@jskit-ai/agent-docs 0.1.249 → 0.1.251

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.
Files changed (39) hide show
  1. package/guide/agent/app-extras/assistant-conversation.md +307 -59
  2. package/guide/agent/app-extras/assistant.md +6 -1
  3. package/guide/agent/app-extras/realtime.md +48 -0
  4. package/guide/agent/app-setup/existing-application-migration.md +7 -1
  5. package/package.json +1 -1
  6. package/patterns/feature-package/example/booking-engine/package.json +1 -1
  7. package/patterns/minimal-foundation/example/AGENTS.md +6 -0
  8. package/patterns/minimal-foundation/example/package.json +3 -3
  9. package/patterns/shell-foundation/example/AGENTS.md +6 -0
  10. package/patterns/shell-foundation/example/package.json +4 -4
  11. package/patterns/shell-foundation/example/packages/main/package.json +1 -1
  12. package/reference/autogen/KERNEL_MAP.md +6 -0
  13. package/reference/autogen/PATTERN_INDEX.md +37 -37
  14. package/reference/autogen/packages/assistant-core.md +35 -11
  15. package/reference/autogen/packages/crud-core.md +2 -2
  16. package/reference/autogen/packages/http-web.md +29 -0
  17. package/reference/autogen/packages/kernel.md +11 -0
  18. package/reference/autogen/packages/realtime.md +9 -0
  19. package/reference/autogen/packages/shell-web.md +6 -0
  20. package/skills/jskit/references/existing-application-migration.md +7 -1
  21. package/skills/jskit/references/pattern-index.md +37 -37
  22. package/skills/jskit/references/patterns/app/minimal-foundation/example/AGENTS.md +6 -0
  23. package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +3 -3
  24. package/skills/jskit/references/patterns/app/shell-foundation/example/AGENTS.md +6 -0
  25. package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +4 -4
  26. package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
  27. package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +2 -2
  28. package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
  29. package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
  30. package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +4 -4
  31. package/skills/jskit/references/patterns/crud/crud-screen-set/PATTERN.md +46 -0
  32. package/skills/jskit/references/patterns/crud/json-api-resource-package/PATTERN.md +7 -0
  33. package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/package.json +2 -2
  34. package/skills/jskit/references/patterns/database/mysql-application/example/package.json +1 -1
  35. package/skills/jskit/references/patterns/database/postgres-application/example/package.json +1 -1
  36. package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
  37. package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
  38. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +2 -2
  39. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +3 -3
@@ -84,7 +84,16 @@ Its authorized operations use the existing action catalogue and HTTP router.
84
84
  Read, send, cancel and delivery inspection use the existing `createAssistantApi`
85
85
  request client, including its surface header and workspace path. Inspection is
86
86
  an authenticated POST operation because it may recover and save native receipts;
87
- it never dispatches another model request. Browser inputs cannot set the actor,
87
+ it never dispatches another model request. Cancelling one message is
88
+ `POST …/deliveries/:messageId/cancel` (`cancelConversationDelivery`), which
89
+ always answers success for an unsent, unconfirmed or failed message, without
90
+ waiting for work queued in that conversation. The runtime records the message
91
+ as cancelled, so a send of it that is still queued, or arrives later, is refused
92
+ as not sent with `conversation_message_cancelled`. It also stops a submission
93
+ that holds the message, and afterwards discards its unconfirmed request or
94
+ pending native attempt. A message already accepted stays history. An
95
+ application conversation provides this as `cancelDelivery({ messageId })`;
96
+ without it the operation answers `conversation_unsupported`. Browser inputs cannot set the actor,
88
97
  native host or engine context.
89
98
  `readConversation(id, { beforeTurnId, limit, signal })` optionally requests an
90
99
  earlier or bounded page through the same authenticated GET. Its query contains
@@ -326,11 +335,17 @@ uncertain ID and matching draft text cannot be resent. Active or unconfirmed
326
335
  server work still blocks this continuation. Unknown inspection displays its
327
336
  current result without retaining a stale HTTP error.
328
337
  The same inspection operation may return `{ status: "not-sent", messageId, error }`
329
- when a settled native request has explicit durable no-admission proof. The client
330
- marks only that exact uncertain message failed, preserving its payload, the draft
331
- and other uncertain messages. Inspection never submits or accepts it. Missing
332
- markers, attempted requests, incomplete cleanup and API-model requests remain
333
- conservative. A retired native request cannot be retried against its successor
338
+ when a settled native request has explicit durable no-admission proof. Claude
339
+ also proves it when its history lacks the attempted prompt and no send,
340
+ process or execution of that conversation remains: an admitted prompt is always
341
+ recorded, and nothing is left to record it later. That proof is saved as an
342
+ unattempted request (including a native changeover's saved attempt), so a reload
343
+ no longer restores the message as unconfirmed and a later send may dispatch it.
344
+ The client marks only that exact uncertain message failed, preserving its
345
+ payload, the draft and other uncertain messages. Inspection never submits or
346
+ accepts it. Missing markers, a live process, incomplete cleanup and API-model
347
+ requests remain conservative; Codex and OpenCode still report only accepted or
348
+ unknown. A retired native request cannot be retried against its successor
334
349
  with the old ID; edit its words into a new authored message instead.
335
350
 
336
351
  Incoming saved-state updates refresh the history already loaded with **Load older
@@ -394,9 +409,10 @@ composer; acceptance removes only the submitted files, preserving later uploads.
394
409
  Pass `retryMessageId` for an existing failed or uncertain message. An application
395
410
  may supply its authoritative `retry` receipt projection when routing persists it
396
411
  outside the current local delivery list. Failed delivery reuses the captured
397
- payload; uncertain delivery only inspects the original receipt, never running
398
- preparation or sending again. An accepted restored receipt applies idempotent
399
- composer cleanup. Ordinary `runtime.submitPrepared` remains available to hosts
412
+ payload; uncertain delivery first inspects the original receipt. Unknown never
413
+ runs preparation or sends again. When inspection proves `not-sent`, the message
414
+ is failed and the same Retry sends its original payload with the same ID. An
415
+ accepted restored receipt applies idempotent composer cleanup. Ordinary `runtime.submitPrepared` remains available to hosts
400
416
  that already own their composer; it requires an authored `payload.request`.
401
417
 
402
418
  Both paths use the existing API, abort and receipt owner. It rechecks the actor,
@@ -709,6 +725,10 @@ uses more layout work for long histories. The default is false and retains the
709
725
  existing remove-and-follow behavior and offscreen layout optimization.
710
726
  Scrolling upward within 160 CSS pixels of the transcript's top requests older
711
727
  history through `loadMore`, including touch, wheel and keyboard scrolling.
728
+ New replies are followed while the reader is within 48 CSS pixels of the end.
729
+ The reader's own upward touch, wheel or keyboard scrolling (Home, Page Up, Arrow
730
+ Up, Shift+Space) stops following from its first frame, even within that
731
+ distance; scrolling back down to the end resumes it.
712
732
  Only one request runs at a time, and prepending preserves the reading position.
