@cloudflare/think 0.2.0 → 0.2.1
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 +134 -31
- package/dist/extensions/index.d.ts +20 -10
- package/dist/extensions/index.js +96 -8
- package/dist/extensions/index.js.map +1 -1
- package/dist/hook-proxy-f_DqtJ9u.js +32 -0
- package/dist/hook-proxy-f_DqtJ9u.js.map +1 -0
- package/dist/index-BsB4GUsL.d.ts +109 -0
- package/dist/{index-CAMRySsy.d.ts → manager-DCbSiSWT.d.ts} +106 -41
- package/dist/{manager-BY5AZLVa.js → manager-dtoAI3A6.js} +115 -8
- package/dist/manager-dtoAI3A6.js.map +1 -0
- package/dist/think.d.ts +294 -69
- package/dist/think.js +360 -119
- package/dist/think.js.map +1 -1
- package/dist/tools/execute.d.ts +1 -1
- package/dist/tools/extensions.d.ts +3 -3
- package/dist/tools/extensions.js +3 -3
- package/dist/tools/extensions.js.map +1 -1
- package/package.json +2 -5
- package/dist/manager-BY5AZLVa.js.map +0 -1
- /package/dist/{classPrivateFieldGet2-B0jG-d4Z.js → classPrivateFieldGet2-DZKvdPZj.js} +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ToolSet } from "ai";
|
|
2
|
-
import { WorkerEntrypoint } from "cloudflare:workers";
|
|
3
2
|
|
|
4
3
|
//#region src/extensions/types.d.ts
|
|
5
4
|
/**
|
|
@@ -10,11 +9,11 @@ import { WorkerEntrypoint } from "cloudflare:workers";
|
|
|
10
9
|
* access to the host (workspace, network) via permissions.
|
|
11
10
|
*/
|
|
12
11
|
/**
|
|
13
|
-
* Manifest declaring an extension's identity and
|
|
12
|
+
* Manifest declaring an extension's identity, permissions, and contributions.
|
|
14
13
|
* Passed to ExtensionManager.load() alongside the extension source.
|
|
15
14
|
*/
|
|
16
15
|
interface ExtensionManifest {
|
|
17
|
-
/** Unique name for this extension (used as namespace prefix for tools). */
|
|
16
|
+
/** Unique name for this extension (used as namespace prefix for tools and context). */
|
|
18
17
|
name: string;
|
|
19
18
|
/** Semver version string. */
|
|
20
19
|
version: string;
|
|
@@ -22,6 +21,36 @@ interface ExtensionManifest {
|
|
|
22
21
|
description?: string;
|
|
23
22
|
/** Permission declarations — controls what the extension can access. */
|
|
24
23
|
permissions?: ExtensionPermissions;
|
|
24
|
+
/**
|
|
25
|
+
* Context blocks contributed by this extension.
|
|
26
|
+
* Labels are namespaced as `{extName}_{label}` at registration.
|
|
27
|
+
* Currently backed by SQLite storage — extensions write via
|
|
28
|
+
* `host.setContext()`. Direct RPC delegation is planned for Phase 4.
|
|
29
|
+
*/
|
|
30
|
+
context?: Array<{
|
|
31
|
+
/** Block label (namespaced as {extName}_{label}). */ label: string /** Human-readable description shown in the system prompt header. */;
|
|
32
|
+
description?: string;
|
|
33
|
+
/** Block type determines which tools are generated.
|
|
34
|
+
* Note: not yet enforced — all blocks use SQLite-backed storage
|
|
35
|
+
* until bridge providers are implemented (Phase 4). */
|
|
36
|
+
type:
|
|
37
|
+
| "readonly"
|
|
38
|
+
| "writable"
|
|
39
|
+
| "skill"
|
|
40
|
+
| "searchable" /** Maximum token budget for this block. */;
|
|
41
|
+
maxTokens?: number;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Lifecycle hooks this extension provides handlers for.
|
|
45
|
+
* The extension Worker must expose corresponding RPC methods.
|
|
46
|
+
*/
|
|
47
|
+
hooks?: Array<
|
|
48
|
+
| "beforeTurn"
|
|
49
|
+
| "beforeToolCall"
|
|
50
|
+
| "afterToolCall"
|
|
51
|
+
| "onStepFinish"
|
|
52
|
+
| "onChunk"
|
|
53
|
+
>;
|
|
25
54
|
}
|
|
26
55
|
interface ExtensionPermissions {
|
|
27
56
|
/**
|
|
@@ -41,6 +70,30 @@ interface ExtensionPermissions {
|
|
|
41
70
|
* - "read-write": can read, write, and delete files
|
|
42
71
|
*/
|
|
43
72
|
workspace?: "read" | "read-write" | "none";
|
|
73
|
+
/**
|
|
74
|
+
* Context block access.
|
|
75
|
+
* - `read`: which labels the extension can read ("all" or specific list)
|
|
76
|
+
* - `write`: which labels the extension can write ("own" = only its manifest-declared labels, or specific list)
|
|
77
|
+
*/
|
|
78
|
+
context?: {
|
|
79
|
+
read?: string[] | "all";
|
|
80
|
+
write?: string[] | "own";
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Message history access.
|
|
84
|
+
* - "none" (default): no access
|
|
85
|
+
* - "read": can read conversation history
|
|
86
|
+
*/
|
|
87
|
+
messages?: "none" | "read";
|
|
88
|
+
/**
|
|
89
|
+
* Session-level capabilities.
|
|
90
|
+
* - `sendMessage`: can inject user messages (queued when inside inference loop)
|
|
91
|
+
* - `metadata`: can read session metadata (message count, etc.)
|
|
92
|
+
*/
|
|
93
|
+
session?: {
|
|
94
|
+
sendMessage?: boolean;
|
|
95
|
+
metadata?: boolean;
|
|
96
|
+
};
|
|
44
97
|
}
|
|
45
98
|
/**
|
|
46
99
|
* Tool descriptor returned by the extension's describe() method.
|
|
@@ -64,10 +117,18 @@ interface ExtensionInfo {
|
|
|
64
117
|
description?: string;
|
|
65
118
|
/** Names of tools provided by this extension. */
|
|
66
119
|
tools: string[];
|
|
120
|
+
/** Namespaced context labels contributed by this extension. */
|
|
121
|
+
contextLabels: string[];
|
|
67
122
|
permissions: ExtensionPermissions;
|
|
68
123
|
}
|
|
69
124
|
//#endregion
|
|
70
125
|
//#region src/extensions/manager.d.ts
|
|
126
|
+
interface ExtensionEntrypoint {
|
|
127
|
+
describe(): Promise<string>;
|
|
128
|
+
manifest(): Promise<string>;
|
|
129
|
+
execute(toolName: string, argsJson: string): Promise<string>;
|
|
130
|
+
hook(name: string, ctxProxy: unknown): Promise<string>;
|
|
131
|
+
}
|
|
71
132
|
interface ExtensionManagerOptions {
|
|
72
133
|
/** WorkerLoader binding for creating sandboxed extension Workers. */
|
|
73
134
|
loader: WorkerLoader;
|
|
@@ -87,13 +148,16 @@ interface ExtensionManagerOptions {
|
|
|
87
148
|
*
|
|
88
149
|
* Typically wired up using HostBridgeLoopback via `ctx.exports`:
|
|
89
150
|
* ```typescript
|
|
90
|
-
* createHostBinding: (permissions) =>
|
|
151
|
+
* createHostBinding: (permissions, ownContextLabels) =>
|
|
91
152
|
* ctx.exports.HostBridgeLoopback({
|
|
92
|
-
* props: { agentClassName: "ChatSession", agentId: ctx.id.toString(), permissions }
|
|
153
|
+
* props: { agentClassName: "ChatSession", agentId: ctx.id.toString(), permissions, ownContextLabels }
|
|
93
154
|
* })
|
|
94
155
|
* ```
|
|
95
156
|
*/
|
|
96
|
-
createHostBinding?: (
|
|
157
|
+
createHostBinding?: (
|
|
158
|
+
permissions: ExtensionPermissions,
|
|
159
|
+
ownContextLabels: string[]
|
|
160
|
+
) => Fetcher;
|
|
97
161
|
}
|
|
98
162
|
declare class ExtensionManager {
|
|
99
163
|
#private;
|
|
@@ -117,8 +181,37 @@ declare class ExtensionManager {
|
|
|
117
181
|
load(manifest: ExtensionManifest, source: string): Promise<ExtensionInfo>;
|
|
118
182
|
/**
|
|
119
183
|
* Unload an extension, removing its tools from the agent.
|
|
184
|
+
* If an onUnload callback is registered, it fires with the
|
|
185
|
+
* extension's namespaced context labels so the caller can
|
|
186
|
+
* remove context blocks from the Session.
|
|
120
187
|
*/
|
|
121
188
|
unload(name: string): Promise<boolean>;
|
|
189
|
+
/**
|
|
190
|
+
* Register a callback invoked when an extension is unloaded.
|
|
191
|
+
* Think uses this to remove the extension's context blocks from Session.
|
|
192
|
+
*/
|
|
193
|
+
onUnload(
|
|
194
|
+
cb: (name: string, contextLabels: string[]) => void | Promise<void>
|
|
195
|
+
): void;
|
|
196
|
+
/**
|
|
197
|
+
* Get the namespaced context labels for all loaded extensions
|
|
198
|
+
* that declare context blocks in their manifests.
|
|
199
|
+
*/
|
|
200
|
+
getContextLabels(): Array<{
|
|
201
|
+
extName: string;
|
|
202
|
+
label: string;
|
|
203
|
+
}>;
|
|
204
|
+
/**
|
|
205
|
+
* Get extension manifest by name.
|
|
206
|
+
*/
|
|
207
|
+
getManifest(name: string): ExtensionManifest | null;
|
|
208
|
+
/**
|
|
209
|
+
* Get extensions that subscribe to a specific hook, in load order.
|
|
210
|
+
*/
|
|
211
|
+
getHookSubscribers(hookName: string): Array<{
|
|
212
|
+
name: string;
|
|
213
|
+
entrypoint: ExtensionEntrypoint;
|
|
214
|
+
}>;
|
|
122
215
|
/**
|
|
123
216
|
* List all loaded extensions.
|
|
124
217
|
*/
|
|
@@ -132,40 +225,12 @@ declare class ExtensionManager {
|
|
|
132
225
|
getTools(): ToolSet;
|
|
133
226
|
}
|
|
134
227
|
//#endregion
|
|
135
|
-
//#region src/extensions/host-bridge.d.ts
|
|
136
|
-
type HostBridgeLoopbackProps = {
|
|
137
|
-
agentClassName: string;
|
|
138
|
-
agentId: string;
|
|
139
|
-
permissions: ExtensionPermissions;
|
|
140
|
-
};
|
|
141
|
-
declare class HostBridgeLoopback extends WorkerEntrypoint<
|
|
142
|
-
Record<string, unknown>,
|
|
143
|
-
HostBridgeLoopbackProps
|
|
144
|
-
> {
|
|
145
|
-
#private;
|
|
146
|
-
private _permissions;
|
|
147
|
-
private _getAgent;
|
|
148
|
-
readFile(path: string): Promise<string | null>;
|
|
149
|
-
writeFile(path: string, content: string): Promise<void>;
|
|
150
|
-
deleteFile(path: string): Promise<boolean>;
|
|
151
|
-
listFiles(dir: string): Promise<
|
|
152
|
-
Array<{
|
|
153
|
-
name: string;
|
|
154
|
-
type: string;
|
|
155
|
-
size: number;
|
|
156
|
-
path: string;
|
|
157
|
-
}>
|
|
158
|
-
>;
|
|
159
|
-
}
|
|
160
|
-
//#endregion
|
|
161
228
|
export {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
ExtensionManagerOptions as
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
ExtensionManager as
|
|
168
|
-
ExtensionPermissions as s,
|
|
169
|
-
HostBridgeLoopback as t
|
|
229
|
+
ExtensionPermissions as a,
|
|
230
|
+
ExtensionManifest as i,
|
|
231
|
+
ExtensionManagerOptions as n,
|
|
232
|
+
ExtensionToolDescriptor as o,
|
|
233
|
+
ExtensionInfo as r,
|
|
234
|
+
ExtensionManager as t
|
|
170
235
|
};
|
|
171
|
-
//# sourceMappingURL=
|
|
236
|
+
//# sourceMappingURL=manager-DCbSiSWT.d.ts.map
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
import { a as _checkPrivateRedeclaration, i as _classPrivateFieldInitSpec, n as _classPrivateFieldSet2, r as _assertClassBrand, t as _classPrivateFieldGet2 } from "./classPrivateFieldGet2-
|
|
1
|
+
import { a as _checkPrivateRedeclaration, i as _classPrivateFieldInitSpec, n as _classPrivateFieldSet2, r as _assertClassBrand, t as _classPrivateFieldGet2 } from "./classPrivateFieldGet2-DZKvdPZj.js";
|
|
2
2
|
import { jsonSchema, tool } from "ai";
|
|
3
|
+
//#region \0rolldown/runtime.js
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __exportAll = (all, no_symbols) => {
|
|
6
|
+
let target = {};
|
|
7
|
+
for (var name in all) __defProp(target, name, {
|
|
8
|
+
get: all[name],
|
|
9
|
+
enumerable: true
|
|
10
|
+
});
|
|
11
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
12
|
+
return target;
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
3
15
|
//#region \0@oxc-project+runtime@0.122.0/helpers/classPrivateMethodInitSpec.js
|
|
4
16
|
function _classPrivateMethodInitSpec(e, a) {
|
|
5
17
|
_checkPrivateRedeclaration(e, a), a.add(e);
|
|
@@ -34,6 +46,10 @@ function _classPrivateMethodInitSpec(e, a) {
|
|
|
34
46
|
* binding that resolves the parent agent and delegates workspace operations
|
|
35
47
|
* (gated by permissions). See HostBridgeLoopback.
|
|
36
48
|
*/
|
|
49
|
+
var manager_exports = /* @__PURE__ */ __exportAll({
|
|
50
|
+
ExtensionManager: () => ExtensionManager,
|
|
51
|
+
sanitizeName: () => sanitizeName
|
|
52
|
+
});
|
|
37
53
|
/**
|
|
38
54
|
* Sanitize a name for use as a tool name prefix.
|
|
39
55
|
* Replaces any non-alphanumeric characters with underscores and
|
|
@@ -49,6 +65,7 @@ var _storage = /* @__PURE__ */ new WeakMap();
|
|
|
49
65
|
var _createHostBinding = /* @__PURE__ */ new WeakMap();
|
|
50
66
|
var _extensions = /* @__PURE__ */ new WeakMap();
|
|
51
67
|
var _restored = /* @__PURE__ */ new WeakMap();
|
|
68
|
+
var _onUnload = /* @__PURE__ */ new WeakMap();
|
|
52
69
|
var _ExtensionManager_brand = /* @__PURE__ */ new WeakSet();
|
|
53
70
|
var ExtensionManager = class {
|
|
54
71
|
constructor(options) {
|
|
@@ -58,6 +75,7 @@ var ExtensionManager = class {
|
|
|
58
75
|
_classPrivateFieldInitSpec(this, _createHostBinding, void 0);
|
|
59
76
|
_classPrivateFieldInitSpec(this, _extensions, /* @__PURE__ */ new Map());
|
|
60
77
|
_classPrivateFieldInitSpec(this, _restored, false);
|
|
78
|
+
_classPrivateFieldInitSpec(this, _onUnload, null);
|
|
61
79
|
_classPrivateFieldSet2(_loader, this, options.loader);
|
|
62
80
|
_classPrivateFieldSet2(_storage, this, options.storage ?? null);
|
|
63
81
|
_classPrivateFieldSet2(_createHostBinding, this, options.createHostBinding ?? null);
|
|
@@ -97,13 +115,63 @@ var ExtensionManager = class {
|
|
|
97
115
|
}
|
|
98
116
|
/**
|
|
99
117
|
* Unload an extension, removing its tools from the agent.
|
|
118
|
+
* If an onUnload callback is registered, it fires with the
|
|
119
|
+
* extension's namespaced context labels so the caller can
|
|
120
|
+
* remove context blocks from the Session.
|
|
100
121
|
*/
|
|
101
122
|
async unload(name) {
|
|
123
|
+
const ext = _classPrivateFieldGet2(_extensions, this).get(name);
|
|
124
|
+
if (!ext) return false;
|
|
102
125
|
const removed = _classPrivateFieldGet2(_extensions, this).delete(name);
|
|
103
126
|
if (removed && _classPrivateFieldGet2(_storage, this)) await _classPrivateFieldGet2(_storage, this).delete(`${STORAGE_PREFIX}${name}`);
|
|
127
|
+
if (removed && _classPrivateFieldGet2(_onUnload, this)) {
|
|
128
|
+
const prefix = sanitizeName(name);
|
|
129
|
+
const contextLabels = (ext.manifest.context ?? []).map((c) => `${prefix}_${c.label}`);
|
|
130
|
+
await _classPrivateFieldGet2(_onUnload, this).call(this, name, contextLabels);
|
|
131
|
+
}
|
|
104
132
|
return removed;
|
|
105
133
|
}
|
|
106
134
|
/**
|
|
135
|
+
* Register a callback invoked when an extension is unloaded.
|
|
136
|
+
* Think uses this to remove the extension's context blocks from Session.
|
|
137
|
+
*/
|
|
138
|
+
onUnload(cb) {
|
|
139
|
+
_classPrivateFieldSet2(_onUnload, this, cb);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Get the namespaced context labels for all loaded extensions
|
|
143
|
+
* that declare context blocks in their manifests.
|
|
144
|
+
*/
|
|
145
|
+
getContextLabels() {
|
|
146
|
+
const result = [];
|
|
147
|
+
for (const ext of _classPrivateFieldGet2(_extensions, this).values()) {
|
|
148
|
+
if (!ext.manifest.context) continue;
|
|
149
|
+
const prefix = sanitizeName(ext.manifest.name);
|
|
150
|
+
for (const ctx of ext.manifest.context) result.push({
|
|
151
|
+
extName: ext.manifest.name,
|
|
152
|
+
label: `${prefix}_${ctx.label}`
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Get extension manifest by name.
|
|
159
|
+
*/
|
|
160
|
+
getManifest(name) {
|
|
161
|
+
return _classPrivateFieldGet2(_extensions, this).get(name)?.manifest ?? null;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Get extensions that subscribe to a specific hook, in load order.
|
|
165
|
+
*/
|
|
166
|
+
getHookSubscribers(hookName) {
|
|
167
|
+
const result = [];
|
|
168
|
+
for (const ext of _classPrivateFieldGet2(_extensions, this).values()) if (ext.hooks.includes(hookName)) result.push({
|
|
169
|
+
name: ext.manifest.name,
|
|
170
|
+
entrypoint: ext.entrypoint
|
|
171
|
+
});
|
|
172
|
+
return result;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
107
175
|
* List all loaded extensions.
|
|
108
176
|
*/
|
|
109
177
|
list() {
|
|
@@ -141,8 +209,12 @@ async function _loadInternal(manifest, source) {
|
|
|
141
209
|
const workerModule = wrapExtensionSource(source);
|
|
142
210
|
const permissions = manifest.permissions ?? {};
|
|
143
211
|
const workerEnv = {};
|
|
144
|
-
const
|
|
145
|
-
if (_classPrivateFieldGet2(_createHostBinding, this) &&
|
|
212
|
+
const needsHost = (permissions.workspace ?? "none") !== "none" || permissions.context?.read !== void 0 || permissions.context?.write !== void 0 || (permissions.messages ?? "none") !== "none" || permissions.session?.sendMessage || permissions.session?.metadata;
|
|
213
|
+
if (_classPrivateFieldGet2(_createHostBinding, this) && needsHost) {
|
|
214
|
+
const prefix = sanitizeName(manifest.name);
|
|
215
|
+
const ownLabels = (manifest.context ?? []).map((c) => `${prefix}_${c.label}`);
|
|
216
|
+
workerEnv.host = _classPrivateFieldGet2(_createHostBinding, this).call(this, permissions, ownLabels);
|
|
217
|
+
}
|
|
146
218
|
const entrypoint = _classPrivateFieldGet2(_loader, this).get(`ext-${manifest.name}-${manifest.version}-${Date.now()}`, () => ({
|
|
147
219
|
compatibilityDate: "2025-06-01",
|
|
148
220
|
compatibilityFlags: ["nodejs_compat"],
|
|
@@ -153,9 +225,15 @@ async function _loadInternal(manifest, source) {
|
|
|
153
225
|
})).getEntrypoint();
|
|
154
226
|
const descriptorsJson = await entrypoint.describe();
|
|
155
227
|
const tools = JSON.parse(descriptorsJson);
|
|
228
|
+
let hooks = [];
|
|
229
|
+
try {
|
|
230
|
+
const manifestJson = await entrypoint.manifest();
|
|
231
|
+
hooks = JSON.parse(manifestJson).hooks ?? [];
|
|
232
|
+
} catch {}
|
|
156
233
|
_classPrivateFieldGet2(_extensions, this).set(manifest.name, {
|
|
157
234
|
manifest,
|
|
158
235
|
tools,
|
|
236
|
+
hooks,
|
|
159
237
|
entrypoint
|
|
160
238
|
});
|
|
161
239
|
return toExtensionInfo(manifest, tools);
|
|
@@ -167,17 +245,29 @@ function toExtensionInfo(manifest, tools) {
|
|
|
167
245
|
version: manifest.version,
|
|
168
246
|
description: manifest.description,
|
|
169
247
|
tools: tools.map((t) => `${prefix}_${t.name}`),
|
|
248
|
+
contextLabels: (manifest.context ?? []).map((c) => `${prefix}_${c.label}`),
|
|
170
249
|
permissions: manifest.permissions ?? {}
|
|
171
250
|
};
|
|
172
251
|
}
|
|
173
252
|
/**
|
|
174
|
-
* Wrap an extension source
|
|
175
|
-
*
|
|
253
|
+
* Wrap an extension source in a Worker module that exposes
|
|
254
|
+
* describe(), execute(), manifest(), and hook RPC methods.
|
|
255
|
+
*
|
|
256
|
+
* Source format: `({ tools: {...}, hooks: {...} })`
|
|
257
|
+
* Both `tools` and `hooks` are optional.
|
|
176
258
|
*/
|
|
177
259
|
function wrapExtensionSource(source) {
|
|
178
260
|
return `import { WorkerEntrypoint } from "cloudflare:workers";
|
|
179
261
|
|
|
180
|
-
const
|
|
262
|
+
const __ext = (${source});
|
|
263
|
+
if (__ext && typeof __ext === "object" && !("tools" in __ext) && !("hooks" in __ext)) {
|
|
264
|
+
throw new Error(
|
|
265
|
+
"Invalid extension source format. Expected { tools: {...}, hooks: {...} } " +
|
|
266
|
+
"but got a flat object. Wrap your tools in a 'tools' key."
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
const __tools = __ext.tools || {};
|
|
270
|
+
const __hooks = __ext.hooks || {};
|
|
181
271
|
|
|
182
272
|
export default class Extension extends WorkerEntrypoint {
|
|
183
273
|
describe() {
|
|
@@ -196,6 +286,12 @@ export default class Extension extends WorkerEntrypoint {
|
|
|
196
286
|
return JSON.stringify(descriptors);
|
|
197
287
|
}
|
|
198
288
|
|
|
289
|
+
manifest() {
|
|
290
|
+
return JSON.stringify({
|
|
291
|
+
hooks: Object.keys(__hooks)
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
199
295
|
async execute(toolName, argsJson) {
|
|
200
296
|
const def = __tools[toolName];
|
|
201
297
|
if (!def || !def.execute) {
|
|
@@ -209,10 +305,21 @@ export default class Extension extends WorkerEntrypoint {
|
|
|
209
305
|
return JSON.stringify({ error: err.message || String(err) });
|
|
210
306
|
}
|
|
211
307
|
}
|
|
308
|
+
|
|
309
|
+
async hook(name, ctxSnapshot) {
|
|
310
|
+
const fn = __hooks[name];
|
|
311
|
+
if (!fn) return JSON.stringify({ skipped: true });
|
|
312
|
+
try {
|
|
313
|
+
const result = await fn(ctxSnapshot);
|
|
314
|
+
return JSON.stringify({ result: result ?? {} });
|
|
315
|
+
} catch (err) {
|
|
316
|
+
return JSON.stringify({ error: err.message || String(err) });
|
|
317
|
+
}
|
|
318
|
+
}
|
|
212
319
|
}
|
|
213
320
|
`;
|
|
214
321
|
}
|
|
215
322
|
//#endregion
|
|
216
|
-
export {
|
|
323
|
+
export { _classPrivateMethodInitSpec as i, manager_exports as n, sanitizeName as r, ExtensionManager as t };
|
|
217
324
|
|
|
218
|
-
//# sourceMappingURL=manager-
|
|
325
|
+
//# sourceMappingURL=manager-dtoAI3A6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager-dtoAI3A6.js","names":[],"sources":["../src/extensions/manager.ts"],"sourcesContent":["/**\n * ExtensionManager — loads, manages, and exposes tools from extension Workers.\n *\n * Extensions are sandboxed Workers created via WorkerLoader. Each extension\n * declares tools (with JSON Schema inputs) and permissions. The manager:\n *\n * 1. Wraps extension source in a Worker module with describe/execute RPC\n * 2. Loads it via WorkerLoader with permission-gated bindings\n * 3. Discovers tools via describe() RPC call\n * 4. Exposes them as AI SDK tools via getTools()\n *\n * Extension source format — a JS object expression defining tools:\n *\n * ```js\n * ({\n * greet: {\n * description: \"Greet someone\",\n * parameters: { name: { type: \"string\" } },\n * required: [\"name\"],\n * execute: async (args, host) => `Hello, ${args.name}!`\n * }\n * })\n * ```\n *\n * The `host` parameter in execute is provided via `env.host` — a loopback\n * binding that resolves the parent agent and delegates workspace operations\n * (gated by permissions). See HostBridgeLoopback.\n */\n\nimport { tool, jsonSchema } from \"ai\";\nimport type { ToolSet } from \"ai\";\nimport type {\n ExtensionManifest,\n ExtensionPermissions,\n ExtensionInfo,\n ExtensionToolDescriptor\n} from \"./types\";\n\n/**\n * Sanitize a name for use as a tool name prefix.\n * Replaces any non-alphanumeric characters with underscores and\n * collapses consecutive underscores.\n */\nexport function sanitizeName(name: string): string {\n if (!name || name.trim().length === 0) {\n throw new Error(\"Extension name must not be empty\");\n }\n return name\n .replace(/[^a-zA-Z0-9]/g, \"_\")\n .replace(/_+/g, \"_\")\n .replace(/^_|_$/g, \"\");\n}\n\ninterface ExtensionEntrypoint {\n describe(): Promise<string>;\n manifest(): Promise<string>;\n execute(toolName: string, argsJson: string): Promise<string>;\n hook(name: string, ctxProxy: unknown): Promise<string>;\n}\n\ninterface LoadedExtension {\n manifest: ExtensionManifest;\n tools: ExtensionToolDescriptor[];\n hooks: string[];\n entrypoint: ExtensionEntrypoint;\n}\n\n/** Shape persisted to DO storage for each extension. */\ninterface PersistedExtension {\n manifest: ExtensionManifest;\n source: string;\n}\n\nconst STORAGE_PREFIX = \"ext:\";\n\nexport interface ExtensionManagerOptions {\n /** WorkerLoader binding for creating sandboxed extension Workers. */\n loader: WorkerLoader;\n /**\n * Durable Object storage for persisting extensions across hibernation.\n * If provided, loaded extensions survive DO restarts. Call `restore()`\n * on each turn to rebuild in-memory state from storage.\n */\n storage?: DurableObjectStorage;\n /**\n * Factory that creates a loopback Fetcher for workspace access, given\n * an extension's declared permissions. The returned binding is injected\n * into the extension worker's `env.host`.\n *\n * If not provided, extensions receive no host binding (workspace tools\n * will get `null` for the host parameter).\n *\n * Typically wired up using HostBridgeLoopback via `ctx.exports`:\n * ```typescript\n * createHostBinding: (permissions, ownContextLabels) =>\n * ctx.exports.HostBridgeLoopback({\n * props: { agentClassName: \"ChatSession\", agentId: ctx.id.toString(), permissions, ownContextLabels }\n * })\n * ```\n */\n createHostBinding?: (\n permissions: ExtensionPermissions,\n ownContextLabels: string[]\n ) => Fetcher;\n}\n\nexport class ExtensionManager {\n #loader: WorkerLoader;\n #storage: DurableObjectStorage | null;\n #createHostBinding:\n | ((\n permissions: ExtensionPermissions,\n ownContextLabels: string[]\n ) => Fetcher)\n | null;\n #extensions = new Map<string, LoadedExtension>();\n #restored = false;\n #onUnload:\n | ((name: string, contextLabels: string[]) => void | Promise<void>)\n | null = null;\n\n constructor(options: ExtensionManagerOptions) {\n this.#loader = options.loader;\n this.#storage = options.storage ?? null;\n this.#createHostBinding = options.createHostBinding ?? null;\n }\n\n /**\n * Load an extension from source code.\n *\n * The source is a JS object expression defining tools. Each tool has\n * `description`, `parameters` (JSON Schema properties), optional\n * `required` array, and an `execute` async function.\n *\n * @returns Summary of the loaded extension including discovered tools.\n */\n /**\n * Restore extensions from DO storage after hibernation.\n *\n * Idempotent — skips extensions already in memory. Call this at the\n * start of each chat turn (e.g. in onChatMessage before getTools).\n */\n async restore(): Promise<void> {\n if (this.#restored || !this.#storage) return;\n this.#restored = true;\n\n const entries = await this.#storage.list<PersistedExtension>({\n prefix: STORAGE_PREFIX\n });\n\n for (const persisted of entries.values()) {\n if (this.#extensions.has(persisted.manifest.name)) continue;\n await this.#loadInternal(persisted.manifest, persisted.source);\n }\n }\n\n async load(\n manifest: ExtensionManifest,\n source: string\n ): Promise<ExtensionInfo> {\n if (this.#extensions.has(manifest.name)) {\n throw new Error(\n `Extension \"${manifest.name}\" is already loaded. Unload it first.`\n );\n }\n\n const info = await this.#loadInternal(manifest, source);\n\n // Persist to storage so it survives hibernation\n if (this.#storage) {\n await this.#storage.put<PersistedExtension>(\n `${STORAGE_PREFIX}${manifest.name}`,\n { manifest, source }\n );\n }\n\n return info;\n }\n\n async #loadInternal(\n manifest: ExtensionManifest,\n source: string\n ): Promise<ExtensionInfo> {\n const workerModule = wrapExtensionSource(source);\n const permissions = manifest.permissions ?? {};\n\n // Build env bindings for the dynamic worker. Inject a loopback\n // Fetcher as env.host when the extension declares ANY permission\n // that requires host access (workspace, context, messages, session).\n const workerEnv: Record<string, Fetcher> = {};\n const needsHost =\n (permissions.workspace ?? \"none\") !== \"none\" ||\n permissions.context?.read !== undefined ||\n permissions.context?.write !== undefined ||\n (permissions.messages ?? \"none\") !== \"none\" ||\n permissions.session?.sendMessage ||\n permissions.session?.metadata;\n if (this.#createHostBinding && needsHost) {\n const prefix = sanitizeName(manifest.name);\n const ownLabels = (manifest.context ?? []).map(\n (c) => `${prefix}_${c.label}`\n );\n workerEnv.host = this.#createHostBinding(permissions, ownLabels);\n }\n\n const worker = this.#loader.get(\n `ext-${manifest.name}-${manifest.version}-${Date.now()}`,\n () => ({\n compatibilityDate: \"2025-06-01\",\n compatibilityFlags: [\"nodejs_compat\"],\n mainModule: \"extension.js\",\n modules: { \"extension.js\": workerModule },\n globalOutbound: permissions.network?.length ? undefined : null,\n ...(Object.keys(workerEnv).length > 0 ? { env: workerEnv } : {})\n })\n );\n\n const entrypoint = worker.getEntrypoint() as unknown as ExtensionEntrypoint;\n\n // Discover tools and hooks via RPC\n const descriptorsJson = await entrypoint.describe();\n const tools = JSON.parse(descriptorsJson) as ExtensionToolDescriptor[];\n\n let hooks: string[] = [];\n try {\n const manifestJson = await entrypoint.manifest();\n const runtimeManifest = JSON.parse(manifestJson) as {\n hooks?: string[];\n };\n hooks = runtimeManifest.hooks ?? [];\n } catch {\n // Legacy extensions may not have manifest() — treat as no hooks\n }\n\n this.#extensions.set(manifest.name, {\n manifest,\n tools,\n hooks,\n entrypoint\n });\n\n return toExtensionInfo(manifest, tools);\n }\n\n /**\n * Unload an extension, removing its tools from the agent.\n * If an onUnload callback is registered, it fires with the\n * extension's namespaced context labels so the caller can\n * remove context blocks from the Session.\n */\n async unload(name: string): Promise<boolean> {\n const ext = this.#extensions.get(name);\n if (!ext) return false;\n\n const removed = this.#extensions.delete(name);\n if (removed && this.#storage) {\n await this.#storage.delete(`${STORAGE_PREFIX}${name}`);\n }\n\n if (removed && this.#onUnload) {\n const prefix = sanitizeName(name);\n const contextLabels = (ext.manifest.context ?? []).map(\n (c) => `${prefix}_${c.label}`\n );\n await this.#onUnload(name, contextLabels);\n }\n\n return removed;\n }\n\n /**\n * Register a callback invoked when an extension is unloaded.\n * Think uses this to remove the extension's context blocks from Session.\n */\n onUnload(\n cb: (name: string, contextLabels: string[]) => void | Promise<void>\n ): void {\n this.#onUnload = cb;\n }\n\n /**\n * Get the namespaced context labels for all loaded extensions\n * that declare context blocks in their manifests.\n */\n getContextLabels(): Array<{ extName: string; label: string }> {\n const result: Array<{ extName: string; label: string }> = [];\n for (const ext of this.#extensions.values()) {\n if (!ext.manifest.context) continue;\n const prefix = sanitizeName(ext.manifest.name);\n for (const ctx of ext.manifest.context) {\n result.push({\n extName: ext.manifest.name,\n label: `${prefix}_${ctx.label}`\n });\n }\n }\n return result;\n }\n\n /**\n * Get extension manifest by name.\n */\n getManifest(name: string): ExtensionManifest | null {\n return this.#extensions.get(name)?.manifest ?? null;\n }\n\n /**\n * Get extensions that subscribe to a specific hook, in load order.\n */\n getHookSubscribers(\n hookName: string\n ): Array<{ name: string; entrypoint: ExtensionEntrypoint }> {\n const result: Array<{ name: string; entrypoint: ExtensionEntrypoint }> = [];\n for (const ext of this.#extensions.values()) {\n if (ext.hooks.includes(hookName)) {\n result.push({ name: ext.manifest.name, entrypoint: ext.entrypoint });\n }\n }\n return result;\n }\n\n /**\n * List all loaded extensions.\n */\n list(): ExtensionInfo[] {\n return [...this.#extensions.values()].map((ext) =>\n toExtensionInfo(ext.manifest, ext.tools)\n );\n }\n\n /**\n * Get AI SDK tools from all loaded extensions.\n *\n * Tool names are prefixed with the sanitized extension name to avoid\n * collisions: e.g. extension \"github\" with tool \"create_pr\" → \"github_create_pr\".\n */\n getTools(): ToolSet {\n const tools: ToolSet = {};\n\n for (const ext of this.#extensions.values()) {\n const prefix = sanitizeName(ext.manifest.name);\n\n for (const descriptor of ext.tools) {\n const toolName = `${prefix}_${descriptor.name}`;\n\n tools[toolName] = tool({\n description: `[${ext.manifest.name}] ${descriptor.description}`,\n inputSchema: jsonSchema(\n descriptor.inputSchema as Record<string, unknown>\n ),\n execute: async (args: Record<string, unknown>) => {\n if (!this.#extensions.has(ext.manifest.name)) {\n throw new Error(\n `Extension \"${ext.manifest.name}\" has been unloaded. Tool \"${toolName}\" is no longer available.`\n );\n }\n const resultJson = await ext.entrypoint.execute(\n descriptor.name,\n JSON.stringify(args)\n );\n const parsed = JSON.parse(resultJson) as {\n result?: unknown;\n error?: string;\n };\n if (parsed.error) throw new Error(parsed.error);\n return parsed.result;\n }\n });\n }\n }\n\n return tools;\n }\n}\n\nfunction toExtensionInfo(\n manifest: ExtensionManifest,\n tools: ExtensionToolDescriptor[]\n): ExtensionInfo {\n const prefix = sanitizeName(manifest.name);\n return {\n name: manifest.name,\n version: manifest.version,\n description: manifest.description,\n tools: tools.map((t) => `${prefix}_${t.name}`),\n contextLabels: (manifest.context ?? []).map((c) => `${prefix}_${c.label}`),\n permissions: manifest.permissions ?? {}\n };\n}\n\n/**\n * Wrap an extension source in a Worker module that exposes\n * describe(), execute(), manifest(), and hook RPC methods.\n *\n * Source format: `({ tools: {...}, hooks: {...} })`\n * Both `tools` and `hooks` are optional.\n */\nfunction wrapExtensionSource(source: string): string {\n return `import { WorkerEntrypoint } from \"cloudflare:workers\";\n\nconst __ext = (${source});\nif (__ext && typeof __ext === \"object\" && !(\"tools\" in __ext) && !(\"hooks\" in __ext)) {\n throw new Error(\n \"Invalid extension source format. Expected { tools: {...}, hooks: {...} } \" +\n \"but got a flat object. Wrap your tools in a 'tools' key.\"\n );\n}\nconst __tools = __ext.tools || {};\nconst __hooks = __ext.hooks || {};\n\nexport default class Extension extends WorkerEntrypoint {\n describe() {\n const descriptors = [];\n for (const [name, def] of Object.entries(__tools)) {\n descriptors.push({\n name,\n description: def.description || name,\n inputSchema: {\n type: \"object\",\n properties: def.parameters || {},\n required: def.required || []\n }\n });\n }\n return JSON.stringify(descriptors);\n }\n\n manifest() {\n return JSON.stringify({\n hooks: Object.keys(__hooks)\n });\n }\n\n async execute(toolName, argsJson) {\n const def = __tools[toolName];\n if (!def || !def.execute) {\n return JSON.stringify({ error: \"Unknown tool: \" + toolName });\n }\n try {\n const args = JSON.parse(argsJson);\n const result = await def.execute(args, this.env.host ?? null);\n return JSON.stringify({ result });\n } catch (err) {\n return JSON.stringify({ error: err.message || String(err) });\n }\n }\n\n async hook(name, ctxSnapshot) {\n const fn = __hooks[name];\n if (!fn) return JSON.stringify({ skipped: true });\n try {\n const result = await fn(ctxSnapshot);\n return JSON.stringify({ result: result ?? {} });\n } catch (err) {\n return JSON.stringify({ error: err.message || String(err) });\n }\n }\n}\n`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAgB,aAAa,MAAsB;AACjD,KAAI,CAAC,QAAQ,KAAK,MAAM,CAAC,WAAW,EAClC,OAAM,IAAI,MAAM,mCAAmC;AAErD,QAAO,KACJ,QAAQ,iBAAiB,IAAI,CAC7B,QAAQ,OAAO,IAAI,CACnB,QAAQ,UAAU,GAAG;;AAuB1B,MAAM,iBAAiB;;;;;;;;AAiCvB,IAAa,mBAAb,MAA8B;CAe5B,YAAY,SAAkC;;mDAdxB;oDACgB;8DAM7B;gEACK,IAAI,KAA8B,CAAC;8CACrC,MAAM;8CAGP,KAAK;AAGd,yBAAA,SAAA,MAAe,QAAQ,OAAM;AAC7B,yBAAA,UAAA,MAAgB,QAAQ,WAAW,KAAI;AACvC,yBAAA,oBAAA,MAA0B,QAAQ,qBAAqB,KAAI;;;;;;;;;;;;;;;;;CAkB7D,MAAM,UAAyB;AAC7B,MAAA,uBAAA,WAAI,KAAc,IAAI,CAAA,uBAAA,UAAC,KAAa,CAAE;AACtC,yBAAA,WAAA,MAAiB,KAAI;EAErB,MAAM,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