dsh-loop-engine-allinone 0.0.0-stage → 0.4.0

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 (143) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/CONTRIBUTING.md +78 -0
  3. package/LICENSE +23 -0
  4. package/NOTICE +45 -0
  5. package/README.md +221 -2
  6. package/README.zh.md +89 -0
  7. package/SECURITY.md +39 -0
  8. package/cordis.patch.yml +3 -0
  9. package/lib/client.js +2166 -0
  10. package/lib/index.js +11621 -0
  11. package/lib/invariant.js +453 -0
  12. package/lib/types/agent-preset-ids.d.ts +276 -0
  13. package/lib/types/client/LoopEngineBadge.d.ts +71 -0
  14. package/lib/types/client/LoopEngineComposerSelect.d.ts +126 -0
  15. package/lib/types/client/LoopEngineSection.d.ts +35 -0
  16. package/lib/types/client/engine-marks.d.ts +87 -0
  17. package/lib/types/client/index.d.ts +39 -0
  18. package/lib/types/client/locales.d.ts +182 -0
  19. package/lib/types/client/reload.d.ts +135 -0
  20. package/lib/types/client/session-engine.d.ts +508 -0
  21. package/lib/types/client/store.d.ts +103 -0
  22. package/lib/types/client/turn-status.d.ts +234 -0
  23. package/lib/types/client/use-session-engine.d.ts +74 -0
  24. package/lib/types/commands.d.ts +77 -0
  25. package/lib/types/compat.d.ts +25 -0
  26. package/lib/types/driver-acp/agent.d.ts +289 -0
  27. package/lib/types/driver-acp/approval.d.ts +27 -0
  28. package/lib/types/driver-acp/capabilities.d.ts +200 -0
  29. package/lib/types/driver-acp/client.d.ts +297 -0
  30. package/lib/types/driver-acp/executable.d.ts +53 -0
  31. package/lib/types/driver-acp/mapping.d.ts +76 -0
  32. package/lib/types/driver-acp/profile.d.ts +126 -0
  33. package/lib/types/driver-acp/runtime.d.ts +45 -0
  34. package/lib/types/driver-acp/subprocess.d.ts +19 -0
  35. package/lib/types/driver-acp/terminal.d.ts +98 -0
  36. package/lib/types/driver-acp/transport.d.ts +43 -0
  37. package/lib/types/driver-acp/types.d.ts +152 -0
  38. package/lib/types/driver-cli/capability.d.ts +42 -0
  39. package/lib/types/driver-cli/cli-agent.d.ts +258 -0
  40. package/lib/types/driver-cli/cli-loop.d.ts +46 -0
  41. package/lib/types/driver-cli/flatten.d.ts +35 -0
  42. package/lib/types/driver-cli/frames.d.ts +128 -0
  43. package/lib/types/driver-cli/ndjson.d.ts +106 -0
  44. package/lib/types/driver-cli/session-sink.d.ts +333 -0
  45. package/lib/types/driver-cli/stream-json.d.ts +61 -0
  46. package/lib/types/driver-cli/text.d.ts +66 -0
  47. package/lib/types/driver-cli/transport.d.ts +84 -0
  48. package/lib/types/driver-core/agents-md-skill-provider.d.ts +72 -0
  49. package/lib/types/driver-core/assistant-stream.d.ts +68 -0
  50. package/lib/types/driver-core/context-files.d.ts +62 -0
  51. package/lib/types/driver-core/host-servers.d.ts +119 -0
  52. package/lib/types/driver-core/hosted-engine-runtime.d.ts +190 -0
  53. package/lib/types/driver-core/hosted-tool-vocabulary.d.ts +78 -0
  54. package/lib/types/driver-core/idle-child.d.ts +57 -0
  55. package/lib/types/driver-core/image-access.d.ts +25 -0
  56. package/lib/types/driver-core/inbox.d.ts +104 -0
  57. package/lib/types/driver-core/model-handover.d.ts +134 -0
  58. package/lib/types/driver-core/ownership.d.ts +41 -0
  59. package/lib/types/driver-core/permission-knobs.d.ts +26 -0
  60. package/lib/types/driver-core/prompt.d.ts +64 -0
  61. package/lib/types/driver-core/session-lifetime.d.ts +62 -0
  62. package/lib/types/driver-core/session-model.d.ts +128 -0
  63. package/lib/types/driver-core/skill-inject.d.ts +59 -0
  64. package/lib/types/driver-core/step-close.d.ts +49 -0
  65. package/lib/types/driver-core/step-images.d.ts +62 -0
  66. package/lib/types/driver-core/step-tools.d.ts +43 -0
  67. package/lib/types/driver-core/system-head.d.ts +43 -0
  68. package/lib/types/engine-agy/agent.d.ts +67 -0
  69. package/lib/types/engine-agy/frames.d.ts +90 -0
  70. package/lib/types/engine-agy/loop.d.ts +64 -0
  71. package/lib/types/engine-agy/process.d.ts +173 -0
  72. package/lib/types/engine-claude/agent.d.ts +186 -0
  73. package/lib/types/engine-claude/loop.d.ts +73 -0
  74. package/lib/types/engine-claude/mapping.d.ts +108 -0
  75. package/lib/types/engine-claude/permission.d.ts +41 -0
  76. package/lib/types/engine-claude/process.d.ts +59 -0
  77. package/lib/types/engine-claude/sdk.d.ts +67 -0
  78. package/lib/types/engine-claude/types.d.ts +28 -0
  79. package/lib/types/engine-codex/agent.d.ts +216 -0
  80. package/lib/types/engine-codex/appserver/client.d.ts +80 -0
  81. package/lib/types/engine-codex/appserver/mapping.d.ts +67 -0
  82. package/lib/types/engine-codex/appserver/thread.d.ts +66 -0
  83. package/lib/types/engine-codex/appserver/types.d.ts +225 -0
  84. package/lib/types/engine-codex/loop.d.ts +75 -0
  85. package/lib/types/engine-codex/model-handover.d.ts +56 -0
  86. package/lib/types/engine-codex/permission.d.ts +126 -0
  87. package/lib/types/engine-codex/skills.d.ts +28 -0
  88. package/lib/types/engine-codex/types.d.ts +36 -0
  89. package/lib/types/engine-drivers.d.ts +132 -0
  90. package/lib/types/engine-grok/agent.d.ts +24 -0
  91. package/lib/types/engine-grok/loop.d.ts +61 -0
  92. package/lib/types/engine-grok/process.d.ts +46 -0
  93. package/lib/types/engine-grok/profile.d.ts +82 -0
  94. package/lib/types/engine-hermes/agent.d.ts +47 -0
  95. package/lib/types/engine-hermes/loop.d.ts +56 -0
  96. package/lib/types/engine-hermes/process.d.ts +92 -0
  97. package/lib/types/engine-kimi/acp/client.d.ts +123 -0
  98. package/lib/types/engine-kimi/acp/mapping.d.ts +73 -0
  99. package/lib/types/engine-kimi/acp/types.d.ts +143 -0
  100. package/lib/types/engine-kimi/agent.d.ts +24 -0
  101. package/lib/types/engine-kimi/commands.d.ts +44 -0
  102. package/lib/types/engine-kimi/loop.d.ts +62 -0
  103. package/lib/types/engine-kimi/model-handover.d.ts +32 -0
  104. package/lib/types/engine-kimi/permission.d.ts +28 -0
  105. package/lib/types/engine-kimi/process.d.ts +47 -0
  106. package/lib/types/engine-kimi/profile.d.ts +19 -0
  107. package/lib/types/engine-kimi/skills.d.ts +52 -0
  108. package/lib/types/engine-kimi/types.d.ts +25 -0
  109. package/lib/types/engine-minimaxcode/agent.d.ts +24 -0
  110. package/lib/types/engine-minimaxcode/loop.d.ts +83 -0
  111. package/lib/types/engine-minimaxcode/process.d.ts +53 -0
  112. package/lib/types/engine-minimaxcode/profile.d.ts +72 -0
  113. package/lib/types/engine-of-session.d.ts +97 -0
  114. package/lib/types/engine-pi/agent.d.ts +230 -0
  115. package/lib/types/engine-pi/loop.d.ts +72 -0
  116. package/lib/types/engine-pi/model-handover.d.ts +84 -0
  117. package/lib/types/engine-pi/permission.d.ts +47 -0
  118. package/lib/types/engine-pi/rpc/client.d.ts +107 -0
  119. package/lib/types/engine-pi/rpc/mapping.d.ts +37 -0
  120. package/lib/types/engine-pi/rpc/types.d.ts +249 -0
  121. package/lib/types/engine-pi/skills.d.ts +47 -0
  122. package/lib/types/engine-pi/types.d.ts +36 -0
  123. package/lib/types/engine-qoderclicn/agent.d.ts +59 -0
  124. package/lib/types/engine-qoderclicn/loop.d.ts +51 -0
  125. package/lib/types/engine-qoderclicn/process.d.ts +113 -0
  126. package/lib/types/engine-registry.d.ts +584 -0
  127. package/lib/types/engine-remote.d.ts +192 -0
  128. package/lib/types/engine-surface.d.ts +36 -0
  129. package/lib/types/engine-zcode/agent.d.ts +50 -0
  130. package/lib/types/engine-zcode/loop.d.ts +47 -0
  131. package/lib/types/engine-zcode/process.d.ts +111 -0
  132. package/lib/types/index.d.ts +205 -0
  133. package/lib/types/invariant.d.ts +26 -0
  134. package/lib/types/model-selection-reset.d.ts +271 -0
  135. package/lib/types/namespace.d.ts +25 -0
  136. package/lib/types/patch-manager.d.ts +104 -0
  137. package/lib/types/preset.d.ts +254 -0
  138. package/lib/types/provider-route.d.ts +245 -0
  139. package/lib/types/router-loop.d.ts +458 -0
  140. package/lib/types/session-engine-store.d.ts +138 -0
  141. package/lib/types/settings.d.ts +60 -0
  142. package/lib/types/skills.d.ts +85 -0
  143. package/package.json +150 -4
