@gajae-code/coding-agent 0.7.10 → 0.7.11

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 (88) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +1 -1
  3. package/dist/types/config/keybindings.d.ts +11 -5
  4. package/dist/types/defaults/gjc-defaults.d.ts +7 -0
  5. package/dist/types/gjc-runtime/launch-tmux.d.ts +3 -0
  6. package/dist/types/gjc-runtime/ralplan-runtime.d.ts +3 -2
  7. package/dist/types/gjc-runtime/restricted-role-agent-bash.d.ts +1 -0
  8. package/dist/types/gjc-runtime/state-writer.d.ts +1 -0
  9. package/dist/types/modes/components/custom-editor.d.ts +2 -1
  10. package/dist/types/modes/components/skill-message.d.ts +1 -0
  11. package/dist/types/modes/controllers/command-controller.d.ts +1 -0
  12. package/dist/types/modes/controllers/input-controller.d.ts +4 -0
  13. package/dist/types/modes/interactive-mode.d.ts +1 -0
  14. package/dist/types/modes/prompt-action-autocomplete.d.ts +2 -0
  15. package/dist/types/modes/slash-command-visibility.d.ts +1 -0
  16. package/dist/types/modes/types.d.ts +1 -0
  17. package/dist/types/sdk.d.ts +1 -1
  18. package/dist/types/session/agent-session.d.ts +8 -5
  19. package/dist/types/slash-commands/types.d.ts +2 -0
  20. package/dist/types/utils/cmux-workspace.d.ts +30 -1
  21. package/dist/types/web/search/index.d.ts +3 -1
  22. package/dist/types/web/search/provider.d.ts +9 -0
  23. package/dist/types/web/search/providers/utils.d.ts +42 -13
  24. package/package.json +7 -7
  25. package/src/cli/update-cli.ts +24 -0
  26. package/src/cli/web-search-cli.ts +2 -5
  27. package/src/cli.ts +1 -1
  28. package/src/commands/launch.ts +1 -1
  29. package/src/commands/ralplan.ts +1 -0
  30. package/src/config/keybindings.ts +14 -5
  31. package/src/config/model-profiles.ts +16 -0
  32. package/src/coordinator-mcp/server.ts +9 -3
  33. package/src/defaults/gjc/skills/ralplan/SKILL.md +16 -14
  34. package/src/defaults/gjc-defaults.ts +16 -0
  35. package/src/extensibility/extensions/runner.ts +2 -1
  36. package/src/gjc-runtime/launch-tmux.ts +164 -42
  37. package/src/gjc-runtime/ralplan-runtime.ts +22 -6
  38. package/src/gjc-runtime/restricted-role-agent-bash.ts +1 -0
  39. package/src/gjc-runtime/state-runtime.ts +8 -5
  40. package/src/gjc-runtime/state-writer.ts +5 -5
  41. package/src/internal-urls/docs-index.generated.ts +5 -4
  42. package/src/main.ts +2 -2
  43. package/src/migrate/executor.ts +23 -6
  44. package/src/modes/components/custom-editor.ts +8 -0
  45. package/src/modes/components/model-selector.ts +6 -2
  46. package/src/modes/components/settings-selector.ts +0 -2
  47. package/src/modes/components/skill-message.ts +18 -10
  48. package/src/modes/controllers/command-controller.ts +23 -0
  49. package/src/modes/controllers/input-controller.ts +41 -9
  50. package/src/modes/interactive-mode.ts +16 -7
  51. package/src/modes/prompt-action-autocomplete.ts +23 -1
  52. package/src/modes/slash-command-visibility.ts +9 -0
  53. package/src/modes/types.ts +1 -0
  54. package/src/modes/utils/hotkeys-markdown.ts +5 -2
  55. package/src/modes/utils/ui-helpers.ts +76 -3
  56. package/src/notifications/telegram-daemon.ts +4 -4
  57. package/src/prompts/agents/architect.md +7 -4
  58. package/src/prompts/agents/critic.md +15 -6
  59. package/src/prompts/agents/planner.md +8 -3
  60. package/src/prompts/tools/bash.md +1 -1
  61. package/src/sdk.ts +3 -6
  62. package/src/session/agent-session.ts +60 -17
  63. package/src/slash-commands/builtin-registry.ts +30 -10
  64. package/src/slash-commands/types.ts +2 -0
  65. package/src/tools/bash.ts +24 -8
  66. package/src/utils/cmux-workspace.ts +134 -7
  67. package/src/utils/title-generator.ts +1 -1
  68. package/src/web/kagi.ts +1 -1
  69. package/src/web/parallel.ts +2 -2
  70. package/src/web/search/index.ts +118 -45
  71. package/src/web/search/provider.ts +65 -0
  72. package/src/web/search/providers/anthropic.ts +1 -1
  73. package/src/web/search/providers/brave.ts +1 -1
  74. package/src/web/search/providers/codex.ts +1 -1
  75. package/src/web/search/providers/duckduckgo.ts +1 -1
  76. package/src/web/search/providers/exa.ts +1 -1
  77. package/src/web/search/providers/gemini.ts +7 -3
  78. package/src/web/search/providers/jina.ts +1 -1
  79. package/src/web/search/providers/kimi.ts +6 -1
  80. package/src/web/search/providers/openai-compatible.ts +1 -1
  81. package/src/web/search/providers/parallel.ts +1 -1
  82. package/src/web/search/providers/perplexity.ts +2 -2
  83. package/src/web/search/providers/searxng.ts +1 -1
  84. package/src/web/search/providers/synthetic.ts +1 -1
  85. package/src/web/search/providers/tavily.ts +1 -1
  86. package/src/web/search/providers/utils.ts +67 -17
  87. package/src/web/search/providers/xai.ts +1 -1
  88. package/src/web/search/providers/zai.ts +1 -1
