@whooshbang/contracts 1.0.0-rc.13

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 (229) hide show
  1. package/CHANGELOG.md +198 -0
  2. package/LICENSE +21 -0
  3. package/README.md +120 -0
  4. package/contract-manifest.json +390 -0
  5. package/dist/base64url.d.ts +2 -0
  6. package/dist/base64url.js +51 -0
  7. package/dist/base64url.js.map +1 -0
  8. package/dist/generated/artifact-index.d.ts +205 -0
  9. package/dist/generated/artifact-index.js +396 -0
  10. package/dist/generated/artifact-index.js.map +1 -0
  11. package/dist/generated/contract-manifest.d.ts +66 -0
  12. package/dist/generated/contract-manifest.js +6 -0
  13. package/dist/generated/contract-manifest.js.map +1 -0
  14. package/dist/generated/core-scenario.d.ts +18 -0
  15. package/dist/generated/core-scenario.js +6 -0
  16. package/dist/generated/core-scenario.js.map +1 -0
  17. package/dist/generated/fixture-index.d.ts +33 -0
  18. package/dist/generated/fixture-index.js +6 -0
  19. package/dist/generated/fixture-index.js.map +1 -0
  20. package/dist/generated/interaction-machine-scenario.d.ts +263 -0
  21. package/dist/generated/interaction-machine-scenario.js +6 -0
  22. package/dist/generated/interaction-machine-scenario.js.map +1 -0
  23. package/dist/generated/interaction-v1.d.ts +152 -0
  24. package/dist/generated/interaction-v1.js +6 -0
  25. package/dist/generated/interaction-v1.js.map +1 -0
  26. package/dist/generated/machine-v1.d.ts +169 -0
  27. package/dist/generated/machine-v1.js +6 -0
  28. package/dist/generated/machine-v1.js.map +1 -0
  29. package/dist/generated/provider-capabilities-v1.d.ts +78 -0
  30. package/dist/generated/provider-capabilities-v1.js +6 -0
  31. package/dist/generated/provider-capabilities-v1.js.map +1 -0
  32. package/dist/generated/validators-standalone.d.ts +659 -0
  33. package/dist/generated/validators-standalone.js +47800 -0
  34. package/dist/generated/validators-standalone.js.map +1 -0
  35. package/dist/generated/validators.d.ts +74 -0
  36. package/dist/generated/validators.js +493 -0
  37. package/dist/generated/validators.js.map +1 -0
  38. package/dist/generated/webhook-delivery-case-v1.d.ts +91 -0
  39. package/dist/generated/webhook-delivery-case-v1.js +6 -0
  40. package/dist/generated/webhook-delivery-case-v1.js.map +1 -0
  41. package/dist/generated/webhook-signing-vector-v1.d.ts +88 -0
  42. package/dist/generated/webhook-signing-vector-v1.js +6 -0
  43. package/dist/generated/webhook-signing-vector-v1.js.map +1 -0
  44. package/dist/generated/whooshbang-event-v1.d.ts +191 -0
  45. package/dist/generated/whooshbang-event-v1.js +6 -0
  46. package/dist/generated/whooshbang-event-v1.js.map +1 -0
  47. package/dist/generated/whooshbang-v1.d.ts +1162 -0
  48. package/dist/generated/whooshbang-v1.js +6 -0
  49. package/dist/generated/whooshbang-v1.js.map +1 -0
  50. package/dist/index.d.ts +20 -0
  51. package/dist/index.js +7 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/machine-credential.d.ts +31 -0
  54. package/dist/machine-credential.js +78 -0
  55. package/dist/machine-credential.js.map +1 -0
  56. package/dist/webhook-consumer.d.ts +50 -0
  57. package/dist/webhook-consumer.js +71 -0
  58. package/dist/webhook-consumer.js.map +1 -0
  59. package/dist/webhook-delivery.d.ts +46 -0
  60. package/dist/webhook-delivery.js +126 -0
  61. package/dist/webhook-delivery.js.map +1 -0
  62. package/dist/webhook-signature.d.ts +36 -0
  63. package/dist/webhook-signature.js +255 -0
  64. package/dist/webhook-signature.js.map +1 -0
  65. package/examples/python/verify_webhook.py +283 -0
  66. package/fixtures/.gitkeep +1 -0
  67. package/fixtures/core-v1/fixture-index.json +963 -0
  68. package/fixtures/core-v1/problems/auth-invalid.json +9 -0
  69. package/fixtures/core-v1/problems/authentication-required.json +9 -0
  70. package/fixtures/core-v1/problems/cancellation-too-late.json +9 -0
  71. package/fixtures/core-v1/problems/endpoint-rotation-conflict.json +10 -0
  72. package/fixtures/core-v1/problems/environment-mismatch.json +9 -0
  73. package/fixtures/core-v1/problems/idempotency-conflict.json +9 -0
  74. package/fixtures/core-v1/problems/idempotency-key-required.json +9 -0
  75. package/fixtures/core-v1/problems/project-slug-conflict.json +16 -0
  76. package/fixtures/core-v1/problems/provider-outcome-unknown.json +9 -0
  77. package/fixtures/core-v1/problems/provider-retryable.json +10 -0
  78. package/fixtures/core-v1/problems/provider-terminal.json +9 -0
  79. package/fixtures/core-v1/problems/rate-limited.json +10 -0
  80. package/fixtures/core-v1/problems/replay-unavailable-not-terminal.json +16 -0
  81. package/fixtures/core-v1/problems/replay-unavailable-payload.json +16 -0
  82. package/fixtures/core-v1/problems/replay-unavailable-rollout.json +16 -0
  83. package/fixtures/core-v1/problems/request-invalid.json +16 -0
  84. package/fixtures/core-v1/problems/resource-expired.json +9 -0
  85. package/fixtures/core-v1/problems/resource-not-found.json +9 -0
  86. package/fixtures/core-v1/problems/scope-forbidden.json +9 -0
  87. package/fixtures/core-v1/problems/subscriber-unbound.json +9 -0
  88. package/fixtures/core-v1/requests/create-api-credential.json +9 -0
  89. package/fixtures/core-v1/requests/create-customer-endpoint.json +5 -0
  90. package/fixtures/core-v1/requests/create-message.json +15 -0
  91. package/fixtures/core-v1/requests/create-project.json +4 -0
  92. package/fixtures/core-v1/requests/create-subscription-link.json +5 -0
  93. package/fixtures/core-v1/requests/rotate-api-credential.json +3 -0
  94. package/fixtures/core-v1/requests/rotate-customer-endpoint.json +3 -0
  95. package/fixtures/core-v1/scenarios/api-credential-invalid-indistinguishable.json +14 -0
  96. package/fixtures/core-v1/scenarios/api-credential-one-time-reveal.json +21 -0
  97. package/fixtures/core-v1/scenarios/api-credential-revocation-replay.json +17 -0
  98. package/fixtures/core-v1/scenarios/api-credential-rotation-overlap.json +18 -0
  99. package/fixtures/core-v1/scenarios/cancellation-too-late.json +15 -0
  100. package/fixtures/core-v1/scenarios/cross-account-project.json +14 -0
  101. package/fixtures/core-v1/scenarios/cross-project-resource.json +17 -0
  102. package/fixtures/core-v1/scenarios/environment-mismatch.json +17 -0
  103. package/fixtures/core-v1/scenarios/idempotency-conflict.json +35 -0
  104. package/fixtures/core-v1/scenarios/idempotency-equivalent-replay.json +27 -0
  105. package/fixtures/core-v1/scenarios/malformed-bearer.json +14 -0
  106. package/fixtures/core-v1/scenarios/metadata-overrun.json +14 -0
  107. package/fixtures/core-v1/scenarios/missing-scope.json +15 -0
  108. package/fixtures/core-v1/scenarios/project-create-equivalent-replay.json +26 -0
  109. package/fixtures/core-v1/scenarios/project-slug-conflict.json +21 -0
  110. package/fixtures/core-v1/scenarios/provider-outcome-unknown.json +15 -0
  111. package/fixtures/core-v1/scenarios/subscription-activation-replay.json +18 -0
  112. package/fixtures/core-v1/scenarios/subscription-expired-replay.json +16 -0
  113. package/fixtures/core-v1/success/account-projection.json +11 -0
  114. package/fixtures/core-v1/success/api-credential-collection.json +22 -0
  115. package/fixtures/core-v1/success/api-credential-created.json +20 -0
  116. package/fixtures/core-v1/success/api-credential-revoked.json +19 -0
  117. package/fixtures/core-v1/success/api-credential-rotated.json +41 -0
  118. package/fixtures/core-v1/success/customer-endpoint-attempts.json +15 -0
  119. package/fixtures/core-v1/success/customer-endpoint-collection.json +26 -0
  120. package/fixtures/core-v1/success/customer-endpoint-create-replayed.json +16 -0
  121. package/fixtures/core-v1/success/customer-endpoint-created.json +17 -0
  122. package/fixtures/core-v1/success/customer-endpoint-rotated.json +21 -0
  123. package/fixtures/core-v1/success/message-accepted.json +30 -0
  124. package/fixtures/core-v1/success/message-cancellation-too-late.json +27 -0
  125. package/fixtures/core-v1/success/message-cancelled.json +27 -0
  126. package/fixtures/core-v1/success/message-outcome-unknown.json +33 -0
  127. package/fixtures/core-v1/success/message-provider-accepted.json +30 -0
  128. package/fixtures/core-v1/success/project-collection.json +42 -0
  129. package/fixtures/core-v1/success/project-created.json +38 -0
  130. package/fixtures/core-v1/success/subscription-link-activated.json +22 -0
  131. package/fixtures/core-v1/success/subscription-link-cancelled.json +14 -0
  132. package/fixtures/core-v1/success/subscription-link-paused.json +22 -0
  133. package/fixtures/core-v1/success/subscription-link-pending.json +14 -0
  134. package/fixtures/core-v1/success/subscription-link-revoked.json +22 -0
  135. package/fixtures/interaction-machine-v1/capabilities/providers.json +57 -0
  136. package/fixtures/interaction-machine-v1/capabilities/telegram.json +52 -0
  137. package/fixtures/interaction-machine-v1/events/confirm-answered.json +22 -0
  138. package/fixtures/interaction-machine-v1/events/input-answered.json +22 -0
  139. package/fixtures/interaction-machine-v1/events/input-redacted.json +18 -0
  140. package/fixtures/interaction-machine-v1/events/select-answered.json +22 -0
  141. package/fixtures/interaction-machine-v1/requests/ack-processed.json +5 -0
  142. package/fixtures/interaction-machine-v1/requests/ack-quarantined.json +5 -0
  143. package/fixtures/interaction-machine-v1/requests/create-machine-client.json +6 -0
  144. package/fixtures/interaction-machine-v1/requests/create-message-confirm.json +18 -0
  145. package/fixtures/interaction-machine-v1/requests/create-message-input.json +16 -0
  146. package/fixtures/interaction-machine-v1/requests/create-message-select.json +26 -0
  147. package/fixtures/interaction-machine-v1/requests/register-machine-credential.json +4 -0
  148. package/fixtures/interaction-machine-v1/scenarios/ack-conflict.json +14 -0
  149. package/fixtures/interaction-machine-v1/scenarios/ack-cross-machine.json +15 -0
  150. package/fixtures/interaction-machine-v1/scenarios/ack-out-of-order.json +15 -0
  151. package/fixtures/interaction-machine-v1/scenarios/ack-replay.json +17 -0
  152. package/fixtures/interaction-machine-v1/scenarios/ambiguous-free-text.json +15 -0
  153. package/fixtures/interaction-machine-v1/scenarios/callback-token-opacity.json +16 -0
  154. package/fixtures/interaction-machine-v1/scenarios/credential-registration-conflict.json +16 -0
  155. package/fixtures/interaction-machine-v1/scenarios/credential-registration-replay.json +15 -0
  156. package/fixtures/interaction-machine-v1/scenarios/credential-revocation-replay.json +14 -0
  157. package/fixtures/interaction-machine-v1/scenarios/credential-rotation.json +16 -0
  158. package/fixtures/interaction-machine-v1/scenarios/first-credential-activates.json +15 -0
  159. package/fixtures/interaction-machine-v1/scenarios/interaction-duplicate.json +16 -0
  160. package/fixtures/interaction-machine-v1/scenarios/interaction-expired.json +17 -0
  161. package/fixtures/interaction-machine-v1/scenarios/interaction-mismatch.json +16 -0
  162. package/fixtures/interaction-machine-v1/scenarios/interaction-retired.json +16 -0
  163. package/fixtures/interaction-machine-v1/scenarios/interaction-stale.json +16 -0
  164. package/fixtures/interaction-machine-v1/scenarios/machine-admin-denied.json +14 -0
  165. package/fixtures/interaction-machine-v1/scenarios/machine-bound-message-create.json +22 -0
  166. package/fixtures/interaction-machine-v1/scenarios/machine-cancel-denied.json +14 -0
  167. package/fixtures/interaction-machine-v1/scenarios/machine-crash-before-ack.json +16 -0
  168. package/fixtures/interaction-machine-v1/scenarios/machine-notifier-mismatch.json +14 -0
  169. package/fixtures/interaction-machine-v1/scenarios/machine-other-message-read.json +14 -0
  170. package/fixtures/interaction-machine-v1/scenarios/machine-owned-message-read.json +22 -0
  171. package/fixtures/interaction-machine-v1/scenarios/machine-subscriber-mismatch.json +14 -0
  172. package/fixtures/interaction-machine-v1/scenarios/poll-uncommitted-cursor-rejected.json +17 -0
  173. package/fixtures/interaction-machine-v1/scenarios/project-credential-machine-endpoint-denied.json +14 -0
  174. package/fixtures/interaction-machine-v1/scenarios/quarantine-integrity-rejected.json +15 -0
  175. package/fixtures/interaction-machine-v1/scenarios/quarantine-signature-rejected.json +16 -0
  176. package/fixtures/interaction-machine-v1/scenarios/quarantine-valid.json +15 -0
  177. package/fixtures/interaction-machine-v1/scenarios/revoked-machine-credential.json +15 -0
  178. package/fixtures/interaction-machine-v1/success/ack-out-of-order.json +8 -0
  179. package/fixtures/interaction-machine-v1/success/ack-processed.json +8 -0
  180. package/fixtures/interaction-machine-v1/success/ack-quarantined.json +9 -0
  181. package/fixtures/interaction-machine-v1/success/interaction-answered-confirm.json +10 -0
  182. package/fixtures/interaction-machine-v1/success/interaction-answered-input.json +10 -0
  183. package/fixtures/interaction-machine-v1/success/interaction-answered-redacted.json +8 -0
  184. package/fixtures/interaction-machine-v1/success/interaction-answered-select.json +10 -0
  185. package/fixtures/interaction-machine-v1/success/interaction-open.json +7 -0
  186. package/fixtures/interaction-machine-v1/success/machine-client-active.json +20 -0
  187. package/fixtures/interaction-machine-v1/success/machine-client-provisioning.json +19 -0
  188. package/fixtures/interaction-machine-v1/success/machine-client-revoked.json +21 -0
  189. package/fixtures/interaction-machine-v1/success/machine-credential-active.json +13 -0
  190. package/fixtures/interaction-machine-v1/success/machine-credential-revoked.json +14 -0
  191. package/fixtures/interaction-machine-v1/success/message-interaction-open.json +33 -0
  192. package/fixtures/interaction-machine-v1/success/poll-empty.json +6 -0
  193. package/fixtures/interaction-machine-v1/success/poll-events.json +51 -0
  194. package/fixtures/interaction-machine-v1/tokens/callback-token.json +1 -0
  195. package/fixtures/whooshbang-events-v1/delivery/cases.json +418 -0
  196. package/fixtures/whooshbang-events-v1/events/agent-binding-degraded.json +17 -0
  197. package/fixtures/whooshbang-events-v1/events/interaction-expired.json +16 -0
  198. package/fixtures/whooshbang-events-v1/events/interaction-received.json +23 -0
  199. package/fixtures/whooshbang-events-v1/events/message-delivered.json +16 -0
  200. package/fixtures/whooshbang-events-v1/events/message-expired.json +15 -0
  201. package/fixtures/whooshbang-events-v1/events/message-failed.json +17 -0
  202. package/fixtures/whooshbang-events-v1/events/message-provider-accepted.json +15 -0
  203. package/fixtures/whooshbang-events-v1/events/subscription-activated.json +18 -0
  204. package/fixtures/whooshbang-events-v1/events/subscription-revoked.json +18 -0
  205. package/fixtures/whooshbang-events-v1/signing/vectors.json +852 -0
  206. package/openapi/.gitkeep +1 -0
  207. package/openapi/generated/whooshbang-v1.bundle.json +5913 -0
  208. package/openapi/whooshbang-v1.yaml +2334 -0
  209. package/package.json +63 -0
  210. package/schemas/contract-manifest.schema.json +140 -0
  211. package/schemas/core-scenario.schema.json +38 -0
  212. package/schemas/events/agent-binding-degraded-v1.schema.json +8 -0
  213. package/schemas/events/interaction-expired-v1.schema.json +8 -0
  214. package/schemas/events/interaction-received-v1.schema.json +8 -0
  215. package/schemas/events/message-delivered-v1.schema.json +8 -0
  216. package/schemas/events/message-expired-v1.schema.json +8 -0
  217. package/schemas/events/message-failed-v1.schema.json +8 -0
  218. package/schemas/events/message-provider-accepted-v1.schema.json +8 -0
  219. package/schemas/events/subscription-activated-v1.schema.json +8 -0
  220. package/schemas/events/subscription-revoked-v1.schema.json +8 -0
  221. package/schemas/events/whooshbang-event-v1.schema.json +689 -0
  222. package/schemas/fixture-index.schema.json +67 -0
  223. package/schemas/interaction-machine-scenario.schema.json +700 -0
  224. package/schemas/interaction-v1.schema.json +483 -0
  225. package/schemas/machine-v1.schema.json +430 -0
  226. package/schemas/provider-capabilities-v1.schema.json +263 -0
  227. package/schemas/webhooks/webhook-delivery-case-v1.schema.json +167 -0
  228. package/schemas/webhooks/webhook-signing-vector-v1.schema.json +197 -0
  229. package/schemas/whooshbang-v1.schema.json +2173 -0
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Generated by `npm run contracts:generate`.
3
+ * Do not edit this file directly.
4
+ */
5
+ /**
6
+ * This interface was referenced by `ContractManifest`'s JSON-Schema
7
+ * via the `definition` "contractVersion".
8
+ */
9
+ export type ContractVersion = string;
10
+ /**
11
+ * This interface was referenced by `ContractManifest`'s JSON-Schema
12
+ * via the `definition` "artifactId".
13
+ */
14
+ export type ArtifactId = string;
15
+ /**
16
+ * This interface was referenced by `ContractManifest`'s JSON-Schema
17
+ * via the `definition` "relativePath".
18
+ */
19
+ export type RelativePath = string;
20
+ /**
21
+ * Machine-verifiable index of the public artifacts owned by WhooshBang.
22
+ */
23
+ export interface ContractManifest {
24
+ schema: "flowxo.contract-manifest.v1";
25
+ artifact: "@whooshbang/contracts";
26
+ version: ContractVersion;
27
+ openapi: Artifact[];
28
+ schemas: Artifact[];
29
+ fixture_sets: FixtureSet[];
30
+ generated: GeneratedArtifact[];
31
+ compatibility: {
32
+ api_major: number;
33
+ status: "draft" | "release-candidate" | "stable" | "deprecated";
34
+ };
35
+ }
36
+ /**
37
+ * This interface was referenced by `ContractManifest`'s JSON-Schema
38
+ * via the `definition` "artifact".
39
+ */
40
+ export interface Artifact {
41
+ id: ArtifactId;
42
+ version: ContractVersion;
43
+ path: RelativePath;
44
+ }
45
+ /**
46
+ * This interface was referenced by `ContractManifest`'s JSON-Schema
47
+ * via the `definition` "fixtureSet".
48
+ */
49
+ export interface FixtureSet {
50
+ id: ArtifactId;
51
+ version: ContractVersion;
52
+ schema: RelativePath;
53
+ /**
54
+ * @minItems 1
55
+ */
56
+ fixtures: [RelativePath, ...RelativePath[]];
57
+ }
58
+ /**
59
+ * This interface was referenced by `ContractManifest`'s JSON-Schema
60
+ * via the `definition` "generatedArtifact".
61
+ */
62
+ export interface GeneratedArtifact {
63
+ id: ArtifactId;
64
+ source: RelativePath;
65
+ path: RelativePath;
66
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generated by `npm run contracts:generate`.
3
+ * Do not edit this file directly.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=contract-manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-manifest.js","sourceRoot":"","sources":["../../src/generated/contract-manifest.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Generated by `npm run contracts:generate`.
3
+ * Do not edit this file directly.
4
+ */
5
+ /**
6
+ * A deterministic C0-02 semantic, state, idempotency, or isolation scenario.
7
+ */
8
+ export interface CoreContractScenario {
9
+ contract_version: "1.0.0-rc.13";
10
+ id: string;
11
+ category: "idempotency" | "isolation" | "subscription_replay" | "message_outcome" | "cancellation" | "credential_lifecycle";
12
+ given: {
13
+ [k: string]: unknown;
14
+ };
15
+ expected: {
16
+ [k: string]: unknown;
17
+ };
18
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generated by `npm run contracts:generate`.
3
+ * Do not edit this file directly.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=core-scenario.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-scenario.js","sourceRoot":"","sources":["../../src/generated/core-scenario.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Generated by `npm run contracts:generate`.
3
+ * Do not edit this file directly.
4
+ */
5
+ /**
6
+ * The machine-readable index of deterministic C0-02 through C0-04 golden fixtures.
7
+ */
8
+ export interface CoreFixtureIndex {
9
+ contract_version: "1.0.0-rc.13";
10
+ /**
11
+ * @minItems 1
12
+ */
13
+ fixtures: [
14
+ {
15
+ id: string;
16
+ kind: "request" | "success" | "problem" | "event" | "capability" | "scenario" | "signing_vector" | "delivery_case";
17
+ path: string;
18
+ schema_ref: string;
19
+ operation_id?: string;
20
+ status_code?: number;
21
+ problem_code?: string;
22
+ },
23
+ ...{
24
+ id: string;
25
+ kind: "request" | "success" | "problem" | "event" | "capability" | "scenario" | "signing_vector" | "delivery_case";
26
+ path: string;
27
+ schema_ref: string;
28
+ operation_id?: string;
29
+ status_code?: number;
30
+ problem_code?: string;
31
+ }[]
32
+ ];
33
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generated by `npm run contracts:generate`.
3
+ * Do not edit this file directly.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=fixture-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixture-index.js","sourceRoot":"","sources":["../../src/generated/fixture-index.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,263 @@
1
+ /**
2
+ * Generated by `npm run contracts:generate`.
3
+ * Do not edit this file directly.
4
+ */
5
+ /**
6
+ * A deterministic C0-03 interaction, credential, authorization, polling, acknowledgement, or quarantine scenario.
7
+ */
8
+ export type InteractionMachineScenario = ({
9
+ category: "interaction_resolution";
10
+ given: InteractionResolutionGiven;
11
+ expected: InteractionResolutionExpected;
12
+ [k: string]: unknown;
13
+ } | {
14
+ category: "callback_token";
15
+ given: CallbackTokenGiven;
16
+ expected: CallbackTokenExpected;
17
+ [k: string]: unknown;
18
+ } | {
19
+ category: "machine_credential";
20
+ given: MachineCredentialGiven;
21
+ expected: MachineCredentialExpected;
22
+ [k: string]: unknown;
23
+ } | {
24
+ category: "machine_authorization";
25
+ given: MachineAuthorizationGiven;
26
+ expected: MachineAuthorizationExpected;
27
+ [k: string]: unknown;
28
+ } | {
29
+ category: "machine_poll";
30
+ given: MachinePollGiven;
31
+ expected: MachinePollExpected;
32
+ [k: string]: unknown;
33
+ } | {
34
+ category: "machine_ack";
35
+ given: MachineAckGiven;
36
+ expected: MachineAckExpected;
37
+ [k: string]: unknown;
38
+ } | {
39
+ category: "quarantine";
40
+ given: QuarantineGiven;
41
+ expected: QuarantineExpected;
42
+ [k: string]: unknown;
43
+ }) & {
44
+ contract_version: "1.0.0-rc.13";
45
+ id: string;
46
+ category: "interaction_resolution" | "callback_token" | "machine_credential" | "machine_authorization" | "machine_poll" | "machine_ack" | "quarantine";
47
+ given: {
48
+ [k: string]: unknown;
49
+ };
50
+ expected: {
51
+ [k: string]: unknown;
52
+ };
53
+ };
54
+ /**
55
+ * This interface was referenced by `undefined`'s JSON-Schema
56
+ * via the `definition` "MachineAuthorizationExpected".
57
+ */
58
+ export type MachineAuthorizationExpected = {
59
+ status?: number;
60
+ existence_disclosed?: false;
61
+ ack_recorded?: false;
62
+ committed_cursor?: NullableCursor;
63
+ authorized?: false;
64
+ provider_called?: false;
65
+ required_project_scope?: "messages:write" | "machine-clients:write";
66
+ resource_looked_up?: false;
67
+ machine_stream_selected?: false;
68
+ } | {
69
+ authorized: true;
70
+ target_bound: true;
71
+ provider_call_allowed: true;
72
+ } | {
73
+ authorized: true;
74
+ own_message_only: true;
75
+ message_returned: true;
76
+ };
77
+ /**
78
+ * This interface was referenced by `undefined`'s JSON-Schema
79
+ * via the `definition` "NullableCursor".
80
+ */
81
+ export type NullableCursor = string | null;
82
+ /**
83
+ * This interface was referenced by `undefined`'s JSON-Schema
84
+ * via the `definition` "MachinePollGiven".
85
+ */
86
+ export type MachinePollGiven = {
87
+ committed_cursor: NullableCursor;
88
+ polled_event_id: string;
89
+ acknowledged: boolean;
90
+ client_restarted: boolean;
91
+ } | {
92
+ committed_cursor: NullableCursor;
93
+ supplied_after: string;
94
+ supplied_cursor_issued: boolean;
95
+ supplied_cursor_committed: boolean;
96
+ };
97
+ /**
98
+ * This interface was referenced by `undefined`'s JSON-Schema
99
+ * via the `definition` "MachinePollExpected".
100
+ */
101
+ export type MachinePollExpected = {
102
+ event_repeated: boolean;
103
+ event_id: string;
104
+ committed_cursor: NullableCursor;
105
+ } | {
106
+ outcome: "cursor_mismatch";
107
+ events_returned: 0;
108
+ rewound: false;
109
+ committed_cursor: NullableCursor;
110
+ };
111
+ /**
112
+ * This interface was referenced by `undefined`'s JSON-Schema
113
+ * via the `definition` "InteractionResolutionGiven".
114
+ */
115
+ export interface InteractionResolutionGiven {
116
+ state?: "open" | "answered" | "expired" | "cancelled" | "retired";
117
+ provider_update?: "duplicate" | "late_answer";
118
+ expires_at?: string;
119
+ response_at?: string;
120
+ provider_binding_matches?: boolean;
121
+ eligible_open_inputs?: number;
122
+ exact_reply_context?: boolean;
123
+ }
124
+ /**
125
+ * This interface was referenced by `undefined`'s JSON-Schema
126
+ * via the `definition` "InteractionResolutionExpected".
127
+ */
128
+ export interface InteractionResolutionExpected {
129
+ state?: "open" | "answered" | "expired" | "cancelled" | "retired";
130
+ answers_created?: number;
131
+ events_created?: number;
132
+ outcome?: "answered" | "duplicate" | "expired" | "stale" | "identity_mismatch" | "ambiguous";
133
+ safe_diagnostic?: boolean;
134
+ trusted_provider_identity?: boolean;
135
+ routed_by_recency?: boolean;
136
+ }
137
+ /**
138
+ * This interface was referenced by `undefined`'s JSON-Schema
139
+ * via the `definition` "CallbackTokenGiven".
140
+ */
141
+ export interface CallbackTokenGiven {
142
+ token: string;
143
+ random_bytes: 16;
144
+ }
145
+ /**
146
+ * This interface was referenced by `undefined`'s JSON-Schema
147
+ * via the `definition` "CallbackTokenExpected".
148
+ */
149
+ export interface CallbackTokenExpected {
150
+ opaque: true;
151
+ contains_identity: false;
152
+ contains_answer: false;
153
+ contains_command: false;
154
+ contains_business_parameter: false;
155
+ }
156
+ /**
157
+ * This interface was referenced by `undefined`'s JSON-Schema
158
+ * via the `definition` "MachineCredentialGiven".
159
+ */
160
+ export interface MachineCredentialGiven {
161
+ same_credential_id?: boolean;
162
+ same_digest?: boolean;
163
+ new_registered?: boolean;
164
+ new_smoke_tested?: boolean;
165
+ old_revoked_after_smoke_test?: boolean;
166
+ registration_response_lost?: boolean;
167
+ client_state?: "provisioning" | "active" | "revoked";
168
+ active_credentials?: number;
169
+ registration_accepted?: boolean;
170
+ credential_status?: "active" | "revoked";
171
+ same_revocation_replayed?: boolean;
172
+ }
173
+ /**
174
+ * This interface was referenced by `undefined`'s JSON-Schema
175
+ * via the `definition` "MachineCredentialExpected".
176
+ */
177
+ export interface MachineCredentialExpected {
178
+ outcome?: "existing" | "conflict";
179
+ status?: number;
180
+ credentials_created?: number;
181
+ secret_returned?: false;
182
+ digest_returned?: false;
183
+ valid_credentials?: number;
184
+ machine_locked_out?: boolean;
185
+ old_credential_authorized?: boolean;
186
+ client_state?: "provisioning" | "active" | "revoked";
187
+ active_credentials?: number;
188
+ readable_secret_received?: false;
189
+ credential_status?: "active" | "revoked";
190
+ authorized?: false;
191
+ }
192
+ /**
193
+ * This interface was referenced by `undefined`'s JSON-Schema
194
+ * via the `definition` "MachineAuthorizationGiven".
195
+ */
196
+ export interface MachineAuthorizationGiven {
197
+ authenticated_machine_id?: string;
198
+ event_machine_id?: string;
199
+ credential_subscriber_id?: string;
200
+ request_subscriber_id?: string;
201
+ credential_notifier_id?: string;
202
+ request_notifier_id?: string;
203
+ credential_machine_client_id?: string;
204
+ message_machine_client_id?: string;
205
+ credential_kind?: "machine" | "project";
206
+ credential_status?: "active" | "revoked";
207
+ scope?: "machine-messages:write" | "machine-messages:read";
208
+ authenticated_project_id?: string;
209
+ authenticated_environment?: "test" | "live";
210
+ bound_notifier_id?: string;
211
+ bound_subscriber_id?: string;
212
+ message_project_id?: string;
213
+ message_environment?: "test" | "live";
214
+ operation_id?: string;
215
+ }
216
+ /**
217
+ * This interface was referenced by `undefined`'s JSON-Schema
218
+ * via the `definition` "MachineAckGiven".
219
+ */
220
+ export interface MachineAckGiven {
221
+ earlier_cursor?: string;
222
+ earlier_acknowledged?: boolean;
223
+ ack_cursor?: string;
224
+ event_id?: string;
225
+ cursor?: string;
226
+ disposition?: "processed" | "quarantined";
227
+ same_ack_replayed?: boolean;
228
+ recorded_disposition?: "processed" | "quarantined";
229
+ replayed_disposition?: "processed" | "quarantined";
230
+ }
231
+ /**
232
+ * This interface was referenced by `undefined`'s JSON-Schema
233
+ * via the `definition` "MachineAckExpected".
234
+ */
235
+ export interface MachineAckExpected {
236
+ ack_recorded?: boolean;
237
+ committed_cursor?: NullableCursor;
238
+ gap_skipped?: false;
239
+ outcome?: "existing" | "conflict";
240
+ status?: number;
241
+ events_skipped?: number;
242
+ committed_cursor_unchanged?: boolean;
243
+ }
244
+ /**
245
+ * This interface was referenced by `undefined`'s JSON-Schema
246
+ * via the `definition` "QuarantineGiven".
247
+ */
248
+ export interface QuarantineGiven {
249
+ schema_valid: boolean;
250
+ stream_identity_valid: boolean;
251
+ durable_reason_recorded?: boolean;
252
+ signature_valid?: boolean;
253
+ reason_code: string;
254
+ }
255
+ /**
256
+ * This interface was referenced by `undefined`'s JSON-Schema
257
+ * via the `definition` "QuarantineExpected".
258
+ */
259
+ export interface QuarantineExpected {
260
+ outcome: "recorded" | "integrity_failure";
261
+ cursor_may_advance: boolean;
262
+ ordinary_quarantine_allowed?: boolean;
263
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generated by `npm run contracts:generate`.
3
+ * Do not edit this file directly.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=interaction-machine-scenario.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interaction-machine-scenario.js","sourceRoot":"","sources":["../../src/generated/interaction-machine-scenario.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,152 @@
1
+ /**
2
+ * Generated by `npm run contracts:generate`.
3
+ * Do not edit this file directly.
4
+ */
5
+ /**
6
+ * Provider-neutral confirm, single-select, input, lifecycle, callback-token, and authenticated answer-event contracts.
7
+ */
8
+ export type InteractionV1ContractDocument = InteractionRequest | InteractionSummary | InteractionEvent | ProviderCallbackToken;
9
+ /**
10
+ * A required-type tagged union. C0 supports confirm, single-select, and input only.
11
+ */
12
+ export type InteractionRequest = ConfirmInteractionRequest | SelectInteractionRequest | InputInteractionRequest;
13
+ export type InteractionPrompt = string;
14
+ /**
15
+ * Caller-owned opaque correlation returned as data, never treated as execution authority.
16
+ */
17
+ export type InteractionCorrelationId = string;
18
+ /**
19
+ * The hosted interaction identity and first-terminal-writer state.
20
+ */
21
+ export type InteractionSummary = {
22
+ [k: string]: unknown;
23
+ } & {
24
+ id: OpaqueIdentifier;
25
+ type: "confirm" | "select" | "input";
26
+ state: InteractionState;
27
+ expires_at: Timestamp;
28
+ correlation_id?: InteractionCorrelationId;
29
+ answered_at?: Timestamp;
30
+ /**
31
+ * Whether the typed answer remains available inside its content-retention window. False preserves the answered terminal fact after answer deletion.
32
+ */
33
+ answer_retained?: boolean;
34
+ answer?: boolean | string;
35
+ };
36
+ /**
37
+ * An opaque identifier whose internal encoding is not a public promise.
38
+ */
39
+ export type OpaqueIdentifier = string;
40
+ export type InteractionState = "open" | "answered" | "expired" | "cancelled" | "retired";
41
+ export type Timestamp = string;
42
+ /**
43
+ * An authenticated, immutable human-answer fact. It is data for the consumer and never a command or proof of business success.
44
+ */
45
+ export type InteractionEvent = {
46
+ [k: string]: unknown;
47
+ } & {
48
+ schema: "whooshbang.interaction-event.v1";
49
+ id: OpaqueIdentifier;
50
+ /**
51
+ * The opaque position of this event in the authenticated machine stream.
52
+ */
53
+ cursor: string;
54
+ type: "interaction.received";
55
+ message_id: OpaqueIdentifier;
56
+ interaction_id: OpaqueIdentifier;
57
+ correlation_id?: InteractionCorrelationId;
58
+ response?: InteractionResponse;
59
+ /**
60
+ * False means the content window closed and response was removed. New retained events publish true; a retained legacy event may omit this member during rolling deployment.
61
+ */
62
+ answer_retained?: boolean;
63
+ channel_context: SafeChannelContext;
64
+ occurred_at: Timestamp;
65
+ expires_at: Timestamp;
66
+ };
67
+ export type InteractionResponse = ConfirmInteractionResponse | SelectInteractionResponse | InputInteractionResponse;
68
+ /**
69
+ * Untrusted input text after leading and trailing whitespace is removed.
70
+ */
71
+ export type TrimmedInputAnswer = string;
72
+ /**
73
+ * An opaque single-purpose reference containing exactly 128 random bits and no trusted identity, answer, command, or business data.
74
+ */
75
+ export type ProviderCallbackToken = string;
76
+ export interface ConfirmInteractionRequest {
77
+ type: "confirm";
78
+ prompt: InteractionPrompt;
79
+ confirm_label?: string;
80
+ deny_label?: string;
81
+ /**
82
+ * Must be 30 seconds through 24 hours after server acceptance.
83
+ */
84
+ expires_at: string;
85
+ correlation_id?: InteractionCorrelationId;
86
+ }
87
+ export interface SelectInteractionRequest {
88
+ type: "select";
89
+ prompt: InteractionPrompt;
90
+ /**
91
+ * @minItems 2
92
+ * @maxItems 6
93
+ */
94
+ options: [InteractionOption, InteractionOption] | [InteractionOption, InteractionOption, InteractionOption] | [
95
+ InteractionOption,
96
+ InteractionOption,
97
+ InteractionOption,
98
+ InteractionOption
99
+ ] | [
100
+ InteractionOption,
101
+ InteractionOption,
102
+ InteractionOption,
103
+ InteractionOption,
104
+ InteractionOption
105
+ ] | [
106
+ InteractionOption,
107
+ InteractionOption,
108
+ InteractionOption,
109
+ InteractionOption,
110
+ InteractionOption,
111
+ InteractionOption
112
+ ];
113
+ /**
114
+ * Must be 30 seconds through 24 hours after server acceptance.
115
+ */
116
+ expires_at: string;
117
+ correlation_id?: InteractionCorrelationId;
118
+ }
119
+ export interface InteractionOption {
120
+ /**
121
+ * Opaque customer data. It is never interpreted as a command.
122
+ */
123
+ value: string;
124
+ label: string;
125
+ }
126
+ export interface InputInteractionRequest {
127
+ type: "input";
128
+ prompt: InteractionPrompt;
129
+ /**
130
+ * Must be 30 seconds through 24 hours after server acceptance.
131
+ */
132
+ expires_at: string;
133
+ correlation_id?: InteractionCorrelationId;
134
+ }
135
+ export interface ConfirmInteractionResponse {
136
+ type: "confirm";
137
+ value: boolean;
138
+ }
139
+ export interface SelectInteractionResponse {
140
+ type: "select";
141
+ value: string;
142
+ }
143
+ export interface InputInteractionResponse {
144
+ type: "input";
145
+ value: TrimmedInputAnswer;
146
+ }
147
+ export interface SafeChannelContext {
148
+ binding_id: OpaqueIdentifier;
149
+ channel: "telegram";
150
+ conversation_kind: "private_chat" | "thread" | "group";
151
+ display_name?: string;
152
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generated by `npm run contracts:generate`.
3
+ * Do not edit this file directly.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=interaction-v1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interaction-v1.js","sourceRoot":"","sources":["../../src/generated/interaction-v1.ts"],"names":[],"mappings":"AAAA;;;GAGG"}