713
733
  Initial positioning and conversation selection do not fetch older pages.
714
734
  `loadMoreError` pauses automatic loading; the older-messages button remains
@@ -724,12 +744,18 @@ same `reload` action and respects `reloading`. Enable it only when the current
724
744
  actor may recover that conversation. The supplied runtime binding derives this
725
745
  from its existing access-denial state; a 401/403 still clears private history and
726
746
  drafts and offers no error-only Reload. Restore access or sign in through the
727
- application before reopening. A subscription transport failure says **Chat
728
- updates could not reconnect. Retrying automatically; Reload chat to try now.** and
729
- retains its original error as `cause`; provider errors keep their own wording.
730
- After a transport failure or a 5xx subscription response, the subscription retries
731
- by itself after 1 s, doubling up to 30 s, while the socket stays connected; Reload,
732
- a reconnect or disposal replaces that pending retry. Denials (4xx) never retry.
747
+ application before reopening. A subscription that is still unanswered after
748
+ 10 s says **Chat is still loading. Waiting for the server; Reload chat to try now.**
749
+ (`assistant_subscription_waiting`) through the same error channel, and keeps
750
+ waiting: while the socket stays connected it does not unsubscribe or subscribe
751
+ again, so the server's work is not abandoned or repeated. The answer replaces the
752
+ notice. Only an answer missing after 120 s counts as a transport failure, which
753
+ says **Chat updates could not reconnect. Retrying automatically; Reload chat to try
754
+ now.** and retains its original error as `cause`; provider errors keep their own
755
+ wording. After a transport failure or a 5xx subscription response, the subscription
756
+ retries by itself after 1 s, doubling up to 30 s, while the socket stays connected;
757
+ Reload, a reconnect or disposal replaces that pending retry. A disconnect ends the
758
+ wait without a notice and the next connect subscribes again. Denials (4xx) never retry.
733
759
 
734
760
  When `runtime.logger` is supplied, subscriptions emit structured
735
761
  `assistant.conversation.subscription` records containing `stage`, `previousStage`,
@@ -740,8 +766,8 @@ authentication, action admission, conversation opening, observer attachment,
740
766
  snapshot reading and acknowledgement. The acknowledgement stage includes
741
767
  `snapshotTurns` and `snapshotLimit` when available, without message content.
742
768
  `acknowledgement-sent` records server dispatch, not client receipt. Diagnose the
743
- measured slow stage before changing the existing ten-second acknowledgement
744
- deadline.
769
+ measured slow stage before changing the existing ten-second loading notice or the
770
+ 120-second lost-answer deadline.
745
771
 
746
772
  `reloadable`, `reloading`, `welcomeMessage`, and `variant: "main" | "task"`
747
773
  control the corresponding transcript presentation. `userMessageFormat` is
@@ -864,7 +890,18 @@ message with attachments while an earlier delivery is pending.
864
890
 
865
891
  Retry keeps the same payload and message ID; the backend must deduplicate that
866
892
  ID. Edit moves failed text into the composer while preserving a newer draft;
867
- Cancel removes only the failed local entry. Neither action stops native work.
893
+ Cancel never removes a message on the browser's own authority. `cancel(id)`
894
+ marks a pending, uncertain or failed entry `cancelling` (shown as
895
+ Cancelling…, with Retry and Edit hidden), and a queued entry cancelled while
896
+ it waits is never delivered. The caller removes it with `remove(id)` once its
897
+ server agrees, or calls `cancelFailed(id, error)` to keep it with Cancel again
898
+ (by default "Couldn't reach the server — Cancel again"). The runtime's
899
+ `cancelMessage(id)` does all of this: it aborts that message's unsent request
900
+ and running delivery check, calls the server's delivery cancel, removes the
901
+ message on agreement and reloads. A cancel that could not reach the server is
902
+ retried on the next snapshot after reconnecting, including after a page reload
903
+ with `draftStorage`. Without an application `cancel` action, the element
904
+ removes only a failed message.
868
905
  Retry leaves the current draft untouched. Attachment bytes and removal on
869
906
  acceptance remain with the application's attachment owner.
870
907
 
@@ -883,7 +920,10 @@ streaming and provider execution remain separately observable application work.
883
920
 
884
921
  For canonical receipt observation, supply reactive `receiptTurns` and
885
922
  `uncertainOnError: true`. Unknown transport failures then retain an uncertain
886
- entry for inspection; they do not expose Retry, Edit or Cancel. Explicit
923
+ entry for inspection; they expose Retry (the delivery check) and, with
924
+ `cancellableDelivery`, Cancel, which stays enabled while the check runs. The
925
+ runtime binding sets `cancellableDelivery`, because its server always accepts
926
+ a delivery cancel. Explicit
887
927
  pre-admission rejection can still return `{ ok: false, error }`. Use `accept(id)`
