@gajae-code/coding-agent 0.12.6 → 0.12.7

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 (70) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/dist/types/async/job-manager.d.ts +36 -1
  3. package/dist/types/eval/backend.d.ts +2 -2
  4. package/dist/types/exec/bash-executor.d.ts +8 -10
  5. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +0 -36
  6. package/dist/types/internal-urls/registry-helpers.d.ts +0 -18
  7. package/dist/types/sdk/bus/chat-daemon-control.d.ts +1 -3
  8. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +2 -4
  9. package/dist/types/sdk/host/host.d.ts +2 -23
  10. package/dist/types/sdk/host/reverse-leases.d.ts +4 -7
  11. package/dist/types/session/artifacts.d.ts +5 -8
  12. package/dist/types/session/client-bridge.d.ts +0 -14
  13. package/dist/types/session/internal/managed-session-storage.d.ts +2 -5
  14. package/dist/types/session/messages.d.ts +1 -4
  15. package/dist/types/session/session-manager.d.ts +4 -5
  16. package/dist/types/session/streaming-output.d.ts +0 -32
  17. package/dist/types/task/receipt.d.ts +1 -2
  18. package/dist/types/task/types.d.ts +43 -178
  19. package/dist/types/tools/bash.d.ts +1 -1
  20. package/dist/types/tools/fetch.d.ts +0 -3
  21. package/dist/types/tools/output-meta.d.ts +5 -37
  22. package/dist/types/tools/subagent.d.ts +15 -0
  23. package/dist/types/tools/todo-write.d.ts +3 -0
  24. package/dist/types/tools/tool-result.d.ts +0 -1
  25. package/package.json +8 -8
  26. package/src/async/job-manager.ts +430 -46
  27. package/src/cursor.ts +13 -20
  28. package/src/defaults/gjc/skills/ultragoal/SKILL.md +2 -3
  29. package/src/eval/backend.ts +2 -2
  30. package/src/exec/bash-executor.ts +151 -425
  31. package/src/gjc-runtime/ultragoal-runtime.ts +3 -280
  32. package/src/gjc-runtime/workflow-manifest.generated.json +1 -40
  33. package/src/gjc-runtime/workflow-manifest.ts +0 -12
  34. package/src/internal-urls/agent-protocol.ts +38 -98
  35. package/src/internal-urls/artifact-protocol.ts +17 -28
  36. package/src/internal-urls/docs-index.generated.ts +1 -1
  37. package/src/internal-urls/registry-helpers.ts +0 -62
  38. package/src/modes/acp/acp-agent.ts +0 -24
  39. package/src/modes/acp/acp-client-bridge.ts +11 -154
  40. package/src/prompts/tools/bash.md +2 -2
  41. package/src/sdk/acp/adapter.ts +9 -200
  42. package/src/sdk/bus/chat-daemon-control.ts +3 -5
  43. package/src/sdk/bus/index.ts +8 -324
  44. package/src/sdk/bus/telegram-daemon-contract.ts +2 -4
  45. package/src/sdk/host/host.ts +9 -187
  46. package/src/sdk/host/reverse-leases.ts +42 -249
  47. package/src/session/agent-session.ts +15 -178
  48. package/src/session/artifacts.ts +74 -211
  49. package/src/session/client-bridge.ts +0 -15
  50. package/src/session/internal/managed-session-storage.ts +5 -104
  51. package/src/session/messages.ts +7 -32
  52. package/src/session/session-manager.ts +21 -12
  53. package/src/session/streaming-output.ts +40 -198
  54. package/src/task/index.ts +230 -64
  55. package/src/task/receipt.ts +2 -4
  56. package/src/task/render.ts +0 -30
  57. package/src/task/types.ts +10 -34
  58. package/src/tools/bash.ts +239 -818
  59. package/src/tools/eval.ts +4 -99
  60. package/src/tools/fetch.ts +15 -77
  61. package/src/tools/find.ts +3 -7
  62. package/src/tools/output-meta.ts +114 -696
  63. package/src/tools/search.ts +4 -9
  64. package/src/tools/subagent.ts +97 -75
  65. package/src/tools/todo-write.ts +47 -0
  66. package/src/tools/tool-result.ts +0 -1
  67. package/dist/types/gjc-runtime/ultragoal-review-source.d.ts +0 -83
  68. package/dist/types/utils/artifact-id.d.ts +0 -2
  69. package/src/gjc-runtime/ultragoal-review-source.ts +0 -378
  70. package/src/utils/artifact-id.ts +0 -6
