@latysh-development/monolith 0.0.0-stage → 0.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +132 -2
  3. package/dist/brief/cli.d.ts +30 -0
  4. package/dist/brief/cli.d.ts.map +1 -0
  5. package/dist/brief/cli.js +85 -0
  6. package/dist/brief/collect.d.ts +17 -0
  7. package/dist/brief/collect.d.ts.map +1 -0
  8. package/dist/brief/collect.js +302 -0
  9. package/dist/brief/config.d.ts +40 -0
  10. package/dist/brief/config.d.ts.map +1 -0
  11. package/dist/brief/config.js +85 -0
  12. package/dist/brief/constants.d.ts +10 -0
  13. package/dist/brief/constants.d.ts.map +1 -0
  14. package/dist/brief/constants.js +9 -0
  15. package/dist/brief/docs.d.ts +53 -0
  16. package/dist/brief/docs.d.ts.map +1 -0
  17. package/dist/brief/docs.js +229 -0
  18. package/dist/brief/freshness.d.ts +104 -0
  19. package/dist/brief/freshness.d.ts.map +1 -0
  20. package/dist/brief/freshness.js +263 -0
  21. package/dist/brief/git-signals.d.ts +17 -0
  22. package/dist/brief/git-signals.d.ts.map +1 -0
  23. package/dist/brief/git-signals.js +101 -0
  24. package/dist/brief/index.d.ts +11 -0
  25. package/dist/brief/index.d.ts.map +1 -0
  26. package/dist/brief/index.js +5 -0
  27. package/dist/brief/reconcile.d.ts +75 -0
  28. package/dist/brief/reconcile.d.ts.map +1 -0
  29. package/dist/brief/reconcile.js +259 -0
  30. package/dist/brief/render.d.ts +60 -0
  31. package/dist/brief/render.d.ts.map +1 -0
  32. package/dist/brief/render.js +407 -0
  33. package/dist/brief/sanitize.d.ts +38 -0
  34. package/dist/brief/sanitize.d.ts.map +1 -0
  35. package/dist/brief/sanitize.js +48 -0
  36. package/dist/brief/selectors.d.ts +36 -0
  37. package/dist/brief/selectors.d.ts.map +1 -0
  38. package/dist/brief/selectors.js +75 -0
  39. package/dist/brief/story.d.ts +18 -0
  40. package/dist/brief/story.d.ts.map +1 -0
  41. package/dist/brief/story.js +59 -0
  42. package/dist/brief/types.d.ts +110 -0
  43. package/dist/brief/types.d.ts.map +1 -0
  44. package/dist/brief/types.js +11 -0
  45. package/dist/cli/index.d.ts +3 -0
  46. package/dist/cli/index.d.ts.map +1 -0
  47. package/dist/cli/index.js +166 -0
  48. package/dist/cli/init-args.d.ts +16 -0
  49. package/dist/cli/init-args.d.ts.map +1 -0
  50. package/dist/cli/init-args.js +24 -0
  51. package/dist/cli/ui-args.d.ts +23 -0
  52. package/dist/cli/ui-args.d.ts.map +1 -0
  53. package/dist/cli/ui-args.js +66 -0
  54. package/dist/cli/ui.d.ts +40 -0
  55. package/dist/cli/ui.d.ts.map +1 -0
  56. package/dist/cli/ui.js +180 -0
  57. package/dist/coordinatorium/checkpoint.d.ts +44 -0
  58. package/dist/coordinatorium/checkpoint.d.ts.map +1 -0
  59. package/dist/coordinatorium/checkpoint.js +124 -0
  60. package/dist/coordinatorium/cli.d.ts +39 -0
  61. package/dist/coordinatorium/cli.d.ts.map +1 -0
  62. package/dist/coordinatorium/cli.js +203 -0
  63. package/dist/coordinatorium/errors.d.ts +112 -0
  64. package/dist/coordinatorium/errors.d.ts.map +1 -0
  65. package/dist/coordinatorium/errors.js +145 -0
  66. package/dist/coordinatorium/index.d.ts +11 -0
  67. package/dist/coordinatorium/index.d.ts.map +1 -0
  68. package/dist/coordinatorium/index.js +5 -0
  69. package/dist/coordinatorium/lock.d.ts +187 -0
  70. package/dist/coordinatorium/lock.d.ts.map +1 -0
  71. package/dist/coordinatorium/lock.js +659 -0
  72. package/dist/coordinatorium/mission.d.ts +32 -0
  73. package/dist/coordinatorium/mission.d.ts.map +1 -0
  74. package/dist/coordinatorium/mission.js +87 -0
  75. package/dist/coordinatorium/state-keeper.d.ts +115 -0
  76. package/dist/coordinatorium/state-keeper.d.ts.map +1 -0
  77. package/dist/coordinatorium/state-keeper.js +396 -0
  78. package/dist/coordinatorium/types.d.ts +69 -0
  79. package/dist/coordinatorium/types.d.ts.map +1 -0
  80. package/dist/coordinatorium/types.js +27 -0
  81. package/dist/durable/assess.d.ts +105 -0
  82. package/dist/durable/assess.d.ts.map +1 -0
  83. package/dist/durable/assess.js +239 -0
  84. package/dist/durable/canonical.d.ts +25 -0
  85. package/dist/durable/canonical.d.ts.map +1 -0
  86. package/dist/durable/canonical.js +78 -0
  87. package/dist/durable/cli.d.ts +37 -0
  88. package/dist/durable/cli.d.ts.map +1 -0
  89. package/dist/durable/cli.js +141 -0
  90. package/dist/durable/errors.d.ts +188 -0
  91. package/dist/durable/errors.d.ts.map +1 -0
  92. package/dist/durable/errors.js +317 -0
  93. package/dist/durable/fs-store.d.ts +233 -0
  94. package/dist/durable/fs-store.d.ts.map +1 -0
  95. package/dist/durable/fs-store.js +1393 -0
  96. package/dist/durable/index.d.ts +20 -0
  97. package/dist/durable/index.d.ts.map +1 -0
  98. package/dist/durable/index.js +13 -0
  99. package/dist/durable/log.d.ts +33 -0
  100. package/dist/durable/log.d.ts.map +1 -0
  101. package/dist/durable/log.js +157 -0
  102. package/dist/durable/memory-store.d.ts +51 -0
  103. package/dist/durable/memory-store.d.ts.map +1 -0
  104. package/dist/durable/memory-store.js +302 -0
  105. package/dist/durable/projection.d.ts +35 -0
  106. package/dist/durable/projection.d.ts.map +1 -0
  107. package/dist/durable/projection.js +328 -0
  108. package/dist/durable/prune-check.d.ts +17 -0
  109. package/dist/durable/prune-check.d.ts.map +1 -0
  110. package/dist/durable/prune-check.js +45 -0
  111. package/dist/durable/register.d.ts +100 -0
  112. package/dist/durable/register.d.ts.map +1 -0
  113. package/dist/durable/register.js +532 -0
  114. package/dist/durable/retention.d.ts +49 -0
  115. package/dist/durable/retention.d.ts.map +1 -0
  116. package/dist/durable/retention.js +59 -0
  117. package/dist/durable/runtime.d.ts +497 -0
  118. package/dist/durable/runtime.d.ts.map +1 -0
  119. package/dist/durable/runtime.js +1271 -0
  120. package/dist/durable/seams.d.ts +40 -0
  121. package/dist/durable/seams.d.ts.map +1 -0
  122. package/dist/durable/seams.js +21 -0
  123. package/dist/durable/testing.d.ts +11 -0
  124. package/dist/durable/testing.d.ts.map +1 -0
  125. package/dist/durable/testing.js +25 -0
  126. package/dist/durable/types.d.ts +442 -0
  127. package/dist/durable/types.d.ts.map +1 -0
  128. package/dist/durable/types.js +75 -0
  129. package/dist/graph/builder.d.ts +11 -0
  130. package/dist/graph/builder.d.ts.map +1 -0
  131. package/dist/graph/builder.js +153 -0
  132. package/dist/graph/identity.d.ts +37 -0
  133. package/dist/graph/identity.d.ts.map +1 -0
  134. package/dist/graph/identity.js +46 -0
  135. package/dist/graph/index.d.ts +7 -0
  136. package/dist/graph/index.d.ts.map +1 -0
  137. package/dist/graph/index.js +3 -0
  138. package/dist/graph/resolver.d.ts +41 -0
  139. package/dist/graph/resolver.d.ts.map +1 -0
  140. package/dist/graph/resolver.js +36 -0
  141. package/dist/graph/types.d.ts +42 -0
  142. package/dist/graph/types.d.ts.map +1 -0
  143. package/dist/graph/types.js +1 -0
  144. package/dist/http/index.d.ts +5 -0
  145. package/dist/http/index.d.ts.map +1 -0
  146. package/dist/http/index.js +2 -0
  147. package/dist/http/server.d.ts +76 -0
  148. package/dist/http/server.d.ts.map +1 -0
  149. package/dist/http/server.js +195 -0
  150. package/dist/http/ui-assets.d.ts +22 -0
  151. package/dist/http/ui-assets.d.ts.map +1 -0
  152. package/dist/http/ui-assets.js +100 -0
  153. package/dist/index.d.ts +31 -0
  154. package/dist/index.d.ts.map +1 -0
  155. package/dist/index.js +26 -0
  156. package/dist/init/index.d.ts +12 -0
  157. package/dist/init/index.d.ts.map +1 -0
  158. package/dist/init/index.js +90 -0
  159. package/dist/init/prompts.d.ts +3 -0
  160. package/dist/init/prompts.d.ts.map +1 -0
  161. package/dist/init/prompts.js +47 -0
  162. package/dist/init/scaffold.d.ts +25 -0
  163. package/dist/init/scaffold.d.ts.map +1 -0
  164. package/dist/init/scaffold.js +204 -0
  165. package/dist/init/types.d.ts +14 -0
  166. package/dist/init/types.d.ts.map +1 -0
  167. package/dist/init/types.js +1 -0
  168. package/dist/readmodel/dashboard.d.ts +40 -0
  169. package/dist/readmodel/dashboard.d.ts.map +1 -0
  170. package/dist/readmodel/dashboard.js +236 -0
  171. package/dist/readmodel/index.d.ts +3 -0
  172. package/dist/readmodel/index.d.ts.map +1 -0
  173. package/dist/readmodel/index.js +1 -0
  174. package/dist/readmodel/types.d.ts +104 -0
  175. package/dist/readmodel/types.d.ts.map +1 -0
  176. package/dist/readmodel/types.js +15 -0
  177. package/dist/root/index.d.ts +179 -0
  178. package/dist/root/index.d.ts.map +1 -0
  179. package/dist/root/index.js +418 -0
  180. package/dist/root/safe-write.d.ts +268 -0
  181. package/dist/root/safe-write.d.ts.map +1 -0
  182. package/dist/root/safe-write.js +966 -0
  183. package/dist/root/write-artifacts.d.ts +20 -0
  184. package/dist/root/write-artifacts.d.ts.map +1 -0
  185. package/dist/root/write-artifacts.js +42 -0
  186. package/dist/scriptorium/compile.d.ts +4 -0
  187. package/dist/scriptorium/compile.d.ts.map +1 -0
  188. package/dist/scriptorium/compile.js +185 -0
  189. package/dist/scriptorium/frontmatter.d.ts +13 -0
  190. package/dist/scriptorium/frontmatter.d.ts.map +1 -0
  191. package/dist/scriptorium/frontmatter.js +90 -0
  192. package/dist/scriptorium/index.d.ts +3 -0
  193. package/dist/scriptorium/index.d.ts.map +1 -0
  194. package/dist/scriptorium/index.js +1 -0
  195. package/dist/scriptorium/markdown.d.ts +31 -0
  196. package/dist/scriptorium/markdown.d.ts.map +1 -0
  197. package/dist/scriptorium/markdown.js +88 -0
  198. package/dist/scriptorium/types.d.ts +78 -0
  199. package/dist/scriptorium/types.d.ts.map +1 -0
  200. package/dist/scriptorium/types.js +1 -0
  201. package/dist/types/enforcement.d.ts +11 -0
  202. package/dist/types/enforcement.d.ts.map +1 -0
  203. package/dist/types/enforcement.js +1 -0
  204. package/dist/types/integrity.d.ts +33 -0
  205. package/dist/types/integrity.d.ts.map +1 -0
  206. package/dist/types/integrity.js +1 -0
  207. package/dist/types/project-definition.d.ts +30 -0
  208. package/dist/types/project-definition.d.ts.map +1 -0
  209. package/dist/types/project-definition.js +1 -0
  210. package/dist/ui/assets/cosmic-glass-bg-Dwx47zPu.webp +0 -0
  211. package/dist/ui/assets/index-C4NhMaq7.js +28 -0
  212. package/dist/ui/assets/index-DMZ7ZvZY.css +1 -0
  213. package/dist/ui/index.html +13 -0
  214. package/dist/validate/index.d.ts +6 -0
  215. package/dist/validate/index.d.ts.map +1 -0
  216. package/dist/validate/index.js +214 -0
  217. package/dist/version.d.ts +2 -0
  218. package/dist/version.d.ts.map +1 -0
  219. package/dist/version.js +1 -0
  220. package/package.json +67 -4
  221. package/templates/.gitkeep +0 -0
  222. package/templates/default-instance/instruction/.cursorrules +53 -0
  223. package/templates/default-instance/instruction/.windsurfrules +53 -0
  224. package/templates/default-instance/instruction/CLAUDE.md +53 -0
  225. package/templates/default-instance/monolith/context/boot/HANDOFF.md +49 -0
  226. package/templates/default-instance/monolith/context/boot/WORK_SESSION.md +30 -0
  227. package/templates/default-instance/monolith/context/execution/current-state.md +30 -0
  228. package/templates/default-instance/monolith/context/maps/dependency-map.md +38 -0
  229. package/templates/default-instance/monolith/context/maps/project-map.md +85 -0
  230. package/templates/default-instance/monolith/context/maps/roadmap-index.md +41 -0
  231. package/templates/default-instance/monolith/context/maps/routing-map.md +147 -0
  232. package/templates/default-instance/monolith/context/maps/semantic-map.md +73 -0
  233. package/templates/default-instance/monolith/context/models/model-registry.md +37 -0
  234. package/templates/default-instance/monolith/context/models/privacy-classification.md +35 -0
  235. package/templates/default-instance/monolith/context/templates/plan-template.md +56 -0
  236. package/templates/default-instance/monolith/governance/README.md +29 -0
  237. package/templates/default-instance/monolith/governance/RULE_SCHEMA.md +58 -0
  238. package/templates/default-instance/monolith/learning/INDEX.md +48 -0
  239. package/templates/default-instance/monolith/learning/injection-map.md +49 -0
  240. package/templates/default-instance/monolith/learning/taxonomy.md +30 -0
  241. package/templates/default-instance/monolith/memory/errors/README.md +26 -0
  242. package/templates/default-instance/monolith/memory/errors/SCHEMA.md +47 -0
  243. package/templates/default-instance/monolith/memory/errors/TAXONOMY.md +27 -0
  244. package/templates/default-instance/monolith/memory/long-term/architecture-principles.md +31 -0
  245. package/templates/default-instance/monolith/memory/long-term/decisions.md +36 -0
  246. package/templates/default-instance/monolith/memory/long-term/execution-history.md +20 -0
  247. package/templates/default-instance/monolith/memory/long-term/tech-debt.md +25 -0
  248. package/templates/default-instance/monolith/memory/working/active.md +41 -0
  249. package/templates/default-instance/monolith/memory/working/governance-result.md +0 -0
  250. package/templates/default-instance/monolith/memory/working/integrity-result.md +0 -0
  251. package/templates/default-instance/monolith/memory/working/story-index.md +28 -0
  252. package/templates/default-instance/monolith/protocols/boot/boot-sequence.md +59 -0
  253. package/templates/default-instance/monolith/protocols/cognition/cognitive-modes.md +90 -0
  254. package/templates/default-instance/monolith/protocols/cognition/dry-run.md +56 -0
  255. package/templates/default-instance/monolith/protocols/cognition/execution-trace-format.md +52 -0
  256. package/templates/default-instance/monolith/protocols/cognition/semantic-planning.md +51 -0
  257. package/templates/default-instance/monolith/protocols/execution/hybrid-execution.md +37 -0
  258. package/templates/default-instance/monolith/protocols/execution/local-llm-governance.md +42 -0
  259. package/templates/default-instance/monolith/protocols/governance/command-policy.md +51 -0
  260. package/templates/default-instance/monolith/protocols/governance/core-invariants.md +40 -0
  261. package/templates/default-instance/monolith/protocols/governance/memory-governance.md +54 -0
  262. package/templates/default-instance/monolith/protocols/governance/metadata-schema.md +62 -0
  263. package/templates/default-instance/monolith/protocols/governance/skills.md +53 -0
  264. package/templates/default-instance/monolith/protocols/governance/work-session.md +46 -0
  265. package/templates/default-instance/monolith/skills/INDEX.md +28 -0
  266. package/templates/default-instance/monolith/skills/current-status/SKILL.md +47 -0
  267. package/templates/default-instance/monolith/skills/finalize-story/SKILL.md +86 -0
  268. package/templates/default-instance/monolith/skills/global-status/SKILL.md +56 -0
  269. package/templates/default-instance/monolith/skills/self-improvement/SKILL.md +77 -0
  270. package/templates/default-instance/monolith/state.json +11 -0
  271. package/templates/default-instance/monolith/tests/INDEX.md +57 -0
  272. package/templates/default-instance/monolith/tests/scenarios/architecture-review.md +32 -0
  273. package/templates/default-instance/monolith/tests/scenarios/debug-failure.md +32 -0
  274. package/templates/default-instance/monolith/tests/scenarios/dry-run-activation.md +33 -0
  275. package/templates/default-instance/monolith/tests/scenarios/execution-trace-verification.md +31 -0
  276. package/templates/default-instance/monolith/tests/scenarios/finalize-story.md +35 -0
  277. package/templates/default-instance/monolith/tests/scenarios/implement-feature.md +36 -0
  278. package/templates/default-instance/monolith/tests/scenarios/local-llm-delegation.md +31 -0
  279. package/templates/default-instance/monolith/tests/scenarios/planning-request.md +32 -0
  280. package/templates/default-instance/monolith/tests/scenarios/sensitive-context-task.md +30 -0
  281. package/templates/default-instance/monolith/tests/scenarios/validator-verification.md +33 -0
  282. package/templates/default-instance/monolith/tests/validation/expected-behavior.md +70 -0
  283. package/templates/default-instance/monolith/tests/validators/INDEX.md +17 -0
  284. package/templates/default-instance/monolith/tests/validators/delegation-semantics.md +22 -0
  285. package/templates/default-instance/monolith/tests/validators/mode-consistency.md +25 -0
  286. package/templates/default-instance/monolith/tests/validators/privacy-routing.md +23 -0
  287. package/templates/default-instance/monolith/tests/validators/protocol-references.md +27 -0
  288. package/templates/default-instance/monolith/tests/validators/routing-integrity.md +30 -0
  289. package/templates/default-instance/projectroot/AGENTS.md +107 -0
  290. package/templates/default-instance/projectroot/monolith.config.json +32 -0
  291. package/templates/default-instance/projectroot/project.definition.mjs.template +41 -0
