@gajae-code/coding-agent 0.12.0 → 0.12.2

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 (247) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/dist/types/async/job-manager.d.ts +17 -3
  3. package/dist/types/config/settings-schema.d.ts +56 -2
  4. package/dist/types/exa/mcp-client.d.ts +10 -1
  5. package/dist/types/exec/bash-executor.d.ts +45 -12
  6. package/dist/types/extensibility/extensions/types.d.ts +16 -2
  7. package/dist/types/extensibility/gjc-plugins/index.d.ts +12 -2
  8. package/dist/types/extensibility/gjc-plugins/installer.d.ts +63 -7
  9. package/dist/types/extensibility/gjc-plugins/lifecycle-reconciliation.d.ts +55 -0
  10. package/dist/types/extensibility/gjc-plugins/lifecycle.d.ts +64 -0
  11. package/dist/types/extensibility/gjc-plugins/runtime-quarantine.d.ts +67 -0
  12. package/dist/types/extensibility/gjc-plugins/session-validation.d.ts +3 -1
  13. package/dist/types/extensibility/gjc-plugins/types.d.ts +124 -0
  14. package/dist/types/gjc-runtime/launch-tmux.d.ts +1 -0
  15. package/dist/types/gjc-runtime/ralplan-review-conflicts.d.ts +114 -0
  16. package/dist/types/gjc-runtime/ralplan-runtime.d.ts +23 -3
  17. package/dist/types/gjc-runtime/team-launch.d.ts +1 -1
  18. package/dist/types/gjc-runtime/team-runtime.d.ts +25 -0
  19. package/dist/types/gjc-runtime/team-worker-heartbeat.d.ts +43 -0
  20. package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +10 -0
  21. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +37 -80
  22. package/dist/types/modes/acp/acp-agent.d.ts +2 -19
  23. package/dist/types/modes/components/gjc-bundle-settings.d.ts +34 -0
  24. package/dist/types/modes/components/irc-sidebar.d.ts +16 -0
  25. package/dist/types/modes/components/notifications-settings-editor.d.ts +1 -0
  26. package/dist/types/modes/components/session-observer-overlay.d.ts +18 -0
  27. package/dist/types/modes/components/settings-selector.d.ts +9 -0
  28. package/dist/types/modes/components/status-line/gh.d.ts +5 -0
  29. package/dist/types/modes/components/transcript-viewer-overlay.d.ts +18 -1
  30. package/dist/types/modes/controllers/command-controller.d.ts +1 -1
  31. package/dist/types/modes/controllers/event-controller.d.ts +1 -1
  32. package/dist/types/modes/controllers/extension-ui-controller.d.ts +2 -1
  33. package/dist/types/modes/controllers/selector-controller.d.ts +1 -1
  34. package/dist/types/modes/interactive-mode.d.ts +9 -0
  35. package/dist/types/modes/theme/theme.d.ts +3 -1
  36. package/dist/types/modes/types.d.ts +32 -0
  37. package/dist/types/reminders/star-reminder.d.ts +3 -13
  38. package/dist/types/runtime-mcp/manager.d.ts +1 -0
  39. package/dist/types/sdk/acp/adapter.d.ts +3 -1
  40. package/dist/types/sdk/broker/transport.d.ts +2 -0
  41. package/dist/types/sdk/bus/attachment-registry.d.ts +1 -0
  42. package/dist/types/sdk/bus/chat-daemon-control.d.ts +5 -1
  43. package/dist/types/sdk/bus/config.d.ts +6 -2
  44. package/dist/types/sdk/bus/index.d.ts +29 -0
  45. package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +8 -1
  46. package/dist/types/sdk/bus/lifecycle-control-runtime.d.ts +4 -0
  47. package/dist/types/sdk/bus/reconciliation-store.d.ts +7 -3
  48. package/dist/types/sdk/bus/rich-draft.d.ts +1 -0
  49. package/dist/types/sdk/bus/rich-render.d.ts +2 -0
  50. package/dist/types/sdk/bus/telegram-adoption-intent.d.ts +165 -0
  51. package/dist/types/sdk/bus/telegram-cli.d.ts +12 -0
  52. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +12 -4
  53. package/dist/types/sdk/bus/telegram-daemon.d.ts +25 -1
  54. package/dist/types/sdk/bus/telegram-reference.d.ts +11 -1
  55. package/dist/types/sdk/bus/threaded-render.d.ts +3 -2
  56. package/dist/types/sdk/bus/topic-registry.d.ts +11 -1
  57. package/dist/types/sdk/host/query/revision-store.d.ts +2 -0
  58. package/dist/types/sdk/host/reverse-leases.d.ts +1 -1
  59. package/dist/types/sdk/prompt-status.d.ts +23 -3
  60. package/dist/types/sdk/session.d.ts +6 -0
  61. package/dist/types/session/agent-session.d.ts +40 -2
  62. package/dist/types/session/artifacts.d.ts +8 -0
  63. package/dist/types/session/blob-store.d.ts +57 -4
  64. package/dist/types/session/internal/managed-session-storage.d.ts +30 -4
  65. package/dist/types/session/session-manager.d.ts +23 -6
  66. package/dist/types/session/session-storage.d.ts +4 -0
  67. package/dist/types/session/streaming-output.d.ts +36 -7
  68. package/dist/types/setup/credential-import.d.ts +12 -0
  69. package/dist/types/skill-state/active-state.d.ts +12 -0
  70. package/dist/types/skill-state/workflow-hud.d.ts +6 -0
  71. package/dist/types/task/executor.d.ts +3 -2
  72. package/dist/types/task/index.d.ts +7 -1
  73. package/dist/types/task/output-manager.d.ts +1 -0
  74. package/dist/types/task/provider-retry-status.d.ts +8 -0
  75. package/dist/types/task/receipt.d.ts +9 -1
  76. package/dist/types/task/types.d.ts +23 -0
  77. package/dist/types/tools/ask-answer-registry.d.ts +2 -2
  78. package/dist/types/tools/bash-interactive.d.ts +4 -1
  79. package/dist/types/tools/bash.d.ts +3 -1
  80. package/dist/types/tools/image-gen.d.ts +4 -0
  81. package/dist/types/tools/index.d.ts +6 -0
  82. package/dist/types/tools/output-meta.d.ts +23 -2
  83. package/dist/types/tools/path-utils.d.ts +1 -0
  84. package/dist/types/tools/read.d.ts +0 -6
  85. package/dist/types/tools/review.d.ts +5 -7
  86. package/dist/types/tools/subagent.d.ts +2 -0
  87. package/dist/types/utils/gh.d.ts +13 -0
  88. package/dist/types/utils/image-resize.d.ts +1 -0
  89. package/dist/types/web/search/providers/kimi.d.ts +2 -0
  90. package/dist/types/web/search/providers/searxng.d.ts +7 -0
  91. package/dist/types/web/search/providers/xai.d.ts +2 -0
  92. package/package.json +10 -8
  93. package/scripts/acp-conformance-agent.ts +218 -0
  94. package/scripts/capture-gjc-bundle-settings.ts +306 -0
  95. package/scripts/dogfood-ralplan-review-conflicts.ts +272 -0
  96. package/scripts/generate-sdk-operation-inventory.ts +5 -0
  97. package/scripts/resident-memory-bench.ts +1341 -0
  98. package/scripts/run-acp-conformance.ts +290 -0
  99. package/src/async/job-manager.ts +99 -39
  100. package/src/cli/fast-help.ts +1 -1
  101. package/src/cli/plugin-cli.ts +176 -18
  102. package/src/commands/team.ts +19 -1
  103. package/src/config/file-lock.ts +11 -2
  104. package/src/config/settings-schema.ts +53 -2
  105. package/src/coordinator-mcp/question-gate-codec.ts +1 -1
  106. package/src/coordinator-mcp/server.ts +5 -12
  107. package/src/debug/index.ts +42 -17
  108. package/src/defaults/gjc/skills/deep-interview/SKILL.md +1 -0
  109. package/src/defaults/gjc/skills/ralplan/SKILL.md +25 -20
  110. package/src/defaults/gjc/skills/team/SKILL.md +2 -0
  111. package/src/defaults/gjc/skills/ultragoal/SKILL.md +39 -26
  112. package/src/defaults/gjc/skills/ultragoal/validation-batch-contracts.md +12 -0
  113. package/src/defaults/gjc-defaults.ts +4 -4
  114. package/src/exa/mcp-client.ts +12 -3
  115. package/src/exec/bash-executor.ts +144 -27
  116. package/src/extensibility/extensions/runner.ts +15 -0
  117. package/src/extensibility/extensions/types.ts +18 -1
  118. package/src/extensibility/gjc-plugins/constrained-hooks.ts +8 -2
  119. package/src/extensibility/gjc-plugins/index.ts +19 -2
  120. package/src/extensibility/gjc-plugins/installer.ts +189 -50
  121. package/src/extensibility/gjc-plugins/lifecycle-reconciliation.ts +199 -0
  122. package/src/extensibility/gjc-plugins/lifecycle.ts +626 -0
  123. package/src/extensibility/gjc-plugins/observability.ts +3 -3
  124. package/src/extensibility/gjc-plugins/prompt-appendix.ts +5 -1
  125. package/src/extensibility/gjc-plugins/runtime-adapters.ts +12 -2
  126. package/src/extensibility/gjc-plugins/runtime-quarantine.ts +121 -0
  127. package/src/extensibility/gjc-plugins/schema.ts +84 -12
  128. package/src/extensibility/gjc-plugins/session-validation.ts +9 -3
  129. package/src/extensibility/gjc-plugins/types.ts +141 -0
  130. package/src/extensibility/gjc-plugins/validation.ts +9 -0
  131. package/src/gjc-runtime/launch-tmux.ts +25 -6
  132. package/src/gjc-runtime/launch-worktree.ts +103 -1
  133. package/src/gjc-runtime/ledger-event-renderer.ts +1 -0
  134. package/src/gjc-runtime/managed-owner-admission.ts +1 -1
  135. package/src/gjc-runtime/ralplan-review-conflicts.ts +472 -0
  136. package/src/gjc-runtime/ralplan-runtime.ts +491 -27
  137. package/src/gjc-runtime/team-launch.ts +8 -0
  138. package/src/gjc-runtime/team-runtime.ts +140 -32
  139. package/src/gjc-runtime/team-worker-heartbeat.ts +149 -0
  140. package/src/gjc-runtime/tmux-owner-isolation.ts +10 -0
  141. package/src/gjc-runtime/tmux-sessions.ts +58 -13
  142. package/src/gjc-runtime/ultragoal-evidence.ts +6 -74
  143. package/src/gjc-runtime/ultragoal-runtime.ts +635 -612
  144. package/src/gjc-runtime/workflow-manifest.generated.json +37 -99
  145. package/src/gjc-runtime/workflow-manifest.ts +21 -70
  146. package/src/internal-urls/docs-index.generated.ts +16 -16
  147. package/src/modes/DESIGN.md +104 -0
  148. package/src/modes/acp/acp-agent.ts +298 -186
  149. package/src/modes/components/gjc-bundle-settings.ts +508 -0
  150. package/src/modes/components/irc-sidebar.ts +30 -1
  151. package/src/modes/components/notifications-settings-editor.ts +12 -1
  152. package/src/modes/components/oauth-selector.ts +68 -30
  153. package/src/modes/components/session-observer-overlay.ts +305 -86
  154. package/src/modes/components/settings-selector.ts +56 -5
  155. package/src/modes/components/status-line/gh.ts +16 -0
  156. package/src/modes/components/tool-status-header.ts +3 -15
  157. package/src/modes/components/transcript-viewer-overlay.ts +99 -24
  158. package/src/modes/controllers/command-controller.ts +42 -34
  159. package/src/modes/controllers/event-controller.ts +27 -16
  160. package/src/modes/controllers/extension-ui-controller.ts +193 -34
  161. package/src/modes/controllers/selector-controller.ts +160 -22
  162. package/src/modes/interactive-mode.ts +189 -62
  163. package/src/modes/jobs-observer.ts +1 -1
  164. package/src/modes/runtime-init.ts +3 -0
  165. package/src/modes/theme/theme.ts +11 -9
  166. package/src/modes/types.ts +88 -0
  167. package/src/prompts/agent-fragments/ralplan-persistence.md +4 -3
  168. package/src/prompts/system/eager-todo.md +8 -4
  169. package/src/prompts/system/system-prompt.md +11 -4
  170. package/src/prompts/tools/bash.md +5 -5
  171. package/src/prompts/tools/search-tool-bm25.md +5 -0
  172. package/src/prompts/tools/task.md +1 -1
  173. package/src/reminders/star-reminder.ts +4 -42
  174. package/src/runtime-mcp/manager.ts +19 -4
  175. package/src/sdk/acp/adapter.ts +22 -6
  176. package/src/sdk/broker/lifecycle.ts +18 -13
  177. package/src/sdk/broker/transport.ts +35 -3
  178. package/src/sdk/bus/attachment-registry.ts +5 -1
  179. package/src/sdk/bus/chat-daemon-cli.ts +4 -39
  180. package/src/sdk/bus/chat-daemon-control.ts +7 -3
  181. package/src/sdk/bus/config.ts +18 -2
  182. package/src/sdk/bus/index.ts +661 -126
  183. package/src/sdk/bus/kind-aware-reconciliation.ts +148 -73
  184. package/src/sdk/bus/lifecycle-commands.ts +4 -1
  185. package/src/sdk/bus/lifecycle-control-runtime.ts +403 -88
  186. package/src/sdk/bus/reconciliation-store.ts +95 -16
  187. package/src/sdk/bus/rich-draft.ts +1 -1
  188. package/src/sdk/bus/rich-render.ts +2 -2
  189. package/src/sdk/bus/telegram-adoption-intent.ts +574 -0
  190. package/src/sdk/bus/telegram-cli.ts +33 -8
  191. package/src/sdk/bus/telegram-daemon-cli.ts +1 -0
  192. package/src/sdk/bus/telegram-daemon-contract.ts +12 -4
  193. package/src/sdk/bus/telegram-daemon.ts +916 -23
  194. package/src/sdk/bus/telegram-reference.ts +40 -3
  195. package/src/sdk/bus/threaded-render.ts +48 -3
  196. package/src/sdk/bus/topic-registry.ts +20 -0
  197. package/src/sdk/host/query/revision-store.ts +36 -2
  198. package/src/sdk/host/reverse-leases.ts +44 -7
  199. package/src/sdk/prompt-status.ts +16 -3
  200. package/src/sdk/protocol/operation-inventory.generated.json +33 -0
  201. package/src/sdk/session.ts +89 -9
  202. package/src/session/agent-session.ts +844 -173
  203. package/src/session/artifacts.ts +22 -0
  204. package/src/session/auth-broker-config.ts +10 -3
  205. package/src/session/blob-store.ts +915 -24
  206. package/src/session/internal/managed-session-scope.ts +200 -111
  207. package/src/session/internal/managed-session-storage.ts +492 -62
  208. package/src/session/session-manager.ts +1614 -435
  209. package/src/session/session-storage.ts +38 -45
  210. package/src/session/streaming-output.ts +238 -68
  211. package/src/setup/credential-import.ts +75 -13
  212. package/src/skill-state/active-state.ts +32 -0
  213. package/src/skill-state/workflow-hud.ts +17 -0
  214. package/src/skill-state/workflow-mutation-guard.ts +496 -2
  215. package/src/task/executor.ts +122 -39
  216. package/src/task/index.ts +280 -45
  217. package/src/task/output-manager.ts +24 -14
  218. package/src/task/provider-retry-status.ts +16 -0
  219. package/src/task/receipt.ts +34 -8
  220. package/src/task/render.ts +6 -2
  221. package/src/task/types.ts +108 -0
  222. package/src/tools/ask-answer-registry.ts +12 -6
  223. package/src/tools/ask.ts +86 -55
  224. package/src/tools/ast-edit.ts +1 -0
  225. package/src/tools/ast-grep.ts +1 -0
  226. package/src/tools/bash-interactive.ts +8 -3
  227. package/src/tools/bash.ts +503 -60
  228. package/src/tools/find.ts +1 -0
  229. package/src/tools/image-gen.ts +29 -5
  230. package/src/tools/index.ts +6 -0
  231. package/src/tools/output-meta.ts +108 -14
  232. package/src/tools/path-utils.ts +3 -2
  233. package/src/tools/read.ts +18 -0
  234. package/src/tools/review.ts +5 -7
  235. package/src/tools/search.ts +1 -0
  236. package/src/tools/subagent-render.ts +6 -2
  237. package/src/tools/subagent.ts +6 -0
  238. package/src/tools/telegram-send.ts +6 -3
  239. package/src/utils/gh.ts +39 -0
  240. package/src/utils/image-resize.ts +3 -0
  241. package/src/web/search/providers/anthropic.ts +4 -4
  242. package/src/web/search/providers/kimi.ts +15 -5
  243. package/src/web/search/providers/searxng.ts +47 -4
  244. package/src/web/search/providers/xai.ts +7 -2
  245. package/dist/types/gjc-runtime/ultragoal-pipeline.d.ts +0 -23
  246. package/src/defaults/gjc/skills/ultragoal/pipeline-validation-contracts.md +0 -30
  247. package/src/gjc-runtime/ultragoal-pipeline.ts +0 -306
