@tangle-network/agent-runtime 0.138.1 → 0.140.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.
Files changed (113) hide show
  1. package/dist/{activation-AyIFaunX.js → activation-eLJ6uRlP.js} +3 -3
  2. package/dist/{activation-AyIFaunX.js.map → activation-eLJ6uRlP.js.map} +1 -1
  3. package/dist/agent.d.ts +4 -4
  4. package/dist/agent.js +3 -3
  5. package/dist/{analyst-loop-Dk6_xfhI.js → analyst-loop-DtOEXGzR.js} +3 -3
  6. package/dist/{analyst-loop-Dk6_xfhI.js.map → analyst-loop-DtOEXGzR.js.map} +1 -1
  7. package/dist/analyst-loop.d.ts +1 -1
  8. package/dist/analyst-loop.js +1 -1
  9. package/dist/{authoring-Cw6Ufsng.js → authoring-J93uFAwd.js} +3 -3
  10. package/dist/{authoring-Cw6Ufsng.js.map → authoring-J93uFAwd.js.map} +1 -1
  11. package/dist/candidate-execution/index.d.ts +3 -3
  12. package/dist/candidate-execution/index.js +4 -4
  13. package/dist/{candidate-execution-CN2hO-og.js → candidate-execution-uuUeFSc6.js} +5 -5
  14. package/dist/{candidate-execution-CN2hO-og.js.map → candidate-execution-uuUeFSc6.js.map} +1 -1
  15. package/dist/{conversation-DIUtiLkC.js → conversation-C3eZCvLd.js} +8 -6
  16. package/dist/conversation-C3eZCvLd.js.map +1 -0
  17. package/dist/conversation.d.ts +1 -1
  18. package/dist/conversation.js +1 -1
  19. package/dist/durable.d.ts +1 -1
  20. package/dist/{environment-provider-CLNVqp6H.js → environment-provider-BAO8wt1_.js} +147 -48
  21. package/dist/environment-provider-BAO8wt1_.js.map +1 -0
  22. package/dist/{environment-provider-DA8LqBV-.d.ts → environment-provider-Bu3S3v78.d.ts} +3 -3
  23. package/dist/environment-provider.d.ts +1 -1
  24. package/dist/environment-provider.js +1 -1
  25. package/dist/{errors-CVIDr7GQ.js → errors-CDZ8XsVj.js} +34 -9
  26. package/dist/errors-CDZ8XsVj.js.map +1 -0
  27. package/dist/{graph-DxU92LTL.js → graph-BbMjq7-x.js} +5 -5
  28. package/dist/{graph-DxU92LTL.js.map → graph-BbMjq7-x.js.map} +1 -1
  29. package/dist/{improvement-cycle-hIOGxDtV.js → improvement-cycle-D6rhMJR0.js} +67 -66
  30. package/dist/improvement-cycle-D6rhMJR0.js.map +1 -0
  31. package/dist/{index-Bdgpx2Dx.d.ts → index-C6yfz0QN.d.ts} +5 -5
  32. package/dist/{index-BOgzou1U.d.ts → index-COnuT0h7.d.ts} +263 -82
  33. package/dist/{index-CETQJlqT.d.ts → index-CTz17pH6.d.ts} +11 -11
  34. package/dist/{index-DQxQgKDs.d.ts → index-DQv7iCeE.d.ts} +6 -6
  35. package/dist/index.d.ts +16 -16
  36. package/dist/index.js +16 -16
  37. package/dist/intelligence.d.ts +736 -681
  38. package/dist/intelligence.js +113 -8
  39. package/dist/intelligence.js.map +1 -1
  40. package/dist/kernel.d.ts +7 -7
  41. package/dist/kernel.js +12 -12
  42. package/dist/{knowledge-C-JiS5Xg.js → knowledge-CD-_FbJT.js} +7 -7
  43. package/dist/{knowledge-C-JiS5Xg.js.map → knowledge-CD-_FbJT.js.map} +1 -1
  44. package/dist/knowledge.d.ts +1 -1
  45. package/dist/knowledge.js +1 -1
  46. package/dist/{loop-runner-bin-B_Ww2iqY.js → loop-runner-bin-BBz_ACfQ.js} +5 -5
  47. package/dist/{loop-runner-bin-B_Ww2iqY.js.map → loop-runner-bin-BBz_ACfQ.js.map} +1 -1
  48. package/dist/{loop-runner-bin-OH61zEVw.d.ts → loop-runner-bin-DUNxyuaG.d.ts} +3 -3
  49. package/dist/loop-runner-bin.d.ts +1 -1
  50. package/dist/loop-runner-bin.js +1 -1
  51. package/dist/{materialization-BP5zspr2.js → materialization-CrdcfWXp.js} +4 -4
  52. package/dist/{materialization-BP5zspr2.js.map → materialization-CrdcfWXp.js.map} +1 -1
  53. package/dist/mcp/bin.js +4 -4
  54. package/dist/mcp/index.d.ts +5 -5
  55. package/dist/mcp/index.js +8 -8
  56. package/dist/mcp/memory-bin.js +1 -1
  57. package/dist/{memory-server-Cdpy7Uu8.js → memory-server-DsKOhzGf.js} +3 -3
  58. package/dist/{memory-server-Cdpy7Uu8.js.map → memory-server-DsKOhzGf.js.map} +1 -1
  59. package/dist/{model-policy-UTTc9Z-A.js → model-policy-DgRJIJse.js} +2 -2
  60. package/dist/{model-policy-UTTc9Z-A.js.map → model-policy-DgRJIJse.js.map} +1 -1
  61. package/dist/{openai-tools-BKJqaQ1b.js → openai-tools-DIKr72_l.js} +2 -2
  62. package/dist/{openai-tools-BKJqaQ1b.js.map → openai-tools-DIKr72_l.js.map} +1 -1
  63. package/dist/{openai-tools-DU3TZvFY.d.ts → openai-tools-yoRRzAUW.d.ts} +2 -2
  64. package/dist/{prepare-CYqGSYza.js → prepare-DK1qnk7-.js} +3 -3
  65. package/dist/{prepare-CYqGSYza.js.map → prepare-DK1qnk7-.js.map} +1 -1
  66. package/dist/primeintellect/index.d.ts +1 -1
  67. package/dist/profiles.d.ts +1 -1
  68. package/dist/profiles.js +1 -1
  69. package/dist/{protected-model-port-DEsTWOFs.d.ts → protected-model-port-B8ssMyUg.d.ts} +7 -7
  70. package/dist/{protected-model-port-B6DW_x2I.js → protected-model-port-DHeCm_UF.js} +2 -2
  71. package/dist/{protected-model-port-B6DW_x2I.js.map → protected-model-port-DHeCm_UF.js.map} +1 -1
  72. package/dist/{redact-BwEdhuVH.d.ts → redact-CLw2B7Qj.d.ts} +9 -9
  73. package/dist/{researcher-DBfKdnAz.js → researcher-CiSY6Wzb.js} +3 -3
  74. package/dist/{researcher-DBfKdnAz.js.map → researcher-CiSY6Wzb.js.map} +1 -1
  75. package/dist/retained-run-binding-Dp2e8xne.js +268 -0
  76. package/dist/retained-run-binding-Dp2e8xne.js.map +1 -0
  77. package/dist/{runtime-DhPCNvuH.d.ts → runtime-CVNWEw16.d.ts} +4 -4
  78. package/dist/{runtime-CUpB4rEP.js → runtime-tTA2iCZQ.js} +650 -222
  79. package/dist/runtime-tTA2iCZQ.js.map +1 -0
  80. package/dist/{sandbox-events-CA2amHoA.js → sandbox-events-DPmXlcKw.js} +24 -2
  81. package/dist/sandbox-events-DPmXlcKw.js.map +1 -0
  82. package/dist/{snapshot-BOIprwBk.js → snapshot-cK9K420n.js} +2 -2
  83. package/dist/{snapshot-BOIprwBk.js.map → snapshot-cK9K420n.js.map} +1 -1
  84. package/dist/{spawn-journal-DVFqdzO9.js → spawn-journal-DGXei3xG.js} +3 -3
  85. package/dist/{spawn-journal-DVFqdzO9.js.map → spawn-journal-DGXei3xG.js.map} +1 -1
  86. package/dist/{stream-agent-turn-Q5ellSUu.js → stream-agent-turn-4kUH8Nnn.js} +77 -34
  87. package/dist/stream-agent-turn-4kUH8Nnn.js.map +1 -0
  88. package/dist/{stream-agent-turn-DhPlvHwp.d.ts → stream-agent-turn-RjrKGk6S.d.ts} +5 -8
  89. package/dist/{structural-rollout-CwtVIJf-.js → structural-rollout-7LP9Ex0F.js} +9 -9
  90. package/dist/structural-rollout-7LP9Ex0F.js.map +1 -0
  91. package/dist/{supervise-CUJRmx3s.js → supervise-Cx1QY_hj.js} +9 -9
  92. package/dist/{supervise-CUJRmx3s.js.map → supervise-Cx1QY_hj.js.map} +1 -1
  93. package/dist/{supervisor-BoC2tFgH.js → supervisor-BV72aDmP.js} +13 -9
  94. package/dist/supervisor-BV72aDmP.js.map +1 -0
  95. package/dist/testing.d.ts +2 -2
  96. package/dist/testing.js +12 -12
  97. package/dist/{tool-server-Dh-NcbHr.js → tool-server-DEmLr9YY.js} +2 -2
  98. package/dist/{tool-server-Dh-NcbHr.js.map → tool-server-DEmLr9YY.js.map} +1 -1
  99. package/dist/{types-CxU37Uzr.d.ts → types-19ZOddS3.d.ts} +2 -2
  100. package/dist/{types-BBwGSiAj.d.ts → types-C244Huc9.d.ts} +16 -7
  101. package/dist/{types-BCkweg3w.d.ts → types-D4arYjUl.d.ts} +6 -6
  102. package/dist/{workspace-archive-C7AvjSVb.js → workspace-archive-HYlsPhfm.js} +2 -2
  103. package/dist/{workspace-archive-C7AvjSVb.js.map → workspace-archive-HYlsPhfm.js.map} +1 -1
  104. package/package.json +8 -8
  105. package/dist/conversation-DIUtiLkC.js.map +0 -1
  106. package/dist/environment-provider-CLNVqp6H.js.map +0 -1
  107. package/dist/errors-CVIDr7GQ.js.map +0 -1
  108. package/dist/improvement-cycle-hIOGxDtV.js.map +0 -1
  109. package/dist/runtime-CUpB4rEP.js.map +0 -1
  110. package/dist/sandbox-events-CA2amHoA.js.map +0 -1
  111. package/dist/stream-agent-turn-Q5ellSUu.js.map +0 -1
  112. package/dist/structural-rollout-CwtVIJf-.js.map +0 -1
  113. package/dist/supervisor-BoC2tFgH.js.map +0 -1
@@ -1,15 +1,15 @@
1
- import { b as LoopTraceEvent, it as RuntimeStreamEvent } from "./types-BBwGSiAj.js";
1
+ import { at as RuntimeStreamEvent, b as LoopTraceEvent } from "./types-C244Huc9.js";
2
2
  import { d as RunAnalystLoopOpts, f as RunAnalystLoopResult } from "./types-zWfqDjeL.js";
