@zenera/neo 1.1.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/LICENSE +21 -0
- package/README.md +178 -0
- package/dist/agent.d.ts +66 -0
- package/dist/agent.js +97 -0
- package/dist/architecture.d.ts +74 -0
- package/dist/architecture.js +105 -0
- package/dist/embedding.d.ts +60 -0
- package/dist/embedding.js +21 -0
- package/dist/embeddings/gemini.d.ts +24 -0
- package/dist/embeddings/gemini.js +71 -0
- package/dist/embeddings/index.d.ts +4 -0
- package/dist/embeddings/index.js +4 -0
- package/dist/embeddings/openai.d.ts +18 -0
- package/dist/embeddings/openai.js +27 -0
- package/dist/embeddings/openrouter.d.ts +21 -0
- package/dist/embeddings/openrouter.js +54 -0
- package/dist/events.d.ts +144 -0
- package/dist/events.js +110 -0
- package/dist/ids.d.ts +14 -0
- package/dist/ids.js +33 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +25 -0
- package/dist/inspect/client.d.ts +2 -0
- package/dist/inspect/client.js +1326 -0
- package/dist/inspect/css.d.ts +2 -0
- package/dist/inspect/css.js +164 -0
- package/dist/inspect/index.d.ts +9 -0
- package/dist/inspect/index.js +12 -0
- package/dist/inspect/page.d.ts +3 -0
- package/dist/inspect/page.js +93 -0
- package/dist/inspect/report.d.ts +54 -0
- package/dist/inspect/report.js +62 -0
- package/dist/kernel.d.ts +178 -0
- package/dist/kernel.js +929 -0
- package/dist/memory-stores/factory.d.ts +15 -0
- package/dist/memory-stores/factory.js +29 -0
- package/dist/memory-stores/file.d.ts +37 -0
- package/dist/memory-stores/file.js +174 -0
- package/dist/memory-stores/in-memory.d.ts +17 -0
- package/dist/memory-stores/in-memory.js +80 -0
- package/dist/memory-stores/index.d.ts +4 -0
- package/dist/memory-stores/index.js +5 -0
- package/dist/memory.d.ts +115 -0
- package/dist/memory.js +213 -0
- package/dist/model.d.ts +25 -0
- package/dist/model.js +2 -0
- package/dist/models/anthropic.d.ts +36 -0
- package/dist/models/anthropic.js +293 -0
- package/dist/models/factory.d.ts +202 -0
- package/dist/models/factory.js +533 -0
- package/dist/models/gemini.d.ts +45 -0
- package/dist/models/gemini.js +368 -0
- package/dist/models/index.d.ts +7 -0
- package/dist/models/index.js +7 -0
- package/dist/models/openai-chat.d.ts +19 -0
- package/dist/models/openai-chat.js +203 -0
- package/dist/models/openai-responses.d.ts +31 -0
- package/dist/models/openai-responses.js +258 -0
- package/dist/models/openrouter.d.ts +44 -0
- package/dist/models/openrouter.js +230 -0
- package/dist/payload-stores/factory.d.ts +15 -0
- package/dist/payload-stores/factory.js +30 -0
- package/dist/payload-stores/file.d.ts +29 -0
- package/dist/payload-stores/file.js +112 -0
- package/dist/payload-stores/in-memory.d.ts +17 -0
- package/dist/payload-stores/in-memory.js +40 -0
- package/dist/payload-stores/index.d.ts +4 -0
- package/dist/payload-stores/index.js +5 -0
- package/dist/payload.d.ts +89 -0
- package/dist/payload.js +181 -0
- package/dist/project/config.d.ts +302 -0
- package/dist/project/config.js +290 -0
- package/dist/project/index.d.ts +4 -0
- package/dist/project/index.js +4 -0
- package/dist/project/load.d.ts +142 -0
- package/dist/project/load.js +430 -0
- package/dist/project/refs.d.ts +23 -0
- package/dist/project/refs.js +70 -0
- package/dist/prompt.d.ts +66 -0
- package/dist/prompt.js +62 -0
- package/dist/runner.d.ts +103 -0
- package/dist/runner.js +537 -0
- package/dist/services.d.ts +23 -0
- package/dist/services.js +44 -0
- package/dist/skill-providers/factory.d.ts +16 -0
- package/dist/skill-providers/factory.js +26 -0
- package/dist/skill-providers/file.d.ts +44 -0
- package/dist/skill-providers/file.js +209 -0
- package/dist/skill-providers/index.d.ts +4 -0
- package/dist/skill-providers/index.js +5 -0
- package/dist/skill-providers/static.d.ts +13 -0
- package/dist/skill-providers/static.js +47 -0
- package/dist/skills.d.ts +102 -0
- package/dist/skills.js +232 -0
- package/dist/state.d.ts +86 -0
- package/dist/state.js +49 -0
- package/dist/tools/exa.d.ts +23 -0
- package/dist/tools/exa.js +389 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.js +6 -0
- package/dist/tools/sandbox.d.ts +172 -0
- package/dist/tools/sandbox.js +602 -0
- package/dist/tools/workspace.d.ts +53 -0
- package/dist/tools/workspace.js +1034 -0
- package/dist/trajectory.d.ts +213 -0
- package/dist/trajectory.js +232 -0
- package/dist/types.d.ts +195 -0
- package/dist/types.js +134 -0
- package/package.json +98 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const CSS = "\n:root {\n --bg: #0f1115; --panel: #161922; --line: #262b36; --fg: #d7dbe3; --dim: #8a92a6;\n --accent: #6ea8fe; --ok: #4ec9a0; --err: #f0776c; --warn: #e2b341; --mono: ui-monospace, SFMono-Regular, Menlo, monospace;\n}\n* { box-sizing: border-box; }\nbody { margin: 0; background: var(--bg); color: var(--fg);\n font: 14px/1.5 system-ui, -apple-system, Segoe UI, sans-serif; }\nheader { padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel);\n display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: baseline; }\nheader h1 { font-size: 15px; margin: 0 12px 0 0; font-weight: 600; }\nheader .kv { color: var(--dim); font-size: 12px; }\nheader .kv b { color: var(--fg); font-weight: 600; }\nmain { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 49px); }\naside { border-right: 1px solid var(--line); overflow: auto; background: var(--panel); }\n.pad { padding: 10px; position: sticky; top: 0; background: var(--panel); border-bottom: 1px solid var(--line); }\n#filter { width: 100%; padding: 6px 8px; background: var(--bg); color: var(--fg);\n border: 1px solid var(--line); border-radius: 6px; }\n#timeline { list-style: none; margin: 0; padding: 4px 0; }\n#timeline li { padding: 6px 10px; border-left: 3px solid transparent; cursor: pointer; }\n#timeline li:hover { background: #1c2130; }\n#timeline li.sel { background: #1f2637; border-left-color: var(--accent); }\n#timeline li.covered { opacity: .45; }\n#timeline .row { display: flex; gap: 6px; align-items: baseline; }\n#timeline .t { color: var(--fg); font: 11px var(--mono); min-width: 38px; text-align: right; }\n#timeline .t.same { color: #3d4453; }\n#timeline .dur { margin-left: auto; color: var(--dim); font: 11px var(--mono); }\n#timeline .idx { color: var(--dim); font: 11px var(--mono); min-width: 22px; }\n#timeline .prev { color: var(--dim); font-size: 11px; white-space: nowrap;\n overflow: hidden; text-overflow: ellipsis; padding-left: 44px; }\n/* Branch histories are contiguous in this list, so a coloured edge plus a\n header is enough to stop ten parallel branches reading as one long run. */\n#timeline li.sep { cursor: default; padding: 10px 10px 4px; display: flex; gap: 7px;\n align-items: center; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;\n color: var(--dim); border-left-color: transparent; }\n#timeline li.sep:hover { background: none; }\n#timeline li.sep .dot { width: 8px; height: 8px; border-radius: 2px;\n background: var(--bc, var(--dim)); }\n/* The group header shouts in uppercase; its elapsed time should not. */\n#timeline li.sep .dur { text-transform: none; letter-spacing: 0; }\n/* The branch the join actually waited for. */\n#timeline li.sep.slow { background: #232a38; color: var(--fg); }\n#timeline li.sep.slow .dur { color: var(--fg); }\n#timeline li.branch { padding-left: 20px; border-left-color: var(--bc, var(--line)); }\n#timeline li.branch.sel { border-left-color: var(--bc, var(--accent)); }\n#middle { display: flex; flex-direction: column; overflow: hidden; }\n.tabs { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); }\n.tabs button { background: none; border: 1px solid transparent; color: var(--dim);\n padding: 4px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; }\n.tabs button.on { color: var(--fg); background: var(--panel); border-color: var(--line); }\n#detail { overflow: auto; padding: 16px; flex: 1; }\n#stats { overflow: auto; padding: 16px; flex: 1; }\ntable.st { width: 100%; border-collapse: collapse; font: 12px var(--mono); }\ntable.st th { text-align: right; color: var(--dim); font-weight: 600; padding: 6px 12px;\n border-bottom: 1px solid var(--line); white-space: nowrap; }\ntable.st td { text-align: right; padding: 5px 12px; border-bottom: 1px solid #1d2230;\n white-space: nowrap; }\ntable.st th:first-child, table.st td:first-child { text-align: left; }\ntable.st tbody tr:hover { background: #1c2130; }\ntable.st tbody tr:last-child td { border-bottom: none; }\n/* The total is a different kind of row, not one more of the same: it gets its\n own band so nobody reads it as another model or another agent. */\ntable.st tfoot td { color: var(--fg); font-weight: 600; background: #191e2a;\n border-top: 1px solid #2b3346; border-bottom: none; padding: 7px 12px; }\ntable.st tfoot td:first-child { color: var(--dim); text-transform: uppercase;\n letter-spacing: .07em; font-size: 11px; }\n/* Two panes hold a zoomable diagram (the run graph and the architecture), so\n everything about one is written for both. */\n.pane { display: flex; flex-direction: column; overflow: hidden; flex: 1; }\n/* An explicit display on the pane would otherwise beat the hidden attribute\n and both views would show at once. */\n.pane[hidden], #detail[hidden], #stats[hidden] { display: none; }\n.pane svg { max-width: none; display: block; }\n.pane .node { cursor: pointer; }\n/* A node with nothing behind it in this run is not clickable, and says so. */\n.pane .node.idle { cursor: default; }\n.gtools { display: flex; align-items: center; gap: 6px; padding: 6px 10px;\n border-bottom: 1px solid var(--line); background: var(--panel); }\n.gtools button { background: var(--bg); border: 1px solid var(--line); color: var(--fg);\n border-radius: 6px; padding: 2px 10px; cursor: pointer; font: 12px var(--mono); }\n.gtools button:hover { border-color: var(--accent); }\n.gtools .hint:first-of-type { margin-left: 8px; }\n.gtools .lvl { margin-left: auto; font-family: var(--mono); }\n/* The canvas is transformed, not scrolled: panning has to work past the edges\n of the diagram, which overflow:auto would forbid. */\n.viewport { flex: 1; overflow: hidden; position: relative; cursor: grab; touch-action: none;\n user-select: none; -webkit-user-select: none; }\n.viewport.drag { cursor: grabbing; }\n.canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; }\n.hint { color: var(--dim); font-size: 12px; }\n.hint.pad { padding: 16px; }\n.type { font-size: 11px; letter-spacing: .04em; text-transform: uppercase;\n padding: 1px 6px; border-radius: 4px; background: #232a38; color: var(--dim); }\n.type.llm_call { background: #1e3357; color: #9dc1ff; }\n.type.tool_call, .type.tool_result { background: #1e3d33; color: #8ee0c2; }\n.type.compaction { background: #40331a; color: var(--warn); }\n.type.fork, .type.join { background: #3a2450; color: #d1a6ff; }\n.type.final_output { background: #14392c; color: var(--ok); }\n.type.err { background: #4a1f1c; color: var(--err); }\nh2.dt { font-size: 16px; margin: 0 0 4px; display: flex; gap: 10px; align-items: center; }\n.meta { color: var(--dim); font-size: 12px; font-family: var(--mono); margin-bottom: 14px;\n display: flex; flex-wrap: wrap; gap: 4px 14px; }\nsection.blk { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px;\n background: var(--panel); overflow: hidden; }\nsection.blk > h3 { margin: 0; padding: 7px 12px; font-size: 12px; font-weight: 600;\n color: var(--dim); border-bottom: 1px solid var(--line); letter-spacing: .03em; }\nsection.blk > h3 .tag { float: right; font-weight: 400; }\nsection.blk.sys { border-left: 3px solid var(--warn); }\n/* An LLM call has three things a reader wants to tell apart at a glance: what\n went in, what came back, and what it cost. Groups carry the first two. */\n.group { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px;\n background: #12151d; overflow: hidden; }\n.group > .ghdr { display: flex; align-items: center; gap: 10px; padding: 8px 12px;\n font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;\n background: #1b2130; border-bottom: 1px solid var(--line); }\n.group > .ghdr .tag { margin-left: auto; font: 11px var(--mono); font-weight: 400;\n letter-spacing: 0; text-transform: none; color: var(--dim); }\n.group > .body { padding: 10px; }\n.group > .body > .blk:last-child { margin-bottom: 0; }\n.group.req { border-left: 3px solid var(--accent); }\n.group.req > .ghdr { color: #9dc1ff; }\n.group.res { border-left: 3px solid var(--ok); }\n.group.res > .ghdr { color: #8ee0c2; }\n.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }\n.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 999px;\n padding: 3px 12px; font: 12px var(--mono); color: var(--dim); }\n.stat b { color: var(--fg); font-weight: 600; }\npre { margin: 0; padding: 10px 12px; font: 12px/1.55 var(--mono); white-space: pre-wrap;\n word-break: break-word; overflow-wrap: anywhere; }\npre.text { white-space: pre-wrap; }\nimg.media { display: block; max-width: 100%; max-height: 420px; margin: 10px 12px;\n border: 1px solid var(--line); border-radius: 6px; background: #0d1017; }\nimg.media.thumb { max-height: 88px; margin: 8px 12px; cursor: zoom-in; }\n.msg { border-top: 1px solid var(--line); border-left: 3px solid transparent; }\n.msg:first-of-type { border-top: none; }\n.msg > .role { padding: 5px 12px; font-size: 11px; text-transform: uppercase;\n letter-spacing: .05em; color: var(--dim); background: #1b202c;\n display: flex; justify-content: space-between; }\n.msg.user > .role { color: #9dc1ff; }\n.msg.user { border-left-color: #35507f; }\n.msg.assistant > .role { color: #c3a6ff; }\n.msg.assistant { border-left-color: #5a4380; }\n.msg.tool > .role { color: #8ee0c2; }\n.msg.tool { border-left-color: #2f6b58; }\n.msg.system > .role { color: var(--warn); }\n.msg.system { border-left-color: #7a6535; }\n.msg.err > .role { color: var(--err); }\n.msg.err { border-left-color: #8a3a33; }\n.call { border-top: 1px dashed var(--line); }\n.call .name { padding: 5px 12px; font: 12px var(--mono); color: #8ee0c2; }\ndetails > summary { cursor: pointer; padding: 6px 12px; color: var(--dim); font-size: 12px; }\n.badge { font: 11px var(--mono); color: var(--dim); }\n.badge.ok { color: var(--ok); } .badge.bad { color: var(--err); }\n.empty { padding: 10px 12px; color: var(--dim); font-size: 12px; font-style: italic; }\nbutton.link { background: none; border: none; color: var(--accent); cursor: pointer;\n font: 12px var(--mono); padding: 0 6px 0 0; }\n";
|
|
2
|
+
//# sourceMappingURL=css.d.ts.map
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Page styles
|
|
3
|
+
//
|
|
4
|
+
// Split out of the report code for no reason other than size: this is one
|
|
5
|
+
// string, embedded verbatim into the <style> element by `page()`.
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
export const CSS = `
|
|
8
|
+
:root {
|
|
9
|
+
--bg: #0f1115; --panel: #161922; --line: #262b36; --fg: #d7dbe3; --dim: #8a92a6;
|
|
10
|
+
--accent: #6ea8fe; --ok: #4ec9a0; --err: #f0776c; --warn: #e2b341; --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
11
|
+
}
|
|
12
|
+
* { box-sizing: border-box; }
|
|
13
|
+
body { margin: 0; background: var(--bg); color: var(--fg);
|
|
14
|
+
font: 14px/1.5 system-ui, -apple-system, Segoe UI, sans-serif; }
|
|
15
|
+
header { padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel);
|
|
16
|
+
display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: baseline; }
|
|
17
|
+
header h1 { font-size: 15px; margin: 0 12px 0 0; font-weight: 600; }
|
|
18
|
+
header .kv { color: var(--dim); font-size: 12px; }
|
|
19
|
+
header .kv b { color: var(--fg); font-weight: 600; }
|
|
20
|
+
main { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 49px); }
|
|
21
|
+
aside { border-right: 1px solid var(--line); overflow: auto; background: var(--panel); }
|
|
22
|
+
.pad { padding: 10px; position: sticky; top: 0; background: var(--panel); border-bottom: 1px solid var(--line); }
|
|
23
|
+
#filter { width: 100%; padding: 6px 8px; background: var(--bg); color: var(--fg);
|
|
24
|
+
border: 1px solid var(--line); border-radius: 6px; }
|
|
25
|
+
#timeline { list-style: none; margin: 0; padding: 4px 0; }
|
|
26
|
+
#timeline li { padding: 6px 10px; border-left: 3px solid transparent; cursor: pointer; }
|
|
27
|
+
#timeline li:hover { background: #1c2130; }
|
|
28
|
+
#timeline li.sel { background: #1f2637; border-left-color: var(--accent); }
|
|
29
|
+
#timeline li.covered { opacity: .45; }
|
|
30
|
+
#timeline .row { display: flex; gap: 6px; align-items: baseline; }
|
|
31
|
+
#timeline .t { color: var(--fg); font: 11px var(--mono); min-width: 38px; text-align: right; }
|
|
32
|
+
#timeline .t.same { color: #3d4453; }
|
|
33
|
+
#timeline .dur { margin-left: auto; color: var(--dim); font: 11px var(--mono); }
|
|
34
|
+
#timeline .idx { color: var(--dim); font: 11px var(--mono); min-width: 22px; }
|
|
35
|
+
#timeline .prev { color: var(--dim); font-size: 11px; white-space: nowrap;
|
|
36
|
+
overflow: hidden; text-overflow: ellipsis; padding-left: 44px; }
|
|
37
|
+
/* Branch histories are contiguous in this list, so a coloured edge plus a
|
|
38
|
+
header is enough to stop ten parallel branches reading as one long run. */
|
|
39
|
+
#timeline li.sep { cursor: default; padding: 10px 10px 4px; display: flex; gap: 7px;
|
|
40
|
+
align-items: center; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
|
|
41
|
+
color: var(--dim); border-left-color: transparent; }
|
|
42
|
+
#timeline li.sep:hover { background: none; }
|
|
43
|
+
#timeline li.sep .dot { width: 8px; height: 8px; border-radius: 2px;
|
|
44
|
+
background: var(--bc, var(--dim)); }
|
|
45
|
+
/* The group header shouts in uppercase; its elapsed time should not. */
|
|
46
|
+
#timeline li.sep .dur { text-transform: none; letter-spacing: 0; }
|
|
47
|
+
/* The branch the join actually waited for. */
|
|
48
|
+
#timeline li.sep.slow { background: #232a38; color: var(--fg); }
|
|
49
|
+
#timeline li.sep.slow .dur { color: var(--fg); }
|
|
50
|
+
#timeline li.branch { padding-left: 20px; border-left-color: var(--bc, var(--line)); }
|
|
51
|
+
#timeline li.branch.sel { border-left-color: var(--bc, var(--accent)); }
|
|
52
|
+
#middle { display: flex; flex-direction: column; overflow: hidden; }
|
|
53
|
+
.tabs { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
|
|
54
|
+
.tabs button { background: none; border: 1px solid transparent; color: var(--dim);
|
|
55
|
+
padding: 4px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; }
|
|
56
|
+
.tabs button.on { color: var(--fg); background: var(--panel); border-color: var(--line); }
|
|
57
|
+
#detail { overflow: auto; padding: 16px; flex: 1; }
|
|
58
|
+
#stats { overflow: auto; padding: 16px; flex: 1; }
|
|
59
|
+
table.st { width: 100%; border-collapse: collapse; font: 12px var(--mono); }
|
|
60
|
+
table.st th { text-align: right; color: var(--dim); font-weight: 600; padding: 6px 12px;
|
|
61
|
+
border-bottom: 1px solid var(--line); white-space: nowrap; }
|
|
62
|
+
table.st td { text-align: right; padding: 5px 12px; border-bottom: 1px solid #1d2230;
|
|
63
|
+
white-space: nowrap; }
|
|
64
|
+
table.st th:first-child, table.st td:first-child { text-align: left; }
|
|
65
|
+
table.st tbody tr:hover { background: #1c2130; }
|
|
66
|
+
table.st tbody tr:last-child td { border-bottom: none; }
|
|
67
|
+
/* The total is a different kind of row, not one more of the same: it gets its
|
|
68
|
+
own band so nobody reads it as another model or another agent. */
|
|
69
|
+
table.st tfoot td { color: var(--fg); font-weight: 600; background: #191e2a;
|
|
70
|
+
border-top: 1px solid #2b3346; border-bottom: none; padding: 7px 12px; }
|
|
71
|
+
table.st tfoot td:first-child { color: var(--dim); text-transform: uppercase;
|
|
72
|
+
letter-spacing: .07em; font-size: 11px; }
|
|
73
|
+
/* Two panes hold a zoomable diagram (the run graph and the architecture), so
|
|
74
|
+
everything about one is written for both. */
|
|
75
|
+
.pane { display: flex; flex-direction: column; overflow: hidden; flex: 1; }
|
|
76
|
+
/* An explicit display on the pane would otherwise beat the hidden attribute
|
|
77
|
+
and both views would show at once. */
|
|
78
|
+
.pane[hidden], #detail[hidden], #stats[hidden] { display: none; }
|
|
79
|
+
.pane svg { max-width: none; display: block; }
|
|
80
|
+
.pane .node { cursor: pointer; }
|
|
81
|
+
/* A node with nothing behind it in this run is not clickable, and says so. */
|
|
82
|
+
.pane .node.idle { cursor: default; }
|
|
83
|
+
.gtools { display: flex; align-items: center; gap: 6px; padding: 6px 10px;
|
|
84
|
+
border-bottom: 1px solid var(--line); background: var(--panel); }
|
|
85
|
+
.gtools button { background: var(--bg); border: 1px solid var(--line); color: var(--fg);
|
|
86
|
+
border-radius: 6px; padding: 2px 10px; cursor: pointer; font: 12px var(--mono); }
|
|
87
|
+
.gtools button:hover { border-color: var(--accent); }
|
|
88
|
+
.gtools .hint:first-of-type { margin-left: 8px; }
|
|
89
|
+
.gtools .lvl { margin-left: auto; font-family: var(--mono); }
|
|
90
|
+
/* The canvas is transformed, not scrolled: panning has to work past the edges
|
|
91
|
+
of the diagram, which overflow:auto would forbid. */
|
|
92
|
+
.viewport { flex: 1; overflow: hidden; position: relative; cursor: grab; touch-action: none;
|
|
93
|
+
user-select: none; -webkit-user-select: none; }
|
|
94
|
+
.viewport.drag { cursor: grabbing; }
|
|
95
|
+
.canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
|
|
96
|
+
.hint { color: var(--dim); font-size: 12px; }
|
|
97
|
+
.hint.pad { padding: 16px; }
|
|
98
|
+
.type { font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
|
|
99
|
+
padding: 1px 6px; border-radius: 4px; background: #232a38; color: var(--dim); }
|
|
100
|
+
.type.llm_call { background: #1e3357; color: #9dc1ff; }
|
|
101
|
+
.type.tool_call, .type.tool_result { background: #1e3d33; color: #8ee0c2; }
|
|
102
|
+
.type.compaction { background: #40331a; color: var(--warn); }
|
|
103
|
+
.type.fork, .type.join { background: #3a2450; color: #d1a6ff; }
|
|
104
|
+
.type.final_output { background: #14392c; color: var(--ok); }
|
|
105
|
+
.type.err { background: #4a1f1c; color: var(--err); }
|
|
106
|
+
h2.dt { font-size: 16px; margin: 0 0 4px; display: flex; gap: 10px; align-items: center; }
|
|
107
|
+
.meta { color: var(--dim); font-size: 12px; font-family: var(--mono); margin-bottom: 14px;
|
|
108
|
+
display: flex; flex-wrap: wrap; gap: 4px 14px; }
|
|
109
|
+
section.blk { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px;
|
|
110
|
+
background: var(--panel); overflow: hidden; }
|
|
111
|
+
section.blk > h3 { margin: 0; padding: 7px 12px; font-size: 12px; font-weight: 600;
|
|
112
|
+
color: var(--dim); border-bottom: 1px solid var(--line); letter-spacing: .03em; }
|
|
113
|
+
section.blk > h3 .tag { float: right; font-weight: 400; }
|
|
114
|
+
section.blk.sys { border-left: 3px solid var(--warn); }
|
|
115
|
+
/* An LLM call has three things a reader wants to tell apart at a glance: what
|
|
116
|
+
went in, what came back, and what it cost. Groups carry the first two. */
|
|
117
|
+
.group { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px;
|
|
118
|
+
background: #12151d; overflow: hidden; }
|
|
119
|
+
.group > .ghdr { display: flex; align-items: center; gap: 10px; padding: 8px 12px;
|
|
120
|
+
font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
|
|
121
|
+
background: #1b2130; border-bottom: 1px solid var(--line); }
|
|
122
|
+
.group > .ghdr .tag { margin-left: auto; font: 11px var(--mono); font-weight: 400;
|
|
123
|
+
letter-spacing: 0; text-transform: none; color: var(--dim); }
|
|
124
|
+
.group > .body { padding: 10px; }
|
|
125
|
+
.group > .body > .blk:last-child { margin-bottom: 0; }
|
|
126
|
+
.group.req { border-left: 3px solid var(--accent); }
|
|
127
|
+
.group.req > .ghdr { color: #9dc1ff; }
|
|
128
|
+
.group.res { border-left: 3px solid var(--ok); }
|
|
129
|
+
.group.res > .ghdr { color: #8ee0c2; }
|
|
130
|
+
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
|
|
131
|
+
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
|
|
132
|
+
padding: 3px 12px; font: 12px var(--mono); color: var(--dim); }
|
|
133
|
+
.stat b { color: var(--fg); font-weight: 600; }
|
|
134
|
+
pre { margin: 0; padding: 10px 12px; font: 12px/1.55 var(--mono); white-space: pre-wrap;
|
|
135
|
+
word-break: break-word; overflow-wrap: anywhere; }
|
|
136
|
+
pre.text { white-space: pre-wrap; }
|
|
137
|
+
img.media { display: block; max-width: 100%; max-height: 420px; margin: 10px 12px;
|
|
138
|
+
border: 1px solid var(--line); border-radius: 6px; background: #0d1017; }
|
|
139
|
+
img.media.thumb { max-height: 88px; margin: 8px 12px; cursor: zoom-in; }
|
|
140
|
+
.msg { border-top: 1px solid var(--line); border-left: 3px solid transparent; }
|
|
141
|
+
.msg:first-of-type { border-top: none; }
|
|
142
|
+
.msg > .role { padding: 5px 12px; font-size: 11px; text-transform: uppercase;
|
|
143
|
+
letter-spacing: .05em; color: var(--dim); background: #1b202c;
|
|
144
|
+
display: flex; justify-content: space-between; }
|
|
145
|
+
.msg.user > .role { color: #9dc1ff; }
|
|
146
|
+
.msg.user { border-left-color: #35507f; }
|
|
147
|
+
.msg.assistant > .role { color: #c3a6ff; }
|
|
148
|
+
.msg.assistant { border-left-color: #5a4380; }
|
|
149
|
+
.msg.tool > .role { color: #8ee0c2; }
|
|
150
|
+
.msg.tool { border-left-color: #2f6b58; }
|
|
151
|
+
.msg.system > .role { color: var(--warn); }
|
|
152
|
+
.msg.system { border-left-color: #7a6535; }
|
|
153
|
+
.msg.err > .role { color: var(--err); }
|
|
154
|
+
.msg.err { border-left-color: #8a3a33; }
|
|
155
|
+
.call { border-top: 1px dashed var(--line); }
|
|
156
|
+
.call .name { padding: 5px 12px; font: 12px var(--mono); color: #8ee0c2; }
|
|
157
|
+
details > summary { cursor: pointer; padding: 6px 12px; color: var(--dim); font-size: 12px; }
|
|
158
|
+
.badge { font: 11px var(--mono); color: var(--dim); }
|
|
159
|
+
.badge.ok { color: var(--ok); } .badge.bad { color: var(--err); }
|
|
160
|
+
.empty { padding: 10px 12px; color: var(--dim); font-size: 12px; font-style: italic; }
|
|
161
|
+
button.link { background: none; border: none; color: var(--accent); cursor: pointer;
|
|
162
|
+
font: 12px var(--mono); padding: 0 6px 0 0; }
|
|
163
|
+
`;
|
|
164
|
+
//# sourceMappingURL=css.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReportOptions, type RunReport } from './report.ts';
|
|
2
|
+
import type { AgentState } from '../state.ts';
|
|
3
|
+
import type { PayloadResolver } from '../payload.ts';
|
|
4
|
+
export { buildRunReport, MAX_BLOB_BYTES, MERMAID_URL, type ReportOptions, type RunReport, } from './report.ts';
|
|
5
|
+
/** Report → one standalone HTML document. */
|
|
6
|
+
export declare function renderReportHtml(report: RunReport, opts?: ReportOptions): string;
|
|
7
|
+
/** The usual entry point: state in, HTML out. */
|
|
8
|
+
export declare function renderRunReport(state: AgentState, payloads: PayloadResolver, opts?: ReportOptions): Promise<string>;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { page } from "./page.js";
|
|
2
|
+
import { buildRunReport, MERMAID_URL } from "./report.js";
|
|
3
|
+
export { buildRunReport, MAX_BLOB_BYTES, MERMAID_URL, } from "./report.js";
|
|
4
|
+
/** Report → one standalone HTML document. */
|
|
5
|
+
export function renderReportHtml(report, opts = {}) {
|
|
6
|
+
return page(report, opts.mermaidUrl ?? MERMAID_URL);
|
|
7
|
+
}
|
|
8
|
+
/** The usual entry point: state in, HTML out. */
|
|
9
|
+
export async function renderRunReport(state, payloads, opts = {}) {
|
|
10
|
+
return renderReportHtml(await buildRunReport(state, payloads, opts), opts);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { CLIENT } from "./client.js";
|
|
2
|
+
import { CSS } from "./css.js";
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// The document
|
|
5
|
+
//
|
|
6
|
+
// One function, one string. The page is data-driven: all of the report travels
|
|
7
|
+
// as JSON and the rendering happens in the browser, so the only thing this
|
|
8
|
+
// module has to get right is the shell and the escaping.
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
export function page(report, mermaidUrl) {
|
|
11
|
+
return `<!doctype html>
|
|
12
|
+
<html lang="en">
|
|
13
|
+
<head>
|
|
14
|
+
<meta charset="utf-8">
|
|
15
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
16
|
+
<title>${escapeHtml(report.title)}</title>
|
|
17
|
+
<style>${CSS}</style>
|
|
18
|
+
</head>
|
|
19
|
+
<body>
|
|
20
|
+
<header id="head"></header>
|
|
21
|
+
<main>
|
|
22
|
+
<aside id="side">
|
|
23
|
+
<div class="pad"><input id="filter" type="search" placeholder="filter nodes…" autocomplete="off"></div>
|
|
24
|
+
<ol id="timeline"></ol>
|
|
25
|
+
</aside>
|
|
26
|
+
<section id="middle">
|
|
27
|
+
<div class="tabs" id="viewtabs">
|
|
28
|
+
<button data-view="graph" class="on">Graph</button>
|
|
29
|
+
<button data-view="detail">Detail</button>
|
|
30
|
+
<button data-view="stats">Stats</button>
|
|
31
|
+
<button data-view="agents">Agents</button>
|
|
32
|
+
</div>
|
|
33
|
+
<div id="graph" class="pane">
|
|
34
|
+
<div class="gtools">
|
|
35
|
+
<button data-zoom="out" title="zoom out">−</button>
|
|
36
|
+
<button data-zoom="in" title="zoom in">+</button>
|
|
37
|
+
<button data-zoom="fit" title="fit to window (double-click the canvas)">fit</button>
|
|
38
|
+
<button data-zoom="reset" title="actual size">1:1</button>
|
|
39
|
+
<span class="hint">scroll to zoom · drag to pan</span>
|
|
40
|
+
<span class="hint lvl">100%</span>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="viewport"><div class="canvas"><div class="hint pad">rendering…</div></div></div>
|
|
43
|
+
</div>
|
|
44
|
+
<div id="detail" hidden></div>
|
|
45
|
+
<div id="stats" hidden></div>
|
|
46
|
+
<div id="agents" class="pane" hidden>
|
|
47
|
+
<div class="gtools">
|
|
48
|
+
<button data-zoom="out" title="zoom out">−</button>
|
|
49
|
+
<button data-zoom="in" title="zoom in">+</button>
|
|
50
|
+
<button data-zoom="fit" title="fit to window (double-click the canvas)">fit</button>
|
|
51
|
+
<button data-zoom="reset" title="actual size">1:1</button>
|
|
52
|
+
<span class="hint" id="alegend"></span>
|
|
53
|
+
<span class="hint lvl">100%</span>
|
|
54
|
+
</div>
|
|
55
|
+
<div class="viewport"><div class="canvas"><div class="hint pad">rendering…</div></div></div>
|
|
56
|
+
</div>
|
|
57
|
+
</section>
|
|
58
|
+
</main>
|
|
59
|
+
<script id="run-data" type="application/json">${embedJson(report)}</script>
|
|
60
|
+
<script type="module">
|
|
61
|
+
const MERMAID_URL = ${embedJson(mermaidUrl)};
|
|
62
|
+
${CLIENT}
|
|
63
|
+
</script>
|
|
64
|
+
</body>
|
|
65
|
+
</html>
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
// Escaping
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
/**
|
|
72
|
+
* Blob content is model output and tool output — untrusted by definition. Two
|
|
73
|
+
* rules keep it inert: it reaches the document only as JSON inside a non-executable
|
|
74
|
+
* `application/json` block, and the page only ever writes it through
|
|
75
|
+
* `textContent`. Escaping every `<`, `>` and `&` makes the first rule
|
|
76
|
+
* unbreakable: no byte sequence in a payload can close the script element.
|
|
77
|
+
*/
|
|
78
|
+
function embedJson(value) {
|
|
79
|
+
return JSON.stringify(value)
|
|
80
|
+
.replace(/</g, '\\u003c')
|
|
81
|
+
.replace(/>/g, '\\u003e')
|
|
82
|
+
.replace(/&/g, '\\u0026')
|
|
83
|
+
.replace(/\u2028/g, '\\u2028')
|
|
84
|
+
.replace(/\u2029/g, '\\u2029');
|
|
85
|
+
}
|
|
86
|
+
function escapeHtml(value) {
|
|
87
|
+
return value
|
|
88
|
+
.replace(/&/g, '&')
|
|
89
|
+
.replace(/</g, '<')
|
|
90
|
+
.replace(/>/g, '>')
|
|
91
|
+
.replace(/"/g, '"');
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Architecture } from '../architecture.ts';
|
|
2
|
+
import { type PayloadResolver } from '../payload.ts';
|
|
3
|
+
import type { AgentState } from '../state.ts';
|
|
4
|
+
/** Default per-payload inline cap. Keeps one runaway tool result from turning
|
|
5
|
+
* a report into a file no editor will open. */
|
|
6
|
+
export declare const MAX_BLOB_BYTES: number;
|
|
7
|
+
export declare const MERMAID_URL = "https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs";
|
|
8
|
+
export interface ReportOptions {
|
|
9
|
+
title?: string;
|
|
10
|
+
/** per-payload inline cap; larger values are cut, with a visible marker */
|
|
11
|
+
maxBlobBytes?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Where the page loads Mermaid from. The diagram is the one thing the page
|
|
14
|
+
* cannot carry itself without bloating past a megabyte; everything else is
|
|
15
|
+
* inlined, and the timeline works with no network at all.
|
|
16
|
+
*/
|
|
17
|
+
mermaidUrl?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The declared wiring, from `AgentRunner.describe()`. Optional because a
|
|
20
|
+
* report is often rendered from a stored state with no live runner around;
|
|
21
|
+
* the page then reconstructs what the run itself touched, which is a
|
|
22
|
+
* strictly smaller picture but never a wrong one.
|
|
23
|
+
*/
|
|
24
|
+
architecture?: Architecture;
|
|
25
|
+
}
|
|
26
|
+
/** Everything the page needs, and nothing that needs a store to interpret. */
|
|
27
|
+
export interface RunReport {
|
|
28
|
+
title: string;
|
|
29
|
+
generatedAt: string;
|
|
30
|
+
state: AgentState;
|
|
31
|
+
/** sha256 → content, deduped by address exactly as in a `RunBundle` */
|
|
32
|
+
blobs: Record<string, string>;
|
|
33
|
+
/** addresses whose content was cut to `maxBlobBytes` */
|
|
34
|
+
truncated: string[];
|
|
35
|
+
/**
|
|
36
|
+
* Base64 `data:` uris lifted out of the state and the payloads above,
|
|
37
|
+
* both of which now refer to them as `media:<index>`. A conversation
|
|
38
|
+
* re-sends its images with every turn, so a run with five model calls
|
|
39
|
+
* would otherwise inline the same megabyte six times — and each recorded
|
|
40
|
+
* request would blow past `maxBlobBytes`, arriving cut mid-string and
|
|
41
|
+
* unparseable. Blob content therefore no longer hashes to the address it
|
|
42
|
+
* is filed under: a report is a thing to read, not a bundle to restore.
|
|
43
|
+
*/
|
|
44
|
+
media: string[];
|
|
45
|
+
/** the declared wiring, when the caller had a runner to ask */
|
|
46
|
+
architecture?: Architecture;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Resolves a state into a self-describing report. Separate from rendering so a
|
|
50
|
+
* caller can ship the JSON somewhere else (a service, a test fixture) instead
|
|
51
|
+
* of the page.
|
|
52
|
+
*/
|
|
53
|
+
export declare function buildRunReport(state: AgentState, payloads: PayloadResolver, opts?: ReportOptions): Promise<RunReport>;
|
|
54
|
+
//# sourceMappingURL=report.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { collectPayloads } from "../payload.js";
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// Run inspector — a single HTML file that explains a run
|
|
4
|
+
//
|
|
5
|
+
// A state is a graph of references, which makes it cheap to store and useless
|
|
6
|
+
// to read. This module does the inverse of the storage design: it resolves
|
|
7
|
+
// every payload a run points at and inlines the whole thing into one page, so
|
|
8
|
+
// debugging needs no server, no store credentials and no live process — just a
|
|
9
|
+
// file you can open, attach to a bug report or diff against yesterday's run.
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
/** Default per-payload inline cap. Keeps one runaway tool result from turning
|
|
12
|
+
* a report into a file no editor will open. */
|
|
13
|
+
export const MAX_BLOB_BYTES = 512 * 1024;
|
|
14
|
+
export const MERMAID_URL = 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
|
|
15
|
+
/** Base64 data uris only: the charset ends at the closing JSON quote. */
|
|
16
|
+
const DATA_URL = /data:[\w.+-]+\/[\w.+-]+;base64,[A-Za-z0-9+/=]+/g;
|
|
17
|
+
/** Below this a uri is cheaper to leave in place than to indirect through. */
|
|
18
|
+
const MIN_HOIST = 2048;
|
|
19
|
+
function hoistMedia(text, media) {
|
|
20
|
+
return text.replace(DATA_URL, (url) => {
|
|
21
|
+
if (url.length < MIN_HOIST)
|
|
22
|
+
return url;
|
|
23
|
+
const at = media.indexOf(url);
|
|
24
|
+
return `media:${at < 0 ? media.push(url) - 1 : at}`;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Resolves a state into a self-describing report. Separate from rendering so a
|
|
29
|
+
* caller can ship the JSON somewhere else (a service, a test fixture) instead
|
|
30
|
+
* of the page.
|
|
31
|
+
*/
|
|
32
|
+
export async function buildRunReport(state, payloads, opts = {}) {
|
|
33
|
+
const limit = opts.maxBlobBytes ?? MAX_BLOB_BYTES;
|
|
34
|
+
const refs = collectPayloads(state);
|
|
35
|
+
const values = await payloads.getMany(refs);
|
|
36
|
+
const blobs = {};
|
|
37
|
+
const truncated = [];
|
|
38
|
+
const media = [];
|
|
39
|
+
for (const ref of refs) {
|
|
40
|
+
const value = hoistMedia(values.get(ref.sha256) ?? '', media);
|
|
41
|
+
if (value.length > limit) {
|
|
42
|
+
blobs[ref.sha256] = value.slice(0, limit);
|
|
43
|
+
truncated.push(ref.sha256);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
blobs[ref.sha256] = value;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
title: opts.title ?? `Run ${state.runId}`,
|
|
51
|
+
generatedAt: new Date().toISOString(),
|
|
52
|
+
// The user input carries the same image the requests do. Putting the
|
|
53
|
+
// whole state through the same table is the difference between one
|
|
54
|
+
// copy of a photo in the file and one copy per turn.
|
|
55
|
+
state: JSON.parse(hoistMedia(JSON.stringify(state), media)),
|
|
56
|
+
blobs,
|
|
57
|
+
truncated,
|
|
58
|
+
media,
|
|
59
|
+
architecture: opts.architecture,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=report.js.map
|
package/dist/kernel.d.ts
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Agent, AgentRegistry } from './agent.ts';
|
|
3
|
+
import type { PendingToolCall } from './events.ts';
|
|
4
|
+
import { type IdClock } from './ids.ts';
|
|
5
|
+
import { type MemoryOpSpec, type MemoryRecallSpec } from './memory.ts';
|
|
6
|
+
import type { ModelRequest, ModelResponse } from './model.ts';
|
|
7
|
+
import type { Services } from './services.ts';
|
|
8
|
+
import { type Skill } from './skills.ts';
|
|
9
|
+
import type { AgentState } from './state.ts';
|
|
10
|
+
import { type CompactionNode, type FinalOutputNode, type UserInputNode } from './trajectory.ts';
|
|
11
|
+
import { type AnyTool, type Input, type TokenUsage, type ToolOutcome } from './types.ts';
|
|
12
|
+
/**
|
|
13
|
+
* The kernel is a module of plain functions: it holds no state and no
|
|
14
|
+
* configuration, so there is nothing to instantiate and nothing hidden. All
|
|
15
|
+
* nondeterminism (ids, clock) and all I/O (payloads, memory, skills) enter
|
|
16
|
+
* through the explicit `KernelEnv` argument, which is what makes the same code
|
|
17
|
+
* usable inside a replay-based workflow engine.
|
|
18
|
+
*
|
|
19
|
+
* Deviation from the spec worth knowing: several `apply*` and `createState` are
|
|
20
|
+
* async, because offloading a value to the `PayloadStore` is I/O. Nothing else
|
|
21
|
+
* in the kernel touches the outside world.
|
|
22
|
+
*/
|
|
23
|
+
export interface KernelEnv {
|
|
24
|
+
services: Services;
|
|
25
|
+
/** Zod schema of a typed run; must match `state.spec.outputSchemaHash`. */
|
|
26
|
+
output?: z.ZodType;
|
|
27
|
+
clock?: IdClock;
|
|
28
|
+
}
|
|
29
|
+
export interface CreateStateOptions<T = string, TCtx = unknown> {
|
|
30
|
+
/** default: a fresh ulid */
|
|
31
|
+
runId?: string;
|
|
32
|
+
/** starting agent name */
|
|
33
|
+
agent: string;
|
|
34
|
+
input?: Input;
|
|
35
|
+
/** app context — must be JSON-serializable */
|
|
36
|
+
context?: TCtx;
|
|
37
|
+
/** typed-result request: the source of both `T` and validation */
|
|
38
|
+
output?: z.ZodType<T>;
|
|
39
|
+
/** pre-rendered; otherwise rendered on the first step */
|
|
40
|
+
systemPrompt?: string;
|
|
41
|
+
maxForkDepth?: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The only way to obtain a state. Starting a run is explicit; the loop then
|
|
45
|
+
* only ever *advances* an existing state.
|
|
46
|
+
*/
|
|
47
|
+
export declare function createState<T = string, TCtx = unknown>(opts: CreateStateOptions<T, TCtx>, env: KernelEnv): Promise<AgentState>;
|
|
48
|
+
/** A persisted run must not silently change its contract on resume. */
|
|
49
|
+
export declare function checkOutputSchema(state: AgentState, env: KernelEnv): void;
|
|
50
|
+
export interface BranchPlan {
|
|
51
|
+
name: string;
|
|
52
|
+
agent: string;
|
|
53
|
+
childRunId: string;
|
|
54
|
+
}
|
|
55
|
+
export type NextAction = {
|
|
56
|
+
kind: 'llm';
|
|
57
|
+
} | {
|
|
58
|
+
kind: 'tools';
|
|
59
|
+
calls: PendingToolCall[];
|
|
60
|
+
} | {
|
|
61
|
+
kind: 'fork';
|
|
62
|
+
forkId: string;
|
|
63
|
+
branches: BranchPlan[];
|
|
64
|
+
} | {
|
|
65
|
+
kind: 'done';
|
|
66
|
+
output: FinalOutputNode;
|
|
67
|
+
};
|
|
68
|
+
/** Pure inspection: what must happen next. No I/O, no payload resolution. */
|
|
69
|
+
export declare function nextAction(state: AgentState): NextAction;
|
|
70
|
+
/**
|
|
71
|
+
* tools(state) = agent tools + handoffs + memory + skills + fork +
|
|
72
|
+
* final_output. Computed from the state so a rehydrated run offers exactly the
|
|
73
|
+
* tools it had before the crash.
|
|
74
|
+
*
|
|
75
|
+
* Skill-owned tools are declared here whether or not their skill is active: the
|
|
76
|
+
* gate `lockedSkillTools` installs reads the trajectory when the tool is called,
|
|
77
|
+
* not when it is declared, so the array the model is sent never mutates
|
|
78
|
+
* mid-conversation and the provider's prompt cache survives a `skill_load`.
|
|
79
|
+
*/
|
|
80
|
+
export declare function resolveTools<TCtx>(state: AgentState, reg: AgentRegistry<TCtx>, env: KernelEnv): Promise<AnyTool<TCtx>[]>;
|
|
81
|
+
/**
|
|
82
|
+
* Projection + tool schemas + system prompt for the active agent. The only
|
|
83
|
+
* place in the kernel that dereferences payloads — everything else works on
|
|
84
|
+
* refs alone.
|
|
85
|
+
*
|
|
86
|
+
* Nothing is appended to the system prompt here: what the model reads is
|
|
87
|
+
* exactly the `system_prompt` node `applySystemPrompt` recorded, which is what
|
|
88
|
+
* makes `requestDigest` a meaningful replay check for the prompt.
|
|
89
|
+
*/
|
|
90
|
+
export declare function buildRequest<TCtx>(state: AgentState, reg: AgentRegistry<TCtx>, env: KernelEnv): Promise<ModelRequest>;
|
|
91
|
+
/** Stable fingerprint of a request, for replay divergence detection. */
|
|
92
|
+
export declare function requestDigest(req: ModelRequest): string;
|
|
93
|
+
/**
|
|
94
|
+
* A request as it goes onto an `llm_call` node: everything that shaped the
|
|
95
|
+
* call, minus the `signal`, which is machinery rather than content and is not
|
|
96
|
+
* JSON anyway. Pretty-printed, since the whole point of keeping it is that a
|
|
97
|
+
* human reads it later.
|
|
98
|
+
*/
|
|
99
|
+
export declare function serializeRequest(req: ModelRequest): string;
|
|
100
|
+
export declare function applyUserInput(state: AgentState, input: Input, env: KernelEnv, synthetic?: boolean): Promise<AgentState>;
|
|
101
|
+
/**
|
|
102
|
+
* Renders the active agent's instructions into the trajectory. Idempotent: a
|
|
103
|
+
* matching prompt already in force produces no node, so re-entering the loop
|
|
104
|
+
* (or resuming) does not litter the history.
|
|
105
|
+
*
|
|
106
|
+
* The rendered bytes are the identity. Two compositions that render the same
|
|
107
|
+
* string *are* the same prompt to the model, the provider cache and replay, so
|
|
108
|
+
* there is nothing else to hash and no renderer version to pin: a change that
|
|
109
|
+
* matters changes the bytes, and one that does not, does not.
|
|
110
|
+
*/
|
|
111
|
+
export declare function applySystemPrompt<TCtx>(state: AgentState, reg: AgentRegistry<TCtx>, env: KernelEnv): Promise<AgentState>;
|
|
112
|
+
/** What the driver knows about a model call that the response itself omits. */
|
|
113
|
+
export interface LlmCallOptions<TCtx = unknown> {
|
|
114
|
+
/** stable fingerprint of the request, for replay divergence detection */
|
|
115
|
+
digest?: string;
|
|
116
|
+
/** the request as sent; stored as a payload on the node when given */
|
|
117
|
+
request?: ModelRequest;
|
|
118
|
+
/** needed to validate a `fork` call against the agent's declaration */
|
|
119
|
+
registry?: AgentRegistry<TCtx>;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Appends the `llm_call` node (plus the nodes its tool calls imply) and moves
|
|
123
|
+
* the phase on. Typed runs are resolved here too: `final_output` never reaches
|
|
124
|
+
* tool execution, it is validated against the run's schema on the spot.
|
|
125
|
+
*/
|
|
126
|
+
export declare function applyLlmResponse<TCtx>(state: AgentState, res: ModelResponse, model: string, env: KernelEnv, opts?: LlmCallOptions<TCtx>): Promise<AgentState>;
|
|
127
|
+
/**
|
|
128
|
+
* Appends the tool result, folds in whatever the tool did to memory or skills,
|
|
129
|
+
* and performs a hand-off when the call was a `transfer_to_*`.
|
|
130
|
+
*/
|
|
131
|
+
export declare function applyToolResult(state: AgentState, callId: string, outcome: ToolOutcome, env: KernelEnv): Promise<AgentState>;
|
|
132
|
+
/** Records a memory recall or mutation performed by the driver. */
|
|
133
|
+
export declare function applyMemoryEffect(state: AgentState, effect: MemoryRecallSpec | MemoryOpSpec, env: KernelEnv): Promise<AgentState>;
|
|
134
|
+
/** Records a skill activation and the tools it unlocked. */
|
|
135
|
+
export declare function applySkillLoad(state: AgentState, provider: string, skills: Skill[], env: KernelEnv): Promise<AgentState>;
|
|
136
|
+
export interface CompactionSpec {
|
|
137
|
+
/** ids of the nodes this summary replaces; need not be contiguous */
|
|
138
|
+
covers: string[];
|
|
139
|
+
summary: string;
|
|
140
|
+
reason: CompactionNode['reason'];
|
|
141
|
+
/** the model's call id when it compacted itself; synthesized otherwise */
|
|
142
|
+
callId?: string;
|
|
143
|
+
/** tokens the summarizer burned */
|
|
144
|
+
usage?: TokenUsage;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Containment, not deletion: the covered nodes stay in the trajectory for audit
|
|
148
|
+
* and replay, and only the projection skips them. The log stays append-only.
|
|
149
|
+
*/
|
|
150
|
+
export declare function applyCompaction(state: AgentState, spec: CompactionSpec, env: KernelEnv): Promise<AgentState>;
|
|
151
|
+
export declare function applyFailure(state: AgentState, error: string): AgentState;
|
|
152
|
+
/**
|
|
153
|
+
* Derives a child state seeded with *real nodes* copied from the parent, not a
|
|
154
|
+
* frozen `Message[]` blob: the branch can compact its own inherited context,
|
|
155
|
+
* and at join those nodes splice back into one trajectory. The copy is a
|
|
156
|
+
* snapshot, so the branch can execute in another process.
|
|
157
|
+
*/
|
|
158
|
+
export declare function createChildState(state: AgentState, forkId: string, branch: string, env: KernelEnv): Promise<AgentState>;
|
|
159
|
+
export interface BranchResult {
|
|
160
|
+
name: string;
|
|
161
|
+
status: 'ok' | 'error' | 'aborted';
|
|
162
|
+
/** what the parent sees for this branch — already summarized by the policy */
|
|
163
|
+
output: string;
|
|
164
|
+
error?: string;
|
|
165
|
+
usage: TokenUsage;
|
|
166
|
+
childRunId: string;
|
|
167
|
+
childState: AgentState;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Folds branches back into the parent. Each branch's history is nested inside
|
|
171
|
+
* its row of the join, in *declared* branch order — so the result is identical
|
|
172
|
+
* regardless of completion order, and a walk of the parent array never trips
|
|
173
|
+
* over someone else's nodes.
|
|
174
|
+
*/
|
|
175
|
+
export declare function applyJoin(state: AgentState, forkId: string, results: BranchResult[], env: KernelEnv): Promise<AgentState>;
|
|
176
|
+
export declare function lastUserInput(state: AgentState): UserInputNode | undefined;
|
|
177
|
+
export { Agent, AgentRegistry };
|
|
178
|
+
//# sourceMappingURL=kernel.d.ts.map
|