@rubytech/create-maxy-code 0.1.458 → 0.1.460
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/package.json +1 -1
- package/payload/platform/lib/storage-broker/dist/__tests__/cf-exec.test.js +298 -3
- package/payload/platform/lib/storage-broker/dist/__tests__/cf-exec.test.js.map +1 -1
- package/payload/platform/lib/storage-broker/dist/__tests__/object-limits.test.d.ts +2 -0
- package/payload/platform/lib/storage-broker/dist/__tests__/object-limits.test.d.ts.map +1 -0
- package/payload/platform/lib/storage-broker/dist/__tests__/object-limits.test.js +79 -0
- package/payload/platform/lib/storage-broker/dist/__tests__/object-limits.test.js.map +1 -0
- package/payload/platform/lib/storage-broker/dist/__tests__/resource-limits.test.d.ts +2 -0
- package/payload/platform/lib/storage-broker/dist/__tests__/resource-limits.test.d.ts.map +1 -0
- package/payload/platform/lib/storage-broker/dist/__tests__/resource-limits.test.js +41 -0
- package/payload/platform/lib/storage-broker/dist/__tests__/resource-limits.test.js.map +1 -0
- package/payload/platform/lib/storage-broker/dist/cf-exec.d.ts +13 -1
- package/payload/platform/lib/storage-broker/dist/cf-exec.d.ts.map +1 -1
- package/payload/platform/lib/storage-broker/dist/cf-exec.js +165 -0
- package/payload/platform/lib/storage-broker/dist/cf-exec.js.map +1 -1
- package/payload/platform/lib/storage-broker/dist/house-credential.d.ts.map +1 -1
- package/payload/platform/lib/storage-broker/dist/house-credential.js +4 -2
- package/payload/platform/lib/storage-broker/dist/house-credential.js.map +1 -1
- package/payload/platform/lib/storage-broker/dist/index.d.ts +2 -0
- package/payload/platform/lib/storage-broker/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/storage-broker/dist/index.js +2 -0
- package/payload/platform/lib/storage-broker/dist/index.js.map +1 -1
- package/payload/platform/lib/storage-broker/dist/object-limits.d.ts +80 -0
- package/payload/platform/lib/storage-broker/dist/object-limits.d.ts.map +1 -0
- package/payload/platform/lib/storage-broker/dist/object-limits.js +92 -0
- package/payload/platform/lib/storage-broker/dist/object-limits.js.map +1 -0
- package/payload/platform/lib/storage-broker/dist/resource-limits.d.ts +102 -0
- package/payload/platform/lib/storage-broker/dist/resource-limits.d.ts.map +1 -0
- package/payload/platform/lib/storage-broker/dist/resource-limits.js +105 -0
- package/payload/platform/lib/storage-broker/dist/resource-limits.js.map +1 -0
- package/payload/platform/lib/storage-broker/src/__tests__/cf-exec.test.ts +334 -5
- package/payload/platform/lib/storage-broker/src/__tests__/object-limits.test.ts +106 -0
- package/payload/platform/lib/storage-broker/src/__tests__/resource-limits.test.ts +49 -0
- package/payload/platform/lib/storage-broker/src/cf-exec.ts +221 -6
- package/payload/platform/lib/storage-broker/src/house-credential.ts +4 -2
- package/payload/platform/lib/storage-broker/src/index.ts +2 -0
- package/payload/platform/lib/storage-broker/src/object-limits.ts +95 -0
- package/payload/platform/lib/storage-broker/src/resource-limits.ts +105 -0
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +7 -6
- package/payload/platform/plugins/cloudflare/PLUGIN.md +3 -1
- package/payload/platform/plugins/cloudflare/bin/cf-token.sh +4 -3
- package/payload/platform/plugins/cloudflare/mcp/__tests__/auth-route.test.ts +206 -0
- package/payload/platform/plugins/cloudflare/mcp/__tests__/authorize.test.ts +201 -0
- package/payload/platform/plugins/cloudflare/mcp/__tests__/file-routes.test.ts +178 -0
- package/payload/platform/plugins/cloudflare/mcp/__tests__/harness.test.ts +32 -0
- package/payload/platform/plugins/cloudflare/mcp/__tests__/passcode.test.ts +74 -0
- package/payload/platform/plugins/cloudflare/mcp/__tests__/ratelimit.test.ts +77 -0
- package/payload/platform/plugins/cloudflare/mcp/__tests__/skill-contract.test.ts +46 -0
- package/payload/platform/plugins/cloudflare/mcp/__tests__/template-config.test.ts +55 -0
- package/payload/platform/plugins/cloudflare/mcp/__tests__/upload-route.test.ts +255 -0
- package/payload/platform/plugins/cloudflare/mcp/package.json +5 -2
- package/payload/platform/plugins/cloudflare/references/api.md +1 -1
- package/payload/platform/plugins/cloudflare/references/r2-object-storage.md +46 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/SKILL.md +123 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/_lib/authorize.ts +32 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/_lib/log.ts +12 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/_lib/passcode.ts +73 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/_lib/ratelimit.ts +55 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/_lib/session.ts +85 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/_lib/types.ts +44 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/auth.ts +113 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/delete.ts +89 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/download.ts +70 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/files.ts +41 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/upload.ts +151 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/public/index.html +42 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/public/portal.css +113 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/public/portal.js +155 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/schema.sql +64 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/wrangler.toml +21 -0
- package/payload/platform/plugins/cloudflare/skills/site-deploy/SKILL.md +8 -0
- package/payload/platform/plugins/docs/references/outlook-guide.md +5 -5
- package/payload/platform/plugins/docs/references/voice-mirror-guide.md +1 -0
- package/payload/platform/plugins/filesystem/PLUGIN.md +0 -1
- package/payload/platform/plugins/filesystem/mcp/dist/lib/scope.d.ts +14 -10
- package/payload/platform/plugins/filesystem/mcp/dist/lib/scope.d.ts.map +1 -1
- package/payload/platform/plugins/filesystem/mcp/dist/lib/scope.js +14 -10
- package/payload/platform/plugins/filesystem/mcp/dist/lib/scope.js.map +1 -1
- package/payload/platform/plugins/outlook/.claude-plugin/plugin.json +1 -1
- package/payload/platform/plugins/outlook/PLUGIN.md +3 -5
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/attach.test.d.ts +2 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/attach.test.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/attach.test.js +138 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/attach.test.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/detach.test.d.ts +2 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/detach.test.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/detach.test.js +75 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/detach.test.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-attachments.test.d.ts +2 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-attachments.test.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-attachments.test.js +121 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-attachments.test.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-attachments.test.d.ts +2 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-attachments.test.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-attachments.test.js +102 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-attachments.test.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-removal.test.d.ts +2 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-removal.test.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-removal.test.js +187 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-removal.test.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit.test.js +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit.test.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/mail-send-attachments.test.d.ts +2 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/mail-send-attachments.test.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/mail-send-attachments.test.js +209 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/mail-send-attachments.test.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/index.js +12 -8
- package/payload/platform/plugins/outlook/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/attach.d.ts +37 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/attach.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/attach.js +79 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/attach.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/attachment-list.d.ts +43 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/attachment-list.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/attachment-list.js +65 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/attachment-list.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/detach.d.ts +65 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/detach.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/detach.js +99 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/detach.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/message.d.ts +8 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/message.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/message.js +4 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/message.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/outbound-attachments.d.ts +36 -8
- package/payload/platform/plugins/outlook/mcp/dist/lib/outbound-attachments.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/outbound-attachments.js +40 -13
- package/payload/platform/plugins/outlook/mcp/dist/lib/outbound-attachments.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/upload-session.d.ts +9 -5
- package/payload/platform/plugins/outlook/mcp/dist/lib/upload-session.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/upload-session.js +12 -8
- package/payload/platform/plugins/outlook/mcp/dist/lib/upload-session.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.d.ts +49 -4
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.js +82 -13
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft.d.ts +8 -2
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft.js +13 -4
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-attachment.d.ts +15 -16
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-attachment.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-attachment.js +8 -41
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-attachment.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.js +3 -20
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-send.d.ts +27 -3
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-send.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-send.js +53 -8
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-send.js.map +1 -1
- package/payload/platform/plugins/outlook/references/auth.md +1 -1
- package/payload/platform/plugins/outlook/references/graph-surfaces.md +33 -6
- package/payload/platform/plugins/outlook/skills/outlook/SKILL.md +22 -5
- package/payload/platform/plugins/storage-broker/PLUGIN.md +41 -2
- package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/confine-path.test.d.ts +2 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/confine-path.test.d.ts.map +1 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/confine-path.test.js +85 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/confine-path.test.js.map +1 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/put-source.test.d.ts +2 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/put-source.test.d.ts.map +1 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/put-source.test.js +77 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/put-source.test.js.map +1 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/confine-path.d.ts +12 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/confine-path.d.ts.map +1 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/confine-path.js +107 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/confine-path.js.map +1 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/index.js +86 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/storage-broker/mcp/dist/put-source.d.ts +11 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/put-source.d.ts.map +1 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/put-source.js +35 -0
- package/payload/platform/plugins/storage-broker/mcp/dist/put-source.js.map +1 -0
- package/payload/platform/plugins/voice-mirror/PLUGIN.md +19 -7
- package/payload/platform/plugins/voice-mirror/mcp/dist/index.d.ts.map +1 -1
- package/payload/platform/plugins/voice-mirror/mcp/dist/index.js +35 -16
- package/payload/platform/plugins/voice-mirror/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/voice-mirror/mcp/dist/lib/admin-user.d.ts +31 -0
- package/payload/platform/plugins/voice-mirror/mcp/dist/lib/admin-user.d.ts.map +1 -0
- package/payload/platform/plugins/voice-mirror/mcp/dist/lib/admin-user.js +87 -0
- package/payload/platform/plugins/voice-mirror/mcp/dist/lib/admin-user.js.map +1 -0
- package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-distil-profile.d.ts.map +1 -1
- package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-distil-profile.js +13 -3
- package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-distil-profile.js.map +1 -1
- package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-ingest-session-text.d.ts.map +1 -1
- package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-ingest-session-text.js +2 -1
- package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-ingest-session-text.js.map +1 -1
- package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-record-feedback.d.ts.map +1 -1
- package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-record-feedback.js +2 -1
- package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-record-feedback.js.map +1 -1
- package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-tag-content.d.ts +2 -2
- package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-tag-content.d.ts.map +1 -1
- package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-tag-content.js +12 -3
- package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-tag-content.js.map +1 -1
- package/payload/platform/plugins/voice-mirror/mcp/scripts/smoke.mjs +334 -0
- package/payload/platform/plugins/voice-mirror/skills/voice-mirror/SKILL.md +13 -0
- package/payload/platform/scripts/logs-read-jsonl.test.sh +118 -0
- package/payload/platform/scripts/logs-read.sh +63 -9
- package/payload/platform/scripts/voice-author-key-audit.sh +155 -0
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js +4 -0
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/mcp-descriptor-resolve.d.ts +17 -0
- package/payload/platform/services/claude-session-manager/dist/mcp-descriptor-resolve.d.ts.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/mcp-descriptor-resolve.js +88 -0
- package/payload/platform/services/claude-session-manager/dist/mcp-descriptor-resolve.js.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +0 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +34 -23
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
- package/payload/server/{chunk-64FGYKNZ.js → chunk-JXWFVE5X.js} +148 -0
- package/payload/server/{chunk-F4D35LKL.js → chunk-POBXIHOF.js} +34 -0
- package/payload/server/maxy-edge.js +1 -1
- package/payload/server/server.js +412 -37
- package/payload/server/{src-S7C4P6TT.js → src-4F37OHLK.js} +19 -1
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/pkce-flow.test.d.ts +0 -2
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/pkce-flow.test.js +0 -215
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/pkce-flow.test.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cf-exec.d.ts","sourceRoot":"","sources":["../src/cf-exec.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;A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path");
|
|
10
10
|
const house_credential_js_1 = require("./house-credential.js");
|
|
11
11
|
const house_scoped_token_js_1 = require("./house-scoped-token.js");
|
|
12
|
+
// An object key carries `/` as a real path separator (the data portal's
|
|
13
|
+
// per-person prefixes), so it is encoded segment-wise rather than whole:
|
|
14
|
+
// separators stay separators, and spaces and specials are escaped. This
|
|
15
|
+
// encoding is not doc-confirmed; it is chosen so that a wrong guess surfaces as
|
|
16
|
+
// a 404 carrying its body, never as a silently misfiled object.
|
|
17
|
+
function encodeObjectKey(key) {
|
|
18
|
+
return key.split("/").map(encodeURIComponent).join("/");
|
|
19
|
+
}
|
|
20
|
+
// The single-object endpoint, shared by get/put/delete so the three cannot drift
|
|
21
|
+
// apart on encoding.
|
|
22
|
+
function objectUrl(accountId, bucket, key) {
|
|
23
|
+
return `https://api.cloudflare.com/client/v4/accounts/${accountId}/r2/buckets/${encodeURIComponent(bucket)}/objects/${encodeObjectKey(key)}`;
|
|
24
|
+
}
|
|
25
|
+
// The cast is confined to this adapter. A Uint8Array is a valid fetch body at
|
|
26
|
+
// runtime, but the DOM lib's BodyInit does not admit TypeScript's generic
|
|
27
|
+
// Uint8Array<ArrayBufferLike>, so consumers compiled against DOM typings (the
|
|
28
|
+
// ui server) reject the call the Node typings accept. Casting here keeps the
|
|
29
|
+
// seam's own type honest for every caller and test.
|
|
12
30
|
const defaultFetch = (url, init) => fetch(url, init);
|
|
13
31
|
const defaultRun = (cmd, args, env) => new Promise((resolve, reject) => {
|
|
14
32
|
(0, node_child_process_1.execFile)(cmd, args, { env }, (err, stdout, stderr) => {
|
|
@@ -49,6 +67,67 @@ async function cfApiJson(fetchFn, url, init, context) {
|
|
|
49
67
|
}
|
|
50
68
|
return { parsed, body };
|
|
51
69
|
}
|
|
70
|
+
// The one pagination loop for the object listing, shared by r2ObjectList and
|
|
71
|
+
// r2ObjectFind so the two cannot drift apart on cursor discipline — the same
|
|
72
|
+
// reason objectUrl is shared by get/put/delete.
|
|
73
|
+
//
|
|
74
|
+
// 1665's rules live here and nowhere else: follow the cursor to exhaustion,
|
|
75
|
+
// is_truncated is authoritative when present, a truncated page naming no cursor
|
|
76
|
+
// is an anomaly to surface rather than a partial list, and a repeated cursor is
|
|
77
|
+
// a cycle rather than progress. per_page is deliberately never sent — its
|
|
78
|
+
// default is unconfirmed, and omitting it takes whatever page size Cloudflare
|
|
79
|
+
// serves rather than guessing a value.
|
|
80
|
+
//
|
|
81
|
+
// It yields pages rather than returning a list, which is what lets r2ObjectFind
|
|
82
|
+
// stop early: an async generator is pull-based, so a consumer that stops
|
|
83
|
+
// iterating never triggers the next request.
|
|
84
|
+
async function* r2ObjectPages(fetchFn, cred, bucket, prefix) {
|
|
85
|
+
const base = `https://api.cloudflare.com/client/v4/accounts/${cred.accountId}/r2/buckets/${encodeURIComponent(bucket)}/objects`;
|
|
86
|
+
const seen = new Set();
|
|
87
|
+
let cursor;
|
|
88
|
+
for (;;) {
|
|
89
|
+
const params = new URLSearchParams();
|
|
90
|
+
if (prefix !== undefined)
|
|
91
|
+
params.set("prefix", prefix);
|
|
92
|
+
if (cursor !== undefined)
|
|
93
|
+
params.set("cursor", cursor);
|
|
94
|
+
const qs = params.toString();
|
|
95
|
+
const { parsed, body } = await cfApiJson(fetchFn, qs ? `${base}?${qs}` : base, { method: "GET", headers: { Authorization: `Bearer ${cred.apiToken}` } }, "r2 object list");
|
|
96
|
+
const page = parsed;
|
|
97
|
+
const objects = [];
|
|
98
|
+
for (const o of page.result ?? []) {
|
|
99
|
+
objects.push({ key: o.key, size: o.size, etag: o.etag, lastModified: o.last_modified });
|
|
100
|
+
}
|
|
101
|
+
yield objects;
|
|
102
|
+
const truncated = page.result_info?.is_truncated;
|
|
103
|
+
const next = page.result_info?.cursor;
|
|
104
|
+
// is_truncated is authoritative *when present*: a last page may still carry
|
|
105
|
+
// a cursor, and following it would issue a pointless request or trip the
|
|
106
|
+
// cycle guard below on a healthy response.
|
|
107
|
+
if (truncated === false)
|
|
108
|
+
return;
|
|
109
|
+
// The API says there is more but names no cursor: the response is not the
|
|
110
|
+
// shape we understand. Surface it rather than stop, which would silently
|
|
111
|
+
// truncate the audit's listing — the failure this loop exists to prevent.
|
|
112
|
+
if (truncated === true && !next) {
|
|
113
|
+
throw new Error(`storage-broker: r2 object list reported truncated but gave no pagination cursor: ${body}`);
|
|
114
|
+
}
|
|
115
|
+
// is_truncated absent: it is itself an unmeasured fact, so it must not be
|
|
116
|
+
// what decides correctness. Fall back to cursor presence — the rule r2List
|
|
117
|
+
// uses on the same envelope — so an envelope without the flag paginates
|
|
118
|
+
// rather than truncating silently.
|
|
119
|
+
if (!next)
|
|
120
|
+
return;
|
|
121
|
+
// A cursor seen before means the API is cycling rather than advancing: it
|
|
122
|
+
// would loop forever, re-yielding the same objects each pass. Tracking every
|
|
123
|
+
// cursor (not just the last) also catches a cycle of period >= 2.
|
|
124
|
+
if (seen.has(next)) {
|
|
125
|
+
throw new Error(`storage-broker: r2 object list returned a repeated pagination cursor: ${next}`);
|
|
126
|
+
}
|
|
127
|
+
seen.add(next);
|
|
128
|
+
cursor = next;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
52
131
|
function makeCfExec(cred, run = defaultRun, fetchFn = defaultFetch) {
|
|
53
132
|
const env = {
|
|
54
133
|
...process.env,
|
|
@@ -129,6 +208,92 @@ function makeCfExec(cred, run = defaultRun, fetchFn = defaultFetch) {
|
|
|
129
208
|
async r2Create(name) {
|
|
130
209
|
await run("npx", ["wrangler", "r2", "bucket", "create", name], env);
|
|
131
210
|
},
|
|
211
|
+
// --- R2 objects (Task 1691) -------------------------------------------
|
|
212
|
+
//
|
|
213
|
+
// The v4 REST API exposes the object surface under
|
|
214
|
+
// /accounts/{id}/r2/buckets/{bucket}/objects and accepts the same Bearer
|
|
215
|
+
// token as the bucket endpoints (account-level Workers R2 Storage Write).
|
|
216
|
+
// The r2/api/tokens/ note that "Object Read & Write" is S3-only constrains
|
|
217
|
+
// the bucket-item-scoped *permission types*, not these endpoints.
|
|
218
|
+
//
|
|
219
|
+
// The endpoint's existence and token class are doc-confirmed. Its behaviour
|
|
220
|
+
// was unmeasured until Task 1697, which probed the live v4 API on 2026-07-16
|
|
221
|
+
// from the laptop's own maxy-code install (no house Cloudflare credential
|
|
222
|
+
// exists on the dev Mac, which is why the tests fake the fetch seam). What
|
|
223
|
+
// that probe established, so nobody re-guesses it:
|
|
224
|
+
//
|
|
225
|
+
// - The listing is NOT in ascending UTF-8 binary order. `prefix=a/photo.jpg`
|
|
226
|
+
// returns `a/photo.jpg.bak` before `a/photo.jpg`, so the exact key is not
|
|
227
|
+
// the first element and `per_page=1` returns a neighbour. S3's
|
|
228
|
+
// ListObjectsV2 ordering guarantee does not transfer to this endpoint.
|
|
229
|
+
// - HEAD is routed only for single-segment keys: any key containing "/"
|
|
230
|
+
// returns 405 while GET on the identical URL returns 404.
|
|
231
|
+
// - A ranged GET is honoured at 2 MB and ignored at 12 B, so it cannot size
|
|
232
|
+
// an object without an undocumented size threshold deciding correctness.
|
|
233
|
+
// - per_page is bounded 0..1000 (error 10029), and per_page=0 returns zero
|
|
234
|
+
// objects with is_truncated:true — a loop trap. It is still never sent.
|
|
235
|
+
//
|
|
236
|
+
// The design keeps every unmeasured fact unable to affect correctness:
|
|
237
|
+
// per_page is never sent, order is never assumed, and nothing fails
|
|
238
|
+
// silently. Evidence:
|
|
239
|
+
// docs/superpowers/specs/2026-07-16-storage-broker-get-sizing-early-exit-design.md
|
|
240
|
+
async r2ObjectList(bucket, prefix) {
|
|
241
|
+
// The standing audit needs the complete set: a truncated object listing
|
|
242
|
+
// reads as "those objects are absent", producing false phantom rows and
|
|
243
|
+
// hiding real orphans — the same bug r2List had, one endpoint over. So
|
|
244
|
+
// this drains every page. r2ObjectFind is the caller that needs one
|
|
245
|
+
// record and must not pay for this.
|
|
246
|
+
const objects = [];
|
|
247
|
+
for await (const page of r2ObjectPages(fetchFn, cred, bucket, prefix)) {
|
|
248
|
+
for (const o of page)
|
|
249
|
+
objects.push(o);
|
|
250
|
+
}
|
|
251
|
+
return objects;
|
|
252
|
+
},
|
|
253
|
+
async r2ObjectFind(bucket, key) {
|
|
254
|
+
// Task 1697 — the size source for a get. Scans each page for the exact key
|
|
255
|
+
// and returns on the first match, so it holds one page rather than every
|
|
256
|
+
// object sharing the key as a prefix, and issues no request past the page
|
|
257
|
+
// carrying the match.
|
|
258
|
+
//
|
|
259
|
+
// Exact match, not prefix: a prefix of `a/photo.jpg` also matches
|
|
260
|
+
// `a/photo.jpg.bak`, and sizing the neighbour would either reject a legal
|
|
261
|
+
// get or admit an oversized one. Exiting on the match rather than on
|
|
262
|
+
// position is what makes this independent of listing order — measured
|
|
263
|
+
// 2026-07-16 against the live v4 API, the listing is NOT in ascending
|
|
264
|
+
// UTF-8 binary order, so the exact key is not the first element and
|
|
265
|
+
// `per_page=1` returns a neighbour.
|
|
266
|
+
//
|
|
267
|
+
// An absent key still drains every page, because proving absence requires
|
|
268
|
+
// seeing them all. That residual is accepted and permanent; nothing on
|
|
269
|
+
// this endpoint sizes one object in bounded work. See
|
|
270
|
+
// docs/superpowers/specs/2026-07-16-storage-broker-get-sizing-early-exit-design.md
|
|
271
|
+
for await (const page of r2ObjectPages(fetchFn, cred, bucket, key)) {
|
|
272
|
+
const hit = page.find((o) => o.key === key);
|
|
273
|
+
if (hit)
|
|
274
|
+
return hit;
|
|
275
|
+
}
|
|
276
|
+
return null;
|
|
277
|
+
},
|
|
278
|
+
async r2ObjectGet(bucket, key) {
|
|
279
|
+
// The one method cfApiJson cannot wrap: get returns the raw object body,
|
|
280
|
+
// not a success envelope, so there is nothing to parse or assert
|
|
281
|
+
// success:true on. The error body is still retained on a non-2xx.
|
|
282
|
+
const res = await fetchFn(objectUrl(cred.accountId, bucket, key), {
|
|
283
|
+
method: "GET",
|
|
284
|
+
headers: { Authorization: `Bearer ${cred.apiToken}` },
|
|
285
|
+
});
|
|
286
|
+
if (!res.ok) {
|
|
287
|
+
throw new Error(`storage-broker: r2 object get failed: ${res.status}\n${await res.text()}`);
|
|
288
|
+
}
|
|
289
|
+
return new Uint8Array(await res.arrayBuffer());
|
|
290
|
+
},
|
|
291
|
+
async r2ObjectPut(bucket, key, body) {
|
|
292
|
+
await cfApiJson(fetchFn, objectUrl(cred.accountId, bucket, key), { method: "PUT", headers: { Authorization: `Bearer ${cred.apiToken}` }, body }, "r2 object put");
|
|
293
|
+
},
|
|
294
|
+
async r2ObjectDelete(bucket, key) {
|
|
295
|
+
await cfApiJson(fetchFn, objectUrl(cred.accountId, bucket, key), { method: "DELETE", headers: { Authorization: `Bearer ${cred.apiToken}` } }, "r2 object delete");
|
|
296
|
+
},
|
|
132
297
|
};
|
|
133
298
|
}
|
|
134
299
|
// Task 1670 — build a CfExec whose token is a D1+R2 "storage" scope minted from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cf-exec.js","sourceRoot":"","sources":["../src/cf-exec.ts"],"names":[],"mappings":";AAAA,yEAAyE;AACzE,iFAAiF;AACjF,iFAAiF;;
|
|
1
|
+
{"version":3,"file":"cf-exec.js","sourceRoot":"","sources":["../src/cf-exec.ts"],"names":[],"mappings":";AAAA,yEAAyE;AACzE,iFAAiF;AACjF,iFAAiF;;AAsMjF,gCAwMC;AASD,0CAUC;AA/ZD,2DAA8C;AAC9C,yCAAiC;AAEjC,+DAA4D;AAC5D,mEAAkE;AAgDlE,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AACxE,gFAAgF;AAChF,gEAAgE;AAChE,SAAS,eAAe,CAAC,GAAW;IAClC,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1D,CAAC;AAED,iFAAiF;AACjF,qBAAqB;AACrB,SAAS,SAAS,CAAC,SAAiB,EAAE,MAAc,EAAE,GAAW;IAC/D,OAAO,iDAAiD,SAAS,eAAe,kBAAkB,CAAC,MAAM,CAAC,YAAY,eAAe,CAAC,GAAG,C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AAe,CACnC,YAAoB,EACpB,MAAa,UAAU,EACvB,UAAmB,YAAY;IAE/B,MAAM,IAAI,GAAG,IAAA,yCAAmB,EAAC,YAAY,CAAC,CAAC;IAC/C,MAAM,YAAY,GAAG,IAAA,gBAAI,EAAC,YAAY,EAAE,QAAQ,EAAE,sBAAsB,CAAC,CAAC;IAC1E,MAAM,SAAS,GAAG,IAAA,gBAAI,EAAC,YAAY,EAAE,oCAAoC,CAAC,CAAC;IAC3E,MAAM,MAAM,GAAG,MAAM,IAAA,+CAAuB,EAAC,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IACtF,OAAO,UAAU,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AACnF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"house-credential.d.ts","sourceRoot":"","sources":["../src/house-credential.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"house-credential.d.ts","sourceRoot":"","sources":["../src/house-credential.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,eAAe,CAkBzE"}
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
// config directory. This file is the one place the account-wide capability
|
|
4
4
|
// lives. House-only is a location convention plus the cf-token.sh caller gate,
|
|
5
5
|
// NOT an OS permission: every account's session runs as the same unix user, so
|
|
6
|
-
// a sub-account agent holding Bash can read this path directly.
|
|
7
|
-
//
|
|
6
|
+
// a sub-account agent holding Bash can read this path directly. That is a
|
|
7
|
+
// permanent property, not a pending gap: OS user separation was costed and
|
|
8
|
+
// declined as disproportionate (Task 1690, archived undone), so nothing tracks
|
|
9
|
+
// it. Do not cite this file's location or mode as a boundary. Parses
|
|
8
10
|
// KEY=value lines without polluting process.env (same discipline as
|
|
9
11
|
// reconcile-bookings' readEnvFile).
|
|
10
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"house-credential.js","sourceRoot":"","sources":["../src/house-credential.ts"],"names":[],"mappings":";AAAA,0EAA0E;AAC1E,2EAA2E;AAC3E,+EAA+E;AAC/E,+EAA+E;AAC/E,0EAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"house-credential.js","sourceRoot":"","sources":["../src/house-credential.ts"],"names":[],"mappings":";AAAA,0EAA0E;AAC1E,2EAA2E;AAC3E,+EAA+E;AAC/E,+EAA+E;AAC/E,0EAA0E;AAC1E,2EAA2E;AAC3E,+EAA+E;AAC/E,qEAAqE;AACrE,oEAAoE;AACpE,oCAAoC;;AAUpC,kDAkBC;AA1BD,qCAAuC;AACvC,yCAAiC;AAOjC,SAAgB,mBAAmB,CAAC,YAAoB;IACtD,MAAM,IAAI,GAAG,IAAA,gBAAI,EAAC,YAAY,EAAE,QAAQ,EAAE,sBAAsB,CAAC,CAAC;IAClE,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,IAAA,sBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,iDAAiD,IAAI,EAAE,CAAC,CAAC;IAC3E,CAAC;IACD,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACnC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAC3D,IAAI,CAAC;YAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACjC,CAAC;IACD,MAAM,QAAQ,GAAG,GAAG,CAAC,oBAAoB,CAAC;IAC1C,MAAM,SAAS,GAAG,GAAG,CAAC,qBAAqB,CAAC;IAC5C,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,mDAAmD,IAAI,EAAE,CAAC,CAAC;IAC1F,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,IAAI,EAAE,CAAC,CAAC;IAC5F,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
|
|
@@ -22,7 +22,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
__exportStar(require("./authorize.js"), exports);
|
|
25
|
+
__exportStar(require("./object-limits.js"), exports);
|
|
25
26
|
__exportStar(require("./registry.js"), exports);
|
|
27
|
+
__exportStar(require("./resource-limits.js"), exports);
|
|
26
28
|
__exportStar(require("./house-credential.js"), exports);
|
|
27
29
|
__exportStar(require("./cf-exec.js"), exports);
|
|
28
30
|
__exportStar(require("./house-scoped-token.js"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,mEAAmE;AACnE,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,2EAA2E;AAC3E,uEAAuE;AACvE,4DAA4D;;;;;;;;;;;;;;;;AAE5D,iDAA+B;AAC/B,gDAA8B;AAC9B,wDAAsC;AACtC,+CAA6B;AAC7B,0DAAwC;AACxC,6CAA2B;AAC3B,iDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,mEAAmE;AACnE,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,2EAA2E;AAC3E,uEAAuE;AACvE,4DAA4D;;;;;;;;;;;;;;;;AAE5D,iDAA+B;AAC/B,qDAAmC;AACnC,gDAA8B;AAC9B,uDAAqC;AACrC,wDAAsC;AACtC,+CAA6B;AAC7B,0DAAwC;AACxC,6CAA2B;AAC3B,iDAA+B"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The byte cap on R2 object transfer, and the arithmetic the routes need to
|
|
3
|
+
* enforce it before they buffer anything.
|
|
4
|
+
*
|
|
5
|
+
* One number, one home (Task 1695). The storage-broker MCP tools and the house
|
|
6
|
+
* ui routes both read the cap from here, so the process that rejects a too-large
|
|
7
|
+
* file and the process that would otherwise buffer it cannot drift apart.
|
|
8
|
+
*
|
|
9
|
+
* Deliberately dependency-free: the MCP imports this module directly, without
|
|
10
|
+
* the rest of the lib (cf-exec, registry, audit, remediate), which it has no use
|
|
11
|
+
* for. The ui route reads it through the barrel.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* The maximum size, in bytes, of an object moved through storage-r2-object-get
|
|
15
|
+
* or storage-r2-object-put.
|
|
16
|
+
*
|
|
17
|
+
* Set independently of the email plugin's OUTBOUND_ATTACHMENT_MAX_BYTES (25 MiB)
|
|
18
|
+
* even though the payload class is the same. The two exist for different reasons
|
|
19
|
+
* and must be free to move for different reasons: email's tracks an SMTP-side
|
|
20
|
+
* rejection threshold, this one tracks house-process memory. Do not couple them.
|
|
21
|
+
*
|
|
22
|
+
* Not bounded by R2. A single-part upload may be up to 5 GiB (doc-confirmed:
|
|
23
|
+
* developers.cloudflare.com/r2/platform/limits/), roughly fifty times this, and
|
|
24
|
+
* the v4 REST API states no separate object-size limit. This cap is the only
|
|
25
|
+
* bound on either transfer.
|
|
26
|
+
*
|
|
27
|
+
* The bound is not small: at the cap a get still leaves the house process
|
|
28
|
+
* holding the object and its base64 form, roughly 2.4x the object. That cost was
|
|
29
|
+
* weighed and accepted when the number was chosen.
|
|
30
|
+
*/
|
|
31
|
+
export declare const R2_OBJECT_MAX_BYTES: number;
|
|
32
|
+
/** base64 emits 4 characters per 3 input bytes, padded up to the next quantum. */
|
|
33
|
+
export declare function base64Ceiling(bytes: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* The largest JSON body an object route's metadata envelope can legitimately
|
|
36
|
+
* carry: a bucket name, one key or prefix, and JSON punctuation. No payload term.
|
|
37
|
+
*
|
|
38
|
+
* Used twice, because it answers one question — how large can an envelope
|
|
39
|
+
* legitimately get. `/r2/object/list`, `get` and `delete` carry an envelope and
|
|
40
|
+
* nothing else, so this is their whole body limit (Task 1698). `put` carries the
|
|
41
|
+
* same envelope plus base64 object bytes, so it adds this to the base64 ceiling
|
|
42
|
+
* below, which is the allowance that keeps a legal at-cap put from being rejected
|
|
43
|
+
* by its own key.
|
|
44
|
+
*
|
|
45
|
+
* Deliberately one constant rather than two that happen to match. This is the
|
|
46
|
+
* opposite ruling to the email cap above, for the opposite reason: that pair must
|
|
47
|
+
* stay independent because the numbers track different constraints and would drift
|
|
48
|
+
* for different reasons. Here the constraint is identical, so a change to either
|
|
49
|
+
* use must move both.
|
|
50
|
+
*
|
|
51
|
+
* Sized from confirmed R2 limits rather than assumed. An object key is at most
|
|
52
|
+
* 1,024 bytes (developers.cloudflare.com/r2/platform/limits/) and a bucket name is
|
|
53
|
+
* 3-63 characters (developers.cloudflare.com/r2/buckets/create-buckets/), so a
|
|
54
|
+
* real envelope is about 1.1 KB, or roughly 6 KiB if every key byte takes a
|
|
55
|
+
* six-character \uXXXX escape. This clears that by about ten times and sits about
|
|
56
|
+
* 2,100 times below put's body limit: far above anything a real caller sends, far
|
|
57
|
+
* below anything that threatens house memory. Nothing here depends on either
|
|
58
|
+
* figure being exact.
|
|
59
|
+
*/
|
|
60
|
+
export declare const R2_OBJECT_ENVELOPE_MAX_BODY_BYTES: number;
|
|
61
|
+
/**
|
|
62
|
+
* The largest JSON body /r2/object/put can legitimately carry.
|
|
63
|
+
*
|
|
64
|
+
* This bounds house memory; it does not adjudicate the last kilobyte. The exact
|
|
65
|
+
* decoded-byte rule lives in the MCP, which knows the source's size exactly.
|
|
66
|
+
*/
|
|
67
|
+
export declare const R2_OBJECT_PUT_MAX_BODY_BYTES: number;
|
|
68
|
+
/**
|
|
69
|
+
* The over-cap message, worded once so the MCP and the routes agree. Names the
|
|
70
|
+
* offending object and the limit, which is what makes the failure actionable
|
|
71
|
+
* rather than an opaque out-of-memory kill.
|
|
72
|
+
*
|
|
73
|
+
* Exact bytes accompany the MiB figures because MiB alone rounds: an object one
|
|
74
|
+
* byte over the cap reads "100.0 MiB, which exceeds the 100.0 MiB limit", which
|
|
75
|
+
* is a message that appears to contradict itself and invites the reader to treat
|
|
76
|
+
* the rejection as a bug. The bytes are what make it legible; the MiB is what
|
|
77
|
+
* makes it quick.
|
|
78
|
+
*/
|
|
79
|
+
export declare function tooLargeMessage(what: string, actualBytes: number): string;
|
|
80
|
+
//# sourceMappingURL=object-limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-limits.d.ts","sourceRoot":"","sources":["../src/object-limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,mBAAmB,QAAoB,CAAC;AAErD,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,iCAAiC,QAAY,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,QAC+B,CAAC;AAMzE;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAIzE"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The byte cap on R2 object transfer, and the arithmetic the routes need to
|
|
4
|
+
* enforce it before they buffer anything.
|
|
5
|
+
*
|
|
6
|
+
* One number, one home (Task 1695). The storage-broker MCP tools and the house
|
|
7
|
+
* ui routes both read the cap from here, so the process that rejects a too-large
|
|
8
|
+
* file and the process that would otherwise buffer it cannot drift apart.
|
|
9
|
+
*
|
|
10
|
+
* Deliberately dependency-free: the MCP imports this module directly, without
|
|
11
|
+
* the rest of the lib (cf-exec, registry, audit, remediate), which it has no use
|
|
12
|
+
* for. The ui route reads it through the barrel.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.R2_OBJECT_PUT_MAX_BODY_BYTES = exports.R2_OBJECT_ENVELOPE_MAX_BODY_BYTES = exports.R2_OBJECT_MAX_BYTES = void 0;
|
|
16
|
+
exports.base64Ceiling = base64Ceiling;
|
|
17
|
+
exports.tooLargeMessage = tooLargeMessage;
|
|
18
|
+
/**
|
|
19
|
+
* The maximum size, in bytes, of an object moved through storage-r2-object-get
|
|
20
|
+
* or storage-r2-object-put.
|
|
21
|
+
*
|
|
22
|
+
* Set independently of the email plugin's OUTBOUND_ATTACHMENT_MAX_BYTES (25 MiB)
|
|
23
|
+
* even though the payload class is the same. The two exist for different reasons
|
|
24
|
+
* and must be free to move for different reasons: email's tracks an SMTP-side
|
|
25
|
+
* rejection threshold, this one tracks house-process memory. Do not couple them.
|
|
26
|
+
*
|
|
27
|
+
* Not bounded by R2. A single-part upload may be up to 5 GiB (doc-confirmed:
|
|
28
|
+
* developers.cloudflare.com/r2/platform/limits/), roughly fifty times this, and
|
|
29
|
+
* the v4 REST API states no separate object-size limit. This cap is the only
|
|
30
|
+
* bound on either transfer.
|
|
31
|
+
*
|
|
32
|
+
* The bound is not small: at the cap a get still leaves the house process
|
|
33
|
+
* holding the object and its base64 form, roughly 2.4x the object. That cost was
|
|
34
|
+
* weighed and accepted when the number was chosen.
|
|
35
|
+
*/
|
|
36
|
+
exports.R2_OBJECT_MAX_BYTES = 100 * 1024 * 1024;
|
|
37
|
+
/** base64 emits 4 characters per 3 input bytes, padded up to the next quantum. */
|
|
38
|
+
function base64Ceiling(bytes) {
|
|
39
|
+
return 4 * Math.ceil(bytes / 3);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The largest JSON body an object route's metadata envelope can legitimately
|
|
43
|
+
* carry: a bucket name, one key or prefix, and JSON punctuation. No payload term.
|
|
44
|
+
*
|
|
45
|
+
* Used twice, because it answers one question — how large can an envelope
|
|
46
|
+
* legitimately get. `/r2/object/list`, `get` and `delete` carry an envelope and
|
|
47
|
+
* nothing else, so this is their whole body limit (Task 1698). `put` carries the
|
|
48
|
+
* same envelope plus base64 object bytes, so it adds this to the base64 ceiling
|
|
49
|
+
* below, which is the allowance that keeps a legal at-cap put from being rejected
|
|
50
|
+
* by its own key.
|
|
51
|
+
*
|
|
52
|
+
* Deliberately one constant rather than two that happen to match. This is the
|
|
53
|
+
* opposite ruling to the email cap above, for the opposite reason: that pair must
|
|
54
|
+
* stay independent because the numbers track different constraints and would drift
|
|
55
|
+
* for different reasons. Here the constraint is identical, so a change to either
|
|
56
|
+
* use must move both.
|
|
57
|
+
*
|
|
58
|
+
* Sized from confirmed R2 limits rather than assumed. An object key is at most
|
|
59
|
+
* 1,024 bytes (developers.cloudflare.com/r2/platform/limits/) and a bucket name is
|
|
60
|
+
* 3-63 characters (developers.cloudflare.com/r2/buckets/create-buckets/), so a
|
|
61
|
+
* real envelope is about 1.1 KB, or roughly 6 KiB if every key byte takes a
|
|
62
|
+
* six-character \uXXXX escape. This clears that by about ten times and sits about
|
|
63
|
+
* 2,100 times below put's body limit: far above anything a real caller sends, far
|
|
64
|
+
* below anything that threatens house memory. Nothing here depends on either
|
|
65
|
+
* figure being exact.
|
|
66
|
+
*/
|
|
67
|
+
exports.R2_OBJECT_ENVELOPE_MAX_BODY_BYTES = 64 * 1024;
|
|
68
|
+
/**
|
|
69
|
+
* The largest JSON body /r2/object/put can legitimately carry.
|
|
70
|
+
*
|
|
71
|
+
* This bounds house memory; it does not adjudicate the last kilobyte. The exact
|
|
72
|
+
* decoded-byte rule lives in the MCP, which knows the source's size exactly.
|
|
73
|
+
*/
|
|
74
|
+
exports.R2_OBJECT_PUT_MAX_BODY_BYTES = base64Ceiling(exports.R2_OBJECT_MAX_BYTES) + exports.R2_OBJECT_ENVELOPE_MAX_BODY_BYTES;
|
|
75
|
+
function formatMiB(bytes) {
|
|
76
|
+
return (bytes / 1024 / 1024).toFixed(1);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The over-cap message, worded once so the MCP and the routes agree. Names the
|
|
80
|
+
* offending object and the limit, which is what makes the failure actionable
|
|
81
|
+
* rather than an opaque out-of-memory kill.
|
|
82
|
+
*
|
|
83
|
+
* Exact bytes accompany the MiB figures because MiB alone rounds: an object one
|
|
84
|
+
* byte over the cap reads "100.0 MiB, which exceeds the 100.0 MiB limit", which
|
|
85
|
+
* is a message that appears to contradict itself and invites the reader to treat
|
|
86
|
+
* the rejection as a bug. The bytes are what make it legible; the MiB is what
|
|
87
|
+
* makes it quick.
|
|
88
|
+
*/
|
|
89
|
+
function tooLargeMessage(what, actualBytes) {
|
|
90
|
+
return `${what} is ${formatMiB(actualBytes)} MiB (${actualBytes} bytes), which exceeds the ${formatMiB(exports.R2_OBJECT_MAX_BYTES)} MiB (${exports.R2_OBJECT_MAX_BYTES} bytes) R2 object limit.`;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=object-limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-limits.js","sourceRoot":"","sources":["../src/object-limits.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAuBH,sCAEC;AAsDD,0CAIC;AAjFD;;;;;;;;;;;;;;;;;GAiBG;AACU,QAAA,mBAAmB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAErD,kFAAkF;AAClF,SAAgB,aAAa,CAAC,KAAa;IACzC,OAAO,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACU,QAAA,iCAAiC,GAAG,EAAE,GAAG,IAAI,CAAC;AAE3D;;;;;GAKG;AACU,QAAA,4BAA4B,GACvC,aAAa,CAAC,2BAAmB,CAAC,GAAG,yCAAiC,CAAC;AAEzE,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,CAAC,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,eAAe,CAAC,IAAY,EAAE,WAAmB;IAC/D,OAAO,GAAG,IAAI,OAAO,SAAS,CAAC,WAAW,CAAC,SAAS,WAAW,8BAA8B,SAAS,CACpG,2BAAmB,CACpB,SAAS,2BAAmB,0BAA0B,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bounds on the request bodies the resource-level routes will buffer:
|
|
3
|
+
* /d1/create, /d1/query and /r2/create (Task 1702).
|
|
4
|
+
*
|
|
5
|
+
* Parallel to object-limits.ts, which bounds the object routes. Kept separate
|
|
6
|
+
* because the facts differ: an object envelope is dominated by R2's 1,024-byte
|
|
7
|
+
* object key limit, and these routes carry no key at all. Coupling them would tie
|
|
8
|
+
* a D1 database name to R2's key limit, so a revision to either would move a bound
|
|
9
|
+
* that has no reason to move.
|
|
10
|
+
*
|
|
11
|
+
* These are bounds on house memory. They do not adjudicate the last byte of a name
|
|
12
|
+
* or a statement — the same stance object-limits.ts takes, for the same reason. The
|
|
13
|
+
* house process holds the account-wide credential, so an out-of-memory kill there
|
|
14
|
+
* takes the brand server down, and on the target hardware that is a hard freeze
|
|
15
|
+
* that emits nothing.
|
|
16
|
+
*
|
|
17
|
+
* Deliberately dependency-free, like object-limits.ts: the ui route reads these
|
|
18
|
+
* through the barrel, and nothing here needs the rest of the lib.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Cloudflare's documented maximum SQL statement length.
|
|
22
|
+
*
|
|
23
|
+
* "Maximum SQL statement length | 100,000 bytes (100 KB)"
|
|
24
|
+
* https://developers.cloudflare.com/d1/platform/limits/
|
|
25
|
+
*
|
|
26
|
+
* Recorded because it is what governs a legitimate `sql`, and because
|
|
27
|
+
* D1_QUERY_MAX_BODY_BYTES below is only knowable as safe by way of it.
|
|
28
|
+
*
|
|
29
|
+
* A second, independent bound applies to the same string on the way out, and is
|
|
30
|
+
* recorded here so nobody rediscovers it as a bug: cf-exec's d1Query shells
|
|
31
|
+
* `execFile("npx", ["wrangler", "d1", "execute", ..., "--command", sql])`, so the
|
|
32
|
+
* decoded statement travels as a single argv element. Linux caps one such element
|
|
33
|
+
* at MAX_ARG_STRLEN = 131,072 bytes and fails execve with E2BIG above it
|
|
34
|
+
* (https://man7.org/linux/man-pages/man2/execve.2.html). That is a property of the
|
|
35
|
+
* spawn path, not of D1. It does not bind first: 100,000 < 131,072, so a statement
|
|
36
|
+
* D1 would accept always fits the spawn.
|
|
37
|
+
*/
|
|
38
|
+
export declare const D1_MAX_SQL_STATEMENT_BYTES = 100000;
|
|
39
|
+
/**
|
|
40
|
+
* The worst-case expansion of a byte when it is serialized into a JSON string.
|
|
41
|
+
*
|
|
42
|
+
* A single ASCII control byte becomes the six characters \uXXXX. Multi-byte
|
|
43
|
+
* characters are cheaper per byte — a 3-byte UTF-8 character also becomes six
|
|
44
|
+
* characters (2x), and a non-BMP character becomes a 12-character surrogate pair
|
|
45
|
+
* for 4 bytes (3x) — so 6 is a true ceiling over bytes, reached by ASCII.
|
|
46
|
+
*
|
|
47
|
+
* This is why a body limit is not simply the statement limit: the cap bounds the
|
|
48
|
+
* wire body, and escaping moves the two apart.
|
|
49
|
+
*/
|
|
50
|
+
export declare const JSON_STRING_WORST_CASE_EXPANSION = 6;
|
|
51
|
+
/**
|
|
52
|
+
* The largest JSON body /d1/create or /r2/create can legitimately carry: a single
|
|
53
|
+
* resource name and JSON punctuation. No payload term, and no key term.
|
|
54
|
+
*
|
|
55
|
+
* Sized on headroom rather than a tight derivation, because only one of the two
|
|
56
|
+
* names it bounds has a documented hard limit:
|
|
57
|
+
*
|
|
58
|
+
* - R2 bucket name: 3-63 characters, lowercase letters, digits and hyphens.
|
|
59
|
+
* https://developers.cloudflare.com/r2/buckets/create-buckets/
|
|
60
|
+
* - D1 database name: no documented limit. The API reference states only
|
|
61
|
+
* `name: string`, "D1 database name" — no maxLength, pattern or charset.
|
|
62
|
+
* https://developers.cloudflare.com/api/resources/d1/subresources/database/
|
|
63
|
+
* The get-started guide gives guidance, not a limit: names "should use a
|
|
64
|
+
* combination of ASCII characters, shorter than 32 characters".
|
|
65
|
+
*
|
|
66
|
+
* So a real body is under ~100 bytes and 64 KiB clears it by roughly 650x, while
|
|
67
|
+
* sitting ~2,100x below put's body limit: far above anything a real caller sends,
|
|
68
|
+
* far below anything that threatens house memory. Nothing here depends on either
|
|
69
|
+
* figure being exact. An undocumented D1 name limit cannot plausibly approach 64
|
|
70
|
+
* KiB, and a request body is the wrong place to discover that it had.
|
|
71
|
+
*
|
|
72
|
+
* Deliberately not R2_OBJECT_ENVELOPE_MAX_BODY_BYTES, which happens to hold the
|
|
73
|
+
* same value. That constant is governed by R2's object key limit; this one is not,
|
|
74
|
+
* and the two must be free to drift. Couple what is one fact; separate what merely
|
|
75
|
+
* matches today.
|
|
76
|
+
*/
|
|
77
|
+
export declare const STORAGE_RESOURCE_NAME_MAX_BODY_BYTES: number;
|
|
78
|
+
/**
|
|
79
|
+
* The largest JSON body /d1/query can legitimately carry: a database name and a
|
|
80
|
+
* SQL statement.
|
|
81
|
+
*
|
|
82
|
+
* The envelope reasoning behind the object routes' bound does not govern this. A
|
|
83
|
+
* large but entirely legal migration or batch statement is not a 1,024-byte object
|
|
84
|
+
* key, so applying that constant here would reject correct queries.
|
|
85
|
+
*
|
|
86
|
+
* The bound is on the wire body, not the decoded statement, and JSON escaping moves
|
|
87
|
+
* those apart. The largest legal statement (D1_MAX_SQL_STATEMENT_BYTES) can present
|
|
88
|
+
* a wire body of up to
|
|
89
|
+
*
|
|
90
|
+
* JSON_STRING_WORST_CASE_EXPANSION * 100,000 + 65,536 = 665,536 bytes
|
|
91
|
+
*
|
|
92
|
+
* so capping at 100,000 would 413 a statement D1 would have accepted. 1 MiB clears
|
|
93
|
+
* the worst case by about 1.6x and sits ~133x below put's body limit.
|
|
94
|
+
*
|
|
95
|
+
* It is a flat number rather than that expression, for legibility at the call site.
|
|
96
|
+
* The arithmetic is not decoration: it is the only thing that makes 1 MiB knowable
|
|
97
|
+
* as safe, so resource-limits.test.ts asserts the relationship. If D1 ever raises
|
|
98
|
+
* its statement limit above 163,840 bytes, that test fails rather than this route
|
|
99
|
+
* quietly beginning to refuse legal SQL.
|
|
100
|
+
*/
|
|
101
|
+
export declare const D1_QUERY_MAX_BODY_BYTES: number;
|
|
102
|
+
//# sourceMappingURL=resource-limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-limits.d.ts","sourceRoot":"","sources":["../src/resource-limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,0BAA0B,SAAU,CAAC;AAElD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,oCAAoC,QAAY,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,uBAAuB,QAAc,CAAC"}
|