maka-agent 0.2.0-dev.23.20260906 → 0.2.0-dev.25.20260908

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 (215) hide show
  1. package/README.md +38 -19
  2. package/README.zh-CN.md +34 -19
  3. package/dist/acp/maka-acp-agent.js +2 -1
  4. package/dist/acp/session-configuration.js +143 -0
  5. package/dist/acp/session-registry.js +90 -4
  6. package/dist/cli-core.js +2 -0
  7. package/dist/pi-transcript-tools.js +6 -0
  8. package/dist/pi-transcript.js +5 -12
  9. package/dist/pi-tui-layout.js +56 -10
  10. package/dist/pi-tui-pickers.js +102 -1
  11. package/dist/pi-tui-runner.js +230 -46
  12. package/dist/pi-tui-todo.js +221 -0
  13. package/dist/pi-tui-transcript-viewer.js +134 -7
  14. package/dist/runtime-host-cli-context.js +224 -78
  15. package/dist/runtime-host-cli-installation.js +8 -2
  16. package/dist/runtime-host-cli.js +31 -1
  17. package/dist/runtime-host-handoff-surface.js +106 -0
  18. package/dist/runtime-host-installed-update-bootstrap.js +13 -0
  19. package/dist/runtime-host-installed-update-coordinator.js +33 -0
  20. package/dist/runtime-host-lifecycle-transaction.js +9 -1
  21. package/dist/runtime-host-local-handoff.js +48 -5
  22. package/dist/runtime-host-local-managed-activation.js +84 -0
  23. package/dist/runtime-host-local-source-retirement.js +18 -2
  24. package/dist/runtime-host-managed-lifecycle-manager.js +1 -0
  25. package/dist/runtime-host-operator-retirement.js +50 -0
  26. package/dist/runtime-host-service-manager.js +3 -3
  27. package/dist/runtime-host-session-channel.js +13 -0
  28. package/dist/runtime-host-session-driver.js +46 -26
  29. package/dist/runtime-host-session-update.js +62 -0
  30. package/dist/runtime-host-tui-command.js +38 -73
  31. package/dist/runtime-host-tui-context.js +1 -0
  32. package/dist/runtime-host-tui-owner.js +226 -0
  33. package/dist/tui-copy-catalog.js +219 -6
  34. package/dist/tui-host-owner-copy.js +24 -0
  35. package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
  36. package/node_modules/@maka/core/dist/agent-run.js +1 -0
  37. package/node_modules/@maka/core/dist/attachments.js +3 -0
  38. package/node_modules/@maka/core/dist/canonical-json.js +27 -0
  39. package/node_modules/@maka/core/dist/canonical-runtime-event.js +3 -1
  40. package/node_modules/@maka/core/dist/capabilities.js +35 -0
  41. package/node_modules/@maka/core/dist/computer-use.js +0 -1
  42. package/node_modules/@maka/core/dist/display-redaction.js +18 -0
  43. package/node_modules/@maka/core/dist/llm-connections.js +13 -0
  44. package/node_modules/@maka/core/dist/model-call-attempt.js +2 -0
  45. package/node_modules/@maka/core/dist/model-failure.js +40 -0
  46. package/node_modules/@maka/core/dist/model-metadata.generated.js +4 -4
  47. package/node_modules/@maka/core/dist/model-metadata.js +7 -3
  48. package/node_modules/@maka/core/dist/model-web-search.js +5 -4
  49. package/node_modules/@maka/core/dist/provider-registry.js +45 -4
  50. package/node_modules/@maka/core/dist/record-schema.js +9 -2
  51. package/node_modules/@maka/core/dist/redaction.js +35 -0
  52. package/node_modules/@maka/core/dist/run-composition.js +77 -2
  53. package/node_modules/@maka/core/dist/runtime-boundary.js +31 -11
  54. package/node_modules/@maka/core/dist/runtime-event.js +37 -6
  55. package/node_modules/@maka/core/dist/runtime-handoff.js +98 -0
  56. package/node_modules/@maka/core/dist/runtime-invocation.js +1 -1
  57. package/node_modules/@maka/core/dist/runtime-logical-execution.js +112 -0
  58. package/node_modules/@maka/core/dist/session.js +84 -56
  59. package/node_modules/@maka/core/dist/slash-command-catalog.js +3 -0
  60. package/node_modules/@maka/core/dist/tool-result-archive-evidence.js +20 -0
  61. package/node_modules/@maka/core/dist/tool-result-record-schema.js +2 -1
  62. package/node_modules/@maka/core/dist/usage-record-schema.js +26 -35
  63. package/node_modules/@maka/core/package.json +5 -0
  64. package/node_modules/@maka/eval/dist/experiment-directory.js +4 -13
  65. package/node_modules/@maka/mcp/dist/index.js +131 -1
  66. package/node_modules/@maka/runtime/dist/agent-run-inspect.js +0 -13
  67. package/node_modules/@maka/runtime/dist/agent-run.js +351 -105
  68. package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +29 -13
  69. package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +109 -34
  70. package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +184 -183
  71. package/node_modules/@maka/runtime/dist/archive-read-tool.js +2 -2
  72. package/node_modules/@maka/runtime/dist/context-budget-helpers.js +0 -16
  73. package/node_modules/@maka/runtime/dist/context-budget.js +14 -9
  74. package/node_modules/@maka/runtime/dist/conversation-copy.js +158 -15
  75. package/node_modules/@maka/runtime/dist/github-copilot-oauth-enrollment.js +3 -3
  76. package/node_modules/@maka/runtime/dist/goal-continuation.js +36 -4
  77. package/node_modules/@maka/runtime/dist/history-compact-checkpoint.js +18 -9
  78. package/node_modules/@maka/runtime/dist/history-compact-summarizer.js +30 -22
  79. package/node_modules/@maka/runtime/dist/history-compaction.js +29 -4
  80. package/node_modules/@maka/runtime/dist/ledger-tool-result-archive-reader.js +174 -0
  81. package/node_modules/@maka/runtime/dist/mcp-tools.js +7 -2
  82. package/node_modules/@maka/runtime/dist/message-authority.js +9 -0
  83. package/node_modules/@maka/runtime/dist/model-adapter.js +19 -98
  84. package/node_modules/@maka/runtime/dist/model-factory.js +19 -81
  85. package/node_modules/@maka/runtime/dist/model-fetcher.js +49 -2
  86. package/node_modules/@maka/runtime/dist/model-history.js +0 -112
  87. package/node_modules/@maka/runtime/dist/model-runtime.js +85 -111
  88. package/node_modules/@maka/runtime/dist/native-web-search-tool.js +2 -1
  89. package/node_modules/@maka/runtime/dist/openai-codex-history-compactor.js +2 -2
  90. package/node_modules/@maka/runtime/dist/opencode-session-header.js +4 -2
  91. package/node_modules/@maka/runtime/dist/plugin-runtime.js +20 -10
  92. package/node_modules/@maka/runtime/dist/plugin-tool-service.js +205 -0
  93. package/node_modules/@maka/runtime/dist/provider-error-classification.js +84 -123
  94. package/node_modules/@maka/runtime/dist/provider-request-telemetry.js +76 -109
  95. package/node_modules/@maka/runtime/dist/request-shape.js +23 -0
  96. package/node_modules/@maka/runtime/dist/run-handoff-gate.js +97 -0
  97. package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +83 -55
  98. package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +121 -159
  99. package/node_modules/@maka/runtime/dist/runtime-kernel.js +157 -112
  100. package/node_modules/@maka/runtime/dist/runtime-ledger-repair.js +160 -79
  101. package/node_modules/@maka/runtime/dist/runtime-read-model.js +30 -89
  102. package/node_modules/@maka/runtime/dist/runtime-resume.js +80 -4
  103. package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +5 -0
  104. package/node_modules/@maka/runtime/dist/session-manager.js +171 -288
  105. package/node_modules/@maka/runtime/dist/session-projection-helpers.js +0 -27
  106. package/node_modules/@maka/runtime/dist/stream-graph-coordinator.js +21 -0
  107. package/node_modules/@maka/runtime/dist/stream-graph-supervisor-tools.js +0 -5
  108. package/node_modules/@maka/runtime/dist/subscription-model-fetch.js +3 -4
  109. package/node_modules/@maka/runtime/dist/test-connection.js +16 -17
  110. package/node_modules/@maka/runtime/dist/tool-activation-identity.js +41 -0
  111. package/node_modules/@maka/runtime/dist/tool-availability.js +11 -1
  112. package/node_modules/@maka/runtime/dist/tool-result-archive-encoding.js +38 -0
  113. package/node_modules/@maka/runtime/dist/tool-result-archive-resource.js +63 -1
  114. package/node_modules/@maka/runtime/dist/tool-result-archive-transition.js +42 -12
  115. package/node_modules/@maka/runtime/dist/tool-result-archive.js +27 -4
  116. package/node_modules/@maka/runtime/dist/tool-runtime.js +3 -61
  117. package/node_modules/@maka/runtime/package.json +2 -0
  118. package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +35 -0
  119. package/node_modules/@maka/runtime-host/dist/client/connect-or-spawn.js +9 -1
  120. package/node_modules/@maka/runtime-host/dist/client/connection.js +3 -0
  121. package/node_modules/@maka/runtime-host/dist/client/host-handoff-copy.js +179 -0
  122. package/node_modules/@maka/runtime-host/dist/client/host-handoff.js +275 -0
  123. package/node_modules/@maka/runtime-host/dist/client/host-retirement.js +26 -5
  124. package/node_modules/@maka/runtime-host/dist/client/index.js +2 -0
  125. package/node_modules/@maka/runtime-host/dist/client/launcher.js +3 -0
  126. package/node_modules/@maka/runtime-host/dist/client/remote-compatibility-error.js +2 -0
  127. package/node_modules/@maka/runtime-host/dist/client/session-subscription.js +46 -5
  128. package/node_modules/@maka/runtime-host/dist/control/endpoint.js +1 -3
  129. package/node_modules/@maka/runtime-host/dist/node-error.js +22 -0
  130. package/node_modules/@maka/runtime-host/dist/operator/index.js +2 -1
  131. package/node_modules/@maka/runtime-host/dist/operator/managed-deployment.js +1 -3
  132. package/node_modules/@maka/runtime-host/dist/operator/retirement-cancellation.js +20 -0
  133. package/node_modules/@maka/runtime-host/dist/peer-mesh/limits.js +0 -1
  134. package/node_modules/@maka/runtime-host/dist/peer-mesh/model.js +1 -1
  135. package/node_modules/@maka/runtime-host/dist/peer-reachability/publisher.js +1 -3
  136. package/node_modules/@maka/runtime-host/dist/protocol/host-status.js +21 -12
  137. package/node_modules/@maka/runtime-host/dist/protocol/index.js +29 -1
  138. package/node_modules/@maka/runtime-host/dist/protocol/operations.js +1 -0
  139. package/node_modules/@maka/runtime-host/dist/protocol/plan.js +1 -0
  140. package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +27 -5
  141. package/node_modules/@maka/runtime-host/dist/protocol/project-catalog.js +2 -2
  142. package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +40 -20
  143. package/node_modules/@maka/runtime-host/dist/protocol/session-transcript.js +0 -5
  144. package/node_modules/@maka/runtime-host/dist/protocol/session-turns.js +29 -58
  145. package/node_modules/@maka/runtime-host/dist/protocol/turn.js +11 -1
  146. package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +31 -2
  147. package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +1 -0
  148. package/node_modules/@maka/runtime-host/dist/server/agent-graph-coordinator.js +0 -3
  149. package/node_modules/@maka/runtime-host/dist/server/canonical-turn-snapshot.js +19 -4
  150. package/node_modules/@maka/runtime-host/dist/server/connection-session.js +7 -6
  151. package/node_modules/@maka/runtime-host/dist/server/execution-artifacts.js +32 -32
  152. package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +144 -33
  153. package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +5 -5
  154. package/node_modules/@maka/runtime-host/dist/server/execution-model-composition.js +45 -16
  155. package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +40 -1
  156. package/node_modules/@maka/runtime-host/dist/server/host-kernel.js +96 -17
  157. package/node_modules/@maka/runtime-host/dist/server/host-residency-registry.js +13 -7
  158. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-admission-registry.js +3 -1
  159. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-recovery.js +124 -62
  160. package/node_modules/@maka/runtime-host/dist/server/interactive-run-composer.js +47 -22
  161. package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +76 -6
  162. package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +6 -0
  163. package/node_modules/@maka/runtime-host/dist/server/plugin-platform.js +6 -0
  164. package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +325 -73
  165. package/node_modules/@maka/runtime-host/dist/server/scheduled-task-coordinator.js +37 -2
  166. package/node_modules/@maka/runtime-host/dist/server/serial-outbound-writer.js +45 -3
  167. package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +50 -7
  168. package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +87 -25
  169. package/node_modules/@maka/runtime-host/dist/server/session-retirement-coordinator.js +5 -2
  170. package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +12 -55
  171. package/node_modules/@maka/runtime-host/dist/server/session-sidecar-purge.js +1 -16
  172. package/node_modules/@maka/runtime-host/dist/server/session-transcript-pager.js +0 -1
  173. package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +460 -70
  174. package/node_modules/@maka/runtime-host/dist/server/shared-session-transcript.js +1 -1
  175. package/node_modules/@maka/runtime-host/dist/server/storage-maintenance.js +109 -0
  176. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +20 -2
  177. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +13 -4
  178. package/node_modules/@maka/runtime-host/dist/server/workhub-message-attachments.js +46 -0
  179. package/node_modules/@maka/storage/dist/artifact-store.js +21 -10
  180. package/node_modules/@maka/storage/dist/artifact-stores.js +1 -1
  181. package/node_modules/@maka/storage/dist/claude-code-session-adapter.js +0 -5
  182. package/node_modules/@maka/storage/dist/codex-session-adapter.js +284 -198
  183. package/node_modules/@maka/storage/dist/context-offload-snapshot.js +325 -0
  184. package/node_modules/@maka/storage/dist/execution-stores.js +9 -7
  185. package/node_modules/@maka/storage/dist/file-session-repository.js +1012 -0
  186. package/node_modules/@maka/storage/dist/git-exec.js +61 -0
  187. package/node_modules/@maka/storage/dist/git-worktree-child-executor.js +8 -35
  188. package/node_modules/@maka/storage/dist/goal-authority.js +2 -2
  189. package/node_modules/@maka/storage/dist/interaction-store.js +2 -2
  190. package/node_modules/@maka/storage/dist/opencode-session-adapter.js +0 -4
  191. package/node_modules/@maka/storage/dist/operational-state-backup.js +9 -5
  192. package/node_modules/@maka/storage/dist/project-catalog.js +2 -23
  193. package/node_modules/@maka/storage/dist/runtime-event-invariants.js +2 -2
  194. package/node_modules/@maka/storage/dist/runtime-event-persistence.js +1 -0
  195. package/node_modules/@maka/storage/dist/runtime-policy/connection-catalog-document.js +8 -3
  196. package/node_modules/@maka/storage/dist/runtime-transcript-query.js +308 -0
  197. package/node_modules/@maka/storage/dist/scheduled-task-store.js +249 -283
  198. package/node_modules/@maka/storage/dist/session-bundle-manifest.js +5 -17
  199. package/node_modules/@maka/storage/dist/session-bundle-policy.js +26 -5
  200. package/node_modules/@maka/storage/dist/session-copy-cleanup.js +2 -1
  201. package/node_modules/@maka/storage/dist/session-message-projection.js +15 -0
  202. package/node_modules/@maka/storage/dist/session-repository.js +767 -0
  203. package/node_modules/@maka/storage/dist/session-store.js +25 -99
  204. package/node_modules/@maka/storage/dist/sqlite-artifact-metadata.js +10 -3
  205. package/node_modules/@maka/storage/dist/sqlite-context-offload-store.js +24 -8
  206. package/node_modules/@maka/storage/dist/sqlite-core-execution-schema.js +7 -1
  207. package/node_modules/@maka/storage/dist/sqlite-runtime-schema.js +44 -1
  208. package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +130 -27
  209. package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +109 -892
  210. package/node_modules/@maka/storage/dist/storage-id.js +28 -0
  211. package/node_modules/@maka/storage/dist/tool-result-archive-evidence.js +138 -0
  212. package/node_modules/@maka/storage/dist/workspace-identity.js +2 -15
  213. package/node_modules/@maka/storage/dist/workspace-version-authority-internal.js +1 -8
  214. package/node_modules/@maka/storage/package.json +2 -0
  215. package/package.json +1 -1
