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

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 (148) hide show
  1. package/dist/acp/maka-acp-agent.js +2 -1
  2. package/dist/acp/session-configuration.js +143 -0
  3. package/dist/acp/session-registry.js +90 -4
  4. package/dist/cli-core.js +2 -0
  5. package/dist/pi-transcript.js +5 -12
  6. package/dist/pi-tui-runner.js +74 -4
  7. package/dist/runtime-host-cli-context.js +167 -78
  8. package/dist/runtime-host-cli-installation.js +8 -2
  9. package/dist/runtime-host-cli.js +31 -1
  10. package/dist/runtime-host-handoff-surface.js +81 -0
  11. package/dist/runtime-host-installed-update-bootstrap.js +13 -0
  12. package/dist/runtime-host-installed-update-coordinator.js +33 -0
  13. package/dist/runtime-host-lifecycle-transaction.js +9 -1
  14. package/dist/runtime-host-local-handoff.js +37 -4
  15. package/dist/runtime-host-local-managed-activation.js +84 -0
  16. package/dist/runtime-host-local-source-retirement.js +18 -2
  17. package/dist/runtime-host-managed-lifecycle-manager.js +1 -0
  18. package/dist/runtime-host-operator-retirement.js +50 -0
  19. package/dist/runtime-host-service-manager.js +3 -0
  20. package/dist/runtime-host-session-driver.js +4 -25
  21. package/dist/runtime-host-session-update.js +62 -0
  22. package/dist/runtime-host-tui-command.js +38 -73
  23. package/dist/runtime-host-tui-context.js +1 -0
  24. package/dist/runtime-host-tui-owner.js +226 -0
  25. package/dist/tui-copy-catalog.js +140 -3
  26. package/dist/tui-host-owner-copy.js +24 -0
  27. package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
  28. package/node_modules/@maka/core/dist/canonical-runtime-event.js +3 -1
  29. package/node_modules/@maka/core/dist/model-failure.js +40 -0
  30. package/node_modules/@maka/core/dist/model-metadata.generated.js +4 -4
  31. package/node_modules/@maka/core/dist/model-metadata.js +3 -3
  32. package/node_modules/@maka/core/dist/model-web-search.js +5 -4
  33. package/node_modules/@maka/core/dist/provider-registry.js +45 -4
  34. package/node_modules/@maka/core/dist/record-schema.js +9 -2
  35. package/node_modules/@maka/core/dist/runtime-boundary.js +31 -11
  36. package/node_modules/@maka/core/dist/runtime-event.js +37 -6
  37. package/node_modules/@maka/core/dist/runtime-handoff.js +98 -0
  38. package/node_modules/@maka/core/dist/runtime-invocation.js +1 -1
  39. package/node_modules/@maka/core/dist/runtime-logical-execution.js +112 -0
  40. package/node_modules/@maka/core/dist/session.js +54 -52
  41. package/node_modules/@maka/core/dist/slash-command-catalog.js +2 -0
  42. package/node_modules/@maka/core/dist/tool-result-archive-evidence.js +20 -0
  43. package/node_modules/@maka/core/dist/usage-record-schema.js +26 -35
  44. package/node_modules/@maka/core/package.json +4 -0
  45. package/node_modules/@maka/mcp/dist/index.js +131 -1
  46. package/node_modules/@maka/runtime/dist/agent-run.js +272 -105
  47. package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +13 -5
  48. package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +109 -34
  49. package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +127 -133
  50. package/node_modules/@maka/runtime/dist/context-budget.js +14 -9
  51. package/node_modules/@maka/runtime/dist/conversation-copy.js +5 -4
  52. package/node_modules/@maka/runtime/dist/goal-continuation.js +36 -4
  53. package/node_modules/@maka/runtime/dist/history-compact-checkpoint.js +18 -9
  54. package/node_modules/@maka/runtime/dist/history-compact-summarizer.js +30 -22
  55. package/node_modules/@maka/runtime/dist/history-compaction.js +29 -4
  56. package/node_modules/@maka/runtime/dist/ledger-tool-result-archive-reader.js +106 -0
  57. package/node_modules/@maka/runtime/dist/message-authority.js +9 -0
  58. package/node_modules/@maka/runtime/dist/model-adapter.js +19 -98
  59. package/node_modules/@maka/runtime/dist/model-factory.js +19 -81
  60. package/node_modules/@maka/runtime/dist/model-fetcher.js +7 -0
  61. package/node_modules/@maka/runtime/dist/model-runtime.js +85 -111
  62. package/node_modules/@maka/runtime/dist/native-web-search-tool.js +2 -1
  63. package/node_modules/@maka/runtime/dist/openai-codex-history-compactor.js +2 -2
  64. package/node_modules/@maka/runtime/dist/opencode-session-header.js +4 -2
  65. package/node_modules/@maka/runtime/dist/provider-error-classification.js +84 -123
  66. package/node_modules/@maka/runtime/dist/provider-request-telemetry.js +68 -108
  67. package/node_modules/@maka/runtime/dist/run-handoff-gate.js +97 -0
  68. package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +82 -54
  69. package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +117 -159
  70. package/node_modules/@maka/runtime/dist/runtime-kernel.js +150 -112
  71. package/node_modules/@maka/runtime/dist/runtime-ledger-repair.js +160 -79
  72. package/node_modules/@maka/runtime/dist/runtime-read-model.js +30 -89
  73. package/node_modules/@maka/runtime/dist/runtime-resume.js +80 -4
  74. package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +5 -0
  75. package/node_modules/@maka/runtime/dist/session-manager.js +171 -288
  76. package/node_modules/@maka/runtime/dist/session-projection-helpers.js +0 -27
  77. package/node_modules/@maka/runtime/dist/subscription-model-fetch.js +3 -4
  78. package/node_modules/@maka/runtime/dist/test-connection.js +16 -16
  79. package/node_modules/@maka/runtime/dist/tool-result-archive-encoding.js +38 -0
  80. package/node_modules/@maka/runtime/dist/tool-runtime.js +3 -61
  81. package/node_modules/@maka/runtime/package.json +1 -0
  82. package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +35 -0
  83. package/node_modules/@maka/runtime-host/dist/client/connect-or-spawn.js +9 -1
  84. package/node_modules/@maka/runtime-host/dist/client/connection.js +3 -0
  85. package/node_modules/@maka/runtime-host/dist/client/host-handoff-copy.js +156 -0
  86. package/node_modules/@maka/runtime-host/dist/client/host-handoff.js +273 -0
  87. package/node_modules/@maka/runtime-host/dist/client/host-retirement.js +26 -5
  88. package/node_modules/@maka/runtime-host/dist/client/index.js +2 -0
  89. package/node_modules/@maka/runtime-host/dist/client/launcher.js +3 -0
  90. package/node_modules/@maka/runtime-host/dist/client/remote-compatibility-error.js +2 -0
  91. package/node_modules/@maka/runtime-host/dist/client/session-subscription.js +27 -5
  92. package/node_modules/@maka/runtime-host/dist/operator/index.js +2 -1
  93. package/node_modules/@maka/runtime-host/dist/operator/retirement-cancellation.js +20 -0
  94. package/node_modules/@maka/runtime-host/dist/protocol/host-status.js +21 -12
  95. package/node_modules/@maka/runtime-host/dist/protocol/index.js +25 -1
  96. package/node_modules/@maka/runtime-host/dist/protocol/operations.js +1 -0
  97. package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +40 -20
  98. package/node_modules/@maka/runtime-host/dist/protocol/session-transcript.js +0 -5
  99. package/node_modules/@maka/runtime-host/dist/protocol/session-turns.js +29 -58
  100. package/node_modules/@maka/runtime-host/dist/protocol/turn.js +11 -1
  101. package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +1 -0
  102. package/node_modules/@maka/runtime-host/dist/server/canonical-turn-snapshot.js +19 -4
  103. package/node_modules/@maka/runtime-host/dist/server/connection-session.js +7 -6
  104. package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +100 -24
  105. package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +5 -5
  106. package/node_modules/@maka/runtime-host/dist/server/execution-model-composition.js +3 -2
  107. package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +40 -1
  108. package/node_modules/@maka/runtime-host/dist/server/host-kernel.js +96 -17
  109. package/node_modules/@maka/runtime-host/dist/server/host-residency-registry.js +13 -7
  110. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-admission-registry.js +3 -1
  111. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-recovery.js +124 -62
  112. package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +76 -6
  113. package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +325 -73
  114. package/node_modules/@maka/runtime-host/dist/server/scheduled-task-coordinator.js +37 -2
  115. package/node_modules/@maka/runtime-host/dist/server/serial-outbound-writer.js +45 -3
  116. package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +50 -7
  117. package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +87 -25
  118. package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +8 -55
  119. package/node_modules/@maka/runtime-host/dist/server/session-sidecar-purge.js +1 -16
  120. package/node_modules/@maka/runtime-host/dist/server/session-transcript-pager.js +0 -1
  121. package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +460 -70
  122. package/node_modules/@maka/runtime-host/dist/server/shared-session-transcript.js +1 -1
  123. package/node_modules/@maka/runtime-host/dist/server/storage-maintenance.js +109 -0
  124. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +0 -1
  125. package/node_modules/@maka/storage/dist/artifact-store.js +21 -10
  126. package/node_modules/@maka/storage/dist/artifact-stores.js +1 -1
  127. package/node_modules/@maka/storage/dist/claude-code-session-adapter.js +0 -4
  128. package/node_modules/@maka/storage/dist/codex-session-adapter.js +0 -2
  129. package/node_modules/@maka/storage/dist/context-offload-snapshot.js +325 -0
  130. package/node_modules/@maka/storage/dist/execution-stores.js +9 -7
  131. package/node_modules/@maka/storage/dist/file-session-repository.js +1012 -0
  132. package/node_modules/@maka/storage/dist/opencode-session-adapter.js +0 -4
  133. package/node_modules/@maka/storage/dist/operational-state-backup.js +9 -5
  134. package/node_modules/@maka/storage/dist/runtime-event-persistence.js +1 -0
  135. package/node_modules/@maka/storage/dist/runtime-transcript-query.js +308 -0
  136. package/node_modules/@maka/storage/dist/session-bundle-policy.js +24 -4
  137. package/node_modules/@maka/storage/dist/session-message-projection.js +15 -0
  138. package/node_modules/@maka/storage/dist/session-repository.js +767 -0
  139. package/node_modules/@maka/storage/dist/session-store.js +25 -99
  140. package/node_modules/@maka/storage/dist/sqlite-artifact-metadata.js +10 -3
  141. package/node_modules/@maka/storage/dist/sqlite-context-offload-store.js +24 -8
  142. package/node_modules/@maka/storage/dist/sqlite-core-execution-schema.js +7 -1
  143. package/node_modules/@maka/storage/dist/sqlite-runtime-schema.js +44 -1
  144. package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +129 -25
  145. package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +109 -892
  146. package/node_modules/@maka/storage/dist/tool-result-archive-evidence.js +111 -0
  147. package/node_modules/@maka/storage/package.json +2 -0
  148. package/package.json +1 -1