@@ -0,0 +1,55 @@
1
+ import { type GjcBundleIdentity, type GjcPluginQuarantineEntry, type GjcPluginRegistryEntry, type GjcPluginScope, type NormalizedGjcPluginBundle, type NormalizedGjcPluginSurfaces } from "./types";
2
+ export declare function bundleIdentity(scope: GjcPluginScope, name: string): GjcBundleIdentity;
3
+ export declare function identityKey(identity: GjcBundleIdentity): string;
4
+ export declare function identityEquals(a: GjcBundleIdentity, b: GjcBundleIdentity): boolean;
5
+ /** All stable surface IDs of a surface set, sorted and de-duplicated. */
6
+ export declare function surfaceIdsOf(surfaces: NormalizedGjcPluginSurfaces): string[];
7
+ /**
8
+ * Fingerprint of the exact installed target: identity plus the persisted bytes
9
+ * that any update must not silently replace.
10
+ */
11
+ export declare function targetFingerprint(entry: GjcPluginRegistryEntry): string;
12
+ /**
13
+ * Fingerprint of the exact installed baseline an update compares against: the
14
+ * installed content, the persisted enablement intent it must carry forward,
15
+ * and the stored source descriptor the update re-resolves from.
16
+ *
17
+ * Toggling the bundle or any surface changes this, so a preview taken before
18
+ * the toggle can no longer be applied. Binding the source matters just as much:
19
+ * apply re-resolves `entry.source.uri` before taking the locks, so a descriptor
20
+ * that changed in between must invalidate the reviewed baseline rather than let
21
+ * an update be committed from a locator the reviewer never saw.
22
+ */
23
+ export declare function baselineFingerprint(entry: GjcPluginRegistryEntry): string;
24
+ /** Fingerprint of an update candidate before it is written anywhere. */
25
+ export declare function candidateFingerprint(scope: GjcPluginScope, bundle: NormalizedGjcPluginBundle): string;
26
+ /**
27
+ * Fingerprint of everything besides the target and candidate bytes that the
28
+ * update decision depended on: opposite-scope same-name entries and the
29
+ * effective collision universe.
30
+ */
31
+ export declare function decisionContextFingerprint(target: GjcBundleIdentity, effectiveEntries: readonly GjcPluginRegistryEntry[]): string;
32
+ /**
33
+ * Fingerprint of the inputs that decide live activation. Changes here (and only
34
+ * here) advance the activation generation.
35
+ */
36
+ export declare function activationFingerprint(entries: readonly GjcPluginRegistryEntry[]): string;
37
+ export interface ReconciledEnablement {
38
+ disabledSurfaceIds: string[];
39
+ quarantine: GjcPluginQuarantineEntry[];
40
+ }
41
+ /**
42
+ * Carry persisted enablement intent across an update:
43
+ * - surviving disabled IDs stay disabled,
44
+ * - IDs whose surface disappeared are dropped,
45
+ * - new surface IDs are enabled by omission,
46
+ * - quarantine is recomputed from candidateQuarantine against the candidate's
47
+ * surface set; omitted input means no candidate quarantine is justified.
48
+ */
49
+ export declare function reconcileEnablement(previousDisabledSurfaceIds: readonly string[], candidateSurfaceIds: readonly string[], candidateQuarantine?: readonly GjcPluginQuarantineEntry[]): ReconciledEnablement;
50
+ export interface SurfaceDelta {
51
+ addedSurfaceIds: string[];
52
+ removedSurfaceIds: string[];
53
+ retainedSurfaceIds: string[];
54
+ }
55
+ export declare function diffSurfaceIds(currentSurfaceIds: readonly string[], candidateSurfaceIds: readonly string[]): SurfaceDelta;
@@ -0,0 +1,64 @@
1
+ import type { GjcBundleIdentity, GjcBundleSummary, GjcInstallResult, GjcLifecycleResult, GjcPluginRegistryEntry, GjcPluginRegistrySource, GjcPluginScope, GjcReviewedUpdateToken, GjcToggleResult, GjcUpdateApplyResult, GjcUpdatePreview } from "./types";
2
+ /**
3
+ * GJC bundle lifecycle service.
4
+ *
5
+ * This module is the ONLY policy and persistence writer for GJC bundles: fresh
6
+ * install, update preview/apply, bundle enable/disable, and surface
7
+ * enable/disable. Callers (CLI, Settings) never touch the registry writers or
8
+ * the installer transaction directly.
9
+ */
10
+ export interface GjcLifecycleContext {
11
+ cwd: string;
12
+ }
13
+ export declare function redactSourceLocator(source: GjcPluginRegistrySource): string;
14
+ /** Safe, redacted DTO for one installed bundle. */
15
+ export declare function toBundleSummary(entry: GjcPluginRegistryEntry): GjcBundleSummary;
16
+ /**
17
+ * Rebuild the exact locator an update must re-resolve from. A git ref is stored
18
+ * separately from the URI, so re-resolving the bare URI would silently drop the
19
+ * reviewed branch or tag and update from the default branch instead.
20
+ */
21
+ declare function storedSourceLocator(source: GjcPluginRegistrySource): string;
22
+ /** Exposed for locator-reconstruction tests; not part of the lifecycle API. */
23
+ export declare const storedSourceLocatorForTest: typeof storedSourceLocator;
24
+ /** Exposed so a test can pin parity with the installer's source predicates. */
25
+ export declare const isLocalDirectorySourceForTest: typeof isLocalDirectorySource;
26
+ /** All installed bundles across both scopes, deterministically ordered. */
27
+ export declare function listGjcBundles(ctx: GjcLifecycleContext): Promise<GjcBundleSummary[]>;
28
+ /** One bundle by exact (scope, name) identity. Opposite scope never matches. */
29
+ export declare function getGjcBundle(ctx: GjcLifecycleContext, identity: GjcBundleIdentity): Promise<GjcLifecycleResult<GjcBundleSummary>>;
30
+ /**
31
+ * True only for strings the installer would treat as a local path rather than
32
+ * a remote locator. This deliberately mirrors the installer's own `looksLikeGit`
33
+ * predicate: if the two ever disagreed, a remote locator could be read as a
34
+ * relative path and shadowed by a local directory of the same shape.
35
+ */
36
+ declare function isLocalDirectorySource(source: string): boolean;
37
+ /**
38
+ * Fresh install only. An existing target in the same scope is create-only and
39
+ * is refused identically with or without force; upgrading is a separate,
40
+ * scope-qualified operation.
41
+ */
42
+ export declare function installGjcBundle(ctx: GjcLifecycleContext, scope: GjcPluginScope, source: string): Promise<GjcLifecycleResult<GjcInstallResult>>;
43
+ /**
44
+ * Re-resolve the stored source descriptor and describe what an update would do.
45
+ * The returned token binds the candidate, the exact installed baseline, and the
46
+ * deterministic decision context; apply is a compare-and-swap on all three.
47
+ */
48
+ export declare function previewGjcBundleUpdate(ctx: GjcLifecycleContext, identity: GjcBundleIdentity): Promise<GjcLifecycleResult<GjcUpdatePreview>>;
49
+ /**
50
+ * Apply a previously reviewed update. Any drift in the candidate bytes, the
51
+ * installed baseline, or the decision context returns a typed stale error with
52
+ * zero mutation.
53
+ */
54
+ export declare function applyGjcBundleUpdate(ctx: GjcLifecycleContext, token: GjcReviewedUpdateToken): Promise<GjcLifecycleResult<GjcUpdateApplyResult>>;
55
+ /**
56
+ * Enable or disable a whole bundle. Deterministic quarantine blocks enabling;
57
+ * disabling is always allowed so operators can always de-escalate.
58
+ */
59
+ export declare function setGjcBundleEnabled(ctx: GjcLifecycleContext, identity: GjcBundleIdentity, enabled: boolean): Promise<GjcLifecycleResult<GjcToggleResult>>;
60
+ /** Enable or disable one surface of a bundle by its stable extension ID. */
61
+ export declare function setGjcBundleSurfaceEnabled(ctx: GjcLifecycleContext, identity: GjcBundleIdentity, surfaceId: string, enabled: boolean): Promise<GjcLifecycleResult<GjcToggleResult>>;
62
+ /** Deterministic activation generation for the current persisted state. */
63
+ export declare function currentActivationFingerprint(ctx: GjcLifecycleContext): Promise<string>;
64
+ export {};
@@ -0,0 +1,67 @@
1
+ import type { GjcBundleIdentity, GjcRuntimeFinding, GjcRuntimeSnapshot, GjcRuntimeSnapshotState } from "./types";
2
+ /**
3
+ * Deterministic numeric activation generation for an activation fingerprint.
4
+ *
5
+ * Equal activation inputs yield an equal generation, so a consumer holding a
6
+ * snapshot can tell whether it still describes the state it is rendering.
7
+ * Derived from the fingerprint's leading hex so it stays inside the safe
8
+ * integer range.
9
+ */
10
+ export declare function gjcActivationGenerationFor(activationFingerprint: string): number;
11
+ /**
12
+ * Caller-owned accumulator for scope-qualified runtime evidence.
13
+ *
14
+ * Producers (loaders, adapters, validators) hand findings to an accumulator
15
+ * they were given; they never publish. Exactly one coordinator publishes a
16
+ * complete generation snapshot, and consumers merge it only when the identity
17
+ * and generation match.
18
+ */
19
+ export declare class GjcRuntimeFindingAccumulator {
20
+ readonly generation: number;
21
+ private readonly findings;
22
+ constructor(generation: number);
23
+ add(finding: GjcRuntimeFinding): void;
24
+ addAll(findings: readonly GjcRuntimeFinding[]): void;
25
+ /** Sorted, de-duplicated snapshot for the generation this accumulator owns. */
26
+ snapshot(): GjcRuntimeSnapshot;
27
+ }
28
+ /** Read-only view of the most recently published complete generation. */
29
+ export interface GjcRuntimeSnapshotProvider {
30
+ current(): GjcRuntimeSnapshotState;
31
+ }
32
+ /**
33
+ * Single-writer publisher for runtime evidence.
34
+ *
35
+ * Passes can overlap: the session's prompt rebuild is re-entrant, so a second
36
+ * pass may start while a first is still awaiting its producers. Publication is
37
+ * therefore fenced by a monotonic epoch. A pass reserves an epoch when it
38
+ * begins, which immediately retires whatever was published before, and its
39
+ * later publish is accepted only if no newer pass has reserved since. A slow or
40
+ * failed older pass can never overwrite a newer one, and an incomplete pass
41
+ * simply never publishes, leaving consumers at `unavailable`.
42
+ */
43
+ export declare class GjcRuntimeSnapshotStore implements GjcRuntimeSnapshotProvider {
44
+ private state;
45
+ private epoch;
46
+ /**
47
+ * Begin a pass. Retires the current snapshot and returns the epoch token the
48
+ * caller must present to publish.
49
+ */
50
+ beginPass(): number;
51
+ /** Publish only if `epoch` is still the newest reserved pass. */
52
+ publish(snapshot: GjcRuntimeSnapshot, epoch?: number): void;
53
+ invalidate(): void;
54
+ current(): GjcRuntimeSnapshotState;
55
+ }
56
+ /**
57
+ * Findings for one bundle, but only when the snapshot is current AND describes
58
+ * the exact generation the consumer is rendering. Missing provider, mismatched
59
+ * generation, or unavailable state resolve to `unavailable` — never to a
60
+ * silently empty "clear" result.
61
+ */
62
+ export declare function findingsForBundle(provider: GjcRuntimeSnapshotProvider | undefined, identity: GjcBundleIdentity, expectedGeneration: number): {
63
+ status: "unavailable";
64
+ } | {
65
+ status: "current";
66
+ findings: GjcRuntimeFinding[];
67
+ };
@@ -1,4 +1,4 @@
1
- import type { GjcPluginLoadErrorCode, GjcPluginRegistryEntry } from "./types";
1
+ import type { GjcBundleIdentity, GjcPluginLoadErrorCode, GjcPluginRegistryEntry } from "./types";
2
2
  /**
3
3
  * Session-start validation: the registry is the collision authority. Capability
4
4
  * provider output is supplied as EVIDENCE only; plugin surfaces are never
@@ -16,6 +16,8 @@ export interface SessionCapabilityEvidence {
16
16
  appendixIds?: Iterable<string>;
17
17
  }
18
18
  export interface SessionQuarantine {
19
+ /** Scope-qualified canonical target this finding belongs to. */
20
+ identity: GjcBundleIdentity;
19
21
  plugin: string;
