@tangle-network/agent-runtime 0.50.0 → 0.52.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 (43) hide show
  1. package/dist/agent.js +1 -1
  2. package/dist/{chunk-CM2IK7VS.js → chunk-2OU7ZQPD.js} +38 -8
  3. package/dist/chunk-2OU7ZQPD.js.map +1 -0
  4. package/dist/{chunk-OM3YNZIW.js → chunk-4JI4BCBI.js} +5 -360
  5. package/dist/chunk-4JI4BCBI.js.map +1 -0
  6. package/dist/{chunk-NDM5VXZW.js → chunk-7SP2OVYZ.js} +7 -5
  7. package/dist/{chunk-NDM5VXZW.js.map → chunk-7SP2OVYZ.js.map} +1 -1
  8. package/dist/{chunk-RHW75JW5.js → chunk-BERLUBAP.js} +2 -2
  9. package/dist/{chunk-BKAIVNFA.js → chunk-COAVO6QB.js} +3 -3
  10. package/dist/chunk-G3RGMA7C.js +361 -0
  11. package/dist/chunk-G3RGMA7C.js.map +1 -0
  12. package/dist/{chunk-ML4IXGTV.js → chunk-V2K35HF2.js} +2 -2
  13. package/dist/improvement.d.ts +96 -8
  14. package/dist/improvement.js +191 -9
  15. package/dist/improvement.js.map +1 -1
  16. package/dist/index.d.ts +114 -4
  17. package/dist/index.js +144 -18
  18. package/dist/index.js.map +1 -1
  19. package/dist/intelligence.d.ts +423 -0
  20. package/dist/intelligence.js +427 -0
  21. package/dist/intelligence.js.map +1 -0
  22. package/dist/loop-runner-bin.js +4 -3
  23. package/dist/loops.d.ts +2 -1
  24. package/dist/loops.js +3 -1
  25. package/dist/mcp/bin.js +5 -4
  26. package/dist/mcp/bin.js.map +1 -1
  27. package/dist/mcp/index.js +6 -5
  28. package/dist/mcp/index.js.map +1 -1
  29. package/dist/platform.d.ts +120 -62
  30. package/dist/platform.js +68 -26
  31. package/dist/platform.js.map +1 -1
  32. package/dist/runtime.d.ts +47 -8
  33. package/dist/runtime.js +3 -1
  34. package/dist/workflow.js +1 -1
  35. package/package.json +6 -1
  36. package/skills/agent-runtime-adoption/SKILL.md +41 -26
  37. package/skills/build-with-agent-runtime/SKILL.md +143 -0
  38. package/skills/loop-writer/SKILL.md +6 -7
  39. package/dist/chunk-CM2IK7VS.js.map +0 -1
  40. package/dist/chunk-OM3YNZIW.js.map +0 -1
  41. /package/dist/{chunk-RHW75JW5.js.map → chunk-BERLUBAP.js.map} +0 -0
  42. /package/dist/{chunk-BKAIVNFA.js.map → chunk-COAVO6QB.js.map} +0 -0
  43. /package/dist/{chunk-ML4IXGTV.js.map → chunk-V2K35HF2.js.map} +0 -0
