@andorra-labs/code 0.1.11 → 0.1.12
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 +8 -2
- package/THIRD_PARTY_NOTICES.md +15 -0
- package/dist/src/agent-execution.js +15 -3
- package/dist/src/agent-mcp.js +5 -0
- package/dist/src/app-server/protocol.d.ts +8 -1
- package/dist/src/app-server/protocol.js +1 -1
- package/dist/src/app-server.d.ts +15 -0
- package/dist/src/app-server.js +89 -10
- package/dist/src/browser-panel-tool.d.ts +24 -3
- package/dist/src/browser-panel-tool.js +80 -6
- package/dist/src/browser-runner.js +3 -1
- package/dist/src/browser-view.d.ts +16 -0
- package/dist/src/browser-view.js +38 -2
- package/dist/src/claude-provider.js +15 -2
- package/dist/src/cli.d.ts +2 -1
- package/dist/src/cli.js +175 -43
- package/dist/src/code-intelligence/CodeIntelligenceManager.js +1 -1
- package/dist/src/codex-provider.js +6 -3
- package/dist/src/coding-tools.d.ts +2 -1
- package/dist/src/coding-tools.js +39 -31
- package/dist/src/completion.d.ts +43 -1
- package/dist/src/completion.js +145 -4
- package/dist/src/config.d.ts +1 -0
- package/dist/src/config.js +2 -0
- package/dist/src/decision/PreparedSteps.js +1 -1
- package/dist/src/delegation-changes.js +19 -2
- package/dist/src/diff-preview.d.ts +1 -0
- package/dist/src/diff-preview.js +12 -3
- package/dist/src/engine-streams.d.ts +22 -0
- package/dist/src/engine-streams.js +16 -0
- package/dist/src/extensions.js +17 -6
- package/dist/src/file-read-key.d.ts +8 -0
- package/dist/src/file-read-key.js +12 -0
- package/dist/src/graph-editor-session.js +2 -1
- package/dist/src/graph-health.d.ts +21 -0
- package/dist/src/graph-health.js +46 -0
- package/dist/src/graph-manager-chat.d.ts +52 -3
- package/dist/src/graph-manager-chat.js +50 -5
- package/dist/src/graph-runner.js +23 -3
- package/dist/src/graph-server.d.ts +1 -1
- package/dist/src/graph-server.js +39 -18
- package/dist/src/graph-ui/app.js +100 -30
- package/dist/src/graph-ui/controls.css +52 -0
- package/dist/src/graph-ui/icons.js +3 -0
- package/dist/src/graph-ui/index.html +2 -2
- package/dist/src/graph-ui/manager-state.js +141 -3
- package/dist/src/graph-ui/manager.css +2 -2
- package/dist/src/graph-ui/manager.js +328 -66
- package/dist/src/graph-ui/model-picker.js +279 -0
- package/dist/src/graph-ui/provider-glyphs/alibaba-cloud.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/anthropic.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/aws-bedrock.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/claude.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/deepseek.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/fireworks.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/kimi.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/minimax.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/openai.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/opencode.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/openrouter.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/xai.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/xiaomi-mimo.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/zai.png +0 -0
- package/dist/src/graphs.d.ts +2 -0
- package/dist/src/graphs.js +7 -7
- package/dist/src/mcp.d.ts +52 -14
- package/dist/src/mcp.js +285 -128
- package/dist/src/memory/ProjectMemory.d.ts +77 -0
- package/dist/src/memory/ProjectMemory.js +310 -0
- package/dist/src/memory/index.d.ts +1 -0
- package/dist/src/memory/index.js +1 -0
- package/dist/src/opencode-provider.js +5 -6
- package/dist/src/package-name.d.ts +3 -0
- package/dist/src/package-name.js +3 -0
- package/dist/src/provider-engine.js +2 -2
- package/dist/src/qa/runtime/PtyManager.js +2 -1
- package/dist/src/react-runtime.js +16 -8
- package/dist/src/remote/cert.d.ts +1 -1
- package/dist/src/remote/cert.js +2 -7
- package/dist/src/remote/client.js +1 -1
- package/dist/src/remote/pem.d.ts +6 -0
- package/dist/src/remote/pem.js +11 -0
- package/dist/src/run-records.js +49 -10
- package/dist/src/runtime.d.ts +2 -0
- package/dist/src/sessions.d.ts +3 -1
- package/dist/src/sessions.js +5 -3
- package/dist/src/sign-in-detection.d.ts +82 -0
- package/dist/src/sign-in-detection.js +197 -0
- package/dist/src/sign-in-offer.d.ts +35 -0
- package/dist/src/sign-in-offer.js +116 -0
- package/dist/src/skills/bundled/graph-manager/SKILL.md +22 -4
- package/dist/src/skills/bundled/provenance.json +1 -1
- package/dist/src/skills/runtime-skills.d.ts +6 -0
- package/dist/src/skills/runtime-skills.js +13 -0
- package/dist/src/stray-files.d.ts +14 -0
- package/dist/src/stray-files.js +81 -0
- package/dist/src/subagent-run.js +6 -1
- package/dist/src/terminal-ui.d.ts +1 -1
- package/dist/src/terminal-ui.js +9 -3
- package/dist/src/tool-activity.js +1 -1
- package/dist/src/tool-schema-compatibility.d.ts +7 -2
- package/dist/src/tool-schema-compatibility.js +8 -4
- package/dist/src/transcript.d.ts +5 -0
- package/dist/src/transcript.js +11 -3
- package/dist/src/types.d.ts +2 -0
- package/dist/src/untracked-file-removal.d.ts +3 -0
- package/dist/src/untracked-file-removal.js +125 -0
- package/dist/src/update-check.js +1 -1
- package/dist/src/update.d.ts +11 -1
- package/dist/src/update.js +27 -5
- package/dist/src/workspace-git-metadata.d.ts +15 -0
- package/dist/src/workspace-git-metadata.js +50 -1
- package/dist/src/workspace-instructions.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The editor's model picker: the desktop's chat model control (desktop/src/components/ProviderModelPicker.tsx)
|
|
3
|
+
* drawn without React, so a step's model and Graph Manager's model are chosen the way a task's is.
|
|
4
|
+
*
|
|
5
|
+
* The closed control is a field-sized button naming the model, with its provider's mark and name. It
|
|
6
|
+
* opens one column on the menu material: a search field, an optional pinned default row, and every
|
|
7
|
+
* model grouped under its provider's name, each row with the provider's mark and a check on the chosen
|
|
8
|
+
* one. The keys stay in the search field: Up and Down walk the rows, Enter chooses, Escape and Tab close.
|
|
9
|
+
*
|
|
10
|
+
* The caller owns the data. `modelPickerButton` in app.js builds the trigger and hangs a spec on it:
|
|
11
|
+
*
|
|
12
|
+
* { ariaLabel, groups() -> [{ provider: {id, label, type, baseUrl}, models: [{model, note}] }],
|
|
13
|
+
* selected() -> {provider, model} | null, defaultRow() -> {label, hint, selected} | undefined,
|
|
14
|
+
* pick({provider, model}), pickDefault(), onOpen() }
|
|
15
|
+
*
|
|
16
|
+
* The panel reads the spec each time it draws, so `refresh(trigger)` redraws an open panel when
|
|
17
|
+
* discovery adds models while it is open.
|
|
18
|
+
*/
|
|
19
|
+
'use strict';
|
|
20
|
+
(() => {
|
|
21
|
+
if (typeof document === 'undefined' || typeof window === 'undefined') return;
|
|
22
|
+
|
|
23
|
+
const PANEL_WIDTH = 320;
|
|
24
|
+
const PANEL_MAX_HEIGHT = 440;
|
|
25
|
+
const INSET = 8;
|
|
26
|
+
const GAP = 6;
|
|
27
|
+
|
|
28
|
+
const make = (tag, className, text) => {
|
|
29
|
+
const node = document.createElement(tag);
|
|
30
|
+
if (className) node.className = className;
|
|
31
|
+
if (text !== undefined) node.textContent = String(text);
|
|
32
|
+
return node;
|
|
33
|
+
};
|
|
34
|
+
const icon = (name, size = 14) => globalThis.AndorraIcons?.icon?.(name, size) || null;
|
|
35
|
+
|
|
36
|
+
// The provider marks the desktop draws (desktop/src/engine/providerPresets.ts `providerLogo`): by the
|
|
37
|
+
// provider's type first, then by the vendor domain its endpoint is on. The glyph files are the
|
|
38
|
+
// desktop's own (desktop/src/assets/providers/glyphs), copied beside the editor at build time.
|
|
39
|
+
const TYPE_LOGOS = { codex: 'openai', claude: 'claude', 'opencode-go': 'opencode', grok: 'xai', opencode: 'opencode' };
|
|
40
|
+
const DOMAIN_LOGOS = {
|
|
41
|
+
'openai.com': 'openai', 'anthropic.com': 'anthropic', 'x.ai': 'xai', 'moonshot.ai': 'kimi', 'kimi.ai': 'kimi',
|
|
42
|
+
'kimi.com': 'kimi', 'z.ai': 'zai', 'minimax.io': 'minimax', 'deepseek.com': 'deepseek', 'aliyuncs.com': 'alibaba-cloud',
|
|
43
|
+
'xiaomimimo.com': 'xiaomi-mimo', 'openrouter.ai': 'openrouter', 'opencode.ai': 'opencode', 'api.aws': 'aws-bedrock',
|
|
44
|
+
'fireworks.ai': 'fireworks',
|
|
45
|
+
};
|
|
46
|
+
function logoFor(provider) {
|
|
47
|
+
if (!provider) return undefined;
|
|
48
|
+
if (TYPE_LOGOS[provider.type]) return TYPE_LOGOS[provider.type];
|
|
49
|
+
let host = '';
|
|
50
|
+
try { host = new URL(provider.baseUrl || '').hostname.toLowerCase(); } catch { return undefined; }
|
|
51
|
+
for (const [domain, logo] of Object.entries(DOMAIN_LOGOS)) if (host === domain || host.endsWith('.' + domain)) return logo;
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** A provider's mark: its vendor glyph in the row's icon ink, or the neutral boxes. */
|
|
56
|
+
function mark(provider) {
|
|
57
|
+
const holder = make('span', 'select-option-icon model-picker-mark');
|
|
58
|
+
holder.setAttribute('aria-hidden', 'true');
|
|
59
|
+
const logo = logoFor(provider);
|
|
60
|
+
if (logo) {
|
|
61
|
+
const glyph = make('span', 'model-picker-glyph');
|
|
62
|
+
glyph.style.setProperty('--provider-glyph', `url("/provider-glyphs/${logo}.png")`);
|
|
63
|
+
holder.append(glyph);
|
|
64
|
+
} else {
|
|
65
|
+
const glyph = icon('boxes', 14);
|
|
66
|
+
if (glyph) holder.append(glyph);
|
|
67
|
+
}
|
|
68
|
+
return holder;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let current = null;
|
|
72
|
+
let seq = 0;
|
|
73
|
+
|
|
74
|
+
function close(refocus = false) {
|
|
75
|
+
const open = current;
|
|
76
|
+
if (!open) return;
|
|
77
|
+
current = null;
|
|
78
|
+
open.teardown();
|
|
79
|
+
open.trigger.setAttribute('aria-expanded', 'false');
|
|
80
|
+
if (refocus && open.trigger.isConnected) open.trigger.focus({ preventScroll: true });
|
|
81
|
+
const done = () => open.panel.remove();
|
|
82
|
+
if (window.AndorraControls?.leave) window.AndorraControls.leave(open.panel, done); else done();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function open(trigger) {
|
|
86
|
+
const spec = trigger.modelPicker;
|
|
87
|
+
if (!spec || trigger.disabled) return;
|
|
88
|
+
close();
|
|
89
|
+
const id = `model-picker-${++seq}`;
|
|
90
|
+
const panel = make('div', 'select-panel model-picker-panel');
|
|
91
|
+
panel.id = id;
|
|
92
|
+
panel.setAttribute('role', 'dialog');
|
|
93
|
+
panel.setAttribute('aria-label', spec.ariaLabel || 'Model');
|
|
94
|
+
const search = make('div', 'select-search model-picker-search');
|
|
95
|
+
const searchIcon = make('span', 'select-search-icon'); searchIcon.setAttribute('aria-hidden', 'true');
|
|
96
|
+
const glass = icon('search', 14); if (glass) searchIcon.append(glass);
|
|
97
|
+
const input = make('input');
|
|
98
|
+
input.type = 'text';
|
|
99
|
+
input.placeholder = 'Search models';
|
|
100
|
+
input.spellcheck = false;
|
|
101
|
+
input.setAttribute('aria-label', 'Search models');
|
|
102
|
+
input.setAttribute('role', 'combobox');
|
|
103
|
+
input.setAttribute('aria-expanded', 'true');
|
|
104
|
+
input.setAttribute('aria-autocomplete', 'list');
|
|
105
|
+
input.setAttribute('aria-controls', `${id}-list`);
|
|
106
|
+
search.append(searchIcon, input);
|
|
107
|
+
const list = make('div', 'select-list model-picker-list');
|
|
108
|
+
list.id = `${id}-list`;
|
|
109
|
+
list.setAttribute('role', 'listbox');
|
|
110
|
+
list.setAttribute('aria-label', 'Models');
|
|
111
|
+
// A press on a row must not take the caret out of the search field, where the keys live.
|
|
112
|
+
list.addEventListener('mousedown', event => event.preventDefault());
|
|
113
|
+
panel.append(search, list);
|
|
114
|
+
|
|
115
|
+
const host = trigger.closest?.('dialog[open]') || document.body;
|
|
116
|
+
host.append(panel);
|
|
117
|
+
|
|
118
|
+
let rows = [];
|
|
119
|
+
let active = 0;
|
|
120
|
+
let seeded = false;
|
|
121
|
+
|
|
122
|
+
function setActive(index, scroll = true) {
|
|
123
|
+
if (!rows.length) return;
|
|
124
|
+
active = Math.max(0, Math.min(rows.length - 1, index));
|
|
125
|
+
rows.forEach((row, at) => { if (at === active) row.element.setAttribute('data-active', 'true'); else row.element.removeAttribute('data-active'); });
|
|
126
|
+
input.setAttribute('aria-activedescendant', rows[active].element.id);
|
|
127
|
+
if (scroll) rows[active].element.scrollIntoView?.({ block: 'nearest' });
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function choose(row) {
|
|
131
|
+
if (!row) return;
|
|
132
|
+
close(true);
|
|
133
|
+
if (row.kind === 'default') spec.pickDefault?.();
|
|
134
|
+
else spec.pick?.(row.choice);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const keyOf = row => row ? (row.kind === 'default' ? 'default' : JSON.stringify([row.choice.provider, row.choice.model])) : undefined;
|
|
138
|
+
function draw() {
|
|
139
|
+
const q = input.value.trim().toLowerCase();
|
|
140
|
+
// A redraw (discovery adding models) must keep the walker on the same row, not the same index:
|
|
141
|
+
// a group growing above it would otherwise move Enter onto another model.
|
|
142
|
+
const walked = keyOf(rows[active]);
|
|
143
|
+
const chosen = spec.selected?.() || null;
|
|
144
|
+
const fallback = spec.defaultRow?.();
|
|
145
|
+
list.replaceChildren();
|
|
146
|
+
rows = [];
|
|
147
|
+
const row = (kind, element, choice) => {
|
|
148
|
+
element.id = `${id}-${rows.length}`;
|
|
149
|
+
element.setAttribute('role', 'option');
|
|
150
|
+
const index = rows.length;
|
|
151
|
+
element.addEventListener('pointermove', () => { if (active !== index) setActive(index, false); });
|
|
152
|
+
element.addEventListener('click', () => choose(rows[index]));
|
|
153
|
+
rows.push({ kind, element, choice });
|
|
154
|
+
return element;
|
|
155
|
+
};
|
|
156
|
+
const check = () => {
|
|
157
|
+
const holder = make('span', 'select-check model-picker-check'); holder.setAttribute('aria-hidden', 'true');
|
|
158
|
+
const glyph = icon('check', 14); if (glyph) holder.append(glyph); else holder.textContent = '✓';
|
|
159
|
+
return holder;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const showDefault = fallback && (!q || fallback.label.toLowerCase().includes(q) || 'default'.startsWith(q));
|
|
163
|
+
if (showDefault) {
|
|
164
|
+
const element = make('div', 'select-option model-picker-default');
|
|
165
|
+
if (fallback.hint) element.dataset.hint = 'true';
|
|
166
|
+
element.setAttribute('aria-selected', String(!!fallback.selected));
|
|
167
|
+
const text = make('span', 'select-option-label model-picker-default-text');
|
|
168
|
+
text.append(make('span', 'model-picker-default-label', fallback.label));
|
|
169
|
+
if (fallback.hint) text.append(make('span', 'model-picker-default-hint', fallback.hint));
|
|
170
|
+
element.append(text);
|
|
171
|
+
if (fallback.selected) element.append(check());
|
|
172
|
+
list.append(row('default', element));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const groups = (spec.groups?.() || []).map(group => {
|
|
176
|
+
const label = group.provider.label || group.provider.id;
|
|
177
|
+
const providerHit = label.toLowerCase().includes(q) || group.provider.id.toLowerCase().includes(q);
|
|
178
|
+
return { ...group, label, models: group.models.filter(entry => !q || providerHit || entry.model.toLowerCase().includes(q)) };
|
|
179
|
+
}).filter(group => group.models.length);
|
|
180
|
+
if (showDefault && groups.length) { const divider = make('div', 'select-divider'); divider.setAttribute('aria-hidden', 'true'); list.append(divider); }
|
|
181
|
+
for (const group of groups) {
|
|
182
|
+
const block = make('div', 'select-group-block');
|
|
183
|
+
block.setAttribute('role', 'group');
|
|
184
|
+
block.setAttribute('aria-label', group.label);
|
|
185
|
+
const heading = make('div', 'select-group', group.label); heading.setAttribute('aria-hidden', 'true');
|
|
186
|
+
block.append(heading);
|
|
187
|
+
for (const entry of group.models) {
|
|
188
|
+
const picked = !fallback?.selected && chosen?.provider === group.provider.id && chosen?.model === entry.model;
|
|
189
|
+
const element = make('div', 'select-option model-picker-model');
|
|
190
|
+
element.setAttribute('aria-selected', String(picked));
|
|
191
|
+
element.setAttribute('aria-label', entry.note ? `${entry.model}, ${entry.note}` : entry.model);
|
|
192
|
+
element.title = entry.model;
|
|
193
|
+
element.append(mark(group.provider), make('span', 'select-option-label', entry.model));
|
|
194
|
+
if (entry.note) element.append(make('span', 'model-picker-meta', entry.note));
|
|
195
|
+
if (picked) element.append(check());
|
|
196
|
+
block.append(row('model', element, { provider: group.provider.id, model: entry.model }));
|
|
197
|
+
}
|
|
198
|
+
list.append(block);
|
|
199
|
+
}
|
|
200
|
+
if (!rows.length) list.append(make('div', 'select-empty', 'No matching models'));
|
|
201
|
+
|
|
202
|
+
// The walker starts on what the eye already has: the chosen model, else the chosen default.
|
|
203
|
+
if (!seeded || q !== draw.lastQuery) {
|
|
204
|
+
const picked = rows.findIndex(item => item.element.getAttribute('aria-selected') === 'true');
|
|
205
|
+
active = !q && picked >= 0 ? picked : 0;
|
|
206
|
+
seeded = true;
|
|
207
|
+
} else {
|
|
208
|
+
const kept = rows.findIndex(item => keyOf(item) === walked);
|
|
209
|
+
if (kept >= 0) active = kept;
|
|
210
|
+
}
|
|
211
|
+
draw.lastQuery = q;
|
|
212
|
+
// The pinned default row must not cover the walked row when it scrolls into view.
|
|
213
|
+
const pinned = list.querySelector('.model-picker-default');
|
|
214
|
+
list.style.scrollPaddingTop = pinned ? `${pinned.offsetHeight}px` : '';
|
|
215
|
+
setActive(active);
|
|
216
|
+
place();
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** The column hangs from the trigger: below it when there is room, above otherwise. */
|
|
220
|
+
function place() {
|
|
221
|
+
if (!trigger.isConnected) { close(); return; }
|
|
222
|
+
const anchor = trigger.getBoundingClientRect();
|
|
223
|
+
const width = Math.max(0, Math.min(Math.max(PANEL_WIDTH, anchor.width), window.innerWidth - INSET * 2));
|
|
224
|
+
const left = Math.max(INSET, Math.min(anchor.left, window.innerWidth - width - INSET));
|
|
225
|
+
panel.style.width = `${width}px`;
|
|
226
|
+
panel.style.maxHeight = 'none';
|
|
227
|
+
const natural = panel.getBoundingClientRect().height || 320;
|
|
228
|
+
const height = Math.min(natural, PANEL_MAX_HEIGHT, Math.max(0, window.innerHeight - INSET * 2));
|
|
229
|
+
const roomAbove = Math.max(0, anchor.top - GAP - INSET);
|
|
230
|
+
const roomBelow = Math.max(0, window.innerHeight - anchor.bottom - GAP - INSET);
|
|
231
|
+
const below = roomBelow >= height || roomBelow >= roomAbove;
|
|
232
|
+
const maxHeight = Math.min(PANEL_MAX_HEIGHT, below ? roomBelow : roomAbove);
|
|
233
|
+
const visible = Math.min(height, maxHeight);
|
|
234
|
+
panel.style.maxHeight = `${maxHeight}px`;
|
|
235
|
+
panel.style.left = `${left}px`;
|
|
236
|
+
panel.style.top = `${Math.max(INSET, below ? anchor.bottom + GAP : anchor.top - GAP - visible)}px`;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
input.addEventListener('input', () => draw());
|
|
240
|
+
input.addEventListener('keydown', event => {
|
|
241
|
+
if (event.isComposing || event.keyCode === 229) return;
|
|
242
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); setActive(active + (event.key === 'ArrowDown' ? 1 : -1)); }
|
|
243
|
+
else if (event.key === 'PageDown' || event.key === 'PageUp') { event.preventDefault(); setActive(event.key === 'PageUp' ? 0 : rows.length - 1); }
|
|
244
|
+
else if (event.key === 'Enter') { event.preventDefault(); choose(rows[active]); }
|
|
245
|
+
else if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation(); close(true); }
|
|
246
|
+
else if (event.key === 'Tab') close(false);
|
|
247
|
+
});
|
|
248
|
+
const outside = event => { if (!panel.contains(event.target) && !trigger.contains(event.target)) close(); };
|
|
249
|
+
const follow = event => { if (event?.target instanceof Node && panel.contains(event.target)) return; place(); };
|
|
250
|
+
const blur = () => close();
|
|
251
|
+
document.addEventListener('pointerdown', outside, true);
|
|
252
|
+
window.addEventListener('resize', follow);
|
|
253
|
+
document.addEventListener('scroll', follow, true);
|
|
254
|
+
window.addEventListener('blur', blur);
|
|
255
|
+
|
|
256
|
+
current = {
|
|
257
|
+
trigger, panel, draw,
|
|
258
|
+
teardown() {
|
|
259
|
+
document.removeEventListener('pointerdown', outside, true);
|
|
260
|
+
window.removeEventListener('resize', follow);
|
|
261
|
+
document.removeEventListener('scroll', follow, true);
|
|
262
|
+
window.removeEventListener('blur', blur);
|
|
263
|
+
panel.setAttribute('aria-hidden', 'true');
|
|
264
|
+
panel.removeAttribute('id');
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
trigger.setAttribute('aria-expanded', 'true');
|
|
268
|
+
trigger.setAttribute('aria-controls', id);
|
|
269
|
+
draw();
|
|
270
|
+
input.focus({ preventScroll: true });
|
|
271
|
+
spec.onOpen?.();
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function toggle(trigger) { if (current?.trigger === trigger) close(true); else open(trigger); }
|
|
275
|
+
/** Redraw an open panel after its models changed; a closed trigger needs nothing. */
|
|
276
|
+
function refresh(trigger) { if (current?.trigger === trigger) current.draw(); }
|
|
277
|
+
|
|
278
|
+
window.AndorraModelPicker = Object.freeze({ open, close, toggle, refresh, mark, logoFor });
|
|
279
|
+
})();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/src/graphs.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export interface ContextPolicy {
|
|
|
24
24
|
maxChars?: number;
|
|
25
25
|
conversation?: 'reuse' | 'isolate';
|
|
26
26
|
skillInheritance?: 'inherit' | 'none';
|
|
27
|
+
/** false keeps project memory out of this node: no recalled index and no memory tools. */
|
|
28
|
+
projectMemory?: boolean;
|
|
27
29
|
}
|
|
28
30
|
export interface AgentLimits {
|
|
29
31
|
maxIterations?: number;
|
package/dist/src/graphs.js
CHANGED
|
@@ -133,7 +133,7 @@ export const GRAPH_MANAGER_GRAPH_ID = 'andorra-graph-manager';
|
|
|
133
133
|
export const GRAPH_MANAGER_HARNESS = {
|
|
134
134
|
schemaVersion: 3, id: GRAPH_MANAGER_GRAPH_ID, name: 'Graph Manager', revision: 1, entry: 'manager',
|
|
135
135
|
nodes: {
|
|
136
|
-
manager: { id: 'manager', name: 'Graph Manager', type: 'agent', executor: 'react-basic', instruction: 'You are Graph Manager inside Graph Studio. Before acting, load the bundled skill andorra:graph-manager with read_skill_resource and follow it. Work only through the graphs tool; never write graph files. Reply to the user in the conversation; when a choice is theirs, ask in your reply and wait for their next message.', contextPolicy: { history: true }, position: { x: 120, y: 120 } },
|
|
136
|
+
manager: { id: 'manager', name: 'Graph Manager', type: 'agent', executor: 'react-basic', instruction: 'You are Graph Manager inside Graph Studio. Before acting, load the bundled skill andorra:graph-manager with read_skill_resource and follow it. Work only through the graphs tool; never write graph files. You have no codebase: never search, read or run commands on any files: not the user files, not the Andorra source code. The graph guide (graphs action andorra_graph_guide), the skill and validation messages are your only references; when they leave a value unclear, ask the user. Reply to the user in the conversation; when a choice is theirs, ask in your reply and wait for their next message.', contextPolicy: { history: true }, position: { x: 120, y: 120 } },
|
|
137
137
|
done: { id: 'done', name: 'Done', type: 'end', position: { x: 440, y: 120 } },
|
|
138
138
|
}, edges: [{ id: 'manager-done', source: 'manager', target: 'done', outcome: 'completed' }],
|
|
139
139
|
};
|
|
@@ -745,7 +745,7 @@ function validateGraphInternal(value, options = {}) {
|
|
|
745
745
|
capabilities(node.capabilities, label);
|
|
746
746
|
if (node.contextPolicy !== undefined) {
|
|
747
747
|
const c = node.contextPolicy;
|
|
748
|
-
if (!record(c) || (c.history !== undefined && typeof c.history !== 'boolean') || (c.predecessors !== undefined && !['none', 'direct', 'all'].includes(c.predecessors)) || (c.conversation !== undefined && !['reuse', 'isolate'].includes(c.conversation)) || (c.skillInheritance !== undefined && !['inherit', 'none'].includes(c.skillInheritance)))
|
|
748
|
+
if (!record(c) || (c.history !== undefined && typeof c.history !== 'boolean') || (c.predecessors !== undefined && !['none', 'direct', 'all'].includes(c.predecessors)) || (c.conversation !== undefined && !['reuse', 'isolate'].includes(c.conversation)) || (c.skillInheritance !== undefined && !['inherit', 'none'].includes(c.skillInheritance)) || (c.projectMemory !== undefined && typeof c.projectMemory !== 'boolean'))
|
|
749
749
|
fail(`${label}: invalid context policy`);
|
|
750
750
|
bounds(c.maxChars, `${label} context maxChars`);
|
|
751
751
|
}
|
|
@@ -891,7 +891,7 @@ function validateGraphInternal(value, options = {}) {
|
|
|
891
891
|
bounds(s.maxWallTimeMs, `${label} maxWallTimeMs`);
|
|
892
892
|
for (const [k, values] of Object.entries({ modelPolicy: ['inherit', 'specific', 'per-role'], workspace: ['shared-read-only', 'shared-write', 'worktree'], toolInheritance: ['restricted', 'inherit'], context: ['selected', 'task-only'] }))
|
|
893
893
|
if (s[k] !== undefined && !values.includes(s[k]))
|
|
894
|
-
fail(`${label}: invalid subagent ${k}`);
|
|
894
|
+
fail(`${label}: invalid subagent ${k} ${JSON.stringify(s[k])}; use one of: ${values.join(', ')}`);
|
|
895
895
|
subagentModelRef({ ...s, provider: s.provider ?? node.provider ?? options.defaultProvider }, `${label} subagent`, options);
|
|
896
896
|
const spawningEnabled = s.enabled && node.maxSubagents !== 0;
|
|
897
897
|
if (spawningEnabled && options.spawnAvailable === false)
|
|
@@ -928,7 +928,7 @@ function validateGraphInternal(value, options = {}) {
|
|
|
928
928
|
// spelled out per role so that roles not yet shape-checked by this loop are never inspected.
|
|
929
929
|
const delegated = node.agentRole === 'orchestrator' && spawningEnabled && isWritingRole(r);
|
|
930
930
|
if (delegated && (s.workspace ?? 'shared-read-only') !== 'worktree')
|
|
931
|
-
fail(`${label}: writing roles on an Orchestrator require separate worktrees;
|
|
931
|
+
fail(`${label}: writing roles on an Orchestrator require separate worktrees; set subagents.workspace to "worktree" (Separate Git worktree)`);
|
|
932
932
|
if (delegated && node.completion?.mode === 'outcomes')
|
|
933
933
|
fail(`${label}: Orchestrator delegation needs a single completion outcome; remove declared outcomes or the writing roles`);
|
|
934
934
|
if (delegated && node.completion?.mode === 'single' && node.completion.outcome === DELIVERED_OUTCOME)
|
|
@@ -948,12 +948,12 @@ function validateGraphInternal(value, options = {}) {
|
|
|
948
948
|
if (spawningEnabled && s.workspace === 'worktree' && writes && parent.git !== 'write')
|
|
949
949
|
fail(`${label}: writing worktree role ${r.id} requires parent Git write access; grant Git write or select a read-only role`);
|
|
950
950
|
if (spawningEnabled && (s.workspace ?? 'shared-read-only') === 'shared-read-only' && writes)
|
|
951
|
-
fail(`${label}: shared read-only subagents cannot write files or Git; reduce role permissions or
|
|
951
|
+
fail(`${label}: shared read-only subagents cannot write files or Git; reduce role permissions or set subagents.workspace to "shared-write" or "worktree"`);
|
|
952
952
|
if (spawningEnabled && (s.workspace ?? 'shared-read-only') === 'shared-write' && (s.maxConcurrent ?? 3) > 1 && writes)
|
|
953
|
-
fail(`${label}: concurrent writing subagents require separate worktrees;
|
|
953
|
+
fail(`${label}: concurrent writing subagents require separate worktrees; set subagents.workspace to "worktree" or subagents.maxConcurrent to 1`);
|
|
954
954
|
}
|
|
955
955
|
if (spawningEnabled && (s.workspace ?? 'shared-read-only') === 'shared-write' && (s.maxConcurrent ?? 3) > 1 && !s.roles?.length)
|
|
956
|
-
fail(`${label}: concurrent writing subagents require separate worktrees or maxConcurrent 1`);
|
|
956
|
+
fail(`${label}: concurrent writing subagents require separate worktrees; set subagents.workspace to "worktree" or subagents.maxConcurrent to 1`);
|
|
957
957
|
}
|
|
958
958
|
}
|
|
959
959
|
if (graph.metadata !== undefined && (!record(graph.metadata) || (graph.metadata.description !== undefined && (typeof graph.metadata.description !== 'string' || graph.metadata.description.length > 2000)) || (graph.metadata.updatedAt !== undefined && typeof graph.metadata.updatedAt !== 'string')))
|
package/dist/src/mcp.d.ts
CHANGED
|
@@ -9,15 +9,9 @@ export interface McpCatalogTool {
|
|
|
9
9
|
description?: string;
|
|
10
10
|
inputSchema: Record<string, unknown>;
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* What a server answered the last time it was asked: its tools, or that its catalog was refused
|
|
14
|
-
* for exceeding the task's metadata budget — the one refusal that is the server's own answer
|
|
15
|
-
* rather than a failure to reach it.
|
|
16
|
-
*/
|
|
12
|
+
/** The tools a server reported the last time it was asked. */
|
|
17
13
|
export type McpCatalogRecord = {
|
|
18
14
|
tools: McpCatalogTool[];
|
|
19
|
-
} | {
|
|
20
|
-
overBudget: true;
|
|
21
15
|
};
|
|
22
16
|
/**
|
|
23
17
|
* Where the answer a server last gave is kept between tasks.
|
|
@@ -116,18 +110,62 @@ export declare function probeMcpServer(config: RuntimeMcpServerConfig, workspace
|
|
|
116
110
|
export declare function probeFailureReason(error: unknown, config: Pick<McpServerConfig, 'transport'> & {
|
|
117
111
|
command?: string;
|
|
118
112
|
}): string;
|
|
113
|
+
/** The tool a model uses to read the descriptions and input schemas of tools that are offered on demand. */
|
|
114
|
+
export declare const MCP_FIND_TOOLS = "mcp_find_tools";
|
|
115
|
+
/** The tool a model uses to run a tool that is offered on demand. */
|
|
116
|
+
export declare const MCP_CALL_TOOL = "mcp_call_tool";
|
|
117
|
+
/**
|
|
118
|
+
* The index of on-demand tools a model is shown: each server with its tool names, within
|
|
119
|
+
* {@link MCP_INDEX_MAX_BYTES}. Names past the bound are counted, and the lookup finds them by query.
|
|
120
|
+
*/
|
|
121
|
+
export declare function deferredIndex(servers: {
|
|
122
|
+
id: string;
|
|
123
|
+
catalog: McpCatalogTool[];
|
|
124
|
+
}[]): string;
|
|
125
|
+
/**
|
|
126
|
+
* The tools of on-demand servers that match a lookup, best first: every named tool, or the tools
|
|
127
|
+
* whose name or description carries the most words of the query, or a server's whole list.
|
|
128
|
+
*/
|
|
129
|
+
export declare function findDeferredTools(servers: {
|
|
130
|
+
id: string;
|
|
131
|
+
catalog: McpCatalogTool[];
|
|
132
|
+
}[], request: {
|
|
133
|
+
server?: string;
|
|
134
|
+
query?: string;
|
|
135
|
+
tools?: string[];
|
|
136
|
+
}): {
|
|
137
|
+
server: string;
|
|
138
|
+
tool: McpCatalogTool;
|
|
139
|
+
}[];
|
|
140
|
+
/**
|
|
141
|
+
* What {@link MCP_FIND_TOOLS} answers, always within {@link MCP_FIND_MAX_CHARS}.
|
|
142
|
+
*
|
|
143
|
+
* Matching tools are described with their schemas, best first, while they fit. A tool whose own
|
|
144
|
+
* description and schema would not fit one answer is named with how many parts it takes; asking
|
|
145
|
+
* for it by exact name with `part` returns that slice of its JSON, and the parts joined in order
|
|
146
|
+
* are the whole entry.
|
|
147
|
+
*/
|
|
148
|
+
export declare function answerFind(servers: {
|
|
149
|
+
id: string;
|
|
150
|
+
catalog: McpCatalogTool[];
|
|
151
|
+
}[], args: Record<string, unknown>): string;
|
|
119
152
|
/**
|
|
120
153
|
* Each task owns its clients; no server tools or spawned processes survive task exit.
|
|
121
154
|
*
|
|
155
|
+
* A server's tools are offered one by one while their advertised metadata fits the task's budget
|
|
156
|
+
* ({@link MCP_CATALOG_MAX_BYTES} across servers, in order). A server whose catalog does not fit is
|
|
157
|
+
* not dropped: its tools are offered on demand, through {@link MCP_FIND_TOOLS} (an index of their
|
|
158
|
+
* names, and their schemas when looked up) and {@link MCP_CALL_TOOL}, which runs them under the
|
|
159
|
+
* same approval as a tool offered by itself.
|
|
160
|
+
*
|
|
122
161
|
* With `catalogs`, a server this home has already heard from does not hold the task back while it
|
|
123
162
|
* starts. Its connection is approved first, as every server's is. Then its last answer decides
|
|
124
|
-
* what the task is told now — its tools, offered from the record, or
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
* next task
|
|
129
|
-
*
|
|
130
|
-
* when every server has answered.
|
|
163
|
+
* what the task is told now — its tools, offered from the record, one by one or on demand — and the
|
|
164
|
+
* server itself connects behind the caller, where a call to one of its tools waits for the
|
|
165
|
+
* connection. The record is checked against what the server reports once it is up: a catalog that
|
|
166
|
+
* changed is used from the next task on, and a server that could not be reached is forgotten, so
|
|
167
|
+
* the next task asks it before offering anything, as a server seen for the first time is always
|
|
168
|
+
* asked. `settled` resolves when every server has answered.
|
|
131
169
|
*/
|
|
132
170
|
export declare function connectMcpServers(servers: Record<string, RuntimeMcpServerConfig>, context: ToolContext, notice: (message: string) => void, taskSignal?: AbortSignal, options?: {
|
|
133
171
|
catalogs?: McpCatalogStore;
|