@gajae-code/coding-agent 0.9.6 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/types/cli/classify-install-target.d.ts +0 -10
  3. package/dist/types/cli/daemon-cli.d.ts +2 -0
  4. package/dist/types/cli/initial-message.d.ts +1 -1
  5. package/dist/types/cli/malloc-env-guard.d.ts +65 -0
  6. package/dist/types/cli/malloc-env-guard.test.d.ts +1 -0
  7. package/dist/types/cli/notify-cli.d.ts +3 -1
  8. package/dist/types/cli/session-picker.d.ts +4 -3
  9. package/dist/types/cli/update-cli.d.ts +22 -3
  10. package/dist/types/cli.d.ts +4 -0
  11. package/dist/types/commands/daemon.d.ts +6 -2
  12. package/dist/types/commands/launch.d.ts +1 -0
  13. package/dist/types/commands/notify.d.ts +6 -0
  14. package/dist/types/commit/analysis/conventional.d.ts +1 -1
  15. package/dist/types/commit/analysis/summary.d.ts +1 -1
  16. package/dist/types/commit/changelog/generate.d.ts +1 -1
  17. package/dist/types/commit/changelog/index.d.ts +2 -2
  18. package/dist/types/commit/map-reduce/map-phase.d.ts +1 -1
  19. package/dist/types/commit/map-reduce/reduce-phase.d.ts +1 -1
  20. package/dist/types/config/keybindings.d.ts +5 -0
  21. package/dist/types/config/model-profile-activation.d.ts +1 -0
  22. package/dist/types/config/settings-schema.d.ts +47 -7
  23. package/dist/types/coordinator-mcp/model-preset.d.ts +45 -0
  24. package/dist/types/coordinator-mcp/server.d.ts +67 -6
  25. package/dist/types/daemon/control-types.d.ts +10 -0
  26. package/dist/types/daemon/operator-contract.d.ts +47 -0
  27. package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/models/catalog.d.ts +4 -0
  28. package/dist/types/discovery/helpers.d.ts +1 -1
  29. package/dist/types/discovery/substitute-plugin-root.d.ts +0 -4
  30. package/dist/types/gjc-runtime/launch-tmux.d.ts +26 -7
  31. package/dist/types/gjc-runtime/session-state-sidecar.d.ts +34 -3
  32. package/dist/types/gjc-runtime/tmux-common.d.ts +6 -0
  33. package/dist/types/gjc-runtime/tmux-owner-isolation-cli.d.ts +5 -0
  34. package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +309 -0
  35. package/dist/types/gjc-runtime/tmux-sessions.d.ts +49 -17
  36. package/dist/types/internal-urls/local-protocol.d.ts +13 -9
  37. package/dist/types/main.d.ts +66 -2
  38. package/dist/types/modes/acp/acp-agent.d.ts +19 -2
  39. package/dist/types/modes/acp/acp-mode.d.ts +12 -0
  40. package/dist/types/modes/components/assistant-message.d.ts +1 -1
  41. package/dist/types/modes/components/custom-editor.d.ts +2 -0
  42. package/dist/types/modes/components/gajae-pet-widget.d.ts +59 -0
  43. package/dist/types/modes/components/hook-selector.d.ts +5 -0
  44. package/dist/types/modes/components/irc-sidebar.d.ts +32 -0
  45. package/dist/types/modes/components/pet-selector.d.ts +11 -0
  46. package/dist/types/modes/components/session-selector.d.ts +22 -9
  47. package/dist/types/modes/components/settings-selector.d.ts +2 -0
  48. package/dist/types/modes/components/tool-execution.d.ts +1 -0
  49. package/dist/types/modes/components/user-message.d.ts +2 -1
  50. package/dist/types/modes/controllers/event-controller.d.ts +4 -0
  51. package/dist/types/modes/controllers/selector-controller.d.ts +1 -0
  52. package/dist/types/modes/interactive-mode.d.ts +24 -2
  53. package/dist/types/modes/irc-observation-ledger.d.ts +22 -0
  54. package/dist/types/modes/shared/agent-wire/deep-interview-gate.d.ts +8 -0
  55. package/dist/types/modes/shared/agent-wire/unattended-run-controller.d.ts +5 -0
  56. package/dist/types/modes/shared/agent-wire/unattended-session.d.ts +45 -0
  57. package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +42 -2
  58. package/dist/types/modes/theme/defaults/index.d.ts +568 -568
  59. package/dist/types/modes/types.d.ts +28 -2
  60. package/dist/types/modes/utils/abort-message.d.ts +1 -1
  61. package/dist/types/modes/utils/irc-message.d.ts +38 -0
  62. package/dist/types/modes/utils/ui-helpers.d.ts +13 -4
  63. package/dist/types/notifications/config.d.ts +34 -0
  64. package/dist/types/notifications/daemon-paths.d.ts +7 -0
  65. package/dist/types/notifications/index.d.ts +27 -0
  66. package/dist/types/notifications/lifecycle-control-runtime.d.ts +12 -4
  67. package/dist/types/notifications/notification-service.d.ts +144 -0
  68. package/dist/types/notifications/rate-limit-pool.d.ts +27 -9
  69. package/dist/types/notifications/telegram-daemon-control.d.ts +6 -0
  70. package/dist/types/notifications/telegram-daemon.d.ts +130 -3
  71. package/dist/types/notifications/telegram-reference.d.ts +19 -2
  72. package/dist/types/notifications/topic-registry.d.ts +24 -4
  73. package/dist/types/registry/agent-registry.d.ts +2 -0
  74. package/dist/types/rlm/index.d.ts +1 -1
  75. package/dist/types/sdk.d.ts +2 -0
  76. package/dist/types/secrets/obfuscator.d.ts +1 -1
  77. package/dist/types/session/agent-session.d.ts +26 -2
  78. package/dist/types/session/cache-economics.d.ts +79 -0
  79. package/dist/types/session/provider-safety-stop.d.ts +5 -0
  80. package/dist/types/session/session-manager.d.ts +124 -4
  81. package/dist/types/session/session-storage.d.ts +155 -13
  82. package/dist/types/setup/credential-auto-import.d.ts +2 -2
  83. package/dist/types/task/executor.d.ts +3 -0
  84. package/dist/types/task/receipt.d.ts +3 -1
  85. package/dist/types/task/types.d.ts +8 -0
  86. package/dist/types/tools/ask-answer-registry.d.ts +5 -0
  87. package/dist/types/tools/ask.d.ts +25 -1
  88. package/dist/types/tools/bash.d.ts +1 -1
  89. package/dist/types/tools/browser/tab-supervisor.d.ts +6 -0
  90. package/dist/types/tools/index.d.ts +58 -6
  91. package/dist/types/tools/telegram-send.d.ts +7 -0
  92. package/dist/types/utils/external-editor.d.ts +2 -0
  93. package/package.json +9 -9
  94. package/scripts/g004-tmux-smoke.ts +196 -36
  95. package/src/cli/daemon-cli.ts +19 -29
  96. package/src/cli/malloc-env-guard.test.ts +104 -0
  97. package/src/cli/malloc-env-guard.ts +149 -0
  98. package/src/cli/notify-cli.ts +78 -14
  99. package/src/cli/session-picker.ts +23 -40
  100. package/src/cli/update-cli.ts +56 -37
  101. package/src/cli.ts +50 -10
  102. package/src/commands/daemon.ts +19 -5
  103. package/src/commands/harness.ts +515 -47
  104. package/src/commands/launch.ts +11 -3
  105. package/src/commands/notify.ts +5 -1
  106. package/src/commands/session.ts +6 -1
  107. package/src/config/keybindings.ts +5 -0
  108. package/src/config/model-profile-activation.ts +1 -1
  109. package/src/config/model-profiles.ts +14 -14
  110. package/src/config/settings-schema.ts +41 -1
  111. package/src/coordinator-mcp/model-preset.ts +100 -0
  112. package/src/coordinator-mcp/server.ts +2653 -425
  113. package/src/daemon/control-types.ts +11 -0
  114. package/src/daemon/operator-contract.ts +121 -0
  115. package/src/deep-interview/render-middleware.ts +67 -2
  116. package/src/defaults/gjc/extensions/grok-cli-vendor/src/models/catalog.ts +57 -17
  117. package/src/defaults/gjc/extensions/grok-cli-vendor/src/payload/sanitize.ts +15 -2
  118. package/src/defaults/gjc/extensions/grok-cli-vendor/src/provider/register.ts +5 -1
  119. package/src/gjc-runtime/launch-tmux.ts +702 -135
  120. package/src/gjc-runtime/session-state-sidecar.ts +756 -135
  121. package/src/gjc-runtime/team-runtime.ts +6 -0
  122. package/src/gjc-runtime/tmux-common.ts +26 -7
  123. package/src/gjc-runtime/tmux-gc.ts +52 -9
  124. package/src/gjc-runtime/tmux-owner-isolation-cli.ts +185 -0
  125. package/src/gjc-runtime/tmux-owner-isolation.ts +2060 -0
  126. package/src/gjc-runtime/tmux-sessions.ts +871 -68
  127. package/src/internal-urls/docs-index.generated.ts +9 -8
  128. package/src/internal-urls/local-protocol.ts +29 -10
  129. package/src/main.ts +298 -75
  130. package/src/modes/acp/acp-agent.ts +728 -98
  131. package/src/modes/acp/acp-mode.ts +29 -2
  132. package/src/modes/components/assistant-message.ts +32 -3
  133. package/src/modes/components/bash-execution.ts +43 -13
  134. package/src/modes/components/custom-editor.ts +5 -0
  135. package/src/modes/components/gajae-pet-widget.ts +360 -0
  136. package/src/modes/components/hook-selector.ts +12 -0
  137. package/src/modes/components/irc-sidebar.ts +206 -0
  138. package/src/modes/components/pet-selector.ts +55 -0
  139. package/src/modes/components/session-selector.ts +222 -221
  140. package/src/modes/components/settings-selector.ts +10 -0
  141. package/src/modes/components/tool-execution.ts +47 -6
  142. package/src/modes/components/user-message.ts +26 -9
  143. package/src/modes/controllers/command-controller.ts +28 -2
  144. package/src/modes/controllers/event-controller.ts +159 -36
  145. package/src/modes/controllers/extension-ui-controller.ts +36 -17
  146. package/src/modes/controllers/input-controller.ts +8 -2
  147. package/src/modes/controllers/selector-controller.ts +62 -15
  148. package/src/modes/interactive-mode.ts +183 -7
  149. package/src/modes/irc-observation-ledger.ts +127 -0
  150. package/src/modes/shared/agent-wire/deep-interview-gate.ts +45 -2
  151. package/src/modes/shared/agent-wire/unattended-session.ts +288 -1
  152. package/src/modes/shared/agent-wire/workflow-gate-broker.ts +130 -20
  153. package/src/modes/types.ts +34 -2
  154. package/src/modes/utils/hotkeys-markdown.ts +1 -0
  155. package/src/modes/utils/irc-message.ts +138 -0
  156. package/src/modes/utils/ui-helpers.ts +216 -50
  157. package/src/notifications/config.ts +44 -0
  158. package/src/notifications/daemon-paths.ts +8 -0
  159. package/src/notifications/index.ts +535 -75
  160. package/src/notifications/lifecycle-control-runtime.ts +930 -77
  161. package/src/notifications/notification-service.ts +710 -0
  162. package/src/notifications/rate-limit-pool.ts +46 -12
  163. package/src/notifications/telegram-daemon-cli.ts +2 -0
  164. package/src/notifications/telegram-daemon-control.ts +27 -2
  165. package/src/notifications/telegram-daemon.ts +635 -94
  166. package/src/notifications/telegram-reference.ts +73 -13
  167. package/src/notifications/topic-registry.ts +86 -9
  168. package/src/prompts/system/irc-peer-roster.md +1 -0
  169. package/src/prompts/system/subagent-system-prompt.md +1 -0
  170. package/src/prompts/system/system-prompt.md +1 -0
  171. package/src/prompts/tools/irc.md +1 -1
  172. package/src/registry/agent-registry.ts +3 -0
  173. package/src/sdk.ts +52 -1
  174. package/src/secrets/obfuscator.ts +4 -2
  175. package/src/session/agent-session.ts +396 -145
  176. package/src/session/cache-economics.ts +275 -0
  177. package/src/session/provider-safety-stop.ts +9 -0
  178. package/src/session/session-dump-format.ts +6 -0
  179. package/src/session/session-manager.ts +809 -39
  180. package/src/session/session-storage.ts +582 -38
  181. package/src/slash-commands/builtin-registry.ts +143 -9
  182. package/src/task/executor.ts +12 -3
  183. package/src/task/index.ts +8 -0
  184. package/src/task/receipt.ts +7 -2
  185. package/src/task/types.ts +26 -0
  186. package/src/tools/ask-answer-registry.ts +25 -0
  187. package/src/tools/ask.ts +355 -33
  188. package/src/tools/browser/tab-supervisor.ts +63 -6
  189. package/src/tools/browser.ts +8 -3
  190. package/src/tools/index.ts +81 -6
  191. package/src/tools/sqlite-reader.ts +8 -4
  192. package/src/tui/output-block.ts +18 -6
  193. package/src/utils/external-editor.ts +6 -1
