@botiverse/oar 0.121.0 → 0.123.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 +13 -8
- package/dist/capabilities.d.ts +10 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +7 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/community/cybion/client.d.ts +24 -0
- package/dist/community/cybion/client.d.ts.map +1 -0
- package/dist/community/cybion/client.js +42 -0
- package/dist/community/cybion/client.js.map +1 -0
- package/dist/community/cybion/index.d.ts +14 -0
- package/dist/community/cybion/index.d.ts.map +1 -0
- package/dist/community/cybion/index.js +30 -0
- package/dist/community/cybion/index.js.map +1 -0
- package/dist/community/cybion/projection.d.ts +7 -0
- package/dist/community/cybion/projection.d.ts.map +1 -0
- package/dist/community/cybion/projection.js +100 -0
- package/dist/community/cybion/projection.js.map +1 -0
- package/dist/community/cybion/refusal.d.ts +19 -0
- package/dist/community/cybion/refusal.d.ts.map +1 -0
- package/dist/community/cybion/refusal.js +23 -0
- package/dist/community/cybion/refusal.js.map +1 -0
- package/dist/community/cybion/refused-options.d.ts +4 -0
- package/dist/community/cybion/refused-options.d.ts.map +1 -0
- package/dist/community/cybion/refused-options.js +17 -0
- package/dist/community/cybion/refused-options.js.map +1 -0
- package/dist/community/cybion/session.d.ts +8 -0
- package/dist/community/cybion/session.d.ts.map +1 -0
- package/dist/community/cybion/session.js +283 -0
- package/dist/community/cybion/session.js.map +1 -0
- package/dist/community/cybion/thread.d.ts +75 -0
- package/dist/community/cybion/thread.d.ts.map +1 -0
- package/dist/community/cybion/thread.js +192 -0
- package/dist/community/cybion/thread.js.map +1 -0
- package/dist/community/cybion/tracker-facts.d.ts +38 -0
- package/dist/community/cybion/tracker-facts.d.ts.map +1 -0
- package/dist/community/cybion/tracker-facts.js +44 -0
- package/dist/community/cybion/tracker-facts.js.map +1 -0
- package/dist/community/cybion/tracker.d.ts +76 -0
- package/dist/community/cybion/tracker.d.ts.map +1 -0
- package/dist/community/cybion/tracker.js +244 -0
- package/dist/community/cybion/tracker.js.map +1 -0
- package/dist/community/index.d.ts +1 -0
- package/dist/community/index.d.ts.map +1 -1
- package/dist/community/index.js +1 -0
- package/dist/community/index.js.map +1 -1
- package/dist/community/morph/projection.d.ts.map +1 -1
- package/dist/community/morph/projection.js +14 -2
- package/dist/community/morph/projection.js.map +1 -1
- package/dist/community/morph/tracker.d.ts.map +1 -1
- package/dist/community/morph/tracker.js +18 -6
- package/dist/community/morph/tracker.js.map +1 -1
- package/dist/contracts/account-usage.d.ts +3 -1
- package/dist/contracts/account-usage.d.ts.map +1 -1
- package/dist/contracts/context-usage.d.ts +10 -0
- package/dist/contracts/context-usage.d.ts.map +1 -1
- package/dist/contracts/failure.d.ts +4 -1
- package/dist/contracts/failure.d.ts.map +1 -1
- package/dist/contracts/graph.d.ts +1 -1
- package/dist/contracts/graph.d.ts.map +1 -1
- package/dist/contracts/index.d.ts +5 -4
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +1 -1
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/login.d.ts +6 -0
- package/dist/contracts/login.d.ts.map +1 -1
- package/dist/contracts/orientation.d.ts +5 -0
- package/dist/contracts/orientation.d.ts.map +1 -1
- package/dist/contracts/records.d.ts +12 -11
- package/dist/contracts/records.d.ts.map +1 -1
- package/dist/contracts/runtime.d.ts +77 -6
- package/dist/contracts/runtime.d.ts.map +1 -1
- package/dist/contracts/runtime.js +25 -0
- package/dist/contracts/runtime.js.map +1 -1
- package/dist/contracts/session-options.d.ts +22 -22
- package/dist/contracts/session-options.d.ts.map +1 -1
- package/dist/contracts/session.d.ts +2 -2
- package/dist/contracts/session.d.ts.map +1 -1
- package/dist/forms/fields.d.ts +6 -3
- package/dist/forms/fields.d.ts.map +1 -1
- package/dist/forms/fields.js +44 -5
- package/dist/forms/fields.js.map +1 -1
- package/dist/forms/map.d.ts.map +1 -1
- package/dist/forms/map.js +18 -14
- package/dist/forms/map.js.map +1 -1
- package/dist/forms/types.d.ts +1 -1
- package/dist/forms/types.d.ts.map +1 -1
- package/dist/forms/validate.d.ts.map +1 -1
- package/dist/forms/validate.js +8 -15
- package/dist/forms/validate.js.map +1 -1
- package/dist/observe/conversation.d.ts.map +1 -1
- package/dist/observe/conversation.js +2 -8
- package/dist/observe/conversation.js.map +1 -1
- package/dist/observe/cursor.d.ts +6 -0
- package/dist/observe/cursor.d.ts.map +1 -0
- package/dist/observe/cursor.js +19 -0
- package/dist/observe/cursor.js.map +1 -0
- package/dist/observe/display-text.d.ts.map +1 -1
- package/dist/observe/display-text.js +1 -0
- package/dist/observe/display-text.js.map +1 -1
- package/dist/observe/events.d.ts +1 -1
- package/dist/observe/events.d.ts.map +1 -1
- package/dist/observe/events.js +5 -3
- package/dist/observe/events.js.map +1 -1
- package/dist/observe/failure-advice.d.ts.map +1 -1
- package/dist/observe/failure-advice.js +1 -0
- package/dist/observe/failure-advice.js.map +1 -1
- package/dist/observe/graph.d.ts +2 -0
- package/dist/observe/graph.d.ts.map +1 -1
- package/dist/observe/graph.js +17 -1
- package/dist/observe/graph.js.map +1 -1
- package/dist/observe/session-view-events.d.ts.map +1 -1
- package/dist/observe/session-view-events.js +6 -7
- package/dist/observe/session-view-events.js.map +1 -1
- package/dist/observe/session-view-fold.d.ts +1 -0
- package/dist/observe/session-view-fold.d.ts.map +1 -1
- package/dist/observe/session-view-fold.js +2 -0
- package/dist/observe/session-view-fold.js.map +1 -1
- package/dist/observe/session-view-root.d.ts +8 -0
- package/dist/observe/session-view-root.d.ts.map +1 -0
- package/dist/observe/session-view-root.js +69 -0
- package/dist/observe/session-view-root.js.map +1 -0
- package/dist/observe/session-view.d.ts +6 -7
- package/dist/observe/session-view.d.ts.map +1 -1
- package/dist/observe/session-view.js +19 -27
- package/dist/observe/session-view.js.map +1 -1
- package/dist/observe/usage-totals.d.ts +0 -2
- package/dist/observe/usage-totals.d.ts.map +1 -1
- package/dist/observe/usage-totals.js +1 -15
- package/dist/observe/usage-totals.js.map +1 -1
- package/dist/observe/usage.js +2 -2
- package/dist/observe/usage.js.map +1 -1
- package/dist/platforms.d.ts +25 -0
- package/dist/platforms.d.ts.map +1 -0
- package/dist/platforms.js +16 -0
- package/dist/platforms.js.map +1 -0
- package/dist/runtimes/antigravity/index.d.ts +8 -1
- package/dist/runtimes/antigravity/index.d.ts.map +1 -1
- package/dist/runtimes/antigravity/index.js +3 -2
- package/dist/runtimes/antigravity/index.js.map +1 -1
- package/dist/runtimes/antigravity/skill-files.d.ts.map +1 -1
- package/dist/runtimes/antigravity/skill-files.js +44 -18
- package/dist/runtimes/antigravity/skill-files.js.map +1 -1
- package/dist/runtimes/antigravity/skill-manifests.d.ts +2 -0
- package/dist/runtimes/antigravity/skill-manifests.d.ts.map +1 -1
- package/dist/runtimes/antigravity/skill-manifests.js +11 -16
- package/dist/runtimes/antigravity/skill-manifests.js.map +1 -1
- package/dist/runtimes/claude/account-usage.d.ts.map +1 -1
- package/dist/runtimes/claude/account-usage.js +9 -7
- package/dist/runtimes/claude/account-usage.js.map +1 -1
- package/dist/runtimes/claude/auth-status.d.ts.map +1 -1
- package/dist/runtimes/claude/auth-status.js +6 -1
- package/dist/runtimes/claude/auth-status.js.map +1 -1
- package/dist/runtimes/claude/context-usage.d.ts +8 -4
- package/dist/runtimes/claude/context-usage.d.ts.map +1 -1
- package/dist/runtimes/claude/context-usage.js +24 -4
- package/dist/runtimes/claude/context-usage.js.map +1 -1
- package/dist/runtimes/claude/credentials.d.ts +4 -0
- package/dist/runtimes/claude/credentials.d.ts.map +1 -0
- package/dist/runtimes/claude/credentials.js +62 -0
- package/dist/runtimes/claude/credentials.js.map +1 -0
- package/dist/runtimes/claude/failure.d.ts +4 -0
- package/dist/runtimes/claude/failure.d.ts.map +1 -1
- package/dist/runtimes/claude/failure.js +14 -2
- package/dist/runtimes/claude/failure.js.map +1 -1
- package/dist/runtimes/claude/fork-identity.d.ts +2 -2
- package/dist/runtimes/claude/fork-identity.d.ts.map +1 -1
- package/dist/runtimes/claude/fork-identity.js +21 -16
- package/dist/runtimes/claude/fork-identity.js.map +1 -1
- package/dist/runtimes/claude/global-config.d.ts +3 -0
- package/dist/runtimes/claude/global-config.d.ts.map +1 -0
- package/dist/runtimes/claude/global-config.js +36 -0
- package/dist/runtimes/claude/global-config.js.map +1 -0
- package/dist/runtimes/claude/index.d.ts +9 -1
- package/dist/runtimes/claude/index.d.ts.map +1 -1
- package/dist/runtimes/claude/index.js +5 -2
- package/dist/runtimes/claude/index.js.map +1 -1
- package/dist/runtimes/claude/last-account.d.ts +4 -0
- package/dist/runtimes/claude/last-account.d.ts.map +1 -0
- package/dist/runtimes/claude/last-account.js +15 -0
- package/dist/runtimes/claude/last-account.js.map +1 -0
- package/dist/runtimes/claude/launch-args.d.ts.map +1 -1
- package/dist/runtimes/claude/launch-args.js +16 -8
- package/dist/runtimes/claude/launch-args.js.map +1 -1
- package/dist/runtimes/claude/launch.js +3 -3
- package/dist/runtimes/claude/launch.js.map +1 -1
- package/dist/runtimes/claude/limit-reset/driver.d.ts.map +1 -1
- package/dist/runtimes/claude/limit-reset/driver.js +6 -34
- package/dist/runtimes/claude/limit-reset/driver.js.map +1 -1
- package/dist/runtimes/claude/open-settings.d.ts +2 -2
- package/dist/runtimes/claude/open-settings.d.ts.map +1 -1
- package/dist/runtimes/claude/open-settings.js +13 -6
- package/dist/runtimes/claude/open-settings.js.map +1 -1
- package/dist/runtimes/claude/projection.d.ts +2 -1
- package/dist/runtimes/claude/projection.d.ts.map +1 -1
- package/dist/runtimes/claude/projection.js +45 -14
- package/dist/runtimes/claude/projection.js.map +1 -1
- package/dist/runtimes/claude/session.d.ts.map +1 -1
- package/dist/runtimes/claude/session.js +4 -3
- package/dist/runtimes/claude/session.js.map +1 -1
- package/dist/runtimes/claude/update.d.ts.map +1 -1
- package/dist/runtimes/claude/update.js +8 -0
- package/dist/runtimes/claude/update.js.map +1 -1
- package/dist/runtimes/claude/user-configuration.d.ts.map +1 -1
- package/dist/runtimes/claude/user-configuration.js +13 -6
- package/dist/runtimes/claude/user-configuration.js.map +1 -1
- package/dist/runtimes/codebuddy/failure.d.ts.map +1 -1
- package/dist/runtimes/codebuddy/failure.js +4 -0
- package/dist/runtimes/codebuddy/failure.js.map +1 -1
- package/dist/runtimes/codebuddy/index.d.ts +8 -1
- package/dist/runtimes/codebuddy/index.d.ts.map +1 -1
- package/dist/runtimes/codebuddy/index.js +3 -2
- package/dist/runtimes/codebuddy/index.js.map +1 -1
- package/dist/runtimes/codebuddy/options.d.ts.map +1 -1
- package/dist/runtimes/codebuddy/options.js +8 -9
- package/dist/runtimes/codebuddy/options.js.map +1 -1
- package/dist/runtimes/codex/app-server-client.d.ts.map +1 -1
- package/dist/runtimes/codex/app-server-client.js +2 -1
- package/dist/runtimes/codex/app-server-client.js.map +1 -1
- package/dist/runtimes/codex/index.d.ts +9 -2
- package/dist/runtimes/codex/index.d.ts.map +1 -1
- package/dist/runtimes/codex/index.js +7 -2
- package/dist/runtimes/codex/index.js.map +1 -1
- package/dist/runtimes/cursor/access.d.ts +4 -3
- package/dist/runtimes/cursor/access.d.ts.map +1 -1
- package/dist/runtimes/cursor/access.js +12 -8
- package/dist/runtimes/cursor/access.js.map +1 -1
- package/dist/runtimes/cursor/auth-status.js +1 -1
- package/dist/runtimes/cursor/auth-status.js.map +1 -1
- package/dist/runtimes/cursor/index.d.ts.map +1 -1
- package/dist/runtimes/cursor/index.js +1 -2
- package/dist/runtimes/cursor/index.js.map +1 -1
- package/dist/runtimes/cursor/list-models.js +1 -1
- package/dist/runtimes/cursor/list-models.js.map +1 -1
- package/dist/runtimes/cursor/login.js +1 -1
- package/dist/runtimes/cursor/login.js.map +1 -1
- package/dist/runtimes/cursor/logout.js +1 -1
- package/dist/runtimes/cursor/logout.js.map +1 -1
- package/dist/runtimes/cursor/model.d.ts.map +1 -1
- package/dist/runtimes/cursor/model.js +3 -1
- package/dist/runtimes/cursor/model.js.map +1 -1
- package/dist/runtimes/cursor/session.d.ts.map +1 -1
- package/dist/runtimes/cursor/session.js +5 -4
- package/dist/runtimes/cursor/session.js.map +1 -1
- package/dist/runtimes/cursor/subprocess/channel.d.ts +1 -1
- package/dist/runtimes/cursor/subprocess/channel.d.ts.map +1 -1
- package/dist/runtimes/cursor/subprocess/channel.js +7 -7
- package/dist/runtimes/cursor/subprocess/channel.js.map +1 -1
- package/dist/runtimes/devin/index.d.ts +3 -1
- package/dist/runtimes/devin/index.d.ts.map +1 -1
- package/dist/runtimes/dsh/bridge-controls.d.ts +3 -0
- package/dist/runtimes/dsh/bridge-controls.d.ts.map +1 -0
- package/dist/runtimes/dsh/bridge-controls.js +67 -0
- package/dist/runtimes/dsh/bridge-controls.js.map +1 -0
- package/dist/runtimes/dsh/bridge-goal.d.ts.map +1 -1
- package/dist/runtimes/dsh/bridge-goal.js +9 -5
- package/dist/runtimes/dsh/bridge-goal.js.map +1 -1
- package/dist/runtimes/dsh/bridge-input.d.ts +3 -0
- package/dist/runtimes/dsh/bridge-input.d.ts.map +1 -0
- package/dist/runtimes/dsh/bridge-input.js +77 -0
- package/dist/runtimes/dsh/bridge-input.js.map +1 -0
- package/dist/runtimes/dsh/bridge.d.ts.map +1 -1
- package/dist/runtimes/dsh/bridge.js +30 -55
- package/dist/runtimes/dsh/bridge.js.map +1 -1
- package/dist/runtimes/dsh/compaction.d.ts +5 -0
- package/dist/runtimes/dsh/compaction.d.ts.map +1 -0
- package/dist/runtimes/dsh/compaction.js +73 -0
- package/dist/runtimes/dsh/compaction.js.map +1 -0
- package/dist/runtimes/dsh/control.d.ts +2 -2
- package/dist/runtimes/dsh/control.d.ts.map +1 -1
- package/dist/runtimes/dsh/control.js +7 -5
- package/dist/runtimes/dsh/control.js.map +1 -1
- package/dist/runtimes/dsh/index.d.ts +43 -3
- package/dist/runtimes/dsh/index.d.ts.map +1 -1
- package/dist/runtimes/dsh/index.js +13 -2
- package/dist/runtimes/dsh/index.js.map +1 -1
- package/dist/runtimes/dsh/jobs.d.ts +3 -1
- package/dist/runtimes/dsh/jobs.d.ts.map +1 -1
- package/dist/runtimes/dsh/jobs.js +20 -1
- package/dist/runtimes/dsh/jobs.js.map +1 -1
- package/dist/runtimes/dsh/launch.d.ts +0 -2
- package/dist/runtimes/dsh/launch.d.ts.map +1 -1
- package/dist/runtimes/dsh/launch.js +1 -6
- package/dist/runtimes/dsh/launch.js.map +1 -1
- package/dist/runtimes/dsh/options.d.ts +2 -0
- package/dist/runtimes/dsh/options.d.ts.map +1 -1
- package/dist/runtimes/dsh/options.js +11 -1
- package/dist/runtimes/dsh/options.js.map +1 -1
- package/dist/runtimes/dsh/projection.d.ts.map +1 -1
- package/dist/runtimes/dsh/projection.js +7 -2
- package/dist/runtimes/dsh/projection.js.map +1 -1
- package/dist/runtimes/dsh/session.d.ts.map +1 -1
- package/dist/runtimes/dsh/session.js +38 -12
- package/dist/runtimes/dsh/session.js.map +1 -1
- package/dist/runtimes/dsh/version.d.ts +1 -2
- package/dist/runtimes/dsh/version.d.ts.map +1 -1
- package/dist/runtimes/dsh/version.js +3 -46
- package/dist/runtimes/dsh/version.js.map +1 -1
- package/dist/runtimes/factory/account-credential.d.ts +2 -1
- package/dist/runtimes/factory/account-credential.d.ts.map +1 -1
- package/dist/runtimes/factory/account-credential.js +5 -2
- package/dist/runtimes/factory/account-credential.js.map +1 -1
- package/dist/runtimes/factory/account-usage.d.ts.map +1 -1
- package/dist/runtimes/factory/account-usage.js +4 -2
- package/dist/runtimes/factory/account-usage.js.map +1 -1
- package/dist/runtimes/factory/client.d.ts.map +1 -1
- package/dist/runtimes/factory/client.js +2 -1
- package/dist/runtimes/factory/client.js.map +1 -1
- package/dist/runtimes/factory/compaction.d.ts +1 -1
- package/dist/runtimes/factory/compaction.d.ts.map +1 -1
- package/dist/runtimes/factory/compaction.js +35 -51
- package/dist/runtimes/factory/compaction.js.map +1 -1
- package/dist/runtimes/factory/context-usage.d.ts +15 -0
- package/dist/runtimes/factory/context-usage.d.ts.map +1 -0
- package/dist/runtimes/factory/context-usage.js +75 -0
- package/dist/runtimes/factory/context-usage.js.map +1 -0
- package/dist/runtimes/factory/index.d.ts +8 -1
- package/dist/runtimes/factory/index.d.ts.map +1 -1
- package/dist/runtimes/factory/index.js +2 -1
- package/dist/runtimes/factory/index.js.map +1 -1
- package/dist/runtimes/factory/options.d.ts.map +1 -1
- package/dist/runtimes/factory/options.js +3 -8
- package/dist/runtimes/factory/options.js.map +1 -1
- package/dist/runtimes/factory/session-state.d.ts +2 -0
- package/dist/runtimes/factory/session-state.d.ts.map +1 -1
- package/dist/runtimes/factory/session-state.js.map +1 -1
- package/dist/runtimes/factory/session.d.ts.map +1 -1
- package/dist/runtimes/factory/session.js +76 -45
- package/dist/runtimes/factory/session.js.map +1 -1
- package/dist/runtimes/grok/account-info.d.ts +11 -0
- package/dist/runtimes/grok/account-info.d.ts.map +1 -0
- package/dist/runtimes/grok/account-info.js +60 -0
- package/dist/runtimes/grok/account-info.js.map +1 -0
- package/dist/runtimes/grok/account-usage.d.ts +0 -2
- package/dist/runtimes/grok/account-usage.d.ts.map +1 -1
- package/dist/runtimes/grok/account-usage.js +30 -48
- package/dist/runtimes/grok/account-usage.js.map +1 -1
- package/dist/runtimes/grok/auth.d.ts.map +1 -1
- package/dist/runtimes/grok/auth.js +9 -2
- package/dist/runtimes/grok/auth.js.map +1 -1
- package/dist/runtimes/grok/failure.d.ts.map +1 -1
- package/dist/runtimes/grok/failure.js +4 -2
- package/dist/runtimes/grok/failure.js.map +1 -1
- package/dist/runtimes/grok/index.d.ts +8 -1
- package/dist/runtimes/grok/index.d.ts.map +1 -1
- package/dist/runtimes/grok/index.js +3 -2
- package/dist/runtimes/grok/index.js.map +1 -1
- package/dist/runtimes/kimi/index.d.ts +8 -1
- package/dist/runtimes/kimi/index.d.ts.map +1 -1
- package/dist/runtimes/kimi/index.js +3 -2
- package/dist/runtimes/kimi/index.js.map +1 -1
- package/dist/runtimes/opencode/index.d.ts +7 -6
- package/dist/runtimes/opencode/index.d.ts.map +1 -1
- package/dist/runtimes/opencode/index.js +6 -5
- package/dist/runtimes/opencode/index.js.map +1 -1
- package/dist/runtimes/opencode/options.d.ts +5 -1
- package/dist/runtimes/opencode/options.d.ts.map +1 -1
- package/dist/runtimes/opencode/options.js +24 -1
- package/dist/runtimes/opencode/options.js.map +1 -1
- package/dist/runtimes/opencode/prompt-config-v2.d.ts +15 -0
- package/dist/runtimes/opencode/prompt-config-v2.d.ts.map +1 -0
- package/dist/runtimes/opencode/prompt-config-v2.js +75 -0
- package/dist/runtimes/opencode/prompt-config-v2.js.map +1 -0
- package/dist/runtimes/opencode/prompt-config.d.ts +12 -0
- package/dist/runtimes/opencode/prompt-config.d.ts.map +1 -1
- package/dist/runtimes/opencode/prompt-config.js +32 -19
- package/dist/runtimes/opencode/prompt-config.js.map +1 -1
- package/dist/runtimes/opencode/retry.d.ts +5 -0
- package/dist/runtimes/opencode/retry.d.ts.map +1 -0
- package/dist/runtimes/opencode/retry.js +20 -0
- package/dist/runtimes/opencode/retry.js.map +1 -0
- package/dist/runtimes/opencode/session.d.ts +1 -0
- package/dist/runtimes/opencode/session.d.ts.map +1 -1
- package/dist/runtimes/opencode/session.js +31 -8
- package/dist/runtimes/opencode/session.js.map +1 -1
- package/dist/runtimes/opencode/shared-session.d.ts.map +1 -1
- package/dist/runtimes/opencode/shared-session.js +7 -2
- package/dist/runtimes/opencode/shared-session.js.map +1 -1
- package/dist/runtimes/opencode/token-usage.d.ts +5 -0
- package/dist/runtimes/opencode/token-usage.d.ts.map +1 -0
- package/dist/runtimes/opencode/token-usage.js +31 -0
- package/dist/runtimes/opencode/token-usage.js.map +1 -0
- package/dist/runtimes/opencode/upgrade.d.ts +4 -0
- package/dist/runtimes/opencode/upgrade.d.ts.map +1 -0
- package/dist/runtimes/opencode/upgrade.js +21 -0
- package/dist/runtimes/opencode/upgrade.js.map +1 -0
- package/dist/runtimes/opencode/version.d.ts +5 -0
- package/dist/runtimes/opencode/version.d.ts.map +1 -1
- package/dist/runtimes/opencode/version.js +14 -1
- package/dist/runtimes/opencode/version.js.map +1 -1
- package/dist/runtimes/pi/index.d.ts.map +1 -1
- package/dist/runtimes/pi/index.js +3 -2
- package/dist/runtimes/pi/index.js.map +1 -1
- package/dist/runtimes/pi/input-disposition.d.ts +1 -1
- package/dist/runtimes/pi/input-disposition.d.ts.map +1 -1
- package/dist/runtimes/pi/inventory.d.ts.map +1 -1
- package/dist/runtimes/pi/inventory.js +5 -2
- package/dist/runtimes/pi/inventory.js.map +1 -1
- package/dist/runtimes/pi/projection.d.ts.map +1 -1
- package/dist/runtimes/pi/projection.js +5 -1
- package/dist/runtimes/pi/projection.js.map +1 -1
- package/dist/runtimes/pi/rpc/control.d.ts +1 -1
- package/dist/runtimes/pi/rpc/control.d.ts.map +1 -1
- package/dist/runtimes/pi/rpc/control.js +5 -3
- package/dist/runtimes/pi/rpc/control.js.map +1 -1
- package/dist/runtimes/pi/rpc/open.d.ts.map +1 -1
- package/dist/runtimes/pi/rpc/open.js +4 -2
- package/dist/runtimes/pi/rpc/open.js.map +1 -1
- package/dist/runtimes/pi/rpc/session.js +4 -4
- package/dist/runtimes/pi/rpc/session.js.map +1 -1
- package/dist/runtimes/pi/session.js +4 -4
- package/dist/runtimes/pi/session.js.map +1 -1
- package/dist/runtimes/pi-durable/index.d.ts.map +1 -1
- package/dist/runtimes/pi-durable/index.js +3 -2
- package/dist/runtimes/pi-durable/index.js.map +1 -1
- package/dist/runtimes/pi-durable/session.d.ts.map +1 -1
- package/dist/runtimes/pi-durable/session.js +53 -12
- package/dist/runtimes/pi-durable/session.js.map +1 -1
- package/dist/runtimes/qoder/daemon.d.ts +2 -1
- package/dist/runtimes/qoder/daemon.d.ts.map +1 -1
- package/dist/runtimes/qoder/daemon.js +12 -6
- package/dist/runtimes/qoder/daemon.js.map +1 -1
- package/dist/runtimes/qoder/index.d.ts +8 -1
- package/dist/runtimes/qoder/index.d.ts.map +1 -1
- package/dist/runtimes/qoder/index.js +2 -1
- package/dist/runtimes/qoder/index.js.map +1 -1
- package/dist/runtimes/qoder/launch.d.ts +2 -1
- package/dist/runtimes/qoder/launch.d.ts.map +1 -1
- package/dist/runtimes/qoder/launch.js +8 -4
- package/dist/runtimes/qoder/launch.js.map +1 -1
- package/dist/runtimes/qoder/list-models.d.ts.map +1 -1
- package/dist/runtimes/qoder/list-models.js +20 -13
- package/dist/runtimes/qoder/list-models.js.map +1 -1
- package/dist/runtimes/qoder/options.d.ts.map +1 -1
- package/dist/runtimes/qoder/options.js +13 -10
- package/dist/runtimes/qoder/options.js.map +1 -1
- package/dist/runtimes/qoder/projection.d.ts.map +1 -1
- package/dist/runtimes/qoder/projection.js +2 -1
- package/dist/runtimes/qoder/projection.js.map +1 -1
- package/dist/runtimes/qoder/protocol.d.ts +3 -1
- package/dist/runtimes/qoder/protocol.d.ts.map +1 -1
- package/dist/runtimes/qoder/protocol.js +6 -4
- package/dist/runtimes/qoder/protocol.js.map +1 -1
- package/dist/runtimes/qoder/session.js +1 -1
- package/dist/runtimes/qoder/session.js.map +1 -1
- package/dist/runtimes/qwen/index.d.ts +9 -2
- package/dist/runtimes/qwen/index.d.ts.map +1 -1
- package/dist/runtimes/qwen/index.js +7 -2
- package/dist/runtimes/qwen/index.js.map +1 -1
- package/dist/runtimes/qwen/launch.js +1 -1
- package/dist/runtimes/qwen/launch.js.map +1 -1
- package/dist/runtimes/qwen/options.d.ts.map +1 -1
- package/dist/runtimes/qwen/options.js +11 -17
- package/dist/runtimes/qwen/options.js.map +1 -1
- package/dist/shared/acp/errors.d.ts.map +1 -1
- package/dist/shared/acp/errors.js +2 -1
- package/dist/shared/acp/errors.js.map +1 -1
- package/dist/shared/acp/profile.d.ts +5 -3
- package/dist/shared/acp/profile.d.ts.map +1 -1
- package/dist/shared/acp/profile.js +34 -17
- package/dist/shared/acp/profile.js.map +1 -1
- package/dist/shared/acp/projection.js +7 -3
- package/dist/shared/acp/projection.js.map +1 -1
- package/dist/shared/acp/records.js +9 -9
- package/dist/shared/acp/records.js.map +1 -1
- package/dist/shared/acp/session.d.ts +3 -2
- package/dist/shared/acp/session.d.ts.map +1 -1
- package/dist/shared/acp/session.js +95 -52
- package/dist/shared/acp/session.js.map +1 -1
- package/dist/shared/acp/shared-session.d.ts.map +1 -1
- package/dist/shared/acp/shared-session.js +8 -2
- package/dist/shared/acp/shared-session.js.map +1 -1
- package/dist/shared/acp/token-usage.d.ts +1 -1
- package/dist/shared/acp/token-usage.d.ts.map +1 -1
- package/dist/shared/acp/token-usage.js +2 -2
- package/dist/shared/acp/token-usage.js.map +1 -1
- package/dist/shared/acp/turn-terminals.d.ts.map +1 -1
- package/dist/shared/acp/turn-terminals.js +59 -48
- package/dist/shared/acp/turn-terminals.js.map +1 -1
- package/dist/shared/acp/turns.d.ts +1 -1
- package/dist/shared/acp/turns.d.ts.map +1 -1
- package/dist/shared/acp/turns.js +11 -7
- package/dist/shared/acp/turns.js.map +1 -1
- package/dist/shared/credential-redactor.d.ts +8 -0
- package/dist/shared/credential-redactor.d.ts.map +1 -1
- package/dist/shared/credential-redactor.js +22 -0
- package/dist/shared/credential-redactor.js.map +1 -1
- package/dist/shared/executable/diagnostics.d.ts +6 -0
- package/dist/shared/executable/diagnostics.d.ts.map +1 -1
- package/dist/shared/executable/diagnostics.js +9 -0
- package/dist/shared/executable/diagnostics.js.map +1 -1
- package/dist/shared/executable/node-script.d.ts +1 -0
- package/dist/shared/executable/node-script.d.ts.map +1 -1
- package/dist/shared/executable/node-script.js +1 -1
- package/dist/shared/executable/node-script.js.map +1 -1
- package/dist/shared/executable/process.js +1 -1
- package/dist/shared/executable/process.js.map +1 -1
- package/dist/shared/executable/reported-stderr.d.ts +10 -0
- package/dist/shared/executable/reported-stderr.d.ts.map +1 -0
- package/dist/shared/executable/reported-stderr.js +28 -0
- package/dist/shared/executable/reported-stderr.js.map +1 -0
- package/dist/shared/held-input.d.ts +9 -0
- package/dist/shared/held-input.d.ts.map +1 -1
- package/dist/shared/held-input.js +8 -0
- package/dist/shared/held-input.js.map +1 -1
- package/dist/shared/launch-args.d.ts +7 -0
- package/dist/shared/launch-args.d.ts.map +1 -0
- package/dist/shared/launch-args.js +25 -0
- package/dist/shared/launch-args.js.map +1 -0
- package/dist/shared/orientation/index.d.ts.map +1 -1
- package/dist/shared/orientation/index.js +7 -2
- package/dist/shared/orientation/index.js.map +1 -1
- package/dist/shared/process-session.d.ts +3 -2
- package/dist/shared/process-session.d.ts.map +1 -1
- package/dist/shared/process-session.js +13 -11
- package/dist/shared/process-session.js.map +1 -1
- package/dist/shared/seal-session.d.ts.map +1 -1
- package/dist/shared/seal-session.js +2 -1
- package/dist/shared/seal-session.js.map +1 -1
- package/dist/shared/semver.d.ts +12 -0
- package/dist/shared/semver.d.ts.map +1 -0
- package/dist/shared/semver.js +52 -0
- package/dist/shared/semver.js.map +1 -0
- package/dist/shared/session-options.d.ts +6 -0
- package/dist/shared/session-options.d.ts.map +1 -1
- package/dist/shared/session-options.js +22 -4
- package/dist/shared/session-options.js.map +1 -1
- package/dist/shared/stream-json/profile.d.ts +5 -1
- package/dist/shared/stream-json/profile.d.ts.map +1 -1
- package/dist/shared/stream-json/projection.d.ts.map +1 -1
- package/dist/shared/stream-json/projection.js +34 -3
- package/dist/shared/stream-json/projection.js.map +1 -1
- package/dist/shared/stream-json/session.d.ts.map +1 -1
- package/dist/shared/stream-json/session.js +12 -5
- package/dist/shared/stream-json/session.js.map +1 -1
- package/dist/shared/stream-json/state.d.ts +2 -0
- package/dist/shared/stream-json/state.d.ts.map +1 -1
- package/dist/shared/stream-json/state.js +1 -0
- package/dist/shared/stream-json/state.js.map +1 -1
- package/dist/shared/update.d.ts +2 -0
- package/dist/shared/update.d.ts.map +1 -1
- package/dist/shared/update.js +6 -2
- package/dist/shared/update.js.map +1 -1
- package/dist/shared/user-configuration.d.ts +5 -0
- package/dist/shared/user-configuration.d.ts.map +1 -0
- package/dist/shared/user-configuration.js +19 -0
- package/dist/shared/user-configuration.js.map +1 -0
- package/dist/testing/scripted-runtime.d.ts.map +1 -1
- package/dist/testing/scripted-runtime.js +3 -2
- package/dist/testing/scripted-runtime.js.map +1 -1
- package/package.json +5 -1
|
@@ -5,66 +5,50 @@ import { asNumber, asRecord } from "../../shared/json.js";
|
|
|
5
5
|
* current id), reports `session_compacted` and then answers `{ newSessionId,
|
|
6
6
|
* removedCount }`. During a turn it refuses with -32602 "Wait for the current
|
|
7
7
|
* turn to finish before compacting."; on an empty conversation with -32602
|
|
8
|
-
* "Nothing to compact".
|
|
9
|
-
* `session_compacted` seen while it is pending belongs to it.
|
|
8
|
+
* "Nothing to compact". Only the identified RPC answer belongs to the request.
|
|
10
9
|
*/
|
|
11
|
-
export function factoryCompaction(kernel, client, sessionId
|
|
10
|
+
export function factoryCompaction(kernel, client, sessionId) {
|
|
12
11
|
let requestId = null;
|
|
13
|
-
let compacted = null;
|
|
14
12
|
return {
|
|
15
13
|
async start(request, reply) {
|
|
16
14
|
requestId = request.id;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// The answer line, whole, is recorded where it sat on the wire; its frame settles the operation (observe below).
|
|
21
|
-
const answer = client.request("droid.compact_session", {}, (outcome) => {
|
|
22
|
-
if (outcome.kind === "exited") {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
client.mark(() => {
|
|
26
|
-
recorded.frame = kernel.frame({ type: outcome.kind === "result" ? "droid.compact_session" : "droid.compact_session/error", native: outcome.native, responseTo: request.id, events: [] });
|
|
27
|
-
});
|
|
28
|
-
}, request.id);
|
|
29
|
-
reply({ kind: "accepted" });
|
|
30
|
-
await answer;
|
|
31
|
-
return (recorded.frame === null ? null : settle(recorded.frame)) ?? { kind: "unconfirmed", code: "observation_failed", reason: "droid's compact_session answer was not recorded" };
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
const refusal = asRecord(asRecord(recorded.frame?.body.native)?.error);
|
|
35
|
-
if (refusal === null || kernel.unreachable() !== null) {
|
|
36
|
-
throw error;
|
|
15
|
+
const answer = client.request("droid.compact_session", {}, (outcome) => {
|
|
16
|
+
if (outcome.kind === "exited") {
|
|
17
|
+
return;
|
|
37
18
|
}
|
|
38
|
-
|
|
19
|
+
client.mark(() => {
|
|
20
|
+
kernel.frame({ type: outcome.kind === "result" ? "droid.compact_session" : "droid.compact_session/error",
|
|
21
|
+
native: outcome.native, responseTo: request.id, events: [] });
|
|
22
|
+
});
|
|
23
|
+
}, request.id);
|
|
24
|
+
reply({ kind: "accepted" });
|
|
25
|
+
await answer;
|
|
26
|
+
},
|
|
27
|
+
observe(frame) {
|
|
28
|
+
if (requestId === null || frame.body.responseTo !== requestId) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const native = asRecord(frame.body.native);
|
|
32
|
+
if (frame.body.type === "droid.compact_session/error") {
|
|
33
|
+
const message = asRecord(native?.error)?.message;
|
|
34
|
+
return { kind: "rejected", code: "runtime_refused", reason: typeof message === "string" ? message : "droid refused compact_session" };
|
|
35
|
+
}
|
|
36
|
+
if (frame.body.type !== "droid.compact_session") {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const answer = asRecord(native?.result);
|
|
40
|
+
const removed = asNumber(answer?.removedCount);
|
|
41
|
+
if (typeof answer?.newSessionId === "string" && answer.newSessionId !== sessionId) {
|
|
42
|
+
return { kind: "failed", code: "native_failed", reason: "droid moved the conversation to another session", frame };
|
|
43
|
+
}
|
|
44
|
+
if (removed === 0) {
|
|
45
|
+
return { kind: "failed", code: "not_compacted", reason: "droid removed no messages", frame };
|
|
39
46
|
}
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
if (answer?.newSessionId === sessionId && removed !== null && Number.isSafeInteger(removed) && removed > 0) {
|
|
48
|
+
return { kind: "completed", frame };
|
|
42
49
|
}
|
|
50
|
+
return { kind: "unconfirmed", code: "observation_failed", reason: "droid's answer did not confirm removal in this session" };
|
|
43
51
|
},
|
|
44
|
-
observe: (frame) => settle(frame),
|
|
45
52
|
};
|
|
46
|
-
function settle(frame) {
|
|
47
|
-
if (requestId === null) {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
const ended = frame.body.events.find(event => event.kind === "compaction_ended");
|
|
51
|
-
if (ended?.kind === "compaction_ended" && ended.requestId === requestId) {
|
|
52
|
-
compacted = frame;
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
if (frame.body.type !== "droid.compact_session" || frame.body.responseTo !== requestId) {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
const answer = asRecord(asRecord(frame.body.native)?.result);
|
|
59
|
-
if (typeof answer?.newSessionId === "string" && answer.newSessionId !== sessionId) {
|
|
60
|
-
return { kind: "failed", code: "native_failed", reason: `droid moved the conversation to session ${answer.newSessionId}; this session's id no longer names it`, frame };
|
|
61
|
-
}
|
|
62
|
-
if (compacted !== null) {
|
|
63
|
-
return { kind: "completed", frame: compacted };
|
|
64
|
-
}
|
|
65
|
-
return asNumber(answer?.removedCount) === 0
|
|
66
|
-
? { kind: "failed", code: "not_compacted", reason: "droid removed no messages", frame }
|
|
67
|
-
: { kind: "unconfirmed", code: "observation_failed", reason: "droid answered compact_session without reporting session_compacted" };
|
|
68
|
-
}
|
|
69
53
|
}
|
|
70
54
|
//# sourceMappingURL=compaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compaction.js","sources":["../../../src/runtimes/factory/compaction.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG1D
|
|
1
|
+
{"version":3,"file":"compaction.js","sources":["../../../src/runtimes/factory/compaction.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG1D;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAqB,EAAE,MAAmB,EAAE,SAAiB;IAC7F,IAAI,SAAS,GAAkB,IAA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AK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,+BAA+B,EAAE,CAAC;YACxI,CAAC;YACD,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,uBAAuB,EAAE,CAAC;gBAAC,OAAO,IAAI,CAAC;YAAC,CAAC;YACjE,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACxC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;YAC/C,IAAI,OAAO,MAAM,EAAE,YAAY,KAAK,QAAQ,IAAI,MAAM,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;gBAClF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,iDAAiD,EAAE,KAAK,EAAE,CAAC;YACrH,CAAC;YACD,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;gBAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,2BAA2B,EAAE,KAAK,EAAE,CAAC;YAAC,CAAC;YACpH,IAAI,MAAM,EAAE,YAAY,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,IAAI,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;gBAAC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;YAAC,CAAC;YACpJ,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,EAAE,wDAAwD,EAAE,CAAC;QAC/H,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RuntimeEventBody } from "../../contracts/session.js";
|
|
2
|
+
import type { JsonRecord } from "../../shared/json.js";
|
|
3
|
+
import type { DroidClient, DroidOutcome } from "./client.js";
|
|
4
|
+
/** Default bound for post-turn `droid.get_context_stats` before emitting `turn_ended`. */
|
|
5
|
+
export declare const FACTORY_CONTEXT_TIMEOUT_MS = 1000;
|
|
6
|
+
export interface FactoryContextReadback {
|
|
7
|
+
/** Fire-and-forget read (used at open); a stale reply never overwrites a newer readback. */
|
|
8
|
+
readBackground(): void;
|
|
9
|
+
/** Bounded read awaited before emitting a completed turn's `turn_ended`; timeout keeps the previous value. */
|
|
10
|
+
readBounded(): Promise<void>;
|
|
11
|
+
/** Cancel any active bounded wait immediately (on abort, dispose, or process exit). */
|
|
12
|
+
end(): void;
|
|
13
|
+
}
|
|
14
|
+
export declare function factoryContextReadback(client: Pick<DroidClient, "request">, recordReply: (type: string, events: (result: JsonRecord) => readonly RuntimeEventBody[]) => (outcome: DroidOutcome) => void, unreachable: () => unknown, timeoutMs?: number): FactoryContextReadback;
|
|
15
|
+
//# sourceMappingURL=context-usage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-usage.d.ts","sources":["../../../src/runtimes/factory/context-usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG7D,0FAA0F;AAC1F,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,MAAM,WAAW,sBAAsB;IACrC,4FAA4F;IAC5F,cAAc,IAAI,IAAI,CAAC;IACvB,8GAA8G;IAC9G,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,uFAAuF;IACvF,GAAG,IAAI,IAAI,CAAC;CACb;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,EACpC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,SAAS,gBAAgB,EAAE,KAAK,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,EAC3H,WAAW,EAAE,MAAM,OAAO,EAC1B,SAAS,GAAE,MAAmC,GAC7C,sBAAsB,CAuDxB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { contextOf } from "./open.js";
|
|
2
|
+
/** Default bound for post-turn `droid.get_context_stats` before emitting `turn_ended`. */
|
|
3
|
+
export const FACTORY_CONTEXT_TIMEOUT_MS = 1000;
|
|
4
|
+
export function factoryContextReadback(client, recordReply, unreachable, timeoutMs = FACTORY_CONTEXT_TIMEOUT_MS) {
|
|
5
|
+
let generation = 0;
|
|
6
|
+
let cancelActive = null;
|
|
7
|
+
return {
|
|
8
|
+
readBackground() {
|
|
9
|
+
if (unreachable() !== null) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const mine = ++generation;
|
|
13
|
+
void (async () => {
|
|
14
|
+
try {
|
|
15
|
+
await client.request("droid.get_context_stats", {}, recordReply("droid.get_context_stats", (result) => {
|
|
16
|
+
if (mine !== generation) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
const context = contextOf(result);
|
|
20
|
+
return context === null ? [] : [{ kind: "usage", usage: { context } }];
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
catch { /* Its reply, an error included, is already a frame; an exit is the exited response. */ }
|
|
24
|
+
})();
|
|
25
|
+
},
|
|
26
|
+
async readBounded() {
|
|
27
|
+
if (unreachable() !== null) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const mine = ++generation;
|
|
31
|
+
let settled = false;
|
|
32
|
+
let expired = false;
|
|
33
|
+
const { promise, resolve } = Promise.withResolvers();
|
|
34
|
+
const done = () => {
|
|
35
|
+
if (settled) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
settled = true;
|
|
39
|
+
clearTimeout(timer);
|
|
40
|
+
if (cancelActive === cancel) {
|
|
41
|
+
cancelActive = null;
|
|
42
|
+
}
|
|
43
|
+
resolve();
|
|
44
|
+
};
|
|
45
|
+
const cancel = () => { expired = true; done(); };
|
|
46
|
+
const timer = setTimeout(cancel, timeoutMs);
|
|
47
|
+
cancelActive = cancel;
|
|
48
|
+
const onReply = recordReply("droid.get_context_stats", (result) => {
|
|
49
|
+
if (expired || mine !== generation) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
const context = contextOf(result);
|
|
53
|
+
return context === null ? [] : [{ kind: "usage", usage: { context } }];
|
|
54
|
+
});
|
|
55
|
+
void (async () => {
|
|
56
|
+
try {
|
|
57
|
+
await client.request("droid.get_context_stats", {}, (outcome) => {
|
|
58
|
+
onReply(outcome);
|
|
59
|
+
done();
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
done();
|
|
64
|
+
}
|
|
65
|
+
})();
|
|
66
|
+
await promise;
|
|
67
|
+
},
|
|
68
|
+
end() {
|
|
69
|
+
const cancel = cancelActive;
|
|
70
|
+
cancelActive = null;
|
|
71
|
+
cancel?.();
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=context-usage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-usage.js","sources":["../../../src/runtimes/factory/context-usage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,0FAA0F;AAC1F,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAW/C,MAAM,UAAU,sBAAsB,CACpC,MAAoC,EACpC,WAA2H,EAC3H,WAA0B,EAC1B,SAAS,GAAW,0BAA0B;IAE9C,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,YAAY,GAAwB,IAAI,CAAC;IAE7C,OAAO;QACL,cAAc;YACZ,IAAI,WAAW,EAAE,KAAK,IAAI,EAAE,CA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: true;
|
|
6
6
|
images: true;
|
|
7
|
+
contextUsage: {
|
|
8
|
+
tokens: true;
|
|
9
|
+
contextWindow: true;
|
|
10
|
+
};
|
|
7
11
|
};
|
|
8
12
|
readonly brand: {
|
|
9
13
|
readonly name: "Factory Droid";
|
|
10
14
|
readonly icon: `data:image/svg+xml,${string}`;
|
|
11
15
|
};
|
|
16
|
+
readonly verifiedPlatforms: readonly ["linux", "darwin"];
|
|
12
17
|
readonly manualCompaction: {
|
|
13
18
|
readonly kind: "supported";
|
|
14
19
|
readonly activeTurn: "reject";
|
|
@@ -28,5 +33,7 @@ export declare const factoryRuntime: Omit<{
|
|
|
28
33
|
readonly listModels: (installation: import("../../browser.js").AvailableInstallation, options?: import("../../browser.js").ListModelsOptions | undefined) => Promise<import("../../browser.js").ListModelsResult>;
|
|
29
34
|
readonly skills: (installation: import("../../browser.js").AvailableInstallation, options?: import("../../browser.js").InventoryOptions | undefined) => Promise<import("../../browser.js").InventoryResult<import("../../browser.js").SkillEntry>>;
|
|
30
35
|
readonly session: (installation: import("../../browser.js").AvailableInstallation, options: import("../../browser.js").SessionOptions, context?: import("../../browser.js").SessionOpenContext | undefined) => Promise<import("../../browser.js").Session>;
|
|
31
|
-
}, "execution" | "placement" | "session" | "withPlacement"> & import("../../contracts/runtime.js").Runtime
|
|
36
|
+
}, "execution" | "placement" | "session" | "sessionCapabilities" | "withPlacement"> & import("../../contracts/runtime.js").Runtime & {
|
|
37
|
+
readonly sessionCapabilities: NonNullable<import("../../contracts/runtime.js").Runtime["sessionCapabilities"]>;
|
|
38
|
+
};
|
|
32
39
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sources":["../../../src/runtimes/factory/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../../../src/runtimes/factory/index.ts"],"names":[],"mappings":"AAQA,4HAA4H;AAC5H,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAeC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { runtimeBrands } from "../../brands.js";
|
|
2
|
+
import { verifiedPlatforms } from "../../platforms.js";
|
|
2
3
|
import { defineRuntime } from "../../contracts/runtime.js";
|
|
3
4
|
import { onFirstCall } from "../../shared/lazy.js";
|
|
4
5
|
import { factoryInstallation } from "./installation.js";
|
|
@@ -7,7 +8,7 @@ import { factoryRefusedSessionOptions } from "./options.js";
|
|
|
7
8
|
/** Factory's droid CLI over its native stream-jsonrpc; sign-in through droid's own ACP entry (docs/runtimes/factory.md). */
|
|
8
9
|
export const factoryRuntime = defineRuntime({
|
|
9
10
|
id: "factory",
|
|
10
|
-
sessionCapabilities: () => ({ steer: true, images: true }), brand: runtimeBrands.factory,
|
|
11
|
+
sessionCapabilities: () => ({ steer: true, images: true, contextUsage: { tokens: true, contextWindow: true } }), brand: runtimeBrands.factory, verifiedPlatforms: verifiedPlatforms.factory,
|
|
11
12
|
manualCompaction: { kind: "supported", activeTurn: "reject" },
|
|
12
13
|
refusedSessionOptions: factoryRefusedSessionOptions,
|
|
13
14
|
installation: factoryInstallation, install: factoryInstall, installPlan: factoryInstallPlan,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/runtimes/factory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAE5D,4HAA4H;AAC5H,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa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CAAC;IACjH,OAAO,EAAE,WAAW,CAAC,KAAK,IAAI,EAAE,GAAG,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;CACtH,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sources":["../../../src/runtimes/factory/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"options.d.ts","sources":["../../../src/runtimes/factory/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAGpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,eAAO,MAAM,4BAA4B,EAAE,qBAU1C,CAAC;AAIF,wFAAwF;AACxF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,IAAI,CAEhF;AAED,gIAAgI;AAChI,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,GAAG,UAAU,EAAE,CAI7E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { checkManagedLaunchArgs } from "../../shared/launch-args.js";
|
|
2
2
|
import { isHttpMcpServer } from "../../shared/mcp-servers.js";
|
|
3
3
|
export const factoryRefusedSessionOptions = {
|
|
4
4
|
fork: "OAR has not verified a native droid fork that opens a copy of a saved session under a new id, cut after a chosen turn",
|
|
@@ -11,15 +11,10 @@ export const factoryRefusedSessionOptions = {
|
|
|
11
11
|
additionalDirectories: "droid has no additional workspace directory option",
|
|
12
12
|
disallowedTools: "droid's tool deny list (disabledToolIds) has not been verified against OAR's tool names",
|
|
13
13
|
};
|
|
14
|
+
const FACTORY_MANAGED_LAUNCH_ARGS = new Set(["--input-format", "--output-format", "-o", "--session-id", "-s", "--fork", "--cwd", "-f", "--file", "--"]);
|
|
14
15
|
/** The protocol and session identity belong to OAR: launchArgs must not change them. */
|
|
15
16
|
export function checkFactoryLaunchArgs(args) {
|
|
16
|
-
|
|
17
|
-
for (const arg of args ?? []) {
|
|
18
|
-
const flag = arg.split("=", 1)[0] ?? arg;
|
|
19
|
-
if (managed.has(flag)) {
|
|
20
|
-
throw new UnsupportedOptionError("launchArgs", `Factory launchArgs cannot override ${flag}; OAR owns the protocol and session identity`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
17
|
+
checkManagedLaunchArgs(args, FACTORY_MANAGED_LAUNCH_ARGS, (flag) => `Factory launchArgs cannot override ${flag}; OAR owns the protocol and session identity`);
|
|
23
18
|
}
|
|
24
19
|
/** OAR's MCP server shape as `initialize_session` / `load_session` take it (stdio `env` is a record, http `headers` a list). */
|
|
25
20
|
export function factoryMcpServers(servers) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sources":["../../../src/runtimes/factory/options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"options.js","sources":["../../../src/runtimes/factory/options.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,MAAM,CAAC,MAAM,4BAA4B,GAA0B;IACjE,IAAI,EAAE,uHAAuH;IAC7H,KAAK,EAAE,mEAAmE;IAC1E,uBAAuB,EAAE,2GAA2G;IACpI,WAAW,EAAE,kCAAkC;IAC/C,YAAY,EAAE,uEAAuE;IACrF,iBAAiB,EAAE,6FAA6F;IAChH,IAAI,EAAE,yDAAyD;IAC/D,qBAAqB,EAAE,oDAAoD;IAC3E,eAAe,EAAE,yFAAyF;CAC3G,CAAC;AAEF,MAAM,2BAA2B,GAAG,IAAI,GAAG,CAAC,CAAC,gBAAgB,EAAE,iBAAiB,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;AAExJ,wFAAwF;AACxF,MAAM,UAAU,sBAAsB,CAAC,IAAmC;IACxE,sBAAsB,CAAC,IAAI,EAAE,2BAA2B,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,sCAAsC,IAAI,8CAA8C,CAAC,CAAC;AAChK,CAAC;AAED,gIAAgI;AAChI,MAAM,UAAU,iBAAiB,CAAC,OAA6B;IAC7D,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAc,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC;QAChE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE;QAC/I,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC9G,CAAC"}
|
|
@@ -5,6 +5,8 @@ import type { JsonRecord } from "../../shared/json.js";
|
|
|
5
5
|
export interface FactorySessionTimings {
|
|
6
6
|
/** How long an accepted abort waits for droid's end of that turn before the process is stopped. */
|
|
7
7
|
readonly abortFallbackMs?: number;
|
|
8
|
+
/** How long a completed turn waits for `droid.get_context_stats` before emitting `turn_ended`. */
|
|
9
|
+
readonly contextReadTimeoutMs?: number;
|
|
8
10
|
}
|
|
9
11
|
export interface Held {
|
|
10
12
|
readonly inputId: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-state.d.ts","sources":["../../../src/runtimes/factory/session-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,2DAA2D;AAC3D,MAAM,WAAW,qBAAqB;IACpC,mGAAmG;IACnG,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"session-state.d.ts","sources":["../../../src/runtimes/factory/session-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,2DAA2D;AAC3D,MAAM,WAAW,qBAAqB;IACpC,mGAAmG;IACnG,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,kGAAkG;IAClG,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACxC;AAED,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,CAAC;IACnD,QAAQ,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,uDAAuD;AACvD,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,GAAG,UAAU,CAEtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-state.js","sources":["../../../src/runtimes/factory/session-state.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session-state.js","sources":["../../../src/runtimes/factory/session-state.ts"],"names":[],"mappings":"AAqBA,uDAAuD;AACvD,MAAM,UAAU,WAAW,CAAC,MAA8B;IACxD,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;AACxI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sources":["../../../src/runtimes/factory/session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuF,YAAY,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sources":["../../../src/runtimes/factory/session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuF,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAiBpJ,OAAO,EAAe,KAAK,qBAAqB,EAAa,MAAM,oBAAoB,CAAC;AAgBxF,eAAO,MAAM,oBAAoB,aAAa,qBAAqB,KAAQ,YAiQzE,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,YAAqC,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { randomUUID } from "node:crypto";
|
|
|
3
3
|
import { createAbortFallback } from "../../shared/abort-fallback.js";
|
|
4
4
|
import { appendCleanupFailure } from "../../shared/executable/process-cleanup.js";
|
|
5
5
|
import { sessionEnvironment } from "../../shared/environment.js";
|
|
6
|
-
import {
|
|
6
|
+
import { enqueueHeld, withdrawControl } from "../../shared/held-input.js";
|
|
7
7
|
import { manualCompaction } from "../../shared/manual-compaction.js";
|
|
8
8
|
import { withInputImages } from "../../shared/input-images.js";
|
|
9
9
|
import { asRecord } from "../../shared/json.js";
|
|
@@ -12,7 +12,8 @@ import { withSessionCredentials } from "../../shared/session-credentials.js";
|
|
|
12
12
|
import { refuseSessionOptions } from "../../shared/session-options.js";
|
|
13
13
|
import { startDroidClient } from "./client.js";
|
|
14
14
|
import { checkFactoryLaunchArgs, factoryRefusedSessionOptions } from "./options.js";
|
|
15
|
-
import {
|
|
15
|
+
import { factoryContextReadback } from "./context-usage.js";
|
|
16
|
+
import { factoryOpenRequest, openFactory, serverReply } from "./open.js";
|
|
16
17
|
import { confirmSettings } from "./settings.js";
|
|
17
18
|
import { factoryCompaction } from "./compaction.js";
|
|
18
19
|
import { droidImages } from "./session-state.js";
|
|
@@ -75,8 +76,6 @@ export const createFactorySession = (timings = {}) => withSessionCredentials(asy
|
|
|
75
76
|
let spontaneousTurn = null;
|
|
76
77
|
/** The turn an accepted abort is waiting on; only its own end (or droid handing its prompt back) disarms the fallback. */
|
|
77
78
|
let abortingTurn = false;
|
|
78
|
-
/** The OAR compact request whose `droid.compact_session` is pending: droid's `session_compacted` meanwhile is its completion. */
|
|
79
|
-
let compactRequestId = null;
|
|
80
79
|
let settingsWaiter = null;
|
|
81
80
|
const held = [];
|
|
82
81
|
let dispatching = false;
|
|
@@ -91,31 +90,17 @@ export const createFactorySession = (timings = {}) => withSessionCredentials(asy
|
|
|
91
90
|
}
|
|
92
91
|
client.mark(() => { kernel.frame({ type, native: outcome.native, events: outcome.kind === "result" ? events(outcome.result) : [], ...(responseTo === undefined ? {} : { responseTo }) }); });
|
|
93
92
|
};
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
void (async () => {
|
|
99
|
-
try {
|
|
100
|
-
await client.request("droid.get_context_stats", {}, recordReply("droid.get_context_stats", (result) => {
|
|
101
|
-
const context = contextOf(result);
|
|
102
|
-
return context === null ? [] : [{ kind: "usage", usage: { context } }];
|
|
103
|
-
}));
|
|
104
|
-
}
|
|
105
|
-
catch { /* Its reply, an error included, is already a frame; an exit is the exited response. */ }
|
|
106
|
-
})();
|
|
107
|
-
};
|
|
108
|
-
const onNotification = (message) => {
|
|
93
|
+
const contextReadback = factoryContextReadback(client, recordReply, () => kernel.unreachable(), timings.contextReadTimeoutMs);
|
|
94
|
+
const released = () => { queueMicrotask(drainHeld); };
|
|
95
|
+
const applyNotification = (message) => {
|
|
109
96
|
const notification = asRecord(asRecord(message.params)?.notification);
|
|
97
|
+
const wasBusy = busy();
|
|
110
98
|
const extra = [];
|
|
111
99
|
if (notification?.type === "droid_working_state_changed" && notification.newState !== "idle" && notification.newState !== "compacting_conversation" && active === null && !spontaneous && kernel.unreachable() === null) {
|
|
112
100
|
spontaneous = true;
|
|
113
101
|
extra.push({ kind: "turn_active" });
|
|
114
102
|
}
|
|
115
|
-
const { state, body
|
|
116
|
-
const compacted = compactRequestId;
|
|
117
|
-
const body = notification?.type === "session_compacted" && compacted !== null
|
|
118
|
-
? { ...folded, events: folded.events.map(event => event.kind === "compaction_ended" ? { ...event, requestId: compacted } : event) } : folded;
|
|
103
|
+
const { state, body } = foldFactoryNotification(projection, message);
|
|
119
104
|
projection = state;
|
|
120
105
|
const after = [];
|
|
121
106
|
const prompted = active;
|
|
@@ -158,11 +143,32 @@ export const createFactorySession = (timings = {}) => withSessionCredentials(asy
|
|
|
158
143
|
if (notification?.type === "settings_updated") {
|
|
159
144
|
settingsWaiter?.(asRecord(notification.settings) ?? {});
|
|
160
145
|
}
|
|
161
|
-
if (ended) {
|
|
162
|
-
|
|
163
|
-
queueMicrotask(drainHeld);
|
|
146
|
+
if (ended || (wasBusy && !busy())) {
|
|
147
|
+
released();
|
|
164
148
|
}
|
|
165
149
|
};
|
|
150
|
+
let notificationQueue = null;
|
|
151
|
+
const onNotification = (message) => {
|
|
152
|
+
const notification = asRecord(asRecord(message.params)?.notification);
|
|
153
|
+
const waitContext = notification?.type === "agent_turn_completed" && notification.reason !== "cancelled" && abortingTurn === false && kernel.unreachable() === null;
|
|
154
|
+
if (notificationQueue === null && !waitContext) {
|
|
155
|
+
applyNotification(message);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const previous = notificationQueue ?? Promise.resolve();
|
|
159
|
+
const next = (async () => {
|
|
160
|
+
await previous;
|
|
161
|
+
if (waitContext && kernel.unreachable() === null) {
|
|
162
|
+
await contextReadback.readBounded();
|
|
163
|
+
}
|
|
164
|
+
applyNotification(message);
|
|
165
|
+
})();
|
|
166
|
+
notificationQueue = next;
|
|
167
|
+
// oxlint-disable-next-line promise/prefer-await-to-then -- Clear the tail pointer only when no newer notification queued behind it.
|
|
168
|
+
void next.finally(() => { if (notificationQueue === next) {
|
|
169
|
+
notificationQueue = null;
|
|
170
|
+
} });
|
|
171
|
+
};
|
|
166
172
|
const onServerRequest = (message) => {
|
|
167
173
|
const id = typeof message.id === "string" ? message.id : String(message.id);
|
|
168
174
|
const requestMethod = typeof message.method === "string" ? message.method : "request";
|
|
@@ -172,25 +178,14 @@ export const createFactorySession = (timings = {}) => withSessionCredentials(asy
|
|
|
172
178
|
client.respond(message.id, reply);
|
|
173
179
|
kernel.respond(id, { kind: "answered", native: reply });
|
|
174
180
|
};
|
|
175
|
-
client.handle({ onNotification, onServerRequest, onUnmatched: (native) => { kernel.frame({ type: asRecord(native) === null ? "stdout" : "response", native, events: [] }); } });
|
|
176
|
-
client.onExit((code, reason) => {
|
|
177
|
-
disarm();
|
|
178
|
-
held.splice(0);
|
|
179
|
-
kernel.processExited(code, reason);
|
|
180
|
-
active = null;
|
|
181
|
-
spontaneous = false;
|
|
182
|
-
held.splice(0);
|
|
183
|
-
});
|
|
184
|
-
await confirmSettings(client, options, settings, recordReply("droid.update_session_settings"), (waiter) => { settingsWaiter = waiter; });
|
|
185
|
-
readContext();
|
|
186
181
|
const capabilities = { queue: { durable: false }, attribution: "opaque", images: true };
|
|
187
182
|
const compaction = manualCompaction(kernel, {
|
|
188
183
|
busy: () => busy() || dispatching || held.length > 0,
|
|
189
184
|
busyReason: "droid compacts only between turns, after OAR's held input has been sent",
|
|
190
185
|
// droid's compact_session answer (or refusal) is the end of the operation; its frame names the request.
|
|
191
186
|
settledBy: "native_response",
|
|
192
|
-
create: () => factoryCompaction(kernel, client, sessionId
|
|
193
|
-
released
|
|
187
|
+
create: () => factoryCompaction(kernel, client, sessionId),
|
|
188
|
+
released,
|
|
194
189
|
});
|
|
195
190
|
/** Send one input with `add_user_message`; the reply answers the control. */
|
|
196
191
|
const send = async (request, input, inputId, images, starts) => {
|
|
@@ -211,6 +206,9 @@ export const createFactorySession = (timings = {}) => withSessionCredentials(asy
|
|
|
211
206
|
projection = { ...projection, sent };
|
|
212
207
|
}
|
|
213
208
|
recordReply("droid.add_user_message", () => [], request.id)(outcome);
|
|
209
|
+
if (starts && outcome.kind === "error") {
|
|
210
|
+
released();
|
|
211
|
+
}
|
|
214
212
|
};
|
|
215
213
|
try {
|
|
216
214
|
await client.request("droid.add_user_message", { text: input, messageId: inputId, ...droidImages(images) }, settled, request.id);
|
|
@@ -233,17 +231,47 @@ export const createFactorySession = (timings = {}) => withSessionCredentials(asy
|
|
|
233
231
|
return;
|
|
234
232
|
}
|
|
235
233
|
dispatching = true;
|
|
234
|
+
const origin = next.request.body.kind === "queue" ? next.request.body.origin : undefined;
|
|
236
235
|
const request = kernel.request("toRuntime", { kind: "prompt", input: next.input,
|
|
237
|
-
carries: [next.inputId ?? next.request.id], ...(next.images === undefined ? {} : { images: next.images })
|
|
236
|
+
carries: [next.inputId ?? next.request.id], ...(next.images === undefined ? {} : { images: next.images }),
|
|
237
|
+
...(origin === undefined ? {} : { origin }) });
|
|
238
|
+
const unreachable = kernel.unreachable();
|
|
239
|
+
if (unreachable !== null) {
|
|
240
|
+
dispatching = false;
|
|
241
|
+
kernel.respond(request.id, unreachable);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
238
244
|
void (async () => {
|
|
239
245
|
try {
|
|
240
246
|
kernel.respond(request.id, await send(request, next.input, next.inputId ?? randomUUID(), next.loaded, true));
|
|
241
247
|
}
|
|
242
248
|
finally {
|
|
243
249
|
dispatching = false;
|
|
250
|
+
released();
|
|
244
251
|
}
|
|
245
252
|
})();
|
|
246
253
|
};
|
|
254
|
+
client.handle({ onNotification, onServerRequest, onUnmatched: (native) => { kernel.frame({ type: asRecord(native) === null ? "stdout" : "response", native, events: [] }); } });
|
|
255
|
+
let exitSettled = Promise.resolve();
|
|
256
|
+
const finishExit = (code, reason) => {
|
|
257
|
+
disarm();
|
|
258
|
+
held.splice(0);
|
|
259
|
+
kernel.processExited(code, reason);
|
|
260
|
+
active = null;
|
|
261
|
+
spontaneous = false;
|
|
262
|
+
held.splice(0);
|
|
263
|
+
};
|
|
264
|
+
client.onExit((code, reason) => {
|
|
265
|
+
contextReadback.end();
|
|
266
|
+
const pending = notificationQueue;
|
|
267
|
+
if (pending === null) {
|
|
268
|
+
finishExit(code, reason);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
exitSettled = (async () => { await pending; finishExit(code, reason); })();
|
|
272
|
+
});
|
|
273
|
+
await confirmSettings(client, options, settings, recordReply("droid.update_session_settings"), (waiter) => { settingsWaiter = waiter; });
|
|
274
|
+
contextReadback.readBackground();
|
|
247
275
|
const session = credentials.seal({
|
|
248
276
|
id: kernel.sessionId,
|
|
249
277
|
capabilities,
|
|
@@ -275,7 +303,7 @@ export const createFactorySession = (timings = {}) => withSessionCredentials(asy
|
|
|
275
303
|
},
|
|
276
304
|
queue: async (input, inputOptions) => {
|
|
277
305
|
const result = await kernel.control({ kind: "queue", input, ...inputOptions }, request => withInputImages(capabilities, inputOptions?.images, (loaded) => {
|
|
278
|
-
held
|
|
306
|
+
enqueueHeld(held, { inputId: inputOptions?.inputId, input, images: inputOptions?.images, loaded, request, accepted: false });
|
|
279
307
|
return { kind: "accepted", queued: "adapter" };
|
|
280
308
|
}));
|
|
281
309
|
const entry = held.find(value => value.request.id === result.request.id);
|
|
@@ -285,17 +313,18 @@ export const createFactorySession = (timings = {}) => withSessionCredentials(asy
|
|
|
285
313
|
drainHeld();
|
|
286
314
|
return result;
|
|
287
315
|
},
|
|
288
|
-
withdraw:
|
|
289
|
-
const result = await kernel.control({ kind: "withdraw", inputId }, () => withdrawHeld(held, inputId));
|
|
290
|
-
return result;
|
|
291
|
-
},
|
|
316
|
+
withdraw: withdrawControl(kernel, held),
|
|
292
317
|
abort: async () => {
|
|
293
318
|
const result = await kernel.control({ kind: "abort" }, async (request) => {
|
|
319
|
+
if (compaction.busy()) {
|
|
320
|
+
return { kind: "rejected", code: "busy", reason: "droid cannot interrupt a manual compaction" };
|
|
321
|
+
}
|
|
294
322
|
if (!busy()) {
|
|
295
323
|
return { kind: "rejected", code: "no_active_turn", reason: "no active turn" };
|
|
296
324
|
}
|
|
297
325
|
// Bounded: without droid's end of this turn in time, the process is stopped and its exit is recorded.
|
|
298
326
|
abortingTurn = active !== null && !active.dropped ? active.inputId : spontaneousTurn;
|
|
327
|
+
contextReadback.end();
|
|
299
328
|
const refused = abortFallback.arm();
|
|
300
329
|
try {
|
|
301
330
|
await client.request("droid.interrupt_session", {}, recordReply("droid.interrupt_session", () => [], request.id));
|
|
@@ -314,10 +343,12 @@ export const createFactorySession = (timings = {}) => withSessionCredentials(asy
|
|
|
314
343
|
resources: client.resources,
|
|
315
344
|
dispose: async () => {
|
|
316
345
|
await kernel.dispose(async () => {
|
|
346
|
+
contextReadback.end();
|
|
317
347
|
held.splice(0);
|
|
318
348
|
// Closing stdin ends droid's session (it saves and exits); the process owner escalates if it does not.
|
|
319
349
|
client.kill();
|
|
320
350
|
await client.exited;
|
|
351
|
+
await exitSettled;
|
|
321
352
|
});
|
|
322
353
|
},
|
|
323
354
|
});
|