@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
|
@@ -9,24 +9,101 @@
|
|
|
9
9
|
* `maxChars` slice and re-introduces, one turn deferred, exactly the silent
|
|
10
10
|
* hallucination this feature exists to kill.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
* apart from a lone UTF-16 surrogate,
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
12
|
+
* A content array (toolResultBlocks) is shown block by block, each block as
|
|
13
|
+
* both copies show it: text verbatim, apart from a lone UTF-16 surrogate,
|
|
14
|
+
* which becomes U+FFFD (#695), an image as a short
|
|
15
|
+
* `[image: mimeType, ~NKB]` placeholder, a reference as its stub, and any
|
|
16
|
+
* other block as a marker saying what it was and why it isn't shown. Anything
|
|
17
|
+
* else falls back to JSON, written by RFC-005's rules at every depth
|
|
18
|
+
* (historyJson): a reference is shown as its stub wherever it sits in the
|
|
19
|
+
* data, so its uri reaches history only as a link's line shows it where the
|
|
20
|
+
* host can't fetch the link and its uri can't carry a credential
|
|
21
|
+
* (shownLinkUri), and inline data that claims a uri or a disposition is
|
|
22
|
+
* withheld. A string is already text and is kept as it is.
|
|
20
23
|
*/
|
|
24
|
+
import { type ResultClaims, type ScriptLine } from './mcpl/references.js';
|
|
21
25
|
/** Where one block of a content array sits in its history text, and what
|
|
22
26
|
* kind of block it was: text, an inline image (its placeholder), an RFC-005
|
|
23
|
-
* reference (its stub),
|
|
27
|
+
* reference (its stub), inline data withheld for a contradiction, or a
|
|
28
|
+
* marker in place of a block the lane can't show. */
|
|
24
29
|
export interface HistoryBlockSpan {
|
|
25
|
-
kind: '
|
|
30
|
+
kind: ToolResultBlock['kind'];
|
|
26
31
|
start: number;
|
|
27
32
|
end: number;
|
|
28
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Whether a tool result's live copy goes as native blocks, an image among
|
|
36
|
+
* them, rather than as its stored text. It does when the result holds an
|
|
37
|
+
* image and its links' blocks and markers come to no more than `maxChars`
|
|
38
|
+
* together. Past that, the live copy is the stored text, cut at the cap, so
|
|
39
|
+
* no number of links and markers carries a result past it. A reference's
|
|
40
|
+
* stub and a withheld line go whole beside an image whatever their length,
|
|
41
|
+
* and past its cut the stored copy keeps the newest 64 image slots the live
|
|
42
|
+
* copy showed (#403). Text blocks don't count either: the native copy cuts
|
|
43
|
+
* each at the cap on its own. Both copies decide by this, from each block's
|
|
44
|
+
* kind and the length of its text.
|
|
45
|
+
*/
|
|
46
|
+
export declare function goesNative(blocks: ReadonlyArray<{
|
|
47
|
+
kind: ToolResultBlock['kind'];
|
|
48
|
+
length: number;
|
|
49
|
+
}>, maxChars: number | undefined): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* One block of a tool result's content array as both of its copies show it
|
|
52
|
+
* (toolResultBlocks): a text block's text, an inline image, which the stored
|
|
53
|
+
* copy shows as its placeholder and the live copy as itself, or the text that
|
|
54
|
+
* stands in its place, the same in both. That text is a reference's stub, a
|
|
55
|
+
* link's stub or line (MCP's resource_link, `link`), inline data withheld for
|
|
56
|
+
* a contradiction, or a marker saying what kind of block it was and why the
|
|
57
|
+
* lane can't show it.
|
|
58
|
+
*/
|
|
59
|
+
export type ToolResultBlock = {
|
|
60
|
+
kind: 'text';
|
|
61
|
+
text: string;
|
|
62
|
+
} | {
|
|
63
|
+
kind: 'image';
|
|
64
|
+
data: string;
|
|
65
|
+
mimeType: string;
|
|
66
|
+
} | {
|
|
67
|
+
kind: 'reference' | 'link' | 'withheld' | 'marker';
|
|
68
|
+
text: string;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Each element of `data` as both copies of a tool result show it, or null
|
|
72
|
+
* when `data` isn't a content array, so the result is data, written as JSON.
|
|
73
|
+
* An array is content when the result says so (`dataIsContent`, which the
|
|
74
|
+
* framework sets on an MCPL tool's result: every element of a protocol
|
|
75
|
+
* result's content is a block, of a type the host shows or not). Otherwise
|
|
76
|
+
* it's content only when every element is a block of one of MCP's own types,
|
|
77
|
+
* so a list of records of other types stays data. A module's array of
|
|
78
|
+
* records that all carry MCP's type names, such as `[{ type: 'image', url }]`,
|
|
79
|
+
* is read as content, and shows a marker for each record that isn't a block
|
|
80
|
+
* the lane can show.
|
|
81
|
+
*/
|
|
82
|
+
export declare function toolResultBlocks(data: unknown, dataIsContent?: boolean, claims?: ResultClaims): ToolResultBlock[] | null;
|
|
83
|
+
/** Whether a tool result's data is a content array, which toolResultBlocks
|
|
84
|
+
* shows block by block. */
|
|
85
|
+
export declare function isContentArray(data: unknown, dataIsContent?: boolean): data is unknown[];
|
|
86
|
+
/**
|
|
87
|
+
* The claims of a tool result's data (ResultClaims), as showing it reads
|
|
88
|
+
* them: a content array's from its elements (contentClaims), and any other
|
|
89
|
+
* data's by the walk serialization takes (claimsInHistory). For a decision
|
|
90
|
+
* made about the result outside showing it, such as which of its references
|
|
91
|
+
* to fetch, or for showing part of it as the rest of it claims. Null where a
|
|
92
|
+
* value stops the walk, so what the data claims is unknown (claimsInHistory).
|
|
93
|
+
*/
|
|
94
|
+
export declare function resultClaimsOf(data: unknown, dataIsContent?: boolean): ResultClaims | null;
|
|
95
|
+
/** resultClaimsOf, throwing what stops the walk, for a caller that answers
|
|
96
|
+
* a stop itself: a script's text route, which fails then, as its view does
|
|
97
|
+
* (Ada-1017, room-203 #200374). */
|
|
98
|
+
export declare function resultClaimsOrThrow(data: unknown, dataIsContent?: boolean): ResultClaims;
|
|
29
99
|
export interface HistorySerializeOptions {
|
|
100
|
+
/**
|
|
101
|
+
* Whether the result's data is a protocol result's content
|
|
102
|
+
* (ToolResult.dataIsContent), so an array is shown block by block whatever
|
|
103
|
+
* its blocks' types (toolResultBlocks). nonErrorResultText takes it from
|
|
104
|
+
* the result instead, whatever this says.
|
|
105
|
+
*/
|
|
106
|
+
dataIsContent?: boolean;
|
|
30
107
|
/**
|
|
31
108
|
* Called for every image block the serializer replaces with a placeholder
|
|
32
109
|
* (issue #104). Returns the retention ref to embed in the placeholder —
|
|
@@ -40,10 +117,23 @@ export interface HistorySerializeOptions {
|
|
|
40
117
|
/**
|
|
41
118
|
* Called once a content array has been serialized block by block, rather
|
|
42
119
|
* than given up on for the fallback, with where each block sits in the
|
|
43
|
-
* joined text, before any cut at `maxChars
|
|
44
|
-
*
|
|
120
|
+
* joined text, before any cut at `maxChars`, and the blocks themselves as
|
|
121
|
+
* this text was made from them. The framework reads from it what a
|
|
122
|
+
* result's live copy shows (#403), and builds that copy from these very
|
|
123
|
+
* blocks, so the two copies come from one classification.
|
|
124
|
+
*/
|
|
125
|
+
onBlocks?: (spans: HistoryBlockSpan[], blocks: ToolResultBlock[]) => void;
|
|
126
|
+
/**
|
|
127
|
+
* The claims to read (ResultClaims) in place of the data's own, where the
|
|
128
|
+
* data shown is part of a larger result whose claims these are
|
|
129
|
+
* (resultClaimsOf), such as the fields a withheld result keeps.
|
|
45
130
|
*/
|
|
46
|
-
|
|
131
|
+
claims?: ResultClaims;
|
|
132
|
+
/**
|
|
133
|
+
* Whose result this is, as nonErrorResultText's log line names it where it
|
|
134
|
+
* shows UNCHECKED_RESULT_TEXT for a result it couldn't read or show.
|
|
135
|
+
*/
|
|
136
|
+
toolName?: string;
|
|
47
137
|
}
|
|
48
138
|
/**
|
|
49
139
|
* House-safe default inline cap (chars) for tool results, error results, and
|
|
@@ -72,6 +162,11 @@ export declare function toolResultDataToHistoryString(data: unknown, maxChars?:
|
|
|
72
162
|
*
|
|
73
163
|
* Each field is read once: the direct Agent API passes its caller's own
|
|
74
164
|
* result here, unchecked, and a getter needn't answer the same way twice.
|
|
165
|
+
* Whatever stops reading or showing the data is UNCHECKED_RESULT_TEXT, with
|
|
166
|
+
* a log line naming the tool (`options.toolName`) and the error: the model's
|
|
167
|
+
* lane has no failure answer that doesn't wedge the round.
|
|
168
|
+
* Whether an array is content is the result's own `dataIsContent`, read for
|
|
169
|
+
* its truth as a result's flags are, whatever `options` says.
|
|
75
170
|
*
|
|
76
171
|
* Each text a tool result's copies carry is made well formed where it's
|
|
77
172
|
* taken from the result: a lone UTF-16 surrogate becomes U+FFFD, as the
|
|
@@ -84,6 +179,18 @@ export declare function toolResultDataToHistoryString(data: unknown, maxChars?:
|
|
|
84
179
|
export declare function nonErrorResultText(result: {
|
|
85
180
|
data?: unknown;
|
|
86
181
|
error?: string;
|
|
182
|
+
dataIsContent?: boolean;
|
|
183
|
+
}, maxChars?: number, options?: HistorySerializeOptions): string;
|
|
184
|
+
/**
|
|
185
|
+
* nonErrorResultText's text, throwing whatever stops reading or showing the
|
|
186
|
+
* result, such as a stopped claims walk (historyJson), for a caller that
|
|
187
|
+
* answers a stop itself: a script's routes, which fail naming the tool
|
|
188
|
+
* (Ada-1017, room-203 #200374), never the model lane's notice.
|
|
189
|
+
*/
|
|
190
|
+
export declare function nonErrorResultTextOrThrow(result: {
|
|
191
|
+
data?: unknown;
|
|
192
|
+
error?: string;
|
|
193
|
+
dataIsContent?: boolean;
|
|
87
194
|
}, maxChars?: number, options?: HistorySerializeOptions): string;
|
|
88
195
|
/** Bounded copy of an arbitrary string with the standard truncation notice,
|
|
89
196
|
* cut at the cap where a tool result's stored copy is cut at that cap
|
|
@@ -98,16 +205,40 @@ export declare function truncateForHistory(str: string, maxChars: number): strin
|
|
|
98
205
|
* A value of a tool result's data as a script reads it, by history's rules
|
|
99
206
|
* (shownInHistory), as a JSON replacer applies them at every depth: what
|
|
100
207
|
* RFC-005 governs is shown as the script lane shows it, a reference as its
|
|
101
|
-
* stub's facts
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
208
|
+
* stub's facts, a link's uri among them only where the model's line for it
|
|
209
|
+
* would show it, an invalid one as the notice, and MCP's embedded resource as
|
|
210
|
+
* the block its contents make (referenceBlockForScript), and inline data
|
|
211
|
+
* that also claims a uri of any type or a disposition as the withheld
|
|
212
|
+
* notice, each notice as a text block. A null, absent or empty uri claims
|
|
213
|
+
* none (hasUri), so inline data beside one is itself. Any other value is
|
|
214
|
+
* itself. `claims` are those of everything the script's view shows
|
|
215
|
+
* (scriptViewClaims), and `line` the model's line for the result, its claims
|
|
216
|
+
* and its records as it reads them (ScriptLine), which decide where a link's
|
|
217
|
+
* uri is shown. What it gives is either a stub, a notice or a text block,
|
|
218
|
+
* which RFC-005 doesn't govern, or inline data that claims nothing, or the
|
|
219
|
+
* value itself, each of which it gives again, so applying it twice gives
|
|
220
|
+
* what applying it once gave.
|
|
221
|
+
*/
|
|
222
|
+
export declare function shownToScript(value: unknown, claims?: ResultClaims, line?: ScriptLine): unknown;
|
|
223
|
+
/**
|
|
224
|
+
* The claims (ResultClaims) of everything a script's view of a content array
|
|
225
|
+
* shows, nested fields included (Ada-1017, room-203 #200094), by the walk
|
|
226
|
+
* history's JSON takes (claimsInHistory): a script is shown the references
|
|
227
|
+
* nested in a block's fields, each as its stub, so a `never` among them
|
|
228
|
+
* withholds that uri from every block in the view. A link's uri is still
|
|
229
|
+
* shown only where the model's line shows it, by the claims the line reads
|
|
230
|
+
* (contentClaims, which reads a block and not its fields): reading more
|
|
231
|
+
* claims can loosen as well as tighten, since an expiry makes a link one the
|
|
232
|
+
* host can't fetch (referenceBlockForScript's `line`). An MCPL peer's
|
|
233
|
+
* top-level block the classifier rejects is
|
|
234
|
+
* its notice, its fields unshown, so they don't count (`fromServer`). It
|
|
235
|
+
* throws what stops the walk, such as a value too deep to convert or a
|
|
236
|
+
* getter that throws, and the script's view then isn't written: the
|
|
237
|
+
* treatment never runs without the claims it reads (Ada-1017, room-203
|
|
238
|
+
* #200250), whether or not its own walk, with other replacers and so other
|
|
239
|
+
* stack depths, would stop at the same value.
|
|
109
240
|
*/
|
|
110
|
-
export declare function
|
|
241
|
+
export declare function scriptViewClaims(content: readonly unknown[], fromServer: boolean): ResultClaims;
|
|
111
242
|
/**
|
|
112
243
|
* A value nested in an MCPL peer's content block as a script reads it, as a
|
|
113
244
|
* JSON replacer applies it inside the blocks: what RFC-005 governs
|
|
@@ -117,12 +248,33 @@ export declare function shownToScript(value: unknown): unknown;
|
|
|
117
248
|
* peer's block (referenceBlockForScript), its reference bound to the server
|
|
118
249
|
* that sent it, and any other value is itself. A stub or a notice isn't
|
|
119
250
|
* governed, so a block the top-level pass already treated is left as it is.
|
|
251
|
+
* `claims` are those of the script's whole view (scriptViewClaims).
|
|
120
252
|
*/
|
|
121
|
-
export declare function shownToScriptFromServer(value: unknown, serverId: string): unknown;
|
|
253
|
+
export declare function shownToScriptFromServer(value: unknown, serverId: string, claims?: ResultClaims, line?: ScriptLine): unknown;
|
|
122
254
|
/**
|
|
123
255
|
* The text RFC-005 shows a value of a tool result's data as, when it shows it
|
|
124
256
|
* as text rather than as its fields: a reference's stub, an invalid one's
|
|
125
|
-
*
|
|
257
|
+
* marker, inline data withheld, or what an embedded resource's stored copy
|
|
258
|
+
* shows. Null for any other value.
|
|
126
259
|
*/
|
|
127
260
|
export declare function rfc005TextOf(value: unknown): string | null;
|
|
261
|
+
/**
|
|
262
|
+
* What the model's lane shows for a tool result it couldn't read through,
|
|
263
|
+
* check for references and show (nonErrorResultText, the lane's one catch,
|
|
264
|
+
* which logs the tool and the error): the tool ran, and its result isn't
|
|
265
|
+
* shown, rather than shown with fewer claims, where a link could show a uri a
|
|
266
|
+
* reference in the result withholds, and rather than a throw, which would
|
|
267
|
+
* leave the round unstored and unsent. Where the walk of its claims stops
|
|
268
|
+
* (historyJson throws then), the claims walk meets data no JSON can hold,
|
|
269
|
+
* such as a cycle or a BigInt, or data too deep to write, before the render
|
|
270
|
+
* does, so such data shows this, where the render threw (Desmond-2579's
|
|
271
|
+
* run); so does a render that stops after the walk, or a getter that throws
|
|
272
|
+
* (Ada-1017, room-203 #200344, #201013). The round completes, as a withheld
|
|
273
|
+
* result's kept fields keep nothing then (keptWhenWithheld). A script never
|
|
274
|
+
* gets it: its routes call the serializer, or nonErrorResultTextOrThrow,
|
|
275
|
+
* directly, whose walk throws where it stops, and fail naming the tool
|
|
276
|
+
* (#200374). An error result's own error field is read as before, and so
|
|
277
|
+
* are the fields the tool-result guard keeps of a result it withholds.
|
|
278
|
+
*/
|
|
279
|
+
export declare const UNCHECKED_RESULT_TEXT = "[Result not shown: the tool ran, but its result couldn't be read through, checked for references and shown, so this host withheld it.]";
|
|
128
280
|
//# sourceMappingURL=tool-result-history.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-result-history.d.ts","sourceRoot":"","sources":["../../src/tool-result-history.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tool-result-history.d.ts","sourceRoot":"","sources":["../../src/tool-result-history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAeL,KAAK,YAAY,EACjB,KAAK,UAAU,EAChB,MAAM,sBAAsB,CAAC;AAG9B;;;sDAGsD;AACtD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,MAAM,C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