maka-agent 0.2.0-dev.10.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 (237) hide show
  1. package/LICENSE +49 -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 +115 -122
  10. package/dist/pi-tui-pickers.js +11 -5
  11. package/dist/pi-tui-runner.js +133 -102
  12. package/dist/runtime-host-cli-context.js +4 -0
  13. package/dist/runtime-host-cli.js +150 -4
  14. package/dist/runtime-host-lifecycle-transaction.js +5 -2
  15. package/dist/runtime-host-managed-lifecycle-manager.js +1 -0
  16. package/dist/runtime-host-onboarding.js +12 -16
  17. package/dist/runtime-host-peer-management-command.js +16 -4
  18. package/dist/runtime-host-plugin-command.js +101 -0
  19. package/dist/runtime-host-run-command.js +5 -1
  20. package/dist/runtime-host-service-management-command.js +2 -1
  21. package/dist/runtime-host-setup-command.js +1 -0
  22. package/dist/runtime-host-task-readiness.js +2 -3
  23. package/dist/runtime-host-tui-command.js +1 -1
  24. package/dist/runtime-host-tui-context.js +34 -6
  25. package/dist/runtime-host-update-command.js +13 -5
  26. package/dist/runtime-host-update-discovery.js +1 -0
  27. package/dist/tui-clipboard.js +86 -0
  28. package/dist/tui-copy-catalog.js +256 -0
  29. package/dist/tui-copy-command.js +103 -0
  30. package/dist/tui-mcp-control.js +46 -4
  31. package/dist/tui-mcp-remote-publication.js +395 -0
  32. package/native/runtime-host-peer/prebuilds/darwin-arm64/maka_runtime_host_peer.node +0 -0
  33. package/native/runtime-host-peer/prebuilds/linux-arm64/maka_runtime_host_peer.node +0 -0
  34. package/native/runtime-host-peer/prebuilds/linux-x64/maka_runtime_host_peer.node +0 -0
  35. package/native/runtime-host-peer/prebuilds/win32-x64/maka_runtime_host_peer.node +0 -0
  36. package/node_modules/@maka/core/dist/agent-run.js +5 -0
  37. package/node_modules/@maka/core/dist/attachments.js +80 -1
  38. package/node_modules/@maka/core/dist/bounded-response.js +71 -0
  39. package/node_modules/@maka/core/dist/chat-model-choice.js +8 -31
  40. package/node_modules/@maka/core/dist/client-capability-grant.js +149 -0
  41. package/node_modules/@maka/core/dist/connection-readiness.js +3 -31
  42. package/node_modules/@maka/core/dist/deep-research.js +1 -20
  43. package/node_modules/@maka/core/dist/events.js +22 -1
  44. package/node_modules/@maka/core/dist/execution-inspect.js +3 -1
  45. package/node_modules/@maka/core/dist/foreign-session.js +2 -2
  46. package/node_modules/@maka/core/dist/interaction.js +49 -2
  47. package/node_modules/@maka/core/dist/llm-connections.js +74 -82
  48. package/node_modules/@maka/core/dist/model-call-attempt.js +66 -0
  49. package/node_modules/@maka/core/dist/model-catalog.js +238 -313
  50. package/node_modules/@maka/core/dist/model-facts.js +280 -0
  51. package/node_modules/@maka/core/dist/model-metadata.generated.js +1907 -1872
  52. package/node_modules/@maka/core/dist/model-metadata.js +184 -199
  53. package/node_modules/@maka/core/dist/model-projection-transition.js +145 -0
  54. package/node_modules/@maka/core/dist/model-thinking.js +1 -1
  55. package/node_modules/@maka/core/dist/models-dev-projection.js +302 -0
  56. package/node_modules/@maka/core/dist/models-dev-refresh.js +55 -0
  57. package/node_modules/@maka/core/dist/onboarding.js +2 -1
  58. package/node_modules/@maka/core/dist/provider-auth.js +47 -291
  59. package/node_modules/@maka/core/dist/provider-registry.js +68 -357
  60. package/node_modules/@maka/core/dist/runtime-boundary.js +2 -2
  61. package/node_modules/@maka/core/dist/runtime-event.js +5 -1
  62. package/node_modules/@maka/core/dist/runtime-policy/connection-catalog-codec.js +82 -5
  63. package/node_modules/@maka/core/dist/runtime-policy/model-catalog-entry-codec.js +75 -0
  64. package/node_modules/@maka/core/dist/runtime-policy.js +2 -1
  65. package/node_modules/@maka/core/dist/session-send-projection.js +2 -1
  66. package/node_modules/@maka/core/dist/session-start-mode.js +42 -0
  67. package/node_modules/@maka/core/dist/session-todo.js +101 -0
  68. package/node_modules/@maka/core/dist/session.js +119 -5
  69. package/node_modules/@maka/core/dist/slash-command-catalog.js +1 -0
  70. package/node_modules/@maka/core/dist/task-submission-readiness.js +2 -1
  71. package/node_modules/@maka/core/dist/tool-activity-args.js +4 -0
  72. package/node_modules/@maka/core/dist/tool-quiet-preview.js +5 -5
  73. package/node_modules/@maka/core/dist/tool-result-record-schema.js +2 -1
  74. package/node_modules/@maka/core/dist/workhub-creation-intent.js +896 -0
  75. package/node_modules/@maka/core/package.json +9 -1
  76. package/node_modules/@maka/runtime/dist/active-tool-result-prune.js +45 -131
  77. package/node_modules/@maka/runtime/dist/agent-run.js +58 -44
  78. package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +146 -201
  79. package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +235 -69
  80. package/node_modules/@maka/runtime/dist/context-budget-helpers.js +4 -41
  81. package/node_modules/@maka/runtime/dist/context-budget-policy.js +8 -1
  82. package/node_modules/@maka/runtime/dist/context-budget.js +9 -81
  83. package/node_modules/@maka/runtime/dist/context-diagnostics.js +63 -27
  84. package/node_modules/@maka/runtime/dist/continuation-replay.js +19 -11
  85. package/node_modules/@maka/runtime/dist/conversation-copy.js +179 -16
  86. package/node_modules/@maka/runtime/dist/deep-research-tools.js +2 -3
  87. package/node_modules/@maka/runtime/dist/durable-tool-result-projection.js +21 -0
  88. package/node_modules/@maka/runtime/dist/execution-inspect.js +13 -3
  89. package/node_modules/@maka/runtime/dist/history-compact-checkpoint.js +58 -7
  90. package/node_modules/@maka/runtime/dist/history-compact-ledger.js +9 -1
  91. package/node_modules/@maka/runtime/dist/history-compact-summarizer.js +2 -2
  92. package/node_modules/@maka/runtime/dist/history-compact-summary-validation.js +2 -1
  93. package/node_modules/@maka/runtime/dist/history-compaction.js +2 -1
  94. package/node_modules/@maka/runtime/dist/image-file.js +5 -20
  95. package/node_modules/@maka/runtime/dist/latest-context-snapshot.js +114 -20
  96. package/node_modules/@maka/runtime/dist/local-web-fetch.js +2 -43
  97. package/node_modules/@maka/runtime/dist/mcp-tools.js +28 -0
  98. package/node_modules/@maka/runtime/dist/model-adapter.js +47 -15
  99. package/node_modules/@maka/runtime/dist/model-factory.js +7 -1
  100. package/node_modules/@maka/runtime/dist/model-fetcher.js +15 -8
  101. package/node_modules/@maka/runtime/dist/model-history.js +125 -3
  102. package/node_modules/@maka/runtime/dist/model-projection-transition-ledger.js +207 -0
  103. package/node_modules/@maka/runtime/dist/model-runtime.js +7 -4
  104. package/node_modules/@maka/runtime/dist/openai-codex-history-compactor.js +12 -14
  105. package/node_modules/@maka/runtime/dist/plugin-composition-loader.js +173 -20
  106. package/node_modules/@maka/runtime/dist/plugin-runtime.js +219 -0
  107. package/node_modules/@maka/runtime/dist/prompt-composition.js +33 -21
  108. package/node_modules/@maka/runtime/dist/provider-request-telemetry.js +35 -74
  109. package/node_modules/@maka/runtime/dist/quiescent-session-snapshot.js +78 -0
  110. package/node_modules/@maka/runtime/dist/request-shape.js +256 -343
  111. package/node_modules/@maka/runtime/dist/run-trace.js +2 -24
  112. package/node_modules/@maka/runtime/dist/runtime-continuation-admission.js +1 -1
  113. package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +3 -0
  114. package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +1 -0
  115. package/node_modules/@maka/runtime/dist/runtime-kernel.js +77 -23
  116. package/node_modules/@maka/runtime/dist/runtime-resume.js +20 -11
  117. package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +8 -4
  118. package/node_modules/@maka/runtime/dist/session-manager.js +45 -9
  119. package/node_modules/@maka/runtime/dist/session-recap.js +2 -1
  120. package/node_modules/@maka/runtime/dist/session-todo-tools.js +67 -0
  121. package/node_modules/@maka/runtime/dist/subagent-tools.js +2 -77
  122. package/node_modules/@maka/runtime/dist/system-prompt/main-session-prompt.js +1 -1
  123. package/node_modules/@maka/runtime/dist/telemetry/model-pricing.generated.js +93 -83
  124. package/node_modules/@maka/runtime/dist/test-connection.js +6 -6
  125. package/node_modules/@maka/runtime/dist/tool-result-archive-transition.js +227 -0
  126. package/node_modules/@maka/runtime/dist/tool-result-archive.js +40 -168
  127. package/node_modules/@maka/runtime/dist/tool-runtime.js +50 -6
  128. package/node_modules/@maka/runtime/dist/workers/filesystem-worker.js +39 -16
  129. package/node_modules/@maka/runtime/package.json +2 -1
  130. package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +10 -0
  131. package/node_modules/@maka/runtime-host/dist/client/catalog-reader.js +19 -5
  132. package/node_modules/@maka/runtime-host/dist/client/client-capability-channel.js +3 -2
  133. package/node_modules/@maka/runtime-host/dist/client/connection.js +22 -0
  134. package/node_modules/@maka/runtime-host/dist/client/host-profile.js +222 -19
  135. package/node_modules/@maka/runtime-host/dist/client/index.js +2 -1
  136. package/node_modules/@maka/runtime-host/dist/client/oauth-presentation.js +1 -1
  137. package/node_modules/@maka/runtime-host/dist/client/peer-client.js +4 -0
  138. package/node_modules/@maka/runtime-host/dist/client/reconnecting-connection.js +8 -0
  139. package/node_modules/@maka/runtime-host/dist/operator/index.js +2 -1
  140. package/node_modules/@maka/runtime-host/dist/operator/managed-deployment.js +2 -0
  141. package/node_modules/@maka/runtime-host/dist/operator/peer-management-frame.js +2 -0
  142. package/node_modules/@maka/runtime-host/dist/operator/service-management-frame.js +2 -0
  143. package/node_modules/@maka/runtime-host/dist/peer-mesh/owner.js +1 -0
  144. package/node_modules/@maka/runtime-host/dist/protocol/client-capability.js +22 -1
  145. package/node_modules/@maka/{storage/dist/task-ledger-store-internal.js → runtime-host/dist/protocol/connection-catalog-change.js} +7 -13
  146. package/node_modules/@maka/runtime-host/dist/protocol/index.js +43 -2
  147. package/node_modules/@maka/runtime-host/dist/protocol/operations.js +7 -3
  148. package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +512 -0
  149. package/node_modules/@maka/runtime-host/dist/protocol/runtime-policy.js +24 -12
  150. package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +1 -1
  151. package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +1 -1
  152. package/node_modules/@maka/runtime-host/dist/protocol/session-retirement.js +30 -3
  153. package/node_modules/@maka/runtime-host/dist/protocol/session-todo.js +53 -0
  154. package/node_modules/@maka/runtime-host/dist/protocol/turn.js +4 -1
  155. package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +92 -4
  156. package/node_modules/@maka/runtime-host/dist/server/access-authority.js +15 -13
  157. package/node_modules/@maka/runtime-host/dist/server/access-credential-metadata.js +4 -2
  158. package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +119 -47
  159. package/node_modules/@maka/runtime-host/dist/server/bootstrap-runtime-policy.js +10 -4
  160. package/node_modules/@maka/runtime-host/dist/server/child-agent-composition.js +1 -1
  161. package/node_modules/@maka/runtime-host/dist/server/client-capability-coordinator.js +192 -18
  162. package/node_modules/@maka/runtime-host/dist/server/client-capability-invocation-broker.js +122 -48
  163. package/node_modules/@maka/runtime-host/dist/server/client-capability-provider-id.js +31 -0
  164. package/node_modules/@maka/runtime-host/dist/server/connection-effect-coordinator.js +6 -5
  165. package/node_modules/@maka/runtime-host/dist/server/connection-session.js +1 -0
  166. package/node_modules/@maka/runtime-host/dist/server/deep-research-coordinator.js +1 -1
  167. package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +163 -66
  168. package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +27 -9
  169. package/node_modules/@maka/runtime-host/dist/server/execution-model-composition.js +38 -43
  170. package/node_modules/@maka/runtime-host/dist/server/extension-bundle.js +249 -0
  171. package/node_modules/@maka/runtime-host/dist/server/extension-package-manifest.js +262 -0
  172. package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +0 -23
  173. package/node_modules/@maka/runtime-host/dist/server/host-change-feed.js +11 -0
  174. package/node_modules/@maka/runtime-host/dist/server/index.js +5 -0
  175. package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +181 -13
  176. package/node_modules/@maka/runtime-host/dist/server/interaction-projection.js +6 -0
  177. package/node_modules/@maka/runtime-host/dist/server/interactive-run-composer.js +7 -9
  178. package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +88 -22
  179. package/node_modules/@maka/runtime-host/dist/server/model-metadata-refresh.js +96 -0
  180. package/node_modules/@maka/runtime-host/dist/server/operation-dispatcher.js +43 -118
  181. package/node_modules/@maka/runtime-host/dist/server/plugin-composition-patch.js +58 -0
  182. package/node_modules/@maka/runtime-host/dist/server/plugin-composition-store.js +141 -0
  183. package/node_modules/@maka/runtime-host/dist/server/plugin-package-loader.js +130 -0
  184. package/node_modules/@maka/runtime-host/dist/server/plugin-package-store.js +528 -0
  185. package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +249 -0
  186. package/node_modules/@maka/runtime-host/dist/server/plugin-platform.js +1130 -0
  187. package/node_modules/@maka/runtime-host/dist/server/root-admission-owner.js +4 -0
  188. package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +24 -5
  189. package/node_modules/@maka/runtime-host/dist/server/runtime-policy-coordinator.js +31 -2
  190. package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +2 -1
  191. package/node_modules/@maka/runtime-host/dist/server/session-retirement-coordinator.js +58 -9
  192. package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +30 -13
  193. package/node_modules/@maka/runtime-host/dist/server/session-sidecar-purge.js +1 -1
  194. package/node_modules/@maka/runtime-host/dist/server/session-todo-coordinator.js +77 -0
  195. package/node_modules/@maka/runtime-host/dist/server/session-transcript-pager.js +10 -2
  196. package/node_modules/@maka/runtime-host/dist/server/web-fetch-tool.js +1 -1
  197. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +276 -3
  198. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +101 -1
  199. package/node_modules/@maka/runtime-host/dist/transport/peer-native.js +1 -0
  200. package/node_modules/@maka/runtime-host/dist/webrtc-stun-policy.js +114 -0
  201. package/node_modules/@maka/runtime-host/package.json +2 -0
  202. package/node_modules/@maka/storage/dist/agent-run-store.js +80 -15
  203. package/node_modules/@maka/storage/dist/artifact-attachments.js +29 -6
  204. package/node_modules/@maka/storage/dist/artifact-store.js +7 -23
  205. package/node_modules/@maka/storage/dist/artifact-stores.js +13 -2
  206. package/node_modules/@maka/storage/dist/conversation-operational-state.js +3 -0
  207. package/node_modules/@maka/storage/dist/credential-store.js +3 -0
  208. package/node_modules/@maka/storage/dist/execution-stores.js +4 -0
  209. package/node_modules/@maka/storage/dist/file-lifetime-owner.js +30 -2
  210. package/node_modules/@maka/storage/dist/interaction-store-public.js +1 -1
  211. package/node_modules/@maka/storage/dist/interaction-store.js +173 -0
  212. package/node_modules/@maka/storage/dist/model-facts-store.js +79 -0
  213. package/node_modules/@maka/storage/dist/production-session-snapshot.js +761 -0
  214. package/node_modules/@maka/storage/dist/quiescent-session-snapshot.js +1 -1
  215. package/node_modules/@maka/storage/dist/runtime-policy/connection-catalog-document.js +26 -26
  216. package/node_modules/@maka/storage/dist/runtime-policy/coordinator.js +114 -56
  217. package/node_modules/@maka/storage/dist/runtime-policy/document-io.js +22 -16
  218. package/node_modules/@maka/storage/dist/runtime-policy/onboarding-transaction.js +2 -2
  219. package/node_modules/@maka/storage/dist/runtime-policy-stores.js +1 -1
  220. package/node_modules/@maka/storage/dist/session-message-projection.js +1 -1
  221. package/node_modules/@maka/storage/dist/session-store.js +32 -6
  222. package/node_modules/@maka/storage/dist/{task-ledger-authority.js → session-todo-authority.js} +13 -28
  223. package/node_modules/@maka/storage/dist/session-todo-store.js +169 -0
  224. package/node_modules/@maka/storage/dist/sqlite-core-execution-schema.js +19 -0
  225. package/node_modules/@maka/storage/dist/sqlite-runtime-schema.js +42 -1
  226. package/node_modules/@maka/storage/dist/sqlite-session-metadata-schema.js +10 -1
  227. package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +73 -3
  228. package/node_modules/@maka/storage/dist/sqlite-workflow-schema.js +5 -8
  229. package/node_modules/@maka/storage/dist/storage-writer-composition.js +3 -3
  230. package/node_modules/@maka/storage/package.json +3 -1
  231. package/package.json +1 -1
  232. package/node_modules/@maka/core/dist/task-ledger.js +0 -669
  233. package/node_modules/@maka/runtime/dist/task-ledger-tools.js +0 -244
  234. package/node_modules/@maka/runtime/dist/test-helpers.js +0 -61
  235. package/node_modules/@maka/runtime-host/dist/protocol/task-ledger.js +0 -321
  236. package/node_modules/@maka/runtime-host/dist/server/task-ledger-coordinator.js +0 -154
  237. package/node_modules/@maka/storage/dist/task-ledger-store.js +0 -663
