gsd-pi 2.68.1-dev.c1497ab → 2.69.0-dev.232905b
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/resources/extensions/gsd/auto-model-selection.js +27 -1
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +7 -0
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +6 -2
- package/dist/resources/extensions/gsd/codebase-generator.js +12 -0
- package/dist/resources/extensions/gsd/commands-cmux.js +30 -1
- package/dist/resources/extensions/gsd/model-router.js +53 -0
- package/dist/resources/extensions/gsd/workflow-mcp.js +53 -6
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +15 -15
- 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/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/api/onboarding/route.js +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 +15 -15
- package/dist/web/standalone/.next/server/chunks/6897.js +3 -3
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- 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/package.json +1 -1
- package/packages/daemon/src/orchestrator.ts +9 -84
- package/packages/mcp-server/README.md +25 -3
- package/packages/mcp-server/dist/cli.d.ts +0 -1
- package/packages/mcp-server/dist/cli.d.ts.map +1 -1
- package/packages/mcp-server/dist/cli.js +4 -2
- package/packages/mcp-server/dist/cli.js.map +1 -1
- package/packages/mcp-server/dist/server.d.ts +32 -1
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +118 -1
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/dist/tool-credentials.d.ts +6 -0
- package/packages/mcp-server/dist/tool-credentials.d.ts.map +1 -0
- package/packages/mcp-server/dist/tool-credentials.js +90 -0
- package/packages/mcp-server/dist/tool-credentials.js.map +1 -0
- package/packages/mcp-server/dist/workflow-tools.d.ts +1 -0
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +274 -2
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/src/cli.ts +5 -3
- package/packages/mcp-server/src/mcp-server.test.ts +85 -1
- package/packages/mcp-server/src/server.ts +188 -1
- package/packages/mcp-server/src/tool-credentials.test.ts +95 -0
- package/packages/mcp-server/src/tool-credentials.ts +97 -0
- package/packages/mcp-server/src/workflow-tools.test.ts +32 -25
- package/packages/mcp-server/src/workflow-tools.ts +365 -2
- package/packages/pi-ai/dist/index.d.ts +3 -0
- package/packages/pi-ai/dist/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/index.js +2 -0
- package/packages/pi-ai/dist/index.js.map +1 -1
- package/packages/pi-ai/dist/providers/amazon-bedrock.js +2 -2
- package/packages/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.js +2 -2
- package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +1 -23
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.js +2 -2
- package/packages/pi-ai/dist/providers/google-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/mistral.js +2 -2
- package/packages/pi-ai/dist/providers/mistral.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.js +2 -2
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-responses-shared.js +2 -2
- package/packages/pi-ai/dist/providers/openai-responses-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/provider-capabilities.d.ts +59 -0
- package/packages/pi-ai/dist/providers/provider-capabilities.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/provider-capabilities.js +173 -0
- package/packages/pi-ai/dist/providers/provider-capabilities.js.map +1 -0
- package/packages/pi-ai/dist/providers/provider-capabilities.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/provider-capabilities.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/provider-capabilities.test.js +132 -0
- package/packages/pi-ai/dist/providers/provider-capabilities.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/transform-messages-report.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/transform-messages-report.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/transform-messages-report.test.js +172 -0
- package/packages/pi-ai/dist/providers/transform-messages-report.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/transform-messages.d.ts +34 -1
- package/packages/pi-ai/dist/providers/transform-messages.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/transform-messages.js +73 -2
- package/packages/pi-ai/dist/providers/transform-messages.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/index.d.ts +3 -2
- package/packages/pi-ai/dist/utils/oauth/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/index.js +3 -5
- package/packages/pi-ai/dist/utils/oauth/index.js.map +1 -1
- package/packages/pi-ai/src/index.ts +3 -0
- package/packages/pi-ai/src/providers/amazon-bedrock.ts +2 -2
- package/packages/pi-ai/src/providers/anthropic-shared.ts +2 -2
- package/packages/pi-ai/src/providers/anthropic.ts +1 -31
- package/packages/pi-ai/src/providers/google-shared.ts +2 -2
- package/packages/pi-ai/src/providers/mistral.ts +2 -2
- package/packages/pi-ai/src/providers/openai-completions.ts +2 -2
- package/packages/pi-ai/src/providers/openai-responses-shared.ts +2 -2
- package/packages/pi-ai/src/providers/provider-capabilities.test.ts +174 -0
- package/packages/pi-ai/src/providers/provider-capabilities.ts +215 -0
- package/packages/pi-ai/src/providers/transform-messages-report.test.ts +189 -0
- package/packages/pi-ai/src/providers/transform-messages.ts +94 -1
- package/packages/pi-ai/src/utils/oauth/index.ts +3 -5
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +10 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +2 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +15 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +41 -0
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/index.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/tools/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/index.js +1 -0
- package/packages/pi-coding-agent/dist/core/tools/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/tool-compatibility-registry.d.ts +27 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-compatibility-registry.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-compatibility-registry.js +69 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-compatibility-registry.js.map +1 -0
- package/packages/pi-coding-agent/dist/index.d.ts +2 -2
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js +3 -1
- package/packages/pi-coding-agent/dist/index.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/extensions/index.ts +4 -0
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +11 -1
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +18 -0
- package/packages/pi-coding-agent/src/core/extensions/types.ts +45 -0
- package/packages/pi-coding-agent/src/core/tools/index.ts +7 -0
- package/packages/pi-coding-agent/src/core/tools/tool-compatibility-registry.ts +83 -0
- package/packages/pi-coding-agent/src/index.ts +9 -0
- package/pkg/package.json +1 -1
- package/src/resources/extensions/gsd/auto-model-selection.ts +35 -1
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +8 -0
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +9 -5
- package/src/resources/extensions/gsd/codebase-generator.ts +16 -0
- package/src/resources/extensions/gsd/commands-cmux.ts +32 -1
- package/src/resources/extensions/gsd/model-router.ts +73 -0
- package/src/resources/extensions/gsd/tests/cmux.test.ts +67 -1
- package/src/resources/extensions/gsd/tests/codebase-generator.test.ts +28 -0
- package/src/resources/extensions/gsd/tests/mcp-project-config.test.ts +6 -2
- package/src/resources/extensions/gsd/tests/tool-compatibility.test.ts +199 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +23 -7
- package/src/resources/extensions/gsd/workflow-mcp.ts +59 -5
- package/packages/pi-ai/dist/utils/oauth/anthropic.d.ts +0 -17
- package/packages/pi-ai/dist/utils/oauth/anthropic.d.ts.map +0 -1
- package/packages/pi-ai/dist/utils/oauth/anthropic.js +0 -106
- package/packages/pi-ai/dist/utils/oauth/anthropic.js.map +0 -1
- package/packages/pi-ai/src/utils/oauth/anthropic.ts +0 -140
- /package/dist/web/standalone/.next/static/{5D80IWYltFwlAJiCZ84MC → CHeIRZw-E97oO51g7zDvv}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{5D80IWYltFwlAJiCZ84MC → CHeIRZw-E97oO51g7zDvv}/_ssgManifest.js +0 -0
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
import type { ComplexityTier, ClassificationResult, TaskMetadata } from "./complexity-classifier.js";
|
|
6
6
|
import { tierOrdinal } from "./complexity-classifier.js";
|
|
7
7
|
import type { ResolvedModelConfig } from "./preferences.js";
|
|
8
|
+
import { getProviderCapabilities, type ProviderCapabilities } from "@gsd/pi-ai";
|
|
9
|
+
import { getToolCompatibility, getAllToolCompatibility } from "@gsd/pi-coding-agent";
|
|
10
|
+
import type { ToolCompatibility } from "@gsd/pi-coding-agent";
|
|
8
11
|
|
|
9
12
|
// ─── Types ───────────────────────────────────────────────────────────────────
|
|
10
13
|
|
|
@@ -37,6 +40,8 @@ export interface RoutingDecision {
|
|
|
37
40
|
selectionMethod: "tier-only" | "capability-scored";
|
|
38
41
|
/** Capability scores per eligible model (capability-scored path only) */
|
|
39
42
|
capabilityScores?: Record<string, number>;
|
|
43
|
+
/** Tools filtered out due to provider incompatibility (ADR-005) */
|
|
44
|
+
filteredTools?: string[];
|
|
40
45
|
/** Task requirement vector used for scoring */
|
|
41
46
|
taskRequirements?: Partial<Record<string, number>>;
|
|
42
47
|
}
|
|
@@ -536,3 +541,71 @@ function getModelCost(modelId: string): number {
|
|
|
536
541
|
// Unknown cost — assume expensive to avoid routing to unknown cheap models
|
|
537
542
|
return 999;
|
|
538
543
|
}
|
|
544
|
+
|
|
545
|
+
// ─── Tool Compatibility Filter (ADR-005 Phase 3) ───────────────────────────
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Check if a tool is compatible with a provider's capabilities.
|
|
549
|
+
* Returns true if the tool can be used with the provider.
|
|
550
|
+
*/
|
|
551
|
+
export function isToolCompatibleWithProvider(
|
|
552
|
+
toolName: string,
|
|
553
|
+
providerCaps: ProviderCapabilities,
|
|
554
|
+
): boolean {
|
|
555
|
+
const compat = getToolCompatibility(toolName);
|
|
556
|
+
if (!compat) return true; // no metadata = always compatible
|
|
557
|
+
|
|
558
|
+
// Hard filter: provider doesn't support image tool results
|
|
559
|
+
if (compat.producesImages && !providerCaps.imageToolResults) return false;
|
|
560
|
+
|
|
561
|
+
// Hard filter: tool uses schema features provider doesn't support
|
|
562
|
+
if (compat.schemaFeatures?.some(f => providerCaps.unsupportedSchemaFeatures.includes(f))) {
|
|
563
|
+
return false;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
return true;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Filter a list of tool names to only those compatible with a provider.
|
|
571
|
+
* Used by the routing pipeline to adjust tool sets when switching providers.
|
|
572
|
+
*/
|
|
573
|
+
export function filterToolsForProvider(
|
|
574
|
+
toolNames: string[],
|
|
575
|
+
providerApi: string,
|
|
576
|
+
): { compatible: string[]; filtered: string[] } {
|
|
577
|
+
const providerCaps = getProviderCapabilities(providerApi);
|
|
578
|
+
|
|
579
|
+
// Provider doesn't support tool calling at all
|
|
580
|
+
if (!providerCaps.toolCalling) {
|
|
581
|
+
return { compatible: [], filtered: toolNames };
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
const compatible: string[] = [];
|
|
585
|
+
const filtered: string[] = [];
|
|
586
|
+
|
|
587
|
+
for (const name of toolNames) {
|
|
588
|
+
if (isToolCompatibleWithProvider(name, providerCaps)) {
|
|
589
|
+
compatible.push(name);
|
|
590
|
+
} else {
|
|
591
|
+
filtered.push(name);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
return { compatible, filtered };
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Adjust the active tool set for a selected model's provider capabilities.
|
|
600
|
+
* Returns tool names that should be active — removes incompatible tools.
|
|
601
|
+
*
|
|
602
|
+
* This is a hard filter only — it removes tools that would fail at the
|
|
603
|
+
* provider level. It does NOT remove tools based on soft heuristics.
|
|
604
|
+
*/
|
|
605
|
+
export function adjustToolSet(
|
|
606
|
+
activeToolNames: string[],
|
|
607
|
+
selectedModelApi: string,
|
|
608
|
+
): { toolNames: string[]; removedTools: string[] } {
|
|
609
|
+
const { compatible, filtered } = filterToolsForProvider(activeToolNames, selectedModelApi);
|
|
610
|
+
return { toolNames: compatible, removedTools: filtered };
|
|
611
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import test, { describe } from "node:test";
|
|
1
|
+
import test, { describe, beforeEach, afterEach } from "node:test";
|
|
2
2
|
import assert from "node:assert/strict";
|
|
3
3
|
import * as fs from "node:fs";
|
|
4
4
|
import * as path from "node:path";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
5
6
|
import { fileURLToPath } from "node:url";
|
|
6
7
|
import {
|
|
7
8
|
buildCmuxProgress,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
resolveCmuxConfig,
|
|
13
14
|
shouldPromptToEnableCmux,
|
|
14
15
|
} from "../../cmux/index.ts";
|
|
16
|
+
import { autoEnableCmuxPreferences } from "../commands-cmux.ts";
|
|
15
17
|
import type { GSDState } from "../types.ts";
|
|
16
18
|
|
|
17
19
|
test("detectCmuxEnvironment requires workspace, surface, and socket", () => {
|
|
@@ -79,6 +81,70 @@ test("shouldPromptToEnableCmux only prompts once per session", () => {
|
|
|
79
81
|
resetCmuxPromptState();
|
|
80
82
|
});
|
|
81
83
|
|
|
84
|
+
describe("autoEnableCmuxPreferences", () => {
|
|
85
|
+
let tmp: string;
|
|
86
|
+
let originalCwd: string;
|
|
87
|
+
|
|
88
|
+
beforeEach(() => {
|
|
89
|
+
originalCwd = process.cwd();
|
|
90
|
+
tmp = fs.mkdtempSync(path.join(tmpdir(), "cmux-auto-test-"));
|
|
91
|
+
fs.mkdirSync(path.join(tmp, ".gsd"), { recursive: true });
|
|
92
|
+
process.chdir(tmp);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
afterEach(() => {
|
|
96
|
+
process.chdir(originalCwd);
|
|
97
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("writes cmux.enabled true when preferences file exists with no cmux config", () => {
|
|
101
|
+
const prefsPath = path.join(tmp, ".gsd", "preferences.md");
|
|
102
|
+
fs.writeFileSync(prefsPath, [
|
|
103
|
+
"---",
|
|
104
|
+
"version: 1",
|
|
105
|
+
"---",
|
|
106
|
+
"",
|
|
107
|
+
"# GSD Skill Preferences",
|
|
108
|
+
].join("\n"));
|
|
109
|
+
|
|
110
|
+
const result = autoEnableCmuxPreferences();
|
|
111
|
+
assert.equal(result, true);
|
|
112
|
+
|
|
113
|
+
const content = fs.readFileSync(prefsPath, "utf-8");
|
|
114
|
+
assert.ok(content.includes("enabled: true"), "should write enabled: true");
|
|
115
|
+
assert.ok(content.includes("notifications: true"), "should default notifications on");
|
|
116
|
+
assert.ok(content.includes("sidebar: true"), "should default sidebar on");
|
|
117
|
+
assert.ok(content.includes("splits: false"), "should default splits off");
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test("returns false when preferences file does not exist", () => {
|
|
121
|
+
const result = autoEnableCmuxPreferences();
|
|
122
|
+
assert.equal(result, false);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test("preserves existing cmux sub-preferences when auto-enabling", () => {
|
|
126
|
+
const prefsPath = path.join(tmp, ".gsd", "preferences.md");
|
|
127
|
+
fs.writeFileSync(prefsPath, [
|
|
128
|
+
"---",
|
|
129
|
+
"version: 1",
|
|
130
|
+
"cmux:",
|
|
131
|
+
" splits: true",
|
|
132
|
+
" browser: true",
|
|
133
|
+
"---",
|
|
134
|
+
"",
|
|
135
|
+
"# GSD Skill Preferences",
|
|
136
|
+
].join("\n"));
|
|
137
|
+
|
|
138
|
+
const result = autoEnableCmuxPreferences();
|
|
139
|
+
assert.equal(result, true);
|
|
140
|
+
|
|
141
|
+
const content = fs.readFileSync(prefsPath, "utf-8");
|
|
142
|
+
assert.ok(content.includes("enabled: true"), "should set enabled: true");
|
|
143
|
+
assert.ok(content.includes("splits: true"), "should preserve existing splits: true");
|
|
144
|
+
assert.ok(content.includes("browser: true"), "should preserve existing browser: true");
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
|
|
82
148
|
test("buildCmuxStatusLabel and progress prefer deepest active unit", () => {
|
|
83
149
|
const state: GSDState = {
|
|
84
150
|
activeMilestone: { id: "M001", title: "Milestone" },
|
|
@@ -162,6 +162,34 @@ test("generateCodebaseMap: excludes .claude/ and other tool directories", () =>
|
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
164
|
|
|
165
|
+
test("generateCodebaseMap: excludes .agents/ and other tooling directories", () => {
|
|
166
|
+
const base = makeTmpRepo();
|
|
167
|
+
try {
|
|
168
|
+
addFile(base, "src/main.ts");
|
|
169
|
+
addFile(base, ".agents/skills/pdf/SKILL.md");
|
|
170
|
+
addFile(base, ".agents/skills/find-skills/SKILL.md");
|
|
171
|
+
addFile(base, ".bg-shell/session.json");
|
|
172
|
+
addFile(base, ".idea/workspace.xml");
|
|
173
|
+
addFile(base, ".cache/data.bin");
|
|
174
|
+
addFile(base, "tmp/scratch.ts");
|
|
175
|
+
addFile(base, "target/debug/build.rs");
|
|
176
|
+
addFile(base, "venv/lib/site.py");
|
|
177
|
+
|
|
178
|
+
const result = generateCodebaseMap(base);
|
|
179
|
+
assert.ok(result.content.includes("`src/main.ts`"), "should include src/main.ts");
|
|
180
|
+
assert.ok(!result.content.includes("SKILL.md"), "should exclude .agents/ files");
|
|
181
|
+
assert.ok(!result.content.includes(".bg-shell"), "should exclude .bg-shell/ files");
|
|
182
|
+
assert.ok(!result.content.includes(".idea"), "should exclude .idea/ files");
|
|
183
|
+
assert.ok(!result.content.includes(".cache"), "should exclude .cache/ files");
|
|
184
|
+
assert.ok(!result.content.includes("tmp/"), "should exclude tmp/ files");
|
|
185
|
+
assert.ok(!result.content.includes("target"), "should exclude target/ files");
|
|
186
|
+
assert.ok(!result.content.includes("venv"), "should exclude venv/ files");
|
|
187
|
+
assert.equal(result.fileCount, 1);
|
|
188
|
+
} finally {
|
|
189
|
+
cleanup(base);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
|
|
165
193
|
test("generateCodebaseMap: excludes binary and lock files", () => {
|
|
166
194
|
const base = makeTmpRepo();
|
|
167
195
|
try {
|
|
@@ -26,8 +26,12 @@ test("ensureProjectWorkflowMcpConfig creates .mcp.json with the workflow server"
|
|
|
26
26
|
assert.equal(typeof server?.command, "string");
|
|
27
27
|
assert.equal(Array.isArray(server?.args), true);
|
|
28
28
|
assert.equal(server?.env?.GSD_WORKFLOW_PROJECT_ROOT, projectRoot);
|
|
29
|
-
assert.match(server?.env?.GSD_WORKFLOW_EXECUTORS_MODULE ?? "", /workflow-tool-executors\.js$/);
|
|
30
|
-
assert.match(server?.env?.GSD_WORKFLOW_WRITE_GATE_MODULE ?? "", /write-gate\.js$/);
|
|
29
|
+
assert.match(server?.env?.GSD_WORKFLOW_EXECUTORS_MODULE ?? "", /workflow-tool-executors\.(js|ts)$/);
|
|
30
|
+
assert.match(server?.env?.GSD_WORKFLOW_WRITE_GATE_MODULE ?? "", /write-gate\.(js|ts)$/);
|
|
31
|
+
if ((server?.env?.GSD_WORKFLOW_EXECUTORS_MODULE ?? "").endsWith(".ts")) {
|
|
32
|
+
assert.match(server?.env?.NODE_OPTIONS ?? "", /--experimental-strip-types/);
|
|
33
|
+
assert.match(server?.env?.NODE_OPTIONS ?? "", /resolve-ts\.mjs/);
|
|
34
|
+
}
|
|
31
35
|
} finally {
|
|
32
36
|
rmSync(projectRoot, { recursive: true, force: true });
|
|
33
37
|
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
// GSD-2 — Tool Compatibility + Model Router Tool Filtering Tests (ADR-005 Phases 2-3)
|
|
2
|
+
import { describe, test, beforeEach } from "node:test";
|
|
3
|
+
import assert from "node:assert/strict";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
registerToolCompatibility,
|
|
7
|
+
getToolCompatibility,
|
|
8
|
+
getAllToolCompatibility,
|
|
9
|
+
registerMcpToolCompatibility,
|
|
10
|
+
resetToolCompatibilityRegistry,
|
|
11
|
+
} from "@gsd/pi-coding-agent";
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
isToolCompatibleWithProvider,
|
|
15
|
+
filterToolsForProvider,
|
|
16
|
+
adjustToolSet,
|
|
17
|
+
} from "../model-router.js";
|
|
18
|
+
|
|
19
|
+
import {
|
|
20
|
+
getProviderCapabilities,
|
|
21
|
+
} from "@gsd/pi-ai";
|
|
22
|
+
|
|
23
|
+
// ─── Tool Compatibility Registry ────────────────────────────────────────────
|
|
24
|
+
|
|
25
|
+
describe("tool compatibility registry", () => {
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
resetToolCompatibilityRegistry();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test("built-in tools are pre-registered", () => {
|
|
31
|
+
const builtins = ["bash", "read", "write", "edit", "grep", "find", "ls", "lsp"];
|
|
32
|
+
for (const name of builtins) {
|
|
33
|
+
const compat = getToolCompatibility(name);
|
|
34
|
+
assert.ok(compat !== undefined, `${name} should be pre-registered`);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("unknown tool returns undefined", () => {
|
|
39
|
+
assert.equal(getToolCompatibility("nonexistent_tool_xyz"), undefined);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test("registerToolCompatibility stores and retrieves metadata", () => {
|
|
43
|
+
registerToolCompatibility("screenshot_tool", {
|
|
44
|
+
producesImages: true,
|
|
45
|
+
minCapabilityTier: "standard",
|
|
46
|
+
});
|
|
47
|
+
const compat = getToolCompatibility("screenshot_tool");
|
|
48
|
+
assert.ok(compat);
|
|
49
|
+
assert.equal(compat.producesImages, true);
|
|
50
|
+
assert.equal(compat.minCapabilityTier, "standard");
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test("registerMcpToolCompatibility sets default schema features", () => {
|
|
54
|
+
registerMcpToolCompatibility("mcp__test__tool");
|
|
55
|
+
const compat = getToolCompatibility("mcp__test__tool");
|
|
56
|
+
assert.ok(compat);
|
|
57
|
+
assert.ok(compat.schemaFeatures?.includes("patternProperties"));
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test("registerMcpToolCompatibility allows overrides", () => {
|
|
61
|
+
registerMcpToolCompatibility("mcp__test__override", { producesImages: true });
|
|
62
|
+
const compat = getToolCompatibility("mcp__test__override");
|
|
63
|
+
assert.ok(compat);
|
|
64
|
+
assert.equal(compat.producesImages, true);
|
|
65
|
+
assert.ok(compat.schemaFeatures?.includes("patternProperties"));
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test("getAllToolCompatibility returns all entries", () => {
|
|
69
|
+
const all = getAllToolCompatibility();
|
|
70
|
+
assert.ok(all.size >= 10); // at least built-in tools
|
|
71
|
+
assert.ok(all.has("bash"));
|
|
72
|
+
assert.ok(all.has("read"));
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test("resetToolCompatibilityRegistry clears custom entries but keeps builtins", () => {
|
|
76
|
+
registerToolCompatibility("custom_tool", { producesImages: true });
|
|
77
|
+
assert.ok(getToolCompatibility("custom_tool"));
|
|
78
|
+
resetToolCompatibilityRegistry();
|
|
79
|
+
assert.equal(getToolCompatibility("custom_tool"), undefined);
|
|
80
|
+
assert.ok(getToolCompatibility("bash")); // built-in preserved
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// ─── isToolCompatibleWithProvider ───────────────────────────────────────────
|
|
85
|
+
|
|
86
|
+
describe("isToolCompatibleWithProvider", () => {
|
|
87
|
+
beforeEach(() => {
|
|
88
|
+
resetToolCompatibilityRegistry();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test("tool without compatibility metadata is always compatible", () => {
|
|
92
|
+
const caps = getProviderCapabilities("anthropic-messages");
|
|
93
|
+
assert.equal(isToolCompatibleWithProvider("unknown_tool", caps), true);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test("built-in tools are compatible with all providers", () => {
|
|
97
|
+
const providers = ["anthropic-messages", "openai-responses", "google-generative-ai", "mistral-conversations"];
|
|
98
|
+
const tools = ["bash", "read", "write", "edit"];
|
|
99
|
+
for (const api of providers) {
|
|
100
|
+
const caps = getProviderCapabilities(api);
|
|
101
|
+
for (const tool of tools) {
|
|
102
|
+
assert.equal(
|
|
103
|
+
isToolCompatibleWithProvider(tool, caps),
|
|
104
|
+
true,
|
|
105
|
+
`${tool} should be compatible with ${api}`,
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
test("image-producing tool filtered for providers without image support", () => {
|
|
112
|
+
registerToolCompatibility("screenshot", { producesImages: true });
|
|
113
|
+
const openaiCaps = getProviderCapabilities("openai-responses");
|
|
114
|
+
assert.equal(isToolCompatibleWithProvider("screenshot", openaiCaps), false);
|
|
115
|
+
|
|
116
|
+
const anthropicCaps = getProviderCapabilities("anthropic-messages");
|
|
117
|
+
assert.equal(isToolCompatibleWithProvider("screenshot", anthropicCaps), true);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test("tool with unsupported schema features filtered for Google", () => {
|
|
121
|
+
registerToolCompatibility("complex_schema_tool", {
|
|
122
|
+
schemaFeatures: ["patternProperties"],
|
|
123
|
+
});
|
|
124
|
+
const googleCaps = getProviderCapabilities("google-generative-ai");
|
|
125
|
+
assert.equal(isToolCompatibleWithProvider("complex_schema_tool", googleCaps), false);
|
|
126
|
+
|
|
127
|
+
const anthropicCaps = getProviderCapabilities("anthropic-messages");
|
|
128
|
+
assert.equal(isToolCompatibleWithProvider("complex_schema_tool", anthropicCaps), true);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
// ─── filterToolsForProvider ─────────────────────────────────────────────────
|
|
133
|
+
|
|
134
|
+
describe("filterToolsForProvider", () => {
|
|
135
|
+
beforeEach(() => {
|
|
136
|
+
resetToolCompatibilityRegistry();
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test("all built-in tools pass for any provider", () => {
|
|
140
|
+
const toolNames = ["bash", "read", "write", "edit", "grep", "find", "ls"];
|
|
141
|
+
const { compatible, filtered } = filterToolsForProvider(toolNames, "mistral-conversations");
|
|
142
|
+
assert.deepEqual(compatible, toolNames);
|
|
143
|
+
assert.deepEqual(filtered, []);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
test("image tool filtered for OpenAI Responses", () => {
|
|
147
|
+
registerToolCompatibility("browser_screenshot", { producesImages: true });
|
|
148
|
+
const toolNames = ["bash", "read", "browser_screenshot"];
|
|
149
|
+
const { compatible, filtered } = filterToolsForProvider(toolNames, "openai-responses");
|
|
150
|
+
assert.deepEqual(compatible, ["bash", "read"]);
|
|
151
|
+
assert.deepEqual(filtered, ["browser_screenshot"]);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test("MCP tool with patternProperties filtered for Google", () => {
|
|
155
|
+
registerMcpToolCompatibility("mcp__repowise__search");
|
|
156
|
+
const toolNames = ["bash", "read", "mcp__repowise__search"];
|
|
157
|
+
const { compatible, filtered } = filterToolsForProvider(toolNames, "google-generative-ai");
|
|
158
|
+
assert.deepEqual(compatible, ["bash", "read"]);
|
|
159
|
+
assert.deepEqual(filtered, ["mcp__repowise__search"]);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test("unknown provider passes all tools (permissive default)", () => {
|
|
163
|
+
registerToolCompatibility("image_tool", { producesImages: true });
|
|
164
|
+
registerMcpToolCompatibility("mcp_tool");
|
|
165
|
+
const toolNames = ["bash", "image_tool", "mcp_tool"];
|
|
166
|
+
const { compatible, filtered } = filterToolsForProvider(toolNames, "unknown-provider-xyz");
|
|
167
|
+
assert.deepEqual(compatible, toolNames);
|
|
168
|
+
assert.deepEqual(filtered, []);
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// ─── adjustToolSet ──────────────────────────────────────────────────────────
|
|
173
|
+
|
|
174
|
+
describe("adjustToolSet", () => {
|
|
175
|
+
beforeEach(() => {
|
|
176
|
+
resetToolCompatibilityRegistry();
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
test("returns all tools for Anthropic (most permissive)", () => {
|
|
180
|
+
registerToolCompatibility("screenshot", { producesImages: true });
|
|
181
|
+
const toolNames = ["bash", "read", "screenshot"];
|
|
182
|
+
const { toolNames: result, removedTools } = adjustToolSet(toolNames, "anthropic-messages");
|
|
183
|
+
assert.deepEqual(result, toolNames);
|
|
184
|
+
assert.deepEqual(removedTools, []);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
test("removes incompatible tools and reports them", () => {
|
|
188
|
+
registerToolCompatibility("screenshot", { producesImages: true });
|
|
189
|
+
registerMcpToolCompatibility("mcp_complex");
|
|
190
|
+
const toolNames = ["bash", "read", "screenshot", "mcp_complex"];
|
|
191
|
+
const { toolNames: result, removedTools } = adjustToolSet(toolNames, "google-generative-ai");
|
|
192
|
+
// Google supports images but not patternProperties
|
|
193
|
+
assert.ok(result.includes("bash"));
|
|
194
|
+
assert.ok(result.includes("read"));
|
|
195
|
+
assert.ok(result.includes("screenshot")); // Google supports images
|
|
196
|
+
assert.ok(!result.includes("mcp_complex")); // patternProperties not supported
|
|
197
|
+
assert.deepEqual(removedTools, ["mcp_complex"]);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
@@ -141,7 +141,11 @@ test("detectWorkflowMcpLaunchConfig resolves the bundled server relative to the
|
|
|
141
141
|
assert.match(launch?.env?.GSD_WORKFLOW_EXECUTORS_MODULE ?? "", /workflow-tool-executors\.(js|ts)$/);
|
|
142
142
|
assert.match(launch?.env?.GSD_WORKFLOW_WRITE_GATE_MODULE ?? "", /write-gate\.(js|ts)$/);
|
|
143
143
|
assert.equal(typeof launch?.args?.[0], "string");
|
|
144
|
-
assert.match(launch?.args?.[0] ?? "", /packages[\/\\]mcp-server[\/\\]dist[\/\\]cli\.js$/);
|
|
144
|
+
assert.match(launch?.args?.[0] ?? "", /packages[\/\\]mcp-server[\/\\](dist[\/\\]cli\.js|src[\/\\]cli\.ts)$/);
|
|
145
|
+
if ((launch?.args?.[0] ?? "").endsWith(".ts")) {
|
|
146
|
+
assert.match(launch?.env?.NODE_OPTIONS ?? "", /--experimental-strip-types/);
|
|
147
|
+
assert.match(launch?.env?.NODE_OPTIONS ?? "", /resolve-ts\.mjs/);
|
|
148
|
+
}
|
|
145
149
|
});
|
|
146
150
|
|
|
147
151
|
test("detectWorkflowMcpLaunchConfig resolves the bundled server relative to the package without env hints", () => {
|
|
@@ -154,7 +158,11 @@ test("detectWorkflowMcpLaunchConfig resolves the bundled server relative to the
|
|
|
154
158
|
assert.match(launch?.env?.GSD_WORKFLOW_EXECUTORS_MODULE ?? "", /workflow-tool-executors\.(js|ts)$/);
|
|
155
159
|
assert.match(launch?.env?.GSD_WORKFLOW_WRITE_GATE_MODULE ?? "", /write-gate\.(js|ts)$/);
|
|
156
160
|
assert.equal(typeof launch?.args?.[0], "string");
|
|
157
|
-
assert.match(launch?.args?.[0] ?? "", /packages[\/\\]mcp-server[\/\\]dist[\/\\]cli\.js$/);
|
|
161
|
+
assert.match(launch?.args?.[0] ?? "", /packages[\/\\]mcp-server[\/\\](dist[\/\\]cli\.js|src[\/\\]cli\.ts)$/);
|
|
162
|
+
if ((launch?.args?.[0] ?? "").endsWith(".ts")) {
|
|
163
|
+
assert.match(launch?.env?.NODE_OPTIONS ?? "", /--experimental-strip-types/);
|
|
164
|
+
assert.match(launch?.env?.NODE_OPTIONS ?? "", /resolve-ts\.mjs/);
|
|
165
|
+
}
|
|
158
166
|
});
|
|
159
167
|
|
|
160
168
|
test("workflow MCP launch config reaches mutation tools over stdio", async () => {
|
|
@@ -165,12 +173,16 @@ test("workflow MCP launch config reaches mutation tools over stdio", async () =>
|
|
|
165
173
|
assert.ok(launch, "expected a workflow MCP launch config");
|
|
166
174
|
assert.match(
|
|
167
175
|
launch.env?.GSD_WORKFLOW_EXECUTORS_MODULE ?? "",
|
|
168
|
-
/dist[\/\\]resources[\/\\]extensions[\/\\]gsd[\/\\]tools[\/\\]workflow-tool-executors\.js$/,
|
|
176
|
+
/(dist[\/\\]resources[\/\\]extensions[\/\\]gsd[\/\\]tools[\/\\]workflow-tool-executors\.js|src[\/\\]resources[\/\\]extensions[\/\\]gsd[\/\\]tools[\/\\]workflow-tool-executors\.(js|ts))$/,
|
|
169
177
|
);
|
|
170
178
|
assert.match(
|
|
171
179
|
launch.env?.GSD_WORKFLOW_WRITE_GATE_MODULE ?? "",
|
|
172
|
-
/dist[\/\\]resources[\/\\]extensions[\/\\]gsd[\/\\]bootstrap[\/\\]write-gate\.js$/,
|
|
180
|
+
/(dist[\/\\]resources[\/\\]extensions[\/\\]gsd[\/\\]bootstrap[\/\\]write-gate\.js|src[\/\\]resources[\/\\]extensions[\/\\]gsd[\/\\]bootstrap[\/\\]write-gate\.(js|ts))$/,
|
|
173
181
|
);
|
|
182
|
+
if ((launch.env?.GSD_WORKFLOW_EXECUTORS_MODULE ?? "").endsWith(".ts")) {
|
|
183
|
+
assert.match(launch.env?.NODE_OPTIONS ?? "", /--experimental-strip-types/);
|
|
184
|
+
assert.match(launch.env?.NODE_OPTIONS ?? "", /resolve-ts\.mjs/);
|
|
185
|
+
}
|
|
174
186
|
|
|
175
187
|
const client = new Client({ name: "workflow-mcp-transport-test", version: "1.0.0" });
|
|
176
188
|
const transport = new StdioClientTransport({
|
|
@@ -189,6 +201,10 @@ test("workflow MCP launch config reaches mutation tools over stdio", async () =>
|
|
|
189
201
|
(tools.tools ?? []).some((tool) => tool.name === "gsd_plan_slice"),
|
|
190
202
|
"expected workflow MCP surface to expose gsd_plan_slice",
|
|
191
203
|
);
|
|
204
|
+
assert.ok(
|
|
205
|
+
(tools.tools ?? []).some((tool) => tool.name === "ask_user_questions"),
|
|
206
|
+
"expected workflow MCP surface to expose ask_user_questions",
|
|
207
|
+
);
|
|
192
208
|
|
|
193
209
|
const milestoneResult = await client.callTool(
|
|
194
210
|
{
|
|
@@ -465,18 +481,18 @@ test("transport compatibility now allows replan-slice over workflow MCP surface"
|
|
|
465
481
|
test("transport compatibility still blocks units whose MCP tools are not exposed", () => {
|
|
466
482
|
const error = getWorkflowTransportSupportError(
|
|
467
483
|
"claude-code",
|
|
468
|
-
["
|
|
484
|
+
["secure_env_collect"],
|
|
469
485
|
{
|
|
470
486
|
projectRoot: "/tmp/project",
|
|
471
487
|
env: { GSD_WORKFLOW_MCP_COMMAND: "node" },
|
|
472
488
|
surface: "auto-mode",
|
|
473
|
-
unitType: "
|
|
489
|
+
unitType: "guided-discussion",
|
|
474
490
|
authMode: "externalCli",
|
|
475
491
|
baseUrl: "local://claude-code",
|
|
476
492
|
},
|
|
477
493
|
);
|
|
478
494
|
|
|
479
|
-
assert.match(error ?? "", /requires
|
|
495
|
+
assert.match(error ?? "", /requires secure_env_collect/);
|
|
480
496
|
assert.match(error ?? "", /currently exposes only/);
|
|
481
497
|
});
|
|
482
498
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { execSync } from "node:child_process";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { dirname, resolve } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
5
|
|
|
6
6
|
export interface WorkflowMcpLaunchConfig {
|
|
7
7
|
name: string;
|
|
@@ -21,22 +21,35 @@ export interface WorkflowCapabilityOptions {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const MCP_WORKFLOW_TOOL_SURFACE = new Set([
|
|
24
|
+
"ask_user_questions",
|
|
25
|
+
"gsd_decision_save",
|
|
24
26
|
"gsd_complete_milestone",
|
|
25
27
|
"gsd_complete_task",
|
|
26
28
|
"gsd_complete_slice",
|
|
29
|
+
"gsd_generate_milestone_id",
|
|
30
|
+
"gsd_journal_query",
|
|
27
31
|
"gsd_milestone_complete",
|
|
32
|
+
"gsd_milestone_generate_id",
|
|
28
33
|
"gsd_milestone_status",
|
|
29
34
|
"gsd_milestone_validate",
|
|
35
|
+
"gsd_plan_task",
|
|
30
36
|
"gsd_plan_milestone",
|
|
31
37
|
"gsd_plan_slice",
|
|
32
38
|
"gsd_replan_slice",
|
|
33
39
|
"gsd_reassess_roadmap",
|
|
40
|
+
"gsd_requirement_save",
|
|
41
|
+
"gsd_requirement_update",
|
|
34
42
|
"gsd_roadmap_reassess",
|
|
43
|
+
"gsd_save_decision",
|
|
35
44
|
"gsd_save_gate_result",
|
|
45
|
+
"gsd_save_requirement",
|
|
46
|
+
"gsd_skip_slice",
|
|
36
47
|
"gsd_slice_replan",
|
|
37
48
|
"gsd_slice_complete",
|
|
38
49
|
"gsd_summary_save",
|
|
50
|
+
"gsd_task_plan",
|
|
39
51
|
"gsd_task_complete",
|
|
52
|
+
"gsd_update_requirement",
|
|
40
53
|
"gsd_validate_milestone",
|
|
41
54
|
]);
|
|
42
55
|
|
|
@@ -95,6 +108,8 @@ function getBundledWorkflowMcpCliPath(env: NodeJS.ProcessEnv): string | null {
|
|
|
95
108
|
}
|
|
96
109
|
|
|
97
110
|
const candidates = [
|
|
111
|
+
resolve(fileURLToPath(new URL("../../../../packages/mcp-server/src/cli.ts", import.meta.url))),
|
|
112
|
+
resolve(fileURLToPath(new URL("../../../../../packages/mcp-server/src/cli.ts", import.meta.url))),
|
|
98
113
|
resolve(fileURLToPath(new URL("../../../../packages/mcp-server/dist/cli.js", import.meta.url))),
|
|
99
114
|
resolve(fileURLToPath(new URL("../../../../../packages/mcp-server/dist/cli.js", import.meta.url))),
|
|
100
115
|
];
|
|
@@ -108,9 +123,9 @@ function getBundledWorkflowMcpCliPath(env: NodeJS.ProcessEnv): string | null {
|
|
|
108
123
|
|
|
109
124
|
function getBundledWorkflowExecutorModulePath(): string | null {
|
|
110
125
|
const candidates = [
|
|
111
|
-
resolve(fileURLToPath(new URL("../../../../dist/resources/extensions/gsd/tools/workflow-tool-executors.js", import.meta.url))),
|
|
112
126
|
resolve(fileURLToPath(new URL("./tools/workflow-tool-executors.js", import.meta.url))),
|
|
113
127
|
resolve(fileURLToPath(new URL("./tools/workflow-tool-executors.ts", import.meta.url))),
|
|
128
|
+
resolve(fileURLToPath(new URL("../../../../dist/resources/extensions/gsd/tools/workflow-tool-executors.js", import.meta.url))),
|
|
114
129
|
];
|
|
115
130
|
|
|
116
131
|
for (const candidate of candidates) {
|
|
@@ -122,9 +137,9 @@ function getBundledWorkflowExecutorModulePath(): string | null {
|
|
|
122
137
|
|
|
123
138
|
function getBundledWorkflowWriteGateModulePath(): string | null {
|
|
124
139
|
const candidates = [
|
|
125
|
-
resolve(fileURLToPath(new URL("../../../../dist/resources/extensions/gsd/bootstrap/write-gate.js", import.meta.url))),
|
|
126
140
|
resolve(fileURLToPath(new URL("./bootstrap/write-gate.js", import.meta.url))),
|
|
127
141
|
resolve(fileURLToPath(new URL("./bootstrap/write-gate.ts", import.meta.url))),
|
|
142
|
+
resolve(fileURLToPath(new URL("../../../../dist/resources/extensions/gsd/bootstrap/write-gate.js", import.meta.url))),
|
|
128
143
|
];
|
|
129
144
|
|
|
130
145
|
for (const candidate of candidates) {
|
|
@@ -134,19 +149,58 @@ function getBundledWorkflowWriteGateModulePath(): string | null {
|
|
|
134
149
|
return null;
|
|
135
150
|
}
|
|
136
151
|
|
|
152
|
+
function getResolveTsHookPath(): string | null {
|
|
153
|
+
const candidates = [
|
|
154
|
+
resolve(fileURLToPath(new URL("./tests/resolve-ts.mjs", import.meta.url))),
|
|
155
|
+
resolve(fileURLToPath(new URL("../../../../src/resources/extensions/gsd/tests/resolve-ts.mjs", import.meta.url))),
|
|
156
|
+
];
|
|
157
|
+
|
|
158
|
+
for (const candidate of candidates) {
|
|
159
|
+
if (existsSync(candidate)) return candidate;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function mergeNodeOptions(existing: string | undefined, additions: string[]): string | undefined {
|
|
166
|
+
const tokens = (existing ?? "").split(/\s+/).map((value) => value.trim()).filter(Boolean);
|
|
167
|
+
for (const addition of additions) {
|
|
168
|
+
if (!tokens.includes(addition)) {
|
|
169
|
+
tokens.push(addition);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return tokens.length > 0 ? tokens.join(" ") : undefined;
|
|
173
|
+
}
|
|
174
|
+
|
|
137
175
|
function buildWorkflowLaunchEnv(
|
|
138
176
|
projectRoot: string,
|
|
139
177
|
gsdCliPath: string | undefined,
|
|
140
178
|
explicitEnv?: Record<string, string>,
|
|
179
|
+
workflowCliPath?: string,
|
|
141
180
|
): Record<string, string> {
|
|
142
181
|
const executorModulePath = getBundledWorkflowExecutorModulePath();
|
|
143
182
|
const writeGateModulePath = getBundledWorkflowWriteGateModulePath();
|
|
183
|
+
const resolveTsHookPath = getResolveTsHookPath();
|
|
184
|
+
const wantsSourceTs =
|
|
185
|
+
Boolean(resolveTsHookPath) &&
|
|
186
|
+
(
|
|
187
|
+
(workflowCliPath?.endsWith(".ts") ?? false) ||
|
|
188
|
+
(executorModulePath?.endsWith(".ts") ?? false) ||
|
|
189
|
+
(writeGateModulePath?.endsWith(".ts") ?? false)
|
|
190
|
+
);
|
|
191
|
+
const nodeOptions = wantsSourceTs
|
|
192
|
+
? mergeNodeOptions(explicitEnv?.NODE_OPTIONS, [
|
|
193
|
+
"--experimental-strip-types",
|
|
194
|
+
`--import=${pathToFileURL(resolveTsHookPath!).href}`,
|
|
195
|
+
])
|
|
196
|
+
: explicitEnv?.NODE_OPTIONS;
|
|
144
197
|
|
|
145
198
|
return {
|
|
146
199
|
...(explicitEnv ?? {}),
|
|
147
200
|
...(gsdCliPath ? { GSD_CLI_PATH: gsdCliPath } : {}),
|
|
148
201
|
...(executorModulePath ? { GSD_WORKFLOW_EXECUTORS_MODULE: executorModulePath } : {}),
|
|
149
202
|
...(writeGateModulePath ? { GSD_WORKFLOW_WRITE_GATE_MODULE: writeGateModulePath } : {}),
|
|
203
|
+
...(nodeOptions ? { NODE_OPTIONS: nodeOptions } : {}),
|
|
150
204
|
GSD_PERSIST_WRITE_GATE_STATE: "1",
|
|
151
205
|
GSD_WORKFLOW_PROJECT_ROOT: projectRoot,
|
|
152
206
|
};
|
|
@@ -188,7 +242,7 @@ export function detectWorkflowMcpLaunchConfig(
|
|
|
188
242
|
command: process.execPath,
|
|
189
243
|
args: [distCli],
|
|
190
244
|
cwd: resolvedWorkflowProjectRoot,
|
|
191
|
-
env: buildWorkflowLaunchEnv(resolvedWorkflowProjectRoot, gsdCliPath),
|
|
245
|
+
env: buildWorkflowLaunchEnv(resolvedWorkflowProjectRoot, gsdCliPath, undefined, distCli),
|
|
192
246
|
};
|
|
193
247
|
}
|
|
194
248
|
|
|
@@ -199,7 +253,7 @@ export function detectWorkflowMcpLaunchConfig(
|
|
|
199
253
|
command: process.execPath,
|
|
200
254
|
args: [bundledCli],
|
|
201
255
|
cwd: resolvedWorkflowProjectRoot,
|
|
202
|
-
env: buildWorkflowLaunchEnv(resolvedWorkflowProjectRoot, gsdCliPath),
|
|
256
|
+
env: buildWorkflowLaunchEnv(resolvedWorkflowProjectRoot, gsdCliPath, undefined, bundledCli),
|
|
203
257
|
};
|
|
204
258
|
}
|
|
205
259
|
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Anthropic OAuth flow (Claude Pro/Max)
|
|
3
|
-
*/
|
|
4
|
-
import type { OAuthCredentials, OAuthProviderInterface } from "./types.js";
|
|
5
|
-
/**
|
|
6
|
-
* Login with Anthropic OAuth (device code flow)
|
|
7
|
-
*
|
|
8
|
-
* @param onAuthUrl - Callback to handle the authorization URL (e.g., open browser)
|
|
9
|
-
* @param onPromptCode - Callback to prompt user for the authorization code
|
|
10
|
-
*/
|
|
11
|
-
export declare function loginAnthropic(onAuthUrl: (url: string) => void, onPromptCode: () => Promise<string>): Promise<OAuthCredentials>;
|
|
12
|
-
/**
|
|
13
|
-
* Refresh Anthropic OAuth token
|
|
14
|
-
*/
|
|
15
|
-
export declare function refreshAnthropicToken(refreshToken: string): Promise<OAuthCredentials>;
|
|
16
|
-
export declare const anthropicOAuthProvider: OAuthProviderInterface;
|
|
17
|
-
//# sourceMappingURL=anthropic.d.ts.map
|