opensquid 0.5.441 → 0.5.447

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 (380) hide show
  1. package/README.md +1 -0
  2. package/dist/functions/arm_scope.d.ts +27 -0
  3. package/dist/functions/arm_scope.d.ts.map +1 -0
  4. package/dist/functions/arm_scope.js +52 -0
  5. package/dist/functions/arm_scope.js.map +1 -0
  6. package/dist/functions/index.d.ts +1 -0
  7. package/dist/functions/index.d.ts.map +1 -1
  8. package/dist/functions/index.js +1 -0
  9. package/dist/functions/index.js.map +1 -1
  10. package/dist/runtime/bootstrap.d.ts.map +1 -1
  11. package/dist/runtime/bootstrap.js +2 -0
  12. package/dist/runtime/bootstrap.js.map +1 -1
  13. package/dist/runtime/handoff/render.d.ts +5 -4
  14. package/dist/runtime/handoff/render.d.ts.map +1 -1
  15. package/dist/runtime/handoff/render.js +7 -7
  16. package/dist/runtime/handoff/render.js.map +1 -1
  17. package/dist/runtime/hooks/active_task_mirror.js +0 -0
  18. package/dist/runtime/hooks/apply_patch.js +0 -0
  19. package/dist/runtime/hooks/dispatch.js +0 -0
  20. package/dist/runtime/hooks/hook_output.js +0 -0
  21. package/dist/runtime/hooks/memory_reconcile.js +0 -0
  22. package/dist/runtime/hooks/new_project_detect.js +0 -0
  23. package/dist/runtime/hooks/profession_resolver.js +0 -0
  24. package/dist/runtime/hooks/scope_intent.js +0 -0
  25. package/dist/runtime/hooks/session_id.js +0 -0
  26. package/dist/runtime/hooks/session_liveness.js +0 -0
  27. package/dist/runtime/hooks/stop_drive.js +0 -0
  28. package/dist/runtime/hooks/stop_stream.js +0 -0
  29. package/dist/runtime/hooks/subagent_guard.js +0 -0
  30. package/dist/runtime/hooks/transcript.js +0 -0
  31. package/dist/runtime/hooks/transcript_tasks.js +0 -0
  32. package/dist/runtime/ralph/orchestrator.d.ts.map +1 -1
  33. package/dist/runtime/ralph/orchestrator.js +2 -1
  34. package/dist/runtime/ralph/orchestrator.js.map +1 -1
  35. package/dist/setup/cli/limits_state.d.ts.map +1 -1
  36. package/dist/setup/cli/limits_state.js +6 -40
  37. package/dist/setup/cli/limits_state.js.map +1 -1
  38. package/dist/setup/cli/pack_walk.d.ts +32 -0
  39. package/dist/setup/cli/pack_walk.d.ts.map +1 -0
  40. package/dist/setup/cli/pack_walk.js +76 -0
  41. package/dist/setup/cli/pack_walk.js.map +1 -0
  42. package/dist/setup/cli/permissions_state.d.ts.map +1 -1
  43. package/dist/setup/cli/permissions_state.js +6 -37
  44. package/dist/setup/cli/permissions_state.js.map +1 -1
  45. package/dist/setup/cli/triggers_state.d.ts.map +1 -1
  46. package/dist/setup/cli/triggers_state.js +3 -29
  47. package/dist/setup/cli/triggers_state.js.map +1 -1
  48. package/dist/workgraph/events.d.ts.map +1 -1
  49. package/dist/workgraph/events.js +10 -0
  50. package/dist/workgraph/events.js.map +1 -1
  51. package/dist/workgraph/store.d.ts.map +1 -1
  52. package/dist/workgraph/store.js +5 -0
  53. package/dist/workgraph/store.js.map +1 -1
  54. package/dist/workgraph/types.d.ts +2 -1
  55. package/dist/workgraph/types.d.ts.map +1 -1
  56. package/docs/ARCHITECTURE.md +268 -0
  57. package/package.json +5 -3
  58. package/packs/builtin/coding-flow/skills/entry-and-handoffs/skill.yaml +13 -17
  59. package/dist/anti-drift/evaluator.d.ts +0 -88
  60. package/dist/anti-drift/evaluator.d.ts.map +0 -1
  61. package/dist/anti-drift/evaluator.js +0 -417
  62. package/dist/anti-drift/evaluator.js.map +0 -1
  63. package/dist/anti-drift/evaluator.test.js +0 -78
  64. package/dist/anti-drift/rules.d.ts +0 -80
  65. package/dist/anti-drift/rules.d.ts.map +0 -1
  66. package/dist/anti-drift/rules.js +0 -368
  67. package/dist/anti-drift/rules.js.map +0 -1
  68. package/dist/anti-drift/rules.test.js +0 -213
  69. package/dist/anti-drift/state.d.ts +0 -107
  70. package/dist/anti-drift/state.d.ts.map +0 -1
  71. package/dist/anti-drift/state.js +0 -177
  72. package/dist/anti-drift/state.js.map +0 -1
  73. package/dist/anti-drift/state.test.js +0 -120
  74. package/dist/chat/adapters/discord.d.ts +0 -41
  75. package/dist/chat/adapters/discord.d.ts.map +0 -1
  76. package/dist/chat/adapters/discord.js +0 -176
  77. package/dist/chat/adapters/discord.js.map +0 -1
  78. package/dist/chat/adapters/discord.test.js +0 -25
  79. package/dist/chat/adapters/slack.d.ts +0 -43
  80. package/dist/chat/adapters/slack.d.ts.map +0 -1
  81. package/dist/chat/adapters/slack.js +0 -172
  82. package/dist/chat/adapters/slack.js.map +0 -1
  83. package/dist/chat/adapters/slack.test.js +0 -30
  84. package/dist/chat/adapters/telegram.d.ts +0 -148
  85. package/dist/chat/adapters/telegram.d.ts.map +0 -1
  86. package/dist/chat/adapters/telegram.js +0 -498
  87. package/dist/chat/adapters/telegram.js.map +0 -1
  88. package/dist/chat/adapters/telegram.test.js +0 -94
  89. package/dist/chat/config.d.ts +0 -98
  90. package/dist/chat/config.d.ts.map +0 -1
  91. package/dist/chat/config.js +0 -185
  92. package/dist/chat/config.js.map +0 -1
  93. package/dist/chat/daemon/active-project.d.ts +0 -17
  94. package/dist/chat/daemon/active-project.d.ts.map +0 -1
  95. package/dist/chat/daemon/active-project.js +0 -23
  96. package/dist/chat/daemon/active-project.js.map +0 -1
  97. package/dist/chat/daemon/autospawn.d.ts +0 -40
  98. package/dist/chat/daemon/autospawn.d.ts.map +0 -1
  99. package/dist/chat/daemon/autospawn.js +0 -129
  100. package/dist/chat/daemon/autospawn.js.map +0 -1
  101. package/dist/chat/daemon/autospawn.test.js +0 -112
  102. package/dist/chat/daemon/cli.d.ts +0 -18
  103. package/dist/chat/daemon/cli.d.ts.map +0 -1
  104. package/dist/chat/daemon/cli.js +0 -71
  105. package/dist/chat/daemon/cli.js.map +0 -1
  106. package/dist/chat/daemon/collisions.js +0 -384
  107. package/dist/chat/daemon/health-check.d.ts +0 -69
  108. package/dist/chat/daemon/health-check.d.ts.map +0 -1
  109. package/dist/chat/daemon/health-check.js +0 -112
  110. package/dist/chat/daemon/health-check.js.map +0 -1
  111. package/dist/chat/daemon/inbox-read.d.ts +0 -35
  112. package/dist/chat/daemon/inbox-read.d.ts.map +0 -1
  113. package/dist/chat/daemon/inbox-read.js +0 -75
  114. package/dist/chat/daemon/inbox-read.js.map +0 -1
  115. package/dist/chat/daemon/inbox-read.test.js +0 -97
  116. package/dist/chat/daemon/inbox.d.ts +0 -63
  117. package/dist/chat/daemon/inbox.d.ts.map +0 -1
  118. package/dist/chat/daemon/inbox.js +0 -56
  119. package/dist/chat/daemon/inbox.js.map +0 -1
  120. package/dist/chat/daemon/inbox.test.js +0 -110
  121. package/dist/chat/daemon/lifecycle.d.ts +0 -71
  122. package/dist/chat/daemon/lifecycle.d.ts.map +0 -1
  123. package/dist/chat/daemon/lifecycle.js +0 -221
  124. package/dist/chat/daemon/lifecycle.js.map +0 -1
  125. package/dist/chat/daemon/lifecycle.test.js +0 -163
  126. package/dist/chat/daemon/protocol.d.ts +0 -107
  127. package/dist/chat/daemon/protocol.d.ts.map +0 -1
  128. package/dist/chat/daemon/protocol.js +0 -54
  129. package/dist/chat/daemon/protocol.js.map +0 -1
  130. package/dist/chat/daemon/routing.d.ts +0 -140
  131. package/dist/chat/daemon/routing.d.ts.map +0 -1
  132. package/dist/chat/daemon/routing.js +0 -198
  133. package/dist/chat/daemon/routing.js.map +0 -1
  134. package/dist/chat/daemon/routing.test.js +0 -259
  135. package/dist/chat/daemon/rpc-client.d.ts +0 -45
  136. package/dist/chat/daemon/rpc-client.d.ts.map +0 -1
  137. package/dist/chat/daemon/rpc-client.js +0 -133
  138. package/dist/chat/daemon/rpc-client.js.map +0 -1
  139. package/dist/chat/daemon/rpc-server.d.ts +0 -39
  140. package/dist/chat/daemon/rpc-server.d.ts.map +0 -1
  141. package/dist/chat/daemon/rpc-server.js +0 -385
  142. package/dist/chat/daemon/rpc-server.js.map +0 -1
  143. package/dist/chat/daemon/rpc.test.js +0 -177
  144. package/dist/chat/daemon/subscribers.js +0 -257
  145. package/dist/chat/daemon/worker.d.ts +0 -27
  146. package/dist/chat/daemon/worker.d.ts.map +0 -1
  147. package/dist/chat/daemon/worker.js +0 -313
  148. package/dist/chat/daemon/worker.js.map +0 -1
  149. package/dist/chat/daemon/workspace-topic.js +0 -324
  150. package/dist/chat/env-token.d.ts +0 -60
  151. package/dist/chat/env-token.d.ts.map +0 -1
  152. package/dist/chat/env-token.js +0 -137
  153. package/dist/chat/env-token.js.map +0 -1
  154. package/dist/chat/env-token.test.js +0 -160
  155. package/dist/chat/factory.d.ts +0 -30
  156. package/dist/chat/factory.d.ts.map +0 -1
  157. package/dist/chat/factory.js +0 -50
  158. package/dist/chat/factory.js.map +0 -1
  159. package/dist/chat/factory.test.js +0 -55
  160. package/dist/chat/gateway.d.ts +0 -176
  161. package/dist/chat/gateway.d.ts.map +0 -1
  162. package/dist/chat/gateway.js +0 -146
  163. package/dist/chat/gateway.js.map +0 -1
  164. package/dist/chat/gateway.test.js +0 -192
  165. package/dist/claude-md.d.ts +0 -39
  166. package/dist/claude-md.d.ts.map +0 -1
  167. package/dist/claude-md.js +0 -113
  168. package/dist/claude-md.js.map +0 -1
  169. package/dist/claude-md.test.js +0 -91
  170. package/dist/codex/activate.d.ts +0 -66
  171. package/dist/codex/activate.d.ts.map +0 -1
  172. package/dist/codex/activate.js +0 -329
  173. package/dist/codex/activate.js.map +0 -1
  174. package/dist/codex/activate.test.js +0 -229
  175. package/dist/codex/bundled-default/bundled-default.test.js +0 -161
  176. package/dist/codex/cli-publish.test.js +0 -133
  177. package/dist/codex/cli.d.ts +0 -35
  178. package/dist/codex/cli.d.ts.map +0 -1
  179. package/dist/codex/cli.js +0 -554
  180. package/dist/codex/cli.js.map +0 -1
  181. package/dist/codex/cli.test.js +0 -277
  182. package/dist/codex/import-skill-md.d.ts +0 -53
  183. package/dist/codex/import-skill-md.d.ts.map +0 -1
  184. package/dist/codex/import-skill-md.js +0 -236
  185. package/dist/codex/import-skill-md.js.map +0 -1
  186. package/dist/codex/import-skill-md.test.js +0 -225
  187. package/dist/codex/loader.d.ts +0 -27
  188. package/dist/codex/loader.d.ts.map +0 -1
  189. package/dist/codex/loader.js +0 -86
  190. package/dist/codex/loader.js.map +0 -1
  191. package/dist/codex/loader.test.js +0 -75
  192. package/dist/codex/parse.d.ts +0 -28
  193. package/dist/codex/parse.d.ts.map +0 -1
  194. package/dist/codex/parse.js +0 -309
  195. package/dist/codex/parse.js.map +0 -1
  196. package/dist/codex/parse.test.js +0 -241
  197. package/dist/codex/store.d.ts +0 -87
  198. package/dist/codex/store.d.ts.map +0 -1
  199. package/dist/codex/store.js +0 -205
  200. package/dist/codex/store.js.map +0 -1
  201. package/dist/codex/store.test.js +0 -242
  202. package/dist/codex/types.d.ts +0 -398
  203. package/dist/codex/types.d.ts.map +0 -1
  204. package/dist/codex/types.js +0 -21
  205. package/dist/codex/types.js.map +0 -1
  206. package/dist/config.d.ts +0 -53
  207. package/dist/config.d.ts.map +0 -1
  208. package/dist/config.js +0 -202
  209. package/dist/config.js.map +0 -1
  210. package/dist/config.test.js +0 -117
  211. package/dist/engine/cli.d.ts +0 -14
  212. package/dist/engine/cli.d.ts.map +0 -1
  213. package/dist/engine/cli.js +0 -171
  214. package/dist/engine/cli.js.map +0 -1
  215. package/dist/engine/client.d.ts +0 -219
  216. package/dist/engine/client.d.ts.map +0 -1
  217. package/dist/engine/client.js +0 -312
  218. package/dist/engine/client.js.map +0 -1
  219. package/dist/engine/config.d.ts +0 -62
  220. package/dist/engine/config.d.ts.map +0 -1
  221. package/dist/engine/config.js +0 -223
  222. package/dist/engine/config.js.map +0 -1
  223. package/dist/engine/index.d.ts +0 -17
  224. package/dist/engine/index.d.ts.map +0 -1
  225. package/dist/engine/index.js +0 -16
  226. package/dist/engine/index.js.map +0 -1
  227. package/dist/engine/resolver.d.ts +0 -62
  228. package/dist/engine/resolver.d.ts.map +0 -1
  229. package/dist/engine/resolver.js +0 -103
  230. package/dist/engine/resolver.js.map +0 -1
  231. package/dist/engine/singleton.d.ts +0 -95
  232. package/dist/engine/singleton.d.ts.map +0 -1
  233. package/dist/engine/singleton.js +0 -325
  234. package/dist/engine/singleton.js.map +0 -1
  235. package/dist/engine/types.d.ts +0 -402
  236. package/dist/engine/types.d.ts.map +0 -1
  237. package/dist/engine/types.js +0 -22
  238. package/dist/engine/types.js.map +0 -1
  239. package/dist/engine-binary-resolver.js +0 -110
  240. package/dist/engine-binary-resolver.test.js +0 -61
  241. package/dist/engine-cli.js +0 -60
  242. package/dist/engine-client.js +0 -301
  243. package/dist/engine-client.test.js +0 -118
  244. package/dist/functions/chain_state.d.ts +0 -51
  245. package/dist/functions/chain_state.d.ts.map +0 -1
  246. package/dist/functions/chain_state.js +0 -59
  247. package/dist/functions/chain_state.js.map +0 -1
  248. package/dist/hooks/drift-catalog.d.ts +0 -68
  249. package/dist/hooks/drift-catalog.d.ts.map +0 -1
  250. package/dist/hooks/drift-catalog.js +0 -184
  251. package/dist/hooks/drift-catalog.js.map +0 -1
  252. package/dist/hooks/drift-catalog.test.js +0 -154
  253. package/dist/hooks/drift-patterns.d.ts +0 -110
  254. package/dist/hooks/drift-patterns.d.ts.map +0 -1
  255. package/dist/hooks/drift-patterns.js +0 -289
  256. package/dist/hooks/drift-patterns.js.map +0 -1
  257. package/dist/hooks/drift-patterns.test.js +0 -325
  258. package/dist/hooks/engine-vocab-gate.d.ts +0 -108
  259. package/dist/hooks/engine-vocab-gate.d.ts.map +0 -1
  260. package/dist/hooks/engine-vocab-gate.js +0 -225
  261. package/dist/hooks/engine-vocab-gate.js.map +0 -1
  262. package/dist/hooks/engine-vocab-gate.test.js +0 -170
  263. package/dist/hooks/heartbeat.d.ts +0 -107
  264. package/dist/hooks/heartbeat.d.ts.map +0 -1
  265. package/dist/hooks/heartbeat.js +0 -316
  266. package/dist/hooks/heartbeat.js.map +0 -1
  267. package/dist/hooks/heartbeat.test.js +0 -393
  268. package/dist/hooks/honesty-ledger-session-scope.test.js +0 -100
  269. package/dist/hooks/honesty-ledger.d.ts +0 -123
  270. package/dist/hooks/honesty-ledger.d.ts.map +0 -1
  271. package/dist/hooks/honesty-ledger.js +0 -226
  272. package/dist/hooks/honesty-ledger.js.map +0 -1
  273. package/dist/hooks/honesty-ledger.test.js +0 -466
  274. package/dist/hooks/inline-report-check.d.ts +0 -63
  275. package/dist/hooks/inline-report-check.d.ts.map +0 -1
  276. package/dist/hooks/inline-report-check.js +0 -88
  277. package/dist/hooks/inline-report-check.js.map +0 -1
  278. package/dist/hooks/inline-report-check.test.js +0 -96
  279. package/dist/hooks/pre-tool-use.d.ts +0 -62
  280. package/dist/hooks/pre-tool-use.d.ts.map +0 -1
  281. package/dist/hooks/pre-tool-use.js +0 -342
  282. package/dist/hooks/pre-tool-use.js.map +0 -1
  283. package/dist/hooks/pre-tool-use.test.js +0 -134
  284. package/dist/hooks/session-end.d.ts +0 -15
  285. package/dist/hooks/session-end.d.ts.map +0 -1
  286. package/dist/hooks/session-end.js +0 -60
  287. package/dist/hooks/session-end.js.map +0 -1
  288. package/dist/hooks/session-end.test.js +0 -52
  289. package/dist/hooks/stop.d.ts +0 -35
  290. package/dist/hooks/stop.d.ts.map +0 -1
  291. package/dist/hooks/stop.js +0 -136
  292. package/dist/hooks/stop.js.map +0 -1
  293. package/dist/hooks/transcript-active-task.test.js +0 -342
  294. package/dist/hooks/transcript.d.ts +0 -26
  295. package/dist/hooks/transcript.d.ts.map +0 -1
  296. package/dist/hooks/transcript.js +0 -266
  297. package/dist/hooks/transcript.js.map +0 -1
  298. package/dist/hooks/transcript.test.js +0 -103
  299. package/dist/hooks/user-prompt-submit.d.ts +0 -74
  300. package/dist/hooks/user-prompt-submit.d.ts.map +0 -1
  301. package/dist/hooks/user-prompt-submit.js +0 -256
  302. package/dist/hooks/user-prompt-submit.js.map +0 -1
  303. package/dist/hooks/user-prompt-submit.test.js +0 -118
  304. package/dist/hooks/versioning-gate.d.ts +0 -101
  305. package/dist/hooks/versioning-gate.d.ts.map +0 -1
  306. package/dist/hooks/versioning-gate.js +0 -245
  307. package/dist/hooks/versioning-gate.js.map +0 -1
  308. package/dist/hooks/versioning-gate.test.js +0 -368
  309. package/dist/hooks/workflow-gate.d.ts +0 -64
  310. package/dist/hooks/workflow-gate.d.ts.map +0 -1
  311. package/dist/hooks/workflow-gate.js +0 -152
  312. package/dist/hooks/workflow-gate.js.map +0 -1
  313. package/dist/hooks/workflow-gate.test.js +0 -197
  314. package/dist/hooks-cli.d.ts +0 -25
  315. package/dist/hooks-cli.d.ts.map +0 -1
  316. package/dist/hooks-cli.js +0 -286
  317. package/dist/hooks-cli.js.map +0 -1
  318. package/dist/hooks-cli.test.js +0 -148
  319. package/dist/origin.d.ts +0 -16
  320. package/dist/origin.d.ts.map +0 -1
  321. package/dist/origin.js +0 -92
  322. package/dist/origin.js.map +0 -1
  323. package/dist/packs/seed_lessons_ingest.d.ts +0 -30
  324. package/dist/packs/seed_lessons_ingest.d.ts.map +0 -1
  325. package/dist/packs/seed_lessons_ingest.js +0 -107
  326. package/dist/packs/seed_lessons_ingest.js.map +0 -1
  327. package/dist/project-cli.d.ts +0 -7
  328. package/dist/project-cli.d.ts.map +0 -1
  329. package/dist/project-cli.js +0 -145
  330. package/dist/project-cli.js.map +0 -1
  331. package/dist/project.d.ts +0 -127
  332. package/dist/project.d.ts.map +0 -1
  333. package/dist/project.js +0 -281
  334. package/dist/project.js.map +0 -1
  335. package/dist/project.test.js +0 -287
  336. package/dist/rag/backends/loop_engine.d.ts +0 -61
  337. package/dist/rag/backends/loop_engine.d.ts.map +0 -1
  338. package/dist/rag/backends/loop_engine.js +0 -160
  339. package/dist/rag/backends/loop_engine.js.map +0 -1
  340. package/dist/recall.d.ts +0 -82
  341. package/dist/recall.d.ts.map +0 -1
  342. package/dist/recall.js +0 -81
  343. package/dist/recall.js.map +0 -1
  344. package/dist/runtime/agent_bridge/autospawn.d.ts +0 -131
  345. package/dist/runtime/agent_bridge/autospawn.d.ts.map +0 -1
  346. package/dist/runtime/agent_bridge/autospawn.js +0 -251
  347. package/dist/runtime/agent_bridge/autospawn.js.map +0 -1
  348. package/dist/runtime/chain_state.d.ts +0 -124
  349. package/dist/runtime/chain_state.d.ts.map +0 -1
  350. package/dist/runtime/chain_state.js +0 -189
  351. package/dist/runtime/chain_state.js.map +0 -1
  352. package/dist/runtime/hooks/permission_decision.d.ts +0 -34
  353. package/dist/runtime/hooks/permission_decision.d.ts.map +0 -1
  354. package/dist/runtime/hooks/permission_decision.js +0 -39
  355. package/dist/runtime/hooks/permission_decision.js.map +0 -1
  356. package/dist/runtime/workflow_fsm.d.ts +0 -21
  357. package/dist/runtime/workflow_fsm.d.ts.map +0 -1
  358. package/dist/runtime/workflow_fsm.js +0 -25
  359. package/dist/runtime/workflow_fsm.js.map +0 -1
  360. package/dist/runtime/workflow_map.d.ts +0 -26
  361. package/dist/runtime/workflow_map.d.ts.map +0 -1
  362. package/dist/runtime/workflow_map.js +0 -38
  363. package/dist/runtime/workflow_map.js.map +0 -1
  364. package/dist/scope.d.ts +0 -48
  365. package/dist/scope.d.ts.map +0 -1
  366. package/dist/scope.js +0 -111
  367. package/dist/scope.js.map +0 -1
  368. package/dist/setup/cli/topic_create_step.d.ts +0 -84
  369. package/dist/setup/cli/topic_create_step.d.ts.map +0 -1
  370. package/dist/setup/cli/topic_create_step.js +0 -213
  371. package/dist/setup/cli/topic_create_step.js.map +0 -1
  372. package/dist/system-export.d.ts +0 -65
  373. package/dist/system-export.d.ts.map +0 -1
  374. package/dist/system-export.js +0 -194
  375. package/dist/system-export.js.map +0 -1
  376. package/dist/utterance/classifier.d.ts +0 -53
  377. package/dist/utterance/classifier.d.ts.map +0 -1
  378. package/dist/utterance/classifier.js +0 -184
  379. package/dist/utterance/classifier.js.map +0 -1
  380. package/dist/utterance/classifier.test.js +0 -147
