melchizedek-agents 0.9.6 → 0.16.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 (246) hide show
  1. package/.env.example +272 -0
  2. package/AGENT_SETUP.md +39 -23
  3. package/CHANGELOG.md +623 -0
  4. package/DOCUMENTATION.md +429 -109
  5. package/QUICKSTART.md +92 -18
  6. package/README.md +45 -5
  7. package/config/agents/README.md +46 -1
  8. package/config/agents/examples/ares.yaml +117 -40
  9. package/config/agents/examples/assistant.yaml +159 -0
  10. package/config/agents/examples/augustin.yaml +154 -51
  11. package/config/agents/examples/cartographers.yaml +91 -23
  12. package/config/agents/examples/claude.yaml +45 -6
  13. package/config/agents/examples/council.yaml +23 -8
  14. package/config/agents/examples/critic.yaml +57 -21
  15. package/config/agents/examples/delegation.yaml +76 -9
  16. package/config/agents/examples/hierarchical.yaml +55 -8
  17. package/config/agents/examples/image_production.yaml +54 -16
  18. package/config/agents/examples/librarian.yaml +70 -14
  19. package/config/agents/examples/model_zoo.yaml +105 -29
  20. package/config/agents/examples/patient_advocate.yaml +102 -34
  21. package/config/agents/examples/research.yaml +250 -0
  22. package/config/agents/examples/scribe.yaml +242 -0
  23. package/config/agents/examples/scriptorium.yaml +87 -24
  24. package/config/agents/examples/style_council.yaml +31 -9
  25. package/config/agents/examples/syndicate.yaml +29 -10
  26. package/config/agents/examples/tutor.yaml +10 -3
  27. package/config/agents/syndicateSchema.yaml +44 -9
  28. package/config/agents/templates/README.md +58 -0
  29. package/config/agents/templates/account_memory.yaml +153 -0
  30. package/config/agents/templates/case_desk.yaml +188 -0
  31. package/config/agents/templates/conversational.yaml +110 -0
  32. package/config/agents/templates/draft_review.yaml +130 -0
  33. package/config/agents/templates/intake_extractor.yaml +152 -0
  34. package/config/agents/templates/research_brief.yaml +169 -0
  35. package/config/agents/templates/research_desk.yaml +152 -0
  36. package/config/agents/templates/review_panel.yaml +188 -0
  37. package/config/agents/templates/support_triage.yaml +273 -0
  38. package/config/agents/templates/systems_operator.yaml +157 -0
  39. package/db/hardening.sql +202 -0
  40. package/db/memory_v2.sql +77 -0
  41. package/db/migrations/0001_base.sql +167 -0
  42. package/db/migrations/0002_erase_scope.sql +172 -0
  43. package/db/migrations/0003_postgres_storage.sql +58 -0
  44. package/db/migrations/0004_usage.sql +94 -0
  45. package/db/migrations/0005_agent_registry.sql +200 -0
  46. package/db/migrations/0006_task_leases.sql +25 -0
  47. package/db/migrations/0007_memory_commit.sql +134 -0
  48. package/db/migrations/0008_memory_retention.sql +37 -0
  49. package/db/migrations/0009_task_queue.sql +51 -0
  50. package/db/migrations/0010_erase_complete.sql +180 -0
  51. package/db/telemetry.sql +401 -0
  52. package/demo/README.md +77 -0
  53. package/demo/a2a_demo.mjs +95 -0
  54. package/dist/lib/a2a/app.d.ts +253 -0
  55. package/dist/lib/a2a/app.js +751 -0
  56. package/dist/lib/a2a/executor.d.ts +167 -0
  57. package/dist/lib/a2a/executor.js +548 -0
  58. package/dist/lib/a2a/identity.d.ts +122 -0
  59. package/dist/lib/a2a/identity.js +254 -0
  60. package/dist/lib/a2a/policy.d.ts +110 -0
  61. package/dist/lib/a2a/policy.js +178 -0
  62. package/dist/lib/a2a/redisLimits.d.ts +26 -0
  63. package/dist/lib/a2a/redisLimits.js +31 -0
  64. package/dist/lib/a2a/remoteAgent.d.ts +91 -0
  65. package/dist/lib/a2a/remoteAgent.js +268 -0
  66. package/dist/lib/a2a/turnLock.d.ts +28 -0
  67. package/dist/lib/a2a/turnLock.js +76 -0
  68. package/dist/lib/compile.d.ts +11 -1
  69. package/dist/lib/compile.js +109 -8
  70. package/dist/lib/config.d.ts +7 -7
  71. package/dist/lib/config.js +7 -7
  72. package/dist/lib/doctor.d.ts +145 -0
  73. package/dist/lib/doctor.js +517 -0
  74. package/dist/lib/grounding.d.ts +2 -2
  75. package/dist/lib/grounding.js +2 -2
  76. package/dist/lib/guards/index.d.ts +37 -0
  77. package/dist/lib/guards/index.js +66 -0
  78. package/dist/lib/guards/science.d.ts +117 -0
  79. package/dist/lib/guards/science.js +444 -0
  80. package/dist/lib/index.d.ts +37 -2
  81. package/dist/lib/index.js +35 -4
  82. package/dist/lib/loadEnv.d.ts +23 -11
  83. package/dist/lib/loadEnv.js +77 -29
  84. package/dist/lib/loadSyndicate.d.ts +97 -5
  85. package/dist/lib/loadSyndicate.js +176 -76
  86. package/dist/lib/memory/erase.d.ts +24 -0
  87. package/dist/lib/memory/erase.js +47 -0
  88. package/dist/lib/memory/namespace.d.ts +37 -0
  89. package/dist/lib/memory/namespace.js +74 -0
  90. package/dist/lib/memory/providers.d.ts +99 -0
  91. package/dist/lib/memory/providers.js +240 -0
  92. package/dist/lib/memory/store.d.ts +74 -0
  93. package/dist/lib/memory/store.js +108 -0
  94. package/dist/lib/memory/supabaseMemoryService.d.ts +69 -9
  95. package/dist/lib/memory/supabaseMemoryService.js +239 -125
  96. package/dist/lib/models/capabilities.d.ts +103 -0
  97. package/dist/lib/models/capabilities.js +291 -0
  98. package/dist/lib/models/claudeLlm.d.ts +10 -1
  99. package/dist/lib/models/claudeLlm.js +57 -27
  100. package/dist/lib/models/endpoints.d.ts +100 -0
  101. package/dist/lib/models/endpoints.js +282 -0
  102. package/dist/lib/models/gateway.d.ts +107 -0
  103. package/dist/lib/models/gateway.js +157 -0
  104. package/dist/lib/models/gatewayLlm.d.ts +57 -0
  105. package/dist/lib/models/gatewayLlm.js +105 -0
  106. package/dist/lib/models/gptLlm.d.ts +51 -2
  107. package/dist/lib/models/gptLlm.js +169 -26
  108. package/dist/lib/models/grokLlm.d.ts +19 -10
  109. package/dist/lib/models/grokLlm.js +29 -14
  110. package/dist/lib/models/ollamaLlm.d.ts +26 -0
  111. package/dist/lib/models/ollamaLlm.js +43 -1
  112. package/dist/lib/models/openAiCompatibleLlm.d.ts +67 -2
  113. package/dist/lib/models/openAiCompatibleLlm.js +200 -37
  114. package/dist/lib/models/providerMap.js +9 -2
  115. package/dist/lib/models/registry.d.ts +42 -5
  116. package/dist/lib/models/registry.js +140 -29
  117. package/dist/lib/models/retry.d.ts +146 -0
  118. package/dist/lib/models/retry.js +305 -0
  119. package/dist/lib/models/schemaNormalize.d.ts +20 -0
  120. package/dist/lib/models/schemaNormalize.js +43 -0
  121. package/dist/lib/net/addressGuard.d.ts +60 -0
  122. package/dist/lib/net/addressGuard.js +216 -0
  123. package/dist/lib/observability/embeddings.d.ts +11 -2
  124. package/dist/lib/observability/embeddings.js +18 -14
  125. package/dist/lib/observability/metrics.d.ts +36 -0
  126. package/dist/lib/observability/metrics.js +86 -0
  127. package/dist/lib/observability/redact.d.ts +29 -0
  128. package/dist/lib/observability/redact.js +102 -0
  129. package/dist/lib/observability/supabaseSpanExporter.d.ts +2 -0
  130. package/dist/lib/observability/supabaseSpanExporter.js +22 -6
  131. package/dist/lib/observability/tracer.d.ts +10 -0
  132. package/dist/lib/observability/tracer.js +70 -3
  133. package/dist/lib/persistence/supabaseProvider.d.ts +11 -0
  134. package/dist/lib/persistence/supabaseProvider.js +32 -6
  135. package/dist/lib/registry.d.ts +87 -0
  136. package/dist/lib/registry.js +146 -0
  137. package/dist/lib/runtime/approvals.d.ts +44 -0
  138. package/dist/lib/runtime/approvals.js +67 -0
  139. package/dist/lib/runtime/syndicateTurn.d.ts +233 -0
  140. package/dist/lib/runtime/syndicateTurn.js +597 -0
  141. package/dist/lib/runtime/turnControl.d.ts +90 -0
  142. package/dist/lib/runtime/turnControl.js +131 -0
  143. package/dist/lib/session/supabaseSessionService.js +1 -1
  144. package/dist/lib/session/transcript.d.ts +9 -1
  145. package/dist/lib/session/transcript.js +15 -7
  146. package/dist/lib/skills.d.ts +50 -0
  147. package/dist/lib/skills.js +138 -0
  148. package/dist/lib/storage/postgres/index.d.ts +98 -0
  149. package/dist/lib/storage/postgres/index.js +146 -0
  150. package/dist/lib/storage/postgres/memoryStore.d.ts +11 -0
  151. package/dist/lib/storage/postgres/memoryStore.js +82 -0
  152. package/dist/lib/storage/postgres/sessionService.d.ts +51 -0
  153. package/dist/lib/storage/postgres/sessionService.js +225 -0
  154. package/dist/lib/storage/postgres/taskQueue.d.ts +22 -0
  155. package/dist/lib/storage/postgres/taskQueue.js +101 -0
  156. package/dist/lib/storage/postgres/taskStore.d.ts +55 -0
  157. package/dist/lib/storage/postgres/taskStore.js +168 -0
  158. package/dist/lib/storage/schema.d.ts +27 -0
  159. package/dist/lib/storage/schema.js +50 -0
  160. package/dist/lib/storage/schemaVersion.d.ts +25 -0
  161. package/dist/lib/storage/schemaVersion.js +46 -0
  162. package/dist/lib/syndicateSchema.d.ts +275 -0
  163. package/dist/lib/syndicateSchema.js +534 -0
  164. package/dist/lib/toolRegistry.d.ts +15 -0
  165. package/dist/lib/toolRegistry.js +59 -10
  166. package/dist/lib/tools/collectionsSearchTool.js +1 -1
  167. package/dist/lib/tools/mcpServe.d.ts +45 -0
  168. package/dist/lib/tools/mcpServe.js +88 -0
  169. package/dist/lib/tools/mcpToolFactory.d.ts +2 -0
  170. package/dist/lib/tools/mcpToolFactory.js +41 -21
  171. package/dist/lib/tools/science/corrections.d.ts +42 -0
  172. package/dist/lib/tools/science/corrections.js +115 -0
  173. package/dist/lib/tools/science/europepmc.d.ts +51 -0
  174. package/dist/lib/tools/science/europepmc.js +127 -0
  175. package/dist/lib/tools/science/http.d.ts +31 -0
  176. package/dist/lib/tools/science/http.js +104 -0
  177. package/dist/lib/tools/science/openalex.d.ts +30 -0
  178. package/dist/lib/tools/science/openalex.js +81 -0
  179. package/dist/lib/tools/science/trials.d.ts +58 -0
  180. package/dist/lib/tools/science/trials.js +203 -0
  181. package/dist/lib/tools/science/types.d.ts +69 -0
  182. package/dist/lib/tools/science/types.js +48 -0
  183. package/dist/lib/tools/scienceTools.d.ts +100 -0
  184. package/dist/lib/tools/scienceTools.js +277 -0
  185. package/dist/lib/tools/taskTools.d.ts +204 -0
  186. package/dist/lib/tools/taskTools.js +374 -0
  187. package/dist/lib/tools/toolContract.d.ts +17 -4
  188. package/dist/lib/tools/toolContract.js +13 -5
  189. package/dist/lib/tools/webExtractTool.d.ts +13 -10
  190. package/dist/lib/tools/webExtractTool.js +23 -55
  191. package/dist/lib/tools/webSearchTool.d.ts +2 -1
  192. package/dist/lib/tools/webSearchTool.js +4 -3
  193. package/dist/lib/tools/wikiTools.d.ts +2 -2
  194. package/dist/lib/tools/wikiTools.js +12 -12
  195. package/dist/lib/tools/xApiSearchTool.d.ts +194 -0
  196. package/dist/lib/tools/xApiSearchTool.js +583 -0
  197. package/dist/lib/tools/xSearchTool.js +1 -1
  198. package/dist/lib/wiki/agentRun.js +1 -1
  199. package/dist/lib/wiki/builder.js +21 -6
  200. package/dist/lib/wiki/dive.js +2 -2
  201. package/dist/lib/wiki/entities.d.ts +2 -2
  202. package/dist/lib/wiki/entities.js +7 -7
  203. package/dist/lib/wiki/extract.js +5 -1
  204. package/dist/lib/wiki/fill.js +5 -5
  205. package/dist/lib/wiki/format.d.ts +7 -5
  206. package/dist/lib/wiki/format.js +2 -2
  207. package/dist/lib/wiki/graph.js +2 -2
  208. package/dist/lib/wiki/lint.js +2 -2
  209. package/dist/lib/wiki/markdown.d.ts +1 -1
  210. package/dist/lib/wiki/markdown.js +6 -1
  211. package/dist/lib/wiki/pipeline.js +2 -2
  212. package/dist/lib/wiki/vault.js +2 -2
  213. package/dist/scripts/a2a_server.d.ts +17 -11
  214. package/dist/scripts/a2a_server.js +405 -1028
  215. package/dist/scripts/assistant_worker.d.ts +33 -0
  216. package/dist/scripts/assistant_worker.js +193 -0
  217. package/dist/scripts/db.d.ts +26 -0
  218. package/dist/scripts/db.js +179 -0
  219. package/dist/scripts/doctor.d.ts +23 -0
  220. package/dist/scripts/doctor.js +90 -0
  221. package/dist/scripts/init.d.ts +43 -0
  222. package/dist/scripts/init.js +152 -0
  223. package/dist/scripts/registry.d.ts +25 -0
  224. package/dist/scripts/registry.js +182 -0
  225. package/dist/scripts/skills_install.d.ts +7 -0
  226. package/dist/scripts/skills_install.js +137 -0
  227. package/dist/scripts/syndicate_chat.js +159 -276
  228. package/package.json +90 -16
  229. package/skills/README.md +74 -0
  230. package/skills/briefs/README.md +16 -0
  231. package/skills/briefs/_shared.md +16 -0
  232. package/skills/briefs/melchizedek-author.md +60 -0
  233. package/skills/briefs/melchizedek-memory.md +47 -0
  234. package/skills/briefs/melchizedek-models.md +47 -0
  235. package/skills/briefs/melchizedek-scribe.md +37 -0
  236. package/skills/briefs/melchizedek-serve.md +56 -0
  237. package/skills/briefs/melchizedek.md +69 -0
  238. package/skills/briefs/skills-readme.md +33 -0
  239. package/skills/melchizedek/SKILL.md +159 -0
  240. package/skills/melchizedek-author/SKILL.md +99 -0
  241. package/skills/melchizedek-author/templates/minimal.yaml +60 -0
  242. package/skills/melchizedek-memory/SKILL.md +138 -0
  243. package/skills/melchizedek-models/SKILL.md +137 -0
  244. package/skills/melchizedek-scribe/SKILL.md +72 -0
  245. package/skills/melchizedek-scribe/templates/brief.md +27 -0
  246. package/skills/melchizedek-serve/SKILL.md +119 -0
