@moldea.ai/adapter-cloudflare-agents 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 CHANGED
@@ -8,7 +8,7 @@ The package implements the official `cloudflare-agents` runtime adapter for `@mo
8
8
 
9
9
  ## Supported targets
10
10
 
11
- Version `3.0.1` supports:
11
+ Version `3.0.2` supports:
12
12
 
13
13
  - Repository Format version `1`
14
14
  - `@moldea.ai/core ^4.0.0`
@@ -71,6 +71,8 @@ Evidence is source-grounded, references existing repository files, and contains
71
71
 
72
72
  ## Documentation
73
73
 
74
+ - [Complete binding example](docs/binding-example.md): manifest, canonical instructions, runtime source, and supported schema or routing relationships.
75
+
74
76
  These guides are included in the installed package. Open only the page relevant to your task.
75
77
 
76
78
  - [Adapter contract](docs/index.md)
@@ -0,0 +1,239 @@
1
+ ---
2
+ title: Binding example
3
+ description: Complete manifest and source files for inspecting cloudflare-agents 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
+ Both exported classes are bound separately. Think connects `getSystemPrompt` and the closed `getTools` map; it has no agent input/output schema evidence. AIChatAgent connects its direct `streamText` call and `Output.object` schema. `agentTool` supplies the exact target routing description. Function tools bind `execute`, `inputSchema`, and `outputSchema`. The Markdown imports require the application's Worker text-module configuration; this is not a deployable Worker scaffold.
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
+ support:
27
+ runtime:
28
+ id: 'cloudflare-agents'
29
+ bindings:
30
+ runtimeAgent:
31
+ path: '/src/agents.ts'
32
+ symbol: 'SupportAgent'
33
+ instructionLoader:
34
+ path: '/src/instructions.ts'
35
+ symbol: 'loadSupportInstruction'
36
+ tools:
37
+ find-order:
38
+ name: 'find_order'
39
+ description: 'Finds an order.'
40
+ implementation:
41
+ path: '/src/implementations.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
+ outputSchema:
50
+ path: '/src/contracts.ts'
51
+ symbol: 'FindOrderOutputSchema'
52
+ summary:
53
+ runtime:
54
+ id: 'cloudflare-agents'
55
+ bindings:
56
+ runtimeAgent:
57
+ path: '/src/agents.ts'
58
+ symbol: 'SummaryAgent'
59
+ instructionLoader:
60
+ path: '/src/instructions.ts'
61
+ symbol: 'loadSummaryInstruction'
62
+ outputSchema:
63
+ path: '/src/contracts.ts'
64
+ symbol: 'SummaryOutputSchema'
65
+ tools:
66
+ find-order:
67
+ name: 'find_order'
68
+ description: 'Finds an order.'
69
+ implementation:
70
+ path: '/src/implementations.ts'
71
+ symbol: 'findOrder'
72
+ registration:
73
+ path: '/src/tools.ts'
74
+ symbol: 'findOrderTool'
75
+ inputSchema:
76
+ path: '/src/contracts.ts'
77
+ symbol: 'FindOrderInputSchema'
78
+ outputSchema:
79
+ path: '/src/contracts.ts'
80
+ symbol: 'FindOrderOutputSchema'
81
+ ```
82
+
83
+ ### /package.json
84
+
85
+ ```json
86
+ {
87
+ "dependencies": {
88
+ "@cloudflare/think": "^0.16.0",
89
+ "@cloudflare/ai-chat": "^0.10.2",
90
+ "agents": "^0.21.0",
91
+ "ai": "^7.0.0",
92
+ "zod": "4.6.4"
93
+ },
94
+ "name": "binding-example",
95
+ "private": true,
96
+ "type": "module"
97
+ }
98
+ ```
99
+
100
+ ### /moldea/project.md
101
+
102
+ ```markdown
103
+ # Fixture project
104
+ ```
105
+
106
+ ### /moldea/agents/support/description.md
107
+
108
+ ```markdown
109
+ Supports customers.
110
+ ```
111
+
112
+ ### /moldea/agents/support/instruction.md
113
+
114
+ ```markdown
115
+ You are the `support` agent.
116
+
117
+ Answer from supplied support facts. Do not invent order status or account information.
118
+ ```
119
+
120
+ ### /moldea/agents/summary/description.md
121
+
122
+ ```markdown
123
+ Summarizes requests.
124
+ ```
125
+
126
+ ### /moldea/agents/summary/handoff-description.md
127
+
128
+ ```markdown
129
+ Summarizes a support request.
130
+ ```
131
+
132
+ ### /moldea/agents/summary/instruction.md
133
+
134
+ ```markdown
135
+ You are the `summary` agent.
136
+
137
+ Summarize the supplied support request without inventing facts.
138
+ ```
139
+
140
+ ### /src/contracts.ts
141
+
142
+ ```typescript
143
+ import { z } from 'zod';
144
+
145
+ // response and tool contracts
146
+ export const SummaryOutputSchema = z.object({ summary: z.string() });
147
+ export const FindOrderInputSchema = z.object({ orderId: z.string() });
148
+ export const FindOrderOutputSchema = z.object({
149
+ orderId: z.string(),
150
+ status: z.enum(['shipped', 'not_found']),
151
+ });
152
+ ```
153
+
154
+ ### /src/instructions.ts
155
+
156
+ ```typescript
157
+ import supportInstruction from '../moldea/agents/support/instruction.md';
158
+ import summaryInstruction from '../moldea/agents/summary/instruction.md';
159
+
160
+ /** Loads the canonical support text through the Worker text-module loader. */
161
+ export const loadSupportInstruction = () => supportInstruction;
162
+ /** Loads the canonical summary text through the Worker text-module loader. */
163
+ export const loadSummaryInstruction = () => summaryInstruction;
164
+ ```
165
+
166
+ ### /src/implementations.ts
167
+
168
+ ```typescript
169
+ /** Looks up an order in the example's fixed catalog. */
170
+ export const findOrder = async ({ orderId }: { orderId: string }) => ({
171
+ orderId,
172
+ status: orderId === 'order-1042' ? ('shipped' as const) : ('not_found' as const),
173
+ });
174
+ ```
175
+
176
+ ### /src/tools.ts
177
+
178
+ ```typescript
179
+ import { tool } from 'ai';
180
+ import { FindOrderInputSchema, FindOrderOutputSchema } from './contracts.js';
181
+ import { findOrder } from './implementations.js';
182
+ export const findOrderTool = tool({
183
+ inputSchema: FindOrderInputSchema,
184
+ outputSchema: FindOrderOutputSchema,
185
+ execute: findOrder,
186
+ });
187
+ ```
188
+
189
+ ### /src/agents.ts
190
+
191
+ ```typescript
192
+ import { AIChatAgent } from '@cloudflare/ai-chat';
193
+ import { Think } from '@cloudflare/think';
194
+ import { agentTool } from 'agents/agent-tools';
195
+ import { Output, streamText } from 'ai';
196
+ import { SummaryOutputSchema } from './contracts.js';
197
+ import { loadSummaryInstruction, loadSupportInstruction } from './instructions.js';
198
+ import { findOrderTool } from './tools.js';
199
+
200
+ export class SummaryAgent extends AIChatAgent {
201
+ onChatMessage(_onFinish: unknown, _options?: unknown) {
202
+ return streamText({
203
+ model: 'openai/gpt-5',
204
+ prompt: 'Summarize this support request.',
205
+ instructions: loadSummaryInstruction(),
206
+ output: Output.object({ schema: SummaryOutputSchema }),
207
+ tools: { find_order: findOrderTool },
208
+ });
209
+ }
210
+ }
211
+
212
+ export const summaryHandoffTool = agentTool(SummaryAgent, {
213
+ description: 'Summarizes a support request.',
214
+ });
215
+
216
+ export class SupportAgent extends Think {
217
+ getSystemPrompt() {
218
+ return loadSupportInstruction();
219
+ }
220
+ getTools() {
221
+ return { find_order: findOrderTool, summarize: summaryHandoffTool };
222
+ }
223
+ }
224
+ ```
225
+
226
+ ### /src/assets.d.ts
227
+
228
+ ```typescript
229
+ declare module '*.md' {
230
+ const text: string;
231
+ export default text;
232
+ }
233
+ ```
234
+
235
+ <!-- example:end -->
236
+
237
+ ## What the check establishes
238
+
239
+ 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
@@ -11,3 +11,5 @@ order: 0
11
11
  The adapter inspects TypeScript source through the repository reader supplied by Core. It does not execute source, load Cloudflare packages, inspect `node_modules`, use credentials, or make network requests. Runtime applications register the singleton with `createCore({ adapters: [cloudflareAgentsAdapter] })`; the local CLI registers active official adapters automatically.
12
12
 
13
13
  The [Runtime Compatibility Matrix](https://packages.moldea.ai/compatibility/) is authoritative. This documentation explains the package behavior but does not expand the verified target boundary.
14
+
15
+ Start with the [complete binding example](https://packages.moldea.ai/adapters/cloudflare-agents/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-cloudflare-agents",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "Deterministic runtime evidence and diagnostics for Cloudflare Agents integrations.",
5
5
  "homepage": "https://github.com/moldea-ai/packages/tree/main/projects/adapter-cloudflare-agents#readme",
6
6
  "bugs": {