@gajae-code/coding-agent 0.9.2 → 0.9.4

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 (86) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/types/build-metadata.d.ts +7 -0
  3. package/dist/types/capability/mcp.d.ts +3 -1
  4. package/dist/types/commands/mcp.d.ts +1 -1
  5. package/dist/types/config/keybindings.d.ts +2 -2
  6. package/dist/types/modes/components/hook-selector.d.ts +1 -0
  7. package/dist/types/modes/components/status-line/types.d.ts +6 -0
  8. package/dist/types/modes/components/status-line.d.ts +1 -0
  9. package/dist/types/modes/components/welcome.d.ts +1 -0
  10. package/dist/types/modes/rpc/rpc-client.d.ts +7 -2
  11. package/dist/types/modes/utils/ui-helpers.d.ts +12 -0
  12. package/dist/types/notifications/telegram-daemon.d.ts +2 -0
  13. package/dist/types/runtime-mcp/config-writer.d.ts +4 -3
  14. package/dist/types/runtime-mcp/types.d.ts +5 -4
  15. package/dist/types/session/agent-session.d.ts +16 -0
  16. package/dist/types/session/session-manager.d.ts +1 -0
  17. package/dist/types/tools/skill.d.ts +9 -8
  18. package/dist/types/utils/linkedom.d.ts +4 -0
  19. package/dist/types/utils/pasted-image-path.d.ts +5 -3
  20. package/package.json +11 -7
  21. package/scripts/build-binary.ts +2 -40
  22. package/scripts/compile-args.ts +96 -0
  23. package/scripts/generate-docs-index.ts +1 -0
  24. package/src/build-metadata.ts +104 -0
  25. package/src/capability/mcp.ts +3 -1
  26. package/src/cli/mcp-cli.ts +108 -26
  27. package/src/cli.ts +21 -0
  28. package/src/commands/mcp.ts +8 -8
  29. package/src/commands/stats.ts +6 -2
  30. package/src/config/keybindings.ts +2 -2
  31. package/src/config/mcp-schema.json +21 -17
  32. package/src/coordinator-mcp/server.ts +7 -4
  33. package/src/discovery/builtin.ts +14 -0
  34. package/src/discovery/mcp-json.ts +14 -0
  35. package/src/eval/js/executor.ts +7 -1
  36. package/src/gjc-runtime/state-runtime.ts +105 -12
  37. package/src/gjc-runtime/workflow-manifest.generated.json +4 -28
  38. package/src/gjc-runtime/workflow-manifest.ts +1 -7
  39. package/src/internal-urls/docs-index.generated.ts +3 -2
  40. package/src/internal-urls/gjc-protocol.ts +14 -1
  41. package/src/modes/components/assistant-message.ts +1 -1
  42. package/src/modes/components/hook-selector.ts +4 -0
  43. package/src/modes/components/session-selector.ts +2 -2
  44. package/src/modes/components/status-line/presets.ts +5 -7
  45. package/src/modes/components/status-line/segments.ts +14 -0
  46. package/src/modes/components/status-line/types.ts +6 -0
  47. package/src/modes/components/status-line.ts +13 -6
  48. package/src/modes/components/tool-execution.ts +1 -1
  49. package/src/modes/components/welcome.ts +4 -1
  50. package/src/modes/controllers/command-controller.ts +1 -1
  51. package/src/modes/controllers/event-controller.ts +9 -9
  52. package/src/modes/controllers/input-controller.ts +8 -2
  53. package/src/modes/controllers/selector-controller.ts +7 -3
  54. package/src/modes/interactive-mode.ts +12 -4
  55. package/src/modes/rpc/rpc-client.ts +30 -6
  56. package/src/modes/utils/ui-helpers.ts +154 -32
  57. package/src/notifications/telegram-daemon.ts +28 -2
  58. package/src/prompts/tools/skill.md +2 -2
  59. package/src/runtime-mcp/config-writer.ts +4 -3
  60. package/src/runtime-mcp/config.ts +1 -0
  61. package/src/runtime-mcp/types.ts +5 -4
  62. package/src/session/agent-session.ts +117 -3
  63. package/src/session/session-manager.ts +68 -40
  64. package/src/slash-commands/builtin-registry.ts +9 -4
  65. package/src/tools/bash-interactive.ts +9 -4
  66. package/src/tools/browser/readable.ts +2 -2
  67. package/src/tools/fetch.ts +5 -5
  68. package/src/tools/skill.ts +14 -11
  69. package/src/utils/linkedom.ts +14 -0
  70. package/src/utils/pasted-image-path.ts +23 -9
  71. package/src/web/scrapers/arxiv.ts +2 -2
  72. package/src/web/scrapers/go-pkg.ts +2 -2
  73. package/src/web/scrapers/iacr.ts +2 -2
  74. package/src/web/scrapers/readthedocs.ts +2 -2
  75. package/src/web/scrapers/twitter.ts +3 -2
  76. package/src/web/scrapers/wikipedia.ts +2 -2
  77. package/src/export/html/template.css +0 -1060
  78. package/src/export/html/template.html +0 -47
  79. package/src/export/html/template.js +0 -2314
  80. package/vendor/insane-search/engine/tests/test_hardening.py +0 -57
  81. package/vendor/insane-search/engine/tests/test_smoke.py +0 -152
  82. package/vendor/insane-search/engine/tests/test_u1.py +0 -200
  83. package/vendor/insane-search/engine/tests/test_u4.py +0 -131
  84. package/vendor/insane-search/engine/tests/test_u5.py +0 -163
  85. package/vendor/insane-search/engine/tests/test_u7.py +0 -124
  86. package/vendor/insane-search/engine/tests/test_u8.py +0 -216
