@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.
Files changed (114) hide show
  1. package/README.md +8 -2
  2. package/THIRD_PARTY_NOTICES.md +15 -0
  3. package/dist/src/agent-execution.js +15 -3
  4. package/dist/src/agent-mcp.js +5 -0
  5. package/dist/src/app-server/protocol.d.ts +8 -1
  6. package/dist/src/app-server/protocol.js +1 -1
  7. package/dist/src/app-server.d.ts +15 -0
  8. package/dist/src/app-server.js +89 -10
  9. package/dist/src/browser-panel-tool.d.ts +24 -3
  10. package/dist/src/browser-panel-tool.js +80 -6
  11. package/dist/src/browser-runner.js +3 -1
  12. package/dist/src/browser-view.d.ts +16 -0
  13. package/dist/src/browser-view.js +38 -2
  14. package/dist/src/claude-provider.js +15 -2
  15. package/dist/src/cli.d.ts +2 -1
  16. package/dist/src/cli.js +175 -43
  17. package/dist/src/code-intelligence/CodeIntelligenceManager.js +1 -1
  18. package/dist/src/codex-provider.js +6 -3
  19. package/dist/src/coding-tools.d.ts +2 -1
  20. package/dist/src/coding-tools.js +39 -31
  21. package/dist/src/completion.d.ts +43 -1
  22. package/dist/src/completion.js +145 -4
  23. package/dist/src/config.d.ts +1 -0
  24. package/dist/src/config.js +2 -0
  25. package/dist/src/decision/PreparedSteps.js +1 -1
  26. package/dist/src/delegation-changes.js +19 -2
  27. package/dist/src/diff-preview.d.ts +1 -0
  28. package/dist/src/diff-preview.js +12 -3
  29. package/dist/src/engine-streams.d.ts +22 -0
  30. package/dist/src/engine-streams.js +16 -0
  31. package/dist/src/extensions.js +17 -6
  32. package/dist/src/file-read-key.d.ts +8 -0
  33. package/dist/src/file-read-key.js +12 -0
  34. package/dist/src/graph-editor-session.js +2 -1
  35. package/dist/src/graph-health.d.ts +21 -0
  36. package/dist/src/graph-health.js +46 -0
  37. package/dist/src/graph-manager-chat.d.ts +52 -3
  38. package/dist/src/graph-manager-chat.js +50 -5
  39. package/dist/src/graph-runner.js +23 -3
  40. package/dist/src/graph-server.d.ts +1 -1
  41. package/dist/src/graph-server.js +39 -18
  42. package/dist/src/graph-ui/app.js +100 -30
  43. package/dist/src/graph-ui/controls.css +52 -0
  44. package/dist/src/graph-ui/icons.js +3 -0
  45. package/dist/src/graph-ui/index.html +2 -2
  46. package/dist/src/graph-ui/manager-state.js +141 -3
  47. package/dist/src/graph-ui/manager.css +2 -2
  48. package/dist/src/graph-ui/manager.js +328 -66
  49. package/dist/src/graph-ui/model-picker.js +279 -0
  50. package/dist/src/graph-ui/provider-glyphs/alibaba-cloud.png +0 -0
  51. package/dist/src/graph-ui/provider-glyphs/anthropic.png +0 -0
  52. package/dist/src/graph-ui/provider-glyphs/aws-bedrock.png +0 -0
  53. package/dist/src/graph-ui/provider-glyphs/claude.png +0 -0
  54. package/dist/src/graph-ui/provider-glyphs/deepseek.png +0 -0
  55. package/dist/src/graph-ui/provider-glyphs/fireworks.png +0 -0
  56. package/dist/src/graph-ui/provider-glyphs/kimi.png +0 -0
  57. package/dist/src/graph-ui/provider-glyphs/minimax.png +0 -0
  58. package/dist/src/graph-ui/provider-glyphs/openai.png +0 -0
  59. package/dist/src/graph-ui/provider-glyphs/opencode.png +0 -0
  60. package/dist/src/graph-ui/provider-glyphs/openrouter.png +0 -0
  61. package/dist/src/graph-ui/provider-glyphs/xai.png +0 -0
  62. package/dist/src/graph-ui/provider-glyphs/xiaomi-mimo.png +0 -0
  63. package/dist/src/graph-ui/provider-glyphs/zai.png +0 -0
  64. package/dist/src/graphs.d.ts +2 -0
  65. package/dist/src/graphs.js +7 -7
  66. package/dist/src/mcp.d.ts +52 -14
  67. package/dist/src/mcp.js +285 -128
  68. package/dist/src/memory/ProjectMemory.d.ts +77 -0
  69. package/dist/src/memory/ProjectMemory.js +310 -0
  70. package/dist/src/memory/index.d.ts +1 -0
  71. package/dist/src/memory/index.js +1 -0
  72. package/dist/src/opencode-provider.js +5 -6
  73. package/dist/src/package-name.d.ts +3 -0
  74. package/dist/src/package-name.js +3 -0
  75. package/dist/src/provider-engine.js +2 -2
  76. package/dist/src/qa/runtime/PtyManager.js +2 -1
  77. package/dist/src/react-runtime.js +16 -8
  78. package/dist/src/remote/cert.d.ts +1 -1
  79. package/dist/src/remote/cert.js +2 -7
  80. package/dist/src/remote/client.js +1 -1
  81. package/dist/src/remote/pem.d.ts +6 -0
  82. package/dist/src/remote/pem.js +11 -0
  83. package/dist/src/run-records.js +49 -10
  84. package/dist/src/runtime.d.ts +2 -0
  85. package/dist/src/sessions.d.ts +3 -1
  86. package/dist/src/sessions.js +5 -3
  87. package/dist/src/sign-in-detection.d.ts +82 -0
  88. package/dist/src/sign-in-detection.js +197 -0
  89. package/dist/src/sign-in-offer.d.ts +35 -0
  90. package/dist/src/sign-in-offer.js +116 -0
  91. package/dist/src/skills/bundled/graph-manager/SKILL.md +22 -4
  92. package/dist/src/skills/bundled/provenance.json +1 -1
  93. package/dist/src/skills/runtime-skills.d.ts +6 -0
  94. package/dist/src/skills/runtime-skills.js +13 -0
  95. package/dist/src/stray-files.d.ts +14 -0
  96. package/dist/src/stray-files.js +81 -0
  97. package/dist/src/subagent-run.js +6 -1
  98. package/dist/src/terminal-ui.d.ts +1 -1
  99. package/dist/src/terminal-ui.js +9 -3
  100. package/dist/src/tool-activity.js +1 -1
  101. package/dist/src/tool-schema-compatibility.d.ts +7 -2
  102. package/dist/src/tool-schema-compatibility.js +8 -4
  103. package/dist/src/transcript.d.ts +5 -0
  104. package/dist/src/transcript.js +11 -3
  105. package/dist/src/types.d.ts +2 -0
  106. package/dist/src/untracked-file-removal.d.ts +3 -0
  107. package/dist/src/untracked-file-removal.js +125 -0
  108. package/dist/src/update-check.js +1 -1
  109. package/dist/src/update.d.ts +11 -1
  110. package/dist/src/update.js +27 -5
  111. package/dist/src/workspace-git-metadata.d.ts +15 -0
  112. package/dist/src/workspace-git-metadata.js +50 -1
  113. package/dist/src/workspace-instructions.js +1 -1
  114. package/package.json +1 -1
