@animalabs/agent-framework 0.26.1 → 0.27.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 +57 -7
- package/dist/src/agent.d.ts +263 -22
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +531 -54
- package/dist/src/agent.js.map +1 -1
- package/dist/src/api/server.d.ts.map +1 -1
- package/dist/src/api/server.js +1 -2
- package/dist/src/api/server.js.map +1 -1
- package/dist/src/auto-continue.d.ts +33 -0
- package/dist/src/auto-continue.d.ts.map +1 -0
- package/dist/src/auto-continue.js +35 -0
- package/dist/src/auto-continue.js.map +1 -0
- package/dist/src/code-execution/isolate/scripts.d.ts +11 -0
- package/dist/src/code-execution/isolate/scripts.d.ts.map +1 -1
- package/dist/src/code-execution/isolate/scripts.js +5 -1
- package/dist/src/code-execution/isolate/scripts.js.map +1 -1
- package/dist/src/framework.d.ts +829 -156
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +3906 -1008
- package/dist/src/framework.js.map +1 -1
- package/dist/src/gate/event-gate.d.ts +309 -46
- package/dist/src/gate/event-gate.d.ts.map +1 -1
- package/dist/src/gate/event-gate.js +2117 -395
- package/dist/src/gate/event-gate.js.map +1 -1
- package/dist/src/gate/index.d.ts +2 -2
- package/dist/src/gate/index.d.ts.map +1 -1
- package/dist/src/gate/index.js +1 -1
- package/dist/src/gate/index.js.map +1 -1
- package/dist/src/gate/recipe-reconcile.d.ts +103 -0
- package/dist/src/gate/recipe-reconcile.d.ts.map +1 -0
- package/dist/src/gate/recipe-reconcile.js +325 -0
- package/dist/src/gate/recipe-reconcile.js.map +1 -0
- package/dist/src/gate/types.d.ts +68 -8
- package/dist/src/gate/types.d.ts.map +1 -1
- package/dist/src/index.d.ts +6 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcpl/channel-registry.d.ts +433 -113
- package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.js +1152 -434
- package/dist/src/mcpl/channel-registry.js.map +1 -1
- package/dist/src/mcpl/conversation-router.d.ts +16 -8
- package/dist/src/mcpl/conversation-router.d.ts.map +1 -1
- package/dist/src/mcpl/conversation-router.js +29 -15
- package/dist/src/mcpl/conversation-router.js.map +1 -1
- package/dist/src/mcpl/convert-block.d.ts.map +1 -1
- package/dist/src/mcpl/convert-block.js +14 -2
- package/dist/src/mcpl/convert-block.js.map +1 -1
- package/dist/src/mcpl/hook-orchestrator.d.ts +7 -1
- package/dist/src/mcpl/hook-orchestrator.d.ts.map +1 -1
- package/dist/src/mcpl/hook-orchestrator.js +32 -7
- package/dist/src/mcpl/hook-orchestrator.js.map +1 -1
- package/dist/src/mcpl/index.d.ts +5 -1
- package/dist/src/mcpl/index.d.ts.map +1 -1
- package/dist/src/mcpl/index.js +4 -0
- package/dist/src/mcpl/index.js.map +1 -1
- package/dist/src/mcpl/inference-router.d.ts +14 -2
- package/dist/src/mcpl/inference-router.d.ts.map +1 -1
- package/dist/src/mcpl/inference-router.js +73 -28
- package/dist/src/mcpl/inference-router.js.map +1 -1
- package/dist/src/mcpl/prose-grammar.d.ts +4 -0
- package/dist/src/mcpl/prose-grammar.d.ts.map +1 -1
- package/dist/src/mcpl/prose-grammar.js +6 -0
- package/dist/src/mcpl/prose-grammar.js.map +1 -1
- package/dist/src/mcpl/protocol-family.d.ts.map +1 -1
- package/dist/src/mcpl/protocol-family.js +3 -0
- package/dist/src/mcpl/protocol-family.js.map +1 -1
- package/dist/src/mcpl/push-coalescer.d.ts +20 -2
- package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
- package/dist/src/mcpl/push-coalescer.js +33 -11
- package/dist/src/mcpl/push-coalescer.js.map +1 -1
- package/dist/src/mcpl/reference-fetcher.d.ts +63 -42
- package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
- package/dist/src/mcpl/reference-fetcher.js +177 -145
- package/dist/src/mcpl/reference-fetcher.js.map +1 -1
- package/dist/src/mcpl/references.d.ts +380 -46
- package/dist/src/mcpl/references.d.ts.map +1 -1
- package/dist/src/mcpl/references.js +737 -78
- package/dist/src/mcpl/references.js.map +1 -1
- package/dist/src/mcpl/server-connection.d.ts +82 -3
- package/dist/src/mcpl/server-connection.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.js +132 -7
- package/dist/src/mcpl/server-connection.js.map +1 -1
- package/dist/src/mcpl/tool-lifecycle.d.ts +11 -0
- package/dist/src/mcpl/tool-lifecycle.d.ts.map +1 -1
- package/dist/src/mcpl/tool-lifecycle.js +21 -0
- package/dist/src/mcpl/tool-lifecycle.js.map +1 -1
- package/dist/src/mcpl/tool-presence.d.ts +259 -0
- package/dist/src/mcpl/tool-presence.d.ts.map +1 -0
- package/dist/src/mcpl/tool-presence.js +628 -0
- package/dist/src/mcpl/tool-presence.js.map +1 -0
- package/dist/src/mcpl/tool-result-normalize.d.ts +9 -3
- package/dist/src/mcpl/tool-result-normalize.d.ts.map +1 -1
- package/dist/src/mcpl/tool-result-normalize.js +14 -6
- package/dist/src/mcpl/tool-result-normalize.js.map +1 -1
- package/dist/src/mcpl/tool-signature.d.ts +39 -0
- package/dist/src/mcpl/tool-signature.d.ts.map +1 -0
- package/dist/src/mcpl/tool-signature.js +292 -0
- package/dist/src/mcpl/tool-signature.js.map +1 -0
- package/dist/src/mcpl/toolset-host.d.ts +200 -0
- package/dist/src/mcpl/toolset-host.d.ts.map +1 -0
- package/dist/src/mcpl/toolset-host.js +621 -0
- package/dist/src/mcpl/toolset-host.js.map +1 -0
- package/dist/src/mcpl/toolsets-module.d.ts +80 -0
- package/dist/src/mcpl/toolsets-module.d.ts.map +1 -0
- package/dist/src/mcpl/toolsets-module.js +431 -0
- package/dist/src/mcpl/toolsets-module.js.map +1 -0
- package/dist/src/mcpl/transport.d.ts +2 -2
- package/dist/src/mcpl/transport.d.ts.map +1 -1
- package/dist/src/mcpl/transport.js +3 -2
- package/dist/src/mcpl/transport.js.map +1 -1
- package/dist/src/mcpl/types.d.ts +21 -1
- package/dist/src/mcpl/types.d.ts.map +1 -1
- package/dist/src/mcpl/types.js.map +1 -1
- package/dist/src/mcpl/visible-content.d.ts +7 -9
- package/dist/src/mcpl/visible-content.d.ts.map +1 -1
- package/dist/src/mcpl/visible-content.js +21 -9
- package/dist/src/mcpl/visible-content.js.map +1 -1
- package/dist/src/module-registry.d.ts +23 -8
- package/dist/src/module-registry.d.ts.map +1 -1
- package/dist/src/module-registry.js +68 -15
- package/dist/src/module-registry.js.map +1 -1
- package/dist/src/modules/discord/index.js +1 -1
- package/dist/src/modules/discord/index.js.map +1 -1
- package/dist/src/modules/history/index.d.ts +2 -1
- package/dist/src/modules/history/index.d.ts.map +1 -1
- package/dist/src/modules/history/index.js +51 -17
- package/dist/src/modules/history/index.js.map +1 -1
- package/dist/src/modules/history/semantic.d.ts +108 -6
- package/dist/src/modules/history/semantic.d.ts.map +1 -1
- package/dist/src/modules/history/semantic.js +273 -57
- package/dist/src/modules/history/semantic.js.map +1 -1
- package/dist/src/modules/workspace/direct-write.d.ts +181 -0
- package/dist/src/modules/workspace/direct-write.d.ts.map +1 -0
- package/dist/src/modules/workspace/direct-write.js +384 -0
- package/dist/src/modules/workspace/direct-write.js.map +1 -0
- package/dist/src/modules/workspace/edit-text.d.ts +26 -12
- package/dist/src/modules/workspace/edit-text.d.ts.map +1 -1
- package/dist/src/modules/workspace/edit-text.js +58 -28
- package/dist/src/modules/workspace/edit-text.js.map +1 -1
- package/dist/src/modules/workspace/effects.d.ts +10 -0
- package/dist/src/modules/workspace/effects.d.ts.map +1 -1
- package/dist/src/modules/workspace/effects.js +1 -1
- package/dist/src/modules/workspace/effects.js.map +1 -1
- package/dist/src/modules/workspace/index.d.ts +246 -27
- package/dist/src/modules/workspace/index.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.js +1216 -236
- package/dist/src/modules/workspace/index.js.map +1 -1
- package/dist/src/modules/workspace/read-page.d.ts +41 -0
- package/dist/src/modules/workspace/read-page.d.ts.map +1 -0
- package/dist/src/modules/workspace/read-page.js +213 -0
- package/dist/src/modules/workspace/read-page.js.map +1 -0
- package/dist/src/modules/workspace/result-text.d.ts +67 -0
- package/dist/src/modules/workspace/result-text.d.ts.map +1 -0
- package/dist/src/modules/workspace/result-text.js +94 -0
- package/dist/src/modules/workspace/result-text.js.map +1 -0
- package/dist/src/modules/workspace/text.d.ts +29 -12
- package/dist/src/modules/workspace/text.d.ts.map +1 -1
- package/dist/src/modules/workspace/text.js +35 -33
- package/dist/src/modules/workspace/text.js.map +1 -1
- package/dist/src/modules/workspace/types.d.ts +41 -17
- package/dist/src/modules/workspace/types.d.ts.map +1 -1
- package/dist/src/modules/workspace/types.js.map +1 -1
- package/dist/src/sent-rows.d.ts +59 -0
- package/dist/src/sent-rows.d.ts.map +1 -0
- package/dist/src/sent-rows.js +145 -0
- package/dist/src/sent-rows.js.map +1 -0
- package/dist/src/silent-heartbeat.d.ts +17 -10
- package/dist/src/silent-heartbeat.d.ts.map +1 -1
- package/dist/src/silent-heartbeat.js.map +1 -1
- package/dist/src/stable-hash.d.ts +3 -0
- package/dist/src/stable-hash.d.ts.map +1 -0
- package/dist/src/stable-hash.js +15 -0
- package/dist/src/stable-hash.js.map +1 -0
- package/dist/src/stored-injections.d.ts +99 -0
- package/dist/src/stored-injections.d.ts.map +1 -0
- package/dist/src/stored-injections.js +106 -0
- package/dist/src/stored-injections.js.map +1 -0
- package/dist/src/text-as-stored.d.ts +4 -3
- package/dist/src/text-as-stored.d.ts.map +1 -1
- package/dist/src/text-as-stored.js +4 -3
- package/dist/src/text-as-stored.js.map +1 -1
- package/dist/src/thinking-drops.d.ts +81 -0
- package/dist/src/thinking-drops.d.ts.map +1 -0
- package/dist/src/thinking-drops.js +103 -0
- package/dist/src/thinking-drops.js.map +1 -0
- package/dist/src/tool-image-ledger.d.ts +9 -8
- package/dist/src/tool-image-ledger.d.ts.map +1 -1
- package/dist/src/tool-image-ledger.js +9 -8
- package/dist/src/tool-image-ledger.js.map +1 -1
- package/dist/src/tool-presentation.d.ts.map +1 -1
- package/dist/src/tool-presentation.js +3 -1
- package/dist/src/tool-presentation.js.map +1 -1
- package/dist/src/tool-result-guard.d.ts +4 -2
- package/dist/src/tool-result-guard.d.ts.map +1 -1
- package/dist/src/tool-result-guard.js +21 -6
- package/dist/src/tool-result-guard.js.map +1 -1
- package/dist/src/tool-result-history.d.ts +186 -21
- package/dist/src/tool-result-history.d.ts.map +1 -1
- package/dist/src/tool-result-history.js +428 -89
- package/dist/src/tool-result-history.js.map +1 -1
- package/dist/src/tune-out/coordinator.d.ts +17 -9
- package/dist/src/tune-out/coordinator.d.ts.map +1 -1
- package/dist/src/tune-out/coordinator.js +84 -37
- package/dist/src/tune-out/coordinator.js.map +1 -1
- package/dist/src/types/agent.d.ts +186 -7
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/events.d.ts +19 -2
- package/dist/src/types/events.d.ts.map +1 -1
- package/dist/src/types/framework.d.ts +24 -3
- package/dist/src/types/framework.d.ts.map +1 -1
- package/dist/src/types/module.d.ts +90 -7
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/trace.d.ts +57 -2
- package/dist/src/types/trace.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/agent.ts +593 -60
- package/src/api/server.ts +1 -2
- package/src/auto-continue.ts +42 -0
- package/src/code-execution/isolate/scripts.ts +11 -3
- package/src/framework.ts +4004 -1026
- package/src/gate/event-gate.ts +2315 -389
- package/src/gate/index.ts +2 -1
- package/src/gate/recipe-reconcile.ts +355 -0
- package/src/gate/types.ts +70 -8
- package/src/index.ts +7 -4
- package/src/mcpl/channel-registry.ts +1220 -467
- package/src/mcpl/conversation-router.ts +34 -16
- package/src/mcpl/convert-block.ts +14 -1
- package/src/mcpl/hook-orchestrator.ts +33 -6
- package/src/mcpl/index.ts +6 -1
- package/src/mcpl/inference-router.ts +79 -34
- package/src/mcpl/prose-grammar.ts +7 -0
- package/src/mcpl/protocol-family.ts +2 -0
- package/src/mcpl/push-coalescer.ts +51 -13
- package/src/mcpl/reference-fetcher.ts +201 -162
- package/src/mcpl/references.ts +852 -78
- package/src/mcpl/server-connection.ts +145 -7
- package/src/mcpl/tool-lifecycle.ts +21 -0
- package/src/mcpl/tool-presence.ts +650 -0
- package/src/mcpl/tool-result-normalize.ts +18 -6
- package/src/mcpl/tool-signature.ts +285 -0
- package/src/mcpl/toolset-host.ts +637 -0
- package/src/mcpl/toolsets-module.ts +451 -0
- package/src/mcpl/transport.ts +3 -2
- package/src/mcpl/types.ts +22 -1
- package/src/mcpl/visible-content.ts +22 -9
- package/src/module-registry.ts +77 -24
- package/src/modules/discord/index.ts +1 -1
- package/src/modules/history/index.ts +48 -18
- package/src/modules/history/semantic.ts +308 -54
- package/src/modules/workspace/direct-write.ts +425 -0
- package/src/modules/workspace/edit-text.ts +82 -35
- package/src/modules/workspace/effects.ts +1 -1
- package/src/modules/workspace/index.ts +1274 -241
- package/src/modules/workspace/read-page.ts +222 -0
- package/src/modules/workspace/result-text.ts +119 -0
- package/src/modules/workspace/text.ts +58 -32
- package/src/modules/workspace/types.ts +41 -17
- package/src/sent-rows.ts +162 -0
- package/src/silent-heartbeat.ts +17 -10
- package/src/stable-hash.ts +14 -0
- package/src/stored-injections.ts +131 -0
- package/src/text-as-stored.ts +4 -3
- package/src/thinking-drops.ts +141 -0
- package/src/tool-image-ledger.ts +9 -8
- package/src/tool-presentation.ts +3 -1
- package/src/tool-result-guard.ts +19 -6
- package/src/tool-result-history.ts +488 -88
- package/src/tune-out/coordinator.ts +80 -37
- package/src/types/agent.ts +189 -7
- package/src/types/events.ts +19 -2
- package/src/types/framework.ts +21 -3
- package/src/types/module.ts +86 -7
- package/src/types/trace.ts +58 -2
package/dist/src/framework.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type PresentationSnapshot } from "./tool-presentation.js";
|
|
2
2
|
import { JsStore } from '@animalabs/chronicle';
|
|
3
3
|
import type { Membrane, NormalizedRequest } from '@animalabs/membrane';
|
|
4
|
+
import { type RetrySettings } from '@animalabs/membrane/retry';
|
|
4
5
|
import { ContextManager } from '@animalabs/context-manager';
|
|
5
6
|
import type { TokenBudget } from '@animalabs/context-manager';
|
|
6
|
-
import type { FrameworkConfig, TraceEventListener, InferenceLogQuery, InferenceLogQueryResult, InferenceLogEntryWithId, ProcessLogQuery, ProcessLogQueryResult, ProcessLogEntryWithId, ProcessEvent, ToolCall, ToolResult, AgentConfig, InferenceRequest, Module, ContextMaintenanceSnapshot, AgentRuntimeSettingsPatch, AgentRuntimeSettingsSnapshot, SameRoundThinkTextPolicy } from './types/index.js';
|
|
7
|
-
import { Agent } from './agent.js';
|
|
7
|
+
import type { FrameworkConfig, ErrorPolicy, ErrorAction, TraceEventListener, InferenceLogQuery, InferenceLogQueryResult, InferenceLogEntryWithId, ProcessLogQuery, ProcessLogQueryResult, ProcessLogEntryWithId, ProcessEvent, ToolCall, ToolResult, AgentConfig, InferenceRequest, Module, ContextMaintenanceSnapshot, AgentRuntimeSettingsPatch, AgentRuntimeSettingsSnapshot, SameRoundThinkTextPolicy } from './types/index.js';
|
|
8
|
+
import { Agent, type RenderStats } from './agent.js';
|
|
8
9
|
import { type ToolClass, type ToolClassSource } from './mcpl/tool-classes.js';
|
|
9
10
|
import { ChannelRegistry } from './mcpl/channel-registry.js';
|
|
10
11
|
import { ConversationRouter } from './mcpl/conversation-router.js';
|
|
@@ -64,18 +65,21 @@ export interface HostModeStatus {
|
|
|
64
65
|
reason?: string;
|
|
65
66
|
since?: number;
|
|
66
67
|
/** True when no turn is alive: no turn token (the token spans dequeue →
|
|
67
|
-
* settled teardown, strictly wider than activeStreams)
|
|
68
|
+
* settled teardown, strictly wider than activeStreams), no continuation
|
|
68
69
|
* of a turn on its way to its start (a budget restart's or a tool-result
|
|
69
70
|
* guard's retry, queued, held by a provider hold, parked or in a scheduler
|
|
70
|
-
* pass),
|
|
71
|
+
* pass), no turn whose call failed into a provider hold waiting for the
|
|
72
|
+
* hold to release its retry (wherever that retry then waits), and no wake
|
|
73
|
+
* parked on provider admission. It covers the
|
|
71
74
|
* framework's own turns: a caller of the direct Agent API
|
|
72
75
|
* (`Agent.runInference`) owns its turns' timing. */
|
|
73
76
|
drained: boolean;
|
|
74
77
|
activeTurns: number;
|
|
75
78
|
/** The agents with a turn alive, the ones `activeTurns` counts, sorted:
|
|
76
79
|
* each from its turn's dequeue to its settled teardown, so a turn in its
|
|
77
|
-
* hooks or compile, one finishing its deliveries,
|
|
78
|
-
* is on its way to its start,
|
|
80
|
+
* hooks or compile, one finishing its deliveries, one whose continuation
|
|
81
|
+
* is on its way to its start, or one a provider hold keeps for its retry,
|
|
82
|
+
* is listed. These are the agents an abandon or
|
|
79
83
|
* a stop() made now would find mid-turn. */
|
|
80
84
|
activeTurnAgents: string[];
|
|
81
85
|
/** Wakes that own provider admission while waiting for an in-flight
|
|
@@ -87,7 +91,8 @@ export interface HostModeStatus {
|
|
|
87
91
|
/** Inference requests parked by the quiesce wake gate (while quiesced), or
|
|
88
92
|
* simply queued (while serving — non-zero right after a resume until the
|
|
89
93
|
* scheduler's next pass consumes them). Continuations of a held turn
|
|
90
|
-
* (budget restart, tool results)
|
|
94
|
+
* (budget restart, tool results) and a held turn's retry, which a quiesce
|
|
95
|
+
* lets through, are never counted. */
|
|
91
96
|
gatedRequests: number;
|
|
92
97
|
/** code_execution scripts still running that no call is waiting on: left
|
|
93
98
|
* running after a yield, outside any turn. Quiesce does NOT stop them —
|
|
@@ -156,6 +161,42 @@ export declare class ProviderWaitNotSleptError extends Error {
|
|
|
156
161
|
interface InferenceToolSnapshot {
|
|
157
162
|
sameRoundThinkTextPolicy: SameRoundThinkTextPolicy;
|
|
158
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Default error policy: membrane's own retry schedules, decided here.
|
|
166
|
+
*
|
|
167
|
+
* The framework's turns pass `retry: false` to membrane, so a failure reaches
|
|
168
|
+
* this policy after one send, and the framework is the one retry layer: each
|
|
169
|
+
* retry is a fresh compile, a stop cancels its wait, and the wait is seen.
|
|
170
|
+
* The decision is membrane's (`@animalabs/membrane/retry`), on the settings
|
|
171
|
+
* given (membrane's defaults unless a host passes its own, e.g. from a
|
|
172
|
+
* recipe's retry config):
|
|
173
|
+
* - not retryable (400 invalid_request, 401 auth, context_length, safety,
|
|
174
|
+
* a caller-code error): terminal on the first failure. Retrying them burns
|
|
175
|
+
* API quota without any chance of success; production traces showed clerk +
|
|
176
|
+
* reviewer wasting 4 inferences on each 400 due to blind retries.
|
|
177
|
+
* - overloaded (a 529, or an overloaded error mid-stream): the overloaded
|
|
178
|
+
* schedule, jittered (by default 7 tries, 10 s doubling to 5 min, ~10 min).
|
|
179
|
+
* - rate limited (429): the base schedule with at least 5 tries.
|
|
180
|
+
* - any other retryable failure, a stream deadline on a sent request
|
|
181
|
+
* included (membrane leaves those to its caller): the base schedule (by
|
|
182
|
+
* default 3 tries, 1 s then 2 s).
|
|
183
|
+
* A provider's stated wait (`retryAfterMs`) is waited when it is longer than
|
|
184
|
+
* the backoff, up to the framework's own cap (PROVIDER_ACCELERATION_MAX_
|
|
185
|
+
* COOLDOWN_MS, ten minutes) where a schedule's ceiling is lower; past it the
|
|
186
|
+
* turn ends here. (Before this policy runs, the framework holds a resident
|
|
187
|
+
* for a stated wait or an acceleration 429 itself, and ends an ephemeral run
|
|
188
|
+
* on a wait past that cap; see holdProviderAcceleration and
|
|
189
|
+
* nonOwningProviderWait.)
|
|
190
|
+
* An error that isn't a MembraneError is retried as a retryable failure, on
|
|
191
|
+
* the base schedule.
|
|
192
|
+
*/
|
|
193
|
+
export declare class DefaultErrorPolicy implements ErrorPolicy {
|
|
194
|
+
/** The most retries any class allows (ErrorPolicy's bound, for readers). */
|
|
195
|
+
readonly maxRetries: number;
|
|
196
|
+
private readonly settings;
|
|
197
|
+
constructor(settings?: RetrySettings);
|
|
198
|
+
onInferenceError(error: Error, _agentName: string, attempt: number): ErrorAction;
|
|
199
|
+
}
|
|
159
200
|
/**
|
|
160
201
|
* Whether the poison-history breaker may shed the newest exchange for a
|
|
161
202
|
* failure: an `invalid_request` at HTTP 400, 413 or 422 or with no status, or
|
|
@@ -218,6 +259,29 @@ export declare class AgentFramework {
|
|
|
218
259
|
private toolPresentations;
|
|
219
260
|
private presentationPreviews;
|
|
220
261
|
getRequestToolPresentation(request: object): PresentationSnapshot | null;
|
|
262
|
+
/**
|
|
263
|
+
* The render stats of the dry compile that built `request`, a request
|
|
264
|
+
* `previewActivation` returned (or `Agent.buildActivationRequest` with
|
|
265
|
+
* `dryRun`), as context-manager gives them in `CompileResult.renderStats`:
|
|
266
|
+
* what that compile's select put in the context, by kind. They count the
|
|
267
|
+
* selection, not each message of the request. The injections
|
|
268
|
+
* context-manager merges in after its select, such as those
|
|
269
|
+
* `previewActivation` gathers with `injections: true`, aren't counted;
|
|
270
|
+
* context-manager's doc of `CompileResult.renderStats` names what else its
|
|
271
|
+
* compile does after the select. The agent then changes the messages
|
|
272
|
+
* itself, and the stats come from before that: they count a message it
|
|
273
|
+
* drops, such as one left holding only blank text, and leave out the turns
|
|
274
|
+
* it adds, such as `[Continue]`, a silent heartbeat's separator,
|
|
275
|
+
* request-only turns, and the stand-ins `previewActivation` shows for the
|
|
276
|
+
* `afterUser` injections a start would store (stored-injections.ts). A
|
|
277
|
+
* later preview or live compile leaves them as they were.
|
|
278
|
+
* They're the object the compile returned, not a copy, so treat them as
|
|
279
|
+
* read-only: a change to them shows in every later read. Null for a request
|
|
280
|
+
* no dry run built, a request that is sent included, and when the agent's
|
|
281
|
+
* strategy records none (of context-manager's own, the autobiographical
|
|
282
|
+
* strategy and the knowledge strategy built on it do).
|
|
283
|
+
*/
|
|
284
|
+
getRequestCompileStats(request: object): RenderStats | null;
|
|
221
285
|
private store;
|
|
222
286
|
private ownsStore;
|
|
223
287
|
private stopPromise;
|
|
@@ -385,6 +449,10 @@ export declare class AgentFramework {
|
|
|
385
449
|
/** Consecutive bounce-wakes per agent; capped so an agent that keeps
|
|
386
450
|
* emitting unprefixed prose can't wake-loop (notices still append). */
|
|
387
451
|
private proseBounceStreaks;
|
|
452
|
+
/** Consecutive autoContinue continuations per agent, capped by its
|
|
453
|
+
* maxConsecutive. Cleared when a turn starts with a cause of its own
|
|
454
|
+
* (processInferenceRequests) or a tool ends a turn (skip_reply). */
|
|
455
|
+
private autoContinueStreaks;
|
|
388
456
|
private pendingAssistantBlocks;
|
|
389
457
|
/** Streams the FRAMEWORK cancelled for non-terminal reasons, keyed
|
|
390
458
|
* `${agentName}:${streamId}`: an endTurn tool result or a context-budget
|
|
@@ -517,6 +585,12 @@ export declare class AgentFramework {
|
|
|
517
585
|
*/
|
|
518
586
|
private deferredScanFrom;
|
|
519
587
|
private deferredMessages;
|
|
588
|
+
/** The marked held writes whose store couldn't be searched, each with the
|
|
589
|
+
* failure said, said once until a lookup of them succeeds and again when
|
|
590
|
+
* the failure changes (landedCopiesById), and those a drain has said it
|
|
591
|
+
* holds what's queued behind (writeDrainedInOrder). */
|
|
592
|
+
private unsearchableSaid;
|
|
593
|
+
private stillUnknownSaid;
|
|
520
594
|
private activeTurnTokens;
|
|
521
595
|
/** Each running scheduler pass's requests, which it took from
|
|
522
596
|
* pendingRequests: it holds those of the agents it hasn't taken up yet
|
|
@@ -569,12 +643,14 @@ export declare class AgentFramework {
|
|
|
569
643
|
* is still the agent's, so a start that ends after a later frame opened
|
|
570
644
|
* one, such as its retry's stream waiting to retry, leaves that one open.
|
|
571
645
|
* An operator's abandon marks the window, and the frame's check collects
|
|
572
|
-
* the mark, which goes with the window.
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
*
|
|
646
|
+
* the mark, which goes with the window. A stop of a turn with no stream
|
|
647
|
+
* lands here, or, for a turn whose continuation or retry is on its way (a
|
|
648
|
+
* provider hold's, a park's, the queue's or a pass's), through
|
|
649
|
+
* abortInference(), an abandon or stop(), which drop that continuation or
|
|
650
|
+
* retry (dropContinuations); a stop made anywhere else, as while an agent
|
|
651
|
+
* is idle or a turn finishes its last delivery, has no check to end it,
|
|
652
|
+
* and the next start drops it. Keyed by the Agent, so a replacement agent
|
|
653
|
+
* under the same name never shares one.
|
|
578
654
|
*/
|
|
579
655
|
private checkAhead;
|
|
580
656
|
/** Structured calls executed in the current logical turn. Unlike the
|
|
@@ -618,6 +694,9 @@ export declare class AgentFramework {
|
|
|
618
694
|
* ephemeral agents have isolated slots and are their own only readers.
|
|
619
695
|
*/
|
|
620
696
|
private readonly sharedSlotAgents;
|
|
697
|
+
/** The batched-wake lines already written (placeWakeLines), so every agent a
|
|
698
|
+
* wake was for, and every later start of it, writes each at most once. */
|
|
699
|
+
private readonly placedWakeLines;
|
|
621
700
|
/** Rounds of tool calls, by their results array, that a save_recent_image
|
|
622
701
|
* in the round counted by their share of the bound: such a round is
|
|
623
702
|
* stored by its share whether or not it fits (buildStoredToolResultContent). */
|
|
@@ -653,6 +732,21 @@ export declare class AgentFramework {
|
|
|
653
732
|
private closingConversationAgents;
|
|
654
733
|
private codeExecution;
|
|
655
734
|
private scriptToolWaiters;
|
|
735
|
+
/** A script's call being dispatched, by its call id: what its script was
|
|
736
|
+
* started with, its words' turn and reading. `turnId` is the turn the
|
|
737
|
+
* script was started in, if one was (callingTurnOf); `readThrough` is the
|
|
738
|
+
* consumed watermark its agent had when the run call started it, which a
|
|
739
|
+
* publish the call makes is credited with (publishReadThrough). Kept only
|
|
740
|
+
* while the dispatch runs (dispatchScriptToolCall). */
|
|
741
|
+
private readonly scriptCallStarts;
|
|
742
|
+
/** Per agent, the unexpected thinking drops its last operator alert counted (noteThinkingLoss). */
|
|
743
|
+
private readonly thinkingLossIncidents;
|
|
744
|
+
/** Per live stream that can be noted, its rows so far after the compiled messages (noteRoundSent). */
|
|
745
|
+
private readonly streamRequestNotes;
|
|
746
|
+
/** Per pending round's blocks (pendingAssistantBlocks' value), what membrane held as that round's reply
|
|
747
|
+
* (`roundContent`, its results left out); null where the round has no `roundContent` (XML or fallback). Keyed by
|
|
748
|
+
* the blocks themselves, so it goes wherever they go. */
|
|
749
|
+
private readonly pendingRoundSent;
|
|
656
750
|
/** Per agent, a round that called code_execution and waits for those calls'
|
|
657
751
|
* results before its prose is routed (ScriptRound). */
|
|
658
752
|
private scriptRounds;
|
|
@@ -735,6 +829,10 @@ export declare class AgentFramework {
|
|
|
735
829
|
/** Host capabilities advertised during the MCP handshake — stored so servers
|
|
736
830
|
* can be connected at runtime (connectMcplServer) after initialization. */
|
|
737
831
|
private mcplHostCapabilities;
|
|
832
|
+
/** MCPL RFC-014: every toolHints server's tool presence, for the
|
|
833
|
+
* `toolsets` module's meta-tools and reminders. Made when the first
|
|
834
|
+
* server configured with `toolHints: true` is set up; null until then. */
|
|
835
|
+
private toolsetHub;
|
|
738
836
|
/** Inference routing policy from FrameworkConfig — stored so the MCPL
|
|
739
837
|
* subsystem can be lazily initialized by connectMcplServer when the
|
|
740
838
|
* framework started with zero configured servers. */
|
|
@@ -980,12 +1078,17 @@ export declare class AgentFramework {
|
|
|
980
1078
|
* a stated 0, as in ProviderWaits: the 1 s floor, plus jitter. */
|
|
981
1079
|
private accelerationCooldownMs;
|
|
982
1080
|
/** Whether two requests are one wake, for a provider hold's dedup: the
|
|
983
|
-
* same agent, reason, source, time and channel,
|
|
1081
|
+
* same agent, reason, source, time and channel, on the same server (two
|
|
1082
|
+
* servers' channels can share an id), and the same coalescing
|
|
984
1083
|
* marks: a batch wake's subject, a batch-only merge's subjects (it has no
|
|
985
1084
|
* single subject), and the write a wake reads. A wake with any of them
|
|
986
1085
|
* can be withdrawn or dropped on its own, and must not stand for one
|
|
987
1086
|
* without. (coalescingBatch is set only beside one of the first two.) */
|
|
988
1087
|
private sameInferenceRequest;
|
|
1088
|
+
/** Keep `request` among a hold's `held` requests, once by
|
|
1089
|
+
* sameInferenceRequest. A held turn's retry (TURN_RETRY) whose equal is
|
|
1090
|
+
* already held marks that one, so the hold still keeps the turn alive. */
|
|
1091
|
+
private holdRequest;
|
|
989
1092
|
private consultProviderHold;
|
|
990
1093
|
/** A host hold whose slice expired: ask the host again before spending an
|
|
991
1094
|
* inference on it. True = extended in place (held requests stay held). */
|
|
@@ -1043,7 +1146,10 @@ export declare class AgentFramework {
|
|
|
1043
1146
|
* Hold this agent's primary turns for a provider wait on its model. The
|
|
1044
1147
|
* requests are kept and released together, into one fresh compile, when
|
|
1045
1148
|
* the wait ends: the same path an acceleration cooldown takes, without
|
|
1046
|
-
* parking auxiliary calls to other models.
|
|
1149
|
+
* parking auxiliary calls to other models. `report`, once the wait is
|
|
1150
|
+
* found to bind, runs before anything is held: a caller that reports its
|
|
1151
|
+
* turn's end there (inference:failed) does so before the hold takes the
|
|
1152
|
+
* turn's retry, as every failure site does.
|
|
1047
1153
|
*/
|
|
1048
1154
|
private holdForProviderWait;
|
|
1049
1155
|
/**
|
|
@@ -1183,9 +1289,11 @@ export declare class AgentFramework {
|
|
|
1183
1289
|
getConversationRouter(): ConversationRouter | null;
|
|
1184
1290
|
/**
|
|
1185
1291
|
* Abort an in-flight inference for an agent. True when there was one to
|
|
1186
|
-
* stop: a stream
|
|
1292
|
+
* stop: a stream; a turn with no stream and one of its checks ahead (its
|
|
1187
1293
|
* hooks or compile, a wait to retry, the tool-result guard's wait), which
|
|
1188
|
-
* ends at that check, before it sends anything more
|
|
1294
|
+
* ends at that check, before it sends anything more; or a turn whose
|
|
1295
|
+
* continuation or retry is on its way (queued, kept by a provider hold,
|
|
1296
|
+
* parked at admission or in a scheduler pass), which ends here.
|
|
1189
1297
|
*/
|
|
1190
1298
|
abortInference(agentName: string, reason?: string): boolean;
|
|
1191
1299
|
/**
|
|
@@ -1239,6 +1347,10 @@ export declare class AgentFramework {
|
|
|
1239
1347
|
* a read-write workspace mount without an include for storage). */
|
|
1240
1348
|
private referenceFetcherInstance?;
|
|
1241
1349
|
private getReferenceFetcher;
|
|
1350
|
+
/** Configure an MCPL server: its config, for tool routing and the fetcher,
|
|
1351
|
+
* which reads a server's address and credential from it, and its address
|
|
1352
|
+
* in the reference registry, where a reference's stub reads it. */
|
|
1353
|
+
private setMcplServerConfig;
|
|
1242
1354
|
/** Register every RFC-005 reference in an MCPL peer's tool-result content
|
|
1243
1355
|
* against its server, then fetch by `mode`:
|
|
1244
1356
|
* - `register`: nothing. An in-process caller (executeMcplToolCall) may
|
|
@@ -1248,13 +1360,18 @@ export declare class AgentFramework {
|
|
|
1248
1360
|
* bound, so fetch_reference can fetch it.
|
|
1249
1361
|
* - `model`: eagerly fetch the ones inside the autofetch envelope (below
|
|
1250
1362
|
* the eager ceiling, connection origin — never worse than the server
|
|
1251
|
-
* having inlined the bytes
|
|
1252
|
-
*
|
|
1253
|
-
*
|
|
1363
|
+
* having inlined the bytes, for a reference whose claim is true; a fetch
|
|
1364
|
+
* it starts stops reading at the first chunk past that ceiling).
|
|
1365
|
+
* Failures are non-fatal: the stub then says fetch_reference instead of
|
|
1366
|
+
* a path, and the eager default doesn't choose that reference again.
|
|
1367
|
+
* - `script`: as `model`, then fetch every reference but a link ("eagerly lazy"): a
|
|
1254
1368
|
* script receiving a result is the strongest available signal that the
|
|
1255
1369
|
* bytes are wanted (scripts process, they do not browse), so the stub it
|
|
1256
1370
|
* receives carries a workspace path it can open directly.
|
|
1257
|
-
* A uri the result calls expired is fetched in no mode
|
|
1371
|
+
* A uri the result calls expired is fetched in no mode: by its blocks, or
|
|
1372
|
+
* by `claims` where given, those of everything a script's view of it
|
|
1373
|
+
* shows (scriptViewClaims), nested fields included, as the module
|
|
1374
|
+
* route's demand fetch reads them (Ada-1017, room-203 #201013). */
|
|
1258
1375
|
private autoFetchReferences;
|
|
1259
1376
|
/** Core agent_settings keys — extension keys must not collide with these. */
|
|
1260
1377
|
private static readonly AGENT_SETTINGS_CORE_KEYS;
|
|
@@ -1269,6 +1386,74 @@ export declare class AgentFramework {
|
|
|
1269
1386
|
private spillSettingsExtension;
|
|
1270
1387
|
private captureInferenceToolSnapshot;
|
|
1271
1388
|
private toolResultGuardSettingsExtension;
|
|
1389
|
+
/** Whether the agent wants the note on words that land in a closed channel:
|
|
1390
|
+
* on unless they've turned it off with agent_settings. */
|
|
1391
|
+
private closedChannelNoteOn;
|
|
1392
|
+
private closedChannelNoteSettingsExtension;
|
|
1393
|
+
/** What `who` is told when their words go to a channel that stays closed
|
|
1394
|
+
* because it closed or declined the channel itself (ChannelRegistry
|
|
1395
|
+
* closedByAgent), or undefined where nothing needs saying. Speech also
|
|
1396
|
+
* leaves a channel a module closed as it stands (speechOpens), but there
|
|
1397
|
+
* the module's own tool is the way back. Every other closed channel opens
|
|
1398
|
+
* on speech where this host directs its server's lifecycle, as it always
|
|
1399
|
+
* did, so the agent meets the change here, where speaking used to reopen
|
|
1400
|
+
* what it had closed. The channel is read on the server the words went
|
|
1401
|
+
* to. A channel whose transport is open, as when its server refused the
|
|
1402
|
+
* agent's close, gets none, since its traffic still flows.
|
|
1403
|
+
*
|
|
1404
|
+
* The rest is judged for its reader, as the opened notices' advice is
|
|
1405
|
+
* (channelOpenedNotices). That messages addressing it still reach it is
|
|
1406
|
+
* said where they land in its window: a push, and off a host that routes
|
|
1407
|
+
* conversations a channel's incoming message, is stored with the delivery
|
|
1408
|
+
* agent, where the residents' shared slot is read (residentHoldsTraffic),
|
|
1409
|
+
* and an ephemeral run's window is its own. What a closed channel
|
|
1410
|
+
* delivers beyond those is the connector's (slack-mcpl delivers ambient
|
|
1411
|
+
* traffic by its own subscription), so the note promises only those. One
|
|
1412
|
+
* connector state the host can't see makes that sentence false: a channel
|
|
1413
|
+
* muted with discord-mcpl's mute_channel delivers nothing, messages that
|
|
1414
|
+
* address the agent included. The agent that muted it knows. channel_open
|
|
1415
|
+
* is offered where the reader may call it (canAgentUseTool) and this host
|
|
1416
|
+
* may open the channel: everywhere but a server that's up without
|
|
1417
|
+
* channels.lifecycle (lifecycleWithheld), since a reconnecting server's
|
|
1418
|
+
* grant is empty only until its next exchange, and the note stays in the
|
|
1419
|
+
* window after that. */
|
|
1420
|
+
private closedChannelNoteFor;
|
|
1421
|
+
/** What an agent is told when a send tool's words go to a channel it tuned
|
|
1422
|
+
* out, or undefined where nothing needs saying. A send keeps the tune-out
|
|
1423
|
+
* (ChannelRegistry.openChannelNow), so the agent that sent there expecting
|
|
1424
|
+
* answers learns they still go to its subconscious. A send tool's answer
|
|
1425
|
+
* carries this, send_dm's included, or for a code_execution script's send
|
|
1426
|
+
* a notice in the agent's window: a tune-out diverts a DM too. The same setting
|
|
1427
|
+
* turns it off, a conversation agent gets none, and a failure while
|
|
1428
|
+
* working it out is logged and adds nothing, as for the closed-channel
|
|
1429
|
+
* note. */
|
|
1430
|
+
private tunedOutSendNote;
|
|
1431
|
+
/** How to stop the closed-channel note, said once wherever it appears, to
|
|
1432
|
+
* a reader that may call agent_settings (canAgentUseTool), with the space
|
|
1433
|
+
* before it; nothing to one that may not. */
|
|
1434
|
+
private closedChannelNoteOff;
|
|
1435
|
+
/** The closed-channel notes for an agent's words that landed in these
|
|
1436
|
+
* channels, or none when they've turned the note off. A conversation agent
|
|
1437
|
+
* gets none: channel_open is refused to it and its settings end with its
|
|
1438
|
+
* conversation, so neither what the note offers nor turning it off is its
|
|
1439
|
+
* own, and the resident that owns the channel gets the note for its own
|
|
1440
|
+
* words. The note is advice: if working it out fails, the words were still
|
|
1441
|
+
* delivered, so that's logged and nothing is added. */
|
|
1442
|
+
private closedChannelNotes;
|
|
1443
|
+
/**
|
|
1444
|
+
* A send tool's answer, with the closed-channel note where its words
|
|
1445
|
+
* stayed in a channel the agent closed or declined itself, or the tune-out
|
|
1446
|
+
* line where they went to one it tuned out, after the server's own words:
|
|
1447
|
+
* one more text block where the answer is a list of blocks, or a paragraph
|
|
1448
|
+
* where it's text. A code_execution script's send (`forScript`) keeps the
|
|
1449
|
+
* server's answer alone, since the script parses it, and the agent whose
|
|
1450
|
+
* script sent is told in its own window instead, as a notice. The channel
|
|
1451
|
+
* is the one the send went to on its server (resolveSendTarget), from the
|
|
1452
|
+
* id the send's answer or its call named. The note is advice: if working it
|
|
1453
|
+
* out fails, or the window can't take the notice, that's logged, and the
|
|
1454
|
+
* answer stays as it was.
|
|
1455
|
+
*/
|
|
1456
|
+
private noteSendIntoKeptChannel;
|
|
1272
1457
|
/** Every guard's annotation still running, for stop() (agent-framework #277). */
|
|
1273
1458
|
private readonly guardAnnotations;
|
|
1274
1459
|
/** Each guard that isn't idle, by agent name, as the guard reports it. An
|
|
@@ -1380,9 +1565,10 @@ export declare class AgentFramework {
|
|
|
1380
1565
|
* it queues, or a tool-result guard's retry, which its frame starts at
|
|
1381
1566
|
* once) holds no turn token until its start takes one. Once its turn's
|
|
1382
1567
|
* frame has let go of its token, its start can wait in the queue, a
|
|
1383
|
-
* provider hold
|
|
1384
|
-
*
|
|
1385
|
-
*
|
|
1568
|
+
* provider hold, a park on admission or a scheduler pass's hands. Its turn
|
|
1569
|
+
* is alive meanwhile. So is a turn whose call failed into a provider hold,
|
|
1570
|
+
* which keeps the turn's retry (TURN_RETRY), until that retry starts,
|
|
1571
|
+
* wherever it waits. These are the agents with one on its way. A
|
|
1386
1572
|
* `tool_results_ready` continuation follows a tool round left waiting with
|
|
1387
1573
|
* no stream, which only the direct Agent API makes (Agent's
|
|
1388
1574
|
* runInferenceWithInjections; the framework's own rounds wait with their
|
|
@@ -1391,9 +1577,13 @@ export declare class AgentFramework {
|
|
|
1391
1577
|
*/
|
|
1392
1578
|
private pendingContinuationAgents;
|
|
1393
1579
|
/** The agents with a turn alive: holding a turn token, or with a
|
|
1394
|
-
* continuation of their turn on its way. */
|
|
1580
|
+
* continuation of their turn, or its retry, on its way. */
|
|
1395
1581
|
private turnHolders;
|
|
1396
1582
|
private hasTurn;
|
|
1583
|
+
/** The provider hold keeping `agentName`'s turn for its retry (TURN_RETRY),
|
|
1584
|
+
* in words naming its end and its reason, and whether a stated wait holds
|
|
1585
|
+
* it; undefined when no hold keeps one. */
|
|
1586
|
+
private heldTurnRetry;
|
|
1397
1587
|
getHostModeStatus(): HostModeStatus;
|
|
1398
1588
|
/** Drain window bounds shared by every ingress (framework API, WS, HTTP,
|
|
1399
1589
|
* host/command). Below the floor a drain is meaningless; above the ceiling
|
|
@@ -1405,8 +1595,9 @@ export declare class AgentFramework {
|
|
|
1405
1595
|
* Enter quiesce mode: write the deferred-write queue, persist the flag,
|
|
1406
1596
|
* suppress gate deliveries, pause all MCPL data planes, and wait for
|
|
1407
1597
|
* in-flight turns to settle (turn-alive is a turn token, which spans
|
|
1408
|
-
* dequeue → settled teardown,
|
|
1409
|
-
*
|
|
1598
|
+
* dequeue → settled teardown, a continuation of the turn on its way to its
|
|
1599
|
+
* start, or the turn's retry, which a provider hold keeps or which waits
|
|
1600
|
+
* to start: turnHolders). Idempotent, but for the queue's write, which
|
|
1410
1601
|
* every call makes first: when the queue can't reach disk, because its
|
|
1411
1602
|
* write fails or it's over the cap, the call rejects with a
|
|
1412
1603
|
* QuiesceBlockedError and the host's mode as it was, unless it has
|
|
@@ -1416,8 +1607,8 @@ export declare class AgentFramework {
|
|
|
1416
1607
|
* On drain timeout the host STAYS quiesced (`drained: false` in the
|
|
1417
1608
|
* result); with `abandon: true` the undrained streams are cancelled via a
|
|
1418
1609
|
* dedicated cancel kind that settles the turn without feeding the
|
|
1419
|
-
* inference-failure accounting, and a turn whose continuation
|
|
1420
|
-
* started ends with
|
|
1610
|
+
* inference-failure accounting, and a turn whose continuation or retry
|
|
1611
|
+
* hasn't started ends with it dropped. Drain covers the framework's
|
|
1421
1612
|
* own turns: a caller of the direct Agent API (`Agent.runInference`) owns
|
|
1422
1613
|
* its turns' timing.
|
|
1423
1614
|
*/
|
|
@@ -1629,10 +1820,9 @@ export declare class AgentFramework {
|
|
|
1629
1820
|
* delegates to `Agent.buildActivationRequest`. No tokens are spent, no
|
|
1630
1821
|
* external MCPL server is contacted, no fold resolution is persisted and
|
|
1631
1822
|
* none of the compression its fold plan calls for is queued; the consumed
|
|
1632
|
-
* watermark and any prepared budget change are left alone; and
|
|
1633
|
-
*
|
|
1634
|
-
*
|
|
1635
|
-
* acceptance. In context-manager 0.14 its dry run leaves nothing else
|
|
1823
|
+
* watermark and any prepared budget change are left alone; and with the
|
|
1824
|
+
* thinking binding (`thinkingBinding.binds`), no binding record is
|
|
1825
|
+
* written. In context-manager 0.14 its dry run leaves nothing else
|
|
1636
1826
|
* behind but the release of an expired compression hold, as any compile
|
|
1637
1827
|
* does (see `Agent.compileWithInjections`). The preview keeps in-memory
|
|
1638
1828
|
* bookkeeping of its own, such as handing the context manager the
|
|
@@ -1658,6 +1848,16 @@ export declare class AgentFramework {
|
|
|
1658
1848
|
*
|
|
1659
1849
|
* Pass `{ injections: true }` to opt into full-fidelity gathering and accept
|
|
1660
1850
|
* those side effects (byte-faithful to a real activation's injected context).
|
|
1851
|
+
* An `afterUser` injection a start would store (stored-injections.ts) is
|
|
1852
|
+
* shown where that start's compile would render it, and one it would skip
|
|
1853
|
+
* isn't shown again; nothing is stored. The stand-in isn't weighed against
|
|
1854
|
+
* the budget or shaped as the stored row would be, so where the strategy
|
|
1855
|
+
* would cap, shard or leave out rows to fit it, the start's request
|
|
1856
|
+
* differs from the preview.
|
|
1857
|
+
*
|
|
1858
|
+
* What the dry compile selected, by kind, is `getRequestCompileStats` of the
|
|
1859
|
+
* request this returns. It doesn't count the stand-in, which is added after
|
|
1860
|
+
* the compile.
|
|
1661
1861
|
*/
|
|
1662
1862
|
previewActivation(agentName: string, opts?: {
|
|
1663
1863
|
injections?: boolean;
|
|
@@ -1726,11 +1926,21 @@ export declare class AgentFramework {
|
|
|
1726
1926
|
getModule(name: string): Module | null;
|
|
1727
1927
|
/**
|
|
1728
1928
|
* Add or replace (upsert) a gate policy at runtime. Validated and persisted
|
|
1729
|
-
* to gate.json; hot-applied in memory.
|
|
1730
|
-
*
|
|
1731
|
-
*
|
|
1732
|
-
*
|
|
1733
|
-
*
|
|
1929
|
+
* to gate.json; hot-applied in memory. Placement: `'prepend'` puts a rule
|
|
1930
|
+
* ahead of EVERYTHING (including addressed-message wake rules — see
|
|
1931
|
+
* EventGate.lintShadows); `{before: name}` / `{after: name}` anchor it
|
|
1932
|
+
* against a specific rule, which is usually what a sampler or debounce
|
|
1933
|
+
* actually wants. Every rule the change doesn't touch is written back as it
|
|
1934
|
+
* was written. Over a gate.json the gate doesn't use, the change is written
|
|
1935
|
+
* only if gate.json then loads, as when it replaces or removes the rule that
|
|
1936
|
+
* keeps it out. Fields the gate reads nowhere, and that aren't a slip of one
|
|
1937
|
+
* it does, are left out, and named to `onIgnoredFields`, called once the
|
|
1938
|
+
* change is made; a throw from it is logged, not thrown. Throws if no gate is
|
|
1939
|
+
* configured, the policy is invalid, the placement can't be made, gate.json
|
|
1940
|
+
* has no rule list a change could edit, it isn't used and the change doesn't
|
|
1941
|
+
* mend it, or it can't be read, isn't JSON or can't be written
|
|
1942
|
+
* (EventGate.addPolicy). A refusal leaves gate.json as it is; a write that
|
|
1943
|
+
* fails after its open may leave it part-written, and its error says so.
|
|
1734
1944
|
*/
|
|
1735
1945
|
addGatePolicy(rawPolicy: unknown, options?: {
|
|
1736
1946
|
position?: 'append' | 'prepend' | {
|
|
@@ -1738,10 +1948,14 @@ export declare class AgentFramework {
|
|
|
1738
1948
|
} | {
|
|
1739
1949
|
after: string;
|
|
1740
1950
|
};
|
|
1951
|
+
onIgnoredFields?: (notes: string[]) => void;
|
|
1741
1952
|
}): import('./gate/types.js').GatePolicy;
|
|
1742
1953
|
/**
|
|
1743
1954
|
* Remove a gate policy by name at runtime. Returns false if it didn't exist.
|
|
1744
|
-
* Throws if no gate is configured.
|
|
1955
|
+
* Throws if no gate is configured, gate.json has no rule list a change could
|
|
1956
|
+
* edit, it isn't used and the removal doesn't mend it, or it can't be read,
|
|
1957
|
+
* isn't JSON or can't be written (EventGate.removePolicy); the rules in
|
|
1958
|
+
* force then stay as they were.
|
|
1745
1959
|
*/
|
|
1746
1960
|
removeGatePolicy(name: string): boolean;
|
|
1747
1961
|
/** Current gate policy names (freshest on-disk view). Empty when no gate. */
|
|
@@ -2108,7 +2322,8 @@ export declare class AgentFramework {
|
|
|
2108
2322
|
* by stop() while it runs.
|
|
2109
2323
|
*
|
|
2110
2324
|
* The branch moves under every agent sharing the store, so the switch
|
|
2111
|
-
* reserves the store as a surgery does: every agent must be idle
|
|
2325
|
+
* reserves the store as a surgery does: every agent must be idle with no
|
|
2326
|
+
* turn alive (no continuation or held retry of one on its way), or it is
|
|
2112
2327
|
* refused (OperatorActionError 'agent-busy'), and no turn starts until the
|
|
2113
2328
|
* switch is done.
|
|
2114
2329
|
*/
|
|
@@ -2560,8 +2775,9 @@ export declare class AgentFramework {
|
|
|
2560
2775
|
* and keeping the agent registered would just grow every agent scan and
|
|
2561
2776
|
* broadcast filter forever. Its window is released now, or, while the host
|
|
2562
2777
|
* is quiesced, at resume (releaseWindowNowOrAfterResume); when stop() ends
|
|
2563
|
-
* it then, stop()'s pass for postponed releases passes on
|
|
2564
|
-
*
|
|
2778
|
+
* it then, stop()'s pass for postponed releases passes on what it left
|
|
2779
|
+
* unread that the primary takes in its place instead (passesToPrimary:
|
|
2780
|
+
* failed replies, channel notices, module writes). No binding names it
|
|
2565
2781
|
* by then: the idle sweep unbinds its channel as the closure begins,
|
|
2566
2782
|
* stop() unbinds it just before it ends the fork, and a spawn whose fork
|
|
2567
2783
|
* stop() has ended binds nothing (spawnConversationAgent). The fork's
|
|
@@ -2621,14 +2837,22 @@ export declare class AgentFramework {
|
|
|
2621
2837
|
* only that messages addressing the agent reach it whether or not it opens
|
|
2622
2838
|
* the channel: it is shown only when one has arrived from a closed channel,
|
|
2623
2839
|
* and both servers deliver them either way. What else arrives is for the
|
|
2624
|
-
* server to say on its push. Option 1 says a reply
|
|
2625
|
-
*
|
|
2626
|
-
*
|
|
2627
|
-
*
|
|
2628
|
-
*
|
|
2629
|
-
* (discord-mcpl sends
|
|
2630
|
-
*
|
|
2631
|
-
* decision time.
|
|
2840
|
+
* server to say on its push. Option 1 says what a reply does, which
|
|
2841
|
+
* speechOpens decides: a reply opens a closed channel nobody decided to keep
|
|
2842
|
+
* closed, and leaves one the agent closed or declined itself closed. What
|
|
2843
|
+
* else reaches the agent from a channel left closed is its server's to say
|
|
2844
|
+
* on its push, so the option says nothing about it. When the surface tracks
|
|
2845
|
+
* a missed-ambient tally (discord-mcpl sends
|
|
2846
|
+
* `missedMessages`/`missedCharacters` in push origin), the invitation shows
|
|
2847
|
+
* the count — the cost of staying out, as a number, at decision time.
|
|
2848
|
+
*
|
|
2849
|
+
* No invitation on a direct message (`chat:dm`): every message of a DM is
|
|
2850
|
+
* addressed, so it reaches the agent open or closed, and there is nothing
|
|
2851
|
+
* to miss or open. A DM registers closed, and stays closed until the agent
|
|
2852
|
+
* answers it, or for good once the agent closes it, so without this a DM
|
|
2853
|
+
* would carry the block. The tag describes the message, not the channel:
|
|
2854
|
+
* a whisper tagged `chat:dm` inside a shared channel that is closed
|
|
2855
|
+
* carries no invitation either.
|
|
2632
2856
|
*/
|
|
2633
2857
|
private buildClosedChannelInvitation;
|
|
2634
2858
|
/**
|
|
@@ -2718,7 +2942,8 @@ export declare class AgentFramework {
|
|
|
2718
2942
|
/** Queue a wake for each agent of the batch's audience, when its latest
|
|
2719
2943
|
* occurrence triggers inference. `plain`: an ordinary push wake, without
|
|
2720
2944
|
* the subject a withdrawal of the batch's wakes goes by, for a render
|
|
2721
|
-
* placed in its agent's deferred queue (wakeToRead), at `readsDeferredWrite
|
|
2945
|
+
* placed in its agent's deferred queue (wakeToRead), at `readsDeferredWrite`,
|
|
2946
|
+
* marked ambient when every notice the render folds was (`allAmbient`). */
|
|
2722
2947
|
private queueCoalescedWakes;
|
|
2723
2948
|
/** Withdraw unstarted wakes whose sole cause is this subject (§4.2). */
|
|
2724
2949
|
private cancelCoalescedWakes;
|
|
@@ -2754,6 +2979,34 @@ export declare class AgentFramework {
|
|
|
2754
2979
|
* a fork is that fork's conversation, so no other agent takes it.
|
|
2755
2980
|
*/
|
|
2756
2981
|
private mayTakeGateRoute;
|
|
2982
|
+
/**
|
|
2983
|
+
* The one channel a wake's channel names: `channelId` on `serverId` when
|
|
2984
|
+
* the wake gives its server, otherwise the one registered channel that id,
|
|
2985
|
+
* or its server-qualified name, means (ChannelRegistry.channelsNamed).
|
|
2986
|
+
* Undefined when it means none or several: channel ids are unique only
|
|
2987
|
+
* within one server's connection (MCPL §14.2), and a name two servers'
|
|
2988
|
+
* channels answer to is never resolved to either.
|
|
2989
|
+
*/
|
|
2990
|
+
private channelNamed;
|
|
2991
|
+
/**
|
|
2992
|
+
* Explicit mode's typing channel for one start of a turn, which has no
|
|
2993
|
+
* locus, read once as the start opens (driveStream then shows what the
|
|
2994
|
+
* start showed, TurnRouting.typing): where that start's wake came from,
|
|
2995
|
+
* its trigger's channel with its server (channelNamed), so a start batched
|
|
2996
|
+
* with a new wake shows typing where that wake came from. Not the turn's
|
|
2997
|
+
* trigger channel, which a channel_open moves as the turn's default
|
|
2998
|
+
* outgoing channel. A start whose wake names no one channel, as a budget
|
|
2999
|
+
* restart's or a re-inference's names none, keeps the channel the turn
|
|
3000
|
+
* shows typing in (TurnRouting.typing), showing it again where a stop or
|
|
3001
|
+
* a failed start ended the indicator, since the turn is still at work
|
|
3002
|
+
* there; a turn that has shown none, as a heartbeat's, shows none. A guard
|
|
3003
|
+
* retry's wake is its start's, read again. In a turn that has no channel
|
|
3004
|
+
* (TurnRouting.noChannel), a wake named without its server isn't read: a
|
|
3005
|
+
* retry's trigger names it again, and reading it then could take a
|
|
3006
|
+
* channel the turn never had. A wake that gives its server, as every one
|
|
3007
|
+
* the framework makes for a channel does, names that pair.
|
|
3008
|
+
*/
|
|
3009
|
+
private explicitTypingChannel;
|
|
2757
3010
|
/**
|
|
2758
3011
|
* Derive the MCPL composite channel id (the outbound routing locus) for a
|
|
2759
3012
|
* push event from its server-defined `origin`, if it carries one.
|
|
@@ -2829,7 +3082,9 @@ export declare class AgentFramework {
|
|
|
2829
3082
|
private draftTime;
|
|
2830
3083
|
/** A draft's opening words, for the drafts tool's listing only. */
|
|
2831
3084
|
private static draftPreview;
|
|
2832
|
-
|
|
3085
|
+
/** A destination as the agent is shown it: its label, with its name as
|
|
3086
|
+
* ChannelRegistry.nameShown gives it. */
|
|
3087
|
+
private destinationText;
|
|
2833
3088
|
/** One line per draft: id, state, when, why, size, preview. */
|
|
2834
3089
|
private draftLine;
|
|
2835
3090
|
/** A draft's state in words that claim only what is known. */
|
|
@@ -2860,6 +3115,16 @@ export declare class AgentFramework {
|
|
|
2860
3115
|
* queue names.
|
|
2861
3116
|
*/
|
|
2862
3117
|
private noticeUnnoticedDrafts;
|
|
3118
|
+
/**
|
|
3119
|
+
* Turn start, every one: where the agent's history holds neither its
|
|
3120
|
+
* latest direct write to a mount nor the notice of its departure
|
|
3121
|
+
* from it, as after an undo or another move of the store's head away from
|
|
3122
|
+
* that write, the workspace's notice that those writes are still on disk
|
|
3123
|
+
* goes into the history, privately, before the compile, as the drafts
|
|
3124
|
+
* notice does, and the workspace keeps its id (headMoveNotice). On an
|
|
3125
|
+
* unmoved head it finds nothing due and stores nothing.
|
|
3126
|
+
*/
|
|
3127
|
+
private noticeHeadMoves;
|
|
2863
3128
|
/**
|
|
2864
3129
|
* Logical turn end, after the turn's deferred notices are flushed: record
|
|
2865
3130
|
* as noticed exactly the drafts a stored message names (the receipt, a
|
|
@@ -2899,6 +3164,9 @@ export declare class AgentFramework {
|
|
|
2899
3164
|
* drafts. Private to the calling resident. `resend` is an explicit send:
|
|
2900
3165
|
* each draft is published verbatim, in order, through the normal publish
|
|
2901
3166
|
* executor, its attempt journaled durably before the request leaves.
|
|
3167
|
+
* `turn` is the turn the call was made in (callingTurnOf), none for a
|
|
3168
|
+
* call made outside the agent's current turn: a resend's destination names
|
|
3169
|
+
* its own channels (ownChannels) by their ids, and its sends engage it.
|
|
2902
3170
|
*/
|
|
2903
3171
|
private handleDraftsTool;
|
|
2904
3172
|
/** Why a draft can't be resent now (dismissed, or possibly already posted
|
|
@@ -2920,6 +3188,17 @@ export declare class AgentFramework {
|
|
|
2920
3188
|
* ([discord-send-failed]); this is the success half.
|
|
2921
3189
|
*/
|
|
2922
3190
|
private appendProseDeliveryReceipt;
|
|
3191
|
+
/**
|
|
3192
|
+
* The closed-channel note alone, in a send's words, at explicit mode's turn
|
|
3193
|
+
* end, which has no `[delivered]` receipt since the agent named every
|
|
3194
|
+
* destination itself. A `>>` into a channel the agent closed or declined
|
|
3195
|
+
* leaves it closed, so the note goes wherever the turn's speech stayed in
|
|
3196
|
+
* such a channel, once per channel. It goes through addMessage, as the
|
|
3197
|
+
* open notices do: held while the agent has a turn alive and written at
|
|
3198
|
+
* that turn's next boundary, so it reaches the agent once and never
|
|
3199
|
+
* mid-turn. No-op otherwise.
|
|
3200
|
+
*/
|
|
3201
|
+
private appendClosedChannelNoteAlone;
|
|
2923
3202
|
/**
|
|
2924
3203
|
* Announce-on-change locus notice (turn-frozen routing). Appends a durable
|
|
2925
3204
|
* `[routing]` window message when the turn's effective outbound locus
|
|
@@ -2965,6 +3244,65 @@ export declare class AgentFramework {
|
|
|
2965
3244
|
* window's all the same, so it's returned, and a tool boundary injects it.
|
|
2966
3245
|
*/
|
|
2967
3246
|
private storeDueClock;
|
|
3247
|
+
/**
|
|
3248
|
+
* Store `agent`'s `afterUser` injections in its own window, as the
|
|
3249
|
+
* messages `compile()` would have placed after the last user message, and
|
|
3250
|
+
* return the injections left for `compile()` to place: the rest, and any
|
|
3251
|
+
* that couldn't be stored (stored-injections.ts, #155 part 5). Which are
|
|
3252
|
+
* stored, and which skipped, is planInjectionStores'.
|
|
3253
|
+
*
|
|
3254
|
+
* Nothing is stored while the window is held (slotHeldFrom: the host is
|
|
3255
|
+
* quiesced, or another reader of the residents' shared slot has a turn
|
|
3256
|
+
* alive, as for a clock row): `compile()` places what the plan would have
|
|
3257
|
+
* stored, and what it skips, being in view already, isn't placed again.
|
|
3258
|
+
* Rows are written in the order gathered. A row whose write throws is
|
|
3259
|
+
* placed by `compile()` instead, with every row after it, unless the
|
|
3260
|
+
* read-back shows it landed; where the read-back fails, a row whose write
|
|
3261
|
+
* returned counts as landed and the rest are placed, so the request may
|
|
3262
|
+
* carry a landed one twice, which is logged as unknown.
|
|
3263
|
+
*/
|
|
3264
|
+
private storeInjections;
|
|
3265
|
+
/**
|
|
3266
|
+
* Which of `injections` a start stores in `agent`'s window, and which it
|
|
3267
|
+
* leaves for `compile()`. Each source's stored kind (isStoredKind), by
|
|
3268
|
+
* namespace, is one unit. A unit is skipped, neither stored nor placed,
|
|
3269
|
+
* when the copy the agent will read as that namespace's current one has
|
|
3270
|
+
* every part of it with the same content: the newest copy this agent
|
|
3271
|
+
* stored since its last request compiled to send, where a start stored one
|
|
3272
|
+
* and its compile then didn't record, as when it threw
|
|
3273
|
+
* (Agent.unsentInjection), and otherwise the
|
|
3274
|
+
* newest stored unit of that namespace the last request held
|
|
3275
|
+
* (Agent.renderedInjection). It's where the agent saw it, or will see it
|
|
3276
|
+
* at this compile, and placing it again would move it; a fold or scroll-out
|
|
3277
|
+
* since costs one request, as below. A part the strategy cut at its
|
|
3278
|
+
* per-message cap, or stripped an image from, counts as held, since a new
|
|
3279
|
+
* copy would meet the same. One a fold has summarized, a strategy's window
|
|
3280
|
+
* has scrolled past, a throwing write left part-stored, or that no request
|
|
3281
|
+
* since this agent started has held (and no failed start since has
|
|
3282
|
+
* stored), is stored again at the next start,
|
|
3283
|
+
* so the agent has the current copy at the cost of one more row: a fold
|
|
3284
|
+
* between two starts leaves the request after it with the summary's word,
|
|
3285
|
+
* and the start after that stores it again. The rows to store come in the order gathered,
|
|
3286
|
+
* as `compile()` would have placed them. A stored row is appended, so
|
|
3287
|
+
* where the window ends on a user message (a turn's start, a restart
|
|
3288
|
+
* after tool results) it lands where `compile()` would have placed it;
|
|
3289
|
+
* where it ends on the agent's latest reply (a wake with nothing new), it
|
|
3290
|
+
* lands after that reply, where `compile()` placed it after the last user
|
|
3291
|
+
* message, before the reply, or at the end when there was none.
|
|
3292
|
+
* Undefined when there's nothing of the stored kind.
|
|
3293
|
+
*/
|
|
3294
|
+
private planInjectionStores;
|
|
3295
|
+
/**
|
|
3296
|
+
* Whether a write the framework makes into `agent`'s window of its own
|
|
3297
|
+
* accord (a clock row, a batched wake's line) waits: while the host is
|
|
3298
|
+
* quiesced, or, for a reader of the residents' shared slot (the
|
|
3299
|
+
* subconscious, which reads it through a merged view, included), while
|
|
3300
|
+
* another reader of it has a turn alive, where it would land inside that
|
|
3301
|
+
* turn.
|
|
3302
|
+
*/
|
|
3303
|
+
private slotHeldFrom;
|
|
3304
|
+
/** Rows isNewestIn reads back past clock rows and stored injections. */
|
|
3305
|
+
private static readonly NEWEST_SCAN_ROWS;
|
|
2968
3306
|
/** Rows a window's last-clock scan reads at a time. */
|
|
2969
3307
|
private static readonly CLOCK_SCAN_ROWS;
|
|
2970
3308
|
/** What the next clock is planned from: the window's newest row's time and
|
|
@@ -2997,7 +3335,7 @@ export declare class AgentFramework {
|
|
|
2997
3335
|
*/
|
|
2998
3336
|
private noteForOtherResidents;
|
|
2999
3337
|
/**
|
|
3000
|
-
* Show the turn's typing indicator in `
|
|
3338
|
+
* Show the turn's typing indicator in `channel`, stopping the one it last
|
|
3001
3339
|
* showed elsewhere: this stream's, or one an earlier stream of the turn
|
|
3002
3340
|
* left running when it handed the turn on.
|
|
3003
3341
|
*/
|
|
@@ -3031,8 +3369,9 @@ export declare class AgentFramework {
|
|
|
3031
3369
|
* when the server next registers the channel), or an open that the agent's
|
|
3032
3370
|
* own delivery or reply caused (`opened-by-delivery`, `opened-by-reply`),
|
|
3033
3371
|
* once its transport is confirmed. It names `channel_close` as the opt-out
|
|
3034
|
-
* (neither the
|
|
3035
|
-
*
|
|
3372
|
+
* (neither the agent's own speech there, the subscription policy nor the
|
|
3373
|
+
* server's default reopens a channel the agent closed: speechOpens and
|
|
3374
|
+
* ensureInitialDesiredState) only where the agent it's addressed to can
|
|
3036
3375
|
* call it for every channel it names (canCloseChannels): a conversation
|
|
3037
3376
|
* fork may close only its home channel, and an agent's allowedTools can leave
|
|
3038
3377
|
* channel_close out. The other residents can read it too, where several
|
|
@@ -3077,14 +3416,14 @@ export declare class AgentFramework {
|
|
|
3077
3416
|
*/
|
|
3078
3417
|
private channelOpenedNotices;
|
|
3079
3418
|
/**
|
|
3080
|
-
* Whether `who` can call channel_close for every one of `
|
|
3419
|
+
* Whether `who` can call channel_close for every one of `channels` here:
|
|
3081
3420
|
* its allowedTools hold it (canAgentUseTool), and a conversation fork,
|
|
3082
3421
|
* whose channel_close dispatchChannelToolCall refuses for any channel but
|
|
3083
3422
|
* its home, only for its home.
|
|
3084
3423
|
*/
|
|
3085
3424
|
private canCloseChannels;
|
|
3086
3425
|
/**
|
|
3087
|
-
* Whether `who` holds the traffic of every one of `
|
|
3426
|
+
* Whether `who` holds the traffic of every one of `channels`, so that
|
|
3088
3427
|
* what an open channel delivers is in its window. Where conversations are
|
|
3089
3428
|
* routed, an incoming message goes to the fork its channel is bound to, or
|
|
3090
3429
|
* nowhere, and never to the primary (handleMcplChannelIncoming), so a fork
|
|
@@ -3186,8 +3525,77 @@ export declare class AgentFramework {
|
|
|
3186
3525
|
* a turn abandoned by a quiesce asks for none.
|
|
3187
3526
|
*/
|
|
3188
3527
|
private requestProseContinuation;
|
|
3528
|
+
/**
|
|
3529
|
+
* autoContinue (AgentConfig.autoContinue): after a turn the model ended
|
|
3530
|
+
* itself (AUTO_CONTINUE_STOP_REASONS), with prose or with nothing, queue
|
|
3531
|
+
* another, unless its last word was a skip (`>>skip_reply`, or a hybrid
|
|
3532
|
+
* `>>>skip_reply` hold still standing). Runs at the logical turn end of a
|
|
3533
|
+
* stream's `complete`, after the turn's deliveries and `[delivered]`
|
|
3534
|
+
* receipt, and only when the turn asked for no ` !` continuation (that one
|
|
3535
|
+
* runs instead). A tool that ends the turn (skip_reply, sleep) never
|
|
3536
|
+
* reaches here, and clears the run's count.
|
|
3537
|
+
*
|
|
3538
|
+
* It continues only an agent that has a way to stop it is offered: the
|
|
3539
|
+
* skip_reply tool, or in explicit/hybrid mode a skip envelope. It leaves
|
|
3540
|
+
* a turn whose closing prose bounced to the bounce, and never continues an
|
|
3541
|
+
* ephemeral run or a conversation fork. The wake names
|
|
3542
|
+
* the turn's locus, or the unresolved channel of a turn that had none, so
|
|
3543
|
+
* the next turn speaks, or doesn't, where this one did; a batched message's
|
|
3544
|
+
* channel outranks it. Its mark (InferenceRequest.autoContinueRun) holds
|
|
3545
|
+
* what the `[continue]` row says, written as the turn starts
|
|
3546
|
+
* (startAgentStream). A run is capped at maxConsecutive; the last allowed
|
|
3547
|
+
* row says so, and the cap holds until a turn starts with a cause of its own.
|
|
3548
|
+
*/
|
|
3549
|
+
private autoContinueAfterTurn;
|
|
3550
|
+
/** How an autoContinue agent stops a run, as its `[continue]` row says it,
|
|
3551
|
+
* or undefined when no way is offered: the skip_reply tool when the
|
|
3552
|
+
* channel registry offers it and the agent may call it, else a skip
|
|
3553
|
+
* envelope in explicit or hybrid mode. */
|
|
3554
|
+
private autoContinueStop;
|
|
3555
|
+
/**
|
|
3556
|
+
* Store a continuation's `[continue]` row in the agent's window as its turn
|
|
3557
|
+
* starts (startAgentStream), with the run's count as it stands and the
|
|
3558
|
+
* agent's cap. False when it couldn't be stored.
|
|
3559
|
+
*/
|
|
3560
|
+
private writeAutoContinueNotice;
|
|
3561
|
+
/** Whether another reader of the residents' shared slot has a turn alive,
|
|
3562
|
+
* so no row may be written there now (as storeDueClock checks). */
|
|
3563
|
+
private sharedSlotBusy;
|
|
3564
|
+
/** A continuation whose turn doesn't run: the run's count goes back to
|
|
3565
|
+
* what it was before it was queued. */
|
|
3566
|
+
private giveBackAutoContinue;
|
|
3189
3567
|
/** The agent's routing state for its current turn, made when it has none. */
|
|
3190
3568
|
private routingOf;
|
|
3569
|
+
/**
|
|
3570
|
+
* A turn's own channels, every channel that has been its trigger or its
|
|
3571
|
+
* locus (TurnRouting.wasIn), so a channel_open or a re-pin adds one and
|
|
3572
|
+
* drops none: a `>>` target, a drafts resend's destination or a channel
|
|
3573
|
+
* tool's name one of them answers to by its id means that channel, on its
|
|
3574
|
+
* server (ChannelRegistry.ownChannelNamed). A tool call takes them only
|
|
3575
|
+
* when it is made inside that turn (callOwnChannels).
|
|
3576
|
+
*/
|
|
3577
|
+
private ownChannels;
|
|
3578
|
+
/**
|
|
3579
|
+
* The agent's current turn, where a tool call was made inside it, else
|
|
3580
|
+
* none: a call made outside it, such as a script's left running after its
|
|
3581
|
+
* turn, carries no turn (ToolCall.callerTurnId), and a script's call in a
|
|
3582
|
+
* turn other than the one that started the script isn't that turn's. The
|
|
3583
|
+
* one test for both what a call's names mean (callOwnChannels) and which
|
|
3584
|
+
* turn's routing it may change: a channel_open's move of the trigger and
|
|
3585
|
+
* locus, and the engagement of a send or a drafts resend. Read while the
|
|
3586
|
+
* call is dispatched, since a script's start turn is kept only then.
|
|
3587
|
+
*/
|
|
3588
|
+
private callingTurnOf;
|
|
3589
|
+
/** What a publish a call makes is credited with having read
|
|
3590
|
+
* (Agent.notePublished): its agent's consumed watermark at the call, or,
|
|
3591
|
+
* for a script's call, the watermark when the run call started the
|
|
3592
|
+
* script. A script is written then, and a later round's wait that watches
|
|
3593
|
+
* it shares the turn's id but not what the agent has read since, so the
|
|
3594
|
+
* script's words can't answer anything injected after it started. */
|
|
3595
|
+
private publishReadThrough;
|
|
3596
|
+
/** The own channels (ownChannels) of the turn a tool call was made in
|
|
3597
|
+
* (callingTurnOf), and none for a call made outside it. */
|
|
3598
|
+
private callOwnChannels;
|
|
3191
3599
|
/**
|
|
3192
3600
|
* Explicit-prose-routing delivery gateway (docs/explicit-prose-routing.md),
|
|
3193
3601
|
* entered directly: parse the `>>` prefix, resolve the target, deliver, or
|
|
@@ -3290,6 +3698,24 @@ export declare class AgentFramework {
|
|
|
3290
3698
|
* lands now, or at that frame's end.
|
|
3291
3699
|
*/
|
|
3292
3700
|
private endContinuedTurn;
|
|
3701
|
+
/**
|
|
3702
|
+
* After a failure a provider hold would take: once stop() has closed
|
|
3703
|
+
* admission, the hold installs nothing (holdForProviderWait,
|
|
3704
|
+
* holdProviderAcceleration), so no retry follows the turn's
|
|
3705
|
+
* inference:failed, and the turn ends as a retry a stop cancelled ends, with
|
|
3706
|
+
* an inference:aborted saying so. Nothing is written. True when it ended
|
|
3707
|
+
* the turn.
|
|
3708
|
+
*/
|
|
3709
|
+
private endFailureAtStop;
|
|
3710
|
+
/**
|
|
3711
|
+
* A turn's start whose failure a provider hold took (or, once stop() has
|
|
3712
|
+
* closed admission, would have: endFailureAtStop) ends here. Its window
|
|
3713
|
+
* closes now, not at the start's finally a few microtasks on: no check of
|
|
3714
|
+
* this start is ahead, and a stop made after the failure's report must
|
|
3715
|
+
* find the held retry (abortInference's drop), not a window nothing will
|
|
3716
|
+
* collect.
|
|
3717
|
+
*/
|
|
3718
|
+
private endHeldStart;
|
|
3293
3719
|
/**
|
|
3294
3720
|
* End a turn that beginAgentTurn drops before it sends anything. The turn
|
|
3295
3721
|
* emitted inference:started, and listeners that bracket a turn, such as a
|
|
@@ -3333,12 +3759,15 @@ export declare class AgentFramework {
|
|
|
3333
3759
|
/**
|
|
3334
3760
|
* Execute a tool call and return the result.
|
|
3335
3761
|
* Routes to the appropriate handler (module registry or MCPL).
|
|
3336
|
-
*
|
|
3762
|
+
* Its one caller in the framework is the operator's puppet
|
|
3763
|
+
* (puppetToolCall), which puts the agent's inline cap on the call as
|
|
3764
|
+
* resultMaxChars; a host may call it as well.
|
|
3337
3765
|
*
|
|
3338
|
-
* This public entry always carries AGENT origin.
|
|
3339
|
-
*
|
|
3340
|
-
*
|
|
3341
|
-
*
|
|
3766
|
+
* This public entry always carries AGENT origin. Its callers act for an
|
|
3767
|
+
* agent, the puppet as the agent and a host for the model it runs, and
|
|
3768
|
+
* provenance must identify which internal path a call entered through — a
|
|
3769
|
+
* public method shared with model callers can never confer module trust,
|
|
3770
|
+
* whatever the input claims. Module origin
|
|
3342
3771
|
* exists only through the private closure handed to ModuleRegistry
|
|
3343
3772
|
* (ctx.callTool → executeToolCallFrom with {kind:'module'}), which is exempt
|
|
3344
3773
|
* from agent allowlists. Registered agents' allowedTools is enforced at
|
|
@@ -3392,7 +3821,42 @@ export declare class AgentFramework {
|
|
|
3392
3821
|
/** puppetToolCall's work, run where stop() can wait for it. */
|
|
3393
3822
|
private runPuppetToolCall;
|
|
3394
3823
|
private executeToolCallFrom;
|
|
3395
|
-
/**
|
|
3824
|
+
/**
|
|
3825
|
+
* RFC-014: the calls toolsets--act resolved to a server's dynamic tool,
|
|
3826
|
+
* with the instance each is for (`_meta["mcpl/instance"]`, §5.5). The MCPL
|
|
3827
|
+
* dispatch paths read it: such a call isn't refused as a dynamic tool
|
|
3828
|
+
* called by name, and carries its instance. Nothing else about it differs
|
|
3829
|
+
* from a direct call of the tool. Created on first use, so a framework
|
|
3830
|
+
* assembled field by field (as unit tests do) needs no setup for it.
|
|
3831
|
+
*/
|
|
3832
|
+
private toolsetActCalls?;
|
|
3833
|
+
/** A toolsets--act call resolved (resolveAct) to the call of the server's
|
|
3834
|
+
* tool it makes, under that tool's model-facing name and with its
|
|
3835
|
+
* arguments, its id kept; or the reason it can't be sent. */
|
|
3836
|
+
private resolveToolsetAct;
|
|
3837
|
+
/**
|
|
3838
|
+
* RFC-014 §8.2: a toolsets--act call from the agent (the model's, or a
|
|
3839
|
+
* script's) goes down the path a direct call of the server's tool takes
|
|
3840
|
+
* (dispatchMcplToolCall): its agent's allowedTools, the server's tool
|
|
3841
|
+
* policy, the state exchange, RFC-005's reading of the result, the tool
|
|
3842
|
+
* change shown after it, and RFC-007's lifecycle, which describes the call
|
|
3843
|
+
* as that tool, with its arguments, before it opens. Only
|
|
3844
|
+
* `_meta["mcpl/instance"]` is added. A call act can't resolve is refused
|
|
3845
|
+
* before anything is sent.
|
|
3846
|
+
*/
|
|
3847
|
+
private dispatchToolsetAct;
|
|
3848
|
+
/**
|
|
3849
|
+
* RFC-014 §6.2: a tool result that goes to the agent, with the tool change
|
|
3850
|
+
* its hints made (applied as the result was read) told after the server's
|
|
3851
|
+
* content; taking it means it isn't told again as a notice. The result
|
|
3852
|
+
* itself when there's none, as for every server without toolHints.
|
|
3853
|
+
*/
|
|
3854
|
+
private withToolsetChange;
|
|
3855
|
+
/** A programmatic call of an MCPL tool: `serverId` and `prefix` as
|
|
3856
|
+
* resolveMcplTool matched them, or as toolsets--act resolved them
|
|
3857
|
+
* (toolsetActCalls). Its RFC-014 tool change isn't shown with its result,
|
|
3858
|
+
* which goes to its caller, not necessarily to the agent: it's told as a
|
|
3859
|
+
* notice (ToolsetController.tellUnlessClaimed). */
|
|
3396
3860
|
private executeMcplToolCall;
|
|
3397
3861
|
/** Event-pushing wrapper for the model-driven dispatch path. */
|
|
3398
3862
|
private dispatchCodeExecutionToolCall;
|
|
@@ -3441,12 +3905,21 @@ export declare class AgentFramework {
|
|
|
3441
3905
|
/** The tools a script of this agent may call now: the agent's own surface, without code_execution. */
|
|
3442
3906
|
private scriptTools;
|
|
3443
3907
|
/**
|
|
3444
|
-
* The first read-write mount without an include
|
|
3445
|
-
* keeps its own files there
|
|
3446
|
-
*
|
|
3447
|
-
*
|
|
3908
|
+
* The first read-write mount without an include that isn't configured
|
|
3909
|
+
* direct, or null. The framework keeps its own files there
|
|
3910
|
+
* (`tool-results/`, `refs/`). A mount with an include holds only the files
|
|
3911
|
+
* it names, so it would refuse them, and a setup whose only writable mount
|
|
3912
|
+
* has one, or is direct, is treated as having none.
|
|
3448
3913
|
*/
|
|
3449
3914
|
private firstWritableMountName;
|
|
3915
|
+
/**
|
|
3916
|
+
* Why firstWritableMountName found no mount, for the words that say so:
|
|
3917
|
+
* none writable without an include, or only mounts configured direct, which
|
|
3918
|
+
* it passes over.
|
|
3919
|
+
*/
|
|
3920
|
+
private noFileMountText;
|
|
3921
|
+
/** Whether firstWritableMountName passed over a writable mount without an include because it's configured direct. */
|
|
3922
|
+
private directPassedOver;
|
|
3450
3923
|
/**
|
|
3451
3924
|
* A script's word to its agent: a wake_agent() payload, or the ending of a
|
|
3452
3925
|
* left script that failed, crashed or was stopped at its limit. It enters
|
|
@@ -3486,15 +3959,16 @@ export declare class AgentFramework {
|
|
|
3486
3959
|
* the image stays reachable by provenance after the bytes leave the wire.
|
|
3487
3960
|
*
|
|
3488
3961
|
* The live copy is the stored text itself unless the result is a content
|
|
3489
|
-
* array carrying an inline image
|
|
3490
|
-
*
|
|
3491
|
-
*
|
|
3492
|
-
* each
|
|
3493
|
-
*
|
|
3962
|
+
* array carrying an inline image whose links and markers fit the cap
|
|
3963
|
+
* together (goesNative). Then `live` holds the blocks this text was made
|
|
3964
|
+
* from, which toMembraneToolResult sends as native blocks (nativeContent),
|
|
3965
|
+
* showing each image, stub and marker whole and each text block up to where
|
|
3966
|
+
* it cuts that block at the cap (`maxChars`, toolResultCutAt), so those are
|
|
3967
|
+
* the ranges of the text it showed.
|
|
3494
3968
|
*/
|
|
3495
3969
|
private storedToolResultText;
|
|
3496
3970
|
/** Where a tool result labelled `label` is written: `<first writable
|
|
3497
|
-
* mount without an include>/tool-results/<label>.txt` (see
|
|
3971
|
+
* mount without an include, not configured direct>/tool-results/<label>.txt` (see
|
|
3498
3972
|
* firstWritableMountName), or null when there is no such mount. */
|
|
3499
3973
|
private toolResultFilePlace;
|
|
3500
3974
|
/**
|
|
@@ -3555,7 +4029,9 @@ export declare class AgentFramework {
|
|
|
3555
4029
|
* what the model would read: a structured result's blocks as the dispatch
|
|
3556
4030
|
* gave them (the direct reading, with RFC-005's treatment of an MCPL peer's
|
|
3557
4031
|
* blocks there, bound to the server that sent them), a module's under
|
|
3558
|
-
* history's reading of RFC-005 at every depth (shownToScript),
|
|
4032
|
+
* history's reading of RFC-005 at every depth (shownToScript), each
|
|
4033
|
+
* reading the claims of everything the script's view shows, nested fields
|
|
4034
|
+
* included (scriptViewClaims), and
|
|
3559
4035
|
* otherwise one text block of the model's text, which for a failure is its
|
|
3560
4036
|
* error. A module's is any result whose call the dispatch didn't send to
|
|
3561
4037
|
* a server (`toServer`, from the call's waiter). `structuredContent` is the
|
|
@@ -3563,7 +4039,9 @@ export declare class AgentFramework {
|
|
|
3563
4039
|
* content where it sent one, `false`, `0` and `null` included, else null.
|
|
3564
4040
|
* A result that can't be converted to JSON (a cyclic object, a BigInt),
|
|
3565
4041
|
* which the dispatch's own check makes unlikely here, is a failure naming
|
|
3566
|
-
* the tool and saying the call itself completed.
|
|
4042
|
+
* the tool and saying the call itself completed. So is an MCPL peer's
|
|
4043
|
+
* result whose blocks were too deep for the dispatch's treatment, which
|
|
4044
|
+
* the dispatch marks (SCRIPT_RESULT_UNCONVERTIBLE).
|
|
3567
4045
|
*/
|
|
3568
4046
|
private scriptResultAnswer;
|
|
3569
4047
|
/**
|
|
@@ -3575,9 +4053,11 @@ export declare class AgentFramework {
|
|
|
3575
4053
|
* RFC-007: with an `origin`, observers see the call as they see a model
|
|
3576
4054
|
* call (register, dispatch with its refusal sites, open; the terminal at
|
|
3577
4055
|
* the waiter intercept), under the inner tool's own name and class.
|
|
3578
|
-
* `turnId` is the turn the call was made in (dispatchToolCall)
|
|
3579
|
-
* the
|
|
3580
|
-
*
|
|
4056
|
+
* `turnId` is the turn the call was made in (dispatchToolCall), the turn
|
|
4057
|
+
* of the run or wait call watching the script; `start` is what the script
|
|
4058
|
+
* was started with, its turn and its agent's reading, which its words
|
|
4059
|
+
* carry (scriptCallStarts). `route` is the waiter's: the dispatch sets
|
|
4060
|
+
* `toServer` when it sends the call to a server.
|
|
3581
4061
|
*/
|
|
3582
4062
|
private dispatchScriptToolCall;
|
|
3583
4063
|
/**
|
|
@@ -3601,17 +4081,20 @@ export declare class AgentFramework {
|
|
|
3601
4081
|
private liveTurns;
|
|
3602
4082
|
private toMembraneToolResult;
|
|
3603
4083
|
/**
|
|
3604
|
-
*
|
|
3605
|
-
*
|
|
3606
|
-
*
|
|
3607
|
-
*
|
|
3608
|
-
*
|
|
3609
|
-
*
|
|
3610
|
-
*
|
|
3611
|
-
*
|
|
3612
|
-
* copy
|
|
3613
|
-
|
|
3614
|
-
|
|
4084
|
+
* A content array's blocks (toolResultBlocks) as Membrane's native
|
|
4085
|
+
* ToolResultContentBlock[], for a caller that found they go natively: at
|
|
4086
|
+
* least one image, with links and markers that fit the cap together
|
|
4087
|
+
* (goesNative), which this doesn't check. Each image as itself, each text block
|
|
4088
|
+
* cut at the cap, and every other block whole, as the text the stored copy
|
|
4089
|
+
* shows for it. `maxChars`, when provided, caps each text block so an image
|
|
4090
|
+
* inlined beside an enormous text payload can't blow the context. A block
|
|
4091
|
+
* is cut as the stored copy is at that cap (toolResultCutAt), never inside a
|
|
4092
|
+
* slot, so the stored copy can keep exactly the slots this showed (#403);
|
|
4093
|
+
* under a readers' bound the stored copy's cut can come earlier
|
|
4094
|
+
* (cutStoredToolResultToFit). Each text is already well formed, as the
|
|
4095
|
+
* stored copy's is (toolResultBlocks).
|
|
4096
|
+
*/
|
|
4097
|
+
private nativeContent;
|
|
3615
4098
|
private toolImageLedgerFor;
|
|
3616
4099
|
/** Strategy-derived per-message bound (maxMessageTokens * 4 chars). */
|
|
3617
4100
|
private strategyDerivedToolResultChars;
|
|
@@ -3742,6 +4225,61 @@ export declare class AgentFramework {
|
|
|
3742
4225
|
private dispatchToolCall;
|
|
3743
4226
|
private dispatchToolCallEvent;
|
|
3744
4227
|
private addMessage;
|
|
4228
|
+
/**
|
|
4229
|
+
* Whether an MCPL event's own stored entry is the newest entry in the window
|
|
4230
|
+
* a batched wake's line is written to (deliveryAgent(): the primary's), with
|
|
4231
|
+
* no turn alive there (turnAlive: started, streaming, or waiting on its
|
|
4232
|
+
* tools) and nothing waiting to be written (deferred). The gate then hands
|
|
4233
|
+
* the line to the wake (WakeLine) instead of writing it, and the turn's
|
|
4234
|
+
* start decides it (placeWakeLines). A channel message is found by its
|
|
4235
|
+
* server, channel and message id, a push event by its server and event id.
|
|
4236
|
+
* A message a tune-out holds from the residents is never "newest" here.
|
|
4237
|
+
*/
|
|
4238
|
+
private isNewestContextEntry;
|
|
4239
|
+
/**
|
|
4240
|
+
* Write the batched-wake lines the gate left to this turn's start (WakeLine)
|
|
4241
|
+
* into the window they name, the delivery agent's (the residents' shared
|
|
4242
|
+
* slot where it is one), on that agent's own start only. Called by a fresh
|
|
4243
|
+
* start that doesn't resume a logical turn, after the turn's own inputs (a
|
|
4244
|
+
* due clock row, the deferred-write and assembly flushes) and before its
|
|
4245
|
+
* checkpoint, so a line lands after whatever arrived since the gate's
|
|
4246
|
+
* decision, before the notices the turn's start writes itself (the locus
|
|
4247
|
+
* notice among them), and before the agent's answer to the wake.
|
|
4248
|
+
*
|
|
4249
|
+
* - A wake's one line whose event is still the newest entry is left out:
|
|
4250
|
+
* no message follows the wake's, so it is the wake's whole cause, and the
|
|
4251
|
+
* start's token defers an arrival into the window past its request. (The
|
|
4252
|
+
* start's own notices, written after this, aren't messages a reply could
|
|
4253
|
+
* be meant for.)
|
|
4254
|
+
* - A co-resident's start places nothing. Every resident gets every
|
|
4255
|
+
* batched wake, so a co-resident writing the line would put it under the
|
|
4256
|
+
* message, the line #727 left out, or after the delivery agent's answer,
|
|
4257
|
+
* a wake line for a message already answered. Its request shows what the
|
|
4258
|
+
* slot holds, as on `main`: a reply after the message is in the message's
|
|
4259
|
+
* own channel, but a message from another channel that lands between the
|
|
4260
|
+
* gate's decision and its compile follows the message with no line.
|
|
4261
|
+
* - Two or more lines are all written, each naming its message, its age
|
|
4262
|
+
* counted to now.
|
|
4263
|
+
* - None is written while the host is quiesced or another reader of the
|
|
4264
|
+
* slot has a turn alive (slotHeldFrom, as for a clock row): written, a
|
|
4265
|
+
* line would land inside that turn, and deferred, it would wait for the
|
|
4266
|
+
* delivery agent's next boundary, never reaching this request
|
|
4267
|
+
* (overlapping turns in the slot, #286). They stay undecided, and are
|
|
4268
|
+
* written only if another fresh start of the wake comes (a provider
|
|
4269
|
+
* hold's release, a requeue): this start's request goes without them.
|
|
4270
|
+
*
|
|
4271
|
+
* A line left out is traced. Each line is written once (placedWakeLines),
|
|
4272
|
+
* across the wake's retries and holds, whichever copy of its trigger a
|
|
4273
|
+
* start carries: every request for the wake carries the same line. A line
|
|
4274
|
+
* left out, or whose write fails, stays undecided for a later fresh start.
|
|
4275
|
+
*/
|
|
4276
|
+
private placeWakeLines;
|
|
4277
|
+
/** Whether `entry`'s own stored entry is the newest in `agent`'s window,
|
|
4278
|
+
* clock rows and stored context injections after it aside: a channel
|
|
4279
|
+
* message by its server, channel and message id, a push event by its
|
|
4280
|
+
* server and event id, and never one a tune-out holds. Past
|
|
4281
|
+
* NEWEST_SCAN_ROWS such rows, it answers no. */
|
|
4282
|
+
private isNewestIn;
|
|
3745
4283
|
/** Where addMessage delivers: the named agent, else the primary, else the
|
|
3746
4284
|
* first registered agent. Undefined when there is no such agent. */
|
|
3747
4285
|
private deliveryAgent;
|
|
@@ -3771,25 +4309,13 @@ export declare class AgentFramework {
|
|
|
3771
4309
|
* its window (ContextManager.renderAsNewest): cut by the per-message cap,
|
|
3772
4310
|
* a sharded body joined, and the image limits applied over the batch, so
|
|
3773
4311
|
* the live stream hears what the next compile sends. An id comes back as
|
|
3774
|
-
* null where
|
|
3775
|
-
*
|
|
3776
|
-
*
|
|
3777
|
-
*
|
|
4312
|
+
* null where the render can't place the message among the newest, and the
|
|
4313
|
+
* boundary injects that one as stored (see the boundary's null). Undefined
|
|
4314
|
+
* where the strategy has no such hook, or the render threw, which is
|
|
4315
|
+
* logged: the boundary then injects what it stored, as it did before
|
|
4316
|
+
* strategies could say.
|
|
3778
4317
|
*/
|
|
3779
4318
|
private renderForInjection;
|
|
3780
|
-
/**
|
|
3781
|
-
* Tell the agent of the messages a tool boundary stored and left out of
|
|
3782
|
-
* its injection, since the next compile won't send them among its newest:
|
|
3783
|
-
* who sent each and its size, and how to read it, `history--extract`
|
|
3784
|
-
* around it where the agent is shown that tool, else its id. None of a
|
|
3785
|
-
* message's words: the line stands in for a message the live round
|
|
3786
|
-
* doesn't carry. A system line, so it's no conversation: it neither
|
|
3787
|
-
* re-pins the turn nor clears its send suppression. It names the agent
|
|
3788
|
-
* it's for, since every resident sharing the slot reads it too. Returns
|
|
3789
|
-
* the notice as stored, for the boundary to inject after the batch, or
|
|
3790
|
-
* undefined when it couldn't be stored, which is logged.
|
|
3791
|
-
*/
|
|
3792
|
-
private recordLeftOutNotice;
|
|
3793
4319
|
/**
|
|
3794
4320
|
* Write drained entries in queue (seq) order, whatever their targets:
|
|
3795
4321
|
* residents share one message slot, so the order entries arrived in is the
|
|
@@ -3863,11 +4389,15 @@ export declare class AgentFramework {
|
|
|
3863
4389
|
* appended later without splitting the body.) Boot's scan for landed
|
|
3864
4390
|
* writes counts a landed shard the same way. When the store can't be read
|
|
3865
4391
|
* back (storedCopiesOf logs it), or couldn't say how many messages it held
|
|
3866
|
-
* before the write,
|
|
4392
|
+
* before the write, the store is searched for the entry's id at once
|
|
4393
|
+
* (landedCopiesById): found, it counts as written, as above. When that
|
|
4394
|
+
* can't be done either, whether the entry landed is unknown: it's put back
|
|
3867
4395
|
* marked so (`landing`), and before it's written again the store is
|
|
3868
|
-
* searched for its id
|
|
3869
|
-
*
|
|
3870
|
-
*
|
|
4396
|
+
* searched for its id. Found then, it counts as written where it was
|
|
4397
|
+
* stored, ahead of what was stored since without it, a known limit
|
|
4398
|
+
* (context-manager #155, named at the tool boundary's drain); not found,
|
|
4399
|
+
* it's written. While the store can't be searched, it stays queued,
|
|
4400
|
+
* holding what's behind it.
|
|
3871
4401
|
*
|
|
3872
4402
|
* Returns what was written (stored, or deferred again by addMessage, whose
|
|
3873
4403
|
* id is then empty), in queue order: for one target, its entries up to the
|
|
@@ -3895,10 +4425,29 @@ export declare class AgentFramework {
|
|
|
3895
4425
|
* when the store can't be read back, which is logged under `tag`, naming
|
|
3896
4426
|
* `what` was written: not the same as nothing found. */
|
|
3897
4427
|
private storedSince;
|
|
3898
|
-
/**
|
|
3899
|
-
*
|
|
3900
|
-
*
|
|
3901
|
-
*
|
|
4428
|
+
/**
|
|
4429
|
+
* The positions on `cm`'s current branch of the messages carrying
|
|
4430
|
+
* `deferredWriteId`, in store order: the whole branch, read in blob-free
|
|
4431
|
+
* windows, so a blob missing from some other message can't make it fail,
|
|
4432
|
+
* as it makes queryMessages fail (every blob on the branch is resolved for
|
|
4433
|
+
* it). Throws when a window can't be read, or holds fewer messages than it
|
|
4434
|
+
* was asked for: a scan that didn't reach every message can't say a write
|
|
4435
|
+
* is absent, and a write taken as absent is stored again.
|
|
4436
|
+
*/
|
|
4437
|
+
private landedPositions;
|
|
4438
|
+
/**
|
|
4439
|
+
* The messages carrying `deferredWriteId` anywhere on the agent's current
|
|
4440
|
+
* branch, in store order with their blobs resolved, as a request carries
|
|
4441
|
+
* them, so no position is needed. They're found with queryMessages, over
|
|
4442
|
+
* context-manager's cached view, as landedRow finds a held write's row.
|
|
4443
|
+
* Where that throws, as one blob missing anywhere on the branch makes it
|
|
4444
|
+
* do, the branch is scanned blob-free instead (landedPositions), and only
|
|
4445
|
+
* the rows that match are read with their blobs. Undefined when the store
|
|
4446
|
+
* can be searched neither way, or the scan finds the write's rows but one
|
|
4447
|
+
* of them can't be read. Each write whose lookup fails is said once until
|
|
4448
|
+
* a lookup of it succeeds, since every path that reads held writes looks
|
|
4449
|
+
* again.
|
|
4450
|
+
*/
|
|
3902
4451
|
private landedCopiesById;
|
|
3903
4452
|
/** The line naming a drained write that threw: one that couldn't be stored,
|
|
3904
4453
|
* which is already back in the queue; with 'dropped', a malformed refusal
|
|
@@ -3939,9 +4488,10 @@ export declare class AgentFramework {
|
|
|
3939
4488
|
* A target no longer registered (a fork or a run that has ended, here or
|
|
3940
4489
|
* before a crash) has no window to land in: a failed reply queued for it,
|
|
3941
4490
|
* or a channel notice it could have acted on, becomes the primary's
|
|
3942
|
-
* by-name notice,
|
|
3943
|
-
*
|
|
3944
|
-
*
|
|
4491
|
+
* by-name notice, and a module's write for a run or a fork goes to it as
|
|
4492
|
+
* written, each under the entry's own id and place in the queue
|
|
4493
|
+
* (passesToPrimary, queuedNoticeForPrimary), written with the rest; any
|
|
4494
|
+
* other write is dropped, logged, by addMessage. Nothing here reads the gone agent's
|
|
3945
4495
|
* window, so such a notice an earlier write of which landed there, and
|
|
3946
4496
|
* which the agent read, goes on too. */
|
|
3947
4497
|
private readdDrained;
|
|
@@ -3972,7 +4522,8 @@ export declare class AgentFramework {
|
|
|
3972
4522
|
*
|
|
3973
4523
|
* The agent never reads its window again, so every failed-reply notice it
|
|
3974
4524
|
* never read, and every channel notice it could act on and never read, is
|
|
3975
|
-
* passed to the primary, by name, once
|
|
4525
|
+
* passed to the primary, by name, once, and so is every module write for
|
|
4526
|
+
* it that it never read, as the write itself (passesToPrimary,
|
|
3976
4527
|
* passOnFromReleasedWindow): each one stored in its window above its
|
|
3977
4528
|
* consumed watermark (flushed there at its turn's end, or stored while it
|
|
3978
4529
|
* was idle) and not heard at a tool boundary, and each one still queued
|
|
@@ -4003,8 +4554,9 @@ export declare class AgentFramework {
|
|
|
4003
4554
|
* The part of a released agent's pass to the primary that its release and
|
|
4004
4555
|
* stop() share (stop() runs it for a release the quiesce postponed). Each
|
|
4005
4556
|
* notice stored in its window that it never read and the primary takes in
|
|
4006
|
-
* its place (passesToPrimary: a failed reply,
|
|
4007
|
-
*
|
|
4557
|
+
* its place (passesToPrimary: a failed reply, a channel notice its reader
|
|
4558
|
+
* could act on, or a module's write for a run or a fork, which goes as
|
|
4559
|
+
* the write itself) goes on as stored, by name (passNoticeToPrimary),
|
|
4008
4560
|
* except a copy of an entry for it still in the durable queue, pending or
|
|
4009
4561
|
* un-acked: that entry is the notice's one identity until its ack, the one
|
|
4010
4562
|
* boot's check for landed writes knows, so it's the entry that goes on, as
|
|
@@ -4025,8 +4577,11 @@ export declare class AgentFramework {
|
|
|
4025
4577
|
* What a released agent's window holds that its pass to the primary reads
|
|
4026
4578
|
* (passOnFromReleasedWindow): `unread`, the notices stored there that it
|
|
4027
4579
|
* never read and the primary takes in its place (passesToPrimary: its
|
|
4028
|
-
* failed replies,
|
|
4029
|
-
*
|
|
4580
|
+
* failed replies, the channel notices it was told it could act on, and a
|
|
4581
|
+
* run's or a fork's module writes), each with its participant and
|
|
4582
|
+
* content, a sharded body's shards joined into one text, as the
|
|
4583
|
+
* autobiographical strategy joins them (asCompiled), other than
|
|
4584
|
+
* copies of the entries `held` names; and `held`, for each of
|
|
4030
4585
|
* those entries with a copy there, its copies and whether any of them is
|
|
4031
4586
|
* unread. A notice is read below the lower of its consumed watermark and
|
|
4032
4587
|
* the point where the watermark's branch and the current one part
|
|
@@ -4060,8 +4615,8 @@ export declare class AgentFramework {
|
|
|
4060
4615
|
* deregistered, so its stream can't dispatch anything more and resume
|
|
4061
4616
|
* doesn't weigh its context, and a write addressed to it meanwhile is
|
|
4062
4617
|
* treated as for any agent no longer registered (dropped, or passed to the
|
|
4063
|
-
* primary if it's a failed reply,
|
|
4064
|
-
* on).
|
|
4618
|
+
* primary if it's a failed reply, a channel notice its reader could act
|
|
4619
|
+
* on, or a module's write for a run or a fork: passesToPrimary).
|
|
4065
4620
|
*/
|
|
4066
4621
|
private releaseWindowNowOrAfterResume;
|
|
4067
4622
|
/** resume(): the windows whose release the quiesce window postponed, each on its own. */
|
|
@@ -4096,7 +4651,10 @@ export declare class AgentFramework {
|
|
|
4096
4651
|
* The primary's by-name notice in place of one `speaker` never read, and
|
|
4097
4652
|
* what it's about, as a log line says it: a failed reply's
|
|
4098
4653
|
* (failedReplyNoticeForPrimary) or a channel notice's
|
|
4099
|
-
* (channelNoticeForPrimary).
|
|
4654
|
+
* (channelNoticeForPrimary). A module's write for a run or a fork that
|
|
4655
|
+
* it never read (PRIMARY_IF_UNREAD_KEY), given with what was `written`,
|
|
4656
|
+
* goes as the write itself: its participant, its content, and its
|
|
4657
|
+
* metadata without the mark. null when no one is told, which is logged
|
|
4100
4658
|
* where it's decided.
|
|
4101
4659
|
*/
|
|
4102
4660
|
private noticeForPrimary;
|
|
@@ -4133,11 +4691,34 @@ export declare class AgentFramework {
|
|
|
4133
4691
|
*/
|
|
4134
4692
|
private channelForNotice;
|
|
4135
4693
|
/**
|
|
4136
|
-
* A
|
|
4137
|
-
*
|
|
4138
|
-
*
|
|
4139
|
-
*
|
|
4140
|
-
|
|
4694
|
+
* A channel as the agent is shown it: its label, with the name that picks
|
|
4695
|
+
* it alone (ChannelRegistry.nameShown), which is its id, or, where another
|
|
4696
|
+
* server registers the same id, its server-qualified name; or, for a
|
|
4697
|
+
* channel no string picks alone, its id and its server.
|
|
4698
|
+
*/
|
|
4699
|
+
private channelShown;
|
|
4700
|
+
/** A channel named in a notice with the label it was given there: the
|
|
4701
|
+
* label, with its name as ChannelRegistry.nameShown gives it. */
|
|
4702
|
+
private labelledChannel;
|
|
4703
|
+
/**
|
|
4704
|
+
* A module's write through its context (ModuleContext.addMessage):
|
|
4705
|
+
* addMessage's, except that a write the framework holds is answered by its
|
|
4706
|
+
* handle (heldHandle) rather than '', so the module can find, read, edit
|
|
4707
|
+
* and remove what it wrote before the write lands, through getMessage,
|
|
4708
|
+
* editMessage and removeMessage, which read the delivery agent's window: a
|
|
4709
|
+
* handle for a write held for a fork or a sub-agent isn't found there. The
|
|
4710
|
+
* framework's own callers keep the '' they've always had, which their
|
|
4711
|
+
* traces and checks take as a write not stored yet.
|
|
4712
|
+
*
|
|
4713
|
+
* With `forAgent`, the write is for the named agent's window, which must
|
|
4714
|
+
* be registered when the write is made: a name that isn't, or the empty
|
|
4715
|
+
* one, which addMessage would read as none (deliveryAgent), throws, naming
|
|
4716
|
+
* the registered ones, as queryMessages does. The framework's own writes
|
|
4717
|
+
* log and drop instead, as a held write does whose agent is gone by its
|
|
4718
|
+
* flush. A write for an ephemeral run or a conversation fork, whose
|
|
4719
|
+
* window nothing reads after its release, is marked (PRIMARY_IF_UNREAD_KEY),
|
|
4720
|
+
* so the release passes it to the primary if its target never read it,
|
|
4721
|
+
* as it passes a notice (passOnFromReleasedWindow).
|
|
4141
4722
|
*/
|
|
4142
4723
|
private addModuleMessage;
|
|
4143
4724
|
/**
|
|
@@ -4148,7 +4729,8 @@ export declare class AgentFramework {
|
|
|
4148
4729
|
* no module reads that agent's store, and the write waits for its window's
|
|
4149
4730
|
* release (drainDeferredFor) or, at its flush, is dropped (addMessage), a
|
|
4150
4731
|
* failed reply, or a channel notice its reader could act on, passing to the
|
|
4151
|
-
* primary as its notice
|
|
4732
|
+
* primary as its notice, and a module's write for a run as written
|
|
4733
|
+
* (passesToPrimary, queuedNoticeForPrimary).
|
|
4152
4734
|
*/
|
|
4153
4735
|
private heldWritesFor;
|
|
4154
4736
|
/**
|
|
@@ -4170,10 +4752,11 @@ export declare class AgentFramework {
|
|
|
4170
4752
|
* Settle held writes whose landing is unknown (DeferredWrite.landing),
|
|
4171
4753
|
* among those `which` picks, before a path reads or changes held writes:
|
|
4172
4754
|
* each is looked up by its id in its target's store (landedCopiesById).
|
|
4173
|
-
* Found, the write landed (settleFound)
|
|
4174
|
-
*
|
|
4175
|
-
*
|
|
4176
|
-
* own
|
|
4755
|
+
* Found, the write landed (settleFound), where its copy sits, a known
|
|
4756
|
+
* limit (writeDrainedInOrder). Not found, the mark goes, and it's an
|
|
4757
|
+
* ordinary held write, which is persisted as an edit is. Where the store
|
|
4758
|
+
* can't be searched, it stays marked, a doubt each path reads by its own
|
|
4759
|
+
* rule.
|
|
4177
4760
|
*/
|
|
4178
4761
|
private settleUnknownLandings;
|
|
4179
4762
|
/**
|
|
@@ -4194,7 +4777,8 @@ export declare class AgentFramework {
|
|
|
4194
4777
|
* that write's copy, so the write landed, and it's settled as found
|
|
4195
4778
|
* (settleFound) before the row is read or changed. A lookup by the id
|
|
4196
4779
|
* can't be needed then, so this holds where the store can't be searched
|
|
4197
|
-
* too.
|
|
4780
|
+
* too. One row of a sharded body says it's a shard, without a count,
|
|
4781
|
+
* since one row doesn't tell how many landed.
|
|
4198
4782
|
*/
|
|
4199
4783
|
private settleByCopy;
|
|
4200
4784
|
/** A held write whose landing stays unknown after settling, its store
|
|
@@ -4202,21 +4786,43 @@ export declare class AgentFramework {
|
|
|
4202
4786
|
* changing only the queued entry could leave its stored copy as it was.
|
|
4203
4787
|
* Throws with nothing changed. */
|
|
4204
4788
|
private refuseUnsettled;
|
|
4205
|
-
/** Whether
|
|
4206
|
-
* evidence only
|
|
4207
|
-
* watermark
|
|
4208
|
-
*
|
|
4209
|
-
*
|
|
4210
|
-
*
|
|
4211
|
-
*
|
|
4212
|
-
*
|
|
4213
|
-
*
|
|
4214
|
-
*
|
|
4215
|
-
*
|
|
4216
|
-
|
|
4789
|
+
/** Whether a wake for a deferred write has nothing left for the agent to
|
|
4790
|
+
* do, on evidence only. The write's row is at or below the newest
|
|
4791
|
+
* consumed watermark of an answered request (Agent.getAnsweredWatermark)
|
|
4792
|
+
* on the agent's current branch, and for a wake that carries a channel
|
|
4793
|
+
* and wasn't marked ambient (`to`, that channel on the wake's server), the
|
|
4794
|
+
* agent has since published there having read the row
|
|
4795
|
+
* (Agent.publishedAfterReading): hearing a message isn't answering it,
|
|
4796
|
+
* and the wake's turn is the agent's chance to answer there. Or the
|
|
4797
|
+
* write is in neither the queue (drained entries not yet stored
|
|
4798
|
+
* included) nor the store's current branch: removed, or left on a
|
|
4799
|
+
* branch the agent has switched from, where a turn now would find
|
|
4800
|
+
* nothing of it (switching back brings it back unread, with no wake, as
|
|
4801
|
+
* main's wake spent on this branch leaves it). Any doubt keeps the
|
|
4802
|
+
* wake, such as a watermark that a branch switch or an undo left on
|
|
4803
|
+
* another branch, or a store that can't be read: a turn that finds
|
|
4804
|
+
* nothing new costs less than a write no wake brings the agent to read
|
|
4805
|
+
* or answer. */
|
|
4806
|
+
private deferredWriteDone;
|
|
4807
|
+
/** The mark a wake for `agentName` takes for the write it was queued with
|
|
4808
|
+
* (`placement`, addMessage's out-param): set only when that write was
|
|
4809
|
+
* deferred for that agent, since a stored write's wake starts the turn
|
|
4810
|
+
* that reads it. The scheduler drops the wake once the write needs
|
|
4811
|
+
* nothing more of the agent (deferredWriteDone). */
|
|
4812
|
+
private readsDeferredFor;
|
|
4217
4813
|
private editMessage;
|
|
4218
4814
|
private removeMessage;
|
|
4219
4815
|
private getMessage;
|
|
4816
|
+
/** The refusal of a module's `forAgent` that names no registered agent:
|
|
4817
|
+
* the name, cut at 120 characters; the registered ones, a list over 400
|
|
4818
|
+
* characters cut with how many there are; and what leaving forAgent out
|
|
4819
|
+
* does. With none registered, there's no window either way, and it says
|
|
4820
|
+
* so. */
|
|
4821
|
+
private unknownAgentError;
|
|
4822
|
+
/** A module's query (ModuleContext.queryMessages): the delivery agent's
|
|
4823
|
+
* window (the primary's, or the first agent's when none is primary), or
|
|
4824
|
+
* the named agent's, which must be registered: an unknown name, or the
|
|
4825
|
+
* empty one, throws, naming the registered ones, as a write's does. */
|
|
4220
4826
|
private queryMessages;
|
|
4221
4827
|
private createFrameworkState;
|
|
4222
4828
|
private emitTrace;
|
|
@@ -4275,6 +4881,41 @@ export declare class AgentFramework {
|
|
|
4275
4881
|
* failures.log + ops:alert trace + CONNECTOME_OPS_WEBHOOK.
|
|
4276
4882
|
*/
|
|
4277
4883
|
notifyOps(kind: string, agentName: string, message: string, data?: Record<string, unknown>): void;
|
|
4884
|
+
/**
|
|
4885
|
+
* Tells the context manager what a stream's later round carries after its compiled messages: every round so far,
|
|
4886
|
+
* in sent order, with the round's own rows appended (roundRows): each stored row's id where the next request will
|
|
4887
|
+
* carry it as the stream sent it, the marker where it won't. A request-only row (a heartbeat tick, a `[Continue]`)
|
|
4888
|
+
* isn't a row here: the next request puts it back in the same place (renderRequestOnlyRows), and no compile holds
|
|
4889
|
+
* it. A round with no `roundContent` (membrane's XML or fallback path, where the stored reply is the framework's
|
|
4890
|
+
* rebuild) can't be vouched for, so nothing more of the stream is noted, and its later rounds' thinking is left
|
|
4891
|
+
* out at the next compile rather than refused. So is a stream whose note threw or wrote nothing (noteStreamRows).
|
|
4892
|
+
*/
|
|
4893
|
+
private noteRoundSent;
|
|
4894
|
+
/**
|
|
4895
|
+
* At the stream's end, after its last reply is stored: every row so far, judged as of now, with that reply as the
|
|
4896
|
+
* final row (or none, where the stream's last request had no reply after it). Past the record's end nothing
|
|
4897
|
+
* keeps its thinking, so the last reply keeps its own only by being noted here. Judged as of now, a batch the
|
|
4898
|
+
* tool-result guard held at its boundary and has since settled to the originals is named. A reply with no
|
|
4899
|
+
* `roundContent` to vouch for ends noting instead, as a round's does.
|
|
4900
|
+
*/
|
|
4901
|
+
private noteStreamEnd;
|
|
4902
|
+
/**
|
|
4903
|
+
* Every row so far, judged as of now (roundRows), noted. A note the context manager writes nothing for (false)
|
|
4904
|
+
* ends the stream's notes, with a line saying so: where the stream's compile no longer wrote the branch's record, or
|
|
4905
|
+
* the branch has none, no later note could write either; where its store failed, a later one might, and stopping
|
|
4906
|
+
* gives that up for this stream's later rounds, whose thinking then goes at the next compile, as it would have
|
|
4907
|
+
* after the failed write. A note that throws is a fault, and ends them too.
|
|
4908
|
+
*/
|
|
4909
|
+
private noteStreamRows;
|
|
4910
|
+
/**
|
|
4911
|
+
* A call's dropped blocks, placed, against the branch's binding-record start (splitThinkingDrops). Replies stored at
|
|
4912
|
+
* or below it may lose their thinking with no strip having missed, since the context manager recorded nothing they
|
|
4913
|
+
* were sent under, and so may any block for a binding the record doesn't track (the account's). Any other drop is
|
|
4914
|
+
* one the record doesn't account for: a change ahead of it that the record didn't see. The operators hear of it
|
|
4915
|
+
* once per incident, again only if a call shows more, and the incident ends at a call that shows no unexpected drop
|
|
4916
|
+
* (ThinkingLossIncidents).
|
|
4917
|
+
*/
|
|
4918
|
+
private noteThinkingLoss;
|
|
4278
4919
|
private opsAlert;
|
|
4279
4920
|
/**
|
|
4280
4921
|
* Record a model refusal for observability: per-agent stats + a
|
|
@@ -4519,6 +5160,32 @@ export declare class AgentFramework {
|
|
|
4519
5160
|
* logged here rather than replacing the failure the connect reports.
|
|
4520
5161
|
*/
|
|
4521
5162
|
private closeFailedRuntimeConnect;
|
|
5163
|
+
/**
|
|
5164
|
+
* The host capabilities offered to one server: the host's own, plus
|
|
5165
|
+
* RFC-014's `toolHints` where its configuration asks for them. Without it,
|
|
5166
|
+
* the very object every server is offered.
|
|
5167
|
+
*/
|
|
5168
|
+
private mcplHostCapabilitiesFor;
|
|
5169
|
+
/** RFC-014: every toolHints server's presence, made on first use. */
|
|
5170
|
+
private toolsets;
|
|
5171
|
+
/** RFC-014: the `toolsets` module (toolsets--open, --act, --look,
|
|
5172
|
+
* --close), registered once, by the first server configured with
|
|
5173
|
+
* toolHints. Its tools don't change after that. */
|
|
5174
|
+
private ensureToolsetsModule;
|
|
5175
|
+
/** RFC-014 §5.3: after a (re)connect whose policy has settled, read what
|
|
5176
|
+
* the server holds open and adopt it. In the background: its notices are
|
|
5177
|
+
* written as they come. */
|
|
5178
|
+
private reattachToolsets;
|
|
5179
|
+
/**
|
|
5180
|
+
* RFC-014 §8.3: a tool change with no result or event to ride on (a
|
|
5181
|
+
* standalone tools/hints, a late result, a reconnect's adoption, a
|
|
5182
|
+
* recovery) is told as a notice, which doesn't wake the agent. Like any
|
|
5183
|
+
* delivery from a server into the conversation, it needs `pushEvents`
|
|
5184
|
+
* (§6.1); without it the change is still tracked, and toolsets--look shows
|
|
5185
|
+
* it. The text is the server's (its tool definitions, titles, reasons), so
|
|
5186
|
+
* the notice names the server.
|
|
5187
|
+
*/
|
|
5188
|
+
private recordToolsetNotice;
|
|
4522
5189
|
/**
|
|
4523
5190
|
* Connect a single MCPL server: register routing entries, open the
|
|
4524
5191
|
* connection, wire events, and initialize feature sets / scopes /
|
|
@@ -4814,8 +5481,8 @@ export declare class AgentFramework {
|
|
|
4814
5481
|
*/
|
|
4815
5482
|
private wireModernEvents;
|
|
4816
5483
|
/** An MCP tool call's trace: a result the server marked an error (or one
|
|
4817
|
-
* the reading
|
|
4818
|
-
* paths; anything else is tool:completed. */
|
|
5484
|
+
* the reading takes as one, such as malformed content) is tool:failed, as
|
|
5485
|
+
* on the other tool paths; anything else is tool:completed. */
|
|
4819
5486
|
private traceMcpToolOutcome;
|
|
4820
5487
|
/**
|
|
4821
5488
|
* Discover tools from all connected MCPL servers and cache them.
|
|
@@ -4896,7 +5563,8 @@ export declare class AgentFramework {
|
|
|
4896
5563
|
* direct path (a module's callTool, a channel's tool call) doesn't come
|
|
4897
5564
|
* here: it returns the server's result itself (directToolResult), for
|
|
4898
5565
|
* either engine, as does a script's call whose result is structured, with
|
|
4899
|
-
* an MCPL peer's blocks given RFC-005's treatment (referenceBlockForScript)
|
|
5566
|
+
* an MCPL peer's blocks given RFC-005's treatment (referenceBlockForScript),
|
|
5567
|
+
* and what's nested in them at any depth (shownToScriptFromServer).
|
|
4900
5568
|
*/
|
|
4901
5569
|
private mcpToolResult;
|
|
4902
5570
|
/**
|
|
@@ -4940,8 +5608,8 @@ export declare class AgentFramework {
|
|
|
4940
5608
|
* Handle the synthesized `read_image` tool: read image bytes from a
|
|
4941
5609
|
* workspace mount and return them as a native MCP-shaped content array
|
|
4942
5610
|
* (`[{type:'text'…},{type:'image', data, mimeType}]`). The live-turn
|
|
4943
|
-
* converter (
|
|
4944
|
-
* blocks) delivers the actual image to the model; history storage keeps
|
|
5611
|
+
* converter (toMembraneToolResult's nativeContent → membrane tool_result
|
|
5612
|
+
* image blocks) delivers the actual image to the model; history storage keeps
|
|
4945
5613
|
* the standard compact `[image: …]` placeholder.
|
|
4946
5614
|
*/
|
|
4947
5615
|
/** RFC-005 on-demand dereference: [ref id] → workspace file, via the
|
|
@@ -4978,9 +5646,10 @@ export declare class AgentFramework {
|
|
|
4978
5646
|
*/
|
|
4979
5647
|
private dispatchSaveImageToolCall;
|
|
4980
5648
|
/** The `utils` meta-tool: list/describe/run over module utilities
|
|
4981
|
-
* (Module.getUtilities). Shared by the model-facing dispatcher
|
|
4982
|
-
*
|
|
4983
|
-
*
|
|
5649
|
+
* (Module.getUtilities). Shared by the model-facing dispatcher, which a
|
|
5650
|
+
* running code_execution script's calls take too, and executeToolCallFrom,
|
|
5651
|
+
* which the puppet and a host reach through executeToolCall and a module
|
|
5652
|
+
* through callTool. */
|
|
4984
5653
|
private handleUtilsToolCall;
|
|
4985
5654
|
private dispatchUtilsToolCall;
|
|
4986
5655
|
private dispatchAgentSettingsToolCall;
|
|
@@ -4989,6 +5658,10 @@ export declare class AgentFramework {
|
|
|
4989
5658
|
private buildEventTagsResult;
|
|
4990
5659
|
private dispatchEventTagsToolCall;
|
|
4991
5660
|
private dispatchGateToolCall;
|
|
5661
|
+
/** The channel context one server is told for an agent's inference
|
|
5662
|
+
* (context/beforeInference, §14.4): only that server's own channels
|
|
5663
|
+
* (ChannelRegistry.buildChannelContext). */
|
|
5664
|
+
private channelsForServer;
|
|
4992
5665
|
private buildBeforeInferenceParams;
|
|
4993
5666
|
}
|
|
4994
5667
|
export {};
|