@animalabs/agent-framework 0.32.0 → 0.34.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 +340 -22
- package/dist/src/admission/admit.d.ts +18 -0
- package/dist/src/admission/admit.d.ts.map +1 -1
- package/dist/src/admission/admit.js +16 -3
- package/dist/src/admission/admit.js.map +1 -1
- package/dist/src/agent.d.ts +208 -80
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +345 -113
- package/dist/src/agent.js.map +1 -1
- package/dist/src/api/mcp-server-core.d.ts.map +1 -1
- package/dist/src/api/mcp-server-core.js +50 -12
- package/dist/src/api/mcp-server-core.js.map +1 -1
- package/dist/src/api/server.d.ts.map +1 -1
- package/dist/src/api/server.js +4 -20
- package/dist/src/api/server.js.map +1 -1
- package/dist/src/append-all.d.ts +5 -0
- package/dist/src/append-all.d.ts.map +1 -0
- package/dist/src/append-all.js +8 -0
- package/dist/src/append-all.js.map +1 -0
- package/dist/src/code-execution/isolate/scripts.d.ts +12 -8
- package/dist/src/code-execution/isolate/scripts.d.ts.map +1 -1
- package/dist/src/code-execution/isolate/scripts.js +24 -0
- package/dist/src/code-execution/isolate/scripts.js.map +1 -1
- package/dist/src/config-checks.d.ts +7 -0
- package/dist/src/config-checks.d.ts.map +1 -1
- package/dist/src/config-checks.js +14 -0
- package/dist/src/config-checks.js.map +1 -1
- package/dist/src/context-manager-errors.d.ts +25 -0
- package/dist/src/context-manager-errors.d.ts.map +1 -0
- package/dist/src/context-manager-errors.js +31 -0
- package/dist/src/context-manager-errors.js.map +1 -0
- package/dist/src/context-options.d.ts +70 -0
- package/dist/src/context-options.d.ts.map +1 -0
- package/dist/src/context-options.js +90 -0
- package/dist/src/context-options.js.map +1 -0
- package/dist/src/cut-off-round.js +4 -4
- package/dist/src/deferred-import.d.ts +93 -0
- package/dist/src/deferred-import.d.ts.map +1 -0
- package/dist/src/deferred-import.js +177 -0
- package/dist/src/deferred-import.js.map +1 -0
- package/dist/src/dendrite/audience.d.ts +223 -0
- package/dist/src/dendrite/audience.d.ts.map +1 -0
- package/dist/src/dendrite/audience.js +202 -0
- package/dist/src/dendrite/audience.js.map +1 -0
- package/dist/src/dendrite/index.d.ts +5 -3
- package/dist/src/dendrite/index.d.ts.map +1 -1
- package/dist/src/dendrite/index.js +2 -1
- package/dist/src/dendrite/index.js.map +1 -1
- package/dist/src/dendrite/presets.d.ts +10 -5
- package/dist/src/dendrite/presets.d.ts.map +1 -1
- package/dist/src/dendrite/presets.js +17 -5
- package/dist/src/dendrite/presets.js.map +1 -1
- package/dist/src/dendrite/registry.d.ts +62 -7
- package/dist/src/dendrite/registry.d.ts.map +1 -1
- package/dist/src/dendrite/registry.js +183 -12
- package/dist/src/dendrite/registry.js.map +1 -1
- package/dist/src/dendrite/types.d.ts +91 -8
- package/dist/src/dendrite/types.d.ts.map +1 -1
- package/dist/src/failure-text.d.ts +36 -0
- package/dist/src/failure-text.d.ts.map +1 -0
- package/dist/src/failure-text.js +89 -0
- package/dist/src/failure-text.js.map +1 -0
- package/dist/src/foreign-rounds.d.ts +69 -0
- package/dist/src/foreign-rounds.d.ts.map +1 -0
- package/dist/src/foreign-rounds.js +152 -0
- package/dist/src/foreign-rounds.js.map +1 -0
- package/dist/src/framework.d.ts +2064 -842
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +8586 -3739
- package/dist/src/framework.js.map +1 -1
- package/dist/src/gate/event-gate.d.ts +125 -21
- package/dist/src/gate/event-gate.d.ts.map +1 -1
- package/dist/src/gate/event-gate.js +487 -72
- package/dist/src/gate/event-gate.js.map +1 -1
- package/dist/src/gate/index.d.ts +1 -1
- package/dist/src/gate/index.d.ts.map +1 -1
- package/dist/src/gate/index.js.map +1 -1
- package/dist/src/gate/reply-judge.d.ts +4 -0
- package/dist/src/gate/reply-judge.d.ts.map +1 -1
- package/dist/src/gate/reply-judge.js +12 -3
- package/dist/src/gate/reply-judge.js.map +1 -1
- package/dist/src/gate/rule-scope.d.ts +30 -0
- package/dist/src/gate/rule-scope.d.ts.map +1 -0
- package/dist/src/gate/rule-scope.js +41 -0
- package/dist/src/gate/rule-scope.js.map +1 -0
- package/dist/src/gate/suppress-script-worker.d.ts +2 -0
- package/dist/src/gate/suppress-script-worker.d.ts.map +1 -0
- package/dist/src/gate/suppress-script-worker.js +103 -0
- package/dist/src/gate/suppress-script-worker.js.map +1 -0
- package/dist/src/gate/suppress-scripts.d.ts +105 -0
- package/dist/src/gate/suppress-scripts.d.ts.map +1 -0
- package/dist/src/gate/suppress-scripts.js +403 -0
- package/dist/src/gate/suppress-scripts.js.map +1 -0
- package/dist/src/gate/suppression-review.d.ts +143 -0
- package/dist/src/gate/suppression-review.d.ts.map +1 -0
- package/dist/src/gate/suppression-review.js +463 -0
- package/dist/src/gate/suppression-review.js.map +1 -0
- package/dist/src/gate/suppression-stats.d.ts +125 -0
- package/dist/src/gate/suppression-stats.d.ts.map +1 -0
- package/dist/src/gate/suppression-stats.js +214 -0
- package/dist/src/gate/suppression-stats.js.map +1 -0
- package/dist/src/gate/types.d.ts +142 -7
- package/dist/src/gate/types.d.ts.map +1 -1
- package/dist/src/gate/wake-onboarding.d.ts +119 -0
- package/dist/src/gate/wake-onboarding.d.ts.map +1 -0
- package/dist/src/gate/wake-onboarding.js +277 -0
- package/dist/src/gate/wake-onboarding.js.map +1 -0
- package/dist/src/heartbeat/heartbeat.js +1 -1
- package/dist/src/heartbeat/heartbeat.js.map +1 -1
- package/dist/src/held-writes.d.ts +31 -23
- package/dist/src/held-writes.d.ts.map +1 -1
- package/dist/src/held-writes.js +44 -59
- package/dist/src/held-writes.js.map +1 -1
- package/dist/src/index.d.ts +6 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/inference-bounds.d.ts +2 -1
- package/dist/src/inference-bounds.d.ts.map +1 -1
- package/dist/src/inference-bounds.js +9 -6
- package/dist/src/inference-bounds.js.map +1 -1
- package/dist/src/jsonrpc-envelope.d.ts +69 -0
- package/dist/src/jsonrpc-envelope.d.ts.map +1 -0
- package/dist/src/jsonrpc-envelope.js +66 -0
- package/dist/src/jsonrpc-envelope.js.map +1 -0
- package/dist/src/mcpl/channel-registry.d.ts +188 -28
- package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.js +426 -70
- package/dist/src/mcpl/channel-registry.js.map +1 -1
- package/dist/src/mcpl/checkpoint-manager.d.ts +2 -4
- package/dist/src/mcpl/checkpoint-manager.d.ts.map +1 -1
- package/dist/src/mcpl/checkpoint-manager.js.map +1 -1
- package/dist/src/mcpl/feature-set-manager.d.ts +2 -4
- package/dist/src/mcpl/feature-set-manager.d.ts.map +1 -1
- package/dist/src/mcpl/feature-set-manager.js.map +1 -1
- package/dist/src/mcpl/inbound-source.d.ts +2 -1
- package/dist/src/mcpl/inbound-source.d.ts.map +1 -1
- package/dist/src/mcpl/inbound-source.js +2 -1
- package/dist/src/mcpl/inbound-source.js.map +1 -1
- package/dist/src/mcpl/inference-router.d.ts +6 -6
- package/dist/src/mcpl/inference-router.d.ts.map +1 -1
- package/dist/src/mcpl/inference-router.js.map +1 -1
- package/dist/src/mcpl/modern-connection.d.ts +109 -15
- package/dist/src/mcpl/modern-connection.d.ts.map +1 -1
- package/dist/src/mcpl/modern-connection.js +593 -86
- package/dist/src/mcpl/modern-connection.js.map +1 -1
- package/dist/src/mcpl/protocol-family.d.ts +3 -1
- package/dist/src/mcpl/protocol-family.d.ts.map +1 -1
- package/dist/src/mcpl/protocol-family.js +15 -9
- package/dist/src/mcpl/protocol-family.js.map +1 -1
- package/dist/src/mcpl/push-coalescer.d.ts +132 -22
- package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
- package/dist/src/mcpl/push-coalescer.js +105 -15
- package/dist/src/mcpl/push-coalescer.js.map +1 -1
- package/dist/src/mcpl/push-handler.d.ts +9 -7
- package/dist/src/mcpl/push-handler.d.ts.map +1 -1
- package/dist/src/mcpl/push-handler.js.map +1 -1
- package/dist/src/mcpl/server-connection.d.ts +50 -28
- package/dist/src/mcpl/server-connection.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.js +165 -72
- package/dist/src/mcpl/server-connection.js.map +1 -1
- package/dist/src/mcpl/tool-classes.d.ts.map +1 -1
- package/dist/src/mcpl/tool-classes.js +3 -0
- package/dist/src/mcpl/tool-classes.js.map +1 -1
- package/dist/src/mcpl/tool-presence.d.ts.map +1 -1
- package/dist/src/mcpl/tool-presence.js +10 -6
- package/dist/src/mcpl/tool-presence.js.map +1 -1
- package/dist/src/mcpl/toolset-host.d.ts.map +1 -1
- package/dist/src/mcpl/toolset-host.js +7 -6
- package/dist/src/mcpl/toolset-host.js.map +1 -1
- package/dist/src/mcpl/toolsets-module.d.ts.map +1 -1
- package/dist/src/mcpl/toolsets-module.js +2 -1
- package/dist/src/mcpl/toolsets-module.js.map +1 -1
- package/dist/src/mcpl/types.d.ts +33 -6
- package/dist/src/mcpl/types.d.ts.map +1 -1
- package/dist/src/mcpl/types.js.map +1 -1
- package/dist/src/module-registry.d.ts +24 -1
- package/dist/src/module-registry.d.ts.map +1 -1
- package/dist/src/module-registry.js +68 -18
- package/dist/src/module-registry.js.map +1 -1
- package/dist/src/modules/discord/index.d.ts +45 -8
- package/dist/src/modules/discord/index.d.ts.map +1 -1
- package/dist/src/modules/discord/index.js +238 -87
- package/dist/src/modules/discord/index.js.map +1 -1
- package/dist/src/modules/health/index.js +2 -2
- package/dist/src/modules/health/index.js.map +1 -1
- package/dist/src/modules/history/index.d.ts +59 -0
- package/dist/src/modules/history/index.d.ts.map +1 -1
- package/dist/src/modules/history/index.js +432 -67
- package/dist/src/modules/history/index.js.map +1 -1
- package/dist/src/modules/history/semantic.d.ts +6 -5
- package/dist/src/modules/history/semantic.d.ts.map +1 -1
- package/dist/src/modules/history/semantic.js +18 -25
- package/dist/src/modules/history/semantic.js.map +1 -1
- package/dist/src/modules/workspace/disk-agreement.d.ts +1 -1
- package/dist/src/modules/workspace/disk-agreement.js +1 -1
- package/dist/src/modules/workspace/index.d.ts +28 -7
- package/dist/src/modules/workspace/index.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.js +80 -25
- package/dist/src/modules/workspace/index.js.map +1 -1
- package/dist/src/modules/workspace/observe.d.ts.map +1 -1
- package/dist/src/modules/workspace/observe.js +2 -1
- package/dist/src/modules/workspace/observe.js.map +1 -1
- package/dist/src/modules/workspace/reconcile.d.ts.map +1 -1
- package/dist/src/modules/workspace/reconcile.js +3 -2
- package/dist/src/modules/workspace/reconcile.js.map +1 -1
- package/dist/src/notice-tags.d.ts +20 -9
- package/dist/src/notice-tags.d.ts.map +1 -1
- package/dist/src/notice-tags.js +20 -9
- package/dist/src/notice-tags.js.map +1 -1
- package/dist/src/operator-log.d.ts +36 -3
- package/dist/src/operator-log.d.ts.map +1 -1
- package/dist/src/operator-log.js +2 -2
- package/dist/src/operator-log.js.map +1 -1
- package/dist/src/presentation.d.ts +747 -0
- package/dist/src/presentation.d.ts.map +1 -0
- package/dist/src/presentation.js +1437 -0
- package/dist/src/presentation.js.map +1 -0
- package/dist/src/prose-drafts.d.ts +15 -11
- package/dist/src/prose-drafts.d.ts.map +1 -1
- package/dist/src/prose-drafts.js +16 -12
- package/dist/src/prose-drafts.js.map +1 -1
- package/dist/src/read-marks.d.ts +192 -0
- package/dist/src/read-marks.d.ts.map +1 -0
- package/dist/src/read-marks.js +242 -0
- package/dist/src/read-marks.js.map +1 -0
- package/dist/src/reasoning-loss.d.ts +5 -0
- package/dist/src/reasoning-loss.d.ts.map +1 -0
- package/dist/src/reasoning-loss.js +8 -0
- package/dist/src/reasoning-loss.js.map +1 -0
- package/dist/src/recovery/offline-branch.d.ts +91 -6
- package/dist/src/recovery/offline-branch.d.ts.map +1 -1
- package/dist/src/recovery/offline-branch.js +277 -32
- package/dist/src/recovery/offline-branch.js.map +1 -1
- package/dist/src/recovery/recover-cli.js +24 -4
- package/dist/src/recovery/recover-cli.js.map +1 -1
- package/dist/src/send-tools.d.ts +5 -9
- package/dist/src/send-tools.d.ts.map +1 -1
- package/dist/src/send-tools.js +40 -7
- package/dist/src/send-tools.js.map +1 -1
- package/dist/src/sent-rows.js +1 -1
- package/dist/src/stored-injections.d.ts +2 -2
- package/dist/src/stored-injections.js +2 -2
- package/dist/src/stored-removal.d.ts +17 -4
- package/dist/src/stored-removal.d.ts.map +1 -1
- package/dist/src/stored-removal.js +29 -5
- package/dist/src/stored-removal.js.map +1 -1
- package/dist/src/supplied-text.d.ts +1 -1
- package/dist/src/supplied-text.js +3 -3
- package/dist/src/supplied-text.js.map +1 -1
- package/dist/src/thinking-drops.d.ts +2 -0
- package/dist/src/thinking-drops.d.ts.map +1 -1
- package/dist/src/thinking-drops.js.map +1 -1
- package/dist/src/tool-presentation.d.ts.map +1 -1
- package/dist/src/tool-presentation.js +38 -9
- package/dist/src/tool-presentation.js.map +1 -1
- package/dist/src/tool-result-guard.d.ts +12 -1
- package/dist/src/tool-result-guard.d.ts.map +1 -1
- package/dist/src/tool-result-guard.js +42 -8
- package/dist/src/tool-result-guard.js.map +1 -1
- package/dist/src/tune-out/coordinator.d.ts +1170 -81
- package/dist/src/tune-out/coordinator.d.ts.map +1 -1
- package/dist/src/tune-out/coordinator.js +3732 -369
- package/dist/src/tune-out/coordinator.js.map +1 -1
- package/dist/src/tune-out/tools.d.ts +114 -17
- package/dist/src/tune-out/tools.d.ts.map +1 -1
- package/dist/src/tune-out/tools.js +89 -28
- package/dist/src/tune-out/tools.js.map +1 -1
- package/dist/src/tune-out/window-anchor.d.ts +143 -0
- package/dist/src/tune-out/window-anchor.d.ts.map +1 -0
- package/dist/src/tune-out/window-anchor.js +202 -0
- package/dist/src/tune-out/window-anchor.js.map +1 -0
- package/dist/src/types/agent.d.ts +121 -25
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/events.d.ts +2 -0
- package/dist/src/types/events.d.ts.map +1 -1
- package/dist/src/types/framework.d.ts +72 -17
- package/dist/src/types/framework.d.ts.map +1 -1
- package/dist/src/types/inference-log.d.ts +1 -0
- package/dist/src/types/inference-log.d.ts.map +1 -1
- package/dist/src/types/module.d.ts +180 -69
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/trace.d.ts +573 -39
- package/dist/src/types/trace.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/admission/admit.ts +32 -3
- package/src/agent.ts +392 -132
- package/src/api/mcp-server-core.ts +54 -17
- package/src/api/server.ts +4 -23
- package/src/append-all.ts +6 -0
- package/src/code-execution/isolate/scripts.ts +28 -3
- package/src/config-checks.ts +14 -0
- package/src/context-manager-errors.ts +37 -0
- package/src/context-options.ts +106 -0
- package/src/cut-off-round.ts +4 -4
- package/src/deferred-import.ts +239 -0
- package/src/dendrite/audience.ts +315 -0
- package/src/dendrite/index.ts +14 -2
- package/src/dendrite/presets.ts +18 -6
- package/src/dendrite/registry.ts +213 -14
- package/src/dendrite/types.ts +92 -8
- package/src/failure-text.ts +88 -0
- package/src/foreign-rounds.ts +199 -0
- package/src/framework.ts +8796 -3813
- package/src/gate/event-gate.ts +518 -91
- package/src/gate/index.ts +3 -0
- package/src/gate/reply-judge.ts +12 -3
- package/src/gate/rule-scope.ts +45 -0
- package/src/gate/suppress-script-worker.ts +89 -0
- package/src/gate/suppress-scripts.ts +414 -0
- package/src/gate/suppression-review.ts +517 -0
- package/src/gate/suppression-stats.ts +314 -0
- package/src/gate/types.ts +148 -7
- package/src/gate/wake-onboarding.ts +309 -0
- package/src/heartbeat/heartbeat.ts +1 -1
- package/src/held-writes.ts +49 -60
- package/src/index.ts +10 -2
- package/src/inference-bounds.ts +11 -6
- package/src/jsonrpc-envelope.ts +81 -0
- package/src/mcpl/channel-registry.ts +513 -116
- package/src/mcpl/checkpoint-manager.ts +3 -2
- package/src/mcpl/feature-set-manager.ts +2 -1
- package/src/mcpl/inbound-source.ts +2 -1
- package/src/mcpl/inference-router.ts +7 -4
- package/src/mcpl/modern-connection.ts +629 -91
- package/src/mcpl/protocol-family.ts +15 -9
- package/src/mcpl/push-coalescer.ts +193 -34
- package/src/mcpl/push-handler.ts +10 -5
- package/src/mcpl/server-connection.ts +169 -75
- package/src/mcpl/tool-classes.ts +3 -0
- package/src/mcpl/tool-presence.ts +10 -5
- package/src/mcpl/toolset-host.ts +7 -6
- package/src/mcpl/toolsets-module.ts +2 -1
- package/src/mcpl/types.ts +33 -6
- package/src/module-registry.ts +73 -17
- package/src/modules/discord/index.ts +230 -82
- package/src/modules/health/index.ts +2 -2
- package/src/modules/history/index.ts +439 -70
- package/src/modules/history/semantic.ts +18 -24
- package/src/modules/workspace/disk-agreement.ts +1 -1
- package/src/modules/workspace/index.ts +89 -26
- package/src/modules/workspace/observe.ts +2 -1
- package/src/modules/workspace/reconcile.ts +3 -2
- package/src/notice-tags.ts +21 -9
- package/src/operator-log.ts +36 -3
- package/src/presentation.ts +1678 -0
- package/src/prose-drafts.ts +16 -12
- package/src/read-marks.ts +328 -0
- package/src/reasoning-loss.ts +7 -0
- package/src/recovery/offline-branch.ts +350 -35
- package/src/recovery/recover-cli.ts +23 -4
- package/src/send-tools.ts +40 -7
- package/src/sent-rows.ts +1 -1
- package/src/stored-injections.ts +2 -2
- package/src/stored-removal.ts +31 -7
- package/src/supplied-text.ts +3 -3
- package/src/thinking-drops.ts +2 -0
- package/src/tool-presentation.ts +34 -9
- package/src/tool-result-guard.ts +41 -7
- package/src/tune-out/coordinator.ts +4121 -472
- package/src/tune-out/tools.ts +162 -44
- package/src/tune-out/window-anchor.ts +277 -0
- package/src/types/agent.ts +122 -25
- package/src/types/events.ts +2 -0
- package/src/types/framework.ts +73 -17
- package/src/types/inference-log.ts +1 -0
- package/src/types/module.ts +181 -68
- package/src/types/trace.ts +607 -43
package/src/types/module.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { ContentBlock } from '@animalabs/membrane';
|
|
2
2
|
import type {
|
|
3
|
+
ContextManager,
|
|
3
4
|
MessageId,
|
|
4
5
|
MessageMetadata,
|
|
5
6
|
StoredMessage,
|
|
6
7
|
ContextInjection,
|
|
8
|
+
WindowStatus,
|
|
7
9
|
} from '@animalabs/context-manager';
|
|
8
10
|
import type { ProcessEvent, ToolDefinition, ToolCall, ToolResult } from './events.js';
|
|
9
11
|
import type { TraceEventListener } from './trace.js';
|
|
@@ -49,44 +51,54 @@ export interface MessageQuery {
|
|
|
49
51
|
export type ModuleContextInjection = ContextInjection & { placedEachCompile?: true };
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
|
-
* A message as a module context's reads answer it: a stored row,
|
|
53
|
-
*
|
|
54
|
-
* `heldFromResidents` when a tune-out holds it from the
|
|
54
|
+
* A message as a module context's reads answer it: a stored row, marked
|
|
55
|
+
* `held` when it isn't in the window of the agent the read is for, and
|
|
56
|
+
* `heldFromResidents` when a tune-out or a suppress rule holds it from the
|
|
57
|
+
* residents.
|
|
55
58
|
*/
|
|
56
59
|
export type ModuleMessage = StoredMessage & {
|
|
57
60
|
/**
|
|
58
|
-
* True
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
61
|
+
* True on a row stored and not in the window of the agent the read is for
|
|
62
|
+
* (#291's presentation index): it arrived while that agent's turn was
|
|
63
|
+
* alive, or while the host was quiesced, and enters the window at the
|
|
64
|
+
* agent's next presentation point (a turn's start, a tool boundary that
|
|
65
|
+
* can carry it, a turn's end, or at once while no turn of it is alive);
|
|
66
|
+
* or it was taken out of the window as an undone turn's; or it is never
|
|
67
|
+
* presented to that agent, as a held message is to a resident. Set only
|
|
68
|
+
* once that agent's window is written down (presented mode); a held
|
|
69
|
+
* message an earlier release stored is in a resident's window written
|
|
70
|
+
* down from the record, so it reads without `held`, and
|
|
71
|
+
* `heldFromResidents` is what marks it. Its `id`,
|
|
72
|
+
* `sequence` and `timestamp` are the store's, as for any row: since #291
|
|
73
|
+
* every write is stored at once, so no row is a handle and nothing
|
|
74
|
+
* changes when it enters the window. Before #291 the same name marked a
|
|
75
|
+
* write the framework still held, under a `held:` handle; see the
|
|
76
|
+
* changelog. Absent on a row the window holds.
|
|
69
77
|
*/
|
|
70
78
|
held?: true;
|
|
71
79
|
/**
|
|
72
80
|
* True on a message a tune-out holds from the residents: one that arrived
|
|
73
81
|
* in a tuned-out channel, stamped `metadata.tuneOut` as it came in. The
|
|
74
82
|
* store keeps it, but no resident is shown the row itself: no resident's
|
|
75
|
-
* compiled view includes it, during the tune-out or after it
|
|
76
|
-
* resident's tool boundary of a turn alive
|
|
77
|
-
*
|
|
83
|
+
* compiled view includes it, during the tune-out or after it. It is
|
|
84
|
+
* stored as any write is, and a resident's tool boundary of a turn alive
|
|
85
|
+
* when it arrived doesn't inject it into the live turn. The subconscious
|
|
86
|
+
* reads it. Its
|
|
78
87
|
* text can still reach a resident in rows of their own, which aren't
|
|
79
88
|
* marked, such as the
|
|
80
89
|
* cancel's `<tuned-out-backlog>` row, with the text of the tune-out's newest
|
|
81
90
|
* messages, up to `backlogCap` of them and as many as fit in one of the
|
|
82
|
-
* residents' messages
|
|
83
|
-
*
|
|
91
|
+
* residents' messages; what the subconscious says of it, in its report or
|
|
92
|
+
* its note; and the
|
|
84
93
|
* result of a tool that reads history on request, such as a
|
|
85
94
|
* channel's `fetch_history` or the history module's `extract`. A module
|
|
86
95
|
* that builds on what the residents see, such as one choosing from the
|
|
87
96
|
* recent conversation, leaves a marked row out, and one that matches
|
|
88
|
-
* what's stored, such as a sync's dedupe, keeps it. A
|
|
89
|
-
* is marked too
|
|
97
|
+
* what's stored, such as a sync's dedupe, keeps it. A row a suppress rule
|
|
98
|
+
* hid (`metadata.suppressed`) is marked too: no view shows it, the
|
|
99
|
+
* subconscious's included, and no window presents it, so once the
|
|
100
|
+
* agent's window is written down it reads `held` too. Absent on every
|
|
101
|
+
* other row.
|
|
90
102
|
*/
|
|
91
103
|
heldFromResidents?: true;
|
|
92
104
|
};
|
|
@@ -95,9 +107,8 @@ export type ModuleMessage = StoredMessage & {
|
|
|
95
107
|
* Result of a message query.
|
|
96
108
|
*/
|
|
97
109
|
export interface MessageQueryResult {
|
|
98
|
-
/** The matching stored rows,
|
|
99
|
-
*
|
|
100
|
-
* in a reversed query */
|
|
110
|
+
/** The matching stored rows, in store order (newest first in a reversed
|
|
111
|
+
* query), each marked as ModuleMessage says. */
|
|
101
112
|
messages: ModuleMessage[];
|
|
102
113
|
totalCount: number;
|
|
103
114
|
}
|
|
@@ -281,9 +292,10 @@ export interface AgentSettingsExtension {
|
|
|
281
292
|
* nothing.
|
|
282
293
|
*
|
|
283
294
|
* Its reads (`getState`, `getLog`, `getLogLength`, `getMessage`,
|
|
284
|
-
* `queryMessages`, `getAgents`, `getActiveTools`, `findMessageByExternalId
|
|
285
|
-
*
|
|
286
|
-
*
|
|
295
|
+
* `queryMessages`, `getAgents`, `getActiveTools`, `findMessageByExternalId`,
|
|
296
|
+
* and the window lookups `windowStatusOf`, `observes`, `viewKeeps` and
|
|
297
|
+
* `agentNameOf` where the framework offers them) answer, and fail, as
|
|
298
|
+
* before. The framework calls none of the
|
|
287
299
|
* module's `onProcess`, `onAgentSpeech` and `onToolBatchComplete` again; it
|
|
288
300
|
* drops whole a response of its that hadn't been applied by then, with a line
|
|
289
301
|
* naming what the response asked for if it asked for anything; and it leaves
|
|
@@ -381,20 +393,44 @@ export interface ModuleContext {
|
|
|
381
393
|
getModule<T extends Module>(name: string): T | null;
|
|
382
394
|
|
|
383
395
|
/**
|
|
384
|
-
* Add a message to the conversation, and answer its id.
|
|
385
|
-
*
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
*
|
|
396
|
+
* Add a message to the conversation, and answer its stored id. The write
|
|
397
|
+
* is stored at once, whatever the agent's turn (#291): it enters the
|
|
398
|
+
* agent's window at the agent's next presentation point, or at once while
|
|
399
|
+
* no turn of it is alive, and until then reads mark it `held`
|
|
400
|
+
* (ModuleMessage.held). Only while the write is kept in memory is the id
|
|
401
|
+
* '': while an operator's surgery holds the store, stored at the
|
|
402
|
+
* surgery's end, and while the agent's context manager refuses its work
|
|
403
|
+
* after a failed re-initialization, stored when a switchBranch()
|
|
404
|
+
* re-initializes it (a restart loses it; if the agent ends first, it goes
|
|
405
|
+
* to the primary when it is a write the primary takes in its place).
|
|
406
|
+
* Until it lands, such a write can't be read, edited or removed through
|
|
407
|
+
* this context: it has no id, getMessage, editMessage and removeMessage
|
|
408
|
+
* take none for it, and queryMessages and findMessageByExternalId read
|
|
409
|
+
* the store, which doesn't hold it yet. Its release stores it as it was
|
|
410
|
+
* given here. A module that must change it keeps the change and applies
|
|
411
|
+
* it to the row once the row is stored, which the release traces
|
|
412
|
+
* synchronously as `message:added` with source `surgery-release` and the
|
|
413
|
+
* stored id, as the Discord module does for an edit or a delete of a
|
|
414
|
+
* message whose create was kept.
|
|
415
|
+
* Writes a release before #291 held and kept across a restart are
|
|
416
|
+
* stored once create() imports them, which is after every module's
|
|
417
|
+
* start().
|
|
418
|
+
* A write whose store throws after rows of it landed is answered by the
|
|
419
|
+
* first of them, as stored (context-manager's WriteLandedError names
|
|
420
|
+
* them). One whose store throws where the store can't be read to tell
|
|
421
|
+
* what of it landed throws context-manager's WriteOutcomeUnknownError,
|
|
422
|
+
* which names the rows it knows are stored (`landed`, presented as a
|
|
423
|
+
* stored write's rows are) and counts those it can't (`unknown`,
|
|
424
|
+
* `unnamed`): the write may be stored, in part or whole, or not at all,
|
|
425
|
+
* and isn't answered as stored. A read of the store tells, once the store
|
|
426
|
+
* reads: queryMessages, or findMessageByExternalId for a write that
|
|
427
|
+
* carried `metadata.external`. Any other error means none of it is stored.
|
|
392
428
|
*
|
|
393
429
|
* With `opts.forAgent`, it's added to the named agent's window instead: a
|
|
394
430
|
* conversation fork's or a running sub-agent's own store, or, for an
|
|
395
|
-
* ordinary resident, the residents' shared slot. It
|
|
396
|
-
* agent's
|
|
397
|
-
* primary's
|
|
431
|
+
* ordinary resident, the residents' shared slot. It enters that agent's
|
|
432
|
+
* window at that agent's points, as a write for the primary does at the
|
|
433
|
+
* primary's. A name that isn't a registered agent when the write is
|
|
398
434
|
* made, or the empty name, throws, naming the registered ones, so a write
|
|
399
435
|
* for a launcher that has gone is heard. For an ephemeral run (a
|
|
400
436
|
* sub-agent's run) or a conversation fork, whose window nothing reads
|
|
@@ -413,12 +449,17 @@ export interface ModuleContext {
|
|
|
413
449
|
* failed reply, or a channel notice its reader could act on). getMessage,
|
|
414
450
|
* editMessage and removeMessage read the delivery agent's window (the
|
|
415
451
|
* primary's, or the first agent's when none is primary): they don't take
|
|
416
|
-
* an id
|
|
452
|
+
* an id for a row in a fork's or a sub-agent's window, and don't
|
|
417
453
|
* find it (read it with queryMessages and the same forAgent). The
|
|
418
454
|
* residents' shared slot is the primary's window too, for a primary
|
|
419
455
|
* that's an ordinary resident, so there they do.
|
|
420
456
|
* `metadata.external` with a target throws: its id map is read in the
|
|
421
|
-
* primary's window.
|
|
457
|
+
* primary's window. The row is stamped (`metadata.audience`, #291) for
|
|
458
|
+
* the agent named, or, with no agent named, for the agents that take
|
|
459
|
+
* untargeted inbound in the slot it lands in: every resident on a
|
|
460
|
+
* residents' host. A row a suppress rule took is stamped for nobody, and
|
|
461
|
+
* one carrying a tune-out's hold for nobody but a named agent whose view
|
|
462
|
+
* keeps held traffic (the persistent subconscious).
|
|
422
463
|
*/
|
|
423
464
|
addMessage(
|
|
424
465
|
participant: string,
|
|
@@ -428,48 +469,53 @@ export interface ModuleContext {
|
|
|
428
469
|
): MessageId;
|
|
429
470
|
|
|
430
471
|
/**
|
|
431
|
-
* Edit a message, by its id
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
472
|
+
* Edit a stored message, by its id. An edit of a row an agent's window
|
|
473
|
+
* holds changes what that agent's next compile sends, as for any stored
|
|
474
|
+
* row. For one release it also takes the `held:` handle a release before
|
|
475
|
+
* #291 answered for a write it held, and edits the row that write landed
|
|
476
|
+
* as.
|
|
435
477
|
*/
|
|
436
478
|
editMessage(id: MessageId, content: ContentBlock[]): void;
|
|
437
479
|
|
|
438
480
|
/**
|
|
439
|
-
* Remove a message, by its id
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
* with nothing changed.
|
|
481
|
+
* Remove a stored message, by its id. For one release it also takes the
|
|
482
|
+
* `held:` handle a release before #291 answered for a write it held, and
|
|
483
|
+
* removes the row that write landed as.
|
|
443
484
|
*/
|
|
444
485
|
removeMessage(id: MessageId): void;
|
|
445
486
|
|
|
446
487
|
/**
|
|
447
488
|
* Find the message for an external ID this context added a message under:
|
|
448
|
-
* the row it added, while the store holds it. For a write
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
*
|
|
489
|
+
* the row it added, while the store holds it. For a write whose id this
|
|
490
|
+
* context doesn't keep (one kept in memory, by an operator's surgery or
|
|
491
|
+
* for its agent's recovery, one whose store threw where context-manager
|
|
492
|
+
* couldn't tell whether it landed (WriteOutcomeUnknownError), or one a
|
|
493
|
+
* release before #291 held, whose map it kept as ''), the first row the
|
|
494
|
+
* store shows under that external ID. Null when this context added none under
|
|
495
|
+
* it, when the row it added is gone, or when the store shows none for
|
|
496
|
+
* such a write, as for one an earlier release left queued, looked up in
|
|
497
|
+
* start() before create() imports it.
|
|
454
498
|
*/
|
|
455
499
|
findMessageByExternalId(source: string, externalId: string): MessageId | null;
|
|
456
500
|
|
|
457
501
|
/**
|
|
458
|
-
* Get a message by its id
|
|
459
|
-
*
|
|
460
|
-
*
|
|
502
|
+
* Get a stored message by its id, marked as ModuleMessage says: `held`
|
|
503
|
+
* when it isn't in the delivery agent's window, `heldFromResidents` when a
|
|
504
|
+
* tune-out or a suppress rule holds it from the residents. For one release
|
|
505
|
+
* it also takes the `held:` handle a release before #291 answered, and
|
|
506
|
+
* gives the row that write landed as.
|
|
461
507
|
*/
|
|
462
508
|
getMessage(id: MessageId): ModuleMessage | null;
|
|
463
509
|
|
|
464
510
|
/**
|
|
465
511
|
* Query messages by filter criteria.
|
|
466
512
|
* Useful for finding messages from external sources, by participant, etc.
|
|
467
|
-
* The rows
|
|
468
|
-
* the
|
|
469
|
-
*
|
|
470
|
-
*
|
|
471
|
-
*
|
|
472
|
-
*
|
|
513
|
+
* The rows come in store order, each marked as ModuleMessage says: `held`
|
|
514
|
+
* when it isn't in the window of the agent the read is for (stored and not
|
|
515
|
+
* yet presented to it, or undone), and `heldFromResidents` when a tune-out
|
|
516
|
+
* or a suppress rule holds it from the residents. Writes a release before
|
|
517
|
+
* #291 left queued show once create() has imported them, after every
|
|
518
|
+
* module's start() (addMessage).
|
|
473
519
|
*
|
|
474
520
|
* It reads the primary's window (the first registered agent's when none
|
|
475
521
|
* is primary), or with `opts.forAgent`, the named agent's: a conversation
|
|
@@ -482,6 +528,67 @@ export interface ModuleContext {
|
|
|
482
528
|
*/
|
|
483
529
|
queryMessages(filter: MessageQuery, opts?: { forAgent?: string }): MessageQueryResult;
|
|
484
530
|
|
|
531
|
+
/**
|
|
532
|
+
* Where a stored row stands with an agent's window (#291), the rows its
|
|
533
|
+
* requests are given, before its view's filter (context-manager's
|
|
534
|
+
* `windowStatusOf`): `'in'` when the window holds it, which is every row
|
|
535
|
+
* its record holds while the window is still the record; `'undone'` when
|
|
536
|
+
* it was taken out as an undone turn's, or shed after a refusal; `'out'`
|
|
537
|
+
* when it is stored and not in the window (not presented to the agent
|
|
538
|
+
* yet, or taken back to arrived); `'absent'` when the agent's record
|
|
539
|
+
* doesn't hold it (removed, never stored on its branch, or in a slot it
|
|
540
|
+
* doesn't read). For the delivery agent (the primary's, or the first
|
|
541
|
+
* agent's when none is primary), or with `opts.forAgent`, the named
|
|
542
|
+
* agent, which must be registered, as for queryMessages: a name that
|
|
543
|
+
* isn't throws. A tool that reads the record for an agent, such as the
|
|
544
|
+
* history module's, says with it, and with viewKeeps, which of the rows it
|
|
545
|
+
* returns the agent isn't being shown.
|
|
546
|
+
*
|
|
547
|
+
* Optional: a framework from before the presentation index, or a host's
|
|
548
|
+
* own context, doesn't offer it. Call as `ctx.windowStatusOf?.(...)`.
|
|
549
|
+
*/
|
|
550
|
+
windowStatusOf?(id: MessageId, opts?: { forAgent?: string }): WindowStatus;
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Whether `observer` reads `observed`'s own rows through an observe edge
|
|
554
|
+
* (dendrite's relationships): one of its edges reads another slot
|
|
555
|
+
* `observed` owns, or names `observed` and reads the observer's own slot
|
|
556
|
+
* (a resident's `AgentConfig.observes`). Seeing another agent's rounds is
|
|
557
|
+
* a declared relationship (#291, decision 1): an observe edge, which a
|
|
558
|
+
* resident's configuration declares with `observes`, so a tool that reads
|
|
559
|
+
* the record for an agent leaves out another agent's own rows it isn't
|
|
560
|
+
* shown unless this is true.
|
|
561
|
+
* False for a name the registry doesn't know. Optional, as
|
|
562
|
+
* windowStatusOf is, and offered with it.
|
|
563
|
+
*/
|
|
564
|
+
observes?(observer: string, observed: string): boolean;
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Whether an agent's view keeps a stored row (#291): whether its requests
|
|
568
|
+
* carry the row, as its strategy renders it (a row it has folded, as that
|
|
569
|
+
* summary), while its window holds it. windowStatusOf answers before
|
|
570
|
+
* the view's filter, and a window written down from the record the
|
|
571
|
+
* residents share can hold rows the view never sends: another agent's
|
|
572
|
+
* stored context injection, and, for an agent whose view leaves held
|
|
573
|
+
* traffic out (a resident), a row a tune-out holds from the residents. A
|
|
574
|
+
* row the agent is shown is one windowStatusOf reads `'in'` and this
|
|
575
|
+
* keeps. It reads the view the agent's context was opened with
|
|
576
|
+
* (context-options.ts), for the delivery agent, or with `opts.forAgent`
|
|
577
|
+
* the named agent, which must be registered, as for windowStatusOf: a name
|
|
578
|
+
* that isn't throws. Optional, as windowStatusOf is, and offered with it.
|
|
579
|
+
*/
|
|
580
|
+
viewKeeps?(row: StoredMessage, opts?: { forAgent?: string }): boolean;
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* The live agent whose context `contextManager` is (the one its
|
|
584
|
+
* `getContextManager()` returns), or undefined when it is no live
|
|
585
|
+
* agent's (#291). A module a host binds to an agent's context, as it binds
|
|
586
|
+
* the history module, reads that context's record and summaries; this
|
|
587
|
+
* says whose they are, so another agent's call can be told from that
|
|
588
|
+
* agent's own. Optional, as windowStatusOf is, and offered with it.
|
|
589
|
+
*/
|
|
590
|
+
agentNameOf?(contextManager: ContextManager): string | undefined;
|
|
591
|
+
|
|
485
592
|
/**
|
|
486
593
|
* Get info about all agents.
|
|
487
594
|
*/
|
|
@@ -649,19 +756,25 @@ export type AgentStatus = 'idle' | 'inferring' | 'streaming' | 'waiting_for_tool
|
|
|
649
756
|
*/
|
|
650
757
|
export interface EventResponse {
|
|
651
758
|
/**
|
|
652
|
-
* Messages to add to the conversation.
|
|
759
|
+
* Messages to add to the conversation. Each row says who it is for in
|
|
760
|
+
* `metadata.audience` (#291): the agents a `requestInference` list names
|
|
761
|
+
* that are registered and read the slot the row lands in (the agent the
|
|
762
|
+
* row is delivered to, when none of them is registered); for `true`, no
|
|
763
|
+
* request, or a list whose registered agents don't read that slot (an
|
|
764
|
+
* isolated job, a conversation fork), as for any write that names no
|
|
765
|
+
* agent, the agents that take untargeted inbound in the slot it lands in
|
|
766
|
+
* (every resident on a residents' host). A message that carries a
|
|
767
|
+
* tune-out's hold is for nobody.
|
|
653
768
|
*/
|
|
654
769
|
addMessages?: NewMessage[];
|
|
655
770
|
|
|
656
771
|
/**
|
|
657
|
-
* Messages to edit, each by its id
|
|
658
|
-
* (ModuleContext.editMessage).
|
|
772
|
+
* Messages to edit, each by its stored id (ModuleContext.editMessage).
|
|
659
773
|
*/
|
|
660
774
|
editMessages?: MessageEdit[];
|
|
661
775
|
|
|
662
776
|
/**
|
|
663
|
-
* Messages to remove, each by its id
|
|
664
|
-
* (ModuleContext.removeMessage).
|
|
777
|
+
* Messages to remove, each by its stored id (ModuleContext.removeMessage).
|
|
665
778
|
*/
|
|
666
779
|
removeMessages?: MessageId[];
|
|
667
780
|
|