@tangle-network/agent-runtime 0.105.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 +2 -2
- 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 -1058
- package/dist/index.js +2106 -2082
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +768 -889
- package/dist/intelligence.js +1466 -1367
- 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 -15
- 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 -436
- 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 +149 -145
- package/dist/primeintellect/index.js +626 -1003
- 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 -56
- package/skills/build-with-agent-runtime/SKILL.md +1 -0
- 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-2VZYRB55.js +0 -834
- package/dist/chunk-2VZYRB55.js.map +0 -1
- package/dist/chunk-3MDZX7YU.js +0 -125
- package/dist/chunk-3MDZX7YU.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-C5RTIBNZ.js +0 -48
- package/dist/chunk-C5RTIBNZ.js.map +0 -1
- package/dist/chunk-CTRA64LY.js +0 -680
- package/dist/chunk-CTRA64LY.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-H5QPIZNX.js +0 -907
- package/dist/chunk-H5QPIZNX.js.map +0 -1
- package/dist/chunk-HLKC4UYB.js +0 -3514
- package/dist/chunk-HLKC4UYB.js.map +0 -1
- package/dist/chunk-HNP72PNU.js +0 -192
- package/dist/chunk-HNP72PNU.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-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-OPVWXJ2H.js +0 -75
- package/dist/chunk-OPVWXJ2H.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-RDOAVVHY.js +0 -699
- package/dist/chunk-RDOAVVHY.js.map +0 -1
- package/dist/chunk-SGKPNBXE.js +0 -60
- package/dist/chunk-SGKPNBXE.js.map +0 -1
- package/dist/chunk-SMQXZGLZ.js +0 -351
- package/dist/chunk-SMQXZGLZ.js.map +0 -1
- package/dist/chunk-UHEZW5BU.js +0 -2918
- package/dist/chunk-UHEZW5BU.js.map +0 -1
- package/dist/chunk-UPWGXKXB.js +0 -254
- package/dist/chunk-UPWGXKXB.js.map +0 -1
- package/dist/chunk-VISA6CI3.js +0 -200
- package/dist/chunk-VISA6CI3.js.map +0 -1
- package/dist/chunk-WMTCUOQL.js +0 -474
- package/dist/chunk-WMTCUOQL.js.map +0 -1
- package/dist/chunk-WRTOVNN4.js +0 -4728
- package/dist/chunk-WRTOVNN4.js.map +0 -1
- package/dist/chunk-WSTRQZYQ.js +0 -5576
- package/dist/chunk-WSTRQZYQ.js.map +0 -1
- package/dist/chunk-XBG2W2VW.js +0 -6434
- package/dist/chunk-XBG2W2VW.js.map +0 -1
- package/dist/chunk-YEJR7IXO.js +0 -68
- package/dist/chunk-YEJR7IXO.js.map +0 -1
- package/dist/chunk-YJZA2BIK.js +0 -1338
- package/dist/chunk-YJZA2BIK.js.map +0 -1
- package/dist/completion-gate-BMy5LGoP.d.ts +0 -256
- package/dist/conversation.js.map +0 -1
- package/dist/coordination-BZZSVYpZ.d.ts +0 -2570
- package/dist/environment-provider.js.map +0 -1
- package/dist/improvement-adapter-HAZz-7vK.d.ts +0 -203
- package/dist/knowledge.js.map +0 -1
- package/dist/local-harness-BDNcl6jI.d.ts +0 -175
- package/dist/loop-runner-bin-68aoM9-7.d.ts +0 -199
- 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-B4t-OQjL.d.ts +0 -271
- package/dist/redact-BuFjxBUJ.d.ts +0 -481
- package/dist/sanitize-DEbPNtyI.d.ts +0 -328
- package/dist/structural-rollout-DEh6CEsa.d.ts +0 -446
- package/dist/supervise-4_48wwvy.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-DxhAWr5Z.d.ts +0 -999
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { FindingSubject, AnalystFinding } from '@tangle-network/agent-eval';
|
|
2
|
-
import { I as ImprovementProposalSource } from './types-CmYCMbFT.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* `AgentSurfaces` — declarative map of the mutable file/directory paths
|
|
6
|
-
* the self-improvement loop can edit on behalf of an agent.
|
|
7
|
-
*
|
|
8
|
-
* The substrate uses this map to resolve every parsed `FindingSubject`
|
|
9
|
-
* (from agent-eval) to a real on-disk path. No per-vertical glue;
|
|
10
|
-
* no fabricated paths; no silent `existsSync(...)` skips that hide
|
|
11
|
-
* misconfiguration from the operator.
|
|
12
|
-
*
|
|
13
|
-
* Surfaces are validated at `defineAgent` time — missing paths fail
|
|
14
|
-
* loud with a list of every offender. A surface that's not needed
|
|
15
|
-
* (e.g. an agent with no RAG corpora) is simply omitted; the loop
|
|
16
|
-
* refuses to route those subjects rather than fabricating a target.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Surface declarations. Every path is repo-relative (or absolute) at
|
|
21
|
-
* `defineAgent` time. At resolution time, paths are joined against the
|
|
22
|
-
* agent's `repoRoot`.
|
|
23
|
-
*
|
|
24
|
-
* `systemPrompt`, `tools`, `personas` are DIRECTORIES; the loop appends
|
|
25
|
-
* `<section>.md`, `<tool>/README.md`, `<persona-id>.yaml` etc.
|
|
26
|
-
* `rubric`, `outputSchema` are SINGLE FILES; the loop edits them in
|
|
27
|
-
* place.
|
|
28
|
-
*
|
|
29
|
-
* `knowledge` is the agent-knowledge root (typically `.agent-knowledge`);
|
|
30
|
-
* `applyKnowledgeWriteBlocks` writes pages relative to it.
|
|
31
|
-
*
|
|
32
|
-
* Optional surfaces (`scaffolding`, `memory`, `rag`, `outputSchema`)
|
|
33
|
-
* can be omitted — the loop will reject findings targeting them with a
|
|
34
|
-
* clear log message instead of fabricating a path.
|
|
35
|
-
*/
|
|
36
|
-
interface AgentSurfaces {
|
|
37
|
-
/** Directory containing one markdown file per system-prompt section. */
|
|
38
|
-
systemPrompt: string;
|
|
39
|
-
/** Directory containing one subdir per tool (`<tool>/README.md`). */
|
|
40
|
-
tools: string;
|
|
41
|
-
/** Single file (TypeScript module) defining the rubric weights + dimensions. */
|
|
42
|
-
rubric: string;
|
|
43
|
-
/** Knowledge-base root; typically `.agent-knowledge`. */
|
|
44
|
-
knowledge: string;
|
|
45
|
-
/** Directory containing one YAML/JSON file per persona. */
|
|
46
|
-
personas: string;
|
|
47
|
-
/** Optional: directory containing scaffolding rules (precondition checks, retry policies). */
|
|
48
|
-
scaffolding?: string;
|
|
49
|
-
/** Optional: memory store path (JSONL / SQLite / DB). */
|
|
50
|
-
memory?: string;
|
|
51
|
-
/** Optional: directory containing RAG corpora (`<corpus>/<doc-id>.md`). */
|
|
52
|
-
rag?: string;
|
|
53
|
-
/** Optional: single file defining the output schema (Zod / JSON Schema). */
|
|
54
|
-
outputSchema?: string;
|
|
55
|
-
/** Optional: directory containing Agent Skill packages. */
|
|
56
|
-
skills?: string;
|
|
57
|
-
/** Optional: directory containing MCP server/tool configuration. */
|
|
58
|
-
mcp?: string;
|
|
59
|
-
/** Optional: directory containing hook definitions. */
|
|
60
|
-
hooks?: string;
|
|
61
|
-
/** Optional: directory containing subagent definitions. */
|
|
62
|
-
subagents?: string;
|
|
63
|
-
/** Optional: directory containing orchestration/workflow policies. */
|
|
64
|
-
workflows?: string;
|
|
65
|
-
/** Optional: single file containing rollout-policy settings. */
|
|
66
|
-
rolloutPolicy?: string;
|
|
67
|
-
/** Optional: single canonical AgentProfile file. */
|
|
68
|
-
agentProfile?: string;
|
|
69
|
-
/** Optional: source root for code findings. */
|
|
70
|
-
code?: string;
|
|
71
|
-
}
|
|
72
|
-
interface ResolvedSurface {
|
|
73
|
-
/** Absolute filesystem path the operator can `cat` / `vim`. */
|
|
74
|
-
absolutePath: string;
|
|
75
|
-
/** Repo-relative path for PR descriptions, diffs, audit logs. */
|
|
76
|
-
repoRelativePath: string;
|
|
77
|
-
/** Whether the path currently exists on disk. */
|
|
78
|
-
exists: boolean;
|
|
79
|
-
/** The substrate's intent: edit an existing file or create a new one. */
|
|
80
|
-
intent: 'edit-existing' | 'create-new';
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Resolve a parsed `FindingSubject` to the file path the substrate
|
|
84
|
-
* should edit (or create) on disk.
|
|
85
|
-
*
|
|
86
|
-
* Returns `null` when:
|
|
87
|
-
* - the subject targets a surface the agent didn't declare
|
|
88
|
-
* (e.g. `rag:*` when `surfaces.rag` is undefined), OR
|
|
89
|
-
* - the subject is a `cluster` (failure-mode emits these as evidence,
|
|
90
|
-
* not actionable mutations — they don't route to a file).
|
|
91
|
-
*
|
|
92
|
-
* Returns a `ResolvedSurface` with `intent: 'create-new'` when the
|
|
93
|
-
* subject names a path that doesn't yet exist (e.g. a new wiki page).
|
|
94
|
-
* The caller chooses whether to honour the create — for tightly-managed
|
|
95
|
-
* surfaces like `systemPrompt` it's usually a contract violation
|
|
96
|
-
* (the analyst named a section that doesn't exist); for `knowledge`
|
|
97
|
-
* it's the whole point.
|
|
98
|
-
*/
|
|
99
|
-
declare function resolveSubjectPath(subject: FindingSubject, surfaces: AgentSurfaces, repoRoot: string): ResolvedSurface | null;
|
|
100
|
-
/**
|
|
101
|
-
* Validate that every declared surface exists on disk under `repoRoot`.
|
|
102
|
-
*
|
|
103
|
-
* Returns an array of `SurfaceValidationIssue` — empty when all required
|
|
104
|
-
* surfaces resolve. `defineAgent` throws with the issues rendered, so
|
|
105
|
-
* a misconfigured manifest fails at startup (not at the first finding
|
|
106
|
-
* the loop produces 20 minutes later).
|
|
107
|
-
*/
|
|
108
|
-
interface SurfaceValidationIssue {
|
|
109
|
-
surface: keyof AgentSurfaces;
|
|
110
|
-
path: string;
|
|
111
|
-
reason: 'missing' | 'not-directory' | 'not-file';
|
|
112
|
-
}
|
|
113
|
-
/** Validate an `AgentSurfaces` map on disk — missing paths fail loud at `defineAgent` time instead of silently skipping self-improvement edits. */
|
|
114
|
-
declare function validateSurfaces(surfaces: AgentSurfaces, repoRoot: string): ReadonlyArray<SurfaceValidationIssue>;
|
|
115
|
-
/** Format a list of surface validation issues into a human-readable error string. */
|
|
116
|
-
declare function renderSurfaceIssues(issues: ReadonlyArray<SurfaceValidationIssue>, repoRoot: string): string;
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Surface improvement proposer — resolves analyst findings into LLM-drafted
|
|
120
|
-
* candidate patches without changing the caller's repository.
|
|
121
|
-
*
|
|
122
|
-
* The proposer parses each finding's `subject` via
|
|
123
|
-
* `parseFindingSubject` (agent-eval), resolves it to a real file path
|
|
124
|
-
* via the agent's `AgentSurfaces`, reads the current content, and asks
|
|
125
|
-
* an LLM to draft a unified-diff patch given the finding + current
|
|
126
|
-
* content + per-kind editing-discipline rules.
|
|
127
|
-
*
|
|
128
|
-
* Fail-loud rules:
|
|
129
|
-
* - Findings whose subject doesn't parse → counted in `errors`.
|
|
130
|
-
* - Findings whose subject targets an undeclared surface → counted in
|
|
131
|
-
* `errors` with the offending kind in the message.
|
|
132
|
-
* - Findings whose target path doesn't exist AND the kind isn't a
|
|
133
|
-
* create-new variant (`new-tool`, `knowledge.wiki`) → counted in
|
|
134
|
-
* `errors` with the resolved path in the message.
|
|
135
|
-
* - LLM drafts that fail JSON-schema validation → counted in
|
|
136
|
-
* `errors` with the schema issue.
|
|
137
|
-
*
|
|
138
|
-
* No silent skips. Every dropped finding has a recorded reason the
|
|
139
|
-
* loop's report surfaces.
|
|
140
|
-
*/
|
|
141
|
-
|
|
142
|
-
interface SurfaceImprovementEdit {
|
|
143
|
-
/** Stable id derived from the source finding so re-proposals are idempotent. */
|
|
144
|
-
id: string;
|
|
145
|
-
/** The finding that produced this edit — for revert + audit trail. */
|
|
146
|
-
sourceFindingId: string;
|
|
147
|
-
/** Parsed subject; included so the apply step doesn't re-parse. */
|
|
148
|
-
subject: FindingSubject;
|
|
149
|
-
/** Resolved on-disk target. */
|
|
150
|
-
target: ResolvedSurface;
|
|
151
|
-
/** SHA-256 of the current file content the patch was drafted against. */
|
|
152
|
-
baseSha256: string;
|
|
153
|
-
/** Unified-diff patch the LLM drafted (relative to `target.absolutePath`). */
|
|
154
|
-
patch: string;
|
|
155
|
-
/** One-line summary the operator sees in the report / PR title. */
|
|
156
|
-
summary: string;
|
|
157
|
-
/** Multi-line rationale for the PR body — finding context + LLM reasoning. */
|
|
158
|
-
rationale: string;
|
|
159
|
-
/** Carry-forward from the finding so the apply gate can check the threshold. */
|
|
160
|
-
confidence: number;
|
|
161
|
-
/** Carry-forward severity for prioritization. */
|
|
162
|
-
severity: AnalystFinding['severity'];
|
|
163
|
-
}
|
|
164
|
-
interface CreateSurfaceImprovementProposerOptions {
|
|
165
|
-
surfaces: AgentSurfaces;
|
|
166
|
-
repoRoot: string;
|
|
167
|
-
/**
|
|
168
|
-
* LLM-draft callback. Given a finding + current file content + the
|
|
169
|
-
* resolved target, returns a unified-diff patch + summary + rationale.
|
|
170
|
-
*
|
|
171
|
-
* Required — the substrate doesn't ship a hardcoded prompt; the agent
|
|
172
|
-
* author picks the model (Haiku for cheap routine drafts, Sonnet for
|
|
173
|
-
* substantive prompt rewrites, etc.) via this callback.
|
|
174
|
-
*/
|
|
175
|
-
draftPatch: (input: DraftPatchInput) => Promise<DraftPatchOutput>;
|
|
176
|
-
/**
|
|
177
|
-
* When the resolved target doesn't exist, allow the substrate to
|
|
178
|
-
* CREATE the file (for `knowledge.wiki`, `new-tool` subjects). Default
|
|
179
|
-
* true for those kinds, false for `system-prompt` / `rubric` / etc.
|
|
180
|
-
* (named sections that don't exist are a contract violation, not a
|
|
181
|
-
* scaffolding opportunity).
|
|
182
|
-
*/
|
|
183
|
-
allowCreateForKinds?: ReadonlyArray<FindingSubject['kind']>;
|
|
184
|
-
}
|
|
185
|
-
interface DraftPatchInput {
|
|
186
|
-
finding: AnalystFinding;
|
|
187
|
-
subject: FindingSubject;
|
|
188
|
-
target: ResolvedSurface;
|
|
189
|
-
/** Current file content (empty string when `intent === 'create-new'`). */
|
|
190
|
-
currentContent: string;
|
|
191
|
-
}
|
|
192
|
-
interface DraftPatchOutput {
|
|
193
|
-
/** Unified diff against the current file content. Empty string skips this finding. */
|
|
194
|
-
patch: string;
|
|
195
|
-
/** One-line summary for the operator. */
|
|
196
|
-
summary: string;
|
|
197
|
-
/** Multi-line rationale for the PR body. */
|
|
198
|
-
rationale: string;
|
|
199
|
-
}
|
|
200
|
-
/** Resolve each finding to a real surface and draft a detached patch candidate. */
|
|
201
|
-
declare function createSurfaceImprovementProposer(opts: CreateSurfaceImprovementProposerOptions): ImprovementProposalSource<SurfaceImprovementEdit>;
|
|
202
|
-
|
|
203
|
-
export { type AgentSurfaces as A, type CreateSurfaceImprovementProposerOptions as C, type DraftPatchInput as D, type ResolvedSurface as R, type SurfaceImprovementEdit as S, type DraftPatchOutput as a, type SurfaceValidationIssue as b, createSurfaceImprovementProposer as c, resolveSubjectPath as d, renderSurfaceIssues as r, validateSurfaces as v };
|
package/dist/knowledge.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { ChildProcess } from 'node:child_process';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* Subprocess wrappers for the local coding-harness CLIs installed in the
|
|
6
|
-
* sandbox image (claude-code, codex, opencode). Used by the in-process
|
|
7
|
-
* delegation executor (`createInProcessExecutor`) so a delegated coding task
|
|
8
|
-
* spawns a real harness on a real git worktree instead of provisioning a
|
|
9
|
-
* sibling sandbox.
|
|
10
|
-
*
|
|
11
|
-
* All harness invocations:
|
|
12
|
-
* - run with `cwd` set to the worktree
|
|
13
|
-
* - inherit env from the parent (the MCP server inside the sandbox has
|
|
14
|
-
* the harness's auth already)
|
|
15
|
-
* - capture stdout/stderr
|
|
16
|
-
* - support cancellation via AbortSignal
|
|
17
|
-
* - enforce a wall-clock timeout
|
|
18
|
-
*
|
|
19
|
-
* @experimental
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/** Local coding harness available inside the sandbox. */
|
|
23
|
-
type LocalHarness = 'claude' | 'codex' | 'opencode';
|
|
24
|
-
/** @experimental */
|
|
25
|
-
interface RunLocalHarnessOptions {
|
|
26
|
-
harness: LocalHarness;
|
|
27
|
-
/** Working directory for the subprocess (typically a worktree path). */
|
|
28
|
-
cwd: string;
|
|
29
|
-
/** Prompt forwarded as the harness CLI's task argument. */
|
|
30
|
-
taskPrompt: string;
|
|
31
|
-
/**
|
|
32
|
-
* Pre-built command + args (e.g. from `harnessInvocation` so the full authored
|
|
33
|
-
* `AgentProfile` — systemPrompt + model — reaches the harness). When set it OVERRIDES the
|
|
34
|
-
* default prompt-only `buildArgs(taskPrompt)` path; `command` defaults to the harness's
|
|
35
|
-
* default binary when only `args` is supplied. When absent the legacy prompt-only shape
|
|
36
|
-
* is used unchanged.
|
|
37
|
-
*/
|
|
38
|
-
invocation?: {
|
|
39
|
-
command?: string;
|
|
40
|
-
args: ReadonlyArray<string>;
|
|
41
|
-
};
|
|
42
|
-
/** Allow autonomous Claude edits without an interactive permission prompt.
|
|
43
|
-
* Use only when `cwd` is an isolated candidate worktree. */
|
|
44
|
-
dangerouslySkipPermissions?: boolean;
|
|
45
|
-
/** Isolate Codex from ambient configuration/instructions and require JSONL token usage.
|
|
46
|
-
* The invocation should come from `harnessInvocation(..., { codexReproducible: true })`. */
|
|
47
|
-
codexReproducible?: boolean;
|
|
48
|
-
/** Absolute host paths that reproducible Codex must not read. The normalized set is compiled
|
|
49
|
-
* into the controlled permission profile and its digest is returned in execution evidence. */
|
|
50
|
-
codexReadDeniedPaths?: ReadonlyArray<string>;
|
|
51
|
-
/** Wall-clock kill deadline (ms). Default 5 min. Subprocess SIGTERMed on expiry. */
|
|
52
|
-
timeoutMs?: number;
|
|
53
|
-
/** Newest stdout/stderr bytes retained per stream. Default 64 MiB. */
|
|
54
|
-
maxOutputBytes?: number;
|
|
55
|
-
/** Caller cancellation. SIGTERM is sent on abort. */
|
|
56
|
-
signal?: AbortSignal;
|
|
57
|
-
/** Override env (defaults to inheriting from the parent). */
|
|
58
|
-
env?: NodeJS.ProcessEnv;
|
|
59
|
-
/**
|
|
60
|
-
* Test seam — inject a custom spawner so unit tests can mock the
|
|
61
|
-
* subprocess without touching the OS. Defaults to node's `child_process.spawn`.
|
|
62
|
-
*/
|
|
63
|
-
spawn?: (command: string, args: ReadonlyArray<string>, opts: {
|
|
64
|
-
cwd: string;
|
|
65
|
-
env: NodeJS.ProcessEnv;
|
|
66
|
-
stdio: 'pipe';
|
|
67
|
-
detached: boolean;
|
|
68
|
-
}) => ChildProcess;
|
|
69
|
-
/** Test seam for locating the native Codex executable before it is staged in the worktree. */
|
|
70
|
-
resolveCodexExecutable?: (command: string, env: NodeJS.ProcessEnv) => Promise<string>;
|
|
71
|
-
}
|
|
72
|
-
/** Exact aggregate usage emitted by Codex's terminal `turn.completed` JSONL event. */
|
|
73
|
-
interface CodexTokenUsage {
|
|
74
|
-
inputTokens: number;
|
|
75
|
-
cachedInputTokens: number;
|
|
76
|
-
outputTokens: number;
|
|
77
|
-
reasoningOutputTokens: number;
|
|
78
|
-
}
|
|
79
|
-
/** Isolation settings asserted before a reproducible Codex run is allowed to start. */
|
|
80
|
-
interface CodexExecutionPolicy {
|
|
81
|
-
sessionPersistence: 'ephemeral';
|
|
82
|
-
userConfig: false;
|
|
83
|
-
rules: false;
|
|
84
|
-
projectInstructions: false;
|
|
85
|
-
skillInstructions: false;
|
|
86
|
-
appInstructions: false;
|
|
87
|
-
toolSuggestions: false;
|
|
88
|
-
multiAgentInstructions: false;
|
|
89
|
-
sandbox: 'workspace-write';
|
|
90
|
-
permissionProfile: 'agent_runtime_reproducible';
|
|
91
|
-
approvalPolicy: 'never';
|
|
92
|
-
shellNetwork: false;
|
|
93
|
-
webSearch: false;
|
|
94
|
-
serviceTier: 'default';
|
|
95
|
-
shellEnvironment: 'core-filtered';
|
|
96
|
-
loginShell: false;
|
|
97
|
-
credentialsReadable: false;
|
|
98
|
-
hostHomeReadable: false;
|
|
99
|
-
procEnvironment: 'private-sanitized';
|
|
100
|
-
sensitiveEnvironmentNamesVisible: false;
|
|
101
|
-
parentRepoRead: false;
|
|
102
|
-
gitMetadata: false;
|
|
103
|
-
temporaryDirectory: 'workspace-private';
|
|
104
|
-
stagedExecutable: 'static-elf-read-only';
|
|
105
|
-
callerReadDeniedPaths: 'enforced';
|
|
106
|
-
containerSockets: false;
|
|
107
|
-
}
|
|
108
|
-
/** Zero-model-call evidence for the exact Codex process about to run. */
|
|
109
|
-
interface CodexExecutionEvidence {
|
|
110
|
-
cliVersion: string;
|
|
111
|
-
executableSha256: string;
|
|
112
|
-
/** SHA-256 of the exact composed prompt argument proved present in the rendered prompt. */
|
|
113
|
-
requestedPromptSha256: string;
|
|
114
|
-
effectivePromptSha256: string;
|
|
115
|
-
nonPromptArgsSha256: string;
|
|
116
|
-
controlledConfigSha256: string;
|
|
117
|
-
/** Sorted normalized paths compiled into the permission profile. */
|
|
118
|
-
readDeniedPaths: string[];
|
|
119
|
-
readDeniedPathsSha256: string;
|
|
120
|
-
readDeniedPathCount: number;
|
|
121
|
-
policy: CodexExecutionPolicy;
|
|
122
|
-
}
|
|
123
|
-
/** @experimental */
|
|
124
|
-
interface LocalHarnessResult {
|
|
125
|
-
/** OS exit code. `null` when killed before exit. */
|
|
126
|
-
exitCode: number | null;
|
|
127
|
-
/** Concatenated stdout. */
|
|
128
|
-
stdout: string;
|
|
129
|
-
/** Concatenated stderr. */
|
|
130
|
-
stderr: string;
|
|
131
|
-
/** Set when the process exited via signal (timeout / abort). */
|
|
132
|
-
killedBySignal: NodeJS.Signals | null;
|
|
133
|
-
/** Wall-clock duration ms (spawn → exit). */
|
|
134
|
-
durationMs: number;
|
|
135
|
-
/** Set when timeoutMs elapsed before exit. */
|
|
136
|
-
timedOut: boolean;
|
|
137
|
-
/**
|
|
138
|
-
* Set when the caller's AbortSignal fired before this result settled.
|
|
139
|
-
* Optional so injected runners and stored results from older releases remain valid.
|
|
140
|
-
*/
|
|
141
|
-
aborted?: boolean;
|
|
142
|
-
/** Present for a reproducible Codex run; parsed from the real terminal JSONL event. */
|
|
143
|
-
usage?: CodexTokenUsage;
|
|
144
|
-
/** Present for reproducible Codex runs; generated and checked before model execution. */
|
|
145
|
-
evidence?: CodexExecutionEvidence;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Spawn a local coding harness CLI as a subprocess + collect its output.
|
|
149
|
-
*
|
|
150
|
-
* NOT responsible for parsing the harness's output or extracting a diff —
|
|
151
|
-
* the in-process executor's `streamPrompt` orchestrates `git diff` against
|
|
152
|
-
* the worktree after this resolves. This function is intentionally narrow:
|
|
153
|
-
* spawn, wait, capture, return.
|
|
154
|
-
*
|
|
155
|
-
* Fails loud — throws when:
|
|
156
|
-
* - `cwd` doesn't exist (subprocess emits ENOENT; surfaced as Error)
|
|
157
|
-
* - the harness binary is not on PATH (ENOENT)
|
|
158
|
-
* - the caller signal was already aborted before process launch
|
|
159
|
-
*
|
|
160
|
-
* Does NOT throw when:
|
|
161
|
-
* - the subprocess exits non-zero (`result.exitCode` carries the code)
|
|
162
|
-
* - a non-reproducible subprocess is aborted / timed out (`result.aborted` /
|
|
163
|
-
* `result.timedOut` carries the reason even when a TERM-aware child exits zero)
|
|
164
|
-
*
|
|
165
|
-
* Reproducible Codex additionally requires a terminal usage event. If cancellation
|
|
166
|
-
* prevents that event, this rejects with `CodexExecutionDiagnosticError` instead of
|
|
167
|
-
* returning an incomplete reproducibility receipt.
|
|
168
|
-
*
|
|
169
|
-
* @experimental
|
|
170
|
-
*/
|
|
171
|
-
declare function runLocalHarness(options: RunLocalHarnessOptions): Promise<LocalHarnessResult>;
|
|
172
|
-
/** Parse and validate the one terminal usage event emitted by `codex exec --json`. */
|
|
173
|
-
declare function parseCodexTokenUsage(stdout: string): CodexTokenUsage;
|
|
174
|
-
|
|
175
|
-
export { type CodexTokenUsage as C, type LocalHarness as L, type RunLocalHarnessOptions as R, type CodexExecutionPolicy as a, type CodexExecutionEvidence as b, type LocalHarnessResult as c, parseCodexTokenUsage as p, runLocalHarness as r };
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { R as RunAnalystLoopOpts, a as RunAnalystLoopResult } from './types-CmYCMbFT.js';
|
|
2
|
-
import { F as FactCandidate, C as CreateKbGateOptions } from './kb-gate-CwHO0vz6.js';
|
|
3
|
-
import { B as Budget } from './types-CvNwMzQt.js';
|
|
4
|
-
import { A as AuthoredHarness, W as WinnerStrategy, a as WorktreeFanoutOptions, b as WorktreePatchArtifact } from './worktree-fanout-DxhAWr5Z.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* `runDelegatedLoop` — the configured delegated loop-runner.
|
|
9
|
-
*
|
|
10
|
-
* One typed entrypoint a worker agent (or a scheduled routine) calls to run a
|
|
11
|
-
* disciplined loop in a chosen MODE, over agent-runtime's hardened engines:
|
|
12
|
-
*
|
|
13
|
-
* code → build-in-a-loop on the GENERIC recursive path (worktreeLoopRunner: author one
|
|
14
|
-
* `AgentProfile` per harness → worktree-CLI leaves → `patchDelivered` gate)
|
|
15
|
-
* review → caller-registered runner — a `code` runner with an approval gate over candidates
|
|
16
|
-
* research → research-in-a-loop with valid-only KB growth (createKbGate)
|
|
17
|
-
* audit → analyze trace/run data → findings (runAnalystLoop, caller-wired)
|
|
18
|
-
* self-improve → caller-registered `improve(profile, options)` run
|
|
19
|
-
*
|
|
20
|
-
* It is intentionally a thin façade: the value is that EVERY product reuses the
|
|
21
|
-
* one hardened engine instead of forking delegation logic. The dispatcher owns
|
|
22
|
-
* mode routing, timing, fail-loud on an unregistered mode, and a uniform result
|
|
23
|
-
* shape; each mode's engine is a pre-configured runner in the registry (build it
|
|
24
|
-
* with the factories below, or inject your own / a stub).
|
|
25
|
-
*
|
|
26
|
-
* @experimental
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/** All valid delegated-loop mode names — used for validation and CLI surfaces. @experimental */
|
|
30
|
-
declare const DELEGATED_LOOP_MODES: readonly ["code", "review", "research", "audit", "self-improve"];
|
|
31
|
-
/** @experimental */
|
|
32
|
-
type DelegatedLoopMode = (typeof DELEGATED_LOOP_MODES)[number];
|
|
33
|
-
/** Type guard — returns true when `value` is a valid `DelegatedLoopMode` string. @experimental */
|
|
34
|
-
declare function isDelegatedLoopMode(value: unknown): value is DelegatedLoopMode;
|
|
35
|
-
/** @experimental A pre-configured loop for one mode. Returns the mode's raw
|
|
36
|
-
* output; the dispatcher wraps it in a {@link DelegatedLoopResult}. */
|
|
37
|
-
type DelegatedLoopRunner<T = unknown> = (signal: AbortSignal) => Promise<T>;
|
|
38
|
-
/** @experimental Mode → configured runner. Partial: only register the modes a
|
|
39
|
-
* given product/routine actually uses. */
|
|
40
|
-
type DelegatedLoopRegistry = Partial<Record<DelegatedLoopMode, DelegatedLoopRunner>>;
|
|
41
|
-
/** @experimental Uniform result — never throws from a registered runner; a
|
|
42
|
-
* thrown engine becomes `{ ok: false, error }` so a routine can record + move on. */
|
|
43
|
-
interface DelegatedLoopResult<T = unknown> {
|
|
44
|
-
mode: DelegatedLoopMode;
|
|
45
|
-
ok: boolean;
|
|
46
|
-
output?: T;
|
|
47
|
-
error?: string;
|
|
48
|
-
durationMs: number;
|
|
49
|
-
}
|
|
50
|
-
/** @experimental */
|
|
51
|
-
interface RunDelegatedLoopOptions {
|
|
52
|
-
signal?: AbortSignal;
|
|
53
|
-
/** Clock override for deterministic tests. */
|
|
54
|
-
now?: () => number;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
58
|
-
* Dispatch a configured loop by mode. Fails loud (throws `ConfigError`) when no
|
|
59
|
-
* runner is registered for the mode — a routine pointed at an unwired mode is a
|
|
60
|
-
* config bug, not a silent no-op. A runner that throws is captured as
|
|
61
|
-
* `{ ok: false }` so unattended runs record the failure rather than crash.
|
|
62
|
-
*
|
|
63
|
-
* @experimental
|
|
64
|
-
*/
|
|
65
|
-
declare function runDelegatedLoop<T = unknown>(mode: DelegatedLoopMode, registry: DelegatedLoopRegistry, options?: RunDelegatedLoopOptions): Promise<DelegatedLoopResult<T>>;
|
|
66
|
-
/** @experimental Options for the local-repo `code` runner over the GENERIC recursive path. */
|
|
67
|
-
interface WorktreeLoopRunnerOptions {
|
|
68
|
-
/** Absolute path to the local git checkout each worktree is cut from. */
|
|
69
|
-
repoRoot: string;
|
|
70
|
-
/** The instruction handed to every authored harness (composed under each profile's systemPrompt). */
|
|
71
|
-
taskPrompt: string;
|
|
72
|
-
/** The supervisor-authored harness profiles — one fanout item (one worktree-CLI leaf) each. */
|
|
73
|
-
harnesses: ReadonlyArray<AuthoredHarness>;
|
|
74
|
-
/** Conserved budget pool bounding the fanout (equal-k holds by construction). */
|
|
75
|
-
budget: Budget;
|
|
76
|
-
/** Shell command run in each worktree to derive the tests-PASS signal. */
|
|
77
|
-
testCmd?: string;
|
|
78
|
-
/** Shell command run in each worktree to derive the typecheck-PASS signal. */
|
|
79
|
-
typecheckCmd?: string;
|
|
80
|
-
/** Which verification signals the deliverable REQUIRES present-and-passing (default none). */
|
|
81
|
-
require?: ReadonlyArray<'tests' | 'typecheck'>;
|
|
82
|
-
/** Diff-size cap (lines). */
|
|
83
|
-
maxDiffLines?: number;
|
|
84
|
-
/** Literal path prefixes the patch must not touch (the secret-floor is always on regardless). */
|
|
85
|
-
forbiddenPaths?: string[];
|
|
86
|
-
/** Winner-selection strategy among gated candidates. Default `highest-score`. */
|
|
87
|
-
winnerStrategy?: WinnerStrategy;
|
|
88
|
-
/** Test seams forwarded to the worktree-CLI leaves so the runner drives offline. */
|
|
89
|
-
runGit?: WorktreeFanoutOptions['runGit'];
|
|
90
|
-
runHarness?: WorktreeFanoutOptions['runHarness'];
|
|
91
|
-
runCommand?: WorktreeFanoutOptions['runCommand'];
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
*
|
|
95
|
-
* `code` mode on the GENERIC recursive path: author one `AgentProfile` per harness, run them as a
|
|
96
|
-
* `worktreeFanout` (N `createWorktreeCliExecutor` leaves, each `gateOnDeliverable`) through
|
|
97
|
-
* `runPersonified` on the keystone Supervisor. The sandbox-session counterpart that drives the in-box
|
|
98
|
-
* harness over a `SandboxClient` is `detachedSessionDelegate` (`./mcp/delegates`); here there is no
|
|
99
|
-
* `runAgentRounds` driver, no role-coupled delegate — the harness list is the fanout, the gate is
|
|
100
|
-
* `patchDelivered`,
|
|
101
|
-
* the winner is the shared valid-only selector (NOT `defaultSelectWinner`, whose non-valid fallback
|
|
102
|
-
* would surface an ungated patch). Equal-k holds by the conserved budget pool. Returns the winning
|
|
103
|
-
* patch artifact, or throws when no candidate is delivered (fail loud, never a vacuous done).
|
|
104
|
-
*
|
|
105
|
-
* @experimental
|
|
106
|
-
*/
|
|
107
|
-
declare function worktreeLoopRunner(options: WorktreeLoopRunnerOptions): DelegatedLoopRunner<WorktreePatchArtifact>;
|
|
108
|
-
/** @experimental A fact rejected at the KB gate — surfaced, never dropped. */
|
|
109
|
-
interface VetoedFact {
|
|
110
|
-
candidate: FactCandidate;
|
|
111
|
-
vetoedBy?: string;
|
|
112
|
-
reason?: string;
|
|
113
|
-
}
|
|
114
|
-
/** @experimental */
|
|
115
|
-
interface ResearchLoopResult {
|
|
116
|
-
/** Facts that passed the fail-closed gate — safe to write to the KB. */
|
|
117
|
-
accepted: FactCandidate[];
|
|
118
|
-
/** Facts the gate vetoed in the final round — escalate, do not silently drop. */
|
|
119
|
-
vetoed: VetoedFact[];
|
|
120
|
-
/** Research rounds actually run. */
|
|
121
|
-
rounds: number;
|
|
122
|
-
}
|
|
123
|
-
/** @experimental Options for the default `research` runner. */
|
|
124
|
-
interface ResearchLoopRunnerOptions {
|
|
125
|
-
/**
|
|
126
|
-
* The research engine (the consumer's web/doc searcher + extractor). Called
|
|
127
|
-
* each round with the prior round's vetoes so it can re-research the gaps.
|
|
128
|
-
* Returns fact candidates carrying their grounding (`verbatimPassage` +
|
|
129
|
-
* `sourceText`).
|
|
130
|
-
*/
|
|
131
|
-
research: (round: number, vetoed: VetoedFact[]) => Promise<FactCandidate[]>;
|
|
132
|
-
/** Gate config (extra judges, self-artifact kinds, …). The floor is always on. */
|
|
133
|
-
gate?: CreateKbGateOptions;
|
|
134
|
-
/** Max research rounds (correct-on-veto remediation). Default 1. */
|
|
135
|
-
maxRounds?: number;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* `research` mode — research-in-a-loop with valid-only KB growth.
|
|
139
|
-
*
|
|
140
|
-
* Each round: research → gate every candidate (fail-closed; passage MUST be in
|
|
141
|
-
* the source) → accept the clean ones → re-research the vetoed ones next round,
|
|
142
|
-
* up to `maxRounds`. Vetoed facts in the final round are RETURNED (escalate,
|
|
143
|
-
* never silently dropped) so the caller audits vs retries.
|
|
144
|
-
*
|
|
145
|
-
* @experimental
|
|
146
|
-
*/
|
|
147
|
-
declare function researchLoopRunner(o: ResearchLoopRunnerOptions): DelegatedLoopRunner<ResearchLoopResult>;
|
|
148
|
-
/**
|
|
149
|
-
* `audit` mode — analyst loop over captured trace/run data.
|
|
150
|
-
*
|
|
151
|
-
* @experimental
|
|
152
|
-
*/
|
|
153
|
-
declare function auditLoopRunner<TProposal = unknown, TEdit = unknown>(options: RunAnalystLoopOpts): DelegatedLoopRunner<RunAnalystLoopResult<TProposal, TEdit>>;
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
*
|
|
157
|
-
* `agent-runtime-loop` — the schedulable entrypoint for the configured
|
|
158
|
-
* delegated loop-runner. A cron job / routine / Makefile target invokes:
|
|
159
|
-
*
|
|
160
|
-
* agent-runtime-loop --mode research --config ./loops.config.js
|
|
161
|
-
*
|
|
162
|
-
* The config module wires the registry (with full access to env / creds —
|
|
163
|
-
* which is why the deps live there, not in this generic bin). It must default-
|
|
164
|
-
* export a `DelegatedLoopRegistry`, or a `() => DelegatedLoopRegistry | Promise<…>`.
|
|
165
|
-
* The bin runs the selected mode, prints the `DelegatedLoopResult` as JSON, and
|
|
166
|
-
* exits 0 on `ok`, 1 on a recorded failure, 2 on a usage/config error.
|
|
167
|
-
*
|
|
168
|
-
* @experimental
|
|
169
|
-
*/
|
|
170
|
-
|
|
171
|
-
/** @experimental Parsed CLI invocation. */
|
|
172
|
-
interface LoopRunnerCliArgs {
|
|
173
|
-
mode: string;
|
|
174
|
-
/** Loads the registry — the bin wires this from `--config`; tests inject a stub. */
|
|
175
|
-
loadRegistry: () => Promise<DelegatedLoopRegistry> | DelegatedLoopRegistry;
|
|
176
|
-
now?: () => number;
|
|
177
|
-
}
|
|
178
|
-
/** @experimental */
|
|
179
|
-
interface LoopRunnerCliResult {
|
|
180
|
-
exitCode: number;
|
|
181
|
-
result?: DelegatedLoopResult;
|
|
182
|
-
error?: string;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
*
|
|
186
|
-
* Pure CLI core (no process / argv / IO) so it's unit-testable: validate the
|
|
187
|
-
* mode, load the registry, dispatch, map to an exit code (0 ok / 1 failed /
|
|
188
|
-
* 2 usage). Exported for embedding in custom runners + tests.
|
|
189
|
-
*
|
|
190
|
-
* @experimental
|
|
191
|
-
*/
|
|
192
|
-
declare function runLoopRunnerCli(args: LoopRunnerCliArgs): Promise<LoopRunnerCliResult>;
|
|
193
|
-
/** Parse `--mode X --config Y` from an argv tail (`process.argv.slice(2)`). */
|
|
194
|
-
declare function parseLoopRunnerArgv(argv: string[]): {
|
|
195
|
-
mode?: string;
|
|
196
|
-
config?: string;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
export { DELEGATED_LOOP_MODES as D, type LoopRunnerCliArgs as L, type ResearchLoopResult as R, type VetoedFact as V, type WorktreeLoopRunnerOptions as W, type DelegatedLoopMode as a, type DelegatedLoopRegistry as b, type DelegatedLoopResult as c, type DelegatedLoopRunner as d, type LoopRunnerCliResult as e, type ResearchLoopRunnerOptions as f, type RunDelegatedLoopOptions as g, auditLoopRunner as h, isDelegatedLoopMode as i, runDelegatedLoop as j, runLoopRunnerCli as k, parseLoopRunnerArgv as p, researchLoopRunner as r, worktreeLoopRunner as w };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/loops.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { O as OpenAIChatTool } from './types-BwoZWq-i.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* OpenAI Chat Completions `tools[]` projection of the queue-bound agent-runtime
|
|
6
|
-
* MCP delegation tools.
|
|
7
|
-
*
|
|
8
|
-
* Use when configuring `createOpenAICompatibleBackend({ tools: ... })` so the
|
|
9
|
-
* model can call `delegate_feedback`, `delegation_status`, and
|
|
10
|
-
* `delegation_history` through the OpenAI-compat transport (tcloud, OpenRouter,
|
|
11
|
-
* OpenAI direct, cli-bridge). The runtime surfaces tool calls as `tool_call`
|
|
12
|
-
* stream events — execution is the caller's responsibility (typically the
|
|
13
|
-
* parent sandbox runtime's MCP mount).
|
|
14
|
-
*
|
|
15
|
-
* Sandbox-SDK callers do NOT need this helper: the sandbox runtime mounts
|
|
16
|
-
* MCP servers natively and the in-sandbox harness discovers tools via the
|
|
17
|
-
* runtime, not via an OpenAI tools array.
|
|
18
|
-
*
|
|
19
|
-
* Tool name + description + JSON-schema are pulled from the canonical
|
|
20
|
-
* `DELEGATE_*` constants exported by `./tools/*` so the projection cannot
|
|
21
|
-
* drift from the server's own validators.
|
|
22
|
-
*
|
|
23
|
-
* @experimental
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* Returns the queue-bound delegation tools projected into OpenAI Chat
|
|
29
|
-
* Completions `tools[]` shape. The order is stable: `delegate_feedback`,
|
|
30
|
-
* `delegation_status`, `delegation_history`.
|
|
31
|
-
*
|
|
32
|
-
* @experimental
|
|
33
|
-
*/
|
|
34
|
-
declare function mcpToolsForRuntimeMcp(): OpenAIChatTool[];
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* Subset filter — return only the projected tools whose `function.name`
|
|
38
|
-
* appears in `names`. Useful for curated mounts (e.g. only the queue-bound
|
|
39
|
-
* delegation tools, omitting `delegate_feedback`). Unknown names are
|
|
40
|
-
* silently ignored; pass an empty array to get an empty result.
|
|
41
|
-
*
|
|
42
|
-
* @experimental
|
|
43
|
-
*/
|
|
44
|
-
declare function mcpToolsForRuntimeMcpSubset(names: ReadonlyArray<string>): OpenAIChatTool[];
|
|
45
|
-
|
|
46
|
-
export { mcpToolsForRuntimeMcpSubset as a, mcpToolsForRuntimeMcp as m };
|