@@ -0,0 +1,226 @@
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 { randomUUID } from 'node:crypto';
20
+ import { isDeepStrictEqual } from 'node:util';
21
+ import { formatUiMessage } from '@maka/core/ui-locale';
22
+ import { connectExistingRuntimeHost, } from '@maka/runtime-host/client';
23
+ import { readLocalHostDeploymentRecord, resolveRuntimeHostManagedDeploymentAuthority, withLocalHostDeploymentAuthority, } from '@maka/runtime-host/operator';
24
+ import { isProductReleaseVersion } from '@maka/runtime-host/operator/update-package-evidence';
25
+ import { INTERACTIVE_RUNTIME_HOST_COMPOSITION_ID, RUNTIME_HOST_PROTOCOL_VERSION, } from '@maka/runtime-host/protocol';
26
+ import { resolveRuntimeHostNpmGlobalInstallation } from './runtime-host-cli-installation.js';
27
+ import { runRuntimeHostInstalledUpdateBootstrap } from './runtime-host-installed-update-bootstrap.js';
28
+ import { retireRuntimeHostLifecycleOwner } from './runtime-host-lifecycle-transaction.js';
29
+ import { openRuntimeHostNpmGlobalStagedDeployment } from './runtime-host-local-handoff.js';
30
+ import { launchRuntimeHostTargetActivator } from './runtime-host-local-target-activation.js';
31
+ import { getTuiHostOwnerCopy } from './tui-host-owner-copy.js';
32
+ /** A thin owner adapter. The caller disconnects its reconnecting client before execute. */
33
+ export async function prepareTuiHostOwnerAction(input, overrides = {}) {
34
+ const locale = input.locale ?? 'en';
35
+ const copy = getTuiHostOwnerCopy(locale);
36
+ if (input.profile.kind !== 'local') {
37
+ throw new Error(copy.foreign);
38
+ }
39
+ const deps = {
40
+ resolveInstallation: resolveRuntimeHostNpmGlobalInstallation,
41
+ readRecord: readLocalHostDeploymentRecord,
42
+ resolveManagedAuthority: resolveRuntimeHostManagedDeploymentAuthority,
43
+ connectExisting: connectExistingRuntimeHost,
44
+ withAuthority: withLocalHostDeploymentAuthority,
45
+ retire: retireRuntimeHostLifecycleOwner,
46
+ openStaged: openRuntimeHostNpmGlobalStagedDeployment,
47
+ activate: launchRuntimeHostTargetActivator,
48
+ update: runRuntimeHostInstalledUpdateBootstrap,
49
+ ...overrides,
50
+ };
51
+ const installation = await deps.resolveInstallation();
52
+ const rootId = input.connection.rootId;
53
+ const hostEpoch = input.connection.hostEpoch;
54
+ if (await deps.resolveManagedAuthority(rootId))
55
+ throw new Error(copy.notOwner);
56
+ const record = await deps.readRecord(rootId);
57
+ if (record?.state.kind !== 'owned' ||
58
+ record.state.owner.kind !== 'cli' ||
59
+ record.state.owner.installationId !== installation.owner.installationId) {
60
+ throw new Error(copy.notOwner);
61
+ }
62
+ const observed = await deps.connectExisting({
63
+ rootPath: input.rootPath,
64
+ protocol: { min: RUNTIME_HOST_PROTOCOL_VERSION, max: RUNTIME_HOST_PROTOCOL_VERSION },
65
+ compositionId: INTERACTIVE_RUNTIME_HOST_COMPOSITION_ID,
66
+ });
67
+ try {
68
+ if (observed.kind !== 'connected' ||
69
+ observed.registration.rootId !== rootId ||
70
+ observed.registration.hostEpoch !== hostEpoch ||
71
+ observed.registration.lifecycleMode !== 'ephemeral') {
72
+ throw new Error(copy.hostChanged);
73
+ }
74
+ }
75
+ finally {
76
+ if (observed.kind === 'connected')
77
+ await observed.connection.close();
78
+ }
79
+ const diagnostics = await input.connection
80
+ .request('host.diagnostics.query', {})
81
+ .catch(() => undefined);
82
+ const fingerprint = activityFingerprint(diagnostics);
83
+ let allowInterruptActiveTasks = false;
84
+ if (!diagnostics || diagnostics.upgradeBlockingActivity) {
85
+ const choice = await input.confirm([
86
+ formatUiMessage(copy.actionSummary, { action: copy[`action_${input.action.action}`], name: input.profile.name }, locale),
87
+ formatUiMessage(copy.owner, { owner: installation.owner.installationId }, locale),
88
+ formatUiMessage(copy.root, { root: rootId }, locale),
89
+ formatUiMessage(copy.epoch, { epoch: hostEpoch }, locale),
90
+ diagnostics
91
+ ? formatUiMessage(copy.activity, {
92
+ connections: diagnostics.connections,
93
+ operations: diagnostics.activeOperations,
94
+ residencies: JSON.stringify(diagnostics.residencies),
95
+ }, locale)
96
+ : copy.unknownActivity,
97
+ input.action.action === 'update' ? copy.updateSafeOnly : '',
98
+ ]
99
+ .filter(Boolean)
100
+ .join('\n'));
101
+ if (choice === 'cancel')
102
+ return undefined;
103
+ allowInterruptActiveTasks = choice === 'interrupt';
104
+ }
105
+ const target = input.action.target ?? 'latest';
106
+ if (input.action.action === 'update' &&
107
+ target !== 'latest' &&
108
+ target !== 'next' &&
109
+ !isProductReleaseVersion(target))
110
+ throw new Error(copy.invalidTarget);
111
+ if (input.action.action === 'update' && allowInterruptActiveTasks) {
112
+ throw new Error(copy.updateRequiresSafe);
113
+ }
114
+ return async () => {
115
+ if (!isDeepStrictEqual(await deps.resolveInstallation(), installation)) {
116
+ throw new Error(copy.installationChanged);
117
+ }
118
+ if (input.action.action === 'update') {
119
+ if (await deps.resolveManagedAuthority(rootId))
120
+ throw new Error(copy.notOwner);
121
+ return deps.update({
122
+ rootPath: input.rootPath,
123
+ selector: target === 'latest' || target === 'next'
124
+ ? { kind: 'channel', channel: target }
125
+ : { kind: 'exact', version: target },
126
+ allowInterruptActiveTasks: false,
127
+ expectedSource: {
128
+ rootId,
129
+ deploymentRevision: record.revision,
130
+ ownerInstallationId: installation.owner.installationId,
131
+ hostEpoch,
132
+ },
133
+ });
134
+ }
135
+ return deps.withAuthority(rootId, async (authority, inheritableAuthorityLeaseFd) => {
136
+ if (!isDeepStrictEqual(await authority.read(), record)) {
137
+ throw new Error(copy.ownerChanged);
138
+ }
139
+ // Same-artifact restart is a process lifecycle operation, not an update.
140
+ // Open the already verified selected package; never restage/reinstall it.
141
+ const staged = input.action.action === 'restart'
142
+ ? await deps.openStaged({
143
+ rootId,
144
+ owner: installation.owner,
145
+ target: record.state.selected,
146
+ transactionId: `tui-restart:${randomUUID()}`,
147
+ })
148
+ : undefined;
149
+ if (await deps.resolveManagedAuthority(rootId))
150
+ throw new Error(copy.notOwner);
151
+ const retired = await deps.retire({
152
+ rootPath: input.rootPath,
153
+ rootId,
154
+ allowInterruptActiveTasks,
155
+ connectExisting: async (request) => {
156
+ const current = await deps.connectExisting(request);
157
+ if (current.kind !== 'connected' ||
158
+ current.registration.rootId !== rootId ||
159
+ current.registration.hostEpoch !== hostEpoch ||
160
+ current.registration.lifecycleMode !== 'ephemeral') {
161
+ if (current.kind === 'connected')
162
+ await current.connection.close();
163
+ throw new Error(copy.retirementHostChanged);
164
+ }
165
+ const currentDiagnostics = await current.connection
166
+ .request('host.diagnostics.query', {})
167
+ .catch(() => undefined);
168
+ if (allowInterruptActiveTasks &&
169
+ activityFingerprint(currentDiagnostics) !== fingerprint) {
170
+ await current.connection.close();
171
+ throw new Error(copy.activityChanged);
172
+ }
173
+ return current;
174
+ },
175
+ });
176
+ if (retired.kind === 'active_tasks') {
177
+ throw new Error(formatUiMessage(copy.stillActive, { action: input.action.action }, locale));
178
+ }
179
+ await retired.owner.close();
180
+ if (staged) {
181
+ const activated = await deps.activate({
182
+ rootPath: input.rootPath,
183
+ rootId,
184
+ staged,
185
+ ownerInstallationId: installation.owner.installationId,
186
+ target: record.state.selected,
187
+ inheritableAuthorityLeaseFd,
188
+ });
189
+ if (activated.kind !== 'ready')
190
+ throw new Error(formatUiMessage(copy.restartFailed, { detail: activated.kind }, locale));
191
+ await activated.settle();
192
+ }
193
+ return 0;
194
+ });
195
+ };
196
+ }
197
+ function activityFingerprint(diagnostics) {
198
+ if (!diagnostics)
199
+ return 'unknown';
200
+ return JSON.stringify([
201
+ diagnostics.hostEpoch,
202
+ diagnostics.pid,
203
+ diagnostics.state,
204
+ diagnostics.connections,
205
+ diagnostics.activeOperations,
206
+ diagnostics.residencies,
207
+ diagnostics.upgradeBlockingActivity,
208
+ ]);
209
+ }
210
+ export async function describeTuiHost(input) {
211
+ const locale = input.locale ?? 'en';
212
+ const copy = getTuiHostOwnerCopy(locale);
213
+ const status = await input.connection.status();
214
+ return [
215
+ formatUiMessage(copy.status, { name: input.profile.name, state: copy[`state_${status.state}`] }, locale),
216
+ formatUiMessage(copy.root, { root: input.connection.rootId }, locale),
217
+ formatUiMessage(copy.epoch, { epoch: status.hostEpoch }, locale),
218
+ formatUiMessage(copy.composition, { composition: status.compositionId, revision: status.compositionRevision }, locale),
219
+ formatUiMessage(copy.activity, {
220
+ connections: status.connections,
221
+ operations: status.activeOperations,
222
+ residencies: status.activeResidencies,
223
+ }, locale),
224
+ input.profile.kind === 'local' ? copy.localOwnerHint : copy.attachedOwnerHint,
225
+ ].join('\n');
226
+ }
@@ -17,6 +17,137 @@
17
17
  * under the License.
