@pithy-sh/support 0.1.2 → 0.1.3

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.
Files changed (167) hide show
  1. package/dist/ai/classify.d.ts +90 -0
  2. package/dist/ai/classify.d.ts.map +1 -0
  3. package/dist/ai/classify.js +151 -0
  4. package/dist/attachment/store.d.ts +53 -0
  5. package/dist/attachment/store.d.ts.map +1 -0
  6. package/dist/attachment/store.js +67 -0
  7. package/dist/audit/actions.d.ts +68 -0
  8. package/dist/audit/actions.d.ts.map +1 -0
  9. package/dist/audit/actions.js +68 -0
  10. package/dist/capability.d.ts +93 -0
  11. package/dist/capability.d.ts.map +1 -0
  12. package/dist/capability.js +187 -0
  13. package/dist/client/projection.d.ts +56 -0
  14. package/dist/client/projection.d.ts.map +1 -0
  15. package/dist/client/projection.js +0 -0
  16. package/dist/config/config.d.ts +215 -0
  17. package/dist/config/config.d.ts.map +1 -0
  18. package/dist/config/config.js +169 -0
  19. package/dist/data/attachment.d.ts +30 -0
  20. package/dist/data/attachment.d.ts.map +1 -0
  21. package/dist/data/attachment.js +32 -0
  22. package/dist/data/billingScope.d.ts +30 -0
  23. package/dist/data/billingScope.d.ts.map +1 -0
  24. package/dist/data/billingScope.js +32 -0
  25. package/dist/data/categories.d.ts +54 -0
  26. package/dist/data/categories.d.ts.map +1 -0
  27. package/dist/data/categories.js +97 -0
  28. package/dist/data/classification.d.ts +34 -0
  29. package/dist/data/classification.d.ts.map +1 -0
  30. package/dist/data/classification.js +28 -0
  31. package/dist/data/enums.d.ts +82 -0
  32. package/dist/data/enums.d.ts.map +1 -0
  33. package/dist/data/enums.js +70 -0
  34. package/dist/data/flag.d.ts +25 -0
  35. package/dist/data/flag.d.ts.map +1 -0
  36. package/dist/data/flag.js +27 -0
  37. package/dist/data/message.d.ts +81 -0
  38. package/dist/data/message.d.ts.map +1 -0
  39. package/dist/data/message.js +84 -0
  40. package/dist/data/tables.d.ts +160 -0
  41. package/dist/data/tables.d.ts.map +1 -0
  42. package/dist/data/tables.js +44 -0
  43. package/dist/data/thread.d.ts +77 -0
  44. package/dist/data/thread.d.ts.map +1 -0
  45. package/dist/data/thread.js +65 -0
  46. package/dist/error/errors.d.ts +64 -0
  47. package/dist/error/errors.d.ts.map +1 -0
  48. package/dist/error/errors.js +82 -0
  49. package/dist/http/guards.d.ts +44 -0
  50. package/dist/http/guards.d.ts.map +1 -0
  51. package/dist/http/guards.js +53 -0
  52. package/dist/http/handlers.d.ts +89 -0
  53. package/dist/http/handlers.d.ts.map +1 -0
  54. package/dist/http/handlers.js +248 -0
  55. package/dist/http/resolve.d.ts +44 -0
  56. package/dist/http/resolve.d.ts.map +1 -0
  57. package/dist/http/resolve.js +72 -0
  58. package/dist/http/responses.d.ts +829 -0
  59. package/dist/http/responses.d.ts.map +1 -0
  60. package/dist/http/responses.js +303 -0
  61. package/dist/http/routes.d.ts +109 -0
  62. package/dist/http/routes.d.ts.map +1 -0
  63. package/dist/http/routes.js +62 -0
  64. package/dist/http/schemas.d.ts +121 -0
  65. package/dist/http/schemas.d.ts.map +1 -0
  66. package/dist/http/schemas.js +89 -0
  67. package/dist/http/scopes.d.ts +56 -0
  68. package/dist/http/scopes.d.ts.map +1 -0
  69. package/dist/http/scopes.js +107 -0
  70. package/dist/http/views.d.ts +36 -0
  71. package/dist/http/views.d.ts.map +1 -0
  72. package/dist/http/views.js +144 -0
  73. package/dist/inbound/authenticity.d.ts +81 -0
  74. package/dist/inbound/authenticity.d.ts.map +1 -0
  75. package/dist/inbound/authenticity.js +61 -0
  76. package/dist/inbound/guard.d.ts +74 -0
  77. package/dist/inbound/guard.d.ts.map +1 -0
  78. package/dist/inbound/guard.js +78 -0
  79. package/dist/inbound/handler.d.ts +28 -0
  80. package/dist/inbound/handler.d.ts.map +1 -0
  81. package/dist/inbound/handler.js +82 -0
  82. package/dist/inbound/ingest.d.ts +104 -0
  83. package/dist/inbound/ingest.d.ts.map +1 -0
  84. package/dist/inbound/ingest.js +326 -0
  85. package/dist/inbound/recipient.d.ts +16 -0
  86. package/dist/inbound/recipient.d.ts.map +1 -0
  87. package/dist/inbound/recipient.js +46 -0
  88. package/dist/index.d.ts +20 -0
  89. package/dist/index.d.ts.map +1 -0
  90. package/dist/index.js +14 -0
  91. package/dist/link/sender.d.ts +160 -0
  92. package/dist/link/sender.d.ts.map +1 -0
  93. package/dist/link/sender.js +200 -0
  94. package/dist/migrations/0001_threads.d.ts +26 -0
  95. package/dist/migrations/0001_threads.d.ts.map +1 -0
  96. package/dist/migrations/0001_threads.js +103 -0
  97. package/dist/mime/address.d.ts +22 -0
  98. package/dist/mime/address.d.ts.map +1 -0
  99. package/dist/mime/address.js +28 -0
  100. package/dist/mime/parse.d.ts +96 -0
  101. package/dist/mime/parse.d.ts.map +1 -0
  102. package/dist/mime/parse.js +146 -0
  103. package/dist/mime/sanitize.d.ts +25 -0
  104. package/dist/mime/sanitize.d.ts.map +1 -0
  105. package/dist/mime/sanitize.js +212 -0
  106. package/dist/mime/threading.d.ts +79 -0
  107. package/dist/mime/threading.d.ts.map +1 -0
  108. package/dist/mime/threading.js +111 -0
  109. package/dist/mime/truncate.d.ts +17 -0
  110. package/dist/mime/truncate.d.ts.map +1 -0
  111. package/dist/mime/truncate.js +47 -0
  112. package/dist/provision/provisionSupport.d.ts +158 -0
  113. package/dist/provision/provisionSupport.d.ts.map +1 -0
  114. package/dist/provision/provisionSupport.js +110 -0
  115. package/dist/provision/resolveSupportConfig.d.ts +45 -0
  116. package/dist/provision/resolveSupportConfig.d.ts.map +1 -0
  117. package/dist/provision/resolveSupportConfig.js +22 -0
  118. package/dist/reply/send.d.ts +123 -0
  119. package/dist/reply/send.d.ts.map +1 -0
  120. package/dist/reply/send.js +153 -0
  121. package/dist/reply/snippets.d.ts +79 -0
  122. package/dist/reply/snippets.d.ts.map +1 -0
  123. package/dist/reply/snippets.js +135 -0
  124. package/dist/secret/registry.d.ts +18 -0
  125. package/dist/secret/registry.d.ts.map +1 -0
  126. package/dist/secret/registry.js +21 -0
  127. package/dist/seeds/example.d.ts +3 -0
  128. package/dist/seeds/example.d.ts.map +1 -0
  129. package/dist/seeds/example.js +350 -0
  130. package/dist/store/paging.d.ts +18 -0
  131. package/dist/store/paging.d.ts.map +1 -0
  132. package/dist/store/paging.js +20 -0
  133. package/dist/store/search.d.ts +67 -0
  134. package/dist/store/search.d.ts.map +1 -0
  135. package/dist/store/search.js +160 -0
  136. package/dist/store/searchIndex.d.ts +53 -0
  137. package/dist/store/searchIndex.d.ts.map +1 -0
  138. package/dist/store/searchIndex.js +66 -0
  139. package/dist/store/threads.d.ts +147 -0
  140. package/dist/store/threads.d.ts.map +1 -0
  141. package/dist/store/threads.js +197 -0
  142. package/dist/submission/encoding.d.ts +21 -0
  143. package/dist/submission/encoding.d.ts.map +1 -0
  144. package/dist/submission/encoding.js +55 -0
  145. package/dist/submission/guard.d.ts +71 -0
  146. package/dist/submission/guard.d.ts.map +1 -0
  147. package/dist/submission/guard.js +46 -0
  148. package/dist/submission/submit.d.ts +152 -0
  149. package/dist/submission/submit.d.ts.map +1 -0
  150. package/dist/submission/submit.js +319 -0
  151. package/dist/version.generated.d.ts +5 -0
  152. package/dist/version.generated.d.ts.map +1 -0
  153. package/dist/version.generated.js +7 -0
  154. package/dist/workflows/classify.d.ts +63 -0
  155. package/dist/workflows/classify.d.ts.map +1 -0
  156. package/dist/workflows/classify.js +68 -0
  157. package/dist/workflows/retryPolicy.d.ts +39 -0
  158. package/dist/workflows/retryPolicy.d.ts.map +1 -0
  159. package/dist/workflows/retryPolicy.js +43 -0
  160. package/dist/workflows/specs.d.ts +43 -0
  161. package/dist/workflows/specs.d.ts.map +1 -0
  162. package/dist/workflows/specs.js +46 -0
  163. package/dist/workflows/worker.d.ts +48 -0
  164. package/dist/workflows/worker.d.ts.map +1 -0
  165. package/dist/workflows/worker.js +37 -0
  166. package/package.json +24 -15
  167. package/src/version.generated.ts +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prov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/D,iEAAiE;IACjE,YAAY,EAAE,kBAAkB,EAAE,CAAC;IACnC,4FAA4F;IAC5F,MAAM,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,kBAAkB,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC/E,iFAAiF;IACjF,OAAO,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CACjD;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,kBAAkB,EAC/B,YAAY,EAAE,oBAAoB,GAAG,SAAS,MAAM,EAAE,GACrD,OAAO,CAAC,sBAAsB,CAAC,CAYjC;AAED,4FAA4F;AAC5F,MAAM,WAAW,oBAAoB;IACnC,0DAA0D;IAC1D,YAAY,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,uFAAuF;IACvF,iBAAiB,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACnD;;;OAGG;IACH,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAED,+FAA+F;AAC/F,MAAM,WAAW,yBAAyB;IACxC,kEAAkE;IAClE,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CACtC,aAAa,EAAE,oBAAoB,EACnC,YAAY,EAAE,oBAAoB,GAAG,SAAS,MAAM,EAAE,EACtD,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,IAAI,CAAC,CAMf"}
