maka-agent 0.2.0-dev.47.20260922 → 0.2.0-dev.49.20260924

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 (155) hide show
  1. package/dist/acp/session-event-mapper.js +1 -4
  2. package/dist/onboarding-catalog.js +20 -4
  3. package/dist/pi-transcript.js +0 -8
  4. package/dist/pi-tui-pickers.js +1 -1
  5. package/dist/pi-tui-runner.js +6 -4
  6. package/dist/runtime-host-capability-provider-command.js +25 -6
  7. package/dist/runtime-host-onboarding.js +5 -3
  8. package/dist/runtime-host-session-channel.js +9 -3
  9. package/dist/tui-mcp-control.js +37 -24
  10. package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
  11. package/node_modules/@maka/acp-executor-plugin/dist/acp-errors.js +26 -0
  12. package/node_modules/@maka/acp-executor-plugin/dist/acp-filesystem.js +103 -0
  13. package/node_modules/@maka/acp-executor-plugin/dist/acp-process.js +119 -0
  14. package/node_modules/@maka/acp-executor-plugin/dist/acp-projection.js +146 -0
  15. package/node_modules/@maka/acp-executor-plugin/dist/index.js +653 -0
  16. package/node_modules/@maka/acp-executor-plugin/dist/plugin.mjs +24446 -0
  17. package/node_modules/@maka/acp-executor-plugin/package.json +15 -0
  18. package/node_modules/@maka/antigravity-acp-plugin/dist/index.js +88 -0
  19. package/node_modules/@maka/antigravity-acp-plugin/dist/model-presentation.js +53 -0
  20. package/node_modules/@maka/antigravity-acp-plugin/dist/plugin.mjs +115 -0
  21. package/node_modules/@maka/antigravity-acp-plugin/package.json +15 -0
  22. package/node_modules/@maka/core/dist/events.js +13 -0
  23. package/node_modules/@maka/core/dist/executor-catalog.js +106 -0
  24. package/node_modules/@maka/core/dist/llm-connections.js +2 -5
  25. package/node_modules/@maka/core/dist/mcp.js +4 -1
  26. package/node_modules/@maka/core/dist/model-facts.js +2 -4
  27. package/node_modules/@maka/core/dist/model-metadata.generated.js +345 -248
  28. package/node_modules/@maka/core/dist/model-metadata.js +28 -1
  29. package/node_modules/@maka/core/dist/model-thinking.js +17 -17
  30. package/node_modules/@maka/core/dist/model-web-search.js +7 -9
  31. package/node_modules/@maka/core/dist/models-dev-projection.js +1 -1
  32. package/node_modules/@maka/core/dist/onboarding.js +1 -4
  33. package/node_modules/@maka/core/dist/provider-registry.js +60 -86
  34. package/node_modules/@maka/core/dist/runtime-event-store.js +25 -0
  35. package/node_modules/@maka/core/dist/runtime-event.js +2 -2
  36. package/node_modules/@maka/core/dist/runtime-invocation.js +5 -0
  37. package/node_modules/@maka/core/dist/runtime-policy/connection-catalog-codec.js +28 -16
  38. package/node_modules/@maka/core/dist/runtime-policy/credential-vault-codec.js +6 -0
  39. package/node_modules/@maka/core/dist/runtime-policy/policy-codec.js +21 -0
  40. package/node_modules/@maka/core/dist/runtime-policy.js +1 -1
  41. package/node_modules/@maka/core/dist/session.js +25 -9
  42. package/node_modules/@maka/core/dist/settings.js +1 -0
  43. package/node_modules/@maka/core/dist/tool-ledger-scanner.js +365 -104
  44. package/node_modules/@maka/core/dist/transcript-search.js +1 -0
  45. package/node_modules/@maka/core/dist/turn-origin.js +14 -0
  46. package/node_modules/@maka/core/dist/usage-stats/types.js +1 -0
  47. package/node_modules/@maka/core/package.json +2 -0
  48. package/node_modules/@maka/eval/dist/harbor-maka-subject.js +3 -0
  49. package/node_modules/@maka/eval/dist/maka-subject.js +8 -1
  50. package/node_modules/@maka/mcp/dist/credential-coordinator.js +6 -1
  51. package/node_modules/@maka/mcp/dist/index.js +31 -5
  52. package/node_modules/@maka/mcp/dist/oauth.js +54 -6
  53. package/node_modules/@maka/runtime/dist/agent-run-inspect.js +1 -1
  54. package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +1 -11
  55. package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +2 -12
  56. package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +3 -71
  57. package/node_modules/@maka/runtime/dist/conversation-copy.js +58 -3
  58. package/node_modules/@maka/runtime/dist/local-web-fetch.js +23 -11
  59. package/node_modules/@maka/runtime/dist/mcp-tools.js +9 -2
  60. package/node_modules/@maka/runtime/dist/model-adapter.js +10 -5
  61. package/node_modules/@maka/runtime/dist/model-factory.js +33 -30
  62. package/node_modules/@maka/runtime/dist/model-fetcher.js +4 -1
  63. package/node_modules/@maka/runtime/dist/model-runtime.js +3 -9
  64. package/node_modules/@maka/runtime/dist/plugin-executor-backend.js +116 -3
  65. package/node_modules/@maka/runtime/dist/plugin-executor-service.js +212 -16
  66. package/node_modules/@maka/runtime/dist/read-page.js +11 -8
  67. package/node_modules/@maka/runtime/dist/recovery-resolver.js +47 -20
  68. package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +1 -0
  69. package/node_modules/@maka/runtime/dist/runtime-ledger-repair.js +2 -2
  70. package/node_modules/@maka/runtime/dist/scheduled-task-tools.js +39 -8
  71. package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +3 -0
  72. package/node_modules/@maka/runtime/dist/session-manager.js +182 -127
  73. package/node_modules/@maka/runtime/dist/shell-run-manager.js +3 -0
  74. package/node_modules/@maka/runtime/dist/stream-graph-coordinator.js +29 -4
  75. package/node_modules/@maka/runtime/dist/telemetry/model-pricing.generated.js +141 -134
  76. package/node_modules/@maka/runtime/dist/tool-result-archive-transition.js +3 -3
  77. package/node_modules/@maka/runtime/dist/workers/filesystem-worker.js +7 -6
  78. package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +28 -62
  79. package/node_modules/@maka/runtime-host/dist/candidate-entry.js +8 -5
  80. package/node_modules/@maka/runtime-host/dist/client/hosted-execution-target.js +7 -1
  81. package/node_modules/@maka/runtime-host/dist/client/index.js +1 -1
  82. package/node_modules/@maka/runtime-host/dist/client/reconnect-lifecycle.js +8 -1
  83. package/node_modules/@maka/runtime-host/dist/client/session-catalog-summary.js +6 -1
  84. package/node_modules/@maka/runtime-host/dist/client/session-subscription.js +3 -0
  85. package/node_modules/@maka/runtime-host/dist/composition-identity.js +19 -0
  86. package/node_modules/@maka/runtime-host/dist/protocol/connection-effects.js +6 -3
  87. package/node_modules/@maka/runtime-host/dist/protocol/index.js +14 -2
  88. package/node_modules/@maka/runtime-host/dist/protocol/operations.js +4 -1
  89. package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +34 -0
  90. package/node_modules/@maka/runtime-host/dist/protocol/prompt-suggestions.js +61 -0
  91. package/node_modules/@maka/runtime-host/dist/protocol/runtime-policy.js +4 -1
  92. package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +40 -2
  93. package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +2 -1
  94. package/node_modules/@maka/runtime-host/dist/server/builtin-external-agent-plugins.js +188 -0
  95. package/node_modules/@maka/runtime-host/dist/server/candidate.js +12 -7
  96. package/node_modules/@maka/runtime-host/dist/server/client-capability-recovery.js +44 -46
  97. package/node_modules/@maka/runtime-host/dist/server/connection-effect-coordinator.js +3 -0
  98. package/node_modules/@maka/runtime-host/dist/server/context-coordinator.js +2 -0
  99. package/node_modules/@maka/runtime-host/dist/server/execution-composition-factory.js +1 -1
  100. package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +212 -24
  101. package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +41 -2
  102. package/node_modules/@maka/runtime-host/dist/server/extension-bundle.js +4 -0
  103. package/node_modules/@maka/runtime-host/dist/server/generated-text.js +39 -0
  104. package/node_modules/@maka/runtime-host/dist/server/host-composition-source.js +47 -0
  105. package/node_modules/@maka/runtime-host/dist/server/host-composition.js +1 -29
  106. package/node_modules/@maka/runtime-host/dist/server/host-kernel.js +2 -9
  107. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-recovery.js +75 -9
  108. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-tool-profile.js +12 -0
  109. package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +45 -0
  110. package/node_modules/@maka/runtime-host/dist/server/jev-routing-model.js +157 -0
  111. package/node_modules/@maka/runtime-host/dist/server/listener-set.js +2 -2
  112. package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +4 -0
  113. package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +11 -1
  114. package/node_modules/@maka/runtime-host/dist/server/process-lifecycle.js +1 -1
  115. package/node_modules/@maka/runtime-host/dist/server/process-termination-error.js +27 -0
  116. package/node_modules/@maka/runtime-host/dist/server/prompt-suggestion.js +179 -0
  117. package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +93 -14
  118. package/node_modules/@maka/runtime-host/dist/server/runtime-policy-coordinator.js +2 -0
  119. package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +99 -12
  120. package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +48 -16
  121. package/node_modules/@maka/runtime-host/dist/server/session-effect-coordinator.js +12 -6
  122. package/node_modules/@maka/runtime-host/dist/server/session-title.js +3 -16
  123. package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +71 -3
  124. package/node_modules/@maka/runtime-host/dist/server/shared-session-transcript.js +3 -0
  125. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +6 -13
  126. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +39 -11
  127. package/node_modules/@maka/runtime-host/dist/server/workhub-result-coordinator.js +173 -0
  128. package/node_modules/@maka/runtime-host/dist/server/workhub-result-runtime.js +293 -0
  129. package/node_modules/@maka/runtime-host/package.json +2 -0
  130. package/node_modules/@maka/storage/dist/agent-run-store-contract.js +8 -0
  131. package/node_modules/@maka/storage/dist/config-transfer.js +14 -8
  132. package/node_modules/@maka/storage/dist/execution-stores.js +19 -6
  133. package/node_modules/@maka/storage/dist/interaction-store.js +13 -0
  134. package/node_modules/@maka/storage/dist/mcp-config-store.js +91 -2
  135. package/node_modules/@maka/storage/dist/operational-state-store.js +15 -1
  136. package/node_modules/@maka/storage/dist/plan-authority.js +2 -0
  137. package/node_modules/@maka/storage/dist/plan-store.js +30 -0
  138. package/node_modules/@maka/storage/dist/runtime-event-persistence.js +1 -0
  139. package/node_modules/@maka/storage/dist/runtime-policy/connection-catalog-document.js +28 -17
  140. package/node_modules/@maka/storage/dist/runtime-policy/coordinator.js +9 -3
  141. package/node_modules/@maka/storage/dist/runtime-policy/credential-vault-document.js +4 -1
  142. package/node_modules/@maka/storage/dist/runtime-policy/legacy-custom-connection.js +65 -0
  143. package/node_modules/@maka/storage/dist/runtime-policy/onboarding-transaction.js +10 -5
  144. package/node_modules/@maka/storage/dist/runtime-policy/policy-document.js +2 -0
  145. package/node_modules/@maka/storage/dist/session-bundle-policy.js +11 -0
  146. package/node_modules/@maka/storage/dist/session-store-values.js +16 -4
  147. package/node_modules/@maka/storage/dist/session-store.js +29 -6
  148. package/node_modules/@maka/storage/dist/shell-run-authority.js +1 -0
  149. package/node_modules/@maka/storage/dist/shell-run-store.js +15 -0
  150. package/node_modules/@maka/storage/dist/sqlite-core-execution-schema.js +3 -0
  151. package/node_modules/@maka/storage/dist/sqlite-runtime-schema.js +74 -1
  152. package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +849 -91
  153. package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +21 -3
  154. package/node_modules/@maka/storage/dist/usage-screen.js +138 -108
  155. package/package.json +1 -1
