@tangle-network/agent-runtime 0.52.0 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +2 -2
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/{chunk-7SP2OVYZ.js → chunk-5M2WDWBI.js} +3 -3
- package/dist/{chunk-4JI4BCBI.js → chunk-AYRQZRDV.js} +2 -2
- package/dist/{chunk-BERLUBAP.js → chunk-FO4DCM7R.js} +2 -2
- package/dist/{chunk-7JITYN6T.js → chunk-JFIYKDXF.js} +17 -2
- package/dist/chunk-JFIYKDXF.js.map +1 -0
- package/dist/{chunk-COAVO6QB.js → chunk-K5M3SHEU.js} +3 -3
- package/dist/{chunk-2OU7ZQPD.js → chunk-K6WP7PYW.js} +42 -57
- package/dist/chunk-K6WP7PYW.js.map +1 -0
- package/dist/{chunk-V2K35HF2.js → chunk-P4QNEXFC.js} +2 -2
- package/dist/{coder-_YCf3BAK.d.ts → coder-LKm3Mczw.d.ts} +1 -1
- package/dist/{delegation-profile-1GbW5yA3.d.ts → delegation-profile-Bvfro2m1.d.ts} +28 -2
- package/dist/{driver-DLI1io57.d.ts → driver-B2RKkVJW.d.ts} +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +475 -5
- package/dist/intelligence.js +547 -3
- package/dist/intelligence.js.map +1 -1
- package/dist/{kb-gate-CHAyt4aI.d.ts → kb-gate-CKfykcYQ.d.ts} +2 -2
- package/dist/{loop-runner-bin-DFUNgpeK.d.ts → loop-runner-bin-D4Ir7b00.d.ts} +4 -4
- package/dist/loop-runner-bin.d.ts +5 -5
- package/dist/loop-runner-bin.js +3 -3
- package/dist/loops.d.ts +6 -5
- package/dist/loops.js +1 -1
- package/dist/mcp/bin.js +4 -4
- package/dist/mcp/index.d.ts +7 -7
- package/dist/mcp/index.js +6 -6
- package/dist/{openai-tools-D4HLDWgw.d.ts → openai-tools-CKfR3EMh.d.ts} +1 -1
- package/dist/profiles.d.ts +2 -2
- package/dist/router-client-B0Qi1NiN.d.ts +120 -0
- package/dist/{run-loop-BIineL1T.d.ts → run-loop-DgVhucoR.d.ts} +1 -1
- package/dist/runtime.d.ts +16 -119
- package/dist/runtime.js +1 -1
- package/dist/{types-5MGt5KTY.d.ts → types-CNDJCL_0.d.ts} +1 -1
- package/dist/{types-BEQsBhOE.d.ts → types-CklkW4Eh.d.ts} +2 -1
- package/dist/workflow.d.ts +2 -2
- package/dist/workflow.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2OU7ZQPD.js.map +0 -1
- package/dist/chunk-7JITYN6T.js.map +0 -1
- /package/dist/{chunk-7SP2OVYZ.js.map → chunk-5M2WDWBI.js.map} +0 -0
- /package/dist/{chunk-4JI4BCBI.js.map → chunk-AYRQZRDV.js.map} +0 -0
- /package/dist/{chunk-BERLUBAP.js.map → chunk-FO4DCM7R.js.map} +0 -0
- /package/dist/{chunk-COAVO6QB.js.map → chunk-K5M3SHEU.js.map} +0 -0
- /package/dist/{chunk-V2K35HF2.js.map → chunk-P4QNEXFC.js.map} +0 -0
package/dist/intelligence.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { e as LoopTraceEvent } from './types-CklkW4Eh.js';
|
|
2
|
+
import { AgentProfileMcpServer } from '@tangle-network/sandbox';
|
|
3
|
+
import { T as ToolSpec } from './router-client-B0Qi1NiN.js';
|
|
4
|
+
import '@tangle-network/agent-eval';
|
|
5
|
+
import './runtime-hooks-C7JwKb9E.js';
|
|
6
|
+
|
|
1
7
|
/**
|
|
2
8
|
* @experimental
|
|
3
9
|
*
|
|
@@ -69,6 +75,46 @@ declare function resolveEffort(tier: EffortTier, overrides?: EffortOverrides): E
|
|
|
69
75
|
* OFF floor and the wrapper treats them as an intelligence-enabled run.
|
|
70
76
|
*/
|
|
71
77
|
declare function isIntelligenceOff(settings: EffortSettings): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* The run-config overrides an `EffortSettings` compiles to — the bridge between the
|
|
80
|
+
* pure effort policy and the orchestration entrypoints (`runPersonified` / the
|
|
81
|
+
* improvement cycle). This is ONLY data: it never constructs an analyst or runs a
|
|
82
|
+
* loop. The caller reads these flags to decide WHAT to pass:
|
|
83
|
+
*
|
|
84
|
+
* - `withAnalyst: false` ⇒ DO NOT construct/pass a `ScopeAnalyst` to `runPersonified`
|
|
85
|
+
* (the dormant empty-findings path runs; the base agent still works). This is the
|
|
86
|
+
* PRODUCT fail-closed at `off`/`eco` — "don't construct the analyst" — distinct from
|
|
87
|
+
* the EXPERIMENT fail-closed inside `createScopeAnalyst` ("hard abort"), which stays
|
|
88
|
+
* untouched. Degrade, never throw.
|
|
89
|
+
* - `fanout` ⇒ the `ShapeBudget.fanout` width to pass (`1` at `off`, the tier's breadth
|
|
90
|
+
* otherwise). Overrides the personify default fanout.
|
|
91
|
+
* - `withLoops: false` ⇒ the improvement cycle is a no-op for this run (no refine /
|
|
92
|
+
* fanout-vote multi-step loop spawns).
|
|
93
|
+
* - `intelligenceBudgetUsd` ⇒ the intelligence-class spend ceiling carried through for
|
|
94
|
+
* the billing clamp (passed verbatim; `0` refuses every intelligence spawn).
|
|
95
|
+
*/
|
|
96
|
+
interface EffortOverridesCompiled {
|
|
97
|
+
/** Construct + pass a `ScopeAnalyst`? `false` ⇒ omit it (degrade to the base agent). */
|
|
98
|
+
withAnalyst: boolean;
|
|
99
|
+
/** `ShapeBudget.fanout` width to pass to `runPersonified`. */
|
|
100
|
+
fanout: number;
|
|
101
|
+
/** Run the multi-step improvement cycle, or no-op it for this run? */
|
|
102
|
+
withLoops: boolean;
|
|
103
|
+
/** Intelligence-class spend ceiling. `0` refuses every intelligence spawn; `null` uncapped. */
|
|
104
|
+
intelligenceBudgetUsd: number | null;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Compile resolved `EffortSettings` into the orchestration overrides above. Pure: same
|
|
108
|
+
* input → same object, no I/O, no execution, no construction. It is the single place that
|
|
109
|
+
* maps the effort axes onto the run-config knobs, so no `if (effort)` leaks into the
|
|
110
|
+
* supervise kernel — the kernel stays effort-blind, the caller reads these flags once.
|
|
111
|
+
*
|
|
112
|
+
* `off`/`eco` (`analysts: false`) compile to `withAnalyst: false` ⇒ the caller omits the
|
|
113
|
+
* analyst and the run degrades to the dormant base agent rather than throwing. `fanout: 1`
|
|
114
|
+
* (no breadth) at `off`; `withLoops: false` no-ops the improvement cycle. `standard`+
|
|
115
|
+
* compile to `withAnalyst: true`, the tier's `fanout`, and `withLoops: true`.
|
|
116
|
+
*/
|
|
117
|
+
declare function compileEffort(settings: EffortSettings): EffortOverridesCompiled;
|
|
72
118
|
|
|
73
119
|
/**
|
|
74
120
|
* @experimental
|
|
@@ -174,6 +220,10 @@ interface PullCertifiedOptions {
|
|
|
174
220
|
baseUrl?: string;
|
|
175
221
|
/** fetch impl (tests / non-global-fetch runtimes). Defaults to global fetch. */
|
|
176
222
|
fetchImpl?: typeof fetch;
|
|
223
|
+
/** Abort the pull after this many ms so a hung plane never blocks the caller.
|
|
224
|
+
* Default 10000. The timeout surfaces as a normal fail-closed `succeeded:
|
|
225
|
+
* false` (the agent runs on its base surface). */
|
|
226
|
+
timeoutMs?: number;
|
|
177
227
|
}
|
|
178
228
|
/**
|
|
179
229
|
* Pull the certified composed profile for a target. Fail-closed: a network
|
|
@@ -183,10 +233,11 @@ interface PullCertifiedOptions {
|
|
|
183
233
|
*/
|
|
184
234
|
declare function pullCertified(opts: PullCertifiedOptions): Promise<PullOutcome>;
|
|
185
235
|
/**
|
|
186
|
-
* Fold the certified prompt surface (and any certified
|
|
187
|
-
* `skill`
|
|
188
|
-
* deployed agent prompt == base + the gate-certified
|
|
189
|
-
* (prompt surface first, then
|
|
236
|
+
* Fold the certified prompt surface (and any certified prompt-folding artifacts:
|
|
237
|
+
* `prompt-surface` / `skill` / `instructions`) into a base system prompt under a
|
|
238
|
+
* marked section, so the deployed agent prompt == base + the gate-certified
|
|
239
|
+
* additions. Order is stable (prompt surface first, then artifact buckets in
|
|
240
|
+
* `promptFoldTypes` order, then by path within a bucket) so the same profile
|
|
190
241
|
* renders byte-identically each call. Returns `base` unchanged when there is no
|
|
191
242
|
* usable certified content.
|
|
192
243
|
*/
|
|
@@ -211,6 +262,8 @@ interface DeliveryConfig extends IntelligenceConfig {
|
|
|
211
262
|
baseUrl?: string;
|
|
212
263
|
/** Min interval between certified-profile pulls. Default 5m. */
|
|
213
264
|
refreshMs?: number;
|
|
265
|
+
/** Per-pull timeout in ms (fail-closed on a hung plane). Default 10000. */
|
|
266
|
+
timeoutMs?: number;
|
|
214
267
|
/** fetch impl for the pull (tests). Defaults to global fetch. */
|
|
215
268
|
fetchImpl?: typeof fetch;
|
|
216
269
|
}
|
|
@@ -226,6 +279,405 @@ declare function withCertifiedDelivery<I, O>(agent: DeliveredAgent<I, O>, config
|
|
|
226
279
|
refresh(): Promise<void>;
|
|
227
280
|
};
|
|
228
281
|
|
|
282
|
+
/**
|
|
283
|
+
* @experimental
|
|
284
|
+
*
|
|
285
|
+
* The Capability-Delivery Manifest — the unified, future-proof structure for
|
|
286
|
+
* delivering ONE certified unit of agent power = `{ interface, binding }`.
|
|
287
|
+
*
|
|
288
|
+
* The law that makes it future-proof: **interfaces are closed; bindings are
|
|
289
|
+
* open.** The interface is the only thing the agent and the certify lane ever
|
|
290
|
+
* reason about (a tool / an MCP toolset / a prompt-context / a retrieval surface
|
|
291
|
+
* / a hook / a subagent). The binding is a tagged union over runtime kinds that
|
|
292
|
+
* the resolver collapses (inline / file / http / sandbox-code / mcp-stdio /
|
|
293
|
+
* mcp-remote / process-on-infra / rag-index / memory-store / wasm / a2a). A new
|
|
294
|
+
* runtime kind = one new binding arm + one resolver case; nothing else moves.
|
|
295
|
+
*
|
|
296
|
+
* This module owns the manifest TYPES and the lowering of TODAY's wire
|
|
297
|
+
* (`CertifiedProfile`) into a `CapabilityManifest`. The resolver — the single
|
|
298
|
+
* place that knows binding kinds and produces a uniform `ResolvedSurface` — lives
|
|
299
|
+
* in `./resolver`. The shipped prompt-only path (`composeCertifiedPrompt` in
|
|
300
|
+
* `./delivery`) is preserved verbatim: a prompt is a `Capability{ surface:
|
|
301
|
+
* 'context', binding:{ kind:'inline' } }`, so the existing
|
|
302
|
+
* `pullCertified → composeCertifiedPrompt → fail-closed` lane is a strict subset.
|
|
303
|
+
*
|
|
304
|
+
* Layering: this depends DOWN on `@tangle-network/sandbox` (the SDK
|
|
305
|
+
* `AgentProfileMcpServer` shape the mcp binding lowers to) and on the runtime's
|
|
306
|
+
* own `ToolSpec`. It never imports agent-eval and never reaches upward.
|
|
307
|
+
*/
|
|
308
|
+
|
|
309
|
+
/** A JSON Schema object describing a tool's parameters. Kept structural — the
|
|
310
|
+
* resolver forwards it verbatim into a `ToolSpec` / MCP `tools/list` check. */
|
|
311
|
+
type JsonSchema = Record<string, unknown>;
|
|
312
|
+
/**
|
|
313
|
+
* What the agent consumes. CLOSED — a new runtime kind NEVER extends this. Each
|
|
314
|
+
* arm maps slot-for-slot onto `AgentProfile` + the host `RouterToolsSeam`.
|
|
315
|
+
*/
|
|
316
|
+
type CapabilityInterface = {
|
|
317
|
+
surface: 'tool';
|
|
318
|
+
name: string;
|
|
319
|
+
description?: string;
|
|
320
|
+
parameters: JsonSchema;
|
|
321
|
+
returns?: JsonSchema;
|
|
322
|
+
} | {
|
|
323
|
+
surface: 'mcp';
|
|
324
|
+
serverName: string;
|
|
325
|
+
toolset?: string[];
|
|
326
|
+
} | {
|
|
327
|
+
surface: 'context';
|
|
328
|
+
kind: 'prompt-surface' | 'skill' | 'instructions';
|
|
329
|
+
name: string;
|
|
330
|
+
} | {
|
|
331
|
+
surface: 'retrieval';
|
|
332
|
+
name: string;
|
|
333
|
+
description?: string;
|
|
334
|
+
topK?: number;
|
|
335
|
+
} | {
|
|
336
|
+
surface: 'hook';
|
|
337
|
+
event: string;
|
|
338
|
+
matcher?: string;
|
|
339
|
+
} | {
|
|
340
|
+
surface: 'subagent';
|
|
341
|
+
name: string;
|
|
342
|
+
description?: string;
|
|
343
|
+
};
|
|
344
|
+
/** Every interface surface tag — the closed set the resolver fans into slots. */
|
|
345
|
+
type CapabilitySurface = CapabilityInterface['surface'];
|
|
346
|
+
/**
|
|
347
|
+
* Where a capability's bytes live. A leaked manifest carries no live secret and
|
|
348
|
+
* no inlined blob: `github`/`blob` are pointers resolved at provision time.
|
|
349
|
+
*/
|
|
350
|
+
type ContentRef = {
|
|
351
|
+
kind: 'inline';
|
|
352
|
+
content: string;
|
|
353
|
+
} | {
|
|
354
|
+
kind: 'github';
|
|
355
|
+
repository?: string;
|
|
356
|
+
path: string;
|
|
357
|
+
ref?: string;
|
|
358
|
+
} | {
|
|
359
|
+
kind: 'blob';
|
|
360
|
+
uri: string;
|
|
361
|
+
sha256: string;
|
|
362
|
+
bytes?: number;
|
|
363
|
+
};
|
|
364
|
+
/** A named secret a binding requires — declared, never carried. */
|
|
365
|
+
interface CredentialRef {
|
|
366
|
+
key: string;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* How a binding authenticates at resolve time. Declared as a REQUIREMENT in the
|
|
370
|
+
* manifest; the live secret is resolved per-tenant by the resolver context,
|
|
371
|
+
* never inlined here.
|
|
372
|
+
*/
|
|
373
|
+
type CapabilityAuth = {
|
|
374
|
+
mode: 'none';
|
|
375
|
+
} | {
|
|
376
|
+
mode: 'tangle-key';
|
|
377
|
+
} | {
|
|
378
|
+
mode: 'hub-connection';
|
|
379
|
+
providerId: string;
|
|
380
|
+
scopes?: string[];
|
|
381
|
+
} | {
|
|
382
|
+
mode: 'secret-ref';
|
|
383
|
+
key: string;
|
|
384
|
+
};
|
|
385
|
+
/**
|
|
386
|
+
* The host a `process-on-infra` binding provisions before its inner binding.
|
|
387
|
+
* Reuses `createExecutor`'s backend-as-data vocabulary — no new runtime invented.
|
|
388
|
+
* `image` is the sandbox image tag; `warm`/`idleTtlMs`/`costTag` meter standing
|
|
389
|
+
* cost; `ports` are the inner server's listen ports the host must expose.
|
|
390
|
+
*/
|
|
391
|
+
interface HostSpec {
|
|
392
|
+
backend: 'sandbox' | 'router' | 'cli';
|
|
393
|
+
image?: string;
|
|
394
|
+
ports?: number[];
|
|
395
|
+
warm?: boolean;
|
|
396
|
+
idleTtlMs?: number;
|
|
397
|
+
costTag?: string;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* How a capability is backed. OPEN tagged union — THE extension point. All arms
|
|
401
|
+
* are typed even when the resolver does not yet admit them; an un-admitted arm
|
|
402
|
+
* throws {@link CapabilityNotAdmittedError} at resolve, never silently no-ops.
|
|
403
|
+
*/
|
|
404
|
+
type DeliveryBinding = {
|
|
405
|
+
kind: 'inline';
|
|
406
|
+
content: ContentRef;
|
|
407
|
+
} | {
|
|
408
|
+
kind: 'file';
|
|
409
|
+
path: string;
|
|
410
|
+
content: ContentRef;
|
|
411
|
+
executable?: boolean;
|
|
412
|
+
} | {
|
|
413
|
+
kind: 'http';
|
|
414
|
+
url: string;
|
|
415
|
+
method?: string;
|
|
416
|
+
auth?: CapabilityAuth;
|
|
417
|
+
} | {
|
|
418
|
+
kind: 'sandbox-code';
|
|
419
|
+
entry: string;
|
|
420
|
+
code: ContentRef;
|
|
421
|
+
runtime?: string;
|
|
422
|
+
harness?: string;
|
|
423
|
+
} | {
|
|
424
|
+
kind: 'mcp-stdio';
|
|
425
|
+
command: string;
|
|
426
|
+
args?: string[];
|
|
427
|
+
env?: Record<string, string>;
|
|
428
|
+
cwd?: string;
|
|
429
|
+
} | {
|
|
430
|
+
kind: 'mcp-remote';
|
|
431
|
+
url: string;
|
|
432
|
+
transport: 'http' | 'sse';
|
|
433
|
+
headers?: Record<string, string>;
|
|
434
|
+
} | {
|
|
435
|
+
kind: 'process-on-infra';
|
|
436
|
+
host: HostSpec;
|
|
437
|
+
inner: DeliveryBinding;
|
|
438
|
+
} | {
|
|
439
|
+
kind: 'rag-index';
|
|
440
|
+
index: ContentRef;
|
|
441
|
+
embedModel: string;
|
|
442
|
+
topK?: number;
|
|
443
|
+
} | {
|
|
444
|
+
kind: 'memory-store';
|
|
445
|
+
provision: 'sqlite' | 'neo4j' | 'vector';
|
|
446
|
+
seed?: ContentRef;
|
|
447
|
+
} | {
|
|
448
|
+
kind: 'wasm';
|
|
449
|
+
module: ContentRef;
|
|
450
|
+
exports: string[];
|
|
451
|
+
} | {
|
|
452
|
+
kind: 'a2a';
|
|
453
|
+
endpoint: string;
|
|
454
|
+
card: ContentRef;
|
|
455
|
+
auth?: CapabilityAuth;
|
|
456
|
+
};
|
|
457
|
+
/** Every binding kind — the open set the resolver dispatches over. */
|
|
458
|
+
type DeliveryBindingKind = DeliveryBinding['kind'];
|
|
459
|
+
/**
|
|
460
|
+
* The certify lane's held-out lift travelling WITH delivery. The shipped
|
|
461
|
+
* `CertifiedArtifact` envelope minus its content (which moves into the binding
|
|
462
|
+
* arm): `version`/`contentHash`/`lift` are stamped by the promote step, never
|
|
463
|
+
* the author.
|
|
464
|
+
*
|
|
465
|
+
* `sourcePath` is the artifact's ORIGINAL path (including `null`). It is the
|
|
466
|
+
* byte-stable fold sort key — the resolver folds context artifacts in
|
|
467
|
+
* `composeCertifiedPrompt` order, which sorts by `path ?? ''`, so a `null` path
|
|
468
|
+
* is load-bearing and MUST round-trip exactly. It is distinct from a context
|
|
469
|
+
* `iface.name` (display only): collapsing the two flips the fold order for a
|
|
470
|
+
* mix of null-path and non-null-path artifacts.
|
|
471
|
+
*/
|
|
472
|
+
interface CertProvenance {
|
|
473
|
+
contentHash: string;
|
|
474
|
+
version: number | null;
|
|
475
|
+
lift: string | null;
|
|
476
|
+
promotedAt: string;
|
|
477
|
+
sourcePath: string | null;
|
|
478
|
+
}
|
|
479
|
+
/** One certified unit of agent power. */
|
|
480
|
+
interface CertifiedCapability {
|
|
481
|
+
id: string;
|
|
482
|
+
iface: CapabilityInterface;
|
|
483
|
+
binding: DeliveryBinding;
|
|
484
|
+
auth: CapabilityAuth;
|
|
485
|
+
provenance: CertProvenance;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* The strict generalization of `CertifiedProfile`. `promptSurface` is kept
|
|
489
|
+
* during the migration window (the shipped pull lane still emits it); new
|
|
490
|
+
* capabilities live in `capabilities`.
|
|
491
|
+
*/
|
|
492
|
+
interface CapabilityManifest {
|
|
493
|
+
target: string;
|
|
494
|
+
generatedAt: string;
|
|
495
|
+
promptSurface: CertifiedPromptSurface | null;
|
|
496
|
+
capabilities: CertifiedCapability[];
|
|
497
|
+
}
|
|
498
|
+
/** One retrieval handle. The agent never learns vector vs graph vs index. */
|
|
499
|
+
interface ResolvedRetrieval {
|
|
500
|
+
name: string;
|
|
501
|
+
retrieve(query: string, k?: number): Promise<Array<{
|
|
502
|
+
text: string;
|
|
503
|
+
score?: number;
|
|
504
|
+
}>>;
|
|
505
|
+
}
|
|
506
|
+
/** One resolved hook — event + the command/matcher the seam folds into
|
|
507
|
+
* `AgentProfile.hooks`. */
|
|
508
|
+
interface ResolvedHook {
|
|
509
|
+
event: string;
|
|
510
|
+
command: string;
|
|
511
|
+
matcher?: string;
|
|
512
|
+
}
|
|
513
|
+
/** One resolved subagent — folded into `AgentProfile.subagents`. */
|
|
514
|
+
interface ResolvedSubagent {
|
|
515
|
+
name: string;
|
|
516
|
+
description?: string;
|
|
517
|
+
prompt?: string;
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* What `composeCertifiedProfile` produces. Every binding fans into the same
|
|
521
|
+
* slots, consumed identically by the in-process seam (`RouterToolsSeam.{tools,
|
|
522
|
+
* executeToolCall}` + folded prompt) and the sandbox seam (`AgentProfile`).
|
|
523
|
+
* `dispose()` tears provisioned hosts down in REVERSE dependency order.
|
|
524
|
+
*/
|
|
525
|
+
interface ResolvedSurface {
|
|
526
|
+
/** Host-side tool defs → `RouterToolsSeam.tools` / agent-app `extraTools`. */
|
|
527
|
+
tools: ToolSpec[];
|
|
528
|
+
/** Host-side dispatch for a resolved tool. Throws when `name` is unknown so a
|
|
529
|
+
* mis-dispatch is loud, never a silent empty string. */
|
|
530
|
+
execute(name: string, args: Record<string, unknown>, task: unknown): Promise<string>;
|
|
531
|
+
/** Sandbox-side tool delivery → `AgentProfile.mcp` / in-proc `createMcpEnvironment`. */
|
|
532
|
+
mcpConnections: Record<string, AgentProfileMcpServer>;
|
|
533
|
+
/** Prompt-context additions, byte-stable-ordered → folded system prompt. */
|
|
534
|
+
promptAdditions: string[];
|
|
535
|
+
/** Workspace files → `AgentProfile.resources.files`. */
|
|
536
|
+
files: Array<{
|
|
537
|
+
path: string;
|
|
538
|
+
content: string;
|
|
539
|
+
executable?: boolean;
|
|
540
|
+
}>;
|
|
541
|
+
/** Uniform retrieval handles. */
|
|
542
|
+
retrieval: ResolvedRetrieval[];
|
|
543
|
+
/** Hooks → `AgentProfile.hooks`. */
|
|
544
|
+
hooks: ResolvedHook[];
|
|
545
|
+
/** Subagents → `AgentProfile.subagents`. */
|
|
546
|
+
subagents: ResolvedSubagent[];
|
|
547
|
+
/** The folded system prompt — base + the byte-stable prompt additions, exactly
|
|
548
|
+
* as `composeCertifiedPrompt` renders the inline/context capabilities. */
|
|
549
|
+
systemPrompt: string;
|
|
550
|
+
/** Tear down provisioned hosts (reverse dependency order). */
|
|
551
|
+
dispose(): Promise<void>;
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* A binding kind whose resolver case is typed but not yet admitted (rag-index,
|
|
555
|
+
* memory-store, wasm, a2a). Thrown by the resolver — NEVER faked into a working
|
|
556
|
+
* surface. The TYPE arms exist so the union is closed against the spec; the
|
|
557
|
+
* resolver grows them later behind their lifecycle + admission gate.
|
|
558
|
+
*/
|
|
559
|
+
declare class CapabilityNotAdmittedError extends Error {
|
|
560
|
+
readonly kind: DeliveryBindingKind;
|
|
561
|
+
readonly capabilityId: string;
|
|
562
|
+
constructor(kind: DeliveryBindingKind, capabilityId: string, reason: string);
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Lower the EXISTING plane wire (`CertifiedProfile`) into a `CapabilityManifest`.
|
|
566
|
+
* `prompt-surface`/`skill` artifacts → `context`/inline capabilities (the
|
|
567
|
+
* shipped fold, generalized); any other artifact type → best-effort binding
|
|
568
|
+
* inference (see {@link inferCapability}). `promptSurface` is carried through so
|
|
569
|
+
* the resolver folds it first, exactly as `composeCertifiedPrompt` does today.
|
|
570
|
+
* This delivers the spine against today's wire before the plane changes.
|
|
571
|
+
*/
|
|
572
|
+
declare function manifestFromProfile(profile: CertifiedProfile): CapabilityManifest;
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* @experimental
|
|
576
|
+
*
|
|
577
|
+
* The capability resolver — the ONLY place that knows binding kinds. It lowers a
|
|
578
|
+
* `CapabilityManifest` into a uniform `ResolvedSurface` consumed identically by
|
|
579
|
+
* the in-process seam (`RouterToolsSeam.{tools, executeToolCall}` + a folded
|
|
580
|
+
* prompt) and the sandbox seam (`AgentProfile`).
|
|
581
|
+
*
|
|
582
|
+
* The spine (zero new infra) resolves inline/file, mcp-stdio/mcp-remote, and
|
|
583
|
+
* http tools for BOTH seams, reusing shipped primitives:
|
|
584
|
+
* - inline/context → `composeCertifiedPrompt` (delivery.ts) — byte-stable order;
|
|
585
|
+
* - http → a `ToolSpec` + a host-side fetch `execute`;
|
|
586
|
+
* - mcp-stdio/remote → an `AgentProfileMcpServer` (the strict union widens to
|
|
587
|
+
* the SDK's flat shape — an always-valid lowering).
|
|
588
|
+
*
|
|
589
|
+
* The ladder rungs that need infra are INJECTED capabilities of the resolve
|
|
590
|
+
* context (`runSandboxCode`, `provisionHost`), so the substrate-free caller wires
|
|
591
|
+
* only what it can host — a binding that needs an absent provider throws loudly,
|
|
592
|
+
* it is NEVER faked into a working surface. The not-yet-admitted arms (rag-index,
|
|
593
|
+
* memory-store, wasm, a2a) throw {@link CapabilityNotAdmittedError}.
|
|
594
|
+
*
|
|
595
|
+
* Fail-closed by construction (mirroring `pullCertified`): a `null` manifest
|
|
596
|
+
* returns the base surface only; a per-capability resolve failure DROPS that
|
|
597
|
+
* capability (never a half-wired tool); a post-resolve drift check drops any tool
|
|
598
|
+
* whose live names diverge from the certified interface.
|
|
599
|
+
*/
|
|
600
|
+
|
|
601
|
+
/** A live, provisioned host the resolver tore up for a `process-on-infra` arm.
|
|
602
|
+
* `teardown()` runs at `dispose()` in reverse provisioning order. */
|
|
603
|
+
interface ProvisionedHost {
|
|
604
|
+
/** Lower the inner binding's mcp connection now that the host is up; the URL/
|
|
605
|
+
* command points at the host. Absent when the host serves a non-mcp inner. */
|
|
606
|
+
mcpConnection?: AgentProfileMcpServer;
|
|
607
|
+
teardown(): Promise<void>;
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Per-call, per-tenant context the resolver reads. Everything that touches the
|
|
611
|
+
* network, a secret, or an infra provisioner is INJECTED so the manifest carries
|
|
612
|
+
* no live secret and the substrate-free caller wires only what it can host.
|
|
613
|
+
*/
|
|
614
|
+
interface ResolveCtx {
|
|
615
|
+
/** Stable tenant id — namespaces billing + teardown (`tenant#target`). */
|
|
616
|
+
tenant?: string;
|
|
617
|
+
/** fetch impl for http tools. Defaults to global fetch; absent ⇒ http tools fail loud. */
|
|
618
|
+
fetchImpl?: typeof fetch;
|
|
619
|
+
/**
|
|
620
|
+
* Resolve a declared credential to a live secret for THIS tenant. Returns a
|
|
621
|
+
* typed outcome — inspect `succeeded` before `value`. Absent ⇒ a binding that
|
|
622
|
+
* declares non-`none` auth fails loud (never a request with no credential).
|
|
623
|
+
*/
|
|
624
|
+
resolveSecret?: (auth: CapabilityAuth, tenant: string | undefined) => Promise<{
|
|
625
|
+
succeeded: true;
|
|
626
|
+
value: string;
|
|
627
|
+
} | {
|
|
628
|
+
succeeded: false;
|
|
629
|
+
error: string;
|
|
630
|
+
}>;
|
|
631
|
+
/**
|
|
632
|
+
* Run a `sandbox-code` body per call. Injected by the host that owns a sandbox
|
|
633
|
+
* client (the spine does not import the sandbox executor). Absent ⇒
|
|
634
|
+
* `sandbox-code` bindings fail loud.
|
|
635
|
+
*/
|
|
636
|
+
runSandboxCode?: (code: ContentRef, entry: string, args: Record<string, unknown>, task: unknown) => Promise<string>;
|
|
637
|
+
/**
|
|
638
|
+
* Provision a host for a `process-on-infra` binding, then serve the inner
|
|
639
|
+
* binding inside it. Injected by the host that owns `createExecutor`. Absent ⇒
|
|
640
|
+
* `process-on-infra` bindings fail loud. The provider resolves the inner
|
|
641
|
+
* binding INSIDE the host and returns the connection + a teardown.
|
|
642
|
+
*/
|
|
643
|
+
provisionHost?: (host: HostSpec, inner: DeliveryBinding, costTag: string) => Promise<ProvisionedHost>;
|
|
644
|
+
/**
|
|
645
|
+
* Drift probe: return the LIVE tool names a resolved surface exposes for a
|
|
646
|
+
* given capability id (a `tools/list` over an mcp connection, the agent's
|
|
647
|
+
* actual registered tool names for a host tool). When present, the post-resolve
|
|
648
|
+
* drift check drops any tool/mcp whose live names diverge from the certified
|
|
649
|
+
* interface — the only callable surfaces are gate-blessed ones. Absent ⇒ the
|
|
650
|
+
* check enforces only the host-side executor↔spec parity (no live probe).
|
|
651
|
+
*/
|
|
652
|
+
probeLiveToolNames?: (capabilityId: string) => Promise<string[]>;
|
|
653
|
+
/**
|
|
654
|
+
* Observe a DROPPED capability — a per-capability resolve failure that is
|
|
655
|
+
* fail-closed (the capability is omitted, never half-wired). The drop is the
|
|
656
|
+
* contract; this surfaces the diagnostic so it is never silently erased. NOT
|
|
657
|
+
* called for {@link CapabilityNotAdmittedError} (that rethrows — a manifest
|
|
658
|
+
* carrying an un-admitted binding kind is a hard error, not a soft drop).
|
|
659
|
+
*/
|
|
660
|
+
onDrop?: (capabilityId: string, error: Error) => void;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Compose a certified profile into a uniform `ResolvedSurface`. Additive over
|
|
664
|
+
* `composeCertifiedPrompt`: the inline/context fold is delegated to
|
|
665
|
+
* `composeCertifiedPrompt` so the byte-stable ordering (prompt surface first,
|
|
666
|
+
* then type alphabetic, then path locale-compare) is reused EXACTLY — the
|
|
667
|
+
* prompt-only path is a strict subset of this.
|
|
668
|
+
*
|
|
669
|
+
* Fail-closed: a `null` manifest returns the base surface only.
|
|
670
|
+
*/
|
|
671
|
+
declare function composeCertifiedProfile(base: {
|
|
672
|
+
systemPrompt: string;
|
|
673
|
+
}, manifest: CapabilityManifest | null, ctx?: ResolveCtx): Promise<ResolvedSurface>;
|
|
674
|
+
/** Lower a plane `CertifiedProfile` straight into a `ResolvedSurface` via
|
|
675
|
+
* `manifestFromProfile` — the convenience the shipped pull lane calls when it
|
|
676
|
+
* already holds a `CertifiedProfile` (today's wire) rather than a manifest. */
|
|
677
|
+
declare function composeCertifiedProfileFromWire(base: {
|
|
678
|
+
systemPrompt: string;
|
|
679
|
+
}, profile: CertifiedProfile | null, ctx?: ResolveCtx): Promise<ResolvedSurface>;
|
|
680
|
+
|
|
229
681
|
/**
|
|
230
682
|
* @experimental
|
|
231
683
|
*
|
|
@@ -343,6 +795,14 @@ interface TraceHandle {
|
|
|
343
795
|
usage?: Partial<UsageSplit>;
|
|
344
796
|
}): void;
|
|
345
797
|
}
|
|
798
|
+
/** Metadata for {@link IntelligenceClient.recordTrace}. */
|
|
799
|
+
interface RecordTraceMeta {
|
|
800
|
+
/** 32-hex trace id to anchor every span to. Defaults to a fresh id. */
|
|
801
|
+
traceId?: string;
|
|
802
|
+
/** Span id of an enclosing span the loop root should parent under (e.g. a
|
|
803
|
+
* `traceRun` span). Omitted ⇒ the loop root is the trace root. */
|
|
804
|
+
rootParentSpanId?: string;
|
|
805
|
+
}
|
|
346
806
|
/** The resolved outcome of one traced run, surfaced on the export span and
|
|
347
807
|
* available to the caller for downstream billing assertions. */
|
|
348
808
|
interface TraceOutcome {
|
|
@@ -370,6 +830,16 @@ interface IntelligenceClient {
|
|
|
370
830
|
* `fn` propagates to the caller (the agent's own failures are not masked).
|
|
371
831
|
*/
|
|
372
832
|
traceRun<T>(meta: TraceMeta, fn: (trace: TraceHandle) => Promise<T>): Promise<T>;
|
|
833
|
+
/**
|
|
834
|
+
* Export a run's full loop topology — the ordered `LoopTraceEvent` stream a
|
|
835
|
+
* `runLoop`/`Supervisor` run emits — as a nested OTLP span tree (loop → round →
|
|
836
|
+
* iteration) into ONE trace. Reuses the shipped `buildLoopOtelSpans` builder
|
|
837
|
+
* (NO second span builder), so the topology a viewer renders matches the
|
|
838
|
+
* kernel's. `traceId` defaults to a fresh id; `rootParentSpanId` parents the
|
|
839
|
+
* loop root under an enclosing span (e.g. a `traceRun` span) when given.
|
|
840
|
+
* Best-effort: export failures are swallowed. Returns the resolved `traceId`.
|
|
841
|
+
*/
|
|
842
|
+
recordTrace(events: ReadonlyArray<LoopTraceEvent>, meta?: RecordTraceMeta): string;
|
|
373
843
|
/**
|
|
374
844
|
* Network-free readiness report: which adoption modes are reachable given
|
|
375
845
|
* this config. Observe is always reachable; Recommend needs outcomes; PR
|
|
@@ -420,4 +890,4 @@ type ClientOrConfig = IntelligenceClient | IntelligenceConfig;
|
|
|
420
890
|
*/
|
|
421
891
|
declare function withTangleIntelligence<TInput, TOutput>(agent: Agent<TInput, TOutput>, clientOrConfig: ClientOrConfig): Agent<TInput, TOutput>;
|
|
422
892
|
|
|
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 };
|
|
893
|
+
export { type Agent, type AppliedIntelligence, type CapabilityAuth, type CapabilityInterface, type CapabilityManifest, CapabilityNotAdmittedError, type CapabilitySurface, type CertProvenance, type CertifiedArtifact, type CertifiedCapability, type CertifiedProfile, type CertifiedPromptSurface, type ClientOrConfig, type ContentRef, type CorpusAccess, type CredentialRef, type DeliveredAgent, type DeliveryBinding, type DeliveryBindingKind, type DeliveryConfig, type DoctorReport, type EffortOverrides, type EffortOverridesCompiled, type EffortSettings, type EffortTier, type HostSpec, type IntelligenceClient, type IntelligenceConfig, type JsonSchema, type ModeReadiness, type ProvisionedHost, type PullCertifiedOptions, type PullOutcome, type RecordTraceMeta, type Redactor, type RepoConfig, type ResolveCtx, type ResolvedHook, type ResolvedRetrieval, type ResolvedSubagent, type ResolvedSurface, type TraceHandle, type TraceMeta, type TraceOutcome, type UsageClass, type UsageSplit, compileEffort, composeCertifiedProfile, composeCertifiedProfileFromWire, composeCertifiedPrompt, createIntelligenceClient, defaultEffortTier, defaultRedactor, isIntelligenceOff, manifestFromProfile, pullCertified, resolveEffort, resolveRedactor, withCertifiedDelivery, withTangleIntelligence };
|