@lssm/lib.communication-spec 3.1.1

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 (309) hide show
  1. package/README.md +201 -0
  2. package/dist/browser/capabilities/comms-ai.capabilities.js +1 -0
  3. package/dist/browser/capabilities/communication-os.capability-ids.js +1 -0
  4. package/dist/browser/capabilities/ecosystem-messaging.capabilities.js +1 -0
  5. package/dist/browser/capabilities/index.js +1 -0
  6. package/dist/browser/commands/comms-ai.commands.js +1 -0
  7. package/dist/browser/commands/index.js +1 -0
  8. package/dist/browser/contracts/agent-communication.js +1 -0
  9. package/dist/browser/contracts/agent-lifecycle-projection.js +1 -0
  10. package/dist/browser/contracts/agent-surface-control.js +1 -0
  11. package/dist/browser/contracts/ai-assistance.operations.js +1 -0
  12. package/dist/browser/contracts/artifact-digest.js +1 -0
  13. package/dist/browser/contracts/canonical-agent-conversation.js +1 -0
  14. package/dist/browser/contracts/channel-preferences.js +1 -0
  15. package/dist/browser/contracts/channel-routing.js +1 -0
  16. package/dist/browser/contracts/collaboration.operations.js +1 -0
  17. package/dist/browser/contracts/customer-live-chat-grant.operations.js +1 -0
  18. package/dist/browser/contracts/delivery-eligibility.js +1 -0
  19. package/dist/browser/contracts/delivery-fallback-eligibility-validation.js +1 -0
  20. package/dist/browser/contracts/delivery-fallback-validation.js +1 -0
  21. package/dist/browser/contracts/delivery-fallback.js +1 -0
  22. package/dist/browser/contracts/delivery-intent-validation.js +1 -0
  23. package/dist/browser/contracts/delivery-intent.js +1 -0
  24. package/dist/browser/contracts/delivery-progress.js +1 -0
  25. package/dist/browser/contracts/discord-community-intelligence.operations.js +1 -0
  26. package/dist/browser/contracts/discord-community.events.js +1 -0
  27. package/dist/browser/contracts/discord-community.models.js +1 -0
  28. package/dist/browser/contracts/discord-community.operations.js +1 -0
  29. package/dist/browser/contracts/ecosystem-attachment.operations.js +1 -0
  30. package/dist/browser/contracts/ecosystem-auth.operations.js +1 -0
  31. package/dist/browser/contracts/ecosystem-binding.operations.js +1 -0
  32. package/dist/browser/contracts/ecosystem-connection-subscription.events.js +1 -0
  33. package/dist/browser/contracts/ecosystem-governed-work-v2.operations.js +1 -0
  34. package/dist/browser/contracts/ecosystem-governed-work.operations.js +1 -0
  35. package/dist/browser/contracts/ecosystem-identity-v3.operations.js +1 -0
  36. package/dist/browser/contracts/ecosystem-identity.operations.js +1 -0
  37. package/dist/browser/contracts/ecosystem-message.operations.js +1 -0
  38. package/dist/browser/contracts/ecosystem-messaging.dtos.js +0 -0
  39. package/dist/browser/contracts/ecosystem-messaging.events.js +1 -0
  40. package/dist/browser/contracts/ecosystem-messaging.models.js +1 -0
  41. package/dist/browser/contracts/ecosystem-navigation-v3.operations.js +1 -0
  42. package/dist/browser/contracts/ecosystem-webhook.operations.js +1 -0
  43. package/dist/browser/contracts/ecosystem-workspace.operations.js +1 -0
  44. package/dist/browser/contracts/enums.js +1 -0
  45. package/dist/browser/contracts/erasure.operations.js +1 -0
  46. package/dist/browser/contracts/events.js +1 -0
  47. package/dist/browser/contracts/index.js +1 -0
  48. package/dist/browser/contracts/ingestion.js +1 -0
  49. package/dist/browser/contracts/ingress-admission-policy.js +1 -0
  50. package/dist/browser/contracts/ingress-admission.js +1 -0
  51. package/dist/browser/contracts/models.js +1 -0
  52. package/dist/browser/contracts/operations.js +1 -0
  53. package/dist/browser/contracts/persistence.js +1 -0
  54. package/dist/browser/contracts/preference-resolution.js +1 -0
  55. package/dist/browser/contracts/query.operations.js +1 -0
  56. package/dist/browser/contracts/sequence-intent.js +1 -0
  57. package/dist/browser/contracts/sovereignty.js +1 -0
  58. package/dist/browser/contracts/support-internal-note.operations.js +1 -0
  59. package/dist/browser/contracts/thread-link-kind.js +1 -0
  60. package/dist/browser/contracts/thread-message.operations.js +1 -0
  61. package/dist/browser/events/index.js +1 -0
  62. package/dist/browser/fixtures/agent-omnichannel-primitives.js +1 -0
  63. package/dist/browser/fixtures/agent-omnichannel.js +1 -0
  64. package/dist/browser/fixtures/gtm-learning-loop-neutral.parts.js +1 -0
  65. package/dist/browser/fixtures/index.js +1 -0
  66. package/dist/browser/fixtures/normalized-ingestion.js +1 -0
  67. package/dist/browser/index.js +1 -0
  68. package/dist/browser/queries/index.js +1 -0
  69. package/dist/browser/types/domain-command.js +0 -0
  70. package/dist/browser/types/index.js +1 -0
  71. package/dist/browser/validation/domain-command.js +1 -0
  72. package/dist/browser/validation/index.js +1 -0
  73. package/dist/capabilities/comms-ai.capabilities.d.ts +72 -0
  74. package/dist/capabilities/comms-ai.capabilities.js +2 -0
  75. package/dist/capabilities/communication-os-capability-boundary.test.d.ts +1 -0
  76. package/dist/capabilities/communication-os.capability-ids.d.ts +39 -0
  77. package/dist/capabilities/communication-os.capability-ids.js +2 -0
  78. package/dist/capabilities/communication-os.capability-ids.test.d.ts +1 -0
  79. package/dist/capabilities/ecosystem-messaging.capabilities.d.ts +9 -0
  80. package/dist/capabilities/ecosystem-messaging.capabilities.js +2 -0
  81. package/dist/capabilities/index.d.ts +4 -0
  82. package/dist/capabilities/index.js +2 -0
  83. package/dist/commands/comms-ai.commands.d.ts +272 -0
  84. package/dist/commands/comms-ai.commands.js +2 -0
  85. package/dist/commands/index.d.ts +10 -0
  86. package/dist/commands/index.js +2 -0
  87. package/dist/contracts/agent-communication.d.ts +108 -0
  88. package/dist/contracts/agent-communication.js +2 -0
  89. package/dist/contracts/agent-communication.test.d.ts +1 -0
  90. package/dist/contracts/agent-lifecycle-projection.d.ts +98 -0
  91. package/dist/contracts/agent-lifecycle-projection.js +2 -0
  92. package/dist/contracts/agent-lifecycle-projection.test.d.ts +1 -0
  93. package/dist/contracts/agent-surface-control.d.ts +210 -0
  94. package/dist/contracts/agent-surface-control.js +2 -0
  95. package/dist/contracts/agent-surface-control.test.d.ts +1 -0
  96. package/dist/contracts/ai-assistance.operations.d.ts +187 -0
  97. package/dist/contracts/ai-assistance.operations.js +2 -0
  98. package/dist/contracts/artifact-digest.d.ts +3 -0
  99. package/dist/contracts/artifact-digest.js +2 -0
  100. package/dist/contracts/canonical-agent-conversation.d.ts +46 -0
  101. package/dist/contracts/canonical-agent-conversation.js +2 -0
  102. package/dist/contracts/canonical-agent-conversation.test.d.ts +1 -0
  103. package/dist/contracts/channel-preferences.d.ts +115 -0
  104. package/dist/contracts/channel-preferences.js +2 -0
  105. package/dist/contracts/channel-routing.d.ts +58 -0
  106. package/dist/contracts/channel-routing.js +2 -0
  107. package/dist/contracts/channel-routing.test.d.ts +1 -0
  108. package/dist/contracts/collaboration.operations.d.ts +315 -0
  109. package/dist/contracts/collaboration.operations.js +2 -0
  110. package/dist/contracts/customer-live-chat-grant.operations.d.ts +132 -0
  111. package/dist/contracts/customer-live-chat-grant.operations.js +2 -0
  112. package/dist/contracts/delivery-contracts.test.d.ts +1 -0
  113. package/dist/contracts/delivery-eligibility.d.ts +126 -0
  114. package/dist/contracts/delivery-eligibility.js +2 -0
  115. package/dist/contracts/delivery-eligibility.test.d.ts +1 -0
  116. package/dist/contracts/delivery-fallback-eligibility-validation.d.ts +6 -0
  117. package/dist/contracts/delivery-fallback-eligibility-validation.js +2 -0
  118. package/dist/contracts/delivery-fallback-validation.d.ts +24 -0
  119. package/dist/contracts/delivery-fallback-validation.js +2 -0
  120. package/dist/contracts/delivery-fallback.d.ts +117 -0
  121. package/dist/contracts/delivery-fallback.js +2 -0
  122. package/dist/contracts/delivery-intent-validation.d.ts +13 -0
  123. package/dist/contracts/delivery-intent-validation.js +2 -0
  124. package/dist/contracts/delivery-intent.d.ts +137 -0
  125. package/dist/contracts/delivery-intent.js +2 -0
  126. package/dist/contracts/delivery-progress.d.ts +61 -0
  127. package/dist/contracts/delivery-progress.js +2 -0
  128. package/dist/contracts/discord-community-intelligence.operations.d.ts +405 -0
  129. package/dist/contracts/discord-community-intelligence.operations.js +2 -0
  130. package/dist/contracts/discord-community.events.d.ts +162 -0
  131. package/dist/contracts/discord-community.events.js +2 -0
  132. package/dist/contracts/discord-community.models.d.ts +167 -0
  133. package/dist/contracts/discord-community.models.js +2 -0
  134. package/dist/contracts/discord-community.operations.d.ts +663 -0
  135. package/dist/contracts/discord-community.operations.js +2 -0
  136. package/dist/contracts/discord-community.test.d.ts +1 -0
  137. package/dist/contracts/ecosystem-attachment.operations.d.ts +129 -0
  138. package/dist/contracts/ecosystem-attachment.operations.js +2 -0
  139. package/dist/contracts/ecosystem-auth.operations.d.ts +345 -0
  140. package/dist/contracts/ecosystem-auth.operations.js +2 -0
  141. package/dist/contracts/ecosystem-binding.operations.d.ts +231 -0
  142. package/dist/contracts/ecosystem-binding.operations.js +2 -0
  143. package/dist/contracts/ecosystem-connection-subscription.events.d.ts +332 -0
  144. package/dist/contracts/ecosystem-connection-subscription.events.js +2 -0
  145. package/dist/contracts/ecosystem-governed-work-v2.operations.d.ts +234 -0
  146. package/dist/contracts/ecosystem-governed-work-v2.operations.js +2 -0
  147. package/dist/contracts/ecosystem-governed-work.operations.d.ts +265 -0
  148. package/dist/contracts/ecosystem-governed-work.operations.js +2 -0
  149. package/dist/contracts/ecosystem-governed-work.operations.test.d.ts +1 -0
  150. package/dist/contracts/ecosystem-identity-v3.operations.d.ts +65 -0
  151. package/dist/contracts/ecosystem-identity-v3.operations.js +2 -0
  152. package/dist/contracts/ecosystem-identity.operations.d.ts +174 -0
  153. package/dist/contracts/ecosystem-identity.operations.js +2 -0
  154. package/dist/contracts/ecosystem-identity.operations.test.d.ts +1 -0
  155. package/dist/contracts/ecosystem-message.operations.d.ts +1092 -0
  156. package/dist/contracts/ecosystem-message.operations.js +2 -0
  157. package/dist/contracts/ecosystem-messaging.dtos.d.ts +68 -0
  158. package/dist/contracts/ecosystem-messaging.dtos.js +1 -0
  159. package/dist/contracts/ecosystem-messaging.dtos.test.d.ts +1 -0
  160. package/dist/contracts/ecosystem-messaging.events.d.ts +608 -0
  161. package/dist/contracts/ecosystem-messaging.events.js +2 -0
  162. package/dist/contracts/ecosystem-messaging.models.d.ts +386 -0
  163. package/dist/contracts/ecosystem-messaging.models.js +2 -0
  164. package/dist/contracts/ecosystem-messaging.test.d.ts +1 -0
  165. package/dist/contracts/ecosystem-navigation-v3.operations.d.ts +149 -0
  166. package/dist/contracts/ecosystem-navigation-v3.operations.js +2 -0
  167. package/dist/contracts/ecosystem-webhook.operations.d.ts +187 -0
  168. package/dist/contracts/ecosystem-webhook.operations.js +2 -0
  169. package/dist/contracts/ecosystem-workspace.operations.d.ts +590 -0
  170. package/dist/contracts/ecosystem-workspace.operations.js +2 -0
  171. package/dist/contracts/enums.d.ts +9 -0
  172. package/dist/contracts/enums.js +2 -0
  173. package/dist/contracts/erasure.operations.d.ts +114 -0
  174. package/dist/contracts/erasure.operations.js +2 -0
  175. package/dist/contracts/erasure.test.d.ts +1 -0
  176. package/dist/contracts/events.d.ts +174 -0
  177. package/dist/contracts/events.js +2 -0
  178. package/dist/contracts/index.d.ts +43 -0
  179. package/dist/contracts/index.js +2 -0
  180. package/dist/contracts/ingestion.d.ts +169 -0
  181. package/dist/contracts/ingestion.js +2 -0
  182. package/dist/contracts/ingress-admission-policy.d.ts +14 -0
  183. package/dist/contracts/ingress-admission-policy.js +2 -0
  184. package/dist/contracts/ingress-admission.d.ts +184 -0
  185. package/dist/contracts/ingress-admission.js +2 -0
  186. package/dist/contracts/ingress-admission.test.d.ts +1 -0
  187. package/dist/contracts/models.d.ts +851 -0
  188. package/dist/contracts/models.js +2 -0
  189. package/dist/contracts/operations.d.ts +5 -0
  190. package/dist/contracts/operations.js +2 -0
  191. package/dist/contracts/persistence.d.ts +353 -0
  192. package/dist/contracts/persistence.js +2 -0
  193. package/dist/contracts/persistence.test.d.ts +1 -0
  194. package/dist/contracts/preference-resolution.d.ts +154 -0
  195. package/dist/contracts/preference-resolution.js +2 -0
  196. package/dist/contracts/preference-resolution.test.d.ts +1 -0
  197. package/dist/contracts/query.operations.d.ts +600 -0
  198. package/dist/contracts/query.operations.js +2 -0
  199. package/dist/contracts/sequence-intent.d.ts +103 -0
  200. package/dist/contracts/sequence-intent.js +2 -0
  201. package/dist/contracts/sequence-intent.test.d.ts +1 -0
  202. package/dist/contracts/sovereignty.d.ts +164 -0
  203. package/dist/contracts/sovereignty.js +2 -0
  204. package/dist/contracts/support-internal-note.operations.d.ts +309 -0
  205. package/dist/contracts/support-internal-note.operations.js +2 -0
  206. package/dist/contracts/support-internal-note.operations.test.d.ts +1 -0
  207. package/dist/contracts/thread-link-kind.d.ts +20 -0
  208. package/dist/contracts/thread-link-kind.js +2 -0
  209. package/dist/contracts/thread-message.operations.d.ts +485 -0
  210. package/dist/contracts/thread-message.operations.js +2 -0
  211. package/dist/events/index.d.ts +4 -0
  212. package/dist/events/index.js +2 -0
  213. package/dist/fixtures/agent-omnichannel-primitives.d.ts +240 -0
  214. package/dist/fixtures/agent-omnichannel-primitives.js +2 -0
  215. package/dist/fixtures/agent-omnichannel.d.ts +682 -0
  216. package/dist/fixtures/agent-omnichannel.js +2 -0
  217. package/dist/fixtures/agent-omnichannel.test.d.ts +1 -0
  218. package/dist/fixtures/gtm-learning-loop-neutral.parts.d.ts +20 -0
  219. package/dist/fixtures/gtm-learning-loop-neutral.parts.js +2 -0
  220. package/dist/fixtures/index.d.ts +3 -0
  221. package/dist/fixtures/index.js +2 -0
  222. package/dist/fixtures/normalized-ingestion.d.ts +102 -0
  223. package/dist/fixtures/normalized-ingestion.js +2 -0
  224. package/dist/fixtures/normalized-ingestion.test.d.ts +1 -0
  225. package/dist/index.d.ts +7 -0
  226. package/dist/index.js +2 -0
  227. package/dist/node/capabilities/comms-ai.capabilities.js +1 -0
  228. package/dist/node/capabilities/communication-os.capability-ids.js +1 -0
  229. package/dist/node/capabilities/ecosystem-messaging.capabilities.js +1 -0
  230. package/dist/node/capabilities/index.js +1 -0
  231. package/dist/node/commands/comms-ai.commands.js +1 -0
  232. package/dist/node/commands/index.js +1 -0
  233. package/dist/node/contracts/agent-communication.js +1 -0
  234. package/dist/node/contracts/agent-lifecycle-projection.js +1 -0
  235. package/dist/node/contracts/agent-surface-control.js +1 -0
  236. package/dist/node/contracts/ai-assistance.operations.js +1 -0
  237. package/dist/node/contracts/artifact-digest.js +1 -0
  238. package/dist/node/contracts/canonical-agent-conversation.js +1 -0
  239. package/dist/node/contracts/channel-preferences.js +1 -0
  240. package/dist/node/contracts/channel-routing.js +1 -0
  241. package/dist/node/contracts/collaboration.operations.js +1 -0
  242. package/dist/node/contracts/customer-live-chat-grant.operations.js +1 -0
  243. package/dist/node/contracts/delivery-eligibility.js +1 -0
  244. package/dist/node/contracts/delivery-fallback-eligibility-validation.js +1 -0
  245. package/dist/node/contracts/delivery-fallback-validation.js +1 -0
  246. package/dist/node/contracts/delivery-fallback.js +1 -0
  247. package/dist/node/contracts/delivery-intent-validation.js +1 -0
  248. package/dist/node/contracts/delivery-intent.js +1 -0
  249. package/dist/node/contracts/delivery-progress.js +1 -0
  250. package/dist/node/contracts/discord-community-intelligence.operations.js +1 -0
  251. package/dist/node/contracts/discord-community.events.js +1 -0
  252. package/dist/node/contracts/discord-community.models.js +1 -0
  253. package/dist/node/contracts/discord-community.operations.js +1 -0
  254. package/dist/node/contracts/ecosystem-attachment.operations.js +1 -0
  255. package/dist/node/contracts/ecosystem-auth.operations.js +1 -0
  256. package/dist/node/contracts/ecosystem-binding.operations.js +1 -0
  257. package/dist/node/contracts/ecosystem-connection-subscription.events.js +1 -0
  258. package/dist/node/contracts/ecosystem-governed-work-v2.operations.js +1 -0
  259. package/dist/node/contracts/ecosystem-governed-work.operations.js +1 -0
  260. package/dist/node/contracts/ecosystem-identity-v3.operations.js +1 -0
  261. package/dist/node/contracts/ecosystem-identity.operations.js +1 -0
  262. package/dist/node/contracts/ecosystem-message.operations.js +1 -0
  263. package/dist/node/contracts/ecosystem-messaging.dtos.js +0 -0
  264. package/dist/node/contracts/ecosystem-messaging.events.js +1 -0
  265. package/dist/node/contracts/ecosystem-messaging.models.js +1 -0
  266. package/dist/node/contracts/ecosystem-navigation-v3.operations.js +1 -0
  267. package/dist/node/contracts/ecosystem-webhook.operations.js +1 -0
  268. package/dist/node/contracts/ecosystem-workspace.operations.js +1 -0
  269. package/dist/node/contracts/enums.js +1 -0
  270. package/dist/node/contracts/erasure.operations.js +1 -0
  271. package/dist/node/contracts/events.js +1 -0
  272. package/dist/node/contracts/index.js +1 -0
  273. package/dist/node/contracts/ingestion.js +1 -0
  274. package/dist/node/contracts/ingress-admission-policy.js +1 -0
  275. package/dist/node/contracts/ingress-admission.js +1 -0
  276. package/dist/node/contracts/models.js +1 -0
  277. package/dist/node/contracts/operations.js +1 -0
  278. package/dist/node/contracts/persistence.js +1 -0
  279. package/dist/node/contracts/preference-resolution.js +1 -0
  280. package/dist/node/contracts/query.operations.js +1 -0
  281. package/dist/node/contracts/sequence-intent.js +1 -0
  282. package/dist/node/contracts/sovereignty.js +1 -0
  283. package/dist/node/contracts/support-internal-note.operations.js +1 -0
  284. package/dist/node/contracts/thread-link-kind.js +1 -0
  285. package/dist/node/contracts/thread-message.operations.js +1 -0
  286. package/dist/node/events/index.js +1 -0
  287. package/dist/node/fixtures/agent-omnichannel-primitives.js +1 -0
  288. package/dist/node/fixtures/agent-omnichannel.js +1 -0
  289. package/dist/node/fixtures/gtm-learning-loop-neutral.parts.js +1 -0
  290. package/dist/node/fixtures/index.js +1 -0
  291. package/dist/node/fixtures/normalized-ingestion.js +1 -0
  292. package/dist/node/index.js +1 -0
  293. package/dist/node/queries/index.js +1 -0
  294. package/dist/node/types/domain-command.js +0 -0
  295. package/dist/node/types/index.js +1 -0
  296. package/dist/node/validation/domain-command.js +1 -0
  297. package/dist/node/validation/index.js +1 -0
  298. package/dist/package-exports.test.d.ts +1 -0
  299. package/dist/queries/index.d.ts +4 -0
  300. package/dist/queries/index.js +2 -0
  301. package/dist/types/domain-command.d.ts +54 -0
  302. package/dist/types/domain-command.js +1 -0
  303. package/dist/types/index.d.ts +3 -0
  304. package/dist/types/index.js +2 -0
  305. package/dist/validation/domain-command.d.ts +3 -0
  306. package/dist/validation/domain-command.js +2 -0
  307. package/dist/validation/index.d.ts +53 -0
  308. package/dist/validation/index.js +2 -0
  309. package/package.json +1227 -0
