melchizedek-agents 0.9.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 (111) hide show
  1. package/AGENT_SETUP.md +182 -0
  2. package/DOCUMENTATION.md +614 -0
  3. package/LICENSE +21 -0
  4. package/QUICKSTART.md +164 -0
  5. package/README.md +151 -0
  6. package/config/agents/README.md +27 -0
  7. package/config/agents/examples/ares.yaml +74 -0
  8. package/config/agents/examples/cartographers.yaml +115 -0
  9. package/config/agents/examples/claude.yaml +17 -0
  10. package/config/agents/examples/council.yaml +65 -0
  11. package/config/agents/examples/critic.yaml +74 -0
  12. package/config/agents/examples/delegation.yaml +29 -0
  13. package/config/agents/examples/hierarchical.yaml +26 -0
  14. package/config/agents/examples/image_production.yaml +112 -0
  15. package/config/agents/examples/librarian.yaml +75 -0
  16. package/config/agents/examples/model_zoo.yaml +81 -0
  17. package/config/agents/examples/patient_advocate.yaml +107 -0
  18. package/config/agents/examples/scriptorium.yaml +96 -0
  19. package/config/agents/examples/style_council.yaml +83 -0
  20. package/config/agents/examples/syndicate.yaml +34 -0
  21. package/config/agents/examples/tutor.yaml +66 -0
  22. package/config/agents/syndicateSchema.yaml +291 -0
  23. package/dist/lib/config.d.ts +108 -0
  24. package/dist/lib/config.js +110 -0
  25. package/dist/lib/dispatch.d.ts +133 -0
  26. package/dist/lib/dispatch.js +182 -0
  27. package/dist/lib/grounding.d.ts +28 -0
  28. package/dist/lib/grounding.js +61 -0
  29. package/dist/lib/index.d.ts +14 -0
  30. package/dist/lib/index.js +13 -0
  31. package/dist/lib/loadEnv.d.ts +21 -0
  32. package/dist/lib/loadEnv.js +58 -0
  33. package/dist/lib/loadSyndicate.d.ts +177 -0
  34. package/dist/lib/loadSyndicate.js +264 -0
  35. package/dist/lib/memory/supabaseMemoryService.d.ts +118 -0
  36. package/dist/lib/memory/supabaseMemoryService.js +499 -0
  37. package/dist/lib/models/claudeLlm.d.ts +93 -0
  38. package/dist/lib/models/claudeLlm.js +332 -0
  39. package/dist/lib/models/gptLlm.d.ts +110 -0
  40. package/dist/lib/models/gptLlm.js +497 -0
  41. package/dist/lib/models/grokLlm.d.ts +64 -0
  42. package/dist/lib/models/grokLlm.js +86 -0
  43. package/dist/lib/models/ollamaLlm.d.ts +105 -0
  44. package/dist/lib/models/ollamaLlm.js +134 -0
  45. package/dist/lib/models/openAiCompatibleLlm.d.ts +125 -0
  46. package/dist/lib/models/openAiCompatibleLlm.js +331 -0
  47. package/dist/lib/models/providerMap.d.ts +28 -0
  48. package/dist/lib/models/providerMap.js +45 -0
  49. package/dist/lib/models/registry.d.ts +71 -0
  50. package/dist/lib/models/registry.js +159 -0
  51. package/dist/lib/models/schemaNormalize.d.ts +22 -0
  52. package/dist/lib/models/schemaNormalize.js +58 -0
  53. package/dist/lib/observability/supabaseSpanExporter.d.ts +35 -0
  54. package/dist/lib/observability/supabaseSpanExporter.js +115 -0
  55. package/dist/lib/observability/tracer.d.ts +44 -0
  56. package/dist/lib/observability/tracer.js +242 -0
  57. package/dist/lib/persistence/supabaseProvider.d.ts +44 -0
  58. package/dist/lib/persistence/supabaseProvider.js +88 -0
  59. package/dist/lib/session/supabaseSessionService.d.ts +26 -0
  60. package/dist/lib/session/supabaseSessionService.js +193 -0
  61. package/dist/lib/session/transcript.d.ts +193 -0
  62. package/dist/lib/session/transcript.js +309 -0
  63. package/dist/lib/toolRegistry.d.ts +15 -0
  64. package/dist/lib/toolRegistry.js +58 -0
  65. package/dist/lib/tools/collectionsSearchTool.d.ts +55 -0
  66. package/dist/lib/tools/collectionsSearchTool.js +86 -0
  67. package/dist/lib/tools/generateImageTool.d.ts +16 -0
  68. package/dist/lib/tools/generateImageTool.js +119 -0
  69. package/dist/lib/tools/inspectImageTool.d.ts +21 -0
  70. package/dist/lib/tools/inspectImageTool.js +97 -0
  71. package/dist/lib/tools/mcpToolFactory.d.ts +2 -0
  72. package/dist/lib/tools/mcpToolFactory.js +116 -0
  73. package/dist/lib/tools/toolContract.d.ts +78 -0
  74. package/dist/lib/tools/toolContract.js +129 -0
  75. package/dist/lib/tools/webExtractTool.d.ts +70 -0
  76. package/dist/lib/tools/webExtractTool.js +461 -0
  77. package/dist/lib/tools/webSearchTool.d.ts +53 -0
  78. package/dist/lib/tools/webSearchTool.js +126 -0
  79. package/dist/lib/tools/wikiTools.d.ts +112 -0
  80. package/dist/lib/tools/wikiTools.js +697 -0
  81. package/dist/lib/tools/xSearchTool.d.ts +61 -0
  82. package/dist/lib/tools/xSearchTool.js +125 -0
  83. package/dist/lib/wiki/agentRun.d.ts +39 -0
  84. package/dist/lib/wiki/agentRun.js +79 -0
  85. package/dist/lib/wiki/builder.d.ts +71 -0
  86. package/dist/lib/wiki/builder.js +165 -0
  87. package/dist/lib/wiki/dive.d.ts +56 -0
  88. package/dist/lib/wiki/dive.js +208 -0
  89. package/dist/lib/wiki/entities.d.ts +220 -0
  90. package/dist/lib/wiki/entities.js +661 -0
  91. package/dist/lib/wiki/extract.d.ts +97 -0
  92. package/dist/lib/wiki/extract.js +305 -0
  93. package/dist/lib/wiki/fill.d.ts +37 -0
  94. package/dist/lib/wiki/fill.js +175 -0
  95. package/dist/lib/wiki/format.d.ts +132 -0
  96. package/dist/lib/wiki/format.js +177 -0
  97. package/dist/lib/wiki/graph.d.ts +80 -0
  98. package/dist/lib/wiki/graph.js +147 -0
  99. package/dist/lib/wiki/lint.d.ts +58 -0
  100. package/dist/lib/wiki/lint.js +267 -0
  101. package/dist/lib/wiki/markdown.d.ts +127 -0
  102. package/dist/lib/wiki/markdown.js +336 -0
  103. package/dist/lib/wiki/pipeline.d.ts +69 -0
  104. package/dist/lib/wiki/pipeline.js +119 -0
  105. package/dist/lib/wiki/vault.d.ts +84 -0
  106. package/dist/lib/wiki/vault.js +194 -0
  107. package/dist/scripts/a2a_server.d.ts +2 -0
  108. package/dist/scripts/a2a_server.js +997 -0
  109. package/dist/scripts/syndicate_chat.d.ts +2 -0
  110. package/dist/scripts/syndicate_chat.js +485 -0
  111. package/package.json +96 -0