20
22
  surfaceId: string;
21
23
  code: GjcPluginLoadErrorCode;
@@ -218,3 +218,127 @@ export interface GjcPluginRegistry {
218
218
  * disabledSurfaceIds, and quarantine bookkeeping.
219
219
  */
220
220
  export type GjcPluginSurfaceExtensionId = string;
221
+ /** Canonical GJC bundle identity: kind is fixed, target is (scope, name). */
222
+ export declare const GJC_BUNDLE_KIND = "gjc-bundle";
223
+ export interface GjcBundleIdentity {
224
+ kind: typeof GJC_BUNDLE_KIND;
225
+ scope: GjcPluginScope;
226
+ name: string;
227
+ }
228
+ /** Source descriptor exposed to CLI/Settings: never carries raw locator secrets. */
229
+ export interface GjcBundleSafeSource {
230
+ kind: GjcPluginSourceKind;
231
+ /** Redacted display locator (host + path only; no userinfo/query/fragment). */
232
+ display: string;
233
+ /** Conservative safe git ref, omitted when the stored value is unsafe. */
234
+ ref?: string;
235
+ /** Hex-only revision identifier, omitted when the stored value is unsafe. */
236
+ sha?: string;
237
+ resolvedAt: string;
238
+ /** True when this source kind supports re-resolution during update. */
239
+ updatable: boolean;
240
+ /** Present only when updatable is false. */
241
+ unsupportedReason?: string;
242
+ }
243
+ export interface GjcBundleSurfaceSummary {
244
+ extensionId: string;
245
+ kind: "tool" | "hook" | "mcp" | "system-appendix" | "agent-appendix" | "subskill";
246
+ name: string;
247
+ /** Persisted user intent (registry disabledSurfaceIds). */
248
+ enabled: boolean;
249
+ /** Deterministic quarantine derived from persisted registry state only. */
250
+ quarantined: boolean;
251
+ quarantineCode?: GjcPluginLoadErrorCode;
252
+ }
253
+ /** Installed-bundle DTO shared by CLI and Settings. Contains no raw locators. */
254
+ export interface GjcBundleSummary {
255
+ identity: GjcBundleIdentity;
256
+ version: string;
257
+ description?: string;
258
+ enabled: boolean;
259
+ source: GjcBundleSafeSource;
260
+ installedAt: string;
261
+ updatedAt: string;
262
+ manifestHash: string;
263
+ /** Deterministic fingerprint of the exact installed target. */
264
+ targetFingerprint: string;
265
+ surfaces: GjcBundleSurfaceSummary[];
266
+ /** True when any deterministic quarantine blocks enablement. */
267
+ quarantined: boolean;
268
+ }
269
+ /**
270
+ * Host-derived token binding an update preview to the exact candidate, the
271
+ * exact installed baseline, and the deterministic decision context. Apply is a
272
+ * compare-and-swap against all three fingerprints.
273
+ */
274
+ export interface GjcReviewedUpdateToken {
275
+ identity: GjcBundleIdentity;
276
+ candidateFingerprint: string;
277
+ baselineFingerprint: string;
278
+ decisionContextFingerprint: string;
279
+ reviewedAt: string;
280
+ }
281
+ export type GjcLifecycleErrorCode = "already_installed_use_upgrade" | "not_installed" | "identity_mismatch" | "stale_candidate" | "stale_baseline" | "stale_decision_context" | "source_unsupported" | "source_unavailable" | "quarantined" | "surface_unknown" | "invalid_target";
282
+ export interface GjcLifecycleError {
283
+ code: GjcLifecycleErrorCode;
284
+ /** Sanitized operator-facing message; never contains raw locators or causes. */
285
+ message: string;
286
+ /** Safe scoped recovery hint (e.g. the exact command to run instead). */
287
+ recovery?: string;
288
+ }
289
+ export type GjcLifecycleResult<T> = {
290
+ ok: true;
291
+ value: T;
292
+ } | {
293
+ ok: false;
294
+ error: GjcLifecycleError;
295
+ };
296
+ export interface GjcUpdatePreview {
297
+ identity: GjcBundleIdentity;
298
+ current: GjcBundleSummary;
299
+ candidateVersion: string;
300
+ candidateManifestHash: string;
301
+ /** Surface IDs added, removed, or retained by this candidate. */
302
+ addedSurfaceIds: string[];
303
+ removedSurfaceIds: string[];
304
+ retainedSurfaceIds: string[];
305
+ changed: boolean;
306
+ token: GjcReviewedUpdateToken;
307
+ }
308
+ export type GjcUpdateApplyStatus = "updated" | "unchanged";
309
+ export interface GjcUpdateApplyResult {
310
+ status: GjcUpdateApplyStatus;
311
+ summary: GjcBundleSummary;
312
+ /** Number of filesystem remnants that could not be removed after a successful swap. */
313
+ remnantCount: number;
314
+ }
315
+ export interface GjcInstallResult {
316
+ status: "installed";
317
+ summary: GjcBundleSummary;
318
+ }
319
+ export interface GjcToggleResult {
320
+ summary: GjcBundleSummary;
321
+ /** False when the requested state already matched (no persisted mutation). */
322
+ mutated: boolean;
323
+ }
324
+ /**
325
+ * Scope-qualified runtime evidence emitted by producers. Producers never
326
+ * publish; the session coordinator accumulates one complete generation.
327
+ */
328
+ export interface GjcRuntimeFinding {
329
+ identity: GjcBundleIdentity;
330
+ surfaceId: string;
331
+ code: GjcPluginLoadErrorCode;
332
+ message: string;
333
+ }
334
+ export interface GjcRuntimeSnapshot {
335
+ /** Monotonic activation generation this snapshot describes. */
336
+ generation: number;
337
+ findings: GjcRuntimeFinding[];
338
+ }
339
+ export type GjcRuntimeSnapshotState = {
340
+ status: "unavailable";
341
+ } | {
342
+ status: "current";
343
+ snapshot: GjcRuntimeSnapshot;
344
+ };
@@ -87,6 +87,7 @@ export interface TmuxLaunchPlan {
87
87
  createdServerIdentity?: {
88
88
  pid: number;
89
89
  startTime: string;
90
+ pidProven?: boolean;
90
91
  };
91
92
  isPsmux: boolean;
92
93
  platform: NodeJS.Platform;
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Typed ralplan review conflicts and dispositions (#2902).
3
+ *
4
+ * Architect and Critic findings remain free-form in their stage markdown, but
5
+ * the join/revision path can record machine-checkable findings against stable
6
+ * plan targets. Incompatible actions on the same target produce open conflicts
7
+ * that block a clean join until an explicit disposition is recorded.
8
+ */
9
+ export declare const RALPLAN_REVIEW_CONFLICTS_SCHEMA: "ralplan.review_conflicts.v1";
10
+ export type ReviewAction = "add" | "remove" | "change" | "clarify";
11
+ export type ReviewRole = "architect" | "critic";
12
+ export type ReviewSeverity = "info" | "watch" | "block";
13
+ export type DispositionChoice = "accept_architect" | "accept_critic" | "synthesize" | "defer_user" | "reject_both";
14
+ export interface ReviewSourceReceipt {
15
+ stage: "architect" | "critic";
16
+ stageN: number;
17
+ path: string;
18
+ sha256: string;
19
+ }
20
+ export interface ReviewFinding {
21
+ findingId: string;
22
+ targetId: string;
23
+ action: ReviewAction;
24
+ severity: ReviewSeverity;
25
+ evidence: string;
26
+ sourceRole: ReviewRole;
27
+ sourceReceipt: ReviewSourceReceipt;
28
+ proposedOwner?: string;
29
+ }
30
+ export interface ReviewConflict {
31
+ conflictId: string;
32
+ targetId: string;
33
+ findingIds: [string, string];
34
+ actions: [ReviewAction, ReviewAction];
35
+ sourceRoles: [ReviewRole, ReviewRole];
36
+ status: "open" | "dispositioned";
37
+ }
38
+ export interface ConflictDisposition {
39
+ conflictId: string;
40
+ choice: DispositionChoice;
41
+ rationale: string;
42
+ decisionOwner: string;
43
+ affectedSections: string[];
44
+ dispositionedAt?: string;
45
+ }
46
+ export interface ReviewConflictDocument {
47
+ schema: typeof RALPLAN_REVIEW_CONFLICTS_SCHEMA;
48
+ plannerStageN: number;
49
+ findings: ReviewFinding[];
50
+ conflicts: ReviewConflict[];
51
+ dispositions: ConflictDisposition[];
52
+ }
53
+ export interface JoinGateResult {
54
+ ok: boolean;
55
+ openConflictIds: string[];
56
+ missingDispositionIds: string[];
57
+ orphanDispositionIds: string[];
58
+ message: string;
59
+ }
60
+ /** True when two actions on the same target cannot both remain. */
61
+ export declare function actionsAreIncompatible(left: ReviewAction, right: ReviewAction): boolean;
62
+ /**
63
+ * Derive open conflicts from typed findings. Only cross-role incompatible pairs
64
+ * on the same targetId are conflicts (Architect remove vs Critic add, etc.).
65
+ */
66
+ export declare function detectReviewConflicts(findings: readonly ReviewFinding[]): ReviewConflict[];
67
+ /** Mark conflicts dispositioned when a matching disposition exists. */
68
+ export declare function applyDispositions(conflicts: readonly ReviewConflict[], dispositions: readonly ConflictDisposition[]): ReviewConflict[];
69
+ /**
70
+ * Join gate: clean only when every derived conflict has an explicit disposition
71
+ * with rationale and decision owner, and no orphan dispositions reference unknown
72
+ * conflicts.
73
+ */
74
+ export declare function evaluateReviewJoinGate(findings: readonly ReviewFinding[], dispositions: readonly ConflictDisposition[], precomputedConflicts?: readonly ReviewConflict[]): JoinGateResult;
75
+ /** Strip optional markdown fence and parse JSON. */
76
+ export declare function parseReviewConflictJson(raw: string): unknown;
77
+ /**
78
+ * Authoritative provenance required by `gjc ralplan --write --stage disposition`.
79
+ *
80
+ * Without this, a disposition document can claim arbitrary path/hash strings and
81
+ * join the wrong Architect/Critic pass (#3013 adversarial review).
82
+ */
83
+ export interface IndexedReviewArtifact {
84
+ path: string;
85
+ sha256: string;
86
+ }
87
+ export interface DispositionProvenanceContext {
88
+ /** CLI `--stage_n` for this disposition write; must equal `plannerStageN`. */
89
+ expectedStageN: number;
90
+ /**
91
+ * Persisted Architect/Critic (and other) stage artifacts from this run's
92
+ * `index.jsonl`, keyed by `${stage}\u0000${stageN}`.
93
+ */
94
+ indexedArtifacts: ReadonlyMap<string, IndexedReviewArtifact>;
95
+ }
96
+ /** Stable map key for a staged artifact identity in the run index. */
97
+ export declare function reviewArtifactIndexKey(stage: string, stageN: number): string;
98
+ /**
99
+ * Cross-check every finding's source receipt against the CLI stage number and
100
+ * the run's persisted Architect/Critic artifact index. Fail closed on mismatch
101
+ * or spoofed path/hash attestations.
102
+ */
103
+ export declare function assertDispositionProvenance(doc: ReviewConflictDocument, provenance: DispositionProvenanceContext): void;
104
+ /**
105
+ * Parse and validate a disposition-stage document. Re-derives conflicts from
106
+ * findings when omitted, then fails closed unless every conflict is dispositioned
107
+ * (or findings produce zero conflicts and dispositions are empty).
108
+ *
109
+ * When `provenance` is provided (CLI write path), also enforces authoritative
110
+ * same-pass receipt checks against the run index.
111
+ */
112
+ export declare function parseReviewConflictDocument(raw: string | unknown, provenance?: DispositionProvenanceContext): ReviewConflictDocument;
113
+ /** Canonical JSON serialization for disposition-stage artifacts. */
114
+ export declare function serializeReviewConflictDocument(doc: ReviewConflictDocument): string;
@@ -14,9 +14,11 @@ import { type RalplanIndexRow } from "./ledger-event-renderer";
14
14
  * 2. **Artifact write**: `gjc ralplan --write --stage <type> --stage_n <N>
15
15
  * (--artifact <path-or-string> | --artifact-env GJC_RALPLAN_ARTIFACT)
16
16
  * [--run-id <id>] [--session-id <id>] [--lane-verdict <token>] [--json]` persists Planner / Architect
17
- * / Critic / revision / post-interview / ADR / final markdown under `.gjc/plans/ralplan/<run-id>/`, maintains
18
- * an `index.jsonl` audit log, copies `final` stages to `pending-approval.md`, and advances
19
- * the HUD chip to reflect the latest persisted stage.
17
+ * / Critic / disposition / revision / post-interview / ADR / final artifacts under
18
+ * `.gjc/plans/ralplan/<run-id>/`, maintains an `index.jsonl` audit log, copies `final`
19
+ * stages to `pending-approval.md`, and advances the HUD chip to reflect the latest
20
+ * persisted stage. Disposition stage artifacts are fail-closed JSON documents that
21
+ * record typed review conflicts with authoritative same-pass source receipts (#2902).
20
22
  */
21
23
  export interface RalplanCommandResult {
22
24
  status: number;
@@ -33,6 +35,13 @@ export declare const PLANNING_STUCK_MARKER = "PLANNING-STUCK";
33
35
  export declare const RALPLAN_DEFAULT_MAX_REVIEW_PASSES_PER_LANE = 1;
34
36
  /** Inclusive upper bound for `gjc.ralplan.maxReviewPassesPerLane` settings overrides. */
35
37
  export declare const RALPLAN_MAX_REVIEW_PASSES_PER_LANE_LIMIT = 10;
38
+ export type RalplanAutoHandoffTarget = "off" | "ultragoal" | "team";
39
+ export interface RalplanAutoHandoffResolution {
40
+ configuredTarget: RalplanAutoHandoffTarget;
41
+ effectiveTarget: RalplanAutoHandoffTarget;
42
+ degradationReason: string | null;
43
+ source: string;
44
+ }
36
45
  export type RalplanIterationCapDecision = {
37
46
  allowed: true;
38
47
  currentIterations: number;
@@ -128,6 +137,16 @@ export declare function resolveRalplanMaxIterations(cwd: string): Promise<{
128
137
  maxIterations: number;
129
138
  source: string;
130
139
  }>;
140
+ type RalplanAutoHandoffOptions = {
141
+ planningStuck?: boolean;
142
+ teamAvailabilityProbe?: () => {
143
+ available: true;
144
+ } | {
145
+ available: false;
146
+ reason: string;
147
+ };
148
+ };
149
+ export declare function resolveRalplanAutoHandoff(cwd: string, options?: RalplanAutoHandoffOptions): Promise<RalplanAutoHandoffResolution>;
131
150
  /** Resolve the per-lane review-pass budget with project-over-user precedence. */
132
151
  export declare function resolveRalplanMaxReviewPassesPerLane(cwd: string): Promise<{
133
152
  maxReviewPassesPerLane: number;
@@ -135,3 +154,4 @@ export declare function resolveRalplanMaxReviewPassesPerLane(cwd: string): Promi
135
154
  }>;
136
155
  export declare function isRalplanArtifactWriteInvocation(args: readonly string[]): boolean;
137
156
  export declare function runNativeRalplanCommand(args: string[], cwd?: string): Promise<RalplanCommandResult>;
157
+ export {};
@@ -2,7 +2,7 @@ import type { GjcTeamConfig, GjcTeamSnapshot, GjcTeamStartOptions, GjcTeamTask,
2
2
  /** Launch-specific option wiring kept separate from runtime dispatch. */
3
3
  export declare function withTeamLaunchTransport(options: GjcTeamStartOptions, mailboxDeliveryTransport: GjcTeamStartOptions["mailboxDeliveryTransport"]): GjcTeamStartOptions;
4
4
  /** @internal Exported for unit tests. */
5
- export declare function buildWorkerCommand(config: GjcTeamConfig, worker: GjcTeamWorker, platform?: NodeJS.Platform, promptOverride?: string): string;
5
+ export declare function buildWorkerCommand(config: GjcTeamConfig, worker: GjcTeamWorker, platform?: NodeJS.Platform, promptOverride?: string, env?: NodeJS.ProcessEnv): string;
6
6
  interface GjcTmuxBinary {
7
7
  command: string;
8
8
  isPsmux: boolean;
@@ -201,6 +201,13 @@ export interface GjcWorkerIntegrationAttemptOptions {
201
201
  signal?: AbortSignal;
202
202
  }
203
203
  export declare const GJC_TEAM_API_OPERATIONS: readonly ["send-message", "broadcast", "mailbox-list", "mailbox-mark-delivered", "mailbox-mark-notified", "notification-list", "notification-read", "notification-replay", "notification-mark-pane-attempt", "worker-startup-ack", "create-task", "read-task", "list-tasks", "update-task", "claim-task", "transition-task-status", "transition-task", "release-task-claim", "read-config", "read-manifest", "read-worker-status", "update-worker-status", "read-worker-heartbeat", "recover-stale-claims", "update-worker-heartbeat", "read-worker-memory-guard", "update-worker-memory-guard", "apply-worker-memory-guard", "write-worker-inbox", "write-worker-identity", "append-event", "read-events", "read-traces", "await-event", "write-shutdown-request", "read-shutdown-ack", "read-monitor-snapshot", "write-monitor-snapshot", "read-task-approval", "write-task-approval"];
204
+ export type GjcTeamApiOperation = (typeof GJC_TEAM_API_OPERATIONS)[number];
205
+ export declare class UnknownGjcTeamApiOperationError extends Error {
206
+ readonly code = "unknown_team_api_operation";
207
+ readonly operation: string;
208
+ readonly suggestions: readonly string[];
209
+ constructor(operation: string, suggestions: readonly string[]);
210
+ }
204
211
  export interface GjcTeamRuntimeTestSeams {
205
212
  nowMs?: () => number;
206
213
  continuationTmuxDispatch?: (command: string, args: readonly string[]) => {
@@ -225,6 +232,16 @@ export declare function resolveWorkerWorktreePath(input: {
225
232
  platform: NodeJS.Platform;
226
233
  isPsmux: boolean;
227
234
  }): string;
235
+ /**
236
+ * Check whether the current process can launch a team without changing tmux state.
237
+ * Unlike the launch path, this never adopts or tags an unmanaged tmux session.
238
+ */
239
+ export declare function probeGjcTeamAvailability(env?: NodeJS.ProcessEnv): {
240
+ available: true;
241
+ } | {
242
+ available: false;
243
+ reason: string;
244
+ };
228
245
  export declare function resolveGjcWorkerCommand(cwd?: string, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, argv?: string[], execPath?: string): string;
229
246
  export { buildWorkerCommand } from "./team-launch";
230
247
  export type GjcWorkerCheckpointClassification = {
@@ -257,6 +274,8 @@ export declare function requestGjcWorkerIntegrationAttempt(cwd?: string, env?: N
257
274
  export declare function buildTeamHudSummary(snapshot: GjcTeamSnapshot, latestEvent?: GjcTeamEvent, latestMessage?: GjcTeamMailboxMessage): Promise<WorkflowHudSummary>;
258
275
  export declare function monitorGjcTeam(teamName: string, cwd?: string, env?: NodeJS.ProcessEnv): Promise<GjcTeamSnapshot>;
259
276
  export declare function listGjcTeams(cwd?: string, env?: NodeJS.ProcessEnv): Promise<GjcTeamSnapshot[]>;
277
+ /** Positive stale windows are clamped so a worker can publish strictly before expiry. */
278
+ export declare function parseHeartbeatStaleMs(env: NodeJS.ProcessEnv): number;
260
279
  export declare function shutdownGjcTeam(teamName: string, cwd?: string, env?: NodeJS.ProcessEnv): Promise<GjcTeamSnapshot>;
261
280
  export declare function listGjcTeamTasks(teamName: string, cwd?: string, env?: NodeJS.ProcessEnv): Promise<GjcTeamTask[]>;
262
281
  export declare function readGjcTeamTask(teamName: string, taskId: string, cwd?: string, env?: NodeJS.ProcessEnv): Promise<GjcTeamTask>;
@@ -278,6 +297,12 @@ export declare const readGjcWorkerStatus: (teamName: string, worker: string, cwd
278
297
  export declare function updateGjcWorkerStatus(teamName: string, worker: string, status: GjcWorkerStatusState, cwd?: string, env?: NodeJS.ProcessEnv, currentTaskId?: string, reason?: string): Promise<WorkerStatusFile>;
279
298
  export declare const readGjcWorkerHeartbeat: (teamName: string, worker: string, cwd?: string, env?: NodeJS.ProcessEnv) => Promise<WorkerHeartbeatFile | null>;
280
299
  export declare function updateGjcWorkerHeartbeat(teamName: string, worker: string, heartbeat: WorkerHeartbeatFile, cwd?: string, env?: NodeJS.ProcessEnv): Promise<WorkerHeartbeatFile>;
300
+ /**
301
+ * Refresh liveness without discarding metadata written by other heartbeat
302
+ * producers. The read/merge/write sequence shares the team mutation fence with
303
+ * CLI heartbeat updates, so a runtime tick cannot overwrite a newer turn count.
304
+ */
305
+ export declare function refreshGjcWorkerHeartbeat(teamName: string, worker: string, pid: number, cwd?: string, env?: NodeJS.ProcessEnv): Promise<WorkerHeartbeatFile>;
281
306
  export declare function writeGjcWorkerInbox(teamName: string, worker: string, content: string, cwd?: string, env?: NodeJS.ProcessEnv): Promise<{
282
307
  path: string;
283
308
  }>;
@@ -0,0 +1,43 @@
1
+ import { type WorkerHeartbeatFile } from "./team-runtime";
2
+ export interface GjcTeamWorkerIdentity {
3
+ teamName: string;
4
+ workerId: string;
5
+ }
6
+ /** Resolves the team identity injected into a worker pane by `gjc team` startup. */
7
+ export declare function resolveGjcTeamWorkerIdentity(env?: NodeJS.ProcessEnv): GjcTeamWorkerIdentity | undefined;
8
+ /** Refresh cadence derived from the leader's stale window; `0` disables publishing. */
9
+ export declare function resolveGjcTeamWorkerHeartbeatIntervalMs(env?: NodeJS.ProcessEnv): number;
10
+ /**
11
+ * Publish one runtime-owned heartbeat for the worker this process is running as.
12
+ * Returns `undefined` when the process is not a team worker.
13
+ *
14
+ * `turn_count` and process-incarnation metadata are merged under the same
15
+ * mutation fence used by CLI heartbeat updates.
16
+ */
17
+ export declare function writeGjcTeamWorkerRuntimeHeartbeat(cwd?: string, env?: NodeJS.ProcessEnv): Promise<WorkerHeartbeatFile | undefined>;
18
+ export interface GjcTeamWorkerHeartbeatReporterOptions {
19
+ write: () => Promise<void>;
20
+ intervalMs: number;
21
+ }
22
+ /**
23
+ * Publishes a worker heartbeat while a turn is in flight.
24
+ *
25
+ * Writes never overlap; a slow or failing write is logged and skipped rather
26
+ * than queued, because only the most recent record matters. The timer is
27
+ * unreferenced so it can never hold the process open.
28
+ */
29
+ export declare class GjcTeamWorkerHeartbeatReporter {
30
+ #private;
31
+ constructor(options: GjcTeamWorkerHeartbeatReporterOptions);
32
+ /** Reporter for the current process, or `undefined` when it is not a team worker. */
33
+ static forProcess(cwd: () => string, env?: NodeJS.ProcessEnv): GjcTeamWorkerHeartbeatReporter | undefined;
34
+ get isRunning(): boolean;
35
+ /** Publish immediately, then keep publishing until {@link stop} or {@link dispose}. */
36
+ start(): void;
37
+ /** Stop periodic publishing after one final record, so the idle stamp is fresh. */
38
+ stop(): void;
39
+ /** Await the write in flight, if any. */
40
+ flush(): Promise<void>;
41
+ /** Permanently stop publishing. Idempotent. */
42
+ dispose(): void;
43
+ }
@@ -31,6 +31,16 @@ export interface TmuxServerProof {
31
31
  startTime?: string;
32
32
  cgroup?: CgroupInfo;
33
33
  sessionNames?: string[];
34
+ /**
35
+ * Whether `pid` is kernel-proved evidence about the live tmux server.
36
+ *
37
+ * Only Linux can prove a server PID (`/proc` + cgroup classification), so
38
+ * probes on other platforms may report a placeholder PID with this flag set
39
+ * to `false`. Guards must not build a `#{pid}` predicate from an unproven
40
+ * PID: no live tmux server can ever satisfy it. Omitted means proven, which
41
+ * keeps every probe that reads a real `#{pid}` unchanged.
42
+ */
43
+ pidProven?: boolean;
34
44
  }
35
45
  export interface PlanRequest {
36
46
  schema_version: 1;