@tangle-network/agent-runtime 0.342.1 → 0.343.2
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/{activation-DOH7Fnyp.js → activation-BMjalBNv.js} +4 -4
- package/dist/{activation-DOH7Fnyp.js.map → activation-BMjalBNv.js.map} +1 -1
- package/dist/{activation-CXqtijue.d.ts → activation-NJiV0MHb.d.ts} +2 -2
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +3 -3
- package/dist/{bundle-Cwpit6Tg.js → bundle-DKQtOO9d.js} +2 -2
- package/dist/{bundle-Cwpit6Tg.js.map → bundle-DKQtOO9d.js.map} +1 -1
- package/dist/candidate-execution/index.js +4 -4
- package/dist/{coordination-manager-HQE0bIav.js → coordination-manager-DIC19cgD.js} +22 -314
- package/dist/coordination-manager-DIC19cgD.js.map +1 -0
- package/dist/{delegate-DmShSdjy.js → delegate-BWXq1BeR.js} +2 -2
- package/dist/{delegate-DmShSdjy.js.map → delegate-BWXq1BeR.js.map} +1 -1
- package/dist/{durable-file-gNI9ILAn.js → durable-file-CA0kr1Pi.js} +8 -3
- package/dist/durable-file-CA0kr1Pi.js.map +1 -0
- package/dist/durable.d.ts +2 -2
- package/dist/durable.js +153 -16
- package/dist/durable.js.map +1 -1
- package/dist/{graph-BCghJFlS.js → graph-B89lApkU.js} +4 -4
- package/dist/{graph-BCghJFlS.js.map → graph-B89lApkU.js.map} +1 -1
- package/dist/{improve-Dga6OYt-.js → improve-CII-AhGN.js} +7 -8
- package/dist/{improve-Dga6OYt-.js.map → improve-CII-AhGN.js.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +6 -6
- package/dist/kernel.d.ts +1 -1
- package/dist/kernel.js +10 -11
- package/dist/{loop-runner-CW87Vqoj.js → loop-runner-Bbk9It72.js} +2 -2
- package/dist/{loop-runner-CW87Vqoj.js.map → loop-runner-Bbk9It72.js.map} +1 -1
- package/dist/{loop-runner-CuhbgVGo.d.ts → loop-runner-D56Rpd2z.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +6 -6
- package/dist/mcp/index.js.map +1 -1
- package/dist/platform.js +1 -1
- package/dist/platform.js.map +1 -1
- package/dist/{prepare-C-cWCyt3.js → prepare-TEEHSJwq.js} +3 -3
- package/dist/{prepare-C-cWCyt3.js.map → prepare-TEEHSJwq.js.map} +1 -1
- package/dist/{profile-CbMw5hAn.js → profile-6OLpbjvV.js} +2 -2
- package/dist/{profile-CbMw5hAn.js.map → profile-6OLpbjvV.js.map} +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/profiles.js +1 -1
- package/dist/profiles.js.map +1 -1
- package/dist/{provision-supervisor-BWR_TJFg.js → provision-supervisor-it-VCGyZ.js} +6 -6
- package/dist/{provision-supervisor-BWR_TJFg.js.map → provision-supervisor-it-VCGyZ.js.map} +1 -1
- package/dist/{run-cancellation-C9oL62sW.js → run-cancellation-DSpwvFmQ.js} +8 -4
- package/dist/{run-cancellation-C9oL62sW.js.map → run-cancellation-DSpwvFmQ.js.map} +1 -1
- package/dist/{runtime-CuRTZFe6.js → runtime-fKVK1rVb.js} +15 -17
- package/dist/{runtime-CuRTZFe6.js.map → runtime-fKVK1rVb.js.map} +1 -1
- package/dist/{sandbox-profile-compat-FN2kab2-.js → sandbox-profile-compat-_fEtHPCj.js} +2 -2
- package/dist/sandbox-profile-compat-_fEtHPCj.js.map +1 -0
- package/dist/{search-executor-0-SjHAao.js → search-executor-Ymr-tAKJ.js} +3 -3
- package/dist/{search-executor-0-SjHAao.js.map → search-executor-Ymr-tAKJ.js.map} +1 -1
- package/dist/{server-DTUK2wW1.js → server-BngfDubR.js} +4 -4
- package/dist/{server-DTUK2wW1.js.map → server-BngfDubR.js.map} +1 -1
- package/dist/{structural-rollout-kfaZgAkd.js → structural-rollout-BmKAIWWR.js} +3 -3
- package/dist/{structural-rollout-kfaZgAkd.js.map → structural-rollout-BmKAIWWR.js.map} +1 -1
- package/dist/{supervise-C_GAgiJU.js → supervise-DyCUu8Io.js} +415 -107
- package/dist/supervise-DyCUu8Io.js.map +1 -0
- package/dist/{supervisor-C_03z693.js → supervisor-gDn4C1o5.js} +627 -27
- package/dist/supervisor-gDn4C1o5.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +13 -13
- package/dist/{top-snapshot-CbZE1JsU.js → top-snapshot-OjHdhai1.js} +2 -2
- package/dist/{top-snapshot-CbZE1JsU.js.map → top-snapshot-OjHdhai1.js.map} +1 -1
- package/dist/tui/bin.js +5 -3
- package/dist/tui/bin.js.map +1 -1
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +2 -2
- package/dist/{types-Cgs89PQd.d.ts → types-D0ZRqIJh.d.ts} +131 -17
- package/package.json +6 -6
- package/dist/content-digest-sBTLujlK.js +0 -9
- package/dist/content-digest-sBTLujlK.js.map +0 -1
- package/dist/coordination-manager-HQE0bIav.js.map +0 -1
- package/dist/durable-file-gNI9ILAn.js.map +0 -1
- package/dist/graph-registry-BnO64cn8.js +0 -197
- package/dist/graph-registry-BnO64cn8.js.map +0 -1
- package/dist/jsonl-file-C9Kde_0Z.js +0 -206
- package/dist/jsonl-file-C9Kde_0Z.js.map +0 -1
- package/dist/record-value-B6bwJxLa.js +0 -12
- package/dist/record-value-B6bwJxLa.js.map +0 -1
- package/dist/sandbox-profile-compat-FN2kab2-.js.map +0 -1
- package/dist/supervise-C_GAgiJU.js.map +0 -1
- package/dist/supervisor-C_03z693.js.map +0 -1
|
@@ -1,319 +1,11 @@
|
|
|
1
|
-
import { Ai as assertValidBudget,
|
|
2
|
-
import { t as
|
|
3
|
-
import { a as readCommittedJsonLines, t as appendCommittedJsonLine } from "./jsonl-file-C9Kde_0Z.js";
|
|
4
|
-
import { S as writeWorkerSteerAcknowledgement, b as writeWorkerCancellation, c as claimWorkerSteerDelivery, d as readWorkerCancelRequests, f as readWorkerCancellation, i as readRunCancellation, m as readWorkerSteerRequests, o as writeRunCancellation, p as readWorkerSteerAcknowledgement, r as readRunCancelRequest, t as applyRunCancellation } from "./run-cancellation-C9oL62sW.js";
|
|
1
|
+
import { Ai as detachedFrozen, Bi as assertValidBudget, C as FileSpawnJournal, Gn as isTerminalNodeStatus, In as createPeerMailbox, M as runtimeGraphMetadataKey, Mi as contentAddress, Pi as errMessage, Ui as resolveRedactor, Wn as isLiveNodeStatus, _t as readCommittedJsonLines, ar as CheckUnavailableError, d as withDriverExecutor, dt as InMemorySpawnJournal, fr as checkVerdictOf, ft as FileResultBlobStore, g as workerTraceAnalysisStore, h as parseWorkerToolTraceArtifact, kn as INBOX_RECEIPT_KEY, mr as failedItems, pt as appendCommittedJsonLine, q as resolveSpawnResourcePaths, ut as InMemoryResultBlobStore, xt as createExecutorRegistry, yi as settlementFailureCause, z as meterRuntimeOwnedAccounting } from "./supervisor-gDn4C1o5.js";
|
|
2
|
+
import { C as writeWorkerCancellation, T as writeWorkerSteerAcknowledgement, c as writeRunCancellation, g as readWorkerSteerRequests, h as readWorkerSteerAcknowledgement, i as readRunCancellation, m as readWorkerCancellation, p as readWorkerCancelRequests, r as readRunCancelRequest, t as applyRunCancellation, u as claimWorkerSteerDelivery } from "./run-cancellation-DSpwvFmQ.js";
|
|
5
3
|
import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest } from "@tangle-network/agent-interface";
|
|
6
4
|
import { argHash, errorStreakDetector, observeAll, repeatedActionDetector } from "@tangle-network/agent-eval";
|
|
7
5
|
import { registry } from "zod";
|
|
8
|
-
import {
|
|
6
|
+
import { randomUUID } from "node:crypto";
|
|
9
7
|
import { readFileSync } from "node:fs";
|
|
10
|
-
import {
|
|
11
|
-
import { open, realpath, stat } from "node:fs/promises";
|
|
12
|
-
//#region src/mcp/tools/spawn-resource-paths.ts
|
|
13
|
-
/**
|
|
14
|
-
* Inline resources a manager hands a child by PATH instead of by content.
|
|
15
|
-
*
|
|
16
|
-
* The canonical profile schema knows two resource kinds, `inline` (a content string) and `github`.
|
|
17
|
-
* A manager that wants a child to receive a data file therefore had one way to do it: emit the
|
|
18
|
-
* bytes inside its own `spawn` tool call. That is a transcription by a language model, and it does
|
|
19
|
-
* not survive size. Measured 2026-09-12 (discovery-lab `mech-interp-foundations-glm2-b-20260912b`):
|
|
20
|
-
* a 29,144-character base64 payload on the manager's disk reached three children as 15,928
|
|
21
|
-
* characters with 11 substitutions, and a fourth child received the literal placeholder the
|
|
22
|
-
* manager meant to replace. Seven blind-check attempts across two runs delivered no data.
|
|
23
|
-
*
|
|
24
|
-
* `{ kind: 'inline', name, path }` lets the coordination server be the transport: it reads the
|
|
25
|
-
* file from the manager's workspace, fills `content`, and the profile that reaches the schema,
|
|
26
|
-
* the journal, and the provider is an ordinary inline resource. Nothing downstream changes; the
|
|
27
|
-
* model's output stops carrying the bytes.
|
|
28
|
-
*
|
|
29
|
-
* Where the bytes come from is a {@link SpawnResourceReader}, and there are two:
|
|
30
|
-
* - a HOST DIRECTORY, for a manager whose driver runs on this host (a loopback bridge with a
|
|
31
|
-
* `cwd`), read through the descriptor-identity checks below;
|
|
32
|
-
* - the manager's OWN EXECUTION ENVIRONMENT, for a manager inside a provider sandbox, read
|
|
33
|
-
* through the environment's `read()`. The coordination server cannot see a sandbox filesystem,
|
|
34
|
-
* but the provider that created the sandbox can, and it is already in hand.
|
|
35
|
-
*
|
|
36
|
-
* The second reader exists because the first one's absence was not a refusal a manager could
|
|
37
|
-
* work around. Measured 2026-09-17 (discovery-lab `mech-interp-foundations-sandbox-a-20260917h`):
|
|
38
|
-
* a sandbox-rooted director, refused by path, fell back to emitting its files as content and got
|
|
39
|
-
* 5 characters wrong in 24,008, destroying 3 of 7 files including its instrument and both
|
|
40
|
-
* drivers. At that rate 20 KB of mounts all arrive intact about 2% of the time, and gzip makes it
|
|
41
|
-
* worse by turning one wrong character into total loss. Four consecutive runs in that lane lost
|
|
42
|
-
* their research children to this. There is no encoding that fixes a transcription channel; the
|
|
43
|
-
* only fix is a channel with no model in it.
|
|
44
|
-
*
|
|
45
|
-
* Fail-closed rules, each with the reason a manager needs to fix its call:
|
|
46
|
-
* - no reader available → refused (neither a host directory nor an environment with `read`)
|
|
47
|
-
* - absolute path or `..` escape → refused by both readers; a symlink that resolves outside the
|
|
48
|
-
* root → refused by the host reader (the environment reader delegates containment to the
|
|
49
|
-
* provider, which serves only the sandbox's own workspace)
|
|
50
|
-
* - not a regular file → refused
|
|
51
|
-
* - over {@link SPAWN_RESOURCE_PATH_MAX_BYTES} → refused naming the bound
|
|
52
|
-
* - bytes that are not valid UTF-8 → refused; `content` is a string, so binary data is encoded
|
|
53
|
-
* (base64) by the manager first, exactly as it would be for a content resource
|
|
54
|
-
*/
|
|
55
|
-
const SPAWN_RESOURCE_PATH_MAX_BYTES = 4 * 1024 * 1024;
|
|
56
|
-
/** The host-directory reader: a manager whose workspace is a directory this process can open. */
|
|
57
|
-
function hostDirectoryReader(root) {
|
|
58
|
-
return {
|
|
59
|
-
describe: `workspace root ${root}`,
|
|
60
|
-
read: (requested) => readUnderRoot(root, requested)
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* The environment reader: a manager running inside a provider environment whose `read()` serves
|
|
65
|
-
* its own workspace. The provider owns containment — it will not serve a path outside the box —
|
|
66
|
-
* but the relative-path and `..` rules are enforced here too, so the refusal names the rule the
|
|
67
|
-
* manager broke rather than whatever the provider says about an escape it declined.
|
|
68
|
-
*
|
|
69
|
-
* `read()` returns a string, so an environment cannot hand back bytes that are not UTF-8; the
|
|
70
|
-
* provider has already decoded. The size bound is checked on what arrives.
|
|
71
|
-
*/
|
|
72
|
-
function environmentReader(environment) {
|
|
73
|
-
return {
|
|
74
|
-
describe: `environment ${environment.id}`,
|
|
75
|
-
async read(requested) {
|
|
76
|
-
if (requested.length === 0) return {
|
|
77
|
-
ok: false,
|
|
78
|
-
reason: "path is empty"
|
|
79
|
-
};
|
|
80
|
-
if (isAbsolute(requested)) return {
|
|
81
|
-
ok: false,
|
|
82
|
-
reason: `path must be relative to the manager's workspace, not absolute (${requested})`
|
|
83
|
-
};
|
|
84
|
-
if (requested.split(/[\\/]/u).includes("..")) return {
|
|
85
|
-
ok: false,
|
|
86
|
-
reason: `path ${requested} leaves the manager's workspace`
|
|
87
|
-
};
|
|
88
|
-
let content;
|
|
89
|
-
try {
|
|
90
|
-
content = await environment.read(requested);
|
|
91
|
-
} catch (error) {
|
|
92
|
-
return {
|
|
93
|
-
ok: false,
|
|
94
|
-
reason: `path ${requested}: ${describe(error)} (read from environment ${environment.id})`
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
const bytes = Buffer.from(content, "utf8");
|
|
98
|
-
if (bytes.length > 4194304) return {
|
|
99
|
-
ok: false,
|
|
100
|
-
reason: `path ${requested} is ${bytes.length} bytes; an inline resource is at most ${SPAWN_RESOURCE_PATH_MAX_BYTES} bytes`
|
|
101
|
-
};
|
|
102
|
-
return {
|
|
103
|
-
ok: true,
|
|
104
|
-
content,
|
|
105
|
-
byteLength: bytes.length,
|
|
106
|
-
sha256: createHash("sha256").update(bytes).digest("hex")
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
/** An inline ref that names a path and carries no content. Anything else is left untouched so the
|
|
112
|
-
* canonical schema keeps its verdict on it. */
|
|
113
|
-
function pathInlineRef(value) {
|
|
114
|
-
if (!isRecord(value)) return void 0;
|
|
115
|
-
if (value.kind !== "inline" || value.content !== void 0) return void 0;
|
|
116
|
-
if (typeof value.path !== "string" || typeof value.name !== "string") return void 0;
|
|
117
|
-
return {
|
|
118
|
-
kind: "inline",
|
|
119
|
-
name: value.name,
|
|
120
|
-
path: value.path
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
async function readUnderRoot(root, requested) {
|
|
124
|
-
if (requested.length === 0) return {
|
|
125
|
-
ok: false,
|
|
126
|
-
reason: "path is empty"
|
|
127
|
-
};
|
|
128
|
-
if (isAbsolute(requested)) return {
|
|
129
|
-
ok: false,
|
|
130
|
-
reason: `path must be relative to the workspace root, not absolute (${requested})`
|
|
131
|
-
};
|
|
132
|
-
const rootReal = await realpath(root).catch(() => void 0);
|
|
133
|
-
if (rootReal === void 0) return {
|
|
134
|
-
ok: false,
|
|
135
|
-
reason: `workspace root ${root} does not exist`
|
|
136
|
-
};
|
|
137
|
-
const candidate = resolve(rootReal, requested);
|
|
138
|
-
if (!inside(rootReal, candidate)) return {
|
|
139
|
-
ok: false,
|
|
140
|
-
reason: `path ${requested} leaves the workspace root`
|
|
141
|
-
};
|
|
142
|
-
let handle;
|
|
143
|
-
try {
|
|
144
|
-
handle = await open(candidate, "r");
|
|
145
|
-
} catch (error) {
|
|
146
|
-
return {
|
|
147
|
-
ok: false,
|
|
148
|
-
reason: `path ${requested}: ${describe(error)}`
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
try {
|
|
152
|
-
const info = await handle.stat();
|
|
153
|
-
if (!info.isFile()) return {
|
|
154
|
-
ok: false,
|
|
155
|
-
reason: `path ${requested} is not a regular file`
|
|
156
|
-
};
|
|
157
|
-
const real = await realpath(candidate).catch(() => void 0);
|
|
158
|
-
if (real === void 0 || !inside(rootReal, real)) return {
|
|
159
|
-
ok: false,
|
|
160
|
-
reason: `path ${requested} resolves outside the workspace root`
|
|
161
|
-
};
|
|
162
|
-
const named = await stat(real).catch(() => void 0);
|
|
163
|
-
if (named === void 0 || named.dev !== info.dev || named.ino !== info.ino) return {
|
|
164
|
-
ok: false,
|
|
165
|
-
reason: `path ${requested} changed while it was being read; retry the spawn`
|
|
166
|
-
};
|
|
167
|
-
if (info.size > 4194304) return {
|
|
168
|
-
ok: false,
|
|
169
|
-
reason: `path ${requested} is ${info.size} bytes; an inline resource is at most ${SPAWN_RESOURCE_PATH_MAX_BYTES} bytes`
|
|
170
|
-
};
|
|
171
|
-
const bytes = await handle.readFile();
|
|
172
|
-
if (bytes.length > 4194304) return {
|
|
173
|
-
ok: false,
|
|
174
|
-
reason: `path ${requested} is ${bytes.length} bytes; an inline resource is at most ${SPAWN_RESOURCE_PATH_MAX_BYTES} bytes`
|
|
175
|
-
};
|
|
176
|
-
const content = bytes.toString("utf8");
|
|
177
|
-
if (!Buffer.from(content, "utf8").equals(bytes)) return {
|
|
178
|
-
ok: false,
|
|
179
|
-
reason: `path ${requested} is not valid UTF-8; encode binary data (base64) before handing it to a child`
|
|
180
|
-
};
|
|
181
|
-
return {
|
|
182
|
-
ok: true,
|
|
183
|
-
content,
|
|
184
|
-
byteLength: bytes.length,
|
|
185
|
-
sha256: createHash("sha256").update(bytes).digest("hex")
|
|
186
|
-
};
|
|
187
|
-
} catch (error) {
|
|
188
|
-
return {
|
|
189
|
-
ok: false,
|
|
190
|
-
reason: `path ${requested}: ${describe(error)}`
|
|
191
|
-
};
|
|
192
|
-
} finally {
|
|
193
|
-
await handle.close().catch(() => void 0);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
/** `target` is `rootReal` itself or strictly below it; both must already be absolute. */
|
|
197
|
-
function inside(rootReal, target) {
|
|
198
|
-
const rel = relative(rootReal, target);
|
|
199
|
-
return rel !== "" && !rel.startsWith(`..${sep}`) && rel !== ".." && !isAbsolute(rel);
|
|
200
|
-
}
|
|
201
|
-
function describe(error) {
|
|
202
|
-
const code = error?.code;
|
|
203
|
-
if (code === "ENOENT") return "does not exist under the workspace root";
|
|
204
|
-
if (code === "EACCES" || code === "EPERM") return "is not readable by the runtime process";
|
|
205
|
-
if (code === "EISDIR") return "is not a regular file";
|
|
206
|
-
return error instanceof Error ? error.message : String(error);
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Replace every `{ kind: 'inline', name, path }` under `profile.resources` with the inline
|
|
210
|
-
* resource its bytes make. Returns the profile unchanged (same reference) when nothing names a
|
|
211
|
-
* path, so callers pay nothing on the common case.
|
|
212
|
-
*
|
|
213
|
-
* `source` is a host directory (a string, kept for the existing call sites), a
|
|
214
|
-
* {@link SpawnResourceReader}, or `undefined` when the manager has neither — in which case a path
|
|
215
|
-
* is refused with the reason and what to do instead.
|
|
216
|
-
*/
|
|
217
|
-
async function resolveSpawnResourcePaths(profile, source) {
|
|
218
|
-
if (!isRecord(profile) || !isRecord(profile.resources)) return {
|
|
219
|
-
ok: true,
|
|
220
|
-
profile,
|
|
221
|
-
resolved: []
|
|
222
|
-
};
|
|
223
|
-
const reader = typeof source === "string" ? hostDirectoryReader(source) : source;
|
|
224
|
-
const resources = profile.resources;
|
|
225
|
-
const resolved = [];
|
|
226
|
-
let touched = false;
|
|
227
|
-
const next = { ...resources };
|
|
228
|
-
const substitute = async (at, ref) => {
|
|
229
|
-
if (reader === void 0) return { error: "this manager has no workspace root the coordination server may read (no host directory and no environment with read), so a resource by path cannot be resolved; pass content, or a github resource" };
|
|
230
|
-
const read = await reader.read(ref.path);
|
|
231
|
-
if (!read.ok) return { error: read.reason };
|
|
232
|
-
resolved.push({
|
|
233
|
-
at,
|
|
234
|
-
path: ref.path,
|
|
235
|
-
byteLength: read.byteLength,
|
|
236
|
-
sha256: read.sha256
|
|
237
|
-
});
|
|
238
|
-
touched = true;
|
|
239
|
-
return {
|
|
240
|
-
kind: "inline",
|
|
241
|
-
name: ref.name,
|
|
242
|
-
content: read.content
|
|
243
|
-
};
|
|
244
|
-
};
|
|
245
|
-
for (const list of [
|
|
246
|
-
"tools",
|
|
247
|
-
"skills",
|
|
248
|
-
"agents"
|
|
249
|
-
]) {
|
|
250
|
-
const entries = resources[list];
|
|
251
|
-
if (!Array.isArray(entries)) continue;
|
|
252
|
-
const out = [];
|
|
253
|
-
for (const [index, entry] of entries.entries()) {
|
|
254
|
-
const ref = pathInlineRef(entry);
|
|
255
|
-
if (ref === void 0) {
|
|
256
|
-
out.push(entry);
|
|
257
|
-
continue;
|
|
258
|
-
}
|
|
259
|
-
const at = `${list}[${index}]`;
|
|
260
|
-
const replaced = await substitute(at, ref);
|
|
261
|
-
if ("error" in replaced) return {
|
|
262
|
-
ok: false,
|
|
263
|
-
at,
|
|
264
|
-
reason: replaced.error
|
|
265
|
-
};
|
|
266
|
-
out.push(replaced);
|
|
267
|
-
}
|
|
268
|
-
next[list] = out;
|
|
269
|
-
}
|
|
270
|
-
if (Array.isArray(resources.files)) {
|
|
271
|
-
const out = [];
|
|
272
|
-
for (const [index, mount] of resources.files.entries()) {
|
|
273
|
-
const ref = isRecord(mount) ? pathInlineRef(mount.resource) : void 0;
|
|
274
|
-
if (ref === void 0 || !isRecord(mount)) {
|
|
275
|
-
out.push(mount);
|
|
276
|
-
continue;
|
|
277
|
-
}
|
|
278
|
-
const at = `files[${index}].resource`;
|
|
279
|
-
const replaced = await substitute(at, ref);
|
|
280
|
-
if ("error" in replaced) return {
|
|
281
|
-
ok: false,
|
|
282
|
-
at,
|
|
283
|
-
reason: replaced.error
|
|
284
|
-
};
|
|
285
|
-
out.push({
|
|
286
|
-
...mount,
|
|
287
|
-
resource: replaced
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
next.files = out;
|
|
291
|
-
}
|
|
292
|
-
const instructions = pathInlineRef(resources.instructions);
|
|
293
|
-
if (instructions !== void 0) {
|
|
294
|
-
const replaced = await substitute("instructions", instructions);
|
|
295
|
-
if ("error" in replaced) return {
|
|
296
|
-
ok: false,
|
|
297
|
-
at: "instructions",
|
|
298
|
-
reason: replaced.error
|
|
299
|
-
};
|
|
300
|
-
next.instructions = replaced;
|
|
301
|
-
}
|
|
302
|
-
if (!touched) return {
|
|
303
|
-
ok: true,
|
|
304
|
-
profile,
|
|
305
|
-
resolved: []
|
|
306
|
-
};
|
|
307
|
-
return {
|
|
308
|
-
ok: true,
|
|
309
|
-
profile: {
|
|
310
|
-
...profile,
|
|
311
|
-
resources: next
|
|
312
|
-
},
|
|
313
|
-
resolved
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
//#endregion
|
|
8
|
+
import { join } from "node:path";
|
|
317
9
|
//#region src/runtime/supervise/coordination-log.ts
|
|
318
10
|
/**
|
|
319
11
|
* Durable side-log for coordination evidence the spawn journal does not own: questions, analyst
|
|
@@ -5746,6 +5438,22 @@ function managerSurface(parts, tools) {
|
|
|
5746
5438
|
awaitWake: waiting.awaitWake,
|
|
5747
5439
|
awaitSettlement: waiting.awaitSettlement,
|
|
5748
5440
|
receiveLeadMessage: intake.receiveLeadMessage,
|
|
5441
|
+
queuedLeadMessages: () => bus.queued(["lead-message"]).map((record) => record.seq),
|
|
5442
|
+
awaitLeadMessage: (signal) => new Promise((resolve) => {
|
|
5443
|
+
if (signal.aborted) {
|
|
5444
|
+
resolve();
|
|
5445
|
+
return;
|
|
5446
|
+
}
|
|
5447
|
+
const done = () => {
|
|
5448
|
+
unsubscribe();
|
|
5449
|
+
signal.removeEventListener("abort", done);
|
|
5450
|
+
resolve();
|
|
5451
|
+
};
|
|
5452
|
+
const unsubscribe = bus.onQueued((record) => {
|
|
5453
|
+
if (record.event.type === "lead-message") done();
|
|
5454
|
+
});
|
|
5455
|
+
signal.addEventListener("abort", done, { once: true });
|
|
5456
|
+
}),
|
|
5749
5457
|
openToolReceipt: intake.openToolReceipt,
|
|
5750
5458
|
settleToolReceipt: intake.settleToolReceipt,
|
|
5751
5459
|
reentryState: () => managerReentryState({
|
|
@@ -5900,6 +5608,6 @@ function createResumeReplay({ opts, bus, ledger, analysis, projectSettled }) {
|
|
|
5900
5608
|
};
|
|
5901
5609
|
}
|
|
5902
5610
|
//#endregion
|
|
5903
|
-
export {
|
|
5611
|
+
export { createEventBus as a, budgetOverspendText as c, safeJsonText as d, createFileRunContext as f, foldCoordinationRecords as g, FileCoordinationLog as h, watchTrace as i, normalizeAnalyzeOnSettle as l, withRunContext as m, createCoordinationToolsForManager as n, createCancelAcknowledger as o, createInMemoryRunContext as p, defaultToolDetectors as r, createSteerAcknowledger as s, createCoordinationTools as t, coordinationVerbNames as u };
|
|
5904
5612
|
|
|
5905
|
-
//# sourceMappingURL=coordination-manager-
|
|
5613
|
+
//# sourceMappingURL=coordination-manager-DIC19cgD.js.map
|