@gajae-code/coding-agent 0.3.0 → 0.3.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 (213) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +1 -1
  3. package/dist/types/async/job-manager.d.ts +7 -0
  4. package/dist/types/cli/args.d.ts +3 -1
  5. package/dist/types/commands/deep-interview.d.ts +3 -0
  6. package/dist/types/commands/launch.d.ts +6 -0
  7. package/dist/types/config/keybindings.d.ts +5 -0
  8. package/dist/types/config/model-profile-activation.d.ts +30 -0
  9. package/dist/types/config/model-profiles.d.ts +19 -0
  10. package/dist/types/config/model-registry.d.ts +8 -0
  11. package/dist/types/config/model-resolver.d.ts +1 -1
  12. package/dist/types/config/models-config-schema.d.ts +47 -0
  13. package/dist/types/config/settings-schema.d.ts +14 -4
  14. package/dist/types/debug/crash-diagnostics.d.ts +45 -0
  15. package/dist/types/debug/runtime-gauges.d.ts +6 -0
  16. package/dist/types/deep-interview/render-middleware.d.ts +1 -0
  17. package/dist/types/eval/py/executor.d.ts +2 -0
  18. package/dist/types/eval/py/kernel.d.ts +2 -0
  19. package/dist/types/exec/bash-executor.d.ts +10 -0
  20. package/dist/types/gjc-runtime/cli-write-receipt.d.ts +24 -0
  21. package/dist/types/gjc-runtime/deep-interview-runtime.d.ts +1 -0
  22. package/dist/types/gjc-runtime/state-migrations.d.ts +9 -0
  23. package/dist/types/gjc-runtime/state-schema.d.ts +317 -0
  24. package/dist/types/gjc-runtime/state-writer.d.ts +10 -0
  25. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +2 -1
  26. package/dist/types/gjc-runtime/workflow-command-ref.d.ts +43 -0
  27. package/dist/types/harness-control-plane/control-endpoint.d.ts +3 -2
  28. package/dist/types/hooks/skill-state.d.ts +21 -0
  29. package/dist/types/internal-urls/agent-protocol.d.ts +2 -2
  30. package/dist/types/internal-urls/artifact-protocol.d.ts +2 -2
  31. package/dist/types/internal-urls/registry-helpers.d.ts +8 -7
  32. package/dist/types/internal-urls/types.d.ts +4 -0
  33. package/dist/types/lsp/index.d.ts +10 -10
  34. package/dist/types/main.d.ts +10 -1
  35. package/dist/types/modes/bridge/auth.d.ts +12 -0
  36. package/dist/types/modes/bridge/bridge-client-bridge.d.ts +9 -0
  37. package/dist/types/modes/bridge/bridge-mode.d.ts +44 -0
  38. package/dist/types/modes/bridge/bridge-ui-context.d.ts +88 -0
  39. package/dist/types/modes/bridge/event-stream.d.ts +8 -0
  40. package/dist/types/modes/components/custom-editor.d.ts +6 -0
  41. package/dist/types/modes/components/custom-provider-wizard.d.ts +10 -0
  42. package/dist/types/modes/components/jobs-overlay-model.d.ts +31 -0
  43. package/dist/types/modes/components/jobs-overlay.d.ts +30 -0
  44. package/dist/types/modes/components/model-selector.d.ts +6 -1
  45. package/dist/types/modes/components/provider-onboarding-selector.d.ts +1 -1
  46. package/dist/types/modes/components/status-line/types.d.ts +2 -0
  47. package/dist/types/modes/components/status-line.d.ts +2 -0
  48. package/dist/types/modes/controllers/input-controller.d.ts +1 -0
  49. package/dist/types/modes/controllers/selector-controller.d.ts +9 -0
  50. package/dist/types/modes/index.d.ts +1 -0
  51. package/dist/types/modes/interactive-mode.d.ts +1 -0
  52. package/dist/types/modes/jobs-observer.d.ts +57 -0
  53. package/dist/types/modes/rpc/host-tools.d.ts +1 -16
  54. package/dist/types/modes/rpc/host-uris.d.ts +1 -38
  55. package/dist/types/modes/shared/agent-wire/command-dispatch.d.ts +20 -0
  56. package/dist/types/modes/shared/agent-wire/command-validation.d.ts +2 -0
  57. package/dist/types/modes/shared/agent-wire/event-envelope.d.ts +24 -0
  58. package/dist/types/modes/shared/agent-wire/handshake.d.ts +46 -0
  59. package/dist/types/modes/shared/agent-wire/host-tool-bridge.d.ts +16 -0
  60. package/dist/types/modes/shared/agent-wire/host-uri-bridge.d.ts +17 -0
  61. package/dist/types/modes/shared/agent-wire/protocol.d.ts +44 -0
  62. package/dist/types/modes/shared/agent-wire/responses.d.ts +4 -0
  63. package/dist/types/modes/shared/agent-wire/scopes.d.ts +18 -0
  64. package/dist/types/modes/shared/agent-wire/ui-request-broker.d.ts +42 -0
  65. package/dist/types/modes/shared/agent-wire/ui-result.d.ts +27 -0
  66. package/dist/types/modes/types.d.ts +2 -0
  67. package/dist/types/sdk.d.ts +3 -1
  68. package/dist/types/session/agent-session.d.ts +11 -1
  69. package/dist/types/skill-state/workflow-state-contract.d.ts +1 -2
  70. package/dist/types/skill-state/workflow-state-version.d.ts +3 -0
  71. package/dist/types/task/executor.d.ts +1 -0
  72. package/dist/types/task/id.d.ts +7 -0
  73. package/dist/types/task/index.d.ts +5 -0
  74. package/dist/types/task/receipt.d.ts +85 -0
  75. package/dist/types/task/spawn-gate.d.ts +38 -0
  76. package/dist/types/task/types.d.ts +143 -11
  77. package/dist/types/tools/cron.d.ts +6 -0
  78. package/dist/types/tools/hindsight-recall.d.ts +0 -2
  79. package/dist/types/tools/hindsight-reflect.d.ts +0 -2
  80. package/dist/types/tools/hindsight-retain.d.ts +0 -2
  81. package/dist/types/tools/index.d.ts +6 -4
  82. package/dist/types/tools/path-utils.d.ts +1 -0
  83. package/dist/types/tools/subagent.d.ts +15 -0
  84. package/package.json +7 -7
  85. package/scripts/build-binary.ts +7 -0
  86. package/src/async/job-manager.ts +36 -0
  87. package/src/cli/args.ts +19 -2
  88. package/src/commands/deep-interview.ts +1 -0
  89. package/src/commands/harness.ts +289 -19
  90. package/src/commands/launch.ts +10 -2
  91. package/src/commands/state.ts +2 -1
  92. package/src/commands/team.ts +22 -4
  93. package/src/config/keybindings.ts +6 -0
  94. package/src/config/model-profile-activation.ts +157 -0
  95. package/src/config/model-profiles.ts +155 -0
  96. package/src/config/model-registry.ts +19 -0
  97. package/src/config/model-resolver.ts +3 -2
  98. package/src/config/models-config-schema.ts +36 -0
  99. package/src/config/settings-schema.ts +16 -3
  100. package/src/dap/client.ts +17 -3
  101. package/src/debug/crash-diagnostics.ts +223 -0
  102. package/src/debug/runtime-gauges.ts +20 -0
  103. package/src/deep-interview/render-middleware.ts +6 -0
  104. package/src/defaults/gjc/skills/deep-interview/SKILL.md +1 -1
  105. package/src/defaults/gjc/skills/ralplan/SKILL.md +31 -2
  106. package/src/defaults/gjc/skills/ultragoal/SKILL.md +39 -3
  107. package/src/defaults/gjc/skills/ultragoal/ai-slop-cleaner.md +61 -0
  108. package/src/defaults/gjc-defaults.ts +7 -0
  109. package/src/eval/py/executor.ts +21 -1
  110. package/src/eval/py/kernel.ts +15 -0
  111. package/src/exec/bash-executor.ts +41 -0
  112. package/src/gjc-runtime/cli-write-receipt.ts +31 -0
  113. package/src/gjc-runtime/deep-interview-runtime.ts +69 -32
  114. package/src/gjc-runtime/ralplan-runtime.ts +213 -36
  115. package/src/gjc-runtime/state-migrations.ts +54 -7
  116. package/src/gjc-runtime/state-runtime.ts +461 -64
  117. package/src/gjc-runtime/state-schema.ts +192 -0
  118. package/src/gjc-runtime/state-writer.ts +32 -1
  119. package/src/gjc-runtime/team-runtime.ts +177 -105
  120. package/src/gjc-runtime/ultragoal-runtime.ts +231 -38
  121. package/src/gjc-runtime/workflow-command-ref.ts +239 -0
  122. package/src/gjc-runtime/workflow-manifest.generated.json +108 -4
  123. package/src/gjc-runtime/workflow-manifest.ts +3 -1
  124. package/src/harness-control-plane/control-endpoint.ts +19 -8
  125. package/src/harness-control-plane/owner.ts +57 -10
  126. package/src/harness-control-plane/state-machine.ts +2 -1
  127. package/src/hooks/skill-state.ts +176 -26
  128. package/src/internal-urls/agent-protocol.ts +68 -21
  129. package/src/internal-urls/artifact-protocol.ts +12 -17
  130. package/src/internal-urls/docs-index.generated.ts +8 -10
  131. package/src/internal-urls/registry-helpers.ts +19 -16
  132. package/src/internal-urls/types.ts +4 -0
  133. package/src/lsp/client.ts +18 -2
  134. package/src/main.ts +88 -6
  135. package/src/modes/bridge/auth.ts +41 -0
  136. package/src/modes/bridge/bridge-client-bridge.ts +47 -0
  137. package/src/modes/bridge/bridge-mode.ts +520 -0
  138. package/src/modes/bridge/bridge-ui-context.ts +200 -0
  139. package/src/modes/bridge/event-stream.ts +70 -0
  140. package/src/modes/components/custom-editor.ts +101 -0
  141. package/src/modes/components/custom-provider-wizard.ts +318 -0
  142. package/src/modes/components/hook-selector.ts +61 -18
  143. package/src/modes/components/jobs-overlay-model.ts +109 -0
  144. package/src/modes/components/jobs-overlay.ts +172 -0
  145. package/src/modes/components/model-selector.ts +108 -18
  146. package/src/modes/components/provider-onboarding-selector.ts +6 -1
  147. package/src/modes/components/status-line/presets.ts +7 -5
  148. package/src/modes/components/status-line/segments.ts +25 -0
  149. package/src/modes/components/status-line/types.ts +2 -0
  150. package/src/modes/components/status-line.ts +9 -1
  151. package/src/modes/controllers/extension-ui-controller.ts +39 -3
  152. package/src/modes/controllers/input-controller.ts +97 -9
  153. package/src/modes/controllers/selector-controller.ts +86 -1
  154. package/src/modes/index.ts +1 -0
  155. package/src/modes/interactive-mode.ts +27 -0
  156. package/src/modes/jobs-observer.ts +204 -0
  157. package/src/modes/rpc/host-tools.ts +1 -186
  158. package/src/modes/rpc/host-uris.ts +1 -235
  159. package/src/modes/rpc/rpc-client.ts +25 -10
  160. package/src/modes/rpc/rpc-mode.ts +12 -381
  161. package/src/modes/shared/agent-wire/command-dispatch.ts +341 -0
  162. package/src/modes/shared/agent-wire/command-validation.ts +131 -0
  163. package/src/modes/shared/agent-wire/event-envelope.ts +108 -0
  164. package/src/modes/shared/agent-wire/handshake.ts +117 -0
  165. package/src/modes/shared/agent-wire/host-tool-bridge.ts +194 -0
  166. package/src/modes/shared/agent-wire/host-uri-bridge.ts +236 -0
  167. package/src/modes/shared/agent-wire/protocol.ts +96 -0
  168. package/src/modes/shared/agent-wire/responses.ts +17 -0
  169. package/src/modes/shared/agent-wire/scopes.ts +89 -0
  170. package/src/modes/shared/agent-wire/ui-request-broker.ts +150 -0
  171. package/src/modes/shared/agent-wire/ui-result.ts +48 -0
  172. package/src/modes/types.ts +2 -0
  173. package/src/prompts/memories/consolidation.md +1 -1
  174. package/src/prompts/memories/read-path.md +6 -7
  175. package/src/prompts/memories/unavailable.md +2 -2
  176. package/src/prompts/tools/bash.md +1 -1
  177. package/src/prompts/tools/irc.md +1 -1
  178. package/src/prompts/tools/read.md +2 -2
  179. package/src/prompts/tools/recall.md +1 -0
  180. package/src/prompts/tools/reflect.md +1 -0
  181. package/src/prompts/tools/retain.md +1 -0
  182. package/src/prompts/tools/subagent.md +12 -7
  183. package/src/prompts/tools/task-summary.md +3 -9
  184. package/src/prompts/tools/task.md +5 -1
  185. package/src/sdk.ts +5 -1
  186. package/src/session/agent-session.ts +214 -38
  187. package/src/skill-state/deep-interview-mutation-guard.ts +23 -4
  188. package/src/skill-state/workflow-state-contract.ts +7 -4
  189. package/src/skill-state/workflow-state-version.ts +3 -0
  190. package/src/slash-commands/builtin-registry.ts +9 -1
  191. package/src/task/executor.ts +31 -5
  192. package/src/task/id.ts +33 -0
  193. package/src/task/index.ts +259 -67
  194. package/src/task/output-manager.ts +5 -4
  195. package/src/task/receipt.ts +297 -0
  196. package/src/task/render.ts +48 -131
  197. package/src/task/spawn-gate.ts +132 -0
  198. package/src/task/types.ts +48 -7
  199. package/src/tools/ask.ts +73 -33
  200. package/src/tools/ast-edit.ts +1 -0
  201. package/src/tools/ast-grep.ts +1 -0
  202. package/src/tools/bash.ts +1 -1
  203. package/src/tools/cron.ts +48 -0
  204. package/src/tools/find.ts +4 -1
  205. package/src/tools/hindsight-recall.ts +0 -2
  206. package/src/tools/hindsight-reflect.ts +0 -2
  207. package/src/tools/hindsight-retain.ts +0 -2
  208. package/src/tools/index.ts +6 -18
  209. package/src/tools/path-utils.ts +3 -2
  210. package/src/tools/read.ts +4 -3
  211. package/src/tools/search.ts +1 -0
  212. package/src/tools/skill.ts +6 -1
  213. package/src/tools/subagent.ts +237 -84