@@ -1,4 +1,6 @@
1
1
  import { COORDINATOR_MCP_PROTOCOL_VERSION, COORDINATOR_MCP_SERVER_NAME, COORDINATOR_MCP_TOOL_NAMES, type CoordinatorToolName } from "../coordinator/contract";
2
+ import { type OwnerIsolationProbe } from "../gjc-runtime/tmux-owner-isolation";
3
+ import { type CoordinatorModelProfileLoader } from "./model-preset";
2
4
  import { type CoordinatorMcpConfig } from "./policy";
3
5
  export type { CoordinatorToolName };
4
6
  export { COORDINATOR_MCP_PROTOCOL_VERSION, COORDINATOR_MCP_SERVER_NAME, COORDINATOR_MCP_TOOL_NAMES };
@@ -22,20 +24,31 @@ interface JsonRpcResponse {
22
24
  interface SessionStartInput {
23
25
  cwd: string;
24
26
  prompt?: string;
27
+ mpreset?: string | null;
25
28
  namespace: {
26
29
  profile: string | null;
27
30
  repo: string | null;
28
31
  };
29
32
  worktree: true;
33
+ sessionId: string;
34
+ launchId: string;
35
+ /** Canonical, coordinator-owned immutable readiness marker path. */
36
+ readinessMarkerFile: string;
37
+ /** @deprecated Compatibility alias for injected launch providers. */
38
+ readinessFile: string;
30
39
  }
40
+ interface CommandResult {
41
+ exitCode: number;
42
+ stdout: string;
43
+ stderr: string;
44
+ }
45
+ type CommandRunner = (command: string[], stdinLine?: string) => Promise<CommandResult>;
31
46
  interface CoordinatorServices {
32
47
  listSessions?: () => unknown[] | Promise<unknown[]>;
33
48
  startSession?: (input: SessionStartInput) => unknown | Promise<unknown>;
34
- commandRunner?: (command: string[]) => Promise<{
35
- exitCode: number;
36
- stdout: string;
37
- stderr: string;
38
- }>;
49
+ commandRunner?: CommandRunner;
50
+ ownerIsolationProbe?: OwnerIsolationProbe;
51
+ resolveModelProfiles?: CoordinatorModelProfileLoader;
39
52
  }
40
53
  interface CoordinatorMcpServerOptions {
41
54
  env?: NodeJS.ProcessEnv;
@@ -43,16 +56,35 @@ interface CoordinatorMcpServerOptions {
43
56
  }
44
57
  interface LegacyHandlerOptions {
45
58
  env?: NodeJS.ProcessEnv;
46
- createSession?: () => unknown;
59
+ createSession?: (input: SessionStartInput) => unknown;
47
60
  }
61
+ /**
62
+ * Append an authoritative `--mpreset <profile>` to the coordinator child launch
63
+ * command so the spawned GJC session activates the selected profile from its
64
+ * first turn. The profile name is validated against the merged registry before
65
+ * reaching here; it is still shell-quoted as defense in depth.
66
+ *
67
+ * Precedence note: this matches `gjc --mpreset <profile>` semantics exactly, so
68
+ * an explicit model-affecting flag already present in the operator-configured
69
+ * `sessionCommand` (e.g. a `--model`/`--thinking` baked into the launch command)
70
+ * follows the same CLI precedence as a direct `gjc --mpreset ... --model ...`
71
+ * invocation. The effective profile recorded on the session is the
72
+ * coordinator-resolved request, not a child-attested activation receipt; a
73
+ * cross-process activation receipt is a possible future enhancement and is out
74
+ * of scope for the per-session selection contract here.
75
+ */
76
+ export declare function buildCoordinatorSessionCommand(sessionCommand: string, mpreset: string | null | undefined): string;
48
77
  export declare const COORDINATOR_AWAIT_TURN_TIMEOUT_MAX_MS: number;
49
78
  export declare const COORDINATOR_RUNTIME_PROMPT_ACK_TIMEOUT_MAX_MS: number;
79
+ export declare const COORDINATOR_RUNTIME_READINESS_TIMEOUT_MAX_MS: number;
50
80
  export declare const COORDINATOR_EVENT_WATCH_TIMEOUT_MAX_MS = 30000;
51
81
  export declare const COORDINATOR_POLL_INTERVAL_MAX_MS = 10000;
52
82
  export declare function boundedAwaitTurnTimeoutMs(value: unknown): number;
53
83
  export declare function boundedRuntimePromptAckTimeoutMs(value: unknown): number;
84
+ export declare function boundedRuntimeReadinessTimeoutMs(value: unknown): number;
54
85
  export declare function boundedEventWatchTimeoutMs(value: unknown): number;
55
86
  export declare function boundedPollIntervalMs(value: unknown): number;
87
+ export declare function coordinatorOwnerIsolationProbe(runner: CommandRunner): Promise<OwnerIsolationProbe>;
56
88
  export declare function readCoordinatorArtifact(config: CoordinatorMcpConfig, args: {
57
89
  path: unknown;
58
90
  }): Promise<Record<string, unknown>>;
@@ -63,4 +95,33 @@ export declare function createCoordinatorMcpServer(options?: CoordinatorMcpServe
63
95
  handle: (request: JsonRpcRequest) => Promise<JsonRpcResponse>;
64
96
  };
65
97
  export declare function handleCoordinatorMcpRequest(request: JsonRpcRequest, options?: LegacyHandlerOptions): Promise<JsonRpcResponse>;
98
+ export interface PumpCoordinatorOptions {
99
+ /** Max concurrent in-flight *data* (non-control) handlers. Control frames (ping) bypass this. */
100
+ maxDataConcurrency?: number;
101
+ /** Max data requests queued waiting for a slot before overflow is rejected as server_busy. */
102
+ maxQueueDepth?: number;
103
+ /** Bounded wait for in-flight handlers/writes to settle after input ends. */
104
+ drainTimeoutMs?: number;
105
+ }
106
+ /**
107
+ * Pump a newline-delimited JSON-RPC stream with BOUNDED concurrent dispatch.
108
+ *
109
+ * A long-running tool call (e.g. gjc_coordinator_await_turn, which polls for
110
+ * minutes) must not block the read loop from answering keepalive pings on the
111
+ * same stdio channel. But naive unbounded concurrency reintroduces its own
112
+ * hazards, so this pump enforces the safety envelope the coordinator needs:
113
+ *
114
+ * - Control frames (ping) bypass the data-concurrency cap → keepalive is always
115
+ * answerable even while data handlers saturate.
116
+ * - Data handlers are capped at `maxDataConcurrency`; excess is queued up to
117
+ * `maxQueueDepth`, then rejected as `server_busy` (bounded memory / fanout).
118
+ * - `writeLine` failures move the writer to a terminal closed state instead of
119
+ * poisoning the serialized write chain or escaping as an unhandled rejection;
120
+ * no writes happen after close.
121
+ * - On EOF the pump drains in-flight handlers (bounded by `drainTimeoutMs`) and
122
+ * flushes queued writes before returning, so shutdown never races live work.
123
+ * - Byte chunks are decoded with a streaming decoder so multibyte characters
124
+ * split across chunks are not corrupted.
125
+ */
126
+ export declare function pumpCoordinatorMcpStream(handleJsonRpc: (request: JsonRpcRequest) => Promise<JsonRpcResponse>, input: AsyncIterable<string | Uint8Array>, writeLine: (line: string) => void | Promise<void>, options?: PumpCoordinatorOptions): Promise<void>;
66
127
  export declare function runCoordinatorMcpStdio(options?: CoordinatorMcpServerOptions): Promise<void>;
@@ -40,6 +40,14 @@ export interface DaemonOperationOptions {
40
40
  /** For reload: spawn a fresh owner even when none is currently running. */
41
41
  spawnIfStopped?: boolean;
42
42
  }
43
+ export interface DaemonRecovery {
44
+ /** Machine-readable recovery category for automation branching. */
45
+ reason: "ownership_mismatch";
46
+ /** One-line human summary of why the operation could not proceed. */
47
+ summary: string;
48
+ /** Ordered, copy-pasteable remediation steps. */
49
+ steps: string[];
50
+ }
43
51
  export interface DaemonOperationResult {
44
52
  kind: DaemonKind;
45
53
  action: Exclude<DaemonAction, "list">;
@@ -48,6 +56,8 @@ export interface DaemonOperationResult {
48
56
  after?: DaemonStatus;
49
57
  warnings: string[];
50
58
  message: string;
59
+ /** Present when the operation was refused with an actionable recovery path (e.g. ownership mismatch). */
60
+ recovery?: DaemonRecovery;
51
61
  }
52
62
  export interface BuiltInDaemonController {
53
63
  readonly kind: DaemonKind;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Shared operator contract for the `gjc daemon` command surface.
3
+ *
4
+ * One source of truth for the beginner-safe operational vocabulary so the
5
+ * guided human surface and the machine-readable JSON never drift:
6
+ * - the terse action verbs plus operator aliases (e.g. `restart` -> `reload`),
7
+ * - process exit codes,
8
+ * - concise vs. `--verbose` human rendering of statuses and results, and
9
+ * - actionable recovery guidance for a token/chat ownership mismatch.
10
+ *
11
+ * The full roots/debug payload lives behind `--verbose` (human) or `--json`
12
+ * (automation); the default human output stays a concise per-daemon result.
13
+ */
14
+ import type { DaemonAction, DaemonOperationResult, DaemonRecovery, DaemonStatus } from "./control-types";
15
+ /** Canonical daemon actions accepted as the leading verb. */
16
+ export declare const DAEMON_CANONICAL_ACTIONS: readonly DaemonAction[];
17
+ /**
18
+ * Operator-friendly aliases resolved to a canonical action. `restart` is the
19
+ * routine "reload if running, otherwise start" verb; it maps onto `reload`,
20
+ * whose default already spawns a fresh owner when none is running.
21
+ */
22
+ export declare const DAEMON_ACTION_ALIASES: Readonly<Record<string, DaemonAction>>;
23
+ /** Every token accepted in the leading action position (canonical + aliases). */
24
+ export declare const DAEMON_ACTION_TOKENS: readonly string[];
25
+ /** Resolve a leading verb (canonical or alias) to its canonical action. */
26
+ export declare function resolveDaemonAction(token: string | undefined): DaemonAction | undefined;
27
+ /** Exit codes for `gjc daemon`. Backward compatible: success 0, any failure 1. */
28
+ export declare const DAEMON_EXIT: {
29
+ readonly ok: 0;
30
+ readonly failure: 1;
31
+ };
32
+ /** Human-facing headline when a spawn/reload is refused by a live foreign identity. */
33
+ export declare const OWNERSHIP_MISMATCH_MESSAGE = "refused: a live Telegram daemon with a different bot token or chat already owns this workspace";
34
+ /** Structured, actionable recovery for a token/chat ownership mismatch. */
35
+ export declare function ownershipMismatchRecovery(): DaemonRecovery;
36
+ /**
37
+ * Render one daemon status. Concise by default (single head line + any
38
+ * actionable warning); `--verbose` adds runtime detail and the full roots list.
39
+ */
40
+ export declare function formatDaemonStatus(status: DaemonStatus, opts?: {
41
+ verbose?: boolean;
42
+ }): string;
43
+ /**
44
+ * Render one operation result. Keeps the stable `<kind> <action>: ok|failed —
45
+ * <message>` head line, then any warnings, then actionable recovery steps.
46
+ */
47
+ export declare function formatDaemonResult(result: DaemonOperationResult): string;
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Model definitions for Grok CLI's API.
3
3
  */
4
+ import { Effort } from '@gajae-code/ai/model-thinking';
4
5
  export interface GrokCliModelConfig {
5
6
  id: string;
6
7
  name: string;
@@ -14,9 +15,12 @@ export interface GrokCliModelConfig {
14
15
  };
15
16
  contextWindow: number;
16
17
  maxTokens: number;
18
+ /** Highest reasoning effort supported by this model. */
19
+ maxReasoningEffort?: Effort;
17
20
  /** Models that don't support reasoning.effort get a thinkingLevelMap. */
18
21
  thinkingLevelMap?: Record<string, string | null>;
19
22
  }
23
+ export declare function getMaxReasoningEffort(modelId: string): Effort | undefined;
20
24
  export declare function supportsReasoningEffort(modelId: string): boolean;
21
25
  /**
22
26
  * Resolve the active model list. If `GJC_GROK_CLI_MODELS` is set,
@@ -11,7 +11,7 @@ export declare const SOURCE_PATHS: {
11
11
  readonly native: {
12
12
  readonly userBase: string;
13
13
  readonly userAgent: string;
14
- projectDir: string;
14
+ readonly projectDir: string;
15
15
  };
16
16
  readonly claude: {
17
17
  readonly userBase: ".claude";
@@ -1,5 +1 @@
1
- /**
2
- * Recursively substitute ${ANTHROPIC_MODEL_PLUGIN_ROOT} and ${GJC_PLUGIN_ROOT}
3
- * with the actual plugin root path in strings, arrays, and plain objects.
4
- */
5
1
  export declare function substitutePluginRoot<T>(value: T, rootPath: string): T;
@@ -1,10 +1,10 @@
1
1
  import type { Args } from "../cli/args";
2
2
  import { buildGjcTmuxExactSessionTarget, buildGjcTmuxProfileCommands, GJC_DEFAULT_TMUX_SESSION, GJC_TMUX_COMMAND_ENV, GJC_TMUX_MOUSE_ENV, GJC_TMUX_PROFILE_ENV, GJC_TMUX_SESSION_PREFIX, type GjcTmuxProfileCommand } from "./tmux-common";
3
+ import { type OwnerIsolationProbeSync } from "./tmux-owner-isolation";
3
4
  export { buildGjcTmuxExactSessionTarget, buildGjcTmuxProfileCommands, GJC_DEFAULT_TMUX_SESSION, GJC_TMUX_COMMAND_ENV, GJC_TMUX_MOUSE_ENV, GJC_TMUX_PROFILE_ENV, GJC_TMUX_SESSION_PREFIX, };
4
5
  export declare const GJC_TMUX_LAUNCHED_ENV = "GJC_TMUX_LAUNCHED";
5
6
  export declare const GJC_LAUNCH_POLICY_ENV = "GJC_LAUNCH_POLICY";
6
7
  export declare const GJC_TMUX_WINDOW_LABEL_MAX_WIDTH = 48;
7
- export declare const GJC_PSMUX_PROFILE_FORCE_ENV = "GJC_PSMUX_PROFILE_FORCE";
8
8
  interface TtyState {
9
9
  stdin: boolean;
10
10
  stdout: boolean;
@@ -28,11 +28,19 @@ export interface TmuxLaunchContext {
28
28
  existingBranchSessionName?: string | null;
29
29
  project?: string | null;
30
30
  diagnosticWriter?: (message: string) => void;
31
+ /**
32
+ * Synchronous owner-isolation proof boundary for managed tmux creation.
33
+ * Production uses Linux /proc probes; callers may inject deterministic proofs.
34
+ */
35
+ ownerIsolationProbe?: OwnerIsolationProbeSync;
36
+ /** Test seam for deterministic default-probe caller cgroup classification. */
37
+ callerCgroupReader?: () => string | null;
31
38
  }
32
39
  export interface TmuxSpawnResult {
33
40
  exitCode: number | null;
34
41
  signalCode?: string | null;
35
42
  stderr?: string;
43
+ stdout?: string;
36
44
  }
37
45
  export interface TmuxTerminalSize {
38
46
  columns: number;
@@ -46,14 +54,12 @@ export interface TmuxSpawnOptions {
46
54
  stdout: "inherit" | "pipe";
47
55
  stderr: "inherit" | "pipe";
48
56
  /**
49
- * When true, the spawn captures stderr into a buffer and forwards it to
50
- * the parent stderr so the user still sees the live output. The captured
51
- * text is also returned in TmuxSpawnResult.stderr for diagnostic
52
- * surfacing in "attach failed" / "profile tagging failed" messages.
53
- * Defaults to false to preserve the previous PTY-binding behavior for
54
- * attach-session and other interactive commands.
57
+ * Captures control-plane stderr for sanitized, bounded diagnostics. PTY-bound
58
+ * commands retain inherited stderr for multiplexer compatibility.
55
59
  */
56
60
  captureStderr?: boolean;
61
+ /** Internal scoped-bootstrap input; never used for ordinary tmux commands. */
62
+ stdinLine?: string;
57
63
  }
58
64
  export interface TmuxLaunchPlan {
59
65
  tmuxCommand: string;
@@ -67,6 +73,17 @@ export interface TmuxLaunchPlan {
67
73
  project?: string | null;
68
74
  sessionId?: string | null;
69
75
  sessionStateFile?: string | null;
76
+ /** Immutable Linux-managed owner provenance, assigned immediately before creation. */
77
+ ownerGeneration?: string;
78
+ /** Generation state captured before owner-isolation planning; required for publication CAS. */
79
+ ownerGenerationBaseline?: import("./tmux-owner-isolation").OwnerGenerationBaseline;
80
+ /** Native tmux session identity emitted atomically by `new-session -P -F`. */
81
+ createdSessionId?: string;
82
+ /** Safe server identity proven immediately after creation. */
83
+ createdServerIdentity?: {
84
+ pid: number;
85
+ startTime: string;
86
+ };
70
87
  isPsmux: boolean;
71
88
  platform: NodeJS.Platform;
72
89
  }
@@ -89,6 +106,8 @@ export interface GjcTmuxProfileContext {
89
106
  project?: string | null;
90
107
  sessionId?: string | null;
91
108
  sessionStateFile?: string | null;
109
+ ownerGeneration?: string | null;
110
+ ownerServerKey?: string | null;
92
111
  version?: string | null;
93
112
  }
94
113
  export declare function applyGjcTmuxProfile(context: GjcTmuxProfileContext): GjcTmuxProfileResult;
@@ -1,7 +1,23 @@
1
1
  import { postmortem } from "@gajae-code/utils";
2
+ /** Managed tmux owner provenance propagated only to the launched child process. */
3
+ export declare const GJC_TMUX_OWNER_GENERATION_ENV = "GJC_TMUX_OWNER_GENERATION";
4
+ export declare const GJC_TMUX_OWNER_STATE_DIR_ENV = "GJC_TMUX_OWNER_STATE_DIR";
5
+ export declare const GJC_TMUX_OWNER_SERVER_KEY_ENV = "GJC_TMUX_OWNER_SERVER_KEY";
2
6
  export declare const GJC_COORDINATOR_SESSION_STATE_FILE_ENV = "GJC_COORDINATOR_SESSION_STATE_FILE";
3
7
  export declare const GJC_COORDINATOR_SESSION_ID_ENV = "GJC_COORDINATOR_SESSION_ID";
4
8
  export declare const GJC_COORDINATOR_SESSION_BRANCH_ENV = "GJC_COORDINATOR_SESSION_BRANCH";
9
+ export declare const GJC_COORDINATOR_SESSION_LAUNCH_ID_ENV = "GJC_COORDINATOR_SESSION_LAUNCH_ID";
10
+ export declare const GJC_COORDINATOR_SESSION_READINESS_FILE_ENV = "GJC_COORDINATOR_SESSION_READINESS_FILE";
11
+ export type RuntimeInputReadyMarker = Readonly<{
12
+ schema_version: 1;
13
+ session_id: string;
14
+ launch_id: string;
15
+ state: "ready_for_input";
16
+ event: "interactive_input_ready";
17
+ source: "gjc_interactive_runtime";
18
+ ready_for_input: true;
19
+ created_at: string;
20
+ }>;
5
21
  export type RuntimeState = "ready_for_input" | "running" | "needs_user_input" | "completed" | "errored";
6
22
  /** Test-only counters for runtime sidecar hot-path assertions. */
7
23
  export declare const __sessionStateSidecarPerfCounters: {
@@ -12,19 +28,33 @@ interface RuntimeStateEvent {
12
28
  type: string;
13
29
  messages?: unknown[];
14
30
  }
15
- interface RuntimeStateContext {
31
+ export interface OwnerTerminalContext {
32
+ generation: string;
33
+ stateDir: string;
34
+ socketKey: string;
35
+ scope?: string | null;
36
+ ownerPid?: number | null;
37
+ ownerName?: string | null;
38
+ operatorDispatchId?: string | null;
39
+ }
40
+ export interface RuntimeStateContext {
16
41
  sessionId: string;
17
42
  cwd: string;
18
43
  sessionFile?: string | null;
19
44
  branch?: string | null;
45
+ /** Public-safe owner metadata used to persist the canonical terminal verdict. */
46
+ ownerTerminal?: OwnerTerminalContext | null;
47
+ /** Internal fail-closed marker set only when managed owner metadata is malformed or missing. */
48
+ ownerTerminalMetadataInvalid?: boolean;
20
49
  }
21
50
  export type TerminalRuntimeStateStatus = {
22
51
  terminal: true;
23
52
  state: "completed" | "errored";
24
53
  } | {
25
54
  terminal: false;
26
- reason: "missing_state_file" | "invalid_json" | "session_id_mismatch" | "cwd_mismatch" | "session_file_mismatch" | "non_terminal_state";
55
+ reason: "missing_state_file" | "invalid_json" | "invalid_state_marker" | "session_id_mismatch" | "cwd_mismatch" | "session_file_mismatch" | "non_terminal_state";
27
56
  };
57
+ export declare function persistCoordinatorRuntimeInputReady(): Promise<RuntimeInputReadyMarker | null>;
28
58
  export declare function readTerminalRuntimeStateMarker(input: {
29
59
  stateFile?: string | null;
30
60
  sessionId?: string | null;
@@ -34,6 +64,7 @@ export declare function readTerminalRuntimeStateMarker(input: {
34
64
  export declare function stateForEvent(event: RuntimeStateEvent): RuntimeState | null;
35
65
  export declare function eventAffectsCoordinatorRuntimeState(event: RuntimeStateEvent): boolean;
36
66
  export declare function persistCoordinatorRuntimeStateFromEvent(event: RuntimeStateEvent, context: RuntimeStateContext): Promise<void>;
37
- export declare function persistCoordinatorRuntimeStateFromPostmortem(reason: postmortem.Reason, context: RuntimeStateContext): void;
67
+ export declare function ownerTerminalContextFromEnvironment(): OwnerTerminalContext | "invalid" | null;
68
+ export declare function persistCoordinatorRuntimeStateFromPostmortem(reason: postmortem.Reason, context: RuntimeStateContext): Promise<void>;
38
69
  export declare function registerCoordinatorRuntimeStateFinalizer(context: RuntimeStateContext): () => void;
39
70
  export {};
@@ -12,6 +12,8 @@ export declare const GJC_TMUX_BRANCH_SLUG_OPTION = "@gjc-branch-slug";
12
12
  export declare const GJC_TMUX_PROJECT_OPTION = "@gjc-project";
13
13
  export declare const GJC_TMUX_SESSION_ID_OPTION = "@gjc-session-id";
14
14
  export declare const GJC_TMUX_SESSION_STATE_FILE_OPTION = "@gjc-session-state-file";
15
+ export declare const GJC_TMUX_OWNER_GENERATION_OPTION = "@gjc-owner-generation";
16
+ export declare const GJC_TMUX_OWNER_SERVER_KEY_OPTION = "@gjc-owner-server-key";
15
17
  export declare const GJC_TMUX_VERSION_OPTION = "@gjc-version";
16
18
  export declare const GJC_PSMUX_PROFILE_FORCE_ENV = "GJC_PSMUX_PROFILE_FORCE";
17
19
  export interface GjcTmuxProfileCommand {
@@ -89,6 +91,8 @@ export declare function buildGjcTmuxRequiredProfileCommands(target: string, meta
89
91
  project?: string | null;
90
92
  sessionId?: string | null;
91
93
  sessionStateFile?: string | null;
94
+ ownerGeneration?: string | null;
95
+ ownerServerKey?: string | null;
92
96
  version?: string | null;
93
97
  }): GjcTmuxProfileCommand[];
94
98
  export declare function buildGjcTmuxProfileCommands(target: string, env?: NodeJS.ProcessEnv, metadata?: {
@@ -97,6 +101,8 @@ export declare function buildGjcTmuxProfileCommands(target: string, env?: NodeJS
97
101
  project?: string | null;
98
102
  sessionId?: string | null;
99
103
  sessionStateFile?: string | null;
104
+ ownerGeneration?: string | null;
105
+ ownerServerKey?: string | null;
100
106
  version?: string | null;
101
107
  }, opts?: {
102
108
  platform?: NodeJS.Platform;
@@ -0,0 +1,5 @@
1
+ /** Matches the sole argv shape allowed to enter the owner-isolation JSON-line protocol. */
2
+ export declare function isTmuxOwnerIsolationCliArgv(argv: readonly string[]): boolean;
3
+ /** Reads exactly one bounded JSON line and writes exactly one JSON response line. */
4
+ export declare function runTmuxOwnerIsolationCli(stdin: string): Promise<string>;
5
+ export declare function runTmuxOwnerIsolationCliFromStdin(): Promise<void>;