@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
package/payload/server/server.js
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
CLAUDE_CREDENTIALS_FILE,
|
|
10
10
|
COMMERCIAL_MODE,
|
|
11
11
|
GREETING_DIRECTIVE,
|
|
12
|
+
HTTPException,
|
|
12
13
|
Hono,
|
|
13
14
|
HtmlEscapedCallbackPhase,
|
|
14
15
|
INSTALL_OWNER_FILE,
|
|
@@ -110,14 +111,21 @@ import {
|
|
|
110
111
|
vncLog,
|
|
111
112
|
walkPremiumBundles,
|
|
112
113
|
writeAdminUserAndPerson
|
|
113
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-POBXIHOF.js";
|
|
114
115
|
import {
|
|
116
|
+
D1_MAX_SQL_STATEMENT_BYTES,
|
|
117
|
+
D1_QUERY_MAX_BODY_BYTES,
|
|
118
|
+
R2_OBJECT_ENVELOPE_MAX_BODY_BYTES,
|
|
119
|
+
R2_OBJECT_MAX_BYTES,
|
|
120
|
+
R2_OBJECT_PUT_MAX_BODY_BYTES,
|
|
121
|
+
STORAGE_RESOURCE_NAME_MAX_BODY_BYTES,
|
|
115
122
|
authorizeAccess,
|
|
116
123
|
listResources,
|
|
117
124
|
makeHouseCfExec,
|
|
118
125
|
registerResource,
|
|
119
|
-
resolveOwner
|
|
120
|
-
|
|
126
|
+
resolveOwner,
|
|
127
|
+
tooLargeMessage
|
|
128
|
+
} from "./chunk-JXWFVE5X.js";
|
|
121
129
|
import {
|
|
122
130
|
__commonJS,
|
|
123
131
|
__toESM
|
|
@@ -8664,6 +8672,65 @@ app2.get("/group-info", async (c) => {
|
|
|
8664
8672
|
});
|
|
8665
8673
|
var whatsapp_default = app2;
|
|
8666
8674
|
|
|
8675
|
+
// node_modules/hono/dist/middleware/body-limit/index.js
|
|
8676
|
+
var ERROR_MESSAGE = "Payload Too Large";
|
|
8677
|
+
var BodyLimitError = class extends Error {
|
|
8678
|
+
constructor(message) {
|
|
8679
|
+
super(message);
|
|
8680
|
+
this.name = "BodyLimitError";
|
|
8681
|
+
}
|
|
8682
|
+
};
|
|
8683
|
+
var bodyLimit = (options) => {
|
|
8684
|
+
const onError = options.onError || (() => {
|
|
8685
|
+
const res = new Response(ERROR_MESSAGE, {
|
|
8686
|
+
status: 413
|
|
8687
|
+
});
|
|
8688
|
+
throw new HTTPException(413, { res });
|
|
8689
|
+
});
|
|
8690
|
+
const maxSize = options.maxSize;
|
|
8691
|
+
return async function bodyLimit2(c, next) {
|
|
8692
|
+
if (!c.req.raw.body) {
|
|
8693
|
+
return next();
|
|
8694
|
+
}
|
|
8695
|
+
const hasTransferEncoding = c.req.raw.headers.has("transfer-encoding");
|
|
8696
|
+
const hasContentLength = c.req.raw.headers.has("content-length");
|
|
8697
|
+
if (hasTransferEncoding && hasContentLength) {
|
|
8698
|
+
}
|
|
8699
|
+
if (hasContentLength && !hasTransferEncoding) {
|
|
8700
|
+
const contentLength = parseInt(c.req.raw.headers.get("content-length") || "0", 10);
|
|
8701
|
+
return contentLength > maxSize ? onError(c) : next();
|
|
8702
|
+
}
|
|
8703
|
+
let size = 0;
|
|
8704
|
+
const rawReader = c.req.raw.body.getReader();
|
|
8705
|
+
const reader = new ReadableStream({
|
|
8706
|
+
async start(controller) {
|
|
8707
|
+
try {
|
|
8708
|
+
for (; ; ) {
|
|
8709
|
+
const { done, value } = await rawReader.read();
|
|
8710
|
+
if (done) {
|
|
8711
|
+
break;
|
|
8712
|
+
}
|
|
8713
|
+
size += value.length;
|
|
8714
|
+
if (size > maxSize) {
|
|
8715
|
+
controller.error(new BodyLimitError(ERROR_MESSAGE));
|
|
8716
|
+
break;
|
|
8717
|
+
}
|
|
8718
|
+
controller.enqueue(value);
|
|
8719
|
+
}
|
|
8720
|
+
} finally {
|
|
8721
|
+
controller.close();
|
|
8722
|
+
}
|
|
8723
|
+
}
|
|
8724
|
+
});
|
|
8725
|
+
const requestInit = { body: reader, duplex: "half" };
|
|
8726
|
+
c.req.raw = new Request(c.req.raw, requestInit);
|
|
8727
|
+
await next();
|
|
8728
|
+
if (c.error instanceof BodyLimitError) {
|
|
8729
|
+
c.res = await onError(c);
|
|
8730
|
+
}
|
|
8731
|
+
};
|
|
8732
|
+
};
|
|
8733
|
+
|
|
8667
8734
|
// server/routes/storage-broker.ts
|
|
8668
8735
|
import { join as join11, resolve as resolve11 } from "path";
|
|
8669
8736
|
import { readdirSync as readdirSync6, readFileSync as readFileSync13, existsSync as existsSync8 } from "fs";
|
|
@@ -8674,14 +8741,57 @@ function platformRoot() {
|
|
|
8674
8741
|
function caller(c) {
|
|
8675
8742
|
return c.req.header("x-maxy-caller-account")?.trim() || null;
|
|
8676
8743
|
}
|
|
8677
|
-
function log(action, kind, account, target, owner, result) {
|
|
8744
|
+
function log(action, kind, account, target, owner, result, reason) {
|
|
8678
8745
|
console.error(
|
|
8679
|
-
`[storage-broker] op=storage-broker resource=${kind} action=${action} account=${account} target=${target} owner=${owner ?? "none"} result=${result}`
|
|
8746
|
+
`[storage-broker] op=storage-broker resource=${kind} action=${action} account=${account} target=${target} owner=${owner ?? "none"} result=${result}${reason ? ` reason=${reason}` : ""}`
|
|
8680
8747
|
);
|
|
8681
8748
|
}
|
|
8682
8749
|
function cfExec() {
|
|
8683
8750
|
return makeHouseCfExec(platformRoot());
|
|
8684
8751
|
}
|
|
8752
|
+
async function readJsonBody(c) {
|
|
8753
|
+
let parsed;
|
|
8754
|
+
try {
|
|
8755
|
+
parsed = await c.req.json();
|
|
8756
|
+
} catch (err) {
|
|
8757
|
+
if (err instanceof Error && err.name === "BodyLimitError") throw err;
|
|
8758
|
+
return { ok: false, res: c.json({ error: "invalid-json" }, 400) };
|
|
8759
|
+
}
|
|
8760
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
8761
|
+
return { ok: false, res: c.json({ error: "invalid-json" }, 400) };
|
|
8762
|
+
}
|
|
8763
|
+
return { ok: true, body: parsed };
|
|
8764
|
+
}
|
|
8765
|
+
function nameBodyLimit(kind) {
|
|
8766
|
+
return bodyLimit({
|
|
8767
|
+
maxSize: STORAGE_RESOURCE_NAME_MAX_BODY_BYTES,
|
|
8768
|
+
onError: (c) => {
|
|
8769
|
+
log("write", kind, caller(c) ?? "none", "*", null, "deny", "name-body-too-large");
|
|
8770
|
+
return c.json(
|
|
8771
|
+
{
|
|
8772
|
+
error: `request body exceeds the ${(STORAGE_RESOURCE_NAME_MAX_BODY_BYTES / 1024).toFixed(
|
|
8773
|
+
1
|
|
8774
|
+
)} KiB (${STORAGE_RESOURCE_NAME_MAX_BODY_BYTES} bytes) limit for a storage resource create, which carries only a name.`
|
|
8775
|
+
},
|
|
8776
|
+
413
|
|
8777
|
+
);
|
|
8778
|
+
}
|
|
8779
|
+
});
|
|
8780
|
+
}
|
|
8781
|
+
var d1QueryBodyLimit = bodyLimit({
|
|
8782
|
+
maxSize: D1_QUERY_MAX_BODY_BYTES,
|
|
8783
|
+
onError: (c) => {
|
|
8784
|
+
log("read", "d1", caller(c) ?? "none", "*", null, "deny", "sql-body-too-large");
|
|
8785
|
+
return c.json(
|
|
8786
|
+
{
|
|
8787
|
+
error: `request body exceeds the ${(D1_QUERY_MAX_BODY_BYTES / 1024 / 1024).toFixed(
|
|
8788
|
+
1
|
|
8789
|
+
)} MiB (${D1_QUERY_MAX_BODY_BYTES} bytes) limit for a D1 query, which carries a database name and a SQL statement of at most ${D1_MAX_SQL_STATEMENT_BYTES} bytes.`
|
|
8790
|
+
},
|
|
8791
|
+
413
|
|
8792
|
+
);
|
|
8793
|
+
}
|
|
8794
|
+
});
|
|
8685
8795
|
app3.get("/d1/list", async (c) => {
|
|
8686
8796
|
const account = caller(c);
|
|
8687
8797
|
if (!account) return c.json({ error: "no-caller" }, 403);
|
|
@@ -8696,10 +8806,12 @@ app3.get("/d1/list", async (c) => {
|
|
|
8696
8806
|
await session.close();
|
|
8697
8807
|
}
|
|
8698
8808
|
});
|
|
8699
|
-
app3.post("/d1/create", async (c) => {
|
|
8809
|
+
app3.post("/d1/create", nameBodyLimit("d1"), async (c) => {
|
|
8700
8810
|
const account = caller(c);
|
|
8701
8811
|
if (!account) return c.json({ error: "no-caller" }, 403);
|
|
8702
|
-
const
|
|
8812
|
+
const parsed = await readJsonBody(c);
|
|
8813
|
+
if (!parsed.ok) return parsed.res;
|
|
8814
|
+
const { name } = parsed.body;
|
|
8703
8815
|
if (!name || typeof name !== "string") return c.json({ error: "name-required" }, 400);
|
|
8704
8816
|
const session = getSession();
|
|
8705
8817
|
try {
|
|
@@ -8718,10 +8830,12 @@ app3.post("/d1/create", async (c) => {
|
|
|
8718
8830
|
await session.close();
|
|
8719
8831
|
}
|
|
8720
8832
|
});
|
|
8721
|
-
app3.post("/d1/query", async (c) => {
|
|
8833
|
+
app3.post("/d1/query", d1QueryBodyLimit, async (c) => {
|
|
8722
8834
|
const account = caller(c);
|
|
8723
8835
|
if (!account) return c.json({ error: "no-caller" }, 403);
|
|
8724
|
-
const
|
|
8836
|
+
const parsed = await readJsonBody(c);
|
|
8837
|
+
if (!parsed.ok) return parsed.res;
|
|
8838
|
+
const { name, sql } = parsed.body;
|
|
8725
8839
|
if (!name || typeof name !== "string") return c.json({ error: "name-required" }, 400);
|
|
8726
8840
|
if (!sql || typeof sql !== "string") return c.json({ error: "sql-required" }, 400);
|
|
8727
8841
|
const session = getSession();
|
|
@@ -8752,10 +8866,12 @@ app3.get("/r2/list", async (c) => {
|
|
|
8752
8866
|
await session.close();
|
|
8753
8867
|
}
|
|
8754
8868
|
});
|
|
8755
|
-
app3.post("/r2/create", async (c) => {
|
|
8869
|
+
app3.post("/r2/create", nameBodyLimit("r2"), async (c) => {
|
|
8756
8870
|
const account = caller(c);
|
|
8757
8871
|
if (!account) return c.json({ error: "no-caller" }, 403);
|
|
8758
|
-
const
|
|
8872
|
+
const parsed = await readJsonBody(c);
|
|
8873
|
+
if (!parsed.ok) return parsed.res;
|
|
8874
|
+
const { name } = parsed.body;
|
|
8759
8875
|
if (!name || typeof name !== "string") return c.json({ error: "name-required" }, 400);
|
|
8760
8876
|
const session = getSession();
|
|
8761
8877
|
try {
|
|
@@ -8774,9 +8890,178 @@ app3.post("/r2/create", async (c) => {
|
|
|
8774
8890
|
await session.close();
|
|
8775
8891
|
}
|
|
8776
8892
|
});
|
|
8893
|
+
async function objectGate(c, action) {
|
|
8894
|
+
const account = caller(c);
|
|
8895
|
+
if (!account) return { ok: false, res: c.json({ error: "no-caller" }, 403) };
|
|
8896
|
+
let body;
|
|
8897
|
+
try {
|
|
8898
|
+
body = await c.req.json();
|
|
8899
|
+
} catch (err) {
|
|
8900
|
+
if (err instanceof Error && err.name === "BodyLimitError") throw err;
|
|
8901
|
+
return { ok: false, res: c.json({ error: "invalid-json" }, 400) };
|
|
8902
|
+
}
|
|
8903
|
+
const bucket = body.bucket;
|
|
8904
|
+
if (!bucket || typeof bucket !== "string") {
|
|
8905
|
+
return { ok: false, res: c.json({ error: "bucket-required" }, 400) };
|
|
8906
|
+
}
|
|
8907
|
+
const session = getSession();
|
|
8908
|
+
let owner;
|
|
8909
|
+
try {
|
|
8910
|
+
owner = await resolveOwner(session, "r2", bucket);
|
|
8911
|
+
} catch (err) {
|
|
8912
|
+
return { ok: false, res: c.json({ error: String(err) }, 500) };
|
|
8913
|
+
} finally {
|
|
8914
|
+
await session.close();
|
|
8915
|
+
}
|
|
8916
|
+
const decision = authorizeAccess({ caller: account, owner, action });
|
|
8917
|
+
log(action, "r2", account, bucket, owner, decision.allow ? "allow" : "deny");
|
|
8918
|
+
if (!decision.allow) return { ok: false, res: c.json({ error: decision.reason }, 403) };
|
|
8919
|
+
return { ok: true, bucket, body };
|
|
8920
|
+
}
|
|
8921
|
+
function readKey(body) {
|
|
8922
|
+
const key = body.key;
|
|
8923
|
+
return typeof key === "string" && key.length > 0 ? key : null;
|
|
8924
|
+
}
|
|
8925
|
+
function envelopeBodyLimit(action) {
|
|
8926
|
+
return bodyLimit({
|
|
8927
|
+
maxSize: R2_OBJECT_ENVELOPE_MAX_BODY_BYTES,
|
|
8928
|
+
// Names the limit rather than the object: the body is deliberately unparsed
|
|
8929
|
+
// here, which is the whole point of the middleware, so the key is genuinely
|
|
8930
|
+
// unknown — as recorded for put in 1695. Stated in KiB with exact bytes rather
|
|
8931
|
+
// than the MiB the object messages use: 64 KiB renders as "0.1 MiB", which is
|
|
8932
|
+
// less legible, not more. The exact bytes are there for the same reason
|
|
8933
|
+
// tooLargeMessage carries them.
|
|
8934
|
+
//
|
|
8935
|
+
// The {error} body is the routes' convention, which the default's bare text
|
|
8936
|
+
// is not. On the content-length branch no body is read and no handler runs, so
|
|
8937
|
+
// this log line is the only trace the request ever existed.
|
|
8938
|
+
//
|
|
8939
|
+
// reason distinguishes this from put's body-too-large rather than reusing it.
|
|
8940
|
+
// They are different events refusing bodies ~2,100x apart, and put and delete
|
|
8941
|
+
// both log action=write, so a shared slug would make a 140 MB put denial and a
|
|
8942
|
+
// 65 KiB delete denial byte-identical — the same conflation the reason field
|
|
8943
|
+
// exists to prevent for ownership-vs-size.
|
|
8944
|
+
onError: (c) => {
|
|
8945
|
+
log(action, "r2", caller(c) ?? "none", "*", null, "deny", "envelope-too-large");
|
|
8946
|
+
return c.json(
|
|
8947
|
+
{
|
|
8948
|
+
error: `request body exceeds the ${(R2_OBJECT_ENVELOPE_MAX_BODY_BYTES / 1024).toFixed(
|
|
8949
|
+
1
|
|
8950
|
+
)} KiB (${R2_OBJECT_ENVELOPE_MAX_BODY_BYTES} bytes) limit for an R2 object metadata envelope, which carries only a bucket and a key or prefix.`
|
|
8951
|
+
},
|
|
8952
|
+
413
|
|
8953
|
+
);
|
|
8954
|
+
}
|
|
8955
|
+
});
|
|
8956
|
+
}
|
|
8957
|
+
app3.post("/r2/object/list", envelopeBodyLimit("list"), async (c) => {
|
|
8958
|
+
const gate = await objectGate(c, "list");
|
|
8959
|
+
if (!gate.ok) return gate.res;
|
|
8960
|
+
const prefix = gate.body.prefix;
|
|
8961
|
+
if (prefix !== void 0 && typeof prefix !== "string") {
|
|
8962
|
+
return c.json({ error: "prefix-must-be-string" }, 400);
|
|
8963
|
+
}
|
|
8964
|
+
try {
|
|
8965
|
+
const objects = await (await cfExec()).r2ObjectList(gate.bucket, prefix);
|
|
8966
|
+
return c.json({ objects });
|
|
8967
|
+
} catch (err) {
|
|
8968
|
+
return c.json({ error: String(err) }, 500);
|
|
8969
|
+
}
|
|
8970
|
+
});
|
|
8971
|
+
app3.post("/r2/object/get", envelopeBodyLimit("read"), async (c) => {
|
|
8972
|
+
const gate = await objectGate(c, "read");
|
|
8973
|
+
if (!gate.ok) return gate.res;
|
|
8974
|
+
const key = readKey(gate.body);
|
|
8975
|
+
if (!key) return c.json({ error: "key-required" }, 400);
|
|
8976
|
+
try {
|
|
8977
|
+
const cf = await cfExec();
|
|
8978
|
+
const found = await cf.r2ObjectFind(gate.bucket, key);
|
|
8979
|
+
const size = found?.size;
|
|
8980
|
+
if (typeof size !== "number" || !Number.isFinite(size) || size < 0) {
|
|
8981
|
+
log("read", "r2", caller(c) ?? "none", key, caller(c), "deny", "size-unknown");
|
|
8982
|
+
return c.json(
|
|
8983
|
+
{
|
|
8984
|
+
error: `${key} has no recorded size in ${gate.bucket}; refusing to transfer an object that cannot be bounded.`
|
|
8985
|
+
},
|
|
8986
|
+
409
|
|
8987
|
+
);
|
|
8988
|
+
}
|
|
8989
|
+
if (size > R2_OBJECT_MAX_BYTES) {
|
|
8990
|
+
log("read", "r2", caller(c) ?? "none", key, caller(c), "deny", "object-too-large");
|
|
8991
|
+
return c.json({ error: tooLargeMessage(key, size) }, 413);
|
|
8992
|
+
}
|
|
8993
|
+
const bytes = await cf.r2ObjectGet(gate.bucket, key);
|
|
8994
|
+
return c.json({ contentBase64: Buffer.from(bytes).toString("base64") });
|
|
8995
|
+
} catch (err) {
|
|
8996
|
+
return c.json({ error: String(err) }, 500);
|
|
8997
|
+
}
|
|
8998
|
+
});
|
|
8999
|
+
app3.post(
|
|
9000
|
+
"/r2/object/put",
|
|
9001
|
+
// Task 1695 — before the body is buffered, not after. This process runs
|
|
9002
|
+
// house-level and holds the account-wide credential, so an over-cap body
|
|
9003
|
+
// buffered here is an OOM kill of the brand server. The handler cannot do this
|
|
9004
|
+
// itself: objectGate's c.req.json() has already read the whole body by the time
|
|
9005
|
+
// any handler code runs.
|
|
9006
|
+
//
|
|
9007
|
+
// Not redundant with the MCP's statSync check. Every account shares one unix
|
|
9008
|
+
// user and the agent holds Bash, so these routes are reachable by curl with the
|
|
9009
|
+
// MCP nowhere in the path; a cap enforced only there is bypassed by one
|
|
9010
|
+
// command. The MCP check gives the precise, file-naming error; this one is what
|
|
9011
|
+
// actually bounds house memory.
|
|
9012
|
+
bodyLimit({
|
|
9013
|
+
maxSize: R2_OBJECT_PUT_MAX_BODY_BYTES,
|
|
9014
|
+
// The key is unknown here — the body is deliberately unparsed — so this names
|
|
9015
|
+
// the limit rather than the object. The MCP names the file. The limit is
|
|
9016
|
+
// stated in MiB like every other over-cap message, so an operator reading a
|
|
9017
|
+
// route rejection and an MCP rejection can see they are one rule rather than
|
|
9018
|
+
// two unrelated numbers.
|
|
9019
|
+
//
|
|
9020
|
+
// It logs, because a task filed on "the OOM emits nothing" must not ship a
|
|
9021
|
+
// rejection that also emits nothing. On the content-length branch — the shape
|
|
9022
|
+
// every real caller sends — no body is read and no handler runs, so this line
|
|
9023
|
+
// is the only trace the request ever existed.
|
|
9024
|
+
onError: (c) => {
|
|
9025
|
+
log("write", "r2", caller(c) ?? "none", "*", null, "deny", "body-too-large");
|
|
9026
|
+
return c.json(
|
|
9027
|
+
{
|
|
9028
|
+
error: `request body exceeds the ${(R2_OBJECT_PUT_MAX_BODY_BYTES / 1024 / 1024).toFixed(1)} MiB limit for an R2 object put (a base64-encoded ${(R2_OBJECT_MAX_BYTES / 1024 / 1024).toFixed(1)} MiB object plus its envelope).`
|
|
9029
|
+
},
|
|
9030
|
+
413
|
|
9031
|
+
);
|
|
9032
|
+
}
|
|
9033
|
+
}),
|
|
9034
|
+
async (c) => {
|
|
9035
|
+
const gate = await objectGate(c, "write");
|
|
9036
|
+
if (!gate.ok) return gate.res;
|
|
9037
|
+
const key = readKey(gate.body);
|
|
9038
|
+
if (!key) return c.json({ error: "key-required" }, 400);
|
|
9039
|
+
const contentBase64 = gate.body.contentBase64;
|
|
9040
|
+
if (typeof contentBase64 !== "string") return c.json({ error: "contentBase64-required" }, 400);
|
|
9041
|
+
try {
|
|
9042
|
+
const bytes = new Uint8Array(Buffer.from(contentBase64, "base64"));
|
|
9043
|
+
await (await cfExec()).r2ObjectPut(gate.bucket, key, bytes);
|
|
9044
|
+
return c.json({ ok: true });
|
|
9045
|
+
} catch (err) {
|
|
9046
|
+
return c.json({ error: String(err) }, 500);
|
|
9047
|
+
}
|
|
9048
|
+
}
|
|
9049
|
+
);
|
|
9050
|
+
app3.post("/r2/object/delete", envelopeBodyLimit("write"), async (c) => {
|
|
9051
|
+
const gate = await objectGate(c, "write");
|
|
9052
|
+
if (!gate.ok) return gate.res;
|
|
9053
|
+
const key = readKey(gate.body);
|
|
9054
|
+
if (!key) return c.json({ error: "key-required" }, 400);
|
|
9055
|
+
try {
|
|
9056
|
+
await (await cfExec()).r2ObjectDelete(gate.bucket, key);
|
|
9057
|
+
return c.json({ ok: true });
|
|
9058
|
+
} catch (err) {
|
|
9059
|
+
return c.json({ error: String(err) }, 500);
|
|
9060
|
+
}
|
|
9061
|
+
});
|
|
8777
9062
|
var storage_broker_default = app3;
|
|
8778
9063
|
async function runStorageAudit(root) {
|
|
8779
|
-
const { reconcileStorage } = await import("./src-
|
|
9064
|
+
const { reconcileStorage } = await import("./src-4F37OHLK.js");
|
|
8780
9065
|
const session = getSession();
|
|
8781
9066
|
try {
|
|
8782
9067
|
const cf = await makeHouseCfExec(root);
|
|
@@ -9701,6 +9986,78 @@ function pickActivity(entries, grown, nowMs, concurrencyWindowMs) {
|
|
|
9701
9986
|
return { hex: newest.hex, lastEmitAt: newest.mtimeMs, count };
|
|
9702
9987
|
}
|
|
9703
9988
|
|
|
9989
|
+
// server/routes/stream-lifecycle.ts
|
|
9990
|
+
var GAUGE_INTERVAL_MS = 6e4;
|
|
9991
|
+
function isArmed(timer2) {
|
|
9992
|
+
return timer2._destroyed !== true;
|
|
9993
|
+
}
|
|
9994
|
+
var Registration = class {
|
|
9995
|
+
constructor(connId, channel, startedAt) {
|
|
9996
|
+
this.connId = connId;
|
|
9997
|
+
this.channel = channel;
|
|
9998
|
+
this.startedAt = startedAt;
|
|
9999
|
+
}
|
|
10000
|
+
timers = [];
|
|
10001
|
+
closed = false;
|
|
10002
|
+
arm(timer2) {
|
|
10003
|
+
this.timers.push(timer2);
|
|
10004
|
+
return timer2;
|
|
10005
|
+
}
|
|
10006
|
+
teardown(reason) {
|
|
10007
|
+
if (this.closed) return false;
|
|
10008
|
+
this.closed = true;
|
|
10009
|
+
for (const t of this.timers) clearInterval(t);
|
|
10010
|
+
const stillArmed = this.timers.filter(isArmed).length;
|
|
10011
|
+
if (stillArmed > 0) {
|
|
10012
|
+
console.error(
|
|
10013
|
+
`[wa-stream] op=teardown-defect conn=${this.connId} channel=${this.channel} stillArmed=${stillArmed} reason=${reason}`
|
|
10014
|
+
);
|
|
10015
|
+
return true;
|
|
10016
|
+
}
|
|
10017
|
+
registry.delete(this);
|
|
10018
|
+
if (registry.size === 0) emitGauge();
|
|
10019
|
+
return true;
|
|
10020
|
+
}
|
|
10021
|
+
};
|
|
10022
|
+
var registry = /* @__PURE__ */ new Set();
|
|
10023
|
+
var gaugeTimer = null;
|
|
10024
|
+
function emitGauge() {
|
|
10025
|
+
const now = Date.now();
|
|
10026
|
+
const counts = { reader: 0, store: 0 };
|
|
10027
|
+
let oldestMs = 0;
|
|
10028
|
+
let stale = 0;
|
|
10029
|
+
for (const reg of [...registry]) {
|
|
10030
|
+
if (!reg.timers.some(isArmed)) {
|
|
10031
|
+
stale++;
|
|
10032
|
+
registry.delete(reg);
|
|
10033
|
+
continue;
|
|
10034
|
+
}
|
|
10035
|
+
counts[reg.channel]++;
|
|
10036
|
+
oldestMs = Math.max(oldestMs, now - reg.startedAt);
|
|
10037
|
+
}
|
|
10038
|
+
const armed = counts.reader + counts.store;
|
|
10039
|
+
console.log(
|
|
10040
|
+
`[wa-stream] op=gauge armed=${armed} reader=${counts.reader} store=${counts.store} oldestSec=${Math.floor(oldestMs / 1e3)} stale=${stale}`
|
|
10041
|
+
);
|
|
10042
|
+
if (armed === 0) stopGauge();
|
|
10043
|
+
}
|
|
10044
|
+
function startGauge() {
|
|
10045
|
+
if (gaugeTimer) return;
|
|
10046
|
+
gaugeTimer = setInterval(emitGauge, GAUGE_INTERVAL_MS);
|
|
10047
|
+
gaugeTimer.unref();
|
|
10048
|
+
}
|
|
10049
|
+
function stopGauge() {
|
|
10050
|
+
if (!gaugeTimer) return;
|
|
10051
|
+
clearInterval(gaugeTimer);
|
|
10052
|
+
gaugeTimer = null;
|
|
10053
|
+
}
|
|
10054
|
+
function openStream(connId, channel, startedAt) {
|
|
10055
|
+
const reg = new Registration(connId, channel, startedAt);
|
|
10056
|
+
registry.add(reg);
|
|
10057
|
+
startGauge();
|
|
10058
|
+
return reg;
|
|
10059
|
+
}
|
|
10060
|
+
|
|
9704
10061
|
// app/admin-types.ts
|
|
9705
10062
|
var ACCEPT_MIME = "image/jpeg,image/png,image/gif,image/webp,application/pdf,text/plain,text/markdown,text/csv,text/html,text/calendar,application/zip,application/x-zip-compressed,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,text/rtf,application/rtf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-powerpoint,application/vnd.oasis.opendocument.presentation,audio/ogg,audio/opus,audio/mp4,audio/x-m4a,audio/mpeg,audio/webm,audio/wav,video/mp4,.docx,.odt,.rtf,.xlsx,.xls,.ods,.pptx,.ppt,.odp,.opus,.ogg,.m4a,.mp4,.mp3,.wav,.webm";
|
|
9706
10063
|
var SUPPORTED_MIME_SET = new Set(ACCEPT_MIME.split(",").filter((t) => !t.startsWith(".")));
|
|
@@ -10009,6 +10366,8 @@ data: ${JSON.stringify(turn)}
|
|
|
10009
10366
|
const connId = `${sessionId.slice(0, 8)}-${process.hrtime.bigint().toString(36).slice(-6)}`;
|
|
10010
10367
|
const startedAt = Date.now();
|
|
10011
10368
|
const lastEventId = c.req.header("Last-Event-ID");
|
|
10369
|
+
let teardown = () => {
|
|
10370
|
+
};
|
|
10012
10371
|
const readable = new ReadableStream({
|
|
10013
10372
|
start(controller) {
|
|
10014
10373
|
const fileEnd0 = (() => {
|
|
@@ -10093,27 +10452,34 @@ data: ${JSON.stringify(obj)}
|
|
|
10093
10452
|
actx.now = Date.now();
|
|
10094
10453
|
runActivityTick(actx);
|
|
10095
10454
|
};
|
|
10096
|
-
const
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10455
|
+
const lifecycle = openStream(connId, "reader", startedAt);
|
|
10456
|
+
lifecycle.arm(setInterval(tick, 1e3));
|
|
10457
|
+
lifecycle.arm(
|
|
10458
|
+
setInterval(() => {
|
|
10459
|
+
try {
|
|
10460
|
+
controller.enqueue(encoder.encode(": ping\n\n"));
|
|
10461
|
+
console.log(`[wa-stream] op=heartbeat conn=${connId}`);
|
|
10462
|
+
} catch {
|
|
10463
|
+
teardown("heartbeat-dead-controller");
|
|
10464
|
+
}
|
|
10465
|
+
}, 2e4)
|
|
10466
|
+
);
|
|
10467
|
+
teardown = (reason) => {
|
|
10468
|
+
if (!lifecycle.teardown(reason)) return;
|
|
10105
10469
|
watcher?.close();
|
|
10106
|
-
clearInterval(poll);
|
|
10107
|
-
clearInterval(heartbeat);
|
|
10108
10470
|
if (actx.emittedHex !== null) {
|
|
10109
10471
|
console.log(`[webchat-activity] op=clear key=${sessionKey} reason=stream-close`);
|
|
10110
10472
|
}
|
|
10111
|
-
console.log(`[wa-stream] op=close conn=${connId} ranMs=${Date.now() - startedAt} reason
|
|
10473
|
+
console.log(`[wa-stream] op=close conn=${connId} ranMs=${Date.now() - startedAt} reason=${reason}`);
|
|
10112
10474
|
try {
|
|
10113
10475
|
controller.close();
|
|
10114
10476
|
} catch {
|
|
10115
10477
|
}
|
|
10116
|
-
}
|
|
10478
|
+
};
|
|
10479
|
+
c.req.raw.signal.addEventListener("abort", () => teardown("client-abort"));
|
|
10480
|
+
},
|
|
10481
|
+
cancel() {
|
|
10482
|
+
teardown("client-cancel");
|
|
10117
10483
|
}
|
|
10118
10484
|
});
|
|
10119
10485
|
return new Response(readable, {
|
|
@@ -10221,6 +10587,8 @@ app5.get("/store-stream", requireAdminSession, (c) => {
|
|
|
10221
10587
|
}
|
|
10222
10588
|
return turn;
|
|
10223
10589
|
};
|
|
10590
|
+
let teardown = () => {
|
|
10591
|
+
};
|
|
10224
10592
|
const readable = new ReadableStream({
|
|
10225
10593
|
start(controller) {
|
|
10226
10594
|
const send = (turn, id) => {
|
|
@@ -10318,23 +10686,30 @@ data: ${JSON.stringify(payload)}
|
|
|
10318
10686
|
watcher = watch(file, drain);
|
|
10319
10687
|
} catch {
|
|
10320
10688
|
}
|
|
10321
|
-
const
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10689
|
+
const lifecycle = openStream(connId, "store", startedAt);
|
|
10690
|
+
lifecycle.arm(setInterval(drain, 1e3));
|
|
10691
|
+
lifecycle.arm(
|
|
10692
|
+
setInterval(() => {
|
|
10693
|
+
try {
|
|
10694
|
+
controller.enqueue(encoder.encode(": ping\n\n"));
|
|
10695
|
+
} catch {
|
|
10696
|
+
teardown("heartbeat-dead-controller");
|
|
10697
|
+
}
|
|
10698
|
+
}, 2e4)
|
|
10699
|
+
);
|
|
10700
|
+
teardown = (reason) => {
|
|
10701
|
+
if (!lifecycle.teardown(reason)) return;
|
|
10329
10702
|
watcher?.close();
|
|
10330
|
-
|
|
10331
|
-
clearInterval(heartbeat);
|
|
10332
|
-
console.log(`[wa-reader] op=store-close conn=${connId} ranMs=${Date.now() - startedAt}`);
|
|
10703
|
+
console.log(`[wa-reader] op=store-close conn=${connId} ranMs=${Date.now() - startedAt} reason=${reason}`);
|
|
10333
10704
|
try {
|
|
10334
10705
|
controller.close();
|
|
10335
10706
|
} catch {
|
|
10336
10707
|
}
|
|
10337
|
-
}
|
|
10708
|
+
};
|
|
10709
|
+
c.req.raw.signal.addEventListener("abort", () => teardown("client-abort"));
|
|
10710
|
+
},
|
|
10711
|
+
cancel() {
|
|
10712
|
+
teardown("client-cancel");
|
|
10338
10713
|
}
|
|
10339
10714
|
});
|
|
10340
10715
|
return new Response(readable, {
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
+
D1_MAX_SQL_STATEMENT_BYTES,
|
|
4
|
+
D1_QUERY_MAX_BODY_BYTES,
|
|
5
|
+
JSON_STRING_WORST_CASE_EXPANSION,
|
|
6
|
+
R2_OBJECT_ENVELOPE_MAX_BODY_BYTES,
|
|
7
|
+
R2_OBJECT_MAX_BYTES,
|
|
8
|
+
R2_OBJECT_PUT_MAX_BODY_BYTES,
|
|
9
|
+
STORAGE_RESOURCE_NAME_MAX_BODY_BYTES,
|
|
3
10
|
authorizeAccess,
|
|
11
|
+
base64Ceiling,
|
|
4
12
|
listResources,
|
|
5
13
|
makeCfExec,
|
|
6
14
|
makeHouseCfExec,
|
|
@@ -10,11 +18,20 @@ import {
|
|
|
10
18
|
resolveHouseScopedToken,
|
|
11
19
|
resolveOwner,
|
|
12
20
|
stripAccountWideTokens,
|
|
21
|
+
tooLargeMessage,
|
|
13
22
|
validateMapping
|
|
14
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-JXWFVE5X.js";
|
|
15
24
|
import "./chunk-PFF6I7KP.js";
|
|
16
25
|
export {
|
|
26
|
+
D1_MAX_SQL_STATEMENT_BYTES,
|
|
27
|
+
D1_QUERY_MAX_BODY_BYTES,
|
|
28
|
+
JSON_STRING_WORST_CASE_EXPANSION,
|
|
29
|
+
R2_OBJECT_ENVELOPE_MAX_BODY_BYTES,
|
|
30
|
+
R2_OBJECT_MAX_BYTES,
|
|
31
|
+
R2_OBJECT_PUT_MAX_BODY_BYTES,
|
|
32
|
+
STORAGE_RESOURCE_NAME_MAX_BODY_BYTES,
|
|
17
33
|
authorizeAccess,
|
|
34
|
+
base64Ceiling,
|
|
18
35
|
listResources,
|
|
19
36
|
makeCfExec,
|
|
20
37
|
makeHouseCfExec,
|
|
@@ -24,5 +41,6 @@ export {
|
|
|
24
41
|
resolveHouseScopedToken,
|
|
25
42
|
resolveOwner,
|
|
26
43
|
stripAccountWideTokens,
|
|
44
|
+
tooLargeMessage,
|
|
27
45
|
validateMapping
|
|
28
46
|
};
|