@volter/supercode-frontend-vscode 0.1.17 → 0.1.20

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/NOTICE.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Third-party notice
2
2
 
3
- This optional frontend has **no runtime npm dependency**. It builds against `@types/vscode`
3
+ This optional frontend needs **no runtime npm installation**. Its form-schema validator
4
+ bundles Ajv 8.17.1, ajv-formats 3.0.1 and their dependencies; their license texts ship in
5
+ `dist/request-schema.LICENSE.txt`. esbuild bundles that one module during the build.
6
+ The validator does not fetch external schema references or change answer values.
7
+ It builds against `@types/vscode`
4
8
  (Copyright (c) Microsoft Corporation, MIT) as an exact devDependency for types only; `vscode` itself
5
9
  is supplied by the editor at runtime and is never bundled or redistributed here.
6
10
 
package/README.md CHANGED
@@ -102,11 +102,25 @@ and returns its new scoped connection. The host owns validation, process lifetim
102
102
  persistence, and failure handling. Prompts and approvals still use the generated frontend client.
103
103
  The contract is in `src/host-controls.ts`.
104
104
 
105
- With that host, **Chat: New Chat: Choose Harness, Model and Reasoning** chooses
106
- configuration before opening a separate conversation. A conversation's harness, model and
107
- reasoning settings remain fixed: this integration does not advertise hot swapping. Native
108
- Chat displays its selected model and provider icon inside the composer and its supported
109
- approval policy below it. The response author identifies the harness.
105
+ With that host, **New Session** / **Chat: New Chat: Choose Agent** asks only
106
+ which startable agent to use. It refreshes the host's available choices first;
107
+ with one agent it opens immediately, and with none it returns to setup. Model
108
+ and reasoning are sent as empty values, leaving both at the harness's own defaults,
109
+ even if the previous conversation used explicit settings. Cancelling the agent
110
+ picker creates nothing.
111
+
112
+ The composer's native **Model settings** control offers **Choose model and reasoning
113
+ for a new chat…** for Claude Code and Codex. This optional path retains the model
114
+ list, exact model ID entry and reasoning choices. Only completing the choices
115
+ starts a separate conversation; cancelling either leaves the current one intact.
116
+ A conversation's harness, model and reasoning remain fixed: this integration does
117
+ not advertise hot swapping. The built-in model picker still displays the selected
118
+ model and provider icon; nondelegating session providers cannot add its Manage
119
+ Models action, so configuration uses the native session-options command door.
120
+ The response author identifies the harness. Other harnesses keep their own defaults.
121
+
122
+ This simplified creation flow is source-only pending frontend compilation and a
123
+ live check of zero/one picker, cancellation, defaults and explicit configuration.
110
124
 
111
125
  The host publishes durable conversation IDs and their exact harness history identities.
112
126
  `POST /open` resumes only the requested saved conversation; `POST /remember` binds its
package/dist/extension.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { adaptRequestSchema, fieldControl, objectValue, requestValidator } from './request-schema.js';
1
2
  import { resolveSessionBinding } from './bindings.js';
2
3
  import { withTextContext } from './context.js';
3
4
  import { randomUUID } from 'node:crypto';
@@ -451,7 +452,7 @@ export async function activate(context) {
451
452
  statusIcon: new vscode.ThemeIcon(provider === 'anthropic' ? 'claude' : provider === 'openai' ? 'openai' : provider === 'google' ? 'google-gemini' : 'sparkle'),
452
453
  maxInputTokens: 0, maxOutputTokens: 0, capabilities: {},
453
454
  targetChatSessionType: SESSION_SCHEME, isUserSelectable: true, isDefault: model.id === selection.model,
454
- tooltip: `${model.name} via ${harnessDisplayName(selection.harness)}${selection.effort ? ` · ${selection.effort} reasoning` : ''}. Model is fixed for this conversation. Use New Chat to choose another model.`,
455
+ tooltip: `${model.name} via ${harnessDisplayName(selection.harness)}${selection.effort ? ` · ${selection.effort} reasoning` : ''}. Model is fixed for this conversation. Use Model settings to choose model and reasoning for a new conversation.`,
455
456
  };
456
457
  });
457
458
  },
