mixdog 1.4.3 → 1.4.5
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/package.json +1 -2
- package/src/cli.mjs +5 -1
- package/src/defaults/shipped-history.json +30 -2
- package/src/defaults/skills/browser-use/SKILL.md +148 -273
- package/src/defaults/skills/browser-use/references/devtools.md +14 -0
- package/src/defaults/skills/browser-use/references/page-flows.md +66 -0
- package/src/defaults/skills/browser-use/references/sign-in.md +70 -0
- package/src/defaults/skills/code-tidy/SKILL.md +60 -84
- package/src/defaults/skills/code-tidy/references/agent-cleanup.md +27 -2
- package/src/defaults/skills/computer-use/SKILL.md +145 -229
- package/src/defaults/skills/computer-use/references/flows.md +35 -0
- package/src/defaults/skills/computer-use/references/operations.md +22 -0
- package/src/defaults/skills/computer-use/references/platforms.md +12 -0
- package/src/defaults/skills/docx/SKILL.md +23 -31
- package/src/defaults/skills/docx/references/native-authoring.md +26 -3
- package/src/defaults/skills/docx/references/redlining.md +15 -0
- package/src/defaults/skills/image/SKILL.md +37 -77
- package/src/defaults/skills/image/references/prompt-forms.md +51 -0
- package/src/defaults/skills/image/references/text.md +6 -0
- package/src/defaults/skills/local-provider/SKILL.md +75 -105
- package/src/defaults/skills/local-provider/references/lifecycle.md +14 -0
- package/src/defaults/skills/local-provider/references/maintenance.md +19 -0
- package/src/defaults/skills/local-provider/references/recovery.md +30 -0
- package/src/defaults/skills/memory-management/SKILL.md +22 -21
- package/src/defaults/skills/pdf/SKILL.md +21 -23
- package/src/defaults/skills/pdf/references/blocks.md +20 -0
- package/src/defaults/skills/pdf/references/forms.md +12 -0
- package/src/defaults/skills/pdf/references/html.md +2 -2
- package/src/defaults/skills/pdf/references/ocr.md +7 -0
- package/src/defaults/skills/pdf/references/security.md +8 -0
- package/src/defaults/skills/pptx/SKILL.md +30 -109
- package/src/defaults/skills/pptx/references/audit.md +45 -0
- package/src/defaults/skills/pptx/references/brief-critique.md +47 -0
- package/src/defaults/skills/pptx/references/editing.md +24 -0
- package/src/defaults/skills/pptx/references/html.md +1 -1
- package/src/defaults/skills/pptx/references/script.md +33 -0
- package/src/defaults/skills/setup/SKILL.md +34 -102
- package/src/defaults/skills/setup/references/actions.md +73 -14
- package/src/defaults/skills/setup/references/surfaces.md +23 -8
- package/src/defaults/skills/setup-guide/SKILL.md +28 -115
- package/src/defaults/skills/setup-guide/references/features.md +36 -0
- package/src/defaults/skills/setup-guide/references/glossary.md +38 -0
- package/src/defaults/skills/setup-guide/references/workflow-models.md +62 -0
- package/src/defaults/skills/test-suite/SKILL.md +15 -127
- package/src/defaults/skills/test-suite/references/case-management.md +17 -9
- package/src/defaults/skills/test-suite/references/diagnose.md +23 -0
- package/src/defaults/skills/test-suite/references/prune.md +27 -0
- package/src/defaults/skills/test-suite/references/write.md +44 -0
- package/src/defaults/skills/video/SKILL.md +28 -42
- package/src/defaults/skills/video/references/prompting.md +31 -0
- package/src/defaults/skills/visualize/SKILL.md +73 -107
- package/src/defaults/skills/visualize/references/craft.md +1 -2
- package/src/defaults/skills/visualize/references/feedback.md +36 -0
- package/src/defaults/skills/visualize/references/showing.md +13 -0
- package/src/defaults/skills/xlsx/SKILL.md +23 -50
- package/src/defaults/skills/xlsx/references/editing.md +15 -0
- package/src/defaults/skills/xlsx/references/model-conventions.md +1 -1
- package/src/defaults/skills/xlsx/references/recalculation.md +37 -0
- package/src/defaults/skills/xlsx/references/report-design.md +18 -2
- package/src/lib/keychain-cjs.cjs +22 -1
- package/src/lib/rules-builder.cjs +1 -1
- package/src/rules/agent/AGENT.md +3 -0
- package/src/rules/agent-mode/MIXY.md +5 -3
- package/src/rules/lead/LEAD.md +3 -1
- package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +8 -30
- package/src/runtime/agent/orchestrator/agent-runtime/title-completion.mjs +5 -0
- package/src/runtime/agent/orchestrator/mcp/oauth-request.mjs +21 -2
- package/src/runtime/agent/orchestrator/providers/account-pool.mjs +3 -0
- package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +4 -3
- package/src/runtime/agent/orchestrator/providers/anthropic-api-request.mjs +11 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-api-transport.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-message-threads.mjs +583 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-client-version.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +81 -19
- package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events/content-block-start.mjs +4 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-outcome.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-sse.mjs +180 -13
- package/src/runtime/agent/orchestrator/providers/anthropic-turn-result.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/anthropic.mjs +58 -6
- package/src/runtime/agent/orchestrator/providers/cursor-wire.mjs +4 -2
- package/src/runtime/agent/orchestrator/providers/custom-provider-config.mjs +121 -9
- package/src/runtime/agent/orchestrator/providers/custom-provider.mjs +4 -1
- package/src/runtime/agent/orchestrator/providers/gemini-error-contract.mjs +6 -6
- package/src/runtime/agent/orchestrator/providers/gemini-model-redirect.mjs +44 -0
- package/src/runtime/agent/orchestrator/providers/gemini-reasoning-relay.mjs +5 -0
- package/src/runtime/agent/orchestrator/providers/gemini-request-body.mjs +34 -5
- package/src/runtime/agent/orchestrator/providers/gemini-response.mjs +10 -0
- package/src/runtime/agent/orchestrator/providers/gemini-schema.mjs +11 -6
- package/src/runtime/agent/orchestrator/providers/gemini-sdk-request.mjs +4 -100
- package/src/runtime/agent/orchestrator/providers/gemini-stream.mjs +3 -227
- package/src/runtime/agent/orchestrator/providers/gemini.mjs +226 -118
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +11 -1
- package/src/runtime/agent/orchestrator/providers/lib/claude-bridge-schema.mjs +15 -3
- package/src/runtime/agent/orchestrator/providers/lib/gemini-model-catalog.mjs +2 -1
- package/src/runtime/agent/orchestrator/providers/lib/generation-window.mjs +9 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-send.mjs +9 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-result.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-state.mjs +5 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-options.mjs +3 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-response-normalization.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses.mjs +10 -1
- package/src/runtime/agent/orchestrator/providers/openai-direct-request.mjs +5 -28
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-events.mjs +3 -0
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-outcome.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +50 -28
- package/src/runtime/agent/orchestrator/providers/openai-ws-response-state.mjs +9 -2
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream/socket-handlers.mjs +14 -10
- package/src/runtime/agent/orchestrator/providers/openai-ws.mjs +1 -3
- package/src/runtime/agent/orchestrator/providers/openrouter-provider-routing.mjs +28 -0
- package/src/runtime/agent/orchestrator/providers/openrouter.mjs +4 -1
- package/src/runtime/agent/orchestrator/providers/registry.mjs +30 -25
- package/src/runtime/agent/orchestrator/providers/stream-json-pool/worker-slots/slot-spawn.mjs +8 -3
- package/src/runtime/agent/orchestrator/providers/vertex-ai-maas.mjs +2 -2
- package/src/runtime/agent/orchestrator/runtime-core/ask-user-result.mjs +66 -0
- package/src/runtime/agent/orchestrator/runtime-core/config-helpers.mjs +4 -5
- package/src/runtime/agent/orchestrator/runtime-core/goal-tool-defs.mjs +2 -2
- package/src/runtime/agent/orchestrator/runtime-core/provider-request-tools.mjs +15 -8
- package/src/runtime/agent/orchestrator/runtime-core/session-title.mjs +1 -0
- package/src/runtime/agent/orchestrator/runtime-core/todo-list.mjs +9 -32
- package/src/runtime/agent/orchestrator/runtime-core/todo-tool-defs.mjs +4 -5
- package/src/runtime/agent/orchestrator/session/compact/summary-route.mjs +1 -3
- package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +5 -2
- package/src/runtime/agent/orchestrator/session/loop/no-tool-turn/todo-check.mjs +2 -17
- package/src/runtime/agent/orchestrator/session/loop/usage.mjs +7 -3
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-settle.mjs +9 -2
- package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +8 -1
- package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +26 -13
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +4 -5
- package/src/runtime/agent/orchestrator/session/manager/usage-metrics.mjs +16 -5
- package/src/runtime/agent/orchestrator/session/store/lifecycle-barriers.mjs +22 -1
- package/src/runtime/agent/orchestrator/session/store/live-state.mjs +4 -0
- package/src/runtime/agent/orchestrator/session/store.mjs +12 -6
- package/src/runtime/agent/orchestrator/tools/builtin/cache-layers.mjs +11 -9
- package/src/runtime/agent/orchestrator/tools/builtin/grep-formatting.mjs +2 -8
- package/src/runtime/agent/orchestrator/tools/builtin/lib/search-input-helpers.mjs +1 -9
- package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-output-silence.mjs +64 -0
- package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-task-output.mjs +20 -6
- package/src/runtime/agent/orchestrator/tools/builtin/local-search-telemetry.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/native-search-client.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/runtime-capabilities.mjs +12 -3
- package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +12 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/ast-calls.mjs +9 -2
- package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +137 -7
- package/src/runtime/agent/orchestrator/tools/code-graph/calls-cache.mjs +43 -14
- package/src/runtime/agent/orchestrator/tools/code-graph/calls-sidecar-worker.mjs +33 -0
- package/src/runtime/agent/orchestrator/tools/code-graph/disk-cache.mjs +146 -11
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +31 -24
- package/src/runtime/agent/orchestrator/tools/code-graph/graph-binary/spawn-jsonl.mjs +172 -25
- package/src/runtime/agent/orchestrator/tools/code-graph/graph-model.mjs +100 -2
- package/src/runtime/agent/orchestrator/tools/code-graph/main-thread-slice.mjs +18 -0
- package/src/runtime/agent/orchestrator/tools/code-graph/mask-pool.mjs +219 -0
- package/src/runtime/agent/orchestrator/tools/code-graph/mask-worker.mjs +12 -0
- package/src/runtime/agent/orchestrator/tools/code-graph/memory-cache.mjs +6 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/modes/calls.mjs +9 -2
- package/src/runtime/agent/orchestrator/tools/code-graph/modes/dependents.mjs +5 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/modes/structure.mjs +8 -2
- package/src/runtime/agent/orchestrator/tools/code-graph/modes/symbols.mjs +14 -11
- package/src/runtime/agent/orchestrator/tools/code-graph/search-references.mjs +41 -18
- package/src/runtime/agent/orchestrator/tools/code-graph/search.mjs +391 -83
- package/src/runtime/agent/orchestrator/tools/code-graph/symbol-index.mjs +109 -9
- package/src/runtime/agent/orchestrator/tools/code-graph/text-mask.mjs +73 -29
- package/src/runtime/agent/orchestrator/tools/code-graph-prewarm-worker.mjs +6 -5
- package/src/runtime/agent/orchestrator/tools/lib/native-spawn-client.mjs +7 -3
- package/src/runtime/channels/lib/crash-log.mjs +21 -1
- package/src/runtime/channels/lib/routines-db.mjs +35 -0
- package/src/runtime/channels/lib/schedules-db.mjs +4 -0
- package/src/runtime/channels/lib/webhooks-db.mjs +4 -0
- package/src/runtime/channels/lib/worker-main.mjs +8 -25
- package/src/runtime/computer-bridge/action-schema.mjs +2 -2
- package/src/runtime/computer-bridge/core-actions.mjs +16 -2
- package/src/runtime/computer-bridge/result-canonical.mjs +6 -0
- package/src/runtime/media/jobs.mjs +5 -0
- package/src/runtime/media/store.mjs +146 -3
- package/src/runtime/memory/tool-defs.mjs +1 -1
- package/src/runtime/office/core/office-write-ledger.mjs +2 -2
- package/src/runtime/shared/agent-reap-state.mjs +19 -0
- package/src/runtime/shared/desktop-notice-host.d.mts +13 -0
- package/src/runtime/shared/desktop-notice-host.mjs +87 -0
- package/src/runtime/shared/file-lock.mjs +2 -2
- package/src/runtime/shared/heap-cap.mjs +9 -11
- package/src/runtime/shared/llm/http-agent.mjs +11 -1
- package/src/runtime/shared/llm/system-proxy.mjs +100 -25
- package/src/runtime/shared/llm/usage-accounting.mjs +121 -19
- package/src/runtime/shared/llm/usage-context.mjs +3 -3
- package/src/runtime/shared/llm/usage-ledger-quota.mjs +2 -0
- package/src/runtime/shared/llm/usage-ledger-requests.mjs +190 -0
- package/src/runtime/shared/llm/usage-ledger-rollup.mjs +7 -3
- package/src/runtime/shared/llm/usage-ledger-worker.mjs +2 -0
- package/src/runtime/shared/llm/usage-ledger.mjs +69 -1
- package/src/runtime/shared/llm/usage-request-status.mjs +48 -0
- package/src/runtime/shared/provider-accounts.mjs +22 -0
- package/src/runtime/shared/provider-auth-binding.mjs +2 -2
- package/src/runtime/shared/resource-admission.mjs +2 -2
- package/src/runtime/shared/root-async-context.mjs +51 -0
- package/src/runtime/shared/run-child.mjs +18 -1
- package/src/runtime/shared/slow-span.mjs +2 -2
- package/src/runtime/shared/tool-execution-owner.mjs +2 -2
- package/src/runtime/shared/tool-result-summary.mjs +1 -1
- package/src/runtime/shared/tool-work-units.mjs +2 -0
- package/src/runtime/shared/turn-snapshot-store.mjs +75 -18
- package/src/runtime/shared/turn-worktree-snapshot.mjs +38 -8
- package/src/runtime/shared/user-cwd.mjs +2 -2
- package/src/runtime/shared/worker-requests.mjs +3 -1
- package/src/runtime/shared/worktrees/lock.mjs +2 -2
- package/src/runtime/visualize-bridge/client.mjs +26 -4
- package/src/runtime/visualize-bridge/tool-defs.mjs +46 -5
- package/src/session-runtime/agent-home-delivery.mjs +76 -8
- package/src/session-runtime/agent-task-sessions.mjs +63 -22
- package/src/session-runtime/boot/apis.mjs +16 -0
- package/src/session-runtime/boot/begin.mjs +2 -0
- package/src/session-runtime/boot/tools.mjs +8 -2
- package/src/session-runtime/internal-tool-executor/ask-user-tool.mjs +3 -58
- package/src/session-runtime/media-api.mjs +15 -0
- package/src/session-runtime/model-route/route-persist.mjs +12 -4
- package/src/session-runtime/provider-models/row-hydration.mjs +2 -0
- package/src/session-runtime/provider-readiness.mjs +10 -2
- package/src/session-runtime/routine-owner.mjs +9 -3
- package/src/session-runtime/runtime-core.mjs +35 -8
- package/src/session-runtime/runtime-review-api.mjs +3 -1
- package/src/session-runtime/services/agent-task-status.mjs +29 -1
- package/src/session-runtime/services/agent-tool/close-flow.mjs +6 -1
- package/src/session-runtime/services/agent-tool/execute-resume.mjs +94 -0
- package/src/session-runtime/services/agent-tool/execute-send.mjs +77 -27
- package/src/session-runtime/services/agent-tool/execute-spawn.mjs +28 -7
- package/src/session-runtime/services/agent-tool/execute.mjs +6 -1
- package/src/session-runtime/services/agent-tool/helpers.mjs +11 -0
- package/src/session-runtime/services/agent-tool/job-views/job-render.mjs +13 -10
- package/src/session-runtime/services/agent-tool/job-views/session-progress.mjs +3 -0
- package/src/session-runtime/services/agent-tool/render.mjs +8 -1
- package/src/session-runtime/services/agent-tool/send-flow.mjs +1 -0
- package/src/session-runtime/services/agent-tool/spawn-flow/spawn-prep.mjs +6 -0
- package/src/session-runtime/services/agent-tool/spawn-flow/spawn-run.mjs +2 -1
- package/src/session-runtime/services/agent-tool/tag-registry/reaped-sessions.mjs +82 -0
- package/src/session-runtime/services/agent-tool/tag-registry/record-facts-worker.mjs +36 -0
- package/src/session-runtime/services/agent-tool/tag-registry.mjs +4 -0
- package/src/session-runtime/services/agent-tool/terminal-reaper/row-helpers.mjs +29 -0
- package/src/session-runtime/services/agent-tool/terminal-reaper/scan-admission.mjs +11 -3
- package/src/session-runtime/services/agent-tool/terminal-reaper/stale-rows.mjs +19 -8
- package/src/session-runtime/services/agent-tool/terminal-reaper.mjs +5 -2
- package/src/session-runtime/services/agent-tool/worker-index.mjs +1 -0
- package/src/session-runtime/services/channel-admin.mjs +44 -3
- package/src/session-runtime/services/daemon-crash-capture/daemon-exit-record.mjs +2 -2
- package/src/session-runtime/services/plugin-admin.mjs +46 -7
- package/src/session-runtime/services/provider-admin.mjs +5 -0
- package/src/session-runtime/session-create.mjs +5 -0
- package/src/session-runtime/setup-tool/agent-settings-actions.mjs +1 -1
- package/src/session-runtime/setup-tool/executor.mjs +1 -1
- package/src/session-runtime/setup-tool/extended-actions.mjs +1 -1
- package/src/session-runtime/setup-tool/settings-contract.mjs +4 -2
- package/src/session-runtime/usage-stats-api.mjs +120 -1
- package/src/session-runtime/workflow-agents-api/agent-connectors.mjs +36 -29
- package/src/session-runtime/workflow-agents-api/agent-editor.mjs +183 -23
- package/src/session-runtime/workspace/admission-gate.mjs +25 -7
- package/src/session-runtime/workspace/transitions.mjs +4 -0
- package/src/standalone/daemon-log.mjs +28 -4
- package/src/standalone/daemon-owner.mjs +41 -7
- package/src/standalone/daemon-work-gate.mjs +139 -0
- package/src/standalone/daemon.mjs +80 -11
- package/src/standalone/desktop-service-registry.mjs +11 -4
- package/src/standalone/session-client.mjs +57 -5
- package/src/standalone/session-protocol.mjs +6 -0
- package/src/standalone/session-service/agent-tree/agent-cancel.mjs +17 -1
- package/src/standalone/session-service/agent-tree.mjs +7 -0
- package/src/standalone/session-service/retention/busy.mjs +3 -2
- package/src/standalone/session-service/session-calls/session-turns.mjs +12 -5
- package/src/standalone/session-transport/call-route.mjs +10 -4
- package/src/standalone/session-transport/routes.mjs +21 -0
- package/src/standalone/session-transport/stack.mjs +3 -1
- package/src/standalone/session-transport.mjs +5 -0
- package/src/tui/app/model-picker/model-footer.mjs +1 -1
- package/src/tui/app/model-picker/provider-models-list.mjs +7 -3
- package/src/tui/app/model-picker/route-selection/fast-parameters.mjs +23 -3
- package/src/tui/app/model-picker/route-selection.mjs +1 -0
- package/src/tui/dist/index.mjs +536 -484
- package/src/tui/session/session-api/integrations.mjs +3 -0
- package/src/tui/session/session-api/media.mjs +5 -0
- package/src/tui/session/tool-approval-settle.mjs +24 -4
- package/src/tui/session/tool-approval.mjs +35 -10
- package/src/tui/session/turn.mjs +13 -0
- package/src/runtime/agent/orchestrator/providers/gemini-sdk-stream/cancellation.mjs +0 -71
- package/src/runtime/agent/orchestrator/providers/gemini-sdk-stream/reader.mjs +0 -108
|
@@ -35,6 +35,9 @@ export function createSessionIntegrationsApi(bag, { oauthFlows }) {
|
|
|
35
35
|
getUsageStats: async (options = {}) => {
|
|
36
36
|
return await runtime.getUsageStats?.(options);
|
|
37
37
|
},
|
|
38
|
+
getUsageRequests: async (options = {}) => {
|
|
39
|
+
return await runtime.getUsageRequests?.(options);
|
|
40
|
+
},
|
|
38
41
|
getQuotaHistory: async (options = {}) => {
|
|
39
42
|
return await runtime.getQuotaHistory?.(options);
|
|
40
43
|
},
|
|
@@ -127,6 +127,11 @@ export function createSessionMediaApi(bag) {
|
|
|
127
127
|
setMediaPin: (input) => runtime.setMediaPin?.(input),
|
|
128
128
|
listMediaAssets: (options) => runtime.listMediaAssets?.(options),
|
|
129
129
|
readMediaAsset: (id, options) => runtime.readMediaAsset?.(id, options),
|
|
130
|
+
listMediaBoards: () => runtime.listMediaBoards?.(),
|
|
131
|
+
createMediaBoard: (name) => runtime.createMediaBoard?.(name),
|
|
132
|
+
renameMediaBoard: (id, name) => runtime.renameMediaBoard?.(id, name),
|
|
133
|
+
deleteMediaBoard: (id) => runtime.deleteMediaBoard?.(id),
|
|
134
|
+
setMediaAssetBoard: (ids, boardId) => runtime.setMediaAssetBoard?.(ids, boardId),
|
|
130
135
|
cacheMediaThumbnail: (id, input) => runtime.cacheMediaThumbnail?.(id, input),
|
|
131
136
|
resolveMediaFile: (id, options) => runtime.resolveMediaFile?.(id, options),
|
|
132
137
|
getMediaJob: (id) => runtime.getMediaJob?.(id),
|
|
@@ -5,11 +5,22 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { normalizeHumanResponse } from '../../runtime/agent/orchestrator/session/human-gate/requests.mjs';
|
|
7
7
|
import { withdrawDelegatedApproval } from '../../runtime/shared/delegated-approval-host.mjs';
|
|
8
|
+
import { askUserResultText } from '../../runtime/agent/orchestrator/runtime-core/ask-user-result.mjs';
|
|
8
9
|
|
|
9
10
|
// Settle one entry: drop its timeout, then hand the waiter its answer. The
|
|
10
11
|
// resolve stays guarded — a waiter whose caller already went away must never
|
|
11
|
-
// take the rest of the queue down with it.
|
|
12
|
-
|
|
12
|
+
// take the rest of the queue down with it. `interrupted`: Stop/turn abort or
|
|
13
|
+
// close ended it, nobody answered.
|
|
14
|
+
export function settleToolApproval(
|
|
15
|
+
entry,
|
|
16
|
+
approved,
|
|
17
|
+
reason,
|
|
18
|
+
answers,
|
|
19
|
+
reply,
|
|
20
|
+
extra,
|
|
21
|
+
device = '',
|
|
22
|
+
{ interrupted = false } = {}
|
|
23
|
+
) {
|
|
13
24
|
if (entry?.timer) clearTimeout(entry.timer);
|
|
14
25
|
const result = { approved, reason };
|
|
15
26
|
if (answers !== undefined) result.answers = answers;
|
|
@@ -20,9 +31,18 @@ export function settleToolApproval(entry, approved, reason, answers, reply, extr
|
|
|
20
31
|
if (device) result.device = device;
|
|
21
32
|
}
|
|
22
33
|
if (extra?.timedOut === true) result.timedOut = true;
|
|
23
|
-
// Settled here: its copy in the top-level chat goes away.
|
|
34
|
+
// Settled here: its copy in the top-level chat goes away. An answered or
|
|
35
|
+
// timed-out question leaves the record its call returns (ask-user-result.mjs),
|
|
36
|
+
// so a hand-off copy settles into the card the asking session keeps.
|
|
24
37
|
if (entry?.delegated) {
|
|
25
|
-
|
|
38
|
+
const questions = entry.request?.kind === 'question' ? entry.request.args?.questions : null;
|
|
39
|
+
const record = Array.isArray(questions) && !interrupted ? askUserResultText(questions, result) : '';
|
|
40
|
+
withdrawDelegatedApproval(entry.id, {
|
|
41
|
+
approved,
|
|
42
|
+
device,
|
|
43
|
+
...(extra?.timedOut === true ? { expired: true } : {}),
|
|
44
|
+
...(record ? { record } : {}),
|
|
45
|
+
});
|
|
26
46
|
}
|
|
27
47
|
try {
|
|
28
48
|
entry.resolve(result);
|
|
@@ -42,7 +42,17 @@ export function createToolApproval({ getState, set, nextId, getDisposed, timeout
|
|
|
42
42
|
// queue so they never hold this chat's own requests back and several show
|
|
43
43
|
// at once. Answered here, the answer goes to the asking session's queue.
|
|
44
44
|
const handoffQuestions = [];
|
|
45
|
-
|
|
45
|
+
// The last settled copy per asking session, its request with `record` (the
|
|
46
|
+
// result its ask_user call returned): the card stays answered beside the
|
|
47
|
+
// hand-off line, as the asking session's transcript keeps it, until that
|
|
48
|
+
// session asks again. Never answered here.
|
|
49
|
+
const handoffRecords = [];
|
|
50
|
+
const publishHandoffQuestions = () =>
|
|
51
|
+
set({ handoffQuestions: [...handoffRecords, ...handoffQuestions].map((entry) => entry.request) });
|
|
52
|
+
const dropHandoffRecordOf = (sessionId) => {
|
|
53
|
+
const at = handoffRecords.findIndex((entry) => String(entry.request.sessionId || '') === sessionId);
|
|
54
|
+
if (at >= 0) handoffRecords.splice(at, 1);
|
|
55
|
+
};
|
|
46
56
|
const ownSessionId = () => String(getState()?.sessionId || '');
|
|
47
57
|
const { delegationSurface, handsOff, offerToHandoffs } = createApprovalDelegation({ surfaceOf, ownSessionId });
|
|
48
58
|
const unregister =
|
|
@@ -72,6 +82,7 @@ export function createToolApproval({ getState, set, nextId, getDisposed, timeout
|
|
|
72
82
|
if (getDisposed() || delegated.sessionId !== ownSessionId()) return;
|
|
73
83
|
if (delegated.request?.kind === 'question') {
|
|
74
84
|
if (handoffQuestions.some((entry) => entry.id === delegated.id)) return;
|
|
85
|
+
dropHandoffRecordOf(String(delegated.request.sessionId || ''));
|
|
75
86
|
handoffQuestions.push({ id: delegated.id, request: delegated.request, mirror: delegated });
|
|
76
87
|
publishHandoffQuestions();
|
|
77
88
|
return;
|
|
@@ -83,8 +94,13 @@ export function createToolApproval({ getState, set, nextId, getDisposed, timeout
|
|
|
83
94
|
function withdrawDelegatedCopy(id, result) {
|
|
84
95
|
const question = handoffQuestions.findIndex((entry) => entry.id === id);
|
|
85
96
|
if (question >= 0) {
|
|
86
|
-
handoffQuestions.splice(question, 1);
|
|
87
|
-
if (
|
|
97
|
+
const [entry] = handoffQuestions.splice(question, 1);
|
|
98
|
+
if (getDisposed()) return;
|
|
99
|
+
if (typeof result?.record === 'string') {
|
|
100
|
+
dropHandoffRecordOf(String(entry.request.sessionId || ''));
|
|
101
|
+
handoffRecords.push({ id, request: { ...entry.request, record: result.record } });
|
|
102
|
+
}
|
|
103
|
+
publishHandoffQuestions();
|
|
88
104
|
return;
|
|
89
105
|
}
|
|
90
106
|
if (activeToolApproval?.mirror && activeToolApproval.id === id) {
|
|
@@ -154,11 +170,18 @@ export function createToolApproval({ getState, set, nextId, getDisposed, timeout
|
|
|
154
170
|
settleToolApproval(entry, approved === true, String(reason || ''), answers, reply, extra, String(device || ''));
|
|
155
171
|
return true;
|
|
156
172
|
}
|
|
157
|
-
const question = handoffQuestions.
|
|
158
|
-
if (question
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
173
|
+
const question = handoffQuestions.find((entry) => entry.id === targetId);
|
|
174
|
+
if (question) {
|
|
175
|
+
// The owner's settle withdraws this copy (withdrawDelegatedCopy), which
|
|
176
|
+
// keeps it as the answered record; a copy the owner had already settled
|
|
177
|
+
// only leaves.
|
|
178
|
+
const accepted = forwardToOwner(question, approved, reason, device, answers, reply, extra);
|
|
179
|
+
const left = handoffQuestions.indexOf(question);
|
|
180
|
+
if (left >= 0) {
|
|
181
|
+
handoffQuestions.splice(left, 1);
|
|
182
|
+
publishHandoffQuestions();
|
|
183
|
+
}
|
|
184
|
+
return accepted;
|
|
162
185
|
}
|
|
163
186
|
return false;
|
|
164
187
|
}
|
|
@@ -171,12 +194,14 @@ export function createToolApproval({ getState, set, nextId, getDisposed, timeout
|
|
|
171
194
|
unregister();
|
|
172
195
|
// Dropped unanswered with this runtime: the next one adopts them again.
|
|
173
196
|
handoffQuestions.length = 0;
|
|
197
|
+
handoffRecords.length = 0;
|
|
174
198
|
}
|
|
199
|
+
const interrupted = { interrupted: true };
|
|
175
200
|
if (activeToolApproval && !(activeToolApproval.mirror && !closing)) {
|
|
176
201
|
const entry = activeToolApproval;
|
|
177
202
|
activeToolApproval = null;
|
|
178
203
|
if (!entry.mirror) {
|
|
179
|
-
settleToolApproval(entry, false, reason);
|
|
204
|
+
settleToolApproval(entry, false, reason, undefined, undefined, undefined, '', interrupted);
|
|
180
205
|
// Stop/turn abort ended it: not a timeout, nobody answered.
|
|
181
206
|
set({ toolApprovalResult: { id: entry.id, approved: false, device: '', interrupted: true, at: Date.now() } });
|
|
182
207
|
}
|
|
@@ -184,7 +209,7 @@ export function createToolApproval({ getState, set, nextId, getDisposed, timeout
|
|
|
184
209
|
const kept = [];
|
|
185
210
|
while (toolApprovalQueue.length > 0) {
|
|
186
211
|
const entry = toolApprovalQueue.shift();
|
|
187
|
-
if (!entry.mirror) settleToolApproval(entry, false, reason);
|
|
212
|
+
if (!entry.mirror) settleToolApproval(entry, false, reason, undefined, undefined, undefined, '', interrupted);
|
|
188
213
|
else if (!closing) kept.push(entry);
|
|
189
214
|
}
|
|
190
215
|
toolApprovalQueue.push(...kept);
|
package/src/tui/session/turn.mjs
CHANGED
|
@@ -22,6 +22,8 @@ export { transcriptToolCallDisplayMode } from './turn-tool-cards.mjs';
|
|
|
22
22
|
import { isRejected429 } from '../../runtime/shared/error-presentation.mjs';
|
|
23
23
|
import { QUOTA_KINDS, providerErrorKind } from '../../runtime/agent/orchestrator/providers/provider-error-kind.mjs';
|
|
24
24
|
import { turnFailureRecord } from '../../runtime/agent/orchestrator/session/turn-failure.mjs';
|
|
25
|
+
import { providerDisplayName } from '../../runtime/shared/provider-display-name.mjs';
|
|
26
|
+
import { clearDesktopNotice, raiseDesktopNotice } from '../../runtime/shared/desktop-notice-host.mjs';
|
|
25
27
|
import { registerTaskWaitSteeringCheck } from '../../runtime/agent/orchestrator/session/task-wait-control.mjs';
|
|
26
28
|
import {
|
|
27
29
|
isReactionSuccess,
|
|
@@ -529,8 +531,11 @@ function completeTurn(ctx, result, session) {
|
|
|
529
531
|
set({ stats: { ...getState().stats } });
|
|
530
532
|
settleFinalText(stream, result?.content != null ? String(result.content) : '');
|
|
531
533
|
turn.finishedNormally = true;
|
|
534
|
+
if (turn.routeMeta?.provider) clearDesktopNotice(providerSignInNoticeKey(turn.routeMeta.provider));
|
|
532
535
|
}
|
|
533
536
|
|
|
537
|
+
const providerSignInNoticeKey = (provider) => `provider-sign-in:${provider}`;
|
|
538
|
+
|
|
534
539
|
export function failTurn(ctx, error) {
|
|
535
540
|
const { turn, stream, cards, pushNotice } = ctx;
|
|
536
541
|
flushStreamBatch(stream); // ensure any batched text lands before the error notice
|
|
@@ -549,6 +554,14 @@ export function failTurn(ctx, error) {
|
|
|
549
554
|
if (record.quota) turn.quota = record.quota;
|
|
550
555
|
turn.failureDetail = record.detail;
|
|
551
556
|
turn.failureDiagnostic = record.errorDetails;
|
|
557
|
+
// The provider refused the sign-in (expired, revoked, refresh failed): the
|
|
558
|
+
// desktop says so once per provider until a turn on it succeeds again.
|
|
559
|
+
const provider = turn.routeMeta?.provider;
|
|
560
|
+
if (provider && record.providerKind.kind === 'auth') {
|
|
561
|
+
raiseDesktopNotice(providerSignInNoticeKey(provider), 'provider-sign-in-expired', {
|
|
562
|
+
name: providerDisplayName(provider),
|
|
563
|
+
});
|
|
564
|
+
}
|
|
552
565
|
// Answers the turn went on past before it failed (turn-report.mjs).
|
|
553
566
|
if (typeof error?.carriedReport === 'string') turn.carriedReport = error.carriedReport;
|
|
554
567
|
pushNotice(turn.failureDetail, 'error', { owner: 'transcript' });
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// Cancellation of an in-flight Gemini SDK iterator.
|
|
2
|
-
//
|
|
3
|
-
// A timeout or external abort must stop the generation and retire the SDK
|
|
4
|
-
// iterator without deadlocking on it. The first forced failure wins; a read
|
|
5
|
-
// that settles later reports that failure once cleanup finished.
|
|
6
|
-
export function createSdkStreamCancellation({ signal, label, cancelGeneration, cancellationGraceMs }) {
|
|
7
|
-
let iterator = null;
|
|
8
|
-
let cancellation = null;
|
|
9
|
-
let forcedFailure = null;
|
|
10
|
-
|
|
11
|
-
const abortError = () => (signal?.reason instanceof Error ? signal.reason : new Error(`${label} aborted`));
|
|
12
|
-
|
|
13
|
-
const cancelInFlight = (err) => {
|
|
14
|
-
if (cancellation) return cancellation;
|
|
15
|
-
forcedFailure = err;
|
|
16
|
-
cancellation = (async () => {
|
|
17
|
-
try {
|
|
18
|
-
cancelGeneration?.(err);
|
|
19
|
-
} catch {}
|
|
20
|
-
let returnPromise;
|
|
21
|
-
try {
|
|
22
|
-
returnPromise = Promise.resolve(iterator?.return?.());
|
|
23
|
-
} catch {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
// iterator.return() is best-effort cleanup. A broken SDK iterator
|
|
27
|
-
// must not deadlock the timeout path and prevent withRetry from
|
|
28
|
-
// beginning the next attempt after the generation was aborted.
|
|
29
|
-
let graceTimer = null;
|
|
30
|
-
try {
|
|
31
|
-
await Promise.race([
|
|
32
|
-
returnPromise.catch(() => {}),
|
|
33
|
-
new Promise((resolve) => {
|
|
34
|
-
graceTimer = setTimeout(resolve, Math.max(0, cancellationGraceMs));
|
|
35
|
-
}),
|
|
36
|
-
]);
|
|
37
|
-
} finally {
|
|
38
|
-
if (graceTimer) clearTimeout(graceTimer);
|
|
39
|
-
// Keep observing a late rejection after the grace race expires.
|
|
40
|
-
returnPromise.catch(() => {});
|
|
41
|
-
}
|
|
42
|
-
})();
|
|
43
|
-
return cancellation;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
abortError,
|
|
48
|
-
cancelInFlight,
|
|
49
|
-
// The iterator to retire; bound once the SDK stream is opened.
|
|
50
|
-
bindIterator(next) {
|
|
51
|
-
iterator = next;
|
|
52
|
-
},
|
|
53
|
-
// Fail a pending read only after the generation was cancelled.
|
|
54
|
-
rejectAfterCancellation(reject, err) {
|
|
55
|
-
cancelInFlight(err).then(
|
|
56
|
-
() => reject(err),
|
|
57
|
-
() => reject(err)
|
|
58
|
-
);
|
|
59
|
-
},
|
|
60
|
-
// A read settling after a forced cancellation reports that failure once
|
|
61
|
-
// cleanup finished. Returns false when no cancellation was forced.
|
|
62
|
-
settleForced(reject) {
|
|
63
|
-
if (!forcedFailure) return false;
|
|
64
|
-
cancellation.then(
|
|
65
|
-
() => reject(forcedFailure),
|
|
66
|
-
() => reject(forcedFailure)
|
|
67
|
-
);
|
|
68
|
-
return true;
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
// Pending-read registry and watchdogs for the Gemini SDK iterator.
|
|
2
|
-
//
|
|
3
|
-
// One read is in flight at a time. Its reject handle is registered so the
|
|
4
|
-
// first-byte timer, the idle watchdog and an external abort can fail the read
|
|
5
|
-
// immediately instead of waiting for the SDK to notice.
|
|
6
|
-
import { PROVIDER_SSE_IDLE_TIMEOUT_MS, PROVIDER_SSE_IDLE_WATCHDOG_ENABLED } from '../../stall-policy.mjs';
|
|
7
|
-
|
|
8
|
-
export function createSdkStreamReader({ iterator, label, firstByteTimeoutMs, timeoutError, cancellation }) {
|
|
9
|
-
let sawStreamChunk = false;
|
|
10
|
-
let idleTimedOut = false;
|
|
11
|
-
let idleTimer = null;
|
|
12
|
-
let firstByteTimer = null;
|
|
13
|
-
let firstByteReject = null;
|
|
14
|
-
let inFlightReject = null;
|
|
15
|
-
|
|
16
|
-
const idleError = () => timeoutError(`${label} SSE idle`, PROVIDER_SSE_IDLE_TIMEOUT_MS);
|
|
17
|
-
const clearPending = () => {
|
|
18
|
-
inFlightReject = null;
|
|
19
|
-
firstByteReject = null;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const armFirstByteTimer = () => {
|
|
23
|
-
if (firstByteTimer) clearTimeout(firstByteTimer);
|
|
24
|
-
firstByteTimer = setTimeout(() => {
|
|
25
|
-
if (firstByteReject) {
|
|
26
|
-
const e = timeoutError(`${label} first byte`, firstByteTimeoutMs);
|
|
27
|
-
const r = firstByteReject;
|
|
28
|
-
firstByteReject = null;
|
|
29
|
-
cancellation.rejectAfterCancellation(r, e);
|
|
30
|
-
}
|
|
31
|
-
}, firstByteTimeoutMs);
|
|
32
|
-
};
|
|
33
|
-
const clearFirstByteTimer = () => {
|
|
34
|
-
if (firstByteTimer) {
|
|
35
|
-
clearTimeout(firstByteTimer);
|
|
36
|
-
firstByteTimer = null;
|
|
37
|
-
}
|
|
38
|
-
firstByteReject = null;
|
|
39
|
-
};
|
|
40
|
-
const resetIdleTimer = () => {
|
|
41
|
-
if (!PROVIDER_SSE_IDLE_WATCHDOG_ENABLED) return;
|
|
42
|
-
if (idleTimer) clearTimeout(idleTimer);
|
|
43
|
-
idleTimer = setTimeout(() => {
|
|
44
|
-
idleTimedOut = true;
|
|
45
|
-
if (inFlightReject) {
|
|
46
|
-
const r = inFlightReject;
|
|
47
|
-
inFlightReject = null;
|
|
48
|
-
cancellation.rejectAfterCancellation(r, idleError());
|
|
49
|
-
}
|
|
50
|
-
}, PROVIDER_SSE_IDLE_TIMEOUT_MS);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
get sawStreamChunk() {
|
|
55
|
-
return sawStreamChunk;
|
|
56
|
-
},
|
|
57
|
-
get idleTimedOut() {
|
|
58
|
-
return idleTimedOut;
|
|
59
|
-
},
|
|
60
|
-
idleError,
|
|
61
|
-
// Arm both watchdogs once the abort listener is in place.
|
|
62
|
-
arm() {
|
|
63
|
-
armFirstByteTimer();
|
|
64
|
-
resetIdleTimer();
|
|
65
|
-
},
|
|
66
|
-
clearFirstByte: clearFirstByteTimer,
|
|
67
|
-
// Stop every watchdog (completion or the finally path).
|
|
68
|
-
stop() {
|
|
69
|
-
clearFirstByteTimer();
|
|
70
|
-
if (idleTimer) clearTimeout(idleTimer);
|
|
71
|
-
},
|
|
72
|
-
// External abort: fail the pending read now; the SDK iterator may
|
|
73
|
-
// propagate the transport abort only after its own asynchronous cleanup.
|
|
74
|
-
rejectPending(err) {
|
|
75
|
-
if (!inFlightReject) return;
|
|
76
|
-
const r = inFlightReject;
|
|
77
|
-
clearPending();
|
|
78
|
-
r(err);
|
|
79
|
-
},
|
|
80
|
-
// Resolve the next SDK step with its reject handle registered for the
|
|
81
|
-
// watchdogs; a settlement after a forced cancellation reports that failure.
|
|
82
|
-
next() {
|
|
83
|
-
return new Promise((resolve, reject) => {
|
|
84
|
-
inFlightReject = reject;
|
|
85
|
-
if (!sawStreamChunk) firstByteReject = reject;
|
|
86
|
-
iterator.next().then(
|
|
87
|
-
(value) => {
|
|
88
|
-
clearPending();
|
|
89
|
-
if (!cancellation.settleForced(reject)) resolve(value);
|
|
90
|
-
},
|
|
91
|
-
(err) => {
|
|
92
|
-
clearPending();
|
|
93
|
-
if (!cancellation.settleForced(reject)) reject(err);
|
|
94
|
-
}
|
|
95
|
-
);
|
|
96
|
-
});
|
|
97
|
-
},
|
|
98
|
-
// A delivered chunk retires the first-byte timer and restarts the idle
|
|
99
|
-
// watchdog.
|
|
100
|
-
noteChunk() {
|
|
101
|
-
if (!sawStreamChunk) {
|
|
102
|
-
sawStreamChunk = true;
|
|
103
|
-
clearFirstByteTimer();
|
|
104
|
-
}
|
|
105
|
-
resetIdleTimer();
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
}
|