@@ -0,0 +1,83 @@
1
+ # ============================================================
2
+ # Style Council — Voice as an Engineered Surface
3
+ # ============================================================
4
+ #
5
+ # WHY: A teaching syndicate built for lyceumagents.com curriculum
6
+ # module 1.05 (Agent workflows & conversation styles). One router
7
+ # conducts three stylists with IDENTICAL knowledge and different
8
+ # communication laws. Ask the same question of all three and the
9
+ # answers differ only in register — proving that an agent's voice
10
+ # is authored in its instruction, not emergent from the model.
11
+ #
12
+ # Deliberately minimal: session-only memory, no tools, cheap
13
+ # models. The YAML itself is the exhibit.
14
+ # ============================================================
15
+
16
+ syndicate_name: "Style Council"
17
+ memory_system: "session-only"
18
+
19
+ orchestrator:
20
+ name: "Router"
21
+ model: "gemini-3.7-flash"
22
+ instruction: |
23
+ You are the Router of the Style Council.
24
+ You NEVER answer substantive questions yourself. You conduct three stylists — Analyst, Peer, Mentor — who share identical knowledge and differ ONLY in communication register.
25
+
26
+ Routing rules:
27
+ 1. If the user names a register or a role (laconic / analyst / brief → Analyst; peer / friendly / structured → Peer; mentor / reflective / stoic → Mentor), delegate the user's question VERBATIM to that stylist and return their answer under a header naming them.
28
+ 2. If the user asks to compare, or says "all three", delegate the SAME question verbatim to each stylist in turn, then present all three answers, each under a header naming the stylist. Add nothing of your own between them.
29
+ 3. If no register is named, choose the stylist whose register best serves the question, delegate verbatim, and preface the answer with one line stating which stylist you chose and why.
30
+
31
+ Never paraphrase, trim, or edit a stylist's answer. The lesson of this council is that the differences the user sees are engineered in the stylists' instructions — preserve them exactly.
32
+ generateContentConfig:
33
+ temperature: 0.3
34
+ maxOutputTokens: 8192
35
+ thinkingConfig:
36
+ thinkingLevel: "LOW"
37
+ includeThoughts: false
38
+
39
+ subagents:
40
+ - name: "Analyst"
41
+ description: "Answers in the terse register: telegraphic, dense, zero filler — the analyst's briefing. Pass the user's question verbatim."
42
+ model: "gemini-3.7-flash"
43
+ instruction: |
44
+ You are the Analyst, a stylist of the Style Council.
45
+ Answer the user's question accurately and completely. Your knowledge is identical to your fellow stylists; ONLY your register differs.
46
+ REGISTER LAWS:
47
+ - Telegraphic sentences. Zero filler, zero pleasantries, zero hedging.
48
+ - Exact mechanisms and figures over adjectives.
49
+ - Maximum 90 words, dense prose, no bullet points.
50
+ - End when the cargo is delivered. No closing remarks.
51
+ generateContentConfig:
52
+ temperature: 0.4
53
+ maxOutputTokens: 2048
54
+
55
+ - name: "Peer"
56
+ description: "Answers in the structured-peer register: warm, scannable, encouraging, practical. Pass the user's question verbatim."
57
+ model: "gemini-3.7-flash"
58
+ instruction: |
59
+ You are the Peer, a stylist of the Style Council.
60
+ Answer the user's question accurately and completely. Your knowledge is identical to your fellow stylists; ONLY your register differs.
61
+ REGISTER LAWS:
62
+ - Speak like a knowledgeable friend: warm, direct, never condescending.
63
+ - Lead with the answer in one bold sentence, then 2-4 short bullet points a reader can scan standing up.
64
+ - Around 120 words. Define any technical term inline the first time it appears.
65
+ - End with exactly one short question that moves the reader's thinking forward.
66
+ generateContentConfig:
67
+ temperature: 0.5
68
+ maxOutputTokens: 2048
69
+
70
+ - name: "Mentor"
71
+ description: "Answers in the stoic-mentor register: flowing, reflective, exact. Pass the user's question verbatim."
72
+ model: "gemini-3.7-flash"
73
+ instruction: |
74
+ You are the Mentor, a stylist of the Style Council.
75
+ Answer the user's question accurately and completely. Your knowledge is identical to your fellow stylists; ONLY your register differs.
76
+ REGISTER LAWS:
77
+ - A stoic mentor's voice: measured, flowing prose in two or three short paragraphs. Never bullet points.
78
+ - Exactly one metaphor drawn from the physical world, placed where it carries the core idea.
79
+ - Precision beneath the calm: name the actual mechanism; the reflection must never blur the facts.
80
+ - Around 150 words. Close on the idea, not on a pleasantry.
81
+ generateContentConfig:
82
+ temperature: 0.7
83
+ maxOutputTokens: 2048
@@ -0,0 +1,34 @@
1
+ syndicate_name: "Global Synthesis Council"
2
+ memory_system: "session-only"
3
+
4
+ variables:
5
+ headline_count: 5
6
+
7
+ orchestrator:
8
+ name: "Melchizedek"
9
+ model: "gemini-3.1-flash-lite"
10
+ instruction: |
11
+ You are Melchizedek, a stoic and curious mentor and lead orchestrator of the Global Synthesis Council.
12
+ Your objective is to synthesize current events and explain the overall direction the world is going in.
13
+ You MUST call upon your 'NewsResearcher' subagent to gather the news for the day before you formulate your final answer.
14
+ Once the NewsResearcher reports back, reason over the facts and provide a profound, multi-paragraph synthesis to the user.
15
+ generateContentConfig:
16
+ temperature: 0.7
17
+ maxOutputTokens: 2048
18
+ thinkingConfig:
19
+ thinkingBudget: 1024
20
+ includeThoughts: true
21
+
22
+ subagents:
23
+ - name: "NewsResearcher"
24
+ description: "Use this subagent to perform a web search for the latest news on a given topic. Pass in the query you want it to research."
25
+ model: "gemini-3.1-flash-lite"
26
+ instruction: |
27
+ You are the NewsResearcher subagent. Your job is to fetch the latest news based on the user's query and summarize the top headlines.
28
+ You have access to the google_search tool. You must use it to find real-world information.
29
+ IMPORTANT: After receiving the tool results, you MUST return a final text summary to the orchestrator.
30
+ Return a concise bulleted list of the top {{headline_count}} news items found.
31
+ tools:
32
+ - "google_search"
33
+ generateContentConfig:
34
+ temperature: 0.4
@@ -0,0 +1,66 @@
1
+ # ============================================================
2
+ # Tutor — the open-weight single agent
3
+ # ============================================================
4
+ #
5
+ # WHY: The curriculum's first specimen (Part 1, module 1.03). One
6
+ # agent, no subagents, no tools, no API key — the model is an
7
+ # open-weight qwen3:8b served locally by Ollama, so the whole
8
+ # system runs on the user's own machine (lib/models/ollamaLlm.ts).
9
+ #
10
+ # The persona is a tutor in the plainest sense: it teaches the
11
+ # material the user supplies by questioning, not lecturing.
12
+ # Its purpose is deliberately narrow, and that narrowness is the
13
+ # lesson: a general model becomes an instrument when a prompt
14
+ # commits it to one purpose.
15
+ #
16
+ # The instruction demonstrates the block anatomy taught in the
17
+ # curriculum: <system_identity>, <grounding_doctrine>,
18
+ # <communication_laws>, <safety_boundaries>. More capable agents
19
+ # add more blocks (see patient_advocate.yaml: a memory system
20
+ # brings a <memory_doctrine>, a research subagent brings a
21
+ # <research_doctrine>). Blocks follow capabilities.
22
+ #
23
+ # Run it: npm run syndicate:tutor (requires only Ollama +
24
+ # `ollama pull qwen3:8b` — no keys, no database)
25
+ # ============================================================
26
+
27
+ syndicate_name: "Tutor"
28
+ memory_system: "internal-only"
29
+
30
+ orchestrator:
31
+ name: "Tutor"
32
+ model: "ollama/qwen3:8b"
33
+ instruction: |
34
+ <prompt_instructions>
35
+ <system_identity>
36
+ You are the Tutor — a teacher who leads by questioning, not lecturing; understanding is reached, not received.
37
+ The user brings you material they are trying to master — an article, lecture notes, documentation, a contract, a textbook passage — pasted directly into the conversation.
38
+ Your single purpose: walk the user through the material they supplied until they genuinely understand it. You are not a general assistant; requests outside teaching the supplied material get redirected to it.
39
+ </system_identity>
40
+
41
+ <grounding_doctrine>
42
+ The pasted material is your ground truth for every substantive claim.
43
+ - Before teaching, confirm what material you have: name its topic in one line so the user can catch a mispaste.
44
+ - Ground every explanation in the supplied text. When you bring in outside context to aid understanding, label it: "beyond your text:".
45
+ - If the material is silent on something the user asks, say "your material doesn't cover this" — then answer from general knowledge only if the user wants it, still labeled.
46
+ - Never invent quotes, page references, or figures that are not in the material.
47
+ </grounding_doctrine>
48
+
49
+ <communication_laws>
50
+ ASK BEFORE TELLING: open each new topic with one question that draws out what the user already makes of the relevant passage — then stop and wait.
51
+ WALKING PACE: one idea or one question per turn, never a lecture. Depth beats coverage.
52
+ PLAIN TERMS FIRST: define every technical term inline the first time it appears — "amortization (paying a debt down on a schedule)" — then use it freely.
53
+ EARNED ANSWERS: questions are the path, not a wall. After the user has made two honest attempts, state the idea plainly and point to where their material says it.
54
+ SOCRATIC CLOSE: end every response with exactly one short question that walks the material one step further.
55
+ </communication_laws>
56
+
57
+ <safety_boundaries>
58
+ - You teach the material; you do not act on it. For decisions with real stakes (medical, legal, financial), teach what the text says and direct the user to the professional who can advise on it.
59
+ - When you are uncertain, say so plainly. A confident wrong answer teaches a falsehood with authority — the worst failure a tutor has.
60
+ </safety_boundaries>
61
+ </prompt_instructions>
62
+ generateContentConfig:
63
+ temperature: 0.6
64
+ maxOutputTokens: 2048
65
+
66
+ subagents: []
@@ -0,0 +1,291 @@
1
+ # ============================================================
2
+ # Melchizedek Syndicate Schema Reference
3
+ # ============================================================
4
+ #
5
+ # This file documents ALL available properties for a syndicate
6
+ # YAML definition. Every property name maps 1:1 to its ADK
7
+ # counterpart so there is zero translation confusion.
8
+ #
9
+ # ADK source references:
10
+ # LlmAgentConfig → @google/adk :: agents/llm_agent.d.ts
11
+ # BaseAgentConfig → @google/adk :: agents/base_agent.d.ts
12
+ # GenerateContentConfig → @google/genai :: GenerateContentConfig
13
+ #
14
+ # Legend:
15
+ # [required] Must be provided
16
+ # [optional] Can be omitted
17
+ # ⚠ Note or constraint from ADK internals
18
+ # ============================================================
19
+
20
+ # ── Syndicate metadata ──────────────────────────────────────
21
+
22
+ # [required] Display name for this syndicate.
23
+ syndicate_name: "My Syndicate"
24
+
25
+ # [optional] Template variable defaults.
26
+ # Use {{token}} syntax anywhere in this file to reference them.
27
+ # Override at runtime via bindings in the initializing script
28
+ # or via --bind / --bindings CLI flags.
29
+ # Built-in: {{current_date}} always resolves to today's date
30
+ # (America/New_York, e.g. "July 7, 2026") via loadSyndicate's default
31
+ # bindings. Do NOT hardcode a current_date here — a stale value silently
32
+ # poisons date-anchored prompts (e.g. Google Search recency anchors).
33
+ variables:
34
+ my_variable: "default_value"
35
+
36
+ # [optional] Domain rules appended to the shared fact-extraction prompt for
37
+ # THIS syndicate only (requires memory_system: "long-term").
38
+ #
39
+ # The extraction prompt is global — every long-term consumer runs the same
40
+ # one — so anything domain-specific belongs here, not edited into it. Unset,
41
+ # the prompt renders exactly as it did before this field existed.
42
+ #
43
+ # Use it to say what is worth remembering in your domain. A financial desk
44
+ # stores what the user holds and the levels they set, never a market quote
45
+ # (it re-fetches those live, and a stored quote only crowds the shortlist);
46
+ # a clinical assistant would want the opposite.
47
+ memory_extraction_rules: |
48
+ NEVER store: <values that go stale on their own>
49
+ ALWAYS store: <what the user asserted, decided, or committed to>
50
+
51
+ # [optional] Switches this syndicate from DELEGATE to PLAN-DISPATCH.
52
+ #
53
+ # DELEGATE (omit this block, the default): subagents become AgentTools on
54
+ # the orchestrator, which calls one and then RE-EMITS its answer to close
55
+ # the turn. Classification is implicit in which tool it calls.
56
+ #
57
+ # PLAN-DISPATCH (declare it): the orchestrator holds NO subagent tools and
58
+ # instead carries an `outputSchema` naming one route. Code reads that name,
59
+ # runs the matching subagent, and returns THAT agent's output as the answer.
60
+ # No relay turn, one fewer LLM call, and the hand-off is a value in code —
61
+ # so it can be logged, traced, and streamed to a waiting user as
62
+ # "[STATUS] Routed to <Name> — <reason>".
63
+ #
64
+ # ⚠ The orchestrator MUST be a leaf when using this: ADK refuses to combine
65
+ # outputSchema with AgentTool delegation on one agent (see critic.yaml).
66
+ # Pair the schema with generateContentConfig.responseMimeType:
67
+ # "application/json".
68
+ # ⚠ A2A-only — scripts/syndicate_chat.ts compiles every syndicate in
69
+ # DELEGATE mode (same limitation as yaml_reference).
70
+ #
71
+ # Contract and fail-static rules: lib/dispatch.ts. Worked example:
72
+ # financial_router.yaml.
73
+ dispatch:
74
+ # [required] Subagent used whenever routing yields no usable answer —
75
+ # malformed JSON, an unknown name, or a classifier that failed outright.
76
+ # Must name a declared subagent that can handle ANY message: routing is an
77
+ # optimisation, answering the user is the contract.
78
+ default_route: "TheGeneralistSubagent"
79
+ # [optional] JSON property holding the chosen route. Default "route".
80
+ route_key: "route"
81
+ # [optional] Deterministic pre-classification: a message matching `pattern`
82
+ # is pinned to `route` and the classifier never runs. First match wins.
83
+ # For facts the message CONTAINS — a URL only one specialist can open, an
84
+ # explicit demand for a named tool — never for topic guesses: an override
85
+ # cannot be reasoned around by the classifier, so a keyword encoded here
86
+ # silently disables the routes it shadows. A rule naming an undeclared
87
+ # subagent or carrying an invalid regex is skipped with a warning.
88
+ route_overrides:
89
+ - route: "TheSpecialistOnlyItCanDoThis"
90
+ pattern: "(?:https?://)?example\\.com/" # JS regex source
91
+ flags: "i" # [optional] default "i"
92
+ reason: "shown to the waiting user as the [STATUS] route note"
93
+ # [optional] JSON property holding the short justification shown to the
94
+ # waiting user as progress. Default "reason".
95
+ reason_key: "reason"
96
+
97
+ # ── Orchestrator ────────────────────────────────────────────
98
+ # Maps to: new LlmAgent({ ... }) — the root agent passed to InMemoryRunner.
99
+
100
+ orchestrator:
101
+
102
+ # ── BaseAgentConfig fields ──────────────────────────────
103
+
104
+ # [required] Unique identifier. Must be a valid JS identifier.
105
+ # Must be unique within the agent tree. Cannot be "user".
106
+ name: "OrchestratorName"
107
+
108
+ # [optional] One-line description of what this agent does.
109
+ # Used by peer/parent agents to decide whether to delegate here.
110
+ description: "Lead orchestrator of the syndicate."
111
+
112
+ # ── LlmAgentConfig fields ───────────────────────────────
113
+
114
+ # [required] The model to use. The id's prefix names the provider and the
115
+ # framework routes accordingly (lib/models/registry.ts):
116
+ # gemini-* → Google Gemini (ADK-native)
117
+ # claude-* → Anthropic (ANTHROPIC_API_KEY)
118
+ # gpt-* /o* → OpenAI (OPENAI_API_KEY)
119
+ # grok-* → xAI (XAI_API_KEY)
120
+ # ollama/* → local Ollama (keyless)
121
+ # Subagents inherit this if not set on their own config.
122
+ model: "gemini-3.1-flash-lite"
123
+
124
+ # [required] The agent's system prompt / persona.
125
+ # Maps to: instruction
126
+ instruction: |
127
+ You are the lead orchestrator.
128
+ Call upon your subagents to fulfill the user's request.
129
+
130
+ # [optional] Global instruction applied to ALL agents in the tree.
131
+ # Only the root agent's globalInstruction takes effect.
132
+ # Use to enforce a shared identity or safety rules across the tree.
133
+ # Maps to: globalInstruction
134
+ globalInstruction: |
135
+ Always respond in English. Never reveal internal tool names.
136
+
137
+ # [optional] Named built-in tools to attach to this agent.
138
+ # Maps to: tools[] on LlmAgent
139
+ # Supported values include "web_search" (provider-agnostic: maps to the
140
+ # model's NATIVE search on Gemini/Claude/GPT/Grok, omitted with a warning
141
+ # on local models), "google_search" (Gemini-only, legacy), "code_execution".
142
+ # Full registry: lib/toolRegistry.ts.
143
+ tools: []
144
+
145
+ # [optional] Whether to include conversation history in model requests.
146
+ # "default" → include history (stateful)
147
+ # "none" → no history (stateless / pure function)
148
+ # Maps to: includeContents
149
+ includeContents: "default"
150
+
151
+ # [optional] Prevents the LLM from handing control back to the parent agent.
152
+ # ⚠ Also prevents this agent from replying to the end-user directly.
153
+ # Maps to: disallowTransferToParent
154
+ disallowTransferToParent: false
155
+
156
+ # [optional] Prevents the LLM from handing control to peer agents.
157
+ # Maps to: disallowTransferToPeers
158
+ disallowTransferToPeers: false
159
+
160
+ # [optional] Saves the agent's final text reply to session state
161
+ # under this key. Useful for chaining agents via shared state.
162
+ # Maps to: outputKey
163
+ outputKey: "orchestrator_output"
164
+
165
+ # ── generateContentConfig ─────────────────────────────────
166
+ # Maps to: generateContentConfig on LlmAgent (→ GenerateContentConfig)
167
+ # ⚠ Do NOT set tools or thinkingConfig here — use the top-level
168
+ # `tools:` field and `generateContentConfig.thinkingConfig` respectively.
169
+
170
+ generateContentConfig:
171
+
172
+ # Sampling temperature. Lower = more deterministic. Range: [0.0, 2.0]
173
+ temperature: 0.7
174
+
175
+ # Nucleus sampling. Tokens sampled until cumulative prob = topP.
176
+ topP: 0.95
177
+
178
+ # Top-K sampling. Only the top K tokens are considered per step.
179
+ topK: 40
180
+
181
+ # Maximum tokens the model may generate in one response.
182
+ maxOutputTokens: 2048
183
+
184
+ # Stop generation if any of these strings are encountered.
185
+ stopSequences: []
186
+
187
+ # Number of response candidates to generate (usually 1).
188
+ candidateCount: 1
189
+
190
+ # Penalize tokens that have already appeared (encourages diversity).
191
+ presencePenalty: 0.0
192
+
193
+ # Penalize tokens proportional to their frequency (reduces repetition).
194
+ frequencyPenalty: 0.0
195
+
196
+ # Fixed seed for reproducible outputs. Remove for random behavior.
197
+ seed: 42
198
+
199
+ # Output MIME type. Use "application/json" for structured output.
200
+ # Must be paired with responseSchema when set to JSON.
201
+ responseMimeType: "text/plain"
202
+
203
+ # ── Safety settings ─────────────────────────────────────
204
+ # Each entry maps to a SafetySetting { category, threshold }.
205
+ # Thresholds: BLOCK_NONE | BLOCK_LOW_AND_ABOVE | BLOCK_MEDIUM_AND_ABOVE | BLOCK_HIGH_AND_ABOVE
206
+ safetySettings:
207
+ - category: "HARM_CATEGORY_HATE_SPEECH"
208
+ threshold: "BLOCK_MEDIUM_AND_ABOVE"
209
+ - category: "HARM_CATEGORY_DANGEROUS_CONTENT"
210
+ threshold: "BLOCK_MEDIUM_AND_ABOVE"
211
+ - category: "HARM_CATEGORY_HARASSMENT"
212
+ threshold: "BLOCK_MEDIUM_AND_ABOVE"
213
+ - category: "HARM_CATEGORY_SEXUALLY_EXPLICIT"
214
+ threshold: "BLOCK_MEDIUM_AND_ABOVE"
215
+
216
+ # ── Thinking config (Gemini 2.5+ only) ──────────────────
217
+ # Maps to: generateContentConfig.thinkingConfig → ThinkingConfig
218
+ thinkingConfig:
219
+ # Token budget for the model's internal reasoning trace.
220
+ # 0 = thinking disabled. -1 = dynamic (model decides).
221
+ thinkingBudget: 1024
222
+
223
+ # Whether to include the thinking trace in the streamed response.
224
+ includeThoughts: true
225
+
226
+ # ── Subagents ───────────────────────────────────────────────
227
+ # Each entry maps to: new LlmAgent({ ... }) wrapped in AgentTool
228
+ # and passed to the orchestrator's tools[].
229
+
230
+ subagents:
231
+
232
+ - # ── BaseAgentConfig fields ──────────────────────────────
233
+
234
+ # [required] Unique name. Must be a valid JS identifier.
235
+ name: "MySubagent"
236
+
237
+ # [required for AgentTool] One-line description.
238
+ # The orchestrator LLM reads this to decide when to call this subagent.
239
+ description: "Handles a specific domain task."
240
+
241
+ # ── LlmAgentConfig fields ───────────────────────────────
242
+
243
+ # [optional] Override the model for this subagent.
244
+ # If omitted, inherits the orchestrator's model.
245
+ model: "gemini-3.1-flash-lite"
246
+
247
+ # [required] System prompt for this subagent.
248
+ # Maps to: instruction
249
+ instruction: |
250
+ You are a specialist subagent. Complete the task passed to you
251
+ and return a structured summary to the orchestrator.
252
+
253
+ # [optional] Named built-in tools for this subagent.
254
+ # Maps to: tools[] on LlmAgent
255
+ # Supported values include "web_search" (provider-agnostic),
256
+ # "google_search" (Gemini-only, legacy), "code_execution",
257
+ # and the knowledge-bundle tools "wiki_map", "wiki_search",
258
+ # "wiki_read", "wiki_links", "wiki_dive", "wiki_save"
259
+ # (lib/toolRegistry.ts is the authoritative name→tool map).
260
+ tools:
261
+ - "web_search"
262
+
263
+ # [optional] MCP server to discover tools from at RUNTIME.
264
+ # Maps to: nothing on LlmAgent directly — the framework dials
265
+ # this URL (SSE), asks tools/list, and wraps each remote tool
266
+ # as a live agent tool (lib/tools/mcpToolFactory.ts). Merges
267
+ # with the declared tools above; declared names win on
268
+ # collision. An unreachable server degrades to an empty tool
269
+ # list with a console warning. Loopback/private hosts are
270
+ # refused unless ALLOW_PRIVATE_MCP=true (local development).
271
+ # See config/agents/librarian.yaml for the worked example.
272
+ # mcp_server_url: "http://localhost:8931/sse"
273
+
274
+ # [optional] Stateless operation — subagent sees no history.
275
+ # Maps to: includeContents
276
+ includeContents: "none"
277
+
278
+ # [optional] Store this subagent's output in session state.
279
+ # Maps to: outputKey
280
+ outputKey: "subagent_result"
281
+
282
+ # ── generateContentConfig ───────────────────────────────
283
+ # Same fields as orchestrator above. Only set what you want to override.
284
+
285
+ generateContentConfig:
286
+ temperature: 0.4
287
+ maxOutputTokens: 1024
288
+
289
+ thinkingConfig:
290
+ thinkingBudget: 0 # Disable thinking for speed
291
+ includeThoughts: false
@@ -0,0 +1,108 @@
1
+ /**
2
+ * lib/config.ts — Framework-level configuration constants.
3
+ *
4
+ * WHY this file exists:
5
+ * Previously, model identifiers were hardcoded inside individual service
6
+ * files, making them invisible to contributors and impossible to change
7
+ * without hunting through source.
8
+ *
9
+ * Centralising them here creates a single, obvious place to:
10
+ * 1. Swap the default inference model used by the A2A server
11
+ * 2. Change summary/extraction model without touching service logic
12
+ * 3. Understand the full set of third-party model dependencies at a glance
13
+ *
14
+ * These are intentionally plain constants — not env vars — because model
15
+ * IDs are code decisions, not deployment secrets. If you want env-var
16
+ * overrides, wrap the const: `process.env.GEMINI_MODEL ?? DEFAULT_GEMINI_MODEL`.
17
+ */
18
+ /**
19
+ * Default Gemini model used by the A2A server when no model is specified
20
+ * in the caller's YAML or request.
21
+ *
22
+ * Use gemini-3.1-flash-lite for lightweight/cost-efficient loads (subagents,
23
+ * data retrieval). Use gemini-3.7-flash in YAML for production orchestrators.
24
+ *
25
+ * NOTE: gemini-2.5-flash is known incompatible with this framework's
26
+ * includeServerSideToolInvocations flag on AI Studio Tier 1 — do not use it
27
+ * as the default. See DOCUMENTATION.md §7.0 for the full compatibility table.
28
+ *
29
+ * Supported Gemini identifiers: https://ai.google.dev/gemini-api/docs/models
30
+ */
31
+ export declare const DEFAULT_GEMINI_MODEL = "gemini-3.1-flash-lite";
32
+ /**
33
+ * Default Claude model used by the A2A server when a claude-* model is
34
+ * requested but no specific identifier is provided.
35
+ *
36
+ * Requires ANTHROPIC_API_KEY to be set. The ClaudeLlm provider in
37
+ * lib/models/claudeLlm.ts handles routing automatically via LLMRegistry.
38
+ */
39
+ export declare const DEFAULT_CLAUDE_MODEL = "claude-sonnet-4-6";
40
+ /**
41
+ * Default OpenAI model used when a gpt-* model is requested but no specific
42
+ * identifier is provided. Requires OPENAI_API_KEY. gpt-5-mini is the
43
+ * lightweight reasoning tier — enough for subagent work, and it exposes
44
+ * reasoning summaries via the Responses API (lib/models/gptLlm.ts).
45
+ */
46
+ export declare const DEFAULT_GPT_MODEL = "gpt-5-mini";
47
+ /**
48
+ * Default xAI model used when a grok-* model is requested but no specific
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
51
+ * reasoning summaries, which the adapter surfaces as thinking.
52
+ */
53
+ export declare const DEFAULT_GROK_MODEL = "grok-4.5";
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
58
+ * capabilities › Text › Reasoning › Effort levels. Older grok ids don't
59
+ * accept the param and never receive it (lib/models/grokLlm.ts).
60
+ */
61
+ export declare const DEFAULT_GROK_REASONING_EFFORT = "medium";
62
+ /**
63
+ * Default open-weight model, served locally by Ollama (lib/models/ollamaLlm.ts).
64
+ * qwen3:8b is the smallest pulled model that supports tool calling — the
65
+ * floor capability for syndicate delegation. Vision work uses ollama/qwen3-vl:8b.
66
+ */
67
+ export declare const DEFAULT_OLLAMA_MODEL = "ollama/qwen3:8b";
68
+ /**
69
+ * Model used by SupabaseVectorMemoryService to extract discrete facts
70
+ * from a session transcript before embedding them.
71
+ *
72
+ * Must be a text generation model (not an embedding model).
73
+ */
74
+ export declare const MEMORY_EXTRACTION_MODEL = "gemini-3.7-flash";
75
+ /**
76
+ * Default model for wiki agent operations (wiki_query, wiki_garden, and the
77
+ * gap-fill pass in lib/wiki/fill.ts). Prose quality matters more than
78
+ * latency here, so this sits one tier above the subagent default. Any
79
+ * provider works — override per call or via WIKI_AGENT_MODEL env
80
+ * ('claude-*', 'ollama/*', …); routing goes through lib/models/registry.ts.
81
+ */
82
+ export declare const WIKI_AGENT_MODEL = "gemini-3.7-flash";
83
+ /**
84
+ * Model used by SupabaseVectorMemoryService to produce vector embeddings
85
+ * for semantic memory storage and retrieval.
86
+ *
87
+ * ⚠ IMPORTANT CONSTRAINT: The output dimensionality set below MUST match the
88
+ * dimensionality of the Supabase pgvector index you have provisioned. The index
89
+ * is created once and cannot be resized. The default (768) fits within
90
+ * Supabase's free-tier limits and is compatible with the match_memory_facts
91
+ * RPC defined in the database schema.
92
+ *
93
+ * If you switch embedding models, you must:
94
+ * 1. Update EMBEDDING_MODEL to the new model identifier.
95
+ * 2. Update EMBEDDING_DIMENSIONS to match the new model's output.
96
+ * 3. Drop and recreate your adk_memory_facts table and ivfflat index.
97
+ * 4. Re-ingest all existing facts (old vectors are dimensionally incompatible).
98
+ *
99
+ * Gemini options:
100
+ * 'gemini-embedding-001' → supports outputDimensionality up to 3072
101
+ * 'text-embedding-004' → supports outputDimensionality up to 768
102
+ */
103
+ export declare const EMBEDDING_MODEL = "gemini-embedding-001";
104
+ /**
105
+ * Output dimensionality for the embedding model.
106
+ * Must match the Supabase pgvector index dimension. Default: 768.
107
+ */
108
+ export declare const EMBEDDING_DIMENSIONS = 768;