maka-agent 0.2.0-dev.11.20260831 → 0.2.0-dev.12.20260901

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 (166) hide show
  1. package/LICENSE +2 -2
  2. package/RUNTIME_HOST_PEER_DEPENDENCIES.rust.tsv +70 -0
  3. package/RUNTIME_HOST_PEER_THIRD_PARTY_NOTICES.txt +1839 -140
  4. package/dist/cli-core.js +25 -1
  5. package/dist/mcp-capability-provider.js +1 -1
  6. package/dist/onboarding-catalog.js +3 -5
  7. package/dist/pi-transcript.js +21 -17
  8. package/dist/pi-tui-layout.js +4 -2
  9. package/dist/pi-tui-mcp-status.js +44 -130
  10. package/dist/pi-tui-pickers.js +11 -5
  11. package/dist/pi-tui-runner.js +133 -102
  12. package/dist/runtime-host-cli.js +150 -4
  13. package/dist/runtime-host-lifecycle-transaction.js +5 -2
  14. package/dist/runtime-host-managed-lifecycle-manager.js +1 -0
  15. package/dist/runtime-host-onboarding.js +12 -16
  16. package/dist/runtime-host-peer-management-command.js +16 -4
  17. package/dist/runtime-host-plugin-command.js +101 -0
  18. package/dist/runtime-host-run-command.js +5 -1
  19. package/dist/runtime-host-service-management-command.js +2 -1
  20. package/dist/runtime-host-setup-command.js +1 -0
  21. package/dist/runtime-host-task-readiness.js +2 -3
  22. package/dist/runtime-host-tui-command.js +1 -1
  23. package/dist/runtime-host-tui-context.js +18 -5
  24. package/dist/runtime-host-update-command.js +13 -5
  25. package/dist/runtime-host-update-discovery.js +1 -0
  26. package/dist/tui-clipboard.js +86 -0
  27. package/dist/tui-copy-catalog.js +246 -0
  28. package/dist/tui-copy-command.js +103 -0
  29. package/native/runtime-host-peer/prebuilds/darwin-arm64/maka_runtime_host_peer.node +0 -0
  30. package/native/runtime-host-peer/prebuilds/linux-arm64/maka_runtime_host_peer.node +0 -0
  31. package/native/runtime-host-peer/prebuilds/linux-x64/maka_runtime_host_peer.node +0 -0
  32. package/native/runtime-host-peer/prebuilds/win32-x64/maka_runtime_host_peer.node +0 -0
  33. package/node_modules/@maka/core/dist/attachments.js +80 -1
  34. package/node_modules/@maka/core/dist/bounded-response.js +71 -0
  35. package/node_modules/@maka/core/dist/chat-model-choice.js +8 -33
  36. package/node_modules/@maka/core/dist/client-capability-grant.js +149 -0
  37. package/node_modules/@maka/core/dist/connection-readiness.js +3 -31
  38. package/node_modules/@maka/core/dist/deep-research.js +1 -20
  39. package/node_modules/@maka/core/dist/events.js +22 -1
  40. package/node_modules/@maka/core/dist/foreign-session.js +2 -2
  41. package/node_modules/@maka/core/dist/interaction.js +49 -2
  42. package/node_modules/@maka/core/dist/llm-connections.js +74 -82
  43. package/node_modules/@maka/core/dist/model-catalog.js +221 -315
  44. package/node_modules/@maka/core/dist/model-facts.js +13 -19
  45. package/node_modules/@maka/core/dist/model-metadata.generated.js +1907 -1872
  46. package/node_modules/@maka/core/dist/model-metadata.js +184 -199
  47. package/node_modules/@maka/core/dist/model-thinking.js +1 -1
  48. package/node_modules/@maka/core/dist/models-dev-projection.js +302 -0
  49. package/node_modules/@maka/core/dist/models-dev-refresh.js +55 -0
  50. package/node_modules/@maka/core/dist/onboarding.js +2 -1
  51. package/node_modules/@maka/core/dist/provider-auth.js +47 -291
  52. package/node_modules/@maka/core/dist/provider-registry.js +68 -357
  53. package/node_modules/@maka/core/dist/runtime-event.js +4 -0
  54. package/node_modules/@maka/core/dist/runtime-policy/connection-catalog-codec.js +34 -18
  55. package/node_modules/@maka/core/dist/runtime-policy/model-catalog-entry-codec.js +75 -0
  56. package/node_modules/@maka/core/dist/runtime-policy.js +2 -1
  57. package/node_modules/@maka/core/dist/session-send-projection.js +2 -1
  58. package/node_modules/@maka/core/dist/session-start-mode.js +42 -0
  59. package/node_modules/@maka/core/dist/session.js +119 -5
  60. package/node_modules/@maka/core/dist/slash-command-catalog.js +1 -0
  61. package/node_modules/@maka/core/dist/task-submission-readiness.js +2 -1
  62. package/node_modules/@maka/core/dist/workhub-creation-intent.js +896 -0
  63. package/node_modules/@maka/core/package.json +6 -1
  64. package/node_modules/@maka/runtime/dist/agent-run.js +7 -0
  65. package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +3 -2
  66. package/node_modules/@maka/runtime/dist/image-file.js +5 -20
  67. package/node_modules/@maka/runtime/dist/local-web-fetch.js +2 -43
  68. package/node_modules/@maka/runtime/dist/mcp-tools.js +28 -0
  69. package/node_modules/@maka/runtime/dist/model-fetcher.js +15 -8
  70. package/node_modules/@maka/runtime/dist/model-history.js +18 -1
  71. package/node_modules/@maka/runtime/dist/model-runtime.js +2 -2
  72. package/node_modules/@maka/runtime/dist/plugin-composition-loader.js +173 -20
  73. package/node_modules/@maka/runtime/dist/plugin-runtime.js +219 -0
  74. package/node_modules/@maka/runtime/dist/quiescent-session-snapshot.js +78 -0
  75. package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +3 -0
  76. package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +1 -0
  77. package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +8 -4
  78. package/node_modules/@maka/runtime/dist/telemetry/model-pricing.generated.js +93 -83
  79. package/node_modules/@maka/runtime/dist/test-connection.js +6 -6
  80. package/node_modules/@maka/runtime/dist/tool-runtime.js +50 -6
  81. package/node_modules/@maka/runtime/dist/workers/filesystem-worker.js +39 -16
  82. package/node_modules/@maka/runtime/package.json +1 -0
  83. package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +10 -0
  84. package/node_modules/@maka/runtime-host/dist/client/catalog-reader.js +19 -5
  85. package/node_modules/@maka/runtime-host/dist/client/client-capability-channel.js +3 -2
  86. package/node_modules/@maka/runtime-host/dist/client/connection.js +22 -0
  87. package/node_modules/@maka/runtime-host/dist/client/host-profile.js +1 -0
  88. package/node_modules/@maka/runtime-host/dist/client/index.js +1 -0
  89. package/node_modules/@maka/runtime-host/dist/client/oauth-presentation.js +1 -1
  90. package/node_modules/@maka/runtime-host/dist/client/peer-client.js +4 -0
  91. package/node_modules/@maka/runtime-host/dist/client/reconnecting-connection.js +8 -0
  92. package/node_modules/@maka/runtime-host/dist/operator/index.js +2 -1
  93. package/node_modules/@maka/runtime-host/dist/operator/managed-deployment.js +2 -0
  94. package/node_modules/@maka/runtime-host/dist/operator/peer-management-frame.js +2 -0
  95. package/node_modules/@maka/runtime-host/dist/operator/service-management-frame.js +2 -0
  96. package/node_modules/@maka/runtime-host/dist/peer-mesh/owner.js +1 -0
  97. package/node_modules/@maka/runtime-host/dist/protocol/client-capability.js +22 -1
  98. package/node_modules/@maka/{storage/dist/task-ledger-store-internal.js → runtime-host/dist/protocol/connection-catalog-change.js} +7 -13
  99. package/node_modules/@maka/runtime-host/dist/protocol/index.js +33 -1
  100. package/node_modules/@maka/runtime-host/dist/protocol/operations.js +3 -1
  101. package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +512 -0
  102. package/node_modules/@maka/runtime-host/dist/protocol/runtime-policy.js +25 -61
  103. package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +1 -1
  104. package/node_modules/@maka/runtime-host/dist/protocol/turn.js +4 -1
  105. package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +92 -4
  106. package/node_modules/@maka/runtime-host/dist/server/access-authority.js +15 -13
  107. package/node_modules/@maka/runtime-host/dist/server/access-credential-metadata.js +4 -2
  108. package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +119 -47
  109. package/node_modules/@maka/runtime-host/dist/server/bootstrap-runtime-policy.js +10 -4
  110. package/node_modules/@maka/runtime-host/dist/server/client-capability-coordinator.js +192 -18
  111. package/node_modules/@maka/runtime-host/dist/server/client-capability-invocation-broker.js +122 -48
  112. package/node_modules/@maka/runtime-host/dist/server/client-capability-provider-id.js +31 -0
  113. package/node_modules/@maka/runtime-host/dist/server/connection-effect-coordinator.js +5 -5
  114. package/node_modules/@maka/runtime-host/dist/server/connection-session.js +1 -0
  115. package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +117 -4
  116. package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +2 -2
  117. package/node_modules/@maka/runtime-host/dist/server/extension-bundle.js +249 -0
  118. package/node_modules/@maka/runtime-host/dist/server/extension-package-manifest.js +262 -0
  119. package/node_modules/@maka/runtime-host/dist/server/host-change-feed.js +11 -0
  120. package/node_modules/@maka/runtime-host/dist/server/index.js +5 -0
  121. package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +181 -13
  122. package/node_modules/@maka/runtime-host/dist/server/interaction-projection.js +6 -0
  123. package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +88 -22
  124. package/node_modules/@maka/runtime-host/dist/server/model-metadata-refresh.js +96 -0
  125. package/node_modules/@maka/runtime-host/dist/server/operation-dispatcher.js +43 -118
  126. package/node_modules/@maka/runtime-host/dist/server/plugin-composition-patch.js +58 -0
  127. package/node_modules/@maka/runtime-host/dist/server/plugin-composition-store.js +141 -0
  128. package/node_modules/@maka/runtime-host/dist/server/plugin-package-loader.js +130 -0
  129. package/node_modules/@maka/runtime-host/dist/server/plugin-package-store.js +528 -0
  130. package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +249 -0
  131. package/node_modules/@maka/runtime-host/dist/server/plugin-platform.js +1130 -0
  132. package/node_modules/@maka/runtime-host/dist/server/root-admission-owner.js +4 -0
  133. package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +24 -5
  134. package/node_modules/@maka/runtime-host/dist/server/runtime-policy-coordinator.js +29 -4
  135. package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +2 -1
  136. package/node_modules/@maka/runtime-host/dist/server/session-transcript-pager.js +10 -2
  137. package/node_modules/@maka/runtime-host/dist/server/web-fetch-tool.js +1 -1
  138. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +276 -3
  139. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +101 -1
  140. package/node_modules/@maka/runtime-host/dist/transport/peer-native.js +1 -0
  141. package/node_modules/@maka/runtime-host/dist/webrtc-stun-policy.js +114 -0
  142. package/node_modules/@maka/runtime-host/package.json +2 -0
  143. package/node_modules/@maka/storage/dist/agent-run-store.js +4 -0
  144. package/node_modules/@maka/storage/dist/artifact-store.js +7 -23
  145. package/node_modules/@maka/storage/dist/conversation-operational-state.js +3 -0
  146. package/node_modules/@maka/storage/dist/execution-stores.js +3 -0
  147. package/node_modules/@maka/storage/dist/interaction-store-public.js +1 -1
  148. package/node_modules/@maka/storage/dist/interaction-store.js +173 -0
  149. package/node_modules/@maka/storage/dist/production-session-snapshot.js +761 -0
  150. package/node_modules/@maka/storage/dist/quiescent-session-snapshot.js +1 -1
  151. package/node_modules/@maka/storage/dist/runtime-policy/connection-catalog-document.js +19 -22
  152. package/node_modules/@maka/storage/dist/runtime-policy/coordinator.js +16 -36
  153. package/node_modules/@maka/storage/dist/runtime-policy/onboarding-transaction.js +2 -2
  154. package/node_modules/@maka/storage/dist/runtime-policy-stores.js +1 -1
  155. package/node_modules/@maka/storage/dist/session-message-projection.js +1 -1
  156. package/node_modules/@maka/storage/dist/session-store.js +32 -6
  157. package/node_modules/@maka/storage/dist/session-todo-store.js +6 -68
  158. package/node_modules/@maka/storage/dist/sqlite-core-execution-schema.js +19 -0
  159. package/node_modules/@maka/storage/dist/sqlite-session-metadata-schema.js +10 -1
  160. package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +73 -3
  161. package/node_modules/@maka/storage/dist/sqlite-workflow-schema.js +2 -10
  162. package/node_modules/@maka/storage/package.json +2 -0
  163. package/package.json +1 -1
  164. package/node_modules/@maka/core/dist/task-ledger.js +0 -669
  165. package/node_modules/@maka/storage/dist/task-ledger-authority.js +0 -121
  166. package/node_modules/@maka/storage/dist/task-ledger-store.js +0 -663
