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

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 (226) 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/THIRD_PARTY_NOTICES.txt +2 -2
  5. package/dist/acp/maka-acp-agent.js +6 -3
  6. package/dist/acp/session-registry.js +307 -0
  7. package/dist/acp/stdio-server.js +20 -1
  8. package/dist/cli-core.js +40 -3
  9. package/dist/mcp-capability-provider.js +1 -1
  10. package/dist/onboarding-catalog.js +3 -5
  11. package/dist/pi-transcript.js +21 -17
  12. package/dist/pi-tui-layout.js +4 -2
  13. package/dist/pi-tui-mcp-status.js +44 -130
  14. package/dist/pi-tui-pickers.js +11 -5
  15. package/dist/pi-tui-runner.js +133 -102
  16. package/dist/runtime-host-access-command.js +37 -4
  17. package/dist/runtime-host-capability-provider-command.js +16 -2
  18. package/dist/runtime-host-cli-context.js +73 -3
  19. package/dist/runtime-host-cli.js +187 -10
  20. package/dist/runtime-host-lifecycle-transaction.js +5 -2
  21. package/dist/runtime-host-managed-lifecycle-manager.js +1 -0
  22. package/dist/runtime-host-onboarding.js +12 -16
  23. package/dist/runtime-host-peer-management-command.js +16 -4
  24. package/dist/runtime-host-plugin-command.js +101 -0
  25. package/dist/runtime-host-run-command.js +8 -2
  26. package/dist/runtime-host-service-management-command.js +2 -1
  27. package/dist/runtime-host-setup-command.js +1 -0
  28. package/dist/runtime-host-task-readiness.js +2 -3
  29. package/dist/runtime-host-tui-command.js +1 -1
  30. package/dist/runtime-host-tui-context.js +18 -5
  31. package/dist/runtime-host-update-command.js +71 -35
  32. package/dist/runtime-host-update-discovery.js +1 -0
  33. package/dist/tui-clipboard.js +86 -0
  34. package/dist/tui-copy-catalog.js +248 -0
  35. package/dist/tui-copy-command.js +103 -0
  36. package/native/runtime-host-peer/prebuilds/darwin-arm64/maka_runtime_host_peer.node +0 -0
  37. package/native/runtime-host-peer/prebuilds/linux-arm64/maka_runtime_host_peer.node +0 -0
  38. package/native/runtime-host-peer/prebuilds/linux-x64/maka_runtime_host_peer.node +0 -0
  39. package/native/runtime-host-peer/prebuilds/win32-x64/maka_runtime_host_peer.node +0 -0
  40. package/node_modules/@maka/core/dist/attachments.js +92 -1
  41. package/node_modules/@maka/core/dist/bounded-response.js +71 -0
  42. package/node_modules/@maka/core/dist/chat-model-choice.js +8 -33
  43. package/node_modules/@maka/core/dist/client-capability-grant.js +149 -0
  44. package/node_modules/@maka/core/dist/connection-error-copy.js +17 -34
  45. package/node_modules/@maka/core/dist/connection-readiness.js +3 -31
  46. package/node_modules/@maka/core/dist/deep-research.js +1 -20
  47. package/node_modules/@maka/core/dist/events.js +22 -14
  48. package/node_modules/@maka/core/dist/foreign-session.js +2 -2
  49. package/node_modules/@maka/core/dist/interaction.js +49 -2
  50. package/node_modules/@maka/core/dist/llm-connections.js +74 -82
  51. package/node_modules/@maka/core/dist/maka-wordmark.js +23 -0
  52. package/node_modules/@maka/core/dist/model-catalog.js +242 -315
  53. package/node_modules/@maka/core/dist/model-facts.js +13 -19
  54. package/node_modules/@maka/core/dist/model-metadata.generated.js +1907 -1872
  55. package/node_modules/@maka/core/dist/model-metadata.js +184 -199
  56. package/node_modules/@maka/core/dist/model-thinking.js +1 -1
  57. package/node_modules/@maka/core/dist/models-dev-projection.js +302 -0
  58. package/node_modules/@maka/core/dist/models-dev-refresh.js +55 -0
  59. package/node_modules/@maka/core/dist/onboarding.js +2 -1
  60. package/node_modules/@maka/core/dist/provider-auth.js +47 -291
  61. package/node_modules/@maka/core/dist/provider-registry.js +68 -357
  62. package/node_modules/@maka/core/dist/runtime-event.js +5 -0
  63. package/node_modules/@maka/core/dist/runtime-policy/connection-catalog-codec.js +83 -18
  64. package/node_modules/@maka/core/dist/runtime-policy/credential-vault-codec.js +9 -1
  65. package/node_modules/@maka/core/dist/runtime-policy/model-catalog-entry-codec.js +84 -0
  66. package/node_modules/@maka/core/dist/runtime-policy/policy-codec.js +75 -0
  67. package/node_modules/@maka/core/dist/runtime-policy.js +5 -2
  68. package/node_modules/@maka/core/dist/session-send-projection.js +2 -1
  69. package/node_modules/@maka/core/dist/session-start-mode.js +42 -0
  70. package/node_modules/@maka/core/dist/session.js +120 -5
  71. package/node_modules/@maka/core/dist/settings.js +10 -2
  72. package/node_modules/@maka/core/dist/slash-command-catalog.js +1 -0
  73. package/node_modules/@maka/core/dist/task-submission-readiness.js +2 -1
  74. package/node_modules/@maka/core/dist/usage-record-schema.js +11 -1
  75. package/node_modules/@maka/core/dist/workhub-creation-intent.js +896 -0
  76. package/node_modules/@maka/core/package.json +8 -2
  77. package/node_modules/@maka/mcp/dist/index.js +1 -0
  78. package/node_modules/@maka/runtime/dist/agent-run.js +7 -0
  79. package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +55 -82
  80. package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +178 -140
  81. package/node_modules/@maka/runtime/dist/archive-read-tool.js +26 -5
  82. package/node_modules/@maka/runtime/dist/builtin-tools.js +27 -2
  83. package/node_modules/@maka/runtime/dist/context-budget-policy.js +0 -12
  84. package/node_modules/@maka/runtime/dist/conversation-copy.js +66 -43
  85. package/node_modules/@maka/runtime/dist/durable-tool-result-projection.js +31 -0
  86. package/node_modules/@maka/runtime/dist/history-compact-error.js +10 -2
  87. package/node_modules/@maka/runtime/dist/history-compact-input-fit.js +7 -1
  88. package/node_modules/@maka/runtime/dist/history-compaction.js +13 -22
  89. package/node_modules/@maka/runtime/dist/image-file.js +5 -20
  90. package/node_modules/@maka/runtime/dist/local-web-fetch.js +2 -43
  91. package/node_modules/@maka/runtime/dist/mcp-tools.js +28 -0
  92. package/node_modules/@maka/runtime/dist/model-fetcher.js +15 -8
  93. package/node_modules/@maka/runtime/dist/model-history.js +59 -17
  94. package/node_modules/@maka/runtime/dist/model-runtime.js +2 -2
  95. package/node_modules/@maka/runtime/dist/plugin-composition-loader.js +173 -20
  96. package/node_modules/@maka/runtime/dist/plugin-runtime.js +219 -0
  97. package/node_modules/@maka/runtime/dist/provider-image-overflow-recovery.js +12 -31
  98. package/node_modules/@maka/runtime/dist/quiescent-session-snapshot.js +78 -0
  99. package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +6 -0
  100. package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +14 -2
  101. package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +11 -10
  102. package/node_modules/@maka/runtime/dist/shell-tools.js +77 -1
  103. package/node_modules/@maka/runtime/dist/telemetry/model-pricing.generated.js +93 -83
  104. package/node_modules/@maka/runtime/dist/test-connection.js +6 -6
  105. package/node_modules/@maka/runtime/dist/tool-availability.js +74 -5
  106. package/node_modules/@maka/runtime/dist/tool-result-archive-resource.js +333 -52
  107. package/node_modules/@maka/runtime/dist/tool-result-archive-transition.js +34 -3
  108. package/node_modules/@maka/runtime/dist/tool-runtime.js +62 -6
  109. package/node_modules/@maka/runtime/dist/workers/filesystem-worker.js +39 -16
  110. package/node_modules/@maka/runtime/package.json +1 -0
  111. package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +10 -3
  112. package/node_modules/@maka/runtime-host/dist/client/catalog-reader.js +59 -18
  113. package/node_modules/@maka/runtime-host/dist/client/client-capability-channel.js +3 -2
  114. package/node_modules/@maka/runtime-host/dist/client/connection.js +72 -31
  115. package/node_modules/@maka/runtime-host/dist/client/host-profile.js +49 -4
  116. package/node_modules/@maka/runtime-host/dist/client/index.js +3 -2
  117. package/node_modules/@maka/runtime-host/dist/client/oauth-presentation.js +1 -1
  118. package/node_modules/@maka/runtime-host/dist/client/owner-connection-code.js +32 -1
  119. package/node_modules/@maka/runtime-host/dist/client/peer-client.js +26 -4
  120. package/node_modules/@maka/runtime-host/dist/client/reconnecting-connection.js +8 -0
  121. package/node_modules/@maka/runtime-host/dist/operator/access-management-frame.js +10 -1
  122. package/node_modules/@maka/runtime-host/dist/operator/index.js +2 -1
  123. package/node_modules/@maka/runtime-host/dist/operator/managed-deployment.js +2 -0
  124. package/node_modules/@maka/runtime-host/dist/operator/peer-management-frame.js +2 -0
  125. package/node_modules/@maka/runtime-host/dist/operator/service-management-frame.js +2 -0
  126. package/node_modules/@maka/runtime-host/dist/peer-mesh/node.js +56 -12
  127. package/node_modules/@maka/runtime-host/dist/peer-mesh/owner.js +4 -0
  128. package/node_modules/@maka/runtime-host/dist/protocol/client-capability.js +22 -1
  129. package/node_modules/@maka/runtime-host/dist/protocol/configuration.js +55 -9
  130. package/node_modules/@maka/{storage/dist/task-ledger-store-internal.js → runtime-host/dist/protocol/connection-catalog-change.js} +7 -13
  131. package/node_modules/@maka/runtime-host/dist/protocol/host-status.js +37 -0
  132. package/node_modules/@maka/runtime-host/dist/protocol/index.js +49 -1
  133. package/node_modules/@maka/runtime-host/dist/protocol/network-proxy.js +1 -7
  134. package/node_modules/@maka/runtime-host/dist/protocol/operations.js +5 -1
  135. package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +512 -0
  136. package/node_modules/@maka/runtime-host/dist/protocol/runtime-policy.js +72 -61
  137. package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +1 -1
  138. package/node_modules/@maka/runtime-host/dist/protocol/session-collaboration.js +4 -2
  139. package/node_modules/@maka/runtime-host/dist/protocol/turn.js +5 -12
  140. package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +92 -4
  141. package/node_modules/@maka/runtime-host/dist/server/access-authority.js +17 -14
  142. package/node_modules/@maka/runtime-host/dist/server/access-credential-metadata.js +4 -2
  143. package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +119 -47
  144. package/node_modules/@maka/runtime-host/dist/server/agent-graph-execution-coordinator.js +1 -2
  145. package/node_modules/@maka/runtime-host/dist/server/bootstrap-runtime-policy.js +10 -4
  146. package/node_modules/@maka/runtime-host/dist/server/canonical-turn-snapshot.js +0 -9
  147. package/node_modules/@maka/runtime-host/dist/server/client-capability-coordinator.js +192 -18
  148. package/node_modules/@maka/runtime-host/dist/server/client-capability-invocation-broker.js +122 -48
  149. package/node_modules/@maka/runtime-host/dist/server/client-capability-provider-id.js +31 -0
  150. package/node_modules/@maka/runtime-host/dist/server/configuration-coordinator.js +20 -1
  151. package/node_modules/@maka/runtime-host/dist/server/connection-effect-coordinator.js +5 -5
  152. package/node_modules/@maka/runtime-host/dist/server/connection-session.js +1 -0
  153. package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +163 -28
  154. package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +2 -2
  155. package/node_modules/@maka/runtime-host/dist/server/execution-service.js +4 -1
  156. package/node_modules/@maka/runtime-host/dist/server/extension-bundle.js +249 -0
  157. package/node_modules/@maka/runtime-host/dist/server/extension-package-manifest.js +262 -0
  158. package/node_modules/@maka/runtime-host/dist/server/host-change-feed.js +11 -0
  159. package/node_modules/@maka/runtime-host/dist/server/host-kernel.js +15 -0
  160. package/node_modules/@maka/runtime-host/dist/server/index.js +5 -0
  161. package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +181 -13
  162. package/node_modules/@maka/runtime-host/dist/server/interaction-projection.js +6 -0
  163. package/node_modules/@maka/runtime-host/dist/server/listener-set.js +8 -4
  164. package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +88 -22
  165. package/node_modules/@maka/runtime-host/dist/server/model-metadata-refresh.js +96 -0
  166. package/node_modules/@maka/runtime-host/dist/server/network-proxy-coordinator.js +0 -1
  167. package/node_modules/@maka/runtime-host/dist/server/operation-dispatcher.js +43 -118
  168. package/node_modules/@maka/runtime-host/dist/server/peer-listener.js +3 -0
  169. package/node_modules/@maka/runtime-host/dist/server/plugin-composition-patch.js +58 -0
  170. package/node_modules/@maka/runtime-host/dist/server/plugin-composition-store.js +141 -0
  171. package/node_modules/@maka/runtime-host/dist/server/plugin-package-loader.js +130 -0
  172. package/node_modules/@maka/runtime-host/dist/server/plugin-package-store.js +528 -0
  173. package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +249 -0
  174. package/node_modules/@maka/runtime-host/dist/server/plugin-platform.js +1130 -0
  175. package/node_modules/@maka/runtime-host/dist/server/root-admission-owner.js +4 -0
  176. package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +24 -5
  177. package/node_modules/@maka/runtime-host/dist/server/runtime-policy-coordinator.js +57 -5
  178. package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +2 -1
  179. package/node_modules/@maka/runtime-host/dist/server/session-retirement-coordinator.js +3 -3
  180. package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +35 -3
  181. package/node_modules/@maka/runtime-host/dist/server/session-sidecar-purge.js +16 -0
  182. package/node_modules/@maka/runtime-host/dist/server/session-transcript-pager.js +10 -2
  183. package/node_modules/@maka/runtime-host/dist/server/web-fetch-tool.js +1 -1
  184. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +276 -3
  185. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +101 -1
  186. package/node_modules/@maka/runtime-host/dist/transport/peer-native.js +1 -0
  187. package/node_modules/@maka/runtime-host/dist/webrtc-stun-policy.js +114 -0
  188. package/node_modules/@maka/runtime-host/package.json +2 -0
  189. package/node_modules/@maka/storage/dist/agent-run-store.js +4 -0
  190. package/node_modules/@maka/storage/dist/artifact-store.js +7 -23
  191. package/node_modules/@maka/storage/dist/conversation-operational-state.js +3 -0
  192. package/node_modules/@maka/storage/dist/execution-stores.js +3 -0
  193. package/node_modules/@maka/storage/dist/interaction-store-public.js +1 -1
  194. package/node_modules/@maka/storage/dist/interaction-store.js +173 -0
  195. package/node_modules/@maka/storage/dist/production-session-snapshot.js +761 -0
  196. package/node_modules/@maka/storage/dist/quiescent-session-snapshot.js +1 -1
  197. package/node_modules/@maka/storage/dist/runtime-policy/connection-catalog-document.js +19 -22
  198. package/node_modules/@maka/storage/dist/runtime-policy/coordinator.js +205 -42
  199. package/node_modules/@maka/storage/dist/runtime-policy/onboarding-transaction.js +2 -2
  200. package/node_modules/@maka/storage/dist/runtime-policy-stores.js +5 -2
  201. package/node_modules/@maka/storage/dist/session-message-projection.js +1 -1
  202. package/node_modules/@maka/storage/dist/session-store.js +32 -6
  203. package/node_modules/@maka/storage/dist/session-todo-store.js +6 -68
  204. package/node_modules/@maka/storage/dist/settings-store.js +16 -25
  205. package/node_modules/@maka/storage/dist/sqlite-core-execution-schema.js +19 -0
  206. package/node_modules/@maka/storage/dist/sqlite-session-metadata-schema.js +10 -1
  207. package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +73 -3
  208. package/node_modules/@maka/storage/dist/sqlite-workflow-schema.js +2 -10
  209. package/node_modules/@maka/storage/package.json +2 -0
  210. package/node_modules/fast-uri/index.js +215 -47
  211. package/node_modules/fast-uri/lib/schemes.js +9 -4
  212. package/node_modules/fast-uri/lib/utils.js +396 -92
  213. package/node_modules/fast-uri/package.json +1 -1
  214. package/node_modules/qs/.github/THREAT_MODEL.md +3 -3
  215. package/node_modules/qs/CHANGELOG.md +15 -0
  216. package/node_modules/qs/README.md +19 -1
  217. package/node_modules/qs/dist/qs.js +21 -21
  218. package/node_modules/qs/eslint.config.mjs +1 -1
  219. package/node_modules/qs/lib/parse.js +3 -4
  220. package/node_modules/qs/lib/stringify.js +23 -8
  221. package/node_modules/qs/lib/utils.js +10 -3
  222. package/node_modules/qs/package.json +4 -4
  223. package/package.json +1 -1
  224. package/node_modules/@maka/core/dist/task-ledger.js +0 -669
  225. package/node_modules/@maka/storage/dist/task-ledger-authority.js +0 -121
  226. package/node_modules/@maka/storage/dist/task-ledger-store.js +0 -663
