mixdog 1.3.1 → 1.3.2
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 +8 -4
- package/package.json +2 -2
- package/scripts/native-release-status.mjs +238 -0
- package/src/defaults/shipped-history.json +5 -1
- package/src/defaults/skills/pptx/scripts/qc-pages.mjs +3 -2
- package/src/defaults/skills/setup/SKILL.md +23 -1
- package/src/defaults/skills/setup/references/actions.md +50 -3
- package/src/defaults/skills/setup/references/surfaces.md +23 -3
- package/src/defaults/skills/setup-guide/SKILL.md +7 -3
- package/src/defaults/skills/visualize/SKILL.md +9 -6
- package/src/defaults/skills/visualize/references/craft.md +8 -1
- package/src/help.mjs +1 -1
- package/src/lib/keychain-cjs.cjs +4 -1
- package/src/lib/rules-builder.cjs +14 -7
- package/src/rules/agent-mode/AGENT_MODE.md +8 -5
- package/src/rules/agent-mode/MIXY.md +6 -8
- package/src/rules/lead/LEAD.md +2 -2
- package/src/rules/shared/10-tool-workflow.md +4 -0
- package/src/rules/shared/20-research.md +2 -0
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch/preset.mjs +5 -0
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch/session-prep.mjs +8 -0
- package/src/runtime/agent/orchestrator/agent-runtime/agent-progress-watchdog.mjs +6 -1
- package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +114 -26
- package/src/runtime/agent/orchestrator/agent-runtime/maintenance-route.mjs +8 -0
- package/src/runtime/agent/orchestrator/agent-runtime/room-supervisor-completion.mjs +5 -4
- package/src/runtime/agent/orchestrator/agent-trace.mjs +3 -0
- package/src/runtime/agent/orchestrator/cache-break-trace.mjs +4 -0
- package/src/runtime/agent/orchestrator/config-presets.mjs +2 -0
- package/src/runtime/agent/orchestrator/config-storage.mjs +10 -3
- package/src/runtime/agent/orchestrator/config.mjs +11 -0
- package/src/runtime/agent/orchestrator/context/role-instructions.mjs +9 -2
- package/src/runtime/agent/orchestrator/mcp/agent-connectors.mjs +97 -5
- package/src/runtime/agent/orchestrator/mcp/child-tree.mjs +6 -10
- package/src/runtime/agent/orchestrator/mcp/client.mjs +7 -4
- package/src/runtime/agent/orchestrator/providers/anthropic-api-request.mjs +80 -31
- package/src/runtime/agent/orchestrator/providers/anthropic-model-resolve.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-client-version.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +67 -38
- package/src/runtime/agent/orchestrator/providers/anthropic-turn-result.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/antigravity-request.mjs +6 -2
- package/src/runtime/agent/orchestrator/providers/auto-effort.mjs +27 -8
- package/src/runtime/agent/orchestrator/providers/cursor-wire.mjs +31 -4
- package/src/runtime/agent/orchestrator/providers/cursor.mjs +4 -1
- package/src/runtime/agent/orchestrator/providers/custom-provider.mjs +11 -8
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-prefix-trace.mjs +76 -0
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +16 -0
- package/src/runtime/agent/orchestrator/providers/lib/tail-reminder-split.mjs +13 -0
- package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +16 -1
- package/src/runtime/agent/orchestrator/providers/mixdog-local.mjs +3 -1
- package/src/runtime/agent/orchestrator/providers/model-proxy-provider.mjs +1 -0
- package/src/runtime/agent/orchestrator/providers/openai-codex-metadata.mjs +5 -5
- package/src/runtime/agent/orchestrator/providers/openai-compat-models.mjs +9 -5
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses.mjs +9 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-wire.mjs +2 -1
- package/src/runtime/agent/orchestrator/providers/openai-direct-request.mjs +30 -3
- package/src/runtime/agent/orchestrator/providers/openai-model-capabilities.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/openai-ws.mjs +3 -1
- package/src/runtime/agent/orchestrator/providers/opencode-go-oauth.mjs +61 -8
- package/src/runtime/agent/orchestrator/providers/registry.mjs +9 -0
- package/src/runtime/agent/orchestrator/runtime-core/config-helpers.mjs +90 -24
- package/src/runtime/agent/orchestrator/runtime-core/fs-utils.mjs +8 -1
- package/src/runtime/agent/orchestrator/runtime-core/goal-mutations.mjs +1 -1
- package/src/runtime/agent/orchestrator/runtime-core/goal-storage.mjs +68 -22
- package/src/runtime/agent/orchestrator/runtime-core/goal-tool-exec.mjs +1 -1
- package/src/runtime/agent/orchestrator/runtime-core/orchestration.mjs +4 -6
- package/src/runtime/agent/orchestrator/runtime-core/route-context-state.mjs +81 -0
- package/src/runtime/agent/orchestrator/runtime-core/session-text.mjs +2 -1
- package/src/runtime/agent/orchestrator/runtime-core/tool-catalog.mjs +12 -1
- package/src/runtime/agent/orchestrator/runtime-core/tool-defs.mjs +6 -5
- package/src/runtime/agent/orchestrator/runtime-core/workflow/agents.mjs +7 -6
- package/src/runtime/agent/orchestrator/runtime-core/workflow/context.mjs +1 -1
- package/src/runtime/agent/orchestrator/runtime-core/workflow/packs.mjs +8 -4
- package/src/runtime/agent/orchestrator/runtime-core/workflow.mjs +2 -0
- package/src/runtime/agent/orchestrator/session/agent-mode.mjs +0 -6
- package/src/runtime/agent/orchestrator/session/agent-room-supervisor.d.mts +1 -1
- package/src/runtime/agent/orchestrator/session/agent-room-supervisor.mjs +22 -4
- package/src/runtime/agent/orchestrator/session/agent-room.d.mts +17 -2
- package/src/runtime/agent/orchestrator/session/agent-room.mjs +133 -38
- package/src/runtime/agent/orchestrator/session/attachment-preflight.mjs +80 -0
- package/src/runtime/agent/orchestrator/session/catalog-db/schema.mjs +4 -1
- package/src/runtime/agent/orchestrator/session/compact/execution-tail.mjs +14 -11
- package/src/runtime/agent/orchestrator/session/compact/forked-summary.mjs +3 -0
- package/src/runtime/agent/orchestrator/session/compact/runner.mjs +68 -18
- package/src/runtime/agent/orchestrator/session/compact/summary-mode.mjs +16 -0
- package/src/runtime/agent/orchestrator/session/compact/summary-route.mjs +87 -0
- package/src/runtime/agent/orchestrator/session/compact/summary.mjs +2 -0
- package/src/runtime/agent/orchestrator/session/compact/text-utils.mjs +5 -1
- package/src/runtime/agent/orchestrator/session/compact/user-message-kind.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/compaction-archive-capture.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +41 -10
- package/src/runtime/agent/orchestrator/session/human-gate/delegation.mjs +230 -0
- package/src/runtime/agent/orchestrator/session/human-gate/gate.mjs +136 -32
- package/src/runtime/agent/orchestrator/session/human-gate/outbound-policy.mjs +20 -0
- package/src/runtime/agent/orchestrator/session/human-gate/requests.mjs +21 -9
- package/src/runtime/agent/orchestrator/session/human-gate/run-policy.mjs +73 -0
- package/src/runtime/agent/orchestrator/session/human-gate/store.mjs +55 -27
- package/src/runtime/agent/orchestrator/session/human-gate/unattended-port.mjs +15 -0
- package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +4 -1
- package/src/runtime/agent/orchestrator/session/loop/fresh-context.mjs +189 -105
- package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +6 -2
- package/src/runtime/agent/orchestrator/session/loop/route-fallback.mjs +5 -5
- package/src/runtime/agent/orchestrator/session/loop/send-phase.mjs +3 -0
- package/src/runtime/agent/orchestrator/session/loop/steering.mjs +3 -0
- package/src/runtime/agent/orchestrator/session/loop/tool-exec/before-hook.mjs +38 -5
- package/src/runtime/agent/orchestrator/session/loop/tool-exec/dispatch.mjs +21 -0
- package/src/runtime/agent/orchestrator/session/loop/tool-exec.mjs +2 -1
- package/src/runtime/agent/orchestrator/session/loop/tool-exposure-migration.mjs +12 -0
- package/src/runtime/agent/orchestrator/session/loop/tool-helpers.mjs +11 -5
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-auto-effort.mjs +13 -2
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-execute.mjs +4 -0
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-prepare.mjs +6 -0
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-settle.mjs +4 -0
- package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +44 -18
- package/src/runtime/agent/orchestrator/session/manager/orchestration-mode-switch-notice.mjs +99 -0
- package/src/runtime/agent/orchestrator/session/manager/owner-route-fallbacks.mjs +42 -0
- package/src/runtime/agent/orchestrator/session/manager/pending-messages.mjs +3 -9
- package/src/runtime/agent/orchestrator/session/manager/pending-spool-file.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/pending-spool-shard.mjs +5 -3
- package/src/runtime/agent/orchestrator/session/manager/rules-cache.mjs +40 -1
- package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +12 -0
- package/src/runtime/agent/orchestrator/session/manager/runtime-state.mjs +20 -0
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +55 -27
- package/src/runtime/agent/orchestrator/session/manager/session-prompt-composition.mjs +3 -8
- package/src/runtime/agent/orchestrator/session/manager/session-record.mjs +12 -1
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-journal.mjs +6 -15
- package/src/runtime/agent/orchestrator/session/manager/turn-interruption.mjs +24 -8
- package/src/runtime/agent/orchestrator/session/manager/workflow-switch-notice.mjs +94 -13
- package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +42 -10
- package/src/runtime/agent/orchestrator/session/provider-prefix-guard.mjs +21 -3
- package/src/runtime/agent/orchestrator/session/routine-result.d.mts +18 -3
- package/src/runtime/agent/orchestrator/session/routine-result.mjs +120 -9
- package/src/runtime/agent/orchestrator/session/send-with-recovery.mjs +5 -1
- package/src/runtime/agent/orchestrator/session/side-question-store.mjs +3 -1
- package/src/runtime/agent/orchestrator/session/store/canonical-reader.mjs +41 -7
- package/src/runtime/agent/orchestrator/session/store/lifecycle-barriers.mjs +10 -2
- package/src/runtime/agent/orchestrator/session/store/load-cache.mjs +14 -2
- package/src/runtime/agent/orchestrator/session/store/session-delete.mjs +15 -1
- package/src/runtime/agent/orchestrator/session/store/sweep/sweep-record.mjs +8 -3
- package/src/runtime/agent/orchestrator/session/store/sweep/sweep-row.mjs +36 -1
- package/src/runtime/agent/orchestrator/session/store-summary-catalog.mjs +4 -1
- package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +40 -5
- package/src/runtime/agent/orchestrator/session/store-summary-last-message.mjs +47 -2
- package/src/runtime/agent/orchestrator/session/tail-reminder-rules.mjs +125 -0
- package/src/runtime/agent/orchestrator/session/tool-batch/finalize.mjs +4 -0
- package/src/runtime/agent/orchestrator/session/tool-result-offload.mjs +78 -43
- package/src/runtime/agent/orchestrator/session/transcript-restore/restore.mjs +35 -5
- package/src/runtime/agent/orchestrator/session/transcript-restore/user-text.mjs +42 -2
- package/src/runtime/agent/orchestrator/tools/builtin/advisory-lock.mjs +35 -13
- package/src/runtime/agent/orchestrator/tools/builtin/atomic-write.mjs +25 -5
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/backgrounded-result.mjs +4 -3
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/completed-result.mjs +13 -14
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/transport-artifacts.mjs +9 -0
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +19 -14
- package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +7 -1
- package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-job-records.mjs +6 -14
- package/src/runtime/agent/orchestrator/tools/builtin/pdf-test-fixtures.mjs +5 -3
- package/src/runtime/agent/orchestrator/tools/builtin/read-image.mjs +4 -2
- package/src/runtime/agent/orchestrator/tools/builtin/read-single-media.mjs +47 -2
- package/src/runtime/agent/orchestrator/tools/builtin/read-special-files.mjs +264 -87
- package/src/runtime/agent/orchestrator/tools/builtin/shell-analysis.mjs +10 -4
- package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +34 -21
- package/src/runtime/agent/orchestrator/tools/code-graph/constants.mjs +8 -4
- package/src/runtime/agent/orchestrator/tools/lib/shell-descendants.mjs +9 -30
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-settle.mjs +24 -12
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-spawn.mjs +3 -2
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-state.mjs +6 -2
- package/src/runtime/agent/orchestrator/tools/patch/delete-quarantine.mjs +2 -1
- package/src/runtime/agent/orchestrator/tools/patch/replay-capture.mjs +4 -2
- package/src/runtime/agent/orchestrator/tools/patch/rollback-state.mjs +33 -2
- package/src/runtime/agent/orchestrator/tools/patch-manifest.json +13 -13
- package/src/runtime/agent/orchestrator/tools/shell-command.mjs +5 -3
- package/src/runtime/agent/orchestrator/tools/shell-exec-output.mjs +3 -1
- package/src/runtime/attachments/attachment-reference.mjs +155 -0
- package/src/runtime/attachments/limits.mjs +5 -1
- package/src/runtime/attachments/office-extract.mjs +3 -6
- package/src/runtime/attachments/pdf-extract.mjs +84 -10
- package/src/runtime/attachments/store.mjs +49 -30
- package/src/runtime/browser-bridge/client.mjs +73 -20
- package/src/runtime/channels/lib/runtime-paths.mjs +1 -1
- package/src/runtime/channels/lib/scheduler.mjs +14 -7
- package/src/runtime/channels/lib/state-file.mjs +15 -15
- package/src/runtime/channels/lib/voice-runtime-fetcher.mjs +14 -13
- package/src/runtime/channels/lib/webhook/relay-tunnel.mjs +22 -18
- package/src/runtime/channels/lib/webhook/session-dispatch.mjs +14 -36
- package/src/runtime/channels/lib/worker-main.mjs +3 -2
- package/src/runtime/effort-judge/compact-tokenizer.mjs +8 -2
- package/src/runtime/effort-judge/judge-client.mjs +5 -2
- package/src/runtime/effort-judge/model-install.mjs +16 -8
- package/src/runtime/local-provider/asset-installer.mjs +10 -4
- package/src/runtime/local-provider/catalog.mjs +5 -2
- package/src/runtime/local-provider/registered-models.mjs +64 -27
- package/src/runtime/local-provider/server.mjs +2 -3
- package/src/runtime/media/adapters/image-api.mjs +89 -0
- package/src/runtime/media/auth.mjs +64 -1
- package/src/runtime/media/catalog.mjs +66 -4
- package/src/runtime/media/jobs.mjs +4 -0
- package/src/runtime/media/lanes.mjs +46 -5
- package/src/runtime/media/media-usage.mjs +17 -0
- package/src/runtime/media/renditions.mjs +15 -15
- package/src/runtime/media/store.mjs +36 -35
- package/src/runtime/media/tool.mjs +8 -1
- package/src/runtime/memory/lib/cycle-scheduler/health-ledger.mjs +8 -2
- package/src/runtime/memory/lib/embedding-model-files.mjs +30 -7
- package/src/runtime/memory/lib/ingest/transcript-tail.mjs +16 -7
- package/src/runtime/memory/lib/pg/process.mjs +8 -4
- package/src/runtime/memory/lib/project-id-resolver.mjs +5 -1
- package/src/runtime/memory/lib/runtime-fetcher.mjs +6 -1
- package/src/runtime/office/core/journal.mjs +7 -14
- package/src/runtime/office/design/library/design-library-core.mjs +4 -16
- package/src/runtime/office/pdf/ocr-engine-worker.mjs +37 -0
- package/src/runtime/office/pdf/ocr-engine.mjs +146 -0
- package/src/runtime/office/pdf/pdf-ocr.mjs +51 -21
- package/src/runtime/office/pdf/pdf-render.mjs +30 -18
- package/src/runtime/office/portable/ooxml-validator.mjs +2 -2
- package/src/runtime/office/portable/portable-soffice.mjs +4 -0
- package/src/runtime/shared/agent-kind-migration.mjs +200 -0
- package/src/runtime/shared/agent-message-envelope.d.mts +6 -0
- package/src/runtime/shared/agent-message-envelope.mjs +44 -0
- package/src/runtime/shared/agent-reap-state.d.mts +4 -0
- package/src/runtime/shared/agent-store.mjs +24 -7
- package/src/runtime/shared/agent-task-starts.mjs +27 -0
- package/src/runtime/shared/atomic-file.d.mts +50 -0
- package/src/runtime/shared/atomic-file.mjs +394 -132
- package/src/runtime/shared/background-tasks.mjs +7 -4
- package/src/runtime/shared/bot-hops.mjs +30 -0
- package/src/runtime/shared/bot-split-migration.mjs +1 -1
- package/src/runtime/shared/bounded-download.mjs +4 -2
- package/src/runtime/shared/config.mjs +39 -9
- package/src/runtime/shared/defaults-separation.mjs +6 -2
- package/src/runtime/shared/delegated-approval-host.mjs +74 -0
- package/src/runtime/shared/err-text.mjs +4 -0
- package/src/runtime/shared/error-presentation.mjs +22 -4
- package/src/runtime/shared/file-has-data.mjs +28 -0
- package/src/runtime/shared/llm/usage-ledger-import.mjs +37 -18
- package/src/runtime/shared/pending-agent-work.mjs +54 -0
- package/src/runtime/shared/process-lifecycle.mjs +8 -12
- package/src/runtime/shared/projects.mjs +50 -41
- package/src/runtime/shared/provider-accounts.mjs +17 -12
- package/src/runtime/shared/routine-trigger.d.mts +6 -1
- package/src/runtime/shared/routine-trigger.mjs +14 -6
- package/src/runtime/shared/run-child.d.mts +3 -0
- package/src/runtime/shared/run-child.mjs +24 -3
- package/src/runtime/shared/session-baseline-store.mjs +8 -2
- package/src/runtime/shared/singleton-owner.mjs +7 -6
- package/src/runtime/shared/skill-tool-dependencies.mjs +4 -10
- package/src/runtime/shared/staged-update.mjs +4 -2
- package/src/runtime/shared/statusline/statusline-segments.mjs +4 -15
- package/src/runtime/shared/tool-execution-contract.mjs +6 -0
- package/src/runtime/shared/transcript-metadata.mjs +28 -3
- package/src/runtime/shared/transcript-writer/session-record.mjs +7 -6
- package/src/runtime/shared/turn-snapshot-store.mjs +5 -4
- package/src/runtime/shared/turn-snapshot.mjs +44 -2
- package/src/runtime/shared/user-cwd.mjs +9 -4
- package/src/runtime/shared/user-data-guard.mjs +41 -42
- package/src/runtime/shared/utf8-cut.mjs +10 -0
- package/src/runtime/shared/worktrees/activity-gate.mjs +269 -61
- package/src/runtime/shared/worktrees/registry.mjs +26 -26
- package/src/runtime/tidy/core-install.mjs +26 -4
- package/src/runtime/tidy/install.mjs +91 -23
- package/src/runtime/web-search/lib/config.mjs +4 -16
- package/src/session-runtime/agent-home-delivery.mjs +555 -199
- package/src/session-runtime/agent-room-delivery.mjs +143 -36
- package/src/session-runtime/agent-task-sessions.mjs +667 -165
- package/src/session-runtime/agent-tool-routing.mjs +1 -0
- package/src/session-runtime/boot/apis.mjs +45 -24
- package/src/session-runtime/boot/config.mjs +1 -0
- package/src/session-runtime/boot/facade.mjs +11 -1
- package/src/session-runtime/boot/infrastructure.mjs +14 -2
- package/src/session-runtime/boot/providers.mjs +2 -2
- package/src/session-runtime/boot/shared.mjs +12 -6
- package/src/session-runtime/boot/tools.mjs +2 -2
- package/src/session-runtime/bot-status.mjs +432 -0
- package/src/session-runtime/config-lifecycle/lead-route-sync.mjs +29 -0
- package/src/session-runtime/config-lifecycle.mjs +60 -55
- package/src/session-runtime/cwd-plugins/core-memory-context.mjs +2 -4
- package/src/session-runtime/held-requests.mjs +36 -33
- package/src/session-runtime/internal-tool-executor/bridge-tools.mjs +10 -1
- package/src/session-runtime/internal-tool-executor/feature-tools.mjs +2 -2
- package/src/session-runtime/internal-tool-executor/workspace-tools.mjs +19 -4
- package/src/session-runtime/lifecycle/session-catalog.mjs +12 -2
- package/src/session-runtime/lifecycle/teardown.mjs +11 -3
- package/src/session-runtime/mcp-glue/connect.mjs +100 -186
- package/src/session-runtime/mcp-glue/initial-connect-gate.mjs +57 -0
- package/src/session-runtime/mcp-glue/server-connection.mjs +71 -0
- package/src/session-runtime/media-api.mjs +5 -2
- package/src/session-runtime/model-route/route-tuning.mjs +4 -1
- package/src/session-runtime/model-route/set-route.mjs +61 -1
- package/src/session-runtime/owned-automation-run.mjs +8 -1
- package/src/session-runtime/room-member-gate.mjs +16 -3
- package/src/session-runtime/route-resolution.mjs +16 -8
- package/src/session-runtime/route-state.mjs +1 -59
- package/src/session-runtime/routine-home-turn.mjs +5 -3
- package/src/session-runtime/runtime-bootstrap.mjs +5 -3
- package/src/session-runtime/runtime-paths.mjs +11 -5
- package/src/session-runtime/runtime-tunables.mjs +6 -0
- package/src/session-runtime/services/agent-tool/close-flow/close-all.mjs +11 -2
- package/src/session-runtime/services/agent-tool/close-flow.mjs +4 -2
- package/src/session-runtime/services/agent-tool/execute-send.mjs +1 -0
- package/src/session-runtime/services/agent-tool/execute-spawn.mjs +1 -0
- package/src/session-runtime/services/agent-tool/restart-notify.mjs +10 -0
- package/src/session-runtime/services/agent-tool/send-flow.mjs +25 -21
- package/src/session-runtime/services/agent-tool/spawn-flow/job-start.mjs +4 -0
- package/src/session-runtime/services/agent-tool/spawn-flow/spawn-prep.mjs +6 -3
- package/src/session-runtime/services/agent-tool/spawn-flow/spawn-run.mjs +8 -5
- package/src/session-runtime/services/agent-tool/worker-index/row-liveness.mjs +22 -2
- package/src/session-runtime/services/agent-tool/worker-index.mjs +4 -6
- package/src/session-runtime/services/agent-tool.mjs +6 -0
- package/src/session-runtime/services/daemon-crash-capture/daemon-exit-record.mjs +1 -1
- package/src/session-runtime/services/daemon-crash-capture/retention.mjs +4 -3
- package/src/session-runtime/services/hook-bus/config-loader.mjs +14 -5
- package/src/session-runtime/services/hook-bus/rule-file.mjs +49 -11
- package/src/session-runtime/services/plugin-admin.mjs +26 -26
- package/src/session-runtime/services/provider-admin.mjs +14 -4
- package/src/session-runtime/services/schedule-access.mjs +33 -4
- package/src/session-runtime/services/seeds.mjs +4 -3
- package/src/session-runtime/services/usage-dashboard.mjs +1 -1
- package/src/session-runtime/services/usage-stats-model.mjs +2 -1
- package/src/session-runtime/session-create/materialize.mjs +2 -3
- package/src/session-runtime/session-create/session-options.mjs +15 -2
- package/src/session-runtime/settings-builtin-tools-api.mjs +63 -1
- package/src/session-runtime/settings-compaction-api.mjs +86 -39
- package/src/session-runtime/setup-tool/executor.mjs +8 -2
- package/src/session-runtime/setup-tool/settings-contract.mjs +31 -1
- package/src/session-runtime/setup-tool/tool-defs.mjs +20 -3
- package/src/session-runtime/skills-api.mjs +12 -5
- package/src/session-runtime/tool-policy/agent-profile-fold.mjs +265 -0
- package/src/session-runtime/tool-policy/mode-switch.mjs +54 -0
- package/src/session-runtime/tool-policy/pending-switches.mjs +59 -0
- package/src/session-runtime/tool-policy/policy-stage.mjs +165 -0
- package/src/session-runtime/tool-policy/session-switches.mjs +169 -0
- package/src/session-runtime/tool-policy/surface-helpers.mjs +114 -0
- package/src/session-runtime/tool-policy/workflow-overlay.mjs +145 -0
- package/src/session-runtime/tool-policy-refresh.mjs +47 -369
- package/src/session-runtime/tool-surface.mjs +5 -3
- package/src/session-runtime/turn/turn-run/turn-prepare.mjs +95 -88
- package/src/session-runtime/turn/turn-run/turn-timing.mjs +4 -3
- package/src/session-runtime/turn/turn-run.mjs +2 -1
- package/src/session-runtime/workflow-agents-api/agent-connectors.mjs +54 -7
- package/src/session-runtime/workflow-agents-api/agent-editor.mjs +519 -333
- package/src/session-runtime/workflow-agents-api/agent-route.mjs +46 -46
- package/src/session-runtime/workflow-agents-api/shared.mjs +5 -1
- package/src/session-runtime/workflow-agents-api/style-and-mode.mjs +14 -1
- package/src/session-runtime/workflow-agents-api/workflow-packs.mjs +6 -3
- package/src/session-runtime/workspace/workspace-state.mjs +7 -6
- package/src/standalone/daemon-agent-control.mjs +4 -1
- package/src/standalone/daemon-session-control.mjs +51 -10
- package/src/standalone/daemon.mjs +28 -10
- package/src/standalone/local-session-runtime.mjs +22 -14
- package/src/standalone/session-client.mjs +7 -2
- package/src/standalone/session-protocol.mjs +7 -0
- package/src/standalone/session-service.mjs +11 -0
- package/src/standalone/session-state-projection.mjs +19 -9
- package/src/standalone/session-tool-output.mjs +35 -9
- package/src/tui/app/maintenance-pickers/auto-clear-picker.mjs +19 -13
- package/src/tui/app/settings-picker/settings-rows.mjs +2 -2
- package/src/tui/app/slash-commands.mjs +1 -1
- package/src/tui/app/usage-context-panels/context-model.mjs +8 -2
- package/src/tui/dist/index.mjs +529 -333
- package/src/tui/prompt-history-store.mjs +16 -21
- package/src/tui/session/context-state.mjs +4 -0
- package/src/tui/session/session-api/intake/abort.mjs +19 -1
- package/src/tui/session/session-api/media.mjs +2 -1
- package/src/tui/session/session-api/routes-agent-definitions.mjs +75 -0
- package/src/tui/session/session-api/routes-write.mjs +203 -0
- package/src/tui/session/session-api/routes.mjs +23 -247
- package/src/tui/session/session-api/settings.mjs +14 -1
- package/src/tui/session/session-flow/drain.mjs +28 -3
- package/src/tui/session/session-flow/failed-turn-rewind.mjs +4 -2
- package/src/tui/session/session-flow/queue/take-entries.mjs +8 -0
- package/src/tui/session/session-flow/steering.mjs +8 -3
- package/src/tui/session/tool-approval.mjs +185 -20
- package/src/tui/session/transcript-intake.mjs +2 -0
- package/src/tui/session/turn.mjs +23 -14
- package/src/tui/transcript-tool-failures.mjs +8 -2
- package/src/vendor/statusline/src/gateway/route-meta.mjs +7 -8
- package/src/vendor/statusline/src/gateway/session-routes.mjs +6 -7
- package/src/rules/agent-mode/ROUTINE.md +0 -6
|
@@ -4,88 +4,20 @@
|
|
|
4
4
|
* definitions, output style and orchestration mode.
|
|
5
5
|
*/
|
|
6
6
|
import {
|
|
7
|
-
|
|
7
|
+
orchestrationModeSwitchItem,
|
|
8
8
|
workflowSwitchItem,
|
|
9
9
|
} from '../../../runtime/agent/orchestrator/session/transcript-restore/restore.mjs';
|
|
10
|
-
import {
|
|
10
|
+
import { createAgentDefinitionApi } from './routes-agent-definitions.mjs';
|
|
11
|
+
import { createRouteWrite } from './routes-write.mjs';
|
|
11
12
|
import { createApiHelpers } from './shared.mjs';
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
// published before the runtime write settles. What is NOT previewed about the
|
|
15
|
-
// route (effort options, Fast capability, context window) is provider
|
|
16
|
-
// metadata the runtime resolves while the preview is already on screen.
|
|
17
|
-
const ROUTE_PREVIEW_KEYS = [
|
|
18
|
-
'provider',
|
|
19
|
-
'model',
|
|
20
|
-
'effort',
|
|
21
|
-
'fast',
|
|
22
|
-
'autoEffort',
|
|
23
|
-
'modelParameters',
|
|
24
|
-
'contextPercent',
|
|
25
|
-
'contextTokens',
|
|
26
|
-
];
|
|
14
|
+
export { publishModelSwitch } from './routes-write.mjs';
|
|
27
15
|
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const route = requested && typeof requested === 'object' ? requested : {};
|
|
34
|
-
const has = (key) => Object.hasOwn(route, key);
|
|
35
|
-
const patch = {};
|
|
36
|
-
for (const key of ROUTE_PREVIEW_KEYS) {
|
|
37
|
-
if (has(key)) patch[key] = route[key];
|
|
38
|
-
}
|
|
39
|
-
if (!has('provider') && !has('model')) {
|
|
40
|
-
return Object.keys(patch).length > 0 ? patch : null;
|
|
41
|
-
}
|
|
42
|
-
const sameModel =
|
|
43
|
-
String(patch.provider ?? current.provider ?? '') === String(current.provider ?? '') &&
|
|
44
|
-
String(patch.model ?? current.model ?? '') === String(current.model ?? '');
|
|
45
|
-
// A different model carries none of the previous model's tuning: an omitted
|
|
46
|
-
// key means "this model has no such control", not "keep the old value".
|
|
47
|
-
if (!sameModel) {
|
|
48
|
-
if (!has('effort')) patch.effort = null;
|
|
49
|
-
if (!has('fast')) patch.fast = false;
|
|
50
|
-
if (!has('modelParameters')) patch.modelParameters = {};
|
|
51
|
-
}
|
|
52
|
-
return patch;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const SESSION_ONLY_KEYS = new Set(['provider', 'model', 'effort', 'fast', 'autoEffort']);
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* A session-only request (an agent child's route) may name just the model, just
|
|
59
|
-
* the tuning, or both. Completed here, inside the serialized route write,
|
|
60
|
-
* against the latest selected route — so a Fast-only change keeps the effort a
|
|
61
|
-
* previous write selected. `unchanged` when it asks for nothing the selected
|
|
62
|
-
* route does not already have.
|
|
63
|
-
*/
|
|
64
|
-
function completeSessionOnlyRequest(request, selected) {
|
|
65
|
-
const named = Boolean(request.provider || request.model);
|
|
66
|
-
const target = named ? request : { ...request, provider: selected.provider, model: selected.model };
|
|
67
|
-
const sameModel = target.provider === selected.provider && target.model === selected.model;
|
|
68
|
-
if (!sameModel) return { request: target, unchanged: false };
|
|
69
|
-
const unchanged =
|
|
70
|
-
Object.keys(request).every((key) => SESSION_ONLY_KEYS.has(key)) &&
|
|
71
|
-
(request.effort === undefined || request.effort === selected.effort) &&
|
|
72
|
-
(request.fast === undefined || request.fast === (selected.fast === true)) &&
|
|
73
|
-
(request.autoEffort === undefined || request.autoEffort === (selected.autoEffort !== false));
|
|
74
|
-
return {
|
|
75
|
-
unchanged,
|
|
76
|
-
request: {
|
|
77
|
-
...(selected.effort ? { effort: selected.effort } : {}),
|
|
78
|
-
fast: selected.fast === true,
|
|
79
|
-
autoEffort: selected.autoEffort !== false,
|
|
80
|
-
...target,
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/** The live divider of an in-place model switch (restored from message meta
|
|
86
|
-
* after a reload); every switch path publishes it the same way. */
|
|
87
|
-
export function publishModelSwitch(bag, modelSwitch) {
|
|
88
|
-
if (modelSwitch) bag.pushItem(modelSwitchItem(bag.nextId(), modelSwitch));
|
|
16
|
+
/** The live dividers of a conversation's orchestration mode and workflow
|
|
17
|
+
* switches (made now, or chosen during a turn and applied at the next). */
|
|
18
|
+
export function publishSessionSwitches(bag, { orchestrationModeSwitch, workflowSwitch } = {}) {
|
|
19
|
+
if (orchestrationModeSwitch) bag.pushItem(orchestrationModeSwitchItem(bag.nextId(), orchestrationModeSwitch));
|
|
20
|
+
if (workflowSwitch) bag.pushItem(workflowSwitchItem(bag.nextId(), workflowSwitch));
|
|
89
21
|
}
|
|
90
22
|
|
|
91
23
|
export function createSessionRouteApi(bag) {
|
|
@@ -106,117 +38,15 @@ export function createSessionRouteApi(bag) {
|
|
|
106
38
|
routeState,
|
|
107
39
|
syncContextStats,
|
|
108
40
|
});
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return target.provider ? { ...routeOpts, ...target } : routeOpts;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const setRoute = async (opts) => {
|
|
122
|
-
const routeOpts = opts && typeof opts === 'object' ? opts : {};
|
|
123
|
-
// All model pickers save a selection for the conversation's next turn; a
|
|
124
|
-
// running turn keeps the session model it started on. A selection is never
|
|
125
|
-
// refused: another command's lock neither blocks it nor is released by it.
|
|
126
|
-
const token = ++routeSequence;
|
|
127
|
-
const previousWrite = routeWrite;
|
|
128
|
-
// The session generation this selection was made under. The write below
|
|
129
|
-
// waits behind earlier ones, so "current" is never read later: the runtime
|
|
130
|
-
// validates this token before every route side effect, and `settle` below
|
|
131
|
-
// is the only place the display is touched once the write has started.
|
|
132
|
-
const originGeneration = runtime.sessionGeneration;
|
|
133
|
-
const owned = () => runtime.sessionGeneration === originGeneration;
|
|
134
|
-
// A conditional fill (only when the route is still empty) may not apply, so
|
|
135
|
-
// it never previews: the runtime's answer is what gets published.
|
|
136
|
-
const onlyIfEmpty = routeOpts.onlyIfEmpty === true;
|
|
137
|
-
const preview = onlyIfEmpty ? null : optimisticRoutePatch(previewedRequest(routeOpts), getState());
|
|
138
|
-
// Preview immediately, serialize persistence without dropping a later
|
|
139
|
-
// click. Earlier completions cannot replace the newest visible choice.
|
|
140
|
-
if (!getState().commandBusy) routeLocked = true;
|
|
141
|
-
set({ ...(routeLocked ? { commandBusy: true } : {}), ...(preview || {}) });
|
|
142
|
-
flushEmitImmediate();
|
|
143
|
-
const write = (async () => {
|
|
144
|
-
if (previousWrite) await previousWrite.catch(() => {});
|
|
145
|
-
const previousRoute = routeState();
|
|
146
|
-
// A stale selection only republishes the route that is actually
|
|
147
|
-
// selected; it never restores or announces its own session's state.
|
|
148
|
-
const settle = ({ failed = false, sync = false, modelSwitch = null } = {}) => {
|
|
149
|
-
const stillOwned = owned();
|
|
150
|
-
if (stillOwned) publishModelSwitch(bag, modelSwitch);
|
|
151
|
-
// A newer selection publishes the final route itself.
|
|
152
|
-
if (token !== routeSequence) return;
|
|
153
|
-
if (stillOwned && failed) {
|
|
154
|
-
if (preview) set({ ...previousRoute, stats: { ...getState().stats } });
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
if (stillOwned && sync) syncContextStats({ allowEstimated: true });
|
|
158
|
-
publishRoute();
|
|
159
|
-
};
|
|
160
|
-
try {
|
|
161
|
-
// Keep the durable session address while deferring route application.
|
|
162
|
-
const applyToCurrentSession = routeOpts.applyToCurrentSession === true;
|
|
163
|
-
const keepMainModel = routeOpts.keepMainModel !== false;
|
|
164
|
-
const sessionOnly = routeOpts.sessionOnly === true;
|
|
165
|
-
const {
|
|
166
|
-
applyToCurrentSession: _drop,
|
|
167
|
-
keepMainModel: _keep,
|
|
168
|
-
sessionOnly: _scope,
|
|
169
|
-
onlyIfEmpty: _fill,
|
|
170
|
-
...requested
|
|
171
|
-
} = routeOpts;
|
|
172
|
-
let nextRoute = requested;
|
|
173
|
-
if (sessionOnly) {
|
|
174
|
-
const completed = completeSessionOnlyRequest(requested, previousRoute);
|
|
175
|
-
if (completed.unchanged) {
|
|
176
|
-
// An earlier failed write skipped its rollback because this one is
|
|
177
|
-
// newer, so the shown route may still be that write's preview.
|
|
178
|
-
settle();
|
|
179
|
-
return previousRoute;
|
|
180
|
-
}
|
|
181
|
-
nextRoute = completed.request;
|
|
182
|
-
}
|
|
183
|
-
const resolvedRoute = await runtime.setRoute(nextRoute, {
|
|
184
|
-
applyToCurrentSession,
|
|
185
|
-
keepMainModel,
|
|
186
|
-
...(sessionOnly ? { sessionOnly } : {}),
|
|
187
|
-
...(onlyIfEmpty ? { onlyIfEmpty } : {}),
|
|
188
|
-
...(originGeneration !== undefined ? { originGeneration } : {}),
|
|
189
|
-
switchEstablished: true,
|
|
190
|
-
deferUntilNextTurn: true,
|
|
191
|
-
});
|
|
192
|
-
settle({
|
|
193
|
-
sync: applyToCurrentSession || Boolean(resolvedRoute?.modelSwitch),
|
|
194
|
-
modelSwitch: resolvedRoute?.modelSwitch,
|
|
195
|
-
});
|
|
196
|
-
return resolvedRoute;
|
|
197
|
-
} catch (error) {
|
|
198
|
-
settle({ failed: true });
|
|
199
|
-
throw error;
|
|
200
|
-
} finally {
|
|
201
|
-
if (token === routeSequence) {
|
|
202
|
-
if (routeLocked) set({ commandBusy: false });
|
|
203
|
-
routeLocked = false;
|
|
204
|
-
// Publish the resolved route (or rollback) before an RPC reply
|
|
205
|
-
// reads getState(), even while the display-frame clock is busy.
|
|
206
|
-
flushEmitImmediate();
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
})();
|
|
210
|
-
routeWrite = write;
|
|
211
|
-
try {
|
|
212
|
-
return await write;
|
|
213
|
-
} finally {
|
|
214
|
-
if (routeWrite === write) routeWrite = null;
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
// The settings surface's setModel (/model, presets) is the same user
|
|
218
|
-
// model choice and runs through this one path.
|
|
219
|
-
bag.setSessionRoute = setRoute;
|
|
41
|
+
const setRoute = createRouteWrite(bag, {
|
|
42
|
+
runtime,
|
|
43
|
+
getState,
|
|
44
|
+
set,
|
|
45
|
+
flushEmitImmediate,
|
|
46
|
+
routeState,
|
|
47
|
+
syncContextStats,
|
|
48
|
+
publishRoute,
|
|
49
|
+
});
|
|
220
50
|
|
|
221
51
|
const setWebSearchRoute = async (opts) => {
|
|
222
52
|
if (getState().commandBusy) return null;
|
|
@@ -272,62 +102,7 @@ export function createSessionRouteApi(bag) {
|
|
|
272
102
|
return runtime.listWebSearchModels?.(options) || [];
|
|
273
103
|
},
|
|
274
104
|
setWebSearchRoute,
|
|
275
|
-
|
|
276
|
-
return runtime.listAgents?.() || [];
|
|
277
|
-
},
|
|
278
|
-
listWorkflows: () => {
|
|
279
|
-
return runtime.listWorkflows?.() || [];
|
|
280
|
-
},
|
|
281
|
-
// Workflow pack editing (desktop Workflows page): direct passthroughs —
|
|
282
|
-
// the runtime owns validation, user-pack persistence, and delete guards.
|
|
283
|
-
getWorkflowPack: (workflowId) => runtime.getWorkflowPack?.(workflowId) ?? null,
|
|
284
|
-
saveWorkflowPack: async (payload) => runtime.saveWorkflowPack?.(payload) ?? null,
|
|
285
|
-
createWorkflow: async (payload) => runtime.createWorkflow?.(payload) ?? null,
|
|
286
|
-
deleteWorkflow: async (workflowId) => runtime.deleteWorkflow?.(workflowId) ?? null,
|
|
287
|
-
getAgentDefinition: (agentId) => runtime.getAgentDefinition?.(agentId) ?? null,
|
|
288
|
-
getAgentAvatarImage: (agentId) => runtime.getAgentAvatarImage?.(agentId) ?? null,
|
|
289
|
-
getAgentConnectors: (agentId) => runtime.getAgentConnectors?.(agentId) ?? [],
|
|
290
|
-
listConnectors: () => runtime.listConnectors?.() ?? [],
|
|
291
|
-
listConnectorTools: (connectorId) => runtime.listConnectorTools?.(connectorId) ?? [],
|
|
292
|
-
setAgentConnectors: async (agentId, connectors) => runtime.setAgentConnectors?.(agentId, connectors) ?? null,
|
|
293
|
-
setAgentConnectorEnabled: async (agentId, connectorId, enabled) =>
|
|
294
|
-
runtime.setAgentConnectorEnabled?.(agentId, connectorId, enabled) ?? [],
|
|
295
|
-
getProjectConnectors: (projectPath) => runtime.getProjectConnectors?.(projectPath) ?? [],
|
|
296
|
-
setProjectConnectorEnabled: async (projectPath, connectorId, enabled) =>
|
|
297
|
-
runtime.setProjectConnectorEnabled?.(projectPath, connectorId, enabled) ?? [],
|
|
298
|
-
setAgentConnectorToolPermission: async (agentId, connectorId, toolName, permission) =>
|
|
299
|
-
runtime.setAgentConnectorToolPermission?.(agentId, connectorId, toolName, permission) ?? null,
|
|
300
|
-
// Per-agent action-kind permissions (ask / allow / block) for the profile.
|
|
301
|
-
getAgentPermissions: async (agentId) =>
|
|
302
|
-
(await import('../../../runtime/agent/orchestrator/session/human-gate/store.mjs')).agentPermissions(agentId),
|
|
303
|
-
setAgentPermission: async (agentId, action, mode) =>
|
|
304
|
-
(await import('../../../runtime/agent/orchestrator/session/human-gate/store.mjs')).setAgentPermission(
|
|
305
|
-
agentId,
|
|
306
|
-
action,
|
|
307
|
-
mode
|
|
308
|
-
),
|
|
309
|
-
getLeadPersona: () => runtime.getLeadPersona?.() ?? '',
|
|
310
|
-
saveLeadPersona: async (text) => runtime.saveLeadPersona?.(text) ?? '',
|
|
311
|
-
getLeadAgentBody: () => runtime.getLeadAgentBody?.() ?? '',
|
|
312
|
-
saveLeadAgentBody: async (text) => runtime.saveLeadAgentBody?.(text) ?? '',
|
|
313
|
-
getLeadStatus: () =>
|
|
314
|
-
runtime.getLeadStatus?.() ?? { created: null, name: '', avatar: null, homeChatted: false, route: null },
|
|
315
|
-
saveLeadIdentity: async (payload) => runtime.saveLeadIdentity?.(payload) ?? null,
|
|
316
|
-
setLeadCreated: async (created, description) => runtime.setLeadCreated?.(created, description) ?? null,
|
|
317
|
-
saveAgentDefinition: async (payload) => runtime.saveAgentDefinition?.(payload) ?? null,
|
|
318
|
-
deleteAgentDefinition: async (agentId) => runtime.deleteAgentDefinition?.(agentId) ?? null,
|
|
319
|
-
agentDefinitionPresence: (agentIds) => runtime.agentDefinitionPresence?.(agentIds) ?? null,
|
|
320
|
-
restoreAgentDefinition: async (agentId) => runtime.restoreAgentDefinition?.(agentId) ?? null,
|
|
321
|
-
purgeAgentDefinition: async (agentId) => runtime.purgeAgentDefinition?.(agentId) ?? null,
|
|
322
|
-
archivedAgentIdentities: (agentIds) => runtime.archivedAgentIdentities?.(agentIds) ?? null,
|
|
323
|
-
// Group-room rows posted by the desktop host into a room's log session.
|
|
324
|
-
appendRoomRows: async (sessionId, rows) =>
|
|
325
|
-
(await import('../../../session-runtime/agent-room-delivery.mjs')).appendRoomRows(sessionId, rows),
|
|
326
|
-
// One group-room supervisor step on the Maintainer route.
|
|
327
|
-
decideRoomTurn: async (input) =>
|
|
328
|
-
(await import('../../../runtime/agent/orchestrator/agent-runtime/room-supervisor-completion.mjs')).decideRoomTurn(
|
|
329
|
-
input
|
|
330
|
-
),
|
|
105
|
+
...createAgentDefinitionApi(runtime),
|
|
331
106
|
getOutputStyle: () => {
|
|
332
107
|
return runtime.getOutputStyle?.() || runtime.listOutputStyles?.() || null;
|
|
333
108
|
},
|
|
@@ -348,13 +123,14 @@ export function createSessionRouteApi(bag) {
|
|
|
348
123
|
setWorkflow: withCommandLock(async (workflowId, options) => {
|
|
349
124
|
const result = await runtime.setWorkflow?.(workflowId, options);
|
|
350
125
|
// A switch of this conversation leaves a divider (restored from message meta).
|
|
351
|
-
|
|
126
|
+
publishSessionSwitches(bag, { workflowSwitch: result?.workflowSwitch });
|
|
352
127
|
publishRoute();
|
|
353
128
|
return result;
|
|
354
129
|
}),
|
|
355
130
|
getOrchestrationMode: () => runtime.getOrchestrationMode(),
|
|
356
|
-
setOrchestrationMode: withCommandLock(async (mode) => {
|
|
357
|
-
const result = await runtime.setOrchestrationMode(mode);
|
|
131
|
+
setOrchestrationMode: withCommandLock(async (mode, options) => {
|
|
132
|
+
const result = await runtime.setOrchestrationMode(mode, options);
|
|
133
|
+
publishSessionSwitches(bag, { orchestrationModeSwitch: result?.orchestrationModeSwitch });
|
|
358
134
|
publishRoute();
|
|
359
135
|
return result;
|
|
360
136
|
}),
|
|
@@ -112,6 +112,18 @@ export function createSessionSettingsApi(bag) {
|
|
|
112
112
|
setAiSessionTitles: withCommandLock(async (enabled) => {
|
|
113
113
|
return await runtime.setAiSessionTitles?.(enabled);
|
|
114
114
|
}),
|
|
115
|
+
getLeadAppearance: () => {
|
|
116
|
+
return runtime.getLeadAppearance?.() || { avatar: null };
|
|
117
|
+
},
|
|
118
|
+
setLeadAppearance: withCommandLock(async (avatar) => {
|
|
119
|
+
return await runtime.setLeadAppearance?.(avatar);
|
|
120
|
+
}),
|
|
121
|
+
getBotOrder: () => {
|
|
122
|
+
return runtime.getBotOrder?.() || { order: [] };
|
|
123
|
+
},
|
|
124
|
+
setBotOrder: withCommandLock(async (order) => {
|
|
125
|
+
return await runtime.setBotOrder?.(order);
|
|
126
|
+
}),
|
|
115
127
|
getToolModuleSettings: () => {
|
|
116
128
|
return (
|
|
117
129
|
runtime.getToolModuleSettings?.() || {
|
|
@@ -130,9 +142,10 @@ export function createSessionSettingsApi(bag) {
|
|
|
130
142
|
setWorktreeSettings: lockedRuntimeCall((patch) => runtime.setWorktreeSettings(patch)),
|
|
131
143
|
setWebSearchEnabled: lockedRuntimeCall((enabled) => runtime.setWebSearchEnabled?.(enabled)),
|
|
132
144
|
setInstructionFiles: lockedRuntimeCall((mode) => runtime.setInstructionFiles?.(mode)),
|
|
145
|
+
setAutoEffortBase: lockedRuntimeCall((level) => runtime.setAutoEffortBase?.(level)),
|
|
133
146
|
setMemoryToolsEnabled: lockedRuntimeCall((enabled) => runtime.setMemoryToolsEnabled?.(enabled)),
|
|
134
147
|
setBuiltinToolEnabled: lockedRuntimeCall((name, enabled) => runtime.setBuiltinToolEnabled?.(name, enabled)),
|
|
135
|
-
installBuiltinFeature: lockedRuntimeCall((name) => runtime.installBuiltinFeature?.(name)),
|
|
148
|
+
installBuiltinFeature: lockedRuntimeCall((name, options) => runtime.installBuiltinFeature?.(name, options)),
|
|
136
149
|
installLocalProviderModel: lockedRuntimeCall((modelId) => runtime.installLocalProviderModel?.(modelId)),
|
|
137
150
|
// Background installs return promptly; cancellation must remain usable
|
|
138
151
|
// even while a legacy blocking install owns commandBusy.
|
|
@@ -63,8 +63,13 @@ function renderBatchItems(batch, pushUserOrSyntheticItem) {
|
|
|
63
63
|
.trim()
|
|
64
64
|
.toLowerCase();
|
|
65
65
|
const device = typeof entry.transcriptMeta?.device === 'string' ? entry.transcriptMeta.device : '';
|
|
66
|
-
const
|
|
67
|
-
|
|
66
|
+
const fromAgent = typeof entry.transcriptMeta?.fromAgent === 'string' ? entry.transcriptMeta.fromAgent : '';
|
|
67
|
+
const attribution = {
|
|
68
|
+
...(sender ? { sender } : {}),
|
|
69
|
+
...(device ? { device } : {}),
|
|
70
|
+
...(fromAgent ? { fromAgent } : {}),
|
|
71
|
+
};
|
|
72
|
+
let itemExtras = sender || device || fromAgent ? attribution : null;
|
|
68
73
|
if (Array.isArray(entry.images) && entry.images.length) {
|
|
69
74
|
itemExtras = { images: entry.images, ...attribution };
|
|
70
75
|
}
|
|
@@ -84,6 +89,23 @@ function batchPromptSource(batch) {
|
|
|
84
89
|
return undefined;
|
|
85
90
|
}
|
|
86
91
|
|
|
92
|
+
/** The batch's transcript metadata; a batch of completion wakes also records
|
|
93
|
+
* the execution ids it delivers (`consumedExecutionIds`, from each entry's
|
|
94
|
+
* execution or resume keys; null for one with neither), the structured
|
|
95
|
+
* provenance a task session's report follows (agent-task-sessions.mjs). */
|
|
96
|
+
function completionWakeTranscriptMeta(batch) {
|
|
97
|
+
const meta = batch[0]?.transcriptMeta || null;
|
|
98
|
+
if (batchPromptSource(batch) !== 'task-notification') return meta;
|
|
99
|
+
const consumed = batch.flatMap((entry) => {
|
|
100
|
+
if (entry?.execution?.id) return [String(entry.execution.id)];
|
|
101
|
+
const keys = (Array.isArray(entry?.resumeCompletionKeys) ? entry.resumeCompletionKeys : []).map(String);
|
|
102
|
+
return keys.length
|
|
103
|
+
? keys.map((key) => (key.startsWith('execution:') ? key.slice('execution:'.length) : null))
|
|
104
|
+
: [null];
|
|
105
|
+
});
|
|
106
|
+
return { ...(meta || {}), consumedExecutionIds: consumed };
|
|
107
|
+
}
|
|
108
|
+
|
|
87
109
|
export function turnOptionsForBatch(batch, steering) {
|
|
88
110
|
const nonEditable = batch.filter((entry) => !isQueuedEntryEditable(entry));
|
|
89
111
|
// A completion resume is owned by the completion that woke it. Esc
|
|
@@ -106,13 +128,16 @@ export function turnOptionsForBatch(batch, steering) {
|
|
|
106
128
|
pastedTexts: mergePastedTexts(batch),
|
|
107
129
|
submittedAt: earliestSubmittedAt(batch),
|
|
108
130
|
onCommitted: () => steering.commitSteeringQueueEntries(batch),
|
|
131
|
+
// Cancelling typed input consumes its queue copy with or without draft
|
|
132
|
+
// restoration, without signalling successful delivery to onCommitted.
|
|
133
|
+
onAborted: () => steering.releaseSteeringQueueEntries(batch),
|
|
109
134
|
submittedIds: [...new Set(batch.map((e) => e.id))],
|
|
110
135
|
restorable: nonEditable.length === 0,
|
|
111
136
|
requeueOnAbort: nonEditable.filter((entry) => !discardOnAbort.includes(entry)),
|
|
112
137
|
discardExecutionPendingResumeKeys: discardOnAbort.flatMap((entry) =>
|
|
113
138
|
Array.isArray(entry?.resumeCompletionKeys) ? entry.resumeCompletionKeys : []
|
|
114
139
|
),
|
|
115
|
-
transcriptMeta: batch
|
|
140
|
+
transcriptMeta: completionWakeTranscriptMeta(batch),
|
|
116
141
|
// Only a routine turn names its selection text (never its payload).
|
|
117
142
|
...(batch[0]?.mode === 'routine' && typeof batch[0].skillSelection === 'string'
|
|
118
143
|
? { skillSelection: batch[0].skillSelection }
|
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
const TURN_CHROME_KINDS = new Set(['user', 'turndone', 'notice']);
|
|
7
7
|
|
|
8
8
|
// An in-place model switch made after the stop (the quota "switch model"
|
|
9
|
-
// path)
|
|
10
|
-
|
|
9
|
+
// path), or a model, workflow or orchestration mode switch applied at the
|
|
10
|
+
// failed turn's start, is not the turn's output and outlives its rewind.
|
|
11
|
+
const SWITCH_DIVIDERS = new Set(['model-switched', 'workflow-switched', 'orchestration-mode-switched']);
|
|
12
|
+
const isModelSwitchDivider = (item) => item?.kind === 'statusdone' && SWITCH_DIVIDERS.has(item.status);
|
|
11
13
|
|
|
12
14
|
/** The items with the trailing failed, output-less turn removed (a later
|
|
13
15
|
* model switch divider kept), or null when nothing qualifies. */
|
|
@@ -13,6 +13,12 @@ import {
|
|
|
13
13
|
import { hydratePastedAttachments, hydrateRestorableFileParts } from '../../../../runtime/attachments/store.mjs';
|
|
14
14
|
import { dropTuiSteeringPersist } from '../../tui-steering-persist.mjs';
|
|
15
15
|
|
|
16
|
+
/** Who an entry's words are attributed to (its `sender`, sending bot and chain hop). */
|
|
17
|
+
const attributionOf = (entry) =>
|
|
18
|
+
`${String(entry?.transcriptMeta?.sender || '').toLowerCase()}|${entry?.transcriptMeta?.fromAgent || ''}|${
|
|
19
|
+
entry?.transcriptMeta?.hop || 0
|
|
20
|
+
}`;
|
|
21
|
+
|
|
16
22
|
export function createTakeEntriesOps({ pending, pendingNotificationKeys, removeQueuedEntries, leadSessionId }) {
|
|
17
23
|
function dequeueQueueBatch(maxPriority = 'later', options = {}) {
|
|
18
24
|
if (pending.length === 0) return [];
|
|
@@ -40,6 +46,8 @@ export function createTakeEntriesOps({ pending, pendingNotificationKeys, removeQ
|
|
|
40
46
|
queuePriorityValue(entry.priority) === bestPriority
|
|
41
47
|
) {
|
|
42
48
|
if (batch.length > 0 && entry.retryTurnId) break;
|
|
49
|
+
// One turn records one sender: a bot's message never merges with the user's.
|
|
50
|
+
if (batch.length > 0 && attributionOf(entry) !== attributionOf(batch[0])) break;
|
|
43
51
|
batch.push(entry);
|
|
44
52
|
pending.splice(i, 1);
|
|
45
53
|
if (entry.mode === 'task-notification' && entry.key) pendingNotificationKeys.delete(entry.key);
|
|
@@ -127,12 +127,16 @@ export function createSteeringOps(bag, { queue, submissions }) {
|
|
|
127
127
|
return isQueuedEntryEditable(entry) && !isSlashQueuedEntry(entry);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
function
|
|
131
|
-
callCommitCallbacks(entries);
|
|
130
|
+
function releaseSteeringQueueEntries(entries) {
|
|
132
131
|
const mirrored = (Array.isArray(entries) ? entries : []).filter(
|
|
133
132
|
(entry) => shouldMirrorSteeringEntry(entry) && entry.steeringPersistId
|
|
134
133
|
);
|
|
135
|
-
if (mirrored.length > 0) dropTuiSteeringPersist(leadSessionId(), mirrored);
|
|
134
|
+
if (mirrored.length > 0) return dropTuiSteeringPersist(leadSessionId(), mirrored);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function commitSteeringQueueEntries(entries) {
|
|
138
|
+
callCommitCallbacks(entries);
|
|
139
|
+
releaseSteeringQueueEntries(entries);
|
|
136
140
|
}
|
|
137
141
|
|
|
138
142
|
function canDeliverSteeringEntry(entry) {
|
|
@@ -291,6 +295,7 @@ export function createSteeringOps(bag, { queue, submissions }) {
|
|
|
291
295
|
return {
|
|
292
296
|
leadSessionId,
|
|
293
297
|
shouldMirrorSteeringEntry,
|
|
298
|
+
releaseSteeringQueueEntries,
|
|
294
299
|
commitSteeringQueueEntries,
|
|
295
300
|
settleSteeredSubmissions,
|
|
296
301
|
hasPendingSteering,
|