@tangle-network/agent-runtime 0.53.0 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -16
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +5 -3
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/analyst-loop.js +2 -2
- package/dist/{chunk-K5M3SHEU.js → chunk-2BDXWZUC.js} +5 -34
- package/dist/chunk-2BDXWZUC.js.map +1 -0
- package/dist/chunk-A73RADPB.js +281 -0
- package/dist/chunk-A73RADPB.js.map +1 -0
- package/dist/chunk-GRAGM4MC.js +72 -0
- package/dist/chunk-GRAGM4MC.js.map +1 -0
- package/dist/{chunk-GLR25NG7.js → chunk-H2KWSZAN.js} +2 -1
- package/dist/{chunk-GLR25NG7.js.map → chunk-H2KWSZAN.js.map} +1 -1
- package/dist/{chunk-K6WP7PYW.js → chunk-JTH2FPCK.js} +3231 -424
- package/dist/chunk-JTH2FPCK.js.map +1 -0
- package/dist/{chunk-P4QNEXFC.js → chunk-KJH62YEK.js} +2 -2
- package/dist/{chunk-HNUXAZIJ.js → chunk-P5OKDSLB.js} +2 -2
- package/dist/{chunk-GSUO5QS6.js → chunk-VLF5RHEQ.js} +2 -5
- package/dist/{chunk-GSUO5QS6.js.map → chunk-VLF5RHEQ.js.map} +1 -1
- package/dist/{chunk-JFIYKDXF.js → chunk-XRYEZPR6.js} +2 -1
- package/dist/chunk-XRYEZPR6.js.map +1 -0
- package/dist/chunk-ZMPQEPQ7.js +396 -0
- package/dist/chunk-ZMPQEPQ7.js.map +1 -0
- package/dist/{coder-LKm3Mczw.d.ts → coder-CEkUFv8h.d.ts} +1 -1
- package/dist/{types-CNDJCL_0.d.ts → coordination-BMzskrUR.d.ts} +268 -2
- package/dist/{kb-gate-CKfykcYQ.d.ts → delegates-BPLIl8EC.d.ts} +491 -566
- package/dist/improvement.js +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +23 -80
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +2 -2
- package/dist/kb-gate-CuzMYGYM.d.ts +76 -0
- package/dist/{loop-runner-bin-D4Ir7b00.d.ts → loop-runner-bin-BGpVVyXp.d.ts} +6 -27
- package/dist/loop-runner-bin.d.ts +5 -5
- package/dist/loop-runner-bin.js +6 -5
- package/dist/loops.d.ts +8 -6
- package/dist/loops.js +32 -8
- package/dist/mcp/bin.js +95 -31
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +9 -272
- package/dist/mcp/index.js +45 -365
- package/dist/mcp/index.js.map +1 -1
- package/dist/{openai-tools-CKfR3EMh.d.ts → openai-tools-CoeLQ7Uo.d.ts} +1 -1
- package/dist/profiles.d.ts +2 -2
- package/dist/profiles.js +4 -4
- package/dist/{router-client-B0Qi1NiN.d.ts → router-client-30Y_pca8.d.ts} +1 -1
- package/dist/{run-loop-DgVhucoR.d.ts → run-loop-DluzfJ2h.d.ts} +1 -1
- package/dist/runtime.d.ts +424 -23
- package/dist/runtime.js +32 -8
- package/dist/topology.d.ts +54 -1
- package/dist/topology.js +222 -0
- package/dist/topology.js.map +1 -1
- package/dist/{types-CklkW4Eh.d.ts → types-C8rNlxfV.d.ts} +4 -4
- package/dist/workflow.d.ts +2 -2
- package/dist/workflow.js +4 -2
- package/dist/workflow.js.map +1 -1
- package/package.json +5 -5
- package/skills/agent-runtime-adoption/SKILL.md +54 -46
- package/skills/build-with-agent-runtime/SKILL.md +12 -8
- package/skills/loop-writer/SKILL.md +9 -1
- package/skills/supervise/SKILL.md +24 -0
- package/dist/chunk-5M2WDWBI.js +0 -908
- package/dist/chunk-5M2WDWBI.js.map +0 -1
- package/dist/chunk-AYRQZRDV.js +0 -623
- package/dist/chunk-AYRQZRDV.js.map +0 -1
- package/dist/chunk-FO4DCM7R.js +0 -1356
- package/dist/chunk-FO4DCM7R.js.map +0 -1
- package/dist/chunk-JFIYKDXF.js.map +0 -1
- package/dist/chunk-K5M3SHEU.js.map +0 -1
- package/dist/chunk-K6WP7PYW.js.map +0 -1
- package/dist/driver-B2RKkVJW.d.ts +0 -221
- /package/dist/{chunk-P4QNEXFC.js.map → chunk-KJH62YEK.js.map} +0 -0
- /package/dist/{chunk-HNUXAZIJ.js.map → chunk-P5OKDSLB.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AgentProfile } from '@tangle-network/sandbox';
|
|
2
|
-
import { O as OutputAdapter, V as Validator, A as AgentRunSpec, D as Driver } from './types-
|
|
2
|
+
import { O as OutputAdapter, V as Validator, A as AgentRunSpec, D as Driver } from './types-C8rNlxfV.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @experimental
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { DefaultVerdict } from '@tangle-network/agent-eval';
|
|
2
2
|
import { AgentProfile, BackendType } from '@tangle-network/sandbox';
|
|
3
3
|
import { R as RuntimeHooks } from './runtime-hooks-C7JwKb9E.js';
|
|
4
|
-
import { d as LoopTokenUsage } from './types-
|
|
4
|
+
import { d as LoopTokenUsage } from './types-C8rNlxfV.js';
|
|
5
|
+
import { b as DelegateFeedbackArgs, c as DelegationFeedbackSnapshot, d as DelegationTaskQueue, e as CoderDelegate, R as ResearcherDelegate, U as UiAuditorDelegate, T as TraceContext } from './delegates-BPLIl8EC.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @experimental
|
|
@@ -435,4 +436,269 @@ interface WidenGate<Out> {
|
|
|
435
436
|
readonly judgeExempt?: boolean;
|
|
436
437
|
}
|
|
437
438
|
|
|
438
|
-
|
|
439
|
+
/**
|
|
440
|
+
* @experimental
|
|
441
|
+
*
|
|
442
|
+
* Feedback persistence surface for the MCP layer.
|
|
443
|
+
*
|
|
444
|
+
* The substrate cannot import `@tangle-network/agent-knowledge` (it would
|
|
445
|
+
* induce a dependency cycle), so the store is an abstract interface. The
|
|
446
|
+
* default implementation is in-memory; consumers wire their own adapter
|
|
447
|
+
* (a real KbStore-backed sink, an HTTP relay to gtm-agent's knowledge
|
|
448
|
+
* service, etc.) via `createMcpServer({ feedbackStore })`.
|
|
449
|
+
*
|
|
450
|
+
* Feedback events are append-only: every rating is a new event with a
|
|
451
|
+
* fresh id, even when the same delegation is rated multiple times. The
|
|
452
|
+
* caller decides how to roll up scores downstream.
|
|
453
|
+
*/
|
|
454
|
+
|
|
455
|
+
/** @experimental */
|
|
456
|
+
interface FeedbackEvent {
|
|
457
|
+
id: string;
|
|
458
|
+
refersTo: DelegateFeedbackArgs['refersTo'];
|
|
459
|
+
rating: DelegateFeedbackArgs['rating'];
|
|
460
|
+
by: DelegateFeedbackArgs['by'];
|
|
461
|
+
capturedAt: string;
|
|
462
|
+
namespace?: string;
|
|
463
|
+
}
|
|
464
|
+
/** @experimental */
|
|
465
|
+
interface FeedbackStore {
|
|
466
|
+
/** Append a new event. Never dedupes — every rating is its own event. */
|
|
467
|
+
put(event: FeedbackEvent): Promise<void>;
|
|
468
|
+
/**
|
|
469
|
+
* List events filtered by `namespace`. When `namespace` is omitted, list
|
|
470
|
+
* across all namespaces. Returns events in insertion order.
|
|
471
|
+
*/
|
|
472
|
+
list(filter?: {
|
|
473
|
+
namespace?: string;
|
|
474
|
+
refersToRef?: string;
|
|
475
|
+
}): Promise<FeedbackEvent[]>;
|
|
476
|
+
}
|
|
477
|
+
/** @experimental */
|
|
478
|
+
declare class InMemoryFeedbackStore implements FeedbackStore {
|
|
479
|
+
private readonly events;
|
|
480
|
+
put(event: FeedbackEvent): Promise<void>;
|
|
481
|
+
list(filter?: {
|
|
482
|
+
namespace?: string;
|
|
483
|
+
refersToRef?: string;
|
|
484
|
+
}): Promise<FeedbackEvent[]>;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Project a `FeedbackEvent` down to the snapshot shape carried on
|
|
488
|
+
* `delegation_history` entries.
|
|
489
|
+
*
|
|
490
|
+
* @experimental
|
|
491
|
+
*/
|
|
492
|
+
declare function eventToSnapshot(event: FeedbackEvent): DelegationFeedbackSnapshot;
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* @experimental
|
|
496
|
+
*
|
|
497
|
+
* Stdio JSON-RPC MCP server exposing the 5 delegation tools to sandbox
|
|
498
|
+
* coding-harness agents (claude-code, codex, opencode, ...).
|
|
499
|
+
*
|
|
500
|
+
* The server is transport-bound but topology-free: tool execution is
|
|
501
|
+
* delegated to handler functions composed from a queue, a feedback
|
|
502
|
+
* store, and per-profile run delegates. Consumers wire those at
|
|
503
|
+
* construction time. The `agent-runtime-mcp` bin spins up a default
|
|
504
|
+
* configuration for the common case (real sandbox client + coder).
|
|
505
|
+
*
|
|
506
|
+
* Wire protocol: line-delimited JSON-RPC 2.0 over stdio. Each line is
|
|
507
|
+
* one request; each response is one line. `tools/list` and `tools/call`
|
|
508
|
+
* mirror the MCP 2024-11-05 spec; we do not pull in
|
|
509
|
+
* `@modelcontextprotocol/sdk` to keep the dependency footprint zero.
|
|
510
|
+
*/
|
|
511
|
+
|
|
512
|
+
/** @experimental */
|
|
513
|
+
interface McpServerOptions {
|
|
514
|
+
/** Required to enable delegate_code. */
|
|
515
|
+
coderDelegate?: CoderDelegate;
|
|
516
|
+
/**
|
|
517
|
+
* Required to enable delegate_research. The substrate cannot ship a
|
|
518
|
+
* default — wire one that closes over your `runLoop` + a
|
|
519
|
+
* researcher profile (typically `@tangle-network/agent-knowledge`'s
|
|
520
|
+
* `researcherProfile` / `multiHarnessResearcherFanout`).
|
|
521
|
+
*/
|
|
522
|
+
researcherDelegate?: ResearcherDelegate;
|
|
523
|
+
/**
|
|
524
|
+
* Required to enable delegate_ui_audit. Wire one that closes over your
|
|
525
|
+
* `runLoop` + `uiAuditorProfile` + a `SandboxClient` (the
|
|
526
|
+
* canonical in-process choice is `createInProcessUiAuditClient` from
|
|
527
|
+
* `@tangle-network/agent-runtime/profiles`) + your vision judge.
|
|
528
|
+
*/
|
|
529
|
+
uiAuditorDelegate?: UiAuditorDelegate;
|
|
530
|
+
/** Override the default in-memory feedback store. */
|
|
531
|
+
feedbackStore?: FeedbackStore;
|
|
532
|
+
/** Override the default in-memory task queue. */
|
|
533
|
+
queue?: DelegationTaskQueue;
|
|
534
|
+
/**
|
|
535
|
+
* Record deterministic detached-session resume keys on single-variant
|
|
536
|
+
* coder/researcher submissions so a durable queue can resume them after a
|
|
537
|
+
* restart. Enable only when the wired delegates dispatch via sandbox
|
|
538
|
+
* sessions (`driveTurn`) AND `queue` persists records — the keys are inert
|
|
539
|
+
* otherwise. The bin turns this on alongside the durable store for
|
|
540
|
+
* session-backed (sibling/fleet) placements.
|
|
541
|
+
*/
|
|
542
|
+
detachedDispatch?: boolean;
|
|
543
|
+
/**
|
|
544
|
+
* Extra tools to serve alongside the delegation tools, for example
|
|
545
|
+
* `createCoordinationTools(...).tools`. Registered after the built-ins; a
|
|
546
|
+
* duplicate name throws so delegation tools cannot be shadowed silently.
|
|
547
|
+
*/
|
|
548
|
+
extraTools?: McpToolDescriptor[];
|
|
549
|
+
/**
|
|
550
|
+
* Inherited trace identity (`readTraceContextFromEnv()`) stamped on every
|
|
551
|
+
* record the DEFAULT queue creates. Ignored when `queue` is supplied —
|
|
552
|
+
* pass `traceContext` to that queue's constructor instead.
|
|
553
|
+
*/
|
|
554
|
+
traceContext?: TraceContext;
|
|
555
|
+
/** Server display name surfaced via `initialize`. Default `'agent-runtime-mcp'`. */
|
|
556
|
+
serverName?: string;
|
|
557
|
+
/** Server version surfaced via `initialize`. Default = the package version baked at build time. */
|
|
558
|
+
serverVersion?: string;
|
|
559
|
+
}
|
|
560
|
+
/** @experimental */
|
|
561
|
+
interface McpToolDescriptor {
|
|
562
|
+
name: string;
|
|
563
|
+
description: string;
|
|
564
|
+
inputSchema: Record<string, unknown>;
|
|
565
|
+
handler: (raw: unknown) => Promise<unknown>;
|
|
566
|
+
}
|
|
567
|
+
/** @experimental */
|
|
568
|
+
interface McpServer {
|
|
569
|
+
/** Tools currently registered (depend on which delegates were wired). */
|
|
570
|
+
readonly tools: ReadonlyMap<string, McpToolDescriptor>;
|
|
571
|
+
/** The underlying queue — exposed so tests can introspect it. */
|
|
572
|
+
readonly queue: DelegationTaskQueue;
|
|
573
|
+
/** The feedback store — exposed for the same reason. */
|
|
574
|
+
readonly feedbackStore: FeedbackStore;
|
|
575
|
+
/** Handle a single parsed JSON-RPC message. Returns the response object (or `null` for notifications). */
|
|
576
|
+
handle(message: JsonRpcMessage): Promise<JsonRpcResponse | null>;
|
|
577
|
+
/** Drive the server on a stdio-shaped transport until `stop()` is called. */
|
|
578
|
+
serve(transport?: McpTransport): Promise<void>;
|
|
579
|
+
/** Stop a `serve` call. Subsequent requests are rejected. */
|
|
580
|
+
stop(): void;
|
|
581
|
+
}
|
|
582
|
+
/** @experimental */
|
|
583
|
+
interface McpTransport {
|
|
584
|
+
input: NodeJS.ReadableStream;
|
|
585
|
+
output: NodeJS.WritableStream;
|
|
586
|
+
}
|
|
587
|
+
/** @experimental */
|
|
588
|
+
interface JsonRpcMessage {
|
|
589
|
+
jsonrpc: '2.0';
|
|
590
|
+
id?: number | string | null;
|
|
591
|
+
method: string;
|
|
592
|
+
params?: unknown;
|
|
593
|
+
}
|
|
594
|
+
/** @experimental */
|
|
595
|
+
interface JsonRpcResponse {
|
|
596
|
+
jsonrpc: '2.0';
|
|
597
|
+
id: number | string | null;
|
|
598
|
+
result?: unknown;
|
|
599
|
+
error?: {
|
|
600
|
+
code: number;
|
|
601
|
+
message: string;
|
|
602
|
+
data?: unknown;
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
/** @experimental */
|
|
606
|
+
declare function createMcpServer(options?: McpServerOptions): McpServer;
|
|
607
|
+
/**
|
|
608
|
+
* In-process pair of `Readable` + `Writable` streams suitable for driving
|
|
609
|
+
* `server.serve(...)` from a test. Returns the agent-side stream (the
|
|
610
|
+
* client writes to it) and the server-side stream (the test reads from it).
|
|
611
|
+
*
|
|
612
|
+
* @experimental
|
|
613
|
+
*/
|
|
614
|
+
declare function createInProcessTransport(): {
|
|
615
|
+
transport: McpTransport;
|
|
616
|
+
clientWrite(line: string): void;
|
|
617
|
+
clientClose(): void;
|
|
618
|
+
readServer(): Promise<JsonRpcResponse[]>;
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* @experimental
|
|
623
|
+
*
|
|
624
|
+
* MCP binding for a live `Scope`. A sandbox driver gets the same small verbs
|
|
625
|
+
* the in-process driver has: spawn, observe, await, steer, ask/answer, analyze,
|
|
626
|
+
* and stop. Settled outputs remain Scope artifacts; product code can project
|
|
627
|
+
* them into any UI/report envelope it needs.
|
|
628
|
+
*/
|
|
629
|
+
|
|
630
|
+
/** A worker the driver has drained via `await_next`. */
|
|
631
|
+
interface SettledWorker {
|
|
632
|
+
readonly id: string;
|
|
633
|
+
readonly status: 'done' | 'down';
|
|
634
|
+
readonly score?: number;
|
|
635
|
+
readonly valid?: boolean;
|
|
636
|
+
readonly outRef?: string;
|
|
637
|
+
readonly reason?: string;
|
|
638
|
+
}
|
|
639
|
+
type QuestionLevel = 'worker' | 'driver' | 'loop';
|
|
640
|
+
type QuestionUrgency = 'continue-without' | 'blocks-step' | 'blocks-run';
|
|
641
|
+
interface QuestionOption {
|
|
642
|
+
readonly label: string;
|
|
643
|
+
readonly tradeoff: string;
|
|
644
|
+
}
|
|
645
|
+
interface Question {
|
|
646
|
+
readonly id: string;
|
|
647
|
+
readonly from: string;
|
|
648
|
+
readonly level: QuestionLevel;
|
|
649
|
+
readonly question: string;
|
|
650
|
+
readonly reason: string;
|
|
651
|
+
readonly urgency: QuestionUrgency;
|
|
652
|
+
readonly options?: ReadonlyArray<QuestionOption>;
|
|
653
|
+
}
|
|
654
|
+
type QuestionDecision = {
|
|
655
|
+
readonly kind: 'answer';
|
|
656
|
+
readonly answer: string;
|
|
657
|
+
readonly by: string;
|
|
658
|
+
} | {
|
|
659
|
+
readonly kind: 'defer';
|
|
660
|
+
readonly reason: string;
|
|
661
|
+
} | {
|
|
662
|
+
readonly kind: 'escalate';
|
|
663
|
+
readonly to: 'parent' | 'user' | string;
|
|
664
|
+
readonly reason: string;
|
|
665
|
+
};
|
|
666
|
+
interface QuestionRecord extends Question {
|
|
667
|
+
readonly status: 'open' | 'answered' | 'deferred' | 'escalated';
|
|
668
|
+
readonly decision?: QuestionDecision;
|
|
669
|
+
readonly openedAt: number;
|
|
670
|
+
}
|
|
671
|
+
type QuestionPolicy = 'auto' | 'mustDecide' | 'bubble' | 'failClosed';
|
|
672
|
+
interface AnalystRegistry {
|
|
673
|
+
readonly kinds: ReadonlyArray<{
|
|
674
|
+
id: string;
|
|
675
|
+
description: string;
|
|
676
|
+
area: string;
|
|
677
|
+
}>;
|
|
678
|
+
readonly run: (kindId: string, trace: unknown) => Promise<unknown>;
|
|
679
|
+
}
|
|
680
|
+
type CoordinationEvent = {
|
|
681
|
+
readonly type: 'question';
|
|
682
|
+
readonly question: QuestionRecord;
|
|
683
|
+
};
|
|
684
|
+
type MakeWorkerAgent = (profile: unknown) => Agent<unknown, unknown>;
|
|
685
|
+
interface CoordinationToolsOptions {
|
|
686
|
+
readonly scope: Scope<unknown>;
|
|
687
|
+
readonly blobs: ResultBlobStore;
|
|
688
|
+
readonly makeWorkerAgent: MakeWorkerAgent;
|
|
689
|
+
readonly perWorker: Budget;
|
|
690
|
+
readonly analysts?: AnalystRegistry;
|
|
691
|
+
readonly onEvent?: (event: CoordinationEvent) => void | Promise<void>;
|
|
692
|
+
readonly questionPolicy?: QuestionPolicy;
|
|
693
|
+
}
|
|
694
|
+
interface CoordinationTools {
|
|
695
|
+
readonly tools: McpToolDescriptor[];
|
|
696
|
+
isStopped(): boolean;
|
|
697
|
+
stopReason(): string | undefined;
|
|
698
|
+
settled(): ReadonlyArray<SettledWorker>;
|
|
699
|
+
questions(): ReadonlyArray<QuestionRecord>;
|
|
700
|
+
}
|
|
701
|
+
/** Build the driver's MCP tools over a live scope. */
|
|
702
|
+
declare function createCoordinationTools(opts: CoordinationToolsOptions): CoordinationTools;
|
|
703
|
+
|
|
704
|
+
export { type AnalystRegistry as A, type Budget as B, type CoordinationEvent as C, type Supervisor as D, type ExecutorRegistry as E, type FeedbackStore as F, type ExecutorContext as G, type ExecutorResult as H, InMemoryFeedbackStore as I, type JsonRpcMessage as J, type Handle as K, type NodeSnapshot as L, type MakeWorkerAgent as M, type NodeId as N, type NodeStatus as O, type Restart as P, type Question as Q, type ResultBlobStore as R, type SettledWorker as S, type TreeView as T, type UsageEvent as U, type RootSignal as V, type Runtime as W, type SpawnOpts as X, type SupervisorOpts as Y, type WidenGate as Z, type CoordinationTools as a, type CoordinationToolsOptions as b, type FeedbackEvent as c, type JsonRpcResponse as d, type McpServer as e, type McpServerOptions as f, type McpToolDescriptor as g, type McpTransport as h, type QuestionDecision as i, type QuestionPolicy as j, type QuestionRecord as k, createCoordinationTools as l, createInProcessTransport as m, createMcpServer as n, eventToSnapshot as o, type SpawnJournal as p, type SpawnEvent as q, type Settled as r, type AgentSpec as s, type Agent as t, type RootHandle as u, type SupervisedResult as v, type Spend as w, type Scope as x, type ExecutorFactory as y, type Executor as z };
|