@volter/supercode-frontend-vscode 0.1.42 → 0.1.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/extension.js +23 -7
  2. package/package.json +1 -1
package/dist/extension.js CHANGED
@@ -410,6 +410,8 @@ export async function activate(context) {
410
410
  const resourceBindings = new Map(context.workspaceState.get('supercode.sessionBindings', []));
411
411
  const boundId = (resource) => resolveSessionBinding(resource, controls?.state.sessions ?? [], resourceBindings);
412
412
  let applying = Promise.resolve();
413
+ // the reason the last send from a new chat made no conversation, said by that draft's request handler
414
+ let refusedSend;
413
415
  let pendingDraft;
414
416
  let focusedResource;
415
417
  let focusGeneration = 0;
@@ -606,8 +608,12 @@ export async function activate(context) {
606
608
  const applied = pending.then(() => undefined, () => undefined);
607
609
  applying = applied;
608
610
  const revealed = pending.then(async (target) => {
611
+ // A blank chat the workbench restored keeps the focus, except from a conversation whose turn runs or waits for an
612
+ // answer: after a reload mid-turn, that is the chat a person needs (its Stop button, its pending approval).
613
+ const live = target?.kind === 'managed' && Boolean(frontends.get(target.id)?.session.pendingRequests.size
614
+ || frontends.get(target.id)?.session.descriptor?.turn_state === 'busy');
609
615
  if (!target || !controls || applying !== applied || target.generation !== focusGeneration
610
- || focusedResource?.path.startsWith('/untitled-'))
616
+ || (focusedResource?.path.startsWith('/untitled-') && !live))
611
617
  return;
612
618
  if (target.kind === 'managed') {
613
619
  if ((controls.state.setup && !controls.state.setup.ready) || controls.state.activeSession !== target.id
@@ -746,11 +752,7 @@ export async function activate(context) {
746
752
  throw new Error('This host does not expose native conversation creation.');
747
753
  // Its callers (the new-chat pickers) swallow the cancellation, so the warning is the one message shown. An error
748
754
  // would reach the person as a bare "Canceled" or not at all through the contributed-command boundary.
749
- const refusal = busyRefusal(managed(), 'starting a new chat');
750
- if (refusal) {
751
- void vscode.window.showWarningMessage(refusal);
752
- throw new vscode.CancellationError();
753
- }
755
+ // A turn running elsewhere does not stop a draft: its first send is refused there, in the chat (`create`).
754
756
  // Code-OSS materializes this untitled session on first send, awaiting our
755
757
  // newChatSessionItemHandler before accepting/clearing the draft. Never boot
756
758
  // beside the old widget and reveal another resource after it accepts input.
@@ -886,6 +888,13 @@ export async function activate(context) {
886
888
  create: async (inputState) => {
887
889
  if (!controls)
888
890
  throw new Error('The host does not expose conversation creation.');
891
+ // A send while another turn runs makes no conversation: the host then runs the request on the draft itself, and
892
+ // its handler says why in the chat. A rejection here reaches nobody (the host's acceptInput drops it).
893
+ const busy = busyRefusal(managed(), 'starting a new chat');
894
+ if (busy) {
895
+ refusedSend = busy;
896
+ return undefined;
897
+ }
889
898
  const draft = activeDraft();
890
899
  await draft?.choosing;
891
900
  if (draft && activeDraft() !== draft)
@@ -1161,6 +1170,12 @@ export async function activate(context) {
1161
1170
  const handler = async (request, chatContext, stream, token) => {
1162
1171
  await applying;
1163
1172
  const requestedResource = chatContext.chatSessionContext?.chatSessionItem?.resource;
1173
+ if (refusedSend && requestedResource?.path.startsWith('/untitled-') && !boundId(requestedResource)) {
1174
+ const refusal = refusedSend;
1175
+ refusedSend = undefined;
1176
+ // thrown as is: the workbench writes a handler's error into the chat
1177
+ throw new Error(`${refusal} Nothing was sent; send it again in a new chat once that turn has ended.`);
1178
+ }
1164
1179
  if (controls?.state.setup && !controls.state.setup.ready) {
1165
1180
  stream.markdown('Sign in before sending a message. Use **New Chat: Choose Agent** to get started.');
1166
1181
  return {};
@@ -1713,7 +1728,8 @@ function registerSessions(context, frontends, participant, granted, handler, his
1713
1728
  controller.newChatSessionItemHandler = async ({ inputState }, token) => {
1714
1729
  if (token.isCancellationRequested)
1715
1730
  throw new vscode.CancellationError();
1716
- return connectedItem(await controls.create(inputState));
1731
+ const connection = await controls.create(inputState);
1732
+ return connection ? connectedItem(connection) : undefined;
1717
1733
  };
1718
1734
  context.subscriptions.push(controls.changed(() => {
1719
1735
  refreshItems();
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.42",
4
+ "version": "0.1.43",
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",