@moldea.ai/adapter-claude-agent-sdk 3.0.1 → 3.0.2
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/README.md +3 -1
- package/docs/binding-example.md +235 -0
- package/docs/index.md +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ The package implements the official `claude-agent-sdk` runtime adapter for `@mol
|
|
|
8
8
|
|
|
9
9
|
## Supported target
|
|
10
10
|
|
|
11
|
-
Version `3.0.
|
|
11
|
+
Version `3.0.2` supports:
|
|
12
12
|
|
|
13
13
|
- Repository Format version `1`
|
|
14
14
|
- `@moldea.ai/core ^4.0.0`
|
|
@@ -91,6 +91,8 @@ Unit and integration tests are colocated with their implementation modules. Adap
|
|
|
91
91
|
|
|
92
92
|
## Documentation
|
|
93
93
|
|
|
94
|
+
- [Complete binding example](docs/binding-example.md): manifest, canonical instructions, runtime source, and supported schema or routing relationships.
|
|
95
|
+
|
|
94
96
|
These guides are included in the installed package. Open only the page relevant to your task.
|
|
95
97
|
|
|
96
98
|
- [Package overview](docs/index.md)
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Binding example
|
|
3
|
+
description: Complete manifest and source files for inspecting claude-agent-sdk bindings locally.
|
|
4
|
+
order: 5
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Binding example
|
|
8
|
+
|
|
9
|
+
Read this example before searching adapter implementation for binding syntax. It is a complete **static inspection** file set, not a deployment starter or a live provider test. The files are checked together through this adapter and Core without installing or executing the target SDK. Keep application setup, credentials, provider model access, tool execution, and deployment configuration separate.
|
|
10
|
+
|
|
11
|
+
## How the bindings connect
|
|
12
|
+
|
|
13
|
+
Bind the query function and each exported programmatic subagent object separately. Query `systemPrompt` and child `prompt` call their canonical loaders. Query `outputFormat.schema` binds the JSON Schema constant. `tools: ['Agent']` enables delegation; child `description` matches its canonical handoff description. MCP tool names use the query server key (`mcp__support__find_order`), not the server's display name. `tool` takes a Zod property map, whereas `outputFormat` takes JSON Schema. This target does not establish tool output-schema evidence.
|
|
14
|
+
|
|
15
|
+
Paths below are repository-root-relative logical paths. Keep the canonical instructions as the policy source. General manifest semantics belong to the [Repository Format specification](https://packages.moldea.ai/repository-format/). Use the other local guides for the full supported boundary and limitations; this example does not expand them.
|
|
16
|
+
|
|
17
|
+
## Files
|
|
18
|
+
|
|
19
|
+
<!-- example:start -->
|
|
20
|
+
|
|
21
|
+
### /moldea/moldea.yaml
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
version: 1
|
|
25
|
+
agents:
|
|
26
|
+
billing:
|
|
27
|
+
runtime:
|
|
28
|
+
id: 'claude-agent-sdk'
|
|
29
|
+
bindings:
|
|
30
|
+
runtimeAgent:
|
|
31
|
+
path: '/src/agents.ts'
|
|
32
|
+
symbol: 'billingAgent'
|
|
33
|
+
instructionLoader:
|
|
34
|
+
path: '/src/instructions.ts'
|
|
35
|
+
symbol: 'loadBillingInstruction'
|
|
36
|
+
tools:
|
|
37
|
+
find-order:
|
|
38
|
+
name: 'mcp__support__find_order'
|
|
39
|
+
description: 'Retrieves one order by its identifier.'
|
|
40
|
+
implementation:
|
|
41
|
+
path: '/src/find-order.ts'
|
|
42
|
+
symbol: 'findOrder'
|
|
43
|
+
registration:
|
|
44
|
+
path: '/src/tools.ts'
|
|
45
|
+
symbol: 'findOrderTool'
|
|
46
|
+
inputSchema:
|
|
47
|
+
path: '/src/contracts.ts'
|
|
48
|
+
symbol: 'FindOrderInputSchema'
|
|
49
|
+
triage:
|
|
50
|
+
runtime:
|
|
51
|
+
id: 'claude-agent-sdk'
|
|
52
|
+
bindings:
|
|
53
|
+
runtimeAgent:
|
|
54
|
+
path: '/src/runtime.ts'
|
|
55
|
+
symbol: 'triageAgent'
|
|
56
|
+
instructionLoader:
|
|
57
|
+
path: '/src/instructions.ts'
|
|
58
|
+
symbol: 'loadTriageInstruction'
|
|
59
|
+
outputSchema:
|
|
60
|
+
path: '/src/contracts.ts'
|
|
61
|
+
symbol: 'TriageOutputSchema'
|
|
62
|
+
tools:
|
|
63
|
+
find-order:
|
|
64
|
+
name: 'mcp__support__find_order'
|
|
65
|
+
description: 'Retrieves one order by its identifier.'
|
|
66
|
+
implementation:
|
|
67
|
+
path: '/src/find-order.ts'
|
|
68
|
+
symbol: 'findOrder'
|
|
69
|
+
registration:
|
|
70
|
+
path: '/src/tools.ts'
|
|
71
|
+
symbol: 'findOrderTool'
|
|
72
|
+
inputSchema:
|
|
73
|
+
path: '/src/contracts.ts'
|
|
74
|
+
symbol: 'FindOrderInputSchema'
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### /moldea/project.md
|
|
78
|
+
|
|
79
|
+
```markdown
|
|
80
|
+
# Claude Agent SDK adapter fixture
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### /moldea/agents/billing/description.md
|
|
84
|
+
|
|
85
|
+
```markdown
|
|
86
|
+
Handles customer billing requests.
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### /moldea/agents/billing/handoff-description.md
|
|
90
|
+
|
|
91
|
+
```markdown
|
|
92
|
+
Route billing questions and payment issues here.
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### /moldea/agents/billing/instruction.md
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
You are the `billing` agent.
|
|
99
|
+
|
|
100
|
+
Resolve billing requests from the supplied facts. Ask when essential details are missing.
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### /moldea/agents/triage/description.md
|
|
104
|
+
|
|
105
|
+
```markdown
|
|
106
|
+
Routes customer support requests.
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### /moldea/agents/triage/instruction.md
|
|
110
|
+
|
|
111
|
+
```markdown
|
|
112
|
+
You are the `triage` agent.
|
|
113
|
+
|
|
114
|
+
Route billing requests to billing. Do not invent account facts.
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### /package.json
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"dependencies": {
|
|
122
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.234",
|
|
123
|
+
"zod": "4.6.4"
|
|
124
|
+
},
|
|
125
|
+
"name": "binding-example",
|
|
126
|
+
"private": true,
|
|
127
|
+
"type": "module"
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### /src/agents.ts
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
import { loadBillingInstruction } from './instructions.js';
|
|
135
|
+
|
|
136
|
+
export const billingAgent = {
|
|
137
|
+
description: 'Route billing questions and payment issues here.',
|
|
138
|
+
prompt: loadBillingInstruction(),
|
|
139
|
+
tools: ['mcp__support__find_order'],
|
|
140
|
+
};
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### /src/contracts.ts
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
import { z } from 'zod';
|
|
147
|
+
|
|
148
|
+
// response and tool contracts
|
|
149
|
+
export const TriageOutputSchema = {
|
|
150
|
+
type: 'object',
|
|
151
|
+
properties: { summary: { type: 'string' } },
|
|
152
|
+
required: ['summary'],
|
|
153
|
+
additionalProperties: false,
|
|
154
|
+
} as const;
|
|
155
|
+
export const FindOrderInputSchema = { orderId: z.string() };
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### /src/find-order.ts
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
/** Returns one sample order as MCP text content. */
|
|
162
|
+
export const findOrder = async ({ orderId }: { orderId: string }) => ({
|
|
163
|
+
content: [
|
|
164
|
+
{
|
|
165
|
+
type: 'text' as const,
|
|
166
|
+
text: JSON.stringify({ orderId, status: orderId === 'order-1042' ? 'shipped' : 'not_found' }),
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
});
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### /src/instructions.ts
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
import { readFileSync } from 'node:fs';
|
|
176
|
+
|
|
177
|
+
/** Reads the canonical billing instruction. */
|
|
178
|
+
export const loadBillingInstruction = (): string =>
|
|
179
|
+
readFileSync(new URL('../moldea/agents/billing/instruction.md', import.meta.url), 'utf8');
|
|
180
|
+
|
|
181
|
+
/** Reads the canonical triage instruction. */
|
|
182
|
+
export const loadTriageInstruction = (): string =>
|
|
183
|
+
readFileSync(new URL('../moldea/agents/triage/instruction.md', import.meta.url), 'utf8');
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### /src/runtime.ts
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
import { query } from '@anthropic-ai/claude-agent-sdk';
|
|
190
|
+
|
|
191
|
+
import { billingAgent } from './agents.js';
|
|
192
|
+
import { TriageOutputSchema } from './contracts.js';
|
|
193
|
+
import { loadTriageInstruction } from './instructions.js';
|
|
194
|
+
import { supportServer } from './tools.js';
|
|
195
|
+
|
|
196
|
+
export const triageAgent = async (prompt: string) =>
|
|
197
|
+
query({
|
|
198
|
+
prompt,
|
|
199
|
+
options: {
|
|
200
|
+
systemPrompt: await loadTriageInstruction(),
|
|
201
|
+
outputFormat: { type: 'json_schema', schema: TriageOutputSchema },
|
|
202
|
+
agents: { billing: billingAgent },
|
|
203
|
+
tools: ['Agent'],
|
|
204
|
+
mcpServers: { support: supportServer },
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### /src/tools.ts
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
import { createSdkMcpServer, tool } from '@anthropic-ai/claude-agent-sdk';
|
|
213
|
+
|
|
214
|
+
import { FindOrderInputSchema } from './contracts.js';
|
|
215
|
+
import { findOrder } from './find-order.js';
|
|
216
|
+
|
|
217
|
+
export const findOrderTool = tool(
|
|
218
|
+
'find_order',
|
|
219
|
+
'Retrieves one order by its identifier.',
|
|
220
|
+
FindOrderInputSchema,
|
|
221
|
+
findOrder,
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
export const supportServer = createSdkMcpServer({
|
|
225
|
+
name: 'support-tools',
|
|
226
|
+
version: '1.0.0',
|
|
227
|
+
tools: [findOrderTool],
|
|
228
|
+
});
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
<!-- example:end -->
|
|
232
|
+
|
|
233
|
+
## What the check establishes
|
|
234
|
+
|
|
235
|
+
The integration check reads these exact file blocks, requires positive adapter evidence for the documented relationships, and rejects a broken runtime binding. It does not prove that instructions are followed, that every SDK version accepts these forms, or that the application is ready for production. Continue using the installed adapter diagnostics for your actual source.
|
package/docs/index.md
CHANGED
|
@@ -27,3 +27,5 @@ The adapter never imports or calls the SDK, requires no API key, executes no rep
|
|
|
27
27
|
## Public surface
|
|
28
28
|
|
|
29
29
|
The package exports only `claudeAgentSdkAdapter`. It has no default export, configuration factory, SDK facade, parser export, public diagnostic registry, or mutable runtime state. The generated [API reference](https://packages.moldea.ai/adapters/claude-agent-sdk/api/) derives that surface from the package export.
|
|
30
|
+
|
|
31
|
+
Start with the [complete binding example](https://packages.moldea.ai/adapters/claude-agent-sdk/binding-example/) when connecting runtime source to canonical instructions, schemas, tools, or routing metadata. The same example ships locally as `docs/binding-example.md` in the installed package.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moldea.ai/adapter-claude-agent-sdk",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Deterministic runtime evidence and diagnostics for Claude Agent SDK query and subagent integrations.",
|
|
5
5
|
"homepage": "https://github.com/moldea-ai/packages/tree/main/projects/adapter-claude-agent-sdk#readme",
|
|
6
6
|
"bugs": {
|