@opengsd/gsd-pi 1.0.2-dev.235ebf3 → 1.0.2-dev.29398d2
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/README.md +63 -12
- package/dist/onboarding.js +22 -3
- package/dist/resource-loader.d.ts +7 -0
- package/dist/resource-loader.js +42 -9
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/extensions/context7/index.js +12 -2
- package/dist/resources/extensions/google-cli/index.js +30 -0
- package/dist/resources/extensions/google-cli/models.js +55 -0
- package/dist/resources/extensions/google-cli/package.json +11 -0
- package/dist/resources/extensions/google-cli/readiness.js +12 -0
- package/dist/resources/extensions/google-cli/stream-adapter.js +191 -0
- package/dist/resources/extensions/gsd/auto/loop.js +19 -0
- package/dist/resources/extensions/gsd/auto/phases.js +1 -1
- package/dist/resources/extensions/gsd/auto/session.js +3 -0
- package/dist/resources/extensions/gsd/auto-start.js +232 -49
- package/dist/resources/extensions/gsd/auto-worktree.js +2 -54
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +4 -3
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +17 -15
- package/dist/resources/extensions/gsd/closeout-recovery.js +7 -1
- package/dist/resources/extensions/gsd/commands/handlers/auto.js +9 -1
- package/dist/resources/extensions/gsd/commands-handlers.js +3 -0
- package/dist/resources/extensions/gsd/doctor-providers.js +54 -24
- package/dist/resources/extensions/gsd/git-conflict-state.js +26 -1
- package/dist/resources/extensions/gsd/key-manager.js +45 -13
- package/dist/resources/extensions/gsd/tools/complete-task.js +9 -0
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +40 -1
- package/dist/resources/extensions/gsd/worktree-lifecycle.js +24 -3
- package/dist/resources/extensions/gsd/worktree-post-create-hook.js +117 -0
- package/dist/resources/extensions/search-the-web/native-search.js +57 -8
- package/dist/resources/shared/package-manager-detection.js +36 -0
- package/dist/update-check.d.ts +6 -2
- package/dist/update-check.js +7 -3
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +5 -5
- 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/boot/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/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 +5 -5
- package/dist/web/standalone/.next/server/chunks/1834.js +2 -2
- 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/dist/web/standalone/node_modules/node-pty/build/Makefile +1 -1
- package/dist/web/standalone/package.json +0 -1
- package/dist/worktree-cli.d.ts +0 -2
- package/dist/worktree-cli.js +21 -9
- package/package.json +5 -2
- package/packages/cloud-mcp-gateway/bin/gsd-cloud-mcp-gateway.js +14 -0
- package/packages/cloud-mcp-gateway/package.json +4 -3
- package/packages/contracts/package.json +1 -1
- package/packages/daemon/package.json +4 -4
- package/packages/gsd-agent-core/package.json +5 -5
- package/packages/gsd-agent-modes/dist/modes/interactive/components/login-dialog.d.ts +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/login-dialog.js +2 -2
- package/packages/gsd-agent-modes/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/oauth-selector.d.ts +6 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/oauth-selector.js +9 -6
- package/packages/gsd-agent-modes/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js +3 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/transcript-design.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/transcript-design.js +0 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/transcript-design.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-class-constants.d.ts +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-class-constants.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-class-constants.js +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-class-constants.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.js +2 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-auth.d.ts +3 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-auth.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-auth.js +144 -2
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-auth.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-session.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-session.js +2 -14
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-session.js.map +1 -1
- package/packages/gsd-agent-modes/package.json +7 -7
- package/packages/mcp-server/bin/gsd-mcp-server.js +14 -0
- package/packages/mcp-server/dist/workflow-tools.js +1 -1
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +5 -4
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +13 -13
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/bin/pi-ai.js +14 -0
- package/packages/pi-ai/dist/models.generated.d.ts +40 -17
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.js +49 -30
- package/packages/pi-ai/dist/models.generated.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +50 -0
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/types.d.ts +2 -0
- package/packages/pi-ai/dist/types.d.ts.map +1 -1
- package/packages/pi-ai/dist/types.js.map +1 -1
- package/packages/pi-ai/package.json +3 -2
- package/packages/pi-coding-agent/dist/core/tools/read.d.ts +2 -2
- package/packages/pi-coding-agent/dist/core/tools/read.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/read.js +5 -3
- package/packages/pi-coding-agent/dist/core/tools/read.js.map +1 -1
- package/packages/pi-coding-agent/package.json +8 -8
- package/packages/pi-tui/package.json +1 -1
- package/packages/rpc-client/package.json +2 -2
- package/pkg/package.json +1 -1
- package/scripts/install/deps.js +10 -0
- package/scripts/install/detect-existing.js +17 -3
- package/scripts/install/npm-global.js +103 -33
- package/scripts/install.js +1 -0
- package/src/resources/extensions/context7/index.ts +15 -2
- package/src/resources/extensions/google-cli/index.ts +34 -0
- package/src/resources/extensions/google-cli/models.ts +57 -0
- package/src/resources/extensions/google-cli/package.json +11 -0
- package/src/resources/extensions/google-cli/readiness.ts +15 -0
- package/src/resources/extensions/google-cli/stream-adapter.ts +245 -0
- package/src/resources/extensions/gsd/auto/loop.ts +22 -0
- package/src/resources/extensions/gsd/auto/phases.ts +1 -1
- package/src/resources/extensions/gsd/auto/session.ts +3 -0
- package/src/resources/extensions/gsd/auto-start.ts +307 -56
- package/src/resources/extensions/gsd/auto-worktree.ts +2 -56
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +4 -3
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +22 -15
- package/src/resources/extensions/gsd/closeout-recovery.ts +6 -1
- package/src/resources/extensions/gsd/commands/handlers/auto.ts +9 -1
- package/src/resources/extensions/gsd/commands-handlers.ts +2 -0
- package/src/resources/extensions/gsd/doctor-providers.ts +55 -27
- package/src/resources/extensions/gsd/git-conflict-state.ts +25 -1
- package/src/resources/extensions/gsd/key-manager.ts +57 -14
- package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +436 -0
- package/src/resources/extensions/gsd/tests/closeout-recovery.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/commands-context.test.ts +5 -3
- package/src/resources/extensions/gsd/tests/commands-dispatcher-workspace-git.test.ts +15 -2
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +64 -0
- package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +105 -0
- package/src/resources/extensions/gsd/tests/key-manager.test.ts +23 -4
- package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +70 -10
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +13 -2
- package/src/resources/extensions/gsd/tests/tool-param-optionality.test.ts +24 -1
- package/src/resources/extensions/gsd/tests/workflow-mcp-auto-prep.test.ts +60 -0
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/workspace-git-preflight.test.ts +16 -1
- package/src/resources/extensions/gsd/tests/worktree-lifecycle.test.ts +28 -0
- package/src/resources/extensions/gsd/tests/worktree-post-create-hook.test.ts +141 -1
- package/src/resources/extensions/gsd/tests/zombie-gsd-state.test.ts +45 -1
- package/src/resources/extensions/gsd/tools/complete-task.ts +9 -0
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +56 -4
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +37 -2
- package/src/resources/extensions/gsd/worktree-post-create-hook.ts +127 -0
- package/src/resources/extensions/search-the-web/native-search.ts +60 -8
- package/src/resources/shared/package-manager-detection.ts +39 -0
- package/dist/tsconfig.extensions.tsbuildinfo +0 -1
- /package/dist/web/standalone/.next/static/{-P554bKh56nzavKUmvFM2 → bukT6Ux1YchPm2XqjaexX}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{-P554bKh56nzavKUmvFM2 → bukT6Ux1YchPm2XqjaexX}/_ssgManifest.js +0 -0
|
@@ -4,7 +4,75 @@
|
|
|
4
4
|
import { getAuthPath } from "@gsd/pi-coding-agent/config.js";
|
|
5
5
|
import { LoginDialogComponent } from "./components/login-dialog.js";
|
|
6
6
|
import { OAuthSelectorComponent } from "./components/oauth-selector.js";
|
|
7
|
+
const BLOCKED_BROWSER_OAUTH_PROVIDERS = new Set(["anthropic"]);
|
|
8
|
+
function isBrowserOAuthProviderAllowed(providerId) {
|
|
9
|
+
return !BLOCKED_BROWSER_OAUTH_PROVIDERS.has(providerId);
|
|
10
|
+
}
|
|
11
|
+
function uniqueProviders(providers) {
|
|
12
|
+
const seen = new Set();
|
|
13
|
+
const unique = [];
|
|
14
|
+
for (const provider of providers) {
|
|
15
|
+
if (seen.has(provider.id))
|
|
16
|
+
continue;
|
|
17
|
+
seen.add(provider.id);
|
|
18
|
+
unique.push(provider);
|
|
19
|
+
}
|
|
20
|
+
return unique;
|
|
21
|
+
}
|
|
22
|
+
function formatAuthStatus(status) {
|
|
23
|
+
if (!status?.source)
|
|
24
|
+
return undefined;
|
|
25
|
+
if (status.source === "stored")
|
|
26
|
+
return "✓ configured";
|
|
27
|
+
if (status.source === "environment" && status.label)
|
|
28
|
+
return `✓ env: ${status.label}`;
|
|
29
|
+
if (status.source === "runtime" && status.label)
|
|
30
|
+
return `✓ ${status.label}`;
|
|
31
|
+
if (status.source === "models_json_command")
|
|
32
|
+
return "✓ command in models.json";
|
|
33
|
+
if (status.source === "models_json_key")
|
|
34
|
+
return "✓ key in models.json";
|
|
35
|
+
if (status.source === "fallback")
|
|
36
|
+
return "✓ configured";
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
export function buildLoginProviderOptions(host) {
|
|
40
|
+
const modelRegistry = host.session.modelRegistry;
|
|
41
|
+
const oauthProviders = modelRegistry.authStorage
|
|
42
|
+
.getOAuthProviders()
|
|
43
|
+
.filter((provider) => isBrowserOAuthProviderAllowed(provider.id));
|
|
44
|
+
const oauthProviderIds = new Set(oauthProviders.map((provider) => provider.id));
|
|
45
|
+
const modelProviderIds = Array.from(new Set(modelRegistry.getAll().map((model) => model.provider))).sort();
|
|
46
|
+
const externalCliProviders = modelProviderIds
|
|
47
|
+
.filter((providerId) => modelRegistry.getProviderAuthMode(providerId) === "externalCli")
|
|
48
|
+
.map((providerId) => ({
|
|
49
|
+
id: providerId,
|
|
50
|
+
name: modelRegistry.getProviderDisplayName(providerId),
|
|
51
|
+
authType: "external_cli",
|
|
52
|
+
statusLabel: modelRegistry.isProviderRequestReady(providerId) ? "✓ ready" : undefined,
|
|
53
|
+
}));
|
|
54
|
+
const apiKeyProviders = modelProviderIds
|
|
55
|
+
.filter((providerId) => modelRegistry.getProviderAuthMode(providerId) === "apiKey")
|
|
56
|
+
.filter((providerId) => !oauthProviderIds.has(providerId))
|
|
57
|
+
.map((providerId) => ({
|
|
58
|
+
id: providerId,
|
|
59
|
+
name: modelRegistry.getProviderDisplayName(providerId),
|
|
60
|
+
authType: "api_key",
|
|
61
|
+
statusLabel: formatAuthStatus(modelRegistry.getProviderAuthStatus(providerId)),
|
|
62
|
+
}));
|
|
63
|
+
const browserOAuthProviders = oauthProviders.map((provider) => ({
|
|
64
|
+
...provider,
|
|
65
|
+
authType: "oauth",
|
|
66
|
+
statusLabel: formatAuthStatus(modelRegistry.getProviderAuthStatus(provider.id)),
|
|
67
|
+
}));
|
|
68
|
+
return uniqueProviders([
|
|
69
|
+
...externalCliProviders,
|
|
70
|
+
...apiKeyProviders,
|
|
71
|
+
...browserOAuthProviders,
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
7
74
|
export async function showOAuthSelector(host, mode) {
|
|
75
|
+
const loginProviders = mode === "login" ? buildLoginProviderOptions(host) : undefined;
|
|
8
76
|
if (mode === "logout") {
|
|
9
77
|
const providers = host.session.modelRegistry.authStorage.list();
|
|
10
78
|
const loggedInProviders = providers.filter((p) => host.session.modelRegistry.authStorage.get(p)?.type === "oauth");
|
|
@@ -18,7 +86,7 @@ export async function showOAuthSelector(host, mode) {
|
|
|
18
86
|
done();
|
|
19
87
|
const handleAsync = async () => {
|
|
20
88
|
if (mode === "login") {
|
|
21
|
-
await host
|
|
89
|
+
await handleLoginProviderSelection(host, providerId);
|
|
22
90
|
}
|
|
23
91
|
else {
|
|
24
92
|
const providerInfo = host.session.modelRegistry.authStorage
|
|
@@ -55,11 +123,85 @@ export async function showOAuthSelector(host, mode) {
|
|
|
55
123
|
}, () => {
|
|
56
124
|
done();
|
|
57
125
|
host.ui.requestRender();
|
|
58
|
-
});
|
|
126
|
+
}, loginProviders);
|
|
59
127
|
return { component: selector, focus: selector };
|
|
60
128
|
});
|
|
61
129
|
}
|
|
130
|
+
export async function handleLoginProviderSelection(host, providerId) {
|
|
131
|
+
const modelRegistry = host.session.modelRegistry;
|
|
132
|
+
const authMode = modelRegistry.getProviderAuthMode(providerId);
|
|
133
|
+
if (authMode === "externalCli") {
|
|
134
|
+
await activateExternalCliProvider(host, providerId);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const oauthProvider = modelRegistry.authStorage.getOAuthProviders().find((provider) => provider.id === providerId);
|
|
138
|
+
if (oauthProvider && isBrowserOAuthProviderAllowed(providerId)) {
|
|
139
|
+
await host.showLoginDialog(providerId);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
await showApiKeyLoginDialog(host, providerId);
|
|
143
|
+
}
|
|
144
|
+
async function activateExternalCliProvider(host, providerId) {
|
|
145
|
+
const modelRegistry = host.session.modelRegistry;
|
|
146
|
+
const providerName = modelRegistry.getProviderDisplayName(providerId);
|
|
147
|
+
if (!modelRegistry.isProviderRequestReady(providerId)) {
|
|
148
|
+
host.showError(`${providerName} is not ready. Run the provider's own login command, then try /login again.`);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
modelRegistry.authStorage.set(providerId, { type: "api_key", key: "cli" });
|
|
152
|
+
modelRegistry.refresh();
|
|
153
|
+
await host.updateAvailableProviderCount();
|
|
154
|
+
const targetModel = modelRegistry.getAvailable().find((model) => model.provider === providerId);
|
|
155
|
+
if (targetModel) {
|
|
156
|
+
await host.session.setModel(targetModel);
|
|
157
|
+
host.showStatus(`Using ${providerName}: ${providerId}/${targetModel.id}`);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
host.showStatus(`${providerName} is ready. Use /model to choose a model.`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
async function showApiKeyLoginDialog(host, providerId) {
|
|
164
|
+
const providerName = host.session.modelRegistry.getProviderDisplayName(providerId);
|
|
165
|
+
const dialog = new LoginDialogComponent(host.ui, providerId, (_success, _message) => { }, providerName);
|
|
166
|
+
host.editorContainer.clear();
|
|
167
|
+
host.editorContainer.addChild(dialog);
|
|
168
|
+
host.ui.setFocus(dialog);
|
|
169
|
+
host.ui.requestRender();
|
|
170
|
+
const restoreEditor = () => {
|
|
171
|
+
dialog.dispose();
|
|
172
|
+
host.editorContainer.clear();
|
|
173
|
+
host.editorContainer.addChild(host.editor);
|
|
174
|
+
host.ui.setFocus(host.editor);
|
|
175
|
+
host.ui.requestRender();
|
|
176
|
+
};
|
|
177
|
+
try {
|
|
178
|
+
const apiKey = (await dialog.showPrompt(`Paste your ${providerName} API key:`)).trim();
|
|
179
|
+
if (!apiKey) {
|
|
180
|
+
throw new Error("API key is required");
|
|
181
|
+
}
|
|
182
|
+
host.session.modelRegistry.authStorage.set(providerId, { type: "api_key", key: apiKey });
|
|
183
|
+
restoreEditor();
|
|
184
|
+
host.session.modelRegistry.refresh();
|
|
185
|
+
await host.updateAvailableProviderCount();
|
|
186
|
+
const targetModel = host.session.modelRegistry.getAvailable().find((model) => model.provider === providerId);
|
|
187
|
+
if (targetModel) {
|
|
188
|
+
await host.session.setModel(targetModel);
|
|
189
|
+
}
|
|
190
|
+
host.showStatus(`Saved ${providerName} API key to ${getAuthPath()}`);
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
restoreEditor();
|
|
194
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
195
|
+
if (errorMsg !== "Login cancelled" && !errorMsg.includes("Superseded") && !errorMsg.includes("disposed")) {
|
|
196
|
+
host.showError(`Failed to save ${providerName} API key: ${errorMsg}`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
62
200
|
export async function showLoginDialog(host, providerId) {
|
|
201
|
+
if (!isBrowserOAuthProviderAllowed(providerId)) {
|
|
202
|
+
await showApiKeyLoginDialog(host, providerId);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
63
205
|
const providerInfo = host.session.modelRegistry.authStorage.getOAuthProviders().find((p) => p.id === providerId);
|
|
64
206
|
const providerName = providerInfo?.name || providerId;
|
|
65
207
|
const usesCallbackServer = providerInfo?.usesCallbackServer ?? false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-selectors-auth.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-selectors-auth.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,6FAA6F;AAC7F,cAAc;AAGd,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAGxE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAiC,EAAE,IAAwB;IAClG,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAChE,MAAM,iBAAiB,GAAG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,gBAAgB,EAAE,CAAC;wBACtB,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;oBAC/C,CAAC;yBAAM,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBACjC,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC3C,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;QAAC,MAAM,CAAC;YACR,4DAA4D;QAC7D,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,gBAAgB,YAAY,0BAA0B,WAAW,EAAE,EAAE,CAAC,CAAC;IACxF,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACzB,aAAa,EAAE,CAAC;QAChB,MAAM,QAAQ,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACxE,IAAI,QAAQ,KAAK,iBAAiB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1G,IAAI,CAAC,SAAS,CAAC,sBAAsB,YAAY,KAAK,QAAQ,EAAE,CAAC,CAAC;QACnE,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["// Project/App: gsd-pi\n// File Purpose: Extracted from interactive-selectors-session.ts (Phase E2 seam remediation).\n// @ts-nocheck\n\nimport type { OAuthProviderId } from \"@gsd/pi-ai\";\nimport { getAuthPath } from \"@gsd/pi-coding-agent/config.js\";\nimport { LoginDialogComponent } from \"./components/login-dialog.js\";\nimport { OAuthSelectorComponent } from \"./components/oauth-selector.js\";\nimport type { InteractiveModeDelegateHost } from \"./interactive-mode-delegate-host.js\";\n\nexport async function showOAuthSelector(host: InteractiveModeDelegateHost, mode: \"login\" | \"logout\"): Promise<void> {\n\tif (mode === \"logout\") {\n\t\tconst providers = host.session.modelRegistry.authStorage.list();\n\t\tconst loggedInProviders = providers.filter(\n\t\t\t(p) => host.session.modelRegistry.authStorage.get(p)?.type === \"oauth\",\n\t\t);\n\t\tif (loggedInProviders.length === 0) {\n\t\t\thost.showStatus(\"No OAuth providers logged in. Use /login first.\");\n\t\t\treturn;\n\t\t}\n\t}\n\n\thost.showSelector((done) => {\n\t\tconst selector = new OAuthSelectorComponent(\n\t\t\tmode,\n\t\t\thost.session.modelRegistry.authStorage,\n\t\t\t(providerId: string) => {\n\t\t\t\tdone();\n\n\t\t\t\tconst handleAsync = async () => {\n\t\t\t\t\tif (mode === \"login\") {\n\t\t\t\t\t\tawait host.showLoginDialog(providerId);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst providerInfo = host.session.modelRegistry.authStorage\n\t\t\t\t\t\t\t.getOAuthProviders()\n\t\t\t\t\t\t\t.find((p) => p.id === providerId);\n\t\t\t\t\t\tconst providerName = providerInfo?.name || providerId;\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\thost.session.modelRegistry.authStorage.logout(providerId);\n\t\t\t\t\t\t\thost.session.modelRegistry.refresh();\n\t\t\t\t\t\t\tawait host.updateAvailableProviderCount();\n\n\t\t\t\t\t\t\tconst currentModel = host.session.model;\n\t\t\t\t\t\t\tif (currentModel?.provider === providerId) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tconst available = host.session.modelRegistry.getAvailable();\n\t\t\t\t\t\t\t\t\tconst fallback = available.find((m) => m.provider !== providerId);\n\t\t\t\t\t\t\t\t\tif (fallback) {\n\t\t\t\t\t\t\t\t\t\tawait host.session.setModel(fallback);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\t// Model switch failed — user can manually switch via /model\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\thost.showStatus(`Logged out of ${providerName}`);\n\t\t\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\t\t\thost.showError(`Logout failed: ${error instanceof Error ? error.message : String(error)}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\thandleAsync().catch(() => {\n\t\t\t\t\t// Swallow — showLoginDialog already handles its own errors.\n\t\t\t\t});\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\thost.ui.requestRender();\n\t\t\t},\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n}\n\nexport async function showLoginDialog(host: InteractiveModeDelegateHost, providerId: string): Promise<void> {\n\tconst providerInfo = host.session.modelRegistry.authStorage.getOAuthProviders().find((p) => p.id === providerId);\n\tconst providerName = providerInfo?.name || providerId;\n\tconst usesCallbackServer = providerInfo?.usesCallbackServer ?? false;\n\n\tconst dialog = new LoginDialogComponent(host.ui, providerId, (_success, _message) => {});\n\n\thost.editorContainer.clear();\n\thost.editorContainer.addChild(dialog);\n\thost.ui.setFocus(dialog);\n\thost.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\tdialog.dispose();\n\t\thost.editorContainer.clear();\n\t\thost.editorContainer.addChild(host.editor);\n\t\thost.ui.setFocus(host.editor);\n\t\thost.ui.requestRender();\n\t};\n\n\ttry {\n\t\tawait host.session.modelRegistry.authStorage.login(providerId as OAuthProviderId, {\n\t\t\tonAuth: (info: { url: string; instructions?: string }) => {\n\t\t\t\tdialog.showAuth(info.url, info.instructions);\n\n\t\t\t\tif (!usesCallbackServer && providerId === \"github-copilot\") {\n\t\t\t\t\tdialog.showWaiting(\"Waiting for browser authentication...\");\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tonPrompt: async (prompt: { message: string; placeholder?: string }) => {\n\t\t\t\treturn dialog.showPrompt(prompt.message, prompt.placeholder);\n\t\t\t},\n\n\t\t\tonProgress: (message: string) => {\n\t\t\t\tdialog.showProgress(message);\n\t\t\t},\n\n\t\t\tonManualCodeInput: usesCallbackServer\n\t\t\t\t? () => dialog.showManualInput(\"Paste redirect URL below, or complete login in browser:\")\n\t\t\t\t: undefined,\n\n\t\t\tonDeviceCode: async () => \"\",\n\t\t\tonSelect: async (prompt) => prompt.options[0]?.id,\n\n\t\t\tsignal: dialog.signal,\n\t\t});\n\n\t\trestoreEditor();\n\t\thost.session.modelRegistry.refresh();\n\t\tawait host.updateAvailableProviderCount();\n\n\t\ttry {\n\t\t\tconst currentModel = host.session.model;\n\t\t\tif (currentModel) {\n\t\t\t\tconst currentKey = await host.session.modelRegistry.getApiKey(currentModel);\n\t\t\t\tif (!currentKey) {\n\t\t\t\t\tconst available = host.session.modelRegistry.getAvailable();\n\t\t\t\t\tconst newProviderModel = available.find((m) => m.provider === providerId);\n\t\t\t\t\tif (newProviderModel) {\n\t\t\t\t\t\tawait host.session.setModel(newProviderModel);\n\t\t\t\t\t} else if (available.length > 0) {\n\t\t\t\t\t\tawait host.session.setModel(available[0]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Model switch failed — user can manually switch via /model\n\t\t}\n\n\t\thost.showStatus(`Logged in to ${providerName}. Credentials saved to ${getAuthPath()}`);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (errorMsg !== \"Login cancelled\" && !errorMsg.includes(\"Superseded\") && !errorMsg.includes(\"disposed\")) {\n\t\t\thost.showError(`Failed to login to ${providerName}: ${errorMsg}`);\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-selectors-auth.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-selectors-auth.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,6FAA6F;AAC7F,cAAc;AAGd,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAA6B,sBAAsB,EAAE,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E,CAAC,CAAC,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC;oBAC1E,IAAI,gBAAgB,EAAE,CAAC;wBACtB,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;oBAC/C,CAAC;yBAAM,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBACjC,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC3C,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;QAAC,MAAM,CAAC;YACR,4DAA4D;QAC7D,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,gBAAgB,YAAY,0BAA0B,WAAW,EAAE,EAAE,CAAC,CAAC;IACxF,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACzB,aAAa,EAAE,CAAC;QAChB,MAAM,QAAQ,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACxE,IAAI,QAAQ,KAAK,iBAAiB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1G,IAAI,CAAC,SAAS,CAAC,sBAAsB,YAAY,KAAK,QAAQ,EAAE,CAAC,CAAC;QACnE,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["// Project/App: gsd-pi\n// File Purpose: Extracted from interactive-selectors-session.ts (Phase E2 seam remediation).\n// @ts-nocheck\n\nimport type { OAuthProviderId } from \"@gsd/pi-ai\";\nimport { getAuthPath } from \"@gsd/pi-coding-agent/config.js\";\nimport { LoginDialogComponent } from \"./components/login-dialog.js\";\nimport { type AuthSelectorProvider, OAuthSelectorComponent } from \"./components/oauth-selector.js\";\nimport type { InteractiveModeDelegateHost } from \"./interactive-mode-delegate-host.js\";\n\nconst BLOCKED_BROWSER_OAUTH_PROVIDERS = new Set([\"anthropic\"]);\n\nfunction isBrowserOAuthProviderAllowed(providerId: string): boolean {\n\treturn !BLOCKED_BROWSER_OAUTH_PROVIDERS.has(providerId);\n}\n\nfunction uniqueProviders(providers: AuthSelectorProvider[]): AuthSelectorProvider[] {\n\tconst seen = new Set<string>();\n\tconst unique: AuthSelectorProvider[] = [];\n\tfor (const provider of providers) {\n\t\tif (seen.has(provider.id)) continue;\n\t\tseen.add(provider.id);\n\t\tunique.push(provider);\n\t}\n\treturn unique;\n}\n\nfunction formatAuthStatus(status: { source?: string; label?: string } | undefined): string | undefined {\n\tif (!status?.source) return undefined;\n\tif (status.source === \"stored\") return \"✓ configured\";\n\tif (status.source === \"environment\" && status.label) return `✓ env: ${status.label}`;\n\tif (status.source === \"runtime\" && status.label) return `✓ ${status.label}`;\n\tif (status.source === \"models_json_command\") return \"✓ command in models.json\";\n\tif (status.source === \"models_json_key\") return \"✓ key in models.json\";\n\tif (status.source === \"fallback\") return \"✓ configured\";\n\treturn undefined;\n}\n\nexport function buildLoginProviderOptions(host: InteractiveModeDelegateHost): AuthSelectorProvider[] {\n\tconst modelRegistry = host.session.modelRegistry;\n\tconst oauthProviders = modelRegistry.authStorage\n\t\t.getOAuthProviders()\n\t\t.filter((provider) => isBrowserOAuthProviderAllowed(provider.id));\n\tconst oauthProviderIds = new Set(oauthProviders.map((provider) => provider.id));\n\tconst modelProviderIds = Array.from(new Set(modelRegistry.getAll().map((model) => model.provider))).sort();\n\n\tconst externalCliProviders = modelProviderIds\n\t\t.filter((providerId) => modelRegistry.getProviderAuthMode(providerId) === \"externalCli\")\n\t\t.map((providerId) => ({\n\t\t\tid: providerId,\n\t\t\tname: modelRegistry.getProviderDisplayName(providerId),\n\t\t\tauthType: \"external_cli\" as const,\n\t\t\tstatusLabel: modelRegistry.isProviderRequestReady(providerId) ? \"✓ ready\" : undefined,\n\t\t}));\n\n\tconst apiKeyProviders = modelProviderIds\n\t\t.filter((providerId) => modelRegistry.getProviderAuthMode(providerId) === \"apiKey\")\n\t\t.filter((providerId) => !oauthProviderIds.has(providerId))\n\t\t.map((providerId) => ({\n\t\t\tid: providerId,\n\t\t\tname: modelRegistry.getProviderDisplayName(providerId),\n\t\t\tauthType: \"api_key\" as const,\n\t\t\tstatusLabel: formatAuthStatus(modelRegistry.getProviderAuthStatus(providerId)),\n\t\t}));\n\n\tconst browserOAuthProviders = oauthProviders.map((provider) => ({\n\t\t...provider,\n\t\tauthType: \"oauth\" as const,\n\t\tstatusLabel: formatAuthStatus(modelRegistry.getProviderAuthStatus(provider.id)),\n\t}));\n\n\treturn uniqueProviders([\n\t\t...externalCliProviders,\n\t\t...apiKeyProviders,\n\t\t...browserOAuthProviders,\n\t]);\n}\n\nexport async function showOAuthSelector(host: InteractiveModeDelegateHost, mode: \"login\" | \"logout\"): Promise<void> {\n\tconst loginProviders = mode === \"login\" ? buildLoginProviderOptions(host) : undefined;\n\n\tif (mode === \"logout\") {\n\t\tconst providers = host.session.modelRegistry.authStorage.list();\n\t\tconst loggedInProviders = providers.filter(\n\t\t\t(p) => host.session.modelRegistry.authStorage.get(p)?.type === \"oauth\",\n\t\t);\n\t\tif (loggedInProviders.length === 0) {\n\t\t\thost.showStatus(\"No OAuth providers logged in. Use /login first.\");\n\t\t\treturn;\n\t\t}\n\t}\n\n\thost.showSelector((done) => {\n\t\tconst selector = new OAuthSelectorComponent(\n\t\t\tmode,\n\t\t\thost.session.modelRegistry.authStorage,\n\t\t\t(providerId: string) => {\n\t\t\t\tdone();\n\n\t\t\t\tconst handleAsync = async () => {\n\t\t\t\t\tif (mode === \"login\") {\n\t\t\t\t\t\tawait handleLoginProviderSelection(host, providerId);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst providerInfo = host.session.modelRegistry.authStorage\n\t\t\t\t\t\t\t.getOAuthProviders()\n\t\t\t\t\t\t\t.find((p) => p.id === providerId);\n\t\t\t\t\t\tconst providerName = providerInfo?.name || providerId;\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\thost.session.modelRegistry.authStorage.logout(providerId);\n\t\t\t\t\t\t\thost.session.modelRegistry.refresh();\n\t\t\t\t\t\t\tawait host.updateAvailableProviderCount();\n\n\t\t\t\t\t\t\tconst currentModel = host.session.model;\n\t\t\t\t\t\t\tif (currentModel?.provider === providerId) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tconst available = host.session.modelRegistry.getAvailable();\n\t\t\t\t\t\t\t\t\tconst fallback = available.find((m) => m.provider !== providerId);\n\t\t\t\t\t\t\t\t\tif (fallback) {\n\t\t\t\t\t\t\t\t\t\tawait host.session.setModel(fallback);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\t// Model switch failed — user can manually switch via /model\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\thost.showStatus(`Logged out of ${providerName}`);\n\t\t\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\t\t\thost.showError(`Logout failed: ${error instanceof Error ? error.message : String(error)}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\thandleAsync().catch(() => {\n\t\t\t\t\t// Swallow — showLoginDialog already handles its own errors.\n\t\t\t\t});\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\thost.ui.requestRender();\n\t\t\t},\n\t\t\tloginProviders,\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n}\n\nexport async function handleLoginProviderSelection(host: InteractiveModeDelegateHost, providerId: string): Promise<void> {\n\tconst modelRegistry = host.session.modelRegistry;\n\tconst authMode = modelRegistry.getProviderAuthMode(providerId);\n\n\tif (authMode === \"externalCli\") {\n\t\tawait activateExternalCliProvider(host, providerId);\n\t\treturn;\n\t}\n\n\tconst oauthProvider = modelRegistry.authStorage.getOAuthProviders().find((provider) => provider.id === providerId);\n\tif (oauthProvider && isBrowserOAuthProviderAllowed(providerId)) {\n\t\tawait host.showLoginDialog(providerId);\n\t\treturn;\n\t}\n\n\tawait showApiKeyLoginDialog(host, providerId);\n}\n\nasync function activateExternalCliProvider(host: InteractiveModeDelegateHost, providerId: string): Promise<void> {\n\tconst modelRegistry = host.session.modelRegistry;\n\tconst providerName = modelRegistry.getProviderDisplayName(providerId);\n\n\tif (!modelRegistry.isProviderRequestReady(providerId)) {\n\t\thost.showError(`${providerName} is not ready. Run the provider's own login command, then try /login again.`);\n\t\treturn;\n\t}\n\n\tmodelRegistry.authStorage.set(providerId, { type: \"api_key\", key: \"cli\" });\n\tmodelRegistry.refresh();\n\tawait host.updateAvailableProviderCount();\n\n\tconst targetModel = modelRegistry.getAvailable().find((model) => model.provider === providerId);\n\tif (targetModel) {\n\t\tawait host.session.setModel(targetModel);\n\t\thost.showStatus(`Using ${providerName}: ${providerId}/${targetModel.id}`);\n\t} else {\n\t\thost.showStatus(`${providerName} is ready. Use /model to choose a model.`);\n\t}\n}\n\nasync function showApiKeyLoginDialog(host: InteractiveModeDelegateHost, providerId: string): Promise<void> {\n\tconst providerName = host.session.modelRegistry.getProviderDisplayName(providerId);\n\tconst dialog = new LoginDialogComponent(host.ui, providerId, (_success, _message) => {}, providerName);\n\n\thost.editorContainer.clear();\n\thost.editorContainer.addChild(dialog);\n\thost.ui.setFocus(dialog);\n\thost.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\tdialog.dispose();\n\t\thost.editorContainer.clear();\n\t\thost.editorContainer.addChild(host.editor);\n\t\thost.ui.setFocus(host.editor);\n\t\thost.ui.requestRender();\n\t};\n\n\ttry {\n\t\tconst apiKey = (await dialog.showPrompt(`Paste your ${providerName} API key:`)).trim();\n\t\tif (!apiKey) {\n\t\t\tthrow new Error(\"API key is required\");\n\t\t}\n\n\t\thost.session.modelRegistry.authStorage.set(providerId, { type: \"api_key\", key: apiKey });\n\t\trestoreEditor();\n\t\thost.session.modelRegistry.refresh();\n\t\tawait host.updateAvailableProviderCount();\n\n\t\tconst targetModel = host.session.modelRegistry.getAvailable().find((model) => model.provider === providerId);\n\t\tif (targetModel) {\n\t\t\tawait host.session.setModel(targetModel);\n\t\t}\n\n\t\thost.showStatus(`Saved ${providerName} API key to ${getAuthPath()}`);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (errorMsg !== \"Login cancelled\" && !errorMsg.includes(\"Superseded\") && !errorMsg.includes(\"disposed\")) {\n\t\t\thost.showError(`Failed to save ${providerName} API key: ${errorMsg}`);\n\t\t}\n\t}\n}\n\nexport async function showLoginDialog(host: InteractiveModeDelegateHost, providerId: string): Promise<void> {\n\tif (!isBrowserOAuthProviderAllowed(providerId)) {\n\t\tawait showApiKeyLoginDialog(host, providerId);\n\t\treturn;\n\t}\n\n\tconst providerInfo = host.session.modelRegistry.authStorage.getOAuthProviders().find((p) => p.id === providerId);\n\tconst providerName = providerInfo?.name || providerId;\n\tconst usesCallbackServer = providerInfo?.usesCallbackServer ?? false;\n\n\tconst dialog = new LoginDialogComponent(host.ui, providerId, (_success, _message) => {});\n\n\thost.editorContainer.clear();\n\thost.editorContainer.addChild(dialog);\n\thost.ui.setFocus(dialog);\n\thost.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\tdialog.dispose();\n\t\thost.editorContainer.clear();\n\t\thost.editorContainer.addChild(host.editor);\n\t\thost.ui.setFocus(host.editor);\n\t\thost.ui.requestRender();\n\t};\n\n\ttry {\n\t\tawait host.session.modelRegistry.authStorage.login(providerId as OAuthProviderId, {\n\t\t\tonAuth: (info: { url: string; instructions?: string }) => {\n\t\t\t\tdialog.showAuth(info.url, info.instructions);\n\n\t\t\t\tif (!usesCallbackServer && providerId === \"github-copilot\") {\n\t\t\t\t\tdialog.showWaiting(\"Waiting for browser authentication...\");\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tonPrompt: async (prompt: { message: string; placeholder?: string }) => {\n\t\t\t\treturn dialog.showPrompt(prompt.message, prompt.placeholder);\n\t\t\t},\n\n\t\t\tonProgress: (message: string) => {\n\t\t\t\tdialog.showProgress(message);\n\t\t\t},\n\n\t\t\tonManualCodeInput: usesCallbackServer\n\t\t\t\t? () => dialog.showManualInput(\"Paste redirect URL below, or complete login in browser:\")\n\t\t\t\t: undefined,\n\n\t\t\tonDeviceCode: async () => \"\",\n\t\t\tonSelect: async (prompt) => prompt.options[0]?.id,\n\n\t\t\tsignal: dialog.signal,\n\t\t});\n\n\t\trestoreEditor();\n\t\thost.session.modelRegistry.refresh();\n\t\tawait host.updateAvailableProviderCount();\n\n\t\ttry {\n\t\t\tconst currentModel = host.session.model;\n\t\t\tif (currentModel) {\n\t\t\t\tconst currentKey = await host.session.modelRegistry.getApiKey(currentModel);\n\t\t\t\tif (!currentKey) {\n\t\t\t\t\tconst available = host.session.modelRegistry.getAvailable();\n\t\t\t\t\tconst newProviderModel = available.find((m) => m.provider === providerId);\n\t\t\t\t\tif (newProviderModel) {\n\t\t\t\t\t\tawait host.session.setModel(newProviderModel);\n\t\t\t\t\t} else if (available.length > 0) {\n\t\t\t\t\t\tawait host.session.setModel(available[0]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Model switch failed — user can manually switch via /model\n\t\t}\n\n\t\thost.showStatus(`Logged in to ${providerName}. Credentials saved to ${getAuthPath()}`);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (errorMsg !== \"Login cancelled\" && !errorMsg.includes(\"Superseded\") && !errorMsg.includes(\"disposed\")) {\n\t\t\thost.showError(`Failed to login to ${providerName}: ${errorMsg}`);\n\t\t}\n\t}\n}\n"]}
|
package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-session.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-selectors-session.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-selectors-session.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interactive-selectors-session.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-selectors-session.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAEvF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,2BAA2B,GAAG,IAAI,CAiC9E;AAEF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,2BAA2B,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CA8HnG;AAEF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,2BAA2B,GAAG,IAAI,CAiC1E;AAEF,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,2BAA2B,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4B9G;AAEF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,2BAA2B,GAAG,IAAI,CAiC1E"}
|
|
@@ -9,6 +9,7 @@ import { ProviderManagerComponent } from "./components/provider-manager.js";
|
|
|
9
9
|
import { SessionSelectorComponent } from "./components/session-selector.js";
|
|
10
10
|
import { TreeSelectorComponent } from "./components/tree-selector.js";
|
|
11
11
|
import { UserMessageSelectorComponent } from "./components/user-message-selector.js";
|
|
12
|
+
import { handleLoginProviderSelection } from "./interactive-selectors-auth.js";
|
|
12
13
|
export function showUserMessageSelector(host) {
|
|
13
14
|
const userMessages = host.session.getUserMessagesForForking();
|
|
14
15
|
if (userMessages.length === 0) {
|
|
@@ -210,21 +211,8 @@ export function showProviderManager(host) {
|
|
|
210
211
|
done();
|
|
211
212
|
host.ui.requestRender();
|
|
212
213
|
}, async (provider) => {
|
|
213
|
-
// Enter key → auth setup for selected provider (#3579).
|
|
214
|
-
// Only OAuth providers support the login dialog flow.
|
|
215
|
-
// externalCli providers (e.g. claude-code) authenticate through
|
|
216
|
-
// their own CLI — sending them to the OAuth dialog produces
|
|
217
|
-
// "Unknown OAuth provider: claude-code" (#4548).
|
|
218
|
-
const isOAuthProvider = host.session.modelRegistry.authStorage
|
|
219
|
-
.getOAuthProviders()
|
|
220
|
-
.some((p) => p.id === provider);
|
|
221
|
-
if (!isOAuthProvider) {
|
|
222
|
-
done();
|
|
223
|
-
host.showStatus(`${provider} uses external CLI auth — use /model to select a model or run the provider's own auth command.`);
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
214
|
done();
|
|
227
|
-
await host
|
|
215
|
+
await handleLoginProviderSelection(host, provider);
|
|
228
216
|
});
|
|
229
217
|
return { component, focus: component };
|
|
230
218
|
});
|
package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-session.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-selectors-session.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-selectors-session.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,gFAAgF;AAChF,cAAc;AAEd,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAI7C,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAC9E,OAAO,EAAqD,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC/G,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAE1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAG5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAUrF,MAAM,UAAU,uBAAuB,CAAC,IAAiC;IACvE,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,yBAAyB,EAAE,CAAC;IAE9D,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,IAAI,CAAC,UAAU,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AC,WAAW;iBAC5D,iBAAiB,EAAE;iBACnB,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;YACjC,IAAI,CAAC,eAAe,EAAE,CAAC;gBACtB,IAAI,EAAE,CAAC;gBACP,IAAI,CAAC,UAAU,CAAC,GAAG,QAAQ,gGAAgG,CAAC,CAAC;gBAC7H,OAAO;YACR,CAAC;YACD,IAAI,EAAE,CAAC;YACP,MAAM,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QACtC,CAAC,CACD,CAAC;QACF,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IACxC,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Project/App: gsd-pi\n// File Purpose: Extracted from interactive-mode.ts (Phase E2 seam remediation).\n// @ts-nocheck\n\nimport { Loader, Spacer } from \"@gsd/pi-tui\";\nimport type { Component } from \"@gsd/pi-tui\";\nimport type { Model } from \"@gsd/pi-ai\";\nimport { resolveModelScope } from \"@gsd/pi-coding-agent/core/model-resolver.js\";\nimport { SessionManager } from \"@gsd/pi-coding-agent/core/session-manager.js\";\nimport { getAvailableThemes, setRegisteredThemes, setTheme, theme } from \"@gsd/pi-coding-agent/theme/theme.js\";\nimport { appKey } from \"./components/keybinding-hints.js\";\nimport { ModelSelectorComponent } from \"./components/model-selector.js\";\nimport { ProviderManagerComponent } from \"./components/provider-manager.js\";\nimport { ScopedModelsSelectorComponent } from \"./components/scoped-models-selector.js\";\nimport { SessionSelectorComponent } from \"./components/session-selector.js\";\nimport { SettingsSelectorComponent } from \"./components/settings-selector.js\";\nimport { ToolExecutionComponent } from \"./components/tool-execution.js\";\nimport { TreeSelectorComponent } from \"./components/tree-selector.js\";\nimport { UserMessageSelectorComponent } from \"./components/user-message-selector.js\";\nimport { AssistantMessageComponent } from \"./components/assistant-message.js\";\nimport {\n findExactModelMatch as findExactModelMatchController,\n getModelCandidates as getModelCandidatesController,\n handleModelCommand as handleModelCommandController,\n updateAvailableProviderCount as updateAvailableProviderCountController,\n} from \"./controllers/model-controller.js\";\nimport type { InteractiveModeDelegateHost } from \"./interactive-mode-delegate-host.js\";\n\nexport function showUserMessageSelector(host: InteractiveModeDelegateHost): void {\n\t\tconst userMessages = host.session.getUserMessagesForForking();\n\n\t\tif (userMessages.length === 0) {\n\t\t\thost.showStatus(\"No messages to fork from\");\n\t\t\treturn;\n\t\t}\n\n\t\thost.showSelector((done) => {\n\t\t\tconst selector = new UserMessageSelectorComponent(\n\t\t\t\tuserMessages.map((m) => ({ id: m.entryId, text: m.text })),\n\t\t\t\tasync (entryId) => {\n\t\t\t\t\tconst result = await host.session.fork(entryId);\n\t\t\t\t\tif (result.cancelled) {\n\t\t\t\t\t\t// Extension cancelled the fork\n\t\t\t\t\t\tdone();\n\t\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\thost.chatContainer.clear();\n\t\t\t\t\thost.renderInitialMessages();\n\t\t\t\t\thost.editor.setText(result.selectedText);\n\t\t\t\t\tdone();\n\t\t\t\t\thost.showStatus(\"Branched to new session\");\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tdone();\n\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn { component: selector, focus: selector.getMessageList() };\n\t\t});\n\t}\n\nexport function showTreeSelector(host: InteractiveModeDelegateHost, initialSelectedId?: string): void {\n\t\tconst tree = host.sessionManager.getTree();\n\t\tconst realLeafId = host.sessionManager.getLeafId();\n\t\tconst initialFilterMode = host.settingsManager.getTreeFilterMode();\n\n\t\tif (tree.length === 0) {\n\t\t\thost.showStatus(\"No entries in session\");\n\t\t\treturn;\n\t\t}\n\n\t\thost.showSelector((done) => {\n\t\t\tconst selector = new TreeSelectorComponent(\n\t\t\t\ttree,\n\t\t\t\trealLeafId,\n\t\t\t\thost.ui.terminal.rows,\n\t\t\t\tasync (entryId) => {\n\t\t\t\t\t// Selecting the current leaf is a no-op (already there)\n\t\t\t\t\tif (entryId === realLeafId) {\n\t\t\t\t\t\tdone();\n\t\t\t\t\t\thost.showStatus(\"Already at host point\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Ask about summarization\n\t\t\t\t\tdone(); // Close selector first\n\n\t\t\t\t\t// Loop until user makes a complete choice or cancels to tree\n\t\t\t\t\tlet wantsSummary = false;\n\t\t\t\t\tlet customInstructions: string | undefined;\n\n\t\t\t\t\t// Check if we should skip the prompt (user preference to always default to no summary)\n\t\t\t\t\tif (!host.settingsManager.getBranchSummarySkipPrompt()) {\n\t\t\t\t\t\twhile (true) {\n\t\t\t\t\t\t\tconst summaryChoice = await host.showExtensionSelector(\"Summarize branch?\", [\n\t\t\t\t\t\t\t\t\"No summary\",\n\t\t\t\t\t\t\t\t\"Summarize\",\n\t\t\t\t\t\t\t\t\"Summarize with custom prompt\",\n\t\t\t\t\t\t\t]);\n\n\t\t\t\t\t\t\tif (summaryChoice === undefined) {\n\t\t\t\t\t\t\t\t// User pressed escape - re-show tree selector with same selection\n\t\t\t\t\t\t\t\thost.showTreeSelector(entryId);\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\twantsSummary = summaryChoice !== \"No summary\";\n\n\t\t\t\t\t\t\tif (summaryChoice === \"Summarize with custom prompt\") {\n\t\t\t\t\t\t\t\tcustomInstructions = await host.showExtensionEditor(\"Custom summarization instructions\");\n\t\t\t\t\t\t\t\tif (customInstructions === undefined) {\n\t\t\t\t\t\t\t\t\t// User cancelled - loop back to summary selector\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// User made a complete choice\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Set up escape handler and loader if summarizing\n\t\t\t\t\tlet summaryLoader: Loader | undefined;\n\t\t\t\t\tconst originalOnEscape = host.defaultEditor.onEscape;\n\n\t\t\t\t\tif (wantsSummary) {\n\t\t\t\t\t\thost.defaultEditor.onEscape = () => {\n\t\t\t\t\t\t\thost.session.abortBranchSummary();\n\t\t\t\t\t\t};\n\t\t\t\t\t\thost.chatContainer.addChild(new Spacer(1));\n\t\t\t\t\t\tsummaryLoader = new Loader(\n\t\t\t\t\t\t\thost.ui,\n\t\t\t\t\t\t\t(spinner) => theme.fg(\"accent\", spinner),\n\t\t\t\t\t\t\t(text) => theme.fg(\"muted\", text),\n\t\t\t\t\t\t\t`Summarizing branch... (${appKey(host.keybindings, \"interrupt\")} to cancel)`,\n\t\t\t\t\t\t);\n\t\t\t\t\t\thost.statusContainer.addChild(summaryLoader);\n\t\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t\t}\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = await host.session.navigateTree(entryId, {\n\t\t\t\t\t\t\tsummarize: wantsSummary,\n\t\t\t\t\t\t\tcustomInstructions,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tif (result.aborted) {\n\t\t\t\t\t\t\t// Summarization aborted - re-show tree selector with same selection\n\t\t\t\t\t\t\thost.showStatus(\"Branch summarization cancelled\");\n\t\t\t\t\t\t\thost.showTreeSelector(entryId);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (result.cancelled) {\n\t\t\t\t\t\t\thost.showStatus(\"Navigation cancelled\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Update UI\n\t\t\t\t\t\thost.chatContainer.clear();\n\t\t\t\t\t\thost.renderInitialMessages();\n\t\t\t\t\t\tif (result.editorText && !host.editor.getText().trim()) {\n\t\t\t\t\t\t\thost.editor.setText(result.editorText);\n\t\t\t\t\t\t}\n\t\t\t\t\t\thost.showStatus(\"Navigated to selected point\");\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\thost.showError(error instanceof Error ? error.message : String(error));\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tif (summaryLoader) {\n\t\t\t\t\t\t\tsummaryLoader.stop();\n\t\t\t\t\t\t\thost.statusContainer.clear();\n\t\t\t\t\t\t}\n\t\t\t\t\t\thost.defaultEditor.onEscape = originalOnEscape;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tdone();\n\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t},\n\t\t\t\t(entryId, label) => {\n\t\t\t\t\thost.sessionManager.appendLabelChange(entryId, label);\n\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t},\n\t\t\t\tinitialSelectedId,\n\t\t\t\tinitialFilterMode,\n\t\t\t);\n\t\t\treturn { component: selector, focus: selector };\n\t\t});\n\t}\n\nexport function showSessionSelector(host: InteractiveModeDelegateHost): void {\n\t\thost.showSelector((done) => {\n\t\t\tconst selector = new SessionSelectorComponent(\n\t\t\t\t(onProgress) =>\n\t\t\t\t\tSessionManager.list(host.sessionManager.getCwd(), host.sessionManager.getSessionDir(), onProgress),\n\t\t\t\tSessionManager.listAll,\n\t\t\t\tasync (sessionPath) => {\n\t\t\t\t\tdone();\n\t\t\t\t\tawait host.handleResumeSession(sessionPath);\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tdone();\n\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tvoid host.shutdown();\n\t\t\t\t},\n\t\t\t\t() => host.ui.requestRender(),\n\t\t\t\t{\n\t\t\t\t\trenameSession: async (sessionFilePath: string, nextName: string | undefined) => {\n\t\t\t\t\t\tconst next = (nextName ?? \"\").trim();\n\t\t\t\t\t\tif (!next) return;\n\t\t\t\t\t\tconst mgr = SessionManager.open(sessionFilePath);\n\t\t\t\t\t\tmgr.appendSessionInfo(next);\n\t\t\t\t\t},\n\t\t\t\t\tshowRenameHint: true,\n\t\t\t\t\tkeybindings: host.keybindings,\n\t\t\t\t},\n\n\t\t\t\thost.sessionManager.getSessionFile(),\n\t\t\t);\n\t\t\treturn { component: selector, focus: selector };\n\t\t});\n\t}\n\nexport async function handleResumeSession(host: InteractiveModeDelegateHost, sessionPath: string): Promise<void> {\n\t\t// Stop loading animation\n\t\tif (host.loadingAnimation) {\n\t\t\thost.loadingAnimation.stop();\n\t\t\thost.loadingAnimation = undefined;\n\t\t}\n\t\thost.statusContainer.clear();\n\n\t\t// Clear UI state\n\t\thost.pendingMessagesContainer.clear();\n\t\thost.compactionQueuedMessages = [];\n\t\thost.streamingComponent = undefined;\n\t\thost.streamingMessage = undefined;\n\t\thost.pendingTools.clear();\n\t\thost.clearBlockingError();\n\n\t\t// Switch session via AgentSession (emits extension session events)\n\t\tawait host.session.switchSession(sessionPath);\n\n\t\t// Clear and re-render the chat\n\t\thost.chatContainer.clear();\n\t\thost.renderInitialMessages();\n\n\t\tif (host.session.sessionManager.wasInterrupted()) {\n\t\t\thost.showStatus(\"Resumed session (previous session ended unexpectedly — last action may be incomplete)\");\n\t\t} else {\n\t\t\thost.showStatus(\"Resumed session\");\n\t\t}\n\t}\n\nexport function showProviderManager(host: InteractiveModeDelegateHost): void {\n\t\thost.showSelector((done) => {\n\t\t\tconst component = new ProviderManagerComponent(\n\t\t\t\thost.ui,\n\t\t\t\thost.session.modelRegistry.authStorage,\n\t\t\t\thost.session.modelRegistry,\n\t\t\t\t() => {\n\t\t\t\t\tdone();\n\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t},\n\t\t\t\tasync (provider: string) => {\n\t\t\t\t\thost.showStatus(`Discovering models for ${provider}...`);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst results = await host.session.modelRegistry.discoverModels([provider]);\n\t\t\t\t\t\tconst result = results[0];\n\t\t\t\t\t\tif (result?.error) {\n\t\t\t\t\t\t\thost.showError(`Discovery failed: ${result.error}`);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\thost.showStatus(`Discovered ${result?.models.length ?? 0} models from ${provider}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\thost.showError(error instanceof Error ? error.message : String(error));\n\t\t\t\t\t}\n\t\t\t\t\tdone();\n\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t},\n\t\t\t\tasync (provider: string) => {\n\t\t\t\t\t// Enter key → auth setup for selected provider (#3579).\n\t\t\t\t\t// Only OAuth providers support the login dialog flow.\n\t\t\t\t\t// externalCli providers (e.g. claude-code) authenticate through\n\t\t\t\t\t// their own CLI — sending them to the OAuth dialog produces\n\t\t\t\t\t// \"Unknown OAuth provider: claude-code\" (#4548).\n\t\t\t\t\tconst isOAuthProvider = host.session.modelRegistry.authStorage\n\t\t\t\t\t\t.getOAuthProviders()\n\t\t\t\t\t\t.some((p) => p.id === provider);\n\t\t\t\t\tif (!isOAuthProvider) {\n\t\t\t\t\t\tdone();\n\t\t\t\t\t\thost.showStatus(`${provider} uses external CLI auth — use /model to select a model or run the provider's own auth command.`);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tdone();\n\t\t\t\t\tawait host.showLoginDialog(provider);\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn { component, focus: component };\n\t\t});\n\t}\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-selectors-session.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-selectors-session.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,gFAAgF;AAChF,cAAc;AAEd,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAI7C,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAC9E,OAAO,EAAqD,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC/G,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAE1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,EAAE,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AAC,SAAS,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACxE,CAAC;YACD,IAAI,EAAE,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;QACzB,CAAC,EACD,KAAK,EAAE,QAAgB,EAAE,EAAE;YAC1B,IAAI,EAAE,CAAC;YACP,MAAM,4BAA4B,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACpD,CAAC,CACD,CAAC;QACF,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IACxC,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Project/App: gsd-pi\n// File Purpose: Extracted from interactive-mode.ts (Phase E2 seam remediation).\n// @ts-nocheck\n\nimport { Loader, Spacer } from \"@gsd/pi-tui\";\nimport type { Component } from \"@gsd/pi-tui\";\nimport type { Model } from \"@gsd/pi-ai\";\nimport { resolveModelScope } from \"@gsd/pi-coding-agent/core/model-resolver.js\";\nimport { SessionManager } from \"@gsd/pi-coding-agent/core/session-manager.js\";\nimport { getAvailableThemes, setRegisteredThemes, setTheme, theme } from \"@gsd/pi-coding-agent/theme/theme.js\";\nimport { appKey } from \"./components/keybinding-hints.js\";\nimport { ModelSelectorComponent } from \"./components/model-selector.js\";\nimport { ProviderManagerComponent } from \"./components/provider-manager.js\";\nimport { ScopedModelsSelectorComponent } from \"./components/scoped-models-selector.js\";\nimport { SessionSelectorComponent } from \"./components/session-selector.js\";\nimport { SettingsSelectorComponent } from \"./components/settings-selector.js\";\nimport { ToolExecutionComponent } from \"./components/tool-execution.js\";\nimport { TreeSelectorComponent } from \"./components/tree-selector.js\";\nimport { UserMessageSelectorComponent } from \"./components/user-message-selector.js\";\nimport { AssistantMessageComponent } from \"./components/assistant-message.js\";\nimport {\n findExactModelMatch as findExactModelMatchController,\n getModelCandidates as getModelCandidatesController,\n handleModelCommand as handleModelCommandController,\n updateAvailableProviderCount as updateAvailableProviderCountController,\n} from \"./controllers/model-controller.js\";\nimport { handleLoginProviderSelection } from \"./interactive-selectors-auth.js\";\nimport type { InteractiveModeDelegateHost } from \"./interactive-mode-delegate-host.js\";\n\nexport function showUserMessageSelector(host: InteractiveModeDelegateHost): void {\n\t\tconst userMessages = host.session.getUserMessagesForForking();\n\n\t\tif (userMessages.length === 0) {\n\t\t\thost.showStatus(\"No messages to fork from\");\n\t\t\treturn;\n\t\t}\n\n\t\thost.showSelector((done) => {\n\t\t\tconst selector = new UserMessageSelectorComponent(\n\t\t\t\tuserMessages.map((m) => ({ id: m.entryId, text: m.text })),\n\t\t\t\tasync (entryId) => {\n\t\t\t\t\tconst result = await host.session.fork(entryId);\n\t\t\t\t\tif (result.cancelled) {\n\t\t\t\t\t\t// Extension cancelled the fork\n\t\t\t\t\t\tdone();\n\t\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\thost.chatContainer.clear();\n\t\t\t\t\thost.renderInitialMessages();\n\t\t\t\t\thost.editor.setText(result.selectedText);\n\t\t\t\t\tdone();\n\t\t\t\t\thost.showStatus(\"Branched to new session\");\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tdone();\n\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn { component: selector, focus: selector.getMessageList() };\n\t\t});\n\t}\n\nexport function showTreeSelector(host: InteractiveModeDelegateHost, initialSelectedId?: string): void {\n\t\tconst tree = host.sessionManager.getTree();\n\t\tconst realLeafId = host.sessionManager.getLeafId();\n\t\tconst initialFilterMode = host.settingsManager.getTreeFilterMode();\n\n\t\tif (tree.length === 0) {\n\t\t\thost.showStatus(\"No entries in session\");\n\t\t\treturn;\n\t\t}\n\n\t\thost.showSelector((done) => {\n\t\t\tconst selector = new TreeSelectorComponent(\n\t\t\t\ttree,\n\t\t\t\trealLeafId,\n\t\t\t\thost.ui.terminal.rows,\n\t\t\t\tasync (entryId) => {\n\t\t\t\t\t// Selecting the current leaf is a no-op (already there)\n\t\t\t\t\tif (entryId === realLeafId) {\n\t\t\t\t\t\tdone();\n\t\t\t\t\t\thost.showStatus(\"Already at host point\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Ask about summarization\n\t\t\t\t\tdone(); // Close selector first\n\n\t\t\t\t\t// Loop until user makes a complete choice or cancels to tree\n\t\t\t\t\tlet wantsSummary = false;\n\t\t\t\t\tlet customInstructions: string | undefined;\n\n\t\t\t\t\t// Check if we should skip the prompt (user preference to always default to no summary)\n\t\t\t\t\tif (!host.settingsManager.getBranchSummarySkipPrompt()) {\n\t\t\t\t\t\twhile (true) {\n\t\t\t\t\t\t\tconst summaryChoice = await host.showExtensionSelector(\"Summarize branch?\", [\n\t\t\t\t\t\t\t\t\"No summary\",\n\t\t\t\t\t\t\t\t\"Summarize\",\n\t\t\t\t\t\t\t\t\"Summarize with custom prompt\",\n\t\t\t\t\t\t\t]);\n\n\t\t\t\t\t\t\tif (summaryChoice === undefined) {\n\t\t\t\t\t\t\t\t// User pressed escape - re-show tree selector with same selection\n\t\t\t\t\t\t\t\thost.showTreeSelector(entryId);\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\twantsSummary = summaryChoice !== \"No summary\";\n\n\t\t\t\t\t\t\tif (summaryChoice === \"Summarize with custom prompt\") {\n\t\t\t\t\t\t\t\tcustomInstructions = await host.showExtensionEditor(\"Custom summarization instructions\");\n\t\t\t\t\t\t\t\tif (customInstructions === undefined) {\n\t\t\t\t\t\t\t\t\t// User cancelled - loop back to summary selector\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// User made a complete choice\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Set up escape handler and loader if summarizing\n\t\t\t\t\tlet summaryLoader: Loader | undefined;\n\t\t\t\t\tconst originalOnEscape = host.defaultEditor.onEscape;\n\n\t\t\t\t\tif (wantsSummary) {\n\t\t\t\t\t\thost.defaultEditor.onEscape = () => {\n\t\t\t\t\t\t\thost.session.abortBranchSummary();\n\t\t\t\t\t\t};\n\t\t\t\t\t\thost.chatContainer.addChild(new Spacer(1));\n\t\t\t\t\t\tsummaryLoader = new Loader(\n\t\t\t\t\t\t\thost.ui,\n\t\t\t\t\t\t\t(spinner) => theme.fg(\"accent\", spinner),\n\t\t\t\t\t\t\t(text) => theme.fg(\"muted\", text),\n\t\t\t\t\t\t\t`Summarizing branch... (${appKey(host.keybindings, \"interrupt\")} to cancel)`,\n\t\t\t\t\t\t);\n\t\t\t\t\t\thost.statusContainer.addChild(summaryLoader);\n\t\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t\t}\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = await host.session.navigateTree(entryId, {\n\t\t\t\t\t\t\tsummarize: wantsSummary,\n\t\t\t\t\t\t\tcustomInstructions,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tif (result.aborted) {\n\t\t\t\t\t\t\t// Summarization aborted - re-show tree selector with same selection\n\t\t\t\t\t\t\thost.showStatus(\"Branch summarization cancelled\");\n\t\t\t\t\t\t\thost.showTreeSelector(entryId);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (result.cancelled) {\n\t\t\t\t\t\t\thost.showStatus(\"Navigation cancelled\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Update UI\n\t\t\t\t\t\thost.chatContainer.clear();\n\t\t\t\t\t\thost.renderInitialMessages();\n\t\t\t\t\t\tif (result.editorText && !host.editor.getText().trim()) {\n\t\t\t\t\t\t\thost.editor.setText(result.editorText);\n\t\t\t\t\t\t}\n\t\t\t\t\t\thost.showStatus(\"Navigated to selected point\");\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\thost.showError(error instanceof Error ? error.message : String(error));\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tif (summaryLoader) {\n\t\t\t\t\t\t\tsummaryLoader.stop();\n\t\t\t\t\t\t\thost.statusContainer.clear();\n\t\t\t\t\t\t}\n\t\t\t\t\t\thost.defaultEditor.onEscape = originalOnEscape;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tdone();\n\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t},\n\t\t\t\t(entryId, label) => {\n\t\t\t\t\thost.sessionManager.appendLabelChange(entryId, label);\n\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t},\n\t\t\t\tinitialSelectedId,\n\t\t\t\tinitialFilterMode,\n\t\t\t);\n\t\t\treturn { component: selector, focus: selector };\n\t\t});\n\t}\n\nexport function showSessionSelector(host: InteractiveModeDelegateHost): void {\n\t\thost.showSelector((done) => {\n\t\t\tconst selector = new SessionSelectorComponent(\n\t\t\t\t(onProgress) =>\n\t\t\t\t\tSessionManager.list(host.sessionManager.getCwd(), host.sessionManager.getSessionDir(), onProgress),\n\t\t\t\tSessionManager.listAll,\n\t\t\t\tasync (sessionPath) => {\n\t\t\t\t\tdone();\n\t\t\t\t\tawait host.handleResumeSession(sessionPath);\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tdone();\n\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tvoid host.shutdown();\n\t\t\t\t},\n\t\t\t\t() => host.ui.requestRender(),\n\t\t\t\t{\n\t\t\t\t\trenameSession: async (sessionFilePath: string, nextName: string | undefined) => {\n\t\t\t\t\t\tconst next = (nextName ?? \"\").trim();\n\t\t\t\t\t\tif (!next) return;\n\t\t\t\t\t\tconst mgr = SessionManager.open(sessionFilePath);\n\t\t\t\t\t\tmgr.appendSessionInfo(next);\n\t\t\t\t\t},\n\t\t\t\t\tshowRenameHint: true,\n\t\t\t\t\tkeybindings: host.keybindings,\n\t\t\t\t},\n\n\t\t\t\thost.sessionManager.getSessionFile(),\n\t\t\t);\n\t\t\treturn { component: selector, focus: selector };\n\t\t});\n\t}\n\nexport async function handleResumeSession(host: InteractiveModeDelegateHost, sessionPath: string): Promise<void> {\n\t\t// Stop loading animation\n\t\tif (host.loadingAnimation) {\n\t\t\thost.loadingAnimation.stop();\n\t\t\thost.loadingAnimation = undefined;\n\t\t}\n\t\thost.statusContainer.clear();\n\n\t\t// Clear UI state\n\t\thost.pendingMessagesContainer.clear();\n\t\thost.compactionQueuedMessages = [];\n\t\thost.streamingComponent = undefined;\n\t\thost.streamingMessage = undefined;\n\t\thost.pendingTools.clear();\n\t\thost.clearBlockingError();\n\n\t\t// Switch session via AgentSession (emits extension session events)\n\t\tawait host.session.switchSession(sessionPath);\n\n\t\t// Clear and re-render the chat\n\t\thost.chatContainer.clear();\n\t\thost.renderInitialMessages();\n\n\t\tif (host.session.sessionManager.wasInterrupted()) {\n\t\t\thost.showStatus(\"Resumed session (previous session ended unexpectedly — last action may be incomplete)\");\n\t\t} else {\n\t\t\thost.showStatus(\"Resumed session\");\n\t\t}\n\t}\n\nexport function showProviderManager(host: InteractiveModeDelegateHost): void {\n\t\thost.showSelector((done) => {\n\t\t\tconst component = new ProviderManagerComponent(\n\t\t\t\thost.ui,\n\t\t\t\thost.session.modelRegistry.authStorage,\n\t\t\t\thost.session.modelRegistry,\n\t\t\t\t() => {\n\t\t\t\t\tdone();\n\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t},\n\t\t\t\tasync (provider: string) => {\n\t\t\t\t\thost.showStatus(`Discovering models for ${provider}...`);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst results = await host.session.modelRegistry.discoverModels([provider]);\n\t\t\t\t\t\tconst result = results[0];\n\t\t\t\t\t\tif (result?.error) {\n\t\t\t\t\t\t\thost.showError(`Discovery failed: ${result.error}`);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\thost.showStatus(`Discovered ${result?.models.length ?? 0} models from ${provider}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\thost.showError(error instanceof Error ? error.message : String(error));\n\t\t\t\t\t}\n\t\t\t\t\tdone();\n\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t},\n\t\t\t\tasync (provider: string) => {\n\t\t\t\t\tdone();\n\t\t\t\t\tawait handleLoginProviderSelection(host, provider);\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn { component, focus: component };\n\t\t});\n\t}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gsd/agent-modes",
|
|
3
|
-
"version": "1.0.2-dev.
|
|
3
|
+
"version": "1.0.2-dev.29398d2",
|
|
4
4
|
"description": "GSD run modes and CLI layer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"gsd": {
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"test": "node --import ../../src/resources/extensions/gsd/tests/resolve-ts.mjs --experimental-strip-types --test src/**/*.test.ts"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@gsd/agent-core": "^1.0.2-dev.
|
|
29
|
-
"@gsd/pi-agent-core": "^1.0.2-dev.
|
|
30
|
-
"@gsd/pi-ai": "^1.0.2-dev.
|
|
31
|
-
"@gsd/pi-coding-agent": "^1.0.2-dev.
|
|
32
|
-
"@gsd/pi-tui": "^1.0.2-dev.
|
|
33
|
-
"@opengsd/contracts": "^1.0.2-dev.
|
|
28
|
+
"@gsd/agent-core": "^1.0.2-dev.29398d2",
|
|
29
|
+
"@gsd/pi-agent-core": "^1.0.2-dev.29398d2",
|
|
30
|
+
"@gsd/pi-ai": "^1.0.2-dev.29398d2",
|
|
31
|
+
"@gsd/pi-coding-agent": "^1.0.2-dev.29398d2",
|
|
32
|
+
"@gsd/pi-tui": "^1.0.2-dev.29398d2",
|
|
33
|
+
"@opengsd/contracts": "^1.0.2-dev.29398d2",
|
|
34
34
|
"chalk": "^5.5.0"
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const binDir = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const target = join(binDir, '..', 'dist', 'cli.js');
|
|
8
|
+
|
|
9
|
+
if (!existsSync(target)) {
|
|
10
|
+
process.stderr.write('gsd-mcp-server: build output missing. Run `pnpm --filter @opengsd/mcp-server run build`.\n');
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
await import('../dist/cli.js');
|
|
@@ -980,7 +980,7 @@ const taskCompleteParams = {
|
|
|
980
980
|
milestoneId: nonEmptyString("milestoneId").describe("Milestone ID (e.g. M001)"),
|
|
981
981
|
oneLiner: z.string().describe("One-line summary of what was accomplished"),
|
|
982
982
|
narrative: z.string().describe("Detailed narrative of what happened during the task"),
|
|
983
|
-
verification: z.string().describe("What was verified and how"),
|
|
983
|
+
verification: z.string().optional().describe("What was verified and how. If omitted, the executor derives this from verificationEvidence when possible."),
|
|
984
984
|
deviations: z.string().optional().describe("Deviations from the task plan"),
|
|
985
985
|
knownIssues: z.string().optional().describe("Known issues discovered but not fixed"),
|
|
986
986
|
keyFiles: z.array(z.string()).optional().describe("List of key files created or modified"),
|