@animalabs/agent-framework 0.32.0 → 0.33.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 +204 -14
- package/dist/src/admission/admit.d.ts +18 -0
- package/dist/src/admission/admit.d.ts.map +1 -1
- package/dist/src/admission/admit.js +16 -3
- package/dist/src/admission/admit.js.map +1 -1
- package/dist/src/agent.d.ts +185 -78
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +279 -102
- package/dist/src/agent.js.map +1 -1
- package/dist/src/api/mcp-server-core.d.ts.map +1 -1
- package/dist/src/api/mcp-server-core.js +50 -12
- package/dist/src/api/mcp-server-core.js.map +1 -1
- package/dist/src/api/server.d.ts.map +1 -1
- package/dist/src/api/server.js +4 -20
- package/dist/src/api/server.js.map +1 -1
- package/dist/src/code-execution/isolate/scripts.d.ts +12 -8
- package/dist/src/code-execution/isolate/scripts.d.ts.map +1 -1
- package/dist/src/code-execution/isolate/scripts.js +24 -0
- package/dist/src/code-execution/isolate/scripts.js.map +1 -1
- package/dist/src/config-checks.d.ts +7 -0
- package/dist/src/config-checks.d.ts.map +1 -1
- package/dist/src/config-checks.js +14 -0
- package/dist/src/config-checks.js.map +1 -1
- package/dist/src/context-manager-errors.d.ts +25 -0
- package/dist/src/context-manager-errors.d.ts.map +1 -0
- package/dist/src/context-manager-errors.js +31 -0
- package/dist/src/context-manager-errors.js.map +1 -0
- package/dist/src/context-options.d.ts +67 -0
- package/dist/src/context-options.d.ts.map +1 -0
- package/dist/src/context-options.js +85 -0
- package/dist/src/context-options.js.map +1 -0
- package/dist/src/deferred-import.d.ts +93 -0
- package/dist/src/deferred-import.d.ts.map +1 -0
- package/dist/src/deferred-import.js +177 -0
- package/dist/src/deferred-import.js.map +1 -0
- package/dist/src/dendrite/audience.d.ts +223 -0
- package/dist/src/dendrite/audience.d.ts.map +1 -0
- package/dist/src/dendrite/audience.js +202 -0
- package/dist/src/dendrite/audience.js.map +1 -0
- package/dist/src/dendrite/index.d.ts +5 -3
- package/dist/src/dendrite/index.d.ts.map +1 -1
- package/dist/src/dendrite/index.js +2 -1
- package/dist/src/dendrite/index.js.map +1 -1
- package/dist/src/dendrite/presets.d.ts +10 -5
- package/dist/src/dendrite/presets.d.ts.map +1 -1
- package/dist/src/dendrite/presets.js +17 -5
- package/dist/src/dendrite/presets.js.map +1 -1
- package/dist/src/dendrite/registry.d.ts +62 -7
- package/dist/src/dendrite/registry.d.ts.map +1 -1
- package/dist/src/dendrite/registry.js +179 -10
- package/dist/src/dendrite/registry.js.map +1 -1
- package/dist/src/dendrite/types.d.ts +91 -8
- package/dist/src/dendrite/types.d.ts.map +1 -1
- package/dist/src/foreign-rounds.d.ts +69 -0
- package/dist/src/foreign-rounds.d.ts.map +1 -0
- package/dist/src/foreign-rounds.js +152 -0
- package/dist/src/foreign-rounds.js.map +1 -0
- package/dist/src/framework.d.ts +1976 -818
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +7566 -3422
- package/dist/src/framework.js.map +1 -1
- package/dist/src/gate/event-gate.d.ts +85 -15
- package/dist/src/gate/event-gate.d.ts.map +1 -1
- package/dist/src/gate/event-gate.js +421 -47
- package/dist/src/gate/event-gate.js.map +1 -1
- package/dist/src/gate/index.d.ts +1 -1
- package/dist/src/gate/index.d.ts.map +1 -1
- package/dist/src/gate/index.js.map +1 -1
- package/dist/src/gate/rule-scope.d.ts +30 -0
- package/dist/src/gate/rule-scope.d.ts.map +1 -0
- package/dist/src/gate/rule-scope.js +41 -0
- package/dist/src/gate/rule-scope.js.map +1 -0
- package/dist/src/gate/suppress-script-worker.d.ts +2 -0
- package/dist/src/gate/suppress-script-worker.d.ts.map +1 -0
- package/dist/src/gate/suppress-script-worker.js +103 -0
- package/dist/src/gate/suppress-script-worker.js.map +1 -0
- package/dist/src/gate/suppress-scripts.d.ts +105 -0
- package/dist/src/gate/suppress-scripts.d.ts.map +1 -0
- package/dist/src/gate/suppress-scripts.js +403 -0
- package/dist/src/gate/suppress-scripts.js.map +1 -0
- package/dist/src/gate/suppression-review.d.ts +143 -0
- package/dist/src/gate/suppression-review.d.ts.map +1 -0
- package/dist/src/gate/suppression-review.js +463 -0
- package/dist/src/gate/suppression-review.js.map +1 -0
- package/dist/src/gate/suppression-stats.d.ts +125 -0
- package/dist/src/gate/suppression-stats.d.ts.map +1 -0
- package/dist/src/gate/suppression-stats.js +214 -0
- package/dist/src/gate/suppression-stats.js.map +1 -0
- package/dist/src/gate/types.d.ts +135 -7
- package/dist/src/gate/types.d.ts.map +1 -1
- package/dist/src/gate/wake-onboarding.d.ts +119 -0
- package/dist/src/gate/wake-onboarding.d.ts.map +1 -0
- package/dist/src/gate/wake-onboarding.js +277 -0
- package/dist/src/gate/wake-onboarding.js.map +1 -0
- package/dist/src/held-writes.d.ts +31 -23
- package/dist/src/held-writes.d.ts.map +1 -1
- package/dist/src/held-writes.js +44 -59
- package/dist/src/held-writes.js.map +1 -1
- package/dist/src/index.d.ts +5 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/jsonrpc-envelope.d.ts +69 -0
- package/dist/src/jsonrpc-envelope.d.ts.map +1 -0
- package/dist/src/jsonrpc-envelope.js +66 -0
- package/dist/src/jsonrpc-envelope.js.map +1 -0
- package/dist/src/mcpl/channel-registry.d.ts +131 -15
- package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.js +290 -46
- package/dist/src/mcpl/channel-registry.js.map +1 -1
- package/dist/src/mcpl/checkpoint-manager.d.ts +2 -4
- package/dist/src/mcpl/checkpoint-manager.d.ts.map +1 -1
- package/dist/src/mcpl/checkpoint-manager.js.map +1 -1
- package/dist/src/mcpl/feature-set-manager.d.ts +2 -4
- package/dist/src/mcpl/feature-set-manager.d.ts.map +1 -1
- package/dist/src/mcpl/feature-set-manager.js.map +1 -1
- package/dist/src/mcpl/inbound-source.d.ts +2 -1
- package/dist/src/mcpl/inbound-source.d.ts.map +1 -1
- package/dist/src/mcpl/inbound-source.js +2 -1
- package/dist/src/mcpl/inbound-source.js.map +1 -1
- package/dist/src/mcpl/inference-router.d.ts +6 -6
- package/dist/src/mcpl/inference-router.d.ts.map +1 -1
- package/dist/src/mcpl/inference-router.js.map +1 -1
- package/dist/src/mcpl/push-coalescer.d.ts +132 -22
- package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
- package/dist/src/mcpl/push-coalescer.js +105 -15
- package/dist/src/mcpl/push-coalescer.js.map +1 -1
- package/dist/src/mcpl/push-handler.d.ts +9 -7
- package/dist/src/mcpl/push-handler.d.ts.map +1 -1
- package/dist/src/mcpl/push-handler.js.map +1 -1
- package/dist/src/mcpl/server-connection.d.ts +13 -10
- package/dist/src/mcpl/server-connection.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.js +134 -56
- package/dist/src/mcpl/server-connection.js.map +1 -1
- package/dist/src/mcpl/tool-classes.d.ts.map +1 -1
- package/dist/src/mcpl/tool-classes.js +3 -0
- package/dist/src/mcpl/tool-classes.js.map +1 -1
- package/dist/src/mcpl/types.d.ts +8 -2
- package/dist/src/mcpl/types.d.ts.map +1 -1
- package/dist/src/mcpl/types.js.map +1 -1
- package/dist/src/module-registry.d.ts +24 -1
- package/dist/src/module-registry.d.ts.map +1 -1
- package/dist/src/module-registry.js +68 -18
- package/dist/src/module-registry.js.map +1 -1
- package/dist/src/modules/discord/index.d.ts +45 -8
- package/dist/src/modules/discord/index.d.ts.map +1 -1
- package/dist/src/modules/discord/index.js +237 -86
- package/dist/src/modules/discord/index.js.map +1 -1
- package/dist/src/modules/history/index.d.ts +59 -0
- package/dist/src/modules/history/index.d.ts.map +1 -1
- package/dist/src/modules/history/index.js +432 -67
- package/dist/src/modules/history/index.js.map +1 -1
- package/dist/src/modules/history/semantic.d.ts +6 -5
- package/dist/src/modules/history/semantic.d.ts.map +1 -1
- package/dist/src/modules/history/semantic.js +15 -22
- package/dist/src/modules/history/semantic.js.map +1 -1
- package/dist/src/modules/workspace/disk-agreement.d.ts +1 -1
- package/dist/src/modules/workspace/disk-agreement.js +1 -1
- package/dist/src/modules/workspace/index.d.ts +28 -7
- package/dist/src/modules/workspace/index.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.js +76 -22
- package/dist/src/modules/workspace/index.js.map +1 -1
- package/dist/src/notice-tags.d.ts +10 -1
- package/dist/src/notice-tags.d.ts.map +1 -1
- package/dist/src/notice-tags.js +10 -1
- package/dist/src/notice-tags.js.map +1 -1
- package/dist/src/operator-log.d.ts +36 -3
- package/dist/src/operator-log.d.ts.map +1 -1
- package/dist/src/operator-log.js +2 -2
- package/dist/src/operator-log.js.map +1 -1
- package/dist/src/presentation.d.ts +746 -0
- package/dist/src/presentation.d.ts.map +1 -0
- package/dist/src/presentation.js +1435 -0
- package/dist/src/presentation.js.map +1 -0
- package/dist/src/prose-drafts.d.ts +15 -11
- package/dist/src/prose-drafts.d.ts.map +1 -1
- package/dist/src/prose-drafts.js +16 -12
- package/dist/src/prose-drafts.js.map +1 -1
- package/dist/src/read-marks.d.ts +192 -0
- package/dist/src/read-marks.d.ts.map +1 -0
- package/dist/src/read-marks.js +242 -0
- package/dist/src/read-marks.js.map +1 -0
- package/dist/src/recovery/offline-branch.d.ts +91 -6
- package/dist/src/recovery/offline-branch.d.ts.map +1 -1
- package/dist/src/recovery/offline-branch.js +273 -29
- package/dist/src/recovery/offline-branch.js.map +1 -1
- package/dist/src/recovery/recover-cli.js +22 -3
- package/dist/src/recovery/recover-cli.js.map +1 -1
- package/dist/src/send-tools.d.ts +5 -9
- package/dist/src/send-tools.d.ts.map +1 -1
- package/dist/src/send-tools.js +40 -7
- package/dist/src/send-tools.js.map +1 -1
- package/dist/src/stored-injections.d.ts +2 -2
- package/dist/src/stored-injections.js +2 -2
- package/dist/src/stored-removal.d.ts +17 -4
- package/dist/src/stored-removal.d.ts.map +1 -1
- package/dist/src/stored-removal.js +29 -5
- package/dist/src/stored-removal.js.map +1 -1
- package/dist/src/tool-result-guard.d.ts +12 -1
- package/dist/src/tool-result-guard.d.ts.map +1 -1
- package/dist/src/tool-result-guard.js +42 -8
- package/dist/src/tool-result-guard.js.map +1 -1
- package/dist/src/tune-out/coordinator.d.ts +1159 -79
- package/dist/src/tune-out/coordinator.d.ts.map +1 -1
- package/dist/src/tune-out/coordinator.js +3709 -363
- package/dist/src/tune-out/coordinator.js.map +1 -1
- package/dist/src/tune-out/tools.d.ts +114 -17
- package/dist/src/tune-out/tools.d.ts.map +1 -1
- package/dist/src/tune-out/tools.js +87 -27
- package/dist/src/tune-out/tools.js.map +1 -1
- package/dist/src/tune-out/window-anchor.d.ts +143 -0
- package/dist/src/tune-out/window-anchor.d.ts.map +1 -0
- package/dist/src/tune-out/window-anchor.js +202 -0
- package/dist/src/tune-out/window-anchor.js.map +1 -0
- package/dist/src/types/agent.d.ts +82 -20
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/events.d.ts +2 -0
- package/dist/src/types/events.d.ts.map +1 -1
- package/dist/src/types/framework.d.ts +32 -12
- package/dist/src/types/framework.d.ts.map +1 -1
- package/dist/src/types/module.d.ts +180 -69
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/trace.d.ts +510 -36
- package/dist/src/types/trace.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/admission/admit.ts +32 -3
- package/src/agent.ts +323 -120
- package/src/api/mcp-server-core.ts +54 -17
- package/src/api/server.ts +4 -23
- package/src/code-execution/isolate/scripts.ts +28 -3
- package/src/config-checks.ts +14 -0
- package/src/context-manager-errors.ts +37 -0
- package/src/context-options.ts +96 -0
- package/src/deferred-import.ts +239 -0
- package/src/dendrite/audience.ts +315 -0
- package/src/dendrite/index.ts +14 -2
- package/src/dendrite/presets.ts +18 -6
- package/src/dendrite/registry.ts +209 -12
- package/src/dendrite/types.ts +92 -8
- package/src/foreign-rounds.ts +199 -0
- package/src/framework.ts +7804 -3546
- package/src/gate/event-gate.ts +428 -65
- package/src/gate/index.ts +3 -0
- package/src/gate/rule-scope.ts +45 -0
- package/src/gate/suppress-script-worker.ts +89 -0
- package/src/gate/suppress-scripts.ts +414 -0
- package/src/gate/suppression-review.ts +517 -0
- package/src/gate/suppression-stats.ts +314 -0
- package/src/gate/types.ts +141 -7
- package/src/gate/wake-onboarding.ts +309 -0
- package/src/held-writes.ts +49 -60
- package/src/index.ts +9 -2
- package/src/jsonrpc-envelope.ts +81 -0
- package/src/mcpl/channel-registry.ts +353 -85
- package/src/mcpl/checkpoint-manager.ts +3 -2
- package/src/mcpl/feature-set-manager.ts +2 -1
- package/src/mcpl/inbound-source.ts +2 -1
- package/src/mcpl/inference-router.ts +7 -4
- package/src/mcpl/push-coalescer.ts +193 -34
- package/src/mcpl/push-handler.ts +10 -5
- package/src/mcpl/server-connection.ts +141 -60
- package/src/mcpl/tool-classes.ts +3 -0
- package/src/mcpl/types.ts +8 -2
- package/src/module-registry.ts +73 -17
- package/src/modules/discord/index.ts +229 -81
- package/src/modules/history/index.ts +439 -70
- package/src/modules/history/semantic.ts +15 -21
- package/src/modules/workspace/disk-agreement.ts +1 -1
- package/src/modules/workspace/index.ts +85 -23
- package/src/notice-tags.ts +10 -1
- package/src/operator-log.ts +36 -3
- package/src/presentation.ts +1676 -0
- package/src/prose-drafts.ts +16 -12
- package/src/read-marks.ts +328 -0
- package/src/recovery/offline-branch.ts +346 -32
- package/src/recovery/recover-cli.ts +21 -3
- package/src/send-tools.ts +40 -7
- package/src/stored-injections.ts +2 -2
- package/src/stored-removal.ts +31 -7
- package/src/tool-result-guard.ts +41 -7
- package/src/tune-out/coordinator.ts +4089 -457
- package/src/tune-out/tools.ts +160 -43
- package/src/tune-out/window-anchor.ts +277 -0
- package/src/types/agent.ts +86 -20
- package/src/types/events.ts +2 -0
- package/src/types/framework.ts +32 -12
- package/src/types/module.ts +181 -68
- package/src/types/trace.ts +542 -40
package/dist/src/framework.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { JsStore } from '@animalabs/chronicle';
|
|
|
3
3
|
import type { Membrane, ContentBlock, NormalizedRequest } from '@animalabs/membrane';
|
|
4
4
|
import { type RetrySettings } from '@animalabs/membrane/retry';
|
|
5
5
|
import { ContextManager } from '@animalabs/context-manager';
|
|
6
|
+
import { type TuneOutReader } from './tune-out/tools.js';
|
|
6
7
|
import type { MessageMetadata, TokenBudget } from '@animalabs/context-manager';
|
|
7
8
|
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
9
|
import { Agent, type RenderStats } from './agent.js';
|
|
@@ -17,10 +18,21 @@ import type { ActivationRecord, AgentEndReason, AgentRecord, AgentSpec, EndOutco
|
|
|
17
18
|
* and every module utility is there too.
|
|
18
19
|
*/
|
|
19
20
|
export declare const BUILTIN_TOOLSET_TOOLS: ReadonlySet<string>;
|
|
21
|
+
import { type SuppressedEventRecord } from './gate/suppression-stats.js';
|
|
22
|
+
import { type SuppressionReviewSummary } from './gate/suppression-review.js';
|
|
20
23
|
import type { SessionUsageSnapshot } from './usage/types.js';
|
|
21
24
|
import type { ContextStrategy } from '@animalabs/context-manager';
|
|
22
25
|
import { type DiscordAwarenessView, type DiscordAwarenessCancelReceipt, type DiscordAwarenessMarks, type DiscordAwarenessRetractReceipt } from './recovery/discord-awareness-outbox.js';
|
|
23
26
|
import { type SurgeryMarkerReceipt, type SurgeryMarksPreview, type OperatorLogEntry, type OperatorLogInput, type OperatorRequester } from './operator-log.js';
|
|
27
|
+
export type { TuneOutReader };
|
|
28
|
+
/**
|
|
29
|
+
* The `tune_out` tool for a host with `reader`. The text says what happens
|
|
30
|
+
* to the channel's traffic and what the reader there can do, by the name
|
|
31
|
+
* the host gave it. It says nothing of what a reader decides or why: the
|
|
32
|
+
* voice doctrine's standard (coordinator.ts), which puts no words in a
|
|
33
|
+
* model's mouth, holds for what the resident is told about its reader too.
|
|
34
|
+
*/
|
|
35
|
+
export declare function tuneOutTool(reader: TuneOutReader): import('./types/index.js').ToolDefinition;
|
|
24
36
|
/**
|
|
25
37
|
* Feasibility verdict for a runtime-settings patch, derived through the SAME
|
|
26
38
|
* settings→config mapping the live apply path uses (`Agent.planRuntimeSettings`
|
|
@@ -113,8 +125,17 @@ export interface HostModeStatus {
|
|
|
113
125
|
* they hold no turn token, so drain doesn't wait for them. Reported so the
|
|
114
126
|
* operator sees what is still acting during the window. */
|
|
115
127
|
backgroundScripts: number;
|
|
116
|
-
/**
|
|
117
|
-
*
|
|
128
|
+
/**
|
|
129
|
+
* Context writes kept in memory, to be stored later: those a live
|
|
130
|
+
* operator surgery's hold keeps until its release, and those kept for an
|
|
131
|
+
* agent whose context manager refuses its work after a failed
|
|
132
|
+
* re-initialization, until a branch move (switchBranch, a rollback or a
|
|
133
|
+
* suppression) re-initializes it; 0 otherwise. Before #291 it counted the writes held in the deferred queue,
|
|
134
|
+
* which this release no longer keeps: a write made while quiesced is
|
|
135
|
+
* stored at once, and no agent is shown another's until resume.
|
|
136
|
+
*
|
|
137
|
+
* @deprecated Kept for one release; removed in the next.
|
|
138
|
+
*/
|
|
118
139
|
deferredWrites: number;
|
|
119
140
|
/** Agents whose turn `abandon` had not ended when its grace ran out: a
|
|
120
141
|
* turn token held with no stream to cancel and no check ahead to stop it
|
|
@@ -145,12 +166,13 @@ export declare class ResumeBlockedError extends Error {
|
|
|
145
166
|
}>);
|
|
146
167
|
}
|
|
147
168
|
/**
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
169
|
+
* Was thrown by `quiesce()` when the queue of deferred context writes couldn't
|
|
170
|
+
* reach disk. Since #291 the framework keeps no such queue (a write is stored
|
|
171
|
+
* at once, and enters each agent's window at that agent's presentation
|
|
172
|
+
* points), so quiesce() never throws it.
|
|
173
|
+
*
|
|
174
|
+
* @deprecated Never thrown since #291; kept exported for one release so a
|
|
175
|
+
* host that tests for it still builds.
|
|
154
176
|
*/
|
|
155
177
|
export declare class QuiesceBlockedError extends Error {
|
|
156
178
|
constructor(message: string, options?: {
|
|
@@ -227,13 +249,15 @@ export declare class DefaultErrorPolicy implements ErrorPolicy {
|
|
|
227
249
|
* grace only brings the abandon's report sooner.
|
|
228
250
|
*/
|
|
229
251
|
export declare function setAbandonGraceForTests(framework: AgentFramework, ms: number): void;
|
|
252
|
+
export { heldFromResidents } from './presentation.js';
|
|
253
|
+
export { suppressedRow } from './presentation.js';
|
|
230
254
|
/**
|
|
231
|
-
* The
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
255
|
+
* The event type an MCPL server's `[toolsets]` notice (a tool change with no
|
|
256
|
+
* result or event to ride on, RFC-014 §8.3) is gated as: from the server's
|
|
257
|
+
* id, with the notice's text as its content. Only suppress rules read it,
|
|
258
|
+
* since a notice never wakes the agent.
|
|
235
259
|
*/
|
|
236
|
-
export declare const
|
|
260
|
+
export declare const TOOL_CHANGES_EVENT_TYPE = "mcpl:tool-changes";
|
|
237
261
|
/** Options for {@link AgentFramework.deriveAgent}. */
|
|
238
262
|
export interface DeriveAgentOptions {
|
|
239
263
|
/** The new agent's name. Single-use within this framework's lifetime. */
|
|
@@ -327,7 +351,10 @@ export declare function restoreAlert(restore: {
|
|
|
327
351
|
})): ReinitAlertText;
|
|
328
352
|
export declare function disposalAlert(disposal: {
|
|
329
353
|
move: ReinitMove;
|
|
354
|
+
/** The writes kept in memory for it, by the move's hold or while its manager refused its work, that it ended before storing. */
|
|
330
355
|
heldWrites?: number;
|
|
356
|
+
/** How many of them went on to the primary, which takes them in its place (passesToPrimary); the rest were dropped. */
|
|
357
|
+
passedOn?: number;
|
|
331
358
|
reinitFailed?: string;
|
|
332
359
|
cleanupFailed?: string;
|
|
333
360
|
}): ReinitAlertText;
|
|
@@ -356,8 +383,9 @@ export declare function opsWebhookText(message: string): string;
|
|
|
356
383
|
* the shed doesn't help, and the breaker stops at its rewind cap. The 413 arm
|
|
357
384
|
* takes both labels membranes have given a 413, invalid_request and
|
|
358
385
|
* context_length (see the notes below). Other statuses keep the history,
|
|
359
|
-
* since a shed takes the exchange out of the agent's context
|
|
360
|
-
*
|
|
386
|
+
* since a shed takes the exchange out of the agent's context for good (the
|
|
387
|
+
* record keeps it, and no later start, restart or redo of another turn
|
|
388
|
+
* presents it again), and the status gives no sign that a shed
|
|
361
389
|
* would help: a 404 is a model or an endpoint that doesn't exist, and 405,
|
|
362
390
|
* 409, 410 and 415 are about the HTTP request or the resource, as a rule,
|
|
363
391
|
* rather than the conversation.
|
|
@@ -477,10 +505,6 @@ export declare class AgentFramework {
|
|
|
477
505
|
* clear failed, or a quiesce whose write failed partway, memory can say
|
|
478
506
|
* serving while the record says quiesced, until a resume() clears it. */
|
|
479
507
|
private hostModeRecordMayBeQuiesced;
|
|
480
|
-
/** Whether a resume() is between serving and clearing the record: it has
|
|
481
|
-
* cleared `quiesced` and is flushing the deferred writes, then clearing the
|
|
482
|
-
* record. A resume() on the serving host leaves the record to it. */
|
|
483
|
-
private resumeInFlight;
|
|
484
508
|
private quiesceReason?;
|
|
485
509
|
private quiescedAt?;
|
|
486
510
|
private traceListeners;
|
|
@@ -704,11 +728,13 @@ export declare class AgentFramework {
|
|
|
704
728
|
private subconsciousAgentName;
|
|
705
729
|
/** Its windowed strategy — the coordinator moves the anchor on tune-out entry. */
|
|
706
730
|
private subconsciousStrategy;
|
|
731
|
+
/** Where the persistent subconscious's window starts, by sequence or by a fixed ordinal (#291, AF-5). */
|
|
732
|
+
private subconsciousAnchor;
|
|
707
733
|
/** Its config (speak_in_channel gate, voice block provenance). */
|
|
708
734
|
private subconsciousConfig;
|
|
709
735
|
/** Tune-out coordinator (issue #77); non-null iff a reader is configured + channels. */
|
|
710
736
|
private tuneOutCoordinator;
|
|
711
|
-
/** Residents are offered `tune_out` (a reader is configured
|
|
737
|
+
/** Residents are offered `tune_out` (a reader is configured). */
|
|
712
738
|
private tuneOutOffered;
|
|
713
739
|
/**
|
|
714
740
|
* The reply anchor a coalesced delivery would set, parked until the
|
|
@@ -728,20 +754,6 @@ export declare class AgentFramework {
|
|
|
728
754
|
/** Agents an abandon could not cancel (token held, no stream) — surfaced
|
|
729
755
|
* in HostModeStatus until the next quiesce/resume. */
|
|
730
756
|
private lastUnabandonable;
|
|
731
|
-
/** True while the deferred-write queue is mirrored to its record, so each
|
|
732
|
-
* change of it writes it: from a write of it that reached or may reach
|
|
733
|
-
* the record, one that failed or met the cap unless quiesce() rejected
|
|
734
|
-
* for it (deferredWritesFellBehind), or a boot that restored it, until a
|
|
735
|
-
* write clears the record once the queue drains. */
|
|
736
|
-
private deferredWritesPersisted;
|
|
737
|
-
/** True from a write of the queue that failed or met the cap, unless
|
|
738
|
-
* quiesce() rejected for it, until one succeeds: a run of failures
|
|
739
|
-
* (deferredWritesFellBehind). A quiesce({ abandon: true }) over the cap
|
|
740
|
-
* goes on rather than rejecting, so its write begins a run too. */
|
|
741
|
-
private deferredWritesBehind;
|
|
742
|
-
/** True once the cap has been met in the current run, so its line is
|
|
743
|
-
* logged once a run, whatever began the run. */
|
|
744
|
-
private deferredWritesCapLogged;
|
|
745
757
|
/** The agent registry and its ended log, as recovery files beside the store
|
|
746
758
|
* (nissa's #546 finding 3): Chronicle state follows the store's branch, and
|
|
747
759
|
* an undo or an operator's surgery must not erase a result held for
|
|
@@ -760,39 +772,19 @@ export declare class AgentFramework {
|
|
|
760
772
|
private endedLogIndexed;
|
|
761
773
|
/** The last indexed entry's mark, so a log that changed under the index is seen. */
|
|
762
774
|
private endedLogTail;
|
|
763
|
-
/** Branch-independent recovery
|
|
764
|
-
*
|
|
775
|
+
/** Branch-independent recovery file for the host's mode (see
|
|
776
|
+
* FrameworkConfig.hostModePath). Undefined → branch-local slot fallback. */
|
|
765
777
|
private hostModePath;
|
|
778
|
+
/** Where a release before #291 mirrored its deferred-write queue (see
|
|
779
|
+
* FrameworkConfig.deferredWritesPath), read once at boot by the importer
|
|
780
|
+
* (importPersistedDeferredWrites), for one release. Undefined → the
|
|
781
|
+
* store's slot. */
|
|
766
782
|
private deferredWritesPath;
|
|
783
|
+
/** The writes the importer left queued for the next boot, its agent's
|
|
784
|
+
* store having failed (importPersistedDeferredWrites): reconcile doesn't
|
|
785
|
+
* deliver again the mail one of them carries. One release. */
|
|
786
|
+
private importLeftQueued;
|
|
767
787
|
private recoveryFallbackWarned;
|
|
768
|
-
/**
|
|
769
|
-
* Deferred writes that have been handed to a context manager but whose
|
|
770
|
-
* chronicle state is NOT yet durably synced. They stay in the durable
|
|
771
|
-
* recovery queue until `ackDeferredWrites()` syncs the store — chronicle
|
|
772
|
-
* persists the slot-chain head only on sync(), so acknowledging on append
|
|
773
|
-
* alone would let a hard exit forget an accepted message.
|
|
774
|
-
*/
|
|
775
|
-
private unackedDeferredWrites;
|
|
776
|
-
/** Monotonic order stamp for deferred writes: the durable queue is always
|
|
777
|
-
* written, restored, drained and flushed in `seq` order, whatever the
|
|
778
|
-
* pending/un-acked split — a re-deferred entry keeps its place. Boot
|
|
779
|
-
* recovery numbers the restored queue 1..N in that order, and the stamp
|
|
780
|
-
* goes on from N (restorePersistedDeferredWrites). */
|
|
781
|
-
private deferredSeq;
|
|
782
|
-
/**
|
|
783
|
-
* Per target agent: the store's message count when the OLDEST currently
|
|
784
|
-
* un-acked entry for it was handed off. Persisted with the queue so a boot
|
|
785
|
-
* after an interrupted flush knows exactly which slot range the batch
|
|
786
|
-
* could occupy and dedups against all of it — never a fixed tail.
|
|
787
|
-
*/
|
|
788
|
-
private deferredScanFrom;
|
|
789
|
-
private deferredMessages;
|
|
790
|
-
/** The marked held writes whose store couldn't be searched, each with the
|
|
791
|
-
* failure said, said once until a lookup of them succeeds and again when
|
|
792
|
-
* the failure changes (landedCopiesById), and those a drain has said it
|
|
793
|
-
* holds what's queued behind (writeDrainedInOrder). */
|
|
794
|
-
private unsearchableSaid;
|
|
795
|
-
private stillUnknownSaid;
|
|
796
788
|
private activeTurnTokens;
|
|
797
789
|
/** Each running scheduler pass's requests, which it took from
|
|
798
790
|
* pendingRequests: it holds those of the agents it hasn't taken up yet
|
|
@@ -810,8 +802,10 @@ export declare class AgentFramework {
|
|
|
810
802
|
* (beginAgentTurn). */
|
|
811
803
|
private settledTurns;
|
|
812
804
|
/** Agents whose fresh turn's coalescing assembly is running
|
|
813
|
-
* (beginAgentTurn)
|
|
814
|
-
*
|
|
805
|
+
* (beginAgentTurn). What is stored for such an agent meanwhile is
|
|
806
|
+
* presented before its compile (presentAtStart's 'assembly'), so
|
|
807
|
+
* addMessage stores it with the event clock it is due, and doesn't
|
|
808
|
+
* mark its placement unpresented. */
|
|
815
809
|
private readonly assembling;
|
|
816
810
|
/**
|
|
817
811
|
* The InferenceRequest that started each agent's turn in progress — set and
|
|
@@ -896,6 +890,75 @@ export declare class AgentFramework {
|
|
|
896
890
|
* roles from here instead of excluding kinds by hand.
|
|
897
891
|
*/
|
|
898
892
|
private readonly registry;
|
|
893
|
+
/**
|
|
894
|
+
* The presentation index (#291, presentation.ts). Set once, in create(),
|
|
895
|
+
* before any agent is created; null only on a framework built from its
|
|
896
|
+
* prototype, as some suites build one. Each agent is taken on as it is
|
|
897
|
+
* registered (adoptPresentation), and from then on, for an agent whose
|
|
898
|
+
* window is presented (presents), a write enters the window at the
|
|
899
|
+
* agent's presentation points: its own rows as they are written, others'
|
|
900
|
+
* at its turn's start, at its tool boundary as the stream can carry them,
|
|
901
|
+
* at its turn's end, and at once while no turn of it is alive. Every
|
|
902
|
+
* write is stored at once.
|
|
903
|
+
*/
|
|
904
|
+
private presentation;
|
|
905
|
+
private bootFreeze;
|
|
906
|
+
/** The arrival listener adoptPresentation installed for each agent, by its unsubscribe. */
|
|
907
|
+
private readonly presentationListeners;
|
|
908
|
+
/**
|
|
909
|
+
* Writes a surgery's hold kept out of every store while the operator's
|
|
910
|
+
* switch was awaited (addMessage, and the writes into a fork's store), in
|
|
911
|
+
* arrival order. They are in memory only, so a crash during the surgery
|
|
912
|
+
* loses them: the release replays them through the ordinary write path
|
|
913
|
+
* (releaseSurgeryHeldWrites).
|
|
914
|
+
*/
|
|
915
|
+
private readonly surgeryHeldWrites;
|
|
916
|
+
/**
|
|
917
|
+
* Set while releaseSurgeryHeldWrites replays what a hold kept: the writes
|
|
918
|
+
* still to replay stay in surgeryHeldWrites, a write made meanwhile (a
|
|
919
|
+
* listener of a replayed write's trace) is kept behind them, and the
|
|
920
|
+
* tune-out's writesHeld reads true, as during the hold.
|
|
921
|
+
*/
|
|
922
|
+
private replayingHeld;
|
|
923
|
+
/**
|
|
924
|
+
* Set by addMessage and storeInFork where the write the release replays
|
|
925
|
+
* (`replayed`) meets a hold a listener of its own traces began: the write
|
|
926
|
+
* isn't stored, and stays at the head of the queue for that hold's
|
|
927
|
+
* release (releaseSurgeryHeldWrites reads and clears it).
|
|
928
|
+
*/
|
|
929
|
+
private replayHeldAgain;
|
|
930
|
+
/** A release of the tune-outs on record with no reader (releaseTuneOutsWithoutReader) that met held writes, to run once they are stored. */
|
|
931
|
+
private releaseWithoutReaderWaits;
|
|
932
|
+
/** How many writes this process has kept in memory (SurgeryHeldWrite.heldOrder): their arrival order across agents. */
|
|
933
|
+
private heldWritesKept;
|
|
934
|
+
/**
|
|
935
|
+
* Writes for an agent whose context manager refuses its work, by the
|
|
936
|
+
* agent's name, each agent's in arrival order: its re-initialization after
|
|
937
|
+
* a branch move failed (reinitializeManagers), and context-manager's
|
|
938
|
+
* initialization fence refused a write for it (refusesUntilReinitialized),
|
|
939
|
+
* at its writer or at a hold's release. Every later write for the agent
|
|
940
|
+
* waits behind them. They are in memory only, so a restart loses them: the
|
|
941
|
+
* next move that re-initializes the agent stores them, at its release, as
|
|
942
|
+
* the hold's own writes (recoverHeldWrites), and an agent that ends first
|
|
943
|
+
* passes on the ones the primary takes in its place (passHeldWritesOn).
|
|
944
|
+
*/
|
|
945
|
+
private readonly heldForRecovery;
|
|
946
|
+
/**
|
|
947
|
+
* The context managers that refuse their work until a re-initialization
|
|
948
|
+
* succeeds, each with what failed: a move's re-initialization of it
|
|
949
|
+
* (reinitializeManagers), or a failed surgery's restore that selected the
|
|
950
|
+
* branch and couldn't initialize it (restoreSourceBranch).
|
|
951
|
+
*/
|
|
952
|
+
private readonly managersRefusingWork;
|
|
953
|
+
/**
|
|
954
|
+
* The agents whose foreignRounds the framework sets (applyForeignRounds),
|
|
955
|
+
* each with the mode its configuration names: a resident that observes
|
|
956
|
+
* another (AgentConfig.foreignRounds), and the persistent subconscious
|
|
957
|
+
* (its config's); and an agent that takes its context from one of those
|
|
958
|
+
* (a derived agent, a conversation fork), with that agent's. Recorded at
|
|
959
|
+
* registration (configureForeignRounds).
|
|
960
|
+
*/
|
|
961
|
+
private readonly foreignRoundsConfigured;
|
|
899
962
|
/** Tell the first adoption candidate when task work is orphaned (config.dendrite.announceOrphans). */
|
|
900
963
|
private announceOrphans;
|
|
901
964
|
/**
|
|
@@ -911,8 +974,10 @@ export declare class AgentFramework {
|
|
|
911
974
|
/** Per source agent, per kind: how many derivations, since when, and at which count the last note went. */
|
|
912
975
|
private derivationTallies;
|
|
913
976
|
private readonly sharedSlotAgents;
|
|
914
|
-
/** The batched-wake lines already written (placeWakeLines),
|
|
915
|
-
*
|
|
977
|
+
/** The batched-wake lines already written (placeWakeLines), and the agents
|
|
978
|
+
* each was written for, so every later start of a wake writes each at
|
|
979
|
+
* most once for its agent: the delivery agent alone, and with the
|
|
980
|
+
* presentation index each resident a wake was for. */
|
|
916
981
|
private readonly placedWakeLines;
|
|
917
982
|
/** Rounds of tool calls, by their results array, that a save_recent_image
|
|
918
983
|
* in the round counted by their share of the bound: such a round is
|
|
@@ -921,10 +986,14 @@ export declare class AgentFramework {
|
|
|
921
986
|
/** Group commit: one fsync per event-loop turn, shared by every waiter. */
|
|
922
987
|
/** The windows of forks and runs deregistered while the host was quiesced,
|
|
923
988
|
* by agent name (releaseWindowNowOrAfterResume); resume() releases them
|
|
924
|
-
* (runReleasesAfterResume), or stop() passes on what they left
|
|
925
|
-
*
|
|
926
|
-
* its queue (drainDeferredFor). */
|
|
989
|
+
* (runReleasesAfterResume), or stop() passes on what they left unread,
|
|
990
|
+
* and clears them. */
|
|
927
991
|
private readonly releasesAfterResume;
|
|
992
|
+
/** Each released agent's reader facts, as the registry recorded them when
|
|
993
|
+
* its release was asked for (releaseWindowNowOrAfterResume), before a
|
|
994
|
+
* later agent can take its name: what its release reads as meant for it
|
|
995
|
+
* (releasedWindow). */
|
|
996
|
+
private readonly releasedReaders;
|
|
928
997
|
private readonly managerReleases;
|
|
929
998
|
private readonly releasedByCleanup;
|
|
930
999
|
private readonly resumesPending;
|
|
@@ -958,6 +1027,12 @@ export declare class AgentFramework {
|
|
|
958
1027
|
* publish the call makes is credited with (publishReadThrough). Kept only
|
|
959
1028
|
* while the dispatch runs (dispatchScriptToolCall). */
|
|
960
1029
|
private readonly scriptCallStarts;
|
|
1030
|
+
/** The marks of channel_publish calls still out (publishReadThrough's,
|
|
1031
|
+
* taken at the call), by agent, until their delivery settles: a redo
|
|
1032
|
+
* gives them again (heldMarksOf, retakeMarks), as it gives a running
|
|
1033
|
+
* script's, so a script's publish that settles after the redo is credited
|
|
1034
|
+
* with the rows put back (holdPublishMark). */
|
|
1035
|
+
private readonly publishMarksInFlight;
|
|
961
1036
|
/** Per agent, the unexpected thinking drops its last operator alert counted (noteThinkingLoss). */
|
|
962
1037
|
private readonly thinkingLossIncidents;
|
|
963
1038
|
/** Per live stream that can be noted, its rows so far after the compiled messages (noteRoundSent). */
|
|
@@ -1006,6 +1081,7 @@ export declare class AgentFramework {
|
|
|
1006
1081
|
private mcplToolServers;
|
|
1007
1082
|
/** Servers whose tools/list answered in the latest refresh. */
|
|
1008
1083
|
private mcplListedServers;
|
|
1084
|
+
private mcplPublishedConnections;
|
|
1009
1085
|
/** refreshMcplTools' starts, and the start whose result was published
|
|
1010
1086
|
* last: a refresh that a later-started one has overtaken publishes
|
|
1011
1087
|
* nothing, since that one listed every server after it. */
|
|
@@ -1078,7 +1154,6 @@ export declare class AgentFramework {
|
|
|
1078
1154
|
*/
|
|
1079
1155
|
private surgeryHold;
|
|
1080
1156
|
private readonly conversationSpawnsInFlight;
|
|
1081
|
-
private syncMoveReinit;
|
|
1082
1157
|
private holdAlertMs;
|
|
1083
1158
|
/** Serialize per-server drains so reconnect and an online undo cannot race. */
|
|
1084
1159
|
private discordAwarenessDrains;
|
|
@@ -1088,6 +1163,10 @@ export declare class AgentFramework {
|
|
|
1088
1163
|
private discordAwarenessDrainsJoined;
|
|
1089
1164
|
private eventGate;
|
|
1090
1165
|
private judgeWired;
|
|
1166
|
+
/** Wake onboarding's record of the agent's decisions (null: onboarding off, or no gate). */
|
|
1167
|
+
private wakeDecisions;
|
|
1168
|
+
/** The periodic review of what suppress rules hid; null with no gate or with the review off. */
|
|
1169
|
+
private suppressionReview;
|
|
1091
1170
|
/** The heartbeat (FrameworkConfig.heartbeat), when the host turns it on. */
|
|
1092
1171
|
private heartbeat;
|
|
1093
1172
|
private usageTracker;
|
|
@@ -1198,14 +1277,11 @@ export declare class AgentFramework {
|
|
|
1198
1277
|
* stop() fails with the cancel's error: that stop() doesn't wait for it,
|
|
1199
1278
|
* even with no budget, and a later stop() waits for it as for anything an
|
|
1200
1279
|
* earlier one left running (the last point below). After either:
|
|
1201
|
-
* - an agent still registered whose stream is still running
|
|
1202
|
-
*
|
|
1203
|
-
* own turn-end flush takes them when it settles, if the process lives on,
|
|
1204
|
-
* and a later stop() takes what that leaves; a memory-only queue loses
|
|
1205
|
-
* them if the process exits first.
|
|
1280
|
+
* - an agent still registered whose stream is still running may still
|
|
1281
|
+
* write; what it writes is stored as it is written, as every write is.
|
|
1206
1282
|
* - every ephemeral run still registered is ended, as after any stop(), and
|
|
1207
|
-
* its
|
|
1208
|
-
* stream is doing: once a run has left, its stream's late events are
|
|
1283
|
+
* its release passes on what it never read, as at any run's end, whatever
|
|
1284
|
+
* its stream is doing: once a run has left, its stream's late events are
|
|
1209
1285
|
* dropped, though a write the stream already had under way can still
|
|
1210
1286
|
* land in the run's namespace after them.
|
|
1211
1287
|
* - an event loop still in a call, such as a module's onProcess, finishes
|
|
@@ -1216,8 +1292,7 @@ export declare class AgentFramework {
|
|
|
1216
1292
|
* Each conversation fork still live ends, as a closing fork's end does,
|
|
1217
1293
|
* whatever its stream is doing, as each run does: its channel unbinds, and
|
|
1218
1294
|
* its window's release passes on to the primary the notices it left that
|
|
1219
|
-
* the primary takes in its place, unread in its window
|
|
1220
|
-
* for it unless it read the copy that landed there. Its end settles a
|
|
1295
|
+
* the primary takes in its place, unread in its window. Its end settles a
|
|
1221
1296
|
* tool-result batch its stream still held and removes the stream's
|
|
1222
1297
|
* entries, and once it has left, its stream's late events are dropped.
|
|
1223
1298
|
*/
|
|
@@ -1299,6 +1374,18 @@ export declare class AgentFramework {
|
|
|
1299
1374
|
* them beside the gate's own timers, so it can weigh what waiting costs.
|
|
1300
1375
|
*/
|
|
1301
1376
|
private upcomingWakesFor;
|
|
1377
|
+
/**
|
|
1378
|
+
* What will wake `agentName` with no new event, as healthSnapshot reports
|
|
1379
|
+
* it: soonest first, the first HEALTH_UPCOMING_WAKES of them, each with its
|
|
1380
|
+
* time, kind and whether the rule table lets it wake the agent (a probe:
|
|
1381
|
+
* gate.js isn't asked). A wake's `what` stays out: it can quote a reminder or
|
|
1382
|
+
* a queue reason, and health goes to observers granted nothing else.
|
|
1383
|
+
*
|
|
1384
|
+
* The field is left out when this can't say, so that it isn't taken for an
|
|
1385
|
+
* agent with nothing due: when a read throws, and when the heartbeat is
|
|
1386
|
+
* heartbeat-mcpl, whose next tick only its own process knows.
|
|
1387
|
+
*/
|
|
1388
|
+
private upcomingWakesHealth;
|
|
1302
1389
|
/**
|
|
1303
1390
|
* The heartbeat's ticks and reminders for `agentName`, soonest first, which
|
|
1304
1391
|
* the agent's rules decide as they decide a heartbeat push: one the rules
|
|
@@ -1342,7 +1429,7 @@ export declare class AgentFramework {
|
|
|
1342
1429
|
* tick stores no prompt: its turn, when the gate triggers one, is a silent
|
|
1343
1430
|
* heartbeat (silent-heartbeat.ts), prose suppressed. As for a stored push,
|
|
1344
1431
|
* the wake of the agent the text was delivered to is dropped once a
|
|
1345
|
-
* request of its own has carried and answered the text (
|
|
1432
|
+
* request of its own has carried and answered the text (readsRowFor);
|
|
1346
1433
|
* another resident's isn't tied to it.
|
|
1347
1434
|
*/
|
|
1348
1435
|
private deliverHeartbeat;
|
|
@@ -1756,7 +1843,9 @@ export declare class AgentFramework {
|
|
|
1756
1843
|
/** What an agent is told when a send tool's words go to a channel it tuned
|
|
1757
1844
|
* out, or undefined where nothing needs saying. A send keeps the tune-out
|
|
1758
1845
|
* (ChannelRegistry.openChannelNow), so the agent that sent there expecting
|
|
1759
|
-
* answers learns they still
|
|
1846
|
+
* answers learns they are still held from it, and who reads them
|
|
1847
|
+
* meanwhile: the reader by the name it runs under, or forks of its
|
|
1848
|
+
* context (tuneOutReader). A send tool's answer
|
|
1760
1849
|
* carries this, send_dm's included, or for a code_execution script's send
|
|
1761
1850
|
* a notice in the agent's window: a tune-out diverts a DM too. The same setting
|
|
1762
1851
|
* turns it off, a conversation agent gets none, and a failure while
|
|
@@ -1923,17 +2012,16 @@ export declare class AgentFramework {
|
|
|
1923
2012
|
static readonly QUIESCE_TIMEOUT_MAX_MS = 600000;
|
|
1924
2013
|
static readonly QUIESCE_TIMEOUT_DEFAULT_MS = 120000;
|
|
1925
2014
|
/**
|
|
1926
|
-
* Enter quiesce mode:
|
|
1927
|
-
*
|
|
1928
|
-
*
|
|
1929
|
-
*
|
|
1930
|
-
*
|
|
1931
|
-
*
|
|
1932
|
-
*
|
|
1933
|
-
*
|
|
1934
|
-
*
|
|
1935
|
-
*
|
|
1936
|
-
* (writeDeferredWritesForQuiesce).
|
|
2015
|
+
* Enter quiesce mode: persist the flag, suppress gate deliveries, pause all
|
|
2016
|
+
* MCPL data planes, and wait for in-flight turns to settle (turn-alive is
|
|
2017
|
+
* a turn token, which spans dequeue → settled teardown, a continuation of
|
|
2018
|
+
* the turn on its way to its start, or the turn's retry, which a provider
|
|
2019
|
+
* hold keeps or which waits to start: turnHolders). Idempotent. While
|
|
2020
|
+
* quiesced a write is stored at once, as always, unless a surgery's hold
|
|
2021
|
+
* or a context manager refusing its work keeps it in memory, and the
|
|
2022
|
+
* presentation index presents no agent another's row until resume
|
|
2023
|
+
* (#291): every window is frozen but for each agent's own rows, a
|
|
2024
|
+
* draining turn's tool boundaries included.
|
|
1937
2025
|
*
|
|
1938
2026
|
* On drain timeout the host STAYS quiesced (`drained: false` in the
|
|
1939
2027
|
* result); with `abandon: true` the undrained streams are cancelled via a
|
|
@@ -1968,49 +2056,15 @@ export declare class AgentFramework {
|
|
|
1968
2056
|
}): Promise<HostModeStatus>;
|
|
1969
2057
|
private runResume;
|
|
1970
2058
|
/**
|
|
1971
|
-
*
|
|
1972
|
-
*
|
|
1973
|
-
*
|
|
1974
|
-
*
|
|
1975
|
-
*
|
|
1976
|
-
*
|
|
1977
|
-
*
|
|
1978
|
-
*
|
|
1979
|
-
*
|
|
1980
|
-
* go on. One the store refuses as malformed, which it would at every flush,
|
|
1981
|
-
* is logged and dropped instead, and what is behind it goes on. (A write
|
|
1982
|
-
* that isn't deferred can still land ahead of it, such as one for an idle
|
|
1983
|
-
* agent once the host has resumed.) A boot that meets it again logs it and
|
|
1984
|
-
* goes on.
|
|
1985
|
-
*
|
|
1986
|
-
* Per-target: an agent whose turn is still alive keeps ITS messages
|
|
1987
|
-
* deferred for its own turn boundary; everyone else's flush now.
|
|
1988
|
-
*/
|
|
1989
|
-
private flushDeferredWrites;
|
|
1990
|
-
/**
|
|
1991
|
-
* Acknowledge every deferred write that has been handed to a context
|
|
1992
|
-
* manager: sync the chronicle so the appended slots are durable, and only
|
|
1993
|
-
* then drop them from the recovery queue. If the sync fails they stay in
|
|
1994
|
-
* the durable queue (the next ack, or stop(), retries); a reboot in that
|
|
1995
|
-
* state replays them, deduplicated by `deferredWriteId` for any that did
|
|
1996
|
-
* reach disk. Idempotent and cheap when nothing is un-acked.
|
|
1997
|
-
*/
|
|
1998
|
-
private ackDeferredWrites;
|
|
1999
|
-
/**
|
|
2000
|
-
* Move drained entries into the un-acked set and record, per target
|
|
2001
|
-
* agent, the store position they will be appended after — then persist
|
|
2002
|
-
* that receipt BEFORE any of them is written. Boot recovery scans from the
|
|
2003
|
-
* recorded position to the tail, so every member of an interrupted batch
|
|
2004
|
-
* is visible to the dedup, however large the batch.
|
|
2005
|
-
*/
|
|
2006
|
-
private handOffDeferredWrites;
|
|
2007
|
-
/**
|
|
2008
|
-
* Which of `ids` already exist in some agent's store as a landed deferred
|
|
2009
|
-
* write (`metadata.deferredWriteId`). Scans each context manager's recent
|
|
2010
|
-
* tail blob-free — an interrupted flush is always within the last few
|
|
2011
|
-
* hundred slots — and tolerates facades without windowed reads. A context
|
|
2012
|
-
* that can't be read throws, naming its agent: counted as holding none, a
|
|
2013
|
-
* write that landed there before its ack would land a second time.
|
|
2059
|
+
* Which of `ids`, an earlier release's queued writes, already exist in
|
|
2060
|
+
* some agent's store as a landed write (`metadata.deferredWriteId`): one an
|
|
2061
|
+
* interrupted flush of that release stored before its ack, or one this
|
|
2062
|
+
* importer stored at a boot that ended before it cleared the record. Scans
|
|
2063
|
+
* each context manager from the record's per-agent position (the whole
|
|
2064
|
+
* store where it names none) to the tail, blob-free, and tolerates facades
|
|
2065
|
+
* without windowed reads. A context that can't be read throws, naming its
|
|
2066
|
+
* agent: counted as holding none, a write that landed there would land a
|
|
2067
|
+
* second time.
|
|
2014
2068
|
*/
|
|
2015
2069
|
private landedDeferredWriteIds;
|
|
2016
2070
|
/** Atomic, durable JSON write for the recovery files. The document goes to
|
|
@@ -2043,95 +2097,144 @@ export declare class AgentFramework {
|
|
|
2043
2097
|
private readRecoveryFile;
|
|
2044
2098
|
private warnRecoveryFallbackOnce;
|
|
2045
2099
|
/**
|
|
2046
|
-
*
|
|
2047
|
-
*
|
|
2048
|
-
*
|
|
2049
|
-
*
|
|
2050
|
-
*
|
|
2051
|
-
*
|
|
2052
|
-
*
|
|
2053
|
-
*
|
|
2054
|
-
*
|
|
2055
|
-
*
|
|
2056
|
-
*
|
|
2057
|
-
*
|
|
2058
|
-
*
|
|
2059
|
-
*
|
|
2100
|
+
* Store, once, the context writes a release before #291 left queued
|
|
2101
|
+
* (src/deferred-import.ts reads its record), and clear the record. One
|
|
2102
|
+
* release only: the release after this one deletes it. A host boots this
|
|
2103
|
+
* release until its record is empty (the `deferred-import` alert says
|
|
2104
|
+
* when writes stay queued, such as those for an agent a move cut), and
|
|
2105
|
+
* doesn't upgrade past it from a release that kept a queue.
|
|
2106
|
+
*
|
|
2107
|
+
* Such a release held a write while its agent's turn was alive or the host
|
|
2108
|
+
* was quiesced, and mirrored the queue to its recovery file (or the
|
|
2109
|
+
* store's slot) while quiesced, or from a flush that might not have
|
|
2110
|
+
* reached disk, until the queue drained. This release keeps no queue, so
|
|
2111
|
+
* create() calls this once, after the quiesced flags are restored and
|
|
2112
|
+
* every agent's window was written down at its registration, and before
|
|
2113
|
+
* the boot's pass over the windows (repairAndRest) and the registry's
|
|
2114
|
+
* reconcile:
|
|
2115
|
+
*
|
|
2116
|
+
* - A record that can't be read, or that isn't a queue, fails create()
|
|
2117
|
+
* (deferredWritesRefusal), and so does a context that can't be checked
|
|
2118
|
+
* for writes that already landed: taken as empty, the writes would never
|
|
2119
|
+
* be stored, or would be stored twice.
|
|
2120
|
+
* - Each write is stored in the order it arrived, across agents, under
|
|
2121
|
+
* its own id (`metadata.deferredWriteId`, addMessage's `imported`), so a
|
|
2122
|
+
* later boot finds it. One that already landed is skipped by that id: an
|
|
2123
|
+
* interrupted flush of the earlier release stored it before its ack, or
|
|
2124
|
+
* a boot of this one stored it and ended before it cleared the record.
|
|
2125
|
+
* One whose earlier write may have landed (`landing: 'unknown'`) is
|
|
2126
|
+
* looked up across its agent's whole branch first: found, it isn't
|
|
2127
|
+
* stored again; where the branch can't be searched, that agent is cut
|
|
2128
|
+
* there.
|
|
2129
|
+
* - A write keeps the audience it was queued with. One queued with none,
|
|
2130
|
+
* by a release before the stamp, is stamped as addMessage stamps any
|
|
2131
|
+
* write, and a tool-block pair (the puppet's) as its agent's own row.
|
|
2132
|
+
* - A write for an agent no longer registered goes to the primary, as its
|
|
2133
|
+
* by-name notice under the write's own id, when it is a failed reply, a
|
|
2134
|
+
* channel notice its reader could act on, or a module's write for a run
|
|
2135
|
+
* or a fork (passesToPrimary); anything else is dropped, logged. The
|
|
2136
|
+
* notice is stamped for the primary alone, whatever stamp the write was
|
|
2137
|
+
* queued with: one for the gone agent would put it in no window.
|
|
2138
|
+
* - A write that can't be stored cuts its agent: it and that agent's later
|
|
2139
|
+
* writes stay in the record for the next boot, and the other agents' go
|
|
2140
|
+
* on. One context-manager refuses as malformed, which it would at every
|
|
2141
|
+
* boot, is dropped, logged.
|
|
2142
|
+
* - A tune-out's release (`kind: 'tune-out-cancel'`) stored here owes its
|
|
2143
|
+
* agent the wake its cancel requested (#232 gap 6).
|
|
2144
|
+
* - Mail an imported write carries is released as it is stored
|
|
2145
|
+
* (releaseLandedMail), so reconcile doesn't deliver it again; the
|
|
2146
|
+
* boot's pass after the import asks its recipient's wake
|
|
2147
|
+
* (wakeForUnpresentedMail), as the delivery did.
|
|
2060
2148
|
*
|
|
2061
|
-
* A write
|
|
2062
|
-
*
|
|
2063
|
-
*
|
|
2064
|
-
*
|
|
2065
|
-
*
|
|
2066
|
-
*
|
|
2067
|
-
*
|
|
2068
|
-
*
|
|
2069
|
-
*
|
|
2070
|
-
*
|
|
2071
|
-
*
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
* the
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
*
|
|
2080
|
-
*
|
|
2081
|
-
*
|
|
2082
|
-
*
|
|
2083
|
-
*
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
*
|
|
2088
|
-
*
|
|
2089
|
-
*
|
|
2090
|
-
*
|
|
2091
|
-
*
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
*
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
private
|
|
2098
|
-
/**
|
|
2099
|
-
*
|
|
2100
|
-
*
|
|
2101
|
-
*
|
|
2102
|
-
*
|
|
2103
|
-
*
|
|
2104
|
-
*
|
|
2105
|
-
*
|
|
2106
|
-
*
|
|
2107
|
-
*
|
|
2108
|
-
*
|
|
2109
|
-
*
|
|
2110
|
-
*
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
*
|
|
2115
|
-
*
|
|
2116
|
-
*
|
|
2117
|
-
*
|
|
2118
|
-
*
|
|
2119
|
-
*
|
|
2120
|
-
*
|
|
2121
|
-
*
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
*
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
*
|
|
2129
|
-
*
|
|
2130
|
-
*
|
|
2131
|
-
*
|
|
2132
|
-
*
|
|
2133
|
-
|
|
2134
|
-
|
|
2149
|
+
* - A write with no id is given one as it is read (readPersistedDeferredWrites),
|
|
2150
|
+
* and the record is written with it before anything is stored, so the
|
|
2151
|
+
* next boot finds a copy that landed by it. Where that write fails,
|
|
2152
|
+
* such a write cuts its agent.
|
|
2153
|
+
*
|
|
2154
|
+
* What is stored is presented to no window here: the pass after the
|
|
2155
|
+
* import presents each agent its own rows and what it is owed at rest, and
|
|
2156
|
+
* a quiesced host's other rows wait for resume. Once every write is stored
|
|
2157
|
+
* the store is synced, and only then is the record cleared, or written
|
|
2158
|
+
* again with the writes cut for the next boot; a sync that fails leaves
|
|
2159
|
+
* the record as it was, and the next boot skips what landed.
|
|
2160
|
+
*/
|
|
2161
|
+
private importPersistedDeferredWrites;
|
|
2162
|
+
/**
|
|
2163
|
+
* At boot, the wakes a tune-out's rows still owe their agents (#232 gap
|
|
2164
|
+
* 6). A tune-out's release for the resident (`kind: 'tune-out-cancel'`)
|
|
2165
|
+
* and its notices for the subconscious (`tune-out-wake`,
|
|
2166
|
+
* `tune-out-cadence`, `tune-out-cancel-report`,
|
|
2167
|
+
* `tune-out-note-undelivered`) are stored at once and
|
|
2168
|
+
* made durable (commitDeliveries), but the wake each asks for is in
|
|
2169
|
+
* memory. One stored while a turn of its agent's was alive stays out of
|
|
2170
|
+
* that agent's window until its next tool boundary or the turn's end,
|
|
2171
|
+
* and its wake runs after; a
|
|
2172
|
+
* process that ended before then lost the wake, and the row is still not
|
|
2173
|
+
* in the window at the next boot. So each such row owes its agent a wake,
|
|
2174
|
+
* asked for here, before the boot's pass presents what each agent is owed
|
|
2175
|
+
* (repairAndRest). Earlier releases kept such a row in the deferred queue,
|
|
2176
|
+
* whose restore asked for the same wake; the importer still asks for it
|
|
2177
|
+
* for a release it stores (importPersistedDeferredWrites), and is not
|
|
2178
|
+
* asked twice. A row in the window already was presented at rest or
|
|
2179
|
+
* injected at a tool boundary, its wake run or lost with the turn as
|
|
2180
|
+
* before #291. Nothing for an agent the index doesn't present for. A
|
|
2181
|
+
* window that can't be read is logged and asks for nothing, and its agent
|
|
2182
|
+
* is returned: the boot's pass leaves what it is owed out of its window
|
|
2183
|
+
* (repairAndRest's `restExcept`), so a later boot reads it again.
|
|
2184
|
+
*/
|
|
2185
|
+
private wakeForUnpresentedTuneOutRows;
|
|
2186
|
+
/**
|
|
2187
|
+
* At boot, the wakes stored mail still owes its recipients (#291). A
|
|
2188
|
+
* result or a message is stored for its recipient as it is delivered,
|
|
2189
|
+
* whatever the recipient's turn, and its mail released once the store has
|
|
2190
|
+
* synced the row (releaseLandedMail); the wake the delivery asks for is in
|
|
2191
|
+
* memory. Mail stored while a turn of its recipient's was alive stays out
|
|
2192
|
+
* of that agent's window until the turn's next point (its tool boundary
|
|
2193
|
+
* or its end), and its wake runs after the turn, unless a request of
|
|
2194
|
+
* the turn carried the row and was answered (rowDone); a process that
|
|
2195
|
+
* ended before then lost the wake, and the next boot has nothing left to
|
|
2196
|
+
* deliver: the mail is no longer held (or is released there, its copy
|
|
2197
|
+
* found in the store), and an interrupted job's result, stored, needs no
|
|
2198
|
+
* "ended without a result" notice (resultStoredFor). So each agent the
|
|
2199
|
+
* index presents for is woken, once per sender and kind, for each row of
|
|
2200
|
+
* mail it is owed and its window doesn't hold, as the delivery's wake
|
|
2201
|
+
* (`agent-<kind>:<sender>`, source 'dendrite'), asked for here, before the
|
|
2202
|
+
* boot's pass presents what each agent is owed (repairAndRest). That
|
|
2203
|
+
* covers mail an earlier release left queued, which the importer stores
|
|
2204
|
+
* and releases. The row is the recipient's when it
|
|
2205
|
+
* names that agent as the one it is for (`dendrite.to`); one stored before
|
|
2206
|
+
* mail named its recipient counts for an agent its audience names, so a
|
|
2207
|
+
* slot's observer isn't woken for a resident's mail. Mail whose sender
|
|
2208
|
+
* asked for no wake (sendAgentMessage's `wake: false`, recorded on the row
|
|
2209
|
+
* as `dendrite.wake: false`) asks for none; reconcile's redelivery of held
|
|
2210
|
+
* mail doesn't ask, as the registry doesn't record it. Mail an earlier
|
|
2211
|
+
* release left queued records no such ask (that release didn't queue
|
|
2212
|
+
* it), so it is woken for whatever its sender asked, where main asked no
|
|
2213
|
+
* boot wake for any queued mail.
|
|
2214
|
+
* Mail in the window already was presented at rest, or sent in a request
|
|
2215
|
+
* of the turn's (at its tool boundary), its wake run or lost as before
|
|
2216
|
+
* #291, and asks for none; nor does a wake with the same reason already
|
|
2217
|
+
* pending. A window that can't be read is logged and asks for nothing, and
|
|
2218
|
+
* its agent is returned, as wakeForUnpresentedTuneOutRows returns one. The
|
|
2219
|
+
* wakes are asked in memory: once the pass has presented the rows, a
|
|
2220
|
+
* process that ends, or a create() that fails, before they run loses them,
|
|
2221
|
+
* and the next boot, which finds the rows in the window, asks for none.
|
|
2222
|
+
*/
|
|
2223
|
+
private wakeForUnpresentedMail;
|
|
2224
|
+
/**
|
|
2225
|
+
* Write the deferred-write record the importer read once it is done:
|
|
2226
|
+
* empty, or holding the writes it left for the next boot, in their order.
|
|
2227
|
+
* The file where it was read from the file, else the store's slot. A
|
|
2228
|
+
* write that fails is logged and alerted: the next boot imports the
|
|
2229
|
+
* record again, and skips what landed by its id.
|
|
2230
|
+
*/
|
|
2231
|
+
private writeImportedRecord;
|
|
2232
|
+
/**
|
|
2233
|
+
* Write the deferred-write record the importer reads: empty, or holding
|
|
2234
|
+
* `entries`, in their order. The file where it was read from the file,
|
|
2235
|
+
* else the store's slot, synced. Throws what the write threw.
|
|
2236
|
+
*/
|
|
2237
|
+
private recordImportQueue;
|
|
2135
2238
|
/**
|
|
2136
2239
|
* Operator-driven maintenance: run (or join) one bounded compression pass —
|
|
2137
2240
|
* the same runQueuedMaintenance the timer drives, so tool definitions are
|
|
@@ -2482,13 +2585,22 @@ export declare class AgentFramework {
|
|
|
2482
2585
|
private discardEphemeralCandidate;
|
|
2483
2586
|
/**
|
|
2484
2587
|
* The default wording for the call that derived a child: who it is, what
|
|
2485
|
-
* kind, and how long — the fields the
|
|
2588
|
+
* kind, and how long — the fields the creation event names, so the fork
|
|
2486
2589
|
* never has to infer its own lifetime from context (Linn, 10-09).
|
|
2487
2590
|
*/
|
|
2488
2591
|
private derivedNote;
|
|
2489
2592
|
/**
|
|
2490
2593
|
* The parent's in-flight tool round, reproduced on the child's branch so
|
|
2491
2594
|
* the child sees the call that made it (see `DeriveAgentOptions.pendingRound`).
|
|
2595
|
+
*
|
|
2596
|
+
* The results it carries are the ones the parent holds: while the round
|
|
2597
|
+
* waits for its tools, those `completed` so far; once every result is in,
|
|
2598
|
+
* the `ready` state's `toolResults`. A round stays pending while a boundary
|
|
2599
|
+
* builds its results for storing (the ordinary tool boundary, or a stream
|
|
2600
|
+
* that completed while its tools ran, which gave each call still running
|
|
2601
|
+
* an error result), and the state is `ready` then, so a derive landing in
|
|
2602
|
+
* that build frames the round with its results, never with a note that a
|
|
2603
|
+
* call whose result is in is still running.
|
|
2492
2604
|
*/
|
|
2493
2605
|
private framePendingRound;
|
|
2494
2606
|
/**
|
|
@@ -2530,10 +2642,20 @@ export declare class AgentFramework {
|
|
|
2530
2642
|
* - A live agent: a snapshot derived from its context — at the head, or
|
|
2531
2643
|
* at `atSequence` for an earlier state. The snapshot is its own branch;
|
|
2532
2644
|
* the agent keeps running and is not affected by anything done to it.
|
|
2645
|
+
* `atSequence` is a sequence on the store's branch that follows a
|
|
2646
|
+
* presentation into the agent's window (#291), such as
|
|
2647
|
+
* `getStore().currentSequence()` read after one, not a row's own
|
|
2648
|
+
* sequence: a row enters the window at a write after its own, so a cut
|
|
2649
|
+
* at the row's own sequence holds it in the snapshot's record
|
|
2650
|
+
* (getAllMessages) and not in its window (getPresentedMessages), where
|
|
2651
|
+
* it reads as arrived (context-manager's derive).
|
|
2533
2652
|
* - An ended agent: the context it left, reopened where it lives.
|
|
2534
2653
|
*
|
|
2535
|
-
* The returned manager uses a passthrough strategy
|
|
2536
|
-
*
|
|
2654
|
+
* The returned manager uses a passthrough strategy, so nothing is
|
|
2655
|
+
* folded: its compile is the agent's window as the agent's view shows it
|
|
2656
|
+
* (the rows the window holds, through its view filter), and in legacy
|
|
2657
|
+
* mode, where the window is the record, the record so. getAllMessages()
|
|
2658
|
+
* lists the record. An ended agent's context is the real one — treat it as
|
|
2537
2659
|
* read-only unless you mean to change what a later resume starts from.
|
|
2538
2660
|
*/
|
|
2539
2661
|
inspectAgentContext(name: string, options?: {
|
|
@@ -2541,6 +2663,31 @@ export declare class AgentFramework {
|
|
|
2541
2663
|
}): Promise<ContextManager>;
|
|
2542
2664
|
/** Open the context an ended agent left, wherever it lives. */
|
|
2543
2665
|
private reopenAgentContext;
|
|
2666
|
+
/**
|
|
2667
|
+
* The view an agent's live context was opened with, by where its rows go
|
|
2668
|
+
* and what it observes (context-options.ts): a resident's, on the
|
|
2669
|
+
* residents' slot, or for an isolated agent that watches that slot, the
|
|
2670
|
+
* residents' view when its edge leaves held traffic out, and the
|
|
2671
|
+
* subconscious's when it shows it. Undefined for an isolated agent that
|
|
2672
|
+
* watches no residents' slot on its branch (a worker, a conversation
|
|
2673
|
+
* fork), whose context was opened with no filter.
|
|
2674
|
+
*/
|
|
2675
|
+
private liveViewFilterOf;
|
|
2676
|
+
/**
|
|
2677
|
+
* The agent a chain of shared derivations started from, whose view each
|
|
2678
|
+
* derived context in it inherited: `record` itself when it isn't one, and
|
|
2679
|
+
* the newest record the registry has of a parent otherwise, back to one
|
|
2680
|
+
* that isn't (or one the registry no longer knows, by its name).
|
|
2681
|
+
*/
|
|
2682
|
+
private viewOwnerOf;
|
|
2683
|
+
/**
|
|
2684
|
+
* The view a context derived by shared inheritance was opened with
|
|
2685
|
+
* (deriveSharedContext): what the agent its chain of derivations started
|
|
2686
|
+
* from sees (liveViewFilterOf), and the stored injections of each agent in
|
|
2687
|
+
* the chain, which carry that agent's name and would otherwise read as
|
|
2688
|
+
* another's. Undefined when the owner's context has no filter.
|
|
2689
|
+
*/
|
|
2690
|
+
private derivedViewFilterOf;
|
|
2544
2691
|
/** Open a derived agent's context on a branch of its own (see deriveAgent). */
|
|
2545
2692
|
private deriveSharedContext;
|
|
2546
2693
|
/** Flat list of registered agents with their roles, lifetime and relationships. */
|
|
@@ -2641,19 +2788,23 @@ export declare class AgentFramework {
|
|
|
2641
2788
|
* else would surface it (reparentAgent delivers it).
|
|
2642
2789
|
*/
|
|
2643
2790
|
private tellResultHeld;
|
|
2644
|
-
/**
|
|
2791
|
+
/**
|
|
2792
|
+
* A host-framed lifecycle fact in an agent's context. Never voiced as
|
|
2793
|
+
* anyone. Its `dendrite` detail names the agent it is for (`to`), as mail's
|
|
2794
|
+
* does.
|
|
2795
|
+
*/
|
|
2645
2796
|
private lifecycleNotice;
|
|
2646
2797
|
/**
|
|
2647
|
-
* The creation
|
|
2648
|
-
*
|
|
2649
|
-
*
|
|
2650
|
-
*
|
|
2651
|
-
*
|
|
2652
|
-
*
|
|
2653
|
-
*
|
|
2654
|
-
*
|
|
2655
|
-
*
|
|
2656
|
-
*
|
|
2798
|
+
* The creation event: names what kind of agent this is, what ends it and
|
|
2799
|
+
* what happens to it when its spawner ends. A derived agent's creation is
|
|
2800
|
+
* told to the agent it was derived from only when the host asks for it
|
|
2801
|
+
* with a derivationNotice and that returns text: one host-framed line in
|
|
2802
|
+
* the source's context, with no wake, given the framework's line built
|
|
2803
|
+
* from the same facts as the trace. Without one the source is told
|
|
2804
|
+
* nothing; the trace is emitted either way. Both derivation paths announce
|
|
2805
|
+
* after the fork's branch or copy exists, so a fork never inherits the
|
|
2806
|
+
* notice about itself; a source that has ended is told nothing
|
|
2807
|
+
* (lifecycleNotice).
|
|
2657
2808
|
*/
|
|
2658
2809
|
private announceAgentCreated;
|
|
2659
2810
|
/** The derivation notice's text, addressed to the agent `from` the record was derived. */
|
|
@@ -2739,6 +2890,9 @@ export declare class AgentFramework {
|
|
|
2739
2890
|
* ran would be overwritten by this boot's first registration.
|
|
2740
2891
|
*/
|
|
2741
2892
|
private restoreAgentRegistry;
|
|
2893
|
+
private passOnInterruptedNotices;
|
|
2894
|
+
/** The rows of the interrupted record `from` (name#incarnation@createdAt) whose pass the primary's store holds (passOnInterruptedNotices). */
|
|
2895
|
+
private rowsPassedOn;
|
|
2742
2896
|
/**
|
|
2743
2897
|
* Boot reconciliation, once configuration has declared its agents.
|
|
2744
2898
|
* Restart behaviour follows from lifetime: persistent agents were just
|
|
@@ -2750,11 +2904,54 @@ export declare class AgentFramework {
|
|
|
2750
2904
|
/**
|
|
2751
2905
|
* Deliver held mail that hasn't landed. Its copy may have reached the
|
|
2752
2906
|
* recipient's store in the same sync that the release missed, and then it
|
|
2753
|
-
* is released instead
|
|
2754
|
-
*
|
|
2755
|
-
*
|
|
2907
|
+
* is released instead. In the residents' shared slot the recipient's
|
|
2908
|
+
* store holds every resident's mail, so a copy counts only where it was
|
|
2909
|
+
* for this recipient (dendrite.to); a row stored before mail carried `to`
|
|
2910
|
+
* counts by its mail id alone (isMailCopyFor).
|
|
2911
|
+
*
|
|
2912
|
+
* A write an earlier release queued for this mail, which the importer
|
|
2913
|
+
* stored, was released as it was stored (releaseLandedMail), and one
|
|
2914
|
+
* whose release missed its sync is found here. One the importer left
|
|
2915
|
+
* queued for the next boot (importLeftQueued) lands then and releases the
|
|
2916
|
+
* mail then; a second delivery here would put it in the window twice
|
|
2917
|
+
* under one mail id. A copy for another recipient is not that write, as a
|
|
2918
|
+
* stored one isn't.
|
|
2919
|
+
*
|
|
2920
|
+
* A copy found is released only once the store has synced, as
|
|
2921
|
+
* releaseLandedMail releases: the copy may be in memory only (an import
|
|
2922
|
+
* whose sync failed), and the release is written to the registry's own
|
|
2923
|
+
* recovery file at once. A sync that fails leaves the mail held and
|
|
2924
|
+
* undelivered, for the next boot's check.
|
|
2756
2925
|
*/
|
|
2757
2926
|
private deliverHeldMail;
|
|
2927
|
+
/**
|
|
2928
|
+
* Whether `recipient`'s store holds a result the agent `record` names
|
|
2929
|
+
* delivered in this incarnation, for that recipient (dendrite.to, or none
|
|
2930
|
+
* on a row stored before mail named its recipient). Mail is released once
|
|
2931
|
+
* its row is stored, so after a restart that interrupted the agent, its
|
|
2932
|
+
* result is no longer held mail but is in the store: a recipient whose
|
|
2933
|
+
* turn was alive when it arrived has it stored at once, as an idle one
|
|
2934
|
+
* does (#291). It counts as handed over even while it is out of the
|
|
2935
|
+
* recipient's window, the turn it arrived in cut off by the restart: the
|
|
2936
|
+
* boot asked that recipient's wake for it again (wakeForUnpresentedMail),
|
|
2937
|
+
* and its pass presented it.
|
|
2938
|
+
*
|
|
2939
|
+
* A result counts only where it was produced (dendrite.producedAt, which
|
|
2940
|
+
* every delivered result carries) at or after the record was created: a
|
|
2941
|
+
* single-use name whose counter aged out of the registry starts again at
|
|
2942
|
+
* incarnation 1, so an earlier agent of that name and incarnation may have
|
|
2943
|
+
* delivered one to the same recipient. Both times are the registry's wall
|
|
2944
|
+
* clock (Date.now): the two agents are always on opposite sides of a
|
|
2945
|
+
* restart, so they don't share a millisecond, but a clock stepped back
|
|
2946
|
+
* between the record's creation and its result can misjudge the result
|
|
2947
|
+
* as an earlier agent's.
|
|
2948
|
+
*
|
|
2949
|
+
* Undefined where the store can't be read, which is logged: whether the
|
|
2950
|
+
* result was handed over is unknown, so the boot leaves the record out of
|
|
2951
|
+
* its notice and of its settling (settleInterrupted), and the next boot
|
|
2952
|
+
* asks again.
|
|
2953
|
+
*/
|
|
2954
|
+
private resultStoredFor;
|
|
2758
2955
|
private createDeferred;
|
|
2759
2956
|
/** Liveness ping for an active ephemeral run (no-op otherwise). */
|
|
2760
2957
|
private touchEphemeralRun;
|
|
@@ -2810,9 +3007,22 @@ export declare class AgentFramework {
|
|
|
2810
3007
|
* Query inference logs.
|
|
2811
3008
|
* Returns entries with summary info (doesn't resolve blobs).
|
|
2812
3009
|
*/
|
|
2813
|
-
/** Tune-out (issue #77):
|
|
2814
|
-
*
|
|
2815
|
-
private
|
|
3010
|
+
/** Tune-out (issue #77): hold a channel. Offered when a reader is
|
|
3011
|
+
* configured (tuneOutOffered), its text naming the reader (tuneOutTool). */
|
|
3012
|
+
private tuneOutToolDefinition;
|
|
3013
|
+
/**
|
|
3014
|
+
* The reader of a tuned-out channel's traffic, as the text a resident
|
|
3015
|
+
* reads describes it (tuneOutTool, tunedOutSendNote, tune_out's answers
|
|
3016
|
+
* and the channel registry's refusals of a tuned-out channel): the persistent
|
|
3017
|
+
* subconscious by the name it runs under, which the host gives it, or
|
|
3018
|
+
* reader forks as forks of the resident's context. There is no hold
|
|
3019
|
+
* without a reader (0.33.0): a tune-out is on record with none running
|
|
3020
|
+
* only where its release failed, after the persistent reader ended or at
|
|
3021
|
+
* a start with none configured. The text names the persistent reader as
|
|
3022
|
+
* configured then, or by its default name (persistentReaderName), as one
|
|
3023
|
+
* not running (`running: false`), which what its messages are says.
|
|
3024
|
+
*/
|
|
3025
|
+
private tuneOutReader;
|
|
2816
3026
|
/** `focus`: the resident-facing alias for `tune_out` with scope "all-except" (#232 decision 2). */
|
|
2817
3027
|
private static readonly FOCUS_TOOL;
|
|
2818
3028
|
/** Synthesized sleep/wake tool definitions (present when a gate is wired). */
|
|
@@ -2823,7 +3033,15 @@ export declare class AgentFramework {
|
|
|
2823
3033
|
* hot-reloaded gate.json (same validation as load), so a rule takes effect
|
|
2824
3034
|
* immediately and survives restart. */
|
|
2825
3035
|
private static readonly WAKE_RULE_TOOLS;
|
|
3036
|
+
/** Wake onboarding's answers (gate/wake-onboarding.ts): accept an MCPL
|
|
3037
|
+
* server's suggested treatment (MCPL RFC-001 §5), all of it or some, or
|
|
3038
|
+
* decline it. Present when a gate is wired and onboarding is on. */
|
|
3039
|
+
private static readonly WAKE_ONBOARDING_TOOLS;
|
|
2826
3040
|
private static readonly JUDGED_WAKE_RULE_TOOLS;
|
|
3041
|
+
/** What the agent's suppress rules have kept out of its context, read from the stamped rows (gate/suppression-stats.ts). Present when a gate is wired. */
|
|
3042
|
+
private static readonly SUPPRESSION_STATS_TOOL;
|
|
3043
|
+
/** Writes the stamped rows to a workspace file (gate/suppression-stats.ts). Present when a gate and a workspace are. */
|
|
3044
|
+
private static readonly DUMP_SUPPRESSED_TOOL;
|
|
2827
3045
|
/** Discoverability for event tags (MCPL RFC-001): the reserved chat:* core,
|
|
2828
3046
|
* each connected server's declared tag ontology, and gate.js status. */
|
|
2829
3047
|
private static readonly EVENT_TAGS_TOOL;
|
|
@@ -2864,6 +3082,35 @@ export declare class AgentFramework {
|
|
|
2864
3082
|
* skipped.
|
|
2865
3083
|
*/
|
|
2866
3084
|
private reactToRefusal;
|
|
3085
|
+
/**
|
|
3086
|
+
* Shed the newest turn: take the newest message that isn't a system
|
|
3087
|
+
* message, and that reached a request, out of what the agent is sent,
|
|
3088
|
+
* whoever wrote it, with the rest of its exchange (the tool_use turn
|
|
3089
|
+
* paired with a tool result, and the whole of a body stored in shards).
|
|
3090
|
+
* With `carried` (the stored bodies a refused request's compile carried,
|
|
3091
|
+
* by each body's first message id), only a message that request carried
|
|
3092
|
+
* counts, or the stored result of a call it carried, which goes with that
|
|
3093
|
+
* call as one exchange; a row that carries nothing a request sends
|
|
3094
|
+
* (asNextRequestCarries) is passed over and left in place. It adds no
|
|
3095
|
+
* marker; the caller keeps one consolidated marker for the episode
|
|
3096
|
+
* (updateRewindMarker). The returned record's descriptor says what was
|
|
3097
|
+
* set aside and its size, never the content. Returns null when nothing
|
|
3098
|
+
* that counts is left.
|
|
3099
|
+
*
|
|
3100
|
+
* On a presented window (#291) the shed is the window's: the newest rows
|
|
3101
|
+
* of the agent's own window, in its order, leave it as an undone turn's
|
|
3102
|
+
* do (retractRows with `undone`), so no presentation point brings them
|
|
3103
|
+
* back, and the record keeps them, as the marker says. No other agent's
|
|
3104
|
+
* window, nor its cache prefix or signed thinking, changes. A row the
|
|
3105
|
+
* agent is never sent is passed over: a system_change row, a row a
|
|
3106
|
+
* tune-out holds from residents (for an agent whose window leaves them
|
|
3107
|
+
* out), and another agent's stored context injection. On a window that is
|
|
3108
|
+
* still the record, the rows are removed from it, as before the index,
|
|
3109
|
+
* and leave every other window that held them.
|
|
3110
|
+
*
|
|
3111
|
+
* Shared by the refusal rewind, automatic or forced by `/unstick`, and by
|
|
3112
|
+
* the shed after inference exhaustion (quarantinePoisonedHistory).
|
|
3113
|
+
*/
|
|
2867
3114
|
private shedNewestTurn;
|
|
2868
3115
|
/**
|
|
2869
3116
|
* Maintain exactly ONE consolidated marker for the current rewind episode,
|
|
@@ -2920,8 +3167,11 @@ export declare class AgentFramework {
|
|
|
2920
3167
|
* Handle a `host/command` request from an MCPL surface server (e.g. a
|
|
2921
3168
|
* Discord slash command). Currently supports:
|
|
2922
3169
|
*
|
|
2923
|
-
* undo — revert the last N inference turns (
|
|
2924
|
-
* `undoLastTurn
|
|
3170
|
+
* undo — revert the last N inference turns on the agent's window (see
|
|
3171
|
+
* `undoLastTurn`; no branch moves), or with `messages`, the last N rows
|
|
3172
|
+
* of its window that are in its own slot (the record's, on a window that
|
|
3173
|
+
* is still the record), by a rollback onto a new branch (see
|
|
3174
|
+
* `rollbackToMessage`). The response includes the last message the agent
|
|
2925
3175
|
* would see in its context after the undo, obtained via the transparent
|
|
2926
3176
|
* `previewActivation` render (no inference, no Chronicle writes).
|
|
2927
3177
|
*
|
|
@@ -2987,73 +3237,260 @@ export declare class AgentFramework {
|
|
|
2987
3237
|
* It moves the store once any maintenance already running has finished, so
|
|
2988
3238
|
* the move can come after the call returns, and a refusal moves nothing.
|
|
2989
3239
|
* An operator's operation: refused once stop() has begun, and waited for
|
|
2990
|
-
* by stop() while it runs.
|
|
3240
|
+
* by stop() while it runs. It is written to the operator log as a
|
|
3241
|
+
* `checkout` (`requester` and `note` as the caller gives them), a refusal
|
|
3242
|
+
* or failure with its error, but for the refusal once stop() has begun,
|
|
3243
|
+
* which throws before anything is written.
|
|
2991
3244
|
*
|
|
2992
3245
|
* The branch moves under every agent sharing the store, so the switch
|
|
2993
3246
|
* reserves the store as a surgery does: every agent must be idle with no
|
|
2994
3247
|
* turn alive (no continuation or held retry of one on its way), or it is
|
|
2995
3248
|
* refused (OperatorActionError 'agent-busy'), and no turn starts until the
|
|
2996
|
-
* switch is done.
|
|
2997
|
-
*
|
|
2998
|
-
*
|
|
2999
|
-
* the
|
|
3000
|
-
* re-initialization fails raises an ops alert naming its agent
|
|
3249
|
+
* switch is done. Before the reservation is released every live agent's
|
|
3250
|
+
* context follows the move (followBranchMove): its context manager is
|
|
3251
|
+
* re-initialized for the branch (reinitializeManagers), and its window is
|
|
3252
|
+
* written down there if the branch was made before its write-down. One
|
|
3253
|
+
* whose re-initialization fails raises an ops alert naming its agent
|
|
3001
3254
|
* (`context-reinit-failed`), and the switch still resolves. A switch to the
|
|
3002
3255
|
* branch the store is already on re-initializes them too, which is how a
|
|
3003
3256
|
* manager left refusing by a failed re-initialization is recovered without
|
|
3004
3257
|
* a restart.
|
|
3005
3258
|
*/
|
|
3006
|
-
switchBranch(name: string
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
*
|
|
3012
|
-
*
|
|
3259
|
+
switchBranch(name: string, opts?: {
|
|
3260
|
+
requester?: OperatorRequester;
|
|
3261
|
+
note?: string;
|
|
3262
|
+
}): Promise<void>;
|
|
3263
|
+
/**
|
|
3264
|
+
* After the store's branch moved, under a store reservation (a host's
|
|
3265
|
+
* switchBranch, a rollback's switch, a suppression's fork, or a failed
|
|
3266
|
+
* surgery's restore): every live agent's context follows the move. Its
|
|
3267
|
+
* context manager is re-initialized for the branch the store is on
|
|
3268
|
+
* (reinitializeManagers, #353), every one but `except`'s, the agent the
|
|
3269
|
+
* move was made through, whose own switchBranch or fork initialized it,
|
|
3270
|
+
* or whose failed surgery's restore left it refusing its work, which
|
|
3271
|
+
* counts here as a failed re-initialization, reported by the restore and
|
|
3272
|
+
* not returned (a manager that didn't make the move keeps its strategy at the old
|
|
3273
|
+
* branch generation otherwise, and an AutobiographicalStrategy refuses
|
|
3274
|
+
* every compile until a re-initialization). Then the presentation index
|
|
3275
|
+
* rebases each agent on the new branch (#291): a window the branch has
|
|
3276
|
+
* none of (a branch made before the agent's write-down, a rollback into
|
|
3277
|
+
* rows the write-down presented) is written down, and the agent's own
|
|
3278
|
+
* rows not in its window are presented, so an agent that presented before
|
|
3279
|
+
* the move presents after it, and an agent whose configuration names how
|
|
3280
|
+
* other agents' rounds go out to it is sent them so where its window is
|
|
3281
|
+
* presented now, as stored where it isn't (applyForeignRounds). Arrivals
|
|
3282
|
+
* wait for the reservation's release, which presents what each agent is
|
|
3283
|
+
* owed. Redo entries are
|
|
3284
|
+
* dropped, every agent's: each was an undo on a window of the branch the
|
|
3285
|
+
* store left. A switch to the branch the store was on (`sameBranch`, a
|
|
3286
|
+
* refusing manager's recovery) moves no branch, so each agent whose
|
|
3287
|
+
* window is presented after the rebase keeps its redo entries: an undo is
|
|
3288
|
+
* a retraction on that window, and the rebase presents no undone row
|
|
3289
|
+
* (main kept redo across a switch too). Returns the managers whose re-initialization failed, for
|
|
3290
|
+
* the caller to report (reportReinitFailures) before it releases the
|
|
3291
|
+
* store.
|
|
3013
3292
|
*
|
|
3014
|
-
*
|
|
3015
|
-
*
|
|
3293
|
+
* Never throws: the move has happened. A manager whose re-initialization
|
|
3294
|
+
* fails stays fenced until a later one succeeds (switchBranch() to the
|
|
3295
|
+
* branch the store is on), and its agent's window stays the record until
|
|
3296
|
+
* the next move, traced as presentation:failed at `'rebase'`; so does an
|
|
3297
|
+
* agent whose window can't be written down. The writes for it meanwhile
|
|
3298
|
+
* wait in memory (heldForRecovery), and the move whose re-initialization
|
|
3299
|
+
* of it succeeds stores them at its release (recoverHeldWrites).
|
|
3300
|
+
*/
|
|
3301
|
+
private followBranchMove;
|
|
3302
|
+
/**
|
|
3303
|
+
* Undo the last inference turn for an agent, on its window (#291,
|
|
3304
|
+
* decision 4): the rows the turn's checkpoint saw enter the window after
|
|
3305
|
+
* it leave it, the agent's own as undone and others' as arrived and not
|
|
3306
|
+
* yet presented, which its next start presents again. Nothing is written
|
|
3307
|
+
* to the record and no branch moves, so `fromBranch` and `toBranch` are
|
|
3308
|
+
* both the store's branch, `window` says how many rows left, and a
|
|
3309
|
+
* `window:undone` trace is emitted. The record, the workspace and
|
|
3310
|
+
* `_config` mounts, MCPL checkpoints and the inference log are left as
|
|
3311
|
+
* they are: rollbackToMessage is the record-level revert. `redo()` puts
|
|
3312
|
+
* the rows back. It is refused while a turn of the agent's is alive, and
|
|
3313
|
+
* allowed while another agent's is, and refused for an agent whose window
|
|
3314
|
+
* isn't presented (presents: a write-down that failed, at its
|
|
3315
|
+
* registration or after a branch move, or a context that couldn't follow
|
|
3316
|
+
* a branch move), which has no window of its own to undo on.
|
|
3016
3317
|
*
|
|
3017
|
-
*
|
|
3018
|
-
*
|
|
3019
|
-
*
|
|
3020
|
-
*
|
|
3021
|
-
*
|
|
3022
|
-
* whose re-initialization fails raises an ops alert naming its agent
|
|
3023
|
-
* (`context-reinit-failed`). An undo or redo made before the managers are
|
|
3024
|
-
* done moves the store again under the same reservation, and they are
|
|
3025
|
-
* re-initialized for the branch the last one leaves.
|
|
3318
|
+
* Returns `{ undone: false }` when there is nothing to undo. A store error
|
|
3319
|
+
* before any row has left the window is thrown as it is, and the turn can
|
|
3320
|
+
* still be undone. An undo that fails after rows left (cut short, or its
|
|
3321
|
+
* checkpoint save failing) throws OperatorActionError 'failed', saying how
|
|
3322
|
+
* many rows left, and can be redone (undoOnWindow).
|
|
3026
3323
|
*
|
|
3027
|
-
*
|
|
3028
|
-
*
|
|
3029
|
-
*
|
|
3030
|
-
*
|
|
3031
|
-
*
|
|
3032
|
-
* store again under the same reservation settles with it.
|
|
3324
|
+
* No branch moves, so nothing is reserved and no context manager is
|
|
3325
|
+
* re-initialized (#353's re-initialization follows a branch move, and an
|
|
3326
|
+
* undo on the window makes none): every other agent goes on compiling.
|
|
3327
|
+
* Its result carries no `settled`, which an undo gives only when it moved
|
|
3328
|
+
* the store.
|
|
3033
3329
|
*/
|
|
3034
3330
|
undoLastTurn(agentName: string, requester?: OperatorRequester): {
|
|
3035
3331
|
undone: boolean;
|
|
3036
3332
|
turnIndex?: number;
|
|
3037
3333
|
fromBranch?: string;
|
|
3038
3334
|
toBranch?: string;
|
|
3335
|
+
window?: {
|
|
3336
|
+
retracted: number;
|
|
3337
|
+
represented: number;
|
|
3338
|
+
};
|
|
3339
|
+
/** Present only when the undo moved the store, which an undo on the
|
|
3340
|
+
* window never does: nothing waits to settle (#291, decision 4). */
|
|
3039
3341
|
settled?: Promise<void>;
|
|
3040
3342
|
};
|
|
3041
3343
|
/** undoLastTurn's work, for a host/command undo already admitted: a stop()
|
|
3042
3344
|
* begun by a trace of one of its turns doesn't refuse the next. */
|
|
3043
3345
|
private runUndoLastTurn;
|
|
3044
3346
|
/**
|
|
3045
|
-
*
|
|
3347
|
+
* An undo on the window (undoLastTurn): the
|
|
3348
|
+
* agent's newest checkpoint's tail of its window, the rows at the index
|
|
3349
|
+
* length it recorded and after (checkpointLength), leaves it. The agent's
|
|
3350
|
+
* own rows leave as undone, so no presentation point presents them again
|
|
3351
|
+
* until a redo; others' rows leave as arrived and not presented, and its
|
|
3352
|
+
* next presentation point presents them again, after what it holds then.
|
|
3353
|
+
* The rows are named body by body, by the shard that names each, in
|
|
3354
|
+
* window order, and kept for redo with the ordinal each held, the index
|
|
3355
|
+
* length the undo left, and which of them each of the agent's marks
|
|
3356
|
+
* covered (marksOverTail).
|
|
3046
3357
|
*
|
|
3047
|
-
*
|
|
3048
|
-
*
|
|
3358
|
+
* Own rows and others' leave in two calls, each whole or not at all on a
|
|
3359
|
+
* store that batches. The redo entry is kept before either, so an undo
|
|
3360
|
+
* cut short after rows left (between the calls, or partway through one
|
|
3361
|
+
* on a store without the batched form) is refused with
|
|
3362
|
+
* OperatorActionError 'failed' and can be redone: a redo puts back what
|
|
3363
|
+
* left, in its order, and its checkpoint stays for another undo to finish
|
|
3364
|
+
* it. So is an undo whose rows all left and whose checkpoint save then
|
|
3365
|
+
* failed: the checkpoint stays saved, and the next undo, which finds
|
|
3366
|
+
* nothing of its turn left in the window past it, saves the checkpoints
|
|
3367
|
+
* without it and keeps no redo of nothing (the entry kept puts the rows
|
|
3368
|
+
* back). An undo that took nothing out throws its error and keeps
|
|
3369
|
+
* nothing. Each refusal after rows left is traced (`window:undone`) and
|
|
3370
|
+
* recorded with its error.
|
|
3371
|
+
*/
|
|
3372
|
+
private undoOnWindow;
|
|
3373
|
+
/**
|
|
3374
|
+
* Where a checkpoint's turn began in the agent's window: the index length
|
|
3375
|
+
* it recorded, on the branch it recorded it on. A checkpoint recorded
|
|
3376
|
+
* before the window was presented (an earlier version's, or one taken
|
|
3377
|
+
* while the context was in legacy mode), or on another branch, is
|
|
3378
|
+
* converted: the place of the first row in the window stored after the
|
|
3379
|
+
* checkpoint's sequence, or the window's end when there is none.
|
|
3380
|
+
*/
|
|
3381
|
+
private checkpointLength;
|
|
3382
|
+
/**
|
|
3383
|
+
* The bodies of `cm`'s window at ordinal `from` and after, in window
|
|
3384
|
+
* order: each by the shard that names it, with its ordinal and sequence,
|
|
3385
|
+
* and whether it is `agent`'s own row. A stamped row is the agent's own
|
|
3386
|
+
* when its stamp says so (isOwnRowOf). A row stored before the audience
|
|
3387
|
+
* stamp (every turn an earlier release recorded, whose checkpoints an
|
|
3388
|
+
* undo still takes) carries none, and the presentation index reads it as
|
|
3389
|
+
* an arrival, so an undo that took it out as arrived would see it come
|
|
3390
|
+
* back at the agent's next point: it is the agent's own when it is stored
|
|
3391
|
+
* under the agent's voice (isOwnParticipant), holds only results of
|
|
3392
|
+
* calls an own row of the window made, which such a release stored under
|
|
3393
|
+
* `user`, or is a framework notice whose metadata names the agent as its
|
|
3394
|
+
* owner (legacyNoticeOwner: a drafts notice, an `[auto-continue]` row, a
|
|
3395
|
+
* stored injection), which such a release stored under `user` too.
|
|
3396
|
+
*/
|
|
3397
|
+
private windowBodiesFrom;
|
|
3398
|
+
/**
|
|
3399
|
+
* The read marks held for `agent` (heldMarksOf's): its own
|
|
3400
|
+
* (Agent.heldReadMarks), the marks its running scripts started with
|
|
3401
|
+
* (AgentScripts.readMarksOf), which each script's sends are credited with
|
|
3402
|
+
* having read (publishReadThrough), and those of its channel_publish calls
|
|
3403
|
+
* still out (publishMarksInFlight). A redo gives them all again.
|
|
3404
|
+
*/
|
|
3405
|
+
private heldMarksOf;
|
|
3406
|
+
/**
|
|
3407
|
+
* Hold a publish's mark (publishReadThrough's) while its call is out
|
|
3408
|
+
* (publishMarksInFlight), so a redo meanwhile gives it again. `release`
|
|
3409
|
+
* lets it go and returns the mark as it stands then, for notePublished.
|
|
3410
|
+
*/
|
|
3411
|
+
private holdPublishMark;
|
|
3412
|
+
/**
|
|
3413
|
+
* The agent's marks (heldMarksOf: its own and its running scripts') that cover rows of `tail` by
|
|
3414
|
+
* their ordinals in its window, read before an undo takes them out, each
|
|
3415
|
+
* with the bodies it covers. A mark taken in legacy mode is one of them
|
|
3416
|
+
* where it covers such rows: the window is presented (undo refuses one
|
|
3417
|
+
* that isn't), and there it covers the rows the window held by its head
|
|
3418
|
+
* where they stand (coverTest), which a redo puts back at new ordinals
|
|
3419
|
+
* past it. One on another branch can't say, and isn't kept. A failure to
|
|
3420
|
+
* read them is logged and keeps none: the redone rows then read as unread
|
|
3421
|
+
* until the agent's next mark, as they did before redo gave marks again.
|
|
3422
|
+
*/
|
|
3423
|
+
private marksOverTail;
|
|
3424
|
+
/**
|
|
3425
|
+
* A redo of an undo on the window. First the rows presented since the
|
|
3426
|
+
* undo leave the window as arrived and not presented (they enter again at
|
|
3427
|
+
* the agent's next point, after the redone rows), and with them any of
|
|
3428
|
+
* the undo's own rows still in it (an undo cut short), so the redone
|
|
3429
|
+
* rounds sit after the prefix their signed thinking was minted under.
|
|
3430
|
+
* Presented since means in the window past the index length the undo
|
|
3431
|
+
* left and not in it right after the undo: a body a later undo took out
|
|
3432
|
+
* and its redo put back (`kept`) stays where it is, so undos redone in
|
|
3433
|
+
* turn give back the window they took. Then the rows the undo took out
|
|
3434
|
+
* enter it again, in their window order, but for one the store no longer
|
|
3435
|
+
* holds. Each undo still to redo below this one (`below`, oldest first)
|
|
3436
|
+
* notes which of the rows put back were in its window right after it
|
|
3437
|
+
* (their ordinal before this undo was below the length it left), and the
|
|
3438
|
+
* marks that covered the rows at the undo cover them again
|
|
3439
|
+
* (retakeMarks). The checkpoint goes back, unless an undo cut short left
|
|
3440
|
+
* it in place.
|
|
3049
3441
|
*
|
|
3050
|
-
*
|
|
3051
|
-
*
|
|
3442
|
+
* A step that fails once the window has changed (the retraction partway,
|
|
3443
|
+
* the rows' return, the checkpoint save) refuses the redo with
|
|
3444
|
+
* OperatorActionError 'failed', saying how many rows left and how many
|
|
3445
|
+
* returned, traced (`window:undone`) and recorded with its error; the
|
|
3446
|
+
* entry stays, and another redo finishes it, from the window as it then
|
|
3447
|
+
* is. One that changed nothing throws its error as it is. The caller,
|
|
3448
|
+
* redo(), takes the entry off the stack and traces and records a redo
|
|
3449
|
+
* that went through, after this returns.
|
|
3450
|
+
*/
|
|
3451
|
+
private redoOnWindow;
|
|
3452
|
+
/**
|
|
3453
|
+
* After a redo put `back` (the undo's rows, in window order) into the
|
|
3454
|
+
* window again, at new ordinals past every mark: each mark the undo
|
|
3455
|
+
* recorded (RedoEntry.marks) that the agent still holds is given again,
|
|
3456
|
+
* covering the window as it stands up to the first row put back that the
|
|
3457
|
+
* mark didn't cover at the undo. So a row the undone turn had read, and
|
|
3458
|
+
* its reply answered, reads as read, shown and answered again, and one it
|
|
3459
|
+
* hadn't reads as before; a row presented since the undo, which the redo
|
|
3460
|
+
* took out and the agent's next point presents after, isn't covered. A
|
|
3461
|
+
* mark the agent no longer holds (a compile moved it since the undo) is
|
|
3462
|
+
* left as it is: what it covers is what the agent read later. Each undo
|
|
3463
|
+
* still to redo below records the new mark in place of the old, and so
|
|
3464
|
+
* does this one's entry, for a redo that finishes this one where it was
|
|
3465
|
+
* cut short after the rows came back (redoOnWindow). A failure
|
|
3466
|
+
* is logged and leaves the marks as they were: the rows put back then
|
|
3467
|
+
* read as unread until the agent's next mark.
|
|
3468
|
+
*/
|
|
3469
|
+
private retakeMarks;
|
|
3470
|
+
/**
|
|
3471
|
+
* Redo a previously undone turn for an agent, on its window (undoLastTurn):
|
|
3472
|
+
* no branch moves, the rows presented since the undo leave the window,
|
|
3473
|
+
* and the rows it took out enter it again, in their order, with `window`
|
|
3474
|
+
* saying how many of each and a `window:undone` trace; the agent's marks
|
|
3475
|
+
* that covered them at the undo cover them again. Undos are redone newest
|
|
3476
|
+
* first, each giving back the window it took. Returns
|
|
3477
|
+
* `{ redone: false }` if there's nothing to redo. Refused
|
|
3478
|
+
* (OperatorActionError 'failed') when the store is on another branch
|
|
3479
|
+
* than the undo was: its rows' places are that branch's window's. A
|
|
3480
|
+
* branch move through the framework (switchBranch, a rollback, a
|
|
3481
|
+
* suppression, a failed surgery's restore) drops every redo entry
|
|
3482
|
+
* (followBranchMove), so this is a move made past it.
|
|
3052
3483
|
*/
|
|
3053
3484
|
redo(agentName: string, requester?: OperatorRequester): {
|
|
3054
3485
|
redone: boolean;
|
|
3055
3486
|
fromBranch?: string;
|
|
3056
3487
|
toBranch?: string;
|
|
3488
|
+
window?: {
|
|
3489
|
+
retracted: number;
|
|
3490
|
+
represented: number;
|
|
3491
|
+
};
|
|
3492
|
+
/** Present only when the redo moved the store, which a redo on the
|
|
3493
|
+
* window never does: nothing waits to settle (#291, decision 4). */
|
|
3057
3494
|
settled?: Promise<void>;
|
|
3058
3495
|
};
|
|
3059
3496
|
/**
|
|
@@ -3089,18 +3526,111 @@ export declare class AgentFramework {
|
|
|
3089
3526
|
* Passing the gate RESERVES the store for the caller: a turn token is
|
|
3090
3527
|
* held for every agent until the returned release runs, so no wake — via
|
|
3091
3528
|
* the scheduler or a parked provider admission, both of which re-test
|
|
3092
|
-
* turn-alive — can start a turn while the switch is awaited
|
|
3093
|
-
*
|
|
3094
|
-
*
|
|
3529
|
+
* turn-alive — can start a turn while the switch is awaited, and every
|
|
3530
|
+
* write made meanwhile is held in memory (surgeryHeldWrites). Release
|
|
3531
|
+
* stores what the hold kept, in arrival order, and presents each reserved
|
|
3532
|
+
* agent what it is owed, as at a turn's end, but for the arrivals a
|
|
3533
|
+
* rollback's cut returned, which wait for that agent's next turn start
|
|
3534
|
+
* (presentation.holdUntilStart). Always release in `finally`: a token
|
|
3535
|
+
* nobody clears wedges the fleet.
|
|
3095
3536
|
*/
|
|
3096
3537
|
private reserveStoreForSurgery;
|
|
3097
3538
|
private reinitializeManagers;
|
|
3539
|
+
/**
|
|
3540
|
+
* After a move's pass (reinitializeManagers): the writes kept in memory
|
|
3541
|
+
* for each agent whose context manager refused its work
|
|
3542
|
+
* (heldForRecovery), and whose re-initialization didn't fail this time,
|
|
3543
|
+
* go back to the move's hold ahead of the writes it keeps now, which came
|
|
3544
|
+
* after them, each agent's in arrival order. The release stores them
|
|
3545
|
+
* through the ordinary write path and traces each as it lands
|
|
3546
|
+
* (releaseSurgeryHeldWrites); one its manager still refuses there is kept
|
|
3547
|
+
* for it again, and the ones after it wait behind it. An agent gone
|
|
3548
|
+
* meanwhile passes them on (passHeldWritesOn). With no hold, which no
|
|
3549
|
+
* move makes, they are stored now.
|
|
3550
|
+
*/
|
|
3551
|
+
private recoverHeldWrites;
|
|
3552
|
+
/**
|
|
3553
|
+
* Keep `write` in memory for `agentName`, whose context manager refuses
|
|
3554
|
+
* its work (heldForRecovery), behind the writes already kept for it. The
|
|
3555
|
+
* first one kept is logged with the refusal that began the wait.
|
|
3556
|
+
*/
|
|
3557
|
+
private keepForRecovery;
|
|
3558
|
+
private refusesItsWork;
|
|
3559
|
+
/** Whether writes for `agentName` wait in memory for its context manager's recovery (heldForRecovery). */
|
|
3560
|
+
private waitsForRecovery;
|
|
3561
|
+
/**
|
|
3562
|
+
* At stop(), before its final sync: the writes still kept in memory, which
|
|
3563
|
+
* no queue persists (#291), told of once per agent they are for, by a log
|
|
3564
|
+
* line and an ops alert of kind `store-held-lost` naming how many and of
|
|
3565
|
+
* what kinds. Those kept for an agent whose context manager refuses its
|
|
3566
|
+
* work (heldForRecovery) are lost: no branch move follows a stop. Those
|
|
3567
|
+
* a surgery's hold still keeps (surgeryHeldWrites, a hold whose operation
|
|
3568
|
+
* outlived stop()'s wait for it) are stored only if it releases before the
|
|
3569
|
+
* process exits. Mail among them stays held in the registry, and the next
|
|
3570
|
+
* boot delivers it. Says nothing when none is kept. An alert's listeners
|
|
3571
|
+
* run as it is raised, and a write one makes is kept so too, after this
|
|
3572
|
+
* read of what is kept: each round tells the writes the rounds before it
|
|
3573
|
+
* didn't, until one finds none new (a few rounds at most, for a listener
|
|
3574
|
+
* that writes at every alert).
|
|
3575
|
+
*/
|
|
3576
|
+
private reportHeldWritesAtStop;
|
|
3577
|
+
/** One round of reportHeldWritesAtStop: tells the writes kept in memory that aren't in `told`, adding them; whether any was. */
|
|
3578
|
+
private reportHeldWritesOnce;
|
|
3579
|
+
/**
|
|
3580
|
+
* The writes for `agentName` a surgery's release couldn't store, told of
|
|
3581
|
+
* once: a log line and an ops alert of kind `store-held-lost`. Each was
|
|
3582
|
+
* accepted with no id and kept in memory until the release, where its
|
|
3583
|
+
* store threw. One context-manager found none of stored is lost (one it
|
|
3584
|
+
* names rows of as stored, WriteLandedError, counts as stored and isn't
|
|
3585
|
+
* here). One whose store couldn't be read to tell what of it landed
|
|
3586
|
+
* (WriteOutcomeUnknownError: `unknown` holds one per such write) may be
|
|
3587
|
+
* lost: the alert names the rows the errors name as stored, which the
|
|
3588
|
+
* release presented and traced, and the rows the store may hold besides,
|
|
3589
|
+
* by id and by count, and its data counts them (`mayBeStored`). The writes
|
|
3590
|
+
* after them went on.
|
|
3591
|
+
*/
|
|
3592
|
+
private tellHeldWritesLost;
|
|
3593
|
+
/** How many writes wait in memory for an agent's recovery (heldForRecovery), every agent's. */
|
|
3594
|
+
private writesHeldForRecovery;
|
|
3595
|
+
/**
|
|
3596
|
+
* Writes kept in memory for an agent that ended before they were stored
|
|
3597
|
+
* (a fork a move emptied and disposed, or a fork or a run that ended while
|
|
3598
|
+
* a hold kept them or while its context manager refused its work): each
|
|
3599
|
+
* one the primary takes in its place, as a release of the agent's window
|
|
3600
|
+
* passes it on (passesToPrimary: a failed reply, a channel notice its
|
|
3601
|
+
* reader could act on, or a module's write for a run or a fork, which goes
|
|
3602
|
+
* as the write itself), goes on to the primary by name
|
|
3603
|
+
* (passNoticeToPrimary), in arrival order, where a hold keeps it until its
|
|
3604
|
+
* release, as any write. The rest are dropped, which is logged and, unless
|
|
3605
|
+
* the caller's own alert counts them (`counted`: a move's disposal of the
|
|
3606
|
+
* fork), told of by an ops alert of kind `store-held-lost`: unlike a
|
|
3607
|
+
* released window's unread rows, they never reach the record. Each write
|
|
3608
|
+
* goes on by itself: one whose notice can't be built (passNoticeToPrimary
|
|
3609
|
+
* doesn't guard that, and a channel notice's words read the store) is
|
|
3610
|
+
* logged and counted among the dropped, and the rest still go on. Never
|
|
3611
|
+
* throws.
|
|
3612
|
+
*/
|
|
3613
|
+
private passHeldWritesOn;
|
|
3614
|
+
/**
|
|
3615
|
+
* The name a kept write names whose agent has ended, else undefined: no
|
|
3616
|
+
* agent is registered under it, or another incarnation is, not the one
|
|
3617
|
+
* the write was kept for (SurgeryHeldWrite.heldFor). A write that names no
|
|
3618
|
+
* agent is the delivery agent's at its release, whichever that is then.
|
|
3619
|
+
* `named` is the name the write was kept under, where a caller keys it.
|
|
3620
|
+
*/
|
|
3621
|
+
private heldWriteTargetGone;
|
|
3622
|
+
/**
|
|
3623
|
+
* Take out of memory the writes kept for `agent`, which is ending: those
|
|
3624
|
+
* kept while its context manager refused its work (heldForRecovery), then
|
|
3625
|
+
* those a surgery's hold keeps that name it, in arrival order, so that
|
|
3626
|
+
* neither a later move nor the hold's release meets them. Writes that
|
|
3627
|
+
* name no agent stay: they are the delivery agent's at the release.
|
|
3628
|
+
*/
|
|
3629
|
+
private takeHeldWritesFor;
|
|
3098
3630
|
private reportLongHold;
|
|
3099
3631
|
private disposeEmptiedForks;
|
|
3100
3632
|
private reportReinitFailures;
|
|
3101
3633
|
private reportReinitFailure;
|
|
3102
|
-
private beginSyncMove;
|
|
3103
|
-
private reinitializeAfterSyncMove;
|
|
3104
3634
|
/**
|
|
3105
3635
|
* A surgery's marker batch, recorded before its body change. If it can't
|
|
3106
3636
|
* be recorded, the surgery doesn't start, and the error says what the
|
|
@@ -3126,14 +3656,21 @@ export declare class AgentFramework {
|
|
|
3126
3656
|
private retireAfterRestore;
|
|
3127
3657
|
/**
|
|
3128
3658
|
* After a failed switch or redaction: put the store back on `sourceBranch`
|
|
3129
|
-
* if it moved, and return a sentence saying what actually happened.
|
|
3130
|
-
*
|
|
3659
|
+
* if it moved, and return a sentence saying what actually happened. The
|
|
3660
|
+
* caller's release has every other live agent's context follow the store
|
|
3661
|
+
* to where it ends (followBranchMove): its source, or the failed branch
|
|
3662
|
+
* when the restore failed too. Never throws — the caller reports the
|
|
3663
|
+
* original failure with this appended.
|
|
3131
3664
|
*/
|
|
3132
3665
|
private restoreSourceBranch;
|
|
3133
3666
|
/**
|
|
3134
3667
|
* Roll the active branch back so `messageId` becomes its tail: fork the
|
|
3135
3668
|
* chronicle at that message (origin-sequence time-travel branch) and switch
|
|
3136
|
-
* to the fork. Everything after the message stays on the source branch
|
|
3669
|
+
* to the fork. Everything after the message stays on the source branch
|
|
3670
|
+
* (on a presented window, but for the rows stored before the write that
|
|
3671
|
+
* presented it: those the window took after that write,
|
|
3672
|
+
* returnedToArrivals, and those it presented with the message,
|
|
3673
|
+
* keptInWindowAfterTarget).
|
|
3137
3674
|
*
|
|
3138
3675
|
* The rollback is local to the resident. Marking removed Discord messages
|
|
3139
3676
|
* with an awareness reaction is a separate, explicit publication choice
|
|
@@ -3178,6 +3715,38 @@ export declare class AgentFramework {
|
|
|
3178
3715
|
role?: string;
|
|
3179
3716
|
preview?: string;
|
|
3180
3717
|
} | null;
|
|
3718
|
+
/**
|
|
3719
|
+
* On a presented window (#291), the rows after the target in the
|
|
3720
|
+
* agent's window that the cut kept in the record: stored before the
|
|
3721
|
+
* write that presented the target, they left the window as arrived and
|
|
3722
|
+
* not presented. They wait outside it until the agent's next turn
|
|
3723
|
+
* start, which presents them after what its window holds then: the
|
|
3724
|
+
* surgery's release, a resume, the agent's turn ending or a row
|
|
3725
|
+
* stored for it while it is idle don't bring them back, so the cut
|
|
3726
|
+
* holds until the agent speaks again, on the rollback's branch: a later
|
|
3727
|
+
* move of the store's branch, a suppression or rollback through another
|
|
3728
|
+
* agent included, ends it. An own row of the agent's among
|
|
3729
|
+
* them is the exception: it re-enters at the surgery's release, as own
|
|
3730
|
+
* rows enter at every point. The hold is in memory: a restart before
|
|
3731
|
+
* then presents them at its pass over every agent at rest, or, where it
|
|
3732
|
+
* boots quiesced, at the resume. Not counted
|
|
3733
|
+
* in `messagesRemoved`, and not marked. Set only on a presented window.
|
|
3734
|
+
*/
|
|
3735
|
+
returnedToArrivals?: number;
|
|
3736
|
+
/**
|
|
3737
|
+
* On a presented window (#291), the rows after the target in the
|
|
3738
|
+
* agent's window that one write presented together with the target (a
|
|
3739
|
+
* batch: two Discord messages that arrived while the agent was busy,
|
|
3740
|
+
* say, presented at its turn's end). The cut is at that write, so they
|
|
3741
|
+
* stay in the window after the target: a branch cut can't separate
|
|
3742
|
+
* them from it. Not removed, so not counted in `messagesRemoved` and
|
|
3743
|
+
* not marked; suppressMessages, or, for those with a Discord message
|
|
3744
|
+
* id, the host's hide by it, takes them out: a suppression through the
|
|
3745
|
+
* agent whose own slot holds each, this one, or for a row of a slot it observes (a
|
|
3746
|
+
* persistent subconscious's residents' rows), that slot's owner. Set
|
|
3747
|
+
* only on a presented window.
|
|
3748
|
+
*/
|
|
3749
|
+
keptInWindowAfterTarget?: number;
|
|
3181
3750
|
}>;
|
|
3182
3751
|
/**
|
|
3183
3752
|
* Suppress specific messages from the live context without touching the
|
|
@@ -3192,9 +3761,16 @@ export declare class AgentFramework {
|
|
|
3192
3761
|
* a marker-scheduling receipt (`markers`); delivery continues without the
|
|
3193
3762
|
* caller waiting on it.
|
|
3194
3763
|
*
|
|
3195
|
-
*
|
|
3196
|
-
*
|
|
3197
|
-
*
|
|
3764
|
+
* On a presented window (#291) the removal reaches what every reader on
|
|
3765
|
+
* the store folded: every other agent's context follows the fork before
|
|
3766
|
+
* the removals (followBranchMove), so each one's strategy hears the rows
|
|
3767
|
+
* leave, drops each summary that folded one and folds the rows it keeps
|
|
3768
|
+
* again. Where a window can't be repaired, which is logged, its strategy
|
|
3769
|
+
* hears at the next boot (presentation's retractAbsentRows), since the
|
|
3770
|
+
* record no longer holds the rows. In legacy mode it is not retroactive
|
|
3771
|
+
* over derived state: a message already folded into an autobiographical
|
|
3772
|
+
* summary stays in that summary — roll back to before it entered if that
|
|
3773
|
+
* matters.
|
|
3198
3774
|
*/
|
|
3199
3775
|
suppressMessages(agentName: string, opts: {
|
|
3200
3776
|
messageIds: string[];
|
|
@@ -3228,8 +3804,76 @@ export declare class AgentFramework {
|
|
|
3228
3804
|
* changing anything. Never bisects a body group: chronicle refuses that
|
|
3229
3805
|
* for removals and branchAt has no such guard, so the target snaps to the
|
|
3230
3806
|
* group's last shard.
|
|
3807
|
+
*
|
|
3808
|
+
* The rows removed are those the branch cut leaves behind: the slot's
|
|
3809
|
+
* rows after the target stored after the sequence branchAt cuts at
|
|
3810
|
+
* (branchSequenceOf). That is every row after the target, but on a
|
|
3811
|
+
* presented window (#291), where the cut is the write that presented the
|
|
3812
|
+
* target, rows stored after the target and before that write stay in the
|
|
3813
|
+
* record. Those of them the agent's window holds were presented after
|
|
3814
|
+
* the target: they leave the window (`returnedToArrivals`, named by
|
|
3815
|
+
* `returnedIds`); the agent's own rows among them enter it again at its
|
|
3816
|
+
* next presentation point (the surgery's release), and the rest, as
|
|
3817
|
+
* arrived and not presented, at the agent's next turn start on the
|
|
3818
|
+
* rollback's branch (a later move of the store's branch, a suppression or
|
|
3819
|
+
* rollback through another agent included, ends the hold; it is in
|
|
3820
|
+
* memory: a restart presents them at its pass at rest, or, where it boots
|
|
3821
|
+
* quiesced, at the resume). The rows of
|
|
3822
|
+
* the agent's window after the
|
|
3823
|
+
* target that the write presenting it presented too (`keptInWindow`, a
|
|
3824
|
+
* batch: one write, one presentation point) stay in the window, since no
|
|
3825
|
+
* branch cut separates them from the target. Both are set only on a
|
|
3826
|
+
* presented window. A rollback that neither removes a row nor returns
|
|
3827
|
+
* one is refused as a no-op, saying why: rows presented with the target
|
|
3828
|
+
* are named, with the removals that can take them out, and through which
|
|
3829
|
+
* agent a suppression does (suppressionThrough).
|
|
3231
3830
|
*/
|
|
3232
3831
|
private planRollback;
|
|
3832
|
+
/**
|
|
3833
|
+
* Through which agent a suppression takes `rows` of `agentName`'s window
|
|
3834
|
+
* out, for a refusal's advice, each row named by its id, which
|
|
3835
|
+
* suppressMessages takes: a suppression looks for its ids in the agent's
|
|
3836
|
+
* own slot (planSuppression), so a row of a slot the agent observes,
|
|
3837
|
+
* merged into its window, is suppressed through an owner of that slot
|
|
3838
|
+
* whose own slot holds it (observedRowOwner). Plain `suppressMessages`
|
|
3839
|
+
* with the ids when every row is in the agent's own slot. Where an
|
|
3840
|
+
* owner's slot holds no row but those named for it, the advice says the
|
|
3841
|
+
* suppression there is refused, as planSuppression refuses one that
|
|
3842
|
+
* would leave no row.
|
|
3843
|
+
*/
|
|
3844
|
+
private suppressionThrough;
|
|
3845
|
+
/**
|
|
3846
|
+
* On which agent the host's hide takes each of `rows` out, for a
|
|
3847
|
+
* refusal's advice, each row named by its Discord message id, which the
|
|
3848
|
+
* hide matches: the hide reads the own slot of the agent it is run on, so
|
|
3849
|
+
* a row of a slot `agentName` observes, merged into its window, is hidden
|
|
3850
|
+
* on an owner of that slot whose own slot holds it (observedRowOwner), as
|
|
3851
|
+
* suppressionThrough names one for a suppression. Grouped by agent, the
|
|
3852
|
+
* groups set apart by semicolons.
|
|
3853
|
+
*/
|
|
3854
|
+
private hideThrough;
|
|
3855
|
+
/**
|
|
3856
|
+
* The live agent whose own slot holds `id`, a row of a slot `agentName`
|
|
3857
|
+
* observes: an owner of one of the slots its observe edges read
|
|
3858
|
+
* (readerFacts' observed slots), other than itself. Undefined when none
|
|
3859
|
+
* is found or the registry can't be read.
|
|
3860
|
+
*/
|
|
3861
|
+
private observedRowOwner;
|
|
3862
|
+
/** Whether a slot `cm` merges beside its own holds the row, which its own slot doesn't. */
|
|
3863
|
+
private mergesObservedRow;
|
|
3864
|
+
/**
|
|
3865
|
+
* What a branch cut at `cut` does to the rows of `cm`'s window after the
|
|
3866
|
+
* target (`tailId`), in window order: those it keeps in the record and
|
|
3867
|
+
* out of the window (`returned`: stored at or before the cut, and
|
|
3868
|
+
* presented by a write after it), and those it keeps in the window
|
|
3869
|
+
* (`kept`: presented by the write the cut is at, the one that presented
|
|
3870
|
+
* the target, so after the target only when that write presented them
|
|
3871
|
+
* together, a batch). Read from the window's newest row back, to the
|
|
3872
|
+
* target or the first row presented before the cut: every row's cut
|
|
3873
|
+
* (branchSequenceOf, the write that presented it, or its own sequence
|
|
3874
|
+
* for a row the write-down presented) grows in window order.
|
|
3875
|
+
*/
|
|
3876
|
+
private windowAfterCut;
|
|
3233
3877
|
/**
|
|
3234
3878
|
* The removal intervals a suppression of `requestedIds` would apply
|
|
3235
3879
|
* (index-ordered, newest first), validated, without changing anything. A
|
|
@@ -3249,6 +3893,18 @@ export declare class AgentFramework {
|
|
|
3249
3893
|
} | {
|
|
3250
3894
|
suppress: string[];
|
|
3251
3895
|
}): SurgeryMarksPreview;
|
|
3896
|
+
/**
|
|
3897
|
+
* The live agents whose window holds a row now (#291): each whose context
|
|
3898
|
+
* reads it `'in'` (windowStatusOf), every agent whose window is still the
|
|
3899
|
+
* record and whose record holds it among them (`names`). A row an agent's
|
|
3900
|
+
* view leaves out (agentSees) is held by no such agent, though its window
|
|
3901
|
+
* holds it: one a tune-out holds from residents, or another agent's stored
|
|
3902
|
+
* context injection, which a write-down from the record took in. A row a
|
|
3903
|
+
* suppress rule hid is held by no agent: no view shows it. An agent
|
|
3904
|
+
* whose lookup throws is in `unreadable`, with the error: whether its
|
|
3905
|
+
* window holds the row isn't known.
|
|
3906
|
+
*/
|
|
3907
|
+
private holderNames;
|
|
3252
3908
|
/** The awareness ledger's batches and retract requests, for operator surfaces. */
|
|
3253
3909
|
listDiscordAwareness(): DiscordAwarenessView[];
|
|
3254
3910
|
/**
|
|
@@ -3315,7 +3971,9 @@ export declare class AgentFramework {
|
|
|
3315
3971
|
* reservation. The gate picks it up by mtime; stop() still waits for it. */
|
|
3316
3972
|
private materializeConfigMountAfterBranchSwitch;
|
|
3317
3973
|
/**
|
|
3318
|
-
* Check if undo/redo is available for an agent.
|
|
3974
|
+
* Check if undo/redo is available for an agent. `canRedo` is false where
|
|
3975
|
+
* the newest undo was on another branch than the store's, which redo
|
|
3976
|
+
* refuses; `redoDepth` counts every undo kept all the same.
|
|
3319
3977
|
*/
|
|
3320
3978
|
getUndoRedoState(agentName: string): {
|
|
3321
3979
|
canUndo: boolean;
|
|
@@ -3365,6 +4023,12 @@ export declare class AgentFramework {
|
|
|
3365
4023
|
* Useful for testing.
|
|
3366
4024
|
*/
|
|
3367
4025
|
runUntilIdle(): Promise<void>;
|
|
4026
|
+
/**
|
|
4027
|
+
* A configured agent (a resident). `configured` is every configured
|
|
4028
|
+
* agent's name: an agent its `observes` names may be registered after it,
|
|
4029
|
+
* in this same pass, so its edge on that agent is admitted before then
|
|
4030
|
+
* (AgentRegistry.register's `declaredWith`).
|
|
4031
|
+
*/
|
|
3368
4032
|
private createAgent;
|
|
3369
4033
|
/**
|
|
3370
4034
|
* Create and register the subconscious resident (issue #77): a persistent
|
|
@@ -3374,6 +4038,14 @@ export declare class AgentFramework {
|
|
|
3374
4038
|
* excludes; the backlog is precisely what it exists to see. Windowed
|
|
3375
4039
|
* passthrough, no memory pyramid: its durable output is what it delivers
|
|
3376
4040
|
* into the resident's window, which accumulates there.
|
|
4041
|
+
*
|
|
4042
|
+
* With the presentation index (#291) the merge is the record its window is
|
|
4043
|
+
* presented from, not its compile: the residents' rows enter its window by
|
|
4044
|
+
* its observe edge's rule (observedRowFor) at its own points, as any
|
|
4045
|
+
* agent's arrivals do, so none lands inside its live turn; its window
|
|
4046
|
+
* starts at the oldest active tune-out's start, fixed as an ordinal
|
|
4047
|
+
* (SubconsciousWindowAnchor); and a resident's rounds go out to it as a
|
|
4048
|
+
* transcript (foreign-rounds.ts).
|
|
3377
4049
|
*/
|
|
3378
4050
|
private createSubconsciousAgent;
|
|
3379
4051
|
/**
|
|
@@ -3382,6 +4054,36 @@ export declare class AgentFramework {
|
|
|
3382
4054
|
* kept for the voice block, the speech switch and the strategy factory.
|
|
3383
4055
|
*/
|
|
3384
4056
|
private configureReaderForks;
|
|
4057
|
+
/**
|
|
4058
|
+
* How many of the residents' stored rows `keep` keeps the persistent
|
|
4059
|
+
* subconscious hasn't been shown (the coordinator's unseenBySubconscious),
|
|
4060
|
+
* one per body: with the presentation index, those its window doesn't
|
|
4061
|
+
* hold, which it takes at its next point; else those its consumed mark
|
|
4062
|
+
* doesn't cover, stored after its last compile. 0 with no subconscious,
|
|
4063
|
+
* and for a row its mark can't speak for.
|
|
4064
|
+
*/
|
|
4065
|
+
private unseenBySubconscious;
|
|
4066
|
+
/**
|
|
4067
|
+
* The persistent subconscious's window as written down, its presented
|
|
4068
|
+
* rows (the coordinator's subconsciousWindow): what a boot reads for the
|
|
4069
|
+
* losses told to it, its own cancels, and what it was told of an
|
|
4070
|
+
* unrecorded stop, where the turn a row asked for, in memory, doesn't
|
|
4071
|
+
* outlast a stop, and its read marks, in memory too, don't either. Its
|
|
4072
|
+
* stored rows where its window isn't presented. None with no
|
|
4073
|
+
* subconscious.
|
|
4074
|
+
*/
|
|
4075
|
+
private subconsciousWindow;
|
|
4076
|
+
/**
|
|
4077
|
+
* The persistent subconscious's tool results as its tool-result guard
|
|
4078
|
+
* archived them (the coordinator's subconsciousGuardedResults): each
|
|
4079
|
+
* `staged` record of its audit (TOOL_RESULT_GUARD_AUDIT_STATE, under the
|
|
4080
|
+
* subconscious's name) holds its batch's original content, inline or as a
|
|
4081
|
+
* blob, written and synced before the placeholder row's results went out,
|
|
4082
|
+
* by tool use id, the placeholders' own. A crash before the guard settles
|
|
4083
|
+
* the batch leaves the placeholder for the result in its record; the
|
|
4084
|
+
* original is here. None with no subconscious, or no audit.
|
|
4085
|
+
*/
|
|
4086
|
+
private subconsciousGuardedResults;
|
|
3385
4087
|
/**
|
|
3386
4088
|
* One reader invocation: derive a fork of the resident at its head with
|
|
3387
4089
|
* the resident's refusals, hand it the held traffic since the last look
|
|
@@ -3390,13 +4092,11 @@ export declare class AgentFramework {
|
|
|
3390
4092
|
*/
|
|
3391
4093
|
private invokeReaderFork;
|
|
3392
4094
|
/**
|
|
3393
|
-
*
|
|
3394
|
-
*
|
|
3395
|
-
*
|
|
3396
|
-
*
|
|
4095
|
+
* A reader fork's own words to the resident: attributed mail when it has a
|
|
4096
|
+
* route, else under its name. Answers the row's id for the latter (empty
|
|
4097
|
+
* where the write was kept in memory), and nothing for mail, which the
|
|
4098
|
+
* registry keeps until it is delivered.
|
|
3397
4099
|
*/
|
|
3398
|
-
private queuedReaderRows;
|
|
3399
|
-
/** A reader fork's own words to the resident: attributed mail when it has a route, else under its name. */
|
|
3400
4100
|
private deliverFromReader;
|
|
3401
4101
|
private runLoop;
|
|
3402
4102
|
private processNextEvent;
|
|
@@ -3410,6 +4110,34 @@ export declare class AgentFramework {
|
|
|
3410
4110
|
*/
|
|
3411
4111
|
private dispatchProcessEventToModules;
|
|
3412
4112
|
private applyProcessResponse;
|
|
4113
|
+
/**
|
|
4114
|
+
* Who a module's process response's messages are for when its inference
|
|
4115
|
+
* request names agents (#291's audience stamp): those of them registered
|
|
4116
|
+
* here that read the slot the messages land in (readersNamed), once each,
|
|
4117
|
+
* in the order named, whether or not the event gate then lets their wake
|
|
4118
|
+
* through; the delivery agent when it names none registered. The messages
|
|
4119
|
+
* are stored where a write that names no agent is, the delivery agent's
|
|
4120
|
+
* store, whoever these are: on a residents' host the shared slot every
|
|
4121
|
+
* resident reads. Undefined for a request for every agent (`true`), for
|
|
4122
|
+
* none, for an empty list, or for one whose registered agents don't read
|
|
4123
|
+
* that slot (an isolated job, a conversation fork), which leave the stamp
|
|
4124
|
+
* to addMessage (untargetedAudience): stamped for those agents alone, the
|
|
4125
|
+
* messages would be in no window.
|
|
4126
|
+
*/
|
|
4127
|
+
private requestedAudience;
|
|
4128
|
+
/**
|
|
4129
|
+
* Of the agents a write that names no agent (no `forAgent`) is said to be
|
|
4130
|
+
* for (`named`, non-empty), those that read the slot it lands in, the
|
|
4131
|
+
* delivery agent's own: its owners and the agents that observe it (the
|
|
4132
|
+
* registry's readersOf), in the order named. Undefined when none of them
|
|
4133
|
+
* reads it, so the write takes addMessage's stamp for a write that names
|
|
4134
|
+
* no agent in that slot (defaultAudience): a stamp naming only agents
|
|
4135
|
+
* that can't read the slot puts the row in no window. Where the registry
|
|
4136
|
+
* places no slot for the delivery agent, `named` as given.
|
|
4137
|
+
*/
|
|
4138
|
+
private readersNamed;
|
|
4139
|
+
/** Each event's suppression, decided once: by its MCPL lane at admission, or by the first module response that adds messages or asks for a wake (applyProcessResponse). */
|
|
4140
|
+
private readonly eventSuppression;
|
|
3413
4141
|
/** The servers and keys whose drop withoutHostKeys has logged, each as
|
|
3414
4142
|
* `${serverId}\u0000${key}`. */
|
|
3415
4143
|
private readonly hostKeysDropped;
|
|
@@ -3439,6 +4167,21 @@ export declare class AgentFramework {
|
|
|
3439
4167
|
* the template ("trunk") is a dormant warm checkpoint, not a listener.
|
|
3440
4168
|
*/
|
|
3441
4169
|
private routeConversationIncoming;
|
|
4170
|
+
/**
|
|
4171
|
+
* A fork's channel message, routed or a correction for it, written into
|
|
4172
|
+
* the fork's store (storeInFork, #291: stored at once, stamped for the fork
|
|
4173
|
+
* alone, and presented at the fork's next point, at once when no turn of
|
|
4174
|
+
* its is alive), and where it went: the fork, with the stored id, and
|
|
4175
|
+
* `presented: false` where the row is out of the fork's window after its
|
|
4176
|
+
* write, as addMessage's placement says (placedUnpresented). While a
|
|
4177
|
+
* surgery holds the store, storeInFork keeps the write in memory
|
|
4178
|
+
* (surgeryHeldWrites) and the hold's release stores it, and while the
|
|
4179
|
+
* fork's context manager refuses its work it keeps it for the move that
|
|
4180
|
+
* re-initializes it (heldForRecovery), so the placement names the fork
|
|
4181
|
+
* alone, with no id yet, as not presented: no request reads it before it
|
|
4182
|
+
* is stored, and the fork is woken to read it, as addMessage places a
|
|
4183
|
+
* write it keeps. `mayBeStored`: storeInFork's.
|
|
4184
|
+
*/
|
|
3442
4185
|
private writeToFork;
|
|
3443
4186
|
/**
|
|
3444
4187
|
* Spawn a persistent per-channel conversation agent ("fork") from the
|
|
@@ -3624,6 +4367,14 @@ export declare class AgentFramework {
|
|
|
3624
4367
|
* editMessage keeps metadata but not this hash.
|
|
3625
4368
|
*/
|
|
3626
4369
|
private static withStoredDigest;
|
|
4370
|
+
/**
|
|
4371
|
+
* Who an admitted inbound message is for (#291's audience stamp): the
|
|
4372
|
+
* recipients admission delivered it to, in their view, and nobody when a
|
|
4373
|
+
* tune-out holds it, since then nothing may act for them (admit.ts), or
|
|
4374
|
+
* when a suppress rule took it, since then no view renders it. The
|
|
4375
|
+
* stored row lands in one store, the delivery agent's, whoever these are.
|
|
4376
|
+
*/
|
|
4377
|
+
private static inboundAudience;
|
|
3627
4378
|
/** Source envelope of a channels/incoming event (lane facts as given). */
|
|
3628
4379
|
private channelEventSource;
|
|
3629
4380
|
/** Source envelope of a push event: its derived channel, else unscoped. */
|
|
@@ -3669,38 +4420,68 @@ export declare class AgentFramework {
|
|
|
3669
4420
|
private assertChannelScopedPush;
|
|
3670
4421
|
private coalescedAuthorized;
|
|
3671
4422
|
private coalescedAudience;
|
|
3672
|
-
/** Deliver through the lane's ordinary path; report where it landed.
|
|
4423
|
+
/** Deliver through the lane's ordinary path; report where it landed.
|
|
4424
|
+
* `options.mayBeStored` rides the event to its store, which looks for the
|
|
4425
|
+
* occurrence's rows first (FrameworkWriteOptions.mayBeStored). */
|
|
3673
4426
|
private deliverCoalesced;
|
|
4427
|
+
private dispatchAfterDelivery;
|
|
3674
4428
|
private wakeForCoalescedBatch;
|
|
3675
4429
|
/** Queue a wake for each agent of the batch's audience, when its latest
|
|
3676
4430
|
* occurrence triggers inference. `plain`: an ordinary push wake, without
|
|
3677
4431
|
* the subject a withdrawal of the batch's wakes goes by, for a render
|
|
3678
|
-
*
|
|
3679
|
-
* marked ambient when every notice the render folds was
|
|
4432
|
+
* its turn being assembled doesn't read (wakeToRead), reading `readsRow`
|
|
4433
|
+
* (readsRowFor), marked ambient when every notice the render folds was
|
|
4434
|
+
* (`allAmbient`). */
|
|
3680
4435
|
private queueCoalescedWakes;
|
|
3681
4436
|
/** Withdraw unstarted wakes whose sole cause is this subject (§4.2), and
|
|
3682
4437
|
* a merged start whose every request is withdrawn. */
|
|
3683
4438
|
private cancelCoalescedWakes;
|
|
3684
|
-
/**
|
|
3685
|
-
* A placement in the deferred queue is upgraded in place once the flush has
|
|
3686
|
-
* stored it: the stored copy carries `metadata.deferredWriteId`, found by
|
|
3687
|
-
* scanning the unread tail (above the watermark) — never below it.
|
|
3688
|
-
*/
|
|
3689
|
-
private resolvePlacement;
|
|
3690
4439
|
/** Unread (the coalescer's isUnread) by the consumed watermark, or, by the
|
|
3691
|
-
* shown watermark, never possibly shown (its isUnshown). A placement
|
|
3692
|
-
*
|
|
3693
|
-
*
|
|
3694
|
-
*
|
|
4440
|
+
* shown watermark, never possibly shown (its isUnshown). A placement with
|
|
4441
|
+
* no stored row, a write kept in memory (a surgery's hold, or the wait
|
|
4442
|
+
* for its agent's recovery), counts as read and as shown: it can't be
|
|
4443
|
+
* found again once it is stored. */
|
|
3695
4444
|
private isUnreadPlacement;
|
|
3696
4445
|
/**
|
|
3697
|
-
* Unread = stored,
|
|
3698
|
-
*
|
|
3699
|
-
*
|
|
3700
|
-
*
|
|
3701
|
-
*
|
|
4446
|
+
* Unread = stored, not covered by the consumed watermark of any agent that
|
|
4447
|
+
* reads it (Agent.getConsumedWatermark, read in that agent's own context:
|
|
4448
|
+
* in its window as of the mark once the context presents rows, else at or
|
|
4449
|
+
* below the mark on the branch), not a body-group shard (immutable), and
|
|
4450
|
+
* not folded into any reader's summary (compression is consumption,
|
|
4451
|
+
* §3.3). Conservative on every doubt: a reader whose mark can't say (none,
|
|
4452
|
+
* or one on another branch) counts it read. By the shown watermark
|
|
4453
|
+
* (Agent.getShownWatermark), the same test says the message may never
|
|
4454
|
+
* have been shown.
|
|
3702
4455
|
*/
|
|
3703
4456
|
private isUnreadStoredMessage;
|
|
4457
|
+
/**
|
|
4458
|
+
* The live agents whose presented window holds a row (the presentation
|
|
4459
|
+
* index's holders, #291, leaving out a window that is still the whole
|
|
4460
|
+
* record): each one's own place for it, or a reader fork's framing.
|
|
4461
|
+
* None on a framework built without the index. Undefined when it can't be
|
|
4462
|
+
* read, which is logged: one window that can't be read fails the lookup
|
|
4463
|
+
* for every window, so which hold the row isn't known.
|
|
4464
|
+
*/
|
|
4465
|
+
private windowHolders;
|
|
4466
|
+
/** Whether a reader fork was handed a row as framing (the presentation
|
|
4467
|
+
* index's noteFramed, #291, AF-5): its framing row carries the row's
|
|
4468
|
+
* text, so the row is read whatever its marks say. False on a framework
|
|
4469
|
+
* built without the index. */
|
|
4470
|
+
private framedToAReader;
|
|
4471
|
+
/**
|
|
4472
|
+
* Rows just removed from the record through `remover`, taken out of every
|
|
4473
|
+
* other live agent's window that still holds them (the presentation
|
|
4474
|
+
* index's retractRemoved, #291): context-manager tombstones a removal in
|
|
4475
|
+
* the remover's window only. Each row leaves at its own place, so no
|
|
4476
|
+
* other row's place moves; a window on a branch whose record still holds
|
|
4477
|
+
* the row, and one that is still the record, keep it. A window that can't
|
|
4478
|
+
* be repaired is logged and the removal stands. Called after every
|
|
4479
|
+
* removal in place: a hide, a suppression on its fork, a coalescer's or a
|
|
4480
|
+
* module's removal, a suppression a start finishes, and a shed from a
|
|
4481
|
+
* window that is still the record. A rollback needs none: it is a branch
|
|
4482
|
+
* cut, made at the same place in every window.
|
|
4483
|
+
*/
|
|
4484
|
+
private retractRemovedElsewhere;
|
|
3704
4485
|
private removePlacement;
|
|
3705
4486
|
/**
|
|
3706
4487
|
* Convert an MCPL push event to a context message.
|
|
@@ -3708,9 +4489,9 @@ export declare class AgentFramework {
|
|
|
3708
4489
|
private handleMcplPushEvent;
|
|
3709
4490
|
/**
|
|
3710
4491
|
* Whether a batched gate wake's addressed route may become `agentName`'s
|
|
3711
|
-
* speech locus.
|
|
3712
|
-
*
|
|
3713
|
-
* a fork is that fork's conversation, so no other agent takes it.
|
|
4492
|
+
* speech locus. A batch naming no agent wakes every resident and
|
|
4493
|
+
* conversation fork. A fork speaks only in its home channel, and a channel
|
|
4494
|
+
* bound to a fork is that fork's conversation, so no other agent takes it.
|
|
3714
4495
|
*/
|
|
3715
4496
|
private mayTakeGateRoute;
|
|
3716
4497
|
/**
|
|
@@ -3744,8 +4525,8 @@ export declare class AgentFramework {
|
|
|
3744
4525
|
*/
|
|
3745
4526
|
private channelOfHome;
|
|
3746
4527
|
/**
|
|
3747
|
-
*
|
|
3748
|
-
*
|
|
4528
|
+
* The typing channel for one start of a turn that has no locus, an
|
|
4529
|
+
* explicit or a disabled mode turn's, read once as the start opens (driveStream then shows what the
|
|
3749
4530
|
* start showed, TurnRouting.typing): where that start's wake came from,
|
|
3750
4531
|
* its trigger's channel with its server (channelNamed), so a start batched
|
|
3751
4532
|
* with a new wake shows typing where that wake came from. Not the turn's
|
|
@@ -3759,9 +4540,11 @@ export declare class AgentFramework {
|
|
|
3759
4540
|
* (TurnRouting.noChannel), a wake named without its server isn't read: a
|
|
3760
4541
|
* retry's trigger names it again, and reading it then could take a
|
|
3761
4542
|
* channel the turn never had. A wake that gives its server, as every one
|
|
3762
|
-
* the framework makes for a channel does, names that pair.
|
|
4543
|
+
* the framework makes for a channel does, names that pair. A silent wake's
|
|
4544
|
+
* start (InferenceRequest.suppressProse), which runs as disabled mode in
|
|
4545
|
+
* every mode, shows none, though its wake names a channel.
|
|
3763
4546
|
*/
|
|
3764
|
-
private
|
|
4547
|
+
private noLocusTypingChannel;
|
|
3765
4548
|
/**
|
|
3766
4549
|
* Derive the MCPL composite channel id (the outbound routing locus) for a
|
|
3767
4550
|
* push event from its server-defined `origin`, if it carries one.
|
|
@@ -3804,8 +4587,8 @@ export declare class AgentFramework {
|
|
|
3804
4587
|
* Stamps for the rows the agent's reply stores in its current turn: its
|
|
3805
4588
|
* assistant responses, its tool_result rows (through `storeResults`), and
|
|
3806
4589
|
* the contained-wrapper row that stands in for a response. The turn's other
|
|
3807
|
-
* stores (a delivery receipt, a routing notice
|
|
3808
|
-
*
|
|
4590
|
+
* stores (a delivery receipt, a routing notice) aren't the reply's, and
|
|
4591
|
+
* carry none.
|
|
3809
4592
|
* - A silent heartbeat tick stamps each of them for the whole turn, with the
|
|
3810
4593
|
* separator text its request rendered. The stamps keep every row of the
|
|
3811
4594
|
* tick identifiable after the turn, for a later retention policy to find
|
|
@@ -3848,8 +4631,11 @@ export declare class AgentFramework {
|
|
|
3848
4631
|
* turn whose round it came from (opts.routing). `notice: 'now'` also
|
|
3849
4632
|
* queues a private notice naming them, which
|
|
3850
4633
|
* the resident hears at its next tool boundary — only when the live stream
|
|
3851
|
-
* presents mid-turn injections.
|
|
3852
|
-
* (
|
|
4634
|
+
* presents mid-turn injections. The notice is the agent's own row, about
|
|
4635
|
+
* its own speech (#291), so an undo of the turn takes it out of the window
|
|
4636
|
+
* with the turn's other rows, as it takes the receipt, and the next start
|
|
4637
|
+
* names the draft again (noticeUnnoticedDrafts). Otherwise the turn-end
|
|
4638
|
+
* receipt names them (or, after a crash, the next turn's catch-up). Drafts the journal cannot
|
|
3853
4639
|
* hold are reported in the receipt: their words remain in history only.
|
|
3854
4640
|
*/
|
|
3855
4641
|
private holdProseDrafts;
|
|
@@ -3880,17 +4666,18 @@ export declare class AgentFramework {
|
|
|
3880
4666
|
* Turn start (or after a crash): name, privately and before the turn's
|
|
3881
4667
|
* compile, any open drafts no notice on the current branch names: none
|
|
3882
4668
|
* reached the history (a crash, an aborted turn), or a rollback or branch
|
|
3883
|
-
* move took the notices away
|
|
3884
|
-
*
|
|
3885
|
-
*
|
|
3886
|
-
*
|
|
3887
|
-
*
|
|
3888
|
-
*
|
|
3889
|
-
*
|
|
3890
|
-
*
|
|
3891
|
-
*
|
|
3892
|
-
*
|
|
3893
|
-
*
|
|
4669
|
+
* move took the notices away, or, once the agent's context presents rows
|
|
4670
|
+
* (#291), an undo took them out of its window as an undone turn's. Every
|
|
4671
|
+
* draft it marks is named by id, newest first: the newest eight with their
|
|
4672
|
+
* state and why each was held, the rest by id. Like every notice, it quotes
|
|
4673
|
+
* none of their words; the drafts tool shows them. A draft a recent message
|
|
4674
|
+
* already names is recorded as noticed rather than named again: its notice
|
|
4675
|
+
* landed after its turn ended, as a bounce does when a delivery runs after
|
|
4676
|
+
* a tool ends an explicit turn. It reads only the recent history
|
|
4677
|
+
* (draftsNamedInHistory), so its notice claims no more than that, a notice
|
|
4678
|
+
* stored and not yet presented to the agent among it, which its next start
|
|
4679
|
+
* presents. Left out are the open logical turn's own drafts, which its
|
|
4680
|
+
* receipt names and its settlement records (settleTurnDrafts).
|
|
3894
4681
|
*/
|
|
3895
4682
|
private noticeUnnoticedDrafts;
|
|
3896
4683
|
/**
|
|
@@ -3904,7 +4691,8 @@ export declare class AgentFramework {
|
|
|
3904
4691
|
*/
|
|
3905
4692
|
private noticeHeadMoves;
|
|
3906
4693
|
/**
|
|
3907
|
-
* Logical turn end,
|
|
4694
|
+
* Logical turn end, the turn's notices stored (each at its write since
|
|
4695
|
+
* #291, with no queue to flush first): record
|
|
3908
4696
|
* as noticed exactly the drafts a stored message names (the receipt, a
|
|
3909
4697
|
* held-draft notice, a bounce notice), each with the message that names
|
|
3910
4698
|
* it. One whose notice never reached the history stays unnoticed, for the
|
|
@@ -3920,8 +4708,13 @@ export declare class AgentFramework {
|
|
|
3920
4708
|
/** Which of these drafts a stored notice or receipt OF THIS RESIDENT names
|
|
3921
4709
|
* (draft ids are unique only per resident, and residents can share one
|
|
3922
4710
|
* history), each with the newest message that names it, reading only the
|
|
3923
|
-
* recent history, where this turn's notices are.
|
|
4711
|
+
* recent history of the slot's record, where this turn's notices are. A
|
|
4712
|
+
* notice stored and not presented to the agent yet counts: its next start
|
|
4713
|
+
* presents it. Once the agent's context presents rows (#291), one taken
|
|
4714
|
+
* out of its window as an undone turn's (windowStatusOf 'undone') doesn't:
|
|
4715
|
+
* the record still holds it, and the agent's window doesn't. */
|
|
3924
4716
|
private draftsNamedInHistory;
|
|
4717
|
+
private static undoneInWindow;
|
|
3925
4718
|
/** Page size for drafts(action: "list"). */
|
|
3926
4719
|
private static readonly DRAFTS_PAGE;
|
|
3927
4720
|
/** Drafts with a delivery attempt in flight, `${agent}\u0000${id}`: a
|
|
@@ -3959,6 +4752,13 @@ export declare class AgentFramework {
|
|
|
3959
4752
|
* for them, and the agent may send them where it chooses.
|
|
3960
4753
|
*/
|
|
3961
4754
|
private routeLocusSpeech;
|
|
4755
|
+
/**
|
|
4756
|
+
* Hold a locked turn's plain speech as drafts ('no-destination'): the agent
|
|
4757
|
+
* pointed its speech at drafts, or has no lock yet. Named in the turn's
|
|
4758
|
+
* receipt rather than a notice per round, since holding is what the agent
|
|
4759
|
+
* asked for.
|
|
4760
|
+
*/
|
|
4761
|
+
private holdLockedProse;
|
|
3962
4762
|
/** The mark a framework wake takes from a heartbeat's turn with no locus
|
|
3963
4763
|
* of its own (InferenceRequest.heartbeatTurn), so the turn it opens is a
|
|
3964
4764
|
* heartbeat's too; nothing for any other turn. */
|
|
@@ -3981,6 +4781,14 @@ export declare class AgentFramework {
|
|
|
3981
4781
|
* ([discord-send-failed]); this is the success half.
|
|
3982
4782
|
*/
|
|
3983
4783
|
private appendProseDeliveryReceipt;
|
|
4784
|
+
/**
|
|
4785
|
+
* main's [speech-not-posted] notice, the agent's own row (#291:
|
|
4786
|
+
* storeOwnRow, stamped and presented as it is stored), written by the frame
|
|
4787
|
+
* whose turn ends here, or by a start before its compile, each holding the
|
|
4788
|
+
* agent. A dropped start (endDroppedTurn) passes `present` false: its agent
|
|
4789
|
+
* may have been replaced, and a turn of the new one's may be alive, so the
|
|
4790
|
+
* row waits out of the window for the agent's next point.
|
|
4791
|
+
*/
|
|
3984
4792
|
private nameUnpostedSpeech;
|
|
3985
4793
|
private noteFailedTurnEnd;
|
|
3986
4794
|
/**
|
|
@@ -3989,9 +4797,9 @@ export declare class AgentFramework {
|
|
|
3989
4797
|
* destination itself. A `>>` into a channel the agent closed or declined
|
|
3990
4798
|
* leaves it closed, so the note goes wherever the turn's speech stayed in
|
|
3991
4799
|
* such a channel, once per channel. It goes through addMessage, as the
|
|
3992
|
-
* open notices do:
|
|
3993
|
-
*
|
|
3994
|
-
*
|
|
4800
|
+
* open notices do: stored at once, and presented at the agent's next
|
|
4801
|
+
* presentation point while a turn of its is alive, so it reaches the
|
|
4802
|
+
* agent once. No-op otherwise.
|
|
3995
4803
|
*/
|
|
3996
4804
|
private appendClosedChannelNoteAlone;
|
|
3997
4805
|
/**
|
|
@@ -4006,6 +4814,54 @@ export declare class AgentFramework {
|
|
|
4006
4814
|
/** The stored baseline's entry for the agent set (rememberAnnouncedLocus),
|
|
4007
4815
|
* or removed (undefined) when the agent ends without coming back. */
|
|
4008
4816
|
private writeAnnouncedLocus;
|
|
4817
|
+
/**
|
|
4818
|
+
* Whether the agent's current turn has no channel of its own, so it is
|
|
4819
|
+
* answering no incoming message (ChannelRegistry.incomingFor): a
|
|
4820
|
+
* heartbeat's, or one woken for a channel that names none, which no re-pin
|
|
4821
|
+
* or channel_open has given a channel since. A locked turn's locus is where
|
|
4822
|
+
* it speaks, not a message it answers, so it never counts as one.
|
|
4823
|
+
*/
|
|
4824
|
+
private channellessTurn;
|
|
4825
|
+
/**
|
|
4826
|
+
* The prose routing an agent's turns run under: its configured mode, except
|
|
4827
|
+
* for a locked agent's conversation fork and ephemeral run, which have no
|
|
4828
|
+
* lock of their own. A fork is bound to its home channel, so it routes as
|
|
4829
|
+
* locus mode does. A run's plain speech is its caller's result, and it
|
|
4830
|
+
* publishes none: run as locus mode, its narration between tool calls would
|
|
4831
|
+
* post to the channel inferred for its turn, which the lock exists to
|
|
4832
|
+
* prevent, so it runs disabled, as a disabled resident's run does.
|
|
4833
|
+
*/
|
|
4834
|
+
private proseRoutingOf;
|
|
4835
|
+
/**
|
|
4836
|
+
* A locked agent's own choice of destination (prose_locus), as
|
|
4837
|
+
* framework/state keeps it: a channel, 'drafts', or undefined when it
|
|
4838
|
+
* hasn't chosen. Throws when the state can't be read.
|
|
4839
|
+
*/
|
|
4840
|
+
private readProseLock;
|
|
4841
|
+
/** Record a locked agent's choice of destination. Throws when it isn't recorded. */
|
|
4842
|
+
private writeProseLock;
|
|
4843
|
+
/**
|
|
4844
|
+
* Where a locked agent's plain speech goes now: its own choice
|
|
4845
|
+
* (prose_locus), else its recipe's proseLock, resolved as a `>>` target
|
|
4846
|
+
* is, else nowhere (null: held as drafts). A stored choice that can't be
|
|
4847
|
+
* read holds the speech as drafts rather than fall back to the recipe's,
|
|
4848
|
+
* which the agent may have moved it away from.
|
|
4849
|
+
*/
|
|
4850
|
+
private proseLockLocus;
|
|
4851
|
+
/** Where a locked turn's plain speech goes now: its locus, or nowhere (drafts) while a move holds the rest of the turn (heldForMove). */
|
|
4852
|
+
private turnSpeaksAt;
|
|
4853
|
+
/** " prose_locus moves it." where the agent may call prose_locus, else nothing: a notice names only a tool the agent has. */
|
|
4854
|
+
private proseLocusMoves;
|
|
4855
|
+
/** Where a locked agent's plain speech goes, as the agent is told it: a verb phrase after "your plain speech". */
|
|
4856
|
+
private proseLockShown;
|
|
4857
|
+
/**
|
|
4858
|
+
* prose_locus: read or move a locked agent's prose lock. A move is
|
|
4859
|
+
* recorded before it applies, so a failed write moves nothing. It applies
|
|
4860
|
+
* to the calling turn's later rounds while that turn is open (what the
|
|
4861
|
+
* calling round wrote was routed with the locus it had), and to every
|
|
4862
|
+
* later turn.
|
|
4863
|
+
*/
|
|
4864
|
+
private proseLocusToolResult;
|
|
4009
4865
|
/**
|
|
4010
4866
|
* Announce-on-change locus notice (turn-frozen routing). Appends a durable
|
|
4011
4867
|
* `[routing]` window message when the turn's effective outbound locus
|
|
@@ -4033,8 +4889,221 @@ export declare class AgentFramework {
|
|
|
4033
4889
|
* (addressedElsewhereNotice).
|
|
4034
4890
|
*/
|
|
4035
4891
|
private repinChannel;
|
|
4892
|
+
/**
|
|
4893
|
+
* Whether `agent`'s logical turn is alive: a turn token, or a continuation
|
|
4894
|
+
* of its turn or a retry on its way (hasTurn: a budget restart's queued
|
|
4895
|
+
* continuation, a provider hold's retry), or a live stream or a tool cycle
|
|
4896
|
+
* pending (turnAlive). The one test the presentation index (its host's
|
|
4897
|
+
* turnAlive) and the writes that weigh a turn share: a write stored then
|
|
4898
|
+
* is marked not presented (addMessage) and takes no clock row ahead of it,
|
|
4899
|
+
* and no undo or redo is made.
|
|
4900
|
+
*/
|
|
4901
|
+
private logicalTurnAlive;
|
|
4036
4902
|
/** Whether `agent` has a turn alive: starting, streaming or waiting on its tools. */
|
|
4037
4903
|
private turnAlive;
|
|
4904
|
+
/**
|
|
4905
|
+
* Whether the presentation index presents for `agent` (#291): the agent
|
|
4906
|
+
* taken on, and its context in presented mode. Every registered agent is
|
|
4907
|
+
* taken on, its window written down at its registration, and again on the
|
|
4908
|
+
* new branch after every move of the store's branch where that branch has
|
|
4909
|
+
* none (followBranchMove: a branch made before the write-down, a rollback
|
|
4910
|
+
* into rows the write-down presented), so a branch move doesn't end it.
|
|
4911
|
+
* One whose window couldn't be written down (another version's index
|
|
4912
|
+
* format, or a failed write), or whose context couldn't follow a branch
|
|
4913
|
+
* move, stays unpresented until the next move (legacy mode: its window
|
|
4914
|
+
* the whole record where the branch has none, or as the new branch holds
|
|
4915
|
+
* it, writes for it then waiting in memory), traced as
|
|
4916
|
+
* presentation:failed; the paths that ask this pass it by: nothing is
|
|
4917
|
+
* presented for it, its tool boundaries hear nothing, and undo refuses
|
|
4918
|
+
* it.
|
|
4919
|
+
*/
|
|
4920
|
+
private presents;
|
|
4921
|
+
/**
|
|
4922
|
+
* Record, at an agent's registration, the mode its requests send other
|
|
4923
|
+
* agents' rounds in (foreignRoundsConfigured). An agent that takes its
|
|
4924
|
+
* context from another (`from`: a derived agent's parent, a conversation
|
|
4925
|
+
* fork's template) is sent them in the mode configured for that agent,
|
|
4926
|
+
* the one its window uses when presented (a source left in legacy mode by
|
|
4927
|
+
* a failed write-down is sent them as stored meanwhile; a child it
|
|
4928
|
+
* derives, presented, isn't), its inheritance holding what that agent's
|
|
4929
|
+
* window held of them, a shared derivation's as a window and a copy's or
|
|
4930
|
+
* a fork's seed as its own rows. The source is live here: the registry
|
|
4931
|
+
* admits a derived agent only while its context source is, but for a
|
|
4932
|
+
* resumption, which takes its configuration's mode as below. Otherwise, an
|
|
4933
|
+
* agent that observes another is sent them as its configuration's
|
|
4934
|
+
* foreignRounds says, a transcript by default, as the persistent
|
|
4935
|
+
* subconscious is (foreign-rounds.ts). Any other agent reads no other
|
|
4936
|
+
* agent's rounds, and is left as stored.
|
|
4937
|
+
*/
|
|
4938
|
+
private configureForeignRounds;
|
|
4939
|
+
/**
|
|
4940
|
+
* How another agent's rounds go out in `agent`'s requests
|
|
4941
|
+
* (Agent.setForeignRounds), for an agent whose configuration names a mode
|
|
4942
|
+
* (foreignRoundsConfigured): that mode while the presentation index
|
|
4943
|
+
* presents its window, and as stored (`'raw'`) while its window is the
|
|
4944
|
+
* record, as before the index. Set at its registration and again after
|
|
4945
|
+
* each branch move's rebase (followBranchMove), which can present a
|
|
4946
|
+
* window whose write-down failed at registration, or leave one in legacy
|
|
4947
|
+
* mode. Nothing for any other agent, which reads no other agent's rounds.
|
|
4948
|
+
*/
|
|
4949
|
+
private applyForeignRounds;
|
|
4950
|
+
/**
|
|
4951
|
+
* Take a newly registered agent on (presentation.adopt: its window
|
|
4952
|
+
* written down, its own rows stored and not in it presented, its own-row
|
|
4953
|
+
* sink installed), and weigh each row of another writer that enters its
|
|
4954
|
+
* window at a start, at an end or at rest as its open turn's arrival
|
|
4955
|
+
* (noteArrival), as the flushes these points replace weighed what they
|
|
4956
|
+
* stored. A tool boundary weighs what it hears itself.
|
|
4957
|
+
*/
|
|
4958
|
+
private adoptPresentation;
|
|
4959
|
+
/**
|
|
4960
|
+
* For the workspace's head-move notice (useWindow): whether `agentName`'s
|
|
4961
|
+
* window still holds the first of its own rows stored after
|
|
4962
|
+
* `afterSequence`, the store's head when it wrote a mount direct during a
|
|
4963
|
+
* turn of its, which is the round that made the write (one made outside
|
|
4964
|
+
* any turn isn't asked here). An undo on the window leaves the record
|
|
4965
|
+
* and the branch as they were and takes the turn's own rows out of the
|
|
4966
|
+
* window as undone, so this is where the agent's history no longer holds
|
|
4967
|
+
* the write. True for an agent the index doesn't present for, and where
|
|
4968
|
+
* no own row of its came after. A row is its own by the rule an undo
|
|
4969
|
+
* takes it out by (ownWindowRow), so a turn an earlier release stored,
|
|
4970
|
+
* with no stamp, counts by its voice. Reads the record back from its
|
|
4971
|
+
* newest row, 64 at a time, to that place, then weighs the rows after it
|
|
4972
|
+
* in store order.
|
|
4973
|
+
*/
|
|
4974
|
+
private windowHoldsOwnRowsAfter;
|
|
4975
|
+
/** Let a deregistered agent go from the presentation index (forget), its arrival listener with it. */
|
|
4976
|
+
private forgetPresentation;
|
|
4977
|
+
/**
|
|
4978
|
+
* An agent's turn's end, or a moment its turn may have ended: what it is
|
|
4979
|
+
* owed is presented (presentation.presentAtEnd),
|
|
4980
|
+
* unless its logical turn is still alive (a token, a continuation or
|
|
4981
|
+
* retry on its way, a stream, a tool cycle), whose own points present
|
|
4982
|
+
* it. Idempotent; nothing for an agent the index doesn't present for.
|
|
4983
|
+
*/
|
|
4984
|
+
private presentAtEndOf;
|
|
4985
|
+
/**
|
|
4986
|
+
* Whether a write stored for `agent` now waits outside its window for a
|
|
4987
|
+
* later point (#291), read before the write: while the host is quiesced,
|
|
4988
|
+
* or while a logical turn of the agent's is alive (`turnLive`,
|
|
4989
|
+
* logicalTurnAlive), but for a fresh tool_result (a draining turn's
|
|
4990
|
+
* continuation depends on it) and a write while the agent's start is
|
|
4991
|
+
* assembling, which that start presents before its compile.
|
|
4992
|
+
*/
|
|
4993
|
+
private keptOutOfWindow;
|
|
4994
|
+
/**
|
|
4995
|
+
* Whether a write stored for `agent` as `id` is placed as not presented
|
|
4996
|
+
* to it (`presented: false`), which a coalesced render's delivery reads
|
|
4997
|
+
* to keep the render replaceable and wake its agent to read it: kept out
|
|
4998
|
+
* of the agent's window by its turn or a quiesced host (`keptOut`,
|
|
4999
|
+
* keptOutOfWindow), or stored while no logical turn of the agent's was
|
|
5000
|
+
* alive (`atRest`) and out of its window after its presentation at rest,
|
|
5001
|
+
* which failed (presentation.notPresented). Only for an agent the index
|
|
5002
|
+
* presents for.
|
|
5003
|
+
*/
|
|
5004
|
+
private placedUnpresented;
|
|
5005
|
+
/**
|
|
5006
|
+
* A channel message stored straight into a fork's own store, past
|
|
5007
|
+
* addMessage, as the fork writes are (a correction
|
|
5008
|
+
* handleMcplChannelIncoming delivers, a message routeConversationIncoming
|
|
5009
|
+
* routes), stamped for the fork alone. While a surgery holds the store it
|
|
5010
|
+
* is held in memory instead (surgeryHeldWrites) and '' returned, and so
|
|
5011
|
+
* is it while a hold's release replays what the hold kept, but for the
|
|
5012
|
+
* write the replay stores (`replayed`, called as soon as its store
|
|
5013
|
+
* returns, as addMessage calls it), and while the fork's context
|
|
5014
|
+
* manager refuses its work after a failed re-initialization
|
|
5015
|
+
* (heldForRecovery, as addMessage keeps a write);
|
|
5016
|
+
* stored, it enters the fork's window at once when no turn of the fork's
|
|
5017
|
+
* is alive, else at the fork's next point (afterStore). One whose store
|
|
5018
|
+
* threw after its row landed is stored as that row, and one whose store
|
|
5019
|
+
* can't tell what of it landed throws that error, the rows it names
|
|
5020
|
+
* presented (landedThoughThrown), as addMessage's. `mayBeStored`: as
|
|
5021
|
+
* FrameworkWriteOptions.mayBeStored, read back in the fork's store.
|
|
5022
|
+
*/
|
|
5023
|
+
private storeInFork;
|
|
5024
|
+
/**
|
|
5025
|
+
* The writes a surgery's hold kept (surgeryHeldWrites), replayed in the
|
|
5026
|
+
* order they arrived once the hold and its tokens are released, each by
|
|
5027
|
+
* the path it was held on: addMessage's, or a fork's store. Ahead of them
|
|
5028
|
+
* are the writes kept for an agent whose context manager the move
|
|
5029
|
+
* re-initialized after it refused its work (recoverHeldWrites). Each is
|
|
5030
|
+
* traced once, as it is stored (`message:added`, source
|
|
5031
|
+
* `surgery-release`, with its stored id): its arrival named none, and
|
|
5032
|
+
* wasn't traced. The trace is emitted synchronously, right after that
|
|
5033
|
+
* write's store and before the next write is stored, inside this call,
|
|
5034
|
+
* which no await interrupts: a listener that edits or removes the row
|
|
5035
|
+
* does so before any turn compiles a request with it in, though the row
|
|
5036
|
+
* may be in an idle reader's window by then (each reader takes it as it
|
|
5037
|
+
* is stored). The Discord module relies on that to apply the edits and
|
|
5038
|
+
* deletes it kept for a message whose create the hold kept, which no
|
|
5039
|
+
* module can reach before it lands (ModuleContext.addMessage). Keep it so,
|
|
5040
|
+
* or give such a module a callback the release calls in its place. The
|
|
5041
|
+
* writes are taken off the queue one at a time, each once it is stored or
|
|
5042
|
+
* lost, and while they replay (replayingHeld) the ones still waiting, the
|
|
5043
|
+
* one being stored included, stay listed (the tune-out's
|
|
5044
|
+
* getSurgeryHeldMessages, HostModeStatus.deferredWrites), a write such a
|
|
5045
|
+
* listener makes is kept behind them, and the tune-out's writesHeld reads
|
|
5046
|
+
* true, so a cancel a listener asks for waits for the replay's end, as it
|
|
5047
|
+
* does during the hold. A hold a listener begins meanwhile stops the
|
|
5048
|
+
* replay, and its own release stores the rest, in order: one begun by a
|
|
5049
|
+
* listener of the write being stored (its clock row's trace) leaves that
|
|
5050
|
+
* write unstored at their head. A
|
|
5051
|
+
* write for an agent whose context manager refuses its
|
|
5052
|
+
* work is kept in memory for it again (heldForRecovery), never dropped,
|
|
5053
|
+
* and is traced when a later move stores it. An agent that ends during
|
|
5054
|
+
* the hold takes its writes out of it as it ends, and passes them on
|
|
5055
|
+
* (releaseWindowNowOrAfterResume). One the release still meets for an
|
|
5056
|
+
* agent gone, or for a name another agent is registered under since
|
|
5057
|
+
* (heldWriteTargetGone), goes on to the primary if it is one the primary
|
|
5058
|
+
* takes in its place, and is dropped otherwise (passHeldWritesOn), told of
|
|
5059
|
+
* by an ops alert. A write whose store threw after its rows landed
|
|
5060
|
+
* (context-manager's WriteLandedError) is stored as those rows by
|
|
5061
|
+
* addMessage and storeInFork, presented and traced as any write stored
|
|
5062
|
+
* here. One whose store threw where context-manager can't tell what of it
|
|
5063
|
+
* landed (WriteOutcomeUnknownError) may be lost: the rows the error names
|
|
5064
|
+
* as stored are presented (by addMessage and storeInFork) and traced, the
|
|
5065
|
+
* first by its id, and the write is counted as one that may be lost, the
|
|
5066
|
+
* rows the store may hold besides named. Any other throw stored none of
|
|
5067
|
+
* the write: it is logged and lost. The rest go on either way. Each
|
|
5068
|
+
* agent's lost writes, and those that may be, are told of once, by a log
|
|
5069
|
+
* line and an ops alert of kind `store-held-lost`. Each is also given to
|
|
5070
|
+
* the tune-out coordinator, by its metadata (heldWriteLost), before the
|
|
5071
|
+
* deferred cancels run: a reader's note kept with a waiting cancel is
|
|
5072
|
+
* told lost to the reader when that cancel ends the hold, as the cancel's
|
|
5073
|
+
* waiting answer promised. So is each write stored (heldWriteStored),
|
|
5074
|
+
* before its trace: such a note counts as delivered then, and a stop
|
|
5075
|
+
* while its cancel still waits doesn't tell it lost.
|
|
5076
|
+
*/
|
|
5077
|
+
private releaseSurgeryHeldWrites;
|
|
5078
|
+
/**
|
|
5079
|
+
* One write of releaseSurgeryHeldWrites's replay, the head of `queue`,
|
|
5080
|
+
* stored by the path it was held on; one that fails is noted in `lost`,
|
|
5081
|
+
* by agent, and given to the tune-out coordinator (heldWriteLost), which
|
|
5082
|
+
* knows its own writes by their metadata; one stored is given to it too
|
|
5083
|
+
* (heldWriteStored). It is taken off the queue once
|
|
5084
|
+
* it is stored, kept for its agent's recovery, passed on or lost, before
|
|
5085
|
+
* its trace; false where a
|
|
5086
|
+
* hold begun during its store (a listener of its clock row's trace)
|
|
5087
|
+
* keeps it at the head, unstored.
|
|
5088
|
+
*/
|
|
5089
|
+
private replayHeldWrite;
|
|
5090
|
+
/**
|
|
5091
|
+
* Whether a round's turn was stopped while its results were built (a
|
|
5092
|
+
* spill's workspace write), which a tool boundary and a stream that
|
|
5093
|
+
* completed while its tools ran both await before they store anything:
|
|
5094
|
+
* the stop's name, or null when the round goes on. `before` is the state
|
|
5095
|
+
* the build began from and `stream` the round's stream.
|
|
5096
|
+
*
|
|
5097
|
+
* A host's cancelStream, stop() and abortInference, and an ephemeral run's
|
|
5098
|
+
* disposal, replace that state (the agent is left idle): `'state-changed'`.
|
|
5099
|
+
* A quiesce's abandon and stop() record their cancel of the stream and
|
|
5100
|
+
* leave the state to driveStream: the record's name, once the stream is no
|
|
5101
|
+
* longer waiting for these results. The stream's state is what makes the
|
|
5102
|
+
* record this stream's: one left under the same key by an earlier stream,
|
|
5103
|
+
* such as an earlier agent's of the same name, sits beside a stream still
|
|
5104
|
+
* waiting.
|
|
5105
|
+
*/
|
|
5106
|
+
private roundStoppedDuringBuild;
|
|
4038
5107
|
/**
|
|
4039
5108
|
* Store the clock row due in `agent`'s window (clock-rows.ts), if the agent
|
|
4040
5109
|
* has clock rows and a boundary has passed since the window's last clock,
|
|
@@ -4047,10 +5116,11 @@ export declare class AgentFramework {
|
|
|
4047
5116
|
* the request that follows or before every request still to come, so the
|
|
4048
5117
|
* window and the live stream keep matching.
|
|
4049
5118
|
*
|
|
4050
|
-
* None while the host is quiesced (the window is frozen for surgery)
|
|
4051
|
-
*
|
|
4052
|
-
*
|
|
4053
|
-
*
|
|
5119
|
+
* None while the host is quiesced (the window is frozen for surgery). In
|
|
5120
|
+
* the residents' shared slot another reader's turn doesn't matter (#291):
|
|
5121
|
+
* the row is the agent's own, in no other resident's window unless that
|
|
5122
|
+
* resident observes the agent (AgentConfig.observes), which takes it at
|
|
5123
|
+
* its own points. A clock that
|
|
4054
5124
|
* can't be planned or stored is logged and skipped: it never holds up what
|
|
4055
5125
|
* it would have preceded. One whose write threw after it landed is the
|
|
4056
5126
|
* window's all the same, so it's returned, and a tool boundary injects it.
|
|
@@ -4063,10 +5133,9 @@ export declare class AgentFramework {
|
|
|
4063
5133
|
* that couldn't be stored (stored-injections.ts, #155 part 5). Which are
|
|
4064
5134
|
* stored, and which skipped, is planInjectionStores'.
|
|
4065
5135
|
*
|
|
4066
|
-
* Nothing is stored while the
|
|
4067
|
-
*
|
|
4068
|
-
*
|
|
4069
|
-
* stored, and what it skips, being in view already, isn't placed again.
|
|
5136
|
+
* Nothing is stored while the host is quiesced, as for a clock row:
|
|
5137
|
+
* `compile()` places what the plan would have stored, and what it skips,
|
|
5138
|
+
* being in view already, isn't placed again.
|
|
4070
5139
|
* Rows are written in the order gathered. A row whose write throws is
|
|
4071
5140
|
* placed by `compile()` instead, with every row after it, unless the
|
|
4072
5141
|
* read-back shows it landed; where the read-back fails, a row whose write
|
|
@@ -4089,9 +5158,10 @@ export declare class AgentFramework {
|
|
|
4089
5158
|
* since costs one request, as below. A part the strategy cut at its
|
|
4090
5159
|
* per-message cap, or stripped an image from, counts as held, since a new
|
|
4091
5160
|
* copy would meet the same. One a fold has summarized, a strategy's window
|
|
4092
|
-
* has scrolled past,
|
|
4093
|
-
*
|
|
4094
|
-
*
|
|
5161
|
+
* has scrolled past, an undo has taken out of the agent's window (#291),
|
|
5162
|
+
* a throwing write left part-stored, or that no request since this agent
|
|
5163
|
+
* started has held (and no failed start since has stored), is stored
|
|
5164
|
+
* again at the next start,
|
|
4095
5165
|
* so the agent has the current copy at the cost of one more row: a fold
|
|
4096
5166
|
* between two starts leaves the request after it with the summary's word,
|
|
4097
5167
|
* and the start after that stores it again. The rows to store come in the order gathered,
|
|
@@ -4104,27 +5174,37 @@ export declare class AgentFramework {
|
|
|
4104
5174
|
* Undefined when there's nothing of the stored kind.
|
|
4105
5175
|
*/
|
|
4106
5176
|
private planInjectionStores;
|
|
4107
|
-
/**
|
|
4108
|
-
* Whether a write the framework makes into `agent`'s window of its own
|
|
4109
|
-
* accord (a clock row, a batched wake's line) waits: while the host is
|
|
4110
|
-
* quiesced, or, for a reader of the residents' shared slot (the
|
|
4111
|
-
* subconscious, which reads it through a merged view, included), while
|
|
4112
|
-
* another reader of it has a turn alive, where it would land inside that
|
|
4113
|
-
* turn.
|
|
4114
|
-
*/
|
|
4115
|
-
private slotHeldFrom;
|
|
4116
5177
|
/** Rows isNewestIn reads back past clock rows and stored injections. */
|
|
4117
5178
|
private static readonly NEWEST_SCAN_ROWS;
|
|
4118
5179
|
/** Rows a window's last-clock scan reads at a time. */
|
|
4119
5180
|
private static readonly CLOCK_SCAN_ROWS;
|
|
4120
|
-
/** What the next clock is planned from:
|
|
4121
|
-
* the time its last clock row reads, found by reading back from
|
|
4122
|
-
* newest row, CLOCK_SCAN_ROWS at a time, until a clock row comes,
|
|
4123
|
-
* far back it is. In the steady state the newest chunk holds it,
|
|
4124
|
-
* more rows than that have come since the last clock; a window
|
|
4125
|
-
* clock row is read whole once, and then takes one (planClock).
|
|
5181
|
+
/** What the agent's next clock is planned from: its window's newest row's
|
|
5182
|
+
* time and the time its last clock row reads, found by reading back from
|
|
5183
|
+
* the newest row, CLOCK_SCAN_ROWS at a time, until a clock row comes,
|
|
5184
|
+
* however far back it is. In the steady state the newest chunk holds it,
|
|
5185
|
+
* unless more rows than that have come since the last clock; a window
|
|
5186
|
+
* with no clock row is read whole once, and then takes one (planClock).
|
|
5187
|
+
* While the agent's context is in legacy mode, its window is the slot's
|
|
5188
|
+
* record, a co-resident's rows and clock rows among them. Once it
|
|
5189
|
+
* presents rows (#291), the window is the rows presented to it, in their
|
|
5190
|
+
* order: a co-resident's clock row isn't in it unless the agent observes
|
|
5191
|
+
* that co-resident (AgentConfig.observes), and then the newest clock row
|
|
5192
|
+
* the window holds is read, whosever it is; a row stored and not
|
|
5193
|
+
* presented yet comes after the clock its start writes, so it isn't read. */
|
|
4126
5194
|
private lastClockOf;
|
|
4127
5195
|
private agentSees;
|
|
5196
|
+
/**
|
|
5197
|
+
* Record `view`, the filter `contextManager` was opened with
|
|
5198
|
+
* (context-options.ts: residentViewFilter, subconsciousViewFilter, or
|
|
5199
|
+
* liveViewFilterOf's choice for an agent's record), as what its agent sees
|
|
5200
|
+
* (storeSees), so main's checks of whether an agent sees a row (agentSees,
|
|
5201
|
+
* #853: a tool boundary's injection, an arrival, an unread message's
|
|
5202
|
+
* readers, the newest-row check, the recent-image scan) ask the predicate
|
|
5203
|
+
* its compiles read. Both views read a row's metadata alone. A manager
|
|
5204
|
+
* opened with no view keeps no record, and agentSees reads it as seeing
|
|
5205
|
+
* every row, as its compiles do. Returns the manager.
|
|
5206
|
+
*/
|
|
5207
|
+
private recordView;
|
|
4128
5208
|
/**
|
|
4129
5209
|
* Weigh a message that no tool boundary of the agent's open logical turn
|
|
4130
5210
|
* will weigh: one that would re-pin the locus becomes one of the turn's
|
|
@@ -4137,18 +5217,11 @@ export declare class AgentFramework {
|
|
|
4137
5217
|
private noteArrival;
|
|
4138
5218
|
/**
|
|
4139
5219
|
* Whether `agent`'s store is the residents' one message slot, which every
|
|
4140
|
-
* ordinary resident reads
|
|
4141
|
-
* slot
|
|
4142
|
-
* or an ephemeral agent's is.
|
|
5220
|
+
* ordinary resident reads: its own slot in the registry (`ownSlot`) is
|
|
5221
|
+
* that slot. The subconscious reads that slot through an observe edge, but
|
|
5222
|
+
* its own store is isolated, as a fork's or an ephemeral agent's is.
|
|
4143
5223
|
*/
|
|
4144
5224
|
private isOrdinaryResident;
|
|
4145
|
-
/**
|
|
4146
|
-
* Weigh a message just stored in an ordinary resident's store for every
|
|
4147
|
-
* other ordinary resident's open turn, running or not: residents read one
|
|
4148
|
-
* message slot, and a tool boundary weighs only the messages drained for
|
|
4149
|
-
* its own agent, so no boundary of another resident's turn weighs it.
|
|
4150
|
-
*/
|
|
4151
|
-
private noteForOtherResidents;
|
|
4152
5225
|
/**
|
|
4153
5226
|
* Show the turn's typing indicator in `channel`, stopping the one it last
|
|
4154
5227
|
* showed elsewhere: this stream's, or one an earlier stream of the turn
|
|
@@ -4179,18 +5252,20 @@ export declare class AgentFramework {
|
|
|
4179
5252
|
*/
|
|
4180
5253
|
private repinTurnLocus;
|
|
4181
5254
|
/**
|
|
4182
|
-
* Under `speech.locus: 'delivery'
|
|
4183
|
-
* it from another channel while its
|
|
4184
|
-
* never moves the locus and a neutral
|
|
4185
|
-
* its channel (first live run,
|
|
5255
|
+
* Under `speech.locus: 'delivery'`, and in a locked turn under either rule:
|
|
5256
|
+
* tell the agent that someone addressed it from another channel while its
|
|
5257
|
+
* turn was busy, since incoming traffic never moves the locus and a neutral
|
|
5258
|
+
* message carries nothing that names its channel (first live run,
|
|
5259
|
+
* 2026-10-12, finding C). Once per channel
|
|
4186
5260
|
* per turn (TurnRouting.addressedElsewhere); nothing for the turn's own
|
|
4187
|
-
* locus. Stored durably; returned as stored for a live
|
|
4188
|
-
* with its boundary's other messages
|
|
5261
|
+
* locus. Stored durably; returned as stored, with its id, for a live
|
|
5262
|
+
* stream to inject with its boundary's other messages, so the round's note
|
|
5263
|
+
* (noteRoundSent) names the stored row. Undefined when nothing was stored.
|
|
4189
5264
|
*/
|
|
4190
5265
|
private addressedElsewhereNotice;
|
|
4191
5266
|
/**
|
|
4192
5267
|
* The arrivals a start of the turn consumes under `speech.locus:
|
|
4193
|
-
* 'delivery'
|
|
5268
|
+
* 'delivery'`, or in a locked turn: each one that addressed the agent, whose message is still
|
|
4194
5269
|
* in the store, gets the addressed-elsewhere notice, oldest first. A
|
|
4195
5270
|
* follow-up in an engaged channel addressed nobody and is not announced.
|
|
4196
5271
|
*/
|
|
@@ -4207,8 +5282,9 @@ export declare class AgentFramework {
|
|
|
4207
5282
|
* ensureInitialDesiredState) only where the agent it's addressed to can
|
|
4208
5283
|
* call it for every channel it names (canCloseChannels): a conversation
|
|
4209
5284
|
* fork may close only its home channel, and an agent's allowedTools can leave
|
|
4210
|
-
* channel_close out.
|
|
4211
|
-
*
|
|
5285
|
+
* channel_close out. Where several residents share one slot it is stored
|
|
5286
|
+
* in the slot they share, but stamped for the agent it's addressed to
|
|
5287
|
+
* (#291); a fork's seed leaves it out (primaryNoticeTexts).
|
|
4212
5288
|
* Where an
|
|
4213
5289
|
* agent's own send opened a channel it can't close, the primary is told by
|
|
4214
5290
|
* name too, if it's registered and can close it, and the agent is told
|
|
@@ -4224,14 +5300,17 @@ export declare class AgentFramework {
|
|
|
4224
5300
|
* Write a builder's channel notices in order, each on its own: one that
|
|
4225
5301
|
* can't be written is logged, and the rest are still written. A reader's
|
|
4226
5302
|
* notice that says the primary was told comes after the primary's, and is
|
|
4227
|
-
* written in its `untold` words where the primary's write
|
|
4228
|
-
* never says the primary was told of a notice
|
|
4229
|
-
*
|
|
4230
|
-
*
|
|
4231
|
-
*
|
|
4232
|
-
*
|
|
4233
|
-
*
|
|
4234
|
-
*
|
|
5303
|
+
* written in its `untold` words where the primary's write threw, so it
|
|
5304
|
+
* never says the primary was told of a notice whose write threw. A write
|
|
5305
|
+
* a surgery's hold keeps in memory, or one kept for a manager that refuses
|
|
5306
|
+
* its work, counts as written (addMessage returns '' for it, without
|
|
5307
|
+
* throwing): if storing the primary's fails at the release, or a restart
|
|
5308
|
+
* loses it, the reader's notice, stored too, still says the primary was
|
|
5309
|
+
* told. A write is stored at once (#291), and one for an agent mid-turn enters its
|
|
5310
|
+
* window at its next point (its tool boundary hears it, or its turn's end
|
|
5311
|
+
* presents it). Through framework.addMessage, so a notice an open forces
|
|
5312
|
+
* inside a live turn is stored and presented as any write is, rather than
|
|
5313
|
+
* appended to the context manager straight.
|
|
4235
5314
|
*/
|
|
4236
5315
|
private writeChannelNotices;
|
|
4237
5316
|
/**
|
|
@@ -4321,8 +5400,10 @@ export declare class AgentFramework {
|
|
|
4321
5400
|
* channel_open as the way to try again only where the agent it's addressed
|
|
4322
5401
|
* to can call it: a conversation fork's channel_open is refused outright
|
|
4323
5402
|
* (dispatchChannelToolCall), and an agent's allowedTools can leave it out.
|
|
4324
|
-
*
|
|
4325
|
-
*
|
|
5403
|
+
* Where several residents share one slot it is stored in the slot they
|
|
5404
|
+
* share, but stamped for the agent it's addressed to (#291), the primary
|
|
5405
|
+
* alone where it's told by name; a fork's seed leaves it out
|
|
5406
|
+
* (primaryNoticeTexts).
|
|
4326
5407
|
* Where the channel is selected for opening, it says so and why, as
|
|
4327
5408
|
* speech's failure does, and what that means: where the host couldn't
|
|
4328
5409
|
* record putting the channel's decision back, a later delivery or
|
|
@@ -4391,9 +5472,6 @@ export declare class AgentFramework {
|
|
|
4391
5472
|
* agent's cap. False when it couldn't be stored.
|
|
4392
5473
|
*/
|
|
4393
5474
|
private writeAutoContinueNotice;
|
|
4394
|
-
/** Whether another reader of the residents' shared slot has a turn alive,
|
|
4395
|
-
* so no row may be written there now (as storeDueClock checks). */
|
|
4396
|
-
private sharedSlotBusy;
|
|
4397
5475
|
/** A continuation whose turn doesn't run: the run's count goes back to
|
|
4398
5476
|
* what it was before it was queued. */
|
|
4399
5477
|
private giveBackAutoContinue;
|
|
@@ -4529,8 +5607,8 @@ export declare class AgentFramework {
|
|
|
4529
5607
|
* the gate released). Any other drop ends it as a start dropped before it
|
|
4530
5608
|
* sends anything ends, and settles a registered ephemeral run's turn with
|
|
4531
5609
|
* the drop's reason. That frame, if it hasn't let go of its token yet,
|
|
4532
|
-
* ends on its own and settles nothing. What was
|
|
4533
|
-
*
|
|
5610
|
+
* ends on its own and settles nothing. What was stored for the agent
|
|
5611
|
+
* meanwhile is presented now (presentAtEndOf), or at that frame's end.
|
|
4534
5612
|
*/
|
|
4535
5613
|
private endContinuedTurn;
|
|
4536
5614
|
/**
|
|
@@ -4672,8 +5750,10 @@ export declare class AgentFramework {
|
|
|
4672
5750
|
* - Refused unless the agent is idle with no turn alive: puppeting
|
|
4673
5751
|
* mid-turn would corrupt the turn state machine and the live stream's
|
|
4674
5752
|
* wire ordering. For its own duration the puppet HOLDS the turn-alive
|
|
4675
|
-
* marker (wakes requeue,
|
|
4676
|
-
*
|
|
5753
|
+
* marker (wakes requeue, and a write meanwhile is stored at once and
|
|
5754
|
+
* kept out of the window until the agent's next presentation point, the
|
|
5755
|
+
* puppet's end), so a wake landing during the tool's execution cannot
|
|
5756
|
+
* start a turn underneath the pair.
|
|
4677
5757
|
* - Refused for tools outside the agent's own surface (the tools it may
|
|
4678
5758
|
* call, availableToolsForPresentation), and for skip_reply, by name or
|
|
4679
5759
|
* through a toolsets--act that reaches it, which ends the turn it's
|
|
@@ -5149,48 +6229,64 @@ export declare class AgentFramework {
|
|
|
5149
6229
|
private dispatchToolCall;
|
|
5150
6230
|
private dispatchToolCallEvent;
|
|
5151
6231
|
private addMessage;
|
|
6232
|
+
/**
|
|
6233
|
+
* The agents a write's placement may name (addMessage's out-param,
|
|
6234
|
+
* #291), never none: its delivery agent, or, for a write stored in that
|
|
6235
|
+
* agent's slot for other agents only (its stamp names them and not it,
|
|
6236
|
+
* as a coalesced render targeted to a co-resident is: inboundAudience),
|
|
6237
|
+
* those of them whose own slot it is. The placement names one agent,
|
|
6238
|
+
* whose store the coalescer reads the row in and removes it from
|
|
6239
|
+
* (isUnreadPlacement, removePlacement), whose wake reads it, and to whom
|
|
6240
|
+
* `presented` refers: the first of these the write wasn't presented to,
|
|
6241
|
+
* else the first. An agent that only observes the slot (the subconscious
|
|
6242
|
+
* over the residents' slot) has no copy of the row in its own store, so
|
|
6243
|
+
* a write for such agents alone is placed for the delivery agent, as
|
|
6244
|
+
* before.
|
|
6245
|
+
*/
|
|
6246
|
+
private placementReaders;
|
|
5152
6247
|
/**
|
|
5153
6248
|
* Whether an MCPL event's own stored entry is the newest entry in the window
|
|
5154
|
-
* a batched wake's line is written to
|
|
5155
|
-
*
|
|
5156
|
-
*
|
|
5157
|
-
*
|
|
5158
|
-
*
|
|
5159
|
-
*
|
|
5160
|
-
*
|
|
6249
|
+
* a batched wake's line is written to, with no turn alive there (turnAlive:
|
|
6250
|
+
* started, streaming, or waiting on its tools): the window of each agent a
|
|
6251
|
+
* targeted event was delivered to (`recipients`), else the delivery
|
|
6252
|
+
* agent's (deliveryAgent(): the primary's). The gate then hands the line to
|
|
6253
|
+
* the wake (WakeLine) instead of writing it, and the turn's start decides
|
|
6254
|
+
* it (placeWakeLines). A channel message is found by its server, channel
|
|
6255
|
+
* and message id, a push event by its server and event id. A message a
|
|
6256
|
+
* tune-out holds from the residents is never "newest" here.
|
|
5161
6257
|
*/
|
|
5162
6258
|
private isNewestContextEntry;
|
|
5163
6259
|
/**
|
|
5164
6260
|
* Write the batched-wake lines the gate left to this turn's start (WakeLine)
|
|
5165
|
-
* into the
|
|
5166
|
-
*
|
|
5167
|
-
*
|
|
5168
|
-
*
|
|
5169
|
-
*
|
|
5170
|
-
*
|
|
5171
|
-
* notice among them), and before the agent's answer to the wake.
|
|
6261
|
+
* into the starting agent's own window, as its own rows (#291). Called by
|
|
6262
|
+
* a fresh start that doesn't resume a logical turn, after the turn's own
|
|
6263
|
+
* inputs (a due clock row, and the rows its start presents) and before its
|
|
6264
|
+
* checkpoint, so a line lands after whatever entered the window since the
|
|
6265
|
+
* gate's decision, before the notices the turn's start writes itself (the
|
|
6266
|
+
* locus notice among them), and before the agent's answer to the wake.
|
|
5172
6267
|
*
|
|
5173
|
-
* - A wake's one line whose event is still the newest entry
|
|
5174
|
-
* no message follows the wake's, so it is
|
|
5175
|
-
*
|
|
5176
|
-
*
|
|
5177
|
-
* be meant
|
|
5178
|
-
*
|
|
5179
|
-
*
|
|
5180
|
-
*
|
|
5181
|
-
*
|
|
5182
|
-
*
|
|
5183
|
-
*
|
|
5184
|
-
*
|
|
6268
|
+
* - A wake's one line whose event is still the newest entry of the
|
|
6269
|
+
* agent's window is left out: no message follows the wake's, so it is
|
|
6270
|
+
* the wake's whole cause, and an arrival stored past the start enters
|
|
6271
|
+
* the window at a later point, after its request. (The start's own
|
|
6272
|
+
* notices, written after this, aren't messages a reply could be meant
|
|
6273
|
+
* for.)
|
|
6274
|
+
* - Each resident a batched wake is for (every resident, or a targeted
|
|
6275
|
+
* batch's recipients) gets it, and each one's start
|
|
6276
|
+
* decides and writes its own line: a co-resident's line, and her reply,
|
|
6277
|
+
* are her own rows and enter no other window but an observer's
|
|
6278
|
+
* (AgentConfig.observes), which takes them as it takes her rounds; in
|
|
6279
|
+
* no other can either land under the message or after another
|
|
6280
|
+
* resident's answer. For an agent whose
|
|
6281
|
+
* window isn't presented (its write-down failed, so its window is the
|
|
6282
|
+
* record), only the delivery agent's start writes the slot's one line,
|
|
6283
|
+
* and a co-resident's start places nothing.
|
|
5185
6284
|
* - Two or more lines are all written, each naming its message, its age
|
|
5186
6285
|
* counted to now.
|
|
5187
|
-
* - None is written while the host is quiesced
|
|
5188
|
-
*
|
|
5189
|
-
*
|
|
5190
|
-
*
|
|
5191
|
-
* (overlapping turns in the slot, #286). They stay undecided, and are
|
|
5192
|
-
* written only if another fresh start of the wake comes (a provider
|
|
5193
|
-
* hold's release, a requeue): this start's request goes without them.
|
|
6286
|
+
* - None is written while the host is quiesced, as for a clock row. They
|
|
6287
|
+
* stay undecided, and are written only if another fresh start of the
|
|
6288
|
+
* wake comes (a provider hold's release, a requeue): this start's
|
|
6289
|
+
* request goes without them.
|
|
5194
6290
|
*
|
|
5195
6291
|
* A line left out is traced. Each line is written once (placedWakeLines),
|
|
5196
6292
|
* across the wake's retries and holds, whichever copy of its trigger a
|
|
@@ -5202,41 +6298,88 @@ export declare class AgentFramework {
|
|
|
5202
6298
|
* clock rows, stored context injections and rows the agent's own view
|
|
5203
6299
|
* leaves out after it aside: a channel message by its server, channel and
|
|
5204
6300
|
* message id, a push event by its server and event id, and never one the
|
|
5205
|
-
* agent's view leaves out, such as one a tune-out holds. Past
|
|
5206
|
-
* NEWEST_SCAN_ROWS such rows, it answers no.
|
|
6301
|
+
* agent's view leaves out (agentSees), such as one a tune-out holds. Past
|
|
6302
|
+
* NEWEST_SCAN_ROWS such rows, it answers no. While the agent's context
|
|
6303
|
+
* is in legacy mode, its window is the slot's record, read from its
|
|
6304
|
+
* newest row. Once it presents rows (#291), the window's own order
|
|
6305
|
+
* decides, as the agent's next request will hold it (windowTail): the
|
|
6306
|
+
* rows presented to it, then its own rows and its arrivals not presented
|
|
6307
|
+
* yet (bearingOf), an observed co-resident's rounds among them, which its
|
|
6308
|
+
* next start presents; a row stored in a shared slot for another agent,
|
|
6309
|
+
* such as the own round of a co-resident it doesn't observe, isn't in
|
|
6310
|
+
* it. */
|
|
5207
6311
|
private isNewestIn;
|
|
6312
|
+
/**
|
|
6313
|
+
* The newest `limit` rows of a presented window as the agent's next
|
|
6314
|
+
* request will hold them, newest first: the rows it is owed and not
|
|
6315
|
+
* presented yet (its own rows and its arrivals, one per body, as the
|
|
6316
|
+
* presentation index reads them: owedOf, so an observed co-resident's
|
|
6317
|
+
* round is among them), after the rows its window holds. A row presented
|
|
6318
|
+
* later than a newer one comes after it here, as in the window.
|
|
6319
|
+
*/
|
|
6320
|
+
private windowTail;
|
|
5208
6321
|
/** Where addMessage delivers: the named agent, else the primary, else the
|
|
5209
6322
|
* first registered agent. Undefined when there is no such agent. */
|
|
5210
6323
|
private deliveryAgent;
|
|
6324
|
+
/**
|
|
6325
|
+
* The audience addMessage stamps a write with when its caller gives none
|
|
6326
|
+
* (#291): for one a suppress rule took (suppressedRow), nobody, as no view
|
|
6327
|
+
* renders it; for one that carries a tune-out's hold, nobody, since no
|
|
6328
|
+
* resident is shown it (inboundAudience), unless it names an agent whose
|
|
6329
|
+
* own view keeps it (agentSees, main's #853: the subconscious, whose view
|
|
6330
|
+
* keeps held traffic), which it is for; the agent a write names
|
|
6331
|
+
* (`forAgent`); and for a write that names no agent, untargetedAudience
|
|
6332
|
+
* of the agent it is delivered to. Undefined only for that last on a
|
|
6333
|
+
* host with no agent, where addMessage stores nothing. Restore stamps an
|
|
6334
|
+
* entry an earlier version queued by the same rule
|
|
6335
|
+
* (restorePersistedDeferredWrites).
|
|
6336
|
+
*/
|
|
6337
|
+
private defaultAudience;
|
|
6338
|
+
/**
|
|
6339
|
+
* Who a write that names no agent is for (#291's audience stamp): the
|
|
6340
|
+
* agents whose role takes untargeted inbound (the registry's
|
|
6341
|
+
* untargetedRecipients) and whose own slot is the slot the write lands
|
|
6342
|
+
* in, its delivery agent's, in registration order. On a residents' host
|
|
6343
|
+
* that is every resident, as every resident reads the shared slot the
|
|
6344
|
+
* row is stored in; with one resident it is that resident, the stamp such
|
|
6345
|
+
* a write had before. The delivery agent alone when there is none: a host
|
|
6346
|
+
* whose only agent is an ephemeral run, or an agent the registry doesn't
|
|
6347
|
+
* place. This is the rule #291's presentation index presents an
|
|
6348
|
+
* untargeted row in the shared slot by, applied when the row is written,
|
|
6349
|
+
* so the record tells an untargeted write from one for the primary,
|
|
6350
|
+
* which is stamped with the primary alone. The slot's observers (the
|
|
6351
|
+
* subconscious) aren't in it: they are a relationship in the registry
|
|
6352
|
+
* (dendrite/audience.ts).
|
|
6353
|
+
*/
|
|
6354
|
+
private untargetedAudience;
|
|
6355
|
+
/** A message was said to `agentName` (main's #846): the re-send count of
|
|
6356
|
+
* its exhausted turn starts again, unless its own view leaves the
|
|
6357
|
+
* message out (agentSees), it is the agent's own schedule write, or it
|
|
6358
|
+
* isn't conversation. */
|
|
5211
6359
|
private noteSpokenTo;
|
|
5212
|
-
/** The notes addMessage takes for a message it stored
|
|
5213
|
-
*
|
|
5214
|
-
*
|
|
5215
|
-
*
|
|
6360
|
+
/** The notes addMessage takes for a message it stored. Each agent it is
|
|
6361
|
+
* for was spoken to (noteSpokenTo): the agents its audience stamp names
|
|
6362
|
+
* (#291), which for a write that names no agent are the residents that
|
|
6363
|
+
* take untargeted inbound in its slot, as main notes every other
|
|
6364
|
+
* resident (noteForOtherResidents there), and the agent it was delivered
|
|
6365
|
+
* to where it carries no stamp. And for an agent whose window isn't
|
|
6366
|
+
* presented (a write-down of it failed), whose window is the record: an
|
|
6367
|
+
* arrival for its open turn when none of its turns is alive or its start
|
|
6368
|
+
* is assembling (no tool boundary will weigh it). An agent the
|
|
6369
|
+
* presentation index presents for weighs the row as it enters its window
|
|
6370
|
+
* (adoptPresentation's listener), or at the tool boundary that hears it,
|
|
6371
|
+
* not here. */
|
|
5216
6372
|
private noteStored;
|
|
5217
6373
|
/**
|
|
5218
6374
|
* Held agent mail is released only when its message has actually entered
|
|
5219
|
-
* the recipient's store
|
|
5220
|
-
*
|
|
5221
|
-
*
|
|
5222
|
-
*
|
|
6375
|
+
* the recipient's store, as a copy for that recipient — never while a
|
|
6376
|
+
* surgery's hold, or the wait for the recipient's recovery, keeps the
|
|
6377
|
+
* write in memory. Called where the framework stores a
|
|
6378
|
+
* message (addMessage, and the importer's lookup of a write that landed).
|
|
6379
|
+
* Both writes reach disk in the same sync, so a crash keeps either both or
|
|
6380
|
+
* neither.
|
|
5223
6381
|
*/
|
|
5224
6382
|
private releaseLandedMail;
|
|
5225
|
-
/**
|
|
5226
|
-
* Splice out the deferred messages addressed to `agentName` (explicitly
|
|
5227
|
-
* via forAgent, or implicitly when it is the primary), leaving other
|
|
5228
|
-
* targets' messages queued for their own boundaries. With `stopAt`, the
|
|
5229
|
-
* drain ends at the first of them (in queue order) that it matches: that
|
|
5230
|
-
* message and every later one stay queued, so what is drained is always a
|
|
5231
|
-
* prefix of the agent's queue.
|
|
5232
|
-
*/
|
|
5233
|
-
private drainDeferredFor;
|
|
5234
|
-
/**
|
|
5235
|
-
* Put drained entries back into the queue under their ids and seq: out of
|
|
5236
|
-
* the un-acked set, and persisted when the queue is. A memory-only queue
|
|
5237
|
-
* keeps them while the framework runs.
|
|
5238
|
-
*/
|
|
5239
|
-
private requeueDrained;
|
|
5240
6383
|
/**
|
|
5241
6384
|
* What the next compile sends for each of `ids`, messages a tool boundary
|
|
5242
6385
|
* has just stored, as the agent's strategy renders them as the newest of
|
|
@@ -5250,110 +6393,9 @@ export declare class AgentFramework {
|
|
|
5250
6393
|
* strategies could say.
|
|
5251
6394
|
*/
|
|
5252
6395
|
private renderForInjection;
|
|
5253
|
-
/**
|
|
5254
|
-
* Write drained entries in queue (seq) order, whatever their targets:
|
|
5255
|
-
* residents share one message slot, so the order entries arrived in is the
|
|
5256
|
-
* order they're stored. Each target is cut at its own first entry that
|
|
5257
|
-
* can't be stored: that entry and every later one for the same target go
|
|
5258
|
-
* back into the queue under their ids and seq (requeueDrained) before
|
|
5259
|
-
* anything is logged, and other targets' entries go on. Left in the
|
|
5260
|
-
* un-acked set, the next ack would drop them from the durable queue.
|
|
5261
|
-
*
|
|
5262
|
-
* So none of a target's entries lands ahead of an earlier one, and a queued
|
|
5263
|
-
* tool_use that can't be stored keeps the tool_result queued behind it from
|
|
5264
|
-
* being stored alone, unless context-manager refused it as malformed
|
|
5265
|
-
* (below). (A tool_use that is stored, followed by a tool_result that
|
|
5266
|
-
* can't be, stays stored without it until the tool_result lands at a later
|
|
5267
|
-
* flush, or for good when the store refuses the tool_result as malformed.
|
|
5268
|
-
* The only queued pair is puppetToolCall's, queued only when its turn's
|
|
5269
|
-
* token is no longer its own once the pair is built, which its comment
|
|
5270
|
-
* calls defensive.) An entry that keeps failing is logged by id at each
|
|
5271
|
-
* flush, and holds its target's later queued writes rather than letting
|
|
5272
|
-
* them land out of order.
|
|
5273
|
-
*
|
|
5274
|
-
* An entry context-manager refuses as malformed (MalformedContentError) is
|
|
5275
|
-
* the exception for the store's own validation: context-manager checks
|
|
5276
|
-
* content and every shard before writing. A custom synchronous strategy
|
|
5277
|
-
* hook can throw the same class after append (context-manager #288);
|
|
5278
|
-
* unreadable landing in that callback escape remains a limitation until
|
|
5279
|
-
* the CM follow-up lands. A copy actually found still counts first. Other
|
|
5280
|
-
* ambiguous errors remain queued for ID reconciliation before retry. A
|
|
5281
|
-
* malformed refusal would fail every flush and hold its target's later
|
|
5282
|
-
* writes for good, so it's logged and dropped instead, and its
|
|
5283
|
-
* target isn't cut: left in the un-acked set, the next ack drops it from
|
|
5284
|
-
* the durable queue. A tool_use dropped this way leaves a tool_result
|
|
5285
|
-
* queued behind it to be stored alone. context-manager mends a tool_use
|
|
5286
|
-
* whose input isn't an object, so it refuses one only when that input has
|
|
5287
|
-
* no JSON form or the block itself is malformed. addMessage refuses such
|
|
5288
|
-
* content before it's queued, so an entry meets this here from a queue an
|
|
5289
|
-
* earlier process persisted, as puppetToolCall's pair, which it queues
|
|
5290
|
-
* itself, or when the strategy's chunking splits well-formed content into a
|
|
5291
|
-
* shard the store refuses, which the store's error names.
|
|
5292
|
-
*
|
|
5293
|
-
* From a fresh turn's start to the end of its coalescing assembly, before
|
|
5294
|
-
* its checkpoint, every write deferred for its agent lands in that
|
|
5295
|
-
* request, in arrival order, up to one that can't be stored and unless the
|
|
5296
|
-
* host is quiesced (flushForStart). The turn-start flush writes the queue;
|
|
5297
|
-
* while the assembly runs, each write it makes into the agent's own window
|
|
5298
|
-
* (addMessage's bypassDeferralFor) first writes what was deferred since;
|
|
5299
|
-
* and what was deferred during the assembly is written once it ends. A
|
|
5300
|
-
* write the assembly makes while an entry is held waits behind it in the
|
|
5301
|
-
* queue, so the hold covers the assembly's writes too, and so does one
|
|
5302
|
-
* made while the host is quiesced with anything queued for the agent: a
|
|
5303
|
-
* quiesce that begins while an assembly awaits a render lets that turn
|
|
5304
|
-
* drain, and what is queued waits for resume(). Outside that window the
|
|
5305
|
-
* hold is the queue's alone: a write that isn't deferred is stored at once
|
|
5306
|
-
* and can land ahead of a held entry, as a fresh tool_result does whatever
|
|
5307
|
-
* its agent's state, and any write does while its agent's turn, stream and
|
|
5308
|
-
* tool cycle are all idle and the host isn't quiesced. So an entry that
|
|
5309
|
-
* keeps failing holds what is deferred behind it and the assembly's writes
|
|
5310
|
-
* for its agent.
|
|
5311
|
-
*
|
|
5312
|
-
* A write can throw after its message is stored: a store listener, the
|
|
5313
|
-
* strategy's handling of the add, or a later shard of a sharded body can
|
|
5314
|
-
* throw once a record is written. Before an entry that threw is put back,
|
|
5315
|
-
* its target's store is read from where it stood before the write, for
|
|
5316
|
-
* messages carrying the entry's `deferredWriteId`. What it finds counts as
|
|
5317
|
-
* written, at most once: the entry isn't requeued and stored a second
|
|
5318
|
-
* time, and what landed, as later compiles render it (asCompiled), is what
|
|
5319
|
-
* it returns as the entry's content. For a sharded body, that can be its
|
|
5320
|
-
* first shards alone if rollback could not remove them; context-manager
|
|
5321
|
-
* from 0.15 otherwise removes shards from a failed append. (Requeued, the
|
|
5322
|
-
* landed shards would be stored twice, and only the rest could not be
|
|
5323
|
-
* appended later without splitting the body.) Boot's scan for landed
|
|
5324
|
-
* writes counts a landed shard the same way. When the store can't be read
|
|
5325
|
-
* back (storedCopiesOf logs it), or couldn't say how many messages it held
|
|
5326
|
-
* before the write, the store is searched for the entry's id at once
|
|
5327
|
-
* (landedCopiesById): found, it counts as written, as above. When that
|
|
5328
|
-
* can't be done either, whether the entry landed is unknown: it's put back
|
|
5329
|
-
* marked so (`landing`), and before it's written again the store is
|
|
5330
|
-
* searched for its id. Found then, it counts as written where it was
|
|
5331
|
-
* stored, ahead of what was stored since without it, a known limit
|
|
5332
|
-
* (context-manager #155, named at the tool boundary's drain); not found,
|
|
5333
|
-
* it's written. While the store can't be searched, it stays queued,
|
|
5334
|
-
* holding what's behind it.
|
|
5335
|
-
*
|
|
5336
|
-
* Returns what was written (stored, or deferred again by addMessage, whose
|
|
5337
|
-
* id is then empty), in queue order: for one target, its entries up to the
|
|
5338
|
-
* first that couldn't be stored, less entries refused as malformed and dropped. Each comes
|
|
5339
|
-
* with its content: as given, unless the store took it as more than one
|
|
5340
|
-
* message (a sharded body) and can be read back, when its copies are
|
|
5341
|
-
* returned joined, as later compiles render them (asCompiled), or its write
|
|
5342
|
-
* threw after storing it (above). `onLanded` hears an entry whose write
|
|
5343
|
-
* threw after storing it, with the id it landed under, as soon as it's
|
|
5344
|
-
* found: before the writes after it, so whatever it records keeps their
|
|
5345
|
-
* order.
|
|
5346
|
-
*/
|
|
5347
|
-
private writeDrainedInOrder;
|
|
5348
6396
|
/** How many messages the agent's store holds: undefined when its store
|
|
5349
6397
|
* can't say. */
|
|
5350
6398
|
private storedCountOf;
|
|
5351
|
-
/** The messages carrying `deferredWriteId` among those the agent's store
|
|
5352
|
-
* gained from position `from` on, in store order, with their blobs
|
|
5353
|
-
* resolved, as a request carries them. A sharded body's carry its
|
|
5354
|
-
* `bodyGroupId`. Undefined when the store can't be read back, which is
|
|
5355
|
-
* logged: not the same as nothing found. */
|
|
5356
|
-
private storedCopiesOf;
|
|
5357
6399
|
/** The messages `match` picks among those the agent's store gained from
|
|
5358
6400
|
* position `from` on, in store order, with their blobs resolved. Undefined
|
|
5359
6401
|
* when the store can't be read back, which is logged under `tag`, naming
|
|
@@ -5369,66 +6411,41 @@ export declare class AgentFramework {
|
|
|
5369
6411
|
* is absent, and a write taken as absent is stored again.
|
|
5370
6412
|
*/
|
|
5371
6413
|
private landedPositions;
|
|
6414
|
+
/** The rows on `cm`'s current branch whose metadata `match` picks, by
|
|
6415
|
+
* position and id, in store order, scanned as landedPositions says: in
|
|
6416
|
+
* blob-free windows, throwing where a window can't be read or comes back
|
|
6417
|
+
* short. */
|
|
6418
|
+
private rowsWhere;
|
|
6419
|
+
/**
|
|
6420
|
+
* The rows of the coalesced occurrence `metadata` is a delivery of (its
|
|
6421
|
+
* `coalescingSubject` and `eventId`, the delivery identity wasPublished
|
|
6422
|
+
* reads at a restore) that `agent`'s store holds on its current branch, in
|
|
6423
|
+
* store order: [] for none, or for a write that carries no such identity.
|
|
6424
|
+
* A delivery's recovery reads them before it stores the occurrence again
|
|
6425
|
+
* (FrameworkWriteOptions.mayBeStored), after a delivery whose store
|
|
6426
|
+
* couldn't tell whether it landed: context-manager gives the row of an
|
|
6427
|
+
* append that threw no id, so it is found by what it carries, as
|
|
6428
|
+
* findMessageByExternalId finds a module's write. Scanned blob-free
|
|
6429
|
+
* (rowsWhere), so a blob missing from some row can't hide them. Undefined
|
|
6430
|
+
* when the store can't be read to tell, which is logged, naming the
|
|
6431
|
+
* occurrence and the duplicate its store may then make: the one case the
|
|
6432
|
+
* recovery can't tell.
|
|
6433
|
+
*/
|
|
6434
|
+
private storedOccurrenceRows;
|
|
5372
6435
|
/**
|
|
5373
6436
|
* The messages carrying `deferredWriteId` anywhere on the agent's current
|
|
5374
6437
|
* branch, in store order with their blobs resolved, as a request carries
|
|
5375
|
-
* them, so no position is needed
|
|
5376
|
-
*
|
|
5377
|
-
*
|
|
5378
|
-
*
|
|
5379
|
-
*
|
|
5380
|
-
*
|
|
5381
|
-
*
|
|
5382
|
-
*
|
|
5383
|
-
*
|
|
6438
|
+
* them, so no position is needed: where an earlier release's queued write
|
|
6439
|
+
* whose landing it couldn't tell may have landed (the importer's lookup).
|
|
6440
|
+
* They're found with queryMessages, over context-manager's cached view,
|
|
6441
|
+
* as landedRow finds a held write's row. Where that throws, as one blob
|
|
6442
|
+
* missing anywhere on the branch makes it do, the branch is scanned
|
|
6443
|
+
* blob-free instead (landedPositions), and only the rows that match are
|
|
6444
|
+
* read with their blobs. Undefined when the store can be searched neither
|
|
6445
|
+
* way, or the scan finds the write's rows but one of them can't be read,
|
|
6446
|
+
* which is logged.
|
|
5384
6447
|
*/
|
|
5385
6448
|
private landedCopiesById;
|
|
5386
|
-
/** The line naming a drained write that threw: one that couldn't be stored,
|
|
5387
|
-
* which is already back in the queue; with 'dropped', a malformed refusal
|
|
5388
|
-
* from the store's pre-write validation (see the CM #288 caveat above);
|
|
5389
|
-
* with a count, one stored before the
|
|
5390
|
-
* throw (for a sharded body, how many of its shards), or, with
|
|
5391
|
-
* `foundLater`, one an earlier write of which landed and was found by its
|
|
5392
|
-
* id; with `'unknown'`, one whose store couldn't be read to tell
|
|
5393
|
-
* whether it landed, back in the queue to be looked up first; and with
|
|
5394
|
-
* `'still-unknown'`, one that still can't be looked up. Logging mustn't
|
|
5395
|
-
* fail the flush that met it, so a thrown value that has no text is
|
|
5396
|
-
* named as such. */
|
|
5397
|
-
private logDeferredWriteError;
|
|
5398
|
-
/**
|
|
5399
|
-
* Write what is queued for `agent` into its window past its deferral, in
|
|
5400
|
-
* queue order and cut at a write that fails, though one the store refuses
|
|
5401
|
-
* as malformed is dropped and what follows goes on (writeDrainedInOrder),
|
|
5402
|
-
* between a fresh turn's start and its checkpoint, where what is stored is
|
|
5403
|
-
* the turn's input: at the start, before each write the coalescing
|
|
5404
|
-
* assembly makes for the agent, and once the assembly ends, the last two
|
|
5405
|
-
* not while the host is quiesced, when what is queued waits for resume().
|
|
5406
|
-
* What is stored is weighed for the start now beginning and for every
|
|
5407
|
-
* other resident's open turn. Returns whether anything is still queued for
|
|
5408
|
-
* the agent.
|
|
5409
|
-
*/
|
|
5410
|
-
private flushForStart;
|
|
5411
|
-
/** Whether anything is queued for `agentName`, by drainDeferredFor's
|
|
5412
|
-
* target rule. */
|
|
5413
|
-
private queuedFor;
|
|
5414
|
-
/** Re-add drained entries through addMessage, which stores each or defers
|
|
5415
|
-
* it again, in queue order and cut per target (writeDrainedInOrder). With
|
|
5416
|
-
* `bypassDeferral`, each is stored past its target's deferral (stop()). A
|
|
5417
|
-
* write that threw after storing missed the notes addMessage takes after a
|
|
5418
|
-
* store, so they're taken for what landed as soon as it's found, before
|
|
5419
|
-
* the writes after it: an open turn's arrivals keep the order the writes
|
|
5420
|
-
* landed in, and its newest stays the newest (remainingArrival).
|
|
5421
|
-
*
|
|
5422
|
-
* A target no longer registered (a fork or a run that has ended, here or
|
|
5423
|
-
* before a crash) has no window to land in: a failed reply queued for it,
|
|
5424
|
-
* or a channel notice it could have acted on, becomes the primary's
|
|
5425
|
-
* by-name notice, and a module's write for a run or a fork goes to it as
|
|
5426
|
-
* written, each under the entry's own id and place in the queue
|
|
5427
|
-
* (passesToPrimary, queuedNoticeForPrimary), written with the rest; any
|
|
5428
|
-
* other write is dropped, logged, by addMessage. Nothing here reads the gone agent's
|
|
5429
|
-
* window, so such a notice an earlier write of which landed there, and
|
|
5430
|
-
* which the agent read, goes on too. */
|
|
5431
|
-
private readdDrained;
|
|
5432
6449
|
/**
|
|
5433
6450
|
* Where a notice about an agent's own action belongs: its failed reply, its
|
|
5434
6451
|
* bounced prose (beside its `{{unsent}}` clipboard), its script's wake, the
|
|
@@ -5437,8 +6454,9 @@ export declare class AgentFramework {
|
|
|
5437
6454
|
* waits on that agent's own turn, stream and tool cycle: a conversation
|
|
5438
6455
|
* fork or an ephemeral run reads only its isolated slot, and a resident's
|
|
5439
6456
|
* notice would otherwise wait on the primary's turn rather than its own.
|
|
5440
|
-
* Residents share one message slot, so a resident's notice can
|
|
5441
|
-
* while another resident's turn is alive;
|
|
6457
|
+
* Residents share one message slot, so a resident's notice can be stored
|
|
6458
|
+
* there while another resident's turn is alive; since #291 it is for its
|
|
6459
|
+
* agent alone, and enters no other resident's window.
|
|
5442
6460
|
*
|
|
5443
6461
|
* null when the agent is no longer registered (a fork or a run already
|
|
5444
6462
|
* released): there is no window to write, so the caller writes nothing,
|
|
@@ -5452,81 +6470,65 @@ export declare class AgentFramework {
|
|
|
5452
6470
|
/**
|
|
5453
6471
|
* A conversation fork or an ephemeral run has been deregistered. A release
|
|
5454
6472
|
* never runs while the host is quiesced: it waits for resume()
|
|
5455
|
-
* (releaseWindowNowOrAfterResume),
|
|
6473
|
+
* (releaseWindowNowOrAfterResume), or, when stop() comes first, stop()
|
|
6474
|
+
* runs it.
|
|
5456
6475
|
*
|
|
5457
6476
|
* The agent never reads its window again, so every failed-reply notice it
|
|
5458
6477
|
* never read, and every channel notice it could act on and never read, is
|
|
5459
6478
|
* passed to the primary, by name, once, and so is every module write for
|
|
5460
6479
|
* it that it never read, as the write itself (passesToPrimary,
|
|
5461
|
-
*
|
|
5462
|
-
*
|
|
5463
|
-
*
|
|
5464
|
-
*
|
|
5465
|
-
*
|
|
5466
|
-
*
|
|
5467
|
-
*
|
|
5468
|
-
*
|
|
5469
|
-
*
|
|
5470
|
-
*
|
|
5471
|
-
*
|
|
5472
|
-
*
|
|
5473
|
-
*
|
|
5474
|
-
*
|
|
5475
|
-
*
|
|
5476
|
-
* or cancelled, or, when stop() ends it, may still run past its cancel, and
|
|
5477
|
-
* then drops each event that comes after the agent has left (driveStream);
|
|
5478
|
-
* a turn of its still assembling or compiling, as when stop() ends it,
|
|
5479
|
-
* drops before it sends anything. One path still stores after these
|
|
5480
|
-
* writes: a `complete` that arrived while the agent still waited for tools
|
|
5481
|
-
* awaits the spill of its last tool results, and stores them once that
|
|
5482
|
-
* resolves, even if a watchdog has ended the run meanwhile. A tool boundary
|
|
6480
|
+
* passNoticeToPrimary): each one stored in its store for it, not for its
|
|
6481
|
+
* parent or a co-resident whose record it shares, and not covered by its
|
|
6482
|
+
* consumed watermark (releasedWindow): presented at its turn's end and
|
|
6483
|
+
* never consumed, stored while it was idle, or never presented. A message
|
|
6484
|
+
* a tool boundary injected is covered once its stream says it carried it.
|
|
6485
|
+
* Its stream is over or cancelled, or, when stop() ends it, may still run
|
|
6486
|
+
* past its cancel, and then drops each event that comes after the agent
|
|
6487
|
+
* has left (driveStream); a turn of its still assembling or compiling, as
|
|
6488
|
+
* when stop() ends it, drops before it sends anything. One path can still
|
|
6489
|
+
* store after the release: a `complete` that arrived while the agent
|
|
6490
|
+
* still waited for tools awaits the spill of its last tool results, and
|
|
6491
|
+
* stores them once that resolves unless the agent's state was replaced
|
|
6492
|
+
* meanwhile, as a run's disposal by its watchdog or its caller replaces it,
|
|
6493
|
+
* or stop() or a quiesce's abandon cancelled its stream
|
|
6494
|
+
* (roundStoppedDuringBuild): then it stores nothing, as a tool boundary
|
|
5483
6495
|
* stores nothing for a round whose turn was stopped while its results were
|
|
5484
|
-
* prepared.
|
|
6496
|
+
* prepared. The agent's store stays in Chronicle for investigation.
|
|
5485
6497
|
*/
|
|
5486
6498
|
private releaseWindow;
|
|
5487
6499
|
/**
|
|
5488
|
-
*
|
|
5489
|
-
*
|
|
5490
|
-
*
|
|
5491
|
-
* its place (passesToPrimary: a failed reply, a channel notice its reader
|
|
5492
|
-
* could act on, or a module's write for a run or a fork, which goes as
|
|
5493
|
-
* the write itself) goes on as stored, by name (passNoticeToPrimary),
|
|
5494
|
-
* except a copy of an entry for it still in the durable queue, pending or
|
|
5495
|
-
* un-acked: that entry is the notice's one identity until its ack, the one
|
|
5496
|
-
* boot's check for landed writes knows, so it's the entry that goes on, as
|
|
5497
|
-
* the primary's by-name notice under its own id and seq (`passOn`,
|
|
5498
|
-
* queuedNoticeForPrimary), and a crash before the ack replays it once, not
|
|
5499
|
-
* twice. A queued notice goes on unless the agent read a copy of it that
|
|
5500
|
-
* landed in its window; where the window can't be read, it goes on, since
|
|
5501
|
-
* telling the primary of a notice the agent may have read costs less than
|
|
5502
|
-
* telling no one. Both callers run this before their drain, which hands
|
|
5503
|
-
* pending entries to the un-acked set, so the un-acked entries for the
|
|
5504
|
-
* agent here have all landed (their write went through, or a lookup found
|
|
5505
|
-
* it: settleFound), and they go on here; the pending ones are the
|
|
5506
|
-
* caller's. Returns the window's read, `passOn`, what it has queued so far
|
|
5507
|
-
* for the primary, and how many un-acked entries the agent had.
|
|
5508
|
-
*/
|
|
5509
|
-
private passOnFromReleasedWindow;
|
|
5510
|
-
/**
|
|
5511
|
-
* What a released agent's window holds that its pass to the primary reads
|
|
5512
|
-
* (passOnFromReleasedWindow): `unread`, the notices stored there that it
|
|
5513
|
-
* never read and the primary takes in its place (passesToPrimary: its
|
|
6500
|
+
* What a released agent's window holds that its release passes to the
|
|
6501
|
+
* primary (releaseWindow): `unread`, the notices stored there for it that
|
|
6502
|
+
* it never read and the primary takes in its place (passesToPrimary: its
|
|
5514
6503
|
* failed replies, the channel notices it was told it could act on, and a
|
|
5515
6504
|
* run's or a fork's module writes), each with its participant and
|
|
5516
6505
|
* content, a sharded body's shards joined into one text, as the
|
|
5517
|
-
* autobiographical strategy joins them (asCompiled)
|
|
5518
|
-
*
|
|
5519
|
-
*
|
|
5520
|
-
*
|
|
5521
|
-
*
|
|
5522
|
-
*
|
|
5523
|
-
*
|
|
5524
|
-
*
|
|
6506
|
+
* autobiographical strategy joins them (asCompiled). A notice is for it
|
|
6507
|
+
* when the audience rule doesn't put it elsewhere (bearingOf, with the
|
|
6508
|
+
* facts the registry recorded for it when its release was asked for:
|
|
6509
|
+
* releasedReaders): its own row, a row whose audience names it, or a row
|
|
6510
|
+
* with no stamp stored after a shared fork's derivation point. Its store
|
|
6511
|
+
* may be a record it shares: a shared fork reads its parent's slot on a
|
|
6512
|
+
* branch of its own, and a resident reads the slot every resident
|
|
6513
|
+
* writes. A notice there for its parent or a co-resident never entered
|
|
6514
|
+
* its window, and is that agent's to read, or to pass on at its own
|
|
6515
|
+
* release: passed on here, it would reach the primary again at each such
|
|
6516
|
+
* release, in this agent's name. A notice for it is read
|
|
6517
|
+
* when the agent's consumed watermark covers it (covers): once its context
|
|
6518
|
+
* presents rows (#291), when it was in the agent's window as of the mark,
|
|
6519
|
+
* so a notice never presented to it, or presented and never consumed, is
|
|
6520
|
+
* unread; for an agent whose window isn't presented, when it is at or
|
|
6521
|
+
* below the mark, or, for a mark on another branch, at or below the lower
|
|
6522
|
+
* of the mark and the point where the two branches part (branchesPartAt).
|
|
6523
|
+
* A mark taken in presented mode can't say on another branch, and there,
|
|
6524
|
+
* as everywhere for an agent with no watermark, every notice is unread.
|
|
6525
|
+
* The watermark is set when the agent is created, and moves at a compile,
|
|
6526
|
+
* and at a tool boundary whose stream declares it carries the messages
|
|
5525
6527
|
* injected there (markContextConsumed). So a notice such a stream carried
|
|
5526
|
-
* is under it. One a boundary
|
|
5527
|
-
* a budget restart, the direct API's boundary, which has no stream)
|
|
5528
|
-
* above it until a compile sends it, and counts as unread. null when
|
|
5529
|
-
* window can't be read, which is logged.
|
|
6528
|
+
* is under it. One a boundary presented without sending (a turn a tool
|
|
6529
|
+
* ended, a budget restart, the direct API's boundary, which has no stream)
|
|
6530
|
+
* is above it until a compile sends it, and counts as unread. null when
|
|
6531
|
+
* the window can't be read, which is logged.
|
|
5530
6532
|
*/
|
|
5531
6533
|
private releasedWindow;
|
|
5532
6534
|
/**
|
|
@@ -5540,15 +6542,16 @@ export declare class AgentFramework {
|
|
|
5540
6542
|
private branchesPartAt;
|
|
5541
6543
|
/**
|
|
5542
6544
|
* Release a deregistered fork's or run's window (releaseWindow) now, or,
|
|
5543
|
-
* while the host is quiesced, when it resumes
|
|
5544
|
-
*
|
|
5545
|
-
*
|
|
5546
|
-
*
|
|
5547
|
-
*
|
|
5548
|
-
*
|
|
5549
|
-
*
|
|
5550
|
-
*
|
|
5551
|
-
*
|
|
6545
|
+
* while the host is quiesced, when it resumes: what the release passes to
|
|
6546
|
+
* the primary is judged on the window as the quiesce leaves it. Only the
|
|
6547
|
+
* window waits: the agent is already deregistered, so its stream can't
|
|
6548
|
+
* dispatch anything more and resume doesn't weigh its context, and a
|
|
6549
|
+
* write addressed to it meanwhile is treated as for any agent no longer
|
|
6550
|
+
* registered (dropped, or passed to the primary if it's a failed reply, a
|
|
6551
|
+
* channel notice its reader could act on, or a module's write for a run or
|
|
6552
|
+
* a fork: passesToPrimary). The writes kept in memory for it, while its
|
|
6553
|
+
* context manager refused its work or by a surgery's hold still up, which
|
|
6554
|
+
* no window holds, are judged so at once.
|
|
5552
6555
|
*/
|
|
5553
6556
|
private releaseWindowNowOrAfterResume;
|
|
5554
6557
|
/** resume(): the windows whose release the quiesce window postponed, each on its own. */
|
|
@@ -5557,28 +6560,27 @@ export declare class AgentFramework {
|
|
|
5557
6560
|
* A fork or an ephemeral run ended before reading a notice the primary
|
|
5558
6561
|
* takes in its place (passesToPrimary): it was released with the notice
|
|
5559
6562
|
* stored in its window unread, or, for a failed reply, its delivery failed
|
|
5560
|
-
* after release. (
|
|
5561
|
-
* boot,
|
|
5562
|
-
* the primary instead, naming the speaker, so an agent who can still act
|
|
5563
|
-
* learns of it (noticeForPrimary).
|
|
5564
|
-
*
|
|
6563
|
+
* after release. (One an earlier release left queued for it goes on at
|
|
6564
|
+
* boot, under the queued write's own id: importPersistedDeferredWrites.)
|
|
6565
|
+
* Tell the primary instead, naming the speaker, so an agent who can still act
|
|
6566
|
+
* learns of it (noticeForPrimary). The notice is the primary's alone
|
|
6567
|
+
* (#291's audience stamp): a co-resident sharing the primary's slot isn't
|
|
6568
|
+
* the agent who takes the speaker's place. On a host with no primary it
|
|
6569
|
+
* goes where a write that names no agent goes, stamped as one. A failed
|
|
6570
|
+
* write is logged and returned, not thrown: it runs inside a release,
|
|
6571
|
+
* which must complete whatever this write meets. Building the notice isn't
|
|
6572
|
+
* guarded, so a throw there, as a store read for a channel notice's words
|
|
6573
|
+
* can make at boot, reaches the caller. Whether the primary was told:
|
|
6574
|
+
* `declined` when no one is, `failed` when the write failed, each logged;
|
|
6575
|
+
* `held` when the write was kept in memory, not stored (a surgery's hold,
|
|
6576
|
+
* or the receiving agent's manager refusing its work), which stores it at
|
|
6577
|
+
* the hold's release, and loses it to a stop or a crash before then: the
|
|
6578
|
+
* empty id addMessage answers for a write it keeps, and, for a write that
|
|
6579
|
+
* names no agent, as this one, for nothing else. `passedOn`, the record
|
|
6580
|
+
* and row a boot passes on (passOnInterruptedNotices), is stamped on the
|
|
6581
|
+
* notice, so a later boot finds it passed.
|
|
5565
6582
|
*/
|
|
5566
6583
|
private passNoticeToPrimary;
|
|
5567
|
-
/**
|
|
5568
|
-
* A queued entry for `speaker`, who is gone, that the primary takes in its
|
|
5569
|
-
* place, as the primary's by-name notice (noticeForPrimary): the same
|
|
5570
|
-
* entry, under its own id and seq, now addressed to the primary. Written
|
|
5571
|
-
* through the drain, it lands stamped with that id, or waits in the queue
|
|
5572
|
-
* under it, so boot's exactly-once holds for it: a crash before the
|
|
5573
|
-
* original's ack replays one entry, never the original and a separate
|
|
5574
|
-
* notice. An entry marked as one whose earlier write may have landed
|
|
5575
|
-
* (`landing`) keeps the mark, so before it's written it's looked up by its
|
|
5576
|
-
* id in the primary's window, where it would land now
|
|
5577
|
-
* (writeDrainedInOrder). A release has looked in the speaker's own window
|
|
5578
|
-
* first (releaseWindow). null when no one is told (logged where it's
|
|
5579
|
-
* decided).
|
|
5580
|
-
*/
|
|
5581
|
-
private queuedNoticeForPrimary;
|
|
5582
6584
|
/**
|
|
5583
6585
|
* The primary's by-name notice in place of one `speaker` never read, and
|
|
5584
6586
|
* what it's about, as a log line says it: a failed reply's
|
|
@@ -5634,111 +6636,84 @@ export declare class AgentFramework {
|
|
|
5634
6636
|
private labelledChannel;
|
|
5635
6637
|
/**
|
|
5636
6638
|
* A module's write through its context (ModuleContext.addMessage):
|
|
5637
|
-
* addMessage's
|
|
5638
|
-
*
|
|
5639
|
-
*
|
|
5640
|
-
*
|
|
5641
|
-
*
|
|
5642
|
-
*
|
|
5643
|
-
*
|
|
6639
|
+
* addMessage's. The write is stored at once whatever its agent's turn
|
|
6640
|
+
* (#291), and its stored id returned; it enters the agent's window at the
|
|
6641
|
+
* agent's next presentation point, or at once while no turn of it is
|
|
6642
|
+
* alive. Only while the write is kept in memory is the id '': a
|
|
6643
|
+
* surgery's hold keeps it until its release stores it, and an agent whose
|
|
6644
|
+
* context manager refuses its work after a failed re-initialization has
|
|
6645
|
+
* it kept until a move re-initializes the agent and its release stores
|
|
6646
|
+
* it (heldForRecovery). A write whose store throws where context-manager
|
|
6647
|
+
* can't tell what of it landed throws its WriteOutcomeUnknownError, the
|
|
6648
|
+
* rows it names presented (addMessage): the write may be stored, and isn't
|
|
6649
|
+
* answered as stored.
|
|
5644
6650
|
*
|
|
5645
6651
|
* With `forAgent`, the write is for the named agent's window, which must
|
|
5646
6652
|
* be registered when the write is made: a name that isn't, or the empty
|
|
5647
6653
|
* one, which addMessage would read as none (deliveryAgent), throws, naming
|
|
5648
6654
|
* the registered ones, as queryMessages does. The framework's own writes
|
|
5649
|
-
* log and drop instead
|
|
5650
|
-
*
|
|
5651
|
-
*
|
|
5652
|
-
*
|
|
5653
|
-
*
|
|
6655
|
+
* log and drop instead. A write for an ephemeral run or a conversation
|
|
6656
|
+
* fork, whose window nothing reads after its release, is marked
|
|
6657
|
+
* (PRIMARY_IF_UNREAD_KEY), so the release passes it to the primary if its
|
|
6658
|
+
* target never read it, as it passes a notice (releaseWindow). A write
|
|
6659
|
+
* that names no agent is stamped for the agents that take untargeted
|
|
6660
|
+
* inbound in the slot it lands in (untargetedAudience, #291); one with
|
|
6661
|
+
* `forAgent` for that agent.
|
|
5654
6662
|
*/
|
|
5655
6663
|
private addModuleMessage;
|
|
5656
|
-
/**
|
|
5657
|
-
*
|
|
5658
|
-
*
|
|
5659
|
-
*
|
|
5660
|
-
*
|
|
5661
|
-
*
|
|
5662
|
-
* release (drainDeferredFor) or, at its flush, is dropped (addMessage), a
|
|
5663
|
-
* failed reply, or a channel notice its reader could act on, passing to the
|
|
5664
|
-
* primary as its notice, and a module's write for a run as written
|
|
5665
|
-
* (passesToPrimary, queuedNoticeForPrimary).
|
|
5666
|
-
*/
|
|
5667
|
-
private heldWritesFor;
|
|
5668
|
-
/**
|
|
5669
|
-
* The writes held for `reader`'s store (heldWritesFor) as the rows a
|
|
5670
|
-
* module's context reads: each under its handle, marked `held`, and
|
|
5671
|
-
* `heldFromResidents` too when its metadata carries a tune-out's stamp
|
|
5672
|
-
* (asModuleRow), with the participant, content and metadata it was
|
|
5673
|
-
* written with, the time it was first held as its timestamp, and a
|
|
5674
|
-
* sequence after every row the store holds, in queue order. The sequence
|
|
5675
|
-
* and timestamp are provisional: the stored row has the store's own.
|
|
5676
|
-
*/
|
|
5677
|
-
private heldRows;
|
|
5678
|
-
/** The row a held write landed as, found by the id it's stored with
|
|
5679
|
-
* (`metadata.deferredWriteId`): the first, for a body stored in shards,
|
|
5680
|
-
* as addMessage answers a stored write. Null when it hasn't landed, or is
|
|
5681
|
-
* no longer in the store. */
|
|
6664
|
+
/** The row a write an earlier release held landed as, found by the id
|
|
6665
|
+
* it's stored with (`metadata.deferredWriteId`): the first, for a body
|
|
6666
|
+
* stored in shards, as addMessage answers a stored write. Null when it
|
|
6667
|
+
* hasn't landed, or is no longer in the store. A module that kept the
|
|
6668
|
+
* `held:` handle such a release gave it reaches the row through it, for
|
|
6669
|
+
* one release (heldWriteId). */
|
|
5682
6670
|
private landedRow;
|
|
5683
6671
|
/**
|
|
5684
|
-
*
|
|
5685
|
-
*
|
|
5686
|
-
*
|
|
5687
|
-
*
|
|
5688
|
-
*
|
|
5689
|
-
*
|
|
5690
|
-
*
|
|
5691
|
-
*
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
* pending queue for the un-acked set, as a drained write does, so it stays
|
|
5697
|
-
* in the durable queue until the next ack has synced the store that holds
|
|
5698
|
-
* it, and it's a stored write from then on, so the paths for a landed
|
|
5699
|
-
* write apply to it. It takes the notes a store takes (noteStored), which
|
|
5700
|
-
* its first write missed when it threw, as a flush that finds such a write
|
|
5701
|
-
* takes them (readdDrained), and is logged by its id. It isn't carried
|
|
5702
|
-
* into a turn, as a flush that finds it carries it: the agent reads it at
|
|
5703
|
-
* its next compile, where the store holds it.
|
|
5704
|
-
*/
|
|
5705
|
-
private settleFound;
|
|
5706
|
-
/**
|
|
5707
|
-
* A stored row a module names by its id: where it carries the
|
|
5708
|
-
* deferredWriteId of a marked held write the reader's store holds, it's
|
|
5709
|
-
* that write's copy, so the write landed, and it's settled as found
|
|
5710
|
-
* (settleFound) before the row is read or changed. A lookup by the id
|
|
5711
|
-
* can't be needed then, so this holds where the store can't be searched
|
|
5712
|
-
* too. One row of a sharded body says it's a shard, without a count,
|
|
5713
|
-
* since one row doesn't tell how many landed.
|
|
5714
|
-
*/
|
|
5715
|
-
private settleByCopy;
|
|
5716
|
-
/** A held write whose landing stays unknown after settling, its store
|
|
5717
|
-
* unsearchable, can't be edited or removed: it may already be stored, and
|
|
5718
|
-
* changing only the queued entry could leave its stored copy as it was.
|
|
5719
|
-
* Throws with nothing changed. */
|
|
5720
|
-
private refuseUnsettled;
|
|
5721
|
-
/** Whether a wake for a deferred write has nothing left for the agent to
|
|
5722
|
-
* do, on evidence only. The write's row is at or below the newest
|
|
6672
|
+
* Whether a wake for a row it reads (InferenceRequest.readsRow) has
|
|
6673
|
+
* nothing left for the agent to do, on evidence only. The row is done once
|
|
6674
|
+
* it is gone from the agent's store on its current branch
|
|
6675
|
+
* (removed, or left on a branch the agent has switched from, where a turn
|
|
6676
|
+
* now would find nothing of it), or once an answered request's consumed
|
|
6677
|
+
* watermark covers it and the agent has spoken where the wake asks
|
|
6678
|
+
* (answeredCovers). A row stored and not yet presented to the agent isn't
|
|
6679
|
+
* covered, so its wake stays: its turn presents the row. Any doubt keeps
|
|
6680
|
+
* the wake, such as a store that can't be read.
|
|
6681
|
+
*/
|
|
6682
|
+
private rowDone;
|
|
6683
|
+
/** Whether a request the agent had answered carried `row`: the newest
|
|
5723
6684
|
* consumed watermark of an answered request (Agent.getAnsweredWatermark)
|
|
5724
|
-
*
|
|
5725
|
-
* and wasn't marked ambient (`to`, that channel on the
|
|
5726
|
-
* agent has since published there having read the
|
|
5727
|
-
* (Agent.publishedAfterReading): hearing a message isn't answering
|
|
5728
|
-
* and the wake's turn is the agent's chance to answer there.
|
|
5729
|
-
*
|
|
5730
|
-
*
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
*
|
|
5734
|
-
*
|
|
5735
|
-
*
|
|
5736
|
-
*
|
|
5737
|
-
*
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
6685
|
+
* covers it, read in the agent's context (covers), and, for a wake that
|
|
6686
|
+
* carries a channel and wasn't marked ambient (`to`, that channel on the
|
|
6687
|
+
* wake's server), the agent has since published there having read the
|
|
6688
|
+
* row (Agent.publishedAfterReading): hearing a message isn't answering
|
|
6689
|
+
* it, and the wake's turn is the agent's chance to answer there. A mark
|
|
6690
|
+
* that can't say (none, or one a branch switch or an undo left on another
|
|
6691
|
+
* branch) says no. */
|
|
6692
|
+
private answeredCovers;
|
|
6693
|
+
/**
|
|
6694
|
+
* The mark a wake for `agentName` takes for the row it was queued with
|
|
6695
|
+
* (`placement`, addMessage's out-param), so the scheduler can drop the
|
|
6696
|
+
* wake once the row needs nothing more of the agent (rowDone): the row's
|
|
6697
|
+
* stored id, for every row stored for that agent, whether it was
|
|
6698
|
+
* presented to the agent at its write or not (`presented: false`, set
|
|
6699
|
+
* where the agent's turn was alive). #291 first marked only a row kept
|
|
6700
|
+
* out of a live turn's window; #814 marks a message stored as it arrived
|
|
6701
|
+
* too, and this carries that. The wider mark drops no wake wrongly:
|
|
6702
|
+
* rowDone drops one only once an answered request's mark covers the row,
|
|
6703
|
+
* by its place in the agent's window (covers), so a request that never
|
|
6704
|
+
* carried the row keeps its wake. A resumed turn (a context-budget
|
|
6705
|
+
* restart, or a tool-result guard's retry a provider held) presents
|
|
6706
|
+
* nothing that arrived meanwhile (the presentation's afterStore counts
|
|
6707
|
+
* its turn alive), so its request doesn't carry such a row, and the row's
|
|
6708
|
+
* wake still starts a turn after it. Another agent's wake stays plain, and
|
|
6709
|
+
* so does one for a write kept in memory (a surgery's hold, or
|
|
6710
|
+
* heldForRecovery), which has no id yet.
|
|
6711
|
+
*/
|
|
6712
|
+
private readsRowFor;
|
|
6713
|
+
/** A module's id as the store knows it: a stored id as it is, and an
|
|
6714
|
+
* earlier release's `held:` handle as the row its write landed as, or
|
|
6715
|
+
* the handle itself, which the store doesn't hold, when it never landed. */
|
|
6716
|
+
private storedIdOf;
|
|
5742
6717
|
private editMessage;
|
|
5743
6718
|
private removeMessage;
|
|
5744
6719
|
private getMessage;
|
|
@@ -5749,10 +6724,38 @@ export declare class AgentFramework {
|
|
|
5749
6724
|
* so. */
|
|
5750
6725
|
private unknownAgentError;
|
|
5751
6726
|
/** A module's query (ModuleContext.queryMessages): the delivery agent's
|
|
5752
|
-
*
|
|
6727
|
+
* store (the primary's, or the first agent's when none is primary), or
|
|
5753
6728
|
* the named agent's, which must be registered: an unknown name, or the
|
|
5754
|
-
* empty one, throws, naming the registered ones, as a write's does.
|
|
6729
|
+
* empty one, throws, naming the registered ones, as a write's does. The
|
|
6730
|
+
* rows come in store order, each marked `held` where it isn't in that
|
|
6731
|
+
* agent's window (#291: stored and not yet presented to it, or taken out
|
|
6732
|
+
* of it as an undone turn's), and the count is the store's. */
|
|
5755
6733
|
private queryMessages;
|
|
6734
|
+
/** A module's window lookup (ModuleContext.windowStatusOf, #291): where
|
|
6735
|
+
* a row stands with the delivery agent's window, or the named agent's,
|
|
6736
|
+
* which must be registered, as for a query: an unknown name, or the
|
|
6737
|
+
* empty one, throws, naming the registered ones. */
|
|
6738
|
+
private windowStatusFor;
|
|
6739
|
+
/** Whether `observer` reads `observed`'s own rows through an observe edge
|
|
6740
|
+
* (ModuleContext.observes, #291), as the presentation index reads its
|
|
6741
|
+
* edges (observesOwnRows). */
|
|
6742
|
+
private observesOwnRowsOf;
|
|
6743
|
+
/**
|
|
6744
|
+
* A module's view lookup (ModuleContext.viewKeeps, #291): whether the
|
|
6745
|
+
* delivery agent's view, or the named agent's, which must be registered,
|
|
6746
|
+
* as for windowStatusFor, keeps a row, so its requests carry it, as its
|
|
6747
|
+
* strategy renders it (a row it has folded, as that summary), while its
|
|
6748
|
+
* window holds it. The view is the one its context was opened with, as
|
|
6749
|
+
* recorded for it (agentSees, main's #853: liveViewFilterOf's choice,
|
|
6750
|
+
* through the agent a shared derivation's view came from): a resident's
|
|
6751
|
+
* leaves out held traffic, the other agents' stored context injections
|
|
6752
|
+
* and what a suppress rule hid, the subconscious's those injections and
|
|
6753
|
+
* suppressed rows, and an agent opened with no view keeps every row. An agent the registry has no
|
|
6754
|
+
* record of is read through a resident's view, the one that keeps least.
|
|
6755
|
+
*/
|
|
6756
|
+
private viewKeepsFor;
|
|
6757
|
+
/** The live agent whose context a context manager is (ModuleContext.agentNameOf, #291), or undefined. */
|
|
6758
|
+
private agentNameOfContext;
|
|
5756
6759
|
private createFrameworkState;
|
|
5757
6760
|
private emitTrace;
|
|
5758
6761
|
/**
|
|
@@ -5828,6 +6831,17 @@ export declare class AgentFramework {
|
|
|
5828
6831
|
* `roundContent` to vouch for ends noting instead, as a round's does.
|
|
5829
6832
|
*/
|
|
5830
6833
|
private noteStreamEnd;
|
|
6834
|
+
/**
|
|
6835
|
+
* A row an agent's window holds, by its id, from whichever slot its
|
|
6836
|
+
* manager merges: getMessage reads the manager's own slot alone, and the
|
|
6837
|
+
* subconscious hears the residents' rows at its tool boundary from the slot
|
|
6838
|
+
* it watches (#291). Null in legacy mode, where nothing is heard from
|
|
6839
|
+
* another slot, and for a row the window doesn't hold; null too where the
|
|
6840
|
+
* window can't be read, which is logged naming `agentName` and the row,
|
|
6841
|
+
* so a note that then records the row as not stored can be told from one
|
|
6842
|
+
* whose row is absent.
|
|
6843
|
+
*/
|
|
6844
|
+
private windowRowOf;
|
|
5831
6845
|
/**
|
|
5832
6846
|
* Every row so far, judged as of now (roundRows), noted. A note the context manager writes nothing for (false)
|
|
5833
6847
|
* ends the stream's notes, with a line saying so: where the stream's compile no longer wrote the branch's record, or
|
|
@@ -6475,10 +7489,7 @@ export declare class AgentFramework {
|
|
|
6475
7489
|
* every other wake.
|
|
6476
7490
|
*/
|
|
6477
7491
|
private wireModernEvents;
|
|
6478
|
-
|
|
6479
|
-
* the reading takes as one, such as malformed content) is tool:failed, as
|
|
6480
|
-
* on the other tool paths; anything else is tool:completed. */
|
|
6481
|
-
private traceMcpToolOutcome;
|
|
7492
|
+
private traceToolOutcome;
|
|
6482
7493
|
/**
|
|
6483
7494
|
* Discover tools from all connected MCPL servers and cache them.
|
|
6484
7495
|
* Tools are namespaced as `{toolPrefix}--{toolName}` per server config.
|
|
@@ -6565,6 +7576,35 @@ export declare class AgentFramework {
|
|
|
6565
7576
|
* and what's nested in them at any depth (shownToScriptFromServer).
|
|
6566
7577
|
*/
|
|
6567
7578
|
private mcpToolResult;
|
|
7579
|
+
/** Whether any tune-out is on record: a channel's, or the all-except scope. */
|
|
7580
|
+
private tuneOutOnRecord;
|
|
7581
|
+
/** The tune-out coordinator over this framework's channels, with the hooks it acts through. */
|
|
7582
|
+
private makeTuneOutCoordinator;
|
|
7583
|
+
/**
|
|
7584
|
+
* Whether a tune-out's release would be kept in memory now, not stored:
|
|
7585
|
+
* a release made while a surgery's hold keeps writes in memory, or while
|
|
7586
|
+
* the primary's or the subconscious's manager refuses its work, would be
|
|
7587
|
+
* kept there too, and lost to a crash before it is stored, while the
|
|
7588
|
+
* epoch's end is on disk at once. The coordinator's cancel waits for them
|
|
7589
|
+
* then (its writesHeld; releaseSurgeryHeldWrites runs it), and so does a
|
|
7590
|
+
* release of the holds on record with no reader
|
|
7591
|
+
* (releaseTuneOutsWithoutReader). With `forAgent` (a loss notice's
|
|
7592
|
+
* author), whether a write for that agent would be kept: a surgery's hold
|
|
7593
|
+
* or its replay, or that agent's own manager refusing its work or waiting
|
|
7594
|
+
* for its recovery; not the primary's or the subconscious's, which hold
|
|
7595
|
+
* their own agent's writes alone.
|
|
7596
|
+
*/
|
|
7597
|
+
private tuneOutWritesHeld;
|
|
7598
|
+
/**
|
|
7599
|
+
* No reader is configured, so nothing can watch or end a hold: each hold
|
|
7600
|
+
* on record (one 0.32's `tuneOut.enabled` left, or one whose reader the
|
|
7601
|
+
* recipe no longer has) ends now, and its backlog goes to the resident,
|
|
7602
|
+
* the per-channel holds and the all-except scope alike, through a
|
|
7603
|
+
* coordinator made for that alone: at a start, or, where no MCPL server
|
|
7604
|
+
* was configured, when the first one connects. One whose release fails
|
|
7605
|
+
* stays on record for the next start.
|
|
7606
|
+
*/
|
|
7607
|
+
private releaseTuneOutsWithoutReader;
|
|
6568
7608
|
/**
|
|
6569
7609
|
* A tune-out on record where this host has no tune-out coordinator: a
|
|
6570
7610
|
* start with no subconscious makes none, and neither does a channel
|
|
@@ -6576,8 +7616,10 @@ export declare class AgentFramework {
|
|
|
6576
7616
|
* open again as a cancel leaves it, under the tune-out's own source, so an
|
|
6577
7617
|
* agent's tune-out keeps the agent's provenance (the housekeeping guard
|
|
6578
7618
|
* reads it). A log line names the channel and says how many of the
|
|
6579
|
-
* messages it diverted are
|
|
6580
|
-
*
|
|
7619
|
+
* messages it diverted are stored here, which nothing will now deliver as
|
|
7620
|
+
* its backlog. Where no reader is configured, releaseTuneOutsWithoutReader
|
|
7621
|
+
* ends them instead, backlog delivered; this is only the late-connect path
|
|
7622
|
+
* of a host that has a reader.
|
|
6581
7623
|
*/
|
|
6582
7624
|
private endTuneOutsWithoutCoordinator;
|
|
6583
7625
|
/**
|
|
@@ -6587,6 +7629,15 @@ export declare class AgentFramework {
|
|
|
6587
7629
|
* Dispatch a synthesized channel tool call.
|
|
6588
7630
|
*/
|
|
6589
7631
|
private dispatchChannelToolCall;
|
|
7632
|
+
/**
|
|
7633
|
+
* `wake_accept_suggestions` / `wake_decline`: the agent's answer to a wake
|
|
7634
|
+
* onboarding offer. Accepting writes the chosen suggestions as
|
|
7635
|
+
* `suggested:<server>:<n>` rules (replacing any it accepted before) ahead of
|
|
7636
|
+
* the first catch-all; declining removes them. Either way the decision is
|
|
7637
|
+
* recorded against the server's declared ontology, so it isn't asked again
|
|
7638
|
+
* until that changes. Throws only what the gate throws on a write.
|
|
7639
|
+
*/
|
|
7640
|
+
private answerWakeOnboarding;
|
|
6590
7641
|
/**
|
|
6591
7642
|
* Handle the synthesized `wake_add_rule` / `wake_remove_rule` tools: mutate
|
|
6592
7643
|
* the hot-reloaded gate.json at runtime. Validation lives in the EventGate
|
|
@@ -6635,7 +7686,102 @@ export declare class AgentFramework {
|
|
|
6635
7686
|
* framework's policy inputs (recipients, the hold in force, the wake
|
|
6636
7687
|
* gate), traced. Callers apply it; nothing downstream re-asks.
|
|
6637
7688
|
*/
|
|
7689
|
+
/**
|
|
7690
|
+
* The suppressed rows stored in an agent's message slot (the primary's when
|
|
7691
|
+
* none is named), oldest first, whole: what dump_suppressed writes and the
|
|
7692
|
+
* suppression review reads, for a host to read too. Within `sinceMs` (at or
|
|
7693
|
+
* after) and `untilMs` (before), and of `rule`, when given. The slot is read
|
|
7694
|
+
* on the branch it's on; a write a surgery's hold, or the wait for its
|
|
7695
|
+
* agent's recovery, keeps in memory isn't in it until it is stored.
|
|
7696
|
+
*/
|
|
7697
|
+
suppressedEvents(agentName?: string, opts?: {
|
|
7698
|
+
rule?: string;
|
|
7699
|
+
sinceMs?: number;
|
|
7700
|
+
untilMs?: number;
|
|
7701
|
+
}): SuppressedEventRecord[];
|
|
7702
|
+
/** Run the suppression review now, as its timer would: null when none is wired or one isn't run now (SuppressionReview.runOnce). */
|
|
7703
|
+
reviewSuppression(): Promise<SuppressionReviewSummary | null>;
|
|
7704
|
+
/** The suppress rules in force, as the suppression review knows them. */
|
|
7705
|
+
private suppressRulesInForce;
|
|
7706
|
+
/**
|
|
7707
|
+
* Tell the agent what the suppression review found: a notice of the
|
|
7708
|
+
* framework's own (never suppressed, as it's no event), and a wake when the
|
|
7709
|
+
* review flagged something. Throws when the notice can't be written, so the
|
|
7710
|
+
* review covers its period again next time.
|
|
7711
|
+
*/
|
|
7712
|
+
private deliverSuppressionReview;
|
|
7713
|
+
/**
|
|
7714
|
+
* Whether `agent`'s view leaves suppressed rows out, asked of the view
|
|
7715
|
+
* itself (storeSees): every resident's, the subconscious's and a view
|
|
7716
|
+
* derived from one does; an isolated agent's own store has no view filter,
|
|
7717
|
+
* so a row stamped there would render.
|
|
7718
|
+
*/
|
|
7719
|
+
private viewHidesSuppressed;
|
|
7720
|
+
/**
|
|
7721
|
+
* The suppress rule that takes an event a lane is about to write with
|
|
7722
|
+
* addMessage, or null (EventGate.decideSuppression: asked once per event,
|
|
7723
|
+
* since a windowed rule opens its window for an event it lets by). Null
|
|
7724
|
+
* with no gate, and where the write would land in a view that doesn't hide
|
|
7725
|
+
* suppressed rows (viewHidesSuppressed), since the stamp would hide
|
|
7726
|
+
* nothing there.
|
|
7727
|
+
*/
|
|
7728
|
+
private suppressionFor;
|
|
7729
|
+
/**
|
|
7730
|
+
* Count a write a suppress rule took, once addMessage has taken it (stored,
|
|
7731
|
+
* or kept in memory by a surgery's hold) (EventGate.noteSuppressed), and tell the review
|
|
7732
|
+
* the rule's description as it stands now, so the rows are judged against
|
|
7733
|
+
* it even when the rule is gone by the next review.
|
|
7734
|
+
*/
|
|
7735
|
+
private noteSuppressedWrite;
|
|
6638
7736
|
private admitInbound;
|
|
7737
|
+
/**
|
|
7738
|
+
* Wake onboarding, after an inbound event is stored: if the gate let it go
|
|
7739
|
+
* by without anyone having decided about its server (gate/wake-onboarding.ts
|
|
7740
|
+
* isUndecided), and the agent hasn't been offered or answered for this
|
|
7741
|
+
* server's declared ontology, offer the server's suggestions once — a notice
|
|
7742
|
+
* after the event, and a wake when the event is addressed to the agent or
|
|
7743
|
+
* waiting on it (ATTENTION_TAGS); otherwise the notice waits for the next
|
|
7744
|
+
* turn. Never throws: onboarding is advice, and an event's delivery must not
|
|
7745
|
+
* depend on it.
|
|
7746
|
+
*
|
|
7747
|
+
* The notice is for the agents the event was delivered to (#291's audience
|
|
7748
|
+
* stamp): the event's recipients, as its row's stamp names them
|
|
7749
|
+
* (inboundAudience), so it reads as following "the one above" only where
|
|
7750
|
+
* that one is, and a co-resident the event wasn't for is neither shown it
|
|
7751
|
+
* nor woken by it. It is stored where a write that names no agent is for
|
|
7752
|
+
* those of them that read that slot (readersNamed), stamped for them; a
|
|
7753
|
+
* recipient that doesn't read it (a conversation fork, on its own slot)
|
|
7754
|
+
* gets its own copy where it reads (`forAgent`), stamped for it, so a
|
|
7755
|
+
* recipient is woken to a notice it is shown and no one else is shown it
|
|
7756
|
+
* but an agent observing that slot (the persistent subconscious).
|
|
7757
|
+
* Mixed recipients get it in both places, once each. An event with no
|
|
7758
|
+
* recipients is for the residents that take untargeted messages, as
|
|
7759
|
+
* before. It goes through addMessage, which stores it at once and
|
|
7760
|
+
* presents it to each of them at rest or at their next point, as it does
|
|
7761
|
+
* the event. The wake of the agent its write's placement names reads the
|
|
7762
|
+
* row (readsRowFor): the delivery agent, or, where the stamp doesn't name
|
|
7763
|
+
* it, a recipient whose own slot that is (placementReaders); and so does
|
|
7764
|
+
* a fork's for its own copy. A co-resident's wake beside the delivery
|
|
7765
|
+
* agent stays plain, as the event's own does.
|
|
7766
|
+
*/
|
|
7767
|
+
private considerWakeOnboarding;
|
|
7768
|
+
/** The last offer built per server, kept while its enabled declarations are the same objects. */
|
|
7769
|
+
private wakeOfferCache;
|
|
7770
|
+
/**
|
|
7771
|
+
* A server's offer from the feature sets this host enabled for it (events
|
|
7772
|
+
* of the others never arrive, and their ontology isn't the question).
|
|
7773
|
+
*/
|
|
7774
|
+
private wakeOffer;
|
|
7775
|
+
/** The onboarding notice: what happened, what the server suggests, how to answer. Server-written text is quoted. */
|
|
7776
|
+
private wakeOnboardingText;
|
|
7777
|
+
private describeOfferedRule;
|
|
7778
|
+
/**
|
|
7779
|
+
* Make delivered messages durable now, and answer whether they are: a
|
|
7780
|
+
* tune-out's cancel stores its release and syncs it before it records the
|
|
7781
|
+
* epoch's end (#232 gap 6), and a sync that fails answers false, so the
|
|
7782
|
+
* cancel leaves the tune-out in force for its next try. A dump a surgery's
|
|
7783
|
+
* hold keeps is in memory until the hold's release.
|
|
7784
|
+
*/
|
|
6639
7785
|
private commitDeliveries;
|
|
6640
7786
|
/** The history-reading tool the primary resident actually has, if any (#232 gap 11). */
|
|
6641
7787
|
private residentHistoryTool;
|
|
@@ -6688,11 +7834,23 @@ export declare class AgentFramework {
|
|
|
6688
7834
|
private buildEventTagsResult;
|
|
6689
7835
|
private dispatchEventTagsToolCall;
|
|
6690
7836
|
private dispatchGateToolCall;
|
|
7837
|
+
/**
|
|
7838
|
+
* suppression_stats: what the suppress rules have hidden, counted over the
|
|
7839
|
+
* rows stored in the caller's message slot (the residents' shared one, for
|
|
7840
|
+
* a resident), on the branch it's on. Every suppress rule in force is
|
|
7841
|
+
* listed, with what it suppressed since start (the gate's matchCount).
|
|
7842
|
+
*/
|
|
7843
|
+
private dispatchSuppressionStatsToolCall;
|
|
7844
|
+
/**
|
|
7845
|
+
* dump_suppressed: the suppressed rows in the caller's message slot
|
|
7846
|
+
* (suppressedEvents), whole, written to a workspace file as the caller's own
|
|
7847
|
+
* write.
|
|
7848
|
+
*/
|
|
7849
|
+
private dispatchDumpSuppressedToolCall;
|
|
6691
7850
|
/** The channel context one server is told for an agent's inference
|
|
6692
7851
|
* (context/beforeInference, §14.4): only that server's own channels
|
|
6693
7852
|
* (ChannelRegistry.buildChannelContext). */
|
|
6694
7853
|
private channelsForServer;
|
|
6695
7854
|
private buildBeforeInferenceParams;
|
|
6696
7855
|
}
|
|
6697
|
-
export {};
|
|
6698
7856
|
//# sourceMappingURL=framework.d.ts.map
|