mixdog 1.4.3 → 1.4.4

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.
Files changed (80) hide show
  1. package/package.json +1 -1
  2. package/src/defaults/shipped-history.json +4 -0
  3. package/src/defaults/skills/computer-use/SKILL.md +14 -3
  4. package/src/defaults/skills/memory-management/SKILL.md +10 -5
  5. package/src/defaults/skills/setup/references/actions.md +1 -1
  6. package/src/rules/agent-mode/MIXY.md +5 -3
  7. package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +2 -1
  8. package/src/runtime/agent/orchestrator/providers/anthropic-api-request.mjs +11 -1
  9. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events/content-block-start.mjs +4 -0
  10. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-outcome.mjs +2 -0
  11. package/src/runtime/agent/orchestrator/providers/anthropic-turn-result.mjs +2 -0
  12. package/src/runtime/agent/orchestrator/providers/anthropic.mjs +2 -0
  13. package/src/runtime/agent/orchestrator/providers/custom-provider-config.mjs +121 -9
  14. package/src/runtime/agent/orchestrator/providers/custom-provider.mjs +4 -1
  15. package/src/runtime/agent/orchestrator/providers/lib/generation-window.mjs +9 -0
  16. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-send.mjs +9 -1
  17. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-result.mjs +2 -0
  18. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-state.mjs +5 -0
  19. package/src/runtime/agent/orchestrator/providers/openai-compat-options.mjs +3 -0
  20. package/src/runtime/agent/orchestrator/providers/openai-compat-response-normalization.mjs +2 -0
  21. package/src/runtime/agent/orchestrator/providers/openai-compat-responses.mjs +10 -1
  22. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-events.mjs +3 -0
  23. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-outcome.mjs +2 -0
  24. package/src/runtime/agent/orchestrator/providers/openai-ws-response-state.mjs +9 -2
  25. package/src/runtime/agent/orchestrator/providers/openrouter-provider-routing.mjs +28 -0
  26. package/src/runtime/agent/orchestrator/providers/openrouter.mjs +4 -1
  27. package/src/runtime/agent/orchestrator/providers/registry.mjs +30 -25
  28. package/src/runtime/agent/orchestrator/runtime-core/ask-user-result.mjs +66 -0
  29. package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +8 -1
  30. package/src/runtime/agent/orchestrator/session/store.mjs +12 -6
  31. package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-output-silence.mjs +64 -0
  32. package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-task-output.mjs +20 -6
  33. package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +12 -1
  34. package/src/runtime/channels/lib/routines-db.mjs +35 -0
  35. package/src/runtime/channels/lib/schedules-db.mjs +4 -0
  36. package/src/runtime/channels/lib/webhooks-db.mjs +4 -0
  37. package/src/runtime/computer-bridge/action-schema.mjs +2 -2
  38. package/src/runtime/computer-bridge/core-actions.mjs +16 -2
  39. package/src/runtime/computer-bridge/result-canonical.mjs +6 -0
  40. package/src/runtime/memory/tool-defs.mjs +1 -1
  41. package/src/runtime/shared/llm/usage-accounting.mjs +110 -19
  42. package/src/runtime/shared/llm/usage-context.mjs +1 -1
  43. package/src/runtime/shared/llm/usage-ledger-quota.mjs +2 -0
  44. package/src/runtime/shared/llm/usage-ledger-requests.mjs +183 -0
  45. package/src/runtime/shared/llm/usage-ledger-rollup.mjs +7 -3
  46. package/src/runtime/shared/llm/usage-ledger-worker.mjs +2 -0
  47. package/src/runtime/shared/llm/usage-ledger.mjs +57 -1
  48. package/src/runtime/shared/llm/usage-request-status.mjs +48 -0
  49. package/src/runtime/shared/tool-result-summary.mjs +1 -1
  50. package/src/session-runtime/agent-home-delivery.mjs +76 -8
  51. package/src/session-runtime/agent-task-sessions.mjs +63 -22
  52. package/src/session-runtime/boot/apis.mjs +15 -0
  53. package/src/session-runtime/boot/tools.mjs +8 -2
  54. package/src/session-runtime/internal-tool-executor/ask-user-tool.mjs +3 -58
  55. package/src/session-runtime/model-route/route-persist.mjs +12 -4
  56. package/src/session-runtime/provider-models/row-hydration.mjs +2 -0
  57. package/src/session-runtime/routine-owner.mjs +9 -3
  58. package/src/session-runtime/services/agent-task-status.mjs +29 -1
  59. package/src/session-runtime/services/agent-tool/job-views/session-progress.mjs +3 -0
  60. package/src/session-runtime/services/agent-tool/render.mjs +6 -1
  61. package/src/session-runtime/services/channel-admin.mjs +44 -3
  62. package/src/session-runtime/services/plugin-admin.mjs +46 -7
  63. package/src/session-runtime/services/provider-admin.mjs +5 -0
  64. package/src/session-runtime/setup-tool/agent-settings-actions.mjs +1 -1
  65. package/src/session-runtime/setup-tool/executor.mjs +1 -1
  66. package/src/session-runtime/setup-tool/extended-actions.mjs +1 -1
  67. package/src/session-runtime/setup-tool/settings-contract.mjs +2 -2
  68. package/src/session-runtime/usage-stats-api.mjs +117 -1
  69. package/src/session-runtime/workflow-agents-api/agent-connectors.mjs +36 -29
  70. package/src/session-runtime/workflow-agents-api/agent-editor.mjs +183 -23
  71. package/src/standalone/session-protocol.mjs +1 -0
  72. package/src/standalone/session-service/retention/busy.mjs +3 -2
  73. package/src/tui/app/model-picker/model-footer.mjs +1 -1
  74. package/src/tui/app/model-picker/provider-models-list.mjs +7 -3
  75. package/src/tui/app/model-picker/route-selection/fast-parameters.mjs +23 -3
  76. package/src/tui/app/model-picker/route-selection.mjs +1 -0
  77. package/src/tui/dist/index.mjs +41 -7
  78. package/src/tui/session/session-api/integrations.mjs +3 -0
  79. package/src/tui/session/tool-approval-settle.mjs +24 -4
  80. package/src/tui/session/tool-approval.mjs +35 -10
@@ -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
- const publishHandoffQuestions = () => set({ handoffQuestions: handoffQuestions.map((entry) => entry.request) });
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 (!getDisposed()) publishHandoffQuestions();
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.findIndex((entry) => entry.id === targetId);
158
- if (question >= 0) {
159
- const [entry] = handoffQuestions.splice(question, 1);
160
- publishHandoffQuestions();
161
- return forwardToOwner(entry, approved, reason, device, answers, reply, extra);
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);