@@ -5,7 +5,7 @@
5
5
  * lib/wiki/graph.ts derives ONE graph: documents joined by markdown
6
6
  * links. That graph answers "what should I read next", but it cannot
7
7
  * answer "which syndicates call web_search", "what breaks without
8
- * XAI_API_KEY", or "which decision constrains the export pipeline" —
8
+ * XAI_API_KEY", or "which decision constrains the memory schema" —
9
9
  * because the things those questions name (agents, tools, models,
10
10
  * tables, env vars, decisions) are not documents. They are ENTITIES,
11
11
  * and the relations between them are typed, not hyperlinks.
@@ -146,7 +146,7 @@ export declare function lintEntityGraph(graph: EntityGraph): GraphFinding[];
146
146
  /**
147
147
  * Both stores live in a dot-directory inside the bundle: the vault walker
148
148
  * skips dotfiles, so they are invisible to every document operation, they
149
- * travel with WIKI_ROOT, and the export pipeline (which copies *.md only)
149
+ * travel with WIKI_ROOT, and publishing the bundle as markdown (*.md only)
150
150
  * cannot ship them by accident.
151
151
  */
152
152
  export declare function graphDir(wikiRoot: string): string;
@@ -5,7 +5,7 @@
5
5
  * lib/wiki/graph.ts derives ONE graph: documents joined by markdown
