@gajae-code/coding-agent 0.22.2-nightly.20261124082924.45420261659.g79e2acc07056 → 0.22.3
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/CHANGELOG.md +175 -0
- package/dist/types/cli/append-system-prompt.d.ts +7 -0
- package/dist/types/cli/doctor/probe-types.d.ts +1 -1
- package/dist/types/cli/doctor/session-owners-probe.d.ts +7 -0
- package/dist/types/cli/doctor/session-owners.d.ts +22 -0
- package/dist/types/cli/github-release.d.ts +16 -0
- package/dist/types/cli/public-command-errors.d.ts +1 -0
- package/dist/types/cli/session-owners-cli.d.ts +13 -0
- package/dist/types/cli/session-picker.d.ts +16 -3
- package/dist/types/cli/update-cli.d.ts +2 -2
- package/dist/types/cli-ordinary.d.ts +1 -1
- package/dist/types/commands/sdk.d.ts +25 -14
- package/dist/types/config/machine-identity.d.ts +11 -0
- package/dist/types/config/model-registry.d.ts +9 -0
- package/dist/types/config/settings-schema.d.ts +88 -2
- package/dist/types/exec/bash-shell-guardian.d.ts +61 -0
- package/dist/types/export/html/html-export-destination.d.ts +16 -0
- package/dist/types/lsp/client.d.ts +9 -0
- package/dist/types/lsp/types.d.ts +2 -0
- package/dist/types/main.d.ts +40 -3
- package/dist/types/modes/components/session-held-warning.d.ts +27 -0
- package/dist/types/modes/components/session-selector.d.ts +32 -1
- package/dist/types/modes/controllers/selector-controller.d.ts +8 -1
- package/dist/types/modes/interactive-mode.d.ts +12 -1
- package/dist/types/sdk/broker/broker.d.ts +3 -0
- package/dist/types/sdk/broker/lifecycle-ledger.d.ts +5 -2
- package/dist/types/sdk/broker/lifecycle.d.ts +2 -0
- package/dist/types/sdk/broker/session-index.d.ts +11 -0
- package/dist/types/sdk/bus/index.d.ts +1 -1
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +1 -1
- package/dist/types/sdk/host/control/dispatch.d.ts +3 -0
- package/dist/types/sdk/host/control/runtime-gate.d.ts +7 -0
- package/dist/types/sdk/host/registration-test-hold.d.ts +7 -0
- package/dist/types/sdk/index.d.ts +1 -0
- package/dist/types/sdk/lifecycle/service.d.ts +3 -0
- package/dist/types/sdk/session-api-key.d.ts +11 -4
- package/dist/types/sdk/session-readonly/format.d.ts +7 -0
- package/dist/types/sdk/session.d.ts +11 -0
- package/dist/types/sdk/startup-capability.d.ts +11 -2
- package/dist/types/session/agent-session.d.ts +1 -2
- package/dist/types/session/internal/graph-successor-proof.d.ts +33 -0
- package/dist/types/session/internal/managed-session-storage.d.ts +6 -1
- package/dist/types/session/internal/session-claim-set.d.ts +224 -0
- package/dist/types/session/operator-error-message.d.ts +29 -0
- package/dist/types/session/session-handover.d.ts +62 -0
- package/dist/types/session/session-manager.d.ts +131 -17
- package/dist/types/session/session-owner-holder.d.ts +77 -0
- package/dist/types/session/session-owners-layout.d.ts +24 -0
- package/dist/types/session/session-ownership-mode.d.ts +88 -0
- package/dist/types/session/session-ownership.d.ts +191 -0
- package/dist/types/session/session-storage.d.ts +36 -0
- package/dist/types/session/yield-queue.d.ts +13 -0
- package/dist/types/slash-commands/helpers/parse.d.ts +1 -0
- package/dist/types/tools/bash.d.ts +7 -0
- package/dist/types/tools/browser/deferred-profile-cleanup.d.ts +3 -0
- package/dist/types/tools/browser/launch.d.ts +24 -1
- package/dist/types/tools/index.d.ts +6 -0
- package/dist/types/tools/output-meta.d.ts +17 -11
- package/dist/types/tools/tool-result.d.ts +1 -0
- package/package.json +14 -8
- package/scripts/compile-args.ts +6 -3
- package/scripts/run-acp-conformance.ts +36 -10
- package/scripts/verify-gjc-sdk-canonicalization.ts +4 -0
- package/src/cli/append-system-prompt.ts +34 -0
- package/src/cli/auth-broker-cli.ts +5 -1
- package/src/cli/doctor/probe-types.ts +1 -1
- package/src/cli/doctor/probe.ts +9 -5
- package/src/cli/doctor/runner.ts +6 -1
- package/src/cli/doctor/session-owners-probe.ts +69 -0
- package/src/cli/doctor/session-owners.ts +112 -0
- package/src/cli/github-release.ts +100 -0
- package/src/cli/public-command-errors.ts +4 -0
- package/src/cli/session-owners-cli.ts +118 -0
- package/src/cli/session-picker.ts +57 -7
- package/src/cli/stats-cli.ts +19 -1
- package/src/cli/update-cli.ts +50 -25
- package/src/cli-ordinary.ts +3 -18
- package/src/commands/sdk.ts +73 -48
- package/src/commands/session.ts +10 -2
- package/src/config/machine-identity.ts +31 -2
- package/src/config/model-registry.ts +40 -6
- package/src/config/settings-schema.ts +64 -2
- package/src/config/settings.ts +189 -13
- package/src/exec/bash-shell-guardian.ts +181 -12
- package/src/exec/isolated-shell.ts +13 -3
- package/src/export/html/html-export-destination.ts +47 -2
- package/src/export/html/index.ts +161 -13
- package/src/gjc-runtime/launch-tmux.ts +4 -1
- package/src/internal-urls/docs-index.generated.ts +14 -14
- package/src/lsp/client.ts +60 -6
- package/src/lsp/index.ts +2 -6
- package/src/lsp/types.ts +2 -0
- package/src/main.ts +379 -102
- package/src/modes/DESIGN.md +36 -0
- package/src/modes/acp/acp-agent.ts +221 -31
- package/src/modes/action-registry.ts +4 -1
- package/src/modes/components/session-held-warning.ts +62 -0
- package/src/modes/components/session-selector.ts +234 -11
- package/src/modes/controllers/command-controller.ts +12 -5
- package/src/modes/controllers/extension-ui-controller.ts +6 -22
- package/src/modes/controllers/goal-mode-controller.ts +14 -2
- package/src/modes/controllers/input-controller.ts +3 -2
- package/src/modes/controllers/selector-controller.ts +206 -4
- package/src/modes/interactive-mode.ts +46 -5
- package/src/modes/print-mode.ts +2 -1
- package/src/modes/runtime-init.ts +2 -17
- package/src/modes/utils/ui-helpers.ts +5 -3
- package/src/prompts/tools/bash.md +1 -1
- package/src/prompts/tools/monitor.md +1 -1
- package/src/runtime-mcp/manager.ts +5 -1
- package/src/sdk/acp/adapter.ts +2 -0
- package/src/sdk/broker/broker.ts +29 -2
- package/src/sdk/broker/lifecycle-ledger.ts +9 -7
- package/src/sdk/broker/lifecycle.ts +280 -39
- package/src/sdk/broker/session-index.ts +24 -0
- package/src/sdk/bus/index.ts +23 -0
- package/src/sdk/bus/lifecycle-commands.ts +4 -0
- package/src/sdk/bus/telegram-daemon-contract.ts +1 -1
- package/src/sdk/cli/session-cli.ts +8 -0
- package/src/sdk/host/control/dispatch.ts +23 -1
- package/src/sdk/host/control/runtime-gate.ts +22 -0
- package/src/sdk/host/host.ts +9 -1
- package/src/sdk/host/registration-test-hold.ts +51 -0
- package/src/sdk/host/session-runtime.test.ts +42 -0
- package/src/sdk/index.ts +10 -0
- package/src/sdk/lifecycle/service.ts +33 -10
- package/src/sdk/prompt-failure.ts +4 -0
- package/src/sdk/protocol/operation-registry.ts +7 -1
- package/src/sdk/session-api-key.ts +31 -16
- package/src/sdk/session-readonly/format.ts +10 -0
- package/src/sdk/session-readonly/metadata.ts +24 -18
- package/src/sdk/session-readonly/scope.ts +2 -1
- package/src/sdk/session.ts +62 -7
- package/src/sdk/startup-capability.ts +27 -2
- package/src/session/agent-session.ts +512 -80
- package/src/session/internal/graph-successor-proof.ts +108 -0
- package/src/session/internal/managed-session-storage.ts +23 -2
- package/src/session/internal/session-claim-set.ts +720 -0
- package/src/session/operator-error-message.ts +79 -0
- package/src/session/session-handover.ts +283 -0
- package/src/session/session-manager.ts +1439 -264
- package/src/session/session-owner-holder.ts +177 -0
- package/src/session/session-owners-layout.ts +52 -0
- package/src/session/session-ownership-mode.ts +248 -0
- package/src/session/session-ownership.ts +877 -0
- package/src/session/session-storage.ts +60 -16
- package/src/session/yield-queue.ts +43 -0
- package/src/session-import/provider-service.ts +8 -0
- package/src/setup/credential-import.ts +2 -1
- package/src/setup/provider-onboarding.ts +5 -5
- package/src/slash-commands/builtin-registry.ts +2 -0
- package/src/slash-commands/helpers/parse.ts +3 -1
- package/src/task/executor.ts +2 -0
- package/src/tools/bash.ts +10 -0
- package/src/tools/browser/deferred-profile-cleanup.ts +20 -0
- package/src/tools/browser/launch.ts +133 -14
- package/src/tools/browser/registry.ts +72 -19
- package/src/tools/index.ts +10 -1
- package/src/tools/monitor.ts +267 -29
- package/src/tools/output-meta.ts +61 -28
- package/src/tools/tool-catalog.generated.ts +2 -2
- package/src/tools/tool-result.ts +5 -0
- package/dist/types/cli/macos-community-app.d.ts +0 -41
- package/src/cli/macos-community-app.ts +0 -1449
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,181 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.22.3] - 2026-11-28
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Session history now records which stored credential produced each assistant response. Assistant messages produced by a provider response (successful, provider error, aborted after streaming began, and streaming partials) carry `credentialId`, the opaque row id of the stored credential whose key was sent, so usage can be attributed per account, including when a usage limit moves the turn from one account to another. Messages served by a runtime `--api-key`, a models.yml key, an environment variable, or a fallback resolver have no `credentialId`. Older session files without the field load unchanged. Failures raised before or instead of a provider response (transport exceptions, aborts before the first event, local run failures) stay unattributed.
|
|
10
|
+
|
|
11
|
+
- The SDK exports `SessionHeldError` (with `code: "session_held"`, `sessionId` and `holder`, the holder's surface and pid), which the session factories and `createAgentSession` throw under `session.ownership.mode: enforce`, and `probeSessionOwners`, which reports for each session id whether another live process holds it, without taking anything. `createAgentSession` takes an `owner: { surface }` option, the name other processes see while it holds the session it creates (default `sdk`).
|
|
12
|
+
|
|
13
|
+
- With `session.ownership.mode: enforce` (now the default), the held-session warning now offers **Continue here** when the session is held by a host the broker launched, for example a session started from Gajae Mobile, Telegram or `gjc acp`. It closes that host between turns and opens the session in this terminal; attached clients re-attach to the terminal, and an ACP client's next prompt runs there without `session/load`. A host that is running a turn refuses with "The session is running a turn; try again when it finishes." and the warning shows again. Continue here is offered at `gjc --resume <id or path>`, in the `gjc --resume` picker and in `/resume`; never when the holder is another terminal or the app, and not at `gjc --resume <id>` for a session from another folder, which can only be forked here.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- The Bash tool now reads its inline output retention from dedicated settings, `tools.bashOutputTailBytes` (default 1 KB) and `tools.bashOutputHeadBytes` (default 0, tail only), instead of overloading the shared `tools.artifactTailBytes` / `tools.artifactHeadBytes` keys. The shared keys previously showed a 20 KB default in `/settings` and `gjc config get` while Bash silently used 1 KB unless the key was physically present in `config.yml`, so re-selecting the displayed default changed Bash behavior. The shared keys no longer affect Bash output anywhere: Bash results carry their retention policy, so the Bash capture window, the threshold spill, and the inline-size backstop all shape a Bash excerpt from the Bash keys — including Bash output returned through `recipe` — and the backstop caps head and tail independently inside the shared `tools.maxInlineResultBytes` size cap instead of letting the cap widen a 1 KB tail. **Migration:** any `tools.artifactTailBytes` / `tools.artifactHeadBytes` value you set for Bash — whether it widened output or restricted it (for example `0` or another value below 1 KB) — must be copied to `tools.bashOutputTailBytes` / `tools.bashOutputHeadBytes`; otherwise Bash returns to its 1 KB tail-only default after upgrading. The shared keys keep governing every other tool's spill.
|
|
18
|
+
|
|
19
|
+
- Under `session.ownership.mode: enforce`, a turn a session host refuses because another process now holds the session reaches remote clients as `live_session`, the code the broker already returns for a held session, with the operator message and `holder: { surface, pid }`, instead of `internal`. This covers `turn.prompt`, `turn.follow_up`, `turn.abort_and_prompt` and `skill.invoke`, and the turn's `turn.prompt_status` / `turn.result` record. ACP keeps JSON-RPC `-32603` and now carries `data.code: "live_session"` and `data.holder`.
|
|
20
|
+
|
|
21
|
+
- Every interactive session now writes its session directly, in every `session.ownership.mode` and whether or not gjc could take the session's lock (for example on Windows, after a lock timeout, or when the filesystem has no locks). The shared-publication path that let two terminals write one session as separate branches is no longer used. In `observe` and `off`, star, tree summary (branch with summary), Move Session and `/drop` now work after the first message instead of being refused as "Shared session mutation requires transaction admission".
|
|
22
|
+
- Two processes writing the same session no longer branch it. With the default `enforce`, the second one gets the held-session warning, as before. In `observe` or `off`, where gjc could not take the session's lock (Windows, a filesystem without locks, a lock timeout), or with a writer gjc cannot see (an older gjc), there is no warning: the process whose copy of the transcript is out of date stops saving with "Another process changed this session's transcript, so this process stopped saving to it" before its next write. To continue in the stopped terminal, reopen the session with `/resume`, which loads the other process's entries, or fork it from another terminal with `gjc --fork`. If the change is only noticed after this process's entry was written, the write is reported as uncertain rather than refused: the entry is kept in this process, it may already be in the transcript, and this process saves nothing more until the session is reopened.
|
|
23
|
+
- This check covers sessions opened from gjc's own session storage (by id, the picker, `/resume`). A session opened by path (`--resume <file>`) or kept in a `--session-dir` has no such check: two processes below `enforce` writing it both append to the file.
|
|
24
|
+
|
|
25
|
+
- Session ownership now defaults to `enforce` (`session.ownership.mode`): only one gjc process writes a session at a time. What you will see:
|
|
26
|
+
- A second terminal that resumes a session another terminal has open (`gjc --resume <id>`, the `--resume` picker, `/resume`) shows a warning naming the holder, with **Fork into a new session** and **Cancel**.
|
|
27
|
+
- Picking up on a PC a session started from a phone or a bot (Gajae Mobile, Telegram, `gjc acp`, `gjc sdk`) while its broker-launched host is still running shows the warning with **Continue here**, which moves the session to this terminal between turns.
|
|
28
|
+
- `gjc -p --resume <id>` of a held session exits 1 and names the holder before any model call. So does `gjc -p --continue` when the most recent session is held, for example a script run while a TUI has that session open; in a terminal, `gjc --continue` and `autoResume` start a new session instead and say why.
|
|
29
|
+
- Starring or deleting a held session in the picker is refused, and a broker `session.delete` of a held session answers `live_session`.
|
|
30
|
+
- ACP `session/load`, `gjc sdk session send` and the notification daemons still attach to the process that holds the session, and their prompts run there.
|
|
31
|
+
- To opt out, set `session.ownership.mode` to `observe` (claims and counts, never refuses) or `off` (no claims) in the global config, for example `gjc config set session.ownership.mode observe`, and restart running gjc processes; a long-lived SDK embedding reads the config once and also needs a restart. `GJC_SESSION_OWNERSHIP=observe|off` in your shell lowers the mode only for processes started from that shell: hosts the broker launches (ACP, `gjc sdk`, daemon sessions) take the broker's environment, so use the config file for them. On Windows there is no native lock yet, so claims fail open there and nothing is refused. See `docs/session.md`.
|
|
32
|
+
|
|
33
|
+
- With `session.ownership.mode: enforce` (now the default), gjc no longer opens a session that another process holds for writing, and refuses before anything is written to it. `gjc -p --resume <id>` and `gjc -p --continue` print the holder and a `gjc -p --fork <id>` command on stderr and exit non-zero, before any model call; without a terminal, an interactive `gjc --resume <id>` refuses the same way. `gjc --continue` in the TUI and `autoResume` (also with `-p`) start a new session instead and say why. `SessionManager.open`, `openExistingStrict`, `continueRecent` and `createAgentSession` throw an error with `code: "session_held"` that names the holder. A fork never refuses its source, an owners directory that fails its safety checks refuses the session, and remote clients (ACP `session/load`, `gjc sdk`) still attach to the holder. Each refusal rereads `config.yml`, so `gjc config set session.ownership.mode off` (or `observe`) stops refusals in running processes at once; a file that names no mode, or cannot be read, keeps them. `observe` and `off` behave as before.
|
|
34
|
+
|
|
35
|
+
- With `session.ownership.mode: enforce` (now the default), resuming a session that another process holds for writing now shows a warning that names the holder, for example "another terminal (pid 4242)", and offers **Fork into a new session** or **Cancel**, instead of refusing. Fork copies the conversation into a new session in this folder, leaving the original untouched, and continues there. This covers `gjc --resume <id or path>` (the warning comes before the "different project" question, which Fork also answers), the bare `gjc --resume` picker (rows held elsewhere are marked, for example `• in terminal`, and Cancel returns to the list), and `/resume` in the TUI (Cancel keeps the current session). Without a terminal, `gjc --resume` still refuses as before. A switch an embedding requests (`AgentSession.switchSession`) onto a held session, and `SessionManager.setSessionFile` onto one, now throw `SessionHeldError` before any event. The printed `gjc --fork` command now repeats a transcript path, quoted for the shell, or adds `--session-dir`, so it finds the same session. `observe` and `off` behave as before.
|
|
36
|
+
|
|
37
|
+
- In every ownership mode, an ACP prompt on a session whose host is gone, including one closed on purpose between turns (for example with `gjc sdk session close`), now resumes the session instead of failing. Resume reuses the endpoint of whatever process now holds the session, and launches a host only if nobody holds it. This matches what ACP already does after it loses its connection to a host.
|
|
38
|
+
|
|
39
|
+
- Each gjc process that opens a session for writing now takes a claim on it (`session.ownership.mode`, which defaults to `enforce`; see the entry on the default), and a session that another process already holds is counted as a conflict. Under `observe`, nothing is refused and no warning is shown (the log records it): both processes keep working exactly as before, with one exception: a fork of a session held elsewhere whose transcript is still in the legacy location reads it in place instead of migrating it. `gjc session owners` lists the sessions held right now, and `gjc stats --summary` / `gjc stats --json` show the counts (`claim_taken`, `claim_conflict`, `held_at_exit`, and others) once processes exit cleanly. A claim that cannot lock fails open: on Windows, which has no native lock yet, every claim does (sessions open without a claim, `gjc session owners` stays empty, and each attempt counts `fail_open`), and a lock timeout, for example on a stalled network filesystem, skips that one claim. Writes after a fail-open claim are not counted as `session_write_without_claim`. To turn it off, run `gjc config set session.ownership.mode off`, which writes the global config; an unreadable config counts as `off` and is retried on the next open. `GJC_SESSION_OWNERSHIP=off` in your shell lowers the mode for processes started from that shell only: it cannot raise the mode, a project `.env` cannot set it, and hosts launched by the SDK broker (ACP, `gjc sdk`, daemon sessions) take the broker's environment, not your shell's, so use `config.yml` for them. Restart running gjc processes after changing the mode: a running TUI keeps claiming under the mode it started with, even on Linux, where it hot-reloads other settings. See `docs/session.md`.
|
|
40
|
+
- `gjc doctor` now warns about session owner sidecars only above 100,000 (was 10,000). Sidecar pruning is not implemented yet: one empty sidecar per session ever opened accumulates. They are harmless; do not delete them by hand while gjc runs.
|
|
41
|
+
|
|
42
|
+
- A session opened without its ownership claim (another process held it, or the lock timed out or failed) is claimed again when a turn starts, with backoff. Under `observe`, the re-attempt runs beside the turn, so a turn never waits on the lock. A terminal that opened a session while, for example, a session host held it becomes the session's owner at a prompt after that host exits, and `gjc session owners` then lists it. A re-attempt that finds the same outcome again is not counted again in the ownership counters.
|
|
43
|
+
- Under `enforce`, a held or failed claim is re-attempted at every turn. A turn on a session another process now holds is not started. The TUI shows the held-session warning with Fork and Cancel and puts the message back in the editor, and `-p` and the SDK get `SessionHeldError`. After that, other writes to the session from this process (a title, a rename, a compaction, an extension's or SDK append) are refused with `SessionHeldError` too, until a background re-attempt finds the holder gone. A claim that fails refuses the turn and other writes, as at open. A re-attempt that times out lets that turn run unclaimed, with a warning.
|
|
44
|
+
|
|
45
|
+
- With `session.ownership.mode: enforce`, an interactive session whose process holds the session alone now writes it directly. It no longer goes through the shared-publication path that exists for two terminals writing one session. After the first message, star, tree summary (branch with summary), Move Session and `/drop` work again; previously they were refused as "Shared session mutation requires transaction admission".
|
|
46
|
+
- `/drop` and Move Session refuse a session that another process changed after this process last wrote it, with "Another process changed this session's transcript". The other process could be one running with session ownership `off`, or an older gjc. The refusal comes before anything is switched, moved or deleted, and the transcript is kept.
|
|
47
|
+
|
|
48
|
+
### Removed
|
|
49
|
+
|
|
50
|
+
- Removed the optional macOS community app install offer from the installer and `gjc update`.
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
|
|
54
|
+
- `gjc acp` no longer fails at startup with "Unsupported under SDK-backed ACP: --continue" when `autoResume` is on and the working directory has a previous session with history. The ACP process now keeps only an in-memory session, so it never opens, or holds, the directory's newest session; ACP sessions still run in broker-launched hosts or attach to the process that owns them.
|
|
55
|
+
- `gjc acp --resume <session>` and `gjc acp --fork <session>` are rejected as unsupported before anything is opened or forked. Previously the session was opened, or the fork created, first, and then the launch failed.
|
|
56
|
+
|
|
57
|
+
- `gjc acp` sessions now append the user-level `~/.gjc/agent/APPEND_SYSTEM.md` to the system prompt, matching the CLI.
|
|
58
|
+
|
|
59
|
+
- `gjc auth-broker logout <provider>` now reports `FAILED` and exits with code 1 when the broker database cannot be written, instead of printing `Logged out of <provider>` while the credentials stay active. A missing provider argument is reported the same way.
|
|
60
|
+
- When invalidating GitHub Copilot credentials after an authentication failure cannot be written, the session logs a warning and finishes post-turn handling; the credential stays stored.
|
|
61
|
+
- Switching a provider from a stored API key to an environment variable now reports the refused disable when the credential store cannot write, instead of a later "kept N credentials" error.
|
|
62
|
+
|
|
63
|
+
- Under `session.ownership.mode: enforce`, the broker's `session.delete` (ACP `session/delete`, `gjc sdk`) no longer deletes a session another process holds without a live index row, such as a `gjc -p` run or an embedding. It refuses with `live_session`, the code a live row already gets, naming the holder, before any cleanup starts, and the holder keeps its transcript. A claim that cannot be checked refuses with `unavailable`. `observe` deletes as before.
|
|
64
|
+
- A `session.delete` refused before it changed anything (a live or held session, or `unavailable`) is no longer stored as a final result: a retry with the same idempotency key runs again, and a pending cleanup that was refused keeps its receipt and resumes under the same key.
|
|
65
|
+
|
|
66
|
+
- A broker `session.resume` (ACP `session/load`, Telegram `/session_resume`, `gjc sdk session raw global --op session.resume`) of a session another gjc process holds now waits for that process's SDK endpoint instead of launching a second session host.
|
|
67
|
+
- **When it applies:** an interactive TUI holds the session before its endpoint is published, while it starts and right after `/resume` switches to the session. Before, resume either refused (`endpoint_stale` for a TUI's startup row) or launched a host that became a second writer.
|
|
68
|
+
- **How long:** at most 2 seconds under `observe` and 8 seconds under `session.ownership.mode: enforce` (the default), and never longer than the request's readiness timeout. The wait counts from when the broker received the request, so resumes queued on one session don't add their waits up. If the endpoint appears in time, resume reuses it, as it already did for a TUI whose endpoint was live.
|
|
69
|
+
- **When no endpoint appears under `observe`:** resume never refuses and goes on as before ownership. Beside an embedding such as the desktop app, it launches a host, which counts the conflict. A TUI started with `GJC_SDK_DISABLE=1` gets the old `endpoint_stale` answer, with no launch.
|
|
70
|
+
- **When no endpoint appears under `enforce`:** resume refuses with `live_session`, a message naming the holder (`another terminal (pid N)`), and a `holder` field with its surface and pid. A launched host whose own claim is refused reports the same `live_session` outcome instead of `spawn_failed`.
|
|
71
|
+
- **Clients:** ACP adds `holder` to the error's `data` and no longer wraps this refusal as an MCP startup failure. `gjc sdk session` adds the `lifecycle_session_held` diagnostic when the broker names a holder. Telegram shows the message.
|
|
72
|
+
- **Unchanged:** a session nobody holds is launched as before, and `session.create` and `session.fork` don't change.
|
|
73
|
+
- **Changing the mode:** the broker rereads `session.ownership.mode` at the probe and at every poll, so `gjc config set session.ownership.mode off` (no wait) or `observe` (no refusal) reaches a running broker at once, even mid-wait. A raise reaches the broker only after a restart, but hosts it launches read the mode when they start.
|
|
74
|
+
- **Retrying:** a retry once the holder is ready needs a new request key, because the broker replays a finished request's answer for the same key.
|
|
75
|
+
|
|
76
|
+
- Browser headless launch no longer creates unhandled EBUSY rejections on Windows when puppeteer's temp profile cleanup fails. gjc now creates the userDataDir itself before launch and passes it to puppeteer, preventing puppeteer from attempting to remove it. If launch fails or Chrome exits, gjc cleans up the profile dir with EBUSY tolerance using the existing removeOwnedWarmupDir pattern.
|
|
77
|
+
|
|
78
|
+
- A message typed while auto-compaction runs before an idle prompt is now delivered after compaction ends. Before this fix it could stay forever as a `Steer:` chip. Session event subscribers inherited the admission context of the prompt that triggered compaction, so the replay was refused as same-session reentrancy whenever that prompt was still in preflight. The message was put back in the compaction queue and never retried.
|
|
79
|
+
|
|
80
|
+
- Compiled `gjc` binaries no longer hard-code `NODE_ENV=development`; release builds now skip development/test-only session snapshot freezing, context cloning, and dev diagnostics, and honor the runtime `NODE_ENV` for `.env` layer selection.
|
|
81
|
+
|
|
82
|
+
- Completing a goal no longer logs `[Unhandled Rejection] Error: Active tool selection was superseded before it could be applied` when the turn-end handler and the next input prompt both start the completed-goal exit. The later tool restore superseded the earlier one; both callers now share a single exit.
|
|
83
|
+
|
|
84
|
+
- Managed session inventory (resume picker, `--continue`, session lists and SDK candidate listing) now skips dot-prefixed `.jsonl` files, as explicit session directories already did, so the hidden staging copy that memory-guard checkpoint restore writes (`.<session-id>.memory-guard.<uuid>.jsonl`) is never listed or resumed in place of the original session.
|
|
85
|
+
|
|
86
|
+
- Language servers no longer keep every document a session ever touched open. Before gjc opens another document it sends `didClose` for documents no gjc operation has used for 5 minutes, and a document whose file was deleted is closed when it is next refreshed. tsserver then unloads the projects of packages the session stopped working in; working across six packages of this repository ended at 2684 MB instead of 3341 MB.
|
|
87
|
+
|
|
88
|
+
- Stopping a language server now follows the LSP shutdown sequence: after the `shutdown` response gjc sends the `exit` notification and lets the server terminate itself, and only signals its process group if it is still running after the 5-second deadline. Previously the server was always killed with SIGTERM right after `shutdown`.
|
|
89
|
+
|
|
90
|
+
- A persistent `monitor` whose command exits cleanly after printing at least one line reports the exit in one monitor notification ("exited (code 0)") instead of also waking the agent with a background-job completion notice. The exit rides on the final line when that line is still undelivered; otherwise it is added to the next turn without waking the agent. The old completion notice arrived after the final answer and produced an extra "already handled" reply (#7993). Failures, timeouts, monitors that printed nothing, monitors whose line notification the session rejected, and ACP clients that defer agent-initiated turns still get the completion notice.
|
|
91
|
+
- A shared session custom message (such as a monitor exit report or a TTSR reminder) whose transcript append was refused because the transcript was relocated before the write is now written again to the relocated transcript instead of failing, as long as the session identity is unchanged.
|
|
92
|
+
|
|
93
|
+
- Under `session.ownership.mode: enforce`, starring, unstarring or deleting a session in the `--resume` picker or the TUI's `/resume` picker no longer rewrites or removes a transcript another gjc process has open. The picker shows `Can't star this session: it is open in another terminal (pid N).` (or `delete`), and the holder keeps working on an intact transcript. `SessionManager.dropSession` and `SessionManager.deleteManagedCandidate` refuse the same way.
|
|
94
|
+
- Each write claims the session only while it runs, then releases it. A session the same process already holds, such as the current one, is never refused.
|
|
95
|
+
- Under `observe`, these writes go ahead as before, and the conflict is logged and counted as `claim_conflict`. `off` makes no lock call.
|
|
96
|
+
|
|
97
|
+
- Under `session.ownership.mode: enforce`, `gjc --resume`, the session picker and `/resume` now offer Continue here when a remote client's resume reached the broker first and the launched session host has claimed the session but not yet published its endpoint. This happens, for example, when Gajae Mobile opens `gjc --resume <id>` in a new tmux window and sends `session/load` at the same time. Before, the warning offered only Fork and Cancel.
|
|
98
|
+
- **The wait:** the warning waits up to 8 seconds for that host to publish, and says "Waiting for the session host…" meanwhile: a line before the warning at launch, in the picker under the list, and in the status line for `/resume`. It shows as soon as the host publishes an endpoint.
|
|
99
|
+
- **Cancelling:** Escape or Ctrl+C in the picker, and quitting during `/resume`, stop the wait.
|
|
100
|
+
- **When the host lets go first:** a session nobody holds any more opens as an unheld one would. A session another process took meanwhile gets the warning for that process.
|
|
101
|
+
- **Unchanged:** a session held by a terminal, the app or an embedding shows the warning at once.
|
|
102
|
+
|
|
103
|
+
- An ACP prompt sent after its session host closed between turns, before the Router attached the session's new owner, failed with "SDK session attachment is stale." or was abandoned as "host closed (replaced)". It now re-attaches the session through the broker and runs there. If the new owner is not ready yet (a terminal still starting), that one prompt fails as before and the session stays loaded; the next prompt or attachment recovers it without `session/load`. If the saved session is gone, the session reports `session_closed` with the advice to load it again with `session/load`. Temporary sessions keep their own recovery.
|
|
104
|
+
- When an idle ACP session's endpoint moved to another process (a terminal that took it over), ACP kept the old host's lifecycle ownership and providers: `session/close` then tried to close the terminal's session. ACP now re-attaches such a session through the broker, so it learns the new host's provenance.
|
|
105
|
+
- Under `enforce`, a broker `session.resume` arriving while a terminal takes a session over (its generation-0 row live, the claim not yet taken) refused at once. It now waits for the terminal's endpoint, as it does for a held claim.
|
|
106
|
+
|
|
107
|
+
- One session ownership lock timeout (for example on a stalled network filesystem) no longer turns claims off for the rest of the process. It skips that one claim, and the next claim tries again. Before, a terminal or session host whose claim timed out once kept writing its session unclaimed for its whole life, so other processes could not see it as the session's writer.
|
|
108
|
+
|
|
109
|
+
- Starring the current session from the session picker no longer adopts transcript entries that another process appended after this process last wrote them. Previously, the next full rewrite (such as a compaction or a pruning pass) could then drop those entries. The star is now refused with "Another process changed this session's transcript", and the transcript is left unchanged.
|
|
110
|
+
- A full transcript rewrite no longer adopts an append that another process made right after the rewrite landed. Previously, the next rewrite could drop that append. The session now stops saving with the same refusal and keeps the other process's entries.
|
|
111
|
+
|
|
112
|
+
- Every history transition (`/new`, `/resume`, `/fork`, branching, handoff, and tree navigation) now saves `!`/`$` command results from the previous turn to the session they were typed in, exactly once, before it switches. Before, a result still being saved through the shared session lease when the switch started could land in the new transcript and the new conversation context, or be lost. A result still waiting to be saved was appended to the next session by `/new`'s first prompt, and dropped without a notice by `/resume`. A result whose own save was already refused keeps its "Could not save" notice and is dropped without a retry. Results queued behind an earlier refusal are still attempted once. While another writer keeps holding the session lease, saving them adds at most one lock-wait budget (about 5 s) per kind of result (`!` and `$`). Results of a kind whose save was refused during the switch are not attempted again. Any result a switch cannot save shows a "Could not save" notice; none is dropped without one.
|
|
113
|
+
|
|
114
|
+
- An SDK turn that hits an interrupting TTSR rule (for example `interruptMode: "tool-only"`) now settles with the resumed run's outcome. Before this fix it was reported as `cancelled` with no receipt, even though the agent kept working and finished normally. The TTSR resume now continues the SDK prompt the same way overflow retry and auto-retry do: it holds the interrupted terminal and inherits the run's SDK owner. A resume that never runs still publishes the original cancelled terminal ([#8094](https://github.com/Yeachan-Heo/gajae-code/issues/8094)).
|
|
115
|
+
|
|
116
|
+
- gjc now fails with a clear operator error instead of a raw stack trace when the home directory or config directory is not writable during startup. The error message names the GJC_CONFIG_DIR environment variable as an override option.
|
|
117
|
+
|
|
118
|
+
- A background job result that arrives while the agent is working is now added to the running turn at its next tool step, instead of waiting until the turn is about to end. Previously the result was held until the final answer and then forced an extra iteration, which showed up as a separate trailing reply after the turn looked finished (#7993). Owned completions of a terminal-aborted turn and folded job receipts keep the previous end-of-turn and idle delivery, and an aborted, folding, or transitioning turn never receives a result at a tool step.
|
|
119
|
+
|
|
120
|
+
## [0.22.2] - 2026-11-25
|
|
121
|
+
|
|
122
|
+
### Added
|
|
123
|
+
|
|
124
|
+
- Each ChatGPT workspace of one OpenAI Codex login is stored as its own account, labeled `email (workspace name)`, and can be chosen with `org:<workspace id or name>` in `--credential`, `/credential`, `gjc accounts pin`, and `gjc accounts prefer openai-codex`, so the workspaces can be ordered with quota fallback (for example `gjc accounts prefer openai-codex 'org:Acme Team' org:Personal`). A row whose name lookup failed is chosen by `org:<workspace-id>`. Importing a Codex CLI `auth.json` is also scoped to its workspace.
|
|
125
|
+
|
|
126
|
+
- `gjc session owners` lists which processes hold sessions open for writing: claims held by this process or the gjc it runs under, every other held session with its surface, pid and how long it has been held, and the owners directory's sidecar count and size on disk. `--json` gives the same report as JSON. It only reads: it never takes, breaks or rewrites a lock or record, and creates nothing on a machine where no session was ever claimed. Session ownership is still off by default, so the list stays empty until it is turned on.
|
|
127
|
+
- `gjc doctor` checks session ownership: it warns when a held session's record names a process that no longer exists, and when the owners directory holds more than 10,000 sidecars.
|
|
128
|
+
|
|
129
|
+
- With session ownership turned on (`session.ownership.mode` set to `observe` or `enforce`), each gjc process adds its ownership counts to the local stats database when it exits: claims taken, released and refused, fail-open claims, locks still held at exit, writes without a claim, and the claim-set signals. `gjc stats --summary` and `gjc stats --json` show the all-time totals, the dates they span, and the same per gjc version with the number of processes that reported. `gjc stats` now also waits for a moment when another gjc process is writing the stats database, instead of failing with "database is locked". The counts stay on this machine. With the default `off`, nothing is counted or written, and `gjc stats` output is unchanged.
|
|
130
|
+
|
|
131
|
+
### Changed
|
|
132
|
+
|
|
133
|
+
- The release validation step in the GitHub Actions release workflow now outputs diagnostic information when git fetch fails, so issues with tag provenance validation are visible instead of failing silently.
|
|
134
|
+
|
|
135
|
+
### Fixed
|
|
136
|
+
|
|
137
|
+
- `gjc --export` can export transcripts larger than 128 MiB again, up to the 2 GiB session-memory limit, without writing anything to the source (not on Windows, which still refuses transcripts above 128 MiB). Their session-memory sidecars are built in a private cache directory under the agent dir, which is removed when the export finishes, fails or is interrupted. Before, export built these sidecars in the session's artifact directory (in the managed store for default-store sessions) and left them there, so only the first export succeeded. Export reflects the transcript as it was when the export started: lines appended during the export are left out, and a transcript replaced or truncated mid-export is refused. A failed export of one of these transcripts leaves any existing output file in place, because the page is written to a temp file and renamed over the output only when complete. As before, only linear, compacted transcripts without patch records can be exported at this size. Any other transcript is refused with an error that names the reason, and a session that was being written while the export read it gets a "retry when the session is idle" error.
|
|
138
|
+
|
|
139
|
+
- On macOS, a bash tool command (including a `monitor` job) that happened to start the shared SDK broker no longer SIGKILLs it when the command finishes or is cancelled. Before, the bash shell guardian tracked the detached broker as one of the command's descendants, so every session host bound to it died, either at once with `SIGHUP` or 10 minutes later through the broker-absence exit. The guardian now leaves alone a process whose pid and kernel incarnation match the published broker discovery. Its session hosts are left alone only when the broker's process lineage can be read at cleanup: if the lineage is unavailable, only the broker survives, and if the lookup fails or takes longer than one second, nothing is spared and cleanup kills everything as before. A reused pid, or a broker-shaped process that is not the published broker, is still killed. When the broker is spared, each remaining process is signalled on its own, right after its recorded incarnation is re-checked. Linux and Windows behavior is unchanged ([#7998](https://github.com/Yeachan-Heo/gajae-code/issues/7998)).
|
|
140
|
+
|
|
141
|
+
- An SDK session host no longer shuts itself down 10 minutes after the broker that launched it dies while a replacement broker is running. Brokers route through the agent directory's shared session index, so the replacement reaches the host, and any live broker publication now resets the host's broker-absence window. The host also no longer exits on broker absence while a turn is in flight: if the absence bound passes during the turn, the host exits within one poll after the turn ends. An idle host under a replacement broker is still bounded by the existing detached-idle windows ([#7998](https://github.com/Yeachan-Heo/gajae-code/issues/7998)).
|
|
142
|
+
|
|
143
|
+
- Fixed regression where `/resume` of a shared managed session with stale OpenAI Responses replay metadata would throw "Shared session mutation requires transaction admission" error. The admission check for replay metadata sanitization is now only performed when actually persisting patches (non-managed destinations), not during in-memory sanitization.
|
|
144
|
+
|
|
145
|
+
- Fixed `/resume` copying the transcripts it scans for header patches. The scan reads backward until it finds the header fields it needs, which for most transcripts means reading to the start of the file. It joined each 64 KiB chunk to the carried partial line and searched both the joined bytes and the raw chunk for the marker. It now searches the chunk and the partial line separately and joins them for parsing only when the marker text appears in them. Partial lines at chunk edges, including lines longer than a chunk, are still copied so they can be completed. Scanning 655 transcripts (1.29 GB) took about 1.9 s before and about 1.1 s after. Listing 772 sessions went from about 11.2 s to 10.5 s, and from about 6.6 s to 5.9 s with #7973 applied. The same header patches are found.
|
|
146
|
+
|
|
147
|
+
- A session that shuts down while its SDK host is still starting now sends `session_closed` once per release. Before, the shutdown, the abandoned startup and a deferred re-stop each ran the terminal release at the same time, so clients could get up to three `session_closed` frames. A retry after a failed release still publishes `session_closed` again.
|
|
148
|
+
|
|
149
|
+
- `/fork` works again in an interactive session after messages were sent, including after `--resume` and in sessions with OpenAI Responses or Codex replies. Since v0.21.0 it failed with "Shared session mutation requires transaction admission: prepare branched session" even with no other process open. The fork is built from the session's saved transcript and leaves the source session file untouched. A fork made this way records its source by session id; other fork paths are unchanged.
|
|
150
|
+
- When `/fork` still cannot run, it says why (for example, "another gjc process has written to this session" or "this session is too large to fork safely"). In the common case it refuses before it disconnects the agent, settles `/btw` or runs `session_before_branch` hooks. A save that starts in the short window after that check can still refuse later, as before. Sessions whose transcript has been moved to the session-memory sidecar (over 128 MiB, or `sessionMemory.mode: enabled`) still cannot fork from an interactive session; they refuse before any effect.
|
|
151
|
+
- `/move` and the `move_session` tool refuse before they start the directory transition when the session cannot be moved.
|
|
152
|
+
|
|
153
|
+
- A session holder record's `claimedAt` is shown only when it is a plain UTC timestamp, so a malformed record can no longer put arbitrary text into ownership output.
|
|
154
|
+
|
|
155
|
+
- When another process changes a session's transcript, the interactive TUI and startup prompts now show the session's operator message instead of the raw `managed_append_identity_mismatch` code, SDK clients get it instead of an opaque "Control operation failed.", and ACP errors carry it in `data.operatorMessage`. SDK and ACP machine codes, and ACP `details`, are unchanged.
|
|
156
|
+
- `/resume`, `/new` and `/fork` work again in a session whose transcript another process changed. Previously the predecessor flush rethrew the identity mismatch, so every way out of the session failed until the process was restarted.
|
|
157
|
+
- Once a session is known to be stuck because another process changed its transcript, it refuses new prompts, skills, hidden custom-message turns, `--continue`, steering and follow-ups up front, before admission, hooks, tools or model calls. Extension and custom slash commands that start no turn still run, so status commands and commands that open another session keep working; one that turns into a prompt is refused after its handler runs. The TUI `input` extension hook also still runs first. The message names the recovery: reopen with `/resume` (or `gjc --resume`), or fork with `/fork` (or `gjc --fork`). The first prompt after the other process writes is only refused at its first transcript write, after skill resolution, command dispatch and title invalidation but before any model call. A hidden custom-message turn used to resolve as if it had succeeded, leaving unsaved entries in memory.
|
|
158
|
+
- Quitting the TUI from a session whose transcript another process changed no longer crashes with an unhandled `managed_append_identity_mismatch` rejection.
|
|
159
|
+
- After any other transcript write failure, those turns are also refused up front with the original error, so a hidden custom-message turn no longer resolves with unsaved entries.
|
|
160
|
+
- `/compact` and `/handoff` on a session already known to be stuck are refused before any compaction hook or model call, and their failure text in the TUI and in headless/ACP slash commands shows the operator message.
|
|
161
|
+
- Keybinding actions that fail with a session refusal, such as the queue/follow-up shortcut on a stuck session, show the operator message instead of the raw code.
|
|
162
|
+
- A context clear on a stuck session is refused before it resets the conversation, and `/move` failures show the operator message.
|
|
163
|
+
- A resume rejected during startup, before anything ran in the session, keeps the accurate "this resume did not run" message.
|
|
164
|
+
- Turns started without a typed prompt on a stuck session are refused before the system prompt build, recall or `before_agent_start` hooks: the auto-continue prompt, hidden next-turn deliveries, `cancelAndSubmit`, and extension `sendMessage(…, { triggerTurn: true })`. The extension send now reports the failure instead of resolving as a success.
|
|
165
|
+
- Extension command failures on a stuck session show the operator message. An error that wraps a session refusal but reports its own failure (for example a failed rollback) keeps that failure in front of the operator message instead of hiding it.
|
|
166
|
+
- SDK and ACP error text only ever carries the fixed operator message. A wrapper's own failure message, which can include local paths, stays on local surfaces (TUI, print mode, CLI stderr).
|
|
167
|
+
- Extension `sendMessage` and `sendUserMessage` failures in the TUI show the operator message on a stuck session.
|
|
168
|
+
|
|
169
|
+
- A project file or runtime override that sets the parent of a protected setting to `null`, a scalar or an array (for example `plan: null` or `hindsight: null`) no longer resets the user's value for that setting. This covers global-only settings such as `plan.enabled` and `hindsight.apiUrl`, and, for project files, project-denied settings such as `task.agentModelOverrides`. `get`, `gjc config list` and the resolution snapshot now report the user value. Other keys under that parent are still replaced as before.
|
|
170
|
+
|
|
171
|
+
- Settings migrations now properly tolerate non-object values in legacy settings sections instead of throwing. When a project settings file contains a non-object value where a migration expects an object (e.g., `retry: "off"` instead of `retry: { ... }`), the malformed section is now skipped gracefully and other valid keys are preserved. (#8034)
|
|
172
|
+
- Settings layer loading failures are now logged with a warning instead of being silently swallowed, improving visibility into why project settings might be dropped. (#8034)
|
|
173
|
+
|
|
174
|
+
- Fixed shared root TUI sessions running an emergency compaction before every prompt once their transcript passed 48 MiB. Shared compaction only appends a summary and never rewrites the transcript, so this floor could not shrink the file there: each prompt paid for an extra summary call and added a compaction entry (about 190 KB on average in the reported session), which brought the session to the 128 MiB managed limit sooner (#8006). Shared sessions now ignore the transcript-size floor; the other emergency floors and the floor for non-shared sessions are unchanged.
|
|
175
|
+
|
|
176
|
+
- `gjc stats` counted two gjc processes that recorded session ownership counts in the same millisecond as one process report. Each process's counts now carry their own report id. Counts recorded before this fix are still read, and are counted by write time as before.
|
|
177
|
+
|
|
178
|
+
- `gjc update` now skips stable releases that don't have the binary asset for the current platform (e.g., when a release is published without all platform binaries yet), and falls back to the newest release that has the asset. Users see a clear message like "release v0.22.1 has no asset for gjc-linux-x64 yet" instead of a 404 download failure.
|
|
179
|
+
|
|
5
180
|
## [0.22.1] - 2026-11-24
|
|
6
181
|
|
|
7
182
|
### Added
|
|
@@ -4,3 +4,10 @@ export interface AppendSystemPromptCandidate {
|
|
|
4
4
|
}
|
|
5
5
|
/** First user file. A repository copy is untrusted project text and is never selected. */
|
|
6
6
|
export declare function selectAppendSystemPromptFile(candidates: readonly AppendSystemPromptCandidate[]): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Reads a discovered append file. Only regular files are read; a missing, unreadable, or
|
|
9
|
+
* non-regular path (FIFO, socket, directory) yields undefined, never the pathname itself.
|
|
10
|
+
*/
|
|
11
|
+
export declare function readAppendSystemPromptFile(filePath: string | undefined): Promise<string | undefined>;
|
|
12
|
+
/** User APPEND_SYSTEM.md only. Repository copies are not appended. */
|
|
13
|
+
export declare function discoverAppendSystemPromptFile(): Promise<string | undefined>;
|
|
@@ -8,7 +8,7 @@ export declare const PROBE_OUTPUT_LIMIT_BYTES: number;
|
|
|
8
8
|
* and transport framing.
|
|
9
9
|
*/
|
|
10
10
|
export declare const PROJECTION_RECEIPT_BUDGET_BYTES: number;
|
|
11
|
-
export type DoctorProbeKind = "native" | "projection";
|
|
11
|
+
export type DoctorProbeKind = "native" | "projection" | "session-owners";
|
|
12
12
|
export interface DoctorProbeReceipt {
|
|
13
13
|
readonly schemaVersion: 1;
|
|
14
14
|
readonly kind: DoctorProbeKind;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DoctorProbeReceipt } from "./probe-types";
|
|
2
|
+
/**
|
|
3
|
+
* Held sidecars whose record names a process that no longer exists: impossible under a kernel lock,
|
|
4
|
+
* so a bug signal. A suspect is flagged only if a second look, at the suspects alone, finds its lock
|
|
5
|
+
* still held and the same dead pid still named. The sidecar count is the collector's, from `readdir`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function collectSessionOwnersProbe(recheckMs?: number): Promise<DoctorProbeReceipt>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type SessionOwnerEntryCounts } from "../../session/session-owners-layout";
|
|
2
|
+
import { type DoctorCollector } from "./checks";
|
|
3
|
+
import { type DoctorProbeResult } from "./probe-client";
|
|
4
|
+
import type { DoctorCheck } from "./types";
|
|
5
|
+
/**
|
|
6
|
+
* Above this many sidecars the doctor warns. Sidecar pruning is not implemented yet, so one empty
|
|
7
|
+
* `.session-owner` file per session ever opened accumulates; they are harmless, and must not be
|
|
8
|
+
* deleted by hand while gjc runs (a deleted sidecar lets a second process lock a new one). 100,000
|
|
9
|
+
* is years of heavy use (about 50 sessions a day for five years), so the warning means an outlier
|
|
10
|
+
* worth reporting, not ordinary use; 10,000 fired within a year for heavy users.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SESSION_OWNER_SIDECAR_LIMIT = 100000;
|
|
13
|
+
/** Both checks for a present owners directory; exported for tests of the probe-failure paths. */
|
|
14
|
+
export declare function sessionOwnersChecks(targetId: string, counts: SessionOwnerEntryCounts | {
|
|
15
|
+
readonly errno?: string;
|
|
16
|
+
}, probe: DoctorProbeResult): DoctorCheck[];
|
|
17
|
+
/**
|
|
18
|
+
* Session ownership (design §2.9). A home with no owners directory has nothing to check, so no
|
|
19
|
+
* probe runs. Otherwise the sidecar count comes from `readdir` here, and a probe child does the
|
|
20
|
+
* lock work, as native code may fail to load.
|
|
21
|
+
*/
|
|
22
|
+
export declare const SESSION_COLLECTOR: DoctorCollector;
|
|
@@ -25,6 +25,10 @@ export interface GithubReleaseLookupOptions {
|
|
|
25
25
|
webOrigin?: string;
|
|
26
26
|
timeoutMs?: number;
|
|
27
27
|
useAmbientToken?: boolean;
|
|
28
|
+
/** Skip releases that don't have this binary asset. */
|
|
29
|
+
requiredBinaryAsset?: string;
|
|
30
|
+
/** Callback to log when a release is skipped due to missing asset. */
|
|
31
|
+
onSkippedRelease?: (tag: string, version: string) => void;
|
|
28
32
|
}
|
|
29
33
|
/** A GitHub REST response that failed, carrying the status the caller must branch on. */
|
|
30
34
|
export declare class GithubApiStatusError extends Error {
|
|
@@ -34,7 +38,18 @@ export declare class GithubApiStatusError extends Error {
|
|
|
34
38
|
/** 403/429 is how api.github.com reports an exhausted unauthenticated budget. */
|
|
35
39
|
get isRateLimited(): boolean;
|
|
36
40
|
}
|
|
41
|
+
interface GithubReleaseJson {
|
|
42
|
+
tag_name?: unknown;
|
|
43
|
+
draft?: unknown;
|
|
44
|
+
prerelease?: unknown;
|
|
45
|
+
html_url?: unknown;
|
|
46
|
+
assets?: unknown[];
|
|
47
|
+
}
|
|
37
48
|
export declare function isSafeReleaseTag(tag: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Check if a release has a binary asset matching the given name.
|
|
51
|
+
*/
|
|
52
|
+
export declare function releaseHasBinaryAsset(release: GithubReleaseJson, assetName: string): boolean;
|
|
38
53
|
export declare function versionFromTag(tag: string): string;
|
|
39
54
|
export declare function githubReleaseHeaders(token: string | undefined): Record<string, string>;
|
|
40
55
|
/**
|
|
@@ -62,3 +77,4 @@ export declare function verifyDownloadedBinaryChecksum(options: {
|
|
|
62
77
|
lookupEnv?: (name: string) => string | undefined;
|
|
63
78
|
downloadOrigin?: string;
|
|
64
79
|
}): Promise<"verified">;
|
|
80
|
+
export {};
|
|
@@ -97,6 +97,7 @@ export declare const PUBLIC_COMMAND_DIAGNOSTICS: {
|
|
|
97
97
|
readonly lifecycle_idempotency_conflict: "The broker reported an idempotency conflict. Reconcile existing lifecycle state before deciding whether another request is safe.";
|
|
98
98
|
readonly lifecycle_legacy_history_ambiguous: "The broker refused admission because legacy lifecycle history cannot prove this target is unrelated. This request was not dispatched; this refusal does not settle earlier effects. Preserve the ledger and original operation, request key, and target. For a prior session.create, use read-only session.lookup with its original key and create target; not_found is not proof of no effect. An empty transcript, stopped host, or fresh key does not resolve this fence. Do not edit the ledger, force deletion, or retry with another key; missing identity or terminal effect evidence requires operator investigation.";
|
|
99
99
|
readonly lifecycle_input_refused: "The broker refused the request as invalid input. Correct the request payload and reconcile existing lifecycle state before deciding whether another request is safe.";
|
|
100
|
+
readonly lifecycle_session_held: "Another gjc process holds this session for writing and has not published an SDK endpoint to attach to, so no session host was launched. Try again with a new idempotency key once that process is ready (the same key replays this answer), or fork the session.";
|
|
100
101
|
readonly broker_cleanup_unverified: "SDK broker startup failed and cleanup of the spawned broker could not be verified; it may still be running.";
|
|
101
102
|
readonly lock_refused: "SDK broker startup refused an existing broker lock held by a live, foreign-host or host-unqualified owner. The lock is never displaced automatically.";
|
|
102
103
|
readonly usage_transport_exclusive: "Specify exactly one of --stdio or --socket <path>.";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type SessionOwnerSidecar, type SessionOwnersInventory } from "../session/session-ownership";
|
|
2
|
+
export interface SessionOwnerRow extends SessionOwnerSidecar {
|
|
3
|
+
/** Held by this process or one of its ancestors (a gjc whose shell ran this command). */
|
|
4
|
+
readonly processTree: boolean;
|
|
5
|
+
readonly ageMs?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface SessionOwnersReport extends Omit<SessionOwnersInventory, "held"> {
|
|
8
|
+
readonly owners: readonly SessionOwnerRow[];
|
|
9
|
+
}
|
|
10
|
+
export declare function collectSessionOwnersReport(now?: number): Promise<SessionOwnersReport>;
|
|
11
|
+
export declare function renderSessionOwnersText(report: SessionOwnersReport): string[];
|
|
12
|
+
/** `gjc session owners [--json]`. A refused or unreadable directory exits 1 with its code. */
|
|
13
|
+
export declare function runSessionOwnersCommand(json: boolean): Promise<void>;
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type HeldSessionChoice, type HeldSessionWarningOptions } from "../modes/components/session-held-warning";
|
|
2
|
+
import { type HeldSessionCheck, type SessionSelectionResult } from "../modes/components/session-selector";
|
|
2
3
|
import { type SessionInfo } from "../session/session-manager";
|
|
4
|
+
import type { SessionHeldError } from "../session/session-ownership";
|
|
3
5
|
export declare function deleteSessionPickerCandidate(sessionPath: string, explicitSessionDir?: string): Promise<void>;
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* The held-session warning before the TUI starts (design §3.1), as a one-shot TUI like the picker:
|
|
8
|
+
* resolves once Fork, Continue here or Cancel is chosen and the terminal is handed back.
|
|
9
|
+
*/
|
|
10
|
+
export declare function promptHeldSession(error: SessionHeldError, options?: HeldSessionWarningOptions): Promise<HeldSessionChoice>;
|
|
11
|
+
/**
|
|
12
|
+
* Show the session picker and return the user's resume consent intent. Under enforce, `held` marks
|
|
13
|
+
* the rows other processes hold and choosing one shows the held-session warning (design §1 row 2).
|
|
14
|
+
*/
|
|
15
|
+
export declare function selectSession(sessions: SessionInfo[], explicitSessionDir?: string, held?: {
|
|
16
|
+
readonly sessions: ReadonlyMap<string, SessionHeldError>;
|
|
17
|
+
readonly check: HeldSessionCheck;
|
|
18
|
+
}): Promise<SessionSelectionResult>;
|
|
@@ -11,7 +11,6 @@ import { type NotificationProvider } from "../sdk/bus/config";
|
|
|
11
11
|
import type { TelemetryDetails, TelemetryEventName } from "../telemetry";
|
|
12
12
|
import { type GithubReleaseLookupOptions } from "./github-release";
|
|
13
13
|
import { type DirectoryIdentity, type FileIdentity, InstallationAclPresentError, type ReconcileResult } from "./install-activation";
|
|
14
|
-
import { offerMacosCommunityApp } from "./macos-community-app";
|
|
15
14
|
export interface UpdateCommandOptions {
|
|
16
15
|
force: boolean;
|
|
17
16
|
check: boolean;
|
|
@@ -113,6 +112,8 @@ export declare function defaultUserBinaryPathForTest(platform?: NodeJS.Platform,
|
|
|
113
112
|
/** Lookup options for the GitHub release check. */
|
|
114
113
|
export interface LatestReleaseLookupOptions extends GithubReleaseLookupOptions {
|
|
115
114
|
channel?: UpdateChannel;
|
|
115
|
+
/** When true for stable releases, checks that the release has the binary asset for the current platform. */
|
|
116
|
+
forBinaryUpdate?: boolean;
|
|
116
117
|
}
|
|
117
118
|
export declare function getLatestReleaseForTest(options: LatestReleaseLookupOptions): Promise<ReleaseInfo>;
|
|
118
119
|
export declare function compareVersionsForTest(a: string, b: string): number;
|
|
@@ -221,7 +222,6 @@ export interface UpdateCommandDependencies {
|
|
|
221
222
|
recoverNotifications?: (settings: Settings) => Promise<void>;
|
|
222
223
|
runPostUpdateRecovery?: (runtimePath: string) => Promise<void>;
|
|
223
224
|
platform?: NodeJS.Platform;
|
|
224
|
-
offerMacosCommunityApp?: typeof offerMacosCommunityApp;
|
|
225
225
|
recordTelemetryEvent?: (event: TelemetryEventName, details: TelemetryDetails) => unknown;
|
|
226
226
|
exit?: (code: number) => never;
|
|
227
227
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* bash-shell worker protocol) plus the unchanged ordinary routing order:
|
|
5
5
|
* bash-shell workers -> darwin malloc re-exec -> internal smoke -> tmux owner
|
|
6
6
|
* isolation -> managed-owner supervisor/admission/recovery -> broker hop ->
|
|
7
|
-
* private sdk stderr drainer -> public family dispatch ->
|
|
7
|
+
* private sdk stderr drainer -> public family dispatch -> doctor worker /
|
|
8
8
|
* probe / cli -> full registry. `cli.ts` imports it lazily, only after argv has
|
|
9
9
|
* been proven not to be a `sdk diagnostics` observation. */
|
|
10
10
|
import { commands } from "./cli-commands";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command } from "@gajae-code/utils/cli";
|
|
2
2
|
import { type ProjectEnvSnapshot } from "@gajae-code/utils/env-file";
|
|
3
|
+
import { discoverAppendSystemPromptFile } from "../cli/append-system-prompt";
|
|
3
4
|
import type { Args as ParsedArgs } from "../cli/args";
|
|
4
5
|
import { applyStartupModelProfiles } from "../main";
|
|
5
6
|
import { initializeExtensions } from "../modes/runtime-init";
|
|
@@ -12,31 +13,40 @@ export declare function lifecycleArgs(request: SessionLifecycleLaunchRequest, cw
|
|
|
12
13
|
* How long a session host tolerates losing the broker it was launched under
|
|
13
14
|
* before treating itself as orphaned.
|
|
14
15
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* a restart-shaped gap, because a broker that is merely slow to
|
|
20
|
-
* never cost a live host
|
|
21
|
-
*
|
|
16
|
+
* Brokers route through the agent directory's session index and the host's
|
|
17
|
+
* endpoint file, not through per-broker state, so a replacement broker for the
|
|
18
|
+
* same agent directory reaches a host its predecessor launched. The window
|
|
19
|
+
* therefore only runs while no live broker is published at all. It still has to
|
|
20
|
+
* outlast a restart-shaped gap, because a broker that is merely slow to
|
|
21
|
+
* republish must never cost a live host, but it must stay finite for an idle
|
|
22
|
+
* host, or every broker that is gone for good leaks a detached
|
|
23
|
+
* multi-hundred-megabyte host. A host holding its session-work lease is the one
|
|
24
|
+
* exception: it never exits on broker absence, so a turn that never settles keeps
|
|
25
|
+
* the host alive until it is closed or signalled.
|
|
22
26
|
*/
|
|
23
27
|
export declare const SESSION_HOST_BROKER_ABSENCE_GRACE_MS: number;
|
|
24
28
|
/**
|
|
25
|
-
* Resolves only once
|
|
26
|
-
*
|
|
29
|
+
* Resolves only once no live broker has been published for the agent directory
|
|
30
|
+
* for the full grace window, and the host is not doing session work.
|
|
27
31
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* so it accrues against the bound instead of resetting it. Only the pinned
|
|
32
|
-
* broker reappearing resets the window. An unreadable or unidentifiable
|
|
32
|
+
* Any identifiable publication resets the window, including one from a
|
|
33
|
+
* replacement incarnation: the replacement routes through the shared session
|
|
34
|
+
* index, so it can still reach this host. An unreadable or unidentifiable
|
|
33
35
|
* publication is not proof of orphanhood but accrues against the same bound.
|
|
36
|
+
*
|
|
37
|
+
* `readWorkLease` reports whether the host's session-work lease is held. It
|
|
38
|
+
* defaults to the lease the host's SDK runtime publishes (the AgentSession's
|
|
39
|
+
* `sessionWorkLease`, registered by the notifications bus at host startup). A
|
|
40
|
+
* turn in flight is never cut short by broker absence: the window keeps
|
|
41
|
+
* accruing, but the host only exits once the lease is released. If the bound was
|
|
42
|
+
* crossed during the turn, the host exits on the first poll after the turn ends.
|
|
34
43
|
*/
|
|
35
44
|
export declare function watchSessionHostBrokerLiveness(deps: {
|
|
36
45
|
agentDir: string;
|
|
37
46
|
now?: () => number;
|
|
38
47
|
sleep?: (ms: number) => Promise<void>;
|
|
39
48
|
readDiscovery?: (agentDir: string) => Promise<unknown>;
|
|
49
|
+
readWorkLease?: () => boolean;
|
|
40
50
|
graceMs?: number;
|
|
41
51
|
pollMs?: number;
|
|
42
52
|
}): Promise<void>;
|
|
@@ -134,6 +144,7 @@ export declare function runSessionHost(timing?: {
|
|
|
134
144
|
initializeLifecycleExtensions?: typeof initializeExtensions;
|
|
135
145
|
openLifecycleSessionManager?: typeof openLifecycleSessionManager;
|
|
136
146
|
createLifecycleAgentSession?: typeof createLifecycleAgentSession;
|
|
147
|
+
discoverAppendSystemPromptFile?: typeof discoverAppendSystemPromptFile;
|
|
137
148
|
writeSessionLifecycleReady?: typeof writeSessionLifecycleReady;
|
|
138
149
|
writeSessionLifecycleStartupCommit?: typeof writeSessionLifecycleStartupCommit;
|
|
139
150
|
writeMcpConfig?: (filePath: string, contents: string) => Promise<number>;
|
|
@@ -13,6 +13,17 @@ export interface MachineIdentityDeps {
|
|
|
13
13
|
export declare function parseWindowsMachineGuid(output: string): string | undefined;
|
|
14
14
|
/** @internal */
|
|
15
15
|
export declare function parseMacPlatformUuid(output: string): string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Configuration directory creation failed. Thrown when the config root directory
|
|
18
|
+
* (usually ~/.gjc) cannot be created due to filesystem permissions or other issues.
|
|
19
|
+
* The error includes an operator message explaining the failure and suggesting fixes.
|
|
20
|
+
*/
|
|
21
|
+
export declare class ConfigDirectoryError extends Error {
|
|
22
|
+
readonly code = "config_directory_io";
|
|
23
|
+
readonly errno: string | undefined;
|
|
24
|
+
readonly operatorMessage: string;
|
|
25
|
+
constructor(directory: string, errno: string | undefined, originalError: unknown);
|
|
26
|
+
}
|
|
16
27
|
/** Loads a verified machine-local identity without persisting the underlying machine ID. */
|
|
17
28
|
export declare function loadInstallationHostId(deps?: MachineIdentityDeps): Promise<string>;
|
|
18
29
|
/** @internal Recognizes owner records written before installation-keyed identities. */
|
|
@@ -672,6 +672,15 @@ export declare class ModelRegistry {
|
|
|
672
672
|
preferredCredentialSelector?: AuthCredentialSelector;
|
|
673
673
|
signal?: AbortSignal;
|
|
674
674
|
}): Promise<string | undefined>;
|
|
675
|
+
/** Get a provider API key together with the stored row that resolved it, when any. */
|
|
676
|
+
getApiKeyForProviderWithCredentialRowId(provider: string, sessionId?: string, baseUrl?: string, options?: {
|
|
677
|
+
credentialSelector?: AuthCredentialSelector;
|
|
678
|
+
preferredCredentialSelector?: AuthCredentialSelector;
|
|
679
|
+
signal?: AbortSignal;
|
|
680
|
+
}): Promise<{
|
|
681
|
+
apiKey: string | undefined;
|
|
682
|
+
credentialRowId: number | undefined;
|
|
683
|
+
}>;
|
|
675
684
|
/** Check credential availability without resolving keys or refreshing OAuth tokens. */
|
|
676
685
|
hasUsableAuthForProvider(provider: string, sessionId?: string): boolean;
|
|
677
686
|
/** @internal Whether this registry is an unpublished staged reload candidate. */
|