@animalabs/agent-framework 0.26.2 → 0.28.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 +99 -8
- package/dist/src/agent.d.ts +291 -23
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +596 -61
- package/dist/src/agent.js.map +1 -1
- package/dist/src/api/server.d.ts.map +1 -1
- package/dist/src/api/server.js +5 -4
- package/dist/src/api/server.js.map +1 -1
- package/dist/src/auto-continue.d.ts +34 -0
- package/dist/src/auto-continue.d.ts.map +1 -0
- package/dist/src/auto-continue.js +36 -0
- package/dist/src/auto-continue.js.map +1 -0
- package/dist/src/code-execution/isolate/scripts.d.ts +11 -0
- package/dist/src/code-execution/isolate/scripts.d.ts.map +1 -1
- package/dist/src/code-execution/isolate/scripts.js +5 -1
- package/dist/src/code-execution/isolate/scripts.js.map +1 -1
- package/dist/src/cut-off-round.d.ts +24 -0
- package/dist/src/cut-off-round.d.ts.map +1 -0
- package/dist/src/cut-off-round.js +87 -0
- package/dist/src/cut-off-round.js.map +1 -0
- package/dist/src/framework.d.ts +1038 -193
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +5967 -1514
- package/dist/src/framework.js.map +1 -1
- package/dist/src/gate/event-gate.d.ts +405 -46
- package/dist/src/gate/event-gate.d.ts.map +1 -1
- package/dist/src/gate/event-gate.js +2646 -399
- package/dist/src/gate/event-gate.js.map +1 -1
- package/dist/src/gate/index.d.ts +3 -2
- package/dist/src/gate/index.d.ts.map +1 -1
- package/dist/src/gate/index.js +2 -1
- package/dist/src/gate/index.js.map +1 -1
- package/dist/src/gate/recipe-reconcile.d.ts +103 -0
- package/dist/src/gate/recipe-reconcile.d.ts.map +1 -0
- package/dist/src/gate/recipe-reconcile.js +325 -0
- package/dist/src/gate/recipe-reconcile.js.map +1 -0
- package/dist/src/gate/reply-judge.d.ts +116 -0
- package/dist/src/gate/reply-judge.d.ts.map +1 -0
- package/dist/src/gate/reply-judge.js +467 -0
- package/dist/src/gate/reply-judge.js.map +1 -0
- package/dist/src/gate/types.d.ts +229 -8
- package/dist/src/gate/types.d.ts.map +1 -1
- package/dist/src/heartbeat/heartbeat.d.ts +184 -0
- package/dist/src/heartbeat/heartbeat.d.ts.map +1 -0
- package/dist/src/heartbeat/heartbeat.js +752 -0
- package/dist/src/heartbeat/heartbeat.js.map +1 -0
- package/dist/src/heartbeat/reminder-time.d.ts +5 -0
- package/dist/src/heartbeat/reminder-time.d.ts.map +1 -0
- package/dist/src/heartbeat/reminder-time.js +107 -0
- package/dist/src/heartbeat/reminder-time.js.map +1 -0
- package/dist/src/index.d.ts +10 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcpl/capability-mask.d.ts.map +1 -1
- package/dist/src/mcpl/capability-mask.js +3 -2
- package/dist/src/mcpl/capability-mask.js.map +1 -1
- package/dist/src/mcpl/channel-registry.d.ts +433 -113
- package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.js +1154 -435
- package/dist/src/mcpl/channel-registry.js.map +1 -1
- package/dist/src/mcpl/conversation-router.d.ts +16 -8
- package/dist/src/mcpl/conversation-router.d.ts.map +1 -1
- package/dist/src/mcpl/conversation-router.js +29 -15
- package/dist/src/mcpl/conversation-router.js.map +1 -1
- package/dist/src/mcpl/convert-block.d.ts.map +1 -1
- package/dist/src/mcpl/convert-block.js +14 -2
- package/dist/src/mcpl/convert-block.js.map +1 -1
- package/dist/src/mcpl/hook-orchestrator.d.ts +7 -1
- package/dist/src/mcpl/hook-orchestrator.d.ts.map +1 -1
- package/dist/src/mcpl/hook-orchestrator.js +32 -7
- package/dist/src/mcpl/hook-orchestrator.js.map +1 -1
- package/dist/src/mcpl/inbound-source.d.ts +26 -10
- package/dist/src/mcpl/inbound-source.d.ts.map +1 -1
- package/dist/src/mcpl/inbound-source.js +40 -69
- package/dist/src/mcpl/inbound-source.js.map +1 -1
- package/dist/src/mcpl/index.d.ts +5 -1
- package/dist/src/mcpl/index.d.ts.map +1 -1
- package/dist/src/mcpl/index.js +4 -0
- package/dist/src/mcpl/index.js.map +1 -1
- package/dist/src/mcpl/inference-router.d.ts +14 -2
- package/dist/src/mcpl/inference-router.d.ts.map +1 -1
- package/dist/src/mcpl/inference-router.js +73 -28
- package/dist/src/mcpl/inference-router.js.map +1 -1
- package/dist/src/mcpl/prose-grammar.d.ts +4 -0
- package/dist/src/mcpl/prose-grammar.d.ts.map +1 -1
- package/dist/src/mcpl/prose-grammar.js +6 -0
- package/dist/src/mcpl/prose-grammar.js.map +1 -1
- package/dist/src/mcpl/protocol-family.d.ts.map +1 -1
- package/dist/src/mcpl/protocol-family.js +3 -0
- package/dist/src/mcpl/protocol-family.js.map +1 -1
- package/dist/src/mcpl/push-coalescer.d.ts +20 -2
- package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
- package/dist/src/mcpl/push-coalescer.js +33 -11
- package/dist/src/mcpl/push-coalescer.js.map +1 -1
- package/dist/src/mcpl/reference-fetcher.d.ts +63 -42
- package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
- package/dist/src/mcpl/reference-fetcher.js +177 -145
- package/dist/src/mcpl/reference-fetcher.js.map +1 -1
- package/dist/src/mcpl/references.d.ts +380 -46
- package/dist/src/mcpl/references.d.ts.map +1 -1
- package/dist/src/mcpl/references.js +736 -77
- package/dist/src/mcpl/references.js.map +1 -1
- package/dist/src/mcpl/server-connection.d.ts +93 -4
- package/dist/src/mcpl/server-connection.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.js +176 -11
- package/dist/src/mcpl/server-connection.js.map +1 -1
- package/dist/src/mcpl/tags.d.ts +9 -2
- package/dist/src/mcpl/tags.d.ts.map +1 -1
- package/dist/src/mcpl/tags.js +12 -2
- package/dist/src/mcpl/tags.js.map +1 -1
- package/dist/src/mcpl/tool-lifecycle.d.ts +11 -0
- package/dist/src/mcpl/tool-lifecycle.d.ts.map +1 -1
- package/dist/src/mcpl/tool-lifecycle.js +21 -0
- package/dist/src/mcpl/tool-lifecycle.js.map +1 -1
- package/dist/src/mcpl/tool-presence.d.ts +311 -0
- package/dist/src/mcpl/tool-presence.d.ts.map +1 -0
- package/dist/src/mcpl/tool-presence.js +697 -0
- package/dist/src/mcpl/tool-presence.js.map +1 -0
- package/dist/src/mcpl/tool-result-normalize.d.ts +9 -3
- package/dist/src/mcpl/tool-result-normalize.d.ts.map +1 -1
- package/dist/src/mcpl/tool-result-normalize.js +14 -6
- package/dist/src/mcpl/tool-result-normalize.js.map +1 -1
- package/dist/src/mcpl/tool-signature.d.ts +46 -0
- package/dist/src/mcpl/tool-signature.d.ts.map +1 -0
- package/dist/src/mcpl/tool-signature.js +321 -0
- package/dist/src/mcpl/tool-signature.js.map +1 -0
- package/dist/src/mcpl/toolset-host.d.ts +251 -0
- package/dist/src/mcpl/toolset-host.d.ts.map +1 -0
- package/dist/src/mcpl/toolset-host.js +720 -0
- package/dist/src/mcpl/toolset-host.js.map +1 -0
- package/dist/src/mcpl/toolsets-module.d.ts +83 -0
- package/dist/src/mcpl/toolsets-module.d.ts.map +1 -0
- package/dist/src/mcpl/toolsets-module.js +523 -0
- package/dist/src/mcpl/toolsets-module.js.map +1 -0
- package/dist/src/mcpl/transport.d.ts +2 -2
- package/dist/src/mcpl/transport.d.ts.map +1 -1
- package/dist/src/mcpl/transport.js +3 -2
- package/dist/src/mcpl/transport.js.map +1 -1
- package/dist/src/mcpl/types.d.ts +24 -2
- package/dist/src/mcpl/types.d.ts.map +1 -1
- package/dist/src/mcpl/types.js.map +1 -1
- package/dist/src/mcpl/visible-content.d.ts +7 -9
- package/dist/src/mcpl/visible-content.d.ts.map +1 -1
- package/dist/src/mcpl/visible-content.js +21 -9
- package/dist/src/mcpl/visible-content.js.map +1 -1
- package/dist/src/module-registry.d.ts +27 -9
- package/dist/src/module-registry.d.ts.map +1 -1
- package/dist/src/module-registry.js +77 -17
- package/dist/src/module-registry.js.map +1 -1
- package/dist/src/modules/discord/index.js +1 -1
- package/dist/src/modules/discord/index.js.map +1 -1
- package/dist/src/modules/history/index.d.ts +2 -1
- package/dist/src/modules/history/index.d.ts.map +1 -1
- package/dist/src/modules/history/index.js +73 -28
- package/dist/src/modules/history/index.js.map +1 -1
- package/dist/src/modules/history/semantic.d.ts +108 -6
- package/dist/src/modules/history/semantic.d.ts.map +1 -1
- package/dist/src/modules/history/semantic.js +273 -57
- package/dist/src/modules/history/semantic.js.map +1 -1
- package/dist/src/modules/workspace/answers.d.ts +22 -0
- package/dist/src/modules/workspace/answers.d.ts.map +1 -0
- package/dist/src/modules/workspace/answers.js +123 -0
- package/dist/src/modules/workspace/answers.js.map +1 -0
- package/dist/src/modules/workspace/branch-intent.d.ts +5 -3
- package/dist/src/modules/workspace/branch-intent.d.ts.map +1 -1
- package/dist/src/modules/workspace/branch-intent.js +6 -2
- package/dist/src/modules/workspace/branch-intent.js.map +1 -1
- package/dist/src/modules/workspace/direct-write.d.ts +184 -0
- package/dist/src/modules/workspace/direct-write.d.ts.map +1 -0
- package/dist/src/modules/workspace/direct-write.js +417 -0
- package/dist/src/modules/workspace/direct-write.js.map +1 -0
- package/dist/src/modules/workspace/disk-agreement.d.ts +33 -11
- package/dist/src/modules/workspace/disk-agreement.d.ts.map +1 -1
- package/dist/src/modules/workspace/disk-agreement.js +48 -17
- package/dist/src/modules/workspace/disk-agreement.js.map +1 -1
- package/dist/src/modules/workspace/edit-text.d.ts +27 -12
- package/dist/src/modules/workspace/edit-text.d.ts.map +1 -1
- package/dist/src/modules/workspace/edit-text.js +61 -29
- package/dist/src/modules/workspace/edit-text.js.map +1 -1
- package/dist/src/modules/workspace/effects.d.ts +10 -0
- package/dist/src/modules/workspace/effects.d.ts.map +1 -1
- package/dist/src/modules/workspace/effects.js +21 -14
- package/dist/src/modules/workspace/effects.js.map +1 -1
- package/dist/src/modules/workspace/index.d.ts +308 -78
- package/dist/src/modules/workspace/index.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.js +2103 -720
- package/dist/src/modules/workspace/index.js.map +1 -1
- package/dist/src/modules/workspace/observe.d.ts +75 -63
- package/dist/src/modules/workspace/observe.d.ts.map +1 -1
- package/dist/src/modules/workspace/observe.js +366 -180
- package/dist/src/modules/workspace/observe.js.map +1 -1
- package/dist/src/modules/workspace/read-page.d.ts +41 -0
- package/dist/src/modules/workspace/read-page.d.ts.map +1 -0
- package/dist/src/modules/workspace/read-page.js +219 -0
- package/dist/src/modules/workspace/read-page.js.map +1 -0
- package/dist/src/modules/workspace/reconcile.d.ts.map +1 -1
- package/dist/src/modules/workspace/reconcile.js +26 -16
- package/dist/src/modules/workspace/reconcile.js.map +1 -1
- package/dist/src/modules/workspace/result-text.d.ts +68 -0
- package/dist/src/modules/workspace/result-text.d.ts.map +1 -0
- package/dist/src/modules/workspace/result-text.js +94 -0
- package/dist/src/modules/workspace/result-text.js.map +1 -0
- package/dist/src/modules/workspace/sync.d.ts +9 -0
- package/dist/src/modules/workspace/sync.d.ts.map +1 -1
- package/dist/src/modules/workspace/sync.js +14 -0
- package/dist/src/modules/workspace/sync.js.map +1 -1
- package/dist/src/modules/workspace/text.d.ts +29 -12
- package/dist/src/modules/workspace/text.d.ts.map +1 -1
- package/dist/src/modules/workspace/text.js +35 -33
- package/dist/src/modules/workspace/text.js.map +1 -1
- package/dist/src/modules/workspace/types.d.ts +137 -60
- package/dist/src/modules/workspace/types.d.ts.map +1 -1
- package/dist/src/modules/workspace/types.js.map +1 -1
- package/dist/src/modules/workspace/watcher.d.ts.map +1 -1
- package/dist/src/modules/workspace/watcher.js +8 -3
- package/dist/src/modules/workspace/watcher.js.map +1 -1
- package/dist/src/prose-drafts.d.ts +4 -3
- package/dist/src/prose-drafts.d.ts.map +1 -1
- package/dist/src/prose-drafts.js +3 -2
- package/dist/src/prose-drafts.js.map +1 -1
- package/dist/src/reasoning-loss-notice.d.ts +23 -0
- package/dist/src/reasoning-loss-notice.d.ts.map +1 -0
- package/dist/src/reasoning-loss-notice.js +50 -0
- package/dist/src/reasoning-loss-notice.js.map +1 -0
- package/dist/src/reasoning-loss.d.ts +24 -0
- package/dist/src/reasoning-loss.d.ts.map +1 -0
- package/dist/src/reasoning-loss.js +102 -0
- package/dist/src/reasoning-loss.js.map +1 -0
- package/dist/src/send-tools.d.ts +3 -2
- package/dist/src/send-tools.d.ts.map +1 -1
- package/dist/src/send-tools.js +3 -2
- package/dist/src/send-tools.js.map +1 -1
- package/dist/src/sent-rows.d.ts +59 -0
- package/dist/src/sent-rows.d.ts.map +1 -0
- package/dist/src/sent-rows.js +145 -0
- package/dist/src/sent-rows.js.map +1 -0
- package/dist/src/silent-heartbeat.d.ts +17 -10
- package/dist/src/silent-heartbeat.d.ts.map +1 -1
- package/dist/src/silent-heartbeat.js.map +1 -1
- package/dist/src/stable-hash.d.ts +3 -0
- package/dist/src/stable-hash.d.ts.map +1 -0
- package/dist/src/stable-hash.js +15 -0
- package/dist/src/stable-hash.js.map +1 -0
- package/dist/src/stored-injections.d.ts +99 -0
- package/dist/src/stored-injections.d.ts.map +1 -0
- package/dist/src/stored-injections.js +106 -0
- package/dist/src/stored-injections.js.map +1 -0
- package/dist/src/text-as-stored.d.ts +4 -3
- package/dist/src/text-as-stored.d.ts.map +1 -1
- package/dist/src/text-as-stored.js +4 -3
- package/dist/src/text-as-stored.js.map +1 -1
- package/dist/src/thinking-drops.d.ts +74 -0
- package/dist/src/thinking-drops.d.ts.map +1 -0
- package/dist/src/thinking-drops.js +96 -0
- package/dist/src/thinking-drops.js.map +1 -0
- package/dist/src/tool-args.d.ts +12 -0
- package/dist/src/tool-args.d.ts.map +1 -1
- package/dist/src/tool-args.js +35 -1
- package/dist/src/tool-args.js.map +1 -1
- package/dist/src/tool-image-ledger.d.ts +9 -8
- package/dist/src/tool-image-ledger.d.ts.map +1 -1
- package/dist/src/tool-image-ledger.js +9 -8
- package/dist/src/tool-image-ledger.js.map +1 -1
- package/dist/src/tool-presentation.d.ts.map +1 -1
- package/dist/src/tool-presentation.js +3 -1
- package/dist/src/tool-presentation.js.map +1 -1
- package/dist/src/tool-result-guard.d.ts +12 -6
- package/dist/src/tool-result-guard.d.ts.map +1 -1
- package/dist/src/tool-result-guard.js +44 -17
- package/dist/src/tool-result-guard.js.map +1 -1
- package/dist/src/tool-result-history.d.ts +176 -24
- package/dist/src/tool-result-history.d.ts.map +1 -1
- package/dist/src/tool-result-history.js +411 -91
- package/dist/src/tool-result-history.js.map +1 -1
- package/dist/src/tune-out/coordinator.d.ts +17 -9
- package/dist/src/tune-out/coordinator.d.ts.map +1 -1
- package/dist/src/tune-out/coordinator.js +84 -37
- package/dist/src/tune-out/coordinator.js.map +1 -1
- package/dist/src/tune-out/tools.d.ts +4 -1
- package/dist/src/tune-out/tools.d.ts.map +1 -1
- package/dist/src/types/agent.d.ts +217 -7
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/events.d.ts +33 -9
- package/dist/src/types/events.d.ts.map +1 -1
- package/dist/src/types/framework.d.ts +39 -3
- package/dist/src/types/framework.d.ts.map +1 -1
- package/dist/src/types/module.d.ts +95 -9
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/trace.d.ts +91 -3
- package/dist/src/types/trace.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/agent.ts +661 -67
- package/src/api/server.ts +5 -4
- package/src/auto-continue.ts +43 -0
- package/src/code-execution/isolate/scripts.ts +11 -3
- package/src/cut-off-round.ts +98 -0
- package/src/framework.ts +6168 -1540
- package/src/gate/event-gate.ts +2895 -405
- package/src/gate/index.ts +10 -1
- package/src/gate/recipe-reconcile.ts +355 -0
- package/src/gate/reply-judge.ts +512 -0
- package/src/gate/types.ts +234 -9
- package/src/heartbeat/heartbeat.ts +804 -0
- package/src/heartbeat/reminder-time.ts +107 -0
- package/src/index.ts +11 -4
- package/src/mcpl/capability-mask.ts +3 -2
- package/src/mcpl/channel-registry.ts +1222 -468
- package/src/mcpl/conversation-router.ts +34 -16
- package/src/mcpl/convert-block.ts +14 -1
- package/src/mcpl/hook-orchestrator.ts +33 -6
- package/src/mcpl/inbound-source.ts +42 -69
- package/src/mcpl/index.ts +6 -1
- package/src/mcpl/inference-router.ts +79 -34
- package/src/mcpl/prose-grammar.ts +7 -0
- package/src/mcpl/protocol-family.ts +2 -0
- package/src/mcpl/push-coalescer.ts +51 -13
- package/src/mcpl/reference-fetcher.ts +201 -162
- package/src/mcpl/references.ts +851 -77
- package/src/mcpl/server-connection.ts +189 -11
- package/src/mcpl/tags.ts +13 -2
- package/src/mcpl/tool-lifecycle.ts +21 -0
- package/src/mcpl/tool-presence.ts +716 -0
- package/src/mcpl/tool-result-normalize.ts +18 -6
- package/src/mcpl/tool-signature.ts +316 -0
- package/src/mcpl/toolset-host.ts +727 -0
- package/src/mcpl/toolsets-module.ts +545 -0
- package/src/mcpl/transport.ts +3 -2
- package/src/mcpl/types.ts +25 -2
- package/src/mcpl/visible-content.ts +22 -9
- package/src/module-registry.ts +85 -26
- package/src/modules/discord/index.ts +1 -1
- package/src/modules/history/index.ts +70 -30
- package/src/modules/history/semantic.ts +308 -54
- package/src/modules/workspace/answers.ts +133 -0
- package/src/modules/workspace/branch-intent.ts +10 -5
- package/src/modules/workspace/direct-write.ts +460 -0
- package/src/modules/workspace/disk-agreement.ts +52 -21
- package/src/modules/workspace/edit-text.ts +84 -35
- package/src/modules/workspace/effects.ts +22 -13
- package/src/modules/workspace/index.ts +2142 -723
- package/src/modules/workspace/observe.ts +381 -177
- package/src/modules/workspace/read-page.ts +228 -0
- package/src/modules/workspace/reconcile.ts +27 -15
- package/src/modules/workspace/result-text.ts +121 -0
- package/src/modules/workspace/sync.ts +16 -0
- package/src/modules/workspace/text.ts +58 -32
- package/src/modules/workspace/types.ts +137 -60
- package/src/modules/workspace/watcher.ts +8 -3
- package/src/prose-drafts.ts +4 -3
- package/src/reasoning-loss-notice.ts +62 -0
- package/src/reasoning-loss.ts +120 -0
- package/src/send-tools.ts +3 -2
- package/src/sent-rows.ts +162 -0
- package/src/silent-heartbeat.ts +17 -10
- package/src/stable-hash.ts +14 -0
- package/src/stored-injections.ts +131 -0
- package/src/text-as-stored.ts +4 -3
- package/src/thinking-drops.ts +135 -0
- package/src/tool-args.ts +34 -1
- package/src/tool-image-ledger.ts +9 -8
- package/src/tool-presentation.ts +3 -1
- package/src/tool-result-guard.ts +45 -17
- package/src/tool-result-history.ts +471 -90
- package/src/tune-out/coordinator.ts +80 -37
- package/src/tune-out/tools.ts +4 -1
- package/src/types/agent.ts +220 -7
- package/src/types/events.ts +33 -9
- package/src/types/framework.ts +36 -3
- package/src/types/module.ts +91 -9
- package/src/types/trace.ts +94 -3
package/dist/src/framework.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type PresentationSnapshot } from "./tool-presentation.js";
|
|
2
2
|
import { JsStore } from '@animalabs/chronicle';
|
|
3
3
|
import type { Membrane, NormalizedRequest } from '@animalabs/membrane';
|
|
4
|
+
import { type RetrySettings } from '@animalabs/membrane/retry';
|
|
4
5
|
import { ContextManager } from '@animalabs/context-manager';
|
|
5
6
|
import type { TokenBudget } from '@animalabs/context-manager';
|
|
6
|
-
import type { FrameworkConfig, TraceEventListener, InferenceLogQuery, InferenceLogQueryResult, InferenceLogEntryWithId, ProcessLogQuery, ProcessLogQueryResult, ProcessLogEntryWithId, ProcessEvent, ToolCall, ToolResult, AgentConfig, InferenceRequest, Module, ContextMaintenanceSnapshot, AgentRuntimeSettingsPatch, AgentRuntimeSettingsSnapshot, SameRoundThinkTextPolicy } from './types/index.js';
|
|
7
|
-
import { Agent } from './agent.js';
|
|
7
|
+
import type { FrameworkConfig, ErrorPolicy, ErrorAction, TraceEventListener, InferenceLogQuery, InferenceLogQueryResult, InferenceLogEntryWithId, ProcessLogQuery, ProcessLogQueryResult, ProcessLogEntryWithId, ProcessEvent, ToolCall, ToolResult, AgentConfig, InferenceRequest, Module, ContextMaintenanceSnapshot, AgentRuntimeSettingsPatch, AgentRuntimeSettingsSnapshot, SameRoundThinkTextPolicy } from './types/index.js';
|
|
8
|
+
import { Agent, type RenderStats } from './agent.js';
|
|
8
9
|
import { type ToolClass, type ToolClassSource } from './mcpl/tool-classes.js';
|
|
9
10
|
import { ChannelRegistry } from './mcpl/channel-registry.js';
|
|
10
11
|
import { ConversationRouter } from './mcpl/conversation-router.js';
|
|
@@ -87,11 +88,15 @@ export interface HostModeStatus {
|
|
|
87
88
|
* is false until it has. A parked continuation of a turn is counted here
|
|
88
89
|
* and, as a turn alive, in `activeTurns` and `activeTurnAgents`. */
|
|
89
90
|
parkedAdmissions: number;
|
|
90
|
-
/** Inference requests parked by the quiesce wake
|
|
91
|
-
*
|
|
92
|
-
* scheduler's
|
|
93
|
-
*
|
|
94
|
-
*
|
|
91
|
+
/** Inference requests waiting to start: queued (parked by the quiesce wake
|
|
92
|
+
* gate while quiesced, or, while serving, until the scheduler's next pass
|
|
93
|
+
* takes them), in a scheduler pass's hands, or held by a provider hold (an
|
|
94
|
+
* acceleration or host hold, or a provider's stated wait). There, a start
|
|
95
|
+
* that carries a turn on counts as the wakes merged into it. A start parked
|
|
96
|
+
* on provider admission behind an auxiliary call counts once in
|
|
97
|
+
* `parkedAdmissions` instead, however many wakes are merged into it.
|
|
98
|
+
* Continuations of a turn (budget restart, tool results) and a held turn's
|
|
99
|
+
* retry, which a quiesce lets through, are never counted. */
|
|
95
100
|
gatedRequests: number;
|
|
96
101
|
/** code_execution scripts still running that no call is waiting on: left
|
|
97
102
|
* running after a yield, outside any turn. Quiesce does NOT stop them —
|
|
@@ -105,11 +110,12 @@ export interface HostModeStatus {
|
|
|
105
110
|
* turn token held with no stream to cancel and no check ahead to stop it
|
|
106
111
|
* at (a puppet tool turn, a store surgery's reservation, a turn finishing
|
|
107
112
|
* its last delivery), or a turn with no stream that hasn't reached its
|
|
108
|
-
* next check, such as one in a hook that hasn't returned
|
|
109
|
-
* stream
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
+
* next check, such as one in a hook that hasn't returned, or a turn whose
|
|
114
|
+
* stream's cancel threw with no check ahead, so that its stream goes on.
|
|
115
|
+
* A turn whose stream the abandon cancelled isn't listed, even one still
|
|
116
|
+
* running when the grace runs out, as one whose tool-result guard waits on
|
|
117
|
+
* its speech may be. Present only after an abandon that left such turns
|
|
118
|
+
* behind, while the host stays quiesced. */
|
|
113
119
|
unabandonable?: string[];
|
|
114
120
|
}
|
|
115
121
|
/**
|
|
@@ -160,6 +166,78 @@ export declare class ProviderWaitNotSleptError extends Error {
|
|
|
160
166
|
interface InferenceToolSnapshot {
|
|
161
167
|
sameRoundThinkTextPolicy: SameRoundThinkTextPolicy;
|
|
162
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Default error policy: membrane's own retry schedules, decided here.
|
|
171
|
+
*
|
|
172
|
+
* The framework's turns pass `retry: false` to membrane, so a failure reaches
|
|
173
|
+
* this policy after one send, and the framework is the one retry layer: each
|
|
174
|
+
* retry is a fresh compile, a stop cancels its wait, and the wait is seen.
|
|
175
|
+
* The decision is membrane's (`@animalabs/membrane/retry`), on the settings
|
|
176
|
+
* given: membrane's, with the two changes below for the turn path, unless a
|
|
177
|
+
* host passes its own (e.g. from a recipe's retry config), which are taken as
|
|
178
|
+
* they are:
|
|
179
|
+
* - not retryable (400 invalid_request, 401 auth, context_length, safety,
|
|
180
|
+
* a caller-code error): terminal on the first failure. Retrying them burns
|
|
181
|
+
* API quota without any chance of success; production traces showed clerk +
|
|
182
|
+
* reviewer wasting 4 inferences on each 400 due to blind retries.
|
|
183
|
+
* - overloaded (a 529, or an overloaded error mid-stream): the overloaded
|
|
184
|
+
* schedule, jittered, 10 s doubling to 5 min (by default 13 tries, where
|
|
185
|
+
* membrane's settings have 7: about 30 min).
|
|
186
|
+
* - rate limited (429): the base schedule with at least 5 tries.
|
|
187
|
+
* - any other retryable failure, a stream deadline on a sent request
|
|
188
|
+
* included (membrane leaves those to its caller): the base schedule (by
|
|
189
|
+
* default 3 tries, 1 s then 2 s).
|
|
190
|
+
* A provider's stated wait (`retryAfterMs`) is waited when it is longer than
|
|
191
|
+
* the backoff, up to the schedule's ceiling, which by default is at least the
|
|
192
|
+
* framework's own cap (PROVIDER_ACCELERATION_MAX_COOLDOWN_MS, ten minutes);
|
|
193
|
+
* past it the turn ends here. A host's own settings keep their ceilings.
|
|
194
|
+
* (Before this policy runs, the framework holds a resident for a stated wait
|
|
195
|
+
* or an acceleration 429 itself, and ends an ephemeral run on a wait past
|
|
196
|
+
* that cap; see holdProviderAcceleration and nonOwningProviderWait.)
|
|
197
|
+
* An error that isn't a MembraneError is retried as a retryable failure, on
|
|
198
|
+
* the base schedule.
|
|
199
|
+
*/
|
|
200
|
+
export declare class DefaultErrorPolicy implements ErrorPolicy {
|
|
201
|
+
/** The most retries any class allows (ErrorPolicy's bound, for readers). */
|
|
202
|
+
readonly maxRetries: number;
|
|
203
|
+
private readonly settings;
|
|
204
|
+
constructor(settings?: RetrySettings);
|
|
205
|
+
onInferenceError(error: Error, _agentName: string, attempt: number): ErrorAction;
|
|
206
|
+
}
|
|
207
|
+
export interface ReinitAlertText {
|
|
208
|
+
opening: string;
|
|
209
|
+
message: string;
|
|
210
|
+
}
|
|
211
|
+
export declare const REINIT_MOVES: readonly ['undo', 'redo', 'rollback', 'suppression', 'branch switch'];
|
|
212
|
+
export type ReinitMove = (typeof REINIT_MOVES)[number];
|
|
213
|
+
export declare function refusedWorkAlert(move: ReinitMove, cause: string): ReinitAlertText;
|
|
214
|
+
export declare function restoreAlert(restore: {
|
|
215
|
+
source: string;
|
|
216
|
+
now: string;
|
|
217
|
+
selected: boolean;
|
|
218
|
+
cause: string;
|
|
219
|
+
} & ({
|
|
220
|
+
move: 'rollback';
|
|
221
|
+
managerCurrent?: false;
|
|
222
|
+
} | {
|
|
223
|
+
move: 'suppression';
|
|
224
|
+
managerCurrent: boolean;
|
|
225
|
+
})): ReinitAlertText;
|
|
226
|
+
export declare function disposalAlert(disposal: {
|
|
227
|
+
move: ReinitMove;
|
|
228
|
+
heldWrites?: number;
|
|
229
|
+
reinitFailed?: string;
|
|
230
|
+
cleanupFailed?: string;
|
|
231
|
+
}): ReinitAlertText;
|
|
232
|
+
export declare function longHoldAlert(hold: {
|
|
233
|
+
move: string;
|
|
234
|
+
agentName: string;
|
|
235
|
+
heldSeconds: number;
|
|
236
|
+
queued: number;
|
|
237
|
+
reinitializing?: string;
|
|
238
|
+
waitingForMaintenance: boolean;
|
|
239
|
+
}): ReinitAlertText;
|
|
240
|
+
export declare function opsWebhookText(message: string): string;
|
|
163
241
|
/**
|
|
164
242
|
* Whether the poison-history breaker may shed the newest exchange for a
|
|
165
243
|
* failure: an `invalid_request` at HTTP 400, 413 or 422 or with no status, or
|
|
@@ -222,11 +300,35 @@ export declare class AgentFramework {
|
|
|
222
300
|
private toolPresentations;
|
|
223
301
|
private presentationPreviews;
|
|
224
302
|
getRequestToolPresentation(request: object): PresentationSnapshot | null;
|
|
303
|
+
/**
|
|
304
|
+
* The render stats of the dry compile that built `request`, a request
|
|
305
|
+
* `previewActivation` returned (or `Agent.buildActivationRequest` with
|
|
306
|
+
* `dryRun`), as context-manager gives them in `CompileResult.renderStats`:
|
|
307
|
+
* what that compile's select put in the context, by kind. They count the
|
|
308
|
+
* selection, not each message of the request. The injections
|
|
309
|
+
* context-manager merges in after its select, such as those
|
|
310
|
+
* `previewActivation` gathers with `injections: true`, aren't counted;
|
|
311
|
+
* context-manager's doc of `CompileResult.renderStats` names what else its
|
|
312
|
+
* compile does after the select. The agent then changes the messages
|
|
313
|
+
* itself, and the stats come from before that: they count a message it
|
|
314
|
+
* drops, such as one left holding only blank text, and leave out the turns
|
|
315
|
+
* it adds, such as `[Continue]`, a silent heartbeat's separator,
|
|
316
|
+
* request-only turns, and the stand-ins `previewActivation` shows for the
|
|
317
|
+
* `afterUser` injections a start would store (stored-injections.ts). A
|
|
318
|
+
* later preview or live compile leaves them as they were.
|
|
319
|
+
* They're the object the compile returned, not a copy, so treat them as
|
|
320
|
+
* read-only: a change to them shows in every later read. Null for a request
|
|
321
|
+
* no dry run built, a request that is sent included, and when the agent's
|
|
322
|
+
* strategy records none (of context-manager's own, the autobiographical
|
|
323
|
+
* strategy and the knowledge strategy built on it do).
|
|
324
|
+
*/
|
|
325
|
+
getRequestCompileStats(request: object): RenderStats | null;
|
|
225
326
|
private store;
|
|
226
327
|
private ownsStore;
|
|
227
328
|
private stopPromise;
|
|
228
329
|
private stopCompleted;
|
|
229
330
|
private ownedStoreClosed;
|
|
331
|
+
private ownedStoreManagersClosed;
|
|
230
332
|
/** Whether the latest stop() got through its teardown with nothing failed:
|
|
231
333
|
* every step and every wait up to and including the one on awareness
|
|
232
334
|
* drains, whatever failed after that, in the storage work that finishes
|
|
@@ -254,6 +356,8 @@ export declare class AgentFramework {
|
|
|
254
356
|
private inferencePolicy;
|
|
255
357
|
private errorPolicy;
|
|
256
358
|
private pendingRequests;
|
|
359
|
+
private readonly exhaustedTurns;
|
|
360
|
+
private readonly roundTurns;
|
|
257
361
|
private running;
|
|
258
362
|
private loopPromise;
|
|
259
363
|
/** Quiesce/maintenance mode (issue #122). DELIBERATELY separate from
|
|
@@ -305,6 +409,7 @@ export declare class AgentFramework {
|
|
|
305
409
|
private providerWaits;
|
|
306
410
|
/** Wakers for error-policy retry waits in progress: stop() ends them. */
|
|
307
411
|
private retryWaitWakers;
|
|
412
|
+
private waitingTraceEveryMs;
|
|
308
413
|
private providerAdmissionClosed;
|
|
309
414
|
/** Invalidates framework turns still assembling when stop begins. */
|
|
310
415
|
private lifecycleGeneration;
|
|
@@ -319,6 +424,7 @@ export declare class AgentFramework {
|
|
|
319
424
|
* framework, and tests set it by cast. */
|
|
320
425
|
private inboundAcceptanceObserver?;
|
|
321
426
|
private streamBoundaryEnds;
|
|
427
|
+
private streamCarries;
|
|
322
428
|
/** A tool boundary injected fresh CONVERSATIONAL input (a real message,
|
|
323
429
|
* or an edit the coalescer marks as the agent's first view; not a system
|
|
324
430
|
* marker or a reaction, reaction removal, edit or deletion marker) into
|
|
@@ -349,6 +455,7 @@ export declare class AgentFramework {
|
|
|
349
455
|
* next turn.
|
|
350
456
|
*/
|
|
351
457
|
private turnRouting;
|
|
458
|
+
private readonly reasoningLoss;
|
|
352
459
|
/**
|
|
353
460
|
* The latest link of each agent's chain of queued prose deliveries. Every
|
|
354
461
|
* stream queues its own behind it, a fresh turn's included, so the agent's
|
|
@@ -389,6 +496,10 @@ export declare class AgentFramework {
|
|
|
389
496
|
/** Consecutive bounce-wakes per agent; capped so an agent that keeps
|
|
390
497
|
* emitting unprefixed prose can't wake-loop (notices still append). */
|
|
391
498
|
private proseBounceStreaks;
|
|
499
|
+
/** Consecutive autoContinue continuations per agent, capped by its
|
|
500
|
+
* maxConsecutive. Cleared when a turn starts with a cause of its own
|
|
501
|
+
* (processInferenceRequests) or a tool ends a turn (skip_reply). */
|
|
502
|
+
private autoContinueStreaks;
|
|
392
503
|
private pendingAssistantBlocks;
|
|
393
504
|
/** Streams the FRAMEWORK cancelled for non-terminal reasons, keyed
|
|
394
505
|
* `${agentName}:${streamId}`: an endTurn tool result or a context-budget
|
|
@@ -521,6 +632,12 @@ export declare class AgentFramework {
|
|
|
521
632
|
*/
|
|
522
633
|
private deferredScanFrom;
|
|
523
634
|
private deferredMessages;
|
|
635
|
+
/** The marked held writes whose store couldn't be searched, each with the
|
|
636
|
+
* failure said, said once until a lookup of them succeeds and again when
|
|
637
|
+
* the failure changes (landedCopiesById), and those a drain has said it
|
|
638
|
+
* holds what's queued behind (writeDrainedInOrder). */
|
|
639
|
+
private unsearchableSaid;
|
|
640
|
+
private stillUnknownSaid;
|
|
524
641
|
private activeTurnTokens;
|
|
525
642
|
/** Each running scheduler pass's requests, which it took from
|
|
526
643
|
* pendingRequests: it holds those of the agents it hasn't taken up yet
|
|
@@ -624,6 +741,9 @@ export declare class AgentFramework {
|
|
|
624
741
|
* ephemeral agents have isolated slots and are their own only readers.
|
|
625
742
|
*/
|
|
626
743
|
private readonly sharedSlotAgents;
|
|
744
|
+
/** The batched-wake lines already written (placeWakeLines), so every agent a
|
|
745
|
+
* wake was for, and every later start of it, writes each at most once. */
|
|
746
|
+
private readonly placedWakeLines;
|
|
627
747
|
/** Rounds of tool calls, by their results array, that a save_recent_image
|
|
628
748
|
* in the round counted by their share of the bound: such a round is
|
|
629
749
|
* stored by its share whether or not it fits (buildStoredToolResultContent). */
|
|
@@ -634,6 +754,11 @@ export declare class AgentFramework {
|
|
|
634
754
|
* queued, and clears them. While a name is here, no other flush drains
|
|
635
755
|
* its queue (drainDeferredFor). */
|
|
636
756
|
private readonly releasesAfterResume;
|
|
757
|
+
private readonly managerReleases;
|
|
758
|
+
private readonly releasedByCleanup;
|
|
759
|
+
private readonly openManagers;
|
|
760
|
+
private readonly openManagerRefs;
|
|
761
|
+
private readonly collectedManagers;
|
|
637
762
|
/** The coalescing commit in flight, if any (see commitCoalescingDurable). */
|
|
638
763
|
private coalescingCommit;
|
|
639
764
|
private inferenceRouter;
|
|
@@ -659,8 +784,24 @@ export declare class AgentFramework {
|
|
|
659
784
|
private closingConversationAgents;
|
|
660
785
|
private codeExecution;
|
|
661
786
|
private scriptToolWaiters;
|
|
662
|
-
/**
|
|
663
|
-
*
|
|
787
|
+
/** A script's call being dispatched, by its call id: what its script was
|
|
788
|
+
* started with, its words' turn and reading. `turnId` is the turn the
|
|
789
|
+
* script was started in, if one was (callingTurnOf); `readThrough` is the
|
|
790
|
+
* consumed watermark its agent had when the run call started it, which a
|
|
791
|
+
* publish the call makes is credited with (publishReadThrough). Kept only
|
|
792
|
+
* while the dispatch runs (dispatchScriptToolCall). */
|
|
793
|
+
private readonly scriptCallStarts;
|
|
794
|
+
/** Per agent, the unexpected thinking drops its last operator alert counted (noteThinkingLoss). */
|
|
795
|
+
private readonly thinkingLossIncidents;
|
|
796
|
+
/** Per live stream that can be noted, its rows so far after the compiled messages (noteRoundSent). */
|
|
797
|
+
private readonly streamRequestNotes;
|
|
798
|
+
private readonly streamCarried;
|
|
799
|
+
/** Per pending round's blocks (pendingAssistantBlocks' value), what membrane held as that round's reply
|
|
800
|
+
* (`roundContent`, its results left out); null where the round has no `roundContent` (XML or fallback). Keyed by
|
|
801
|
+
* the blocks themselves, so it goes wherever they go. */
|
|
802
|
+
private readonly pendingRoundSent;
|
|
803
|
+
/** Per agent, a round that called code_execution or sent, and waits for
|
|
804
|
+
* those calls' results before its prose is routed (ScriptRound). */
|
|
664
805
|
private scriptRounds;
|
|
665
806
|
/** Each code_execution result, by the round that dispatched its call: it
|
|
666
807
|
* settles only that round, even if a newer round reuses its call id. */
|
|
@@ -741,6 +882,10 @@ export declare class AgentFramework {
|
|
|
741
882
|
/** Host capabilities advertised during the MCP handshake — stored so servers
|
|
742
883
|
* can be connected at runtime (connectMcplServer) after initialization. */
|
|
743
884
|
private mcplHostCapabilities;
|
|
885
|
+
/** MCPL RFC-014: every toolHints server's tool presence, for the
|
|
886
|
+
* `toolsets` module's meta-tools and reminders. Made when the first
|
|
887
|
+
* server configured with `toolHints: true` is set up; null until then. */
|
|
888
|
+
private toolsetHub;
|
|
744
889
|
/** Inference routing policy from FrameworkConfig — stored so the MCPL
|
|
745
890
|
* subsystem can be lazily initialized by connectMcplServer when the
|
|
746
891
|
* framework started with zero configured servers. */
|
|
@@ -760,6 +905,9 @@ export declare class AgentFramework {
|
|
|
760
905
|
* scheduler, ephemeral admission and puppet entry points.
|
|
761
906
|
*/
|
|
762
907
|
private surgeryHold;
|
|
908
|
+
private readonly conversationSpawnsInFlight;
|
|
909
|
+
private syncMoveReinit;
|
|
910
|
+
private holdAlertMs;
|
|
763
911
|
/** Serialize per-server drains so reconnect and an online undo cannot race. */
|
|
764
912
|
private discordAwarenessDrains;
|
|
765
913
|
/** The servers whose running pass a later trigger joined
|
|
@@ -767,9 +915,10 @@ export declare class AgentFramework {
|
|
|
767
915
|
* more what it had already tried. */
|
|
768
916
|
private discordAwarenessDrainsJoined;
|
|
769
917
|
private eventGate;
|
|
918
|
+
private judgeWired;
|
|
919
|
+
/** The heartbeat (FrameworkConfig.heartbeat), when the host turns it on. */
|
|
920
|
+
private heartbeat;
|
|
770
921
|
private usageTracker;
|
|
771
|
-
/** Explicit-send or private suppression carried into a tool-result-guard retry. */
|
|
772
|
-
private guardRetryTurnSilenced;
|
|
773
922
|
/** Presentation-only wall-clock zone; persistence remains UTC/epoch. */
|
|
774
923
|
private readonly timeZone;
|
|
775
924
|
private constructor();
|
|
@@ -787,8 +936,9 @@ export declare class AgentFramework {
|
|
|
787
936
|
/**
|
|
788
937
|
* The error a failed create() rejects with, once what it acquired is
|
|
789
938
|
* released: the framework it had begun is stopped, with
|
|
790
|
-
* FAILED_CREATE_TEARDOWN_TIMEOUT_MS as stop()'s teardownTimeoutMs,
|
|
791
|
-
*
|
|
939
|
+
* FAILED_CREATE_TEARDOWN_TIMEOUT_MS as stop()'s teardownTimeoutMs, the
|
|
940
|
+
* context managers it opened are closed, and a store create() opened is
|
|
941
|
+
* closed even when that stop failed or timed out.
|
|
792
942
|
* stop() keeps an owned store open when any of its waits fails or times
|
|
793
943
|
* out, so that it can be called again, but no one can call it on a
|
|
794
944
|
* framework that create() never returned. When the release doesn't finish
|
|
@@ -887,8 +1037,9 @@ export declare class AgentFramework {
|
|
|
887
1037
|
/** What start() and addModule() pass before either begins work of a
|
|
888
1038
|
* lifecycle. A stop() still running refuses both, from the moment it
|
|
889
1039
|
* claims its attempt until that attempt settles. A failed stop() has
|
|
890
|
-
* cleared its attempt, unless it closed an owned store,
|
|
891
|
-
*
|
|
1040
|
+
* cleared its attempt, unless it closed an owned store, or the context
|
|
1041
|
+
* managers it closes before that store, which are refused first. A
|
|
1042
|
+
* completed stop() is cleared, and the call goes on as before;
|
|
892
1043
|
* whether a lifecycle should begin after a stop() is #315's question. */
|
|
893
1044
|
private resetCompletedStop;
|
|
894
1045
|
/** Register before invoking the body, so the set holds the operation for
|
|
@@ -960,7 +1111,56 @@ export declare class AgentFramework {
|
|
|
960
1111
|
* under a surgery's hold, and no failure is reported for it.
|
|
961
1112
|
*/
|
|
962
1113
|
private withdrawMaintenanceWhenStopping;
|
|
1114
|
+
/**
|
|
1115
|
+
* Wakes the framework holds for `agentName` that need no new event: a
|
|
1116
|
+
* request already queued for it (it runs as soon as the agent is free) and
|
|
1117
|
+
* turns a provider cooldown holds until its end. The reply judge is told of
|
|
1118
|
+
* them beside the gate's own timers, so it can weigh what waiting costs.
|
|
1119
|
+
*/
|
|
1120
|
+
private upcomingWakesFor;
|
|
1121
|
+
/** The agents the heartbeat wakes: the residents, not conversation forks,
|
|
1122
|
+
* ephemeral runs or the subconscious, which keep windows of their own. */
|
|
1123
|
+
private heartbeatTargets;
|
|
1124
|
+
/**
|
|
1125
|
+
* The event a heartbeat wake is to the gate: a push from the server id
|
|
1126
|
+
* `heartbeat`, as heartbeat-mcpl's ticks and reminders were. So the
|
|
1127
|
+
* agent's rules govern it as they governed those (a rule matching
|
|
1128
|
+
* `source: "heartbeat"`, a `defer` default), and its sleep lets it through,
|
|
1129
|
+
* as it lets that server id through.
|
|
1130
|
+
*/
|
|
1131
|
+
private heartbeatGateEvent;
|
|
1132
|
+
/**
|
|
1133
|
+
* Deliver one of the heartbeat's wakes, as heartbeat-mcpl's push events
|
|
1134
|
+
* were: a message-mode tick's or a reminder's text is stored, and the gate
|
|
1135
|
+
* decides the wake by the agent's rules (heartbeatGateEvent), a sleep
|
|
1136
|
+
* letting it through as it lets that server's pushes through. A silent
|
|
1137
|
+
* tick stores no prompt: its turn, when the gate triggers one, is a silent
|
|
1138
|
+
* heartbeat (silent-heartbeat.ts), prose suppressed. As for a stored push,
|
|
1139
|
+
* the wake of the agent the text was delivered to is dropped once a
|
|
1140
|
+
* request of its own has carried and answered the text (readsWriteFor);
|
|
1141
|
+
* another resident's isn't tied to it.
|
|
1142
|
+
*/
|
|
1143
|
+
private deliverHeartbeat;
|
|
1144
|
+
/** Handle a call to one of the heartbeat's tools. */
|
|
1145
|
+
private dispatchHeartbeatToolCall;
|
|
1146
|
+
/**
|
|
1147
|
+
* Why `agentName` may not make this heartbeat call, or null when it may.
|
|
1148
|
+
* The heartbeat is the agent's, and wakes its residents: a conversation
|
|
1149
|
+
* fork, an ephemeral run or the subconscious may look at it, but not
|
|
1150
|
+
* change it or set a reminder that would wake someone else. Refused before
|
|
1151
|
+
* the tool runs, as a fork's sleep is.
|
|
1152
|
+
*/
|
|
1153
|
+
private heartbeatRefusal;
|
|
1154
|
+
/** Run a heartbeat call, its throw an error result. */
|
|
1155
|
+
private runHeartbeatTool;
|
|
963
1156
|
private auxiliaryMembraneFor;
|
|
1157
|
+
/**
|
|
1158
|
+
* The reply judge's calls. None waits: under the agent's holds a call is
|
|
1159
|
+
* refused without being made, and the agent's turn stops the judge. A call
|
|
1160
|
+
* that fails records the wait its provider states, if any, and holds
|
|
1161
|
+
* nothing else.
|
|
1162
|
+
*/
|
|
1163
|
+
private judgeMembraneFor;
|
|
964
1164
|
/**
|
|
965
1165
|
* A conversation agent's auxiliary calls (its context manager's
|
|
966
1166
|
* compression). A conversation agent takes no provider gate: admission
|
|
@@ -969,13 +1169,20 @@ export declare class AgentFramework {
|
|
|
969
1169
|
* as a resident's are, so they bind its auxiliary calls too: a held model
|
|
970
1170
|
* is refused without a call, and an auxiliary call's own stated wait is
|
|
971
1171
|
* recorded for it. (An ephemeral run records nothing, its name being
|
|
972
|
-
* single-use, so its context manager
|
|
1172
|
+
* single-use, so its context manager's calls are only withdrawn, as below,
|
|
1173
|
+
* through ephemeralAuxiliaryMembraneFor.) Its
|
|
973
1174
|
* compression is the background work a resident's is, whether a
|
|
974
1175
|
* maintenance tick or a drain after a message starts it, so it is withdrawn
|
|
975
1176
|
* as a resident's is: a call made while a surgery holds the store, or once
|
|
976
1177
|
* stop() has closed provider admission, is withdrawn without being sent.
|
|
977
1178
|
*/
|
|
978
1179
|
private conversationAuxiliaryMembraneFor;
|
|
1180
|
+
private ephemeralAuxiliaryMembraneFor;
|
|
1181
|
+
private withdrawnOnceReleased;
|
|
1182
|
+
private releaseManager;
|
|
1183
|
+
private trackManager;
|
|
1184
|
+
private closeManager;
|
|
1185
|
+
private closeOpenManagers;
|
|
979
1186
|
/** The framework's membrane, with each complete() call passed through
|
|
980
1187
|
* `admit` along with the model it names. */
|
|
981
1188
|
private membraneAdmitting;
|
|
@@ -986,7 +1193,8 @@ export declare class AgentFramework {
|
|
|
986
1193
|
* a stated 0, as in ProviderWaits: the 1 s floor, plus jitter. */
|
|
987
1194
|
private accelerationCooldownMs;
|
|
988
1195
|
/** Whether two requests are one wake, for a provider hold's dedup: the
|
|
989
|
-
* same agent, reason, source, time and channel,
|
|
1196
|
+
* same agent, reason, source, time and channel, on the same server (two
|
|
1197
|
+
* servers' channels can share an id), and the same coalescing
|
|
990
1198
|
* marks: a batch wake's subject, a batch-only merge's subjects (it has no
|
|
991
1199
|
* single subject), and the write a wake reads. A wake with any of them
|
|
992
1200
|
* can be withdrawn or dropped on its own, and must not stand for one
|
|
@@ -1015,7 +1223,8 @@ export declare class AgentFramework {
|
|
|
1015
1223
|
* - An ephemeral run's name is single-use, so a wait recorded for it would
|
|
1016
1224
|
* bind nothing, and its caller is waiting on it. A retryable stated wait
|
|
1017
1225
|
* up to PROVIDER_ACCELERATION_MAX_COOLDOWN_MS is left to the error policy,
|
|
1018
|
-
*
|
|
1226
|
+
* which sleeps and retries it unless it declines, as a host's own ceiling
|
|
1227
|
+
* can. A longer one, or one that can't be represented, ends
|
|
1019
1228
|
* the run now ('fail'): it is never retried before the provider's time,
|
|
1020
1229
|
* and the caller hears why at once.
|
|
1021
1230
|
* Anything else is the error policy's.
|
|
@@ -1254,6 +1463,10 @@ export declare class AgentFramework {
|
|
|
1254
1463
|
* a read-write workspace mount without an include for storage). */
|
|
1255
1464
|
private referenceFetcherInstance?;
|
|
1256
1465
|
private getReferenceFetcher;
|
|
1466
|
+
/** Configure an MCPL server: its config, for tool routing and the fetcher,
|
|
1467
|
+
* which reads a server's address and credential from it, and its address
|
|
1468
|
+
* in the reference registry, where a reference's stub reads it. */
|
|
1469
|
+
private setMcplServerConfig;
|
|
1257
1470
|
/** Register every RFC-005 reference in an MCPL peer's tool-result content
|
|
1258
1471
|
* against its server, then fetch by `mode`:
|
|
1259
1472
|
* - `register`: nothing. An in-process caller (executeMcplToolCall) may
|
|
@@ -1263,13 +1476,18 @@ export declare class AgentFramework {
|
|
|
1263
1476
|
* bound, so fetch_reference can fetch it.
|
|
1264
1477
|
* - `model`: eagerly fetch the ones inside the autofetch envelope (below
|
|
1265
1478
|
* the eager ceiling, connection origin — never worse than the server
|
|
1266
|
-
* having inlined the bytes
|
|
1267
|
-
*
|
|
1268
|
-
*
|
|
1479
|
+
* having inlined the bytes, for a reference whose claim is true; a fetch
|
|
1480
|
+
* it starts stops reading at the first chunk past that ceiling).
|
|
1481
|
+
* Failures are non-fatal: the stub then says fetch_reference instead of
|
|
1482
|
+
* a path, and the eager default doesn't choose that reference again.
|
|
1483
|
+
* - `script`: as `model`, then fetch every reference but a link ("eagerly lazy"): a
|
|
1269
1484
|
* script receiving a result is the strongest available signal that the
|
|
1270
1485
|
* bytes are wanted (scripts process, they do not browse), so the stub it
|
|
1271
1486
|
* receives carries a workspace path it can open directly.
|
|
1272
|
-
* A uri the result calls expired is fetched in no mode
|
|
1487
|
+
* A uri the result calls expired is fetched in no mode: by its blocks, or
|
|
1488
|
+
* by `claims` where given, those of everything a script's view of it
|
|
1489
|
+
* shows (scriptViewClaims), nested fields included, as the module
|
|
1490
|
+
* route's demand fetch reads them (Ada-1017, room-203 #201013). */
|
|
1273
1491
|
private autoFetchReferences;
|
|
1274
1492
|
/** Core agent_settings keys — extension keys must not collide with these. */
|
|
1275
1493
|
private static readonly AGENT_SETTINGS_CORE_KEYS;
|
|
@@ -1284,6 +1502,74 @@ export declare class AgentFramework {
|
|
|
1284
1502
|
private spillSettingsExtension;
|
|
1285
1503
|
private captureInferenceToolSnapshot;
|
|
1286
1504
|
private toolResultGuardSettingsExtension;
|
|
1505
|
+
/** Whether the agent wants the note on words that land in a closed channel:
|
|
1506
|
+
* on unless they've turned it off with agent_settings. */
|
|
1507
|
+
private closedChannelNoteOn;
|
|
1508
|
+
private closedChannelNoteSettingsExtension;
|
|
1509
|
+
/** What `who` is told when their words go to a channel that stays closed
|
|
1510
|
+
* because it closed or declined the channel itself (ChannelRegistry
|
|
1511
|
+
* closedByAgent), or undefined where nothing needs saying. Speech also
|
|
1512
|
+
* leaves a channel a module closed as it stands (speechOpens), but there
|
|
1513
|
+
* the module's own tool is the way back. Every other closed channel opens
|
|
1514
|
+
* on speech where this host directs its server's lifecycle, as it always
|
|
1515
|
+
* did, so the agent meets the change here, where speaking used to reopen
|
|
1516
|
+
* what it had closed. The channel is read on the server the words went
|
|
1517
|
+
* to. A channel whose transport is open, as when its server refused the
|
|
1518
|
+
* agent's close, gets none, since its traffic still flows.
|
|
1519
|
+
*
|
|
1520
|
+
* The rest is judged for its reader, as the opened notices' advice is
|
|
1521
|
+
* (channelOpenedNotices). That messages addressing it still reach it is
|
|
1522
|
+
* said where they land in its window: a push, and off a host that routes
|
|
1523
|
+
* conversations a channel's incoming message, is stored with the delivery
|
|
1524
|
+
* agent, where the residents' shared slot is read (residentHoldsTraffic),
|
|
1525
|
+
* and an ephemeral run's window is its own. What a closed channel
|
|
1526
|
+
* delivers beyond those is the connector's (slack-mcpl delivers ambient
|
|
1527
|
+
* traffic by its own subscription), so the note promises only those. One
|
|
1528
|
+
* connector state the host can't see makes that sentence false: a channel
|
|
1529
|
+
* muted with discord-mcpl's mute_channel delivers nothing, messages that
|
|
1530
|
+
* address the agent included. The agent that muted it knows. channel_open
|
|
1531
|
+
* is offered where the reader may call it (canAgentUseTool) and this host
|
|
1532
|
+
* may open the channel: everywhere but a server that's up without
|
|
1533
|
+
* channels.lifecycle (lifecycleWithheld), since a reconnecting server's
|
|
1534
|
+
* grant is empty only until its next exchange, and the note stays in the
|
|
1535
|
+
* window after that. */
|
|
1536
|
+
private closedChannelNoteFor;
|
|
1537
|
+
/** What an agent is told when a send tool's words go to a channel it tuned
|
|
1538
|
+
* out, or undefined where nothing needs saying. A send keeps the tune-out
|
|
1539
|
+
* (ChannelRegistry.openChannelNow), so the agent that sent there expecting
|
|
1540
|
+
* answers learns they still go to its subconscious. A send tool's answer
|
|
1541
|
+
* carries this, send_dm's included, or for a code_execution script's send
|
|
1542
|
+
* a notice in the agent's window: a tune-out diverts a DM too. The same setting
|
|
1543
|
+
* turns it off, a conversation agent gets none, and a failure while
|
|
1544
|
+
* working it out is logged and adds nothing, as for the closed-channel
|
|
1545
|
+
* note. */
|
|
1546
|
+
private tunedOutSendNote;
|
|
1547
|
+
/** How to stop the closed-channel note, said once wherever it appears, to
|
|
1548
|
+
* a reader that may call agent_settings (canAgentUseTool), with the space
|
|
1549
|
+
* before it; nothing to one that may not. */
|
|
1550
|
+
private closedChannelNoteOff;
|
|
1551
|
+
/** The closed-channel notes for an agent's words that landed in these
|
|
1552
|
+
* channels, or none when they've turned the note off. A conversation agent
|
|
1553
|
+
* gets none: channel_open is refused to it and its settings end with its
|
|
1554
|
+
* conversation, so neither what the note offers nor turning it off is its
|
|
1555
|
+
* own, and the resident that owns the channel gets the note for its own
|
|
1556
|
+
* words. The note is advice: if working it out fails, the words were still
|
|
1557
|
+
* delivered, so that's logged and nothing is added. */
|
|
1558
|
+
private closedChannelNotes;
|
|
1559
|
+
/**
|
|
1560
|
+
* A send tool's answer, with the closed-channel note where its words
|
|
1561
|
+
* stayed in a channel the agent closed or declined itself, or the tune-out
|
|
1562
|
+
* line where they went to one it tuned out, after the server's own words:
|
|
1563
|
+
* one more text block where the answer is a list of blocks, or a paragraph
|
|
1564
|
+
* where it's text. A code_execution script's send (`forScript`) keeps the
|
|
1565
|
+
* server's answer alone, since the script parses it, and the agent whose
|
|
1566
|
+
* script sent is told in its own window instead, as a notice. The channel
|
|
1567
|
+
* is the one the send went to on its server (resolveSendTarget), from the
|
|
1568
|
+
* id the send's answer or its call named. The note is advice: if working it
|
|
1569
|
+
* out fails, or the window can't take the notice, that's logged, and the
|
|
1570
|
+
* answer stays as it was.
|
|
1571
|
+
*/
|
|
1572
|
+
private noteSendIntoKeptChannel;
|
|
1287
1573
|
/** Every guard's annotation still running, for stop() (agent-framework #277). */
|
|
1288
1574
|
private readonly guardAnnotations;
|
|
1289
1575
|
/** Each guard that isn't idle, by agent name, as the guard reports it. An
|
|
@@ -1382,6 +1668,7 @@ export declare class AgentFramework {
|
|
|
1382
1668
|
cancelAgentRuntimeSettingsTransition(agentName: string, opts?: {
|
|
1383
1669
|
requester?: OperatorRequester;
|
|
1384
1670
|
}): AgentRuntimeSettingsSnapshot;
|
|
1671
|
+
private refuseRuntimeSettingsChangeUnderHold;
|
|
1385
1672
|
/**
|
|
1386
1673
|
* Wakes that passed the scheduler and now own provider admission while
|
|
1387
1674
|
* waiting for an in-flight auxiliary call to settle — no turn token yet,
|
|
@@ -1650,10 +1937,9 @@ export declare class AgentFramework {
|
|
|
1650
1937
|
* delegates to `Agent.buildActivationRequest`. No tokens are spent, no
|
|
1651
1938
|
* external MCPL server is contacted, no fold resolution is persisted and
|
|
1652
1939
|
* none of the compression its fold plan calls for is queued; the consumed
|
|
1653
|
-
* watermark and any prepared budget change are left alone; and
|
|
1654
|
-
*
|
|
1655
|
-
*
|
|
1656
|
-
* acceptance. In context-manager 0.14 its dry run leaves nothing else
|
|
1940
|
+
* watermark and any prepared budget change are left alone; and with the
|
|
1941
|
+
* thinking binding (`thinkingBinding.binds`), no binding record is
|
|
1942
|
+
* written. In context-manager 0.14 its dry run leaves nothing else
|
|
1657
1943
|
* behind but the release of an expired compression hold, as any compile
|
|
1658
1944
|
* does (see `Agent.compileWithInjections`). The preview keeps in-memory
|
|
1659
1945
|
* bookkeeping of its own, such as handing the context manager the
|
|
@@ -1679,6 +1965,16 @@ export declare class AgentFramework {
|
|
|
1679
1965
|
*
|
|
1680
1966
|
* Pass `{ injections: true }` to opt into full-fidelity gathering and accept
|
|
1681
1967
|
* those side effects (byte-faithful to a real activation's injected context).
|
|
1968
|
+
* An `afterUser` injection a start would store (stored-injections.ts) is
|
|
1969
|
+
* shown where that start's compile would render it, and one it would skip
|
|
1970
|
+
* isn't shown again; nothing is stored. The stand-in isn't weighed against
|
|
1971
|
+
* the budget or shaped as the stored row would be, so where the strategy
|
|
1972
|
+
* would cap, shard or leave out rows to fit it, the start's request
|
|
1973
|
+
* differs from the preview.
|
|
1974
|
+
*
|
|
1975
|
+
* What the dry compile selected, by kind, is `getRequestCompileStats` of the
|
|
1976
|
+
* request this returns. It doesn't count the stand-in, which is added after
|
|
1977
|
+
* the compile.
|
|
1682
1978
|
*/
|
|
1683
1979
|
previewActivation(agentName: string, opts?: {
|
|
1684
1980
|
injections?: boolean;
|
|
@@ -1747,11 +2043,21 @@ export declare class AgentFramework {
|
|
|
1747
2043
|
getModule(name: string): Module | null;
|
|
1748
2044
|
/**
|
|
1749
2045
|
* Add or replace (upsert) a gate policy at runtime. Validated and persisted
|
|
1750
|
-
* to gate.json; hot-applied in memory.
|
|
1751
|
-
*
|
|
1752
|
-
*
|
|
1753
|
-
*
|
|
1754
|
-
*
|
|
2046
|
+
* to gate.json; hot-applied in memory. Placement: `'prepend'` puts a rule
|
|
2047
|
+
* ahead of EVERYTHING (including addressed-message wake rules — see
|
|
2048
|
+
* EventGate.lintShadows); `{before: name}` / `{after: name}` anchor it
|
|
2049
|
+
* against a specific rule, which is usually what a sampler or debounce
|
|
2050
|
+
* actually wants. Every rule the change doesn't touch is written back as it
|
|
2051
|
+
* was written. Over a gate.json the gate doesn't use, the change is written
|
|
2052
|
+
* only if gate.json then loads, as when it replaces or removes the rule that
|
|
2053
|
+
* keeps it out. Fields the gate reads nowhere, and that aren't a slip of one
|
|
2054
|
+
* it does, are left out, and named to `onIgnoredFields`, called once the
|
|
2055
|
+
* change is made; a throw from it is logged, not thrown. Throws if no gate is
|
|
2056
|
+
* configured, the policy is invalid, the placement can't be made, gate.json
|
|
2057
|
+
* has no rule list a change could edit, it isn't used and the change doesn't
|
|
2058
|
+
* mend it, or it can't be read, isn't JSON or can't be written
|
|
2059
|
+
* (EventGate.addPolicy). A refusal leaves gate.json as it is; a write that
|
|
2060
|
+
* fails after its open may leave it part-written, and its error says so.
|
|
1755
2061
|
*/
|
|
1756
2062
|
addGatePolicy(rawPolicy: unknown, options?: {
|
|
1757
2063
|
position?: 'append' | 'prepend' | {
|
|
@@ -1759,10 +2065,14 @@ export declare class AgentFramework {
|
|
|
1759
2065
|
} | {
|
|
1760
2066
|
after: string;
|
|
1761
2067
|
};
|
|
2068
|
+
onIgnoredFields?: (notes: string[]) => void;
|
|
1762
2069
|
}): import('./gate/types.js').GatePolicy;
|
|
1763
2070
|
/**
|
|
1764
2071
|
* Remove a gate policy by name at runtime. Returns false if it didn't exist.
|
|
1765
|
-
* Throws if no gate is configured.
|
|
2072
|
+
* Throws if no gate is configured, gate.json has no rule list a change could
|
|
2073
|
+
* edit, it isn't used and the removal doesn't mend it, or it can't be read,
|
|
2074
|
+
* isn't JSON or can't be written (EventGate.removePolicy); the rules in
|
|
2075
|
+
* force then stay as they were.
|
|
1766
2076
|
*/
|
|
1767
2077
|
removeGatePolicy(name: string): boolean;
|
|
1768
2078
|
/** Current gate policy names (freshest on-disk view). Empty when no gate. */
|
|
@@ -1798,7 +2108,7 @@ export declare class AgentFramework {
|
|
|
1798
2108
|
private readAgentRuntimeSettings;
|
|
1799
2109
|
private validatePersistedAgentRuntimeSettings;
|
|
1800
2110
|
/** Load resident-set inline caps from framework state, dropping (loudly)
|
|
1801
|
-
* anything
|
|
2111
|
+
* anything Number() doesn't read as a finite number of at least 1000. A
|
|
1802
2112
|
* failed read is logged and boot goes on without them: nothing is lost,
|
|
1803
2113
|
* since persistToolResultInlineCap reads the stored caps again before it
|
|
1804
2114
|
* writes one. */
|
|
@@ -1883,7 +2193,13 @@ export declare class AgentFramework {
|
|
|
1883
2193
|
* `{namespace}/messages`, context log to `{namespace}/context`.
|
|
1884
2194
|
*
|
|
1885
2195
|
* Data persists after cleanup for investigation and cross-revert.
|
|
1886
|
-
* Call cleanup() when done
|
|
2196
|
+
* Call cleanup() when done with the agent: the agent can't run again. From
|
|
2197
|
+
* the run's end, or from cleanup(), its ContextManager makes no provider
|
|
2198
|
+
* call, and the calls it has out are aborted. It starts no new call while a
|
|
2199
|
+
* surgery holds the store or once stop() has begun, either; one already out
|
|
2200
|
+
* then runs on until stop(), with a store the framework owns, closes the
|
|
2201
|
+
* ContextManager, before the store. Until then the ContextManager stays
|
|
2202
|
+
* open.
|
|
1887
2203
|
*/
|
|
1888
2204
|
createEphemeralAgent(config: AgentConfig): Promise<{
|
|
1889
2205
|
agent: Agent;
|
|
@@ -1921,8 +2237,9 @@ export declare class AgentFramework {
|
|
|
1921
2237
|
* framework drives the stream (emitting traces, logging, dispatching tools).
|
|
1922
2238
|
* Returns the agent's speech output when it finishes (no more tool calls).
|
|
1923
2239
|
* Rejects with ProviderWaitNotSleptError when the run ends rather than sleep
|
|
1924
|
-
* a retryable failure's stated wait
|
|
1925
|
-
*
|
|
2240
|
+
* a retryable failure's stated wait longer than the framework's ten-minute
|
|
2241
|
+
* cap, or one it can't represent, and with a plain Error for any other
|
|
2242
|
+
* ending, a stated wait its error policy declines among them.
|
|
1926
2243
|
*
|
|
1927
2244
|
* The caller provides a pre-created agent + contextManager (from createEphemeralAgent).
|
|
1928
2245
|
* The task message should already be in the context manager.
|
|
@@ -1953,6 +2270,7 @@ export declare class AgentFramework {
|
|
|
1953
2270
|
* hot-reloaded gate.json (same validation as load), so a rule takes effect
|
|
1954
2271
|
* immediately and survives restart. */
|
|
1955
2272
|
private static readonly WAKE_RULE_TOOLS;
|
|
2273
|
+
private static readonly JUDGED_WAKE_RULE_TOOLS;
|
|
1956
2274
|
/** Discoverability for event tags (MCPL RFC-001): the reserved chat:* core,
|
|
1957
2275
|
* each connected server's declared tag ontology, and gate.js status. */
|
|
1958
2276
|
private static readonly EVENT_TAGS_TOOL;
|
|
@@ -1986,26 +2304,13 @@ export declare class AgentFramework {
|
|
|
1986
2304
|
* Mark an inference refusal visibly: react on the message that holds the
|
|
1987
2305
|
* refused agent's conversational locus (the most recent incoming channel
|
|
1988
2306
|
* message that isn't a reaction, reaction removal, edit or deletion
|
|
1989
|
-
* marker, apart from an edit the coalescer delivers on acceptance as the
|
|
2307
|
+
* marker or a chat:system notice, apart from an edit the coalescer delivers on acceptance as the
|
|
1990
2308
|
* agent's first view; an ephemeral run has none, so a subagent's refusal
|
|
1991
2309
|
* marks no message) with a category-specific emoji. Best-effort —
|
|
1992
2310
|
* failures are logged, never thrown, and non-Discord loci are silently
|
|
1993
2311
|
* skipped.
|
|
1994
2312
|
*/
|
|
1995
2313
|
private reactToRefusal;
|
|
1996
|
-
/**
|
|
1997
|
-
* Shed the newest turn: remove the newest message that isn't a system
|
|
1998
|
-
* message, whoever wrote it, with the rest of its exchange (the tool_use
|
|
1999
|
-
* turn paired with a tool result, and the whole of a body stored in
|
|
2000
|
-
* shards). It adds no marker; the caller keeps one consolidated marker for
|
|
2001
|
-
* the episode (updateRewindMarker). The returned record's descriptor says
|
|
2002
|
-
* what was removed and its size, never the content, while the raw record
|
|
2003
|
-
* survives in the chronicle log for forensics. Returns null when only
|
|
2004
|
-
* system messages remain.
|
|
2005
|
-
*
|
|
2006
|
-
* Shared by the refusal rewind, automatic or forced by `/unstick`, and by
|
|
2007
|
-
* the shed after inference exhaustion (quarantinePoisonedHistory).
|
|
2008
|
-
*/
|
|
2009
2314
|
private shedNewestTurn;
|
|
2010
2315
|
/**
|
|
2011
2316
|
* Maintain exactly ONE consolidated marker for the current rewind episode,
|
|
@@ -2049,8 +2354,11 @@ export declare class AgentFramework {
|
|
|
2049
2354
|
ok: boolean;
|
|
2050
2355
|
error?: string;
|
|
2051
2356
|
agentName?: string;
|
|
2052
|
-
/** Agent state at queue time — 'idle' means
|
|
2053
|
-
*
|
|
2357
|
+
/** Agent state at queue time — 'idle' means no turn holds the agent, so
|
|
2358
|
+
* the turn starts on the next scheduler pass unless a provider hold (a
|
|
2359
|
+
* provider's stated wait, or a capacity cooldown) holds it until the hold
|
|
2360
|
+
* ends, or a start of the agent's that waits for an auxiliary call to
|
|
2361
|
+
* finish goes first; anything else means it runs after the current turn. */
|
|
2054
2362
|
agentStatus?: string;
|
|
2055
2363
|
/** True when the host is quiesced: the wake is PARKED, not running, until resume(). */
|
|
2056
2364
|
quiesced?: boolean;
|
|
@@ -2078,7 +2386,7 @@ export declare class AgentFramework {
|
|
|
2078
2386
|
* return the snapshot; the operator lever for draining quarantine or
|
|
2079
2387
|
* advancing merges during a quiesce window.
|
|
2080
2388
|
*
|
|
2081
|
-
* host-status — report the quiesce state (drained /
|
|
2389
|
+
* host-status — report the quiesce state (drained / waiting wakes /
|
|
2082
2390
|
* scripts left running).
|
|
2083
2391
|
*
|
|
2084
2392
|
* release-provider-wait — end an agent's provider wait (a provider's
|
|
@@ -2133,6 +2441,14 @@ export declare class AgentFramework {
|
|
|
2133
2441
|
* turn alive (no continuation or held retry of one on its way), or it is
|
|
2134
2442
|
* refused (OperatorActionError 'agent-busy'), and no turn starts until the
|
|
2135
2443
|
* switch is done.
|
|
2444
|
+
*
|
|
2445
|
+
* Every agent's context manager is re-initialized for the branch before
|
|
2446
|
+
* the store is released (reinitializeManagers). One whose
|
|
2447
|
+
* re-initialization fails raises an ops alert naming its agent
|
|
2448
|
+
* (`context-reinit-failed`), and the switch still resolves. A switch to the
|
|
2449
|
+
* branch the store is already on re-initializes them too, which is how a
|
|
2450
|
+
* manager left refusing by a failed re-initialization is recovered without
|
|
2451
|
+
* a restart.
|
|
2136
2452
|
*/
|
|
2137
2453
|
switchBranch(name: string): Promise<void>;
|
|
2138
2454
|
/**
|
|
@@ -2144,12 +2460,30 @@ export declare class AgentFramework {
|
|
|
2144
2460
|
*
|
|
2145
2461
|
* The undone branch is saved so `redo()` can restore it.
|
|
2146
2462
|
* Returns the checkpoint that was undone, or null if nothing to undo.
|
|
2463
|
+
*
|
|
2464
|
+
* The branch moves under every agent sharing the store, so an undo
|
|
2465
|
+
* reserves the store as a surgery does: every agent must be idle, or it is
|
|
2466
|
+
* refused (OperatorActionError 'agent-busy'). It returns once the store has
|
|
2467
|
+
* moved, and the store stays reserved until every agent's context manager
|
|
2468
|
+
* is re-initialized for the new branch, so no turn starts before then. One
|
|
2469
|
+
* whose re-initialization fails raises an ops alert naming its agent
|
|
2470
|
+
* (`context-reinit-failed`). An undo or redo made before the managers are
|
|
2471
|
+
* done moves the store again under the same reservation, and they are
|
|
2472
|
+
* re-initialized for the branch the last one leaves.
|
|
2473
|
+
*
|
|
2474
|
+
* `settled`, present when the store moved, settles once that reservation
|
|
2475
|
+
* is released, every manager re-initialized or its failure alerted, and
|
|
2476
|
+
* never rejects. Await it before work that needs the store free: a
|
|
2477
|
+
* compile on an agent's own context manager, or a write meant to land at
|
|
2478
|
+
* once, which the reservation would defer. An undo or redo that moves the
|
|
2479
|
+
* store again under the same reservation settles with it.
|
|
2147
2480
|
*/
|
|
2148
2481
|
undoLastTurn(agentName: string, requester?: OperatorRequester): {
|
|
2149
2482
|
undone: boolean;
|
|
2150
2483
|
turnIndex?: number;
|
|
2151
2484
|
fromBranch?: string;
|
|
2152
2485
|
toBranch?: string;
|
|
2486
|
+
settled?: Promise<void>;
|
|
2153
2487
|
};
|
|
2154
2488
|
/** undoLastTurn's work, for a host/command undo already admitted: a stop()
|
|
2155
2489
|
* begun by a trace of one of its turns doesn't refuse the next. */
|
|
@@ -2159,11 +2493,15 @@ export declare class AgentFramework {
|
|
|
2159
2493
|
*
|
|
2160
2494
|
* Switches back to the branch that was active before the last undo.
|
|
2161
2495
|
* Returns false if there's nothing to redo.
|
|
2496
|
+
*
|
|
2497
|
+
* It reserves the store and re-initializes every agent's context manager
|
|
2498
|
+
* as undoLastTurn() does, and its result's `settled` is undoLastTurn()'s.
|
|
2162
2499
|
*/
|
|
2163
2500
|
redo(agentName: string, requester?: OperatorRequester): {
|
|
2164
2501
|
redone: boolean;
|
|
2165
2502
|
fromBranch?: string;
|
|
2166
2503
|
toBranch?: string;
|
|
2504
|
+
settled?: Promise<void>;
|
|
2167
2505
|
};
|
|
2168
2506
|
/**
|
|
2169
2507
|
* Append a record to the operator action log and broadcast it as an
|
|
@@ -2203,6 +2541,13 @@ export declare class AgentFramework {
|
|
|
2203
2541
|
* does. Always release in `finally`: a token nobody clears wedges the fleet.
|
|
2204
2542
|
*/
|
|
2205
2543
|
private reserveStoreForSurgery;
|
|
2544
|
+
private reinitializeManagers;
|
|
2545
|
+
private reportLongHold;
|
|
2546
|
+
private disposeEmptiedForks;
|
|
2547
|
+
private reportReinitFailures;
|
|
2548
|
+
private reportReinitFailure;
|
|
2549
|
+
private beginSyncMove;
|
|
2550
|
+
private reinitializeAfterSyncMove;
|
|
2206
2551
|
/**
|
|
2207
2552
|
* A surgery's marker batch, recorded before its body change. If it can't
|
|
2208
2553
|
* be recorded, the surgery doesn't start, and the error says what the
|
|
@@ -2511,6 +2856,7 @@ export declare class AgentFramework {
|
|
|
2511
2856
|
* the template ("trunk") is a dormant warm checkpoint, not a listener.
|
|
2512
2857
|
*/
|
|
2513
2858
|
private routeConversationIncoming;
|
|
2859
|
+
private writeToFork;
|
|
2514
2860
|
/**
|
|
2515
2861
|
* Spawn a persistent per-channel conversation agent ("fork") from the
|
|
2516
2862
|
* template agent: own ContextManager under `conversations/{name}`, seeded
|
|
@@ -2543,13 +2889,15 @@ export declare class AgentFramework {
|
|
|
2543
2889
|
* Store the router's counters with the spawn's generation, create the fork
|
|
2544
2890
|
* the decision names and bind its channel to it, registered in
|
|
2545
2891
|
* conversationSpawns under the channel until it settles. The store runs
|
|
2546
|
-
* inside the spawn's promise,
|
|
2547
|
-
*
|
|
2548
|
-
*
|
|
2549
|
-
* the
|
|
2550
|
-
*
|
|
2551
|
-
*
|
|
2552
|
-
*
|
|
2892
|
+
* inside the spawn's promise, after it waits out a move's hold, so the
|
|
2893
|
+
* counter lands on the branch the fork is created on; with no hold up, it
|
|
2894
|
+
* runs in routeConversation's synchronous step. Either way a store that
|
|
2895
|
+
* throws rejects the spawn, which each caller reports as a failed spawn,
|
|
2896
|
+
* rather than throwing out of routeConversation before the caller's try.
|
|
2897
|
+
* routeConversation registers a spawn only when none is in flight for the
|
|
2898
|
+
* channel, and only this spawn's settlement removes it, so the entry it
|
|
2899
|
+
* removes is its own. It's removed before anyone waiting on it resumes, so
|
|
2900
|
+
* a waiter that decides again doesn't find it.
|
|
2553
2901
|
*
|
|
2554
2902
|
* It binds only while the fork it created is still the agent registered
|
|
2555
2903
|
* under its name. stop() ends each live fork and unbinds the channels
|
|
@@ -2582,8 +2930,9 @@ export declare class AgentFramework {
|
|
|
2582
2930
|
* and keeping the agent registered would just grow every agent scan and
|
|
2583
2931
|
* broadcast filter forever. Its window is released now, or, while the host
|
|
2584
2932
|
* is quiesced, at resume (releaseWindowNowOrAfterResume); when stop() ends
|
|
2585
|
-
* it then, stop()'s pass for postponed releases passes on
|
|
2586
|
-
*
|
|
2933
|
+
* it then, stop()'s pass for postponed releases passes on what it left
|
|
2934
|
+
* unread that the primary takes in its place instead (passesToPrimary:
|
|
2935
|
+
* failed replies, channel notices, module writes). No binding names it
|
|
2587
2936
|
* by then: the idle sweep unbinds its channel as the closure begins,
|
|
2588
2937
|
* stop() unbinds it just before it ends the fork, and a spawn whose fork
|
|
2589
2938
|
* stop() has ended binds nothing (spawnConversationAgent). The fork's
|
|
@@ -2643,14 +2992,22 @@ export declare class AgentFramework {
|
|
|
2643
2992
|
* only that messages addressing the agent reach it whether or not it opens
|
|
2644
2993
|
* the channel: it is shown only when one has arrived from a closed channel,
|
|
2645
2994
|
* and both servers deliver them either way. What else arrives is for the
|
|
2646
|
-
* server to say on its push. Option 1 says a reply
|
|
2647
|
-
*
|
|
2648
|
-
*
|
|
2649
|
-
*
|
|
2650
|
-
*
|
|
2651
|
-
* (discord-mcpl sends
|
|
2652
|
-
*
|
|
2653
|
-
* decision time.
|
|
2995
|
+
* server to say on its push. Option 1 says what a reply does, which
|
|
2996
|
+
* speechOpens decides: a reply opens a closed channel nobody decided to keep
|
|
2997
|
+
* closed, and leaves one the agent closed or declined itself closed. What
|
|
2998
|
+
* else reaches the agent from a channel left closed is its server's to say
|
|
2999
|
+
* on its push, so the option says nothing about it. When the surface tracks
|
|
3000
|
+
* a missed-ambient tally (discord-mcpl sends
|
|
3001
|
+
* `missedMessages`/`missedCharacters` in push origin), the invitation shows
|
|
3002
|
+
* the count — the cost of staying out, as a number, at decision time.
|
|
3003
|
+
*
|
|
3004
|
+
* No invitation on a direct message (`chat:dm`): every message of a DM is
|
|
3005
|
+
* addressed, so it reaches the agent open or closed, and there is nothing
|
|
3006
|
+
* to miss or open. A DM registers closed, and stays closed until the agent
|
|
3007
|
+
* answers it, or for good once the agent closes it, so without this a DM
|
|
3008
|
+
* would carry the block. The tag describes the message, not the channel:
|
|
3009
|
+
* a whisper tagged `chat:dm` inside a shared channel that is closed
|
|
3010
|
+
* carries no invitation either.
|
|
2654
3011
|
*/
|
|
2655
3012
|
private buildClosedChannelInvitation;
|
|
2656
3013
|
/**
|
|
@@ -2740,7 +3097,8 @@ export declare class AgentFramework {
|
|
|
2740
3097
|
/** Queue a wake for each agent of the batch's audience, when its latest
|
|
2741
3098
|
* occurrence triggers inference. `plain`: an ordinary push wake, without
|
|
2742
3099
|
* the subject a withdrawal of the batch's wakes goes by, for a render
|
|
2743
|
-
* placed in its agent's deferred queue (wakeToRead), at `readsDeferredWrite
|
|
3100
|
+
* placed in its agent's deferred queue (wakeToRead), at `readsDeferredWrite`,
|
|
3101
|
+
* marked ambient when every notice the render folds was (`allAmbient`). */
|
|
2744
3102
|
private queueCoalescedWakes;
|
|
2745
3103
|
/** Withdraw unstarted wakes whose sole cause is this subject (§4.2). */
|
|
2746
3104
|
private cancelCoalescedWakes;
|
|
@@ -2776,6 +3134,34 @@ export declare class AgentFramework {
|
|
|
2776
3134
|
* a fork is that fork's conversation, so no other agent takes it.
|
|
2777
3135
|
*/
|
|
2778
3136
|
private mayTakeGateRoute;
|
|
3137
|
+
/**
|
|
3138
|
+
* The one channel a wake's channel names: `channelId` on `serverId` when
|
|
3139
|
+
* the wake gives its server, otherwise the one registered channel that id,
|
|
3140
|
+
* or its server-qualified name, means (ChannelRegistry.channelsNamed).
|
|
3141
|
+
* Undefined when it means none or several: channel ids are unique only
|
|
3142
|
+
* within one server's connection (MCPL §14.2), and a name two servers'
|
|
3143
|
+
* channels answer to is never resolved to either.
|
|
3144
|
+
*/
|
|
3145
|
+
private channelNamed;
|
|
3146
|
+
/**
|
|
3147
|
+
* Explicit mode's typing channel for one start of a turn, which has no
|
|
3148
|
+
* locus, read once as the start opens (driveStream then shows what the
|
|
3149
|
+
* start showed, TurnRouting.typing): where that start's wake came from,
|
|
3150
|
+
* its trigger's channel with its server (channelNamed), so a start batched
|
|
3151
|
+
* with a new wake shows typing where that wake came from. Not the turn's
|
|
3152
|
+
* trigger channel, which a channel_open moves as the turn's default
|
|
3153
|
+
* outgoing channel. A start whose wake names no one channel, as a budget
|
|
3154
|
+
* restart's or a re-inference's names none, keeps the channel the turn
|
|
3155
|
+
* shows typing in (TurnRouting.typing), showing it again where a stop or
|
|
3156
|
+
* a failed start ended the indicator, since the turn is still at work
|
|
3157
|
+
* there; a turn that has shown none, as a heartbeat's, shows none. A guard
|
|
3158
|
+
* retry's wake is its start's, read again. In a turn that has no channel
|
|
3159
|
+
* (TurnRouting.noChannel), a wake named without its server isn't read: a
|
|
3160
|
+
* retry's trigger names it again, and reading it then could take a
|
|
3161
|
+
* channel the turn never had. A wake that gives its server, as every one
|
|
3162
|
+
* the framework makes for a channel does, names that pair.
|
|
3163
|
+
*/
|
|
3164
|
+
private explicitTypingChannel;
|
|
2779
3165
|
/**
|
|
2780
3166
|
* Derive the MCPL composite channel id (the outbound routing locus) for a
|
|
2781
3167
|
* push event from its server-defined `origin`, if it carries one.
|
|
@@ -2822,7 +3208,10 @@ export declare class AgentFramework {
|
|
|
2822
3208
|
/** Record plain-prose segments this turn suppressed without drafts (proseRouting=disabled, or a round withheld before its scripts returned). */
|
|
2823
3209
|
private recordProseSuppression;
|
|
2824
3210
|
/**
|
|
2825
|
-
* Silenced plain speech: an explicit send
|
|
3211
|
+
* Silenced plain speech: an explicit send that may have posted where it was
|
|
3212
|
+
* going holds it as resendable drafts (in a round that calls `drafts` and
|
|
3213
|
+
* sends nothing else, 'kept', its plain speech is kept and counted
|
|
3214
|
+
* instead); a
|
|
2826
3215
|
* deliberate silence (skip_reply, a silent turn, or a private think in
|
|
2827
3216
|
* the same native round, where that policy applies: an XML-mode round has
|
|
2828
3217
|
* no verbatim content to route live, so its prose is routed at the turn's
|
|
@@ -2830,9 +3219,12 @@ export declare class AgentFramework {
|
|
|
2830
3219
|
* counted for the receipt, never drafted. `segments` are the runs exactly
|
|
2831
3220
|
* as written (splitProseRuns), so a draft keeps the resident's words byte
|
|
2832
3221
|
* for byte. What it holds, keeps or moves is the round's turn's
|
|
2833
|
-
* (round.routing), whenever the hold runs.
|
|
3222
|
+
* (round.routing), whenever the hold runs. Hybrid speech under a send goes
|
|
3223
|
+
* through routeSilencedHybrid.
|
|
2834
3224
|
*/
|
|
2835
3225
|
private holdSilencedProse;
|
|
3226
|
+
private routeSilencedHybrid;
|
|
3227
|
+
private sendHoldText;
|
|
2836
3228
|
/**
|
|
2837
3229
|
* Hold plain speech as drafts (src/prose-drafts.ts) instead of
|
|
2838
3230
|
* letting it vanish: journaled durably and recorded for the receipt of the
|
|
@@ -2851,7 +3243,9 @@ export declare class AgentFramework {
|
|
|
2851
3243
|
private draftTime;
|
|
2852
3244
|
/** A draft's opening words, for the drafts tool's listing only. */
|
|
2853
3245
|
private static draftPreview;
|
|
2854
|
-
|
|
3246
|
+
/** A destination as the agent is shown it: its label, with its name as
|
|
3247
|
+
* ChannelRegistry.nameShown gives it. */
|
|
3248
|
+
private destinationText;
|
|
2855
3249
|
/** One line per draft: id, state, when, why, size, preview. */
|
|
2856
3250
|
private draftLine;
|
|
2857
3251
|
/** A draft's state in words that claim only what is known. */
|
|
@@ -2882,6 +3276,16 @@ export declare class AgentFramework {
|
|
|
2882
3276
|
* queue names.
|
|
2883
3277
|
*/
|
|
2884
3278
|
private noticeUnnoticedDrafts;
|
|
3279
|
+
/**
|
|
3280
|
+
* Turn start, every one: where the agent's history holds neither its
|
|
3281
|
+
* latest direct write to a mount nor the notice of its departure
|
|
3282
|
+
* from it, as after an undo or another move of the store's head away from
|
|
3283
|
+
* that write, the workspace's notice that those writes are still on disk
|
|
3284
|
+
* goes into the history, privately, before the compile, as the drafts
|
|
3285
|
+
* notice does, and the workspace keeps its id (headMoveNotice). On an
|
|
3286
|
+
* unmoved head it finds nothing due and stores nothing.
|
|
3287
|
+
*/
|
|
3288
|
+
private noticeHeadMoves;
|
|
2885
3289
|
/**
|
|
2886
3290
|
* Logical turn end, after the turn's deferred notices are flushed: record
|
|
2887
3291
|
* as noticed exactly the drafts a stored message names (the receipt, a
|
|
@@ -2921,6 +3325,9 @@ export declare class AgentFramework {
|
|
|
2921
3325
|
* drafts. Private to the calling resident. `resend` is an explicit send:
|
|
2922
3326
|
* each draft is published verbatim, in order, through the normal publish
|
|
2923
3327
|
* executor, its attempt journaled durably before the request leaves.
|
|
3328
|
+
* `turn` is the turn the call was made in (callingTurnOf), none for a
|
|
3329
|
+
* call made outside the agent's current turn: a resend's destination names
|
|
3330
|
+
* its own channels (ownChannels) by their ids, and its sends engage it.
|
|
2924
3331
|
*/
|
|
2925
3332
|
private handleDraftsTool;
|
|
2926
3333
|
/** Why a draft can't be resent now (dismissed, or possibly already posted
|
|
@@ -2942,6 +3349,19 @@ export declare class AgentFramework {
|
|
|
2942
3349
|
* ([discord-send-failed]); this is the success half.
|
|
2943
3350
|
*/
|
|
2944
3351
|
private appendProseDeliveryReceipt;
|
|
3352
|
+
private nameUnpostedSpeech;
|
|
3353
|
+
private noteFailedTurnEnd;
|
|
3354
|
+
/**
|
|
3355
|
+
* The closed-channel note alone, in a send's words, at explicit mode's turn
|
|
3356
|
+
* end, which has no `[delivered]` receipt since the agent named every
|
|
3357
|
+
* destination itself. A `>>` into a channel the agent closed or declined
|
|
3358
|
+
* leaves it closed, so the note goes wherever the turn's speech stayed in
|
|
3359
|
+
* such a channel, once per channel. It goes through addMessage, as the
|
|
3360
|
+
* open notices do: held while the agent has a turn alive and written at
|
|
3361
|
+
* that turn's next boundary, so it reaches the agent once and never
|
|
3362
|
+
* mid-turn. No-op otherwise.
|
|
3363
|
+
*/
|
|
3364
|
+
private appendClosedChannelNoteAlone;
|
|
2945
3365
|
/**
|
|
2946
3366
|
* Announce-on-change locus notice (turn-frozen routing). Appends a durable
|
|
2947
3367
|
* `[routing]` window message when the turn's effective outbound locus
|
|
@@ -2987,6 +3407,65 @@ export declare class AgentFramework {
|
|
|
2987
3407
|
* window's all the same, so it's returned, and a tool boundary injects it.
|
|
2988
3408
|
*/
|
|
2989
3409
|
private storeDueClock;
|
|
3410
|
+
/**
|
|
3411
|
+
* Store `agent`'s `afterUser` injections in its own window, as the
|
|
3412
|
+
* messages `compile()` would have placed after the last user message, and
|
|
3413
|
+
* return the injections left for `compile()` to place: the rest, and any
|
|
3414
|
+
* that couldn't be stored (stored-injections.ts, #155 part 5). Which are
|
|
3415
|
+
* stored, and which skipped, is planInjectionStores'.
|
|
3416
|
+
*
|
|
3417
|
+
* Nothing is stored while the window is held (slotHeldFrom: the host is
|
|
3418
|
+
* quiesced, or another reader of the residents' shared slot has a turn
|
|
3419
|
+
* alive, as for a clock row): `compile()` places what the plan would have
|
|
3420
|
+
* stored, and what it skips, being in view already, isn't placed again.
|
|
3421
|
+
* Rows are written in the order gathered. A row whose write throws is
|
|
3422
|
+
* placed by `compile()` instead, with every row after it, unless the
|
|
3423
|
+
* read-back shows it landed; where the read-back fails, a row whose write
|
|
3424
|
+
* returned counts as landed and the rest are placed, so the request may
|
|
3425
|
+
* carry a landed one twice, which is logged as unknown.
|
|
3426
|
+
*/
|
|
3427
|
+
private storeInjections;
|
|
3428
|
+
/**
|
|
3429
|
+
* Which of `injections` a start stores in `agent`'s window, and which it
|
|
3430
|
+
* leaves for `compile()`. Each source's stored kind (isStoredKind), by
|
|
3431
|
+
* namespace, is one unit. A unit is skipped, neither stored nor placed,
|
|
3432
|
+
* when the copy the agent will read as that namespace's current one has
|
|
3433
|
+
* every part of it with the same content: the newest copy this agent
|
|
3434
|
+
* stored since its last request compiled to send, where a start stored one
|
|
3435
|
+
* and its compile then didn't record, as when it threw
|
|
3436
|
+
* (Agent.unsentInjection), and otherwise the
|
|
3437
|
+
* newest stored unit of that namespace the last request held
|
|
3438
|
+
* (Agent.renderedInjection). It's where the agent saw it, or will see it
|
|
3439
|
+
* at this compile, and placing it again would move it; a fold or scroll-out
|
|
3440
|
+
* since costs one request, as below. A part the strategy cut at its
|
|
3441
|
+
* per-message cap, or stripped an image from, counts as held, since a new
|
|
3442
|
+
* copy would meet the same. One a fold has summarized, a strategy's window
|
|
3443
|
+
* has scrolled past, a throwing write left part-stored, or that no request
|
|
3444
|
+
* since this agent started has held (and no failed start since has
|
|
3445
|
+
* stored), is stored again at the next start,
|
|
3446
|
+
* so the agent has the current copy at the cost of one more row: a fold
|
|
3447
|
+
* between two starts leaves the request after it with the summary's word,
|
|
3448
|
+
* and the start after that stores it again. The rows to store come in the order gathered,
|
|
3449
|
+
* as `compile()` would have placed them. A stored row is appended, so
|
|
3450
|
+
* where the window ends on a user message (a turn's start, a restart
|
|
3451
|
+
* after tool results) it lands where `compile()` would have placed it;
|
|
3452
|
+
* where it ends on the agent's latest reply (a wake with nothing new), it
|
|
3453
|
+
* lands after that reply, where `compile()` placed it after the last user
|
|
3454
|
+
* message, before the reply, or at the end when there was none.
|
|
3455
|
+
* Undefined when there's nothing of the stored kind.
|
|
3456
|
+
*/
|
|
3457
|
+
private planInjectionStores;
|
|
3458
|
+
/**
|
|
3459
|
+
* Whether a write the framework makes into `agent`'s window of its own
|
|
3460
|
+
* accord (a clock row, a batched wake's line) waits: while the host is
|
|
3461
|
+
* quiesced, or, for a reader of the residents' shared slot (the
|
|
3462
|
+
* subconscious, which reads it through a merged view, included), while
|
|
3463
|
+
* another reader of it has a turn alive, where it would land inside that
|
|
3464
|
+
* turn.
|
|
3465
|
+
*/
|
|
3466
|
+
private slotHeldFrom;
|
|
3467
|
+
/** Rows isNewestIn reads back past clock rows and stored injections. */
|
|
3468
|
+
private static readonly NEWEST_SCAN_ROWS;
|
|
2990
3469
|
/** Rows a window's last-clock scan reads at a time. */
|
|
2991
3470
|
private static readonly CLOCK_SCAN_ROWS;
|
|
2992
3471
|
/** What the next clock is planned from: the window's newest row's time and
|
|
@@ -3019,11 +3498,12 @@ export declare class AgentFramework {
|
|
|
3019
3498
|
*/
|
|
3020
3499
|
private noteForOtherResidents;
|
|
3021
3500
|
/**
|
|
3022
|
-
* Show the turn's typing indicator in `
|
|
3501
|
+
* Show the turn's typing indicator in `channel`, stopping the one it last
|
|
3023
3502
|
* showed elsewhere: this stream's, or one an earlier stream of the turn
|
|
3024
3503
|
* left running when it handed the turn on.
|
|
3025
3504
|
*/
|
|
3026
3505
|
private showTurnTyping;
|
|
3506
|
+
private heardSince;
|
|
3027
3507
|
/**
|
|
3028
3508
|
* The channel of the turn's newest arrival whose message is still in the
|
|
3029
3509
|
* agent's store (TurnRouting.arrivals). A message removed since it was
|
|
@@ -3053,8 +3533,9 @@ export declare class AgentFramework {
|
|
|
3053
3533
|
* when the server next registers the channel), or an open that the agent's
|
|
3054
3534
|
* own delivery or reply caused (`opened-by-delivery`, `opened-by-reply`),
|
|
3055
3535
|
* once its transport is confirmed. It names `channel_close` as the opt-out
|
|
3056
|
-
* (neither the
|
|
3057
|
-
*
|
|
3536
|
+
* (neither the agent's own speech there, the subscription policy nor the
|
|
3537
|
+
* server's default reopens a channel the agent closed: speechOpens and
|
|
3538
|
+
* ensureInitialDesiredState) only where the agent it's addressed to can
|
|
3058
3539
|
* call it for every channel it names (canCloseChannels): a conversation
|
|
3059
3540
|
* fork may close only its home channel, and an agent's allowedTools can leave
|
|
3060
3541
|
* channel_close out. The other residents can read it too, where several
|
|
@@ -3070,6 +3551,7 @@ export declare class AgentFramework {
|
|
|
3070
3551
|
* locus-eligible.
|
|
3071
3552
|
*/
|
|
3072
3553
|
private recordChannelAutoOpenNotice;
|
|
3554
|
+
private tellReasoningLoss;
|
|
3073
3555
|
/**
|
|
3074
3556
|
* Write a builder's channel notices in order, each on its own: one that
|
|
3075
3557
|
* can't be written is logged, and the rest are still written. A reader's
|
|
@@ -3099,14 +3581,14 @@ export declare class AgentFramework {
|
|
|
3099
3581
|
*/
|
|
3100
3582
|
private channelOpenedNotices;
|
|
3101
3583
|
/**
|
|
3102
|
-
* Whether `who` can call channel_close for every one of `
|
|
3584
|
+
* Whether `who` can call channel_close for every one of `channels` here:
|
|
3103
3585
|
* its allowedTools hold it (canAgentUseTool), and a conversation fork,
|
|
3104
3586
|
* whose channel_close dispatchChannelToolCall refuses for any channel but
|
|
3105
3587
|
* its home, only for its home.
|
|
3106
3588
|
*/
|
|
3107
3589
|
private canCloseChannels;
|
|
3108
3590
|
/**
|
|
3109
|
-
* Whether `who` holds the traffic of every one of `
|
|
3591
|
+
* Whether `who` holds the traffic of every one of `channels`, so that
|
|
3110
3592
|
* what an open channel delivers is in its window. Where conversations are
|
|
3111
3593
|
* routed, an incoming message goes to the fork its channel is bound to, or
|
|
3112
3594
|
* nowhere, and never to the primary (handleMcplChannelIncoming), so a fork
|
|
@@ -3208,8 +3690,77 @@ export declare class AgentFramework {
|
|
|
3208
3690
|
* a turn abandoned by a quiesce asks for none.
|
|
3209
3691
|
*/
|
|
3210
3692
|
private requestProseContinuation;
|
|
3693
|
+
/**
|
|
3694
|
+
* autoContinue (AgentConfig.autoContinue): after a turn the model ended
|
|
3695
|
+
* itself (AUTO_CONTINUE_STOP_REASONS), with prose or with nothing, queue
|
|
3696
|
+
* another, unless its last word was a skip (`>>skip_reply`, or a hybrid
|
|
3697
|
+
* `>>>skip_reply` hold still standing). Runs at the logical turn end of a
|
|
3698
|
+
* stream's `complete`, after the turn's deliveries and `[delivered]`
|
|
3699
|
+
* receipt, and only when the turn asked for no ` !` continuation (that one
|
|
3700
|
+
* runs instead). A tool that ends the turn (skip_reply, sleep) never
|
|
3701
|
+
* reaches here, and clears the run's count.
|
|
3702
|
+
*
|
|
3703
|
+
* It continues only an agent that has a way to stop it is offered: the
|
|
3704
|
+
* skip_reply tool, or in explicit/hybrid mode a skip envelope. It leaves
|
|
3705
|
+
* a turn whose closing prose bounced to the bounce, and never continues an
|
|
3706
|
+
* ephemeral run or a conversation fork. The wake names
|
|
3707
|
+
* the turn's locus, or the unresolved channel of a turn that had none, so
|
|
3708
|
+
* the next turn speaks, or doesn't, where this one did; a batched message's
|
|
3709
|
+
* channel outranks it. Its mark (InferenceRequest.autoContinueRun) holds
|
|
3710
|
+
* what the `[continue]` row says, written as the turn starts
|
|
3711
|
+
* (startAgentStream). A run is capped at maxConsecutive; the last allowed
|
|
3712
|
+
* row says so, and the cap holds until a turn starts with a cause of its own.
|
|
3713
|
+
*/
|
|
3714
|
+
private autoContinueAfterTurn;
|
|
3715
|
+
/** How an autoContinue agent stops a run, as its `[continue]` row says it,
|
|
3716
|
+
* or undefined when no way is offered: the skip_reply tool when the
|
|
3717
|
+
* channel registry offers it and the agent may call it, else a skip
|
|
3718
|
+
* envelope in explicit or hybrid mode. */
|
|
3719
|
+
private autoContinueStop;
|
|
3720
|
+
/**
|
|
3721
|
+
* Store a continuation's `[continue]` row in the agent's window as its turn
|
|
3722
|
+
* starts (startAgentStream), with the run's count as it stands and the
|
|
3723
|
+
* agent's cap. False when it couldn't be stored.
|
|
3724
|
+
*/
|
|
3725
|
+
private writeAutoContinueNotice;
|
|
3726
|
+
/** Whether another reader of the residents' shared slot has a turn alive,
|
|
3727
|
+
* so no row may be written there now (as storeDueClock checks). */
|
|
3728
|
+
private sharedSlotBusy;
|
|
3729
|
+
/** A continuation whose turn doesn't run: the run's count goes back to
|
|
3730
|
+
* what it was before it was queued. */
|
|
3731
|
+
private giveBackAutoContinue;
|
|
3211
3732
|
/** The agent's routing state for its current turn, made when it has none. */
|
|
3212
3733
|
private routingOf;
|
|
3734
|
+
/**
|
|
3735
|
+
* A turn's own channels, every channel that has been its trigger or its
|
|
3736
|
+
* locus (TurnRouting.wasIn), so a channel_open or a re-pin adds one and
|
|
3737
|
+
* drops none: a `>>` target, a drafts resend's destination or a channel
|
|
3738
|
+
* tool's name one of them answers to by its id means that channel, on its
|
|
3739
|
+
* server (ChannelRegistry.ownChannelNamed). A tool call takes them only
|
|
3740
|
+
* when it is made inside that turn (callOwnChannels).
|
|
3741
|
+
*/
|
|
3742
|
+
private ownChannels;
|
|
3743
|
+
/**
|
|
3744
|
+
* The agent's current turn, where a tool call was made inside it, else
|
|
3745
|
+
* none: a call made outside it, such as a script's left running after its
|
|
3746
|
+
* turn, carries no turn (ToolCall.callerTurnId), and a script's call in a
|
|
3747
|
+
* turn other than the one that started the script isn't that turn's. The
|
|
3748
|
+
* one test for both what a call's names mean (callOwnChannels) and which
|
|
3749
|
+
* turn's routing it may change: a channel_open's move of the trigger and
|
|
3750
|
+
* locus, and the engagement of a send or a drafts resend. Read while the
|
|
3751
|
+
* call is dispatched, since a script's start turn is kept only then.
|
|
3752
|
+
*/
|
|
3753
|
+
private callingTurnOf;
|
|
3754
|
+
/** What a publish a call makes is credited with having read
|
|
3755
|
+
* (Agent.notePublished): its agent's consumed watermark at the call, or,
|
|
3756
|
+
* for a script's call, the watermark when the run call started the
|
|
3757
|
+
* script. A script is written then, and a later round's wait that watches
|
|
3758
|
+
* it shares the turn's id but not what the agent has read since, so the
|
|
3759
|
+
* script's words can't answer anything injected after it started. */
|
|
3760
|
+
private publishReadThrough;
|
|
3761
|
+
/** The own channels (ownChannels) of the turn a tool call was made in
|
|
3762
|
+
* (callingTurnOf), and none for a call made outside it. */
|
|
3763
|
+
private callOwnChannels;
|
|
3213
3764
|
/**
|
|
3214
3765
|
* Explicit-prose-routing delivery gateway (docs/explicit-prose-routing.md),
|
|
3215
3766
|
* entered directly: parse the `>>` prefix, resolve the target, deliver, or
|
|
@@ -3251,6 +3802,7 @@ export declare class AgentFramework {
|
|
|
3251
3802
|
private draftStateNow;
|
|
3252
3803
|
/** Locus-preserving explicit publication. Source remains byte-identical in Chronicle. */
|
|
3253
3804
|
private deliverHybridProse;
|
|
3805
|
+
private deliverHybridEnvelope;
|
|
3254
3806
|
/** `>>skip_reply {{unsent}}` and its hybrid form: set the latest bounce
|
|
3255
3807
|
* draft aside — unless it is being sent right now, which a dismissal
|
|
3256
3808
|
* can't call back: the resident is told instead. So are a dismissal whose
|
|
@@ -3307,7 +3859,8 @@ export declare class AgentFramework {
|
|
|
3307
3859
|
* abandon or a stop of a registered agent settles the turn as it settles a
|
|
3308
3860
|
* turn's start (endStoppedStart: one inference:aborted, the turn settled,
|
|
3309
3861
|
* the gate released). Any other drop ends it as a start dropped before it
|
|
3310
|
-
* sends anything ends
|
|
3862
|
+
* sends anything ends, and settles a registered ephemeral run's turn with
|
|
3863
|
+
* the drop's reason. That frame, if it hasn't let go of its token yet,
|
|
3311
3864
|
* ends on its own and settles nothing. What was deferred for the agent
|
|
3312
3865
|
* lands now, or at that frame's end.
|
|
3313
3866
|
*/
|
|
@@ -3317,8 +3870,9 @@ export declare class AgentFramework {
|
|
|
3317
3870
|
* admission, the hold installs nothing (holdForProviderWait,
|
|
3318
3871
|
* holdProviderAcceleration), so no retry follows the turn's
|
|
3319
3872
|
* inference:failed, and the turn ends as a retry a stop cancelled ends, with
|
|
3320
|
-
* an inference:aborted saying so. Nothing is written
|
|
3321
|
-
* the turn.
|
|
3873
|
+
* an inference:aborted saying so. Nothing is written but the
|
|
3874
|
+
* [speech-not-posted] notice, for speech the turn's rounds left unposted.
|
|
3875
|
+
* True when it ended the turn.
|
|
3322
3876
|
*/
|
|
3323
3877
|
private endFailureAtStop;
|
|
3324
3878
|
/**
|
|
@@ -3353,6 +3907,42 @@ export declare class AgentFramework {
|
|
|
3353
3907
|
* terminal, and the caller's goes with it.
|
|
3354
3908
|
*/
|
|
3355
3909
|
private takeStartStop;
|
|
3910
|
+
/**
|
|
3911
|
+
* Cancel a stream the framework stops, under `kind`, the mark that tells
|
|
3912
|
+
* the stream's end apart from a caller's stop (frameworkCancelledStreams).
|
|
3913
|
+
* A mark records a cancel that happened, so a cancel that throws takes its
|
|
3914
|
+
* mark back, leaving an earlier mark of the same stream as it was, and the
|
|
3915
|
+
* throw goes on to the caller. With no `kind` (the agent holds no stream),
|
|
3916
|
+
* nothing is marked.
|
|
3917
|
+
*/
|
|
3918
|
+
private cancelUnderMark;
|
|
3919
|
+
/**
|
|
3920
|
+
* Cancel a live stream the framework ends at a tool boundary (`site` says
|
|
3921
|
+
* where), under its mark. A cancel that throws leaves the stream going: its
|
|
3922
|
+
* mark is taken back (cancelUnderMark), `onFailed` undoes what the site
|
|
3923
|
+
* did ahead of the cancel, and the failure is logged. The stream waits for
|
|
3924
|
+
* the round's results, which the boundary doesn't send, and the turn holds
|
|
3925
|
+
* its token until the stream ends, as an abort does when its own cancel
|
|
3926
|
+
* goes through. Only an operator's abort or stop, or an ephemeral run's
|
|
3927
|
+
* idle watchdog, comes back to it, so an operator alert says so too.
|
|
3928
|
+
* Returns whether the cancel went through.
|
|
3929
|
+
*/
|
|
3930
|
+
private cancelLiveStream;
|
|
3931
|
+
/**
|
|
3932
|
+
* Cancel a stream a start compiled and won't send (`site` says why).
|
|
3933
|
+
* Membrane's yielding stream starts its request when it is first iterated,
|
|
3934
|
+
* and this one never is, so it has sent nothing: a cancel that throws is
|
|
3935
|
+
* logged, and the start's cleanup goes on as if it had worked.
|
|
3936
|
+
*/
|
|
3937
|
+
private cancelUnsentStream;
|
|
3938
|
+
/**
|
|
3939
|
+
* Cancel a stream that no longer owns its agent: the agent was replaced or
|
|
3940
|
+
* removed, or a newer stream took it. Its frame settles nothing and is
|
|
3941
|
+
* leaving, so a cancel that throws is logged and the frame leaves all the
|
|
3942
|
+
* same. Thrown on, it would reject driveStream's promise, which nothing
|
|
3943
|
+
* awaits but stop().
|
|
3944
|
+
*/
|
|
3945
|
+
private cancelSupersededStream;
|
|
3356
3946
|
/**
|
|
3357
3947
|
* End a start that a stop reached before it sent anything, through the
|
|
3358
3948
|
* terminal the same stop gets on a live stream: a caller's stop as
|
|
@@ -3373,12 +3963,15 @@ export declare class AgentFramework {
|
|
|
3373
3963
|
/**
|
|
3374
3964
|
* Execute a tool call and return the result.
|
|
3375
3965
|
* Routes to the appropriate handler (module registry or MCPL).
|
|
3376
|
-
*
|
|
3966
|
+
* Its one caller in the framework is the operator's puppet
|
|
3967
|
+
* (puppetToolCall), which puts the agent's inline cap on the call as
|
|
3968
|
+
* resultMaxChars; a host may call it as well.
|
|
3377
3969
|
*
|
|
3378
|
-
* This public entry always carries AGENT origin.
|
|
3379
|
-
*
|
|
3380
|
-
*
|
|
3381
|
-
*
|
|
3970
|
+
* This public entry always carries AGENT origin. Its callers act for an
|
|
3971
|
+
* agent, the puppet as the agent and a host for the model it runs, and
|
|
3972
|
+
* provenance must identify which internal path a call entered through — a
|
|
3973
|
+
* public method shared with model callers can never confer module trust,
|
|
3974
|
+
* whatever the input claims. Module origin
|
|
3382
3975
|
* exists only through the private closure handed to ModuleRegistry
|
|
3383
3976
|
* (ctx.callTool → executeToolCallFrom with {kind:'module'}), which is exempt
|
|
3384
3977
|
* from agent allowlists. Registered agents' allowedTools is enforced at
|
|
@@ -3432,16 +4025,55 @@ export declare class AgentFramework {
|
|
|
3432
4025
|
/** puppetToolCall's work, run where stop() can wait for it. */
|
|
3433
4026
|
private runPuppetToolCall;
|
|
3434
4027
|
private executeToolCallFrom;
|
|
3435
|
-
/**
|
|
4028
|
+
/**
|
|
4029
|
+
* RFC-014: the calls toolsets--act resolved to a server's dynamic tool,
|
|
4030
|
+
* with the instance each is for (`_meta["mcpl/instance"]`, §5.5). The MCPL
|
|
4031
|
+
* dispatch paths read it: such a call isn't refused as a dynamic tool
|
|
4032
|
+
* called by name, and carries its instance. Nothing else about it differs
|
|
4033
|
+
* from a direct call of the tool. Created on first use, so a framework
|
|
4034
|
+
* assembled field by field (as unit tests do) needs no setup for it.
|
|
4035
|
+
*/
|
|
4036
|
+
private toolsetActCalls?;
|
|
4037
|
+
private puppetChanges?;
|
|
4038
|
+
/** RFC-014 §6.1: a change reaches the agent once, so it goes with a result
|
|
4039
|
+
* only where the result is stored in an agent's window (the puppet's) or
|
|
4040
|
+
* handed to an agent awaiting it; null where it may not reach one. */
|
|
4041
|
+
private changeTaker;
|
|
4042
|
+
/** A toolsets--act call resolved (resolveAct) to the call of the server's
|
|
4043
|
+
* tool it makes, under that tool's model-facing name and with its
|
|
4044
|
+
* arguments, its id kept; or the reason it can't be sent. */
|
|
4045
|
+
private resolveToolsetAct;
|
|
4046
|
+
/**
|
|
4047
|
+
* RFC-014 §8.2: a toolsets--act call from the agent (the model's, or a
|
|
4048
|
+
* script's) goes down the path a direct call of the server's tool takes
|
|
4049
|
+
* (dispatchMcplToolCall): its agent's allowedTools, the server's tool
|
|
4050
|
+
* policy, the state exchange, RFC-005's reading of the result, the tool
|
|
4051
|
+
* change shown after it, and RFC-007's lifecycle, which describes the call
|
|
4052
|
+
* as that tool, with its arguments, before it opens. Only
|
|
4053
|
+
* `_meta["mcpl/instance"]` is added. A call act can't resolve is refused
|
|
4054
|
+
* before anything is sent.
|
|
4055
|
+
*/
|
|
4056
|
+
private dispatchToolsetAct;
|
|
4057
|
+
/** A programmatic call of an MCPL tool: `serverId` and `prefix` as
|
|
4058
|
+
* resolveMcplTool matched them, or as toolsets--act resolved them
|
|
4059
|
+
* (toolsetActCalls). Its RFC-014 tool change goes with its result only
|
|
4060
|
+
* where the result is stored in an agent's window or handed to an agent
|
|
4061
|
+
* awaiting it (changeTaker); any other caller's
|
|
4062
|
+
* result may never reach one, so its change is told as a notice
|
|
4063
|
+
* (ToolsetController.tellUnlessClaimed). */
|
|
3436
4064
|
private executeMcplToolCall;
|
|
4065
|
+
private withWholeChange;
|
|
4066
|
+
private withActStateHint;
|
|
3437
4067
|
/** Event-pushing wrapper for the model-driven dispatch path. */
|
|
3438
4068
|
private dispatchCodeExecutionToolCall;
|
|
4069
|
+
private decideWaitingRound;
|
|
3439
4070
|
/**
|
|
3440
4071
|
* A model-issued tool's result has arrived. When it answers the last of
|
|
3441
|
-
* the code_execution calls a round waits on (ScriptRound), the
|
|
3442
|
-
* prose is routed now, its scripts' calls counted.
|
|
4072
|
+
* the code_execution calls and sends a round waits on (ScriptRound), the
|
|
4073
|
+
* round's prose is routed now, its scripts' calls counted.
|
|
3443
4074
|
*/
|
|
3444
4075
|
private settleScriptRound;
|
|
4076
|
+
private sendReachOf;
|
|
3445
4077
|
/**
|
|
3446
4078
|
* Whether a code_execution call watches a script that can change its
|
|
3447
4079
|
* round's routing, so the round waits for the call (ScriptRound): a run's
|
|
@@ -3481,12 +4113,21 @@ export declare class AgentFramework {
|
|
|
3481
4113
|
/** The tools a script of this agent may call now: the agent's own surface, without code_execution. */
|
|
3482
4114
|
private scriptTools;
|
|
3483
4115
|
/**
|
|
3484
|
-
* The first read-write mount without an include
|
|
3485
|
-
* keeps its own files there
|
|
3486
|
-
*
|
|
3487
|
-
*
|
|
4116
|
+
* The first read-write mount without an include that isn't configured
|
|
4117
|
+
* direct, or null. The framework keeps its own files there
|
|
4118
|
+
* (`tool-results/`, `refs/`). A mount with an include holds only the files
|
|
4119
|
+
* it names, so it would refuse them, and a setup whose only writable mount
|
|
4120
|
+
* has one, or is direct, is treated as having none.
|
|
3488
4121
|
*/
|
|
3489
4122
|
private firstWritableMountName;
|
|
4123
|
+
/**
|
|
4124
|
+
* Why firstWritableMountName found no mount, for the words that say so:
|
|
4125
|
+
* none writable without an include, or only mounts configured direct, which
|
|
4126
|
+
* it passes over.
|
|
4127
|
+
*/
|
|
4128
|
+
private noFileMountText;
|
|
4129
|
+
/** Whether firstWritableMountName passed over a writable mount without an include because it's configured direct. */
|
|
4130
|
+
private directPassedOver;
|
|
3490
4131
|
/**
|
|
3491
4132
|
* A script's word to its agent: a wake_agent() payload, or the ending of a
|
|
3492
4133
|
* left script that failed, crashed or was stopped at its limit. It enters
|
|
@@ -3526,15 +4167,16 @@ export declare class AgentFramework {
|
|
|
3526
4167
|
* the image stays reachable by provenance after the bytes leave the wire.
|
|
3527
4168
|
*
|
|
3528
4169
|
* The live copy is the stored text itself unless the result is a content
|
|
3529
|
-
* array carrying an inline image
|
|
3530
|
-
*
|
|
3531
|
-
*
|
|
3532
|
-
* each
|
|
3533
|
-
*
|
|
4170
|
+
* array carrying an inline image whose links and markers fit the cap
|
|
4171
|
+
* together (goesNative). Then `live` holds the blocks this text was made
|
|
4172
|
+
* from, which toMembraneToolResult sends as native blocks (nativeContent),
|
|
4173
|
+
* showing each image, stub and marker whole and each text block up to where
|
|
4174
|
+
* it cuts that block at the cap (`maxChars`, toolResultCutAt), so those are
|
|
4175
|
+
* the ranges of the text it showed.
|
|
3534
4176
|
*/
|
|
3535
4177
|
private storedToolResultText;
|
|
3536
4178
|
/** Where a tool result labelled `label` is written: `<first writable
|
|
3537
|
-
* mount without an include>/tool-results/<label>.txt` (see
|
|
4179
|
+
* mount without an include, not configured direct>/tool-results/<label>.txt` (see
|
|
3538
4180
|
* firstWritableMountName), or null when there is no such mount. */
|
|
3539
4181
|
private toolResultFilePlace;
|
|
3540
4182
|
/**
|
|
@@ -3595,7 +4237,9 @@ export declare class AgentFramework {
|
|
|
3595
4237
|
* what the model would read: a structured result's blocks as the dispatch
|
|
3596
4238
|
* gave them (the direct reading, with RFC-005's treatment of an MCPL peer's
|
|
3597
4239
|
* blocks there, bound to the server that sent them), a module's under
|
|
3598
|
-
* history's reading of RFC-005 at every depth (shownToScript),
|
|
4240
|
+
* history's reading of RFC-005 at every depth (shownToScript), each
|
|
4241
|
+
* reading the claims of everything the script's view shows, nested fields
|
|
4242
|
+
* included (scriptViewClaims), and
|
|
3599
4243
|
* otherwise one text block of the model's text, which for a failure is its
|
|
3600
4244
|
* error. A module's is any result whose call the dispatch didn't send to
|
|
3601
4245
|
* a server (`toServer`, from the call's waiter). `structuredContent` is the
|
|
@@ -3617,9 +4261,11 @@ export declare class AgentFramework {
|
|
|
3617
4261
|
* RFC-007: with an `origin`, observers see the call as they see a model
|
|
3618
4262
|
* call (register, dispatch with its refusal sites, open; the terminal at
|
|
3619
4263
|
* the waiter intercept), under the inner tool's own name and class.
|
|
3620
|
-
* `turnId` is the turn the call was made in (dispatchToolCall)
|
|
3621
|
-
* the
|
|
3622
|
-
*
|
|
4264
|
+
* `turnId` is the turn the call was made in (dispatchToolCall), the turn
|
|
4265
|
+
* of the run or wait call watching the script; `start` is what the script
|
|
4266
|
+
* was started with, its turn and its agent's reading, which its words
|
|
4267
|
+
* carry (scriptCallStarts). `route` is the waiter's: the dispatch sets
|
|
4268
|
+
* `toServer` when it sends the call to a server.
|
|
3623
4269
|
*/
|
|
3624
4270
|
private dispatchScriptToolCall;
|
|
3625
4271
|
/**
|
|
@@ -3643,17 +4289,20 @@ export declare class AgentFramework {
|
|
|
3643
4289
|
private liveTurns;
|
|
3644
4290
|
private toMembraneToolResult;
|
|
3645
4291
|
/**
|
|
3646
|
-
*
|
|
3647
|
-
*
|
|
3648
|
-
*
|
|
3649
|
-
*
|
|
3650
|
-
*
|
|
3651
|
-
*
|
|
3652
|
-
*
|
|
3653
|
-
*
|
|
3654
|
-
* copy
|
|
3655
|
-
|
|
3656
|
-
|
|
4292
|
+
* A content array's blocks (toolResultBlocks) as Membrane's native
|
|
4293
|
+
* ToolResultContentBlock[], for a caller that found they go natively: at
|
|
4294
|
+
* least one image, with links and markers that fit the cap together
|
|
4295
|
+
* (goesNative), which this doesn't check. Each image as itself, each text block
|
|
4296
|
+
* cut at the cap, and every other block whole, as the text the stored copy
|
|
4297
|
+
* shows for it. `maxChars`, when provided, caps each text block so an image
|
|
4298
|
+
* inlined beside an enormous text payload can't blow the context. A block
|
|
4299
|
+
* is cut as the stored copy is at that cap (toolResultCutAt), never inside a
|
|
4300
|
+
* slot, so the stored copy can keep exactly the slots this showed (#403);
|
|
4301
|
+
* under a readers' bound the stored copy's cut can come earlier
|
|
4302
|
+
* (cutStoredToolResultToFit). Each text is already well formed, as the
|
|
4303
|
+
* stored copy's is (toolResultBlocks).
|
|
4304
|
+
*/
|
|
4305
|
+
private nativeContent;
|
|
3657
4306
|
private toolImageLedgerFor;
|
|
3658
4307
|
/** Strategy-derived per-message bound (maxMessageTokens * 4 chars). */
|
|
3659
4308
|
private strategyDerivedToolResultChars;
|
|
@@ -3728,8 +4377,9 @@ export declare class AgentFramework {
|
|
|
3728
4377
|
}>;
|
|
3729
4378
|
/**
|
|
3730
4379
|
* Find the MCPL server for a tool: [serverId, prefix], or null.
|
|
3731
|
-
* The tool listing decides: the server whose tools/list
|
|
3732
|
-
*
|
|
4380
|
+
* The tool listing decides: the server whose tools/list listed the name
|
|
4381
|
+
* (offered to the model, or an RFC-014 dynamic tool, which dispatch then
|
|
4382
|
+
* refuses by that name unless the published list or the server's latest tools/list puts it as static), after its tool policy, as of the last tool refresh (a server that
|
|
3733
4383
|
* closed since keeps its names until the next one). A name the listing
|
|
3734
4384
|
* doesn't hold (invented by the model, or no longer listed) goes to the
|
|
3735
4385
|
* longest matching prefix. Prefixes that meet, such as `foo` and
|
|
@@ -3742,10 +4392,13 @@ export declare class AgentFramework {
|
|
|
3742
4392
|
* while unregistered. Genuine legacy caller names retain their surface. */
|
|
3743
4393
|
private canAgentUseTool;
|
|
3744
4394
|
private agentToolPermissionFailure;
|
|
4395
|
+
private markedInputFailure;
|
|
4396
|
+
private cutOffResults;
|
|
3745
4397
|
/**
|
|
3746
|
-
* A
|
|
3747
|
-
*
|
|
3748
|
-
*
|
|
4398
|
+
* A call answered without running its tool: one the dispatcher refused, or
|
|
4399
|
+
* one in the last round of a response the output limit cut off. RFC-007's
|
|
4400
|
+
* lifecycle forgets it, and its result says it was refused
|
|
4401
|
+
* (`ToolResult.refused`), both from here, so the two can't disagree.
|
|
3749
4402
|
*/
|
|
3750
4403
|
private refusedResult;
|
|
3751
4404
|
/**
|
|
@@ -3766,7 +4419,8 @@ export declare class AgentFramework {
|
|
|
3766
4419
|
* A call as its round's routing counts it, made directly, or by a script
|
|
3767
4420
|
* and reaching the host while a run or wait call of the round watches it
|
|
3768
4421
|
* (ScriptRound). A skip_reply refused, because the agent's allowedTools
|
|
3769
|
-
* doesn't name it
|
|
4422
|
+
* doesn't name it, because its arguments are refused (markedInputRefusal)
|
|
4423
|
+
* or because this host can't set the wake it asks for, is
|
|
3770
4424
|
* marked refused: it keeps its own round private and silences nothing after
|
|
3771
4425
|
* it. A refusal withholds the call's effect, not the model's choice to keep
|
|
3772
4426
|
* its words private. Any other call the list refuses posted nothing, so it
|
|
@@ -3784,6 +4438,61 @@ export declare class AgentFramework {
|
|
|
3784
4438
|
private dispatchToolCall;
|
|
3785
4439
|
private dispatchToolCallEvent;
|
|
3786
4440
|
private addMessage;
|
|
4441
|
+
/**
|
|
4442
|
+
* Whether an MCPL event's own stored entry is the newest entry in the window
|
|
4443
|
+
* a batched wake's line is written to (deliveryAgent(): the primary's), with
|
|
4444
|
+
* no turn alive there (turnAlive: started, streaming, or waiting on its
|
|
4445
|
+
* tools) and nothing waiting to be written (deferred). The gate then hands
|
|
4446
|
+
* the line to the wake (WakeLine) instead of writing it, and the turn's
|
|
4447
|
+
* start decides it (placeWakeLines). A channel message is found by its
|
|
4448
|
+
* server, channel and message id, a push event by its server and event id.
|
|
4449
|
+
* A message a tune-out holds from the residents is never "newest" here.
|
|
4450
|
+
*/
|
|
4451
|
+
private isNewestContextEntry;
|
|
4452
|
+
/**
|
|
4453
|
+
* Write the batched-wake lines the gate left to this turn's start (WakeLine)
|
|
4454
|
+
* into the window they name, the delivery agent's (the residents' shared
|
|
4455
|
+
* slot where it is one), on that agent's own start only. Called by a fresh
|
|
4456
|
+
* start that doesn't resume a logical turn, after the turn's own inputs (a
|
|
4457
|
+
* due clock row, the deferred-write and assembly flushes) and before its
|
|
4458
|
+
* checkpoint, so a line lands after whatever arrived since the gate's
|
|
4459
|
+
* decision, before the notices the turn's start writes itself (the locus
|
|
4460
|
+
* notice among them), and before the agent's answer to the wake.
|
|
4461
|
+
*
|
|
4462
|
+
* - A wake's one line whose event is still the newest entry is left out:
|
|
4463
|
+
* no message follows the wake's, so it is the wake's whole cause, and the
|
|
4464
|
+
* start's token defers an arrival into the window past its request. (The
|
|
4465
|
+
* start's own notices, written after this, aren't messages a reply could
|
|
4466
|
+
* be meant for.)
|
|
4467
|
+
* - A co-resident's start places nothing. Every resident gets every
|
|
4468
|
+
* batched wake, so a co-resident writing the line would put it under the
|
|
4469
|
+
* message, the line #727 left out, or after the delivery agent's answer,
|
|
4470
|
+
* a wake line for a message already answered. Its request shows what the
|
|
4471
|
+
* slot holds, as on `main`: a reply after the message is in the message's
|
|
4472
|
+
* own channel, but a message from another channel that lands between the
|
|
4473
|
+
* gate's decision and its compile follows the message with no line.
|
|
4474
|
+
* - Two or more lines are all written, each naming its message, its age
|
|
4475
|
+
* counted to now.
|
|
4476
|
+
* - None is written while the host is quiesced or another reader of the
|
|
4477
|
+
* slot has a turn alive (slotHeldFrom, as for a clock row): written, a
|
|
4478
|
+
* line would land inside that turn, and deferred, it would wait for the
|
|
4479
|
+
* delivery agent's next boundary, never reaching this request
|
|
4480
|
+
* (overlapping turns in the slot, #286). They stay undecided, and are
|
|
4481
|
+
* written only if another fresh start of the wake comes (a provider
|
|
4482
|
+
* hold's release, a requeue): this start's request goes without them.
|
|
4483
|
+
*
|
|
4484
|
+
* A line left out is traced. Each line is written once (placedWakeLines),
|
|
4485
|
+
* across the wake's retries and holds, whichever copy of its trigger a
|
|
4486
|
+
* start carries: every request for the wake carries the same line. A line
|
|
4487
|
+
* left out, or whose write fails, stays undecided for a later fresh start.
|
|
4488
|
+
*/
|
|
4489
|
+
private placeWakeLines;
|
|
4490
|
+
/** Whether `entry`'s own stored entry is the newest in `agent`'s window,
|
|
4491
|
+
* clock rows and stored context injections after it aside: a channel
|
|
4492
|
+
* message by its server, channel and message id, a push event by its
|
|
4493
|
+
* server and event id, and never one a tune-out holds. Past
|
|
4494
|
+
* NEWEST_SCAN_ROWS such rows, it answers no. */
|
|
4495
|
+
private isNewestIn;
|
|
3787
4496
|
/** Where addMessage delivers: the named agent, else the primary, else the
|
|
3788
4497
|
* first registered agent. Undefined when there is no such agent. */
|
|
3789
4498
|
private deliveryAgent;
|
|
@@ -3813,25 +4522,13 @@ export declare class AgentFramework {
|
|
|
3813
4522
|
* its window (ContextManager.renderAsNewest): cut by the per-message cap,
|
|
3814
4523
|
* a sharded body joined, and the image limits applied over the batch, so
|
|
3815
4524
|
* the live stream hears what the next compile sends. An id comes back as
|
|
3816
|
-
* null where
|
|
3817
|
-
*
|
|
3818
|
-
*
|
|
3819
|
-
*
|
|
4525
|
+
* null where the render can't place the message among the newest, and the
|
|
4526
|
+
* boundary injects that one as stored (see the boundary's null). Undefined
|
|
4527
|
+
* where the strategy has no such hook, or the render threw, which is
|
|
4528
|
+
* logged: the boundary then injects what it stored, as it did before
|
|
4529
|
+
* strategies could say.
|
|
3820
4530
|
*/
|
|
3821
4531
|
private renderForInjection;
|
|
3822
|
-
/**
|
|
3823
|
-
* Tell the agent of the messages a tool boundary stored and left out of
|
|
3824
|
-
* its injection, since the next compile won't send them among its newest:
|
|
3825
|
-
* who sent each and its size, and how to read it, `history--extract`
|
|
3826
|
-
* around it where the agent is shown that tool, else its id. None of a
|
|
3827
|
-
* message's words: the line stands in for a message the live round
|
|
3828
|
-
* doesn't carry. A system line, so it's no conversation: it neither
|
|
3829
|
-
* re-pins the turn nor clears its send suppression. It names the agent
|
|
3830
|
-
* it's for, since every resident sharing the slot reads it too. Returns
|
|
3831
|
-
* the notice as stored, for the boundary to inject after the batch, or
|
|
3832
|
-
* undefined when it couldn't be stored, which is logged.
|
|
3833
|
-
*/
|
|
3834
|
-
private recordLeftOutNotice;
|
|
3835
4532
|
/**
|
|
3836
4533
|
* Write drained entries in queue (seq) order, whatever their targets:
|
|
3837
4534
|
* residents share one message slot, so the order entries arrived in is the
|
|
@@ -3905,11 +4602,15 @@ export declare class AgentFramework {
|
|
|
3905
4602
|
* appended later without splitting the body.) Boot's scan for landed
|
|
3906
4603
|
* writes counts a landed shard the same way. When the store can't be read
|
|
3907
4604
|
* back (storedCopiesOf logs it), or couldn't say how many messages it held
|
|
3908
|
-
* before the write,
|
|
4605
|
+
* before the write, the store is searched for the entry's id at once
|
|
4606
|
+
* (landedCopiesById): found, it counts as written, as above. When that
|
|
4607
|
+
* can't be done either, whether the entry landed is unknown: it's put back
|
|
3909
4608
|
* marked so (`landing`), and before it's written again the store is
|
|
3910
|
-
* searched for its id
|
|
3911
|
-
*
|
|
3912
|
-
*
|
|
4609
|
+
* searched for its id. Found then, it counts as written where it was
|
|
4610
|
+
* stored, ahead of what was stored since without it, a known limit
|
|
4611
|
+
* (context-manager #155, named at the tool boundary's drain); not found,
|
|
4612
|
+
* it's written. While the store can't be searched, it stays queued,
|
|
4613
|
+
* holding what's behind it.
|
|
3913
4614
|
*
|
|
3914
4615
|
* Returns what was written (stored, or deferred again by addMessage, whose
|
|
3915
4616
|
* id is then empty), in queue order: for one target, its entries up to the
|
|
@@ -3937,10 +4638,29 @@ export declare class AgentFramework {
|
|
|
3937
4638
|
* when the store can't be read back, which is logged under `tag`, naming
|
|
3938
4639
|
* `what` was written: not the same as nothing found. */
|
|
3939
4640
|
private storedSince;
|
|
3940
|
-
/**
|
|
3941
|
-
*
|
|
3942
|
-
*
|
|
3943
|
-
*
|
|
4641
|
+
/**
|
|
4642
|
+
* The positions on `cm`'s current branch of the messages carrying
|
|
4643
|
+
* `deferredWriteId`, in store order: the whole branch, read in blob-free
|
|
4644
|
+
* windows, so a blob missing from some other message can't make it fail,
|
|
4645
|
+
* as it makes queryMessages fail (every blob on the branch is resolved for
|
|
4646
|
+
* it). Throws when a window can't be read, or holds fewer messages than it
|
|
4647
|
+
* was asked for: a scan that didn't reach every message can't say a write
|
|
4648
|
+
* is absent, and a write taken as absent is stored again.
|
|
4649
|
+
*/
|
|
4650
|
+
private landedPositions;
|
|
4651
|
+
/**
|
|
4652
|
+
* The messages carrying `deferredWriteId` anywhere on the agent's current
|
|
4653
|
+
* branch, in store order with their blobs resolved, as a request carries
|
|
4654
|
+
* them, so no position is needed. They're found with queryMessages, over
|
|
4655
|
+
* context-manager's cached view, as landedRow finds a held write's row.
|
|
4656
|
+
* Where that throws, as one blob missing anywhere on the branch makes it
|
|
4657
|
+
* do, the branch is scanned blob-free instead (landedPositions), and only
|
|
4658
|
+
* the rows that match are read with their blobs. Undefined when the store
|
|
4659
|
+
* can be searched neither way, or the scan finds the write's rows but one
|
|
4660
|
+
* of them can't be read. Each write whose lookup fails is said once until
|
|
4661
|
+
* a lookup of it succeeds, since every path that reads held writes looks
|
|
4662
|
+
* again.
|
|
4663
|
+
*/
|
|
3944
4664
|
private landedCopiesById;
|
|
3945
4665
|
/** The line naming a drained write that threw: one that couldn't be stored,
|
|
3946
4666
|
* which is already back in the queue; with 'dropped', a malformed refusal
|
|
@@ -3981,9 +4701,10 @@ export declare class AgentFramework {
|
|
|
3981
4701
|
* A target no longer registered (a fork or a run that has ended, here or
|
|
3982
4702
|
* before a crash) has no window to land in: a failed reply queued for it,
|
|
3983
4703
|
* or a channel notice it could have acted on, becomes the primary's
|
|
3984
|
-
* by-name notice,
|
|
3985
|
-
*
|
|
3986
|
-
*
|
|
4704
|
+
* by-name notice, and a module's write for a run or a fork goes to it as
|
|
4705
|
+
* written, each under the entry's own id and place in the queue
|
|
4706
|
+
* (passesToPrimary, queuedNoticeForPrimary), written with the rest; any
|
|
4707
|
+
* other write is dropped, logged, by addMessage. Nothing here reads the gone agent's
|
|
3987
4708
|
* window, so such a notice an earlier write of which landed there, and
|
|
3988
4709
|
* which the agent read, goes on too. */
|
|
3989
4710
|
private readdDrained;
|
|
@@ -4014,7 +4735,8 @@ export declare class AgentFramework {
|
|
|
4014
4735
|
*
|
|
4015
4736
|
* The agent never reads its window again, so every failed-reply notice it
|
|
4016
4737
|
* never read, and every channel notice it could act on and never read, is
|
|
4017
|
-
* passed to the primary, by name, once
|
|
4738
|
+
* passed to the primary, by name, once, and so is every module write for
|
|
4739
|
+
* it that it never read, as the write itself (passesToPrimary,
|
|
4018
4740
|
* passOnFromReleasedWindow): each one stored in its window above its
|
|
4019
4741
|
* consumed watermark (flushed there at its turn's end, or stored while it
|
|
4020
4742
|
* was idle) and not heard at a tool boundary, and each one still queued
|
|
@@ -4045,8 +4767,9 @@ export declare class AgentFramework {
|
|
|
4045
4767
|
* The part of a released agent's pass to the primary that its release and
|
|
4046
4768
|
* stop() share (stop() runs it for a release the quiesce postponed). Each
|
|
4047
4769
|
* notice stored in its window that it never read and the primary takes in
|
|
4048
|
-
* its place (passesToPrimary: a failed reply,
|
|
4049
|
-
*
|
|
4770
|
+
* its place (passesToPrimary: a failed reply, a channel notice its reader
|
|
4771
|
+
* could act on, or a module's write for a run or a fork, which goes as
|
|
4772
|
+
* the write itself) goes on as stored, by name (passNoticeToPrimary),
|
|
4050
4773
|
* except a copy of an entry for it still in the durable queue, pending or
|
|
4051
4774
|
* un-acked: that entry is the notice's one identity until its ack, the one
|
|
4052
4775
|
* boot's check for landed writes knows, so it's the entry that goes on, as
|
|
@@ -4067,8 +4790,11 @@ export declare class AgentFramework {
|
|
|
4067
4790
|
* What a released agent's window holds that its pass to the primary reads
|
|
4068
4791
|
* (passOnFromReleasedWindow): `unread`, the notices stored there that it
|
|
4069
4792
|
* never read and the primary takes in its place (passesToPrimary: its
|
|
4070
|
-
* failed replies,
|
|
4071
|
-
*
|
|
4793
|
+
* failed replies, the channel notices it was told it could act on, and a
|
|
4794
|
+
* run's or a fork's module writes), each with its participant and
|
|
4795
|
+
* content, a sharded body's shards joined into one text, as the
|
|
4796
|
+
* autobiographical strategy joins them (asCompiled), other than
|
|
4797
|
+
* copies of the entries `held` names; and `held`, for each of
|
|
4072
4798
|
* those entries with a copy there, its copies and whether any of them is
|
|
4073
4799
|
* unread. A notice is read below the lower of its consumed watermark and
|
|
4074
4800
|
* the point where the watermark's branch and the current one part
|
|
@@ -4102,8 +4828,8 @@ export declare class AgentFramework {
|
|
|
4102
4828
|
* deregistered, so its stream can't dispatch anything more and resume
|
|
4103
4829
|
* doesn't weigh its context, and a write addressed to it meanwhile is
|
|
4104
4830
|
* treated as for any agent no longer registered (dropped, or passed to the
|
|
4105
|
-
* primary if it's a failed reply,
|
|
4106
|
-
* on).
|
|
4831
|
+
* primary if it's a failed reply, a channel notice its reader could act
|
|
4832
|
+
* on, or a module's write for a run or a fork: passesToPrimary).
|
|
4107
4833
|
*/
|
|
4108
4834
|
private releaseWindowNowOrAfterResume;
|
|
4109
4835
|
/** resume(): the windows whose release the quiesce window postponed, each on its own. */
|
|
@@ -4138,7 +4864,10 @@ export declare class AgentFramework {
|
|
|
4138
4864
|
* The primary's by-name notice in place of one `speaker` never read, and
|
|
4139
4865
|
* what it's about, as a log line says it: a failed reply's
|
|
4140
4866
|
* (failedReplyNoticeForPrimary) or a channel notice's
|
|
4141
|
-
* (channelNoticeForPrimary).
|
|
4867
|
+
* (channelNoticeForPrimary). A module's write for a run or a fork that
|
|
4868
|
+
* it never read (PRIMARY_IF_UNREAD_KEY), given with what was `written`,
|
|
4869
|
+
* goes as the write itself: its participant, its content, and its
|
|
4870
|
+
* metadata without the mark. null when no one is told, which is logged
|
|
4142
4871
|
* where it's decided.
|
|
4143
4872
|
*/
|
|
4144
4873
|
private noticeForPrimary;
|
|
@@ -4175,11 +4904,34 @@ export declare class AgentFramework {
|
|
|
4175
4904
|
*/
|
|
4176
4905
|
private channelForNotice;
|
|
4177
4906
|
/**
|
|
4178
|
-
* A
|
|
4179
|
-
*
|
|
4180
|
-
*
|
|
4181
|
-
*
|
|
4182
|
-
|
|
4907
|
+
* A channel as the agent is shown it: its label, with the name that picks
|
|
4908
|
+
* it alone (ChannelRegistry.nameShown), which is its id, or, where another
|
|
4909
|
+
* server registers the same id, its server-qualified name; or, for a
|
|
4910
|
+
* channel no string picks alone, its id and its server.
|
|
4911
|
+
*/
|
|
4912
|
+
private channelShown;
|
|
4913
|
+
/** A channel named in a notice with the label it was given there: the
|
|
4914
|
+
* label, with its name as ChannelRegistry.nameShown gives it. */
|
|
4915
|
+
private labelledChannel;
|
|
4916
|
+
/**
|
|
4917
|
+
* A module's write through its context (ModuleContext.addMessage):
|
|
4918
|
+
* addMessage's, except that a write the framework holds is answered by its
|
|
4919
|
+
* handle (heldHandle) rather than '', so the module can find, read, edit
|
|
4920
|
+
* and remove what it wrote before the write lands, through getMessage,
|
|
4921
|
+
* editMessage and removeMessage, which read the delivery agent's window: a
|
|
4922
|
+
* handle for a write held for a fork or a sub-agent isn't found there. The
|
|
4923
|
+
* framework's own callers keep the '' they've always had, which their
|
|
4924
|
+
* traces and checks take as a write not stored yet.
|
|
4925
|
+
*
|
|
4926
|
+
* With `forAgent`, the write is for the named agent's window, which must
|
|
4927
|
+
* be registered when the write is made: a name that isn't, or the empty
|
|
4928
|
+
* one, which addMessage would read as none (deliveryAgent), throws, naming
|
|
4929
|
+
* the registered ones, as queryMessages does. The framework's own writes
|
|
4930
|
+
* log and drop instead, as a held write does whose agent is gone by its
|
|
4931
|
+
* flush. A write for an ephemeral run or a conversation fork, whose
|
|
4932
|
+
* window nothing reads after its release, is marked (PRIMARY_IF_UNREAD_KEY),
|
|
4933
|
+
* so the release passes it to the primary if its target never read it,
|
|
4934
|
+
* as it passes a notice (passOnFromReleasedWindow).
|
|
4183
4935
|
*/
|
|
4184
4936
|
private addModuleMessage;
|
|
4185
4937
|
/**
|
|
@@ -4190,7 +4942,8 @@ export declare class AgentFramework {
|
|
|
4190
4942
|
* no module reads that agent's store, and the write waits for its window's
|
|
4191
4943
|
* release (drainDeferredFor) or, at its flush, is dropped (addMessage), a
|
|
4192
4944
|
* failed reply, or a channel notice its reader could act on, passing to the
|
|
4193
|
-
* primary as its notice
|
|
4945
|
+
* primary as its notice, and a module's write for a run as written
|
|
4946
|
+
* (passesToPrimary, queuedNoticeForPrimary).
|
|
4194
4947
|
*/
|
|
4195
4948
|
private heldWritesFor;
|
|
4196
4949
|
/**
|
|
@@ -4212,10 +4965,11 @@ export declare class AgentFramework {
|
|
|
4212
4965
|
* Settle held writes whose landing is unknown (DeferredWrite.landing),
|
|
4213
4966
|
* among those `which` picks, before a path reads or changes held writes:
|
|
4214
4967
|
* each is looked up by its id in its target's store (landedCopiesById).
|
|
4215
|
-
* Found, the write landed (settleFound)
|
|
4216
|
-
*
|
|
4217
|
-
*
|
|
4218
|
-
* own
|
|
4968
|
+
* Found, the write landed (settleFound), where its copy sits, a known
|
|
4969
|
+
* limit (writeDrainedInOrder). Not found, the mark goes, and it's an
|
|
4970
|
+
* ordinary held write, which is persisted as an edit is. Where the store
|
|
4971
|
+
* can't be searched, it stays marked, a doubt each path reads by its own
|
|
4972
|
+
* rule.
|
|
4219
4973
|
*/
|
|
4220
4974
|
private settleUnknownLandings;
|
|
4221
4975
|
/**
|
|
@@ -4236,7 +4990,8 @@ export declare class AgentFramework {
|
|
|
4236
4990
|
* that write's copy, so the write landed, and it's settled as found
|
|
4237
4991
|
* (settleFound) before the row is read or changed. A lookup by the id
|
|
4238
4992
|
* can't be needed then, so this holds where the store can't be searched
|
|
4239
|
-
* too.
|
|
4993
|
+
* too. One row of a sharded body says it's a shard, without a count,
|
|
4994
|
+
* since one row doesn't tell how many landed.
|
|
4240
4995
|
*/
|
|
4241
4996
|
private settleByCopy;
|
|
4242
4997
|
/** A held write whose landing stays unknown after settling, its store
|
|
@@ -4244,21 +4999,40 @@ export declare class AgentFramework {
|
|
|
4244
4999
|
* changing only the queued entry could leave its stored copy as it was.
|
|
4245
5000
|
* Throws with nothing changed. */
|
|
4246
5001
|
private refuseUnsettled;
|
|
4247
|
-
/** Whether
|
|
4248
|
-
* evidence only
|
|
4249
|
-
* watermark
|
|
4250
|
-
*
|
|
4251
|
-
*
|
|
4252
|
-
*
|
|
4253
|
-
*
|
|
4254
|
-
*
|
|
4255
|
-
*
|
|
4256
|
-
*
|
|
4257
|
-
*
|
|
4258
|
-
|
|
5002
|
+
/** Whether a wake for a deferred write has nothing left for the agent to
|
|
5003
|
+
* do, on evidence only. The write's row is at or below the newest
|
|
5004
|
+
* consumed watermark of an answered request (Agent.getAnsweredWatermark)
|
|
5005
|
+
* on the agent's current branch, and for a wake that carries a channel
|
|
5006
|
+
* and wasn't marked ambient (`to`, that channel on the wake's server), the
|
|
5007
|
+
* agent has since published there having read the row
|
|
5008
|
+
* (Agent.publishedAfterReading): hearing a message isn't answering it,
|
|
5009
|
+
* and the wake's turn is the agent's chance to answer there. Or the
|
|
5010
|
+
* write is in neither the queue (drained entries not yet stored
|
|
5011
|
+
* included) nor the store's current branch: removed, or left on a
|
|
5012
|
+
* branch the agent has switched from, where a turn now would find
|
|
5013
|
+
* nothing of it (switching back brings it back unread, with no wake, as
|
|
5014
|
+
* main's wake spent on this branch leaves it). Any doubt keeps the
|
|
5015
|
+
* wake, such as a watermark that a branch switch or an undo left on
|
|
5016
|
+
* another branch, or a store that can't be read: a turn that finds
|
|
5017
|
+
* nothing new costs less than a write no wake brings the agent to read
|
|
5018
|
+
* or answer. */
|
|
5019
|
+
private deferredWriteDone;
|
|
5020
|
+
private storedMessageDone;
|
|
5021
|
+
private writeAnswered;
|
|
5022
|
+
private readsWriteFor;
|
|
4259
5023
|
private editMessage;
|
|
4260
5024
|
private removeMessage;
|
|
4261
5025
|
private getMessage;
|
|
5026
|
+
/** The refusal of a module's `forAgent` that names no registered agent:
|
|
5027
|
+
* the name, cut at 120 characters; the registered ones, a list over 400
|
|
5028
|
+
* characters cut with how many there are; and what leaving forAgent out
|
|
5029
|
+
* does. With none registered, there's no window either way, and it says
|
|
5030
|
+
* so. */
|
|
5031
|
+
private unknownAgentError;
|
|
5032
|
+
/** A module's query (ModuleContext.queryMessages): the delivery agent's
|
|
5033
|
+
* window (the primary's, or the first agent's when none is primary), or
|
|
5034
|
+
* the named agent's, which must be registered: an unknown name, or the
|
|
5035
|
+
* empty one, throws, naming the registered ones, as a write's does. */
|
|
4262
5036
|
private queryMessages;
|
|
4263
5037
|
private createFrameworkState;
|
|
4264
5038
|
private emitTrace;
|
|
@@ -4317,6 +5091,41 @@ export declare class AgentFramework {
|
|
|
4317
5091
|
* failures.log + ops:alert trace + CONNECTOME_OPS_WEBHOOK.
|
|
4318
5092
|
*/
|
|
4319
5093
|
notifyOps(kind: string, agentName: string, message: string, data?: Record<string, unknown>): void;
|
|
5094
|
+
/**
|
|
5095
|
+
* Tells the context manager what a stream's later round carries after its compiled messages: every round so far,
|
|
5096
|
+
* in sent order, with the round's own rows appended (roundRows): each stored row's id where the next request will
|
|
5097
|
+
* carry it as the stream sent it, the marker where it won't. A request-only row (a heartbeat tick, a `[Continue]`)
|
|
5098
|
+
* isn't a row here: the next request puts it back in the same place (renderRequestOnlyRows), and no compile holds
|
|
5099
|
+
* it. A round with no `roundContent` (membrane's XML or fallback path, where the stored reply is the framework's
|
|
5100
|
+
* rebuild) can't be vouched for, so nothing more of the stream is noted, and its later rounds' thinking is left
|
|
5101
|
+
* out at the next compile rather than refused. So is a stream whose note threw or wrote nothing (noteStreamRows).
|
|
5102
|
+
*/
|
|
5103
|
+
private noteRoundSent;
|
|
5104
|
+
/**
|
|
5105
|
+
* At the stream's end, after its last reply is stored: every row so far, judged as of now, with that reply as the
|
|
5106
|
+
* final row (or none, where the stream's last request had no reply after it). Past the record's end nothing
|
|
5107
|
+
* keeps its thinking, so the last reply keeps its own only by being noted here. Judged as of now, a batch the
|
|
5108
|
+
* tool-result guard held at its boundary and has since settled to the originals is named. A reply with no
|
|
5109
|
+
* `roundContent` to vouch for ends noting instead, as a round's does.
|
|
5110
|
+
*/
|
|
5111
|
+
private noteStreamEnd;
|
|
5112
|
+
/**
|
|
5113
|
+
* Every row so far, judged as of now (roundRows), noted. A note the context manager writes nothing for (false)
|
|
5114
|
+
* ends the stream's notes, with a line saying so: where the stream's compile no longer wrote the branch's record, or
|
|
5115
|
+
* the branch has none, no later note could write either; where its store failed, a later one might, and stopping
|
|
5116
|
+
* gives that up for this stream's later rounds, whose thinking then goes at the next compile, as it would have
|
|
5117
|
+
* after the failed write. A note that throws is a fault, and ends them too.
|
|
5118
|
+
*/
|
|
5119
|
+
private noteStreamRows;
|
|
5120
|
+
/**
|
|
5121
|
+
* A call's dropped blocks, placed, against the branch's binding-record start (splitThinkingDrops). Replies stored at
|
|
5122
|
+
* or below it may lose their thinking with no strip having missed, since the context manager recorded nothing they
|
|
5123
|
+
* were sent under, and so may any block for a binding the record doesn't track (the account's). Any other drop is
|
|
5124
|
+
* one the record doesn't account for: a change ahead of it that the record didn't see. The operators hear of it
|
|
5125
|
+
* once per incident, again only if a call shows more, and the incident ends at a call that shows no unexpected drop
|
|
5126
|
+
* (ThinkingLossIncidents).
|
|
5127
|
+
*/
|
|
5128
|
+
private noteThinkingLoss;
|
|
4320
5129
|
private opsAlert;
|
|
4321
5130
|
/**
|
|
4322
5131
|
* Record a model refusal for observability: per-agent stats + a
|
|
@@ -4561,6 +5370,32 @@ export declare class AgentFramework {
|
|
|
4561
5370
|
* logged here rather than replacing the failure the connect reports.
|
|
4562
5371
|
*/
|
|
4563
5372
|
private closeFailedRuntimeConnect;
|
|
5373
|
+
/**
|
|
5374
|
+
* The host capabilities offered to one server: the host's own, plus
|
|
5375
|
+
* RFC-014's `toolHints` where its configuration asks for them. Without it,
|
|
5376
|
+
* the very object every server is offered.
|
|
5377
|
+
*/
|
|
5378
|
+
private mcplHostCapabilitiesFor;
|
|
5379
|
+
/** RFC-014: every toolHints server's presence, made on first use. */
|
|
5380
|
+
private toolsets;
|
|
5381
|
+
/** RFC-014: the `toolsets` module (toolsets--open, --act, --look,
|
|
5382
|
+
* --close), registered once, by the first server configured with
|
|
5383
|
+
* toolHints. Its tools don't change after that. */
|
|
5384
|
+
private ensureToolsetsModule;
|
|
5385
|
+
/** RFC-014 §5.3: after a (re)connect whose policy has settled, read what
|
|
5386
|
+
* the server holds open and adopt it. In the background: its notices are
|
|
5387
|
+
* written as they come. */
|
|
5388
|
+
private reattachToolsets;
|
|
5389
|
+
/**
|
|
5390
|
+
* RFC-014 §8.3: a tool change with no result or event to ride on (a
|
|
5391
|
+
* standalone tools/hints, a late result, a reconnect's adoption, a
|
|
5392
|
+
* recovery) is told as a notice, which doesn't wake the agent. Like any
|
|
5393
|
+
* delivery from a server into the conversation, it needs `pushEvents`
|
|
5394
|
+
* (§6.1); without it the change is still tracked, and toolsets--look shows
|
|
5395
|
+
* it. The text is the server's (its tool definitions, titles, reasons), so
|
|
5396
|
+
* the notice names the server.
|
|
5397
|
+
*/
|
|
5398
|
+
private recordToolsetNotice;
|
|
4564
5399
|
/**
|
|
4565
5400
|
* Connect a single MCPL server: register routing entries, open the
|
|
4566
5401
|
* connection, wire events, and initialize feature sets / scopes /
|
|
@@ -4871,7 +5706,9 @@ export declare class AgentFramework {
|
|
|
4871
5706
|
*/
|
|
4872
5707
|
private refreshMcplTools;
|
|
4873
5708
|
/**
|
|
4874
|
-
* Report operator tool-name patterns that match no
|
|
5709
|
+
* Report operator tool-name patterns that match no tool name: one the
|
|
5710
|
+
* model is offered, or an RFC-014 dynamic tool's listed name, which its
|
|
5711
|
+
* class rules and lifecycle selectors match as a direct call's would:
|
|
4875
5712
|
* `toolClassOverrides` keys and each server's `toolLifecycle.observe.tools`
|
|
4876
5713
|
* / `toolLifecycle.inputs.tools`. These match `<toolPrefix>--<tool>`, and
|
|
4877
5714
|
* the default prefix is `mcpl--<serverId>`, so a pattern written against
|
|
@@ -4886,8 +5723,9 @@ export declare class AgentFramework {
|
|
|
4886
5723
|
private checkToolPatterns;
|
|
4887
5724
|
/** Every tool name the framework offers to anyone: the shared board plus
|
|
4888
5725
|
* each agent's own surface, before presentation visibility (a hidden tool
|
|
4889
|
-
* is still callable, so classes and lifecycle still apply to it)
|
|
4890
|
-
|
|
5726
|
+
* is still callable, so classes and lifecycle still apply to it), and
|
|
5727
|
+
* every name an MCPL server lists, a dynamic tool's included. */
|
|
5728
|
+
private patternableToolNames;
|
|
4891
5729
|
/**
|
|
4892
5730
|
* Handle a tools/list_changed notification with collapse logic.
|
|
4893
5731
|
* At most 2 refresh cycles can be in-flight: one running and one pending.
|
|
@@ -4983,8 +5821,8 @@ export declare class AgentFramework {
|
|
|
4983
5821
|
* Handle the synthesized `read_image` tool: read image bytes from a
|
|
4984
5822
|
* workspace mount and return them as a native MCP-shaped content array
|
|
4985
5823
|
* (`[{type:'text'…},{type:'image', data, mimeType}]`). The live-turn
|
|
4986
|
-
* converter (
|
|
4987
|
-
* blocks) delivers the actual image to the model; history storage keeps
|
|
5824
|
+
* converter (toMembraneToolResult's nativeContent → membrane tool_result
|
|
5825
|
+
* image blocks) delivers the actual image to the model; history storage keeps
|
|
4988
5826
|
* the standard compact `[image: …]` placeholder.
|
|
4989
5827
|
*/
|
|
4990
5828
|
/** RFC-005 on-demand dereference: [ref id] → workspace file, via the
|
|
@@ -5021,17 +5859,24 @@ export declare class AgentFramework {
|
|
|
5021
5859
|
*/
|
|
5022
5860
|
private dispatchSaveImageToolCall;
|
|
5023
5861
|
/** The `utils` meta-tool: list/describe/run over module utilities
|
|
5024
|
-
* (Module.getUtilities). Shared by the model-facing dispatcher
|
|
5025
|
-
*
|
|
5026
|
-
*
|
|
5862
|
+
* (Module.getUtilities). Shared by the model-facing dispatcher, which a
|
|
5863
|
+
* running code_execution script's calls take too, and executeToolCallFrom,
|
|
5864
|
+
* which the puppet and a host reach through executeToolCall and a module
|
|
5865
|
+
* through callTool. */
|
|
5027
5866
|
private handleUtilsToolCall;
|
|
5028
5867
|
private dispatchUtilsToolCall;
|
|
5868
|
+
private readAgentSettings;
|
|
5869
|
+
private settingsChangedSince;
|
|
5029
5870
|
private dispatchAgentSettingsToolCall;
|
|
5030
5871
|
/** Aggregate the event-tag vocabulary: reserved chat:* core + each connected
|
|
5031
5872
|
* server's declared tag ontology + gate.js status. */
|
|
5032
5873
|
private buildEventTagsResult;
|
|
5033
5874
|
private dispatchEventTagsToolCall;
|
|
5034
5875
|
private dispatchGateToolCall;
|
|
5876
|
+
/** The channel context one server is told for an agent's inference
|
|
5877
|
+
* (context/beforeInference, §14.4): only that server's own channels
|
|
5878
|
+
* (ChannelRegistry.buildChannelContext). */
|
|
5879
|
+
private channelsForServer;
|
|
5035
5880
|
private buildBeforeInferenceParams;
|
|
5036
5881
|
}
|
|
5037
5882
|
export {};
|