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
@@ -19,7 +19,7 @@
19
19
  * Default Gemini model used by the A2A server when no model is specified
20
20
  * in the caller's YAML or request.
21
21
  *
22
- * Use gemini-3.1-flash-lite for lightweight/cost-efficient loads (subagents,
22
+ * Use gemini-3.5-flash-lite for lightweight/cost-efficient loads (subagents,
23
23
  * data retrieval). Use gemini-3.8-flash in YAML for production orchestrators.
24
24
  *
25
25
  * NOTE: gemini-2.5-flash is known incompatible with this framework's
@@ -28,7 +28,7 @@
28
28
  *
29
29
  * Supported Gemini identifiers: https://ai.google.dev/gemini-api/docs/models
30
30
  */
31
- export declare const DEFAULT_GEMINI_MODEL = "gemini-3.1-flash-lite";
31
+ export declare const DEFAULT_GEMINI_MODEL = "gemini-3.5-flash-lite";
32
32
  /**
33
33
  * Default Claude model used by the A2A server when a claude-* model is
34
34
  * requested but no specific identifier is provided.
@@ -47,14 +47,14 @@ export declare const DEFAULT_GPT_MODEL = "gpt-5-mini";
47
47
  /**
48
48
  * Default xAI model used when a grok-* model is requested but no specific
49
49
  * identifier is provided. Requires XAI_API_KEY (lib/models/grokLlm.ts).
50
- * grok-4.5 is a reasoning model (reasoning cannot be disabled); it returns
50
+ * grok-4.7 is a reasoning model (reasoning cannot be disabled); it returns
51
51
  * reasoning summaries, which the adapter surfaces as thinking.
52
52
  */
53
- export declare const DEFAULT_GROK_MODEL = "grok-4.5";
53
+ export declare const DEFAULT_GROK_MODEL = "grok-4.7";
54
54
  /**
55
- * Reasoning effort sent with grok-4.5 requests: 'low' | 'medium' | 'high'
56
- * (xAI's own default is 'high'). Pinned to MEDIUM — deeper than low
57
- * without high's latency and token cost. Source: docs.x.ai › Model
55
+ * Reasoning effort sent with grok-4.5/4.7 requests: 'low' | 'medium' | 'high'
56
+ * (xAI's own default is 'high'; 4.7 adds 'xhigh'). Pinned to MEDIUM — deeper
57
+ * than low without high's latency and token cost. Source: docs.x.ai › Model
58
58
  * capabilities › Text › Reasoning › Effort levels. Older grok ids don't
59
59
  * accept the param and never receive it (lib/models/grokLlm.ts).
60
60
  */
@@ -20,7 +20,7 @@
20
20
  * Default Gemini model used by the A2A server when no model is specified
21
21
  * in the caller's YAML or request.
22
22
  *
23
- * Use gemini-3.1-flash-lite for lightweight/cost-efficient loads (subagents,
23
+ * Use gemini-3.5-flash-lite for lightweight/cost-efficient loads (subagents,
24
24
  * data retrieval). Use gemini-3.8-flash in YAML for production orchestrators.
25
25
  *
26
26
  * NOTE: gemini-2.5-flash is known incompatible with this framework's
@@ -29,7 +29,7 @@
29
29
  *
30
30
  * Supported Gemini identifiers: https://ai.google.dev/gemini-api/docs/models
31
31
  */
32
- export const DEFAULT_GEMINI_MODEL = 'gemini-3.1-flash-lite';
32
+ export const DEFAULT_GEMINI_MODEL = 'gemini-3.5-flash-lite';
33
33
  /**
34
34
  * Default Claude model used by the A2A server when a claude-* model is
35
35
  * requested but no specific identifier is provided.
@@ -48,14 +48,14 @@ export const DEFAULT_GPT_MODEL = 'gpt-5-mini';
48
48
  /**
49
49
  * Default xAI model used when a grok-* model is requested but no specific
50
50
  * identifier is provided. Requires XAI_API_KEY (lib/models/grokLlm.ts).
51
- * grok-4.5 is a reasoning model (reasoning cannot be disabled); it returns
51
+ * grok-4.7 is a reasoning model (reasoning cannot be disabled); it returns
52
52
  * reasoning summaries, which the adapter surfaces as thinking.
53
53
  */
54
- export const DEFAULT_GROK_MODEL = 'grok-4.5';
54
+ export const DEFAULT_GROK_MODEL = 'grok-4.7';
55
55
  /**
56
- * Reasoning effort sent with grok-4.5 requests: 'low' | 'medium' | 'high'
57
- * (xAI's own default is 'high'). Pinned to MEDIUM — deeper than low
58
- * without high's latency and token cost. Source: docs.x.ai › Model
56
+ * Reasoning effort sent with grok-4.5/4.7 requests: 'low' | 'medium' | 'high'
57
+ * (xAI's own default is 'high'; 4.7 adds 'xhigh'). Pinned to MEDIUM — deeper
58
+ * than low without high's latency and token cost. Source: docs.x.ai › Model
59
59
  * capabilities › Text › Reasoning › Effort levels. Older grok ids don't
60
60
  * accept the param and never receive it (lib/models/grokLlm.ts).
61
61
  */
@@ -0,0 +1,145 @@
1
+ /**
2
+ * lib/doctor.ts — the onboarding walkthrough, generated from the truth.
3
+ *
4
+ * WHY this file exists:
5
+ * The question every newcomer asks — "which keys do I need?" — used to be
6
+ * answered by prose in four documents that drift. The doctor answers it
7
+ * from the YAMLs and the environment: every syndicate the loader can see,
8
+ * every agent's model, the provider that id routes to, whether that path
9
+ * is funded (direct key, gateway, or local), and which declared
10
+ * server-side tools the path will drop. Then it says exactly what to set,
11
+ * grouped by how much each variable unlocks.
12
+ *
13
+ * WHAT IT NEVER DOES:
14
+ * - edit .env or any file;
15
+ * - send a request (demo_model_optionality.ts is the live proof);
16
+ * - print a key VALUE. Only names of env vars appear (secrets-hygiene).
17
+ *
18
+ * The routing and capability judgments are not re-implemented here: they
19
+ * come from lib/models/gateway.ts and lib/models/capabilities.ts, the same
20
+ * modules the registry and the A2A server use, so the report cannot
21
+ * disagree with what a run would do.
22
+ */
23
+ import type { Platform } from './models/endpoints.ts';
24
+ import type { CapabilityGap, CapabilityReport } from './models/capabilities.ts';
25
+ import type { ProviderId } from './models/providerMap.ts';
26
+ /**
27
+ * What a file costs to run: `keyless` (all Ollama), a single provider's id
28
+ * when every agent shares one (`gemini`, `anthropic`, `openai`, `xai` — one
29
+ * key runs it), or `multi-provider` when the models mix.
30
+ */
31
+ export type Tier = 'keyless' | Exclude<ProviderId, 'ollama'> | 'multi-provider';
32
+ export interface DoctorRow {
33
+ /** Agent name as declared; nested syndicates read "Parent › Child". */
34
+ agent: string;
35
+ role: 'orchestrator' | 'subagent';
36
+ model: string;
37
+ report: CapabilityReport;
38
+ /**
39
+ * What this agent's YAML asks of its model that the resolved path does not
40
+ * fully give it (lib/models/capabilities.ts, ADR 0019). Gaps never block a
41
+ * syndicate; they are printed so a degraded role is not a surprise.
42
+ */
43
+ gaps: CapabilityGap[];
44
+ }
45
+ export type VerdictState = 'ready' | 'ready-local' | 'via-gateway' | 'blocked';
46
+ export interface DoctorSyndicate {
47
+ /** Path relative to the agents dir, e.g. "examples/council.yaml". */
48
+ file: string;
49
+ name: string;
50
+ tier: Tier;
51
+ /** The `# tier:` header comment, when the file declares one. */
52
+ declaredTier?: string;
53
+ rows: DoctorRow[];
54
+ verdict: {
55
+ state: VerdictState;
56
+ detail: string;
57
+ };
58
+ /** `npm run <script>` when package.json has an alias for this file. */
59
+ runCommand?: string;
60
+ /**
61
+ * A load, parse or validation error (every problem, one per line). Rows
62
+ * are empty when the file itself failed; a nested failure keeps the rows
63
+ * that did resolve.
64
+ */
65
+ error?: string;
66
+ /**
67
+ * Long-term memory only: the namespace its facts are filed under
68
+ * (ADR 0020), and what is wrong with it, if anything.
69
+ */
70
+ memory?: {
71
+ namespace: string;
72
+ declared: boolean;
73
+ issue?: string;
74
+ };
75
+ }
76
+ export interface Unlock {
77
+ env: string;
78
+ provider: ProviderId;
79
+ label: string;
80
+ consoleUrl: string;
81
+ /** Syndicates this one variable would move from blocked to ready. */
82
+ syndicates: string[];
83
+ }
84
+ export interface DoctorResult {
85
+ agentsDir: string;
86
+ syndicates: DoctorSyndicate[];
87
+ unlocks: Unlock[];
88
+ gateway: {
89
+ id: string;
90
+ label: string;
91
+ usable: boolean;
92
+ problem?: string;
93
+ } | null;
94
+ /** Every provider not on its default endpoint: a cloud platform or a proxy (ADR 0023). */
95
+ endpoints: DoctorEndpoint[];
96
+ counts: Record<VerdictState, number>;
97
+ }
98
+ export interface DoctorEndpoint {
99
+ provider: ProviderId;
100
+ platform: Platform | 'invalid';
101
+ label: string;
102
+ /** How it authenticates; a cloud credential chain is not exercised by the doctor. */
103
+ credential: string;
104
+ /** The platform SDK it needs beyond the provider's own, and whether it resolves. */
105
+ sdk?: {
106
+ module: string;
107
+ installed: boolean;
108
+ };
109
+ problems: string[];
110
+ /** Cloud platforms are tested against mocks only (ADR 0023). */
111
+ liveVerified: boolean;
112
+ }
113
+ /** One row per provider that is not on its vendor's public API with an env key. */
114
+ export declare function endpointRows(): DoctorEndpoint[];
115
+ export declare const CONSOLE_URLS: Record<ProviderId, string>;
116
+ /**
117
+ * Every syndicate file the loader can see: the root (this deployment's
118
+ * live syndicates), examples/ (the starter pack) and templates/ (the
119
+ * production templates). The schema document
120
+ * and evals/ are skipped — one is not a syndicate, the others exist to be
121
+ * measured, not served (config/agents/README.md).
122
+ */
123
+ export declare function listSyndicateFiles(agentsDir: string): string[];
124
+ /** The `# tier:` comment in the file's leading comment block, if any. */
125
+ export declare function declaredTierOf(filePath: string): string | undefined;
126
+ /** The tier the models actually imply. */
127
+ export declare function tierOf(rows: readonly DoctorRow[]): Tier;
128
+ /** `npm run <alias>` for a file, read from package.json scripts. */
129
+ export declare function runCommandFor(file: string, scripts: Record<string, string> | undefined): string | undefined;
130
+ export declare function diagnoseSyndicate(file: string, agentsDir: string, scripts?: Record<string, string>): DoctorSyndicate;
131
+ /**
132
+ * ADR 0020: a long-term syndicate declares the namespace its facts are filed
133
+ * under, and two syndicates share memory only by declaring the same one.
134
+ * Checked for the deployment's own files (the agents-dir root). The shipped
135
+ * examples and templates are copied before use, and a copy gets its own
136
+ * namespace from `npm run doctor -- --fix-namespaces <file>`.
137
+ */
138
+ export declare function flagMemoryNamespaces(syndicates: DoctorSyndicate[]): void;
139
+ export declare function runDoctor(options?: {
140
+ agentsDir?: string;
141
+ scripts?: Record<string, string>;
142
+ }): DoctorResult;
143
+ export declare function renderDoctor(result: DoctorResult, opts?: {
144
+ color?: boolean;
145
+ }): string;