@pithy-sh/support 0.1.3 → 0.1.5
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/dist/ai/classify.d.ts +2 -0
- package/dist/ai/classify.js +2 -0
- package/dist/attachment/store.d.ts +2 -0
- package/dist/attachment/store.js +2 -0
- package/dist/audit/actions.d.ts +2 -0
- package/dist/audit/actions.js +2 -0
- package/dist/capability.d.ts +2 -0
- package/dist/capability.js +2 -0
- package/dist/client/projection.d.ts +2 -0
- package/dist/client/projection.js +2 -0
- package/dist/config/config.d.ts +2 -0
- package/dist/config/config.js +2 -0
- package/dist/data/attachment.d.ts +2 -0
- package/dist/data/attachment.js +2 -0
- package/dist/data/billingScope.d.ts +2 -0
- package/dist/data/billingScope.js +2 -0
- package/dist/data/categories.d.ts +2 -0
- package/dist/data/categories.js +2 -0
- package/dist/data/classification.d.ts +2 -0
- package/dist/data/classification.js +2 -0
- package/dist/data/enums.d.ts +2 -0
- package/dist/data/enums.js +2 -0
- package/dist/data/flag.d.ts +2 -0
- package/dist/data/flag.js +2 -0
- package/dist/data/message.d.ts +2 -0
- package/dist/data/message.js +2 -0
- package/dist/data/tables.d.ts +2 -0
- package/dist/data/tables.js +2 -0
- package/dist/data/thread.d.ts +2 -0
- package/dist/data/thread.js +2 -0
- package/dist/error/errors.d.ts +2 -0
- package/dist/error/errors.js +2 -0
- package/dist/http/guards.d.ts +2 -0
- package/dist/http/guards.js +2 -0
- package/dist/http/handlers.d.ts +2 -0
- package/dist/http/handlers.js +2 -0
- package/dist/http/resolve.d.ts +2 -0
- package/dist/http/resolve.js +2 -0
- package/dist/http/responses.d.ts +2 -0
- package/dist/http/responses.js +2 -0
- package/dist/http/routes.d.ts +2 -0
- package/dist/http/routes.js +2 -0
- package/dist/http/schemas.d.ts +2 -0
- package/dist/http/schemas.js +2 -0
- package/dist/http/scopes.d.ts +2 -0
- package/dist/http/scopes.js +2 -0
- package/dist/http/views.d.ts +2 -0
- package/dist/http/views.js +2 -0
- package/dist/inbound/authenticity.d.ts +2 -0
- package/dist/inbound/authenticity.js +2 -0
- package/dist/inbound/guard.d.ts +2 -0
- package/dist/inbound/guard.js +2 -0
- package/dist/inbound/handler.d.ts +2 -0
- package/dist/inbound/handler.js +2 -0
- package/dist/inbound/ingest.d.ts +2 -0
- package/dist/inbound/ingest.js +2 -0
- package/dist/inbound/recipient.d.ts +2 -0
- package/dist/inbound/recipient.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/link/sender.d.ts +2 -0
- package/dist/link/sender.js +2 -0
- package/dist/migrations/0001_threads.d.ts +2 -0
- package/dist/migrations/0001_threads.js +2 -0
- package/dist/mime/address.d.ts +2 -0
- package/dist/mime/address.js +2 -0
- package/dist/mime/parse.d.ts +2 -0
- package/dist/mime/parse.js +2 -0
- package/dist/mime/sanitize.d.ts +2 -0
- package/dist/mime/sanitize.js +2 -0
- package/dist/mime/threading.d.ts +2 -0
- package/dist/mime/threading.js +2 -0
- package/dist/mime/truncate.d.ts +2 -0
- package/dist/mime/truncate.js +2 -0
- package/dist/provision/provisionSupport.d.ts +2 -0
- package/dist/provision/provisionSupport.js +2 -0
- package/dist/provision/resolveSupportConfig.d.ts +2 -0
- package/dist/provision/resolveSupportConfig.js +2 -0
- package/dist/reply/send.d.ts +2 -0
- package/dist/reply/send.js +2 -0
- package/dist/reply/snippets.d.ts +2 -0
- package/dist/reply/snippets.js +2 -0
- package/dist/secret/registry.d.ts +2 -0
- package/dist/secret/registry.js +2 -0
- package/dist/seeds/example.d.ts +2 -0
- package/dist/seeds/example.js +2 -0
- package/dist/store/paging.d.ts +2 -0
- package/dist/store/paging.js +2 -0
- package/dist/store/search.d.ts +2 -0
- package/dist/store/search.js +2 -0
- package/dist/store/searchIndex.d.ts +2 -0
- package/dist/store/searchIndex.js +2 -0
- package/dist/store/threads.d.ts +2 -0
- package/dist/store/threads.js +2 -0
- package/dist/submission/encoding.d.ts +3 -1
- package/dist/submission/encoding.js +3 -1
- package/dist/submission/guard.d.ts +2 -0
- package/dist/submission/guard.js +2 -0
- package/dist/submission/submit.d.ts +3 -1
- package/dist/submission/submit.js +2 -0
- package/dist/version.generated.d.ts +3 -1
- package/dist/version.generated.js +3 -1
- package/dist/workflows/classify.d.ts +2 -0
- package/dist/workflows/classify.js +2 -0
- package/dist/workflows/retryPolicy.d.ts +2 -0
- package/dist/workflows/retryPolicy.js +2 -0
- package/dist/workflows/specs.d.ts +2 -0
- package/dist/workflows/specs.js +2 -0
- package/dist/workflows/worker.d.ts +2 -0
- package/dist/workflows/worker.js +2 -0
- package/package.json +8 -8
- package/src/http/handlers.ts +1 -1
- package/src/submission/encoding.ts +1 -1
- package/src/submission/submit.ts +1 -1
- package/src/version.generated.ts +1 -1
package/dist/ai/classify.d.ts
CHANGED
package/dist/ai/classify.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import { SupportClassificationError } from "../error/errors.js";
|
|
2
4
|
import { SupportPriority, SupportSentiment, UNCATEGORIZED } from "../data/enums.js";
|
|
3
5
|
import { categoryEnum, describeCategories } from "../data/categories.js";
|
package/dist/attachment/store.js
CHANGED
package/dist/audit/actions.d.ts
CHANGED
package/dist/audit/actions.js
CHANGED
package/dist/capability.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import type { AuditEmit } from "@pithy-sh/core/src/audit/recorder";
|
|
2
4
|
import { type Capability } from "@pithy-sh/core/src/capability/capability";
|
|
3
5
|
import type { DatabaseSpecMap } from "@pithy-sh/core/src/data/databases";
|
package/dist/capability.js
CHANGED
package/dist/config/config.d.ts
CHANGED
package/dist/config/config.js
CHANGED
package/dist/data/attachment.js
CHANGED
package/dist/data/categories.js
CHANGED
package/dist/data/enums.d.ts
CHANGED
package/dist/data/enums.js
CHANGED
package/dist/data/flag.d.ts
CHANGED
package/dist/data/flag.js
CHANGED
package/dist/data/message.d.ts
CHANGED
package/dist/data/message.js
CHANGED
package/dist/data/tables.d.ts
CHANGED
package/dist/data/tables.js
CHANGED
package/dist/data/thread.d.ts
CHANGED
package/dist/data/thread.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import { SupportAccountLinkSource, SupportChannel, SupportPriority, SupportSentiment, UNCATEGORIZED } from "./enums.js";
|
|
2
4
|
import { z } from "zod";
|
|
3
5
|
import { SQLiteBoolean, SQLiteDate } from "@pithy-sh/core/src/data/codecs";
|
package/dist/error/errors.d.ts
CHANGED
package/dist/error/errors.js
CHANGED
package/dist/http/guards.d.ts
CHANGED
package/dist/http/guards.js
CHANGED
package/dist/http/handlers.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import type { D1Database, R2Bucket } from "@cloudflare/workers-types";
|
|
2
4
|
import type { AuditEmit } from "@pithy-sh/core/src/audit/recorder";
|
|
3
5
|
import type { Logger } from "@pithy-sh/core/src/logger/logger";
|
package/dist/http/handlers.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import { SupportClassificationError, SupportNotFoundError } from "../error/errors.js";
|
|
2
4
|
import { repliesForCategory } from "../reply/snippets.js";
|
|
3
5
|
import { attachmentUrl } from "../attachment/store.js";
|
package/dist/http/resolve.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import type { D1Database, R2Bucket } from "@cloudflare/workers-types";
|
|
2
4
|
import type { PithyHonoEnv } from "@pithy-sh/core/src/capability/capability";
|
|
3
5
|
import type { Logger } from "@pithy-sh/core/src/logger/logger";
|
package/dist/http/resolve.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import { supportDatabase } from "../data/tables.js";
|
|
2
4
|
import { SUPPORT_R2_SECRET } from "../secret/registry.js";
|
|
3
5
|
import { supportWorkflowRegistry, supportWorkflows } from "../workflows/specs.js";
|
package/dist/http/responses.d.ts
CHANGED
package/dist/http/responses.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import { SupportAccountLinkSource, SupportChannel, SupportMessageDirection, SupportPriority, SupportSentiment } from "../data/enums.js";
|
|
2
4
|
import { SupportSubmissionContext } from "../data/message.js";
|
|
3
5
|
import { SUPPORT_BILLING_SCOPE } from "../data/billingScope.js";
|
package/dist/http/routes.d.ts
CHANGED
package/dist/http/routes.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import { requireAuth } from "./guards.js";
|
|
2
4
|
import { archiveConversation, listInbox, listMyThreads, listReplies, readConversation, readMyThread, reclassifyConversation, replyToConversation, submitFeedbackRequest, updateFlags } from "./handlers.js";
|
|
3
5
|
import { ArchiveThreadInput, FlagsInput, ListThreadsQuery, MyThreadsQuery, RepliesQuery, ReplyInput, SubmitFeedbackInput, ThreadIdParam } from "./schemas.js";
|
package/dist/http/schemas.d.ts
CHANGED
package/dist/http/schemas.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import { MAX_SUBMISSION_BODY_CHARS } from "../config/config.js";
|
|
2
4
|
import { SupportChannel, SupportPriority, SupportSentiment } from "../data/enums.js";
|
|
3
5
|
import { SupportSubmissionContext } from "../data/message.js";
|
package/dist/http/scopes.d.ts
CHANGED
package/dist/http/scopes.js
CHANGED
package/dist/http/views.d.ts
CHANGED
package/dist/http/views.js
CHANGED
package/dist/inbound/guard.d.ts
CHANGED
package/dist/inbound/guard.js
CHANGED
package/dist/inbound/handler.js
CHANGED
package/dist/inbound/ingest.d.ts
CHANGED
package/dist/inbound/ingest.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
/**
|
|
2
4
|
* The package entrypoint — the surface `pithy add support` wires into `pithy.config.ts`. Deliberately
|
|
3
5
|
* narrow: the capability factory, its config and options types, the two federation helpers an adopter
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import { DEFAULT_SUPPORT_REPLIES, SupportReplySnippet, defineSupportReplies } from "./reply/snippets.js";
|
|
2
4
|
import { DEFAULT_CLASSIFY_MODEL, SupportAiConfig, SupportAttachmentsConfig, SupportConfig, SupportGuardConfig, SupportReplyConfig, SupportSearchConfig } from "./config/config.js";
|
|
3
5
|
import { SupportMessageDirection, SupportPriority, SupportSentiment, UNCATEGORIZED } from "./data/enums.js";
|
package/dist/link/sender.d.ts
CHANGED
package/dist/link/sender.js
CHANGED
package/dist/mime/address.d.ts
CHANGED
package/dist/mime/address.js
CHANGED
package/dist/mime/parse.d.ts
CHANGED
package/dist/mime/parse.js
CHANGED
package/dist/mime/sanitize.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
/** The largest sanitized body kept, **in bytes**. A dashboard rendering 5 MB of markup has already lost. */
|
|
2
4
|
export declare const MAX_HTML_BYTES: number;
|
|
3
5
|
/** Whether an `href` value is safe to keep. Relative URLs are fine; a bare scheme we do not know is not. */
|
package/dist/mime/sanitize.js
CHANGED
package/dist/mime/threading.d.ts
CHANGED
package/dist/mime/threading.js
CHANGED
package/dist/mime/truncate.d.ts
CHANGED
package/dist/mime/truncate.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import { SUPPORT_CAPABILITY } from "../workflows/specs.js";
|
|
2
4
|
import { GLOBAL_SCOPE } from "@pithy-sh/core/src/naming/environment";
|
|
3
5
|
import { resourceName } from "@pithy-sh/core/src/naming/resource";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import { type WorkflowHostTemplate } from "@pithy-sh/core/src/workflow/host";
|
|
2
4
|
import type { ManagedEnvironment } from "@pithy-sh/secrets/src/scope";
|
|
3
5
|
import type { SupportConfig } from "../config/config";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import { SUPPORT_CAPABILITY, supportWorkflowRegistry } from "../workflows/specs.js";
|
|
2
4
|
import { hostWorkflowsFor, resolveWorkflowHost } from "@pithy-sh/core/src/workflow/host";
|
|
3
5
|
//#region src/provision/resolveSupportConfig.ts
|
package/dist/reply/send.d.ts
CHANGED
package/dist/reply/send.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import { SupportNotFoundError, SupportReplyFailedError } from "../error/errors.js";
|
|
2
4
|
import { SupportMessage } from "../data/message.js";
|
|
3
5
|
import { SUPPORT_MESSAGES_TABLE, SUPPORT_THREADS_TABLE } from "../data/tables.js";
|
package/dist/reply/snippets.d.ts
CHANGED
package/dist/reply/snippets.js
CHANGED
package/dist/secret/registry.js
CHANGED
package/dist/seeds/example.d.ts
CHANGED
package/dist/seeds/example.js
CHANGED
package/dist/store/paging.d.ts
CHANGED
package/dist/store/paging.js
CHANGED
package/dist/store/search.d.ts
CHANGED
package/dist/store/search.js
CHANGED
package/dist/store/threads.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import type { Logger } from "@pithy-sh/core/src/logger/logger";
|
|
2
4
|
import { SupportAttachment } from "../data/attachment";
|
|
3
5
|
import type { SupportChannel, SupportPriority, SupportSentiment } from "../data/enums";
|
package/dist/store/threads.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
/**
|
|
2
4
|
* The largest base64 string worth decoding, derived from a decoded-byte bound.
|
|
3
5
|
*
|
|
4
|
-
* Checked **before** decoding, not after. `atob`
|
|
6
|
+
* Checked **before** decoding, not after. `atob` materializes the whole result, so a client that sends
|
|
5
7
|
* fifty megabytes of base64 has already been allocated fifty megabytes of Worker memory by the time a
|
|
6
8
|
* post-hoc size check could refuse it — and the request that does that is the one an attacker sends.
|
|
7
9
|
* A little slack for padding and any whitespace a client's encoder inserted.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import { ValidationError } from "@pithy-sh/core/src/error/pithyError";
|
|
2
4
|
//#region src/submission/encoding.ts
|
|
3
5
|
/**
|
|
@@ -14,7 +16,7 @@ const BASE64_EXPANSION = 4 / 3;
|
|
|
14
16
|
/**
|
|
15
17
|
* The largest base64 string worth decoding, derived from a decoded-byte bound.
|
|
16
18
|
*
|
|
17
|
-
* Checked **before** decoding, not after. `atob`
|
|
19
|
+
* Checked **before** decoding, not after. `atob` materializes the whole result, so a client that sends
|
|
18
20
|
* fifty megabytes of base64 has already been allocated fifty megabytes of Worker memory by the time a
|
|
19
21
|
* post-hoc size check could refuse it — and the request that does that is the one an attacker sends.
|
|
20
22
|
* A little slack for padding and any whitespace a client's encoder inserted.
|
package/dist/submission/guard.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import type { R2Bucket } from "@cloudflare/workers-types";
|
|
2
4
|
import type { AuditEmit } from "@pithy-sh/core/src/audit/recorder";
|
|
3
5
|
import type { Logger } from "@pithy-sh/core/src/logger/logger";
|
|
@@ -31,7 +33,7 @@ import { type SupportDatabase } from "../data/tables";
|
|
|
31
33
|
* The mail path's rule, applied to a different shape: **refuse on the cheapest true reason first.**
|
|
32
34
|
* The two shape bounds a client controls the cost of — how many files, and how large each encoded one
|
|
33
35
|
* is — are applied at the transport boundary in `http/handlers.ts` *before* anything is decoded,
|
|
34
|
-
* because `atob`
|
|
36
|
+
* because `atob` materializes its whole result and a size check after it has already been handed the
|
|
35
37
|
* allocation it meant to refuse. What is left arrives here as bytes:
|
|
36
38
|
*
|
|
37
39
|
* 0. **The declared category**, which needs no I/O at all — it is a comparison against a taxonomy this
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import { SupportInvalidCategoryError, SupportNotFoundError, SupportRejectedError } from "../error/errors.js";
|
|
2
4
|
import { categoryEnum } from "../data/categories.js";
|
|
3
5
|
import { SupportAttachment } from "../data/attachment.js";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
/** This package's npm name — the join key against a release feed. */
|
|
2
4
|
export declare const PACKAGE_NAME = "@pithy-sh/support";
|
|
3
5
|
/** This package's version, stamped from its own package.json at generation time. */
|
|
4
|
-
export declare const PACKAGE_VERSION = "0.1.
|
|
6
|
+
export declare const PACKAGE_VERSION = "0.1.5";
|
|
5
7
|
//# sourceMappingURL=version.generated.d.ts.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
//#region src/version.generated.ts
|
|
2
4
|
/** This package's npm name — the join key against a release feed. */
|
|
3
5
|
const PACKAGE_NAME = "@pithy-sh/support";
|
|
4
6
|
/** This package's version, stamped from its own package.json at generation time. */
|
|
5
|
-
const PACKAGE_VERSION = "0.1.
|
|
7
|
+
const PACKAGE_VERSION = "0.1.5";
|
|
6
8
|
//#endregion
|
|
7
9
|
export { PACKAGE_NAME, PACKAGE_VERSION };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import "../data/enums.js";
|
|
2
4
|
import { SupportClassification } from "../data/classification.js";
|
|
3
5
|
import { SUPPORT_CLASSIFICATIONS_TABLE, SUPPORT_MESSAGES_TABLE, SUPPORT_THREADS_TABLE } from "../data/tables.js";
|
package/dist/workflows/specs.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
1
3
|
import { WorkflowEntrypoint, type WorkflowEvent, type WorkflowStep } from "cloudflare:workers";
|
|
2
4
|
import type { D1Database } from "@cloudflare/workers-types";
|
|
3
5
|
import type { SupportAi } from "../ai/classify";
|
package/dist/workflows/worker.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pithy-sh/support",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
|
-
"build": "tsdown && tsc -p tsconfig.build.json",
|
|
28
|
+
"build": "tsdown && tsc -p tsconfig.build.json && bun ../../tooling/build/src/stampDeclarations.ts",
|
|
29
29
|
"typecheck": "tsc -p tsconfig.json",
|
|
30
30
|
"test": "vitest run",
|
|
31
31
|
"test:node": "vitest run --project=node",
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@cloudflare/workers-types": "^5.20260729.1",
|
|
38
38
|
"@hono/zod-validator": "^0.9.0",
|
|
39
|
-
"@pithy-sh/core": "^0.
|
|
40
|
-
"@pithy-sh/email": "^0.1.
|
|
41
|
-
"@pithy-sh/secrets": "^0.1.
|
|
42
|
-
"@pithy-sh/storage": "^0.1.
|
|
39
|
+
"@pithy-sh/core": "^0.2.0",
|
|
40
|
+
"@pithy-sh/email": "^0.1.5",
|
|
41
|
+
"@pithy-sh/secrets": "^0.1.5",
|
|
42
|
+
"@pithy-sh/storage": "^0.1.5",
|
|
43
43
|
"postal-mime": "^3.0.0",
|
|
44
44
|
"tldts": "^7.4.10"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@pithy-sh/auth": "^0.1.
|
|
48
|
-
"@pithy-sh/payments": "^0.
|
|
47
|
+
"@pithy-sh/auth": "^0.1.5",
|
|
48
|
+
"@pithy-sh/payments": "^0.2.0",
|
|
49
49
|
"hono": "^4.13.2",
|
|
50
50
|
"kysely": "^0.29.0",
|
|
51
51
|
"zod": "^4.4.0"
|
package/src/http/handlers.ts
CHANGED
|
@@ -359,7 +359,7 @@ export async function submitFeedbackRequest(
|
|
|
359
359
|
context: input.context,
|
|
360
360
|
// Decoded here, at the transport boundary, so `submitFeedback` takes bytes and stays testable
|
|
361
361
|
// without a request — the same split `ingest.ts` has from the `email()` handler. The decode is
|
|
362
|
-
// bounded before it allocates: `atob`
|
|
362
|
+
// bounded before it allocates: `atob` materializes the whole result, so a size check afterwards
|
|
363
363
|
// has already paid for the attack it was meant to refuse.
|
|
364
364
|
attachments: input.attachments.map((attachment) => ({
|
|
365
365
|
filename: attachment.filename,
|
|
@@ -19,7 +19,7 @@ const BASE64_EXPANSION = 4 / 3;
|
|
|
19
19
|
/**
|
|
20
20
|
* The largest base64 string worth decoding, derived from a decoded-byte bound.
|
|
21
21
|
*
|
|
22
|
-
* Checked **before** decoding, not after. `atob`
|
|
22
|
+
* Checked **before** decoding, not after. `atob` materializes the whole result, so a client that sends
|
|
23
23
|
* fifty megabytes of base64 has already been allocated fifty megabytes of Worker memory by the time a
|
|
24
24
|
* post-hoc size check could refuse it — and the request that does that is the one an attacker sends.
|
|
25
25
|
* A little slack for padding and any whitespace a client's encoder inserted.
|
package/src/submission/submit.ts
CHANGED
|
@@ -50,7 +50,7 @@ import { checkAccountRate, checkAttachment } from "./guard";
|
|
|
50
50
|
* The mail path's rule, applied to a different shape: **refuse on the cheapest true reason first.**
|
|
51
51
|
* The two shape bounds a client controls the cost of — how many files, and how large each encoded one
|
|
52
52
|
* is — are applied at the transport boundary in `http/handlers.ts` *before* anything is decoded,
|
|
53
|
-
* because `atob`
|
|
53
|
+
* because `atob` materializes its whole result and a size check after it has already been handed the
|
|
54
54
|
* allocation it meant to refuse. What is left arrives here as bytes:
|
|
55
55
|
*
|
|
56
56
|
* 0. **The declared category**, which needs no I/O at all — it is a comparison against a taxonomy this
|
package/src/version.generated.ts
CHANGED