3
- import { Bt as RuntimeTelemetryOptions } from "./types-BCkweg3w.js";
4
- import { it as ToolSpec } from "./runtime-DhPCNvuH.js";
5
- import { a as AgentEnvironmentProviderRef, o as AgentEnvironmentProviderRegistry } from "./environment-provider-DA8LqBV-.js";
6
- import { T as AgentCandidateExecutionClaimStore, _ as PrepareAgentCandidateExecutionOptions, o as CreateProtectedAgentCandidateModelPortOptions, p as parseAgentCandidateProfileActivation, y as ExecutePreparedAgentCandidateOptions } from "./protected-model-port-DEsTWOFs.js";
7
- import { D as AgentCandidateRunFinalization, O as AgentCandidateTaskExecution, a as AgentCandidateExecutionPorts, c as AgentCandidateExecutorPort, r as AgentCandidateBenchmarkGraderPort, y as AgentCandidateOutputArtifactPort } from "./types-CxU37Uzr.js";
8
- import { D as ImproveScenarioPartitions, T as ImproveResult, _ as ImproveMethodOptions, n as defaultRedactor, r as resolveRedactor, t as Redactor, v as ImproveMethodResult, x as ImproveOptions } from "./redact-BwEdhuVH.js";
3
+ import { Bt as RuntimeTelemetryOptions } from "./types-D4arYjUl.js";
4
+ import { it as ToolSpec } from "./runtime-CVNWEw16.js";
5
+ import { a as AgentEnvironmentProviderRef, o as AgentEnvironmentProviderRegistry } from "./environment-provider-Bu3S3v78.js";
6
+ import { T as AgentCandidateExecutionClaimStore, _ as PrepareAgentCandidateExecutionOptions, o as CreateProtectedAgentCandidateModelPortOptions, p as parseAgentCandidateProfileActivation, y as ExecutePreparedAgentCandidateOptions } from "./protected-model-port-B8ssMyUg.js";
7
+ import { D as AgentCandidateRunFinalization, O as AgentCandidateTaskExecution, a as AgentCandidateExecutionPorts, c as AgentCandidateExecutorPort, r as AgentCandidateBenchmarkGraderPort, y as AgentCandidateOutputArtifactPort } from "./types-19ZOddS3.js";
8
+ import { D as ImproveScenarioPartitions, T as ImproveResult, _ as ImproveMethodOptions, n as defaultRedactor, r as resolveRedactor, t as Redactor, v as ImproveMethodResult, x as ImproveOptions } from "./redact-CLw2B7Qj.js";
9
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 { AgentCandidateBenchmarkCellRef, AgentCandidateBundle, AgentCandidateEvaluationPolicy, AgentCandidateExperiment, AgentCandidateExperimentMaterial, AgentCandidateExperimentMeasurement, AgentCandidateLineage, 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, AgentImprovementSource, AgentImprovementSurface, AgentProfile, AgentProfileDiff, AgentProfileImprovementChange, AgentProfileImprovementExecutionRef, AgentProfileImprovementExperiment, AgentProfileImprovementMeasuredComparison, AgentProfileImprovementMeasurement, AgentProfileImprovementRunReceipt, AgentProfileImprovementTaskMaterial, AgentProfileMcpServer, CandidateExecutionEvidence, CandidateExecutionEvidence as CandidateExecutionEvidence$1, Sha256Digest } from "@tangle-network/agent-interface";
10
11
  import { CostLedgerHandle, TraceStore } from "@tangle-network/agent-eval";
11
- import { OptimizationMethodComparison, OptimizationPackageSource, OptimizationTokenUsage } from "@tangle-network/agent-eval/campaign";
12
- import { AgentCandidateBenchmarkCellRef, AgentCandidateBundle, AgentCandidateEvaluationPolicy, 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, AgentImprovementSource, AgentImprovementSurface, AgentProfile as AgentProfile$1, AgentProfileDiff, AgentProfileImprovementChange, AgentProfileImprovementExecutionRef, AgentProfileImprovementExperiment, AgentProfileImprovementMeasuredComparison, AgentProfileImprovementMeasurement, AgentProfileImprovementRunReceipt, AgentProfileImprovementTaskMaterial, AgentProfileMcpServer, CandidateExecutionEvidence, CandidateExecutionEvidence as CandidateExecutionEvidence$1, Sha256Digest } from "@tangle-network/agent-interface";
12
+ import { CampaignScenarioIdentity, OptimizationMethodComparison, OptimizationPackageSource, OptimizationTokenUsage } from "@tangle-network/agent-eval/campaign";
13
13
  import { ProposalFinding as ProposalFinding$1 } from "@tangle-network/agent-eval/analyst";
14
14
  import { AgentProfileImprovementExperimentExecutionInput, CandidateExperimentExecutionInput, CompareCandidateExperimentOptions, Scenario as Scenario$1 } from "@tangle-network/agent-eval/contract";
15
15
  import { AgentExactProcessResources } from "@tangle-network/agent-interface/environment-provider";