18
18
  */
19
19
  export const TUI_COPY_RESOURCES = {
20
+ 'host-owner': {
21
+ en: {
22
+ unavailable: 'Runtime Host owner controls are unavailable.',
23
+ usage: 'Usage: /host [status|stop|restart] or /update [latest|next|version]',
24
+ pickerTitle: 'Runtime Host owner action',
25
+ cancel: 'Cancel',
26
+ cancelDescription: 'Keep this Host and its work running',
27
+ safe: 'Safe handoff',
28
+ safeDescription: 'Continue only at a verified safe boundary',
29
+ interrupt: 'Interrupt active work',
30
+ interruptDescription: 'May stop work from every attached Surface',
31
+ pending: 'A Host owner action is already pending.',
32
+ disconnected: 'The TUI has already disconnected.',
33
+ foreign: 'This TUI is attached to another Host. Run its owner controls on that Host; /exit only disconnects.',
34
+ notOwner: 'This npm-global installation does not own the local Host. Use its actual operator; /exit only disconnects.',
35
+ hostChanged: 'The local Host changed or requires its managed-service operator.',
36
+ actionSummary: '{action}: {name}',
37
+ action_stop: 'Stop',
38
+ action_restart: 'Restart',
39
+ action_update: 'Update',
40
+ owner: 'Owner: {owner}',
41
+ root: 'Root: {root}',
42
+ epoch: 'Epoch: {epoch}',
43
+ composition: 'Composition: {composition} ({revision})',
44
+ activity: 'Connections: {connections}; operations: {operations}; residencies: {residencies}',
45
+ unknownActivity: 'Activity is unknown. Other Surfaces and autonomous tasks may be affected.',
46
+ updateSafeOnly: 'Update supports safe handoff only.',
47
+ invalidTarget: 'Update target must be latest, next, or an exact release version.',
48
+ updateRequiresSafe: 'TUI update uses safe handoff only. Stop active work explicitly before updating.',
49
+ installationChanged: 'The npm-global installation changed. Reopen Maka before retrying.',
50
+ ownerChanged: 'The local Host installation owner changed. Reopen Maka before retrying.',
51
+ retirementHostChanged: 'The Host changed before owner retirement; no replacement was interrupted.',
52
+ activityChanged: 'Host activity changed after confirmation. Reopen Maka and confirm the new work before retrying.',
53
+ stillActive: 'The Host still has active work. Reopen Maka and retry /host {action}; interruption requires a new confirmation.',
54
+ restartFailed: 'Host restart did not complete: {detail}',
55
+ status: '{name}: {state}',
56
+ state_starting: 'Starting',
57
+ state_containing: 'Containing',
58
+ state_recovering: 'Recovering',
59
+ state_ready: 'Ready',
60
+ state_draining: 'Draining',
61
+ localOwnerHint: 'Owner controls require this npm-global installation to own the Host. /exit only disconnects.',
62
+ attachedOwnerHint: 'Attached Host: lifecycle changes require its operator. /exit only disconnects.',
63
+ },
64
+ 'zh-CN': {
65
+ unavailable: 'Runtime Host 所有者控制不可用。',
66
+ usage: '用法:/host [status|stop|restart] 或 /update [latest|next|version]',
67
+ pickerTitle: 'Runtime Host 所有者操作',
68
+ cancel: '取消',
69
+ cancelDescription: '保持此 Host 及其任务运行',
70
+ safe: '安全交接',
71
+ safeDescription: '仅在已验证的安全边界继续',
72
+ interrupt: '中断活动任务',
73
+ interruptDescription: '可能停止所有已连接界面的任务',
74
+ pending: '已有 Host 所有者操作等待执行。',
75
+ disconnected: 'TUI 已断开连接。',
76
+ foreign: '此 TUI 连接的是其他 Host。请在该 Host 上使用其所有者控制;/exit 仅断开连接。',
77
+ notOwner: '此 npm-global 安装不是本地 Host 的所有者。请使用实际所有者的控制工具;/exit 仅断开连接。',
78
+ hostChanged: '本地 Host 已变更,或需要由其托管服务控制工具操作。',
79
+ actionSummary: '{action}:{name}',
80
+ action_stop: '停止',
81
+ action_restart: '重启',
82
+ action_update: '更新',
83
+ owner: '所有者:{owner}',
84
+ root: '根标识:{root}',
85
+ epoch: '实例标识:{epoch}',
86
+ composition: '运行组成:{composition}({revision})',
87
+ activity: '连接数:{connections};操作数:{operations};常驻任务:{residencies}',
88
+ unknownActivity: '活动状态未知。其他界面和自主任务可能受到影响。',
89
+ updateSafeOnly: '更新仅支持安全交接。',
90
+ invalidTarget: '更新目标必须为 latest、next 或确切的发布版本。',
91
+ updateRequiresSafe: 'TUI 更新仅使用安全交接。更新前请先显式停止活动任务。',
92
+ installationChanged: 'npm-global 安装已变更。请重新打开 Maka 后重试。',
93
+ ownerChanged: '本地 Host 的安装所有者已变更。请重新打开 Maka 后重试。',
94
+ retirementHostChanged: '停止旧实例前 Host 已变更;未中断替代实例。',
95
+ activityChanged: '确认后 Host 活动已变更。请重新打开 Maka,确认新的任务后重试。',
96
+ stillActive: 'Host 仍有活动任务。请重新打开 Maka 并重试 /host {action};中断需要重新确认。',
97
+ restartFailed: 'Host 重启未完成:{detail}',
98
+ status: '{name}:{state}',
99
+ state_starting: '启动中',
100
+ state_containing: '故障隔离中',
101
+ state_recovering: '恢复中',
102
+ state_ready: '就绪',
103
+ state_draining: '排空中',
104
+ localOwnerHint: '仅当此 npm-global 安装拥有该 Host 时才能使用所有者控制。/exit 仅断开连接。',
105
+ attachedOwnerHint: '已连接的 Host:生命周期变更需由其所有者操作。/exit 仅断开连接。',
106
+ },
107
+ 'zh-TW': {
108
+ unavailable: 'Runtime Host 擁有者控制無法使用。',
109
+ usage: '用法:/host [status|stop|restart] 或 /update [latest|next|version]',
110
+ pickerTitle: 'Runtime Host 擁有者操作',
111
+ cancel: '取消',
112
+ cancelDescription: '保持此 Host 及其工作執行',
113
+ safe: '安全交接',
114
+ safeDescription: '僅在已驗證的安全邊界繼續',
115
+ interrupt: '中斷進行中的工作',
116
+ interruptDescription: '可能停止所有已連線介面的工作',
117
+ pending: '已有 Host 擁有者操作等待執行。',
118
+ disconnected: 'TUI 已中斷連線。',
119
+ foreign: '此 TUI 連線的是其他 Host。請在該 Host 上使用其擁有者控制;/exit 僅中斷連線。',
120
+ notOwner: '此 npm-global 安裝不是本機 Host 的擁有者。請使用實際擁有者的控制工具;/exit 僅中斷連線。',
121
+ hostChanged: '本機 Host 已變更,或需要由其託管服務控制工具操作。',
122
+ actionSummary: '{action}:{name}',
123
+ action_stop: '停止',
124
+ action_restart: '重新啟動',
125
+ action_update: '更新',
126
+ owner: '擁有者:{owner}',
127
+ root: '根識別碼:{root}',
128
+ epoch: '執行個體識別碼:{epoch}',
129
+ composition: '執行組成:{composition}({revision})',
130
+ activity: '連線數:{connections};操作數:{operations};常駐工作:{residencies}',
131
+ unknownActivity: '活動狀態未知。其他介面和自主工作可能受到影響。',
132
+ updateSafeOnly: '更新僅支援安全交接。',
133
+ invalidTarget: '更新目標必須為 latest、next 或確切的發行版本。',
134
+ updateRequiresSafe: 'TUI 更新僅使用安全交接。更新前請先明確停止進行中的工作。',
135
+ installationChanged: 'npm-global 安裝已變更。請重新開啟 Maka 後重試。',
136
+ ownerChanged: '本機 Host 的安裝擁有者已變更。請重新開啟 Maka 後重試。',
137
+ retirementHostChanged: '停止舊執行個體前 Host 已變更;未中斷替代執行個體。',
138
+ activityChanged: '確認後 Host 活動已變更。請重新開啟 Maka,確認新的工作後重試。',
139
+ stillActive: 'Host 仍有進行中的工作。請重新開啟 Maka 並重試 /host {action};中斷需要重新確認。',
140
+ restartFailed: 'Host 重新啟動未完成:{detail}',
141
+ status: '{name}:{state}',
142
+ state_starting: '啟動中',
143
+ state_containing: '故障隔離中',
144
+ state_recovering: '復原中',
145
+ state_ready: '就緒',
146
+ state_draining: '排空中',
147
+ localOwnerHint: '僅當此 npm-global 安裝擁有該 Host 時才能使用擁有者控制。/exit 僅中斷連線。',
148
+ attachedOwnerHint: '已連線的 Host:生命週期變更需由其擁有者操作。/exit 僅中斷連線。',
149
+ },
150
+ },
20
151
  copy: {
21
152
  en: {
22
153
  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.',
@@ -711,7 +842,9 @@ export const TUI_COPY_RESOURCES = {
711
842
  compact: 'Compact session context',
712
843
  context: 'Show latest request context usage',
713
844
  copy: 'Copy the last reply (or /copy all) to the clipboard',
714
- exit: 'Exit Maka',
845
+ exit: 'Disconnect this TUI; leave the attached Host running',
846
+ host: 'Inspect the Host or stop/restart its local owner',
847
+ update: 'Update the npm-global CLI and its local Host',
715
848
  goal: 'Show autonomous goal status',
716
849
  graph: 'Show, enable, disable, or run one Graph turn',
717
850
  help: 'Show commands and keybindings',
@@ -762,7 +895,9 @@ export const TUI_COPY_RESOURCES = {
762
895
  compact: '压缩会话上下文',
763
896
  context: '查看最近一次请求的上下文用量',
764
897
  copy: '复制最后一条回复(或 /copy all)到剪贴板',
765
- exit: '退出 Maka',
898
+ exit: '断开此 TUI,保留已连接的 Host',
899
+ host: '查看 Host 状态或停止、重启本地所有者',
900
+ update: '更新 npm 全局 CLI 及其本地 Host',
766
901
  goal: '查看自主目标状态',
767
902
  graph: '查看、启用、停用 Graph 模式,或执行一次 Graph 任务',
768
903
  help: '查看命令和快捷键',
@@ -813,7 +948,9 @@ export const TUI_COPY_RESOURCES = {
813
948
  compact: '壓縮會話上下文',
814
949
  context: '檢視最近一次請求的上下文用量',
815
950
  copy: '複製最後一則回覆(或 /copy all)到剪貼簿',
816
- exit: '退出 Maka',
951
+ exit: '中斷此 TUI,保留已連線的 Host',
952
+ host: '查看 Host 狀態或停止、重新啟動本機擁有者',
953
+ update: '更新 npm 全域 CLI 及其本機 Host',
817
954
  goal: '檢視自主目標狀態',
818
955
  graph: '檢視、啟用、停用 Graph 模式,或執行一次 Graph 任務',
819
956
  help: '檢視命令和快捷鍵',
@@ -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
+ }
@@ -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
  }
@@ -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
+ }
@@ -2009,7 +2009,7 @@ export const GENERATED_MODELS_DEV_MODEL_PROVIDER_OVERRIDES = {
2009
2009
  "alibaba-token-plan-cn": {},
2010
2010
  "alibaba-token-plan": {},
2011
2011
  "cerebras": {},
2012
- "cohere": { "north-mini-code-1-0": { "npm": "@ai-sdk/openai-compatible", "api": "https://api.cohere.ai/compatibility/v1" } },
2012
+ "cohere": { "north-mini-code-1-0": { "adapter": { "kind": "openai-compatible", "name": "provider" }, "baseUrl": "https://api.cohere.ai/compatibility/v1" } },
2013
2013
  "cloudflare-workers-ai": {},
2014
2014
  "deepinfra": {},
2015
2015
  "deepseek": {},
@@ -2027,8 +2027,8 @@ export const GENERATED_MODELS_DEV_MODEL_PROVIDER_OVERRIDES = {
2027
2027
  "nvidia": {},
2028
2028
  "ollama-cloud": {},
2029
2029
  "openai": {},
2030
- "opencode": { "claude-3-5-haiku": { "npm": "@ai-sdk/anthropic" }, "claude-fable-5": { "npm": "@ai-sdk/anthropic" }, "claude-haiku-4-5": { "npm": "@ai-sdk/anthropic" }, "claude-opus-4-1": { "npm": "@ai-sdk/anthropic" }, "claude-opus-4-5": { "npm": "@ai-sdk/anthropic" }, "claude-opus-4-6": { "npm": "@ai-sdk/anthropic" }, "claude-opus-4-7": { "npm": "@ai-sdk/anthropic" }, "claude-opus-4-8": { "npm": "@ai-sdk/anthropic" }, "claude-opus-5": { "npm": "@ai-sdk/anthropic" }, "claude-sonnet-4": { "npm": "@ai-sdk/anthropic" }, "claude-sonnet-4-5": { "npm": "@ai-sdk/anthropic" }, "claude-sonnet-4-6": { "npm": "@ai-sdk/anthropic" }, "claude-sonnet-5": { "npm": "@ai-sdk/anthropic" }, "gemini-3-flash": { "npm": "@ai-sdk/google" }, "gemini-3-pro": { "npm": "@ai-sdk/google" }, "gemini-3.1-pro": { "npm": "@ai-sdk/google" }, "gemini-3.5-flash": { "npm": "@ai-sdk/google" }, "gemini-3.5-flash-lite": { "npm": "@ai-sdk/google" }, "gemini-3.6-flash": { "npm": "@ai-sdk/google" }, "gemini-3.7-flash": { "npm": "@ai-sdk/google" }, "gpt-5": { "npm": "@ai-sdk/openai" }, "gpt-5-codex": { "npm": "@ai-sdk/openai" }, "gpt-5-nano": { "npm": "@ai-sdk/openai" }, "gpt-5.1": { "npm": "@ai-sdk/openai" }, "gpt-5.1-codex": { "npm": "@ai-sdk/openai" }, "gpt-5.1-codex-max": { "npm": "@ai-sdk/openai" }, "gpt-5.1-codex-mini": { "npm": "@ai-sdk/openai" }, "gpt-5.2": { "npm": "@ai-sdk/openai" }, "gpt-5.2-codex": { "npm": "@ai-sdk/openai" }, "gpt-5.3-codex": { "npm": "@ai-sdk/openai" }, "gpt-5.3-codex-spark": { "npm": "@ai-sdk/openai" }, "gpt-5.4": { "npm": "@ai-sdk/openai" }, "gpt-5.4-mini": { "npm": "@ai-sdk/openai" }, "gpt-5.4-nano": { "npm": "@ai-sdk/openai" }, "gpt-5.4-pro": { "npm": "@ai-sdk/openai" }, "gpt-5.5": { "npm": "@ai-sdk/openai" }, "gpt-5.5-pro": { "npm": "@ai-sdk/openai" }, "gpt-5.6-luna": { "npm": "@ai-sdk/openai" }, "gpt-5.6-sol": { "npm": "@ai-sdk/openai" }, "gpt-5.6-terra": { "npm": "@ai-sdk/openai" }, "grok-4.5": { "npm": "@ai-sdk/openai" }, "grok-4.6": { "npm": "@ai-sdk/openai" }, "grok-build-0.1": { "npm": "@ai-sdk/openai" }, "minimax-m2.1-free": { "npm": "@ai-sdk/anthropic" }, "minimax-m2.5-free": { "npm": "@ai-sdk/anthropic" }, "minimax-m3-free": { "npm": "@ai-sdk/anthropic" }, "muse-spark-1.2": { "npm": "@ai-sdk/openai" }, "muse-spark-1.2-contributor-free": { "npm": "@ai-sdk/openai" }, "qwen3.5-plus": { "npm": "@ai-sdk/anthropic" }, "qwen3.6-plus": { "npm": "@ai-sdk/anthropic" }, "qwen3.6-plus-free": { "npm": "@ai-sdk/anthropic" } },
2031
- "opencode-go": { "gpt-5.6-luna": { "npm": "@ai-sdk/openai" }, "grok-4.5": { "npm": "@ai-sdk/openai" }, "grok-4.6": { "npm": "@ai-sdk/openai" }, "minimax-m2.5": { "npm": "@ai-sdk/anthropic" }, "minimax-m2.7": { "npm": "@ai-sdk/anthropic" }, "minimax-m3": { "npm": "@ai-sdk/anthropic" }, "muse-spark-1.2-contributor": { "npm": "@ai-sdk/openai" }, "qwen3.8-flash": { "npm": "@ai-sdk/anthropic" } },
2030
+ "opencode": { "claude-3-5-haiku": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "claude-fable-5": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "claude-haiku-4-5": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "claude-opus-4-1": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "claude-opus-4-5": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "claude-opus-4-6": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "claude-opus-4-7": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "claude-opus-4-8": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "claude-opus-5": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "claude-sonnet-4": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "claude-sonnet-4-5": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "claude-sonnet-4-6": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "claude-sonnet-5": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "gemini-3-flash": { "adapter": { "kind": "google", "normalizeBaseUrl": false } }, "gemini-3-pro": { "adapter": { "kind": "google", "normalizeBaseUrl": false } }, "gemini-3.1-pro": { "adapter": { "kind": "google", "normalizeBaseUrl": false } }, "gemini-3.5-flash": { "adapter": { "kind": "google", "normalizeBaseUrl": false } }, "gemini-3.5-flash-lite": { "adapter": { "kind": "google", "normalizeBaseUrl": false } }, "gemini-3.6-flash": { "adapter": { "kind": "google", "normalizeBaseUrl": false } }, "gemini-3.7-flash": { "adapter": { "kind": "google", "normalizeBaseUrl": false } }, "gpt-5": { "adapter": { "kind": "openai" } }, "gpt-5-codex": { "adapter": { "kind": "openai" } }, "gpt-5-nano": { "adapter": { "kind": "openai" } }, "gpt-5.1": { "adapter": { "kind": "openai" } }, "gpt-5.1-codex": { "adapter": { "kind": "openai" } }, "gpt-5.1-codex-max": { "adapter": { "kind": "openai" } }, "gpt-5.1-codex-mini": { "adapter": { "kind": "openai" } }, "gpt-5.2": { "adapter": { "kind": "openai" } }, "gpt-5.2-codex": { "adapter": { "kind": "openai" } }, "gpt-5.3-codex": { "adapter": { "kind": "openai" } }, "gpt-5.3-codex-spark": { "adapter": { "kind": "openai" } }, "gpt-5.4": { "adapter": { "kind": "openai" } }, "gpt-5.4-mini": { "adapter": { "kind": "openai" } }, "gpt-5.4-nano": { "adapter": { "kind": "openai" } }, "gpt-5.4-pro": { "adapter": { "kind": "openai" } }, "gpt-5.5": { "adapter": { "kind": "openai" } }, "gpt-5.5-pro": { "adapter": { "kind": "openai" } }, "gpt-5.6-luna": { "adapter": { "kind": "openai" } }, "gpt-5.6-sol": { "adapter": { "kind": "openai" } }, "gpt-5.6-terra": { "adapter": { "kind": "openai" } }, "grok-4.5": { "adapter": { "kind": "openai" } }, "grok-4.6": { "adapter": { "kind": "openai" } }, "grok-build-0.1": { "adapter": { "kind": "openai" } }, "minimax-m2.1-free": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "minimax-m2.5-free": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "minimax-m3-free": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "muse-spark-1.2": { "adapter": { "kind": "openai" } }, "muse-spark-1.2-contributor-free": { "adapter": { "kind": "openai" } }, "qwen3.5-plus": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "qwen3.6-plus": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "qwen3.6-plus-free": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } } },
2031
+ "opencode-go": { "gpt-5.6-luna": { "adapter": { "kind": "openai" } }, "grok-4.5": { "adapter": { "kind": "openai" } }, "grok-4.6": { "adapter": { "kind": "openai" } }, "minimax-m2.5": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "minimax-m2.7": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "minimax-m3": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } }, "muse-spark-1.2-contributor": { "adapter": { "kind": "openai" } }, "qwen3.8-flash": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true } } },
2032
2032
  "openrouter": {},
