@andorra-labs/code 0.1.14 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/dist/src/acp-agent.d.ts +54 -0
  2. package/dist/src/acp-agent.js +991 -0
  3. package/dist/src/agent-definitions.js +29 -6
  4. package/dist/src/agent-execution.js +8 -2
  5. package/dist/src/agent-mcp-catalog.js +2 -0
  6. package/dist/src/agent-mcp.d.ts +3 -1
  7. package/dist/src/agent-mcp.js +97 -11
  8. package/dist/src/andorra/entry.js +21 -3
  9. package/dist/src/andorra/hosted.d.ts +3 -0
  10. package/dist/src/andorra/hosted.js +5 -1
  11. package/dist/src/andorra/notices.d.ts +10 -1
  12. package/dist/src/andorra/notices.js +25 -2
  13. package/dist/src/andorra/terminal.d.ts +2 -0
  14. package/dist/src/andorra/terminal.js +2 -2
  15. package/dist/src/app-server/protocol.d.ts +9 -2
  16. package/dist/src/app-server/protocol.js +1 -1
  17. package/dist/src/app-server/workspace.d.ts +1 -0
  18. package/dist/src/app-server/workspace.js +141 -10
  19. package/dist/src/app-server.d.ts +115 -0
  20. package/dist/src/app-server.js +980 -63
  21. package/dist/src/auth/AuthManager.js +4 -4
  22. package/dist/src/auth/deployment.js +2 -2
  23. package/dist/src/browser-bridge.d.ts +1 -0
  24. package/dist/src/browser-bridge.js +5 -2
  25. package/dist/src/browser-external-app.d.ts +27 -0
  26. package/dist/src/browser-external-app.js +60 -0
  27. package/dist/src/browser-panel-tool.d.ts +6 -0
  28. package/dist/src/browser-panel-tool.js +36 -0
  29. package/dist/src/browser-runner.js +1 -0
  30. package/dist/src/browser-server.d.ts +5 -0
  31. package/dist/src/browser-server.js +27 -3
  32. package/dist/src/browser-ui/style.css +3 -3
  33. package/dist/src/browser-ui/tokens.css +27 -16
  34. package/dist/src/browser-view.d.ts +16 -0
  35. package/dist/src/browser-view.js +60 -2
  36. package/dist/src/bug-report.d.ts +81 -0
  37. package/dist/src/bug-report.js +235 -0
  38. package/dist/src/claude-provider.d.ts +2 -1
  39. package/dist/src/claude-provider.js +13 -9
  40. package/dist/src/cli-sign-in.d.ts +3 -1
  41. package/dist/src/cli-sign-in.js +4 -1
  42. package/dist/src/cli.js +184 -40
  43. package/dist/src/codex-errors.js +4 -1
  44. package/dist/src/coding-tools.js +7 -7
  45. package/dist/src/command-screens.d.ts +9 -2
  46. package/dist/src/command-screens.js +166 -97
  47. package/dist/src/commands.d.ts +3 -2
  48. package/dist/src/commands.js +1 -0
  49. package/dist/src/compaction-phrases.d.ts +4 -0
  50. package/dist/src/compaction-phrases.js +20 -0
  51. package/dist/src/completion-gates.d.ts +22 -0
  52. package/dist/src/completion-gates.js +11 -0
  53. package/dist/src/config.d.ts +5 -0
  54. package/dist/src/config.js +48 -0
  55. package/dist/src/context-compaction.js +2 -1
  56. package/dist/src/decision/DecisionManager.js +3 -2
  57. package/dist/src/decision/requestPhrases.d.ts +4 -0
  58. package/dist/src/decision/requestPhrases.js +23 -0
  59. package/dist/src/github-inbox.d.ts +55 -0
  60. package/dist/src/github-inbox.js +153 -0
  61. package/dist/src/google-provider.d.ts +31 -0
  62. package/dist/src/google-provider.js +153 -0
  63. package/dist/src/graph-health.js +8 -4
  64. package/dist/src/graph-manager-chat.js +6 -1
  65. package/dist/src/graph-provider-portability.js +32 -10
  66. package/dist/src/graph-quota.d.ts +29 -2
  67. package/dist/src/graph-quota.js +68 -10
  68. package/dist/src/graph-runner.js +24 -7
  69. package/dist/src/graph-server.d.ts +1 -1
  70. package/dist/src/graph-server.js +9 -7
  71. package/dist/src/graph-sync.d.ts +1 -0
  72. package/dist/src/graph-sync.js +93 -34
  73. package/dist/src/graph-tool.d.ts +2 -0
  74. package/dist/src/graph-tool.js +2 -2
  75. package/dist/src/graph-ui/app.js +177 -41
  76. package/dist/src/graph-ui/controls.css +1 -0
  77. package/dist/src/graph-ui/edge-router.js +121 -53
  78. package/dist/src/graph-ui/embed.js +2 -2
  79. package/dist/src/graph-ui/icons.js +1 -0
  80. package/dist/src/graph-ui/index.html +1 -1
  81. package/dist/src/graph-ui/manager.css +1 -1
  82. package/dist/src/graph-ui/manager.js +2 -2
  83. package/dist/src/graph-ui/sidebar.js +30 -0
  84. package/dist/src/graph-ui/studio-canvas.js +26 -13
  85. package/dist/src/graph-ui/studio.css +15 -7
  86. package/dist/src/graph-ui/studio.js +11 -4
  87. package/dist/src/graph-ui/style.css +77 -45
  88. package/dist/src/graph-ui/theme.js +3 -36
  89. package/dist/src/graph-ui/tokens.css +27 -19
  90. package/dist/src/graph-visibility.d.ts +31 -0
  91. package/dist/src/graph-visibility.js +102 -0
  92. package/dist/src/graphs.js +4 -3
  93. package/dist/src/live-model.d.ts +24 -0
  94. package/dist/src/live-model.js +37 -0
  95. package/dist/src/managed-sign-in.d.ts +1 -0
  96. package/dist/src/managed-sign-in.js +13 -0
  97. package/dist/src/membership-errors.d.ts +2 -0
  98. package/dist/src/membership-errors.js +5 -1
  99. package/dist/src/membership.d.ts +23 -1
  100. package/dist/src/membership.js +48 -6
  101. package/dist/src/model-health-cache.js +1 -1
  102. package/dist/src/model-metadata.d.ts +1 -1
  103. package/dist/src/model-metadata.js +12 -3
  104. package/dist/src/paged-transcript.d.ts +2 -0
  105. package/dist/src/paged-transcript.js +16 -0
  106. package/dist/src/plan-pass.d.ts +59 -0
  107. package/dist/src/plan-pass.js +165 -0
  108. package/dist/src/provider-connection.js +17 -0
  109. package/dist/src/provider-engine.d.ts +5 -0
  110. package/dist/src/provider-engine.js +6 -3
  111. package/dist/src/provider-import.js +3 -1
  112. package/dist/src/provider-settings.js +14 -2
  113. package/dist/src/providers.d.ts +33 -2
  114. package/dist/src/providers.js +101 -28
  115. package/dist/src/pull-request-checks.d.ts +26 -0
  116. package/dist/src/pull-request-checks.js +56 -0
  117. package/dist/src/pull-request-conversation.d.ts +134 -0
  118. package/dist/src/pull-request-conversation.js +221 -0
  119. package/dist/src/pull-request-create.d.ts +175 -0
  120. package/dist/src/pull-request-create.js +392 -0
  121. package/dist/src/pull-request-details.d.ts +242 -0
  122. package/dist/src/pull-request-details.js +614 -0
  123. package/dist/src/pull-request-edit.d.ts +23 -0
  124. package/dist/src/pull-request-edit.js +91 -0
  125. package/dist/src/pull-request-logs.d.ts +76 -0
  126. package/dist/src/pull-request-logs.js +172 -0
  127. package/dist/src/pull-request-merge.d.ts +112 -0
  128. package/dist/src/pull-request-merge.js +258 -0
  129. package/dist/src/pull-request-review.d.ts +137 -0
  130. package/dist/src/pull-request-review.js +401 -0
  131. package/dist/src/pull-requests.d.ts +43 -2
  132. package/dist/src/pull-requests.js +112 -21
  133. package/dist/src/react-runtime.js +58 -9
  134. package/dist/src/read-document-tool.d.ts +2 -0
  135. package/dist/src/read-document-tool.js +6 -6
  136. package/dist/src/remote/engine-pool.js +42 -6
  137. package/dist/src/run-control.d.ts +10 -0
  138. package/dist/src/run-control.js +24 -0
  139. package/dist/src/run-progress.d.ts +10 -0
  140. package/dist/src/run-progress.js +122 -0
  141. package/dist/src/run-records.d.ts +2 -2
  142. package/dist/src/runtime-environment.d.ts +1 -0
  143. package/dist/src/runtime-environment.js +13 -0
  144. package/dist/src/runtime.d.ts +5 -1
  145. package/dist/src/runtime.js +14 -2
  146. package/dist/src/save-lock.js +14 -7
  147. package/dist/src/session-title.d.ts +3 -0
  148. package/dist/src/session-title.js +5 -2
  149. package/dist/src/sign-in-detection.d.ts +1 -1
  150. package/dist/src/sign-in-detection.js +10 -3
  151. package/dist/src/sign-in-offer.js +1 -1
  152. package/dist/src/skill-commands.js +1 -1
  153. package/dist/src/skills/bundled/bug-report/SKILL.md +80 -0
  154. package/dist/src/skills/bundled/graph-manager/SKILL.md +9 -1
  155. package/dist/src/skills/bundled/graph-manager/errors.md +1 -0
  156. package/dist/src/skills/bundled/provenance.json +7 -2
  157. package/dist/src/skills/runtime-skills.js +1 -0
  158. package/dist/src/subagent-run.js +1 -0
  159. package/dist/src/telemetry/capture-core.d.ts +17 -0
  160. package/dist/src/telemetry/capture-core.js +59 -1
  161. package/dist/src/telemetry/classify.d.ts +3 -1
  162. package/dist/src/telemetry/classify.js +37 -0
  163. package/dist/src/telemetry/emitter.d.ts +2 -0
  164. package/dist/src/telemetry/emitter.js +42 -5
  165. package/dist/src/telemetry/schema.d.ts +22 -0
  166. package/dist/src/telemetry/schema.js +68 -1
  167. package/dist/src/telemetry/surface.d.ts +1 -0
  168. package/dist/src/telemetry/uploader.d.ts +12 -1
  169. package/dist/src/telemetry/uploader.js +30 -2
  170. package/dist/src/terminal-links.d.ts +16 -0
  171. package/dist/src/terminal-links.js +113 -0
  172. package/dist/src/terminal-ui.d.ts +8 -1
  173. package/dist/src/terminal-ui.js +40 -14
  174. package/dist/src/tool-catalog.js +1 -1
  175. package/dist/src/trajectory.js +6 -1
  176. package/dist/src/transcript.d.ts +2 -0
  177. package/dist/src/transcript.js +10 -3
  178. package/dist/src/types.d.ts +9 -0
  179. package/dist/src/usage-analytics.js +18 -10
  180. package/package.json +2 -1