@@ -17,6 +17,15 @@
17
17
  * under the License.
18
18
  */
19
19
  import { GENERATED_MODELS_DEV_METADATA, GENERATED_MODELS_DEV_MODEL_PROVIDER_OVERRIDES, GENERATED_MODELS_DEV_PROVIDER_FACTS, } from './model-metadata.generated.js';
20
+ export const MODEL_API_PROTOCOL_LABELS = {
21
+ 'openai-chat': 'OpenAI Chat Completions',
22
+ 'openai-responses': 'OpenAI Responses',
23
+ 'anthropic-messages': 'Anthropic Messages',
24
+ };
25
+ export const MODEL_API_PROTOCOLS = Object.keys(MODEL_API_PROTOCOL_LABELS);
26
+ export function isModelApiProtocol(value) {
27
+ return MODEL_API_PROTOCOLS.includes(value);
28
+ }
20
29
  const siliconflow = GENERATED_MODELS_DEV_PROVIDER_FACTS.siliconflow;
21
30
  if (!siliconflow.api)
22
31
  throw new Error('models.dev SiliconFlow provider facts are missing api');
@@ -133,7 +142,7 @@ if (fireworks.id !== 'fireworks-ai') {
133
142
  }
134
143
  if (!fireworks.api)
135
144
  throw new Error('models.dev Fireworks AI provider facts are missing api');