@@ -4108,7 +4108,7 @@ SOFTWARE.
4108
4108
 
4109
4109
  ================================================================================
4110
4110
 
4111
- Package: fast-uri@3.1.5
4111
+ Package: fast-uri@3.1.7
4112
4112
  Declared license: BSD-3-Clause
4113
4113
  Selected license: BSD-3-Clause
4114
4114
  Repository: git+https://github.com/fastify/fast-uri.git
@@ -6483,7 +6483,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
6483
6483
 
6484
6484
  ================================================================================
6485
6485
 
6486
- Package: qs@6.15.3
6486
+ Package: qs@6.16.0
6487
6487
  Declared license: BSD-3-Clause
6488
6488
  Selected license: BSD-3-Clause
6489
6489
  Repository: https://github.com/ljharb/qs.git
@@ -18,10 +18,13 @@
18
18
  */
19
19
  import { agent, methods } from '@agentclientprotocol/sdk';
20
20
  export function createMakaAcpAgent(options) {
21
- return agent({ name: 'maka' }).onRequest(methods.agent.initialize, () => ({
21
+ return agent({ name: 'maka' })
22
+ .onRequest(methods.agent.initialize, () => ({
22
23
  protocolVersion: 1,
23
- agentCapabilities: {},
24
+ agentCapabilities: { sessionCapabilities: { list: {} } },
24
25
  authMethods: [],
25
26
  agentInfo: { name: 'maka', title: 'Maka', version: options.version },
26
- }));
27
+ }))
28
+ .onRequest(methods.agent.session.new, ({ params }) => options.sessionRegistry.create(params))
29
+ .onRequest(methods.agent.session.list, ({ params }) => options.sessionRegistry.list(params));
27
30
  }