2033
2033
  "siliconflow": {},
2034
2034
  "stepfun": {},
@@ -2047,7 +2047,7 @@ export const GENERATED_MODELS_DEV_MODEL_PROVIDER_OVERRIDES = {
2047
2047
  "xiaomi-token-plan-ams": {},
2048
2048
  "zai": {},
2049
2049
  "zai-coding-plan": {},
2050
- "zenmux": { "anthropic/claude-3.5-haiku": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-3.7-sonnet": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-fable-5": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-haiku-4.5": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-opus-4": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-opus-4.1": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-opus-4.5": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-opus-4.6": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-opus-4.7": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-opus-4.8": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-sonnet-4": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-sonnet-4.5": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-sonnet-4.6": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-sonnet-5": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-sonnet-5-free": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "minimax/minimax-m2": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "minimax/minimax-m2.1": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "minimax/minimax-m2.5": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "minimax/minimax-m2.5-lightning": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "minimax/minimax-m2.7": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "minimax/minimax-m2.7-highspeed": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "minimax/minimax-m3": { "npm": "@ai-sdk/anthropic", "api": "https://zenmux.ai/api/anthropic/v1" }, "openai/gpt-5": { "npm": "@ai-sdk/openai", "api": "https://zenmux.ai/api/v1" }, "openai/gpt-5-codex": { "npm": "@ai-sdk/openai", "api": "https://zenmux.ai/api/v1" }, "openai/gpt-5.1": { "npm": "@ai-sdk/openai", "api": "https://zenmux.ai/api/v1" }, "openai/gpt-5.1-chat": { "npm": "@ai-sdk/openai", "api": "https://zenmux.ai/api/v1" }, "openai/gpt-5.1-codex": { "npm": "@ai-sdk/openai", "api": "https://zenmux.ai/api/v1" }, "openai/gpt-5.1-codex-mini": { "npm": "@ai-sdk/openai", "api": "https://zenmux.ai/api/v1" }, "openai/gpt-5.2": { "npm": "@ai-sdk/openai", "api": "https://zenmux.ai/api/v1" }, "openai/gpt-5.2-codex": { "npm": "@ai-sdk/openai", "api": "https://zenmux.ai/api/v1" }, "openai/gpt-5.2-pro": { "npm": "@ai-sdk/openai", "api": "https://zenmux.ai/api/v1" }, "openai/gpt-5.3-chat": { "npm": "@ai-sdk/openai", "api": "https://zenmux.ai/api/v1" }, "openai/gpt-5.3-codex": { "npm": "@ai-sdk/openai", "api": "https://zenmux.ai/api/v1" }, "openai/gpt-5.4": { "npm": "@ai-sdk/openai", "api": "https://zenmux.ai/api/v1" }, "openai/gpt-5.4-mini": { "npm": "@ai-sdk/openai", "api": "https://zenmux.ai/api/v1" }, "openai/gpt-5.4-nano": { "npm": "@ai-sdk/openai", "api": "https://zenmux.ai/api/v1" }, "openai/gpt-5.4-pro": { "npm": "@ai-sdk/openai", "api": "https://zenmux.ai/api/v1" } },
2050
+ "zenmux": { "anthropic/claude-3.5-haiku": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-3.7-sonnet": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-fable-5": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-haiku-4.5": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-opus-4": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-opus-4.1": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-opus-4.5": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-opus-4.6": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-opus-4.7": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-opus-4.8": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-sonnet-4": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-sonnet-4.5": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-sonnet-4.6": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-sonnet-5": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "anthropic/claude-sonnet-5-free": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "minimax/minimax-m2": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "minimax/minimax-m2.1": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "minimax/minimax-m2.5": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "minimax/minimax-m2.5-lightning": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "minimax/minimax-m2.7": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "minimax/minimax-m2.7-highspeed": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "minimax/minimax-m3": { "adapter": { "kind": "anthropic", "auth": "api-key", "normalizeBaseUrl": true }, "baseUrl": "https://zenmux.ai/api/anthropic/v1" }, "openai/gpt-5": { "adapter": { "kind": "openai" }, "baseUrl": "https://zenmux.ai/api/v1" }, "openai/gpt-5-codex": { "adapter": { "kind": "openai" }, "baseUrl": "https://zenmux.ai/api/v1" }, "openai/gpt-5.1": { "adapter": { "kind": "openai" }, "baseUrl": "https://zenmux.ai/api/v1" }, "openai/gpt-5.1-chat": { "adapter": { "kind": "openai" }, "baseUrl": "https://zenmux.ai/api/v1" }, "openai/gpt-5.1-codex": { "adapter": { "kind": "openai" }, "baseUrl": "https://zenmux.ai/api/v1" }, "openai/gpt-5.1-codex-mini": { "adapter": { "kind": "openai" }, "baseUrl": "https://zenmux.ai/api/v1" }, "openai/gpt-5.2": { "adapter": { "kind": "openai" }, "baseUrl": "https://zenmux.ai/api/v1" }, "openai/gpt-5.2-codex": { "adapter": { "kind": "openai" }, "baseUrl": "https://zenmux.ai/api/v1" }, "openai/gpt-5.2-pro": { "adapter": { "kind": "openai" }, "baseUrl": "https://zenmux.ai/api/v1" }, "openai/gpt-5.3-chat": { "adapter": { "kind": "openai" }, "baseUrl": "https://zenmux.ai/api/v1" }, "openai/gpt-5.3-codex": { "adapter": { "kind": "openai" }, "baseUrl": "https://zenmux.ai/api/v1" }, "openai/gpt-5.4": { "adapter": { "kind": "openai" }, "baseUrl": "https://zenmux.ai/api/v1" }, "openai/gpt-5.4-mini": { "adapter": { "kind": "openai" }, "baseUrl": "https://zenmux.ai/api/v1" }, "openai/gpt-5.4-nano": { "adapter": { "kind": "openai" }, "baseUrl": "https://zenmux.ai/api/v1" }, "openai/gpt-5.4-pro": { "adapter": { "kind": "openai" }, "baseUrl": "https://zenmux.ai/api/v1" } },
2051
2051
  };
2052
2052
  export const GENERATED_MODELS_DEV_PROVIDER_FACTS = {
2053
2053
  "anthropic": { "id": "anthropic", "name": "Anthropic", "doc": "https://docs.anthropic.com/en/docs/about-claude/models" },
@@ -39,7 +39,6 @@ export function installRefreshedModelMetadata(metadata) {
39
39
  function activeMetadata() {
40
40
  return refreshedMetadata ?? bundledModelMetadata;
41
41
  }
42
- const generatedModelProviderOverrides = GENERATED_MODELS_DEV_MODEL_PROVIDER_OVERRIDES;
43
42
  /** Access paths that serve a canonical provider's model catalog. */
44
43
  const GENERATED_METADATA_PROVIDER_ALIASES = {
45
44
  'xai-oauth': 'xai',
@@ -95,8 +94,9 @@ export function modelMetadataIdsForProvider(providerType) {
95
94
  : []),
96
95
  ]));
97
96
  }