6
6
  * links. That graph answers "what should I read next", but it cannot
7
7
  * answer "which syndicates call web_search", "what breaks without
8
- * XAI_API_KEY", or "which decision constrains the export pipeline" —
8
+ * XAI_API_KEY", or "which decision constrains the memory schema" —
9
9
  * because the things those questions name (agents, tools, models,
10
10
  * tables, env vars, decisions) are not documents. They are ENTITIES,
11
11
  * and the relations between them are typed, not hyperlinks.
@@ -34,7 +34,7 @@
34
34
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
35
35
  import { dirname, join } from 'node:path';
36
36
  import { z } from 'zod';
37
- import { isPrivatePath } from "./format.js";
37
+ import { isPrivatePath } from './format.js';
38
38
  // ── Node vocabulary ──────────────────────────────────────────────────────────
39
39
  /**
40
40
  * What kinds of thing this graph knows about. A document keeps its OKF
@@ -84,7 +84,7 @@ export const RELATIONS = {
84
84
  // that is not a table). The generic structural relations below are left
85
85
  // open, because what "contains" or "runs" what differs per repo — a
86
86
  // syndicate contains agents here, a collection contains entries on a
87
- // site, a dyno runs a script on a worker.
87
+ // site, a worker process runs a script on a host.
88
88
  contains: {
89
89
  tier: 'extracted',
90
90
  phrase: 'contains',
@@ -149,7 +149,7 @@ export const RELATIONS = {
149
149
  runs: {
150
150
  tier: 'extracted',
151
151
  phrase: 'runs',
152
- gloss: 'an entrypoint — a script, a process, a dyno — executes this',
152
+ gloss: 'an entrypoint — a script, a process, a worker — executes this',
153
153
  },
154
154
  documents: {
155
155
  tier: 'extracted',
@@ -509,8 +509,8 @@ export function lintEntityGraph(graph) {
509
509
  // The closure rule mirrors the DOCUMENT invariant exactly: what gets
510
510
  // published is the bundle, so a public DOCUMENT may never point into
511
511
  // private knowledge. Code-to-code edges are out of scope here — a
512
- // public module importing a private one is a real fact of this repo,
513
- // sanitized by the export pipeline's patches, not by this graph.
512
+ // public module importing a private one is a real fact of a codebase,
513
+ // governed by what the codebase publishes, not by this graph.
514
514
  if (from.kind === 'doc' && !isPrivateNode(from) && isPrivateNode(to)) {
515
515
  findings.push({
516
516
  severity: 'error',
@@ -532,7 +532,7 @@ export function lintEntityGraph(graph) {
532
532
  /**
533
533
  * Both stores live in a dot-directory inside the bundle: the vault walker
534
534
  * skips dotfiles, so they are invisible to every document operation, they
535
- * travel with WIKI_ROOT, and the export pipeline (which copies *.md only)
535
+ * travel with WIKI_ROOT, and publishing the bundle as markdown (*.md only)
536
536
  * cannot ship them by accident.
537
537
  */
