@volter/supercode-frontend-vscode 0.1.14 → 0.1.16
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/LICENSE-APACHE +202 -0
- package/LICENSE-MIT +21 -0
- package/dist/extension.js +115 -34
- package/package.json +4 -2
- package/vendor/supercode-frontend/package.json +3 -1
package/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 supercode contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/extension.js
CHANGED
|
@@ -8,7 +8,7 @@ import { readCredentialFile } from './credential.js';
|
|
|
8
8
|
import { grantedProposals, PROPOSAL_EFFECTS, REQUESTED_PROPOSALS } from './proposals.js';
|
|
9
9
|
import { observeActiveResponse, sessionStatus } from './native-session.js';
|
|
10
10
|
import { RequestNotPendingError, VscodeFrontendSession } from './session.js';
|
|
11
|
-
import {
|
|
11
|
+
import { acceptedDecisions, opaqueText, projectEvent, projectPendingRequests, projectHistory, projectReplayTurns, resolveParts, resolutionSentence, typedAnswer, } from './view.js';
|
|
12
12
|
const SESSION_SCHEME = 'supercode';
|
|
13
13
|
const PARTICIPANT_ID = 'supercode.chat';
|
|
14
14
|
const DEFAULT_PARTICIPANT_ID = 'supercode.chat.default';
|
|
@@ -324,9 +324,17 @@ export async function activate(context) {
|
|
|
324
324
|
const boundId = (resource) => resolveSessionBinding(resource, controls?.state.sessions ?? [], resourceBindings);
|
|
325
325
|
let applying = Promise.resolve();
|
|
326
326
|
const frontends = new SupercodeFrontends();
|
|
327
|
+
// Runtimes attached by address ("Set Runtime Token", "Attach to Runtime")
|
|
328
|
+
// beside a host's managed conversation. The host's catalogue does not know
|
|
329
|
+
// them, so they open as what they are: attachments, shown as their runtime
|
|
330
|
+
// reports them, and never taken for the conversation the host manages.
|
|
331
|
+
const attachedIds = new Set();
|
|
332
|
+
const managed = () => frontends.all.find((connection) => !attachedIds.has(connection.id));
|
|
333
|
+
// The attached runtime the person is looking at: the Chat names its harness, not the host's.
|
|
334
|
+
let focusedAttached;
|
|
327
335
|
let approvalAvailable = false;
|
|
328
336
|
context.subscriptions.push(frontends.onDidChange(() => {
|
|
329
|
-
const active =
|
|
337
|
+
const active = managed();
|
|
330
338
|
const available = Boolean(active?.session.descriptor?.actions.respond && active.session.permissions.has('approve'));
|
|
331
339
|
if (available !== approvalAvailable) {
|
|
332
340
|
approvalAvailable = available;
|
|
@@ -334,7 +342,9 @@ export async function activate(context) {
|
|
|
334
342
|
}
|
|
335
343
|
}));
|
|
336
344
|
const identity = () => {
|
|
337
|
-
|
|
345
|
+
if (focusedAttached)
|
|
346
|
+
return runtimeIdentity(focusedAttached.session.descriptor?.source_harness, focusedAttached.session.descriptor?.model);
|
|
347
|
+
const descriptor = managed()?.session.descriptor;
|
|
338
348
|
return runtimeIdentity(controls?.state.selection.harness ?? descriptor?.source_harness, controls?.state.selection.model || controls?.state.actualModel || descriptor?.model);
|
|
339
349
|
};
|
|
340
350
|
const icon = () => {
|
|
@@ -384,7 +394,8 @@ export async function activate(context) {
|
|
|
384
394
|
const existing = frontends.get(id);
|
|
385
395
|
if (existing && existing.baseUrl === env.SUPERCODE_FRONTEND_URL)
|
|
386
396
|
return existing;
|
|
387
|
-
|
|
397
|
+
for (const connection of frontends.all.filter((entry) => !attachedIds.has(entry.id)))
|
|
398
|
+
await frontends.disconnect(connection.id);
|
|
388
399
|
const connection = await frontends.connect({ connectionId: id, baseUrl: env.SUPERCODE_FRONTEND_URL,
|
|
389
400
|
token: await readCredentialFile(env.SUPERCODE_FRONTEND_CREDENTIAL_FILE), clientId: env.SUPERCODE_FRONTEND_CLIENT_ID,
|
|
390
401
|
permissions: normalizePermissions(env.SUPERCODE_FRONTEND_PERMISSIONS, ['observe']), label: identity().name }, log);
|
|
@@ -405,10 +416,17 @@ export async function activate(context) {
|
|
|
405
416
|
throw new Error('This conversation is no longer connected.');
|
|
406
417
|
return connection;
|
|
407
418
|
}
|
|
419
|
+
const attached = attachedIds.has(resource.authority) ? frontends.get(resource.authority) : undefined;
|
|
420
|
+
if (focusedAttached !== attached) {
|
|
421
|
+
focusedAttached = attached;
|
|
422
|
+
controlsChanged.fire();
|
|
423
|
+
}
|
|
424
|
+
if (attached)
|
|
425
|
+
return attached;
|
|
408
426
|
const id = boundId(resource);
|
|
409
427
|
if (!id)
|
|
410
428
|
throw new Error('This chat has no backend session binding. Start a new chat; no message was sent.');
|
|
411
|
-
const active =
|
|
429
|
+
const active = managed();
|
|
412
430
|
if (active && active.id !== id && (active.session.descriptor?.turn_state === 'busy' || active.session.pendingRequests.size))
|
|
413
431
|
throw new Error('Finish or cancel the active turn before opening another conversation.');
|
|
414
432
|
try {
|
|
@@ -432,7 +450,7 @@ export async function activate(context) {
|
|
|
432
450
|
async function applySelection(selection, openChat = true) {
|
|
433
451
|
if (!controls)
|
|
434
452
|
throw new Error('This host does not expose harness or model configuration.');
|
|
435
|
-
const active =
|
|
453
|
+
const active = managed();
|
|
436
454
|
if (active?.session.descriptor?.turn_state === 'busy' || active?.session.pendingRequests.size)
|
|
437
455
|
throw new Error('Finish or cancel the current turn before starting a new chat.');
|
|
438
456
|
await controls.select(selection);
|
|
@@ -454,7 +472,7 @@ export async function activate(context) {
|
|
|
454
472
|
currentOptions,
|
|
455
473
|
options: (resource) => {
|
|
456
474
|
const id = resource ? boundId(resource) : undefined;
|
|
457
|
-
const active = resource ? (id ? frontends.get(id) : undefined) :
|
|
475
|
+
const active = resource ? (id ? frontends.get(id) : undefined) : managed();
|
|
458
476
|
const canApprove = active?.session.descriptor?.actions.respond && active.session.permissions.has('approve');
|
|
459
477
|
const permissionItems = [{ id: 'ask', name: canApprove ? 'Ask for approval' : 'Harness permissions', description: canApprove ? 'Show each approval requested by the harness.' : 'Approval controls are unavailable for this harness.' },
|
|
460
478
|
...((canApprove || (!active && resource && currentOptions(resource).permissions === 'autoApprove')) ? [{ id: 'autoApprove', name: 'Auto approve', description: 'Allow tool approval requests for this chat. Harness sandbox rules still apply.' }] : [])];
|
|
@@ -479,6 +497,7 @@ export async function activate(context) {
|
|
|
479
497
|
return connection;
|
|
480
498
|
},
|
|
481
499
|
resolve: connectionFor,
|
|
500
|
+
attached: (connection) => attachedIds.has(connection.id),
|
|
482
501
|
catalogue: () => controls?.state.sessions ?? [],
|
|
483
502
|
bindings: boundId,
|
|
484
503
|
};
|
|
@@ -578,7 +597,7 @@ export async function activate(context) {
|
|
|
578
597
|
}
|
|
579
598
|
finally {
|
|
580
599
|
cancellation.dispose();
|
|
581
|
-
if (controls) {
|
|
600
|
+
if (controls && !attachedIds.has(connection.id)) {
|
|
582
601
|
if (connection.session.descriptor?.session_id)
|
|
583
602
|
await controls.remember(connection.id, connection.session.descriptor.session_id).catch(error => log.warn(`Could not save conversation identity: ${String(error)}`));
|
|
584
603
|
await controls.refresh().catch(error => log.warn(`Could not refresh chat identity: ${String(error)}`));
|
|
@@ -591,8 +610,8 @@ export async function activate(context) {
|
|
|
591
610
|
const requestedResource = chatContext.chatSessionContext?.chatSessionItem?.resource;
|
|
592
611
|
const connection = requestedResource
|
|
593
612
|
? await connectionFor(requestedResource)
|
|
594
|
-
: controls ? undefined :
|
|
595
|
-
if (controls && connection && request.model?.vendor === 'supercode-runtime') {
|
|
613
|
+
: controls ? undefined : managed();
|
|
614
|
+
if (controls && connection && !attachedIds.has(connection.id) && request.model?.vendor === 'supercode-runtime') {
|
|
596
615
|
const selection = controls.state.sessions.find(s => s.id === connection.id).selection;
|
|
597
616
|
const expected = `${selection.harness}/${encodeURIComponent(selection.model || '__default__')}`;
|
|
598
617
|
if (request.model.id !== expected || (typeof request.modelConfiguration?.reasoningEffort === 'string' && request.modelConfiguration.reasoningEffort !== selection.effort)) {
|
|
@@ -652,7 +671,7 @@ export async function activate(context) {
|
|
|
652
671
|
// canDelegate is disabled to avoid a generic workbench-owned registration.
|
|
653
672
|
// A participant names the harness; the native model picker names the model.
|
|
654
673
|
// Keep the author stable when a model changes during request dispatch.
|
|
655
|
-
const participantName = () => harnessDisplayName(controls?.state.selection.harness ??
|
|
674
|
+
const participantName = () => harnessDisplayName(focusedAttached?.session.descriptor?.source_harness ?? controls?.state.selection.harness ?? managed()?.session.descriptor?.source_harness);
|
|
656
675
|
const participantKey = () => `${participantName()}/${identity().provider ?? ''}`;
|
|
657
676
|
const makeParticipant = () => {
|
|
658
677
|
const current = { name: participantName() };
|
|
@@ -792,11 +811,16 @@ export async function activate(context) {
|
|
|
792
811
|
log.info('Volter Harness: a base URL is configured but no token is stored; run Volter Harness: Set Runtime Token.');
|
|
793
812
|
return;
|
|
794
813
|
}
|
|
795
|
-
await frontends
|
|
814
|
+
const connection = await frontends
|
|
796
815
|
.connect({ baseUrl, token, permissions: normalizePermissions(settings.get('permissions'), ['observe']) }, log)
|
|
797
816
|
.catch((error) => {
|
|
798
817
|
log.error(`Volter Harness could not attach to ${baseUrl}: ${String(error?.message ?? error)}`);
|
|
818
|
+
return undefined;
|
|
799
819
|
});
|
|
820
|
+
if (controls && connection) {
|
|
821
|
+
attachedIds.add(connection.id);
|
|
822
|
+
controlsChanged.fire();
|
|
823
|
+
}
|
|
800
824
|
}
|
|
801
825
|
/**
|
|
802
826
|
* The handover path: a runtime (or a product that launched this editor's
|
|
@@ -903,10 +927,79 @@ export function deactivate() {
|
|
|
903
927
|
// Every disposable is owned by the extension context.
|
|
904
928
|
}
|
|
905
929
|
/**
|
|
906
|
-
*
|
|
907
|
-
*
|
|
908
|
-
*
|
|
909
|
-
*
|
|
930
|
+
* A tool call reaches a turn as two parts, its start and its completion, which
|
|
931
|
+
* a live stream draws as one row because the editor merges them by
|
|
932
|
+
* `toolCallId`. A HISTORY turn is markdown and merges nothing, so each call
|
|
933
|
+
* showed twice ("Tool call: exec" and again with its output). The start keeps
|
|
934
|
+
* its place and its description (the command it ran); the completion gives it
|
|
935
|
+
* its output and outcome.
|
|
936
|
+
*/
|
|
937
|
+
function oneRowPerToolCall(parts) {
|
|
938
|
+
const rows = [];
|
|
939
|
+
const started = new Map();
|
|
940
|
+
for (const part of parts) {
|
|
941
|
+
if (part.part === 'tool' && part.toolCallId) {
|
|
942
|
+
const at = started.get(part.toolCallId);
|
|
943
|
+
const first = at === undefined ? undefined : rows[at];
|
|
944
|
+
if (first && first.part === 'tool' && part.isComplete) {
|
|
945
|
+
rows[at] = {
|
|
946
|
+
...first,
|
|
947
|
+
...part,
|
|
948
|
+
pastTenseMessage: first.invocationMessage ?? part.pastTenseMessage,
|
|
949
|
+
invocationMessage: first.invocationMessage ?? part.invocationMessage,
|
|
950
|
+
};
|
|
951
|
+
continue;
|
|
952
|
+
}
|
|
953
|
+
if (!part.isComplete)
|
|
954
|
+
started.set(part.toolCallId, rows.length);
|
|
955
|
+
}
|
|
956
|
+
rows.push(part);
|
|
957
|
+
}
|
|
958
|
+
return rows;
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* A saved turn's parts, drawn as the live stream draws them. The editor
|
|
962
|
+
* converts a history turn's response with the same converter as a live
|
|
963
|
+
* response (`convertResponseTurn` maps every part through it), so a tool call
|
|
964
|
+
* is the same `ChatToolInvocationPart` row it was while it ran; only the text
|
|
965
|
+
* between tools is markdown, consecutive text joined into one part. A turn
|
|
966
|
+
* looks the same however late the Chat was opened.
|
|
967
|
+
*/
|
|
968
|
+
function historyParts(parts) {
|
|
969
|
+
const out = [];
|
|
970
|
+
let text = [];
|
|
971
|
+
const flush = () => {
|
|
972
|
+
if (text.length)
|
|
973
|
+
out.push(new vscode.ChatResponseMarkdownPart(text.join('\n\n')));
|
|
974
|
+
text = [];
|
|
975
|
+
};
|
|
976
|
+
for (const part of parts) {
|
|
977
|
+
if (part.part === 'tool') {
|
|
978
|
+
flush();
|
|
979
|
+
const toolName = part.toolName || 'tool';
|
|
980
|
+
const invocation = new vscode.ChatToolInvocationPart(toolName, part.toolCallId);
|
|
981
|
+
invocation.invocationMessage = part.invocationMessage || toolName;
|
|
982
|
+
invocation.pastTenseMessage = part.pastTenseMessage || part.invocationMessage || toolName;
|
|
983
|
+
invocation.isConfirmed = true;
|
|
984
|
+
invocation.isComplete = part.isComplete;
|
|
985
|
+
if (part.isError !== undefined)
|
|
986
|
+
invocation.isError = part.isError;
|
|
987
|
+
if (part.isComplete) {
|
|
988
|
+
invocation.toolSpecificData = { input: part.inputText ?? '', output: part.resultText ?? '' };
|
|
989
|
+
}
|
|
990
|
+
out.push(invocation);
|
|
991
|
+
continue;
|
|
992
|
+
}
|
|
993
|
+
const value = historyText(part);
|
|
994
|
+
if (value)
|
|
995
|
+
text.push(value);
|
|
996
|
+
}
|
|
997
|
+
flush();
|
|
998
|
+
return out.length ? out : [new vscode.ChatResponseMarkdownPart('')];
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* One text part as the markdown a HISTORY turn carries (tool calls are drawn
|
|
1002
|
+
* as tool rows by `historyParts`).
|
|
910
1003
|
*/
|
|
911
1004
|
function historyText(part) {
|
|
912
1005
|
switch (part.part) {
|
|
@@ -921,17 +1014,9 @@ function historyText(part) {
|
|
|
921
1014
|
return part.value;
|
|
922
1015
|
case 'reference':
|
|
923
1016
|
return `\`${part.path}\``;
|
|
924
|
-
case 'tool':
|
|
925
|
-
//
|
|
926
|
-
|
|
927
|
-
// line plus its output, fenced.
|
|
928
|
-
const summary = part.pastTenseMessage ?? part.invocationMessage ?? part.toolName;
|
|
929
|
-
if (!summary)
|
|
930
|
-
return '';
|
|
931
|
-
const verb = part.isError ? 'Tool failed:' : 'Tool call:';
|
|
932
|
-
const result = part.resultText ? `\n\n${fence(part.resultText)}` : '';
|
|
933
|
-
return `${verb} \`${summary}\`${result}`;
|
|
934
|
-
}
|
|
1017
|
+
case 'tool':
|
|
1018
|
+
// Drawn as a tool row by `historyParts`.
|
|
1019
|
+
return '';
|
|
935
1020
|
case 'answers':
|
|
936
1021
|
return `**${part.title}**\n\n${part.message}`;
|
|
937
1022
|
}
|
|
@@ -1051,7 +1136,7 @@ function registerSessions(context, frontends, participant, granted, handler, con
|
|
|
1051
1136
|
if (!connection) {
|
|
1052
1137
|
return { history: [], requestHandler: boundHandler };
|
|
1053
1138
|
}
|
|
1054
|
-
if (controls) {
|
|
1139
|
+
if (controls && !controls.attached(connection)) {
|
|
1055
1140
|
controls.setPermission(resource, inputState.groups.find(group => group.id === 'permissions')?.selected?.id);
|
|
1056
1141
|
inputState.groups = controls.options(resource);
|
|
1057
1142
|
}
|
|
@@ -1097,16 +1182,12 @@ function registerSessions(context, frontends, participant, granted, handler, con
|
|
|
1097
1182
|
history.push(new turns.ChatRequestTurn(turn.prompt ?? '', undefined, [], participant.id, []));
|
|
1098
1183
|
continue;
|
|
1099
1184
|
}
|
|
1100
|
-
|
|
1101
|
-
.map(historyText)
|
|
1102
|
-
.filter(Boolean)
|
|
1103
|
-
.join('\n\n');
|
|
1104
|
-
history.push(new turns.ChatResponseTurn([new vscode.ChatResponseMarkdownPart(markdown)], {}, participant.id));
|
|
1185
|
+
history.push(new turns.ChatResponseTurn(historyParts(oneRowPerToolCall(turn.parts ?? [])), {}, participant.id));
|
|
1105
1186
|
}
|
|
1106
1187
|
const busy = connection.session.descriptor?.turn_state === 'busy';
|
|
1107
1188
|
return {
|
|
1108
1189
|
title: connection.label,
|
|
1109
|
-
options: controls?.currentOptions(resource),
|
|
1190
|
+
options: controls?.attached(connection) ? undefined : controls?.currentOptions(resource),
|
|
1110
1191
|
history,
|
|
1111
1192
|
requestHandler: boundHandler,
|
|
1112
1193
|
activeResponseCallback: busy
|
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.
|
|
4
|
+
"version": "0.1.16",
|
|
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",
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
15
|
"files": [
|
|
16
|
+
"LICENSE-MIT",
|
|
17
|
+
"LICENSE-APACHE",
|
|
16
18
|
"dist",
|
|
17
19
|
"vendor/supercode-frontend",
|
|
18
20
|
"scripts/pack-extension.mjs",
|
|
@@ -191,7 +193,7 @@
|
|
|
191
193
|
},
|
|
192
194
|
"supercodeFrontendContract": {
|
|
193
195
|
"name": "@volter/supercode-frontend",
|
|
194
|
-
"version": "0.2.
|
|
196
|
+
"version": "0.2.7",
|
|
195
197
|
"mode": "generated-artifact"
|
|
196
198
|
},
|
|
197
199
|
"license": "MIT OR Apache-2.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-frontend",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Generated language-neutral attachment client for Volter Harness SDK runtimes",
|
|
6
6
|
"exports": {
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"types": "./index.d.ts",
|
|
18
18
|
"files": [
|
|
19
|
+
"LICENSE-MIT",
|
|
20
|
+
"LICENSE-APACHE",
|
|
19
21
|
"client.mjs",
|
|
20
22
|
"index.d.ts",
|
|
21
23
|
"generated.mjs",
|