@@ -1,402 +0,0 @@
1
- /**
2
- * Wire-shape types for loop-engine JSON-RPC.
3
- *
4
- * Mirrors the shapes defined in engine/src/serve.rs at HEAD (engine v0.5.4).
5
- * Drift-corrected per T.1 audit findings (B, D, E, G):
6
- * - LessonCreateParams gets v1.1 (`pack_id`, `seed_as_promoted`) +
7
- * v1.2 (`external_id`) fields.
8
- * - LessonCreateResult.authored_by output is `'user' | 'pack' | 'agent'`
9
- * (not `'llm'` — engine renders Llm as `"agent"` on the wire per
10
- * `authorship_str()` in serve.rs:830-836).
11
- * - MemorySearchParams includes `mode: 'semantic' | 'text' | 'hybrid'`
12
- * (engine does server-side RRF fusion in `'hybrid'` mode).
13
- * - MemorySearchHit field is `similarity` (NOT `score`); `source` is
14
- * optional and present only on hybrid results.
15
- * - ManifestAssembleParams defaults `statuses` to `["active"]` which is
16
- * unreachable via the public API per T.1.HH — opensquid MUST always
17
- * pass an explicit `statuses: ["promoted"]` or `["pending","promoted"]`.
18
- *
19
- * No runtime code lives here — pure type module.
20
- */
21
- /** MemoryScope wire shape (engine `MemoryScope` serde). */
22
- export type MemoryScope = 'user' | 'global' | {
23
- team: string;
24
- } | {
25
- skill: string;
26
- } | {
27
- project: string;
28
- };
29
- /** Scope filter for memory search/list (engine `ScopeFilterWire` serde). */
30
- export type ScopeFilterWire = {
31
- kind: 'exact';
32
- scope: MemoryScope;
33
- } | {
34
- kind: 'kind';
35
- kind_name: 'user' | 'team' | 'skill' | 'project' | 'global';
36
- } | {
37
- kind: 'any_of';
38
- scopes: MemoryScope[];
39
- };
40
- /**
41
- * Memory provenance block. All fields optional; engine YAML omits absent
42
- * fields via `skip_serializing_if`, so partial blocks round-trip cleanly.
43
- *
44
- * Privacy: `session_id` is opaque (hashed first 8 chars); `cwd_basename`
45
- * is the last path segment only.
46
- */
47
- export interface MemoryOrigin {
48
- host?: string;
49
- session_id?: string;
50
- model?: string;
51
- cwd_basename?: string;
52
- written_at?: string;
53
- }
54
- /**
55
- * Engine `LessonCreateParams` per serve.rs:317-344 (v1.1 + v1.2 surface).
56
- *
57
- * Validation rules enforced server-side:
58
- * - `authored_by === 'pack'` AND missing/empty `pack_id` → -32602
59
- * - `seed_as_promoted: true` AND `authored_by !== 'pack'` → -32602
60
- *
61
- * Wire INPUT: anything other than `'user' | 'pack'` for `authored_by`
62
- * silently maps to `Llm` (engine default).
63
- */
64
- export interface LessonCreateParams {
65
- description: string;
66
- body: string;
67
- evidence?: string[];
68
- authored_by?: 'user' | 'pack';
69
- /** Required when `authored_by === 'pack'`. */
70
- pack_id?: string;
71
- /** v1.2 UPSERT lookup key; pack-authored only. */
72
- external_id?: string;
73
- /** v1.1 gate bypass; pack-authored only. */
74
- seed_as_promoted?: boolean;
75
- }
76
- /**
77
- * Engine `LessonCreateResult` per serve.rs:458-473.
78
- * Wire OUTPUT: `Llm → "agent"` (NOT `"llm"`).
79
- */
80
- export interface LessonCreateResult {
81
- id: string;
82
- status: 'pending' | 'promoted';
83
- authored_by: 'user' | 'pack' | 'agent';
84
- pack_id?: string;
85
- external_id?: string;
86
- created_at: string;
87
- /** v1.2: true on UPSERT hit (existing row reused). */
88
- updated: boolean;
89
- }
90
- export interface LessonRecallHit {
91
- kind: 'lesson';
92
- id: string;
93
- description: string;
94
- status: string;
95
- body_preview: string;
96
- similarity: number;
97
- applied_count: number;
98
- }
99
- export interface LessonRecallResult {
100
- query: string;
101
- returned: number;
102
- results: LessonRecallHit[];
103
- }
104
- export interface LessonListRow {
105
- id: string;
106
- description: string;
107
- status: string;
108
- authored_by: string;
109
- pack_id: string | null;
110
- external_id: string | null;
111
- applied_count: number;
112
- thumbs_up_count: number;
113
- thumbs_down_count: number;
114
- created_at: string;
115
- updated_at: string | null;
116
- }
117
- export interface LessonListResult {
118
- total: number;
119
- limit: number;
120
- offset: number;
121
- returned: number;
122
- results: LessonListRow[];
123
- }
124
- /**
125
- * Engine `MemorySearchParams` per serve.rs:935-967.
126
- *
127
- * `mode: 'hybrid'` is the load-bearing v0.5 addition — engine fuses
128
- * semantic + text via Cormack et al. 2009 RRF (k=60) SERVER-SIDE,
129
- * eliminating the need for a TS-side lexical leg (T.1.B + T.1.JJ).
130
- */
131
- export interface MemorySearchParams {
132
- query: string;
133
- limit?: number;
134
- include_body?: boolean;
135
- scope_filter?: ScopeFilterWire;
136
- mode?: 'semantic' | 'text' | 'hybrid';
137
- /** Clamped to [0, 1] server-side. Applied to RAW scores BEFORE RRF merge. */
138
- min_similarity?: number;
139
- }
140
- export interface MemorySearchHit {
141
- kind: 'memory';
142
- id: string;
143
- description: string;
144
- /** 240-char preview by default; FULL body when `include_body: true`. */
145
- body_preview: string;
146
- /** Rounded to 3 decimals. Engine field is `similarity` — NOT `score`. */
147
- similarity: number;
148
- /** Present only in hybrid mode. */
149
- source?: 'semantic' | 'text' | 'both';
150
- }
151
- export interface MemorySearchResult {
152
- query: string;
153
- returned: number;
154
- results: MemorySearchHit[];
155
- }
156
- /**
157
- * Engine `ManifestAssembleParams` per serve.rs:1363-1390.
158
- *
159
- * `statuses` default is `["active"]` — UNREACHABLE via public lesson API
160
- * (T.1.HH). Always pass `["promoted"]` or `["pending","promoted"]`.
161
- *
162
- * `record_applied` default is `true` — SIDE EFFECT: bumps `applied_count`
163
- * + `last_applied_at` per surfaced lesson. This is the path lessons
164
- * accumulate toward gate's `min_applied_count >= 3`. Pass `false` for
165
- * read-only callers.
166
- */
167
- export interface ManifestAssembleParams {
168
- statuses?: ('pending' | 'active' | 'promoted' | 'superseded' | 'discarded')[];
169
- lesson_limit?: number;
170
- body_preview_len?: number;
171
- annotate_with_gate?: boolean;
172
- record_applied?: boolean;
173
- memory_query?: string;
174
- memory_limit?: number;
175
- memory_scope_filter?: ScopeFilterWire;
176
- }
177
- export interface ManifestActiveLesson {
178
- id: string;
179
- description: string;
180
- status: string;
181
- body_preview: string;
182
- applied_count: number;
183
- last_applied_at: string | null;
184
- target_skill: string | null;
185
- gate?: {
186
- kind: 'promote' | 'block';
187
- reason_count: number;
188
- };
189
- }
190
- export interface ManifestMemory {
191
- id: string;
192
- description: string;
193
- body_preview: string;
194
- similarity: number;
195
- }
196
- export interface ManifestAssembleResult {
197
- active_lessons: ManifestActiveLesson[];
198
- memories: ManifestMemory[];
199
- /** v1.4 returns empty arrays — deferred to a later engine release. */
200
- active_skills: unknown[];
201
- active_personas: unknown[];
202
- active_teams: unknown[];
203
- assembly_stats: {
204
- assembled_at: string;
205
- total_listed: number;
206
- skipped_count: number;
207
- gate_skip_count: number;
208
- record_applied_failures: number;
209
- memories_returned: number | null;
210
- memory_search_failures: number;
211
- session_section_skips: number;
212
- };
213
- }
214
- export interface CreateMemoryResult {
215
- id: string;
216
- description: string;
217
- created_at: string;
218
- scope: MemoryScope;
219
- origin?: MemoryOrigin | null;
220
- }
221
- export interface GetMemoryResult {
222
- id: string;
223
- description: string;
224
- /** FULL body, no truncation. */
225
- content: string;
226
- created_at: string;
227
- scope: MemoryScope;
228
- origin?: MemoryOrigin | null;
229
- /**
230
- * Reverse-citation count enforcing user-immunity (T.1.E -32003).
231
- * A host MUST check this is `0` before force-deleting (force bypasses
232
- * the engine guard). Added to `memory.get` for CMP.4's per-predecessor
233
- * immunity gate.
234
- */
235
- consumed_by_user_lessons: number;
236
- /** Predecessor ids when this is a compressed memory; `[]` for raw. */
237
- derived_from: string[];
238
- }
239
- export interface MemoryListRow {
240
- id: string;
241
- description: string;
242
- scope: MemoryScope;
243
- origin: MemoryOrigin | null;
244
- created_at: string;
245
- updated_at: string | null;
246
- /** Reverse-citation count enforcing user-immunity (T.1.E -32003). */
247
- consumed_by_user_lessons: number;
248
- }
249
- export interface MemoryListResult {
250
- total: number;
251
- limit: number;
252
- offset: number;
253
- returned: number;
254
- results: MemoryListRow[];
255
- }
256
- export interface TaskLogPhaseResult {
257
- ok: true;
258
- task_id: string;
259
- phase: string;
260
- newly_recorded: boolean;
261
- }
262
- export interface TaskGetLedgerResult {
263
- task_id: string;
264
- phases_logged: string[];
265
- entries: {
266
- phase: string;
267
- logged_at: string;
268
- note: string | null;
269
- }[];
270
- }
271
- export interface LessonPromoteResult {
272
- ok: true;
273
- id: string;
274
- gate: 'passed';
275
- status: 'promoted';
276
- from: string;
277
- /**
278
- * Cited MEMORY ids from the promoted lesson's causal narrative (the
279
- * `EvidenceRef::Memory` evidence refs; quote refs excluded). The
280
- * compression-candidate collector (CMP.3) nominates these as
281
- * compression candidates. May be `[]` (a lesson with no memory
282
- * citations). Added in engine commit "lesson.promote returns
283
- * cited_memory_ids".
284
- */
285
- cited_memory_ids?: string[];
286
- }
287
- export interface LessonDiscardResult {
288
- ok: true;
289
- id: string;
290
- status: 'discarded';
291
- from: string;
292
- reason?: string;
293
- }
294
- export interface LessonCaptureFeedbackResult {
295
- ok: true;
296
- id: string;
297
- status: string;
298
- thumbs_up_count: number;
299
- thumbs_down_count: number;
300
- external_signal_sources: string[];
301
- }
302
- export interface LessonSupersedeResult {
303
- ok: true;
304
- old_id: string;
305
- new_id: string;
306
- old_status: string;
307
- }
308
- export interface MemoryUpdateResult {
309
- ok: true;
310
- id: string;
311
- description: string;
312
- created_at: string;
313
- updated_at: string;
314
- scope: MemoryScope;
315
- origin?: MemoryOrigin | null;
316
- }
317
- export interface MemoryDeleteResult {
318
- ok: true;
319
- id: string;
320
- forced: boolean;
321
- }
322
- /**
323
- * Engine `memory.compress` params per serve.rs `MemoryCompressParams`.
324
- *
325
- * `ids` is the explicit compression window — the host (which owns the
326
- * satisfaction probe + candidate collection) decides what to compress;
327
- * the engine never auto-selects. `max_tokens` / `temperature` default
328
- * to the engine's `CompressionConfig::default` when omitted.
329
- */
330
- export interface CompressParams {
331
- ids: string[];
332
- max_tokens?: number;
333
- temperature?: number;
334
- }
335
- /**
336
- * Engine `memory.compress` result — the new compressed memory `Mc`.
337
- *
338
- * `derived_from` carries the predecessor ids (the trace the engine
339
- * chases via `get_by_id_chasing_derived_from` so recall still surfaces
340
- * `Mc` after predecessors are deleted). `consumed_by_user_lessons` is
341
- * the SUM across predecessors — `> 0` means the gist inherited a
342
- * user-lesson citation and the predecessors are user-immune.
343
- */
344
- export interface CompressResult {
345
- id: string;
346
- description: string;
347
- derived_from: string[];
348
- consumed_by_user_lessons: number;
349
- }
350
- /**
351
- * Engine `memory.recompute_citations` result — drift stats from a
352
- * citation-counter recompute sweep. `counters_repaired > 0` means the
353
- * live state had drifted from ground truth; `orphan_citations > 0`
354
- * means a cited memory + its forward `derived_from` successors are all
355
- * gone (audit-trail integrity compromised — the host should investigate).
356
- */
357
- export interface RecomputeCitationsResult {
358
- lessons_scanned: number;
359
- memories_recomputed: number;
360
- counters_repaired: number;
361
- orphan_citations: number;
362
- }
363
- /**
364
- * Engine `memory.consolidate` params per serve.rs
365
- * `MemoryConsolidateParams`.
366
- *
367
- * `ids` is the explicit window (the host decides what to consolidate).
368
- * `recall_k` is the recall-replay top-k the engine uses to VERIFY that
369
- * the minted `Mc` preserves each predecessor's recall before any
370
- * deletion; defaults to the engine's `DEFAULT_CONSOLIDATE_RECALL_K`.
371
- * `max_tokens` / `temperature` tune the internal compression step.
372
- */
373
- export interface ConsolidateParams {
374
- ids: string[];
375
- max_tokens?: number;
376
- temperature?: number;
377
- recall_k?: number;
378
- }
379
- /**
380
- * Engine `memory.consolidate` result — the atomic verify+gated-delete
381
- * outcome. The engine GUARANTEES the D2 safety contract (verify +
382
- * immunity + fail-closed) internally; this is the report.
383
- *
384
- * - `mc_id`: the minted compressed memory. `null` only if compression
385
- * itself failed (no `Mc` exists). Present even when `verified` is
386
- * `false` — `Mc` then sits alongside the (undeleted) predecessors.
387
- * - `deleted`: predecessor ids force-deleted. Non-empty ONLY when
388
- * `verified === true` (and excludes any user-cited predecessor).
389
- * - `kept_immune`: predecessors KEPT because they are user-cited
390
- * (`consumed_by_user_lessons > 0`); the `derived_from` chain still
391
- * links them to `Mc`.
392
- * - `verified`: the recall-replay gate passed for ALL predecessors AND
393
- * compression succeeded. `false` ⇒ fail-closed (nothing deleted); the
394
- * host surfaces a drift event.
395
- */
396
- export interface ConsolidateResult {
397
- mc_id: string | null;
398
- deleted: string[];
399
- kept_immune: string[];
400
- verified: boolean;
401
- }
402
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"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M,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,wBAAwB,EAAE,MAAM,CAAC;CAClC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAID;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB"}
@@ -1,22 +0,0 @@
1
- /**
2
- * Wire-shape types for loop-engine JSON-RPC.
3
- *
4
- * Mirrors the shapes defined in engine/src/serve.rs at HEAD (engine v0.5.4).
5
- * Drift-corrected per T.1 audit findings (B, D, E, G):
6
- * - LessonCreateParams gets v1.1 (`pack_id`, `seed_as_promoted`) +
7
- * v1.2 (`external_id`) fields.
8
- * - LessonCreateResult.authored_by output is `'user' | 'pack' | 'agent'`
9
- * (not `'llm'` — engine renders Llm as `"agent"` on the wire per
10
- * `authorship_str()` in serve.rs:830-836).
11
- * - MemorySearchParams includes `mode: 'semantic' | 'text' | 'hybrid'`
12
- * (engine does server-side RRF fusion in `'hybrid'` mode).
13
- * - MemorySearchHit field is `similarity` (NOT `score`); `source` is
14
- * optional and present only on hybrid results.
15
- * - ManifestAssembleParams defaults `statuses` to `["active"]` which is
16
- * unreachable via the public API per T.1.HH — opensquid MUST always
17
- * pass an explicit `statuses: ["promoted"]` or `["pending","promoted"]`.
18
- *
19
- * No runtime code lives here — pure type module.
20
- */
21
- export {};
22
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/engine/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG"}
@@ -1,110 +0,0 @@
1
- /**
2
- * Bundled-binary resolver for the loop-engine subprocess (v0.6c).
3
- *
4
- * Pattern: esbuild / biomejs / swc — main opensquid package declares 6
5
- * platform-specific packages as `optionalDependencies`; each one ships
6
- * a single binary at `bin/loop-engine` (or `.exe` on Windows). npm's
7
- * `os`/`cpu` fields cause the wrong-platform packages to skip install,
8
- * so on any given host exactly one optional dep is present and provides
9
- * the right binary.
10
- *
11
- * Runtime path:
12
- * 1. Map `(process.platform, process.arch)` → optional-dep name.
13
- * 2. Try `createRequire(import.meta.url).resolve(...)` on that
14
- * package's `bin/loop-engine`. Returns absolute path if installed.
15
- * 3. If not installed (npm `--no-optional`, wrong-platform install,
16
- * local pre-publish dev), return `null`. Caller falls back to the
17
- * pre-existing discovery chain in `config.ts`.
18
- *
19
- * Why a separate module: the resolver is pure (no fs writes, no async),
20
- * and isolating it makes it trivially unit-testable + future
21
- * postinstall-script-friendly. Keeps `config.ts` focused on the legacy
22
- * env/config/path chain.
23
- */
24
- import { createRequire } from "node:module";
25
- import * as path from "node:path";
26
- /**
27
- * Supported targets and their optional-dep package names. Stays in sync
28
- * with `optionalDependencies` in the main package.json and with the
29
- * matrix in `loop-engine/.github/workflows/release.yml`. If you change
30
- * any of those, change all three.
31
- */
32
- const PACKAGE_FOR_PLATFORM = {
33
- "darwin-x64": "opensquid-engine-darwin-x64",
34
- "darwin-arm64": "opensquid-engine-darwin-arm64",
35
- "linux-x64": "opensquid-engine-linux-x64",
36
- "linux-arm64": "opensquid-engine-linux-arm64",
37
- "win32-x64": "opensquid-engine-win32-x64",
38
- "win32-arm64": "opensquid-engine-win32-arm64",
39
- };
40
- const BIN_NAME_FOR_PLATFORM = {
41
- "darwin-x64": "loop-engine",
42
- "darwin-arm64": "loop-engine",
43
- "linux-x64": "loop-engine",
44
- "linux-arm64": "loop-engine",
45
- "win32-x64": "loop-engine.exe",
46
- "win32-arm64": "loop-engine.exe",
47
- };
48
- /**
49
- * Compute the (platform, arch) tuple for the current process. Wrapped
50
- * for unit testability — tests inject a synthetic probe.
51
- */
52
- export function currentPlatform() {
53
- return { platform: process.platform, arch: process.arch };
54
- }
55
- /**
56
- * Look up the optional-dep package name for a given platform. Returns
57
- * `null` when the (platform, arch) pair isn't in the supported matrix.
58
- */
59
- export function packageForPlatform(probe) {
60
- const key = `${probe.platform}-${probe.arch}`;
61
- return PACKAGE_FOR_PLATFORM[key] ?? null;
62
- }
63
- /**
64
- * Look up the binary filename for a given platform (`.exe` on Windows).
65
- */
66
- export function binaryNameForPlatform(probe) {
67
- const key = `${probe.platform}-${probe.arch}`;
68
- return BIN_NAME_FOR_PLATFORM[key] ?? null;
69
- }
70
- /**
71
- * Resolve the bundled binary path via the optional-dep mechanism.
72
- *
73
- * Returns `null` when:
74
- * - the current (platform, arch) isn't in the supported matrix,
75
- * - the optional dep isn't installed (pre-publish dev, npm
76
- * `--no-optional`, wrong-platform install), or
77
- * - the dep is installed but the expected `bin/<name>` file is missing
78
- * (broken publish — diagnostic-only; caller falls through).
79
- *
80
- * Resolution is synchronous + side-effect-free. Safe to call before any
81
- * async work in the spawn path.
82
- */
83
- export function resolveBundledEngineBin(probe = currentPlatform()) {
84
- const pkg = packageForPlatform(probe);
85
- const binName = binaryNameForPlatform(probe);
86
- if (!pkg || !binName)
87
- return null;
88
- // createRequire(import.meta.url) gives us a node-resolution function
89
- // anchored at this file's location — which is what we want since the
90
- // optional deps are installed alongside the main package's node_modules.
91
- const req = createRequire(import.meta.url);
92
- try {
93
- // We resolve the package's package.json (always present) and append
94
- // the binary path. Resolving `${pkg}/bin/<name>` directly would
95
- // require the binary to be listed in `exports` or `bin`, which we
96
- // intentionally don't do (the binary is opaque to node's loader).
97
- const pkgJson = req.resolve(`${pkg}/package.json`);
98
- // pkgJson = /absolute/path/to/node_modules/<pkg>/package.json
99
- // binary = /absolute/path/to/node_modules/<pkg>/bin/<name>
100
- // v0.6c audit fix (H1): use path.join not string slice. On Windows
101
- // require.resolve returns `\` separators; slicing on "/package.json".length
102
- // would silently mis-strip the suffix and concatenating with "/bin/..."
103
- // would mix separators. path.dirname + path.join is the portable primitive.
104
- return path.join(path.dirname(pkgJson), "bin", binName);
105
- }
106
- catch {
107
- // MODULE_NOT_FOUND — optional dep wasn't installed for this host.
108
- return null;
109
- }
110
- }
@@ -1,61 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { binaryNameForPlatform, currentPlatform, packageForPlatform, resolveBundledEngineBin, } from "./engine-binary-resolver.js";
3
- describe("packageForPlatform", () => {
4
- it("maps darwin-arm64 → opensquid-engine-darwin-arm64", () => {
5
- expect(packageForPlatform({ platform: "darwin", arch: "arm64" })).toBe("opensquid-engine-darwin-arm64");
6
- });
7
- it("maps darwin-x64 → opensquid-engine-darwin-x64", () => {
8
- expect(packageForPlatform({ platform: "darwin", arch: "x64" })).toBe("opensquid-engine-darwin-x64");
9
- });
10
- it("maps linux-x64 → opensquid-engine-linux-x64", () => {
11
- expect(packageForPlatform({ platform: "linux", arch: "x64" })).toBe("opensquid-engine-linux-x64");
12
- });
13
- it("maps linux-arm64 → opensquid-engine-linux-arm64", () => {
14
- expect(packageForPlatform({ platform: "linux", arch: "arm64" })).toBe("opensquid-engine-linux-arm64");
15
- });
16
- it("maps win32-x64 → opensquid-engine-win32-x64", () => {
17
- expect(packageForPlatform({ platform: "win32", arch: "x64" })).toBe("opensquid-engine-win32-x64");
18
- });
19
- it("maps win32-arm64 → opensquid-engine-win32-arm64", () => {
20
- expect(packageForPlatform({ platform: "win32", arch: "arm64" })).toBe("opensquid-engine-win32-arm64");
21
- });
22
- it("returns null for unsupported platform (freebsd)", () => {
23
- expect(packageForPlatform({ platform: "freebsd", arch: "x64" })).toBeNull();
24
- });
25
- it("returns null for unsupported arch (ppc64)", () => {
26
- expect(packageForPlatform({ platform: "linux", arch: "ppc64" })).toBeNull();
27
- });
28
- });
29
- describe("binaryNameForPlatform", () => {
30
- it("returns loop-engine on unix", () => {
31
- expect(binaryNameForPlatform({ platform: "darwin", arch: "arm64" })).toBe("loop-engine");
32
- expect(binaryNameForPlatform({ platform: "linux", arch: "x64" })).toBe("loop-engine");
33
- });
34
- it("returns loop-engine.exe on windows", () => {
35
- expect(binaryNameForPlatform({ platform: "win32", arch: "x64" })).toBe("loop-engine.exe");
36
- expect(binaryNameForPlatform({ platform: "win32", arch: "arm64" })).toBe("loop-engine.exe");
37
- });
38
- it("returns null for unsupported platform", () => {
39
- expect(binaryNameForPlatform({ platform: "aix", arch: "x64" })).toBeNull();
40
- });
41
- });
42
- describe("currentPlatform", () => {
43
- it("returns the live process platform + arch", () => {
44
- const probe = currentPlatform();
45
- expect(probe.platform).toBe(process.platform);
46
- expect(probe.arch).toBe(process.arch);
47
- });
48
- });
49
- describe("resolveBundledEngineBin", () => {
50
- it("returns null for unsupported platform (no map entry → no resolve attempt)", () => {
51
- expect(resolveBundledEngineBin({ platform: "haiku", arch: "x64" })).toBeNull();
52
- });
53
- it("returns null when the optional dep isn't installed for the current platform", () => {
54
- // Pre-publish: none of the opensquid-engine-* packages exist in
55
- // node_modules. The resolver must not throw — it must return null
56
- // so callers fall through to the legacy discovery chain. After
57
- // publish, this assertion would flip; the test stays correct as a
58
- // pre-publish guarantee.
59
- expect(resolveBundledEngineBin()).toBeNull();
60
- });
61
- });
@@ -1,60 +0,0 @@
1
- /**
2
- * `opensquid engine <subcommand>` — engine binary management.
3
- *
4
- * Subcommands:
5
- * doctor — show the resolved engine binary + how it was
6
- * discovered (env / config / search / PATH)
7
- * set-path <path> — persist an explicit engine binary path in
8
- * ~/.opensquid/config.json
9
- * forget — clear the persisted path; force re-discovery
10
- * on next start
11
- */
12
- import { forgetEngineBin, loadConfig, resolveEngineBin, setEngineBin } from "./config.js";
13
- export class EngineCliError extends Error {
14
- hint;
15
- constructor(message, hint) {
16
- super(message);
17
- this.hint = hint;
18
- this.name = "EngineCliError";
19
- }
20
- }
21
- async function cmdDoctor() {
22
- console.log(`[opensquid engine doctor]`);
23
- const env = process.env.OPENSQUID_ENGINE_BIN?.trim();
24
- console.log(` env OPENSQUID_ENGINE_BIN: ${env ?? "(unset)"}`);
25
- const config = await loadConfig();
26
- console.log(` config.engine_bin: ${config.engine_bin ?? "(unset)"}`);
27
- if (config.engine_bin_resolved_at) {
28
- console.log(` resolved at: ${config.engine_bin_resolved_at}`);
29
- }
30
- const resolved = await resolveEngineBin();
31
- console.log(` resolved binary: ${resolved ?? "(none — not found)"}`);
32
- if (!resolved) {
33
- console.log(` hint: run \`opensquid engine set-path <path>\` to fix.`);
34
- }
35
- }
36
- async function cmdSetPath(args) {
37
- const target = args[0];
38
- if (!target) {
39
- throw new EngineCliError("usage: opensquid engine set-path <path>", "pass the path to a loop-engine release binary");
40
- }
41
- const res = await setEngineBin(target);
42
- console.log(`[opensquid engine set-path] persisted: ${res.resolved}`);
43
- }
44
- async function cmdForget() {
45
- await forgetEngineBin();
46
- console.log(`[opensquid engine forget] cleared persisted engine_bin`);
47
- }
48
- export async function runEngineCli(cmd, argv) {
49
- switch (cmd) {
50
- case "doctor":
51
- await cmdDoctor();
52
- return;
53
- case "set-path":
54
- await cmdSetPath(argv);
55
- return;
56
- case "forget":
57
- await cmdForget();
58
- return;
59
- }
60
- }