@gajae-code/coding-agent 0.7.1 → 0.7.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 (92) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/types/cli/notify-cli.d.ts +2 -0
  3. package/dist/types/config/settings-schema.d.ts +39 -2
  4. package/dist/types/extensibility/shared-events.d.ts +1 -0
  5. package/dist/types/gjc-runtime/ralplan-runtime.d.ts +1 -1
  6. package/dist/types/lsp/types.d.ts +2 -0
  7. package/dist/types/notifications/attachment-registry.d.ts +17 -0
  8. package/dist/types/notifications/chat-adapters.d.ts +9 -0
  9. package/dist/types/notifications/config.d.ts +9 -1
  10. package/dist/types/notifications/engine.d.ts +59 -0
  11. package/dist/types/notifications/managed-daemon.d.ts +48 -0
  12. package/dist/types/notifications/telegram-daemon.d.ts +19 -0
  13. package/dist/types/notifications/threaded-inbound.d.ts +19 -0
  14. package/dist/types/notifications/threaded-render.d.ts +6 -1
  15. package/dist/types/session/agent-session.d.ts +2 -0
  16. package/dist/types/tools/fetch.d.ts +23 -0
  17. package/dist/types/tools/index.d.ts +1 -0
  18. package/dist/types/tools/telegram-send.d.ts +32 -0
  19. package/dist/types/web/insane/bridge.d.ts +103 -0
  20. package/dist/types/web/insane/url-guard.d.ts +22 -0
  21. package/dist/types/web/search/provider.d.ts +18 -1
  22. package/dist/types/web/search/providers/insane.d.ts +53 -0
  23. package/dist/types/web/search/providers/text-citations.d.ts +23 -0
  24. package/dist/types/web/search/types.d.ts +12 -4
  25. package/package.json +10 -8
  26. package/scripts/verify-insane-vendor.ts +132 -0
  27. package/src/cli/args.ts +1 -1
  28. package/src/cli/fast-help.ts +1 -1
  29. package/src/cli/notify-cli.ts +152 -5
  30. package/src/commands/team.ts +1 -1
  31. package/src/config/settings-schema.ts +30 -1
  32. package/src/defaults/gjc/skills/ralplan/SKILL.md +11 -4
  33. package/src/extensibility/shared-events.ts +1 -0
  34. package/src/gjc-runtime/launch-tmux.ts +17 -3
  35. package/src/gjc-runtime/ledger-event-renderer.ts +1 -0
  36. package/src/gjc-runtime/ralplan-runtime.ts +2 -2
  37. package/src/gjc-runtime/workflow-manifest.generated.json +29 -0
  38. package/src/gjc-runtime/workflow-manifest.ts +7 -2
  39. package/src/internal-urls/docs-index.generated.ts +7 -7
  40. package/src/lsp/config.ts +16 -3
  41. package/src/lsp/defaults.json +7 -0
  42. package/src/lsp/types.ts +2 -0
  43. package/src/modes/controllers/event-controller.ts +15 -0
  44. package/src/modes/interactive-mode.ts +46 -2
  45. package/src/modes/utils/context-usage.ts +2 -2
  46. package/src/notifications/attachment-registry.ts +23 -0
  47. package/src/notifications/chat-adapters.ts +147 -0
  48. package/src/notifications/config.ts +23 -2
  49. package/src/notifications/engine.ts +100 -0
  50. package/src/notifications/index.ts +180 -38
  51. package/src/notifications/managed-daemon.ts +163 -0
  52. package/src/notifications/telegram-daemon.ts +235 -14
  53. package/src/notifications/threaded-inbound.ts +60 -4
  54. package/src/notifications/threaded-render.ts +20 -2
  55. package/src/session/agent-session.ts +82 -51
  56. package/src/tools/fetch.ts +78 -1
  57. package/src/tools/index.ts +3 -0
  58. package/src/tools/telegram-send.ts +137 -0
  59. package/src/web/insane/bridge.ts +350 -0
  60. package/src/web/insane/url-guard.ts +155 -0
  61. package/src/web/search/provider.ts +77 -18
  62. package/src/web/search/providers/anthropic.ts +70 -3
  63. package/src/web/search/providers/codex.ts +1 -119
  64. package/src/web/search/providers/gemini.ts +99 -0
  65. package/src/web/search/providers/insane.ts +551 -0
  66. package/src/web/search/providers/openai-compatible.ts +66 -32
  67. package/src/web/search/providers/text-citations.ts +111 -0
  68. package/src/web/search/types.ts +13 -2
  69. package/vendor/insane-search/LICENSE +21 -0
  70. package/vendor/insane-search/MANIFEST.json +24 -0
  71. package/vendor/insane-search/engine/__init__.py +23 -0
  72. package/vendor/insane-search/engine/__main__.py +128 -0
  73. package/vendor/insane-search/engine/bias_check.py +183 -0
  74. package/vendor/insane-search/engine/executor.py +254 -0
  75. package/vendor/insane-search/engine/fetch_chain.py +725 -0
  76. package/vendor/insane-search/engine/learning.py +175 -0
  77. package/vendor/insane-search/engine/phase0.py +214 -0
  78. package/vendor/insane-search/engine/safety.py +91 -0
  79. package/vendor/insane-search/engine/templates/package.json +11 -0
  80. package/vendor/insane-search/engine/templates/playwright_mobile_chrome.js +188 -0
  81. package/vendor/insane-search/engine/templates/playwright_real_chrome.js +243 -0
  82. package/vendor/insane-search/engine/tests/test_hardening.py +57 -0
  83. package/vendor/insane-search/engine/tests/test_smoke.py +152 -0
  84. package/vendor/insane-search/engine/tests/test_u1.py +200 -0
  85. package/vendor/insane-search/engine/tests/test_u4.py +131 -0
  86. package/vendor/insane-search/engine/tests/test_u5.py +163 -0
  87. package/vendor/insane-search/engine/tests/test_u7.py +124 -0
  88. package/vendor/insane-search/engine/transport.py +211 -0
  89. package/vendor/insane-search/engine/url_transforms.py +98 -0
  90. package/vendor/insane-search/engine/validators.py +331 -0
  91. package/vendor/insane-search/engine/waf_detector.py +214 -0
  92. package/vendor/insane-search/engine/waf_profiles.yaml +162 -0
