@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
|
@@ -12,7 +12,11 @@
|
|
|
12
12
|
* so a message stamped slightly out of order is still picked up; the
|
|
13
13
|
* service dedups by id + text hash, so re-sending is free. Summaries are
|
|
14
14
|
* watermarked by `createdMs` (a fresh L3 spans months of old timestamps —
|
|
15
|
-
* its creation time is the only monotonic signal).
|
|
15
|
+
* its creation time is the only monotonic signal). Both watermarks are
|
|
16
|
+
* kept in the module's state, which follows the store's branches, so each
|
|
17
|
+
* branch sends its own messages and summaries. A branch made at an earlier
|
|
18
|
+
* point, as an undo makes one, mints summary ids its parent already used,
|
|
19
|
+
* so a summary is keyed `sum:<id>@<created>`.
|
|
16
20
|
*
|
|
17
21
|
* What gets embedded per message: text blocks verbatim, plus the string
|
|
18
22
|
* arguments of the agent's private-prose tools (think / journal / skip_reply
|
|
@@ -41,9 +45,30 @@ export interface SemanticIndexConfig {
|
|
|
41
45
|
syncIntervalMs?: number;
|
|
42
46
|
/** Items per upsert request. Default 128, max 256 (service limit). */
|
|
43
47
|
syncBatch?: number;
|
|
44
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* The most items one background tick's pass writes to the index: what the
|
|
50
|
+
* service reports each upsert inserted or updated, with each queued edit
|
|
51
|
+
* counted as one. Deletes aren't counted: a pass sends its queued removals
|
|
52
|
+
* whatever the budget, and deletes the items its summaries had from before
|
|
53
|
+
* they were keyed by creation time as it sends them.
|
|
54
|
+
*
|
|
55
|
+
* A pass also re-sends items the service already holds unchanged. They
|
|
56
|
+
* spend no budget however many there are, and each costs the service a
|
|
57
|
+
* check and a metadata write, with no embedding. They're the overlap
|
|
58
|
+
* behind the message cursor, the summaries since the summary cursor while
|
|
59
|
+
* a delete of their old items keeps failing, and, once on a branch with
|
|
60
|
+
* no cursor yet, as after upgrading to keys with the creation time, the
|
|
61
|
+
* summaries it shares with other branches. A tick that finds a pass
|
|
62
|
+
* already running, such as a search's catch-up, starts none of its own.
|
|
63
|
+
* Default 1024.
|
|
64
|
+
*/
|
|
45
65
|
maxSyncPerTick?: number;
|
|
46
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* The most items a pre-search catch-up writes to the index before
|
|
68
|
+
* searching anyway, counted as for `maxSyncPerTick`. A search that finds a
|
|
69
|
+
* pass already running, such as a tick's, waits for that pass instead,
|
|
70
|
+
* under that pass's own budget. Default 256.
|
|
71
|
+
*/
|
|
47
72
|
maxSyncBeforeSearch?: number;
|
|
48
73
|
/** Re-scan window behind the message watermark, ms. Default 10 min. */
|
|
49
74
|
overlapMs?: number;
|
|
@@ -167,6 +192,24 @@ export declare function summaryIndexText(s: {
|
|
|
167
192
|
}, cfg: {
|
|
168
193
|
maxChars?: number;
|
|
169
194
|
}): string;
|
|
195
|
+
/**
|
|
196
|
+
* A summary's index key, `sum:<id>@<created>`. A branch made at an earlier
|
|
197
|
+
* point mints ids its parent already used, so the id alone names two
|
|
198
|
+
* summaries; its creation time, set when it was minted and kept by a branch
|
|
199
|
+
* that inherits it, tells them apart.
|
|
200
|
+
*/
|
|
201
|
+
export declare function summaryKey(id: string, createdMs: number): string;
|
|
202
|
+
/**
|
|
203
|
+
* A `sum:` key read back: its summary id, and its creation time, or null for
|
|
204
|
+
* a key in the form written before summaries were keyed by it (`sum:<id>`).
|
|
205
|
+
* Null for a key that isn't a summary's. A finite number written as a string
|
|
206
|
+
* reads back as the same number, so the time compares equal to the
|
|
207
|
+
* summary's own.
|
|
208
|
+
*/
|
|
209
|
+
export declare function parseSummaryKey(key: string): {
|
|
210
|
+
id: string;
|
|
211
|
+
createdMs: number | null;
|
|
212
|
+
} | null;
|
|
170
213
|
export declare function summaryToItem(s: SummaryLike, cfg: {
|
|
171
214
|
maxChars?: number;
|
|
172
215
|
}): IndexItem | null;
|
|
@@ -175,12 +218,38 @@ export interface PendingChanges {
|
|
|
175
218
|
edited: string[];
|
|
176
219
|
removed: string[];
|
|
177
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* A branch's sync cursors for one index: the creation time through which its
|
|
223
|
+
* summaries are sent under their keys, and the time through which its
|
|
224
|
+
* messages are sent. Null where nothing is sent yet.
|
|
225
|
+
*/
|
|
226
|
+
export interface SyncCursors {
|
|
227
|
+
namespace: string;
|
|
228
|
+
summaries: number | null;
|
|
229
|
+
messages: number | null;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Where the sync cursors are kept. HistoryModule keeps them in module state,
|
|
233
|
+
* which the store's branches carry, so a branch made at an earlier point
|
|
234
|
+
* starts from the cursors as they were there, and another branch's passes
|
|
235
|
+
* never move them.
|
|
236
|
+
*/
|
|
237
|
+
export interface SyncCursorStore {
|
|
238
|
+
read(): SyncCursors | null;
|
|
239
|
+
write(cursors: SyncCursors): void;
|
|
240
|
+
}
|
|
178
241
|
export interface SyncReport {
|
|
179
242
|
pushed: number;
|
|
180
243
|
inserted: number;
|
|
181
244
|
updated: number;
|
|
182
245
|
unchanged: number;
|
|
183
|
-
/**
|
|
246
|
+
/**
|
|
247
|
+
* True when items may be left to send: the pass hit its item cap before
|
|
248
|
+
* the end of the store or of the queued edits, a delete of summaries' old
|
|
249
|
+
* items failed, it failed or was backing off, or the store left the branch
|
|
250
|
+
* it read during it. An edit or removal that a failed send queued again
|
|
251
|
+
* doesn't set it; the next pass sends it.
|
|
252
|
+
*/
|
|
184
253
|
more: boolean;
|
|
185
254
|
messagesScanned: number;
|
|
186
255
|
summariesScanned: number;
|
|
@@ -191,6 +260,8 @@ export declare class SemanticIndexer {
|
|
|
191
260
|
private readonly cfg;
|
|
192
261
|
private readonly log;
|
|
193
262
|
private inFlight;
|
|
263
|
+
/** The branch each pass read, by its report, for a search that joined it. */
|
|
264
|
+
private readonly passBranch;
|
|
194
265
|
private consecutiveFailures;
|
|
195
266
|
private backoffUntil;
|
|
196
267
|
lastError: string | null;
|
|
@@ -224,6 +295,32 @@ export declare class SemanticIndexer {
|
|
|
224
295
|
private deleteUnsupported;
|
|
225
296
|
/** Called whenever the pending edit/remove sets change. */
|
|
226
297
|
onPendingChange: ((p: PendingChanges) => void) | null;
|
|
298
|
+
/**
|
|
299
|
+
* Where the sync cursors are kept, set by the host. Without one, as
|
|
300
|
+
* before the host wires module state or after it unwires it, this indexer
|
|
301
|
+
* goes on from the cursors it last wrote for each branch, which it keeps
|
|
302
|
+
* in memory. A branch it wrote none for starts with none.
|
|
303
|
+
*/
|
|
304
|
+
cursorStore: SyncCursorStore | null;
|
|
305
|
+
/** The cursors this indexer last wrote, by branch id ('' for a store without branches). */
|
|
306
|
+
private readonly ownCursors;
|
|
307
|
+
/** The store's current branch, by id ('' for a store without branches). */
|
|
308
|
+
branchId(): string;
|
|
309
|
+
/**
|
|
310
|
+
* The current branch's cursors for this indexer's index. Cursors kept for
|
|
311
|
+
* another namespace, as before the host's index setting changed, are none
|
|
312
|
+
* here.
|
|
313
|
+
*/
|
|
314
|
+
private syncCursors;
|
|
315
|
+
/** Writes the current branch's cursors, which must be `branch`'s. */
|
|
316
|
+
private setSyncCursors;
|
|
317
|
+
/**
|
|
318
|
+
* Deletes ids from the index. A 404 in a pass whose /stats answered with
|
|
319
|
+
* stats shows the index is made, so it means a service build without the
|
|
320
|
+
* route: that sets deleteUnsupported and answers the 404's message. Null
|
|
321
|
+
* when the ids are deleted; any other failure throws.
|
|
322
|
+
*/
|
|
323
|
+
private deleteIds;
|
|
227
324
|
pendingSnapshot(): PendingChanges;
|
|
228
325
|
restorePending(p: PendingChanges | null | undefined): void;
|
|
229
326
|
private pendingChanged;
|
|
@@ -231,9 +328,14 @@ export declare class SemanticIndexer {
|
|
|
231
328
|
attach(): void;
|
|
232
329
|
dispose(): void;
|
|
233
330
|
get backingOff(): boolean;
|
|
331
|
+
/** The branch the pass that gave this report read, or null if it read none. */
|
|
332
|
+
passedOn(report: SyncReport): string | null;
|
|
234
333
|
/**
|
|
235
|
-
* Push what the index is missing,
|
|
236
|
-
*
|
|
334
|
+
* Push what the index is missing, writing at most `maxItems` items by the
|
|
335
|
+
* service's own count (edits one each), and stopping where that runs out,
|
|
336
|
+
* inside a millisecond or a message page too.
|
|
337
|
+
* Coalesces: a call while a sync is already running returns that run's
|
|
338
|
+
* promise instead of racing it.
|
|
237
339
|
*/
|
|
238
340
|
catchUp(maxItems: number): Promise<SyncReport>;
|
|
239
341
|
private runCatchUp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semantic.d.ts","sourceRoot":"","sources":["../../../../src/modules/history/semantic.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"semantic.d.ts","sourceRoot":"","sources":["../../../../src/modules/history/semantic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAMhF,MAAM,WAAW,mBAAmB;IAClC,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,mFAAmF;IACnF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,SAAS,EAAE,MAAM,CAAC;IAClB,0FAA0F;IAC1F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mGAAmG;IACnG,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;;;;;;;OAgBG;IAC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