@@ -251,7 +251,7 @@ async function callPerplexityApi(
251
251
  "Content-Type": "application/json",
252
252
  },
253
253
  body: JSON.stringify(request),
254
- signal: withHardTimeout(signal),
254
+ signal: withHardTimeout(signal, "llm"),
255
255
  });
256
256
 
257
257
  if (!response.ok) {
@@ -370,7 +370,7 @@ async function callPerplexityOAuth(
370
370
  skip_search_enabled: true,
371
371
  },
372
372
  }),
373
- signal: withHardTimeout(params.signal),
373
+ signal: withHardTimeout(params.signal, "llm"),
374
374
  });
375
375
 
376
376
  if (!response.ok) {
@@ -214,7 +214,7 @@ async function callSearXNGSearch(
214
214
 
215
215
  const response = await fetch(url, {
216
216
  headers,
217
- signal: withHardTimeout(params.signal),
217
+ signal: withHardTimeout(params.signal, "api"),
218
218
  });
219
219
 
220
220
  if (!response.ok) {
@@ -47,7 +47,7 @@ async function callSyntheticSearch(
47
47
  Authorization: `Bearer ${apiKey}`,
48
48
  },
49
49
  body: JSON.stringify({ query }),
50
- signal: withHardTimeout(signal),
50
+ signal: withHardTimeout(signal, "api"),
51
51
  });
52
52
 
53
53
  if (!response.ok) {
@@ -96,7 +96,7 @@ async function callTavilySearch(apiKey: string, params: TavilySearchParams): Pro
96
96
  Authorization: `Bearer ${apiKey}`,
97
97
  },
98
98
  body: JSON.stringify(buildRequestBody(params)),
99
- signal: withHardTimeout(params.signal),
99
+ signal: withHardTimeout(params.signal, "api"),
100
100
  });
101
101
 