@@ -47,7 +47,7 @@ Planning artifacts and stage handoffs MUST be persisted through the ralplan CLI
47
47
  gjc ralplan --write --stage <type> --stage_n <N> --artifact "markdown file path or markdown string"
48
48
  ```
49
49
 
50
- Use stage values that match the producer or artifact kind, such as `planner`, `architect`, `critic`, `revision`, `adr`, or `final`. Increment `--stage_n` for each consensus-loop pass. The `--artifact` value may be either a markdown file path prepared outside `.gjc/` for ingestion or the markdown content string itself. The native `--write` handler persists markdown under `.gjc/_session-{sessionid}/plans/ralplan/<run-id>/stage-<NN>-<stage>.md`, maintains an `index.jsonl` audit log, and for `final` stages additionally writes a `pending-approval.md` copy. Direct `write`, `edit`, or `ast_edit` calls against `.gjc/_session-{sessionid}/specs`, `.gjc/_session-{sessionid}/plans`, `.gjc/_session-{sessionid}/state`, or any other `.gjc/` path are forbidden unless an explicit force override is active.
50
+ Use stage values that match the producer or artifact kind, such as `planner`, `architect`, `critic`, `revision`, `post-interview`, `adr`, or `final`. Increment `--stage_n` for each consensus-loop pass. The `--artifact` value may be either a markdown file path prepared outside `.gjc/` for ingestion or the markdown content string itself. The native `--write` handler persists markdown under `.gjc/_session-{sessionid}/plans/ralplan/<run-id>/stage-<NN>-<stage>.md`, maintains an `index.jsonl` audit log, and for `final` stages additionally writes a `pending-approval.md` copy. Direct `write`, `edit`, or `ast_edit` calls against `.gjc/_session-{sessionid}/specs`, `.gjc/_session-{sessionid}/plans`, `.gjc/_session-{sessionid}/state`, or any other `.gjc/` path are forbidden unless an explicit force override is active.
51
51
 
52
52
  While ralplan is active it is a pre-approval planning phase: product-code mutation tools (`write`/`edit`/`ast_edit`) and product-mutating `bash` (e.g. `tee src/...`, redirects into the project tree) are blocked, exactly like deep-interview. Prefer passing the `--artifact` markdown **inline** (the content string) so no scratch file is needed; this is mandatory for restricted role agents (see below). Only the leader, and only when an artifact is too large to pass inline, may stage it as a file in a system temp directory (`os.tmpdir()`/`$TMPDIR`, `/tmp`, `/var/tmp`) outside the project tree and pass that path — never write scratch files into the repo or `.gjc/`. Product code is mutated only after the plan is approved and execution begins.
53
53
 
@@ -80,9 +80,16 @@ The consensus workflow:
80
80
  d. Return to Critic evaluation
81
81
  e. Repeat this loop until Critic returns `APPROVE` or 5 iterations are reached
82
82
  f. If 5 iterations are reached without `APPROVE`, present the best version to the user
83
- 6. On Critic approval, mark the plan `pending approval` unless explicit execution approval has already been captured, persist the ADR/final plan via `gjc ralplan --write --stage final --stage_n <N> --artifact "..."`, and do not directly edit `.gjc/_session-{sessionid}/plans`. *(--interactive only)* If `--interactive` is set, use the `ask` tool to present the plan with approval options (Approve execution via ultragoal (Recommended) / Approve execution via team (only when tmux-based interactive worker parallelization is required) / Compact then return for execution approval / Request changes / Reject). Final plan must include ADR (Decision, Drivers, Alternatives considered, Why chosen, Consequences, Follow-ups). Otherwise, output the final plan and stop before any mutation or delegation.
84
- 7. *(--interactive only)* User chooses: Approve ultragoal execution (recommended), Approve team execution (tmux parallelization only), Request changes, or Reject
85
- 8. *(--interactive only)* On approval: invoke `/skill:ultragoal` for execution by default; invoke `/skill:team` only when the user explicitly needs tmux-based interactive worker parallelization -- never implement directly
83
+ 6. **Post-ralplan interview** (intent reconciliation gate): After Critic returns `APPROVE` and before the plan is finalized, reconcile the consensus plan against the user's actual intent. The goal is to make sure ralplan did not silently bake in assumptions that conflict with what the user wants.
84
+ a. **Collect open items** from the run: every assumption the Planner/Architect/Critic resolved by assumption rather than by stated fact, every ambiguity flagged during review, and every decision the loop made without explicit user input. Source these from the persisted `planner`/`architect`/`critic`/`revision` stage artifacts, not from memory.
85
+ b. **Cross-check prior context for conflicts**: glob `.gjc/_session-{sessionid}/specs/deep-interview-*.md` and other prior specs/plans/context relevant by topic. For each, list points where the consensus plan contradicts, weakens, or expands beyond a previously crystallized decision, constraint, or non-goal. Cite the conflicting artifact and line/section.
86
+ c. **Reconcile with the user**:
87
+ - *(--interactive only)* Use the `ask` tool to confirm the open assumptions and conflicts **one at a time**, weakest/highest-impact first, polishing intent. If any confirmation reveals that the plan diverges from user intent, route the consolidated correction back into the re-review loop (step 5b Planner revision) and re-run Architect + Critic before returning here. Cap at the same 5-iteration ceiling.
88
+ - *(automated mode)* Do not ask. Embed every unconfirmed assumption and every detected prior-context conflict into the final plan under an **## Intent Reconciliation** section as explicit open confirmations the user must review at the `pending approval` gate, so nothing is silently assumed.
89
+ d. Persist the reconciliation with `gjc ralplan --write --stage post-interview --stage_n <N> --artifact "..." --json`, then return the receipt/path plus a compact status (reconciled-clean / reconciled-with-revision / open-confirmations-pending) instead of pasting the full body.
90
+ 7. On reconciliation completion, mark the plan `pending approval` unless explicit execution approval has already been captured, persist the ADR/final plan via `gjc ralplan --write --stage final --stage_n <N> --artifact "..."`, and do not directly edit `.gjc/_session-{sessionid}/plans`. *(--interactive only)* If `--interactive` is set, use the `ask` tool to present the plan with approval options (Approve execution via ultragoal (Recommended) / Approve execution via team (only when tmux-based interactive worker parallelization is required) / Compact then return for execution approval / Request changes / Reject). Final plan must include ADR (Decision, Drivers, Alternatives considered, Why chosen, Consequences, Follow-ups) and, when present, the **## Intent Reconciliation** section. Otherwise, output the final plan and stop before any mutation or delegation.
91
+ 8. *(--interactive only)* User chooses: Approve ultragoal execution (recommended), Approve team execution (tmux parallelization only), Request changes, or Reject
92
+ 9. *(--interactive only)* On approval: invoke `/skill:ultragoal` for execution by default; invoke `/skill:team` only when the user explicitly needs tmux-based interactive worker parallelization -- never implement directly
86
93
 
87
94
  Before invoking `/skill:team` or `/skill:ultragoal`, mark ralplan ready for handoff so the skill tool's chain guard permits the transition:
88
95
 
@@ -217,6 +217,7 @@ export interface AutoCompactionEndEvent {
217
217
  errorMessage?: string;
218
218
  /** True when compaction was skipped for a benign reason (no model, no candidates, nothing to compact). */
219
219
  skipped?: boolean;
220
+ continuationSkipReason?: "auto_continue_disabled_non_resumable_tail";
220
221
  }
221
222
 
222
223
  /** Fired when auto-retry starts */
@@ -93,6 +93,10 @@ function hasCurrentGjcVersion(session: GjcTmuxSessionStatus | undefined): boolea
93
93
  return session?.version === VERSION;
94
94
  }
95
95
 
96
+ function allowsExistingTmuxAttach(parsed: Args, env: NodeJS.ProcessEnv): boolean {
97
+ return Boolean(parsed.continue || parsed.resume || explicitTmuxSessionName(env));
98
+ }
99
+
96
100
  function findExistingSessionForLaunch(context: {
97
101
  env: NodeJS.ProcessEnv;
98
102
  project: string;
@@ -352,6 +356,11 @@ function readCurrentBranch(cwd: string): string | null {
352
356
  function cleanupCreatedTmuxSession(plan: TmuxLaunchPlan, spawnSync: TmuxSpawnSync, options: TmuxSpawnOptions): void {
353
357
  spawnSync(plan.tmuxCommand, ["kill-session", "-t", `=${plan.sessionName}`], options);
354
358
  }
359
+ function isTmuxAttachDisconnectError(result: TmuxSpawnResult): boolean {
360
+ if (result.signalCode === "SIGHUP") return true;
361
+ const stderr = result.stderr?.toLowerCase() ?? "";
362
+ return stderr.includes("eio") || stderr.includes("input/output error");
363
+ }
355
364
 
356
365
  export function buildDefaultTmuxLaunchPlan(context: TmuxLaunchContext): TmuxLaunchPlan | undefined {
357
366
  const env = context.env ?? process.env;
@@ -377,14 +386,15 @@ export function buildDefaultTmuxLaunchPlan(context: TmuxLaunchContext): TmuxLaun
377
386
  tmuxRuntimeSessionPath(cwd, gjcSessionId, buildGjcTmuxSessionSlug(sessionName));
378
387
  const tmuxAvailable = context.tmuxAvailable ?? Bun.which(tmuxCommand) !== null;
379
388
  if (!tmuxAvailable) return undefined;
380
- const existingSessionName =
381
- "existingBranchSessionName" in context
389
+ const existingSessionName = allowsExistingTmuxAttach(context.parsed, env)
390
+ ? "existingBranchSessionName" in context
382
391
  ? (context.existingBranchSessionName ?? undefined)
383
392
  : findExistingSessionForLaunch({
384
393
  env,
385
394
  project,
386
395
  branch,
387
- });
396
+ })
397
+ : undefined;
388
398
  const innerCommand = buildInnerCommand(
389
399
  {
390
400
  cwd,
@@ -478,6 +488,10 @@ export function launchDefaultTmuxIfNeeded(context: TmuxLaunchContext): boolean {
478
488
  if (created.exitCode !== 0) return false;
479
489
  const attached = spawnSync(plan.tmuxCommand, ["attach-session", "-t", `=${plan.sessionName}`], options);
480
490
  if (attached.exitCode === 0) return true;
491
+ if (isTmuxAttachDisconnectError(attached)) {
492
+ (context.diagnosticWriter ?? safeStderrWrite)(formatTmuxLaunchDiagnostic("attach disconnected", attached.stderr));
493
+ return true;
494
+ }
481
495
  cleanupCreatedTmuxSession(plan, spawnSync, options);
482
496
  (context.diagnosticWriter ?? safeStderrWrite)(formatTmuxLaunchDiagnostic("attach failed", attached.stderr));
483
497
  return true;
@@ -93,6 +93,7 @@ const RALPLAN_STAGE_CODES: Record<string, string> = {
93
93
  architect: "A",
94
94
  critic: "C",
95
95
  adr: "D",
96
+ "post-interview": "I",
96
97
  final: "F",
97
98
  };
98
99
 
@@ -37,7 +37,7 @@ import {
37
37
  *
38
38
  * 2. **Artifact write**: `gjc ralplan --write --stage <type> --stage_n <N> --artifact
