copilotkit 4.29.0 → 4.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +311 -33
- package/cli-build-info.json +7 -7
- package/exporters/claude-sdk/README.md +93 -0
- package/exporters/claude-sdk/export_session_store.py +39 -0
- package/exporters/claude-sdk/store-export.ts +61 -0
- package/index.js +212561 -109267
- package/onboarding/index.json +51 -5
- package/onboarding/prompts/authenticate/start.md +51 -49
- package/onboarding/prompts/conversion/plan.md +3 -3
- package/onboarding/prompts/credentials/finalize-plan.md +15 -15
- package/onboarding/prompts/credentials/plan.md +25 -29
- package/onboarding/prompts/credentials/settle-credentials.md +13 -8
- package/onboarding/prompts/credentials/write-plan.md +18 -16
- package/onboarding/prompts/deployment/choose-local.md +13 -12
- package/onboarding/prompts/deployment/local-evaluation.md +11 -11
- package/onboarding/prompts/fallback/best-effort.md +10 -11
- package/onboarding/prompts/feature/a2ui/implement.md +7 -5
- package/onboarding/prompts/feature/a2ui/plan.md +7 -3
- package/onboarding/prompts/feature/a2ui/proof.md +8 -6
- package/onboarding/prompts/feature/a2ui/start.md +10 -10
- package/onboarding/prompts/feature/channels/implement.md +10 -8
- package/onboarding/prompts/feature/channels/plan.md +9 -5
- package/onboarding/prompts/feature/channels/proof.md +8 -6
- package/onboarding/prompts/feature/channels/start.md +17 -13
- package/onboarding/prompts/feature/chat-suggestions/implement.md +7 -5
- package/onboarding/prompts/feature/chat-suggestions/plan.md +7 -3
- package/onboarding/prompts/feature/chat-suggestions/proof.md +8 -6
- package/onboarding/prompts/feature/chat-suggestions/start.md +10 -10
- package/onboarding/prompts/feature/complete.md +3 -3
- package/onboarding/prompts/feature/learning/implement.md +15 -13
- package/onboarding/prompts/feature/learning/plan.md +8 -4
- package/onboarding/prompts/feature/learning/proof.md +16 -14
- package/onboarding/prompts/feature/learning/start.md +10 -10
- package/onboarding/prompts/feature/open-generative-ui/implement.md +7 -5
- package/onboarding/prompts/feature/open-generative-ui/plan.md +7 -3
- package/onboarding/prompts/feature/open-generative-ui/proof.md +8 -6
- package/onboarding/prompts/feature/open-generative-ui/start.md +10 -10
- package/onboarding/prompts/feature/realtime-sync/implement.md +8 -6
- package/onboarding/prompts/feature/realtime-sync/plan.md +7 -3
- package/onboarding/prompts/feature/realtime-sync/proof.md +8 -6
- package/onboarding/prompts/feature/realtime-sync/start.md +9 -9
- package/onboarding/prompts/feature/rich-threads/implement.md +9 -7
- package/onboarding/prompts/feature/rich-threads/plan.md +7 -3
- package/onboarding/prompts/feature/rich-threads/proof.md +8 -6
- package/onboarding/prompts/feature/rich-threads/start.md +9 -9
- package/onboarding/prompts/feature/stop.md +4 -4
- package/onboarding/prompts/feature/voice/implement.md +7 -5
- package/onboarding/prompts/feature/voice/plan.md +8 -4
- package/onboarding/prompts/feature/voice/proof.md +8 -6
- package/onboarding/prompts/feature/voice/start.md +10 -10
- package/onboarding/prompts/framework/ag2.md +4 -11
- package/onboarding/prompts/framework/agno.md +4 -11
- package/onboarding/prompts/framework/built-in.md +3 -3
- package/onboarding/prompts/framework/claude-sdk-python.md +3 -3
- package/onboarding/prompts/framework/claude-sdk-typescript.md +3 -3
- package/onboarding/prompts/framework/crewai-flows.md +6 -12
- package/onboarding/prompts/framework/custom-ag-ui.md +5 -11
- package/onboarding/prompts/framework/deep-agents.md +5 -11
- package/onboarding/prompts/framework/google-adk.md +4 -8
- package/onboarding/prompts/framework/langgraph-fastapi.md +4 -10
- package/onboarding/prompts/framework/langgraph-python.md +4 -10
- package/onboarding/prompts/framework/langgraph-typescript.md +5 -11
- package/onboarding/prompts/framework/llamaindex.md +4 -10
- package/onboarding/prompts/framework/mastra.md +4 -10
- package/onboarding/prompts/framework/ms-agent-dotnet.md +6 -13
- package/onboarding/prompts/framework/ms-agent-harness-dotnet.md +7 -13
- package/onboarding/prompts/framework/ms-agent-python.md +5 -11
- package/onboarding/prompts/framework/pydantic-ai.md +4 -10
- package/onboarding/prompts/framework/strands-python.md +4 -10
- package/onboarding/prompts/framework/strands-typescript.md +4 -10
- package/onboarding/prompts/frontend/angular.md +4 -4
- package/onboarding/prompts/frontend/nextjs.md +4 -4
- package/onboarding/prompts/frontend/plan.md +10 -10
- package/onboarding/prompts/frontend/react-native.md +3 -3
- package/onboarding/prompts/frontend/react-spa.md +3 -3
- package/onboarding/prompts/frontend/vue.md +3 -3
- package/onboarding/prompts/implementation/build-and-validate.md +33 -16
- package/onboarding/prompts/proof/complete.md +22 -19
- package/onboarding/prompts/proof/oss-baseline.md +6 -6
- package/onboarding/prompts/proof/round-trip.md +34 -14
- package/onboarding/prompts/research/gather.md +15 -15
- package/onboarding/prompts/research/merge.md +6 -5
- package/onboarding/prompts/research/preflight.md +2 -2
- package/onboarding/prompts/research/route.md +4 -4
- package/onboarding/prompts/setup/questions.md +10 -8
- package/onboarding/prompts/starter/clone.md +77 -75
- package/onboarding/prompts/starter/setup.md +111 -0
- package/onboarding/prompts/stopped/declined.md +44 -0
- package/onboarding/prompts/stopped/run-failed.md +6 -6
- package/onboarding/prompts/subagent/create-plan.md +5 -5
- package/onboarding/prompts/subagent/implement-and-validate.md +4 -4
- package/onboarding/prompts/subagent/inspect-repository.md +1 -1
- package/onboarding/prompts/subagent/prove-oss-baseline.md +2 -2
- package/onboarding/prompts/subagent/prove-round-trip.md +21 -8
- package/onboarding/prompts/unsupported/no-validated-path.md +6 -6
- package/package.json +4 -1
- package/release/release-tool.js +383 -112
package/README.md
CHANGED
|
@@ -120,6 +120,18 @@ carried as `suggested_name`:
|
|
|
120
120
|
}
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
+
Any other failure carries what is known about its cause: `code` (such as
|
|
124
|
+
`CLI_REQUEST_TIMEOUT` or `ENOENT`), `http_status` for a failed request (`0`
|
|
125
|
+
when no answer arrived), and `syscall` for a failed file operation (such as
|
|
126
|
+
`open`). `failed_step` says whether listing or creating the project failed. A
|
|
127
|
+
taken `--create` name also carries `taken_slug`, the slug of the project that
|
|
128
|
+
has the name.
|
|
129
|
+
|
|
130
|
+
`onboard credentials` runs the selection once more after a timeout, a network
|
|
131
|
+
failure, a server error, or a missing file, then stops and names the cause.
|
|
132
|
+
When a create request failed and the second try finds the name taken, the
|
|
133
|
+
first try made that project, so the step selects it by `taken_slug`.
|
|
134
|
+
|
|
123
135
|
The interactive picker offers the same name and never applies it silently:
|
|
124
136
|
press Enter again to take it, or type a different one.
|
|
125
137
|
|
|
@@ -263,9 +275,17 @@ URL for manual sign-in. Either way, it keeps reading the same process until its
|
|
|
263
275
|
terminal event. A failed sign-in prints one final failure object and exits
|
|
264
276
|
nonzero.
|
|
265
277
|
|
|
266
|
-
The bundled onboarding prompt
|
|
267
|
-
|
|
268
|
-
|
|
278
|
+
The bundled onboarding prompt explains that a free CopilotKit account is required
|
|
279
|
+
to continue setup. Sign-in does not start a paid CopilotKit Intelligence
|
|
280
|
+
subscription or commit you to cloud hosting.
|
|
281
|
+
|
|
282
|
+
The onboarding prompt runs `login --json --onboarding`. In that mode, the agent
|
|
283
|
+
keeps reading the process after it shows the sign-in message. If nobody approves
|
|
284
|
+
the code within 90 seconds, the CLI writes a `pause` record. Its `message` tells
|
|
285
|
+
the developer to reply "done" after they sign in, and its `action` tells the
|
|
286
|
+
agent to end its turn and read the same process again on the reply. The
|
|
287
|
+
`completed` record carries an `action` that names the next step. Plain
|
|
288
|
+
`login --json` writes neither.
|
|
269
289
|
|
|
270
290
|
### Signing in when the browser is on another machine
|
|
271
291
|
|
|
@@ -396,8 +416,8 @@ prompt has no Channel sentence. When the project has no frontend, the root graph
|
|
|
396
416
|
asks which frontend they want and offers Slack and Microsoft Teams there. If the
|
|
397
417
|
copied prompt came from a Slack or Teams docs page, that page is the named
|
|
398
418
|
frontend.
|
|
399
|
-
Its first prompt records the coding agent with `onboard
|
|
400
|
-
the entry command omitted `--coding-agent`. The agent also passes `--model` with
|
|
419
|
+
Its first prompt records the coding agent with `onboard begin`, which runs
|
|
420
|
+
`onboard identify`, including when the entry command omitted `--coding-agent`. The agent also passes `--model` with
|
|
401
421
|
the exact model id its instructions name, and leaves it out when they name none.
|
|
402
422
|
It always passes `--model-family`, picked from a fixed list such as `claude-opus`
|
|
403
423
|
or `gpt-5`. The event reports `coding_agent` and `model_family` normalized to
|
|
@@ -520,7 +540,20 @@ A later `onboard start` that re-enters the same run keeps its project.
|
|
|
520
540
|
### Coming back after a run that broke
|
|
521
541
|
|
|
522
542
|
A run whose stack this release serves, and which broke anyway, reads
|
|
523
|
-
`stopped/run-failed`.
|
|
543
|
+
`stopped/run-failed`. The read requires the reason the run broke:
|
|
544
|
+
|
|
545
|
+
```bash
|
|
546
|
+
npx --yes copilotkit@latest onboard read stopped/run-failed --reason build --message "next build failed on a missing export"
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
`--reason` is one of `build`, `typecheck`, `dependency-install`, `model-call`,
|
|
550
|
+
`docs-gap`, or `other`. `--message` is optional: one line,
|
|
551
|
+
guarded like a friction report. A read with no reason, or an unknown one, serves
|
|
552
|
+
nothing and names the flag to add. The failing command is usually the agent's own,
|
|
553
|
+
such as `next build` or `tsc`, so the CLI cannot see it, and the reason is how
|
|
554
|
+
`cli.onboarding.terminal_reached` names it (`stop_reason`, `stop_reason_text`).
|
|
555
|
+
|
|
556
|
+
That node used to be the end of the run. The graph refuses to
|
|
524
557
|
widen its own scope, so a fix outside the approved plan had to happen outside the
|
|
525
558
|
tracked run, and nothing after that point was recorded.
|
|
526
559
|
|
|
@@ -549,6 +582,21 @@ A feature run that broke reads `feature/stop` instead, and comes back the same
|
|
|
549
582
|
way. That ending also covers a failed validation, a proof that could not be
|
|
550
583
|
driven, and a missing Channel prerequisite, which one approved fix can answer.
|
|
551
584
|
|
|
585
|
+
### When the developer says no
|
|
586
|
+
|
|
587
|
+
A developer who declines, such as **no** or **not now** at the setup message, is not a
|
|
588
|
+
run that broke. The run reads `stopped/declined`, which thanks them, relays what the
|
|
589
|
+
run changed, and offers `onboard restore`:
|
|
590
|
+
|
|
591
|
+
```bash
|
|
592
|
+
npx --yes copilotkit@latest onboard read stopped/declined --message "<the developer's reason>"
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
`--message` is optional and guarded like a friction report. The read takes no
|
|
596
|
+
`--reason`, and `onboard read stopped/run-failed --reason developer-declined` is
|
|
597
|
+
refused with the declined read to run instead, so a decline has one path. It reaches
|
|
598
|
+
`cli.onboarding.terminal_reached` as `terminal: declined`.
|
|
599
|
+
|
|
552
600
|
Only `stopped/run-failed` and `feature/stop` resume.
|
|
553
601
|
`unsupported/no-validated-path` and `fallback/best-effort` describe a stack this
|
|
554
602
|
release does not serve, and `feature/blocked-by-plan` is a refusal by the
|
|
@@ -617,7 +665,27 @@ copilotkit init -n my-agent -f langgraph-py \
|
|
|
617
665
|
`init` prints the variable name and never the value. A real value already in
|
|
618
666
|
the app is kept. A missing or unreadable file stops `init` before it clones
|
|
619
667
|
anything. The .NET starter keeps its key in `dotnet user-secrets`, so this flag
|
|
620
|
-
does not fill it.
|
|
668
|
+
does not fill it. With `--model-vendor`, the key copied is that vendor's.
|
|
669
|
+
Without it, and with `-f`, the key in the file picks the vendor: a file with
|
|
670
|
+
the starter's own key keeps the starter's model, and a file with one other
|
|
671
|
+
vendor's key switches the starter to that vendor. A file with keys for
|
|
672
|
+
several other vendors, or only for a vendor the starter does not run, stops
|
|
673
|
+
`init` before it clones anything, and names the flag to pass.
|
|
674
|
+
- `--model-vendor <vendor>` sets the vendor of the agent's model: `openai`,
|
|
675
|
+
`anthropic`, `google`, or `openai-compatible`. `init` writes
|
|
676
|
+
`COPILOTKIT_AGENT_MODEL=<vendor>:<model>` into the env file the agent reads
|
|
677
|
+
(`openai:<model>` for an OpenAI-compatible provider),
|
|
678
|
+
and asks for that vendor's key instead of the starter's default key. A vendor
|
|
679
|
+
that the starter cannot run is refused before anything is cloned. The
|
|
680
|
+
AgentCore, .NET and AG2 starters take no `--model-vendor`. When you pick the
|
|
681
|
+
framework at a terminal, without `--no-key-prompt`, `init` asks for the vendor
|
|
682
|
+
and model after it.
|
|
683
|
+
- `--model-id <id>` names the vendor's model. Without it, `init` uses a model the
|
|
684
|
+
vendor serves today: `gpt-5-mini`, `claude-sonnet-5` or `gemini-3.8-flash`.
|
|
685
|
+
- `--base-url <url>` is the API base URL of an OpenAI-compatible provider, written
|
|
686
|
+
as `OPENAI_BASE_URL`. It goes with `--model-vendor openai-compatible` only,
|
|
687
|
+
which also needs `--model-id`. A URL that holds a user, password, or key is
|
|
688
|
+
refused: the key goes in the key file.
|
|
621
689
|
|
|
622
690
|
A run with no terminal is refused only for what it has not answered, and every
|
|
623
691
|
missing flag is named at once. Sign-in is the one answer no flag supplies:
|
|
@@ -1028,7 +1096,8 @@ OPENAI_API_KEY=your-key-here
|
|
|
1028
1096
|
(Replace `your-key-here` with your real key — placeholder-shaped values are
|
|
1029
1097
|
rejected by the dev preflight described below.)
|
|
1030
1098
|
|
|
1031
|
-
The ADK
|
|
1099
|
+
The ADK and A2A templates use `GOOGLE_API_KEY`. The A2A template sets one model,
|
|
1100
|
+
`COPILOTKIT_AGENT_MODEL=google:gemini-3.8-flash`, for all three of its agents.
|
|
1032
1101
|
|
|
1033
1102
|
For threads-enabled scaffolds, `npm run dev` verifies the required key(s)
|
|
1034
1103
|
before starting anything: if a key is unset, empty, or still an obvious
|
|
@@ -1077,6 +1146,44 @@ for the app. A new onboarding run,
|
|
|
1077
1146
|
untrack `.env` again. The Channels setup commands still read and write `.env`
|
|
1078
1147
|
only.
|
|
1079
1148
|
|
|
1149
|
+
## Notification when an onboarding run ends
|
|
1150
|
+
|
|
1151
|
+
An onboarding run can take an hour, so you can leave while it works. When the run
|
|
1152
|
+
ends, the CLI shows one desktop notification on your computer:
|
|
1153
|
+
|
|
1154
|
+
- "CopilotKit setup finished" when `onboard complete` records the end. The text
|
|
1155
|
+
says that your app works, or that some checks are not done.
|
|
1156
|
+
- "CopilotKit setup stopped" when the run stops at `stopped/run-failed`,
|
|
1157
|
+
`feature/stop`, or `feature/blocked-by-plan`.
|
|
1158
|
+
|
|
1159
|
+
Open the window of your coding agent to read the report. A run shows one
|
|
1160
|
+
notification at its first end. After `onboard resume`, the run shows one more
|
|
1161
|
+
notification at its next end.
|
|
1162
|
+
|
|
1163
|
+
The CLI uses `osascript` on macOS, `notify-send` on Linux, and a PowerShell toast
|
|
1164
|
+
on Windows. In these cases, the CLI shows no notification:
|
|
1165
|
+
|
|
1166
|
+
- On CI, in a container, or in a sandbox.
|
|
1167
|
+
- Over SSH.
|
|
1168
|
+
- On Linux with no `DISPLAY` or `WAYLAND_DISPLAY`, or with no `notify-send`.
|
|
1169
|
+
|
|
1170
|
+
The CLI waits at most 3 seconds for the notification, or 6 seconds on Windows.
|
|
1171
|
+
When the notification cannot show, the CLI prints nothing and the step
|
|
1172
|
+
continues.
|
|
1173
|
+
|
|
1174
|
+
Set `COPILOTKIT_NO_NOTIFY=1` to turn the notification off.
|
|
1175
|
+
|
|
1176
|
+
`cli.onboarding.completed`, and `cli.onboarding.terminal_reached` for the three
|
|
1177
|
+
stop nodes above, carry `notification`: `shown`, `skipped`, or `failed`.
|
|
1178
|
+
|
|
1179
|
+
### Docs links in the closing report
|
|
1180
|
+
|
|
1181
|
+
The closing report links to the AG-UI Streams and Learning docs. Each link carries
|
|
1182
|
+
`utm_source=cli&utm_medium=onboarding&utm_campaign=closeout` and
|
|
1183
|
+
`utm_content=streams` or `utm_content=learning`. A click that opens the page shows
|
|
1184
|
+
as a docs `$pageview` with that URL, in the same PostHog project as the CLI events.
|
|
1185
|
+
A click from a reader who blocks analytics does not show.
|
|
1186
|
+
|
|
1080
1187
|
## Onboarding backups and restore
|
|
1081
1188
|
|
|
1082
1189
|
`copilotkit onboard start` backs up the project before the run changes anything.
|
|
@@ -1591,6 +1698,16 @@ the coding agent, decides three things about it:
|
|
|
1591
1698
|
`providerError`: `auth`, `quota`, `model-not-found`, `rate-limit` or `other`.
|
|
1592
1699
|
It is read from that code, never from a status or a message.
|
|
1593
1700
|
`verify --round-trip --json` reports both on `roundTrip` too.
|
|
1701
|
+
- When the check started the servers, a `run-error` that says the runtime could
|
|
1702
|
+
not reach its agent (`fetch failed`, `ECONNREFUSED`) is tried again every
|
|
1703
|
+
10 seconds, for up to 2 minutes. A Python agent installs its packages before
|
|
1704
|
+
it listens, so a first run on a cold cache sends its chat message too early.
|
|
1705
|
+
The outcome is recorded once, after the last try.
|
|
1706
|
+
- The first time the app answers in a run that read `proof/round-trip`, and
|
|
1707
|
+
the whole proof check passed, the command also prints `earlyReport`
|
|
1708
|
+
(`Tell the developer:` without `--json`): a short report that the app works,
|
|
1709
|
+
with the frontend URL. The main agent shows it to the developer before the
|
|
1710
|
+
slower checks run. The starter job's own proof check prints none.
|
|
1594
1711
|
- When the same check fails three proof checks in a row, the command prints
|
|
1595
1712
|
`Status: stopped`. A later `onboard proof-check` in the same attempt starts no
|
|
1596
1713
|
server and prints the same stop. Recording the attempt with `onboard proof`
|
|
@@ -1741,13 +1858,24 @@ the value came from: `env-file` or `environment`.
|
|
|
1741
1858
|
|
|
1742
1859
|
- `pass`: the vendor served a model call with the key.
|
|
1743
1860
|
- `fail`: the vendor refused the key or the app's model. The cause is
|
|
1744
|
-
`model_quota` (no credits), `model_auth` (a rejected key),
|
|
1745
|
-
`model_unavailable` (the vendor does not serve the app's model to this key)
|
|
1861
|
+
`model_quota` (no credits), `model_auth` (a rejected key),
|
|
1862
|
+
`model_unavailable` (the vendor does not serve the app's model to this key), or
|
|
1863
|
+
`model_rate_limited` (OpenAI rate-limited two calls in a row, see below).
|
|
1746
1864
|
- `missing`: neither the env file nor the environment holds a real value for
|
|
1747
1865
|
the key.
|
|
1748
|
-
- `unsupported` or `undetermined`: the check did not settle it. A rate
|
|
1749
|
-
vendor outage, or a probe model the key may not use proves nothing
|
|
1750
|
-
key, so none of them is a `fail`.
|
|
1866
|
+
- `unsupported` or `undetermined`: the check did not settle it. A single rate
|
|
1867
|
+
limit, a vendor outage, or a probe model the key may not use proves nothing
|
|
1868
|
+
about the key, so none of them is a `fail`.
|
|
1869
|
+
|
|
1870
|
+
When OpenAI answers the probe with a 429 that is not `insufficient_quota`, the
|
|
1871
|
+
command waits and asks once more. It waits as long as a `Retry-After` header in
|
|
1872
|
+
seconds says, up to 30 seconds, and 30 seconds when there is none. A 429 on the
|
|
1873
|
+
second call too is a `fail` with the cause `model_rate_limited`: one call with
|
|
1874
|
+
one output token cannot reach a normal limit, so the app's calls would be
|
|
1875
|
+
refused too. Any other second answer is read by the usual rules. `providerStatus`
|
|
1876
|
+
and `providerCode` in the JSON are the vendor's HTTP status and error code, and
|
|
1877
|
+
the onboarding event `cli.onboarding.credentials_checked` carries them as
|
|
1878
|
+
`model_key_provider_status` and `model_key_provider_code`.
|
|
1751
1879
|
|
|
1752
1880
|
The probe proves the key, not the app's model. When `COPILOTKIT_AGENT_MODEL` names the
|
|
1753
1881
|
app's model as `provider:model` or `provider/model`, for the same vendor as the key, the
|
|
@@ -1796,7 +1924,15 @@ reason `key-not-openai`. So a key in `.env.local` is checked against a base URL
|
|
|
1796
1924
|
a file outside the app is checked against the right endpoint. When the shell and the
|
|
1797
1925
|
services name different base URLs (the scheme and host compare without regard to case),
|
|
1798
1926
|
the command sends nothing and reports `undetermined` with the reason
|
|
1799
|
-
`endpoint-conflict`.
|
|
1927
|
+
`endpoint-conflict`. Its `endpoints` names each place that sets a base URL: the
|
|
1928
|
+
variable, the env file or the shell or the setup answers, and the `origin` (scheme,
|
|
1929
|
+
host and port, never the path). `pathDiffers` marks two places with one origin and
|
|
1930
|
+
different paths. In `onboard credentials`, this answer pauses the step on the
|
|
1931
|
+
developer, as a missing key does: the question lists each base URL and asks which one
|
|
1932
|
+
the app uses, so the run does not plan or build on a key it never checked. `next` says
|
|
1933
|
+
how to change each kind of place: edit an env file, record a setup answer again with
|
|
1934
|
+
`onboard setup-answers --base-url`, or have the developer unset a shell variable and
|
|
1935
|
+
restart the coding agent. Once one base URL remains, the normal check runs. The JSON names the vendor `openai-compatible` and the endpoint's
|
|
1800
1936
|
host as `endpointHost`. With `COPILOTKIT_AGENT_MODEL` set, the command sends a
|
|
1801
1937
|
one-token chat with that model to `{base}/chat/completions` instead, which gives a
|
|
1802
1938
|
real `pass` or `fail`. A key that the endpoint calls invalid is a `fail`, including
|
|
@@ -1885,6 +2021,11 @@ step reads it even after the coding agent lost its context:
|
|
|
1885
2021
|
- The env-file answer, when git tracks the env file the key goes into or does
|
|
1886
2022
|
not ignore it: `--env-line approved|alternative|declined`.
|
|
1887
2023
|
`credentials/finalize-plan` reads it, so the developer is not asked twice.
|
|
2024
|
+
- On any route, `--learning declined` when the developer leaves Learning out.
|
|
2025
|
+
`onboard credentials` then reads no Learning Container and records it as
|
|
2026
|
+
`skipped` with the reason `developer-declined`. Recorded after that step, it
|
|
2027
|
+
replaces the container the step found. `onboard proof-check` then asks for
|
|
2028
|
+
no container, and the closing report says Learning is off.
|
|
1888
2029
|
|
|
1889
2030
|
A later call replaces only the answers it names. The vendor flags replace the
|
|
1890
2031
|
recorded vendor answer as a whole. With no flag, it prints what the run recorded
|
|
@@ -1913,6 +2054,12 @@ It prints `status`, the `message` to show word for word, the `open` lines, and
|
|
|
1913
2054
|
**go** never answers: the developer names the file that holds it, or says
|
|
1914
2055
|
"later". The message also holds every line that needs the developer's own
|
|
1915
2056
|
answer, such as an env file to untrack or files with uncommitted changes.
|
|
2057
|
+
For an existing app, the message first says what the run adds to the app,
|
|
2058
|
+
what stays as it is, and which env file gets the CopilotKit key. The answers
|
|
2059
|
+
**go** does not give come next, the key
|
|
2060
|
+
first, and the optional settings with their defaults come last. An env-file
|
|
2061
|
+
line leads with the recommended change and what it means for teammates, with
|
|
2062
|
+
the git command under "Details".
|
|
1916
2063
|
- `settled`: every line is answered. The run goes on to `credentials/plan`.
|
|
1917
2064
|
- `needs-credentials`: an existing app on the managed route has no project
|
|
1918
2065
|
finding yet. The command runs the read-only `onboard credentials` check
|
|
@@ -1956,6 +2103,97 @@ When `init --local --install` stops after it cloned the starter, it still
|
|
|
1956
2103
|
installs the starter's dependencies, and its error says so or names the install
|
|
1957
2104
|
command.
|
|
1958
2105
|
|
|
2106
|
+
#### The opening call: `onboard begin`
|
|
2107
|
+
|
|
2108
|
+
After `onboard start`, the agent runs one call to reach the first message the
|
|
2109
|
+
developer acts on (PE-899):
|
|
2110
|
+
|
|
2111
|
+
```bash
|
|
2112
|
+
copilotkit onboard begin --coding-agent codex --model gpt-5.6 --model-family gpt-5
|
|
2113
|
+
```
|
|
2114
|
+
|
|
2115
|
+
It runs, in one process, the steps an agent used to run one by one: `onboard
|
|
2116
|
+
identify`, `onboard deployment --choice managed`, the session check that
|
|
2117
|
+
`login --json` makes first, the `sign-in-settled` checkpoint, and `onboard read`
|
|
2118
|
+
of the next prompt. Each step records the same event as before. The managed
|
|
2119
|
+
deployment it records is a default, not the agent's choice: the setup message
|
|
2120
|
+
shows it on its Hosting line, which says the hosted service is free to start,
|
|
2121
|
+
and the developer approves it with **go**. On the starter
|
|
2122
|
+
route, in a folder that holds no file of the developer's, it also prints the
|
|
2123
|
+
first setup message, as `onboard setup-message --target empty --json` prints it.
|
|
2124
|
+
A README in the folder leaves that message to `starter/setup`, which records the
|
|
2125
|
+
framework the README names first.
|
|
2126
|
+
|
|
2127
|
+
- With no session, it records the agent and the deployment, then prints
|
|
2128
|
+
`Sign-in needed` and the `login --json --onboarding` command. Sign-in stays its
|
|
2129
|
+
own long-lived process.
|
|
2130
|
+
- `--local` records the agent and serves `deployment/choose-local`. A project
|
|
2131
|
+
with a local stack gets that prompt without the flag.
|
|
2132
|
+
- `--vendor <vendor>` passes a model vendor the developer named to the setup
|
|
2133
|
+
message.
|
|
2134
|
+
|
|
2135
|
+
The separate commands still work, so a resumed run on an older prompt goes on.
|
|
2136
|
+
|
|
2137
|
+
#### The starter fast path: `onboard starter`
|
|
2138
|
+
|
|
2139
|
+
`onboard start` in an empty folder takes the starter route (PE-827). A folder
|
|
2140
|
+
counts as empty by the rule `init` builds by: no source folder, no dependency
|
|
2141
|
+
manifest and no `.env`. A README, a licence, ignore files and a `.env.example`
|
|
2142
|
+
are fine, so a repository created on GitHub takes it. The start must have no
|
|
2143
|
+
`--intent`. The start prints `Route: starter`, and
|
|
2144
|
+
`authenticate/start` then sends the run to `starter/setup` instead of the
|
|
2145
|
+
research. That node records a framework the README names, shows the setup message, then
|
|
2146
|
+
runs `onboard starter create`
|
|
2147
|
+
and `onboard starter prove`. It reads no research or plan prompts and changes no
|
|
2148
|
+
code. Any other folder keeps the research route.
|
|
2149
|
+
|
|
2150
|
+
`onboard start --starter <starter-id> [--vendor <openai|anthropic|google>]`
|
|
2151
|
+
fills the framework, frontend and vendor lines with a starter the person picked
|
|
2152
|
+
on a website or docs page. It refuses a starter the CLI does not know and a
|
|
2153
|
+
vendor the starter does not take, before a run starts.
|
|
2154
|
+
`cli.onboarding.started` carries `onboarding_route`: `starter` or `research`.
|
|
2155
|
+
It also carries `git_available`, from one `git --version` run with a 3-second
|
|
2156
|
+
limit, and `git_major_version` when git names one. A missing git otherwise shows
|
|
2157
|
+
only later, as a failed command.
|
|
2158
|
+
|
|
2159
|
+
`onboard starter` builds and proves a starter in an empty folder from the
|
|
2160
|
+
setup answers, with two commands. The agent runs them from the run
|
|
2161
|
+
folder:
|
|
2162
|
+
|
|
2163
|
+
```bash
|
|
2164
|
+
copilotkit onboard starter create --framework langgraph-js --create support-bot --key-file ~/keys/openai.env
|
|
2165
|
+
copilotkit onboard starter status --wait
|
|
2166
|
+
copilotkit onboard starter prove
|
|
2167
|
+
copilotkit onboard starter status --wait
|
|
2168
|
+
```
|
|
2169
|
+
|
|
2170
|
+
- `create` with no flags builds from the setup answers the run recorded, and
|
|
2171
|
+
first records the run's path with `onboard classify`. It refuses a setup
|
|
2172
|
+
with a line still open, and a framework and frontend with no starter.
|
|
2173
|
+
- `create` with flags builds the starter with the `init` command that
|
|
2174
|
+
`starter/clone` runs: `--framework` takes the `init` starter id. It takes one of `--create`,
|
|
2175
|
+
`--project` or `--local` (with `--defer-model` or `--model-config`), and one
|
|
2176
|
+
of `--key-file` or `--key-later`. It also takes `--model-vendor`, `--model-id`,
|
|
2177
|
+
`--base-url` and `--no-install`, as `init` does. Before it starts anything, it
|
|
2178
|
+
checks the key in the key file with the model key check, and a refused key
|
|
2179
|
+
creates nothing.
|
|
2180
|
+
- `prove` checks the model key in the app, starts the app, runs the round trip,
|
|
2181
|
+
records the proof, and prints the closing report. With the key later, it
|
|
2182
|
+
stops at the key check and prints, word for word, the line the developer adds
|
|
2183
|
+
and the file it goes in. If the developer names a file that
|
|
2184
|
+
holds the key instead, `prove --key-file <path>` checks the key there and
|
|
2185
|
+
copies it into the file the app reads.
|
|
2186
|
+
- Each command records a job, starts a background worker, and waits for it for
|
|
2187
|
+
up to 90 seconds. Some coding agents end a command at 2 minutes, and an
|
|
2188
|
+
agent-run `init` takes a median of about 2 minutes. `status --wait` waits up
|
|
2189
|
+
to 90 seconds again, and prints the step under way, the next command, or what
|
|
2190
|
+
failed.
|
|
2191
|
+
|
|
2192
|
+
The job record and its log are in `~/.copilotkit/onboarding-jobs/<run id>/`,
|
|
2193
|
+
never in the project, because `init` refuses a folder that holds files. The
|
|
2194
|
+
worker passes on the deployment flags the command got, such as `--deployment`
|
|
2195
|
+
and `--ops-api-url`.
|
|
2196
|
+
|
|
1959
2197
|
#### Model vendors in this release
|
|
1960
2198
|
|
|
1961
2199
|
Onboarding offers a new agent only the vendors in this table. When onboarding
|
|
@@ -1969,20 +2207,34 @@ An existing agent keeps its own vendor and model. A vendor recorded with
|
|
|
1969
2207
|
`--vendor-choice existing`, or a run that `onboard classify` placed on an
|
|
1970
2208
|
existing agent, is never refused.
|
|
1971
2209
|
|
|
1972
|
-
| Framework
|
|
1973
|
-
|
|
|
1974
|
-
| Built-in CopilotKit agent
|
|
1975
|
-
| ADK
|
|
1976
|
-
|
|
|
1977
|
-
|
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
2210
|
+
| Framework | Vendors |
|
|
2211
|
+
| --------------------------------------------------------------------------------------------- | -------------------------------------------- |
|
|
2212
|
+
| Built-in CopilotKit agent, Agno, LangGraph (Python, TypeScript, FastAPI), Mastra, Pydantic AI | OpenAI, OpenAI-compatible, Anthropic, Google |
|
|
2213
|
+
| ADK | Google, OpenAI, OpenAI-compatible, Anthropic |
|
|
2214
|
+
| Microsoft Agent Framework (Python), Strands Agents (Python, TypeScript) | OpenAI, OpenAI-compatible, Anthropic |
|
|
2215
|
+
| Claude Agent SDK (Python, TypeScript) | Anthropic |
|
|
2216
|
+
| Every other framework and Custom agent | OpenAI, OpenAI-compatible |
|
|
2217
|
+
|
|
2218
|
+
The table comes from `apps/cli/starter-model-vendors.cjs`. A framework takes a
|
|
2219
|
+
vendor when a run with a real key passed on its starter (PE-733). Each run
|
|
2220
|
+
called a frontend tool, sent the tool result in a new run, called a backend
|
|
2221
|
+
tool, and asked a follow-up with page context. The runs used
|
|
2222
|
+
`gemini-3.8-flash` and `claude-sonnet-5`. The other vendors come in a later
|
|
2223
|
+
release:
|
|
2224
|
+
|
|
2225
|
+
- Google on Microsoft Agent Framework (Python) and Strands Agents: their tool
|
|
2226
|
+
loops drop the `thought_signature` that Gemini 3 returns with a tool call, so
|
|
2227
|
+
Gemini refuses the next request.
|
|
2228
|
+
- CrewAI Flows: Gemini refuses it for the same reason, and its flow does not
|
|
2229
|
+
return a backend tool result to the model with any vendor.
|
|
2230
|
+
- LlamaIndex and Microsoft Agent Framework (.NET): their starters send no page
|
|
2231
|
+
context.
|
|
2232
|
+
- AG2, Deep Agents, MS Agent Harness (.NET) and Custom agent: no starter of
|
|
2233
|
+
theirs ran.
|
|
2234
|
+
|
|
2235
|
+
To use a held-back vendor for a new agent now, choose the built-in CopilotKit
|
|
2236
|
+
agent. An existing agent on a held-back vendor keeps it, and the plan says that
|
|
2237
|
+
this release has not proven that vendor on the framework.
|
|
1986
2238
|
|
|
1987
2239
|
Read `status`:
|
|
1988
2240
|
|
|
@@ -2016,11 +2268,21 @@ copilotkit onboard credentials --model-key OPENAI_API_KEY \
|
|
|
2016
2268
|
```
|
|
2017
2269
|
|
|
2018
2270
|
The step copies each key into that `.env` file. `copiedKeys` gives the outcome
|
|
2019
|
-
for each copy. A file that already holds another real value keeps it.
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2271
|
+
for each copy. A file that already holds another real value keeps it.
|
|
2272
|
+
|
|
2273
|
+
- If git does not ignore an untracked file, the step adds the file's path,
|
|
2274
|
+
anchored with `/`, to the `.gitignore` in the file's nearest existing folder.
|
|
2275
|
+
Then it copies the key.
|
|
2276
|
+
- If the folder is in no git repository, the step copies the key. It also adds
|
|
2277
|
+
the path to the `.gitignore` in the run root, for a later `git init`.
|
|
2278
|
+
- If git tracks the file, the key would be committed. Then the step writes
|
|
2279
|
+
nothing and asks the `env-file-exposed` question. The step also asks that
|
|
2280
|
+
question when it cannot add the ignore line, or when git still does not ignore
|
|
2281
|
+
the file after the line is added. Then it removes the line again.
|
|
2282
|
+
- If git cannot be asked, and the folder can be in a repository, the step stops.
|
|
2283
|
+
|
|
2284
|
+
`next` and `addedIgnoreLines` name each line the step added. A `--copy-to` file
|
|
2285
|
+
outside the repository is refused, because the run's backup cannot restore it.
|
|
2024
2286
|
|
|
2025
2287
|
When the developer keeps the key in a file outside the project, name that file
|
|
2026
2288
|
with `--env-path`, and copy the key into the app's own `.env`:
|
|
@@ -2631,3 +2893,19 @@ settings and app references.
|
|
|
2631
2893
|
model-choice inputs together before authentication. Cold installation,
|
|
2632
2894
|
offline operation, and platform acceptance are not yet validated for a
|
|
2633
2895
|
published candidate.
|
|
2896
|
+
|
|
2897
|
+
### Claude Agent SDK imports
|
|
2898
|
+
|
|
2899
|
+
Use `copilotkit import --source claude-agent-sdk-python --dry-run` or
|
|
2900
|
+
`--source claude-agent-sdk-typescript` for an explicitly selected native source.
|
|
2901
|
+
See the [SDK reader configuration and limits](../../libs/import-claude-sdk/README.md)
|
|
2902
|
+
for local transcripts, read-only custom SessionStore exports, language/version
|
|
2903
|
+
pins and original-session continuation requirements.
|
|
2904
|
+
|
|
2905
|
+
### Claude Managed Agents imports
|
|
2906
|
+
|
|
2907
|
+
Use `copilotkit import --source claude-managed-agents --managed-session-ids sesn_example --managed-user-id customer-id --dry-run`
|
|
2908
|
+
to preview a selected native session. Set `ANTHROPIC_API_KEY` for read access;
|
|
2909
|
+
`--managed-workspace-id` selects a source workspace when needed. See the
|
|
2910
|
+
[Managed Agents importer contract](../../libs/import-claude-managed/README.md)
|
|
2911
|
+
for discovery, saved-content limits, continuation companions and failure behavior.
|
package/cli-build-info.json
CHANGED
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"package": {
|
|
4
4
|
"name": "copilotkit",
|
|
5
|
-
"version": "4.
|
|
5
|
+
"version": "4.30.0"
|
|
6
6
|
},
|
|
7
7
|
"intelligence": {
|
|
8
|
-
"commit": "
|
|
8
|
+
"commit": "775ac06c3cf4ce84d460ab9513e422440defec2c"
|
|
9
9
|
},
|
|
10
10
|
"copilotKit": {
|
|
11
|
-
"submittedInput": "
|
|
12
|
-
"commit": "
|
|
11
|
+
"submittedInput": "7e8e10bdd3",
|
|
12
|
+
"commit": "7e8e10bdd3f032fdda93a66aecea99e711aa37db"
|
|
13
13
|
},
|
|
14
14
|
"channel": "production",
|
|
15
15
|
"triggeringActor": "BenTaylorDev",
|
|
16
16
|
"workflow": {
|
|
17
|
-
"runId": "
|
|
18
|
-
"runUrl": "https://github.com/CopilotKit/Intelligence/actions/runs/
|
|
17
|
+
"runId": "39968806374",
|
|
18
|
+
"runUrl": "https://github.com/CopilotKit/Intelligence/actions/runs/39968806374"
|
|
19
19
|
},
|
|
20
20
|
"validationResult": "passed",
|
|
21
21
|
"ag2": {
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"revision": "main",
|
|
25
25
|
"pinned": false
|
|
26
26
|
},
|
|
27
|
-
"builtAt": "2026-10-
|
|
27
|
+
"builtAt": "2026-10-23T14:22:28Z"
|
|
28
28
|
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Claude Agent SDK history import
|
|
2
|
+
|
|
3
|
+
This reader imports retained JSONL or a read-only custom SessionStore export into
|
|
4
|
+
Intelligence's existing import/replay path. Python and TypeScript are separate
|
|
5
|
+
sources. The current reader baselines are Python `0.2.166` and TypeScript
|
|
6
|
+
`0.3.299`; focused synthetic tests do not establish released integration support.
|
|
7
|
+
PNI-658 and PNI-659 own the required live content and continuation adapters.
|
|
8
|
+
|
|
9
|
+
## Select a source
|
|
10
|
+
|
|
11
|
+
Use an explicit project transcript directory; the CLI never scans your home
|
|
12
|
+
Claude directory. Stop writers or copy the selected source to a stable snapshot.
|
|
13
|
+
Do not copy unrelated sessions. Files over 64 MiB fail with a per-session error.
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
export CLAUDE_SDK_TRANSCRIPT_DIR=/path/to/selected/project-transcripts
|
|
17
|
+
export CLAUDE_SDK_VERSION=0.2.166
|
|
18
|
+
export CLAUDE_SDK_PROJECT_KEY=-original-working-directory
|
|
19
|
+
export CLAUDE_SDK_SOURCE_ID=original-store
|
|
20
|
+
export CLAUDE_SDK_AGENT_KEY=my-agent
|
|
21
|
+
copilotkit import --source claude-agent-sdk-python --dry-run
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
For TypeScript use `claude-agent-sdk-typescript` and version `0.3.299`.
|
|
25
|
+
`CLAUDE_SDK_END_USER_ID` explicitly assigns the original application's user ID.
|
|
26
|
+
Otherwise choose the CLI's existing unrecoverable-user policy; it does not infer
|
|
27
|
+
an end user from the person running the import. Supply the existing agent map,
|
|
28
|
+
Intelligence API URL/key and confirmation flags to upload. Existing Skip/Replace,
|
|
29
|
+
active-thread locks and transaction handling apply unchanged.
|
|
30
|
+
|
|
31
|
+
## Custom SessionStore
|
|
32
|
+
|
|
33
|
+
Use [exportSessionStore](src/store-export.ts) with the TypeScript store, or
|
|
34
|
+
[export_session_store](python/export_session_store.py) with the Python store.
|
|
35
|
+
These helpers call only `load`, optional session listing and optional subkey
|
|
36
|
+
listing. Pass explicit session IDs when the store has no listing method. Export
|
|
37
|
+
from stopped writers or a backend read snapshot: generic SessionStore has no
|
|
38
|
+
cross-key transaction contract. No backend credentials go into the export.
|
|
39
|
+
|
|
40
|
+
Serialize the helper result to a JSON file, unset `CLAUDE_SDK_TRANSCRIPT_DIR`, and
|
|
41
|
+
set `CLAUDE_SDK_SESSION_STORE_EXPORT=/path/to/export.json`. The declared language,
|
|
42
|
+
SDK version and project key must match configuration. This supports stores that
|
|
43
|
+
return the native entries unchanged through these read methods; it does not
|
|
44
|
+
assume a Redis, database or object-store layout. A missing entry fails export.
|
|
45
|
+
|
|
46
|
+
The envelope is `claude-session-store-v1`, with `language`, `sdkVersion`,
|
|
47
|
+
`projectKey`, and `sessions`. Each session has `sessionId`, ordered `entries`, and
|
|
48
|
+
`subkeys` (`subpath` plus ordered `entries`). Python's helper translates only the
|
|
49
|
+
store's snake_case selector names into this common envelope; native entries stay
|
|
50
|
+
unchanged.
|
|
51
|
+
|
|
52
|
+
## What replay preserves
|
|
53
|
+
|
|
54
|
+
Root messages retain file order, native message and tool IDs, text, saved thinking,
|
|
55
|
+
tool arguments/results and inline media bytes/MIME/filenames. URL media stays a
|
|
56
|
+
structured attachment with its original URL and known MIME/name; extraction makes
|
|
57
|
+
no network requests. URL availability is not guaranteed. Provider-file input
|
|
58
|
+
remains unsupported by the SDK adapter; this importer does not add it. Unknown blocks remain
|
|
59
|
+
visible JSON. Unknown root entries remain in native provenance. Child provenance retains only subpaths and entry counts; raw child transcripts are not copied into thread metadata. Empty or missing child transcripts produce visible import warnings.
|
|
60
|
+
Saved children also become separate namespace histories, expandable on the parent
|
|
61
|
+
conversation page. Recorded delegation links preserve nested children and native
|
|
62
|
+
parent tool-call IDs; unavailable parent-call links stay explicitly unknown.
|
|
63
|
+
Children do not become independent resumable threads or duplicate root messages. Native UI tool calls/results use shared replay conversion; this cannot
|
|
64
|
+
recover middleware artifacts absent from the transcript.
|
|
65
|
+
|
|
66
|
+
Historical `Tool call forwarded to client` results are marked as missing answers,
|
|
67
|
+
not successful approvals. Import cannot reconstruct the real result from later
|
|
68
|
+
user prose. Ordered successful state-tool updates merge shallowly. Without a
|
|
69
|
+
saved complete base, provenance labels that recovered state `partial`; it is not
|
|
70
|
+
published as the complete `stateSnapshot`. Native success-only state-tool results
|
|
71
|
+
and transient system prompts do not prove that an initial state was saved.
|
|
72
|
+
|
|
73
|
+
## Continuation boundary
|
|
74
|
+
|
|
75
|
+
The native session UUID remains the imported thread ID. PNI-659's host binding
|
|
76
|
+
resolver must recognize imported IDs, select the original working directory,
|
|
77
|
+
SessionStore, tools and access, and fail if an imported session is unavailable.
|
|
78
|
+
A missing imported session must not fall through to new-session creation.
|
|
79
|
+
Saved `hook_deferred_tool` attachments recover one native approval only when
|
|
80
|
+
they match an unresolved call on the intact current root chain. Its call ID,
|
|
81
|
+
tool name and input must match. Later results clear it. Missing ancestry,
|
|
82
|
+
conflicts or multiple pending deferrals are non-actionable. Frontend
|
|
83
|
+
`mcp__ag_ui__` calls remain frontend tools; they are not native permissions.
|
|
84
|
+
Historical in-process permission callbacks are not recoverable approvals.
|
|
85
|
+
Import does not execute models/tools, repair native history, or sync subsequent
|
|
86
|
+
activity sent directly to the SDK. Final product validation and release remain
|
|
87
|
+
separate from these reader tests.
|
|
88
|
+
|
|
89
|
+
## Sources
|
|
90
|
+
|
|
91
|
+
- [Session persistence and SessionStore](https://code.claude.com/docs/en/agent-sdk/session-storage)
|
|
92
|
+
- [Session continuation](https://code.claude.com/docs/en/agent-sdk/sessions)
|
|
93
|
+
- [Python native history reader](https://github.com/anthropics/claude-agent-sdk-python/blob/main/src/claude_agent_sdk/_internal/sessions.py)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""Read-only export for claude-agent-sdk 0.2.166 custom SessionStore objects.
|
|
2
|
+
|
|
3
|
+
Call export_session_store(store, project_key, session_ids) from your application
|
|
4
|
+
against quiesced storage or a consistent read snapshot. No query or writes run.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
async def export_session_store(store, project_key, session_ids=None):
|
|
9
|
+
"""Preserve ordered native entries and opaque subkeys with Python key names."""
|
|
10
|
+
if session_ids is None:
|
|
11
|
+
listing = await store.list_sessions(project_key)
|
|
12
|
+
session_ids = [item["session_id"] for item in listing]
|
|
13
|
+
sessions = []
|
|
14
|
+
for session_id in dict.fromkeys(session_ids):
|
|
15
|
+
key = {"project_key": project_key, "session_id": session_id}
|
|
16
|
+
entries = await store.load(key)
|
|
17
|
+
if entries is None:
|
|
18
|
+
raise ValueError(f"Session {session_id} is missing")
|
|
19
|
+
subkeys = []
|
|
20
|
+
list_subkeys = getattr(store, "list_subkeys", None)
|
|
21
|
+
paths = []
|
|
22
|
+
if list_subkeys is not None:
|
|
23
|
+
try:
|
|
24
|
+
paths = await list_subkeys(key)
|
|
25
|
+
except NotImplementedError:
|
|
26
|
+
paths = []
|
|
27
|
+
for subpath in paths:
|
|
28
|
+
child = await store.load({**key, "subpath": subpath})
|
|
29
|
+
if child is None:
|
|
30
|
+
raise ValueError(f"Session subkey {subpath} is missing")
|
|
31
|
+
subkeys.append({"subpath": subpath, "entries": child})
|
|
32
|
+
sessions.append({"sessionId": session_id, "entries": entries, "subkeys": subkeys})
|
|
33
|
+
return {
|
|
34
|
+
"format": "claude-session-store-v1",
|
|
35
|
+
"language": "python",
|
|
36
|
+
"sdkVersion": "0.2.166",
|
|
37
|
+
"projectKey": project_key,
|
|
38
|
+
"sessions": sessions,
|
|
39
|
+
}
|