@@ -0,0 +1,169 @@
1
+ import { z } from 'zod';
2
+ /** Built-in channels remain open to namespaced vertical/provider extensions. */
3
+ export declare const CommunicationIngestionChannelSchema: z.ZodString;
4
+ export declare const CommunicationDirectionSchema: z.ZodEnum<{
5
+ inbound: "inbound";
6
+ internal: "internal";
7
+ outbound: "outbound";
8
+ }>;
9
+ export declare const CommunicationRedactionStatusSchema: z.ZodEnum<{
10
+ applied: "applied";
11
+ not_required: "not_required";
12
+ partially_applied: "partially_applied";
13
+ pending: "pending";
14
+ }>;
15
+ /**
16
+ * Portable normalized ingestion record. Its thread, message, participant, and
17
+ * consent references point at the existing canonical CommunicationSpec models;
18
+ * ingestion does not introduce competing domain entities.
19
+ */
20
+ export declare const NormalizedCommunicationIngestionRecordSchema: z.ZodObject<{
21
+ id: z.ZodString;
22
+ schemaVersion: z.ZodLiteral<"1.0.0">;
23
+ channel: z.ZodString;
24
+ direction: z.ZodEnum<{
25
+ inbound: "inbound";
26
+ internal: "internal";
27
+ outbound: "outbound";
28
+ }>;
29
+ threadRef: z.ZodString;
30
+ messageRef: z.ZodString;
31
+ participantRefs: z.ZodArray<z.ZodString>;
32
+ observedAt: z.ZodString;
33
+ bodyNormalized: z.ZodString;
34
+ consent: z.ZodObject<{
35
+ status: z.ZodEnum<{
36
+ expired: "expired";
37
+ granted: "granted";
38
+ not_recorded: "not_recorded";
39
+ withdrawn: "withdrawn";
40
+ }>;
41
+ subjectConsentRef: z.ZodOptional<z.ZodString>;
42
+ legalBasisRef: z.ZodOptional<z.ZodString>;
43
+ }, z.core.$strict>;
44
+ redaction: z.ZodObject<{
45
+ status: z.ZodEnum<{
46
+ applied: "applied";
47
+ not_required: "not_required";
48
+ partially_applied: "partially_applied";
49
+ pending: "pending";
50
+ }>;
51
+ redactedFields: z.ZodArray<z.ZodString>;
52
+ decisionRef: z.ZodOptional<z.ZodString>;
53
+ }, z.core.$strict>;
54
+ evidenceRefs: z.ZodArray<z.ZodString>;
55
+ source: z.ZodObject<{
56
+ adapterRef: z.ZodString;
57
+ externalRecordRef: z.ZodString;
58
+ networkAccessed: z.ZodLiteral<false>;
59
+ }, z.core.$strict>;
60
+ }, z.core.$strict>;
61
+ /**
62
+ * Additive R001 bridge contract binding a normalized communication record to
63
+ * the canonical F002 tenant-governance envelope. The refinement prevents a
64
+ * record from being replayed under a governance subject other than itself.
65
+ */
66
+ export declare const TenantBoundCommunicationIngestionSchema: z.ZodObject<{
67
+ ingestion: z.ZodObject<{
68
+ id: z.ZodString;
69
+ schemaVersion: z.ZodLiteral<"1.0.0">;
70
+ channel: z.ZodString;
71
+ direction: z.ZodEnum<{
72
+ inbound: "inbound";
73
+ internal: "internal";
74
+ outbound: "outbound";
75
+ }>;
76
+ threadRef: z.ZodString;
77
+ messageRef: z.ZodString;
78
+ participantRefs: z.ZodArray<z.ZodString>;
79
+ observedAt: z.ZodString;
80
+ bodyNormalized: z.ZodString;
81
+ consent: z.ZodObject<{
82
+ status: z.ZodEnum<{
83
+ expired: "expired";
84
+ granted: "granted";
85
+ not_recorded: "not_recorded";
86
+ withdrawn: "withdrawn";
87
+ }>;
88
+ subjectConsentRef: z.ZodOptional<z.ZodString>;
89
+ legalBasisRef: z.ZodOptional<z.ZodString>;
90
+ }, z.core.$strict>;
91
+ redaction: z.ZodObject<{
92
+ status: z.ZodEnum<{
93
+ applied: "applied";
94
+ not_required: "not_required";
95
+ partially_applied: "partially_applied";
96
+ pending: "pending";
97
+ }>;
98
+ redactedFields: z.ZodArray<z.ZodString>;
99
+ decisionRef: z.ZodOptional<z.ZodString>;
100
+ }, z.core.$strict>;
101
+ evidenceRefs: z.ZodArray<z.ZodString>;
102
+ source: z.ZodObject<{
103
+ adapterRef: z.ZodString;
104
+ externalRecordRef: z.ZodString;
105
+ networkAccessed: z.ZodLiteral<false>;
106
+ }, z.core.$strict>;
107
+ }, z.core.$strict>;
108
+ governance: z.ZodObject<{
109
+ id: z.ZodString;
110
+ schemaVersion: z.ZodLiteral<"companyos.tenant-governance-envelope.v1">;
111
+ policyVersion: z.ZodString;
112
+ scope: z.ZodObject<{
113
+ tenantId: z.ZodString;
114
+ workspaceId: z.ZodString;
115
+ }, z.core.$strip>;
116
+ subjectRef: z.ZodObject<{
117
+ id: z.ZodString;
118
+ type: z.ZodString;
119
+ label: z.ZodOptional<z.ZodString>;
120
+ }, z.core.$strip>;
121
+ authority: z.ZodObject<{
122
+ derivation: z.ZodLiteral<"server_derived">;
123
+ actorPrincipalId: z.ZodString;
124
+ accountableOwnerPrincipalId: z.ZodString;
125
+ authorityEvaluationRefId: z.ZodString;
126
+ rbacDecisionRefId: z.ZodString;
127
+ }, z.core.$strip>;
128
+ dataGovernance: z.ZodObject<{
129
+ residencyRegion: z.ZodString;
130
+ residencyEvidenceRefIds: z.ZodArray<z.ZodString>;
131
+ providerResidencyVerified: z.ZodBoolean;
132
+ retentionPolicyRefId: z.ZodString;
133
+ retainUntil: z.ZodString;
134
+ legalBasis: z.ZodEnum<{
135
+ consent: "consent";
136
+ contract: "contract";
137
+ legal_obligation: "legal_obligation";
138
+ legitimate_interest: "legitimate_interest";
139
+ }>;
140
+ consentRefId: z.ZodOptional<z.ZodString>;
141
+ }, z.core.$strip>;
142
+ idempotency: z.ZodObject<{
143
+ key: z.ZodString;
144
+ scope: z.ZodLiteral<"tenant_workspace_subject">;
145
+ tenantId: z.ZodString;
146
+ workspaceId: z.ZodString;
147
+ subjectRefId: z.ZodString;
148
+ }, z.core.$strip>;
149
+ evidenceReplayRefs: z.ZodObject<{
150
+ evidenceReceiptIds: z.ZodArray<z.ZodString>;
151
+ replayPacketIds: z.ZodArray<z.ZodString>;
152
+ }, z.core.$strip>;
153
+ governanceState: z.ZodLiteral<"active">;
154
+ createdAt: z.ZodString;
155
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
156
+ }, z.core.$strip>;
157
+ }, z.core.$strict>;
158
+ export type CommunicationIngestionChannel = z.infer<typeof CommunicationIngestionChannelSchema>;
159
+ export type CommunicationDirection = z.infer<typeof CommunicationDirectionSchema>;
160
+ export type CommunicationRedactionStatus = z.infer<typeof CommunicationRedactionStatusSchema>;
161
+ export type NormalizedCommunicationIngestionRecord = z.infer<typeof NormalizedCommunicationIngestionRecordSchema>;
162
+ export type TenantBoundCommunicationIngestion = z.infer<typeof TenantBoundCommunicationIngestionSchema>;
163
+ /** Canonical models reused by the normalized ingestion envelope. */
164
+ export declare const normalizedCommunicationIngestionModelRefs: {
165
+ readonly thread: 'CommunicationThread';
166
+ readonly message: 'CommunicationMessage';
167
+ readonly participant: 'CommunicationParticipant';
168
+ readonly consent: 'SubjectConsent';
169
+ };
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{CompanyOsTenantGovernanceEnvelopeSchema as i}from"@lssm/lib.companyos-spec/types/tenant-governance-envelope";import{z as n}from"zod";var o=n.string().min(1),a=n.enum(["inbound","outbound","internal"]),c=n.enum(["not_required","pending","applied","partially_applied"]),s=n.object({id:n.string().min(1),schemaVersion:n.literal("1.0.0"),channel:o,direction:a,threadRef:n.string().min(1),messageRef:n.string().min(1),participantRefs:n.array(n.string().min(1)).min(1),observedAt:n.string().datetime(),bodyNormalized:n.string().min(1),consent:n.object({status:n.enum(["not_recorded","granted","withdrawn","expired"]),subjectConsentRef:n.string().min(1).optional(),legalBasisRef:n.string().min(1).optional()}).strict(),redaction:n.object({status:c,redactedFields:n.array(n.string().min(1)),decisionRef:n.string().min(1).optional()}).strict(),evidenceRefs:n.array(n.string().min(1)).min(1),source:n.object({adapterRef:n.string().min(1),externalRecordRef:n.string().min(1),networkAccessed:n.literal(!1)}).strict()}).strict(),u=n.object({ingestion:s,governance:i}).strict().superRefine((e,t)=>{if(e.governance.subjectRef.id!==e.ingestion.id)t.addIssue({code:"custom",path:["governance","subjectRef","id"],message:"governance subject must reference the normalized ingestion"});if(e.governance.subjectRef.type!=="communication.ingestion")t.addIssue({code:"custom",path:["governance","subjectRef","type"],message:"governance subject type must be communication.ingestion"})}),d={thread:"CommunicationThread",message:"CommunicationMessage",participant:"CommunicationParticipant",consent:"SubjectConsent"};export{a as CommunicationDirectionSchema,o as CommunicationIngestionChannelSchema,c as CommunicationRedactionStatusSchema,s as NormalizedCommunicationIngestionRecordSchema,u as TenantBoundCommunicationIngestionSchema,d as normalizedCommunicationIngestionModelRefs};
@@ -0,0 +1,14 @@
1
+ import type { CommunicationIngressAdmissionContextV1, CommunicationIngressAdmissionDecisionV1, CommunicationIngressReceiptV1 } from './ingress-admission.js';
2
+ type Classification = Pick<CommunicationIngressAdmissionDecisionV1, 'status' | 'reason'>;
3
+ /** Pure policy order: hard blocks, quarantine, mention-ignore, then admit. */
4
+ export declare function classifyCommunicationIngressAdmissionV1(context: CommunicationIngressAdmissionContextV1): Classification;
5
+ export declare function validateCommunicationIngressAdmissionBindingV1(input: {
6
+ receipt: CommunicationIngressReceiptV1;
7
+ context: CommunicationIngressAdmissionContextV1;
8
+ decision: CommunicationIngressAdmissionDecisionV1;
9
+ }): string[];
10
+ export declare function validateCommunicationIngressContextBindingV1(input: {
11
+ receipt: CommunicationIngressReceiptV1;
12
+ context: CommunicationIngressAdmissionContextV1;
13
+ }): string[];
14
+ export {};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{z as s}from"zod";var h="1.0.0",R="1.0.0",I={id:"communication-os.agent-omnichannel.v1",title:"CommunicationOS agent omnichannel contracts",body:"Provider-neutral agent profiles and lifecycle links bind applications, runs, tasks, help requests, background results, routes, preferences, policies, and evidence through opaque references. They grant no provider access or effect authority.",kind:"reference",route:"/docs/communication-os/agent-omnichannel-v1",visibility:"public"},o=s.string().trim().min(1),d=s.string().datetime({offset:!0}),u=s.string().regex(/^sha256:[a-f0-9]{64}$/),l=s.object({ref:o,digest:u}).strict(),f=l.extend({revision:s.number().int().positive()}).strict(),g=s.object({tenantRef:o,workspaceRef:o.optional(),spaceRef:o.optional(),subjectRef:o}).strict(),A=s.object({schemaVersion:s.literal(h),profileRef:o,revision:s.number().int().positive(),agentRef:o,applicationRef:o,scope:g,routeBindings:s.array(f),connectionRefs:s.array(o),preferenceSet:f,policyRefs:s.array(o).min(1),evidenceRefs:s.array(o).min(1),createdAt:d,updatedAt:d,profileDigest:u}).strict().superRefine((e,i)=>{for(let t of["connectionRefs","policyRefs","evidenceRefs"])if(new Set(e[t]).size!==e[t].length)i.addIssue({code:s.ZodIssueCode.custom,path:[t],message:`${t} must be unique`});let n=e.routeBindings.map((t)=>t.ref);if(new Set(n).size!==n.length)i.addIssue({code:s.ZodIssueCode.custom,path:["routeBindings"],message:"route bindings must be unique"})}),b=s.object({schemaVersion:s.literal(R),linkRef:o,profile:f,agentRef:o,applicationRef:o,scope:g,runRef:o.optional(),taskRef:o.optional(),helpRequestRef:o.optional(),approvalRequestRef:o.optional(),backgroundResultRef:o.optional(),canonicalConversation:l.optional(),session:f.optional(),correlationRef:o,evidenceRefs:s.array(o).min(1)}).strict().superRefine((e,i)=>{if(new Set(e.evidenceRefs).size!==e.evidenceRefs.length)i.addIssue({code:s.ZodIssueCode.custom,path:["evidenceRefs"],message:"evidenceRefs must be unique"});if(!e.runRef&&!e.taskRef&&!e.helpRequestRef&&!e.approvalRequestRef&&!e.backgroundResultRef)i.addIssue({code:s.ZodIssueCode.custom,path:["runRef"],message:"at least one run, task, help request, approval request, or background result ref is required"})});function c(e,i){return e.tenantRef===i.tenantRef&&e.workspaceRef===i.workspaceRef&&e.spaceRef===i.spaceRef&&e.subjectRef===i.subjectRef}function S(e){let i=[];for(let n of["agentRef","applicationRef"])if(e.profile[n]!==e.lifecycleLink[n])i.push(`Lifecycle ${n} does not match the agent profile`);if(e.lifecycleLink.profile.ref!==e.profile.profileRef||e.lifecycleLink.profile.revision!==e.profile.revision||e.lifecycleLink.profile.digest!==e.profile.profileDigest)i.push("Lifecycle profile binding does not match the agent profile");if(!c(e.profile.scope,e.lifecycleLink.scope))i.push("Lifecycle scope does not match the agent profile");return i}function x(e){let{intent:i,progress:n}=e,t=[];if(n.deliveryRef!==i.deliveryRef||n.intent.ref!==i.deliveryRef||n.intent.digest!==i.deliveryDigest)t.push("Progress delivery does not match the intent");if(!c(n.scope,i.scope))t.push("Progress scope does not match the intent");if(n.recipientRef!==i.recipientRefs[0])t.push("Progress recipient does not match the intent");let r=i.requestedRoutes.find((m)=>m.ref===n.route.ref);if(!r||r.revision!==n.route.revision||r.digest!==n.route.digest)t.push("Progress route was not requested by the intent");if(Date.parse(n.occurredAt)<Date.parse(i.createdAt)||Date.parse(n.occurredAt)>Date.parse(i.expiresAt))t.push("Progress occurred outside the intent validity window");return t}function C(e){if(e.connectionState!=="active")return a("connection_inactive");if(e.identityState==="revoked")return a("identity_revoked");if(e.consentState!=="valid")return a("consent_invalid");if(e.pairingState==="denied")return a("pairing_denied");if(e.membershipState==="not_member")return a("membership_denied");if(e.pairingState==="pending")return p("pairing_required");if(e.identityState!=="linked")return p("identity_unresolved");if(e.membershipState==="unknown")return p("membership_unresolved");if(e.conversationKind==="group"&&e.mentionPolicy==="required"&&!e.mentionDetected)return{status:"ignored",reason:"mention_required"};return{status:"admitted",reason:"eligible"}}function B(e){let{receipt:i,context:n,decision:t}=e,r=y({receipt:i,context:n});if(!c(i.scope,t.scope))r.push("Ingress decision scope does not match receipt");if(t.receipt.ref!==i.receiptRef||t.receipt.digest!==i.receiptDigest)r.push("Ingress decision receipt binding does not match");if(t.context.ref!==n.contextRef||t.context.digest!==n.contextDigest)r.push("Ingress decision context binding does not match");let m=C(n);if(t.status!==m.status||t.reason!==m.reason)r.push("Ingress decision does not match deterministic admission policy");return r}function y(e){let i=[];if(e.context.receipt.ref!==e.receipt.receiptRef||e.context.receipt.digest!==e.receipt.receiptDigest)i.push("Ingress context receipt binding does not match");if(!c(e.receipt.scope,e.context.scope))i.push("Ingress context scope does not match receipt");if(!v(e.receipt.connection,e.context.connection))i.push("Ingress context connection does not match receipt");if(Date.parse(e.context.evaluatedAt)<Date.parse(e.receipt.receivedAt))i.push("Ingress context predates durable receipt");return i}function v(e,i){return e.ref===i.ref&&e.revision===i.revision&&e.digest===i.digest}function a(e){return{status:"blocked",reason:e}}function p(e){return{status:"quarantined",reason:e}}export{C as classifyCommunicationIngressAdmissionV1,B as validateCommunicationIngressAdmissionBindingV1,y as validateCommunicationIngressContextBindingV1};
@@ -0,0 +1,184 @@
1
+ import { z } from 'zod';
2
+ export declare const COMMUNICATION_INGRESS_RECEIPT_V1: 'communication.ingress-receipt.v1';
3
+ export declare const COMMUNICATION_INGRESS_ADMISSION_CONTEXT_V1: 'communication.ingress-admission-context.v1';
4
+ export declare const COMMUNICATION_INGRESS_ADMISSION_DECISION_V1: 'communication.ingress-admission-decision.v1';
5
+ /** Durable metadata receipt; raw provider bytes and secrets remain adapter-private. */
6
+ export declare const CommunicationIngressReceiptV1Schema: z.ZodObject<{
7
+ schemaVersion: z.ZodLiteral<"communication.ingress-receipt.v1">;
8
+ receiptRef: z.ZodString;
9
+ receiptDigest: z.ZodString;
10
+ scope: z.ZodObject<{
11
+ tenantRef: z.ZodString;
12
+ workspaceRef: z.ZodOptional<z.ZodString>;
13
+ spaceRef: z.ZodOptional<z.ZodString>;
14
+ subjectRef: z.ZodString;
15
+ }, z.core.$strict>;
16
+ connection: z.ZodObject<{
17
+ ref: z.ZodString;
18
+ digest: z.ZodString;
19
+ revision: z.ZodNumber;
20
+ }, z.core.$strict>;
21
+ network: z.ZodString;
22
+ providerDeliveryRef: z.ZodOptional<z.ZodString>;
23
+ payloadDigest: z.ZodString;
24
+ authenticationEvidence: z.ZodObject<{
25
+ ref: z.ZodString;
26
+ digest: z.ZodString;
27
+ }, z.core.$strict>;
28
+ receivedAt: z.ZodString;
29
+ effectAuthority: z.ZodLiteral<"none">;
30
+ }, z.core.$strict>;
31
+ /** Exact deterministic inputs used after durable webhook acknowledgement. */
32
+ export declare const CommunicationIngressAdmissionContextV1Schema: z.ZodObject<{
33
+ schemaVersion: z.ZodLiteral<"communication.ingress-admission-context.v1">;
34
+ contextRef: z.ZodString;
35
+ contextDigest: z.ZodString;
36
+ receipt: z.ZodObject<{
37
+ ref: z.ZodString;
38
+ digest: z.ZodString;
39
+ }, z.core.$strict>;
40
+ scope: z.ZodObject<{
41
+ tenantRef: z.ZodString;
42
+ workspaceRef: z.ZodOptional<z.ZodString>;
43
+ spaceRef: z.ZodOptional<z.ZodString>;
44
+ subjectRef: z.ZodString;
45
+ }, z.core.$strict>;
46
+ connection: z.ZodObject<{
47
+ ref: z.ZodString;
48
+ digest: z.ZodString;
49
+ revision: z.ZodNumber;
50
+ }, z.core.$strict>;
51
+ connectionState: z.ZodEnum<{
52
+ active: "active";
53
+ revoked: "revoked";
54
+ unavailable: "unavailable";
55
+ }>;
56
+ conversationKind: z.ZodEnum<{
57
+ direct: "direct";
58
+ group: "group";
59
+ }>;
60
+ channelIdentity: z.ZodObject<{
61
+ ref: z.ZodString;
62
+ digest: z.ZodString;
63
+ revision: z.ZodNumber;
64
+ }, z.core.$strict>;
65
+ identityState: z.ZodEnum<{
66
+ linked: "linked";
67
+ pending: "pending";
68
+ revoked: "revoked";
69
+ unknown: "unknown";
70
+ }>;
71
+ identityLink: z.ZodOptional<z.ZodObject<{
72
+ ref: z.ZodString;
73
+ digest: z.ZodString;
74
+ revision: z.ZodNumber;
75
+ }, z.core.$strict>>;
76
+ resolvedPrincipalRef: z.ZodOptional<z.ZodString>;
77
+ pairingState: z.ZodEnum<{
78
+ confirmed: "confirmed";
79
+ denied: "denied";
80
+ not_required: "not_required";
81
+ pending: "pending";
82
+ }>;
83
+ pairing: z.ZodOptional<z.ZodObject<{
84
+ ref: z.ZodString;
85
+ digest: z.ZodString;
86
+ }, z.core.$strict>>;
87
+ membershipState: z.ZodEnum<{
88
+ member: "member";
89
+ not_member: "not_member";
90
+ unknown: "unknown";
91
+ }>;
92
+ membership: z.ZodOptional<z.ZodObject<{
93
+ ref: z.ZodString;
94
+ digest: z.ZodString;
95
+ revision: z.ZodNumber;
96
+ }, z.core.$strict>>;
97
+ mentionPolicy: z.ZodEnum<{
98
+ not_required: "not_required";
99
+ required: "required";
100
+ }>;
101
+ mentionDetected: z.ZodBoolean;
102
+ consentState: z.ZodEnum<{
103
+ expired: "expired";
104
+ missing: "missing";
105
+ revoked: "revoked";
106
+ valid: "valid";
107
+ }>;
108
+ policyRefs: z.ZodArray<z.ZodString>;
109
+ evidenceRefs: z.ZodArray<z.ZodString>;
110
+ evaluatedAt: z.ZodString;
111
+ }, z.core.$strict>;
112
+ export declare const CommunicationIngressAdmissionReasonV1Schema: z.ZodEnum<{
113
+ connection_inactive: "connection_inactive";
114
+ consent_invalid: "consent_invalid";
115
+ eligible: "eligible";
116
+ identity_revoked: "identity_revoked";
117
+ identity_unresolved: "identity_unresolved";
118
+ membership_denied: "membership_denied";
119
+ membership_unresolved: "membership_unresolved";
120
+ mention_required: "mention_required";
121
+ pairing_denied: "pairing_denied";
122
+ pairing_required: "pairing_required";
123
+ }>;
124
+ export declare const CommunicationIngressAdmissionDecisionV1Schema: z.ZodObject<{
125
+ schemaVersion: z.ZodLiteral<"communication.ingress-admission-decision.v1">;
126
+ decisionRef: z.ZodString;
127
+ decisionDigest: z.ZodString;
128
+ receipt: z.ZodObject<{
129
+ ref: z.ZodString;
130
+ digest: z.ZodString;
131
+ }, z.core.$strict>;
132
+ context: z.ZodObject<{
133
+ ref: z.ZodString;
134
+ digest: z.ZodString;
135
+ }, z.core.$strict>;
136
+ scope: z.ZodObject<{
137
+ tenantRef: z.ZodString;
138
+ workspaceRef: z.ZodOptional<z.ZodString>;
139
+ spaceRef: z.ZodOptional<z.ZodString>;
140
+ subjectRef: z.ZodString;
141
+ }, z.core.$strict>;
142
+ status: z.ZodEnum<{
143
+ admitted: "admitted";
144
+ blocked: "blocked";
145
+ ignored: "ignored";
146
+ quarantined: "quarantined";
147
+ }>;
148
+ reason: z.ZodEnum<{
149
+ connection_inactive: "connection_inactive";
150
+ consent_invalid: "consent_invalid";
151
+ eligible: "eligible";
152
+ identity_revoked: "identity_revoked";
153
+ identity_unresolved: "identity_unresolved";
154
+ membership_denied: "membership_denied";
155
+ membership_unresolved: "membership_unresolved";
156
+ mention_required: "mention_required";
157
+ pairing_denied: "pairing_denied";
158
+ pairing_required: "pairing_required";
159
+ }>;
160
+ canonicalConversation: z.ZodOptional<z.ZodObject<{
161
+ ref: z.ZodString;
162
+ digest: z.ZodString;
163
+ }, z.core.$strict>>;
164
+ normalizedIngestionRef: z.ZodOptional<z.ZodString>;
165
+ quarantineRef: z.ZodOptional<z.ZodString>;
166
+ decidedAt: z.ZodString;
167
+ evidenceRefs: z.ZodArray<z.ZodString>;
168
+ effectAuthority: z.ZodLiteral<"none">;
169
+ }, z.core.$strict>;
170
+ export type CommunicationIngressReceiptV1 = z.infer<typeof CommunicationIngressReceiptV1Schema>;
171
+ export type CommunicationIngressAdmissionContextV1 = z.infer<typeof CommunicationIngressAdmissionContextV1Schema>;
172
+ export type CommunicationIngressAdmissionDecisionV1 = z.infer<typeof CommunicationIngressAdmissionDecisionV1Schema>;
173
+ export declare function digestCommunicationIngressReceiptV1(receipt: Omit<CommunicationIngressReceiptV1, 'receiptDigest'>): Promise<`sha256:${string}`>;
174
+ export declare function digestCommunicationIngressAdmissionContextV1(context: Omit<CommunicationIngressAdmissionContextV1, 'contextDigest'>): Promise<`sha256:${string}`>;
175
+ export declare function digestCommunicationIngressAdmissionDecisionV1(decision: Omit<CommunicationIngressAdmissionDecisionV1, 'decisionDigest'>): Promise<`sha256:${string}`>;
176
+ export declare function verifyCommunicationIngressArtifactDigestsV1(input: {
177
+ receipt: CommunicationIngressReceiptV1;
178
+ context: CommunicationIngressAdmissionContextV1;
179
+ decision: CommunicationIngressAdmissionDecisionV1;
180
+ }): Promise<boolean>;
181
+ export declare function verifyCommunicationIngressReceiptV1(receipt: CommunicationIngressReceiptV1): Promise<boolean>;
182
+ export declare function verifyCommunicationIngressAdmissionContextV1(context: CommunicationIngressAdmissionContextV1): Promise<boolean>;
183
+ export declare function verifyCommunicationIngressAdmissionDecisionV1(decision: CommunicationIngressAdmissionDecisionV1): Promise<boolean>;
184
+ export { classifyCommunicationIngressAdmissionV1, validateCommunicationIngressAdmissionBindingV1, validateCommunicationIngressContextBindingV1, } from './ingress-admission-policy.js';
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{z as o}from"zod";import{z as r}from"zod";var S="1.0.0",x="1.0.0",j={id:"communication-os.agent-omnichannel.v1",title:"CommunicationOS agent omnichannel contracts",body:"Provider-neutral agent profiles and lifecycle links bind applications, runs, tasks, help requests, background results, routes, preferences, policies, and evidence through opaque references. They grant no provider access or effect authority.",kind:"reference",route:"/docs/communication-os/agent-omnichannel-v1",visibility:"public"},s=r.string().trim().min(1),V=r.string().datetime({offset:!0}),d=r.string().regex(/^sha256:[a-f0-9]{64}$/),p=r.object({ref:s,digest:d}).strict(),m=p.extend({revision:r.number().int().positive()}).strict(),g=r.object({tenantRef:s,workspaceRef:s.optional(),spaceRef:s.optional(),subjectRef:s}).strict(),M=r.object({schemaVersion:r.literal(S),profileRef:s,revision:r.number().int().positive(),agentRef:s,applicationRef:s,scope:g,routeBindings:r.array(m),connectionRefs:r.array(s),preferenceSet:m,policyRefs:r.array(s).min(1),evidenceRefs:r.array(s).min(1),createdAt:V,updatedAt:V,profileDigest:d}).strict().superRefine((e,i)=>{for(let t of["connectionRefs","policyRefs","evidenceRefs"])if(new Set(e[t]).size!==e[t].length)i.addIssue({code:r.ZodIssueCode.custom,path:[t],message:`${t} must be unique`});let n=e.routeBindings.map((t)=>t.ref);if(new Set(n).size!==n.length)i.addIssue({code:r.ZodIssueCode.custom,path:["routeBindings"],message:"route bindings must be unique"})}),T=r.object({schemaVersion:r.literal(x),linkRef:s,profile:m,agentRef:s,applicationRef:s,scope:g,runRef:s.optional(),taskRef:s.optional(),helpRequestRef:s.optional(),approvalRequestRef:s.optional(),backgroundResultRef:s.optional(),canonicalConversation:p.optional(),session:m.optional(),correlationRef:s,evidenceRefs:r.array(s).min(1)}).strict().superRefine((e,i)=>{if(new Set(e.evidenceRefs).size!==e.evidenceRefs.length)i.addIssue({code:r.ZodIssueCode.custom,path:["evidenceRefs"],message:"evidenceRefs must be unique"});if(!e.runRef&&!e.taskRef&&!e.helpRequestRef&&!e.approvalRequestRef&&!e.backgroundResultRef)i.addIssue({code:r.ZodIssueCode.custom,path:["runRef"],message:"at least one run, task, help request, approval request, or background result ref is required"})});function l(e,i){return e.tenantRef===i.tenantRef&&e.workspaceRef===i.workspaceRef&&e.spaceRef===i.spaceRef&&e.subjectRef===i.subjectRef}function U(e){let i=[];for(let n of["agentRef","applicationRef"])if(e.profile[n]!==e.lifecycleLink[n])i.push(`Lifecycle ${n} does not match the agent profile`);if(e.lifecycleLink.profile.ref!==e.profile.profileRef||e.lifecycleLink.profile.revision!==e.profile.revision||e.lifecycleLink.profile.digest!==e.profile.profileDigest)i.push("Lifecycle profile binding does not match the agent profile");if(!l(e.profile.scope,e.lifecycleLink.scope))i.push("Lifecycle scope does not match the agent profile");return i}function Z(e){let{intent:i,progress:n}=e,t=[];if(n.deliveryRef!==i.deliveryRef||n.intent.ref!==i.deliveryRef||n.intent.digest!==i.deliveryDigest)t.push("Progress delivery does not match the intent");if(!l(n.scope,i.scope))t.push("Progress scope does not match the intent");if(n.recipientRef!==i.recipientRefs[0])t.push("Progress recipient does not match the intent");let c=i.requestedRoutes.find((f)=>f.ref===n.route.ref);if(!c||c.revision!==n.route.revision||c.digest!==n.route.digest)t.push("Progress route was not requested by the intent");if(Date.parse(n.occurredAt)<Date.parse(i.createdAt)||Date.parse(n.occurredAt)>Date.parse(i.expiresAt))t.push("Progress occurred outside the intent validity window");return t}async function y(e){let i=new TextEncoder().encode(h(e)),n=new Uint8Array(i.byteLength);n.set(i);let t=await crypto.subtle.digest("SHA-256",n.buffer),c=Array.from(new Uint8Array(t),(f)=>f.toString(16).padStart(2,"0")).join("");return d.parse(`sha256:${c}`)}function h(e){if(Array.isArray(e))return`[${e.map(h).join(",")}]`;if(e&&typeof e==="object")return`{${Object.entries(e).sort(([i],[n])=>i.localeCompare(n)).map(([i,n])=>`${JSON.stringify(i)}:${h(n)}`).join(",")}}`;return JSON.stringify(e)}function v(e){if(e.connectionState!=="active")return C("connection_inactive");if(e.identityState==="revoked")return C("identity_revoked");if(e.consentState!=="valid")return C("consent_invalid");if(e.pairingState==="denied")return C("pairing_denied");if(e.membershipState==="not_member")return C("membership_denied");if(e.pairingState==="pending")return R("pairing_required");if(e.identityState!=="linked")return R("identity_unresolved");if(e.membershipState==="unknown")return R("membership_unresolved");if(e.conversationKind==="group"&&e.mentionPolicy==="required"&&!e.mentionDetected)return{status:"ignored",reason:"mention_required"};return{status:"admitted",reason:"eligible"}}function b(e){let{receipt:i,context:n,decision:t}=e,c=A({receipt:i,context:n});if(!l(i.scope,t.scope))c.push("Ingress decision scope does not match receipt");if(t.receipt.ref!==i.receiptRef||t.receipt.digest!==i.receiptDigest)c.push("Ingress decision receipt binding does not match");if(t.context.ref!==n.contextRef||t.context.digest!==n.contextDigest)c.push("Ingress decision context binding does not match");let f=v(n);if(t.status!==f.status||t.reason!==f.reason)c.push("Ingress decision does not match deterministic admission policy");return c}function A(e){let i=[];if(e.context.receipt.ref!==e.receipt.receiptRef||e.context.receipt.digest!==e.receipt.receiptDigest)i.push("Ingress context receipt binding does not match");if(!l(e.receipt.scope,e.context.scope))i.push("Ingress context scope does not match receipt");if(!D(e.receipt.connection,e.context.connection))i.push("Ingress context connection does not match receipt");if(Date.parse(e.context.evaluatedAt)<Date.parse(e.receipt.receivedAt))i.push("Ingress context predates durable receipt");return i}function D(e,i){return e.ref===i.ref&&e.revision===i.revision&&e.digest===i.digest}function C(e){return{status:"blocked",reason:e}}function R(e){return{status:"quarantined",reason:e}}var k="communication.ingress-receipt.v1",_="communication.ingress-admission-context.v1",q="communication.ingress-admission-decision.v1",a=o.string().trim().min(1),I=o.string().datetime({offset:!0}),W=o.object({schemaVersion:o.literal(k),receiptRef:a,receiptDigest:d,scope:g,connection:m,network:a,providerDeliveryRef:a.optional(),payloadDigest:d,authenticationEvidence:p,receivedAt:I,effectAuthority:o.literal("none")}).strict(),ee=o.object({schemaVersion:o.literal(_),contextRef:a,contextDigest:d,receipt:p,scope:g,connection:m,connectionState:o.enum(["active","revoked","unavailable"]),conversationKind:o.enum(["direct","group"]),channelIdentity:m,identityState:o.enum(["linked","pending","unknown","revoked"]),identityLink:m.optional(),resolvedPrincipalRef:a.optional(),pairingState:o.enum(["not_required","confirmed","pending","denied"]),pairing:p.optional(),membershipState:o.enum(["member","not_member","unknown"]),membership:m.optional(),mentionPolicy:o.enum(["not_required","required"]),mentionDetected:o.boolean(),consentState:o.enum(["valid","missing","revoked","expired"]),policyRefs:o.array(a).min(1),evidenceRefs:o.array(a).min(1),evaluatedAt:I}).strict().superRefine((e,i)=>{for(let t of["policyRefs","evidenceRefs"])if(new Set(e[t]).size!==e[t].length)i.addIssue({code:o.ZodIssueCode.custom,path:[t],message:`${t} must be unique`});let n=e.identityState==="linked"||e.identityState==="revoked";if(n!==Boolean(e.identityLink))u(i,"identityLink","linked or revoked identity requires its exact identity link");if(n!==Boolean(e.resolvedPrincipalRef))u(i,"resolvedPrincipalRef","linked or revoked identity requires its resolved principal");if(e.pairingState!=="not_required"!==Boolean(e.pairing))u(i,"pairing","pairing state requires its exact evidence binding");if(e.membershipState!=="unknown"!==Boolean(e.membership))u(i,"membership","membership state requires its exact membership binding")}),B=o.enum(["eligible","connection_inactive","identity_revoked","consent_invalid","pairing_denied","membership_denied","pairing_required","identity_unresolved","membership_unresolved","mention_required"]),ie=o.object({schemaVersion:o.literal(q),decisionRef:a,decisionDigest:d,receipt:p,context:p,scope:g,status:o.enum(["admitted","quarantined","ignored","blocked"]),reason:B,canonicalConversation:p.optional(),normalizedIngestionRef:a.optional(),quarantineRef:a.optional(),decidedAt:I,evidenceRefs:o.array(a).min(1),effectAuthority:o.literal("none")}).strict().superRefine((e,i)=>{let n=e.status==="admitted";if(n!==Boolean(e.canonicalConversation))u(i,"canonicalConversation","only admission binds a conversation");if(n!==Boolean(e.normalizedIngestionRef))u(i,"normalizedIngestionRef","only admission binds normalized ingestion");if(e.status==="quarantined"!==Boolean(e.quarantineRef))u(i,"quarantineRef","only quarantine requires a quarantine ref")});async function P(e){return y(e)}async function w(e){return y(e)}async function L(e){return y(e)}async function ne(e){return await N(e.receipt)&&await O(e.context)&&await E(e.decision)}async function N(e){let{receiptDigest:i,...n}=e;return i===await P(n)}async function O(e){let{contextDigest:i,...n}=e;return i===await w(n)}async function E(e){let{decisionDigest:i,...n}=e;return i===await L(n)}function u(e,i,n){e.addIssue({code:o.ZodIssueCode.custom,path:[i],message:n})}export{_ as COMMUNICATION_INGRESS_ADMISSION_CONTEXT_V1,q as COMMUNICATION_INGRESS_ADMISSION_DECISION_V1,k as COMMUNICATION_INGRESS_RECEIPT_V1,ee as CommunicationIngressAdmissionContextV1Schema,ie as CommunicationIngressAdmissionDecisionV1Schema,B as CommunicationIngressAdmissionReasonV1Schema,W as CommunicationIngressReceiptV1Schema,v as classifyCommunicationIngressAdmissionV1,w as digestCommunicationIngressAdmissionContextV1,L as digestCommunicationIngressAdmissionDecisionV1,P as digestCommunicationIngressReceiptV1,b as validateCommunicationIngressAdmissionBindingV1,A as validateCommunicationIngressContextBindingV1,O as verifyCommunicationIngressAdmissionContextV1,E as verifyCommunicationIngressAdmissionDecisionV1,ne as verifyCommunicationIngressArtifactDigestsV1,N as verifyCommunicationIngressReceiptV1};
@@ -0,0 +1 @@
1
+ export {};