@sapiom/harness 0.8.9 → 0.10.0
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/CHANGELOG.md +99 -0
- package/README.md +11 -1
- package/dist/core/agent-project-discovery.d.ts +235 -1
- package/dist/core/agent-project-discovery.d.ts.map +1 -1
- package/dist/core/agent-project-discovery.js +303 -1
- package/dist/core/agent-project-discovery.js.map +1 -1
- package/dist/core/canvas-interconnections.d.ts +31 -0
- package/dist/core/canvas-interconnections.d.ts.map +1 -1
- package/dist/core/canvas-interconnections.js +294 -21
- package/dist/core/canvas-interconnections.js.map +1 -1
- package/dist/core/canvas-render.d.ts +32 -0
- package/dist/core/canvas-render.d.ts.map +1 -1
- package/dist/core/canvas-render.js +50 -41
- package/dist/core/canvas-render.js.map +1 -1
- package/dist/core/definition-name.d.ts +12 -0
- package/dist/core/definition-name.d.ts.map +1 -1
- package/dist/core/definition-name.js +14 -5
- package/dist/core/definition-name.js.map +1 -1
- package/dist/core/system-graph-inventory.d.ts +68 -0
- package/dist/core/system-graph-inventory.d.ts.map +1 -0
- package/dist/core/system-graph-inventory.js +312 -0
- package/dist/core/system-graph-inventory.js.map +1 -0
- package/dist/core/system-graph-relationships.d.ts +41 -0
- package/dist/core/system-graph-relationships.d.ts.map +1 -0
- package/dist/core/system-graph-relationships.js +98 -0
- package/dist/core/system-graph-relationships.js.map +1 -0
- package/dist/core/system-graph-store.d.ts +45 -0
- package/dist/core/system-graph-store.d.ts.map +1 -0
- package/dist/core/system-graph-store.js +222 -0
- package/dist/core/system-graph-store.js.map +1 -0
- package/dist/core/system-graph-watcher.d.ts +51 -0
- package/dist/core/system-graph-watcher.d.ts.map +1 -0
- package/dist/core/system-graph-watcher.js +448 -0
- package/dist/core/system-graph-watcher.js.map +1 -0
- package/dist/core/system-graph.d.ts +43 -0
- package/dist/core/system-graph.d.ts.map +1 -0
- package/dist/core/system-graph.js +321 -0
- package/dist/core/system-graph.js.map +1 -0
- package/dist/core/workflow-registry.d.ts +84 -6
- package/dist/core/workflow-registry.d.ts.map +1 -1
- package/dist/core/workflow-registry.js +191 -91
- package/dist/core/workflow-registry.js.map +1 -1
- package/dist/core/workspace-watcher.d.ts +21 -13
- package/dist/core/workspace-watcher.d.ts.map +1 -1
- package/dist/core/workspace-watcher.js +79 -81
- package/dist/core/workspace-watcher.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/server/agent-move.d.ts +134 -0
- package/dist/server/agent-move.d.ts.map +1 -0
- package/dist/server/agent-move.js +343 -0
- package/dist/server/agent-move.js.map +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +275 -22
- package/dist/server/index.js.map +1 -1
- package/dist/server/rest.d.ts +3 -0
- package/dist/server/rest.d.ts.map +1 -1
- package/dist/server/rest.js +3 -0
- package/dist/server/rest.js.map +1 -1
- package/dist/server/studio-rail.d.ts +76 -0
- package/dist/server/studio-rail.d.ts.map +1 -0
- package/dist/server/studio-rail.js +234 -0
- package/dist/server/studio-rail.js.map +1 -0
- package/dist/server/system-graph.d.ts +14 -0
- package/dist/server/system-graph.d.ts.map +1 -0
- package/dist/server/system-graph.js +40 -0
- package/dist/server/system-graph.js.map +1 -0
- package/dist/server/workflow-graph.d.ts +43 -0
- package/dist/server/workflow-graph.d.ts.map +1 -0
- package/dist/server/workflow-graph.js +200 -0
- package/dist/server/workflow-graph.js.map +1 -0
- package/dist/shared/system-graph.d.ts +59 -0
- package/dist/shared/system-graph.d.ts.map +1 -0
- package/dist/shared/system-graph.js +76 -0
- package/dist/shared/system-graph.js.map +1 -0
- package/dist/shared/types.d.ts +45 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/shared/types.js.map +1 -1
- package/dist/web/assets/index-BLrCZ-6M.css +32 -0
- package/dist/web/assets/index-CzCPIbq9.js +513 -0
- package/dist/web/index.html +2 -2
- package/package.json +3 -3
- package/dist/web/assets/index-B18B2y5o.js +0 -494
- package/dist/web/assets/index-jGBbXx9R.css +0 -32
|
@@ -8,7 +8,142 @@ import * as fs from "node:fs";
|
|
|
8
8
|
import * as fsp from "node:fs/promises";
|
|
9
9
|
import * as path from "node:path";
|
|
10
10
|
import { AGENT_PROJECT_MARKER } from "../shared/types.js";
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* How deep a scan looks for agent projects beneath a chosen root.
|
|
13
|
+
*
|
|
14
|
+
* This was 3, which predated the project-rooted rail: it assumed the root the
|
|
15
|
+
* user opened was more or less the agent's own folder. Under a chosen project
|
|
16
|
+
* root, depth is normal — `<root>/backend/src/agents/<agent>` is four segments
|
|
17
|
+
* down and `<root>/apps/<app>/src/features/<x>/agents/<agent>` is six. At 3
|
|
18
|
+
* those agents are not found at all and file under "No workspace"; on a
|
|
19
|
+
* measured root that was well over a third of the rail.
|
|
20
|
+
*
|
|
21
|
+
* 8 leaves headroom above the deepest realistic layout without becoming a walk
|
|
22
|
+
* of the user's home directory. It is NOT what keeps the scan cheap — see
|
|
23
|
+
* AGENT_PROJECT_SCAN_MAX_NODES. What depth still buys is (a) a pathological
|
|
24
|
+
* deep chain terminating in 8 steps rather than by exhausting a node budget,
|
|
25
|
+
* and (b) a *deterministic* outer envelope, which reconciliation needs: the
|
|
26
|
+
* registry may only forget a project it can prove it would have looked for.
|
|
27
|
+
*/
|
|
28
|
+
export const AGENT_PROJECT_SCAN_MAX_DEPTH = 8;
|
|
29
|
+
/**
|
|
30
|
+
* The bound that actually governs scan cost: how many directories one walk may
|
|
31
|
+
* enter. Depth alone cannot do this job, and the numbers are why.
|
|
32
|
+
*
|
|
33
|
+
* Measured on this machine (macOS/APFS) against real roots on a real install,
|
|
34
|
+
* per directory entered = one marker `lstat` + one `readdir`, warm cache
|
|
35
|
+
* ~22-25 us/dir at every depth:
|
|
36
|
+
*
|
|
37
|
+
* root depth 3 depth 8 unbounded
|
|
38
|
+
* a single repo 119 dirs 242 dirs 7 ms 242 dirs
|
|
39
|
+
* ~/sapiom/sapiom-js 758 dirs 9,016 dirs 196 ms 9,195 dirs
|
|
40
|
+
* ~/sapiom/Sapiom 1,298 dirs 35,489 dirs 847 ms 47,544 dirs
|
|
41
|
+
*
|
|
42
|
+
* So raising the depth cap alone makes a 32 ms scan an 847 ms one on a root a
|
|
43
|
+
* user would plausibly open, and the watcher below pays that synchronously on
|
|
44
|
+
* a debounce. Cost is linear and predictable in directories entered, so that
|
|
45
|
+
* is what we bound.
|
|
46
|
+
*
|
|
47
|
+
* Pruning harder by NAME was the other candidate and does not pay: extending
|
|
48
|
+
* the ignored-directory list with the usual suspects (`.venv`, `target`,
|
|
49
|
+
* `vendor`, `coverage`, `.turbo`, `__pycache__`, `out`, ...) removed 0.5-11% of
|
|
50
|
+
* the dirs on the roots above. What is actually there is source directories
|
|
51
|
+
* and, on the biggest root, 42,163 of 47,544 dirs in git worktree copies of the
|
|
52
|
+
* repo itself.
|
|
53
|
+
*
|
|
54
|
+
* That second half IS now reachable, and not by name: see
|
|
55
|
+
* {@link isForeignRepositoryRoot}. A walk that stops at a foreign checkout does
|
|
56
|
+
* not enter those 42,163 directories at all, which is why the node budget is no
|
|
57
|
+
* longer what ends a scan of a real root — the repository is. The budget stays
|
|
58
|
+
* as the backstop for a tree that is genuinely one enormous checkout.
|
|
59
|
+
*
|
|
60
|
+
* **The tradeoff, stated plainly:** past the budget a scan is incomplete, and
|
|
61
|
+
* an agent below the cut is not discovered on that pass. The walk is therefore
|
|
62
|
+
* breadth-first, so the budget degrades by *depth* — every level below the cut
|
|
63
|
+
* is complete, which is exactly the guarantee the old fixed cap gave, just at a
|
|
64
|
+
* depth chosen by the tree's real width instead of guessed in advance. Callers
|
|
65
|
+
* learn how far they may trust the result from
|
|
66
|
+
* {@link AgentProjectScanBudget.envelopeDepth}; nothing beyond it is reconciled
|
|
67
|
+
* away as missing.
|
|
68
|
+
*
|
|
69
|
+
* 10,000 dirs ~= 240 ms warm for the async registry scan, which runs when a
|
|
70
|
+
* session is created or the user asks — and covers a real monorepo project root
|
|
71
|
+
* outright (sapiom-js: 9,016).
|
|
72
|
+
*/
|
|
73
|
+
export const AGENT_PROJECT_SCAN_MAX_NODES = 10000;
|
|
74
|
+
/**
|
|
75
|
+
* The watcher fingerprint's budget, deliberately tighter than the scan's.
|
|
76
|
+
*
|
|
77
|
+
* `snapshotWorkspaceWorkflows` is synchronous and re-runs on a 250 ms debounce
|
|
78
|
+
* after any file change under the session's cwd, so its cost lands on the event
|
|
79
|
+
* loop while the user is typing. 2,500 dirs ~= 60 ms warm, which is the same
|
|
80
|
+
* order as what depth-3 cost on the widest real root measured (1,298 dirs /
|
|
81
|
+
* 32 ms): the watcher gets the full depth on an ordinary project and gets no
|
|
82
|
+
* slower on a huge one. A truncated fingerprint means a *deep* structural
|
|
83
|
+
* change may not arm a rescan until some shallower event does; discovery depth
|
|
84
|
+
* itself is the registry scan's budget, not this one.
|
|
85
|
+
*/
|
|
86
|
+
export const AGENT_PROJECT_WATCH_MAX_NODES = 2500;
|
|
87
|
+
/**
|
|
88
|
+
* The entry name that marks a directory as its own repository checkout: a
|
|
89
|
+
* `.git` DIRECTORY in an ordinary clone, a `.git` FILE in a git worktree or a
|
|
90
|
+
* submodule. Both forms are one entry called `.git`, which is all this policy
|
|
91
|
+
* needs to know.
|
|
92
|
+
*/
|
|
93
|
+
export const REPOSITORY_MARKER = ".git";
|
|
94
|
+
/**
|
|
95
|
+
* Whether a directory we just listed is the root of a repository other than
|
|
96
|
+
* the one the scan started in — the boundary a walk does not cross.
|
|
97
|
+
*
|
|
98
|
+
* **Why breadth, not depth, was the real bound.** The scan that produced this
|
|
99
|
+
* install's 88-row registry was rooted one level too high, at `~/sapiom`. From
|
|
100
|
+
* there the walk crossed into twelve sibling checkouts nobody had opened, and
|
|
101
|
+
* kept going until the node budget cut it off:
|
|
102
|
+
*
|
|
103
|
+
* Measured on that install (macOS/APFS, warm cache) at the shipped 10,000-node
|
|
104
|
+
* budget. Each cell is agents registered / distinct names among them /
|
|
105
|
+
* directories entered / wall clock:
|
|
106
|
+
*
|
|
107
|
+
* root today with the boundary
|
|
108
|
+
* ~/sapiom/wf-demo-testing 10 / 10, 17 dirs, 0 ms 10 / 10, 17 dirs, 0 ms
|
|
109
|
+
* ~/sapiom 88 / 65, 10,000 dirs, 239 ms 68 / 64, 408 dirs, 8 ms
|
|
110
|
+
* TRUNCATED at depth 5 complete
|
|
111
|
+
* ~/sapiom/sapiom-js 25 / 2, 9,016 dirs, 233 ms 2 / 2, 444 dirs, 8 ms
|
|
112
|
+
* ~/sapiom/Sapiom 0 / 0, 10,000 dirs, 200 ms 0 / 0, 5,408 dirs, 107 ms
|
|
113
|
+
* TRUNCATED at depth 5 complete
|
|
114
|
+
*
|
|
115
|
+
* The `sapiom-js` row is the whole argument in one line. Of the 25 agents a
|
|
116
|
+
* scan of that repo used to register, 24 were the SAME agent — one e2e fixture
|
|
117
|
+
* — reachable once per git worktree under `.trees/`. Two were real. Read the
|
|
118
|
+
* name counts down the column: the rule barely changes how many *distinct*
|
|
119
|
+
* agents a scan finds, and collapses how many *rows* it writes.
|
|
120
|
+
*
|
|
121
|
+
* Letting the node budget off its leash widens the gap rather than closing it:
|
|
122
|
+
* uncapped, `~/sapiom` is 141 agents across 83,969 directories in 6.8 s — and
|
|
123
|
+
* still only 73 distinct names. Depth was never what was wrong.
|
|
124
|
+
*
|
|
125
|
+
* **The cost, stated plainly.** Across that pair, 5 distinct agents are lost at
|
|
126
|
+
* `~/sapiom` (73 names uncapped vs 68 bounded), and `~/sapiom/Sapiom` loses the
|
|
127
|
+
* single agent it has. Every one of them lives inside a checkout below the scan
|
|
128
|
+
* root, and every one is registered the moment that checkout is itself the root
|
|
129
|
+
* — opened as a project, hosting a session, or named to
|
|
130
|
+
* `POST /api/workflows/scan`. That is the trade the user asked for in as many
|
|
131
|
+
* words: "It's okay if we don't fully scan."
|
|
132
|
+
*
|
|
133
|
+
* It also costs nothing to evaluate: the walk has already listed the directory
|
|
134
|
+
* to find its subdirectories, so the check reads a `Dirent[]` already in hand —
|
|
135
|
+
* no extra syscall.
|
|
136
|
+
*
|
|
137
|
+
* **What it deliberately does NOT do.** A nested checkout that IS an agent (its
|
|
138
|
+
* own `sapiom.json` at the top) is still registered: the marker is inspected
|
|
139
|
+
* before the boundary is considered, and a marker stops the walk anyway. Only
|
|
140
|
+
* a checkout that merely *contains* agents is left alone. So `~/agents/foo`
|
|
141
|
+
* (one repo per agent) is found; `~/src/some-other-monorepo/**` is not, unless
|
|
142
|
+
* the user points a scan at that monorepo.
|
|
143
|
+
*/
|
|
144
|
+
export function isForeignRepositoryRoot(entries) {
|
|
145
|
+
return entries.some((entry) => entry.name === REPOSITORY_MARKER);
|
|
146
|
+
}
|
|
12
147
|
const IGNORED_DIR_NAMES = new Set([
|
|
13
148
|
"node_modules",
|
|
14
149
|
".git",
|
|
@@ -107,4 +242,171 @@ export async function inspectAgentProjectMarker(dir) {
|
|
|
107
242
|
return { status: markerReadErrorStatus(error) };
|
|
108
243
|
}
|
|
109
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* One walk's traversal allowance, and its report on what it managed to cover.
|
|
247
|
+
*
|
|
248
|
+
* A budget is single-use: it accumulates `visited` as the walk runs, so pass a
|
|
249
|
+
* fresh one per walk (the walkers below default to one). Callers that care
|
|
250
|
+
* about cost or completeness construct it themselves and read it afterwards —
|
|
251
|
+
* that is also how the perf benchmark measures nodes visited without the
|
|
252
|
+
* scanner growing a second, parallel counting path.
|
|
253
|
+
*/
|
|
254
|
+
export class AgentProjectScanBudget {
|
|
255
|
+
constructor(limits = {}) {
|
|
256
|
+
/** Directories entered (marker inspected), root included. */
|
|
257
|
+
this.visited = 0;
|
|
258
|
+
/** The depth at which `maxNodes` stopped the walk, or null if it never did. */
|
|
259
|
+
this.truncatedAtDepth = null;
|
|
260
|
+
/**
|
|
261
|
+
* Foreign repository roots the walk stopped at rather than entering.
|
|
262
|
+
*
|
|
263
|
+
* Rides on the budget for the same reason `visited` does: a caller holding the
|
|
264
|
+
* budget can read what the walk actually did without every intermediate
|
|
265
|
+
* signature having to forward it. Load-bearing for the UI — a scan of a
|
|
266
|
+
* non-repo folder full of clones finds nothing, and only this list can tell
|
|
267
|
+
* "there is nothing here" apart from "I did not look in there".
|
|
268
|
+
*/
|
|
269
|
+
this.repositoryBoundaries = [];
|
|
270
|
+
this.maxDepth = limits.maxDepth ?? AGENT_PROJECT_SCAN_MAX_DEPTH;
|
|
271
|
+
this.maxNodes = limits.maxNodes ?? AGENT_PROJECT_SCAN_MAX_NODES;
|
|
272
|
+
}
|
|
273
|
+
get truncated() {
|
|
274
|
+
return this.truncatedAtDepth !== null;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* The deepest level this walk enumerated *in full* — how deep its results may
|
|
278
|
+
* be trusted as complete, and therefore how deep a caller may reconcile a
|
|
279
|
+
* previously-known project away as gone. `maxDepth` for a walk that finished;
|
|
280
|
+
* one level above the cut for a walk the node budget stopped, because that
|
|
281
|
+
* level is the only incomplete one (the walk is breadth-first).
|
|
282
|
+
*/
|
|
283
|
+
get envelopeDepth() {
|
|
284
|
+
return this.truncatedAtDepth === null
|
|
285
|
+
? this.maxDepth
|
|
286
|
+
: this.truncatedAtDepth - 1;
|
|
287
|
+
}
|
|
288
|
+
/** Charges one directory. False (and records the cut) once spent. */
|
|
289
|
+
admit(depth) {
|
|
290
|
+
if (this.visited >= this.maxNodes) {
|
|
291
|
+
if (this.truncatedAtDepth === null)
|
|
292
|
+
this.truncatedAtDepth = depth;
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
this.visited += 1;
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Subdirectories worth descending into, in a stable order.
|
|
301
|
+
*
|
|
302
|
+
* Two properties matter beyond the ignore filter:
|
|
303
|
+
*
|
|
304
|
+
* - `entry.isDirectory()` reads the raw dirent type, so a symlink — even one
|
|
305
|
+
* pointing at a directory — reports false and is never descended into.
|
|
306
|
+
* That, not the depth cap, is what makes a symlink *cycle* terminate; the
|
|
307
|
+
* cap only ever hid the fact. It is asserted directly in the tests.
|
|
308
|
+
* - Sorted, so a walk the node budget truncates truncates at the same place
|
|
309
|
+
* twice. `readdir` order is filesystem-dependent, and the watcher compares
|
|
310
|
+
* one fingerprint against the next: an order-dependent cut would read as a
|
|
311
|
+
* structural change on every check and rescan the workspace forever.
|
|
312
|
+
*/
|
|
313
|
+
function scanSubdirNames(entries) {
|
|
314
|
+
return entries
|
|
315
|
+
.filter((entry) => entry.isDirectory() && !isAgentProjectScanIgnoredDir(entry.name))
|
|
316
|
+
.map((entry) => entry.name)
|
|
317
|
+
.sort();
|
|
318
|
+
}
|
|
319
|
+
function isConfirmedMissingDir(error) {
|
|
320
|
+
const code = error.code;
|
|
321
|
+
return code === "ENOENT" || code === "ENOTDIR";
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* The boundary decision, shared by the sync and async walks so they cannot
|
|
325
|
+
* disagree about which directories a scan of a given root covers.
|
|
326
|
+
*
|
|
327
|
+
* Depth 0 is exempt: the root is the tree the user asked for, and a scan of a
|
|
328
|
+
* repository must of course cover that repository. Everything below it is only
|
|
329
|
+
* entered while it belongs to the same checkout.
|
|
330
|
+
*/
|
|
331
|
+
function stopsAtRepositoryBoundary(visitor, entries, dir, depth, options) {
|
|
332
|
+
if (options.crossRepositoryBoundaries)
|
|
333
|
+
return false;
|
|
334
|
+
if (depth === 0 || !isForeignRepositoryRoot(entries))
|
|
335
|
+
return false;
|
|
336
|
+
visitor.onRepositoryBoundary?.(dir, depth);
|
|
337
|
+
return true;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Breadth-first, depth- and node-bounded traversal beneath `root` — the one
|
|
341
|
+
* traversal policy the registry and the workspace watcher both run, so they
|
|
342
|
+
* cannot disagree about which directories a scan of a given root covers.
|
|
343
|
+
*
|
|
344
|
+
* Breadth-first is load-bearing rather than incidental: it is what makes the
|
|
345
|
+
* node budget degrade by depth (see AGENT_PROJECT_SCAN_MAX_NODES). Every level
|
|
346
|
+
* shallower than `budget.envelopeDepth` is complete no matter where the budget
|
|
347
|
+
* ran out, which keeps the generalized bound a superset of the fixed depth cap
|
|
348
|
+
* it replaces.
|
|
349
|
+
*
|
|
350
|
+
* Returns the budget so a caller can read `visited` / `envelopeDepth` off it.
|
|
351
|
+
*/
|
|
352
|
+
export function walkAgentProjectTree(root, visitor, budget = new AgentProjectScanBudget(), options = {}) {
|
|
353
|
+
let frontier = [path.resolve(root)];
|
|
354
|
+
for (let depth = 0; depth <= budget.maxDepth && frontier.length > 0; depth += 1) {
|
|
355
|
+
const next = [];
|
|
356
|
+
for (const dir of frontier) {
|
|
357
|
+
if (!budget.admit(depth))
|
|
358
|
+
return budget;
|
|
359
|
+
if (visitor.onDirectory(dir, depth) === "stop")
|
|
360
|
+
continue;
|
|
361
|
+
let entries;
|
|
362
|
+
try {
|
|
363
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
364
|
+
}
|
|
365
|
+
catch (error) {
|
|
366
|
+
if (!isConfirmedMissingDir(error))
|
|
367
|
+
visitor.onUnreadable?.(dir, depth);
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
if (stopsAtRepositoryBoundary(visitor, entries, dir, depth, options))
|
|
371
|
+
continue;
|
|
372
|
+
for (const name of scanSubdirNames(entries))
|
|
373
|
+
next.push(path.join(dir, name));
|
|
374
|
+
}
|
|
375
|
+
frontier = next;
|
|
376
|
+
}
|
|
377
|
+
return budget;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Async twin of {@link walkAgentProjectTree}, for callers that must not block
|
|
381
|
+
* the event loop on a wide tree. Same order, same bounds, same decisions — so
|
|
382
|
+
* the two produce identical results on the same tree with the same budget,
|
|
383
|
+
* which the watcher's sync/async fingerprint pair depends on.
|
|
384
|
+
*/
|
|
385
|
+
export async function walkAgentProjectTreeAsync(root, visitor, budget = new AgentProjectScanBudget(), options = {}) {
|
|
386
|
+
let frontier = [path.resolve(root)];
|
|
387
|
+
for (let depth = 0; depth <= budget.maxDepth && frontier.length > 0; depth += 1) {
|
|
388
|
+
const next = [];
|
|
389
|
+
for (const dir of frontier) {
|
|
390
|
+
if (!budget.admit(depth))
|
|
391
|
+
return budget;
|
|
392
|
+
if ((await visitor.onDirectory(dir, depth)) === "stop")
|
|
393
|
+
continue;
|
|
394
|
+
let entries;
|
|
395
|
+
try {
|
|
396
|
+
entries = await fsp.readdir(dir, { withFileTypes: true });
|
|
397
|
+
}
|
|
398
|
+
catch (error) {
|
|
399
|
+
if (!isConfirmedMissingDir(error))
|
|
400
|
+
visitor.onUnreadable?.(dir, depth);
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
if (stopsAtRepositoryBoundary(visitor, entries, dir, depth, options))
|
|
404
|
+
continue;
|
|
405
|
+
for (const name of scanSubdirNames(entries))
|
|
406
|
+
next.push(path.join(dir, name));
|
|
407
|
+
}
|
|
408
|
+
frontier = next;
|
|
409
|
+
}
|
|
410
|
+
return budget;
|
|
411
|
+
}
|
|
110
412
|
//# sourceMappingURL=agent-project-discovery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-project-discovery.js","sourceRoot":"","sources":["../../src/core/agent-project-discovery.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAE9C,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,cAAc;IACd,MAAM;IACN,SAAS;IACT,MAAM;IACN,OAAO;IACP,OAAO;CACR,CAAC,CAAC;AAwBH,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5 @@
|
|
|
1
|
+
import type { AgentInvocationMode } from "../shared/system-graph.js";
|
|
2
|
+
export type { AgentInvocationMode } from "../shared/system-graph.js";
|
|
1
3
|
/**
|
|
2
4
|
* Lists the workflow's own `.ts`/`.tsx` sources (skipping node_modules and
|
|
3
5
|
* friends), bounded to MAX_FILES_PER_WORKFLOW. Shared with the extraction
|
|
@@ -13,6 +15,30 @@ export interface DetectedLaunch {
|
|
|
13
15
|
* (e.g. a launch in a shared helper). */
|
|
14
16
|
fromStepId: string | null;
|
|
15
17
|
}
|
|
18
|
+
/** Internal source evidence. It never crosses the system-graph HTTP boundary. */
|
|
19
|
+
export interface SourceEvidence {
|
|
20
|
+
/** POSIX path relative to the caller's source root. */
|
|
21
|
+
file: string;
|
|
22
|
+
/** One-based source location of the supported call expression. */
|
|
23
|
+
line: number;
|
|
24
|
+
column: number;
|
|
25
|
+
}
|
|
26
|
+
export interface DetectedAgentInvocation {
|
|
27
|
+
/** The direct literal `definition` target. */
|
|
28
|
+
slug: string;
|
|
29
|
+
mode: AgentInvocationMode;
|
|
30
|
+
fromStepId: string | null;
|
|
31
|
+
evidence: SourceEvidence;
|
|
32
|
+
}
|
|
33
|
+
export interface AgentInvocationDetectionWarning {
|
|
34
|
+
code: "dynamic-target";
|
|
35
|
+
mode: AgentInvocationMode;
|
|
36
|
+
evidence: SourceEvidence;
|
|
37
|
+
}
|
|
38
|
+
export interface AgentInvocationScanResult {
|
|
39
|
+
invocations: DetectedAgentInvocation[];
|
|
40
|
+
warnings: AgentInvocationDetectionWarning[];
|
|
41
|
+
}
|
|
16
42
|
export interface DetectedCapability {
|
|
17
43
|
/** The dotted capability id (e.g. "web.search", "email.messages.send"). */
|
|
18
44
|
capability: string;
|
|
@@ -21,6 +47,8 @@ export interface DetectedCapability {
|
|
|
21
47
|
}
|
|
22
48
|
export interface WorkflowSourceScan {
|
|
23
49
|
launches: DetectedLaunch[];
|
|
50
|
+
invocations: DetectedAgentInvocation[];
|
|
51
|
+
invocationWarnings: AgentInvocationDetectionWarning[];
|
|
24
52
|
capabilities: DetectedCapability[];
|
|
25
53
|
}
|
|
26
54
|
/**
|
|
@@ -35,6 +63,9 @@ export interface WorkflowSourceScan {
|
|
|
35
63
|
* so the shared pass halves the I/O on the hot path.
|
|
36
64
|
*/
|
|
37
65
|
export declare function scanWorkflowSources(root: string, knownStepIds: ReadonlySet<string>): Promise<WorkflowSourceScan>;
|
|
66
|
+
/** Direct agent invocations plus deterministic warnings for supported calls
|
|
67
|
+
* whose target is not a direct literal. */
|
|
68
|
+
export declare function detectAgentInvocations(root: string, knownStepIds: ReadonlySet<string>): Promise<AgentInvocationScanResult>;
|
|
38
69
|
/** Just the launches from {@link scanWorkflowSources}. */
|
|
39
70
|
export declare function detectWorkflowLaunches(root: string, knownStepIds: ReadonlySet<string>): Promise<DetectedLaunch[]>;
|
|
40
71
|
/** Just the capabilities from {@link scanWorkflowSources}. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-interconnections.d.ts","sourceRoot":"","sources":["../../src/core/canvas-interconnections.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"canvas-interconnections.d.ts","sourceRoot":"","sources":["../../src/core/canvas-interconnections.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,YAAY,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AA4CrE;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAuBrE;AA8FD,MAAM,WAAW,cAAc;IAC7B,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb;;8CAE0C;IAC1C,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,iFAAiF;AACjF,MAAM,WAAW,cAAc;IAC7B,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE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