@dougbots/avenor-core 0.16.0 → 0.17.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/index.d.ts +28 -3
- package/dist/index.js +71 -24
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -207,6 +207,12 @@ interface MessagePeer {
|
|
|
207
207
|
interface MessagePeersResult {
|
|
208
208
|
peers: MessagePeer[];
|
|
209
209
|
generation?: string;
|
|
210
|
+
/**
|
|
211
|
+
* Set when the listing read only part of the peer set. The peers beside it
|
|
212
|
+
* are the ones that were read, so a partial list is never read as a
|
|
213
|
+
* complete one.
|
|
214
|
+
*/
|
|
215
|
+
peers_error?: string;
|
|
210
216
|
}
|
|
211
217
|
interface MessagePreflightResult {
|
|
212
218
|
protocol: number;
|
|
@@ -248,6 +254,18 @@ declare class RpcError extends Error {
|
|
|
248
254
|
readonly data?: unknown;
|
|
249
255
|
constructor(code: number, message: string, data?: unknown);
|
|
250
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* A transport failure that marks the control client closed: a send refused
|
|
259
|
+
* because the socket is already closed, a pending call rejected because the
|
|
260
|
+
* read side closed, or a socket write failure. A peer's structured rejection
|
|
261
|
+
* (RpcError) or a call timeout do not close the client and are not classified
|
|
262
|
+
* here.
|
|
263
|
+
*/
|
|
264
|
+
declare class ClosedSocketError extends Error {
|
|
265
|
+
constructor(message: string);
|
|
266
|
+
}
|
|
267
|
+
/** True when the error is a transport failure that closed the client. */
|
|
268
|
+
declare function isClosedSocketError(error: unknown): boolean;
|
|
251
269
|
type OwnerAuthFailureKind = 'unauthenticated' | 'unsupported' | 'timeout';
|
|
252
270
|
/** A classified owner-authentication rejection, not generic transport failure. */
|
|
253
271
|
declare class OwnerAuthError extends Error {
|
|
@@ -1130,6 +1148,7 @@ interface PendingAsk {
|
|
|
1130
1148
|
from_run_id: string;
|
|
1131
1149
|
message_id: string;
|
|
1132
1150
|
}
|
|
1151
|
+
declare const SUPERVISOR_RUN_ID = "supervisor";
|
|
1133
1152
|
/** The broker rejected a receive because the caller's generation is stale. */
|
|
1134
1153
|
declare function isGenerationMismatchError(error: unknown): boolean;
|
|
1135
1154
|
interface HostProviderOptions {
|
|
@@ -1153,7 +1172,10 @@ declare function installAskClaims(provider: MessageProvider, claims: AskClaims,
|
|
|
1153
1172
|
/**
|
|
1154
1173
|
* Build the bound host provider: one supervisor, one generation, one control
|
|
1155
1174
|
* client. It never reads an ambient singleton or retargets, and it never
|
|
1156
|
-
* preflights per call.
|
|
1175
|
+
* preflights per call. Listing-backed lookups fail fast: an incomplete
|
|
1176
|
+
* listing refuses every resolution and state read, even for a peer the
|
|
1177
|
+
* partial set contains, so a wire `peers_error` resolves the same way the Go
|
|
1178
|
+
* providers do. Self and public-ID resolution bypass the listing.
|
|
1157
1179
|
*/
|
|
1158
1180
|
declare function createHostMessageProvider(options: HostProviderOptions): MessageProvider;
|
|
1159
1181
|
interface ChildProviderOptions {
|
|
@@ -1168,7 +1190,10 @@ interface ChildProviderOptions {
|
|
|
1168
1190
|
/**
|
|
1169
1191
|
* Build a child provider over the surface's inherited broker. A child never
|
|
1170
1192
|
* learns a public run id, and it cannot read a sentinel, so it is never
|
|
1171
|
-
* resumable from here: the supervisor owns a resume.
|
|
1193
|
+
* resumable from here: the supervisor owns a resume. Listing-backed lookups
|
|
1194
|
+
* fail fast: an incomplete listing refuses every resolution and state read,
|
|
1195
|
+
* even for a peer the partial set contains, so a wire `peers_error` resolves
|
|
1196
|
+
* the same way the Go providers do. Self resolution bypasses the listing.
|
|
1172
1197
|
*/
|
|
1173
1198
|
declare function createChildMessageProvider(options: ChildProviderOptions): MessageProvider;
|
|
1174
1199
|
//#endregion
|
|
@@ -1305,4 +1330,4 @@ type WorkflowCancelResult = Record<string, unknown>;
|
|
|
1305
1330
|
declare function createWorkflowCancelTool(getSupervisorClient: GetSupervisorClient): (args: WorkflowCancelArgs) => Promise<WorkflowCancelResult>;
|
|
1306
1331
|
declare const workflowCancelTool: (args: WorkflowCancelArgs) => Promise<WorkflowCancelResult>;
|
|
1307
1332
|
//#endregion
|
|
1308
|
-
export { type AskClaims, type BrokerReceiveArgs, type BrokerReceiveResult, type ChildBroker, type Client, DEFAULT_RUN_REDUCER_LIMITS, type Event, type ExecutionIdentity, ForeignPeerError, type HistoryOptions, type HistoryResult, type InboundAsk, type InspectResult, type KillResult, type KillToolArgs, MAX_FINAL_OUTPUT_RUNES, MAX_WAIT_MS, MESSAGE_OUTCOMES, type MessageCallerKind, type MessageClient, type MessageInput, type MessageOutcome, type MessageProvider, type MessageSurface, type NormalizedRunEvent, type ObserveRunOptions, type OwnerAttachOptions, OwnerAuthError, OwnerRecordMissingError, type PeerRecord, type PeersInput, type PeersProviderResult, type PeersResult, type PeersRouterResult, type PeersToolArgs, type PendingAsk, type ProviderResult, type Resolution, type ResultResult, type ResultToolArgs, RpcError, type RunChunkRole, type RunFacts, type RunIdentity, type RunInfo, type RunObserver, type RunObserverClient, type RunPermissionOption, type RunPermissionSummary, RunReducer, type RunReducerLimits, type RunSnapshot, type RunSnapshotSeed, type RunToolState, type RunToolSummary, type RunTranscriptEntry, type SpawnMetadata, type SpawnParams, type SpawnResult, type SpawnSelectionInput, type SpawnToolArgs, type SpawnToolResult, StaleOwnerRecordError, type StatusListResult, type StatusResult, type StatusToolArgs, type StatusView, type SubscribeOptions, Supervisor, type SupervisorClientOptions, type SupervisorOptions, THINKING_LEVELS, type ThinkingLevel, type ThinkingOutcome, ToolError, type WorkflowCancelArgs, type WorkflowCancelResult, type WorkflowCompleteParams, type WorkflowCompleteResult, type WorkflowCompleteToolArgs, type WorkflowControllerCreateParams, type WorkflowControllerStatusResult, type WorkflowControllerStatusToolArgs, type WorkflowEventsResult, type WorkflowEventsToolArgs, type WorkflowGateOperation, type WorkflowGateParams, type WorkflowGateResult, type WorkflowGateToolArgs, type WorkflowHeartbeatParams, type WorkflowInspectResult, type WorkflowInspectToolArgs, type WorkflowReadyResult, type WorkflowReadyToolArgs, type WorkflowStatusResult, type WorkflowStatusToolArgs, type WorkflowWaitResult, type WorkflowWaitToolArgs, answerPermissionTool, assertMessageInput, assertPeersInput, attachOwner, boundFinalOutput, brokerReceiveTool, createChildMessageProvider, createHostMessageProvider, createMessageTool, createPeersTool, createRunSnapshot, createWorkflowCancelTool, createWorkflowCompleteTool, createWorkflowControllerStatusTool, createWorkflowEventsTool, createWorkflowGateTool, createWorkflowInspectTool, createWorkflowReadyTool, createWorkflowStatusTool, createWorkflowWaitTool, dial, evaluateThinkingPolicy, eventsTool, executeMessage, executePeers, extractEventText, extractReplyMessage, extractTurnText, findAvenorBinary, getInstallDir, getSupervisorClient, getVersion, inspectTool, installAskClaims, installerBinaryPath, isGenerationMismatchError, isThinkingLevel, killTool, messageTool, newMsgID, normalizeAskTimeoutMs, normalizeRunEvent, normalizeTurnStopReason, observeRun, peersDetails, peersTool, quote, quoteList, reduceRunSnapshot, renderAskFailure, renderLast, renderOutcome, renderPeerList, repair, resultOutput, resultTool, sanitize, shutdownTool, socketsRoot, spawnTool, statusTool, validateSpawnSelection, validateThinking, validateThinkingForBackend, validateThinkingForBackendResume, workflowCancelTool, workflowCompleteTool, workflowControllerStatusTool, workflowEventsTool, workflowGateTool, workflowInspectTool, workflowReadyTool, workflowStatusTool, workflowWaitTool };
|
|
1333
|
+
export { type AskClaims, type BrokerReceiveArgs, type BrokerReceiveResult, type ChildBroker, type Client, ClosedSocketError, DEFAULT_RUN_REDUCER_LIMITS, type Event, type ExecutionIdentity, ForeignPeerError, type HistoryOptions, type HistoryResult, type InboundAsk, type InspectResult, type KillResult, type KillToolArgs, MAX_FINAL_OUTPUT_RUNES, MAX_WAIT_MS, MESSAGE_OUTCOMES, type MessageCallerKind, type MessageClient, type MessageInput, type MessageOutcome, type MessageProvider, type MessageSurface, type NormalizedRunEvent, type ObserveRunOptions, type OwnerAttachOptions, OwnerAuthError, OwnerRecordMissingError, type PeerRecord, type PeersInput, type PeersProviderResult, type PeersResult, type PeersRouterResult, type PeersToolArgs, type PendingAsk, type ProviderResult, type Resolution, type ResultResult, type ResultToolArgs, RpcError, type RunChunkRole, type RunFacts, type RunIdentity, type RunInfo, type RunObserver, type RunObserverClient, type RunPermissionOption, type RunPermissionSummary, RunReducer, type RunReducerLimits, type RunSnapshot, type RunSnapshotSeed, type RunToolState, type RunToolSummary, type RunTranscriptEntry, SUPERVISOR_RUN_ID, type SpawnMetadata, type SpawnParams, type SpawnResult, type SpawnSelectionInput, type SpawnToolArgs, type SpawnToolResult, StaleOwnerRecordError, type StatusListResult, type StatusResult, type StatusToolArgs, type StatusView, type SubscribeOptions, Supervisor, type SupervisorClientOptions, type SupervisorOptions, THINKING_LEVELS, type ThinkingLevel, type ThinkingOutcome, ToolError, type WorkflowCancelArgs, type WorkflowCancelResult, type WorkflowCompleteParams, type WorkflowCompleteResult, type WorkflowCompleteToolArgs, type WorkflowControllerCreateParams, type WorkflowControllerStatusResult, type WorkflowControllerStatusToolArgs, type WorkflowEventsResult, type WorkflowEventsToolArgs, type WorkflowGateOperation, type WorkflowGateParams, type WorkflowGateResult, type WorkflowGateToolArgs, type WorkflowHeartbeatParams, type WorkflowInspectResult, type WorkflowInspectToolArgs, type WorkflowReadyResult, type WorkflowReadyToolArgs, type WorkflowStatusResult, type WorkflowStatusToolArgs, type WorkflowWaitResult, type WorkflowWaitToolArgs, answerPermissionTool, assertMessageInput, assertPeersInput, attachOwner, boundFinalOutput, brokerReceiveTool, createChildMessageProvider, createHostMessageProvider, createMessageTool, createPeersTool, createRunSnapshot, createWorkflowCancelTool, createWorkflowCompleteTool, createWorkflowControllerStatusTool, createWorkflowEventsTool, createWorkflowGateTool, createWorkflowInspectTool, createWorkflowReadyTool, createWorkflowStatusTool, createWorkflowWaitTool, dial, evaluateThinkingPolicy, eventsTool, executeMessage, executePeers, extractEventText, extractReplyMessage, extractTurnText, findAvenorBinary, getInstallDir, getSupervisorClient, getVersion, inspectTool, installAskClaims, installerBinaryPath, isClosedSocketError, isGenerationMismatchError, isThinkingLevel, killTool, messageTool, newMsgID, normalizeAskTimeoutMs, normalizeRunEvent, normalizeTurnStopReason, observeRun, peersDetails, peersTool, quote, quoteList, reduceRunSnapshot, renderAskFailure, renderLast, renderOutcome, renderPeerList, repair, resultOutput, resultTool, sanitize, shutdownTool, socketsRoot, spawnTool, statusTool, validateSpawnSelection, validateThinking, validateThinkingForBackend, validateThinkingForBackendResume, workflowCancelTool, workflowCompleteTool, workflowControllerStatusTool, workflowEventsTool, workflowGateTool, workflowInspectTool, workflowReadyTool, workflowStatusTool, workflowWaitTool };
|
package/dist/index.js
CHANGED
|
@@ -49,6 +49,23 @@ var CallTimeoutError = class extends Error {
|
|
|
49
49
|
this.name = "CallTimeoutError";
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* A transport failure that marks the control client closed: a send refused
|
|
54
|
+
* because the socket is already closed, a pending call rejected because the
|
|
55
|
+
* read side closed, or a socket write failure. A peer's structured rejection
|
|
56
|
+
* (RpcError) or a call timeout do not close the client and are not classified
|
|
57
|
+
* here.
|
|
58
|
+
*/
|
|
59
|
+
var ClosedSocketError = class extends Error {
|
|
60
|
+
constructor(message) {
|
|
61
|
+
super(message);
|
|
62
|
+
this.name = "ClosedSocketError";
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
/** True when the error is a transport failure that closed the client. */
|
|
66
|
+
function isClosedSocketError(error) {
|
|
67
|
+
return error instanceof ClosedSocketError;
|
|
68
|
+
}
|
|
52
69
|
const OWNER_AUTH_VERSION = 1;
|
|
53
70
|
const OWNER_UNAUTHENTICATED_CODE = -32011;
|
|
54
71
|
const UNSUPPORTED_OWNER_AUTH_CODE = -32012;
|
|
@@ -169,7 +186,7 @@ var Client = class {
|
|
|
169
186
|
this.closed = true;
|
|
170
187
|
for (const [, pc] of this.pending) {
|
|
171
188
|
clearTimeout(pc.timer);
|
|
172
|
-
pc.reject(
|
|
189
|
+
pc.reject(new ClosedSocketError("read response: connection closed"));
|
|
173
190
|
}
|
|
174
191
|
this.pending.clear();
|
|
175
192
|
this.eventDone = true;
|
|
@@ -232,7 +249,7 @@ var Client = class {
|
|
|
232
249
|
if (!value || value.authenticated !== true || value.version !== OWNER_AUTH_VERSION || value.capability_id !== capability.id) throw new OwnerAuthError("unsupported", { reason: "unexpected-result" });
|
|
233
250
|
}
|
|
234
251
|
sendCall(method, params, timeout) {
|
|
235
|
-
if (this.isClosed()) return Promise.reject(
|
|
252
|
+
if (this.isClosed()) return Promise.reject(new ClosedSocketError("control socket is closed"));
|
|
236
253
|
this.startReadLoop();
|
|
237
254
|
const id = ++this.nextID;
|
|
238
255
|
const req = {
|
|
@@ -257,7 +274,7 @@ var Client = class {
|
|
|
257
274
|
this.closed = true;
|
|
258
275
|
clearTimeout(timer);
|
|
259
276
|
this.pending.delete(id);
|
|
260
|
-
reject(
|
|
277
|
+
reject(new ClosedSocketError(`write request: ${err.message}`));
|
|
261
278
|
}
|
|
262
279
|
});
|
|
263
280
|
});
|
|
@@ -1712,6 +1729,13 @@ function avenorHome() {
|
|
|
1712
1729
|
function socketsRoot() {
|
|
1713
1730
|
return path.join(avenorHome(), "sockets");
|
|
1714
1731
|
}
|
|
1732
|
+
function validateSupervisorSocketPath(supervisorId) {
|
|
1733
|
+
const root = fs.realpathSync(socketsRoot());
|
|
1734
|
+
const parent = fs.realpathSync(path.dirname(supervisorId));
|
|
1735
|
+
const basename = path.basename(supervisorId);
|
|
1736
|
+
if (parent !== root || !/^avenor-mcp-[^/\\]+\.sock$/.test(basename)) throw new Error(`invalid supervisorId: ${supervisorId}`);
|
|
1737
|
+
return path.join(parent, basename);
|
|
1738
|
+
}
|
|
1715
1739
|
function runsRoot() {
|
|
1716
1740
|
return path.join(avenorHome(), "runs");
|
|
1717
1741
|
}
|
|
@@ -1932,7 +1956,7 @@ var Supervisor = class Supervisor {
|
|
|
1932
1956
|
recursive: true,
|
|
1933
1957
|
mode: 448
|
|
1934
1958
|
});
|
|
1935
|
-
const socketPath = path.join(socketDir, `avenor-mcp-${process.pid}.sock`);
|
|
1959
|
+
const socketPath = path.join(fs.realpathSync(socketDir), `avenor-mcp-${process.pid}.sock`);
|
|
1936
1960
|
let socketExists = false;
|
|
1937
1961
|
try {
|
|
1938
1962
|
await fs.promises.access(socketPath, fs.constants.R_OK | fs.constants.W_OK);
|
|
@@ -2136,7 +2160,13 @@ var Supervisor = class Supervisor {
|
|
|
2136
2160
|
* isCurrentInstance true while currentInstance is null.
|
|
2137
2161
|
*/
|
|
2138
2162
|
static getInstance(supervisorId) {
|
|
2139
|
-
|
|
2163
|
+
if (Supervisor.instance === null) return null;
|
|
2164
|
+
if (Supervisor.instance.supervisorId === supervisorId) return Supervisor.instance;
|
|
2165
|
+
try {
|
|
2166
|
+
return Supervisor.instance.supervisorId === validateSupervisorSocketPath(supervisorId) ? Supervisor.instance : null;
|
|
2167
|
+
} catch {
|
|
2168
|
+
return null;
|
|
2169
|
+
}
|
|
2140
2170
|
}
|
|
2141
2171
|
static isCurrentInstance(supervisorId) {
|
|
2142
2172
|
return Supervisor.getInstance(supervisorId) !== null;
|
|
@@ -2276,13 +2306,6 @@ function validateTimeout(value) {
|
|
|
2276
2306
|
if (unit === "h") return amount * 3600;
|
|
2277
2307
|
return amount;
|
|
2278
2308
|
}
|
|
2279
|
-
function validateSupervisorSocketPath(supervisorId) {
|
|
2280
|
-
const root = fs.realpathSync(socketsRoot());
|
|
2281
|
-
const parent = fs.realpathSync(path.dirname(supervisorId));
|
|
2282
|
-
const basename = path.basename(supervisorId);
|
|
2283
|
-
if (parent !== root || !/^avenor-mcp-[^/\\]+\.sock$/.test(basename)) throw new Error(`invalid supervisorId: ${supervisorId}`);
|
|
2284
|
-
return path.join(parent, basename);
|
|
2285
|
-
}
|
|
2286
2309
|
function validateObservedAt(observedAt) {
|
|
2287
2310
|
if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/.test(observedAt)) throw new Error("observed_at must be an RFC3339 timestamp");
|
|
2288
2311
|
}
|
|
@@ -9457,13 +9480,20 @@ function installAskClaims(provider, claims, pendingAsks, pollGeneration) {
|
|
|
9457
9480
|
/**
|
|
9458
9481
|
* Build the bound host provider: one supervisor, one generation, one control
|
|
9459
9482
|
* client. It never reads an ambient singleton or retargets, and it never
|
|
9460
|
-
* preflights per call.
|
|
9483
|
+
* preflights per call. Listing-backed lookups fail fast: an incomplete
|
|
9484
|
+
* listing refuses every resolution and state read, even for a peer the
|
|
9485
|
+
* partial set contains, so a wire `peers_error` resolves the same way the Go
|
|
9486
|
+
* providers do. Self and public-ID resolution bypass the listing.
|
|
9461
9487
|
*/
|
|
9462
9488
|
function createHostMessageProvider(options) {
|
|
9463
9489
|
const { surface, supervisorId, generation, client, pendingAsks, pollGeneration } = options;
|
|
9464
9490
|
const claims = /* @__PURE__ */ new Map();
|
|
9465
9491
|
async function listedPeers() {
|
|
9466
|
-
|
|
9492
|
+
const result = await client.messagePeers({ generation });
|
|
9493
|
+
return {
|
|
9494
|
+
peers: peerRecords(result),
|
|
9495
|
+
detail: result.peers_error || void 0
|
|
9496
|
+
};
|
|
9467
9497
|
}
|
|
9468
9498
|
async function retractAsk(messageId) {
|
|
9469
9499
|
try {
|
|
@@ -9498,7 +9528,7 @@ function createHostMessageProvider(options) {
|
|
|
9498
9528
|
runId: "",
|
|
9499
9529
|
match: "none"
|
|
9500
9530
|
};
|
|
9501
|
-
if (ref ===
|
|
9531
|
+
if (ref === "supervisor") return {
|
|
9502
9532
|
runId: SUPERVISOR_RUN_ID,
|
|
9503
9533
|
label: SUPERVISOR_RUN_ID,
|
|
9504
9534
|
match: "unique"
|
|
@@ -9510,7 +9540,8 @@ function createHostMessageProvider(options) {
|
|
|
9510
9540
|
const external = findExternalRunById(supervisorId, ref);
|
|
9511
9541
|
if (external?.runtimeId) return unique(external);
|
|
9512
9542
|
}
|
|
9513
|
-
const peers = await listedPeers();
|
|
9543
|
+
const { peers, detail } = await listedPeers();
|
|
9544
|
+
if (detail) throw new Error(`the peer listing is incomplete: ${detail}`);
|
|
9514
9545
|
const exact = peers.find((peer) => peer.run_id === ref);
|
|
9515
9546
|
if (exact) return {
|
|
9516
9547
|
runId: exact.run_id,
|
|
@@ -9536,8 +9567,10 @@ function createHostMessageProvider(options) {
|
|
|
9536
9567
|
};
|
|
9537
9568
|
},
|
|
9538
9569
|
async state(runId) {
|
|
9539
|
-
if (runId ===
|
|
9540
|
-
const
|
|
9570
|
+
if (runId === "supervisor") {
|
|
9571
|
+
const { peers, detail } = await listedPeers();
|
|
9572
|
+
if (detail) throw new Error(`the peer listing is incomplete: ${detail}`);
|
|
9573
|
+
const translation = translateRunFacts(peers.find((entry) => entry.run_id === "supervisor")?.status ?? "", "");
|
|
9541
9574
|
return {
|
|
9542
9575
|
live: translation.live,
|
|
9543
9576
|
resumable: false,
|
|
@@ -9748,7 +9781,11 @@ function createHostMessageProvider(options) {
|
|
|
9748
9781
|
};
|
|
9749
9782
|
},
|
|
9750
9783
|
async peers() {
|
|
9751
|
-
|
|
9784
|
+
const { peers, detail } = await listedPeers();
|
|
9785
|
+
return {
|
|
9786
|
+
peers,
|
|
9787
|
+
detail
|
|
9788
|
+
};
|
|
9752
9789
|
},
|
|
9753
9790
|
async recordLastTurn(text, stopReason, truncated) {
|
|
9754
9791
|
await client.sessionLastSet(SUPERVISOR_RUN_ID, text, stopReason, truncated);
|
|
@@ -9819,13 +9856,20 @@ function renderReply(reply) {
|
|
|
9819
9856
|
/**
|
|
9820
9857
|
* Build a child provider over the surface's inherited broker. A child never
|
|
9821
9858
|
* learns a public run id, and it cannot read a sentinel, so it is never
|
|
9822
|
-
* resumable from here: the supervisor owns a resume.
|
|
9859
|
+
* resumable from here: the supervisor owns a resume. Listing-backed lookups
|
|
9860
|
+
* fail fast: an incomplete listing refuses every resolution and state read,
|
|
9861
|
+
* even for a peer the partial set contains, so a wire `peers_error` resolves
|
|
9862
|
+
* the same way the Go providers do. Self resolution bypasses the listing.
|
|
9823
9863
|
*/
|
|
9824
9864
|
function createChildMessageProvider(options) {
|
|
9825
9865
|
const { surface, runId, broker, pendingAsks, pollGeneration } = options;
|
|
9826
9866
|
const claims = /* @__PURE__ */ new Map();
|
|
9827
9867
|
async function listedPeers() {
|
|
9828
|
-
|
|
9868
|
+
const result = await broker.peers();
|
|
9869
|
+
return {
|
|
9870
|
+
peers: result.peers,
|
|
9871
|
+
detail: result.detail
|
|
9872
|
+
};
|
|
9829
9873
|
}
|
|
9830
9874
|
const provider = {
|
|
9831
9875
|
caller: () => ({
|
|
@@ -9844,7 +9888,8 @@ function createChildMessageProvider(options) {
|
|
|
9844
9888
|
label: ref,
|
|
9845
9889
|
match: "unique"
|
|
9846
9890
|
};
|
|
9847
|
-
const peers = await listedPeers();
|
|
9891
|
+
const { peers, detail } = await listedPeers();
|
|
9892
|
+
if (detail) throw new Error(`the peer listing is incomplete: ${detail}`);
|
|
9848
9893
|
const exact = peers.find((peer) => peer.run_id === ref);
|
|
9849
9894
|
if (exact) return {
|
|
9850
9895
|
runId: exact.run_id,
|
|
@@ -9868,7 +9913,9 @@ function createChildMessageProvider(options) {
|
|
|
9868
9913
|
};
|
|
9869
9914
|
},
|
|
9870
9915
|
async state(targetRunId) {
|
|
9871
|
-
const
|
|
9916
|
+
const { peers, detail } = await listedPeers();
|
|
9917
|
+
if (detail) throw new Error(`the peer listing is incomplete: ${detail}`);
|
|
9918
|
+
const peer = peers.find((entry) => entry.run_id === targetRunId);
|
|
9872
9919
|
if (!peer) throw new Error(`run ${targetRunId} is not visible`);
|
|
9873
9920
|
const translation = translateRunFacts(peer.status ?? "", "");
|
|
9874
9921
|
return {
|
|
@@ -10107,4 +10154,4 @@ function createWorkflowCancelTool(getSupervisorClient) {
|
|
|
10107
10154
|
}
|
|
10108
10155
|
const workflowCancelTool = createWorkflowCancelTool(getSupervisorClient);
|
|
10109
10156
|
//#endregion
|
|
10110
|
-
export { DEFAULT_RUN_REDUCER_LIMITS, ForeignPeerError, MAX_FINAL_OUTPUT_RUNES, MAX_WAIT_MS, MESSAGE_OUTCOMES, OwnerAuthError, OwnerRecordMissingError, RpcError, RunReducer, StaleOwnerRecordError, Supervisor, THINKING_LEVELS, ToolError, answerPermissionTool, assertMessageInput, assertPeersInput, attachOwner, boundFinalOutput, brokerReceiveTool, createChildMessageProvider, createHostMessageProvider, createMessageTool, createPeersTool, createRunSnapshot, createWorkflowCancelTool, createWorkflowCompleteTool, createWorkflowControllerStatusTool, createWorkflowEventsTool, createWorkflowGateTool, createWorkflowInspectTool, createWorkflowReadyTool, createWorkflowStatusTool, createWorkflowWaitTool, dial, evaluateThinkingPolicy, eventsTool, executeMessage, executePeers, extractEventText, extractReplyMessage, extractTurnText, findAvenorBinary, getInstallDir, getSupervisorClient, getVersion, inspectTool, installAskClaims, installerBinaryPath, isGenerationMismatchError, isThinkingLevel, killTool, messageTool, newMsgID, normalizeAskTimeoutMs, normalizeRunEvent, normalizeTurnStopReason, observeRun, peersDetails, peersTool, quote, quoteList, reduceRunSnapshot, renderAskFailure, renderLast, renderOutcome, renderPeerList, repair, resultOutput, resultTool, sanitize, shutdownTool, socketsRoot, spawnTool, statusTool, validateSpawnSelection, validateThinking, validateThinkingForBackend, validateThinkingForBackendResume, workflowCancelTool, workflowCompleteTool, workflowControllerStatusTool, workflowEventsTool, workflowGateTool, workflowInspectTool, workflowReadyTool, workflowStatusTool, workflowWaitTool };
|
|
10157
|
+
export { ClosedSocketError, DEFAULT_RUN_REDUCER_LIMITS, ForeignPeerError, MAX_FINAL_OUTPUT_RUNES, MAX_WAIT_MS, MESSAGE_OUTCOMES, OwnerAuthError, OwnerRecordMissingError, RpcError, RunReducer, SUPERVISOR_RUN_ID, StaleOwnerRecordError, Supervisor, THINKING_LEVELS, ToolError, answerPermissionTool, assertMessageInput, assertPeersInput, attachOwner, boundFinalOutput, brokerReceiveTool, createChildMessageProvider, createHostMessageProvider, createMessageTool, createPeersTool, createRunSnapshot, createWorkflowCancelTool, createWorkflowCompleteTool, createWorkflowControllerStatusTool, createWorkflowEventsTool, createWorkflowGateTool, createWorkflowInspectTool, createWorkflowReadyTool, createWorkflowStatusTool, createWorkflowWaitTool, dial, evaluateThinkingPolicy, eventsTool, executeMessage, executePeers, extractEventText, extractReplyMessage, extractTurnText, findAvenorBinary, getInstallDir, getSupervisorClient, getVersion, inspectTool, installAskClaims, installerBinaryPath, isClosedSocketError, isGenerationMismatchError, isThinkingLevel, killTool, messageTool, newMsgID, normalizeAskTimeoutMs, normalizeRunEvent, normalizeTurnStopReason, observeRun, peersDetails, peersTool, quote, quoteList, reduceRunSnapshot, renderAskFailure, renderLast, renderOutcome, renderPeerList, repair, resultOutput, resultTool, sanitize, shutdownTool, socketsRoot, spawnTool, statusTool, validateSpawnSelection, validateThinking, validateThinkingForBackend, validateThinkingForBackendResume, workflowCancelTool, workflowCompleteTool, workflowControllerStatusTool, workflowEventsTool, workflowGateTool, workflowInspectTool, workflowReadyTool, workflowStatusTool, workflowWaitTool };
|