@@ -56,12 +56,17 @@ class TuiMcpControllerImpl {
56
56
  initialization: 'loading',
57
57
  configuration: 'synchronizing',
58
58
  publication: 'waiting',
59
+ canManagePublicationCredential: false,
59
60
  toolCount: 0,
60
61
  servers: [],
61
62
  });
62
63
  constructor(connection, deps) {
63
64
  this.#connection = connection;
64
65
  this.#deps = deps;
66
+ this.#snapshot = freezeSnapshot({
67
+ ...this.#snapshot,
68
+ canManagePublicationCredential: Boolean(connection.setCredential && connection.removeCredential),
69
+ });
65
70
  this.#disposeManagerChange = deps.manager.onChange(() => {
66
71
  try {
67
72
  this.#refreshManagerSnapshot();
@@ -77,7 +82,12 @@ class TuiMcpControllerImpl {
77
82
  this.#availability = availability;
78
83
  if (availability.kind === 'unavailable') {
79
84
  this.#published = undefined;
80
- this.#updateSnapshot({ publication: 'host_unavailable' });
85
+ this.#updateSnapshot({
86
+ publication: availability.reason ?? 'host_unavailable',
87
+ ...(availability.reason === 'provider_conflict'
88
+ ? { canManagePublicationCredential: false }
89
+ : {}),
90
+ });
81
91
  }