@@ -0,0 +1,307 @@
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 { realpath } from 'node:fs/promises';
21
+ import { isAbsolute, normalize } from 'node:path';
22
+ import { RequestError, } from '@agentclientprotocol/sdk';
23
+ import { readRuntimeHostSessionCatalogPage, RuntimeHostCatalogReadError, RuntimeHostOperationError, RuntimeHostRequestInterruptedError, RuntimeHostSessionCatalogRevisionChangedError, } from '@maka/runtime-host/client';
24
+ import { SESSION_CATALOG_CURSOR_MAX_BYTES, SESSION_CATALOG_CWD_MAX_BYTES, } from '@maka/runtime-host/protocol';
25
+ const ACP_SESSION_CURSOR_MAX_BYTES = 8 * 1024;
26
+ /** Owns all Runtime Host resources associated with one ACP connection. */
27
+ export class AcpSessionRegistry {
28
+ #connect;
29
+ #newSessionId;
30
+ #inFlightOperations = new Set();
31
+ #connection;
32
+ #connectTask;
33
+ #connectAbortController;
34
+ #closing = false;
35
+ #connectionCloseTask;
36
+ #disposeTask;
37
+ constructor(options) {
38
+ this.#connect = options.connect;
39
+ this.#newSessionId = options.newSessionId ?? randomUUID;
40
+ }
41
+ async create(params) {
42
+ this.#assertOpen('session.create');
43
+ validateNewSessionParams(params);
44
+ return this.#track(this.#create(params));
45
+ }
46
+ async list(params) {
47
+ this.#assertOpen('session.catalog.query');
48
+ return this.#track(this.#list(params));
49
+ }
50
+ dispose() {
51
+ this.#closing = true;
52
+ this.#connectAbortController?.abort();
53
+ this.#disposeTask ??= this.#dispose();
54
+ return this.#disposeTask;
55
+ }
56
+ async #create(params) {
57
+ const connection = await this.#getConnection('session.create');
58
+ const sessionId = this.#newSessionId();
59
+ try {
60
+ await connection.request('session.create', {
61
+ sessionId,
62
+ workspace: { kind: 'host_path', path: params.cwd },
63
+ modelTarget: { kind: 'default' },
64
+ });
65
+ }
66
+ catch (error) {
67
+ throw requestErrorFromRuntimeHost(error, 'session.create', { sessionId });
68
+ }
69
+ return { sessionId };
70
+ }
71
+ async #list(params) {
72
+ const cursor = params.cursor == null ? undefined : decodeAcpSessionCursor(params.cursor);
73
+ const requestedCwd = params.cwd == null ? undefined : await normalizeCwd(params.cwd);
74
+ if (cursor && requestedCwd !== undefined && cursor.cwd !== requestedCwd) {
75
+ throw RequestError.invalidParams({ reason: 'cursor_cwd_mismatch' }, 'cursor was created for a different cwd filter');
76
+ }
77
+ const cwd = requestedCwd ?? cursor?.cwd ?? null;
78
+ const connection = await this.#getConnection('session.catalog.query');
79
+ let page;
80
+ try {
81
+ page = await readRuntimeHostSessionCatalogPage(connection, cursor ? { revision: cursor.revision, cursor: cursor.cursor } : undefined);
82
+ }
83
+ catch (error) {
84
+ if (error instanceof RuntimeHostSessionCatalogRevisionChangedError) {
85
+ throw RequestError.invalidParams({ reason: 'stale_cursor' }, 'session catalog changed; restart listing from the first page');
86
+ }
87
+ throw requestErrorFromRuntimeHost(error, 'session.catalog.query');
88
+ }
89
+ const sessions = page.sessions.flatMap((session) => {
90
+ if ('kind' in session || (cwd !== null && session.workspace.hostCwd !== cwd))
91
+ return [];
92
+ const updatedAt = isoTimestamp(session.activityAt);
93
+ return [
94
+ {
95
+ sessionId: session.id,
96
+ cwd: session.workspace.hostCwd,
97
+ title: session.name,
98
+ ...(updatedAt ? { updatedAt } : {}),
99
+ },
100
+ ];
101
+ });
102
+ return {
103
+ sessions,
104
+ ...(page.nextCursor
105
+ ? { nextCursor: encodeAcpSessionCursor({ ...page.nextCursor, cwd }) }
106
+ : {}),
107
+ };
108
+ }
109
+ async #dispose() {
110
+ const connectionClose = this.#closeOwnedConnection();
111
+ await Promise.allSettled([connectionClose]);
112
+ await Promise.allSettled([...this.#inFlightOperations]);
113
+ }
114
+ #closeOwnedConnection() {
115
+ const connection = this.#connection;
116
+ const connectTask = this.#connectTask;
117
+ if (!connection && !connectTask)
118
+ return Promise.resolve();
119
+ this.#connectionCloseTask ??= connection
120
+ ? Promise.resolve().then(() => connection.close())
121
+ : connectTask.then((connected) => connected.close(), () => undefined);
122
+ return this.#connectionCloseTask;
123
+ }
124
+ async #getConnection(operation) {
125
+ this.#assertOpen(operation);
126
+ if (this.#connection)
127
+ return this.#connection;
128
+ let connectController = this.#connectAbortController;
129
+ if (!this.#connectTask) {
130
+ connectController = new AbortController();
131
+ this.#connectAbortController = connectController;
132
+ this.#connectTask = Promise.resolve().then(() => {
133
+ if (this.#closing)
134
+ throw registryClosedError('connect');
135
+ connectController.signal.throwIfAborted();
136
+ return this.#connect(connectController.signal);
137
+ });
138
+ }
139
+ const connectTask = this.#connectTask;
140
+ let connection;
141
+ try {
142
+ connection = await connectTask;
143
+ }
144
+ catch {
145
+ if (this.#connectTask === connectTask)
146
+ this.#connectTask = undefined;
147
+ if (this.#connectAbortController === connectController) {
148
+ this.#connectAbortController = undefined;
149
+ }
150
+ if (this.#closing)
151
+ throw registryClosedError('connect');
152
+ throw RequestError.internalError({
153
+ source: 'runtime_host',
154
+ operation: 'connect',
155
+ code: 'connection_failed',
156
+ }, 'Runtime Host connection failed');
157
+ }
158
+ if (this.#connectAbortController === connectController) {
159
+ this.#connectAbortController = undefined;
160
+ }
161
+ if (this.#closing) {
162
+ await this.#closeOwnedConnection().catch(() => undefined);
163
+ throw registryClosedError('connect');
164
+ }
165
+ this.#connection ??= connection;
166
+ return this.#connection;
167
+ }
168
+ async #track(operation) {
169
+ this.#inFlightOperations.add(operation);
170
+ try {
171
+ return await operation;
172
+ }
173
+ finally {
174
+ this.#inFlightOperations.delete(operation);
175
+ }
176
+ }
177
+ #assertOpen(operation) {
178
+ if (!this.#closing)
179
+ return;
180
+ throw registryClosedError(operation);
181
+ }
182
+ }
183
+ function registryClosedError(operation) {
184
+ return RequestError.internalError({ source: 'runtime_host', operation, code: 'registry_closed' }, 'ACP session registry is closed');
185
+ }
186
+ function validateNewSessionParams(params) {
187
+ assertBoundedAbsoluteCwd(params.cwd);
188
+ if (params.mcpServers.length > 0) {
189
+ throw RequestError.invalidParams({ field: 'mcpServers', reason: 'unsupported' }, 'MCP servers are not supported by this ACP adapter yet');
190
+ }
191
+ if ((params.additionalDirectories?.length ?? 0) > 0) {
192
+ throw RequestError.invalidParams({ field: 'additionalDirectories', reason: 'unsupported' }, 'Additional directories are not supported by this ACP adapter yet');
193
+ }
194
+ }
195
+ function requestErrorFromRuntimeHost(error, operation, extra = {}) {
196
+ const data = { ...runtimeHostErrorData(error, operation), ...extra };
197
+ if (error instanceof RuntimeHostOperationError && error.code === 'invalid_request') {
198
+ return RequestError.invalidParams(data, 'Runtime Host rejected the request');
199
+ }
200
+ return RequestError.internalError(data, 'Runtime Host request failed');
201
+ }
202
+ function runtimeHostErrorData(error, operation) {
203
+ if (error instanceof RuntimeHostOperationError) {
204
+ return {
205
+ source: 'runtime_host',
206
+ operation: error.operation,
207
+ code: error.code,
208
+ };
209
+ }
210
+ if (error instanceof RuntimeHostRequestInterruptedError) {
211
+ return {
212
+ source: 'runtime_host',
213
+ operation: error.operation,
214
+ code: 'request_interrupted',
215
+ reason: error.reason,
216
+ dispatch: error.dispatch,
217
+ };
218
+ }
219
+ if (error instanceof RuntimeHostCatalogReadError) {
220
+ return {
221
+ source: 'runtime_host',
222
+ operation,
223
+ code: 'catalog_read_failure',
224
+ reason: error.reason,
225
+ };
226
+ }
227
+ return { source: 'runtime_host', operation, code: 'internal_failure' };
228
+ }
229
+ function encodeAcpSessionCursor(cursor) {
230
+ const encoded = Buffer.from(JSON.stringify(cursor), 'utf8').toString('base64url');
231
+ if (Buffer.byteLength(encoded, 'utf8') > ACP_SESSION_CURSOR_MAX_BYTES) {
232
+ throw RequestError.internalError({
233
+ source: 'runtime_host',
234
+ operation: 'session.catalog.query',
235
+ code: 'cursor_too_large',
236
+ }, 'Runtime Host cursor cannot be represented safely in ACP');
237
+ }
238
+ return encoded;
239
+ }
240
+ function decodeAcpSessionCursor(encoded) {
241
+ try {
242
+ if (encoded.length === 0 || Buffer.byteLength(encoded, 'utf8') > ACP_SESSION_CURSOR_MAX_BYTES) {
243
+ throw new Error('cursor size is invalid');
244
+ }
245
+ const decoded = Buffer.from(encoded, 'base64url');
246
+ if (decoded.toString('base64url') !== encoded)
247
+ throw new Error('cursor encoding is invalid');
248
+ const value = JSON.parse(decoded.toString('utf8'));
249
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
250
+ throw new Error('cursor body is invalid');
251
+ }
252
+ const record = value;
253
+ if (Object.keys(record).length !== 3 ||
254
+ typeof record.revision !== 'string' ||
255
+ !/^sha256:[0-9a-f]{64}$/.test(record.revision) ||
256
+ typeof record.cursor !== 'string' ||
257
+ record.cursor.length === 0 ||
258
+ Buffer.byteLength(record.cursor, 'utf8') > SESSION_CATALOG_CURSOR_MAX_BYTES ||
259
+ !validCursorCwd(record.cwd)) {
260
+ throw new Error('cursor fields are invalid');
261
+ }
262
+ return {
263
+ revision: record.revision,
264
+ cursor: record.cursor,
265
+ cwd: record.cwd,
266
+ };
267
+ }
268
+ catch {
269
+ throw RequestError.invalidParams({ reason: 'invalid_cursor' }, 'cursor is invalid');
270
+ }
271
+ }
272
+ function validCursorCwd(value) {
273
+ return (value === null ||
274
+ (typeof value === 'string' &&
275
+ isAbsolute(value) &&
276
+ normalize(value) === value &&
277
+ Buffer.byteLength(value, 'utf8') <= SESSION_CATALOG_CWD_MAX_BYTES));
278
+ }
279
+ async function normalizeCwd(cwd) {
280
+ assertBoundedAbsoluteCwd(cwd);
281
+ const lexical = normalize(cwd);
282
+ try {
283
+ return await realpath(lexical);
284
+ }
285
+ catch (error) {
286
+ const code = error.code;
287
+ if (code === 'ENOENT' || code === 'ENOTDIR')
288
+ return lexical;
289
+ throw RequestError.internalError({
290
+ source: 'filesystem',
291
+ operation: 'cwd.realpath',
292
+ code: code ?? 'internal_failure',
293
+ }, 'cwd could not be canonicalized');
294
+ }
295
+ }
296
+ function assertBoundedAbsoluteCwd(cwd) {
297
+ if (!isAbsolute(cwd)) {
298
+ throw RequestError.invalidParams({ field: 'cwd', reason: 'must_be_absolute' }, 'cwd must be an absolute path');
299
+ }
300
+ if (Buffer.byteLength(cwd, 'utf8') > SESSION_CATALOG_CWD_MAX_BYTES) {
301
+ throw RequestError.invalidParams({ field: 'cwd', reason: 'too_large' }, 'cwd exceeds the Runtime Host path limit');
302
+ }
303
+ }
304
+ function isoTimestamp(timestamp) {
305
+ const date = new Date(timestamp);
306
+ return Number.isNaN(date.getTime()) ? undefined : date.toISOString();
307
+ }
@@ -19,7 +19,22 @@
19
19
  import { Readable, Writable } from 'node:stream';