@@ -242,9 +242,12 @@ function assertSafePathComponent(value: string, label: string): void {
242
242
  throw new StateCommandError(2, `invalid path component for --${label}: ${value}`);
243
243
  }
244
244
  }
245
+ function isKnownMode(mode: string): mode is CanonicalGjcWorkflowSkill {
246
+ return KNOWN_MODES.includes(mode);
247
+ }
245
248
 
246
249
  function assertKnownMode(mode: string): asserts mode is CanonicalGjcWorkflowSkill {
247
- if (!KNOWN_MODES.includes(mode)) {
250
+ if (!isKnownMode(mode)) {
248
251
  throw new StateCommandError(2, `unknown --mode: ${mode}. Expected one of: ${KNOWN_MODES.join(", ")}.`);
249
252
  }
250
253
  }
@@ -1580,14 +1583,15 @@ async function handleHandoff(
1580
1583
  if (!calleeRaw) {
1581
1584
  throw new StateCommandError(2, "gjc state handoff requires --to <callee>");
1582
1585
  }
1583
- assertKnownMode(calleeRaw);
1584
- const callee = calleeRaw as CanonicalGjcWorkflowSkill;
1586
+ assertSafePathComponent(calleeRaw, "to");
1587
+ const callee = calleeRaw;
1588
+ const calleeIsWorkflow = isKnownMode(callee);
1585
1589
  if (callee === caller) {
1586
1590
  throw new StateCommandError(2, `gjc state handoff: --to must differ from caller (both are "${caller}")`);
1587
1591
  }
1588
1592
 
1589
1593
  const callerPath = modeStateFile(cwd, caller, sessionId);
1590
- const calleePath = modeStateFile(cwd, callee, sessionId);
1594
+ const calleePath = calleeIsWorkflow ? modeStateFile(cwd, callee, sessionId) : undefined;
1591
1595
  const forced = hasFlag(args, "--force");
1592
1596
  const callerRead = await readExistingStateForMutation(callerPath);
1593
1597
  if (callerRead.kind === "corrupt" && !forced) {
@@ -1602,15 +1606,7 @@ async function handleHandoff(
1602
1606
  `gjc state ${caller} handoff: caller is not active (no mode-state file at ${callerPath})`,
1603
1607
  );
1604
1608
  }
1605
- const calleeRead = await readExistingStateForMutation(calleePath);
1606
- if (calleeRead.kind === "corrupt" && !forced) {
1607
- throw new StateCommandError(
1608
- 2,
1609
- `existing state for ${callee} is corrupt or tampered (${calleeRead.error}); use --force to overwrite`,
1610
- );
1611
- }
1612
1609
  const existingCaller = callerRead.kind === "valid" ? callerRead.value : {};
1613
- const existingCallee = calleeRead.kind === "valid" ? calleeRead.value : {};
1614
1610
 
1615
1611
  const handoffAt = nowIso();
1616
1612
  const mutationId = `${caller}:handoff:${callee}:${handoffAt}`;
@@ -1623,6 +1619,103 @@ async function handleHandoff(
1623
1619
  nowIso: handoffAt,
1624
1620
  mutationId,
1625
1621
  });
1622
+
1623
+ // Runtime callees have no native mode-state to clear later, so do not
1624
+ // persist them as active-state entries; the prompt observer tracks them
1625
+ // in memory the same way direct `/skill:<runtime>` invocation does.
1626
+ if (!calleeIsWorkflow) {
1627
+ const normalizedCaller =
1628
+ caller === "deep-interview"
1629
+ ? (normalizeDeepInterviewEnvelope(migrateWorkflowState(existingCaller, caller).state) as Record<
1630
+ string,
1631
+ unknown
1632
+ >)
1633
+ : migrateWorkflowState(existingCaller, caller).state;
1634
+ const mergedCallerState: Record<string, unknown> = {
1635
+ ...normalizedCaller,
1636
+ skill: caller,
1637
+ version: WORKFLOW_STATE_VERSION,
1638
+ active: false,
1639
+ current_phase: "handoff",
1640
+ handoff_to: callee,
1641
+ handoff_at: handoffAt,
1642
+ updated_at: handoffAt,
1643
+ receipt: callerReceipt,
1644
+ };
1645
+ const force = hasFlag(args, "--force");
1646
+ await beginWorkflowTransactionJournal({
1647
+ cwd,
1648
+ sessionId,
1649
+ mutationId,
1650
+ caller,
1651
+ paths: [callerPath, activeStateFile(cwd, sessionId)],
1652
+ });
1653
+ const callerWrite = await writeJsonAtomic(cwd, callerPath, mergedCallerState, "handoff", {
1654
+ sessionId,
1655
+ skill: caller,
1656
+ mutationId,
1657
+ force,
1658
+ fromPhase: typeof existingCaller.current_phase === "string" ? existingCaller.current_phase : undefined,
1659
+ toPhase: "handoff",
1660
+ });
1661
+ await updateWorkflowTransactionJournal(cwd, sessionId, mutationId, { steps: ["caller-mode-state"] });
1662
+ if (callerWrite.warning) process.stderr.write(`${callerWrite.warning}\n`);
1663
+ const stampedCallerReceipt = isPlainObject(callerWrite.stamped.receipt) ? callerWrite.stamped.receipt : {};
1664
+ await syncSkillActiveState({
1665
+ cwd,
1666
+ skill: caller,
1667
+ active: false,
1668
+ phase: "handoff",
1669
+ sessionId,
1670
+ threadId,
1671
+ turnId,
1672
+ source: "gjc-state-cli",
1673
+ hud: buildHudForMode(caller, mergedCallerState),
1674
+ handoff_to: callee,
1675
+ handoff_at: handoffAt,
1676
+ receipt: callerReceipt,
1677
+ });
1678
+ await updateWorkflowTransactionJournal(cwd, sessionId, mutationId, {
1679
+ steps: ["caller-mode-state", "active-state"],
1680
+ });
1681
+ await completeWorkflowTransactionJournal(cwd, sessionId, mutationId);
1682
+ await touchStateActivityMarker(cwd, sessionId, callerPath);
1683
+ return {
1684
+ status: 0,
1685
+ stdout: renderCliWriteReceipt({
1686
+ ok: true,
1687
+ from: caller,
1688
+ to: callee,
1689
+ handoff_at: handoffAt,
1690
+ phases: {
1691
+ from: mergedCallerState.current_phase,
1692
+ },
1693
+ receipts: {
1694
+ from: {
1695
+ mutation_id: stampedCallerReceipt.mutation_id,
1696
+ status: stampedCallerReceipt.status,
1697
+ content_sha256: stampedCallerReceipt.content_sha256,
1698
+ },
1699
+ },
1700
+ paths: {
1701
+ from: callerPath,
1702
+ active_state: activeStateFile(cwd, sessionId),
1703
+ },
1704
+ }),
1705
+ };
1706
+ }
1707
+
1708
+ if (!calleePath) {
1709
+ throw new StateCommandError(2, `gjc state handoff failed to resolve workflow callee path for ${callee}`);
1710
+ }
1711
+ const calleeRead = await readExistingStateForMutation(calleePath);
1712
+ if (calleeRead.kind === "corrupt" && !forced) {
1713
+ throw new StateCommandError(
1714
+ 2,
1715
+ `existing state for ${callee} is corrupt or tampered (${calleeRead.error}); use --force to overwrite`,
1716
+ );
1717
+ }
1718
+ const existingCallee = calleeRead.kind === "valid" ? calleeRead.value : {};
1626
1719
  const calleeReceipt = buildWorkflowStateReceipt({
1627
1720
  cwd,
1628
1721
  skill: callee,
@@ -127,15 +127,9 @@
127
127
  "appliesToVerbs": [
128
128
  "handoff"
129
129
  ],
130
- "enumValues": [
131
- "deep-interview",
132
- "ralplan",
133
- "ultragoal",
134
- "team"
135
- ],
136
130
  "name": "to",
137
131
  "required": true,
138
- "type": "enum"
132
+ "type": "string"
139
133
  },
140
134
  {
141
135
  "appliesToVerbs": [
@@ -529,15 +523,9 @@
529
523
  "appliesToVerbs": [
530
524
  "handoff"
531
525
  ],
532
- "enumValues": [
533
- "deep-interview",
534
- "ralplan",
535
- "ultragoal",
536
- "team"
537
- ],
538
526
  "name": "to",
539
527
  "required": true,
540
- "type": "enum"
528
+ "type": "string"
541
529
  },
542
530
  {
543
531
  "appliesToVerbs": [
@@ -913,15 +901,9 @@
913
901
  "appliesToVerbs": [
914
902
  "handoff"
915
903
  ],
916
- "enumValues": [
917
- "deep-interview",
918
- "ralplan",
919
- "ultragoal",
920
- "team"
921
- ],
922
904
  "name": "to",
923
905
  "required": true,
924
- "type": "enum"
906
+ "type": "string"
925
907
  },
926
908
  {
927
909
  "appliesToVerbs": [
@@ -1357,15 +1339,9 @@
1357
1339
  "appliesToVerbs": [
1358
1340
  "handoff"
1359
1341
  ],
1360
- "enumValues": [
1361
- "deep-interview",
1362
- "ralplan",
1363
- "ultragoal",
1364
- "team"
1365
- ],
1366
1342
  "name": "to",
1367
1343
  "required": true,
1368
- "type": "enum"
1344
+ "type": "string"
1369
1345
  },
1370
1346
  {
1371
1347
  "appliesToVerbs": [
@@ -72,13 +72,7 @@ const COMMON_TYPED_ARGS: TypedArgSpec[] = [
72
72
  { name: "session-id", type: "string", appliesToVerbs: [...STATE_VERBS, "kickoff", "write-spec", "write-artifact"] },
73
73
  { name: "thread-id", type: "string", appliesToVerbs: ["write", "clear", "handoff"] },
74
74
  { name: "turn-id", type: "string", appliesToVerbs: ["write", "clear", "handoff"] },
75
- {
76
- name: "to",
77
- type: "enum",
78
- enumValues: [...CANONICAL_GJC_WORKFLOW_SKILLS],
79
- required: true,
80
- appliesToVerbs: ["handoff"],
81
- },
75
+ { name: "to", type: "string", required: true, appliesToVerbs: ["handoff"] },
82
76
  { name: "replace", type: "boolean", appliesToVerbs: ["write"] },
83
77
  { name: "force", type: "boolean", appliesToVerbs: ["write", "clear", "handoff"] },
84
78
  { name: "skill", type: "enum", enumValues: [...CANONICAL_GJC_WORKFLOW_SKILLS], appliesToVerbs: ["doctor"] },