Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27fe60d79f | ||
|
|
48285afa65 | ||
|
|
66bacb655c | ||
|
|
6224cc80aa | ||
|
|
cb0092e343 | ||
|
|
0905884ab5 | ||
|
|
d8221325fa | ||
|
|
0cf47f5851 | ||
|
|
063ce7c06d | ||
|
|
173837314b | ||
|
|
3871851962 | ||
|
|
025baa8fb7 | ||
|
|
d6d4566451 | ||
|
|
964a0fc36d | ||
|
|
fb1d838085 | ||
|
|
99db7582b0 | ||
|
|
15f001ad0b | ||
|
|
186ac22e29 | ||
|
|
fc68af9660 | ||
|
|
b675eb6189 | ||
|
|
82b8e1fa04 | ||
|
|
6e8bea1cba | ||
|
|
8739d4953c | ||
|
|
c17c82b79a | ||
|
|
cb0b20f791 | ||
|
|
2198414245 | ||
|
|
d718dd16f8 | ||
|
|
128ec277d5 | ||
|
|
18477898e0 | ||
|
|
9f19f047d2 | ||
|
|
e21b5903c2 | ||
|
|
17529c8cb1 | ||
|
|
36905f11cc | ||
|
|
722b640c28 | ||
|
|
067b865f97 | ||
|
|
c925a9c94c | ||
|
|
899e8f3da4 | ||
|
|
e10183f2a8 | ||
|
|
00daef8f89 | ||
|
|
94980446c9 | ||
|
|
c2ac5feecb | ||
|
|
97afeaccf0 | ||
|
|
b4b980d9a1 | ||
|
|
9de01af92d | ||
|
|
d896a0ac84 | ||
|
|
f80dd1eeff | ||
|
|
19ddebb3b9 |
@@ -1,34 +1,33 @@
|
||||
---
|
||||
name: publish-extension
|
||||
description: Use when releasing the Cline VS Code extension — stable (currently the combined legacy+next A/B VSIX via ext-vscode-ab-package), nightly (ext-vscode-publish-nightly), or a legacy-branch hotfix (ext-vscode-publish-legacy). Guides version selection, changelog, PostHog rollout-flag coordination, workflow dispatch, environment approvals, tagging, and post-publish verification, plus the eventual cutover to publishing the SDK extension standalone.
|
||||
description: Use when releasing the Cline VS Code extension — stable (standalone SDK build of main via ext-vscode-publish-stable), nightly (ext-vscode-publish-nightly, manual dispatch), or an emergency legacy-branch hotfix (ext-vscode-publish-legacy). Guides version selection, changelog, workflow dispatch, environment approvals, tagging, post-publish verification, and the remaining retirement of the finished A/B rollout machinery.
|
||||
---
|
||||
|
||||
# VS Code Extension Release
|
||||
|
||||
Use this skill when the user asks to release, publish, or ship the VS Code extension — stable, nightly, or a legacy hotfix — or to dial the rollout, or to cut over to the SDK extension permanently.
|
||||
Use this skill when the user asks to release, publish, or ship the VS Code extension — stable, nightly, or an emergency legacy hotfix — or to retire the leftover A/B rollout machinery.
|
||||
|
||||
> Working directory: repo root. All workflows are dispatched from `main` (GitHub requires the workflow file on the default branch; each workflow checks out the refs it actually builds).
|
||||
|
||||
## The current era: combined A/B rollout
|
||||
## The current era: standalone SDK extension from `main`
|
||||
|
||||
We are mid-migration from the legacy (npm, pre-SDK) extension to the next (SDK-based, bun) extension. Until the cutover is complete, **the stable and nightly listings ship a combined VSIX**: a small loader + two complete extensions (`next/` built from `main`, `legacy/` built from the `legacy-extension` branch). The loader picks one per window based on the PostHog flag `ext-sdk-bundle-rollout`. Deep-dive docs: `apps/vscode-rollout/README.md` (authoritative) and PR #12253 (design + runbook comments).
|
||||
**The legacy → SDK migration is complete.** The PostHog flag `ext-sdk-bundle-rollout` reached 100% (verified empirically 2026-09-15: 200/200 `/decide` probes returned `true`), so every user on the combined VSIX runs the `next` (SDK, bun) bundle and the `legacy/` half is dead weight. Stable releases now ship a **plain build of `main`** through `ext-vscode-publish-stable.yml`. The combined A/B path (`ext-vscode-ab-package.yml`) is no longer used for releases and is pending deletion — see "Retiring the A/B machinery" at the bottom for what is still left to clean up and the one caveat (leave the flag at 100%).
|
||||
|
||||
Endgame (see "Cutover" at the bottom): once the next bundle is trusted at 100%, stable goes back to a plain build of `main` via `ext-vscode-publish-stable.yml` and all the legacy/rollout machinery is retired.
|
||||
History, for context only: the A/B era ran `4.1.0` → `4.1.17` (Jul–Sep 2026). Design docs remain at `apps/vscode-rollout/README.md` and PR #12253 until that directory is removed.
|
||||
|
||||
### The listings and the workflows
|
||||
|
||||
| Channel | Marketplace ID | Workflow | Trigger | Version |
|
||||
|---|---|---|---|---|
|
||||
| Stable (combined) | `saoudrizwan.claude-dev` | `ext-vscode-ab-package.yml` | dispatch only; `publish` input defaults false | manual input (semver, e.g. `4.1.0`) |
|
||||
| Nightly (combined) | `saoudrizwan.cline-nightly` | `ext-vscode-publish-nightly.yml` | cron 12:00 UTC + dispatch | auto `<major>.<minor>.<unix-ts>` from main's `apps/vscode/package.json` |
|
||||
| Legacy hotfix (standalone) | `saoudrizwan.claude-dev` | `ext-vscode-publish-legacy.yml` | dispatch | from `apps/vscode/package.json` on `legacy-extension` |
|
||||
| Stable standalone (post-cutover) | `saoudrizwan.claude-dev` | `ext-vscode-publish-stable.yml` | dispatch | from `apps/vscode/package.json` on `main` |
|
||||
| **Stable** | `saoudrizwan.claude-dev` | `ext-vscode-publish-stable.yml` | dispatch, from `main` | `apps/vscode/package.json` on `main`; tag `v<version>` must match |
|
||||
| Nightly | `saoudrizwan.cline-nightly` | `ext-vscode-publish-nightly.yml` | **manual dispatch only** (cron deliberately removed) | auto `<major>.<minor>.<unix-ts>` from main's `apps/vscode/package.json` |
|
||||
| Legacy hotfix (emergency only) | `saoudrizwan.claude-dev` | `ext-vscode-publish-legacy.yml` | dispatch | `apps/vscode/package.json` on `legacy-extension` |
|
||||
|
||||
All three publish paths gate on tests before publishing: nightly and ab-package run the reusable bun suite (`ext-vscode-test.yml`, tests `main`) — ab-package additionally runs the legacy branch's npm suite — and the legacy workflow inlines the npm suite. Environment gates: stable paths use `publish` → `Publish` environment (required reviewers approve in the Actions UI); nightly uses `PublishNightly` (branch policy only, no reviewers — a reviewer requirement would block the cron).
|
||||
Stable runs the reusable bun suite (`ext-vscode-test.yml`, tests `main`) before an environment-gated publish job (`publish` environment — required reviewers approve in the Actions UI). Nightly uses `PublishNightly` (branch policy only). Nightly **still builds the combined loader VSIX** (loader + `next/` + `legacy/`) until it is converted back to a plain build — that conversion is on the retirement list below.
|
||||
|
||||
## Golden rules (read before any release)
|
||||
|
||||
1. **One listing, one version line.** `claude-dev` is published from multiple workflows/branches. Every stable publish must use a version **strictly above the highest version ever published to the listing from any branch** — marketplace versions are monotonic and cannot be unpublished (supersede, never delete). Check what's live first:
|
||||
1. **One listing, one version line.** `claude-dev` has been published from multiple workflows and branches. Every stable publish must use a version **strictly above the highest version ever published to the listing from any branch** — marketplace versions are monotonic and cannot be unpublished (supersede, never delete). Check what's live first:
|
||||
|
||||
```bash
|
||||
curl -s -X POST "https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery" \
|
||||
@@ -37,13 +36,123 @@ All three publish paths gate on tests before publishing: nightly and ab-package
|
||||
| python3 -c "import json,sys; v=json.load(sys.stdin)['results'][0]['extensions'][0]['versions'][0]; print(v['version'], v['lastUpdated'])"
|
||||
```
|
||||
|
||||
`ext-vscode-ab-package` also enforces this automatically for `publish=true` runs: a preflight job validates the version format (plain `X.Y.Z`) and hard-fails unless it exceeds the live Marketplace version, and the publish job re-checks right before publishing (the approval wait can last days — a legacy hotfix landing in between is caught). Still run the query yourself when *choosing* the version.
|
||||
**`ext-vscode-publish-stable` has no marketplace-monotonicity preflight** (that check only ever lived in the retired ab-package workflow), so this query is the only guard. The `legacy-extension` branch sits at `4.0.12`, so it cannot collide with the `4.1.x` line, but a legacy hotfix would have to be numbered above the live stable version (see the emergency section).
|
||||
|
||||
2. **Check the flag BEFORE any stable combined publish.** `ext-sdk-bundle-rollout` is **shared between nightly and stable** — the loader sends only a machine id to `/decide`, no channel property, so there is no per-channel targeting. If the flag is high (nightly dogfooding) and you publish stable, stable users get the next bundle at that same percentage. Verify the effective percentage empirically (no PostHog admin needed — sample `/decide` with random ids using the key inlined in any shipped loader):
|
||||
2. **Tag == package version, enforced.** The workflow reads `apps/vscode/package.json`, requires the `tag` input to equal `v<that version>`, and hard-fails otherwise. Bump the version on `main` first.
|
||||
|
||||
3. **Changelog lives at the repo ROOT** (`CHANGELOG.md`) — not `apps/vscode/CHANGELOG.md` (doesn't exist). The workflow hard-fails unless the first `## [` heading is exactly `## [<version>]`. The section body becomes the GitHub release notes and the Slack post (Slack copy is trimmed to 3000 chars with a link out; the release body stays whole).
|
||||
|
||||
4. **Ask before pushing** commits or tags. **Never approve the `publish` environment gate yourself via `gh api`** — hand the maintainer the run URL to click "Review deployments".
|
||||
|
||||
5. **Concurrency**: the workflow groups on the tag with `cancel-in-progress: false`. A publish run left `waiting` on approval blocks every later dispatch of the same tag until cancelled (`gh run cancel <id>`).
|
||||
|
||||
## Stable release — the current path
|
||||
|
||||
### Pre-flight
|
||||
|
||||
```bash
|
||||
# 1. What's live (rule 1) → pick <VERSION> strictly above it (normally patch bump).
|
||||
# 2. Confirm main's package.json is at the *previous* published version, i.e. the repo
|
||||
# reflects the live line and nothing unreleased is already bumped:
|
||||
node -p "require('./apps/vscode/package.json').version"
|
||||
# 3. What's in the release:
|
||||
git fetch origin main --tags
|
||||
git log v<PREV>..origin/main --oneline --no-merges -- apps/vscode sdk/packages
|
||||
```
|
||||
|
||||
The CLI/SDK notes are the best starting point for the extension notes — the extension bundles `@cline/*` from source, so an SDK release in the same window ships here too. Read `sdk/CHANGELOG.md` for the matching SDK version and translate what's extension-visible; skip CLI-only and desktop-only items.
|
||||
|
||||
### Release prep on `main` (PR, not direct push)
|
||||
|
||||
- Bump `apps/vscode/package.json` → `<VERSION>`.
|
||||
- Prepend `## [<VERSION>]` to root `CHANGELOG.md` with the approved notes.
|
||||
- Side effect of the bump: nightly versions become `<major>.<minor>.<unix-ts>` of the new base — harmless (separate listing, still monotonic).
|
||||
|
||||
Optional local rehearsal of the exact packaging step (the workflow has no dry-run input, and the build runs inside the gated publish job, so this is the only pre-approval check):
|
||||
|
||||
```bash
|
||||
bun install --frozen-lockfile && bun run build:sdk
|
||||
cd apps/vscode && npx @vscode/vsce package --no-dependencies --allow-package-secrets sendgrid --out /tmp/rehearsal.vsix
|
||||
# vsce runs vscode:prepublish → `bun run package` (check-types + build:webview + lint + esbuild --production),
|
||||
# i.e. the same build the workflow performs. Telemetry env is NOT set locally, so expect
|
||||
# telemetry to be dark in this artifact — that is fine for a build rehearsal, not for shipping.
|
||||
```
|
||||
|
||||
### Dispatch
|
||||
|
||||
```bash
|
||||
gh workflow run ext-vscode-publish-stable.yml --ref main \
|
||||
-f release-type=release \
|
||||
-f auto_create_tag_from_main=true \
|
||||
-f tag=v<VERSION>
|
||||
gh run list --workflow=ext-vscode-publish-stable.yml --limit 1 --json databaseId,url,status
|
||||
```
|
||||
|
||||
What the run does, in order: test gate on `main` → publish job checks out `main`, **creates and pushes `v<VERSION>` at the tested SHA** (auto-create mode; refuses if the tag already exists elsewhere) → `bun install --frozen-lockfile` → `bun run build:sdk` → asserts the `better-sqlite3` native binary → verifies tag/version/changelog/PATs → `vsce package` → `bun run publish:marketplace` (vsce publish **and** `npx ovsx publish`, both `--no-dependencies`) → GitHub release with the `.vsix` attached → Slack post. The publish job waits for `publish` environment approval before any of that. Check what a run is waiting on:
|
||||
|
||||
```bash
|
||||
gh api repos/cline/cline/actions/runs/<run-id>/pending_deployments
|
||||
```
|
||||
|
||||
`release-type=pre-release` publishes to the pre-release channel of the same listing; it is a real publish, not a rehearsal.
|
||||
|
||||
### Post-publish
|
||||
|
||||
1. Verify both registries serve the new version (expect minutes-to-an-hour of Marketplace validation lag after "Published" appears in the logs):
|
||||
|
||||
```bash
|
||||
# Marketplace: query from rule 1
|
||||
curl -s "https://open-vsx.org/api/saoudrizwan/claude-dev" | python3 -c "import json,sys; d=json.load(sys.stdin); print(d['version'], d['timestamp'])"
|
||||
```
|
||||
|
||||
2. Verify the bookkeeping landed: `git fetch --tags && git tag --list 'v<VERSION>'`, `gh release view v<VERSION>`, Slack post in the release channel. Tag creation happens **before** the build in this workflow, so a tag-push failure fails the run early (no publish) rather than leaving a published-but-untagged release. Known cause: the built commit touches `.github/workflows/**` (default token cannot create such refs). Workaround: create and push the tag yourself at `origin/main` HEAD (ask first), then re-dispatch with `auto_create_tag_from_main=false` from `main` — the workflow requires the existing tag to point at the exact SHA it tested.
|
||||
|
||||
3. Artifact check (`gh run download <run-id>` or the release asset): `package.json` inside is `saoudrizwan.claude-dev@<VERSION>`; `grep -c 'process.env.TELEMETRY_SERVICE_API_KEY' extension/dist/extension.js` must be **0** (a leftover literal means the build ran without its env and telemetry is silently dead). `CLINE_ROLLOUT_VARIANT` is defined to `""` for ordinary builds by `apps/vscode/esbuild.mjs`, so no literal is expected and telemetry carries no `extension_variant` — correct for a standalone build.
|
||||
|
||||
4. Monitor errors on `extension_version = '<VERSION>'` in `otel.otel_logs` (stable cohort is cleanly separable — nightly versions are timestamps). Metabase dashboards 17 (task error rate) and 19 (error deep dive).
|
||||
|
||||
## Nightly release
|
||||
|
||||
**Manual dispatch only.** The cron was removed on purpose: the `PublishNightly` environment made scheduled runs sit `waiting`, hold the concurrency group, and silently cancel every later scheduled run behind them. A stale nightly listing is therefore expected, not a bug.
|
||||
|
||||
```bash
|
||||
gh workflow run ext-vscode-publish-nightly.yml --ref main # real publish
|
||||
gh workflow run ext-vscode-publish-nightly.yml --ref main -f dry-run=true # artifact only
|
||||
```
|
||||
|
||||
No changelog/version prep — the version is computed. Verify with the Marketplace query against `saoudrizwan.cline-nightly`. Until converted, nightly still ships the combined loader VSIX with a `legacy/` bundle built from `legacy-extension`.
|
||||
|
||||
**Red run ≠ failed publish** on this path: its tag-push step runs *after* publishing and fails whenever main's HEAD touches `.github/workflows/**`. If "Published" appears in the logs, the release went out; push the `nightly-main-<UTC ts>-<sha12>` tag manually with user credentials.
|
||||
|
||||
## Emergency rollback
|
||||
|
||||
Preferred: **ship a fixed build of `main` at a higher version** through the stable workflow above. It is the same path, fully gated, and the only rollback that keeps users on the SDK extension.
|
||||
|
||||
Last resort — the legacy hotfix path — still exists but is degraded: `legacy-extension` is the pre-SDK npm codebase, last touched 2026-08-18 at `4.0.12`, and a publish from it would move every user back onto code that is weeks behind. If it is ever needed:
|
||||
|
||||
```bash
|
||||
# On legacy-extension: commit the fix, bump apps/vscode/package.json ABOVE the
|
||||
# live stable version (rule 1 — e.g. 4.1.18 live -> hotfix is 4.1.19, not 4.0.13),
|
||||
# add the matching `## [x.y.z]` entry to root CHANGELOG.md, push.
|
||||
gh workflow run ext-vscode-publish-legacy.yml --ref main -f release-type=release
|
||||
# (the branch is hardcoded to legacy-extension in the workflow)
|
||||
```
|
||||
|
||||
The npm suite runs ungated, the publish job waits on the `publish` environment, the workflow tags and creates the GitHub release itself, and it publishes to Marketplace **and** Open VSX. On that branch use `npm`, never `bun`, and expect the old monolith layout (`apps/vscode/src/core/...`).
|
||||
|
||||
## Retiring the A/B machinery (still to do)
|
||||
|
||||
The rollout is done but the scaffolding is still in the repo. Retire it in this order, each as its own PR:
|
||||
|
||||
1. **Nightly → plain build of `main`**: drop the loader/`legacy-src` stitching from `ext-vscode-publish-nightly.yml` so nightly matches stable. Preserve the `|| 'default'` fallbacks for `inputs.*` while editing.
|
||||
2. Delete `ext-vscode-ab-package.yml` and, once the emergency path above is judged unnecessary, `ext-vscode-publish-legacy.yml`; keep the `legacy-extension` branch for history.
|
||||
3. Remove `apps/vscode-rollout/` and the rollout-only code paths in `apps/vscode/src/services/telemetry/rollout-metadata.ts` (the `extension_variant` metadata and `extension.rollout.bundle_activated` event).
|
||||
4. Optionally port the marketplace-monotonicity preflight from the old ab-package workflow into `ext-vscode-publish-stable.yml` — the only automated guard for rule 1 was retired with it.
|
||||
5. **Archive the PostHog flag last, and not yet.** Machines still on a combined VSIX (`≤ 4.1.17`) consult `ext-sdk-bundle-rollout` on every window load and treat a *deleted* flag as `legacy`. Leave it at 100% until `extension.rollout.bundle_activated` for combined versions flatlines, then archive. Re-verify the percentage empirically before touching it (no PostHog admin needed — the key is inlined in any shipped combined loader; download the 4.1.17 VSIX from the Marketplace `vspackage` URL, `gunzip`, `unzip`, `grep -o 'phc_[A-Za-z0-9]*' extension/extension.js`):
|
||||
|
||||
```bash
|
||||
node -e '
|
||||
const KEY = process.argv[1]; // phc_... extracted from a shipped VSIX loader
|
||||
const KEY = process.argv[1];
|
||||
(async () => {
|
||||
let t = 0, n = 200;
|
||||
for (let i = 0; i < n; i += 20) {
|
||||
@@ -58,129 +167,15 @@ All three publish paths gate on tests before publishing: nightly and ab-package
|
||||
})()' "$KEY"
|
||||
```
|
||||
|
||||
Flag changes are made in the PostHog UI (Cline project). **0% is the kill switch** — the flag is two-way; there is no separate killswitch flag. Dialing down demotes machines back to legacy on their next window reload.
|
||||
|
||||
3. **Ask before pushing** commits or tags. Environment approvals are the maintainer's to give.
|
||||
|
||||
4. **Changelog lives at the repo ROOT** (`CHANGELOG.md`), on the branch being released — not `apps/vscode/CHANGELOG.md` (doesn't exist). The legacy and stable workflows hard-fail unless the first heading is exactly `## [<version>]`.
|
||||
|
||||
5. **Stuck concurrency groups**: `ext-vscode-ab-package` groups on the version with `cancel-in-progress: false`. Only `publish=true` runs wait on environment approval (build-only rehearsals run ungated to completion), but a publish run left `waiting` still blocks every later dispatch of the same version — cancel it (`gh run cancel <id>`) before re-dispatching.
|
||||
|
||||
## Stable release (combined A/B VSIX) — the current stable path
|
||||
|
||||
### Pre-flight
|
||||
|
||||
```bash
|
||||
# 1. What's live, and what version comes next (must exceed it — rule 1)
|
||||
# 2. Flag percentage (rule 2) — decide where it should be for this release
|
||||
# 3. Legacy tip = what the non-promoted cohort will run; confirm it's the shipped hotfix line
|
||||
git fetch origin main legacy-extension
|
||||
git log --oneline -3 origin/legacy-extension
|
||||
|
||||
# 4. Cheap local rehearsal of the most likely build failure: the union manifest
|
||||
# hard-fails if views/viewsContainers/configuration diverged between branches.
|
||||
git show origin/main:apps/vscode/package.json > /tmp/next.json
|
||||
git show origin/legacy-extension:apps/vscode/package.json > /tmp/legacy.json
|
||||
node apps/vscode-rollout/scripts/gen-manifest.mjs --next /tmp/next.json --legacy /tmp/legacy.json --version <VERSION>
|
||||
# Expected warnings only: engines union (takes newer) + walkthrough copy drift.
|
||||
```
|
||||
|
||||
Release prep on `main` (PR, not direct push):
|
||||
- Add `## [<VERSION>]` entry at the top of root `CHANGELOG.md`.
|
||||
- Bump `apps/vscode/package.json` to `<VERSION>` so the repo reflects the published line. Side effect: nightly versions become `<major>.<minor>.<unix-ts>` of the new base — harmless (separate listing, still monotonic).
|
||||
|
||||
### Dispatch
|
||||
|
||||
```bash
|
||||
gh workflow run ext-vscode-ab-package.yml --ref main \
|
||||
-f version=<VERSION> -f next-ref=main -f publish=true
|
||||
# (the legacy bundle always builds from the protected legacy-extension branch;
|
||||
# it is deliberately not an input)
|
||||
# publish=false builds an installable .vsix artifact without publishing and
|
||||
# needs NO environment approval — the ungated build job uploads the artifact
|
||||
# and the run completes.
|
||||
gh run list --workflow=ext-vscode-ab-package.yml --limit 1
|
||||
```
|
||||
|
||||
Preflight (version format + monotonicity) and both test suites run first, then the ungated `build` job packages and uploads the VSIX; for `publish=true` the `publish` job then **waits for `Publish` environment approval** (Actions → run → "Review deployments"). Both bundles build the exact revisions their test gates ran against (branch names are resolved once — commits landing on either branch mid-run or during the approval wait are not picked up); `publish=true` is additionally refused for any `next-ref` other than `main` (the bun gate only tests main — non-main next-refs are for build-only artifact rehearsals). Check what a run is waiting on:
|
||||
|
||||
```bash
|
||||
gh api repos/cline/cline/actions/runs/<run-id>/pending_deployments
|
||||
```
|
||||
|
||||
### Post-publish
|
||||
|
||||
1. Verify the marketplace serves the new version (query from rule 1) — expect minutes-to-an-hour of validation lag after "Published" appears in the logs. Also verify Open VSX:
|
||||
|
||||
```bash
|
||||
curl -s "https://open-vsx.org/api/saoudrizwan/claude-dev" | python3 -c "import json,sys; d=json.load(sys.stdin); print(d['version'], d['timestamp'])"
|
||||
```
|
||||
2. Tag, GitHub Release (with the .vsix attached), and the Slack release-bot post happen **automatically** after a real publish (all `continue-on-error` — the publish itself already succeeded, so bookkeeping failures leave the run green). Verify they landed; the known failure is the tag push when the built commit touches `.github/workflows/**` (default token cannot create such refs — no grantable permission fixes it). Manual fallback:
|
||||
|
||||
```bash
|
||||
git tag v<VERSION> <main-sha-built> # ask before pushing
|
||||
git push origin v<VERSION>
|
||||
gh release create v<VERSION> --title "v<VERSION>" --notes "<changelog section>" <path-to.vsix>
|
||||
```
|
||||
|
||||
A real publish also **hard-fails early** if root `CHANGELOG.md` on the built main revision doesn't start with `## [<VERSION>]` — the release prep PR must be merged before dispatching.
|
||||
|
||||
3. Thorough artifact check (`gh run download <run-id>`): union `package.json` is `saoudrizwan.claude-dev@<VERSION>`, `next/package.json` and `legacy/package.json` carry the SAME version, `grep -c 'phc_' extension/extension.js` ≥ 1 (loader key inlined), no leftover `process.env.TELEMETRY_SERVICE_API_KEY` / `process.env.CLINE_ROLLOUT_VARIANT` literals in either bundle's dist (leftovers = a build ran without its env and telemetry is silently dead).
|
||||
4. Monitor: `extension.rollout.bundle_activated` in `otel.otel_logs` filtered to `extension_version = '<VERSION>'` (stable cohort is cleanly separable — nightly versions are timestamps). Watch the next/legacy ratio and the crash-fallback rate; Metabase dashboards 17 (rollout + task error rate) and 19 (error deep dive). `extension.rollout.loader_decision` (incl. `double_failure`) is PostHog-only, not in ClickHouse.
|
||||
5. Dial the flag per the rollout plan (e.g. 0% at publish → 1% → up), verifying each change with the probe from rule 2. Announce demotions ahead of time — dialing down also demotes nightly dogfooders unless they set `"cline-nightly.rollout.bundleOverride": "next"`.
|
||||
|
||||
### Known caveats of this path
|
||||
|
||||
- **`engines.vscode` unions upward** (main's floor wins, e.g. `^1.101.0` vs legacy's `^1.84.0`): users on older VS Code are never offered the combined VSIX. Fail-safe during rollout; must be resolved before 100%.
|
||||
- A red run can still mean a successful publish on paths that tag (see Gotchas).
|
||||
|
||||
## Nightly release
|
||||
|
||||
Happens automatically (cron 12:00 UTC). Manual cut:
|
||||
|
||||
```bash
|
||||
gh workflow run ext-vscode-publish-nightly.yml --ref main # real publish
|
||||
gh workflow run ext-vscode-publish-nightly.yml --ref main -f dry-run=true # artifact only
|
||||
gh run watch <run-id> --exit-status --interval 60
|
||||
```
|
||||
|
||||
No changelog/version prep — the version is computed. Verify with the marketplace query against `saoudrizwan.cline-nightly`.
|
||||
|
||||
**Red run ≠ failed publish**: the final tag-push step fails whenever main's HEAD touches `.github/workflows/**` (default token cannot create such refs). If "Published" appears in the logs, the release went out; push the `nightly-main-<UTC ts>-<sha12>` tag manually with user credentials.
|
||||
|
||||
## Legacy hotfix release (and emergency full rollback)
|
||||
|
||||
For shipping a fix on the `legacy-extension` branch — or as the **structural rollback** from a bad combined stable VSIX: a standalone legacy publish at a higher version supersedes the combined VSIX entirely (loader and all) for every user. (For "next bundle misbehaving" you don't need this — dial the flag to 0% instead.)
|
||||
|
||||
```bash
|
||||
# On legacy-extension: commit the fix, bump apps/vscode/package.json ABOVE the
|
||||
# highest version ever published to the listing (rule 1 — including combined
|
||||
# versions, e.g. combined 4.1.0 live -> hotfix is 4.1.1, not 4.0.13),
|
||||
# add the matching `## [x.y.z]` entry to root CHANGELOG.md, push.
|
||||
gh workflow run ext-vscode-publish-legacy.yml --ref main \
|
||||
-f release-type=release
|
||||
# (the branch is hardcoded to legacy-extension in the workflow; it is
|
||||
# deliberately not an input)
|
||||
```
|
||||
|
||||
npm test suite runs ungated; the publish job waits on the `Publish` environment. This workflow derives + pushes the `v<version>` tag itself and creates the GitHub release — no manual tagging. Publishes to Marketplace **and** Open VSX. The branch is the npm codebase: use `npm`, never `bun`, and expect the old monolith layout (`apps/vscode/src/core/...`).
|
||||
|
||||
## Cutover: retiring the A/B machinery (the endgame)
|
||||
|
||||
When the next bundle has held at 100% long enough to trust:
|
||||
|
||||
1. **Resolve the engines floor**: decide whether stranding VS Code < main's `engines.vscode` on the last combined version is acceptable, or lower main's floor first.
|
||||
2. Bump `apps/vscode/package.json` on `main` above everything ever published; root `CHANGELOG.md` entry to match (both are enforced by the workflow).
|
||||
3. Ship standalone from main: `gh workflow run ext-vscode-publish-stable.yml --ref main` — tests main, tags `v<version>` itself, creates the GitHub release, publishes Marketplace + Open VSX.
|
||||
4. Watch the same rollout telemetry through the transition — `extension_variant` disappears from events as users leave combined builds, which is itself the adoption signal.
|
||||
5. Only after the standalone version dominates: retire `legacy-extension` (keep for history), delete `ext-vscode-publish-legacy.yml` and `ext-vscode-ab-package.yml`, convert the nightly workflow back to a plain build of main, remove `apps/vscode-rollout/`, and archive the `ext-sdk-bundle-rollout` flag in PostHog (harmless to machines still on a combined VSIX: absent flag fails safe to... nothing changing until they update, but their loader treats a deleted flag as legacy — leave the flag at 100% until combined-VSIX activations flatline, then archive).
|
||||
6. Update this skill: delete the combined-era sections and keep the standalone flow.
|
||||
6. Update this skill: delete this section and the combined-loader notes under Nightly.
|
||||
|
||||
## Gotchas index
|
||||
|
||||
- `inputs.*` are empty strings on `schedule` events — preserve `|| 'default'` fallbacks when editing the nightly workflow.
|
||||
- `bun run package` in `apps/vscode` does not build `@cline/*` workspace deps — fresh checkouts need `bun run build:sdk` first (workflows handle this).
|
||||
- `bun run package` in `apps/vscode` does not build `@cline/*` workspace deps — fresh checkouts need `bun run build:sdk` first (the workflows handle this).
|
||||
- Every ext workflow pins `bun-version: 1.3.14` while the root `packageManager` is `bun@1.3.13`. This is consistent across all of them and has shipped fine — don't "fix" it in one workflow alone.
|
||||
- The publish job pins **Node 22** on purpose: Node 24 / npm 11 can make vsce's `npm list` detection fail with `ELSPROBLEMS` during packaging. `setup-bun` provides no Node runtime, and the publish scripts and `npx ovsx` need one.
|
||||
- `gh run watch --exit-status` has returned exit 0 on a failed run. Always confirm with `gh run view <id> --json status,conclusion` before acting on a result.
|
||||
- Job-level `if:` ref checks in workflow YAML are advisory (a dispatched branch runs its own copy of the file); the enforced boundary is each environment's deployment-branch policy in repo settings.
|
||||
- Marketplace PATs (`VSCE_PAT`/`OVSX_PAT`) are only mounted into publish steps; neither publish workflow has an untrusted trigger surface.
|
||||
- Environment-approval runs left waiting don't time out quickly — they sit for days and (for ab-package publish runs) block their version's concurrency group.
|
||||
- Local forcing for manual testing: `CLINE_BUNDLE_OVERRIDE=next|legacy` env (launch VS Code fresh from a terminal) or the `<prefix>.rollout.bundleOverride` setting + reload; both report as `override` in telemetry so they don't pollute cohort data.
|
||||
- Marketplace PATs (`VSCE_PAT`/`OVSX_PAT`) are only mounted into publish steps; no publish workflow has an untrusted trigger surface.
|
||||
- Environment-approval runs left waiting don't time out quickly — they sit for days and block their tag's concurrency group.
|
||||
- Open VSX has held a first-time publish in moderation before (logs say "Published", API 404s for hours). Verify with the API query rather than the log line.
|
||||
|
||||
@@ -154,6 +154,8 @@ jobs:
|
||||
OTEL_TELEMETRY_ENABLED: ${{ secrets.OTEL_TELEMETRY_ENABLED }}
|
||||
OTEL_LOGS_EXPORTER: otlp
|
||||
OTEL_METRICS_EXPORTER: otlp
|
||||
OTEL_TRACES_EXPORTER: otlp
|
||||
CLINE_TRACE_RECORD_CONTENT: "true"
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL: ${{ secrets.OTEL_EXPORTER_OTLP_PROTOCOL }}
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: ${{ secrets.OTEL_EXPORTER_OTLP_ENDPOINT }}
|
||||
OTEL_EXPORTER_OTLP_HEADERS: ${{ secrets.OTEL_EXPORTER_OTLP_HEADERS }}
|
||||
@@ -423,6 +425,8 @@ jobs:
|
||||
OTEL_TELEMETRY_ENABLED: ${{ secrets.OTEL_TELEMETRY_ENABLED }}
|
||||
OTEL_LOGS_EXPORTER: otlp
|
||||
OTEL_METRICS_EXPORTER: otlp
|
||||
OTEL_TRACES_EXPORTER: otlp
|
||||
CLINE_TRACE_RECORD_CONTENT: "true"
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL: ${{ secrets.OTEL_EXPORTER_OTLP_PROTOCOL }}
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: ${{ secrets.OTEL_EXPORTER_OTLP_ENDPOINT }}
|
||||
OTEL_EXPORTER_OTLP_HEADERS: ${{ secrets.OTEL_EXPORTER_OTLP_HEADERS }}
|
||||
|
||||
@@ -284,6 +284,8 @@ jobs:
|
||||
OTEL_TELEMETRY_ENABLED: ${{ secrets.OTEL_TELEMETRY_ENABLED }}
|
||||
OTEL_LOGS_EXPORTER: otlp
|
||||
OTEL_METRICS_EXPORTER: otlp
|
||||
OTEL_TRACES_EXPORTER: otlp
|
||||
CLINE_TRACE_RECORD_CONTENT: "true"
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL: ${{ secrets.OTEL_EXPORTER_OTLP_PROTOCOL }}
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: ${{ secrets.OTEL_EXPORTER_OTLP_ENDPOINT }}
|
||||
OTEL_EXPORTER_OTLP_HEADERS: ${{ secrets.OTEL_EXPORTER_OTLP_HEADERS }}
|
||||
|
||||
@@ -161,6 +161,8 @@ jobs:
|
||||
OTEL_TELEMETRY_ENABLED: ${{ secrets.OTEL_TELEMETRY_ENABLED }}
|
||||
OTEL_LOGS_EXPORTER: otlp
|
||||
OTEL_METRICS_EXPORTER: otlp
|
||||
OTEL_TRACES_EXPORTER: otlp
|
||||
CLINE_TRACE_RECORD_CONTENT: "true"
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL: ${{ secrets.OTEL_EXPORTER_OTLP_PROTOCOL }}
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: ${{ secrets.OTEL_EXPORTER_OTLP_ENDPOINT }}
|
||||
OTEL_EXPORTER_OTLP_HEADERS: ${{ secrets.OTEL_EXPORTER_OTLP_HEADERS }}
|
||||
|
||||
@@ -272,6 +272,8 @@ jobs:
|
||||
OTEL_TELEMETRY_ENABLED: ${{ secrets.OTEL_TELEMETRY_ENABLED }}
|
||||
OTEL_LOGS_EXPORTER: otlp
|
||||
OTEL_METRICS_EXPORTER: otlp
|
||||
OTEL_TRACES_EXPORTER: otlp
|
||||
CLINE_TRACE_RECORD_CONTENT: "true"
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL: ${{ secrets.OTEL_EXPORTER_OTLP_PROTOCOL }}
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: ${{ secrets.OTEL_EXPORTER_OTLP_ENDPOINT }}
|
||||
OTEL_EXPORTER_OTLP_HEADERS: ${{ secrets.OTEL_EXPORTER_OTLP_HEADERS }}
|
||||
|
||||
@@ -1,5 +1,46 @@
|
||||
# Changelog
|
||||
|
||||
## [4.1.19]
|
||||
|
||||
### Added
|
||||
|
||||
- Images attached to a model that cannot read them are now flagged instead of silently discarded. Thumbnails get a warning badge and the composer explains that the images will be ignored, with a button to switch to an image-capable model. Previously the thumbnail looked normal and the image was replaced with a text placeholder just before the request, so there was no way to tell it had been dropped. Model info and the attachment picker also report image support accurately for models that declare text-only input without listing capabilities.
|
||||
|
||||
### Changed
|
||||
|
||||
- Cline's logo and icons have been refreshed throughout the extension, including the activity bar and panel icons.
|
||||
- The W&B Inference provider is now listed as CoreWeave, with its sign-up and API-key links updated to match CoreWeave's current documentation.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Long tasks now compact when they actually need to rather than running out of room. The trigger compared a character-based estimate of the conversation (~3 characters per token) against the model's context limit, so content that tokenizes far denser than that — disassembly, image dumps, minified sources — could fill the real context window while the estimate stayed under the threshold and compaction never fired; the turn was then squeezed down to a handful of output tokens. The trigger now also uses the token count the provider itself reports, and how much history is kept is scaled by how far off the estimate turned out to be. The summarizer's output budget also doubled, so a model that reasons before answering can no longer spend the whole budget thinking and return no summary at all.
|
||||
- On Windows, opening a repository that contains a file named `rg.exe`, `git.exe`, or `powershell.exe` no longer runs that file in place of the real program. Bare program names were resolved through the workspace directory before PATH, so a planted executable ran with your privileges as soon as the workspace was indexed. Cline now sets Windows' `NoDefaultCurrentDirectoryInExePath` opt-out at startup, in both the VS Code extension and the JetBrains core. Processes Cline launches inherit it, so inside a Command Prompt shell a program in the current directory now needs `.\` as it already does in PowerShell.
|
||||
- A model turn that fails mid-stream with a transient provider error is now retried up to three times with backoff instead of ending the task. A single rate-limit response forwarded by a gateway previously surfaced as a failed task. A turn that has already streamed output is never retried, so nothing is duplicated.
|
||||
- Terminal commands that succeed without printing anything (`git add -A` on a clean tree, for example) are now reported as empty output. They were treated as a shell-integration failure, which fed the model a snapshot of unrelated terminal scrollback prefixed with a warning that the output could not be captured, so silent commands intermittently looked like failures.
|
||||
- Checkpoints no longer re-hash every untracked file on each message. In workspaces holding large untracked directories this delayed every message by seconds to minutes; a persistent per-task index now lets git skip files it has already seen.
|
||||
- `run_commands` no longer hangs until its timeout after a command that backgrounds a child process. The command had finished, but the backgrounded process held the output pipes open.
|
||||
- `apply_patch` no longer silently overwrites an existing file when the model uses "Add File" on a path that already exists. The file's contents were replaced with no error and no record of what was lost.
|
||||
- PowerShell commands the model wrapped in another `powershell -Command "..."` are no longer parsed twice. The outer shell consumed `$_` before the inner command ran, so pipelines using it emitted an error for every item processed while still reporting success.
|
||||
- Opening your home directory as a workspace no longer drives the extension host to exhaustion. Typing an `@` mention indexed every file beneath it and re-ranked the whole index on each keystroke.
|
||||
- The "Supports Images" checkbox in OpenAI Compatible model settings now stays where you put it. The checkbox rendered the last committed value, and the re-sync that arrived during the save round-trip was re-emitted as a change event that wrote the old value back over your edit.
|
||||
- The error shown to the model when an `editor` call omits the text to replace now names the file and explains how to recover. The previous message was terse enough that some models re-sent the identical call until the task stopped.
|
||||
- Credentials are now stripped of invisible characters when saved, not only when pasted, and the cleanup covers AWS, GCP, and SAP fields and custom header values in addition to API keys.
|
||||
- Cline Pass now defaults to a model from your subscription rather than a free one. Its model list contains both tiers and the default was whichever model was published most recently, so a subscriber who never picked a model could be left on the free tier.
|
||||
- Cline Pass and free models now show no cost rather than the underlying market price, which is not what you are billed for.
|
||||
- Model pickers now fall back to the full Recommended, Free, and Subscribed lists when the models endpoint cannot be reached. The offline fallback was a short hardcoded list with no subscription tier at all.
|
||||
- Model lists for providers sharing the built-in catalog now refresh from the live catalog, so newly published models appear without an extension update, with timeouts so an unresponsive provider endpoint cannot stall the list.
|
||||
- Claude Code and OpenCode no longer ask for an API key they never read. Both authenticate from their own local CLI's credentials, but they were treated as key-based providers; the workaround was storing a dummy key. A missing CLI on `PATH` now warns rather than blocking, since a configured path or bundled binary also works.
|
||||
- The OpenAI Codex (ChatGPT subscription) model list no longer offers models the backend rejects, and Codex context limits are applied to every Codex model instead of being inherited from the OpenAI API catalog, which inflated both the context budget and the usage figures derived from it.
|
||||
- Models served by OpenCode Go are now sent over the wire protocol each one actually speaks. Every model was sent over the OpenAI chat-completions adapter, so models on that endpoint speaking other protocols failed or misbehaved.
|
||||
- Task history no longer goes blank when a task spawns many subagents. Subagent rows crowded out the tasks that created them, hiding the parent task and everything older.
|
||||
- Langfuse tracing, when configured, is now limited to the Cline and Cline Pass providers. The provider was ignored, so prompts and responses sent to third-party and bring-your-own-key providers were exported too.
|
||||
|
||||
### Changed
|
||||
|
||||
- Web search is now enabled by default on models that support it, outside YOLO mode. It can still be turned off in settings, and a settings file that cannot be read leaves it disabled rather than silently on.
|
||||
- The `run_commands` tool description now names the PowerShell edition in use — `Windows PowerShell (powershell.exe)` versus `PowerShell (pwsh.exe)` — quotes its guidance against that executable, and tells the model to run commands directly rather than wrapping them in another shell invocation. It also no longer describes the environment as Windows when `pwsh` is the configured shell on macOS or Linux.
|
||||
- Refreshed the built-in model catalog. Adds four providers (Infer by Flow7, Melious, NaN, and Wallaby) and takes the catalog from 5,788 to 6,079 models. This is a wide refresh: the resolved default model changes for 44 providers, most of them landing on DeepSeek V4.1 Flash — among them Hugging Face, Fireworks, Requesty, Nebius, Cortecs, CrossModel, DigitalOcean, Eden AI, and OpenCode Go. Gemini and Vertex now resolve to Gemini 3.8 Flash, GitHub Copilot and Vivgrid to GPT-6 Astra, and NVIDIA to GLM 5.3 Flash. If you use a provider without pinning a model, expect a different default.
|
||||
|
||||
## [4.1.17]
|
||||
|
||||
Everything here lands through the SDK bundle, so it applies to windows running that bundle.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<h1 align="center">Cline</h1>
|
||||
|
||||
<p align="center">
|
||||
The open source coding agent in your IDE, terminal, and desktop.
|
||||
The open source coding agent in your IDE, terminal, & desktop.
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
@@ -63,7 +63,7 @@ Cline as a native app for macOS and Windows.
|
||||
Run agent sessions in any folder, schedule
|
||||
routines, and manage models, plugins, and MCP servers.
|
||||
|
||||
<a href="https://github.com/cline/cline/releases?q=desktop-v&expanded=true">Download for macOS and Windows</a>
|
||||
<a href="https://cline.bot/desktop">Download for macOS and Windows</a>
|
||||
<br><br>
|
||||
|
||||
</td>
|
||||
@@ -182,7 +182,7 @@ const deployTool = createTool({
|
||||
|
||||
const agent = new Agent({ tools: [deployTool], /* ... */ })
|
||||
```
|
||||
...or use [MCP servers](https://github.com/modelcontextprotocol) to connect to databases, query APIs, manage cloud infrastructure, and interact with external systems. Use [community-built servers](https://github.com/modelcontextprotocol/servers) or ask Cline to create custom tools on the fly. In the CLI, manage servers with `cline mcp`.
|
||||
...or use [MCPs](https://github.com/modelcontextprotocol) to connect to databases, query APIs, manage cloud infrastructure, and interact with external systems. Use [community-built servers](https://github.com/modelcontextprotocol/servers) or ask Cline to create custom tools on the fly. In the CLI, manage servers with `cline mcp`.
|
||||
|
||||
## Multi-Agent Teams
|
||||
|
||||
|
||||
@@ -1,5 +1,33 @@
|
||||
# Cline CLI Changelog
|
||||
|
||||
## 3.0.62
|
||||
|
||||
- Introducing Cline Desktop: a native app for working with open-weight models, with task import from Claude Code and Codex, scheduled runs, web search and voice input, and a marketplace for plugins, MCP servers, and skills. The CLI now shows a one-time startup notice pointing at cline.bot/desktop. At most one notice appears per launch, and `CLINE_DISABLE_CLINE_PASS_NOTICE=1` still suppresses all of them
|
||||
- Agent Plugins are now managed through the Hub. Packages under `~/.agents/plugins/*` are discovered and validated, their skills are exposed through the skills tool as `plugin-name:skill-name`, and their MCP servers start without touching `cline_mcp_settings.json`. The config screen lists them separately from Cline Plugins and Space toggles them. Workspace `.agents/plugins` directories are deliberately not scanned, so opening a repo cannot implicitly start repo-controlled MCP servers
|
||||
- A model turn that dies mid-stream with a transient provider error is now retried up to 3 times with backoff instead of failing the run — a single forwarded 429 from OpenRouter previously ended the run with exit 1. A turn that already streamed output is never retried, so nothing is duplicated
|
||||
- Streaming output is no longer throttled by the Hub. Every streamed token was proxied to client hooks as a round trip carrying a full copy of the session, with the agent loop waiting on it
|
||||
- Checkpoints no longer stall every message in workspaces with large untracked directories. Each turn re-hashed every untracked file before the model call, which on multi-GB workspaces blocked messages for seconds to minutes; a persistent per-session snapshot index now lets git skip unchanged files
|
||||
- Fixed `run_commands` hanging until timeout after a command that backgrounds a child process. The command had finished, but the backgrounded child held the output pipes open
|
||||
- Fixed `cline` being OOM-killed when run from your home directory. Typing an `@` mention indexed every file under `$HOME` and re-ranked it on each keystroke
|
||||
- Fixed `apply_patch` silently overwriting an existing file when the model used "Add File" on a path that already exists
|
||||
- Fixed PowerShell commands that the model wrapped in another `powershell -Command "..."` being parsed twice, which stripped `$_` out of pipelines and produced an error per enumerated item while still reporting success. The tool description now also names which PowerShell edition is in use and tells the model not to wrap commands
|
||||
- API keys pasted with an invisible character (BOM, zero-width space) are now cleaned before being saved. They were stored corrupted and the provider's 401 was indistinguishable from a wrong key
|
||||
- Signing in with Claude Code no longer demands an API key it never reads. It authenticates from the `claude` CLI's own credential store, but onboarding treated it as an API-key provider and dropped you into the sign-in wizard; the workaround was storing a dummy key. A missing `claude` on PATH now warns instead of blocking, since a configured path, bundled binary, or npx also works. OpenCode gets the same local-CLI treatment
|
||||
- Web search is now on by default in non-yolo sessions on models that support it
|
||||
- A running Hub on the same core version as your CLI no longer prompts you to update it. Anyone with both the desktop app and the CLI installed saw a "Cline Hub was updated" dialog on every launch that could never resolve
|
||||
- Scheduled runs no longer stall behind each other — one long turn blocked dispatch of every other schedule. Parallelism limits are now enforced at claim time, work resumed after system sleep is no longer started twice, and a schedule created without a timezone uses your local one instead of an implicit default
|
||||
- Session history no longer goes blank when a session spawns many subagents. Child rows crowded out the roots, hiding the parent session and everything older
|
||||
- Fixed TUI toasts being clipped to their first line. The Hub messages that use them are all longer than that, so the keep-Hub reminder never showed the `cline hub upgrade` command it exists to deliver
|
||||
- Cline Pass now defaults to a subscribed model instead of a free one. Its model list mixes both tiers and the default was whichever model shipped most recently, so subscribers who never picked a model were put on the free tier
|
||||
- Cline Pass and free models now show zero cost instead of the upstream market price for requests you are not billed per token for
|
||||
- Model pickers now fall back to the full Recommended, Free, and Subscribed tiers when the models endpoint is unreachable. Previously the offline fallback was six hardcoded models with no subscribed tier at all
|
||||
- The OpenAI Codex (ChatGPT subscription) model list no longer includes models the backend rejects, and Codex context limits are applied to every Codex model instead of being inherited from the OpenAI API catalog, which was inflating the context budget and the usage math
|
||||
- Model lists for all shared-catalog providers now refresh from the live catalog, so newly published models appear without a CLI update, with timeouts so a hung provider endpoint cannot stall the list
|
||||
- Cline Pass now shows as a configured provider after sign-in — it stores credentials under Cline, so one sign-in configured both but only Cline appeared
|
||||
- Fixed OpenCode Go serving several wire protocols behind one URL while every model was sent over the OpenAI chat-completions adapter
|
||||
- Collapsed a nested `undici@5.29.0` (CVE-2026-1525) onto 7.x. The earlier remediation's version-scoped override key was silently ignored by Bun, so a vulnerable copy survived
|
||||
- Refreshed the model catalog. Adds four providers (Infer by Flow7, Melious, NaN, and Wallaby) and takes the bundled catalog from 5,788 to 6,079 models. This is a wide refresh: the resolved default model changes for 44 providers, most of them landing on DeepSeek V4.1 Flash — among them Hugging Face, Fireworks, Requesty, Nebius, Cortecs, CrossModel, DigitalOcean, Eden AI, and OpenCode Go. Gemini and Vertex now resolve to Gemini 3.8 Flash, GitHub Copilot and Vivgrid to GPT-6 Astra, and NVIDIA to GLM 5.3 Flash. If you use any provider without pinning a model, expect a different default
|
||||
|
||||
## 3.0.61
|
||||
|
||||
- Cline now handles a running Hub that is older than your CLI. Instead of quietly talking to a hub executing stale code, you get a prompt showing how many active sessions a replacement would interrupt, with enter-to-replace or escape-to-keep. The replacement drains the Hub first so in-flight turns finish, and a hub too old or wedged to accept the drain is left alone rather than killed
|
||||
|
||||
@@ -109,6 +109,12 @@ const result = await Bun.build({
|
||||
"OTEL_METRICS_EXPORTER",
|
||||
),
|
||||
"process.env.OTEL_LOGS_EXPORTER": defineProcessEnv("OTEL_LOGS_EXPORTER"),
|
||||
"process.env.OTEL_TRACES_EXPORTER": defineProcessEnv(
|
||||
"OTEL_TRACES_EXPORTER",
|
||||
),
|
||||
"process.env.CLINE_TRACE_RECORD_CONTENT": defineProcessEnv(
|
||||
"CLINE_TRACE_RECORD_CONTENT",
|
||||
),
|
||||
"process.env.OTEL_EXPORTER_OTLP_PROTOCOL": defineProcessEnv(
|
||||
"OTEL_EXPORTER_OTLP_PROTOCOL",
|
||||
),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@cline/cli",
|
||||
"displayName": "cline",
|
||||
"version": "3.0.61",
|
||||
"version": "3.0.62",
|
||||
"description": "Autonomous coding agent CLI - capable of creating/editing files, running commands, using the browser, and more",
|
||||
"type": "module",
|
||||
"publishConfig": {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { isMainThread } from "node:worker_threads";
|
||||
import {
|
||||
claimHubDaemonProcess,
|
||||
claimSupervisedConnectorProcess,
|
||||
disableCurrentDirectoryExecutableSearch,
|
||||
disposeAll,
|
||||
initVcr,
|
||||
setConnectorCliLaunchSpec,
|
||||
@@ -21,6 +22,9 @@ import { writeErr } from "./utils/output";
|
||||
// Set CLINE_VCR=record|playback and CLINE_VCR_CASSETTE=<path> to enable.
|
||||
initVcr(process.env.CLINE_VCR);
|
||||
|
||||
// Before any personality below can spawn a child with the workspace as cwd.
|
||||
disableCurrentDirectoryExecutableSearch();
|
||||
|
||||
if (!isMainThread) {
|
||||
// Worker imports of the bundled CLI entrypoint should not start the CLI.
|
||||
} else if (claimHubDaemonProcess()) {
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
// @jsxImportSource @opentui/react
|
||||
import type { ChoiceContext } from "@opentui-ui/dialog";
|
||||
import { useDialogKeyboard } from "@opentui-ui/dialog/react";
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { useCallback, useState } from "react";
|
||||
import { useDialogPalette } from "../tui/hooks/use-theme";
|
||||
import {
|
||||
type DialogDismissKey,
|
||||
isAnyKeyDismiss,
|
||||
} from "../tui/utils/dialog-keys";
|
||||
import { getCliSubscriptionUrl } from "../utils/cline-pass-errors";
|
||||
import open from "../utils/open";
|
||||
import type { CliMigrationNotice } from "./notice";
|
||||
|
||||
/**
|
||||
* Enter opens the subscription page; any other (unmodified) key dismisses the
|
||||
* Enter opens the notice's page; any other (unmodified) key dismisses the
|
||||
* dialog; modifier-held keys are ignored.
|
||||
*
|
||||
* The dialog used to be dismissible only with Esc, but Esc is the least
|
||||
@@ -20,7 +19,7 @@ import type { CliMigrationNotice } from "./notice";
|
||||
* timeout disambiguation, and Windows console input layers are known to
|
||||
* swallow it), which left users stuck behind the promo with no way out.
|
||||
* Modifier-held keys are ignored so that holding Cmd/Ctrl to click the
|
||||
* subscription link never dismisses the dialog mid-click.
|
||||
* link never dismisses the dialog mid-click.
|
||||
*/
|
||||
export function resolveMigrationNoticeKeyAction(
|
||||
key: DialogDismissKey,
|
||||
@@ -36,27 +35,26 @@ export function MigrationNoticeContent(
|
||||
) {
|
||||
const { dialogId, notice, resolve } = props;
|
||||
const palette = useDialogPalette();
|
||||
const subscriptionUrl = useMemo(() => getCliSubscriptionUrl(), []);
|
||||
const [status, setStatus] = useState<string | undefined>();
|
||||
|
||||
const openSubscriptionPage = useCallback(() => {
|
||||
setStatus("Opening ClinePass in your browser...");
|
||||
void open(subscriptionUrl, { wait: false })
|
||||
const openNoticePage = useCallback(() => {
|
||||
setStatus("Opening in your browser...");
|
||||
void open(notice.url, { wait: false })
|
||||
.then(() => {
|
||||
setStatus("Opened ClinePass in your browser.");
|
||||
setStatus("Opened in your browser.");
|
||||
})
|
||||
.catch(() => {
|
||||
setStatus(
|
||||
"Could not open the browser automatically. Use the URL below.",
|
||||
);
|
||||
});
|
||||
}, [subscriptionUrl]);
|
||||
}, [notice.url]);
|
||||
|
||||
useDialogKeyboard((key) => {
|
||||
const action = resolveMigrationNoticeKeyAction(key);
|
||||
if (action === "ignore") return;
|
||||
if (action === "open") {
|
||||
openSubscriptionPage();
|
||||
openNoticePage();
|
||||
return;
|
||||
}
|
||||
resolve(true);
|
||||
@@ -66,20 +64,20 @@ export function MigrationNoticeContent(
|
||||
<box flexDirection="column" paddingX={1} gap={1}>
|
||||
<text fg={palette.act}>{notice.title}</text>
|
||||
<box flexDirection="column">
|
||||
<text selectable>
|
||||
ClinePass is a $9.99/month subscription plan to get access to the
|
||||
latest open-weight coding models with enough quota for day-to-day
|
||||
work, at a much lower cost than paying API costs directly.
|
||||
</text>
|
||||
{notice.body.split("\n").map((line) => (
|
||||
<text key={line} selectable>
|
||||
{line}
|
||||
</text>
|
||||
))}
|
||||
</box>
|
||||
<box flexDirection="row">
|
||||
<text fg={palette.act} selectable>
|
||||
<a href={subscriptionUrl}>{subscriptionUrl}</a>
|
||||
<a href={notice.url}>{notice.url}</a>
|
||||
</text>
|
||||
</box>
|
||||
<box flexDirection="row">
|
||||
<box paddingX={1} backgroundColor={palette.act}>
|
||||
<text fg={palette.textOnSelection}>Open ClinePass</text>
|
||||
<text fg={palette.textOnSelection}>{notice.openLabel}</text>
|
||||
</box>
|
||||
</box>
|
||||
{status && <text fg={palette.muted}>{status}</text>}
|
||||
|
||||
@@ -55,11 +55,42 @@ describe("migration notice", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("does not show after the notice is marked as shown", () => {
|
||||
it("does not show after every notice is marked as shown", () => {
|
||||
const dataDir = createTempDataDir();
|
||||
|
||||
markClineCliMigrationNoticeShown(dataDir);
|
||||
markClineCliMigrationNoticeShown(dataDir, "cline-cli-desktop-launch");
|
||||
|
||||
expect(getClineCliMigrationNotice(dataDir)).toBeUndefined();
|
||||
});
|
||||
|
||||
it("shows the desktop launch notice once the ClinePass intro was shown", () => {
|
||||
const dataDir = createTempDataDir();
|
||||
|
||||
markClineCliMigrationNoticeShown(dataDir);
|
||||
|
||||
const notice = getClineCliMigrationNotice(dataDir);
|
||||
expect(notice?.id).toBe("cline-cli-desktop-launch");
|
||||
expect(notice?.url).toBe("https://cline.bot/desktop");
|
||||
});
|
||||
|
||||
it("shows only one notice per launch", () => {
|
||||
const dataDir = createTempDataDir();
|
||||
|
||||
expect(getClineCliMigrationNotice(dataDir)?.id).toBe(
|
||||
"cline-cli-cline-pass-intro",
|
||||
);
|
||||
});
|
||||
|
||||
it("marks the desktop launch notice as shown by id", () => {
|
||||
const dataDir = createTempDataDir();
|
||||
|
||||
markClineCliMigrationNoticeShown(dataDir);
|
||||
markClineCliMigrationNoticeShown(dataDir, "cline-cli-desktop-launch");
|
||||
|
||||
const rawState = readFileSync(resolveCliNoticeStatePath(dataDir), "utf8");
|
||||
expect(rawState).toContain('"cline-cli-cline-pass-intro": true');
|
||||
expect(rawState).toContain('"cline-cli-desktop-launch": true');
|
||||
expect(getClineCliMigrationNotice(dataDir)).toBeUndefined();
|
||||
});
|
||||
|
||||
@@ -85,7 +116,7 @@ describe("migration notice", () => {
|
||||
).toBeUndefined();
|
||||
});
|
||||
|
||||
it("does not show when ClinePass is already the active provider", () => {
|
||||
it("does not show the ClinePass intro when ClinePass is already the active provider", () => {
|
||||
const dataDir = createTempDataDir();
|
||||
|
||||
expect(
|
||||
@@ -93,8 +124,8 @@ describe("migration notice", () => {
|
||||
dataDir,
|
||||
{},
|
||||
{ activeProviderId: "cline-pass" },
|
||||
),
|
||||
).toBeUndefined();
|
||||
)?.id,
|
||||
).toBe("cline-cli-desktop-launch");
|
||||
});
|
||||
|
||||
it("suppresses the active ClinePass provider even when the provider id has surrounding whitespace", () => {
|
||||
@@ -141,6 +172,8 @@ describe("migration notice", () => {
|
||||
|
||||
const rawState = readFileSync(resolveCliNoticeStatePath(dataDir), "utf8");
|
||||
expect(rawState).toContain("cline-cli-cline-pass-intro");
|
||||
expect(getClineCliMigrationNotice(dataDir)).toBeUndefined();
|
||||
expect(getClineCliMigrationNotice(dataDir)?.id).not.toBe(
|
||||
"cline-cli-cline-pass-intro",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,20 +1,54 @@
|
||||
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { resolveClineDataDir } from "@cline/shared/storage";
|
||||
import { getCliSubscriptionUrl } from "../utils/cline-pass-errors";
|
||||
|
||||
const NOTICE_ID = "cline-cli-cline-pass-intro";
|
||||
export const CLINE_PASS_NOTICE_ID = "cline-cli-cline-pass-intro";
|
||||
const DESKTOP_NOTICE_ID = "cline-cli-desktop-launch";
|
||||
const FORCE_NOTICE_ENV = "CLINE_FORCE_CLINE_PASS_NOTICE";
|
||||
// Historically named for the ClinePass promo; disables every startup notice.
|
||||
const DISABLE_NOTICE_ENV = "CLINE_DISABLE_CLINE_PASS_NOTICE";
|
||||
const DESKTOP_APP_URL = "https://cline.bot/desktop";
|
||||
|
||||
export interface CliMigrationNotice {
|
||||
id: string;
|
||||
title: string;
|
||||
body: string;
|
||||
url: string;
|
||||
openLabel: string;
|
||||
}
|
||||
|
||||
export interface CliMigrationNoticeOptions {
|
||||
activeProviderId?: string;
|
||||
}
|
||||
|
||||
function getClinePassNotice(): CliMigrationNotice {
|
||||
return {
|
||||
id: CLINE_PASS_NOTICE_ID,
|
||||
title: "Try ClinePass",
|
||||
body: "ClinePass is a $9.99/month subscription plan to get access to the latest open-weight coding models with enough quota for day-to-day work, at a much lower cost than paying API costs directly.",
|
||||
url: getCliSubscriptionUrl(),
|
||||
openLabel: "Open ClinePass",
|
||||
};
|
||||
}
|
||||
|
||||
function getDesktopNotice(): CliMigrationNotice {
|
||||
return {
|
||||
id: DESKTOP_NOTICE_ID,
|
||||
title: "Introducing Cline Desktop",
|
||||
body: [
|
||||
"A native app for working with open weights models. Use it with ClinePass and our free models, or BYOK.",
|
||||
"- Import tasks from Claude Code and Codex",
|
||||
"- Run Cline on a regular schedule",
|
||||
"- Use web search tool and voice input",
|
||||
"- Browse Marketplace for plugins, MCPs, and skills",
|
||||
"Available for macOS and Windows.",
|
||||
].join("\n"),
|
||||
url: DESKTOP_APP_URL,
|
||||
openLabel: "Get Cline Desktop",
|
||||
};
|
||||
}
|
||||
|
||||
interface CliNoticeState {
|
||||
shown: Record<string, boolean>;
|
||||
}
|
||||
@@ -84,32 +118,33 @@ export function getClineCliMigrationNotice(
|
||||
if (disableNotice && !forceNotice) {
|
||||
return undefined;
|
||||
}
|
||||
// At most one notice per launch, oldest first, so a user who has already
|
||||
// dismissed the ClinePass intro sees the desktop launch on their next start.
|
||||
if (
|
||||
shouldSuppressClineCliMigrationNoticeForActiveProvider(
|
||||
!shouldSuppressClineCliMigrationNoticeForActiveProvider(
|
||||
options.activeProviderId,
|
||||
env,
|
||||
)
|
||||
) &&
|
||||
(forceNotice || !noticeState.shown[CLINE_PASS_NOTICE_ID])
|
||||
) {
|
||||
return undefined;
|
||||
return getClinePassNotice();
|
||||
}
|
||||
if (noticeState.shown[NOTICE_ID] && !forceNotice) {
|
||||
return undefined;
|
||||
if (!noticeState.shown[DESKTOP_NOTICE_ID]) {
|
||||
return getDesktopNotice();
|
||||
}
|
||||
return {
|
||||
id: NOTICE_ID,
|
||||
title: "Try ClinePass",
|
||||
};
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function markClineCliMigrationNoticeShown(
|
||||
dataDir = resolveClineDataDir(),
|
||||
noticeId = CLINE_PASS_NOTICE_ID,
|
||||
): void {
|
||||
const noticePath = resolveCliNoticeStatePath(dataDir);
|
||||
const noticeState = readNoticeState(noticePath);
|
||||
const nextState: CliNoticeState = {
|
||||
shown: {
|
||||
...noticeState.shown,
|
||||
[NOTICE_ID]: true,
|
||||
[noticeId]: true,
|
||||
},
|
||||
};
|
||||
mkdirSync(dirname(noticePath), { recursive: true, mode: 0o700 });
|
||||
|
||||
@@ -793,6 +793,9 @@ describe("runCli lightweight command dispatch", () => {
|
||||
const notice = {
|
||||
id: "cline-cli-cline-pass-intro",
|
||||
title: "Try ClinePass",
|
||||
body: "ClinePass body",
|
||||
url: "https://app.cline.bot/dashboard/subscription?personal=true",
|
||||
openLabel: "Open ClinePass",
|
||||
};
|
||||
migrationNoticeMocks.getClineCliMigrationNotice.mockReturnValue(notice);
|
||||
process.argv = ["bun", "src/index.ts"];
|
||||
@@ -816,7 +819,7 @@ describe("runCli lightweight command dispatch", () => {
|
||||
await options?.onInitialNoticeShown?.(notice);
|
||||
expect(
|
||||
migrationNoticeMocks.markClineCliMigrationNoticeShown,
|
||||
).toHaveBeenCalledTimes(1);
|
||||
).toHaveBeenCalledWith(undefined, notice.id);
|
||||
});
|
||||
|
||||
it("passes the active ClinePass provider into the migration notice gate", async () => {
|
||||
@@ -1177,6 +1180,9 @@ describe("runCli lightweight command dispatch", () => {
|
||||
migrationNoticeMocks.getClineCliMigrationNotice.mockReturnValue({
|
||||
id: "cline-cli-cline-pass-intro",
|
||||
title: "Try ClinePass",
|
||||
body: "ClinePass body",
|
||||
url: "https://app.cline.bot/dashboard/subscription?personal=true",
|
||||
openLabel: "Open ClinePass",
|
||||
});
|
||||
process.argv = ["bun", "src/index.ts", "history"];
|
||||
|
||||
|
||||
@@ -1198,8 +1198,8 @@ export async function runCli(): Promise<void> {
|
||||
activeProviderId: provider,
|
||||
});
|
||||
if (initialNotice) {
|
||||
markInitialNoticeShown = () => {
|
||||
markClineCliMigrationNoticeShown();
|
||||
markInitialNoticeShown = (notice) => {
|
||||
markClineCliMigrationNoticeShown(undefined, notice.id);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ export function QueuedPrompts(props: {
|
||||
? "Waiting. ↑/↓ navigate, Tab edit, Esc cancels turn"
|
||||
: `Steered next. ↑/↓ navigate, Tab edit, ${escapeHint}`
|
||||
: `↑/↓ navigate, Enter steer, Tab edit, ${escapeHint}`
|
||||
: "↑ steer or edit messages";
|
||||
: "Enter with empty input to steer first · ↑ select or edit";
|
||||
|
||||
return (
|
||||
<box
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { KeyEvent } from "@opentui/core";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { useRootKeyboard } from "./use-root-keyboard";
|
||||
import { shouldHandleInputHistory } from "./root-keyboard-routing";
|
||||
|
||||
describe("root keyboard input history routing", () => {
|
||||
@@ -29,3 +31,58 @@ describe("root keyboard input history routing", () => {
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
const keyboard = vi.hoisted(() => ({ handle: (_key: KeyEvent) => {} }));
|
||||
vi.mock("@opentui/react", () => ({
|
||||
useKeyboard: (handle: (key: KeyEvent) => void) => {
|
||||
keyboard.handle = handle;
|
||||
},
|
||||
}));
|
||||
vi.mock("react", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("react")>()),
|
||||
useRef: (current: unknown) => ({ current }),
|
||||
}));
|
||||
vi.mock("../contexts/session-context", () => ({
|
||||
useSession: () => ({ isRunning: true, isExitRequested: false }),
|
||||
}));
|
||||
|
||||
describe("empty-input queue steering", () => {
|
||||
it.each([
|
||||
{ text: "", shift: false, promote: true },
|
||||
{ text: " ", shift: false, promote: true },
|
||||
{ text: "new draft", shift: false, promote: false },
|
||||
{ text: "", shift: true, promote: false },
|
||||
])("routes Enter with $text and shift=$shift", ({ text, shift, promote }) => {
|
||||
const promotePrompt = vi.fn();
|
||||
useRootKeyboard({
|
||||
isDialogOpen: false,
|
||||
appView: "chat",
|
||||
autocomplete: { mode: false },
|
||||
transcriptScrollRef: { current: null },
|
||||
getCurrentInputText: () => text,
|
||||
queuedPromptSelection: {
|
||||
items: [
|
||||
{ id: "first", prompt: "first", steer: false, attachmentCount: 0 },
|
||||
{ id: "second", prompt: "second", steer: false, attachmentCount: 0 },
|
||||
],
|
||||
selectedId: null,
|
||||
editingId: null,
|
||||
promote: promotePrompt,
|
||||
},
|
||||
} as unknown as Parameters<typeof useRootKeyboard>[0]);
|
||||
const preventDefault = vi.fn();
|
||||
keyboard.handle({
|
||||
name: "return",
|
||||
ctrl: false,
|
||||
meta: false,
|
||||
shift,
|
||||
repeated: false,
|
||||
preventDefault,
|
||||
} as unknown as KeyEvent);
|
||||
expect(promotePrompt).toHaveBeenCalledTimes(promote ? 1 : 0);
|
||||
if (promote) {
|
||||
expect(promotePrompt).toHaveBeenCalledWith("first");
|
||||
expect(preventDefault).toHaveBeenCalledOnce();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -209,6 +209,22 @@ export function useRootKeyboard(input: {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
!hasInputText &&
|
||||
hasQueuedPrompts &&
|
||||
!key.shift &&
|
||||
!key.ctrl &&
|
||||
!key.meta &&
|
||||
(key.name === "enter" || key.name === "return")
|
||||
) {
|
||||
key.preventDefault();
|
||||
const firstPrompt = queuedSelection.items[0];
|
||||
if (firstPrompt && !firstPrompt.steer && !key.repeated) {
|
||||
queuedSelection.promote(firstPrompt.id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (key.name === "up" && canHandleInputHistory) {
|
||||
if (
|
||||
input.inputHistory.navigateHistory("up", input.inputValueRef.current)
|
||||
|
||||
@@ -15,7 +15,10 @@ import {
|
||||
useDialogState,
|
||||
} from "@opentui-ui/dialog/react";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { shouldSuppressClineCliMigrationNoticeForActiveProvider } from "../kanban-migration/notice";
|
||||
import {
|
||||
CLINE_PASS_NOTICE_ID,
|
||||
shouldSuppressClineCliMigrationNoticeForActiveProvider,
|
||||
} from "../kanban-migration/notice";
|
||||
import { MigrationNoticeContent } from "../kanban-migration/notice-dialog";
|
||||
import {
|
||||
isSameRepoStatus,
|
||||
@@ -552,6 +555,7 @@ function App(props: TuiProps) {
|
||||
if (initialNoticeShownRef.current) return;
|
||||
if (appView !== "home") return;
|
||||
if (
|
||||
notice.id === CLINE_PASS_NOTICE_ID &&
|
||||
shouldSuppressClineCliMigrationNoticeForActiveProvider(currentProviderId)
|
||||
) {
|
||||
initialNoticeShownRef.current = true;
|
||||
|
||||
@@ -106,7 +106,7 @@ function renderDevIndexHtml(devServerUrl: string): string {
|
||||
window.__vite_plugin_react_preamble_installed__ = true;
|
||||
</script>
|
||||
<script type="module" src="${devServerUrl}/@vite/client"></script>
|
||||
<link rel="icon" type="image/svg+xml" href="${devServerUrl}/cline-logo-filled.svg" />
|
||||
<link rel="icon" type="image/svg+xml" href="${devServerUrl}/favicon.svg" />
|
||||
<title>Cline Hub</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/cline-logo-filled.svg" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Cline Hub</title>
|
||||
</head>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="Ebene_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 466.73 487.04">
|
||||
<!-- Generator: Adobe Illustrator 29.8.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 2) -->
|
||||
<path d="M463.6,275.08l-29.26-58.75v-33.83c0-56.08-45.01-101.5-100.53-101.5h-50.01c3.62-7.43,5.61-15.79,5.61-24.61,0-31.17-25.08-56.39-56.07-56.39s-56.07,25.22-56.07,56.39c0,8.82,1.99,17.17,5.61,24.61h-50.01c-55.51,0-100.52,45.42-100.52,101.5v33.83l-29.87,58.59c-3.01,5.9-3.01,12.92,0,18.81l29.87,57.93v33.83c0,56.08,45.01,101.5,100.52,101.5h200.95c55.51,0,100.53-45.42,100.53-101.5v-33.83l29.21-58.13c2.9-5.79,2.9-12.61.05-18.46ZM202.75,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02ZM350.58,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02Z"/>
|
||||
</svg>
|
||||
<svg width="113" height="113" viewBox="0 0 113 113" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M56.4998 8.99805L56.4999 5.29805H56.4998V8.99805ZM68.4998 20.708L72.1998 20.7081V20.708H68.4998ZM67.9929 25L64.3662 24.2671L63.4704 28.7H67.9929V25ZM84.4998 25L84.4998 21.3H84.4998V25ZM95.7 49.7998H92V51.2066L92.9346 52.258L95.7 49.7998ZM108.027 63.667L110.793 61.2088L110.792 61.2088L108.027 63.667ZM108.027 64.7305L110.792 67.1887L110.793 67.1883L108.027 64.7305ZM95.7 78.5977L92.9346 76.1394L92 77.1909V78.5977H95.7ZM95.7 92.2002L99.3999 92.2002V92.2002H95.7ZM84.4998 103.4V107.1H84.4998L84.4998 103.4ZM17.2996 92.2002H13.5996V92.2002L17.2996 92.2002ZM17.2996 78.5986H20.9996V77.1918L20.0649 76.1404L17.2996 78.5986ZM4.97144 64.7305L2.20602 67.1886L2.20611 67.1887L4.97144 64.7305ZM4.97144 63.667L7.73685 66.1251L7.73685 66.1251L4.97144 63.667ZM17.2996 49.7979L20.065 52.256L20.9996 51.2046V49.7979H17.2996ZM45.0066 25V28.7H49.5292L48.6333 24.267L45.0066 25ZM44.4998 20.708H40.7998V20.7081L44.4998 20.708ZM56.4998 8.99805L56.4996 12.698C61.1812 12.6982 64.7998 16.3247 64.7998 20.708H68.4998H72.1998C72.1998 12.0452 65.0728 5.29829 56.4999 5.29805L56.4998 8.99805ZM68.4998 20.708L64.7998 20.7079C64.7997 21.6154 64.6614 22.8066 64.3662 24.2671L67.9929 25L71.6196 25.7329C71.969 24.004 72.1997 22.2864 72.1998 20.7081L68.4998 20.708ZM67.9929 25V28.7H84.4998V25V21.3H67.9929V25ZM84.4998 25L84.4997 28.7C88.6419 28.7001 92 32.0582 92 36.2002H95.7H99.3999C99.3999 27.9712 92.7287 21.3001 84.4998 21.3L84.4998 25ZM95.7 36.2002H92V49.7998H95.7H99.3999V36.2002H95.7ZM95.7 49.7998L92.9346 52.258L105.262 66.1252L108.027 63.667L110.792 61.2088L98.4653 47.3416L95.7 49.7998ZM108.027 63.667L105.262 66.1251C104.285 65.026 104.285 63.371 105.261 62.2727L108.027 64.7305L110.793 67.1883C112.308 65.4837 112.308 62.9141 110.793 61.2088L108.027 63.667ZM108.027 64.7305L105.262 62.2722L92.9346 76.1394L95.7 78.5977L98.4653 81.0559L110.792 67.1887L108.027 64.7305ZM95.7 78.5977H92V92.2002H95.7H99.3999V78.5977H95.7ZM95.7 92.2002L92 92.2002C91.9999 96.3422 88.6418 99.7003 84.4997 99.7004L84.4998 103.4L84.4998 107.1C92.7287 107.1 99.3999 100.429 99.3999 92.2002L95.7 92.2002ZM84.4998 103.4V99.7004H28.4998V103.4V107.1H84.4998V103.4ZM28.4998 103.4V99.7004C24.3577 99.7004 20.9996 96.3423 20.9996 92.2002L17.2996 92.2002L13.5996 92.2002C13.5996 100.429 20.2707 107.1 28.4998 107.1V103.4ZM17.2996 92.2002H20.9996V78.5986H17.2996H13.5996V92.2002H17.2996ZM17.2996 78.5986L20.0649 76.1404L7.73676 62.2722L4.97144 64.7305L2.20611 67.1887L14.5342 81.0569L17.2996 78.5986ZM4.97144 64.7305L7.73685 62.2723C8.71353 63.3711 8.71353 65.0264 7.73685 66.1251L4.97144 63.667L2.20602 61.2088C0.690476 62.9138 0.690476 65.4836 2.20602 67.1886L4.97144 64.7305ZM4.97144 63.667L7.73685 66.1251L20.065 52.256L17.2996 49.7979L14.5341 47.3397L2.20602 61.2088L4.97144 63.667ZM17.2996 49.7979H20.9996V36.2002H17.2996H13.5996V49.7979H17.2996ZM17.2996 36.2002H20.9996C20.9996 32.0581 24.3576 28.7 28.4998 28.7V25V21.3C20.2707 21.3 13.5996 27.9712 13.5996 36.2002H17.2996ZM28.4998 25V28.7H45.0066V25V21.3H28.4998V25ZM45.0066 25L48.6333 24.267C48.3381 22.8066 48.1998 21.6154 48.1998 20.7079L44.4998 20.708L40.7998 20.7081C40.7998 22.2864 41.0305 24.0039 41.3799 25.733L45.0066 25ZM44.4998 20.708H48.1998C48.1998 16.3244 51.8182 12.698 56.4998 12.698V8.99805V5.29805C47.9264 5.29805 40.7998 12.0451 40.7998 20.708H44.4998Z" fill="#1C1C24"/>
|
||||
<rect x="66.1001" y="49.8008" width="9.6" height="28.8" rx="4.8" fill="#1C1C24"/>
|
||||
<rect x="37.3" y="49.8008" width="9.6" height="28.8" rx="4.8" fill="#1C1C24"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 957 B After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 28 KiB |
@@ -1,16 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="92px" height="96px" viewBox="0 0 92 96" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Group Copy 2</title>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="icon-copy" transform="translate(-34, -40)" fill="#24292F">
|
||||
<g id="Group-Copy-2" transform="translate(34, 40.5)">
|
||||
<g id="Group-3-Copy-4" transform="translate(0, 0)">
|
||||
<path d="M65.4492701,16.3 C76.3374701,16.3 85.1635558,25.16479 85.1635558,36.1 L85.1635558,42.7 L90.9027661,54.1647464 C91.4694141,55.2966923 91.4668177,56.6300535 90.8957658,57.7597839 L85.1635558,69.1 L85.1635558,75.7 C85.1635558,86.63554 76.3374701,95.5 65.4492701,95.5 L26.0206986,95.5 C15.1328272,95.5 6.30641291,86.63554 6.30641291,75.7 L6.30641291,69.1 L0.448507752,57.7954874 C-0.14693501,56.6464093 -0.149634367,55.2802504 0.441262896,54.1288283 L6.30641291,42.7 L6.30641291,36.1 C6.30641291,25.16479 15.1328272,16.3 26.0206986,16.3 L65.4492701,16.3 Z M62.9301895,22 L29.189529,22 C19.8723267,22 12.3191987,29.5552188 12.3191987,38.875 L12.3191987,44.5 L7.44288578,53.9634655 C6.84794449,55.1180686 6.85066096,56.4896598 7.45017099,57.6418974 L12.3191987,67 L12.3191987,72.625 C12.3191987,81.9450625 19.8723267,89.5 29.189529,89.5 L62.9301895,89.5 C72.2476729,89.5 79.8005198,81.9450625 79.8005198,72.625 L79.8005198,67 L84.5682187,57.6061395 C85.1432011,56.473244 85.1458141,55.1345713 84.5752587,53.9994398 L79.8005198,44.5 L79.8005198,38.875 C79.8005198,29.5552188 72.2476729,22 62.9301895,22 Z" id="Combined-Shape" fill-rule="nonzero"></path>
|
||||
<circle id="Oval" cx="45.7349843" cy="11" r="11"></circle>
|
||||
</g>
|
||||
<rect id="Rectangle-Copy" stroke="#24292F" stroke-width="8" x="31" y="44.5" width="5" height="22" rx="2.5"></rect>
|
||||
<rect id="Rectangle-Copy-2" stroke="#24292F" stroke-width="8" x="55" y="44.5" width="5" height="22" rx="2.5"></rect>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<svg width="113" height="113" viewBox="0 0 113 113" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M56.4998 8.99805L56.4999 5.29805H56.4998V8.99805ZM68.4998 20.708L72.1998 20.7081V20.708H68.4998ZM67.9929 25L64.3662 24.2671L63.4704 28.7H67.9929V25ZM84.4998 25L84.4998 21.3H84.4998V25ZM95.7 49.7998H92V51.2066L92.9346 52.258L95.7 49.7998ZM108.027 63.667L110.793 61.2088L110.792 61.2088L108.027 63.667ZM108.027 64.7305L110.792 67.1887L110.793 67.1883L108.027 64.7305ZM95.7 78.5977L92.9346 76.1394L92 77.1909V78.5977H95.7ZM95.7 92.2002L99.3999 92.2002V92.2002H95.7ZM84.4998 103.4V107.1H84.4998L84.4998 103.4ZM17.2996 92.2002H13.5996V92.2002L17.2996 92.2002ZM17.2996 78.5986H20.9996V77.1918L20.0649 76.1404L17.2996 78.5986ZM4.97144 64.7305L2.20602 67.1886L2.20611 67.1887L4.97144 64.7305ZM4.97144 63.667L7.73685 66.1251L7.73685 66.1251L4.97144 63.667ZM17.2996 49.7979L20.065 52.256L20.9996 51.2046V49.7979H17.2996ZM45.0066 25V28.7H49.5292L48.6333 24.267L45.0066 25ZM44.4998 20.708H40.7998V20.7081L44.4998 20.708ZM56.4998 8.99805L56.4996 12.698C61.1812 12.6982 64.7998 16.3247 64.7998 20.708H68.4998H72.1998C72.1998 12.0452 65.0728 5.29829 56.4999 5.29805L56.4998 8.99805ZM68.4998 20.708L64.7998 20.7079C64.7997 21.6154 64.6614 22.8066 64.3662 24.2671L67.9929 25L71.6196 25.7329C71.969 24.004 72.1997 22.2864 72.1998 20.7081L68.4998 20.708ZM67.9929 25V28.7H84.4998V25V21.3H67.9929V25ZM84.4998 25L84.4997 28.7C88.6419 28.7001 92 32.0582 92 36.2002H95.7H99.3999C99.3999 27.9712 92.7287 21.3001 84.4998 21.3L84.4998 25ZM95.7 36.2002H92V49.7998H95.7H99.3999V36.2002H95.7ZM95.7 49.7998L92.9346 52.258L105.262 66.1252L108.027 63.667L110.792 61.2088L98.4653 47.3416L95.7 49.7998ZM108.027 63.667L105.262 66.1251C104.285 65.026 104.285 63.371 105.261 62.2727L108.027 64.7305L110.793 67.1883C112.308 65.4837 112.308 62.9141 110.793 61.2088L108.027 63.667ZM108.027 64.7305L105.262 62.2722L92.9346 76.1394L95.7 78.5977L98.4653 81.0559L110.792 67.1887L108.027 64.7305ZM95.7 78.5977H92V92.2002H95.7H99.3999V78.5977H95.7ZM95.7 92.2002L92 92.2002C91.9999 96.3422 88.6418 99.7003 84.4997 99.7004L84.4998 103.4L84.4998 107.1C92.7287 107.1 99.3999 100.429 99.3999 92.2002L95.7 92.2002ZM84.4998 103.4V99.7004H28.4998V103.4V107.1H84.4998V103.4ZM28.4998 103.4V99.7004C24.3577 99.7004 20.9996 96.3423 20.9996 92.2002L17.2996 92.2002L13.5996 92.2002C13.5996 100.429 20.2707 107.1 28.4998 107.1V103.4ZM17.2996 92.2002H20.9996V78.5986H17.2996H13.5996V92.2002H17.2996ZM17.2996 78.5986L20.0649 76.1404L7.73676 62.2722L4.97144 64.7305L2.20611 67.1887L14.5342 81.0569L17.2996 78.5986ZM4.97144 64.7305L7.73685 62.2723C8.71353 63.3711 8.71353 65.0264 7.73685 66.1251L4.97144 63.667L2.20602 61.2088C0.690476 62.9138 0.690476 65.4836 2.20602 67.1886L4.97144 64.7305ZM4.97144 63.667L7.73685 66.1251L20.065 52.256L17.2996 49.7979L14.5341 47.3397L2.20602 61.2088L4.97144 63.667ZM17.2996 49.7979H20.9996V36.2002H17.2996H13.5996V49.7979H17.2996ZM17.2996 36.2002H20.9996C20.9996 32.0581 24.3576 28.7 28.4998 28.7V25V21.3C20.2707 21.3 13.5996 27.9712 13.5996 36.2002H17.2996ZM28.4998 25V28.7H45.0066V25V21.3H28.4998V25ZM45.0066 25L48.6333 24.267C48.3381 22.8066 48.1998 21.6154 48.1998 20.7079L44.4998 20.708L40.7998 20.7081C40.7998 22.2864 41.0305 24.0039 41.3799 25.733L45.0066 25ZM44.4998 20.708H48.1998C48.1998 16.3244 51.8182 12.698 56.4998 12.698V8.99805V5.29805C47.9264 5.29805 40.7998 12.0451 40.7998 20.708H44.4998Z" fill="#1C1C24"/>
|
||||
<rect x="66.1001" y="49.8008" width="9.6" height="28.8" rx="4.8" fill="#1C1C24"/>
|
||||
<rect x="37.3" y="49.8008" width="9.6" height="28.8" rx="4.8" fill="#1C1C24"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 3.5 KiB |
@@ -60,6 +60,7 @@ import { desktopClient } from "@/lib/desktop-client";
|
||||
import { readModelSelectionStorageFromWindow } from "@/lib/model-selection";
|
||||
import { normalizeProviderId } from "@/lib/provider-id";
|
||||
import {
|
||||
filterChatModels,
|
||||
loadProviderModelCatalog,
|
||||
loadProviderModels,
|
||||
} from "@/lib/provider-model-catalog";
|
||||
@@ -492,7 +493,9 @@ export function RoutineSchedulesContent() {
|
||||
|
||||
async function loadModelsForProvider() {
|
||||
try {
|
||||
const models = await loadProviderModels(normalizedProvider);
|
||||
const models = filterChatModels(
|
||||
await loadProviderModels(normalizedProvider),
|
||||
);
|
||||
if (cancelled || models.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -16,57 +16,48 @@ export type ProviderModelCatalog = {
|
||||
providerReasoningModels: Record<string, string[]>;
|
||||
};
|
||||
|
||||
function toModelIds(models: ProviderModel[] | undefined): string[] {
|
||||
return (models ?? [])
|
||||
.filter((model) =>
|
||||
isChatCompatibleModel({
|
||||
operation: model.operation,
|
||||
modalities: {
|
||||
input: model.inputModalities,
|
||||
output: model.outputModalities,
|
||||
},
|
||||
}),
|
||||
)
|
||||
.map((model) => model.id);
|
||||
}
|
||||
|
||||
function toReasoningModelIds(models: ProviderModel[] | undefined): string[] {
|
||||
return (models ?? [])
|
||||
.filter(
|
||||
(model) =>
|
||||
model.supportsReasoning &&
|
||||
isChatCompatibleModel({
|
||||
operation: model.operation,
|
||||
modalities: {
|
||||
input: model.inputModalities,
|
||||
output: model.outputModalities,
|
||||
},
|
||||
}),
|
||||
)
|
||||
.map((model) => model.id);
|
||||
export function filterChatModels(
|
||||
models: ProviderModel[] | undefined,
|
||||
): ProviderModel[] {
|
||||
return (models ?? []).filter((model) =>
|
||||
isChatCompatibleModel({
|
||||
operation: model.operation,
|
||||
modalities: {
|
||||
input: model.inputModalities,
|
||||
output: model.outputModalities,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
export function buildProviderModelCatalog(
|
||||
providers: Provider[],
|
||||
): ProviderModelCatalog {
|
||||
const providerEntries = providers.map((provider) => {
|
||||
const chatModels = filterChatModels(provider.modelList);
|
||||
return {
|
||||
provider,
|
||||
modelIds: chatModels.map((model) => model.id),
|
||||
reasoningModelIds: chatModels
|
||||
.filter((model) => model.supportsReasoning)
|
||||
.map((model) => model.id),
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
providers,
|
||||
enabledProviderIds: providers
|
||||
enabledProviderIds: providerEntries
|
||||
.filter(
|
||||
(provider) =>
|
||||
provider.enabled && toModelIds(provider.modelList).length > 0,
|
||||
({ provider, modelIds }) => provider.enabled && modelIds.length > 0,
|
||||
)
|
||||
.map((provider) => provider.id),
|
||||
.map(({ provider }) => provider.id),
|
||||
providerModels: Object.fromEntries(
|
||||
providers.map((provider) => [
|
||||
provider.id,
|
||||
toModelIds(provider.modelList),
|
||||
]),
|
||||
providerEntries.map(({ provider, modelIds }) => [provider.id, modelIds]),
|
||||
),
|
||||
providerReasoningModels: Object.fromEntries(
|
||||
providers.map((provider) => [
|
||||
providerEntries.map(({ provider, reasoningModelIds }) => [
|
||||
provider.id,
|
||||
toReasoningModelIds(provider.modelList),
|
||||
reasoningModelIds,
|
||||
]),
|
||||
),
|
||||
};
|
||||
|
||||
@@ -1,5 +1,32 @@
|
||||
# Cline Desktop Changelog
|
||||
|
||||
## 0.0.30
|
||||
|
||||
- Windows updates no longer fail with "Error opening file for writing". The installer hook meant to stop the running backend never terminated anything: Tauri ships a 32-bit NSIS installer, so its PowerShell ran under WOW64, where `Get-Process` reports an empty path for every 64-bit process — the filter matched no sidecar on any x64 machine. The installer then wrote over an executable the detached Hub daemon still held open, which is why updating from 0.0.25 through 0.0.28 failed exactly as 0.0.24 did. The installer now asks the Windows Restart Manager which processes hold this install's files and shuts those down; that is bitness-independent, covers the connector processes the Hub spawns, and leaves a side-by-side Cline Beta alone. If Restart Manager itself fails you get a Retry/Cancel prompt rather than a half-replaced install
|
||||
- On Windows, Cline no longer runs a program out of your workspace when it means to run the system one. Windows resolves a bare program name through the child process's working directory before it searches PATH, and Cline runs `rg`, `git`, and `powershell` with your workspace as that directory — so a repository that happened to contain its own `rg.exe` would have that copy executed as soon as the workspace was indexed. Cline now opts out of current-directory executable search at startup, and every process it spawns inherits the setting
|
||||
- Long sessions now compact when they actually need to rather than running out of room. The trigger compared a character-based estimate of the transcript (~3 characters per token) against the model's context limit, so content that tokenizes far denser than that — disassembly, image dumps, minified sources — could fill the real context window while the estimate stayed under the threshold and compaction never fired; the turn was then squeezed down to a handful of output tokens. The trigger now also uses the token count the provider itself reports, and how much history is kept is scaled by how far off the estimate turned out to be. The summarizer's output budget also doubled, so a model that reasons before answering can no longer spend the whole budget thinking and return no summary at all
|
||||
- A tool that streams its output no longer keeps spinning after it has finished. When a tool streamed everything as it went, its completion event carried no final output, which chat read as "still running" — so the tool kept its running presentation, spinner included, for the rest of the turn
|
||||
- Refreshed Cline's logo and app icons throughout the app, the Dock and taskbar, and the installer
|
||||
- The CoreWeave provider's branding and setup links now match CoreWeave's current documentation, and Weights & Biases gained a direct link to its API key page from provider setup
|
||||
|
||||
## 0.0.29
|
||||
|
||||
- Queued messages can now be sent into the running turn with Enter. While the agent is working, pressing Enter with an empty composer steers the first message in the queue, so it is picked up at the next turn boundary instead of waiting for the whole task to finish; the composer placeholder says so whenever the queue is non-empty. The queue head is claimed atomically, so a fast second Enter can't steer a message that has already left the queue, and a steer that fails now surfaces as a toast rather than silently doing nothing
|
||||
- The macOS Dock icon now has the standard margin other apps use. The bundled icon and the selectable runtime icons (Classic, Chip, Hologram, Midnight) were edge-to-edge, so Cline rendered visibly larger than its neighbours in the Dock. Windows keeps its existing artwork
|
||||
- The session sidebar's sort toggle now shows the mode a click switches to, not the one already active — a folder icon while sorted by time, a clock while grouped by project
|
||||
|
||||
## 0.0.28
|
||||
|
||||
- The app no longer gets stuck on "Desktop backend unavailable" when the backend is slow to start. The window asked for the backend's address exactly once and the shell stops waiting after about 15 seconds, so on a slower machine — where starting the hub pushed past that — you were left on the error screen until you relaunched, and the relaunch could lose the same race. Connection attempts now keep retrying and re-resolve the address each time, so a backend that has since restarted is reached at its current one
|
||||
- Confirming text with a Chinese or Japanese IME no longer sends the message. The Enter that commits an in-progress composition also reached the composer, so choosing a candidate fired off a half-typed message; Enter and the arrow keys now belong to the IME while you are composing
|
||||
- The model picker refreshes its list every time you open it, instead of staying frozen until you restart the app. The Recommended and Free groupings come from a live feed, so a newly promoted free model would otherwise not show up for the rest of the session
|
||||
- Signing in with Cline now explains what the plan includes. The sign-in card lists the regular free model promotions, ClinePass for generous usage across open-weight models like DeepSeek, Kimi, and GLM, and that no API key is needed; the last onboarding step then shows the current free models alongside a ClinePass summary. This only appears when you sign in with Cline, not when you bring your own API key
|
||||
- Cline Pass now starts you on a model from your subscription. Its model list carries both subscription and free models and the default was simply the most recently published entry, so a subscriber who never picked a model was left on a free model instead of the tier they pay for
|
||||
- A turn that fails partway through with a temporary provider error is now retried up to three times instead of failing the task. A single rate-limit response passed along by a provider gateway previously ended the turn outright. A turn that has already produced output is never retried, so nothing is duplicated
|
||||
- Long responses stream faster. Every chunk of a streaming reply was being handed to client-side hooks as a round trip carrying a full copy of the session, with the agent waiting on each one before continuing
|
||||
- The command-running tool now tells the model which PowerShell edition it is talking to — `Windows PowerShell (powershell.exe)` versus `PowerShell (pwsh.exe)` — and to write commands directly rather than wrapping them in a second shell invocation, which was corrupting pipelines that use `$_`
|
||||
- Refreshed the model catalog. Adds three providers (Infer by Flow7, Melious, and Wallaby) and takes the catalog from 5,923 to 6,079 models. The resolved default model changes for 33 providers, most of them landing on DeepSeek V4.1 Flash — among them Hugging Face, Fireworks, Requesty, Cortecs, CrossModel, DigitalOcean, Eden AI, and OpenCode Go — while NVIDIA moves to GLM 5.3 Flash and NanoGPT to GPT Astra. If you use a provider without pinning a model, expect a different default
|
||||
|
||||
## 0.0.27
|
||||
|
||||
- An expired Cline sign-in now produces one actionable error instead of two dead ends. A turn that fails before the runtime takes the prompt was reported twice — the hub's detail-less `run.failed` appended a bubble, then the send RPC resolved with the real error and overwrote the error banner underneath it — so you got a vague bubble stacked on a detailed banner. The failure now renders exactly once, upgrading in place when the detailed report arrives. Credential failures also carry a fix button: **Sign in to Cline** for the Cline provider (Settings → API Providers reads a stale token as "Signed in via browser", so there is nothing to fix there), **Open model settings** for others, and local-CLI providers keep pointing at their CLI. Sessions that fail to start over credentials get the same hint and action
|
||||
|
||||
@@ -63,6 +63,23 @@ names, paths, PR numbers/titles, check names, and URLs are not included.
|
||||
Automatic polling does not emit additional impressions. Telemetry delivery
|
||||
does not block interactions, and failures do not interrupt the feature.
|
||||
|
||||
## App Icons
|
||||
|
||||
`src-tauri/app-icon.png` (1024x1024, edge-to-edge) is the source for
|
||||
`bun tauri icon`, which generates the Windows `.ico` and Linux PNGs in
|
||||
`src-tauri/icons/`. macOS is the exception: Dock icons are expected to have a
|
||||
transparent margin, with the artwork filling 824 of the 1024 canvas, so the
|
||||
committed `icons/icon.icns` is built from a padded copy of the source, and the
|
||||
selectable runtime icons in `icons/app/macos/` are padded copies of the
|
||||
Windows ones in `icons/app/`. To regenerate the macOS icon after changing the
|
||||
artwork:
|
||||
|
||||
```bash
|
||||
cd src-tauri
|
||||
magick app-icon.png -resize 824x824 -background none -gravity center -extent 1024x1024 /tmp/app-icon-macos.png
|
||||
bun tauri icon /tmp/app-icon-macos.png -o /tmp/icons-macos && cp /tmp/icons-macos/icon.icns icons/icon.icns
|
||||
```
|
||||
|
||||
## Customizing the macOS Install Window
|
||||
|
||||
The drag-to-Applications window is configured by `bundle.macOS.dmg` in
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cline/code",
|
||||
"version": "0.0.27",
|
||||
"version": "0.0.30",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build:ui": "bun -F @cline/ui build",
|
||||
|
||||
@@ -2280,3 +2280,35 @@ describe("mistake-limit prompt", () => {
|
||||
expect(start).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("queue steering routing", () => {
|
||||
it.each([
|
||||
undefined,
|
||||
"selected-prompt",
|
||||
])("routes steering with prompt ID %s", async (promptId) => {
|
||||
const result = { sessionId: "session", prompts: [], updated: false };
|
||||
const steerFirst = vi.fn(async () => result);
|
||||
const update = vi.fn(async () => result);
|
||||
const ctx = {
|
||||
liveSessions: new Map(),
|
||||
wsClients: new Set(),
|
||||
sessionManager: { pendingPrompts: { steerFirst, update } },
|
||||
} as unknown as SidecarContext;
|
||||
await handleChatSessionCommand(ctx, {
|
||||
action: "steer_prompt",
|
||||
sessionId: "session",
|
||||
promptId,
|
||||
});
|
||||
if (promptId === undefined) {
|
||||
expect(steerFirst).toHaveBeenCalledWith({ sessionId: "session" });
|
||||
expect(update).not.toHaveBeenCalled();
|
||||
} else {
|
||||
expect(update).toHaveBeenCalledWith({
|
||||
sessionId: "session",
|
||||
promptId,
|
||||
delivery: "steer",
|
||||
});
|
||||
expect(steerFirst).not.toHaveBeenCalled();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1711,14 +1711,17 @@ async function handleSteerPrompt(
|
||||
): Promise<unknown> {
|
||||
const sessionId = request.sessionId?.trim();
|
||||
const promptId = request.promptId?.trim();
|
||||
if (!sessionId || !promptId)
|
||||
throw new Error("sessionId and promptId are required");
|
||||
if (!sessionId) throw new Error("sessionId is required");
|
||||
if (request.promptId !== undefined && !promptId)
|
||||
throw new Error("promptId cannot be empty");
|
||||
const manager = getSessionManager(ctx);
|
||||
const result = await manager.pendingPrompts.update({
|
||||
sessionId,
|
||||
promptId,
|
||||
delivery: "steer",
|
||||
});
|
||||
const result = promptId
|
||||
? await manager.pendingPrompts.update({
|
||||
sessionId,
|
||||
promptId,
|
||||
delivery: "steer",
|
||||
})
|
||||
: await manager.pendingPrompts.steerFirst({ sessionId });
|
||||
return {
|
||||
sessionId,
|
||||
updated: result.updated === true,
|
||||
|
||||
@@ -0,0 +1,505 @@
|
||||
import type { HubEventEnvelope } from "@cline/shared";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { reconcileBufferedCloudEvents } from "./cloud-session-snapshots";
|
||||
|
||||
describe("reconcileBufferedCloudEvents", () => {
|
||||
const event = (
|
||||
name: HubEventEnvelope["event"],
|
||||
id: string,
|
||||
payload: Record<string, unknown> = {},
|
||||
): HubEventEnvelope => ({
|
||||
version: "v1",
|
||||
event: name,
|
||||
eventId: id,
|
||||
timestamp: Date.now(),
|
||||
sessionId: "inner-1",
|
||||
payload,
|
||||
});
|
||||
|
||||
it.each([
|
||||
"Continue",
|
||||
"",
|
||||
])("preserves submitted lifecycle while marking only newly reflected %j prompts", (prompt) => {
|
||||
const submitted = (id: string) =>
|
||||
event("session.pending_prompt_submitted", id, {
|
||||
prompt: {
|
||||
id,
|
||||
prompt,
|
||||
delivery: "queue",
|
||||
...(prompt
|
||||
? {}
|
||||
: {
|
||||
userImages: ["data:image/png;base64,AA=="],
|
||||
attachmentCount: 1,
|
||||
}),
|
||||
},
|
||||
});
|
||||
const first = submitted("q-1");
|
||||
const later = submitted("q-2");
|
||||
const baseline = [
|
||||
{
|
||||
role: "user",
|
||||
content: prompt || [
|
||||
{
|
||||
type: "image",
|
||||
source: { type: "base64", media_type: "image/png", data: "AA==" },
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
// An older identical user message must not consume a new submission.
|
||||
expect(
|
||||
reconcileBufferedCloudEvents([first], baseline, {
|
||||
baselineMessages: baseline,
|
||||
}),
|
||||
).toEqual([first]);
|
||||
const toolResult = {
|
||||
role: "user",
|
||||
content: [
|
||||
{ type: "tool_result", tool_use_id: "call-1", content: "done" },
|
||||
],
|
||||
};
|
||||
expect(
|
||||
reconcileBufferedCloudEvents([first], [...baseline, toolResult], {
|
||||
baselineMessages: baseline,
|
||||
}),
|
||||
).toEqual([first]);
|
||||
const snapshot = [
|
||||
...baseline,
|
||||
toolResult,
|
||||
{
|
||||
...baseline[0],
|
||||
...(prompt
|
||||
? {
|
||||
content: [
|
||||
...toolResult.content,
|
||||
{ type: "text", text: `<user_input>${prompt}</user_input>` },
|
||||
],
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
];
|
||||
const completed = event("run.completed", "done");
|
||||
const running = event("run.started", "next");
|
||||
// Keep the next turn's start between lifecycle events; only its bubble is reflected.
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(
|
||||
[completed, first, running, later],
|
||||
snapshot,
|
||||
{
|
||||
baselineMessages: baseline,
|
||||
},
|
||||
),
|
||||
).toEqual([
|
||||
completed,
|
||||
{ ...first, payload: { ...first.payload, transcriptReflected: true } },
|
||||
running,
|
||||
later,
|
||||
]);
|
||||
// A submission received after the transcript reply cannot be in it.
|
||||
expect(
|
||||
reconcileBufferedCloudEvents([later], snapshot, {
|
||||
baselineMessages: baseline,
|
||||
messagesSnapshotEventCutoff: 0,
|
||||
}),
|
||||
).toEqual([later]);
|
||||
});
|
||||
|
||||
it("replays content the snapshot does NOT contain", () => {
|
||||
const buffered = [
|
||||
event("assistant.delta", "a-1", { text: "unpersisted reply" }),
|
||||
event("run.completed", "done-1"),
|
||||
];
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(buffered, [
|
||||
{ role: "assistant", content: "a completely different answer" },
|
||||
]).map((item) => item.event),
|
||||
).toEqual(["assistant.delta", "run.completed"]);
|
||||
});
|
||||
|
||||
it("does not let an interior substring claim another run's snapshot", () => {
|
||||
const buffered = [
|
||||
event("assistant.finished", "a-1", { text: "foo" }),
|
||||
event("run.completed", "done-1"),
|
||||
event("assistant.finished", "a-2", { text: "The answer is foobar" }),
|
||||
event("run.completed", "done-2"),
|
||||
];
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(buffered, [
|
||||
{ role: "assistant", content: "The answer is foobar" },
|
||||
]).map((item) => item.eventId),
|
||||
).toEqual(["a-1", "done-1", "done-2"]);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["bar", "foobar", false],
|
||||
["bar", "foobar", true],
|
||||
["Done", "Done", false],
|
||||
] as const)("preserves aborted %j beside saved %j (reverse: %s)", (partial, saved, reverse) => {
|
||||
const aborted = [
|
||||
event("assistant.delta", "partial", { text: partial }),
|
||||
event("run.aborted", "aborted"),
|
||||
];
|
||||
const completed = [
|
||||
event("assistant.delta", "saved-delta", { text: saved }),
|
||||
event("assistant.finished", "saved-finished", { text: saved }),
|
||||
event("run.completed", "completed"),
|
||||
];
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(
|
||||
reverse ? [...completed, ...aborted] : [...aborted, ...completed],
|
||||
[{ role: "assistant", content: saved }],
|
||||
).map((item) => item.eventId),
|
||||
).toEqual(
|
||||
reverse
|
||||
? ["completed", "partial", "aborted"]
|
||||
: ["partial", "aborted", "completed"],
|
||||
);
|
||||
});
|
||||
|
||||
it.each([
|
||||
"assistant",
|
||||
"reasoning",
|
||||
] as const)("does not let finished %s hide the other aborted content", (finished) => {
|
||||
const partial = finished === "assistant" ? "reasoning" : "assistant";
|
||||
const buffered = [
|
||||
event(`${finished}.finished`, "saved", {
|
||||
text: "foobar",
|
||||
reasoning: "foobar",
|
||||
}),
|
||||
event(`${partial}.delta`, "partial", { text: "bar" }),
|
||||
event("run.aborted", "aborted"),
|
||||
];
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(buffered, [
|
||||
{
|
||||
role: "assistant",
|
||||
content: [
|
||||
{ type: "text", text: "foobar" },
|
||||
{ type: "thinking", thinking: "foobar" },
|
||||
],
|
||||
},
|
||||
]).map((item) => item.eventId),
|
||||
).toEqual(["partial", "aborted"]);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["assistant", false],
|
||||
["reasoning", false],
|
||||
["reasoning", true],
|
||||
] as const)("preserves unfinished %s after saved output (redacted: %s)", (kind, redacted) => {
|
||||
const saved = [
|
||||
event(`${kind}.delta`, "saved-delta", {
|
||||
text: redacted ? "" : "saved",
|
||||
redacted,
|
||||
}),
|
||||
event(`${kind}.finished`, "saved-finished", {
|
||||
[kind === "assistant" ? "text" : "reasoning"]: redacted
|
||||
? undefined
|
||||
: "saved",
|
||||
}),
|
||||
];
|
||||
const partial = event(`${kind}.delta`, "partial", { text: "unfinished" });
|
||||
const snapshot = [
|
||||
{
|
||||
role: "assistant",
|
||||
content: [
|
||||
redacted
|
||||
? { type: "redacted_thinking", data: "opaque" }
|
||||
: kind === "assistant"
|
||||
? { type: "text", text: "saved" }
|
||||
: { type: "thinking", thinking: "saved" },
|
||||
],
|
||||
},
|
||||
];
|
||||
for (const terminal of ["run.aborted", "run.failed"] as const) {
|
||||
const end = event(terminal, "end");
|
||||
const buffered = [...saved, partial, end];
|
||||
expect(reconcileBufferedCloudEvents(buffered, snapshot)).toEqual([
|
||||
partial,
|
||||
end,
|
||||
]);
|
||||
const earlier = [
|
||||
{
|
||||
role: "assistant",
|
||||
content: [
|
||||
kind === "assistant"
|
||||
? { type: "text", text: "earlier" }
|
||||
: { type: "thinking", thinking: "earlier" },
|
||||
],
|
||||
},
|
||||
];
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(
|
||||
[
|
||||
event(`${kind}.finished`, "earlier", {
|
||||
[kind === "assistant" ? "text" : "reasoning"]: "earlier",
|
||||
}),
|
||||
...buffered,
|
||||
],
|
||||
[...earlier, ...snapshot],
|
||||
{ baselineMessages: earlier },
|
||||
),
|
||||
).toEqual([partial, end]);
|
||||
expect(reconcileBufferedCloudEvents(buffered, [])).toEqual(buffered);
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(buffered, snapshot, {
|
||||
baselineMessages: snapshot,
|
||||
}),
|
||||
).toEqual(buffered);
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(buffered, snapshot, {
|
||||
messagesSnapshotEventCutoff: 1,
|
||||
}),
|
||||
).toEqual(
|
||||
terminal === "run.aborted" ? buffered : [saved[1], partial, end],
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it.each([
|
||||
"assistant",
|
||||
"reasoning",
|
||||
] as const)("preserves %s output completed after the snapshot", (kind) => {
|
||||
const key = kind === "assistant" ? "text" : "reasoning";
|
||||
const saved = event(`${kind}.finished`, "saved", { [key]: "saved" });
|
||||
const partial = event(`${kind}.delta`, "partial", { text: "new reply" });
|
||||
const finished = event(`${kind}.finished`, "finished", {
|
||||
[key]: "new reply",
|
||||
});
|
||||
const end = event("run.completed", "end");
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(
|
||||
[saved, partial, finished, end],
|
||||
[
|
||||
{
|
||||
role: "assistant",
|
||||
content: [
|
||||
{
|
||||
type: kind === "assistant" ? "text" : "thinking",
|
||||
[kind === "assistant" ? "text" : "thinking"]: "saved",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
{ messagesSnapshotEventCutoff: 2 },
|
||||
),
|
||||
).toEqual([partial, finished, end]);
|
||||
});
|
||||
|
||||
it.each([
|
||||
"run.completed",
|
||||
"run.aborted",
|
||||
"run.failed",
|
||||
] as const)("ignores empty finishes after saved content in %s", (terminal) => {
|
||||
const end = event(terminal, "end");
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(
|
||||
[
|
||||
event("assistant.finished", "saved", { text: "saved" }),
|
||||
event("assistant.finished", "empty", { text: "" }),
|
||||
event("assistant.finished", "missing"),
|
||||
end,
|
||||
],
|
||||
[{ role: "assistant", content: "saved" }],
|
||||
),
|
||||
).toEqual([end]);
|
||||
});
|
||||
|
||||
it("supersedes despite trailing whitespace in the streamed text", () => {
|
||||
const buffered = [
|
||||
event("assistant.finished", "f-1", { text: "the answer \n" }),
|
||||
event("run.completed", "done-1"),
|
||||
];
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(buffered, [
|
||||
{ role: "assistant", content: "prefix the answer" },
|
||||
]).map((item) => item.event),
|
||||
).toEqual(["run.completed"]);
|
||||
});
|
||||
|
||||
it("drops buffered queue snapshots when a fresh queue snapshot was applied", () => {
|
||||
const buffered = [
|
||||
event("session.pending_prompts", "q-1", { prompts: [] }),
|
||||
event("assistant.delta", "a-1", { text: "live tail" }),
|
||||
];
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(buffered, []).map((item) => item.event),
|
||||
).toEqual(["assistant.delta"]);
|
||||
});
|
||||
|
||||
it("replays the newest buffered queue snapshot when the queue fetch failed", () => {
|
||||
const buffered = [
|
||||
event("session.pending_prompts", "q-1", { prompts: [] }),
|
||||
event("session.pending_prompts", "q-2", {
|
||||
prompts: [{ id: "p-1", prompt: "queued work" }],
|
||||
}),
|
||||
event("assistant.delta", "a-1", { text: "live tail" }),
|
||||
];
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(buffered, [], {
|
||||
queueSnapshotApplied: false,
|
||||
}).map((item) => item.eventId),
|
||||
).toEqual(["q-2", "a-1"]);
|
||||
});
|
||||
|
||||
it("replays a queue snapshot received after the queue fetch", () => {
|
||||
const buffered = [
|
||||
event("session.pending_prompts", "q-old", { prompts: [] }),
|
||||
event("assistant.delta", "a-1", { text: "live tail" }),
|
||||
event("session.pending_prompts", "q-new", {
|
||||
prompts: [{ id: "p-1", prompt: "queued work" }],
|
||||
}),
|
||||
];
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(buffered, [], {
|
||||
queueSnapshotEventCutoff: 1,
|
||||
}).map((item) => item.eventId),
|
||||
).toEqual(["a-1", "q-new"]);
|
||||
});
|
||||
|
||||
it("supersedes content independently across two terminal run segments", () => {
|
||||
const buffered = [
|
||||
event("assistant.delta", "a-1", { text: "first tail" }),
|
||||
event("run.completed", "done-1"),
|
||||
event("assistant.delta", "a-2", { text: "second tail" }),
|
||||
event("run.completed", "done-2"),
|
||||
];
|
||||
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(buffered, [
|
||||
{ role: "assistant", content: "prefix first tail" },
|
||||
{ role: "assistant", content: "prefix second tail" },
|
||||
]).map((item) => item.event),
|
||||
).toEqual(["run.completed", "run.completed"]);
|
||||
});
|
||||
|
||||
it("does not let an older identical reply supersede a new buffered turn", () => {
|
||||
const buffered = [
|
||||
event("assistant.delta", "a-2", { text: "Done" }),
|
||||
event("run.completed", "done-2"),
|
||||
];
|
||||
const baseline = [{ role: "assistant", content: "Done" }];
|
||||
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(buffered, baseline, {
|
||||
baselineMessages: baseline,
|
||||
}).map((item) => item.event),
|
||||
).toEqual(["assistant.delta", "run.completed"]);
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(
|
||||
buffered,
|
||||
[...baseline, { role: "assistant", content: "Done" }],
|
||||
{ baselineMessages: baseline },
|
||||
).map((item) => item.event),
|
||||
).toEqual(["run.completed"]);
|
||||
});
|
||||
|
||||
it("keeps run.failed while suppressing reflected content and dedupes tools by id", () => {
|
||||
const buffered = [
|
||||
event("assistant.delta", "a-1", { text: "partial failure" }),
|
||||
event("tool.started", "tool-1", { toolCallId: "call-1" }),
|
||||
event("run.failed", "failed-1", { error: "boom" }),
|
||||
];
|
||||
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(buffered, [
|
||||
{ role: "assistant", content: "saved partial failure" },
|
||||
{
|
||||
role: "assistant",
|
||||
content: [{ type: "tool_use", id: "call-1", name: "read_file" }],
|
||||
},
|
||||
]).map((item) => item.event),
|
||||
).toEqual(["run.failed"]);
|
||||
});
|
||||
|
||||
it("only suppresses tool phases present in the transcript before its cutoff", () => {
|
||||
const started = event("tool.started", "start", { toolCallId: "call-1" });
|
||||
const finished = event("tool.finished", "finish", {
|
||||
toolCallId: "call-1",
|
||||
output: "done",
|
||||
});
|
||||
const snapshot = [
|
||||
{
|
||||
role: "assistant",
|
||||
content: [{ type: "tool_use", id: "call-1", name: "read_file" }],
|
||||
},
|
||||
];
|
||||
expect(reconcileBufferedCloudEvents([started, finished], snapshot)).toEqual(
|
||||
[finished],
|
||||
);
|
||||
const completedSnapshot = [
|
||||
...snapshot,
|
||||
{
|
||||
role: "user",
|
||||
content: [
|
||||
{ type: "tool_result", tool_use_id: "call-1", content: "done" },
|
||||
],
|
||||
},
|
||||
];
|
||||
expect(
|
||||
reconcileBufferedCloudEvents([started, finished], completedSnapshot),
|
||||
).toEqual([]);
|
||||
expect(
|
||||
reconcileBufferedCloudEvents([started, finished], completedSnapshot, {
|
||||
messagesSnapshotEventCutoff: 1,
|
||||
}),
|
||||
).toEqual([finished]);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["run.failed", false],
|
||||
["run.aborted", false],
|
||||
["run.aborted", true],
|
||||
] as const)("does not replay persisted thinking for %s (redacted: %s)", (terminal, redacted) => {
|
||||
const buffered = [
|
||||
event("reasoning.delta", "thinking", {
|
||||
text: redacted ? "" : "Checking",
|
||||
redacted,
|
||||
}),
|
||||
event("reasoning.finished", "thought", {
|
||||
reasoning: redacted ? undefined : "Checking",
|
||||
}),
|
||||
event(terminal, "end"),
|
||||
];
|
||||
const snapshot = [
|
||||
{
|
||||
role: "assistant",
|
||||
content: [
|
||||
redacted
|
||||
? { type: "redacted_thinking", data: "opaque" }
|
||||
: { type: "thinking", thinking: "Checking" },
|
||||
],
|
||||
},
|
||||
];
|
||||
expect(reconcileBufferedCloudEvents(buffered, snapshot)).toEqual([
|
||||
buffered[2],
|
||||
]);
|
||||
expect(reconcileBufferedCloudEvents(buffered, [])).toEqual(buffered);
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(buffered, snapshot, {
|
||||
baselineMessages: snapshot,
|
||||
}),
|
||||
).toEqual(buffered);
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(buffered, snapshot, {
|
||||
messagesSnapshotEventCutoff: 0,
|
||||
}),
|
||||
).toEqual(buffered);
|
||||
});
|
||||
|
||||
it("does not treat persisted assistant text as proof that thinking was saved", () => {
|
||||
const thinking = event("reasoning.delta", "thinking", { text: "Checking" });
|
||||
const done = event("run.completed", "done");
|
||||
expect(
|
||||
reconcileBufferedCloudEvents(
|
||||
[
|
||||
thinking,
|
||||
event("assistant.finished", "answer", { text: "Done" }),
|
||||
done,
|
||||
],
|
||||
[{ role: "assistant", content: "Done" }],
|
||||
),
|
||||
).toEqual([thinking, done]);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,362 @@
|
||||
import { isUserRunMessage } from "@cline/core";
|
||||
import type { HubEventEnvelope } from "@cline/shared";
|
||||
import type { JsonRecord, PromptInQueue } from "./types";
|
||||
|
||||
export function readSessionRows(
|
||||
payload: Record<string, unknown> | undefined,
|
||||
): JsonRecord[] {
|
||||
return Array.isArray(payload?.sessions)
|
||||
? payload.sessions.filter(
|
||||
(item): item is JsonRecord =>
|
||||
Boolean(item) && typeof item === "object" && !Array.isArray(item),
|
||||
)
|
||||
: [];
|
||||
}
|
||||
|
||||
export function updatedAt(record: JsonRecord): number {
|
||||
const value = record.updatedAt;
|
||||
return typeof value === "number"
|
||||
? value
|
||||
: Date.parse(String(value ?? "")) || 0;
|
||||
}
|
||||
|
||||
export function sessionRowModelId(record: JsonRecord | undefined): string {
|
||||
const metadata =
|
||||
record?.metadata && typeof record.metadata === "object"
|
||||
? (record.metadata as JsonRecord)
|
||||
: undefined;
|
||||
return String(metadata?.model ?? record?.model ?? "").trim();
|
||||
}
|
||||
|
||||
export function isRootSessionRow(record: JsonRecord): boolean {
|
||||
const metadata =
|
||||
record.metadata && typeof record.metadata === "object"
|
||||
? (record.metadata as JsonRecord)
|
||||
: undefined;
|
||||
return !String(
|
||||
metadata?.parentSessionId ?? record.parentSessionId ?? "",
|
||||
).trim();
|
||||
}
|
||||
|
||||
function messageText(
|
||||
message: unknown,
|
||||
kind: "text" | "thinking" = "text",
|
||||
): string {
|
||||
if (!message || typeof message !== "object" || Array.isArray(message)) {
|
||||
return "";
|
||||
}
|
||||
const content = (message as JsonRecord).content;
|
||||
if (typeof content === "string") {
|
||||
return kind === "text" ? content.trim() : "";
|
||||
}
|
||||
if (!Array.isArray(content)) {
|
||||
return "";
|
||||
}
|
||||
return content
|
||||
.map((part) =>
|
||||
part && typeof part === "object" && !Array.isArray(part)
|
||||
? kind === "thinking" &&
|
||||
(part as JsonRecord).type === "redacted_thinking"
|
||||
? "[redacted]"
|
||||
: String((part as JsonRecord)[kind] ?? "")
|
||||
: "",
|
||||
)
|
||||
.join("")
|
||||
.trim();
|
||||
}
|
||||
|
||||
function normalizeUserPrompt(text: string): string {
|
||||
const trimmed = text.trim();
|
||||
const match = trimmed.match(/^<user_input\b[^>]*>([\s\S]*)<\/user_input>$/);
|
||||
return (match ? match[1] : trimmed).trim();
|
||||
}
|
||||
|
||||
export function countPromptOccurrences(
|
||||
messages: unknown[],
|
||||
prompts: PromptInQueue[],
|
||||
prompt: string,
|
||||
): number {
|
||||
const expected = normalizeUserPrompt(prompt);
|
||||
return (
|
||||
messages.filter(
|
||||
(message) =>
|
||||
Boolean(message) &&
|
||||
typeof message === "object" &&
|
||||
!Array.isArray(message) &&
|
||||
String((message as JsonRecord).role ?? "").toLowerCase() === "user" &&
|
||||
(expected !== "" || isUserRunMessage(message as JsonRecord)) &&
|
||||
normalizeUserPrompt(messageText(message)) === expected,
|
||||
).length +
|
||||
prompts.filter((item) => normalizeUserPrompt(item.prompt) === expected)
|
||||
.length
|
||||
);
|
||||
}
|
||||
|
||||
export function submittedPromptsFromEvents(
|
||||
events: HubEventEnvelope[],
|
||||
): PromptInQueue[] {
|
||||
return events.flatMap((event) => {
|
||||
if (event.event !== "session.pending_prompt_submitted") return [];
|
||||
const prompt =
|
||||
event.payload?.prompt &&
|
||||
typeof event.payload.prompt === "object" &&
|
||||
!Array.isArray(event.payload.prompt)
|
||||
? (event.payload.prompt as JsonRecord)
|
||||
: undefined;
|
||||
const id = String(prompt?.id ?? "").trim();
|
||||
if (!id) return [];
|
||||
return [
|
||||
{
|
||||
id,
|
||||
prompt: String(prompt?.prompt ?? ""),
|
||||
steer: prompt?.delivery === "steer",
|
||||
attachmentCount:
|
||||
typeof prompt?.attachmentCount === "number"
|
||||
? prompt.attachmentCount
|
||||
: 0,
|
||||
userImages: Array.isArray(prompt?.userImages)
|
||||
? prompt.userImages.filter(
|
||||
(image): image is string => typeof image === "string",
|
||||
)
|
||||
: undefined,
|
||||
},
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
const TERMINAL_RUN_EVENTS = new Set([
|
||||
"run.completed",
|
||||
"run.aborted",
|
||||
"run.failed",
|
||||
]);
|
||||
const SUPERSEDABLE_CONTENT_EVENTS = new Set([
|
||||
"assistant.delta",
|
||||
"assistant.finished",
|
||||
"reasoning.delta",
|
||||
"reasoning.finished",
|
||||
]);
|
||||
|
||||
function assistantTexts(
|
||||
messages: unknown[],
|
||||
kind: "text" | "thinking",
|
||||
): string[] {
|
||||
return messages
|
||||
.filter(
|
||||
(message): message is JsonRecord =>
|
||||
Boolean(message) &&
|
||||
typeof message === "object" &&
|
||||
!Array.isArray(message) &&
|
||||
String((message as JsonRecord).role ?? "").toLowerCase() ===
|
||||
"assistant",
|
||||
)
|
||||
.map((message) => messageText(message, kind))
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
function newlyPersistedAssistantTexts(
|
||||
snapshotMessages: unknown[],
|
||||
baselineMessages: unknown[],
|
||||
kind: "text" | "thinking" = "text",
|
||||
): string[] {
|
||||
const baselineCounts = new Map<string, number>();
|
||||
for (const text of assistantTexts(baselineMessages, kind)) {
|
||||
baselineCounts.set(text, (baselineCounts.get(text) ?? 0) + 1);
|
||||
}
|
||||
return assistantTexts(snapshotMessages, kind).filter((text) => {
|
||||
const count = baselineCounts.get(text) ?? 0;
|
||||
if (count === 0) return true;
|
||||
if (count === 1) baselineCounts.delete(text);
|
||||
else baselineCounts.set(text, count - 1);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
function collectToolCallIds(
|
||||
value: unknown,
|
||||
phase: "tool_use" | "tool_result",
|
||||
result = new Set<string>(),
|
||||
): Set<string> {
|
||||
if (!value || typeof value !== "object") return result;
|
||||
if (Array.isArray(value)) {
|
||||
for (const item of value) collectToolCallIds(item, phase, result);
|
||||
return result;
|
||||
}
|
||||
const record = value as JsonRecord;
|
||||
const id = phase === "tool_use" ? record.id : record.tool_use_id;
|
||||
if (record.type === phase && typeof id === "string") {
|
||||
result.add(id);
|
||||
}
|
||||
for (const child of Object.values(record))
|
||||
collectToolCallIds(child, phase, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
function streamedAssistantText(
|
||||
events: HubEventEnvelope[],
|
||||
kind: "assistant" | "reasoning" = "assistant",
|
||||
): string {
|
||||
let finishedText = "";
|
||||
let deltas = "";
|
||||
for (const event of events) {
|
||||
if (event.event === `${kind}.delta`) {
|
||||
deltas +=
|
||||
kind === "reasoning" && event.payload?.redacted && !event.payload?.text
|
||||
? "[redacted]"
|
||||
: typeof event.payload?.text === "string"
|
||||
? event.payload.text
|
||||
: "";
|
||||
} else if (event.event === `${kind}.finished`) {
|
||||
const text = event.payload?.[kind === "assistant" ? "text" : "reasoning"];
|
||||
const completed = typeof text === "string" && text ? text : deltas;
|
||||
if (completed) finishedText = completed;
|
||||
deltas = "";
|
||||
}
|
||||
}
|
||||
return (finishedText || deltas).trim();
|
||||
}
|
||||
|
||||
/** Reconciles each completed run separately; tools dedupe by stable call id. */
|
||||
export function reconcileBufferedCloudEvents(
|
||||
events: HubEventEnvelope[],
|
||||
snapshotMessages: unknown[],
|
||||
options: {
|
||||
/**
|
||||
* Whether a fresh queue snapshot was fetched and applied during
|
||||
* rehydration. When it was, queue events received before its reply are
|
||||
* stale; later events still win. When the fetch failed, the newest
|
||||
* buffered queue event is the best state available.
|
||||
*/
|
||||
queueSnapshotApplied?: boolean;
|
||||
queueSnapshotEventCutoff?: number;
|
||||
/** Events received after the transcript reply cannot be reflected in it. */
|
||||
messagesSnapshotEventCutoff?: number;
|
||||
baselineMessages?: unknown[];
|
||||
} = {},
|
||||
): HubEventEnvelope[] {
|
||||
const queueSnapshotApplied = options.queueSnapshotApplied !== false;
|
||||
const unclaimedAssistantTexts = newlyPersistedAssistantTexts(
|
||||
snapshotMessages,
|
||||
options.baselineMessages ?? [],
|
||||
);
|
||||
const unclaimedThinking = newlyPersistedAssistantTexts(
|
||||
snapshotMessages,
|
||||
options.baselineMessages ?? [],
|
||||
"thinking",
|
||||
);
|
||||
const snapshotToolCallIds = collectToolCallIds(snapshotMessages, "tool_use");
|
||||
const snapshotToolResultIds = collectToolCallIds(
|
||||
snapshotMessages,
|
||||
"tool_result",
|
||||
);
|
||||
const beforeTranscript = new Set(
|
||||
events.slice(0, options.messagesSnapshotEventCutoff ?? events.length),
|
||||
);
|
||||
const reflectedSubmissions = new Set<HubEventEnvelope>();
|
||||
const unclaimedUserCounts = new Map<string, number>();
|
||||
for (const event of events.slice(
|
||||
0,
|
||||
options.messagesSnapshotEventCutoff ?? events.length,
|
||||
)) {
|
||||
const submitted = submittedPromptsFromEvents([event])[0];
|
||||
if (!submitted) continue;
|
||||
const prompt = normalizeUserPrompt(submitted.prompt);
|
||||
const count =
|
||||
unclaimedUserCounts.get(prompt) ??
|
||||
Math.max(
|
||||
0,
|
||||
countPromptOccurrences(snapshotMessages, [], prompt) -
|
||||
countPromptOccurrences(options.baselineMessages ?? [], [], prompt),
|
||||
);
|
||||
unclaimedUserCounts.set(prompt, Math.max(0, count - 1));
|
||||
if (count > 0) reflectedSubmissions.add(event);
|
||||
}
|
||||
// Queue events are full snapshots, so only the newest one matters.
|
||||
const queueEvents = queueSnapshotApplied
|
||||
? events.slice(options.queueSnapshotEventCutoff ?? events.length)
|
||||
: events;
|
||||
const lastQueueEvent = queueEvents.findLast(
|
||||
(event) => event.event === "session.pending_prompts",
|
||||
);
|
||||
const reconciled: HubEventEnvelope[] = [];
|
||||
let segment: HubEventEnvelope[] = [];
|
||||
|
||||
const flush = (terminal: boolean) => {
|
||||
if (segment.length === 0) return;
|
||||
const snapshotSegment = segment.filter((event) =>
|
||||
beforeTranscript.has(event),
|
||||
);
|
||||
// A buffered run can contain saved replies followed by unsaved output.
|
||||
const contentEnd = (kind: "assistant" | "reasoning") => {
|
||||
if (!terminal) return -1;
|
||||
const finished = snapshotSegment.findLastIndex(
|
||||
(event) => event.event === `${kind}.finished`,
|
||||
);
|
||||
return finished >= 0 || segment.at(-1)?.event === "run.aborted"
|
||||
? finished
|
||||
: snapshotSegment.length - 1;
|
||||
};
|
||||
const assistantEnd = contentEnd("assistant");
|
||||
const reasoningEnd = contentEnd("reasoning");
|
||||
const streamed = streamedAssistantText(
|
||||
snapshotSegment.slice(0, assistantEnd + 1),
|
||||
);
|
||||
const persistedIndex = streamed
|
||||
? unclaimedAssistantTexts.findIndex((text) => text.endsWith(streamed))
|
||||
: -1;
|
||||
const contentPersisted = persistedIndex >= 0;
|
||||
if (contentPersisted) unclaimedAssistantTexts.splice(persistedIndex, 1);
|
||||
const thinking = streamedAssistantText(
|
||||
snapshotSegment.slice(0, reasoningEnd + 1),
|
||||
"reasoning",
|
||||
);
|
||||
const thinkingIndex = thinking
|
||||
? unclaimedThinking.findIndex((text) => text.endsWith(thinking))
|
||||
: -1;
|
||||
if (thinkingIndex >= 0) unclaimedThinking.splice(thinkingIndex, 1);
|
||||
for (const [index, event] of segment.entries()) {
|
||||
// Preserve the turn-start lifecycle; the UI must only skip its user bubble.
|
||||
if (reflectedSubmissions.has(event)) {
|
||||
reconciled.push({
|
||||
...event,
|
||||
payload: { ...event.payload, transcriptReflected: true },
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if (
|
||||
beforeTranscript.has(event) &&
|
||||
SUPERSEDABLE_CONTENT_EVENTS.has(event.event) &&
|
||||
(event.event.startsWith("reasoning.")
|
||||
? thinkingIndex >= 0 && index <= reasoningEnd
|
||||
: contentPersisted && index <= assistantEnd)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if (
|
||||
event.event === "session.pending_prompts" &&
|
||||
event !== lastQueueEvent
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
// Keep terminal events: run.failed may carry the only error detail.
|
||||
if (beforeTranscript.has(event) && event.event.startsWith("tool.")) {
|
||||
const toolCallId = String(event.payload?.toolCallId ?? "").trim();
|
||||
if (
|
||||
snapshotToolResultIds.has(toolCallId) ||
|
||||
(event.event === "tool.started" &&
|
||||
snapshotToolCallIds.has(toolCallId))
|
||||
)
|
||||
continue;
|
||||
}
|
||||
reconciled.push(event);
|
||||
}
|
||||
segment = [];
|
||||
};
|
||||
|
||||
for (const event of events) {
|
||||
segment.push(event);
|
||||
if (TERMINAL_RUN_EVENTS.has(event.event)) flush(true);
|
||||
}
|
||||
// Never supersede an unterminated tail.
|
||||
flush(false);
|
||||
return reconciled;
|
||||
}
|
||||
@@ -0,0 +1,820 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
CloudSessionApi,
|
||||
CloudSessionError,
|
||||
type CloudSessionRecord,
|
||||
} from "./cloud-sessions";
|
||||
|
||||
const REMOTE_SESSION: CloudSessionRecord = {
|
||||
id: "ses-outer",
|
||||
status: "ready",
|
||||
sandboxUrl: "https://pod.example/hub",
|
||||
repoContext: { repoUrl: "https://github.com/cline/test" },
|
||||
metadata: { modelId: "anthropic/claude-sonnet-5" },
|
||||
createdAt: "2026-08-05T10:00:00.000Z",
|
||||
updatedAt: "2026-08-05T10:01:00.000Z",
|
||||
};
|
||||
|
||||
function jsonResponse(body: unknown, status = 200): Response {
|
||||
return new Response(JSON.stringify(body), {
|
||||
status,
|
||||
headers: { "content-type": "application/json" },
|
||||
});
|
||||
}
|
||||
|
||||
function jwtFor(subject: string, nonce: string): string {
|
||||
const encode = (value: unknown) =>
|
||||
Buffer.from(JSON.stringify(value)).toString("base64url");
|
||||
return (
|
||||
"workos:" +
|
||||
encode({ alg: "none" }) +
|
||||
"." +
|
||||
encode({ sub: subject, nonce }) +
|
||||
".sig"
|
||||
);
|
||||
}
|
||||
|
||||
describe("CloudSessionApi", () => {
|
||||
it("resolves a fresh bearer token for every REST request", async () => {
|
||||
const tokens = ["workos:first", "workos:second"];
|
||||
const authorizations: string[] = [];
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example/",
|
||||
appBaseUrl: "https://app.example/",
|
||||
getAuthToken: async () => tokens.shift(),
|
||||
fetch: async (_input, init) => {
|
||||
authorizations.push(
|
||||
new Headers(init?.headers).get("Authorization") ?? "",
|
||||
);
|
||||
return jsonResponse({ success: true, data: [] });
|
||||
},
|
||||
});
|
||||
|
||||
await api.list();
|
||||
await api.list();
|
||||
|
||||
expect(authorizations).toEqual([
|
||||
"Bearer workos:first",
|
||||
"Bearer workos:second",
|
||||
]);
|
||||
});
|
||||
|
||||
it("uses the dashboard create body and includes branch only when requested", async () => {
|
||||
const bodies: Array<Record<string, unknown>> = [];
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => "sk_test",
|
||||
fetch: async (_input, init) => {
|
||||
bodies.push(JSON.parse(String(init?.body)));
|
||||
return jsonResponse(
|
||||
{ success: true, data: { sessionId: "ses-1", sandboxUrl: "pod" } },
|
||||
201,
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
await api.create({
|
||||
modelId: "anthropic/claude-sonnet-5",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
branch: "feature/login-fix",
|
||||
});
|
||||
await api.create({
|
||||
modelId: "anthropic/claude-sonnet-5",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
});
|
||||
|
||||
expect(bodies[0]).toMatchObject({
|
||||
modelId: "anthropic/claude-sonnet-5",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
branch: "feature/login-fix",
|
||||
title: expect.stringMatching(/^__cline_create_request__:/),
|
||||
});
|
||||
expect(bodies[1]).toMatchObject({
|
||||
modelId: "anthropic/claude-sonnet-5",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
title: expect.stringMatching(/^__cline_create_request__:/),
|
||||
});
|
||||
expect(bodies[1]).not.toHaveProperty("branch");
|
||||
});
|
||||
|
||||
it("treats a missing history snapshot (404) as null, not an empty archive", async () => {
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => "sk_test",
|
||||
fetch: async () => new Response("not found", { status: 404 }),
|
||||
});
|
||||
|
||||
expect(await api.history("ses-1")).toBeNull();
|
||||
});
|
||||
|
||||
it("accepts v1 history and rejects malformed snapshots instead of returning empty history", async () => {
|
||||
const messages = [{ role: "user", content: "Hello" }];
|
||||
let snapshot: unknown = { version: 1, messages };
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => "sk_test",
|
||||
fetch: async () => jsonResponse(snapshot),
|
||||
});
|
||||
|
||||
expect(await api.history("ses-1")).toEqual(messages);
|
||||
snapshot = { version: 1, messages: [] };
|
||||
expect(await api.history("ses-1")).toEqual([]);
|
||||
for (const invalid of [
|
||||
null,
|
||||
{ version: 1 },
|
||||
{ version: 2, messages: [] },
|
||||
]) {
|
||||
snapshot = invalid;
|
||||
await expect(api.history("ses-1")).rejects.toMatchObject({
|
||||
code: "request_failed",
|
||||
detail: "Invalid archived session history",
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("returns the real id before polling readiness and reports provisioning phases", async () => {
|
||||
vi.useFakeTimers();
|
||||
const tokens = ["workos:create", "workos:create", "workos:new-account"];
|
||||
const authorizations: string[] = [];
|
||||
let statusCalls = 0;
|
||||
const phases: Array<string | undefined> = [];
|
||||
try {
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => tokens.shift(),
|
||||
fetch: async (input, init) => {
|
||||
authorizations.push(
|
||||
new Headers(init?.headers).get("Authorization") ?? "",
|
||||
);
|
||||
const url = new URL(String(input));
|
||||
if (init?.method === "POST") {
|
||||
return jsonResponse(
|
||||
{
|
||||
success: true,
|
||||
data: { sessionId: "ses-1", status: "provisioning" },
|
||||
},
|
||||
201,
|
||||
);
|
||||
}
|
||||
expect(url.pathname).toBe("/api/v1/session/ses-1/status");
|
||||
statusCalls += 1;
|
||||
return jsonResponse({
|
||||
success: true,
|
||||
data: {
|
||||
sessionId: "ses-1",
|
||||
status: statusCalls === 1 ? "provisioning" : "ready",
|
||||
phase: statusCalls === 1 ? "cloning_repo" : "ready",
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const created = await api.create({
|
||||
modelId: "anthropic/claude-sonnet-5",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
});
|
||||
expect(created).toMatchObject({
|
||||
sessionId: "ses-1",
|
||||
status: "provisioning",
|
||||
});
|
||||
expect(statusCalls).toBe(0);
|
||||
const ready = api.waitUntilReady(
|
||||
created.sessionId,
|
||||
new AbortController().signal,
|
||||
({ phase }) => phases.push(phase),
|
||||
);
|
||||
await vi.waitFor(() => expect(statusCalls).toBe(1));
|
||||
await vi.advanceTimersByTimeAsync(3_000);
|
||||
|
||||
await expect(ready).resolves.toBeUndefined();
|
||||
expect(statusCalls).toBe(2);
|
||||
expect(phases).toEqual(["cloning_repo", "ready"]);
|
||||
expect(authorizations).toEqual([
|
||||
"Bearer workos:create",
|
||||
"Bearer workos:create",
|
||||
"Bearer workos:create",
|
||||
]);
|
||||
expect(tokens).toEqual(["workos:new-account"]);
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
|
||||
it("refreshes an expired provisioning token without switching accounts", async () => {
|
||||
const original = jwtFor("user-1", "original");
|
||||
const refreshed = jwtFor("user-1", "refreshed");
|
||||
const tokens = [original, refreshed];
|
||||
const authorizations: string[] = [];
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => tokens.shift(),
|
||||
fetch: async (_input, init) => {
|
||||
const authorization =
|
||||
new Headers(init?.headers).get("Authorization") ?? "";
|
||||
authorizations.push(authorization);
|
||||
if (authorization === `Bearer ${original}`) {
|
||||
return jsonResponse(
|
||||
{ success: false, error: "authentication required" },
|
||||
401,
|
||||
);
|
||||
}
|
||||
return jsonResponse({
|
||||
success: true,
|
||||
data: { sessionId: "ses-1", status: "ready" },
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
await expect(
|
||||
api.waitUntilReady("ses-1", new AbortController().signal),
|
||||
).resolves.toBeUndefined();
|
||||
expect(authorizations).toEqual([
|
||||
`Bearer ${original}`,
|
||||
`Bearer ${refreshed}`,
|
||||
]);
|
||||
});
|
||||
|
||||
it("does not switch accounts while refreshing provisioning auth", async () => {
|
||||
const original = jwtFor("user-1", "original");
|
||||
const otherAccount = jwtFor("user-2", "refreshed");
|
||||
const tokens = [original, otherAccount];
|
||||
let statusCalls = 0;
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => tokens.shift(),
|
||||
fetch: async () => {
|
||||
statusCalls += 1;
|
||||
return jsonResponse(
|
||||
{ success: false, error: "authentication required" },
|
||||
401,
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
await expect(
|
||||
api.waitUntilReady("ses-1", new AbortController().signal),
|
||||
).rejects.toMatchObject({ code: "authentication_required" });
|
||||
expect(statusCalls).toBe(1);
|
||||
});
|
||||
|
||||
it("returns a recovered real id without waiting for provisioning", async () => {
|
||||
const requests: string[] = [];
|
||||
let recoveryTitle = "";
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => "workos:fresh",
|
||||
fetch: async (input, init) => {
|
||||
requests.push(
|
||||
`${init?.method ?? "GET"} ${new URL(String(input)).pathname}`,
|
||||
);
|
||||
if (init?.method === "POST") {
|
||||
recoveryTitle = String(JSON.parse(String(init.body)).title);
|
||||
return jsonResponse({ success: false, error: "gateway" }, 500);
|
||||
}
|
||||
return jsonResponse({
|
||||
success: true,
|
||||
data: [
|
||||
{
|
||||
...REMOTE_SESSION,
|
||||
id: "ses-recovered",
|
||||
title: recoveryTitle,
|
||||
status: "provisioning",
|
||||
sandboxUrl: "",
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
await expect(
|
||||
api.create({
|
||||
modelId: "anthropic/claude-sonnet-5",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
}),
|
||||
).resolves.toMatchObject({
|
||||
sessionId: "ses-recovered",
|
||||
status: "provisioning",
|
||||
});
|
||||
expect(requests).toEqual(["POST /api/v1/session", "GET /api/v1/session"]);
|
||||
});
|
||||
|
||||
it("recovers the real id after the create request times out", async () => {
|
||||
vi.useFakeTimers();
|
||||
const requests: string[] = [];
|
||||
let recoveryTitle = "";
|
||||
try {
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
createTimeoutMs: 100,
|
||||
getAuthToken: async () => "workos:fresh",
|
||||
fetch: async (input, init) => {
|
||||
requests.push(
|
||||
`${init?.method ?? "GET"} ${new URL(String(input)).pathname}`,
|
||||
);
|
||||
if (init?.method === "POST") {
|
||||
recoveryTitle = String(JSON.parse(String(init.body)).title);
|
||||
return await new Promise<Response>((_resolve, reject) => {
|
||||
init.signal?.addEventListener(
|
||||
"abort",
|
||||
() => reject(init.signal?.reason),
|
||||
{ once: true },
|
||||
);
|
||||
});
|
||||
}
|
||||
return jsonResponse({
|
||||
success: true,
|
||||
data: [
|
||||
{
|
||||
...REMOTE_SESSION,
|
||||
id: "ses-recovered",
|
||||
title: recoveryTitle,
|
||||
status: "provisioning",
|
||||
sandboxUrl: "",
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const creating = api.create({
|
||||
modelId: "anthropic/claude-sonnet-5",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
});
|
||||
await vi.advanceTimersByTimeAsync(100);
|
||||
|
||||
await expect(creating).resolves.toMatchObject({
|
||||
sessionId: "ses-recovered",
|
||||
});
|
||||
expect(requests).toEqual(["POST /api/v1/session", "GET /api/v1/session"]);
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
|
||||
it("returns a failed recovered session without hiding its real id", async () => {
|
||||
let recoveryTitle = "";
|
||||
const requests: string[] = [];
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => "workos:fresh",
|
||||
fetch: async (input, init) => {
|
||||
requests.push(
|
||||
`${init?.method ?? "GET"} ${new URL(String(input)).pathname}`,
|
||||
);
|
||||
if (init?.method === "POST") {
|
||||
recoveryTitle = String(JSON.parse(String(init.body)).title);
|
||||
return jsonResponse({ success: false, error: "gateway" }, 500);
|
||||
}
|
||||
return jsonResponse({
|
||||
success: true,
|
||||
data: [
|
||||
{
|
||||
...REMOTE_SESSION,
|
||||
title: recoveryTitle,
|
||||
status: "failed",
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
await expect(
|
||||
api.create({
|
||||
modelId: REMOTE_SESSION.metadata.modelId ?? "",
|
||||
repoUrl: REMOTE_SESSION.repoContext.repoUrl ?? "",
|
||||
}),
|
||||
).resolves.toMatchObject({ sessionId: "ses-outer", status: "failed" });
|
||||
expect(requests).toEqual(["POST /api/v1/session", "GET /api/v1/session"]);
|
||||
});
|
||||
|
||||
it("recovers a create accepted before a raw network failure", async () => {
|
||||
let recoveryTitle = "";
|
||||
let listCalls = 0;
|
||||
const now = new Date().toISOString();
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => "sk_test",
|
||||
fetch: async (_input, init) => {
|
||||
if (init?.method === "POST") {
|
||||
recoveryTitle = String(JSON.parse(String(init.body)).title);
|
||||
throw new TypeError("fetch failed");
|
||||
}
|
||||
listCalls += 1;
|
||||
return jsonResponse({
|
||||
success: true,
|
||||
data: [
|
||||
{
|
||||
...REMOTE_SESSION,
|
||||
id: "ses-recovered",
|
||||
title: recoveryTitle,
|
||||
createdAt: now,
|
||||
updatedAt: now,
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
await expect(
|
||||
api.create({
|
||||
requestId: "request-a",
|
||||
modelId: REMOTE_SESSION.metadata.modelId ?? "",
|
||||
repoUrl: REMOTE_SESSION.repoContext.repoUrl ?? "",
|
||||
}),
|
||||
).resolves.toMatchObject({ sessionId: "ses-recovered" });
|
||||
expect(listCalls).toBe(1);
|
||||
});
|
||||
|
||||
it("does not recover another process's identical session", async () => {
|
||||
const now = new Date().toISOString();
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => "sk_test",
|
||||
fetch: async (_input, init) =>
|
||||
init?.method === "POST"
|
||||
? jsonResponse({ success: false, error: "gateway timeout" }, 500)
|
||||
: jsonResponse({
|
||||
success: true,
|
||||
data: [
|
||||
{
|
||||
...REMOTE_SESSION,
|
||||
id: "ses-other-process",
|
||||
title: "__cline_create_request__:other-request",
|
||||
createdAt: now,
|
||||
updatedAt: now,
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
|
||||
await expect(
|
||||
api.create({
|
||||
requestId: "this-request",
|
||||
modelId: REMOTE_SESSION.metadata.modelId ?? "",
|
||||
repoUrl: REMOTE_SESSION.repoContext.repoUrl ?? "",
|
||||
}),
|
||||
).rejects.toMatchObject({ code: "request_failed" });
|
||||
});
|
||||
|
||||
it("hides temporary create request titles from session lists", async () => {
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => "sk_test",
|
||||
fetch: async () =>
|
||||
jsonResponse({
|
||||
success: true,
|
||||
data: [
|
||||
{
|
||||
...REMOTE_SESSION,
|
||||
title: "__cline_create_request__:request-a",
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
|
||||
await expect(api.list()).resolves.toEqual([
|
||||
expect.objectContaining({
|
||||
id: "ses-outer",
|
||||
title: undefined,
|
||||
metadata: expect.objectContaining({
|
||||
createRequestTitle: "__cline_create_request__:request-a",
|
||||
}),
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
it("returns a stable, environment-aware GitHub connection error", async () => {
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://staging-app.example/",
|
||||
getAuthToken: async () => "workos:test",
|
||||
fetch: async () =>
|
||||
jsonResponse({ success: false, error: "GitHub is not connected" }, 412),
|
||||
});
|
||||
|
||||
const error = await api
|
||||
.create({ modelId: "model", repoUrl: "https://github.com/cline/test" })
|
||||
.catch((caught) => caught);
|
||||
|
||||
expect(error).toBeInstanceOf(CloudSessionError);
|
||||
expect(error.code).toBe("github_not_connected");
|
||||
expect(error.message).toBe(
|
||||
'CLOUD_SESSION_ERROR:{"code":"github_not_connected","message":"GitHub is not connected","connectUrl":"https://staging-app.example/dashboard/integrations"}',
|
||||
);
|
||||
});
|
||||
|
||||
it("routes organization GitHub setup to organization integrations", async () => {
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://staging-app.example/",
|
||||
getAuthToken: async () => "workos:test",
|
||||
fetch: async () =>
|
||||
jsonResponse({ success: false, error: "GitHub is not connected" }, 412),
|
||||
});
|
||||
|
||||
const error = await api
|
||||
.create({
|
||||
modelId: "model",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
organizationId: "org-cline-bot",
|
||||
})
|
||||
.catch((caught) => caught);
|
||||
|
||||
expect(error).toBeInstanceOf(CloudSessionError);
|
||||
expect(error.connectUrl).toBe(
|
||||
"https://staging-app.example/dashboard/organization/integrations",
|
||||
);
|
||||
});
|
||||
|
||||
it("lists connected GitHub repositories and their branches", async () => {
|
||||
const requestedPaths: string[] = [];
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => "workos:test",
|
||||
fetch: async (input) => {
|
||||
const path = new URL(String(input)).pathname;
|
||||
requestedPaths.push(path);
|
||||
if (path.endsWith("/branches")) {
|
||||
return jsonResponse({
|
||||
success: true,
|
||||
data: [{ name: "main" }, { name: "feature/cloud" }],
|
||||
});
|
||||
}
|
||||
return jsonResponse({
|
||||
success: true,
|
||||
data: [
|
||||
{
|
||||
id: 42,
|
||||
name: "cline",
|
||||
full_name: "cline/cline",
|
||||
html_url: "https://github.com/cline/cline",
|
||||
clone_url: "https://github.com/cline/cline.git",
|
||||
default_branch: "main",
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
expect(await api.listRepositories()).toEqual({
|
||||
connected: true,
|
||||
connectUrl: "https://app.example/dashboard/integrations",
|
||||
repositories: [
|
||||
{
|
||||
id: 42,
|
||||
name: "cline",
|
||||
fullName: "cline/cline",
|
||||
url: "https://github.com/cline/cline",
|
||||
defaultBranch: "main",
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(await api.listBranches(42)).toEqual({
|
||||
available: true,
|
||||
branches: ["main", "feature/cloud"],
|
||||
nextToken: "",
|
||||
});
|
||||
expect(requestedPaths).toEqual([
|
||||
"/api/v1/integrations/github/repositories",
|
||||
"/api/v1/integrations/github/repositories/42/branches",
|
||||
]);
|
||||
});
|
||||
|
||||
it("reads paginated branch responses and forwards search cursors", async () => {
|
||||
let requestedUrl = "";
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => "workos:test",
|
||||
fetch: async (input) => {
|
||||
requestedUrl = String(input);
|
||||
return jsonResponse({
|
||||
success: true,
|
||||
data: {
|
||||
items: [{ name: "feature/cloud" }],
|
||||
nextToken: "next/page",
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
expect(
|
||||
await api.listBranches(42, undefined, {
|
||||
cursor: "search cursor",
|
||||
query: "feature/cloud",
|
||||
}),
|
||||
).toEqual({
|
||||
available: true,
|
||||
branches: ["feature/cloud"],
|
||||
nextToken: "next/page",
|
||||
});
|
||||
const url = new URL(requestedUrl);
|
||||
expect(url.pathname).toBe(
|
||||
"/api/v1/integrations/github/repositories/42/branches",
|
||||
);
|
||||
expect(url.searchParams.get("query")).toBe("feature/cloud");
|
||||
expect(url.searchParams.get("cursor")).toBe("search cursor");
|
||||
});
|
||||
|
||||
it("filters legacy branch responses while backends roll out", async () => {
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => "workos:test",
|
||||
fetch: async () =>
|
||||
jsonResponse({
|
||||
success: true,
|
||||
data: [{ name: "main" }, { name: "feature/cloud" }],
|
||||
}),
|
||||
});
|
||||
|
||||
expect(await api.listBranches(42, undefined, { query: "FEATURE" })).toEqual(
|
||||
{
|
||||
available: true,
|
||||
branches: ["feature/cloud"],
|
||||
nextToken: "",
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it("falls back to the repository default when the branch API is unavailable", async () => {
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => "workos:test",
|
||||
fetch: async () =>
|
||||
jsonResponse({ success: false, error: "route not found" }, 404),
|
||||
});
|
||||
|
||||
expect(await api.listBranches(42)).toEqual({
|
||||
available: false,
|
||||
branches: [],
|
||||
});
|
||||
});
|
||||
|
||||
it("uses organization-scoped repository and branch endpoints", async () => {
|
||||
const requestedPaths: string[] = [];
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => "workos:test",
|
||||
fetch: async (input) => {
|
||||
const path = new URL(String(input)).pathname;
|
||||
requestedPaths.push(path);
|
||||
return jsonResponse({ success: true, data: [] });
|
||||
},
|
||||
});
|
||||
|
||||
expect(await api.listRepositories("org-cline-bot")).toMatchObject({
|
||||
connected: true,
|
||||
connectUrl: "https://app.example/dashboard/organization/integrations",
|
||||
});
|
||||
await api.listBranches(42, "org-cline-bot");
|
||||
expect(requestedPaths).toEqual([
|
||||
"/api/v1/organizations/org-cline-bot/integrations/github/repositories",
|
||||
"/api/v1/organizations/org-cline-bot/integrations/github/repositories/42/branches",
|
||||
]);
|
||||
});
|
||||
|
||||
it("refuses ambiguous recovery for overlapping identical create requests", async () => {
|
||||
const now = new Date().toISOString();
|
||||
const record = (id: string, createdAt: string) => ({
|
||||
id,
|
||||
title: "__cline_create_request__:same-request",
|
||||
status: "running",
|
||||
sandboxUrl: `pod-${id}`,
|
||||
repoContext: { repoUrl: "https://github.com/cline/test" },
|
||||
metadata: { modelId: "anthropic/claude-sonnet-5" },
|
||||
createdAt,
|
||||
updatedAt: createdAt,
|
||||
});
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => "sk_test",
|
||||
fetch: async (_input, init) =>
|
||||
init?.method === "POST"
|
||||
? jsonResponse({ success: false, error: "gateway timeout" }, 500)
|
||||
: jsonResponse({
|
||||
success: true,
|
||||
data: [
|
||||
record("ses-newer", now),
|
||||
record("ses-older", new Date(Date.now() - 1_000).toISOString()),
|
||||
],
|
||||
}),
|
||||
});
|
||||
const input = {
|
||||
requestId: "same-request",
|
||||
modelId: "anthropic/claude-sonnet-5",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
};
|
||||
|
||||
const error = await api.create(input).catch((caught) => caught);
|
||||
expect(error).toMatchObject({ code: "request_failed" });
|
||||
expect(String(error)).toContain("ambiguous result");
|
||||
});
|
||||
|
||||
it("reports provisioning failure without deleting the known session", async () => {
|
||||
const authorizations: string[] = [];
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => "workos:create",
|
||||
fetch: async (input, init) => {
|
||||
authorizations.push(
|
||||
new Headers(init?.headers).get("Authorization") ?? "",
|
||||
);
|
||||
expect(new URL(String(input)).pathname).toBe(
|
||||
"/api/v1/session/ses-failed/status",
|
||||
);
|
||||
return jsonResponse({
|
||||
success: true,
|
||||
data: {
|
||||
sessionId: "ses-failed",
|
||||
status: "failed",
|
||||
statusReason: "clone failed",
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
await expect(
|
||||
api.waitUntilReady("ses-failed", new AbortController().signal),
|
||||
).rejects.toMatchObject({ code: "session_failed", detail: "clone failed" });
|
||||
expect(authorizations).toEqual(["Bearer workos:create"]);
|
||||
});
|
||||
|
||||
it("turns a generic forbidden response into actionable account guidance", async () => {
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => "workos:test",
|
||||
fetch: async () =>
|
||||
jsonResponse({ success: false, error: "forbidden" }, 403),
|
||||
});
|
||||
|
||||
const error = await api
|
||||
.create({ modelId: "model", repoUrl: "https://github.com/cline/test" })
|
||||
.catch((caught) => caught);
|
||||
|
||||
expect(error).toBeInstanceOf(CloudSessionError);
|
||||
expect(error.code).toBe("request_failed");
|
||||
expect(error.status).toBe(403);
|
||||
expect(error.message).toContain(
|
||||
"Switch to Personal or another organization in Settings → Account",
|
||||
);
|
||||
});
|
||||
|
||||
it("does not run list recovery after a fast client-side rejection", async () => {
|
||||
let listRequests = 0;
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example",
|
||||
getAuthToken: async () => "sk_test",
|
||||
fetch: async (_input, init) => {
|
||||
if (init?.method === "POST") {
|
||||
return jsonResponse({ success: false, error: "invalid branch" }, 422);
|
||||
}
|
||||
listRequests += 1;
|
||||
return jsonResponse({ success: true, data: [] });
|
||||
},
|
||||
});
|
||||
|
||||
await expect(
|
||||
api.create({
|
||||
modelId: "anthropic/claude-sonnet-5",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
}),
|
||||
).rejects.toThrow(/invalid branch/);
|
||||
expect(listRequests).toBe(0);
|
||||
});
|
||||
|
||||
it("returns the GitHub connection action when no integration exists", async () => {
|
||||
const api = new CloudSessionApi({
|
||||
apiBaseUrl: "https://api.example",
|
||||
appBaseUrl: "https://app.example/",
|
||||
getAuthToken: async () => "workos:test",
|
||||
fetch: async () =>
|
||||
jsonResponse({ success: false, error: "not connected" }, 404),
|
||||
});
|
||||
|
||||
expect(await api.listRepositories()).toEqual({
|
||||
connected: false,
|
||||
connectUrl: "https://app.example/dashboard/integrations",
|
||||
repositories: [],
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,431 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
type CloudSessionApi,
|
||||
CloudSessionError,
|
||||
CloudSessionManager,
|
||||
type CloudSessionRecord,
|
||||
cloudSessionToDiscoveryRecord,
|
||||
} from "./cloud-sessions";
|
||||
import type { SidecarContext } from "./types";
|
||||
|
||||
const REMOTE_SESSION: CloudSessionRecord = {
|
||||
id: "ses-outer",
|
||||
status: "ready",
|
||||
sandboxUrl: "https://pod.example/hub",
|
||||
repoContext: { repoUrl: "https://github.com/cline/test" },
|
||||
metadata: { modelId: "anthropic/claude-sonnet-5" },
|
||||
createdAt: "2026-08-05T10:00:00.000Z",
|
||||
updatedAt: "2026-08-05T10:01:00.000Z",
|
||||
};
|
||||
|
||||
function createContext(): { ctx: SidecarContext } {
|
||||
const ctx = {
|
||||
liveSessions: new Map(),
|
||||
restoringWorkspacePaths: new Set(),
|
||||
streamIndices: new Map(),
|
||||
coreStreamActivity: new Map(),
|
||||
bootId: "cloud-test-boot",
|
||||
wsClients: new Set([
|
||||
{
|
||||
data: { canApproveTools: true },
|
||||
send() {},
|
||||
},
|
||||
]),
|
||||
pendingApprovals: new Map(),
|
||||
pendingQuestions: new Map(),
|
||||
sessionManager: null,
|
||||
cloudSessionManager: null,
|
||||
hubClient: null,
|
||||
workspaceRoot: "/local/workspace",
|
||||
unsubscribeSessionEvents: null,
|
||||
hubBuildMismatch: null,
|
||||
} as SidecarContext;
|
||||
return { ctx };
|
||||
}
|
||||
|
||||
describe("CloudSessionManager lifecycle", () => {
|
||||
it.each([
|
||||
"upstream request failed",
|
||||
"couldn't authenticate with GitHub; try reconnecting the integration",
|
||||
])("surfaces create failure without retrying: %s", async (message) => {
|
||||
const { ctx } = createContext();
|
||||
const create = vi.fn(async () => {
|
||||
throw new CloudSessionError("request_failed", message, undefined, 502);
|
||||
});
|
||||
const manager = new CloudSessionManager(ctx, {
|
||||
api: { create } as unknown as CloudSessionApi,
|
||||
apiBaseUrl: "https://api.example",
|
||||
getAuthToken: async () => "workos:fresh",
|
||||
});
|
||||
|
||||
await expect(
|
||||
manager.create({
|
||||
modelId: "model",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
}),
|
||||
).rejects.toThrow(message);
|
||||
expect(create).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("projects the outer remote-session id as the desktop session id", () => {
|
||||
expect(
|
||||
cloudSessionToDiscoveryRecord({
|
||||
...REMOTE_SESSION,
|
||||
repoContext: {
|
||||
...REMOTE_SESSION.repoContext,
|
||||
branch: "feature/cloud",
|
||||
},
|
||||
}),
|
||||
).toMatchObject({
|
||||
sessionId: "ses-outer",
|
||||
origin: "cloud",
|
||||
executionTarget: "cloud",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
workspaceRoot: "/workspace",
|
||||
branch: "feature/cloud",
|
||||
metadata: {
|
||||
git: {
|
||||
url: "https://github.com/cline/test",
|
||||
branch: "feature/cloud",
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("treats a live session's future expiredAt as a TTL, not an end time", () => {
|
||||
const alive = cloudSessionToDiscoveryRecord({
|
||||
...REMOTE_SESSION,
|
||||
expiredAt: new Date(Date.now() + 60 * 60 * 1000).toISOString(),
|
||||
});
|
||||
expect(alive.endedAt).toBeUndefined();
|
||||
|
||||
const expired = cloudSessionToDiscoveryRecord({
|
||||
...REMOTE_SESSION,
|
||||
expiredAt: "2026-08-01T00:00:00.000Z",
|
||||
});
|
||||
expect(expired.endedAt).toBe("2026-08-01T00:00:00.000Z");
|
||||
});
|
||||
|
||||
it("overlays live status and prompt-derived title on refreshed REST rows", async () => {
|
||||
const { ctx } = createContext();
|
||||
ctx.liveSessions.set("ses-outer", {
|
||||
config: { executionTarget: "cloud" },
|
||||
messages: [],
|
||||
promptsInQueue: [],
|
||||
busy: true,
|
||||
startedAt: Date.now(),
|
||||
status: "running",
|
||||
prompt: "Fix reconnect behavior\nwith a regression test",
|
||||
attachedViaHub: true,
|
||||
});
|
||||
const manager = new CloudSessionManager(ctx, {
|
||||
api: { list: async () => [REMOTE_SESSION] } as CloudSessionApi,
|
||||
apiBaseUrl: "https://api.example",
|
||||
getAuthToken: async () => "workos:fresh",
|
||||
});
|
||||
|
||||
const [session] = await manager.listForDiscovery();
|
||||
|
||||
expect(session).toMatchObject({
|
||||
sessionId: "ses-outer",
|
||||
origin: "cloud",
|
||||
status: "running",
|
||||
prompt: "Fix reconnect behavior\nwith a regression test",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
metadata: {
|
||||
title: "Fix reconnect behavior",
|
||||
origin: "cloud",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
"expired",
|
||||
"failed",
|
||||
] as const)("reconciles a %s session without a Hub connection", async (status) => {
|
||||
const { ctx } = createContext();
|
||||
const remote: CloudSessionRecord = { ...REMOTE_SESSION };
|
||||
const manager = new CloudSessionManager(ctx, {
|
||||
api: {
|
||||
create: async () => ({
|
||||
sessionId: remote.id,
|
||||
status: "provisioning",
|
||||
sandboxUrl: "",
|
||||
}),
|
||||
list: async () => [remote],
|
||||
} as unknown as CloudSessionApi,
|
||||
apiBaseUrl: "https://api.example",
|
||||
getAuthToken: async () => "workos:fresh",
|
||||
});
|
||||
await manager.create({
|
||||
modelId: "anthropic/claude-sonnet-5",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
});
|
||||
expect((await manager.listForDiscovery())[0].status).toBe("ready");
|
||||
|
||||
const endedAt = new Date(Date.now() - 1_000).toISOString();
|
||||
if (status === "expired") {
|
||||
remote.expiredAt = endedAt;
|
||||
} else {
|
||||
remote.status = "failed";
|
||||
remote.lastActivityAt = endedAt;
|
||||
}
|
||||
expect((await manager.listForDiscovery())[0]).toMatchObject({
|
||||
status,
|
||||
endedAt,
|
||||
});
|
||||
expect(ctx.liveSessions.get(remote.id)).toMatchObject({
|
||||
status,
|
||||
busy: false,
|
||||
endedAt: Date.parse(endedAt),
|
||||
});
|
||||
if (status === "failed") {
|
||||
remote.title = "Renamed after failure";
|
||||
remote.updatedAt = new Date().toISOString();
|
||||
expect((await manager.listForDiscovery())[0].endedAt).toBe(endedAt);
|
||||
const live = ctx.liveSessions.get(remote.id)!;
|
||||
ctx.liveSessions.clear();
|
||||
expect((await manager.listForDiscovery())[0].endedAt).toBe(endedAt);
|
||||
|
||||
const hubEndedAt = Date.parse(endedAt) + 500;
|
||||
live.endedAt = hubEndedAt;
|
||||
ctx.liveSessions.set(remote.id, live);
|
||||
expect((await manager.listForDiscovery())[0].endedAt).toBe(
|
||||
new Date(hubEndedAt).toISOString(),
|
||||
);
|
||||
ctx.liveSessions.clear();
|
||||
delete remote.lastActivityAt;
|
||||
expect((await manager.listForDiscovery())[0].endedAt).toBe(
|
||||
remote.createdAt,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it("single-flights repeated starts for the same client request", async () => {
|
||||
const { ctx } = createContext();
|
||||
let createCalls = 0;
|
||||
let finishCreate:
|
||||
| ((value: {
|
||||
sessionId: string;
|
||||
status: string;
|
||||
sandboxUrl: string;
|
||||
}) => void)
|
||||
| undefined;
|
||||
const manager = new CloudSessionManager(ctx, {
|
||||
api: {
|
||||
list: async () => [],
|
||||
create: () => {
|
||||
createCalls += 1;
|
||||
return new Promise((resolve) => {
|
||||
finishCreate = resolve;
|
||||
});
|
||||
},
|
||||
} as unknown as CloudSessionApi,
|
||||
apiBaseUrl: "https://api.example",
|
||||
getAuthToken: async () => "workos:fresh",
|
||||
});
|
||||
const input = {
|
||||
requestId: "client-start-1",
|
||||
modelId: "anthropic/claude-sonnet-5",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
};
|
||||
|
||||
const first = manager.create(input);
|
||||
const second = manager.create(input);
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
expect(createCalls).toBe(1);
|
||||
expect(await manager.listForDiscovery()).toEqual([]);
|
||||
|
||||
finishCreate?.({
|
||||
sessionId: "ses-created",
|
||||
status: "provisioning",
|
||||
sandboxUrl: "",
|
||||
});
|
||||
await expect(Promise.all([first, second])).resolves.toEqual([
|
||||
expect.objectContaining({ sessionId: "ses-created" }),
|
||||
expect.objectContaining({ sessionId: "ses-created" }),
|
||||
]);
|
||||
});
|
||||
|
||||
it("keeps identical starts from separate chats independent", async () => {
|
||||
const { ctx } = createContext();
|
||||
let createCalls = 0;
|
||||
const manager = new CloudSessionManager(ctx, {
|
||||
api: {
|
||||
list: async () => [],
|
||||
create: async () => {
|
||||
createCalls += 1;
|
||||
return {
|
||||
sessionId: `ses-created-${createCalls}`,
|
||||
status: "provisioning",
|
||||
sandboxUrl: "pod",
|
||||
};
|
||||
},
|
||||
} as unknown as CloudSessionApi,
|
||||
apiBaseUrl: "https://api.example",
|
||||
getAuthToken: async () => "workos:fresh",
|
||||
});
|
||||
const input = {
|
||||
modelId: "anthropic/claude-sonnet-5",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
};
|
||||
|
||||
const [first, second] = await Promise.all([
|
||||
manager.create({ ...input, requestId: "chat-a" }),
|
||||
manager.create({ ...input, requestId: "chat-b" }),
|
||||
]);
|
||||
|
||||
expect(createCalls).toBe(2);
|
||||
expect(first.sessionId).not.toBe(second.sessionId);
|
||||
});
|
||||
|
||||
it("returns cached cloud discovery promptly while a refresh is slow", async () => {
|
||||
const { ctx } = createContext();
|
||||
let listCalls = 0;
|
||||
let finishRefresh: ((value: CloudSessionRecord[]) => void) | undefined;
|
||||
const manager = new CloudSessionManager(ctx, {
|
||||
api: {
|
||||
list: async () => {
|
||||
listCalls += 1;
|
||||
if (listCalls === 1) return [REMOTE_SESSION];
|
||||
return await new Promise((resolve) => {
|
||||
finishRefresh = resolve;
|
||||
});
|
||||
},
|
||||
} as unknown as CloudSessionApi,
|
||||
apiBaseUrl: "https://api.example",
|
||||
getAuthToken: async () => "workos:fresh",
|
||||
});
|
||||
await manager.listForDiscovery();
|
||||
|
||||
const cached = await manager.listForDiscovery({ timeoutMs: 1 });
|
||||
|
||||
expect(cached).toEqual([
|
||||
expect.objectContaining({ sessionId: "ses-outer", origin: "cloud" }),
|
||||
]);
|
||||
finishRefresh?.([]);
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
});
|
||||
|
||||
it("uses only the active organization for billing and session listing", async () => {
|
||||
const { ctx } = createContext();
|
||||
const listCalls: Array<string | undefined> = [];
|
||||
const repositoryScopes: Array<string | undefined> = [];
|
||||
const branchScopes: Array<string | undefined> = [];
|
||||
let createInput: Record<string, unknown> | undefined;
|
||||
const orgSession = { ...REMOTE_SESSION, id: "ses-org", title: undefined };
|
||||
const manager = new CloudSessionManager(ctx, {
|
||||
api: {
|
||||
list: async (organizationId?: string) => {
|
||||
listCalls.push(organizationId);
|
||||
return organizationId
|
||||
? [orgSession]
|
||||
: [{ ...REMOTE_SESSION, title: undefined }];
|
||||
},
|
||||
create: async (input: Record<string, unknown>) => {
|
||||
createInput = input;
|
||||
return {
|
||||
sessionId: "ses-created",
|
||||
status: "provisioning",
|
||||
sandboxUrl: "",
|
||||
};
|
||||
},
|
||||
listRepositories: async (organizationId?: string) => {
|
||||
repositoryScopes.push(organizationId);
|
||||
return { connected: true, connectUrl: "", repositories: [] };
|
||||
},
|
||||
listBranches: async (
|
||||
_repositoryId: number,
|
||||
organizationId?: string,
|
||||
) => {
|
||||
branchScopes.push(organizationId);
|
||||
return { available: true, branches: [] };
|
||||
},
|
||||
} as unknown as CloudSessionApi,
|
||||
apiBaseUrl: "https://api.example",
|
||||
getAuthToken: async () => "workos:fresh",
|
||||
getActiveOrganizationId: async () => "org-cline-bot",
|
||||
});
|
||||
const scoped = await manager.list();
|
||||
expect(listCalls).toEqual(["org-cline-bot"]);
|
||||
expect(scoped.map((session) => session.id)).toEqual(["ses-org"]);
|
||||
await manager.listRepositories();
|
||||
await manager.listBranches(42);
|
||||
expect(repositoryScopes).toEqual(["org-cline-bot"]);
|
||||
expect(branchScopes).toEqual(["org-cline-bot"]);
|
||||
|
||||
await manager.create({
|
||||
modelId: "anthropic/claude-sonnet-5",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
});
|
||||
expect(createInput).toMatchObject({ organizationId: "org-cline-bot" });
|
||||
});
|
||||
|
||||
it("refreshes the active organization before creating a session", async () => {
|
||||
const { ctx } = createContext();
|
||||
let serverScope = "org-a";
|
||||
let cachedScope = serverScope;
|
||||
const lookupOptions: Array<{ fresh?: boolean } | undefined> = [];
|
||||
let createInput: Record<string, unknown> | undefined;
|
||||
const manager = new CloudSessionManager(ctx, {
|
||||
api: {
|
||||
list: async () => [],
|
||||
create: async (input: Record<string, unknown>) => {
|
||||
createInput = input;
|
||||
return {
|
||||
sessionId: "ses-created",
|
||||
status: "provisioning",
|
||||
sandboxUrl: "",
|
||||
};
|
||||
},
|
||||
} as unknown as CloudSessionApi,
|
||||
apiBaseUrl: "https://api.example",
|
||||
getAuthToken: async () => "workos:fresh",
|
||||
getActiveOrganizationId: async (options) => {
|
||||
lookupOptions.push(options);
|
||||
if (options?.fresh) cachedScope = serverScope;
|
||||
return cachedScope;
|
||||
},
|
||||
});
|
||||
|
||||
await manager.list();
|
||||
serverScope = "org-b";
|
||||
await manager.create({
|
||||
modelId: "anthropic/claude-sonnet-5",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
});
|
||||
|
||||
expect(lookupOptions).toEqual([undefined, { fresh: true }]);
|
||||
expect(createInput).toMatchObject({ organizationId: "org-b" });
|
||||
});
|
||||
|
||||
it("does not silently bill personal credits when account scope lookup fails", async () => {
|
||||
const { ctx } = createContext();
|
||||
let createInput: Record<string, unknown> | undefined;
|
||||
const manager = new CloudSessionManager(ctx, {
|
||||
api: {
|
||||
list: async () => [],
|
||||
create: async (input: Record<string, unknown>) => {
|
||||
createInput = input;
|
||||
return {
|
||||
sessionId: "ses-created",
|
||||
status: "provisioning",
|
||||
sandboxUrl: "",
|
||||
};
|
||||
},
|
||||
} as unknown as CloudSessionApi,
|
||||
apiBaseUrl: "https://api.example",
|
||||
getAuthToken: async () => "workos:fresh",
|
||||
getActiveOrganizationId: async () => {
|
||||
throw new Error("account endpoint down");
|
||||
},
|
||||
});
|
||||
await expect(
|
||||
manager.create({
|
||||
modelId: "anthropic/claude-sonnet-5",
|
||||
repoUrl: "https://github.com/cline/test",
|
||||
}),
|
||||
).rejects.toThrow("account endpoint down");
|
||||
expect(createInput?.organizationId).toBeUndefined();
|
||||
});
|
||||
});
|
||||
@@ -7,7 +7,11 @@ import {
|
||||
setModelToolEnabledGlobally,
|
||||
watchManagedHubBuildMismatch,
|
||||
} from "@cline/core";
|
||||
import { captureSdkError, claimHubDaemonProcess } from "@cline/shared";
|
||||
import {
|
||||
captureSdkError,
|
||||
claimHubDaemonProcess,
|
||||
disableCurrentDirectoryExecutableSearch,
|
||||
} from "@cline/shared";
|
||||
import { prewarmWorkspaceMetadata } from "./chat-session";
|
||||
import { configureConnectorCliLaunch } from "./connectors";
|
||||
import {
|
||||
@@ -232,6 +236,7 @@ async function runEntrypoint(): Promise<void> {
|
||||
runTelemetrySelfcheck();
|
||||
return;
|
||||
}
|
||||
disableCurrentDirectoryExecutableSearch();
|
||||
// Claim rather than read: consuming the sentinel keeps daemon-hosted sessions
|
||||
// from handing it to every process they spawn.
|
||||
if (claimHubDaemonProcess()) {
|
||||
|
||||
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 91 KiB |
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 166 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 923 KiB |
|
After Width: | Height: | Size: 879 KiB |
|
After Width: | Height: | Size: 282 KiB |
|
After Width: | Height: | Size: 736 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 238 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 197 KiB After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 839 B After Width: | Height: | Size: 509 B |
@@ -1,28 +1,80 @@
|
||||
; Tauri's installer only stops the main binary (CheckIfAppIsRunning in its
|
||||
; utils.nsh). The bundled sidecar re-executes itself as the detached Cline Hub
|
||||
; daemon, which by design outlives the app and so keeps code-sidecar.exe
|
||||
; locked. Without this, updating fails with "Error opening file for writing"
|
||||
; (and uninstalling leaves the exe behind) until the user kills that process
|
||||
; by hand.
|
||||
!include "Win\RestartManager.nsh"
|
||||
|
||||
; The Hub re-executes code-sidecar.exe as a detached daemon and outlives the
|
||||
; desktop. Stop users of both installed executables before replacing either:
|
||||
; stopping only the sidecar first leaves the desktop able to spawn it again.
|
||||
;
|
||||
; Match on the full path rather than the image name: the production Hub is
|
||||
; shared per machine, and a code-sidecar.exe from another install (e.g. the
|
||||
; side-by-side Cline Beta) may be hosting it without locking ours. The path
|
||||
; travels through an environment variable so it never needs quoting inside
|
||||
; the PowerShell command ($INSTDIR contains the username).
|
||||
!macro STOP_SIDECAR_PROCESSES
|
||||
System::Call 'kernel32::SetEnvironmentVariable(t "CLINE_SIDECAR_EXE", t "$INSTDIR\code-sidecar.exe")'
|
||||
nsExec::ExecToLog `powershell.exe -NoProfile -NonInteractive -Command "Get-Process code-sidecar -ErrorAction SilentlyContinue | Where-Object { $$_.Path -eq $$env:CLINE_SIDECAR_EXE } | Stop-Process -Force"`
|
||||
Pop $R0
|
||||
; TerminateProcess returns before the file handle is released; same wait
|
||||
; Tauri uses after killing the main binary.
|
||||
Sleep 500
|
||||
; Restart Manager identifies users of the exact files across architectures.
|
||||
; Do not use Get-Process.Path: NSIS is x86 even for an x64 bundle, and x86
|
||||
; PowerShell returns an empty Path for x64 processes. Do not kill by image
|
||||
; name either: another installation (e.g. Beta) must remain untouched.
|
||||
!macro StopDesktopProcesses
|
||||
Push $0
|
||||
Push $1
|
||||
Push $2
|
||||
Push $3
|
||||
Push $4
|
||||
|
||||
retry:
|
||||
System::Call 'rstrtmgr::RmStartSession(*i .r1, i 0, w .r2) i .r0'
|
||||
${If} $0 != 0
|
||||
Goto failed ; no session to end
|
||||
${EndIf}
|
||||
|
||||
!insertmacro RestartManager_RegisterFile $1 "$INSTDIR\${MAINBINARYNAME}.exe"
|
||||
${If} $0 != 0
|
||||
Goto end_session
|
||||
${EndIf}
|
||||
|
||||
!insertmacro RestartManager_RegisterFile $1 "$INSTDIR\code-sidecar.exe"
|
||||
${If} $0 != 0
|
||||
Goto end_session
|
||||
${EndIf}
|
||||
|
||||
StrCpy $3 0
|
||||
System::Call 'rstrtmgr::RmGetList(i r1, *i .r2, *i r3, p 0, *i .r4) i .r0'
|
||||
${If} $0 == 234 ; ERROR_MORE_DATA: at least one process uses these files
|
||||
; RmShutdown waits for shutdown; unlike TerminateProcess + Sleep, its
|
||||
; return value tells us whether stopping the file users failed.
|
||||
System::Call 'rstrtmgr::RmShutdown(i r1, i ${RmForceShutdown}, p 0) i .r0'
|
||||
${EndIf}
|
||||
; A 0 from RmGetList means nothing holds the files: $0 stays 0.
|
||||
|
||||
end_session:
|
||||
; Release the session on every path, preserving the operation's error.
|
||||
System::Call 'rstrtmgr::RmEndSession(i r1)'
|
||||
${If} $0 == 0
|
||||
Goto done
|
||||
${EndIf}
|
||||
|
||||
failed:
|
||||
DetailPrint "Could not stop Cline processes in $INSTDIR (Restart Manager error $0)."
|
||||
; Tauri's updater runs the installer passive (/P): the user who clicked
|
||||
; "Restart now" is watching, and NSIS's own write-failure dialog would
|
||||
; have shown in that mode anyway, so offer a retry. Silent (/S) takes
|
||||
; the default and fails closed. Aborting rather than continuing keeps
|
||||
; the install from ending half-replaced.
|
||||
MessageBox MB_RETRYCANCEL|MB_ICONSTOP "Could not stop Cline processes using files in:$\r$\n$INSTDIR$\r$\n$\r$\nClose Cline and its background tasks, then retry. Windows error: $0." /SD IDCANCEL IDRETRY retry
|
||||
Pop $4
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Pop $0
|
||||
SetErrorLevel 2
|
||||
Abort
|
||||
|
||||
done:
|
||||
Pop $4
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Pop $0
|
||||
!macroend
|
||||
|
||||
!macro NSIS_HOOK_PREINSTALL
|
||||
!insertmacro STOP_SIDECAR_PROCESSES
|
||||
!insertmacro CallArtificialFunction StopDesktopProcesses
|
||||
!macroend
|
||||
|
||||
!macro NSIS_HOOK_PREUNINSTALL
|
||||
!insertmacro STOP_SIDECAR_PROCESSES
|
||||
!insertmacro CallArtificialFunction StopDesktopProcesses
|
||||
!macroend
|
||||
|
||||
@@ -814,15 +814,21 @@ async fn check_for_update_now(
|
||||
|
||||
/// Icon ids accepted by `set_app_icon`; kept in sync with APP_ICONS in
|
||||
/// webview/lib/app-icon.ts. Every id has a matching bundled resource at
|
||||
/// icons/app/<id>.png.
|
||||
/// icons/app/<id>.png, plus a macOS variant at icons/app/macos/<id>.png with
|
||||
/// the transparent margin the Dock expects (artwork fills ~80% of the canvas).
|
||||
const APP_ICONS: [&str; 4] = ["classic", "midnight", "hologram", "chip"];
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
const APP_ICON_RESOURCE_DIR: &str = "icons/app/macos";
|
||||
#[cfg(target_os = "windows")]
|
||||
const APP_ICON_RESOURCE_DIR: &str = "icons/app";
|
||||
|
||||
#[cfg(any(target_os = "macos", target_os = "windows"))]
|
||||
fn resolve_app_icon(app: &tauri::AppHandle, icon: &str) -> Result<PathBuf, String> {
|
||||
let icon_path = app
|
||||
.path()
|
||||
.resolve(
|
||||
format!("icons/app/{icon}.png"),
|
||||
format!("{APP_ICON_RESOURCE_DIR}/{icon}.png"),
|
||||
tauri::path::BaseDirectory::Resource,
|
||||
)
|
||||
.map_err(|e| format!("failed resolving app icon resource: {e}"))?;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "Cline",
|
||||
"version": "0.0.27",
|
||||
"version": "0.0.30",
|
||||
"identifier": "bot.cline.app",
|
||||
"build": {
|
||||
"beforeDevCommand": "bun run build:sidecar:bin && bun run dev:web",
|
||||
@@ -38,7 +38,7 @@
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"externalBin": ["bin/code-sidecar"],
|
||||
"resources": ["icons/app/*.png"],
|
||||
"resources": ["icons/app/*.png", "icons/app/macos/*.png"],
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
|
||||
@@ -659,7 +659,7 @@ export function AgentSidebar({
|
||||
);
|
||||
// A single click flips straight to the other mode (a dropdown here would
|
||||
// cost an extra click for a two-option choice); the icon shows the mode
|
||||
// that is currently active.
|
||||
// the click switches to, not the one currently active.
|
||||
const sortToggle = (
|
||||
<Button
|
||||
aria-label={`Sort sessions: ${sortMode === "time" ? "Time" : "Project"}`}
|
||||
@@ -676,9 +676,9 @@ export function AgentSidebar({
|
||||
variant="ghost"
|
||||
>
|
||||
{sortMode === "time" ? (
|
||||
<Clock3 className="size-3.5" />
|
||||
) : (
|
||||
<FolderTree className="size-3.5" />
|
||||
) : (
|
||||
<Clock3 className="size-3.5" />
|
||||
)}
|
||||
</Button>
|
||||
);
|
||||
|
||||
@@ -291,6 +291,40 @@ describe("ChatInputBar", () => {
|
||||
expect(onSend).toHaveBeenCalledWith("What is this?");
|
||||
});
|
||||
|
||||
it("does not send when Enter commits an IME composition", async () => {
|
||||
const onSend = vi.fn();
|
||||
await renderVoiceComposer({ onSend, prompt: "你好" });
|
||||
const textarea = container.querySelector("textarea");
|
||||
await act(async () => {
|
||||
textarea?.dispatchEvent(
|
||||
new KeyboardEvent("keydown", {
|
||||
key: "Enter",
|
||||
isComposing: true,
|
||||
bubbles: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
// WebKit fires the committing Enter after compositionend with
|
||||
// isComposing false but keyCode 229.
|
||||
await act(async () => {
|
||||
textarea?.dispatchEvent(
|
||||
new KeyboardEvent("keydown", {
|
||||
key: "Enter",
|
||||
keyCode: 229,
|
||||
bubbles: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
expect(onSend).not.toHaveBeenCalled();
|
||||
|
||||
await act(async () => {
|
||||
textarea?.dispatchEvent(
|
||||
new KeyboardEvent("keydown", { key: "Enter", bubbles: true }),
|
||||
);
|
||||
});
|
||||
expect(onSend).toHaveBeenCalledWith("你好");
|
||||
});
|
||||
|
||||
it("allows a parent session with a running child agent to be stopped", async () => {
|
||||
const onAbort = vi.fn();
|
||||
await renderVoiceComposer({
|
||||
@@ -1201,6 +1235,37 @@ describe("ChatInputBar", () => {
|
||||
);
|
||||
});
|
||||
|
||||
onSteerPromptInQueue.mockResolvedValueOnce(undefined);
|
||||
const input = container.querySelector("textarea");
|
||||
for (const modifiers of [
|
||||
{ shiftKey: true },
|
||||
{ isComposing: true },
|
||||
{ repeat: true },
|
||||
]) {
|
||||
await act(async () => {
|
||||
input?.dispatchEvent(
|
||||
new KeyboardEvent("keydown", {
|
||||
key: "Enter",
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
...modifiers,
|
||||
}),
|
||||
);
|
||||
});
|
||||
}
|
||||
expect(onSteerPromptInQueue).not.toHaveBeenCalled();
|
||||
await act(async () => {
|
||||
input?.dispatchEvent(
|
||||
new KeyboardEvent("keydown", {
|
||||
key: "Enter",
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
expect(onSteerPromptInQueue).toHaveBeenCalledExactlyOnceWith();
|
||||
onSteerPromptInQueue.mockClear();
|
||||
|
||||
const queueToggle = [
|
||||
...container.querySelectorAll<HTMLButtonElement>(
|
||||
"button[aria-controls][aria-expanded]",
|
||||
@@ -1557,8 +1622,12 @@ describe("ChatInputBar", () => {
|
||||
'[aria-label^="Model:"]',
|
||||
);
|
||||
expect(modelTrigger?.textContent).toContain("Claude Opus 5");
|
||||
expect(loadProviderModelsMock).toHaveBeenCalledTimes(1);
|
||||
|
||||
await act(async () => modelTrigger?.click());
|
||||
// Opening re-fetches so the tiers reflect the current feed.
|
||||
expect(loadProviderModelsMock).toHaveBeenCalledTimes(2);
|
||||
expect(loadProviderModelsMock).toHaveBeenLastCalledWith("cline");
|
||||
const panel = document.querySelector('[role="dialog"]');
|
||||
expect(panel?.textContent).toContain("Recommended");
|
||||
expect(panel?.textContent).toContain("Free");
|
||||
@@ -1817,6 +1886,34 @@ describe("ChatInputBar", () => {
|
||||
).toEqual(selection);
|
||||
});
|
||||
|
||||
it("keeps the live model name while the picker-open refresh is in flight", async () => {
|
||||
mockBundledCatalog();
|
||||
loadProviderModelsMock.mockResolvedValue([flash, kimi]);
|
||||
await renderComposer({ model: kimi.id, provider: "cline-pass" });
|
||||
const modelTrigger = container.querySelector<HTMLButtonElement>(
|
||||
'[aria-label^="Model:"]',
|
||||
);
|
||||
await vi.waitFor(() => {
|
||||
expect(modelTrigger?.textContent).toContain(kimi.name);
|
||||
});
|
||||
loadProviderModelCatalogMock.mockClear();
|
||||
let resolveModels!: (models: ProviderModel[]) => void;
|
||||
loadProviderModelsMock.mockReturnValue(
|
||||
new Promise<ProviderModel[]>((resolve) => {
|
||||
resolveModels = resolve;
|
||||
}),
|
||||
);
|
||||
|
||||
await act(async () => modelTrigger?.click());
|
||||
// Only the live list is re-fetched; re-applying the bundled catalog
|
||||
// (which lacks kimi) would flash the raw id in the trigger.
|
||||
expect(modelTrigger?.textContent).toContain(kimi.name);
|
||||
expect(loadProviderModelsMock).toHaveBeenLastCalledWith("cline-pass");
|
||||
expect(loadProviderModelCatalogMock).not.toHaveBeenCalled();
|
||||
await act(async () => resolveModels([flash, kimi]));
|
||||
expect(modelTrigger?.textContent).toContain(kimi.name);
|
||||
});
|
||||
|
||||
it.each([
|
||||
"catalog refresh",
|
||||
"new chat",
|
||||
|
||||
@@ -314,7 +314,7 @@ type ChatInputBarProps = {
|
||||
attachments: Array<{ id: string; name: string; isImage: boolean }>;
|
||||
onAttachFiles: (files: File[]) => void;
|
||||
onRemoveAttachment: (id: string) => void;
|
||||
onSteerPromptInQueue: (promptId: string) => Promise<void> | void;
|
||||
onSteerPromptInQueue: (promptId?: string) => Promise<void> | void;
|
||||
onEditPromptInQueue: (
|
||||
promptId: string,
|
||||
prompt: string,
|
||||
@@ -497,6 +497,23 @@ function ChatInputBarImpl({
|
||||
? attachments.filter((attachment) => attachment.isImage).length
|
||||
: 0;
|
||||
const canSend = hasDraft && !speechInputActive;
|
||||
const steeringPromptRef = useRef(false);
|
||||
const steerFirstQueuedPrompt = async () => {
|
||||
const firstPrompt = promptsInQueue[0];
|
||||
if (!firstPrompt || firstPrompt.steer || steeringPromptRef.current) return;
|
||||
steeringPromptRef.current = true;
|
||||
try {
|
||||
await onSteerPromptInQueue();
|
||||
} catch (error) {
|
||||
toast({
|
||||
variant: "destructive",
|
||||
title: "Could not steer queued message",
|
||||
description: error instanceof Error ? error.message : String(error),
|
||||
});
|
||||
} finally {
|
||||
steeringPromptRef.current = false;
|
||||
}
|
||||
};
|
||||
const handleSend = useCallback(() => {
|
||||
if (speechInputActive) return;
|
||||
if (unsupportedDraftImageCount > 0) {
|
||||
@@ -1093,7 +1110,11 @@ function ChatInputBarImpl({
|
||||
<div
|
||||
className={cn(
|
||||
"px-4 py-3",
|
||||
variant === "welcome" ? "pb-2 pt-4" : "py-4",
|
||||
variant === "welcome"
|
||||
? "pb-2 pt-4"
|
||||
: promptsInQueue.length > 0
|
||||
? "pb-4 pt-0"
|
||||
: "py-4",
|
||||
)}
|
||||
>
|
||||
<AgentPromptQueue
|
||||
@@ -1263,6 +1284,12 @@ function ChatInputBarImpl({
|
||||
}
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
// While an IME (e.g. Chinese/Japanese) is composing, Enter
|
||||
// commits the composition and arrows move between candidates,
|
||||
// so leave those keys to the IME. WebKit can fire the committing
|
||||
// Enter after compositionend with isComposing already false but
|
||||
// the legacy keyCode 229, hence the second check.
|
||||
if (e.nativeEvent.isComposing || e.keyCode === 229) return;
|
||||
// Slash command menu takes priority when open.
|
||||
if (slashOpen && filteredSlashCommands.length > 0) {
|
||||
if (e.key === "ArrowDown") {
|
||||
@@ -1331,6 +1358,15 @@ function ChatInputBarImpl({
|
||||
e.preventDefault();
|
||||
if (canSend) {
|
||||
handleSend();
|
||||
} else if (
|
||||
!hasDraft &&
|
||||
!speechInputActive &&
|
||||
!e.ctrlKey &&
|
||||
!e.metaKey &&
|
||||
!e.altKey &&
|
||||
!e.repeat
|
||||
) {
|
||||
void steerFirstQueuedPrompt();
|
||||
}
|
||||
}
|
||||
}}
|
||||
@@ -1345,7 +1381,9 @@ function ChatInputBarImpl({
|
||||
: variant === "welcome"
|
||||
? "Ask to make changes, @mention files, reference #PRs, or run /commands."
|
||||
: isBusy
|
||||
? "Agent is working... submit to queue another message"
|
||||
? promptsInQueue.length > 0
|
||||
? "Agent is working... submit to queue another message, or Enter to send the first message from the queue"
|
||||
: "Agent is working... submit to queue another message"
|
||||
: "Enter your question or type / for commands or @ for context"
|
||||
}
|
||||
readOnly={speechInputActive}
|
||||
@@ -1642,6 +1680,43 @@ const ModelSelector = memo(function ModelSelector({
|
||||
readModelSelectionStorageFromWindow(),
|
||||
);
|
||||
const [mobileOpen, setMobileOpen] = useState(false);
|
||||
const applyProviderModels = useCallback(
|
||||
(providerId: string, models: ProviderModel[]) => {
|
||||
setProviderModels((current) => ({
|
||||
...current,
|
||||
[providerId]: models.map((entry) => entry.id),
|
||||
}));
|
||||
setProviderReasoningModels((current) => ({
|
||||
...current,
|
||||
[providerId]: models
|
||||
.filter((entry) => entry.supportsReasoning)
|
||||
.map((entry) => entry.id),
|
||||
}));
|
||||
setModelDetails((current) => ({
|
||||
...current,
|
||||
[providerId]: models,
|
||||
}));
|
||||
setEnabledProviderIds((current) =>
|
||||
current.includes(providerId) ? current : [...current, providerId],
|
||||
);
|
||||
},
|
||||
[],
|
||||
);
|
||||
// Re-fetch only the live list on picker open so the Recommended/Free tiers
|
||||
// stay current. Re-running the full load would first re-apply the bundled
|
||||
// catalog and briefly flash a stale name in the trigger.
|
||||
const refreshActiveProviderModels = useCallback(() => {
|
||||
if (!normalizedProvider) return;
|
||||
loadProviderModels(normalizedProvider)
|
||||
.then((models) => {
|
||||
if (models.length === 0) return;
|
||||
applyProviderModels(normalizedProvider, models);
|
||||
setReasoningCapabilitySource("catalog");
|
||||
})
|
||||
.catch(() => {
|
||||
// Keep the current list when the refresh fails.
|
||||
});
|
||||
}, [applyProviderModels, normalizedProvider]);
|
||||
const visibleProviderModels = useMemo(() => {
|
||||
const next: Record<string, string[]> = {};
|
||||
for (const providerId of enabledProviderIds) {
|
||||
@@ -1830,28 +1905,8 @@ const ModelSelector = memo(function ModelSelector({
|
||||
if (cancelled || models.length === 0) {
|
||||
return;
|
||||
}
|
||||
const modelIds = models.map((entry) => entry.id);
|
||||
const reasoningModelIds = models
|
||||
.filter((entry) => entry.supportsReasoning)
|
||||
.map((entry) => entry.id);
|
||||
setProviderModels((current) => ({
|
||||
...current,
|
||||
[normalizedProvider]: modelIds,
|
||||
}));
|
||||
setProviderReasoningModels((current) => ({
|
||||
...current,
|
||||
[normalizedProvider]: reasoningModelIds,
|
||||
}));
|
||||
setModelDetails((current) => ({
|
||||
...current,
|
||||
[normalizedProvider]: models,
|
||||
}));
|
||||
applyProviderModels(normalizedProvider, models);
|
||||
setReasoningCapabilitySource("catalog");
|
||||
setEnabledProviderIds((current) =>
|
||||
current.includes(normalizedProvider)
|
||||
? current
|
||||
: [...current, normalizedProvider],
|
||||
);
|
||||
} catch {
|
||||
// Keep the catalog values when provider-specific loading fails.
|
||||
}
|
||||
@@ -1861,30 +1916,13 @@ const ModelSelector = memo(function ModelSelector({
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [normalizedProvider]);
|
||||
}, [applyProviderModels, normalizedProvider]);
|
||||
|
||||
useEffect(() => {
|
||||
return subscribeToProviderModels((providerId, models) => {
|
||||
const normalizedId = normalizeProviderId(providerId);
|
||||
setProviderModels((current) => ({
|
||||
...current,
|
||||
[normalizedId]: models.map((entry) => entry.id),
|
||||
}));
|
||||
setProviderReasoningModels((current) => ({
|
||||
...current,
|
||||
[normalizedId]: models
|
||||
.filter((entry) => entry.supportsReasoning)
|
||||
.map((entry) => entry.id),
|
||||
}));
|
||||
setModelDetails((current) => ({
|
||||
...current,
|
||||
[normalizedId]: models,
|
||||
}));
|
||||
setEnabledProviderIds((current) =>
|
||||
current.includes(normalizedId) ? current : [...current, normalizedId],
|
||||
);
|
||||
applyProviderModels(normalizeProviderId(providerId), models);
|
||||
});
|
||||
}, []);
|
||||
}, [applyProviderModels]);
|
||||
|
||||
// The remembered selection (what new sessions default to) is only written
|
||||
// from the explicit picker handlers below. Mirroring every provider/model
|
||||
@@ -2064,6 +2102,7 @@ const ModelSelector = memo(function ModelSelector({
|
||||
className={triggerClassName}
|
||||
disabled={isBusy || visibleModelPicker.options.length === 0}
|
||||
emptyText="No models found."
|
||||
onOpen={refreshActiveProviderModels}
|
||||
onValueChange={(value) => {
|
||||
handleModelSelect(value);
|
||||
if (closeMobileMenu) setMobileOpen(false);
|
||||
|
||||
@@ -15,10 +15,13 @@ import {
|
||||
sortProvidersForApiKeySetup,
|
||||
} from "./onboarding-view";
|
||||
|
||||
const { invoke } = vi.hoisted(() => ({ invoke: vi.fn() }));
|
||||
const { invoke, openExternalUrl } = vi.hoisted(() => ({
|
||||
invoke: vi.fn(),
|
||||
openExternalUrl: vi.fn(),
|
||||
}));
|
||||
vi.mock("@/lib/desktop-client", () => ({
|
||||
desktopClient: { invoke, subscribe: vi.fn(() => () => {}) },
|
||||
openExternalUrl: vi.fn(),
|
||||
openExternalUrl,
|
||||
}));
|
||||
|
||||
const GITHUB_STEP_ENABLED_FLAGS = {
|
||||
@@ -220,6 +223,15 @@ describe("OnboardingView", () => {
|
||||
const clineOption = container.querySelector(
|
||||
'[data-onboarding-option="cline"]',
|
||||
);
|
||||
expect(
|
||||
Array.from(clineOption?.querySelectorAll("li") ?? []).map((item) =>
|
||||
item.textContent?.trim(),
|
||||
),
|
||||
).toEqual([
|
||||
"Regular free model promotions",
|
||||
"Subscribe to ClinePass for generous usage across the best open weights models like DeepSeek, Kimi, and GLM",
|
||||
"No API key needed",
|
||||
]);
|
||||
const apiKeyOption = container.querySelector(
|
||||
'[data-onboarding-option="api-key"]',
|
||||
);
|
||||
@@ -389,6 +401,16 @@ describe("OnboardingView", () => {
|
||||
if (command === "get_feature_flags") {
|
||||
return GITHUB_STEP_ENABLED_FLAGS;
|
||||
}
|
||||
if (command === "list_cline_recommended_models") {
|
||||
return {
|
||||
recommended: [],
|
||||
free: [
|
||||
{ id: "deepseek/deepseek-v4-flash", name: "deepseek-v4-flash" },
|
||||
{ id: "cline-free/solar-pro4", name: "Solar Pro 4" },
|
||||
],
|
||||
clinePass: [],
|
||||
};
|
||||
}
|
||||
return {};
|
||||
});
|
||||
await render();
|
||||
@@ -408,6 +430,19 @@ describe("OnboardingView", () => {
|
||||
// The redesigned completion step places transparent content over a static,
|
||||
// wide version of the hero grid.
|
||||
expect(container.textContent).toContain("You're all set");
|
||||
// A Cline sign-in ends on the current free models plus the ClinePass upsell.
|
||||
const clineModels = container.querySelector(
|
||||
"[data-onboarding-cline-models]",
|
||||
);
|
||||
expect(clineModels?.textContent).toContain("Free models");
|
||||
expect(clineModels?.textContent).toContain("deepseek-v4-flash");
|
||||
expect(clineModels?.textContent).toContain("Solar Pro 4");
|
||||
await act(async () => {
|
||||
buttonByText("Get ClinePass").click();
|
||||
});
|
||||
expect(openExternalUrl).toHaveBeenCalledWith(
|
||||
"https://app.cline.bot/onboarding/individual-plan",
|
||||
);
|
||||
const doneGrid = container.querySelector<HTMLElement>(
|
||||
'[data-welcome-hero-variant="grid-only"]',
|
||||
);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { AgentWelcomeHero, Button, IconButton } from "@cline/ui";
|
||||
import {
|
||||
ArrowLeft,
|
||||
Check,
|
||||
CheckCircle2,
|
||||
ChevronDown,
|
||||
ExternalLink,
|
||||
@@ -51,6 +52,18 @@ import {
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const CREATE_ACCOUNT_URL = "https://app.cline.bot";
|
||||
const CLINE_PASS_SUBSCRIBE_URL =
|
||||
"https://app.cline.bot/onboarding/individual-plan";
|
||||
|
||||
const CLINE_SIGN_IN_BENEFITS = [
|
||||
"Regular free model promotions",
|
||||
"Subscribe to ClinePass for generous usage across the best open weights models like DeepSeek, Kimi, and GLM",
|
||||
"No API key needed",
|
||||
];
|
||||
|
||||
type ClineRecommendedModelsResponse = {
|
||||
free?: { id: string; name?: string; description?: string }[];
|
||||
};
|
||||
|
||||
export const GITHUB_ONBOARDING_FEATURE_FLAG = "code-onboarding-github";
|
||||
|
||||
@@ -229,7 +242,7 @@ function SetupOptionHeader({
|
||||
title,
|
||||
}: {
|
||||
accessory?: React.ReactNode;
|
||||
description: string;
|
||||
description: React.ReactNode;
|
||||
icon: React.ReactNode;
|
||||
title: string;
|
||||
}) {
|
||||
@@ -240,7 +253,7 @@ function SetupOptionHeader({
|
||||
</span>
|
||||
<div className="min-w-0 mt-1 max-[720px]:col-span-3 max-[720px]:col-start-1 max-[720px]:row-start-2 max-[720px]:mt-0">
|
||||
<h4 className="text-lg font-semibold text-foreground">{title}</h4>
|
||||
<p className="mt-2 text-sm text-muted-foreground">{description}</p>
|
||||
<div className="mt-2 text-sm text-muted-foreground">{description}</div>
|
||||
</div>
|
||||
{accessory ? (
|
||||
<div className="mt-1 max-[720px]:col-start-3 max-[720px]:row-start-1 max-[720px]:mt-0">
|
||||
@@ -560,7 +573,19 @@ function ConnectStep({
|
||||
Recommended
|
||||
</Badge>
|
||||
}
|
||||
description="Latest models with regular free promos. No API keys needed."
|
||||
description={
|
||||
<ul className="flex flex-col gap-1">
|
||||
{CLINE_SIGN_IN_BENEFITS.map((benefit) => (
|
||||
<li className="flex gap-2" key={benefit}>
|
||||
<Check
|
||||
aria-hidden="true"
|
||||
className="mt-0.5 size-3.5 shrink-0 text-primary"
|
||||
/>
|
||||
<span>{benefit}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
}
|
||||
icon={<ClineLogo className="size-5" />}
|
||||
title="Sign in with Cline"
|
||||
/>
|
||||
@@ -992,6 +1017,80 @@ function ImportHistoryStep({
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shown after a Cline sign-in: the free models available right now (from the
|
||||
* same feed as the composer's Free tier, bundled fallback offline) and the
|
||||
* ClinePass upsell. The feed is display-only here; the user picks a model in
|
||||
* the composer.
|
||||
*/
|
||||
function ClineModelsSummary() {
|
||||
const [freeModels, setFreeModels] = useState<
|
||||
NonNullable<ClineRecommendedModelsResponse["free"]>
|
||||
>([]);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
desktopClient
|
||||
.invoke<ClineRecommendedModelsResponse>("list_cline_recommended_models")
|
||||
.then((response) => {
|
||||
if (!cancelled) {
|
||||
setFreeModels(response?.free ?? []);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// The upsell still renders without the model list.
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div
|
||||
className="mt-6 w-full rounded-xl border border-border bg-background p-5 text-left"
|
||||
data-onboarding-cline-models
|
||||
>
|
||||
{freeModels.length > 0 ? (
|
||||
<>
|
||||
<h2 className="text-sm font-semibold text-foreground">Free models</h2>
|
||||
<p className="mt-1 text-xs text-muted-foreground">
|
||||
Try with limited usage at no cost.
|
||||
</p>
|
||||
<ul className="mt-3 flex flex-wrap gap-1.5">
|
||||
{freeModels.map((model) => (
|
||||
<li key={model.id}>
|
||||
<Badge variant="outline">
|
||||
{model.name?.trim() || model.id}
|
||||
</Badge>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<div className="my-4 border-t border-border" />
|
||||
</>
|
||||
) : null}
|
||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||
<div className="min-w-0 flex-1">
|
||||
<h2 className="text-sm font-semibold text-foreground">ClinePass</h2>
|
||||
<p className="mt-1 text-xs text-muted-foreground">
|
||||
Generous usage across the best open weights models like DeepSeek,
|
||||
Kimi, and GLM.
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
onClick={() => void openExternalUrl(CLINE_PASS_SUBSCRIBE_URL)}
|
||||
size="sm"
|
||||
tone="neutral"
|
||||
type="button"
|
||||
variant="surface"
|
||||
>
|
||||
Get ClinePass
|
||||
<ExternalLink className="size-3.5" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function DoneStep({
|
||||
connection,
|
||||
onFinish,
|
||||
@@ -1011,6 +1110,7 @@ function DoneStep({
|
||||
? `${connection.providerName} is connected.`
|
||||
: "Your Cline account is connected."}
|
||||
</p>
|
||||
{connection?.kind === "cline" ? <ClineModelsSummary /> : null}
|
||||
<Button
|
||||
className="mt-8 w-full max-w-64"
|
||||
onClick={onFinish}
|
||||
|
||||