@gajae-code/coding-agent 0.11.7 → 0.11.8

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 (180) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/types/cli/args.d.ts +0 -2
  3. package/dist/types/config/keybindings.d.ts +33 -3
  4. package/dist/types/config/model-profile-activation.d.ts +4 -3
  5. package/dist/types/config/model-profile-contract.d.ts +38 -0
  6. package/dist/types/config/settings-schema.d.ts +15 -2
  7. package/dist/types/edit/modes/patch.d.ts +13 -0
  8. package/dist/types/edit/path-mutation-lock.d.ts +15 -0
  9. package/dist/types/eval/py/executor.d.ts +1 -1
  10. package/dist/types/eval/py/tool-bridge.d.ts +1 -2
  11. package/dist/types/gjc-runtime/repository-binding.d.ts +63 -0
  12. package/dist/types/gjc-runtime/ultragoal-guard.d.ts +1 -0
  13. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +24 -0
  14. package/dist/types/main.d.ts +8 -0
  15. package/dist/types/modes/components/runtime-mcp-add-wizard.d.ts +2 -1
  16. package/dist/types/modes/components/tool-status-header.d.ts +3 -2
  17. package/dist/types/modes/components/welcome.d.ts +2 -0
  18. package/dist/types/modes/controllers/command-controller.d.ts +2 -0
  19. package/dist/types/modes/controllers/selector-controller.d.ts +2 -1
  20. package/dist/types/modes/interactive-mode.d.ts +5 -2
  21. package/dist/types/modes/prompt-action-autocomplete.d.ts +6 -1
  22. package/dist/types/modes/prompt-suggestion-controller.d.ts +35 -0
  23. package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +2 -2
  24. package/dist/types/modes/types.d.ts +3 -0
  25. package/dist/types/modes/utils/hotkeys-markdown.d.ts +2 -1
  26. package/dist/types/runtime-mcp/manager.d.ts +1 -1
  27. package/dist/types/runtime-mcp/oauth-flow.d.ts +0 -5
  28. package/dist/types/runtime-mcp/plugin-network-boundary.d.ts +14 -0
  29. package/dist/types/sdk/broker/broker.d.ts +2 -0
  30. package/dist/types/sdk/broker/lifecycle.d.ts +6 -0
  31. package/dist/types/sdk/bus/chat-daemon-control.d.ts +5 -1
  32. package/dist/types/sdk/bus/config-commands.d.ts +2 -2
  33. package/dist/types/sdk/bus/config.d.ts +2 -0
  34. package/dist/types/sdk/bus/conversation-store.d.ts +1 -0
  35. package/dist/types/sdk/bus/index.d.ts +25 -0
  36. package/dist/types/sdk/bus/notification-orchestration.d.ts +1 -0
  37. package/dist/types/sdk/bus/prompt-reconciliation.d.ts +105 -0
  38. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +13 -3
  39. package/dist/types/sdk/bus/telegram-daemon-control.d.ts +5 -1
  40. package/dist/types/sdk/bus/telegram-daemon.d.ts +128 -1
  41. package/dist/types/sdk/bus/telegram-reference.d.ts +2 -0
  42. package/dist/types/sdk/host/control/operations.d.ts +1 -1
  43. package/dist/types/sdk/host/host.d.ts +1 -1
  44. package/dist/types/sdk/host/query/handlers.d.ts +9 -0
  45. package/dist/types/sdk/index.d.ts +2 -0
  46. package/dist/types/sdk/prompt-status.d.ts +88 -0
  47. package/dist/types/sdk/session-directory.d.ts +1 -1
  48. package/dist/types/sdk/startup-capability.d.ts +3 -0
  49. package/dist/types/session/agent-session.d.ts +2 -0
  50. package/dist/types/session/internal/managed-session-scope.d.ts +11 -2
  51. package/dist/types/session/internal/managed-session-storage.d.ts +17 -2
  52. package/dist/types/session/internal/native-publish-outcome.d.ts +48 -0
  53. package/dist/types/session/session-storage.d.ts +18 -0
  54. package/dist/types/task/index.d.ts +3 -1
  55. package/dist/types/task/receipt.d.ts +2 -0
  56. package/dist/types/task/types.d.ts +94 -0
  57. package/dist/types/tools/ask.d.ts +454 -174
  58. package/dist/types/tools/image-gen.d.ts +47 -1
  59. package/dist/types/tools/index.d.ts +4 -0
  60. package/dist/types/utils/prompt-suggestion.d.ts +33 -0
  61. package/package.json +8 -8
  62. package/scripts/capture-platform-shortcut-labels-showcase.ts +342 -0
  63. package/scripts/dogfood-repository-binding.ts +209 -0
  64. package/scripts/generate-sdk-operation-inventory.ts +2 -0
  65. package/scripts/run-test-manifest.ts +4 -4
  66. package/src/cli/args.ts +2 -92
  67. package/src/cli/notify-cli.ts +5 -38
  68. package/src/cli.ts +18 -0
  69. package/src/commands/sdk.ts +2 -2
  70. package/src/config/keybindings.ts +157 -24
  71. package/src/config/model-profile-activation.ts +7 -18
  72. package/src/config/model-profile-contract.ts +161 -0
  73. package/src/config/model-registry.ts +11 -1
  74. package/src/config/settings-schema.ts +17 -2
  75. package/src/coordinator-mcp/model-preset.ts +21 -74
  76. package/src/defaults/gjc/skills/deep-interview/SKILL.md +2 -2
  77. package/src/defaults/gjc/skills/ralplan/SKILL.md +3 -1
  78. package/src/edit/index.ts +3 -6
  79. package/src/edit/modes/patch.ts +38 -1
  80. package/src/edit/modes/replace.ts +42 -0
  81. package/src/edit/path-mutation-lock.ts +112 -0
  82. package/src/eval/py/executor.ts +30 -11
  83. package/src/eval/py/prelude.py +2 -2
  84. package/src/eval/py/tool-bridge.ts +34 -18
  85. package/src/extensibility/gjc-plugins/runtime-adapters.ts +2 -1
  86. package/src/gjc-runtime/launch-tmux.ts +1 -1
  87. package/src/gjc-runtime/managed-owner-supervisor.ts +83 -4
  88. package/src/gjc-runtime/ralplan-runtime.ts +75 -3
  89. package/src/gjc-runtime/repository-binding.ts +267 -0
  90. package/src/gjc-runtime/session-state-sidecar.ts +25 -9
  91. package/src/gjc-runtime/tmux-owner-isolation.ts +2 -1
  92. package/src/gjc-runtime/tmux-sessions.ts +45 -6
  93. package/src/gjc-runtime/ultragoal-guard.ts +5 -5
  94. package/src/gjc-runtime/ultragoal-runtime.ts +181 -19
  95. package/src/internal-urls/docs-index.generated.ts +6 -5
  96. package/src/internal-urls/local-protocol.ts +33 -16
  97. package/src/internal-urls/mcp-protocol.ts +73 -11
  98. package/src/main.ts +25 -10
  99. package/src/modes/DESIGN.md +5 -0
  100. package/src/modes/acp/acp-agent.ts +50 -16
  101. package/src/modes/components/model-selector.ts +42 -8
  102. package/src/modes/components/plan-preview-overlay.ts +1 -1
  103. package/src/modes/components/runtime-mcp-add-wizard.ts +5 -0
  104. package/src/modes/components/tool-status-header.ts +20 -4
  105. package/src/modes/components/welcome.ts +22 -18
  106. package/src/modes/controllers/command-controller.ts +97 -54
  107. package/src/modes/controllers/event-controller.ts +10 -0
  108. package/src/modes/controllers/input-controller.ts +7 -2
  109. package/src/modes/controllers/runtime-mcp-command-controller.ts +29 -6
  110. package/src/modes/controllers/selector-controller.ts +46 -54
  111. package/src/modes/interactive-mode.ts +41 -27
  112. package/src/modes/prompt-action-autocomplete.ts +32 -13
  113. package/src/modes/prompt-suggestion-controller.ts +96 -0
  114. package/src/modes/shared/agent-wire/workflow-gate-broker.ts +2 -2
  115. package/src/modes/types.ts +3 -0
  116. package/src/modes/utils/hotkeys-markdown.ts +64 -36
  117. package/src/modes/utils/ui-helpers.ts +5 -3
  118. package/src/prompts/agents/architect.md +0 -1
  119. package/src/prompts/agents/critic.md +0 -1
  120. package/src/prompts/system/prompt-suggestion-system.md +32 -0
  121. package/src/prompts/system/system-prompt.md +6 -4
  122. package/src/prompts/tools/cron.md +3 -1
  123. package/src/runtime-mcp/manager.ts +51 -53
  124. package/src/runtime-mcp/oauth-flow.ts +0 -72
  125. package/src/runtime-mcp/plugin-network-boundary.ts +101 -0
  126. package/src/runtime-mcp/transports/http.ts +13 -6
  127. package/src/sdk/broker/broker.ts +34 -20
  128. package/src/sdk/broker/lifecycle.ts +185 -36
  129. package/src/sdk/bus/chat-daemon-control.ts +18 -5
  130. package/src/sdk/bus/config-commands.ts +2 -2
  131. package/src/sdk/bus/config.ts +9 -1
  132. package/src/sdk/bus/conversation-store.ts +40 -6
  133. package/src/sdk/bus/index.ts +240 -65
  134. package/src/sdk/bus/lifecycle-commands.ts +47 -3
  135. package/src/sdk/bus/lifecycle-control-runtime.ts +11 -2
  136. package/src/sdk/bus/lifecycle-orchestrator.ts +32 -1
  137. package/src/sdk/bus/notification-orchestration.ts +12 -0
  138. package/src/sdk/bus/notification-service.ts +27 -2
  139. package/src/sdk/bus/prompt-reconciliation.ts +239 -0
  140. package/src/sdk/bus/recent-activity.ts +90 -26
  141. package/src/sdk/bus/telegram-daemon-contract.ts +13 -3
  142. package/src/sdk/bus/telegram-daemon-control.ts +145 -33
  143. package/src/sdk/bus/telegram-daemon.ts +835 -110
  144. package/src/sdk/bus/telegram-reference.ts +20 -2
  145. package/src/sdk/cli/session-cli.ts +15 -2
  146. package/src/sdk/host/control/dispatch.ts +1 -1
  147. package/src/sdk/host/control/operations.ts +1 -1
  148. package/src/sdk/host/host.ts +2 -6
  149. package/src/sdk/host/query/handlers.ts +70 -5
  150. package/src/sdk/index.ts +12 -0
  151. package/src/sdk/prompt-status.ts +97 -0
  152. package/src/sdk/protocol/operation-inventory.generated.json +47 -0
  153. package/src/sdk/protocol/operation-registry.ts +18 -4
  154. package/src/sdk/session-directory.ts +5 -1
  155. package/src/sdk/session.ts +2 -0
  156. package/src/sdk/startup-capability.ts +9 -1
  157. package/src/session/agent-session.ts +52 -5
  158. package/src/session/blob-store.ts +7 -2
  159. package/src/session/internal/managed-session-scope.ts +854 -84
  160. package/src/session/internal/managed-session-storage.ts +251 -199
  161. package/src/session/internal/native-publish-outcome.ts +266 -0
  162. package/src/session/session-manager.ts +310 -327
  163. package/src/session/session-storage.ts +128 -11
  164. package/src/task/gjc-command.ts +2 -2
  165. package/src/task/index.ts +121 -15
  166. package/src/task/receipt.ts +3 -0
  167. package/src/task/types.ts +34 -3
  168. package/src/tools/ask.ts +198 -88
  169. package/src/tools/ast-edit.ts +2 -2
  170. package/src/tools/bash-pty-selection.ts +2 -2
  171. package/src/tools/browser/screenshot-format.ts +6 -1
  172. package/src/tools/cron.ts +1 -1
  173. package/src/tools/image-gen.ts +178 -6
  174. package/src/tools/index.ts +4 -0
  175. package/src/tools/render-utils.ts +7 -1
  176. package/src/utils/edit-mode.ts +2 -2
  177. package/src/utils/prompt-suggestion.ts +265 -0
  178. package/src/utils/sixel.ts +3 -3
  179. package/src/web/insane/url-guard.ts +3 -1
  180. package/src/web/scrapers/docs-rs.ts +30 -5
