@tangle-network/agent-runtime 0.105.0 → 0.106.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/activation-CRjVfOiy.js +203 -0
- package/dist/activation-CRjVfOiy.js.map +1 -0
- package/dist/activation-DyWB0K6E.d.ts +98 -0
- package/dist/agent.d.ts +216 -234
- package/dist/agent.js +615 -547
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop-DGdtVENg.js +517 -0
- package/dist/analyst-loop-DGdtVENg.js.map +1 -0
- package/dist/analyst-loop.d.ts +10 -43
- package/dist/analyst-loop.js +2 -11
- package/dist/backends-Dy8NujB4.js +713 -0
- package/dist/backends-Dy8NujB4.js.map +1 -0
- package/dist/candidate-execution/index.d.ts +4 -192
- package/dist/candidate-execution/index.js +5 -66
- package/dist/candidate-execution-DqMbv1rU.js +488 -0
- package/dist/candidate-execution-DqMbv1rU.js.map +1 -0
- package/dist/coder-yhVWbdWc.js +40 -0
- package/dist/coder-yhVWbdWc.js.map +1 -0
- package/dist/conversation-XucG_K3l.js +1265 -0
- package/dist/conversation-XucG_K3l.js.map +1 -0
- package/dist/conversation.d.ts +2 -804
- package/dist/conversation.js +2 -55
- package/dist/environment-provider-CfLUmKmf.js +1168 -0
- package/dist/environment-provider-CfLUmKmf.js.map +1 -0
- package/dist/environment-provider-IUGU3epE.d.ts +964 -0
- package/dist/environment-provider.d.ts +2 -78
- package/dist/environment-provider.js +2 -18
- package/dist/errors-DEAvWQPy.js +111 -0
- package/dist/errors-DEAvWQPy.js.map +1 -0
- package/dist/improvement-adapter-Cr5TBSji.d.ts +166 -0
- package/dist/improvement-cycle-C095kS_g.js +2624 -0
- package/dist/improvement-cycle-C095kS_g.js.map +1 -0
- package/dist/index-BGdxAwfO.d.ts +838 -0
- package/dist/index-C-FYUuFG.d.ts +193 -0
- package/dist/index-CbNM40xG.d.ts +140 -0
- package/dist/index-DruSKs3Z.d.ts +7224 -0
- package/dist/index-Efjb3nrQ.d.ts +671 -0
- package/dist/index.d.ts +14 -1058
- package/dist/index.js +2106 -2082
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +768 -889
- package/dist/intelligence.js +1466 -1367
- package/dist/intelligence.js.map +1 -1
- package/dist/{kb-gate-CwHO0vz6.d.ts → kb-gate-C8z2juK8.d.ts} +33 -31
- package/dist/kb-gate-DpaSwXVx.js +80 -0
- package/dist/kb-gate-DpaSwXVx.js.map +1 -0
- package/dist/knowledge-Ku-mPP4f.js +433 -0
- package/dist/knowledge-Ku-mPP4f.js.map +1 -0
- package/dist/knowledge.d.ts +2 -150
- package/dist/knowledge.js +2 -40
- package/dist/local-harness-Dh8PJ0ot.d.ts +455 -0
- package/dist/loop-runner-bin-BXsFEUcf.d.ts +162 -0
- package/dist/loop-runner-bin-BwjQ1NfH.js +268 -0
- package/dist/loop-runner-bin-BwjQ1NfH.js.map +1 -0
- package/dist/loop-runner-bin.d.ts +2 -15
- package/dist/loop-runner-bin.js +2 -24
- package/dist/loops.d.ts +5 -4164
- package/dist/loops.js +8 -419
- package/dist/mcp/bin.d.ts +1 -1
- package/dist/mcp/bin.js +116 -146
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +295 -436
- package/dist/mcp/index.js +1242 -1177
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/memory-bin.d.ts +1 -1
- package/dist/mcp/memory-bin.js +37 -16
- package/dist/mcp/memory-bin.js.map +1 -1
- package/dist/memory-server-DL6cE2Ag.js +234 -0
- package/dist/memory-server-DL6cE2Ag.js.map +1 -0
- package/dist/model-resolution-Btd9iIKV.js +98 -0
- package/dist/model-resolution-Btd9iIKV.js.map +1 -0
- package/dist/openai-tools-B68JaOCx.d.ts +24 -0
- package/dist/openai-tools-CKLy1C7M.js +44 -0
- package/dist/openai-tools-CKLy1C7M.js.map +1 -0
- package/dist/otel-export-D34IQW1C.js +843 -0
- package/dist/otel-export-D34IQW1C.js.map +1 -0
- package/dist/platform.d.ts +188 -185
- package/dist/platform.js +185 -218
- package/dist/platform.js.map +1 -1
- package/dist/prepare-B53sPV7M.js +4292 -0
- package/dist/prepare-B53sPV7M.js.map +1 -0
- package/dist/primeintellect/index.d.ts +149 -145
- package/dist/primeintellect/index.js +626 -1003
- package/dist/primeintellect/index.js.map +1 -1
- package/dist/profiles.d.ts +296 -490
- package/dist/profiles.js +722 -749
- package/dist/profiles.js.map +1 -1
- package/dist/protected-model-port-BLPH5VVv.js +722 -0
- package/dist/protected-model-port-BLPH5VVv.js.map +1 -0
- package/dist/protected-model-port-BP6Z4eau.d.ts +283 -0
- package/dist/protected-redaction--F3v1oo8.js +200 -0
- package/dist/protected-redaction--F3v1oo8.js.map +1 -0
- package/dist/redact-D-u-rrcn.js +82 -0
- package/dist/redact-D-u-rrcn.js.map +1 -0
- package/dist/redact-kbIOjfjM.d.ts +452 -0
- package/dist/researcher-CoVqNhfI.js +433 -0
- package/dist/researcher-CoVqNhfI.js.map +1 -0
- package/dist/runtime-BG0BziaP.js +5408 -0
- package/dist/runtime-BG0BziaP.js.map +1 -0
- package/dist/sandbox-events-DeI5xX8P.js +316 -0
- package/dist/sandbox-events-DeI5xX8P.js.map +1 -0
- package/dist/spawn-journal-CwPvKUTa.js +456 -0
- package/dist/spawn-journal-CwPvKUTa.js.map +1 -0
- package/dist/structural-rollout-IXUEplky.js +1445 -0
- package/dist/structural-rollout-IXUEplky.js.map +1 -0
- package/dist/substrate-B0TYNrXn.js +27 -0
- package/dist/substrate-B0TYNrXn.js.map +1 -0
- package/dist/{substrate-Dyiqmd3o.d.ts → substrate-BcnuSHXm.d.ts} +57 -54
- package/dist/supervise-BiRutHS9.js +7321 -0
- package/dist/supervise-BiRutHS9.js.map +1 -0
- package/dist/supervisor-DTKhF-RV.js +3826 -0
- package/dist/supervisor-DTKhF-RV.js.map +1 -0
- package/dist/testing.d.ts +4 -3
- package/dist/testing.js +2478 -2637
- package/dist/testing.js.map +1 -1
- package/dist/tool-server-RcWgLIsL.js +141 -0
- package/dist/tool-server-RcWgLIsL.js.map +1 -0
- package/dist/trace-propagation-CJJC7SVB.js +57 -0
- package/dist/trace-propagation-CJJC7SVB.js.map +1 -0
- package/dist/types-BaIpb0XT.d.ts +492 -0
- package/dist/types-BevOjfTY.d.ts +765 -0
- package/dist/types-C9j4qg6l.d.ts +500 -0
- package/dist/types-Cja5OTGh.d.ts +190 -0
- package/dist/util-MVgdwuIS.js +145 -0
- package/dist/util-MVgdwuIS.js.map +1 -0
- package/dist/workspace-archive-BosQiotA.js +575 -0
- package/dist/workspace-archive-BosQiotA.js.map +1 -0
- package/package.json +43 -56
- package/skills/build-with-agent-runtime/SKILL.md +1 -0
- package/dist/activation-Cm-9MMX1.d.ts +0 -69
- package/dist/analyst-loop.js.map +0 -1
- package/dist/backends-BO4Jqoe2.d.ts +0 -134
- package/dist/candidate-execution/index.js.map +0 -1
- package/dist/chunk-2KGAN2HM.js +0 -1256
- package/dist/chunk-2KGAN2HM.js.map +0 -1
- package/dist/chunk-2VZYRB55.js +0 -834
- package/dist/chunk-2VZYRB55.js.map +0 -1
- package/dist/chunk-3MDZX7YU.js +0 -125
- package/dist/chunk-3MDZX7YU.js.map +0 -1
- package/dist/chunk-5IBQAPVB.js +0 -29
- package/dist/chunk-5IBQAPVB.js.map +0 -1
- package/dist/chunk-5QOB7H74.js +0 -387
- package/dist/chunk-5QOB7H74.js.map +0 -1
- package/dist/chunk-C5RTIBNZ.js +0 -48
- package/dist/chunk-C5RTIBNZ.js.map +0 -1
- package/dist/chunk-CTRA64LY.js +0 -680
- package/dist/chunk-CTRA64LY.js.map +0 -1
- package/dist/chunk-DPEUKJRO.js +0 -27
- package/dist/chunk-DPEUKJRO.js.map +0 -1
- package/dist/chunk-FD2MBMOH.js +0 -494
- package/dist/chunk-FD2MBMOH.js.map +0 -1
- package/dist/chunk-H5QPIZNX.js +0 -907
- package/dist/chunk-H5QPIZNX.js.map +0 -1
- package/dist/chunk-HLKC4UYB.js +0 -3514
- package/dist/chunk-HLKC4UYB.js.map +0 -1
- package/dist/chunk-HNP72PNU.js +0 -192
- package/dist/chunk-HNP72PNU.js.map +0 -1
- package/dist/chunk-ISPWRSEC.js +0 -408
- package/dist/chunk-ISPWRSEC.js.map +0 -1
- package/dist/chunk-KRBFHMV6.js +0 -1228
- package/dist/chunk-KRBFHMV6.js.map +0 -1
- package/dist/chunk-M22PL4GH.js +0 -171
- package/dist/chunk-M22PL4GH.js.map +0 -1
- package/dist/chunk-NURIQBJQ.js +0 -72
- package/dist/chunk-NURIQBJQ.js.map +0 -1
- package/dist/chunk-OPVWXJ2H.js +0 -75
- package/dist/chunk-OPVWXJ2H.js.map +0 -1
- package/dist/chunk-PZZKQVQV.js +0 -52
- package/dist/chunk-PZZKQVQV.js.map +0 -1
- package/dist/chunk-Q2JSAVQ3.js +0 -671
- package/dist/chunk-Q2JSAVQ3.js.map +0 -1
- package/dist/chunk-RDOAVVHY.js +0 -699
- package/dist/chunk-RDOAVVHY.js.map +0 -1
- package/dist/chunk-SGKPNBXE.js +0 -60
- package/dist/chunk-SGKPNBXE.js.map +0 -1
- package/dist/chunk-SMQXZGLZ.js +0 -351
- package/dist/chunk-SMQXZGLZ.js.map +0 -1
- package/dist/chunk-UHEZW5BU.js +0 -2918
- package/dist/chunk-UHEZW5BU.js.map +0 -1
- package/dist/chunk-UPWGXKXB.js +0 -254
- package/dist/chunk-UPWGXKXB.js.map +0 -1
- package/dist/chunk-VISA6CI3.js +0 -200
- package/dist/chunk-VISA6CI3.js.map +0 -1
- package/dist/chunk-WMTCUOQL.js +0 -474
- package/dist/chunk-WMTCUOQL.js.map +0 -1
- package/dist/chunk-WRTOVNN4.js +0 -4728
- package/dist/chunk-WRTOVNN4.js.map +0 -1
- package/dist/chunk-WSTRQZYQ.js +0 -5576
- package/dist/chunk-WSTRQZYQ.js.map +0 -1
- package/dist/chunk-XBG2W2VW.js +0 -6434
- package/dist/chunk-XBG2W2VW.js.map +0 -1
- package/dist/chunk-YEJR7IXO.js +0 -68
- package/dist/chunk-YEJR7IXO.js.map +0 -1
- package/dist/chunk-YJZA2BIK.js +0 -1338
- package/dist/chunk-YJZA2BIK.js.map +0 -1
- package/dist/completion-gate-BMy5LGoP.d.ts +0 -256
- package/dist/conversation.js.map +0 -1
- package/dist/coordination-BZZSVYpZ.d.ts +0 -2570
- package/dist/environment-provider.js.map +0 -1
- package/dist/improvement-adapter-HAZz-7vK.d.ts +0 -203
- package/dist/knowledge.js.map +0 -1
- package/dist/local-harness-BDNcl6jI.d.ts +0 -175
- package/dist/loop-runner-bin-68aoM9-7.d.ts +0 -199
- package/dist/loop-runner-bin.js.map +0 -1
- package/dist/loops.js.map +0 -1
- package/dist/openai-tools-fnj6SRVg.d.ts +0 -46
- package/dist/protected-model-port-B4t-OQjL.d.ts +0 -271
- package/dist/redact-BuFjxBUJ.d.ts +0 -481
- package/dist/sanitize-DEbPNtyI.d.ts +0 -328
- package/dist/structural-rollout-DEh6CEsa.d.ts +0 -446
- package/dist/supervise-4_48wwvy.d.ts +0 -379
- package/dist/types-BCoemcXU.d.ts +0 -802
- package/dist/types-BwoZWq-i.d.ts +0 -510
- package/dist/types-Cbp72qyu.d.ts +0 -491
- package/dist/types-CmYCMbFT.d.ts +0 -203
- package/dist/types-CvNwMzQt.d.ts +0 -957
- package/dist/worktree-fanout-DxhAWr5Z.d.ts +0 -999
package/dist/intelligence.d.ts
CHANGED
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
import { CandidateExperimentExecutionInput,
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
import { AnalystFinding } from '@tangle-network/agent-eval/analyst';
|
|
18
|
-
import { R as RunAnalystLoopOpts, a as RunAnalystLoopResult } from './types-CmYCMbFT.js';
|
|
19
|
-
import { OptimizationPackageSource, OptimizationMethodComparison, OptimizationTokenUsage } from '@tangle-network/agent-eval/campaign';
|
|
20
|
-
import './local-harness-BDNcl6jI.js';
|
|
21
|
-
import 'node:child_process';
|
|
22
|
-
import '@tangle-network/sandbox';
|
|
23
|
-
import './types-CvNwMzQt.js';
|
|
24
|
-
|
|
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
|
|
25
17
|
/**
|
|
26
18
|
*
|
|
27
19
|
* EffortPolicy — pure data, no execution. Resolves a named tier into a flat
|
|
@@ -51,21 +43,21 @@ type CorpusAccess = 'off' | 'read' | 'read-write';
|
|
|
51
43
|
* self-executing.
|
|
52
44
|
*/
|
|
53
45
|
interface EffortSettings {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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;
|
|
69
61
|
}
|
|
70
62
|
/** Per-field overrides applied on top of a tier preset. Any subset of the
|
|
71
63
|
* resolved settings; each provided field wins over the preset. */
|
|
@@ -113,14 +105,14 @@ declare function isIntelligenceOff(settings: EffortSettings): boolean;
|
|
|
113
105
|
* the billing clamp (passed verbatim; `0` refuses every intelligence spawn).
|
|
114
106
|
*/
|
|
115
107
|
interface EffortOverridesCompiled {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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;
|
|
124
116
|
}
|
|
125
117
|
/**
|
|
126
118
|
* Compile resolved `EffortSettings` into the orchestration overrides above. Pure: same
|
|
@@ -134,60 +126,33 @@ interface EffortOverridesCompiled {
|
|
|
134
126
|
* compile to `withAnalyst: true`, the tier's `fanout`, and `withLoops: true`.
|
|
135
127
|
*/
|
|
136
128
|
declare function compileEffort(settings: EffortSettings): EffortOverridesCompiled;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
*
|
|
140
|
-
* Tangle Intelligence — the RECEIVE half of the loop (pull-by-default).
|
|
141
|
-
*
|
|
142
|
-
* The sibling Observe path (`./index`) sends run records UP to the plane. This
|
|
143
|
-
* module pulls certified artifacts DOWN: it reads the tenant's promoted,
|
|
144
|
-
* gate-certified profile from the deployed Intelligence plane so an approved
|
|
145
|
-
* improvement actually reaches the running agent. The pull carries three things
|
|
146
|
-
* the plane already composes:
|
|
147
|
-
* - the certified PROMPT surface + prompt-folding artifacts (delivered into the
|
|
148
|
-
* system prompt via {@link composeCertifiedPrompt} — the promoted prompt);
|
|
149
|
-
* - the typed profile DIFFS the plane has promoted, each with its held-out
|
|
150
|
-
* provenance (surfaced as PROPOSALS — never auto-applied at runtime);
|
|
151
|
-
* - the composed `agentProfile` those diffs fold to, for inspection.
|
|
152
|
-
*
|
|
153
|
-
* Pull contract (deployed plane): GET /v1/profiles/:target/composed →
|
|
154
|
-
* { target, generatedAt,
|
|
155
|
-
* promptSurface: {surface,surfaceHash,version,lift}|null,
|
|
156
|
-
* artifacts: { <artifactType>: [{path,content,contentHash,version,lift,promotedAt}] },
|
|
157
|
-
* capabilities: [{id,iface:{surface},binding:{path,content},provenance}],
|
|
158
|
-
* agentProfileDiffs: [{diff, provenance:{version,lift,contentHash,promotedAt}}],
|
|
159
|
-
* agentProfile: AgentProfile|null }
|
|
160
|
-
* Auth: Bearer <apiKey> (the one TANGLE_API_KEY shared by router + sandbox +
|
|
161
|
-
* intelligence), resolved to a tenant by platform-api's key-verify S2S contract.
|
|
162
|
-
*
|
|
163
|
-
* @experimental
|
|
164
|
-
*/
|
|
165
|
-
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/intelligence/delivery.d.ts
|
|
166
131
|
/** A promoted, certified artifact (one entry in the composed profile). */
|
|
167
132
|
interface CertifiedArtifact {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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;
|
|
176
141
|
}
|
|
177
142
|
/** The active promoted prompt surface for a target. */
|
|
178
143
|
interface CertifiedPromptSurface {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
144
|
+
surface: string;
|
|
145
|
+
surfaceHash: string;
|
|
146
|
+
version: number | null;
|
|
147
|
+
lift: string | null;
|
|
183
148
|
}
|
|
184
149
|
/** The held-out provenance the plane's certify step stamps on a promoted diff.
|
|
185
150
|
* `lift` is the held-out gate lift (e.g. "+3.1pp"), never a within-run claim. */
|
|
186
151
|
interface DiffProvenance {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
152
|
+
version: number | null;
|
|
153
|
+
lift: string | null;
|
|
154
|
+
contentHash: string;
|
|
155
|
+
promotedAt: string;
|
|
191
156
|
}
|
|
192
157
|
/**
|
|
193
158
|
* A gate-certified profile diff the plane has already promoted, plus the
|
|
@@ -197,61 +162,61 @@ interface DiffProvenance {
|
|
|
197
162
|
* into a shipped profile. It is NEVER auto-applied at runtime.
|
|
198
163
|
*/
|
|
199
164
|
interface ProposedProfileDiff {
|
|
200
|
-
|
|
201
|
-
|
|
165
|
+
diff: AgentProfileDiff;
|
|
166
|
+
provenance: DiffProvenance;
|
|
202
167
|
}
|
|
203
168
|
/** The composed endpoint's per-capability summary — the narrow shape on the
|
|
204
169
|
* wire (id + surface + path/content + provenance). Distinct from the richer
|
|
205
170
|
* `CertifiedCapability` the capability resolver lowers a manifest into. */
|
|
206
171
|
interface CertifiedCapabilitySummary {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
172
|
+
id: string;
|
|
173
|
+
iface: {
|
|
174
|
+
surface: string;
|
|
175
|
+
};
|
|
176
|
+
binding: {
|
|
177
|
+
path: string | null;
|
|
178
|
+
content: string;
|
|
179
|
+
};
|
|
180
|
+
provenance: DiffProvenance;
|
|
216
181
|
}
|
|
217
182
|
/** The composed certified profile — exactly the shape the plane's
|
|
218
183
|
* `GET /v1/profiles/:target/composed` returns. */
|
|
219
184
|
interface CertifiedProfile {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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;
|
|
232
197
|
}
|
|
233
198
|
/** Typed outcome for the pull — inspect `succeeded` before `value`. A 404
|
|
234
199
|
* (nothing promoted yet) is a normal, non-error `succeeded: false`. */
|
|
235
200
|
type PullOutcome = {
|
|
236
|
-
|
|
237
|
-
|
|
201
|
+
succeeded: true;
|
|
202
|
+
value: CertifiedProfile;
|
|
238
203
|
} | {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
204
|
+
succeeded: false;
|
|
205
|
+
error: string;
|
|
206
|
+
status?: number;
|
|
242
207
|
};
|
|
243
208
|
interface PullCertifiedOptions {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
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;
|
|
255
220
|
}
|
|
256
221
|
/** What Runtime knows about a failed proposal submission.
|
|
257
222
|
* `not-sent` means no request began, `rejected` means Intelligence returned a
|
|
@@ -260,29 +225,29 @@ interface PullCertifiedOptions {
|
|
|
260
225
|
type AgentImprovementProposalSubmissionState = 'not-sent' | 'rejected' | 'unconfirmed';
|
|
261
226
|
/** Submit a completed measured proposal for product-side review. */
|
|
262
227
|
interface SubmitAgentImprovementProposalOptions {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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;
|
|
273
238
|
}
|
|
274
239
|
/** Typed result for proposal submission. A successful result contains the
|
|
275
240
|
* exact immutable proposal Intelligence recorded. */
|
|
276
241
|
type SubmitAgentImprovementProposalOutcome = {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
242
|
+
succeeded: true;
|
|
243
|
+
value: AgentImprovementProposal$1;
|
|
244
|
+
status: number;
|
|
280
245
|
} | {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
246
|
+
succeeded: false;
|
|
247
|
+
submission: AgentImprovementProposalSubmissionState;
|
|
248
|
+
error: string;
|
|
249
|
+
status?: number;
|
|
250
|
+
code?: string;
|
|
286
251
|
};
|
|
287
252
|
/** Resolve the ONE Intelligence base URL — the single knob both the send and
|
|
288
253
|
* receive paths derive from. Env fallback: `TANGLE_INTELLIGENCE_URL`. */
|
|
@@ -326,19 +291,19 @@ declare function composeCertifiedPrompt(base: string, certified: Pick<CertifiedP
|
|
|
326
291
|
* `refreshMs`, coalesces concurrent pulls, keeps the last-known profile on a
|
|
327
292
|
* failed/404 pull, never throws, never blocks past the pull timeout. */
|
|
328
293
|
interface CertifiedPromptSource {
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
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>;
|
|
336
301
|
}
|
|
337
302
|
/** Options for {@link createCertifiedPromptSource} — the pull coordinates plus
|
|
338
303
|
* the refresh cadence. */
|
|
339
304
|
interface CertifiedPromptSourceOptions extends PullCertifiedOptions {
|
|
340
|
-
|
|
341
|
-
|
|
305
|
+
/** Min interval between certified-profile pulls. Default 5m. */
|
|
306
|
+
refreshMs?: number;
|
|
342
307
|
}
|
|
343
308
|
/**
|
|
344
309
|
* Create the cached certified-prompt source — the ONE module-scope-cache +
|
|
@@ -347,35 +312,8 @@ interface CertifiedPromptSourceOptions extends PullCertifiedOptions {
|
|
|
347
312
|
* `withIntelligence` hook rides this same source for its prompt delivery.
|
|
348
313
|
*/
|
|
349
314
|
declare function createCertifiedPromptSource(opts: CertifiedPromptSourceOptions): CertifiedPromptSource;
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
*
|
|
353
|
-
* The Capability-Delivery Manifest — the unified, future-proof structure for
|
|
354
|
-
* delivering ONE certified unit of agent power = `{ interface, binding }`.
|
|
355
|
-
*
|
|
356
|
-
* The law that makes it future-proof: **interfaces are closed; bindings are
|
|
357
|
-
* open.** The interface is the only thing the agent and the certify lane ever
|
|
358
|
-
* reason about (a tool / an MCP toolset / a prompt-context / a retrieval surface
|
|
359
|
-
* / a hook / a subagent). The binding is a tagged union over runtime kinds that
|
|
360
|
-
* the resolver collapses (inline / file / http / sandbox-code / mcp-stdio /
|
|
361
|
-
* mcp-remote / process-on-infra / rag-index / memory-store / wasm / a2a). A new
|
|
362
|
-
* runtime kind = one new binding arm + one resolver case; nothing else moves.
|
|
363
|
-
*
|
|
364
|
-
* This module owns the manifest TYPES and the lowering of TODAY's wire
|
|
365
|
-
* (`CertifiedProfile`) into a `CapabilityManifest`. The resolver — the single
|
|
366
|
-
* place that knows binding kinds and produces a uniform `ResolvedSurface` — lives
|
|
367
|
-
* in `./resolver`. The shipped prompt-only path (`composeCertifiedPrompt` in
|
|
368
|
-
* `./delivery`) is preserved verbatim: a prompt is a `Capability{ surface:
|
|
369
|
-
* 'context', binding:{ kind:'inline' } }`, so the existing
|
|
370
|
-
* `pullCertified → composeCertifiedPrompt → fail-closed` lane is a strict subset.
|
|
371
|
-
*
|
|
372
|
-
* Layering: this depends DOWN on `@tangle-network/sandbox` (the SDK
|
|
373
|
-
* `AgentProfileMcpServer` shape the mcp binding lowers to) and on the runtime's
|
|
374
|
-
* own `ToolSpec`. It never imports agent-eval and never reaches upward.
|
|
375
|
-
*
|
|
376
|
-
* @experimental
|
|
377
|
-
*/
|
|
378
|
-
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region src/intelligence/capability.d.ts
|
|
379
317
|
/** A JSON Schema object describing a tool's parameters. Kept structural — the
|
|
380
318
|
* resolver forwards it verbatim into a `ToolSpec` / MCP `tools/list` check. */
|
|
381
319
|
type JsonSchema = Record<string, unknown>;
|
|
@@ -384,32 +322,32 @@ type JsonSchema = Record<string, unknown>;
|
|
|
384
322
|
* arm maps slot-for-slot onto `AgentProfile` + the host `RouterToolsSeam`.
|
|
385
323
|
*/
|
|
386
324
|
type CapabilityInterface = {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
325
|
+
surface: 'tool';
|
|
326
|
+
name: string;
|
|
327
|
+
description?: string;
|
|
328
|
+
parameters: JsonSchema;
|
|
329
|
+
returns?: JsonSchema;
|
|
392
330
|
} | {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
331
|
+
surface: 'mcp';
|
|
332
|
+
serverName: string;
|
|
333
|
+
toolset?: string[];
|
|
396
334
|
} | {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
335
|
+
surface: 'context';
|
|
336
|
+
kind: 'prompt-surface' | 'skill' | 'instructions';
|
|
337
|
+
name: string;
|
|
400
338
|
} | {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
339
|
+
surface: 'retrieval';
|
|
340
|
+
name: string;
|
|
341
|
+
description?: string;
|
|
342
|
+
topK?: number;
|
|
405
343
|
} | {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
344
|
+
surface: 'hook';
|
|
345
|
+
event: string;
|
|
346
|
+
matcher?: string;
|
|
409
347
|
} | {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
348
|
+
surface: 'subagent';
|
|
349
|
+
name: string;
|
|
350
|
+
description?: string;
|
|
413
351
|
};
|
|
414
352
|
/** Every interface surface tag — the closed set the resolver fans into slots. */
|
|
415
353
|
type CapabilitySurface = CapabilityInterface['surface'];
|
|
@@ -418,22 +356,22 @@ type CapabilitySurface = CapabilityInterface['surface'];
|
|
|
418
356
|
* no inlined blob: `github`/`blob` are pointers resolved at provision time.
|
|
419
357
|
*/
|
|
420
358
|
type ContentRef = {
|
|
421
|
-
|
|
422
|
-
|
|
359
|
+
kind: 'inline';
|
|
360
|
+
content: string;
|
|
423
361
|
} | {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
362
|
+
kind: 'github';
|
|
363
|
+
repository?: string;
|
|
364
|
+
path: string;
|
|
365
|
+
ref?: string;
|
|
428
366
|
} | {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
367
|
+
kind: 'blob';
|
|
368
|
+
uri: string;
|
|
369
|
+
sha256: string;
|
|
370
|
+
bytes?: number;
|
|
433
371
|
};
|
|
434
372
|
/** A named secret a binding requires — declared, never carried. */
|
|
435
373
|
interface CredentialRef {
|
|
436
|
-
|
|
374
|
+
key: string;
|
|
437
375
|
}
|
|
438
376
|
/**
|
|
439
377
|
* How a binding authenticates at resolve time. Declared as a REQUIREMENT in the
|
|
@@ -441,16 +379,16 @@ interface CredentialRef {
|
|
|
441
379
|
* never inlined here.
|
|
442
380
|
*/
|
|
443
381
|
type CapabilityAuth = {
|
|
444
|
-
|
|
382
|
+
mode: 'none';
|
|
445
383
|
} | {
|
|
446
|
-
|
|
384
|
+
mode: 'tangle-key';
|
|
447
385
|
} | {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
386
|
+
mode: 'hub-connection';
|
|
387
|
+
providerId: string;
|
|
388
|
+
scopes?: string[];
|
|
451
389
|
} | {
|
|
452
|
-
|
|
453
|
-
|
|
390
|
+
mode: 'secret-ref';
|
|
391
|
+
key: string;
|
|
454
392
|
};
|
|
455
393
|
/**
|
|
456
394
|
* The host a `process-on-infra` binding provisions before its inner binding.
|
|
@@ -459,12 +397,12 @@ type CapabilityAuth = {
|
|
|
459
397
|
* cost; `ports` are the inner server's listen ports the host must expose.
|
|
460
398
|
*/
|
|
461
399
|
interface HostSpec {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
400
|
+
backend: 'sandbox' | 'router' | 'cli';
|
|
401
|
+
image?: string;
|
|
402
|
+
ports?: number[];
|
|
403
|
+
warm?: boolean;
|
|
404
|
+
idleTtlMs?: number;
|
|
405
|
+
costTag?: string;
|
|
468
406
|
}
|
|
469
407
|
/**
|
|
470
408
|
* How a capability is backed. OPEN tagged union — THE extension point. All arms
|
|
@@ -472,57 +410,57 @@ interface HostSpec {
|
|
|
472
410
|
* throws {@link CapabilityNotAdmittedError} at resolve, never silently no-ops.
|
|
473
411
|
*/
|
|
474
412
|
type DeliveryBinding = {
|
|
475
|
-
|
|
476
|
-
|
|
413
|
+
kind: 'inline';
|
|
414
|
+
content: ContentRef;
|
|
477
415
|
} | {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
416
|
+
kind: 'file';
|
|
417
|
+
path: string;
|
|
418
|
+
content: ContentRef;
|
|
419
|
+
executable?: boolean;
|
|
482
420
|
} | {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
421
|
+
kind: 'http';
|
|
422
|
+
url: string;
|
|
423
|
+
method?: string;
|
|
424
|
+
auth?: CapabilityAuth;
|
|
487
425
|
} | {
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
426
|
+
kind: 'sandbox-code';
|
|
427
|
+
entry: string;
|
|
428
|
+
code: ContentRef;
|
|
429
|
+
runtime?: string;
|
|
430
|
+
harness?: string;
|
|
493
431
|
} | {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
432
|
+
kind: 'mcp-stdio';
|
|
433
|
+
command: string;
|
|
434
|
+
args?: string[];
|
|
435
|
+
env?: Record<string, string>;
|
|
436
|
+
cwd?: string;
|
|
499
437
|
} | {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
438
|
+
kind: 'mcp-remote';
|
|
439
|
+
url: string;
|
|
440
|
+
transport: 'http' | 'sse';
|
|
441
|
+
headers?: Record<string, string>;
|
|
504
442
|
} | {
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
443
|
+
kind: 'process-on-infra';
|
|
444
|
+
host: HostSpec;
|
|
445
|
+
inner: DeliveryBinding;
|
|
508
446
|
} | {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
447
|
+
kind: 'rag-index';
|
|
448
|
+
index: ContentRef;
|
|
449
|
+
embedModel: string;
|
|
450
|
+
topK?: number;
|
|
513
451
|
} | {
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
452
|
+
kind: 'memory-store';
|
|
453
|
+
provision: 'sqlite' | 'neo4j' | 'vector';
|
|
454
|
+
seed?: ContentRef;
|
|
517
455
|
} | {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
456
|
+
kind: 'wasm';
|
|
457
|
+
module: ContentRef;
|
|
458
|
+
exports: string[];
|
|
521
459
|
} | {
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
460
|
+
kind: 'a2a';
|
|
461
|
+
endpoint: string;
|
|
462
|
+
card: ContentRef;
|
|
463
|
+
auth?: CapabilityAuth;
|
|
526
464
|
};
|
|
527
465
|
/** Every binding kind — the open set the resolver dispatches over. */
|
|
528
466
|
type DeliveryBindingKind = DeliveryBinding['kind'];
|
|
@@ -540,19 +478,19 @@ type DeliveryBindingKind = DeliveryBinding['kind'];
|
|
|
540
478
|
* mix of null-path and non-null-path artifacts.
|
|
541
479
|
*/
|
|
542
480
|
interface CertProvenance {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
481
|
+
contentHash: string;
|
|
482
|
+
version: number | null;
|
|
483
|
+
lift: string | null;
|
|
484
|
+
promotedAt: string;
|
|
485
|
+
sourcePath: string | null;
|
|
548
486
|
}
|
|
549
487
|
/** One certified unit of agent power. */
|
|
550
488
|
interface CertifiedCapability {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
489
|
+
id: string;
|
|
490
|
+
iface: CapabilityInterface;
|
|
491
|
+
binding: DeliveryBinding;
|
|
492
|
+
auth: CapabilityAuth;
|
|
493
|
+
provenance: CertProvenance;
|
|
556
494
|
}
|
|
557
495
|
/**
|
|
558
496
|
* The strict generalization of `CertifiedProfile`. `promptSurface` is kept
|
|
@@ -560,31 +498,31 @@ interface CertifiedCapability {
|
|
|
560
498
|
* capabilities live in `capabilities`.
|
|
561
499
|
*/
|
|
562
500
|
interface CapabilityManifest {
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
501
|
+
target: string;
|
|
502
|
+
generatedAt: string;
|
|
503
|
+
promptSurface: CertifiedPromptSurface | null;
|
|
504
|
+
capabilities: CertifiedCapability[];
|
|
567
505
|
}
|
|
568
506
|
/** One retrieval handle. The agent never learns vector vs graph vs index. */
|
|
569
507
|
interface ResolvedRetrieval {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
508
|
+
name: string;
|
|
509
|
+
retrieve(query: string, k?: number): Promise<Array<{
|
|
510
|
+
text: string;
|
|
511
|
+
score?: number;
|
|
512
|
+
}>>;
|
|
575
513
|
}
|
|
576
514
|
/** One resolved hook — event + the command/matcher the seam folds into
|
|
577
515
|
* `AgentProfile.hooks`. */
|
|
578
516
|
interface ResolvedHook {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
517
|
+
event: string;
|
|
518
|
+
command: string;
|
|
519
|
+
matcher?: string;
|
|
582
520
|
}
|
|
583
521
|
/** One resolved subagent — folded into `AgentProfile.subagents`. */
|
|
584
522
|
interface ResolvedSubagent {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
523
|
+
name: string;
|
|
524
|
+
description?: string;
|
|
525
|
+
prompt?: string;
|
|
588
526
|
}
|
|
589
527
|
/**
|
|
590
528
|
* What `composeCertifiedProfile` produces. Every binding fans into the same
|
|
@@ -593,32 +531,32 @@ interface ResolvedSubagent {
|
|
|
593
531
|
* `dispose()` tears provisioned hosts down in REVERSE dependency order.
|
|
594
532
|
*/
|
|
595
533
|
interface ResolvedSurface {
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
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>;
|
|
622
560
|
}
|
|
623
561
|
/**
|
|
624
562
|
* A binding kind whose resolver case is typed but not yet admitted (rag-index,
|
|
@@ -627,31 +565,32 @@ interface ResolvedSurface {
|
|
|
627
565
|
* resolver grows them later behind their lifecycle + admission gate.
|
|
628
566
|
*/
|
|
629
567
|
declare class CapabilityNotAdmittedError extends Error {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
568
|
+
readonly kind: DeliveryBindingKind;
|
|
569
|
+
readonly capabilityId: string;
|
|
570
|
+
constructor(kind: DeliveryBindingKind, capabilityId: string, reason: string);
|
|
633
571
|
}
|
|
634
572
|
/**
|
|
635
573
|
* Lower the EXISTING plane wire (`CertifiedProfile`) into a `CapabilityManifest`.
|
|
636
574
|
* `prompt-surface`/`skill` artifacts → `context`/inline capabilities (the
|
|
637
575
|
* shipped fold, generalized); any other artifact type → best-effort binding
|
|
638
|
-
* inference
|
|
576
|
+
* inference. `promptSurface` is carried through so
|
|
639
577
|
* the resolver folds it first, exactly as `composeCertifiedPrompt` does today.
|
|
640
578
|
* This delivers the spine against today's wire before the plane changes.
|
|
641
579
|
*/
|
|
642
580
|
declare function manifestFromProfile(profile: CertifiedProfile): CapabilityManifest;
|
|
643
|
-
|
|
581
|
+
//#endregion
|
|
582
|
+
//#region src/intelligence/improvement-surfaces.d.ts
|
|
644
583
|
/** Agent improvement surfaces delivered as exact `AgentProfileDiff` replacements. */
|
|
645
584
|
declare const AGENT_IMPROVEMENT_PROFILE_SURFACES: readonly ["prompt", "skills", "tools", "mcp", "hooks", "subagents"];
|
|
646
585
|
type AgentImprovementProfileSurface = (typeof AGENT_IMPROVEMENT_PROFILE_SURFACES)[number];
|
|
647
586
|
interface AgentImprovementTargetProfileDiffOptions {
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
587
|
+
id: string;
|
|
588
|
+
source?: AgentProfileDiff['source'];
|
|
589
|
+
metadata?: Record<string, unknown>;
|
|
651
590
|
}
|
|
652
591
|
type AgentImprovementActivationTargetIdentity = Pick<AgentImprovementActivationTarget, 'surface' | 'identity'>;
|
|
653
592
|
/** Bind caller-owned target identities to the exact source state Runtime measured. */
|
|
654
|
-
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[]];
|
|
655
594
|
/** Return whether a measured surface can be delivered through an agent profile. */
|
|
656
595
|
declare function isAgentImprovementProfileSurface(surface: AgentImprovementSurface): surface is AgentImprovementProfileSurface;
|
|
657
596
|
/**
|
|
@@ -660,168 +599,169 @@ declare function isAgentImprovementProfileSurface(surface: AgentImprovementSurfa
|
|
|
660
599
|
* Unrelated profile fields are excluded. The result matches `agentImprovementTargetInput` for the
|
|
661
600
|
* same profile inside a candidate bundle.
|
|
662
601
|
*/
|
|
663
|
-
declare function agentImprovementProfileSurfaceInput(profile: AgentProfile, surface: AgentImprovementProfileSurface): unknown;
|
|
602
|
+
declare function agentImprovementProfileSurfaceInput(profile: AgentProfile$1, surface: AgentImprovementProfileSurface): unknown;
|
|
664
603
|
/** Return the `Sha256Digest` of one profile surface using Runtime's canonical candidate digest. */
|
|
665
|
-
declare function agentImprovementProfileSurfaceDigest(profile: AgentProfile, surface: AgentImprovementProfileSurface): Sha256Digest;
|
|
604
|
+
declare function agentImprovementProfileSurfaceDigest(profile: AgentProfile$1, surface: AgentImprovementProfileSurface): Sha256Digest;
|
|
666
605
|
/**
|
|
667
606
|
* Replace one measured profile surface exactly, including array-valued resources.
|
|
668
607
|
* Apply the returned diffs in order: a diff applies its set before its removal,
|
|
669
608
|
* so exact replacement requires a reset record followed by a set record.
|
|
670
609
|
*/
|
|
671
610
|
declare function agentImprovementTargetProfileDiffs(target: {
|
|
672
|
-
|
|
673
|
-
|
|
611
|
+
surface: AgentImprovementProfileSurface;
|
|
612
|
+
desiredInput: unknown;
|
|
674
613
|
}, options: AgentImprovementTargetProfileDiffOptions): [AgentProfileDiff, ...AgentProfileDiff[]];
|
|
675
|
-
|
|
614
|
+
//#endregion
|
|
615
|
+
//#region src/intelligence/improvement-cycle.d.ts
|
|
676
616
|
interface AgentCandidateExperimentCellPlacement {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
617
|
+
executionId: string;
|
|
618
|
+
attempt?: number;
|
|
619
|
+
executionRoots: AgentCandidateTaskExecution['executionRoots'];
|
|
620
|
+
stagingRoots: AgentCandidateTaskExecution['stagingRoots'];
|
|
621
|
+
ports: AgentCandidateExecutionPorts;
|
|
622
|
+
preparation?: PrepareAgentCandidateExecutionOptions;
|
|
623
|
+
execution: ExecutePreparedAgentCandidateOptions;
|
|
684
624
|
}
|
|
685
625
|
interface RunAgentCandidateExperimentOptions extends Omit<CompareCandidateExperimentOptions, 'experiment' | 'measurements'> {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
626
|
+
experiment: AgentCandidateExperiment;
|
|
627
|
+
placeCell: (input: CandidateExperimentExecutionInput) => AgentCandidateExperimentCellPlacement | Promise<AgentCandidateExperimentCellPlacement>;
|
|
628
|
+
maxConcurrency?: number;
|
|
629
|
+
signal?: AbortSignal;
|
|
690
630
|
}
|
|
691
631
|
interface RunAgentCandidateExperimentResult {
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
}
|
|
696
|
-
interface ExecuteAgentCandidateExperimentCellOptions extends CandidateExperimentExecutionInput, AgentCandidateExperimentCellPlacement {
|
|
632
|
+
experiment: AgentCandidateExperiment;
|
|
633
|
+
measurements: AgentCandidateExperimentMeasurement[];
|
|
634
|
+
evaluation: AgentImprovementMeasuredComparison$1;
|
|
697
635
|
}
|
|
636
|
+
interface ExecuteAgentCandidateExperimentCellOptions extends CandidateExperimentExecutionInput, AgentCandidateExperimentCellPlacement {}
|
|
698
637
|
interface VerifyCandidateExecutionEvidenceOptions {
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
638
|
+
experiment: AgentCandidateExperiment;
|
|
639
|
+
arm: 'baseline' | 'candidate';
|
|
640
|
+
benchmarkCell: AgentCandidateBenchmarkCellRef;
|
|
641
|
+
seed: number;
|
|
642
|
+
attempt?: number;
|
|
643
|
+
resolvedResources?: ReadonlyMap<Sha256Digest, string>;
|
|
705
644
|
}
|
|
706
645
|
/** A failed baseline or candidate cell with its complete Runtime failure result. */
|
|
707
646
|
declare class AgentCandidateExperimentCellExecutionError extends Error {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
647
|
+
readonly finalization: Extract<AgentCandidateRunFinalization, {
|
|
648
|
+
succeeded: false;
|
|
649
|
+
}>;
|
|
650
|
+
constructor(finalization: Extract<AgentCandidateRunFinalization, {
|
|
651
|
+
succeeded: false;
|
|
652
|
+
}>);
|
|
714
653
|
}
|
|
715
654
|
interface CreateAgentImprovementProposalOptions {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
655
|
+
runId: string;
|
|
656
|
+
findings: readonly AnalystFinding$1[];
|
|
657
|
+
evaluation: AgentImprovementEvaluation$1;
|
|
658
|
+
now?: () => Date;
|
|
720
659
|
}
|
|
721
660
|
type CreateAgentImprovementMeasuredComparisonOptions = CompareCandidateExperimentOptions;
|
|
722
661
|
interface ReviewAgentImprovementInput {
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
662
|
+
decision: AgentImprovementReviewDecision$1;
|
|
663
|
+
reviewedBy: string;
|
|
664
|
+
reason: string;
|
|
665
|
+
feedback?: string;
|
|
666
|
+
now?: () => Date;
|
|
728
667
|
}
|
|
729
668
|
interface CreateAgentImprovementActivationOptions {
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
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;
|
|
737
676
|
}
|
|
738
|
-
interface ProposeAgentImprovementOptions<TScenario extends Scenario, TArtifact> {
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
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;
|
|
753
692
|
}
|
|
754
693
|
/** Product-supplied experiment material. Runtime supplies optimizer ancestry and the final digest. */
|
|
755
694
|
type AgentImprovementExperimentMaterial = Omit<AgentCandidateExperimentMaterial, 'candidateLineage'>;
|
|
756
|
-
interface ProposeAgentImprovementResult<TScenario extends Scenario, TArtifact> {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
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;
|
|
762
701
|
}
|
|
763
702
|
/** Execute both arms of one immutable experiment and derive its paired result. */
|
|
764
703
|
declare function runAgentCandidateExperiment(options: RunAgentCandidateExperimentOptions): Promise<RunAgentCandidateExperimentResult>;
|
|
765
704
|
/** Execute one exact arm, task, repetition, seed, and attempt through Runtime. */
|
|
766
|
-
declare function executeAgentCandidateExperimentCell(options: ExecuteAgentCandidateExperimentCellOptions): Promise<CandidateExecutionEvidence>;
|
|
705
|
+
declare function executeAgentCandidateExperimentCell(options: ExecuteAgentCandidateExperimentCellOptions): Promise<CandidateExecutionEvidence$1>;
|
|
767
706
|
/** Delegate all statistics and promotion checks to agent-eval's receipt-based comparison. */
|
|
768
|
-
declare function createAgentImprovementMeasuredComparison(options: CreateAgentImprovementMeasuredComparisonOptions): AgentImprovementMeasuredComparison;
|
|
707
|
+
declare function createAgentImprovementMeasuredComparison(options: CreateAgentImprovementMeasuredComparisonOptions): AgentImprovementMeasuredComparison$1;
|
|
769
708
|
/** Analyze, search, then remeasure the resulting exact candidate before proposing it. */
|
|
770
|
-
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>>;
|
|
771
710
|
/** Create the reviewable record only from a complete, recomputable experiment result. */
|
|
772
|
-
declare function createAgentImprovementProposal(options: CreateAgentImprovementProposalOptions): AgentImprovementProposal;
|
|
711
|
+
declare function createAgentImprovementProposal(options: CreateAgentImprovementProposalOptions): AgentImprovementProposal$1;
|
|
773
712
|
/** Persist a human or tenant-policy decision bound to one exact proposal. */
|
|
774
|
-
declare function reviewAgentImprovementProposal(inputProposal: AgentImprovementProposal, input: ReviewAgentImprovementInput): AgentImprovementReview;
|
|
713
|
+
declare function reviewAgentImprovementProposal(inputProposal: AgentImprovementProposal$1, input: ReviewAgentImprovementInput): AgentImprovementReview$1;
|
|
775
714
|
/** Authorize product-owned writes only after the exact candidate was measured and approved. */
|
|
776
|
-
declare function createAgentImprovementActivation(inputProposal: AgentImprovementProposal, inputReview: AgentImprovementReview, options: CreateAgentImprovementActivationOptions): AgentImprovementActivation;
|
|
715
|
+
declare function createAgentImprovementActivation(inputProposal: AgentImprovementProposal$1, inputReview: AgentImprovementReview$1, options: CreateAgentImprovementActivationOptions): AgentImprovementActivation$1;
|
|
777
716
|
/** Validate a proposal and recompute every binding to its measured experiment. */
|
|
778
|
-
declare function verifyAgentImprovementProposal(input: unknown): AgentImprovementProposal;
|
|
717
|
+
declare function verifyAgentImprovementProposal(input: unknown): AgentImprovementProposal$1;
|
|
779
718
|
/** Validate the canonical identity and wire shape of an improvement review. */
|
|
780
|
-
declare function verifyAgentImprovementReview(input: unknown): AgentImprovementReview;
|
|
719
|
+
declare function verifyAgentImprovementReview(input: unknown): AgentImprovementReview$1;
|
|
781
720
|
/** Validate activation authority against the exact proposal, review, experiment, and base state. */
|
|
782
721
|
declare function verifyAgentImprovementActivation(input: {
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
}): AgentImprovementActivation;
|
|
722
|
+
proposal: unknown;
|
|
723
|
+
review: unknown;
|
|
724
|
+
activation: unknown;
|
|
725
|
+
}): AgentImprovementActivation$1;
|
|
787
726
|
/** Recheck one Runtime receipt against its exact signed experiment cell. */
|
|
788
|
-
declare function verifyCandidateExecutionEvidence(input: unknown, options: VerifyCandidateExecutionEvidenceOptions): CandidateExecutionEvidence;
|
|
789
|
-
|
|
727
|
+
declare function verifyCandidateExecutionEvidence(input: unknown, options: VerifyCandidateExecutionEvidenceOptions): CandidateExecutionEvidence$1;
|
|
728
|
+
//#endregion
|
|
729
|
+
//#region src/intelligence/exact-process-candidate.d.ts
|
|
790
730
|
/** Candidate surfaces implemented by the neutral exact-process executor. */
|
|
791
731
|
declare const exactProcessCandidateExperimentExecutionSupport: Readonly<{
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
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
|
+
}>;
|
|
810
750
|
}>;
|
|
811
751
|
interface CreateExactProcessCandidateExperimentExecutorOptions {
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
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;
|
|
825
765
|
}
|
|
826
766
|
/** Product-owned candidate ports other than protected model access. */
|
|
827
767
|
type AgentCandidateExecutionHostPorts = Omit<AgentCandidateExecutionPorts, 'models'>;
|
|
@@ -830,148 +770,138 @@ type AgentCandidateExecutionHostPorts = Omit<AgentCandidateExecutionPorts, 'mode
|
|
|
830
770
|
* metered, and settled by the caller's grant service.
|
|
831
771
|
*/
|
|
832
772
|
interface CreateProtectedExactProcessCandidateExperimentExecutorOptions extends Omit<CreateExactProcessCandidateExperimentExecutorOptions, 'ports'> {
|
|
833
|
-
|
|
834
|
-
|
|
773
|
+
hostPorts: AgentCandidateExecutionHostPorts;
|
|
774
|
+
model: CreateProtectedAgentCandidateModelPortOptions;
|
|
835
775
|
}
|
|
836
776
|
interface ExactProcessCandidateExperimentExecution extends CandidateExperimentExecutionInput {
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
777
|
+
executionId: string;
|
|
778
|
+
attempt?: number;
|
|
779
|
+
executionRoots: AgentCandidateExperimentCellPlacement['executionRoots'];
|
|
780
|
+
stagingRoots: AgentCandidateExperimentCellPlacement['stagingRoots'];
|
|
781
|
+
preparation?: PrepareAgentCandidateExecutionOptions;
|
|
842
782
|
}
|
|
843
783
|
interface ExactProcessCandidateExperimentExecutor {
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
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>;
|
|
847
787
|
}
|
|
848
788
|
/** Exact-process executor plus the ports required for durable recovery. */
|
|
849
789
|
interface ProtectedExactProcessCandidateExperimentExecutor extends ExactProcessCandidateExperimentExecutor {
|
|
850
|
-
|
|
790
|
+
readonly recoveryPorts: Pick<AgentCandidateExecutionPorts, 'models' | 'memory'>;
|
|
851
791
|
}
|
|
852
792
|
/** Execute one signed experiment cell through any declared exact-process provider. */
|
|
853
793
|
declare function createExactProcessCandidateExperimentExecutor(options: CreateExactProcessCandidateExperimentExecutorOptions): ExactProcessCandidateExperimentExecutor;
|
|
854
794
|
/** Compose host-owned execution ports with protected model access for one exact-process run. */
|
|
855
795
|
declare function createProtectedExactProcessCandidateExperimentExecutor(options: CreateProtectedExactProcessCandidateExperimentExecutorOptions): ProtectedExactProcessCandidateExperimentExecutor;
|
|
856
|
-
|
|
796
|
+
//#endregion
|
|
797
|
+
//#region src/intelligence/optimization-receipt.d.ts
|
|
857
798
|
type OptimizationProvenance = NonNullable<OptimizationMethodComparison['best']['provenance']>;
|
|
858
799
|
interface OptimizationActivationReceipt {
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
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;
|
|
887
828
|
}
|
|
888
829
|
interface OptimizationReceiptCost {
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
830
|
+
totalUsd: number;
|
|
831
|
+
accountingComplete: boolean;
|
|
832
|
+
incompleteReasons: string[];
|
|
892
833
|
}
|
|
893
834
|
/** Build a detached receipt only for methods backed by an identified external optimizer. */
|
|
894
835
|
declare function createOptimizationActivationReceipt(improvement: ImproveMethodResult): OptimizationActivationReceipt | undefined;
|
|
895
836
|
/** Read and verify the optimizer evidence carried by a measured proposal. */
|
|
896
|
-
declare function optimizationActivationReceiptFromMetadata(metadata: AgentImprovementMeasuredComparison['metadata']): OptimizationActivationReceipt | undefined;
|
|
897
|
-
|
|
837
|
+
declare function optimizationActivationReceiptFromMetadata(metadata: AgentImprovementMeasuredComparison$1['metadata']): OptimizationActivationReceipt | undefined;
|
|
838
|
+
//#endregion
|
|
839
|
+
//#region src/intelligence/profile-activation.d.ts
|
|
898
840
|
type AgentImprovementProfileActivationTarget = Omit<AgentImprovementActivationTargetPlan, 'surface'> & {
|
|
899
|
-
|
|
841
|
+
surface: AgentImprovementProfileSurface;
|
|
900
842
|
};
|
|
901
843
|
type AgentImprovementProfileTargetState = Omit<AgentImprovementActivationTargetState, 'surface'> & {
|
|
902
|
-
|
|
844
|
+
surface: AgentImprovementProfileSurface;
|
|
903
845
|
};
|
|
904
846
|
type AgentImprovementProfileTargetTransition = Omit<AgentImprovementActivationTargetTransition, 'surface'> & {
|
|
905
|
-
|
|
847
|
+
surface: AgentImprovementProfileSurface;
|
|
906
848
|
};
|
|
907
849
|
interface AgentImprovementProfileReplacement {
|
|
908
|
-
|
|
909
|
-
|
|
850
|
+
identity: string;
|
|
851
|
+
profile: AgentProfile$1;
|
|
910
852
|
}
|
|
853
|
+
interface AgentImprovementProfileStateDigestInput {
|
|
854
|
+
identity: string;
|
|
855
|
+
profile: AgentProfile$1;
|
|
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
|
+
};
|
|
911
874
|
type AgentImprovementProfileActivationPreparation = {
|
|
912
|
-
|
|
913
|
-
|
|
875
|
+
status: 'missing';
|
|
876
|
+
identities: readonly string[];
|
|
914
877
|
} | {
|
|
915
|
-
|
|
916
|
-
|
|
878
|
+
status: 'unavailable';
|
|
879
|
+
code: 'PROFILE_STATE_UNAVAILABLE';
|
|
880
|
+
identities: readonly string[];
|
|
881
|
+
requiredStateDigest: Sha256Digest;
|
|
917
882
|
} | {
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
883
|
+
status: 'already-applied' | 'conflict';
|
|
884
|
+
targets: [AgentImprovementProfileTargetState, ...AgentImprovementProfileTargetState[]];
|
|
885
|
+
} | {
|
|
886
|
+
status: 'apply';
|
|
887
|
+
replacements: [AgentImprovementProfileReplacement, ...AgentImprovementProfileReplacement[]];
|
|
888
|
+
targets: [AgentImprovementProfileTargetTransition, ...AgentImprovementProfileTargetTransition[]];
|
|
924
889
|
};
|
|
925
890
|
/**
|
|
926
891
|
* Compare product-owned profiles with an exact measured transition and prepare
|
|
927
|
-
*
|
|
928
|
-
*
|
|
929
|
-
* Profiles stay in product-owned stores, so this returns replacements instead
|
|
930
|
-
* of owning the transition callbacks used by Runtime-owned knowledge stores.
|
|
931
|
-
*/
|
|
932
|
-
declare function prepareAgentImprovementProfileActivation(input: {
|
|
933
|
-
currentByIdentity: ReadonlyMap<string, AgentProfile>;
|
|
934
|
-
targets: readonly [
|
|
935
|
-
AgentImprovementProfileActivationTarget,
|
|
936
|
-
...AgentImprovementProfileActivationTarget[]
|
|
937
|
-
];
|
|
938
|
-
}): AgentImprovementProfileActivationPreparation;
|
|
939
|
-
|
|
940
|
-
/**
|
|
941
|
-
*
|
|
942
|
-
* The capability resolver — the ONLY place that knows binding kinds. It lowers a
|
|
943
|
-
* `CapabilityManifest` into a uniform `ResolvedSurface` consumed identically by
|
|
944
|
-
* the in-process seam (`RouterToolsSeam.{tools, executeToolCall}` + a folded
|
|
945
|
-
* prompt) and the sandbox seam (`AgentProfile`).
|
|
946
|
-
*
|
|
947
|
-
* The spine (zero new infra) resolves inline/file, mcp-stdio/mcp-remote, and
|
|
948
|
-
* http tools for BOTH seams, reusing shipped primitives:
|
|
949
|
-
* - inline/context → `composeCertifiedPrompt` (delivery.ts) — byte-stable order;
|
|
950
|
-
* - http → a `ToolSpec` + a host-side fetch `execute`;
|
|
951
|
-
* - mcp-stdio/remote → an `AgentProfileMcpServer` (the strict union widens to
|
|
952
|
-
* the SDK's flat shape — an always-valid lowering).
|
|
953
|
-
*
|
|
954
|
-
* The ladder rungs that need infra are INJECTED capabilities of the resolve
|
|
955
|
-
* context (`runSandboxCode`, `provisionHost`), so the substrate-free caller wires
|
|
956
|
-
* only what it can host — a binding that needs an absent provider throws loudly,
|
|
957
|
-
* it is NEVER faked into a working surface. The not-yet-admitted arms (rag-index,
|
|
958
|
-
* memory-store, wasm, a2a) throw {@link CapabilityNotAdmittedError}.
|
|
959
|
-
*
|
|
960
|
-
* Fail-closed by construction (mirroring `pullCertified`): a `null` manifest
|
|
961
|
-
* returns the base surface only; a per-capability resolve failure DROPS that
|
|
962
|
-
* capability (never a half-wired tool); a post-resolve drift check drops any tool
|
|
963
|
-
* whose live names diverge from the certified interface.
|
|
964
|
-
*
|
|
965
|
-
* @experimental
|
|
892
|
+
* all-or-none replacements. The product owns locking, persistence, and retained
|
|
893
|
+
* state; Runtime owns the profile diff semantics and digest checks.
|
|
966
894
|
*/
|
|
967
|
-
|
|
895
|
+
declare function prepareAgentImprovementProfileActivation(input: AgentImprovementProfileActivationInput): AgentImprovementProfileActivationPreparation;
|
|
896
|
+
//#endregion
|
|
897
|
+
//#region src/intelligence/resolver.d.ts
|
|
968
898
|
/** A live, provisioned host the resolver tore up for a `process-on-infra` arm.
|
|
969
899
|
* `teardown()` runs at `dispose()` in reverse provisioning order. */
|
|
970
900
|
interface ProvisionedHost {
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
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>;
|
|
975
905
|
}
|
|
976
906
|
/**
|
|
977
907
|
* Per-call, per-tenant context the resolver reads. Everything that touches the
|
|
@@ -979,52 +909,52 @@ interface ProvisionedHost {
|
|
|
979
909
|
* no live secret and the substrate-free caller wires only what it can host.
|
|
980
910
|
*/
|
|
981
911
|
interface ResolveCtx {
|
|
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
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
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;
|
|
1028
958
|
}
|
|
1029
959
|
/**
|
|
1030
960
|
* Compose a certified profile into a uniform `ResolvedSurface`. Additive over
|
|
@@ -1036,73 +966,41 @@ interface ResolveCtx {
|
|
|
1036
966
|
* Fail-closed: a `null` manifest returns the base surface only.
|
|
1037
967
|
*/
|
|
1038
968
|
declare function composeCertifiedProfile(base: {
|
|
1039
|
-
|
|
969
|
+
systemPrompt: string;
|
|
1040
970
|
}, manifest: CapabilityManifest | null, ctx?: ResolveCtx): Promise<ResolvedSurface>;
|
|
1041
971
|
/** Lower a plane `CertifiedProfile` straight into a `ResolvedSurface` via
|
|
1042
972
|
* `manifestFromProfile` — the convenience the shipped pull lane calls when it
|
|
1043
973
|
* already holds a `CertifiedProfile` (today's wire) rather than a manifest. */
|
|
1044
974
|
declare function composeCertifiedProfileFromWire(base: {
|
|
1045
|
-
|
|
975
|
+
systemPrompt: string;
|
|
1046
976
|
}, profile: CertifiedProfile | null, ctx?: ResolveCtx): Promise<ResolvedSurface>;
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
*
|
|
1050
|
-
* `withIntelligence` — the ONE agent-runtime hook that unifies Tangle
|
|
1051
|
-
* Intelligence send + receive.
|
|
1052
|
-
*
|
|
1053
|
-
* It does two things per call, both fail-open:
|
|
1054
|
-
* 1. RECEIVE — pull the tenant's certified profile from the deployed plane
|
|
1055
|
-
* (cached + refreshed), hand the agent the certified prompt surface to fold
|
|
1056
|
-
* (`applied.composePrompt`) and the promoted, gate-certified profile DIFFS
|
|
1057
|
-
* as PROPOSALS (`applied.proposals` / `applied.applyProfile`).
|
|
1058
|
-
* 2. SEND — serialize a typed {@link RunRecord} for the call through the shipped
|
|
1059
|
-
* OTLP builders to the plane's `/v1/otlp` ingest, best-effort.
|
|
1060
|
-
*
|
|
1061
|
-
* SAFETY — observe + deliver ONLY. This hook NEVER auto-applies a received diff
|
|
1062
|
-
* at runtime. A promoted diff is surfaced as a proposal; a human, or the gated
|
|
1063
|
-
* local `improve()` loop, turns a proposal into a shipped profile. That
|
|
1064
|
-
* preserves the held-out invariant the plane enforces — a runtime that silently
|
|
1065
|
-
* folded an un-gated diff into itself would defeat the very gate the diff cleared.
|
|
1066
|
-
*
|
|
1067
|
-
* import { withIntelligence } from '@tangle-network/agent-runtime/intelligence'
|
|
1068
|
-
*
|
|
1069
|
-
* export const agent = withIntelligence(
|
|
1070
|
-
* async (input, applied) => {
|
|
1071
|
-
* const out = await myAgent(input, { systemPrompt: applied.composePrompt(BASE) })
|
|
1072
|
-
* applied.record({ success: true, usage: { inferenceUsd: 0.002, intelligenceUsd: 0 } })
|
|
1073
|
-
* return out
|
|
1074
|
-
* },
|
|
1075
|
-
* { project: 'support-agent', target: 'support-agent' },
|
|
1076
|
-
* )
|
|
1077
|
-
*
|
|
1078
|
-
* @experimental
|
|
1079
|
-
*/
|
|
1080
|
-
|
|
977
|
+
//#endregion
|
|
978
|
+
//#region src/intelligence/with-intelligence.d.ts
|
|
1081
979
|
/** What the hook hands the agent each run. Additive over the prompt-only
|
|
1082
980
|
* delivery: `composePrompt` folds the certified prompt surface (as before);
|
|
1083
981
|
* `proposals`/`applyProfile` surface the promoted profile DIFFS — never
|
|
1084
982
|
* auto-applied; `record` enriches the {@link RunRecord} that is sent. */
|
|
1085
983
|
interface AppliedIntelligence {
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
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;
|
|
1106
1004
|
}
|
|
1107
1005
|
/** An agent wrapped by {@link withIntelligence}: receives the input plus the
|
|
1108
1006
|
* intelligence delivered for this run. */
|
|
@@ -1111,25 +1009,25 @@ type IntelligenceAgent<I, O> = (input: I, applied: AppliedIntelligence) => Promi
|
|
|
1111
1009
|
* cadence, and a proposals callback. One base URL (`baseUrl` /
|
|
1112
1010
|
* `TANGLE_INTELLIGENCE_URL`) drives both the send and receive paths. */
|
|
1113
1011
|
interface IntelligenceHookConfig extends IntelligenceConfig {
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
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;
|
|
1125
1023
|
}
|
|
1126
1024
|
/** The wrapped agent — same `(input) => Promise<output>` shape, plus a manual
|
|
1127
1025
|
* `refresh()` and a `proposals()` accessor for the currently-promoted diffs. */
|
|
1128
1026
|
type IntelligenceWrapped<I, O> = ((input: I) => Promise<O>) & {
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1027
|
+
refresh(): Promise<void>;
|
|
1028
|
+
proposals(): ProposedProfileDiff[];
|
|
1029
|
+
/** Flush buffered trace spans before a short-lived process exits. */
|
|
1030
|
+
flush(): Promise<void>;
|
|
1133
1031
|
};
|
|
1134
1032
|
/**
|
|
1135
1033
|
* Wrap an agent so it (a) RECEIVES the tenant's certified profile — the prompt
|
|
@@ -1141,28 +1039,8 @@ type IntelligenceWrapped<I, O> = ((input: I) => Promise<O>) & {
|
|
|
1141
1039
|
* thrown by the agent itself propagates unchanged.
|
|
1142
1040
|
*/
|
|
1143
1041
|
declare function withIntelligence<I, O>(agent: IntelligenceAgent<I, O>, config: IntelligenceHookConfig): IntelligenceWrapped<I, O>;
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
*
|
|
1147
|
-
* Tangle Intelligence SDK — trace capture plus reviewable improvement.
|
|
1148
|
-
*
|
|
1149
|
-
* The client keeps live-agent trace delivery best-effort. The separate
|
|
1150
|
-
* improvement-cycle exports analyze completed traces, run a signed baseline
|
|
1151
|
-
* versus candidate experiment, bind review to its result, and activate only
|
|
1152
|
-
* the exact measured candidate.
|
|
1153
|
-
*
|
|
1154
|
-
* 1. OBSERVE — wrap a generic agent and export one trace span per call to
|
|
1155
|
-
* Tangle Intelligence, swallowing every export failure so a live agent
|
|
1156
|
-
* never fails because Intelligence is down.
|
|
1157
|
-
* 2. MODE 0 / OFF — at `effort: 'off'`, run the agent as PURE PASSTHROUGH
|
|
1158
|
-
* (zero intelligence spawns) with best-effort telemetry still on. The
|
|
1159
|
-
* exported trace tags usage by class `{ inferenceUsd, intelligenceUsd }`,
|
|
1160
|
-
* and at OFF `intelligenceUsd` is provably `0` — the mechanism that proves
|
|
1161
|
-
* an OFF customer paid inference-only.
|
|
1162
|
-
*
|
|
1163
|
-
* @experimental
|
|
1164
|
-
*/
|
|
1165
|
-
|
|
1042
|
+
//#endregion
|
|
1043
|
+
//#region src/intelligence/index.d.ts
|
|
1166
1044
|
/** Usage class for billing. Base-stream tokens bill `'inference'`; every
|
|
1167
1045
|
* intelligence spawn (analyst, corpus, loop) bills `'intelligence'`. The
|
|
1168
1046
|
* billing line falls on the spawn line. */
|
|
@@ -1173,10 +1051,10 @@ type UsageClass = 'inference' | 'intelligence';
|
|
|
1173
1051
|
* bill. This is a classification on the trace, NOT a budget-pool split.
|
|
1174
1052
|
*/
|
|
1175
1053
|
interface UsageSplit {
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
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;
|
|
1180
1058
|
}
|
|
1181
1059
|
/**
|
|
1182
1060
|
* The typed record `withIntelligence` sends per call — serialized through the
|
|
@@ -1186,44 +1064,44 @@ interface UsageSplit {
|
|
|
1186
1064
|
* tree under the same `traceId`.
|
|
1187
1065
|
*/
|
|
1188
1066
|
interface RunRecord {
|
|
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
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
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;
|
|
1227
1105
|
}
|
|
1228
1106
|
/**
|
|
1229
1107
|
* What an agent reports (via `applied.record`) to enrich the {@link RunRecord}
|
|
@@ -1232,91 +1110,91 @@ interface RunRecord {
|
|
|
1232
1110
|
* as pure inference (the base stream).
|
|
1233
1111
|
*/
|
|
1234
1112
|
interface RunReport {
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
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;
|
|
1250
1128
|
}
|
|
1251
1129
|
/** Repo coordinates a product may declare for the (later) Gated-PR mode. The
|
|
1252
1130
|
* Observe slice only records their PRESENCE for `doctor()`; it never touches
|
|
1253
1131
|
* the repo. */
|
|
1254
1132
|
interface RepoConfig {
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1133
|
+
owner: string;
|
|
1134
|
+
name: string;
|
|
1135
|
+
baseBranch: string;
|
|
1258
1136
|
}
|
|
1259
1137
|
/** Client configuration. `project` + `apiKey` are the Observe minimum; the
|
|
1260
1138
|
* rest tune effort, endpoint, redaction, and (for `doctor()` readiness)
|
|
1261
1139
|
* declare the surfaces/checks/repo a later PR mode would need. */
|
|
1262
1140
|
interface IntelligenceConfig {
|
|
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
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
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';
|
|
1305
1183
|
}
|
|
1306
1184
|
/** Metadata describing one traced run. `runId`/`traceId` default to fresh ids. */
|
|
1307
1185
|
interface TraceMeta {
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
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>;
|
|
1320
1198
|
}
|
|
1321
1199
|
/**
|
|
1322
1200
|
* The trace handle a `traceRun` body records into. `recordOutput` captures the
|
|
@@ -1325,104 +1203,104 @@ interface TraceMeta {
|
|
|
1325
1203
|
* an un-recorded run still exports a span with whatever was set.
|
|
1326
1204
|
*/
|
|
1327
1205
|
interface TraceHandle {
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
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;
|
|
1342
1220
|
}
|
|
1343
1221
|
/** Metadata for {@link IntelligenceClient.recordTrace}. */
|
|
1344
1222
|
interface RecordTraceMeta {
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
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;
|
|
1350
1228
|
}
|
|
1351
1229
|
/** The resolved outcome of one traced run, surfaced on the export span and
|
|
1352
1230
|
* available to the caller for downstream billing assertions. */
|
|
1353
1231
|
interface TraceOutcome {
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
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;
|
|
1365
1243
|
}
|
|
1366
1244
|
/** The Observe-mode Intelligence client. */
|
|
1367
1245
|
interface IntelligenceClient {
|
|
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
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
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>;
|
|
1408
1286
|
}
|
|
1409
1287
|
/** One mode's readiness verdict. */
|
|
1410
1288
|
interface ModeReadiness {
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1289
|
+
ready: boolean;
|
|
1290
|
+
/** Inputs this mode still needs, when not ready. Empty when ready. */
|
|
1291
|
+
missing: string[];
|
|
1414
1292
|
}
|
|
1415
1293
|
/** The `doctor()` readiness report — Mode-readiness without any network call. */
|
|
1416
1294
|
interface DoctorReport {
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
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
|
+
};
|
|
1426
1304
|
}
|
|
1427
1305
|
/**
|
|
1428
1306
|
* Create an Observe-mode Intelligence client. Resolves effort, the base URL, and
|
|
@@ -1431,5 +1309,6 @@ interface DoctorReport {
|
|
|
1431
1309
|
* and best-effort export must never spam an unauthenticated plane).
|
|
1432
1310
|
*/
|
|
1433
1311
|
declare function createIntelligenceClient(config: IntelligenceConfig): IntelligenceClient;
|
|
1434
|
-
|
|
1435
|
-
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
|