136
- const fireworksModelIds = toolCallingModelIds('Fireworks AI', GENERATED_MODELS_DEV_METADATA['fireworks-ai'], ['accounts/fireworks/models/kimi-k2p6']);
145
+ const fireworksModelIds = toolCallingModelIds('Fireworks AI', GENERATED_MODELS_DEV_METADATA['fireworks-ai'], ['accounts/fireworks/models/kimi-k3']).filter((id) => GENERATED_MODELS_DEV_METADATA['fireworks-ai'][id]?.lifecycle !== 'deprecated');
137
146
  const tencentTokenHub = GENERATED_MODELS_DEV_PROVIDER_FACTS['tencent-tokenhub'];
138
147
  if (tencentTokenHub.id !== 'tencent-tokenhub') {
139
148
  throw new Error('models.dev Tencent TokenHub provider facts are missing stable id tencent-tokenhub');
@@ -480,7 +489,6 @@ const providerRegistry = {
480
489
  protocolAdapters: {
481
490
  'openai-chat': {
482
491
  kind: 'openai-compatible',
483
- name: 'provider',
484
492
  normalizeUsage: true,
485
493
  normalizeBaseUrl: true,
486
494
  },
@@ -510,7 +518,7 @@ const providerRegistry = {
510
518
  authKind: 'api_key',
511
519
  fallbackModels: [...tencentCodingPlanModelIds],
512
520
  status: 'ready',
513
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
521
+ runtimeAdapter: { kind: 'openai-compatible' },
514
522
  modelDiscovery: { kind: 'protocol' },
515
523
  category: 'domestic',
516
524
  catalogGroup: 'plans',
@@ -523,7 +531,7 @@ const providerRegistry = {
523
531
  authKind: 'api_key',
524
532
  fallbackModels: [...volcengineCodingPlanModelIds],
525
533
  status: 'ready',
526
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
534
+ runtimeAdapter: { kind: 'openai-compatible' },
527
535
  modelDiscovery: { kind: 'protocol' },
528
536
  category: 'domestic',
529
537
  catalogGroup: 'plans',
@@ -556,7 +564,7 @@ const providerRegistry = {
556
564
  authKind: 'api_key',
557
565
  fallbackModels: [...tencentTokenPlanModelIds],
558
566
  status: 'ready',
559
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
567
+ runtimeAdapter: { kind: 'openai-compatible' },
560
568
  modelDiscovery: { kind: 'protocol' },
561
569
  category: 'domestic',
562
570
  catalogGroup: 'plans',
@@ -603,17 +611,10 @@ const providerRegistry = {
603
611
  label: 'DeepSeek',
604
612
  baseUrl: 'https://api.deepseek.com',
605
613
  authKind: 'api_key',
606
- fallbackModels: [
607
- 'deepseek-v4-flash',
608
- 'deepseek-v4-flash-vision-exp',
609
- 'deepseek-v4-pro',
610
- 'deepseek-reasoner',
611
- 'deepseek-chat',
612
- ],
614
+ fallbackModels: ['deepseek-flash', 'deepseek-v4-pro'],
613
615
  status: 'ready',
614
616
  runtimeAdapter: {
615
617
  kind: 'openai-compatible',
616
- name: 'provider',
617
618
  responses: { adapter: 'open-responses', reasoningReplay: 'plaintext-content' },
618
619
  },
619
620
  modelDiscovery: { kind: 'protocol' },
@@ -628,7 +629,7 @@ const providerRegistry = {
628
629
  authKind: 'api_key',
629
630
  fallbackModels: moonshotModelIds,
630
631
  status: 'ready',
631
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
632
+ runtimeAdapter: { kind: 'openai-compatible' },
632
633
  modelDiscovery: { kind: 'protocol' },
633
634
  category: 'domestic',
634
635
  catalogGroup: 'api',
@@ -659,7 +660,7 @@ const providerRegistry = {
659
660
  authKind: 'api_key',
660
661
  fallbackModels: ['glm-5.2', 'glm-5.1', 'glm-5-turbo', 'glm-4.7', 'glm-4.5-air'],
661
662
  status: 'ready',
662
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
663
+ runtimeAdapter: { kind: 'openai-compatible' },
663
664
  modelDiscovery: { kind: 'protocol' },
664
665
  category: 'domestic',
665
666
  catalogGroup: 'plans',
@@ -698,7 +699,7 @@ const providerRegistry = {
698
699
  authKind: 'api_key',
699
700
  fallbackModels: siliconflowModelIds,
700
701
  status: 'ready',
701
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
702
+ runtimeAdapter: { kind: 'openai-compatible' },
702
703
  modelDiscovery: { kind: 'protocol', query: { sub_type: 'chat' } },
703
704
  category: 'domestic',
704
705
  catalogGroup: 'aggregators',
@@ -711,7 +712,7 @@ const providerRegistry = {
711
712
  authKind: 'api_key',
712
713
  fallbackModels: vercelModelIds,
713
714
  status: 'ready',
714
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
715
+ runtimeAdapter: { kind: 'openai-compatible' },
715
716
  modelDiscovery: { kind: 'protocol', auth: 'none', filter: 'language-models' },
716
717
  category: 'overseas',
717
718
  catalogGroup: 'aggregators',
@@ -726,7 +727,6 @@ const providerRegistry = {
726
727
  status: 'ready',
727
728
  runtimeAdapter: {
728
729
  kind: 'openai-compatible',
729
- name: 'provider',
730
730
  responses: { adapter: 'openai', reasoningReplay: 'encrypted-content' },
731
731
  },
732
732
  modelDiscovery: { kind: 'protocol' },
@@ -743,7 +743,6 @@ const providerRegistry = {
743
743
  status: 'ready',
744
744
  runtimeAdapter: {
745
745
  kind: 'openai-compatible',
746
- name: 'provider',
747
746
  responses: { adapter: 'openai', reasoningReplay: 'encrypted-content' },
748
747
  },
749
748
  modelDiscovery: {
@@ -759,7 +758,7 @@ const providerRegistry = {
759
758
  authKind: 'api_key',
760
759
  fallbackModels: zaiModelIds,
761
760
  status: 'ready',
762
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
761
+ runtimeAdapter: { kind: 'openai-compatible' },
763
762
  modelDiscovery: { kind: 'protocol' },
764
763
  category: 'domestic',
765
764
  catalogGroup: 'api',
@@ -772,7 +771,7 @@ const providerRegistry = {
772
771
  authKind: 'api_key',
773
772
  fallbackModels: xiaomiModelIds,
774
773
  status: 'ready',
775
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
774
+ runtimeAdapter: { kind: 'openai-compatible' },
776
775
  modelDiscovery: { kind: 'protocol' },
777
776
  category: 'domestic',
778
777
  catalogGroup: 'api',
@@ -785,7 +784,7 @@ const providerRegistry = {
785
784
  authKind: 'api_key',
786
785
  fallbackModels: [...xiaomiTokenPlanModelIds],
787
786
  status: 'ready',
788
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
787
+ runtimeAdapter: { kind: 'openai-compatible' },
789
788
  modelDiscovery: { kind: 'protocol' },
790
789
  category: 'domestic',
791
790
  catalogGroup: 'plans',
@@ -798,7 +797,7 @@ const providerRegistry = {
798
797
  authKind: 'api_key',
799
798
  fallbackModels: [...xiaomiTokenPlanModelIds],
800
799
  status: 'ready',
801
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
800
+ runtimeAdapter: { kind: 'openai-compatible' },
802
801
  modelDiscovery: { kind: 'protocol' },
803
802
  category: 'overseas',
804
803
  catalogGroup: 'plans',
@@ -811,7 +810,7 @@ const providerRegistry = {
811
810
  authKind: 'api_key',
812
811
  fallbackModels: [...xiaomiTokenPlanModelIds],
813
812
  status: 'ready',
814
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
813
+ runtimeAdapter: { kind: 'openai-compatible' },
815
814
  modelDiscovery: { kind: 'protocol' },
816
815
  category: 'overseas',
817
816
  catalogGroup: 'plans',
@@ -824,7 +823,7 @@ const providerRegistry = {
824
823
  authKind: 'api_key',
825
824
  fallbackModels: cerebrasModelIds,
826
825
  status: 'ready',
827
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
826
+ runtimeAdapter: { kind: 'openai-compatible' },
828
827
  modelDiscovery: { kind: 'protocol' },
829
828
  category: 'overseas',
830
829
  catalogGroup: 'api',
@@ -837,7 +836,7 @@ const providerRegistry = {
837
836
  authKind: 'api_key',
838
837
  fallbackModels: mistralModelIds,
839
838
  status: 'ready',
840
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
839
+ runtimeAdapter: { kind: 'openai-compatible' },
841
840
  modelDiscovery: { kind: 'protocol', responseShape: 'array-or-data' },
842
841
  category: 'overseas',
843
842
  catalogGroup: 'api',
@@ -863,7 +862,7 @@ const providerRegistry = {
863
862
  authKind: 'api_key',
864
863
  fallbackModels: huggingfaceModelIds,
865
864
  status: 'ready',
866
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
865
+ runtimeAdapter: { kind: 'openai-compatible' },
867
866
  modelDiscovery: { kind: 'protocol', filter: 'tool-capable' },
868
867
  category: 'overseas',
869
868
  catalogGroup: 'aggregators',
@@ -878,7 +877,6 @@ const providerRegistry = {
878
877
  status: 'ready',
879
878
  runtimeAdapter: {
880
879
  kind: 'openai-compatible',
881
- name: 'provider',
882
880
  replayAssistantReasoningAs: 'reasoning',
883
881
  replayAssistantReasoningDetails: true,
884
882
  },
@@ -894,7 +892,7 @@ const providerRegistry = {
894
892
  authKind: 'api_key',
895
893
  fallbackModels: opencodeModelIds,
896
894
  status: 'ready',
897
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
895
+ runtimeAdapter: { kind: 'openai-compatible' },
898
896
  protocolAdapters: {
899
897
  'anthropic-messages': { kind: 'anthropic', auth: 'api-key', normalizeBaseUrl: true },
900
898
  'openai-responses': {
@@ -915,7 +913,7 @@ const providerRegistry = {
915
913
  authKind: 'api_key',
916
914
  fallbackModels: opencodeGoModelIds,
917
915
  status: 'ready',
918
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
916
+ runtimeAdapter: { kind: 'openai-compatible' },
919
917
  protocolAdapters: {
920
918
  'anthropic-messages': { kind: 'anthropic', auth: 'api-key', normalizeBaseUrl: true },
921
919
  'openai-responses': {
@@ -951,7 +949,7 @@ const providerRegistry = {
951
949
  authKind: 'api_key',
952
950
  fallbackModels: togetherModelIds,
953
951
  status: 'ready',
954
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
952
+ runtimeAdapter: { kind: 'openai-compatible' },
955
953
  modelDiscovery: { kind: 'protocol' },
956
954
  category: 'overseas',
957
955
  catalogGroup: 'api',
@@ -964,7 +962,7 @@ const providerRegistry = {
964
962
  authKind: 'api_key',
965
963
  fallbackModels: fireworksModelIds,
966
964
  status: 'ready',
967
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
965
+ runtimeAdapter: { kind: 'openai-compatible' },
968
966
  modelDiscovery: {
969
967
  kind: 'fireworks',
970
968
  accountsPath: '/v1/accounts',
@@ -982,7 +980,7 @@ const providerRegistry = {
982
980
  authKind: 'api_key',
983
981
  fallbackModels: nvidiaModelIds,
984
982
  status: 'ready',
985
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
983
+ runtimeAdapter: { kind: 'openai-compatible' },
986
984
  modelDiscovery: { kind: 'protocol' },
987
985
  category: 'overseas',
988
986
  catalogGroup: 'api',
@@ -995,7 +993,7 @@ const providerRegistry = {
995
993
  authKind: 'api_key',
996
994
  fallbackModels: tencentTokenHubModelIds,
997
995
  status: 'ready',
998
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
996
+ runtimeAdapter: { kind: 'openai-compatible' },
999
997
  modelDiscovery: { kind: 'protocol' },
1000
998
  category: 'domestic',
1001
999
  catalogGroup: 'api',
@@ -1008,7 +1006,7 @@ const providerRegistry = {
1008
1006
  authKind: 'api_key',
1009
1007
  fallbackModels: stepfunModelIds,
1010
1008
  status: 'ready',
1011
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
1009
+ runtimeAdapter: { kind: 'openai-compatible' },
1012
1010
  modelDiscovery: { kind: 'protocol' },
1013
1011
  category: 'domestic',
1014
1012
  catalogGroup: 'api',
@@ -1021,7 +1019,7 @@ const providerRegistry = {
1021
1019
  authKind: 'api_key',
1022
1020
  fallbackModels: [...stepfunStepPlanModelIds],
1023
1021
  status: 'ready',
1024
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
1022
+ runtimeAdapter: { kind: 'openai-compatible' },
1025
1023
  modelDiscovery: { kind: 'protocol' },
1026
1024
  category: 'domestic',
1027
1025
  catalogGroup: 'plans',
@@ -1034,7 +1032,7 @@ const providerRegistry = {
1034
1032
  authKind: 'api_key',
1035
1033
  fallbackModels: [...stepfunGlobalStepPlanModelIds],
1036
1034
  status: 'ready',
1037
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
1035
+ runtimeAdapter: { kind: 'openai-compatible' },
1038
1036
  modelDiscovery: { kind: 'protocol' },
1039
1037
  category: 'overseas',
1040
1038
  catalogGroup: 'plans',
@@ -1047,7 +1045,7 @@ const providerRegistry = {
1047
1045
  authKind: 'api_key',
1048
1046
  fallbackModels: stepfunGlobalModelIds,
1049
1047
  status: 'ready',
1050
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
1048
+ runtimeAdapter: { kind: 'openai-compatible' },
1051
1049
  modelDiscovery: { kind: 'protocol' },
1052
1050
  category: 'overseas',
1053
1051
  catalogGroup: 'api',
@@ -1060,7 +1058,7 @@ const providerRegistry = {
1060
1058
  authKind: 'api_key',
1061
1059
  fallbackModels: ['doubao-seed-2-0-pro-260215'],
1062
1060
  status: 'ready',
1063
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
1061
+ runtimeAdapter: { kind: 'openai-compatible' },
1064
1062
  modelDiscovery: {
1065
1063
  kind: 'fallback',
1066
1064
  reason: 'Ark model discovery is a control-plane API that requires AK/SK signing; inference API keys cannot call it',
@@ -1076,7 +1074,7 @@ const providerRegistry = {
1076
1074
  authKind: 'api_key',
1077
1075
  fallbackModels: deepinfraModelIds,
1078
1076
  status: 'ready',
1079
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
1077
+ runtimeAdapter: { kind: 'openai-compatible' },
1080
1078
  modelDiscovery: { kind: 'protocol', path: '/v1/models' },
1081
1079
  category: 'overseas',
1082
1080
  catalogGroup: 'api',
@@ -1089,7 +1087,7 @@ const providerRegistry = {
1089
1087
  authKind: 'api_key',
1090
1088
  fallbackModels: groqModelIds,
1091
1089
  status: 'ready',
1092
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
1090
+ runtimeAdapter: { kind: 'openai-compatible' },
1093
1091
  modelDiscovery: { kind: 'protocol' },
1094
1092
  category: 'overseas',
1095
1093
  catalogGroup: 'api',
@@ -1102,7 +1100,7 @@ const providerRegistry = {
1102
1100
  authKind: 'api_key',
1103
1101
  fallbackModels: openrouterModelIds,
1104
1102
  status: 'ready',
1105
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
1103
+ runtimeAdapter: { kind: 'openai-compatible' },
1106
1104
  modelDiscovery: { kind: 'protocol' },
1107
1105
  category: 'overseas',
1108
1106
  catalogGroup: 'aggregators',
@@ -1115,7 +1113,7 @@ const providerRegistry = {
1115
1113
  authKind: 'api_key',
1116
1114
  fallbackModels: alibabaModelIds,
1117
1115
  status: 'ready',
1118
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
1116
+ runtimeAdapter: { kind: 'openai-compatible' },
1119
1117
  modelDiscovery: { kind: 'protocol' },
1120
1118
  category: 'overseas',
1121
1119
  catalogGroup: 'api',
@@ -1128,7 +1126,7 @@ const providerRegistry = {
1128
1126
  authKind: 'api_key',
1129
1127
  fallbackModels: alibabaCnModelIds,
1130
1128
  status: 'ready',
1131
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
1129
+ runtimeAdapter: { kind: 'openai-compatible' },
1132
1130
  modelDiscovery: { kind: 'protocol' },
1133
1131
  category: 'domestic',
1134
1132
  catalogGroup: 'api',
@@ -1141,7 +1139,7 @@ const providerRegistry = {
1141
1139
  authKind: 'api_key',
1142
1140
  fallbackModels: [...alibabaCodingPlanModelIds],
1143
1141
  status: 'ready',
1144
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
1142
+ runtimeAdapter: { kind: 'openai-compatible' },
1145
1143
  modelDiscovery: { kind: 'protocol' },
1146
1144
  category: 'domestic',
1147
1145
  catalogGroup: 'plans',
@@ -1154,7 +1152,7 @@ const providerRegistry = {
1154
1152
  authKind: 'api_key',
1155
1153
  fallbackModels: [...alibabaCodingPlanModelIds],
1156
1154
  status: 'ready',
1157
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
1155
+ runtimeAdapter: { kind: 'openai-compatible' },
1158
1156
  modelDiscovery: { kind: 'protocol' },
1159
1157
  category: 'overseas',
1160
1158
  catalogGroup: 'plans',
@@ -1169,7 +1167,6 @@ const providerRegistry = {
1169
1167
  status: 'ready',
1170
1168
  runtimeAdapter: {
1171
1169
  kind: 'openai-compatible',
1172
- name: 'provider',
1173
1170
  responses: {
1174
1171
  adapter: 'open-responses',
1175
1172
  reasoningReplay: 'plaintext-summary',
@@ -1190,7 +1187,6 @@ const providerRegistry = {
1190
1187
  status: 'ready',
1191
1188
  runtimeAdapter: {
1192
1189
  kind: 'openai-compatible',
1193
- name: 'provider',
1194
1190
  responses: {
1195
1191
  adapter: 'open-responses',
1196
1192
  reasoningReplay: 'plaintext-summary',
@@ -1209,7 +1205,7 @@ const providerRegistry = {
1209
1205
  authKind: 'api_key',
1210
1206
  fallbackModels: [],
1211
1207
  status: 'ready',
1212
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
1208
+ runtimeAdapter: { kind: 'openai-compatible' },
1213
1209
  protocolAdapters: {
1214
1210
  'anthropic-messages': { kind: 'anthropic', auth: 'bearer', normalizeBaseUrl: true },
1215
1211
  },
@@ -1249,7 +1245,6 @@ const providerRegistry = {
1249
1245
  status: 'ready',
1250
1246
  runtimeAdapter: {
1251
1247
  kind: 'openai-compatible',
1252
- name: 'provider',
1253
1248
  requireBaseUrl: true,
1254
1249
  replayAssistantReasoningAs: 'reasoning',
1255
1250
  },
@@ -1267,7 +1262,6 @@ const providerRegistry = {
1267
1262
  status: 'ready',
1268
1263
  runtimeAdapter: {
1269
1264
  kind: 'openai-compatible',
1270
- name: 'provider',
1271
1265
  includeUsage: true,
1272
1266
  replayAssistantReasoningAs: 'reasoning',
1273
1267
  },
@@ -1283,7 +1277,7 @@ const providerRegistry = {
1283
1277
  authKind: 'none',
1284
1278
  fallbackModels: ['llama3.2', 'qwen2.5-coder', 'gemma3'],
1285
1279
  status: 'ready',
1286
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
1280
+ runtimeAdapter: { kind: 'openai-compatible' },
1287
1281
  modelDiscovery: { kind: 'ollama' },
1288
1282
  category: 'local',
1289
1283
  catalogGroup: 'local',
@@ -1295,7 +1289,7 @@ const providerRegistry = {
1295
1289
  authKind: 'none',
1296
1290
  fallbackModels: [],
1297
1291
  status: 'ready',
1298
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
1292
+ runtimeAdapter: { kind: 'openai-compatible' },
1299
1293
  modelDiscovery: { kind: 'protocol' },
1300
1294
  category: 'local',
1301
1295
  catalogGroup: 'local',
@@ -1307,51 +1301,31 @@ const providerRegistry = {
1307
1301
  authKind: 'optional_api_key',
1308
1302
  fallbackModels: ['qwen3-8b'],
1309
1303
  status: 'ready',
1310
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },
1304
+ runtimeAdapter: { kind: 'openai-compatible' },
1311
1305
  modelDiscovery: { kind: 'protocol' },
1312
1306
  category: 'local',
1313
1307
  catalogGroup: 'local',
1314
1308
  catalogOrder: 17.5,
1315
1309
  },
1316
- 'openai-compatible': {
1317
- label: 'Custom relay (OpenAI Chat-compatible)',
1310
+ custom: {
1311
+ label: 'Custom connection',
1318
1312
  baseUrl: '',
1319
1313
  authKind: 'api_key',
1320
1314
  fallbackModels: [],
1321
1315
  status: 'ready',
1322
- runtimeAdapter: { kind: 'openai-compatible', name: 'connection', requireBaseUrl: true },
1323
- modelDiscovery: { kind: 'protocol' },
1324
- category: 'custom',
1325
- catalogGroup: 'aggregators',
1326
- catalogOrder: 18,
1327
- },
1328
- 'openai-responses-compatible': {
1329
- label: 'Custom relay (OpenAI Responses)',
1330
- baseUrl: '',
1331
- authKind: 'api_key',
1332
- fallbackModels: [],
1333
- status: 'ready',
1334
- runtimeAdapter: {
1335
- kind: 'openai',
1336
- apiProtocol: 'openai-responses',
1337
- responses: { adapter: 'openai', reasoningReplay: 'encrypted-content' },
1316
+ runtimeAdapter: { kind: 'openai-compatible', requireBaseUrl: true },
1317
+ protocolAdapters: {
1318
+ 'openai-responses': {
1319
+ kind: 'openai',
1320
+ apiProtocol: 'openai-responses',
1321
+ responses: { adapter: 'openai', reasoningReplay: 'encrypted-content' },
1322
+ },
1323
+ 'anthropic-messages': { kind: 'anthropic', auth: 'api-key', normalizeBaseUrl: true },
1338
1324
  },
1339
1325
  modelDiscovery: { kind: 'protocol' },
1340
1326
  category: 'custom',
1341
1327
  catalogGroup: 'aggregators',
1342
- catalogOrder: 18.1,
1343
- },
1344
- 'anthropic-compatible': {
1345
- label: 'Custom relay (Anthropic)',
1346
- baseUrl: '',
1347
- authKind: 'api_key',
1348
- fallbackModels: [],
1349
- status: 'ready',
1350
- runtimeAdapter: { kind: 'anthropic', auth: 'api-key', normalizeBaseUrl: true },
1351
- modelDiscovery: { kind: 'protocol' },
1352
- category: 'custom',
1353
- catalogGroup: 'aggregators',
1354
- catalogOrder: 18.2,
1328
+ catalogOrder: 18,
1355
1329
  },
1356
1330
  'github-copilot': {
1357
1331
  label: githubCopilot.name,
@@ -1359,7 +1333,7 @@ const providerRegistry = {
1359
1333
  authKind: 'oauth_token',
1360
1334
  fallbackModels: githubCopilotModelIds,
1361
1335
  status: 'ready',
1362
- runtimeAdapter: { kind: 'openai-compatible', name: 'provider', includeUsage: false },
1336
+ runtimeAdapter: { kind: 'openai-compatible', includeUsage: false },
1363
1337
  protocolAdapters: {
1364
1338
  'anthropic-messages': {
1365
1339
  kind: 'anthropic',
@@ -16,8 +16,33 @@
16
16
  * specific language governing permissions and limitations
17
17
  * under the License.
18
18
  */
19
+ import { runtimeHandoffPause } from './runtime-handoff.js';
20
+ import { mayBeTranscriptLedgerInvocationId, } from './runtime-invocation.js';
19
21
  export const TOOL_RECOVERY_BUNDLE_CAPABILITY_V1 = 'tool_recovery_bundle_v1';
20
22
  export const RUNTIME_CONTINUATION_AUTHORITY_V1 = 'runtime_continuation_authority_v1';
23
+ export function runtimeInvocationRecoveryInventoryFromInvocations(invocations) {
24
+ return invocations.map((invocation) => {
25
+ const base = {
26
+ sessionId: invocation.sessionId,
27
+ invocationId: invocation.invocationId,
28
+ };
29
+ if (!invocation.terminalEvent || runtimeHandoffPause(invocation.terminalEvent)) {
30
+ return { ...base, candidate: invocation };
31
+ }
32
+ return mayBeTranscriptLedgerInvocationId(invocation.invocationId)
33
+ ? {
34
+ ...base,
35
+ identity: {
36
+ sessionId: invocation.sessionId,
37
+ invocationId: invocation.invocationId,
38
+ runId: invocation.runId,
39
+ turnId: invocation.turnId,
40
+ openedAt: invocation.openedAt,
41
+ },
42
+ }
43
+ : base;
44
+ });
45
+ }
21
46
  /**
22
47
  * An append arrived after the run's terminal fact was already written. The
23
48
  * refusal is the store doing its job: once a run has said it ended, a late
@@ -41,7 +41,7 @@ import { isCollaborationMode } from './collaboration.js';
41
41
  import { isAgentSwarmAuthorizationSource, isEffectiveOrchestrationSource, isOrchestrationMode, } from './orchestration.js';
42
42
  import { isToolMode } from './tool-mode.js';
43
43
  import { isExecutorId } from './executor-id.js';
44
- import { isRuntimeSystemNoteKind, } from './session.js';
44
+ import { isSystemNoteKind } from './session.js';
45
45
  import { decodeTurnOrigin } from './turn-origin.js';
46
46
  import { defineObjectShape, hasExactShape, isFiniteNumber, isOptionalMember, isOptionalString, isRecord, isStringArray, } from './record-schema.js';
47
47
  import { isPermissionDecisionFields, isPermissionRequestPayload, isUserQuestionRequest, } from './interaction-record-schema.js';
@@ -451,7 +451,7 @@ function isRuntimeEventContent(value) {
451
451
  case 'system_note':
452
452
  return (hasExactShape(value, SYSTEM_NOTE_CONTENT_SHAPE) &&
453
453
  typeof value.note === 'string' &&
454
- isRuntimeSystemNoteKind(value.note));
454
+ isSystemNoteKind(value.note));
455
455
  case 'invocation_opened':
456
456
  return isRuntimeInvocationOpened(value);
457
457
  default:
@@ -17,6 +17,11 @@
17
17
  * under the License.
18
18
  */
19
19
  import { isTerminalRuntimeEvent } from './runtime-event.js';
20
+ /** Persisted namespace used only by deterministic legacy-transcript conversion runs. */
21
+ export const TRANSCRIPT_LEDGER_INVOCATION_ID_PREFIX = 'transcript-';
22
+ export function mayBeTranscriptLedgerInvocationId(invocationId) {
23
+ return invocationId.startsWith(TRANSCRIPT_LEDGER_INVOCATION_ID_PREFIX);
24
+ }
20
25
  /**
21
26
  * Rebuild a Session's invocation inventory from its events alone.
22
27
  *
@@ -16,7 +16,7 @@
16
16
  * specific language governing permissions and limitations
17
17
  * under the License.
18
18
  */
19
- import { isModelModality, isRelayProviderType, effectiveBaseUrl, PROVIDER_REGISTRY, providerDefaultsOf, validateSlug, } from '../llm-connections.js';
19
+ import { isModelApiProtocol, isModelModality, effectiveBaseUrl, PROVIDER_REGISTRY, providerDefaultsOf, validateSlug, } from '../llm-connections.js';
20
20
  import { CONNECTION_MODEL_DESCRIPTION_MAX_LENGTH, CONNECTION_MODEL_DISPLAY_NAME_MAX_LENGTH, MAX_PREPENDED_FALLBACK_MODELS, } from '../model-catalog.js';
21
21
  import { DECLARABLE_RELAY_THINKING_LEVELS, isThinkingLevel, } from '../model-thinking.js';
22
22
  import { normalizeOptionalRequestBodyOverlay, RequestCustomizationValidationError, } from '../request-customization.js';
@@ -78,6 +78,7 @@ export function normalizeConnectionCatalogEntryDraft(value) {
78
78
  'name',
79
79
  'providerType',
80
80
  'baseUrl',
81
+ 'defaultApiProtocol',
81
82
  'enabled',
82
83
  'enabledModelIds',
83
84
  'modelOverrides',
@@ -85,6 +86,7 @@ export function normalizeConnectionCatalogEntryDraft(value) {
85
86
  ], ['slug', 'name', 'providerType', 'enabled', 'enabledModelIds']);
86
87
  const providerType = decodeProviderType(item.providerType);
87
88
  const baseUrl = normalizeCatalogConnectionBaseUrl(item.baseUrl, providerType);
89
+ const defaultApiProtocol = decodeDefaultApiProtocol(item.defaultApiProtocol, providerType);
88
90
  const enabledModelIds = decodeConnectionModelIds(item.enabledModelIds);
89
91
  const requestBodyOverlay = item.requestBodyOverlay === undefined
90
92
  ? undefined
@@ -96,6 +98,7 @@ export function normalizeConnectionCatalogEntryDraft(value) {
96
98
  name: decodeConnectionName(item.name),
97
99
  providerType,
98
100
  ...(baseUrl === undefined ? {} : { baseUrl }),
101
+ ...(defaultApiProtocol === undefined ? {} : { defaultApiProtocol }),
99
102
  enabled: booleanValue(item.enabled, 'connection enabled'),
100
103
  enabledModelIds,
101
104
  ...profiles,
@@ -261,28 +264,36 @@ export function decodeModelOverridesTable(value) {
261
264
  * `contextWindow` and `vision` state facts about a model. A user has them when
262
265
  * Maka does not — a model newer than the bundled snapshot, or any model on a
263
266
  * provider with no model-list endpoint — and that need is not confined to
264
- * relays (#1584), so they are legal everywhere.
267
+ * custom connections (#1584), so they are legal everywhere.
265
268
  *
266
- * `thinkingLevels` and `serviceTier` name a wire feature instead. They encode
267
- * into request shapes only the OpenAI-compatible relays accept —
268
- * `reasoning_effort` tiers and priority processing — and
269
- * `supportsRelayFastServiceTier` gates the read side by provider for the same
270
- * reason. A table carrying them on another provider describes a request Maka
271
- * would never send: dead state at best, and on a provider whose wire rejects
272
- * the unknown value, a 400 the user cannot explain.
269
+ * `thinkingLevels` and `serviceTier` name a wire feature instead. Built-in
270
+ * providers take thinking levels from model metadata and never send a declared
271
+ * one; a table carrying them there describes a request Maka would never send.
273
272
  */
274
273
  function assertProfileFieldsFitProvider(profiles, providerType) {
275
- if (!profiles || isRelayProviderType(providerType))
274
+ if (!profiles || providerType === 'custom')
276
275
  return;
277
276
  for (const [modelId, profile] of Object.entries(profiles)) {
278
277
  if (profile.thinkingLevels !== undefined) {
279
- throw domainError(`declared thinking levels for ${modelId} require an OpenAI-compatible connection`);
278
+ throw domainError(`declared thinking levels for ${modelId} require a custom connection`);
280
279
  }
281
280
  if (profile.serviceTier !== undefined) {
282
- throw domainError(`declared service tier for ${modelId} requires an OpenAI-compatible connection`);
281
+ throw domainError(`declared service tier for ${modelId} requires a custom connection`);
283
282
  }
284
283
  }
285
284
  }
285
+ export function decodeDefaultApiProtocol(value, providerType) {
286
+ if (providerType !== 'custom') {
287
+ if (value !== undefined) {
288
+ throw domainError('only a custom connection has a default API protocol');
289
+ }
290
+ return undefined;
291
+ }
292
+ if (!isModelApiProtocol(value)) {
293
+ throw domainError('custom connection default API protocol is invalid');
294
+ }
295
+ return value;
296
+ }
286
297
  // An empty table is not a state worth storing: drafts/canonical entries omit
287
298
  // the key, and updates treat it as the same instruction as `null` (clear).
288
299
  function nonEmptyRelayProfiles(value) {
@@ -297,6 +308,7 @@ export function decodeCanonicalConnectionCatalogEntry(value) {
297
308
  'name',
298
309
  'providerType',
299
310
  'baseUrl',
311
+ 'defaultApiProtocol',
300
312
  'enabled',
301
313
  'enabledModelIds',
302
314
  'modelOverrides',
@@ -320,6 +332,9 @@ export function decodeCanonicalConnectionCatalogEntry(value) {
320
332
  name: item.name,
321
333
  providerType: item.providerType,
322
334
  ...(item.baseUrl === undefined ? {} : { baseUrl: item.baseUrl }),
335
+ ...(item.defaultApiProtocol === undefined
336
+ ? {}
337
+ : { defaultApiProtocol: item.defaultApiProtocol }),
323
338
  enabled: item.enabled,
324
339
  enabledModelIds: item.enabledModelIds,
325
340
  ...(item.modelOverrides === undefined ? {} : { modelOverrides: item.modelOverrides }),
@@ -435,10 +450,7 @@ export function decodeConnectionModel(value) {
435
450
  'capabilities',
436
451
  'modalities',
437
452
  ], ['id']);
438
- if (item.apiProtocol !== undefined &&
439
- item.apiProtocol !== 'openai-chat' &&
440
- item.apiProtocol !== 'openai-responses' &&
441
- item.apiProtocol !== 'anthropic-messages') {
453
+ if (item.apiProtocol !== undefined && !isModelApiProtocol(item.apiProtocol)) {
442
454
  throw domainError('connection model API protocol is invalid');
443
455
  }
444
456
  let capabilities;