@volter/supercode-frontend-vscode 0.1.34 → 0.1.35

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 CHANGED
@@ -24,6 +24,25 @@ Gallery detection reads the host's `product.json` through `vscode.workspace.fs`
24
24
  at `vscode.env.appRoot`; hosts without an inspectable gallery configuration hide
25
25
  the choice. Neither the extension nor its credentials are bundled or copied.
26
26
 
27
+ The welcome's primary action uses `supercode.frontend.beginChatGPTSignIn`:
28
+ it starts one retained install/sidebar operation and returns a copied receipt
29
+ with its id, timestamps and current phase. This is a launch receipt, not proof
30
+ that installation, sidebar presentation or authentication succeeded. A second
31
+ begin while that operation is running returns the same id and starts no extra
32
+ installation. `supercode.frontend.chatGPTSignInStatus` reads its current phase
33
+ locally without waiting for host readiness or installation; pass the operation
34
+ id to receive only that operation (a mismatched id returns null).
35
+ Phases name the selected work before its awaited command: `checking-gallery`,
36
+ `installing-extension`, `opening-sidebar`, then `completed` or `failed`.
37
+ Completed means the official command sequence fulfilled, not signed in. Failures
38
+ remain in operation status and the existing native error notification/output.
39
+ Only the current or most recent operation is retained, for this extension-window
40
+ lifetime; reload does not restore or automatically retry it. Runtime status
41
+ inspection also includes this snapshot as `chatGPTSignIn`.
42
+ The existing `supercode.frontend.signInWithChatGPT` still awaits the same work
43
+ with its existing error-notification/fulfillment behavior, and the agent picker
44
+ continues to use it. Ordinary relay budgets and draft guards are unchanged.
45
+
27
46
  The optional host-controls state can include `setup: { ready, actions, reason,
28
47
  cwd }`. Each action supplies `kind` (`login` or `install`), `harness`, `name` and
29
48
  the exact `command` revalidated before execution. On a signed-out first open,
@@ -2,12 +2,22 @@
2
2
  import * as vscode from 'vscode';
3
3
  import type { ChatSetupState } from './host-controls.js';
4
4
  export declare const CHATGPT_SIGN_IN = "supercode.frontend.signInWithChatGPT";
5
+ export declare const CHATGPT_SIGN_IN_BEGIN = "supercode.frontend.beginChatGPTSignIn";
6
+ export declare const CHATGPT_SIGN_IN_STATUS = "supercode.frontend.chatGPTSignInStatus";
7
+ export type ChatGPTSignInWorkPhase = 'checking-gallery' | 'installing-extension' | 'opening-sidebar';
8
+ export interface ChatGPTSignInOperation {
9
+ readonly id: string;
10
+ readonly phase: ChatGPTSignInWorkPhase | 'completed' | 'failed';
11
+ readonly startedAt: number;
12
+ readonly updatedAt: number;
13
+ readonly finishedAt?: number;
14
+ }
5
15
  /** The install command also exists in gallery-less Code-OSS. Fail closed when
6
16
  * the host's product configuration cannot be inspected through the VS Code API. */
7
17
  export declare function chatGPTAvailable(): Promise<boolean>;
8
18
  /** Only called by an explicit click. The gallery and extension own installation
9
19
  * and authentication; there is no terminal or provider credential handling here. */
10
- export declare function signInWithChatGPT(): Promise<void>;
20
+ export declare function signInWithChatGPT(report?: (phase: ChatGPTSignInWorkPhase) => void): Promise<void>;
11
21
  /** Empty-chat welcome content, rendered by Code-OSS's ChatViewWelcomePart.
12
22
  * Only the official extension gets the primary button; native local sign-in
13
23
  * actions remain ordinary links. Commands and host diagnostic paths stay out
@@ -1,6 +1,8 @@
1
1
  /** Native Chat presentation; the host supplies inventory and terminal actions. */
2
2
  import * as vscode from 'vscode';
3
3
  export const CHATGPT_SIGN_IN = 'supercode.frontend.signInWithChatGPT';
