@gajae-code/coding-agent 0.22.2 → 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 +115 -0
- package/dist/types/cli/append-system-prompt.d.ts +7 -0
- package/dist/types/cli/doctor/session-owners.d.ts +8 -2
- package/dist/types/cli/public-command-errors.d.ts +1 -0
- package/dist/types/cli/session-picker.d.ts +16 -3
- package/dist/types/cli/update-cli.d.ts +0 -2
- package/dist/types/cli-ordinary.d.ts +1 -1
- package/dist/types/commands/sdk.d.ts +2 -0
- 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 +84 -4
- 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/host/control/dispatch.d.ts +3 -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/managed-session-storage.d.ts +1 -1
- package/dist/types/session/internal/session-claim-set.d.ts +168 -13
- package/dist/types/session/session-handover.d.ts +62 -0
- package/dist/types/session/session-manager.d.ts +75 -15
- package/dist/types/session/session-owner-holder.d.ts +77 -0
- package/dist/types/session/session-ownership-mode.d.ts +45 -2
- package/dist/types/session/session-ownership.d.ts +25 -29
- package/dist/types/session/yield-queue.d.ts +13 -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 +9 -7
- package/scripts/compile-args.ts +6 -3
- package/scripts/run-acp-conformance.ts +36 -10
- package/scripts/verify-gjc-sdk-canonicalization.ts +2 -0
- package/src/cli/append-system-prompt.ts +34 -0
- package/src/cli/auth-broker-cli.ts +5 -1
- package/src/cli/doctor/session-owners.ts +8 -2
- package/src/cli/public-command-errors.ts +4 -0
- package/src/cli/session-picker.ts +57 -7
- package/src/cli/update-cli.ts +0 -22
- package/src/cli-ordinary.ts +2 -17
- package/src/commands/sdk.ts +37 -15
- package/src/config/machine-identity.ts +31 -2
- package/src/config/model-registry.ts +40 -6
- package/src/config/settings-schema.ts +50 -6
- package/src/config/settings.ts +65 -3
- package/src/gjc-runtime/launch-tmux.ts +4 -1
- package/src/internal-urls/docs-index.generated.ts +12 -12
- 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 +364 -93
- package/src/modes/DESIGN.md +36 -0
- package/src/modes/acp/acp-agent.ts +215 -31
- package/src/modes/components/session-held-warning.ts +62 -0
- package/src/modes/components/session-selector.ts +234 -11
- package/src/modes/controllers/goal-mode-controller.ts +14 -2
- package/src/modes/controllers/selector-controller.ts +192 -3
- package/src/modes/interactive-mode.ts +40 -2
- 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 +1 -0
- package/src/sdk/bus/lifecycle-commands.ts +4 -0
- package/src/sdk/cli/session-cli.ts +8 -0
- package/src/sdk/host/control/dispatch.ts +18 -0
- package/src/sdk/host/host.ts +5 -0
- 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/scope.ts +2 -1
- package/src/sdk/session.ts +60 -7
- package/src/sdk/startup-capability.ts +27 -2
- package/src/session/agent-session.ts +411 -58
- package/src/session/internal/managed-session-storage.ts +16 -2
- package/src/session/internal/session-claim-set.ts +527 -49
- package/src/session/session-handover.ts +283 -0
- package/src/session/session-manager.ts +907 -148
- package/src/session/session-owner-holder.ts +177 -0
- package/src/session/session-ownership-mode.ts +84 -12
- package/src/session/session-ownership.ts +115 -89
- package/src/session/yield-queue.ts +43 -0
- package/src/session-import/provider-service.ts +8 -0
- package/src/setup/provider-onboarding.ts +5 -5
- 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,121 @@
|
|
|
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
|
+
|
|
5
120
|
## [0.22.2] - 2026-11-25
|
|
6
121
|
|
|
7
122
|
### 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>;
|
|
@@ -2,8 +2,14 @@ import { type SessionOwnerEntryCounts } from "../../session/session-owners-layou
|
|
|
2
2
|
import { type DoctorCollector } from "./checks";
|
|
3
3
|
import { type DoctorProbeResult } from "./probe-client";
|
|
4
4
|
import type { DoctorCheck } from "./types";
|
|
5
|
-
/**
|
|
6
|
-
|
|
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;
|
|
7
13
|
/** Both checks for a present owners directory; exported for tests of the probe-failure paths. */
|
|
8
14
|
export declare function sessionOwnersChecks(targetId: string, counts: SessionOwnerEntryCounts | {
|
|
9
15
|
readonly errno?: string;
|
|
@@ -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>.";
|
|
@@ -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;
|
|
@@ -223,7 +222,6 @@ export interface UpdateCommandDependencies {
|
|
|
223
222
|
recoverNotifications?: (settings: Settings) => Promise<void>;
|
|
224
223
|
runPostUpdateRecovery?: (runtimePath: string) => Promise<void>;
|
|
225
224
|
platform?: NodeJS.Platform;
|
|
226
|
-
offerMacosCommunityApp?: typeof offerMacosCommunityApp;
|
|
227
225
|
recordTelemetryEvent?: (event: TelemetryEventName, details: TelemetryDetails) => unknown;
|
|
228
226
|
exit?: (code: number) => never;
|
|
229
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";
|
|
@@ -143,6 +144,7 @@ export declare function runSessionHost(timing?: {
|
|
|
143
144
|
initializeLifecycleExtensions?: typeof initializeExtensions;
|
|
144
145
|
openLifecycleSessionManager?: typeof openLifecycleSessionManager;
|
|
145
146
|
createLifecycleAgentSession?: typeof createLifecycleAgentSession;
|
|
147
|
+
discoverAppendSystemPromptFile?: typeof discoverAppendSystemPromptFile;
|
|
146
148
|
writeSessionLifecycleReady?: typeof writeSessionLifecycleReady;
|
|
147
149
|
writeSessionLifecycleStartupCommit?: typeof writeSessionLifecycleStartupCommit;
|
|
148
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. */
|
|
@@ -226,8 +226,8 @@ export declare const SETTINGS_SCHEMA: {
|
|
|
226
226
|
readonly "session.ownership.mode": {
|
|
227
227
|
readonly type: "enum";
|
|
228
228
|
readonly values: readonly ["off", "observe", "enforce"];
|
|
229
|
-
readonly default: "
|
|
230
|
-
readonly description: "
|
|
229
|
+
readonly default: "enforce";
|
|
230
|
+
readonly description: "Single-owner session claims: off makes none, observe claims and counts conflicts without refusing anything, enforce (the default) refuses to open a session another process holds.";
|
|
231
231
|
};
|
|
232
232
|
readonly "workspaceTree.mode": {
|
|
233
233
|
readonly type: "enum";
|
|
@@ -1040,7 +1040,7 @@ export declare const SETTINGS_SCHEMA: {
|
|
|
1040
1040
|
readonly ui: {
|
|
1041
1041
|
readonly tab: "tools";
|
|
1042
1042
|
readonly label: "Artifact tail size (KB)";
|
|
1043
|
-
readonly description: "Amount of tail content kept inline when
|
|
1043
|
+
readonly description: "Amount of tail content kept inline when a tool result spills to an artifact. The Bash tool uses `tools.bashOutputTailBytes` instead.";
|
|
1044
1044
|
readonly options: readonly [{
|
|
1045
1045
|
readonly value: "1";
|
|
1046
1046
|
readonly label: "1 KB";
|
|
@@ -1082,7 +1082,7 @@ export declare const SETTINGS_SCHEMA: {
|
|
|
1082
1082
|
readonly ui: {
|
|
1083
1083
|
readonly tab: "tools";
|
|
1084
1084
|
readonly label: "Artifact head size (KB)";
|
|
1085
|
-
readonly description: "Amount of head content kept inline alongside the tail when
|
|
1085
|
+
readonly description: "Amount of head content kept inline alongside the tail when a tool result spills to an artifact (middle elision). 0 disables — keep tail only. The Bash tool uses `tools.bashOutputHeadBytes` instead.";
|
|
1086
1086
|
readonly options: readonly [{
|
|
1087
1087
|
readonly value: "0";
|
|
1088
1088
|
readonly label: "0 KB";
|
|
@@ -1122,6 +1122,86 @@ export declare const SETTINGS_SCHEMA: {
|
|
|
1122
1122
|
}];
|
|
1123
1123
|
};
|
|
1124
1124
|
};
|
|
1125
|
+
readonly "tools.bashOutputTailBytes": {
|
|
1126
|
+
readonly type: "number";
|
|
1127
|
+
readonly default: 1;
|
|
1128
|
+
readonly ui: {
|
|
1129
|
+
readonly tab: "tools";
|
|
1130
|
+
readonly label: "Bash output tail size (KB)";
|
|
1131
|
+
readonly description: "Tail window the Bash tool keeps inline from command output; the full stream is saved as an artifact when storage is available. Deliberately small so callers prefer focused commands and the search/find tools.";
|
|
1132
|
+
readonly options: readonly [{
|
|
1133
|
+
readonly value: "1";
|
|
1134
|
+
readonly label: "1 KB";
|
|
1135
|
+
readonly description: "Default; ~250 tokens";
|
|
1136
|
+
}, {
|
|
1137
|
+
readonly value: "2.5";
|
|
1138
|
+
readonly label: "2.5 KB";
|
|
1139
|
+
readonly description: "~625 tokens";
|
|
1140
|
+
}, {
|
|
1141
|
+
readonly value: "5";
|
|
1142
|
+
readonly label: "5 KB";
|
|
1143
|
+
readonly description: "~1.25K tokens";
|
|
1144
|
+
}, {
|
|
1145
|
+
readonly value: "10";
|
|
1146
|
+
readonly label: "10 KB";
|
|
1147
|
+
readonly description: "~2.5K tokens";
|
|
1148
|
+
}, {
|
|
1149
|
+
readonly value: "20";
|
|
1150
|
+
readonly label: "20 KB";
|
|
1151
|
+
readonly description: "~5K tokens";
|
|
1152
|
+
}, {
|
|
1153
|
+
readonly value: "50";
|
|
1154
|
+
readonly label: "50 KB";
|
|
1155
|
+
readonly description: "~12.5K tokens";
|
|
1156
|
+
}, {
|
|
1157
|
+
readonly value: "100";
|
|
1158
|
+
readonly label: "100 KB";
|
|
1159
|
+
readonly description: "~25K tokens";
|
|
1160
|
+
}, {
|
|
1161
|
+
readonly value: "200";
|
|
1162
|
+
readonly label: "200 KB";
|
|
1163
|
+
readonly description: "~50K tokens";
|
|
1164
|
+
}];
|
|
1165
|
+
};
|
|
1166
|
+
};
|
|
1167
|
+
readonly "tools.bashOutputHeadBytes": {
|
|
1168
|
+
readonly type: "number";
|
|
1169
|
+
readonly default: 0;
|
|
1170
|
+
readonly ui: {
|
|
1171
|
+
readonly tab: "tools";
|
|
1172
|
+
readonly label: "Bash output head size (KB)";
|
|
1173
|
+
readonly description: "Head window the Bash tool keeps inline alongside the tail (middle elision) so the start of long command output stays visible. 0 keeps the tail only.";
|
|
1174
|
+
readonly options: readonly [{
|
|
1175
|
+
readonly value: "0";
|
|
1176
|
+
readonly label: "0 KB";
|
|
1177
|
+
readonly description: "Default; tail-only truncation";
|
|
1178
|
+
}, {
|
|
1179
|
+
readonly value: "1";
|
|
1180
|
+
readonly label: "1 KB";
|
|
1181
|
+
readonly description: "~250 tokens";
|
|
1182
|
+
}, {
|
|
1183
|
+
readonly value: "2.5";
|
|
1184
|
+
readonly label: "2.5 KB";
|
|
1185
|
+
readonly description: "~625 tokens";
|
|
1186
|
+
}, {
|
|
1187
|
+
readonly value: "5";
|
|
1188
|
+
readonly label: "5 KB";
|
|
1189
|
+
readonly description: "~1.25K tokens";
|
|
1190
|
+
}, {
|
|
1191
|
+
readonly value: "10";
|
|
1192
|
+
readonly label: "10 KB";
|
|
1193
|
+
readonly description: "~2.5K tokens";
|
|
1194
|
+
}, {
|
|
1195
|
+
readonly value: "20";
|
|
1196
|
+
readonly label: "20 KB";
|
|
1197
|
+
readonly description: "~5K tokens";
|
|
1198
|
+
}, {
|
|
1199
|
+
readonly value: "50";
|
|
1200
|
+
readonly label: "50 KB";
|
|
1201
|
+
readonly description: "~12.5K tokens";
|
|
1202
|
+
}];
|
|
1203
|
+
};
|
|
1204
|
+
};
|
|
1125
1205
|
readonly "tools.outputMaxColumns": {
|
|
1126
1206
|
readonly type: "number";
|
|
1127
1207
|
readonly default: 768;
|
|
@@ -16,6 +16,15 @@ export declare const WARMUP_TIMEOUT_MS = 5000;
|
|
|
16
16
|
* @param initTimeoutMs - Optional timeout for the initialize request (defaults to 30s)
|
|
17
17
|
*/
|
|
18
18
|
export declare function getOrCreateClient(config: ServerConfig, cwd: string, initTimeoutMs?: number): Promise<LspClient>;
|
|
19
|
+
/**
|
|
20
|
+
* Open documents no gjc operation has used for this long are closed before the next
|
|
21
|
+
* document opens. What a server releases on `didClose` is server-dependent; tsserver
|
|
22
|
+
* keeps the whole tsconfig program of every open document loaded and drops a project
|
|
23
|
+
* once all of its documents are closed, when it handles the next open.
|
|
24
|
+
*/
|
|
25
|
+
export declare const OPEN_FILE_IDLE_MS: number;
|
|
26
|
+
/** Send `didClose` for a tracked document and forget it and its diagnostics. */
|
|
27
|
+
export declare function closeDocument(client: LspClient, uri: string): Promise<void>;
|
|
19
28
|
/**
|
|
20
29
|
* Ensure a file is opened in the LSP client.
|
|
21
30
|
* Sends didOpen notification if the file is not already tracked.
|
|
@@ -239,6 +239,8 @@ export interface ServerConfig {
|
|
|
239
239
|
export interface OpenFile {
|
|
240
240
|
version: number;
|
|
241
241
|
languageId: string;
|
|
242
|
+
/** When a gjc operation last used this document; long-unused documents close before the next open. */
|
|
243
|
+
lastUsedAt: number;
|
|
242
244
|
}
|
|
243
245
|
export interface PendingRequest {
|
|
244
246
|
resolve: (result: unknown) => void;
|
package/dist/types/main.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { ModelRegistry } from "./config/model-registry";
|
|
|
11
11
|
import { Settings } from "./config/settings";
|
|
12
12
|
import type { ExtensionUIContext } from "./extensibility/extensions/types";
|
|
13
13
|
import type { AcpStartupOptions } from "./modes/acp/startup-options";
|
|
14
|
+
import { type HeldSessionChoice, type HeldSessionWarningOptions } from "./modes/components/session-held-warning";
|
|
14
15
|
import type { SessionSelectionResult } from "./modes/components/session-selector";
|
|
15
16
|
import type { InteractiveMode } from "./modes/interactive-mode";
|
|
16
17
|
import type { PrintModeOptions } from "./modes/print-mode";
|
|
@@ -23,6 +24,7 @@ import { SessionIndex } from "./sdk/broker/session-index";
|
|
|
23
24
|
import type { ResumeSessionIdentity } from "./sdk/session-readonly/storage";
|
|
24
25
|
import type { AgentSession } from "./session/agent-session";
|
|
25
26
|
import { type SessionDestination, type SessionDirectoryMigrationPolicy, type SessionInfo, SessionManager, type StrictSessionOpenResult } from "./session/session-manager";
|
|
27
|
+
import { SessionHeldError, type SessionOwnerSurface } from "./session/session-ownership";
|
|
26
28
|
import { resolveStartupAuthConfig } from "./session/startup-auth-config";
|
|
27
29
|
import { runStartupCredentialAutoImportIfNeeded } from "./setup/credential-auto-import";
|
|
28
30
|
import type { LspStartupServerInfo } from "./tools";
|
|
@@ -52,7 +54,7 @@ export interface InteractiveModeNotify {
|
|
|
52
54
|
kind: "warn" | "error" | "info";
|
|
53
55
|
message: string;
|
|
54
56
|
}
|
|
55
|
-
export declare function submitInteractiveInput(mode: Pick<InteractiveMode, "markPendingSubmissionStarted" | "finishPendingSubmission" | "showError" | "checkShutdownRequested" | "waitForAgentEnd"
|
|
57
|
+
export declare function submitInteractiveInput(mode: Pick<InteractiveMode, "markPendingSubmissionStarted" | "finishPendingSubmission" | "showError" | "checkShutdownRequested" | "waitForAgentEnd"> & Partial<Pick<InteractiveMode, "handleRefusedSessionTurn">>, session: Pick<AgentSession, "prompt" | "promptCustomMessage"> & {
|
|
56
58
|
continuePersistedHistory?: AgentSession["continuePersistedHistory"];
|
|
57
59
|
}, input: SubmittedUserInput): Promise<void>;
|
|
58
60
|
type StartupModelProfileArgs = {
|
|
@@ -120,14 +122,49 @@ export declare class SessionNotFoundError extends Error {
|
|
|
120
122
|
constructor(sessionId: string);
|
|
121
123
|
get sessionId(): string;
|
|
122
124
|
}
|
|
123
|
-
|
|
125
|
+
/** Cancel chosen in the held-session warning at launch: gjc exits 0 without opening anything (design §3.1). */
|
|
126
|
+
export declare class SessionResumeCancelledError extends Error {
|
|
127
|
+
constructor();
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Where a printed `gjc --fork` must look for the session it copies: the transcript path the launch
|
|
131
|
+
* named, and the `--session-dir` it searched, both absolute. An id alone resolves only in the
|
|
132
|
+
* default store.
|
|
133
|
+
*/
|
|
134
|
+
export interface SessionHeldForkSource {
|
|
135
|
+
readonly source?: string;
|
|
136
|
+
readonly sessionDir?: string;
|
|
137
|
+
}
|
|
138
|
+
export declare function sessionHeldForkSourceFor(parsed: Args, cwd: string): SessionHeldForkSource;
|
|
139
|
+
export declare function operatorFacingSessionOpenMessage(value: unknown, options?: {
|
|
140
|
+
readonly print?: boolean;
|
|
141
|
+
readonly fork?: SessionHeldForkSource;
|
|
142
|
+
}): string | undefined;
|
|
124
143
|
export declare function shouldNotifyModelFallback(authBootstrap: boolean | undefined, isInteractive: boolean): boolean;
|
|
125
144
|
export declare function runInteractiveMode(session: AgentSession, version: string, changelogMarkdown: string | undefined, notifs: (InteractiveModeNotify | null)[], startupUpdate: StartupUpdateOrchestrator, initialMessages: string[], setExtensionUIContext: (uiContext: ExtensionUIContext, hasUI: boolean) => void, lspServers: LspStartupServerInfo[] | undefined, mcpManager: MCPManager | undefined, eventBus?: EventBus, initialMessage?: string, initialImages?: ImageContent[], createInteractiveMode?: CreateInteractiveMode, resumeAction?: "continue-tail" | "open-idle", startDeferredMcpConfig?: CreateAgentSessionResult["startDeferredMcpConfig"], startDeferredModelProfiles?: DeferredModelProfileStartup, options?: {
|
|
126
145
|
stopAfterFirstPaint?: boolean;
|
|
127
146
|
openModelSelectorWithFallback?: string;
|
|
128
147
|
}): Promise<void>;
|
|
129
148
|
export declare function getChangelogForDisplay(parsed: Args): Promise<string | undefined>;
|
|
130
|
-
|
|
149
|
+
/**
|
|
150
|
+
* How a launch reports that `--continue` or `autoResume` started fresh because the session it would
|
|
151
|
+
* continue is held: `-p --continue` refuses instead, unless `interactive`.
|
|
152
|
+
*/
|
|
153
|
+
export interface SessionStartupNotices {
|
|
154
|
+
readonly interactive: boolean;
|
|
155
|
+
readonly notice: (message: string) => void;
|
|
156
|
+
/**
|
|
157
|
+
* Only for a launch that can show the TUI (a TTY): under enforce, `--resume` of a session another
|
|
158
|
+
* process holds asks here whether to fork it (design §3.1); without it the open refuses.
|
|
159
|
+
*/
|
|
160
|
+
readonly held?: {
|
|
161
|
+
readonly choose: (error: SessionHeldError, options: HeldSessionWarningOptions) => Promise<HeldSessionChoice>;
|
|
162
|
+
readonly forked: (message: string) => void;
|
|
163
|
+
/** The warning is waiting for a launched session host to publish before it shows. */
|
|
164
|
+
readonly waiting?: () => void;
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
export declare function createSessionManager(parsed: Args, cwd: string, activeSettings?: Settings, surface?: SessionOwnerSurface, startup?: SessionStartupNotices): Promise<SessionManager | undefined>;
|
|
131
168
|
type RunPrintMode = (session: AgentSession, options: PrintModeOptions) => Promise<void>;
|
|
132
169
|
export interface RunRootCommandDependencies {
|
|
133
170
|
createAgentSession?: typeof createAgentSession;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The held-session warning (session single-owner design §3.1): a session another process holds is
|
|
3
|
+
* never opened here, and the user can fork it or cancel. When the holder is a broker-launched host,
|
|
4
|
+
* the user can also continue here (design §12, §13 L1), which closes that host between turns. One
|
|
5
|
+
* copy and one option list for every surface that shows it: the launch before the TUI starts, the
|
|
6
|
+
* resume picker and `/resume`.
|
|
7
|
+
*/
|
|
8
|
+
import { type SessionHeldError } from "../../session/session-ownership";
|
|
9
|
+
import { HookSelectorComponent } from "./hook-selector";
|
|
10
|
+
export type HeldSessionChoice = "fork" | "continue" | "cancel";
|
|
11
|
+
export interface HeldSessionWarningOptions {
|
|
12
|
+
/** Offer Continue here: the holder is a broker-launched session host. */
|
|
13
|
+
readonly continueHere?: boolean;
|
|
14
|
+
/** Why the last Continue here did not go through, shown under the warning. */
|
|
15
|
+
readonly note?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Shown while the warning waits for a launched session host to publish (design §13 H3). */
|
|
18
|
+
export declare const SESSION_HOST_WAITING_MESSAGE = "Waiting for the session host\u2026";
|
|
19
|
+
/** The selector title (Markdown, as `HookSelectorComponent` renders it) and its options, Fork first. */
|
|
20
|
+
export declare function heldSessionWarningDialog(error: SessionHeldError, options?: HeldSessionWarningOptions): {
|
|
21
|
+
readonly title: string;
|
|
22
|
+
readonly options: string[];
|
|
23
|
+
};
|
|
24
|
+
/** The choice a selected option means; anything else (Escape, a closed dialog) cancels. */
|
|
25
|
+
export declare function heldSessionChoice(option: string | undefined): HeldSessionChoice;
|
|
26
|
+
/** The warning as a focused selector: Enter on Fork forks, Enter on Cancel or Escape cancels. */
|
|
27
|
+
export declare function createHeldSessionWarning(error: SessionHeldError, onChoice: (choice: HeldSessionChoice) => void, options?: HeldSessionWarningOptions): HookSelectorComponent;
|
|
@@ -1,16 +1,40 @@
|
|
|
1
1
|
import { type Component, Container } from "@gajae-code/tui";
|
|
2
2
|
import type { ResumeSessionIdentity } from "../../sdk/session-readonly/storage";
|
|
3
|
+
import type { SessionHandoverOutcome, SessionHandoverWaitOptions } from "../../session/session-handover";
|
|
3
4
|
import { type ResumeTailInspection, type SessionInfo } from "../../session/session-manager";
|
|
5
|
+
import { type SessionHeldError, type SessionOwnerClaim } from "../../session/session-ownership";
|
|
4
6
|
export interface SelectedSession {
|
|
5
7
|
kind: "selected";
|
|
6
8
|
path: string;
|
|
7
9
|
identity: ResumeSessionIdentity;
|
|
8
10
|
action: "continue-tail" | "open-idle";
|
|
11
|
+
/** Continue here's claim of the session: the caller releases it once its open has claimed. */
|
|
12
|
+
admission?: SessionOwnerClaim;
|
|
9
13
|
}
|
|
10
14
|
export interface CancelledSessionSelection {
|
|
11
15
|
kind: "cancelled";
|
|
12
16
|
}
|
|
13
|
-
|
|
17
|
+
/** Fork chosen from the held-session warning: the session stays with its holder, a copy opens idle. */
|
|
18
|
+
export interface ForkHeldSessionSelection {
|
|
19
|
+
kind: "fork";
|
|
20
|
+
path: string;
|
|
21
|
+
error: SessionHeldError;
|
|
22
|
+
}
|
|
23
|
+
export type SessionSelectionResult = SelectedSession | CancelledSessionSelection | ForkHeldSessionSelection;
|
|
24
|
+
/** A session another process holds, as checked when it is chosen. */
|
|
25
|
+
export interface HeldSession {
|
|
26
|
+
readonly error: SessionHeldError;
|
|
27
|
+
/**
|
|
28
|
+
* Continue here (design §13 L1), only when the holder is a broker-launched host: close it and
|
|
29
|
+
* claim the session for the caller, which releases the claim once its open has claimed.
|
|
30
|
+
*/
|
|
31
|
+
readonly handOver?: () => Promise<SessionHandoverOutcome>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Whether another process holds a session, checked when it is chosen (enforce only). `wait` lets the
|
|
35
|
+
* picker show the wait for a launched host and stop it when the check is abandoned.
|
|
36
|
+
*/
|
|
37
|
+
export type HeldSessionCheck = (session: SessionInfo, wait?: SessionHandoverWaitOptions) => Promise<HeldSession | undefined>;
|
|
14
38
|
export type SessionInspector = (sessionPath: string) => Promise<ResumeTailInspection>;
|
|
15
39
|
declare class SessionList implements Component {
|
|
16
40
|
#private;
|
|
@@ -23,6 +47,8 @@ declare class SessionList implements Component {
|
|
|
23
47
|
onToggleStarRequest?: (session: SessionInfo) => void;
|
|
24
48
|
constructor(allSessions: SessionInfo[], showCwd?: boolean);
|
|
25
49
|
setInputFrozen(frozen: boolean): void;
|
|
50
|
+
/** Mark (or unmark, with `undefined`) a session another process holds, by id: `in terminal`. */
|
|
51
|
+
setHeldMarker(sessionId: string, marker: string | undefined): void;
|
|
26
52
|
removeSession(sessionPath: string): void;
|
|
27
53
|
setSessionStarred(sessionPath: string, starred: boolean): void;
|
|
28
54
|
invalidate(): void;
|
|
@@ -41,6 +67,11 @@ export declare class SessionSelectorComponent extends Container {
|
|
|
41
67
|
private readonly onSetStarred?;
|
|
42
68
|
constructor(sessions: SessionInfo[], onSelect: (sessionPath: string) => void | Promise<void>, onCancel: () => void, onExit: () => void, onDelete?: ((session: SessionInfo) => Promise<boolean>) | undefined, inspector?: SessionInspector | undefined, onSelection?: ((selection: SessionSelectionResult) => void) | undefined, onSetStarred?: ((session: SessionInfo, starred: boolean) => Promise<void>) | undefined);
|
|
43
69
|
setOnRequestRender(callback: () => void): void;
|
|
70
|
+
/**
|
|
71
|
+
* Under enforce (design §1 row 2): mark the rows other processes hold, and, with `check`, show the
|
|
72
|
+
* held-session warning when one is chosen instead of resuming it. Cancel returns to the list.
|
|
73
|
+
*/
|
|
74
|
+
setHeldSessions(held: ReadonlyMap<string, SessionHeldError>, check?: HeldSessionCheck): void;
|
|
44
75
|
handleInput(keyData: string): void;
|
|
45
76
|
getSessionList(): SessionList;
|
|
46
77
|
}
|