82
92
  else {
83
93
  this.#updateSnapshot({ publication: 'waiting' });
@@ -160,6 +170,7 @@ class TuiMcpControllerImpl {
160
170
  await this.#connection.unregisterClientCapabilities().catch(() => undefined);
161
171
  }
162
172
  this.#published = undefined;
173
+ await this.#connection.closePublication?.().catch(() => undefined);
163
174
  await managerClosing;
164
175
  await this.#initialization.catch(() => undefined);
165
176
  }
@@ -189,6 +200,30 @@ class TuiMcpControllerImpl {
189
200
  async #executeAction(action) {
190
201
  if (this.#closed)
191
202
  return { status: 'failed', reason: 'closed' };
203
+ if (action.kind === 'set_publication_credential') {
204
+ if (!this.#connection.setCredential) {
205
+ return { status: 'failed', reason: 'publication-credential-failed' };
206
+ }
207
+ try {
208
+ await this.#connection.setCredential(action.credential);
209
+ return { status: 'applied', effect: await this.#settlePublication() };
210
+ }
211
+ catch {
212
+ return { status: 'failed', reason: 'publication-credential-failed' };
213
+ }
214
+ }
215
+ if (action.kind === 'remove_publication_credential') {
216
+ if (!this.#connection.removeCredential) {
217
+ return { status: 'failed', reason: 'publication-credential-failed' };
218
+ }
219
+ try {
220
+ await this.#connection.removeCredential();
221
+ return { status: 'applied', effect: 'pending_host' };
222
+ }
223
+ catch {
224
+ return { status: 'failed', reason: 'publication-credential-failed' };
225
+ }
226
+ }
192
227
  if (action.kind === 'test') {
193
228
  try {
194
229
  const test = await this.#deps.manager.test(action.serverId);
@@ -334,10 +369,16 @@ class TuiMcpControllerImpl {
334
369
  while (!this.#closed && (this.#publicationTask || this.#publicationRequested)) {
335
370
  await this.#publicationTask?.catch(() => undefined);
336
371
  }
337
- if (this.#snapshot.publication === 'error')
372
+ if (this.#snapshot.publication === 'error' ||
373
+ this.#snapshot.publication === 'credential_rejected' ||
374
+ this.#snapshot.publication === 'provider_conflict' ||
375
+ this.#snapshot.publication === 'target_mismatch') {
338
376
  return 'publication_failed';
339
- if (this.#snapshot.publication === 'host_unavailable')
377
+ }
378
+ if (this.#snapshot.publication === 'host_unavailable' ||
379
+ this.#snapshot.publication === 'credential_required') {
340
380
  return 'pending_host';
381
+ }
341
382
  return 'published';
342
383
  }
343
384
  #refreshManagerSnapshot(initialization = this.#snapshot.initialization, configuration = this.#snapshot.configuration) {
@@ -351,6 +392,7 @@ class TuiMcpControllerImpl {
351
392
  initialization,
352
393
  configuration,
353
394
  publication: this.#snapshot.publication,
395
+ canManagePublicationCredential: this.#snapshot.canManagePublicationCredential,
354
396
  toolCount: this.#deps.manager.toolSnapshot().tools.length,
355
397
  servers: [...serverIds]
356
398
  .sort((left, right) => left.localeCompare(right))
@@ -383,7 +425,7 @@ class TuiMcpControllerImpl {
383
425
  async #publishCurrentSnapshot() {
384
426
  const availability = this.#availability;
385
427
  if (availability.kind !== 'connected') {
386
- this.#updateSnapshot({ publication: 'host_unavailable' });
428
+ this.#updateSnapshot({ publication: availability.reason ?? 'host_unavailable' });
387
429
  return;
388
430
  }
389
431
  const identity = connectionIdentity(availability);
@@ -0,0 +1,395 @@
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 { createHash } from 'node:crypto';
20
+ import { join } from 'node:path';
21
+ import { connectRuntimeHostProfile, createClientRuntimeHostCredentialStore, createClientRuntimeHostProfileCatalog, createRuntimeHostCapabilityProviderCredentialStore, createRuntimeHostPeerClientFromEnvironment, createRuntimeHostReconnectingConnection, loadOrCreateRuntimeHostClientInstanceId, RuntimeHostPermanentReconnectError, RuntimeHostProfileConnectionError, subscribeClientRuntimeHostProfileCatalogChanges, RuntimeHostRemoteCompatibilityError, runtimeHostProfileTargetFingerprint, } from '@maka/runtime-host/client';
22
+ import { tryAcquireFileLifetimeOwner, } from '@maka/storage/file-lifetime-owner';
23
+ export function createRemoteTuiMcpPublicationTarget(input, overrides = {}) {
24
+ const deps = {
25
+ credentials: createRuntimeHostCapabilityProviderCredentialStore(createClientRuntimeHostCredentialStore(input.clientDataRoot)),
26
+ loadClientInstanceId: loadOrCreateRuntimeHostClientInstanceId,
27
+ connectProfile: connectRuntimeHostProfile,
28
+ createPeerClient: createRuntimeHostPeerClientFromEnvironment,
29
+ createReconnectingConnection: createRuntimeHostReconnectingConnection,
30
+ acquirePublicationLease: tryAcquireFileLifetimeOwner,
31
+ profiles: createClientRuntimeHostProfileCatalog(input.clientDataRoot),
32
+ subscribeProfileChanges: (listener) => subscribeClientRuntimeHostProfileCatalogChanges(input.clientDataRoot, listener),
33
+ ...overrides,
34
+ };
35
+ return new RemoteTuiMcpPublicationTarget(input, deps);
36
+ }
37
+ class RemoteTuiMcpPublicationTarget {
38
+ #input;
39
+ #deps;
40
+ #listeners = new Set();
41
+ #availability = {
42
+ kind: 'unavailable',
43
+ reason: 'host_unavailable',
44
+ };
45
+ #connection;
46
+ #publicationLease;
47
+ #disposeAvailability;
48
+ #peerClient;
49
+ #peerCloseTask = Promise.resolve();
50
+ #operation = Promise.resolve();
51
+ #connectAbort;
52
+ #generation = 0;
53
+ #closed = false;
54
+ #closeTask;
55
+ #disposeProfileChanges;
56
+ #profileValidationQueued = false;
57
+ #profileInvalidationGeneration = 0;
58
+ #profileValidationError;
59
+ constructor(input, deps) {
60
+ this.#input = input;
61
+ this.#deps = deps;
62
+ try {
63
+ this.#disposeProfileChanges = deps.subscribeProfileChanges((error) => {
64
+ this.#scheduleProfileValidation(error);
65
+ });
66
+ }
67
+ catch (error) {
68
+ this.#scheduleProfileValidation(error instanceof Error ? error : new Error(String(error)));
69
+ }
70
+ void this.#serialize(async () => {
71
+ let lease;
72
+ try {
73
+ lease = await deps.acquirePublicationLease(providerLeasePath(input));
74
+ }
75
+ catch {
76
+ await this.#retire('host_unavailable');
77
+ return;
78
+ }
79
+ if (!lease) {
80
+ await this.#retire('provider_conflict');
81
+ return;
82
+ }
83
+ if (this.#closed) {
84
+ await lease.close();
85
+ return;
86
+ }
87
+ this.#publicationLease = lease;
88
+ const profileCurrent = await this.#profileStillCurrent().catch(() => undefined);
89
+ if (profileCurrent !== true) {
90
+ await this.#retire(profileCurrent === false ? 'target_mismatch' : 'host_unavailable');
91
+ return;
92
+ }
93
+ const credential = await deps.credentials.get(this.#profileTarget(), input.ownerClientInstanceId);
94
+ if (this.#closed)
95
+ return;
96
+ if (!credential) {
97
+ this.#setUnavailable('credential_required');
98
+ return;
99
+ }
100
+ await this.#connect(credential);
101
+ }).catch(() => {
102
+ if (!this.#closed)
103
+ this.#setUnavailable('host_unavailable');
104
+ });
105
+ }
106
+ replaceClientCapabilities(provider, timeoutMs) {
107
+ return this.#serialize(async () => {
108
+ if (this.#closed)
109
+ throw new Error('Remote MCP publication is closed');
110
+ let result;
111
+ const committed = await this.#deps.profiles.mutateRemoteProfileIfCurrent(this.#profileTarget(), async () => {
112
+ result = await this.#requireConnection().replaceClientCapabilities(provider, timeoutMs);
113
+ });
114
+ if (!committed) {
115
+ await this.#retire('target_mismatch');
116
+ throw new RuntimeHostProfileConnectionError('target_mismatch', 'Remote MCP publication profile is no longer current');
117
+ }
118
+ if (!result)
119
+ throw new Error('Runtime Host did not confirm MCP capability registration');
120
+ return result;
121
+ });
122
+ }
123
+ unregisterClientCapabilities(timeoutMs) {
124
+ return this.#requireConnection().unregisterClientCapabilities(timeoutMs);
125
+ }
126
+ subscribeConnectionAvailability(listener) {
127
+ this.#listeners.add(listener);
128
+ try {
129
+ listener(this.#availability);
130
+ }
131
+ catch {
132
+ // Presentation cannot invalidate the companion lifecycle.
133
+ }
134
+ return () => this.#listeners.delete(listener);
135
+ }
136
+ setCredential(credential) {
137
+ this.#cancelConnect();
138
+ return this.#serialize(async () => {
139
+ if (this.#closed)
140
+ throw new Error('Remote MCP publication is closed');
141
+ const committed = await this.#deps.profiles.mutateRemoteProfileIfCurrent(this.#profileTarget(), (profile) => this.#deps.credentials.set({ profile, profileIncarnationId: this.#input.profileIncarnationId }, this.#input.ownerClientInstanceId, credential));
142
+ if (!committed) {
143
+ await this.#retire('target_mismatch');
144
+ throw new RuntimeHostProfileConnectionError('target_mismatch', 'Remote MCP publication profile is no longer current');
145
+ }
146
+ await this.#disconnect();
147
+ await this.#connect(credential);
148
+ });
149
+ }
150
+ removeCredential() {
151
+ this.#cancelConnect();
152
+ return this.#serialize(async () => {
153
+ if (this.#closed)
154
+ throw new Error('Remote MCP publication is closed');
155
+ await this.#disconnect();
156
+ const committed = await this.#deps.profiles.mutateRemoteProfileIfCurrent(this.#profileTarget(), (profile) => this.#deps.credentials.delete({ profile, profileIncarnationId: this.#input.profileIncarnationId }, this.#input.ownerClientInstanceId));
157
+ if (!committed) {
158
+ await this.#retire('target_mismatch');
159
+ throw new RuntimeHostProfileConnectionError('target_mismatch', 'Remote MCP publication profile is no longer current');
160
+ }
161
+ this.#setUnavailable('credential_required');
162
+ });
163
+ }
164
+ closePublication() {
165
+ this.#cancelConnect();
166
+ return this.#beginClose({ waitForOperations: true });
167
+ }
168
+ #serialize(work) {
169
+ const pending = this.#operation.then(work, work);
170
+ this.#operation = pending.then(() => undefined, () => undefined);
171
+ return pending;
172
+ }
173
+ async #connect(credential) {
174
+ const generation = ++this.#generation;
175
+ const abort = new AbortController();
176
+ this.#connectAbort = abort;
177
+ this.#setUnavailable('host_unavailable');
178
+ try {
179
+ const clientInstanceId = await this.#deps.loadClientInstanceId(providerIdentityPath(this.#input));
180
+ const peerClient = this.#input.profile.transport.kind === 'libp2p-direct'
181
+ ? this.#deps.createPeerClient()
182
+ : undefined;
183
+ this.#peerClient = peerClient;
184
+ const connect = async (signal) => {
185
+ const profile = await this.#requireCurrentProfile();
186
+ const connection = await this.#deps.connectProfile({
187
+ profile,
188
+ credential,
189
+ clientInstanceId,
190
+ sshInteraction: 'batch',
191
+ ...(peerClient ? { peerClient } : {}),
192
+ signal: signal ? AbortSignal.any([abort.signal, signal]) : abort.signal,
193
+ });
194
+ return this.#keepIfProfileCurrent(connection);
195
+ };
196
+ const initial = await connect();
197
+ if (this.#closed || generation !== this.#generation) {
198
+ await initial.close().catch(() => undefined);
199
+ await this.#closePeer(peerClient);
200
+ return;
201
+ }
202
+ const connection = await this.#keepIfProfileCurrent(await this.#deps.createReconnectingConnection({
203
+ initialConnection: initial,
204
+ connect,
205
+ onFatalError: (error) => {
206
+ if (!this.#closed && generation === this.#generation) {
207
+ this.#setUnavailable(classifyUnavailable(error));
208
+ if (this.#peerClient === peerClient) {
209
+ void this.#closePeer(peerClient);
210
+ }
211
+ }
212
+ },
213
+ }));
214
+ if (this.#closed || generation !== this.#generation) {
215
+ await connection.close().catch(() => undefined);
216
+ await this.#closePeer(peerClient);
217
+ return;
218
+ }
219
+ this.#connection = connection;
220
+ this.#disposeAvailability = connection.subscribeConnectionAvailability((availability) => {
221
+ if (this.#closed || generation !== this.#generation)
222
+ return;
223
+ this.#setAvailability(availability.kind === 'connected'
224
+ ? availability
225
+ : { kind: 'unavailable', reason: 'host_unavailable' });
226
+ });
227
+ }
228
+ catch (error) {
229
+ if (!this.#closed && generation === this.#generation) {
230
+ this.#setUnavailable(classifyUnavailable(error));
231
+ }
232
+ await this.#closePeer(this.#peerClient);
233
+ }
234
+ finally {
235
+ if (this.#connectAbort === abort)
236
+ this.#connectAbort = undefined;
237
+ }
238
+ }
239
+ async #disconnect() {
240
+ this.#cancelConnect();
241
+ this.#generation += 1;
242
+ this.#disposeAvailability?.();
243
+ this.#disposeAvailability = undefined;
244
+ const connection = this.#connection;
245
+ this.#connection = undefined;
246
+ await connection?.close().catch(() => undefined);
247
+ await this.#closePeer(this.#peerClient);
248
+ await this.#peerCloseTask;
249
+ if (!this.#closed)
250
+ this.#setUnavailable('host_unavailable');
251
+ }
252
+ #scheduleProfileValidation(error) {
253
+ if (this.#closed)
254
+ return;
255
+ this.#profileInvalidationGeneration += 1;
256
+ this.#profileValidationError ??= error;
257
+ if (this.#profileValidationQueued)
258
+ return;
259
+ this.#profileValidationQueued = true;
260
+ void this.#serialize(async () => {
261
+ try {
262
+ while (!this.#closed) {
263
+ const generation = this.#profileInvalidationGeneration;
264
+ const profileCurrent = await this.#profileStillCurrent().catch(() => undefined);
265
+ const validationError = this.#profileValidationError;
266
+ this.#profileValidationError = undefined;
267
+ if (this.#closed)
268
+ return;
269
+ if (validationError || profileCurrent !== true) {
270
+ await this.#retire(validationError || profileCurrent === undefined
271
+ ? 'host_unavailable'
272
+ : 'target_mismatch');
273
+ return;
274
+ }
275
+ if (generation === this.#profileInvalidationGeneration)
276
+ return;
277
+ }
278
+ }
279
+ finally {
280
+ this.#profileValidationQueued = false;
281
+ }
282
+ });
283
+ }
284
+ async #currentProfile() {
285
+ return this.#deps.profiles.readRemoteProfileIfCurrent(this.#profileTarget());
286
+ }
287
+ async #profileStillCurrent() {
288
+ return (await this.#currentProfile()) !== undefined;
289
+ }
290
+ async #requireCurrentProfile() {
291
+ const profile = await this.#currentProfile();
292
+ if (profile)
293
+ return profile;
294
+ throw new RuntimeHostProfileConnectionError('target_mismatch', 'Remote MCP publication profile is no longer current');
295
+ }
296
+ async #keepIfProfileCurrent(connection) {
297
+ try {
298
+ await this.#requireCurrentProfile();
299
+ return connection;
300
+ }
301
+ catch (error) {
302
+ await connection.close().catch(() => undefined);
303
+ throw error;
304
+ }
305
+ }
306
+ #profileTarget() {
307
+ return {
308
+ profile: this.#input.profile,
309
+ profileIncarnationId: this.#input.profileIncarnationId,
310
+ };
311
+ }
312
+ async #retire(reason) {
313
+ await this.#beginClose({ reason, waitForOperations: false });
314
+ }
315
+ #beginClose(input) {
316
+ if (this.#closeTask)
317
+ return this.#closeTask;
318
+ this.#closed = true;
319
+ this.#disposeProfileChanges?.();
320
+ this.#disposeProfileChanges = undefined;
321
+ if (input.reason)
322
+ this.#setUnavailable(input.reason);
323
+ const operations = input.waitForOperations
324
+ ? this.#operation.catch(() => undefined)
325
+ : Promise.resolve();
326
+ this.#closeTask = operations.then(async () => {
327
+ await this.#disconnect();
328
+ const lease = this.#publicationLease;
329
+ this.#publicationLease = undefined;
330
+ try {
331
+ await lease?.close();
332
+ }
333
+ finally {
334
+ this.#listeners.clear();
335
+ }
336
+ });
337
+ return this.#closeTask;
338
+ }
339
+ #requireConnection() {
340
+ if (this.#connection && this.#availability.kind === 'connected')
341
+ return this.#connection;
342
+ throw new RuntimeHostPermanentReconnectError('Remote MCP publication is unavailable');
343
+ }
344
+ #cancelConnect() {
345
+ this.#connectAbort?.abort(new Error('Remote MCP publication target changed'));
346
+ }
347
+ #closePeer(peerClient) {
348
+ if (!peerClient)
349
+ return this.#peerCloseTask;
350
+ if (this.#peerClient === peerClient)
351
+ this.#peerClient = undefined;
352
+ const closing = this.#peerCloseTask.then(() => peerClient.close()).catch(() => undefined);
353
+ this.#peerCloseTask = closing;
354
+ return closing;
355
+ }
356
+ #setUnavailable(reason) {
357
+ this.#setAvailability({ kind: 'unavailable', reason });
358
+ }
359
+ #setAvailability(availability) {
360
+ this.#availability = availability;
361
+ for (const listener of this.#listeners) {
362
+ try {
363
+ listener(availability);
364
+ }
365
+ catch {
366
+ // Presentation cannot invalidate the companion lifecycle.
367
+ }
368
+ }
369
+ }
370
+ }
371
+ function providerIdentityPath(input) {
372
+ return join(input.clientDataRoot, 'runtime-host-client', 'capability-provider-identities', `${providerIdentity(input)}.json`);
373
+ }
374
+ function providerLeasePath(input) {
375
+ return join(input.clientDataRoot, 'runtime-host-client', 'capability-provider-leases', `${providerIdentity(input)}.lease`);
376
+ }
377
+ function providerIdentity(input) {
378
+ return createHash('sha256')
379
+ .update('tui-mcp-capability-provider')
380
+ .update('\0')
381
+ .update(runtimeHostProfileTargetFingerprint(input.profile))
382
+ .update('\0')
383
+ .update(input.profileIncarnationId)
384
+ .update('\0')
385
+ .update(input.ownerClientInstanceId)
386
+ .digest('hex')
387
+ .slice(0, 24);
388
+ }
389
+ function classifyUnavailable(error) {
390
+ if (error instanceof RuntimeHostProfileConnectionError)
391
+ return error.reason;
392
+ if (error instanceof RuntimeHostRemoteCompatibilityError)
393
+ return 'target_mismatch';
394
+ return 'host_unavailable';
395
+ }
@@ -203,6 +203,7 @@ export const AGENT_RUN_EVENT_TYPES = [
203
203
  'provider_request_attempt_recorded',
204
204
  'model_call_attempt_recorded',
205
205
  'history_compact_checkpoint_recorded',
206
+ 'model_projection_transition_recorded',
206
207
  'task_gate_decided',
207
208
  'abort_requested',
208
209
  'run_completed',
@@ -259,6 +260,7 @@ const AGENT_RUN_HEADER_SHAPE = defineObjectShape()([
259
260
  ], [
260
261
  'invocationId',
261
262
  'llmConnectionId',
263
+ 'providerStateIdentity',
262
264
  'completedAt',
263
265
  'parentRunId',
264
266
  'resumedFromRunId',
@@ -323,6 +325,9 @@ export function decodeAgentRunHeader(value) {
323
325
  isPersistedBackendKind(value.backendKind) &&
324
326
  (value.llmConnectionId === undefined ||
325
327
  (typeof value.llmConnectionId === 'string' && value.llmConnectionId.length > 0)) &&
328
+ (value.providerStateIdentity === undefined ||
329
+ (typeof value.providerStateIdentity === 'string' &&
330
+ /^sha256:[0-9a-f]{64}$/.test(value.providerStateIdentity))) &&
326
331
  typeof value.llmConnectionSlug === 'string' &&
327
332
  typeof value.modelId === 'string' &&
328
333
  typeof value.cwd === 'string' &&
@@ -70,7 +70,6 @@ const MIME_BY_EXTENSION = {
70
70
  jpeg: 'image/jpeg',
71
71
  gif: 'image/gif',
72
72
  webp: 'image/webp',
73
- bmp: 'image/bmp',
74
73
  pdf: 'application/pdf',
75
74
  docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
76
75
  xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
@@ -79,6 +78,62 @@ const MIME_BY_EXTENSION = {
79
78
  xls: 'application/vnd.ms-excel',
80
79
  ppt: 'application/vnd.ms-powerpoint',
81
80
  };
81
+ export const ATTACHMENT_MIME_SNIFF_BYTES = 16;
82
+ /**
83
+ * PDF permits arbitrary bytes before the `%PDF-` header and readers
84
+ * conventionally scan roughly the first kilobyte for it. Searching that window
85
+ * keeps a PDF with a preamble from sniffing as nothing — which downstream would
86
+ * otherwise decode as UTF-8 text — while staying bounded so sniffing never
87
+ * becomes an unbounded read. Only the PDF header needs it: image signatures are
88
+ * valid solely at their fixed offset within {@link ATTACHMENT_MIME_SNIFF_BYTES}.
89
+ */
90
+ export const PDF_HEADER_SCAN_BYTES = 1024;
91
+ /**
92
+ * Identify the attachment formats whose bytes affect how Maka processes them.
93
+ * Image signatures are read from the fixed {@link ATTACHMENT_MIME_SNIFF_BYTES}
94
+ * prefix at their required offset; the PDF header may sit behind a short
95
+ * preamble, so it is searched across the first {@link PDF_HEADER_SCAN_BYTES}.
96
+ * Both bounds are fixed, so callers can apply this before handing untrusted
97
+ * input to an image decoder without turning sniffing into an unbounded read.
98
+ */
99
+ export function sniffAttachmentMimeType(bytes) {
100
+ const prefix = bytes.subarray(0, ATTACHMENT_MIME_SNIFF_BYTES);
101
+ if (startsWithBytes(prefix, [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a])) {
102
+ return 'image/png';
103
+ }
104
+ if (startsWithBytes(prefix, [0xff, 0xd8, 0xff]))
105
+ return 'image/jpeg';
106
+ if (startsWithAscii(prefix, 'GIF87a') || startsWithAscii(prefix, 'GIF89a'))
107
+ return 'image/gif';
108
+ if (startsWithAscii(prefix, 'RIFF') && startsWithAscii(prefix, 'WEBP', 8))
109
+ return 'image/webp';
110
+ if (containsAscii(bytes.subarray(0, PDF_HEADER_SCAN_BYTES), '%PDF-'))
111
+ return 'application/pdf';
112
+ return undefined;
113
+ }
114
+ function startsWithBytes(bytes, signature, offset = 0) {
115
+ return (bytes.length >= offset + signature.length &&
116
+ signature.every((value, index) => bytes[offset + index] === value));
117
+ }
118
+ function startsWithAscii(bytes, signature, offset = 0) {
119
+ if (bytes.length < offset + signature.length)
120
+ return false;
121
+ for (let index = 0; index < signature.length; index += 1) {
122
+ if (bytes[offset + index] !== signature.charCodeAt(index))
123
+ return false;
124
+ }
125
+ return true;
126
+ }
127
+ /** True if `signature` appears anywhere in `bytes` (bounded by the caller's
128
+ * slice), for headers a format allows to sit behind a preamble. */
129
+ function containsAscii(bytes, signature) {
130
+ const lastOffset = bytes.length - signature.length;
131
+ for (let offset = 0; offset <= lastOffset; offset += 1) {
132
+ if (startsWithAscii(bytes, signature, offset))
133
+ return true;
134
+ }
135
+ return false;
136
+ }
82
137
  /**
83
138
  * Best-effort MIME from a file name, used when the picker gives no MIME
84
139
  * (Electron's openDialog only returns paths). Falls back to
@@ -91,6 +146,30 @@ export function guessMimeFromName(fileName) {
91
146
  const ext = fileName.slice(dot + 1).toLowerCase();
92
147
  return MIME_BY_EXTENSION[ext] ?? 'application/octet-stream';
93
148
  }
149
+ /**
150
+ * Decide an attachment's MIME with content taking precedence over the name and
151
+ * any renderer-supplied MIME, so a spoofed extension cannot steer routing.
152
+ * Sniffed bytes win outright. When nothing sniffs, a *claimed* image/PDF MIME
153
+ * (from the name or the renderer) is downgraded to `application/octet-stream`
154
+ * so unverified bytes never enter the image or PDF path; any other claim is
155
+ * kept so genuine document kinds still resolve. `bytes` may be a prefix rather
156
+ * than the whole file: image signatures resolve from the
157
+ * {@link ATTACHMENT_MIME_SNIFF_BYTES} prefix, while a PDF header behind a
158
+ * preamble is only found within the first {@link PDF_HEADER_SCAN_BYTES} — the
159
+ * send path passes the full bytes, pick-time staging passes the short prefix.
160
+ */
161
+ export function resolveAttachmentMimeType(bytes, suppliedMimeType, fileName) {
162
+ const sniffed = sniffAttachmentMimeType(bytes);
163
+ if (sniffed)
164
+ return sniffed;
165
+ const fallback = suppliedMimeType && suppliedMimeType.length > 0
166
+ ? suppliedMimeType
167
+ : guessMimeFromName(fileName);
168
+ const normalized = fallback.toLowerCase();
169
+ return normalized.startsWith('image/') || normalized === 'application/pdf'
170
+ ? 'application/octet-stream'
171
+ : fallback;
172
+ }
94
173
  /**
95
174
  * Route a MIME type to an {@link AttachmentRef} kind. The runtime
96
175
  * consumption split is image vs. everything-else (images become provider