package/dist/cli-core.js CHANGED
@@ -121,6 +121,11 @@ function helpText(cliCommand) {
121
121
  ` ${cliCommand} runtime-host access revoke --credential <id>`,
122
122
  ` ${cliCommand} runtime-host project list [--root <path>]`,
123
123
  ` ${cliCommand} runtime-host project add <path> [--prefer] [--root <path>]`,
124
+ ` ${cliCommand} runtime-host plugin status|list|inspect|failures [--root <path>]`,
125
+ ` ${cliCommand} runtime-host plugin install|uninstall|reload <target> [--root <path>]`,
126
+ ` ${cliCommand} runtime-host plugin export <extension-id> <bundle-path> [--root <path>]`,
127
+ ` ${cliCommand} runtime-host plugin apply <operations.json> [--root <path>]`,
128
+ ` ${cliCommand} runtime-host plugin reconcile [--root <path>]`,
124
129
  ` ${cliCommand} runtime-host profile list`,
125
130
  ` ${cliCommand} runtime-host profile set --id <id> --name <name> --tls-url <wss-url> --expected-root <root-id> [--credential-env <name>]`,
126
131
  ` ${cliCommand} runtime-host profile set --id <id> --name <name> --ssh-destination <user@host> --ssh-remote-port <port> --expected-root <root-id> [--ssh-port <port>] [--credential-env <name>]`,
@@ -180,6 +185,9 @@ function helpText(cliCommand) {
180
185
  ' --clear-coordination-relays Remove every manually configured relay',
181
186
  ' --automatic-relay-discovery Enable best-effort public relay discovery',
182
187
  ' --no-automatic-relay-discovery Disable public discovery and retain manual relays',
188
+ ' --default-public-stun Use the packaged best-effort public STUN policy',
189
+ ' --no-public-stun Disable public STUN and keep host candidates only',
190
+ ' --webrtc-stun <stun-url> Use a custom STUN endpoint (repeatable)',
183
191
  '',
184
192
  'Runtime Host access issue options:',
185
193
  ' --root <path> Select the canonical data root',
@@ -248,7 +256,7 @@ export async function runMakaCli(argv = process.argv.slice(2), options = RELEASE
248
256
  case 'runtime-host-serve': {
249
257
  const { runRuntimeHostServiceCli } = await import('./runtime-host-service-command.js');
250
258
  if (command.managedDeployment) {
251
- const { resolveRuntimeHostManagedDeployment, resolveRuntimeHostNpmDeploymentLayout } = await import('@maka/runtime-host/operator');
259
+ const { resolveRuntimeHostManagedDeployment, resolveRuntimeHostNpmDeploymentLayout, resolveRuntimeHostWebRtcStunUrls, } = await import('@maka/runtime-host/operator');
252
260
  const { config } = await resolveRuntimeHostManagedDeployment(command.managedDeployment.rootId);
253
261
  const peer = config.listeners.directPeer?.enabled ? config.listeners.directPeer : undefined;
254
262
  const packageLayout = resolveRuntimeHostNpmDeploymentLayout(config.deploymentRoot, config.launch.package.integrity);
@@ -270,6 +278,7 @@ export async function runMakaCli(argv = process.argv.slice(2), options = RELEASE
270
278
  listenAddresses: peer.listenAddresses,
271
279
  coordinationRelays: peer.coordinationRelays,
272
280
  automaticRelayDiscovery: peer.automaticRelayDiscovery,
281
+ webRtcStunUrls: resolveRuntimeHostWebRtcStunUrls(peer.webRtcStunPolicy),
273
282
  meshDataRoot: join(config.deploymentRoot, 'peer-mesh'),
274
283
  },
275
284
  }
@@ -430,6 +439,8 @@ export async function runMakaCli(argv = process.argv.slice(2), options = RELEASE
430
439
  ? {}
431
440
  : { automaticRelayDiscovery: command.automaticRelayDiscovery }),
432
441
  ...(command.relayDiscoveryStatus ? { relayDiscoveryStatus: true } : {}),
442
+ ...(command.webRtcStunPolicy ? { webRtcStunPolicy: command.webRtcStunPolicy } : {}),
443
+ ...(command.webRtcStunStatus ? { webRtcStunStatus: true } : {}),
433
444
  ...(command.expectedTarget ? { expectedTarget: command.expectedTarget } : {}),
434
445
  ...(command.allowInterruptActiveTasks ? { allowInterruptActiveTasks: true } : {}),
435
446
  });
@@ -469,6 +480,7 @@ export async function runMakaCli(argv = process.argv.slice(2), options = RELEASE
469
480
  ...(command.operatorDeploymentId
470
481
  ? { operatorDeploymentId: command.operatorDeploymentId }
471
482
  : {}),
483
+ ...(command.allowManualUpdate ? { allowManualUpdate: true } : {}),
472
484
  ...(command.allowInterruptActiveTasks ? { allowInterruptActiveTasks: true } : {}),
473
485
  });
474
486
  }
