@fabric-harness/cloudflare 0.1.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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # @fabric-harness/cloudflare
2
+
3
+ > Cloudflare Workers + Sandbox adapter for [Fabric Harness](https://github.com/Fabric-Pro/fabric-harness).
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm install @fabric-harness/cloudflare @fabric-harness/sdk
9
+ ```
10
+
11
+ `@cloudflare/sandbox` is a peer dependency — install it as well if you want a real Cloudflare-backed sandbox; otherwise the adapter falls back to the in-memory virtual sandbox.
12
+
13
+ ## Quick start
14
+
15
+ ```ts
16
+ import { defineAgent } from '@fabric-harness/sdk/lite';
17
+ import { getCloudflareSandbox } from '@fabric-harness/cloudflare';
18
+
19
+ export default defineAgent(async ({ init, payload, env }) => {
20
+ const sandbox = await getCloudflareSandbox(env.SANDBOX, 'session-1');
21
+ const session = await (await init({
22
+ sandbox,
23
+ model: 'anthropic/claude-sonnet-4-6',
24
+ runtime: 'stateless',
25
+ })).session();
26
+ return { reply: await session.prompt<string>(String((payload as any)?.message ?? '')) };
27
+ }, { name: 'edge-assistant', triggers: { webhook: true } });
28
+ ```
29
+
30
+ Build with `fh build --target cloudflare` to produce an artifact ready for `wrangler deploy`.
31
+
32
+ ## Documentation
33
+
34
+ - [Cloudflare deployment](https://fabric-harness.dev/docs/deployment)
35
+ - [Sandboxes](https://fabric-harness.dev/docs/building/sandboxes)
36
+
37
+ ## License
38
+
39
+ Apache-2.0
@@ -0,0 +1,78 @@
1
+ import type { SandboxEnv, SessionStore } from '@fabric-harness/sdk';
2
+ export interface CloudflareDurableObjectSqlStorage {
3
+ exec(query: string, ...bindings: unknown[]): {
4
+ toArray(): Array<Record<string, unknown>>;
5
+ };
6
+ }
7
+ export interface CloudflareR2ObjectBodyLike {
8
+ arrayBuffer(): Promise<ArrayBuffer>;
9
+ }
10
+ export interface CloudflareR2BucketLike {
11
+ put(key: string, value: Uint8Array | ArrayBuffer | string, options?: {
12
+ httpMetadata?: {
13
+ contentType?: string;
14
+ };
15
+ customMetadata?: Record<string, string>;
16
+ }): Promise<unknown>;
17
+ get(key: string): Promise<CloudflareR2ObjectBodyLike | null>;
18
+ delete?(key: string): Promise<void>;
19
+ }
20
+ export interface CloudflareDurableObjectSessionStoreOptions {
21
+ /** Optional R2 bucket for large artifact content. */
22
+ r2Bucket?: CloudflareR2BucketLike;
23
+ /** Store artifact content in R2 when size is greater than this threshold. Defaults to 1 MiB when r2Bucket is provided. */
24
+ r2ThresholdBytes?: number;
25
+ /** Prefix for R2 object keys. Defaults to fabric-harness/artifacts. */
26
+ r2KeyPrefix?: string;
27
+ }
28
+ export interface CloudflareSandboxFileInfo {
29
+ content: string;
30
+ encoding?: 'utf-8' | 'base64' | string;
31
+ }
32
+ export interface CloudflareSandboxExecResult {
33
+ success?: boolean;
34
+ stdout?: string;
35
+ stderr?: string;
36
+ exitCode?: number;
37
+ }
38
+ export interface CloudflareSandboxLike {
39
+ exec(command: string, options?: {
40
+ cwd?: string;
41
+ env?: Record<string, string | undefined>;
42
+ timeout?: number;
43
+ stdin?: string;
44
+ signal?: AbortSignal;
45
+ }): Promise<CloudflareSandboxExecResult>;
46
+ readFile(path: string, options?: {
47
+ encoding?: 'utf-8' | 'base64';
48
+ }): Promise<CloudflareSandboxFileInfo>;
49
+ writeFile(path: string, content: string, options?: {
50
+ encoding?: 'utf-8' | 'base64';
51
+ }): Promise<void>;
52
+ exists(path: string): Promise<{
53
+ exists: boolean;
54
+ }>;
55
+ mkdir(path: string, options?: {
56
+ recursive?: boolean;
57
+ }): Promise<void>;
58
+ deleteFile(path: string): Promise<void>;
59
+ }
60
+ export interface CloudflareSandboxEnvOptions {
61
+ cwd?: string;
62
+ cleanup?: (() => void | Promise<void>) | {
63
+ cleanup(): void | Promise<void>;
64
+ };
65
+ }
66
+ /**
67
+ * Adapt an instance returned by `getSandbox(env.Sandbox, id)` from
68
+ * `@cloudflare/sandbox` into Fabric's provider-neutral SandboxEnv contract.
69
+ */
70
+ export declare function createCloudflareSandboxEnv(sandbox: CloudflareSandboxLike, options?: CloudflareSandboxEnvOptions): SandboxEnv;
71
+ /**
72
+ * Minimal Durable Object SQL-backed SessionStore used by the Cloudflare build
73
+ * target. It intentionally depends only on the small SQL shape exposed by
74
+ * Workers Durable Objects so Cloudflare SDK types do not leak into the SDK.
75
+ */
76
+ export declare function createCloudflareDurableObjectSessionStore(sql: CloudflareDurableObjectSqlStorage, options?: CloudflareDurableObjectSessionStoreOptions): SessionStore;
77
+ export declare const CLOUDFLARE_BUILD_TARGET = "cloudflare";
78
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyJ,UAAU,EAAiD,YAAY,EAAe,MAAM,qBAAqB,CAAC;AAEvR,MAAM,WAAW,iCAAiC;IAChD,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE,GAAG;QAAE,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;KAAE,CAAC;CAC5F;AAED,MAAM,WAAW,0BAA0B;IACzC,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,WAAW,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE;YAAE,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,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AAC;IACxG,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrG,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACnD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,2BAA2B;IAC1C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG;QAAE,OAAO,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC;CAC9E;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,qBAAqB,EAAE,OAAO,GAAE,2BAAgC,GAAG,UAAU,CA2EhI;AAED;;;;GAIG;AACH,wBAAgB,yCAAyC,CAAC,GAAG,EAAE,iCAAiC,EAAE,OAAO,GAAE,0CAA+C,GAAG,YAAY,CAmHxK;AAED,eAAO,MAAM,uBAAuB,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,323 @@
1
+ import { approvalStatesFromEntries, createRemoteSandboxEnv } from '@fabric-harness/sdk';
2
+ /**
3
+ * Adapt an instance returned by `getSandbox(env.Sandbox, id)` from
4
+ * `@cloudflare/sandbox` into Fabric's provider-neutral SandboxEnv contract.
5
+ */
6
+ export function createCloudflareSandboxEnv(sandbox, options = {}) {
7
+ const api = {
8
+ async exec(command, execOptions) {
9
+ if (execOptions?.signal?.aborted)
10
+ return { command, exitCode: 130, stdout: '', stderr: 'Command aborted.\n' };
11
+ let abortListener;
12
+ const aborted = new Promise((resolve) => {
13
+ if (!execOptions?.signal)
14
+ return;
15
+ abortListener = () => resolve({ success: false, exitCode: 130, stdout: '', stderr: 'Command aborted.\n' });
16
+ execOptions.signal.addEventListener('abort', abortListener, { once: true });
17
+ });
18
+ const result = await (execOptions?.signal ? Promise.race([sandbox.exec(command, toCloudflareExecOptions(execOptions)), aborted]) : sandbox.exec(command, toCloudflareExecOptions(execOptions)));
19
+ if (abortListener)
20
+ execOptions?.signal?.removeEventListener('abort', abortListener);
21
+ return {
22
+ command,
23
+ exitCode: result.exitCode ?? (result.success === false ? 1 : 0),
24
+ stdout: result.stdout ?? '',
25
+ stderr: result.stderr ?? '',
26
+ };
27
+ },
28
+ async readFile(filePath) {
29
+ return (await sandbox.readFile(filePath, { encoding: 'utf-8' })).content;
30
+ },
31
+ async readFileBuffer(filePath) {
32
+ const file = await sandbox.readFile(filePath, { encoding: 'base64' });
33
+ return decodeBase64(file.content);
34
+ },
35
+ async writeFile(filePath, content) {
36
+ if (typeof content === 'string') {
37
+ await sandbox.writeFile(filePath, content, { encoding: 'utf-8' });
38
+ }
39
+ else {
40
+ await sandbox.writeFile(filePath, encodeBase64(content), { encoding: 'base64' });
41
+ }
42
+ },
43
+ async stat(filePath) {
44
+ const result = await sandbox.exec(`stat -c '{"type":"%F","size":%s,"mode":%a}' ${shellQuote(filePath)}`);
45
+ if (result.success === false)
46
+ throw new Error(`stat failed for ${filePath}: ${result.stderr ?? ''}`.trim());
47
+ return parseStat(filePath, result.stdout ?? '');
48
+ },
49
+ async readdir(dirPath) {
50
+ const result = await sandbox.exec(`ls -1A ${shellQuote(dirPath)}`);
51
+ if (result.success === false)
52
+ throw new Error(`readdir failed for ${dirPath}: ${result.stderr ?? ''}`.trim());
53
+ return (result.stdout ?? '').split('\n').map((line) => line.trim()).filter(Boolean);
54
+ },
55
+ async exists(filePath) {
56
+ return (await sandbox.exists(filePath)).exists;
57
+ },
58
+ async mkdir(dirPath, mkdirOptions) {
59
+ await sandbox.mkdir(dirPath, mkdirOptions);
60
+ },
61
+ async rm(filePath, rmOptions) {
62
+ if (rmOptions?.recursive || rmOptions?.force) {
63
+ const flags = `${rmOptions.recursive ? 'r' : ''}${rmOptions.force ? 'f' : ''}`;
64
+ const command = flags ? `rm -${flags} ${shellQuote(filePath)}` : `rm ${shellQuote(filePath)}`;
65
+ const result = await sandbox.exec(command);
66
+ if (result.success === false)
67
+ throw new Error(`rm failed for ${filePath}: ${result.stderr ?? ''}`.trim());
68
+ }
69
+ else {
70
+ await sandbox.deleteFile(filePath);
71
+ }
72
+ },
73
+ };
74
+ return createRemoteSandboxEnv(api, {
75
+ cwd: options.cwd ?? '/workspace',
76
+ ...(options.cleanup ? { cleanup: options.cleanup } : {}),
77
+ capabilities: {
78
+ exec: true,
79
+ filesystem: true,
80
+ binaryFiles: true,
81
+ snapshots: false,
82
+ restore: false,
83
+ network: 'provider-managed',
84
+ persistence: 'session',
85
+ isolation: 'container',
86
+ },
87
+ });
88
+ }
89
+ /**
90
+ * Minimal Durable Object SQL-backed SessionStore used by the Cloudflare build
91
+ * target. It intentionally depends only on the small SQL shape exposed by
92
+ * Workers Durable Objects so Cloudflare SDK types do not leak into the SDK.
93
+ */
94
+ export function createCloudflareDurableObjectSessionStore(sql, options = {}) {
95
+ sql.exec('CREATE TABLE IF NOT EXISTS fabric_harness_sessions (id TEXT PRIMARY KEY, data TEXT NOT NULL, updated_at INTEGER NOT NULL)');
96
+ sql.exec('CREATE TABLE IF NOT EXISTS fabric_harness_artifacts (session_id TEXT NOT NULL, id TEXT NOT NULL, name TEXT NOT NULL, path TEXT NOT NULL, ref TEXT NOT NULL, content_base64 TEXT NOT NULL, created_at TEXT NOT NULL, storage TEXT DEFAULT \'do\', r2_key TEXT, PRIMARY KEY (session_id, id))');
97
+ try {
98
+ sql.exec('ALTER TABLE fabric_harness_artifacts ADD COLUMN storage TEXT DEFAULT \'do\'');
99
+ }
100
+ catch { }
101
+ try {
102
+ sql.exec('ALTER TABLE fabric_harness_artifacts ADD COLUMN r2_key TEXT');
103
+ }
104
+ catch { }
105
+ const r2ThresholdBytes = options.r2ThresholdBytes ?? 1024 * 1024;
106
+ const r2KeyPrefix = options.r2KeyPrefix ?? 'fabric-harness/artifacts';
107
+ return {
108
+ async load(id) {
109
+ const rows = sql.exec('SELECT data FROM fabric_harness_sessions WHERE id = ?', id).toArray();
110
+ const data = rows[0]?.data;
111
+ return typeof data === 'string' ? JSON.parse(data) : undefined;
112
+ },
113
+ async save(data) {
114
+ sql.exec('INSERT OR REPLACE INTO fabric_harness_sessions (id, data, updated_at) VALUES (?, ?, ?)', data.id, JSON.stringify(data), Date.now());
115
+ },
116
+ async appendEvent(sessionId, event) {
117
+ const data = await this.load(sessionId);
118
+ if (!data)
119
+ return;
120
+ data.events = [...(data.events ?? []), event];
121
+ await this.save(data);
122
+ },
123
+ async appendEntry(sessionId, entry) {
124
+ const data = await this.load(sessionId);
125
+ if (!data)
126
+ return;
127
+ data.entries = [...(data.entries ?? []), entry];
128
+ data.leafId = entry.id;
129
+ await this.save(data);
130
+ },
131
+ async waitForApproval(sessionId, approvalId, timeoutMs) {
132
+ const started = Date.now();
133
+ while (true) {
134
+ const existing = findApprovalResolution((await this.load(sessionId))?.entries ?? [], approvalId);
135
+ if (existing)
136
+ return existing;
137
+ if (timeoutMs !== undefined && Date.now() - started >= timeoutMs)
138
+ return undefined;
139
+ await new Promise((resolve) => setTimeout(resolve, 500));
140
+ }
141
+ },
142
+ async resolveApproval(_sessionId, _approvalId, _response) {
143
+ // Durable Object requests are single-threaded per object. Waiters poll persisted entries.
144
+ },
145
+ async voteApproval(sessionId, approvalId, vote) {
146
+ const state = await this.getApprovalState?.(sessionId, approvalId);
147
+ if (!state)
148
+ throw new Error(`Approval not found: ${approvalId}`);
149
+ if (state.status !== 'pending')
150
+ throw new Error(`Approval is already ${state.status}: ${approvalId}`);
151
+ await this.appendEntry?.(sessionId, approvalEntry(sessionId, 'approval_voted', {
152
+ approvalId,
153
+ actor: approvalActorToJson(vote.actor),
154
+ decision: vote.decision,
155
+ votedAt: vote.votedAt,
156
+ ...(vote.reason ? { reason: vote.reason } : {}),
157
+ }));
158
+ const next = await this.getApprovalState?.(sessionId, approvalId);
159
+ if (!next)
160
+ throw new Error(`Approval not found after vote: ${approvalId}`);
161
+ if (next.status === 'approved' || next.status === 'denied') {
162
+ const terminal = approvalEntry(sessionId, next.status === 'approved' ? 'approval_granted' : 'approval_denied', {
163
+ approvalId,
164
+ reason: next.resolutionReason ?? (next.status === 'approved' ? 'Approval quorum reached' : 'Approval denied by vote'),
165
+ });
166
+ await this.appendEntry?.(sessionId, terminal);
167
+ await this.appendEvent?.(sessionId, entryToEvent(sessionId, terminal));
168
+ return await this.getApprovalState?.(sessionId, approvalId) ?? next;
169
+ }
170
+ return next;
171
+ },
172
+ async getApprovalState(sessionId, approvalId) {
173
+ return approvalStatesFromEntries(sessionId, (await this.load(sessionId))?.entries ?? []).find((approval) => approval.id === approvalId);
174
+ },
175
+ async listApprovalStates(sessionId) {
176
+ return approvalStatesFromEntries(sessionId, (await this.load(sessionId))?.entries ?? []);
177
+ },
178
+ async putArtifact(sessionId, name, content, artifactOptions = {}) {
179
+ const bytes = typeof content === 'string' ? new TextEncoder().encode(content) : new Uint8Array(content);
180
+ const createdAt = new Date().toISOString();
181
+ const id = `${createdAt}-${name}`.replace(/[^a-zA-Z0-9._:-]/g, '_');
182
+ const path = name.replace(/[^a-zA-Z0-9._/:-]/g, '_');
183
+ const useR2 = Boolean(options.r2Bucket && bytes.byteLength > r2ThresholdBytes);
184
+ const r2Key = useR2 ? `${r2KeyPrefix}/${sessionId}/${id}` : undefined;
185
+ const ref = {
186
+ id,
187
+ sessionId,
188
+ name,
189
+ path,
190
+ size: bytes.byteLength,
191
+ sha256: await sha256Hex(bytes),
192
+ createdAt,
193
+ uri: useR2 ? `r2://${r2Key}` : `cloudflare-do://${sessionId}/${name}`,
194
+ ...(artifactOptions.contentType ? { contentType: artifactOptions.contentType } : {}),
195
+ ...(artifactOptions.metadata ? { metadata: artifactOptions.metadata } : {}),
196
+ };
197
+ if (useR2 && r2Key) {
198
+ await options.r2Bucket.put(r2Key, bytes, { ...(artifactOptions.contentType ? { httpMetadata: { contentType: artifactOptions.contentType } } : {}), customMetadata: { sessionId, artifactId: id, name } });
199
+ }
200
+ sql.exec('INSERT OR REPLACE INTO fabric_harness_artifacts (session_id, id, name, path, ref, content_base64, created_at, storage, r2_key) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)', sessionId, ref.id, name, ref.path, JSON.stringify(ref), useR2 ? '' : encodeBase64(bytes), createdAt, useR2 ? 'r2' : 'do', r2Key ?? null);
201
+ return ref;
202
+ },
203
+ async getArtifact(sessionId, artifactIdOrName) {
204
+ const rows = sql.exec('SELECT ref, content_base64, storage, r2_key FROM fabric_harness_artifacts WHERE session_id = ? AND (id = ? OR name = ? OR path = ?) ORDER BY created_at DESC LIMIT 1', sessionId, artifactIdOrName, artifactIdOrName, artifactIdOrName).toArray();
205
+ const row = rows[0];
206
+ if (!row || typeof row.ref !== 'string')
207
+ return undefined;
208
+ const ref = JSON.parse(row.ref);
209
+ if (row.storage === 'r2') {
210
+ if (!options.r2Bucket || typeof row.r2_key !== 'string')
211
+ return undefined;
212
+ const object = await options.r2Bucket.get(row.r2_key);
213
+ if (!object)
214
+ return undefined;
215
+ return { ref, content: new Uint8Array(await object.arrayBuffer()) };
216
+ }
217
+ if (typeof row.content_base64 !== 'string')
218
+ return undefined;
219
+ return { ref, content: decodeBase64(row.content_base64) };
220
+ },
221
+ async listArtifacts(sessionId) {
222
+ const rows = sql.exec('SELECT ref FROM fabric_harness_artifacts WHERE session_id = ? ORDER BY created_at DESC', sessionId).toArray();
223
+ return rows.map((row) => typeof row.ref === 'string' ? JSON.parse(row.ref) : undefined).filter((ref) => ref !== undefined);
224
+ },
225
+ };
226
+ }
227
+ export const CLOUDFLARE_BUILD_TARGET = 'cloudflare';
228
+ function toCloudflareExecOptions(options) {
229
+ const output = {};
230
+ if (options?.cwd !== undefined)
231
+ output.cwd = options.cwd;
232
+ if (options?.env !== undefined)
233
+ output.env = options.env;
234
+ if (options?.timeout !== undefined)
235
+ output.timeout = options.timeout;
236
+ if (options?.signal !== undefined)
237
+ output.signal = options.signal;
238
+ return output;
239
+ }
240
+ function parseStat(filePath, stdout) {
241
+ try {
242
+ const parsed = JSON.parse(stdout.trim());
243
+ const type = String(parsed.type ?? 'regular file');
244
+ const stat = {
245
+ type: type.includes('directory') ? 'directory' : type.includes('symbolic link') ? 'symlink' : type.includes('regular file') ? 'file' : 'other',
246
+ size: typeof parsed.size === 'number' ? parsed.size : 0,
247
+ };
248
+ const mode = typeof parsed.mode === 'number' ? parsed.mode : typeof parsed.mode === 'string' ? Number.parseInt(parsed.mode, 8) : undefined;
249
+ if (mode !== undefined && !Number.isNaN(mode))
250
+ stat.mode = mode;
251
+ return stat;
252
+ }
253
+ catch {
254
+ throw new Error(`Failed to parse stat output for ${filePath}: ${stdout}`);
255
+ }
256
+ }
257
+ function shellQuote(value) {
258
+ if (/^[A-Za-z0-9_/:=.,@%+-]+$/.test(value))
259
+ return value;
260
+ return `'${value.replaceAll("'", "'\\''")}'`;
261
+ }
262
+ function findApprovalResolution(entries, approvalId) {
263
+ for (const entry of entries) {
264
+ if (entry.type !== 'approval_granted' && entry.type !== 'approval_denied')
265
+ continue;
266
+ if (entry.data?.approvalId !== approvalId)
267
+ continue;
268
+ return {
269
+ decision: entry.type === 'approval_granted' ? 'approved' : 'denied',
270
+ ...(typeof entry.data.reason === 'string' ? { reason: entry.data.reason } : {}),
271
+ };
272
+ }
273
+ return undefined;
274
+ }
275
+ function approvalEntry(sessionId, type, data) {
276
+ return { id: `${sessionId}-entry-${Date.now()}-${Math.random().toString(16).slice(2)}`, type, timestamp: new Date().toISOString(), data };
277
+ }
278
+ function entryToEvent(sessionId, entry) {
279
+ return { id: `${sessionId}-${Date.now()}-${Math.random().toString(16).slice(2)}`, type: entry.type, timestamp: entry.timestamp, sessionId, ...(entry.data ? { data: entry.data } : {}) };
280
+ }
281
+ function approvalActorToJson(actor) {
282
+ if (typeof actor === 'string')
283
+ return actor;
284
+ const value = actor;
285
+ const result = { id: value.id };
286
+ if (value.type)
287
+ result.type = value.type;
288
+ if (value.provider)
289
+ result.provider = value.provider;
290
+ if (value.tenantId)
291
+ result.tenantId = value.tenantId;
292
+ if (value.displayName)
293
+ result.displayName = value.displayName;
294
+ return result;
295
+ }
296
+ async function sha256Hex(bytes) {
297
+ if (globalThis.crypto?.subtle) {
298
+ const digest = await globalThis.crypto.subtle.digest('SHA-256', bytes);
299
+ return [...new Uint8Array(digest)].map((byte) => byte.toString(16).padStart(2, '0')).join('');
300
+ }
301
+ const { createHash } = await import('node:crypto');
302
+ return createHash('sha256').update(bytes).digest('hex');
303
+ }
304
+ function decodeBase64(value) {
305
+ if (typeof atob === 'function') {
306
+ const binary = atob(value);
307
+ const bytes = new Uint8Array(binary.length);
308
+ for (let i = 0; i < binary.length; i += 1)
309
+ bytes[i] = binary.charCodeAt(i);
310
+ return bytes;
311
+ }
312
+ return Uint8Array.from(Buffer.from(value, 'base64'));
313
+ }
314
+ function encodeBase64(value) {
315
+ if (typeof btoa === 'function') {
316
+ let binary = '';
317
+ for (const byte of value)
318
+ binary += String.fromCharCode(byte);
319
+ return btoa(binary);
320
+ }
321
+ return Buffer.from(value).toString('base64');
322
+ }
323
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAoDxF;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAA8B,EAAE,UAAuC,EAAE;IAClH,MAAM,GAAG,GAAqB;QAC5B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AM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3B,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC;YAAE,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC3E,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,YAAY,CAAC,KAAiB;IACrC,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,MAAM,IAAI,IAAI,KAAK;YAAE,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC/C,CAAC"}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@fabric-harness/cloudflare",
3
+ "version": "0.1.0",
4
+ "description": "Cloudflare Workers and Sandbox adapter for Fabric Harness.",
5
+ "license": "Apache-2.0",
6
+ "author": "Fabric",
7
+ "homepage": "https://github.com/Fabric-Pro/fabric-harness#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/Fabric-Pro/fabric-harness.git",
11
+ "directory": "packages/cloudflare"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/Fabric-Pro/fabric-harness/issues"
15
+ },
16
+ "keywords": [
17
+ "agents",
18
+ "ai",
19
+ "fabric-harness",
20
+ "cloudflare",
21
+ "workers",
22
+ "sandbox",
23
+ "edge"
24
+ ],
25
+ "type": "module",
26
+ "sideEffects": false,
27
+ "engines": {
28
+ "node": ">=22.0.0"
29
+ },
30
+ "publishConfig": {
31
+ "registry": "https://registry.npmjs.org",
32
+ "access": "public"
33
+ },
34
+ "main": "dist/index.js",
35
+ "types": "dist/index.d.ts",
36
+ "files": [
37
+ "dist",
38
+ "README.md",
39
+ "LICENSE"
40
+ ],
41
+ "dependencies": {
42
+ "@fabric-harness/sdk": "0.1.0"
43
+ },
44
+ "peerDependencies": {
45
+ "@cloudflare/sandbox": "*"
46
+ },
47
+ "peerDependenciesMeta": {
48
+ "@cloudflare/sandbox": {
49
+ "optional": true
50
+ }
51
+ },
52
+ "devDependencies": {
53
+ "typescript": "^5.8.3",
54
+ "vitest": "^4.1.5"
55
+ },
56
+ "scripts": {
57
+ "build": "tsc -p tsconfig.json",
58
+ "check": "tsc -b tsconfig.json",
59
+ "test": "vitest run"
60
+ }
61
+ }