package/src/cursor.ts CHANGED
@@ -14,7 +14,6 @@ import type {
14
14
  ToolResultMessage,
15
15
  } from "@gajae-code/ai";
16
16
  import { sanitizeText } from "@gajae-code/utils";
17
- import { finalizeToolResultForDelivery } from "./tools/output-meta";
18
17
  import { resolveToCwd } from "./tools/path-utils";
19
18
 
20
19
  interface CursorExecBridgeOptions {
@@ -49,14 +48,6 @@ function buildToolErrorResult(message: string): AgentToolResult<unknown> {
49
48
  };
50
49
  }
51
50
 
52
- async function buildFinalToolErrorResult(
53
- options: CursorExecBridgeOptions,
54
- toolName: string,
55
- message: string,
56
- ): Promise<AgentToolResult<unknown>> {
57
- return finalizeToolResultForDelivery(buildToolErrorResult(message), toolName, options.getToolContext?.());
58
- }
59
-
60
51
  async function executeTool(
61
52
  options: CursorExecBridgeOptions,
62
53
  toolName: string,
@@ -65,12 +56,11 @@ async function executeTool(
65
56
  ): Promise<ToolResultMessage> {
66
57
  const tool = options.tools.get(toolName);
67
58
  if (!tool) {
68
- const result = await buildFinalToolErrorResult(options, toolName, `Tool "${toolName}" not available`);
59
+ const result = buildToolErrorResult(`Tool "${toolName}" not available`);
69
60
  return createToolResultMessage(toolCallId, toolName, result, true);
70
61
  }
71
62
 
72
63
  options.emitEvent?.({ type: "tool_execution_start", toolCallId, toolName, args });
73
- const context = options.getToolContext?.();
74
64
 
75
65
  let result: AgentToolResult<unknown>;
76
66
  let isError = false;
@@ -92,10 +82,16 @@ async function executeTool(
92
82
  : undefined;
93
83
 
94
84
  try {
95
- result = await tool.execute(toolCallId, args as Record<string, unknown>, undefined, onUpdate, context);
85
+ result = await tool.execute(
86
+ toolCallId,
87
+ args as Record<string, unknown>,
88
+ undefined,
89
+ onUpdate,
90
+ options.getToolContext?.(),
91
+ );
96
92
  } catch (error) {
97
93
  const message = error instanceof Error ? error.message : String(error);
98
- result = await buildFinalToolErrorResult(options, toolName, message);
94
+ result = buildToolErrorResult(message);
99
95
  isError = true;
100
96
  }
101
97
 
@@ -137,7 +133,6 @@ async function executeDelete(options: CursorExecBridgeOptions, pathArg: string,
137
133
  result = buildToolErrorResult(message);
138
134
  isError = true;
139
135
  }
140
- result = await finalizeToolResultForDelivery(result, toolName, options.getToolContext?.());
141
136
 
142
137
  options.emitEvent?.({ type: "tool_execution_end", toolCallId, toolName, result, isError });
143
138
  return createToolResultMessage(toolCallId, toolName, result, isError);
@@ -227,9 +222,7 @@ export class CursorExecHandlers implements ICursorExecHandlers {
227
222
  const globPath = `${args.path || "."}/${args.glob}`;
228
223
  return executeTool(this.#optionsForCall(), "find", toolCallId, { paths: [globPath] });
229
224
  }
230
- const result = await buildFinalToolErrorResult(
231
- this.#optionsForCall(),
232
- "search",
225
+ const result = buildToolErrorResult(
233
226
  "Cursor grep request rejected: pattern must not be empty. Provide a non-empty search pattern.",
234
227
  );
235
228
  return createToolResultMessage(toolCallId, "search", result, true);
@@ -279,7 +272,7 @@ export class CursorExecHandlers implements ICursorExecHandlers {
279
272
  const toolName = "bash";
280
273
  const tool = options.tools.get(toolName);
281
274
  if (!tool) {
282
- const result = await buildFinalToolErrorResult(options, toolName, `Tool "${toolName}" not available`);
275
+ const result = buildToolErrorResult(`Tool "${toolName}" not available`);
283
276
  return createToolResultMessage(toolCallId, toolName, result, true);
284
277
  }
285
278
 
@@ -338,7 +331,7 @@ export class CursorExecHandlers implements ICursorExecHandlers {
338
331
  result = await tool.execute(toolCallId, toolArgs, undefined, onUpdate, options.getToolContext?.());
339
332
  } catch (error) {
340
333
  const message = error instanceof Error ? error.message : String(error);
341
- result = await buildFinalToolErrorResult(options, toolName, message);
334
+ result = buildToolErrorResult(message);
342
335
  isError = true;
343
336
  }
344
337
 
@@ -388,7 +381,7 @@ export class CursorExecHandlers implements ICursorExecHandlers {
388
381
  if (!tool) {
389
382
  const availableTools = Array.from(options.tools.keys()).filter(name => name.startsWith("mcp__"));
390
383
  const message = formatMcpToolErrorMessage(toolName, availableTools);
391
- const result = await buildFinalToolErrorResult(options, toolName, message);
384
+ const result = buildToolErrorResult(message);
392
385
  return createToolResultMessage(toolCallId, toolName, result, true);
393
386
  }
394
387
 
@@ -295,8 +295,7 @@ The heavyweight gate runs **once per boundary generation**, not once per story a
295
295
  One generation freezes the change set and reviews it exactly once:
296
296
 
297
297
  1. Run implementation verification for the boundary's cumulative change set.
298
- 2. **Freeze the change set.** Use the native coordinator: run `gjc ultragoal review-source freeze --json` before dispatch, then create each lane with `gjc ultragoal review-source dispatch --cohort-id <id> --task-id <id> --lane <cleaner|architect|qa|critic> --rerun-command <command> --json` and pass the returned leader-issued `reviewSource` object to `task`. The runtime derives and persists the canonical source identity; never hand-author or copy a `sourceHash`. Every delivered lane receipt is classified `current`, `stale_review_delivery`, or `invalid_provenance` against the active source, and only current runtime-owned delivery IDs may enter the gate.
299
-
298
+ 2. **Freeze the change set.** Compute one immutable `sourceHash` over the reviewed source. Every lane in this generation inspects that same frozen snapshot; a lane verdict carrying a different `sourceHash` is rejected.
300
299
  3. **Run the cohort lanes on the frozen snapshot** — at most one `cleaner`, one `architect`, and one `qa` lane per generation. They may run in parallel because they share the frozen source; a second architect or QA lane in the same generation is rejected. The `cleaner` lane is the internal ai-slop-cleaner skill fragment run over the frozen change set: a read-only detector that emits an `AI SLOP CLEANUP REPORT`, and it still runs and records a passed/no-op report when there are no relevant edits. Its BLOCKING findings join the cohort findings rather than starting their own fix loop; advisory findings are included in the gate report only and are not written to the Ultragoal ledger.
301
300
  4. Delegate an `architect` review covering all three lanes:
302
301
  - architecture-side: system boundaries, layering, data/control flow, operational risks.
@@ -310,7 +309,7 @@ One generation freezes the change set and reviews it exactly once:
310
309
  - API/package surfaces require a real artifact file or typed receipt whose artifact `kind` contains one of `api`, `package`, `consumer`, `black-box`, or `test-report`; examples: `api-package-test-report`, `package-consumer-report`, `black-box-api-receipt`. Algorithm/math surfaces require a real artifact file or typed receipt whose artifact `kind` contains one of `property`, `boundary`, `edge`, `adversarial`, `failure`, `math`, `algorithm`, or `test-report`; examples: `property-test-report`, `algorithm-boundary-report`. Bare `inlineEvidence` text alone is not sufficient for any surface.
311
310
  - The mandatory **computer-use** red-team suite (`kill-switch-bypass`, `suspended-enforcement`, `permission-revoked`, …) is conditional, not universal: require it only when computer/desktop control is genuinely part of the product surface being dogfooded. For every other product type, prove the change through the matching live surface instead — browser-use automation for web/GUI, bash/CLI live invocation or argv replay for CLI, and real artifacts or typed receipts for API/package/algorithm/math. Editing docs, prompts, or skills that merely mention computer-use does not by itself make the computer-use suite applicable; pick the red-team surface that matches what the change actually ships.
312
311
  7. The executor QA/red-team lane must report a matrix using `executorQa.contractCoverage`, `executorQa.surfaceEvidence`, `executorQa.adversarialCases`, and `executorQa.artifactRefs`. Not-applicable rows are allowed only in `contractCoverage` and `surfaceEvidence`; each `status: "not_applicable"` row requires `contractRef` plus `reason`. `adversarialCases` rows cannot be not-applicable.
313
- 8. **Join before repairing.** Fold all three lane verdicts and the final code review into the strict gate under `iteration.reviewCohort` (`cohortId`, `reviewGeneration`, runtime-derived `sourceHash`, `joined: true`, and the three lanes with runtime-issued `deliveryId`). No lane may checkpoint on its own, and no fix work starts until the findings are joined. A `stale_review_delivery` stays visible for audit, is excluded from approval and blocker authority, and must be rerun using the rendered command. Clean means `architectReview.architectureStatus`, `architectReview.productStatus`, and `architectReview.codeStatus` are all `"CLEAR"`, `architectReview.recommendation` is `"APPROVE"`, executor QA statuses are `"passed"`, iteration is `"passed"` with `fullRerun: true`, the cohort is joined with every lane clean and receipt-bound to the active snapshot, every evidence field is non-empty, every required matrix row is present, and every blockers array is empty. `COMMENT`, `WATCH`, `REQUEST CHANGES`, `BLOCK`, stale/invalid provenance, missing evidence, missing or shallow matrix rows, plan/code mismatches, or non-empty blockers are non-clean.
312
+ 8. **Join before repairing.** Fold all three lane verdicts and the final code review into the strict gate under `iteration.reviewCohort` (`reviewGeneration`, `sourceHash`, `joined: true`, and the three `lanes`). No lane may checkpoint on its own, and no fix work starts until the findings are joined. Clean means `architectReview.architectureStatus`, `architectReview.productStatus`, and `architectReview.codeStatus` are all `"CLEAR"`, `architectReview.recommendation` is `"APPROVE"`, executor QA statuses are `"passed"`, iteration is `"passed"` with `fullRerun: true`, the cohort is joined with every lane clean and hash-bound, every evidence field is non-empty, every required matrix row is present, and every blockers array is empty. `COMMENT`, `WATCH`, `REQUEST CHANGES`, `BLOCK`, missing evidence, missing or shallow matrix rows, plan/code mismatches, or non-empty blockers are non-clean.
314
313
  9. If the joined findings contain any blocker, do **not** checkpoint `complete` and do **not** call `goal({"op":"complete"})`. Record **one consolidated blocker batch** for all findings from the whole cohort instead of one story per lane:
315
314
  ```sh
316
315
  gjc ultragoal record-review-blockers --goal-id <id> --title "Resolve verification blockers" --objective "<blocker-resolution objective>" --evidence "<joined cohort findings>"
@@ -11,8 +11,8 @@ export interface ExecutorBackendExecOptions {
11
11
  session: ToolSession;
12
12
  deadlineMs: number;
13
13
  reset: boolean;
14
- artifactPath?: string;
15
- artifactId?: string;
14
+ artifactPath: string | undefined;
15
+ artifactId: string | undefined;
16
16
  onChunk: (chunk: string) => void;
17
17
  }
18
18