@@ -5,16 +5,43 @@ export declare const FREE_GRAPH_NODE_LIMIT = 3;
5
5
  export declare const FREE_GRAPH_LIMIT_MESSAGE = "The free tier includes 1 custom graph. Upgrade to Premium to create more graphs.";
6
6
  export declare const FREE_NODE_LIMIT_MESSAGE = "Free tier graphs can have up to 3 nodes, not counting Done. Upgrade to Premium for larger graphs.";
7
7
  export declare const FREE_ORCHESTRATOR_MESSAGE = "The Orchestrator is a Premium feature. Free tier graphs can use the other agent nodes.";
8
- export declare const FREE_LOCKED_GRAPH_MESSAGE = "On the free tier only your first custom graph is available. Upgrade to Premium to use this graph.";
8
+ export declare const FREE_LOCKED_GRAPH_MESSAGE = "This graph is view only on the free tier. Duplicate it to make a copy you can change, or upgrade to Premium to use it.";
9
9
  export declare function countedGraphNodes(graph: Pick<Graph, 'nodes'>): number;
10
10
  export declare function freeTierGraphViolation(graph: Pick<Graph, 'nodes'>): string | undefined;
11
+ /**
12
+ * A graph saved by a free account carries `metadata.freeTier: true`, and one saved by a Premium
13
+ * account carries `false`, so which plan made a graph travels with it to another machine.
14
+ */
15
+ export declare function isFreeTierGraph(graph: Pick<Graph, 'metadata'>): boolean;
11
16
  export interface GraphQuota {
12
17
  customGraphs: number;
18
+ /** The one graph a free account may change and run. Absent when every saved graph is view only. */
13
19
  freeGraphId?: string;
14
20
  }