20
20
  import { ndJsonStream } from '@agentclientprotocol/sdk';
21
21
  import { createMakaAcpAgent } from './maka-acp-agent.js';
22
+ import { AcpSessionRegistry } from './session-registry.js';
23
+ import { connectRuntimeHostCliConnection } from '../runtime-host-cli-context.js';
22
24
  export async function runMakaAcpStdioServer(input, dependencies = {}) {
25
+ const sessionRegistry = new AcpSessionRegistry({
26
+ connect: async (signal) => {
27
+ const context = await (dependencies.connectRuntimeHostCliConnection ?? connectRuntimeHostCliConnection)({
28
+ rootPath: input.workspaceRoot,
29
+ clientDataRoot: input.clientDataRoot,
30
+ signal,
31
+ });
32
+ return {
33
+ request: context.connection.request.bind(context.connection),
34
+ close: () => context.close(),
35
+ };
36
+ },
37
+ });
23
38
  const stdin = dependencies.stdin ?? process.stdin;
24
39
  const stdout = dependencies.stdout ?? process.stdout;
25
40
  let stdioError;
@@ -30,7 +45,10 @@ export async function runMakaAcpStdioServer(input, dependencies = {}) {
30
45
  stdout.once('error', recordStdioError);
31
46
  try {
32
47
  const stream = ndJsonStream(Writable.toWeb(stdout), Readable.toWeb(stdin));
33
- const connection = createMakaAcpAgent({ version: input.version }).connect(stream);
48
+ const connection = createMakaAcpAgent({
49
+ version: input.version,
50
+ sessionRegistry,
51
+ }).connect(stream);
34
52
  await connection.closed;
35
53
  if (stdioError) {
36
54
  throw stdioError;
@@ -40,5 +58,6 @@ export async function runMakaAcpStdioServer(input, dependencies = {}) {
40
58
  finally {
41
59
  stdin.off('error', recordStdioError);
42
60
  stdout.off('error', recordStdioError);
61
+ await sessionRegistry.dispose();
43
62
  }
44
63
  }
package/dist/cli-core.js CHANGED
@@ -94,7 +94,7 @@ function helpText(cliCommand) {
94
94
  '',
95
95
  'Commands:',
96
96
  ` ${cliCommand} Start the TUI`,
97
- ` ${cliCommand} --acp Serve ACP v1 over stdio (initialize only; session support in progress)`,
97
+ ` ${cliCommand} --acp Serve ACP v1 over stdio (initialize, session/new, session/list)`,
98
98
  ` ${cliCommand} run ... Run one non-interactive model turn`,
99
99
  ` ${cliCommand} activate ... Run one Cloud Session activation and emit JSONL`,
100
100
  ` ${cliCommand} -p ... Alias for ${cliCommand} run`,
@@ -116,11 +116,17 @@ function helpText(cliCommand) {
116
116
  ` ${cliCommand} runtime-host service reconcile-update [--json]`,
117
117
  ` ${cliCommand} runtime-host access issue --principal <id> --grant <operation>`,
118
118
  ` ${cliCommand} runtime-host access issue --principal <id> --preset <desktop-client|terminal-client>`,
119
+ ` ${cliCommand} runtime-host access connection-code [--name <name>] [--root <path>]`,
119
120
  ` ${cliCommand} runtime-host access list`,
120
121
  ` ${cliCommand} runtime-host access issue --kind capability-provider --principal <id>`,
121
122
  ` ${cliCommand} runtime-host access revoke --credential <id>`,
122
123
  ` ${cliCommand} runtime-host project list [--root <path>]`,
123
124
  ` ${cliCommand} runtime-host project add <path> [--prefer] [--root <path>]`,
125
+ ` ${cliCommand} runtime-host plugin status|list|inspect|failures [--root <path>]`,
126
+ ` ${cliCommand} runtime-host plugin install|uninstall|reload <target> [--root <path>]`,
127
+ ` ${cliCommand} runtime-host plugin export <extension-id> <bundle-path> [--root <path>]`,
128
+ ` ${cliCommand} runtime-host plugin apply <operations.json> [--root <path>]`,
129
+ ` ${cliCommand} runtime-host plugin reconcile [--root <path>]`,
124
130
  ` ${cliCommand} runtime-host profile list`,
125
131
  ` ${cliCommand} runtime-host profile set --id <id> --name <name> --tls-url <wss-url> --expected-root <root-id> [--credential-env <name>]`,
126
132
  ` ${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 +186,9 @@ function helpText(cliCommand) {
180
186
  ' --clear-coordination-relays Remove every manually configured relay',
181
187
  ' --automatic-relay-discovery Enable best-effort public relay discovery',
182
188
  ' --no-automatic-relay-discovery Disable public discovery and retain manual relays',
189
+ ' --default-public-stun Use the packaged best-effort public STUN policy',
190
+ ' --no-public-stun Disable public STUN and keep host candidates only',
191
+ ' --webrtc-stun <stun-url> Use a custom STUN endpoint (repeatable)',
183
192
  '',
184
193
  'Runtime Host access issue options:',
185
194
  ' --root <path> Select the canonical data root',
@@ -243,12 +252,16 @@ export async function runMakaCli(argv = process.argv.slice(2), options = RELEASE
243
252
  }
244
253
  case 'acp': {
245
254
  const { runMakaAcpStdioServer } = await import('./acp/stdio-server.js');
246
- return runMakaAcpStdioServer({ version });
255
+ return runMakaAcpStdioServer({
256
+ workspaceRoot: dataRoots.workspaceRoot,
257
+ clientDataRoot: dataRoots.clientDataRoot,
258
+ version,
259
+ });
247
260
  }
248
261
  case 'runtime-host-serve': {
249
262
  const { runRuntimeHostServiceCli } = await import('./runtime-host-service-command.js');
250
263
  if (command.managedDeployment) {
251
- const { resolveRuntimeHostManagedDeployment, resolveRuntimeHostNpmDeploymentLayout } = await import('@maka/runtime-host/operator');
264
+ const { resolveRuntimeHostManagedDeployment, resolveRuntimeHostNpmDeploymentLayout, resolveRuntimeHostWebRtcStunUrls, } = await import('@maka/runtime-host/operator');
252
265
  const { config } = await resolveRuntimeHostManagedDeployment(command.managedDeployment.rootId);
253
266
  const peer = config.listeners.directPeer?.enabled ? config.listeners.directPeer : undefined;
254
267
  const packageLayout = resolveRuntimeHostNpmDeploymentLayout(config.deploymentRoot, config.launch.package.integrity);
@@ -270,6 +283,7 @@ export async function runMakaCli(argv = process.argv.slice(2), options = RELEASE
270
283
  listenAddresses: peer.listenAddresses,
271
284
  coordinationRelays: peer.coordinationRelays,
272
285
  automaticRelayDiscovery: peer.automaticRelayDiscovery,
286
+ webRtcStunUrls: resolveRuntimeHostWebRtcStunUrls(peer.webRtcStunPolicy),
273
287
  meshDataRoot: join(config.deploymentRoot, 'peer-mesh'),
274
288
  },
275
289
  }
@@ -430,6 +444,8 @@ export async function runMakaCli(argv = process.argv.slice(2), options = RELEASE
430
444
  ? {}
431
445
  : { automaticRelayDiscovery: command.automaticRelayDiscovery }),
432
446
  ...(command.relayDiscoveryStatus ? { relayDiscoveryStatus: true } : {}),
447
+ ...(command.webRtcStunPolicy ? { webRtcStunPolicy: command.webRtcStunPolicy } : {}),
448
+ ...(command.webRtcStunStatus ? { webRtcStunStatus: true } : {}),
433
449
  ...(command.expectedTarget ? { expectedTarget: command.expectedTarget } : {}),
434
450
  ...(command.allowInterruptActiveTasks ? { allowInterruptActiveTasks: true } : {}),
435
451
  });
@@ -469,6 +485,7 @@ export async function runMakaCli(argv = process.argv.slice(2), options = RELEASE
469
485
  ...(command.operatorDeploymentId
470
486
  ? { operatorDeploymentId: command.operatorDeploymentId }
471
487
  : {}),
488
+ ...(command.allowManualUpdate ? { allowManualUpdate: true } : {}),
472
489
  ...(command.allowInterruptActiveTasks ? { allowInterruptActiveTasks: true } : {}),
473
490
  });
474
491
  }
@@ -579,6 +596,14 @@ export async function runMakaCli(argv = process.argv.slice(2), options = RELEASE
579
596
  currentCredentialFingerprint: command.currentCredentialFingerprint,
580
597
  });
581
598
  }
599
+ case 'runtime-host-access-connection-code': {
600
+ const { runRuntimeHostAccessConnectionCodeCli } = await import('./runtime-host-access-command.js');
601
+ return runRuntimeHostAccessConnectionCodeCli({
602
+ rootPath: command.rootPath ?? dataRoots.workspaceRoot,
603
+ ...(command.expectedRootId ? { expectedRootId: command.expectedRootId } : {}),
604
+ ...(command.name ? { name: command.name } : {}),
605
+ }, command.framed);
606
+ }
582
607
  case 'runtime-host-access-list': {
583
608
  const { runRuntimeHostAccessListCli } = await import('./runtime-host-access-command.js');
584
609
  return runRuntimeHostAccessListCli({
@@ -612,6 +637,18 @@ export async function runMakaCli(argv = process.argv.slice(2), options = RELEASE
612
637
  prefer: command.prefer,
613
638
  });
614
639
  }
640
+ case 'runtime-host-plugin': {
641
+ const { runRuntimeHostPluginCli } = await import('./runtime-host-plugin-command.js');
642
+ return runRuntimeHostPluginCli({
643
+ rootPath: command.rootPath ?? dataRoots.workspaceRoot,
644
+ action: command.action,
645
+ ...(command.subject ? { subject: command.subject } : {}),
646
+ ...(command.targetPath ? { targetPath: command.targetPath } : {}),
647
+ ...(command.rootId ? { rootId: command.rootId } : {}),
648
+ ...(command.cursor === undefined ? {} : { cursor: command.cursor }),
649
+ ...(command.limit === undefined ? {} : { limit: command.limit }),
650
+ });
651
+ }
615
652
  case 'runtime-host-capability-provider-serve': {
616
653
  const { runRuntimeHostCapabilityProviderCli } = await import('./runtime-host-capability-provider-command.js');
617
654
  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, locale) {
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) {
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
  /**