@@ -245,6 +245,7 @@ import { loadActiveSubskillTools } from "../extensibility/gjc-plugins/tools";
245
245
  import type { HookCommandContext } from "../extensibility/hooks/types";
246
246
  import { buildSkillPromptMessage, type Skill, type SkillWarning } from "../extensibility/skills";
247
247
  import { expandSlashCommand, type FileSlashCommand } from "../extensibility/slash-commands";
248
+ import { assertDeepInterviewIntentManifest } from "../gjc-runtime/deep-interview-state";
248
249
  import { buildGjcRuntimeSessionEnv, consumePendingGoalModeRequest } from "../gjc-runtime/goal-mode-request";
249
250
  import {
250
251
  assertNonEmptyGjcSessionId,
@@ -252,6 +253,7 @@ import {
252
253
  sessionStateDir,
253
254
  } from "../gjc-runtime/session-layout";
254
255
  import {
256
+ ownerTerminalContextFromEnvironment,
255
257
  persistCoordinatorRuntimeStateFromEvent,
256
258
  registerCoordinatorRuntimeStateFinalizer,
257
259
  } from "../gjc-runtime/session-state-sidecar";
@@ -260,7 +262,7 @@ import { GoalRuntime } from "../goals/runtime";
260
262
  import type { Goal, GoalModeState } from "../goals/state";
261
263
  import type { HindsightSessionState } from "../hindsight/state";
262
264
  import { buildSkillStopOutput, ensureWorkflowSkillActivationState } from "../hooks/skill-state";
263
- import { type LocalProtocolOptions, resolveLocalUrlToPath } from "../internal-urls";
265
+ import { initializeLocalRoot, type LocalProtocolOptions, resolveLocalUrlToPath } from "../internal-urls";
264
266
  import { shutdownAll as shutdownAllLspClients } from "../lsp/client";
265
267
  import { resolveMemoryBackend } from "../memory-backend";
266
268
  import {
@@ -1668,6 +1670,7 @@ export class AgentSession {
1668
1670
 
1669
1671
  #skillsSettings: SkillsSettings | undefined;
1670
1672
  #activeSkillState: { skill: string; sessionId?: string } | undefined;
1673
+ #restoredWorkflowSkillState: { skill: string; sessionId: string } | undefined;
1671
1674
 
1672
1675
  // Model registry for API key resolution
1673
1676
  #modelRegistry: ModelRegistry;
@@ -2487,6 +2490,34 @@ export class AgentSession {
2487
2490
  return undefined;
2488
2491
  }
2489
2492
  }
2493
+ /** Provider-facing ask metadata must expose only the active deep-interview phase. */
2494
+ getDeepInterviewAskStage(): "topology" | "post-topology" | undefined {
2495
+ const currentSessionId = this.sessionManager.getSessionId();
2496
+ const inMemory = this.#activeSkillState;
2497
+ const active =
2498
+ inMemory && (!inMemory.sessionId || inMemory.sessionId === currentSessionId)
2499
+ ? inMemory
2500
+ : this.#restoredWorkflowSkillState?.sessionId === currentSessionId
2501
+ ? this.#restoredWorkflowSkillState
2502
+ : undefined;
2503
+ if (active?.skill !== "deep-interview") return undefined;
2504
+ try {
2505
+ assertNonEmptyGjcSessionId(currentSessionId, "AgentSession.getDeepInterviewAskStage");
2506
+ const stateDir = sessionStateDir(this.sessionManager.getCwd(), currentSessionId);
2507
+ const filePath = path.join(
2508
+ stateDir,
2509
+ path.basename(sessionModeStatePath(this.sessionManager.getCwd(), currentSessionId, active.skill)),
2510
+ );
2511
+ const raw = fs.readFileSync(filePath, "utf-8");
2512
+ const parsed = JSON.parse(raw) as { state?: { intent_contract?: unknown } };
2513
+ const intentContract = parsed.state?.intent_contract;
2514
+ if (intentContract === undefined) return "topology";
2515
+ assertDeepInterviewIntentManifest(intentContract);
2516
+ return "post-topology";
2517
+ } catch {
2518
+ return undefined;
2519
+ }
2520
+ }
2490
2521
 
2491
2522
  /** Peek the in-flight directive's invocation handler for use by the resolve tool. */
2492
2523
  peekQueueInvoker(): ((input: unknown) => Promise<unknown> | unknown) | undefined {
@@ -4553,6 +4584,8 @@ export class AgentSession {
4553
4584
  return {
4554
4585
  getArtifactsDir: () => this.sessionManager.getArtifactsDir(),
4555
4586
  isManagedDestination: () => this.sessionManager.isManagedDestination(),
4587
+ // Required for verified legacy local:// migration on managed sessions (#2797 / #2925).
4588
+ getManagedLegacyLocalMigrationSource: () => this.sessionManager.getManagedLegacyLocalMigrationSource(),
4556
4589
  getSessionId: () => this.sessionManager.getSessionId(),
4557
4590
  };
4558
4591
  }
@@ -5127,7 +5160,7 @@ export class AgentSession {
5127
5160
  // No-op when this session opened no tabs. Failure is logged, not thrown.
5128
5161
  this.#unregisterResourceGc?.();
5129
5162
  this.#unregisterResourceGc = undefined;
5130
- this.#unregisterRuntimeStateFinalizer?.();
5163
+ if (ownerTerminalContextFromEnvironment() === null) this.#unregisterRuntimeStateFinalizer?.();
5131
5164
  this.#unregisterRuntimeStateFinalizer = undefined;
5132
5165
  await releaseTabsForOwner(this.sessionManager.getSessionId()).catch((error: unknown) =>
5133
5166
  logger.warn("session dispose: releaseTabsForOwner failed", { error }),
@@ -6780,8 +6813,9 @@ export class AgentSession {
6780
6813
  if (!activeSkill) {
6781
6814
  try {
6782
6815
  const activeState = await readVisibleSkillActiveState(this.sessionManager.getCwd(), sessionId);
6783
- activeSkill =
6784
- activeState?.skill ?? activeState?.active_skills?.find(entry => entry.active !== false)?.skill;
6816
+ activeSkill = activeState?.active_skills?.find(
6817
+ entry => entry.active !== false && entry.session_id === sessionId,
6818
+ )?.skill;
6785
6819
  } catch (error) {
6786
6820
  logger.warn("Failed to read durable workflow skill state while restoring ask tool", {
6787
6821
  error: error instanceof Error ? error.message : String(error),
@@ -6793,7 +6827,12 @@ export class AgentSession {
6793
6827
  // a predecessor session's workflow state to the current identity.
6794
6828
  if (this.#isDisposed || this.sessionManager.getSessionId() !== sessionId) return;
6795
6829
  }
6796
- if (activeSkill && isCanonicalGjcWorkflowSkill(activeSkill.trim())) this.#attachAskTool();
6830
+ if (activeSkill && isCanonicalGjcWorkflowSkill(activeSkill.trim())) {
6831
+ if (!inMemoryActiveSkill) this.#restoredWorkflowSkillState = { skill: activeSkill.trim(), sessionId };
6832
+ this.#attachAskTool();
6833
+ } else if (this.#restoredWorkflowSkillState?.sessionId === sessionId) {
6834
+ this.#restoredWorkflowSkillState = undefined;
6835
+ }
6797
6836
  }
6798
6837
 
6799
6838
  #attachAskTool(): void {
@@ -7345,6 +7384,7 @@ export class AgentSession {
7345
7384
  }
7346
7385
  }
7347
7386
  // In-memory tracking keeps `getActiveSkillState` accurate for the chain guard.
7387
+ this.#restoredWorkflowSkillState = undefined;
7348
7388
  this.#activeSkillState = active ? { skill, sessionId } : undefined;
7349
7389
  if (active) {
7350
7390
  await this.refreshGjcSubskillTools();
@@ -14507,6 +14547,13 @@ export class AgentSession {
14507
14547
  await this.sessionManager.ensureOnDisk();
14508
14548
 
14509
14549
  if (switchingToDifferentSession) {
14550
+ // Interactive /resume (and any other switchSession identity change) must
14551
+ // await verified legacy local:// migration for the *new* session before
14552
+ // post-commit session_switch / local path resolution. createAgentSession
14553
+ // already does this at cold start (#2797); switchSession previously omitted
14554
+ // it, so resolving local:// after /resume could fail-closed with
14555
+ // "legacy migration must complete before path resolution" (#2925).
14556
+ await initializeLocalRoot(this.#localProtocolOptions());
14510
14557
  this.#resetHindsightConversationTrackingIfHindsight();
14511
14558
  this.#resetIrcRosterDeliveryState();
14512
14559
  }
@@ -124,8 +124,13 @@ export class BlobStore {
124
124
  },
125
125
  };
126
126
 
127
- await Bun.write(blobPath, data);
128
- await fsp.chmod(blobPath, BLOB_FILE_MODE);
127
+ // Create the blob directory 0700 and the file 0600 at creation, mirroring
128
+ // putSync/putImmutableSync. The previous Bun.write let the parent dir be
129
+ // created with the process umask (e.g. 0755) and the file at 0644 before a
130
+ // follow-up chmod, violating the owner-only contract above and leaving a
131
+ // group/other-readable window a managed-tree snapshot fails closed on.
132
+ await fsp.mkdir(this.dir, { recursive: true, mode: BLOB_DIR_MODE });
133
+ await fsp.writeFile(blobPath, data, { mode: BLOB_FILE_MODE });
129
134
  return result;
130
135
  }
131
136