@tangle-network/agent-runtime 0.93.2 → 0.94.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 +4 -3
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +3 -4
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/candidate-execution/index.d.ts +10 -3
- package/dist/candidate-execution/index.js +8 -2
- package/dist/{chunk-XDSWWUKE.js → chunk-4E2GM63H.js} +6 -29
- package/dist/chunk-4E2GM63H.js.map +1 -0
- package/dist/{chunk-TU73X3I6.js → chunk-4GBT4WQ6.js} +2 -2
- package/dist/{chunk-Z7K5BPKZ.js → chunk-55P6V5JT.js} +2 -2
- package/dist/{chunk-OX3QRJOA.js → chunk-7I2AOKCI.js} +280 -250
- package/dist/chunk-7I2AOKCI.js.map +1 -0
- package/dist/{chunk-2BQMAZAB.js → chunk-FHZHADIM.js} +1327 -19
- package/dist/chunk-FHZHADIM.js.map +1 -0
- package/dist/{chunk-WGR6QJ5H.js → chunk-H2D3DCEB.js} +7 -160
- package/dist/chunk-H2D3DCEB.js.map +1 -0
- package/dist/chunk-ISTDY47H.js +849 -0
- package/dist/chunk-ISTDY47H.js.map +1 -0
- package/dist/{chunk-X5KJKS33.js → chunk-MRYPFDHJ.js} +3 -3
- package/dist/{chunk-6K5CI33W.js → chunk-OO4EK3JB.js} +1228 -18
- package/dist/chunk-OO4EK3JB.js.map +1 -0
- package/dist/{chunk-R5GWDTM3.js → chunk-ZEYAT33L.js} +2 -2
- package/dist/{completion-gate-BLaiN0-X.d.ts → completion-gate-BDkEYB_-.d.ts} +1 -1
- package/dist/{coordination-DxJ83oZA.d.ts → coordination-EGoRbbsd.d.ts} +4 -4
- package/dist/environment-provider.d.ts +2 -2
- package/dist/{improve-DDhQaaJT.d.ts → improve-ZzTEkpF_.d.ts} +11 -14
- package/dist/index.d.ts +35 -106
- package/dist/index.js +89 -33
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +22 -5
- package/dist/intelligence.js +111 -17
- package/dist/intelligence.js.map +1 -1
- package/dist/knowledge.d.ts +6 -6
- package/dist/knowledge.js +3 -3
- package/dist/{loop-runner-bin-kKUNGLyV.d.ts → loop-runner-bin-BRXC1RwC.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +5 -5
- package/dist/loop-runner-bin.js +4 -5
- package/dist/loops.d.ts +456 -17
- package/dist/loops.js +37 -39
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +8 -8
- package/dist/mcp/index.js +5 -6
- package/dist/mcp/index.js.map +1 -1
- package/dist/{openai-tools-E3woykz9.d.ts → openai-tools-D0ZSRCC6.d.ts} +1 -1
- package/dist/{prepare-DiVGKcwS.d.ts → prepare-BKxAiUcH.d.ts} +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/{sanitize-C9go6tXj.d.ts → sanitize-C2jicjNf.d.ts} +1 -1
- package/dist/{supervise-T2pazU3G.d.ts → supervise-Gmf709kn.d.ts} +4 -4
- package/dist/{types-DAdIm4AC.d.ts → types-Cg_teUPO.d.ts} +2 -2
- package/dist/{types-B00NtbCs.d.ts → types-DWA64rbJ.d.ts} +1 -1
- package/dist/{worktree-fanout-BUb2Ag02.d.ts → worktree-fanout-BrB4att3.d.ts} +233 -233
- package/package.json +4 -4
- package/skills/build-with-agent-runtime/SKILL.md +1 -1
- package/dist/chunk-2BQMAZAB.js.map +0 -1
- package/dist/chunk-6K5CI33W.js.map +0 -1
- package/dist/chunk-FDJ7AHXG.js +0 -1229
- package/dist/chunk-FDJ7AHXG.js.map +0 -1
- package/dist/chunk-J2K6WIG6.js +0 -2172
- package/dist/chunk-J2K6WIG6.js.map +0 -1
- package/dist/chunk-OX3QRJOA.js.map +0 -1
- package/dist/chunk-WGR6QJ5H.js.map +0 -1
- package/dist/chunk-XDSWWUKE.js.map +0 -1
- package/dist/structural-rollout-DHGDbhvR.d.ts +0 -446
- /package/dist/{chunk-TU73X3I6.js.map → chunk-4GBT4WQ6.js.map} +0 -0
- /package/dist/{chunk-Z7K5BPKZ.js.map → chunk-55P6V5JT.js.map} +0 -0
- /package/dist/{chunk-X5KJKS33.js.map → chunk-MRYPFDHJ.js.map} +0 -0
- /package/dist/{chunk-R5GWDTM3.js.map → chunk-ZEYAT33L.js.map} +0 -0
|
@@ -715,4 +715,4 @@ interface PrepareAgentCandidateExecutionOptions {
|
|
|
715
715
|
/** Materializes a verified candidate into one immutable evaluator-owned execution plan. */
|
|
716
716
|
declare function prepareAgentCandidateExecution(candidate: VerifiedAgentCandidate, task: AgentCandidateTaskExecution, ports: AgentCandidateExecutionPorts, options?: PrepareAgentCandidateExecutionOptions): Promise<PreparedAgentCandidateExecution>;
|
|
717
717
|
|
|
718
|
-
export { InMemoryAgentCandidateExecutionClaimStore as $, type
|
|
718
|
+
export { InMemoryAgentCandidateExecutionClaimStore as $, type AgentCandidateBundleInput as A, type AgentCandidateExecutorProfileFile as B, type AgentCandidateExecutorRequest as C, type AgentCandidateExecutorStopRequest as D, type ExecutePreparedAgentCandidateOptions as E, type AgentCandidateExecutorTaskOutcomeCapture as F, type AgentCandidateExecutorWorkspaceFile as G, type AgentCandidateExecutorWorkspaceInput as H, type AgentCandidateMemoryPort as I, type AgentCandidateMemoryResetResult as J, type AgentCandidateModelLimits as K, type AgentCandidateModelPort as L, type AgentCandidateOutputArtifactPort as M, type AgentCandidateOutputPurpose as N, type AgentCandidateProtectedModelActivation as O, type PrepareAgentCandidateExecutionOptions as P, type AgentCandidateProtectedModelCall as Q, type AgentCandidateProtectedModelReservation as R, type AgentCandidateProtectedModelSettlement as S, type AgentCandidateProtectedRunCapture as T, type AgentCandidateRepositoryPort as U, type AgentCandidateRetryRejection as V, type AgentCandidateVerificationPorts as W, type AgentCandidateWorkspacePort as X, CANDIDATE_TRACE_ENV as Y, CANDIDATE_TRACE_TAGS as Z, type CanonicalCandidateDocument as _, type AgentCandidateTaskExecution as a, type PreparedAgentCandidateExecution as a0, type PreparedAgentCandidateInstruction as a1, type PreparedAgentCandidateLaunch as a2, type PreparedAgentCandidateTrace as a3, type ResolvedAgentCandidateContainer as a4, type VerifiedAgentCandidate as a5, type VerifiedAgentCandidateTaskOutcome as a6, executePreparedAgentCandidate as a7, prepareAgentCandidateExecution as a8, sealAgentCandidateBundle as a9, type AgentCandidateExecutionPorts as b, type AgentCandidateRunFinalization as c, type AgentCandidateArtifactPort as d, type AgentCandidateBenchmarkGraderIdentity as e, type AgentCandidateBenchmarkGraderPort as f, type AgentCandidateContainerPort as g, type AgentCandidateExecutionAttemptRecord as h, type AgentCandidateExecutionAttemptRef as i, type AgentCandidateExecutionClaim as j, type AgentCandidateExecutionClaimResult as k, type AgentCandidateExecutionClaimStore as l, type AgentCandidateExecutionCleanupHandles as m, type AgentCandidateExecutionFailureClass as n, type AgentCandidateExecutionFinishResult as o, type AgentCandidateExecutionLease as p, type AgentCandidateExecutionPhase as q, type AgentCandidateExecutionPhaseResult as r, type AgentCandidateExecutionRecoveryEvidence as s, type AgentCandidateExecutionStageResult as t, type AgentCandidateExecutionTerminalRecord as u, type AgentCandidateExecutionTerminalResult as v, type AgentCandidateExecutionUsage as w, type AgentCandidateExecutorFinalCapture as x, type AgentCandidateExecutorMemoryCapture as y, type AgentCandidateExecutorPort as z };
|
package/dist/profiles.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as UiFinding, U as UiLens } from './substrate-DO2GHNg2.js';
|
|
2
2
|
export { C as CoderTask, b as UI_FINDING_SEVERITIES, c as UI_LENSES, d as UiFindingScreenshot, e as UiFindingSeverity, f as coderTaskToPrompt } from './substrate-DO2GHNg2.js';
|
|
3
3
|
import { AgentProfile, SandboxEvent } from '@tangle-network/sandbox';
|
|
4
|
-
import { V as Validator,
|
|
4
|
+
import { V as Validator, d as AgentRunSpec, c as OutputAdapter, D as Driver, S as SandboxClient } from './types-DWA64rbJ.js';
|
|
5
5
|
import { AgentProfile as AgentProfile$1 } from '@tangle-network/agent-interface';
|
|
6
6
|
import '@tangle-network/agent-eval';
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ControlEvalResult, KnowledgeReadinessReport, KnowledgeRequirement } from '@tangle-network/agent-eval';
|
|
2
|
-
import { A as AgentRuntimeEvent,
|
|
2
|
+
import { A as AgentRuntimeEvent, a as RuntimeStreamEvent, b as AgentTaskStatus } from './types-DWA64rbJ.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* THE canonical agentic tool-loop. One inference turn → run any requested tools → fold the
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as Scope, a as ResultBlobStore, B as Budget, A as Agent, b as SupervisedResult } from './types-
|
|
2
|
-
import { M as MakeWorkerAgent, A as AnalystRegistry, E as ExecutorConfig } from './coordination-
|
|
3
|
-
import { R as RouterConfig, T as ToolLoopChat, a as ToolLoopCompactionOptions } from './sanitize-
|
|
4
|
-
import { D as DeliverableSpec } from './completion-gate-
|
|
1
|
+
import { S as Scope, a as ResultBlobStore, B as Budget, A as Agent, b as SupervisedResult } from './types-Cg_teUPO.js';
|
|
2
|
+
import { M as MakeWorkerAgent, A as AnalystRegistry, E as ExecutorConfig } from './coordination-EGoRbbsd.js';
|
|
3
|
+
import { R as RouterConfig, T as ToolLoopChat, a as ToolLoopCompactionOptions } from './sanitize-C2jicjNf.js';
|
|
4
|
+
import { D as DeliverableSpec } from './completion-gate-BDkEYB_-.js';
|
|
5
5
|
|
|
6
6
|
/** The supervisor's profile — the subset of an `AgentProfile` that selects + shapes its brain.
|
|
7
7
|
* `harness` is the backend-as-data discriminant; `systemPrompt` is the standing instruction. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DefaultVerdict } from '@tangle-network/agent-eval';
|
|
2
2
|
import { AgentProfile } from '@tangle-network/agent-interface';
|
|
3
3
|
import { BackendType } from '@tangle-network/sandbox';
|
|
4
|
-
import { L as LoopTokenUsage, R as RuntimeHooks } from './types-
|
|
4
|
+
import { L as LoopTokenUsage, R as RuntimeHooks } from './types-DWA64rbJ.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
@@ -494,4 +494,4 @@ interface WidenGate<Out> {
|
|
|
494
494
|
readonly judgeExempt?: boolean;
|
|
495
495
|
}
|
|
496
496
|
|
|
497
|
-
export type { Agent as A, Budget as B, ExecutorFactory as E, NodeId as N, Runtime as R, Scope as S, TreeView as T, UsageEvent as U, WidenGate as W, ResultBlobStore as a, SupervisedResult as b, Executor as c,
|
|
497
|
+
export type { Agent as A, Budget as B, ExecutorFactory as E, NodeId as N, Runtime as R, Scope as S, TreeView as T, UsageEvent as U, WidenGate as W, ResultBlobStore as a, SupervisedResult as b, Executor as c, AgentSpec as d, ExecutorRegistry as e, SpawnJournal as f, RootHandle as g, Settled as h, Spend as i, SpawnEvent as j, Supervisor as k, ExecutorContext as l, ExecutorResult as m, SupervisorOpts as n };
|
|
@@ -1308,4 +1308,4 @@ interface ExecCtx {
|
|
|
1308
1308
|
parentSpanId?: string;
|
|
1309
1309
|
}
|
|
1310
1310
|
|
|
1311
|
-
export { type
|
|
1311
|
+
export { type SelectionReceipt as $, type AgentRuntimeEvent as A, type BackendErrorDetail as B, type RuntimeHookErrorContext as C, type Driver as D, type ExecCtx as E, type RuntimeHookEvent as F, type RuntimeHookPhase as G, type RuntimeHookTarget as H, type Iteration as I, type RuntimeRunHandle as J, type KnowledgeReadinessDecision as K, type LoopTokenUsage as L, type RuntimeRunPersistenceAdapter as M, type RuntimeRunRow as N, type OpenAIChatTool as O, composeRuntimeHooks as P, defineRuntimeHooks as Q, type RuntimeHooks as R, type SandboxClient as S, notifyRuntimeDecisionPoint as T, notifyRuntimeHookEvent as U, type Validator as V, startRuntimeRun as W, type LoopWinner as X, type LoopLineageOptions as Y, type LoopResult as Z, type MountRecorder as _, type RuntimeStreamEvent as a, type LoopDecisionPayload as a0, type LoopEndedPayload as a1, type LoopIterationDispatchPayload as a2, type LoopIterationEndedPayload as a3, type LoopIterationStartedPayload as a4, type LoopPlanDescription as a5, type LoopPlanPayload as a6, type LoopStartedPayload as a7, type LoopTeardownFailedPayload as a8, type MountManifestEntry as a9, type RunProvenance as aa, type ValidationCtx as ab, type AgentTaskStatus as b, type OutputAdapter as c, type AgentRunSpec as d, type LoopSandboxPlacement as e, type LoopTraceEvent as f, type LoopTraceEmitter as g, type AgentBackendInput as h, type OpenAIChatToolChoice as i, type OpenAIChatResponseFormat as j, type AgentExecutionBackend as k, type AgentBackendContext as l, type RunAgentTaskOptions as m, type AgentTaskRunResult as n, type RunAgentTaskStreamOptions as o, type RuntimeSessionStore as p, type RuntimeSession as q, type AgentAdapter as r, type AgentKnowledgeProvider as s, type AgentRuntimeEventSink as t, type AgentTaskContext as u, type AgentTaskSpec as v, type RuntimeDecisionEvidenceRef as w, type RuntimeDecisionKind as x, type RuntimeDecisionPoint as y, type RuntimeHookContext as z };
|
|
@@ -1,11 +1,240 @@
|
|
|
1
1
|
import { AgentProfile } from '@tangle-network/agent-interface';
|
|
2
2
|
import { AnalystFinding, DefaultVerdict } from '@tangle-network/agent-eval';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { d as AgentSpec, e as ExecutorRegistry, B as Budget, A as Agent, f as SpawnJournal, a as ResultBlobStore, g as RootHandle, b as SupervisedResult, N as NodeId, h as Settled, i as Spend, S as Scope, c as Executor } from './types-Cg_teUPO.js';
|
|
4
|
+
import { R as RuntimeHooks, I as Iteration } from './types-DWA64rbJ.js';
|
|
5
5
|
import { BackendType } from '@tangle-network/sandbox';
|
|
6
|
-
import { W as WorktreeHarnessResult, G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './completion-gate-
|
|
6
|
+
import { W as WorktreeHarnessResult, G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './completion-gate-BDkEYB_-.js';
|
|
7
7
|
import { L as LocalHarness, r as runLocalHarness } from './local-harness-dcD5WTTr.js';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* The personify layer — the "act like X" knob on top of the recursive keystone.
|
|
12
|
+
*
|
|
13
|
+
* The keystone (`src/loops/supervise/`) is pure STRUCTURE: a recursive `Agent` atom inside
|
|
14
|
+
* a budget-conserving `Scope`, an `ExecutorRegistry` mapping an `AgentSpec` to a runtime,
|
|
15
|
+
* and a `Supervisor` that runs a root agent to a typed `SupervisedResult`. It carries no
|
|
16
|
+
* CONTENT — no model, no prompt, no goal framing, no notion of "who this loop is".
|
|
17
|
+
*
|
|
18
|
+
* This layer adds exactly that content seam without inventing a second engine:
|
|
19
|
+
* - A `Persona` is a thin record: the root `AgentSpec` (profile + harness + optional BYO
|
|
20
|
+
* executor), a root `directive` (the goal framing handed to the chosen shape), a
|
|
21
|
+
* `context` blob (who the loop is acting as), and the executor seams the registry needs.
|
|
22
|
+
* `definePersona` builds it; it is data, not behavior.
|
|
23
|
+
* - A `LoopShape` is a reusable act-body FACTORY: `(ctx: ShapeContext) => Agent`. The shape
|
|
24
|
+
* owns the STRUCTURE (how to decompose / fan out / verify / synthesize); the persona's
|
|
25
|
+
* content parameterizes it. A new shape is ONE file + one `registerShape` call.
|
|
26
|
+
* - `Outcome<D>` is the contract every shape synthesizes into: a finished deliverable OR a
|
|
27
|
+
* list of concrete blockers — "100% done or 100%-defined blockers", never a vague middle.
|
|
28
|
+
*
|
|
29
|
+
* Layering: this module imports ONLY keystone runtime types (`./supervise/types`) and the
|
|
30
|
+
* substrate `AgentProfile`/`BackendType`. It typechecks standalone — no impl, no engine.
|
|
31
|
+
* Extensibility is structural: `Persona` carries an open `extensions` bag so a later
|
|
32
|
+
* world-model / memory field is additive (a new optional key), never a breaking change.
|
|
33
|
+
*
|
|
34
|
+
* @experimental
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The terminal contract Drew wants: a loop returns a FINISHED deliverable, or the concrete
|
|
39
|
+
* list of blockers that stopped it — never a half-done best-effort coercion. A `blocked`
|
|
40
|
+
* outcome with an empty `blockers` list is a contract violation (a shape that can't finish
|
|
41
|
+
* MUST name why); impls fail loud on it rather than emitting a vacuous block.
|
|
42
|
+
*
|
|
43
|
+
* `Outcome` is the `Out` type a personified `Agent`/`Supervisor` is parameterized by, so the
|
|
44
|
+
* keystone's typed `SupervisedResult<Outcome<D>>` carries it end to end with no coercion.
|
|
45
|
+
*/
|
|
46
|
+
type Outcome<D> = {
|
|
47
|
+
kind: 'done';
|
|
48
|
+
deliverable: D;
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'blocked';
|
|
51
|
+
blockers: string[];
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* The "act like X" record. A thin composition over the keystone's `AgentSpec`: it pairs the
|
|
55
|
+
* root spec (the executor mapping for the root agent the shape builds) with the CONTENT a
|
|
56
|
+
* shape consumes — the goal framing (`directive`) and who the loop is acting as (`context`).
|
|
57
|
+
*
|
|
58
|
+
* The framework never reads `directive`/`context` semantically; it threads them to the shape
|
|
59
|
+
* verbatim through `ShapeContext`. This is the rule the mandate names: the FRAMEWORK is
|
|
60
|
+
* structure, the PERSONA carries model/prompt/tools/directive. No model name, prompt, or
|
|
61
|
+
* persona string is ever hardcoded in a shape or the engine.
|
|
62
|
+
*
|
|
63
|
+
* `D` is the deliverable type this persona's loops produce; it flows into `Outcome<D>`.
|
|
64
|
+
*/
|
|
65
|
+
interface Persona<D = unknown> {
|
|
66
|
+
/** Stable persona name — used as the trace/journal label root, never as content. */
|
|
67
|
+
readonly name: string;
|
|
68
|
+
/**
|
|
69
|
+
* The root agent's executor mapping (profile + harness + optional BYO executor). The
|
|
70
|
+
* shape's root `Agent` carries THIS as its `executorSpec`; child specs the shape spawns
|
|
71
|
+
* are derived from / resolved against the same persona registry (see `ShapeContext`).
|
|
72
|
+
*/
|
|
73
|
+
readonly root: AgentSpec;
|
|
74
|
+
/** The goal framing handed to the shape — the "what to achieve", not "how". */
|
|
75
|
+
readonly directive: string;
|
|
76
|
+
/** Who the loop is acting as — the opaque persona context blob the shape may inject into
|
|
77
|
+
* child tasks. Opaque to the framework; only the persona's profiles/prompts interpret it. */
|
|
78
|
+
readonly context: PersonaContext;
|
|
79
|
+
/**
|
|
80
|
+
* The executor seams (router endpoint+key, sandbox client, cli bin) the built-in runtimes
|
|
81
|
+
* read off `ExecutorContext.seams`, OR a fully pre-configured registry. The supervisor
|
|
82
|
+
* threads an EMPTY seam bag to the root scope, so a persona that uses built-in metered
|
|
83
|
+
* runtimes MUST supply a registry whose factories close over their seams (or BYO executors
|
|
84
|
+
* on each `AgentSpec`). Carried here so `runPersonified` can build `SupervisorOpts.executors`.
|
|
85
|
+
*/
|
|
86
|
+
readonly executors: PersonaExecutors;
|
|
87
|
+
/**
|
|
88
|
+
* Forward-compatible extension bag — a later world-model / memory / tool-budget field is an
|
|
89
|
+
* additive key here, never a breaking change to the `Persona` shape. Opaque to the engine.
|
|
90
|
+
*/
|
|
91
|
+
readonly extensions?: Readonly<Record<string, unknown>>;
|
|
92
|
+
/** Phantom: binds the persona to its deliverable type so `runPersonified` infers `D` from
|
|
93
|
+
* the persona and the chosen shape must agree. Type-only — never present at runtime. */
|
|
94
|
+
readonly __deliverable?: D;
|
|
95
|
+
}
|
|
96
|
+
/** The persona context blob — who the loop is acting as. Open by intent: a persona names its
|
|
97
|
+
* own role/audience/constraints; the framework treats it as opaque content. */
|
|
98
|
+
interface PersonaContext {
|
|
99
|
+
/** The role the loop embodies ("senior staff engineer", "equity research analyst", …). */
|
|
100
|
+
readonly role: string;
|
|
101
|
+
/** Optional freeform framing the persona's prompts/profiles consume. */
|
|
102
|
+
readonly notes?: string;
|
|
103
|
+
/** Open content bag — persona-specific fields a shape's child tasks may carry. */
|
|
104
|
+
readonly [key: string]: unknown;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* How a persona supplies executor resolution. Either a pre-built registry (factories already
|
|
108
|
+
* closed over their seams) OR the raw seam bag the engine uses to construct a registry +
|
|
109
|
+
* thread the seams onto each spawn. Exactly one is required — fail loud if neither is set.
|
|
110
|
+
*/
|
|
111
|
+
interface PersonaExecutors {
|
|
112
|
+
/** A registry whose factories already capture their seams. Highest precedence. */
|
|
113
|
+
readonly registry?: ExecutorRegistry;
|
|
114
|
+
/** Raw seams to thread onto built-in runtimes (`router`/`sandbox`/`cli` keys). */
|
|
115
|
+
readonly seams?: Readonly<Record<string, unknown>>;
|
|
116
|
+
}
|
|
117
|
+
/** The minimal input to build a `Persona`. Mirrors `Persona` but lets the builder default
|
|
118
|
+
* the executors-supplied invariant check and freeze the record. */
|
|
119
|
+
interface DefinePersonaInput<D = unknown> {
|
|
120
|
+
readonly name: string;
|
|
121
|
+
readonly root: AgentSpec;
|
|
122
|
+
readonly directive: string;
|
|
123
|
+
readonly context: PersonaContext;
|
|
124
|
+
readonly executors: PersonaExecutors;
|
|
125
|
+
readonly extensions?: Readonly<Record<string, unknown>>;
|
|
126
|
+
/** Phantom: pins the input's deliverable type so `definePersona<D>` returns a `Persona<D>`
|
|
127
|
+
* the caller's shape must agree with. Type-only — never supplied at a call site. */
|
|
128
|
+
readonly __deliverable?: D;
|
|
129
|
+
}
|
|
130
|
+
/** Builds a frozen `Persona`, failing loud on the executors-supplied invariant (neither a
|
|
131
|
+
* registry nor seams = an unresolvable persona). Pure — no I/O, no engine. */
|
|
132
|
+
type DefinePersona = <D = unknown>(input: DefinePersonaInput<D>) => Persona<D>;
|
|
133
|
+
/**
|
|
134
|
+
* Budget knobs a shape reads to size its fanout/children WITHOUT owning the conserved pool.
|
|
135
|
+
* The root budget lives on `SupervisorOpts.budget`; the shape only needs the per-child
|
|
136
|
+
* sizing hints + the fanout width it is allowed to open. All ceilings — the pool reserves
|
|
137
|
+
* against them and fails closed, so an over-eager shape can never overspend.
|
|
138
|
+
*/
|
|
139
|
+
interface ShapeBudget {
|
|
140
|
+
/** Per-child spawn budget the shape reserves for each leaf/sub-loop it opens. */
|
|
141
|
+
readonly perChild: Budget;
|
|
142
|
+
/** Max children a fanout step may open in one round (the shape's structural width). */
|
|
143
|
+
readonly fanout: number;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The construction context a `LoopShape` factory receives. Carries the persona's resolved
|
|
147
|
+
* executor seams + the budget knobs, plus the ONE helper a shape needs to spawn a child
|
|
148
|
+
* through the keystone: `spawnChild` resolves an `AgentSpec` (or a persona-derived child
|
|
149
|
+
* profile) into an `Agent` the shape hands to `scope.spawn`. The shape never touches the
|
|
150
|
+
* registry directly — it asks the context, keeping resolution single-sourced.
|
|
151
|
+
*/
|
|
152
|
+
interface ShapeContext<D = unknown> {
|
|
153
|
+
readonly persona: Persona<D>;
|
|
154
|
+
readonly budget: ShapeBudget;
|
|
155
|
+
/**
|
|
156
|
+
* Wrap an `AgentSpec` into a leaf `Agent` carrying it as `executorSpec`, so the shape can
|
|
157
|
+
* `scope.spawn(spawnChild(spec), task, opts)`. `name` labels the child for traces. The
|
|
158
|
+
* returned agent's `act` is never invoked by the keystone (it is spawned, not run) — the
|
|
159
|
+
* spec drives the resolved `Executor`; `act` exists only to satisfy the `Agent` shape.
|
|
160
|
+
*/
|
|
161
|
+
spawnChild(name: string, spec: AgentSpec): Agent<unknown, Outcome<D>>;
|
|
162
|
+
/** Derive a child `AgentSpec` from the persona's root spec with an overridden profile —
|
|
163
|
+
* the seam a shape uses to give a worker a narrower role/prompt than the root persona. */
|
|
164
|
+
childSpec(profile: AgentProfile, harness?: BackendType | null): AgentSpec;
|
|
165
|
+
/** The scope analyst (selector≠judge firewall) the combinator steers from. Absent ⇒ the
|
|
166
|
+
* dormant default (empty findings → gates read deliverables/state only). */
|
|
167
|
+
readonly analyst?: ScopeAnalyst<D>;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* A reusable act-body factory. Given the persona's content + seams (`ShapeContext`), it
|
|
171
|
+
* returns the root `Agent<Task, Outcome<D>>` whose `act` decomposes the task, fans out
|
|
172
|
+
* children through `scope.spawn`, verifies/selects across their settlements (selector≠judge:
|
|
173
|
+
* via `settledToIteration` + `defaultSelectWinner`, never re-ranking behind the driver), and
|
|
174
|
+
* synthesizes the terminal `Outcome<D>`. The shape is STRUCTURE; the persona is CONTENT.
|
|
175
|
+
*/
|
|
176
|
+
type LoopShape<Task, D> = (ctx: ShapeContext<D>) => Agent<Task, Outcome<D>>;
|
|
177
|
+
/**
|
|
178
|
+
* The open shape registry — the extension point that makes a new loop-shape ONE file + one
|
|
179
|
+
* `registerShape` call with zero edits elsewhere. `resolve` returns a typed outcome (inspect
|
|
180
|
+
* `succeeded` before `value`); `register` fails loud on a duplicate name.
|
|
181
|
+
*/
|
|
182
|
+
interface ShapeRegistry {
|
|
183
|
+
register<Task, D>(name: string, factory: LoopShape<Task, D>): void;
|
|
184
|
+
resolve<Task, D>(name: string): {
|
|
185
|
+
succeeded: true;
|
|
186
|
+
value: LoopShape<Task, D>;
|
|
187
|
+
} | {
|
|
188
|
+
succeeded: false;
|
|
189
|
+
error: string;
|
|
190
|
+
};
|
|
191
|
+
/** The registered shape names — for diagnostics + a fail-loud "unknown shape" message. */
|
|
192
|
+
names(): string[];
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* The end-to-end entrypoint. Builds the persona's root `Agent` from the chosen shape, then
|
|
196
|
+
* runs it through a fresh `createSupervisor` over the persona's executors + the supplied
|
|
197
|
+
* budget/journal/blobs. Returns the keystone's typed `SupervisedResult<Outcome<D>>` — a
|
|
198
|
+
* `winner` carries the synthesized `Outcome<D>`; a `no-winner` is never coerced into one.
|
|
199
|
+
*
|
|
200
|
+
* `shape` is either a resolved `LoopShape` or a registered shape NAME (resolved through the
|
|
201
|
+
* default registry). The journal/blobs default to in-memory impls in the engine when omitted
|
|
202
|
+
* (durable FS impls are passed explicitly for a persisted run).
|
|
203
|
+
*/
|
|
204
|
+
interface RunPersonifiedOptions<Task, D> {
|
|
205
|
+
readonly persona: Persona<D>;
|
|
206
|
+
/** A resolved shape factory OR a registered shape name. */
|
|
207
|
+
readonly shape: LoopShape<Task, D> | string;
|
|
208
|
+
readonly task: Task;
|
|
209
|
+
readonly budget: Budget;
|
|
210
|
+
/** Per-child sizing + fanout width handed to the shape. Defaults derive from `budget`. */
|
|
211
|
+
readonly shapeBudget?: Partial<ShapeBudget>;
|
|
212
|
+
/** Trace/journal root key. Defaults to the persona name + a run discriminator in the engine. */
|
|
213
|
+
readonly runId?: string;
|
|
214
|
+
readonly journal?: SpawnJournal;
|
|
215
|
+
readonly blobs?: ResultBlobStore;
|
|
216
|
+
/** Runtime recursion-depth ceiling, paired with the conserved pool. */
|
|
217
|
+
readonly maxDepth?: number;
|
|
218
|
+
/** OTP intensity breaker bounds, forwarded to the supervisor verbatim. */
|
|
219
|
+
readonly maxRestarts?: number;
|
|
220
|
+
readonly withinMs?: number;
|
|
221
|
+
/** A live root handle to attach (view/signal/abort) before the run starts. */
|
|
222
|
+
readonly handle?: RootHandle<Outcome<D>>;
|
|
223
|
+
readonly now?: () => number;
|
|
224
|
+
readonly signal?: AbortSignal;
|
|
225
|
+
/** Optional scope analyst threaded into the shape's ShapeContext so loopUntil/widen steer
|
|
226
|
+
* on trace-derived findings instead of the dormant empty default. */
|
|
227
|
+
readonly analyst?: ScopeAnalyst<D>;
|
|
228
|
+
/**
|
|
229
|
+
* Lifecycle stream sink, forwarded to `SupervisorOpts.hooks` so the root `Scope`'s
|
|
230
|
+
* `agent.spawn`/`agent.child` events flow to an observer (e.g. the Intelligence SDK's
|
|
231
|
+
* trace export). Absent ⇒ no stream (the run is silent, as today).
|
|
232
|
+
*/
|
|
233
|
+
readonly hooks?: RuntimeHooks;
|
|
234
|
+
}
|
|
235
|
+
/** The composed run signature. */
|
|
236
|
+
type RunPersonified = <Task, D>(options: RunPersonifiedOptions<Task, D>) => Promise<SupervisedResult<Outcome<D>>>;
|
|
237
|
+
|
|
9
238
|
/**
|
|
10
239
|
*
|
|
11
240
|
* The RSI-wave type surface — the FROZEN contracts the wave's Core + Compose build to.
|
|
@@ -538,235 +767,6 @@ interface EqualKOnCostOptions {
|
|
|
538
767
|
/** `equalKOnCost(arms, opts)` — the cross-arm equal-compute check on conserved cost. */
|
|
539
768
|
type EqualKOnCost = (arms: ReadonlyArray<EqualKArm>, options?: EqualKOnCostOptions) => EqualKVerdict;
|
|
540
769
|
|
|
541
|
-
/**
|
|
542
|
-
*
|
|
543
|
-
* The personify layer — the "act like X" knob on top of the recursive keystone.
|
|
544
|
-
*
|
|
545
|
-
* The keystone (`src/loops/supervise/`) is pure STRUCTURE: a recursive `Agent` atom inside
|
|
546
|
-
* a budget-conserving `Scope`, an `ExecutorRegistry` mapping an `AgentSpec` to a runtime,
|
|
547
|
-
* and a `Supervisor` that runs a root agent to a typed `SupervisedResult`. It carries no
|
|
548
|
-
* CONTENT — no model, no prompt, no goal framing, no notion of "who this loop is".
|
|
549
|
-
*
|
|
550
|
-
* This layer adds exactly that content seam without inventing a second engine:
|
|
551
|
-
* - A `Persona` is a thin record: the root `AgentSpec` (profile + harness + optional BYO
|
|
552
|
-
* executor), a root `directive` (the goal framing handed to the chosen shape), a
|
|
553
|
-
* `context` blob (who the loop is acting as), and the executor seams the registry needs.
|
|
554
|
-
* `definePersona` builds it; it is data, not behavior.
|
|
555
|
-
* - A `LoopShape` is a reusable act-body FACTORY: `(ctx: ShapeContext) => Agent`. The shape
|
|
556
|
-
* owns the STRUCTURE (how to decompose / fan out / verify / synthesize); the persona's
|
|
557
|
-
* content parameterizes it. A new shape is ONE file + one `registerShape` call.
|
|
558
|
-
* - `Outcome<D>` is the contract every shape synthesizes into: a finished deliverable OR a
|
|
559
|
-
* list of concrete blockers — "100% done or 100%-defined blockers", never a vague middle.
|
|
560
|
-
*
|
|
561
|
-
* Layering: this module imports ONLY keystone runtime types (`./supervise/types`) and the
|
|
562
|
-
* substrate `AgentProfile`/`BackendType`. It typechecks standalone — no impl, no engine.
|
|
563
|
-
* Extensibility is structural: `Persona` carries an open `extensions` bag so a later
|
|
564
|
-
* world-model / memory field is additive (a new optional key), never a breaking change.
|
|
565
|
-
*
|
|
566
|
-
* @experimental
|
|
567
|
-
*/
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
* The terminal contract Drew wants: a loop returns a FINISHED deliverable, or the concrete
|
|
571
|
-
* list of blockers that stopped it — never a half-done best-effort coercion. A `blocked`
|
|
572
|
-
* outcome with an empty `blockers` list is a contract violation (a shape that can't finish
|
|
573
|
-
* MUST name why); impls fail loud on it rather than emitting a vacuous block.
|
|
574
|
-
*
|
|
575
|
-
* `Outcome` is the `Out` type a personified `Agent`/`Supervisor` is parameterized by, so the
|
|
576
|
-
* keystone's typed `SupervisedResult<Outcome<D>>` carries it end to end with no coercion.
|
|
577
|
-
*/
|
|
578
|
-
type Outcome<D> = {
|
|
579
|
-
kind: 'done';
|
|
580
|
-
deliverable: D;
|
|
581
|
-
} | {
|
|
582
|
-
kind: 'blocked';
|
|
583
|
-
blockers: string[];
|
|
584
|
-
};
|
|
585
|
-
/**
|
|
586
|
-
* The "act like X" record. A thin composition over the keystone's `AgentSpec`: it pairs the
|
|
587
|
-
* root spec (the executor mapping for the root agent the shape builds) with the CONTENT a
|
|
588
|
-
* shape consumes — the goal framing (`directive`) and who the loop is acting as (`context`).
|
|
589
|
-
*
|
|
590
|
-
* The framework never reads `directive`/`context` semantically; it threads them to the shape
|
|
591
|
-
* verbatim through `ShapeContext`. This is the rule the mandate names: the FRAMEWORK is
|
|
592
|
-
* structure, the PERSONA carries model/prompt/tools/directive. No model name, prompt, or
|
|
593
|
-
* persona string is ever hardcoded in a shape or the engine.
|
|
594
|
-
*
|
|
595
|
-
* `D` is the deliverable type this persona's loops produce; it flows into `Outcome<D>`.
|
|
596
|
-
*/
|
|
597
|
-
interface Persona<D = unknown> {
|
|
598
|
-
/** Stable persona name — used as the trace/journal label root, never as content. */
|
|
599
|
-
readonly name: string;
|
|
600
|
-
/**
|
|
601
|
-
* The root agent's executor mapping (profile + harness + optional BYO executor). The
|
|
602
|
-
* shape's root `Agent` carries THIS as its `executorSpec`; child specs the shape spawns
|
|
603
|
-
* are derived from / resolved against the same persona registry (see `ShapeContext`).
|
|
604
|
-
*/
|
|
605
|
-
readonly root: AgentSpec;
|
|
606
|
-
/** The goal framing handed to the shape — the "what to achieve", not "how". */
|
|
607
|
-
readonly directive: string;
|
|
608
|
-
/** Who the loop is acting as — the opaque persona context blob the shape may inject into
|
|
609
|
-
* child tasks. Opaque to the framework; only the persona's profiles/prompts interpret it. */
|
|
610
|
-
readonly context: PersonaContext;
|
|
611
|
-
/**
|
|
612
|
-
* The executor seams (router endpoint+key, sandbox client, cli bin) the built-in runtimes
|
|
613
|
-
* read off `ExecutorContext.seams`, OR a fully pre-configured registry. The supervisor
|
|
614
|
-
* threads an EMPTY seam bag to the root scope, so a persona that uses built-in metered
|
|
615
|
-
* runtimes MUST supply a registry whose factories close over their seams (or BYO executors
|
|
616
|
-
* on each `AgentSpec`). Carried here so `runPersonified` can build `SupervisorOpts.executors`.
|
|
617
|
-
*/
|
|
618
|
-
readonly executors: PersonaExecutors;
|
|
619
|
-
/**
|
|
620
|
-
* Forward-compatible extension bag — a later world-model / memory / tool-budget field is an
|
|
621
|
-
* additive key here, never a breaking change to the `Persona` shape. Opaque to the engine.
|
|
622
|
-
*/
|
|
623
|
-
readonly extensions?: Readonly<Record<string, unknown>>;
|
|
624
|
-
/** Phantom: binds the persona to its deliverable type so `runPersonified` infers `D` from
|
|
625
|
-
* the persona and the chosen shape must agree. Type-only — never present at runtime. */
|
|
626
|
-
readonly __deliverable?: D;
|
|
627
|
-
}
|
|
628
|
-
/** The persona context blob — who the loop is acting as. Open by intent: a persona names its
|
|
629
|
-
* own role/audience/constraints; the framework treats it as opaque content. */
|
|
630
|
-
interface PersonaContext {
|
|
631
|
-
/** The role the loop embodies ("senior staff engineer", "equity research analyst", …). */
|
|
632
|
-
readonly role: string;
|
|
633
|
-
/** Optional freeform framing the persona's prompts/profiles consume. */
|
|
634
|
-
readonly notes?: string;
|
|
635
|
-
/** Open content bag — persona-specific fields a shape's child tasks may carry. */
|
|
636
|
-
readonly [key: string]: unknown;
|
|
637
|
-
}
|
|
638
|
-
/**
|
|
639
|
-
* How a persona supplies executor resolution. Either a pre-built registry (factories already
|
|
640
|
-
* closed over their seams) OR the raw seam bag the engine uses to construct a registry +
|
|
641
|
-
* thread the seams onto each spawn. Exactly one is required — fail loud if neither is set.
|
|
642
|
-
*/
|
|
643
|
-
interface PersonaExecutors {
|
|
644
|
-
/** A registry whose factories already capture their seams. Highest precedence. */
|
|
645
|
-
readonly registry?: ExecutorRegistry;
|
|
646
|
-
/** Raw seams to thread onto built-in runtimes (`router`/`sandbox`/`cli` keys). */
|
|
647
|
-
readonly seams?: Readonly<Record<string, unknown>>;
|
|
648
|
-
}
|
|
649
|
-
/** The minimal input to build a `Persona`. Mirrors `Persona` but lets the builder default
|
|
650
|
-
* the executors-supplied invariant check and freeze the record. */
|
|
651
|
-
interface DefinePersonaInput<D = unknown> {
|
|
652
|
-
readonly name: string;
|
|
653
|
-
readonly root: AgentSpec;
|
|
654
|
-
readonly directive: string;
|
|
655
|
-
readonly context: PersonaContext;
|
|
656
|
-
readonly executors: PersonaExecutors;
|
|
657
|
-
readonly extensions?: Readonly<Record<string, unknown>>;
|
|
658
|
-
/** Phantom: pins the input's deliverable type so `definePersona<D>` returns a `Persona<D>`
|
|
659
|
-
* the caller's shape must agree with. Type-only — never supplied at a call site. */
|
|
660
|
-
readonly __deliverable?: D;
|
|
661
|
-
}
|
|
662
|
-
/** Builds a frozen `Persona`, failing loud on the executors-supplied invariant (neither a
|
|
663
|
-
* registry nor seams = an unresolvable persona). Pure — no I/O, no engine. */
|
|
664
|
-
type DefinePersona = <D = unknown>(input: DefinePersonaInput<D>) => Persona<D>;
|
|
665
|
-
/**
|
|
666
|
-
* Budget knobs a shape reads to size its fanout/children WITHOUT owning the conserved pool.
|
|
667
|
-
* The root budget lives on `SupervisorOpts.budget`; the shape only needs the per-child
|
|
668
|
-
* sizing hints + the fanout width it is allowed to open. All ceilings — the pool reserves
|
|
669
|
-
* against them and fails closed, so an over-eager shape can never overspend.
|
|
670
|
-
*/
|
|
671
|
-
interface ShapeBudget {
|
|
672
|
-
/** Per-child spawn budget the shape reserves for each leaf/sub-loop it opens. */
|
|
673
|
-
readonly perChild: Budget;
|
|
674
|
-
/** Max children a fanout step may open in one round (the shape's structural width). */
|
|
675
|
-
readonly fanout: number;
|
|
676
|
-
}
|
|
677
|
-
/**
|
|
678
|
-
* The construction context a `LoopShape` factory receives. Carries the persona's resolved
|
|
679
|
-
* executor seams + the budget knobs, plus the ONE helper a shape needs to spawn a child
|
|
680
|
-
* through the keystone: `spawnChild` resolves an `AgentSpec` (or a persona-derived child
|
|
681
|
-
* profile) into an `Agent` the shape hands to `scope.spawn`. The shape never touches the
|
|
682
|
-
* registry directly — it asks the context, keeping resolution single-sourced.
|
|
683
|
-
*/
|
|
684
|
-
interface ShapeContext<D = unknown> {
|
|
685
|
-
readonly persona: Persona<D>;
|
|
686
|
-
readonly budget: ShapeBudget;
|
|
687
|
-
/**
|
|
688
|
-
* Wrap an `AgentSpec` into a leaf `Agent` carrying it as `executorSpec`, so the shape can
|
|
689
|
-
* `scope.spawn(spawnChild(spec), task, opts)`. `name` labels the child for traces. The
|
|
690
|
-
* returned agent's `act` is never invoked by the keystone (it is spawned, not run) — the
|
|
691
|
-
* spec drives the resolved `Executor`; `act` exists only to satisfy the `Agent` shape.
|
|
692
|
-
*/
|
|
693
|
-
spawnChild(name: string, spec: AgentSpec): Agent<unknown, Outcome<D>>;
|
|
694
|
-
/** Derive a child `AgentSpec` from the persona's root spec with an overridden profile —
|
|
695
|
-
* the seam a shape uses to give a worker a narrower role/prompt than the root persona. */
|
|
696
|
-
childSpec(profile: AgentProfile, harness?: BackendType | null): AgentSpec;
|
|
697
|
-
/** The scope analyst (selector≠judge firewall) the combinator steers from. Absent ⇒ the
|
|
698
|
-
* dormant default (empty findings → gates read deliverables/state only). */
|
|
699
|
-
readonly analyst?: ScopeAnalyst<D>;
|
|
700
|
-
}
|
|
701
|
-
/**
|
|
702
|
-
* A reusable act-body factory. Given the persona's content + seams (`ShapeContext`), it
|
|
703
|
-
* returns the root `Agent<Task, Outcome<D>>` whose `act` decomposes the task, fans out
|
|
704
|
-
* children through `scope.spawn`, verifies/selects across their settlements (selector≠judge:
|
|
705
|
-
* via `settledToIteration` + `defaultSelectWinner`, never re-ranking behind the driver), and
|
|
706
|
-
* synthesizes the terminal `Outcome<D>`. The shape is STRUCTURE; the persona is CONTENT.
|
|
707
|
-
*/
|
|
708
|
-
type LoopShape<Task, D> = (ctx: ShapeContext<D>) => Agent<Task, Outcome<D>>;
|
|
709
|
-
/**
|
|
710
|
-
* The open shape registry — the extension point that makes a new loop-shape ONE file + one
|
|
711
|
-
* `registerShape` call with zero edits elsewhere. `resolve` returns a typed outcome (inspect
|
|
712
|
-
* `succeeded` before `value`); `register` fails loud on a duplicate name.
|
|
713
|
-
*/
|
|
714
|
-
interface ShapeRegistry {
|
|
715
|
-
register<Task, D>(name: string, factory: LoopShape<Task, D>): void;
|
|
716
|
-
resolve<Task, D>(name: string): {
|
|
717
|
-
succeeded: true;
|
|
718
|
-
value: LoopShape<Task, D>;
|
|
719
|
-
} | {
|
|
720
|
-
succeeded: false;
|
|
721
|
-
error: string;
|
|
722
|
-
};
|
|
723
|
-
/** The registered shape names — for diagnostics + a fail-loud "unknown shape" message. */
|
|
724
|
-
names(): string[];
|
|
725
|
-
}
|
|
726
|
-
/**
|
|
727
|
-
* The end-to-end entrypoint. Builds the persona's root `Agent` from the chosen shape, then
|
|
728
|
-
* runs it through a fresh `createSupervisor` over the persona's executors + the supplied
|
|
729
|
-
* budget/journal/blobs. Returns the keystone's typed `SupervisedResult<Outcome<D>>` — a
|
|
730
|
-
* `winner` carries the synthesized `Outcome<D>`; a `no-winner` is never coerced into one.
|
|
731
|
-
*
|
|
732
|
-
* `shape` is either a resolved `LoopShape` or a registered shape NAME (resolved through the
|
|
733
|
-
* default registry). The journal/blobs default to in-memory impls in the engine when omitted
|
|
734
|
-
* (durable FS impls are passed explicitly for a persisted run).
|
|
735
|
-
*/
|
|
736
|
-
interface RunPersonifiedOptions<Task, D> {
|
|
737
|
-
readonly persona: Persona<D>;
|
|
738
|
-
/** A resolved shape factory OR a registered shape name. */
|
|
739
|
-
readonly shape: LoopShape<Task, D> | string;
|
|
740
|
-
readonly task: Task;
|
|
741
|
-
readonly budget: Budget;
|
|
742
|
-
/** Per-child sizing + fanout width handed to the shape. Defaults derive from `budget`. */
|
|
743
|
-
readonly shapeBudget?: Partial<ShapeBudget>;
|
|
744
|
-
/** Trace/journal root key. Defaults to the persona name + a run discriminator in the engine. */
|
|
745
|
-
readonly runId?: string;
|
|
746
|
-
readonly journal?: SpawnJournal;
|
|
747
|
-
readonly blobs?: ResultBlobStore;
|
|
748
|
-
/** Runtime recursion-depth ceiling, paired with the conserved pool. */
|
|
749
|
-
readonly maxDepth?: number;
|
|
750
|
-
/** OTP intensity breaker bounds, forwarded to the supervisor verbatim. */
|
|
751
|
-
readonly maxRestarts?: number;
|
|
752
|
-
readonly withinMs?: number;
|
|
753
|
-
/** A live root handle to attach (view/signal/abort) before the run starts. */
|
|
754
|
-
readonly handle?: RootHandle<Outcome<D>>;
|
|
755
|
-
readonly now?: () => number;
|
|
756
|
-
readonly signal?: AbortSignal;
|
|
757
|
-
/** Optional scope analyst threaded into the shape's ShapeContext so loopUntil/widen steer
|
|
758
|
-
* on trace-derived findings instead of the dormant empty default. */
|
|
759
|
-
readonly analyst?: ScopeAnalyst<D>;
|
|
760
|
-
/**
|
|
761
|
-
* Lifecycle stream sink, forwarded to `SupervisorOpts.hooks` so the root `Scope`'s
|
|
762
|
-
* `agent.spawn`/`agent.child` events flow to an observer (e.g. the Intelligence SDK's
|
|
763
|
-
* trace export). Absent ⇒ no stream (the run is silent, as today).
|
|
764
|
-
*/
|
|
765
|
-
readonly hooks?: RuntimeHooks;
|
|
766
|
-
}
|
|
767
|
-
/** The composed run signature. */
|
|
768
|
-
type RunPersonified = <Task, D>(options: RunPersonifiedOptions<Task, D>) => Promise<SupervisedResult<Outcome<D>>>;
|
|
769
|
-
|
|
770
770
|
/**
|
|
771
771
|
*
|
|
772
772
|
* The mechanical patch gate — the SINGLE source of the no-op / always-on secret-path floor /
|
|
@@ -975,4 +975,4 @@ interface WorktreeFanoutOptions extends PatchDeliverableOptions {
|
|
|
975
975
|
*/
|
|
976
976
|
declare function worktreeFanout<Task>(options: WorktreeFanoutOptions): CombinatorShape<Task, WorktreePatchArtifact>;
|
|
977
977
|
|
|
978
|
-
export { type Widen as $, type AuthoredHarness as A, type Panel as B, type
|
|
978
|
+
export { type Widen as $, type AuthoredHarness as A, type Panel as B, type CorpusRecord as C, type DefinePersonaInput as D, type EqualKArm as E, type FanoutOptions as F, type PanelJudge as G, type PanelVerdict as H, type PatchDeliverableOptions as I, type PersonaContext as J, type PersonaExecutors as K, type LoopUntilSpec as L, type Pipeline as M, type RenderCorpusToInstructions as N, type Outcome as O, type PanelSpec as P, type RunPersonified as Q, type RenderCorpusToInstructionsOptions as R, type ScopeAnalyzeInput as S, type TrajectoryReportOptions as T, type ShapeBudget as U, type VerifySpec as V, type WinnerStrategy as W, type ShapeContext as X, type TrajectoryNode as Y, type TrajectoryReportFn as Z, type Verify as _, type WorktreeFanoutOptions as a, type WidenDecision as a0, type WidenLineage as a1, type WorktreeCliExecutorOptions as a2, createWorktreeCliExecutor as a3, patchDelivered as a4, worktreeFanout as a5, type WorktreePatchArtifact as b, type Corpus as c, type AssertTraceDerivedFindings as d, type SteerContext as e, type ScopeAnalyst as f, type CombinatorShape as g, type ScopeWidenGate as h, type PipelineStage as i, type FanoutWinnerSelector as j, type WidenSpec as k, type CorpusFilter as l, type Persona as m, type RunPersonifiedOptions as n, type ShapeRegistry as o, type LoopShape as p, type EqualKOnCostOptions as q, type EqualKVerdict as r, type TrajectoryReport as s, type DefinePersona as t, type EqualKOnCost as u, type Fanout as v, type FanoutSynthesis as w, type FlatWidenGate as x, type LoopUntil as y, type LoopUntilState as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.94.0",
|
|
4
4
|
"description": "Shared task-lifecycle skeleton for agents: a recursive loop kernel for chat turns, one-shot tasks, and multi-attempt loops, with trace capture and eval-gated self-improvement. Domain behavior lives in adapters; scoring and ship-gates in @tangle-network/agent-eval.",
|
|
5
5
|
"homepage": "https://github.com/tangle-network/agent-runtime#readme",
|
|
6
6
|
"repository": {
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
106
|
"@biomejs/biome": "^2.4.15",
|
|
107
|
-
"@tangle-network/agent-eval": "^0.
|
|
107
|
+
"@tangle-network/agent-eval": "^0.115.1",
|
|
108
108
|
"@tangle-network/agent-interface": "^0.25.0",
|
|
109
109
|
"@tangle-network/sandbox": "^0.9.7",
|
|
110
110
|
"@types/node": "^25.9.3",
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
"license": "MIT",
|
|
135
135
|
"packageManager": "pnpm@10.28.0",
|
|
136
136
|
"peerDependencies": {
|
|
137
|
-
"@tangle-network/agent-eval": ">=0.
|
|
137
|
+
"@tangle-network/agent-eval": ">=0.115.1 <1.0.0",
|
|
138
138
|
"@tangle-network/agent-interface": ">=0.25.0 <1.0.0",
|
|
139
139
|
"@tangle-network/sandbox": ">=0.8.0 <1.0.0",
|
|
140
140
|
"playwright": "^1.40.0"
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
}
|
|
149
149
|
},
|
|
150
150
|
"dependencies": {
|
|
151
|
-
"@tangle-network/agent-knowledge": "^1.
|
|
151
|
+
"@tangle-network/agent-knowledge": "^1.12.1",
|
|
152
152
|
"@tangle-network/agent-profile-materialize": "0.3.2"
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -93,7 +93,7 @@ to its native default (`HARNESS_NATIVE_MODEL`) — never silently dropped.
|
|
|
93
93
|
| **Sandbox coding rollout** (fresh box/round, or persistent+resume) | `runLoop(options)` / `openSandboxRun(client, opts, deliverable)` — `/loops` | canonical-api §3.1 |
|
|
94
94
|
| **Optimize a CODE surface** in a gated loop | `improvementDriver({ worktree, generator })` — root `.` | canonical-api §3.4 |
|
|
95
95
|
| **Freeze a measured profile/diff + code surface for execution** | `buildAgentCandidateBundle(...)` then `verifyAgentCandidateBundle(...)` — `/candidate-execution` | canonical-api §2 |
|
|
96
|
-
| **Optimize any agent/code surface** (one call) — START HERE | `improve(profile, findings, { surface, gate })` — root `.`; prompt, skill-document, and curated-memory surfaces have built-in proposers, config/whole-profile surfaces accept a proposer,
|
|
96
|
+
| **Optimize any agent/code surface** (one call) — START HERE | `improve(profile, findings, { surface, gate })` — root `.`; prompt, skill-document, and curated-memory surfaces have built-in proposers, config/whole-profile surfaces accept a proposer, and code gets isolated incumbent/candidate worktrees. Workflow and rollout-policy files use code plus agent-eval's `parameterSweepProposer` for JSON sweeps; drop to `selfImprove({ agent, scenarios, judge, baselineSurface })` only for lower-level control | canonical-api §3.4 |
|
|
97
97
|
| **Gate: ship/hold a candidate** (campaign ctx) | `defaultProductionGate` / `heldOutGate` / `composeGate` — `agent-eval/contract`; `neutralizationGate` (footprint-matched PLACEBO gate — proves a held-out lift is CONTENT, not added prompt/mount footprint) — `agent-eval/campaign` | canonical-api §3.4 |
|
|
98
98
|
| **Gate: ship/hold from a `BenchmarkReport`** (per-task cells) | `promotionGate({ report, incumbent, candidate })` — `/loops` | canonical-api §3.4 |
|
|
99
99
|
| **Run the full multi-generation flywheel + certify** | `runStrategyEvolution(config)` — `/loops` | canonical-api §3.4 |
|