@@ -671,6 +672,16 @@ export async function activate(context) {
671
672
  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.' },
672
673
  ...((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.' }] : [])];
673
674
  const groups = [{ id: 'permissions', name: 'Permissions', kind: 'permissions', items: permissionItems, selected: permissionItems.find(i => i.id === (resource ? currentOptions(resource).permissions : 'ask')) }];
675
+ const selected = controls?.state.sessions.find(session => session.id === id);
676
+ if (selected && ['claude-code', 'codex'].includes(selected.selection.harness)) {
677
+ // Native session-option commands remain reachable for nondelegating providers,
678
+ // whose built-in model picker deliberately omits Manage Models. Do not advertise
679
+ // hot swapping: the command opens a separate conversation after both choices.
680
+ // A locked selected item hides the entire native dropdown, including commands.
681
+ const item = { id: 'settings', name: 'Model settings' };
682
+ groups.push({ id: 'modelSettings', name: 'Model', items: [item], selected: item,
683
+ commands: [{ command: 'supercode.frontend.configureModel', title: 'Choose model and reasoning for a new chat…', arguments: [selected.id] }] });
684
+ }
674
685
  return groups;
675
686
  },
676
687
  setPermission: (resource, value) => {
@@ -685,7 +696,7 @@ export async function activate(context) {
685
696
  create: async (inputState) => {
686
697
  if (!controls)
687
698
  throw new Error('The host does not expose conversation creation.');
688
- await enqueueSelection({ ...controls.state.selection }, false);
699
+ await enqueueSelection({ harness: controls.state.selection.harness, model: '', effort: '' }, false);
689
700
  const connection = frontends.get(controls.state.activeSession);
690
701
  savePermission(connection.id, turnPermission(inputState.groups.find(group => group.id === 'permissions')?.selected?.id));
691
702
  return connection;
@@ -737,15 +748,43 @@ export async function activate(context) {
737
748
  void vscode.window.showInformationMessage('This host does not expose chat configuration.');
738
749
  return;
739
750
  }
740
- const selection = { ...controls.state.selection };
741
- const harness = await vscode.window.showQuickPick(controls.state.harnesses.map(h => ({ label: h.name, id: h.id })), { title: 'New chat · Harness', placeHolder: 'Choose the harness for a new conversation. Existing chats keep their harness and history.' });
751
+ await controls.refresh();
752
+ // Sign-in choices stay visible alongside agents that can be explicitly started.
753
+ const login = controls.state.setup?.actions.filter(action => action.kind === 'login') ?? [];
754
+ const choices = [
755
+ ...login.map(action => ({ label: action.name, id: action.harness, description: 'Sign in…', login: true, autoStart: false })),
756
+ ...controls.state.harnesses.filter(h => !login.some(action => action.harness === h.id))
757
+ .map(h => ({ label: h.name, id: h.id, description: h.description, login: false, autoStart: h.autoStart === true })),
758
+ ];
759
+ if (!choices.length) {
760
+ await revealSetup();
761
+ return;
762
+ }
763
+ // A sole sign-in option still requires a deliberate click before opening its terminal.
764
+ const harness = choices.length === 1 && choices[0].autoStart ? choices[0] : await vscode.window.showQuickPick(choices, { title: 'New chat · Agent', placeHolder: 'Choose your coding agent. Model and reasoning use its defaults.' });
742
765
  if (!harness)
743
766
  return;
744
- if (harness.id !== selection.harness) {
745
- selection.harness = harness.id;
746
- selection.model = '';
747
- selection.effort = '';
767
+ if (harness.login) {
768
+ await vscode.commands.executeCommand('supercode.frontend.setup', 'login', harness.id);
769
+ return;
748
770
  }
771
+ await enqueueSelection({ harness: harness.id, model: '', effort: '' });
772
+ }));
773
+ context.subscriptions.push(vscode.commands.registerCommand('supercode.frontend.configureModel', async (resource, sessionId) => {
774
+ if (!controls || focusedAttached)
775
+ throw new Error('Model settings require a host-managed conversation.');
776
+ await controls.refresh();
777
+ // The native session-options picker prepends its exact resource to command arguments.
778
+ const bound = resource ? boundId(resource) : undefined;
779
+ if (resource && (!bound || (sessionId && bound !== sessionId)))
780
+ throw new Error('Model settings have no matching conversation binding.');
781
+ const id = bound ?? controls.state.activeSession;
782
+ const selected = controls.state.sessions.find(session => session.id === id);
783
+ if (!selected || selected.id !== controls.state.activeSession)
784
+ throw new Error('Open this conversation before choosing model settings.');
785
+ const selection = { ...selected.selection };
786
+ if (!['claude-code', 'codex'].includes(selection.harness))
787
+ throw new Error('This harness uses its own model defaults; configuration is not advertised.');
749
788
  if (['claude-code', 'codex'].includes(selection.harness)) {
750
789
  const choices = controls.state.modelsByHarness?.[selection.harness] ?? [{ id: '', name: 'Harness default' }];
751
790
  const picked = await vscode.window.showQuickPick([...choices.map(model => ({ label: model.name, id: model.id })), { label: 'Enter an exact model ID…', id: '__custom__' }], { title: 'New chat · Model', placeHolder: 'Model availability depends on your harness account.' });
@@ -845,9 +884,14 @@ export async function activate(context) {
845
884
  // and an elicitation's free-text content).
846
885
  const pending = pendingRequestOf(connection);
847
886
  if (pending) {
848
- const answer = typedAnswer(pending, request.prompt);
849
- await connection.session.respond(answer);
850
- stream.markdown(`_answered request #${pending.id}: ${opaqueText(answer, 256)}_`);
887
+ try {
888
+ const answer = typedAnswer(pending, request.prompt);
889
+ await connection.session.respond(answer);
890
+ stream.markdown(`_answered request #${pending.id}: ${opaqueText(answer, 256)}_`);
891
+ }
892
+ catch (error) {
893
+ stream.markdown(`Could not answer request #${pending.id}: ${opaqueText(String(error.message), 512)}`);
894
+ }
851
895
  return {};
852
896
  }
853
897
  if (request.prompt.trim().length === 0) {
@@ -942,17 +986,13 @@ export async function activate(context) {
942
986
  return;
943
987
  }
944
988
  let response = answer.response;
945
- if (answer.promptForContent) {
946
- const content = await vscode.window.showInputBox({
947
- title: 'Volter Harness runtime request',
948
- prompt: 'The runtime asked for a value; a button cannot carry one.',
949
- ignoreFocusOut: true,
950
- });
951
- if (content === undefined)
952
- return;
953
- response = { ...response, content };
954
- }
955
989
  try {
990
+ if (answer.promptForContent) {
991
+ const content = await requestContent(request);
992
+ if (content === undefined)
993
+ return;
994
+ response = { ...response, content };
995
+ }
956
996
  await connection.session.respond(response);
957
997
  void vscode.window.setStatusBarMessage(`Volter Harness: ${resolutionSentence(response, request, answer.requestId)}`, 4000);
958
998
  }
@@ -1466,3 +1506,155 @@ function registerSessions(context, frontends, participant, granted, handler, con
1466
1506
  },
1467
1507
  }, participant, { supportsInterruptions: true }));
1468
1508
  }
1509
+ /** Collect each question through the existing Chat answer button, preserving ids and secrets. */
1510
+ async function requestContent(request) {
1511
+ const payload = request.payload;
1512
+ if (Array.isArray(payload?.questions)) {
1513
+ const answers = Object.create(null);
1514
+ for (const value of payload.questions) {
1515
+ if (!value || typeof value !== 'object' || Array.isArray(value) || typeof value.id !== 'string')
1516
+ continue;
1517
+ const question = value;
1518
+ const options = Array.isArray(question.options) ? question.options.flatMap(option => {
1519
+ if (!option || typeof option !== 'object' || Array.isArray(option) || typeof option.label !== 'string')
1520
+ return [];
1521
+ return [{ label: option.label, description: typeof option.description === 'string' ? option.description : undefined, custom: false }];
1522
+ }) : [];
1523
+ let answer;
1524
+ if (options.length) {
1525
+ if (question.isOther === true)
1526
+ options.push({ label: 'Write an answer…', description: undefined, custom: true });
1527
+ const chosen = await vscode.window.showQuickPick(options, { title: String(question.header ?? 'Codex question'), placeHolder: String(question.question ?? ''), ignoreFocusOut: true });
1528
+ if (!chosen)
1529
+ return undefined;
1530
+ if (!chosen.custom)
1531
+ answer = chosen.label;
1532
+ }
1533
+ if (answer === undefined) {
1534
+ answer = await vscode.window.showInputBox({ title: String(question.header ?? 'Codex question'), prompt: String(question.question ?? ''), password: question.isSecret === true, ignoreFocusOut: true });
1535
+ }
1536
+ if (answer === undefined)
1537
+ return undefined;
1538
+ answers[value.id] = answer;
1539
+ }
1540
+ return answers;
1541
+ }
1542
+ const schema = payload?.requested_schema;
1543
+ if (schema === undefined || schema === null) {
1544
+ return vscode.window.showInputBox({ title: 'Runtime request', prompt: 'Enter your answer.', ignoreFocusOut: true });
1545
+ }
1546
+ const showSchema = async () => {
1547
+ const document = await vscode.workspace.openTextDocument({ language: 'json', content: JSON.stringify(schema, null, 2) });
1548
+ await vscode.window.showTextDocument(document, { preview: true, preserveFocus: true });
1549
+ };
1550
+ const adaptedSchema = adaptRequestSchema(schema, payload?.mode);
1551
+ let validate;
1552
+ const structuredFallback = async (initial) => {
1553
+ await showSchema();
1554
+ const typed = await vscode.window.showInputBox({ title: 'Runtime request', prompt: 'Enter an answer matching the displayed JSON schema.', value: initial === undefined ? undefined : JSON.stringify(initial), ignoreFocusOut: true, validateInput: value => {
1555
+ try {
1556
+ const parsed = JSON.parse(value);
1557
+ return objectValue(parsed) ? validate(parsed) : 'Enter a JSON object';
1558
+ }
1559
+ catch {
1560
+ return 'Enter valid JSON';
1561
+ }
1562
+ } });
1563
+ return typed === undefined ? undefined : JSON.parse(typed);
1564
+ };
1565
+ try {
1566
+ validate = requestValidator(adaptedSchema);
1567
+ }
1568
+ catch (error) {
1569
+ // Keep the structured-input path available with the original schema in
1570
+ // view. Never accept an answer whose constraints cannot be validated.
1571
+ const message = `Cannot validate this request schema: ${String(error.message)}`;
1572
+ validate = () => message;
1573
+ return structuredFallback();
1574
+ }
1575
+ const form = objectValue(adaptedSchema);
1576
+ const properties = objectValue(form?.properties);
1577
+ // Cross-field conditions, refs and nested schemas use the complete validated
1578
+ // JSON fallback rather than controls that would erase their semantics.
1579
+ const simpleForm = form?.type === 'object' && properties && Object.keys(form).every(key => ['$schema', 'type', 'title', 'description', 'properties', 'required', 'additionalProperties'].includes(key));
1580
+ if (!simpleForm || !properties)
1581
+ return structuredFallback();
1582
+ const fields = Object.entries(properties).map(([name, spec]) => ({ name, spec: objectValue(spec), control: objectValue(spec) ? fieldControl(objectValue(spec)) : undefined }));
1583
+ if (fields.some(field => !field.spec || !field.control))
1584
+ return structuredFallback();
1585
+ const content = Object.create(null);
1586
+ const required = Array.isArray(form.required) ? form.required : [];
1587
+ for (const { name, spec, control } of fields) {
1588
+ const field = spec;
1589
+ const title = typeof field.title === 'string' ? field.title : name;
1590
+ if (!required.includes(name)) {
1591
+ const choice = await vscode.window.showQuickPick(['Provide a value', 'Omit this field'], { title: `${title} (optional)`, ignoreFocusOut: true });
1592
+ if (!choice)
1593
+ return undefined;
1594
+ if (choice === 'Omit this field')
1595
+ continue;
1596
+ }
1597
+ let validateField;
1598
+ try {
1599
+ validateField = requestValidator(field);
1600
+ }
1601
+ catch {
1602
+ // A field can require the root's dialect or references. The full-form
1603
+ // validator already compiled, so the JSON fallback retains them.
1604
+ return structuredFallback(content);
1605
+ }
1606
+ if (control.kind === 'select') {
1607
+ const select = control;
1608
+ while (true) {
1609
+ const options = select.choices.map(choice => ({ ...choice }));
1610
+ let answer;
1611
+ if (select.multiple) {
1612
+ const selected = await vscode.window.showQuickPick(options, { title, placeHolder: typeof field.description === 'string' ? field.description : undefined, canPickMany: true, ignoreFocusOut: true });
1613
+ if (!selected)
1614
+ return undefined;
1615
+ answer = selected.map(choice => choice.value);
1616
+ }
1617
+ else {
1618
+ const selected = await vscode.window.showQuickPick(options, { title, placeHolder: typeof field.description === 'string' ? field.description : undefined, ignoreFocusOut: true });
1619
+ if (!selected)
1620
+ return undefined;
1621
+ answer = selected.value;
1622
+ }
1623
+ const error = validateField(answer);
1624
+ if (error) {
1625
+ await vscode.window.showWarningMessage(error);
1626
+ continue;
1627
+ }
1628
+ content[name] = answer;
1629
+ break;
1630
+ }
1631
+ }
1632
+ else {
1633
+ const text = control;
1634
+ const parse = (value) => {
1635
+ if (text.type === 'string')
1636
+ return value;
1637
+ if (!value.trim() || !Number.isFinite(Number(value)))
1638
+ throw new Error('Enter a valid number');
1639
+ return Number(value);
1640
+ };
1641
+ const typed = await vscode.window.showInputBox({ title, prompt: typeof field.description === 'string' ? field.description : undefined, ignoreFocusOut: true, validateInput: value => {
1642
+ try {
1643
+ return validateField(parse(value));
1644
+ }
1645
+ catch (error) {
1646
+ return error.message;
1647
+ }
1648
+ } });
1649
+ if (typed === undefined)
1650
+ return undefined;
1651
+ content[name] = parse(typed);
1652
+ }
1653
+ }
1654
+ const error = validate(content);
1655
+ if (error) {
1656
+ await vscode.window.showWarningMessage(error);
1657
+ return structuredFallback(content);
1658
+ }
1659
+ return content;
1660
+ }
@@ -9,6 +9,7 @@ export interface ChatChoice {
9
9
  id: string;
10
10
  name: string;
11
11
  description?: string;
12
+ autoStart?: boolean;
12
13
  }
13
14
  export interface ChatStarterPrompt {
14
15
  label: string;
@@ -46,6 +47,7 @@ export interface HostState {
46
47
  sessions: ManagedChatSession[];
47
48
  selection: ChatSelection;
48
49
  connection?: Record<string, string>;
50
+ /** Agents the host can start now (installation, authentication and capability checked). */
49
51
  harnesses: ChatChoice[];
50
52
  models: ChatChoice[];
51
53
  modelsByHarness?: Record<string, ChatChoice[]>;
@@ -0,0 +1,157 @@
1
+ ajv
2
+
3
+ The MIT License (MIT)
4
+
5
+ Copyright (c) 2015-2021 Evgeny Poberezkin
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+
25
+
26
+
27
+ ajv-formats
28
+
29
+ MIT License
30
+
31
+ Copyright (c) 2020 Evgeny Poberezkin
32
+
33
+ Permission is hereby granted, free of charge, to any person obtaining a copy
34
+ of this software and associated documentation files (the "Software"), to deal
35
+ in the Software without restriction, including without limitation the rights
36
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
37
+ copies of the Software, and to permit persons to whom the Software is
38
+ furnished to do so, subject to the following conditions:
39
+
40
+ The above copyright notice and this permission notice shall be included in all
41
+ copies or substantial portions of the Software.
42
+
43
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
46
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
47
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
48
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
49
+ SOFTWARE.
50
+
51
+
52
+ fast-deep-equal
53
+
54
+ MIT License
55
+
56
+ Copyright (c) 2017 Evgeny Poberezkin
57
+
58
+ Permission is hereby granted, free of charge, to any person obtaining a copy
59
+ of this software and associated documentation files (the "Software"), to deal
60
+ in the Software without restriction, including without limitation the rights
61
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
62
+ copies of the Software, and to permit persons to whom the Software is
63
+ furnished to do so, subject to the following conditions:
64
+
65
+ The above copyright notice and this permission notice shall be included in all
66
+ copies or substantial portions of the Software.
67
+
68
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
69
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
70
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
71
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
72
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
73
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
74
+ SOFTWARE.
75
+
76
+
77
+ fast-uri
78
+
79
+ Copyright (c) 2011-2021, Gary Court until https://github.com/garycourt/uri-js/commit/a1acf730b4bba3f1097c9f52e7d9d3aba8cdcaae
80
+ Copyright (c) 2021-present The Fastify team <https://github.com/fastify/fastify#team>
81
+ All rights reserved.
82
+
83
+ Redistribution and use in source and binary forms, with or without
84
+ modification, are permitted provided that the following conditions are met:
85
+ * Redistributions of source code must retain the above copyright
86
+ notice, this list of conditions and the following disclaimer.
87
+ * Redistributions in binary form must reproduce the above copyright
88
+ notice, this list of conditions and the following disclaimer in the
89
+ documentation and/or other materials provided with the distribution.
90
+ * The names of any contributors may not be used to endorse or promote
91
+ products derived from this software without specific prior written
92
+ permission.
93
+
94
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
95
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
96
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
97
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY
98
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
99
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
100
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
101
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
102
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
103
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
104
+
105
+ * * *
106
+
107
+ The complete list of contributors can be found at:
108
+ - https://github.com/garycourt/uri-js/graphs/contributors
109
+
110
+ json-schema-traverse
111
+
112
+ MIT License
113
+
114
+ Copyright (c) 2017 Evgeny Poberezkin
115
+
116
+ Permission is hereby granted, free of charge, to any person obtaining a copy
117
+ of this software and associated documentation files (the "Software"), to deal
118
+ in the Software without restriction, including without limitation the rights
119
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
120
+ copies of the Software, and to permit persons to whom the Software is
121
+ furnished to do so, subject to the following conditions:
122
+
123
+ The above copyright notice and this permission notice shall be included in all
124
+ copies or substantial portions of the Software.
125
+
126
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
127
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
128
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
129
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
130
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
131
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
132
+ SOFTWARE.
133
+
134
+
135
+ require-from-string
136
+
137
+ The MIT License (MIT)
138
+
139
+ Copyright (c) Vsevolod Strukchinsky <floatdrop@gmail.com> (github.com/floatdrop)
140
+
141
+ Permission is hereby granted, free of charge, to any person obtaining a copy
142
+ of this software and associated documentation files (the "Software"), to deal
143
+ in the Software without restriction, including without limitation the rights
144
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
145
+ copies of the Software, and to permit persons to whom the Software is
146
+ furnished to do so, subject to the following conditions:
147
+
148
+ The above copyright notice and this permission notice shall be included in
149
+ all copies or substantial portions of the Software.
150
+
151
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
152
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
153
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
154
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
155
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
156
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
157
+ THE SOFTWARE.
@@ -0,0 +1,22 @@
1
+ import type { FrontendRequest, JsonValue } from '../vendor/supercode-frontend/generated.mjs';
2
+ export declare function objectValue(value: JsonValue | undefined): Record<string, JsonValue> | undefined;
3
+ /** Adapt only Codex's typed MCP form schema. Other modes carry arbitrary JSON Schema. */
4
+ export declare function adaptRequestSchema(schema: JsonValue, mode: JsonValue | undefined): JsonValue;
5
+ /** Validate without changing answers, filling defaults, or fetching external refs. */
6
+ export declare function requestValidator(schema: JsonValue): (value: JsonValue) => string | undefined;
7
+ /** Plain-text and single-question responses retain their exact text. */
8
+ export declare function typedRequestContent(request: FrontendRequest, reply: string): JsonValue;
9
+ export interface FieldChoice {
10
+ label: string;
11
+ value: JsonValue;
12
+ }
13
+ export type FieldControl = {
14
+ kind: 'select';
15
+ choices: FieldChoice[];
16
+ multiple: boolean;
17
+ } | {
18
+ kind: 'text';
19
+ type: 'string' | 'number' | 'integer';
20
+ };
21
+ /** Only known shapes get native controls; everything else keeps its full schema. */
22
+ export declare function fieldControl(field: Record<string, JsonValue>): FieldControl | undefined;