4
+ export const CHATGPT_SIGN_IN_BEGIN = 'supercode.frontend.beginChatGPTSignIn';
5
+ export const CHATGPT_SIGN_IN_STATUS = 'supercode.frontend.chatGPTSignInStatus';
4
6
  const CODEX_EXTENSION = 'openai.chatgpt';
5
7
  const INSTALL_EXTENSION = 'workbench.extensions.installExtension';
6
8
  /** The install command also exists in gallery-less Code-OSS. Fail closed when
@@ -20,16 +22,19 @@ export async function chatGPTAvailable() {
20
22
  }
21
23
  /** Only called by an explicit click. The gallery and extension own installation
22
24
  * and authentication; there is no terminal or provider credential handling here. */
23
- export async function signInWithChatGPT() {
25
+ export async function signInWithChatGPT(report) {
26
+ report?.('checking-gallery');
24
27
  if (!await chatGPTAvailable())
25
28
  throw new Error('This host does not provide an extension gallery.');
26
29
  if (!vscode.extensions.getExtension(CODEX_EXTENSION)) {
27
30
  // enable makes the workbench await the running extension registry, not
28
31
  // just the installed inventory, before we dispatch the contributed command.
32
+ report?.('installing-extension');
29
33
  await vscode.commands.executeCommand(INSTALL_EXTENSION, CODEX_EXTENSION, { enable: true });
30
34
  }
31
35
  // openai.chatgpt contributes this command, not a public sign-in command.
32
36
  // Revealing its sidebar presents its own Sign in with ChatGPT when signed out.
37
+ report?.('opening-sidebar');
33
38
  await vscode.commands.executeCommand('chatgpt.openSidebar');
34
39
  }
35
40
  /** Empty-chat welcome content, rendered by Code-OSS's ChatViewWelcomePart.
@@ -38,9 +43,9 @@ export async function signInWithChatGPT() {
38
43
  * of the welcome, and the host still revalidates every action on click. */
39
44
  export function setupWelcome(setup, chatGPT = false) {
40
45
  const welcome = new vscode.MarkdownString();
41
- welcome.isTrusted = { enabledCommands: [CHATGPT_SIGN_IN, 'supercode.frontend.setup', 'supercode.frontend.refreshSetup'] };
46
+ welcome.isTrusted = { enabledCommands: [CHATGPT_SIGN_IN_BEGIN, 'supercode.frontend.setup', 'supercode.frontend.refreshSetup'] };
42
47
  if (chatGPT) {
43
- welcome.appendMarkdown(`[Sign in with ChatGPT](command:${CHATGPT_SIGN_IN})\n\n`);
48
+ welcome.appendMarkdown(`[Sign in with ChatGPT](command:${CHATGPT_SIGN_IN_BEGIN})\n\n`);
44
49
  welcome.appendMarkdown('Use the official Codex extension.');
45
50
  welcome.appendMarkdown('\n\n');
46
51
  }
package/dist/extension.js CHANGED
@@ -2,7 +2,7 @@ import { resolveSessionBinding } from './bindings.js';
2
2
  import { withTextContext } from './context.js';
3
3
  import { randomUUID } from 'node:crypto';
4
4
  import { ChatHostControls, runtimeIdentity, harnessDisplayName, turnPermission } from './host-controls.js';
5
- import { CHATGPT_SIGN_IN, chatGPTAvailable, setupWelcome, signInWithChatGPT } from './chat-setup.js';
5
+ import { CHATGPT_SIGN_IN, CHATGPT_SIGN_IN_BEGIN, CHATGPT_SIGN_IN_STATUS, chatGPTAvailable, setupWelcome, signInWithChatGPT } from './chat-setup.js';
6
6
  import * as vscode from 'vscode';
7
7
  import { createFrontendClient } from './client.js';
8
8
  import { readCredentialFile } from './credential.js';
@@ -324,13 +324,36 @@ export async function activate(context) {
324
324
  const controls = await ChatHostControls.fromEnvironment();
325
325
  const offerChatGPT = await chatGPTAvailable();
326
326
  let signingInWithChatGPT;
327
- context.subscriptions.push(vscode.commands.registerCommand(CHATGPT_SIGN_IN, () => {
328
- signingInWithChatGPT ??= signInWithChatGPT().catch(error => {
327
+ let chatGPTSignInOperation;
328
+ const signInSnapshot = () => chatGPTSignInOperation ? { ...chatGPTSignInOperation } : null;
329
+ const startChatGPTSignIn = () => {
330
+ if (signingInWithChatGPT)
331
+ return signingInWithChatGPT;
332
+ const startedAt = Date.now();
333
+ const operation = { id: randomUUID(), startedAt };
334
+ const update = (phase) => {
335
+ const updatedAt = Date.now();
336
+ chatGPTSignInOperation = { ...operation, phase, updatedAt,
337
+ ...(phase === 'completed' || phase === 'failed' ? { finishedAt: updatedAt } : {}) };
338
+ };
339
+ signingInWithChatGPT = signInWithChatGPT(phase => update(phase)).then(() => {
340
+ // Fulfilled install/sidebar commands do not establish authentication.
341
+ update('completed');
342
+ }).catch(error => {
343
+ update('failed');
329
344
  log.error(`Could not open ChatGPT sign-in: ${String(error)}`);
330
345
  void vscode.window.showErrorMessage(`Could not open ChatGPT sign-in: ${error instanceof Error ? error.message : String(error)}`);
331
346
  }).finally(() => { signingInWithChatGPT = undefined; });
332
347
  return signingInWithChatGPT;
333
- }));
348
+ };
349
+ context.subscriptions.push(
350
+ // Preserve the completion-awaiting command used by the agent picker.
351
+ vscode.commands.registerCommand(CHATGPT_SIGN_IN, startChatGPTSignIn),
352
+ // A click starts one retained task. Its receipt is not install/login success.
353
+ vscode.commands.registerCommand(CHATGPT_SIGN_IN_BEGIN, () => {
354
+ void startChatGPTSignIn();
355
+ return signInSnapshot();
356
+ }), vscode.commands.registerCommand(CHATGPT_SIGN_IN_STATUS, (operationId) => operationId === undefined || operationId === chatGPTSignInOperation?.id ? signInSnapshot() : null));
334
357
  const controlsChanged = new vscode.EventEmitter();
335
358
  context.subscriptions.push(controlsChanged);
336
359
  let permission = 'ask';
@@ -1160,6 +1183,7 @@ export async function activate(context) {
1160
1183
  await controls.refresh();
1161
1184
  if (inspect === true)
1162
1185
  return {
1186
+ chatGPTSignIn: signInSnapshot(),
1163
1187
  connections: frontends.all.map(c => ({ ...frontends.info(c), permissions: [...c.session.permissions],
1164
1188
  pendingRequests: [...c.session.pendingRequests.values()] })),
1165
1189
  selection: controls?.state.selection, activeSession: controls?.state.activeSession,
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { createFrontendClient, type FrontendPermission, type VscodeFrontendConnection } from './client.js';
2
2
  export { readCredentialFile } from './credential.js';
3
+ export type { ChatGPTSignInWorkPhase, ChatGPTSignInOperation } from './chat-setup.js';
3
4
  export { grantedProposals, PROPOSAL_EFFECTS, REQUESTED_PROPOSALS, type ProposalName, } from './proposals.js';
4
5
  export { EventSequenceGapError, LEASE_ERROR_NAMES, RequestNotPendingError, TURN_TERMINAL_KINDS, VscodeFrontendSession, type VscodeFrontendActions, type VscodeRuntimeClient, } from './session.js';
5
6
  export { HISTORY_MARKER_PROMPT, VSCODE_CHAT_LIMITS, acceptedDecisions, diffPaths, fence, opaqueText, projectEvent, projectPendingRequests, projectHistory, projectReplayTurns, requestAnswers, requestNeedsTypedReply, requestSubject, requestSummary, resolutionSentence, resolveParts, toolSubject, typedAnswer, type ChatAnswer, type ChatPart, type ProjectedPart, type ProjectedTurn, type ProjectionContext, } from './view.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@volter/supercode-frontend-vscode",
3
3
  "displayName": "Volter Harness",
4
- "version": "0.1.34",
4
+ "version": "0.1.35",
5
5
  "type": "module",
6
6
  "description": "VS Code chat-view frontend for an existing Volter Harness SDK runtime",
7
7
  "publisher": "volter-ai-dev",