@@ -127,748 +127,803 @@ interface EffortOverridesCompiled {
127
127
  */
128
128
  declare function compileEffort(settings: EffortSettings): EffortOverridesCompiled;
129
129
  //#endregion
130
- //#region src/intelligence/delivery.d.ts
131
- /** A promoted, certified artifact (one entry in the composed profile). */
132
- interface CertifiedArtifact {
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;
141
- }
142
- /** The active promoted prompt surface for a target. */
143
- interface CertifiedPromptSurface {
144
- surface: string;
145
- surfaceHash: string;
146
- version: number | null;
147
- lift: string | null;
148
- }
149
- /** The held-out provenance the plane's certify step stamps on a promoted diff.
150
- * `lift` is the held-out gate lift (e.g. "+3.1pp"), never a within-run claim. */
151
- interface DiffProvenance {
152
- version: number | null;
153
- lift: string | null;
154
- contentHash: string;
155
- promotedAt: string;
156
- }
130
+ //#region src/intelligence/improvement-surfaces.d.ts
131
+ /** Agent improvement surfaces delivered as exact `AgentProfileDiff` replacements. */
132
+ declare const AGENT_IMPROVEMENT_PROFILE_SURFACES: readonly ["prompt", "skills", "tools", "mcp", "hooks", "subagents"];
133
+ type AgentImprovementProfileSurface = (typeof AGENT_IMPROVEMENT_PROFILE_SURFACES)[number];
157
134
  /**
158
- * A gate-certified profile diff the plane has already promoted, plus the
159
- * held-out provenance it carries. This is the previously-DROPPED typed diff the
160
- * composed endpoint returns; `withIntelligence` deserializes it and surfaces it
161
- * as a PROPOSAL — a human, or the gated local `improve()` loop, turns a proposal
162
- * into a shipped profile. It is NEVER auto-applied at runtime.
135
+ * Profile changes eligible for the product-owned measured comparison path.
136
+ * The six directly deliverable profile surfaces retain their granular labels;
137
+ * any residual profile axis also adds the complete `agent-profile` surface.
163
138
  */
164
- interface ProposedProfileDiff {
165
- diff: AgentProfileDiff;
166
- provenance: DiffProvenance;
167
- }
168
- /** The composed endpoint's per-capability summary — the narrow shape on the
169
- * wire (id + surface + path/content + provenance). Distinct from the richer
170
- * `CertifiedCapability` the capability resolver lowers a manifest into. */
171
- interface CertifiedCapabilitySummary {
139
+ declare const AGENT_PROFILE_MEASURED_SURFACES: readonly ["prompt", "skills", "tools", "mcp", "hooks", "subagents", "agent-profile"];
140
+ type AgentProfileMeasuredSurface = (typeof AGENT_PROFILE_MEASURED_SURFACES)[number];
141
+ interface AgentImprovementTargetProfileDiffOptions {
172
142
  id: string;
173
- iface: {
174
- surface: string;
175
- };
176
- binding: {
177
- path: string | null;
178
- content: string;
179
- };
180
- provenance: DiffProvenance;
181
- }
182
- /** The composed certified profile — exactly the shape the plane's
183
- * `GET /v1/profiles/:target/composed` returns. */
184
- interface CertifiedProfile {
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;
197
- }
198
- /** Typed outcome for the pull — inspect `succeeded` before `value`. A 404
199
- * (nothing promoted yet) is a normal, non-error `succeeded: false`. */
200
- type PullOutcome = {
201
- succeeded: true;
202
- value: CertifiedProfile;
203
- } | {
204
- succeeded: false;
205
- error: string;
206
- status?: number;
207
- };
208
- interface PullCertifiedOptions {
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;
220
- }
221
- /** What Runtime knows about a failed proposal submission.
222
- * `not-sent` means no request began, `rejected` means Intelligence returned a
223
- * definitive 4xx response, and `unconfirmed` means the caller may safely retry
224
- * the same immutable proposal. */
225
- type AgentImprovementProposalSubmissionState = 'not-sent' | 'rejected' | 'unconfirmed';
226
- /** Submit a completed measured proposal for product-side review. */
227
- interface SubmitAgentImprovementProposalOptions {
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;
143
+ source?: AgentProfileDiff['source'];
144
+ metadata?: Record<string, unknown>;
238
145
  }
239
- /** Typed result for proposal submission. A successful result contains the
240
- * exact immutable proposal Intelligence recorded. */
241
- type SubmitAgentImprovementProposalOutcome = {
242
- succeeded: true;
243
- value: AgentImprovementProposal$1;
244
- status: number;
245
- } | {
246
- succeeded: false;
247
- submission: AgentImprovementProposalSubmissionState;
248
- error: string;
249
- status?: number;
250
- code?: string;
251
- };
252
- /** Resolve the ONE Intelligence base URL — the single knob both the send and
253
- * receive paths derive from. Env fallback: `TANGLE_INTELLIGENCE_URL`. */
254
- declare function resolveIntelligenceBaseUrl(baseUrl: string | undefined): string;
255
- /**
256
- * Deserialize the composed-endpoint response into a `CertifiedProfile`. The
257
- * previously-dropped `agentProfileDiffs`/`capabilities`/`agentProfile` are read
258
- * here so they round-trip to the consumer; a plane that has not yet promoted any
259
- * diffs simply yields empty arrays / a null profile (fail-closed, never a crash).
260
- */
261
- declare function normalizeCertifiedProfile(raw: unknown): CertifiedProfile;
146
+ type AgentImprovementActivationTargetIdentity = Pick<AgentImprovementActivationTarget, 'surface' | 'identity'>;
147
+ /** Bind caller-owned target identities to the exact source state Runtime measured. */
148
+ declare function buildAgentImprovementActivationTargets(surfaces: readonly AgentImprovementSurface[], experiment: AgentImprovementEvaluation$1['experiment'], intent: AgentImprovementActivationIntent$1, identities: readonly AgentImprovementActivationTargetIdentity[]): [AgentImprovementActivationTarget, ...AgentImprovementActivationTarget[]];
149
+ /** Return whether a measured surface can be delivered through an agent profile. */
150
+ declare function isAgentImprovementProfileSurface(surface: AgentImprovementSurface): surface is AgentImprovementProfileSurface;
151
+ /** Return whether a surface is eligible for shared profile measurement. */
152
+ declare function isAgentProfileMeasuredSurface(surface: string): surface is AgentProfileMeasuredSurface;
262
153
  /**
263
- * Pull the certified composed profile for a target. Fail-closed: a network
264
- * error or a non-2xx returns a typed `succeeded: false` (never throws), so a
265
- * caller can run on its base surface when Intelligence is unreachable. A 404 is
266
- * the normal "nothing promoted yet" signal, carried as `status: 404`.
154
+ * Return the canonical current-state input for one profile-deliverable improvement target.
155
+ * Missing slots become `null`; tools and subagents include both their direct and resource slots.
156
+ * Unrelated profile fields are excluded. The result matches `agentImprovementTargetInput` for the
157
+ * same profile inside a candidate bundle.
267
158
  */
268
- declare function pullCertified(opts: PullCertifiedOptions): Promise<PullOutcome>;
159
+ declare function agentImprovementProfileSurfaceInput(profile: AgentProfile, surface: AgentImprovementProfileSurface): unknown;
160
+ /** Return the `Sha256Digest` of one profile surface using Runtime's canonical candidate digest. */
161
+ declare function agentImprovementProfileSurfaceDigest(profile: AgentProfile, surface: AgentImprovementProfileSurface): Sha256Digest;
269
162
  /**
270
- * Submit a completed Runtime proposal to Intelligence for product-side review.
271
- * This never runs an experiment, approves a proposal, or applies a candidate.
272
- * A 4xx response is a confirmed `rejected` request. Network failures, timeouts,
273
- * 5xx responses, and invalid success responses are `unconfirmed`, so callers
274
- * can retry the same digest because Intelligence stores proposals idempotently.
163
+ * Replace one measured profile surface exactly, including array-valued resources.
164
+ * Apply the returned diffs in order: a diff applies its set before its removal,
165
+ * so exact replacement requires a reset record followed by a set record.
275
166
  */
276
- declare function submitAgentImprovementProposal(opts: SubmitAgentImprovementProposalOptions): Promise<SubmitAgentImprovementProposalOutcome>;
167
+ declare function agentImprovementTargetProfileDiffs(target: {
168
+ surface: AgentImprovementProfileSurface;
169
+ desiredInput: unknown;
170
+ }, options: AgentImprovementTargetProfileDiffOptions): [AgentProfileDiff, ...AgentProfileDiff[]];
277
171
  /**
278
- * Fold the certified prompt surface (and any certified prompt-folding artifacts:
279
- * `prompt-surface` / `skill` / `instructions`) into a base system prompt under a
280
- * marked section, so the deployed agent prompt == base + the gate-certified
281
- * additions. Order is stable (prompt surface first, then artifact buckets in
282
- * `promptFoldTypes` order, then by path within a bucket) so the same profile
283
- * renders byte-identically each call. Returns `base` unchanged when there is no
284
- * usable certified content. Reads only the prompt-folding slice of a profile.
172
+ * Derive the ordered profile patch that changes one executable profile into
173
+ * another, then prove the patch preserves the complete candidate state.
285
174
  */
286
- declare function composeCertifiedPrompt(base: string, certified: Pick<CertifiedProfile, 'promptSurface' | 'artifacts'> | null): string;
287
- /** A cached, self-refreshing source of a target's certified prompt additions —
288
- * the prompt-only delivery lane for callers that assemble their OWN system
289
- * prompt (product chat routes) rather than wrapping an agent fn. Same
290
- * fail-closed semantics as {@link pullCertified}: pulls at most every
291
- * `refreshMs`, coalesces concurrent pulls, keeps the last-known profile on a
292
- * failed/404 pull, never throws, never blocks past the pull timeout. */
293
- interface CertifiedPromptSource {
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>;
175
+ declare function agentImprovementProfileDiffs(baselineInput: AgentProfile, candidateInput: AgentProfile, options: AgentImprovementTargetProfileDiffOptions): [AgentProfileDiff, ...AgentProfileDiff[]];
176
+ //#endregion
177
+ //#region src/intelligence/profile-activation.d.ts
178
+ type AgentImprovementProfileActivationTarget = Omit<AgentImprovementActivationTargetPlan, 'surface'> & {
179
+ surface: AgentImprovementProfileSurface;
180
+ };
181
+ type AgentImprovementProfileTargetState = Omit<AgentImprovementActivationTargetState, 'surface'> & {
182
+ surface: AgentProfileMeasuredSurface;
183
+ };
184
+ type AgentImprovementProfileTargetTransition = Omit<AgentImprovementActivationTargetTransition, 'surface'> & {
185
+ surface: AgentProfileMeasuredSurface;
186
+ };
187
+ interface AgentImprovementProfileReplacement {
188
+ identity: string;
189
+ profile: AgentProfile;
301
190
  }
302
- /** Options for {@link createCertifiedPromptSource} — the pull coordinates plus
303
- * the refresh cadence. */
304
- interface CertifiedPromptSourceOptions extends PullCertifiedOptions {
305
- /** Min interval between certified-profile pulls. Default 5m. */
306
- refreshMs?: number;
191
+ interface AgentImprovementProfileStateDigestInput {
192
+ identity: string;
193
+ profile: AgentProfile;
194
+ }
195
+ /** Product-defined hash of the complete profile state that actually runs. */
196
+ type AgentImprovementProfileStateDigest = (input: AgentImprovementProfileStateDigestInput) => Sha256Digest;
197
+ interface AgentImprovementProfileStateResolverInput {
198
+ identity: string;
199
+ stateDigest: Sha256Digest;
307
200
  }
201
+ /** Product-owned retained-state lookup used only for an explicit restore. */
202
+ type AgentImprovementProfileStateResolver = (input: AgentImprovementProfileStateResolverInput) => AgentProfile | undefined;
203
+ type AgentImprovementProfileActivationInput = {
204
+ currentByIdentity: ReadonlyMap<string, AgentProfile>;
205
+ targets: readonly [AgentImprovementProfileActivationTarget, ...AgentImprovementProfileActivationTarget[]];
206
+ } | {
207
+ currentByIdentity: ReadonlyMap<string, AgentProfile>;
208
+ profileTransition: ProfileImprovementActivationTransitionInput;
209
+ stateDigest: AgentImprovementProfileStateDigest;
210
+ resolveState?: AgentImprovementProfileStateResolver;
211
+ };
212
+ type AgentImprovementProfileActivationPreparation = {
213
+ status: 'missing';
214
+ identities: readonly string[];
215
+ } | {
216
+ status: 'unavailable';
217
+ code: 'PROFILE_STATE_UNAVAILABLE';
218
+ identities: readonly string[];
219
+ requiredStateDigest: Sha256Digest;
220
+ } | {
221
+ status: 'already-applied' | 'conflict';
222
+ targets: [AgentImprovementProfileTargetState, ...AgentImprovementProfileTargetState[]];
223
+ } | {
224
+ status: 'apply';
225
+ replacements: [AgentImprovementProfileReplacement, ...AgentImprovementProfileReplacement[]];
226
+ targets: [AgentImprovementProfileTargetTransition, ...AgentImprovementProfileTargetTransition[]];
227
+ };
308
228
  /**
309
- * Create the cached certified-prompt source the ONE module-scope-cache +
310
- * coalesced-refresh + keep-last-known implementation. Product wiring uses this
311
- * rather than hand-rolling the same lines around `pullCertified`. The
312
- * `withIntelligence` hook rides this same source for its prompt delivery.
229
+ * Compare product-owned profiles with an exact measured transition and prepare
230
+ * all-or-none replacements. The product owns locking, persistence, and retained
231
+ * state; Runtime owns the profile diff semantics and digest checks.
313
232
  */
314
- declare function createCertifiedPromptSource(opts: CertifiedPromptSourceOptions): CertifiedPromptSource;
233
+ declare function prepareAgentImprovementProfileActivation(input: AgentImprovementProfileActivationInput): AgentImprovementProfileActivationPreparation;
315
234
  //#endregion
316
- //#region src/intelligence/capability.d.ts
317
- /** A JSON Schema object describing a tool's parameters. Kept structural — the
318
- * resolver forwards it verbatim into a `ToolSpec` / MCP `tools/list` check. */
319
- type JsonSchema = Record<string, unknown>;
320
- /**
321
- * What the agent consumes. CLOSED — a new runtime kind NEVER extends this. Each
322
- * arm maps slot-for-slot onto `AgentProfile` + the host `RouterToolsSeam`.
323
- */
324
- type CapabilityInterface = {
325
- surface: 'tool';
326
- name: string;
327
- description?: string;
328
- parameters: JsonSchema;
329
- returns?: JsonSchema;
330
- } | {
331
- surface: 'mcp';
332
- serverName: string;
333
- toolset?: string[];
334
- } | {
335
- surface: 'context';
336
- kind: 'prompt-surface' | 'skill' | 'instructions';
337
- name: string;
338
- } | {
339
- surface: 'retrieval';
340
- name: string;
341
- description?: string;
342
- topK?: number;
343
- } | {
344
- surface: 'hook';
345
- event: string;
346
- matcher?: string;
347
- } | {
348
- surface: 'subagent';
349
- name: string;
350
- description?: string;
351
- };
352
- /** Every interface surface tag — the closed set the resolver fans into slots. */
353
- type CapabilitySurface = CapabilityInterface['surface'];
354
- /**
355
- * Where a capability's bytes live. A leaked manifest carries no live secret and
356
- * no inlined blob: `github`/`blob` are pointers resolved at provision time.
357
- */
358
- type ContentRef = {
359
- kind: 'inline';
360
- content: string;
361
- } | {
362
- kind: 'github';
363
- repository?: string;
364
- path: string;
365
- ref?: string;
366
- } | {
367
- kind: 'blob';
368
- uri: string;
369
- sha256: string;
370
- bytes?: number;
235
+ //#region src/intelligence/improvement-cycle.d.ts
236
+ interface AgentCandidateExperimentCellPlacement {
237
+ executionId: string;
238
+ attempt?: number;
239
+ executionRoots: AgentCandidateTaskExecution['executionRoots'];
240
+ stagingRoots: AgentCandidateTaskExecution['stagingRoots'];
241
+ ports: AgentCandidateExecutionPorts;
242
+ preparation?: PrepareAgentCandidateExecutionOptions;
243
+ execution: ExecutePreparedAgentCandidateOptions;
244
+ }
245
+ interface RunAgentCandidateExperimentOptions extends Omit<CompareCandidateExperimentOptions, 'experiment' | 'measurements' | 'measurement' | 'preparation'> {
246
+ experiment: AgentCandidateExperiment;
247
+ placeCell: (input: CandidateExperimentExecutionInput) => AgentCandidateExperimentCellPlacement | Promise<AgentCandidateExperimentCellPlacement>;
248
+ maxConcurrency?: number;
249
+ /** Work before this call. Omit when this function is only measuring a sealed experiment. */
250
+ preparation?: CompareCandidateExperimentOptions['preparation'];
251
+ /** Shared account when preparation and held-out work have one customer budget. */
252
+ costLedger?: CostLedgerHandle;
253
+ signal?: AbortSignal;
254
+ }
255
+ interface RunAgentCandidateExperimentResult {
256
+ experiment: AgentCandidateExperiment;
257
+ measurements: AgentCandidateExperimentMeasurement[];
258
+ evaluation: AgentImprovementMeasuredComparison$1;
259
+ }
260
+ interface ExecuteAgentCandidateExperimentCellOptions extends CandidateExperimentExecutionInput, AgentCandidateExperimentCellPlacement {}
261
+ interface VerifyCandidateExecutionEvidenceOptions {
262
+ experiment: AgentCandidateExperiment;
263
+ arm: 'baseline' | 'candidate';
264
+ benchmarkCell: AgentCandidateBenchmarkCellRef;
265
+ seed: number;
266
+ attempt?: number;
267
+ resolvedResources?: ReadonlyMap<Sha256Digest, string>;
268
+ }
269
+ /** A failed baseline or candidate cell with its complete Runtime failure result. */
270
+ declare class AgentCandidateExperimentCellExecutionError extends Error {
271
+ readonly finalization: Extract<AgentCandidateRunFinalization, {
272
+ succeeded: false;
273
+ }>;
274
+ constructor(finalization: Extract<AgentCandidateRunFinalization, {
275
+ succeeded: false;
276
+ }>);
277
+ }
278
+ interface CreateAgentImprovementProposalOptions {
279
+ runId: string;
280
+ findings: readonly ProposalFinding$1[];
281
+ evaluation: AgentImprovementEvaluation$1;
282
+ now?: () => Date;
283
+ }
284
+ type CreateAgentImprovementMeasuredComparisonOptions = CompareCandidateExperimentOptions;
285
+ interface ReviewAgentImprovementInput {
286
+ decision: AgentImprovementReviewDecision$1;
287
+ reviewedBy: string;
288
+ reason: string;
289
+ feedback?: string;
290
+ now?: () => Date;
291
+ }
292
+ interface CreateAgentImprovementActivationOptions {
293
+ intent: AgentImprovementActivationIntent$1;
294
+ /** Runtime derives each exact source digest; callers identify only the records to change. */
295
+ targets: [AgentImprovementActivationTargetIdentity, ...AgentImprovementActivationTargetIdentity[]];
296
+ fundingOwner: string;
297
+ authorizedBy: string;
298
+ expiresAt: string;
299
+ /** Required only when an activation targets the complete `agent-profile` surface. */
300
+ executionRef?: AgentProfileImprovementExecutionRef;
301
+ now?: () => Date;
302
+ }
303
+ type AgentImprovementAnalysisOptions = Omit<RunAnalystLoopOpts, 'runId' | 'inputs' | 'improvementProposalSource' | 'knowledgeProposalSource' | 'onEvent' | 'log' | 'costLedger' | 'costPhase' | 'signal'> & {
304
+ inputs: Omit<RunAnalystLoopOpts['inputs'], 'judgeInput'> & {
305
+ judgeInput?: never;
306
+ };
371
307
  };
372
- /** A named secret a binding requires — declared, never carried. */
373
- interface CredentialRef {
374
- key: string;
308
+ type WithProposalFindings<T> = T extends unknown ? Omit<T, 'findings'> & {
309
+ findings?: readonly ProposalFinding$1[];
310
+ } : never;
311
+ interface ProposeAgentImprovementOptions<TScenario extends Scenario$1, TArtifact> {
312
+ runId: string;
313
+ profile: AgentProfile;
314
+ analysis: AgentImprovementAnalysisOptions;
315
+ improvement: WithProposalFindings<ImproveOptions<TScenario, TArtifact>>;
316
+ buildExperiment: (input: {
317
+ analysis: RunAnalystLoopResult;
318
+ improvement: ImproveResult<TScenario, TArtifact>;
319
+ }) => AgentImprovementExperimentMaterial | Promise<AgentImprovementExperimentMaterial>;
320
+ placeCell: RunAgentCandidateExperimentOptions['placeCell'];
321
+ maxConcurrency?: number;
322
+ signal?: AbortSignal;
323
+ candidate?: AgentImprovementMeasuredComparison$1['candidate'];
324
+ metadata?: AgentImprovementMeasuredComparison$1['metadata'];
325
+ now?: () => Date;
326
+ }
327
+ /** Product-supplied experiment material. Runtime supplies optimizer ancestry and the final digest. */
328
+ type AgentImprovementExperimentMaterial = Omit<AgentCandidateExperimentMaterial, 'candidateLineage'>;
329
+ interface ProposeAgentImprovementResult<TScenario extends Scenario$1, TArtifact> {
330
+ analysis: RunAnalystLoopResult;
331
+ improvement: ImproveResult<TScenario, TArtifact>;
332
+ experiment: AgentCandidateExperiment;
333
+ measurements: AgentCandidateExperimentMeasurement[];
334
+ proposal: AgentImprovementProposal$1;
335
+ }
336
+ /** Product-owned task material that Runtime freezes before either profile state runs. */
337
+ interface AgentProfileImprovementBenchmark {
338
+ tasks: [AgentProfileImprovementTaskMaterial, ...AgentProfileImprovementTaskMaterial[]];
339
+ reps: number;
340
+ seeds: [number, ...number[]];
341
+ policy: AgentCandidateEvaluationPolicy;
375
342
  }
376
343
  /**
377
- * How a binding authenticates at resolve time. Declared as a REQUIREMENT in the
378
- * manifest; the live secret is resolved per-tenant by the resolver context,
379
- * never inlined here.
344
+ * One product execution adapter shared by optimizer search and exact profile
345
+ * measurement. `executionRef` must identify both operations and their closure.
380
346
  */
381
- type CapabilityAuth = {
382
- mode: 'none';
383
- } | {
384
- mode: 'tangle-key';
385
- } | {
386
- mode: 'hub-connection';
387
- providerId: string;
388
- scopes?: string[];
389
- } | {
390
- mode: 'secret-ref';
391
- key: string;
347
+ interface AgentProfileImprovementExecutor<TScenario extends Scenario$1, TArtifact> {
348
+ executionRef: AgentProfileImprovementExecutionRef;
349
+ optimize: ImproveMethodOptions<TScenario, TArtifact>['agent'];
350
+ measure(input: AgentProfileImprovementExperimentExecutionInput & {
351
+ profile: AgentProfile;
352
+ }): Promise<AgentProfileImprovementRunReceipt>;
353
+ }
354
+ /** The portable profile changes that the measured-profile contract permits. */
355
+ type AgentProfileImprovementMethodOptions<TScenario extends Scenario$1, TArtifact> = Omit<ImproveMethodOptions<TScenario, TArtifact>, 'agent' | 'executionRef' | 'findings' | 'surface'> & {
356
+ surface?: AgentProfileMeasuredSurface;
357
+ findings?: readonly ProposalFinding$1[];
392
358
  };
393
359
  /**
394
- * The host a `process-on-infra` binding provisions before its inner binding.
395
- * Reuses `createExecutor`'s backend-as-data vocabulary no new runtime invented.
396
- * `image` is the sandbox image tag; `warm`/`idleTtlMs`/`costTag` meter standing
397
- * cost; `ports` are the inner server's listen ports the host must expose.
360
+ * Complete profile-improvement path for a product-owned source.
361
+ * Runtime owns analysis, search ancestry, profile diffs, experiment sealing,
362
+ * paired evaluation, and the reviewable proposal. The product keeps its
363
+ * profile bytes, task executor, billing, trace capture, and persistence.
398
364
  */
399
- interface HostSpec {
400
- backend: 'sandbox' | 'router' | 'cli';
401
- image?: string;
402
- ports?: number[];
403
- warm?: boolean;
404
- idleTtlMs?: number;
405
- costTag?: string;
365
+ interface ProposeAgentProfileImprovementOptions<TScenario extends Scenario$1, TArtifact> {
366
+ runId: string;
367
+ source: AgentImprovementSource;
368
+ profile: AgentProfile;
369
+ stateDigest: AgentImprovementProfileStateDigest;
370
+ analysis: AgentImprovementAnalysisOptions;
371
+ improvement: AgentProfileImprovementMethodOptions<TScenario, TArtifact>;
372
+ benchmark: AgentProfileImprovementBenchmark;
373
+ executor: AgentProfileImprovementExecutor<TScenario, TArtifact>;
374
+ /** One customer-approved maximum for analysis, optimization, and measurement. */
375
+ budgetUsd: number;
376
+ maxConcurrency?: number;
377
+ signal?: AbortSignal;
378
+ candidate?: AgentProfileImprovementMeasuredComparison['candidate'];
379
+ metadata?: AgentProfileImprovementMeasuredComparison['metadata'];
380
+ now?: () => Date;
381
+ }
382
+ interface ProposeAgentProfileImprovementResult {
383
+ analysis: RunAnalystLoopResult;
384
+ improvement: ImproveMethodResult;
385
+ experiment: AgentProfileImprovementExperiment;
386
+ measurements: AgentProfileImprovementMeasurement[];
387
+ proposal: AgentImprovementProposal$1;
406
388
  }
389
+ /** Execute both arms of one immutable experiment and derive its paired result. */
390
+ declare function runAgentCandidateExperiment(options: RunAgentCandidateExperimentOptions): Promise<RunAgentCandidateExperimentResult>;
391
+ /** Execute one exact arm, task, repetition, seed, and attempt through Runtime. */
392
+ declare function executeAgentCandidateExperimentCell(options: ExecuteAgentCandidateExperimentCellOptions): Promise<CandidateExecutionEvidence$1>;
393
+ /** Delegate all statistics and promotion checks to agent-eval's receipt-based comparison. */
394
+ declare function createAgentImprovementMeasuredComparison(options: CreateAgentImprovementMeasuredComparisonOptions): AgentImprovementMeasuredComparison$1;
407
395
  /**
408
- * How a capability is backed. OPEN tagged union THE extension point. All arms
409
- * are typed even when the resolver does not yet admit them; an un-admitted arm
410
- * throws {@link CapabilityNotAdmittedError} at resolve, never silently no-ops.
396
+ * Analyze a product-owned profile, search one profile surface, then run the
397
+ * exact baseline and candidate through the product executor before proposing.
411
398
  */
412
- type DeliveryBinding = {
413
- kind: 'inline';
414
- content: ContentRef;
415
- } | {
416
- kind: 'file';
417
- path: string;
418
- content: ContentRef;
419
- executable?: boolean;
420
- } | {
421
- kind: 'http';
422
- url: string;
423
- method?: string;
424
- auth?: CapabilityAuth;
425
- } | {
426
- kind: 'sandbox-code';
427
- entry: string;
428
- code: ContentRef;
429
- runtime?: string;
430
- harness?: string;
431
- } | {
432
- kind: 'mcp-stdio';
433
- command: string;
434
- args?: string[];
435
- env?: Record<string, string>;
436
- cwd?: string;
437
- } | {
438
- kind: 'mcp-remote';
439
- url: string;
440
- transport: 'http' | 'sse';
441
- headers?: Record<string, string>;
442
- } | {
443
- kind: 'process-on-infra';
444
- host: HostSpec;
445
- inner: DeliveryBinding;
446
- } | {
447
- kind: 'rag-index';
448
- index: ContentRef;
449
- embedModel: string;
450
- topK?: number;
451
- } | {
452
- kind: 'memory-store';
453
- provision: 'sqlite' | 'neo4j' | 'vector';
454
- seed?: ContentRef;
455
- } | {
456
- kind: 'wasm';
457
- module: ContentRef;
458
- exports: string[];
459
- } | {
460
- kind: 'a2a';
461
- endpoint: string;
462
- card: ContentRef;
463
- auth?: CapabilityAuth;
399
+ declare function proposeAgentProfileImprovement<TScenario extends Scenario$1, TArtifact>(options: ProposeAgentProfileImprovementOptions<TScenario, TArtifact>): Promise<ProposeAgentProfileImprovementResult>;
400
+ /** Analyze, search, then remeasure the resulting exact candidate before proposing it. */
401
+ declare function proposeAgentImprovement<TScenario extends Scenario$1, TArtifact>(options: ProposeAgentImprovementOptions<TScenario, TArtifact>): Promise<ProposeAgentImprovementResult<TScenario, TArtifact>>;
402
+ /** Create the reviewable record only from a complete, recomputable experiment result. */
403
+ declare function createAgentImprovementProposal(options: CreateAgentImprovementProposalOptions): AgentImprovementProposal$1;
404
+ /** Persist a human or tenant-policy decision bound to one exact proposal. */
405
+ declare function reviewAgentImprovementProposal(inputProposal: AgentImprovementProposal$1, input: ReviewAgentImprovementInput): AgentImprovementReview$1;
406
+ /** Authorize product-owned writes only after the exact candidate was measured and approved. */
407
+ declare function createAgentImprovementActivation(inputProposal: AgentImprovementProposal$1, inputReview: AgentImprovementReview$1, options: CreateAgentImprovementActivationOptions): AgentImprovementActivation$1;
408
+ /** Validate a proposal and recompute every binding to its measured experiment. */
409
+ declare function verifyAgentImprovementProposal(input: unknown): AgentImprovementProposal$1;
410
+ /** Validate the canonical identity and wire shape of an improvement review. */
411
+ declare function verifyAgentImprovementReview(input: unknown): AgentImprovementReview$1;
412
+ /** Validate activation authority against the exact proposal, review, experiment, and base state. */
413
+ declare function verifyAgentImprovementActivation(input: {
414
+ proposal: unknown;
415
+ review: unknown;
416
+ activation: unknown;
417
+ }): AgentImprovementActivation$1;
418
+ /** Recheck one Runtime receipt against its exact signed experiment cell. */
419
+ declare function verifyCandidateExecutionEvidence(input: unknown, options: VerifyCandidateExecutionEvidenceOptions): CandidateExecutionEvidence$1;
420
+ //#endregion
421
+ //#region src/intelligence/authored-profile-improvement.d.ts
422
+ /** Lineage accepted by the direct candidate path. Optimizer lineage belongs to `improve()`. */
423
+ type AuthoredAgentProfileCandidateLineage = Omit<AgentCandidateLineage, 'source' | 'profileDiffIds'> & {
424
+ source: Exclude<AgentCandidateLineage['source'], 'optimizer'>;
425
+ /** Runtime derives these from the exact profile change it seals. */
426
+ profileDiffIds?: never;
464
427
  };
465
- /** Every binding kind the open set the resolver dispatches over. */
466
- type DeliveryBindingKind = DeliveryBinding['kind'];
428
+ /** Provenance attached while Runtime derives the exact profile diff. */
429
+ type AuthoredAgentProfileDiffOptions = NonNullable<Parameters<typeof agentImprovementProfileDiffs>[2]>;
430
+ /** Product-owned executor for exact baseline/candidate profile measurement. */
431
+ interface AgentProfileCandidateMeasurementExecutor {
432
+ executionRef: AgentProfileImprovementExecutionRef;
433
+ measure(input: AgentProfileImprovementExperimentExecutionInput & {
434
+ profile: AgentProfile;
435
+ }): Promise<AgentProfileImprovementRunReceipt>;
436
+ }
467
437
  /**
468
- * The certify lane's held-out lift travelling WITH delivery. The shipped
469
- * `CertifiedArtifact` envelope minus its content (which moves into the binding
470
- * arm): `version`/`contentHash`/`lift` are stamped by the promote step, never
471
- * the author.
472
- *
473
- * `sourcePath` is the artifact's ORIGINAL path (including `null`). It is the
474
- * byte-stable fold sort key — the resolver folds context artifacts in
475
- * `composeCertifiedPrompt` order, which sorts by `path ?? ''`, so a `null` path
476
- * is load-bearing and MUST round-trip exactly. It is distinct from a context
477
- * `iface.name` (display only): collapsing the two flips the fold order for a
478
- * mix of null-path and non-null-path artifacts.
438
+ * Measure a complete human-authored, imported, or compound profile candidate.
439
+ * No optimizer runs and no optimizer receipt is fabricated.
479
440
  */
480
- interface CertProvenance {
441
+ interface ProposeAuthoredAgentProfileImprovementOptions {
442
+ runId: string;
443
+ source: AgentImprovementSource;
444
+ profile: AgentProfile;
445
+ stateDigest: AgentImprovementProfileStateDigest;
446
+ candidateProfile: AgentProfile;
447
+ candidateLineage: AuthoredAgentProfileCandidateLineage;
448
+ /** Optional source/artifact metadata used on Runtime-derived profile diff steps. */
449
+ diff?: AuthoredAgentProfileDiffOptions;
450
+ findings?: readonly ProposalFinding$1[];
451
+ benchmark: AgentProfileImprovementBenchmark;
452
+ executor: AgentProfileCandidateMeasurementExecutor;
453
+ /** One customer-approved maximum for the held-out paired measurement. */
454
+ budgetUsd: number;
455
+ /** Optional identities used to prove authored/imported development work is held out. */
456
+ developmentScenarios?: readonly CampaignScenarioIdentity[];
457
+ maxConcurrency?: number;
458
+ signal?: AbortSignal;
459
+ candidate?: AgentProfileImprovementMeasuredComparison['candidate'];
460
+ metadata?: AgentProfileImprovementMeasuredComparison['metadata'];
461
+ now?: () => Date;
462
+ }
463
+ interface ProposeAuthoredAgentProfileImprovementResult {
464
+ candidateProfile: AgentProfile;
465
+ candidateLineage: AgentCandidateLineage;
466
+ experiment: AgentProfileImprovementExperiment;
467
+ measurements: AgentProfileImprovementMeasurement[];
468
+ proposal: AgentImprovementProposal$1;
469
+ }
470
+ /**
471
+ * Put a complete authored/imported profile through the canonical profile
472
+ * experiment and proposal path without invoking `improve()`.
473
+ */
474
+ declare function proposeAuthoredAgentProfileImprovement(options: ProposeAuthoredAgentProfileImprovementOptions): Promise<ProposeAuthoredAgentProfileImprovementResult>;
475
+ //#endregion
476
+ //#region src/intelligence/delivery.d.ts
477
+ /** A promoted, certified artifact (one entry in the composed profile). */
478
+ interface CertifiedArtifact {
479
+ path: string | null;
480
+ content: string;
481
481
  contentHash: string;
482
482
  version: number | null;
483
+ /** Held-out gate lift attached at certification, e.g. "+3.1pp" — never a
484
+ * within-run claim. `null` when the promotion carried no lift record. */
483
485
  lift: string | null;
484
486
  promotedAt: string;
485
- sourcePath: string | null;
486
487
  }
487
- /** One certified unit of agent power. */
488
- interface CertifiedCapability {
489
- id: string;
490
- iface: CapabilityInterface;
491
- binding: DeliveryBinding;
492
- auth: CapabilityAuth;
493
- provenance: CertProvenance;
488
+ /** The active promoted prompt surface for a target. */
489
+ interface CertifiedPromptSurface {
490
+ surface: string;
491
+ surfaceHash: string;
492
+ version: number | null;
493
+ lift: string | null;
494
+ }
495
+ /** The held-out provenance the plane's certify step stamps on a promoted diff.
496
+ * `lift` is the held-out gate lift (e.g. "+3.1pp"), never a within-run claim. */
497
+ interface DiffProvenance {
498
+ version: number | null;
499
+ lift: string | null;
500
+ contentHash: string;
501
+ promotedAt: string;
494
502
  }
495
503
  /**
496
- * The strict generalization of `CertifiedProfile`. `promptSurface` is kept
497
- * during the migration window (the shipped pull lane still emits it); new
498
- * capabilities live in `capabilities`.
504
+ * A gate-certified profile diff the plane has already promoted, plus the
505
+ * held-out provenance it carries. This is the previously-DROPPED typed diff the
506
+ * composed endpoint returns; `withIntelligence` deserializes it and surfaces it
507
+ * as a PROPOSAL — a human, or the gated local `improve()` loop, turns a proposal
508
+ * into a shipped profile. It is NEVER auto-applied at runtime.
499
509
  */
500
- interface CapabilityManifest {
510
+ interface ProposedProfileDiff {
511
+ diff: AgentProfileDiff;
512
+ provenance: DiffProvenance;
513
+ }
514
+ /** The composed endpoint's per-capability summary — the narrow shape on the
515
+ * wire (id + surface + path/content + provenance). Distinct from the richer
516
+ * `CertifiedCapability` the capability resolver lowers a manifest into. */
517
+ interface CertifiedCapabilitySummary {
518
+ id: string;
519
+ iface: {
520
+ surface: string;
521
+ };
522
+ binding: {
523
+ path: string | null;
524
+ content: string;
525
+ };
526
+ provenance: DiffProvenance;
527
+ }
528
+ /** The composed certified profile — exactly the shape the plane's
529
+ * `GET /v1/profiles/:target/composed` returns. */
530
+ interface CertifiedProfile {
501
531
  target: string;
502
532
  generatedAt: string;
503
533
  promptSurface: CertifiedPromptSurface | null;
504
- capabilities: CertifiedCapability[];
505
- }
506
- /** One retrieval handle. The agent never learns vector vs graph vs index. */
507
- interface ResolvedRetrieval {
508
- name: string;
509
- retrieve(query: string, k?: number): Promise<Array<{
510
- text: string;
511
- score?: number;
512
- }>>;
513
- }
514
- /** One resolved hook — event + the command/matcher the seam folds into
515
- * `AgentProfile.hooks`. */
516
- interface ResolvedHook {
517
- event: string;
518
- command: string;
519
- matcher?: string;
520
- }
521
- /** One resolved subagent — folded into `AgentProfile.subagents`. */
522
- interface ResolvedSubagent {
523
- name: string;
524
- description?: string;
525
- prompt?: string;
534
+ artifacts: Record<string, CertifiedArtifact[]>;
535
+ /** The typed profile diffs the plane has promoted, each with held-out
536
+ * provenance. Surfaced as proposals; never auto-applied. Empty when none. */
537
+ agentProfileDiffs: ProposedProfileDiff[];
538
+ /** The composed capability summaries the plane returns. Empty when none. */
539
+ capabilities: CertifiedCapabilitySummary[];
540
+ /** The composed profile the promoted diffs fold to, for inspection. `null`
541
+ * when no diffs are promoted. */
542
+ agentProfile: AgentProfile | null;
526
543
  }
527
- /**
528
- * What `composeCertifiedProfile` produces. Every binding fans into the same
529
- * slots, consumed identically by the in-process seam (`RouterToolsSeam.{tools,
530
- * executeToolCall}` + folded prompt) and the sandbox seam (`AgentProfile`).
531
- * `dispose()` tears provisioned hosts down in REVERSE dependency order.
532
- */
533
- interface ResolvedSurface {
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>;
544
+ /** Typed outcome for the pull — inspect `succeeded` before `value`. A 404
545
+ * (nothing promoted yet) is a normal, non-error `succeeded: false`. */
546
+ type PullOutcome = {
547
+ succeeded: true;
548
+ value: CertifiedProfile;
549
+ } | {
550
+ succeeded: false;
551
+ error: string;
552
+ status?: number;
553
+ };
554
+ interface PullCertifiedOptions {
555
+ /** The agent target certified artifacts are promoted under. */
556
+ target: string;
557
+ /** Bearer key. Defaults to `process.env.TANGLE_API_KEY`. */
558
+ apiKey?: string;
559
+ /** Plane base URL. Defaults to `process.env.TANGLE_INTELLIGENCE_URL` then
560
+ * `https://intelligence.tangle.tools`. */
561
+ baseUrl?: string;
562
+ /** fetch impl (tests / non-global-fetch runtimes). Defaults to global fetch. */
563
+ fetchImpl?: typeof fetch;
564
+ /** Abort the request after this many ms. Default 10000. */
565
+ timeoutMs?: number;
560
566
  }
561
- /**
562
- * A binding kind whose resolver case is typed but not yet admitted (rag-index,
563
- * memory-store, wasm, a2a). Thrown by the resolver NEVER faked into a working
564
- * surface. The TYPE arms exist so the union is closed against the spec; the
565
- * resolver grows them later behind their lifecycle + admission gate.
566
- */
567
- declare class CapabilityNotAdmittedError extends Error {
568
- readonly kind: DeliveryBindingKind;
569
- readonly capabilityId: string;
570
- constructor(kind: DeliveryBindingKind, capabilityId: string, reason: string);
567
+ /** What Runtime knows about a failed proposal submission.
568
+ * `not-sent` means no request began, `rejected` means Intelligence returned a
569
+ * definitive 4xx response, and `unconfirmed` means the caller may safely retry
570
+ * the same immutable proposal. */
571
+ type AgentImprovementProposalSubmissionState = 'not-sent' | 'rejected' | 'unconfirmed';
572
+ /** Submit a completed measured proposal for product-side review. */
573
+ interface SubmitAgentImprovementProposalOptions {
574
+ proposal: AgentImprovementProposal$1;
575
+ /** Bearer key. Defaults to `process.env.TANGLE_API_KEY`. */
576
+ apiKey?: string;
577
+ /** Plane base URL. Defaults to `process.env.TANGLE_INTELLIGENCE_URL` then
578
+ * `https://intelligence.tangle.tools`. */
579
+ baseUrl?: string;
580
+ /** fetch impl (tests / non-global-fetch runtimes). Defaults to global fetch. */
581
+ fetchImpl?: typeof fetch;
582
+ /** Abort the request after this many ms. Default 10000. */
583
+ timeoutMs?: number;
571
584
  }
585
+ /** Typed result for proposal submission. A successful result contains the
586
+ * exact immutable proposal Intelligence recorded. */
587
+ type SubmitAgentImprovementProposalOutcome = {
588
+ succeeded: true;
589
+ value: AgentImprovementProposal$1;
590
+ status: number;
591
+ } | {
592
+ succeeded: false;
593
+ submission: AgentImprovementProposalSubmissionState;
594
+ error: string;
595
+ status?: number;
596
+ code?: string;
597
+ };
598
+ /** Resolve the ONE Intelligence base URL — the single knob both the send and
599
+ * receive paths derive from. Env fallback: `TANGLE_INTELLIGENCE_URL`. */
600
+ declare function resolveIntelligenceBaseUrl(baseUrl: string | undefined): string;
572
601
  /**
573
- * Lower the EXISTING plane wire (`CertifiedProfile`) into a `CapabilityManifest`.
574
- * `prompt-surface`/`skill` artifacts → `context`/inline capabilities (the
575
- * shipped fold, generalized); any other artifact type best-effort binding
576
- * inference. `promptSurface` is carried through so
577
- * the resolver folds it first, exactly as `composeCertifiedPrompt` does today.
578
- * This delivers the spine against today's wire before the plane changes.
602
+ * Deserialize the composed-endpoint response into a `CertifiedProfile`. The
603
+ * previously-dropped `agentProfileDiffs`/`capabilities`/`agentProfile` are read
604
+ * here so they round-trip to the consumer; a plane that has not yet promoted any
605
+ * diffs simply yields empty arrays / a null profile (fail-closed, never a crash).
579
606
  */
580
- declare function manifestFromProfile(profile: CertifiedProfile): CapabilityManifest;
581
- //#endregion
582
- //#region src/intelligence/improvement-surfaces.d.ts
583
- /** Agent improvement surfaces delivered as exact `AgentProfileDiff` replacements. */
584
- declare const AGENT_IMPROVEMENT_PROFILE_SURFACES: readonly ["prompt", "skills", "tools", "mcp", "hooks", "subagents"];
585
- type AgentImprovementProfileSurface = (typeof AGENT_IMPROVEMENT_PROFILE_SURFACES)[number];
607
+ declare function normalizeCertifiedProfile(raw: unknown): CertifiedProfile;
586
608
  /**
587
- * Profile changes eligible for the product-owned measured comparison path.
588
- * The six directly deliverable profile surfaces retain their granular labels;
589
- * any residual profile axis also adds the complete `agent-profile` surface.
590
- */
591
- declare const AGENT_PROFILE_MEASURED_SURFACES: readonly ["prompt", "skills", "tools", "mcp", "hooks", "subagents", "agent-profile"];
592
- type AgentProfileMeasuredSurface = (typeof AGENT_PROFILE_MEASURED_SURFACES)[number];
593
- interface AgentImprovementTargetProfileDiffOptions {
594
- id: string;
595
- source?: AgentProfileDiff['source'];
596
- metadata?: Record<string, unknown>;
597
- }
598
- type AgentImprovementActivationTargetIdentity = Pick<AgentImprovementActivationTarget, 'surface' | 'identity'>;
599
- /** Bind caller-owned target identities to the exact source state Runtime measured. */
600
- declare function buildAgentImprovementActivationTargets(surfaces: readonly AgentImprovementSurface[], experiment: AgentImprovementEvaluation$1['experiment'], intent: AgentImprovementActivationIntent$1, identities: readonly AgentImprovementActivationTargetIdentity[]): [AgentImprovementActivationTarget, ...AgentImprovementActivationTarget[]];
601
- /** Return whether a measured surface can be delivered through an agent profile. */
602
- declare function isAgentImprovementProfileSurface(surface: AgentImprovementSurface): surface is AgentImprovementProfileSurface;
603
- /** Return whether a surface is eligible for shared profile measurement. */
604
- declare function isAgentProfileMeasuredSurface(surface: string): surface is AgentProfileMeasuredSurface;
609
+ * Pull the certified composed profile for a target. Fail-closed: a network
610
+ * error or a non-2xx returns a typed `succeeded: false` (never throws), so a
611
+ * caller can run on its base surface when Intelligence is unreachable. A 404 is
612
+ * the normal "nothing promoted yet" signal, carried as `status: 404`.
613
+ */
614
+ declare function pullCertified(opts: PullCertifiedOptions): Promise<PullOutcome>;
605
615
  /**
606
- * Return the canonical current-state input for one profile-deliverable improvement target.
607
- * Missing slots become `null`; tools and subagents include both their direct and resource slots.
608
- * Unrelated profile fields are excluded. The result matches `agentImprovementTargetInput` for the
609
- * same profile inside a candidate bundle.
616
+ * Submit a completed Runtime proposal to Intelligence for product-side review.
617
+ * This never runs an experiment, approves a proposal, or applies a candidate.
618
+ * A 4xx response is a confirmed `rejected` request. Network failures, timeouts,
619
+ * 5xx responses, and invalid success responses are `unconfirmed`, so callers
620
+ * can retry the same digest because Intelligence stores proposals idempotently.
610
621
  */
611
- declare function agentImprovementProfileSurfaceInput(profile: AgentProfile$1, surface: AgentImprovementProfileSurface): unknown;
612
- /** Return the `Sha256Digest` of one profile surface using Runtime's canonical candidate digest. */
613
- declare function agentImprovementProfileSurfaceDigest(profile: AgentProfile$1, surface: AgentImprovementProfileSurface): Sha256Digest;
622
+ declare function submitAgentImprovementProposal(opts: SubmitAgentImprovementProposalOptions): Promise<SubmitAgentImprovementProposalOutcome>;
614
623
  /**
615
- * Replace one measured profile surface exactly, including array-valued resources.
616
- * Apply the returned diffs in order: a diff applies its set before its removal,
617
- * so exact replacement requires a reset record followed by a set record.
624
+ * Fold the certified prompt surface (and any certified prompt-folding artifacts:
625
+ * `prompt-surface` / `skill` / `instructions`) into a base system prompt under a
626
+ * marked section, so the deployed agent prompt == base + the gate-certified
627
+ * additions. Order is stable (prompt surface first, then artifact buckets in
628
+ * `promptFoldTypes` order, then by path within a bucket) so the same profile
629
+ * renders byte-identically each call. Returns `base` unchanged when there is no
630
+ * usable certified content. Reads only the prompt-folding slice of a profile.
618
631
  */
619
- declare function agentImprovementTargetProfileDiffs(target: {
620
- surface: AgentImprovementProfileSurface;
621
- desiredInput: unknown;
622
- }, options: AgentImprovementTargetProfileDiffOptions): [AgentProfileDiff, ...AgentProfileDiff[]];
632
+ declare function composeCertifiedPrompt(base: string, certified: Pick<CertifiedProfile, 'promptSurface' | 'artifacts'> | null): string;
633
+ /** A cached, self-refreshing source of a target's certified prompt additions —
634
+ * the prompt-only delivery lane for callers that assemble their OWN system
635
+ * prompt (product chat routes) rather than wrapping an agent fn. Same
636
+ * fail-closed semantics as {@link pullCertified}: pulls at most every
637
+ * `refreshMs`, coalesces concurrent pulls, keeps the last-known profile on a
638
+ * failed/404 pull, never throws, never blocks past the pull timeout. */
639
+ interface CertifiedPromptSource {
640
+ /** Refresh (window-respecting) then fold the certified additions into a
641
+ * base system prompt. Returns `base` unchanged when nothing is promoted. */
642
+ compose(base: string): Promise<string>;
643
+ /** The certified profile currently in effect (`null` = none pulled yet). */
644
+ current(): CertifiedProfile | null;
645
+ /** Pull now if the refresh window has elapsed; coalesced and fail-closed. */
646
+ refresh(): Promise<void>;
647
+ }
648
+ /** Options for {@link createCertifiedPromptSource} — the pull coordinates plus
649
+ * the refresh cadence. */
650
+ interface CertifiedPromptSourceOptions extends PullCertifiedOptions {
651
+ /** Min interval between certified-profile pulls. Default 5m. */
652
+ refreshMs?: number;
653
+ }
623
654
  /**
624
- * Derive the ordered profile patch that changes one executable profile into
625
- * another, then prove the patch preserves the complete candidate state.
655
+ * Create the cached certified-prompt source the ONE module-scope-cache +
656
+ * coalesced-refresh + keep-last-known implementation. Product wiring uses this
657
+ * rather than hand-rolling the same lines around `pullCertified`. The
658
+ * `withIntelligence` hook rides this same source for its prompt delivery.
626
659
  */
627
- declare function agentImprovementProfileDiffs(baselineInput: AgentProfile$1, candidateInput: AgentProfile$1, options: AgentImprovementTargetProfileDiffOptions): [AgentProfileDiff, ...AgentProfileDiff[]];
660
+ declare function createCertifiedPromptSource(opts: CertifiedPromptSourceOptions): CertifiedPromptSource;
628
661
  //#endregion
629
- //#region src/intelligence/profile-activation.d.ts
630
- type AgentImprovementProfileActivationTarget = Omit<AgentImprovementActivationTargetPlan, 'surface'> & {
631
- surface: AgentImprovementProfileSurface;
632
- };
633
- type AgentImprovementProfileTargetState = Omit<AgentImprovementActivationTargetState, 'surface'> & {
634
- surface: AgentProfileMeasuredSurface;
635
- };
636
- type AgentImprovementProfileTargetTransition = Omit<AgentImprovementActivationTargetTransition, 'surface'> & {
637
- surface: AgentProfileMeasuredSurface;
662
+ //#region src/intelligence/capability.d.ts
663
+ /** A JSON Schema object describing a tool's parameters. Kept structural — the
664
+ * resolver forwards it verbatim into a `ToolSpec` / MCP `tools/list` check. */
665
+ type JsonSchema = Record<string, unknown>;
666
+ /**
667
+ * What the agent consumes. CLOSED — a new runtime kind NEVER extends this. Each
668
+ * arm maps slot-for-slot onto `AgentProfile` + the host `RouterToolsSeam`.
669
+ */
670
+ type CapabilityInterface = {
671
+ surface: 'tool';
672
+ name: string;
673
+ description?: string;
674
+ parameters: JsonSchema;
675
+ returns?: JsonSchema;
676
+ } | {
677
+ surface: 'mcp';
678
+ serverName: string;
679
+ toolset?: string[];
680
+ } | {
681
+ surface: 'context';
682
+ kind: 'prompt-surface' | 'skill' | 'instructions';
683
+ name: string;
684
+ } | {
685
+ surface: 'retrieval';
686
+ name: string;
687
+ description?: string;
688
+ topK?: number;
689
+ } | {
690
+ surface: 'hook';
691
+ event: string;
692
+ matcher?: string;
693
+ } | {
694
+ surface: 'subagent';
695
+ name: string;
696
+ description?: string;
638
697
  };
639
- interface AgentImprovementProfileReplacement {
640
- identity: string;
641
- profile: AgentProfile$1;
642
- }
643
- interface AgentImprovementProfileStateDigestInput {
644
- identity: string;
645
- profile: AgentProfile$1;
646
- }
647
- /** Product-defined hash of the complete profile state that actually runs. */
648
- type AgentImprovementProfileStateDigest = (input: AgentImprovementProfileStateDigestInput) => Sha256Digest;
649
- interface AgentImprovementProfileStateResolverInput {
650
- identity: string;
651
- stateDigest: Sha256Digest;
652
- }
653
- /** Product-owned retained-state lookup used only for an explicit restore. */
654
- type AgentImprovementProfileStateResolver = (input: AgentImprovementProfileStateResolverInput) => AgentProfile$1 | undefined;
655
- type AgentImprovementProfileActivationInput = {
656
- currentByIdentity: ReadonlyMap<string, AgentProfile$1>;
657
- targets: readonly [AgentImprovementProfileActivationTarget, ...AgentImprovementProfileActivationTarget[]];
698
+ /** Every interface surface tag — the closed set the resolver fans into slots. */
699
+ type CapabilitySurface = CapabilityInterface['surface'];
700
+ /**
701
+ * Where a capability's bytes live. A leaked manifest carries no live secret and
702
+ * no inlined blob: `github`/`blob` are pointers resolved at provision time.
703
+ */
704
+ type ContentRef = {
705
+ kind: 'inline';
706
+ content: string;
658
707
  } | {
659
- currentByIdentity: ReadonlyMap<string, AgentProfile$1>;
660
- profileTransition: ProfileImprovementActivationTransitionInput;
661
- stateDigest: AgentImprovementProfileStateDigest;
662
- resolveState?: AgentImprovementProfileStateResolver;
708
+ kind: 'github';
709
+ repository?: string;
710
+ path: string;
711
+ ref?: string;
712
+ } | {
713
+ kind: 'blob';
714
+ uri: string;
715
+ sha256: string;
716
+ bytes?: number;
663
717
  };
664
- type AgentImprovementProfileActivationPreparation = {
665
- status: 'missing';
666
- identities: readonly string[];
718
+ /** A named secret a binding requires — declared, never carried. */
719
+ interface CredentialRef {
720
+ key: string;
721
+ }
722
+ /**
723
+ * How a binding authenticates at resolve time. Declared as a REQUIREMENT in the
724
+ * manifest; the live secret is resolved per-tenant by the resolver context,
725
+ * never inlined here.
726
+ */
727
+ type CapabilityAuth = {
728
+ mode: 'none';
667
729
  } | {
668
- status: 'unavailable';
669
- code: 'PROFILE_STATE_UNAVAILABLE';
670
- identities: readonly string[];
671
- requiredStateDigest: Sha256Digest;
730
+ mode: 'tangle-key';
672
731
  } | {
673
- status: 'already-applied' | 'conflict';
674
- targets: [AgentImprovementProfileTargetState, ...AgentImprovementProfileTargetState[]];
732
+ mode: 'hub-connection';
733
+ providerId: string;
734
+ scopes?: string[];
675
735
  } | {
676
- status: 'apply';
677
- replacements: [AgentImprovementProfileReplacement, ...AgentImprovementProfileReplacement[]];
678
- targets: [AgentImprovementProfileTargetTransition, ...AgentImprovementProfileTargetTransition[]];
736
+ mode: 'secret-ref';
737
+ key: string;
679
738
  };
680
739
  /**
681
- * Compare product-owned profiles with an exact measured transition and prepare
682
- * all-or-none replacements. The product owns locking, persistence, and retained
683
- * state; Runtime owns the profile diff semantics and digest checks.
740
+ * The host a `process-on-infra` binding provisions before its inner binding.
741
+ * Reuses `createExecutor`'s backend-as-data vocabulary no new runtime invented.
742
+ * `image` is the sandbox image tag; `warm`/`idleTtlMs`/`costTag` meter standing
743
+ * cost; `ports` are the inner server's listen ports the host must expose.
684
744
  */
685
- declare function prepareAgentImprovementProfileActivation(input: AgentImprovementProfileActivationInput): AgentImprovementProfileActivationPreparation;
686
- //#endregion
687
- //#region src/intelligence/improvement-cycle.d.ts
688
- interface AgentCandidateExperimentCellPlacement {
689
- executionId: string;
690
- attempt?: number;
691
- executionRoots: AgentCandidateTaskExecution['executionRoots'];
692
- stagingRoots: AgentCandidateTaskExecution['stagingRoots'];
693
- ports: AgentCandidateExecutionPorts;
694
- preparation?: PrepareAgentCandidateExecutionOptions;
695
- execution: ExecutePreparedAgentCandidateOptions;
696
- }
697
- interface RunAgentCandidateExperimentOptions extends Omit<CompareCandidateExperimentOptions, 'experiment' | 'measurements' | 'measurement' | 'preparation'> {
698
- experiment: AgentCandidateExperiment;
699
- placeCell: (input: CandidateExperimentExecutionInput) => AgentCandidateExperimentCellPlacement | Promise<AgentCandidateExperimentCellPlacement>;
700
- maxConcurrency?: number;
701
- /** Work before this call. Omit when this function is only measuring a sealed experiment. */
702
- preparation?: CompareCandidateExperimentOptions['preparation'];
703
- /** Shared account when preparation and held-out work have one customer budget. */
704
- costLedger?: CostLedgerHandle;
705
- signal?: AbortSignal;
706
- }
707
- interface RunAgentCandidateExperimentResult {
708
- experiment: AgentCandidateExperiment;
709
- measurements: AgentCandidateExperimentMeasurement[];
710
- evaluation: AgentImprovementMeasuredComparison$1;
711
- }
712
- interface ExecuteAgentCandidateExperimentCellOptions extends CandidateExperimentExecutionInput, AgentCandidateExperimentCellPlacement {}
713
- interface VerifyCandidateExecutionEvidenceOptions {
714
- experiment: AgentCandidateExperiment;
715
- arm: 'baseline' | 'candidate';
716
- benchmarkCell: AgentCandidateBenchmarkCellRef;
717
- seed: number;
718
- attempt?: number;
719
- resolvedResources?: ReadonlyMap<Sha256Digest, string>;
720
- }
721
- /** A failed baseline or candidate cell with its complete Runtime failure result. */
722
- declare class AgentCandidateExperimentCellExecutionError extends Error {
723
- readonly finalization: Extract<AgentCandidateRunFinalization, {
724
- succeeded: false;
725
- }>;
726
- constructor(finalization: Extract<AgentCandidateRunFinalization, {
727
- succeeded: false;
728
- }>);
745
+ interface HostSpec {
746
+ backend: 'sandbox' | 'router' | 'cli';
747
+ image?: string;
748
+ ports?: number[];
749
+ warm?: boolean;
750
+ idleTtlMs?: number;
751
+ costTag?: string;
729
752
  }
730
- interface CreateAgentImprovementProposalOptions {
731
- runId: string;
732
- findings: readonly ProposalFinding$1[];
733
- evaluation: AgentImprovementEvaluation$1;
734
- now?: () => Date;
753
+ /**
754
+ * How a capability is backed. OPEN tagged union — THE extension point. All arms
755
+ * are typed even when the resolver does not yet admit them; an un-admitted arm
756
+ * throws {@link CapabilityNotAdmittedError} at resolve, never silently no-ops.
757
+ */
758
+ type DeliveryBinding = {
759
+ kind: 'inline';
760
+ content: ContentRef;
761
+ } | {
762
+ kind: 'file';
763
+ path: string;
764
+ content: ContentRef;
765
+ executable?: boolean;
766
+ } | {
767
+ kind: 'http';
768
+ url: string;
769
+ method?: string;
770
+ auth?: CapabilityAuth;
771
+ } | {
772
+ kind: 'sandbox-code';
773
+ entry: string;
774
+ code: ContentRef;
775
+ runtime?: string;
776
+ harness?: string;
777
+ } | {
778
+ kind: 'mcp-stdio';
779
+ command: string;
780
+ args?: string[];
781
+ env?: Record<string, string>;
782
+ cwd?: string;
783
+ } | {
784
+ kind: 'mcp-remote';
785
+ url: string;
786
+ transport: 'http' | 'sse';
787
+ headers?: Record<string, string>;
788
+ } | {
789
+ kind: 'process-on-infra';
790
+ host: HostSpec;
791
+ inner: DeliveryBinding;
792
+ } | {
793
+ kind: 'rag-index';
794
+ index: ContentRef;
795
+ embedModel: string;
796
+ topK?: number;
797
+ } | {
798
+ kind: 'memory-store';
799
+ provision: 'sqlite' | 'neo4j' | 'vector';
800
+ seed?: ContentRef;
801
+ } | {
802
+ kind: 'wasm';
803
+ module: ContentRef;
804
+ exports: string[];
805
+ } | {
806
+ kind: 'a2a';
807
+ endpoint: string;
808
+ card: ContentRef;
809
+ auth?: CapabilityAuth;
810
+ };
811
+ /** Every binding kind — the open set the resolver dispatches over. */
812
+ type DeliveryBindingKind = DeliveryBinding['kind'];
813
+ /**
814
+ * The certify lane's held-out lift travelling WITH delivery. The shipped
815
+ * `CertifiedArtifact` envelope minus its content (which moves into the binding
816
+ * arm): `version`/`contentHash`/`lift` are stamped by the promote step, never
817
+ * the author.
818
+ *
819
+ * `sourcePath` is the artifact's ORIGINAL path (including `null`). It is the
820
+ * byte-stable fold sort key — the resolver folds context artifacts in
821
+ * `composeCertifiedPrompt` order, which sorts by `path ?? ''`, so a `null` path
822
+ * is load-bearing and MUST round-trip exactly. It is distinct from a context
823
+ * `iface.name` (display only): collapsing the two flips the fold order for a
824
+ * mix of null-path and non-null-path artifacts.
825
+ */
826
+ interface CertProvenance {
827
+ contentHash: string;
828
+ version: number | null;
829
+ lift: string | null;
830
+ promotedAt: string;
831
+ sourcePath: string | null;
735
832
  }
736
- type CreateAgentImprovementMeasuredComparisonOptions = CompareCandidateExperimentOptions;
737
- interface ReviewAgentImprovementInput {
738
- decision: AgentImprovementReviewDecision$1;
739
- reviewedBy: string;
740
- reason: string;
741
- feedback?: string;
742
- now?: () => Date;
833
+ /** One certified unit of agent power. */
834
+ interface CertifiedCapability {
835
+ id: string;
836
+ iface: CapabilityInterface;
837
+ binding: DeliveryBinding;
838
+ auth: CapabilityAuth;
839
+ provenance: CertProvenance;
743
840
  }
744
- interface CreateAgentImprovementActivationOptions {
745
- intent: AgentImprovementActivationIntent$1;
746
- /** Runtime derives each exact source digest; callers identify only the records to change. */
747
- targets: [AgentImprovementActivationTargetIdentity, ...AgentImprovementActivationTargetIdentity[]];
748
- fundingOwner: string;
749
- authorizedBy: string;
750
- expiresAt: string;
751
- /** Required only when an activation targets the complete `agent-profile` surface. */
752
- executionRef?: AgentProfileImprovementExecutionRef;
753
- now?: () => Date;
841
+ /**
842
+ * The strict generalization of `CertifiedProfile`. `promptSurface` is kept
843
+ * during the migration window (the shipped pull lane still emits it); new
844
+ * capabilities live in `capabilities`.
845
+ */
846
+ interface CapabilityManifest {
847
+ target: string;
848
+ generatedAt: string;
849
+ promptSurface: CertifiedPromptSurface | null;
850
+ capabilities: CertifiedCapability[];
754
851
  }
755
- type AgentImprovementAnalysisOptions = Omit<RunAnalystLoopOpts, 'runId' | 'inputs' | 'improvementProposalSource' | 'knowledgeProposalSource' | 'onEvent' | 'log' | 'costLedger' | 'costPhase' | 'signal'> & {
756
- inputs: Omit<RunAnalystLoopOpts['inputs'], 'judgeInput'> & {
757
- judgeInput?: never;
758
- };
759
- };
760
- type WithProposalFindings<T> = T extends unknown ? Omit<T, 'findings'> & {
761
- findings?: readonly ProposalFinding$1[];
762
- } : never;
763
- interface ProposeAgentImprovementOptions<TScenario extends Scenario$1, TArtifact> {
764
- runId: string;
765
- profile: AgentProfile$1;
766
- analysis: AgentImprovementAnalysisOptions;
767
- improvement: WithProposalFindings<ImproveOptions<TScenario, TArtifact>>;
768
- buildExperiment: (input: {
769
- analysis: RunAnalystLoopResult;
770
- improvement: ImproveResult<TScenario, TArtifact>;
771
- }) => AgentImprovementExperimentMaterial | Promise<AgentImprovementExperimentMaterial>;
772
- placeCell: RunAgentCandidateExperimentOptions['placeCell'];
773
- maxConcurrency?: number;
774
- signal?: AbortSignal;
775
- candidate?: AgentImprovementMeasuredComparison$1['candidate'];
776
- metadata?: AgentImprovementMeasuredComparison$1['metadata'];
777
- now?: () => Date;
852
+ /** One retrieval handle. The agent never learns vector vs graph vs index. */
853
+ interface ResolvedRetrieval {
854
+ name: string;
855
+ retrieve(query: string, k?: number): Promise<Array<{
856
+ text: string;
857
+ score?: number;
858
+ }>>;
778
859
  }
779
- /** Product-supplied experiment material. Runtime supplies optimizer ancestry and the final digest. */
780
- type AgentImprovementExperimentMaterial = Omit<AgentCandidateExperimentMaterial, 'candidateLineage'>;
781
- interface ProposeAgentImprovementResult<TScenario extends Scenario$1, TArtifact> {
782
- analysis: RunAnalystLoopResult;
783
- improvement: ImproveResult<TScenario, TArtifact>;
784
- experiment: AgentCandidateExperiment;
785
- measurements: AgentCandidateExperimentMeasurement[];
786
- proposal: AgentImprovementProposal$1;
860
+ /** One resolved hook event + the command/matcher the seam folds into
861
+ * `AgentProfile.hooks`. */
862
+ interface ResolvedHook {
863
+ event: string;
864
+ command: string;
865
+ matcher?: string;
787
866
  }
788
- /** Product-owned task material that Runtime freezes before either profile state runs. */
789
- interface AgentProfileImprovementBenchmark {
790
- tasks: [AgentProfileImprovementTaskMaterial, ...AgentProfileImprovementTaskMaterial[]];
791
- reps: number;
792
- seeds: [number, ...number[]];
793
- policy: AgentCandidateEvaluationPolicy;
867
+ /** One resolved subagent folded into `AgentProfile.subagents`. */
868
+ interface ResolvedSubagent {
869
+ name: string;
870
+ description?: string;
871
+ prompt?: string;
794
872
  }
795
873
  /**
796
- * One product execution adapter shared by optimizer search and exact profile
797
- * measurement. `executionRef` must identify both operations and their closure.
874
+ * What `composeCertifiedProfile` produces. Every binding fans into the same
875
+ * slots, consumed identically by the in-process seam (`RouterToolsSeam.{tools,
876
+ * executeToolCall}` + folded prompt) and the sandbox seam (`AgentProfile`).
877
+ * `dispose()` tears provisioned hosts down in REVERSE dependency order.
798
878
  */
799
- interface AgentProfileImprovementExecutor<TScenario extends Scenario$1, TArtifact> {
800
- executionRef: AgentProfileImprovementExecutionRef;
801
- optimize: ImproveMethodOptions<TScenario, TArtifact>['agent'];
802
- measure(input: AgentProfileImprovementExperimentExecutionInput & {
803
- profile: AgentProfile$1;
804
- }): Promise<AgentProfileImprovementRunReceipt>;
879
+ interface ResolvedSurface {
880
+ /** Host-side tool defs → `RouterToolsSeam.tools` / agent-app `extraTools`. */
881
+ tools: ToolSpec[];
882
+ /** Host-side dispatch for a resolved tool. Throws when `name` is unknown so a
883
+ * mis-dispatch is loud, never a silent empty string. */
884
+ execute(name: string, args: Record<string, unknown>, task: unknown): Promise<string>;
885
+ /** Sandbox-side tool delivery → `AgentProfile.mcp` / in-proc `createMcpEnvironment`. */
886
+ mcpConnections: Record<string, AgentProfileMcpServer>;
887
+ /** Prompt-context additions, byte-stable-ordered → folded system prompt. */
888
+ promptAdditions: string[];
889
+ /** Workspace files → `AgentProfile.resources.files`. */
890
+ files: Array<{
891
+ path: string;
892
+ content: string;
893
+ executable?: boolean;
894
+ }>;
895
+ /** Uniform retrieval handles. */
896
+ retrieval: ResolvedRetrieval[];
897
+ /** Hooks → `AgentProfile.hooks`. */
898
+ hooks: ResolvedHook[];
899
+ /** Subagents → `AgentProfile.subagents`. */
900
+ subagents: ResolvedSubagent[];
901
+ /** The folded system prompt — base + the byte-stable prompt additions, exactly
902
+ * as `composeCertifiedPrompt` renders the inline/context capabilities. */
903
+ systemPrompt: string;
904
+ /** Tear down provisioned hosts (reverse dependency order). */
905
+ dispose(): Promise<void>;
805
906
  }
806
- /** The portable profile changes that the measured-profile contract permits. */
807
- type AgentProfileImprovementMethodOptions<TScenario extends Scenario$1, TArtifact> = Omit<ImproveMethodOptions<TScenario, TArtifact>, 'agent' | 'executionRef' | 'findings' | 'surface'> & {
808
- surface?: AgentProfileMeasuredSurface;
809
- findings?: readonly ProposalFinding$1[];
810
- };
811
907
  /**
812
- * Complete profile-improvement path for a product-owned source.
813
- * Runtime owns analysis, search ancestry, profile diffs, experiment sealing,
814
- * paired evaluation, and the reviewable proposal. The product keeps its
815
- * profile bytes, task executor, billing, trace capture, and persistence.
908
+ * A binding kind whose resolver case is typed but not yet admitted (rag-index,
909
+ * memory-store, wasm, a2a). Thrown by the resolver — NEVER faked into a working
910
+ * surface. The TYPE arms exist so the union is closed against the spec; the
911
+ * resolver grows them later behind their lifecycle + admission gate.
816
912
  */
817
- interface ProposeAgentProfileImprovementOptions<TScenario extends Scenario$1, TArtifact> {
818
- runId: string;
819
- source: AgentImprovementSource;
820
- profile: AgentProfile$1;
821
- stateDigest: AgentImprovementProfileStateDigest;
822
- analysis: AgentImprovementAnalysisOptions;
823
- improvement: AgentProfileImprovementMethodOptions<TScenario, TArtifact>;
824
- benchmark: AgentProfileImprovementBenchmark;
825
- executor: AgentProfileImprovementExecutor<TScenario, TArtifact>;
826
- /** One customer-approved maximum for analysis, optimization, and measurement. */
827
- budgetUsd: number;
828
- maxConcurrency?: number;
829
- signal?: AbortSignal;
830
- candidate?: AgentProfileImprovementMeasuredComparison['candidate'];
831
- metadata?: AgentProfileImprovementMeasuredComparison['metadata'];
832
- now?: () => Date;
833
- }
834
- interface ProposeAgentProfileImprovementResult {
835
- analysis: RunAnalystLoopResult;
836
- improvement: ImproveMethodResult;
837
- experiment: AgentProfileImprovementExperiment;
838
- measurements: AgentProfileImprovementMeasurement[];
839
- proposal: AgentImprovementProposal$1;
913
+ declare class CapabilityNotAdmittedError extends Error {
914
+ readonly kind: DeliveryBindingKind;
915
+ readonly capabilityId: string;
916
+ constructor(kind: DeliveryBindingKind, capabilityId: string, reason: string);
840
917
  }
841
- /** Execute both arms of one immutable experiment and derive its paired result. */
842
- declare function runAgentCandidateExperiment(options: RunAgentCandidateExperimentOptions): Promise<RunAgentCandidateExperimentResult>;
843
- /** Execute one exact arm, task, repetition, seed, and attempt through Runtime. */
844
- declare function executeAgentCandidateExperimentCell(options: ExecuteAgentCandidateExperimentCellOptions): Promise<CandidateExecutionEvidence$1>;
845
- /** Delegate all statistics and promotion checks to agent-eval's receipt-based comparison. */
846
- declare function createAgentImprovementMeasuredComparison(options: CreateAgentImprovementMeasuredComparisonOptions): AgentImprovementMeasuredComparison$1;
847
918
  /**
848
- * Analyze a product-owned profile, search one profile surface, then run the
849
- * exact baseline and candidate through the product executor before proposing.
919
+ * Lower the EXISTING plane wire (`CertifiedProfile`) into a `CapabilityManifest`.
920
+ * `prompt-surface`/`skill` artifacts `context`/inline capabilities (the
921
+ * shipped fold, generalized); any other artifact type → best-effort binding
922
+ * inference. `promptSurface` is carried through so
923
+ * the resolver folds it first, exactly as `composeCertifiedPrompt` does today.
924
+ * This delivers the spine against today's wire before the plane changes.
850
925
  */
851
- declare function proposeAgentProfileImprovement<TScenario extends Scenario$1, TArtifact>(options: ProposeAgentProfileImprovementOptions<TScenario, TArtifact>): Promise<ProposeAgentProfileImprovementResult>;
852
- /** Analyze, search, then remeasure the resulting exact candidate before proposing it. */
853
- declare function proposeAgentImprovement<TScenario extends Scenario$1, TArtifact>(options: ProposeAgentImprovementOptions<TScenario, TArtifact>): Promise<ProposeAgentImprovementResult<TScenario, TArtifact>>;
854
- /** Create the reviewable record only from a complete, recomputable experiment result. */
855
- declare function createAgentImprovementProposal(options: CreateAgentImprovementProposalOptions): AgentImprovementProposal$1;
856
- /** Persist a human or tenant-policy decision bound to one exact proposal. */
857
- declare function reviewAgentImprovementProposal(inputProposal: AgentImprovementProposal$1, input: ReviewAgentImprovementInput): AgentImprovementReview$1;
858
- /** Authorize product-owned writes only after the exact candidate was measured and approved. */
859
- declare function createAgentImprovementActivation(inputProposal: AgentImprovementProposal$1, inputReview: AgentImprovementReview$1, options: CreateAgentImprovementActivationOptions): AgentImprovementActivation$1;
860
- /** Validate a proposal and recompute every binding to its measured experiment. */
861
- declare function verifyAgentImprovementProposal(input: unknown): AgentImprovementProposal$1;
862
- /** Validate the canonical identity and wire shape of an improvement review. */
863
- declare function verifyAgentImprovementReview(input: unknown): AgentImprovementReview$1;
864
- /** Validate activation authority against the exact proposal, review, experiment, and base state. */
865
- declare function verifyAgentImprovementActivation(input: {
866
- proposal: unknown;
867
- review: unknown;
868
- activation: unknown;
869
- }): AgentImprovementActivation$1;
870
- /** Recheck one Runtime receipt against its exact signed experiment cell. */
871
- declare function verifyCandidateExecutionEvidence(input: unknown, options: VerifyCandidateExecutionEvidenceOptions): CandidateExecutionEvidence$1;
926
+ declare function manifestFromProfile(profile: CertifiedProfile): CapabilityManifest;
872
927
  //#endregion
873
928
  //#region src/intelligence/exact-process-candidate.d.ts
874
929
  /** Candidate surfaces implemented by the neutral exact-process executor. */
@@ -948,7 +1003,7 @@ interface OptimizationActivationReceipt {
948
1003
  modules?: OptimizationProvenance['modules'];
949
1004
  python?: OptimizationProvenance['python'];
950
1005
  models?: {
951
- candidate?: NonNullable<AgentProfile$1['model']>;
1006
+ candidate?: NonNullable<AgentProfile['model']>;
952
1007
  optimizer?: string;
953
1008
  };
954
1009
  usage: {
@@ -1084,7 +1139,7 @@ interface AppliedIntelligence {
1084
1139
  /** Fold every proposal into `base` via `applyAgentProfileDiff`, in promotion
1085
1140
  * order, and return the result. The caller invokes this EXPLICITLY (it is the
1086
1141
  * human/gated apply step) — the hook never calls it on the run path. */
1087
- applyProfile(base: AgentProfile$1): AgentProfile$1;
1142
+ applyProfile(base: AgentProfile): AgentProfile;
1088
1143
  /** Enrich the {@link RunRecord} sent for this call — outcome, usage split,
1089
1144
  * model/provider, and the loop event stream. Optional; an un-recorded run
1090
1145
  * still sends input/output with an inference-only zero usage split. */
@@ -1167,7 +1222,7 @@ interface RunRecord {
1167
1222
  provider?: string;
1168
1223
  loopEvents?: LoopTraceEvent[];
1169
1224
  runtimeEvents?: RuntimeStreamEvent[];
1170
- profile?: AgentProfile$1;
1225
+ profile?: AgentProfile;
1171
1226
  sessionId?: string;
1172
1227
  harness?: string;
1173
1228
  repository?: string;
@@ -1206,7 +1261,7 @@ interface RunReport {
1206
1261
  provider?: string;
1207
1262
  loopEvents?: LoopTraceEvent[];
1208
1263
  runtimeEvents?: RuntimeStreamEvent[];
1209
- profile?: AgentProfile$1;
1264
+ profile?: AgentProfile;
1210
1265
  sessionId?: string;
1211
1266
  harness?: string;
1212
1267
  commitSha?: string;
@@ -1256,7 +1311,7 @@ interface IntelligenceConfig {
1256
1311
  /** Repo access a later PR mode would need. Recorded for `doctor()` only. */
1257
1312
  repo?: RepoConfig;
1258
1313
  /** Full canonical profile used for this agent. Exported redacted with a stable hash. */
1259
- profile?: AgentProfile$1;
1314
+ profile?: AgentProfile;
1260
1315
  /** Commit that produced the running agent, when known. */
1261
1316
  commitSha?: string;
1262
1317
  /** Runtime-event payload policy. Tool inputs/results remain off unless explicitly enabled. */
@@ -1398,5 +1453,5 @@ interface DoctorReport {
1398
1453
  */
1399
1454
  declare function createIntelligenceClient(config: IntelligenceConfig): IntelligenceClient;
1400
1455
  //#endregion
1401
- export { AGENT_IMPROVEMENT_PROFILE_SURFACES, AGENT_PROFILE_MEASURED_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 AgentImprovementAnalysisOptions, 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 AgentProfileImprovementBenchmark, type AgentProfileImprovementExecutor, type AgentProfileImprovementMethodOptions, type AgentProfileMeasuredSurface, 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 ProposeAgentProfileImprovementOptions, type ProposeAgentProfileImprovementResult, 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, agentImprovementProfileDiffs, agentImprovementProfileSurfaceDigest, agentImprovementProfileSurfaceInput, agentImprovementTargetProfileDiffs, buildAgentImprovementActivationTargets, compileEffort, composeCertifiedProfile, composeCertifiedProfileFromWire, composeCertifiedPrompt, createAgentImprovementActivation, createAgentImprovementActivationResult, createAgentImprovementMeasuredComparison, createAgentImprovementProposal, createCertifiedPromptSource, createExactProcessCandidateExperimentExecutor, createIntelligenceClient, createOptimizationActivationReceipt, createProtectedExactProcessCandidateExperimentExecutor, defaultEffortTier, defaultRedactor, exactProcessCandidateExperimentExecutionSupport, executeAgentCandidateExperimentCell, executeAgentImprovementActivation, isAgentImprovementProfileSurface, isAgentProfileMeasuredSurface, isIntelligenceOff, manifestFromProfile, normalizeCertifiedProfile, optimizationActivationReceiptFromMetadata, parseAgentCandidateProfileActivation as parseCandidateProfileMaterialization, prepareAgentImprovementProfileActivation, proposeAgentImprovement, proposeAgentProfileImprovement, pullCertified, resolveEffort, resolveIntelligenceBaseUrl, resolveRedactor, reviewAgentImprovementProposal, runAgentCandidateExperiment, submitAgentImprovementProposal, verifyAgentImprovementActivation, verifyAgentImprovementActivationResult, verifyAgentImprovementProposal, verifyAgentImprovementReview, verifyCandidateExecutionEvidence, withIntelligence };
1456
+ export { AGENT_IMPROVEMENT_PROFILE_SURFACES, AGENT_PROFILE_MEASURED_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 AgentImprovementAnalysisOptions, 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 AgentProfileCandidateMeasurementExecutor, type AgentProfileImprovementActivationOperation, type AgentProfileImprovementActivationTargetPlan, type AgentProfileImprovementBenchmark, type AgentProfileImprovementExecutor, type AgentProfileImprovementMethodOptions, type AgentProfileMeasuredSurface, type AppliedIntelligence, type AuthoredAgentProfileCandidateLineage, type AuthoredAgentProfileDiffOptions, 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 ProposeAgentProfileImprovementOptions, type ProposeAgentProfileImprovementResult, type ProposeAuthoredAgentProfileImprovementOptions, type ProposeAuthoredAgentProfileImprovementResult, 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, agentImprovementProfileDiffs, agentImprovementProfileSurfaceDigest, agentImprovementProfileSurfaceInput, agentImprovementTargetProfileDiffs, buildAgentImprovementActivationTargets, compileEffort, composeCertifiedProfile, composeCertifiedProfileFromWire, composeCertifiedPrompt, createAgentImprovementActivation, createAgentImprovementActivationResult, createAgentImprovementMeasuredComparison, createAgentImprovementProposal, createCertifiedPromptSource, createExactProcessCandidateExperimentExecutor, createIntelligenceClient, createOptimizationActivationReceipt, createProtectedExactProcessCandidateExperimentExecutor, defaultEffortTier, defaultRedactor, exactProcessCandidateExperimentExecutionSupport, executeAgentCandidateExperimentCell, executeAgentImprovementActivation, isAgentImprovementProfileSurface, isAgentProfileMeasuredSurface, isIntelligenceOff, manifestFromProfile, normalizeCertifiedProfile, optimizationActivationReceiptFromMetadata, parseAgentCandidateProfileActivation as parseCandidateProfileMaterialization, prepareAgentImprovementProfileActivation, proposeAgentImprovement, proposeAgentProfileImprovement, proposeAuthoredAgentProfileImprovement, pullCertified, resolveEffort, resolveIntelligenceBaseUrl, resolveRedactor, reviewAgentImprovementProposal, runAgentCandidateExperiment, submitAgentImprovementProposal, verifyAgentImprovementActivation, verifyAgentImprovementActivationResult, verifyAgentImprovementProposal, verifyAgentImprovementReview, verifyCandidateExecutionEvidence, withIntelligence };
1402
1457
  //# sourceMappingURL=intelligence.d.ts.map