melchizedek-agents 0.20.0 → 1.0.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.
- package/.env.example +4 -5
- package/AGENT_SETUP.md +3 -3
- package/CHANGELOG.md +240 -0
- package/DOCUMENTATION.md +142 -150
- package/QUICKSTART.md +12 -11
- package/README.md +11 -11
- package/config/agents/examples/image_production.yaml +2 -2
- package/config/agents/syndicateSchema.yaml +52 -26
- package/dist/lib/a2a/app.d.ts +17 -12
- package/dist/lib/a2a/app.js +16 -6
- package/dist/lib/a2a/executor.d.ts +10 -14
- package/dist/lib/a2a/executor.js +10 -18
- package/dist/lib/a2a/remoteAgent.d.ts +5 -12
- package/dist/lib/a2a/remoteAgent.js +5 -12
- package/dist/lib/compile.d.ts +76 -86
- package/dist/lib/compile.js +100 -116
- package/dist/lib/compileNative.d.ts +44 -56
- package/dist/lib/compileNative.js +91 -89
- package/dist/lib/config.d.ts +6 -6
- package/dist/lib/config.js +6 -6
- package/dist/lib/doctor.d.ts +8 -14
- package/dist/lib/doctor.js +10 -46
- package/dist/lib/index.d.ts +12 -9
- package/dist/lib/index.js +10 -11
- package/dist/lib/loadSyndicate.d.ts +3 -3
- package/dist/lib/loadSyndicate.js +2 -2
- package/dist/lib/memory/erase.d.ts +1 -1
- package/dist/lib/memory/erase.js +1 -1
- package/dist/lib/memory/namespace.d.ts +12 -14
- package/dist/lib/memory/namespace.js +13 -14
- package/dist/lib/memory/providers.d.ts +4 -5
- package/dist/lib/memory/providers.js +12 -6
- package/dist/lib/memory/supabaseMemoryService.d.ts +9 -30
- package/dist/lib/memory/supabaseMemoryService.js +8 -30
- package/dist/lib/model.d.ts +6 -12
- package/dist/lib/model.js +6 -12
- package/dist/lib/models/adapterResolver.d.ts +21 -40
- package/dist/lib/models/adapterResolver.js +32 -40
- package/dist/lib/models/chatCompletionsAdapter.d.ts +12 -33
- package/dist/lib/models/chatCompletionsAdapter.js +13 -18
- package/dist/lib/models/circuitBreaker.d.ts +5 -5
- package/dist/lib/models/circuitBreaker.js +5 -5
- package/dist/lib/models/claudeAdapter.d.ts +9 -26
- package/dist/lib/models/claudeAdapter.js +11 -15
- package/dist/lib/models/claudeModels.d.ts +4 -4
- package/dist/lib/models/claudeModels.js +4 -4
- package/dist/lib/models/contract.d.ts +11 -11
- package/dist/lib/models/contract.js +6 -6
- package/dist/lib/models/errorResponse.d.ts +13 -20
- package/dist/lib/models/errorResponse.js +0 -12
- package/dist/lib/models/fallbackAdapter.d.ts +7 -8
- package/dist/lib/models/gatewayAdapter.d.ts +1 -1
- package/dist/lib/models/gatewayAdapter.js +1 -1
- package/dist/lib/models/geminiAdapter.d.ts +5 -6
- package/dist/lib/models/geminiAdapter.js +9 -10
- package/dist/lib/models/geminiState.d.ts +8 -8
- package/dist/lib/models/geminiState.js +8 -8
- package/dist/lib/models/genaiMapping.d.ts +82 -36
- package/dist/lib/models/genaiMapping.js +41 -41
- package/dist/lib/models/gptAdapter.d.ts +11 -11
- package/dist/lib/models/gptAdapter.js +13 -13
- package/dist/lib/models/kimiAdapter.d.ts +6 -7
- package/dist/lib/models/kimiAdapter.js +6 -9
- package/dist/lib/models/ollamaAdapter.d.ts +3 -3
- package/dist/lib/models/ollamaAdapter.js +3 -3
- package/dist/lib/models/providerMap.d.ts +6 -5
- package/dist/lib/models/providerMap.js +6 -5
- package/dist/lib/models/providerState.d.ts +3 -2
- package/dist/lib/models/providerState.js +3 -2
- package/dist/lib/models/reasoning.d.ts +1 -1
- package/dist/lib/models/registry.d.ts +26 -73
- package/dist/lib/models/registry.js +31 -144
- package/dist/lib/models/retry.d.ts +2 -2
- package/dist/lib/models/retry.js +2 -2
- package/dist/lib/models/schemaNormalize.d.ts +25 -55
- package/dist/lib/models/schemaNormalize.js +30 -100
- package/dist/lib/observability/lineage.d.ts +3 -3
- package/dist/lib/observability/lineage.js +10 -10
- package/dist/lib/observability/supabaseSpanExporter.js +1 -1
- package/dist/lib/observability/tracer.d.ts +25 -23
- package/dist/lib/observability/tracer.js +26 -63
- package/dist/lib/persistence/supabaseProvider.d.ts +4 -3
- package/dist/lib/runtime/approvals.d.ts +1 -1
- package/dist/lib/runtime/credentials.d.ts +1 -1
- package/dist/lib/runtime/events.d.ts +3 -4
- package/dist/lib/runtime/events.js +3 -4
- package/dist/lib/runtime/logging.d.ts +3 -8
- package/dist/lib/runtime/logging.js +3 -8
- package/dist/lib/runtime/memoryService.d.ts +4 -6
- package/dist/lib/runtime/memoryService.js +3 -5
- package/dist/lib/runtime/native/agentLoop.d.ts +18 -16
- package/dist/lib/runtime/native/agentLoop.js +38 -26
- package/dist/lib/runtime/native/compaction.d.ts +10 -11
- package/dist/lib/runtime/native/compaction.js +10 -11
- package/dist/lib/runtime/native/delegate.d.ts +13 -14
- package/dist/lib/runtime/native/delegate.js +11 -18
- package/dist/lib/runtime/native/history.d.ts +5 -6
- package/dist/lib/runtime/native/history.js +5 -6
- package/dist/lib/runtime/native/interrupts.d.ts +6 -6
- package/dist/lib/runtime/native/interrupts.js +6 -6
- package/dist/lib/runtime/native/request.d.ts +24 -24
- package/dist/lib/runtime/native/request.js +35 -24
- package/dist/lib/runtime/native/selfCorrection.d.ts +32 -32
- package/dist/lib/runtime/native/selfCorrection.js +34 -34
- package/dist/lib/runtime/native/step.d.ts +23 -23
- package/dist/lib/runtime/native/step.js +49 -27
- package/dist/lib/runtime/native/taskMode.d.ts +8 -8
- package/dist/lib/runtime/native/taskMode.js +8 -8
- package/dist/lib/runtime/native/telemetry.d.ts +11 -11
- package/dist/lib/runtime/native/telemetry.js +11 -11
- package/dist/lib/runtime/native/tempState.d.ts +4 -4
- package/dist/lib/runtime/native/tempState.js +4 -4
- package/dist/lib/runtime/nativeTurn.d.ts +29 -32
- package/dist/lib/runtime/nativeTurn.js +30 -41
- package/dist/lib/runtime/questions.d.ts +8 -9
- package/dist/lib/runtime/questions.js +1 -2
- package/dist/lib/runtime/runtimeFlag.d.ts +28 -14
- package/dist/lib/runtime/runtimeFlag.js +38 -16
- package/dist/lib/runtime/sessions.d.ts +10 -12
- package/dist/lib/runtime/sessions.js +10 -12
- package/dist/lib/runtime/syndicateTurn.d.ts +44 -45
- package/dist/lib/runtime/syndicateTurn.js +163 -158
- package/dist/lib/runtime/turnControl.d.ts +8 -8
- package/dist/lib/runtime/turnControl.js +8 -8
- package/dist/lib/session/supabaseSessionService.d.ts +7 -21
- package/dist/lib/session/supabaseSessionService.js +7 -43
- package/dist/lib/session/transcript.d.ts +16 -26
- package/dist/lib/session/transcript.js +17 -57
- package/dist/lib/storage/postgres/sessionService.d.ts +6 -20
- package/dist/lib/storage/postgres/sessionService.js +6 -39
- package/dist/lib/syndicateSchema.js +7 -6
- package/dist/lib/toolRegistry.d.ts +9 -14
- package/dist/lib/toolRegistry.js +36 -33
- package/dist/lib/tools/auth.d.ts +1 -1
- package/dist/lib/tools/auth.js +1 -1
- package/dist/lib/tools/examples.d.ts +2 -4
- package/dist/lib/tools/examples.js +2 -4
- package/dist/lib/tools/generateImageTool.d.ts +3 -3
- package/dist/lib/tools/generateImageTool.js +4 -5
- package/dist/lib/tools/inspectImageTool.d.ts +2 -2
- package/dist/lib/tools/inspectImageTool.js +3 -4
- package/dist/lib/tools/mcpToolFactory.d.ts +4 -24
- package/dist/lib/tools/mcpToolFactory.js +19 -9
- package/dist/lib/tools/memoryTools.d.ts +5 -6
- package/dist/lib/tools/memoryTools.js +5 -6
- package/dist/lib/tools/nativeTools.d.ts +9 -14
- package/dist/lib/tools/nativeTools.js +9 -14
- package/dist/lib/tools/openapiTools.d.ts +5 -7
- package/dist/lib/tools/openapiTools.js +6 -13
- package/dist/lib/tools/scienceTools.d.ts +3 -3
- package/dist/lib/tools/scienceTools.js +8 -10
- package/dist/lib/tools/skillToolset.d.ts +1 -2
- package/dist/lib/tools/skillToolset.js +1 -2
- package/dist/lib/tools/skills/executor.d.ts +1 -1
- package/dist/lib/tools/skills/executor.js +1 -1
- package/dist/lib/tools/skills/frontmatter.d.ts +2 -2
- package/dist/lib/tools/skills/frontmatter.js +2 -2
- package/dist/lib/tools/skills/tools.d.ts +8 -10
- package/dist/lib/tools/skills/tools.js +9 -11
- package/dist/lib/tools/tool.d.ts +24 -40
- package/dist/lib/tools/tool.js +24 -56
- package/dist/lib/tools/toolContract.d.ts +8 -13
- package/dist/lib/tools/toolContract.js +6 -17
- package/dist/lib/tools/webExtractTool.d.ts +2 -2
- package/dist/lib/tools/webExtractTool.js +3 -4
- package/dist/lib/tools/wikiTools.d.ts +2 -2
- package/dist/lib/tools/wikiTools.js +5 -6
- package/dist/lib/tools/xApiSearchTool.d.ts +2 -2
- package/dist/lib/tools/xApiSearchTool.js +3 -4
- package/dist/lib/tools/xaiSearchParams.d.ts +2 -5
- package/dist/lib/tools/xaiSearchParams.js +2 -5
- package/dist/lib/wiki/agentRun.d.ts +10 -11
- package/dist/lib/wiki/agentRun.js +24 -42
- package/dist/lib/workflow/agentNode.d.ts +10 -1
- package/dist/lib/workflow/agentNode.js +5 -3
- package/dist/lib/workflow/graph.d.ts +8 -9
- package/dist/lib/workflow/graph.js +12 -12
- package/dist/lib/workflow/nodeEvents.d.ts +5 -5
- package/dist/lib/workflow/nodeEvents.js +5 -5
- package/dist/lib/workflow/pause.d.ts +5 -4
- package/dist/lib/workflow/pause.js +5 -4
- package/dist/lib/workflow/resume.d.ts +4 -4
- package/dist/lib/workflow/resume.js +4 -4
- package/dist/lib/workflow/route.d.ts +7 -7
- package/dist/lib/workflow/route.js +8 -8
- package/dist/lib/workflow/scheduler.d.ts +44 -2
- package/dist/lib/workflow/scheduler.js +60 -6
- package/dist/lib/workflow/toolNode.d.ts +18 -29
- package/dist/lib/workflow/toolNode.js +29 -35
- package/dist/lib/workflow/turn.d.ts +29 -20
- package/dist/lib/workflow/turn.js +111 -24
- package/dist/lib/workflow.d.ts +34 -60
- package/dist/lib/workflow.js +34 -168
- package/dist/lib/workflowConfig.d.ts +2 -10
- package/dist/lib/workflowConfig.js +2 -31
- package/dist/scripts/a2a_server.js +1 -2
- package/dist/scripts/assistant_worker.d.ts +2 -2
- package/dist/scripts/assistant_worker.js +8 -7
- package/dist/scripts/doctor.d.ts +2 -2
- package/dist/scripts/doctor.js +2 -2
- package/dist/scripts/syndicate_chat.js +14 -24
- package/package.json +3 -9
- package/skills/briefs/_shared.md +2 -2
- package/skills/briefs/melchizedek-author.md +2 -2
- package/skills/briefs/melchizedek-models.md +6 -6
- package/skills/melchizedek-author/SKILL.md +2 -2
- package/skills/melchizedek-models/SKILL.md +5 -5
|
@@ -1,43 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/compileNative.ts — an AgentSpec as the
|
|
3
|
-
* NativeAgent the agent loop takes (ADR 0045, ADR 0073).
|
|
2
|
+
* lib/compileNative.ts — an AgentSpec as the runtime runs it: the
|
|
3
|
+
* NativeAgent the agent loop takes (ADR 0045, ADR 0073, ADR 0107).
|
|
4
4
|
*
|
|
5
5
|
* WHY this file exists:
|
|
6
|
-
* lib/compile.ts turns a YAML agent into
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* NativeAgent), so both runtimes run the agent the YAML describes, with
|
|
10
|
-
* the same tools, instruction and config. tests/compile.test.ts compiles
|
|
11
|
-
* one spec both ways and requires the same first request.
|
|
6
|
+
* lib/compile.ts turns a YAML agent into an AgentSpec. This file builds
|
|
7
|
+
* the loop's agent from it (lib/runtime/native/request.ts, NativeAgent),
|
|
8
|
+
* with the tools, instruction and config the YAML describes.
|
|
12
9
|
*
|
|
13
|
-
* TOOLS: each resolved tool is handed to the loop as the own Tool
|
|
14
|
-
* InstructionTool
|
|
15
|
-
*
|
|
16
|
-
* runs
|
|
17
|
-
*
|
|
18
|
-
* a
|
|
19
|
-
*
|
|
20
|
-
* workflowSubagentTool whose call walks the whole graph (ADR 0098); a remote A2A subagent is the own
|
|
21
|
-
* Tool the ADK runtime's FunctionTool wraps (lib/a2a/remoteAgent.ts).
|
|
10
|
+
* TOOLS: each resolved tool is handed to the loop as the own Tool,
|
|
11
|
+
* InstructionTool or Toolset it is (lib/tools/tool.ts). A delegated
|
|
12
|
+
* subagent becomes a subagentTool holding its own NativeAgent, which the
|
|
13
|
+
* loop runs as a child loop (lib/runtime/native/delegate.ts, ADR 0074), a
|
|
14
|
+
* nested syndicate as its orchestrator's agent, a nested workflow syndicate
|
|
15
|
+
* as a workflowSubagentTool whose call walks the whole graph (ADR 0098); a
|
|
16
|
+
* remote A2A subagent is its own Tool (lib/a2a/remoteAgent.ts).
|
|
22
17
|
*
|
|
23
|
-
* EVERY AGENT KEY COMPILES
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* question, a caller's agent transform) is refused by the turn runner
|
|
30
|
-
* (lib/runtime/nativeTurn.ts), which owns those choices.
|
|
18
|
+
* EVERY AGENT KEY COMPILES: `context:` is handed to the loop, which
|
|
19
|
+
* compacts (lib/runtime/native/compaction.ts); `mode: task` and
|
|
20
|
+
* `code_execution: gemini` pass through, the request declaring finish_task
|
|
21
|
+
* (lib/runtime/native/taskMode.ts) and asking Gemini for its
|
|
22
|
+
* code-execution tool (lib/runtime/native/request.ts). What the runtime
|
|
23
|
+
* does not run is refused by the turn runner (lib/runtime/nativeTurn.ts).
|
|
31
24
|
*
|
|
32
25
|
* THE MODEL: the loop calls a model through its contract adapter. A
|
|
33
|
-
* resolver
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* ADK classes are told apart by ADK's own Symbol.for marks, so
|
|
40
|
-
* imports nothing from ADK.
|
|
26
|
+
* resolver returns an id, a ModelAdapter or undefined. Anything else is
|
|
27
|
+
* refused with UnsupportedOnRuntimeError by compileNative and
|
|
28
|
+
* nativeAdapterFor before any model call, rather than run the registry's
|
|
29
|
+
* model for that id in its place (ADR 0088, ADR 0107): an ADK model class (a
|
|
30
|
+
* resolver written for 0.x) has no adapter behind it, and a plain
|
|
31
|
+
* `{ model, apiKey }` object would run on the operator's env key, not the
|
|
32
|
+
* caller's. ADK classes are told apart by ADK's own Symbol.for marks, so
|
|
33
|
+
* this file imports nothing from ADK.
|
|
41
34
|
*/
|
|
42
35
|
import type { AgentSpec, CompileOptions, WorkflowSpec } from './compile.ts';
|
|
43
36
|
import type { SubagentYamlConfig, SyndicateYamlConfig } from './loadSyndicate.ts';
|
|
@@ -47,24 +40,22 @@ import type { NativeAgent } from './runtime/native/request.ts';
|
|
|
47
40
|
export { UnsupportedOnRuntimeError, unsupportedOnNative } from './runtime/runtimeFlag.ts';
|
|
48
41
|
import type { WorkflowGraph } from './workflow/graph.ts';
|
|
49
42
|
/**
|
|
50
|
-
* The class name of an ADK model the
|
|
51
|
-
*
|
|
52
|
-
* included) nor a shim carrying a contract adapter (lib/models/adkShim.ts).
|
|
43
|
+
* The class name of an ADK model the runtime cannot run, else undefined:
|
|
44
|
+
* any ADK BaseLlm (ADR 0107; the ADK runtime that ran one left in 1.0.0).
|
|
53
45
|
*/
|
|
54
46
|
export declare function unrunnableModelClass(resolved: unknown): string | undefined;
|
|
55
47
|
/**
|
|
56
48
|
* The NativeAgent for `spec`. Throws when no model id is known, and
|
|
57
|
-
* UnsupportedOnRuntimeError when the resolver returned
|
|
58
|
-
*
|
|
49
|
+
* UnsupportedOnRuntimeError when the resolver returned anything but an id,
|
|
50
|
+
* a ModelAdapter or undefined (see the header).
|
|
59
51
|
*/
|
|
60
52
|
export declare function compileNative(spec: AgentSpec): NativeAgent;
|
|
61
53
|
/**
|
|
62
|
-
* The model id a request is sent under
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* circuit breaker then see that id on both runtimes.
|
|
54
|
+
* The model id a request is sent under: the id of the adapter the resolver
|
|
55
|
+
* returned, else the id the resolver returned, else the spec's. A resolver
|
|
56
|
+
* may answer a YAML id with a model under another id (a gateway stand-in, a
|
|
57
|
+
* caller's alias); the adapter, the span and the circuit breaker then see
|
|
58
|
+
* that id.
|
|
68
59
|
*/
|
|
69
60
|
export declare function wireModelOf(spec: Pick<AgentSpec, 'modelId' | 'resolvedModel'>): string | undefined;
|
|
70
61
|
/** A syndicate's orchestrator for the native loop: compileSpec, then compileNative. */
|
|
@@ -76,20 +67,19 @@ export interface NativeWorkflow {
|
|
|
76
67
|
graph: WorkflowGraph;
|
|
77
68
|
agents: Map<string, NativeAgent>;
|
|
78
69
|
resolveTool: (name: string) => unknown;
|
|
70
|
+
/** The nodes that are a nested workflow syndicate, each compiled the same way, by YAML name (ADR 0106). */
|
|
71
|
+
workflows: Map<string, NativeWorkflow>;
|
|
79
72
|
}
|
|
80
73
|
/**
|
|
81
|
-
* A workflow spec for the
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* refuses (an unregistered or long-running tool) is refused here, before
|
|
85
|
-
* any model call, with ADK's message.
|
|
74
|
+
* A workflow spec for the walk: the graph, every agent compiled from its
|
|
75
|
+
* spec, and the registry's lookup for tool nodes. An unregistered or
|
|
76
|
+
* long-running tool node is refused here, before any model call.
|
|
86
77
|
*/
|
|
87
78
|
export declare function compileNativeWorkflow(spec: WorkflowSpec): NativeWorkflow;
|
|
88
79
|
/**
|
|
89
80
|
* A nested workflow as the delegated subagent the native loop calls (ADR
|
|
90
81
|
* 0098): one call walks the whole graph with runNativeWorkflow on the child
|
|
91
|
-
* session lib/runtime/native/delegate.ts opened
|
|
92
|
-
* Workflow on its own Runner.
|
|
82
|
+
* session lib/runtime/native/delegate.ts opened.
|
|
93
83
|
*/
|
|
94
84
|
export declare function workflowSubagentOf(workflow: NativeWorkflow): WorkflowSubagent;
|
|
95
85
|
/** One subagent entry (a dispatch route) for the native loop: compileSubagentSpec, then compileNative. */
|
|
@@ -97,14 +87,12 @@ export declare function compileNativeSubagent(subCfg: SubagentYamlConfig, opts?:
|
|
|
97
87
|
/** What nativeAdapterFor reads from a spec: its model resolution, the other ids it calls, and its delegated subagents. */
|
|
98
88
|
type NativeModelSpec = Pick<AgentSpec, 'modelId' | 'resolvedModel'> & Partial<Pick<AgentSpec, 'name' | 'fallbackModel' | 'context' | 'tools'>>;
|
|
99
89
|
/**
|
|
100
|
-
* The loop's `adapterFor
|
|
101
|
-
*
|
|
102
|
-
* (an ADK shim carries its contract adapter, so a caller's BYOK key on a
|
|
103
|
-
* shimmed provider reaches the call), else resolveAdapter for the id
|
|
90
|
+
* The loop's `adapterFor`: the adapter CompileOptions.resolveModel returns
|
|
91
|
+
* (so a caller's BYOK key reaches the call), else resolveAdapter for the id
|
|
104
92
|
* (lib/models/registry.ts). The spec's own resolution, and each delegated
|
|
105
93
|
* subagent's, is reused for the id its agent runs under (wireModelOf).
|
|
106
94
|
* Each agent's `fallback_model:` and compaction `summary_model` are
|
|
107
|
-
* resolved here,
|
|
95
|
+
* resolved here, at compile time, so a model
|
|
108
96
|
* class native cannot run is refused before any model call; any other id
|
|
109
97
|
* is resolved when first asked for. Each is kept.
|
|
110
98
|
*/
|
|
@@ -1,87 +1,104 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/compileNative.ts — an AgentSpec as the
|
|
3
|
-
* NativeAgent the agent loop takes (ADR 0045, ADR 0073).
|
|
2
|
+
* lib/compileNative.ts — an AgentSpec as the runtime runs it: the
|
|
3
|
+
* NativeAgent the agent loop takes (ADR 0045, ADR 0073, ADR 0107).
|
|
4
4
|
*
|
|
5
5
|
* WHY this file exists:
|
|
6
|
-
* lib/compile.ts turns a YAML agent into
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* NativeAgent), so both runtimes run the agent the YAML describes, with
|
|
10
|
-
* the same tools, instruction and config. tests/compile.test.ts compiles
|
|
11
|
-
* one spec both ways and requires the same first request.
|
|
6
|
+
* lib/compile.ts turns a YAML agent into an AgentSpec. This file builds
|
|
7
|
+
* the loop's agent from it (lib/runtime/native/request.ts, NativeAgent),
|
|
8
|
+
* with the tools, instruction and config the YAML describes.
|
|
12
9
|
*
|
|
13
|
-
* TOOLS: each resolved tool is handed to the loop as the own Tool
|
|
14
|
-
* InstructionTool
|
|
15
|
-
*
|
|
16
|
-
* runs
|
|
17
|
-
*
|
|
18
|
-
* a
|
|
19
|
-
*
|
|
20
|
-
* workflowSubagentTool whose call walks the whole graph (ADR 0098); a remote A2A subagent is the own
|
|
21
|
-
* Tool the ADK runtime's FunctionTool wraps (lib/a2a/remoteAgent.ts).
|
|
10
|
+
* TOOLS: each resolved tool is handed to the loop as the own Tool,
|
|
11
|
+
* InstructionTool or Toolset it is (lib/tools/tool.ts). A delegated
|
|
12
|
+
* subagent becomes a subagentTool holding its own NativeAgent, which the
|
|
13
|
+
* loop runs as a child loop (lib/runtime/native/delegate.ts, ADR 0074), a
|
|
14
|
+
* nested syndicate as its orchestrator's agent, a nested workflow syndicate
|
|
15
|
+
* as a workflowSubagentTool whose call walks the whole graph (ADR 0098); a
|
|
16
|
+
* remote A2A subagent is its own Tool (lib/a2a/remoteAgent.ts).
|
|
22
17
|
*
|
|
23
|
-
* EVERY AGENT KEY COMPILES
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* question, a caller's agent transform) is refused by the turn runner
|
|
30
|
-
* (lib/runtime/nativeTurn.ts), which owns those choices.
|
|
18
|
+
* EVERY AGENT KEY COMPILES: `context:` is handed to the loop, which
|
|
19
|
+
* compacts (lib/runtime/native/compaction.ts); `mode: task` and
|
|
20
|
+
* `code_execution: gemini` pass through, the request declaring finish_task
|
|
21
|
+
* (lib/runtime/native/taskMode.ts) and asking Gemini for its
|
|
22
|
+
* code-execution tool (lib/runtime/native/request.ts). What the runtime
|
|
23
|
+
* does not run is refused by the turn runner (lib/runtime/nativeTurn.ts).
|
|
31
24
|
*
|
|
32
25
|
* THE MODEL: the loop calls a model through its contract adapter. A
|
|
33
|
-
* resolver
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* ADK classes are told apart by ADK's own Symbol.for marks, so
|
|
40
|
-
* imports nothing from ADK.
|
|
26
|
+
* resolver returns an id, a ModelAdapter or undefined. Anything else is
|
|
27
|
+
* refused with UnsupportedOnRuntimeError by compileNative and
|
|
28
|
+
* nativeAdapterFor before any model call, rather than run the registry's
|
|
29
|
+
* model for that id in its place (ADR 0088, ADR 0107): an ADK model class (a
|
|
30
|
+
* resolver written for 0.x) has no adapter behind it, and a plain
|
|
31
|
+
* `{ model, apiKey }` object would run on the operator's env key, not the
|
|
32
|
+
* caller's. ADK classes are told apart by ADK's own Symbol.for marks, so
|
|
33
|
+
* this file imports nothing from ADK.
|
|
41
34
|
*/
|
|
42
35
|
import { remoteAgentOwnTool } from './a2a/remoteAgent.js';
|
|
43
|
-
import { compileSpec, compileSubagentSpec } from './compile.js';
|
|
44
|
-
import {
|
|
36
|
+
import { compileSpec, compileSubagentSpec, workflowAgentSpecs } from './compile.js';
|
|
37
|
+
import { resolveAdapter } from './models/registry.js';
|
|
45
38
|
import { subagentTool, workflowSubagentTool } from './runtime/native/delegate.js';
|
|
46
|
-
import { servedThroughShim } from './runtime/native/selfCorrection.js';
|
|
47
39
|
import { unsupportedOnNative } from './runtime/runtimeFlag.js';
|
|
48
40
|
export { UnsupportedOnRuntimeError, unsupportedOnNative } from './runtime/runtimeFlag.js';
|
|
49
41
|
import { instructionToolOf, toolOf, toolsetOf } from './tools/tool.js';
|
|
50
42
|
import { buildWorkflowGraph } from './workflow/graph.js';
|
|
51
43
|
import { refuseUnrunnableNodes, runNativeWorkflow } from './workflow/turn.js';
|
|
52
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* A resolved tool as the loop holds it: the own Tool, InstructionTool or
|
|
46
|
+
* Toolset behind it, else the object itself. An ADK tool (anything with
|
|
47
|
+
* runAsync) is refused, naming 1.0.0 and defineTool, as registerTool
|
|
48
|
+
* refuses one.
|
|
49
|
+
*/
|
|
53
50
|
function nativeTool(tool) {
|
|
51
|
+
if (!!tool && typeof tool === 'object' && 'runAsync' in tool) {
|
|
52
|
+
const name = String(tool.name ?? '<unnamed>');
|
|
53
|
+
throw new Error(`compile: '${name}' is an ADK tool, which melchizedek-agents 1.0.0 no longer runs (ADR 0107); define it with defineTool (melchizedek-agents) instead`);
|
|
54
|
+
}
|
|
54
55
|
return toolOf(tool) ?? instructionToolOf(tool) ?? toolsetOf(tool) ?? tool;
|
|
55
56
|
}
|
|
56
|
-
/** ADK's own
|
|
57
|
+
/** ADK's own mark on its model classes, registered with Symbol.for so it holds across copies of ADK. */
|
|
57
58
|
const ADK_BASE_MODEL = Symbol.for('google.adk.baseModel');
|
|
58
|
-
const ADK_GEMINI_MODEL = Symbol.for('google.adk.geminiModel');
|
|
59
59
|
const marked = (value, mark) => !!value && typeof value === 'object' && value[mark] === true;
|
|
60
60
|
/**
|
|
61
|
-
* The class name of an ADK model the
|
|
62
|
-
*
|
|
63
|
-
* included) nor a shim carrying a contract adapter (lib/models/adkShim.ts).
|
|
61
|
+
* The class name of an ADK model the runtime cannot run, else undefined:
|
|
62
|
+
* any ADK BaseLlm (ADR 0107; the ADK runtime that ran one left in 1.0.0).
|
|
64
63
|
*/
|
|
65
64
|
export function unrunnableModelClass(resolved) {
|
|
66
|
-
if (!marked(resolved, ADK_BASE_MODEL)
|
|
67
|
-
return undefined;
|
|
68
|
-
if (isModelAdapter(resolved.adapter))
|
|
65
|
+
if (!marked(resolved, ADK_BASE_MODEL))
|
|
69
66
|
return undefined;
|
|
70
67
|
const name = resolved.constructor?.name;
|
|
71
68
|
return typeof name === 'string' && name ? name : 'BaseLlm';
|
|
72
69
|
}
|
|
73
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* Throws UnsupportedOnRuntimeError when `resolved` is not a model id, a
|
|
72
|
+
* ModelAdapter or undefined: an ADK model class native cannot run, or any
|
|
73
|
+
* other value, such as a plain `{ model, apiKey }` object, which would
|
|
74
|
+
* otherwise run on the operator's env key in place of the caller's (see the
|
|
75
|
+
* header).
|
|
76
|
+
*/
|
|
74
77
|
function refuseModelClass(resolved, modelId, where) {
|
|
78
|
+
const forId = modelId ? ` for '${modelId}'` : '';
|
|
75
79
|
const name = unrunnableModelClass(resolved);
|
|
76
|
-
if (
|
|
80
|
+
if (name) {
|
|
81
|
+
throw unsupportedOnNative(`the ADK model class ${name} that resolveModel returned${forId}, which has no contract adapter behind it ` +
|
|
82
|
+
`(ADK model classes left in 1.0.0; return a model id or a ModelAdapter from melchizedek-agents/model)`, where);
|
|
83
|
+
}
|
|
84
|
+
if (resolved === undefined || typeof resolved === 'string' || isModelAdapter(resolved))
|
|
77
85
|
return;
|
|
78
|
-
throw unsupportedOnNative(`the
|
|
79
|
-
`
|
|
86
|
+
throw unsupportedOnNative(`the ${describeResolved(resolved)} that resolveModel returned${forId} (melchizedek-agents 1.0.0 accepts only a model id, a ModelAdapter or undefined; ` +
|
|
87
|
+
`return a model id or a ModelAdapter (e.g. new ClaudeAdapter({ model, apiKey })) from melchizedek-agents/model)`, where);
|
|
88
|
+
}
|
|
89
|
+
/** What a resolver returned, named for a refusal: its type, never its contents (a key may be among them). */
|
|
90
|
+
function describeResolved(value) {
|
|
91
|
+
if (value === null)
|
|
92
|
+
return 'null';
|
|
93
|
+
if (typeof value !== 'object')
|
|
94
|
+
return `${typeof value} value`;
|
|
95
|
+
const ctor = value.constructor?.name;
|
|
96
|
+
return typeof ctor === 'string' && ctor && ctor !== 'Object' ? `${ctor} instance` : 'plain object';
|
|
80
97
|
}
|
|
81
98
|
/**
|
|
82
99
|
* The NativeAgent for `spec`. Throws when no model id is known, and
|
|
83
|
-
* UnsupportedOnRuntimeError when the resolver returned
|
|
84
|
-
*
|
|
100
|
+
* UnsupportedOnRuntimeError when the resolver returned anything but an id,
|
|
101
|
+
* a ModelAdapter or undefined (see the header).
|
|
85
102
|
*/
|
|
86
103
|
export function compileNative(spec) {
|
|
87
104
|
refuseModelClass(spec.resolvedModel, spec.model ?? spec.modelId, spec.name);
|
|
@@ -131,12 +148,11 @@ export function compileNative(spec) {
|
|
|
131
148
|
return agent;
|
|
132
149
|
}
|
|
133
150
|
/**
|
|
134
|
-
* The model id a request is sent under
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* circuit breaker then see that id on both runtimes.
|
|
151
|
+
* The model id a request is sent under: the id of the adapter the resolver
|
|
152
|
+
* returned, else the id the resolver returned, else the spec's. A resolver
|
|
153
|
+
* may answer a YAML id with a model under another id (a gateway stand-in, a
|
|
154
|
+
* caller's alias); the adapter, the span and the circuit breaker then see
|
|
155
|
+
* that id.
|
|
140
156
|
*/
|
|
141
157
|
export function wireModelOf(spec) {
|
|
142
158
|
const resolved = spec.resolvedModel;
|
|
@@ -152,25 +168,25 @@ export async function compileNativeGraph(config, opts = {}) {
|
|
|
152
168
|
return compileNative(await compileSpec(config, opts));
|
|
153
169
|
}
|
|
154
170
|
/**
|
|
155
|
-
* A workflow spec for the
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
* refuses (an unregistered or long-running tool) is refused here, before
|
|
159
|
-
* any model call, with ADK's message.
|
|
171
|
+
* A workflow spec for the walk: the graph, every agent compiled from its
|
|
172
|
+
* spec, and the registry's lookup for tool nodes. An unregistered or
|
|
173
|
+
* long-running tool node is refused here, before any model call.
|
|
160
174
|
*/
|
|
161
175
|
export function compileNativeWorkflow(spec) {
|
|
162
176
|
const graph = buildWorkflowGraph(spec.config);
|
|
163
177
|
const agents = new Map();
|
|
164
178
|
for (const { yaml, spec: agentSpec } of spec.agents)
|
|
165
179
|
agents.set(yaml.name, compileNative(agentSpec));
|
|
180
|
+
const workflows = new Map();
|
|
181
|
+
for (const { yaml, workflow } of spec.workflows)
|
|
182
|
+
workflows.set(yaml.name, compileNativeWorkflow(workflow));
|
|
166
183
|
refuseUnrunnableNodes(graph, spec.resolveTool);
|
|
167
|
-
return { name: spec.name, description: spec.description, graph, agents, resolveTool: spec.resolveTool };
|
|
184
|
+
return { name: spec.name, description: spec.description, graph, agents, resolveTool: spec.resolveTool, workflows };
|
|
168
185
|
}
|
|
169
186
|
/**
|
|
170
187
|
* A nested workflow as the delegated subagent the native loop calls (ADR
|
|
171
188
|
* 0098): one call walks the whole graph with runNativeWorkflow on the child
|
|
172
|
-
* session lib/runtime/native/delegate.ts opened
|
|
173
|
-
* Workflow on its own Runner.
|
|
189
|
+
* session lib/runtime/native/delegate.ts opened.
|
|
174
190
|
*/
|
|
175
191
|
export function workflowSubagentOf(workflow) {
|
|
176
192
|
return {
|
|
@@ -180,6 +196,7 @@ export function workflowSubagentOf(workflow) {
|
|
|
180
196
|
graph: workflow.graph,
|
|
181
197
|
agents: workflow.agents,
|
|
182
198
|
resolveTool: workflow.resolveTool,
|
|
199
|
+
workflows: workflow.workflows,
|
|
183
200
|
sessions: run.sessions,
|
|
184
201
|
appName: run.appName,
|
|
185
202
|
userId: run.userId,
|
|
@@ -203,38 +220,23 @@ function isModelAdapter(value) {
|
|
|
203
220
|
return !!value && typeof value === 'object' && typeof value.generate === 'function' && typeof value.model === 'string';
|
|
204
221
|
}
|
|
205
222
|
/**
|
|
206
|
-
* The contract adapter behind what a resolver returned:
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* BYOK key still pays for the call; else the registry's for the id.
|
|
223
|
+
* The contract adapter behind what a resolver returned: the adapter itself,
|
|
224
|
+
* else the registry's for the id (`model` when the resolver returned
|
|
225
|
+
* undefined or an empty id). Anything else is refused (refuseModelClass).
|
|
210
226
|
*/
|
|
211
227
|
function adapterOf(resolved, model) {
|
|
212
228
|
if (isModelAdapter(resolved))
|
|
213
229
|
return resolved;
|
|
214
230
|
refuseModelClass(resolved, model, 'the native runtime');
|
|
215
|
-
|
|
216
|
-
return resolveAdapter(resolved || model);
|
|
217
|
-
if (!resolved || typeof resolved !== 'object')
|
|
218
|
-
return resolveAdapter(model);
|
|
219
|
-
const held = resolved;
|
|
220
|
-
// On ADK a shim declares the toolsDict, the reflection tool included, whatever its adapter (ADR 0097).
|
|
221
|
-
if (isModelAdapter(held.adapter))
|
|
222
|
-
return servedThroughShim(held.adapter);
|
|
223
|
-
// On Vertex AI the client authenticates with the platform's credentials, never a key (ADR 0023).
|
|
224
|
-
if (typeof held.apiKey === 'string' && held.apiKey && held.vertexai !== true) {
|
|
225
|
-
return resolveAdapter(model, { apiKey: held.apiKey, keyProvider: providerForModel(model) });
|
|
226
|
-
}
|
|
227
|
-
return resolveAdapter(model);
|
|
231
|
+
return resolveAdapter(resolved || model);
|
|
228
232
|
}
|
|
229
233
|
/**
|
|
230
|
-
* The loop's `adapterFor
|
|
231
|
-
*
|
|
232
|
-
* (an ADK shim carries its contract adapter, so a caller's BYOK key on a
|
|
233
|
-
* shimmed provider reaches the call), else resolveAdapter for the id
|
|
234
|
+
* The loop's `adapterFor`: the adapter CompileOptions.resolveModel returns
|
|
235
|
+
* (so a caller's BYOK key reaches the call), else resolveAdapter for the id
|
|
234
236
|
* (lib/models/registry.ts). The spec's own resolution, and each delegated
|
|
235
237
|
* subagent's, is reused for the id its agent runs under (wireModelOf).
|
|
236
238
|
* Each agent's `fallback_model:` and compaction `summary_model` are
|
|
237
|
-
* resolved here,
|
|
239
|
+
* resolved here, at compile time, so a model
|
|
238
240
|
* class native cannot run is refused before any model call; any other id
|
|
239
241
|
* is resolved when first asked for. Each is kept.
|
|
240
242
|
*/
|
|
@@ -259,8 +261,8 @@ export function nativeAdapterFor(opts = {}, spec) {
|
|
|
259
261
|
learn(entry.agent);
|
|
260
262
|
// A nested workflow's agents run under the caller's lookup (ADR 0098).
|
|
261
263
|
else if (entry.kind === 'workflow')
|
|
262
|
-
for (const node of entry.workflow
|
|
263
|
-
learn(node
|
|
264
|
+
for (const node of workflowAgentSpecs(entry.workflow))
|
|
265
|
+
learn(node);
|
|
264
266
|
}
|
|
265
267
|
};
|
|
266
268
|
// A workflow's agents share one lookup: every node's spec is learned.
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -33,20 +33,20 @@ export declare const DEFAULT_GEMINI_MODEL = "gemini-3.5-flash-lite";
|
|
|
33
33
|
* Default Claude model used by the A2A server when a claude-* model is
|
|
34
34
|
* requested but no specific identifier is provided.
|
|
35
35
|
*
|
|
36
|
-
* Requires ANTHROPIC_API_KEY to be set.
|
|
37
|
-
* lib/models/
|
|
36
|
+
* Requires ANTHROPIC_API_KEY to be set. A claude-* id resolves to
|
|
37
|
+
* ClaudeAdapter (lib/models/claudeAdapter.ts) through resolveAdapter.
|
|
38
38
|
*/
|
|
39
39
|
export declare const DEFAULT_CLAUDE_MODEL = "claude-sonnet-4-6";
|
|
40
40
|
/**
|
|
41
41
|
* Default OpenAI model used when a gpt-* model is requested but no specific
|
|
42
42
|
* identifier is provided. Requires OPENAI_API_KEY. gpt-5-mini is the
|
|
43
43
|
* lightweight reasoning tier — enough for subagent work, and it exposes
|
|
44
|
-
* reasoning summaries via the Responses API (lib/models/
|
|
44
|
+
* reasoning summaries via the Responses API (lib/models/gptAdapter.ts).
|
|
45
45
|
*/
|
|
46
46
|
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
|
-
* identifier is provided. Requires XAI_API_KEY (lib/models/
|
|
49
|
+
* identifier is provided. Requires XAI_API_KEY (lib/models/grokAdapter.ts).
|
|
50
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
|
*/
|
|
@@ -63,7 +63,7 @@ export declare const DEFAULT_GROK_REASONING_EFFORT = "medium";
|
|
|
63
63
|
/**
|
|
64
64
|
* Default Moonshot model used when a kimi-* model is requested but no
|
|
65
65
|
* specific identifier is provided. Requires MOONSHOT_API_KEY
|
|
66
|
-
* (lib/models/
|
|
66
|
+
* (lib/models/kimiAdapter.ts). kimi-k3 is the flagship, priced like a mid-tier
|
|
67
67
|
* closed model ($3 / $15, Claude Sonnet 4.6's price; Sonnet 5.5 is cheaper);
|
|
68
68
|
* kimi-k2.6 is the general tier at a quarter of that (the family table and
|
|
69
69
|
* the cost note are in the adapter's header).
|
|
@@ -85,7 +85,7 @@ export declare const DEFAULT_KIMI_REASONING_EFFORT = "high";
|
|
|
85
85
|
*/
|
|
86
86
|
export declare const DEFAULT_MAX_STEPS = 50;
|
|
87
87
|
/**
|
|
88
|
-
* Default open-weight model, served locally by Ollama (lib/models/
|
|
88
|
+
* Default open-weight model, served locally by Ollama (lib/models/ollamaAdapter.ts).
|
|
89
89
|
* qwen3:8b is the smallest pulled model that supports tool calling — the
|
|
90
90
|
* floor capability for syndicate delegation. Vision work uses ollama/qwen3-vl:8b.
|
|
91
91
|
*/
|
package/dist/lib/config.js
CHANGED
|
@@ -34,20 +34,20 @@ export const DEFAULT_GEMINI_MODEL = 'gemini-3.5-flash-lite';
|
|
|
34
34
|
* Default Claude model used by the A2A server when a claude-* model is
|
|
35
35
|
* requested but no specific identifier is provided.
|
|
36
36
|
*
|
|
37
|
-
* Requires ANTHROPIC_API_KEY to be set.
|
|
38
|
-
* lib/models/
|
|
37
|
+
* Requires ANTHROPIC_API_KEY to be set. A claude-* id resolves to
|
|
38
|
+
* ClaudeAdapter (lib/models/claudeAdapter.ts) through resolveAdapter.
|
|
39
39
|
*/
|
|
40
40
|
export const DEFAULT_CLAUDE_MODEL = 'claude-sonnet-4-6';
|
|
41
41
|
/**
|
|
42
42
|
* Default OpenAI model used when a gpt-* model is requested but no specific
|
|
43
43
|
* identifier is provided. Requires OPENAI_API_KEY. gpt-5-mini is the
|
|
44
44
|
* lightweight reasoning tier — enough for subagent work, and it exposes
|
|
45
|
-
* reasoning summaries via the Responses API (lib/models/
|
|
45
|
+
* reasoning summaries via the Responses API (lib/models/gptAdapter.ts).
|
|
46
46
|
*/
|
|
47
47
|
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
|
-
* identifier is provided. Requires XAI_API_KEY (lib/models/
|
|
50
|
+
* identifier is provided. Requires XAI_API_KEY (lib/models/grokAdapter.ts).
|
|
51
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
|
*/
|
|
@@ -64,7 +64,7 @@ export const DEFAULT_GROK_REASONING_EFFORT = 'medium';
|
|
|
64
64
|
/**
|
|
65
65
|
* Default Moonshot model used when a kimi-* model is requested but no
|
|
66
66
|
* specific identifier is provided. Requires MOONSHOT_API_KEY
|
|
67
|
-
* (lib/models/
|
|
67
|
+
* (lib/models/kimiAdapter.ts). kimi-k3 is the flagship, priced like a mid-tier
|
|
68
68
|
* closed model ($3 / $15, Claude Sonnet 4.6's price; Sonnet 5.5 is cheaper);
|
|
69
69
|
* kimi-k2.6 is the general tier at a quarter of that (the family table and
|
|
70
70
|
* the cost note are in the adapter's header).
|
|
@@ -86,7 +86,7 @@ export const DEFAULT_KIMI_REASONING_EFFORT = 'high';
|
|
|
86
86
|
*/
|
|
87
87
|
export const DEFAULT_MAX_STEPS = 50;
|
|
88
88
|
/**
|
|
89
|
-
* Default open-weight model, served locally by Ollama (lib/models/
|
|
89
|
+
* Default open-weight model, served locally by Ollama (lib/models/ollamaAdapter.ts).
|
|
90
90
|
* qwen3:8b is the smallest pulled model that supports tool calling — the
|
|
91
91
|
* floor capability for syndicate delegation. Vision work uses ollama/qwen3-vl:8b.
|
|
92
92
|
*/
|
package/dist/lib/doctor.d.ts
CHANGED
|
@@ -19,9 +19,8 @@
|
|
|
19
19
|
* come from lib/models/gateway.ts and lib/models/capabilities.ts, the same
|
|
20
20
|
* modules the registry and the A2A server use, so the report cannot
|
|
21
21
|
* disagree with what a run would do. The runtime line comes from
|
|
22
|
-
* lib/runtime/runtimeFlag.ts, which a turn reads (ADR
|
|
23
|
-
*
|
|
24
|
-
* loads ADK to answer it.
|
|
22
|
+
* lib/runtime/runtimeFlag.ts, which a turn reads (ADR 0107): a leftover
|
|
23
|
+
* MELCHIZEDEK_RUNTIME=adk is a problem.
|
|
25
24
|
*/
|
|
26
25
|
import type { Platform } from './models/endpoints.ts';
|
|
27
26
|
import type { CapabilityGap, CapabilityReport } from './models/capabilities.ts';
|
|
@@ -85,24 +84,18 @@ export interface Unlock {
|
|
|
85
84
|
/** Syndicates this one variable would move from blocked to ready. */
|
|
86
85
|
syndicates: string[];
|
|
87
86
|
}
|
|
88
|
-
/** The runtime a turn would run on here, where that came from
|
|
87
|
+
/** The runtime a turn would run on here, and where that came from (ADR 0107). */
|
|
89
88
|
export interface DoctorRuntime {
|
|
90
89
|
/** The runtime in use; undefined when MELCHIZEDEK_RUNTIME holds a value no turn accepts (`problem` says so). */
|
|
91
90
|
runtime?: RuntimeName;
|
|
92
91
|
/** Where it came from: MELCHIZEDEK_RUNTIME, or the default (a turn's own option is the caller's, not the environment's). */
|
|
93
92
|
source?: RuntimeSource;
|
|
94
|
-
/** @google/adk: whether it resolves from here, its version, and whether the runtime in use needs it. */
|
|
95
|
-
adk: {
|
|
96
|
-
installed: boolean;
|
|
97
|
-
version?: string;
|
|
98
|
-
needed: boolean;
|
|
99
|
-
};
|
|
100
93
|
/** Why no turn would run as configured, if none would. */
|
|
101
94
|
problem?: string;
|
|
102
95
|
}
|
|
103
96
|
export interface DoctorResult {
|
|
104
97
|
agentsDir: string;
|
|
105
|
-
/** The runtime in use
|
|
98
|
+
/** The runtime in use. */
|
|
106
99
|
runtime: DoctorRuntime;
|
|
107
100
|
syndicates: DoctorSyndicate[];
|
|
108
101
|
unlocks: Unlock[];
|
|
@@ -133,10 +126,11 @@ export interface DoctorEndpoint {
|
|
|
133
126
|
}
|
|
134
127
|
/**
|
|
135
128
|
* The runtime a turn would run on under this environment (lib/runtime/
|
|
136
|
-
* runtimeFlag.ts), where that came from
|
|
137
|
-
*
|
|
129
|
+
* runtimeFlag.ts), and where that came from. MELCHIZEDEK_RUNTIME=adk is a
|
|
130
|
+
* problem: every turn, and the server's startup, would fail
|
|
131
|
+
* (RuntimeRemovedError, ADR 0107).
|
|
138
132
|
*/
|
|
139
|
-
export declare function runtimeReport(env?: NodeJS.ProcessEnv
|
|
133
|
+
export declare function runtimeReport(env?: NodeJS.ProcessEnv): DoctorRuntime;
|
|
140
134
|
/** One row per provider that is not on its vendor's public API with an env key. */
|
|
141
135
|
export declare function endpointRows(): DoctorEndpoint[];
|
|
142
136
|
export declare const CONSOLE_URLS: Record<ProviderId, string>;
|