@@ -0,0 +1,453 @@
1
+ // src/settings.ts
2
+ import z from "@deepseek-ai/schemastery";
3
+
4
+ // src/engine-registry.ts
5
+ var HOSTED_ENGINE_IDS = [
6
+ "claude-code",
7
+ "codex",
8
+ "pi",
9
+ "kimi",
10
+ "agy",
11
+ "zcode",
12
+ "qoderclicn",
13
+ "hermes",
14
+ "grok",
15
+ "minimaxcode"
16
+ ];
17
+ var LOOP_ENGINE_IDS = ["in-process", ...HOSTED_ENGINE_IDS];
18
+ var ENGINE_REGISTRY = {
19
+ "claude-code": {
20
+ id: "claude-code",
21
+ label: "Claude Code",
22
+ repo: "https://github.com/anthropics/claude-code",
23
+ // The SDK is an npm dependency, but its `pathToClaudeCodeExecutable` option
24
+ // hands the work to an external binary, so the deployment may unbind it.
25
+ bundled: true,
26
+ binConfigKey: "claudeBin",
27
+ versionArgv: ["--version"],
28
+ loginHint: "run `claude` once and sign in, or point `claudeBin` at a signed-in install",
29
+ authPaths: [".claude/.credentials.json", ".claude.json"],
30
+ localeKey: "engineClaudeCode",
31
+ capabilities: {
32
+ streaming: true,
33
+ // The Agent SDK delivers an async message stream; the driver reads it as
34
+ // frames, which is the ndjson family's shape.
35
+ protocol: "ndjson",
36
+ sessionResume: true,
37
+ permissionModes: ["default", "acceptEdits", "bypassPermissions", "plan"],
38
+ images: true,
39
+ reasoningLevels: false
40
+ }
41
+ },
42
+ codex: {
43
+ id: "codex",
44
+ label: "Codex",
45
+ repo: "https://github.com/openai/codex",
46
+ bundled: true,
47
+ binConfigKey: "codexBin",
48
+ versionArgv: ["--version"],
49
+ loginHint: "run `codex login`, or set CODEX_API_KEY, or point `codexBin` at a signed-in install",
50
+ authPaths: [".codex/auth.json"],
51
+ localeKey: "engineCodex",
52
+ capabilities: {
53
+ streaming: true,
54
+ protocol: "jsonrpc",
55
+ sessionResume: true,
56
+ // Codex declares its stance as a (sandbox mode, approval policy) PAIR at
57
+ // `thread/start`, so the modes are the sandbox half.
58
+ permissionModes: ["read-only", "workspace-write", "danger-full-access"],
59
+ images: true,
60
+ reasoningLevels: true
61
+ }
62
+ },
63
+ pi: {
64
+ id: "pi",
65
+ label: "Pi",
66
+ repo: "https://github.com/earendil-works/pi",
67
+ bundled: true,
68
+ binConfigKey: "piBin",
69
+ versionArgv: ["--version"],
70
+ loginHint: "run `pi` once and sign in, or set the provider API-key variable pi expects",
71
+ authPaths: [".pi/agent/auth.json"],
72
+ localeKey: "enginePi",
73
+ capabilities: {
74
+ streaming: true,
75
+ protocol: "jsonrpc",
76
+ // Every step opens a fresh `pi --mode rpc` session, so there is no id to
77
+ // resume across launches.
78
+ sessionResume: false,
79
+ permissionModes: ["read-only", "workspace-write", "danger-full-access"],
80
+ images: true,
81
+ reasoningLevels: true
82
+ }
83
+ },
84
+ kimi: {
85
+ id: "kimi",
86
+ label: "Kimi Code",
87
+ repo: "https://github.com/MoonshotAI/kimi-cli",
88
+ bundled: false,
89
+ binConfigKey: "kimiBin",
90
+ versionArgv: ["--version"],
91
+ updateArgv: ["update"],
92
+ loginHint: "run `kimi` once and sign in (or `kimi login`)",
93
+ authPaths: [".kimi-code/credentials.json", ".kimi-code/auth.json"],
94
+ localeKey: "engineKimi",
95
+ capabilities: {
96
+ streaming: true,
97
+ protocol: "acp",
98
+ sessionResume: true,
99
+ permissionModes: ["ask", "allow", "deny"],
100
+ images: true,
101
+ reasoningLevels: false
102
+ }
103
+ },
104
+ agy: {
105
+ id: "agy",
106
+ label: "Antigravity",
107
+ repo: "https://antigravity.google",
108
+ bundled: false,
109
+ binConfigKey: "agyBin",
110
+ versionArgv: ["--version"],
111
+ updateArgv: ["update"],
112
+ loginHint: "run `agy` once and complete the Google sign-in it opens",
113
+ authPaths: [".gemini/oauth_creds.json"],
114
+ localeKey: "engineAgy",
115
+ // Verified with `agy models` on a signed-in host (2026-10-17) and confirmed
116
+ // selectable end to end: `--model gemini-3.8-flash-low` answered PONG.
117
+ models: [
118
+ { id: "gemini-3.8-flash-high", label: "Gemini 3.8 Flash (High)" },
119
+ { id: "gemini-3.8-flash-medium", label: "Gemini 3.8 Flash (Medium)" },
120
+ { id: "gemini-3.8-flash-low", label: "Gemini 3.8 Flash (Low)" },
121
+ { id: "claude-sonnet-4-6", label: "Claude Sonnet 4.6 (Thinking)" },
122
+ { id: "claude-opus-4-6-thinking", label: "Claude Opus 4.6 (Thinking)" },
123
+ { id: "gpt-oss-120b-medium", label: "GPT-OSS 120B (Medium)" }
124
+ ],
125
+ capabilities: {
126
+ // VERIFIED against a signed-in host: `step_update` frames carry
127
+ // `text_delta` increments, and the driver maps them (see
128
+ // `engine-agy/frames.ts`).
129
+ streaming: true,
130
+ protocol: "ndjson",
131
+ // The CLI continues a conversation with `--conversation <id>` and reports
132
+ // the id it used, but this driver does NOT use it: the plugin is stateless
133
+ // by design, replaying the durable transcript into every step, so there is
134
+ // nothing to carry across steps and nothing that could leak between them.
135
+ sessionResume: true,
136
+ // The CLI's EXECUTION modes. They are deliberately not treated as the
137
+ // permission switch: `--mode accept-edits` and `--mode plan` were both
138
+ // verified to leave `permission_mode` at `request-review`. What actually
139
+ // gates tools headless is `--dangerously-skip-permissions`, mapped from
140
+ // dsh's sandbox knob (`agyDangerouslySkipPermissions`).
141
+ permissionModes: ["accept-edits", "auto", "plan"],
142
+ // Verified absent: there is no image input on this surface.
143
+ images: false,
144
+ reasoningLevels: true
145
+ }
146
+ },
147
+ zcode: {
148
+ id: "zcode",
149
+ label: "ZCode",
150
+ repo: "https://z.ai",
151
+ bundled: false,
152
+ binConfigKey: "zcodeBin",
153
+ versionArgv: ["version"],
154
+ updateArgv: ["plugins", "update"],
155
+ loginHint: "run `zcode login` to sign in with Z.AI",
156
+ authPaths: [".zcode/v2", ".zcode/cli"],
157
+ localeKey: "engineZcode",
158
+ capabilities: {
159
+ streaming: true,
160
+ protocol: "jsonrpc",
161
+ sessionResume: true,
162
+ permissionModes: ["build", "edit", "plan", "yolo"],
163
+ images: false,
164
+ reasoningLevels: false
165
+ }
166
+ },
167
+ qoderclicn: {
168
+ id: "qoderclicn",
169
+ label: "Qoder CN",
170
+ repo: "https://qoder.com",
171
+ bundled: false,
172
+ binConfigKey: "qoderclicnBin",
173
+ versionArgv: ["--version"],
174
+ updateArgv: ["update"],
175
+ loginHint: "run `qoderclicn login` to sign in to Qoder CN",
176
+ authPaths: [".qoder-cn/.auth/user"],
177
+ localeKey: "engineQoderclicn",
178
+ capabilities: {
179
+ streaming: true,
180
+ // `-p --output-format stream-json` emits Claude Code's stream-json frames,
181
+ // one JSON document per line.
182
+ protocol: "ndjson",
183
+ sessionResume: true,
184
+ permissionModes: ["default", "accept_edits", "bypass_permissions", "dont_ask", "auto"],
185
+ // `--attachment` takes files, but a probe could not confirm image blocks
186
+ // survive the round trip, so the engine does not claim the capability.
187
+ images: false,
188
+ reasoningLevels: true
189
+ }
190
+ },
191
+ hermes: {
192
+ id: "hermes",
193
+ label: "Hermes Agent",
194
+ repo: "https://github.com/NousResearch/hermes",
195
+ bundled: false,
196
+ binConfigKey: "hermesBin",
197
+ versionArgv: ["--version"],
198
+ updateArgv: ["update"],
199
+ loginHint: "run `hermes setup` (or `hermes auth`) to sign in to an inference provider",
200
+ authPaths: ["auth.json"],
201
+ localeKey: "engineHermes",
202
+ capabilities: {
203
+ // `-z PROMPT` prints the finished answer; a probe found no structured
204
+ // stream, so the driver reads the whole of stdout as one reply.
205
+ streaming: false,
206
+ protocol: "text",
207
+ sessionResume: true,
208
+ permissionModes: ["safe-mode", "yolo"],
209
+ images: false,
210
+ reasoningLevels: true
211
+ }
212
+ },
213
+ grok: {
214
+ id: "grok",
215
+ label: "Grok Build",
216
+ repo: "https://github.com/xai-org/grok-build",
217
+ bundled: false,
218
+ binConfigKey: "grokBin",
219
+ versionArgv: ["--version"],
220
+ // Verified against the released binary (1.0.59): `grok update Check for
221
+ // updates or install a specific version`. The vendor's own installer
222
+ // (`x.ai/cli/install.sh`) is the other upgrade path and reinstalls in place.
223
+ updateArgv: ["update"],
224
+ loginHint: "run `grok` once and complete the sign-in it opens (or `grok login`), then retry",
225
+ authPaths: [".grok/auth.json"],
226
+ localeKey: "engineGrok",
227
+ // Measured from the SIGNED-IN agent's own `initialize` answer
228
+ // (`_meta.modelState`): the catalog it will actually serve, whose
229
+ // `currentModelId` is `grok-4.7`. This REPLACED an earlier list taken from
230
+ // the unauthenticated `grok models` command, which reported `grok-4.6` and
231
+ // `grok-4.5` — ids the ACP surface then rejected with `-32602 unknown model
232
+ // id`. The lesson is the fork's own rule: a catalog is read from the surface
233
+ // the driver talks to, not from a sibling command that may be reading a
234
+ // different source.
235
+ models: [
236
+ { id: "grok-4.7", label: "Grok 4.7" }
237
+ ],
238
+ capabilities: {
239
+ // Measured: `session/update` frames carry `agent_message_chunk` and
240
+ // `agent_thought_chunk` increments.
241
+ streaming: true,
242
+ protocol: "acp",
243
+ // Measured: `initialize` answers `loadSession: true` with
244
+ // `sessionCapabilities.resume`, and the user guide documents
245
+ // `session/load` plus headless `--resume`/`--continue`.
246
+ sessionResume: true,
247
+ // The ACP gate is `session/request_permission`, and this engine's own
248
+ // always-approve switch is the `--always-approve` argv flag (alias
249
+ // `--yolo`), which `session/new` can also express as `_meta.yoloMode`.
250
+ permissionModes: ["ask", "always-approve"],
251
+ // Measured: `initialize` answers `promptCapabilities.image: false`, so the
252
+ // driver keeps images as path-bearing placeholders instead of sending
253
+ // blocks this engine would refuse.
254
+ images: false,
255
+ // The user guide documents the `reasoning_effort` session config option
256
+ // (`minimal`, `low`, `medium`, `high`, `xhigh`).
257
+ reasoningLevels: true,
258
+ // Measured: the engine answers `protocolVersion: 1` to a client that
259
+ // announces 1.
260
+ acpProtocolVersion: 1
261
+ }
262
+ },
263
+ minimaxcode: {
264
+ id: "minimaxcode",
265
+ label: "MiniMax Code",
266
+ // The vendor's documentation site; the GitHub org (`github.com/MiniMax-AI`)
267
+ // publishes no CLI repository for this product.
268
+ repo: "https://agent.minimax.io/docs/cli/quick-start",
269
+ bundled: false,
270
+ binConfigKey: "minimaxcodeBin",
271
+ versionArgv: ["--version"],
272
+ // Verified against 0.6.12: `mcode update Check for and install a Minimax
273
+ // Code update`.
274
+ updateArgv: ["update"],
275
+ // The subscription path is the whole point of this engine: signing in is what
276
+ // enables the M Plan allowance, and `provider use token-plan` is what makes
277
+ // the CLI spend it instead of an API key.
278
+ loginHint: "run `mcode login --region cn|global`, then `mcode provider use token-plan` to spend your M Plan subscription",
279
+ // Measured on this host: credentials live per REGION under
280
+ // `~/.minimax/auth/prod/<region>/mcode-public/auth.json`, and the CLI writes
281
+ // an `auth-state.json` beside them. The directory, not the file, is the
282
+ // "signed in at least once" fact.
283
+ authPaths: [".minimax/auth/prod"],
284
+ region: {
285
+ configKey: "mcodeRegion",
286
+ // MEASURED, and not the name one would guess: `MCODE_REGION` is INERT on
287
+ // the `mcode acp` path (a child with `MCODE_REGION=en` still authenticated
288
+ // as the `cn` account), while `MAVIS_REGION=en` flipped it to "auth
289
+ // required" — so `MAVIS_REGION` is the variable THIS surface honours. The
290
+ // `MCODE_*` family belongs to the CLI's Electron/mcode-tools broker, which
291
+ // is a different process. A driver that set `MCODE_REGION` would look
292
+ // correct and change nothing.
293
+ envVar: "MAVIS_REGION",
294
+ default: "cn",
295
+ // TWO vocabularies, and conflating them would set a value the CLI rejects:
296
+ // the LOGIN flag speaks `cn|global` (`mcode login --region cn|global`),
297
+ // while the region VALUE the runtime reads and validates is `cn|en`
298
+ // (shipped code: `i!=="cn"&&i!=="en"` throws "The MCode mcode-tools host
299
+ // environment is incomplete"; the same value picks the `zh`/`en` locale and
300
+ // the `mavis` endpoint host). So `en` is this knob's spelling of the
301
+ // non-China account, and the values below are the ones this variable
302
+ // accepts. Only `cn` was measurable here — this host's account is a `cn`
303
+ // one, and the `en` side was observed only as "the cn credentials no longer
304
+ // apply".
305
+ values: ["cn", "en"]
306
+ },
307
+ localeKey: "engineMinimaxcode",
308
+ // Measured from the live `session/new` answer (unauthenticated catalog):
309
+ // MiniMax Code's own composite model ids, whose `v:` suffix selects the
310
+ // variant. A subscription can expose more; a stale id fails loud at the
311
+ // engine, which is the honest outcome.
312
+ models: [
313
+ { id: "m:minimax:MiniMax-M3:v:thinking", label: "M3 \xB7 thinking" },
314
+ { id: "m:minimax:MiniMax-M3:v:", label: "M3" },
315
+ { id: "m:minimax:MiniMax-M3.1-Flash-Preview:v:thinking", label: "M3.1-Flash-Preview \xB7 thinking" },
316
+ { id: "m:minimax:MiniMax-M3.1-Flash-Preview:v:", label: "M3.1-Flash-Preview" },
317
+ { id: "m:minimax:MiniMax-M2.7-highspeed:v:thinking", label: "M2.7-highspeed \xB7 thinking" },
318
+ { id: "m:minimax:MiniMax-M2.7:v:thinking", label: "M2.7 \xB7 thinking" }
319
+ ],
320
+ capabilities: {
321
+ // Measured: `agent_message_chunk` / `agent_thought_chunk` increments, and
322
+ // the ACP handshake answered a real prompt with `stopReason: end_turn`.
323
+ streaming: true,
324
+ protocol: "acp",
325
+ // Measured: `loadSession: true`, `sessionCapabilities.resume`, and a real
326
+ // `session/load` was ACCEPTED on 0.6.12.
327
+ sessionResume: true,
328
+ // Measured from the live `session/new` configOptions: the engine's
329
+ // `permissionMode` option is exactly these three values.
330
+ permissionModes: ["default", "auto", "bypassPermissions"],
331
+ // Measured: `promptCapabilities.image: true` (and the engine's own catalog
332
+ // declares image/video modalities for the M3 models).
333
+ images: true,
334
+ // Measured: a `thinkingEffort` config option
335
+ // (`default`/`low`/`medium`/`high`/`xhigh`/`max`).
336
+ reasoningLevels: true,
337
+ // Measured: the engine answers `protocolVersion: 1`.
338
+ acpProtocolVersion: 1
339
+ }
340
+ }
341
+ };
342
+ var ENGINE_DESCRIPTORS = HOSTED_ENGINE_IDS.map((id) => ENGINE_REGISTRY[id]);
343
+
344
+ // src/settings.ts
345
+ var LOOP_ENGINE_SETTINGS_SCHEMA = z.object({
346
+ engine: z.union(LOOP_ENGINE_IDS.map((id) => z.const(id))).default("in-process"),
347
+ showInComposer: z.boolean().default(true),
348
+ showEngineBadge: z.boolean().default(true)
349
+ });
350
+ function withVolatile(schema) {
351
+ const volatile = schema.volatile;
352
+ return volatile === void 0 ? schema : volatile.call(schema);
353
+ }
354
+ var LOOP_ENGINE_ENGINE_SCHEMA = withVolatile(
355
+ z.union(LOOP_ENGINE_IDS.map((id) => z.const(id))).default("in-process")
356
+ );
357
+ var LOOP_ENGINE_SHOW_IN_COMPOSER_SCHEMA = withVolatile(z.boolean().default(true));
358
+ var LOOP_ENGINE_SHOW_ENGINE_BADGE_SCHEMA = withVolatile(z.boolean().default(true));
359
+
360
+ // src/patch-manager.ts
361
+ var MANAGED_BLOCK_BEGIN = "# -- dsh-loop-engine managed block --";
362
+ var LEGACY_MANAGED_BLOCK_BEGIN = "# -- dsh-loop-engine managed block: ";
363
+ var MANAGED_BLOCK_END = "# -- /dsh-loop-engine managed block --";
364
+ var END_MARKER_LINE = `${MANAGED_BLOCK_END}
365
+ `;
366
+ function renderManagedBlock() {
367
+ return [
368
+ MANAGED_BLOCK_BEGIN,
369
+ "- id: agent-loop",
370
+ " disabled: true",
371
+ "- id: command-goal",
372
+ " disabled: true",
373
+ END_MARKER_LINE
374
+ ].join("\n");
375
+ }
376
+ function hasManagedBlock(text) {
377
+ return text.includes("# -- dsh-loop-engine managed block");
378
+ }
379
+ var LEGACY_BEGIN_MARKER_RE = /^# -- dsh-loop-engine managed block: (\S+) --$/m;
380
+ function legacyBlockEngineOf(text) {
381
+ const engine = LEGACY_BEGIN_MARKER_RE.exec(text)?.[1];
382
+ return LOOP_ENGINE_IDS.includes(engine ?? "") ? engine : void 0;
383
+ }
384
+ function managedSpan(text) {
385
+ const begin = text.indexOf("# -- dsh-loop-engine managed block");
386
+ if (begin === -1) return { head: text, tail: "", present: false, blankBefore: false };
387
+ const afterBegin = begin + LEGACY_MANAGED_BLOCK_BEGIN.length;
388
+ const endAt = text.indexOf(MANAGED_BLOCK_END, afterBegin);
389
+ const spanEnd = endAt === -1 ? text.length : endAt + END_MARKER_LINE.length;
390
+ const before = text.slice(0, begin);
391
+ const blankBefore = before.endsWith("\n\n");
392
+ return {
393
+ head: blankBefore ? before.slice(0, -1) : before,
394
+ tail: text.slice(spanEnd),
395
+ present: true,
396
+ blankBefore
397
+ };
398
+ }
399
+ function ensureTrailingNewline(text) {
400
+ return text.endsWith("\n") ? text : `${text}
401
+ `;
402
+ }
403
+ function dropSeedPlaceholder(text) {
404
+ return text.replace(/^\[\]\n/m, "");
405
+ }
406
+ function applyManagedBlock(text) {
407
+ const block = renderManagedBlock();
408
+ const span = managedSpan(text);
409
+ if (!span.present) {
410
+ if (text === "") return block;
411
+ return dropSeedPlaceholder(`${ensureTrailingNewline(text)}
412
+ ${block}`);
413
+ }
414
+ return dropSeedPlaceholder(`${span.head}${span.blankBefore ? "\n" : ""}${block}${span.tail}`);
415
+ }
416
+
417
+ // src/invariant.ts
418
+ var PACKAGE_NAME = "dsh-loop-engine-allinone";
419
+ var name = "loop-engine-invariant";
420
+ var inject = ["invariants"];
421
+ var install = (ctx, fail) => {
422
+ void ctx;
423
+ const seed = "";
424
+ const commentOnly = "# dsh profile patch layer\n";
425
+ const applied = applyManagedBlock(seed);
426
+ if (applyManagedBlock(applied) !== applied) fail("the managed block is not a fixed point");
427
+ if (!hasManagedBlock(renderManagedBlock())) fail("the rendered block is not recognized by hasManagedBlock");
428
+ if (!applied.includes("- id: agent-loop")) fail("the managed block must disable the base agent-loop row");
429
+ if (legacyBlockEngineOf(applied) !== void 0) fail("the current block must not read as a legacy engine pin");
430
+ for (const engine of LOOP_ENGINE_IDS) {
431
+ const head = "# user patch layer\n";
432
+ const legacy = `${head}
433
+ ${LEGACY_MANAGED_BLOCK_BEGIN}${engine} --
434
+ - id: agent-loop
435
+ disabled: true
436
+ ${MANAGED_BLOCK_END}
437
+ `;
438
+ if (legacyBlockEngineOf(legacy) !== engine) fail(`a legacy ${engine} block must still read as the ${engine} pin`);
439
+ if (applyManagedBlock(legacy) !== applyManagedBlock(head)) {
440
+ fail(`a legacy ${engine} block must migrate to the current block`);
441
+ }
442
+ }
443
+ if (applyManagedBlock(commentOnly) === commentOnly) {
444
+ fail("a comment-only file must gain the block as its top-level array");
445
+ }
446
+ };
447
+ var apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
448
+ export {
449
+ apply,
450
+ inject,
451
+ name
452
+ };
453
+ //# sourceMappingURL=invariant.js.map