@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/intelligence.d.ts
CHANGED
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import { TraceStore } from
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
import { I as ImproveOptions, a as ImproveResult } from './improve--2A0gK1-.js';
|
|
18
|
-
import '@tangle-network/sandbox';
|
|
19
|
-
import './types-CvNwMzQt.js';
|
|
20
|
-
import '@tangle-network/agent-eval/campaign';
|
|
21
|
-
import './local-harness-CtK9dSny.js';
|
|
22
|
-
import 'node:child_process';
|
|
23
|
-
|
|
1
|
+
import { x as RuntimeStreamEvent } from "./types-C9j4qg6l.js";
|
|
2
|
+
import { d as RunAnalystLoopOpts, f as RunAnalystLoopResult } from "./types-Cja5OTGh.js";
|
|
3
|
+
import { b as LoopTraceEvent } from "./types-BevOjfTY.js";
|
|
4
|
+
import { a as AgentEnvironmentProviderRef, o as AgentEnvironmentProviderRegistry } from "./environment-provider-IUGU3epE.js";
|
|
5
|
+
import { D as RuntimeTelemetryOptions, m as ToolSpec } from "./local-harness-Dh8PJ0ot.js";
|
|
6
|
+
import { h as ExecutePreparedAgentCandidateOptions, o as CreateProtectedAgentCandidateModelPortOptions, p as PrepareAgentCandidateExecutionOptions, u as parseAgentCandidateProfileActivation, x as AgentCandidateExecutionClaimStore } from "./protected-model-port-BP6Z4eau.js";
|
|
7
|
+
import { D as AgentCandidateTaskExecution, E as AgentCandidateRunFinalization, a as AgentCandidateExecutionPorts, c as AgentCandidateExecutorPort, r as AgentCandidateBenchmarkGraderPort, y as AgentCandidateOutputArtifactPort } from "./types-BaIpb0XT.js";
|
|
8
|
+
import { S as ImproveResult, h as ImproveMethodResult, n as defaultRedactor, r as resolveRedactor, t as Redactor, v as ImproveOptions } from "./redact-kbIOjfjM.js";
|
|
9
|
+
import { a as AgentImprovementActivationTransitionInput, c as CreateAgentImprovementActivationResultOptions, d as ProfileImprovementActivationTransitionInput, f as SealedCandidateActivationTransitionInput, h as verifyAgentImprovementActivationResult, i as AgentImprovementActivationTransition, l as ExecuteAgentImprovementActivationInput, m as executeAgentImprovementActivation, n as AgentImprovementActivationResultStore, o as AgentProfileImprovementActivationOperation, p as createAgentImprovementActivationResult, r as AgentImprovementActivationTargetPlan, s as AgentProfileImprovementActivationTargetPlan, t as AgentImprovementActivationReconciliation, u as ExecuteAgentImprovementActivationOptions } from "./activation-DyWB0K6E.js";
|
|
10
|
+
import { TraceStore } from "@tangle-network/agent-eval";
|
|
11
|
+
import { OptimizationMethodComparison, OptimizationPackageSource, OptimizationTokenUsage } from "@tangle-network/agent-eval/campaign";
|
|
12
|
+
import { AgentCandidateBenchmarkCellRef, AgentCandidateBundle, AgentCandidateExperiment, AgentCandidateExperimentMaterial, AgentCandidateExperimentMeasurement, AgentCandidateProfileActivation as CandidateProfileMaterialization, AgentImprovementActivation, AgentImprovementActivation as AgentImprovementActivation$1, AgentImprovementActivationIntent, AgentImprovementActivationIntent as AgentImprovementActivationIntent$1, AgentImprovementActivationOutcome, AgentImprovementActivationResult, AgentImprovementActivationTarget, AgentImprovementActivationTargetState, AgentImprovementActivationTargetTransition, AgentImprovementEvaluation, AgentImprovementEvaluation as AgentImprovementEvaluation$1, AgentImprovementMeasuredComparison, AgentImprovementMeasuredComparison as AgentImprovementMeasuredComparison$1, AgentImprovementProposal, AgentImprovementProposal as AgentImprovementProposal$1, AgentImprovementReview, AgentImprovementReview as AgentImprovementReview$1, AgentImprovementReviewDecision, AgentImprovementReviewDecision as AgentImprovementReviewDecision$1, AgentImprovementSurface, AgentProfile as AgentProfile$1, AgentProfileDiff, AgentProfileImprovementChange, AgentProfileImprovementExperiment, AgentProfileMcpServer, CandidateExecutionEvidence, CandidateExecutionEvidence as CandidateExecutionEvidence$1, Sha256Digest } from "@tangle-network/agent-interface";
|
|
13
|
+
import { CandidateExperimentExecutionInput, CompareCandidateExperimentOptions, Scenario as Scenario$1 } from "@tangle-network/agent-eval/contract";
|
|
14
|
+
import { AnalystFinding as AnalystFinding$1 } from "@tangle-network/agent-eval/analyst";
|
|
15
|
+
import { AgentExactProcessResources } from "@tangle-network/agent-interface/environment-provider";
|
|
16
|
+
//#region src/intelligence/effort.d.ts
|
|
24
17
|
/**
|
|
25
18
|
*
|
|
26
19
|
* EffortPolicy — pure data, no execution. Resolves a named tier into a flat
|
|
@@ -50,21 +43,21 @@ type CorpusAccess = 'off' | 'read' | 'read-write';
|
|
|
50
43
|
* self-executing.
|
|
51
44
|
*/
|
|
52
45
|
interface EffortSettings {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
46
|
+
/** Whether trace-derived analyst diagnosis may spawn. `false` ⇒ no analyst. */
|
|
47
|
+
analysts: boolean;
|
|
48
|
+
/** Cross-run corpus access this tier permits. */
|
|
49
|
+
corpus: CorpusAccess;
|
|
50
|
+
/** Parallel candidate width. `1` ⇒ single-shot, no breadth. */
|
|
51
|
+
fanout: number;
|
|
52
|
+
/** Whether multi-step improvement loops (refine / fanout-vote) may run. */
|
|
53
|
+
loops: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Ceiling, in USD, for INTELLIGENCE-class spawns only (analysts, corpus,
|
|
56
|
+
* loops) — NOT base inference. `0` refuses every intelligence spawn; `null`
|
|
57
|
+
* means uncapped (the spend lands on the Pareto receipt). Base-stream
|
|
58
|
+
* inference is billed on its own channel and is never constrained here.
|
|
59
|
+
*/
|
|
60
|
+
intelligenceBudgetUsd: number | null;
|
|
68
61
|
}
|
|
69
62
|
/** Per-field overrides applied on top of a tier preset. Any subset of the
|
|
70
63
|
* resolved settings; each provided field wins over the preset. */
|
|
@@ -112,14 +105,14 @@ declare function isIntelligenceOff(settings: EffortSettings): boolean;
|
|
|
112
105
|
* the billing clamp (passed verbatim; `0` refuses every intelligence spawn).
|
|
113
106
|
*/
|
|
114
107
|
interface EffortOverridesCompiled {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
108
|
+
/** Construct + pass a `ScopeAnalyst`? `false` ⇒ omit it (degrade to the base agent). */
|
|
109
|
+
withAnalyst: boolean;
|
|
110
|
+
/** `ShapeBudget.fanout` width to pass to `runPersonified`. */
|
|
111
|
+
fanout: number;
|
|
112
|
+
/** Run the multi-step improvement cycle, or no-op it for this run? */
|
|
113
|
+
withLoops: boolean;
|
|
114
|
+
/** Intelligence-class spend ceiling. `0` refuses every intelligence spawn; `null` uncapped. */
|
|
115
|
+
intelligenceBudgetUsd: number | null;
|
|
123
116
|
}
|
|
124
117
|
/**
|
|
125
118
|
* Compile resolved `EffortSettings` into the orchestration overrides above. Pure: same
|
|
@@ -133,93 +126,33 @@ interface EffortOverridesCompiled {
|
|
|
133
126
|
* compile to `withAnalyst: true`, the tier's `fanout`, and `withLoops: true`.
|
|
134
127
|
*/
|
|
135
128
|
declare function compileEffort(settings: EffortSettings): EffortOverridesCompiled;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
*
|
|
139
|
-
* Redaction for Intelligence trace export. The trace carries the customer's
|
|
140
|
-
* real input/output; before any of it leaves the process it passes through a
|
|
141
|
-
* `Redactor`. The default scrubs the obvious leak classes (API keys, bearer
|
|
142
|
-
* tokens, emails, private keys) from strings and walks nested objects/arrays,
|
|
143
|
-
* but a customer with domain-specific PII supplies their own `redact` hook.
|
|
144
|
-
*
|
|
145
|
-
* This is intentionally narrower than `src/sanitize.ts` (which redacts the
|
|
146
|
-
* runtime's *event envelope* field-by-field): here the value is opaque
|
|
147
|
-
* customer payload, so the scrub is value-shaped, not schema-shaped.
|
|
148
|
-
*
|
|
149
|
-
* @experimental
|
|
150
|
-
*/
|
|
151
|
-
/** A redactor maps an arbitrary trace value to a safe-to-export value. Pure;
|
|
152
|
-
* must not throw on cyclic input (the default tolerates cycles). */
|
|
153
|
-
type Redactor = (value: unknown) => unknown;
|
|
154
|
-
/**
|
|
155
|
-
* The built-in redactor. Walks objects and arrays; replaces values under
|
|
156
|
-
* secret-bearing keys wholesale; scrubs in-value patterns from every string.
|
|
157
|
-
* Cycle-safe (a seen-set short-circuits self-referential payloads to
|
|
158
|
-
* `'[circular]'`), depth-bounded, and total — never throws on customer input.
|
|
159
|
-
*/
|
|
160
|
-
declare function defaultRedactor(value: unknown): unknown;
|
|
161
|
-
/**
|
|
162
|
-
* Resolve the redactor a client uses. A caller-supplied hook replaces the
|
|
163
|
-
* default entirely (the customer owns their PII rules); absent one, the
|
|
164
|
-
* built-in `defaultRedactor` runs. Returning `false` is the explicit opt-out —
|
|
165
|
-
* NO redaction, for a caller who has already sanitized upstream and wants raw
|
|
166
|
-
* fidelity. Opt-out is loud (an explicit `false`), never a silent default.
|
|
167
|
-
*/
|
|
168
|
-
declare function resolveRedactor(redact: Redactor | false | undefined): Redactor;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
*
|
|
172
|
-
* Tangle Intelligence — the RECEIVE half of the loop (pull-by-default).
|
|
173
|
-
*
|
|
174
|
-
* The sibling Observe path (`./index`) sends run records UP to the plane. This
|
|
175
|
-
* module pulls certified artifacts DOWN: it reads the tenant's promoted,
|
|
176
|
-
* gate-certified profile from the deployed Intelligence plane so an approved
|
|
177
|
-
* improvement actually reaches the running agent. The pull carries three things
|
|
178
|
-
* the plane already composes:
|
|
179
|
-
* - the certified PROMPT surface + prompt-folding artifacts (delivered into the
|
|
180
|
-
* system prompt via {@link composeCertifiedPrompt} — the promoted prompt);
|
|
181
|
-
* - the typed profile DIFFS the plane has promoted, each with its held-out
|
|
182
|
-
* provenance (surfaced as PROPOSALS — never auto-applied at runtime);
|
|
183
|
-
* - the composed `agentProfile` those diffs fold to, for inspection.
|
|
184
|
-
*
|
|
185
|
-
* Pull contract (deployed plane): GET /v1/profiles/:target/composed →
|
|
186
|
-
* { target, generatedAt,
|
|
187
|
-
* promptSurface: {surface,surfaceHash,version,lift}|null,
|
|
188
|
-
* artifacts: { <artifactType>: [{path,content,contentHash,version,lift,promotedAt}] },
|
|
189
|
-
* capabilities: [{id,iface:{surface},binding:{path,content},provenance}],
|
|
190
|
-
* agentProfileDiffs: [{diff, provenance:{version,lift,contentHash,promotedAt}}],
|
|
191
|
-
* agentProfile: AgentProfile|null }
|
|
192
|
-
* Auth: Bearer <apiKey> (the one TANGLE_API_KEY shared by router + sandbox +
|
|
193
|
-
* intelligence), resolved to a tenant by platform-api's key-verify S2S contract.
|
|
194
|
-
*
|
|
195
|
-
* @experimental
|
|
196
|
-
*/
|
|
197
|
-
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/intelligence/delivery.d.ts
|
|
198
131
|
/** A promoted, certified artifact (one entry in the composed profile). */
|
|
199
132
|
interface CertifiedArtifact {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
133
|
+
path: string | null;
|
|
134
|
+
content: string;
|
|
135
|
+
contentHash: string;
|
|
136
|
+
version: number | null;
|
|
137
|
+
/** Held-out gate lift attached at certification, e.g. "+3.1pp" — never a
|
|
138
|
+
* within-run claim. `null` when the promotion carried no lift record. */
|
|
139
|
+
lift: string | null;
|
|
140
|
+
promotedAt: string;
|
|
208
141
|
}
|
|
209
142
|
/** The active promoted prompt surface for a target. */
|
|
210
143
|
interface CertifiedPromptSurface {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
144
|
+
surface: string;
|
|
145
|
+
surfaceHash: string;
|
|
146
|
+
version: number | null;
|
|
147
|
+
lift: string | null;
|
|
215
148
|
}
|
|
216
149
|
/** The held-out provenance the plane's certify step stamps on a promoted diff.
|
|
217
150
|
* `lift` is the held-out gate lift (e.g. "+3.1pp"), never a within-run claim. */
|
|
218
151
|
interface DiffProvenance {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
152
|
+
version: number | null;
|
|
153
|
+
lift: string | null;
|
|
154
|
+
contentHash: string;
|
|
155
|
+
promotedAt: string;
|
|
223
156
|
}
|
|
224
157
|
/**
|
|
225
158
|
* A gate-certified profile diff the plane has already promoted, plus the
|
|
@@ -229,61 +162,61 @@ interface DiffProvenance {
|
|
|
229
162
|
* into a shipped profile. It is NEVER auto-applied at runtime.
|
|
230
163
|
*/
|
|
231
164
|
interface ProposedProfileDiff {
|
|
232
|
-
|
|
233
|
-
|
|
165
|
+
diff: AgentProfileDiff;
|
|
166
|
+
provenance: DiffProvenance;
|
|
234
167
|
}
|
|
235
168
|
/** The composed endpoint's per-capability summary — the narrow shape on the
|
|
236
169
|
* wire (id + surface + path/content + provenance). Distinct from the richer
|
|
237
170
|
* `CertifiedCapability` the capability resolver lowers a manifest into. */
|
|
238
171
|
interface CertifiedCapabilitySummary {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
172
|
+
id: string;
|
|
173
|
+
iface: {
|
|
174
|
+
surface: string;
|
|
175
|
+
};
|
|
176
|
+
binding: {
|
|
177
|
+
path: string | null;
|
|
178
|
+
content: string;
|
|
179
|
+
};
|
|
180
|
+
provenance: DiffProvenance;
|
|
248
181
|
}
|
|
249
182
|
/** The composed certified profile — exactly the shape the plane's
|
|
250
183
|
* `GET /v1/profiles/:target/composed` returns. */
|
|
251
184
|
interface CertifiedProfile {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
185
|
+
target: string;
|
|
186
|
+
generatedAt: string;
|
|
187
|
+
promptSurface: CertifiedPromptSurface | null;
|
|
188
|
+
artifacts: Record<string, CertifiedArtifact[]>;
|
|
189
|
+
/** The typed profile diffs the plane has promoted, each with held-out
|
|
190
|
+
* provenance. Surfaced as proposals; never auto-applied. Empty when none. */
|
|
191
|
+
agentProfileDiffs: ProposedProfileDiff[];
|
|
192
|
+
/** The composed capability summaries the plane returns. Empty when none. */
|
|
193
|
+
capabilities: CertifiedCapabilitySummary[];
|
|
194
|
+
/** The composed profile the promoted diffs fold to, for inspection. `null`
|
|
195
|
+
* when no diffs are promoted. */
|
|
196
|
+
agentProfile: AgentProfile$1 | null;
|
|
264
197
|
}
|
|
265
198
|
/** Typed outcome for the pull — inspect `succeeded` before `value`. A 404
|
|
266
199
|
* (nothing promoted yet) is a normal, non-error `succeeded: false`. */
|
|
267
200
|
type PullOutcome = {
|
|
268
|
-
|
|
269
|
-
|
|
201
|
+
succeeded: true;
|
|
202
|
+
value: CertifiedProfile;
|
|
270
203
|
} | {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
204
|
+
succeeded: false;
|
|
205
|
+
error: string;
|
|
206
|
+
status?: number;
|
|
274
207
|
};
|
|
275
208
|
interface PullCertifiedOptions {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
209
|
+
/** The agent target certified artifacts are promoted under. */
|
|
210
|
+
target: string;
|
|
211
|
+
/** Bearer key. Defaults to `process.env.TANGLE_API_KEY`. */
|
|
212
|
+
apiKey?: string;
|
|
213
|
+
/** Plane base URL. Defaults to `process.env.TANGLE_INTELLIGENCE_URL` then
|
|
214
|
+
* `https://intelligence.tangle.tools`. */
|
|
215
|
+
baseUrl?: string;
|
|
216
|
+
/** fetch impl (tests / non-global-fetch runtimes). Defaults to global fetch. */
|
|
217
|
+
fetchImpl?: typeof fetch;
|
|
218
|
+
/** Abort the request after this many ms. Default 10000. */
|
|
219
|
+
timeoutMs?: number;
|
|
287
220
|
}
|
|
288
221
|
/** What Runtime knows about a failed proposal submission.
|
|
289
222
|
* `not-sent` means no request began, `rejected` means Intelligence returned a
|
|
@@ -292,29 +225,29 @@ interface PullCertifiedOptions {
|
|
|
292
225
|
type AgentImprovementProposalSubmissionState = 'not-sent' | 'rejected' | 'unconfirmed';
|
|
293
226
|
/** Submit a completed measured proposal for product-side review. */
|
|
294
227
|
interface SubmitAgentImprovementProposalOptions {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
228
|
+
proposal: AgentImprovementProposal$1;
|
|
229
|
+
/** Bearer key. Defaults to `process.env.TANGLE_API_KEY`. */
|
|
230
|
+
apiKey?: string;
|
|
231
|
+
/** Plane base URL. Defaults to `process.env.TANGLE_INTELLIGENCE_URL` then
|
|
232
|
+
* `https://intelligence.tangle.tools`. */
|
|
233
|
+
baseUrl?: string;
|
|
234
|
+
/** fetch impl (tests / non-global-fetch runtimes). Defaults to global fetch. */
|
|
235
|
+
fetchImpl?: typeof fetch;
|
|
236
|
+
/** Abort the request after this many ms. Default 10000. */
|
|
237
|
+
timeoutMs?: number;
|
|
305
238
|
}
|
|
306
239
|
/** Typed result for proposal submission. A successful result contains the
|
|
307
240
|
* exact immutable proposal Intelligence recorded. */
|
|
308
241
|
type SubmitAgentImprovementProposalOutcome = {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
242
|
+
succeeded: true;
|
|
243
|
+
value: AgentImprovementProposal$1;
|
|
244
|
+
status: number;
|
|
312
245
|
} | {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
246
|
+
succeeded: false;
|
|
247
|
+
submission: AgentImprovementProposalSubmissionState;
|
|
248
|
+
error: string;
|
|
249
|
+
status?: number;
|
|
250
|
+
code?: string;
|
|
318
251
|
};
|
|
319
252
|
/** Resolve the ONE Intelligence base URL — the single knob both the send and
|
|
320
253
|
* receive paths derive from. Env fallback: `TANGLE_INTELLIGENCE_URL`. */
|
|
@@ -358,19 +291,19 @@ declare function composeCertifiedPrompt(base: string, certified: Pick<CertifiedP
|
|
|
358
291
|
* `refreshMs`, coalesces concurrent pulls, keeps the last-known profile on a
|
|
359
292
|
* failed/404 pull, never throws, never blocks past the pull timeout. */
|
|
360
293
|
interface CertifiedPromptSource {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
294
|
+
/** Refresh (window-respecting) then fold the certified additions into a
|
|
295
|
+
* base system prompt. Returns `base` unchanged when nothing is promoted. */
|
|
296
|
+
compose(base: string): Promise<string>;
|
|
297
|
+
/** The certified profile currently in effect (`null` = none pulled yet). */
|
|
298
|
+
current(): CertifiedProfile | null;
|
|
299
|
+
/** Pull now if the refresh window has elapsed; coalesced and fail-closed. */
|
|
300
|
+
refresh(): Promise<void>;
|
|
368
301
|
}
|
|
369
302
|
/** Options for {@link createCertifiedPromptSource} — the pull coordinates plus
|
|
370
303
|
* the refresh cadence. */
|
|
371
304
|
interface CertifiedPromptSourceOptions extends PullCertifiedOptions {
|
|
372
|
-
|
|
373
|
-
|
|
305
|
+
/** Min interval between certified-profile pulls. Default 5m. */
|
|
306
|
+
refreshMs?: number;
|
|
374
307
|
}
|
|
375
308
|
/**
|
|
376
309
|
* Create the cached certified-prompt source — the ONE module-scope-cache +
|
|
@@ -379,35 +312,8 @@ interface CertifiedPromptSourceOptions extends PullCertifiedOptions {
|
|
|
379
312
|
* `withIntelligence` hook rides this same source for its prompt delivery.
|
|
380
313
|
*/
|
|
381
314
|
declare function createCertifiedPromptSource(opts: CertifiedPromptSourceOptions): CertifiedPromptSource;
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
*
|
|
385
|
-
* The Capability-Delivery Manifest — the unified, future-proof structure for
|
|
386
|
-
* delivering ONE certified unit of agent power = `{ interface, binding }`.
|
|
387
|
-
*
|
|
388
|
-
* The law that makes it future-proof: **interfaces are closed; bindings are
|
|
389
|
-
* open.** The interface is the only thing the agent and the certify lane ever
|
|
390
|
-
* reason about (a tool / an MCP toolset / a prompt-context / a retrieval surface
|
|
391
|
-
* / a hook / a subagent). The binding is a tagged union over runtime kinds that
|
|
392
|
-
* the resolver collapses (inline / file / http / sandbox-code / mcp-stdio /
|
|
393
|
-
* mcp-remote / process-on-infra / rag-index / memory-store / wasm / a2a). A new
|
|
394
|
-
* runtime kind = one new binding arm + one resolver case; nothing else moves.
|
|
395
|
-
*
|
|
396
|
-
* This module owns the manifest TYPES and the lowering of TODAY's wire
|
|
397
|
-
* (`CertifiedProfile`) into a `CapabilityManifest`. The resolver — the single
|
|
398
|
-
* place that knows binding kinds and produces a uniform `ResolvedSurface` — lives
|
|
399
|
-
* in `./resolver`. The shipped prompt-only path (`composeCertifiedPrompt` in
|
|
400
|
-
* `./delivery`) is preserved verbatim: a prompt is a `Capability{ surface:
|
|
401
|
-
* 'context', binding:{ kind:'inline' } }`, so the existing
|
|
402
|
-
* `pullCertified → composeCertifiedPrompt → fail-closed` lane is a strict subset.
|
|
403
|
-
*
|
|
404
|
-
* Layering: this depends DOWN on `@tangle-network/sandbox` (the SDK
|
|
405
|
-
* `AgentProfileMcpServer` shape the mcp binding lowers to) and on the runtime's
|
|
406
|
-
* own `ToolSpec`. It never imports agent-eval and never reaches upward.
|
|
407
|
-
*
|
|
408
|
-
* @experimental
|
|
409
|
-
*/
|
|
410
|
-
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region src/intelligence/capability.d.ts
|
|
411
317
|
/** A JSON Schema object describing a tool's parameters. Kept structural — the
|
|
412
318
|
* resolver forwards it verbatim into a `ToolSpec` / MCP `tools/list` check. */
|
|
413
319
|
type JsonSchema = Record<string, unknown>;
|
|
@@ -416,32 +322,32 @@ type JsonSchema = Record<string, unknown>;
|
|
|
416
322
|
* arm maps slot-for-slot onto `AgentProfile` + the host `RouterToolsSeam`.
|
|
417
323
|
*/
|
|
418
324
|
type CapabilityInterface = {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
325
|
+
surface: 'tool';
|
|
326
|
+
name: string;
|
|
327
|
+
description?: string;
|
|
328
|
+
parameters: JsonSchema;
|
|
329
|
+
returns?: JsonSchema;
|
|
424
330
|
} | {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
331
|
+
surface: 'mcp';
|
|
332
|
+
serverName: string;
|
|
333
|
+
toolset?: string[];
|
|
428
334
|
} | {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
335
|
+
surface: 'context';
|
|
336
|
+
kind: 'prompt-surface' | 'skill' | 'instructions';
|
|
337
|
+
name: string;
|
|
432
338
|
} | {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
339
|
+
surface: 'retrieval';
|
|
340
|
+
name: string;
|
|
341
|
+
description?: string;
|
|
342
|
+
topK?: number;
|
|
437
343
|
} | {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
344
|
+
surface: 'hook';
|
|
345
|
+
event: string;
|
|
346
|
+
matcher?: string;
|
|
441
347
|
} | {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
348
|
+
surface: 'subagent';
|
|
349
|
+
name: string;
|
|
350
|
+
description?: string;
|
|
445
351
|
};
|
|
446
352
|
/** Every interface surface tag — the closed set the resolver fans into slots. */
|
|
447
353
|
type CapabilitySurface = CapabilityInterface['surface'];
|
|
@@ -450,22 +356,22 @@ type CapabilitySurface = CapabilityInterface['surface'];
|
|
|
450
356
|
* no inlined blob: `github`/`blob` are pointers resolved at provision time.
|
|
451
357
|
*/
|
|
452
358
|
type ContentRef = {
|
|
453
|
-
|
|
454
|
-
|
|
359
|
+
kind: 'inline';
|
|
360
|
+
content: string;
|
|
455
361
|
} | {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
362
|
+
kind: 'github';
|
|
363
|
+
repository?: string;
|
|
364
|
+
path: string;
|
|
365
|
+
ref?: string;
|
|
460
366
|
} | {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
367
|
+
kind: 'blob';
|
|
368
|
+
uri: string;
|
|
369
|
+
sha256: string;
|
|
370
|
+
bytes?: number;
|
|
465
371
|
};
|
|
466
372
|
/** A named secret a binding requires — declared, never carried. */
|
|
467
373
|
interface CredentialRef {
|
|
468
|
-
|
|
374
|
+
key: string;
|
|
469
375
|
}
|
|
470
376
|
/**
|
|
471
377
|
* How a binding authenticates at resolve time. Declared as a REQUIREMENT in the
|
|
@@ -473,16 +379,16 @@ interface CredentialRef {
|
|
|
473
379
|
* never inlined here.
|
|
474
380
|
*/
|
|
475
381
|
type CapabilityAuth = {
|
|
476
|
-
|
|
382
|
+
mode: 'none';
|
|
477
383
|
} | {
|
|
478
|
-
|
|
384
|
+
mode: 'tangle-key';
|
|
479
385
|
} | {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
386
|
+
mode: 'hub-connection';
|
|
387
|
+
providerId: string;
|
|
388
|
+
scopes?: string[];
|
|
483
389
|
} | {
|
|
484
|
-
|
|
485
|
-
|
|
390
|
+
mode: 'secret-ref';
|
|
391
|
+
key: string;
|
|
486
392
|
};
|
|
487
393
|
/**
|
|
488
394
|
* The host a `process-on-infra` binding provisions before its inner binding.
|
|
@@ -491,12 +397,12 @@ type CapabilityAuth = {
|
|
|
491
397
|
* cost; `ports` are the inner server's listen ports the host must expose.
|
|
492
398
|
*/
|
|
493
399
|
interface HostSpec {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
400
|
+
backend: 'sandbox' | 'router' | 'cli';
|
|
401
|
+
image?: string;
|
|
402
|
+
ports?: number[];
|
|
403
|
+
warm?: boolean;
|
|
404
|
+
idleTtlMs?: number;
|
|
405
|
+
costTag?: string;
|
|
500
406
|
}
|
|
501
407
|
/**
|
|
502
408
|
* How a capability is backed. OPEN tagged union — THE extension point. All arms
|
|
@@ -504,57 +410,57 @@ interface HostSpec {
|
|
|
504
410
|
* throws {@link CapabilityNotAdmittedError} at resolve, never silently no-ops.
|
|
505
411
|
*/
|
|
506
412
|
type DeliveryBinding = {
|
|
507
|
-
|
|
508
|
-
|
|
413
|
+
kind: 'inline';
|
|
414
|
+
content: ContentRef;
|
|
509
415
|
} | {
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
416
|
+
kind: 'file';
|
|
417
|
+
path: string;
|
|
418
|
+
content: ContentRef;
|
|
419
|
+
executable?: boolean;
|
|
514
420
|
} | {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
421
|
+
kind: 'http';
|
|
422
|
+
url: string;
|
|
423
|
+
method?: string;
|
|
424
|
+
auth?: CapabilityAuth;
|
|
519
425
|
} | {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
426
|
+
kind: 'sandbox-code';
|
|
427
|
+
entry: string;
|
|
428
|
+
code: ContentRef;
|
|
429
|
+
runtime?: string;
|
|
430
|
+
harness?: string;
|
|
525
431
|
} | {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
432
|
+
kind: 'mcp-stdio';
|
|
433
|
+
command: string;
|
|
434
|
+
args?: string[];
|
|
435
|
+
env?: Record<string, string>;
|
|
436
|
+
cwd?: string;
|
|
531
437
|
} | {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
438
|
+
kind: 'mcp-remote';
|
|
439
|
+
url: string;
|
|
440
|
+
transport: 'http' | 'sse';
|
|
441
|
+
headers?: Record<string, string>;
|
|
536
442
|
} | {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
443
|
+
kind: 'process-on-infra';
|
|
444
|
+
host: HostSpec;
|
|
445
|
+
inner: DeliveryBinding;
|
|
540
446
|
} | {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
447
|
+
kind: 'rag-index';
|
|
448
|
+
index: ContentRef;
|
|
449
|
+
embedModel: string;
|
|
450
|
+
topK?: number;
|
|
545
451
|
} | {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
452
|
+
kind: 'memory-store';
|
|
453
|
+
provision: 'sqlite' | 'neo4j' | 'vector';
|
|
454
|
+
seed?: ContentRef;
|
|
549
455
|
} | {
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
456
|
+
kind: 'wasm';
|
|
457
|
+
module: ContentRef;
|
|
458
|
+
exports: string[];
|
|
553
459
|
} | {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
460
|
+
kind: 'a2a';
|
|
461
|
+
endpoint: string;
|
|
462
|
+
card: ContentRef;
|
|
463
|
+
auth?: CapabilityAuth;
|
|
558
464
|
};
|
|
559
465
|
/** Every binding kind — the open set the resolver dispatches over. */
|
|
560
466
|
type DeliveryBindingKind = DeliveryBinding['kind'];
|
|
@@ -572,19 +478,19 @@ type DeliveryBindingKind = DeliveryBinding['kind'];
|
|
|
572
478
|
* mix of null-path and non-null-path artifacts.
|
|
573
479
|
*/
|
|
574
480
|
interface CertProvenance {
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
481
|
+
contentHash: string;
|
|
482
|
+
version: number | null;
|
|
483
|
+
lift: string | null;
|
|
484
|
+
promotedAt: string;
|
|
485
|
+
sourcePath: string | null;
|
|
580
486
|
}
|
|
581
487
|
/** One certified unit of agent power. */
|
|
582
488
|
interface CertifiedCapability {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
489
|
+
id: string;
|
|
490
|
+
iface: CapabilityInterface;
|
|
491
|
+
binding: DeliveryBinding;
|
|
492
|
+
auth: CapabilityAuth;
|
|
493
|
+
provenance: CertProvenance;
|
|
588
494
|
}
|
|
589
495
|
/**
|
|
590
496
|
* The strict generalization of `CertifiedProfile`. `promptSurface` is kept
|
|
@@ -592,31 +498,31 @@ interface CertifiedCapability {
|
|
|
592
498
|
* capabilities live in `capabilities`.
|
|
593
499
|
*/
|
|
594
500
|
interface CapabilityManifest {
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
501
|
+
target: string;
|
|
502
|
+
generatedAt: string;
|
|
503
|
+
promptSurface: CertifiedPromptSurface | null;
|
|
504
|
+
capabilities: CertifiedCapability[];
|
|
599
505
|
}
|
|
600
506
|
/** One retrieval handle. The agent never learns vector vs graph vs index. */
|
|
601
507
|
interface ResolvedRetrieval {
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
508
|
+
name: string;
|
|
509
|
+
retrieve(query: string, k?: number): Promise<Array<{
|
|
510
|
+
text: string;
|
|
511
|
+
score?: number;
|
|
512
|
+
}>>;
|
|
607
513
|
}
|
|
608
514
|
/** One resolved hook — event + the command/matcher the seam folds into
|
|
609
515
|
* `AgentProfile.hooks`. */
|
|
610
516
|
interface ResolvedHook {
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
517
|
+
event: string;
|
|
518
|
+
command: string;
|
|
519
|
+
matcher?: string;
|
|
614
520
|
}
|
|
615
521
|
/** One resolved subagent — folded into `AgentProfile.subagents`. */
|
|
616
522
|
interface ResolvedSubagent {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
523
|
+
name: string;
|
|
524
|
+
description?: string;
|
|
525
|
+
prompt?: string;
|
|
620
526
|
}
|
|
621
527
|
/**
|
|
622
528
|
* What `composeCertifiedProfile` produces. Every binding fans into the same
|
|
@@ -625,32 +531,32 @@ interface ResolvedSubagent {
|
|
|
625
531
|
* `dispose()` tears provisioned hosts down in REVERSE dependency order.
|
|
626
532
|
*/
|
|
627
533
|
interface ResolvedSurface {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
534
|
+
/** Host-side tool defs → `RouterToolsSeam.tools` / agent-app `extraTools`. */
|
|
535
|
+
tools: ToolSpec[];
|
|
536
|
+
/** Host-side dispatch for a resolved tool. Throws when `name` is unknown so a
|
|
537
|
+
* mis-dispatch is loud, never a silent empty string. */
|
|
538
|
+
execute(name: string, args: Record<string, unknown>, task: unknown): Promise<string>;
|
|
539
|
+
/** Sandbox-side tool delivery → `AgentProfile.mcp` / in-proc `createMcpEnvironment`. */
|
|
540
|
+
mcpConnections: Record<string, AgentProfileMcpServer>;
|
|
541
|
+
/** Prompt-context additions, byte-stable-ordered → folded system prompt. */
|
|
542
|
+
promptAdditions: string[];
|
|
543
|
+
/** Workspace files → `AgentProfile.resources.files`. */
|
|
544
|
+
files: Array<{
|
|
545
|
+
path: string;
|
|
546
|
+
content: string;
|
|
547
|
+
executable?: boolean;
|
|
548
|
+
}>;
|
|
549
|
+
/** Uniform retrieval handles. */
|
|
550
|
+
retrieval: ResolvedRetrieval[];
|
|
551
|
+
/** Hooks → `AgentProfile.hooks`. */
|
|
552
|
+
hooks: ResolvedHook[];
|
|
553
|
+
/** Subagents → `AgentProfile.subagents`. */
|
|
554
|
+
subagents: ResolvedSubagent[];
|
|
555
|
+
/** The folded system prompt — base + the byte-stable prompt additions, exactly
|
|
556
|
+
* as `composeCertifiedPrompt` renders the inline/context capabilities. */
|
|
557
|
+
systemPrompt: string;
|
|
558
|
+
/** Tear down provisioned hosts (reverse dependency order). */
|
|
559
|
+
dispose(): Promise<void>;
|
|
654
560
|
}
|
|
655
561
|
/**
|
|
656
562
|
* A binding kind whose resolver case is typed but not yet admitted (rag-index,
|
|
@@ -659,31 +565,32 @@ interface ResolvedSurface {
|
|
|
659
565
|
* resolver grows them later behind their lifecycle + admission gate.
|
|
660
566
|
*/
|
|
661
567
|
declare class CapabilityNotAdmittedError extends Error {
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
568
|
+
readonly kind: DeliveryBindingKind;
|
|
569
|
+
readonly capabilityId: string;
|
|
570
|
+
constructor(kind: DeliveryBindingKind, capabilityId: string, reason: string);
|
|
665
571
|
}
|
|
666
572
|
/**
|
|
667
573
|
* Lower the EXISTING plane wire (`CertifiedProfile`) into a `CapabilityManifest`.
|
|
668
574
|
* `prompt-surface`/`skill` artifacts → `context`/inline capabilities (the
|
|
669
575
|
* shipped fold, generalized); any other artifact type → best-effort binding
|
|
670
|
-
* inference
|
|
576
|
+
* inference. `promptSurface` is carried through so
|
|
671
577
|
* the resolver folds it first, exactly as `composeCertifiedPrompt` does today.
|
|
672
578
|
* This delivers the spine against today's wire before the plane changes.
|
|
673
579
|
*/
|
|
674
580
|
declare function manifestFromProfile(profile: CertifiedProfile): CapabilityManifest;
|
|
675
|
-
|
|
581
|
+
//#endregion
|
|
582
|
+
//#region src/intelligence/improvement-surfaces.d.ts
|
|
676
583
|
/** Agent improvement surfaces delivered as exact `AgentProfileDiff` replacements. */
|
|
677
584
|
declare const AGENT_IMPROVEMENT_PROFILE_SURFACES: readonly ["prompt", "skills", "tools", "mcp", "hooks", "subagents"];
|
|
678
585
|
type AgentImprovementProfileSurface = (typeof AGENT_IMPROVEMENT_PROFILE_SURFACES)[number];
|
|
679
586
|
interface AgentImprovementTargetProfileDiffOptions {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
587
|
+
id: string;
|
|
588
|
+
source?: AgentProfileDiff['source'];
|
|
589
|
+
metadata?: Record<string, unknown>;
|
|
683
590
|
}
|
|
684
591
|
type AgentImprovementActivationTargetIdentity = Pick<AgentImprovementActivationTarget, 'surface' | 'identity'>;
|
|
685
592
|
/** Bind caller-owned target identities to the exact source state Runtime measured. */
|
|
686
|
-
declare function buildAgentImprovementActivationTargets(surfaces: readonly AgentImprovementSurface[], experiment:
|
|
593
|
+
declare function buildAgentImprovementActivationTargets(surfaces: readonly AgentImprovementSurface[], experiment: AgentImprovementEvaluation$1['experiment'], intent: AgentImprovementActivationIntent$1, identities: readonly AgentImprovementActivationTargetIdentity[]): [AgentImprovementActivationTarget, ...AgentImprovementActivationTarget[]];
|
|
687
594
|
/** Return whether a measured surface can be delivered through an agent profile. */
|
|
688
595
|
declare function isAgentImprovementProfileSurface(surface: AgentImprovementSurface): surface is AgentImprovementProfileSurface;
|
|
689
596
|
/**
|
|
@@ -692,168 +599,169 @@ declare function isAgentImprovementProfileSurface(surface: AgentImprovementSurfa
|
|
|
692
599
|
* Unrelated profile fields are excluded. The result matches `agentImprovementTargetInput` for the
|
|
693
600
|
* same profile inside a candidate bundle.
|
|
694
601
|
*/
|
|
695
|
-
declare function agentImprovementProfileSurfaceInput(profile: AgentProfile, surface: AgentImprovementProfileSurface): unknown;
|
|
602
|
+
declare function agentImprovementProfileSurfaceInput(profile: AgentProfile$1, surface: AgentImprovementProfileSurface): unknown;
|
|
696
603
|
/** Return the `Sha256Digest` of one profile surface using Runtime's canonical candidate digest. */
|
|
697
|
-
declare function agentImprovementProfileSurfaceDigest(profile: AgentProfile, surface: AgentImprovementProfileSurface): Sha256Digest;
|
|
604
|
+
declare function agentImprovementProfileSurfaceDigest(profile: AgentProfile$1, surface: AgentImprovementProfileSurface): Sha256Digest;
|
|
698
605
|
/**
|
|
699
606
|
* Replace one measured profile surface exactly, including array-valued resources.
|
|
700
607
|
* Apply the returned diffs in order: a diff applies its set before its removal,
|
|
701
608
|
* so exact replacement requires a reset record followed by a set record.
|
|
702
609
|
*/
|
|
703
610
|
declare function agentImprovementTargetProfileDiffs(target: {
|
|
704
|
-
|
|
705
|
-
|
|
611
|
+
surface: AgentImprovementProfileSurface;
|
|
612
|
+
desiredInput: unknown;
|
|
706
613
|
}, options: AgentImprovementTargetProfileDiffOptions): [AgentProfileDiff, ...AgentProfileDiff[]];
|
|
707
|
-
|
|
614
|
+
//#endregion
|
|
615
|
+
//#region src/intelligence/improvement-cycle.d.ts
|
|
708
616
|
interface AgentCandidateExperimentCellPlacement {
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
617
|
+
executionId: string;
|
|
618
|
+
attempt?: number;
|
|
619
|
+
executionRoots: AgentCandidateTaskExecution['executionRoots'];
|
|
620
|
+
stagingRoots: AgentCandidateTaskExecution['stagingRoots'];
|
|
621
|
+
ports: AgentCandidateExecutionPorts;
|
|
622
|
+
preparation?: PrepareAgentCandidateExecutionOptions;
|
|
623
|
+
execution: ExecutePreparedAgentCandidateOptions;
|
|
716
624
|
}
|
|
717
625
|
interface RunAgentCandidateExperimentOptions extends Omit<CompareCandidateExperimentOptions, 'experiment' | 'measurements'> {
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
626
|
+
experiment: AgentCandidateExperiment;
|
|
627
|
+
placeCell: (input: CandidateExperimentExecutionInput) => AgentCandidateExperimentCellPlacement | Promise<AgentCandidateExperimentCellPlacement>;
|
|
628
|
+
maxConcurrency?: number;
|
|
629
|
+
signal?: AbortSignal;
|
|
722
630
|
}
|
|
723
631
|
interface RunAgentCandidateExperimentResult {
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
}
|
|
728
|
-
interface ExecuteAgentCandidateExperimentCellOptions extends CandidateExperimentExecutionInput, AgentCandidateExperimentCellPlacement {
|
|
632
|
+
experiment: AgentCandidateExperiment;
|
|
633
|
+
measurements: AgentCandidateExperimentMeasurement[];
|
|
634
|
+
evaluation: AgentImprovementMeasuredComparison$1;
|
|
729
635
|
}
|
|
636
|
+
interface ExecuteAgentCandidateExperimentCellOptions extends CandidateExperimentExecutionInput, AgentCandidateExperimentCellPlacement {}
|
|
730
637
|
interface VerifyCandidateExecutionEvidenceOptions {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
638
|
+
experiment: AgentCandidateExperiment;
|
|
639
|
+
arm: 'baseline' | 'candidate';
|
|
640
|
+
benchmarkCell: AgentCandidateBenchmarkCellRef;
|
|
641
|
+
seed: number;
|
|
642
|
+
attempt?: number;
|
|
643
|
+
resolvedResources?: ReadonlyMap<Sha256Digest, string>;
|
|
737
644
|
}
|
|
738
645
|
/** A failed baseline or candidate cell with its complete Runtime failure result. */
|
|
739
646
|
declare class AgentCandidateExperimentCellExecutionError extends Error {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
647
|
+
readonly finalization: Extract<AgentCandidateRunFinalization, {
|
|
648
|
+
succeeded: false;
|
|
649
|
+
}>;
|
|
650
|
+
constructor(finalization: Extract<AgentCandidateRunFinalization, {
|
|
651
|
+
succeeded: false;
|
|
652
|
+
}>);
|
|
746
653
|
}
|
|
747
654
|
interface CreateAgentImprovementProposalOptions {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
655
|
+
runId: string;
|
|
656
|
+
findings: readonly AnalystFinding$1[];
|
|
657
|
+
evaluation: AgentImprovementEvaluation$1;
|
|
658
|
+
now?: () => Date;
|
|
752
659
|
}
|
|
753
660
|
type CreateAgentImprovementMeasuredComparisonOptions = CompareCandidateExperimentOptions;
|
|
754
661
|
interface ReviewAgentImprovementInput {
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
662
|
+
decision: AgentImprovementReviewDecision$1;
|
|
663
|
+
reviewedBy: string;
|
|
664
|
+
reason: string;
|
|
665
|
+
feedback?: string;
|
|
666
|
+
now?: () => Date;
|
|
760
667
|
}
|
|
761
668
|
interface CreateAgentImprovementActivationOptions {
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
669
|
+
intent: AgentImprovementActivationIntent$1;
|
|
670
|
+
/** Runtime derives each exact source digest; callers identify only the records to change. */
|
|
671
|
+
targets: [AgentImprovementActivationTargetIdentity, ...AgentImprovementActivationTargetIdentity[]];
|
|
672
|
+
fundingOwner: string;
|
|
673
|
+
authorizedBy: string;
|
|
674
|
+
expiresAt: string;
|
|
675
|
+
now?: () => Date;
|
|
769
676
|
}
|
|
770
|
-
interface ProposeAgentImprovementOptions<TScenario extends Scenario, TArtifact> {
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
677
|
+
interface ProposeAgentImprovementOptions<TScenario extends Scenario$1, TArtifact> {
|
|
678
|
+
runId: string;
|
|
679
|
+
profile: AgentProfile$1;
|
|
680
|
+
analysis: Omit<RunAnalystLoopOpts, 'runId' | 'improvementProposalSource'>;
|
|
681
|
+
improvement: ImproveOptions<TScenario, TArtifact>;
|
|
682
|
+
buildExperiment: (input: {
|
|
683
|
+
analysis: RunAnalystLoopResult;
|
|
684
|
+
improvement: ImproveResult<TScenario, TArtifact>;
|
|
685
|
+
}) => AgentImprovementExperimentMaterial | Promise<AgentImprovementExperimentMaterial>;
|
|
686
|
+
placeCell: RunAgentCandidateExperimentOptions['placeCell'];
|
|
687
|
+
maxConcurrency?: number;
|
|
688
|
+
signal?: AbortSignal;
|
|
689
|
+
candidate?: AgentImprovementMeasuredComparison$1['candidate'];
|
|
690
|
+
metadata?: AgentImprovementMeasuredComparison$1['metadata'];
|
|
691
|
+
now?: () => Date;
|
|
785
692
|
}
|
|
786
693
|
/** Product-supplied experiment material. Runtime supplies optimizer ancestry and the final digest. */
|
|
787
694
|
type AgentImprovementExperimentMaterial = Omit<AgentCandidateExperimentMaterial, 'candidateLineage'>;
|
|
788
|
-
interface ProposeAgentImprovementResult<TScenario extends Scenario, TArtifact> {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
695
|
+
interface ProposeAgentImprovementResult<TScenario extends Scenario$1, TArtifact> {
|
|
696
|
+
analysis: RunAnalystLoopResult;
|
|
697
|
+
improvement: ImproveResult<TScenario, TArtifact>;
|
|
698
|
+
experiment: AgentCandidateExperiment;
|
|
699
|
+
measurements: AgentCandidateExperimentMeasurement[];
|
|
700
|
+
proposal: AgentImprovementProposal$1;
|
|
794
701
|
}
|
|
795
702
|
/** Execute both arms of one immutable experiment and derive its paired result. */
|
|
796
703
|
declare function runAgentCandidateExperiment(options: RunAgentCandidateExperimentOptions): Promise<RunAgentCandidateExperimentResult>;
|
|
797
704
|
/** Execute one exact arm, task, repetition, seed, and attempt through Runtime. */
|
|
798
|
-
declare function executeAgentCandidateExperimentCell(options: ExecuteAgentCandidateExperimentCellOptions): Promise<CandidateExecutionEvidence>;
|
|
705
|
+
declare function executeAgentCandidateExperimentCell(options: ExecuteAgentCandidateExperimentCellOptions): Promise<CandidateExecutionEvidence$1>;
|
|
799
706
|
/** Delegate all statistics and promotion checks to agent-eval's receipt-based comparison. */
|
|
800
|
-
declare function createAgentImprovementMeasuredComparison(options: CreateAgentImprovementMeasuredComparisonOptions): AgentImprovementMeasuredComparison;
|
|
707
|
+
declare function createAgentImprovementMeasuredComparison(options: CreateAgentImprovementMeasuredComparisonOptions): AgentImprovementMeasuredComparison$1;
|
|
801
708
|
/** Analyze, search, then remeasure the resulting exact candidate before proposing it. */
|
|
802
|
-
declare function proposeAgentImprovement<TScenario extends Scenario, TArtifact>(options: ProposeAgentImprovementOptions<TScenario, TArtifact>): Promise<ProposeAgentImprovementResult<TScenario, TArtifact>>;
|
|
709
|
+
declare function proposeAgentImprovement<TScenario extends Scenario$1, TArtifact>(options: ProposeAgentImprovementOptions<TScenario, TArtifact>): Promise<ProposeAgentImprovementResult<TScenario, TArtifact>>;
|
|
803
710
|
/** Create the reviewable record only from a complete, recomputable experiment result. */
|
|
804
|
-
declare function createAgentImprovementProposal(options: CreateAgentImprovementProposalOptions): AgentImprovementProposal;
|
|
711
|
+
declare function createAgentImprovementProposal(options: CreateAgentImprovementProposalOptions): AgentImprovementProposal$1;
|
|
805
712
|
/** Persist a human or tenant-policy decision bound to one exact proposal. */
|
|
806
|
-
declare function reviewAgentImprovementProposal(inputProposal: AgentImprovementProposal, input: ReviewAgentImprovementInput): AgentImprovementReview;
|
|
713
|
+
declare function reviewAgentImprovementProposal(inputProposal: AgentImprovementProposal$1, input: ReviewAgentImprovementInput): AgentImprovementReview$1;
|
|
807
714
|
/** Authorize product-owned writes only after the exact candidate was measured and approved. */
|
|
808
|
-
declare function createAgentImprovementActivation(inputProposal: AgentImprovementProposal, inputReview: AgentImprovementReview, options: CreateAgentImprovementActivationOptions): AgentImprovementActivation;
|
|
715
|
+
declare function createAgentImprovementActivation(inputProposal: AgentImprovementProposal$1, inputReview: AgentImprovementReview$1, options: CreateAgentImprovementActivationOptions): AgentImprovementActivation$1;
|
|
809
716
|
/** Validate a proposal and recompute every binding to its measured experiment. */
|
|
810
|
-
declare function verifyAgentImprovementProposal(input: unknown): AgentImprovementProposal;
|
|
717
|
+
declare function verifyAgentImprovementProposal(input: unknown): AgentImprovementProposal$1;
|
|
811
718
|
/** Validate the canonical identity and wire shape of an improvement review. */
|
|
812
|
-
declare function verifyAgentImprovementReview(input: unknown): AgentImprovementReview;
|
|
719
|
+
declare function verifyAgentImprovementReview(input: unknown): AgentImprovementReview$1;
|
|
813
720
|
/** Validate activation authority against the exact proposal, review, experiment, and base state. */
|
|
814
721
|
declare function verifyAgentImprovementActivation(input: {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
}): AgentImprovementActivation;
|
|
722
|
+
proposal: unknown;
|
|
723
|
+
review: unknown;
|
|
724
|
+
activation: unknown;
|
|
725
|
+
}): AgentImprovementActivation$1;
|
|
819
726
|
/** Recheck one Runtime receipt against its exact signed experiment cell. */
|
|
820
|
-
declare function verifyCandidateExecutionEvidence(input: unknown, options: VerifyCandidateExecutionEvidenceOptions): CandidateExecutionEvidence;
|
|
821
|
-
|
|
727
|
+
declare function verifyCandidateExecutionEvidence(input: unknown, options: VerifyCandidateExecutionEvidenceOptions): CandidateExecutionEvidence$1;
|
|
728
|
+
//#endregion
|
|
729
|
+
//#region src/intelligence/exact-process-candidate.d.ts
|
|
822
730
|
/** Candidate surfaces implemented by the neutral exact-process executor. */
|
|
823
731
|
declare const exactProcessCandidateExperimentExecutionSupport: Readonly<{
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
732
|
+
outcomes: readonly ["output"];
|
|
733
|
+
outputMediaTypes: readonly ["text/*", "application/json", "*+json"];
|
|
734
|
+
code: readonly ["disabled"];
|
|
735
|
+
memory: readonly ["disabled"];
|
|
736
|
+
knowledge: true;
|
|
737
|
+
profile: Readonly<{
|
|
738
|
+
mcpTransports: readonly ["stdio"];
|
|
739
|
+
remoteMcp: false;
|
|
740
|
+
tools: false;
|
|
741
|
+
permissions: false;
|
|
742
|
+
modes: false;
|
|
743
|
+
confidential: false;
|
|
744
|
+
}>;
|
|
745
|
+
isolation: Readonly<{
|
|
746
|
+
freshEnvironment: true;
|
|
747
|
+
exactProcess: true;
|
|
748
|
+
egress: readonly ["blocked", "strict"];
|
|
749
|
+
}>;
|
|
842
750
|
}>;
|
|
843
751
|
interface CreateExactProcessCandidateExperimentExecutorOptions {
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
752
|
+
provider: AgentEnvironmentProviderRef;
|
|
753
|
+
providerRegistry?: AgentEnvironmentProviderRegistry;
|
|
754
|
+
resources: AgentExactProcessResources;
|
|
755
|
+
providerOptions?: Record<string, unknown>;
|
|
756
|
+
provisionTimeoutMs?: number;
|
|
757
|
+
recoveryRetentionMs?: number;
|
|
758
|
+
ports: AgentCandidateExecutionPorts;
|
|
759
|
+
grader: AgentCandidateBenchmarkGraderPort;
|
|
760
|
+
outputArtifacts: AgentCandidateOutputArtifactPort;
|
|
761
|
+
traceStore: TraceStore;
|
|
762
|
+
claimStore: AgentCandidateExecutionClaimStore;
|
|
763
|
+
cleanupTimeoutMs?: number;
|
|
764
|
+
resultTimeoutMs?: number;
|
|
857
765
|
}
|
|
858
766
|
/** Product-owned candidate ports other than protected model access. */
|
|
859
767
|
type AgentCandidateExecutionHostPorts = Omit<AgentCandidateExecutionPorts, 'models'>;
|
|
@@ -862,107 +770,138 @@ type AgentCandidateExecutionHostPorts = Omit<AgentCandidateExecutionPorts, 'mode
|
|
|
862
770
|
* metered, and settled by the caller's grant service.
|
|
863
771
|
*/
|
|
864
772
|
interface CreateProtectedExactProcessCandidateExperimentExecutorOptions extends Omit<CreateExactProcessCandidateExperimentExecutorOptions, 'ports'> {
|
|
865
|
-
|
|
866
|
-
|
|
773
|
+
hostPorts: AgentCandidateExecutionHostPorts;
|
|
774
|
+
model: CreateProtectedAgentCandidateModelPortOptions;
|
|
867
775
|
}
|
|
868
776
|
interface ExactProcessCandidateExperimentExecution extends CandidateExperimentExecutionInput {
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
777
|
+
executionId: string;
|
|
778
|
+
attempt?: number;
|
|
779
|
+
executionRoots: AgentCandidateExperimentCellPlacement['executionRoots'];
|
|
780
|
+
stagingRoots: AgentCandidateExperimentCellPlacement['stagingRoots'];
|
|
781
|
+
preparation?: PrepareAgentCandidateExecutionOptions;
|
|
874
782
|
}
|
|
875
783
|
interface ExactProcessCandidateExperimentExecutor {
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
784
|
+
/** Runtime's expired-attempt path reuses this port only to stop and dispose. */
|
|
785
|
+
readonly executor: AgentCandidateExecutorPort;
|
|
786
|
+
execute(input: ExactProcessCandidateExperimentExecution): Promise<CandidateExecutionEvidence$1>;
|
|
879
787
|
}
|
|
880
788
|
/** Exact-process executor plus the ports required for durable recovery. */
|
|
881
789
|
interface ProtectedExactProcessCandidateExperimentExecutor extends ExactProcessCandidateExperimentExecutor {
|
|
882
|
-
|
|
790
|
+
readonly recoveryPorts: Pick<AgentCandidateExecutionPorts, 'models' | 'memory'>;
|
|
883
791
|
}
|
|
884
792
|
/** Execute one signed experiment cell through any declared exact-process provider. */
|
|
885
793
|
declare function createExactProcessCandidateExperimentExecutor(options: CreateExactProcessCandidateExperimentExecutorOptions): ExactProcessCandidateExperimentExecutor;
|
|
886
794
|
/** Compose host-owned execution ports with protected model access for one exact-process run. */
|
|
887
795
|
declare function createProtectedExactProcessCandidateExperimentExecutor(options: CreateProtectedExactProcessCandidateExperimentExecutorOptions): ProtectedExactProcessCandidateExperimentExecutor;
|
|
888
|
-
|
|
796
|
+
//#endregion
|
|
797
|
+
//#region src/intelligence/optimization-receipt.d.ts
|
|
798
|
+
type OptimizationProvenance = NonNullable<OptimizationMethodComparison['best']['provenance']>;
|
|
799
|
+
interface OptimizationActivationReceipt {
|
|
800
|
+
kind: 'optimization-activation-receipt';
|
|
801
|
+
method: string;
|
|
802
|
+
source: OptimizationPackageSource;
|
|
803
|
+
bridge?: OptimizationPackageSource;
|
|
804
|
+
modules?: OptimizationProvenance['modules'];
|
|
805
|
+
python?: OptimizationProvenance['python'];
|
|
806
|
+
models?: {
|
|
807
|
+
candidate?: NonNullable<AgentProfile$1['model']>;
|
|
808
|
+
optimizer?: string;
|
|
809
|
+
};
|
|
810
|
+
usage: {
|
|
811
|
+
optimizerEvaluations: number;
|
|
812
|
+
optimizerTokens?: OptimizationTokenUsage;
|
|
813
|
+
};
|
|
814
|
+
cost: {
|
|
815
|
+
optimization: OptimizationReceiptCost;
|
|
816
|
+
finalTest: OptimizationReceiptCost;
|
|
817
|
+
total: OptimizationReceiptCost;
|
|
818
|
+
};
|
|
819
|
+
invocation: {
|
|
820
|
+
runtimeInvocationId: string;
|
|
821
|
+
optimizerRunId: string;
|
|
822
|
+
compatibleOptimizerRunId?: string;
|
|
823
|
+
resumed: boolean;
|
|
824
|
+
artifactDir: string;
|
|
825
|
+
};
|
|
826
|
+
developmentDataDigest: Sha256Digest;
|
|
827
|
+
digest: Sha256Digest;
|
|
828
|
+
}
|
|
829
|
+
interface OptimizationReceiptCost {
|
|
830
|
+
totalUsd: number;
|
|
831
|
+
accountingComplete: boolean;
|
|
832
|
+
incompleteReasons: string[];
|
|
833
|
+
}
|
|
834
|
+
/** Build a detached receipt only for methods backed by an identified external optimizer. */
|
|
835
|
+
declare function createOptimizationActivationReceipt(improvement: ImproveMethodResult): OptimizationActivationReceipt | undefined;
|
|
836
|
+
/** Read and verify the optimizer evidence carried by a measured proposal. */
|
|
837
|
+
declare function optimizationActivationReceiptFromMetadata(metadata: AgentImprovementMeasuredComparison$1['metadata']): OptimizationActivationReceipt | undefined;
|
|
838
|
+
//#endregion
|
|
839
|
+
//#region src/intelligence/profile-activation.d.ts
|
|
889
840
|
type AgentImprovementProfileActivationTarget = Omit<AgentImprovementActivationTargetPlan, 'surface'> & {
|
|
890
|
-
|
|
841
|
+
surface: AgentImprovementProfileSurface;
|
|
891
842
|
};
|
|
892
843
|
type AgentImprovementProfileTargetState = Omit<AgentImprovementActivationTargetState, 'surface'> & {
|
|
893
|
-
|
|
844
|
+
surface: AgentImprovementProfileSurface;
|
|
894
845
|
};
|
|
895
846
|
type AgentImprovementProfileTargetTransition = Omit<AgentImprovementActivationTargetTransition, 'surface'> & {
|
|
896
|
-
|
|
847
|
+
surface: AgentImprovementProfileSurface;
|
|
897
848
|
};
|
|
898
849
|
interface AgentImprovementProfileReplacement {
|
|
899
|
-
|
|
900
|
-
|
|
850
|
+
identity: string;
|
|
851
|
+
profile: AgentProfile$1;
|
|
852
|
+
}
|
|
853
|
+
interface AgentImprovementProfileStateDigestInput {
|
|
854
|
+
identity: string;
|
|
855
|
+
profile: AgentProfile$1;
|
|
901
856
|
}
|
|
857
|
+
/** Product-defined hash of the complete profile state that actually runs. */
|
|
858
|
+
type AgentImprovementProfileStateDigest = (input: AgentImprovementProfileStateDigestInput) => Sha256Digest;
|
|
859
|
+
interface AgentImprovementProfileStateResolverInput {
|
|
860
|
+
identity: string;
|
|
861
|
+
stateDigest: Sha256Digest;
|
|
862
|
+
}
|
|
863
|
+
/** Product-owned retained-state lookup used only for an explicit restore. */
|
|
864
|
+
type AgentImprovementProfileStateResolver = (input: AgentImprovementProfileStateResolverInput) => AgentProfile$1 | undefined;
|
|
865
|
+
type AgentImprovementProfileActivationInput = {
|
|
866
|
+
currentByIdentity: ReadonlyMap<string, AgentProfile$1>;
|
|
867
|
+
targets: readonly [AgentImprovementProfileActivationTarget, ...AgentImprovementProfileActivationTarget[]];
|
|
868
|
+
} | {
|
|
869
|
+
currentByIdentity: ReadonlyMap<string, AgentProfile$1>;
|
|
870
|
+
profileTransition: ProfileImprovementActivationTransitionInput;
|
|
871
|
+
stateDigest: AgentImprovementProfileStateDigest;
|
|
872
|
+
resolveState?: AgentImprovementProfileStateResolver;
|
|
873
|
+
};
|
|
902
874
|
type AgentImprovementProfileActivationPreparation = {
|
|
903
|
-
|
|
904
|
-
|
|
875
|
+
status: 'missing';
|
|
876
|
+
identities: readonly string[];
|
|
877
|
+
} | {
|
|
878
|
+
status: 'unavailable';
|
|
879
|
+
code: 'PROFILE_STATE_UNAVAILABLE';
|
|
880
|
+
identities: readonly string[];
|
|
881
|
+
requiredStateDigest: Sha256Digest;
|
|
905
882
|
} | {
|
|
906
|
-
|
|
907
|
-
|
|
883
|
+
status: 'already-applied' | 'conflict';
|
|
884
|
+
targets: [AgentImprovementProfileTargetState, ...AgentImprovementProfileTargetState[]];
|
|
908
885
|
} | {
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
AgentImprovementProfileTargetTransition,
|
|
913
|
-
...AgentImprovementProfileTargetTransition[]
|
|
914
|
-
];
|
|
886
|
+
status: 'apply';
|
|
887
|
+
replacements: [AgentImprovementProfileReplacement, ...AgentImprovementProfileReplacement[]];
|
|
888
|
+
targets: [AgentImprovementProfileTargetTransition, ...AgentImprovementProfileTargetTransition[]];
|
|
915
889
|
};
|
|
916
890
|
/**
|
|
917
891
|
* Compare product-owned profiles with an exact measured transition and prepare
|
|
918
|
-
*
|
|
919
|
-
*
|
|
920
|
-
* Profiles stay in product-owned stores, so this returns replacements instead
|
|
921
|
-
* of owning the transition callbacks used by Runtime-owned knowledge stores.
|
|
922
|
-
*/
|
|
923
|
-
declare function prepareAgentImprovementProfileActivation(input: {
|
|
924
|
-
currentByIdentity: ReadonlyMap<string, AgentProfile>;
|
|
925
|
-
targets: readonly [
|
|
926
|
-
AgentImprovementProfileActivationTarget,
|
|
927
|
-
...AgentImprovementProfileActivationTarget[]
|
|
928
|
-
];
|
|
929
|
-
}): AgentImprovementProfileActivationPreparation;
|
|
930
|
-
|
|
931
|
-
/**
|
|
932
|
-
*
|
|
933
|
-
* The capability resolver — the ONLY place that knows binding kinds. It lowers a
|
|
934
|
-
* `CapabilityManifest` into a uniform `ResolvedSurface` consumed identically by
|
|
935
|
-
* the in-process seam (`RouterToolsSeam.{tools, executeToolCall}` + a folded
|
|
936
|
-
* prompt) and the sandbox seam (`AgentProfile`).
|
|
937
|
-
*
|
|
938
|
-
* The spine (zero new infra) resolves inline/file, mcp-stdio/mcp-remote, and
|
|
939
|
-
* http tools for BOTH seams, reusing shipped primitives:
|
|
940
|
-
* - inline/context → `composeCertifiedPrompt` (delivery.ts) — byte-stable order;
|
|
941
|
-
* - http → a `ToolSpec` + a host-side fetch `execute`;
|
|
942
|
-
* - mcp-stdio/remote → an `AgentProfileMcpServer` (the strict union widens to
|
|
943
|
-
* the SDK's flat shape — an always-valid lowering).
|
|
944
|
-
*
|
|
945
|
-
* The ladder rungs that need infra are INJECTED capabilities of the resolve
|
|
946
|
-
* context (`runSandboxCode`, `provisionHost`), so the substrate-free caller wires
|
|
947
|
-
* only what it can host — a binding that needs an absent provider throws loudly,
|
|
948
|
-
* it is NEVER faked into a working surface. The not-yet-admitted arms (rag-index,
|
|
949
|
-
* memory-store, wasm, a2a) throw {@link CapabilityNotAdmittedError}.
|
|
950
|
-
*
|
|
951
|
-
* Fail-closed by construction (mirroring `pullCertified`): a `null` manifest
|
|
952
|
-
* returns the base surface only; a per-capability resolve failure DROPS that
|
|
953
|
-
* capability (never a half-wired tool); a post-resolve drift check drops any tool
|
|
954
|
-
* whose live names diverge from the certified interface.
|
|
955
|
-
*
|
|
956
|
-
* @experimental
|
|
892
|
+
* all-or-none replacements. The product owns locking, persistence, and retained
|
|
893
|
+
* state; Runtime owns the profile diff semantics and digest checks.
|
|
957
894
|
*/
|
|
958
|
-
|
|
895
|
+
declare function prepareAgentImprovementProfileActivation(input: AgentImprovementProfileActivationInput): AgentImprovementProfileActivationPreparation;
|
|
896
|
+
//#endregion
|
|
897
|
+
//#region src/intelligence/resolver.d.ts
|
|
959
898
|
/** A live, provisioned host the resolver tore up for a `process-on-infra` arm.
|
|
960
899
|
* `teardown()` runs at `dispose()` in reverse provisioning order. */
|
|
961
900
|
interface ProvisionedHost {
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
901
|
+
/** Lower the inner binding's mcp connection now that the host is up; the URL/
|
|
902
|
+
* command points at the host. Absent when the host serves a non-mcp inner. */
|
|
903
|
+
mcpConnection?: AgentProfileMcpServer;
|
|
904
|
+
teardown(): Promise<void>;
|
|
966
905
|
}
|
|
967
906
|
/**
|
|
968
907
|
* Per-call, per-tenant context the resolver reads. Everything that touches the
|
|
@@ -970,52 +909,52 @@ interface ProvisionedHost {
|
|
|
970
909
|
* no live secret and the substrate-free caller wires only what it can host.
|
|
971
910
|
*/
|
|
972
911
|
interface ResolveCtx {
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
912
|
+
/** Stable tenant id — namespaces billing + teardown (`tenant#target`). */
|
|
913
|
+
tenant?: string;
|
|
914
|
+
/** fetch impl for http tools. Defaults to global fetch; absent ⇒ http tools fail loud. */
|
|
915
|
+
fetchImpl?: typeof fetch;
|
|
916
|
+
/**
|
|
917
|
+
* Resolve a declared credential to a live secret for THIS tenant. Returns a
|
|
918
|
+
* typed outcome — inspect `succeeded` before `value`. Absent ⇒ a binding that
|
|
919
|
+
* declares non-`none` auth fails loud (never a request with no credential).
|
|
920
|
+
*/
|
|
921
|
+
resolveSecret?: (auth: CapabilityAuth, tenant: string | undefined) => Promise<{
|
|
922
|
+
succeeded: true;
|
|
923
|
+
value: string;
|
|
924
|
+
} | {
|
|
925
|
+
succeeded: false;
|
|
926
|
+
error: string;
|
|
927
|
+
}>;
|
|
928
|
+
/**
|
|
929
|
+
* Run a `sandbox-code` body per call. Injected by the host that owns a sandbox
|
|
930
|
+
* client (the spine does not import the sandbox executor). Absent ⇒
|
|
931
|
+
* `sandbox-code` bindings fail loud.
|
|
932
|
+
*/
|
|
933
|
+
runSandboxCode?: (code: ContentRef, entry: string, args: Record<string, unknown>, task: unknown) => Promise<string>;
|
|
934
|
+
/**
|
|
935
|
+
* Provision a host for a `process-on-infra` binding, then serve the inner
|
|
936
|
+
* binding inside it. Injected by the host that owns `createExecutor`. Absent ⇒
|
|
937
|
+
* `process-on-infra` bindings fail loud. The provider resolves the inner
|
|
938
|
+
* binding INSIDE the host and returns the connection + a teardown.
|
|
939
|
+
*/
|
|
940
|
+
provisionHost?: (host: HostSpec, inner: DeliveryBinding, costTag: string) => Promise<ProvisionedHost>;
|
|
941
|
+
/**
|
|
942
|
+
* Drift probe: return the LIVE tool names a resolved surface exposes for a
|
|
943
|
+
* given capability id (a `tools/list` over an mcp connection, the agent's
|
|
944
|
+
* actual registered tool names for a host tool). When present, the post-resolve
|
|
945
|
+
* drift check drops any tool/mcp whose live names diverge from the certified
|
|
946
|
+
* interface — the only callable surfaces are gate-blessed ones. Absent ⇒ the
|
|
947
|
+
* check enforces only the host-side executor↔spec parity (no live probe).
|
|
948
|
+
*/
|
|
949
|
+
probeLiveToolNames?: (capabilityId: string) => Promise<string[]>;
|
|
950
|
+
/**
|
|
951
|
+
* Observe a DROPPED capability — a per-capability resolve failure that is
|
|
952
|
+
* fail-closed (the capability is omitted, never half-wired). The drop is the
|
|
953
|
+
* contract; this surfaces the diagnostic so it is never silently erased. NOT
|
|
954
|
+
* called for {@link CapabilityNotAdmittedError} (that rethrows — a manifest
|
|
955
|
+
* carrying an un-admitted binding kind is a hard error, not a soft drop).
|
|
956
|
+
*/
|
|
957
|
+
onDrop?: (capabilityId: string, error: Error) => void;
|
|
1019
958
|
}
|
|
1020
959
|
/**
|
|
1021
960
|
* Compose a certified profile into a uniform `ResolvedSurface`. Additive over
|
|
@@ -1027,73 +966,41 @@ interface ResolveCtx {
|
|
|
1027
966
|
* Fail-closed: a `null` manifest returns the base surface only.
|
|
1028
967
|
*/
|
|
1029
968
|
declare function composeCertifiedProfile(base: {
|
|
1030
|
-
|
|
969
|
+
systemPrompt: string;
|
|
1031
970
|
}, manifest: CapabilityManifest | null, ctx?: ResolveCtx): Promise<ResolvedSurface>;
|
|
1032
971
|
/** Lower a plane `CertifiedProfile` straight into a `ResolvedSurface` via
|
|
1033
972
|
* `manifestFromProfile` — the convenience the shipped pull lane calls when it
|
|
1034
973
|
* already holds a `CertifiedProfile` (today's wire) rather than a manifest. */
|
|
1035
974
|
declare function composeCertifiedProfileFromWire(base: {
|
|
1036
|
-
|
|
975
|
+
systemPrompt: string;
|
|
1037
976
|
}, profile: CertifiedProfile | null, ctx?: ResolveCtx): Promise<ResolvedSurface>;
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
*
|
|
1041
|
-
* `withIntelligence` — the ONE agent-runtime hook that unifies Tangle
|
|
1042
|
-
* Intelligence send + receive.
|
|
1043
|
-
*
|
|
1044
|
-
* It does two things per call, both fail-open:
|
|
1045
|
-
* 1. RECEIVE — pull the tenant's certified profile from the deployed plane
|
|
1046
|
-
* (cached + refreshed), hand the agent the certified prompt surface to fold
|
|
1047
|
-
* (`applied.composePrompt`) and the promoted, gate-certified profile DIFFS
|
|
1048
|
-
* as PROPOSALS (`applied.proposals` / `applied.applyProfile`).
|
|
1049
|
-
* 2. SEND — serialize a typed {@link RunRecord} for the call through the shipped
|
|
1050
|
-
* OTLP builders to the plane's `/v1/otlp` ingest, best-effort.
|
|
1051
|
-
*
|
|
1052
|
-
* SAFETY — observe + deliver ONLY. This hook NEVER auto-applies a received diff
|
|
1053
|
-
* at runtime. A promoted diff is surfaced as a proposal; a human, or the gated
|
|
1054
|
-
* local `improve()` loop, turns a proposal into a shipped profile. That
|
|
1055
|
-
* preserves the held-out invariant the plane enforces — a runtime that silently
|
|
1056
|
-
* folded an un-gated diff into itself would defeat the very gate the diff cleared.
|
|
1057
|
-
*
|
|
1058
|
-
* import { withIntelligence } from '@tangle-network/agent-runtime/intelligence'
|
|
1059
|
-
*
|
|
1060
|
-
* export const agent = withIntelligence(
|
|
1061
|
-
* async (input, applied) => {
|
|
1062
|
-
* const out = await myAgent(input, { systemPrompt: applied.composePrompt(BASE) })
|
|
1063
|
-
* applied.record({ success: true, usage: { inferenceUsd: 0.002, intelligenceUsd: 0 } })
|
|
1064
|
-
* return out
|
|
1065
|
-
* },
|
|
1066
|
-
* { project: 'support-agent', target: 'support-agent' },
|
|
1067
|
-
* )
|
|
1068
|
-
*
|
|
1069
|
-
* @experimental
|
|
1070
|
-
*/
|
|
1071
|
-
|
|
977
|
+
//#endregion
|
|
978
|
+
//#region src/intelligence/with-intelligence.d.ts
|
|
1072
979
|
/** What the hook hands the agent each run. Additive over the prompt-only
|
|
1073
980
|
* delivery: `composePrompt` folds the certified prompt surface (as before);
|
|
1074
981
|
* `proposals`/`applyProfile` surface the promoted profile DIFFS — never
|
|
1075
982
|
* auto-applied; `record` enriches the {@link RunRecord} that is sent. */
|
|
1076
983
|
interface AppliedIntelligence {
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
984
|
+
/** Stable ids shared by the run span and every nested runtime/loop span. */
|
|
985
|
+
runId: string;
|
|
986
|
+
traceId: string;
|
|
987
|
+
/** The certified profile in effect (null when none promoted / pull failed —
|
|
988
|
+
* fail-closed: the agent runs on its base surface). */
|
|
989
|
+
certified: CertifiedProfile | null;
|
|
990
|
+
/** Fold the certified prompt surface into a base system prompt (the promoted
|
|
991
|
+
* prompt). The consumer opts in by calling it. */
|
|
992
|
+
composePrompt(base: string): string;
|
|
993
|
+
/** The promoted, gate-certified profile diffs — surfaced for a human or the
|
|
994
|
+
* gated `improve()` loop. NEVER auto-applied by this hook. Empty when none. */
|
|
995
|
+
proposals: ProposedProfileDiff[];
|
|
996
|
+
/** Fold every proposal into `base` via `applyAgentProfileDiff`, in promotion
|
|
997
|
+
* order, and return the result. The caller invokes this EXPLICITLY (it is the
|
|
998
|
+
* human/gated apply step) — the hook never calls it on the run path. */
|
|
999
|
+
applyProfile(base: AgentProfile$1): AgentProfile$1;
|
|
1000
|
+
/** Enrich the {@link RunRecord} sent for this call — outcome, usage split,
|
|
1001
|
+
* model/provider, and the loop event stream. Optional; an un-recorded run
|
|
1002
|
+
* still sends input/output with an inference-only zero usage split. */
|
|
1003
|
+
record(report: RunReport): void;
|
|
1097
1004
|
}
|
|
1098
1005
|
/** An agent wrapped by {@link withIntelligence}: receives the input plus the
|
|
1099
1006
|
* intelligence delivered for this run. */
|
|
@@ -1102,25 +1009,25 @@ type IntelligenceAgent<I, O> = (input: I, applied: AppliedIntelligence) => Promi
|
|
|
1102
1009
|
* cadence, and a proposals callback. One base URL (`baseUrl` /
|
|
1103
1010
|
* `TANGLE_INTELLIGENCE_URL`) drives both the send and receive paths. */
|
|
1104
1011
|
interface IntelligenceHookConfig extends IntelligenceConfig {
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1012
|
+
/** Pull target. Defaults to `project`. */
|
|
1013
|
+
target?: string;
|
|
1014
|
+
/** Min interval between certified-profile pulls. Default 5m. */
|
|
1015
|
+
refreshMs?: number;
|
|
1016
|
+
/** Per-pull timeout in ms (fail-closed on a hung plane). Default 10000. */
|
|
1017
|
+
timeoutMs?: number;
|
|
1018
|
+
/** fetch impl for the pull (tests). Defaults to global fetch. */
|
|
1019
|
+
fetchImpl?: typeof fetch;
|
|
1020
|
+
/** Notified when a refresh delivers a NEW set of promoted proposals (by
|
|
1021
|
+
* provenance content hash). Surfaces diffs without auto-applying them. */
|
|
1022
|
+
onProposals?: (proposals: ProposedProfileDiff[]) => void;
|
|
1116
1023
|
}
|
|
1117
1024
|
/** The wrapped agent — same `(input) => Promise<output>` shape, plus a manual
|
|
1118
1025
|
* `refresh()` and a `proposals()` accessor for the currently-promoted diffs. */
|
|
1119
1026
|
type IntelligenceWrapped<I, O> = ((input: I) => Promise<O>) & {
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1027
|
+
refresh(): Promise<void>;
|
|
1028
|
+
proposals(): ProposedProfileDiff[];
|
|
1029
|
+
/** Flush buffered trace spans before a short-lived process exits. */
|
|
1030
|
+
flush(): Promise<void>;
|
|
1124
1031
|
};
|
|
1125
1032
|
/**
|
|
1126
1033
|
* Wrap an agent so it (a) RECEIVES the tenant's certified profile — the prompt
|
|
@@ -1132,28 +1039,8 @@ type IntelligenceWrapped<I, O> = ((input: I) => Promise<O>) & {
|
|
|
1132
1039
|
* thrown by the agent itself propagates unchanged.
|
|
1133
1040
|
*/
|
|
1134
1041
|
declare function withIntelligence<I, O>(agent: IntelligenceAgent<I, O>, config: IntelligenceHookConfig): IntelligenceWrapped<I, O>;
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
*
|
|
1138
|
-
* Tangle Intelligence SDK — trace capture plus reviewable improvement.
|
|
1139
|
-
*
|
|
1140
|
-
* The client keeps live-agent trace delivery best-effort. The separate
|
|
1141
|
-
* improvement-cycle exports analyze completed traces, run a signed baseline
|
|
1142
|
-
* versus candidate experiment, bind review to its result, and activate only
|
|
1143
|
-
* the exact measured candidate.
|
|
1144
|
-
*
|
|
1145
|
-
* 1. OBSERVE — wrap a generic agent and export one trace span per call to
|
|
1146
|
-
* Tangle Intelligence, swallowing every export failure so a live agent
|
|
1147
|
-
* never fails because Intelligence is down.
|
|
1148
|
-
* 2. MODE 0 / OFF — at `effort: 'off'`, run the agent as PURE PASSTHROUGH
|
|
1149
|
-
* (zero intelligence spawns) with best-effort telemetry still on. The
|
|
1150
|
-
* exported trace tags usage by class `{ inferenceUsd, intelligenceUsd }`,
|
|
1151
|
-
* and at OFF `intelligenceUsd` is provably `0` — the mechanism that proves
|
|
1152
|
-
* an OFF customer paid inference-only.
|
|
1153
|
-
*
|
|
1154
|
-
* @experimental
|
|
1155
|
-
*/
|
|
1156
|
-
|
|
1042
|
+
//#endregion
|
|
1043
|
+
//#region src/intelligence/index.d.ts
|
|
1157
1044
|
/** Usage class for billing. Base-stream tokens bill `'inference'`; every
|
|
1158
1045
|
* intelligence spawn (analyst, corpus, loop) bills `'intelligence'`. The
|
|
1159
1046
|
* billing line falls on the spawn line. */
|
|
@@ -1164,10 +1051,10 @@ type UsageClass = 'inference' | 'intelligence';
|
|
|
1164
1051
|
* bill. This is a classification on the trace, NOT a budget-pool split.
|
|
1165
1052
|
*/
|
|
1166
1053
|
interface UsageSplit {
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1054
|
+
/** Base-stream (model) spend in USD. */
|
|
1055
|
+
inferenceUsd: number;
|
|
1056
|
+
/** Intelligence-spawn spend in USD. Provably `0` at the OFF tier. */
|
|
1057
|
+
intelligenceUsd: number;
|
|
1171
1058
|
}
|
|
1172
1059
|
/**
|
|
1173
1060
|
* The typed record `withIntelligence` sends per call — serialized through the
|
|
@@ -1177,44 +1064,44 @@ interface UsageSplit {
|
|
|
1177
1064
|
* tree under the same `traceId`.
|
|
1178
1065
|
*/
|
|
1179
1066
|
interface RunRecord {
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1067
|
+
runId: string;
|
|
1068
|
+
traceId: string;
|
|
1069
|
+
project: string;
|
|
1070
|
+
target: string;
|
|
1071
|
+
input: unknown;
|
|
1072
|
+
output: unknown;
|
|
1073
|
+
outcome: {
|
|
1074
|
+
success?: boolean;
|
|
1075
|
+
score?: number;
|
|
1076
|
+
usage: UsageSplit;
|
|
1077
|
+
};
|
|
1078
|
+
model?: string;
|
|
1079
|
+
provider?: string;
|
|
1080
|
+
loopEvents?: LoopTraceEvent[];
|
|
1081
|
+
runtimeEvents?: RuntimeStreamEvent[];
|
|
1082
|
+
profile?: AgentProfile$1;
|
|
1083
|
+
sessionId?: string;
|
|
1084
|
+
harness?: string;
|
|
1085
|
+
repository?: string;
|
|
1086
|
+
commitSha?: string;
|
|
1087
|
+
timing?: {
|
|
1088
|
+
startedAt: number;
|
|
1089
|
+
completedAt: number;
|
|
1090
|
+
durationMs: number;
|
|
1091
|
+
};
|
|
1092
|
+
tokens?: {
|
|
1093
|
+
input: number;
|
|
1094
|
+
output: number;
|
|
1095
|
+
cachedInput?: number;
|
|
1096
|
+
reasoning?: number;
|
|
1097
|
+
};
|
|
1098
|
+
error?: {
|
|
1099
|
+
name: string;
|
|
1100
|
+
message: string;
|
|
1101
|
+
code?: string;
|
|
1102
|
+
};
|
|
1103
|
+
/** Exact proposal → review → execution → receipt linkage for candidate runs. */
|
|
1104
|
+
candidateExecution?: CandidateExecutionEvidence$1;
|
|
1218
1105
|
}
|
|
1219
1106
|
/**
|
|
1220
1107
|
* What an agent reports (via `applied.record`) to enrich the {@link RunRecord}
|
|
@@ -1223,91 +1110,91 @@ interface RunRecord {
|
|
|
1223
1110
|
* as pure inference (the base stream).
|
|
1224
1111
|
*/
|
|
1225
1112
|
interface RunReport {
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1113
|
+
success?: boolean;
|
|
1114
|
+
score?: number;
|
|
1115
|
+
usage?: Partial<UsageSplit>;
|
|
1116
|
+
costUsd?: number;
|
|
1117
|
+
model?: string;
|
|
1118
|
+
provider?: string;
|
|
1119
|
+
loopEvents?: LoopTraceEvent[];
|
|
1120
|
+
runtimeEvents?: RuntimeStreamEvent[];
|
|
1121
|
+
profile?: AgentProfile$1;
|
|
1122
|
+
sessionId?: string;
|
|
1123
|
+
harness?: string;
|
|
1124
|
+
commitSha?: string;
|
|
1125
|
+
tokens?: RunRecord['tokens'];
|
|
1126
|
+
error?: RunRecord['error'];
|
|
1127
|
+
candidateExecution?: CandidateExecutionEvidence$1;
|
|
1241
1128
|
}
|
|
1242
1129
|
/** Repo coordinates a product may declare for the (later) Gated-PR mode. The
|
|
1243
1130
|
* Observe slice only records their PRESENCE for `doctor()`; it never touches
|
|
1244
1131
|
* the repo. */
|
|
1245
1132
|
interface RepoConfig {
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1133
|
+
owner: string;
|
|
1134
|
+
name: string;
|
|
1135
|
+
baseBranch: string;
|
|
1249
1136
|
}
|
|
1250
1137
|
/** Client configuration. `project` + `apiKey` are the Observe minimum; the
|
|
1251
1138
|
* rest tune effort, endpoint, redaction, and (for `doctor()` readiness)
|
|
1252
1139
|
* declare the surfaces/checks/repo a later PR mode would need. */
|
|
1253
1140
|
interface IntelligenceConfig {
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1141
|
+
/** Stable project id — the tenant dimension every trace is tagged with. */
|
|
1142
|
+
project: string;
|
|
1143
|
+
/** Bearer key for the Intelligence ingest. Reads `TANGLE_API_KEY` when omitted. */
|
|
1144
|
+
apiKey?: string;
|
|
1145
|
+
/** Effort tier (default `'standard'`) plus optional per-field overrides. */
|
|
1146
|
+
effort?: EffortTier | {
|
|
1147
|
+
tier: EffortTier;
|
|
1148
|
+
overrides?: EffortOverrides;
|
|
1149
|
+
};
|
|
1150
|
+
/**
|
|
1151
|
+
* The ONE Tangle Intelligence base URL — both the send (OTLP `/v1/otlp`) and
|
|
1152
|
+
* receive (`/v1/profiles/:target/composed`) paths derive from it. Reads
|
|
1153
|
+
* `TANGLE_INTELLIGENCE_URL` when omitted, else `https://intelligence.tangle.tools`.
|
|
1154
|
+
* Send is best-effort and only ships when an `apiKey` is present (the tenant
|
|
1155
|
+
* key the ingest requires); absent a key, export is a no-op.
|
|
1156
|
+
*/
|
|
1157
|
+
baseUrl?: string;
|
|
1158
|
+
/**
|
|
1159
|
+
* Redaction hook run over every exported input/output. A function replaces
|
|
1160
|
+
* the default scrubber; `false` opts out entirely (raw fidelity, caller has
|
|
1161
|
+
* sanitized upstream); omitted ⇒ the built-in `defaultRedactor`.
|
|
1162
|
+
*/
|
|
1163
|
+
redact?: Redactor | false;
|
|
1164
|
+
/** Mutable surfaces a later PR mode would edit. Recorded for `doctor()` only. */
|
|
1165
|
+
surfaces?: string[];
|
|
1166
|
+
/** Verification checks a later PR mode would gate on. Recorded for `doctor()` only. */
|
|
1167
|
+
checks?: string[];
|
|
1168
|
+
/** Repo access a later PR mode would need. Recorded for `doctor()` only. */
|
|
1169
|
+
repo?: RepoConfig;
|
|
1170
|
+
/** Full canonical profile used for this agent. Exported redacted with a stable hash. */
|
|
1171
|
+
profile?: AgentProfile$1;
|
|
1172
|
+
/** Commit that produced the running agent, when known. */
|
|
1173
|
+
commitSha?: string;
|
|
1174
|
+
/** Runtime-event payload policy. Tool inputs/results remain off unless explicitly enabled. */
|
|
1175
|
+
runtimeTelemetry?: RuntimeTelemetryOptions;
|
|
1176
|
+
/**
|
|
1177
|
+
* Payloads are metadata-only by default: the run span carries a stable hash
|
|
1178
|
+
* and UTF-8 byte count, but not the redacted content. Set `full` only when
|
|
1179
|
+
* the configured OTLP destination is approved to receive complete redacted
|
|
1180
|
+
* inputs, outputs, and profiles.
|
|
1181
|
+
*/
|
|
1182
|
+
payloadAttributes?: 'metadata' | 'full';
|
|
1296
1183
|
}
|
|
1297
1184
|
/** Metadata describing one traced run. `runId`/`traceId` default to fresh ids. */
|
|
1298
1185
|
interface TraceMeta {
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1186
|
+
/** The run's input — exported through the redactor. */
|
|
1187
|
+
input?: unknown;
|
|
1188
|
+
/** Stable run id. Defaults to a fresh id. */
|
|
1189
|
+
runId?: string;
|
|
1190
|
+
/** 32-hex trace id. Defaults to a fresh id. */
|
|
1191
|
+
traceId?: string;
|
|
1192
|
+
/** Model id, when known — stamped on the span. */
|
|
1193
|
+
model?: string;
|
|
1194
|
+
/** Provider name, when known — stamped on the span. */
|
|
1195
|
+
provider?: string;
|
|
1196
|
+
/** Arbitrary extra labels (string/number/boolean) stamped on the span. */
|
|
1197
|
+
labels?: Record<string, string | number | boolean>;
|
|
1311
1198
|
}
|
|
1312
1199
|
/**
|
|
1313
1200
|
* The trace handle a `traceRun` body records into. `recordOutput` captures the
|
|
@@ -1316,104 +1203,104 @@ interface TraceMeta {
|
|
|
1316
1203
|
* an un-recorded run still exports a span with whatever was set.
|
|
1317
1204
|
*/
|
|
1318
1205
|
interface TraceHandle {
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1206
|
+
/** Capture the run's output. Exported through the redactor. */
|
|
1207
|
+
recordOutput(output: unknown): void;
|
|
1208
|
+
/**
|
|
1209
|
+
* Capture the run's outcome. `usage` defaults to inference-only
|
|
1210
|
+
* (`intelligenceUsd: 0`) — the OFF baseline; an intelligence-enabled run
|
|
1211
|
+
* fills `intelligenceUsd` itself. `costUsd`, when given without a split, is
|
|
1212
|
+
* treated as pure inference.
|
|
1213
|
+
*/
|
|
1214
|
+
recordOutcome(outcome: {
|
|
1215
|
+
success?: boolean;
|
|
1216
|
+
score?: number;
|
|
1217
|
+
costUsd?: number;
|
|
1218
|
+
usage?: Partial<UsageSplit>;
|
|
1219
|
+
}): void;
|
|
1333
1220
|
}
|
|
1334
1221
|
/** Metadata for {@link IntelligenceClient.recordTrace}. */
|
|
1335
1222
|
interface RecordTraceMeta {
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1223
|
+
/** 32-hex trace id to anchor every span to. Defaults to a fresh id. */
|
|
1224
|
+
traceId?: string;
|
|
1225
|
+
/** Span id of an enclosing span the loop root should parent under (e.g. a
|
|
1226
|
+
* `traceRun` span). Omitted ⇒ the loop root is the trace root. */
|
|
1227
|
+
rootParentSpanId?: string;
|
|
1341
1228
|
}
|
|
1342
1229
|
/** The resolved outcome of one traced run, surfaced on the export span and
|
|
1343
1230
|
* available to the caller for downstream billing assertions. */
|
|
1344
1231
|
interface TraceOutcome {
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1232
|
+
runId: string;
|
|
1233
|
+
traceId: string;
|
|
1234
|
+
project: string;
|
|
1235
|
+
/** The resolved effort settings this run executed under. */
|
|
1236
|
+
effort: EffortSettings;
|
|
1237
|
+
/** True when this run ran as pure passthrough (the OFF floor). */
|
|
1238
|
+
intelligenceOff: boolean;
|
|
1239
|
+
success?: boolean;
|
|
1240
|
+
score?: number;
|
|
1241
|
+
/** Per-class billing split. `intelligenceUsd` is `0` at the OFF tier. */
|
|
1242
|
+
usage: UsageSplit;
|
|
1356
1243
|
}
|
|
1357
1244
|
/** The Observe-mode Intelligence client. */
|
|
1358
1245
|
interface IntelligenceClient {
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1246
|
+
/** The resolved project id. */
|
|
1247
|
+
readonly project: string;
|
|
1248
|
+
/** The resolved effort settings. */
|
|
1249
|
+
readonly effort: EffortSettings;
|
|
1250
|
+
/**
|
|
1251
|
+
* Run `fn` under a trace, export one span best-effort, and return whatever
|
|
1252
|
+
* `fn` returns. Telemetry-export failures are swallowed; an error THROWN by
|
|
1253
|
+
* `fn` propagates to the caller (the agent's own failures are not masked).
|
|
1254
|
+
*/
|
|
1255
|
+
traceRun<T>(meta: TraceMeta, fn: (trace: TraceHandle) => Promise<T>): Promise<T>;
|
|
1256
|
+
/**
|
|
1257
|
+
* Export a run's full loop topology — the ordered `LoopTraceEvent` stream a
|
|
1258
|
+
* `runAgentRounds`/`Supervisor` run emits — as a nested OTLP span tree (loop → round →
|
|
1259
|
+
* iteration) into ONE trace. Reuses the shipped `buildLoopOtelSpans` builder
|
|
1260
|
+
* (NO second span builder), so the topology a viewer renders matches the
|
|
1261
|
+
* kernel's. `traceId` defaults to a fresh id; `rootParentSpanId` parents the
|
|
1262
|
+
* loop root under an enclosing span (e.g. a `traceRun` span) when given.
|
|
1263
|
+
* Best-effort: export failures are swallowed. Returns the resolved `traceId`.
|
|
1264
|
+
*/
|
|
1265
|
+
recordTrace(events: ReadonlyArray<LoopTraceEvent>, meta?: RecordTraceMeta): string;
|
|
1266
|
+
/**
|
|
1267
|
+
* Send one typed {@link RunRecord} — the run's flat span (input/output/outcome/
|
|
1268
|
+
* usage/model/provider, redacted) plus, when `loopEvents` are present, the
|
|
1269
|
+
* nested loop topology under the same `traceId`. Reuses the shipped
|
|
1270
|
+
* `flatOtelSpan` + `buildLoopOtelSpans` builders (no second builder).
|
|
1271
|
+
* Best-effort: export failures are swallowed. Returns the record's `traceId`.
|
|
1272
|
+
*/
|
|
1273
|
+
exportRunRecord(record: RunRecord): string;
|
|
1274
|
+
/** Mint a fresh run id (`run-<hex>`). */
|
|
1275
|
+
freshRunId(): string;
|
|
1276
|
+
/** Mint a fresh 32-hex trace id. */
|
|
1277
|
+
freshTraceId(): string;
|
|
1278
|
+
/**
|
|
1279
|
+
* Network-free readiness report: which adoption modes are reachable given
|
|
1280
|
+
* this config. Observe is always reachable; Recommend needs outcomes; PR
|
|
1281
|
+
* needs checks + surfaces + repo.
|
|
1282
|
+
*/
|
|
1283
|
+
doctor(): DoctorReport;
|
|
1284
|
+
/** Flush any pending export spans. Best-effort; resolves even if export fails. */
|
|
1285
|
+
flush(): Promise<void>;
|
|
1399
1286
|
}
|
|
1400
1287
|
/** One mode's readiness verdict. */
|
|
1401
1288
|
interface ModeReadiness {
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1289
|
+
ready: boolean;
|
|
1290
|
+
/** Inputs this mode still needs, when not ready. Empty when ready. */
|
|
1291
|
+
missing: string[];
|
|
1405
1292
|
}
|
|
1406
1293
|
/** The `doctor()` readiness report — Mode-readiness without any network call. */
|
|
1407
1294
|
interface DoctorReport {
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1295
|
+
project: string;
|
|
1296
|
+
effort: EffortSettings;
|
|
1297
|
+
/** True when an OTLP endpoint is configured (export will actually ship). */
|
|
1298
|
+
exportConfigured: boolean;
|
|
1299
|
+
modes: {
|
|
1300
|
+
observe: ModeReadiness;
|
|
1301
|
+
recommend: ModeReadiness;
|
|
1302
|
+
pr: ModeReadiness;
|
|
1303
|
+
};
|
|
1417
1304
|
}
|
|
1418
1305
|
/**
|
|
1419
1306
|
* Create an Observe-mode Intelligence client. Resolves effort, the base URL, and
|
|
@@ -1422,5 +1309,6 @@ interface DoctorReport {
|
|
|
1422
1309
|
* and best-effort export must never spam an unauthenticated plane).
|
|
1423
1310
|
*/
|
|
1424
1311
|
declare function createIntelligenceClient(config: IntelligenceConfig): IntelligenceClient;
|
|
1425
|
-
|
|
1426
|
-
export { AGENT_IMPROVEMENT_PROFILE_SURFACES, type AgentCandidateExecutionHostPorts, AgentCandidateExperimentCellExecutionError, type AgentCandidateExperimentCellPlacement, type AgentImprovementActivationTargetIdentity, AgentImprovementActivationTargetPlan, type AgentImprovementExperimentMaterial, type AgentImprovementProfileActivationPreparation, type AgentImprovementProfileActivationTarget, type AgentImprovementProfileReplacement, type AgentImprovementProfileSurface, type AgentImprovementProfileTargetState, type AgentImprovementProfileTargetTransition, type AgentImprovementProposalSubmissionState, type AgentImprovementTargetProfileDiffOptions, type AppliedIntelligence, type CapabilityAuth, type CapabilityInterface, type CapabilityManifest, CapabilityNotAdmittedError, type CapabilitySurface, type CertProvenance, type CertifiedArtifact, type CertifiedCapability, type CertifiedCapabilitySummary, type CertifiedProfile, type CertifiedPromptSource, type CertifiedPromptSourceOptions, type CertifiedPromptSurface, type ContentRef, type CorpusAccess, type CreateAgentImprovementActivationOptions, type CreateAgentImprovementProposalOptions, type CreateExactProcessCandidateExperimentExecutorOptions, type CreateProtectedExactProcessCandidateExperimentExecutorOptions, type CredentialRef, type DeliveryBinding, type DeliveryBindingKind, type DiffProvenance,
|
|
1312
|
+
//#endregion
|
|
1313
|
+
export { AGENT_IMPROVEMENT_PROFILE_SURFACES, type AgentCandidateExecutionHostPorts, AgentCandidateExperimentCellExecutionError, type AgentCandidateExperimentCellPlacement, type AgentImprovementActivation, type AgentImprovementActivationIntent, type AgentImprovementActivationOutcome, type AgentImprovementActivationReconciliation, type AgentImprovementActivationResult, type AgentImprovementActivationResultStore, type AgentImprovementActivationTargetIdentity, type AgentImprovementActivationTargetPlan, type AgentImprovementActivationTransition, type AgentImprovementActivationTransitionInput, type AgentImprovementEvaluation, type AgentImprovementExperimentMaterial, type AgentImprovementMeasuredComparison, type AgentImprovementProfileActivationInput, type AgentImprovementProfileActivationPreparation, type AgentImprovementProfileActivationTarget, type AgentImprovementProfileReplacement, type AgentImprovementProfileStateDigest, type AgentImprovementProfileStateDigestInput, type AgentImprovementProfileStateResolver, type AgentImprovementProfileStateResolverInput, type AgentImprovementProfileSurface, type AgentImprovementProfileTargetState, type AgentImprovementProfileTargetTransition, type AgentImprovementProposal, type AgentImprovementProposalSubmissionState, type AgentImprovementReview, type AgentImprovementReviewDecision, type AgentImprovementTargetProfileDiffOptions, type AgentProfileImprovementActivationOperation, type AgentProfileImprovementActivationTargetPlan, type AppliedIntelligence, type CandidateExecutionEvidence, type CandidateProfileMaterialization, type CapabilityAuth, type CapabilityInterface, type CapabilityManifest, CapabilityNotAdmittedError, type CapabilitySurface, type CertProvenance, type CertifiedArtifact, type CertifiedCapability, type CertifiedCapabilitySummary, type CertifiedProfile, type CertifiedPromptSource, type CertifiedPromptSourceOptions, type CertifiedPromptSurface, type ContentRef, type CorpusAccess, type CreateAgentImprovementActivationOptions, type CreateAgentImprovementActivationResultOptions, type CreateAgentImprovementProposalOptions, type CreateExactProcessCandidateExperimentExecutorOptions, type CreateProtectedExactProcessCandidateExperimentExecutorOptions, type CredentialRef, type DeliveryBinding, type DeliveryBindingKind, type DiffProvenance, DoctorReport, type EffortOverrides, type EffortOverridesCompiled, type EffortSettings, type EffortTier, type ExactProcessCandidateExperimentExecution, type ExactProcessCandidateExperimentExecutor, type ExecuteAgentCandidateExperimentCellOptions, type ExecuteAgentImprovementActivationInput, type ExecuteAgentImprovementActivationOptions, type HostSpec, type IntelligenceAgent, IntelligenceClient, IntelligenceConfig, type IntelligenceHookConfig, type IntelligenceWrapped, type JsonSchema, ModeReadiness, type OptimizationActivationReceipt, type OptimizationReceiptCost, type ProfileImprovementActivationTransitionInput, type ProposeAgentImprovementOptions, type ProposeAgentImprovementResult, type ProposedProfileDiff, type ProtectedExactProcessCandidateExperimentExecutor, type ProvisionedHost, type PullCertifiedOptions, type PullOutcome, RecordTraceMeta, type Redactor, RepoConfig, type ResolveCtx, type ResolvedHook, type ResolvedRetrieval, type ResolvedSubagent, type ResolvedSurface, type ReviewAgentImprovementInput, type RunAgentCandidateExperimentOptions, type RunAgentCandidateExperimentResult, RunRecord, RunReport, type SealedCandidateActivationTransitionInput, type SubmitAgentImprovementProposalOptions, type SubmitAgentImprovementProposalOutcome, TraceHandle, TraceMeta, TraceOutcome, UsageClass, UsageSplit, type VerifyCandidateExecutionEvidenceOptions, agentImprovementProfileSurfaceDigest, agentImprovementProfileSurfaceInput, agentImprovementTargetProfileDiffs, buildAgentImprovementActivationTargets, compileEffort, composeCertifiedProfile, composeCertifiedProfileFromWire, composeCertifiedPrompt, createAgentImprovementActivation, createAgentImprovementActivationResult, createAgentImprovementMeasuredComparison, createAgentImprovementProposal, createCertifiedPromptSource, createExactProcessCandidateExperimentExecutor, createIntelligenceClient, createOptimizationActivationReceipt, createProtectedExactProcessCandidateExperimentExecutor, defaultEffortTier, defaultRedactor, exactProcessCandidateExperimentExecutionSupport, executeAgentCandidateExperimentCell, executeAgentImprovementActivation, isAgentImprovementProfileSurface, isIntelligenceOff, manifestFromProfile, normalizeCertifiedProfile, optimizationActivationReceiptFromMetadata, parseAgentCandidateProfileActivation as parseCandidateProfileMaterialization, prepareAgentImprovementProfileActivation, proposeAgentImprovement, pullCertified, resolveEffort, resolveIntelligenceBaseUrl, resolveRedactor, reviewAgentImprovementProposal, runAgentCandidateExperiment, submitAgentImprovementProposal, verifyAgentImprovementActivation, verifyAgentImprovementActivationResult, verifyAgentImprovementProposal, verifyAgentImprovementReview, verifyCandidateExecutionEvidence, withIntelligence };
|
|
1314
|
+
//# sourceMappingURL=intelligence.d.ts.map
|