15
- export declare function readGraphQuota(directory: string, graphs?: Graph[]): Promise<GraphQuota>;
21
+ /** Records that a Premium account used this graph folder, so its graphs lock when the account is later free. */
22
+ export declare function notePremiumGraphAccount(directory: string): Promise<void>;
23
+ /**
24
+ * Which saved graph is the free account's own.
25
+ *
26
+ * It is the oldest graph that fits the free limits and either carries the free mark or is the one
27
+ * this folder recorded. A folder no Premium account has used, and that has recorded nothing, keeps
28
+ * its oldest graph that fits: that is the graph a free account owned before graphs carried a mark. `adopt`
29
+ * writes that choice down, so a later upgrade and downgrade does not lose it; pass it only for an
30
+ * account the service confirmed as free.
31
+ */
32
+ export declare function readGraphQuota(directory: string, graphs?: Graph[], options?: {
33
+ adopt?: boolean;
34
+ }): Promise<GraphQuota>;
16
35
  export declare function assertFreeTierSave(graph: Graph, isNew: boolean, directory: string): Promise<void>;
17
36
  export declare function saveFreeTierGraph(graph: Graph, expectedRevision: number | null, directory: string): Promise<Graph>;
37
+ /**
38
+ * Saves for a Premium account, marking the graph as made on Premium. The account's own free graph
39
+ * keeps its mark while it fits the free limits, so it is still the free graph after a downgrade.
40
+ * Growing it past the limits gives the mark up for good, as the storage service gives up its pin:
41
+ * shrinking it later must not take the allowance back from the graph that replaced it.
42
+ */
43
+ export declare function savePremiumGraph(graph: Graph, expectedRevision: number | null, directory: string): Promise<Graph>;
44
+ /** The graph a free account may run: its own graph, within the free limits. Every other saved graph is view only. */
18
45
  export declare function loadFreeTierGraph(id: string, directory: string): Promise<Graph>;