@@ -0,0 +1,317 @@
1
+ import { z } from "zod";
2
+ export declare const WorkflowStateContentChecksumSchema: z.ZodObject<{
3
+ algorithm: z.ZodLiteral<"sha256">;
4
+ value: z.ZodString;
5
+ covered_path: z.ZodString;
6
+ computed_at: z.ZodString;
7
+ }, z.core.$loose>;
8
+ /** Lenient receipt schema for reads (mirrors WorkflowStateReceipt). */
9
+ export declare const WorkflowStateReceiptSchema: z.ZodObject<{
10
+ version: z.ZodNumber;
11
+ skill: z.ZodEnum<{
12
+ "deep-interview": "deep-interview";
13
+ ralplan: "ralplan";
14
+ team: "team";
15
+ ultragoal: "ultragoal";
16
+ }>;
17
+ owner: z.ZodEnum<{
18
+ "gjc-hook": "gjc-hook";
19
+ "gjc-runtime": "gjc-runtime";
20
+ "gjc-state-cli": "gjc-state-cli";
21
+ }>;
22
+ command: z.ZodString;
23
+ state_path: z.ZodString;
24
+ storage_path: z.ZodString;
25
+ mutated_at: z.ZodString;
26
+ fresh_until: z.ZodString;
27
+ status: z.ZodEnum<{
28
+ fresh: "fresh";
29
+ stale: "stale";
30
+ }>;
31
+ mutation_id: z.ZodString;
32
+ verb: z.ZodOptional<z.ZodString>;
33
+ from_phase: z.ZodOptional<z.ZodString>;
34
+ to_phase: z.ZodOptional<z.ZodString>;
35
+ forced: z.ZodOptional<z.ZodBoolean>;
36
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
37
+ content_sha256: z.ZodOptional<z.ZodObject<{
38
+ algorithm: z.ZodLiteral<"sha256">;
39
+ value: z.ZodString;
40
+ covered_path: z.ZodString;
41
+ computed_at: z.ZodString;
42
+ }, z.core.$loose>>;
43
+ }, z.core.$loose>;
44
+ /** Lenient envelope schema for reads. Every non-structural field optional. */
45
+ export declare const WorkflowStateEnvelopeSchema: z.ZodObject<{
46
+ skill: z.ZodOptional<z.ZodString>;
47
+ active: z.ZodOptional<z.ZodBoolean>;
48
+ current_phase: z.ZodOptional<z.ZodString>;
49
+ version: z.ZodOptional<z.ZodNumber>;
50
+ updated_at: z.ZodOptional<z.ZodString>;
51
+ session_id: z.ZodOptional<z.ZodString>;
52
+ receipt: z.ZodOptional<z.ZodObject<{
53
+ version: z.ZodNumber;
54
+ skill: z.ZodEnum<{
55
+ "deep-interview": "deep-interview";
56
+ ralplan: "ralplan";
57
+ team: "team";
58
+ ultragoal: "ultragoal";
59
+ }>;
60
+ owner: z.ZodEnum<{
61
+ "gjc-hook": "gjc-hook";
62
+ "gjc-runtime": "gjc-runtime";
63
+ "gjc-state-cli": "gjc-state-cli";
64
+ }>;
65
+ command: z.ZodString;
66
+ state_path: z.ZodString;
67
+ storage_path: z.ZodString;
68
+ mutated_at: z.ZodString;
69
+ fresh_until: z.ZodString;
70
+ status: z.ZodEnum<{
71
+ fresh: "fresh";
72
+ stale: "stale";
73
+ }>;
74
+ mutation_id: z.ZodString;
75
+ verb: z.ZodOptional<z.ZodString>;
76
+ from_phase: z.ZodOptional<z.ZodString>;
77
+ to_phase: z.ZodOptional<z.ZodString>;
78
+ forced: z.ZodOptional<z.ZodBoolean>;
79
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
80
+ content_sha256: z.ZodOptional<z.ZodObject<{
81
+ algorithm: z.ZodLiteral<"sha256">;
82
+ value: z.ZodString;
83
+ covered_path: z.ZodString;
84
+ computed_at: z.ZodString;
85
+ }, z.core.$loose>>;
86
+ }, z.core.$loose>>;
87
+ }, z.core.$loose>;
88
+ /**
89
+ * Strict receipt required on WRITE (post checksum-stamping). Anchored to the
90
+ * fields the sanctioned writer emits — `content_sha256` is REQUIRED here.
91
+ */
92
+ export declare const RequiredWorkflowStateReceiptSchema: z.ZodObject<{
93
+ version: z.ZodNumber;
94
+ skill: z.ZodEnum<{
95
+ "deep-interview": "deep-interview";
96
+ ralplan: "ralplan";
97
+ team: "team";
98
+ ultragoal: "ultragoal";
99
+ }>;
100
+ owner: z.ZodEnum<{
101
+ "gjc-hook": "gjc-hook";
102
+ "gjc-runtime": "gjc-runtime";
103
+ "gjc-state-cli": "gjc-state-cli";
104
+ }>;
105
+ command: z.ZodString;
106
+ state_path: z.ZodString;
107
+ storage_path: z.ZodString;
108
+ mutated_at: z.ZodString;
109
+ fresh_until: z.ZodString;
110
+ status: z.ZodEnum<{
111
+ fresh: "fresh";
112
+ stale: "stale";
113
+ }>;
114
+ mutation_id: z.ZodString;
115
+ content_sha256: z.ZodObject<{
116
+ algorithm: z.ZodLiteral<"sha256">;
117
+ value: z.ZodString;
118
+ covered_path: z.ZodString;
119
+ computed_at: z.ZodString;
120
+ }, z.core.$loose>;
121
+ }, z.core.$loose>;
122
+ /**
123
+ * Write-side fail-closed gate: the serialized on-disk envelope must satisfy
124
+ * this after checksum stamping. Anchored to current sanctioned-writer output.
125
+ */
126
+ export declare const RequiredOnWriteEnvelopeSchema: z.ZodObject<{
127
+ skill: z.ZodEnum<{
128
+ "deep-interview": "deep-interview";
129
+ ralplan: "ralplan";
130
+ team: "team";
131
+ ultragoal: "ultragoal";
132
+ }>;
133
+ version: z.ZodLiteral<2>;
134
+ updated_at: z.ZodString;
135
+ current_phase: z.ZodString;
136
+ active: z.ZodBoolean;
137
+ receipt: z.ZodObject<{
138
+ version: z.ZodNumber;
139
+ skill: z.ZodEnum<{
140
+ "deep-interview": "deep-interview";
141
+ ralplan: "ralplan";
142
+ team: "team";
143
+ ultragoal: "ultragoal";
144
+ }>;
145
+ owner: z.ZodEnum<{
146
+ "gjc-hook": "gjc-hook";
147
+ "gjc-runtime": "gjc-runtime";
148
+ "gjc-state-cli": "gjc-state-cli";
149
+ }>;
150
+ command: z.ZodString;
151
+ state_path: z.ZodString;
152
+ storage_path: z.ZodString;
153
+ mutated_at: z.ZodString;
154
+ fresh_until: z.ZodString;
155
+ status: z.ZodEnum<{
156
+ fresh: "fresh";
157
+ stale: "stale";
158
+ }>;
159
+ mutation_id: z.ZodString;
160
+ content_sha256: z.ZodObject<{
161
+ algorithm: z.ZodLiteral<"sha256">;
162
+ value: z.ZodString;
163
+ covered_path: z.ZodString;
164
+ computed_at: z.ZodString;
165
+ }, z.core.$loose>;
166
+ }, z.core.$loose>;
167
+ }, z.core.$loose>;
168
+ /** Per-skill mode state consumed by hooks / the mutation guard. */
169
+ export declare const ModeStateSchema: z.ZodObject<{
170
+ active: z.ZodOptional<z.ZodBoolean>;
171
+ current_phase: z.ZodOptional<z.ZodString>;
172
+ skill: z.ZodOptional<z.ZodString>;
173
+ session_id: z.ZodOptional<z.ZodString>;
174
+ thread_id: z.ZodOptional<z.ZodString>;
175
+ cwd: z.ZodOptional<z.ZodString>;
176
+ updated_at: z.ZodOptional<z.ZodString>;
177
+ handoff_from: z.ZodOptional<z.ZodString>;
178
+ handoff_to: z.ZodOptional<z.ZodString>;
179
+ handoff_at: z.ZodOptional<z.ZodString>;
180
+ }, z.core.$loose>;
181
+ export declare const SkillActiveEntrySchema: z.ZodObject<{
182
+ skill: z.ZodString;
183
+ phase: z.ZodOptional<z.ZodString>;
184
+ active: z.ZodOptional<z.ZodBoolean>;
185
+ activated_at: z.ZodOptional<z.ZodString>;
186
+ updated_at: z.ZodOptional<z.ZodString>;
187
+ session_id: z.ZodOptional<z.ZodString>;
188
+ thread_id: z.ZodOptional<z.ZodString>;
189
+ turn_id: z.ZodOptional<z.ZodString>;
190
+ stale: z.ZodOptional<z.ZodBoolean>;
191
+ handoff_from: z.ZodOptional<z.ZodString>;
192
+ handoff_to: z.ZodOptional<z.ZodString>;
193
+ handoff_at: z.ZodOptional<z.ZodString>;
194
+ receipt: z.ZodOptional<z.ZodObject<{
195
+ version: z.ZodNumber;
196
+ skill: z.ZodEnum<{
197
+ "deep-interview": "deep-interview";
198
+ ralplan: "ralplan";
199
+ team: "team";
200
+ ultragoal: "ultragoal";
201
+ }>;
202
+ owner: z.ZodEnum<{
203
+ "gjc-hook": "gjc-hook";
204
+ "gjc-runtime": "gjc-runtime";
205
+ "gjc-state-cli": "gjc-state-cli";
206
+ }>;
207
+ command: z.ZodString;
208
+ state_path: z.ZodString;
209
+ storage_path: z.ZodString;
210
+ mutated_at: z.ZodString;
211
+ fresh_until: z.ZodString;
212
+ status: z.ZodEnum<{
213
+ fresh: "fresh";
214
+ stale: "stale";
215
+ }>;
216
+ mutation_id: z.ZodString;
217
+ verb: z.ZodOptional<z.ZodString>;
218
+ from_phase: z.ZodOptional<z.ZodString>;
219
+ to_phase: z.ZodOptional<z.ZodString>;
220
+ forced: z.ZodOptional<z.ZodBoolean>;
221
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
222
+ content_sha256: z.ZodOptional<z.ZodObject<{
223
+ algorithm: z.ZodLiteral<"sha256">;
224
+ value: z.ZodString;
225
+ covered_path: z.ZodString;
226
+ computed_at: z.ZodString;
227
+ }, z.core.$loose>>;
228
+ }, z.core.$loose>>;
229
+ }, z.core.$loose>;
230
+ export declare const SkillActiveStateSchema: z.ZodObject<{
231
+ version: z.ZodOptional<z.ZodNumber>;
232
+ active: z.ZodOptional<z.ZodBoolean>;
233
+ skill: z.ZodOptional<z.ZodString>;
234
+ keyword: z.ZodOptional<z.ZodString>;
235
+ phase: z.ZodOptional<z.ZodString>;
236
+ activated_at: z.ZodOptional<z.ZodString>;
237
+ updated_at: z.ZodOptional<z.ZodString>;
238
+ source: z.ZodOptional<z.ZodString>;
239
+ session_id: z.ZodOptional<z.ZodString>;
240
+ thread_id: z.ZodOptional<z.ZodString>;
241
+ turn_id: z.ZodOptional<z.ZodString>;
242
+ active_skills: z.ZodOptional<z.ZodArray<z.ZodObject<{
243
+ skill: z.ZodString;
244
+ phase: z.ZodOptional<z.ZodString>;
245
+ active: z.ZodOptional<z.ZodBoolean>;
246
+ activated_at: z.ZodOptional<z.ZodString>;
247
+ updated_at: z.ZodOptional<z.ZodString>;
248
+ session_id: z.ZodOptional<z.ZodString>;
249
+ thread_id: z.ZodOptional<z.ZodString>;
250
+ turn_id: z.ZodOptional<z.ZodString>;
251
+ stale: z.ZodOptional<z.ZodBoolean>;
252
+ handoff_from: z.ZodOptional<z.ZodString>;
253
+ handoff_to: z.ZodOptional<z.ZodString>;
254
+ handoff_at: z.ZodOptional<z.ZodString>;
255
+ receipt: z.ZodOptional<z.ZodObject<{
256
+ version: z.ZodNumber;
257
+ skill: z.ZodEnum<{
258
+ "deep-interview": "deep-interview";
259
+ ralplan: "ralplan";
260
+ team: "team";
261
+ ultragoal: "ultragoal";
262
+ }>;
263
+ owner: z.ZodEnum<{
264
+ "gjc-hook": "gjc-hook";
265
+ "gjc-runtime": "gjc-runtime";
266
+ "gjc-state-cli": "gjc-state-cli";
267
+ }>;
268
+ command: z.ZodString;
269
+ state_path: z.ZodString;
270
+ storage_path: z.ZodString;
271
+ mutated_at: z.ZodString;
272
+ fresh_until: z.ZodString;
273
+ status: z.ZodEnum<{
274
+ fresh: "fresh";
275
+ stale: "stale";
276
+ }>;
277
+ mutation_id: z.ZodString;
278
+ verb: z.ZodOptional<z.ZodString>;
279
+ from_phase: z.ZodOptional<z.ZodString>;
280
+ to_phase: z.ZodOptional<z.ZodString>;
281
+ forced: z.ZodOptional<z.ZodBoolean>;
282
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
283
+ content_sha256: z.ZodOptional<z.ZodObject<{
284
+ algorithm: z.ZodLiteral<"sha256">;
285
+ value: z.ZodString;
286
+ covered_path: z.ZodString;
287
+ computed_at: z.ZodString;
288
+ }, z.core.$loose>>;
289
+ }, z.core.$loose>>;
290
+ }, z.core.$loose>>>;
291
+ }, z.core.$loose>;
292
+ export type WorkflowStateEnvelope = z.infer<typeof WorkflowStateEnvelopeSchema>;
293
+ export type RequiredOnWriteEnvelope = z.infer<typeof RequiredOnWriteEnvelopeSchema>;
294
+ export type ModeStateParsed = z.infer<typeof ModeStateSchema>;
295
+ export type SkillActiveStateParsed = z.infer<typeof SkillActiveStateSchema>;
296
+ /**
297
+ * Validated read result.
298
+ * - `null` → file absent (ENOENT); callers treat as no state.
299
+ * - `{ok:true}` → parsed + schema-valid.
300
+ * - `{ok:false}` → present but unparseable or schema-invalid. Callers fail
301
+ * OPEN (normalize/log), never crash — preserving v2 reads.
302
+ */
303
+ export type ReadGjcJsonResult<T> = {
304
+ ok: true;
305
+ value: T;
306
+ raw: unknown;
307
+ } | {
308
+ ok: false;
309
+ error: string;
310
+ raw: unknown;
311
+ };
312
+ /**
313
+ * Parse + schema-validate a `.gjc` JSON file at the read boundary.
314
+ * Returns `null` when the file is absent. Fail-open: an invalid file yields
315
+ * `{ ok: false }` with the raw value attached so the caller can normalize/log.
316
+ */
317
+ export declare function readGjcJson<T>(filePath: string, schema: z.ZodType<T>): Promise<ReadGjcJsonResult<T> | null>;
@@ -93,6 +93,16 @@ export declare class AlreadyExistsError extends Error {
93
93
  readonly path: string;
94
94
  constructor(path: string);
95
95
  }
