@andorra-labs/code 0.1.17 → 0.1.19
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/dist/src/account-jev-savings.d.ts +4 -0
- package/dist/src/account-jev-savings.js +92 -0
- package/dist/src/acp-agent.js +2 -2
- package/dist/src/agent-execution.js +441 -53
- package/dist/src/agent-mcp.js +7 -1
- package/dist/src/agent-modifiers.js +5 -7
- package/dist/src/analytics.d.ts +19 -1
- package/dist/src/analytics.js +9 -1
- package/dist/src/andorra/entry.js +15 -6
- package/dist/src/andorra/errors.js +3 -0
- package/dist/src/andorra/hosted.d.ts +8 -0
- package/dist/src/andorra/hosted.js +22 -3
- package/dist/src/andorra/streams.d.ts +49 -0
- package/dist/src/andorra/streams.js +98 -0
- package/dist/src/antigravity-acp.d.ts +28 -0
- package/dist/src/antigravity-acp.js +150 -0
- package/dist/src/antigravity-terminal.d.ts +2 -0
- package/dist/src/antigravity-terminal.js +214 -0
- package/dist/src/app-server/adaptive-routing-settings.d.ts +37 -0
- package/dist/src/app-server/adaptive-routing-settings.js +69 -0
- package/dist/src/app-server/artifact.d.ts +14 -0
- package/dist/src/app-server/artifact.js +46 -0
- package/dist/src/app-server/legal-protocol.d.ts +33 -0
- package/dist/src/app-server/legal-protocol.js +16 -0
- package/dist/src/app-server/protocol.d.ts +34 -3
- package/dist/src/app-server/protocol.js +3 -1
- package/dist/src/app-server/telemetry-protocol.d.ts +53 -0
- package/dist/src/app-server/telemetry-protocol.js +2 -0
- package/dist/src/app-server/telemetry.d.ts +38 -0
- package/dist/src/app-server/telemetry.js +163 -0
- package/dist/src/app-server/workspace.d.ts +21 -0
- package/dist/src/app-server/workspace.js +192 -10
- package/dist/src/app-server.d.ts +82 -26
- package/dist/src/app-server.js +1573 -417
- package/dist/src/attachments.d.ts +10 -0
- package/dist/src/attachments.js +102 -7
- package/dist/src/auth/AuthManager.d.ts +11 -2
- package/dist/src/auth/AuthManager.js +56 -13
- package/dist/src/auth/index.d.ts +5 -1
- package/dist/src/auth/index.js +8 -1
- package/dist/src/auth/lifecycle.d.ts +13 -0
- package/dist/src/auth/lifecycle.js +109 -0
- package/dist/src/auth/store.d.ts +1 -0
- package/dist/src/auth/store.js +12 -0
- package/dist/src/auth/types.d.ts +12 -0
- package/dist/src/automation-runner.js +2 -0
- package/dist/src/automation-service.js +7 -2
- package/dist/src/automation-tool.js +2 -1
- package/dist/src/benchmark-scores.d.ts +88 -0
- package/dist/src/benchmark-scores.js +302 -0
- package/dist/src/bridge/command.js +16 -1
- package/dist/src/bridge/control.d.ts +3 -1
- package/dist/src/bridge/control.js +9 -3
- package/dist/src/bridge/engines.d.ts +2 -0
- package/dist/src/bridge/engines.js +9 -0
- package/dist/src/bridge/github.d.ts +108 -0
- package/dist/src/bridge/github.js +378 -0
- package/dist/src/bridge/host-ops.d.ts +3 -3
- package/dist/src/bridge/host-ops.js +14 -2
- package/dist/src/bridge/host.d.ts +2 -0
- package/dist/src/bridge/host.js +70 -16
- package/dist/src/bridge/protocol.d.ts +1 -0
- package/dist/src/bridge/protocol.js +1 -0
- package/dist/src/browser-panel-tool.d.ts +12 -0
- package/dist/src/browser-panel-tool.js +30 -3
- package/dist/src/browser-runner.js +53 -62
- package/dist/src/browser-server.js +10 -4
- package/dist/src/browser-session.d.ts +14 -0
- package/dist/src/browser-session.js +57 -12
- package/dist/src/browser-view.d.ts +40 -1
- package/dist/src/browser-view.js +163 -9
- package/dist/src/browser-window-style.d.ts +27 -0
- package/dist/src/browser-window-style.js +244 -0
- package/dist/src/bug-report-attachments.d.ts +48 -0
- package/dist/src/bug-report-attachments.js +327 -0
- package/dist/src/bug-report.d.ts +23 -3
- package/dist/src/bug-report.js +72 -9
- package/dist/src/claude-provider.d.ts +1 -0
- package/dist/src/claude-provider.js +77 -36
- package/dist/src/cli.d.ts +1 -3
- package/dist/src/cli.js +245 -62
- package/dist/src/codex-provider.d.ts +1 -0
- package/dist/src/codex-provider.js +44 -8
- package/dist/src/coding-tools.d.ts +1 -0
- package/dist/src/coding-tools.js +28 -7
- package/dist/src/command-screens.d.ts +1 -1
- package/dist/src/command-screens.js +2 -2
- package/dist/src/commands.d.ts +9 -2
- package/dist/src/commands.js +69 -64
- package/dist/src/completion.js +13 -7
- package/dist/src/config.d.ts +14 -3
- package/dist/src/config.js +57 -17
- package/dist/src/context-budget.d.ts +11 -2
- package/dist/src/context-budget.js +38 -4
- package/dist/src/context-compaction.d.ts +10 -8
- package/dist/src/context-compaction.js +23 -24
- package/dist/src/deadline.js +1 -1
- package/dist/src/decision/DecisionEngine.d.ts +2 -0
- package/dist/src/decision/DecisionManager.d.ts +16 -0
- package/dist/src/decision/DecisionManager.js +75 -2
- package/dist/src/decision/applyTaskKind.d.ts +8 -0
- package/dist/src/decision/applyTaskKind.js +53 -0
- package/dist/src/decision/applyToolMenu.js +6 -2
- package/dist/src/decision/hostedPolicy.js +6 -3
- package/dist/src/decision/optimizationPolicy.d.ts +10 -0
- package/dist/src/decision/optimizationPolicy.js +23 -3
- package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +4 -1
- package/dist/src/decision/providers/AndorraDecisionProvider.js +29 -7
- package/dist/src/decision/providers/index.js +1 -1
- package/dist/src/decision/taskKind.d.ts +52 -0
- package/dist/src/decision/taskKind.js +76 -0
- package/dist/src/decision/toolFamilies.js +1 -1
- package/dist/src/decision/types.d.ts +3 -1
- package/dist/src/default-graph.js +1 -1
- package/dist/src/efficiency.d.ts +80 -1
- package/dist/src/efficiency.js +119 -4
- package/dist/src/effort-routing.d.ts +27 -0
- package/dist/src/effort-routing.js +34 -0
- package/dist/src/evidence.d.ts +110 -0
- package/dist/src/evidence.js +195 -0
- package/dist/src/extensions.d.ts +2 -0
- package/dist/src/extensions.js +30 -20
- package/dist/src/github-app/agent-writes.d.ts +1 -1
- package/dist/src/github-app/agent-writes.js +1 -1
- package/dist/src/github-app/client.d.ts +19 -0
- package/dist/src/github-app/client.js +21 -1
- package/dist/src/github-app/event-source.d.ts +0 -5
- package/dist/src/github-app/event-source.js +1 -31
- package/dist/src/github-app/metrics.d.ts +2 -5
- package/dist/src/github-app/metrics.js +2 -14
- package/dist/src/github-app/review-loop.d.ts +5 -5
- package/dist/src/github-app/review-loop.js +1 -1
- package/dist/src/github-app/review-node.d.ts +2 -2
- package/dist/src/github-app/triggers.d.ts +3 -3
- package/dist/src/github-names.d.ts +7 -0
- package/dist/src/github-names.js +7 -0
- package/dist/src/glob-search.d.ts +1 -0
- package/dist/src/glob-search.js +3 -0
- package/dist/src/google-provider.d.ts +5 -28
- package/dist/src/google-provider.js +6 -141
- package/dist/src/graph-editor-session.d.ts +1 -0
- package/dist/src/graph-editor-session.js +2 -0
- package/dist/src/graph-health.js +3 -1
- package/dist/src/graph-preview.d.ts +2 -0
- package/dist/src/graph-preview.js +1 -0
- package/dist/src/graph-runner.js +20 -14
- package/dist/src/graph-selection.d.ts +3 -1
- package/dist/src/graph-selection.js +2 -2
- package/dist/src/graph-server.d.ts +8 -1
- package/dist/src/graph-server.js +49 -12
- package/dist/src/graph-sync.d.ts +2 -1
- package/dist/src/graph-sync.js +13 -0
- package/dist/src/graph-ui/app.js +49 -8
- package/dist/src/graph-ui/index.html +1 -1
- package/dist/src/graphs.d.ts +23 -1
- package/dist/src/graphs.js +58 -7
- package/dist/src/grok-provider.js +17 -14
- package/dist/src/hardened-runtime.js +39 -25
- package/dist/src/jev-savings.d.ts +4 -0
- package/dist/src/jev-savings.js +13 -0
- package/dist/src/legal/client.d.ts +25 -0
- package/dist/src/legal/client.js +47 -0
- package/dist/src/legal/command.d.ts +13 -0
- package/dist/src/legal/command.js +98 -0
- package/dist/src/legal/documents.d.ts +2 -0
- package/dist/src/legal/documents.js +14 -0
- package/dist/src/legal/gate.d.ts +13 -0
- package/dist/src/legal/gate.js +96 -0
- package/dist/src/legal/manifest.d.ts +21 -0
- package/dist/src/legal/manifest.js +23 -0
- package/dist/src/legal/receipt.d.ts +13 -0
- package/dist/src/legal/receipt.js +137 -0
- package/dist/src/legal/release.d.ts +27 -0
- package/dist/src/legal/release.js +28 -0
- package/dist/src/managed-sign-in.d.ts +0 -1
- package/dist/src/managed-sign-in.js +0 -13
- package/dist/src/membership.d.ts +27 -1
- package/dist/src/membership.js +139 -7
- package/dist/src/model-health-cache.js +1 -1
- package/dist/src/model-metadata.js +3 -7
- package/dist/src/model-override.d.ts +2 -1
- package/dist/src/model-override.js +9 -0
- package/dist/src/model-pool.d.ts +99 -0
- package/dist/src/model-pool.js +136 -0
- package/dist/src/model-relay/local.js +5 -0
- package/dist/src/model-relay/remote.d.ts +2 -0
- package/dist/src/model-relay/remote.js +4 -0
- package/dist/src/model-tiers.d.ts +16 -1
- package/dist/src/model-tiers.js +31 -7
- package/dist/src/opencode-cli-provider.js +59 -56
- package/dist/src/opencode-provider.js +16 -13
- package/dist/src/permissions.d.ts +5 -0
- package/dist/src/permissions.js +7 -0
- package/dist/src/plan-pass.js +2 -1
- package/dist/src/pool-scores.d.ts +45 -0
- package/dist/src/pool-scores.js +40 -0
- package/dist/src/provider-connection.js +3 -17
- package/dist/src/provider-engine.d.ts +13 -1
- package/dist/src/provider-engine.js +116 -12
- package/dist/src/provider-request-error.d.ts +8 -0
- package/dist/src/provider-request-error.js +12 -0
- package/dist/src/provider-settings.d.ts +1 -1
- package/dist/src/provider-settings.js +36 -18
- package/dist/src/provider-turn-deadline.d.ts +39 -0
- package/dist/src/provider-turn-deadline.js +139 -0
- package/dist/src/providers.d.ts +8 -9
- package/dist/src/providers.js +211 -150
- package/dist/src/pull-request-merge.d.ts +1 -8
- package/dist/src/pull-request-merge.js +0 -4
- package/dist/src/pull-requests.d.ts +83 -57
- package/dist/src/pull-requests.js +266 -225
- package/dist/src/qa/runtime/ProcessManager.d.ts +5 -1
- package/dist/src/qa/runtime/ProcessManager.js +9 -3
- package/dist/src/react-runtime.js +245 -71
- package/dist/src/reasoning-probe-cloud.d.ts +10 -0
- package/dist/src/reasoning-probe-cloud.js +209 -0
- package/dist/src/remote/engine-pool.d.ts +3 -0
- package/dist/src/remote/engine-pool.js +88 -21
- package/dist/src/remote/recovery.d.ts +6 -0
- package/dist/src/remote/recovery.js +37 -0
- package/dist/src/run-records.d.ts +13 -3
- package/dist/src/run-records.js +59 -34
- package/dist/src/runtime.d.ts +47 -2
- package/dist/src/runtime.js +33 -7
- package/dist/src/session-summary.d.ts +8 -0
- package/dist/src/session-summary.js +34 -0
- package/dist/src/sessions.d.ts +32 -0
- package/dist/src/sessions.js +65 -3
- package/dist/src/shell.js +6 -0
- package/dist/src/side-panel.js +36 -2
- package/dist/src/sign-in-detection.d.ts +1 -1
- package/dist/src/sign-in-detection.js +4 -10
- package/dist/src/sign-in-offer.js +1 -1
- package/dist/src/skill-commands.js +1 -1
- package/dist/src/skills/bundled/bug-report/SKILL.md +51 -7
- package/dist/src/skills/bundled/graph-manager/SKILL.md +2 -2
- package/dist/src/skills/bundled/graph-manager/patterns.md +13 -19
- package/dist/src/skills/bundled/provenance.json +3 -3
- package/dist/src/subagent-run.js +50 -50
- package/dist/src/subscription-usage.d.ts +50 -0
- package/dist/src/subscription-usage.js +92 -0
- package/dist/src/task-checkout.d.ts +157 -0
- package/dist/src/task-checkout.js +628 -0
- package/dist/src/telemetry/access.d.ts +18 -0
- package/dist/src/telemetry/access.js +43 -0
- package/dist/src/telemetry/aggregate.d.ts +18 -2
- package/dist/src/telemetry/aggregate.js +22 -9
- package/dist/src/telemetry/capture-core.d.ts +33 -14
- package/dist/src/telemetry/capture-core.js +124 -25
- package/dist/src/telemetry/capture.d.ts +3 -2
- package/dist/src/telemetry/capture.js +21 -1
- package/dist/src/telemetry/decision-capture.js +4 -0
- package/dist/src/telemetry/emitter.d.ts +6 -7
- package/dist/src/telemetry/emitter.js +124 -29
- package/dist/src/telemetry/gate.d.ts +41 -2
- package/dist/src/telemetry/gate.js +89 -4
- package/dist/src/telemetry/home.d.ts +1 -0
- package/dist/src/telemetry/home.js +20 -0
- package/dist/src/telemetry/identity.d.ts +6 -3
- package/dist/src/telemetry/identity.js +19 -6
- package/dist/src/telemetry/lifecycle.d.ts +8 -0
- package/dist/src/telemetry/lifecycle.js +76 -0
- package/dist/src/telemetry/outbox.d.ts +13 -8
- package/dist/src/telemetry/outbox.js +68 -12
- package/dist/src/telemetry/permission-command.d.ts +38 -0
- package/dist/src/telemetry/permission-command.js +208 -0
- package/dist/src/telemetry/permission.d.ts +168 -0
- package/dist/src/telemetry/permission.js +662 -0
- package/dist/src/telemetry/record-installation.d.ts +1 -0
- package/dist/src/telemetry/record-installation.js +9 -0
- package/dist/src/telemetry/region-data.d.ts +12 -0
- package/dist/src/telemetry/region-data.js +1314 -0
- package/dist/src/telemetry/region.d.ts +34 -0
- package/dist/src/telemetry/region.js +87 -0
- package/dist/src/telemetry/run-privacy.d.ts +11 -0
- package/dist/src/telemetry/run-privacy.js +165 -0
- package/dist/src/telemetry/schema.d.ts +27 -6
- package/dist/src/telemetry/schema.js +109 -14
- package/dist/src/telemetry/state.d.ts +11 -7
- package/dist/src/telemetry/state.js +39 -6
- package/dist/src/telemetry/surface.d.ts +20 -3
- package/dist/src/telemetry/surface.js +71 -15
- package/dist/src/telemetry/uploader.d.ts +6 -11
- package/dist/src/telemetry/uploader.js +72 -46
- package/dist/src/telemetry/uploads.d.ts +5 -1
- package/dist/src/telemetry/uploads.js +25 -6
- package/dist/src/telemetry/version.d.ts +5 -0
- package/dist/src/telemetry/version.js +34 -0
- package/dist/src/telemetry/workspace.d.ts +4 -1
- package/dist/src/telemetry/workspace.js +18 -3
- package/dist/src/terminal-ui.d.ts +3 -0
- package/dist/src/terminal-ui.js +48 -6
- package/dist/src/test-edit-guard.d.ts +30 -0
- package/dist/src/test-edit-guard.js +167 -2
- package/dist/src/thinking-level-detect.d.ts +13 -0
- package/dist/src/thinking-level-detect.js +52 -0
- package/dist/src/thinking-levels.d.ts +30 -0
- package/dist/src/thinking-levels.js +131 -0
- package/dist/src/timers.d.ts +3 -0
- package/dist/src/todos.d.ts +2 -1
- package/dist/src/todos.js +24 -4
- package/dist/src/tool-argument-coercion.d.ts +7 -0
- package/dist/src/tool-argument-coercion.js +49 -0
- package/dist/src/tool-catalog.d.ts +2 -2
- package/dist/src/tool-catalog.js +1 -1
- package/dist/src/tools.js +67 -22
- package/dist/src/transcript.js +3 -2
- package/dist/src/types.d.ts +48 -1
- package/dist/src/update.js +4 -0
- package/dist/src/usage-analytics.d.ts +7 -0
- package/dist/src/usage-analytics.js +85 -13
- package/dist/telemetry-consent-v1 +1 -0
- package/package.json +97 -96
package/dist/src/graph-server.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createServer } from 'node:http';
|
|
2
|
+
import { requireLegalAcceptance, LegalAcceptanceRequired } from './legal/gate.js';
|
|
2
3
|
import { randomBytes, timingSafeEqual } from 'node:crypto';
|
|
3
4
|
import { readFile } from 'node:fs/promises';
|
|
4
5
|
import { join } from 'node:path';
|
|
@@ -11,7 +12,7 @@ import { createTools } from './tools.js';
|
|
|
11
12
|
import { AutomationStore } from './automations.js';
|
|
12
13
|
import { deleteAgentDefinition, exportAgentDefinition, importAgentDefinition, listAgentDefinitions, readAgentDefinition, saveAgentDefinition, validateAgentDefinition } from './agent-definitions.js';
|
|
13
14
|
import { discoverModelMetadata, resolveModelContext } from './model-metadata.js';
|
|
14
|
-
import { MODEL_LISTING_TIMEOUT_MS, providerLabel, providerModels, recordProviderModel } from './providers.js';
|
|
15
|
+
import { MODEL_LISTING_TIMEOUT_MS, providerLabel, providerModels, recordProviderModel, supportsReasoningEffort } from './providers.js';
|
|
15
16
|
import { PaidMembershipRequiredError, readGraphMembership } from './membership.js';
|
|
16
17
|
import { getGraphMembership } from './membership.js';
|
|
17
18
|
import { FREE_CUSTOM_GRAPH_LIMIT, FREE_GRAPH_NODE_LIMIT, FreeTierLimitError, notePremiumGraphAccount, readGraphQuota, saveFreeTierGraph, savePremiumGraph } from './graph-quota.js';
|
|
@@ -103,7 +104,32 @@ async function editorConfig(directory) {
|
|
|
103
104
|
throw new Error('Invalid provider configuration. Run `andorra` and open /providers to repair it.');
|
|
104
105
|
}
|
|
105
106
|
}
|
|
107
|
+
const DEFAULT_EDITOR_PARENTS = ['tauri://localhost', 'http://tauri.localhost', 'http://127.0.0.1:7347'];
|
|
108
|
+
/** Only the authenticated desktop RPC may select an additional, exact loopback origin. */
|
|
109
|
+
export function graphEditorParentOrigins(value) {
|
|
110
|
+
if (value === undefined)
|
|
111
|
+
return [...DEFAULT_EDITOR_PARENTS];
|
|
112
|
+
if (typeof value !== 'string')
|
|
113
|
+
throw new Error('Invalid Graph Editor parent origin.');
|
|
114
|
+
if (DEFAULT_EDITOR_PARENTS.includes(value))
|
|
115
|
+
return [...DEFAULT_EDITOR_PARENTS];
|
|
116
|
+
let url;
|
|
117
|
+
try {
|
|
118
|
+
url = new URL(value);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
throw new Error('Invalid Graph Editor parent origin.');
|
|
122
|
+
}
|
|
123
|
+
if (url.protocol !== 'http:' || url.hostname !== '127.0.0.1' || !url.port
|
|
124
|
+
|| Number(url.port) < 1 || Number(url.port) > 65535 || url.origin !== value) {
|
|
125
|
+
throw new Error('Invalid Graph Editor parent origin.');
|
|
126
|
+
}
|
|
127
|
+
return [...DEFAULT_EDITOR_PARENTS, value];
|
|
128
|
+
}
|
|
106
129
|
export async function startGraphServer(directory = configDirectory(), checkMembership = readGraphMembership, options = {}) {
|
|
130
|
+
const parentOrigins = graphEditorParentOrigins(options.parentOrigin);
|
|
131
|
+
const checkLegal = () => requireLegalAcceptance(directory, options.legal);
|
|
132
|
+
await checkLegal(); // Before account storage, autosync, config/model work or opening the editor.
|
|
107
133
|
await editorConfig(directory);
|
|
108
134
|
const startup = await checkMembership();
|
|
109
135
|
const account = checkMembership === readGraphMembership ? await getAuthStatus() : { signedIn: false, subject: undefined };
|
|
@@ -186,7 +212,9 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
|
|
|
186
212
|
res.writeHead(status, { 'Content-Type': 'application/json; charset=utf-8' });
|
|
187
213
|
res.end(JSON.stringify(value));
|
|
188
214
|
};
|
|
189
|
-
const providerRegistryPayload = (providers) => providers.map(provider => ({ id: provider.id, model: provider.model, models: provider.models, type: provider.type, baseUrl: provider.baseUrl, label: providerLabel(provider, providers)
|
|
215
|
+
const providerRegistryPayload = (providers) => providers.map(provider => ({ id: provider.id, model: provider.model, models: provider.models, type: provider.type, baseUrl: provider.baseUrl, label: providerLabel(provider, providers),
|
|
216
|
+
// The editor offers a node only the thinking levels its model has enabled on this machine.
|
|
217
|
+
thinksAtLevels: supportsReasoningEffort(provider.type), ...(provider.thinkingLevels ? { thinkingLevels: provider.thinkingLevels } : {}) }));
|
|
190
218
|
const liveEditorState = async () => {
|
|
191
219
|
const [{ pid: _pid, ...status }, config] = await Promise.all([readActivity(directory), editorConfig(directory)]);
|
|
192
220
|
return {
|
|
@@ -199,7 +227,7 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
|
|
|
199
227
|
res.setHeader('Cache-Control', 'no-store');
|
|
200
228
|
res.setHeader('X-Content-Type-Options', 'nosniff');
|
|
201
229
|
res.setHeader('Referrer-Policy', 'no-referrer');
|
|
202
|
-
res.setHeader('Content-Security-Policy',
|
|
230
|
+
res.setHeader('Content-Security-Policy', `default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self'; frame-ancestors ${parentOrigins.join(' ')}; base-uri 'none'; form-action 'none'`);
|
|
203
231
|
try {
|
|
204
232
|
if (req.headers.host !== new URL(origin).host || (req.headers.origin && req.headers.origin !== origin)) {
|
|
205
233
|
reply(res, 403, { error: 'Untrusted origin' });
|
|
@@ -217,6 +245,12 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
|
|
|
217
245
|
reply(res, 401, { error: 'Reopen the editor using andorra graph.' });
|
|
218
246
|
return;
|
|
219
247
|
}
|
|
248
|
+
// Local metadata/status and cancellation stay usable after an in-TUI account change.
|
|
249
|
+
// Manager operations that create a child engine or resume work are checked first.
|
|
250
|
+
const harmless = req.method === 'GET' && ['/api/activity', '/api/activity/stream', '/api/sync'].includes(path)
|
|
251
|
+
|| req.method === 'POST' && ['/api/manager/cancel', '/api/manager/reset'].includes(path);
|
|
252
|
+
if (!harmless)
|
|
253
|
+
await checkLegal();
|
|
220
254
|
if (req.method === 'GET' && path === '/api/activity') {
|
|
221
255
|
reply(res, 200, await liveEditorState());
|
|
222
256
|
return;
|
|
@@ -297,7 +331,7 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
|
|
|
297
331
|
catch { } };
|
|
298
332
|
const timer = setInterval(() => {
|
|
299
333
|
void (async () => { if (sync?.accessDenied)
|
|
300
|
-
throw new PaidMembershipRequiredError(); await checkSession(); })()
|
|
334
|
+
throw new PaidMembershipRequiredError(); await checkSession(); await checkLegal(); })()
|
|
301
335
|
.then(() => { if (open && !res.destroyed)
|
|
302
336
|
res.write(': ping\n\n'); }, end);
|
|
303
337
|
}, MANAGER_PING_MS);
|
|
@@ -326,12 +360,11 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
|
|
|
326
360
|
const parsed = JSON.parse(body.toString('utf8'));
|
|
327
361
|
const value = parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};
|
|
328
362
|
const graphId = action === 'message' ? value.graph?.id : value.graphId;
|
|
329
|
-
if (action === 'cancel') {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
accepted(managerChat(graphId).reset());
|
|
363
|
+
if (action === 'cancel' || action === 'reset') {
|
|
364
|
+
if (typeof graphId !== 'string' || !MANAGER_GRAPH_ID.test(graphId))
|
|
365
|
+
throw new Error('Graph Manager needs the id of the open graph.');
|
|
366
|
+
const chat = managers.get(graphId); // Cancellation must not start a new child engine.
|
|
367
|
+
accepted(chat ? action === 'cancel' ? chat.cancel() : chat.reset() : Promise.resolve());
|
|
335
368
|
return;
|
|
336
369
|
}
|
|
337
370
|
if (action === 'approve') {
|
|
@@ -599,15 +632,19 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
|
|
|
599
632
|
}
|
|
600
633
|
const [file, mime] = assets[path];
|
|
601
634
|
const content = await readFile(new URL(`./graph-ui/${file}`, import.meta.url));
|
|
635
|
+
// Serve the same allowlist used by CSP; never derive trust from an HTTP request.
|
|
636
|
+
const body = file === 'embed.js'
|
|
637
|
+
? content.toString('utf8').replace("const parentOrigins = new Set(['tauri://localhost', 'http://tauri.localhost', 'http://127.0.0.1:7347']);", `const parentOrigins = new Set(${JSON.stringify(parentOrigins)});`)
|
|
638
|
+
: content;
|
|
602
639
|
res.writeHead(200, { 'Content-Type': mime });
|
|
603
|
-
res.end(
|
|
640
|
+
res.end(body);
|
|
604
641
|
}
|
|
605
642
|
catch (error) {
|
|
606
643
|
if (error instanceof FreeTierLimitError) {
|
|
607
644
|
reply(res, 422, { error: error.message, code: error.code });
|
|
608
645
|
return;
|
|
609
646
|
}
|
|
610
|
-
reply(res, error instanceof PaidMembershipRequiredError ? 403 : 400, { error: error instanceof Error ? error.message : 'Request failed' });
|
|
647
|
+
reply(res, error instanceof LegalAcceptanceRequired ? 428 : error instanceof PaidMembershipRequiredError ? 403 : 400, { error: error instanceof Error ? error.message : 'Request failed', ...(error instanceof LegalAcceptanceRequired ? { code: error.code } : {}) });
|
|
611
648
|
}
|
|
612
649
|
});
|
|
613
650
|
server.requestTimeout = 15_000;
|
package/dist/src/graph-sync.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Graph } from './graphs.js';
|
|
2
2
|
export interface GraphSyncStatus {
|
|
3
|
-
state: 'pending' | 'syncing' | 'synced' | 'offline';
|
|
3
|
+
state: 'pending' | 'syncing' | 'synced' | 'offline' | 'acceptance-required';
|
|
4
4
|
detail: string;
|
|
5
5
|
}
|
|
6
6
|
export interface GraphSyncDependencies {
|
|
@@ -9,6 +9,7 @@ export interface GraphSyncDependencies {
|
|
|
9
9
|
baseUrl: string;
|
|
10
10
|
fetch: typeof fetch;
|
|
11
11
|
now?: () => number;
|
|
12
|
+
authorize?: () => Promise<void>;
|
|
12
13
|
}
|
|
13
14
|
export declare class GraphSync {
|
|
14
15
|
readonly directory: string;
|
package/dist/src/graph-sync.js
CHANGED
|
@@ -7,6 +7,7 @@ import { decodeJwt } from 'jose';
|
|
|
7
7
|
import { GraphConflictError, isReservedGraphId, reservedGraphId, restoreGraphRevision, validateGraph } from './graphs.js';
|
|
8
8
|
import { acquireSaveLock, removeLockedFolder, SaveLockBusyError } from './save-lock.js';
|
|
9
9
|
import { readGraphQuota } from './graph-quota.js';
|
|
10
|
+
import { requireLegalAcceptance, LegalAcceptanceRequired } from './legal/gate.js';
|
|
10
11
|
const MAX_BYTES = 600 * 1024;
|
|
11
12
|
const DELETION_MARKER = '.graph-deletion-pending.json';
|
|
12
13
|
const digest = (raw) => createHash('sha256').update(raw).digest('hex');
|
|
@@ -34,6 +35,7 @@ const defaults = {
|
|
|
34
35
|
subject: async () => (await getAuthStatus(AbortSignal.timeout(5000))).subject,
|
|
35
36
|
baseUrl: getAuthConfiguration().apiBaseUrl,
|
|
36
37
|
fetch: (...args) => globalThis.fetch(...args),
|
|
38
|
+
authorize: () => requireLegalAcceptance(),
|
|
37
39
|
};
|
|
38
40
|
async function entries(path) {
|
|
39
41
|
try {
|
|
@@ -129,6 +131,7 @@ export class GraphSync {
|
|
|
129
131
|
this.folder = join(directory, 'graph-cloud', subject);
|
|
130
132
|
}
|
|
131
133
|
async start() {
|
|
134
|
+
await this.deps.authorize?.();
|
|
132
135
|
await mkdir(join(this.folder, 'snapshots'), { recursive: true });
|
|
133
136
|
await mkdir(join(this.directory, 'graph-drafts'), { recursive: true });
|
|
134
137
|
this.timer = setInterval(() => { void this.sync(); }, 30_000);
|
|
@@ -402,9 +405,16 @@ export class GraphSync {
|
|
|
402
405
|
let generation;
|
|
403
406
|
do {
|
|
404
407
|
generation = this.generation;
|
|
408
|
+
await this.deps.authorize?.();
|
|
405
409
|
await this.perform();
|
|
406
410
|
} while (!this.stopped && generation !== this.generation);
|
|
407
411
|
})().catch(error => {
|
|
412
|
+
if (error instanceof LegalAcceptanceRequired) {
|
|
413
|
+
clearInterval(this.timer);
|
|
414
|
+
this.timer = undefined;
|
|
415
|
+
this.status = { state: 'acceptance-required', detail: 'Cloud sync paused: review policies with andorra legal accept (or the desktop policy dialog), then reopen the editor. Local graphs remain saved.' };
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
408
418
|
this.status = error instanceof SyncPaused
|
|
409
419
|
? { state: 'pending', detail: 'Saved locally; cloud sync will resume automatically.' }
|
|
410
420
|
: { state: 'offline', detail: 'Saved locally; cloud sync unavailable. Retrying automatically.' };
|
|
@@ -505,6 +515,7 @@ export class GraphSync {
|
|
|
505
515
|
}
|
|
506
516
|
async request(path, token, body) {
|
|
507
517
|
this.checkBudget();
|
|
518
|
+
await this.deps.authorize?.();
|
|
508
519
|
if (await this.deps.subject() !== this.subject)
|
|
509
520
|
throw new Error('Account changed');
|
|
510
521
|
const base = new URL(this.deps.baseUrl);
|
|
@@ -519,6 +530,8 @@ export class GraphSync {
|
|
|
519
530
|
await response.body?.cancel();
|
|
520
531
|
if (response.status === 401 || response.status === 403)
|
|
521
532
|
this.accessDenied = true;
|
|
533
|
+
if (response.status === 428)
|
|
534
|
+
throw new LegalAcceptanceRequired();
|
|
522
535
|
if (response.status === 422 && body !== undefined)
|
|
523
536
|
throw new SnapshotRefused();
|
|
524
537
|
throw new Error('Cloud sync failed');
|
package/dist/src/graph-ui/app.js
CHANGED
|
@@ -75,6 +75,9 @@ function countedNodes(graph) { return Object.values(graph.nodes).filter(node =>
|
|
|
75
75
|
function canCreateGraph() { return !freeTier() || state.plan.freeGraphId === undefined; }
|
|
76
76
|
function freeGraphEditable(graph) { return !freeTier() || (graph.revision ? graph.id === state.plan.freeGraphId : canCreateGraph()); }
|
|
77
77
|
const FREE_LOCKED_TIP = 'View only on the free tier. Duplicate it to make a copy you can change, or upgrade to Premium.';
|
|
78
|
+
// The bundled Andorra Agent is the one graph nobody can save: it can be explored and tried, and Duplicate makes an editable copy.
|
|
79
|
+
const presetReadOnly = graph => graph?.id === 'default';
|
|
80
|
+
const PRESET_READ_ONLY_TIP = 'Andorra Agent is read only. Duplicate it to make a copy you can change.';
|
|
78
81
|
const FREE_DRAFT_LOCKED_TIP = 'This draft belongs to a view-only graph. Duplicate the graph to change it, or upgrade to Premium.';
|
|
79
82
|
// Why a free account cannot copy this graph, or undefined when the copy would be its free graph.
|
|
80
83
|
function freeCopyRefusal(graph) {
|
|
@@ -161,7 +164,9 @@ function refreshDirty() {
|
|
|
161
164
|
state.dirty = !!state.graph && (state.savedKey == null || graphKey(state.graph) !== state.savedKey);
|
|
162
165
|
if (!state.dirty && pendingDraft && pendingDraft.id === state.graph?.id) { pendingDraft = null; clearTimeout(draftTimer); }
|
|
163
166
|
}
|
|
164
|
-
function changed() { if (viewOnly() && state.viewOnlySource) { restoreViewOnly(); return; } scheduleValidation(); refreshDirty(); renderCanvas(); renderHeading(); renderValidation(); status(state.dirty ? 'Unsaved changes' : 'No unsaved changes'); syncImportRequirementsMarker(); queueDraft();
|
|
167
|
+
function changed() { if (viewOnly() && state.viewOnlySource) { restoreViewOnly(); return; } scheduleValidation(); refreshDirty(); renderCanvas(); renderHeading(); renderValidation(); status(state.dirty ? 'Unsaved changes' : 'No unsaved changes'); syncImportRequirementsMarker(); queueDraft();
|
|
168
|
+
// The first edit to the read-only preset says once why Save stays off, then lets the person keep trying things.
|
|
169
|
+
if (state.dirty && presetReadOnly(state.graph) && !state.readOnlyNoticed) { state.readOnlyNoticed = true; status(PRESET_READ_ONLY_TIP, 'notice'); } }
|
|
165
170
|
function adoptServerStamps(saved) {
|
|
166
171
|
for (const key of ['updatedAt', 'createdAt']) {
|
|
167
172
|
if (saved.metadata?.[key] !== undefined) state.graph.metadata = { ...state.graph.metadata, [key]: saved.metadata[key] };
|
|
@@ -273,9 +278,10 @@ function applyProviderRegistry(value) {
|
|
|
273
278
|
return true;
|
|
274
279
|
}
|
|
275
280
|
function isWritingRole(role) { return role?.capabilities?.filesystem === 'read-write' || role?.capabilities?.git === 'write'; }
|
|
281
|
+
function freeformWrites(node) { const caps = effectiveCaps(node); return node?.subagents?.freeform === 'write' && (caps.filesystem === 'read-write' || caps.git === 'write'); }
|
|
276
282
|
function delegatesWriting(node) {
|
|
277
283
|
return node?.type === 'agent' && node.agentRole === 'orchestrator' && node.subagents?.enabled === true && node.maxSubagents !== 0
|
|
278
|
-
&& (node.subagents.roles ?? []).some(isWritingRole);
|
|
284
|
+
&& ((node.subagents.roles ?? []).some(isWritingRole) || freeformWrites(node));
|
|
279
285
|
}
|
|
280
286
|
function outcomes(node) {
|
|
281
287
|
if (node.type === 'end') return [];
|
|
@@ -490,14 +496,18 @@ function renderHeading() {
|
|
|
490
496
|
$('graph-title').textContent = state.graph?.name || 'Graph Editor';
|
|
491
497
|
$('revision').textContent = state.graph ? (state.graph.revision ? `Version ${state.graph.revision}` : 'New graph') : '';
|
|
492
498
|
$('save').disabled = state.saving || state.orderSaving || !state.graph || !state.dirty || state.graph.id === 'default';
|
|
493
|
-
|
|
499
|
+
const readOnly = presetReadOnly(state.graph);
|
|
500
|
+
$('save').title = readOnly ? PRESET_READ_ONLY_TIP : '';
|
|
501
|
+
$('read-only-notice').hidden = !readOnly;
|
|
502
|
+
$('read-only-notice').title = readOnly ? PRESET_READ_ONLY_TIP : '';
|
|
494
503
|
$('save-state').textContent = viewOnly() ? 'View only' : 'Saved';
|
|
495
504
|
$('save-state').title = viewOnly() ? FREE_LOCKED_TIP : '';
|
|
496
505
|
document.body?.classList?.toggle?.('view-only', viewOnly());
|
|
497
506
|
// Save is the header's one primary and shows only while there is something to save; a clean graph says so quietly.
|
|
498
507
|
const pending = !!state.graph && (state.dirty || state.saving);
|
|
499
508
|
$('save').hidden = !pending;
|
|
500
|
-
|
|
509
|
+
// The read-only preset has its own chip beside the title, so the muted Saved would only repeat it, untruthfully.
|
|
510
|
+
$('save-state').hidden = !state.graph || pending || readOnly;
|
|
501
511
|
$('undo').disabled = !state.undo.length; $('redo').disabled = !state.redo.length;
|
|
502
512
|
for (const id of ['duplicate', 'export', 'layout', 'fit']) $(id).disabled = !state.graph;
|
|
503
513
|
$('duplicate').disabled = state.saving || state.orderSaving || !state.graph || !canCreateGraph();
|
|
@@ -803,7 +813,36 @@ function dismissCanvasHint() {
|
|
|
803
813
|
try { localStorage.setItem(HINT_KEY, '1'); } catch { }
|
|
804
814
|
if (!state.routePick && $('canvas-hint')) $('canvas-hint').hidden = true;
|
|
805
815
|
}
|
|
816
|
+
const THINKING_LEVELS = ['none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
|
|
817
|
+
/** The thinking levels a node's model has enabled here, lowest first; empty when its provider takes no level. */
|
|
818
|
+
function nodeThinkingLevels(node) {
|
|
819
|
+
const provider = state.providers.find(p => idFor(p) === (node.provider || state.defaultProvider));
|
|
820
|
+
if (!provider || typeof provider === 'string' || !provider.thinksAtLevels) return [];
|
|
821
|
+
const entry = provider.thinkingLevels?.[node.model || provider.model];
|
|
822
|
+
const supported = entry?.supported || THINKING_LEVELS;
|
|
823
|
+
const disabled = entry?.disabled || [];
|
|
824
|
+
return THINKING_LEVELS.filter(level => supported.includes(level) && !disabled.includes(level));
|
|
825
|
+
}
|
|
826
|
+
function thinkingSuffix(node) {
|
|
827
|
+
if (node.type !== 'agent' || !node.reasoningEffort) return '';
|
|
828
|
+
return node.reasoningEffort === 'auto' ? 'Auto thinking' : `${node.reasoningEffort} thinking`;
|
|
829
|
+
}
|
|
830
|
+
/** The thinking level control under a node's model: the session's level, Auto, or one of the model's enabled levels. */
|
|
831
|
+
function thinkingLevelField(parent, node) {
|
|
832
|
+
const levels = nodeThinkingLevels(node);
|
|
833
|
+
const current = node.reasoningEffort || '';
|
|
834
|
+
if (!levels.length && !current) return;
|
|
835
|
+
const options = [{ value: '', label: 'Same as session' }, { value: 'auto', label: 'Auto (Jev)' }, ...levels.map(level => ({ value: level, label: level }))];
|
|
836
|
+
if (current && current !== 'auto' && !levels.includes(current)) options.push({ value: current, label: `${current} (not available here)` });
|
|
837
|
+
const control = choice(parent, 'Thinking level', current, options, value => { if (value) node.reasoningEffort = value; else delete node.reasoningEffort; });
|
|
838
|
+
explain(control, 'How hard this step\'s model thinks before it answers. Auto (Jev) picks one of the levels this model has enabled each time the step starts, from how complex and how risky the task is, and keeps it for that run of the step; it needs Jev decisions on for this step, and otherwise keeps the session\'s level. A level that is switched off for this model on the machine running the graph moves to the nearest one that is on.');
|
|
839
|
+
}
|
|
806
840
|
function nodeModelLabel(node) {
|
|
841
|
+
const model = nodeModelName(node);
|
|
842
|
+
const thinking = thinkingSuffix(node);
|
|
843
|
+
return model && thinking ? `${model} · ${thinking}` : model || thinking;
|
|
844
|
+
}
|
|
845
|
+
function nodeModelName(node) {
|
|
807
846
|
if (node.model) return node.model;
|
|
808
847
|
const providerId = node.provider || state.defaultProvider;
|
|
809
848
|
const provider = state.providers.find(p => idFor(p) === providerId);
|
|
@@ -1589,9 +1628,9 @@ function renderSubagents(parent, node) {
|
|
|
1589
1628
|
const delegating = delegatesWriting(node);
|
|
1590
1629
|
explain(check(parent,'Allow subagents',policy.enabled,value=>{set({enabled:value});pruneRoutes(node);}), delegating
|
|
1591
1630
|
? 'Writing roles of an Orchestrator run in their own Git worktree with a shell. The shell is not sandboxed and follows your permission mode. The Orchestrator reviews each change and lands the ones it accepts into your working folder; it never writes code itself.'
|
|
1592
|
-
: 'Internal delegation returns observations to this Agent. Only this parent chooses its graph outcome. Active children finish or cancel before the parent can complete. Subagents of
|
|
1631
|
+
: 'Internal delegation returns observations to this Agent. Only this parent chooses its graph outcome. Active children finish or cancel before the parent can complete. Subagents that share the working folder of this Agent never receive the host shell. With Separate Git worktree, a subagent whose tools include a command tool, or that this Agent gives one when it starts it, runs commands in its own worktree; that shell is not sandboxed and follows your permission mode. Read-only roles use filesystem tools and supported Git read operations.');
|
|
1593
1632
|
if (!policy.enabled) return;
|
|
1594
|
-
const requireWorktree = () => { if (node.agentRole === 'orchestrator' && (policy.roles || []).some(isWritingRole)) set({workspace:'worktree'}); };
|
|
1633
|
+
const requireWorktree = () => { if (node.agentRole === 'orchestrator' && ((policy.roles || []).some(isWritingRole) || freeformWrites(node))) set({workspace:'worktree'}); };
|
|
1595
1634
|
for (const [key,label,fallback] of [['maxConcurrent','Max concurrent',3],['maxTotal','Max total per agent run',8],['maxDepth','Max nesting depth',1]]) field(parent,label,policy[key]??fallback,value=>set({[key]:value}),{type:'number',min:1,max:key==='maxDepth'?3:key==='maxConcurrent'?16:1000});
|
|
1596
1635
|
choice(parent,'Model policy',policy.modelPolicy||'inherit',[{value:'inherit',label:'Inherit parent model'},{value:'specific',label:'Use specific model'},{value:'per-role',label:'Per-role model'}],value=>set({modelPolicy:value}));
|
|
1597
1636
|
const childFallbackProvider = node.retry?.fallback && node.retry.maxAttempts > 1 ? node.retry.fallback.provider : '';
|
|
@@ -1599,6 +1638,7 @@ function renderSubagents(parent, node) {
|
|
|
1599
1638
|
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}));
|
|
1600
1639
|
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.'); }
|
|
1601
1640
|
choice(parent,'Tool inheritance',policy.toolInheritance||'restricted',[{value:'restricted',label:'Restricted subset'},{value:'inherit',label:'Inherit parent allowlist'}],value=>set({toolInheritance:value}));
|
|
1641
|
+
explain(choice(parent,'Subagents without a role',policy.freeform||'off',[{value:'off',label:'Not allowed'},{value:'read-only',label:'Allowed, read only'},{value:'write',label:'Allowed, may write'}],value=>{set({freeform:value});requireWorktree();pruneRoutes(node);}), 'Lets this Agent start a general subagent for any task it writes, without naming a configured role. Read only: the subagent reads and searches. May write: it gets the same permissions as this Agent and needs a writing workspace policy; on an Orchestrator it works in its own Git worktree and each change is reviewed before it lands.');
|
|
1602
1642
|
choice(parent,'Context',policy.context||'selected',[{value:'selected',label:'Selected context only'},{value:'task-only',label:'Task only'}],value=>set({context:value}));
|
|
1603
1643
|
field(parent,'Wall time per child, seconds (blank = inherits the parent)',msToSeconds(policy.maxWallTimeMs),value=>{if(value===undefined)delete policy.maxWallTimeMs;else policy.maxWallTimeMs=secondsToMs(value);node.subagents=policy;},{type:'number',min:1,step:'any',optional:true,placeholder:'Inherits the parent'});
|
|
1604
1644
|
const roles = disclosure(parent,'Configure roles',true);
|
|
@@ -1795,7 +1835,7 @@ function renderInspector() {
|
|
|
1795
1835
|
const panels = inspectorTabs(parent, ['general', 'behavior', 'advanced']); const general = panels.general;
|
|
1796
1836
|
field(general, 'Graph name', graph.name, value => { graph.name = value; renderList(); }, {maxLength:200});
|
|
1797
1837
|
const meta = el('p', [graphIsFixed(graph) ? 'Preset' : '', graph.revision ? `Version ${graph.revision}` : 'Not saved yet'].filter(Boolean).join(' · '), 'graph-meta'); meta.title = `Graph ID: ${graph.id}`; general.append(meta);
|
|
1798
|
-
if (graph
|
|
1838
|
+
if (presetReadOnly(graph)) general.append(el('p', PRESET_READ_ONLY_TIP, 'help'));
|
|
1799
1839
|
const start = field(general,'Starting step',graph.nodes[graph.entry]?.name || '',()=>{}); start.disabled=true; explain(start,'The Orchestrator is optional. Deleting the starting step promotes its first remaining connected successor, or the first remaining step if none is connected.');
|
|
1800
1840
|
field(general, 'Description', graph.metadata?.description, value => {graph.metadata={...graph.metadata,description:value};}, {multiline:true,maxLength:2000});
|
|
1801
1841
|
const widgetGroup = disclosure(panels.behavior, 'Widgets', true);
|
|
@@ -1828,6 +1868,7 @@ function renderInspector() {
|
|
|
1828
1868
|
explain(check(general, 'Jev decisions', node.jevEnabled === true, value => { if (value) node.jevEnabled = true; else delete node.jevEnabled; }), 'Off unless ticked. When Jev is on, it assists this agent with routing decisions. The coding model still implements the task; sign-in, quota and runtime permissions apply.');
|
|
1829
1869
|
const model = panels.model;
|
|
1830
1870
|
modelFields(model, node, value => {node.provider=value.provider; node.model=value.model;});
|
|
1871
|
+
thinkingLevelField(model, node);
|
|
1831
1872
|
const conversation = choice(model, 'Conversation', node.contextPolicy?.conversation ?? 'reuse', [{value:'reuse',label:'Reuse with the same provider and model'}, {value:'isolate',label:'Start an isolated conversation'}], value => {node.contextPolicy={...node.contextPolicy,conversation:value};});
|
|
1832
1873
|
explain(conversation, 'Reuse continues from the preceding Agent with this step\'s instructions and permissions. Different providers or models start fresh. Branches receive separate copies of their shared history. Provider caching and token savings depend on the model service.');
|
|
1833
1874
|
const skills = choice(model, 'Skill inheritance', node.contextPolicy?.skillInheritance ?? 'inherit', [{value:'inherit',label:'Inherit active graph skills'}, {value:'none',label:'Do not inherit skills'}], value => {node.contextPolicy={...node.contextPolicy,skillInheritance:value};});
|
|
@@ -1862,7 +1903,7 @@ function render() { renderHeading(); renderList(); renderLibrary(); renderCanvas
|
|
|
1862
1903
|
async function openGraph(id, options = {}) {
|
|
1863
1904
|
if (state.saving) { status('Wait for the current save before opening another graph.', 'notice'); return false; }
|
|
1864
1905
|
if (state.dirty && !options.discard && !await askConfirm(DISCARD_QUESTION)) return false;
|
|
1865
|
-
try { const opened = options.fetched === undefined ? await api(`/api/graphs/${encodeURIComponent(id)}`) : options.fetched; const locked = graphLocked(id); const capMoved = !locked && hasSubagentCap(opened); state.graph = dropLegacyTokenFields(opened); const migrated = !locked && state.graph.editorMigration === true; state.dirty = migrated || capMoved; delete state.graph.editorMigration; state.viewOnlySource = locked ? copy(state.graph) : null; markSaved(state.dirty ? null : state.graph); clearSelection(); state.undo = []; state.redo = []; state.pendingProviderNodes = null; render(); fit(); status(locked ? FREE_LOCKED_TIP : migrated ? 'This graph was updated to the current format. Save to keep it.' : capMoved ? 'Orchestrator Max subagents moved to Advanced > Subagents. Save to keep it.' : 'Graph loaded', locked || migrated || capMoved ? 'notice' : false); graphOpened(options.reason || 'open'); return true; } catch (error) { status(error.message, true); return false; }
|
|
1906
|
+
try { const opened = options.fetched === undefined ? await api(`/api/graphs/${encodeURIComponent(id)}`) : options.fetched; const locked = graphLocked(id); const capMoved = !locked && hasSubagentCap(opened); state.graph = dropLegacyTokenFields(opened); const migrated = !locked && state.graph.editorMigration === true; state.dirty = migrated || capMoved; delete state.graph.editorMigration; state.viewOnlySource = locked ? copy(state.graph) : null; state.readOnlyNoticed = false; markSaved(state.dirty ? null : state.graph); clearSelection(); state.undo = []; state.redo = []; state.pendingProviderNodes = null; render(); fit(); status(locked ? FREE_LOCKED_TIP : presetReadOnly(state.graph) ? PRESET_READ_ONLY_TIP : migrated ? 'This graph was updated to the current format. Save to keep it.' : capMoved ? 'Orchestrator Max subagents moved to Advanced > Subagents. Save to keep it.' : 'Graph loaded', locked || migrated || capMoved ? 'notice' : false); graphOpened(options.reason || 'open'); return true; } catch (error) { status(error.message, true); return false; }
|
|
1866
1907
|
}
|
|
1867
1908
|
function newId() { return `graph-${crypto.randomUUID()}`; }
|
|
1868
1909
|
function newGraph(duplicate = false, discarded = false) {
|
|
@@ -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><button id="toggle-library" class="icon-button" type="button" aria-expanded="true" aria-controls="library-rail" aria-label="Library" title="Show or hide the library" data-icon="panel-left"></button><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"><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><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><button id="export" type="button" role="menuitem" data-icon="download">Export JSON</button></div></div><button id="toggle-inspector" class="icon-button" aria-expanded="true" aria-label="Inspector" title="Show or hide the inspector" data-icon="panel-right"></button><span id="save-state" class="save-state" hidden>Saved</span><button id="save" class="primary btn-small" hidden>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><span id="status" class="visually-hidden" role="status" aria-live="polite">Connecting to your workspace…</span><div id="toasts" class="toasts" aria-live="off"></div></main>
|
|
6
|
+
<main><header class="chrome"><div id="host-chrome" class="host-chrome" hidden></div><button id="toggle-library" class="icon-button" type="button" aria-expanded="true" aria-controls="library-rail" aria-label="Library" title="Show or hide the library" data-icon="panel-left"></button><div class="graph-heading"><strong id="graph-title">Graph Editor</strong><span id="revision">Loading graphs…</span><span id="read-only-notice" class="chip" role="note" hidden>Read only</span><span id="host-notice" class="chip chip-accent" role="status" hidden></span></div><div class="chrome-actions" id="chrome-actions"><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><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><button id="export" type="button" role="menuitem" data-icon="download">Export JSON</button></div></div><button id="toggle-inspector" class="icon-button" aria-expanded="true" aria-label="Inspector" title="Show or hide the inspector" data-icon="panel-right"></button><span id="save-state" class="save-state" hidden>Saved</span><button id="save" class="primary btn-small" hidden>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><span id="status" class="visually-hidden" role="status" aria-live="polite">Connecting to your workspace…</span><div id="toasts" class="toasts" aria-live="off"></div></main>
|
|
7
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>
|
package/dist/src/graphs.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type JsonSchema, type ValueExpression } from './handoffs.js';
|
|
2
|
+
import { type ReasoningEffort } from './providers.js';
|
|
2
3
|
export type { JsonSchema, ValueExpression } from './handoffs.js';
|
|
4
|
+
/** A node's thinking level: one of the provider levels, or 'auto' for Jev to pick one each time the node starts. */
|
|
5
|
+
export type NodeReasoningEffort = ReasoningEffort | 'auto';
|
|
6
|
+
export declare function isNodeReasoningEffort(value: unknown): value is NodeReasoningEffort;
|
|
3
7
|
export interface CapabilityPolicy {
|
|
4
8
|
filesystem: 'none' | 'read' | 'read-write';
|
|
5
9
|
shell: 'disabled' | 'read-only' | 'allowed';
|
|
@@ -64,6 +68,8 @@ export interface SubagentPolicy {
|
|
|
64
68
|
context?: 'selected' | 'task-only';
|
|
65
69
|
maxWallTimeMs?: number;
|
|
66
70
|
roles?: SubagentRole[];
|
|
71
|
+
/** Lets the agent spawn a general subagent without naming a configured role: read-only, or with the node's own permissions. */
|
|
72
|
+
freeform?: 'off' | 'read-only' | 'write';
|
|
67
73
|
}
|
|
68
74
|
export type OutputSchema = JsonSchema;
|
|
69
75
|
export interface AgentModifiers {
|
|
@@ -105,6 +111,8 @@ export interface GraphNode {
|
|
|
105
111
|
tools?: string[];
|
|
106
112
|
maxIterations?: number;
|
|
107
113
|
jevEnabled?: boolean;
|
|
114
|
+
/** The thinking level this node runs at: a fixed level, or 'auto' for Jev to pick one each time the node starts. */
|
|
115
|
+
reasoningEffort?: NodeReasoningEffort;
|
|
108
116
|
completion?: CompletionPolicy;
|
|
109
117
|
capabilities?: CapabilityPolicy;
|
|
110
118
|
contextPolicy?: ContextPolicy;
|
|
@@ -233,8 +241,22 @@ export declare function intakeCapabilities(node: {
|
|
|
233
241
|
capabilities?: CapabilityPolicy;
|
|
234
242
|
}): CapabilityPolicy;
|
|
235
243
|
export declare const DELIVERED_OUTCOME = "delivered";
|
|
236
|
-
|
|
244
|
+
/**
|
|
245
|
+
* Who a tool set is being built for: `false` the node's own agent, `true` a child sharing its parent's folder,
|
|
246
|
+
* `'worktree'` a child running in its own Git worktree, and `'delegated-worktree'` a child of a delegating
|
|
247
|
+
* Orchestrator running in its own worktree. Only a child in a shared folder is refused command tools.
|
|
248
|
+
*/
|
|
249
|
+
export type CommandScope = boolean | 'worktree' | 'delegated-worktree';
|
|
250
|
+
/** Tools that run commands on the host: the shells, native processes and the QA command tools. */
|
|
251
|
+
export declare function isCommandToolName(name: string): boolean;
|
|
237
252
|
export declare function isWritingRole(role: SubagentRole): boolean;
|
|
253
|
+
/** Freeform subagents of this node may write: the setting is write and the node itself may write files or Git. */
|
|
254
|
+
export declare function freeformWrites(node: GraphNode): boolean;
|
|
255
|
+
/**
|
|
256
|
+
* The general role a spawn without a role runs as, or undefined when the node requires a configured role.
|
|
257
|
+
* The ceiling is the capability policy the child is measured against; read-only narrows it, write takes it whole.
|
|
258
|
+
*/
|
|
259
|
+
export declare function freeformRole(policy: SubagentPolicy, ceiling: CapabilityPolicy): SubagentRole | undefined;
|
|
238
260
|
export declare function delegatesWriting(node: GraphNode): boolean;
|
|
239
261
|
export declare function permitsBuiltInTool(node: Pick<GraphNode, 'capabilities' | 'tools'>, name: string, child?: CommandScope): boolean;
|
|
240
262
|
export declare function capabilitySubset(child: CapabilityPolicy, parent: CapabilityPolicy): boolean;
|
package/dist/src/graphs.js
CHANGED
|
@@ -6,7 +6,10 @@ import { acquireSaveLock, archiveUnpublishedSnapshot, removeLockedFolder, SaveLo
|
|
|
6
6
|
import { validateMappingConstants, validateMappings, validateSchema, validateValue, schemaAt, nodeOutputSchema } from './handoffs.js';
|
|
7
7
|
import { CANONICAL_CODING_TOOLS, canonicalToolName, canonicalizeToolList, toolNameMatches } from './tool-names.js';
|
|
8
8
|
import { DEFAULT_AGENT_GRAPH } from './default-graph.js';
|
|
9
|
-
import { findProviderById, providerModelId } from './providers.js';
|
|
9
|
+
import { findProviderById, providerModelId, REASONING_EFFORTS } from './providers.js';
|
|
10
|
+
export function isNodeReasoningEffort(value) {
|
|
11
|
+
return value === 'auto' || (typeof value === 'string' && REASONING_EFFORTS.includes(value));
|
|
12
|
+
}
|
|
10
13
|
export const REVIEW_NODE_OUTCOMES = ['findings', 'clean', 'stopped'];
|
|
11
14
|
export const REVIEW_NODE_ROUNDS_MAX = 10;
|
|
12
15
|
export const REVIEW_NODE_INSTRUCTION_BYTES = 2_048;
|
|
@@ -293,12 +296,39 @@ export function intakeCapabilities(node) {
|
|
|
293
296
|
git: policy.git === 'none' ? 'none' : 'read', github: 'none', browser: policy.browser, deployment: 'none' };
|
|
294
297
|
}
|
|
295
298
|
export const DELIVERED_OUTCOME = 'delivered';
|
|
299
|
+
/** Tools that run commands on the host: the shells, native processes and the QA command tools. */
|
|
300
|
+
export function isCommandToolName(name) {
|
|
301
|
+
if (name === 'qa.browser_session')
|
|
302
|
+
return false;
|
|
303
|
+
return ['PowerShell', 'Bash', 'NativeExec', 'AsyncProcess', 'PowerShellFast'].includes(canonicalToolName(name)) || isQaToolName(name);
|
|
304
|
+
}
|
|
296
305
|
export function isWritingRole(role) {
|
|
297
306
|
return role.capabilities?.filesystem === 'read-write' || role.capabilities?.git === 'write';
|
|
298
307
|
}
|
|
308
|
+
/** Freeform subagents of this node may write: the setting is write and the node itself may write files or Git. */
|
|
309
|
+
export function freeformWrites(node) {
|
|
310
|
+
const policy = effectiveCapabilities(node);
|
|
311
|
+
return node.subagents?.freeform === 'write' && (policy.filesystem === 'read-write' || policy.git === 'write');
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* The general role a spawn without a role runs as, or undefined when the node requires a configured role.
|
|
315
|
+
* The ceiling is the capability policy the child is measured against; read-only narrows it, write takes it whole.
|
|
316
|
+
*/
|
|
317
|
+
export function freeformRole(policy, ceiling) {
|
|
318
|
+
const mode = policy.freeform ?? 'off';
|
|
319
|
+
if (mode === 'off')
|
|
320
|
+
return undefined;
|
|
321
|
+
const taken = new Set((policy.roles ?? []).map(role => role.id));
|
|
322
|
+
let id = 'general';
|
|
323
|
+
while (taken.has(id))
|
|
324
|
+
id += '-freeform';
|
|
325
|
+
return { id, name: 'General subagent', instruction: 'Complete the bounded task you are given, then report what you did and what you found.',
|
|
326
|
+
capabilities: mode === 'write' ? { ...ceiling } : { ...ceiling, filesystem: ceiling.filesystem === 'none' ? 'none' : 'read',
|
|
327
|
+
git: ceiling.git === 'none' ? 'none' : 'read', shell: 'disabled' } };
|
|
328
|
+
}
|
|
299
329
|
export function delegatesWriting(node) {
|
|
300
330
|
return node.type === 'agent' && node.agentRole === 'orchestrator' && node.subagents?.enabled === true && node.maxSubagents !== 0
|
|
301
|
-
&& (node.subagents.roles ?? []).some(isWritingRole);
|
|
331
|
+
&& ((node.subagents.roles ?? []).some(isWritingRole) || freeformWrites(node));
|
|
302
332
|
}
|
|
303
333
|
const canRunCommands = (policy, child) => child !== true && policy.shell === 'allowed';
|
|
304
334
|
export function permitsBuiltInTool(node, name, child = false) {
|
|
@@ -625,10 +655,12 @@ function validateGraphInternal(value, options = {}) {
|
|
|
625
655
|
const label = `node ${id}`;
|
|
626
656
|
if (!validId(id) || !record(node) || node.id !== id)
|
|
627
657
|
fail(`${label} must have a matching safe id`);
|
|
628
|
-
if (Object.keys(node).some(k => !['id', 'name', 'type', 'position', 'agentRole', 'maxSubagents', 'executor', 'instruction', 'systemPrompt', 'prompt', 'provider', 'model', 'tools', 'maxIterations', 'completion', 'capabilities', 'contextPolicy', 'inputs', 'inputSchema', 'outputSchema', 'limits', 'retry', 'subagents', 'join', 'condition', 'loop', 'action', 'modifiers', 'jevEnabled', 'review'].includes(k)))
|
|
658
|
+
if (Object.keys(node).some(k => !['id', 'name', 'type', 'position', 'agentRole', 'maxSubagents', 'executor', 'instruction', 'systemPrompt', 'prompt', 'provider', 'model', 'tools', 'maxIterations', 'completion', 'capabilities', 'contextPolicy', 'inputs', 'inputSchema', 'outputSchema', 'limits', 'retry', 'subagents', 'join', 'condition', 'loop', 'action', 'modifiers', 'jevEnabled', 'reasoningEffort', 'review'].includes(k)))
|
|
629
659
|
fail(`${label}: unsupported node setting`);
|
|
630
660
|
if (node.jevEnabled !== undefined && (node.type !== 'agent' || typeof node.jevEnabled !== 'boolean'))
|
|
631
661
|
fail(`${label}: jevEnabled must be a boolean on an Agent node`);
|
|
662
|
+
if (node.reasoningEffort !== undefined && (node.type !== 'agent' || !isNodeReasoningEffort(node.reasoningEffort)))
|
|
663
|
+
fail(`${label}: reasoningEffort must be auto, ${REASONING_EFFORTS.join(', ')} on an Agent node`);
|
|
632
664
|
if (!['agent', 'end', 'join', 'parallel', 'condition', 'loop', 'action', 'approval', 'review'].includes(node.type))
|
|
633
665
|
fail(`${label}: unsupported node type`);
|
|
634
666
|
if (node.review !== undefined && node.type !== 'review')
|
|
@@ -842,14 +874,14 @@ function validateGraphInternal(value, options = {}) {
|
|
|
842
874
|
for (const key of Object.keys(s)) {
|
|
843
875
|
if (key === 'maxTokensPerSubagent' || key === 'maxCombinedTokens')
|
|
844
876
|
continue;
|
|
845
|
-
if (!['enabled', 'maxConcurrent', 'maxTotal', 'maxDepth', 'modelPolicy', 'provider', 'model', 'workspace', 'toolInheritance', 'context', 'maxWallTimeMs', 'roles'].includes(key))
|
|
877
|
+
if (!['enabled', 'maxConcurrent', 'maxTotal', 'maxDepth', 'modelPolicy', 'provider', 'model', 'workspace', 'toolInheritance', 'context', 'maxWallTimeMs', 'roles', 'freeform'].includes(key))
|
|
846
878
|
fail(`${label}: unsupported subagent setting ${key}; use a supported SubagentPolicy field`);
|
|
847
879
|
}
|
|
848
880
|
bounds(s.maxConcurrent, `${label} subagent concurrency`, 16);
|
|
849
881
|
bounds(s.maxTotal, `${label} subagent maxTotal`, 1000);
|
|
850
882
|
bounds(s.maxDepth, `${label} subagent maxDepth`, 3);
|
|
851
883
|
bounds(s.maxWallTimeMs, `${label} maxWallTimeMs`);
|
|
852
|
-
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'] }))
|
|
884
|
+
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'], freeform: ['off', 'read-only', 'write'] }))
|
|
853
885
|
if (s[k] !== undefined && !values.includes(s[k]))
|
|
854
886
|
fail(`${label}: invalid subagent ${k} ${JSON.stringify(s[k])}; use one of: ${values.join(', ')}`);
|
|
855
887
|
subagentModelRef({ ...s, provider: s.provider ?? node.provider ?? options.defaultProvider }, `${label} subagent`, options);
|
|
@@ -895,16 +927,35 @@ function validateGraphInternal(value, options = {}) {
|
|
|
895
927
|
fail(`${label}: role ${r.id} capability exceeds parent${node.agentRole === 'orchestrator' && !delegated ? ' intake read-only ceiling; reduce child permissions' : '; reduce child permissions or explicitly grant them to the parent'}`);
|
|
896
928
|
if (r.tools?.some(t => !permitsBuiltInTool(delegated ? { capabilities: parent } : { ...node, capabilities: parent }, t)))
|
|
897
929
|
fail(`${label}: role ${r.id} tools exceed effective parent capabilities; reduce its tools or explicitly grant parent permissions`);
|
|
898
|
-
|
|
899
|
-
|
|
930
|
+
// A role in its own worktree may list command tools; one sharing its parent's folder may not.
|
|
931
|
+
const ownWorktree = s.workspace === 'worktree' && node.agentRole !== 'orchestrator';
|
|
932
|
+
const scope = delegated ? 'delegated-worktree' : ownWorktree ? 'worktree' : true;
|
|
933
|
+
if (r.tools?.some(t => !permitsBuiltInTool({ capabilities: child }, t, scope)))
|
|
934
|
+
fail(`${label}: role ${r.id} tools exceed its child capabilities; remove unavailable tools${scope === true ? ' (subagents in a shared folder cannot use the host shell; select Separate Git worktree to let them run commands)' : ''}`);
|
|
900
935
|
const writes = child.filesystem === 'read-write' || child.git === 'write';
|
|
901
936
|
if (spawningEnabled && s.workspace === 'worktree' && writes && parent.git !== 'write')
|
|
902
937
|
fail(`${label}: writing worktree role ${r.id} requires parent Git write access; grant Git write or select a read-only role`);
|
|
938
|
+
// A role that lists command tools runs them in a worktree it creates, which needs the same Git write access.
|
|
939
|
+
if (spawningEnabled && ownWorktree && child.shell === 'allowed' && r.tools?.some(isCommandToolName) && parent.git !== 'write')
|
|
940
|
+
fail(`${label}: command-running worktree role ${r.id} requires parent Git write access to create its worktree; grant Git write or remove its command tools`);
|
|
903
941
|
if (spawningEnabled && (s.workspace ?? 'shared-read-only') === 'shared-read-only' && writes)
|
|
904
942
|
fail(`${label}: shared read-only subagents cannot write files or Git; reduce role permissions or set subagents.workspace to "shared-write" or "worktree"`);
|
|
905
943
|
if (spawningEnabled && (s.workspace ?? 'shared-read-only') === 'shared-write' && (s.maxConcurrent ?? 3) > 1 && writes)
|
|
906
944
|
fail(`${label}: concurrent writing subagents require separate worktrees; set subagents.workspace to "worktree" or subagents.maxConcurrent to 1`);
|
|
907
945
|
}
|
|
946
|
+
if (spawningEnabled && freeformWrites(node)) {
|
|
947
|
+
const ws = s.workspace ?? 'shared-read-only', orchestrated = node.agentRole === 'orchestrator';
|
|
948
|
+
if (orchestrated && ws !== 'worktree')
|
|
949
|
+
fail(`${label}: freeform writing subagents on an Orchestrator require separate worktrees; set subagents.workspace to worktree (Separate Git worktree) or subagents.freeform to read-only`);
|
|
950
|
+
if (orchestrated && (node.completion?.mode === 'outcomes' ? node.completion.outcomes.includes(DELIVERED_OUTCOME) : node.completion?.outcome === DELIVERED_OUTCOME))
|
|
951
|
+
fail(`${label}: the outcome name ${DELIVERED_OUTCOME} is reserved for Orchestrator delegation; rename the completion outcome`);
|
|
952
|
+
if (ws === 'shared-read-only')
|
|
953
|
+
fail(`${label}: shared read-only subagents cannot write files or Git; set subagents.freeform to read-only or subagents.workspace to shared-write or worktree`);
|
|
954
|
+
if (ws === 'shared-write' && (s.maxConcurrent ?? 3) > 1)
|
|
955
|
+
fail(`${label}: concurrent writing subagents require separate worktrees; set subagents.workspace to worktree or subagents.maxConcurrent to 1`);
|
|
956
|
+
if (ws === 'worktree' && effectiveCapabilities(node).git !== 'write')
|
|
957
|
+
fail(`${label}: freeform writing subagents in worktrees require parent Git write access; grant Git write or set subagents.freeform to read-only`);
|
|
958
|
+
}
|
|
908
959
|
if (spawningEnabled && (s.workspace ?? 'shared-read-only') === 'shared-write' && (s.maxConcurrent ?? 3) > 1 && !s.roles?.length)
|
|
909
960
|
fail(`${label}: concurrent writing subagents require separate worktrees; set subagents.workspace to "worktree" or subagents.maxConcurrent to 1`);
|
|
910
961
|
}
|