538
538
  export function graphDir(wikiRoot) {
@@ -69,6 +69,10 @@ const BARE_IMPORT_RE = /(?:^|\n)\s*import\s+['"]([^'"\n]+)['"]/g;
69
69
  const DYNAMIC_IMPORT_RE = /\bimport\(\s*['"]([^'"\n]+)['"]\s*\)/g;
70
70
  const ENV_DOT_RE = /process\.env\.([A-Za-z_][A-Za-z0-9_]*)/g;
71
71
  const ENV_INDEX_RE = /process\.env\[\s*['"]([A-Za-z_][A-Za-z0-9_]*)['"]\s*\]/g;
72
+ // An injected environment (`env: NodeJS.ProcessEnv = process.env`, the
73
+ // testable form) is read as `env.NAME`. Upper-case names only, so an
74
+ // ordinary object property never reads as a variable.
75
+ const ENV_PARAM_RE = /(?<![\w.])env\.([A-Z][A-Z0-9_]{2,})\b/g;
72
76
  /** Resolve a relative specifier against the importing file's repo path. */
73
77
  export function resolveLocalImport(fromRelPath, specifier) {
74
78
  if (!specifier.startsWith('.'))
@@ -93,7 +97,7 @@ export function scanModule(text, relPath) {
93
97
  specifiers.add(match[1]);
94
98
  }
95
99
  const envVars = new Set();
96
- for (const re of [ENV_DOT_RE, ENV_INDEX_RE]) {
100
+ for (const re of [ENV_DOT_RE, ENV_INDEX_RE, ENV_PARAM_RE]) {
97
101
  re.lastIndex = 0;
98
102
  let match;
99
103
  while ((match = re.exec(text)) !== null)
@@ -19,11 +19,11 @@
19
19
  */
20
20
  import { existsSync, readFileSync } from 'node:fs';
21
21
  import { resolve } from 'node:path';
22
- import { runWikiAgent, modelAvailable } from "./agentRun.js";
23
- import { llmActor } from "./format.js";
24
- import { buildGraph } from "./graph.js";
25
- import { emitFrontmatter, parseDoc, setSlotContent, slotIsUnfilled, TODO_SENTINEL, } from "./markdown.js";
26
- import { loadDoc, writeDocFile } from "./vault.js";
22
+ import { runWikiAgent, modelAvailable } from './agentRun.js';
23
+ import { llmActor } from './format.js';
24
+ import { buildGraph } from './graph.js';
25
+ import { emitFrontmatter, parseDoc, setSlotContent, slotIsUnfilled, TODO_SENTINEL, } from './markdown.js';
26
+ import { loadDoc, writeDocFile } from './vault.js';
27
27
  // ── Prompt assembly ──────────────────────────────────────────────────────────
28
28
  const WRITER_INSTRUCTION = `You write missing prose for knowledge-base documents about a software system.
29
29
  You receive one document, the id of one empty slot in it, a hint describing what belongs there, link candidates, and source excerpts.
@@ -30,12 +30,12 @@ import { z } from 'zod';
30
30
  /** OKF spec version this profile targets. Written to the root index.md. */
31
31
  export declare const OKF_VERSION = "0.2";
32
32
  /** Reserved filenames (§3.1) — never concept documents. */
33
- export declare const RESERVED_FILENAMES: readonly ["index.md", "log.md"];
33
+ export declare const RESERVED_FILENAMES: readonly ['index.md', 'log.md'];
34
34
  export declare function isReservedFilename(fileName: string): boolean;
35
35
  /**
36
36
  * The subtree that never leaves this repo. Path-based visibility: a doc is
37
- * private iff its bundle path starts with this prefix. The export pipeline
38
- * copies the bundle WITHOUT this subtree, and lint's closure rule forbids
37
+ * private iff its bundle path starts with this prefix. Whatever publishes
38
+ * the bundle copies it WITHOUT this subtree, and lint's closure rule forbids
39
39
  * docs outside it from linking into it — so the published bundle is
40
40
  * link-closed by construction (see wiki/decisions/0003.)
41
41
  */
@@ -46,7 +46,7 @@ export declare function isPrivatePath(bundlePath: string): boolean;
46
46
  * tolerate unknown types (§11), so this list steers authors without
47
47
  * rejecting anything — lint reports an unknown type as INFO, not an error.
48
48
  */
49
- export declare const CONCEPT_TYPES: readonly ["overview", "subsystem", "syndicate", "tool", "model-provider", "schema", "protocol", "runbook", "guide", "decision", "doctrine", "reference", "meta"];
49
+ export declare const CONCEPT_TYPES: readonly ['overview', 'subsystem', 'syndicate', 'tool', 'model-provider', 'schema', 'protocol', 'runbook', 'guide', 'decision', 'doctrine', 'reference', 'meta'];
50
50
  export type ConceptType = (typeof CONCEPT_TYPES)[number];
51
51
  /** `human:<id>` | `process:<id>` | `<producer>/<version>` */
52
52
  export declare const actorSchema: z.ZodString;
@@ -126,7 +126,9 @@ export declare function effectiveStatus(fm: ConceptFrontmatter): 'draft' | 'stab
126
126
  /** Stale when today >= stale_after (§5.5). `today` is YYYY-MM-DD. */
127
127
  export declare function isStale(fm: ConceptFrontmatter, today: string): boolean;
128
128
  /** Operations recorded in log.md, one `## [date] op | summary` entry each. */
129
- export declare const LOG_OPS: readonly ["init", "build", "fill", "garden", "ingest", "lint", "relate"];
129
+ export declare const LOG_OPS: readonly ['init', 'build', 'fill', 'garden', 'ingest', 'lint',
130
+ /** One asserted relation added to the entity graph (lib/wiki/entities.ts). */
131
+ 'relate'];
130
132
  export type LogOp = (typeof LOG_OPS)[number];
131
133
  export declare const LOG_ENTRY_RE: RegExp;
132
134
  export declare function formatLogEntry(date: string, op: LogOp, summary: string, detail?: string): string;
@@ -37,8 +37,8 @@ export function isReservedFilename(fileName) {
37
37
  }
38
38
  /**
39
39
  * The subtree that never leaves this repo. Path-based visibility: a doc is
40
- * private iff its bundle path starts with this prefix. The export pipeline
41
- * copies the bundle WITHOUT this subtree, and lint's closure rule forbids
40
+ * private iff its bundle path starts with this prefix. Whatever publishes
41
+ * the bundle copies it WITHOUT this subtree, and lint's closure rule forbids
42
42
  * docs outside it from linking into it — so the published bundle is
43
43
  * link-closed by construction (see wiki/decisions/0003.)
44
44
  */
@@ -14,8 +14,8 @@
14
14
  * index could. `wiki:build --graph` merely snapshots this derivation for
15
15
  * visualisation.
16
16
  */
17
- import { effectiveStatus, trustTier } from "./format.js";
18
- import { lookupTarget, resolveLinkTarget, } from "./vault.js";
17
+ import { effectiveStatus, trustTier } from './format.js';
18
+ import { lookupTarget, resolveLinkTarget, } from './vault.js';
19
19
  // ── Construction ─────────────────────────────────────────────────────────────
20
20
  export function buildGraph(vault) {
21
21
  const nodes = new Map();
@@ -25,8 +25,8 @@
25
25
  * itself know any private vocabulary.
26
26
  */
27
27
  import { posix } from 'node:path';
28
- import { CONCEPT_TYPES, isStale, LOG_ENTRY_RE, } from "./format.js";
29
- import { docsInDirectory, lookupTarget, resolveLinkTarget, } from "./vault.js";
28
+ import { CONCEPT_TYPES, isStale, LOG_ENTRY_RE, } from './format.js';
29
+ import { docsInDirectory, lookupTarget, resolveLinkTarget, } from './vault.js';
30
30
  function report(findings) {
31
31
  const errors = findings.filter((f) => f.severity === 'error').length;
32
32
  const warnings = findings.filter((f) => f.severity === 'warning').length;
@@ -118,7 +118,7 @@ export declare function generatedBlock(id: string, source: string, content: stri
118
118
  /** Splice `content` between a slot's markers. Null when the slot is absent. */
119
119
  export declare function setSlotContent(raw: string, slotId: string, content: string): string | null;
120
120
  /** Splice `content` between a generated block's markers. Null when absent. */
121
- export declare function setGeneratedContent(raw: string, blockId: string, content: string): string | null;
121
+ export declare function setGeneratedContent(raw: string, blockId: string, content: string, source?: string): string | null;
122
122
  /**
123
123
  * Insert a log entry newest-first: after the preamble (everything before the
124
124
  * first `## [` entry), before existing entries. log.md stays chronologically
@@ -304,12 +304,17 @@ export function setSlotContent(raw, slotId, content) {
304
304
  ].join('\n');
305
305
  }
306
306
  /** Splice `content` between a generated block's markers. Null when absent. */
307
- export function setGeneratedContent(raw, blockId, content) {
307
+ export function setGeneratedContent(raw, blockId, content, source) {
308
308
  const doc = parseDoc(raw);
309
309
  const block = doc.generated.find((b) => b.id === blockId);
310
310
  if (!block)
311
311
  return null;
312
312
  const lines = raw.split('\n');
313
+ // A source that moved (a file relocated in the repo) rewrites the opening
314
+ // marker too, so the attribution never outlives the file it names.
315
+ if (source !== undefined && block.source !== source) {
316
+ lines[block.startLine - 1] = generatedBlock(blockId, source, '').split('\n')[0];
317
+ }
313
318
  return [
314
319
  ...lines.slice(0, block.startLine),
315
320
  content.trim(),
@@ -15,8 +15,8 @@
15
15
  * caller extracted from its own truth. This module never guesses what a
16
16
  * repo contains.
17
17
  */
18
- import { buildEntityGraph, entityStats, lintEntityGraph, loadRelations, NODE_KINDS, relationEdges, RELATIONS, writeSnapshot, } from "./entities.js";
19
- import { table } from "./markdown.js";
18
+ import { buildEntityGraph, entityStats, lintEntityGraph, loadRelations, NODE_KINDS, relationEdges, RELATIONS, writeSnapshot, } from './entities.js';
19
+ import { table } from './markdown.js';
20
20
  /**
21
21
  * Merge the derived layer with the asserted relations and (unless this is a
22
22
  * lint-only run) refresh the snapshot the wiki tools read. The snapshot
@@ -19,8 +19,8 @@
19
19
  */
20
20
  import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync, } from 'node:fs';
21
21
  import { dirname, join, posix, resolve, sep } from 'node:path';
22
- import { conceptFrontmatterSchema, isPrivatePath, isReservedFilename, } from "./format.js";
23
- import { parseDoc } from "./markdown.js";
22
+ import { conceptFrontmatterSchema, isPrivatePath, isReservedFilename, } from './format.js';
23
+ import { parseDoc } from './markdown.js';
24
24
  // ── Bundle root ──────────────────────────────────────────────────────────────
25
25
  /**
26
26
  * WIKI_ROOT env var wins; default is `<cwd>/wiki`. The default used to be
@@ -1,12 +1,18 @@
1
1
  #!/usr/bin/env node
2
- /** One human-readable line naming WHY a turn failed, for the failed task's
3
- * status message — the text the Discord surface renders verbatim. Provider
4
- * errors sometimes arrive as a raw JSON blob (Gemini ApiError:
5
- * `{"error":{"code":503,"message":"...","status":"UNAVAILABLE"}}`), so the
6
- * inner message is dug out before falling back to the string itself. An
7
- * empty message keeps the old pointer at the server logs. */
8
- export declare function describeTurnError(error: {
9
- code: string;
10
- message: string;
11
- }): string;
12
- export declare function startServer(syndicateName?: string): Promise<void>;
2
+ import type { Server } from 'node:http';
3
+ import { createA2AApp } from '../lib/a2a/app.ts';
4
+ export { describeTurnError } from '../lib/a2a/executor.ts';
5
+ /**
6
+ * What a deployment adds on top of the environment-driven server: its own
7
+ * routes and any createA2AApp option. A private deployment imports
8
+ * `startServer` from `melchizedek-agents/server`, registers its tools with
9
+ * `registerTool`, and passes its routes here, so it inherits every
10
+ * environment variable this file reads (ADR 0022).
11
+ */
12
+ export interface ServerExtensions {
13
+ /** Mounted after authentication, before the built-in routes. */
14
+ routes?: (app: import('express').Express) => void;
15
+ /** Any other createA2AApp option; wins over what the environment sets. */
16
+ options?: Partial<Parameters<typeof createA2AApp>[0]>;
17
+ }
18
+ export declare function startServer(syndicateName?: string, extensions?: ServerExtensions): Promise<Server>;