mrplex 0.0.1

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 (319) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +284 -0
  3. package/dist/cli/config.d.ts +28 -0
  4. package/dist/cli/config.js +48 -0
  5. package/dist/cli/config.js.map +1 -0
  6. package/dist/cli/exit-codes.d.ts +13 -0
  7. package/dist/cli/exit-codes.js +39 -0
  8. package/dist/cli/exit-codes.js.map +1 -0
  9. package/dist/cli/format.d.ts +22 -0
  10. package/dist/cli/format.js +148 -0
  11. package/dist/cli/format.js.map +1 -0
  12. package/dist/cli/main.d.ts +16 -0
  13. package/dist/cli/main.js +1518 -0
  14. package/dist/cli/main.js.map +1 -0
  15. package/dist/client/kernel-client.d.ts +97 -0
  16. package/dist/client/kernel-client.js +14 -0
  17. package/dist/client/kernel-client.js.map +1 -0
  18. package/dist/client/local.d.ts +26 -0
  19. package/dist/client/local.js +103 -0
  20. package/dist/client/local.js.map +1 -0
  21. package/dist/client/remote-mcp.d.ts +35 -0
  22. package/dist/client/remote-mcp.js +174 -0
  23. package/dist/client/remote-mcp.js.map +1 -0
  24. package/dist/embed/backfill.d.ts +24 -0
  25. package/dist/embed/backfill.js +33 -0
  26. package/dist/embed/backfill.js.map +1 -0
  27. package/dist/embed/chunker.d.ts +31 -0
  28. package/dist/embed/chunker.js +121 -0
  29. package/dist/embed/chunker.js.map +1 -0
  30. package/dist/embed/cmd-hook.d.ts +21 -0
  31. package/dist/embed/cmd-hook.js +100 -0
  32. package/dist/embed/cmd-hook.js.map +1 -0
  33. package/dist/embed/config.d.ts +61 -0
  34. package/dist/embed/config.js +109 -0
  35. package/dist/embed/config.js.map +1 -0
  36. package/dist/embed/hook.d.ts +38 -0
  37. package/dist/embed/hook.js +56 -0
  38. package/dist/embed/hook.js.map +1 -0
  39. package/dist/embed/http-hook.d.ts +13 -0
  40. package/dist/embed/http-hook.js +39 -0
  41. package/dist/embed/http-hook.js.map +1 -0
  42. package/dist/embed/worker.d.ts +62 -0
  43. package/dist/embed/worker.js +228 -0
  44. package/dist/embed/worker.js.map +1 -0
  45. package/dist/fixtures/hwe/characters/albion-ever.md +12 -0
  46. package/dist/fixtures/hwe/characters/cent.md +11 -0
  47. package/dist/fixtures/hwe/concepts/cent-demiurge-resonance.md +10 -0
  48. package/dist/fixtures/hwe/concepts/phase-looper.md +10 -0
  49. package/dist/fixtures/hwe/entities/demiurge.md +11 -0
  50. package/dist/fixtures/hwe/entities/monad.md +11 -0
  51. package/dist/fixtures/hwe/moc/globocorp-network.md +19 -0
  52. package/dist/fixtures/hwe/organizations/globocorp.md +11 -0
  53. package/dist/fixtures/hwe/readme.md +24 -0
  54. package/dist/fixtures/starship/crew/aria-okonkwo.md +14 -0
  55. package/dist/fixtures/starship/crew/bexley-orr.md +14 -0
  56. package/dist/fixtures/starship/crew/dax-thorne.md +14 -0
  57. package/dist/fixtures/starship/crew/isolde-marsh.md +16 -0
  58. package/dist/fixtures/starship/crew/kestrel-vance.md +15 -0
  59. package/dist/fixtures/starship/crew/quill-vasquez.md +14 -0
  60. package/dist/fixtures/starship/crew/soren-halloway.md +16 -0
  61. package/dist/fixtures/starship/encounters/the-drift-choir.md +14 -0
  62. package/dist/fixtures/starship/encounters/the-hollow-signal.md +16 -0
  63. package/dist/fixtures/starship/encounters/the-wandering-buoy.md +14 -0
  64. package/dist/fixtures/starship/equipment/coolant-loop-b.md +13 -0
  65. package/dist/fixtures/starship/equipment/emergency-ration-bars.md +12 -0
  66. package/dist/fixtures/starship/equipment/long-range-sensors.md +13 -0
  67. package/dist/fixtures/starship/equipment/plasma-manifold-3.md +15 -0
  68. package/dist/fixtures/starship/equipment/shuttle-corvid.md +13 -0
  69. package/dist/fixtures/starship/logs/marsh-4419-1.md +13 -0
  70. package/dist/fixtures/starship/logs/okonkwo-4415-1.md +13 -0
  71. package/dist/fixtures/starship/logs/orr-4413-1.md +13 -0
  72. package/dist/fixtures/starship/logs/orr-4420-1.md +12 -0
  73. package/dist/fixtures/starship/logs/thorne-4413-2.md +13 -0
  74. package/dist/fixtures/starship/logs/vance-4419-2.md +13 -0
  75. package/dist/fixtures/starship/misc/the-galley-ficus.md +11 -0
  76. package/dist/fixtures/starship/missions/the-cinder-run.md +17 -0
  77. package/dist/fixtures/starship/missions/the-drift-choir.md +17 -0
  78. package/dist/fixtures/starship/missions/the-hollow-signal.md +17 -0
  79. package/dist/fixtures/starship/missions/the-silent-beacon.md +17 -0
  80. package/dist/fixtures/starship/moc/crew.md +19 -0
  81. package/dist/fixtures/starship/moc/encounters.md +14 -0
  82. package/dist/fixtures/starship/moc/missions.md +15 -0
  83. package/dist/fixtures/starship/readme.md +60 -0
  84. package/dist/index.d.ts +1 -0
  85. package/dist/index.js +3 -0
  86. package/dist/index.js.map +1 -0
  87. package/dist/kernel/auth/glob.d.ts +46 -0
  88. package/dist/kernel/auth/glob.js +112 -0
  89. package/dist/kernel/auth/glob.js.map +1 -0
  90. package/dist/kernel/auth/scope.d.ts +53 -0
  91. package/dist/kernel/auth/scope.js +83 -0
  92. package/dist/kernel/auth/scope.js.map +1 -0
  93. package/dist/kernel/casefold.d.ts +37 -0
  94. package/dist/kernel/casefold.js +44 -0
  95. package/dist/kernel/casefold.js.map +1 -0
  96. package/dist/kernel/constants.d.ts +21 -0
  97. package/dist/kernel/constants.js +22 -0
  98. package/dist/kernel/constants.js.map +1 -0
  99. package/dist/kernel/context.d.ts +70 -0
  100. package/dist/kernel/context.js +114 -0
  101. package/dist/kernel/context.js.map +1 -0
  102. package/dist/kernel/deletion.d.ts +50 -0
  103. package/dist/kernel/deletion.js +83 -0
  104. package/dist/kernel/deletion.js.map +1 -0
  105. package/dist/kernel/diff.d.ts +36 -0
  106. package/dist/kernel/diff.js +61 -0
  107. package/dist/kernel/diff.js.map +1 -0
  108. package/dist/kernel/errors.d.ts +37 -0
  109. package/dist/kernel/errors.js +55 -0
  110. package/dist/kernel/errors.js.map +1 -0
  111. package/dist/kernel/frontmatter-input.d.ts +32 -0
  112. package/dist/kernel/frontmatter-input.js +85 -0
  113. package/dist/kernel/frontmatter-input.js.map +1 -0
  114. package/dist/kernel/graph.d.ts +34 -0
  115. package/dist/kernel/graph.js +559 -0
  116. package/dist/kernel/graph.js.map +1 -0
  117. package/dist/kernel/history.d.ts +74 -0
  118. package/dist/kernel/history.js +143 -0
  119. package/dist/kernel/history.js.map +1 -0
  120. package/dist/kernel/kernel.d.ts +162 -0
  121. package/dist/kernel/kernel.js +675 -0
  122. package/dist/kernel/kernel.js.map +1 -0
  123. package/dist/kernel/path-config.d.ts +101 -0
  124. package/dist/kernel/path-config.js +171 -0
  125. package/dist/kernel/path-config.js.map +1 -0
  126. package/dist/kernel/query/ast.d.ts +24 -0
  127. package/dist/kernel/query/ast.js +52 -0
  128. package/dist/kernel/query/ast.js.map +1 -0
  129. package/dist/kernel/query/cel-parse.d.ts +37 -0
  130. package/dist/kernel/query/cel-parse.js +88 -0
  131. package/dist/kernel/query/cel-parse.js.map +1 -0
  132. package/dist/kernel/query/degrees.d.ts +31 -0
  133. package/dist/kernel/query/degrees.js +135 -0
  134. package/dist/kernel/query/degrees.js.map +1 -0
  135. package/dist/kernel/query/graph-ast.d.ts +51 -0
  136. package/dist/kernel/query/graph-ast.js +139 -0
  137. package/dist/kernel/query/graph-ast.js.map +1 -0
  138. package/dist/kernel/query/query.d.ts +56 -0
  139. package/dist/kernel/query/query.js +276 -0
  140. package/dist/kernel/query/query.js.map +1 -0
  141. package/dist/kernel/validation.d.ts +64 -0
  142. package/dist/kernel/validation.js +183 -0
  143. package/dist/kernel/validation.js.map +1 -0
  144. package/dist/kernel/version-id.d.ts +10 -0
  145. package/dist/kernel/version-id.js +21 -0
  146. package/dist/kernel/version-id.js.map +1 -0
  147. package/dist/kernel/wire.d.ts +148 -0
  148. package/dist/kernel/wire.js +6 -0
  149. package/dist/kernel/wire.js.map +1 -0
  150. package/dist/links/backfill.d.ts +28 -0
  151. package/dist/links/backfill.js +33 -0
  152. package/dist/links/backfill.js.map +1 -0
  153. package/dist/links/extract.d.ts +29 -0
  154. package/dist/links/extract.js +233 -0
  155. package/dist/links/extract.js.map +1 -0
  156. package/dist/links/link-config.d.ts +70 -0
  157. package/dist/links/link-config.js +107 -0
  158. package/dist/links/link-config.js.map +1 -0
  159. package/dist/links/maintain.d.ts +37 -0
  160. package/dist/links/maintain.js +91 -0
  161. package/dist/links/maintain.js.map +1 -0
  162. package/dist/links/repair.d.ts +46 -0
  163. package/dist/links/repair.js +96 -0
  164. package/dist/links/repair.js.map +1 -0
  165. package/dist/links/resolve.d.ts +41 -0
  166. package/dist/links/resolve.js +121 -0
  167. package/dist/links/resolve.js.map +1 -0
  168. package/dist/links/stale.d.ts +32 -0
  169. package/dist/links/stale.js +73 -0
  170. package/dist/links/stale.js.map +1 -0
  171. package/dist/markdown/content-hash.d.ts +34 -0
  172. package/dist/markdown/content-hash.js +46 -0
  173. package/dist/markdown/content-hash.js.map +1 -0
  174. package/dist/markdown/frontmatter.d.ts +69 -0
  175. package/dist/markdown/frontmatter.js +147 -0
  176. package/dist/markdown/frontmatter.js.map +1 -0
  177. package/dist/markdown/hash-backfill.d.ts +22 -0
  178. package/dist/markdown/hash-backfill.js +43 -0
  179. package/dist/markdown/hash-backfill.js.map +1 -0
  180. package/dist/mcp/query-syntax.d.ts +20 -0
  181. package/dist/mcp/query-syntax.js +194 -0
  182. package/dist/mcp/query-syntax.js.map +1 -0
  183. package/dist/mcp/render.d.ts +31 -0
  184. package/dist/mcp/render.js +110 -0
  185. package/dist/mcp/render.js.map +1 -0
  186. package/dist/mcp/server.d.ts +60 -0
  187. package/dist/mcp/server.js +170 -0
  188. package/dist/mcp/server.js.map +1 -0
  189. package/dist/mcp/tools.d.ts +93 -0
  190. package/dist/mcp/tools.js +1218 -0
  191. package/dist/mcp/tools.js.map +1 -0
  192. package/dist/rest/conditional.d.ts +37 -0
  193. package/dist/rest/conditional.js +58 -0
  194. package/dist/rest/conditional.js.map +1 -0
  195. package/dist/rest/negotiate.d.ts +33 -0
  196. package/dist/rest/negotiate.js +54 -0
  197. package/dist/rest/negotiate.js.map +1 -0
  198. package/dist/rest/routes.d.ts +37 -0
  199. package/dist/rest/routes.js +744 -0
  200. package/dist/rest/routes.js.map +1 -0
  201. package/dist/seed/fixture-seed.d.ts +35 -0
  202. package/dist/seed/fixture-seed.js +75 -0
  203. package/dist/seed/fixture-seed.js.map +1 -0
  204. package/dist/seed/starship-config.d.ts +3 -0
  205. package/dist/seed/starship-config.js +5 -0
  206. package/dist/seed/starship-config.js.map +1 -0
  207. package/dist/server/headers.d.ts +36 -0
  208. package/dist/server/headers.js +30 -0
  209. package/dist/server/headers.js.map +1 -0
  210. package/dist/server/http-error.d.ts +53 -0
  211. package/dist/server/http-error.js +104 -0
  212. package/dist/server/http-error.js.map +1 -0
  213. package/dist/server/serve.d.ts +56 -0
  214. package/dist/server/serve.js +135 -0
  215. package/dist/server/serve.js.map +1 -0
  216. package/dist/shell/audit.d.ts +32 -0
  217. package/dist/shell/audit.js +28 -0
  218. package/dist/shell/audit.js.map +1 -0
  219. package/dist/shell/guard.d.ts +50 -0
  220. package/dist/shell/guard.js +176 -0
  221. package/dist/shell/guard.js.map +1 -0
  222. package/dist/shell/keys.d.ts +36 -0
  223. package/dist/shell/keys.js +64 -0
  224. package/dist/shell/keys.js.map +1 -0
  225. package/dist/shell/login.d.ts +56 -0
  226. package/dist/shell/login.js +130 -0
  227. package/dist/shell/login.js.map +1 -0
  228. package/dist/shell/oidc.d.ts +62 -0
  229. package/dist/shell/oidc.js +102 -0
  230. package/dist/shell/oidc.js.map +1 -0
  231. package/dist/shell/policy.d.ts +100 -0
  232. package/dist/shell/policy.js +232 -0
  233. package/dist/shell/policy.js.map +1 -0
  234. package/dist/shell/proxy-policy.d.ts +34 -0
  235. package/dist/shell/proxy-policy.js +120 -0
  236. package/dist/shell/proxy-policy.js.map +1 -0
  237. package/dist/shell/proxy.d.ts +47 -0
  238. package/dist/shell/proxy.js +253 -0
  239. package/dist/shell/proxy.js.map +1 -0
  240. package/dist/shell/serve.d.ts +86 -0
  241. package/dist/shell/serve.js +0 -0
  242. package/dist/shell/serve.js.map +1 -0
  243. package/dist/shell/stdio.d.ts +55 -0
  244. package/dist/shell/stdio.js +63 -0
  245. package/dist/shell/stdio.js.map +1 -0
  246. package/dist/storage/registry.d.ts +20 -0
  247. package/dist/storage/registry.js +38 -0
  248. package/dist/storage/registry.js.map +1 -0
  249. package/dist/storage/search-plan.d.ts +93 -0
  250. package/dist/storage/search-plan.js +15 -0
  251. package/dist/storage/search-plan.js.map +1 -0
  252. package/dist/storage/types.d.ts +448 -0
  253. package/dist/storage/types.js +14 -0
  254. package/dist/storage/types.js.map +1 -0
  255. package/dist/storage/versions-since.d.ts +72 -0
  256. package/dist/storage/versions-since.js +92 -0
  257. package/dist/storage/versions-since.js.map +1 -0
  258. package/dist/storage-postgres/adapter.d.ts +17 -0
  259. package/dist/storage-postgres/adapter.js +782 -0
  260. package/dist/storage-postgres/adapter.js.map +1 -0
  261. package/dist/storage-postgres/compile-postgres.d.ts +22 -0
  262. package/dist/storage-postgres/compile-postgres.js +830 -0
  263. package/dist/storage-postgres/compile-postgres.js.map +1 -0
  264. package/dist/storage-postgres/errors.d.ts +34 -0
  265. package/dist/storage-postgres/errors.js +50 -0
  266. package/dist/storage-postgres/errors.js.map +1 -0
  267. package/dist/storage-postgres/migrations/0001_init.sql +113 -0
  268. package/dist/storage-postgres/migrations/0002_content_hash.sql +7 -0
  269. package/dist/storage-postgres/migrations/index.d.ts +22 -0
  270. package/dist/storage-postgres/migrations/index.js +70 -0
  271. package/dist/storage-postgres/migrations/index.js.map +1 -0
  272. package/dist/storage-sqlite/adapter.d.ts +2 -0
  273. package/dist/storage-sqlite/adapter.js +688 -0
  274. package/dist/storage-sqlite/adapter.js.map +1 -0
  275. package/dist/storage-sqlite/compile-filter.d.ts +41 -0
  276. package/dist/storage-sqlite/compile-filter.js +881 -0
  277. package/dist/storage-sqlite/compile-filter.js.map +1 -0
  278. package/dist/storage-sqlite/compile-sqlite.d.ts +19 -0
  279. package/dist/storage-sqlite/compile-sqlite.js +176 -0
  280. package/dist/storage-sqlite/compile-sqlite.js.map +1 -0
  281. package/dist/storage-sqlite/migrations/0001_init.sql +123 -0
  282. package/dist/storage-sqlite/migrations/0002_content_hash.sql +7 -0
  283. package/dist/storage-sqlite/migrations/index.d.ts +6 -0
  284. package/dist/storage-sqlite/migrations/index.js +41 -0
  285. package/dist/storage-sqlite/migrations/index.js.map +1 -0
  286. package/dist/storage-sqlite/vec.d.ts +40 -0
  287. package/dist/storage-sqlite/vec.js +62 -0
  288. package/dist/storage-sqlite/vec.js.map +1 -0
  289. package/dist/sync/cursor.d.ts +36 -0
  290. package/dist/sync/cursor.js +66 -0
  291. package/dist/sync/cursor.js.map +1 -0
  292. package/dist/sync/daemon.d.ts +40 -0
  293. package/dist/sync/daemon.js +202 -0
  294. package/dist/sync/daemon.js.map +1 -0
  295. package/dist/sync/feed.d.ts +38 -0
  296. package/dist/sync/feed.js +125 -0
  297. package/dist/sync/feed.js.map +1 -0
  298. package/dist/sync/fs-store.d.ts +8 -0
  299. package/dist/sync/fs-store.js +76 -0
  300. package/dist/sync/fs-store.js.map +1 -0
  301. package/dist/sync/intrinsics.d.ts +52 -0
  302. package/dist/sync/intrinsics.js +76 -0
  303. package/dist/sync/intrinsics.js.map +1 -0
  304. package/dist/sync/paths.d.ts +38 -0
  305. package/dist/sync/paths.js +56 -0
  306. package/dist/sync/paths.js.map +1 -0
  307. package/dist/sync/push.d.ts +48 -0
  308. package/dist/sync/push.js +328 -0
  309. package/dist/sync/push.js.map +1 -0
  310. package/dist/sync/reconcile.d.ts +54 -0
  311. package/dist/sync/reconcile.js +252 -0
  312. package/dist/sync/reconcile.js.map +1 -0
  313. package/dist/sync/run.d.ts +27 -0
  314. package/dist/sync/run.js +46 -0
  315. package/dist/sync/run.js.map +1 -0
  316. package/dist/version.d.ts +2 -0
  317. package/dist/version.js +5 -0
  318. package/dist/version.js.map +1 -0
  319. package/package.json +80 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: Number Three Plasma Manifold