96
+ export type StrictMutationReadResult = {
97
+ kind: "absent";
98
+ } | {
99
+ kind: "corrupt";
100
+ error: string;
101
+ } | {
102
+ kind: "valid";
103
+ value: Record<string, unknown>;
104
+ };
105
+ export declare function readExistingStateForMutation(filePath: string): Promise<StrictMutationReadResult>;
96
106
  export declare function workflowEnvelopeContentSha256(value: unknown): string;
97
107
  export declare function stampWorkflowEnvelopeChecksum<T>(value: T, filePath: string, computedAt?: string): T;
98
108
  export declare function detectWorkflowEnvelopeIntegrityMismatch(filePath: string): Promise<WorkflowEnvelopeIntegrityMismatch | undefined>;
@@ -1,4 +1,4 @@
1
- import type { WorkflowHudSummary } from "../skill-state/active-state";
1
+ import { type WorkflowHudSummary } from "../skill-state/active-state";
2
2
  export type UltragoalGjcGoalMode = "aggregate" | "per-story";
3
3
  export type UltragoalGoalStatus = "pending" | "active" | "complete" | "failed" | "blocked" | "review_blocked" | "superseded";
4
4
  export interface UltragoalGoal {
@@ -94,6 +94,7 @@ export declare function computeUltragoalPlanGeneration(input: {
94
94
  export declare function readUltragoalPlan(cwd: string): Promise<UltragoalPlan | null>;
95
95
  export declare function getUltragoalStatus(cwd: string): Promise<UltragoalStatusSummary>;
96
96
  export declare function buildUltragoalHudSummary(summary: UltragoalStatusSummary, latestLedger?: UltragoalLedgerEvent): WorkflowHudSummary;
97
+ export declare function syncUltragoalWorkflowState(cwd: string): Promise<void>;
97
98
  export declare function createUltragoalPlan(input: {
98
99
  cwd: string;
99
100
  brief: string;
@@ -0,0 +1,43 @@
1
+ import type { CanonicalGjcWorkflowSkill } from "../skill-state/active-state";
2
+ export type CommandRefVisibility = "public" | "hidden" | "planned";
3
+ export type CommandRefIncludeWhen = "implemented-only" | "planned";
4
+ export interface CommandRefCommand {
5
+ tokens: string[];
6
+ rendered: string;
7
+ visibility: CommandRefVisibility;
8
+ includeWhen: CommandRefIncludeWhen;
9
+ note?: string;
10
+ }
11
+ export interface CommandRefExample {
12
+ label?: string;
13
+ bytes: string;
14
+ }
15
+ export interface CommandRefBridge {
16
+ from: string;
17
+ to: string;
18
+ rendered: string;
19
+ }
20
+ export interface CommandRefBlock {
21
+ skill: CanonicalGjcWorkflowSkill;
22
+ blockId: string;
23
+ sourcePath: string;
24
+ renderOrder: number;
25
+ markers: {
26
+ start: string;
27
+ end: string;
28
+ };
29
+ commands: CommandRefCommand[];
30
+ examples: CommandRefExample[];
31
+ aliasesAndBridges: CommandRefBridge[];
32
+ notes: string[];
33
+ }
34
+ export interface RenderedCommandRefBlock {
35
+ skill: CanonicalGjcWorkflowSkill;
36
+ blockId: string;
37
+ markers: CommandRefBlock["markers"];
38
+ bytes: string;
39
+ }
40
+ export declare const WORKFLOW_COMMAND_REF_BLOCKS: readonly CommandRefBlock[];
41
+ export declare function listCommandRefBlocks(skill?: CanonicalGjcWorkflowSkill): CommandRefBlock[];
42
+ export declare function renderCommandRefBlock(skill: CanonicalGjcWorkflowSkill, blockId?: string): RenderedCommandRefBlock;
43
+ export declare function isCanonicalGjcWorkflowSkill(value: string): value is CanonicalGjcWorkflowSkill;
@@ -24,7 +24,8 @@ export declare class ControlServer {
24
24
  }
25
25
  export declare class EndpointUnreachableError extends Error {
26
26
  readonly socketPath: string;
27
- constructor(socketPath: string);
27
+ readonly reason: string;
28
+ constructor(socketPath: string, reason?: string);
28
29
  }
29
- /** Call the owner's control endpoint. Rejects with {@link EndpointUnreachableError} when no owner listens. */
30
+ /** Call the owner's control endpoint. Rejects with {@link EndpointUnreachableError} when no owner listens or responds. */
30
31
  export declare function callEndpoint(socketPath: string, req: EndpointRequest, timeoutMs?: number): Promise<unknown>;
@@ -59,6 +59,27 @@ import { initialPhaseForSkill } from "../skill-state/initial-phase";
59
59
  export { initialPhaseForSkill };
60
60
  export declare function readVisibleSkillActiveState(cwd: string, sessionId?: string, stateDir?: string): Promise<SkillActiveState | null>;
61
61
  export declare function recordSkillActivation(input: RecordSkillActivationInput): Promise<SkillActiveState | null>;
62
+ export interface EnsureWorkflowSkillActivationInput {
63
+ cwd: string;
64
+ skill: string;
65
+ sessionId?: string;
66
+ threadId?: string;
67
+ turnId?: string;
68
+ nowIso?: string;
69
+ stateDir?: string;
70
+ }
71
+ /**
72
+ * Idempotently seed `.gjc/state` for a workflow skill that was invoked directly
73
+ * (e.g. via `/skill:<name>`) rather than through keyword detection. This ensures
74
+ * the mutation guard and Stop hook engage the moment a workflow skill becomes
75
+ * active, instead of relying on the skill prompt to run its own state-init steps.
76
+ *
77
+ * The seed is non-destructive: if an active entry for this skill already exists
78
+ * (for example after a `gjc state handoff` promotion that carries
79
+ * `handoff_from`/`handoff_at` lineage), nothing is written so lineage is
80
+ * preserved. Non-workflow skills are ignored.
81
+ */
82
+ export declare function ensureWorkflowSkillActivationState(input: EnsureWorkflowSkillActivationInput): Promise<SkillActiveState | null>;
62
83
  export declare function buildActiveUltragoalPromptContext(input: UserPromptSubmitStateInput): Promise<string | null>;
63
84
  export declare function buildSkillStopOutput(input: StopHookInput): Promise<Record<string, unknown> | null>;
64
85
  export declare function buildSkillActivationAdditionalContext(state: SkillActiveState, effectiveSkillConfig?: EffectiveSkillConfigInput): string;
@@ -1,4 +1,4 @@
1
- import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
1
+ import type { InternalResource, InternalUrl, ProtocolHandler, ResolveContext } from "./types";
2
2
  /**
3
3
  * Handler for agent:// URLs.
4
4
  *
@@ -8,5 +8,5 @@ import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
8
8
  export declare class AgentProtocolHandler implements ProtocolHandler {
9
9
  readonly scheme = "agent";
10
10
  readonly immutable = true;
11
- resolve(url: InternalUrl): Promise<InternalResource>;
11
+ resolve(url: InternalUrl, context?: ResolveContext): Promise<InternalResource>;
12
12
  }
@@ -1,6 +1,6 @@
1
- import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
1
+ import type { InternalResource, InternalUrl, ProtocolHandler, ResolveContext } from "./types";
2
2
  export declare class ArtifactProtocolHandler implements ProtocolHandler {
3
3
  readonly scheme = "artifact";
4
4
  readonly immutable = true;
5
- resolve(url: InternalUrl): Promise<InternalResource>;
5
+ resolve(url: InternalUrl, context?: ResolveContext): Promise<InternalResource>;
6
6
  }
@@ -1,10 +1,11 @@
1
+ import type { ResolveContext } from "./types";
1
2
  /**
2
- * Snapshot of artifacts dirs for every registered session, deduped.
3
+ * Snapshot of artifacts dirs explicitly authorized for the calling session.
3
4
  *
4
- * Prefers `sessionManager.getArtifactsDir()` because subagents adopt their
5
- * parent's `ArtifactManager` and report the parent's dir there; dedup then
6
- * collapses parent + N subagents (the whole agent tree) to one entry. Falls
7
- * back to the raw session file (with the `.jsonl` suffix stripped) when no
8
- * live session reference is attached.
5
+ * Normal reads are scoped to the caller's artifacts directory. Parent/child
6
+ * agent tree sharing is allowed only when the caller supplies explicit
7
+ * authorized directories at the ResolveContext boundary. This intentionally
8
+ * does not enumerate AgentRegistry.global(); live but unrelated sessions are
9
+ * not an authorization source.
9
10
  */
10
- export declare function artifactsDirsFromRegistry(): string[];
11
+ export declare function authorizedArtifactsDirsFromContext(context?: ResolveContext): string[];
@@ -56,6 +56,10 @@ export interface ResolveContext {
56
56
  cwd?: string;
57
57
  /** Settings of the calling session (used by `issue://`/`pr://` for cache TTLs). */
58
58
  settings?: unknown;
59
+ /** Artifacts directory of the calling session. */
60
+ getArtifactsDir?: () => string | null;
61
+ /** Additional artifacts directories explicitly authorized for this caller (for parent/child agent trees). */
62
+ getAuthorizedArtifactsDirs?: () => readonly string[];
59
63
  /** Caller's abort signal. */
60
64
  signal?: AbortSignal;
61
65
  }
@@ -93,8 +93,8 @@ export declare class LspTool implements AgentTool<typeof lspSchema, LspToolDetai
93
93
  readonly loadMode = "discoverable";
94
94
  readonly summary = "Query LSP (language server) for diagnostics, hover info, and references";
95
95
  readonly description: string;
96
- readonly parameters: import("zod/v4").ZodObject<{
97
- action: import("zod/v4").ZodEnum<{
96
+ readonly parameters: import("zod").ZodObject<{
97
+ action: import("zod").ZodEnum<{
98
98
  capabilities: "capabilities";
99
99
  code_actions: "code_actions";
100
100
  definition: "definition";
@@ -110,14 +110,14 @@ export declare class LspTool implements AgentTool<typeof lspSchema, LspToolDetai
110
110
  symbols: "symbols";
111
111
  type_definition: "type_definition";
112
112
  }>;
113
- file: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
114
- line: import("zod/v4").ZodOptional<import("zod/v4").ZodNumber>;
115
- symbol: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
116
- query: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
117
- new_name: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
118
- apply: import("zod/v4").ZodOptional<import("zod/v4").ZodBoolean>;
119
- timeout: import("zod/v4").ZodOptional<import("zod/v4").ZodNumber>;
120
- payload: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
113
+ file: import("zod").ZodOptional<import("zod").ZodString>;
114
+ line: import("zod").ZodOptional<import("zod").ZodNumber>;
115
+ symbol: import("zod").ZodOptional<import("zod").ZodString>;
116
+ query: import("zod").ZodOptional<import("zod").ZodString>;
117
+ new_name: import("zod").ZodOptional<import("zod").ZodString>;
118
+ apply: import("zod").ZodOptional<import("zod").ZodBoolean>;
119
+ timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
120
+ payload: import("zod").ZodOptional<import("zod").ZodString>;
121
121
  }, import("zod/v4/core").$strip>;
122
122
  readonly renderCall: typeof renderCall;
123
123
  readonly renderResult: typeof renderResult;
@@ -24,10 +24,19 @@ export interface AcpSessionFactoryOptions {
24
24
  sessionDir?: string;
25
25
  authStorage: AuthStorage;
26
26
  modelRegistry: ModelRegistry;
27
- parsedArgs: Pick<Args, "apiKey">;
27
+ parsedArgs: Pick<Args, "apiKey" | "default" | "model" | "mpreset" | "thinking">;
28
28
  rawArgs: string[];
29
29
  createSession: (options: CreateAgentSessionOptions) => Promise<CreateAgentSessionResult>;
30
30
  }
31
+ export declare function applyStartupModelProfiles(args: {
32
+ session: AgentSession;
33
+ settings: Settings;
34
+ modelRegistry: ModelRegistry;
35
+ parsedArgs: Pick<Args, "default" | "model" | "mpreset" | "thinking">;
36
+ startupModel?: CreateAgentSessionOptions["model"];
37
+ startupThinkingLevel?: CreateAgentSessionOptions["thinkingLevel"];
38
+ }): Promise<void>;
39
+ export declare function applyStartupModelProfilesOrExit(args: Parameters<typeof applyStartupModelProfiles>[0]): Promise<void>;
31
40
  /**
32
41
  * Build the per-`session/new` factory used by ACP mode.
33
42
  *
@@ -0,0 +1,12 @@
1
+ export interface BridgeAuthConfig {
2
+ token: string;
3
+ }
4
+ export interface BridgeBindConfig {
5
+ hostname: string;
6
+ port: number;
7
+ tlsConfigured: boolean;
8
+ }
9
+ export declare function extractBearerToken(authorization: string | null | undefined): string | undefined;
10
+ export declare function isBridgeTokenAuthorized(authorization: string | null | undefined, config: BridgeAuthConfig): boolean;
11
+ export declare function isLoopbackHost(hostname: string): boolean;
12
+ export declare function assertSafeBridgeBind(config: BridgeBindConfig): void;
@@ -0,0 +1,9 @@
1
+ import type { ClientBridge, ClientBridgePermissionOption, ClientBridgePermissionOutcome, ClientBridgePermissionToolCall } from "../../session/client-bridge";
2
+ import type { UiRequestBroker } from "../shared/agent-wire/ui-request-broker";
3
+ export interface BridgePermissionRequestPayload {
4
+ kind: "permission";
5
+ toolCall: ClientBridgePermissionToolCall;
6
+ options: ClientBridgePermissionOption[];
7
+ }
8
+ export type BridgePermissionBroker = UiRequestBroker<BridgePermissionRequestPayload, ClientBridgePermissionOutcome>;
9
+ export declare function createBridgeClientBridge(broker: BridgePermissionBroker): ClientBridge;
@@ -0,0 +1,44 @@
1
+ import type { ExtensionUIContext } from "../../extensibility/extensions";
2
+ import type { AgentSession } from "../../session/agent-session";
3
+ import type { ClientBridgePermissionOutcome } from "../../session/client-bridge";
4
+ import type { RpcCommand, RpcResponse } from "../rpc/rpc-types";
5
+ import { RpcHostToolBridge } from "../shared/agent-wire/host-tool-bridge";
6
+ import { RpcHostUriBridge } from "../shared/agent-wire/host-uri-bridge";
7
+ import { type BridgeCommandScope } from "../shared/agent-wire/scopes";
8
+ import { UiRequestBroker } from "../shared/agent-wire/ui-request-broker";
9
+ import type { BridgeUiResult } from "../shared/agent-wire/ui-result";
10
+ import { type BridgePermissionRequestPayload } from "./bridge-client-bridge";
11
+ import { type BridgeUiRequestPayload } from "./bridge-ui-context";
12
+ import { BridgeEventStream } from "./event-stream";
13
+ interface BridgeEndpointMatrix {
14
+ events: boolean;
15
+ commands: boolean;
16
+ control: boolean;
17
+ uiResponses: boolean;
18
+ hostToolResults: boolean;
19
+ hostUriResults: boolean;
20
+ }
21
+ interface BridgeFetchHandlerOptions {
22
+ sessionId: string;
23
+ token: string;
24
+ eventStream?: BridgeEventStream;
25
+ commandDispatcher?: (command: RpcCommand) => Promise<RpcResponse>;
26
+ commandScopes?: readonly BridgeCommandScope[];
27
+ idempotencyCache?: BridgeIdempotencyCache;
28
+ permissionBroker?: UiRequestBroker<BridgePermissionRequestPayload, ClientBridgePermissionOutcome>;
29
+ uiBroker?: UiRequestBroker<BridgeUiRequestPayload, BridgeUiResult<unknown>>;
30
+ hostToolBridge?: RpcHostToolBridge;
31
+ hostUriBridge?: RpcHostUriBridge;
32
+ endpointMatrix?: Partial<BridgeEndpointMatrix>;
33
+ }
34
+ interface BridgeIdempotencyRecord {
35
+ route: string;
36
+ ownerToken?: string;
37
+ body: string | Promise<string>;
38
+ response: unknown | Promise<unknown>;
39
+ pending?: boolean;
40
+ }
41
+ type BridgeIdempotencyCache = Map<string, BridgeIdempotencyRecord>;
42
+ export declare function createBridgeFetchHandler(options: BridgeFetchHandlerOptions): (request: Request) => Promise<Response>;
43
+ export declare function runBridgeMode(session: AgentSession, setToolUIContext?: (uiContext: ExtensionUIContext, hasUI: boolean) => void): Promise<never>;
44
+ export {};