98
- export function lookupModelProviderOverride(providerType, modelId) {
99
- return generatedModelProviderOverrides[providerType]?.[modelId.trim()];
97
+ export function lookupModelRuntimeOverride(providerType, modelId) {
98
+ const overrides = GENERATED_MODELS_DEV_MODEL_PROVIDER_OVERRIDES;
99
+ return overrides[providerType]?.[modelId.trim()];
100
100
  }
101
101
  /**
102
102
  * The request wire a model served over the OpenAI adapter must use.
@@ -29,7 +29,7 @@ import { deepSeekModelSupportsResponses } from './model-metadata.js';
29
29
  * Responses and Anthropic Messages. Search never switches wire independently
30
30
  * from the primary model request.
31
31
  */
32
- export function resolveHostedWebSearchCapability(providerType, models, modelId) {
32
+ export function resolveHostedWebSearchCapability(providerType, models, modelId, effectiveWire) {
33
33
  const id = modelId.trim();
34
34
  if (!id)
35
35
  return null;
@@ -39,9 +39,10 @@ export function resolveHostedWebSearchCapability(providerType, models, modelId)
39
39
  const adapter = providerHostedWebSearchAdapter(providerType);
40
40
  if (!adapter)
41
41
  return null;
42
- if (stored?.apiProtocol !== undefined &&
43
- ((adapter.adapter === 'openai-responses' && stored.apiProtocol !== 'openai-responses') ||
44
- (adapter.adapter === 'anthropic-messages' && stored.apiProtocol !== 'anthropic-messages'))) {
42
+ const wire = effectiveWire ?? stored?.apiProtocol;
43
+ if (wire !== undefined &&
44
+ ((adapter.adapter === 'openai-responses' && wire !== 'openai-responses') ||
45
+ (adapter.adapter === 'anthropic-messages' && wire !== 'anthropic-messages'))) {
45
46
  return null;
46
47
  }
47
48
  if (stored?.capabilities?.webSearch === true) {