@ljwei-stak/dsh-model-route-bot 0.66.4 → 0.67.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/.dsh-plugin/bot-product.mjs +81 -5
- package/.dsh-plugin/client.js +17490 -1791
- package/README.i18n.yaml +4 -4
- package/README.md +409 -364
- package/README.zh.md +409 -364
- package/apps/integration-client/README.md +31 -7
- package/apps/integration-client/api.mjs +14 -3
- package/apps/integration-client/binding-editor.jsx +308 -109
- package/apps/integration-client/binding-model.mjs +262 -0
- package/apps/integration-client/binding.css +144 -0
- package/apps/integration-client/bot-model-status.mjs +18 -0
- package/apps/integration-client/bot-profile-identity.jsx +197 -0
- package/apps/integration-client/bot-profile.css +57 -0
- package/apps/integration-client/bot-profile.mjs +97 -0
- package/apps/integration-client/bot-settings-dialog.css +18 -0
- package/apps/integration-client/bot-settings-dialog.jsx +111 -0
- package/apps/integration-client/bot-thread-header-bridge.css +20 -0
- package/apps/integration-client/bot-thread-header.jsx +278 -0
- package/apps/integration-client/bot-threads-panel.jsx +378 -0
- package/apps/integration-client/bot-threads.css +169 -0
- package/apps/integration-client/chat-design.mjs +250 -0
- package/apps/integration-client/chat-ui.jsx +175 -0
- package/apps/integration-client/chat.css +477 -0
- package/apps/integration-client/composer-draft-binding.mjs +50 -0
- package/apps/integration-client/composer-draft-bound.jsx +14 -0
- package/apps/integration-client/composer-draft-host.jsx +142 -0
- package/apps/integration-client/composer-draft-session.jsx +287 -0
- package/apps/integration-client/composer-draft-witness.mjs +115 -0
- package/apps/integration-client/composer-draft.css +4 -0
- package/apps/integration-client/composer-draft.mjs +322 -0
- package/apps/integration-client/contact-attention.jsx +54 -0
- package/apps/integration-client/data-panel.jsx +439 -0
- package/apps/integration-client/data.css +69 -0
- package/apps/integration-client/desktop-bridge.mjs +1 -0
- package/apps/integration-client/desktop-http-socket.mjs +49 -0
- package/apps/integration-client/desktop-keyboard.mjs +32 -0
- package/apps/integration-client/desktop-pane.jsx +99 -30
- package/apps/integration-client/desktop-stream.mjs +13 -3
- package/apps/integration-client/desktop-tools.jsx +19 -0
- package/apps/integration-client/desktop-touch.mjs +27 -0
- package/apps/integration-client/desktop.css +41 -0
- package/apps/integration-client/independent-chat-controller.mjs +224 -0
- package/apps/integration-client/independent-chat-entry.jsx +61 -0
- package/apps/integration-client/independent-chat-navigation.mjs +21 -0
- package/apps/integration-client/independent-chat-page.jsx +148 -0
- package/apps/integration-client/independent-chat-rich.jsx +64 -0
- package/apps/integration-client/independent-chat-rich.mjs +30 -0
- package/apps/integration-client/independent-chat.css +73 -0
- package/apps/integration-client/index.jsx +24 -16
- package/apps/integration-client/library-panel.jsx +4 -1
- package/apps/integration-client/licenses/jsqr-1.4.0-LICENSE.txt +202 -0
- package/apps/integration-client/main-route-editor.jsx +94 -0
- package/apps/integration-client/main-route-model.mjs +100 -0
- package/apps/integration-client/model-picker.css +37 -0
- package/apps/integration-client/model-picker.jsx +83 -0
- package/apps/integration-client/native-activity.css +141 -0
- package/apps/integration-client/native-activity.jsx +276 -0
- package/apps/integration-client/native-activity.mjs +384 -0
- package/apps/integration-client/notifications-panel.jsx +186 -0
- package/apps/integration-client/notifications.css +126 -0
- package/apps/integration-client/pairing-qr.jsx +79 -0
- package/apps/integration-client/panels.jsx +126 -115
- package/apps/integration-client/product-slots.jsx +46 -0
- package/apps/integration-client/routine-recorder.mjs +23 -2
- package/apps/integration-client/secure-pairing.jsx +84 -0
- package/apps/integration-client/tasks-panel.jsx +32 -10
- package/apps/integration-client/ui-icons.jsx +17 -0
- package/apps/integration-client/usage-explorer.jsx +43 -0
- package/apps/integration-client/usage-report.mjs +71 -0
- package/apps/integration-client/usage.css +34 -0
- package/apps/integration-client/web-panel-model.mjs +140 -0
- package/apps/integration-client/web-panel-page.jsx +221 -0
- package/apps/integration-client/web-panel-pins-live.jsx +28 -0
- package/apps/integration-client/web-panel.css +139 -0
- package/apps/integration-client/workspace-model.mjs +67 -0
- package/apps/integration-client/workspace-navigation.mjs +56 -0
- package/apps/integration-client/workspace-ui.jsx +173 -0
- package/apps/integration-client/workspace.css +332 -0
- package/modules/bot-runtime/SOURCE.json +176 -50
- package/modules/bot-runtime/index.mjs +169 -13
- package/modules/bot-runtime/product-overlay/OVERLAY.json +128 -2
- package/modules/bot-runtime/product-overlay/base/src/client/header.js +244 -0
- package/modules/bot-runtime/product-overlay/base/src/client/learning-card.js +202 -0
- package/modules/bot-runtime/product-overlay/base/src/client/model-menu.js +371 -0
- package/modules/bot-runtime/product-overlay/base/src/client/secret-card.js +363 -0
- package/modules/bot-runtime/product-overlay/base/src/client/sources.js +68 -0
- package/modules/bot-runtime/product-overlay/base/src/client/turn-error.js +260 -0
- package/modules/bot-runtime/product-overlay/base/src/host/channel.js +647 -0
- package/modules/bot-runtime/product-overlay/base/src/host/memory.js +2050 -0
- package/modules/bot-runtime/product-overlay/base/src/host/models.js +314 -0
- package/modules/bot-runtime/product-overlay/base/src/host/parts.js +1473 -0
- package/modules/bot-runtime/product-overlay/base/src/host/privacy.js +368 -0
- package/modules/bot-runtime/product-overlay/base/src/host/roster.js +776 -0
- package/modules/bot-runtime/product-overlay/base/src/host/store.js +512 -0
- package/modules/bot-runtime/product-overlay/base/src/host/usage.js +653 -0
- package/modules/bot-runtime/product-overlay/patches/src/client/details-drawer.js.patch +48 -2
- package/modules/bot-runtime/product-overlay/patches/src/client/header.js.patch +41 -0
- package/modules/bot-runtime/product-overlay/patches/src/client/index.js.patch +33 -1
- package/modules/bot-runtime/product-overlay/patches/src/client/learning-card.js.patch +20 -0
- package/modules/bot-runtime/product-overlay/patches/src/client/model-menu.js.patch +24 -0
- package/modules/bot-runtime/product-overlay/patches/src/client/secret-card.js.patch +25 -0
- package/modules/bot-runtime/product-overlay/patches/src/client/sources.js.patch +52 -0
- package/modules/bot-runtime/product-overlay/patches/src/client/turn-error.js.patch +23 -0
- package/modules/bot-runtime/product-overlay/patches/src/host/channel.js.patch +46 -0
- package/modules/bot-runtime/product-overlay/patches/src/host/memory.js.patch +11 -0
- package/modules/bot-runtime/product-overlay/patches/src/host/models.js.patch +16 -0
- package/modules/bot-runtime/product-overlay/patches/src/host/parts.js.patch +95 -0
- package/modules/bot-runtime/product-overlay/patches/src/host/privacy.js.patch +11 -0
- package/modules/bot-runtime/product-overlay/patches/src/host/roster.js.patch +145 -0
- package/modules/bot-runtime/product-overlay/patches/src/host/store.js.patch +68 -0
- package/modules/bot-runtime/product-overlay/patches/src/host/usage.js.patch +11 -0
- package/modules/bot-runtime/read-model.mjs +19 -4
- package/modules/bot-runtime/vendor/ds-bot/src/client/details-drawer.js +15 -5
- package/modules/bot-runtime/vendor/ds-bot/src/client/header.js +9 -2
- package/modules/bot-runtime/vendor/ds-bot/src/client/index.js +9 -2
- package/modules/bot-runtime/vendor/ds-bot/src/client/learning-card.js +2 -2
- package/modules/bot-runtime/vendor/ds-bot/src/client/model-menu.js +5 -3
- package/modules/bot-runtime/vendor/ds-bot/src/client/secret-card.js +3 -3
- package/modules/bot-runtime/vendor/ds-bot/src/client/sources.js +25 -2
- package/modules/bot-runtime/vendor/ds-bot/src/client/turn-error.js +3 -2
- package/modules/bot-runtime/vendor/ds-bot/src/host/channel.js +14 -2
- package/modules/bot-runtime/vendor/ds-bot/src/host/memory.js +1 -1
- package/modules/bot-runtime/vendor/ds-bot/src/host/models.js +7 -0
- package/modules/bot-runtime/vendor/ds-bot/src/host/parts.js +26 -9
- package/modules/bot-runtime/vendor/ds-bot/src/host/privacy.js +1 -1
- package/modules/bot-runtime/vendor/ds-bot/src/host/roster.js +112 -3
- package/modules/bot-runtime/vendor/ds-bot/src/host/store.js +34 -1
- package/modules/bot-runtime/vendor/ds-bot/src/host/usage.js +1 -1
- package/modules/independent-runtime/index.mjs +152 -62
- package/modules/independent-runtime/remote-tools.mjs +8 -5
- package/modules/openmaus-protocol/NOTICE +10 -0
- package/modules/openmaus-protocol/README.md +15 -0
- package/modules/openmaus-protocol/SOURCE.json +68 -0
- package/modules/openmaus-protocol/dist/protocol.mjs +1203 -0
- package/modules/openmaus-protocol/index.mjs +1 -0
- package/modules/openmaus-protocol/transport.mjs +77 -0
- package/modules/openmaus-protocol/vendor/LICENSE +202 -0
- package/modules/openmaus-protocol/vendor/companion/src/e2e/README.md +405 -0
- package/modules/openmaus-protocol/vendor/companion/src/e2e/credentials.ts +128 -0
- package/modules/openmaus-protocol/vendor/companion/src/e2e/descriptor.ts +84 -0
- package/modules/openmaus-protocol/vendor/companion/src/e2e/noise.ts +456 -0
- package/modules/openmaus-protocol/vendor/companion/src/e2e/phone.ts +104 -0
- package/modules/openmaus-protocol/vendor/companion/src/e2e/session.ts +417 -0
- package/modules/openmaus-protocol/vendor/companion/src/e2e/vectors/v1.json +2565 -0
- package/modules/openmaus-protocol/vendor/companion/src/e2e/vectors/v1.sha256 +1 -0
- package/modules/openmaus-protocol/vendor/companion/src/e2e/yamux.ts +335 -0
- package/package.json +18 -6
- package/packages/bot-acp/README.md +156 -0
- package/packages/bot-acp/licenses/LICENSE-OpenMausBot +202 -0
- package/packages/bot-acp/licenses/NOTICE.md +27 -0
- package/packages/bot-acp/src/acp-adapter.mjs +795 -0
- package/packages/bot-acp/src/acp-host.mjs +148 -0
- package/packages/bot-acp/src/native-launch.mjs +121 -0
- package/packages/bot-acp/src/permission-policy.mjs +283 -0
- package/packages/bot-acp/src/rpc-codec.mjs +265 -0
- package/packages/bot-acp/src/session-core.mjs +581 -0
- package/packages/bot-acp/src/stdio-rpc.mjs +329 -0
- package/packages/bot-engines/README.md +281 -0
- package/packages/bot-engines/licenses/LICENSE-OpenMausBot +202 -0
- package/packages/bot-engines/licenses/NOTICE.md +32 -0
- package/packages/bot-engines/src/claude-engine.mjs +772 -0
- package/packages/bot-engines/src/claude-llm-adapter.mjs +797 -0
- package/packages/bot-engines/src/claude-llm-turn.mjs +292 -0
- package/packages/bot-engines/src/claude-permission-broker.mjs +130 -0
- package/packages/bot-engines/src/claude-permission-proxy.mjs +87 -0
- package/packages/bot-engines/src/claude-protocol.mjs +177 -0
- package/packages/bot-engines/src/driver-catalog.mjs +334 -0
- package/packages/bot-engines/src/host-loop-request.mjs +95 -0
- package/packages/bot-engines/src/host-registrations.mjs +105 -0
- package/packages/capability-broker/src/cli-bootstrap.mjs +86 -16
- package/packages/capability-broker/src/cli-bridge-response.mjs +80 -0
- package/packages/capability-broker/src/cli-stdio-bridge.mjs +21 -8
- package/packages/cli-runtime/src/codex-session-core.mjs +4 -0
- package/packages/cli-runtime/src/native-cli-output.mjs +57 -0
- package/packages/cli-runtime/src/native-peer.ps1 +51 -3
- package/packages/cli-runtime/src/native-process.mjs +77 -14
- package/packages/model-router-plugin/package.json +1 -1
- package/packages/orchestration/src/binding-product.mjs +19 -0
- package/packages/orchestration/src/bot-data-actions.mjs +45 -0
- package/packages/orchestration/src/bot-data-chart.mjs +109 -0
- package/packages/orchestration/src/bot-data-context.mjs +44 -0
- package/packages/orchestration/src/bot-data-engine.mjs +809 -0
- package/packages/orchestration/src/bot-data-io.mjs +186 -0
- package/packages/orchestration/src/bot-data-sql.mjs +195 -0
- package/packages/orchestration/src/bot-data-surface.mjs +144 -0
- package/packages/orchestration/src/bot-data-tools.mjs +68 -0
- package/packages/orchestration/src/bot-data-worker.mjs +228 -0
- package/packages/orchestration/src/bot-independent-execution.mjs +195 -0
- package/packages/orchestration/src/bot-independent-stream.mjs +74 -0
- package/packages/orchestration/src/bot-loop.mjs +152 -19
- package/packages/orchestration/src/bot-notifications.mjs +159 -0
- package/packages/orchestration/src/bot-policy.mjs +43 -4
- package/packages/orchestration/src/bot-profile.mjs +171 -0
- package/packages/orchestration/src/bot-routine.mjs +4 -4
- package/packages/orchestration/src/bot-runtime-assembly.mjs +255 -8
- package/packages/orchestration/src/bot-runtime-switch.mjs +13 -2
- package/packages/orchestration/src/bot-serving.mjs +164 -0
- package/packages/orchestration/src/bot-session-store.mjs +105 -9
- package/packages/orchestration/src/bot-settings.mjs +50 -11
- package/packages/orchestration/src/bot-thread-admission.mjs +84 -0
- package/packages/orchestration/src/bot-thread-host.mjs +187 -0
- package/packages/orchestration/src/bot-threads.mjs +790 -0
- package/packages/orchestration/src/data-product-access.mjs +37 -0
- package/packages/orchestration/src/data-tool-contract.mjs +291 -0
- package/packages/orchestration/src/desktop-http-carrier.mjs +120 -0
- package/packages/orchestration/src/desktop-proxy.mjs +311 -0
- package/packages/orchestration/src/desktop-sessions.mjs +43 -9
- package/packages/orchestration/src/ds-lifecycle.mjs +31 -4
- package/packages/orchestration/src/grant-refresh-queue.mjs +17 -0
- package/packages/orchestration/src/independent-chat-page.mjs +39 -0
- package/packages/orchestration/src/independent-chat-service.mjs +308 -0
- package/packages/orchestration/src/independent-context-state.mjs +44 -0
- package/packages/orchestration/src/independent-message-wire.mjs +84 -0
- package/packages/orchestration/src/independent-tool-catalog.mjs +175 -0
- package/packages/orchestration/src/independent-tool-families.mjs +73 -0
- package/packages/orchestration/src/independent-tool-host.mjs +344 -0
- package/packages/orchestration/src/main-bot-grant.mjs +15 -0
- package/packages/orchestration/src/main-model-routes.mjs +208 -0
- package/packages/orchestration/src/model-accounting.mjs +99 -35
- package/packages/orchestration/src/model-auxiliary-dispatch.mjs +187 -0
- package/packages/orchestration/src/model-loop-frame.mjs +179 -0
- package/packages/orchestration/src/model-prepared-generation.mjs +175 -0
- package/packages/orchestration/src/model-request-bounds.mjs +111 -0
- package/packages/orchestration/src/native-activity-contract.mjs +491 -0
- package/packages/orchestration/src/native-activity-service.mjs +102 -0
- package/packages/orchestration/src/native-activity-store.mjs +249 -0
- package/packages/orchestration/src/native-conversation-tools.mjs +78 -0
- package/packages/orchestration/src/native-data-tools.mjs +100 -0
- package/packages/orchestration/src/native-remote-actions.mjs +742 -0
- package/packages/orchestration/src/native-team-tools.mjs +73 -0
- package/packages/orchestration/src/pairing-invite.mjs +37 -0
- package/packages/orchestration/src/product-composition.mjs +1559 -1001
- package/packages/orchestration/src/remote-machines.mjs +82 -14
- package/packages/orchestration/src/routine-execution.mjs +5 -3
- package/packages/orchestration/src/routine-session.mjs +19 -13
- package/packages/orchestration/src/secure-pairing-host.mjs +112 -0
- package/packages/orchestration/src/task-journal.mjs +29 -0
- package/packages/orchestration/src/task-product.mjs +17 -0
- package/packages/orchestration/src/team-assignment-store.mjs +120 -0
- package/packages/orchestration/src/team-bridge.mjs +282 -0
- package/packages/orchestration/src/team-scheduler.mjs +83 -0
- package/packages/orchestration/src/team-sdk-tools.mjs +84 -0
- package/packages/orchestration/src/team-tool-contract.mjs +284 -0
- package/packages/orchestration/src/ui-host-namespace.mjs +23 -0
- package/packages/orchestration/src/web-panel-actions.mjs +103 -0
- package/packages/orchestration/src/web-panel-framing.mjs +227 -0
- package/packages/orchestration/src/web-panel-store.mjs +206 -0
- package/remote-computer-agent/README.md +39 -29
- package/remote-computer-agent/build.mjs +3 -0
- package/remote-computer-agent/dist/OPENMAUSBOT_LICENSE +202 -0
- package/remote-computer-agent/dist/OPENMAUSBOT_NOTICE +10 -0
- package/remote-computer-agent/dist/OPENMAUSBOT_SOURCE.json +68 -0
- package/remote-computer-agent/dist/cli-stdio-bridge.mjs +215 -25
- package/remote-computer-agent/dist/cli-stdio-bridge.mjs.map +4 -4
- package/remote-computer-agent/dist/cli.mjs +1688 -168
- package/remote-computer-agent/dist/cli.mjs.map +4 -4
- package/remote-computer-agent/dist/index.mjs +1579 -122
- package/remote-computer-agent/dist/index.mjs.map +4 -4
- package/remote-computer-agent/dist/native-peer.ps1 +51 -3
- package/remote-computer-agent/package-lock.json +308 -2
- package/remote-computer-agent/package.json +2 -1
- package/remote-computer-agent/pair-device.ps1 +20 -0
- package/remote-computer-agent/setup.ps1 +38 -16
- package/remote-computer-agent/src/cli.ts +24 -3
- package/remote-computer-agent/src/desktop-session.ts +11 -3
- package/remote-computer-agent/src/e2e-server.ts +81 -0
- package/remote-computer-agent/src/pairing-page.ts +35 -0
- package/remote-computer-agent/src/protocol.ts +25 -25
- package/remote-computer-agent/src/secure-pairing.ts +105 -0
- package/remote-computer-agent/src/store.ts +20 -5
- package/remote-computer-agent/src/transport.ts +39 -15
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
{
|
|
17
17
|
"path": "src/client/details-drawer.js",
|
|
18
18
|
"kind": "patched",
|
|
19
|
-
"summary": "Adds the 电脑操作 (desktop) tab to a 1:1 Bot's drawer and renders DesktopPane in it.",
|
|
19
|
+
"summary": "Adds the 电脑操作 (desktop) tab to a 1:1 Bot's drawer and renders DesktopPane in it; a thread Session keeps its own transcript, stats, questions and usage, and its name is shown instead of offering to rename the Bot.",
|
|
20
20
|
"base": {
|
|
21
21
|
"commit": "71d344bf193f3f18185f25de3d8e5c483046910a",
|
|
22
22
|
"sha256": "f4917de604dc7c3daf3b4a5267a04c326c9b20aea94bb5e27bfcb6e106396172"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
{
|
|
35
35
|
"path": "src/client/index.js",
|
|
36
36
|
"kind": "patched",
|
|
37
|
-
"summary": "
|
|
37
|
+
"summary": "Opens a thread Session as itself in partFor — resolved before the Bot, because a thread Session also resolves to its Bot — keeps homeToMainBot from bouncing an open thread to Main, and refreshes thread projections.",
|
|
38
38
|
"base": {
|
|
39
39
|
"commit": "71d344bf193f3f18185f25de3d8e5c483046910a",
|
|
40
40
|
"sha256": "4fd22b26d817ca3ae5454e5a8042c1c4b806ff4ae78c9e38f90ee5ee3c996b9a"
|
|
@@ -57,6 +57,132 @@
|
|
|
57
57
|
"commit": "71d344bf193f3f18185f25de3d8e5c483046910a",
|
|
58
58
|
"sha256": "3818fea953dc7a766d7dcb738661a448a922f84ac42b8d434ac7fb83e09b9c65"
|
|
59
59
|
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"path": "src/client/header.js",
|
|
63
|
+
"kind": "patched",
|
|
64
|
+
"summary": "Renders the product conversationAddon after the native header identity, preserving goals, activity and slot component identity, and names the open thread beside its Bot so two contexts of one Bot are never confused.",
|
|
65
|
+
"base": {
|
|
66
|
+
"commit": "71d344bf193f3f18185f25de3d8e5c483046910a",
|
|
67
|
+
"sha256": "2e16b329fcc5e0994066db13fe54558ac70fdd7b4131155c89b7aa04d0c59bab"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"path": "src/host/roster.js",
|
|
72
|
+
"kind": "patched",
|
|
73
|
+
"summary": "Adds the trusted thread records addThreadSession/renameThread/setThreadArchived (one save each, the Bot model and permission preset applied, no notice or turn), keeps updateBotProfile untouched, and archives thread Sessions on Bot delete.",
|
|
74
|
+
"base": {
|
|
75
|
+
"commit": "71d344bf193f3f18185f25de3d8e5c483046910a",
|
|
76
|
+
"sha256": "0a06730a0ce2ecf6b67d82319ef9b7fc127b3b2c2170b6e50d3d77ce4c866e32"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"path": "src/host/store.js",
|
|
81
|
+
"kind": "patched",
|
|
82
|
+
"summary": "Indexes a Bot thread Session as another own chat of the same Bot: live threads sit in chatOwners/threadOwners, archived ones in pastOwners with no authority, and threadsOf/threadOf/threadSessionOf/sessionsOfBot are exposed for the product.",
|
|
83
|
+
"base": {
|
|
84
|
+
"commit": "71d344bf193f3f18185f25de3d8e5c483046910a",
|
|
85
|
+
"sha256": "aae02595f97b2337e485f16a84091c9d91d40f6dbdc211350fe3fe0cddf52b19"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"path": "src/host/parts.js",
|
|
90
|
+
"kind": "patched",
|
|
91
|
+
"summary": "Keeps the part steward off thread Sessions: a thread is not a part chain, so nothing condenses it or hands its input on to the Bot default chat.",
|
|
92
|
+
"base": {
|
|
93
|
+
"commit": "71d344bf193f3f18185f25de3d8e5c483046910a",
|
|
94
|
+
"sha256": "f7a2e272f0296414075d2318d45cf58871fff3a22c1d3035707a75bec77ef619"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"path": "src/host/models.js",
|
|
99
|
+
"kind": "patched",
|
|
100
|
+
"summary": "Applies a Bot model change to its live thread Sessions as it already does for group Sessions.",
|
|
101
|
+
"base": {
|
|
102
|
+
"commit": "71d344bf193f3f18185f25de3d8e5c483046910a",
|
|
103
|
+
"sha256": "db1424879e28d6252818eccbb4bc763bc87ff355be503abe3f95399aaed869a9"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"path": "src/host/usage.js",
|
|
108
|
+
"kind": "patched",
|
|
109
|
+
"summary": "Attributes a thread Session usage to its Bot through the shared sessionsOfBot list.",
|
|
110
|
+
"base": {
|
|
111
|
+
"commit": "71d344bf193f3f18185f25de3d8e5c483046910a",
|
|
112
|
+
"sha256": "3d4ff2168d7dfb726c2d5454f36eef58dec1c768b79c2c0c17f4192a34b2bbd7"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"path": "src/host/privacy.js",
|
|
117
|
+
"kind": "patched",
|
|
118
|
+
"summary": "Covers thread Sessions when a private Bot files are purged.",
|
|
119
|
+
"base": {
|
|
120
|
+
"commit": "71d344bf193f3f18185f25de3d8e5c483046910a",
|
|
121
|
+
"sha256": "370b5adf762714a8b794f2079a8bbfd8f9c63811bf599ecadad80a63a9f12c5a"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"path": "src/host/memory.js",
|
|
126
|
+
"kind": "patched",
|
|
127
|
+
"summary": "Renews memory for thread Sessions when a Bot memory is archived.",
|
|
128
|
+
"base": {
|
|
129
|
+
"commit": "71d344bf193f3f18185f25de3d8e5c483046910a",
|
|
130
|
+
"sha256": "5e145d02c6c9d8d217b1725ae8bd88483c6a847300d50f107da70575696b7503"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"path": "src/host/channel.js",
|
|
135
|
+
"kind": "patched",
|
|
136
|
+
"summary": "Projects a Bot threads to the client and refuses input aimed at an archived thread instead of redirecting it to the default chat.",
|
|
137
|
+
"base": {
|
|
138
|
+
"commit": "71d344bf193f3f18185f25de3d8e5c483046910a",
|
|
139
|
+
"sha256": "0e05d9a424b188fe338f7102404a9fb295069d0ece241d63cc4f87be18947d03"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"path": "src/client/sources.js",
|
|
144
|
+
"kind": "patched",
|
|
145
|
+
"summary": "Indexes thread Sessions in a read-only threadsById map by Session id and thread id, resolves a thread Session to its Bot in byId (never taking a Bot's own chat identity), and exports isOwnChatOf so Bot-scoped surfaces recognise a thread as another own chat of the same Bot.",
|
|
146
|
+
"base": {
|
|
147
|
+
"commit": "71d344bf193f3f18185f25de3d8e5c483046910a",
|
|
148
|
+
"sha256": "1cc04070d1869dcc382efc31fafcff8fda9c3271342896c98355c37299458e1c"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"path": "src/client/model-menu.js",
|
|
153
|
+
"kind": "patched",
|
|
154
|
+
"summary": "The Bot's model-choice dock belongs to a thread too: it recognises a thread Session as another own chat of the same Bot instead of only the default chat.",
|
|
155
|
+
"base": {
|
|
156
|
+
"commit": "71d344bf193f3f18185f25de3d8e5c483046910a",
|
|
157
|
+
"sha256": "78c28d9459e78ce4ffa9b3edc64d7d2218b02112eaf3b0ae204cf2700321b7a5"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"path": "src/client/learning-card.js",
|
|
162
|
+
"kind": "patched",
|
|
163
|
+
"summary": "Memory learning proposals are shown for a thread Session, which is another own chat of the same Bot, not only for the default chat.",
|
|
164
|
+
"base": {
|
|
165
|
+
"commit": "71d344bf193f3f18185f25de3d8e5c483046910a",
|
|
166
|
+
"sha256": "29e0ddffc08814b3e9676fb40474ba5ae0702edb1b53267d52e51b4b31be733f"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"path": "src/client/secret-card.js",
|
|
171
|
+
"kind": "patched",
|
|
172
|
+
"summary": "The secret-request dock waits for a thread Session's own cards, so a tool asking for a secret inside a thread is answered there.",
|
|
173
|
+
"base": {
|
|
174
|
+
"commit": "71d344bf193f3f18185f25de3d8e5c483046910a",
|
|
175
|
+
"sha256": "2ac7d7546918b7104d7af8b71d08a6fc07bdc2aeb4168d3ad26bddf2f9fd4ff5"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"path": "src/client/turn-error.js",
|
|
180
|
+
"kind": "patched",
|
|
181
|
+
"summary": "A turn failure inside a thread keeps its sign-in and model-move affordances, exactly as the Bot's default chat does.",
|
|
182
|
+
"base": {
|
|
183
|
+
"commit": "71d344bf193f3f18185f25de3d8e5c483046910a",
|
|
184
|
+
"sha256": "4ed1e99fb3fe66be3a55176389e1ab08e282070e23e9e06089a20f6dbec3b59b"
|
|
185
|
+
}
|
|
60
186
|
}
|
|
61
187
|
],
|
|
62
188
|
"files": [
|
|
@@ -112,8 +238,8 @@
|
|
|
112
238
|
{
|
|
113
239
|
"path": "vendor/ds-bot/client.js",
|
|
114
240
|
"sourcePath": "ds-bot/client.js",
|
|
115
|
-
"sha256": "
|
|
116
|
-
"gitBlob": "
|
|
241
|
+
"sha256": "4cbc9dab369ad584735430f8f599ff42f95cc25187ae613b3e249a7038927e19",
|
|
242
|
+
"gitBlob": "83f416cb587bd0eeaca083627fe963fa86b3c7d3",
|
|
117
243
|
"origin": "generated"
|
|
118
244
|
},
|
|
119
245
|
{
|
|
@@ -595,8 +721,8 @@
|
|
|
595
721
|
{
|
|
596
722
|
"path": "vendor/ds-bot/src/client/details-drawer.js",
|
|
597
723
|
"sourcePath": "ds-bot/src/client/details-drawer.js",
|
|
598
|
-
"sha256": "
|
|
599
|
-
"gitBlob": "
|
|
724
|
+
"sha256": "befbf65f7ffde439846154b7a75479dcc85e507851fa6eac9d54f19c6dc3f3ff",
|
|
725
|
+
"gitBlob": "80e500b2631059df8a4e7c65047c3f68083c0c88",
|
|
600
726
|
"origin": "overlay"
|
|
601
727
|
},
|
|
602
728
|
{
|
|
@@ -707,9 +833,9 @@
|
|
|
707
833
|
{
|
|
708
834
|
"path": "vendor/ds-bot/src/client/header.js",
|
|
709
835
|
"sourcePath": "ds-bot/src/client/header.js",
|
|
710
|
-
"sha256": "
|
|
711
|
-
"gitBlob": "
|
|
712
|
-
"origin": "
|
|
836
|
+
"sha256": "f351d5146259fb1bb5d37054515d8af7d810244fe7629fef948f675c4fb59657",
|
|
837
|
+
"gitBlob": "b8fecbd814f35e3b248ec21b790f39ec817174b0",
|
|
838
|
+
"origin": "overlay"
|
|
713
839
|
},
|
|
714
840
|
{
|
|
715
841
|
"path": "vendor/ds-bot/src/client/i18n.js",
|
|
@@ -728,8 +854,8 @@
|
|
|
728
854
|
{
|
|
729
855
|
"path": "vendor/ds-bot/src/client/index.js",
|
|
730
856
|
"sourcePath": "ds-bot/src/client/index.js",
|
|
731
|
-
"sha256": "
|
|
732
|
-
"gitBlob": "
|
|
857
|
+
"sha256": "85b9eae74c40ccd1f746c1b9e4afcde30ff7bf48efa3d5e6621f8282a37e33a0",
|
|
858
|
+
"gitBlob": "b06262af6a875788b740a737a52b738cfcd43002",
|
|
733
859
|
"origin": "overlay"
|
|
734
860
|
},
|
|
735
861
|
{
|
|
@@ -756,9 +882,9 @@
|
|
|
756
882
|
{
|
|
757
883
|
"path": "vendor/ds-bot/src/client/learning-card.js",
|
|
758
884
|
"sourcePath": "ds-bot/src/client/learning-card.js",
|
|
759
|
-
"sha256": "
|
|
760
|
-
"gitBlob": "
|
|
761
|
-
"origin": "
|
|
885
|
+
"sha256": "598171bb8436c1bb49cd9f8b22a63a310ff05f3e960c28da18ce78ddca1e4bc6",
|
|
886
|
+
"gitBlob": "53c38a6545ce19ab0f9639c09cfd091451e08658",
|
|
887
|
+
"origin": "overlay"
|
|
762
888
|
},
|
|
763
889
|
{
|
|
764
890
|
"path": "vendor/ds-bot/src/client/mark.js",
|
|
@@ -784,9 +910,9 @@
|
|
|
784
910
|
{
|
|
785
911
|
"path": "vendor/ds-bot/src/client/model-menu.js",
|
|
786
912
|
"sourcePath": "ds-bot/src/client/model-menu.js",
|
|
787
|
-
"sha256": "
|
|
788
|
-
"gitBlob": "
|
|
789
|
-
"origin": "
|
|
913
|
+
"sha256": "69a7388f92b874ba7b1da04505185a1abdcc73d1d42e67ca23ae0ce4f08056f9",
|
|
914
|
+
"gitBlob": "3757efc44eab2a34057dc4c1c9e20b68a1e0d41b",
|
|
915
|
+
"origin": "overlay"
|
|
790
916
|
},
|
|
791
917
|
{
|
|
792
918
|
"path": "vendor/ds-bot/src/client/motion.js",
|
|
@@ -875,9 +1001,9 @@
|
|
|
875
1001
|
{
|
|
876
1002
|
"path": "vendor/ds-bot/src/client/secret-card.js",
|
|
877
1003
|
"sourcePath": "ds-bot/src/client/secret-card.js",
|
|
878
|
-
"sha256": "
|
|
879
|
-
"gitBlob": "
|
|
880
|
-
"origin": "
|
|
1004
|
+
"sha256": "483e08362e1502e727e353b74bb921e18559a852c09532a0ec5858fd02615806",
|
|
1005
|
+
"gitBlob": "4c118cb99d25b41536dc4b31bb9797e338f04c7a",
|
|
1006
|
+
"origin": "overlay"
|
|
881
1007
|
},
|
|
882
1008
|
{
|
|
883
1009
|
"path": "vendor/ds-bot/src/client/settings.js",
|
|
@@ -917,9 +1043,9 @@
|
|
|
917
1043
|
{
|
|
918
1044
|
"path": "vendor/ds-bot/src/client/sources.js",
|
|
919
1045
|
"sourcePath": "ds-bot/src/client/sources.js",
|
|
920
|
-
"sha256": "
|
|
921
|
-
"gitBlob": "
|
|
922
|
-
"origin": "
|
|
1046
|
+
"sha256": "eb3c5f70c60cab79039d5ce771e864c533c915aca9d3b4662fcf045c98d66860",
|
|
1047
|
+
"gitBlob": "53d49e0485d9cb32c72a5c4b0448885c3a8bc2dd",
|
|
1048
|
+
"origin": "overlay"
|
|
923
1049
|
},
|
|
924
1050
|
{
|
|
925
1051
|
"path": "vendor/ds-bot/src/client/speech.js",
|
|
@@ -973,9 +1099,9 @@
|
|
|
973
1099
|
{
|
|
974
1100
|
"path": "vendor/ds-bot/src/client/turn-error.js",
|
|
975
1101
|
"sourcePath": "ds-bot/src/client/turn-error.js",
|
|
976
|
-
"sha256": "
|
|
977
|
-
"gitBlob": "
|
|
978
|
-
"origin": "
|
|
1102
|
+
"sha256": "07bfc99a2c11b144cfcbcf7951237a5ad0e853c0e48988382fc39d92afe96b47",
|
|
1103
|
+
"gitBlob": "7f34129a2dcb28e377c669d6b510703fd5781131",
|
|
1104
|
+
"origin": "overlay"
|
|
979
1105
|
},
|
|
980
1106
|
{
|
|
981
1107
|
"path": "vendor/ds-bot/src/client/turn-reasoning.js",
|
|
@@ -1134,9 +1260,9 @@
|
|
|
1134
1260
|
{
|
|
1135
1261
|
"path": "vendor/ds-bot/src/host/channel.js",
|
|
1136
1262
|
"sourcePath": "ds-bot/src/host/channel.js",
|
|
1137
|
-
"sha256": "
|
|
1138
|
-
"gitBlob": "
|
|
1139
|
-
"origin": "
|
|
1263
|
+
"sha256": "363ba4779753b18b350233959358af2ff27efe8158828c2b2bc03295e5a66e0e",
|
|
1264
|
+
"gitBlob": "b2d2a764e2338c8fac5c44cea4cc57dd474269a2",
|
|
1265
|
+
"origin": "overlay"
|
|
1140
1266
|
},
|
|
1141
1267
|
{
|
|
1142
1268
|
"path": "vendor/ds-bot/src/host/chat-index.js",
|
|
@@ -1267,16 +1393,16 @@
|
|
|
1267
1393
|
{
|
|
1268
1394
|
"path": "vendor/ds-bot/src/host/memory.js",
|
|
1269
1395
|
"sourcePath": "ds-bot/src/host/memory.js",
|
|
1270
|
-
"sha256": "
|
|
1271
|
-
"gitBlob": "
|
|
1272
|
-
"origin": "
|
|
1396
|
+
"sha256": "e96abcea64320faae0088ace7971aa3415b1803a8ce7d94fa39f27f9e200096d",
|
|
1397
|
+
"gitBlob": "91efa72b230c6c146901afd61f321adda6a45d1c",
|
|
1398
|
+
"origin": "overlay"
|
|
1273
1399
|
},
|
|
1274
1400
|
{
|
|
1275
1401
|
"path": "vendor/ds-bot/src/host/models.js",
|
|
1276
1402
|
"sourcePath": "ds-bot/src/host/models.js",
|
|
1277
|
-
"sha256": "
|
|
1278
|
-
"gitBlob": "
|
|
1279
|
-
"origin": "
|
|
1403
|
+
"sha256": "164f455b356ee11b5e29d1a03fe1df2316b476efee02200eb86ab0f518e66a5f",
|
|
1404
|
+
"gitBlob": "dfb19b892651bdc226fde3cf00bfc91c6204469e",
|
|
1405
|
+
"origin": "overlay"
|
|
1280
1406
|
},
|
|
1281
1407
|
{
|
|
1282
1408
|
"path": "vendor/ds-bot/src/host/office-skills.js",
|
|
@@ -1288,9 +1414,9 @@
|
|
|
1288
1414
|
{
|
|
1289
1415
|
"path": "vendor/ds-bot/src/host/parts.js",
|
|
1290
1416
|
"sourcePath": "ds-bot/src/host/parts.js",
|
|
1291
|
-
"sha256": "
|
|
1292
|
-
"gitBlob": "
|
|
1293
|
-
"origin": "
|
|
1417
|
+
"sha256": "a8838e607ba61b65b2e776b2f1586c3ca6a28112551585ee895826f555a5ac41",
|
|
1418
|
+
"gitBlob": "ded9f132b41086a6a1682b6c2e1aaa8f186d38eb",
|
|
1419
|
+
"origin": "overlay"
|
|
1294
1420
|
},
|
|
1295
1421
|
{
|
|
1296
1422
|
"path": "vendor/ds-bot/src/host/permissions.js",
|
|
@@ -1302,9 +1428,9 @@
|
|
|
1302
1428
|
{
|
|
1303
1429
|
"path": "vendor/ds-bot/src/host/privacy.js",
|
|
1304
1430
|
"sourcePath": "ds-bot/src/host/privacy.js",
|
|
1305
|
-
"sha256": "
|
|
1306
|
-
"gitBlob": "
|
|
1307
|
-
"origin": "
|
|
1431
|
+
"sha256": "dce19addbe585932d9cdcf8375cbd34ccfb92ca8b809a72ab03a965a7c5a9fba",
|
|
1432
|
+
"gitBlob": "20ad3cf78011177ad578f859462946fb3b98e3cd",
|
|
1433
|
+
"origin": "overlay"
|
|
1308
1434
|
},
|
|
1309
1435
|
{
|
|
1310
1436
|
"path": "vendor/ds-bot/src/host/prompt.js",
|
|
@@ -1337,9 +1463,9 @@
|
|
|
1337
1463
|
{
|
|
1338
1464
|
"path": "vendor/ds-bot/src/host/roster.js",
|
|
1339
1465
|
"sourcePath": "ds-bot/src/host/roster.js",
|
|
1340
|
-
"sha256": "
|
|
1341
|
-
"gitBlob": "
|
|
1342
|
-
"origin": "
|
|
1466
|
+
"sha256": "7eaa83caa98b08be978ce58ad754e58c5de9ed2290ee577bcd8225a578bdeb58",
|
|
1467
|
+
"gitBlob": "f2d9ae2f853f1223b52e9c589bcc5cc316252940",
|
|
1468
|
+
"origin": "overlay"
|
|
1343
1469
|
},
|
|
1344
1470
|
{
|
|
1345
1471
|
"path": "vendor/ds-bot/src/host/schedules.js",
|
|
@@ -1386,9 +1512,9 @@
|
|
|
1386
1512
|
{
|
|
1387
1513
|
"path": "vendor/ds-bot/src/host/store.js",
|
|
1388
1514
|
"sourcePath": "ds-bot/src/host/store.js",
|
|
1389
|
-
"sha256": "
|
|
1390
|
-
"gitBlob": "
|
|
1391
|
-
"origin": "
|
|
1515
|
+
"sha256": "a603a6d908caf8196b8d289913b1dda556c0be1c9cc13ae8120f400958adcf2b",
|
|
1516
|
+
"gitBlob": "aa95a4dc3db7c0cfe9605456291c4dacf9878913",
|
|
1517
|
+
"origin": "overlay"
|
|
1392
1518
|
},
|
|
1393
1519
|
{
|
|
1394
1520
|
"path": "vendor/ds-bot/src/host/text.js",
|
|
@@ -1435,9 +1561,9 @@
|
|
|
1435
1561
|
{
|
|
1436
1562
|
"path": "vendor/ds-bot/src/host/usage.js",
|
|
1437
1563
|
"sourcePath": "ds-bot/src/host/usage.js",
|
|
1438
|
-
"sha256": "
|
|
1439
|
-
"gitBlob": "
|
|
1440
|
-
"origin": "
|
|
1564
|
+
"sha256": "db255f1628b0b20403f495fcc853bdfc66e1525257ff4ab0e0dbea854c14452f",
|
|
1565
|
+
"gitBlob": "d2ad4a4de07126fbee886cdae0962ebc2dee9a06",
|
|
1566
|
+
"origin": "overlay"
|
|
1441
1567
|
},
|
|
1442
1568
|
{
|
|
1443
1569
|
"path": "vendor/ds-bot/src/office/check.js",
|
|
@@ -4,8 +4,13 @@ import { attachDsLifecycle } from '../../packages/orchestration/src/ds-lifecycle
|
|
|
4
4
|
import { guardDsWorkspaceReads } from '../../packages/orchestration/src/ds-workspace-privacy.mjs'
|
|
5
5
|
import { createProductReadModel, registerProductChannel } from './read-model.mjs'
|
|
6
6
|
import { needsBotPolicy } from './policy-scope.mjs'
|
|
7
|
+
import { createBotServing } from '../../packages/orchestration/src/bot-serving.mjs'
|
|
8
|
+
import { createBotThreadAdmission } from '../../packages/orchestration/src/bot-thread-admission.mjs'
|
|
9
|
+
import { createBotIndependentExecution } from '../../packages/orchestration/src/bot-independent-execution.mjs'
|
|
10
|
+
import { createPreparedModelDispatch, redactPreparedModelRequest } from '../../packages/orchestration/src/model-prepared-generation.mjs'
|
|
7
11
|
|
|
8
12
|
export { inject }
|
|
13
|
+
export { isAgentLoopRequest }
|
|
9
14
|
export const contractVersion = 1
|
|
10
15
|
|
|
11
16
|
/**
|
|
@@ -14,7 +19,8 @@ export const contractVersion = 1
|
|
|
14
19
|
* startup, the one financial store, and final disposal of the shared services.
|
|
15
20
|
*/
|
|
16
21
|
export function createBotProduct(ctx, options = {}) {
|
|
17
|
-
const { authority, directory, policy, grantFor, accountStream, onBind, authorizeRequest } = options
|
|
22
|
+
const { authority, directory, policy, grantFor, accountStream, onBind, authorizeRequest, now = Date.now } = options
|
|
23
|
+
const optionsBeforeModelRequest = typeof options.beforeModelRequest === 'function' ? options.beforeModelRequest : async () => {}
|
|
18
24
|
if (!authority || !directory || typeof policy?.modelStream !== 'function' || typeof policy?.modelIdentity !== 'function' || typeof grantFor !== 'function') {
|
|
19
25
|
throw new TypeError('BOT_PRODUCT_SERVICES_REQUIRED: shared authority, directory, policy and trusted grantFor are required')
|
|
20
26
|
}
|
|
@@ -26,13 +32,69 @@ export function createBotProduct(ctx, options = {}) {
|
|
|
26
32
|
rt.updateView = integratedUpdate
|
|
27
33
|
rt.updateStart = () => { throw Object.assign(new Error('请在 Harness 插件管理中更新 Bot 工作系统;内置 DS 模块随同发布。'), { code: 'bot/integrated-update' }) }
|
|
28
34
|
|
|
35
|
+
// Which runtime serves a Bot is committed state, read back through the Host's own adapter.
|
|
36
|
+
// A Host that installed no switch never moved anything, so integration is the truth there; a
|
|
37
|
+
// switch that cannot be read refuses the call instead of being assumed away.
|
|
38
|
+
const modeOf = typeof options.modeOf === 'function' ? options.modeOf : botId => {
|
|
39
|
+
const adapter = (() => { try { return ctx.get?.('botRuntimeAdapter') ?? null } catch { return null } })()
|
|
40
|
+
if (!adapter || typeof adapter.modeOf !== 'function') return 'integration'
|
|
41
|
+
return adapter.modeOf(botId)
|
|
42
|
+
}
|
|
43
|
+
const serving = (() => {
|
|
44
|
+
const provided = (() => { try { return options.serving ?? ctx.get?.('botServing') ?? null } catch { return null } })()
|
|
45
|
+
// A shared admission is preferred; anything that is not one is replaced rather than trusted.
|
|
46
|
+
return provided && typeof provided.enter === 'function' && typeof provided.assertMode === 'function' && typeof provided.assertIdle === 'function'
|
|
47
|
+
? provided
|
|
48
|
+
: createBotServing({ modeOf, rt, now })
|
|
49
|
+
})()
|
|
50
|
+
// The thread catalog is built after this runtime, so it is resolved per call: a guard that
|
|
51
|
+
// captured a half-composed Host would either miss the service or freeze a stale one.
|
|
52
|
+
const threadAdmission = createBotThreadAdmission({
|
|
53
|
+
threads: options.threadHost ?? (() => { try { return ctx.get?.('botThreads') ?? null } catch { return null } }),
|
|
54
|
+
nativeThreadOf: id => rt.threadOf(id),
|
|
55
|
+
})
|
|
56
|
+
// The admission is published before this runtime exists, so it is bound here and released on
|
|
57
|
+
// disposal. Without the binding its native probe would see nothing, and a Bot mid-turn would
|
|
58
|
+
// look idle to a move.
|
|
59
|
+
const releaseServingRuntime = typeof serving.bindRuntime === 'function' ? serving.bindRuntime(rt) : null
|
|
60
|
+
|
|
29
61
|
const lifecycle = attachDsLifecycle({ runtime: rt, directory, grantFor, onBind: (agent, grant) => {
|
|
30
62
|
const scoped = agent.ctx.get('tools')
|
|
31
63
|
let signature, release = () => {}
|
|
64
|
+
const isTextOnly = selected => {
|
|
65
|
+
if (typeof options.isTextOnlyModel !== 'function') return false
|
|
66
|
+
const botId = authority.describe(directory.forAgent(agent)).botId
|
|
67
|
+
// Main retains its multi-route grant. Its live Host selection determines
|
|
68
|
+
// this step's capabilities; a saved default is not its entire route set.
|
|
69
|
+
if (lifecycle.committedMainBotIds().includes(botId)) {
|
|
70
|
+
const route = selected?.provider && selected?.model ? selected : agent.options
|
|
71
|
+
if (route?.provider && route?.model) return options.isTextOnlyModel({ provider: route.provider, model: route.model }) === true
|
|
72
|
+
}
|
|
73
|
+
const ref = lifecycle.committedBot(botId)?.model ?? ''
|
|
74
|
+
const at = ref.indexOf('/')
|
|
75
|
+
return at > 0 && options.isTextOnlyModel({ provider: ref.slice(0, at), model: ref.slice(at + 1) }) === true
|
|
76
|
+
}
|
|
77
|
+
// The SDK's restrict() masks inherited tools only; DS Bot's team tools are
|
|
78
|
+
// registered in the Agent's own scope. Negotiate the actual assembled request
|
|
79
|
+
// through the public scoped prompt waterfall as well. The adapter still
|
|
80
|
+
// independently refuses a nonempty tool request before accounting.
|
|
81
|
+
const offAssembly = typeof agent.ctx.on === 'function' ? agent.ctx.on('system-prompt/assemble', async (_assembly, _context, next) => {
|
|
82
|
+
refresh()
|
|
83
|
+
const formed = await next()
|
|
84
|
+
return isTextOnly(formed.variables) ? { ...formed, tools: [] } : formed
|
|
85
|
+
}, { prepend: true }) : () => {}
|
|
86
|
+
const offRequest = typeof agent.ctx.on === 'function' && typeof options.prepareLoopFunding === 'function' ? agent.ctx.on('agent/request', async (position, next) => {
|
|
87
|
+
const config = await next()
|
|
88
|
+
const botId = authority.describe(directory.forAgent(agent)).botId
|
|
89
|
+
return options.prepareLoopFunding({ botId, sessionId: agent.session.id, signal: position.signal, config,
|
|
90
|
+
previousConfig: agent.session.requestHeader?.()?.config })
|
|
91
|
+
}, { prepend: true }) : () => {}
|
|
32
92
|
const refresh = () => {
|
|
33
93
|
const deny = ctx.tools.schemas().map(tool => tool.name)
|
|
34
94
|
.filter(name => (name.startsWith('model_router_') && !grant.tools.includes(`tool/${name}`)) ||
|
|
35
95
|
(name.startsWith('bot_task_') && !grant.tools.includes(`task/${({ start: 'submit', status: 'read', plan_start:'submit',plan_status:'read',plan_cancel:'cancel' })[name.slice(9)] ?? name.slice(9)}`)) ||
|
|
96
|
+
(name.startsWith('data_') && !grant.tools.includes('tool/data')) ||
|
|
97
|
+
(['coordinate_bots', 'assignment_status', 'list_threads'].includes(name) && !grant.tools.includes('tool/team')) ||
|
|
36
98
|
(name.startsWith('remote_computer_') && name !== 'remote_computer_browser' && !grant.tools.includes(`tool/${name}`)))
|
|
37
99
|
.sort()
|
|
38
100
|
const next = JSON.stringify(deny)
|
|
@@ -43,28 +105,121 @@ export function createBotProduct(ctx, options = {}) {
|
|
|
43
105
|
}
|
|
44
106
|
const off = ctx.on('tools/change', refresh)
|
|
45
107
|
let extra
|
|
46
|
-
try { refresh(); extra = onBind?.(agent, grant) } catch (error) { off(); release(); throw error }
|
|
47
|
-
return () => { off(); release(); extra?.() }
|
|
108
|
+
try { refresh(); extra = onBind?.(agent, grant) } catch (error) { off(); offAssembly(); offRequest(); release(); throw error }
|
|
109
|
+
return () => { off(); offAssembly(); offRequest(); release(); extra?.() }
|
|
48
110
|
} })
|
|
49
111
|
const offAgent = ctx.on('agent/created', ({ agent }) => lifecycle.observeAgent(agent))
|
|
112
|
+
// The independent loop's turns run in a frame only this Host can build: the committed Bot, the
|
|
113
|
+
// model that Bot has saved, the Bot policy and the one money stream. It is published once, before
|
|
114
|
+
// any Bot is moved, and the loop asks it per step — a Host that has not started this product has
|
|
115
|
+
// no such frame, and the independent runtime then refuses to run instead of answering from a
|
|
116
|
+
// global provider/model setting.
|
|
117
|
+
// A Host-prepared stream binds one adapter generation (metadata + dispatch) and admits the money
|
|
118
|
+
// against that same generation, so a registration replaced between admission and dispatch cannot
|
|
119
|
+
// price one window and stream another. It is composed from the Host's own `llm`, a Host-owned
|
|
120
|
+
// frame store and the committed funding reader; without that wiring the bridge falls back to the
|
|
121
|
+
// ordinary stream, which re-resolves the model at dispatch exactly as before.
|
|
122
|
+
// A funded Host that supplied this wiring must support prepareCall; it never
|
|
123
|
+
// silently downgrades that request to an unprepared dispatch.
|
|
124
|
+
const hostLlm = () => { try { return ctx.get?.('llm') ?? ctx.llm ?? null } catch { return ctx.llm ?? null } }
|
|
125
|
+
const modelFrames = options.modelFrames ?? null
|
|
126
|
+
const preparedDispatch = (options.modelFrames && typeof options.fundingFor === 'function')
|
|
127
|
+
? createPreparedModelDispatch({ llm: hostLlm, frames: options.modelFrames, fundingFor: options.fundingFor })
|
|
128
|
+
: null
|
|
129
|
+
const independentExecution = createBotIndependentExecution({
|
|
130
|
+
policy, directory, lifecycle, serving, authority,
|
|
131
|
+
...(options.independentReadyFor===undefined?{}:{readyFor:options.independentReadyFor}),
|
|
132
|
+
stream: (request, context) => {
|
|
133
|
+
const llm = hostLlm()
|
|
134
|
+
if (!llm || typeof llm.stream !== 'function') throw Object.assign(new Error('宿主模型服务不可用,本次请求被拒绝。'), { code: 'HOST_LLM_UNAVAILABLE' })
|
|
135
|
+
// The prepared path needs the SDK's prepareCall seam. A Host wired for it with a runtime
|
|
136
|
+
// that exposes it binds and admits one generation; otherwise the ordinary stream runs,
|
|
137
|
+
// re-resolving the model at dispatch exactly as before.
|
|
138
|
+
if (preparedDispatch) return (async function* () {
|
|
139
|
+
await rt.loadSecrets?.()
|
|
140
|
+
const redacted = redactPreparedModelRequest(request, rt.redactSecrets)
|
|
141
|
+
if (redacted.messages !== request.messages) rt.carryUsageTag?.(request.messages, redacted.messages)
|
|
142
|
+
yield* preparedDispatch.dispatch(redacted, context)
|
|
143
|
+
})()
|
|
144
|
+
return llm.stream(request)
|
|
145
|
+
},
|
|
146
|
+
})
|
|
147
|
+
ctx.provide('botIndependentExecution', independentExecution)
|
|
148
|
+
// Every chunk is re-decided. The policy already re-asserts the committed model route per
|
|
149
|
+
// chunk; ownership, archive, revocation and the committed runtime are re-read here with it, so
|
|
150
|
+
// a change made mid-turn stops the stream at the next chunk instead of letting it finish under
|
|
151
|
+
// a Bot, a thread or a runtime that no longer stands.
|
|
152
|
+
const serveStream = async function* (options, { botId, thread, guarded, independent }) {
|
|
153
|
+
for await (const chunk of policy.modelStream(options, guarded)) {
|
|
154
|
+
if (thread.kind === 'thread') threadAdmission.admit(options.sessionId)
|
|
155
|
+
// An independent turn re-reads the Bot's own committed record with the mode, so a Bot that
|
|
156
|
+
// was deleted, suspended or moved stops here rather than finishing on a stale one.
|
|
157
|
+
if (independent) independentExecution.assertTurn(botId)
|
|
158
|
+
else serving.assertMode(botId, 'integration')
|
|
159
|
+
yield chunk
|
|
160
|
+
}
|
|
161
|
+
}
|
|
50
162
|
const offStream = ctx.on('llm/stream', (options, next) => (async function* () {
|
|
51
163
|
await rt.load()
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
164
|
+
const prepared = modelFrames?.read?.(options.signal)
|
|
165
|
+
if (prepared?.request && prepared.request !== options) {
|
|
166
|
+
throw Object.assign(new Error('模型请求在准备后被改写,已拒绝更换调用配置;请核对原请求后重试。'), { code: 'MODEL_PREPARED_REQUEST_REWRITTEN' })
|
|
167
|
+
}
|
|
168
|
+
// A Bot thread is decided on the thread catalog, before the ordinary Session bypass. The
|
|
169
|
+
// runtime's live owner index is not enough: an archived thread, a revoked grant, a deleted
|
|
170
|
+
// Bot and a moved runtime all leave that index, and the bypass would then answer for the
|
|
171
|
+
// Bot with no Bot policy, no accounting and no thread at all.
|
|
172
|
+
const thread = threadAdmission.admit(options.sessionId)
|
|
173
|
+
const frame = policy.activeIdentity()
|
|
174
|
+
if (modelFrames && frame?.independent === true && !prepared) {
|
|
175
|
+
throw Object.assign(new Error('独立模型调用缺少宿主准备记录,已拒绝未绑定的调用。'), { code: 'MODEL_PREPARED_CONTEXT_REQUIRED' })
|
|
176
|
+
}
|
|
177
|
+
const policed = thread.kind === 'thread'
|
|
178
|
+
|| needsBotPolicy({ admitted: Boolean(frame), isBotSession: id => rt.isBotSession(id), sessionId: options.sessionId })
|
|
179
|
+
if (!policed) { yield* next(); return }
|
|
180
|
+
// A frame this Host built for an independent turn. The committed switch — not the frame —
|
|
181
|
+
// decides which runtime answers, so the admission below runs with `independent` expected: a
|
|
182
|
+
// Bot still on the integration path is refused rather than answered twice, and a Bot that was
|
|
183
|
+
// moved is served here instead of being rejected as a moved Bot.
|
|
184
|
+
const independent = frame?.independent === true
|
|
57
185
|
// The policy also understands its AsyncLocalStorage execution context.
|
|
58
186
|
// Resolve identity within the guarded next() call, after policy admission.
|
|
59
|
-
const guarded = ()
|
|
187
|
+
const guarded = async function* () {
|
|
60
188
|
// Identity comes from the trusted context: the live Session when present,
|
|
61
189
|
// otherwise the admitted execution frame (a direct MR call inside a tool
|
|
62
190
|
// carries no sessionId of its own).
|
|
63
191
|
const identity = policy.modelIdentity(options)
|
|
64
|
-
|
|
65
|
-
|
|
192
|
+
await optionsBeforeModelRequest(options, identity)
|
|
193
|
+
// An independent turn is the Bot's own session turn: its own transcript, its own money.
|
|
194
|
+
const source = independent || (!rt.ownRequest(options) && isAgentLoopRequest(options)) ? 'bot-session' : 'bot-auxiliary'
|
|
195
|
+
yield* accountStream(options, next, { ...identity, source, ownRequest:Boolean(rt.ownRequest(options)),agentLoop:isAgentLoopRequest(options), runtime: rt })
|
|
196
|
+
}
|
|
197
|
+
// The Bot this call speaks for comes from committed state — the thread record, the live
|
|
198
|
+
// Session (a chat, a group Session or an earlier part of either), or the admitted execution
|
|
199
|
+
// frame — never from the request. A group Session is a Bot's own work exactly like its chat.
|
|
200
|
+
const botId = thread.kind === 'thread' ? thread.botId
|
|
201
|
+
: independent ? frame?.botId ?? null
|
|
202
|
+
: rt.selfOf(options.sessionId) ?? rt.groupOwners?.get(options.sessionId)?.botId ?? frame?.botId ?? null
|
|
203
|
+
if (typeof botId !== 'string' || botId === '') {
|
|
204
|
+
// A call the product claims but cannot attribute is refused. Falling through to the
|
|
205
|
+
// ordinary bypass here would answer for a Bot with no Bot policy and no accounting.
|
|
206
|
+
throw Object.assign(new Error('无法确认本次请求所属的 Bot,已拒绝。'), { code: 'PRODUCT_IDENTITY_UNRESOLVED', outcome: 'refused' })
|
|
207
|
+
}
|
|
208
|
+
if (frame?.owner === true) {
|
|
209
|
+
// An owner frame is a person's own call, not a Bot turn: the policy and the one money
|
|
210
|
+
// stream still apply, but no Bot is being served, so no lease and no runtime is chosen.
|
|
211
|
+
yield* policy.modelStream(options, guarded)
|
|
212
|
+
return
|
|
213
|
+
}
|
|
214
|
+
// One writer per Bot, on the committed runtime, for the whole stream: the lease is what a
|
|
215
|
+
// move has to see, and it is released on completion, cancel, failure or exception alike.
|
|
216
|
+
serving.assertMode(botId, independent ? 'independent' : 'integration')
|
|
217
|
+
const lease = serving.enter(botId)
|
|
218
|
+
try {
|
|
219
|
+
yield* serveStream(options, { botId, thread, guarded, independent })
|
|
220
|
+
} finally {
|
|
221
|
+
lease.release()
|
|
66
222
|
}
|
|
67
|
-
yield* policy.modelStream(options, guarded)
|
|
68
223
|
})())
|
|
69
224
|
const readModel = createProductReadModel({ runtime: rt, lifecycle, providers: options.readModels, actions: options.actions })
|
|
70
225
|
ctx.provide('botProductReadModel', readModel)
|
|
@@ -74,8 +229,9 @@ export function createBotProduct(ctx, options = {}) {
|
|
|
74
229
|
const dispose = () => {
|
|
75
230
|
if (closed) return
|
|
76
231
|
closed = true
|
|
232
|
+
releaseServingRuntime?.()
|
|
77
233
|
releaseWorkspacePrivacy(); releaseChannel(); offStream(); offAgent(); lifecycle.close()
|
|
78
234
|
}
|
|
79
235
|
ctx.effect(() => dispose, 'bot-product: composed lifecycle')
|
|
80
|
-
return Object.freeze({ version: contractVersion, rt, lifecycle, readModel, dispose })
|
|
236
|
+
return Object.freeze({ version: contractVersion, rt, lifecycle, readModel, dispose, serving, threadAdmission })
|
|
81
237
|
}
|