@@ -612,6 +624,18 @@ export async function runMakaCli(argv = process.argv.slice(2), options = RELEASE
612
624
  prefer: command.prefer,
613
625
  });
614
626
  }
627
+ case 'runtime-host-plugin': {
628
+ const { runRuntimeHostPluginCli } = await import('./runtime-host-plugin-command.js');
629
+ return runRuntimeHostPluginCli({
630
+ rootPath: command.rootPath ?? dataRoots.workspaceRoot,
631
+ action: command.action,
632
+ ...(command.subject ? { subject: command.subject } : {}),
633
+ ...(command.targetPath ? { targetPath: command.targetPath } : {}),
634
+ ...(command.rootId ? { rootId: command.rootId } : {}),
635
+ ...(command.cursor === undefined ? {} : { cursor: command.cursor }),
636
+ ...(command.limit === undefined ? {} : { limit: command.limit }),
637
+ });
638
+ }
615
639
  case 'runtime-host-capability-provider-serve': {
616
640
  const { runRuntimeHostCapabilityProviderCli } = await import('./runtime-host-capability-provider-command.js');
617
641
  return runRuntimeHostCapabilityProviderCli({
@@ -71,7 +71,7 @@ export function createMcpCapabilityProvider(manager) {
71
71
  const binding = bindings.get(capabilityBindingKey(frame.offerId, frame.serverId, frame.toolName));
72
72
  if (!binding)
73
73
  throw new Error('MCP capability is not part of the published snapshot');
74
- await options.accept();
74
+ await options.accept({ kind: 'none' });
75
75
  return projectMcpResult(await manager.callTool(binding, frame.arguments, { signal: options.signal }));
76
76
  },
77
77
  };
@@ -16,7 +16,7 @@
16
16
  * specific language governing permissions and limitations
17
17
  * under the License.
18
18
  */
19
- import { CATALOG_PROVIDER_TYPES, PROVIDER_DEFAULTS, providerAuthSupportsApiKey, } from '@maka/core/llm-connections';
19
+ import { CATALOG_PROVIDER_TYPES, PROVIDER_REGISTRY, providerAuthSupportsApiKey, } from '@maka/core/llm-connections';
20
20
  export function listApiKeyOnboardableProviders() {
21
21
  // Custom relays have no built-in base URL and stay listed: `requiresBaseUrl`
22
22
  // tells the wizard to collect an endpoint before the API key. The original
@@ -28,16 +28,14 @@ export function listApiKeyOnboardableProviders() {
28
28
  return CATALOG_PROVIDER_TYPES.filter((providerType) => {
29
29
  if (!providerAuthSupportsApiKey(providerType))
30
30
  return false;
31
- const definition = PROVIDER_DEFAULTS[providerType];
31
+ const definition = PROVIDER_REGISTRY[providerType];
32
32
  return Boolean(definition.baseUrl) || definition.category === 'custom';
33
33
  }).map((providerType) => {
34
- const definition = PROVIDER_DEFAULTS[providerType];
34
+ const definition = PROVIDER_REGISTRY[providerType];
35
35
  return {
36
36
  providerType,
37
37
  label: definition.label,
38
- authKind: definition.authKind,
39
38
  requiresBaseUrl: !definition.baseUrl,
40
- fallbackModels: definition.fallbackModels,
41
39
  };
42
40
  });
43
41
  }
@@ -19,12 +19,14 @@
19
19
  import { Markdown, visibleWidth } from '@earendil-works/pi-tui';
20
20
  import { deriveTurnRecords, STEP_LIMIT_NOTICE_TEXT, } from '@maka/core/session';
21
21
  import { providerRetryDisplaySeconds } from '@maka/core/provider-retry-countdown';
22
+ import { defineUiMessageCatalog, resolveUiMessageCatalog, } from '@maka/core/ui-locale';
23
+ import { TUI_COPY_RESOURCES } from './tui-copy-catalog.js';
22
24
  import { isActiveShellRunStatus } from '@maka/core/shell-run';
23
25
  import { mergeShellRunStateWithDiagnostics } from '@maka/core/shell-run-result';
24
26
  import { projectToolActivityArgs } from '@maka/core/tool-activity-args';
25
27
  import { toolResultActivityStatus, unfinishedToolActivityStatus, } from '@maka/core/tool-result-status';
26
28
  import { homedir } from 'node:os';
27
- import { basename } from 'node:path';
29
+ import { basename, isAbsolute, relative, sep } from 'node:path';
28
30
  import { BoundedChunkBuffer } from './bounded-chunk-buffer.js';
29
31
  import { ansi } from './tui-ansi.js';
30
32
  import { collapseToSingleLine, fitLine, formatTokenCount, limitText, markdownTheme, renderIndented, } from './pi-transcript-format.js';
@@ -1380,28 +1382,23 @@ function formatElapsedDuration(elapsedMs) {
1380
1382
  parts.push(`${remainingSeconds}s`);
1381
1383
  return parts.join(' ');
1382
1384
  }
1383
- /**
1384
- * Pending-queue bar shown above the editor while messages are queued. Each
1385
- * steering message reads `Steering: <text>` (injected into the running turn at
1386
- * the next step boundary); each followup reads `Queued: <text>` (opens the next
1387
- * turn). A trailing hint reminds the user that alt+↑ takes them back to edit.
1388
- * Renders nothing when both queues are empty.
1389
- */
1390
- export function renderMakaPiPendingQueue(state, width, platform = process.platform) {
1385
+ const TUI_PENDING_QUEUE_COPY = resolveUiMessageCatalog(defineUiMessageCatalog()(TUI_COPY_RESOURCES['pending-queue']));
1386
+ export function renderMakaPiPendingQueue(state, width, platform = process.platform, locale = 'en') {
1391
1387
  if (state.steering.length === 0 && state.followup.length === 0) {
1392
1388
  return [];
1393
1389
  }
1390
+ const copy = TUI_PENDING_QUEUE_COPY[locale];
1394
1391
  const safeWidth = Math.max(1, width);
1395
1392
  const steering = state.steering;
1396
1393
  const followup = state.followup;
1397
1394
  const lines = [];
1398
1395
  for (const text of steering) {
1399
- lines.push(fitLine(`${ansi.accent('Steering:')} ${ansi.dim(firstLinePreview(text))}`, safeWidth));
1396
+ lines.push(fitLine(`${ansi.accent(copy.steeringLabel)} ${ansi.dim(firstLinePreview(text))}`, safeWidth));
1400
1397
  }
1401
1398
  for (const text of followup) {
1402
- lines.push(fitLine(`${ansi.dim('Queued:')} ${ansi.dim(firstLinePreview(text))}`, safeWidth));
1399
+ lines.push(fitLine(`${ansi.dim(copy.queuedLabel)} ${ansi.dim(firstLinePreview(text))}`, safeWidth));
1403
1400
  }
1404
- lines.push(fitLine(ansi.dim(renderTuiShortcutCopy('Alt+↑ 取回队列以重新编辑', platform)), safeWidth));
1401
+ lines.push(fitLine(ansi.dim(renderTuiShortcutCopy(copy.requeueHint, platform)), safeWidth));
1405
1402
  return lines;
1406
1403
  }
1407
1404
  /**
@@ -1426,14 +1423,21 @@ function firstLinePreview(text) {
1426
1423
  * Shorten an absolute path to a `~`-relative form for the statusline.
1427
1424
  * `/Users/alice/workspace/project` → `~/workspace/project`.
1428
1425
  * Falls back to the original path if it is not under the home directory.
1426
+ * Comparison runs through `path.relative`, so Windows profile paths and
1427
+ * case-only differences shorten as well; the remainder keeps its native
1428
+ * separators (`~/Videos\Clips` on Windows).
1429
1429
  */
1430
- function shortenCwd(cwd, homeDir) {
1430
+ export function shortenCwd(cwd, homeDir) {
1431
1431
  const home = homeDir ?? homedir();
1432
- if (home && cwd.startsWith(home + '/'))
1433
- return `~${cwd.slice(home.length)}`;
1434
- if (home && cwd === home)
1432
+ if (!home)
1433
+ return cwd;
1434
+ const rel = relative(home, cwd);
1435
+ if (rel === '')
1435
1436
  return '~';
1436
- return cwd;
1437
+ if (isAbsolute(rel) || rel === '..' || rel.startsWith(`..${sep}`)) {
1438
+ return cwd;
1439
+ }
1440
+ return `~/${rel}`;
1437
1441
  }
1438
1442
  function formatCost(costUsd) {
1439
1443
  if (costUsd < 0.01)
@@ -91,12 +91,14 @@ export class MakaActivityStripComponent {
91
91
  /** The pending-queue bar (Steering:/Queued:) rendered just above the editor. */
92
92
  export class MakaPendingQueueComponent {
93
93
  state;
94
- constructor(state) {
94
+ locale;
95
+ constructor(state, locale = 'en') {
95
96
  this.state = state;
97
+ this.locale = locale;
96
98
  }
97
99
  invalidate() { }
98
100
  render(width) {
99
- return renderMakaPiPendingQueue(this.state, width);
101
+ return renderMakaPiPendingQueue(this.state, width, process.platform, this.locale);
100
102
  }
101
103
  }
102
104
  /**
@@ -90,7 +90,7 @@ export class McpManagementOverlay {
90
90
  }
91
91
  }
92
92
  catch {
93
- this.notice = { level: 'error', text: copy(this.input.locale, 'invalid') };
93
+ this.notice = { level: 'error', text: resultCopy(this.input.locale, 'invalid') };
94
94
  this.backToList(false);
95
95
  }
96
96
  }
@@ -222,7 +222,7 @@ export class McpManagementOverlay {
222
222
  startEdit(serverId) {
223
223
  const edit = this.management()?.configForEdit(serverId);
224
224
  if (!edit) {
225
- this.notice = { level: 'error', text: copy(this.input.locale, 'missing') };
225
+ this.notice = { level: 'error', text: resultCopy(this.input.locale, 'missing') };
226
226
  return;
227
227
  }
228
228
  this.startInput('edit', undefined, serverId, edit.revision, JSON.stringify(edit.config, null, 2));
@@ -324,7 +324,7 @@ export class McpManagementOverlay {
324
324
  this.notice = undefined;
325
325
  }
326
326
  catch {
327
- this.notice = { level: 'error', text: copy(this.input.locale, 'invalid') };
327
+ this.notice = { level: 'error', text: resultCopy(this.input.locale, 'invalid') };
328
328
  }
329
329
  this.input.onChange();
330
330
  }
@@ -334,7 +334,7 @@ export class McpManagementOverlay {
334
334
  return;
335
335
  if (this.input.canManage && !this.input.canManage()) {
336
336
  this.backToList(false);
337
- this.notice = { level: 'error', text: copy(this.input.locale, 'turn_active') };
337
+ this.notice = { level: 'error', text: resultCopy(this.input.locale, 'turn_active') };
338
338
  this.input.onChange();
339
339
  return;
340
340
  }
@@ -362,30 +362,15 @@ export class McpManagementOverlay {
362
362
  return unavailableDocument(this.input.locale);
363
363
  if (this.phase.kind === 'input')
364
364
  return this.inputDocument(width);
365
+ const editor = MCP_STATUS_COPY[this.input.locale].editor;
365
366
  if (this.phase.kind === 'add_choice') {
366
- return [
367
- heading(this.input.locale, 'Add MCP server', '添加 MCP 服务器'),
368
- '',
369
- 'g Guided setup',
370
- 'j Paste JSON',
371
- ];
367
+ return [ansi.bold(editor.addTitle), '', 'g Guided setup', 'j Paste JSON'];
372
368
  }
373
369
  if (this.phase.kind === 'transport') {
374
- return [
375
- heading(this.input.locale, 'Transport', '传输方式'),
376
- '',
377
- '1 stdio',
378
- '2 Streamable HTTP',
379
- ];
370
+ return [ansi.bold(editor.transportTitle), '', '1 stdio', '2 Streamable HTTP'];
380
371
  }
381
372
  if (this.phase.kind === 'protocol') {
382
- return [
383
- heading(this.input.locale, 'Protocol preference', '协议偏好'),
384
- '',
385
- '1 legacy',
386
- '2 auto',
387
- '3 2026-07-28',
388
- ];
373
+ return [ansi.bold(editor.protocolTitle), '', '1 legacy', '2 auto', '3 2026-07-28'];
389
374
  }
390
375
  if (this.phase.kind === 'confirm_add') {
391
376
  return confirmAddDocument(this.phase.draft, this.input.locale);
@@ -395,20 +380,18 @@ export class McpManagementOverlay {
395
380
  }
396
381
  if (this.phase.kind === 'confirm_remove') {
397
382
  return [
398
- ansi.red(heading(this.input.locale, `Remove ${this.phase.serverId}?`, `删除 ${this.phase.serverId}?`)),
383
+ ansi.red(ansi.bold(formatUiMessage(editor.confirmRemoveTitle, { serverId: this.phase.serverId }, this.input.locale))),
399
384
  '',
400
- confirmCopy(this.input.locale),
385
+ editor.confirmHint,
401
386
  ];
402
387
  }
403
388
  if (this.phase.kind === 'confirm_remove_publication_credential') {
404
389
  return [
405
- heading(this.input.locale, 'Remove the remote provider credential?', '删除远程 Provider 凭据?'),
390
+ ansi.bold(editor.confirmRemoveCredentialTitle),
406
391
  '',
407
- this.input.locale === 'zh'
408
- ? '这会停止向所选 Runtime Host 发布 MCP 工具。'
409
- : 'This stops publishing MCP tools to the selected Runtime Host.',
392
+ editor.confirmRemoveCredentialDetail,
410
393
  '',
411
- confirmCopy(this.input.locale),
394
+ editor.confirmHint,
412
395
  ];
413
396
  }
414
397
  if (this.phase.kind === 'busy')
@@ -613,152 +596,83 @@ function serverLines(server, locale, selected) {
613
596
  ];
614
597
  }
615
598
  function actionNotice(result, locale) {
616
- if (result.status === 'conflict')
617
- return { level: 'error', text: copy(locale, result.reason) };
618
- if (result.status === 'failed')
619
- return { level: 'error', text: copy(locale, result.reason) };
599
+ if (result.status === 'conflict' || result.status === 'failed') {
600
+ return { level: 'error', text: resultCopy(locale, result.reason) };
601
+ }
620
602
  if (result.status === 'tested') {
621
603
  if (result.test.ok && result.effect === 'publication_failed') {
622
- return { level: 'error', text: copy(locale, 'test_publication_failed') };
604
+ return { level: 'error', text: resultCopy(locale, 'test_publication_failed') };
623
605
  }
624
606
  if (result.test.ok && result.effect === 'pending_host') {
625
- return { level: 'info', text: copy(locale, 'test_pending_host') };
607
+ return { level: 'info', text: resultCopy(locale, 'test_pending_host') };
626
608
  }
627
609
  return {
628
610
  level: result.test.ok ? 'info' : 'error',
629
- text: result.test.ok ? copy(locale, 'test_ok') : copy(locale, 'test_failed'),
611
+ text: result.test.ok ? resultCopy(locale, 'test_ok') : resultCopy(locale, 'test_failed'),
630
612
  };
631
613
  }
632
614
  return {
633
615
  level: result.effect === 'sync_failed' || result.effect === 'publication_failed' ? 'error' : 'info',
634
- text: copy(locale, result.effect),
616
+ text: resultCopy(locale, result.effect),
635
617
  };
636
618
  }
637
- function copy(locale, key) {
638
- const en = {
639
- exists: 'That server ID already exists.',
640
- stale_config: 'MCP configuration changed; retry the action.',
641
- stale_edit: 'This server changed; reopen it before editing.',
642
- stale_import: 'An imported entry changed; preview the import again.',
643
- missing: 'That server no longer exists.',
644
- closed: 'The MCP controller is closed.',
645
- 'invalid-config': 'The server configuration is invalid.',
646
- 'credential-cleanup-failed': 'Stored credentials could not be removed; the configuration was not changed.',
647
- 'publication-credential-failed': 'The provider credential could not be stored or applied.',
648
- 'persist-failed': 'The configuration could not be saved.',
649
- 'manager-failed': 'The MCP connection action failed.',
650
- turn_active: 'MCP cannot be changed while a turn or another control action is running.',
651
- invalid: 'Check the value and try again.',
652
- published: 'Configuration saved and tools refreshed.',
653
- pending_host: 'Configuration saved; publication is waiting for Runtime Host.',
654
- sync_failed: 'Configuration saved, but the MCP manager is out of sync.',
655
- publication_failed: 'Configuration saved, but capability publication failed.',
656
- test_ok: 'Connection test passed.',
657
- test_failed: 'Connection test failed.',
658
- test_publication_failed: 'Connection test passed, but capability publication failed.',
659
- test_pending_host: 'Connection test passed; publication is waiting for Runtime Host.',
660
- };
661
- const zh = {
662
- exists: '该服务器 ID 已存在。',
663
- stale_config: 'MCP 配置已变化,请重试。',
664
- stale_edit: '该服务器已变化,请重新打开后编辑。',
665
- stale_import: '导入项已变化,请重新预览。',
666
- missing: '该服务器已不存在。',
667
- closed: 'MCP 控制器已关闭。',
668
- 'invalid-config': '服务器配置无效。',
669
- 'credential-cleanup-failed': '无法删除旧凭据,配置未修改。',
670
- 'publication-credential-failed': '无法保存或应用 Provider 凭据。',
671
- 'persist-failed': '无法保存配置。',
672
- 'manager-failed': 'MCP 连接操作失败。',
673
- turn_active: 'Turn 或其他控制操作运行期间不能修改 MCP。',
674
- invalid: '请检查输入后重试。',
675
- published: '配置已保存,工具已刷新。',
676
- pending_host: '配置已保存,正等待 Runtime Host 发布。',
677
- sync_failed: '配置已保存,但 MCP Manager 尚未同步。',
678
- publication_failed: '配置已保存,但 capability 发布失败。',
679
- test_ok: '连接测试通过。',
680
- test_failed: '连接测试失败。',
681
- test_publication_failed: '连接测试通过,但 capability 发布失败。',
682
- test_pending_host: '连接测试通过,正等待 Runtime Host 发布。',
683
- };
684
- return (locale === 'zh' ? zh : en)[key] ?? key;
619
+ function resultCopy(locale, code) {
620
+ return MCP_STATUS_COPY[locale].editor.results[code] ?? code;
685
621
  }
686
622
  function confirmAddDocument(draft, locale) {
623
+ const editor = MCP_STATUS_COPY[locale].editor;
687
624
  return [
688
- heading(locale, 'Add this MCP server?', '添加该 MCP 服务器?'),
625
+ ansi.bold(editor.confirmAddTitle),
689
626
  '',
690
627
  `${draft.serverId} · ${draft.transport} · ${draft.protocol}`,
691
628
  draft.transport === 'stdio' ? (draft.command ?? '') : (draft.url ?? ''),
692
629
  '',
693
- confirmCopy(locale),
630
+ editor.confirmHint,
694
631
  ];
695
632
  }
696
633
  function confirmImportDocument(preview, locale) {
634
+ const editor = MCP_STATUS_COPY[locale].editor;
697
635
  return [
698
- heading(locale, 'Import MCP servers?', '导入 MCP 服务器?'),
636
+ ansi.bold(editor.confirmImportTitle),
699
637
  '',
700
638
  ...preview.entries.map((entry) => `${entry.change === 'add' ? '+' : '~'} ${entry.serverId} · ${entry.transport} · ${entry.protocol}`),
701
639
  '',
702
- confirmCopy(locale),
640
+ editor.confirmHint,
703
641
  ];
704
642
  }
705
643
  function actionLabel(action, locale) {
706
- if (locale === 'zh')
707
- return '正在应用 MCP 更改…';
644
+ const labels = MCP_STATUS_COPY[locale].editor.action;
708
645
  if (action.kind === 'test')
709
- return 'Testing MCP server…';
646
+ return labels.test;
710
647
  if (action.kind === 'reconnect')
711
- return 'Reconnecting MCP server…';
712
- return 'Applying MCP configuration…';
648
+ return labels.reconnect;
649
+ return labels.apply;
713
650
  }
714
651
  function inputLabel(kind, locale) {
715
- const labels = {
716
- server_id: ['Server ID', '服务器 ID'],
717
- command: ['Command', '命令'],
718
- args: ['Arguments', '参数'],
719
- url: ['Streamable HTTP URL', 'Streamable HTTP URL'],
720
- cwd: ['Working directory', '工作目录'],
721
- env: ['Environment', '环境变量'],
722
- headers: ['Request headers', '请求头'],
723
- edit: ['Edit server JSON', '编辑服务器 JSON'],
724
- import: ['Paste MCP JSON', '粘贴 MCP JSON'],
725
- publication_credential: ['Provider credential', 'Provider 凭据'],
726
- };
727
- return labels[kind][locale === 'zh' ? 1 : 0];
652
+ return MCP_STATUS_COPY[locale].editor.inputLabels[kind];
728
653
  }
729
654
  function inputHint(kind, locale) {
730
- const optional = locale === 'zh' ? '可留空' : 'optional';
655
+ const hints = MCP_STATUS_COPY[locale].editor.hints;
731
656
  if (kind === 'args')
732
- return `JSON string array, ${optional}`;
657
+ return hints.args;
733
658
  if (kind === 'env' || kind === 'headers')
734
- return `JSON string map, ${optional}`;
659
+ return hints.map;
735
660
  if (kind === 'cwd')
736
- return optional;
737
- if (kind === 'publication_credential') {
738
- return locale === 'zh'
739
- ? '仅保存到本机凭据存储;不会写入 profile、参数或对话 · Enter 提交 · Esc 返回'
740
- : 'Stored only in the local credential store; never written to profiles, arguments, or chat · Enter submit · Esc back';
741
- }
742
- return locale === 'zh' ? 'Enter 提交 · Esc 返回' : 'Enter submit · Esc back';
661
+ return hints.optional;
662
+ if (kind === 'publication_credential')
663
+ return hints.credential;
664
+ return hints.submit;
743
665
  }
744
666
  function configurationLine(state, locale) {
745
- if (state === 'synchronizing') {
746
- return locale === 'zh' ? '配置同步中…' : 'Configuration is synchronizing…';
747
- }
748
- return ansi.red(locale === 'zh'
749
- ? '持久化配置与 MCP Manager 尚未同步。'
750
- : 'Durable configuration and MCP Manager are out of sync.');
667
+ const editor = MCP_STATUS_COPY[locale].editor;
668
+ if (state === 'synchronizing')
669
+ return editor.synchronizing;
670
+ return ansi.red(editor.outOfSync);
751
671
  }
752
672
  function unavailableDocument(locale) {
753
673
  const copy = MCP_STATUS_COPY[locale];
754
674
  return [ansi.yellow(copy.unavailableTitle), copy.unavailableDetail];
755
675
  }
756
- function heading(locale, en, zh) {
757
- return ansi.bold(locale === 'zh' ? zh : en);
758
- }
759
- function confirmCopy(locale) {
760
- return locale === 'zh' ? 'y 确认 · Esc 取消' : 'y Confirm · Esc cancel';
761
- }
762
676
  function loadingCopy(locale) {
763
677
  return MCP_STATUS_COPY[locale].loading;
764
678
  }
@@ -18,7 +18,7 @@
18
18
  */
19
19
  import { CombinedAutocompleteProvider, Editor, Key, SelectList, decodeKittyPrintable, isKeyRepeat, matchesKey, truncateToWidth, visibleWidth, } from '@earendil-works/pi-tui';
20
20
  import { defineUiMessageCatalog, formatUiMessage, resolveUiMessageCatalog, } from '@maka/core/ui-locale';
21
- import { PROVIDER_DEFAULTS } from '@maka/core/llm-connections';
21
+ import { providerDefaultsOf, } from '@maka/core/llm-connections';
22
22
  import { ansi, editorTheme, selectListTheme, stripAnsi } from './tui-ansi.js';
23
23
  import { TUI_COPY_RESOURCES } from './tui-copy-catalog.js';
24
24
  const TUI_PICKER_COPY = resolveUiMessageCatalog(defineUiMessageCatalog()(TUI_COPY_RESOURCES.pickers));
@@ -480,12 +480,12 @@ export function modelChoiceConnectionLabels(choices) {
480
480
  const labels = new Map();
481
481
  for (const connection of connections) {
482
482
  let label = connection.base;
483
- if (used.has(label) && connection.connectionId) {
483
+ if (used.has(label)) {
484
484
  label = `${connection.base} · ${connection.connectionId}`;
485
485
  }
486
486
  let suffix = 2;
487
487
  while (used.has(label)) {
488
- label = `${connection.base} · ${connection.connectionId ?? connection.connectionSlug} · ${suffix}`;
488
+ label = `${connection.base} · ${connection.connectionId} · ${suffix}`;
489
489
  suffix += 1;
490
490
  }
491
491
  used.add(label);
@@ -527,8 +527,14 @@ function matchesModelChoice(choice, query) {
527
527
  return true;
528
528
  if (choice.providerType.toLowerCase().includes(query))
529
529
  return true;
530
- const providerLabel = PROVIDER_DEFAULTS[choice.providerType]?.label;
531
- if (providerLabel && providerLabel.toLowerCase().includes(query))
530
+ // Both provider names, not just the one the row shows: the dense `menuLabel`
531
+ // drops the qualifier the full label carries ("Google Gemini" → "Google"), so
532
+ // searching only the displayed one loses `gemini`, and searching only the full
533
+ // one loses a qualifier that exists nowhere else ("OpenAI OAuth").
534
+ const provider = providerDefaultsOf(choice.providerType);
535
+ if (provider?.label.toLowerCase().includes(query))
536
+ return true;
537
+ if (provider?.menuLabel?.toLowerCase().includes(query))
532
538
  return true;
533
539
  return false;
534
540
  }