888
928
  only after the backend confirms admission. `restoreUncertain(request, savedTurns)`
889
929
  restores the public pending request without sending it again.
@@ -1190,7 +1230,7 @@ fields; disable or omit `models` independently when supplying fixed agent settin
1190
1230
 
1191
1231
  ```js
1192
1232
  {
1193
- enabled: true, pending: false, error: "",
1233
+ enabled: true, pending: false, stopPending: false, error: "",
1194
1234
  goal: { objective: "Finish the report", status: "active",
1195
1235
  elapsedSeconds: 120, sampledAt: Date.now() },
1196
1236
  set({ objective, tokenBudget }), pause(), resume()
@@ -1203,7 +1243,9 @@ surface failures in `error`; return `false` on unsuccessful creation. The shared
1203
1243
  `AssistantGoalControl` owns the form and presentation, not a scheduler or goal
1204
1244
  storage. Supported statuses are `active`, `paused`, `blocked`, `usageLimited`,
1205
1245
  `budgetLimited`, and `complete`. The UI offers creation only without an unfinished
1206
- goal and offers Pause/Resume only for their applicable statuses.
1246
+ goal and offers Pause/Resume only for their applicable statuses. `pending`
1247
+ disables Set and Resume; `stopPending` disables Pause and Cancel, which the
1248
+ supplied binding never blocks on message sending or unknown delivery.
1207
1249
 
1208
1250
  An active goal flashes red; a paused goal stays orange. `elapsedSeconds` is the
1209
1251
  accumulated **active running time**, and `sampledAt` is its sample time in epoch
@@ -2531,8 +2573,10 @@ message returns its receipt without resending.
2531
2573
 
2532
2574
  Codex uses its active-turn steering operation. Claude writes the instruction as a
2533
2575
  plain user message on the same process; Claude Code acknowledges it as queued and
2534
- reads it after the running tool call, so steering never interrupts a running
2535
- command. OpenCode admits the instruction in the same session
2576
+ reads it when the running tool call returns. Steering never interrupts a running
2577
+ command: Claude's Ctrl+B control moves a long foreground command to the background,
2578
+ where it keeps running, so Claude reads the instruction at its next step. OpenCode
2579
+ admits the instruction in the same session
2536
2580
  and follows the new input through completion. No adapter recreates the native
2537
2581
  conversation to imitate steering.
2538
2582
 
@@ -2741,9 +2785,10 @@ The native identity, working directory and credential-home binding remain in
2741
2785
  server-side runtime metadata. Prompt changes replace the process while preserving
2742
2786
  native history; compatible model/effort changes use native controls. Account changes
2743
2787
  are rejected by default. An application that owns its conversations and authorizes
2744
- the current workspace account may opt into `host.allowAccountChange: true`. The
2745
- existing account guard confirms the old process has stopped before saving the new
2746
- identity and resuming the same native history. Failed cleanup blocks adoption
2788
+ the current workspace account may opt into `host.allowAccountChange: true`. At
2789
+ the conversation's next idle admission, the existing account guard confirms the
2790
+ old process has stopped before saving the new identity and resuming the same
2791
+ native history; it never stops a running turn. Failed cleanup blocks adoption
2747
2792
  until the existing Stop recovery succeeds. Completed response receipts still
2748
2793
  require their original saved account; this option cannot rebind past effects. Application access
2749
2794
  is checked again after native preparation and before dispatch. Built-in tools are
@@ -2827,6 +2872,17 @@ observer connections on a shared server per account/runtime scope. Stopping or
2827
2872
  closing one conversation leaves other consumers' work and shared server intact. The
2828
2873
  former process-per-conversation launcher has been removed.
2829
2874
 
2875
+ Every Codex process this owner launches (the shared app-server in interactive and
2876
+ Helper mode, and a local `codexInteractiveArguments()` terminal) starts with
2877
+ `-c features.plugins=false -c features.apps=false`. Codex otherwise syncs the
2878
+ openai/plugins repository into `<CODEX_HOME>/.tmp/plugins` and downloads plugin,
2879
+ app and connector catalogues into `<CODEX_HOME>/cache` at start, roughly 100-250 MB
2880
+ per home that is refreshed and never pruned; no conversation uses either. A
2881
+ terminal started with `--remote` uses its app-server's setting. The same
2882
+ processes pass `-c features.daemon_auto_start=false`, because Codex's terminal
2883
+ (on by default in 0.163) otherwise starts a shared app-server daemon whose detached
2884
+ updater keeps it running after the terminal closes.
2885
+
2830
2886
  The existing owner preserves per-directory startup serialization, waiter
2831
2887
  revalidation, compatibility and liveness checks, verified retirement, helper
2832
2888
  preparation and startup/publication cleanup. Execution and credential facilities
@@ -2840,7 +2896,11 @@ The existing native connection/thread owner has also moved into
2840
2896
  `CodexAppServerAgentProvider` under `/server/codex-provider`. It consumes that shared
2841
2897
  runtime with execution and credential-state facilities. Its native behavior includes
2842
2898
  helper token activation/refresh, bounded inventories, control recovery, goals,
2843
- hook trust, exact command interruption and history export. The existing
2899
+ hook trust, exact command interruption and history export. Inventories bound
2900
+ the thread IDs they keep (1,000 threads, 512-character IDs), not the preview
2901
+ text Codex sends and the inventory discards; an existence check stops at the
2902
+ page that holds its thread. A refused inventory names the check and thread that
2903
+ failed. The existing
2844
2904
  native consumer now supplies only its host policy and application callbacks. The common
2845
2905
  driver uses this backend. Ordinary applications use the common conversation API
2846
2906
  with its supplied execution and credential defaults.
@@ -2907,16 +2967,39 @@ native work running; failed stop or final persistence remains retryable. Recover
2907
2967
  uses the recorded native owner after reopening and never replays the request.
2908
2968
  Applications using the common runtime do not supply Codex recovery callbacks.
2909
2969
 
2910
- OpenCode provider credentials are cached for a shared server lifetime. The
2911
- application's private `publish` operation enters that same owner's acquisition
2912
- fence after validating the selected provider. Pending starts drain before the
2913
- owner checks all consumers. Another provider, an unowned driver target or an
2914
- unconfirmed native terminal refuses publication before stopping work; the
2915
- previous saved credential stays available. When only owned selected users remain,
2916
- the original cleanup and verified server exit retire the native cache before
2917
- publishing. New acquisitions refuse during this interval and can retry afterwards.
2918
- The application supplies terminal inventory from its existing PTY owner; no
2919
- second process owner or credential refresh proxy is involved.
2970
+ OpenCode reads provider credentials into each directory's native instance and
2971
+ keeps them until that instance is disposed. An OpenCode connection change
2972
+ (connecting, replacing or removing a key) never stops, kills or waits for running
2973
+ turns, retained conversations or the shared server. After the application's
2974
+ private `publish` operation saves the change, the owner reads the host's saved
2975
+ connections from the invalidation preparation's `connections()`, writes each
2976
+ changed key to the running server (`PUT /auth/{provider}`), removes each removed
2977
+ one, and returns `{ closed: 0, ok: true }`. Directories with no turn in flight
2978
+ reload at once (`POST /instance/dispose`). A directory with a turn in flight
2979
+ reloads when its last turn there ends, so that turn finishes on the credentials
2980
+ it started with. New work in a directory still awaiting its reload (a new main,
2981
+ temporary or renewal turn, or a native terminal) waits for that reload and so
2982
+ never starts on credentials the server no longer holds; the only wait is that
2983
+ directory's own running turn, and a steer joins it. The server client records
2984
+ every directory it has loaded (`instanceDirectories()`), so a directory that
2985
+ only served storage reads reloads too, and `disposeInstance()` reloads one
2986
+ directory. `ensure(selected, start, readConnections)` applies the same update
2987
+ when an acquisition finds a changed key. It reads the saved connections instead
2988
+ of trusting the caller's, so a preparation resolved before the change cannot
2989
+ restore an older key. Without `readConnections`, or when a provider's route
2990
+ changes, the shared server is replaced as before. A turn whose provider was
2991
+ removed ends as a credential failure with "`<provider>` isn't connected. Connect
2992
+ it again, then send your message again." An unconfirmed native terminal still
2993
+ refuses the change before publication through the application's
2994
+ `assertConnectionChange`; no second process owner or credential refresh proxy is
2995
+ involved.
2996
+
2997
+ When the shared OpenCode server exits without being stopped, the owner stops
2998
+ what remains of it at once (reason `opencode-server-exited`) through the same
2999
+ stop as a failed health check, rather than leaving its execution and leftover
3000
+ processes until the next health check, connection change or close.
3001
+ `createOpenCodeServerProcess()` exposes that exit as `unexpectedExit`; hosts
3002
+ wire nothing for it.
2920
3003
 
2921
3004
  An application's selected provider credential change uses the existing owner's
2922
3005
  `invalidateRuntimes({ modelProviderId, includeOwned, toolHomeSource })` branch.
@@ -2931,6 +3014,26 @@ process retirement only after every loaded/cached thread is proved to belong to
2931
3014
  that provider; mixed-provider homes refuse retirement. Genuine account/socket
2932
3015
  changes retain the original whole-runtime invalidation and recovery.
2933
3016
 
3017
+ A Codex account change (the runtime lifecycle's `includeOwned` invalidation)
3018
+ never stops or waits for a running turn. A Codex process reads its credentials
3019
+ once, so runtimes whose loaded threads are idle stop at once through the
3020
+ verified stop, while a runtime with a running native turn is marked stale: its
3021
+ active goals are paused so it starts no further turn, its provider still serves
3022
+ that turn's output, steer and interrupt, never restarts its runtime and never
3023
+ marks the current account after a rejection. The owner result lists it under
3024
+ `deferred`; it stops through the same verified stop once its turn completes
3025
+ and its output is recorded, or before the session's next runtime starts. The
3026
+ application gives each sign-in its own runtime directory and provider key, so
3027
+ the next message starts at once on the current account. The run owner's
3028
+ `continueGoalAfterAccountChange(sessionId, { threadId })` option resumes a goal
3029
+ the change paused once the previous runtime stopped; without it the goal stays
3030
+ paused. A runtime that cannot be inspected stops as before. When the
3031
+ application's `identity.write` returns `supersededRuntimeDir` (the runtime
3032
+ directory the session recorded before), the owner removes that directory once
3033
+ its runtime has verifiably stopped; a stale runtime still finishing its turn
3034
+ keeps no exit proof when it stops. Helper cleanup treats an absent directory as
3035
+ retired.
3036
+
2934
3037
  The application owns independently saved orchestrator/provider records and
2935
3038
  validation before publication. This native lifecycle facility copies no keys
2936
3039
  and validates no other provider. Changed account fingerprints still require an
@@ -3124,9 +3227,11 @@ retained runtime handle. Closure during host preparation prevents acquisition.
3124
3227
  `inspectTemporaryActivity` and reads the selected owner's existing temporary-work
3125
3228
  inventory. Its configured host supplies `{ sessionId: id, engine, native, context }`.
3126
3229
  It opens no Main conversation and remains available during cleanup after runtime
3127
- closure. Native restoration and activity exclusions are those of the same owner;
3128
- there is no additional cache. This advanced server operation has no browser route
3129
- or caller-supplied owner/engine override.
3230
+ closure. Activity exclusions are those of the same owner; there is no additional
3231
+ cache. Claude answers from the temporary work this server runs and reopens no
3232
+ saved conversation: a turn an earlier server saved as active ended with that
3233
+ server. This advanced server operation has no browser route or caller-supplied
3234
+ owner/engine override.
3130
3235
 
3131
3236
  An existing application's renewal transaction can invoke
3132
3237
  `runtime.generateNativeRenewalHandover({ id, context, input })` and
@@ -3152,12 +3257,21 @@ its existing renewal authorization before native cleanup.
3152
3257
  The same native owners preserve their original contracts: Codex validates
3153
3258
  application renewal authority before its lifecycle queue, then reads saved runtime
3154
3259
  facts inside that queue and releases persisted proof only after shared-peer checks;
3155
- Claude closes through its existing entry/terminal cleanup; OpenCode predecessor
3260
+ Claude stops the session's retained work, closes its terminals and forgets the
3261
+ session, reopening no saved conversation and writing nothing for an idle one (the
3262
+ session's own close already recovered saved custody); OpenCode predecessor
3156
3263
  cleanup awaits close before consuming proof, while successor cleanup only consumes
3157
3264
  proof. OpenCode retains its original distinction between a resolved failed close
3158
3265
  (which still consumes proof) and rejected close (which leaves proof retryable).
3266
+ Deleting a scoped OpenCode conversation returns its scope's exit proof as
3267
+ `providerExit` and keeps none, because no renewal ever releases a scope's proof.
3159
3268
  Applications retain result projection and successful binding retirement.
3160
3269
 
3270
+ Closing a session stops what this server runs for it and then reopens only the
3271
+ saved custody an earlier server left (an execution whose exit is unproven, or a
3272
+ turn saved as active), so a verified stop can retire it. Claude leaves idle saved
3273
+ conversations closed and names an unreadable saved conversation by ID.
3274
+
3161
3275
  `runtime.disposeNative({ namespace, sessionId, context, options })` also supports
3162
3276
  cleanup when no ready retained handle exists. It authorizes operation `dispose`
3163
3277
  and requests `{ id: sessionId, context, input: options, operation: "dispose" }`
@@ -3171,6 +3285,21 @@ existing early-retirement fence before falling back to the configured owner.
3171
3285
  These server-only operations accept no caller-selected owner or engine and add
3172
3286
  no browser endpoints. Ordinary applications still use their conversation handle.
3173
3287
 
3288
+ A host can bind a logical conversation through its own `commands`, `read` and
3289
+ `readStream`, for example an application's temporary chat. `open()` keeps one
3290
+ entry for each such namespace, and browser handles opened per request share it.
3291
+ When the application deletes or archives that logical conversation, call
3292
+ `runtime.retireOpenConversation({ namespace, sessionId })` from the same trusted
3293
+ server transaction. It retires the open entry, closes its handles and listeners,
3294
+ and returns `{ retired: true }`. A namespace with no open entry returns
3295
+ `{ retired: false }`: nothing is opened to retire it. Native and storage-owned
3296
+ conversations are refused; they keep `dispose()` and `runtime.disposeNative()`.
3297
+ The application has already stopped and removed the logical conversation's work
3298
+ through its own commands; this operation stops nothing and has no browser endpoint.
3299
+ A logical conversation streams through its own `readStream`, so retiring or
3300
+ disposing it leaves the live reply of another conversation that shares its id,
3301
+ such as the session's Main conversation, unchanged.
3302
+
3174
3303
  Historical native records can predate an application's retained scope identity.
3175
3304
  An advanced host can clean up those exact records through
3176
3305
  `runtime.interruptNativeDetachedConversation({ id, context, input })` or
@@ -3193,6 +3322,16 @@ retirement preservation effect. The configured host receives operations
3193
3322
  same saved `binding.engineId`; current conversation selection is not consulted.
3194
3323
  The existing native owners enumerate, export and delete history. These calls add
3195
3324
  no inference authorization or runtime-closure rule to the original storage policy.
3325
+ Storage work borrows the shared native process; it is not a user that keeps it
3326
+ running. Codex and OpenCode stop a process a storage read started about one
3327
+ minute after the last such read (so one maintenance pass shares it), unless a
3328
+ conversation, terminal or helper uses it by then. Persistent (Temporary chat)
3329
+ conversations borrow it the same way: creating them, reading their history or
3330
+ status, stopping idle work, deleting them and changing their settings borrow the
3331
+ provider; a running persistent turn or an active goal holds it until it ends,
3332
+ and it then stops after the same idle minute unless something else uses it. Any
3333
+ other real Codex use of that provider claims it, and goal and plan-usage reads
3334
+ ignore a borrowed provider.
3196
3335
  All four operations are server-only, accept no caller-supplied native owner or
3197
3336
  host, and have no HTTP, socket or client route. Ordinary applications continue
3198
3337
  using their conversation handles.
@@ -3205,6 +3344,18 @@ and synchronously returns `{ engine, native, context, input }` with its existing
3205
3344
  native owner and application preparation. Codex, Claude and OpenCode support this
3206
3345
  advanced operation. It opens no conversation or retained handle and remains
3207
3346
  retryable after runtime closure, including when credentials have been revoked.
3347
+ Claude closes each of the project's sessions from its retained entries alone,
3348
+ independently and together, and then forgets them. A session that cannot close
3349
+ is reported by ID in `failed` (with a combined `error`) while every other session
3350
+ still stops.
3351
+ Codex stops each scoped conversation through the provider that observes it,
3352
+ then retires saved Helper records through the providers it stops, and stops every
3353
+ provider of the project's sessions, including one that a Temporary chat or a
3354
+ read borrowed and no Main thread names. A conversation
3355
+ that cannot be stopped is reported in `failed` while the others still stop. A
3356
+ saved Helper record that cannot be restored (for example, one whose account was
3357
+ removed) stays on disk for a later connection; the result reports it under
3358
+ `helperRestore.failed` with its session and thread instead of failing the stop.
3208
3359
 
3209
3360
  `runtime.invalidateNativeRuntimes({ context, input })` uses the same trusted
3210
3361
  server boundary for account changes and shutdown. Its configured host receives
@@ -3213,10 +3364,31 @@ synchronously. The runtime returns the native operation directly: shutdown
3213
3364
  fences and synchronous errors are not deferred behind another await. The host
3214
3365
  retains account policy and result presentation; the native owner retains its
3215
3366
  original cleanup sequence and retryable failures. No conversation is opened:
3216
- each native owner stops the processes this server runs, since none outlives the
3217
- server that started it, and saved conversations are not reopened to be stopped.
3218
- Failed cleanup can be retried after runtime closure. This is not a browser
3367
+ at shutdown each native owner stops the processes this server runs, since none
3368
+ outlives the server that started it, and saved conversations are not reopened to
3369
+ be stopped. Claude stops its sessions together, leaves an idle chat untouched
3370
+ (nothing to stop, nothing written) and reports a session that cannot stop by ID
3371
+ in `failed` while the others still stop. It stops them even when its
3372
+ account-query cleanup fails; that failure is still the call's result. Once
3373
+ shutdown has invalidated the owner, a later session close only releases retained
3374
+ work. Failed cleanup can be retried after runtime closure. This is not a browser
3219
3375
  operation or a way to submit a caller-selected native owner.
3376
+ A running Codex app-server keeps the credentials it started with. A Codex turn
3377
+ whose OpenAI credentials were rejected after a sign-out or account switch
3378
+ (ChatGPT's token-refresh failure, or a 401 from OpenAI) ends with "Codex (OpenAI)
3379
+ isn't connected. Sign in to Codex, then send your message again."; another
3380
+ provider's rejected key keeps its own error.
3381
+
3382
+ A Claude account change (sign-in, sign-out or switching accounts) stops and
3383
+ waits on nothing. Claude Code reads its credentials for every request, so a
3384
+ running turn continues on the newly connected account, and a conversation whose
3385
+ account signed out ends its next request at once with "Claude isn't connected.
3386
+ Sign in to Claude, then send your message again." The Claude owner only drops
3387
+ the account's cached model and usage reads, without waiting for cancelled reads
3388
+ to finish. Each conversation applies the account guard below at its next idle
3389
+ admission; a status read during a running turn keeps that turn. A provider-key
3390
+ change (`modelProviderId`) still stops the conversations using that provider,
3391
+ because their key is fixed when the process starts.
3220
3392
 
3221
3393
  `runtime.reconcileNativeSessions({ context, sessions, options })` restores an
3222
3394
  application's saved session collection through those same configured native
@@ -3424,8 +3596,9 @@ reuses the host's existing terminal snapshot before attaching, records the
3424
3596
  returned terminal ID on that target, and clears matching IDs after the host's
3425
3597
  existing PTY close resolves. The host supplies only its original read, close
3426
3598
  and namespace functions; a thrown close keeps the native attachment retryable.
3427
- Project cleanup restores the same Helper records, closes the scoped native
3428
- conversations and selects their providers through these existing owners.
3599
+ Project cleanup closes the scoped native conversations, then restores the same
3600
+ Helper records and selects their providers through these existing owners; a
3601
+ record it cannot restore is reported rather than keeping providers running.
3429
3602
  Conversation preparation also applies Helper restoration or ordinary-thread
3430
3603
  ledger exclusion before admission. Native activity and plan-usage queries read
3431
3604
  the same owned maps; hosts retain authorization and result presentation.
@@ -3569,12 +3742,19 @@ The turn owner preserves the production receiver's block lifecycle: deltas are
3569
3742
  temporary, block-stop removes them, and completed snapshots use their native
3570
3743
  UUIDs. It does not group distinct history snapshots into a synthetic reply.
3571
3744
  The retained owner's `createAccountQueries({ accountIdentity, createProcess })`
3572
- composes the existing native model/usage query owner with its own process inventory
3573
- and closing state. A managed host supplies its authorized identity reader and
3745
+ composes the existing native model/usage query owner with its own process inventory,
3746
+ configuration root and closing state. A managed host supplies its authorized identity reader and
3574
3747
  account-process factory. The original query caches, pending-query sharing and
3575
3748
  retryable cleanup remain unchanged; account queries share already-owned processes
3576
3749
  and the same conversation shutdown boundary. Matching owned processes
3577
- are reused; temporary query processes must prove cleanup. Failed stops remain
3750
+ are reused for plan usage; temporary query processes must prove cleanup. The
3751
+ model list is read through a temporary query process (a live conversation's list
3752
+ dates from its start) and kept for its account until the account's
3753
+ `.credentials.json` or the answering process's `command` changes by file
3754
+ metadata: sign-in, sign-out, a token refresh or plan change, or a Claude Code
3755
+ update. Rereading it otherwise starts nothing. A bare command name has no
3756
+ metadata, so only the credentials refresh its list. A started process exposes
3757
+ the `command` it ran. Failed stops remain
3578
3758
  owned and are retried before another native query. `invalidate()` drains pending
3579
3759
  queries, clears both caches and retries retained cleanup while new work is
3580
3760
  blocked. For managed bindings, the existing retained conversation owner also
@@ -3584,7 +3764,25 @@ closing fence. The host supplies current storage facts, authorized context,
3584
3764
  terminal cleanup and product error conversion. These trusted server lifecycle
3585
3765
  operations use the configured common runtime and are not browser actions.
3586
3766
  The account owner's usage normalization retains only native windows whose values and reset times
3587
- are valid; it does not invent refreshed allowance. Product model offerings and
3767
+ are valid; it does not invent refreshed allowance. Plan usage keeps one reading
3768
+ per account in the server process, shared by every account-query owner, page and
3769
+ session that asks with the same `accountIdentity`, so that identity must name one
3770
+ account. A request that arrives during the account's read shares it. It reads
3771
+ through the asking owner's matching live conversation process at most once a
3772
+ minute per account; with none, or when that answer cannot prove it is current,
3773
+ it starts one temporary query process only when neither a verified reading nor a
3774
+ temporary read is from the last five minutes, and stops it when the read
3775
+ finishes. An account therefore starts at most one temporary Claude every five
3776
+ minutes however many pages poll, and none while nothing asks; clients should
3777
+ poll only while the page is visible. A refused fallback keeps the last reading.
3778
+ `invalidate()` forgets the readings that owner used. Only an answer carrying the usage
3779
+ endpoint's `limits` list replaces the reading: Claude Code's fallback answer,
3780
+ taken from the answering process's last response headers while its endpoint read
3781
+ fails or is held, can be hours old and has no age. A reading is returned as
3782
+ `available` with `currentForMs` for seven minutes after `checkedAt`, and then as
3783
+ `stale` with its windows and `checkedAt`; with no verified reading the result is
3784
+ `{ status: "unavailable", windows: [] }`. A native usage change lets the next
3785
+ request read again without hiding the last reading. Product model offerings and
3588
3786
  account visibility remain application configuration. The same subpath supplies
3589
3787
  `claudeCatalogueModels(initialization)` for the original native model and effort
3590
3788
  projection, retaining native IDs, display-name fallbacks and effort labels.
@@ -3676,8 +3874,16 @@ policy. Both compatibility probes retain their sanitized connection errors;
3676
3874
  neither operation is a conversation or an account store.
3677
3875
  `readClaudeCodeAuthStatus` uses a supplied capture runner for native account
3678
3876
  inspection. Hosts select the executable and credential home and retain their
3679
- execution policy; the reader returns only public account fields. The ordinary
3680
- runtime supplies this integration automatically.
3877
+ execution policy; the reader returns only public account fields. Reads of one
3878
+ account (configuration root, credential home and Claude identity variables)
3879
+ share one answer whichever runner or executable asks, kept until a sign-in,
3880
+ sign-out or token refresh changes `.credentials.json`; Claude Code's own
3881
+ `.claude.json` rewrites, during turns and after each status run, do not repeat
3882
+ the read. The ordinary runtime supplies this integration automatically. A read
3883
+ the runner reports as timed out (`timedOut`) or refused for now (`retryable`) is
3884
+ reported and reused for 30 seconds, so a busy host is not asked again by every
3885
+ caller; a read that ran and failed is asked again next time. macOS reuses
3886
+ nothing, because file metadata cannot show Keychain changes.
3681
3887
  The retained owner stops its native process or recovers its durable execution
3682
3888
  identity through the supplied host. Its internal stop operation preserves the
3683
3889
  original stop-proof contract and throws `claude_stop_unconfirmed` when cleanup
@@ -3792,6 +3998,14 @@ Set transport limits appropriate to the host; the default payload limit is
3792
3998
  unbounded. A request abort retires the local request; interrupt a running native
3793
3999
  turn with `turn/interrupt` when cancellation must stop provider work.
3794
4000
 
4001
+ `prepareCodexModelCatalog({ command, runtimeDir, bundled, additionalModels,
4002
+ codexHome, signal })` from the same entry point exports a runtime's
4003
+ `models.json` with the CLI's `debug models` and reuses it until its revision
4004
+ changes: the absolute command's file identity, `bundled`, `additionalModels`, or
4005
+ the metadata of `auth.json` and `config.toml` in `codexHome` (default
4006
+ `CODEX_HOME`, then `~/.codex`). A bare command name exports every time. Isolated
4007
+ tests pass their own `codexHome`.
4008
+
3795
4009
  The original public import contracts remain available alongside these host and
3796
4010
  testing surfaces. `/server/codex-client` exports `CodexAppServerJsonRpcClient`
3797
4011
  and `socketPathFromCodexAppServerEndpoint`; `/server/codex-events` retains its
@@ -3918,8 +4132,14 @@ call the same Helper owner directly for thread lookup and retirement, without a
3918
4132
  host inspection callback. A returned retirement promise retains the original
3919
4133
  admission-release order; native dispatch remains awaited.
3920
4134
  It also rejects ordinary access to a retained Helper thread and aggregates
3921
- restoration failures without changing their retryability. The host decides when
3922
- successful restoration is required and supplies its authorized storage root.
4135
+ restoration failures without changing their retryability. An unreadable ledger
4136
+ or a host notice the host refuses is reported as a restoration failure, not a
4137
+ rejection. The host decides when successful restoration is required and supplies
4138
+ its authorized storage root; the required-restoration error names the first
4139
+ failing session, thread and cause. Closing a session or project reports
4140
+ unrestorable records and still stops its live work. Reconciliation continues
4141
+ for every session and retires each stale provider independently. Account-change
4142
+ invalidation does not restore saved records.
3923
4143
  Stable-account capture and completion validation also belong to the shared run
3924
4144
  owner, independently of the optional retained Helper ledger. They preserve the
3925
4145
  account check after native resume, and the exact current-turn guard before
@@ -3991,6 +4211,17 @@ and `codexCatalogReasoningEfforts` retain native IDs, display-name fallbacks and
3991
4211
  reasoning-option order. Hosts choose offerings, defaults, connection visibility
3992
4212
  and product labels; they may use the original row fields `model`, `hidden`,
3993
4213
  `isDefault` and `defaultReasoningEffort` for that policy.
4214
+ `codexHomeDisposablePaths(codexHome, { retired = false })` returns the sorted
4215
+ absolute paths of Codex-owned entries no JSKIT-launched Codex uses: the plugin
4216
+ and app leftovers in `.tmp` (`plugins*`, `git-*`, `bundled-marketplaces`) and
4217
+ `cache` (`remote_plugin_catalog`, `codex_apps_tools`, `codex_apps_server_info`,
4218
+ `codex_app_directory`, `bundled_plugin_exclusions`). With `retired: true`, for a
4219
+ home that will not launch again, it returns `logs_<n>.sqlite` with its `-wal` and
4220
+ `-shm` files, `.tmp`, `cache` and `tmp`, and keeps auth, config, the catalogue,
4221
+ sessions and the state, goal, memory, queue and thread-history databases that
4222
+ retained conversations may still read. It never follows a linked home or
4223
+ subdirectory, returns a link as itself and reads no file content. The host
4224
+ removes the paths, and only while no Codex process uses that home.
3994
4225
  `codexProviderFileConfiguration(provider, key, codexHome)` formats the original
3995
4226
  private `config.toml` text from the host's authorized provider record and key.
3996
4227
  The record supplies `id`, `label`, `baseUrl`, `webSearch` and the selected first
@@ -4158,7 +4389,8 @@ unconfirmed or rejected stop remains retryable. The execution facility receives
4158
4389
  the native stop reason and three-second termination grace period.
4159
4390
  The application still owns its database path and retention. Startup errors retain
4160
4391
  the execution ID and cleanup proof; optional host `readLogs()` supplies bounded
4161
- diagnostics. If cleanup is unconfirmed, the error also retains `retryCleanup`,
4392
+ diagnostics. A server that exits before readiness names why in its message: its
4393
+ last stderr line as plain text, at most 300 characters. If cleanup is unconfirmed, the error also retains `retryCleanup`,
4162
4394
  the same native stop operation. The shared owner holds that operation until exit
4163
4395
  is verified and blocks replacement startup while cleanup remains unconfirmed.
4164
4396
  Its `cleanupPending` flag lets a managed host retry cleanup during project close
@@ -4302,7 +4534,14 @@ For an existing scoped binding, explicit deletion calls
4302
4534
  its scope/persistence policy from that current context. Read, wait and Stop use
4303
4535
  the same preparation without the deletion descriptor; closing the handle still
4304
4536
  uses its supplied close operation. The driver does not interpret application
4305
- scope fields to choose deletion policy.
4537
+ scope fields to choose deletion policy. A Codex ephemeral thread lives only in
4538
+ the process that created it, so deleting one this server no longer holds needs
4539
+ no native delete. Deleting a scoped conversation stops only what this server
4540
+ runs for the scope: its live providers, and a runtime whose earlier stop could
4541
+ not prove its exit (a runtime other providers share stays theirs). It never
4542
+ starts a provider to stop it, so it needs no account, tool home or workdir. Closing a session stops each
4543
+ persistent temporary conversation through the provider that observes it and
4544
+ reports those it could not stop, which stay retryable.
4306
4545
  A host supplies authorized startup and its application removal notification.
4307
4546
  `openCodeServerForDirectory` keeps each consumer's native client scoped to its
4308
4547
  working directory. `openCodeEnvironmentForDirectory` and
@@ -4470,9 +4709,18 @@ keep using the shared owner for steering and goal admission.
4470
4709
 
4471
4710
  Claude steering and active-turn goal Set/Resume never interrupt the running turn.
4472
4711
  The new input is written as a plain stream-json user message. Claude Code 2.1.307
4473
- acknowledges it with a `queued` command lifecycle event, finishes the running
4474
- foreground tool, then reads the input in the same loop (or in its next loop when
4475
- it arrives after the final model request). The ordinary receipt owner admits it
4712
+ acknowledges it with a `queued` command lifecycle event and reads the input when
4713
+ the running foreground tool call returns, in the same loop (or in its next loop when
4714
+ it arrives after the final model request). So that a long foreground command or a
4715
+ wait loop cannot hold the input for minutes, each steer sends the
4716
+ `background_tasks` control request (Claude's Ctrl+B equivalent) after its write,
4717
+ and again on each `task_started` event until Claude reads it. Foreground Bash
4718
+ commands and subagents keep running in the background and report completion with
4719
+ a task notification; the blocked tool call returns at once.
4720
+ Claude Code 2.1.308 supports the control. A refused control (an older CLI) only
4721
+ leaves the input waiting for the tool call and publishes the
4722
+ `steering_background_failed` diagnostic; `steering_backgrounded` reports success.
4723
+ The ordinary receipt owner admits it
4476
4724
  on that acknowledgement or replay. One native result can then finish the original
4477
4725
  and the queued input; inputs not yet started stay in flight until their own result.
4478
4726
  Interrupting for a steer would kill a running foreground tool such as a deploy.
@@ -172,6 +172,9 @@ NDJSON routes, conversation IDs, message rows and request-claim table remain the
172
172
  integration boundary. A tool reservation is committed to its original
173
173
  `tool_call` row before execution; the matching `tool_result` row retains the
174
174
  verified result. No second transcript is stored in conversation metadata.
175
+ Each chat turn opens its conversation in the runtime and the last of a
176
+ conversation's overlapping turns releases it when it settles, so a finished
177
+ conversation keeps no server memory; the next turn opens it again.
175
178
 
176
179
  The surface's bounded, client-selected history remains request context. It is
177
180
  authorized for attachments and sent to the API model without being inserted into
@@ -542,7 +545,9 @@ it, the UI shows sending status. A delivery failure offers Resend, Edit and Canc
542
545
  beside the message. Resend retains the original message ID, text, selected
543
546
  integration, history and attachment IDs; newer typing and newly attached files
544
547
  remain untouched. Edit moves failed text into the composer and preserves newer
545
- text. Cancel removes only that local failed entry.
548
+ text. Cancel asks the server to cancel that message; it shows Cancelling… and
549
+ leaves only once the server agrees, or stays with Cancel again when the server
550
+ cannot be reached.
546
551
 
547
552
  After acceptance, the runtime displays provider progress and streamed answers.
548
553
  An execution failure before an answer restores the request as a draft only if the