@tangle-network/agent-runtime 0.38.0 → 0.39.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/{chunk-Z523NPJK.js → chunk-7ZECSZ3C.js} +2 -59
- package/dist/chunk-7ZECSZ3C.js.map +1 -0
- package/dist/chunk-AXWGLYSF.js +201 -0
- package/dist/chunk-AXWGLYSF.js.map +1 -0
- package/dist/chunk-FNMGYYSS.js +60 -0
- package/dist/chunk-FNMGYYSS.js.map +1 -0
- package/dist/{chunk-V6GURW4W.js → chunk-HSX6PFZR.js} +1 -209
- package/dist/chunk-HSX6PFZR.js.map +1 -0
- package/dist/{chunk-M65QJD35.js → chunk-PK5DYSNO.js} +5 -3
- package/dist/{chunk-M65QJD35.js.map → chunk-PK5DYSNO.js.map} +1 -1
- package/dist/chunk-VLXRXMTF.js +212 -0
- package/dist/chunk-VLXRXMTF.js.map +1 -0
- package/dist/{dynamic-DeOPeeAw.d.ts → dynamic-DcrwVGuV.d.ts} +1 -1
- package/dist/improvement.d.ts +1 -1
- package/dist/index.d.ts +10 -147
- package/dist/index.js +23 -99
- package/dist/index.js.map +1 -1
- package/dist/{otel-export-CNmeg_7B.d.ts → kb-gate-YdPNEagq.d.ts} +2 -191
- package/dist/loop-runner-bin-DgZj0zfJ.d.ts +192 -0
- package/dist/loop-runner-bin.d.ts +12 -0
- package/dist/loop-runner-bin.js +19 -0
- package/dist/loop-runner-bin.js.map +1 -0
- package/dist/loops.d.ts +4 -4
- package/dist/mcp/bin.js +3 -2
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +5 -3
- package/dist/mcp/index.js +11 -7
- package/dist/mcp/index.js.map +1 -1
- package/dist/{optimize-prompt-cmH9wZdH.d.ts → optimize-prompt-D-urF2wW.d.ts} +1 -1
- package/dist/otel-export-xgf4J6bo.d.ts +191 -0
- package/dist/profiles.d.ts +1 -1
- package/dist/{types-CmkQl8qE.d.ts → types-B9O7l-ij.d.ts} +1 -1
- package/package.json +3 -2
- package/dist/chunk-V6GURW4W.js.map +0 -1
- package/dist/chunk-Z523NPJK.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,15 +2,15 @@ import { AgentEvalError, KnowledgeReadinessReport, RunRecord, ControlEvalResult,
|
|
|
2
2
|
export { AgentEvalError, AgentEvalErrorCode, ConfigError, ControlBudget, ControlDecision, ControlEvalResult, ControlRunResult, ControlStep, DataAcquisitionPlan, JudgeError, KnowledgeReadinessReport, KnowledgeRequirement, NotFoundError, RunRecord, ValidationError } from '@tangle-network/agent-eval';
|
|
3
3
|
import { a as AgentBackendInput, b as AgentExecutionBackend, O as OpenAIChatTool, c as OpenAIChatToolChoice, d as AgentBackendContext, R as RuntimeStreamEvent, K as KnowledgeReadinessDecision, e as RunAgentTaskOptions, f as AgentTaskRunResult, g as RunAgentTaskStreamOptions, h as AgentRuntimeEvent, i as AgentTaskStatus, j as RuntimeSessionStore, k as RuntimeSession } from './types-CsCCryln.js';
|
|
4
4
|
export { l as AgentAdapter, m as AgentKnowledgeProvider, n as AgentRuntimeEventSink, o as AgentTaskContext, A as AgentTaskSpec, B as BackendErrorDetail } from './types-CsCCryln.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
import
|
|
5
|
+
export { C as CoderLoopRunnerOptions, D as DELEGATED_LOOP_MODES, a as DelegatedLoopMode, b as DelegatedLoopRegistry, c as DelegatedLoopResult, d as DelegatedLoopRunner, e as DynamicLoopRunnerOptions, L as LoopRunnerCliArgs, f as LoopRunnerCliResult, R as ResearchLoopResult, g as ResearchLoopRunnerOptions, h as RunDelegatedLoopOptions, V as VetoedFact, i as auditLoopRunner, j as coderLoopRunner, k as dynamicLoopRunner, l as isDelegatedLoopMode, p as parseLoopRunnerArgv, r as researchLoopRunner, m as reviewLoopRunner, n as runDelegatedLoop, o as runLoopRunnerCli, s as selfImproveLoopRunner } from './loop-runner-bin-DgZj0zfJ.js';
|
|
6
|
+
export { E as EvalRunEvent, b as EvalRunGeneration, c as EvalRunsExportConfig, d as EvalRunsExportResult, I as INTELLIGENCE_WIRE_VERSION, e as OtelAttribute, f as OtelExportConfig, O as OtelExporter, g as OtelSpan, h as buildLoopOtelSpans, i as createOtelExporter, j as exportEvalRuns, l as loopEventToOtelSpan, m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from './otel-export-xgf4J6bo.js';
|
|
7
|
+
export { R as RuntimeRunHandle, p as RuntimeRunPersistenceAdapter, q as RuntimeRunRow, s as startRuntimeRun } from './types-B9O7l-ij.js';
|
|
8
|
+
import '@tangle-network/agent-eval/campaign';
|
|
9
|
+
import './types-p8dWBIXL.js';
|
|
10
|
+
import './optimize-prompt-D-urF2wW.js';
|
|
11
|
+
import './dynamic-DcrwVGuV.js';
|
|
12
|
+
import './kb-gate-YdPNEagq.js';
|
|
13
|
+
import './profiles.js';
|
|
14
14
|
import '@tangle-network/sandbox';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -1015,143 +1015,6 @@ declare class PlannerError extends AgentEvalError {
|
|
|
1015
1015
|
});
|
|
1016
1016
|
}
|
|
1017
1017
|
|
|
1018
|
-
/**
|
|
1019
|
-
* @experimental
|
|
1020
|
-
*
|
|
1021
|
-
* `runDelegatedLoop` — the configured delegated loop-runner.
|
|
1022
|
-
*
|
|
1023
|
-
* One typed entrypoint a worker agent (or a scheduled routine) calls to run a
|
|
1024
|
-
* disciplined loop in a chosen MODE, over agent-runtime's hardened engines:
|
|
1025
|
-
*
|
|
1026
|
-
* code → build-in-a-loop via the coder delegate (no-op + secret floor,
|
|
1027
|
-
* optional reviewer gate, winner-selection)
|
|
1028
|
-
* review → code mode with a REQUIRED reviewer (the gate is the point)
|
|
1029
|
-
* research → research-in-a-loop with valid-only KB growth (createKbGate)
|
|
1030
|
-
* audit → analyze trace/run data → findings (runAnalystLoop, caller-wired)
|
|
1031
|
-
* self-improve → identity-gated prompt optimization (optimizePrompt, caller-wired)
|
|
1032
|
-
* dynamic → agent-authored topology (runLoop + createDynamicDriver)
|
|
1033
|
-
*
|
|
1034
|
-
* It is intentionally a thin façade: the value is that EVERY product reuses the
|
|
1035
|
-
* one hardened engine instead of forking delegation logic. The dispatcher owns
|
|
1036
|
-
* mode routing, timing, fail-loud on an unregistered mode, and a uniform result
|
|
1037
|
-
* shape; each mode's engine is a pre-configured runner in the registry (build it
|
|
1038
|
-
* with the factories below, or inject your own / a stub).
|
|
1039
|
-
*/
|
|
1040
|
-
|
|
1041
|
-
/** @experimental */
|
|
1042
|
-
type DelegatedLoopMode = 'code' | 'review' | 'research' | 'audit' | 'self-improve' | 'dynamic';
|
|
1043
|
-
/** @experimental A pre-configured loop for one mode. Returns the mode's raw
|
|
1044
|
-
* output; the dispatcher wraps it in a {@link DelegatedLoopResult}. */
|
|
1045
|
-
type DelegatedLoopRunner<T = unknown> = (signal: AbortSignal) => Promise<T>;
|
|
1046
|
-
/** @experimental Mode → configured runner. Partial: only register the modes a
|
|
1047
|
-
* given product/routine actually uses. */
|
|
1048
|
-
type DelegatedLoopRegistry = Partial<Record<DelegatedLoopMode, DelegatedLoopRunner>>;
|
|
1049
|
-
/** @experimental Uniform result — never throws from a registered runner; a
|
|
1050
|
-
* thrown engine becomes `{ ok: false, error }` so a routine can record + move on. */
|
|
1051
|
-
interface DelegatedLoopResult<T = unknown> {
|
|
1052
|
-
mode: DelegatedLoopMode;
|
|
1053
|
-
ok: boolean;
|
|
1054
|
-
output?: T;
|
|
1055
|
-
error?: string;
|
|
1056
|
-
durationMs: number;
|
|
1057
|
-
}
|
|
1058
|
-
/** @experimental */
|
|
1059
|
-
interface RunDelegatedLoopOptions {
|
|
1060
|
-
signal?: AbortSignal;
|
|
1061
|
-
/** Clock override for deterministic tests. */
|
|
1062
|
-
now?: () => number;
|
|
1063
|
-
}
|
|
1064
|
-
/**
|
|
1065
|
-
* @experimental
|
|
1066
|
-
*
|
|
1067
|
-
* Dispatch a configured loop by mode. Fails loud (throws `ConfigError`) when no
|
|
1068
|
-
* runner is registered for the mode — a routine pointed at an unwired mode is a
|
|
1069
|
-
* config bug, not a silent no-op. A runner that throws is captured as
|
|
1070
|
-
* `{ ok: false }` so unattended runs record the failure rather than crash.
|
|
1071
|
-
*/
|
|
1072
|
-
declare function runDelegatedLoop<T = unknown>(mode: DelegatedLoopMode, registry: DelegatedLoopRegistry, options?: RunDelegatedLoopOptions): Promise<DelegatedLoopResult<T>>;
|
|
1073
|
-
/** @experimental Options for the default `code`/`review` runner. */
|
|
1074
|
-
interface CoderLoopRunnerOptions {
|
|
1075
|
-
sandboxClient: LoopSandboxClient;
|
|
1076
|
-
/** What to build — the delegate args (goal, repoRoot, variants, config, …). */
|
|
1077
|
-
args: DelegateCodeArgs;
|
|
1078
|
-
/** Adversarial reviewer. REQUIRED for `review` mode (see `reviewLoopRunner`). */
|
|
1079
|
-
reviewer?: CoderReviewer;
|
|
1080
|
-
/** Winner-selection strategy. Default `highest-score`. */
|
|
1081
|
-
winnerSelection?: CoderWinnerSelection;
|
|
1082
|
-
/** Harnesses for `variants > 1` fanout. */
|
|
1083
|
-
fanoutHarnesses?: string[];
|
|
1084
|
-
}
|
|
1085
|
-
/** @experimental Build a `code`-mode runner over the hardened coder delegate. */
|
|
1086
|
-
declare function coderLoopRunner(options: CoderLoopRunnerOptions): DelegatedLoopRunner<CoderOutput>;
|
|
1087
|
-
/**
|
|
1088
|
-
* @experimental
|
|
1089
|
-
*
|
|
1090
|
-
* `review` mode = `code` with a REQUIRED reviewer. The gate is the whole point,
|
|
1091
|
-
* so the type forces a reviewer (a "review loop" with no reviewer is a code loop).
|
|
1092
|
-
*/
|
|
1093
|
-
declare function reviewLoopRunner(options: CoderLoopRunnerOptions & {
|
|
1094
|
-
reviewer: CoderReviewer;
|
|
1095
|
-
}): DelegatedLoopRunner<CoderOutput>;
|
|
1096
|
-
/** @experimental Options for the default `dynamic` runner. */
|
|
1097
|
-
interface DynamicLoopRunnerOptions<Task, Output> {
|
|
1098
|
-
sandboxClient: LoopSandboxClient;
|
|
1099
|
-
/** The agent-authored topology planner (e.g. `createSandboxPlanner(...)`). */
|
|
1100
|
-
planner: TopologyPlanner<Task, Output>;
|
|
1101
|
-
task: Task;
|
|
1102
|
-
output: OutputAdapter<Output>;
|
|
1103
|
-
validator?: Validator<Output>;
|
|
1104
|
-
/** Exactly one of `agentRun` / `agentRuns` (runLoop validates). */
|
|
1105
|
-
agentRun?: AgentRunSpec<Task>;
|
|
1106
|
-
agentRuns?: AgentRunSpec<Task>[];
|
|
1107
|
-
maxIterations?: number;
|
|
1108
|
-
maxFanout?: number;
|
|
1109
|
-
}
|
|
1110
|
-
/** @experimental `dynamic` mode — agent-authored topology over `runLoop`. */
|
|
1111
|
-
declare function dynamicLoopRunner<Task, Output>(o: DynamicLoopRunnerOptions<Task, Output>): DelegatedLoopRunner<LoopResult<Task, Output, DynamicDecision>>;
|
|
1112
|
-
/** @experimental A fact rejected at the KB gate — surfaced, never dropped. */
|
|
1113
|
-
interface VetoedFact {
|
|
1114
|
-
candidate: FactCandidate;
|
|
1115
|
-
vetoedBy?: string;
|
|
1116
|
-
reason?: string;
|
|
1117
|
-
}
|
|
1118
|
-
/** @experimental */
|
|
1119
|
-
interface ResearchLoopResult {
|
|
1120
|
-
/** Facts that passed the fail-closed gate — safe to write to the KB. */
|
|
1121
|
-
accepted: FactCandidate[];
|
|
1122
|
-
/** Facts the gate vetoed in the final round — escalate, do not silently drop. */
|
|
1123
|
-
vetoed: VetoedFact[];
|
|
1124
|
-
/** Research rounds actually run. */
|
|
1125
|
-
rounds: number;
|
|
1126
|
-
}
|
|
1127
|
-
/** @experimental Options for the default `research` runner. */
|
|
1128
|
-
interface ResearchLoopRunnerOptions {
|
|
1129
|
-
/**
|
|
1130
|
-
* The research engine (the consumer's web/doc searcher + extractor). Called
|
|
1131
|
-
* each round with the prior round's vetoes so it can re-research the gaps.
|
|
1132
|
-
* Returns fact candidates carrying their grounding (`verbatimPassage` +
|
|
1133
|
-
* `sourceText`).
|
|
1134
|
-
*/
|
|
1135
|
-
research: (round: number, vetoed: VetoedFact[]) => Promise<FactCandidate[]>;
|
|
1136
|
-
/** Gate config (extra judges, self-artifact kinds, …). The floor is always on. */
|
|
1137
|
-
gate?: CreateKbGateOptions;
|
|
1138
|
-
/** Max research rounds (correct-on-veto remediation). Default 1. */
|
|
1139
|
-
maxRounds?: number;
|
|
1140
|
-
}
|
|
1141
|
-
/**
|
|
1142
|
-
* @experimental `research` mode — research-in-a-loop with valid-only KB growth.
|
|
1143
|
-
*
|
|
1144
|
-
* Each round: research → gate every candidate (fail-closed; passage MUST be in
|
|
1145
|
-
* the source) → accept the clean ones → re-research the vetoed ones next round,
|
|
1146
|
-
* up to `maxRounds`. Vetoed facts in the final round are RETURNED (escalate,
|
|
1147
|
-
* never silently dropped) so the caller audits vs retries.
|
|
1148
|
-
*/
|
|
1149
|
-
declare function researchLoopRunner(o: ResearchLoopRunnerOptions): DelegatedLoopRunner<ResearchLoopResult>;
|
|
1150
|
-
/** @experimental `self-improve` mode — identity-gated prompt optimization. */
|
|
1151
|
-
declare function selfImproveLoopRunner<TScenario extends Scenario, TArtifact>(options: OptimizePromptOptions<TScenario, TArtifact>): DelegatedLoopRunner<OptimizePromptResult<TArtifact, TScenario>>;
|
|
1152
|
-
/** @experimental `audit` mode — analyst loop over captured trace/run data. */
|
|
1153
|
-
declare function auditLoopRunner<TProposal = unknown, TEdit = unknown>(options: RunAnalystLoopOpts): DelegatedLoopRunner<RunAnalystLoopResult<TProposal, TEdit>>;
|
|
1154
|
-
|
|
1155
1018
|
/**
|
|
1156
1019
|
* @stable
|
|
1157
1020
|
*
|
|
@@ -1433,4 +1296,4 @@ declare function readinessServerSentEvent(report: KnowledgeReadinessReport, opti
|
|
|
1433
1296
|
/** @stable */
|
|
1434
1297
|
declare function runtimeStreamServerSentEvent(event: RuntimeStreamEvent, options?: RuntimeTelemetryOptions & ServerSentEventOptions): string;
|
|
1435
1298
|
|
|
1436
|
-
export { AgentBackendContext, AgentBackendInput, AgentExecutionBackend, AgentRuntimeEvent, AgentTaskRunResult, AgentTaskStatus, type AuthSource, type BackendCallPolicy, BackendTransportError, type ChatStreamEvent, type ChatTurnHooks, type ChatTurnIdentity, type ChatTurnProducer, type ChatTurnResult, type CircuitBreakerConfig, CircuitBreakerState, CircuitOpenError, type
|
|
1299
|
+
export { AgentBackendContext, AgentBackendInput, AgentExecutionBackend, AgentRuntimeEvent, AgentTaskRunResult, AgentTaskStatus, type AuthSource, type BackendCallPolicy, BackendTransportError, type ChatStreamEvent, type ChatTurnHooks, type ChatTurnIdentity, type ChatTurnProducer, type ChatTurnResult, type CircuitBreakerConfig, CircuitBreakerState, CircuitOpenError, type Conversation, type ConversationDriveState, type ConversationJournal, type ConversationJournalEntry, type ConversationParticipant, type ConversationPolicy, type ConversationResult, type ConversationStreamEvent, type ConversationTurn, type D1DatabaseLike, type D1StmtLike, DEFAULT_MAX_DEPTH, DEFAULT_ROUTER_BASE_URL, DeadlineExceededError, FORWARD_HEADERS, FileConversationJournal, type ForwardHeaderName, type HaltContext, type HaltPredicate, type HaltReason, type HaltSignal, InMemoryConversationJournal, InMemoryRuntimeSessionStore, type ModelInfo, OpenAIChatTool, OpenAIChatToolChoice, PlannerError, type PropagatedHeaders, type ResolvedChatModel, type RetryBackoff, type RetryableErrorPredicate, type RouterEnv, type RunChatTurnInput, type RunConversationOptions, type RuntimeEventCollector, RuntimeRunStateError, RuntimeSessionStore, RuntimeStreamEvent, type RuntimeStreamEventCollector, type RuntimeTelemetryOptions, type SanitizedKnowledgeReadinessReport, type SqlAdapter, SqlConversationJournal, type TurnOrder, applyRunRecordDefaults, buildForwardHeaders, cleanModelId, computeBackoff, createConversationBackend, createIterableBackend, createOpenAICompatibleBackend, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, d1ToSqlAdapter, decideKnowledgeReadiness, defaultIsRetryable, defineConversation, deriveExecutionId, getModels, handleChatTurn, isDepthExceeded, makePerAttemptSignal, readDepth, readinessServerSentEvent, resolveChatModel, resolveRouterBaseUrl, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runtimeStreamServerSentEvent, sanitizeAgentRuntimeEvent, sanitizeKnowledgeReadinessReport, sanitizeRuntimeStreamEvent, sleep, slugifySpeaker, turnId, validateChatModelId };
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
DELEGATED_LOOP_MODES,
|
|
3
|
+
auditLoopRunner,
|
|
4
|
+
coderLoopRunner,
|
|
5
|
+
dynamicLoopRunner,
|
|
6
|
+
isDelegatedLoopMode,
|
|
7
|
+
parseLoopRunnerArgv,
|
|
8
|
+
researchLoopRunner,
|
|
9
|
+
reviewLoopRunner,
|
|
10
|
+
runDelegatedLoop,
|
|
11
|
+
runLoopRunnerCli,
|
|
12
|
+
selfImproveLoopRunner
|
|
13
|
+
} from "./chunk-AXWGLYSF.js";
|
|
14
|
+
import "./chunk-XBUG326M.js";
|
|
15
|
+
import "./chunk-VOX6Z3II.js";
|
|
7
16
|
import {
|
|
8
17
|
INTELLIGENCE_WIRE_VERSION,
|
|
9
18
|
buildLoopOtelSpans,
|
|
10
|
-
createKbGate,
|
|
11
19
|
createOtelExporter,
|
|
12
20
|
exportEvalRuns,
|
|
13
21
|
loopEventToOtelSpan,
|
|
14
22
|
mcpToolsForRuntimeMcp,
|
|
15
23
|
mcpToolsForRuntimeMcpSubset
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import
|
|
21
|
-
createDynamicDriver,
|
|
22
|
-
runLoop
|
|
23
|
-
} from "./chunk-7JBDJQLO.js";
|
|
24
|
+
} from "./chunk-7ZECSZ3C.js";
|
|
25
|
+
import "./chunk-HSX6PFZR.js";
|
|
26
|
+
import "./chunk-FNMGYYSS.js";
|
|
27
|
+
import "./chunk-VLXRXMTF.js";
|
|
28
|
+
import "./chunk-7JBDJQLO.js";
|
|
24
29
|
import "./chunk-3HMHSN22.js";
|
|
25
30
|
import "./chunk-PY6NMZYX.js";
|
|
26
31
|
import {
|
|
@@ -1739,91 +1744,6 @@ function deriveExecutionId(input) {
|
|
|
1739
1744
|
return `${input.projectId}:${input.sessionId}:${input.turnIndex}`;
|
|
1740
1745
|
}
|
|
1741
1746
|
|
|
1742
|
-
// src/loop-runner.ts
|
|
1743
|
-
async function runDelegatedLoop(mode, registry, options = {}) {
|
|
1744
|
-
const runner = registry[mode];
|
|
1745
|
-
if (!runner) {
|
|
1746
|
-
throw new ConfigError(
|
|
1747
|
-
`runDelegatedLoop: no runner registered for mode '${mode}' (registered: ${Object.keys(registry).join(", ") || "none"})`
|
|
1748
|
-
);
|
|
1749
|
-
}
|
|
1750
|
-
const now = options.now ?? Date.now;
|
|
1751
|
-
const signal = options.signal ?? new AbortController().signal;
|
|
1752
|
-
const start = now();
|
|
1753
|
-
try {
|
|
1754
|
-
const output = await runner(signal);
|
|
1755
|
-
return { mode, ok: true, output, durationMs: now() - start };
|
|
1756
|
-
} catch (err) {
|
|
1757
|
-
return {
|
|
1758
|
-
mode,
|
|
1759
|
-
ok: false,
|
|
1760
|
-
error: err instanceof Error ? err.message : String(err),
|
|
1761
|
-
durationMs: now() - start
|
|
1762
|
-
};
|
|
1763
|
-
}
|
|
1764
|
-
}
|
|
1765
|
-
function coderLoopRunner(options) {
|
|
1766
|
-
const delegate = createDefaultCoderDelegate({
|
|
1767
|
-
sandboxClient: options.sandboxClient,
|
|
1768
|
-
...options.reviewer ? { reviewer: options.reviewer } : {},
|
|
1769
|
-
...options.winnerSelection ? { winnerSelection: options.winnerSelection } : {},
|
|
1770
|
-
...options.fanoutHarnesses ? { fanoutHarnesses: options.fanoutHarnesses } : {}
|
|
1771
|
-
});
|
|
1772
|
-
return async (signal) => {
|
|
1773
|
-
const ctx = { signal, report: () => {
|
|
1774
|
-
} };
|
|
1775
|
-
return delegate(options.args, ctx);
|
|
1776
|
-
};
|
|
1777
|
-
}
|
|
1778
|
-
function reviewLoopRunner(options) {
|
|
1779
|
-
return coderLoopRunner(options);
|
|
1780
|
-
}
|
|
1781
|
-
function dynamicLoopRunner(o) {
|
|
1782
|
-
return async (signal) => runLoop({
|
|
1783
|
-
driver: createDynamicDriver({
|
|
1784
|
-
planner: o.planner,
|
|
1785
|
-
...o.maxIterations !== void 0 ? { maxIterations: o.maxIterations } : {},
|
|
1786
|
-
...o.maxFanout !== void 0 ? { maxFanout: o.maxFanout } : {}
|
|
1787
|
-
}),
|
|
1788
|
-
...o.agentRun ? { agentRun: o.agentRun } : {},
|
|
1789
|
-
...o.agentRuns ? { agentRuns: o.agentRuns } : {},
|
|
1790
|
-
output: o.output,
|
|
1791
|
-
...o.validator ? { validator: o.validator } : {},
|
|
1792
|
-
task: o.task,
|
|
1793
|
-
ctx: { sandboxClient: o.sandboxClient, signal },
|
|
1794
|
-
...o.maxIterations !== void 0 ? { maxIterations: o.maxIterations } : {}
|
|
1795
|
-
});
|
|
1796
|
-
}
|
|
1797
|
-
function researchLoopRunner(o) {
|
|
1798
|
-
const gate = createKbGate(o.gate);
|
|
1799
|
-
const maxRounds = Math.max(1, Math.trunc(o.maxRounds ?? 1));
|
|
1800
|
-
return async (signal) => {
|
|
1801
|
-
const accepted = [];
|
|
1802
|
-
let vetoed = [];
|
|
1803
|
-
let rounds = 0;
|
|
1804
|
-
for (let round = 0; round < maxRounds; round += 1) {
|
|
1805
|
-
if (signal.aborted) break;
|
|
1806
|
-
rounds += 1;
|
|
1807
|
-
const candidates = await o.research(round, vetoed);
|
|
1808
|
-
if (candidates.length === 0) break;
|
|
1809
|
-
vetoed = [];
|
|
1810
|
-
for (const c of candidates) {
|
|
1811
|
-
const v = await gate(c);
|
|
1812
|
-
if (v.accepted) accepted.push(c);
|
|
1813
|
-
else vetoed.push({ candidate: c, vetoedBy: v.vetoedBy, reason: v.reason });
|
|
1814
|
-
}
|
|
1815
|
-
if (vetoed.length === 0) break;
|
|
1816
|
-
}
|
|
1817
|
-
return { accepted, vetoed, rounds };
|
|
1818
|
-
};
|
|
1819
|
-
}
|
|
1820
|
-
function selfImproveLoopRunner(options) {
|
|
1821
|
-
return async () => optimizePrompt(options);
|
|
1822
|
-
}
|
|
1823
|
-
function auditLoopRunner(options) {
|
|
1824
|
-
return async () => runAnalystLoop(options);
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
1747
|
// src/model-resolution.ts
|
|
1828
1748
|
var DEFAULT_ROUTER_BASE_URL = "https://router.tangle.tools";
|
|
1829
1749
|
function resolveRouterBaseUrl(env = {}) {
|
|
@@ -2816,6 +2736,7 @@ export {
|
|
|
2816
2736
|
ConfigError,
|
|
2817
2737
|
DEFAULT_MAX_DEPTH,
|
|
2818
2738
|
DEFAULT_ROUTER_BASE_URL,
|
|
2739
|
+
DELEGATED_LOOP_MODES,
|
|
2819
2740
|
DeadlineExceededError,
|
|
2820
2741
|
FORWARD_HEADERS,
|
|
2821
2742
|
FileConversationJournal,
|
|
@@ -2851,11 +2772,13 @@ export {
|
|
|
2851
2772
|
exportEvalRuns,
|
|
2852
2773
|
getModels,
|
|
2853
2774
|
handleChatTurn,
|
|
2775
|
+
isDelegatedLoopMode,
|
|
2854
2776
|
isDepthExceeded,
|
|
2855
2777
|
loopEventToOtelSpan,
|
|
2856
2778
|
makePerAttemptSignal,
|
|
2857
2779
|
mcpToolsForRuntimeMcp,
|
|
2858
2780
|
mcpToolsForRuntimeMcpSubset,
|
|
2781
|
+
parseLoopRunnerArgv,
|
|
2859
2782
|
readDepth,
|
|
2860
2783
|
readinessServerSentEvent,
|
|
2861
2784
|
researchLoopRunner,
|
|
@@ -2867,6 +2790,7 @@ export {
|
|
|
2867
2790
|
runConversation,
|
|
2868
2791
|
runConversationStream,
|
|
2869
2792
|
runDelegatedLoop,
|
|
2793
|
+
runLoopRunnerCli,
|
|
2870
2794
|
runtimeStreamServerSentEvent,
|
|
2871
2795
|
sanitizeAgentRuntimeEvent,
|
|
2872
2796
|
sanitizeKnowledgeReadinessReport,
|