@@ -299,6 +299,7 @@ function applyProviderRegistry(value) {
299
299
  // A changed registry can move the default provider or the endpoint's catalog, so discovered
300
300
  // suggestions must not survive it; the next inspector render rediscovers against live config.
301
301
  state.providerModelRequests = new Map();
302
+ state.providerModelCatalogs = new Map();
302
303
  // The same reasoning applies to the record-on-commit dedupe: a model that was recorded under
303
304
  // the previous registry may have been removed from the provider's configured list since, and
304
305
  // a stale entry would suppress the re-POST that makes such a selection runnable again.
@@ -1162,15 +1163,49 @@ function capabilities(parent, policy, update, ceiling) {
1162
1163
  }
1163
1164
  }
1164
1165
  let modelSuggestionSeq = 0;
1165
- function modelFields(parent, target, update, parentModel, inheritedProvider, fallbackProvider) {
1166
- // The provider dropdown lists every configured provider by name; the Model dropdown under it
1167
- // lists every model the chosen provider serves. Labelling each provider with its one active
1168
- // model made the provider list read as the whole model list.
1169
- const providers = state.providers.map(p => ({value: idFor(p), label: titleFor(p)}));
1170
- if (target.provider && !providers.some(p => p.value === target.provider)) providers.push({value: target.provider, label: target.provider + ' (unavailable)'});
1171
- const defaultProviderLabel = inheritedProvider ? `Same as parent agent (${inheritedProvider})` : state.defaultProvider ? `Use configured default (${state.defaultProvider})` : 'Use configured default';
1172
- choice(parent, 'Provider', target.provider || '', [{value:'', label: defaultProviderLabel}, ...providers], value => update({ ...target, provider: value || undefined, model: undefined }));
1173
- if (target.provider && !state.providers.some(p => idFor(p) === target.provider)) providerWarning(parent, target.provider);
1166
+ /**
1167
+ * The closed model control (model-picker.js draws the column it opens): the model's name, its
1168
+ * provider's mark and name, and a chevron. `spec.current()` names what it shows; the rest of the
1169
+ * spec is what the panel reads each time it draws.
1170
+ */
1171
+ function modelPickerButton(spec) {
1172
+ const button = el('button', undefined, 'model-picker-trigger'); button.type = 'button';
1173
+ button.setAttribute('aria-haspopup', 'dialog'); button.setAttribute('aria-expanded', 'false');
1174
+ button.modelPicker = spec;
1175
+ button.redraw = () => {
1176
+ const { model, provider, entry, note } = spec.current();
1177
+ button.replaceChildren();
1178
+ const mark = globalThis.AndorraModelPicker?.mark?.(entry);
1179
+ if (mark) button.append(mark);
1180
+ button.append(el('span', model, 'model-picker-trigger-name'));
1181
+ // An unpinned selection says so, so a model the step follows is not mistaken for one it names.
1182
+ if (note) button.append(el('span', note, 'model-picker-trigger-note'));
1183
+ if (provider) button.append(el('span', provider, 'model-picker-trigger-provider'));
1184
+ const chevron = el('span', undefined, 'model-picker-trigger-chevron'); const glyph = globalThis.AndorraIcons?.icon?.('chevron-down', 14); if (glyph) chevron.append(glyph);
1185
+ button.append(chevron);
1186
+ button.setAttribute('aria-label', `${spec.ariaLabel}: ${model}${note ? ` (${note})` : ''}${provider ? `, ${provider}` : ''}`);
1187
+ button.title = [model + (note ? ` (${note})` : ''), provider].filter(Boolean).join(' · ');
1188
+ };
1189
+ button.redraw();
1190
+ button.onclick = () => globalThis.AndorraModelPicker?.toggle(button);
1191
+ return button;
1192
+ }
1193
+ // Every provider's models for the picker: what it has configured, then what its endpoint lists.
1194
+ // Discovery is requested once per provider and kept until the provider registry changes.
1195
+ function discoverProviderModels(providerId) {
1196
+ state.providerModelRequests ||= new Map();
1197
+ state.providerModelCatalogs ||= new Map();
1198
+ const registryGeneration = state.providerRegistryGeneration || 0;
1199
+ if (!state.providerModelRequests.has(providerId)) state.providerModelRequests.set(providerId, api(`/api/provider-models?provider=${encodeURIComponent(providerId)}`).catch(() => ({ models: [] })));
1200
+ return state.providerModelRequests.get(providerId).then(data => {
1201
+ if ((state.providerRegistryGeneration || 0) !== registryGeneration) return data;
1202
+ state.providerModelCatalogs.set(providerId, (data.models || []).map(name => name?.trim()).filter(Boolean));
1203
+ return data;
1204
+ });
1205
+ }
1206
+ function modelFields(parent, target, update, parentModel, inheritedProvider, fallbackProvider, options = {}) {
1207
+ // One control in the chat's model picker format: every configured provider's models, grouped
1208
+ // under the provider's name, with the step's own default pinned at the top.
1174
1209
  // A providerless subagent child inherits the parent node's provider at execution
1175
1210
  // (bindPortableGraphProviders adds its model to the parent's requirements), so the suggestions
1176
1211
  // shown here and the recording that makes a discovered pick runnable must resolve against that
@@ -1181,20 +1216,56 @@ function modelFields(parent, target, update, parentModel, inheritedProvider, fal
1181
1216
  // Every model the resolved provider serves: its configured models first, then whatever its
1182
1217
  // endpoint lists once discovery answers (filled in by addModelOption below). Picking one commits
1183
1218
  // through the custom-name field so a discovered pick is recorded exactly as a typed one is.
1184
- const picker = field(parent, 'Model', '', () => {}, { options: [] });
1185
- const pickerModels = [];
1186
1219
  const inheritedModel = parentModel?.trim() || activeName;
1187
- const renderPicker = () => {
1188
- picker.replaceChildren();
1189
- const rows = [{ value: '', label: inheritedModel ? `${parentModel ? 'Same as parent' : 'Provider default'} (${inheritedModel})` : 'Provider default' },
1190
- ...pickerModels.map(name => ({ value: name, label: name === activeName ? `${name} (active)` : name }))];
1191
- for (const row of rows) { const option = el('option', row.label); option.value = row.value; picker.append(option); }
1192
- picker.value = target.model?.trim() || '';
1193
- // Discovery can answer while the list is open; the branded panel copies the options when it
1194
- // opens, so redraw it or the newly served models stay out of reach until it is reopened.
1195
- window.AndorraControls?.refreshSelect?.(picker);
1196
- };
1197
- renderPicker();
1220
+ const effectiveProvider = target.provider || listingProvider;
1221
+ const entryFor = id => { const p = state.providers.find(item => idFor(item) === id); return p ? { id, label: titleFor(p), type: p.type, baseUrl: p.baseUrl } : id ? { id, label: `${id} (unavailable)` } : undefined; };
1222
+ const configuredOn = id => { const p = state.providers.find(item => idFor(item) === id); return [p?.model, ...(p?.models || [])].map(name => name?.trim()).filter(Boolean); };
1223
+ const pickerModels = [];
1224
+ const defaultLabel = options.defaultLabel || (inheritedProvider || parentModel ? 'Same as parent agent' : 'Use configured default');
1225
+ // The default row clears both overrides, so its hint names what applies afterwards: the inherited
1226
+ // or configured default provider and the parent's model or that provider's active one, never the
1227
+ // explicit selection it is about to replace.
1228
+ const clearedProvider = inheritedProvider || state.defaultProvider || '';
1229
+ const clearedModel = parentModel?.trim() || state.providers.find(p => idFor(p) === clearedProvider)?.model?.trim() || '';
1230
+ const defaultHint = options.defaultLabel ? '' : [clearedProvider ? entryFor(clearedProvider)?.label : '', clearedModel].filter(Boolean).join(' · ');
1231
+ const pickerButton = modelPickerButton({
1232
+ ariaLabel: 'Model',
1233
+ current: () => {
1234
+ const pinned = target.model?.trim();
1235
+ const entry = entryFor(effectiveProvider);
1236
+ if (!pinned && !target.provider && options.defaultLabel) return { model: options.defaultLabel, provider: '', entry: undefined };
1237
+ return { model: pinned || inheritedModel || 'Provider default', note: pinned || !inheritedModel ? '' : 'default', provider: entry?.label || '', entry };
1238
+ },
1239
+ groups: () => {
1240
+ const ids = state.providers.map(idFor);
1241
+ if (target.provider && !ids.includes(target.provider)) ids.push(target.provider);
1242
+ return ids.map(id => {
1243
+ const active = state.providers.find(item => idFor(item) === id)?.model?.trim() || '';
1244
+ const names = [...configuredOn(id), ...(state.providerModelCatalogs?.get(id) || [])];
1245
+ if (id === effectiveProvider) names.push(...pickerModels);
1246
+ return { provider: entryFor(id), models: [...new Set(names)].map(model => ({ model, note: model === active ? 'active' : '' })) };
1247
+ });
1248
+ },
1249
+ selected: () => target.model?.trim() ? { provider: effectiveProvider, model: target.model.trim() } : null,
1250
+ defaultRow: () => options.noDefault ? undefined : ({ label: defaultLabel, hint: defaultHint, selected: !target.provider && !target.model?.trim() }),
1251
+ pickDefault: () => mutate(() => update({ ...target, provider: undefined, model: undefined }), true),
1252
+ pick: ({ provider: chosenProvider, model: chosenModel }) => {
1253
+ // A model of the provider this selection already resolves to commits through the custom-name
1254
+ // field, as a typed name does, so a providerless child keeps inheriting its parent's provider
1255
+ // and a discovered pick is recorded (on the retry fallback too) the way it always was.
1256
+ if (chosenProvider === effectiveProvider && !(options.requireProvider && !target.provider)) { model.value = chosenModel; model.onchange(); return; }
1257
+ mutate(() => update({ ...target, provider: chosenProvider, model: chosenModel }), true);
1258
+ // Execution validates an explicit model against the provider's configured list, so a model only
1259
+ // its endpoint lists is recorded with that provider, as /model does.
1260
+ if (!configuredOn(chosenProvider).includes(chosenModel) && state.providerModelCatalogs?.get(chosenProvider)?.includes(chosenModel)) recordWith(chosenProvider, chosenModel);
1261
+ },
1262
+ onOpen: () => {
1263
+ for (const p of state.providers) discoverProviderModels(idFor(p)).then(() => globalThis.AndorraModelPicker?.refresh?.(pickerButton));
1264
+ },
1265
+ });
1266
+ const pickerField = el('div', undefined, 'field model-picker-field'); pickerField.append(el('span', 'Model'), pickerButton); parent.append(pickerField);
1267
+ const renderPicker = () => { pickerButton.redraw(); globalThis.AndorraModelPicker?.refresh?.(pickerButton); };
1268
+ if (target.provider && !state.providers.some(p => idFor(p) === target.provider)) providerWarning(parent, target.provider);
1198
1269
  // Surface portability without rewriting the synced revision or local credentials. The alias must
1199
1270
  // satisfy every reference to the original provider graph-wide (bindPortableGraphProviders groups
1200
1271
  // them), so the hint mirrors that grouping instead of promising an alias execution would refuse.
@@ -1292,8 +1363,8 @@ function modelFields(parent, target, update, parentModel, inheritedProvider, fal
1292
1363
  if (!value || displayed.has(value)) return;
1293
1364
  displayed.add(value);
1294
1365
  const option = el('option'); option.value = value; if (label) option.label = label; datalist.append(option);
1295
- // The picker is rebuilt once per batch by the caller: rebuilding per model is quadratic for a
1296
- // large catalog, and an open panel would be redrawn and re-measured for every entry.
1366
+ // An open panel is redrawn once per batch by the caller: redrawing per model is quadratic for a
1367
+ // large catalog, and the panel would be re-measured for every entry.
1297
1368
  pickerModels.push(value);
1298
1369
  return true;
1299
1370
  };
@@ -1302,9 +1373,7 @@ function modelFields(parent, target, update, parentModel, inheritedProvider, fal
1302
1373
  renderPicker();
1303
1374
  // Keyed by the resolved provider: a node using the configured default must follow that default's
1304
1375
  // identity, not share a blank key that survives a default switch.
1305
- state.providerModelRequests ||= new Map();
1306
- if (!state.providerModelRequests.has(listingProvider)) state.providerModelRequests.set(listingProvider, api(`/api/provider-models?provider=${encodeURIComponent(listingProvider)}`).catch(() => ({ models: [] })));
1307
- state.providerModelRequests.get(listingProvider).then(data => {
1376
+ discoverProviderModels(listingProvider).then(data => {
1308
1377
  if ((state.providerRegistryGeneration || 0) !== registryGeneration) return;
1309
1378
  let added = false;
1310
1379
  for (const name of data.models || []) {
@@ -1391,7 +1460,6 @@ function modelFields(parent, target, update, parentModel, inheritedProvider, fal
1391
1460
  const initialWarning = state.providerModelWarnings?.get(warningKey(target.model?.trim() || ''));
1392
1461
  if (initialWarning) override.append(el('p', initialWarning, 'help'));
1393
1462
  }
1394
- picker.onchange = () => { model.value = picker.value; model.onchange(); };
1395
1463
  model.onchange = () => {
1396
1464
  committed?.();
1397
1465
  // Recording eligibility keys on whether the model still needs recording, not on whether the
@@ -1587,7 +1655,9 @@ function renderSubagents(parent, node) {
1587
1655
  // Mirrors bindPortableGraphProviders: enabled retry attempts may spawn providerless children on
1588
1656
  // the fallback provider, so a discovered child pick must be recorded there as well.
1589
1657
  const childFallbackProvider = node.retry?.fallback && node.retry.maxAttempts > 1 ? node.retry.fallback.provider : '';
1590
- if(policy.modelPolicy==='specific') modelFields(parent,policy,value=>set({provider:value.provider,model:value.model}),undefined,node.provider,childFallbackProvider);
1658
+ // Validation refuses a specific subagent model without a provider, so every pick names one and
1659
+ // there is no default row to clear it.
1660
+ if(policy.modelPolicy==='specific') modelFields(parent,policy,value=>set({provider:value.provider,model:value.model}),undefined,node.provider,childFallbackProvider,{requireProvider:true,noDefault:true});
1591
1661
  const workspace = choice(parent,'Workspace policy',policy.workspace||'shared-read-only',[{value:'shared-read-only',label:'Shared workspace, read only'},{value:'shared-write',label:'Shared workspace, write allowed'},{value:'worktree',label:'Separate Git worktree'}],value=>set({workspace:value}));
1592
1662
  if (delegating) { for (const option of workspace.options) option.disabled = option.value !== 'worktree'; explain(workspace, 'A writing role on an Orchestrator requires separate worktrees: each child edits its own copy, and the Orchestrator lands accepted changes into your working folder.'); }
1593
1663
  choice(parent,'Tool inheritance',policy.toolInheritance||'restricted',[{value:'restricted',label:'Restricted subset'},{value:'inherit',label:'Inherit parent allowlist'}],value=>set({toolInheritance:value}));
@@ -1773,7 +1843,7 @@ function renderInspector() {
1773
1843
  // Tool calls default to blank, and blank means unlimited: an absent limit is only
1774
1844
  // written when the field is cleared, so a node keeps its ceiling once one is set.
1775
1845
  field(limits,'Tool calls (blank = unlimited)',node.limits?.maxToolCalls,value=>{node.limits={...node.limits,maxToolCalls:value}; if(value===undefined)delete node.limits.maxToolCalls;},{type:'number',min:0,optional:true,placeholder:'Unlimited'});
1776
- skillPrompt(field(advanced,'System prompt',node.systemPrompt ?? node.prompt,value=>{node.systemPrompt=value; delete node.prompt;},{multiline:true,maxLength:100000})); jsonField(advanced,'Input schema (JSON Schema)',node.inputSchema,value=>{node.inputSchema=value;}); jsonField(advanced,'Output schema (JSON Schema)',node.outputSchema,value=>{node.outputSchema=value;}); field(advanced,'Retries',node.retry?.maxAttempts??1,value=>{node.retry={...node.retry,maxAttempts:value};},{type:'number',min:1}); const fallback=disclosure(advanced,'Fallback model'); modelFields(fallback,node.retry?.fallback||{},value=>{node.retry={maxAttempts:1,...node.retry,fallback:value.provider?{provider:value.provider,model:value.model}:undefined};});
1846
+ skillPrompt(field(advanced,'System prompt',node.systemPrompt ?? node.prompt,value=>{node.systemPrompt=value; delete node.prompt;},{multiline:true,maxLength:100000})); jsonField(advanced,'Input schema (JSON Schema)',node.inputSchema,value=>{node.inputSchema=value;}); jsonField(advanced,'Output schema (JSON Schema)',node.outputSchema,value=>{node.outputSchema=value;}); field(advanced,'Retries',node.retry?.maxAttempts??1,value=>{node.retry={...node.retry,maxAttempts:value};},{type:'number',min:1}); const fallback=disclosure(advanced,'Fallback model'); modelFields(fallback,node.retry?.fallback||{},value=>{node.retry={maxAttempts:1,...node.retry,fallback:value.provider?{provider:value.provider,model:value.model}:undefined};},undefined,undefined,undefined,{requireProvider:true,defaultLabel:'No fallback model'});
1777
1847
  field(advanced,'Executor','react-basic',()=>{}).disabled=true;
1778
1848
  const tools = disclosure(advanced,'Tool allowlist');
1779
1849
  for (const name of [...new Set([...state.tools.map(t=>typeof t==='string'?t:t.name||t.id),...(node.tools||[])])]) check(tools,name,node.tools===undefined||node.tools.includes(name),enabled=>{const all=state.tools.map(t=>typeof t==='string'?t:t.name||t.id); node.tools=enabled?[...new Set([...(node.tools??all),name])]:(node.tools??all).filter(t=>t!==name);});
@@ -232,3 +232,55 @@ kbd {
232
232
  input[type="checkbox"], input[type="radio"], select:not([multiple]) { appearance: auto; -webkit-appearance: auto; }
233
233
  input[type="checkbox"]::before, input[type="radio"]::before { display: none; }
234
234
  }
235
+
236
+ /* Model picker (model-picker.js) ------------------------------------------------ */
237
+ /* The desktop's chat model control (app.css `.provider-model-*`) in the editor: the closed control is a
238
+ field naming the model with its provider's mark and name; the column it opens is the menu material
239
+ with a search field, a pinned default row, and the models grouped under their provider. */
240
+ .model-picker-field > .model-picker-trigger { grid-column: 1 / -1; grid-row: 2; }
241
+ .model-picker-trigger {
242
+ display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; min-height: var(--input-height); margin: 0;
243
+ padding: var(--space-1) 10px; text-align: left; font-weight: var(--weight-regular);
244
+ background: var(--bg-input); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--input-radius);
245
+ transition: border-color var(--dur-1) var(--ease-standard);
246
+ }
247
+ .model-picker-trigger:hover:not(:disabled) { border-color: var(--text-3); }
248
+ .model-picker-trigger[aria-expanded="true"] { border-color: var(--text-3); }
249
+ .model-picker-trigger:focus { outline: none; }
250
+ .model-picker-trigger:focus-visible { box-shadow: 0 0 0 2px var(--accent-ring); }
251
+ :root[data-focus-via="pointer"] .model-picker-trigger:focus-visible { box-shadow: none; }
252
+ .model-picker-trigger:disabled { color: var(--text-disabled); cursor: default; }
253
+ .model-picker-trigger-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
254
+ .model-picker-trigger-provider { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: var(--type-xs); }
255
+ .model-picker-trigger-chevron { display: inline-flex; flex: none; margin-left: auto; color: var(--text-3); }
256
+ .select-panel.model-picker-panel { box-sizing: border-box; min-width: 0; max-width: calc(100vw - 16px); z-index: calc(var(--z-menu) + 1); }
257
+ .select-search {
258
+ display: flex; align-items: center; gap: 8px; flex: 0 0 auto; height: var(--input-height); padding: 0 var(--space-3);
259
+ margin: calc(-1 * var(--space-1)) calc(-1 * var(--space-1)) var(--space-1);
260
+ border-bottom: 1px solid var(--border); color: var(--text-3);
261
+ }
262
+ .select-search-icon { display: inline-flex; flex: none; }
263
+ .select-search input, .select-search input:hover, .select-search input:focus-visible {
264
+ flex: 1; min-width: 0; min-height: 0; height: 100%; padding: 0; border: 0; border-radius: 0; box-shadow: none;
265
+ background: transparent; color: var(--text); caret-color: var(--text); font-size: var(--type-row); outline: none;
266
+ }
267
+ .model-picker-list { min-height: 0; flex: 1 1 auto; }
268
+ .select-group-block { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 0 0 auto; }
269
+ .select-option-icon { display: inline-flex; flex-shrink: 0; color: var(--text-3); }
270
+ .select-divider { height: 1px; background: var(--border); margin: 4px; flex: 0 0 auto; }
271
+ .select-empty { padding: 8px 12px; color: var(--text-3); font-size: var(--type-xs); }
272
+ /* The default row stays pinned over the scrolling models, opaque so rows pass under it. */
273
+ .model-picker-default { position: sticky; top: 0; z-index: 1; background: var(--bg-input); }
274
+ .model-picker-default[data-active="true"], .model-picker-default:hover { background: linear-gradient(var(--hover), var(--hover)), var(--bg-input); }
275
+ .model-picker-default[data-hint="true"] { padding-top: 5px; padding-bottom: 5px; }
276
+ .model-picker-default-text { display: flex; flex-direction: column; min-width: 0; }
277
+ .model-picker-default-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
278
+ .model-picker-default-hint { color: var(--text-3); font-size: var(--type-xs); white-space: normal; }
279
+ .model-picker-mark { width: 14px; height: 14px; align-items: center; justify-content: center; }
280
+ .model-picker-glyph {
281
+ display: block; width: 14px; height: 14px; background: currentColor;
282
+ -webkit-mask: var(--provider-glyph) center / contain no-repeat; mask: var(--provider-glyph) center / contain no-repeat;
283
+ }
284
+ .model-picker-meta { flex: none; margin-left: auto; color: var(--text-3); font-size: var(--type-xs); }
285
+ .model-picker-check { margin-left: auto; color: var(--text); }
286
+ .model-picker-meta + .model-picker-check { margin-left: 0; }
@@ -18,6 +18,9 @@ globalThis.AndorraIcons = (() => {
18
18
  const GLYPHS = {
19
19
  'arrow-left': '<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>',
20
20
  'chevron-right': '<path d="m9 18 6-6-6-6"/>',
21
+ 'chevron-down': '<path d="m6 9 6 6 6-6"/>',
22
+ // A provider with no vendor mark (Lucide's "boxes"), as the desktop's model picker draws it.
23
+ boxes: '<path d="M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z"/><path d="m7 16.5-4.74-2.85"/><path d="m7 16.5 5-3"/><path d="M7 16.5v5.17"/><path d="M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z"/><path d="m17 16.5-5-3"/><path d="m17 16.5 4.74-2.85"/><path d="M17 16.5v5.17"/><path d="M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z"/><path d="M12 8 7.26 5.15"/><path d="m12 8 4.74-2.85"/><path d="M12 13.5V8"/>',
21
24
  lock: '<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',
22
25
  undo: '<path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11"/>',
23
26
  redo: '<path d="m15 14 5-5-5-5"/><path d="M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13"/>',
@@ -3,5 +3,5 @@
3
3
  <head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Graph Editor · Andorra Code</title><link rel="icon" type="image/png" href="/andorra-logo.png"><link rel="stylesheet" href="/tokens.css"><link rel="stylesheet" href="/style.css"><link rel="stylesheet" href="/library.css"><link rel="stylesheet" href="/studio.css"><link rel="stylesheet" href="/controls.css"><link rel="stylesheet" href="/manager.css"><script src="/theme.js"></script></head>
4
4
  <body>
5
5
  <aside class="rail" id="library-rail"><div id="rail-resize" role="separator" aria-label="Resize library sidebar" aria-orientation="vertical" aria-controls="library-rail" tabindex="0"></div><div class="rail-caption" aria-hidden="true"></div><div class="rail-body" tabindex="0" aria-label="Graph and step library"><div class="section-label">Your graphs <button id="new-graph" aria-label="Create graph" title="Create graph" data-icon="plus"></button></div><div class="rail-search"><input id="search" type="search" placeholder="Find a graph" aria-label="Find a graph"></div><nav id="graphs" aria-label="Graphs" tabindex="0"></nav><div class="section-label library-label">Step library</div><div class="rail-search"><input id="node-search" type="search" placeholder="Search steps…" aria-label="Search steps"></div><nav id="node-library" aria-label="Step library"></nav><p class="hint">Drag a step onto the canvas, or select it and press Enter to add it. Connect each outcome to one or more destinations.</p></div><footer class="rail-footer">Your account <span id="sync-status" role="status">Saved locally; cloud sync pending</span></footer></aside>
6
- <main><header class="chrome"><div id="host-chrome" class="host-chrome" hidden></div><div class="graph-heading"><strong id="graph-title">Graph Editor</strong><span id="revision">Loading graphs…</span><span id="host-notice" class="chip chip-accent" role="status" hidden></span></div><div class="chrome-actions" id="chrome-actions"><button id="toggle-inspector" class="icon-button" aria-expanded="true" aria-label="Inspector" title="Show or hide the inspector" data-icon="panel-right"></button><div class="menu" id="more-wrap"><button id="more" class="icon-button" aria-haspopup="menu" aria-expanded="false" aria-controls="more-menu" aria-label="More actions" title="More actions" data-icon="more"></button><div id="more-menu" class="menu-list" role="menu" aria-label="More actions" hidden><button id="duplicate" type="button" role="menuitem" data-icon="copy">Duplicate</button></div></div><div class="manager-anchor" hidden><button id="graph-manager" class="btn-small studio-secondary" type="button" aria-label="Graph Manager" aria-expanded="false" aria-controls="manager-panel" title="Build or change this graph with Graph Manager" data-icon="bot" hidden><span>Graph Manager</span></button><div id="manager-tip" class="manager-tip" role="note" hidden><span>Let Graph Manager build this graph with you.</span><button id="manager-tip-close" type="button" class="icon-button" aria-label="Dismiss" title="Dismiss" data-icon="x"></button></div></div><button id="save" class="primary btn-small">Save</button></div></header><div class="workspace"><section id="canvas" aria-label="Graph canvas"><div id="scene"><svg id="edges" aria-label="Graph connections"></svg><div id="nodes"></div></div><div id="empty"><div class="empty-state"><span class="empty-state-icon" data-icon="graph"></span><p class="empty-state-title">No graph open</p><p class="empty-state-line">Create a graph to get started.</p><div class="empty-state-action"><button id="empty-create" type="button" class="primary btn-small">Create Graph</button></div></div></div><div id="canvas-hint" class="canvas-hint" role="note"><span id="canvas-hint-text">Drag or scroll to pan · Pinch or Ctrl/Cmd+scroll to zoom</span><button id="canvas-hint-close" type="button" class="icon-button" aria-label="Dismiss canvas tips" title="Dismiss" data-icon="x"></button></div><div class="canvas-toolbar" role="toolbar" aria-label="Canvas controls"><button id="undo" aria-label="Undo" title="Undo (Ctrl/Cmd+Z)" data-icon="undo"></button><button id="redo" aria-label="Redo" title="Redo (Ctrl/Cmd+Y)" data-icon="redo"></button><span class="toolbar-divider" aria-hidden="true"></span><button id="zoom-out" aria-label="Zoom out" title="Zoom out" data-icon="zoom-out"></button><output id="zoom" aria-label="Zoom level">100%</output><button id="zoom-in" aria-label="Zoom in" title="Zoom in" data-icon="zoom-in"></button><button id="fit" aria-label="Fit graph" title="Fit graph" data-icon="fit"></button><button id="layout" aria-label="Arrange" title="Arrange steps" data-icon="arrange"></button></div></section><aside id="inspector"><div id="resize" role="separator" aria-label="Resize inspector" aria-orientation="vertical" tabindex="0"></div><header class="panel-header"><strong id="inspector-title">Graph settings</strong><button id="graph-settings" class="btn-small" title="Show the graph's own settings">Graph Settings</button></header><div id="inspector-body"></div></aside><aside id="manager-panel" aria-label="Graph Manager" hidden><div id="manager-resize" role="separator" aria-label="Resize Graph Manager" aria-orientation="vertical" tabindex="0"></div><header class="panel-header"><strong>Graph Manager</strong><span class="manager-header-actions"><button id="manager-new-chat" type="button" class="btn-small" title="Start a new conversation. The current one stays in your history.">New Chat</button><button id="manager-close" type="button" class="icon-button" aria-label="Close Graph Manager" title="Close" data-icon="x"></button></span></header><div class="manager-models"><select id="manager-provider" aria-label="Graph Manager provider"></select><select id="manager-model" aria-label="Graph Manager model"></select></div><div id="manager-notices"></div><div id="manager-transcript" role="log" aria-label="Graph Manager conversation" tabindex="0"></div><footer class="manager-composer"><textarea id="manager-input" rows="3" placeholder="Ask Graph Manager to build or change this graph" aria-label="Message Graph Manager"></textarea><div class="manager-composer-actions"><span id="manager-run-state" role="status"></span><button id="manager-stop" type="button" class="btn-small" hidden>Stop</button><button id="manager-send" type="button" class="primary btn-small">Send</button></div></footer></aside></div><footer class="status"><span id="status" role="status" aria-live="polite">Connecting to your workspace…</span><span class="status-actions"><button id="theme-toggle" type="button" hidden>Light</button><button id="export">Export JSON</button></span></footer></main>
7
- <script src="/compat.js" defer></script><script src="/icons.js" defer></script><script src="/controls.js" defer></script><script src="/skill-picker.js" defer></script><script src="/edge-router.js" defer></script><script src="/drafts.js" defer></script><script src="/app.js" defer></script><script src="/manager-markdown.js" defer></script><script src="/manager-state.js" defer></script><script src="/manager.js" defer></script><script src="/embed.js" defer></script><script src="/sidebar.js" defer></script><script src="/studio.js" defer></script><script src="/studio-canvas.js" defer></script></body></html>
6
+ <main><header class="chrome"><div id="host-chrome" class="host-chrome" hidden></div><div class="graph-heading"><strong id="graph-title">Graph Editor</strong><span id="revision">Loading graphs…</span><span id="host-notice" class="chip chip-accent" role="status" hidden></span></div><div class="chrome-actions" id="chrome-actions"><button id="toggle-inspector" class="icon-button" aria-expanded="true" aria-label="Inspector" title="Show or hide the inspector" data-icon="panel-right"></button><div class="menu" id="more-wrap"><button id="more" class="icon-button" aria-haspopup="menu" aria-expanded="false" aria-controls="more-menu" aria-label="More actions" title="More actions" data-icon="more"></button><div id="more-menu" class="menu-list" role="menu" aria-label="More actions" hidden><button id="duplicate" type="button" role="menuitem" data-icon="copy">Duplicate</button></div></div><div class="manager-anchor" hidden><button id="graph-manager" class="btn-small studio-secondary" type="button" aria-label="Graph Manager" aria-expanded="false" aria-controls="manager-panel" title="Build or change this graph with Graph Manager" data-icon="bot" hidden><span>Graph Manager</span></button><div id="manager-tip" class="manager-tip" role="note" hidden><span>Let Graph Manager build this graph with you.</span><button id="manager-tip-close" type="button" class="icon-button" aria-label="Dismiss" title="Dismiss" data-icon="x"></button></div></div><button id="save" class="primary btn-small">Save</button></div></header><div class="workspace"><section id="canvas" aria-label="Graph canvas"><div id="scene"><svg id="edges" aria-label="Graph connections"></svg><div id="nodes"></div></div><div id="empty"><div class="empty-state"><span class="empty-state-icon" data-icon="graph"></span><p class="empty-state-title">No graph open</p><p class="empty-state-line">Create a graph to get started.</p><div class="empty-state-action"><button id="empty-create" type="button" class="primary btn-small">Create Graph</button></div></div></div><div id="canvas-hint" class="canvas-hint" role="note"><span id="canvas-hint-text">Drag or scroll to pan · Pinch or Ctrl/Cmd+scroll to zoom</span><button id="canvas-hint-close" type="button" class="icon-button" aria-label="Dismiss canvas tips" title="Dismiss" data-icon="x"></button></div><div class="canvas-toolbar" role="toolbar" aria-label="Canvas controls"><button id="undo" aria-label="Undo" title="Undo (Ctrl/Cmd+Z)" data-icon="undo"></button><button id="redo" aria-label="Redo" title="Redo (Ctrl/Cmd+Y)" data-icon="redo"></button><span class="toolbar-divider" aria-hidden="true"></span><button id="zoom-out" aria-label="Zoom out" title="Zoom out" data-icon="zoom-out"></button><output id="zoom" aria-label="Zoom level">100%</output><button id="zoom-in" aria-label="Zoom in" title="Zoom in" data-icon="zoom-in"></button><button id="fit" aria-label="Fit graph" title="Fit graph" data-icon="fit"></button><button id="layout" aria-label="Arrange" title="Arrange steps" data-icon="arrange"></button></div></section><aside id="inspector"><div id="resize" role="separator" aria-label="Resize inspector" aria-orientation="vertical" tabindex="0"></div><header class="panel-header"><strong id="inspector-title">Graph settings</strong><button id="graph-settings" class="btn-small" title="Show the graph's own settings">Graph Settings</button></header><div id="inspector-body"></div></aside><aside id="manager-panel" aria-label="Graph Manager" hidden><div id="manager-resize" role="separator" aria-label="Resize Graph Manager" aria-orientation="vertical" tabindex="0"></div><header class="panel-header"><strong>Graph Manager</strong><span class="manager-header-actions"><button id="manager-new-chat" type="button" class="btn-small" title="Start a new conversation. The current one stays in your history.">New Chat</button><button id="manager-close" type="button" class="icon-button" aria-label="Close Graph Manager" title="Close" data-icon="x"></button></span></header><div class="manager-models" id="manager-models"></div><div id="manager-notices"></div><div id="manager-transcript" role="log" aria-label="Graph Manager conversation" tabindex="0"></div><footer class="manager-composer"><textarea id="manager-input" rows="3" placeholder="Ask Graph Manager to build or change this graph" aria-label="Message Graph Manager"></textarea><div class="manager-composer-actions"><span id="manager-run-state" role="status"></span><button id="manager-stop" type="button" class="btn-small" hidden>Stop</button><button id="manager-send" type="button" class="primary btn-small">Send</button></div></footer></aside></div><footer class="status"><span id="status" role="status" aria-live="polite">Connecting to your workspace…</span><span class="status-actions"><button id="theme-toggle" type="button" hidden>Light</button><button id="export">Export JSON</button></span></footer></main>
7
+ <script src="/compat.js" defer></script><script src="/icons.js" defer></script><script src="/controls.js" defer></script><script src="/skill-picker.js" defer></script><script src="/model-picker.js" defer></script><script src="/edge-router.js" defer></script><script src="/drafts.js" defer></script><script src="/app.js" defer></script><script src="/manager-markdown.js" defer></script><script src="/manager-state.js" defer></script><script src="/manager.js" defer></script><script src="/embed.js" defer></script><script src="/sidebar.js" defer></script><script src="/studio.js" defer></script><script src="/studio-canvas.js" defer></script></body></html>
@@ -88,6 +88,143 @@ globalThis.AndorraManagerState = (() => {
88
88
  return deleted;
89
89
  }
90
90
 
91
+ const plainObject = value => !!value && typeof value === 'object' && !Array.isArray(value);
92
+ const text = value => typeof value === 'string';
93
+ const optional = (value, check) => value === undefined || check(value);
94
+ const point = value => plainObject(value) && Number.isFinite(value.x) && Number.isFinite(value.y);
95
+ const GRAPH_FIELDS = { name: text, entry: text, limits: plainObject, metadata: plainObject, widgets: Array.isArray, inputSchema: plainObject, stateSchema: plainObject };
96
+
97
+ /**
98
+ * Whether a draft change has the shape the canvas draws. The backend checks a draft's fields only
99
+ * when it validates or publishes, so a malformed change (a graph patch naming `name: null`, say)
100
+ * can still reach the panel; drawn, it would break every redraw and save until undone.
101
+ */
102
+ const UNSAFE_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
103
+ /** Whether a parsed value carries a key that would reach an object's prototype when assigned. */
104
+ function unsafeKeys(value, depth = 0) {
105
+ if (depth > 64) return true;
106
+ if (Array.isArray(value)) return value.some(item => unsafeKeys(item, depth + 1));
107
+ if (!value || typeof value !== 'object') return false;
108
+ return Object.keys(value).some(key => UNSAFE_KEYS.has(key) || unsafeKeys(value[key], depth + 1));
109
+ }
110
+
111
+ function soundEdit(edit) {
112
+ if (!edit || typeof edit.kind !== 'string' || unsafeKeys(edit)) return false;
113
+ if (edit.kind === 'node') {
114
+ const node = edit.node;
115
+ return plainObject(node) && text(node.id) && !!node.id && text(node.name) && text(node.type)
116
+ && optional(node.model, text) && optional(node.provider, text) && optional(node.instruction, text)
117
+ && optional(node.position, point) && ['completion', 'capabilities', 'subagents', 'limits', 'contextPolicy'].every(key => optional(node[key], plainObject));
118
+ }
119
+ if (edit.kind === 'edge') {
120
+ const edge = edit.edge;
121
+ return plainObject(edge) && text(edge.id) && text(edge.source) && text(edge.target) && optional(edge.outcome, text);
122
+ }
123
+ if (edit.kind === 'node.remove') return text(edit.nodeId) && !!edit.nodeId;
124
+ if (edit.kind === 'edge.remove') return text(edit.edgeId) && !!edit.edgeId;
125
+ if (edit.kind === 'graph') {
126
+ if (!plainObject(edit.patch)) return false;
127
+ const keys = Object.keys(edit.patch);
128
+ return keys.length > 0 && keys.every(key => Object.hasOwn(GRAPH_FIELDS, key) && GRAPH_FIELDS[key](edit.patch[key]));
129
+ }
130
+ return false;
131
+ }
132
+
133
+ const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
134
+ /**
135
+ * The agent's version of an object (a node, or the graph's fields) merged into the canvas's, field
136
+ * by field, against `base`: the version both last shared. A field the user changed since keeps the
137
+ * user's value; a field only the agent changed takes the agent's; with no base, the agent's version
138
+ * is taken whole. `kept` lists the fields where the user's value won over a different one of the
139
+ * agent's, so the caller knows the canvas no longer follows the agent.
140
+ */
141
+ function mergeFields(base, current, incoming, keys) {
142
+ if (!plainObject(current) || !plainObject(base)) return { merged: incoming, kept: [] };
143
+ const merged = {}, kept = [];
144
+ const fields = keys || [...new Set([...Object.keys(base), ...Object.keys(current), ...Object.keys(incoming)])];
145
+ for (const key of fields) {
146
+ const userChanged = !same(current[key], base[key]);
147
+ const value = userChanged ? current[key] : incoming[key];
148
+ if (userChanged && !same(current[key], incoming[key])) kept.push(key);
149
+ if (value !== undefined) merged[key] = value;
150
+ }
151
+ return { merged, kept };
152
+ }
153
+
154
+ /**
155
+ * Makes `target` hold what `next` holds while keeping every nested object and array that both have,
156
+ * so a reference held elsewhere (an inspector control) still points into the live value.
157
+ */
158
+ function assignInPlace(target, next) {
159
+ if (Array.isArray(target)) {
160
+ target.length = Math.min(target.length, next.length);
161
+ next.forEach((value, index) => {
162
+ const current = target[index];
163
+ if ((plainObject(current) && plainObject(value)) || (Array.isArray(current) && Array.isArray(value))) assignInPlace(current, value);
164
+ else target[index] = value;
165
+ });
166
+ return target;
167
+ }
168
+ for (const key of Object.keys(target)) if (!Object.hasOwn(next, key)) delete target[key];
169
+ for (const [key, value] of Object.entries(next)) {
170
+ if (UNSAFE_KEYS.has(key)) continue;
171
+ // Only the object's own value is kept and descended into; an inherited one is never written through.
172
+ const current = Object.hasOwn(target, key) ? target[key] : undefined;
173
+ if ((plainObject(current) && plainObject(value)) || (Array.isArray(current) && Array.isArray(value))) assignInPlace(current, value);
174
+ else Object.defineProperty(target, key, { value, writable: true, enumerable: true, configurable: true });
175
+ }
176
+ return target;
177
+ }
178
+
179
+ /**
180
+ * Applies one change the agent made to its draft (`graph.edit`'s `edit`) to `graph` in place, the
181
+ * way the draft applied it: a node is set (keeping the object the editor's inspector is bound to),
182
+ * a connection is set whole, a removed node takes its connections with it, a graph patch replaces
183
+ * the fields it names. False when it changed nothing or the change is malformed.
184
+ */
185
+ function applyEdit(graph, edit) {
186
+ if (!graph || !soundEdit(edit)) return false;
187
+ graph.nodes = plainObject(graph.nodes) ? graph.nodes : {};
188
+ graph.edges = Array.isArray(graph.edges) ? graph.edges : [];
189
+ if (edit.kind === 'node') {
190
+ const next = JSON.parse(JSON.stringify(edit.node));
191
+ const target = graph.nodes[next.id];
192
+ if (!plainObject(target)) { graph.nodes[next.id] = next; return true; }
193
+ // The inspector's fields write into the objects they were drawn for (the node, its completion,
194
+ // its subagent roles), so those objects stay and their contents change: a field being typed in
195
+ // still commits into the graph.
196
+ assignInPlace(target, next);
197
+ return true;
198
+ }
199
+ if (edit.kind === 'node.remove') {
200
+ if (!Object.hasOwn(graph.nodes, edit.nodeId)) return false;
201
+ delete graph.nodes[edit.nodeId];
202
+ graph.edges = graph.edges.filter(edge => edge.source !== edit.nodeId && edge.target !== edit.nodeId);
203
+ return true;
204
+ }
205
+ if (edit.kind === 'edge') {
206
+ // A connection is drawn only between cards the canvas has.
207
+ if (!Object.hasOwn(graph.nodes, edit.edge.source) || !Object.hasOwn(graph.nodes, edit.edge.target)) return false;
208
+ const edge = JSON.parse(JSON.stringify(edit.edge));
209
+ const index = graph.edges.findIndex(item => item.id === edge.id);
210
+ // An existing connection keeps the object its inspector's mapping fields write into.
211
+ if (index < 0) graph.edges.push(edge); else if (plainObject(graph.edges[index])) assignInPlace(graph.edges[index], edge); else graph.edges[index] = edge;
212
+ return true;
213
+ }
214
+ if (edit.kind === 'edge.remove') {
215
+ const before = graph.edges.length;
216
+ graph.edges = graph.edges.filter(edge => edge.id !== edit.edgeId);
217
+ return graph.edges.length !== before;
218
+ }
219
+ for (const key of Object.keys(edit.patch)) {
220
+ const value = JSON.parse(JSON.stringify(edit.patch[key]));
221
+ // The graph inspector's fields hold its settings objects (limits, schemas) the same way.
222
+ if ((plainObject(graph[key]) && plainObject(value)) || (Array.isArray(graph[key]) && Array.isArray(value))) assignInPlace(graph[key], value);
223
+ else graph[key] = value;
224
+ }
225
+ return true;
226
+ }
227
+
91
228
  /**
92
229
  * The transcript after one server event, as a new array. A `snapshot` replaces it, folded like live
93
230
  * events; `resolved` marks its approval or question `answered` on a copy and adds no row.
@@ -96,8 +233,9 @@ globalThis.AndorraManagerState = (() => {
96
233
  const current = Array.isArray(transcript) ? transcript : [];
97
234
  if (!event || typeof event.type !== 'string') return [...current];
98
235
  if (event.type === 'snapshot') return (event.events || []).reduce(reduce, []);
99
- // A `state` event is not a transcript row: the panel tracks the run state on its own.
100
- if (event.type === 'state') return [...current];
236
+ // A `state` event is not a transcript row: the panel tracks the run state on its own, and a
237
+ // `graph.edit` is applied to the canvas, not listed.
238
+ if (event.type === 'state' || event.type === 'graph.edit') return [...current];
101
239
  if (event.type === 'resolved') {
102
240
  return current.map(entry => (entry.type === 'approval' || entry.type === 'question') && entry.id === event.id ? { ...entry, answered: true } : entry);
103
241
  }
@@ -187,5 +325,5 @@ globalThis.AndorraManagerState = (() => {
187
325
  return Math.max(...ends) - Math.min(...starts);
188
326
  }
189
327
 
190
- return { shouldShowTip, dismissTip, initialModel, rememberModel, applyDecision, createdGraph, deletedGraphs, reduce, blocks, seconds, thoughtLabel, workLabel, workDuration };
328
+ return { shouldShowTip, dismissTip, initialModel, rememberModel, applyDecision, createdGraph, deletedGraphs, soundEdit, mergeFields, applyEdit, reduce, blocks, seconds, thoughtLabel, workLabel, workDuration };
191
329
  })();
@@ -24,7 +24,7 @@
24
24
  #manager-resize:focus-visible { outline: none; background: var(--accent-ring); }
25
25
  .manager-header-actions { display: flex; align-items: center; gap: var(--space-1); }
26
26
  .manager-models {
27
- display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-2);
27
+ display: flex; gap: var(--space-2);
28
28
  padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--border);
29
29
  }
30
30
 
@@ -157,6 +157,6 @@ button.manager-fold-head::after {
157
157
  @media (max-width: 760px) {
158
158
  #manager-panel { max-width: 78%; width: min(var(--manager-panel, 380px), 78%); }
159
159
  .workspace.manager-open #inspector { display: none; }
160
- .manager-models { grid-template-columns: minmax(0, 1fr); padding: var(--space-2) var(--space-3); }
160
+ .manager-models { padding: var(--space-2) var(--space-3); }
161
161
  #manager-transcript, .manager-composer { padding: var(--space-3); }
162
162
  }