3
+ type: equipment
4
+ status: damaged
5
+ deck: 7
6
+ maintainer: /crew/bexley-orr.md
7
+ related:
8
+ - /equipment/coolant-loop-b.md
9
+ ---
10
+
11
+ # Number Three Plasma Manifold
12
+
13
+ The Meridian's chronic invalid. Manifold three has been rebuilt twice and derated once; it carries the ship's aft power distribution and it does not like to. Under sustained load it runs hot enough that the [[equipment/coolant-loop-b|B coolant loop]] can no longer keep pace, which is what ended the [[missions/the-cinder-run|Cinder Run]].
14
+
15
+ Thorne has flagged it unfit for combat maneuvering. Orr keeps it alive shift by shift and swears it makes a sound, just below hearing, when it is about to misbehave.
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: Shuttle Corvid
3
+ type: equipment
4
+ status: offline
5
+ deck: 5
6
+ maintainer: /crew/dax-thorne.md
7
+ ---
8
+
9
+ # Shuttle Corvid
10
+
11
+ One of two shuttles aboard, currently offline pending a part that is three supply runs overdue. The Corvid carried the boarding team out to the derelict during the [[encounters/the-hollow-signal|Hollow Signal]] and came back with one empty seat, which the crew have not forgotten.
12
+
13
+ There is a quiet, unofficial reluctance to fly it again. Thorne insists the reluctance is about the missing part and nothing else, and no one argues with him out loud.
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: Science Log — Marsh, 4419.1
3
+ type: log
4
+ stardate: 4419.1
5
+ author: /crew/isolde-marsh.md
6
+ mission: /missions/the-drift-choir.md
7
+ ---
8
+
9
+ # Science Log — Marsh, 4419.1
10
+
11
+ Day forty of listening to the [[encounters/the-drift-choir|Choir]] and I am more certain than ever: this is language, not weather. The tones resolve into recurring structures — call them phrases — that answer one another across the nebula with a latency that tracks distance exactly. Something is talking to itself, and it is very large, and it is not in a hurry.
12
+
13
+ I have started singing back. Simple intervals, held long. This morning the Choir held the same interval back to me for nine full seconds before letting it drift. Doctor [[crew/quill-vasquez|Vasquez]] wants me to rest; I told them I would rest when the conversation pauses. It has not paused in forty days.
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: Command Log — Okonkwo, 4415.1
3
+ type: log
4
+ stardate: 4415.1
5
+ author: /crew/aria-okonkwo.md
6
+ mission: /missions/the-hollow-signal.md
7
+ ---
8
+
9
+ # Command Log — Okonkwo, 4415.1
10
+
11
+ The boarding team is back. Halloway is not. I am writing this while the count is still fresh because I do not trust my memory of it to stay honest.
12
+
13
+ Everything on the derelict was working. Everything except the crew, who were simply gone — no bodies, no signs of struggle, no breach. [[crew/soren-halloway|Halloway]] reported a sealed compartment on the lower deck, said he was going to open it, and then said nothing at all. We searched for six hours. The [[encounters/the-hollow-signal|signal]] cut out the instant we broke orbit, as if it had gotten what it came for. I have opened an inquiry. I do not expect it to close.
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: Engineering Log — Orr, 4413.1
3
+ type: log
4
+ stardate: 4413.1
5
+ author: /crew/bexley-orr.md
6
+ mission: /missions/the-cinder-run.md
7
+ ---
8
+
9
+ # Engineering Log — Orr, 4413.1
10
+
11
+ Third pass through the debris field and the [[equipment/plasma-manifold-3|manifold]] is screaming. Not literally — but the harmonic is back, the one just under hearing that I keep trying to get someone to believe in. Coolant temps on [[equipment/coolant-loop-b|Loop B]] climbed past redline on the second trip and never fully came down before we went in again.
12
+
13
+ Commander [[crew/aria-okonkwo|Okonkwo]] wanted a fourth run. Chief [[crew/dax-thorne|Thorne]] said no with a word I will not enter into the log. We pulled out. I keep thinking about the nine we did not reach. I have never seen the chief so quiet.
@@ -0,0 +1,12 @@
1
+ ---
2
+ title: Engineering Log — Orr, 4420.1
3
+ type: log
4
+ stardate: 4420.1
5
+ author: /crew/bexley-orr.md
6
+ ---
7
+
8
+ # Engineering Log — Orr, 4420.1
9
+
10
+ Quiet shift. The [[equipment/plasma-manifold-3|manifold]] behaved, which always makes me more nervous than when it doesn't. I ran the full diagnostic twice and both times it came back clean, and I do not believe it.
11
+
12
+ I have started keeping a private tally of the sound — the sub-audible harmonic — against the load curve. If I am right, it leads the temperature spike by about ninety seconds. Ninety seconds is enough to shed load before Loop B ever notices. Nobody has asked me to do this. I am doing it anyway. If I am wrong it is a hobby; if I am right it is a warning system.
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: Engineering Log — Thorne, 4413.2
3
+ type: log
4
+ stardate: 4413.2
5
+ author: /crew/dax-thorne.md
6
+ mission: /missions/the-cinder-run.md
7
+ ---
8
+
9
+ # Engineering Log — Thorne, 4413.2
10
+
11
+ For the record, since the record will be read: I aborted the fourth run on the Cinder Run over the first officer's stated objection. The [[equipment/plasma-manifold-3|number three manifold]] was past the point where I would trust it to hold formation, let alone thread a collapsing nursery a fourth time.
12
+
13
+ I am formally requesting the manifold be listed unfit for combat maneuvering until it is replaced, not rebuilt. I have made this request before. I am making it again. [[crew/bexley-orr|Orr]] logged the coolant numbers; they are not opinions. If command wants a ship that can do this work, command can find me a manifold that is not held together by my own stubbornness and a prayer.
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: Captain's Log — Vance, 4419.2
3
+ type: log
4
+ stardate: 4419.2
5
+ author: /crew/kestrel-vance.md
6
+ mission: /missions/the-drift-choir.md
7
+ ---
8
+
9
+ # Captain's Log — Vance, 4419.2
10
+
11
+ [[crew/isolde-marsh|Marsh]] sang to the Choir today and it sang back. I watched her face when it held the note. Whatever we are doing out here, that was the reason for all of it — the surveys, the derelicts, the long empty months. One held interval, nine seconds, from a mind the size of a nebula.
12
+
13
+ [[crew/aria-okonkwo|Okonkwo]] has, correctly, filed her concerns: we do not know what the Choir wants, what prolonged contact does to the crew, or how to leave gracefully if we must. She is right, as she usually is. I have logged her objection and overruled it, as I usually do. We stay. Curiosity outranks fear until fear can prove its case, and it has not proven its case yet.
@@ -0,0 +1,11 @@
1
+ ---
2
+ title: The Galley Ficus
3
+ type: note
4
+ status: active
5
+ ---
6
+
7
+ # The Galley Ficus
8
+
9
+ There is a ficus in the galley. No one remembers bringing it aboard, and no manifest lists it. It has survived two refits, one hull breach on the far side of the ship, and the collective neglect of a hundred and twenty people who assume someone else is watering it.
10
+
11
+ The crew have adopted it as a mascot and a superstition: as long as the ficus lives, the Meridian comes home. So far, the ficus has been right. It links to nothing and nothing depends on it, which is exactly why the crew love it.
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Mission — The Cinder Run
3
+ type: mission
4
+ status: aborted
5
+ stardate: 4413.4
6
+ classification: rescue
7
+ commander: /crew/aria-okonkwo.md
8
+ crew:
9
+ - /crew/dax-thorne.md
10
+ - /crew/bexley-orr.md
11
+ ---
12
+
13
+ # The Cinder Run
14
+
15
+ A mining outpost in a collapsing stellar nursery called for evacuation. The Meridian ran three trips through the debris field before the [[equipment/plasma-manifold-3|number three manifold]] overheated badly enough that Thorne pulled the ship out over Okonkwo's objection.
16
+
17
+ Forty-one colonists were recovered; nine were not. Okonkwo filed the mission as aborted and requested the manifold be listed unfit for combat maneuvering. The request is still pending. The [[logs/orr-4413-1|shift log]] from that run is required reading for new engineering crew.
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Mission — Answering the Drift Choir
3
+ type: mission
4
+ status: active
5
+ stardate: 4419.0
6
+ classification: contact
7
+ commander: /crew/kestrel-vance.md
8
+ crew:
9
+ - /crew/isolde-marsh.md
10
+ - /crew/quill-vasquez.md
11
+ ---
12
+
13
+ # Answering the Drift Choir
14
+
15
+ An ongoing first-contact effort with a distributed intelligence that communicates in overlapping tones across a whole nebula — the [[encounters/the-drift-choir|Drift Choir]]. Marsh leads the translation work; Vasquez monitors the crew for the disorientation that prolonged exposure to the Choir's song seems to cause.
16
+
17
+ The mission has no defined end state, which unsettles the crew more than any weapon could. Vance considers it the most important thing the Meridian has ever attempted.
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Mission — The Hollow Signal
3
+ type: mission
4
+ status: completed
5
+ stardate: 4415.7
6
+ classification: contact
7
+ commander: /crew/aria-okonkwo.md
8
+ crew:
9
+ - /crew/soren-halloway.md
10
+ - /crew/quill-vasquez.md
11
+ ---
12
+
13
+ # The Hollow Signal
14
+
15
+ A repeating transmission led the Meridian to a derelict vessel adrift far from any charted lane. Okonkwo commanded from the bridge while [[crew/soren-halloway|Halloway]] took a boarding team across. The derelict was intact, powered, and empty — a ship that had been abandoned mid-sentence.
16
+
17
+ The team recovered logs but no crew. Halloway did not return. The mission is filed as completed because the ship came home; the [[encounters/the-hollow-signal|encounter record]] and the standing inquiry disagree with that word.
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Mission — The Silent Beacon
3
+ type: mission
4
+ status: completed
5
+ stardate: 4411.2
6
+ classification: survey
7
+ commander: /crew/kestrel-vance.md
8
+ crew:
9
+ - /crew/isolde-marsh.md
10
+ - /crew/dax-thorne.md
11
+ ---
12
+
13
+ # The Silent Beacon
14
+
15
+ A survey buoy of unknown make was broadcasting a distress pattern into empty space, on a frequency abandoned two centuries ago. The Meridian was diverted to investigate. There was no ship, no colony, no sender — only the beacon, patiently calling for help that could no longer be meaningful.
16
+
17
+ Marsh eventually decoded the pattern as a star map, not a distress call. The map pointed at a system that no longer exists. Vance logged the mission as completed and the beacon as a grave marker. See the [[encounters/the-wandering-buoy|wandering buoy]] for the object itself.
@@ -0,0 +1,19 @@
1
+ ---
2
+ title: MOC — Crew Roster
3
+ type: moc
4
+ ---
5
+
6
+ # Crew Roster
7
+
8
+ The officers of the USS Meridian.
9
+
10
+ ## Command
11
+ - [[crew/kestrel-vance]]
12
+ - [[crew/aria-okonkwo]]
13
+
14
+ ## Departments
15
+ - [[crew/dax-thorne]] — engineering
16
+ - [[crew/isolde-marsh]] — science
17
+ - [[crew/quill-vasquez]] — medical
18
+ - [[crew/soren-halloway]] — security
19
+ - [[crew/bexley-orr]] — engineering
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: MOC — Encounter Catalog
3
+ type: moc
4
+ ---
5
+
6
+ # Encounter Catalog
7
+
8
+ The things the Meridian has met, sorted by how much sleep they cost the crew.
9
+
10
+ - [[encounters/the-wandering-buoy]] — artifact, harmless
11
+ - [[encounters/the-drift-choir]] — intelligence, unknown
12
+ - [[encounters/the-hollow-signal]] — derelict, high threat
13
+
14
+ Each encounter traces back to a mission in the [[moc/missions|mission log]].
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: MOC — Mission Log
3
+ type: moc
4
+ ---
5
+
6
+ # Mission Log
7
+
8
+ Every mission the USS Meridian has undertaken, in the order it was filed.
9
+
10
+ - [[missions/the-silent-beacon]] — survey, completed
11
+ - [[missions/the-cinder-run]] — rescue, aborted
12
+ - [[missions/the-hollow-signal]] — contact, completed
13
+ - [[missions/the-drift-choir]] — contact, active
14
+
15
+ See also the [[moc/encounters]] these missions produced.
@@ -0,0 +1,60 @@
1
+ # USS Meridian — Ship's Knowledge Base
2
+
3
+ A sample mrplex repository: the operational notes, crew files, mission records, encounter logs, and equipment status of a fictional survey starship. Every entry is deliberately short — one idea, one to three paragraphs, zettelkasten-style — so the repo reads as a connected graph rather than a handful of long documents.
4
+
5
+ Load it into a fresh database with:
6
+
7
+ ```bash
8
+ mrplex demo seed
9
+ export MRPLEX_REPO=demo
10
+ ```
11
+
12
+ It exists to exercise mrplex end to end: links, backlinks, frontmatter reference-fields, graph queries, filters, and full-text search all have something real to bite on here.
13
+
14
+ ## Layout
15
+
16
+ - `crew/` — officer files. Frontmatter `reports_to` builds the chain of command; heavily backlinked from logs and missions (the graph's hubs).
17
+ - `missions/` — mission records. Frontmatter `commander` and `crew` link to the officers involved.
18
+ - `encounters/` — what the missions found. Linked from missions and logs via `mission`.
19
+ - `equipment/` — ship systems, each with a `status` (operational / damaged / offline) and a `maintainer`.
20
+ - `logs/` — officer logs. Prose-heavy, so they drive full-text search and produce most of the backlinks.
21
+ - `moc/` — maps of content: hand-curated wikilink indexes that make membership queries meaningful.
22
+ - `misc/` — a home for the deliberately-unconnected (see the ficus).
23
+
24
+ ## Link configuration
25
+
26
+ This repo opts the following frontmatter fields into the link graph:
27
+
28
+ ```json
29
+ { "fields": ["reports_to", "commander", "crew", "author", "mission", "maintainer", "related"] }
30
+ ```
31
+
32
+ Body links use wikilinks (`[[crew/kestrel-vance]]`) and inline links; frontmatter fields use repo-absolute paths (`/crew/kestrel-vance.md`).
33
+
34
+ ## Example queries
35
+
36
+ ```bash
37
+ # Who reports directly to the captain?
38
+ mrplex -r starship query --filter '$in_static("crew/kestrel-vance.md", "reports_to")'
39
+
40
+ # Which officer does the whole ship reference? (the hubs)
41
+ mrplex -r starship query --filter '$backlinks_static().size() >= 4'
42
+
43
+ # What's broken right now?
44
+ mrplex -r starship query --filter 'status == "damaged" || status == "offline"'
45
+
46
+ # Which missions did Okonkwo command?
47
+ mrplex -r starship query --filter '$has_static("crew/aria-okonkwo.md", "commander")'
48
+
49
+ # Every mission indexed by the mission MOC
50
+ mrplex -r starship query --filter '$in_static("moc/missions.md")'
51
+
52
+ # Leaf notes that link to nothing
53
+ mrplex -r starship query --filter '$links_static().size() == 0'
54
+
55
+ # Orphans nobody references
56
+ mrplex -r starship query --filter '!$in_static("**")'
57
+
58
+ # Full-text across the logs
59
+ mrplex -r starship query --text 'manifold coolant'
60
+ ```
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ // mrplex root — see docs/design.md
2
+ export {};
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Gitignore-style glob matching (design §8.2).
3
+ *
4
+ * Semantics — faithful to git's gitignore(5):
5
+ * `**` matches any sequence of characters (including `/`)
6
+ * `**\/` zero or more path segments (including none)
7
+ * `/**` (end) everything strictly inside the preceding directory
8
+ * `*` matches within a path segment (no `/`)
9
+ * `?` matches a single character (no `/`)
10
+ * leading `/` anchors the pattern to the root; the `/` is not part
11
+ * of the matched string
12
+ * no `/` in pattern is a basename — matches at any depth
13
+ * pattern
14
+ * `!glob` negates — handled at the LIST level, not the individual glob
15
+ * literals everything else, including `.`, is a literal char
16
+ *
17
+ * Kept small on purpose: no `[abc]` character classes.
18
+ */
19
+ /**
20
+ * Compile a single glob (WITHOUT leading `!`) to a regex source string.
21
+ * Returns the raw pattern (no leading/trailing anchor); wrap in `^...$`
22
+ * for full-string matching. Kept separate from compileGlob so callers
23
+ * that need the source (e.g. to hand to a SQL regexp() UDF) don't have
24
+ * to re-derive it from RegExp.source.
25
+ */
26
+ export declare function globToRegexSource(glob: string): string;
27
+ /**
28
+ * Compile a single glob (WITHOUT leading `!`) to an anchored RegExp.
29
+ * Callers strip `!` before calling and track the negation flag themselves.
30
+ */
31
+ export declare function compileGlob(glob: string): RegExp;
32
+ /**
33
+ * Does `path` match any of `globs`, honoring gitignore's "last-match-wins"
34
+ * negation semantics? Returns true iff the last matching pattern is a
35
+ * positive one; false if no pattern matches or the last match was negated.
36
+ *
37
+ * An empty `globs` array yields false (no capability).
38
+ */
39
+ export declare function pathMatchesGlobs(globs: readonly string[], path: string): boolean;
40
+ /**
41
+ * Repo-slug pattern matching (§8.2 — "Since slugs contain no `/`, `*` is the
42
+ * canonical wildcard at the repo level"). Uses the same compileGlob so the
43
+ * `*`/`?` semantics stay consistent, but slug patterns don't need `**` or
44
+ * negation.
45
+ */
46
+ export declare function slugMatchesPattern(pattern: string, slug: string): boolean;
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Gitignore-style glob matching (design §8.2).
3
+ *
4
+ * Semantics — faithful to git's gitignore(5):
5
+ * `**` matches any sequence of characters (including `/`)
6
+ * `**\/` zero or more path segments (including none)
7
+ * `/**` (end) everything strictly inside the preceding directory
8
+ * `*` matches within a path segment (no `/`)
9
+ * `?` matches a single character (no `/`)
10
+ * leading `/` anchors the pattern to the root; the `/` is not part
11
+ * of the matched string
12
+ * no `/` in pattern is a basename — matches at any depth
13
+ * pattern
14
+ * `!glob` negates — handled at the LIST level, not the individual glob
15
+ * literals everything else, including `.`, is a literal char
16
+ *
17
+ * Kept small on purpose: no `[abc]` character classes.
18
+ */
19
+ /**
20
+ * Compile a single glob (WITHOUT leading `!`) to a regex source string.
21
+ * Returns the raw pattern (no leading/trailing anchor); wrap in `^...$`
22
+ * for full-string matching. Kept separate from compileGlob so callers
23
+ * that need the source (e.g. to hand to a SQL regexp() UDF) don't have
24
+ * to re-derive it from RegExp.source.
25
+ */
26
+ export function globToRegexSource(glob) {
27
+ const hasLeadingSlash = glob.startsWith("/");
28
+ const rest = hasLeadingSlash ? glob.slice(1) : glob;
29
+ const isBareBasename = !rest.includes("/");
30
+ // Bare `**` already expands to `.*`, which subsumes `(?:.*/)?` — skip the
31
+ // redundant prefix rather than emitting dead regex text.
32
+ const anyDepthPrefix = isBareBasename && !hasLeadingSlash && rest !== "**" ? "(?:.*/)?" : "";
33
+ let source = "";
34
+ let i = 0;
35
+ while (i < rest.length) {
36
+ // `**/` — zero or more path segments (including none)
37
+ if (rest.slice(i, i + 3) === "**/") {
38
+ source += "(?:.*/)?";
39
+ i += 3;
40
+ continue;
41
+ }
42
+ // Trailing `/**` — everything strictly inside the preceding dir
43
+ if (rest.slice(i, i + 3) === "/**" && i + 3 === rest.length) {
44
+ source += "/.*";
45
+ i += 3;
46
+ continue;
47
+ }
48
+ // Bare `**` — any run of characters, including `/`
49
+ if (rest[i] === "*" && rest[i + 1] === "*") {
50
+ source += ".*";
51
+ i += 2;
52
+ continue;
53
+ }
54
+ // `*` — within a segment
55
+ if (rest[i] === "*") {
56
+ source += "[^/]*";
57
+ i += 1;
58
+ continue;
59
+ }
60
+ // `?` — single char, not `/`
61
+ if (rest[i] === "?") {
62
+ source += "[^/]";
63
+ i += 1;
64
+ continue;
65
+ }
66
+ const ch = rest[i];
67
+ // Escape regex specials — critically `.`, which is a literal in globs.
68
+ if ("[](){}+^$.|\\".includes(ch)) {
69
+ source += `\\${ch}`;
70
+ i += 1;
71
+ continue;
72
+ }
73
+ source += ch;
74
+ i += 1;
75
+ }
76
+ return anyDepthPrefix + source;
77
+ }
78
+ /**
79
+ * Compile a single glob (WITHOUT leading `!`) to an anchored RegExp.
80
+ * Callers strip `!` before calling and track the negation flag themselves.
81
+ */
82
+ export function compileGlob(glob) {
83
+ return new RegExp(`^${globToRegexSource(glob)}$`);
84
+ }
85
+ /**
86
+ * Does `path` match any of `globs`, honoring gitignore's "last-match-wins"
87
+ * negation semantics? Returns true iff the last matching pattern is a
88
+ * positive one; false if no pattern matches or the last match was negated.
89
+ *
90
+ * An empty `globs` array yields false (no capability).
91
+ */
92
+ export function pathMatchesGlobs(globs, path) {
93
+ let allowed = false;
94
+ for (const g of globs) {
95
+ const negated = g.startsWith("!");
96
+ const pat = negated ? g.slice(1) : g;
97
+ if (compileGlob(pat).test(path)) {
98
+ allowed = !negated;
99
+ }
100
+ }
101
+ return allowed;
102
+ }
103
+ /**
104
+ * Repo-slug pattern matching (§8.2 — "Since slugs contain no `/`, `*` is the
105
+ * canonical wildcard at the repo level"). Uses the same compileGlob so the
106
+ * `*`/`?` semantics stay consistent, but slug patterns don't need `**` or
107
+ * negation.
108
+ */
109
+ export function slugMatchesPattern(pattern, slug) {
110
+ return compileGlob(pattern).test(slug);
111
+ }
112
+ //# sourceMappingURL=glob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.js","sourceRoot":"","sources":["../../../src/kernel/auth/glob.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACpD,MAAM,cAAc,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC3C,0EAA0E;IAC1E,yDAAyD;IACzD,MAAM,cAA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CAAW,CAAC;QAC7B,uEAAuE;QACvE,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,EAAE,EAAE,CAAC;YACpB,CAAC,IAAI,CAAC,CAAC;YACP,SAAS;QACX,CAAC;QACD,MAAM,IAAI,EAAE,CAAC;QACb,CAAC,IAAI,CAAC,CAAC;IACT,CAAC;IACD,OAAO,cAAc,GAAG,MAAM,CAAC;AACjC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,IAAI,MAAM,CAAC,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAwB,EAAE,IAAY;IACrE,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,MAAM,OAAO,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAClC,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACrC,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAChC,OAAO,GAAG,CAAC,OAAO,CAAC;QACrB,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe,EAAE,IAAY;IAC9D,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Read-scope claim evaluation — design §8.2, noauth plan §1.
3
+ *
4
+ * A `CallContext.scope` (ScopeClaim[]) narrows a call's visibility. Claims
5
+ * name repos by slug pattern and paths by gitignore-style globs, and are
6
+ * evaluated against the repos existing at call time — there is no issuance
7
+ * snapshot and no repo-id binding (noauth plan decision 4). A claim names what
8
+ * it names right now.
9
+ *
10
+ * This module owns:
11
+ * • claim normalization (`ScopeClaim` → `ClaimMatcher[]`)
12
+ * • the runtime grant checks (`claimsGrantRead`, `claimsGrantRepo`)
13
+ * • compilation to `SearchPlan` scope groups (`claimsToScopeGroups`) — the
14
+ * seam into the adapter's silent search filtering, unchanged from tokens;
15
+ * only the provenance of the globs changed (per-call input, not a row).
16
+ *
17
+ * The old token machinery (id resolution, subset assertions, the child-token
18
+ * subset check) is gone: a caller who can supply a claim can supply a wider
19
+ * one, so narrowing across trust levels is the shell's concern, not ours.
20
+ */
21
+ import type { ScopeGroup } from "../../storage/search-plan.js";
22
+ import type { RepoRow } from "../../storage/types.js";
23
+ import type { ScopeClaim } from "../context.js";
24
+ /**
25
+ * Normalized claim: repo patterns split from the `"*"` fast-path, plus the
26
+ * path globs. `hasWildcard` distinguishes the dynamic all-repos claim (covers
27
+ * repos created after the call is issued) for scope-group compilation.
28
+ */
29
+ export type ClaimMatcher = {
30
+ repoPatterns: string[];
31
+ hasWildcard: boolean;
32
+ paths: string[];
33
+ };
34
+ export declare function normalizeClaims(claims: readonly ScopeClaim[]): ClaimMatcher[];
35
+ /**
36
+ * Does any claim grant read on `path` in the repo named `repoSlug`? Follows
37
+ * gitignore's per-glob-list "last match wins" (see glob.ts), OR'd across
38
+ * claims (union semantics, §8.2).
39
+ */
40
+ export declare function claimsGrantRead(matchers: readonly ClaimMatcher[], repoSlug: string, path: string): boolean;
41
+ /**
42
+ * Does any claim bind `repoSlug` at all (regardless of path)? Coarse
43
+ * addressability — used by `repos.list` and query repo resolution to filter
44
+ * to claimed repos (§8.2).
45
+ */
46
+ export declare function claimsGrantRepo(matchers: readonly ClaimMatcher[], repoSlug: string): boolean;
47
+ /**
48
+ * Compile claims into `SearchPlan` scope groups against the current repo set.
49
+ * A wildcard claim maps to the dynamic `"*"` group; a concrete claim resolves
50
+ * its repo patterns to the matching current repo ids. Claims with no path
51
+ * globs contribute nothing (they grant no path).
52
+ */
53
+ export declare function claimsToScopeGroups(matchers: readonly ClaimMatcher[], repos: readonly RepoRow[]): ScopeGroup[];
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Read-scope claim evaluation — design §8.2, noauth plan §1.
3
+ *
4
+ * A `CallContext.scope` (ScopeClaim[]) narrows a call's visibility. Claims
5
+ * name repos by slug pattern and paths by gitignore-style globs, and are
6
+ * evaluated against the repos existing at call time — there is no issuance
7
+ * snapshot and no repo-id binding (noauth plan decision 4). A claim names what
8
+ * it names right now.
9
+ *
10
+ * This module owns:
11
+ * • claim normalization (`ScopeClaim` → `ClaimMatcher[]`)
12
+ * • the runtime grant checks (`claimsGrantRead`, `claimsGrantRepo`)
13
+ * • compilation to `SearchPlan` scope groups (`claimsToScopeGroups`) — the
14
+ * seam into the adapter's silent search filtering, unchanged from tokens;
15
+ * only the provenance of the globs changed (per-call input, not a row).
16
+ *
17
+ * The old token machinery (id resolution, subset assertions, the child-token
18
+ * subset check) is gone: a caller who can supply a claim can supply a wider
19
+ * one, so narrowing across trust levels is the shell's concern, not ours.
20
+ */
21
+ import { pathMatchesGlobs, slugMatchesPattern } from "./glob.js";
22
+ const asList = (v) => v === undefined ? [] : Array.isArray(v) ? v : [v];
23
+ export function normalizeClaims(claims) {
24
+ return claims.map((c) => {
25
+ const repoPatterns = asList(c.repo);
26
+ return {
27
+ repoPatterns,
28
+ hasWildcard: repoPatterns.includes("*"),
29
+ paths: asList(c.paths),
30
+ };
31
+ });
32
+ }
33
+ function matcherCoversRepo(m, repoSlug) {
34
+ if (m.hasWildcard)
35
+ return true;
36
+ return m.repoPatterns.some((p) => slugMatchesPattern(p, repoSlug));
37
+ }
38
+ /**
39
+ * Does any claim grant read on `path` in the repo named `repoSlug`? Follows
40
+ * gitignore's per-glob-list "last match wins" (see glob.ts), OR'd across
41
+ * claims (union semantics, §8.2).
42
+ */
43
+ export function claimsGrantRead(matchers, repoSlug, path) {
44
+ for (const m of matchers) {
45
+ if (!matcherCoversRepo(m, repoSlug))
46
+ continue;
47
+ if (pathMatchesGlobs(m.paths, path))
48
+ return true;
49
+ }
50
+ return false;
51
+ }
52
+ /**
53
+ * Does any claim bind `repoSlug` at all (regardless of path)? Coarse
54
+ * addressability — used by `repos.list` and query repo resolution to filter
55
+ * to claimed repos (§8.2).
56
+ */
57
+ export function claimsGrantRepo(matchers, repoSlug) {
58
+ return matchers.some((m) => matcherCoversRepo(m, repoSlug));
59
+ }
60
+ /**
61
+ * Compile claims into `SearchPlan` scope groups against the current repo set.
62
+ * A wildcard claim maps to the dynamic `"*"` group; a concrete claim resolves
63
+ * its repo patterns to the matching current repo ids. Claims with no path
64
+ * globs contribute nothing (they grant no path).
65
+ */
66
+ export function claimsToScopeGroups(matchers, repos) {
67
+ const groups = [];
68
+ for (const m of matchers) {
69
+ if (m.paths.length === 0)
70
+ continue;
71
+ if (m.hasWildcard) {
72
+ groups.push({ repos: "*", globs: m.paths });
73
+ continue;
74
+ }
75
+ const ids = repos
76
+ .filter((r) => m.repoPatterns.some((p) => slugMatchesPattern(p, r.slug)))
77
+ .map((r) => r.id);
78
+ if (ids.length > 0)
79
+ groups.push({ repos: ids, globs: m.paths });
80
+ }
81
+ return groups;
82
+ }
83
+ //# sourceMappingURL=scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../../src/kernel/auth/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEjE,MAAM,MAAM,GAAG,CAAC,CAAgC,EAAY,EAAE,CAC5D,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC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