@tangle-network/agent-runtime 0.104.0 → 0.106.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/README.md +176 -42
- package/dist/activation-CRjVfOiy.js +203 -0
- package/dist/activation-CRjVfOiy.js.map +1 -0
- package/dist/activation-DyWB0K6E.d.ts +98 -0
- package/dist/agent.d.ts +216 -234
- package/dist/agent.js +615 -547
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop-DGdtVENg.js +517 -0
- package/dist/analyst-loop-DGdtVENg.js.map +1 -0
- package/dist/analyst-loop.d.ts +10 -43
- package/dist/analyst-loop.js +2 -11
- package/dist/backends-Dy8NujB4.js +713 -0
- package/dist/backends-Dy8NujB4.js.map +1 -0
- package/dist/candidate-execution/index.d.ts +4 -192
- package/dist/candidate-execution/index.js +5 -66
- package/dist/candidate-execution-DqMbv1rU.js +488 -0
- package/dist/candidate-execution-DqMbv1rU.js.map +1 -0
- package/dist/coder-yhVWbdWc.js +40 -0
- package/dist/coder-yhVWbdWc.js.map +1 -0
- package/dist/conversation-XucG_K3l.js +1265 -0
- package/dist/conversation-XucG_K3l.js.map +1 -0
- package/dist/conversation.d.ts +2 -804
- package/dist/conversation.js +2 -55
- package/dist/environment-provider-CfLUmKmf.js +1168 -0
- package/dist/environment-provider-CfLUmKmf.js.map +1 -0
- package/dist/environment-provider-IUGU3epE.d.ts +964 -0
- package/dist/environment-provider.d.ts +2 -78
- package/dist/environment-provider.js +2 -18
- package/dist/errors-DEAvWQPy.js +111 -0
- package/dist/errors-DEAvWQPy.js.map +1 -0
- package/dist/improvement-adapter-Cr5TBSji.d.ts +166 -0
- package/dist/improvement-cycle-C095kS_g.js +2624 -0
- package/dist/improvement-cycle-C095kS_g.js.map +1 -0
- package/dist/index-BGdxAwfO.d.ts +838 -0
- package/dist/index-C-FYUuFG.d.ts +193 -0
- package/dist/index-CbNM40xG.d.ts +140 -0
- package/dist/index-DruSKs3Z.d.ts +7224 -0
- package/dist/index-Efjb3nrQ.d.ts +671 -0
- package/dist/index.d.ts +14 -1134
- package/dist/index.js +2134 -1972
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +776 -888
- package/dist/intelligence.js +1466 -1410
- package/dist/intelligence.js.map +1 -1
- package/dist/{kb-gate-CwHO0vz6.d.ts → kb-gate-C8z2juK8.d.ts} +33 -31
- package/dist/kb-gate-DpaSwXVx.js +80 -0
- package/dist/kb-gate-DpaSwXVx.js.map +1 -0
- package/dist/knowledge-Ku-mPP4f.js +433 -0
- package/dist/knowledge-Ku-mPP4f.js.map +1 -0
- package/dist/knowledge.d.ts +2 -150
- package/dist/knowledge.js +2 -40
- package/dist/local-harness-Dh8PJ0ot.d.ts +455 -0
- package/dist/loop-runner-bin-BXsFEUcf.d.ts +162 -0
- package/dist/loop-runner-bin-BwjQ1NfH.js +268 -0
- package/dist/loop-runner-bin-BwjQ1NfH.js.map +1 -0
- package/dist/loop-runner-bin.d.ts +2 -17
- package/dist/loop-runner-bin.js +2 -24
- package/dist/loops.d.ts +5 -4164
- package/dist/loops.js +8 -419
- package/dist/mcp/bin.d.ts +1 -1
- package/dist/mcp/bin.js +116 -146
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +295 -437
- package/dist/mcp/index.js +1242 -1177
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/memory-bin.d.ts +1 -1
- package/dist/mcp/memory-bin.js +37 -16
- package/dist/mcp/memory-bin.js.map +1 -1
- package/dist/memory-server-DL6cE2Ag.js +234 -0
- package/dist/memory-server-DL6cE2Ag.js.map +1 -0
- package/dist/model-resolution-Btd9iIKV.js +98 -0
- package/dist/model-resolution-Btd9iIKV.js.map +1 -0
- package/dist/openai-tools-B68JaOCx.d.ts +24 -0
- package/dist/openai-tools-CKLy1C7M.js +44 -0
- package/dist/openai-tools-CKLy1C7M.js.map +1 -0
- package/dist/otel-export-D34IQW1C.js +843 -0
- package/dist/otel-export-D34IQW1C.js.map +1 -0
- package/dist/platform.d.ts +188 -185
- package/dist/platform.js +185 -218
- package/dist/platform.js.map +1 -1
- package/dist/prepare-B53sPV7M.js +4292 -0
- package/dist/prepare-B53sPV7M.js.map +1 -0
- package/dist/primeintellect/index.d.ts +150 -147
- package/dist/primeintellect/index.js +626 -1004
- package/dist/primeintellect/index.js.map +1 -1
- package/dist/profiles.d.ts +296 -490
- package/dist/profiles.js +722 -749
- package/dist/profiles.js.map +1 -1
- package/dist/protected-model-port-BLPH5VVv.js +722 -0
- package/dist/protected-model-port-BLPH5VVv.js.map +1 -0
- package/dist/protected-model-port-BP6Z4eau.d.ts +283 -0
- package/dist/protected-redaction--F3v1oo8.js +200 -0
- package/dist/protected-redaction--F3v1oo8.js.map +1 -0
- package/dist/redact-D-u-rrcn.js +82 -0
- package/dist/redact-D-u-rrcn.js.map +1 -0
- package/dist/redact-kbIOjfjM.d.ts +452 -0
- package/dist/researcher-CoVqNhfI.js +433 -0
- package/dist/researcher-CoVqNhfI.js.map +1 -0
- package/dist/runtime-BG0BziaP.js +5408 -0
- package/dist/runtime-BG0BziaP.js.map +1 -0
- package/dist/sandbox-events-DeI5xX8P.js +316 -0
- package/dist/sandbox-events-DeI5xX8P.js.map +1 -0
- package/dist/spawn-journal-CwPvKUTa.js +456 -0
- package/dist/spawn-journal-CwPvKUTa.js.map +1 -0
- package/dist/structural-rollout-IXUEplky.js +1445 -0
- package/dist/structural-rollout-IXUEplky.js.map +1 -0
- package/dist/substrate-B0TYNrXn.js +27 -0
- package/dist/substrate-B0TYNrXn.js.map +1 -0
- package/dist/{substrate-Dyiqmd3o.d.ts → substrate-BcnuSHXm.d.ts} +57 -54
- package/dist/supervise-BiRutHS9.js +7321 -0
- package/dist/supervise-BiRutHS9.js.map +1 -0
- package/dist/supervisor-DTKhF-RV.js +3826 -0
- package/dist/supervisor-DTKhF-RV.js.map +1 -0
- package/dist/testing.d.ts +4 -3
- package/dist/testing.js +2478 -2637
- package/dist/testing.js.map +1 -1
- package/dist/tool-server-RcWgLIsL.js +141 -0
- package/dist/tool-server-RcWgLIsL.js.map +1 -0
- package/dist/trace-propagation-CJJC7SVB.js +57 -0
- package/dist/trace-propagation-CJJC7SVB.js.map +1 -0
- package/dist/types-BaIpb0XT.d.ts +492 -0
- package/dist/types-BevOjfTY.d.ts +765 -0
- package/dist/types-C9j4qg6l.d.ts +500 -0
- package/dist/types-Cja5OTGh.d.ts +190 -0
- package/dist/util-MVgdwuIS.js +145 -0
- package/dist/util-MVgdwuIS.js.map +1 -0
- package/dist/workspace-archive-BosQiotA.js +575 -0
- package/dist/workspace-archive-BosQiotA.js.map +1 -0
- package/package.json +43 -55
- package/skills/build-with-agent-runtime/SKILL.md +16 -9
- package/skills/loop-writer/SKILL.md +1 -1
- package/dist/activation-Cm-9MMX1.d.ts +0 -69
- package/dist/analyst-loop.js.map +0 -1
- package/dist/backends-BO4Jqoe2.d.ts +0 -134
- package/dist/candidate-execution/index.js.map +0 -1
- package/dist/chunk-2KGAN2HM.js +0 -1256
- package/dist/chunk-2KGAN2HM.js.map +0 -1
- package/dist/chunk-2QJSNOGK.js +0 -48
- package/dist/chunk-2QJSNOGK.js.map +0 -1
- package/dist/chunk-2UABGGUB.js +0 -474
- package/dist/chunk-2UABGGUB.js.map +0 -1
- package/dist/chunk-2VZYRB55.js +0 -834
- package/dist/chunk-2VZYRB55.js.map +0 -1
- package/dist/chunk-2X65HYMI.js +0 -3526
- package/dist/chunk-2X65HYMI.js.map +0 -1
- package/dist/chunk-3MDZX7YU.js +0 -125
- package/dist/chunk-3MDZX7YU.js.map +0 -1
- package/dist/chunk-3PPVCS75.js +0 -199
- package/dist/chunk-3PPVCS75.js.map +0 -1
- package/dist/chunk-5HNDYWUT.js +0 -6424
- package/dist/chunk-5HNDYWUT.js.map +0 -1
- package/dist/chunk-5IBQAPVB.js +0 -29
- package/dist/chunk-5IBQAPVB.js.map +0 -1
- package/dist/chunk-5QOB7H74.js +0 -387
- package/dist/chunk-5QOB7H74.js.map +0 -1
- package/dist/chunk-ATDFUJYI.js +0 -4728
- package/dist/chunk-ATDFUJYI.js.map +0 -1
- package/dist/chunk-B7K7V22Y.js +0 -699
- package/dist/chunk-B7K7V22Y.js.map +0 -1
- package/dist/chunk-DPEUKJRO.js +0 -27
- package/dist/chunk-DPEUKJRO.js.map +0 -1
- package/dist/chunk-FD2MBMOH.js +0 -494
- package/dist/chunk-FD2MBMOH.js.map +0 -1
- package/dist/chunk-FJI3EXU3.js +0 -2402
- package/dist/chunk-FJI3EXU3.js.map +0 -1
- package/dist/chunk-HAO4CXHP.js +0 -200
- package/dist/chunk-HAO4CXHP.js.map +0 -1
- package/dist/chunk-ISPWRSEC.js +0 -408
- package/dist/chunk-ISPWRSEC.js.map +0 -1
- package/dist/chunk-KRBFHMV6.js +0 -1228
- package/dist/chunk-KRBFHMV6.js.map +0 -1
- package/dist/chunk-L5DST3QC.js +0 -351
- package/dist/chunk-L5DST3QC.js.map +0 -1
- package/dist/chunk-M22PL4GH.js +0 -171
- package/dist/chunk-M22PL4GH.js.map +0 -1
- package/dist/chunk-NURIQBJQ.js +0 -72
- package/dist/chunk-NURIQBJQ.js.map +0 -1
- package/dist/chunk-PZZKQVQV.js +0 -52
- package/dist/chunk-PZZKQVQV.js.map +0 -1
- package/dist/chunk-Q2JSAVQ3.js +0 -671
- package/dist/chunk-Q2JSAVQ3.js.map +0 -1
- package/dist/chunk-SBTWKPVR.js +0 -5576
- package/dist/chunk-SBTWKPVR.js.map +0 -1
- package/dist/chunk-SGKPNBXE.js +0 -60
- package/dist/chunk-SGKPNBXE.js.map +0 -1
- package/dist/chunk-SNSMRT6H.js +0 -680
- package/dist/chunk-SNSMRT6H.js.map +0 -1
- package/dist/chunk-STJEHM5F.js +0 -1338
- package/dist/chunk-STJEHM5F.js.map +0 -1
- package/dist/chunk-UPWGXKXB.js +0 -254
- package/dist/chunk-UPWGXKXB.js.map +0 -1
- package/dist/chunk-YEJR7IXO.js +0 -68
- package/dist/chunk-YEJR7IXO.js.map +0 -1
- package/dist/chunk-ZXICDSAK.js +0 -907
- package/dist/chunk-ZXICDSAK.js.map +0 -1
- package/dist/completion-gate-Bv47cOnn.d.ts +0 -256
- package/dist/conversation.js.map +0 -1
- package/dist/coordination-CxtzMxSM.d.ts +0 -2570
- package/dist/environment-provider.js.map +0 -1
- package/dist/improve--2A0gK1-.d.ts +0 -440
- package/dist/improvement-adapter-HAZz-7vK.d.ts +0 -203
- package/dist/knowledge.js.map +0 -1
- package/dist/local-harness-CtK9dSny.d.ts +0 -175
- package/dist/loop-runner-bin-DUOGtvOl.d.ts +0 -207
- package/dist/loop-runner-bin.js.map +0 -1
- package/dist/loops.js.map +0 -1
- package/dist/openai-tools-fnj6SRVg.d.ts +0 -46
- package/dist/protected-model-port-DzkUY3HQ.d.ts +0 -271
- package/dist/sanitize-DEbPNtyI.d.ts +0 -328
- package/dist/structural-rollout-C4mabf87.d.ts +0 -446
- package/dist/supervise-7q9F5brx.d.ts +0 -379
- package/dist/types-BCoemcXU.d.ts +0 -802
- package/dist/types-BwoZWq-i.d.ts +0 -510
- package/dist/types-Cbp72qyu.d.ts +0 -491
- package/dist/types-CmYCMbFT.d.ts +0 -203
- package/dist/types-CvNwMzQt.d.ts +0 -957
- package/dist/worktree-fanout-WsOzt8qu.d.ts +0 -999
package/dist/profiles.d.ts
CHANGED
|
@@ -1,47 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { AgentProfile
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import '@tangle-network/agent-eval';
|
|
7
|
-
import './types-BwoZWq-i.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
* UI-audit issue writer — pure I/O. Takes a workspace dir + `UiFinding[]`
|
|
12
|
-
* and emits:
|
|
13
|
-
* - `<workspace>/issues/NNN--<lens>--<slug>.md` — one self-contained
|
|
14
|
-
* GitHub-issue-ready Markdown per finding, with embedded screenshot
|
|
15
|
-
* references.
|
|
16
|
-
* - `<workspace>/registry.json` — finding index for dedup and audit
|
|
17
|
-
* resume across iterations.
|
|
18
|
-
* - `<workspace>/index.md` — human-readable rollup (severity / lens /
|
|
19
|
-
* route counts plus a sorted finding list).
|
|
20
|
-
*
|
|
21
|
-
* The writer is deterministic, idempotent for `appendFindings()`, and
|
|
22
|
-
* never invokes an LLM. It assigns the next monotonic id to a finding the
|
|
23
|
-
* caller did not pre-id.
|
|
24
|
-
*
|
|
25
|
-
* @experimental
|
|
26
|
-
*/
|
|
27
|
-
|
|
1
|
+
import { E as SandboxClient, k as Validator, r as Driver, t as AgentRunSpec, w as OutputAdapter } from "./types-BevOjfTY.js";
|
|
2
|
+
import { a as UiFindingSeverity, c as coderTaskToPrompt, i as UiFindingScreenshot, n as UI_LENSES, o as UiLens, r as UiFinding, s as CoderTask, t as UI_FINDING_SEVERITIES } from "./substrate-BcnuSHXm.js";
|
|
3
|
+
import { AgentProfile } from "@tangle-network/agent-interface";
|
|
4
|
+
import { SandboxEvent } from "@tangle-network/sandbox";
|
|
5
|
+
//#region src/audit/issue-writer.d.ts
|
|
28
6
|
/** @experimental */
|
|
29
7
|
interface AuditRegistry {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
8
|
+
schemaVersion: 1;
|
|
9
|
+
findings: UiFinding[];
|
|
10
|
+
/** Route → URL + captures sidecar; preserved across runs. */
|
|
11
|
+
routes: Record<string, {
|
|
12
|
+
url?: string;
|
|
13
|
+
captures: AuditRegistryCapture[];
|
|
14
|
+
}>;
|
|
37
15
|
}
|
|
38
16
|
/** @experimental */
|
|
39
17
|
interface AuditRegistryCapture {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
18
|
+
file: string;
|
|
19
|
+
viewport?: string;
|
|
20
|
+
fullPage?: boolean;
|
|
21
|
+
elementSelector?: string;
|
|
22
|
+
capturedAt: string;
|
|
45
23
|
}
|
|
46
24
|
/** Create the `issues/`, `screenshots/`, and `registry.json` scaffold in a new audit workspace. @experimental */
|
|
47
25
|
declare function initAuditWorkspace(workspaceDir: string): Promise<void>;
|
|
@@ -49,10 +27,10 @@ declare function initAuditWorkspace(workspaceDir: string): Promise<void>;
|
|
|
49
27
|
declare function readAuditRegistry(workspaceDir: string): Promise<AuditRegistry>;
|
|
50
28
|
/** @experimental */
|
|
51
29
|
interface AppendFindingsResult {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
30
|
+
/** Findings with id + createdAt assigned, in input order. */
|
|
31
|
+
written: UiFinding[];
|
|
32
|
+
/** Workspace-relative path to each issue Markdown file, in input order. */
|
|
33
|
+
files: string[];
|
|
56
34
|
}
|
|
57
35
|
/**
|
|
58
36
|
* Append findings to a workspace, writing one Markdown file per finding
|
|
@@ -68,9 +46,9 @@ interface AppendFindingsResult {
|
|
|
68
46
|
declare function appendFindings(workspaceDir: string, findings: readonly UiFinding[]): Promise<AppendFindingsResult>;
|
|
69
47
|
/** @experimental */
|
|
70
48
|
interface RegisterCapturesOptions {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
49
|
+
route: string;
|
|
50
|
+
url?: string;
|
|
51
|
+
captures: readonly AuditRegistryCapture[];
|
|
74
52
|
}
|
|
75
53
|
/**
|
|
76
54
|
* Record screenshots taken for a route in the registry, without filing a
|
|
@@ -82,11 +60,11 @@ interface RegisterCapturesOptions {
|
|
|
82
60
|
declare function registerCaptures(workspaceDir: string, options: RegisterCapturesOptions): Promise<void>;
|
|
83
61
|
/** @experimental */
|
|
84
62
|
interface AuditIndex {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
63
|
+
/** Total findings in the workspace. */
|
|
64
|
+
total: number;
|
|
65
|
+
bySeverity: Record<UiFinding['severity'], number>;
|
|
66
|
+
byLens: Partial<Record<UiLens, number>>;
|
|
67
|
+
byRoute: Record<string, number>;
|
|
90
68
|
}
|
|
91
69
|
/** Compute finding counts by severity, lens, and route from an `AuditRegistry`. @experimental */
|
|
92
70
|
declare function summarizeRegistry(reg: AuditRegistry): AuditIndex;
|
|
@@ -96,50 +74,26 @@ declare function summarizeRegistry(reg: AuditRegistry): AuditIndex;
|
|
|
96
74
|
* @experimental
|
|
97
75
|
*/
|
|
98
76
|
declare function writeAuditIndex(workspaceDir: string): Promise<string>;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
* Opinionated preset for source-grounded research
|
|
102
|
-
* tasks. The agent is told to:
|
|
103
|
-
* - bound its work to a single `knowledgeNamespace`
|
|
104
|
-
* - emit `items[]` carrying provenance + confidence
|
|
105
|
-
* - emit `citations[]` linking quotes back to source urls
|
|
106
|
-
* - emit `proposedWrites[]` — never call materialize itself
|
|
107
|
-
* - describe `gaps` it could not answer
|
|
108
|
-
*
|
|
109
|
-
* The profile is stateless and agent-agnostic. `harness` selects the
|
|
110
|
-
* sandbox-SDK backend. For heterogeneous fanout, use
|
|
111
|
-
* `multiHarnessResearcherFanout`.
|
|
112
|
-
*
|
|
113
|
-
* Propose-don't-apply: the profile NEVER writes to the knowledge base.
|
|
114
|
-
* It produces `proposedWrites: KnowledgeUpdate[]` in the output. The
|
|
115
|
-
* caller (gtm-agent, journey-eval, user) decides whether to feed those
|
|
116
|
-
* updates through `applyKnowledgeWriteBlocks` / a KbStore put.
|
|
117
|
-
*
|
|
118
|
-
* Namespace isolation: every `KnowledgeItem` + `KnowledgeUpdate` in the
|
|
119
|
-
* output carries `namespace`. The validator hard-fails when any item
|
|
120
|
-
* touches a namespace other than `task.knowledgeNamespace`.
|
|
121
|
-
*
|
|
122
|
-
* @experimental
|
|
123
|
-
*/
|
|
124
|
-
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/profiles/researcher.d.ts
|
|
125
79
|
/** Source families a researcher profile may prefer for a task. @experimental */
|
|
126
80
|
type ResearchSource = 'web' | 'corpus' | 'twitter' | 'github' | 'docs';
|
|
127
81
|
/** Task contract for a source-grounded research agent. @experimental */
|
|
128
82
|
interface ResearchTask {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
83
|
+
/** The research question to answer. */
|
|
84
|
+
question: string;
|
|
85
|
+
/** Bound: e.g. "audience for cpg-founder ICP". */
|
|
86
|
+
scope?: string;
|
|
87
|
+
/** Multi-tenant scope (customer-id, workspace-id). Validator enforces. */
|
|
88
|
+
knowledgeNamespace: string;
|
|
89
|
+
sources?: ResearchSource[];
|
|
90
|
+
recencyWindow?: {
|
|
91
|
+
since?: Date;
|
|
92
|
+
until?: Date;
|
|
93
|
+
};
|
|
94
|
+
maxItems?: number;
|
|
95
|
+
/** Per-item minimum confidence in [0, 1]. Validator scores recall vs this. */
|
|
96
|
+
minConfidence?: number;
|
|
143
97
|
}
|
|
144
98
|
/**
|
|
145
99
|
* Knowledge item emitted by the researcher.
|
|
@@ -150,28 +104,28 @@ interface ResearchTask {
|
|
|
150
104
|
* @experimental
|
|
151
105
|
*/
|
|
152
106
|
interface KnowledgeItem {
|
|
107
|
+
id: string;
|
|
108
|
+
/** Multi-tenant scope. MUST equal `task.knowledgeNamespace`. */
|
|
109
|
+
namespace: string;
|
|
110
|
+
/** The factual claim, in the researcher's words. */
|
|
111
|
+
claim: string;
|
|
112
|
+
/** Provenance — at least one entry required. */
|
|
113
|
+
evidence: Array<{
|
|
114
|
+
source: string;
|
|
115
|
+
quote?: string;
|
|
116
|
+
url?: string;
|
|
117
|
+
capturedAt: number;
|
|
118
|
+
}>;
|
|
119
|
+
/** Researcher's self-reported confidence in [0, 1]. */
|
|
120
|
+
confidence: number;
|
|
121
|
+
/** Prior item ids this supersedes (chain). */
|
|
122
|
+
supersedes?: string[];
|
|
123
|
+
/** Set if the agent is retracting an earlier item. Unix ms. */
|
|
124
|
+
retractedAt?: number;
|
|
125
|
+
authoredBy: {
|
|
126
|
+
kind: 'human' | 'agent';
|
|
153
127
|
id: string;
|
|
154
|
-
|
|
155
|
-
namespace: string;
|
|
156
|
-
/** The factual claim, in the researcher's words. */
|
|
157
|
-
claim: string;
|
|
158
|
-
/** Provenance — at least one entry required. */
|
|
159
|
-
evidence: Array<{
|
|
160
|
-
source: string;
|
|
161
|
-
quote?: string;
|
|
162
|
-
url?: string;
|
|
163
|
-
capturedAt: number;
|
|
164
|
-
}>;
|
|
165
|
-
/** Researcher's self-reported confidence in [0, 1]. */
|
|
166
|
-
confidence: number;
|
|
167
|
-
/** Prior item ids this supersedes (chain). */
|
|
168
|
-
supersedes?: string[];
|
|
169
|
-
/** Set if the agent is retracting an earlier item. Unix ms. */
|
|
170
|
-
retractedAt?: number;
|
|
171
|
-
authoredBy: {
|
|
172
|
-
kind: 'human' | 'agent';
|
|
173
|
-
id: string;
|
|
174
|
-
};
|
|
128
|
+
};
|
|
175
129
|
}
|
|
176
130
|
/**
|
|
177
131
|
* A proposed write to the knowledge base. The profile does NOT apply
|
|
@@ -180,19 +134,19 @@ interface KnowledgeItem {
|
|
|
180
134
|
* @experimental
|
|
181
135
|
*/
|
|
182
136
|
type KnowledgeUpdate = {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
137
|
+
kind: 'insert';
|
|
138
|
+
namespace: string;
|
|
139
|
+
item: KnowledgeItem;
|
|
186
140
|
} | {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
141
|
+
kind: 'supersede';
|
|
142
|
+
namespace: string;
|
|
143
|
+
previousId: string;
|
|
144
|
+
item: KnowledgeItem;
|
|
191
145
|
} | {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
146
|
+
kind: 'retract';
|
|
147
|
+
namespace: string;
|
|
148
|
+
itemId: string;
|
|
149
|
+
reason: string;
|
|
196
150
|
};
|
|
197
151
|
/**
|
|
198
152
|
* Researcher output. Required fields are typed; optional fields preserve
|
|
@@ -202,54 +156,54 @@ type KnowledgeUpdate = {
|
|
|
202
156
|
* @experimental
|
|
203
157
|
*/
|
|
204
158
|
interface ResearchOutput {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
159
|
+
items: KnowledgeItem[];
|
|
160
|
+
citations: Array<{
|
|
161
|
+
url: string;
|
|
162
|
+
quote: string;
|
|
163
|
+
confidence: number;
|
|
164
|
+
}>;
|
|
165
|
+
proposedWrites: KnowledgeUpdate[];
|
|
166
|
+
gaps?: string[];
|
|
167
|
+
notes?: string;
|
|
168
|
+
/** Anything the agent emitted beyond the typed fields. */
|
|
169
|
+
raw?: unknown;
|
|
216
170
|
}
|
|
217
171
|
/** Options for the source-grounded researcher profile preset. @experimental */
|
|
218
172
|
interface ResearcherProfileOptions {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
173
|
+
/** Sandbox-SDK backend.type. Default `'opencode/zai-coding-plan/glm-5.1'`. */
|
|
174
|
+
harness?: string;
|
|
175
|
+
/** Default model id passed in `AgentProfile.model.default`. */
|
|
176
|
+
model?: string;
|
|
177
|
+
/** Custom system prompt replacement. Default = built-in researcher preset. */
|
|
178
|
+
systemPrompt?: string;
|
|
179
|
+
/** Stable name for `AgentRunSpec.name`. Default = `researcher-${harness}`. */
|
|
180
|
+
name?: string;
|
|
181
|
+
/**
|
|
182
|
+
* Default 0.7. Minimum (citations with quote) / items ratio for `valid=true`.
|
|
183
|
+
* Below this floor, citation_density scores < 1 and the item set is gated.
|
|
184
|
+
*/
|
|
185
|
+
citationDensityMin?: number;
|
|
232
186
|
}
|
|
233
187
|
/** Build a source-grounded researcher profile with output parsing and validation. @experimental */
|
|
234
188
|
declare function researcherProfile(options?: ResearcherProfileOptions & {
|
|
235
|
-
|
|
189
|
+
task?: ResearchTask;
|
|
236
190
|
}): {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
191
|
+
profile: AgentProfile;
|
|
192
|
+
taskToPrompt: (task: ResearchTask) => string;
|
|
193
|
+
output: OutputAdapter<ResearchOutput>;
|
|
194
|
+
validator: Validator<ResearchOutput>;
|
|
195
|
+
agentRunSpec: AgentRunSpec<ResearchTask>;
|
|
242
196
|
};
|
|
243
197
|
/** @experimental */
|
|
244
198
|
interface MultiHarnessResearcherFanoutOptions {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
199
|
+
/** Backend.type identifiers, one per parallel agent. */
|
|
200
|
+
harnesses?: string[];
|
|
201
|
+
/** Optional per-harness model override. Indexed parallel to `harnesses`. */
|
|
202
|
+
models?: (string | undefined)[];
|
|
203
|
+
/** Default citation density floor for the shared validator. */
|
|
204
|
+
citationDensityMin?: number;
|
|
205
|
+
/** Optional task — narrows the validator's namespace check. */
|
|
206
|
+
task?: ResearchTask;
|
|
253
207
|
}
|
|
254
208
|
/**
|
|
255
209
|
* Build a fanout topology over multiple harnesses. The kernel round-robins
|
|
@@ -259,10 +213,10 @@ interface MultiHarnessResearcherFanoutOptions {
|
|
|
259
213
|
* @experimental
|
|
260
214
|
*/
|
|
261
215
|
declare function multiHarnessResearcherFanout(options?: MultiHarnessResearcherFanoutOptions): {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
216
|
+
agentRuns: AgentRunSpec<ResearchTask>[];
|
|
217
|
+
output: OutputAdapter<ResearchOutput>;
|
|
218
|
+
validator: Validator<ResearchOutput>;
|
|
219
|
+
driver: Driver<ResearchTask, ResearchOutput, 'done'>;
|
|
266
220
|
};
|
|
267
221
|
/**
|
|
268
222
|
* Build a validator that closes over a specific `ResearchTask`'s constraints.
|
|
@@ -284,49 +238,37 @@ declare function multiHarnessResearcherFanout(options?: MultiHarnessResearcherFa
|
|
|
284
238
|
* @experimental
|
|
285
239
|
*/
|
|
286
240
|
declare function createResearcherValidator(task: ResearchTask, config?: {
|
|
287
|
-
|
|
288
|
-
|
|
241
|
+
citationDensityMin?: number;
|
|
242
|
+
namespaceCheck?: boolean;
|
|
289
243
|
}): Validator<ResearchOutput>;
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
*
|
|
293
|
-
* UI auditor task + output shapes — what one iteration of the audit loop
|
|
294
|
-
* does and what it returns.
|
|
295
|
-
*
|
|
296
|
-
* An iteration is one (lens × route × viewport) audit pass. The driver
|
|
297
|
-
* decides which iterations to plan (lens-cycling, route-cycling,
|
|
298
|
-
* refine-on-low-yield, etc.); the iteration itself captures screenshots
|
|
299
|
-
* and asks a vision judge to identify findings under that lens.
|
|
300
|
-
*
|
|
301
|
-
* @experimental
|
|
302
|
-
*/
|
|
303
|
-
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region src/profiles/ui-auditor/task.d.ts
|
|
304
246
|
/** @experimental */
|
|
305
247
|
interface UiAuditViewport {
|
|
306
|
-
|
|
307
|
-
|
|
248
|
+
width: number;
|
|
249
|
+
height: number;
|
|
308
250
|
}
|
|
309
251
|
/** @experimental */
|
|
310
252
|
interface UiAuditCaptureRequest {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
253
|
+
/**
|
|
254
|
+
* Logical route name (e.g. `home`, `checkout-step-2`). Used in screenshot
|
|
255
|
+
* filenames and finding metadata.
|
|
256
|
+
*/
|
|
257
|
+
route: string;
|
|
258
|
+
/** Fully qualified URL the iteration audits. */
|
|
259
|
+
url: string;
|
|
260
|
+
/** Default `{ width: 1280, height: 800 }`. */
|
|
261
|
+
viewport?: UiAuditViewport;
|
|
262
|
+
/** Default `false`. */
|
|
263
|
+
fullPage?: boolean;
|
|
264
|
+
/** CSS selector to wait for before capturing. */
|
|
265
|
+
waitFor?: string;
|
|
266
|
+
/** Extra milliseconds to wait after navigation settles. Default `500`. */
|
|
267
|
+
waitMs?: number;
|
|
268
|
+
/** Optional CSS selector — capture only the matched element. */
|
|
269
|
+
elementSelector?: string;
|
|
270
|
+
/** Optional human-readable label appended to the screenshot filename. */
|
|
271
|
+
label?: string;
|
|
330
272
|
}
|
|
331
273
|
/**
|
|
332
274
|
* One iteration's task: audit a single (lens × route) pair, capturing the
|
|
@@ -339,34 +281,34 @@ interface UiAuditCaptureRequest {
|
|
|
339
281
|
* @experimental
|
|
340
282
|
*/
|
|
341
283
|
interface UiAuditTask {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
284
|
+
/** The audit lens that scopes which findings are valid this iteration. */
|
|
285
|
+
lens: UiLens;
|
|
286
|
+
/** Required captures. Order is preserved; index 0 is the primary frame. */
|
|
287
|
+
captures: readonly UiAuditCaptureRequest[];
|
|
288
|
+
/**
|
|
289
|
+
* Free-form context the consumer wants the judge to know about (product
|
|
290
|
+
* name, target audience, copy tone). Surfaced as a prompt prelude.
|
|
291
|
+
*/
|
|
292
|
+
productContext?: string;
|
|
293
|
+
/**
|
|
294
|
+
* IDs of findings already on file across earlier iterations. The judge
|
|
295
|
+
* uses these to mark cross-references via `similarTo` instead of filing
|
|
296
|
+
* pile-on duplicates.
|
|
297
|
+
*/
|
|
298
|
+
knownFindingIds?: readonly number[];
|
|
357
299
|
}
|
|
358
300
|
/** @experimental */
|
|
359
301
|
interface UiAuditCapture {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
302
|
+
/** Workspace-relative path to the screenshot file. */
|
|
303
|
+
path: string;
|
|
304
|
+
viewport: string;
|
|
305
|
+
fullPage: boolean;
|
|
306
|
+
elementSelector?: string;
|
|
307
|
+
label?: string;
|
|
308
|
+
route: string;
|
|
309
|
+
url: string;
|
|
310
|
+
/** Wall-clock when the capture completed. */
|
|
311
|
+
capturedAt: string;
|
|
370
312
|
}
|
|
371
313
|
/**
|
|
372
314
|
* Output of one iteration. `findings` is the headline payload; `captures`
|
|
@@ -376,194 +318,131 @@ interface UiAuditCapture {
|
|
|
376
318
|
* @experimental
|
|
377
319
|
*/
|
|
378
320
|
interface UiAuditOutput {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
321
|
+
lens: UiLens;
|
|
322
|
+
findings: UiFinding[];
|
|
323
|
+
captures: UiAuditCapture[];
|
|
324
|
+
/** Optional judge commentary (debug / triage aid). */
|
|
325
|
+
notes?: string;
|
|
384
326
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
*
|
|
388
|
-
* UI judge seam — consumer-supplied vision LLM hook the in-process
|
|
389
|
-
* auditor client invokes to identify findings from captured screenshots.
|
|
390
|
-
*
|
|
391
|
-
* The seam stays model-agnostic so consumers can plug in OpenAI vision,
|
|
392
|
-
* Anthropic vision, gemini, a local model, or a deterministic stub for
|
|
393
|
-
* tests. The auditor handles browser capture + Markdown emission; the
|
|
394
|
-
* judge owns the perception + judgment.
|
|
395
|
-
*
|
|
396
|
-
* Implementor contract:
|
|
397
|
-
* - Treat `lens` as authoritative — only emit findings that belong to
|
|
398
|
-
* that lens. Findings with `lens !== input.lens` will fail the
|
|
399
|
-
* iteration validator.
|
|
400
|
-
* - Reference screenshots via the `path` strings provided in
|
|
401
|
-
* `input.captures`. Inventing a path will cause the validator to
|
|
402
|
-
* reject the iteration.
|
|
403
|
-
* - Be conservative — a finding the judge cannot actually see in the
|
|
404
|
-
* screenshots is a hallucination and pollutes the audit.
|
|
405
|
-
* - Treat any exception thrown by the judge as the iteration's failure —
|
|
406
|
-
* do not swallow LLM errors. Per agent-runtime's fail-loud doctrine,
|
|
407
|
-
* surfacing the error to the kernel beats producing a silent zero.
|
|
408
|
-
*
|
|
409
|
-
* @experimental
|
|
410
|
-
*/
|
|
411
|
-
|
|
327
|
+
//#endregion
|
|
328
|
+
//#region src/profiles/ui-auditor/judge.d.ts
|
|
412
329
|
/** @experimental */
|
|
413
330
|
interface UiJudgeTokenUsage {
|
|
414
|
-
|
|
415
|
-
|
|
331
|
+
input: number;
|
|
332
|
+
output: number;
|
|
416
333
|
}
|
|
417
334
|
/** @experimental */
|
|
418
335
|
interface UiJudgeInput {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
336
|
+
lens: UiLens;
|
|
337
|
+
captures: readonly UiAuditCapture[];
|
|
338
|
+
/** Free-form product context the consumer wants the judge to know. */
|
|
339
|
+
productContext?: string;
|
|
340
|
+
/** Findings already on file across earlier iterations — for similarTo linkage. */
|
|
341
|
+
knownFindingIds?: readonly number[];
|
|
342
|
+
/** The full prompt the loop kernel synthesized for this iteration. */
|
|
343
|
+
promptText: string;
|
|
344
|
+
/** Cooperative cancellation. */
|
|
345
|
+
signal: AbortSignal;
|
|
429
346
|
}
|
|
430
347
|
/** @experimental */
|
|
431
348
|
interface UiJudgeOutput {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
349
|
+
findings: UiFinding[];
|
|
350
|
+
/** Optional triage commentary. */
|
|
351
|
+
notes?: string;
|
|
352
|
+
/** Optional usage; folded into the kernel cost ledger when present. */
|
|
353
|
+
tokenUsage?: UiJudgeTokenUsage;
|
|
354
|
+
/** Optional total cost in USD. */
|
|
355
|
+
costUsd?: number;
|
|
439
356
|
}
|
|
440
357
|
/** @experimental */
|
|
441
358
|
type UiJudge = (input: UiJudgeInput) => Promise<UiJudgeOutput>;
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
*
|
|
445
|
-
* `createInProcessUiAuditClient` — a `SandboxClient` that drives a
|
|
446
|
-
* Playwright browser in-process and delegates finding identification to a
|
|
447
|
-
* consumer-supplied {@link UiJudge}.
|
|
448
|
-
*
|
|
449
|
-
* Why this exists: `runAgentRounds` is built around a sandbox-SDK seam — each
|
|
450
|
-
* iteration is `client.create() → box.streamPrompt() → box.delete()`.
|
|
451
|
-
* For UI audit, spinning up a real container running a coding harness
|
|
452
|
-
* per iteration is overkill: the work is one browser capture + one
|
|
453
|
-
* vision LLM call. This client satisfies the kernel contract while
|
|
454
|
-
* doing the audit in-process; no container, no sandbox-SDK backend.
|
|
455
|
-
*
|
|
456
|
-
* The client owns ONE browser for its lifetime and creates a fresh
|
|
457
|
-
* context per iteration (isolated cookies/storage). Playwright is
|
|
458
|
-
* dynamically imported so consumers who use a different `SandboxClient`
|
|
459
|
-
* — e.g. a fleet executor that drives Playwright remotely — do not pay
|
|
460
|
-
* the peer dep cost.
|
|
461
|
-
*
|
|
462
|
-
* Concurrency: each iteration's prompt carries a self-describing task
|
|
463
|
-
* envelope (see `prompt.ts`), so concurrent fanout iterations do not race
|
|
464
|
-
* over per-client side state.
|
|
465
|
-
*
|
|
466
|
-
* @experimental
|
|
467
|
-
*/
|
|
468
|
-
|
|
359
|
+
//#endregion
|
|
360
|
+
//#region src/profiles/ui-auditor/in-process-client.d.ts
|
|
469
361
|
/** @experimental */
|
|
470
362
|
interface InProcessUiAuditClientOptions {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
363
|
+
/**
|
|
364
|
+
* Absolute path under which screenshots are written. Each capture lands
|
|
365
|
+
* at `<workspaceDir>/screenshots/<filename>`; finding screenshot paths
|
|
366
|
+
* are workspace-relative (`screenshots/<filename>`).
|
|
367
|
+
*/
|
|
368
|
+
workspaceDir: string;
|
|
369
|
+
/** The vision judge that turns captures into findings. */
|
|
370
|
+
judge: UiJudge;
|
|
371
|
+
/**
|
|
372
|
+
* Navigation policy.
|
|
373
|
+
*
|
|
374
|
+
* `'strict'` (default) waits for `networkidle` and fails the iteration
|
|
375
|
+
* if the page does not settle. `'spa'` waits for `domcontentloaded` —
|
|
376
|
+
* use for single-page apps that hold open long-poll/websocket
|
|
377
|
+
* connections and never settle.
|
|
378
|
+
*/
|
|
379
|
+
navPolicy?: 'strict' | 'spa';
|
|
380
|
+
/**
|
|
381
|
+
* Browser launch override. Default: chromium headless via Playwright.
|
|
382
|
+
* Consumers pass a custom factory to target a remote browser, a
|
|
383
|
+
* different channel, or a fleet adapter.
|
|
384
|
+
*/
|
|
385
|
+
launchBrowser?: () => Promise<BrowserHandle>;
|
|
494
386
|
}
|
|
495
387
|
/** @experimental */
|
|
496
388
|
interface BrowserHandle {
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
389
|
+
newContext(options?: {
|
|
390
|
+
viewport?: {
|
|
391
|
+
width: number;
|
|
392
|
+
height: number;
|
|
393
|
+
};
|
|
394
|
+
}): Promise<BrowserContextHandle>;
|
|
395
|
+
close(): Promise<void>;
|
|
504
396
|
}
|
|
505
397
|
/** @experimental */
|
|
506
398
|
interface BrowserContextHandle {
|
|
507
|
-
|
|
508
|
-
|
|
399
|
+
newPage(): Promise<PageHandle>;
|
|
400
|
+
close(): Promise<void>;
|
|
509
401
|
}
|
|
510
402
|
/** @experimental */
|
|
511
403
|
interface PageHandle {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
404
|
+
setViewportSize(size: {
|
|
405
|
+
width: number;
|
|
406
|
+
height: number;
|
|
407
|
+
}): Promise<void>;
|
|
408
|
+
goto(url: string, options?: {
|
|
409
|
+
waitUntil?: string;
|
|
410
|
+
timeout?: number;
|
|
411
|
+
}): Promise<unknown>;
|
|
412
|
+
waitForSelector(selector: string, options?: {
|
|
413
|
+
timeout?: number;
|
|
414
|
+
}): Promise<unknown>;
|
|
415
|
+
waitForTimeout(ms: number): Promise<void>;
|
|
416
|
+
screenshot(options: {
|
|
417
|
+
path: string;
|
|
418
|
+
fullPage?: boolean;
|
|
419
|
+
}): Promise<void>;
|
|
420
|
+
locator(selector: string): {
|
|
421
|
+
first(): {
|
|
422
|
+
screenshot(options: {
|
|
525
423
|
path: string;
|
|
526
|
-
|
|
527
|
-
}): Promise<void>;
|
|
528
|
-
locator(selector: string): {
|
|
529
|
-
first(): {
|
|
530
|
-
screenshot(options: {
|
|
531
|
-
path: string;
|
|
532
|
-
}): Promise<void>;
|
|
533
|
-
};
|
|
424
|
+
}): Promise<void>;
|
|
534
425
|
};
|
|
426
|
+
};
|
|
535
427
|
}
|
|
536
428
|
/** Create a `SandboxClient` that drives a local Playwright browser for in-process UI audits. @experimental */
|
|
537
429
|
declare function createInProcessUiAuditClient(options: InProcessUiAuditClientOptions): SandboxClient & {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
430
|
+
/**
|
|
431
|
+
* Close the underlying browser. Idempotent.
|
|
432
|
+
*
|
|
433
|
+
* Contract: callers MUST ensure no iterations are in flight when this is
|
|
434
|
+
* called. The kernel respects this — `runAgentRounds` awaits every iteration
|
|
435
|
+
* before returning, so `await runAgentRounds(...); await client.close()` is the
|
|
436
|
+
* intended pattern (see `examples/ui-audit`). If `close()` is invoked
|
|
437
|
+
* concurrently with a running iteration, the browser teardown will race
|
|
438
|
+
* against in-flight page operations; the iteration will surface an
|
|
439
|
+
* AggregateError carrying both the iteration error and the close error,
|
|
440
|
+
* but no work is lost silently.
|
|
441
|
+
*/
|
|
442
|
+
close(): Promise<void>;
|
|
551
443
|
};
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
*
|
|
555
|
-
* Per-lens guidance the auditor inlines into its system prompt for an
|
|
556
|
-
* iteration. Each entry is a self-contained brief — the same content the
|
|
557
|
-
* standalone ui-issue-finder skill ships, embedded as a string constant so
|
|
558
|
-
* agent-runtime carries no runtime dep on that external workspace.
|
|
559
|
-
*
|
|
560
|
-
* Briefs are deliberately concrete: they enumerate the SIGNALS to look for
|
|
561
|
-
* and the cross-lens distinctions to respect, so the judge files fewer
|
|
562
|
-
* pile-on findings under generic labels.
|
|
563
|
-
*
|
|
564
|
-
* @experimental
|
|
565
|
-
*/
|
|
566
|
-
|
|
444
|
+
//#endregion
|
|
445
|
+
//#region src/profiles/ui-auditor/lens-prompts.d.ts
|
|
567
446
|
/** Cross-lens rules injected into every UI audit iteration: finding quality standards and scope limits. @experimental */
|
|
568
447
|
declare const SHARED_AUDITOR_RULES: string;
|
|
569
448
|
/** Per-lens auditor briefs: concrete signals to look for and cross-lens distinctions to respect. @experimental */
|
|
@@ -574,57 +453,29 @@ declare const LENS_BRIEFS: Record<UiLens, string>;
|
|
|
574
453
|
* @experimental
|
|
575
454
|
*/
|
|
576
455
|
declare function buildAuditorSystemPrompt(lens: UiLens): string;
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
*
|
|
580
|
-
* Sandbox-event stream → UiAuditOutput decoder. The custom auditor
|
|
581
|
-
* `SandboxClient` emits events of the form:
|
|
582
|
-
*
|
|
583
|
-
* { type: 'audit.capture', data: UiAuditCapture }
|
|
584
|
-
* { type: 'audit.finding', data: UiFinding }
|
|
585
|
-
* { type: 'audit.notes', data: { notes: string } }
|
|
586
|
-
* { type: 'audit.lens', data: { lens: UiLens } }
|
|
587
|
-
* { type: 'done', data: { tokenUsage: { ... }, totalCostUsd?: number } }
|
|
588
|
-
*
|
|
589
|
-
* Other event types are tolerated and ignored. The adapter is pure: it
|
|
590
|
-
* folds an already-collected event array into a UiAuditOutput.
|
|
591
|
-
*
|
|
592
|
-
* @experimental
|
|
593
|
-
*/
|
|
594
|
-
|
|
456
|
+
//#endregion
|
|
457
|
+
//#region src/profiles/ui-auditor/output-adapter.d.ts
|
|
595
458
|
/** Parse raw `SandboxEvent` emissions from an audit iteration into structured `UiAuditOutput`. @experimental */
|
|
596
459
|
declare function parseAuditorEvents(events: SandboxEvent[]): UiAuditOutput;
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
*
|
|
600
|
-
* `uiAuditorProfile` — preset for vision-driven UI audit iterations.
|
|
601
|
-
*
|
|
602
|
-
* A `runAgentRounds` bundle: it returns the `AgentRunSpec`, output adapter, validator, and prompt
|
|
603
|
-
* formatter the loop kernel needs. The agent's "harness" is not a sandbox-SDK code-runner — it's a
|
|
604
|
-
* vision-capable judge driving a browser. The loop kernel still iterates
|
|
605
|
-
* `client.create() → box.streamPrompt() → box.delete()`; the client/box pair are provided by
|
|
606
|
-
* `createInProcessUiAuditClient` (in `./in-process-client.ts`) or a consumer-supplied `SandboxClient`.
|
|
607
|
-
*
|
|
608
|
-
* @experimental
|
|
609
|
-
*/
|
|
610
|
-
|
|
460
|
+
//#endregion
|
|
461
|
+
//#region src/profiles/ui-auditor/profile.d.ts
|
|
611
462
|
/** @experimental */
|
|
612
463
|
interface UiAuditorProfileOptions {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
464
|
+
/**
|
|
465
|
+
* Stable name surfaced in trace events. Defaults to `ui-auditor`.
|
|
466
|
+
*/
|
|
467
|
+
name?: string;
|
|
468
|
+
/**
|
|
469
|
+
* Optional model identifier passed in `AgentProfile.model.default`.
|
|
470
|
+
* The consumer's `SandboxClient` chooses how to interpret it.
|
|
471
|
+
*/
|
|
472
|
+
model?: string;
|
|
473
|
+
/**
|
|
474
|
+
* Task bound to the validator. Without it the validator uses the lens
|
|
475
|
+
* embedded in the iteration output as its expectation — fine for one-off
|
|
476
|
+
* use; less strict than passing the task explicitly.
|
|
477
|
+
*/
|
|
478
|
+
task?: UiAuditTask;
|
|
628
479
|
}
|
|
629
480
|
/**
|
|
630
481
|
* Preset `runAgentRounds` bundle for vision-driven UI audits: returns the `AgentRunSpec`, output adapter, validator, and prompt formatter the loop kernel needs.
|
|
@@ -632,32 +483,14 @@ interface UiAuditorProfileOptions {
|
|
|
632
483
|
* @experimental
|
|
633
484
|
*/
|
|
634
485
|
declare function uiAuditorProfile(options?: UiAuditorProfileOptions): {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
486
|
+
profile: AgentProfile;
|
|
487
|
+
taskToPrompt: (task: UiAuditTask) => string;
|
|
488
|
+
output: OutputAdapter<UiAuditOutput>;
|
|
489
|
+
validator: Validator<UiAuditOutput>;
|
|
490
|
+
agentRunSpec: AgentRunSpec<UiAuditTask>;
|
|
640
491
|
};
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
*
|
|
644
|
-
* Prompt formatter for the auditor profile. `formatAuditorPrompt` produces
|
|
645
|
-
* the user message handed to the iteration — describes the captures to be
|
|
646
|
-
* taken and the lens to apply. The system prompt comes from
|
|
647
|
-
* `buildAuditorSystemPrompt(lens)` (lens-prompts.ts).
|
|
648
|
-
*
|
|
649
|
-
* The formatter prepends a machine-readable envelope (`<<UI_AUDIT_TASK>>`
|
|
650
|
-
* … `<<UI_AUDIT_TASK_END>>`) carrying a JSON-serialised task. The
|
|
651
|
-
* in-process auditor client recovers the task from this envelope so the
|
|
652
|
-
* iteration is self-describing — robust to concurrent fanout, where any
|
|
653
|
-
* per-client side state (e.g. a "current task" register) would race.
|
|
654
|
-
*
|
|
655
|
-
* The formatter is pure and deterministic — re-run on the same task
|
|
656
|
-
* produces the same prompt. Tests and trace replays rely on this.
|
|
657
|
-
*
|
|
658
|
-
* @experimental
|
|
659
|
-
*/
|
|
660
|
-
|
|
492
|
+
//#endregion
|
|
493
|
+
//#region src/profiles/ui-auditor/prompt.d.ts
|
|
661
494
|
/** Wrap a `UiAuditTask` in a machine-readable envelope so iterations are self-describing. @experimental */
|
|
662
495
|
declare function encodeAuditTaskEnvelope(task: UiAuditTask): string;
|
|
663
496
|
/**
|
|
@@ -670,37 +503,10 @@ declare function encodeAuditTaskEnvelope(task: UiAuditTask): string;
|
|
|
670
503
|
declare function decodeAuditTaskEnvelope(prompt: string): UiAuditTask | undefined;
|
|
671
504
|
/** Produce the user message for one audit iteration: lens, captures to take, and the task envelope. @experimental */
|
|
672
505
|
declare function formatAuditorPrompt(task: UiAuditTask): string;
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
*
|
|
676
|
-
* Auditor validator — scores a single iteration's findings for actionability
|
|
677
|
-
* and gates the iteration result. The kernel uses `valid` + `score` for
|
|
678
|
-
* winner selection across fanned-out iterations and to detect a degenerate
|
|
679
|
-
* iteration (lens-violating findings, no screenshot evidence, no findings
|
|
680
|
-
* at all on a route where we expected some).
|
|
681
|
-
*
|
|
682
|
-
* Hard fails (`valid = false`):
|
|
683
|
-
* - A finding is filed under a lens that does not match the iteration's
|
|
684
|
-
* lens. The whole iteration is bad — the judge isn't following the
|
|
685
|
-
* lens discipline and the resulting Markdown would mislead reviewers.
|
|
686
|
-
* - A finding has no screenshot reference.
|
|
687
|
-
* - A finding's screenshot references a path that wasn't captured in
|
|
688
|
-
* this iteration.
|
|
689
|
-
*
|
|
690
|
-
* Score (0..1, max two decimals stable):
|
|
691
|
-
* - 0.4 * specificityRatio — proportion of findings with a selector
|
|
692
|
-
* - 0.4 * evidenceRatio — proportion of findings whose screenshots resolve to captures
|
|
693
|
-
* - 0.2 * (1 - genericTitleRatio) — proportion of findings whose titles
|
|
694
|
-
* are concrete (not "improve UX", "fix layout", etc.)
|
|
695
|
-
*
|
|
696
|
-
* An iteration with zero findings scores 0.5 by convention — neither a
|
|
697
|
-
* confident pass nor a hard failure (the judge might just have nothing to
|
|
698
|
-
* say on this lens). The driver decides what to do with it.
|
|
699
|
-
*
|
|
700
|
-
* @experimental
|
|
701
|
-
*/
|
|
702
|
-
|
|
506
|
+
//#endregion
|
|
507
|
+
//#region src/profiles/ui-auditor/validator.d.ts
|
|
703
508
|
/** Build a `Validator` that rejects off-lens findings and findings missing screenshot evidence. @experimental */
|
|
704
509
|
declare function createUiAuditorValidator(task: UiAuditTask): Validator<UiAuditOutput>;
|
|
705
|
-
|
|
706
|
-
export { type AppendFindingsResult, type AuditIndex, type AuditRegistry, type AuditRegistryCapture, type BrowserContextHandle, type BrowserHandle, type InProcessUiAuditClientOptions, type KnowledgeItem, type KnowledgeUpdate, LENS_BRIEFS, type MultiHarnessResearcherFanoutOptions, type PageHandle, type RegisterCapturesOptions, type ResearchOutput, type ResearchSource, type ResearchTask, type ResearcherProfileOptions, SHARED_AUDITOR_RULES, type UiAuditCapture, type UiAuditCaptureRequest, type UiAuditOutput, type UiAuditTask, type UiAuditViewport, type UiAuditorProfileOptions, UiFinding, type UiJudge, type UiJudgeInput, type UiJudgeOutput, type UiJudgeTokenUsage, UiLens, appendFindings, buildAuditorSystemPrompt, createInProcessUiAuditClient, createResearcherValidator, createUiAuditorValidator, decodeAuditTaskEnvelope, encodeAuditTaskEnvelope, formatAuditorPrompt, initAuditWorkspace, multiHarnessResearcherFanout, parseAuditorEvents, readAuditRegistry, registerCaptures, researcherProfile, summarizeRegistry, uiAuditorProfile, writeAuditIndex };
|
|
510
|
+
//#endregion
|
|
511
|
+
export { type AppendFindingsResult, type AuditIndex, type AuditRegistry, type AuditRegistryCapture, type BrowserContextHandle, type BrowserHandle, type CoderTask, type InProcessUiAuditClientOptions, type KnowledgeItem, type KnowledgeUpdate, LENS_BRIEFS, type MultiHarnessResearcherFanoutOptions, type PageHandle, type RegisterCapturesOptions, type ResearchOutput, type ResearchSource, type ResearchTask, type ResearcherProfileOptions, SHARED_AUDITOR_RULES, UI_FINDING_SEVERITIES, UI_LENSES, type UiAuditCapture, type UiAuditCaptureRequest, type UiAuditOutput, type UiAuditTask, type UiAuditViewport, type UiAuditorProfileOptions, type UiFinding, type UiFindingScreenshot, type UiFindingSeverity, type UiJudge, type UiJudgeInput, type UiJudgeOutput, type UiJudgeTokenUsage, type UiLens, appendFindings, buildAuditorSystemPrompt, coderTaskToPrompt, createInProcessUiAuditClient, createResearcherValidator, createUiAuditorValidator, decodeAuditTaskEnvelope, encodeAuditTaskEnvelope, formatAuditorPrompt, initAuditWorkspace, multiHarnessResearcherFanout, parseAuditorEvents, readAuditRegistry, registerCaptures, researcherProfile, summarizeRegistry, uiAuditorProfile, writeAuditIndex };
|
|
512
|
+
//# sourceMappingURL=profiles.d.ts.map
|