39
39
  * <path-or-string> [--run-id <id>] [--session-id <id>] [--json]` persists Planner / Architect
40
- * / Critic / revision / ADR / final markdown under `.gjc/plans/ralplan/<run-id>/`, maintains
40
+ * / Critic / revision / post-interview / ADR / final markdown under `.gjc/plans/ralplan/<run-id>/`, maintains
41
41
  * an `index.jsonl` audit log, copies `final` stages to `pending-approval.md`, and advances
42
42
  * the HUD chip to reflect the latest persisted stage.
43
43
  */
@@ -48,7 +48,7 @@ export interface RalplanCommandResult {
48
48
  stderr?: string;
49
49
  }
50
50
 
51
- const KNOWN_STAGES = ["planner", "architect", "critic", "revision", "adr", "final"] as const;
51
+ const KNOWN_STAGES = ["planner", "architect", "critic", "revision", "post-interview", "adr", "final"] as const;
52
52
  type RalplanStage = (typeof KNOWN_STAGES)[number];
53
53
 
54
54
  const KNOWN_ARCHITECT_KINDS = new Set(["openai-code"]);
@@ -369,6 +369,9 @@
369
369
  {
370
370
  "id": "revision"
371
371
  },
372
+ {
373
+ "id": "post-interview"
374
+ },
372
375
  {
373
376
  "id": "adr"
374
377
  },
@@ -401,6 +404,26 @@
401
404
  "to": "revision",
402
405
  "verb": "write-artifact"
403
406
  },
407
+ {
408
+ "from": "revision",
409
+ "to": "post-interview",
410
+ "verb": "write-artifact"
411
+ },
412
+ {
413
+ "from": "critic",
414
+ "to": "post-interview",
415
+ "verb": "write-artifact"
416
+ },
417
+ {
418
+ "from": "post-interview",
419
+ "to": "revision",
420
+ "verb": "write-artifact"
421
+ },
422
+ {
423
+ "from": "post-interview",
424
+ "to": "adr",
425
+ "verb": "write-artifact"
426
+ },
404
427
  {
405
428
  "from": "revision",
406
429
  "to": "adr",
@@ -435,6 +458,11 @@
435
458
  "from": "adr",
436
459
  "to": "handoff",
437
460
  "verb": "handoff"
461
+ },
462
+ {
463
+ "from": "post-interview",
464
+ "to": "handoff",
465
+ "verb": "handoff"
438
466
  }
439
467
  ],
440
468
  "typedArgs": [
@@ -592,6 +620,7 @@
592
620
  "architect",
593
621
  "critic",
594
622
  "revision",
623
+ "post-interview",
595
624
  "adr",
596
625
  "final"
597
626
  ],
@@ -172,12 +172,16 @@ export const WORKFLOW_MANIFEST: Record<CanonicalGjcWorkflowSkill, SkillManifest>
172
172
  }),
173
173
  ralplan: manifest({
174
174
  skill: "ralplan",
175
- states: ["planner", "architect", "critic", "revision", "adr", "final", "handoff"],
175
+ states: ["planner", "architect", "critic", "revision", "post-interview", "adr", "final", "handoff"],
176
176
  terminalStates: ["final", "handoff"],
177
177
  transitions: [
178
178
  { from: "planner", to: "architect", verb: "write-artifact" },
179
179
  { from: "architect", to: "critic", verb: "write-artifact" },
180
180
  { from: "critic", to: "revision", verb: "write-artifact" },
181
+ { from: "revision", to: "post-interview", verb: "write-artifact" },
182
+ { from: "critic", to: "post-interview", verb: "write-artifact" },
183
+ { from: "post-interview", to: "revision", verb: "write-artifact" },
184
+ { from: "post-interview", to: "adr", verb: "write-artifact" },
181
185
  { from: "revision", to: "adr", verb: "write-artifact" },
182
186
  { from: "adr", to: "final", verb: "write-artifact" },
183
187
  { from: "planner", to: "handoff", verb: "handoff" },
@@ -185,6 +189,7 @@ export const WORKFLOW_MANIFEST: Record<CanonicalGjcWorkflowSkill, SkillManifest>
185
189
  { from: "critic", to: "handoff", verb: "handoff" },
186
190
  { from: "revision", to: "handoff", verb: "handoff" },
187
191
  { from: "adr", to: "handoff", verb: "handoff" },
192
+ { from: "post-interview", to: "handoff", verb: "handoff" },
188
193
  ],
189
194
  verbs: [...stateVerbs(), ...flagVerbs(["kickoff", "write-artifact"]), ...plannedVerbs(PLANNED_ADMIN_VERBS)],
190
195
  typedArgs: [
@@ -196,7 +201,7 @@ export const WORKFLOW_MANIFEST: Record<CanonicalGjcWorkflowSkill, SkillManifest>
196
201
  {
197
202
  name: "stage",
198
203
  type: "enum",
199
- enumValues: ["planner", "architect", "critic", "revision", "adr", "final"],
204
+ enumValues: ["planner", "architect", "critic", "revision", "post-interview", "adr", "final"],
200
205
  appliesToVerbs: ["write-artifact"],
201
206
  },
202
207
  { name: "stage_n", type: "number", appliesToVerbs: ["write-artifact"] },