@@ -0,0 +1,153 @@
1
+ import { compareObjects, isValidIdentifier, makeRef } from './identity.js';
2
+ import { buildObjectIndex, resolveRef } from './resolver.js';
3
+ /**
4
+ * Builds the explicit relationship graph.
5
+ *
6
+ * Nodes are KnowledgeObjects declared by Scriptorium (document `id:` and `{#ID}` sections).
7
+ * Concepts are not nodes. An edge exists only when its target resolves (RESOLVED) from a
8
+ * source that itself has a unique canonical identity. Output is independent of input order.
9
+ */
10
+ export function buildGraph(results) {
11
+ if (results.length === 0) {
12
+ return {
13
+ nodes: [],
14
+ edges: [],
15
+ unresolved: [],
16
+ conflicts: [],
17
+ diagnostics: [{ severity: 'info', message: 'No ScriptoriumResult inputs provided — graph is empty.' }],
18
+ };
19
+ }
20
+ const diagnostics = [];
21
+ const ordered = [...results].sort((a, b) => cmp(a.artifactId, b.artifactId) || cmp(a.sourcePath ?? '', b.sourcePath ?? ''));
22
+ // --- Pass 1: validate declarations into KnowledgeObjects ---
23
+ const declared = [];
24
+ const documentOf = new Map(); // result → document ref
25
+ const loadedNamespaces = new Set();
26
+ for (const result of ordered) {
27
+ const { artifactId } = result;
28
+ const namespace = result.namespace;
29
+ if (namespace === undefined || !isValidIdentifier(namespace)) {
30
+ if (result.declarations.length > 0 || result.relationships.length > 0) {
31
+ diagnostics.push({
32
+ severity: 'error',
33
+ message: namespace === undefined
34
+ ? 'Artifact has no namespace; its declarations and relationships cannot be given a canonical identity'
35
+ : `Invalid namespace "${namespace}"; its declarations and relationships cannot be given a canonical identity`,
36
+ artifactId,
37
+ });
38
+ }
39
+ continue;
40
+ }
41
+ loadedNamespaces.add(namespace);
42
+ for (const decl of result.declarations) {
43
+ if (!isValidIdentifier(decl.localId)) {
44
+ diagnostics.push({
45
+ severity: 'error',
46
+ message: `Invalid local id "${decl.localId}" in ${decl.kind} declaration; object ignored`,
47
+ artifactId,
48
+ });
49
+ continue;
50
+ }
51
+ const obj = {
52
+ ref: makeRef(namespace, decl.localId),
53
+ namespace,
54
+ localId: decl.localId,
55
+ kind: decl.kind,
56
+ ...(decl.title !== undefined ? { title: decl.title } : {}),
57
+ ...(decl.status !== undefined ? { status: decl.status } : {}),
58
+ location: {
59
+ artifactId,
60
+ path: result.sourcePath ?? artifactId,
61
+ ...(decl.sourceLine !== undefined ? { line: decl.sourceLine } : {}),
62
+ },
63
+ };
64
+ declared.push(obj);
65
+ if (decl.kind === 'document' && !documentOf.has(result))
66
+ documentOf.set(result, obj.ref);
67
+ }
68
+ }
69
+ // --- Pass 2: uniqueness. A ref held by more than one object is a conflict, never a node. ---
70
+ const index = buildObjectIndex(declared, loadedNamespaces);
71
+ const nodes = [];
72
+ const conflicts = [];
73
+ for (const [ref, list] of index.byRef) {
74
+ if (list.length === 1) {
75
+ nodes.push(list[0]);
76
+ }
77
+ else {
78
+ conflicts.push({ ref, candidates: [...list] });
79
+ diagnostics.push({
80
+ severity: 'error',
81
+ message: `Identity conflict: ${list.length} objects declare "${ref}" (${list
82
+ .map(o => `${o.location.artifactId}${o.location.line !== undefined ? `:${o.location.line}` : ''}`)
83
+ .join(', ')}); none is resolvable`,
84
+ });
85
+ }
86
+ }
87
+ nodes.sort(compareObjects);
88
+ conflicts.sort((a, b) => cmp(a.ref, b.ref));
89
+ // --- Pass 3: relationships → edges (RESOLVED only) ---
90
+ const edges = [];
91
+ const edgeDedup = new Map();
92
+ const unresolved = [];
93
+ for (const result of ordered) {
94
+ if (result.relationships.length === 0)
95
+ continue;
96
+ const fromRef = documentOf.get(result);
97
+ const fromOk = fromRef !== undefined && index.byRef.get(fromRef)?.length === 1;
98
+ if (!fromOk) {
99
+ if (result.namespace !== undefined && isValidIdentifier(result.namespace)) {
100
+ diagnostics.push({
101
+ severity: 'warn',
102
+ message: fromRef === undefined
103
+ ? `Artifact declares no document id; ${result.relationships.length} relationship(s) have no canonical source and create no edges`
104
+ : `Document "${fromRef}" is in an identity conflict; ${result.relationships.length} relationship(s) create no edges`,
105
+ artifactId: result.artifactId,
106
+ });
107
+ }
108
+ continue;
109
+ }
110
+ for (const rel of result.relationships) {
111
+ const resolution = resolveRef(rel.toLabel, result.namespace, index);
112
+ if (resolution.status !== 'RESOLVED') {
113
+ unresolved.push({
114
+ fromRef,
115
+ rawRef: rel.toLabel,
116
+ relationshipType: rel.relationshipType,
117
+ resolution,
118
+ sourceArtifactId: result.artifactId,
119
+ evidenceId: rel.id,
120
+ ...(rel.sourceLine !== undefined ? { sourceLine: rel.sourceLine } : {}),
121
+ });
122
+ continue;
123
+ }
124
+ const toRef = resolution.object.ref;
125
+ const key = `${fromRef}|${rel.relationshipType}|${toRef}|${result.artifactId}`;
126
+ const existing = edgeDedup.get(key);
127
+ if (existing !== undefined) {
128
+ edges[existing].evidenceIds.push(rel.id);
129
+ }
130
+ else {
131
+ edgeDedup.set(key, edges.length);
132
+ edges.push({
133
+ id: key,
134
+ fromRef,
135
+ toRef,
136
+ relationshipType: rel.relationshipType,
137
+ provenance: 'explicit',
138
+ evidenceIds: [rel.id],
139
+ sourceArtifactId: result.artifactId,
140
+ ...(rel.sourceLine !== undefined ? { sourceLine: rel.sourceLine } : {}),
141
+ });
142
+ }
143
+ }
144
+ }
145
+ edges.sort((a, b) => cmp(a.id, b.id));
146
+ unresolved.sort((a, b) => cmp(a.sourceArtifactId, b.sourceArtifactId) ||
147
+ cmp(a.evidenceId, b.evidenceId) ||
148
+ cmp(a.rawRef, b.rawRef));
149
+ return { nodes, edges, unresolved, conflicts, diagnostics };
150
+ }
151
+ function cmp(a, b) {
152
+ return a < b ? -1 : a > b ? 1 : 0;
153
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Canonical Knowledge Identity.
3
+ *
4
+ * ref = namespace:localId. Neither part is derived from a title, a path or a slug:
5
+ * namespace is supplied by the caller, localId is declared in the artifact
6
+ * (frontmatter `id:` or a `{#ID}` heading marker). Identifiers are case-sensitive.
7
+ */
8
+ export type KnowledgeObjectKind = 'document' | 'section';
9
+ export interface KnowledgeObject {
10
+ ref: string;
11
+ namespace: string;
12
+ localId: string;
13
+ kind: KnowledgeObjectKind;
14
+ title?: string;
15
+ status?: string;
16
+ location: {
17
+ artifactId: string;
18
+ path: string;
19
+ line?: number;
20
+ };
21
+ }
22
+ export declare function isValidIdentifier(value: string): boolean;
23
+ export declare function makeRef(namespace: string, localId: string): string;
24
+ export type ParsedRef = {
25
+ ok: true;
26
+ qualified: boolean;
27
+ namespace?: string;
28
+ localId: string;
29
+ } | {
30
+ ok: false;
31
+ reason: string;
32
+ };
33
+ /** Syntactic parse only; whether the ref resolves is the resolver's concern. */
34
+ export declare function parseRef(raw: string): ParsedRef;
35
+ /** Total order used for every candidate list, so output never depends on input order. */
36
+ export declare function compareObjects(a: KnowledgeObject, b: KnowledgeObject): number;
37
+ //# sourceMappingURL=identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/graph/identity.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,SAAS,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QACR,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAKD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,MAAM,MAAM,SAAS,GACjB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACrE;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAElC,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAgB/C;AAED,yFAAyF;AACzF,wBAAgB,cAAc,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,GAAG,MAAM,CAQ7E"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Canonical Knowledge Identity.
3
+ *
4
+ * ref = namespace:localId. Neither part is derived from a title, a path or a slug:
5
+ * namespace is supplied by the caller, localId is declared in the artifact
6
+ * (frontmatter `id:` or a `{#ID}` heading marker). Identifiers are case-sensitive.
7
+ */
8
+ /** Allowed in both namespace and localId. Excludes ':' (the ref separator), whitespace and braces. */
9
+ const IDENTIFIER_RE = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
10
+ export function isValidIdentifier(value) {
11
+ return IDENTIFIER_RE.test(value);
12
+ }
13
+ export function makeRef(namespace, localId) {
14
+ return `${namespace}:${localId}`;
15
+ }
16
+ /** Syntactic parse only; whether the ref resolves is the resolver's concern. */
17
+ export function parseRef(raw) {
18
+ const value = raw.trim();
19
+ if (value === '')
20
+ return { ok: false, reason: 'empty reference' };
21
+ const parts = value.split(':');
22
+ if (parts.length > 2)
23
+ return { ok: false, reason: 'more than one ":" separator' };
24
+ if (parts.length === 2) {
25
+ const [namespace, localId] = parts;
26
+ if (!isValidIdentifier(namespace))
27
+ return { ok: false, reason: `invalid namespace "${namespace}"` };
28
+ if (!isValidIdentifier(localId))
29
+ return { ok: false, reason: `invalid local id "${localId}"` };
30
+ return { ok: true, qualified: true, namespace, localId };
31
+ }
32
+ if (!isValidIdentifier(value))
33
+ return { ok: false, reason: `invalid local id "${value}"` };
34
+ return { ok: true, qualified: false, localId: value };
35
+ }
36
+ /** Total order used for every candidate list, so output never depends on input order. */
37
+ export function compareObjects(a, b) {
38
+ return (cmp(a.ref, b.ref) ||
39
+ cmp(a.location.artifactId, b.location.artifactId) ||
40
+ cmp(a.location.path, b.location.path) ||
41
+ (a.location.line ?? -1) - (b.location.line ?? -1) ||
42
+ cmp(a.kind, b.kind));
43
+ }
44
+ function cmp(a, b) {
45
+ return a < b ? -1 : a > b ? 1 : 0;
46
+ }
@@ -0,0 +1,7 @@
1
+ export type { GraphNode, GraphEdge, GraphDiagnostic, ExplicitRelationshipGraph, UnresolvedReference, IdentityConflict, } from './types.js';
2
+ export type { KnowledgeObject, KnowledgeObjectKind, ParsedRef } from './identity.js';
3
+ export { makeRef, parseRef, isValidIdentifier } from './identity.js';
4
+ export type { Resolution, UnresolvedResolution, ObjectIndex } from './resolver.js';
5
+ export { buildObjectIndex, resolveRef } from './resolver.js';
6
+ export { buildGraph } from './builder.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graph/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,SAAS,EACT,SAAS,EACT,eAAe,EACf,yBAAyB,EACzB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACrE,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { makeRef, parseRef, isValidIdentifier } from './identity.js';
2
+ export { buildObjectIndex, resolveRef } from './resolver.js';
3
+ export { buildGraph } from './builder.js';
@@ -0,0 +1,41 @@
1
+ import type { KnowledgeObject } from './identity.js';
2
+ /**
3
+ * Deterministic reference resolution. No fuzzy matching, no title matching,
4
+ * no LLM, no first-wins: a ref resolves only when exactly one object holds it.
5
+ */
6
+ export interface ObjectIndex {
7
+ /** Every declared object by ref. More than one entry means an identity conflict. */
8
+ byRef: ReadonlyMap<string, readonly KnowledgeObject[]>;
9
+ /** Namespaces for which at least one artifact was provided as input. */
10
+ loadedNamespaces: ReadonlySet<string>;
11
+ }
12
+ export type Resolution = {
13
+ status: 'RESOLVED';
14
+ ref: string;
15
+ object: KnowledgeObject;
16
+ } | {
17
+ status: 'MISSING';
18
+ ref: string;
19
+ } | {
20
+ status: 'AMBIGUOUS';
21
+ ref: string;
22
+ candidates: KnowledgeObject[];
23
+ } | {
24
+ status: 'EXTERNAL_UNAVAILABLE';
25
+ ref: string;
26
+ namespace: string;
27
+ } | {
28
+ status: 'INVALID_REF';
29
+ raw: string;
30
+ reason: string;
31
+ };
32
+ export type UnresolvedResolution = Exclude<Resolution, {
33
+ status: 'RESOLVED';
34
+ }>;
35
+ export declare function buildObjectIndex(objects: readonly KnowledgeObject[], loadedNamespaces: Iterable<string>): ObjectIndex;
36
+ /**
37
+ * @param raw reference text as written in the source artifact
38
+ * @param sourceNamespace namespace of the artifact containing the reference
39
+ */
40
+ export declare function resolveRef(raw: string, sourceNamespace: string, index: ObjectIndex): Resolution;
41
+ //# sourceMappingURL=resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/graph/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD;;;GAGG;AAEH,MAAM,WAAW,WAAW;IAC1B,oFAAoF;IACpF,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC,CAAC;IACvD,wEAAwE;IACxE,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACvC;AAED,MAAM,MAAM,UAAU,GAClB;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,GAC5D;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,eAAe,EAAE,CAAA;CAAE,GACnE;IAAE,MAAM,EAAE,sBAAsB,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAClE;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3D,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC,CAAC;AAE/E,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,eAAe,EAAE,EACnC,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,GACjC,WAAW,CASb;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,UAAU,CAiB/F"}
@@ -0,0 +1,36 @@
1
+ import { compareObjects, makeRef, parseRef } from './identity.js';
2
+ export function buildObjectIndex(objects, loadedNamespaces) {
3
+ const byRef = new Map();
4
+ for (const obj of objects) {
5
+ const list = byRef.get(obj.ref);
6
+ if (list)
7
+ list.push(obj);
8
+ else
9
+ byRef.set(obj.ref, [obj]);
10
+ }
11
+ for (const list of byRef.values())
12
+ list.sort(compareObjects);
13
+ return { byRef, loadedNamespaces: new Set(loadedNamespaces) };
14
+ }
15
+ /**
16
+ * @param raw reference text as written in the source artifact
17
+ * @param sourceNamespace namespace of the artifact containing the reference
18
+ */
19
+ export function resolveRef(raw, sourceNamespace, index) {
20
+ const parsed = parseRef(raw);
21
+ if (!parsed.ok)
22
+ return { status: 'INVALID_REF', raw, reason: parsed.reason };
23
+ // Rule 2: an unqualified id is looked up only inside the source's own namespace.
24
+ const namespace = parsed.qualified ? parsed.namespace : sourceNamespace;
25
+ const ref = makeRef(namespace, parsed.localId);
26
+ // Rule 5: a namespace with no loaded corpus is unavailable, not a missing local object.
27
+ if (!index.loadedNamespaces.has(namespace)) {
28
+ return { status: 'EXTERNAL_UNAVAILABLE', ref, namespace };
29
+ }
30
+ const candidates = index.byRef.get(ref);
31
+ if (!candidates || candidates.length === 0)
32
+ return { status: 'MISSING', ref };
33
+ if (candidates.length > 1)
34
+ return { status: 'AMBIGUOUS', ref, candidates: [...candidates] };
35
+ return { status: 'RESOLVED', ref, object: candidates[0] };
36
+ }
@@ -0,0 +1,42 @@
1
+ import type { KnowledgeObject } from './identity.js';
2
+ import type { UnresolvedResolution } from './resolver.js';
3
+ /** A graph node is a canonical KnowledgeObject. There are no concept, alias or synthesized nodes. */
4
+ export type GraphNode = KnowledgeObject;
5
+ export interface GraphEdge {
6
+ id: string;
7
+ fromRef: string;
8
+ toRef: string;
9
+ relationshipType: string;
10
+ provenance: 'explicit';
11
+ evidenceIds: string[];
12
+ sourceArtifactId: string;
13
+ sourceLine?: number;
14
+ }
15
+ /** A relationship whose target did not resolve to exactly one object. No edge exists for it. */
16
+ export interface UnresolvedReference {
17
+ fromRef: string;
18
+ rawRef: string;
19
+ relationshipType: string;
20
+ resolution: UnresolvedResolution;
21
+ sourceArtifactId: string;
22
+ evidenceId: string;
23
+ sourceLine?: number;
24
+ }
25
+ /** Two or more declarations claim the same `ref`. None of them becomes a node. */
26
+ export interface IdentityConflict {
27
+ ref: string;
28
+ candidates: KnowledgeObject[];
29
+ }
30
+ export interface GraphDiagnostic {
31
+ severity: 'info' | 'warn' | 'error';
32
+ message: string;
33
+ artifactId?: string;
34
+ }
35
+ export interface ExplicitRelationshipGraph {
36
+ nodes: GraphNode[];
37
+ edges: GraphEdge[];
38
+ unresolved: UnresolvedReference[];
39
+ conflicts: IdentityConflict[];
40
+ diagnostics: GraphDiagnostic[];
41
+ }
42
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/graph/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,qGAAqG;AACrG,MAAM,MAAM,SAAS,GAAG,eAAe,CAAC;AAExC,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,gGAAgG;AAChG,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,oBAAoB,CAAC;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,kFAAkF;AAClF,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,eAAe,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAClC,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,WAAW,EAAE,eAAe,EAAE,CAAC;CAChC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export { startDashboardServer, DASHBOARD_PATH, LOOPBACK_HOST, MAX_RESPONSE_BYTES } from './server.js';
2
+ export type { DashboardServer, DashboardServerOptions, HttpErrorBody, HttpErrorCode, HttpErrorKind, UiAsset, UiAssets, } from './server.js';
3
+ export { loadUiAssets, UiAssetsError } from './ui-assets.js';
4
+ export type { UiAssetsErrorCode } from './ui-assets.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtG,YAAY,EACV,eAAe,EACf,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,aAAa,EACb,OAAO,EACP,QAAQ,GACT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC7D,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { startDashboardServer, DASHBOARD_PATH, LOOPBACK_HOST, MAX_RESPONSE_BYTES } from './server.js';
2
+ export { loadUiAssets, UiAssetsError } from './ui-assets.js';
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Secure read-only HTTP transport for Mission Control (UI-001B.2, ADR-010 G2).
3
+ *
4
+ * One endpoint, `GET /api/dashboard`, serves the existing `DashboardReadModel`
5
+ * exactly as `readDashboardModel(projectRoot)` returns it. This module is a
6
+ * transport only:
7
+ * - it reads no file and imports no filesystem module; every byte of project
8
+ * data arrives through `readDashboardModel` (ADR-014 safe read);
9
+ * - it knows nothing about `state.json`, its schema or its physical layout, so
10
+ * the Core storage can change (STATE-003) without touching this layer;
11
+ * - the project root is fixed when the server starts and is never taken from a
12
+ * request (query, body, header or cookie are not read for that purpose).
13
+ *
14
+ * With `options.assets` it also serves the built UI from memory (`monolith ui`);
15
+ * the API route, the Host/Origin checks and the loopback bind are unchanged.
16
+ *
17
+ * Security boundary (G2): bound to 127.0.0.1 only; `Host` allowlist (loopback
18
+ * name + the real port, against DNS rebinding); `Origin` checked when present
19
+ * and never reflected; no CORS headers at all; GET only; fixed response
20
+ * headers; bounded response size with no partial JSON; errors are fixed codes,
21
+ * never exception text or paths. Loopback is NOT treated as authentication.
22
+ *
23
+ * Source failures (absent / forbidden / corrupt / unreadable) are part of the
24
+ * DTO (`SourceReport`) and keep their Typed Read Model semantics: they are a
25
+ * valid 200 response carrying `data: null` and a typed code, never project
26
+ * content. Threat model (ADR-013): TM-A supported with limitations, TM-B
27
+ * partially supported, TM-C (concurrent adversarial mutation) NOT supported;
28
+ * dynamic TOCTOU is not closed here, nor by Core.
29
+ */
30
+ export declare const DASHBOARD_PATH = "/api/dashboard";
31
+ /** The only bind address; there is deliberately no option to change it. */
32
+ export declare const LOOPBACK_HOST = "127.0.0.1";
33
+ /**
34
+ * Hard ceiling for one serialized response. The Core read limits (state 16 MiB,
35
+ * active.md/roadmap 256 KiB) are protective ceilings of their own and can exceed
36
+ * it; an over-limit DTO is refused whole, never truncated.
37
+ */
38
+ export declare const MAX_RESPONSE_BYTES: number;
39
+ /** One file of the built UI, held in memory (loaded by `ui-assets.ts`, which is the only place that touches the disk). */
40
+ export interface UiAsset {
41
+ readonly body: Buffer;
42
+ readonly contentType: string;
43
+ }
44
+ /** Request path (`/index.html`, `/assets/x.js`) -> asset. */
45
+ export type UiAssets = ReadonlyMap<string, UiAsset>;
46
+ export type HttpErrorKind = 'request' | 'security' | 'dashboard' | 'internal';
47
+ export type HttpErrorCode = 'HOST_NOT_ALLOWED' | 'ORIGIN_NOT_ALLOWED' | 'NOT_FOUND' | 'METHOD_NOT_ALLOWED' | 'RESPONSE_TOO_LARGE' | 'INTERNAL_ERROR';
48
+ /** Body of every non-200 response. Fixed vocabulary only: no message, path or detail. */
49
+ export interface HttpErrorBody {
50
+ error: {
51
+ kind: HttpErrorKind;
52
+ code: HttpErrorCode;
53
+ };
54
+ }
55
+ export interface DashboardServerOptions {
56
+ /** Absolute project root, chosen by the embedding process. */
57
+ projectRoot: string;
58
+ /** 0 (default) lets the OS pick a free port; read the result from `DashboardServer.port`. */
59
+ port?: number;
60
+ /** Overrides MAX_RESPONSE_BYTES (tests, tighter deployments). */
61
+ maxResponseBytes?: number;
62
+ /**
63
+ * The built UI, already in memory (`loadUiAssets`). When given, `GET /` and
64
+ * `GET <asset path>` serve it; the match is by exact key, so no request path
65
+ * is ever mapped onto the filesystem. When absent, only the API exists.
66
+ */
67
+ assets?: UiAssets;
68
+ }
69
+ export interface DashboardServer {
70
+ readonly host: typeof LOOPBACK_HOST;
71
+ readonly port: number;
72
+ readonly url: string;
73
+ close(): Promise<void>;
74
+ }
75
+ export declare function startDashboardServer(options: DashboardServerOptions): Promise<DashboardServer>;
76
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/http/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAOH,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAC/C,2EAA2E;AAC3E,eAAO,MAAM,aAAa,cAAc,CAAC;AACzC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,QAAkB,CAAC;AAElD,0HAA0H;AAC1H,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,6DAA6D;AAC7D,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;AAC9E,MAAM,MAAM,aAAa,GACrB,kBAAkB,GAClB,oBAAoB,GACpB,WAAW,GACX,oBAAoB,GACpB,oBAAoB,GACpB,gBAAgB,CAAC;AAErB,yFAAyF;AACzF,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE;QAAE,IAAI,EAAE,aAAa,CAAC;QAAC,IAAI,EAAE,aAAa,CAAA;KAAE,CAAC;CACrD;AAED,MAAM,WAAW,sBAAsB;IACrC,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAAC;IACpB,6FAA6F;IAC7F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,OAAO,aAAa,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAmFD,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,eAAe,CAAC,CA4EpG"}