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
package/src/lib/keychain-cjs.cjs
CHANGED
|
@@ -32,6 +32,13 @@ let _cacheEpoch = 0;
|
|
|
32
32
|
// DPAPI PowerShell hosts for the same startup.
|
|
33
33
|
let _prewarmPromise = null;
|
|
34
34
|
|
|
35
|
+
// The desktop's toast for a failing secret store, raised once per process
|
|
36
|
+
// (src/runtime/shared/desktop-notice-host.mjs). This CommonJS module cannot
|
|
37
|
+
// import that ESM file, so it reaches the registry the file shares globally.
|
|
38
|
+
function _noticeSecretStoreFailure() {
|
|
39
|
+
globalThis[Symbol.for('mixdog.desktopNoticeHost.v1')]?.raise?.('secret-storage', 'secret-storage-failed');
|
|
40
|
+
}
|
|
41
|
+
|
|
35
42
|
function _cacheGet(account) {
|
|
36
43
|
const key = `${SERVICE}\0${account}`;
|
|
37
44
|
const entry = _secretCache.get(key);
|
|
@@ -682,6 +689,9 @@ function _noteKeychainFailure(error) {
|
|
|
682
689
|
// (KEYRING_UNREACHABLE: gdbus missing, unparsable reply) proves nothing, so
|
|
683
690
|
// it keeps its warning and recovery action.
|
|
684
691
|
_keychainStatus = { state, message, unavailable: error?.code === KEYRING_UNAVAILABLE };
|
|
692
|
+
// No provider at all means the private secrets file serves instead (a
|
|
693
|
+
// working store), and an inconclusive passive probe proves no failure.
|
|
694
|
+
if (error?.code !== KEYRING_UNAVAILABLE && error?.code !== 'KEYRING_UNREACHABLE') _noticeSecretStoreFailure();
|
|
685
695
|
}
|
|
686
696
|
|
|
687
697
|
// Sync entry points feed the same health the async ones do (Linux only).
|
|
@@ -1317,7 +1327,12 @@ function getSecret(account) {
|
|
|
1317
1327
|
// Unreadable keychain (no provider, locked, not read yet): a secret saved
|
|
1318
1328
|
// to the fallback file is still there; otherwise the keychain error stands.
|
|
1319
1329
|
const stored = fallbackGetQuiet(account);
|
|
1320
|
-
if (stored == null)
|
|
1330
|
+
if (stored == null) {
|
|
1331
|
+
// A Linux read also throws while the keyring is still being read at
|
|
1332
|
+
// startup; its real failures are reported by _noteKeychainFailure.
|
|
1333
|
+
if (platform() !== 'linux') _noticeSecretStoreFailure();
|
|
1334
|
+
throw error;
|
|
1335
|
+
}
|
|
1321
1336
|
return stored;
|
|
1322
1337
|
}
|
|
1323
1338
|
_cacheSet(account, value);
|
|
@@ -1350,6 +1365,9 @@ function setSecret(account, value) {
|
|
|
1350
1365
|
viaFile = true;
|
|
1351
1366
|
}
|
|
1352
1367
|
stored = true;
|
|
1368
|
+
} catch (error) {
|
|
1369
|
+
_noticeSecretStoreFailure();
|
|
1370
|
+
throw error;
|
|
1353
1371
|
} finally {
|
|
1354
1372
|
_cacheInvalidate(account);
|
|
1355
1373
|
// Linux reads are cache-only, so a fresh keychain write must stay readable.
|
|
@@ -1415,6 +1433,9 @@ async function setSecretAsync(account, value) {
|
|
|
1415
1433
|
viaFile = true;
|
|
1416
1434
|
}
|
|
1417
1435
|
stored = true;
|
|
1436
|
+
} catch (error) {
|
|
1437
|
+
_noticeSecretStoreFailure();
|
|
1438
|
+
throw error;
|
|
1418
1439
|
} finally {
|
|
1419
1440
|
_cacheInvalidate(account);
|
|
1420
1441
|
if (stored && !viaFile) _cacheSet(account, value);
|
|
@@ -396,7 +396,7 @@ function buildRouteRulesContent({
|
|
|
396
396
|
const LEAD_IDENTITY_LINE = /^- (You are Mixdog, a coding agent\.)\n/m;
|
|
397
397
|
const LEAD_PROGRESS_PASSAGE = / (Before your first tool call, briefly state[\s\S]*?narration or plan repeats\.)/;
|
|
398
398
|
// Word gaps are \s+ so rewrapping LEAD.md cannot silently unmatch a passage.
|
|
399
|
-
const LEAD_REPORT_PASSAGE = / (On\s+an\s+agent\s+report[\s\S]*?
|
|
399
|
+
const LEAD_REPORT_PASSAGE = / (On\s+an\s+agent\s+report[\s\S]*?never\s+report\s+it\s+as\s+done\.)/;
|
|
400
400
|
const AGENT_MODE_PROGRESS =
|
|
401
401
|
'- Just answer conversation. Quick tool use (checking memory, a lookup,\n' +
|
|
402
402
|
' leaving a reaction) needs no announcement. When starting longer work\n' +
|
package/src/rules/agent/AGENT.md
CHANGED
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
once, and if the cause isn't found, stop and report it with the decisive
|
|
11
11
|
error. Changing only a timeout, output path, retry count or wrapper is not
|
|
12
12
|
a relevant change. This holds even when the brief asks for the check.
|
|
13
|
+
- Complete the brief fully: every part your tools can do, without
|
|
14
|
+
gold-plating and without leaving it half-done. `partial` or `blocked` is
|
|
15
|
+
only for a part you truly cannot do; name it and why under Open.
|
|
13
16
|
- Communicate in English. Call tools immediately, with no preamble or
|
|
14
17
|
progress text.
|
|
15
18
|
- Reporting: send one final message, then stop; never ask whether to
|
|
@@ -18,9 +18,11 @@
|
|
|
18
18
|
session run by Lead and agents is "agent mode" (에이전트 모드). A session
|
|
19
19
|
you start with `session create` is an "agent task session" (에이전트 작업
|
|
20
20
|
세션); any other is a "session" (세션). Use those words with the user.
|
|
21
|
-
- You coordinate the user's bots and agents
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
- You coordinate the user's bots and agents. What you can settle in this
|
|
22
|
+
reply with a few quick lookups, you answer yourself. Work that needs its
|
|
23
|
+
own investigation or writing and a report back goes to the bot whose role
|
|
24
|
+
fits it (Bots), or to a sub-agent when no bot's role fits; an agent task
|
|
25
|
+
session only for a big multi-step plan.
|
|
24
26
|
- Asked how the bots are doing, what they did or what is pending, call
|
|
25
27
|
`session` action `bots` first (with a bot's id for its recent sessions) and
|
|
26
28
|
answer from it. Each bot's chat is `sess_home_<id>`; `session read` opens it.
|
package/src/rules/lead/LEAD.md
CHANGED
|
@@ -35,4 +35,6 @@
|
|
|
35
35
|
beyond docs/copy/style or one-line changes gets one fresh Reviewer, any
|
|
36
36
|
author (Lead reviews when none is available); recheck only fixes. Before
|
|
37
37
|
commit/report, check cross-feature seams. Pending agent work is not a
|
|
38
|
-
completed request
|
|
38
|
+
completed request: send the rest of a `partial` or `blocked` report back
|
|
39
|
+
to the same tag, and tell the user what still could not be done; never
|
|
40
|
+
report it as done.
|
|
@@ -42,14 +42,7 @@
|
|
|
42
42
|
* prompt_cache_options.ttl: "30m" (default, writes 1.25x input) or "12h"
|
|
43
43
|
* (writes 2.5x); reads 0.1x (0.05x on GPT-6.1 Sol) either way. Earlier
|
|
44
44
|
* models keep prompt_cache_retention '24h' on the extended-retention list.
|
|
45
|
-
*
|
|
46
|
-
* explicit "12h" breakpoint at the end of the stable prefix (tools +
|
|
47
|
-
* instructions + environment developer item; top-level instructions
|
|
48
|
-
* cannot carry a breakpoint). Break-even: the 12h write costs
|
|
49
|
-
* (2.5-1.25)=1.25x the prefix once per 12h window, every gap > 30m saves
|
|
50
|
-
* a 1.25x rewrite for a 0.1x read (1.15x), so it pays from ~1.09 long gaps
|
|
51
|
-
* per 12h — an hourly routine or a returning user pays it back many times;
|
|
52
|
-
* a short sub-agent never sees one, so agents stay on "30m".
|
|
45
|
+
* Every session sends ttl "30m"; "12h" is not used.
|
|
53
46
|
* - OpenAI OAuth (Codex/ChatGPT login): prompt_cache_key only, request body
|
|
54
47
|
* unchanged. Since 2026-10-20 OpenAI keeps the cache of logged-in Codex
|
|
55
48
|
* users indefinitely ("we keep cache forever … guaranteed to hit the
|
|
@@ -150,7 +143,7 @@ export function resolveLeadMessagesTtl(autoClear) {
|
|
|
150
143
|
* compacted transcript instead of the whole accumulated tail. Replayed agent
|
|
151
144
|
* cost vs a 1h tail: -24.6% with that compaction, +2.7% without it.
|
|
152
145
|
* (These tiers only drive explicit-breakpoint providers — Anthropic. OpenAI's
|
|
153
|
-
*
|
|
146
|
+
* lifetime is providerTailCacheLifetimeMs;
|
|
154
147
|
* the 5m-vs-1h reasoning does not apply to openai-oauth, whose cache does
|
|
155
148
|
* not expire.)
|
|
156
149
|
*
|
|
@@ -191,20 +184,11 @@ export function resolveCacheStrategy(agent, { autoClear, session = null } = {})
|
|
|
191
184
|
return applyEnv({ tools: 'none', system: '1h', tier3: '1h', messages: resolveLeadMessagesTtl(autoClear) });
|
|
192
185
|
}
|
|
193
186
|
|
|
194
|
-
// OpenAI public API, GPT-5.6+ Responses: the moving tail rides the request
|
|
195
|
-
// ttl "30m"; Lead-class sessions pin their stable prefix with one "12h"
|
|
196
|
-
// breakpoint (header: break-even). Earlier models' typical retention is
|
|
197
|
-
// ~30 min as well.
|
|
198
|
-
const OPENAI_LEAD_PREFIX_CACHE_TTL = '12h';
|
|
199
187
|
export const ANTHROPIC_TAIL_LIFETIME_MS = Object.freeze({ '5m': 5 * 60_000, '1h': 60 * 60_000 });
|
|
188
|
+
// OpenAI public API, GPT-5.6+ Responses: request ttl "30m". Earlier models'
|
|
189
|
+
// typical retention is ~30 min as well.
|
|
200
190
|
const OPENAI_TAIL_LIFETIME_MS = 30 * 60_000;
|
|
201
191
|
|
|
202
|
-
/** The OpenAI (API key) stable-prefix TTL for a session: '12h' for the Lead
|
|
203
|
-
* class, null (request default "30m" only) for sub-agents and hidden roles. */
|
|
204
|
-
export function resolveOpenAiPrefixCacheTtl(agent, session = null) {
|
|
205
|
-
return isLeadCacheClass(agent, session) ? OPENAI_LEAD_PREFIX_CACHE_TTL : null;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
192
|
/**
|
|
209
193
|
* Single source of truth for how long a session's message-tail cache stays
|
|
210
194
|
* readable, per provider, in ms. null = no expiring tail to act on: the cache
|
|
@@ -212,7 +196,7 @@ export function resolveOpenAiPrefixCacheTtl(agent, session = null) {
|
|
|
212
196
|
* or the provider exposes no tail lifetime. Any "compact or clear because the
|
|
213
197
|
* tail cache expired" rule must read this.
|
|
214
198
|
* - openai-oauth → null (permanent; never compact for cache reasons)
|
|
215
|
-
* - openai → 30m (request ttl "30m"
|
|
199
|
+
* - openai → 30m (request ttl "30m")
|
|
216
200
|
* - Anthropic → the session cacheStrategy.messages tier (5m / 1h)
|
|
217
201
|
*/
|
|
218
202
|
export function providerTailCacheLifetimeMs(provider, cacheStrategy = null) {
|
|
@@ -559,7 +543,7 @@ function oneShotPromptCacheOpts(agent) {
|
|
|
559
543
|
* schemas are the same bytes on every call (the explore tool's explorers):
|
|
560
544
|
* keyed on that prefix, never per call, on the default 5m tier. The parallel
|
|
561
545
|
* explorers of a fan-out and the next calls minutes later are its only
|
|
562
|
-
* readers, so the Lead's 1h
|
|
546
|
+
* readers, so the Lead's 1h tier would only raise the write price.
|
|
563
547
|
*/
|
|
564
548
|
export function sharedPrefixProviderCacheOpts(provider) {
|
|
565
549
|
const shared = { promptCacheScope: 'shared' };
|
|
@@ -569,8 +553,8 @@ export function sharedPrefixProviderCacheOpts(provider) {
|
|
|
569
553
|
|
|
570
554
|
/**
|
|
571
555
|
* Cache send options for a role's requests on `provider`: the breakpoint
|
|
572
|
-
* strategy on explicit-breakpoint providers, the
|
|
573
|
-
*
|
|
556
|
+
* strategy on explicit-breakpoint providers, plus the one-shot shared scope.
|
|
557
|
+
* Session and
|
|
574
558
|
* session-less callers use this one resolution; `options.session` (record or
|
|
575
559
|
* create options) classifies agent-mode Leads such as bot home threads.
|
|
576
560
|
*/
|
|
@@ -580,12 +564,6 @@ export function roleProviderCacheOpts(provider, agent, options = {}) {
|
|
|
580
564
|
|
|
581
565
|
export function buildProviderCacheOpts(provider, _sessionId, agent, options = {}) {
|
|
582
566
|
const capability = cacheCapabilityForProvider(provider);
|
|
583
|
-
if (provider === 'openai') {
|
|
584
|
-
// Read by applyOpenAIDirectCachePolicy (GPT-5.6+ Responses only).
|
|
585
|
-
const prefixTtl = resolveOpenAiPrefixCacheTtl(agent, options.session);
|
|
586
|
-
const opts = { ...(prefixTtl ? { promptCachePrefixTtl: prefixTtl } : {}), ...oneShotPromptCacheOpts(agent) };
|
|
587
|
-
return Object.keys(opts).length ? opts : null;
|
|
588
|
-
}
|
|
589
567
|
if (capability !== 'explicit-breakpoint') return oneShotPromptCacheOpts(agent);
|
|
590
568
|
// 2026-03-06 Anthropic dropped default TTL 1h→5m. We request 1h via
|
|
591
569
|
// cache_control ttl:"1h"; no beta header is required.
|
|
@@ -62,6 +62,11 @@ export function createTitleCompletion(deps = {}) {
|
|
|
62
62
|
effort: String(route.effort || '').trim() || 'low',
|
|
63
63
|
fast: route.fast === true,
|
|
64
64
|
maxOutputTokens: 128,
|
|
65
|
+
// The spend belongs to the session being titled, and the request log
|
|
66
|
+
// names it a title call. `usageSessionId` only attributes the usage
|
|
67
|
+
// record: the provider still sees a one-shot, sessionless request.
|
|
68
|
+
...(options.sessionId ? { usageSessionId: String(options.sessionId) } : {}),
|
|
69
|
+
sourceType: 'session-title',
|
|
65
70
|
// Background call: an overloaded provider is not retried (nobody is
|
|
66
71
|
// waiting on a title, and every retry adds load during a cascade).
|
|
67
72
|
retry529: false,
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { anySignal, loginFailed, reauthenticationRequired } from './oauth-shared.mjs';
|
|
2
|
+
import { clearDesktopNotice, raiseDesktopNotice } from '../../../shared/desktop-notice-host.mjs';
|
|
3
|
+
|
|
4
|
+
// A sign-in that worked was refused and could not be renewed: the desktop says
|
|
5
|
+
// so once per server until a request carrying its token succeeds (2xx) again.
|
|
6
|
+
const signInNoticeKey = (serverName) => `connector-sign-in:${serverName}`;
|
|
7
|
+
function signInExpired(serverName) {
|
|
8
|
+
if (serverName) raiseDesktopNotice(signInNoticeKey(serverName), 'connector-sign-in-expired', { name: serverName });
|
|
9
|
+
}
|
|
2
10
|
|
|
3
11
|
/**
|
|
4
12
|
* The authenticated `fetch` of one server over its credential `cache`: it
|
|
@@ -90,7 +98,10 @@ export function createAuthorizedFetch({ url, cache, login, fetchImpl, lifetimeSi
|
|
|
90
98
|
const { response } = sent;
|
|
91
99
|
const attemptedToken = sent.tokens;
|
|
92
100
|
storeUnreadable ||= sent.unreadable;
|
|
93
|
-
if (!sameOrigin || ![401, 403].includes(response.status))
|
|
101
|
+
if (!sameOrigin || ![401, 403].includes(response.status)) {
|
|
102
|
+
if (sameOrigin && attemptedToken && response.ok && serverName) clearDesktopNotice(signInNoticeKey(serverName));
|
|
103
|
+
return response;
|
|
104
|
+
}
|
|
94
105
|
const { extractWWWAuthenticateParams } = await import('@modelcontextprotocol/sdk/client/auth.js');
|
|
95
106
|
const challenge = extractWWWAuthenticateParams(response);
|
|
96
107
|
if (response.status === 403 && challenge.error !== 'insufficient_scope') return response;
|
|
@@ -99,7 +110,13 @@ export function createAuthorizedFetch({ url, cache, login, fetchImpl, lifetimeSi
|
|
|
99
110
|
if (!flight && creds.tokens === attemptedToken) {
|
|
100
111
|
startLogin(challenge, requestLogin, browser, attemptedToken, serverName);
|
|
101
112
|
}
|
|
102
|
-
|
|
113
|
+
try {
|
|
114
|
+
if (flight) await awaitLogin(signal, onAuthorized);
|
|
115
|
+
} catch (error) {
|
|
116
|
+
// The stored sign-in was sent and refused, and its renewal needs the user.
|
|
117
|
+
if (attemptedToken && error?.code === 'reauthenticationRequired') signInExpired(serverName);
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
103
120
|
lifetimeSignal.throwIfAborted();
|
|
104
121
|
signal.throwIfAborted();
|
|
105
122
|
const retry = await sendRequest(input, options, signal, sameOrigin);
|
|
@@ -114,8 +131,10 @@ export function createAuthorizedFetch({ url, cache, login, fetchImpl, lifetimeSi
|
|
|
114
131
|
},
|
|
115
132
|
{ expected: retry.revision }
|
|
116
133
|
);
|
|
134
|
+
if (attemptedToken) signInExpired(serverName);
|
|
117
135
|
throw reauthenticationRequired();
|
|
118
136
|
}
|
|
137
|
+
if (retry.tokens && retried.ok && serverName) clearDesktopNotice(signInNoticeKey(serverName));
|
|
119
138
|
return retried;
|
|
120
139
|
}
|
|
121
140
|
return { fetch: authorizedFetch, cancelLogin: () => flightController?.abort() };
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
ACCOUNT_PROVIDERS,
|
|
3
3
|
MAX_ACCOUNTS,
|
|
4
4
|
accountScopedSessionId,
|
|
5
|
+
noteAccountScopedSessionId,
|
|
5
6
|
readProviderAccountPool,
|
|
6
7
|
chooseProviderAccount,
|
|
7
8
|
selectProviderAccountIf,
|
|
@@ -179,6 +180,8 @@ function boundAccountSend(providerName, row, messages, options, servedBy = repla
|
|
|
179
180
|
// An explicit empty executor (model-proxy host) must stay empty.
|
|
180
181
|
opts.toolExecutionSessionId = options.toolExecutionSessionId ?? options.sessionId;
|
|
181
182
|
opts.sessionId = accountScopedSessionId(providerName, row.id, options.sessionId);
|
|
183
|
+
// Closing the visible session must reach the connections keyed by it.
|
|
184
|
+
noteAccountScopedSessionId(options.sessionId, opts.sessionId);
|
|
182
185
|
// The spend still belongs to the visible session (usage-accounting.mjs).
|
|
183
186
|
opts.usageSessionId = options.usageSessionId || options.sessionId;
|
|
184
187
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
import {
|
|
2
|
+
import { runtimeAsyncLocalStorage } from '../../../shared/root-async-context.mjs';
|
|
3
3
|
import { PRIORITY_RANK, normalizePriority, resourceAdmission } from '../../../shared/resource-admission.mjs';
|
|
4
4
|
import { accountProviderSend } from '../../../shared/llm/usage-accounting.mjs';
|
|
5
5
|
import { sanitizeSurrogates } from '../../../shared/llm/well-formed.mjs';
|
|
@@ -20,7 +20,7 @@ const PROVIDER_ACCOUNT_MAX_QUEUE = 1024;
|
|
|
20
20
|
// request because their scope can differ by model.
|
|
21
21
|
const PROVIDER_COOLDOWN_FAIL_FAST_MS = 60_000;
|
|
22
22
|
const MAX_TIMEOUT_MS = 2_147_483_647;
|
|
23
|
-
const currentAdmission =
|
|
23
|
+
const currentAdmission = runtimeAsyncLocalStorage();
|
|
24
24
|
export function currentProviderAdmissionOwner() {
|
|
25
25
|
const active = currentAdmission.getStore();
|
|
26
26
|
return active?.ownerKey ? String(active.ownerKey) : null;
|
|
@@ -601,7 +601,8 @@ export function wrapProviderAdmission(provider, providerName, scheduler = provid
|
|
|
601
601
|
return accountProviderSend(
|
|
602
602
|
providerName,
|
|
603
603
|
this,
|
|
604
|
-
|
|
604
|
+
// Accounting hands back the options with its first-output probe.
|
|
605
|
+
(accountedOpts) => originalSend.call(this, messages, model, tools, accountedOpts),
|
|
605
606
|
model,
|
|
606
607
|
admittedOpts
|
|
607
608
|
);
|
|
@@ -20,6 +20,7 @@ import { applyAnthropicServerFallback } from './anthropic-server-fallback.mjs';
|
|
|
20
20
|
import { fastModeAvailable } from './anthropic-fast-mode.mjs';
|
|
21
21
|
import { applyAnthropicEffortToBody, shouldIncludeEffortBeta } from './anthropic-effort.mjs';
|
|
22
22
|
import { isCustomProviderName, resolveCustomReasoning } from './custom-reasoning.mjs';
|
|
23
|
+
import { applyCustomRequestBody, customRequestHeaders } from './custom-provider-config.mjs';
|
|
23
24
|
import {
|
|
24
25
|
anthropicThinkingActive,
|
|
25
26
|
anthropicTurnScopedReminders,
|
|
@@ -73,6 +74,8 @@ export async function buildAnthropicApiRequest({
|
|
|
73
74
|
capabilityModel = useModel,
|
|
74
75
|
// A gateway-supplied output limit for the model; wins over the Anthropic catalog.
|
|
75
76
|
modelMaxOutputTokens = opts?.modelMaxOutputTokens ?? null,
|
|
77
|
+
// A custom provider's normalized config: its extra request JSON and headers.
|
|
78
|
+
customConfig = null,
|
|
76
79
|
}) {
|
|
77
80
|
// A user-defined provider's reasoning comes from its own model row only:
|
|
78
81
|
// the global by-model-id capability index and the Claude-id ladders are
|
|
@@ -171,6 +174,11 @@ export async function buildAnthropicApiRequest({
|
|
|
171
174
|
gatewayEffort,
|
|
172
175
|
effortProjection,
|
|
173
176
|
});
|
|
177
|
+
// User-defined extra fields (e.g. `thinking`) go over the body before the
|
|
178
|
+
// tool_choice guard, so a forced choice is still dropped while the merged
|
|
179
|
+
// body has thinking on. The app-owned keys (model, messages, tools, stream,
|
|
180
|
+
// tool_choice, …) are refused inside.
|
|
181
|
+
if (isCustom && customConfig) applyCustomRequestBody(params, customConfig, useModel);
|
|
174
182
|
if (params.tools) resolveRequestToolChoice(params, opts, config);
|
|
175
183
|
// Fast mode → speed: "fast" on models Anthropic marks as speed-capable.
|
|
176
184
|
// Suppressed while the fast capacity pool is cooling down.
|
|
@@ -197,7 +205,9 @@ export async function buildAnthropicApiRequest({
|
|
|
197
205
|
capabilityModel,
|
|
198
206
|
effortProjection,
|
|
199
207
|
});
|
|
200
|
-
const
|
|
208
|
+
const appHeaders = requestHeadersFor(betas, { config, opts });
|
|
209
|
+
const requestHeaders =
|
|
210
|
+
isCustom && customConfig ? customRequestHeaders(customConfig, useModel, appHeaders) : appHeaders;
|
|
201
211
|
|
|
202
212
|
// `betas`: the selected beta names, whether or not this route sends them as a header.
|
|
203
213
|
return { params, requestHeaders, betas, knownToolNames, fastModeLatched: fastLatched };
|
|
@@ -172,6 +172,8 @@ export function createAnthropicApiTransport({
|
|
|
172
172
|
// short Retry-After and upstream can read quota hints.
|
|
173
173
|
err.headers = res.headers;
|
|
174
174
|
err.response = { status: res.status, headers: res.headers };
|
|
175
|
+
// The full error body: thread error codes sit past the message cut.
|
|
176
|
+
err.responseBody = text;
|
|
175
177
|
// This is an initial-response 429, before SSE
|
|
176
178
|
// output/tool exposure, so the request-local
|
|
177
179
|
// withRetry loop may retry it with jitter.
|