@@ -0,0 +1,110 @@
1
+ import { SUPPORT_CAPABILITY } from "../workflows/specs.js";
2
+ import { GLOBAL_SCOPE } from "@pithy-sh/core/src/naming/environment";
3
+ import { resourceName } from "@pithy-sh/core/src/naming/resource";
4
+ import { resourceNames } from "@pithy-sh/core/src/naming/resourceNames";
5
+ import { managedEnvironments } from "@pithy-sh/secrets/src/scope";
6
+ //#region src/provision/provisionSupport.ts
7
+ /**
8
+ * The provisioning orchestration for the support capability — the live counterpart to
9
+ * `pithy add support`'s config wiring.
10
+ *
11
+ * Three things have to exist before a support inbox works, and none of them can be a binding an
12
+ * adopter hand-writes: the R2 bucket attachments and raw messages land in, the prebuilt classification
13
+ * worker per environment, and — the one that actually delivers the mail — an Email Routing rule
14
+ * pointing the support address at the app worker.
15
+ *
16
+ * The live Cloudflare/wrangler steps sit behind the {@link SupportProvisioner} seam, so the
17
+ * orchestration (order, idempotency, per-env fan-out) is unit-tested without touching Cloudflare.
18
+ * Every step is idempotent; re-running is a no-op.
19
+ *
20
+ * ## The routing rule is opt-in, and that is a safety decision
21
+ *
22
+ * `ensureRoutingRule` returns `skipped: true` when no routing config is supplied, exactly as
23
+ * `@pithy-sh/email`'s does — because **enabling Email Routing on a zone points its MX at Cloudflare.**
24
+ * Creating a rule on the wrong zone would move an adopter's real inbound mail off their existing
25
+ * provider, which is not a mistake a provisioning command gets to make on their behalf. So the zone,
26
+ * the address, and the target worker are all explicit flags, and a project that has not decided yet
27
+ * provisions everything else and adds the rule later.
28
+ *
29
+ * The rule name is `<project>-global-support-inbound`, deliberately distinct from `@pithy-sh/email`'s
30
+ * `<project>-global-email-bounce`. Idempotency in `ensureWorkerRoute` keys on the rule *name*, so
31
+ * sharing one would make whichever capability provisioned second silently believe its rule already
32
+ * existed — and the project segment is what stops two Pithy projects on one zone doing the same to
33
+ * each other, with the loser's customer mail delivered to the winner's Worker.
34
+ */
35
+ /**
36
+ * The name of the Email Routing rule this capability creates, for one project. Distinct from the
37
+ * bounce handler's, and `global` in the environment slot because there is one rule per zone: the
38
+ * environments are separated by which app Worker the rule is pointed at, not by the rule.
39
+ *
40
+ * **Still on the generic composer**, and deliberately: an Email Routing rule is not a namespace
41
+ * `@pithy-sh/core/src/naming/limits` carries a verified Cloudflare cap for, and the facade exists so a
42
+ * kind of thing brings its own number rather than borrowing one. It takes the conservative default
43
+ * until that namespace lands — the same call `@pithy-sh/email`'s bounce rule makes.
44
+ */
45
+ function supportRoutingRuleName(project) {
46
+ return resourceName({
47
+ project,
48
+ env: GLOBAL_SCOPE,
49
+ thing: `${SUPPORT_CAPABILITY}-inbound`
50
+ });
51
+ }
52
+ /**
53
+ * The deployed Worker name for a project's environment — also its resolved config basename. Composed
54
+ * through core's naming facade under the **`worker`** namespace, so it is measured against a Worker
55
+ * script's 63 and the environment is validated on the way through. One source, so the name the CLI
56
+ * audits and deletes under cannot drift from the name it deploys under.
57
+ */
58
+ function supportWorkerName(project, env) {
59
+ return resourceNames(project).env(env).worker(SUPPORT_CAPABILITY);
60
+ }
61
+ /**
62
+ * Provision the support infrastructure.
63
+ *
64
+ * The order matters and is the inverse of how it fails: the bucket exists before a worker that could
65
+ * write to it, and **the routing rule is last** — creating it first would start delivering mail to a
66
+ * Worker whose classification host is not deployed yet, which is a window where real customer
67
+ * messages arrive and stay `uncategorized` with nothing to say why.
68
+ *
69
+ * `environments` is the project's declaration from the root `pithy.config.ts` (#241). Every declared
70
+ * environment is provisioned; an environment this skipped would be one the project deploys to with no
71
+ * resources behind it — the silence the closed `ManagedEnvironment` enum used to produce.
72
+ */
73
+ async function provisionSupport(provisioner, environments) {
74
+ await provisioner.preflight();
75
+ const bucket = await provisioner.ensureBucket();
76
+ const search = [];
77
+ for (const env of managedEnvironments(environments)) {
78
+ await provisioner.deployWorker(env);
79
+ search.push({
80
+ env,
81
+ ...await provisioner.ensureSearchIndex(env)
82
+ });
83
+ }
84
+ const routing = await provisioner.ensureRoutingRule();
85
+ return {
86
+ bucket,
87
+ environments: managedEnvironments(environments),
88
+ routing,
89
+ search
90
+ };
91
+ }
92
+ /**
93
+ * Tear down the support infrastructure, reversing {@link provisionSupport}.
94
+ *
95
+ * The routing rule goes **first**, and that ordering is the whole point: stop new mail arriving before
96
+ * removing the workers that would have handled it, or messages land in a Worker with no classification
97
+ * host during the teardown. Stored correspondence is preserved unless explicitly requested — losing an
98
+ * adopter's support history to a teardown flag would be unrecoverable.
99
+ *
100
+ * `environments` is the project's declaration from the root `pithy.config.ts` (#241). Every declared
101
+ * environment is provisioned; an environment this skipped would be one the project deploys to with no
102
+ * resources behind it — the silence the closed `ManagedEnvironment` enum used to produce.
103
+ */
104
+ async function deprovisionSupport(deprovisioner, environments, options = {}) {
105
+ await deprovisioner.removeRoutingRule();
106
+ for (const env of managedEnvironments(environments)) await deprovisioner.deleteWorker(env);
107
+ if (options.deleteStorage) await deprovisioner.deleteBucket();
108
+ }
109
+ //#endregion
110
+ export { deprovisionSupport, provisionSupport, supportRoutingRuleName, supportWorkerName };
@@ -0,0 +1,45 @@
1
+ import { type WorkflowHostTemplate } from "@pithy-sh/core/src/workflow/host";
2
+ import type { ManagedEnvironment } from "@pithy-sh/secrets/src/scope";
3
+ import type { SupportConfig } from "../config/config";
4
+ /**
5
+ * Resolve the support worker's committed `wrangler.jsonc` template into one environment's standalone
6
+ * config. Every per-environment decision lives here; everything static — the compatibility date, the
7
+ * AI binding, the Workflow class name — stays as the template committed it.
8
+ *
9
+ * Thin over core's {@link resolveWorkflowHost}, which owns the mechanics (clone, fill by binding name,
10
+ * stamp `ENVIRONMENT`). This file owns only what is support's: which binding maps to which provisioned
11
+ * resource, the Workflow name derived from support's own specs, and the serialized config the worker
12
+ * parses.
13
+ *
14
+ * **`AI` is marked remote.** Workflows cannot use remote bindings in general, so a host always runs
15
+ * locally under `wrangler dev` — and Workers AI has no local emulation, so without this flag the
16
+ * classification step has nothing to call in development. Same treatment `@pithy-sh/vector` gives
17
+ * Vectorize, for the same reason.
18
+ *
19
+ * There is no secrets binding and no secrets database, and that absence is deliberate: this worker
20
+ * reads a message and writes a classification. The AI binding is its entire dependency, so it holds no
21
+ * credential at all — which is the smallest blast radius a deployed worker can have.
22
+ */
23
+ /** The resolved resource ids + per-env values for one environment's support-worker deploy. */
24
+ export interface SupportConfigParams {
25
+ /**
26
+ * The project name — the `<project>` segment the deployed worker and its classification Workflow
27
+ * lead with. The root `pithy.config.ts` `name`, resolved by `requireProjectName` and never guessed.
28
+ */
29
+ project: string;
30
+ /** The target environment. */
31
+ env: ManagedEnvironment;
32
+ /** The app database id for this environment — where the support tables live. */
33
+ appDatabaseId: string;
34
+ /**
35
+ * The app's resolved support config, serialized into the worker's `SUPPORT_CONFIG` var.
36
+ *
37
+ * This is how an adopter's federated categories reach the prompt. The worker is deployed from this
38
+ * package and cannot import their code, so the taxonomy has to travel as data — which it does,
39
+ * because it always was data.
40
+ */
41
+ supportConfig: SupportConfig;
42
+ }
43
+ /** Fill the template for one environment. */
44
+ export declare function resolveSupportConfig(template: WorkflowHostTemplate, params: SupportConfigParams): WorkflowHostTemplate;
45
+ //# sourceMappingURL=resolveSupportConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveSupportConfig.d.ts","sourceRoot":"","sources":["../../src/provision/resolveSupportConfig.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyC,KAAK,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACpH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD;;;;;;;;;;;;;;;;;;GAkBG;AAEH,8FAA8F;AAC9F,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,GAAG,EAAE,kBAAkB,CAAC;IACxB,gFAAgF;IAChF,aAAa,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,6CAA6C;AAC7C,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,oBAAoB,EAC9B,MAAM,EAAE,mBAAmB,GAC1B,oBAAoB,CAatB"}
@@ -0,0 +1,22 @@
1
+ import { SUPPORT_CAPABILITY, supportWorkflowRegistry } from "../workflows/specs.js";
2
+ import { hostWorkflowsFor, resolveWorkflowHost } from "@pithy-sh/core/src/workflow/host";
3
+ //#region src/provision/resolveSupportConfig.ts
4
+ /** Fill the template for one environment. */
5
+ function resolveSupportConfig(template, params) {
6
+ const { project, env } = params;
7
+ return resolveWorkflowHost(template, {
8
+ project,
9
+ capability: SUPPORT_CAPABILITY,
10
+ env,
11
+ databaseIds: { DB: params.appDatabaseId },
12
+ remoteBindings: ["AI"],
13
+ vars: { SUPPORT_CONFIG: JSON.stringify(params.supportConfig) },
14
+ workflows: hostWorkflowsFor(supportWorkflowRegistry, {
15
+ project,
16
+ capability: SUPPORT_CAPABILITY,
17
+ env
18
+ }).workflows
19
+ });
20
+ }
21
+ //#endregion
22
+ export { resolveSupportConfig };
@@ -0,0 +1,123 @@
1
+ import type { AuditEmit } from "@pithy-sh/core/src/audit/recorder";
2
+ import type { Logger } from "@pithy-sh/core/src/logger/logger";
3
+ import type { SupportConfig } from "../config/config";
4
+ import { type SupportDatabase } from "../data/tables";
5
+ /**
6
+ * Sending a reply — through `@pithy-sh/email`'s durable send path, never directly.
7
+ *
8
+ * ## Why the reply is composed here and not in the dashboard
9
+ *
10
+ * Three things have to be true of an answer, and a dashboard can guarantee none of them. It has to
11
+ * leave from the adopter's domain carrying the adopter's DKIM, so it is not filtered as a forgery.
12
+ * It has to be durable and retryable, which is what the email capability's job row and Workflow buy.
13
+ * And it has to set `In-Reply-To` and `References` correctly — which only the Worker can do, because
14
+ * only the Worker holds the thread's chain. Implemented dashboard-side, threading breaks in the
15
+ * customer's mail client and every conversation fragments into one message per answer.
16
+ *
17
+ * So the dashboard POSTs a body. That is the entire contract, and it is why the reply route is small.
18
+ *
19
+ * ## The sent Message-ID is not ours to know
20
+ *
21
+ * Cloudflare assigns the real `Message-ID` at send time and does not tell the enqueuer, so the
22
+ * outbound row stores `emailJobId` and leaves `mimeMessageId` null. Threading back still works, and
23
+ * this is the part worth being clear about: when the customer replies, their `References` carries the
24
+ * whole ancestry — including the *inbound* ids this capability stored itself — so `parentCandidates`
25
+ * finds the thread through one of those even though it has never seen the id of its own reply.
26
+ *
27
+ * ## Storing the answer and sending it are two steps, and one of them is optional
28
+ *
29
+ * Everything above describes mail. An `app` thread has a second destination that already exists:
30
+ * `readOwnThread` hands the submitter every message on their own conversation, outbound ones
31
+ * included, so an answer stored and never sent is an answer they will read next time they open it.
32
+ *
33
+ * That is the whole shape of in-app delivery — the outbound row, the thread counters and the audit
34
+ * event are written exactly as they are for mail, and only the `enqueue` is skipped. It is taken in
35
+ * two situations, and they are different in kind:
36
+ *
37
+ * - **The adopter chose it.** `reply.deliverInApp` on a project whose mail works perfectly well.
38
+ * Email Routing takes over a zone's MX, so a project already running mail on that domain cannot
39
+ * receive support replies without disturbing everything else on it — and a fallback conditioned on
40
+ * mail being *impossible* is unreachable by exactly the adopter who most wants this.
41
+ * - **There is nothing to send with.** No address a reply could come back to, or no email capability
42
+ * composed at all. Storing the answer beats refusing it, because the person can still read it.
43
+ *
44
+ * An `email` thread never takes it. Its sender has no read-back — there is no session, only an
45
+ * address — so an answer stored there is one nobody would ever see, and a missing reply address on a
46
+ * mail thread stays the misconfiguration it always was.
47
+ *
48
+ * **The two are never rendered the same.** "Sent by email" and "waiting in the app" are different
49
+ * promises about when somebody will read the answer, and `ReplyResult` is a union rather than an
50
+ * object with an optional `jobId` so that a console has to say which one it is showing.
51
+ */
52
+ /** What a reply needs, all injectable. */
53
+ export interface ReplyDeps {
54
+ /** The support tables. */
55
+ db: SupportDatabase;
56
+ /** The resolved config. */
57
+ config: SupportConfig;
58
+ /**
59
+ * The email capability's `enqueue`, already bound to the request env. Support never assembles the
60
+ * send infrastructure — it hands over a recipient, a template id, and a payload.
61
+ *
62
+ * **Optional, because a project can compose support without composing email.** Absent, an `app`
63
+ * thread is answered in the app rather than refused, and only a mail thread has nothing left to
64
+ * try. The refusal is raised here rather than by the caller so that the one place that knows
65
+ * whether mail is needed is the one that asks for it.
66
+ */
67
+ enqueue?: (input: {
68
+ to: string;
69
+ template: string;
70
+ payload: unknown;
71
+ replyTo?: string;
72
+ /** The language to write the shell in — the reporter's, taken off their submission context. */
73
+ locale?: string;
74
+ inReplyTo?: string;
75
+ references?: string;
76
+ }) => Promise<{
77
+ jobId: string;
78
+ }>;
79
+ /** Whether the full-text index is in use. */
80
+ fts: boolean;
81
+ /** The audit seam. */
82
+ emit: AuditEmit;
83
+ /** The request logger. */
84
+ log: Logger;
85
+ /** Generate a row id. */
86
+ newId: () => string;
87
+ /** Now. */
88
+ now: () => Date;
89
+ }
90
+ /** What the operator is sending. */
91
+ export interface ReplyInput {
92
+ /** The thread being answered. */
93
+ threadId: string;
94
+ /** The reply text, as a human wrote and edited it. */
95
+ body: string;
96
+ /** Who is answering, signed at the bottom. Optional. */
97
+ agentName?: string;
98
+ /** The verified control-plane subject sending it — the audit actor. */
99
+ viewer: string;
100
+ }
101
+ /**
102
+ * What the reply produced, discriminated on the channel it was delivered over.
103
+ *
104
+ * A union rather than one object with an optional `jobId`, because the two outcomes are different
105
+ * promises about when the customer reads the answer — and an optional field is exactly what lets a
106
+ * console render "sent" over both of them.
107
+ */
108
+ export type ReplyResult = {
109
+ /** Handed to the email capability's durable send path. */
110
+ channel: "email";
111
+ /** The outbound `pithy_support_messages.id`. */
112
+ messageId: string;
113
+ /** The `pithy_email_jobs.id` the send was enqueued as. */
114
+ jobId: string;
115
+ } | {
116
+ /** Stored for the submitter to read in the app. No mail was sent, and there is no job. */
117
+ channel: "app";
118
+ /** The outbound `pithy_support_messages.id`. */
119
+ messageId: string;
120
+ };
121
+ /** Send a reply on a thread. */
122
+ export declare function sendReply(deps: ReplyDeps, input: ReplyInput): Promise<ReplyResult>;
123
+ //# sourceMappingURL=send.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/reply/send.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,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MAAM,MAAM,WAAW,GACnB;IACE,0DAA0D;IAC1D,OAAO,EAAE,OAAO,CAAC;IACjB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;CACf,GACD;IACE,0FAA0F;IAC1F,OAAO,EAAE,KAAK,CAAC;IACf,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN,gCAAgC;AAChC,wBAAsB,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CA2LxF"}
@@ -0,0 +1,153 @@
1
+ import { SupportNotFoundError, SupportReplyFailedError } from "../error/errors.js";
2
+ import { SupportMessage } from "../data/message.js";
3
+ import { SUPPORT_MESSAGES_TABLE, SUPPORT_THREADS_TABLE } from "../data/tables.js";
4
+ import { SupportAuditActions } from "../audit/actions.js";
5
+ import { buildReferencesHeader, replySubject } from "../mime/threading.js";
6
+ import { indexMessage } from "../store/search.js";
7
+ //#region src/reply/send.ts
8
+ /** Send a reply on a thread. */
9
+ async function sendReply(deps, input) {
10
+ if (!deps.config.reply.enabled) throw new SupportReplyFailedError({
11
+ message: "Replying is disabled on this deployment.",
12
+ action: "Set `reply.enabled` on the support capability in pithy.config.ts, then redeploy.",
13
+ detail: "support config has reply.enabled = false"
14
+ });
15
+ const thread = await deps.db.selectFrom(SUPPORT_THREADS_TABLE).select([
16
+ "id",
17
+ "channel",
18
+ "subject",
19
+ "fromAddress",
20
+ "fromName",
21
+ "inboxAddress",
22
+ "messageCount"
23
+ ]).where("id", "=", input.threadId).executeTakeFirst();
24
+ if (!thread) throw new SupportNotFoundError({ detail: `no support thread ${input.threadId}` });
25
+ const parent = await deps.db.selectFrom(SUPPORT_MESSAGES_TABLE).select([
26
+ "mimeMessageId",
27
+ "mimeReferences",
28
+ "context"
29
+ ]).where("threadId", "=", input.threadId).where("direction", "=", "inbound").orderBy("receivedAt", "desc").orderBy("id", "desc").limit(1).executeTakeFirst();
30
+ /**
31
+ * The language to answer in: the one the reporter's app was rendering in when they wrote.
32
+ *
33
+ * **The customer's, never the agent's.** A reply is composed inside an operator's request, and that
34
+ * request's negotiated locale is the operator's — so reading `c.var.t` here would answer a Spanish
35
+ * customer in whatever language the support console happens to be open in. The submission context is
36
+ * the only thing on this thread that says something about the *reader*, and it is already collected
37
+ * because a locale-shaped bug is only reproducible in the reporter's locale.
38
+ *
39
+ * It moves the shell and not the letter. `supportReply`'s words are the adopter's — a human wrote
40
+ * them, and a catalog cannot translate a sentence it has never seen — so what follows this tag is the
41
+ * document's `lang` and `dir` and the footer. That is the honest half, and it is the half that decides
42
+ * whether an Arabic reply lays out right-to-left.
43
+ *
44
+ * Absent on every mail-path message, which is most of them, and absent renders as it always has.
45
+ */
46
+ const parentContext = SupportMessage.shape.context.safeParse(parent?.context);
47
+ const replyLocale = parentContext.success ? parentContext.data?.locale ?? void 0 : void 0;
48
+ const parentReferences = SupportMessage.shape.mimeReferences.safeParse(parent?.mimeReferences);
49
+ const chain = parentReferences.success && Array.isArray(parentReferences.data) ? parentReferences.data : [];
50
+ const references = buildReferencesHeader(chain, parent?.mimeMessageId ?? void 0);
51
+ const subject = replySubject(thread.subject);
52
+ const now = deps.now();
53
+ const replyTo = deps.config.reply.replyToAddress ?? thread.inboxAddress;
54
+ const enqueue = deps.enqueue;
55
+ const deliverable = enqueue !== void 0 && replyTo !== null && replyTo !== void 0;
56
+ const inApp = thread.channel === "app" && (deps.config.reply.deliverInApp || !deliverable);
57
+ let jobId = null;
58
+ if (!inApp) {
59
+ if (!enqueue) throw new SupportReplyFailedError({
60
+ message: "This deployment cannot send mail.",
61
+ action: "Add the email capability (`pithy add email`) and provision it, then retry.",
62
+ detail: `thread ${input.threadId} needs a mailed reply and no email capability is composed`
63
+ });
64
+ if (!replyTo) throw new SupportReplyFailedError({
65
+ message: "This deployment has no address a reply can come back to.",
66
+ action: "Set `inboundAddresses` or `reply.replyToAddress` on the support capability, then retry.",
67
+ detail: `thread ${input.threadId} has no inboxAddress and no reply.replyToAddress is configured`
68
+ });
69
+ try {
70
+ jobId = (await enqueue({
71
+ to: thread.fromAddress,
72
+ template: "supportReply",
73
+ payload: {
74
+ subject,
75
+ body: input.body,
76
+ ...input.agentName ? { agentName: input.agentName } : {}
77
+ },
78
+ replyTo,
79
+ locale: replyLocale,
80
+ inReplyTo: parent?.mimeMessageId ? `<${parent.mimeMessageId}>` : void 0,
81
+ references: references.length > 0 ? references : void 0
82
+ })).jobId;
83
+ } catch (cause) {
84
+ throw new SupportReplyFailedError({ detail: `enqueue failed for thread ${input.threadId}` }, { cause });
85
+ }
86
+ }
87
+ const messageId = deps.newId();
88
+ const message = {
89
+ id: messageId,
90
+ threadId: input.threadId,
91
+ direction: "outbound",
92
+ channel: inApp ? "app" : "email",
93
+ submittedByUserId: null,
94
+ context: null,
95
+ mimeMessageId: null,
96
+ mimeInReplyTo: parent?.mimeMessageId ?? null,
97
+ mimeReferences: chain.length > 0 ? chain : null,
98
+ fromAddress: inApp ? null : replyTo,
99
+ fromName: null,
100
+ toAddress: inApp ? null : thread.fromAddress,
101
+ subject,
102
+ textBody: input.body,
103
+ htmlBody: null,
104
+ emailJobId: jobId,
105
+ rawKey: null,
106
+ rawBytes: null,
107
+ receivedAt: now,
108
+ createdAt: now
109
+ };
110
+ await deps.db.insertInto(SUPPORT_MESSAGES_TABLE).values(SupportMessage.encode(message)).execute();
111
+ if (deps.fts) try {
112
+ await indexMessage(deps.db, {
113
+ threadId: input.threadId,
114
+ messageId,
115
+ subject,
116
+ body: input.body
117
+ });
118
+ } catch (error) {
119
+ deps.log.warn("support reply not indexed", {
120
+ messageId,
121
+ error
122
+ });
123
+ }
124
+ await deps.db.updateTable(SUPPORT_THREADS_TABLE).set((eb) => ({
125
+ messageCount: eb("messageCount", "+", 1),
126
+ lastMessageAt: now.getTime(),
127
+ updatedAt: now.getTime()
128
+ })).where("id", "=", input.threadId).execute();
129
+ await deps.emit({
130
+ action: SupportAuditActions.replySent,
131
+ outcome: "success",
132
+ actorType: "control-plane",
133
+ actorId: input.viewer,
134
+ resourceType: "support_thread",
135
+ resourceId: input.threadId,
136
+ metadata: {
137
+ channel: message.channel,
138
+ messageId,
139
+ threaded: Boolean(parent?.mimeMessageId),
140
+ ...jobId === null ? {} : { jobId }
141
+ }
142
+ });
143
+ return jobId === null ? {
144
+ channel: "app",
145
+ messageId
146
+ } : {
147
+ channel: "email",
148
+ messageId,
149
+ jobId
150
+ };
151
+ }
152
+ //#endregion
153
+ export { sendReply };
@@ -0,0 +1,79 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * The tokens a dashboard substitutes before sending. Documented here because they are a contract
4
+ * between this catalog and whatever renders it, and deliberately few: a placeholder language is a
5
+ * template engine, and a template engine over untrusted context is a rendering vulnerability.
6
+ */
7
+ export declare const SNIPPET_TOKENS: {
8
+ /** The sender's display name, or their address when the app knows no name. */
9
+ readonly name: "{{name}}";
10
+ /** The thread's subject. */
11
+ readonly subject: "{{subject}}";
12
+ };
13
+ /** One canned reply. */
14
+ export declare const SupportReplySnippet: z.ZodObject<{
15
+ label: z.ZodString;
16
+ category: z.ZodOptional<z.ZodString>;
17
+ body: z.ZodString;
18
+ }, z.core.$strip>;
19
+ export type SupportReplySnippet = z.infer<typeof SupportReplySnippet>;
20
+ /** A snippet catalog: key → the snippet. */
21
+ export type SupportReplySnippets = Record<string, SupportReplySnippet>;
22
+ /**
23
+ * The set Pithy ships, keyed to the default categories.
24
+ *
25
+ * Six, not sixteen. A picker long enough to need scrolling is one nobody reads, and the ones below
26
+ * are the replies a solo developer actually writes over and over.
27
+ */
28
+ export declare const DEFAULT_SUPPORT_REPLIES: {
29
+ readonly refund_issued: {
30
+ readonly label: "Refund issued";
31
+ readonly category: "billing";
32
+ readonly body: "Hi {{name}},\n\nI've refunded this — you should see it back on your original payment method within ___ working days.\n\nSorry for the trouble.\n";
33
+ };
34
+ readonly billing_explained: {
35
+ readonly label: "Explain a charge";
36
+ readonly category: "billing";
37
+ readonly body: "Hi {{name}},\n\nThat charge is ___. It covers ___.\n\nIf that isn't what you expected, tell me and I'll sort it out.\n";
38
+ };
39
+ readonly sign_in_help: {
40
+ readonly label: "Sign-in help";
41
+ readonly category: "account_access";
42
+ readonly body: "Hi {{name}},\n\nI've had a look — ___.\n\nTry signing in again and let me know if it still doesn't work. If the email isn't arriving, check your spam folder, and tell me which address you're using so I can confirm it matches the account.\n";
43
+ };
44
+ readonly bug_acknowledged: {
45
+ readonly label: "Bug acknowledged";
46
+ readonly category: "bug_report";
47
+ readonly body: "Hi {{name}},\n\nThanks for reporting this — I've reproduced it and it's a real bug. ___.\n\nI'll follow up here once it's fixed.\n";
48
+ };
49
+ readonly feature_noted: {
50
+ readonly label: "Feature request noted";
51
+ readonly category: "feature_request";
52
+ readonly body: "Hi {{name}},\n\nThanks — that's a good idea and I've written it down. I can't promise a date, but ___.\n\nIf you can tell me a bit about how you'd use it, that genuinely helps me prioritize.\n";
53
+ };
54
+ readonly need_more_detail: {
55
+ readonly label: "Ask for more detail";
56
+ readonly body: "Hi {{name}},\n\nHappy to help with this. Could you tell me ___?\n\nA screenshot or the exact wording of any error would speed this up a lot.\n";
57
+ };
58
+ };
59
+ /**
60
+ * Declare an adopter's own canned replies, validated at author time.
61
+ *
62
+ * The same shape and the same reasoning as `defineSupportCategories`: a malformed key is a picker
63
+ * entry that silently never matches, and it should fail where the constant is written.
64
+ */
65
+ export declare function defineSupportReplies<const T extends SupportReplySnippets>(snippets: T): T;
66
+ /** The effective catalog: the shipped set, plus the adopter's, theirs winning on a key collision. */
67
+ export declare function resolveReplies(extra?: SupportReplySnippets): SupportReplySnippets;
68
+ /**
69
+ * The catalog as a dashboard consumes it: the snippets for this thread's category first, then the
70
+ * uncategorized general-purpose ones, then everything else.
71
+ *
72
+ * Ordering rather than filtering, deliberately. A classifier that put a refund request in
73
+ * `bug_report` would otherwise hide the refund snippets from the one person who can tell it was
74
+ * wrong — the model orders the list, it never restricts it.
75
+ */
76
+ export declare function repliesForCategory(snippets: SupportReplySnippets, category: string): Array<SupportReplySnippet & {
77
+ key: string;
78
+ }>;
79
+ //# sourceMappingURL=snippets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snippets.d.ts","sourceRoot":"","sources":["../../src/reply/snippets.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqCxB;;;;GAIG;AACH,eAAO,MAAM,cAAc;IACzB,8EAA8E;aAC9E,IAAI,EAAE,UAAU;IAChB,4BAA4B;aAC5B,OAAO,EAAE,aAAa;CACd,CAAC;AAEX,wBAAwB;AACxB,eAAO,MAAM,mBAAmB;;;;iBAqBmD,CAAC;AACpF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE,4CAA4C;AAC5C,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;AAEvE;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;;iBAEhC,KAAK,EAAE,eAAe;iBACtB,QAAQ,EAAE,SAAS;iBACnB,IAAI,EAAE,kJAAkJ;;;iBAGxJ,KAAK,EAAE,kBAAkB;iBACzB,QAAQ,EAAE,SAAS;iBACnB,IAAI,EAAE,wHAAwH;;;iBAG9H,KAAK,EAAE,cAAc;iBACrB,QAAQ,EAAE,gBAAgB;iBAC1B,IAAI,EAAE,iPAAiP;;;iBAGvP,KAAK,EAAE,kBAAkB;iBACzB,QAAQ,EAAE,YAAY;iBACtB,IAAI,EAAE,oIAAoI;;;iBAG1I,KAAK,EAAE,uBAAuB;iBAC9B,QAAQ,EAAE,iBAAiB;iBAC3B,IAAI,EAAE,kMAAkM;;;iBAGxM,KAAK,EAAE,qBAAqB;iBAC5B,IAAI,EAAE,gJAAgJ;;CAEjH,CAAC;AAE1C;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,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