@@ -0,0 +1,423 @@
1
+ /**
2
+ * @experimental
3
+ *
4
+ * EffortPolicy — pure data, no execution. Resolves a named tier into a flat
5
+ * settings object the Intelligence wrapper reads to decide WHICH intelligence
6
+ * spawns are admitted. The composer never runs anything; it only describes the
7
+ * shape of intelligence a tier permits.
8
+ *
9
+ * The billing boundary lives one layer above this (the wrapper tags trace usage
10
+ * by class). What this module owns is the single law the OFF tier rests on:
11
+ * `'off'` ⇒ every intelligence knob OFF (analysts:false, corpus:'off',
12
+ * fanout:1, loops:false, intelligenceBudgetUsd:0). At OFF the wrapper runs the
13
+ * agent as pure passthrough and only intelligence-class usage can prove to be
14
+ * zero — there is nothing to spawn.
15
+ */
16
+ /** The named effort tiers, lowest to highest. `'off'` is the honest floor
17
+ * below `'eco'`: intelligence fully off, telemetry still best-effort. */
18
+ type EffortTier = 'off' | 'eco' | 'standard' | 'thorough' | 'max';
19
+ /** Corpus access an intelligence tier permits. `'off'` reads and writes
20
+ * nothing; `'read'` consults the cross-run corpus without contributing;
21
+ * `'read-write'` both consults and accumulates. */
22
+ type CorpusAccess = 'off' | 'read' | 'read-write';
23
+ /**
24
+ * The flat, resolved settings a tier compiles to. Every field is individually
25
+ * overridable through `resolveEffort`. Pure data — read by the wrapper, never
26
+ * self-executing.
27
+ */
28
+ interface EffortSettings {
29
+ /** Whether trace-derived analyst diagnosis may spawn. `false` ⇒ no analyst. */
30
+ analysts: boolean;
31
+ /** Cross-run corpus access this tier permits. */
32
+ corpus: CorpusAccess;
33
+ /** Parallel candidate width. `1` ⇒ single-shot, no breadth. */
34
+ fanout: number;
35
+ /** Whether multi-step improvement loops (refine / fanout-vote) may run. */
36
+ loops: boolean;
37
+ /**
38
+ * Ceiling, in USD, for INTELLIGENCE-class spawns only (analysts, corpus,
39
+ * loops) — NOT base inference. `0` refuses every intelligence spawn; `null`
40
+ * means uncapped (the spend lands on the Pareto receipt). Base-stream
41
+ * inference is billed on its own channel and is never constrained here.
42
+ */
43
+ intelligenceBudgetUsd: number | null;
44
+ }
45
+ /** Per-field overrides applied on top of a tier preset. Any subset of the
46
+ * resolved settings; each provided field wins over the preset. */
47
+ type EffortOverrides = Partial<EffortSettings>;
48
+ /** The default tier when a client declares no effort. `'standard'` turns
49
+ * intelligence on with sensible knobs; opt down to `'off'`/`'eco'` or up to
50
+ * `'thorough'`/`'max'`. */
51
+ declare const defaultEffortTier: EffortTier;
52
+ /**
53
+ * Compile a named tier (plus optional per-field overrides) into the flat
54
+ * `EffortSettings` the wrapper reads. Pure: same inputs → same object, no I/O,
55
+ * no execution. Fails loud on an unknown tier rather than silently defaulting —
56
+ * a typo'd tier must not quietly grant or deny intelligence.
57
+ *
58
+ * Invariant preserved for the billing floor: `resolveEffort('off')` always
59
+ * yields `intelligenceBudgetUsd: 0` with every intelligence knob off UNLESS the
60
+ * caller explicitly overrides a field — overriding off is an opt-in the caller
61
+ * owns, not a default the composer leaks.
62
+ */
63
+ declare function resolveEffort(tier: EffortTier, overrides?: EffortOverrides): EffortSettings;
64
+ /**
65
+ * True when these settings admit NO intelligence spawn — the passthrough
66
+ * predicate the wrapper branches on. Every intelligence axis must be off:
67
+ * analysts disabled, corpus off, no breadth, no loops, and a zero intelligence
68
+ * budget. A caller who overrides any one of these back on is no longer at the
69
+ * OFF floor and the wrapper treats them as an intelligence-enabled run.
70
+ */
71
+ declare function isIntelligenceOff(settings: EffortSettings): boolean;
72
+
73
+ /**
74
+ * @experimental
75
+ *
76
+ * Redaction for Intelligence trace export. The trace carries the customer's
77
+ * real input/output; before any of it leaves the process it passes through a
78
+ * `Redactor`. The default scrubs the obvious leak classes (API keys, bearer
79
+ * tokens, emails, private keys) from strings and walks nested objects/arrays,
80
+ * but a customer with domain-specific PII supplies their own `redact` hook.
81
+ *
82
+ * This is intentionally narrower than `src/sanitize.ts` (which redacts the
83
+ * runtime's *event envelope* field-by-field): here the value is opaque
84
+ * customer payload, so the scrub is value-shaped, not schema-shaped.
85
+ */
86
+ /** A redactor maps an arbitrary trace value to a safe-to-export value. Pure;
87
+ * must not throw on cyclic input (the default tolerates cycles). */
88
+ type Redactor = (value: unknown) => unknown;
89
+ /**
90
+ * The built-in redactor. Walks objects and arrays; replaces values under
91
+ * secret-bearing keys wholesale; scrubs in-value patterns from every string.
92
+ * Cycle-safe (a seen-set short-circuits self-referential payloads to
93
+ * `'[circular]'`), depth-bounded, and total — never throws on customer input.
94
+ */
95
+ declare function defaultRedactor(value: unknown): unknown;
96
+ /**
97
+ * Resolve the redactor a client uses. A caller-supplied hook replaces the
98
+ * default entirely (the customer owns their PII rules); absent one, the
99
+ * built-in `defaultRedactor` runs. Returning `false` is the explicit opt-out —
100
+ * NO redaction, for a caller who has already sanitized upstream and wants raw
101
+ * fidelity. Opt-out is loud (an explicit `false`), never a silent default.
102
+ */
103
+ declare function resolveRedactor(redact: Redactor | false | undefined): Redactor;
104
+
105
+ /**
106
+ * @experimental
107
+ *
108
+ * Tangle Intelligence — the DELIVERY half of the loop (pull-by-default).
109
+ *
110
+ * The sibling Observe layer (`./index`) sends traces UP to the plane. This
111
+ * module pulls certified artifacts DOWN: it reads the tenant's promoted,
112
+ * gate-certified profile from the deployed Intelligence plane and folds it into
113
+ * the running agent's prompt — so an approved improvement actually reaches the
114
+ * agent. This is "shipping intelligence to people's agents", pull-by-default;
115
+ * the push/Gated-PR opt-in composes on top of this.
116
+ *
117
+ * Pull contract (deployed plane): GET /v1/profiles/:target/composed →
118
+ * { target, generatedAt, promptSurface: {surface,surfaceHash,version,lift}|null,
119
+ * artifacts: { <artifactType>: [{path,content,contentHash,version,lift,promotedAt}] } }
120
+ * Auth: Bearer <apiKey> (the one TANGLE_API_KEY shared by router + sandbox +
121
+ * intelligence), resolved to a tenant by platform-api's key-verify S2S contract.
122
+ *
123
+ * import { withCertifiedDelivery } from '@tangle-network/agent-runtime/intelligence'
124
+ *
125
+ * export const agent = withCertifiedDelivery(
126
+ * async (input, applied) => myAgent(input, { systemPrompt: applied.composePrompt(BASE) }),
127
+ * { project: 'support-agent', target: 'support-agent' },
128
+ * )
129
+ */
130
+
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 composed certified profile — exactly the shape the plane's
150
+ * `GET /v1/profiles/:target/composed` returns. */
151
+ interface CertifiedProfile {
152
+ target: string;
153
+ generatedAt: string;
154
+ promptSurface: CertifiedPromptSurface | null;
155
+ artifacts: Record<string, CertifiedArtifact[]>;
156
+ }
157
+ /** Typed outcome for the pull — inspect `succeeded` before `value`. A 404
158
+ * (nothing promoted yet) is a normal, non-error `succeeded: false`. */
159
+ type PullOutcome = {
160
+ succeeded: true;
161
+ value: CertifiedProfile;
162
+ } | {
163
+ succeeded: false;
164
+ error: string;
165
+ status?: number;
166
+ };
167
+ interface PullCertifiedOptions {
168
+ /** The agent target certified artifacts are promoted under. */
169
+ target: string;
170
+ /** Bearer key. Defaults to `process.env.TANGLE_API_KEY`. */
171
+ apiKey?: string;
172
+ /** Plane base URL. Defaults to `process.env.TANGLE_INTELLIGENCE_URL` then
173
+ * `https://intelligence.tangle.tools`. */
174
+ baseUrl?: string;
175
+ /** fetch impl (tests / non-global-fetch runtimes). Defaults to global fetch. */
176
+ fetchImpl?: typeof fetch;
177
+ }
178
+ /**
179
+ * Pull the certified composed profile for a target. Fail-closed: a network
180
+ * error or a non-2xx returns a typed `succeeded: false` (never throws), so a
181
+ * caller can run on its base surface when Intelligence is unreachable. A 404 is
182
+ * the normal "nothing promoted yet" signal, carried as `status: 404`.
183
+ */
184
+ declare function pullCertified(opts: PullCertifiedOptions): Promise<PullOutcome>;
185
+ /**
186
+ * Fold the certified prompt surface (and any certified `prompt-surface` /
187
+ * `skill` artifacts) into a base system prompt under a marked section, so the
188
+ * deployed agent prompt == base + the gate-certified additions. Order is stable
189
+ * (prompt surface first, then artifacts by type then path) so the same profile
190
+ * renders byte-identically each call. Returns `base` unchanged when there is no
191
+ * usable certified content.
192
+ */
193
+ declare function composeCertifiedPrompt(base: string, certified: CertifiedProfile | null): string;
194
+ /** What the delivery wrapper hands the agent each run. */
195
+ interface AppliedIntelligence {
196
+ /** The certified profile in effect (null when none promoted / pull failed —
197
+ * fail-closed: the agent runs on its base surface). */
198
+ certified: CertifiedProfile | null;
199
+ /** Fold the certified prompt surface into a base system prompt. */
200
+ composePrompt(base: string): string;
201
+ }
202
+ /** An agent wrapped by {@link withCertifiedDelivery}: receives the input plus
203
+ * the certified intelligence delivered for this run. */
204
+ type DeliveredAgent<I, O> = (input: I, applied: AppliedIntelligence) => Promise<O>;
205
+ /** Delivery config = the Observe config plus the pull target + refresh cadence. */
206
+ interface DeliveryConfig extends IntelligenceConfig {
207
+ /** Pull target. Defaults to `project`. */
208
+ target?: string;
209
+ /** Plane base URL for the pull (NOT the OTLP `endpoint`). Defaults to
210
+ * `TANGLE_INTELLIGENCE_URL` then `https://intelligence.tangle.tools`. */
211
+ baseUrl?: string;
212
+ /** Min interval between certified-profile pulls. Default 5m. */
213
+ refreshMs?: number;
214
+ /** fetch impl for the pull (tests). Defaults to global fetch. */
215
+ fetchImpl?: typeof fetch;
216
+ }
217
+ /**
218
+ * Wrap an agent so it (a) Observes each run via the shipped Observe client and
219
+ * (b) RECEIVES the tenant's certified artifacts pulled from the deployed plane.
220
+ * The certified profile is cached and refreshed at most every `refreshMs`; a
221
+ * failed pull is fail-closed — the agent runs on its base surface and never
222
+ * breaks because Intelligence is unreachable. When the plane promotes a new
223
+ * gate-certified surface, the next refresh delivers it to the running agent.
224
+ */
225
+ declare function withCertifiedDelivery<I, O>(agent: DeliveredAgent<I, O>, config: DeliveryConfig): ((input: I) => Promise<O>) & {
226
+ refresh(): Promise<void>;
227
+ };
228
+
229
+ /**
230
+ * @experimental
231
+ *
232
+ * Tangle Intelligence SDK — the Observe + Mode-0 product layer.
233
+ *
234
+ * A thin, best-effort wrapper over the shipped trace-export substrate
235
+ * (`createOtelExporter` in `../otel-export`). It does exactly two things in
236
+ * this slice:
237
+ *
238
+ * 1. OBSERVE — wrap a generic agent and export one trace span per call to
239
+ * Tangle Intelligence, swallowing every export failure so a live agent
240
+ * never fails because Intelligence is down.
241
+ * 2. MODE 0 / OFF — at `effort: 'off'`, run the agent as PURE PASSTHROUGH
242
+ * (zero intelligence spawns) with best-effort telemetry still on. The
243
+ * exported trace tags usage by class `{ inferenceUsd, intelligenceUsd }`,
244
+ * and at OFF `intelligenceUsd` is provably `0` — the mechanism that proves
245
+ * an OFF customer paid inference-only.
246
+ *
247
+ * Behavior-changing intelligence (analyst steer, candidate promotion, loops)
248
+ * is a LATER phase and is NOT built here. This wrapper only Observes and passes
249
+ * through; there is no abort path, so the only fail-soft surface is the
250
+ * telemetry export.
251
+ */
252
+
253
+ /** Usage class for billing. Base-stream tokens bill `'inference'`; every
254
+ * intelligence spawn (analyst, corpus, loop) bills `'intelligence'`. The
255
+ * billing line falls on the spawn line. */
256
+ type UsageClass = 'inference' | 'intelligence';
257
+ /**
258
+ * The per-class cost split carried by every trace and outcome. `off` ⇒
259
+ * `intelligenceUsd: 0` by construction — there is no intelligence spawn to
260
+ * bill. This is a classification on the trace, NOT a budget-pool split.
261
+ */
262
+ interface UsageSplit {
263
+ /** Base-stream (model) spend in USD. */
264
+ inferenceUsd: number;
265
+ /** Intelligence-spawn spend in USD. Provably `0` at the OFF tier. */
266
+ intelligenceUsd: number;
267
+ }
268
+ /** Repo coordinates a product may declare for the (later) Gated-PR mode. The
269
+ * Observe slice only records their PRESENCE for `doctor()`; it never touches
270
+ * the repo. */
271
+ interface RepoConfig {
272
+ owner: string;
273
+ name: string;
274
+ baseBranch: string;
275
+ }
276
+ /** Client configuration. `project` + `apiKey` are the Observe minimum; the
277
+ * rest tune effort, endpoint, redaction, and (for `doctor()` readiness)
278
+ * declare the surfaces/checks/repo a later PR mode would need. */
279
+ interface IntelligenceConfig {
280
+ /** Stable project id — the tenant dimension every trace is tagged with. */
281
+ project: string;
282
+ /** Bearer key for the Intelligence ingest. Reads `TANGLE_API_KEY` when omitted. */
283
+ apiKey?: string;
284
+ /** Effort tier (default `'standard'`) plus optional per-field overrides. */
285
+ effort?: EffortTier | {
286
+ tier: EffortTier;
287
+ overrides?: EffortOverrides;
288
+ };
289
+ /**
290
+ * OTLP ingest base. The underlying exporter appends `/v1/traces`, so point
291
+ * this at the OTLP route (e.g. `https://intelligence.tangle.tools/v1/otlp`).
292
+ * Reads `INTELLIGENCE_OTLP_ENDPOINT` then `OTEL_EXPORTER_OTLP_ENDPOINT` when
293
+ * omitted; absent all three, export is a no-op (best-effort by construction).
294
+ */
295
+ endpoint?: string;
296
+ /**
297
+ * Redaction hook run over every exported input/output. A function replaces
298
+ * the default scrubber; `false` opts out entirely (raw fidelity, caller has
299
+ * sanitized upstream); omitted ⇒ the built-in `defaultRedactor`.
300
+ */
301
+ redact?: Redactor | false;
302
+ /** Mutable surfaces a later PR mode would edit. Recorded for `doctor()` only. */
303
+ surfaces?: string[];
304
+ /** Verification checks a later PR mode would gate on. Recorded for `doctor()` only. */
305
+ checks?: string[];
306
+ /** Repo access a later PR mode would need. Recorded for `doctor()` only. */
307
+ repo?: RepoConfig;
308
+ }
309
+ /** Metadata describing one traced run. `runId`/`traceId` default to fresh ids. */
310
+ interface TraceMeta {
311
+ /** The run's input — exported through the redactor. */
312
+ input?: unknown;
313
+ /** Stable run id. Defaults to a fresh id. */
314
+ runId?: string;
315
+ /** 32-hex trace id. Defaults to a fresh id. */
316
+ traceId?: string;
317
+ /** Model id, when known — stamped on the span. */
318
+ model?: string;
319
+ /** Provider name, when known — stamped on the span. */
320
+ provider?: string;
321
+ /** Arbitrary extra labels (string/number/boolean) stamped on the span. */
322
+ labels?: Record<string, string | number | boolean>;
323
+ }
324
+ /**
325
+ * The trace handle a `traceRun` body records into. `recordOutput` captures the
326
+ * agent's result (redacted on export); `recordOutcome` captures the scored
327
+ * outcome + the `{ inferenceUsd, intelligenceUsd }` split. Both are optional —
328
+ * an un-recorded run still exports a span with whatever was set.
329
+ */
330
+ interface TraceHandle {
331
+ /** Capture the run's output. Exported through the redactor. */
332
+ recordOutput(output: unknown): void;
333
+ /**
334
+ * Capture the run's outcome. `usage` defaults to inference-only
335
+ * (`intelligenceUsd: 0`) — the OFF baseline; an intelligence-enabled run
336
+ * fills `intelligenceUsd` itself. `costUsd`, when given without a split, is
337
+ * treated as pure inference.
338
+ */
339
+ recordOutcome(outcome: {
340
+ success?: boolean;
341
+ score?: number;
342
+ costUsd?: number;
343
+ usage?: Partial<UsageSplit>;
344
+ }): void;
345
+ }
346
+ /** The resolved outcome of one traced run, surfaced on the export span and
347
+ * available to the caller for downstream billing assertions. */
348
+ interface TraceOutcome {
349
+ runId: string;
350
+ traceId: string;
351
+ project: string;
352
+ /** The resolved effort settings this run executed under. */
353
+ effort: EffortSettings;
354
+ /** True when this run ran as pure passthrough (the OFF floor). */
355
+ intelligenceOff: boolean;
356
+ success?: boolean;
357
+ score?: number;
358
+ /** Per-class billing split. `intelligenceUsd` is `0` at the OFF tier. */
359
+ usage: UsageSplit;
360
+ }
361
+ /** The Observe-mode Intelligence client. */
362
+ interface IntelligenceClient {
363
+ /** The resolved project id. */
364
+ readonly project: string;
365
+ /** The resolved effort settings. */
366
+ readonly effort: EffortSettings;
367
+ /**
368
+ * Run `fn` under a trace, export one span best-effort, and return whatever
369
+ * `fn` returns. Telemetry-export failures are swallowed; an error THROWN by
370
+ * `fn` propagates to the caller (the agent's own failures are not masked).
371
+ */
372
+ traceRun<T>(meta: TraceMeta, fn: (trace: TraceHandle) => Promise<T>): Promise<T>;
373
+ /**
374
+ * Network-free readiness report: which adoption modes are reachable given
375
+ * this config. Observe is always reachable; Recommend needs outcomes; PR
376
+ * needs checks + surfaces + repo.
377
+ */
378
+ doctor(): DoctorReport;
379
+ /** Flush any pending export spans. Best-effort; resolves even if export fails. */
380
+ flush(): Promise<void>;
381
+ }
382
+ /** One mode's readiness verdict. */
383
+ interface ModeReadiness {
384
+ ready: boolean;
385
+ /** Inputs this mode still needs, when not ready. Empty when ready. */
386
+ missing: string[];
387
+ }
388
+ /** The `doctor()` readiness report — Mode-readiness without any network call. */
389
+ interface DoctorReport {
390
+ project: string;
391
+ effort: EffortSettings;
392
+ /** True when an OTLP endpoint is configured (export will actually ship). */
393
+ exportConfigured: boolean;
394
+ modes: {
395
+ observe: ModeReadiness;
396
+ recommend: ModeReadiness;
397
+ pr: ModeReadiness;
398
+ };
399
+ }
400
+ /**
401
+ * Create an Observe-mode Intelligence client. Resolves effort, endpoint, and
402
+ * redactor up front; the exporter is built lazily and is `undefined` when no
403
+ * endpoint is configured (export becomes a no-op — best-effort by
404
+ * construction).
405
+ */
406
+ declare function createIntelligenceClient(config: IntelligenceConfig): IntelligenceClient;
407
+ /** A generic agent: one async input → output. The shape `withTangleIntelligence`
408
+ * preserves exactly. */
409
+ type Agent<TInput, TOutput> = (input: TInput) => Promise<TOutput>;
410
+ /** Either a built client or the config to build one. */
411
+ type ClientOrConfig = IntelligenceClient | IntelligenceConfig;
412
+ /**
413
+ * Wrap a generic `agent` with best-effort Observe-mode tracing, returning the
414
+ * SAME shape. Each call runs the agent under a trace and exports one span; an
415
+ * export failure is swallowed (the live agent never fails because Intelligence
416
+ * is down) but an error from the agent itself propagates unchanged.
417
+ *
418
+ * At `effort: 'off'` this is pure passthrough plus best-effort telemetry —
419
+ * zero intelligence spawns, `intelligenceUsd: 0` on the trace.
420
+ */
421
+ declare function withTangleIntelligence<TInput, TOutput>(agent: Agent<TInput, TOutput>, clientOrConfig: ClientOrConfig): Agent<TInput, TOutput>;
422
+
423
+ export { type Agent, type AppliedIntelligence, type CertifiedArtifact, type CertifiedProfile, type CertifiedPromptSurface, type ClientOrConfig, type CorpusAccess, type DeliveredAgent, type DeliveryConfig, type DoctorReport, type EffortOverrides, type EffortSettings, type EffortTier, type IntelligenceClient, type IntelligenceConfig, type ModeReadiness, type PullCertifiedOptions, type PullOutcome, type Redactor, type RepoConfig, type TraceHandle, type TraceMeta, type TraceOutcome, type UsageClass, type UsageSplit, composeCertifiedPrompt, createIntelligenceClient, defaultEffortTier, defaultRedactor, isIntelligenceOff, pullCertified, resolveEffort, resolveRedactor, withCertifiedDelivery, withTangleIntelligence };