102
102
  if (!response.ok) {
@@ -44,38 +44,81 @@ export function findCredential(
44
44
  }
45
45
 
46
46
  /**
47
- * Default hard ceiling for a single web-search round-trip. 300s tolerates
48
- * legitimate slow LLM-mediated responses (anthropic web_search_20250305,
49
- * perplexity, gemini, OpenAI code backend) while still guaranteeing the session unfreezes
50
- * if Bun's `AbortSignal` fails to propagate on Windows.
51
- *
52
- * Pure search APIs (brave, exa, jina, tavily, searxng, synthetic, zai)
53
- * settle far faster in practice; reusing the same ceiling keeps the wiring
54
- * uniform without compromising correctness.
47
+ * Legacy hard ceiling for a single web-search round-trip, retained as the
48
+ * fallback for call sites that do not declare a timeout class. 300s tolerates
49
+ * pathological cases while still guaranteeing the session unfreezes if Bun's
50
+ * `AbortSignal` fails to propagate on Windows.
55
51
  */
56
52
  export const SEARCH_HARD_TIMEOUT_MS = 300_000;
57
53
 
54
+ /**
55
+ * Hard ceiling for pure search APIs (brave, exa, jina, tavily, kagi,
56
+ * parallel, searxng, synthetic, zai, duckduckgo). These settle in ~1-3s in
57
+ * practice; a hung TCP/TLS connection should fall through to the next
58
+ * provider in seconds, not minutes. Kimi is the exception: it declares an
59
+ * explicit ceiling aligned with its upstream 30s request budget.
60
+ */
61
+ export const SEARCH_API_TIMEOUT_MS = 15_000;
62
+
63
+ /**
64
+ * Hard ceiling for LLM-mediated search providers (anthropic, codex, gemini,
65
+ * perplexity, xai, openai-compatible). These legitimately take tens of
66
+ * seconds because a model performs the search and synthesizes an answer.
67
+ */
68
+ export const SEARCH_LLM_TIMEOUT_MS = 120_000;
69
+
70
+ /** Timeout class a provider declares for its outbound round-trips. */
71
+ export type SearchTimeoutClass = "api" | "llm";
72
+
73
+ const TIMEOUT_CLASS_MS: Record<SearchTimeoutClass, number> = {
74
+ api: SEARCH_API_TIMEOUT_MS,
75
+ llm: SEARCH_LLM_TIMEOUT_MS,
76
+ };
77
+
58
78
  /**
59
79
  * Runtime-configurable hard timeout, seeded from the `web_search.timeout`
60
- * setting via {@link setSearchHardTimeoutMs}. Falls back to
61
- * {@link SEARCH_HARD_TIMEOUT_MS} when unset or invalid.
80
+ * setting via {@link setSearchHardTimeoutMs}. When set, it overrides every
81
+ * class default so users keep a single knob. Unset means class defaults apply.
62
82
  */
63
- let configuredHardTimeoutMs = SEARCH_HARD_TIMEOUT_MS;
83
+ let configuredHardTimeoutMs: number | undefined;
64
84
 
65
85
  /**
66
86
  * Override the hard timeout applied to every web-search round-trip.
67
87
  *
68
88
  * @param ms - Hard timeout in milliseconds. Non-finite or non-positive
69
- * values reset the timeout to {@link SEARCH_HARD_TIMEOUT_MS}.
89
+ * values clear the override so per-class defaults apply.
70
90
  */
71
91
  export function setSearchHardTimeoutMs(ms: number | undefined): void {
72
- configuredHardTimeoutMs = typeof ms === "number" && Number.isFinite(ms) && ms > 0 ? ms : SEARCH_HARD_TIMEOUT_MS;
92
+ configuredHardTimeoutMs = typeof ms === "number" && Number.isFinite(ms) && ms > 0 ? ms : undefined;
93
+ }
94
+
95
+ /** Structural settings source for {@link applyConfiguredSearchTimeout}. */
96
+ export interface SearchTimeoutSettingSource {
97
+ get(path: "web_search.timeout"): unknown;
98
+ has(path: "web_search.timeout"): boolean;
99
+ }
100
+
101
+ /**
102
+ * Install the `web_search.timeout` override from settings — but only when the
103
+ * user explicitly configured it. The settings schema ships a default value
104
+ * (300), and consuming that default via `get()` alone would reinstall a
105
+ * uniform 300s ceiling on every session, silently disabling the per-class
106
+ * timeout defaults. `has()` distinguishes loaded/overridden settings from
107
+ * schema defaults; unset clears any previous override so class defaults apply.
108
+ */
109
+ export function applyConfiguredSearchTimeout(settings: SearchTimeoutSettingSource): void {
110
+ if (!settings.has("web_search.timeout")) {
111
+ setSearchHardTimeoutMs(undefined);
112
+ return;
113
+ }
114
+ const value = settings.get("web_search.timeout");
115
+ setSearchHardTimeoutMs(typeof value === "number" && Number.isFinite(value) && value > 0 ? value * 1000 : undefined);
73
116
  }
74
117
 
75
118
  /**
76
119
  * Compose a caller-supplied {@link AbortSignal} with a hard timeout so an
77
- * outbound `fetch()` is guaranteed to settle within `ms` even when the
78
- * runtime fails to propagate cancellation to the underlying transport.
120
+ * outbound `fetch()` is guaranteed to settle even when the runtime fails to
121
+ * propagate cancellation to the underlying transport.
79
122
  *
80
123
  * Bun's WinHTTP backend on Windows is known to ignore `AbortSignal` once a
81
124
  * TCP/TLS connection stalls (oven-sh/bun#15275, oven-sh/bun#18536); without
@@ -83,9 +126,16 @@ export function setSearchHardTimeoutMs(ms: number | undefined): void {
83
126
  * because the user's Esc is never delivered to the native layer.
84
127
  *
85
128
  * @param signal - Caller cancellation signal, if any.
86
- * @param ms - Hard timeout in milliseconds. Defaults to the configured value.
129
+ * @param msOrClass - Explicit timeout in milliseconds, or a
130
+ * {@link SearchTimeoutClass} resolved to its class default. Omitted falls
131
+ * back to the legacy {@link SEARCH_HARD_TIMEOUT_MS} ceiling. A user-set
132
+ * `web_search.timeout` overrides class defaults (but not explicit ms).
87
133
  */
88
- export function withHardTimeout(signal: AbortSignal | undefined, ms: number = configuredHardTimeoutMs): AbortSignal {
134
+ export function withHardTimeout(signal: AbortSignal | undefined, msOrClass?: number | SearchTimeoutClass): AbortSignal {
135
+ const ms =
136
+ typeof msOrClass === "number"
137
+ ? msOrClass
138
+ : (configuredHardTimeoutMs ?? (msOrClass ? TIMEOUT_CLASS_MS[msOrClass] : SEARCH_HARD_TIMEOUT_MS));
89
139
  const timeout = AbortSignal.timeout(ms);
90
140
  return signal ? AbortSignal.any([signal, timeout]) : timeout;
91
141
  }
@@ -441,7 +441,7 @@ export async function searchXai(params: XaiSearchParams): Promise<SearchResponse
441
441
  noInlineCitations: params.no_inline_citations,
442
442
  }),
443
443
  ),
444
- signal: withHardTimeout(params.signal),
444
+ signal: withHardTimeout(params.signal, "llm"),
445
445
  });
446
446
 
447
447
  const text = await response.text();
@@ -79,7 +79,7 @@ async function callZaiTool(apiKey: string, args: Record<string, unknown>, signal
79
79
  arguments: args,
80
80
  },
81
81
  }),
82
- signal: withHardTimeout(signal),
82
+ signal: withHardTimeout(signal, "api"),
83
83
  });
84
84
 
85
85
  if (!response.ok) {