@sapiom/harness 0.1.6 → 0.2.1
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 +105 -0
- package/dist/cli/args.d.ts +16 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +80 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/bin.js +12 -65
- package/dist/cli/bin.js.map +1 -1
- package/dist/cli/settings.d.ts.map +1 -1
- package/dist/cli/settings.js +33 -1
- package/dist/cli/settings.js.map +1 -1
- package/dist/core/adapters/claude-code.d.ts +60 -2
- package/dist/core/adapters/claude-code.d.ts.map +1 -1
- package/dist/core/adapters/claude-code.js +119 -32
- package/dist/core/adapters/claude-code.js.map +1 -1
- package/dist/core/adapters/codex.d.ts +21 -2
- package/dist/core/adapters/codex.d.ts.map +1 -1
- package/dist/core/adapters/codex.js +53 -2
- package/dist/core/adapters/codex.js.map +1 -1
- package/dist/core/adapters/detect.d.ts +9 -0
- package/dist/core/adapters/detect.d.ts.map +1 -1
- package/dist/core/adapters/detect.js +9 -0
- package/dist/core/adapters/detect.js.map +1 -1
- package/dist/core/canvas-body.d.ts +28 -28
- package/dist/core/canvas-body.d.ts.map +1 -1
- package/dist/core/canvas-body.js +117 -55
- package/dist/core/canvas-body.js.map +1 -1
- package/dist/core/canvas-derive.d.ts +43 -0
- package/dist/core/canvas-derive.d.ts.map +1 -0
- package/dist/core/canvas-derive.js +95 -0
- package/dist/core/canvas-derive.js.map +1 -0
- package/dist/core/canvas-enrichment.d.ts +52 -127
- package/dist/core/canvas-enrichment.d.ts.map +1 -1
- package/dist/core/canvas-enrichment.js +17 -178
- package/dist/core/canvas-enrichment.js.map +1 -1
- package/dist/core/canvas-graph.d.ts +40 -1
- package/dist/core/canvas-graph.d.ts.map +1 -1
- package/dist/core/canvas-graph.js +71 -9
- package/dist/core/canvas-graph.js.map +1 -1
- package/dist/core/canvas-interconnections.d.ts +26 -8
- package/dist/core/canvas-interconnections.d.ts.map +1 -1
- package/dist/core/canvas-interconnections.js +132 -24
- package/dist/core/canvas-interconnections.js.map +1 -1
- package/dist/core/canvas-manifest-check.d.ts.map +1 -1
- package/dist/core/canvas-manifest-check.js +15 -2
- package/dist/core/canvas-manifest-check.js.map +1 -1
- package/dist/core/canvas-render.d.ts +8 -15
- package/dist/core/canvas-render.d.ts.map +1 -1
- package/dist/core/canvas-render.js +29 -41
- package/dist/core/canvas-render.js.map +1 -1
- package/dist/core/canvas-run-state.d.ts +41 -0
- package/dist/core/canvas-run-state.d.ts.map +1 -1
- package/dist/core/canvas-run-state.js +136 -0
- package/dist/core/canvas-run-state.js.map +1 -1
- package/dist/core/canvas-svg.d.ts +9 -4
- package/dist/core/canvas-svg.d.ts.map +1 -1
- package/dist/core/canvas-svg.js +84 -13
- package/dist/core/canvas-svg.js.map +1 -1
- package/dist/core/canvas-template.d.ts +9 -10
- package/dist/core/canvas-template.d.ts.map +1 -1
- package/dist/core/canvas-template.js +57 -20
- package/dist/core/canvas-template.js.map +1 -1
- package/dist/core/canvas-watcher.d.ts +22 -1
- package/dist/core/canvas-watcher.d.ts.map +1 -1
- package/dist/core/canvas-watcher.js +111 -30
- package/dist/core/canvas-watcher.js.map +1 -1
- package/dist/core/collector/normalizer.d.ts +8 -0
- package/dist/core/collector/normalizer.d.ts.map +1 -1
- package/dist/core/collector/normalizer.js +8 -0
- package/dist/core/collector/normalizer.js.map +1 -1
- package/dist/core/collector/store.d.ts +75 -1
- package/dist/core/collector/store.d.ts.map +1 -1
- package/dist/core/collector/store.js +334 -2
- package/dist/core/collector/store.js.map +1 -1
- package/dist/core/errors.d.ts +10 -4
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +11 -5
- package/dist/core/errors.js.map +1 -1
- package/dist/core/example-seed.d.ts +8 -0
- package/dist/core/example-seed.d.ts.map +1 -1
- package/dist/core/example-seed.js +47 -10
- package/dist/core/example-seed.js.map +1 -1
- package/dist/core/inject/system-prompt.d.ts +8 -0
- package/dist/core/inject/system-prompt.d.ts.map +1 -1
- package/dist/core/inject/system-prompt.js +3 -1
- package/dist/core/inject/system-prompt.js.map +1 -1
- package/dist/core/macros.d.ts.map +1 -1
- package/dist/core/macros.js +5 -6
- package/dist/core/macros.js.map +1 -1
- package/dist/core/paths.d.ts +1 -0
- package/dist/core/paths.d.ts.map +1 -1
- package/dist/core/paths.js +1 -0
- package/dist/core/paths.js.map +1 -1
- package/dist/core/record-archive.d.ts +187 -0
- package/dist/core/record-archive.d.ts.map +1 -0
- package/dist/core/record-archive.js +465 -0
- package/dist/core/record-archive.js.map +1 -0
- package/dist/core/rehydration.d.ts +72 -0
- package/dist/core/rehydration.d.ts.map +1 -0
- package/dist/core/rehydration.js +72 -0
- package/dist/core/rehydration.js.map +1 -0
- package/dist/core/resume-brief.d.ts +130 -0
- package/dist/core/resume-brief.d.ts.map +1 -0
- package/dist/core/resume-brief.js +404 -0
- package/dist/core/resume-brief.js.map +1 -0
- package/dist/core/rolling-summary.d.ts +130 -0
- package/dist/core/rolling-summary.d.ts.map +1 -0
- package/dist/core/rolling-summary.js +227 -0
- package/dist/core/rolling-summary.js.map +1 -0
- package/dist/core/session-manager.d.ts +11 -3
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +56 -7
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-record.d.ts +165 -0
- package/dist/core/session-record.d.ts.map +1 -0
- package/dist/core/session-record.js +470 -0
- package/dist/core/session-record.js.map +1 -0
- package/dist/core/spawn-target.d.ts +12 -0
- package/dist/core/spawn-target.d.ts.map +1 -0
- package/dist/core/spawn-target.js +187 -0
- package/dist/core/spawn-target.js.map +1 -0
- package/dist/core/task-manager.d.ts.map +1 -1
- package/dist/core/task-manager.js +9 -1
- package/dist/core/task-manager.js.map +1 -1
- package/dist/core/template-catalog.d.ts +48 -0
- package/dist/core/template-catalog.d.ts.map +1 -0
- package/dist/core/template-catalog.js +338 -0
- package/dist/core/template-catalog.js.map +1 -0
- package/dist/core/workflow-registry.d.ts.map +1 -1
- package/dist/core/workflow-registry.js +2 -2
- package/dist/core/workflow-registry.js.map +1 -1
- package/dist/core/workspace-watcher.d.ts.map +1 -1
- package/dist/core/workspace-watcher.js +4 -3
- package/dist/core/workspace-watcher.js.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -1
- package/dist/profiles/default.d.ts.map +1 -1
- package/dist/profiles/default.js +9 -14
- package/dist/profiles/default.js.map +1 -1
- package/dist/server/canvas.d.ts.map +1 -1
- package/dist/server/canvas.js +7 -7
- package/dist/server/canvas.js.map +1 -1
- package/dist/server/fs.d.ts.map +1 -1
- package/dist/server/fs.js +17 -1
- package/dist/server/fs.js.map +1 -1
- package/dist/server/index.d.ts +12 -3
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +321 -50
- package/dist/server/index.js.map +1 -1
- package/dist/server/ingest.d.ts +11 -0
- package/dist/server/ingest.d.ts.map +1 -1
- package/dist/server/ingest.js +1 -0
- package/dist/server/ingest.js.map +1 -1
- package/dist/server/macros.d.ts +4 -6
- package/dist/server/macros.d.ts.map +1 -1
- package/dist/server/macros.js.map +1 -1
- package/dist/server/rest.d.ts +18 -6
- package/dist/server/rest.d.ts.map +1 -1
- package/dist/server/rest.js +185 -48
- package/dist/server/rest.js.map +1 -1
- package/dist/server/templates.d.ts +24 -0
- package/dist/server/templates.d.ts.map +1 -0
- package/dist/server/templates.js +54 -0
- package/dist/server/templates.js.map +1 -0
- package/dist/shared/types.d.ts +477 -29
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/shared/types.js +19 -11
- package/dist/shared/types.js.map +1 -1
- package/dist/web/assets/index-SYpugKQ1.css +32 -0
- package/dist/web/assets/index-vYYd44hZ.js +446 -0
- package/dist/web/index.html +2 -2
- package/package.json +5 -4
- package/dist/core/canvas-enrich.d.ts +0 -115
- package/dist/core/canvas-enrich.d.ts.map +0 -1
- package/dist/core/canvas-enrich.js +0 -186
- package/dist/core/canvas-enrich.js.map +0 -1
- package/dist/profiles/canvas-guidelines.d.ts +0 -20
- package/dist/profiles/canvas-guidelines.d.ts.map +0 -1
- package/dist/profiles/canvas-guidelines.js +0 -48
- package/dist/profiles/canvas-guidelines.js.map +0 -1
- package/dist/web/assets/index-DCtyI4VW.css +0 -32
- package/dist/web/assets/index-WSw5RvYR.js +0 -445
- package/dist/web/welcome-hero-dark.png +0 -0
- package/dist/web/welcome-hero-light.png +0 -0
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* nothing but itself.
|
|
2
|
+
* The canvas enrichment contract: the optional annotation layer merged on top
|
|
3
|
+
* of a deterministic canvas render — a summary line, per-node sublabels/hover
|
|
4
|
+
* descriptions, edge labels, footer notes, layout hints, and a cross-workflow
|
|
5
|
+
* tie. Every value is a BOUNDED plain string (the limits below are hard caps
|
|
6
|
+
* that keep the SVG layout from breaking); the renderer (core/canvas-svg.ts,
|
|
7
|
+
* core/canvas-body.ts) decides where each field goes.
|
|
9
8
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
9
|
+
* The enrichment is produced DETERMINISTICALLY, in-process, from the extracted
|
|
10
|
+
* graph — see core/canvas-derive.ts. There is no LLM, no user token, no file
|
|
11
|
+
* write, and no cache: it is recomputed from the current sources on every
|
|
12
|
+
* render, so it can never go stale. This module is now just the shared shape +
|
|
13
|
+
* limits both the producer (canvas-derive.ts) and the consumer (canvas-svg.ts,
|
|
14
|
+
* canvas-body.ts) agree on.
|
|
15
|
+
*
|
|
16
|
+
* Layout hints are the one structural field: named groups (rendered as subtle
|
|
17
|
+
* background bands) and per-layer ordering. The renderer applies a hint only
|
|
18
|
+
* when every node id it references actually exists in the graph (see
|
|
19
|
+
* canvas-svg.ts) — ids are validated at render time.
|
|
16
20
|
*/
|
|
17
|
-
import * as fs from "node:fs/promises";
|
|
18
|
-
import * as path from "node:path";
|
|
19
|
-
import { z } from "zod";
|
|
20
21
|
export const ENRICHMENT_LIMITS = {
|
|
21
22
|
summary: 160,
|
|
22
23
|
sublabel: 48,
|
|
@@ -27,166 +28,4 @@ export const ENRICHMENT_LIMITS = {
|
|
|
27
28
|
groupLabel: 48,
|
|
28
29
|
crossWorkflow: 160,
|
|
29
30
|
};
|
|
30
|
-
const bounded = (max) => z.string().max(max);
|
|
31
|
-
export const canvasEnrichmentSchema = z
|
|
32
|
-
.object({
|
|
33
|
-
/** One-liner under the panel header. */
|
|
34
|
-
summary: bounded(ENRICHMENT_LIMITS.summary).optional(),
|
|
35
|
-
/** Per-node annotations, keyed by node id. */
|
|
36
|
-
nodeDetails: z
|
|
37
|
-
.record(z
|
|
38
|
-
.object({
|
|
39
|
-
/** Second text line inside the node box. */
|
|
40
|
-
sublabel: bounded(ENRICHMENT_LIMITS.sublabel).optional(),
|
|
41
|
-
/** Hover tooltip (SVG <title>) — room for a full sentence. */
|
|
42
|
-
description: bounded(ENRICHMENT_LIMITS.description).optional(),
|
|
43
|
-
})
|
|
44
|
-
.strip())
|
|
45
|
-
.optional(),
|
|
46
|
-
/** Edge annotations (intent/condition names), keyed `"<from>-><to>"`. */
|
|
47
|
-
edgeLabels: z.record(bounded(ENRICHMENT_LIMITS.edgeLabel)).optional(),
|
|
48
|
-
/** Footer facts worth knowing that don't fit the diagram itself. */
|
|
49
|
-
notes: z.array(bounded(ENRICHMENT_LIMITS.note)).max(ENRICHMENT_LIMITS.noteCount).optional(),
|
|
50
|
-
layoutHints: z
|
|
51
|
-
.object({
|
|
52
|
-
/** Named clusters rendered as background bands behind member nodes. */
|
|
53
|
-
groups: z
|
|
54
|
-
.array(z
|
|
55
|
-
.object({
|
|
56
|
-
label: bounded(ENRICHMENT_LIMITS.groupLabel),
|
|
57
|
-
nodeIds: z.array(z.string()).min(1),
|
|
58
|
-
})
|
|
59
|
-
.strip())
|
|
60
|
-
.optional(),
|
|
61
|
-
/** Preferred left-to-right node order per layout layer, keyed by the
|
|
62
|
-
* layer index as a string. Reorders WITHIN the computed layer only —
|
|
63
|
-
* it can never move a node between layers. */
|
|
64
|
-
laneOrder: z.record(z.array(z.string()).min(1)).optional(),
|
|
65
|
-
})
|
|
66
|
-
.strip()
|
|
67
|
-
.optional(),
|
|
68
|
-
/** How this workflow ties into the workspace's other workflows. */
|
|
69
|
-
crossWorkflow: bounded(ENRICHMENT_LIMITS.crossWorkflow).optional(),
|
|
70
|
-
})
|
|
71
|
-
.strip();
|
|
72
|
-
/**
|
|
73
|
-
* Validates a candidate enrichment object. Returns null on ANY schema
|
|
74
|
-
* violation (oversize string, wrong shape, too many notes) — partial
|
|
75
|
-
* salvage is deliberately not attempted, so the contract stays a hard line
|
|
76
|
-
* the prompt can state truthfully: "invalid output is thrown away whole."
|
|
77
|
-
*/
|
|
78
|
-
export function parseCanvasEnrichment(value) {
|
|
79
|
-
const parsed = canvasEnrichmentSchema.safeParse(value);
|
|
80
|
-
return parsed.success ? parsed.data : null;
|
|
81
|
-
}
|
|
82
|
-
function clampString(value, max) {
|
|
83
|
-
if (typeof value !== "string" || value.length <= max)
|
|
84
|
-
return value;
|
|
85
|
-
return `${value.slice(0, max - 1)}…`;
|
|
86
|
-
}
|
|
87
|
-
function isRecord(value) {
|
|
88
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
89
|
-
}
|
|
90
|
-
/** Removes null/undefined-valued properties (models write `"field": null`
|
|
91
|
-
* to mean "omitted"; the schema means it as `undefined`). Shallow — called
|
|
92
|
-
* per level below where object shapes are known. */
|
|
93
|
-
function dropNulls(record) {
|
|
94
|
-
return Object.fromEntries(Object.entries(record).filter(([, v]) => v != null));
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Deterministic repair of the two ways an otherwise-good answer most often
|
|
98
|
-
* misses the contract, applied BEFORE strict validation:
|
|
99
|
-
* - `null` where the schema means "omit the field"
|
|
100
|
-
* - strings a few words over their cap (measured live: sonnet writes
|
|
101
|
-
* excellent content but doesn't count characters — a single 160-char note
|
|
102
|
-
* against the 140 cap discarded 3 of 4 real enrichments whole), truncated
|
|
103
|
-
* to the cap with an ellipsis; extra notes beyond the count cap dropped
|
|
104
|
-
*
|
|
105
|
-
* The bound the caps exist for — the AI can never blow up the layout with
|
|
106
|
-
* unbounded text — is still enforced, just deterministically here instead
|
|
107
|
-
* of by rejection. Everything else (wrong shapes, wrong types, unknown
|
|
108
|
-
* structure) still fails `parseCanvasEnrichment` and discards the
|
|
109
|
-
* enrichment whole.
|
|
110
|
-
*/
|
|
111
|
-
export function normalizeCanvasEnrichmentCandidate(value) {
|
|
112
|
-
if (!isRecord(value))
|
|
113
|
-
return value;
|
|
114
|
-
const L = ENRICHMENT_LIMITS;
|
|
115
|
-
const out = { ...value };
|
|
116
|
-
out.summary = clampString(out.summary, L.summary);
|
|
117
|
-
out.crossWorkflow = clampString(out.crossWorkflow, L.crossWorkflow);
|
|
118
|
-
if (isRecord(out.nodeDetails)) {
|
|
119
|
-
out.nodeDetails = Object.fromEntries(Object.entries(out.nodeDetails).map(([id, details]) => {
|
|
120
|
-
if (!isRecord(details))
|
|
121
|
-
return [id, details];
|
|
122
|
-
return [
|
|
123
|
-
id,
|
|
124
|
-
dropNulls({
|
|
125
|
-
...details,
|
|
126
|
-
sublabel: clampString(details.sublabel, L.sublabel),
|
|
127
|
-
description: clampString(details.description, L.description),
|
|
128
|
-
}),
|
|
129
|
-
];
|
|
130
|
-
}));
|
|
131
|
-
}
|
|
132
|
-
if (isRecord(out.edgeLabels)) {
|
|
133
|
-
out.edgeLabels = Object.fromEntries(Object.entries(out.edgeLabels).map(([key, label]) => [key, clampString(label, L.edgeLabel)]));
|
|
134
|
-
}
|
|
135
|
-
if (Array.isArray(out.notes)) {
|
|
136
|
-
out.notes = out.notes.slice(0, L.noteCount).map((note) => clampString(note, L.note));
|
|
137
|
-
}
|
|
138
|
-
if (isRecord(out.layoutHints)) {
|
|
139
|
-
const hints = dropNulls({ ...out.layoutHints });
|
|
140
|
-
if (Array.isArray(hints.groups)) {
|
|
141
|
-
hints.groups = hints.groups.map((group) => isRecord(group) ? dropNulls({ ...group, label: clampString(group.label, L.groupLabel) }) : group);
|
|
142
|
-
}
|
|
143
|
-
out.layoutHints = hints;
|
|
144
|
-
}
|
|
145
|
-
return dropNulls(out);
|
|
146
|
-
}
|
|
147
|
-
/** Envelope validation is deliberately shallow for `graph` (it's our own
|
|
148
|
-
* writer's serialization, not AI output) and strict for `enrichment` (it IS
|
|
149
|
-
* AI output — re-validated on every read, so a hand-edited or corrupted
|
|
150
|
-
* cache file can never smuggle unbounded strings into a render). */
|
|
151
|
-
const cacheEntrySchema = z.object({
|
|
152
|
-
graph: z.object({
|
|
153
|
-
manifestName: z.string(),
|
|
154
|
-
entry: z.string(),
|
|
155
|
-
nodes: z.array(z.record(z.unknown())),
|
|
156
|
-
edges: z.array(z.record(z.unknown())),
|
|
157
|
-
warnings: z.array(z.string()),
|
|
158
|
-
}),
|
|
159
|
-
enrichment: canvasEnrichmentSchema,
|
|
160
|
-
sourceFingerprint: z.string(),
|
|
161
|
-
enrichedAt: z.string(),
|
|
162
|
-
});
|
|
163
|
-
/** Reads + validates one enrichment cache file. Null for missing, unparsable
|
|
164
|
-
* or schema-invalid content — a bad cache degrades to "no enrichment". */
|
|
165
|
-
export async function readEnrichmentCacheFile(filePath) {
|
|
166
|
-
let raw;
|
|
167
|
-
try {
|
|
168
|
-
raw = await fs.readFile(filePath, "utf8");
|
|
169
|
-
}
|
|
170
|
-
catch {
|
|
171
|
-
return null;
|
|
172
|
-
}
|
|
173
|
-
try {
|
|
174
|
-
const parsed = cacheEntrySchema.safeParse(JSON.parse(raw));
|
|
175
|
-
// The shallow node/edge validation above means this cast, not a full
|
|
176
|
-
// structural proof — see the schema's own comment for why that's enough.
|
|
177
|
-
return parsed.success ? parsed.data : null;
|
|
178
|
-
}
|
|
179
|
-
catch {
|
|
180
|
-
return null;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
export async function writeEnrichmentCacheFile(filePath, entry) {
|
|
184
|
-
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
185
|
-
await fs.writeFile(filePath, JSON.stringify(entry, null, 2), "utf8");
|
|
186
|
-
}
|
|
187
|
-
/** Deletes one enrichment cache file (the visualize macro's force refresh).
|
|
188
|
-
* Missing file is fine — the goal state is "no cache". */
|
|
189
|
-
export async function removeEnrichmentCacheFile(filePath) {
|
|
190
|
-
await fs.rm(filePath, { force: true });
|
|
191
|
-
}
|
|
192
31
|
//# sourceMappingURL=canvas-enrichment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-enrichment.js","sourceRoot":"","sources":["../../src/core/canvas-enrichment.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"canvas-enrichment.js","sourceRoot":"","sources":["../../src/core/canvas-enrichment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,OAAO,EAAE,GAAG;IACZ,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE,GAAG;IAChB,SAAS,EAAE,EAAE;IACb,SAAS,EAAE,CAAC;IACZ,IAAI,EAAE,GAAG;IACT,UAAU,EAAE,EAAE;IACd,aAAa,EAAE,GAAG;CACV,CAAC"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* instead of crashing or silently falling back to an LLM.
|
|
11
11
|
*/
|
|
12
12
|
import type { AgentManifest } from "@sapiom/agent";
|
|
13
|
-
import { type DetectedLaunch } from "./canvas-interconnections.js";
|
|
13
|
+
import { type DetectedLaunch, type DetectedCapability } from "./canvas-interconnections.js";
|
|
14
14
|
export type CanvasNodeKind = "entry" | "step" | "pause" | "terminal-success" | "terminal-warn" | "launched-workflow";
|
|
15
15
|
export type CanvasEdgeKind = "sequential" | "branching" | "cross" | "launch";
|
|
16
16
|
export interface CanvasNode {
|
|
@@ -18,6 +18,14 @@ export interface CanvasNode {
|
|
|
18
18
|
kind: CanvasNodeKind;
|
|
19
19
|
label: string;
|
|
20
20
|
sublabel?: string;
|
|
21
|
+
/** Human-authored step description from the manifest (Option A); "" when none. */
|
|
22
|
+
description?: string;
|
|
23
|
+
/** The step's declared input contract (JSON Schema) from the manifest. */
|
|
24
|
+
inputSchema?: Record<string, unknown> | null;
|
|
25
|
+
/** Author-declared Sapiom capabilities the step calls. */
|
|
26
|
+
capabilities?: readonly string[];
|
|
27
|
+
/** The step's declared dispatch timeout (ms); null when unset. */
|
|
28
|
+
timeoutMs?: number | null;
|
|
21
29
|
}
|
|
22
30
|
export interface CanvasEdge {
|
|
23
31
|
from: string;
|
|
@@ -30,6 +38,8 @@ export interface CanvasGraph {
|
|
|
30
38
|
/** The manifest's own name — used both as a display title fallback and as
|
|
31
39
|
* the match key for cross-workflow interconnection detection. */
|
|
32
40
|
manifestName: string;
|
|
41
|
+
/** Human-authored workflow description from the manifest (Option A); "" when none. */
|
|
42
|
+
description?: string;
|
|
33
43
|
entry: string;
|
|
34
44
|
nodes: CanvasNode[];
|
|
35
45
|
edges: CanvasEdge[];
|
|
@@ -47,6 +57,31 @@ export interface ExtractionFailure {
|
|
|
47
57
|
reason: string;
|
|
48
58
|
}
|
|
49
59
|
export type ExtractionResult = ExtractionSuccess | ExtractionFailure;
|
|
60
|
+
/**
|
|
61
|
+
* The precedence table above, over nothing but a step's declared transition
|
|
62
|
+
* kinds — so a caller that has transitions from somewhere OTHER than a local
|
|
63
|
+
* `AgentManifest` classifies identically.
|
|
64
|
+
*
|
|
65
|
+
* Exported because the Studio's template preview projects the SAME graph from
|
|
66
|
+
* core's relayed `DefinitionTransitionDto[]` (see `core/template-catalog.ts`).
|
|
67
|
+
* That preview claims parity with the canvas, so it must not re-derive this:
|
|
68
|
+
* a second copy of the rule is a second answer to "what kind of node is this",
|
|
69
|
+
* and the two surfaces disagreeing is the exact class of bug the template work
|
|
70
|
+
* set out to remove. Collapsing the four kinds into a single `terminal` boolean
|
|
71
|
+
* (as the first cut of that preview did) renders a fail-only sink as a green
|
|
72
|
+
* success exit and a `continue`-plus-`terminate` gate as a terminal.
|
|
73
|
+
*/
|
|
74
|
+
export declare function classifyStepKind(input: {
|
|
75
|
+
name: string;
|
|
76
|
+
entry: string;
|
|
77
|
+
transitions: ReadonlyArray<{
|
|
78
|
+
kind: string;
|
|
79
|
+
signal?: string | null;
|
|
80
|
+
}>;
|
|
81
|
+
}): {
|
|
82
|
+
kind: CanvasNodeKind;
|
|
83
|
+
sublabel: string;
|
|
84
|
+
};
|
|
50
85
|
/** Reshapes a validated `AgentManifest` into the render-ready graph model. */
|
|
51
86
|
export declare function graphFromManifest(manifest: AgentManifest, warnings: string[]): CanvasGraph;
|
|
52
87
|
/**
|
|
@@ -58,6 +93,10 @@ export declare function graphFromManifest(manifest: AgentManifest, warnings: str
|
|
|
58
93
|
* already shows those steps. Pure — returns a new graph.
|
|
59
94
|
*/
|
|
60
95
|
export declare function mergeLaunchesIntoGraph(graph: CanvasGraph, launches: readonly DetectedLaunch[]): CanvasGraph;
|
|
96
|
+
/** Fills each step node's `capabilities` from statically-detected
|
|
97
|
+
* `ctx.sapiom.*` calls, unless the manifest already declared them (authored
|
|
98
|
+
* capabilities win). Pure — returns a new graph. */
|
|
99
|
+
export declare function mergeCapabilitiesIntoGraph(graph: CanvasGraph, detected: readonly DetectedCapability[]): CanvasGraph;
|
|
61
100
|
/**
|
|
62
101
|
* Extracts a workflow's step graph from its project directory, with detected
|
|
63
102
|
* cross-workflow launches merged in as dashed nodes. Never throws: any
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-graph.d.ts","sourceRoot":"","sources":["../../src/core/canvas-graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GA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
|
|
1
1
|
import { runManifestCheck } from "./canvas-manifest-check.js";
|
|
2
|
-
import {
|
|
2
|
+
import { scanWorkflowSources, } from "./canvas-interconnections.js";
|
|
3
3
|
/**
|
|
4
4
|
* Classifies a step for node styling. Priority: the entry step always reads
|
|
5
5
|
* as "entry" (the diagram's obvious starting point) even if it also happens
|
|
@@ -18,10 +18,28 @@ import { detectWorkflowLaunches } from "./canvas-interconnections.js";
|
|
|
18
18
|
* prefers an enrichment-supplied sublabel over this default when present.
|
|
19
19
|
*/
|
|
20
20
|
function classifyNode(name, entry, step) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
return classifyStepKind({ name, entry, transitions: step.transitions });
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The precedence table above, over nothing but a step's declared transition
|
|
25
|
+
* kinds — so a caller that has transitions from somewhere OTHER than a local
|
|
26
|
+
* `AgentManifest` classifies identically.
|
|
27
|
+
*
|
|
28
|
+
* Exported because the Studio's template preview projects the SAME graph from
|
|
29
|
+
* core's relayed `DefinitionTransitionDto[]` (see `core/template-catalog.ts`).
|
|
30
|
+
* That preview claims parity with the canvas, so it must not re-derive this:
|
|
31
|
+
* a second copy of the rule is a second answer to "what kind of node is this",
|
|
32
|
+
* and the two surfaces disagreeing is the exact class of bug the template work
|
|
33
|
+
* set out to remove. Collapsing the four kinds into a single `terminal` boolean
|
|
34
|
+
* (as the first cut of that preview did) renders a fail-only sink as a green
|
|
35
|
+
* success exit and a `continue`-plus-`terminate` gate as a terminal.
|
|
36
|
+
*/
|
|
37
|
+
export function classifyStepKind(input) {
|
|
38
|
+
const { name, entry, transitions } = input;
|
|
39
|
+
const continueTargets = transitions.filter((t) => t.kind === "continue");
|
|
40
|
+
const pause = transitions.find((t) => t.kind === "pause");
|
|
41
|
+
const hasTerminate = transitions.some((t) => t.kind === "terminate");
|
|
42
|
+
const hasFail = transitions.some((t) => t.kind === "fail");
|
|
25
43
|
if (name === entry)
|
|
26
44
|
return { kind: "entry", sublabel: "entry" };
|
|
27
45
|
if (pause)
|
|
@@ -55,10 +73,26 @@ function edgesForStep(name, step) {
|
|
|
55
73
|
export function graphFromManifest(manifest, warnings) {
|
|
56
74
|
const nodes = Object.entries(manifest.steps).map(([name, step]) => {
|
|
57
75
|
const { kind, sublabel } = classifyNode(name, manifest.entry, step);
|
|
58
|
-
return {
|
|
76
|
+
return {
|
|
77
|
+
id: name,
|
|
78
|
+
kind,
|
|
79
|
+
label: name,
|
|
80
|
+
sublabel,
|
|
81
|
+
description: step.description ?? "",
|
|
82
|
+
inputSchema: step.inputSchema ?? null,
|
|
83
|
+
capabilities: step.capabilities ?? [],
|
|
84
|
+
timeoutMs: step.timeoutMs ?? null,
|
|
85
|
+
};
|
|
59
86
|
});
|
|
60
87
|
const edges = Object.entries(manifest.steps).flatMap(([name, step]) => edgesForStep(name, step));
|
|
61
|
-
return {
|
|
88
|
+
return {
|
|
89
|
+
manifestName: manifest.name,
|
|
90
|
+
description: manifest.description ?? "",
|
|
91
|
+
entry: manifest.entry,
|
|
92
|
+
nodes,
|
|
93
|
+
edges,
|
|
94
|
+
warnings,
|
|
95
|
+
};
|
|
62
96
|
}
|
|
63
97
|
/**
|
|
64
98
|
* Merges heuristically detected cross-workflow launches into the workflow's
|
|
@@ -91,6 +125,30 @@ export function mergeLaunchesIntoGraph(graph, launches) {
|
|
|
91
125
|
}
|
|
92
126
|
return { ...graph, nodes, edges };
|
|
93
127
|
}
|
|
128
|
+
/** Fills each step node's `capabilities` from statically-detected
|
|
129
|
+
* `ctx.sapiom.*` calls, unless the manifest already declared them (authored
|
|
130
|
+
* capabilities win). Pure — returns a new graph. */
|
|
131
|
+
export function mergeCapabilitiesIntoGraph(graph, detected) {
|
|
132
|
+
if (detected.length === 0)
|
|
133
|
+
return graph;
|
|
134
|
+
const byStep = new Map();
|
|
135
|
+
for (const d of detected) {
|
|
136
|
+
if (!d.fromStepId)
|
|
137
|
+
continue;
|
|
138
|
+
const set = byStep.get(d.fromStepId) ?? new Set();
|
|
139
|
+
set.add(d.capability);
|
|
140
|
+
byStep.set(d.fromStepId, set);
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
...graph,
|
|
144
|
+
nodes: graph.nodes.map((n) => {
|
|
145
|
+
if ((n.capabilities?.length ?? 0) > 0)
|
|
146
|
+
return n; // authored capabilities win
|
|
147
|
+
const caps = byStep.get(n.id);
|
|
148
|
+
return caps ? { ...n, capabilities: [...caps].sort() } : n;
|
|
149
|
+
}),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
94
152
|
/**
|
|
95
153
|
* Extracts a workflow's step graph from its project directory, with detected
|
|
96
154
|
* cross-workflow launches merged in as dashed nodes. Never throws: any
|
|
@@ -105,7 +163,11 @@ export async function extractWorkflowGraph(sourceDir) {
|
|
|
105
163
|
if (!result.ok)
|
|
106
164
|
return { ok: false, reason: result.reason };
|
|
107
165
|
const graph = graphFromManifest(result.manifest, result.warnings);
|
|
108
|
-
const
|
|
109
|
-
|
|
166
|
+
const stepIds = new Set(graph.nodes.map((n) => n.id));
|
|
167
|
+
// One walk over the sources yields both — halves the I/O on the auto-render
|
|
168
|
+
// hot path (this runs on every workflow-source save).
|
|
169
|
+
const { launches, capabilities } = await scanWorkflowSources(sourceDir, stepIds);
|
|
170
|
+
const withLaunches = mergeLaunchesIntoGraph(graph, launches);
|
|
171
|
+
return { ok: true, graph: mergeCapabilitiesIntoGraph(withLaunches, capabilities) };
|
|
110
172
|
}
|
|
111
173
|
//# sourceMappingURL=canvas-graph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-graph.js","sourceRoot":"","sources":["../../src/core/canvas-graph.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,
|
|
1
|
+
{"version":3,"file":"canvas-graph.js","sourceRoot":"","sources":["../../src/core/canvas-graph.ts"],"names":[],"mappings":"AAYA,OAAO,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;IAC1D,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACjD,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;IAC5D,MAAM,KAAK,GAAG,iBAAiB,CAAC,MAAM,CAAC,QAAyB,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IACnF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtD,4EAA4E;IAC5E,sDAAsD;IACtD,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,MAAM,mBAAmB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACjF,MAAM,YAAY,GAAG,sBAAsB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC7D,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,0BAA0B,CAAC,YAAY,EAAE,YAAY,CAAC,EAAE,CAAC;AACrF,CAAC"}
|
|
@@ -8,17 +8,35 @@ export declare function listSourceFiles(root: string): Promise<string[]>;
|
|
|
8
8
|
export interface DetectedLaunch {
|
|
9
9
|
/** The `definition` slug the launch call referenced. */
|
|
10
10
|
slug: string;
|
|
11
|
-
/** The step (by declared name) the call was attributed to — the
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
/** The step (by declared name) the call was attributed to — the step whose
|
|
12
|
+
* `defineStep` block it sits in — or null when it sits outside any step
|
|
13
|
+
* (e.g. a launch in a shared helper). */
|
|
14
14
|
fromStepId: string | null;
|
|
15
15
|
}
|
|
16
|
+
export interface DetectedCapability {
|
|
17
|
+
/** The dotted capability id (e.g. "web.search", "email.messages.send"). */
|
|
18
|
+
capability: string;
|
|
19
|
+
/** The step the call was attributed to, or null (a shared helper). */
|
|
20
|
+
fromStepId: string | null;
|
|
21
|
+
}
|
|
22
|
+
export interface WorkflowSourceScan {
|
|
23
|
+
launches: DetectedLaunch[];
|
|
24
|
+
capabilities: DetectedCapability[];
|
|
25
|
+
}
|
|
16
26
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* (`knownStepIds` = the workflow's real step names, so an unrelated
|
|
20
|
-
* property can never be mistaken for a step). Never throws: unreadable
|
|
21
|
-
* files/directories simply contribute
|
|
27
|
+
* One pass over `root`'s sources returning both the cross-workflow launches and
|
|
28
|
+
* the Sapiom capability calls, each attributed to the `defineStep` block it
|
|
29
|
+
* sits in (`knownStepIds` = the workflow's real step names, so an unrelated
|
|
30
|
+
* `name:` property can never be mistaken for a step). Never throws: unreadable
|
|
31
|
+
* files/directories simply contribute nothing.
|
|
32
|
+
*
|
|
33
|
+
* A single walk + read + block computation per file: the callers used to scan
|
|
34
|
+
* the tree twice (once per detector), and auto-render now fires on every save,
|
|
35
|
+
* so the shared pass halves the I/O on the hot path.
|
|
22
36
|
*/
|
|
37
|
+
export declare function scanWorkflowSources(root: string, knownStepIds: ReadonlySet<string>): Promise<WorkflowSourceScan>;
|
|
38
|
+
/** Just the launches from {@link scanWorkflowSources}. */
|
|
23
39
|
export declare function detectWorkflowLaunches(root: string, knownStepIds: ReadonlySet<string>): Promise<DetectedLaunch[]>;
|
|
40
|
+
/** Just the capabilities from {@link scanWorkflowSources}. */
|
|
41
|
+
export declare function detectStepCapabilities(root: string, knownStepIds: ReadonlySet<string>): Promise<DetectedCapability[]>;
|
|
24
42
|
//# sourceMappingURL=canvas-interconnections.d.ts.map
|
|
@@ -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":"AAwDA;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAsBrE;AAsFD,MAAM,WAAW,cAAc;IAC7B,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb;;8CAE0C;IAC1C,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC,2EAA2E;IAC3E,UAAU,EAAE,MAAM,CAAC;IACnB,sEAAsE;IACtE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,YAAY,EAAE,kBAAkB,EAAE,CAAC;CACpC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,GAChC,OAAO,CAAC,kBAAkB,CAAC,CAyB7B;AAED,0DAA0D;AAC1D,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,GAChC,OAAO,CAAC,cAAc,EAAE,CAAC,CAE3B;AAED,8DAA8D;AAC9D,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,GAChC,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAE/B"}
|