@@ -17,6 +17,195 @@
17
17
  * under the License.
18
18
  */
19
19
  export const TUI_COPY_RESOURCES = {
20
+ todo: {
21
+ en: {
22
+ title: 'Current Todo',
23
+ markedComplete: 'marked complete',
24
+ open: '/todo to view',
25
+ usage: 'Usage: /todo',
26
+ progress: 'Todo',
27
+ unavailable: 'Todo unavailable',
28
+ empty: 'No Todo items',
29
+ loading: 'Loading Todo…',
30
+ hint: '↑↓/PgUp/PgDn scroll · Home/End · Esc close',
31
+ },
32
+ 'zh-CN': {
33
+ title: '当前待办',
34
+ markedComplete: '标记完成',
35
+ open: '/todo 查看',
36
+ usage: '用法:/todo',
37
+ progress: '待办',
38
+ unavailable: '待办不可用',
39
+ empty: '暂无待办',
40
+ loading: '正在加载待办…',
41
+ hint: '↑↓/PgUp/PgDn 滚动 · Home/End · Esc 关闭',
42
+ },
43
+ 'zh-TW': {
44
+ title: '目前待辦',
45
+ markedComplete: '標記完成',
46
+ open: '/todo 查看',
47
+ usage: '用法:/todo',
48
+ progress: '待辦',
49
+ unavailable: '待辦不可用',
50
+ empty: '沒有待辦',
51
+ loading: '正在載入待辦…',
52
+ hint: '↑↓/PgUp/PgDn 捲動 · Home/End · Esc 關閉',
53
+ },
54
+ },
55
+ 'transcript-reader': {
56
+ en: {
57
+ title: 'DETAILED TRANSCRIPT',
58
+ scope: 'loaded history',
59
+ hint: 'Esc/Ctrl+O close · Ctrl+E details · / search · ↑↓/PgUp/PgDn · Home/End',
60
+ matches: 'matches in displayed text',
61
+ back: 'return',
62
+ },
63
+ 'zh-CN': {
64
+ title: '详细记录',
65
+ scope: '已加载历史',
66
+ hint: 'Esc/Ctrl+O 返回 · Ctrl+E 详情 · / 搜索 · ↑↓/PgUp/PgDn · Home/End',
67
+ matches: '处匹配(当前显示内容)',
68
+ back: '回到原位置',
69
+ },
70
+ 'zh-TW': {
71
+ title: '詳細記錄',
72
+ scope: '已載入歷史',
73
+ hint: 'Esc/Ctrl+O 返回 · Ctrl+E 詳情 · / 搜尋 · ↑↓/PgUp/PgDn · Home/End',
74
+ matches: '處符合(目前顯示內容)',
75
+ back: '回到原位置',
76
+ },
77
+ },
78
+ 'host-owner': {
79
+ en: {
80
+ unavailable: 'Runtime Host owner controls are unavailable.',
81
+ usage: 'Usage: /host [status|stop|restart] or /update [latest|next|version]',
82
+ pickerTitle: 'Runtime Host owner action',
83
+ cancel: 'Cancel',
84
+ cancelDescription: 'Keep this Host and its work running',
85
+ safe: 'Safe handoff',
86
+ safeDescription: 'Continue only at a verified safe boundary',
87
+ interrupt: 'Interrupt active work',
88
+ interruptDescription: 'May stop work from every attached Surface',
89
+ pending: 'A Host owner action is already pending.',
90
+ disconnected: 'The TUI has already disconnected.',
91
+ foreign: 'This TUI is attached to another Host. Run its owner controls on that Host; /exit only disconnects.',
92
+ notOwner: 'This npm-global installation does not own the local Host. Use its actual operator; /exit only disconnects.',
93
+ hostChanged: 'The local Host changed or requires its managed-service operator.',
94
+ actionSummary: '{action}: {name}',
95
+ action_stop: 'Stop',
96
+ action_restart: 'Restart',
97
+ action_update: 'Update',
98
+ owner: 'Owner: {owner}',
99
+ root: 'Root: {root}',
100
+ epoch: 'Epoch: {epoch}',
101
+ composition: 'Composition: {composition} ({revision})',
102
+ activity: 'Connections: {connections}; operations: {operations}; residencies: {residencies}',
103
+ unknownActivity: 'Activity is unknown. Other Surfaces and autonomous tasks may be affected.',
104
+ updateSafeOnly: 'Update supports safe handoff only.',
105
+ invalidTarget: 'Update target must be latest, next, or an exact release version.',
106
+ updateRequiresSafe: 'TUI update uses safe handoff only. Stop active work explicitly before updating.',
107
+ installationChanged: 'The npm-global installation changed. Reopen Maka before retrying.',
108
+ ownerChanged: 'The local Host installation owner changed. Reopen Maka before retrying.',
109
+ retirementHostChanged: 'The Host changed before owner retirement; no replacement was interrupted.',
110
+ activityChanged: 'Host activity changed after confirmation. Reopen Maka and confirm the new work before retrying.',
111
+ stillActive: 'The Host still has active work. Reopen Maka and retry /host {action}; interruption requires a new confirmation.',
112
+ restartFailed: 'Host restart did not complete: {detail}',
113
+ status: '{name}: {state}',
114
+ state_starting: 'Starting',
115
+ state_containing: 'Containing',
116
+ state_recovering: 'Recovering',
117
+ state_ready: 'Ready',
118
+ state_draining: 'Draining',
119
+ localOwnerHint: 'Owner controls require this npm-global installation to own the Host. /exit only disconnects.',
120
+ attachedOwnerHint: 'Attached Host: lifecycle changes require its operator. /exit only disconnects.',
121
+ },
122
+ 'zh-CN': {
123
+ unavailable: 'Runtime Host 所有者控制不可用。',
124
+ usage: '用法:/host [status|stop|restart] 或 /update [latest|next|version]',
125
+ pickerTitle: 'Runtime Host 所有者操作',
126
+ cancel: '取消',
127
+ cancelDescription: '保持此 Host 及其任务运行',
128
+ safe: '安全交接',
129
+ safeDescription: '仅在已验证的安全边界继续',
130
+ interrupt: '中断活动任务',
131
+ interruptDescription: '可能停止所有已连接界面的任务',
132
+ pending: '已有 Host 所有者操作等待执行。',
133
+ disconnected: 'TUI 已断开连接。',
134
+ foreign: '此 TUI 连接的是其他 Host。请在该 Host 上使用其所有者控制;/exit 仅断开连接。',
135
+ notOwner: '此 npm-global 安装不是本地 Host 的所有者。请使用实际所有者的控制工具;/exit 仅断开连接。',
136
+ hostChanged: '本地 Host 已变更,或需要由其托管服务控制工具操作。',
137
+ actionSummary: '{action}:{name}',
138
+ action_stop: '停止',
139
+ action_restart: '重启',
140
+ action_update: '更新',
141
+ owner: '所有者:{owner}',
142
+ root: '根标识:{root}',
143
+ epoch: '实例标识:{epoch}',
144
+ composition: '运行组成:{composition}({revision})',
145
+ activity: '连接数:{connections};操作数:{operations};常驻任务:{residencies}',
146
+ unknownActivity: '活动状态未知。其他界面和自主任务可能受到影响。',
147
+ updateSafeOnly: '更新仅支持安全交接。',
148
+ invalidTarget: '更新目标必须为 latest、next 或确切的发布版本。',
149
+ updateRequiresSafe: 'TUI 更新仅使用安全交接。更新前请先显式停止活动任务。',
150
+ installationChanged: 'npm-global 安装已变更。请重新打开 Maka 后重试。',
151
+ ownerChanged: '本地 Host 的安装所有者已变更。请重新打开 Maka 后重试。',
152
+ retirementHostChanged: '停止旧实例前 Host 已变更;未中断替代实例。',
153
+ activityChanged: '确认后 Host 活动已变更。请重新打开 Maka,确认新的任务后重试。',
154
+ stillActive: 'Host 仍有活动任务。请重新打开 Maka 并重试 /host {action};中断需要重新确认。',
155
+ restartFailed: 'Host 重启未完成:{detail}',
156
+ status: '{name}:{state}',
157
+ state_starting: '启动中',
158
+ state_containing: '故障隔离中',
159
+ state_recovering: '恢复中',
160
+ state_ready: '就绪',
161
+ state_draining: '排空中',
162
+ localOwnerHint: '仅当此 npm-global 安装拥有该 Host 时才能使用所有者控制。/exit 仅断开连接。',
163
+ attachedOwnerHint: '已连接的 Host:生命周期变更需由其所有者操作。/exit 仅断开连接。',
164
+ },
165
+ 'zh-TW': {
166
+ unavailable: 'Runtime Host 擁有者控制無法使用。',
167
+ usage: '用法:/host [status|stop|restart] 或 /update [latest|next|version]',
168
+ pickerTitle: 'Runtime Host 擁有者操作',
169
+ cancel: '取消',
170
+ cancelDescription: '保持此 Host 及其工作執行',
171
+ safe: '安全交接',
172
+ safeDescription: '僅在已驗證的安全邊界繼續',
173
+ interrupt: '中斷進行中的工作',
174
+ interruptDescription: '可能停止所有已連線介面的工作',
175
+ pending: '已有 Host 擁有者操作等待執行。',
176
+ disconnected: 'TUI 已中斷連線。',
177
+ foreign: '此 TUI 連線的是其他 Host。請在該 Host 上使用其擁有者控制;/exit 僅中斷連線。',
178
+ notOwner: '此 npm-global 安裝不是本機 Host 的擁有者。請使用實際擁有者的控制工具;/exit 僅中斷連線。',
179
+ hostChanged: '本機 Host 已變更,或需要由其託管服務控制工具操作。',
180
+ actionSummary: '{action}:{name}',
181
+ action_stop: '停止',
182
+ action_restart: '重新啟動',
183
+ action_update: '更新',
184
+ owner: '擁有者:{owner}',
185
+ root: '根識別碼:{root}',
186
+ epoch: '執行個體識別碼:{epoch}',
187
+ composition: '執行組成:{composition}({revision})',
188
+ activity: '連線數:{connections};操作數:{operations};常駐工作:{residencies}',
189
+ unknownActivity: '活動狀態未知。其他介面和自主工作可能受到影響。',
190
+ updateSafeOnly: '更新僅支援安全交接。',
191
+ invalidTarget: '更新目標必須為 latest、next 或確切的發行版本。',
192
+ updateRequiresSafe: 'TUI 更新僅使用安全交接。更新前請先明確停止進行中的工作。',
193
+ installationChanged: 'npm-global 安裝已變更。請重新開啟 Maka 後重試。',
194
+ ownerChanged: '本機 Host 的安裝擁有者已變更。請重新開啟 Maka 後重試。',
195
+ retirementHostChanged: '停止舊執行個體前 Host 已變更;未中斷替代執行個體。',
196
+ activityChanged: '確認後 Host 活動已變更。請重新開啟 Maka,確認新的工作後重試。',
197
+ stillActive: 'Host 仍有進行中的工作。請重新開啟 Maka 並重試 /host {action};中斷需要重新確認。',
198
+ restartFailed: 'Host 重新啟動未完成:{detail}',
199
+ status: '{name}:{state}',
200
+ state_starting: '啟動中',
201
+ state_containing: '故障隔離中',
202
+ state_recovering: '復原中',
203
+ state_ready: '就緒',
204
+ state_draining: '排空中',
205
+ localOwnerHint: '僅當此 npm-global 安裝擁有該 Host 時才能使用擁有者控制。/exit 僅中斷連線。',
206
+ attachedOwnerHint: '已連線的 Host:生命週期變更需由其擁有者操作。/exit 僅中斷連線。',
207
+ },
208
+ },
20
209
  copy: {
21
210
  en: {
22
211
  copiedLast: 'Sent the last reply to the terminal via OSC 52 · {count, plural, one {# char} other {# chars}} — it reaches the clipboard only if your terminal (and tmux, if used) allows OSC 52 writes.',
@@ -435,6 +624,11 @@ export const TUI_COPY_RESOURCES = {
435
624
  modelSearchHint: 'Search models / providers / connections · ↑↓ select · Enter confirm · Esc cancel',
436
625
  searchLabel: 'Search',
437
626
  noMatchingModels: 'No matching models',
627
+ resumeSessionTitle: 'Resume Session',
628
+ sessionScopeCurrent: 'Current',
629
+ sessionScopeAll: 'All',
630
+ sessionSearchHint: 'Search name / id / path / model / connection · Tab scope · ↑↓ select · Enter open · Esc close',
631
+ noMatchingSessions: 'No matching sessions',
438
632
  selectPickerHint: '↑↓ select · Enter confirm · Esc close',
439
633
  providerConfigured: 'configured',
440
634
  addAccount: 'add account',
@@ -525,6 +719,11 @@ export const TUI_COPY_RESOURCES = {
525
719
  modelSearchHint: '搜索模型 / 服务商 / 连接 · ↑↓ 选择 · Enter 确认 · Esc 取消',
526
720
  searchLabel: '搜索',
527
721
  noMatchingModels: '没有匹配的模型',
722
+ resumeSessionTitle: '恢复会话',
723
+ sessionScopeCurrent: '当前目录',
724
+ sessionScopeAll: '全部',
725
+ sessionSearchHint: '搜索名称 / ID / 路径 / 模型 / 连接 · Tab 切换范围 · ↑↓ 选择 · Enter 打开 · Esc 关闭',
726
+ noMatchingSessions: '没有匹配的会话',
528
727
  selectPickerHint: '↑↓ 选择 · Enter 确认 · Esc 关闭',
529
728
  providerConfigured: '已设置',
530
729
  addAccount: '添加账号',
@@ -614,6 +813,11 @@ export const TUI_COPY_RESOURCES = {
614
813
  modelSearchHint: '搜尋模型 / 服務商 / 連線 · ↑↓ 選擇 · Enter 確認 · Esc 取消',
615
814
  searchLabel: '搜尋',
616
815
  noMatchingModels: '沒有符合的模型',
816
+ resumeSessionTitle: '恢復會話',
817
+ sessionScopeCurrent: '目前目錄',
818
+ sessionScopeAll: '全部',
819
+ sessionSearchHint: '搜尋名稱 / ID / 路徑 / 模型 / 連線 · Tab 切換範圍 · ↑↓ 選取 · Enter 開啟 · Esc 關閉',
820
+ noMatchingSessions: '沒有符合的會話',
617
821
  selectPickerHint: '↑↓ 選擇 · Enter 確認 · Esc 關閉',
618
822
  providerConfigured: '已設定',
619
823
  addAccount: '新增帳號',
@@ -711,7 +915,9 @@ export const TUI_COPY_RESOURCES = {
711
915
  compact: 'Compact session context',
712
916
  context: 'Show latest request context usage',
713
917
  copy: 'Copy the last reply (or /copy all) to the clipboard',
714
- exit: 'Exit Maka',
918
+ exit: 'Disconnect this TUI; leave the attached Host running',
919
+ host: 'Inspect the Host or stop/restart its local owner',
920
+ update: 'Update the npm-global CLI and its local Host',
715
921
  goal: 'Show autonomous goal status',
716
922
  graph: 'Show, enable, disable, or run one Graph turn',
717
923
  help: 'Show commands and keybindings',
@@ -730,6 +936,7 @@ export const TUI_COPY_RESOURCES = {
730
936
  skill: 'Invoke a skill (or type /skill:<name> inline)',
731
937
  swarm: 'Show, enable, disable, or run one Swarm turn',
732
938
  thinking: 'Set thinking level',
939
+ todo: 'Show the current session Todo list',
733
940
  transcript: 'Browse the full transcript inside Maka',
734
941
  },
735
942
  help: {
@@ -737,7 +944,7 @@ export const TUI_COPY_RESOURCES = {
737
944
  userCommand: ' !<command> — run one shell command visible only to you',
738
945
  keybindingsHeading: 'Keybindings',
739
946
  keybindings: [
740
- ' Ctrl+O — expand or collapse all tool output',
947
+ ' Ctrl+O — open detailed transcript (Ctrl+E toggles details inside)',
741
948
  ' Ctrl+T — expand or collapse all thinking in view',
742
949
  ' Scroll the transcript with your terminal or trackpad',
743
950
  ' Enter (during a turn) — steer: inject a message into the running turn',
@@ -762,7 +969,9 @@ export const TUI_COPY_RESOURCES = {
762
969
  compact: '压缩会话上下文',
763
970
  context: '查看最近一次请求的上下文用量',
764
971
  copy: '复制最后一条回复(或 /copy all)到剪贴板',
765
- exit: '退出 Maka',
972
+ exit: '断开此 TUI,保留已连接的 Host',
973
+ host: '查看 Host 状态或停止、重启本地所有者',
974
+ update: '更新 npm 全局 CLI 及其本地 Host',
766
975
  goal: '查看自主目标状态',
767
976
  graph: '查看、启用、停用 Graph 模式,或执行一次 Graph 任务',
768
977
  help: '查看命令和快捷键',
@@ -781,6 +990,7 @@ export const TUI_COPY_RESOURCES = {
781
990
  skill: '调用 Skill(也可直接输入 /skill:<name>)',
782
991
  swarm: '查看、启用、停用 Swarm 模式,或执行一次 Swarm 任务',
783
992
  thinking: '设置思考级别',
993
+ todo: '查看当前会话待办清单',
784
994
  transcript: '在 Maka 内浏览完整对话记录',
785
995
  },
786
996
  help: {
@@ -788,7 +998,7 @@ export const TUI_COPY_RESOURCES = {
788
998
  userCommand: ' !<command> — 执行一次仅用户可见的 shell 命令',
789
999
  keybindingsHeading: '快捷键',
790
1000
  keybindings: [
791
- ' Ctrl+O — 展开或折叠所有工具输出',
1001
+ ' Ctrl+O — 打开详细记录(其中 Ctrl+E 切换详情)',
792
1002
  ' Ctrl+T — 展开或折叠视图中的所有思考块',
793
1003
  ' 使用终端或触控板滚动对话记录',
794
1004
  ' Enter(任务运行中)— 将消息注入当前任务',
@@ -813,7 +1023,9 @@ export const TUI_COPY_RESOURCES = {
813
1023
  compact: '壓縮會話上下文',
814
1024
  context: '檢視最近一次請求的上下文用量',
815
1025
  copy: '複製最後一則回覆(或 /copy all)到剪貼簿',
816
- exit: '退出 Maka',
1026
+ exit: '中斷此 TUI,保留已連線的 Host',
1027
+ host: '查看 Host 狀態或停止、重新啟動本機擁有者',
1028
+ update: '更新 npm 全域 CLI 及其本機 Host',
817
1029
  goal: '檢視自主目標狀態',
818
1030
  graph: '檢視、啟用、停用 Graph 模式,或執行一次 Graph 任務',
819
1031
  help: '檢視命令和快捷鍵',
@@ -832,6 +1044,7 @@ export const TUI_COPY_RESOURCES = {
832
1044
  skill: '呼叫 Skill(也可直接輸入 /skill:<name>)',
833
1045
  swarm: '檢視、啟用、停用 Swarm 模式,或執行一次 Swarm 任務',
834
1046
  thinking: '設定思考級別',
1047
+ todo: '檢視目前會話待辦清單',
835
1048
  transcript: '在 Maka 內瀏覽完整對話記錄',
836
1049
  },
837
1050
  help: {
@@ -839,7 +1052,7 @@ export const TUI_COPY_RESOURCES = {
839
1052
  userCommand: ' !<command> — 執行一次僅使用者可見的 shell 命令',
840
1053
  keybindingsHeading: '快捷鍵',
841
1054
  keybindings: [
842
- ' Ctrl+O — 展開或摺疊所有工具輸出',
1055
+ ' Ctrl+O — 開啟詳細記錄(其中 Ctrl+E 切換詳情)',
843
1056
  ' Ctrl+T — 展開或摺疊檢視中的所有思考區塊',
844
1057
  ' 使用終端機或觸控板捲動對話記錄',
845
1058
  ' Enter(任務執行中)— 將訊息注入目前任務',
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ import { defineUiMessageCatalog, resolveUiMessageCatalog, } from '@maka/core/ui-locale';
20
+ import { TUI_COPY_RESOURCES } from './tui-copy-catalog.js';
21
+ const HOST_OWNER_COPY = resolveUiMessageCatalog(defineUiMessageCatalog()(TUI_COPY_RESOURCES['host-owner']));
22
+ export function getTuiHostOwnerCopy(locale) {
23
+ return HOST_OWNER_COPY[locale];
24
+ }
@@ -65,6 +65,7 @@ export const AGENT_RUN_EVENT_TYPES = [
65
65
  'sandbox_escalation_applied',
66
66
  'sandbox_escalation_failed',
67
67
  'sandbox_denial_detected',
68
+ 'request_composition_resolved',
68
69
  'model_call_attempt_recorded',
69
70
  'history_compact_checkpoint_recorded',
70
71
  'model_projection_transition_recorded',
@@ -251,3 +251,6 @@ export function attachmentKindFromMimeType(mimeType, fileName) {
251
251
  }
252
252
  return 'other';
253
253
  }
254
+ export function attachmentIngestBlocked(code) {
255
+ return new Error(`attachment_ingest:${code}`);
256
+ }
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ /**
20
+ * Neutral entrypoint for the strict, key-sorted JSON serializer shared by
21
+ * identity and persistence authorities.
22
+ *
23
+ * The implementation remains in `tool-args-identity` so its existing import
24
+ * path and wire behavior stay compatible while other packages use a domain-
25
+ * neutral name.
26
+ */
27
+ export { stableJsonStringify } from './tool-args-identity.js';
@@ -93,7 +93,9 @@ function omitUndefinedEnvelopeFields(value) {
93
93
  }
94
94
  if (descriptor.value === undefined)
95
95
  continue;
96
- Object.defineProperty(result, key, descriptor);
96
+ // This is our normalization copy. Frozen snapshots constrain their owner,
97
+ // not this copy; retaining non-configurable flags prevents normalizing it.
98
+ Object.defineProperty(result, key, { ...descriptor, configurable: true, writable: true });
97
99
  }
98
100
  return result;
99
101
  }
@@ -75,6 +75,41 @@ export const CAPABILITY_READINESS_STATES = [
75
75
  'degraded',
76
76
  'paused',
77
77
  ];
78
+ /**
79
+ * Stable machine codes for capability and OS-permission reasons. Producers
80
+ * emit these instead of locale-bound prose; presenters own the code→copy map
81
+ * per locale. Bot capabilities pass their bridge status reasons through as-is
82
+ * (`rate-limited`, `gateway-closed-4004`, …), so signal `reason` fields stay
83
+ * `string` — this union types the desktop producers and the presenter maps.
84
+ */
85
+ export const CAPABILITY_REASON_CODES = [
86
+ 'disabled',
87
+ 'platform_credentials_missing',
88
+ 'macos_tcc_only',
89
+ 'apple_events_tcc_status_unavailable',
90
+ 'cu_artifact_missing',
91
+ 'cu_backend_status',
92
+ 'cu_backend_unavailable',
93
+ 'cu_executor_undistributable',
94
+ 'cu_executor_stopped',
95
+ 'cu_executor_start_failed',
96
+ 'cu_executor_recovering',
97
+ 'cu_executor_ready',
98
+ 'cu_executor_lazy_start',
99
+ 'activity_recorder_partial',
100
+ 'activity_recorder_probe_hint',
101
+ 'memory_partial',
102
+ 'memory_no_probe',
103
+ 'accessibility_status_ambiguous',
104
+ 'screen_recording_status_mac_only',
105
+ 'notifications_status_unreadable_macos',
106
+ 'notifications_status_unreadable',
107
+ 'notifications_unsupported',
108
+ 'permission_probe_failed',
109
+ ];
110
+ export function isCapabilityReasonCode(value) {
111
+ return (typeof value === 'string' && CAPABILITY_REASON_CODES.includes(value));
112
+ }
78
113
  export function isOsPermissionState(value) {
79
114
  return typeof value === 'string' && OS_PERMISSION_STATES.includes(value);
80
115
  }
@@ -81,7 +81,6 @@ export function isComputerUseErrorCode(value) {
81
81
  return (typeof value === 'string' && COMPUTER_USE_ERROR_CODES.includes(value));
82
82
  }
83
83
  export const CU_ACTION_TYPES = ['screenshot', 'type', 'key', 'wait'];
84
- export const COMPUTER_USE_ACTION_TYPES = CU_ACTION_TYPES;
85
84
  /**
86
85
  * The semantic actions, which name an element rather than a pixel. They are not
87
86
  * in `CU_ACTION_TYPES` because they are not `CuAction`s — they are dispatched
@@ -28,6 +28,24 @@ const PATTERNS = [
28
28
  streamingTerminator: /[\s"'<>]/,
29
29
  streamingValueGroup: 3,
30
30
  },
31
+ // URL userinfo: https://user:pass@host / https://token@host
32
+ // Structural — any authority that contains `@` is credential-bearing, so
33
+ // this does not depend on a provider prefix list. Runs before the query
34
+ // rule so only the userinfo is replaced and host/path survive.
35
+ // Character class matches streamingTerminator so a bare `https://host`
36
+ // cannot swallow later `@` across whitespace/quotes/angle brackets.
37
+ // Known boundary: punctuation like commas can still join a bare URL to a
38
+ // later `@`; a proper fix would restrict userinfo to the RFC 3986 set.
39
+ // http(s) only for now. Streaming cannot recognize userinfo before `@`
40
+ // arrives (`https://user:pa` stays clear until then); tightening earlier
41
+ // would eat `https://host:8080/`.
42
+ {
43
+ label: 'url userinfo',
44
+ regex: /(https?:\/\/)([^\s"'<>/?#]*@)/gi,
45
+ replacement: (m) => `${m[1]}<redacted>@`,
46
+ streamingTerminator: /[/?#\s"'<>]/,
47
+ streamingValueGroup: 2,
48
+ },
31
49
  // URL query secrets: ?key=[redacted] ?token=[redacted] ?api_key=[redacted] &access_token=[redacted]
32
50
  // (runs before the api-key-header rule so the URL form isn't mangled.)
33
51
  {
@@ -228,6 +228,19 @@ export function reconcileConnectionAfterModelFetch(connection, models, options)
228
228
  const previousEnabled = [
229
229
  ...new Set(connectionEnabledModelIds(connection).map((id) => supersededModelId(id, live, options?.aliases))),
230
230
  ];
231
+ if (options?.authoritative) {
232
+ // The first account-scoped fetch replaces the provider fallback guess: no
233
+ // user chose those bootstrap ids, and every usable model should be offered.
234
+ // Later refreshes preserve explicit user choices only while they remain in
235
+ // the account catalog; newly introduced models stay opt-in.
236
+ const enabledModelIds = connection.hasModelInventory
237
+ ? previousEnabled.filter((id) => live.has(id))
238
+ : liveIds;
239
+ const defaultModel = enabledModelIds.includes(previousDefault)
240
+ ? previousDefault
241
+ : (enabledModelIds[0] ?? '');
242
+ return { defaultModel, enabledModelIds };
243
+ }
231
244
  // Seed a first choice only for a connection that has never had a list to
232
245
  // pick from: four providers ship no `fallbackModels`, so for them discovery
233
246
  // is the only place a first default can come from.
@@ -83,6 +83,7 @@ const MODEL_CALL_ATTEMPT_SHAPE = defineObjectShape()([
83
83
  ], [
84
84
  'connectionSlug',
85
85
  'historyCompactRoute',
86
+ 'requestCompositionId',
86
87
  'contextWindow',
87
88
  'captureArtifactId',
88
89
  'promptComposition',
@@ -294,6 +295,7 @@ export function decodeModelCallAttempt(value) {
294
295
  isNonEmptyString(value.runId) &&
295
296
  isNonEmptyString(value.turnId) &&
296
297
  isNonNegativeInteger(value.step) &&
298
+ isOptionalString(value.requestCompositionId) &&
297
299
  isNonNegativeInteger(value.attempt) &&
298
300
  MODEL_CALL_KINDS.includes(value.callKind) &&
299
301
  (value.historyCompactRoute === undefined ||
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ import { defineObjectShape, hasExactShape, isRecord } from './record-schema.js';
20
+ export const MODEL_FAILURE_MESSAGE_MAX_BYTES = 2 * 1024;
21
+ const EXHAUSTED_SHAPE = defineObjectShape()(['decision', 'attempts'], []);
22
+ const DECLINED_SHAPE = defineObjectShape()(['decision', 'because'], []);
23
+ export function isModelRetryDecision(value) {
24
+ if (!isRecord(value))
25
+ return false;
26
+ switch (value.decision) {
27
+ case 'exhausted':
28
+ return (hasExactShape(value, EXHAUSTED_SHAPE) &&
29
+ Number.isSafeInteger(value.attempts) &&
30
+ Number(value.attempts) > 0);
31
+ case 'declined':
32
+ return (hasExactShape(value, DECLINED_SHAPE) &&
33
+ (value.because === 'side_effects' ||
34
+ value.because === 'observable_output' ||
35
+ value.because === 'policy' ||
36
+ value.because === 'budget'));
37
+ default:
38
+ return false;
39
+ }
40
+ }