19
46
  export declare class FreeTierLimitError extends PaidMembershipRequiredError {
20
47
  readonly code = "FREE_TIER_LIMIT";
@@ -1,4 +1,4 @@
1
- import { readFile } from 'node:fs/promises';
1
+ import { readFile, writeFile } from 'node:fs/promises';
2
2
  import { join } from 'node:path';
3
3
  import { setTimeout as delay } from 'node:timers/promises';
4
4
  import { GraphConflictError, listGraphs, loadGraph, saveGraph } from './graphs.js';
@@ -9,7 +9,7 @@ export const FREE_GRAPH_NODE_LIMIT = 3;
9
9
  export const FREE_GRAPH_LIMIT_MESSAGE = 'The free tier includes 1 custom graph. Upgrade to Premium to create more graphs.';
10
10
  export const FREE_NODE_LIMIT_MESSAGE = `Free tier graphs can have up to ${FREE_GRAPH_NODE_LIMIT} nodes, not counting Done. Upgrade to Premium for larger graphs.`;
11
11
  export const FREE_ORCHESTRATOR_MESSAGE = 'The Orchestrator is a Premium feature. Free tier graphs can use the other agent nodes.';
12
- export const FREE_LOCKED_GRAPH_MESSAGE = 'On the free tier only your first custom graph is available. Upgrade to Premium to use this graph.';
12
+ export const FREE_LOCKED_GRAPH_MESSAGE = 'This graph is view only on the free tier. Duplicate it to make a copy you can change, or upgrade to Premium to use it.';
13
13
  export function countedGraphNodes(graph) {
14
14
  return Object.values(graph.nodes).filter(node => node.type !== 'end').length;
15
15
  }
@@ -20,6 +20,13 @@ export function freeTierGraphViolation(graph) {
20
20
  return FREE_NODE_LIMIT_MESSAGE;
21
21
  return undefined;
22
22
  }
23
+ /**
24
+ * A graph saved by a free account carries `metadata.freeTier: true`, and one saved by a Premium
25
+ * account carries `false`, so which plan made a graph travels with it to another machine.
26
+ */
27
+ export function isFreeTierGraph(graph) {
28
+ return graph.metadata?.freeTier === true;
29
+ }
23
30
  async function graphCreatedAt(graph, directory) {
24
31
  if (typeof graph.metadata?.createdAt === 'string')
25
32
  return graph.metadata.createdAt;
@@ -32,18 +39,57 @@ async function graphCreatedAt(graph, directory) {
32
39
  return typeof graph.metadata?.updatedAt === 'string' ? graph.metadata.updatedAt : '';
33
40
  }
34
41
  const RECOVERY_COPY = /^cloud-[a-f0-9]{40}$/;
35
- export async function readGraphQuota(directory, graphs) {
42
+ const PREMIUM_SEEN = 'graph-premium-seen.json';
43
+ const FREE_GRAPH_RECORD = 'graph-free.json';
44
+ /** Records that a Premium account used this graph folder, so its graphs lock when the account is later free. */
45
+ export async function notePremiumGraphAccount(directory) {
46
+ try {
47
+ await writeFile(join(directory, PREMIUM_SEEN), 'true', { flag: 'wx', mode: 0o600 });
48
+ }
49
+ catch (error) {
50
+ if (error.code !== 'EEXIST' && error.code !== 'ENOENT')
51
+ throw error;
52
+ }
53
+ }
54
+ async function readJson(path) {
55
+ try {
56
+ return JSON.parse(await readFile(path, 'utf8'));
57
+ }
58
+ catch {
59
+ return undefined;
60
+ }
61
+ }
62
+ /**
63
+ * Which saved graph is the free account's own.
64
+ *
65
+ * It is the oldest graph that fits the free limits and either carries the free mark or is the one
66
+ * this folder recorded. A folder no Premium account has used, and that has recorded nothing, keeps
67
+ * its oldest graph that fits: that is the graph a free account owned before graphs carried a mark. `adopt`
68
+ * writes that choice down, so a later upgrade and downgrade does not lose it; pass it only for an
69
+ * account the service confirmed as free.
70
+ */
71
+ export async function readGraphQuota(directory, graphs, options = {}) {
36
72
  const custom = (graphs ?? await listGraphs(directory)).filter(graph => graph.id !== 'default');
37
73
  if (!custom.length)
38
74
  return { customGraphs: 0 };
39
- const dated = await Promise.all(custom.map(async (graph) => ({ id: graph.id, recovery: RECOVERY_COPY.test(graph.id), created: await graphCreatedAt(graph, directory) })));
75
+ const dated = await Promise.all(custom.map(async (graph) => ({ graph, recovery: RECOVERY_COPY.test(graph.id), created: await graphCreatedAt(graph, directory) })));
40
76
  dated.sort((a, b) => Number(a.recovery) - Number(b.recovery)
41
- || (a.created === b.created ? 0 : !a.created ? 1 : !b.created ? -1 : a.created < b.created ? -1 : 1) || a.id.localeCompare(b.id));
42
- return { customGraphs: custom.length, freeGraphId: dated[0].id };
77
+ || (a.created === b.created ? 0 : !a.created ? 1 : !b.created ? -1 : a.created < b.created ? -1 : 1) || a.graph.id.localeCompare(b.graph.id));
78
+ const fits = (graph) => freeTierGraphViolation(graph) === undefined;
79
+ const recorded = await readJson(join(directory, FREE_GRAPH_RECORD));
80
+ const recordedId = typeof recorded === 'string' ? recorded : undefined;
81
+ let free = dated.find(({ graph }) => fits(graph) && (isFreeTierGraph(graph) || (graph.id === recordedId && graph.metadata?.freeTier !== false)))?.graph.id;
82
+ if (free === undefined && recorded === undefined && await readJson(join(directory, PREMIUM_SEEN)) === undefined) {
83
+ // A graph a Premium account saved says so itself, on any machine it was synced to.
84
+ free = dated.find(({ graph }) => fits(graph) && graph.metadata?.freeTier !== false)?.graph.id;
85
+ if (free !== undefined && options.adopt)
86
+ await writeFile(join(directory, FREE_GRAPH_RECORD), JSON.stringify(free), { mode: 0o600 }).catch(() => { });
87
+ }
88
+ return { customGraphs: custom.length, ...(free === undefined ? {} : { freeGraphId: free }) };
43
89
  }
44
90
  export async function assertFreeTierSave(graph, isNew, directory) {
45
- const quota = await readGraphQuota(directory);
46
- if (isNew ? quota.customGraphs >= FREE_CUSTOM_GRAPH_LIMIT : quota.freeGraphId !== graph.id) {
91
+ const quota = await readGraphQuota(directory, undefined, { adopt: true });
92
+ if (isNew ? quota.freeGraphId !== undefined : quota.freeGraphId !== graph.id) {
47
93
  throw new FreeTierLimitError(isNew ? FREE_GRAPH_LIMIT_MESSAGE : FREE_LOCKED_GRAPH_MESSAGE);
48
94
  }
49
95
  const violation = freeTierGraphViolation(graph);
@@ -66,14 +112,26 @@ export async function saveFreeTierGraph(graph, expectedRevision, directory) {
66
112
  }
67
113
  try {
68
114
  await assertFreeTierSave(graph, expectedRevision === null, directory);
69
- return await saveGraph(graph, expectedRevision, directory);
115
+ return await saveGraph({ ...graph, metadata: { ...graph.metadata, freeTier: true } }, expectedRevision, directory);
70
116
  }
71
117
  finally {
72
118
  await release();
73
119
  }
74
120
  }
121
+ /**
122
+ * Saves for a Premium account, marking the graph as made on Premium. The account's own free graph
123
+ * keeps its mark while it fits the free limits, so it is still the free graph after a downgrade.
124
+ * Growing it past the limits gives the mark up for good, as the storage service gives up its pin:
125
+ * shrinking it later must not take the allowance back from the graph that replaced it.
126
+ */
127
+ export async function savePremiumGraph(graph, expectedRevision, directory) {
128
+ const own = expectedRevision !== null && freeTierGraphViolation(graph) === undefined
129
+ && (isFreeTierGraph(graph) || (graph.metadata?.freeTier !== false && graph.id === await readJson(join(directory, FREE_GRAPH_RECORD))));
130
+ return saveGraph({ ...graph, metadata: { ...graph.metadata, freeTier: own } }, expectedRevision, directory);
131
+ }
132
+ /** The graph a free account may run: its own graph, within the free limits. Every other saved graph is view only. */
75
133
  export async function loadFreeTierGraph(id, directory) {
76
- const quota = await readGraphQuota(directory);
134
+ const quota = await readGraphQuota(directory, undefined, { adopt: true });
77
135
  const graph = await loadGraph(id, undefined, directory);
78
136
  if (quota.freeGraphId !== id)
79
137
  throw new FreeTierLimitError(FREE_LOCKED_GRAPH_MESSAGE);
@@ -23,15 +23,23 @@ import { loadConfig, resolveMemoryConfig } from './config.js';
23
23
  import { advertiseAvailableTools } from './tool-availability.js';
24
24
  import { elapsedMs, monotonicNow } from './duration.js';
25
25
  import { dashboardAdapter } from './dashboard.js';
26
- import { createRunTelemetry, mergeRunTelemetry, recordAttempt, recordTestCommand, recordToolFailure, recordToolUse } from './telemetry/capture.js';
26
+ import { toolBoundaryOpen } from './run-progress.js';
27
+ import { createRunTelemetry, mergeRunTelemetry, recordAttempt, recordErrorOnce, recordTestCommand, recordToolFailure, recordToolUse } from './telemetry/capture.js';
28
+ import { ProviderRequestError, runFailureCode } from './providers.js';
27
29
  import { isTestCommandLine } from './telemetry/classify.js';
28
30
  function absorbTelemetry(result, outcome) {
31
+ // Every branch's errors are kept; why the run stopped is taken from the one outcome it ends on (endOn).
29
32
  if (outcome.telemetry)
30
33
  mergeRunTelemetry(result.telemetry, outcome.telemetry);
31
- if (outcome.providerRequestFailed)
32
- result.providerRequestFailed = true;
33
- if (outcome.providerOverflow)
34
- result.providerOverflow = true;
34
+ }
35
+ /** The run ends on this outcome: its error code and failure evidence, not another branch's, say why it stopped. */
36
+ function endOn(result, outcome) {
37
+ for (const field of ['failureCode', 'providerRequestFailed', 'providerOverflow']) {
38
+ if (outcome[field] === undefined)
39
+ delete result[field];
40
+ else
41
+ result[field] = outcome[field];
42
+ }
35
43
  }
36
44
  const freeze = (value) => {
37
45
  for (const child of Object.values(value))
@@ -266,8 +274,7 @@ export async function runGraph(graph, options) {
266
274
  ?? { nodeId: checkpoint.nodeId, generation: checkpoint.generation ?? 0, path: [], inputs: {}, predecessors: {} };
267
275
  if (!continuableByThisRun(checkpoint.nodeId, checkpoint))
268
276
  continue;
269
- const toolEvent = progress.lastEffectfulToolEvent?.[checkpoint.nodeId];
270
- if (toolEvent !== undefined && Date.parse(checkpoint.savedAt) < Date.parse(toolEvent)) {
277
+ if (toolBoundaryOpen(checkpoint, progress)) {
271
278
  throw new Error(`Cannot resume the "${pinned.nodes[checkpoint.nodeId]?.name ?? checkpoint.nodeId}" node: the stopped attempt ran a tool call after the conversation this checkpoint saved, so re-entering it could repeat an effect the checkpoint does not cover. Check what the call changed, then start a new run.`);
272
279
  }
273
280
  const routed = routedContinuation(checkpoint.nodeId, checkpoint);
@@ -741,6 +748,7 @@ export async function runGraph(graph, options) {
741
748
  result.model = failed.model;
742
749
  result.status = failed.status;
743
750
  result.reason = failed.reason ?? failed.status;
751
+ endOn(result, failed);
744
752
  if (failed.limits)
745
753
  result.limits = runClockBounds(failed.limits, result.reason, failedActivation.nodeId);
746
754
  break;
@@ -790,6 +798,7 @@ export async function runGraph(graph, options) {
790
798
  const cancelled = (options.context.userSignal ?? options.context.signal).aborted;
791
799
  result.status = cancelled ? 'cancelled' : budget.expired() ? 'exhausted' : outcome.status;
792
800
  result.reason = cancelled ? 'cancelled' : budget.expired() ? 'wallTimeMs' : outcome.reason ?? outcome.status;
801
+ endOn(result, outcome);
793
802
  if (outcome.limits)
794
803
  result.limits = runClockBounds(outcome.limits, result.reason, nodeId);
795
804
  break;
@@ -1007,6 +1016,7 @@ export async function runGraph(graph, options) {
1007
1016
  if (continuation.status !== 'succeeded' || !continuation.completion) {
1008
1017
  result.status = continuation.status;
1009
1018
  result.reason = continuation.reason ?? continuation.status;
1019
+ endOn(result, continuation);
1010
1020
  break;
1011
1021
  }
1012
1022
  const condition = pinned.nodes[lastAgentActivation.nodeId].modifiers?.condition;
@@ -1087,6 +1097,13 @@ export async function runGraph(graph, options) {
1087
1097
  const deadline = budget.expired() || signal.aborted;
1088
1098
  result.status = cancelled ? 'cancelled' : deadline ? 'exhausted' : 'infrastructure_error';
1089
1099
  result.reason = cancelled ? 'cancelled' : deadline ? 'wallTimeMs' : error instanceof Error ? error.message : 'Graph runtime failure';
1100
+ if (cancelled || deadline)
1101
+ endOn(result, {});
1102
+ else
1103
+ endOn(result, {
1104
+ failureCode: recordErrorOnce(result.telemetry ??= createRunTelemetry(), error, runFailureCode(error)),
1105
+ ...(error instanceof ProviderRequestError ? { providerRequestFailed: true, ...(error.contextOverflow ? { providerOverflow: true } : {}) } : {}),
1106
+ });
1090
1107
  }
1091
1108
  try {
1092
1109
  await options.commandMemory?.flush(options.context.userSignal ?? options.context.signal);
@@ -4,7 +4,7 @@ import { GraphSync } from './graph-sync.js';
4
4
  import { GraphManagerChat, type ManagerGraphRevision } from './graph-manager-chat.js';
5
5
  export declare function readManagerGraphRevision(id: string, graphDirectory: string): Promise<ManagerGraphRevision | undefined>;
6
6
  export type GraphManagerChatSession = Pick<GraphManagerChat, 'subscribe' | 'send' | 'approve' | 'answer' | 'cancel' | 'reset' | 'close'>;
7
- export declare function createGraphSessionCheck(subject: string | undefined, status?: (signal?: AbortSignal) => Promise<import("./auth/types.js").AuthStatus>, membership?: (signal?: AbortSignal, home?: string) => Promise<Membership>): () => Promise<void>;
7
+ export declare function createGraphSessionCheck(subject: string | undefined, status?: (signal?: AbortSignal) => Promise<import("./auth/types.js").AuthStatus>, membership?: () => Promise<Membership>): () => Promise<void>;
8
8
  export declare const EDITOR_MEMBERSHIP_TTL_MS = 30000;
9
9
  export declare function sharedRead<T>(read: () => Promise<T>, ttlMs: number, now?: () => number): () => Promise<T>;
10
10
  export declare function requireGraphProviders(directory?: string): Promise<Config>;
@@ -6,15 +6,15 @@ import { execFile } from 'node:child_process';
6
6
  import { changeConfigFile, configDirectory, loadConfig, validateConfig } from './config.js';
7
7
  import { stampGraphProviderProfiles } from './graph-provider-portability.js';
8
8
  import { resetDeletedGraphSelection } from './graph-selection.js';
9
- import { listGraphs, loadGraph, saveGraph, saveGraphOrder, validateGraph, migrateGraphForEditor, deleteGraph, isDeletedGraph, withoutDeletedGraphs, GRAPH_MANAGER_GRAPH_ID, reservedGraphId } from './graphs.js';
9
+ import { listGraphs, loadGraph, saveGraphOrder, validateGraph, migrateGraphForEditor, deleteGraph, isDeletedGraph, withoutDeletedGraphs, GRAPH_MANAGER_GRAPH_ID, reservedGraphId } from './graphs.js';
10
10
  import { createTools } from './tools.js';
11
11
  import { AutomationStore } from './automations.js';
12
12
  import { deleteAgentDefinition, exportAgentDefinition, importAgentDefinition, listAgentDefinitions, readAgentDefinition, saveAgentDefinition, validateAgentDefinition } from './agent-definitions.js';
13
13
  import { discoverModelMetadata, resolveModelContext } from './model-metadata.js';
14
14
  import { MODEL_LISTING_TIMEOUT_MS, providerLabel, providerModels, recordProviderModel } from './providers.js';
15
15
  import { PaidMembershipRequiredError, readGraphMembership } from './membership.js';
16
- import { getMembership } from './membership.js';
17
- import { FREE_CUSTOM_GRAPH_LIMIT, FREE_GRAPH_NODE_LIMIT, FreeTierLimitError, readGraphQuota, saveFreeTierGraph } from './graph-quota.js';
16
+ import { getGraphMembership } from './membership.js';
17
+ import { FREE_CUSTOM_GRAPH_LIMIT, FREE_GRAPH_NODE_LIMIT, FreeTierLimitError, notePremiumGraphAccount, readGraphQuota, saveFreeTierGraph, savePremiumGraph } from './graph-quota.js';
18
18
  import { getAuthStatus } from './auth/index.js';
19
19
  import { readActivity } from './activity.js';
20
20
  import { graphStorageDirectory } from './graph-account.js';
@@ -43,7 +43,7 @@ async function readBody(req, limit) {
43
43
  }
44
44
  const filled = (value) => typeof value === 'string' && value.trim() !== '';
45
45
  const setupMessage = 'No providers configured. Run `andorra` and open `/providers` first, then retry `andorra graph`.';
46
- export function createGraphSessionCheck(subject, status = getAuthStatus, membership = getMembership) {
46
+ export function createGraphSessionCheck(subject, status = getAuthStatus, membership = getGraphMembership) {
47
47
  let revoked = false;
48
48
  return async () => {
49
49
  const current = await status();
@@ -112,7 +112,7 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
112
112
  await sync?.start();
113
113
  // The sign-in state is local and read on every request, so signing out or switching accounts
114
114
  // ends the session at once; the account service's answer is a network call and is reused briefly.
115
- const sessionMembership = sharedRead(() => getMembership(), EDITOR_MEMBERSHIP_TTL_MS);
115
+ const sessionMembership = sharedRead(() => getGraphMembership(), EDITOR_MEMBERSHIP_TTL_MS);
116
116
  const checkSession = checkMembership === readGraphMembership
117
117
  ? createGraphSessionCheck(account.subject, sharedRead(() => getAuthStatus(), 0), sessionMembership)
118
118
  : checkMembership;
@@ -125,6 +125,8 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
125
125
  const access = await readMembership();
126
126
  if (!access.unavailable)
127
127
  lastPaid = access.paid;
128
+ if (!access.unavailable && access.paid)
129
+ await notePremiumGraphAccount(graphDirectory);
128
130
  return lastPaid !== true;
129
131
  };
130
132
  await freeTier();
@@ -447,7 +449,7 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
447
449
  }
448
450
  }
449
451
  const plan = free
450
- ? { paid: false, customGraphLimit: FREE_CUSTOM_GRAPH_LIMIT, nodeLimit: FREE_GRAPH_NODE_LIMIT, ...await readGraphQuota(graphDirectory, savedGraphs) }
452
+ ? { paid: false, customGraphLimit: FREE_CUSTOM_GRAPH_LIMIT, nodeLimit: FREE_GRAPH_NODE_LIMIT, ...await readGraphQuota(graphDirectory, savedGraphs, { adopt: true }) }
451
453
  : { paid: true };
452
454
  reply(res, 200, { plan, graphs, graphMigrationErrors, definitions: await listAgentDefinitions(directory), defaultProvider: config.provider, providers: providerRegistryPayload(config.providers), tools: [...createTools().filter(tool => tool.providerVisible !== false).map(tool => tool.name), 'git_read', 'read_artifact', 'write_artifact', 'repo_explore', 'memory_search', 'read_skill_resource', 'browser.panel', 'browser.incognito', 'browser.extensions'], runtime: { spawnAvailable: true, rawShellForSubagents: false, browser: true, deployment: false } });
453
455
  return;
@@ -582,7 +584,7 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
582
584
  return;
583
585
  }
584
586
  const expected = graph.revision === 0 ? null : graph.revision;
585
- const saved = await freeTier() ? await saveFreeTierGraph(stamped, expected, graphDirectory) : await saveGraph(stamped, expected, graphDirectory);
587
+ const saved = await freeTier() ? await saveFreeTierGraph(stamped, expected, graphDirectory) : await savePremiumGraph(stamped, expected, graphDirectory);
586
588
  await sync?.reviveGraph(saved.id);
587
589
  void sync?.sync();
588
590
  reply(res, 200, saved);
@@ -23,6 +23,7 @@ export declare class GraphSync {
23
23
  private generation;
24
24
  private deadline;
25
25
  private readonly lastDraft;
26
+ private readonly stored;
26
27
  private readonly folder;
27
28
  constructor(directory: string, subject: string, deps?: GraphSyncDependencies);
28
29
  start(): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import { createHash, randomUUID } from 'node:crypto';
2
- import { mkdir, readdir, readFile, rename, writeFile, link, unlink } from 'node:fs/promises';
2
+ import { mkdir, readdir, readFile, rename, stat, writeFile, link, unlink } from 'node:fs/promises';
3
3
  import { setTimeout as delay } from 'node:timers/promises';
4
4
  import { join, relative } from 'node:path';
5
5
  import { AUTH_REFRESH_BUDGET_MS, getAccessToken, getAuthConfiguration, getAuthStatus } from './auth/index.js';
@@ -118,6 +118,7 @@ export class GraphSync {
118
118
  generation = 0;
119
119
  deadline = 0;
120
120
  lastDraft = new Map();
121
+ stored = new Map();
121
122
  folder;
122
123
  constructor(directory, subject, deps = defaults) {
123
124
  this.directory = directory;
@@ -574,6 +575,7 @@ export class GraphSync {
574
575
  || (saved.file !== undefined && (typeof saved.file !== 'string' || !/^(?:\d+|[a-f0-9]{64})\.json$/.test(saved.file)))
575
576
  || (saved.drafts !== undefined && typeof saved.drafts !== 'boolean')
576
577
  || (saved.invalid !== undefined && (!Number.isSafeInteger(saved.invalid) || saved.invalid < 0))
578
+ || (saved.head !== undefined && !safeId(saved.head))
577
579
  || (saved.refused !== undefined && (!Array.isArray(saved.refused) || saved.refused.length > 10_000
578
580
  || saved.refused.some((file) => typeof file !== 'string' || !REFUSED_FILE.test(file)))))
579
581
  throw new Error('Invalid local checkpoint');
@@ -585,21 +587,36 @@ export class GraphSync {
585
587
  let processed = 0, localComplete = false;
586
588
  const refused = new Set(local.refused ?? []);
587
589
  let confirmKept;
590
+ // Resolves true when the file cost a request, false when it was already stored or cannot be read.
591
+ // `head` marks the newest-revision pass below, whose files the history sweep also visits and counts.
588
592
  const upload = async (path, kind, filename, options = {}) => {
589
- let raw;
593
+ let raw, mark;
590
594
  try {
595
+ // A file this process already found stored is recognized by its size and times, without opening it:
596
+ // every pass now visits every file, and reading them all again each time would cost far more than it saves.
597
+ const info = await stat(path);
598
+ mark = `${info.size}:${info.mtimeMs}:${info.ino}`;
599
+ if (!options.confirm && this.stored.get(path) === mark)
600
+ return false;
591
601
  const body = await readFile(path, 'utf8');
592
- if (!options.confirm && receipts[path] === digest(body))
602
+ if (!options.confirm && receipts[path] === digest(body)) {
603
+ this.stored.set(path, mark);
593
604
  return false;
605
+ }
594
606
  raw = kind === 'revision' ? envelope(kind, JSON.parse(body)) : body;
595
607
  parseSnapshot(raw, kind === 'draft' ? filename.slice(0, -5) : digest(raw));
596
608
  }
597
609
  catch {
598
- local.invalid = (local.invalid ?? 0) + 1;
610
+ if (!options.head)
611
+ local.invalid = (local.invalid ?? 0) + 1;
599
612
  return false;
600
613
  }
601
614
  const hash = digest(raw);
602
- if (options.confirm || !await this.cached(hash)) {
615
+ if (!options.confirm && await this.cached(hash)) {
616
+ this.stored.set(path, mark);
617
+ return false;
618
+ }
619
+ {
603
620
  if (this.status === recheck)
604
621
  this.status = { state: 'syncing', detail: 'Saving graphs to your account…' };
605
622
  try {
@@ -614,47 +631,89 @@ export class GraphSync {
614
631
  return true;
615
632
  }
616
633
  await immutable(join(this.folder, 'snapshots', `${hash}.json`), raw);
634
+ this.stored.set(path, mark);
617
635
  return true;
618
636
  }
619
- return false;
620
637
  };
621
638
  const exhausted = () => processed >= 32 || this.now() >= localDeadline || this.stopped;
622
- if (!local.drafts) {
623
- const dirs = (await entries(join(this.directory, 'graphs'))).filter(dir => dir.isDirectory() && safeId(dir.name) && !deleted.has(dir.name)).sort((a, b) => a.name < b.name ? -1 : 1);
624
- const kept = (await readGraphQuota(this.directory).catch(() => undefined))?.freeGraphId;
625
- const latest = kept && dirs.some(dir => dir.name === kept)
626
- ? (await entries(join(this.directory, 'graphs', kept))).filter(file => file.isFile() && /^\d+\.json$/.test(file.name))
627
- .sort((a, b) => Number.parseInt(b.name, 10) - Number.parseInt(a.name, 10))[0]
628
- : undefined;
629
- if (kept && latest) {
630
- let confirmed = false;
631
- confirmKept = async () => {
632
- if (confirmed)
633
- return;
634
- confirmed = true;
635
- await upload(join(this.directory, 'graphs', kept, latest.name), 'revision', latest.name, { pin: true, confirm: true });
636
- };
637
- if (!local.directory && await upload(join(this.directory, 'graphs', kept, latest.name), 'revision', latest.name, { pin: true }))
638
- processed++;
639
+ // A file that was already stored costs no request, so it does not count against the batch and its
640
+ // checkpoint is written once for the run of them: a sweep over an account's settled history takes
641
+ // one pass, not one pass per 32 files.
642
+ let unsaved = false;
643
+ const advance = async (worked) => {
644
+ if (!worked) {
645
+ unsaved = true;
646
+ return;
647
+ }
648
+ processed++;
649
+ unsaved = false;
650
+ await atomic(localPath, JSON.stringify(local));
651
+ };
652
+ const dirs = (await entries(join(this.directory, 'graphs'))).filter(dir => dir.isDirectory() && safeId(dir.name) && !deleted.has(dir.name)).sort((a, b) => a.name < b.name ? -1 : 1);
653
+ const revisions = async (id) => (await entries(join(this.directory, 'graphs', id))).filter(file => file.isFile() && /^\d+\.json$/.test(file.name));
654
+ const newest = async (id) => (await revisions(id)).sort((a, b) => Number.parseInt(b.name, 10) - Number.parseInt(a.name, 10))[0];
655
+ const kept = (await readGraphQuota(this.directory).catch(() => undefined))?.freeGraphId;
656
+ const latest = kept && dirs.some(dir => dir.name === kept) ? await newest(kept) : undefined;
657
+ if (kept && latest) {
658
+ let confirmed = false;
659
+ confirmKept = async () => {
660
+ if (confirmed)
661
+ return;
662
+ confirmed = true;
663
+ await upload(join(this.directory, 'graphs', kept, latest.name), 'revision', latest.name, { pin: true, confirm: true });
664
+ };
665
+ }
666
+ // The newest revision of every graph goes up before the sweep resumes, the kept graph first so it
667
+ // takes the free pin. A graph that was just published is therefore stored by the pass its save
668
+ // starts, wherever the sweep's checkpoint stands; the sweep still carries the older revisions.
669
+ // It shares the sweep's batch and takes at most half its local time, so neither many new graphs nor
670
+ // a collection too large to check in one slice keeps the pass from the sweep and the account index.
671
+ // A scan that is cut short records the last graph it checked and the next pass carries on after it.
672
+ const refusedBefore = refused.size, resumedAfter = local.head;
673
+ const headDeadline = Math.min(localDeadline, this.now() + 2500);
674
+ const others = dirs.filter(dir => dir.name !== kept);
675
+ const rotated = resumedAfter === undefined ? others
676
+ : [...others.filter(dir => dir.name > resumedAfter), ...others.filter(dir => dir.name <= resumedAfter)];
677
+ let headsDone = true;
678
+ for (const dir of [...dirs.filter(dir => dir.name === kept), ...rotated]) {
679
+ if (processed >= 32 || this.now() >= headDeadline || this.stopped) {
680
+ headsDone = false;
681
+ break;
639
682
  }
683
+ const head = dir.name === kept ? latest : await newest(dir.name);
684
+ if (dir.name !== kept)
685
+ local.head = dir.name;
686
+ if (!head)
687
+ continue;
688
+ const path = join(this.directory, 'graphs', dir.name, head.name);
689
+ if (refused.has(relative(this.directory, path).replace(/\\/g, '/')))
690
+ continue;
691
+ if (await upload(path, 'revision', head.name, { pin: dir.name === kept, head: true }))
692
+ processed++;
693
+ }
694
+ if (headsDone)
695
+ delete local.head;
696
+ if (refused.size > refusedBefore || local.head !== resumedAfter)
697
+ await atomic(localPath, JSON.stringify(local));
698
+ if (!local.drafts) {
640
699
  outer: for (const dir of dirs) {
641
700
  if (local.directory && dir.name < local.directory)
642
701
  continue;
643
- const files = (await entries(join(this.directory, 'graphs', dir.name))).filter(file => file.isFile() && /^\d+\.json$/.test(file.name)).sort((a, b) => a.name < b.name ? -1 : 1);
702
+ const files = (await revisions(dir.name)).sort((a, b) => a.name < b.name ? -1 : 1);
644
703
  for (const file of files) {
645
704
  if (dir.name === local.directory && local.file && file.name <= local.file)
646
705
  continue;
647
706
  if (exhausted())
648
707
  break outer;
649
- await upload(join(this.directory, 'graphs', dir.name, file.name), 'revision', file.name, { pin: dir.name === kept });
708
+ const worked = await upload(join(this.directory, 'graphs', dir.name, file.name), 'revision', file.name, { pin: dir.name === kept });
650
709
  local.directory = dir.name;
651
710
  local.file = file.name;
652
- processed++;
653
- await atomic(localPath, JSON.stringify(local));
711
+ await advance(worked);
654
712
  }
655
713
  }
656
714
  if (!exhausted()) {
657
- local = { drafts: true, invalid: local.invalid, ...(refused.size ? { refused: [...refused] } : {}) };
715
+ local = { drafts: true, invalid: local.invalid, ...(refused.size ? { refused: [...refused] } : {}), ...(local.head ? { head: local.head } : {}) };
716
+ unsaved = false;
658
717
  await atomic(localPath, JSON.stringify(local));
659
718
  }
660
719
  }
@@ -674,22 +733,22 @@ export class GraphSync {
674
733
  if (deleted.has(parseSnapshot(raw, file.name.slice(0, -5)).graphId)) {
675
734
  await unlink(join(this.directory, 'graph-drafts', file.name)).catch(() => { });
676
735
  local.file = file.name;
677
- processed++;
678
- await atomic(localPath, JSON.stringify(local));
736
+ await advance(true);
679
737
  continue;
680
738
  }
681
739
  }
682
740
  catch { }
683
741
  }
684
- await upload(join(this.directory, 'graph-drafts', file.name), 'draft', file.name);
742
+ const worked = await upload(join(this.directory, 'graph-drafts', file.name), 'draft', file.name);
685
743
  local.file = file.name;
686
- processed++;
687
- await atomic(localPath, JSON.stringify(local));
744
+ await advance(worked);
688
745
  }
689
746
  }
747
+ if (unsaved && !localComplete)
748
+ await atomic(localPath, JSON.stringify(local));
690
749
  const invalidLocalFiles = local.invalid ?? 0;
691
750
  if (localComplete)
692
- await atomic(localPath, '{}');
751
+ await atomic(localPath, JSON.stringify(local.head ? { head: local.head } : {}));
693
752
  const progressPath = join(this.folder, 'index-progress.json');
694
753
  let progress = {};
695
754
  try {
@@ -2,6 +2,7 @@ import type { Tool } from './types.js';
2
2
  export interface GraphBackend {
3
3
  call(name: string, args: unknown, options?: {
4
4
  beforeSave?: () => void;
5
+ workspace?: string;
5
6
  }): Promise<{
6
7
  ok: true;
7
8
  data: unknown;
@@ -20,6 +21,7 @@ export declare class GraphBackendPool {
20
21
  });
21
22
  call(directory: string, action: string, args: unknown, options?: {
22
23
  beforeSave?: () => void;
24
+ workspace?: string;
23
25
  }): Promise<{
24
26
  ok: true;
25
27
  data: unknown;
@@ -61,7 +61,7 @@ function actionSummary() {
61
61
  export function createGraphTool(pool = sharedPool) {
62
62
  return {
63
63
  name: 'graphs', capability: 'external', executionMode: 'sequential',
64
- description: 'Create, edit, validate, publish, delete or restore Andorra graphs (multi-agent workflows) in the signed-in account\'s graph store, the same store the Graph Builder and graph picker use. Never write graph files on disk. '
64
+ description: 'Create, edit, validate, publish, delete or restore Andorra graphs, and choose which projects list them, (multi-agent workflows) in the signed-in account\'s graph store, the same store the Graph Builder and graph picker use. Never write graph files on disk. '
65
65
  + 'Call action andorra_graph_guide first for node types, ports, limits and error codes; load the skill andorra:graph-manager to design a graph with the user. '
66
66
  + 'Put the action\'s arguments in args. Drafts are kept in this Andorra process for up to an hour; publish saves a revision and syncs it to the account. Publish, delete and restore ask the user for permission, except under Full Access, which approves them without a prompt; never tell the user a prompt is coming when the task runs in Full Access. '
67
67
  + `Actions and their args (* required): ${actionSummary()}.`,
@@ -93,7 +93,7 @@ export function createGraphTool(pool = sharedPool) {
93
93
  throw error;
94
94
  }
95
95
  };
96
- const reply = await pool.call(context.automationDirectory ?? configDirectory(), action, input, { beforeSave });
96
+ const reply = await pool.call(context.automationDirectory ?? configDirectory(), action, input, { beforeSave, workspace: context.workspace });
97
97
  if (refused !== undefined)
98
98
  throw refused;
99
99
  let text = JSON.stringify(reply);