gsd-pi 2.76.0-dev.b072ebb73 → 2.76.0-dev.fe143342a
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.
- package/dist/mcp-server.d.ts +7 -0
- package/dist/mcp-server.js +35 -1
- package/dist/resource-loader.d.ts +1 -1
- package/dist/resource-loader.js +2 -8
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +66 -4
- package/dist/resources/extensions/gsd/auto/phases.js +4 -1
- package/dist/resources/extensions/gsd/auto/session.js +4 -0
- package/dist/resources/extensions/gsd/auto-model-selection.js +39 -13
- package/dist/resources/extensions/gsd/auto-start.js +39 -21
- package/dist/resources/extensions/gsd/auto.js +15 -12
- package/dist/resources/extensions/gsd/blocked-models.js +68 -0
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +76 -0
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +39 -9
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +93 -0
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +2 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +35 -0
- package/dist/resources/extensions/gsd/compaction-snapshot.js +121 -0
- package/dist/resources/extensions/gsd/complexity-classifier.js +5 -3
- package/dist/resources/extensions/gsd/error-classifier.js +31 -3
- package/dist/resources/extensions/gsd/exec-history.js +120 -0
- package/dist/resources/extensions/gsd/exec-sandbox.js +258 -0
- package/dist/resources/extensions/gsd/gsd-db.js +62 -4
- package/dist/resources/extensions/gsd/init-wizard.js +15 -1
- package/dist/resources/extensions/gsd/key-manager.js +6 -0
- package/dist/resources/extensions/gsd/pre-execution-checks.js +13 -3
- package/dist/resources/extensions/gsd/preferences-types.js +9 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +83 -0
- package/dist/resources/extensions/gsd/preferences.js +17 -17
- package/dist/resources/extensions/gsd/prompt-loader.js +22 -7
- package/dist/resources/extensions/gsd/safety/file-change-validator.js +1 -1
- package/dist/resources/extensions/gsd/tools/exec-search-tool.js +59 -0
- package/dist/resources/extensions/gsd/tools/exec-tool.js +126 -0
- package/dist/resources/extensions/gsd/tools/resume-tool.js +23 -0
- package/dist/resources/extensions/gsd/workflow-mcp.js +3 -0
- package/dist/resources/extensions/search-the-web/command-search-provider.js +5 -4
- package/dist/resources/extensions/search-the-web/native-search.js +45 -13
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +8 -8
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/required-server-files.json +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +8 -8
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/server.js +1 -1
- package/package.json +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +64 -25
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/src/workflow-tools.test.ts +146 -1
- package/packages/mcp-server/src/workflow-tools.ts +84 -43
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.js +60 -15
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/packages/pi-ai/dist/providers/think-tag-parser.d.ts +17 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.js +75 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.js.map +1 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.test.js +41 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.test.js.map +1 -0
- package/packages/pi-ai/src/providers/openai-completions.ts +57 -16
- package/packages/pi-ai/src/providers/think-tag-parser.test.ts +44 -0
- package/packages/pi-ai/src/providers/think-tag-parser.ts +94 -0
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/model-discovery.d.ts +3 -1
- package/packages/pi-coding-agent/dist/core/model-discovery.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-discovery.js +92 -12
- package/packages/pi-coding-agent/dist/core/model-discovery.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-discovery.test.js +16 -1
- package/packages/pi-coding-agent/dist/core/model-discovery.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry-discovery.test.js +61 -1
- package/packages/pi-coding-agent/dist/core/model-registry-discovery.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts +5 -0
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +76 -10
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/redact-secrets.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.js +49 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.test.js +67 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js +9 -5
- package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.test.js +25 -1
- package/packages/pi-coding-agent/dist/core/session-manager.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +5 -4
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.js +13 -7
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts +7 -6
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js +29 -21
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/packages/pi-coding-agent/src/core/model-discovery.test.ts +19 -0
- package/packages/pi-coding-agent/src/core/model-discovery.ts +99 -12
- package/packages/pi-coding-agent/src/core/model-registry-discovery.test.ts +75 -0
- package/packages/pi-coding-agent/src/core/model-registry.ts +86 -10
- package/packages/pi-coding-agent/src/core/redact-secrets.test.ts +86 -0
- package/packages/pi-coding-agent/src/core/redact-secrets.ts +58 -0
- package/packages/pi-coding-agent/src/core/session-manager.test.ts +36 -1
- package/packages/pi-coding-agent/src/core/session-manager.ts +9 -5
- package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +6 -6
- package/packages/pi-coding-agent/src/modes/interactive/components/provider-manager.ts +16 -7
- package/packages/pi-coding-agent/src/modes/interactive/components/skill-invocation-message.ts +36 -22
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/scripts/link-workspace-packages.cjs +1 -0
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +67 -4
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +137 -2
- package/src/resources/extensions/gsd/auto/loop-deps.ts +1 -0
- package/src/resources/extensions/gsd/auto/phases.ts +4 -0
- package/src/resources/extensions/gsd/auto/session.ts +7 -1
- package/src/resources/extensions/gsd/auto-model-selection.ts +50 -12
- package/src/resources/extensions/gsd/auto-start.ts +40 -22
- package/src/resources/extensions/gsd/auto.ts +15 -12
- package/src/resources/extensions/gsd/blocked-models.ts +98 -0
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +97 -0
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +40 -9
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +109 -0
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +2 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +36 -0
- package/src/resources/extensions/gsd/compaction-snapshot.ts +165 -0
- package/src/resources/extensions/gsd/complexity-classifier.ts +5 -3
- package/src/resources/extensions/gsd/error-classifier.ts +36 -3
- package/src/resources/extensions/gsd/exec-history.ts +153 -0
- package/src/resources/extensions/gsd/exec-sandbox.ts +326 -0
- package/src/resources/extensions/gsd/gsd-db.ts +68 -4
- package/src/resources/extensions/gsd/init-wizard.ts +15 -1
- package/src/resources/extensions/gsd/key-manager.ts +6 -0
- package/src/resources/extensions/gsd/pre-execution-checks.ts +13 -3
- package/src/resources/extensions/gsd/preferences-types.ts +38 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +79 -0
- package/src/resources/extensions/gsd/preferences.ts +17 -17
- package/src/resources/extensions/gsd/prompt-loader.ts +30 -7
- package/src/resources/extensions/gsd/safety/file-change-validator.ts +1 -1
- package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/auto-start-model-capture.test.ts +33 -3
- package/src/resources/extensions/gsd/tests/auto-thinking-restore.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/blocked-models.test.ts +98 -0
- package/src/resources/extensions/gsd/tests/compaction-snapshot.test.ts +123 -0
- package/src/resources/extensions/gsd/tests/complexity-classifier.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/exec-history.test.ts +124 -0
- package/src/resources/extensions/gsd/tests/exec-sandbox.test.ts +210 -0
- package/src/resources/extensions/gsd/tests/file-change-validator.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +151 -0
- package/src/resources/extensions/gsd/tests/init-wizard.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/isolation-none-branch-guard.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/key-manager.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/pre-exec-backtick-strip.test.ts +14 -0
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +110 -0
- package/src/resources/extensions/gsd/tests/prompt-loader-extension-dir.test.ts +49 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +91 -0
- package/src/resources/extensions/gsd/tests/save-gate-result-render.test.ts +95 -0
- package/src/resources/extensions/gsd/tests/zombie-gsd-state.test.ts +3 -1
- package/src/resources/extensions/gsd/tools/exec-search-tool.ts +81 -0
- package/src/resources/extensions/gsd/tools/exec-tool.ts +183 -0
- package/src/resources/extensions/gsd/tools/resume-tool.ts +40 -0
- package/src/resources/extensions/gsd/workflow-logger.ts +2 -1
- package/src/resources/extensions/gsd/workflow-mcp.ts +3 -0
- package/src/resources/extensions/search-the-web/command-search-provider.ts +5 -4
- package/src/resources/extensions/search-the-web/native-search.ts +48 -12
- /package/dist/web/standalone/.next/static/{pBwmOoye64ZrRp-_rf0v1 → n21VtX2hZlkpdEUO_nU4z}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{pBwmOoye64ZrRp-_rf0v1 → n21VtX2hZlkpdEUO_nU4z}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import test from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
|
|
5
|
+
import { resolveExtensionDirFromCandidates } from "../prompt-loader.ts";
|
|
6
|
+
|
|
7
|
+
function makeExists(paths: Set<string>): (path: string) => boolean {
|
|
8
|
+
return (path: string) => paths.has(path);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
test("resolveExtensionDirFromCandidates prefers user-local dir when both trees are valid", () => {
|
|
12
|
+
const moduleDir = "/npm/global/gsd";
|
|
13
|
+
const agentDir = "/home/user/.gsd/agent/extensions/gsd";
|
|
14
|
+
const paths = new Set<string>([
|
|
15
|
+
join(moduleDir, "prompts"),
|
|
16
|
+
join(moduleDir, "templates", "task-summary.md"),
|
|
17
|
+
join(agentDir, "prompts"),
|
|
18
|
+
join(agentDir, "templates", "task-summary.md"),
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
const resolved = resolveExtensionDirFromCandidates(moduleDir, agentDir, makeExists(paths));
|
|
22
|
+
assert.equal(resolved, agentDir);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("resolveExtensionDirFromCandidates rejects module dir missing task-summary template", () => {
|
|
26
|
+
const moduleDir = "/npm/global/gsd";
|
|
27
|
+
const agentDir = "/home/user/.gsd/agent/extensions/gsd";
|
|
28
|
+
const paths = new Set<string>([
|
|
29
|
+
join(moduleDir, "prompts"),
|
|
30
|
+
// Missing module templates/task-summary.md on purpose.
|
|
31
|
+
join(agentDir, "prompts"),
|
|
32
|
+
join(agentDir, "templates", "task-summary.md"),
|
|
33
|
+
]);
|
|
34
|
+
|
|
35
|
+
const resolved = resolveExtensionDirFromCandidates(moduleDir, agentDir, makeExists(paths));
|
|
36
|
+
assert.equal(resolved, agentDir);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test("resolveExtensionDirFromCandidates falls back to prompts-only dir when neither tree is fully valid", () => {
|
|
40
|
+
const moduleDir = "/npm/global/gsd";
|
|
41
|
+
const agentDir = "/home/user/.gsd/agent/extensions/gsd";
|
|
42
|
+
const paths = new Set<string>([
|
|
43
|
+
join(moduleDir, "prompts"),
|
|
44
|
+
// Neither side has templates/task-summary.md.
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
const resolved = resolveExtensionDirFromCandidates(moduleDir, agentDir, makeExists(paths));
|
|
48
|
+
assert.equal(resolved, moduleDir);
|
|
49
|
+
});
|
|
@@ -45,6 +45,13 @@ test("classifyError treats usage-limit phrasing as transient rate-limit (#4373)"
|
|
|
45
45
|
assert.equal(result.kind, "rate-limit");
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
+
test("classifyError treats extra-usage phrasing as transient rate-limit (#4397)", () => {
|
|
49
|
+
const result = classifyError("You are out of extra usage. Please wait before retrying.");
|
|
50
|
+
assert.ok(isTransient(result));
|
|
51
|
+
assert.equal(result.kind, "rate-limit");
|
|
52
|
+
assert.ok("retryAfterMs" in result && result.retryAfterMs === 60_000);
|
|
53
|
+
});
|
|
54
|
+
|
|
48
55
|
test("classifyError treats OpenRouter affordability errors as transient rate-limit class", () => {
|
|
49
56
|
const result = classifyError(
|
|
50
57
|
"402 This request requires more credits, or fewer max_tokens. You requested up to 32000 tokens, but can only afford 329.",
|
|
@@ -147,6 +154,49 @@ test("classifyError: rate limit takes precedence over auth keywords", () => {
|
|
|
147
154
|
assert.ok(isTransient(result));
|
|
148
155
|
});
|
|
149
156
|
|
|
157
|
+
// ── unsupported-model: account/plan entitlement rejection (#4513) ──────────
|
|
158
|
+
|
|
159
|
+
test("classifyError: Codex ChatGPT-account entitlement rejection is unsupported-model", () => {
|
|
160
|
+
const result = classifyError(
|
|
161
|
+
"The 'gpt-5.1-codex-max' model is not supported when using Codex with a ChatGPT account.",
|
|
162
|
+
);
|
|
163
|
+
assert.equal(result.kind, "unsupported-model");
|
|
164
|
+
assert.ok(!isTransient(result));
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
test("classifyError: 'model not available for this plan' is unsupported-model", () => {
|
|
168
|
+
const result = classifyError("This model is not available for your current plan.");
|
|
169
|
+
assert.equal(result.kind, "unsupported-model");
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
test("classifyError: 'account does not have access to model' is unsupported-model", () => {
|
|
173
|
+
const result = classifyError("Your account does not have access to the gpt-5 model.");
|
|
174
|
+
assert.equal(result.kind, "unsupported-model");
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
test("classifyError: 'tier does not support deployment' is unsupported-model", () => {
|
|
178
|
+
const result = classifyError("The free tier does not support this deployment.");
|
|
179
|
+
assert.equal(result.kind, "unsupported-model");
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
test("classifyError: 'account suspended' stays permanent (not unsupported-model)", () => {
|
|
183
|
+
const result = classifyError("Your account has been suspended. Contact support.");
|
|
184
|
+
assert.equal(result.kind, "permanent");
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
test("classifyError: 'invalid account' stays permanent", () => {
|
|
188
|
+
const result = classifyError("invalid account credentials");
|
|
189
|
+
assert.equal(result.kind, "permanent");
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
test("classifyError: rate limit on unsupported-model phrasing stays rate-limit", () => {
|
|
193
|
+
// A throttled account is not an entitlement failure.
|
|
194
|
+
const result = classifyError(
|
|
195
|
+
"429 rate limit — model not supported when using your account right now",
|
|
196
|
+
);
|
|
197
|
+
assert.equal(result.kind, "rate-limit");
|
|
198
|
+
});
|
|
199
|
+
|
|
150
200
|
// ── STREAM_RE: V8 JSON parse error variants (#2916) ────────────────────────
|
|
151
201
|
|
|
152
202
|
test("classifyError: 'Expected comma/brace after property value in JSON' is transient stream", () => {
|
|
@@ -630,6 +680,47 @@ test("MAX_TRANSIENT_AUTO_RESUMES is at least 8 for sustained overload resilience
|
|
|
630
680
|
);
|
|
631
681
|
});
|
|
632
682
|
|
|
683
|
+
// ── Stream idle timeout / partial response (#4558) ──────────────────────────
|
|
684
|
+
|
|
685
|
+
test("classifyError: 'Stream idle timeout - partial response received' is transient network", () => {
|
|
686
|
+
const result = classifyError("API Error: Stream idle timeout - partial response received");
|
|
687
|
+
assert.ok(isTransient(result), "stream idle timeout must be transient");
|
|
688
|
+
assert.equal(result.kind, "network");
|
|
689
|
+
assert.ok("retryAfterMs" in result && result.retryAfterMs > 0);
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
test("classifyError: 'stream idle timeout' (lowercase) is transient network", () => {
|
|
693
|
+
const result = classifyError("stream idle timeout");
|
|
694
|
+
assert.ok(isTransient(result), "lowercase stream idle timeout must be transient");
|
|
695
|
+
assert.equal(result.kind, "network");
|
|
696
|
+
});
|
|
697
|
+
|
|
698
|
+
test("classifyError: 'partial response received' alone is transient network", () => {
|
|
699
|
+
const result = classifyError("partial response received");
|
|
700
|
+
assert.ok(isTransient(result), "partial response received must be transient");
|
|
701
|
+
assert.equal(result.kind, "network");
|
|
702
|
+
});
|
|
703
|
+
|
|
704
|
+
// ── Context overflow / context window exceeded (#4528) ───────────────────────
|
|
705
|
+
|
|
706
|
+
test("classifyError: MiniMax context window error is transient server", () => {
|
|
707
|
+
const result = classifyError("400 invalid params, context window exceeds limit (2013)");
|
|
708
|
+
assert.ok(isTransient(result), "context window exceeded must be transient");
|
|
709
|
+
assert.equal(result.kind, "server");
|
|
710
|
+
});
|
|
711
|
+
|
|
712
|
+
test("classifyError: 'context length exceeded' is transient server", () => {
|
|
713
|
+
const result = classifyError("context length exceeded: max 128000 tokens");
|
|
714
|
+
assert.ok(isTransient(result), "context length exceeded must be transient");
|
|
715
|
+
assert.equal(result.kind, "server");
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
test("classifyError: 'context window' with 'exceed' is transient server", () => {
|
|
719
|
+
const result = classifyError("context window exceeded for this model");
|
|
720
|
+
assert.ok(isTransient(result), "context window exceeded must be transient");
|
|
721
|
+
assert.equal(result.kind, "server");
|
|
722
|
+
});
|
|
723
|
+
|
|
633
724
|
// ── agent-session retryable regex handles server_error (#1166) ──────────────
|
|
634
725
|
|
|
635
726
|
test("agent-session retryable error regex matches server_error (underscore)", () => {
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regression test suite for save_gate_result renderResult.
|
|
3
|
+
*
|
|
4
|
+
* Verifies that renderResult does not print "undefined: undefined" when
|
|
5
|
+
* `details` is empty, and that the error fallback does not produce a
|
|
6
|
+
* duplicated `Error: Error:` prefix when `content[0].text` already starts
|
|
7
|
+
* with `Error:`.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { test } from 'node:test';
|
|
11
|
+
import assert from 'node:assert/strict';
|
|
12
|
+
import { registerDbTools } from '../bootstrap/db-tools.ts';
|
|
13
|
+
|
|
14
|
+
function makeMockPi() {
|
|
15
|
+
const tools: any[] = [];
|
|
16
|
+
return {
|
|
17
|
+
registerTool: (tool: any) => tools.push(tool),
|
|
18
|
+
tools,
|
|
19
|
+
} as any;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const fakeTheme = {
|
|
23
|
+
fg: (_color: string, text: string) => text,
|
|
24
|
+
bold: (text: string) => text,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
function getSaveGateResultTool() {
|
|
28
|
+
const pi = makeMockPi();
|
|
29
|
+
registerDbTools(pi);
|
|
30
|
+
const tool = pi.tools.find((t: any) => t.name === 'gsd_save_gate_result');
|
|
31
|
+
assert.ok(tool, 'gsd_save_gate_result should be registered');
|
|
32
|
+
return tool;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
test('save_gate_result renderResult falls back to content text when details is empty', () => {
|
|
36
|
+
const tool = getSaveGateResultTool();
|
|
37
|
+
const result = {
|
|
38
|
+
content: [{ type: 'text', text: 'Gate Q3 result saved: verdict=pass' }],
|
|
39
|
+
details: {},
|
|
40
|
+
isError: false,
|
|
41
|
+
};
|
|
42
|
+
const rendered = tool.renderResult(result, {}, fakeTheme);
|
|
43
|
+
const text = String(rendered.content ?? rendered.text ?? rendered);
|
|
44
|
+
assert.ok(!text.includes('undefined'), `got: ${text}`);
|
|
45
|
+
assert.ok(
|
|
46
|
+
text.includes('Gate Q3') || text.includes('verdict=pass'),
|
|
47
|
+
`expected content summary — got: ${text}`,
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('save_gate_result renderResult uses structured details when present', () => {
|
|
52
|
+
const tool = getSaveGateResultTool();
|
|
53
|
+
const result = {
|
|
54
|
+
content: [{ type: 'text', text: 'Gate Q3 result saved: verdict=flag' }],
|
|
55
|
+
details: { operation: 'save_gate_result', gateId: 'Q3', verdict: 'flag' },
|
|
56
|
+
isError: false,
|
|
57
|
+
};
|
|
58
|
+
const rendered = tool.renderResult(result, {}, fakeTheme);
|
|
59
|
+
const text = String(rendered.content ?? rendered.text ?? rendered);
|
|
60
|
+
assert.ok(text.includes('Q3'), `got: ${text}`);
|
|
61
|
+
assert.ok(text.includes('flag'), `got: ${text}`);
|
|
62
|
+
assert.ok(!text.includes('undefined'), `got: ${text}`);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('save_gate_result renderResult shows error from content when details.error is missing', () => {
|
|
66
|
+
const tool = getSaveGateResultTool();
|
|
67
|
+
const result = {
|
|
68
|
+
content: [{ type: 'text', text: 'Error: Invalid gateId "Z1"' }],
|
|
69
|
+
details: {},
|
|
70
|
+
isError: true,
|
|
71
|
+
};
|
|
72
|
+
const rendered = tool.renderResult(result, {}, fakeTheme);
|
|
73
|
+
const text = String(rendered.content ?? rendered.text ?? rendered);
|
|
74
|
+
assert.ok(
|
|
75
|
+
text.includes('Invalid gateId') || text.includes('Error'),
|
|
76
|
+
`got: ${text}`,
|
|
77
|
+
);
|
|
78
|
+
assert.ok(!text.includes('undefined'), `got: ${text}`);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('save_gate_result renderResult does not duplicate Error: prefix', () => {
|
|
82
|
+
const tool = getSaveGateResultTool();
|
|
83
|
+
const result = {
|
|
84
|
+
content: [{ type: 'text', text: 'Error: Invalid gateId "Z1"' }],
|
|
85
|
+
details: {},
|
|
86
|
+
isError: true,
|
|
87
|
+
};
|
|
88
|
+
const rendered = tool.renderResult(result, {}, fakeTheme);
|
|
89
|
+
const text = String(rendered.content ?? rendered.text ?? rendered);
|
|
90
|
+
assert.ok(
|
|
91
|
+
!/Error:\s*Error:/i.test(text),
|
|
92
|
+
`expected a single Error: prefix — got: ${text}`,
|
|
93
|
+
);
|
|
94
|
+
assert.ok(text.includes('Invalid gateId'), `got: ${text}`);
|
|
95
|
+
});
|
|
@@ -72,7 +72,9 @@ const autoStartSrc = readFileSync(
|
|
|
72
72
|
const symlinkIdx = autoStartSrc.indexOf("ensureGsdSymlink(base)");
|
|
73
73
|
assertTrue(symlinkIdx >= 0, "auto-start.ts calls ensureGsdSymlink(base)");
|
|
74
74
|
|
|
75
|
-
const afterSymlink = symlinkIdx >= 0
|
|
75
|
+
const afterSymlink = symlinkIdx >= 0
|
|
76
|
+
? autoStartSrc.slice(symlinkIdx, autoStartSrc.indexOf("Initialize GitServiceImpl", symlinkIdx))
|
|
77
|
+
: "";
|
|
76
78
|
|
|
77
79
|
// The milestones bootstrap must check milestones path, not gsdDir
|
|
78
80
|
// Old (dead) code: if (!existsSync(gsdDir)) { mkdirSync(join(gsdDir, "milestones"), ...) }
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// GSD Exec Search Tool — lists and filters prior gsd_exec runs.
|
|
2
|
+
//
|
|
3
|
+
// Scans .gsd/exec/*.meta.json and returns a ranked summary so agents can
|
|
4
|
+
// re-discover past runs without re-executing. Read-only; no DB writes.
|
|
5
|
+
|
|
6
|
+
import { searchExecHistory, type ExecSearchOptions } from "../exec-history.js";
|
|
7
|
+
|
|
8
|
+
export interface ExecSearchToolParams {
|
|
9
|
+
query?: string;
|
|
10
|
+
runtime?: "bash" | "node" | "python";
|
|
11
|
+
failing_only?: boolean;
|
|
12
|
+
limit?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ToolExecutionResult {
|
|
16
|
+
content: Array<{ type: "text"; text: string }>;
|
|
17
|
+
details: Record<string, unknown>;
|
|
18
|
+
isError?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function executeExecSearch(
|
|
22
|
+
params: ExecSearchToolParams,
|
|
23
|
+
opts: { baseDir: string },
|
|
24
|
+
): ToolExecutionResult {
|
|
25
|
+
const searchOpts: ExecSearchOptions = {
|
|
26
|
+
query: typeof params.query === "string" ? params.query : undefined,
|
|
27
|
+
runtime: params.runtime,
|
|
28
|
+
failing_only: params.failing_only === true,
|
|
29
|
+
limit: typeof params.limit === "number" ? params.limit : undefined,
|
|
30
|
+
};
|
|
31
|
+
const hits = searchExecHistory(opts.baseDir, searchOpts);
|
|
32
|
+
|
|
33
|
+
if (hits.length === 0) {
|
|
34
|
+
return {
|
|
35
|
+
content: [{ type: "text", text: "No prior gsd_exec runs match those filters." }],
|
|
36
|
+
details: { operation: "gsd_exec_search", matches: 0 },
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const lines: string[] = [`Found ${hits.length} exec run(s), most recent first:`];
|
|
41
|
+
for (const hit of hits) {
|
|
42
|
+
const e = hit.entry;
|
|
43
|
+
const status = formatStatus(e);
|
|
44
|
+
const purpose = e.purpose ? ` — ${e.purpose}` : "";
|
|
45
|
+
const truncated = e.stdout_truncated ? " (stdout truncated)" : "";
|
|
46
|
+
lines.push(
|
|
47
|
+
`- [${e.id}] ${e.runtime} ${status} ${e.duration_ms}ms${truncated}${purpose}`,
|
|
48
|
+
` stdout: ${e.stdout_path}`,
|
|
49
|
+
);
|
|
50
|
+
if (hit.digest_preview) {
|
|
51
|
+
const preview = hit.digest_preview.replace(/\n/g, "\n ");
|
|
52
|
+
lines.push(` preview:\n ${preview}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
58
|
+
details: {
|
|
59
|
+
operation: "gsd_exec_search",
|
|
60
|
+
matches: hits.length,
|
|
61
|
+
results: hits.map((hit) => ({
|
|
62
|
+
id: hit.entry.id,
|
|
63
|
+
runtime: hit.entry.runtime,
|
|
64
|
+
exit_code: hit.entry.exit_code,
|
|
65
|
+
timed_out: hit.entry.timed_out,
|
|
66
|
+
duration_ms: hit.entry.duration_ms,
|
|
67
|
+
purpose: hit.entry.purpose,
|
|
68
|
+
stdout_path: hit.entry.stdout_path,
|
|
69
|
+
stderr_path: hit.entry.stderr_path,
|
|
70
|
+
meta_path: hit.entry.meta_path,
|
|
71
|
+
})),
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function formatStatus(entry: { exit_code: number | null; timed_out: boolean; signal: string | null }): string {
|
|
77
|
+
if (entry.timed_out) return "timeout";
|
|
78
|
+
if (entry.signal) return `signal:${entry.signal}`;
|
|
79
|
+
if (entry.exit_code === null) return "exit:null";
|
|
80
|
+
return `exit:${entry.exit_code}`;
|
|
81
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
// GSD Exec Tool — executor for the gsd_exec MCP tool.
|
|
2
|
+
//
|
|
3
|
+
// Thin wrapper around exec-sandbox.ts that reads effective options from
|
|
4
|
+
// the project preferences (context_mode block) and formats the result
|
|
5
|
+
// for MCP return.
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
EXEC_DEFAULTS,
|
|
9
|
+
runExecSandbox,
|
|
10
|
+
type ExecSandboxOptions,
|
|
11
|
+
type ExecSandboxRequest,
|
|
12
|
+
type ExecSandboxResult,
|
|
13
|
+
} from "../exec-sandbox.js";
|
|
14
|
+
import { isContextModeEnabled, type ContextModeConfig } from "../preferences-types.js";
|
|
15
|
+
|
|
16
|
+
export interface ExecToolParams {
|
|
17
|
+
runtime: ExecSandboxRequest["runtime"];
|
|
18
|
+
script: string;
|
|
19
|
+
purpose?: string;
|
|
20
|
+
timeout_ms?: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ToolExecutionResult {
|
|
24
|
+
content: Array<{ type: "text"; text: string }>;
|
|
25
|
+
details: Record<string, unknown>;
|
|
26
|
+
isError?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ExecToolDeps {
|
|
30
|
+
baseDir: string;
|
|
31
|
+
preferences: { context_mode?: ContextModeConfig } | null;
|
|
32
|
+
/** Optional override for testing. */
|
|
33
|
+
run?: (req: ExecSandboxRequest, opts: ExecSandboxOptions) => Promise<ExecSandboxResult>;
|
|
34
|
+
now?: () => Date;
|
|
35
|
+
generateId?: () => string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function buildExecOptions(
|
|
39
|
+
baseDir: string,
|
|
40
|
+
cfg: ContextModeConfig | undefined,
|
|
41
|
+
extras?: Pick<ExecSandboxOptions, "env" | "now" | "generateId">,
|
|
42
|
+
): ExecSandboxOptions {
|
|
43
|
+
const allowlist = Array.isArray(cfg?.exec_env_allowlist) ? cfg!.exec_env_allowlist! : EXEC_DEFAULTS.envAllowlist;
|
|
44
|
+
const stdoutCap = clampNumber(
|
|
45
|
+
cfg?.exec_stdout_cap_bytes,
|
|
46
|
+
EXEC_DEFAULTS.stdoutCapBytes,
|
|
47
|
+
4_096,
|
|
48
|
+
16_777_216,
|
|
49
|
+
);
|
|
50
|
+
const defaultTimeout = clampNumber(
|
|
51
|
+
cfg?.exec_timeout_ms,
|
|
52
|
+
EXEC_DEFAULTS.defaultTimeoutMs,
|
|
53
|
+
1_000,
|
|
54
|
+
EXEC_DEFAULTS.clampTimeoutMs,
|
|
55
|
+
);
|
|
56
|
+
const digestChars = clampNumber(cfg?.exec_digest_chars, EXEC_DEFAULTS.digestChars, 0, 4_000);
|
|
57
|
+
return {
|
|
58
|
+
baseDir,
|
|
59
|
+
clamp_timeout_ms: EXEC_DEFAULTS.clampTimeoutMs,
|
|
60
|
+
default_timeout_ms: defaultTimeout,
|
|
61
|
+
stdout_cap_bytes: stdoutCap,
|
|
62
|
+
stderr_cap_bytes: EXEC_DEFAULTS.stderrCapBytes,
|
|
63
|
+
digest_chars: digestChars,
|
|
64
|
+
env_allowlist: allowlist,
|
|
65
|
+
...extras,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function clampNumber(value: unknown, fallback: number, min: number, max: number): number {
|
|
70
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return fallback;
|
|
71
|
+
if (value < min) return min;
|
|
72
|
+
if (value > max) return max;
|
|
73
|
+
return Math.floor(value);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function isEnabled(prefs: ExecToolDeps["preferences"]): boolean {
|
|
77
|
+
return isContextModeEnabled(prefs);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function disabledResult(): ToolExecutionResult {
|
|
81
|
+
return {
|
|
82
|
+
content: [
|
|
83
|
+
{
|
|
84
|
+
type: "text",
|
|
85
|
+
text:
|
|
86
|
+
"gsd_exec is disabled by `context_mode.enabled: false` in preferences. Remove that " +
|
|
87
|
+
"override (or set it to true) to re-enable sandboxed tool-output execution.",
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
details: { operation: "gsd_exec", error: "context_mode_disabled" },
|
|
91
|
+
isError: true,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function paramError(message: string): ToolExecutionResult {
|
|
96
|
+
return {
|
|
97
|
+
content: [{ type: "text", text: `Error: ${message}` }],
|
|
98
|
+
details: { operation: "gsd_exec", error: "invalid_params", detail: message },
|
|
99
|
+
isError: true,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export async function executeGsdExec(
|
|
104
|
+
params: ExecToolParams,
|
|
105
|
+
deps: ExecToolDeps,
|
|
106
|
+
): Promise<ToolExecutionResult> {
|
|
107
|
+
if (!isEnabled(deps.preferences)) return disabledResult();
|
|
108
|
+
|
|
109
|
+
const runtime = params.runtime;
|
|
110
|
+
if (runtime !== "bash" && runtime !== "node" && runtime !== "python") {
|
|
111
|
+
return paramError(`invalid runtime "${String(runtime)}" — must be bash | node | python`);
|
|
112
|
+
}
|
|
113
|
+
const script = typeof params.script === "string" ? params.script : "";
|
|
114
|
+
if (script.trim().length === 0) {
|
|
115
|
+
return paramError("script is required and must be a non-empty string");
|
|
116
|
+
}
|
|
117
|
+
if (Buffer.byteLength(script, "utf8") > 200_000) {
|
|
118
|
+
return paramError("script exceeds the 200 KB length limit");
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const opts = buildExecOptions(
|
|
122
|
+
deps.baseDir,
|
|
123
|
+
deps.preferences?.context_mode,
|
|
124
|
+
{ now: deps.now, generateId: deps.generateId },
|
|
125
|
+
);
|
|
126
|
+
const run = deps.run ?? runExecSandbox;
|
|
127
|
+
|
|
128
|
+
try {
|
|
129
|
+
const result = await run(
|
|
130
|
+
{
|
|
131
|
+
runtime,
|
|
132
|
+
script,
|
|
133
|
+
...(typeof params.purpose === "string" ? { purpose: params.purpose } : {}),
|
|
134
|
+
...(typeof params.timeout_ms === "number" ? { timeout_ms: params.timeout_ms } : {}),
|
|
135
|
+
},
|
|
136
|
+
opts,
|
|
137
|
+
);
|
|
138
|
+
return formatResult(result);
|
|
139
|
+
} catch (err) {
|
|
140
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
141
|
+
return {
|
|
142
|
+
content: [{ type: "text", text: `Error: gsd_exec failed — ${message}` }],
|
|
143
|
+
details: { operation: "gsd_exec", error: message },
|
|
144
|
+
isError: true,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function formatResult(result: ExecSandboxResult): ToolExecutionResult {
|
|
150
|
+
const headerLines = [
|
|
151
|
+
`gsd_exec[${result.id}] runtime=${result.runtime} exit=${formatExit(result)} duration=${result.duration_ms}ms`,
|
|
152
|
+
` stdout: ${result.stdout_bytes}B${result.stdout_truncated ? " (truncated)" : ""} → ${result.stdout_path}`,
|
|
153
|
+
` stderr: ${result.stderr_bytes}B${result.stderr_truncated ? " (truncated)" : ""} → ${result.stderr_path}`,
|
|
154
|
+
];
|
|
155
|
+
const summary = `${headerLines.join("\n")}\n--- digest ---\n${result.digest}`.trimEnd();
|
|
156
|
+
return {
|
|
157
|
+
content: [{ type: "text", text: summary }],
|
|
158
|
+
details: {
|
|
159
|
+
operation: "gsd_exec",
|
|
160
|
+
id: result.id,
|
|
161
|
+
runtime: result.runtime,
|
|
162
|
+
exit_code: result.exit_code,
|
|
163
|
+
signal: result.signal,
|
|
164
|
+
timed_out: result.timed_out,
|
|
165
|
+
duration_ms: result.duration_ms,
|
|
166
|
+
stdout_bytes: result.stdout_bytes,
|
|
167
|
+
stderr_bytes: result.stderr_bytes,
|
|
168
|
+
stdout_truncated: result.stdout_truncated,
|
|
169
|
+
stderr_truncated: result.stderr_truncated,
|
|
170
|
+
stdout_path: result.stdout_path,
|
|
171
|
+
stderr_path: result.stderr_path,
|
|
172
|
+
meta_path: result.meta_path,
|
|
173
|
+
},
|
|
174
|
+
isError: result.timed_out || result.signal !== null || result.exit_code !== 0,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function formatExit(result: ExecSandboxResult): string {
|
|
179
|
+
if (result.timed_out) return "timeout";
|
|
180
|
+
if (result.signal) return `signal:${result.signal}`;
|
|
181
|
+
if (result.exit_code === null) return "null";
|
|
182
|
+
return String(result.exit_code);
|
|
183
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// GSD Resume Tool — returns the contents of .gsd/last-snapshot.md so
|
|
2
|
+
// agents can re-orient after compaction or session resume without
|
|
3
|
+
// re-deriving project memory state.
|
|
4
|
+
|
|
5
|
+
import { readCompactionSnapshot } from "../compaction-snapshot.js";
|
|
6
|
+
|
|
7
|
+
export interface ResumeToolParams {
|
|
8
|
+
/** Ignored — reserved for future variant (e.g. dated snapshots). */
|
|
9
|
+
_variant?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ToolExecutionResult {
|
|
13
|
+
content: Array<{ type: "text"; text: string }>;
|
|
14
|
+
details: Record<string, unknown>;
|
|
15
|
+
isError?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function executeResume(
|
|
19
|
+
_params: ResumeToolParams,
|
|
20
|
+
opts: { baseDir: string },
|
|
21
|
+
): ToolExecutionResult {
|
|
22
|
+
const snapshot = readCompactionSnapshot(opts.baseDir);
|
|
23
|
+
if (snapshot == null) {
|
|
24
|
+
return {
|
|
25
|
+
content: [
|
|
26
|
+
{
|
|
27
|
+
type: "text",
|
|
28
|
+
text:
|
|
29
|
+
"No snapshot found at .gsd/last-snapshot.md. The snapshot is written automatically " +
|
|
30
|
+
"on session_before_compact (enabled by default; set context_mode.enabled=false to opt out).",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
details: { operation: "gsd_resume", found: false },
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
content: [{ type: "text", text: snapshot }],
|
|
38
|
+
details: { operation: "gsd_resume", found: true, bytes: Buffer.byteLength(snapshot, "utf-8") },
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -57,7 +57,8 @@ export type LogComponent =
|
|
|
57
57
|
| "ecosystem" // GSD ecosystem extension loader and dispatch
|
|
58
58
|
| "memory-embeddings" // Memory layer embedding generation
|
|
59
59
|
| "memory-ingest" // Memory layer ingestion pipeline
|
|
60
|
-
| "memory-backfill"
|
|
60
|
+
| "memory-backfill" // ADR-013: decisions->memories backfill
|
|
61
|
+
| "context-mode"; // Context-mode exec sandbox and compaction snapshot
|
|
61
62
|
|
|
62
63
|
export interface LogEntry {
|
|
63
64
|
ts: string;
|
|
@@ -23,6 +23,9 @@ export interface WorkflowCapabilityOptions {
|
|
|
23
23
|
const MCP_WORKFLOW_TOOL_SURFACE = new Set([
|
|
24
24
|
"ask_user_questions",
|
|
25
25
|
"gsd_decision_save",
|
|
26
|
+
"gsd_exec",
|
|
27
|
+
"gsd_exec_search",
|
|
28
|
+
"gsd_resume",
|
|
26
29
|
"gsd_complete_milestone",
|
|
27
30
|
"gsd_complete_task",
|
|
28
31
|
"gsd_complete_slice",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* All provider logic lives in provider.ts (S01) — this is pure UI wiring.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { supportsNativeWebSearch } from './native-search.js'
|
|
12
12
|
import type { ExtensionAPI } from '@gsd/pi-coding-agent'
|
|
13
13
|
import type { AutocompleteItem } from '@gsd/pi-tui'
|
|
14
14
|
import {
|
|
@@ -91,9 +91,10 @@ export function registerSearchProviderCommand(pi: ExtensionAPI): void {
|
|
|
91
91
|
|
|
92
92
|
setSearchProviderPreference(chosen)
|
|
93
93
|
const effective = resolveSearchProvider()
|
|
94
|
-
// Gate on api
|
|
95
|
-
//
|
|
96
|
-
|
|
94
|
+
// Gate on api shape + provider allowlist: the info note must match the
|
|
95
|
+
// actual runtime behavior in native-search.ts. Claude served via copilot
|
|
96
|
+
// / minimax / kimi is anthropic-shaped but does NOT run native search.
|
|
97
|
+
const isAnthropic = supportsNativeWebSearch(ctx.model)
|
|
97
98
|
const nativeNote = isAnthropic ? '\nNote: Native Anthropic web search is also active (automatic, no API key needed).' : ''
|
|
98
99
|
ctx.ui.notify(
|
|
99
100
|
`Search provider set to ${chosen}. Effective provider: ${effective ?? 'none (no API keys)'}${nativeNote}`,
|