@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.
- package/README.md +201 -0
- package/dist/browser/capabilities/comms-ai.capabilities.js +1 -0
- package/dist/browser/capabilities/communication-os.capability-ids.js +1 -0
- package/dist/browser/capabilities/ecosystem-messaging.capabilities.js +1 -0
- package/dist/browser/capabilities/index.js +1 -0
- package/dist/browser/commands/comms-ai.commands.js +1 -0
- package/dist/browser/commands/index.js +1 -0
- package/dist/browser/contracts/agent-communication.js +1 -0
- package/dist/browser/contracts/agent-lifecycle-projection.js +1 -0
- package/dist/browser/contracts/agent-surface-control.js +1 -0
- package/dist/browser/contracts/ai-assistance.operations.js +1 -0
- package/dist/browser/contracts/artifact-digest.js +1 -0
- package/dist/browser/contracts/canonical-agent-conversation.js +1 -0
- package/dist/browser/contracts/channel-preferences.js +1 -0
- package/dist/browser/contracts/channel-routing.js +1 -0
- package/dist/browser/contracts/collaboration.operations.js +1 -0
- package/dist/browser/contracts/customer-live-chat-grant.operations.js +1 -0
- package/dist/browser/contracts/delivery-eligibility.js +1 -0
- package/dist/browser/contracts/delivery-fallback-eligibility-validation.js +1 -0
- package/dist/browser/contracts/delivery-fallback-validation.js +1 -0
- package/dist/browser/contracts/delivery-fallback.js +1 -0
- package/dist/browser/contracts/delivery-intent-validation.js +1 -0
- package/dist/browser/contracts/delivery-intent.js +1 -0
- package/dist/browser/contracts/delivery-progress.js +1 -0
- package/dist/browser/contracts/discord-community-intelligence.operations.js +1 -0
- package/dist/browser/contracts/discord-community.events.js +1 -0
- package/dist/browser/contracts/discord-community.models.js +1 -0
- package/dist/browser/contracts/discord-community.operations.js +1 -0
- package/dist/browser/contracts/ecosystem-attachment.operations.js +1 -0
- package/dist/browser/contracts/ecosystem-auth.operations.js +1 -0
- package/dist/browser/contracts/ecosystem-binding.operations.js +1 -0
- package/dist/browser/contracts/ecosystem-connection-subscription.events.js +1 -0
- package/dist/browser/contracts/ecosystem-governed-work-v2.operations.js +1 -0
- package/dist/browser/contracts/ecosystem-governed-work.operations.js +1 -0
- package/dist/browser/contracts/ecosystem-identity-v3.operations.js +1 -0
- package/dist/browser/contracts/ecosystem-identity.operations.js +1 -0
- package/dist/browser/contracts/ecosystem-message.operations.js +1 -0
- package/dist/browser/contracts/ecosystem-messaging.dtos.js +0 -0
- package/dist/browser/contracts/ecosystem-messaging.events.js +1 -0
- package/dist/browser/contracts/ecosystem-messaging.models.js +1 -0
- package/dist/browser/contracts/ecosystem-navigation-v3.operations.js +1 -0
- package/dist/browser/contracts/ecosystem-webhook.operations.js +1 -0
- package/dist/browser/contracts/ecosystem-workspace.operations.js +1 -0
- package/dist/browser/contracts/enums.js +1 -0
- package/dist/browser/contracts/erasure.operations.js +1 -0
- package/dist/browser/contracts/events.js +1 -0
- package/dist/browser/contracts/index.js +1 -0
- package/dist/browser/contracts/ingestion.js +1 -0
- package/dist/browser/contracts/ingress-admission-policy.js +1 -0
- package/dist/browser/contracts/ingress-admission.js +1 -0
- package/dist/browser/contracts/models.js +1 -0
- package/dist/browser/contracts/operations.js +1 -0
- package/dist/browser/contracts/persistence.js +1 -0
- package/dist/browser/contracts/preference-resolution.js +1 -0
- package/dist/browser/contracts/query.operations.js +1 -0
- package/dist/browser/contracts/sequence-intent.js +1 -0
- package/dist/browser/contracts/sovereignty.js +1 -0
- package/dist/browser/contracts/support-internal-note.operations.js +1 -0
- package/dist/browser/contracts/thread-link-kind.js +1 -0
- package/dist/browser/contracts/thread-message.operations.js +1 -0
- package/dist/browser/events/index.js +1 -0
- package/dist/browser/fixtures/agent-omnichannel-primitives.js +1 -0
- package/dist/browser/fixtures/agent-omnichannel.js +1 -0
- package/dist/browser/fixtures/gtm-learning-loop-neutral.parts.js +1 -0
- package/dist/browser/fixtures/index.js +1 -0
- package/dist/browser/fixtures/normalized-ingestion.js +1 -0
- package/dist/browser/index.js +1 -0
- package/dist/browser/queries/index.js +1 -0
- package/dist/browser/types/domain-command.js +0 -0
- package/dist/browser/types/index.js +1 -0
- package/dist/browser/validation/domain-command.js +1 -0
- package/dist/browser/validation/index.js +1 -0
- package/dist/capabilities/comms-ai.capabilities.d.ts +72 -0
- package/dist/capabilities/comms-ai.capabilities.js +2 -0
- package/dist/capabilities/communication-os-capability-boundary.test.d.ts +1 -0
- package/dist/capabilities/communication-os.capability-ids.d.ts +39 -0
- package/dist/capabilities/communication-os.capability-ids.js +2 -0
- package/dist/capabilities/communication-os.capability-ids.test.d.ts +1 -0
- package/dist/capabilities/ecosystem-messaging.capabilities.d.ts +9 -0
- package/dist/capabilities/ecosystem-messaging.capabilities.js +2 -0
- package/dist/capabilities/index.d.ts +4 -0
- package/dist/capabilities/index.js +2 -0
- package/dist/commands/comms-ai.commands.d.ts +272 -0
- package/dist/commands/comms-ai.commands.js +2 -0
- package/dist/commands/index.d.ts +10 -0
- package/dist/commands/index.js +2 -0
- package/dist/contracts/agent-communication.d.ts +108 -0
- package/dist/contracts/agent-communication.js +2 -0
- package/dist/contracts/agent-communication.test.d.ts +1 -0
- package/dist/contracts/agent-lifecycle-projection.d.ts +98 -0
- package/dist/contracts/agent-lifecycle-projection.js +2 -0
- package/dist/contracts/agent-lifecycle-projection.test.d.ts +1 -0
- package/dist/contracts/agent-surface-control.d.ts +210 -0
- package/dist/contracts/agent-surface-control.js +2 -0
- package/dist/contracts/agent-surface-control.test.d.ts +1 -0
- package/dist/contracts/ai-assistance.operations.d.ts +187 -0
- package/dist/contracts/ai-assistance.operations.js +2 -0
- package/dist/contracts/artifact-digest.d.ts +3 -0
- package/dist/contracts/artifact-digest.js +2 -0
- package/dist/contracts/canonical-agent-conversation.d.ts +46 -0
- package/dist/contracts/canonical-agent-conversation.js +2 -0
- package/dist/contracts/canonical-agent-conversation.test.d.ts +1 -0
- package/dist/contracts/channel-preferences.d.ts +115 -0
- package/dist/contracts/channel-preferences.js +2 -0
- package/dist/contracts/channel-routing.d.ts +58 -0
- package/dist/contracts/channel-routing.js +2 -0
- package/dist/contracts/channel-routing.test.d.ts +1 -0
- package/dist/contracts/collaboration.operations.d.ts +315 -0
- package/dist/contracts/collaboration.operations.js +2 -0
- package/dist/contracts/customer-live-chat-grant.operations.d.ts +132 -0
- package/dist/contracts/customer-live-chat-grant.operations.js +2 -0
- package/dist/contracts/delivery-contracts.test.d.ts +1 -0
- package/dist/contracts/delivery-eligibility.d.ts +126 -0
- package/dist/contracts/delivery-eligibility.js +2 -0
- package/dist/contracts/delivery-eligibility.test.d.ts +1 -0
- package/dist/contracts/delivery-fallback-eligibility-validation.d.ts +6 -0
- package/dist/contracts/delivery-fallback-eligibility-validation.js +2 -0
- package/dist/contracts/delivery-fallback-validation.d.ts +24 -0
- package/dist/contracts/delivery-fallback-validation.js +2 -0
- package/dist/contracts/delivery-fallback.d.ts +117 -0
- package/dist/contracts/delivery-fallback.js +2 -0
- package/dist/contracts/delivery-intent-validation.d.ts +13 -0
- package/dist/contracts/delivery-intent-validation.js +2 -0
- package/dist/contracts/delivery-intent.d.ts +137 -0
- package/dist/contracts/delivery-intent.js +2 -0
- package/dist/contracts/delivery-progress.d.ts +61 -0
- package/dist/contracts/delivery-progress.js +2 -0
- package/dist/contracts/discord-community-intelligence.operations.d.ts +405 -0
- package/dist/contracts/discord-community-intelligence.operations.js +2 -0
- package/dist/contracts/discord-community.events.d.ts +162 -0
- package/dist/contracts/discord-community.events.js +2 -0
- package/dist/contracts/discord-community.models.d.ts +167 -0
- package/dist/contracts/discord-community.models.js +2 -0
- package/dist/contracts/discord-community.operations.d.ts +663 -0
- package/dist/contracts/discord-community.operations.js +2 -0
- package/dist/contracts/discord-community.test.d.ts +1 -0
- package/dist/contracts/ecosystem-attachment.operations.d.ts +129 -0
- package/dist/contracts/ecosystem-attachment.operations.js +2 -0
- package/dist/contracts/ecosystem-auth.operations.d.ts +345 -0
- package/dist/contracts/ecosystem-auth.operations.js +2 -0
- package/dist/contracts/ecosystem-binding.operations.d.ts +231 -0
- package/dist/contracts/ecosystem-binding.operations.js +2 -0
- package/dist/contracts/ecosystem-connection-subscription.events.d.ts +332 -0
- package/dist/contracts/ecosystem-connection-subscription.events.js +2 -0
- package/dist/contracts/ecosystem-governed-work-v2.operations.d.ts +234 -0
- package/dist/contracts/ecosystem-governed-work-v2.operations.js +2 -0
- package/dist/contracts/ecosystem-governed-work.operations.d.ts +265 -0
- package/dist/contracts/ecosystem-governed-work.operations.js +2 -0
- package/dist/contracts/ecosystem-governed-work.operations.test.d.ts +1 -0
- package/dist/contracts/ecosystem-identity-v3.operations.d.ts +65 -0
- package/dist/contracts/ecosystem-identity-v3.operations.js +2 -0
- package/dist/contracts/ecosystem-identity.operations.d.ts +174 -0
- package/dist/contracts/ecosystem-identity.operations.js +2 -0
- package/dist/contracts/ecosystem-identity.operations.test.d.ts +1 -0
- package/dist/contracts/ecosystem-message.operations.d.ts +1092 -0
- package/dist/contracts/ecosystem-message.operations.js +2 -0
- package/dist/contracts/ecosystem-messaging.dtos.d.ts +68 -0
- package/dist/contracts/ecosystem-messaging.dtos.js +1 -0
- package/dist/contracts/ecosystem-messaging.dtos.test.d.ts +1 -0
- package/dist/contracts/ecosystem-messaging.events.d.ts +608 -0
- package/dist/contracts/ecosystem-messaging.events.js +2 -0
- package/dist/contracts/ecosystem-messaging.models.d.ts +386 -0
- package/dist/contracts/ecosystem-messaging.models.js +2 -0
- package/dist/contracts/ecosystem-messaging.test.d.ts +1 -0
- package/dist/contracts/ecosystem-navigation-v3.operations.d.ts +149 -0
- package/dist/contracts/ecosystem-navigation-v3.operations.js +2 -0
- package/dist/contracts/ecosystem-webhook.operations.d.ts +187 -0
- package/dist/contracts/ecosystem-webhook.operations.js +2 -0
- package/dist/contracts/ecosystem-workspace.operations.d.ts +590 -0
- package/dist/contracts/ecosystem-workspace.operations.js +2 -0
- package/dist/contracts/enums.d.ts +9 -0
- package/dist/contracts/enums.js +2 -0
- package/dist/contracts/erasure.operations.d.ts +114 -0
- package/dist/contracts/erasure.operations.js +2 -0
- package/dist/contracts/erasure.test.d.ts +1 -0
- package/dist/contracts/events.d.ts +174 -0
- package/dist/contracts/events.js +2 -0
- package/dist/contracts/index.d.ts +43 -0
- package/dist/contracts/index.js +2 -0
- package/dist/contracts/ingestion.d.ts +169 -0
- package/dist/contracts/ingestion.js +2 -0
- package/dist/contracts/ingress-admission-policy.d.ts +14 -0
- package/dist/contracts/ingress-admission-policy.js +2 -0
- package/dist/contracts/ingress-admission.d.ts +184 -0
- package/dist/contracts/ingress-admission.js +2 -0
- package/dist/contracts/ingress-admission.test.d.ts +1 -0
- package/dist/contracts/models.d.ts +851 -0
- package/dist/contracts/models.js +2 -0
- package/dist/contracts/operations.d.ts +5 -0
- package/dist/contracts/operations.js +2 -0
- package/dist/contracts/persistence.d.ts +353 -0
- package/dist/contracts/persistence.js +2 -0
- package/dist/contracts/persistence.test.d.ts +1 -0
- package/dist/contracts/preference-resolution.d.ts +154 -0
- package/dist/contracts/preference-resolution.js +2 -0
- package/dist/contracts/preference-resolution.test.d.ts +1 -0
- package/dist/contracts/query.operations.d.ts +600 -0
- package/dist/contracts/query.operations.js +2 -0
- package/dist/contracts/sequence-intent.d.ts +103 -0
- package/dist/contracts/sequence-intent.js +2 -0
- package/dist/contracts/sequence-intent.test.d.ts +1 -0
- package/dist/contracts/sovereignty.d.ts +164 -0
- package/dist/contracts/sovereignty.js +2 -0
- package/dist/contracts/support-internal-note.operations.d.ts +309 -0
- package/dist/contracts/support-internal-note.operations.js +2 -0
- package/dist/contracts/support-internal-note.operations.test.d.ts +1 -0
- package/dist/contracts/thread-link-kind.d.ts +20 -0
- package/dist/contracts/thread-link-kind.js +2 -0
- package/dist/contracts/thread-message.operations.d.ts +485 -0
- package/dist/contracts/thread-message.operations.js +2 -0
- package/dist/events/index.d.ts +4 -0
- package/dist/events/index.js +2 -0
- package/dist/fixtures/agent-omnichannel-primitives.d.ts +240 -0
- package/dist/fixtures/agent-omnichannel-primitives.js +2 -0
- package/dist/fixtures/agent-omnichannel.d.ts +682 -0
- package/dist/fixtures/agent-omnichannel.js +2 -0
- package/dist/fixtures/agent-omnichannel.test.d.ts +1 -0
- package/dist/fixtures/gtm-learning-loop-neutral.parts.d.ts +20 -0
- package/dist/fixtures/gtm-learning-loop-neutral.parts.js +2 -0
- package/dist/fixtures/index.d.ts +3 -0
- package/dist/fixtures/index.js +2 -0
- package/dist/fixtures/normalized-ingestion.d.ts +102 -0
- package/dist/fixtures/normalized-ingestion.js +2 -0
- package/dist/fixtures/normalized-ingestion.test.d.ts +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +2 -0
- package/dist/node/capabilities/comms-ai.capabilities.js +1 -0
- package/dist/node/capabilities/communication-os.capability-ids.js +1 -0
- package/dist/node/capabilities/ecosystem-messaging.capabilities.js +1 -0
- package/dist/node/capabilities/index.js +1 -0
- package/dist/node/commands/comms-ai.commands.js +1 -0
- package/dist/node/commands/index.js +1 -0
- package/dist/node/contracts/agent-communication.js +1 -0
- package/dist/node/contracts/agent-lifecycle-projection.js +1 -0
- package/dist/node/contracts/agent-surface-control.js +1 -0
- package/dist/node/contracts/ai-assistance.operations.js +1 -0
- package/dist/node/contracts/artifact-digest.js +1 -0
- package/dist/node/contracts/canonical-agent-conversation.js +1 -0
- package/dist/node/contracts/channel-preferences.js +1 -0
- package/dist/node/contracts/channel-routing.js +1 -0
- package/dist/node/contracts/collaboration.operations.js +1 -0
- package/dist/node/contracts/customer-live-chat-grant.operations.js +1 -0
- package/dist/node/contracts/delivery-eligibility.js +1 -0
- package/dist/node/contracts/delivery-fallback-eligibility-validation.js +1 -0
- package/dist/node/contracts/delivery-fallback-validation.js +1 -0
- package/dist/node/contracts/delivery-fallback.js +1 -0
- package/dist/node/contracts/delivery-intent-validation.js +1 -0
- package/dist/node/contracts/delivery-intent.js +1 -0
- package/dist/node/contracts/delivery-progress.js +1 -0
- package/dist/node/contracts/discord-community-intelligence.operations.js +1 -0
- package/dist/node/contracts/discord-community.events.js +1 -0
- package/dist/node/contracts/discord-community.models.js +1 -0
- package/dist/node/contracts/discord-community.operations.js +1 -0
- package/dist/node/contracts/ecosystem-attachment.operations.js +1 -0
- package/dist/node/contracts/ecosystem-auth.operations.js +1 -0
- package/dist/node/contracts/ecosystem-binding.operations.js +1 -0
- package/dist/node/contracts/ecosystem-connection-subscription.events.js +1 -0
- package/dist/node/contracts/ecosystem-governed-work-v2.operations.js +1 -0
- package/dist/node/contracts/ecosystem-governed-work.operations.js +1 -0
- package/dist/node/contracts/ecosystem-identity-v3.operations.js +1 -0
- package/dist/node/contracts/ecosystem-identity.operations.js +1 -0
- package/dist/node/contracts/ecosystem-message.operations.js +1 -0
- package/dist/node/contracts/ecosystem-messaging.dtos.js +0 -0
- package/dist/node/contracts/ecosystem-messaging.events.js +1 -0
- package/dist/node/contracts/ecosystem-messaging.models.js +1 -0
- package/dist/node/contracts/ecosystem-navigation-v3.operations.js +1 -0
- package/dist/node/contracts/ecosystem-webhook.operations.js +1 -0
- package/dist/node/contracts/ecosystem-workspace.operations.js +1 -0
- package/dist/node/contracts/enums.js +1 -0
- package/dist/node/contracts/erasure.operations.js +1 -0
- package/dist/node/contracts/events.js +1 -0
- package/dist/node/contracts/index.js +1 -0
- package/dist/node/contracts/ingestion.js +1 -0
- package/dist/node/contracts/ingress-admission-policy.js +1 -0
- package/dist/node/contracts/ingress-admission.js +1 -0
- package/dist/node/contracts/models.js +1 -0
- package/dist/node/contracts/operations.js +1 -0
- package/dist/node/contracts/persistence.js +1 -0
- package/dist/node/contracts/preference-resolution.js +1 -0
- package/dist/node/contracts/query.operations.js +1 -0
- package/dist/node/contracts/sequence-intent.js +1 -0
- package/dist/node/contracts/sovereignty.js +1 -0
- package/dist/node/contracts/support-internal-note.operations.js +1 -0
- package/dist/node/contracts/thread-link-kind.js +1 -0
- package/dist/node/contracts/thread-message.operations.js +1 -0
- package/dist/node/events/index.js +1 -0
- package/dist/node/fixtures/agent-omnichannel-primitives.js +1 -0
- package/dist/node/fixtures/agent-omnichannel.js +1 -0
- package/dist/node/fixtures/gtm-learning-loop-neutral.parts.js +1 -0
- package/dist/node/fixtures/index.js +1 -0
- package/dist/node/fixtures/normalized-ingestion.js +1 -0
- package/dist/node/index.js +1 -0
- package/dist/node/queries/index.js +1 -0
- package/dist/node/types/domain-command.js +0 -0
- package/dist/node/types/index.js +1 -0
- package/dist/node/validation/domain-command.js +1 -0
- package/dist/node/validation/index.js +1 -0
- package/dist/package-exports.test.d.ts +1 -0
- package/dist/queries/index.d.ts +4 -0
- package/dist/queries/index.js +2 -0
- package/dist/types/domain-command.d.ts +54 -0
- package/dist/types/domain-command.js +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +2 -0
- package/dist/validation/domain-command.d.ts +3 -0
- package/dist/validation/domain-command.js +2 -0
- package/dist/validation/index.d.ts +53 -0
- package/dist/validation/index.js +2 -0
- package/package.json +1227 -0
package/README.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# @lssm/lib.communication-spec
|
|
2
|
+
|
|
3
|
+
Identity resolution uses `communication.account.list@2.0.0`,
|
|
4
|
+
`communication.contact.list@2.0.0`, and
|
|
5
|
+
`communication.identity.decide@1.0.0`. Account outputs exclude credential
|
|
6
|
+
references; identity merges remain human-reviewed and auditable.
|
|
7
|
+
|
|
8
|
+
Governed work uses canonical `communication.governed_work.list@2.0.0`,
|
|
9
|
+
`communication.governed_work.create@2.0.0`, and
|
|
10
|
+
`communication.governed_work.transition@2.0.0`. These operations cover identity
|
|
11
|
+
review, drafts, actions, handoffs, escalations, triage, summaries, agents,
|
|
12
|
+
consent, retention, and policy while keeping scope and transition authority on
|
|
13
|
+
the server. The v1 operations remain exported only for deliberate migration.
|
|
14
|
+
|
|
15
|
+
Canonical CommunicationOS contracts for threads, messages, spaces, rooms, scoped principals, memberships, connections, reply drafts, handoffs, realtime state, operations, queries, events, capabilities, and validation helpers.
|
|
16
|
+
|
|
17
|
+
The additive Discord community-intelligence surface models multiple guilds per
|
|
18
|
+
workspace with explicit `staff` and `managed-community` trust zones, guild-local
|
|
19
|
+
specialties and roles, protected typed provider events, evidence-backed insights,
|
|
20
|
+
restricted coaching scorecards, and Kaizen digests. Existing v1 normalized
|
|
21
|
+
message ingestion remains unchanged.
|
|
22
|
+
|
|
23
|
+
## Canonical capability namespace
|
|
24
|
+
|
|
25
|
+
`COMMUNICATION_OS_CAPABILITY_KEYS` is the single capability vocabulary for
|
|
26
|
+
route discovery, role projections, contextual slots, and UI action gates. All
|
|
27
|
+
capability identifiers use the `communication-os.*` namespace. The legacy
|
|
28
|
+
`comms.*` strings are no longer capability identifiers; similarly named
|
|
29
|
+
`comms.thread.summarize`, `comms.reply.draft`, and `comms.handoff.suggest`
|
|
30
|
+
values remain operation keys and are not authorization capabilities.
|
|
31
|
+
|
|
32
|
+
The direct public entry point
|
|
33
|
+
`./capabilities/communication-os.capability-ids` exposes the canonical keys and
|
|
34
|
+
the exact subset used by the 23-route CommunicationOS hub.
|
|
35
|
+
|
|
36
|
+
Private Support notes use the additive
|
|
37
|
+
`communication.support.internal-note.create@1.0.0` command and
|
|
38
|
+
`communication.support.internal-note.verify@1.0.0` query. Their public inputs
|
|
39
|
+
never carry tenant, workspace, or actor authority; verification is redacted and
|
|
40
|
+
never exposes note content.
|
|
41
|
+
|
|
42
|
+
The additive v2 ecosystem surface models strictly scoped personal and organization
|
|
43
|
+
spaces, human/agent/system principals, hybrid connection placement, explicit
|
|
44
|
+
encryption modes, cursor sync, messaging state, and revocable agent authority.
|
|
45
|
+
Message v2.1 accepts optional public-safe attachment metadata backed by opaque,
|
|
46
|
+
scope-authorized storage references; raw bytes and private storage locations are
|
|
47
|
+
never part of the public message projection.
|
|
48
|
+
Provider OAuth start accepts an optional provider key so Google and Microsoft
|
|
49
|
+
mail can coexist under the email network without mutable process-global
|
|
50
|
+
selection. Authenticated callback invalidations use the additive
|
|
51
|
+
`communication.connection.sync.invalidated` event; they request sync and never
|
|
52
|
+
become user or agent instructions.
|
|
53
|
+
Provider subscription create and renewal use a separate durable lifecycle:
|
|
54
|
+
`requested` is appended before Runtime Node dispatch, `active` requires an exact
|
|
55
|
+
work-order receipt, definitive `failed` state obeys retryability, and
|
|
56
|
+
`indeterminate` retains custody without automatic retry.
|
|
57
|
+
`communication.message.send@3.0.0` is the canonical JSON transport contract. It
|
|
58
|
+
accepts only client intent plus replay keys; tenant, author, message identifier,
|
|
59
|
+
revision, and timestamps are derived and returned by the authorized server.
|
|
60
|
+
`communication.message.search@3.0.0` likewise derives tenant authority from the
|
|
61
|
+
session while retaining explicit workspace and space selection.
|
|
62
|
+
`communication.space.list@3.0.0`, `communication.room.list@3.0.0`,
|
|
63
|
+
`communication.account.list@3.0.0`, and `communication.contact.list@3.0.0`
|
|
64
|
+
accept no client-selected scope. `communication.room.create@3.0.0` accepts only
|
|
65
|
+
the room name, kind, and replay key; tenant, workspace, space, principal,
|
|
66
|
+
identifiers, revisions, and timestamps remain server-owned.
|
|
67
|
+
CommunicationSpec remains canonical; Matrix and proprietary networks are adapters.
|
|
68
|
+
All v1 contract keys remain exported unchanged.
|
|
69
|
+
|
|
70
|
+
Domain-command helpers classify agent-callable CommunicationOS actions such as
|
|
71
|
+
reply drafting, reply sending, handoff creation, and escalation requests. These
|
|
72
|
+
helpers are contract-only: they describe authority, autonomy, approval
|
|
73
|
+
requirements, and semantic violations without provider adapters, persistence
|
|
74
|
+
drivers, outbound sends, or runtime side effects.
|
|
75
|
+
|
|
76
|
+
Command-inbox contracts extend domain-command planning with non-executing inbox
|
|
77
|
+
items, fail-closed status, AIP control refs, and CompanyOS bridge evidence.
|
|
78
|
+
These contracts describe review/approval state only; they do not grant send or
|
|
79
|
+
work-execution authority.
|
|
80
|
+
|
|
81
|
+
## Agent omnichannel contracts
|
|
82
|
+
|
|
83
|
+
The additive V1 omnichannel surface keeps agent communication provider-neutral:
|
|
84
|
+
|
|
85
|
+
- `agent-communication` binds agent applications, runs, tasks, help requests,
|
|
86
|
+
and background results through opaque refs.
|
|
87
|
+
- `agent-lifecycle-projection` publishes immutable, non-authoritative run,
|
|
88
|
+
task, help, approval, and terminal status into the canonical conversation.
|
|
89
|
+
A help projection must bind the exact durable help request and checkpoint.
|
|
90
|
+
- `canonical-agent-conversation` binds one scoped conversation to its exact
|
|
91
|
+
session, participants, channel identities, origin, revision, and digest.
|
|
92
|
+
- `ingress-admission` separates the durable authenticated receipt from the
|
|
93
|
+
deterministic connection, identity, pairing, membership, mention, and
|
|
94
|
+
consent decision. Unresolved identity or membership quarantines rather than
|
|
95
|
+
becoming model input.
|
|
96
|
+
- `agent-surface-control` binds help, approval, steer, queue, pause, cancel, and
|
|
97
|
+
branch requests to one conversation, run, human identity proof, authority
|
|
98
|
+
decision, expiry, idempotency key, and durable result.
|
|
99
|
+
- `channel-routing` provides an open channel key plus well-known email,
|
|
100
|
+
calendar, SMS, Slack, Teams, Discord, Telegram, WhatsApp, Matrix, in-app,
|
|
101
|
+
push, webhook, web-chat, and internal-chat keys.
|
|
102
|
+
- `channel-preferences` records typed user choices with
|
|
103
|
+
`authority: "preference_only"`; each set has exactly one event, automation,
|
|
104
|
+
feature, application, product, space, person, or stable platform-default
|
|
105
|
+
resolution target plus explicit inherited parent-set refs. Resolution follows
|
|
106
|
+
event/automation, feature/application, product, space/person, then platform
|
|
107
|
+
default. A preference never authorizes delivery.
|
|
108
|
+
- `delivery-intent`, `delivery-progress`, and `delivery-fallback` carry content
|
|
109
|
+
proof, opaque event/automation/feature/application/product classification,
|
|
110
|
+
idempotency, receipts, reconciliation, policy, eligibility, and evidence refs
|
|
111
|
+
with `effectAuthority: "none"`. Route, preference, resolution, intent,
|
|
112
|
+
progress, and fallback bindings retain revisions or digests; attempted
|
|
113
|
+
fallback binds the exact prior progress ref and digest.
|
|
114
|
+
|
|
115
|
+
Provider acceptance remains distinct from delivered/read evidence. An
|
|
116
|
+
ambiguous prior effect must be reconciled before an alternate route can be
|
|
117
|
+
selected. The contracts contain no provider credentials, runtime effects, or
|
|
118
|
+
persistence implementation.
|
|
119
|
+
|
|
120
|
+
The domain-command outbox schema carries optional reconciliation custody
|
|
121
|
+
bindings. An indeterminate provider outcome records the exact Runtime Node work
|
|
122
|
+
order digest and evidence refs before its lease can leave effectful execution.
|
|
123
|
+
|
|
124
|
+
## Public Entry Points
|
|
125
|
+
|
|
126
|
+
- `.` resolves through `./src/index.ts`
|
|
127
|
+
- `./types` resolves through `./src/types/index.ts`
|
|
128
|
+
- `./types/domain-command` resolves through `./src/types/domain-command.ts` and includes command-inbox contracts
|
|
129
|
+
- `./commands` resolves through `./src/commands/index.ts`
|
|
130
|
+
- `./queries` resolves through `./src/queries/index.ts`
|
|
131
|
+
- `./events` resolves through `./src/events/index.ts`
|
|
132
|
+
- `./capabilities` resolves through `./src/capabilities/index.ts`
|
|
133
|
+
- `./validation` resolves through `./src/validation/index.ts`
|
|
134
|
+
- `./contracts/agent-communication` resolves agent profiles and lifecycle links
|
|
135
|
+
- `./contracts/agent-lifecycle-projection` resolves evidence-bound agent status
|
|
136
|
+
and help projections for canonical conversations
|
|
137
|
+
- `./contracts/canonical-agent-conversation`, `./contracts/ingress-admission`,
|
|
138
|
+
and `./contracts/agent-surface-control` resolve canonical continuity,
|
|
139
|
+
deterministic admission, and origin-neutral agent controls
|
|
140
|
+
- `./contracts/channel-routing` and `./contracts/channel-preferences` resolve
|
|
141
|
+
open route keys and typed non-authoritative preferences
|
|
142
|
+
- `./contracts/preference-resolution` resolves typed preference targets and the
|
|
143
|
+
most-specific-to-platform-default hierarchy; it performs no runtime resolution
|
|
144
|
+
- `./contracts/delivery-intent`, `./contracts/delivery-progress`, and
|
|
145
|
+
`./contracts/delivery-fallback` resolve the fail-closed delivery artifact set
|
|
146
|
+
- `./contracts/delivery-eligibility` resolves evidence-only route eligibility
|
|
147
|
+
across consent, policy, grants, quiet hours, limits, provider health, cost,
|
|
148
|
+
and channel-specific constraints; it grants no delivery authority
|
|
149
|
+
- `./fixtures/agent-omnichannel` resolves the deterministic no-network fixture
|
|
150
|
+
- `./contracts/ecosystem-messaging.models` resolves v2 spaces, rooms, principals, connections, messages, and authority grants
|
|
151
|
+
- `./contracts/ecosystem-workspace.operations` and `./contracts/ecosystem-message.operations` resolve additive v2 operations
|
|
152
|
+
- `communication.space.list@3.0.0` and `communication.room.list@3.0.0` expose
|
|
153
|
+
server-selected navigation without accepting browser scope authority; their
|
|
154
|
+
v2 predecessors remain exported for compatibility during migration
|
|
155
|
+
- `./contracts/ecosystem-messaging.events` resolves additive v2 journal/realtime events
|
|
156
|
+
- The root and `./contracts` exports include browser-safe v2 request, result,
|
|
157
|
+
error, cursor, journal, realtime, and projection DTOs. Public extension
|
|
158
|
+
payloads use `CommunicationJsonObjectDto` rather than unknown records.
|
|
159
|
+
- `./contracts/ecosystem-webhook.operations` resolves authenticated, replay-safe provider webhook ingress
|
|
160
|
+
- `communication.oauth.start@3.0.0` and `communication.oauth.complete@3.0.0`
|
|
161
|
+
derive an allowlisted callback return origin from the authenticated host issuer,
|
|
162
|
+
so embedded CompanyOS and standalone CommunicationOS return to their own shell.
|
|
163
|
+
define scope-bound provider onboarding with PKCE, one-time opaque state, safe
|
|
164
|
+
return paths, and credential-reference-only completion
|
|
165
|
+
- `./capabilities/ecosystem-messaging.capabilities` resolves v2 messaging capability constants
|
|
166
|
+
- `./capabilities/communication-os.capability-ids` resolves the canonical route and action capability identifiers
|
|
167
|
+
|
|
168
|
+
`TenantBoundCommunicationIngestionSchema` is an additive R001 contract exposed
|
|
169
|
+
through `./contracts/ingestion`. It binds the existing normalized ingestion
|
|
170
|
+
record to the canonical F002 CompanyOS tenant-governance envelope and validates
|
|
171
|
+
subject, consent, idempotency, and evidence/replay alignment without introducing
|
|
172
|
+
provider or webhook behavior.
|
|
173
|
+
|
|
174
|
+
## Persistence wave
|
|
175
|
+
|
|
176
|
+
CommunicationOS persistence stays contract-first. `communicationOsSchemaContribution`, `communicationOsPersistencePlans`, and `createCommunicationOsMutationDescriptor` expose portable schema and governed `database.mutation.execute@2.0.0` envelopes for managed/BYOK providers. The domain command reference remains the write authority; provider packages execute SQL/Drizzle outside this spec package. Local/PgLite support is compatibility binding metadata, not an ownership mode.
|
|
177
|
+
|
|
178
|
+
## Boundary
|
|
179
|
+
|
|
180
|
+
This package owns canonical communication contracts. Runtime behavior, examples, fixtures, proof/replay, and product composition live in separate packages. Deprecated module shims may re-export this surface for compatibility only.
|
|
181
|
+
|
|
182
|
+
## Approval-bound sequences
|
|
183
|
+
|
|
184
|
+
`CommunicationSequenceIntentSchema` is the additive, provider-neutral contract
|
|
185
|
+
for scheduled outbound intent. It binds the exact recipient, content proof,
|
|
186
|
+
channel, side effect, schedule/expiry, policy and consent refs, kill switch,
|
|
187
|
+
ActionPacket, approval request, and approval fingerprint. Runtime schedulers must
|
|
188
|
+
revalidate those bindings and controls before every initial claim and retry.
|
|
189
|
+
`CommunicationSequenceApprovalTargetSchema` is the canonical versioned human
|
|
190
|
+
approval payload. Its deterministic fingerprint binds the sequence/version,
|
|
191
|
+
tenant, recipient set, content proof, channel/effect, schedule and policy
|
|
192
|
+
versions, and expiry. The approval request and ActionPacket evidence must carry
|
|
193
|
+
that same fingerprint.
|
|
194
|
+
|
|
195
|
+
## Matrix channel
|
|
196
|
+
|
|
197
|
+
`ChannelTypeEnum` includes `matrix` for deployments that ingest Matrix room events or send governed replies to Matrix rooms. Matrix bridge metadata is owned by integration contracts; this package only owns the canonical channel value.
|
|
198
|
+
|
|
199
|
+
Published browser conditions select the emitted browser artifacts alongside
|
|
200
|
+
existing Node/Bun/type targets. Export keys and source behavior are preserved;
|
|
201
|
+
this packaging metadata does not activate providers or grant execution authority.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineCapability as e,StabilityEnum as n}from"@lssm/lib.contracts-spec";var o={INBOX_READ:"communication-os.inbox.read",INBOX_MANAGE:"communication-os.inbox.manage",SPACES_READ:"communication-os.spaces.read",ROOMS_READ:"communication-os.rooms.read",ROOMS_WRITE:"communication-os.rooms.write",ROOM_MEMBERS_MANAGE:"communication-os.rooms.members.manage",SEARCH:"communication-os.search",REPLY_SEND:"communication-os.reply.send",ATTACHMENTS_READ:"communication-os.attachments.read",IDENTITY_MANAGE:"communication-os.identity.manage",IDENTITY_MERGE:"communication-os.identity.merge",AGENTS_MANAGE:"communication-os.agents.manage",CONNECTIONS_MANAGE:"communication-os.connections.manage",GOVERNANCE_MANAGE:"communication-os.governance.manage",AUTOMATION_MANAGE:"communication-os.automation.manage",ACTIONS_APPROVE:"communication-os.actions.approve",HANDOFFS_APPROVE:"communication-os.handoffs.approve",AI_USE:"communication-os.ai.use",THREAD_EXPLAIN:"communication-os.thread.explain",AUDIT_READ:"communication-os.audit.read",AUDIT_EXPORT:"communication-os.audit.export"},c=[o.INBOX_READ,o.SPACES_READ,o.ROOMS_READ,o.ROOMS_WRITE,o.SEARCH,o.IDENTITY_MANAGE,o.AGENTS_MANAGE,o.CONNECTIONS_MANAGE,o.GOVERNANCE_MANAGE,o.AUTOMATION_MANAGE,o.REPLY_SEND,o.AUDIT_READ],i={"comms.room.read":o.ROOMS_READ,"comms.room.write":o.ROOMS_WRITE,"comms.room.members.manage":o.ROOM_MEMBERS_MANAGE,"comms.connections.manage":o.CONNECTIONS_MANAGE,"comms.authority.manage":o.GOVERNANCE_MANAGE,"comms.search":o.SEARCH,"comms.thread.write":o.REPLY_SEND,"comms.inbox.archive":o.INBOX_MANAGE,"comms.action.approve":o.ACTIONS_APPROVE,"comms.handoff.approve":o.HANDOFFS_APPROVE,"comms.identity.merge":o.IDENTITY_MERGE,"comms.audit.export":o.AUDIT_EXPORT,"comms.ai":o.AI_USE,"comms.thread.explain":o.THREAD_EXPLAIN},A=Object.freeze(Object.keys(i));function r(a){return i[a]??a}function E(a){return[...new Set(a.map(r))]}function p(a){return a.some((s)=>(s in i))}var t=["platform.communication-os","platform.ai-routing"],m={FULL:o.AI_USE,AUDITOR:o.THREAD_EXPLAIN},I=e({meta:{key:m.FULL,version:"2.0.0",kind:"api",stability:n.Experimental,description:"Full CommunicationOS AI routing capability: thread summarization, reply drafting, and handoff suggestion",owners:[...t],tags:["comms","ai","routing","summarize","draft","handoff"]},provides:[{surface:"operation",key:"comms.thread.summarize",version:"1.0.0",description:"AI thread summarization with persona-adaptive redaction (audiencePersona resolved from actor role)"},{surface:"operation",key:"comms.reply.draft",version:"1.0.0",description:"AI reply drafting; draft status reflects policy evaluation (drafted | requires_review)"},{surface:"operation",key:"comms.handoff.suggest",version:"1.0.0",description:"AI handoff suggestion (suggestion only — does not create HandoffPacket)"}],requires:[{key:"communication-spec",version:"1.0.0",reason:"Core communication contracts (thread, message, handoff models) must be available"}]}),O=e({meta:{key:m.AUDITOR,version:"2.0.0",kind:"api",stability:n.Experimental,description:"Auditor read-only AI capability: thread explanation (summarize) only, with forced PII redaction",owners:[...t],tags:["comms","ai","auditor","read-only","explain","thread"]},provides:[{surface:"operation",key:"comms.thread.summarize",version:"1.0.0",description:"Read-only thread explanation for auditor persona; handler forces audiencePersona=auditor and redacts PII"}],requires:[{key:"communication-spec",version:"1.0.0",reason:"Core communication contracts (thread, message models) must be available"}]});export{m as COMMS_AI_CAPABILITY_KEYS,O as CommsAiAuditorCapability,I as CommsAiFullCapability};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o={INBOX_READ:"communication-os.inbox.read",INBOX_MANAGE:"communication-os.inbox.manage",SPACES_READ:"communication-os.spaces.read",ROOMS_READ:"communication-os.rooms.read",ROOMS_WRITE:"communication-os.rooms.write",ROOM_MEMBERS_MANAGE:"communication-os.rooms.members.manage",SEARCH:"communication-os.search",REPLY_SEND:"communication-os.reply.send",ATTACHMENTS_READ:"communication-os.attachments.read",IDENTITY_MANAGE:"communication-os.identity.manage",IDENTITY_MERGE:"communication-os.identity.merge",AGENTS_MANAGE:"communication-os.agents.manage",CONNECTIONS_MANAGE:"communication-os.connections.manage",GOVERNANCE_MANAGE:"communication-os.governance.manage",AUTOMATION_MANAGE:"communication-os.automation.manage",ACTIONS_APPROVE:"communication-os.actions.approve",HANDOFFS_APPROVE:"communication-os.handoffs.approve",AI_USE:"communication-os.ai.use",THREAD_EXPLAIN:"communication-os.thread.explain",AUDIT_READ:"communication-os.audit.read",AUDIT_EXPORT:"communication-os.audit.export"},A=[o.INBOX_READ,o.SPACES_READ,o.ROOMS_READ,o.ROOMS_WRITE,o.SEARCH,o.IDENTITY_MANAGE,o.AGENTS_MANAGE,o.CONNECTIONS_MANAGE,o.GOVERNANCE_MANAGE,o.AUTOMATION_MANAGE,o.REPLY_SEND,o.AUDIT_READ],a={"comms.room.read":o.ROOMS_READ,"comms.room.write":o.ROOMS_WRITE,"comms.room.members.manage":o.ROOM_MEMBERS_MANAGE,"comms.connections.manage":o.CONNECTIONS_MANAGE,"comms.authority.manage":o.GOVERNANCE_MANAGE,"comms.search":o.SEARCH,"comms.thread.write":o.REPLY_SEND,"comms.inbox.archive":o.INBOX_MANAGE,"comms.action.approve":o.ACTIONS_APPROVE,"comms.handoff.approve":o.HANDOFFS_APPROVE,"comms.identity.merge":o.IDENTITY_MERGE,"comms.audit.export":o.AUDIT_EXPORT,"comms.ai":o.AI_USE,"comms.thread.explain":o.THREAD_EXPLAIN},t=Object.freeze(Object.keys(a));function i(n){return a[n]??n}function c(n){return[...new Set(n.map(i))]}function e(n){return n.some((m)=>(m in a))}export{o as COMMUNICATION_OS_CAPABILITY_KEYS,A as COMMUNICATION_OS_ROUTE_CAPABILITY_KEYS,t as LEGACY_COMMUNICATION_OS_CAPABILITY_KEYS,c as canonicalCommunicationOsCapabilities,i as canonicalCommunicationOsCapability,e as hasLegacyCommunicationOsCapability};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineCapability as g,docId as _,StabilityEnum as S}from"@lssm/lib.contracts-spec";import{defineEnum as a,defineSchemaModel as i,ScalarTypeEnum as e}from"@lssm/lib.schema";var m=a("CommunicationSpaceKind",["personal","organization"]),p=a("CommunicationPrincipalKind",["human","agent","system"]),u=a("CommunicationConnectionPlacement",["device","managed_cloud","self_hosted"]),f=a("CommunicationConnectionNetwork",["email","sms","slack","teams","telegram","whatsapp","discord","matrix"]),l=a("CommunicationEncryptionMode",["client_encrypted","governed_server_indexable"]),d=a("CommunicationMembershipState",["active","revoked"]),C=a("CommunicationReceiptKind",["delivered","read"]),O=a("CommunicationConnectionHealth",["connecting","healthy","degraded","offline","revoked"]),r={id:"communication-os.ecosystem-messaging.v2",title:"CommunicationOS ecosystem messaging contracts",body:"Versioned, workspace-scoped contracts for personal and organization spaces, rooms, human and agent membership, hybrid channel connections, synchronized messages, and revocable outbound authority. CommunicationSpec remains canonical; provider protocols are adapters. V1 thread and draft-only operations remain unchanged.",kind:"reference",route:"/docs/communication-os/ecosystem-messaging-v2",visibility:"public"},I=i({name:"CommunicationScopeV2",description:"Strict tenant, workspace, and space boundary for messaging state",fields:{tenantId:{type:e.String_unsecure(),isOptional:!1},workspaceId:{type:e.String_unsecure(),isOptional:!1},spaceId:{type:e.String_unsecure(),isOptional:!1}}}),M=i({name:"CommunicationSpaceV2",description:"Personal or organization messaging boundary under one account",fields:{id:{type:e.String_unsecure(),isOptional:!1},tenantId:{type:e.String_unsecure(),isOptional:!1},workspaceId:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},kind:{type:m,isOptional:!1},encryptionMode:{type:l,isOptional:!1},createdAt:{type:e.DateTime(),isOptional:!1}}}),N=i({name:"CommunicationPrincipalV2",description:"Auditable human, agent, or system identity",fields:{id:{type:e.String_unsecure(),isOptional:!1},kind:{type:p,isOptional:!1},displayName:{type:e.String_unsecure(),isOptional:!1},ownerPrincipalId:{type:e.String_unsecure(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),T=i({name:"CommunicationRoomV2",description:"Room or direct-message projection inside one space",fields:{id:{type:e.String_unsecure(),isOptional:!1},tenantId:{type:e.String_unsecure(),isOptional:!1},workspaceId:{type:e.String_unsecure(),isOptional:!1},spaceId:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!0},roomKind:{type:e.String_unsecure(),isOptional:!1},connectionIds:{type:e.String_unsecure(),isArray:!0,isOptional:!1},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),R=i({name:"CommunicationRoomMembershipV2",description:"Revocable principal membership and room-scoped capabilities",fields:{id:{type:e.String_unsecure(),isOptional:!1},tenantId:{type:e.String_unsecure(),isOptional:!1},workspaceId:{type:e.String_unsecure(),isOptional:!1},spaceId:{type:e.String_unsecure(),isOptional:!1},roomId:{type:e.String_unsecure(),isOptional:!1},principalId:{type:e.String_unsecure(),isOptional:!1},role:{type:e.String_unsecure(),isOptional:!1},state:{type:d,isOptional:!1},capabilities:{type:e.String_unsecure(),isArray:!0,isOptional:!1},expiresAt:{type:e.DateTime(),isOptional:!0},revokedAt:{type:e.DateTime(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),h=i({name:"CommunicationChannelConnectionV2",description:"Credential-reference-only local, managed, or self-hosted channel connection",fields:{id:{type:e.String_unsecure(),isOptional:!1},tenantId:{type:e.String_unsecure(),isOptional:!1},workspaceId:{type:e.String_unsecure(),isOptional:!1},spaceId:{type:e.String_unsecure(),isOptional:!1},network:{type:e.String_unsecure(),isOptional:!1},placement:{type:u,isOptional:!1},externalAccountRef:{type:e.String_unsecure(),isOptional:!1},credentialRef:{type:e.String_unsecure(),isOptional:!1},health:{type:O,isOptional:!1},capabilities:{type:e.String_unsecure(),isArray:!0,isOptional:!1},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),y=i({name:"CommunicationAttachmentV2",description:"Public-safe metadata for an opaque, scope-bound message attachment",fields:{id:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},mimeType:{type:e.String_unsecure(),isOptional:!1},sizeBytes:{type:e.Int_unsecure(),isOptional:!1},sha256:{type:e.String_unsecure(),isOptional:!1},createdAt:{type:e.DateTime(),isOptional:!1}}}),b=i({name:"CommunicationMessageV2",description:"Canonical room message with explicit author and encryption posture",fields:{id:{type:e.String_unsecure(),isOptional:!1},tenantId:{type:e.String_unsecure(),isOptional:!1},workspaceId:{type:e.String_unsecure(),isOptional:!1},spaceId:{type:e.String_unsecure(),isOptional:!1},roomId:{type:e.String_unsecure(),isOptional:!1},authorPrincipalId:{type:e.String_unsecure(),isOptional:!1},connectionId:{type:e.String_unsecure(),isOptional:!0},externalMessageId:{type:e.String_unsecure(),isOptional:!0},body:{type:e.String_unsecure(),isOptional:!0},encryptedEnvelope:{type:e.JSONObject(),isOptional:!0},attachments:{type:y,isArray:!0,isOptional:!0},replyToMessageId:{type:e.String_unsecure(),isOptional:!0},revision:{type:e.Int_unsecure(),isOptional:!1},deletedAt:{type:e.DateTime(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),D=i({name:"CommunicationAuthorityGrantV2",description:"Explicit, revocable messaging authority granted to one principal",fields:{id:{type:e.String_unsecure(),isOptional:!1},tenantId:{type:e.String_unsecure(),isOptional:!1},workspaceId:{type:e.String_unsecure(),isOptional:!1},spaceId:{type:e.String_unsecure(),isOptional:!1},roomId:{type:e.String_unsecure(),isOptional:!0},connectionId:{type:e.String_unsecure(),isOptional:!0},principalId:{type:e.String_unsecure(),isOptional:!1},capabilities:{type:e.String_unsecure(),isArray:!0,isOptional:!1},grantedBy:{type:e.String_unsecure(),isOptional:!1},expiresAt:{type:e.DateTime(),isOptional:!0},revokedAt:{type:e.DateTime(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}});var n={INBOX_READ:"communication-os.inbox.read",INBOX_MANAGE:"communication-os.inbox.manage",SPACES_READ:"communication-os.spaces.read",ROOMS_READ:"communication-os.rooms.read",ROOMS_WRITE:"communication-os.rooms.write",ROOM_MEMBERS_MANAGE:"communication-os.rooms.members.manage",SEARCH:"communication-os.search",REPLY_SEND:"communication-os.reply.send",ATTACHMENTS_READ:"communication-os.attachments.read",IDENTITY_MANAGE:"communication-os.identity.manage",IDENTITY_MERGE:"communication-os.identity.merge",AGENTS_MANAGE:"communication-os.agents.manage",CONNECTIONS_MANAGE:"communication-os.connections.manage",GOVERNANCE_MANAGE:"communication-os.governance.manage",AUTOMATION_MANAGE:"communication-os.automation.manage",ACTIONS_APPROVE:"communication-os.actions.approve",HANDOFFS_APPROVE:"communication-os.handoffs.approve",AI_USE:"communication-os.ai.use",THREAD_EXPLAIN:"communication-os.thread.explain",AUDIT_READ:"communication-os.audit.read",AUDIT_EXPORT:"communication-os.audit.export"},G=[n.INBOX_READ,n.SPACES_READ,n.ROOMS_READ,n.ROOMS_WRITE,n.SEARCH,n.IDENTITY_MANAGE,n.AGENTS_MANAGE,n.CONNECTIONS_MANAGE,n.GOVERNANCE_MANAGE,n.AUTOMATION_MANAGE,n.REPLY_SEND,n.AUDIT_READ],c={"comms.room.read":n.ROOMS_READ,"comms.room.write":n.ROOMS_WRITE,"comms.room.members.manage":n.ROOM_MEMBERS_MANAGE,"comms.connections.manage":n.CONNECTIONS_MANAGE,"comms.authority.manage":n.GOVERNANCE_MANAGE,"comms.search":n.SEARCH,"comms.thread.write":n.REPLY_SEND,"comms.inbox.archive":n.INBOX_MANAGE,"comms.action.approve":n.ACTIONS_APPROVE,"comms.handoff.approve":n.HANDOFFS_APPROVE,"comms.identity.merge":n.IDENTITY_MERGE,"comms.audit.export":n.AUDIT_EXPORT,"comms.ai":n.AI_USE,"comms.thread.explain":n.THREAD_EXPLAIN},P=Object.freeze(Object.keys(c));function A(o){return c[o]??o}function k(o){return[...new Set(o.map(A))]}function v(o){return o.some((s)=>(s in c))}var K={READ:n.ROOMS_READ,WRITE:n.ROOMS_WRITE,MANAGE_MEMBERS:n.ROOM_MEMBERS_MANAGE,MANAGE_CONNECTIONS:n.CONNECTIONS_MANAGE,MANAGE_AUTHORITY:n.GOVERNANCE_MANAGE,SEARCH:n.SEARCH},t=(o,s)=>({surface:"operation",key:o,version:"2.0.0",description:s}),L=g({meta:{key:"communication-os.ecosystem-messaging",version:"3.0.0",kind:"api",stability:S.Experimental,description:"Standalone and embeddable unified messaging for humans and explicitly authorized agents",owners:["platform.communication-os"],tags:["communication","messaging","agents","hybrid","cross-platform"],docId:[_(r.id)]},provides:[t("communication.space.create","Create isolated messaging spaces"),t("communication.room.create","Create rooms and direct messages"),t("communication.membership.set","Manage room membership"),t("communication.authority.set","Manage revocable principal authority"),t("communication.connection.connect","Connect messaging networks"),t("communication.connection.sync","Synchronize network events"),t("communication.message.send","Send an attributed room message"),t("communication.message.edit","Edit a message revision"),t("communication.message.delete","Delete message content"),t("communication.reaction.set","Set a message reaction"),t("communication.receipt.record","Record delivery and read state"),t("communication.inbox-state.set","Organize the unified inbox"),t("communication.message.search","Search one authorized space")],requires:[{key:"communication-spec",version:"1.0.0",reason:"V2 extends the existing canonical CommunicationSpec surface"}]});export{K as ECOSYSTEM_MESSAGING_CAPABILITY_KEYS,L as EcosystemMessagingCapability};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineCapability as c,StabilityEnum as m}from"@lssm/lib.contracts-spec";var n={INBOX_READ:"communication-os.inbox.read",INBOX_MANAGE:"communication-os.inbox.manage",SPACES_READ:"communication-os.spaces.read",ROOMS_READ:"communication-os.rooms.read",ROOMS_WRITE:"communication-os.rooms.write",ROOM_MEMBERS_MANAGE:"communication-os.rooms.members.manage",SEARCH:"communication-os.search",REPLY_SEND:"communication-os.reply.send",ATTACHMENTS_READ:"communication-os.attachments.read",IDENTITY_MANAGE:"communication-os.identity.manage",IDENTITY_MERGE:"communication-os.identity.merge",AGENTS_MANAGE:"communication-os.agents.manage",CONNECTIONS_MANAGE:"communication-os.connections.manage",GOVERNANCE_MANAGE:"communication-os.governance.manage",AUTOMATION_MANAGE:"communication-os.automation.manage",ACTIONS_APPROVE:"communication-os.actions.approve",HANDOFFS_APPROVE:"communication-os.handoffs.approve",AI_USE:"communication-os.ai.use",THREAD_EXPLAIN:"communication-os.thread.explain",AUDIT_READ:"communication-os.audit.read",AUDIT_EXPORT:"communication-os.audit.export"},h=[n.INBOX_READ,n.SPACES_READ,n.ROOMS_READ,n.ROOMS_WRITE,n.SEARCH,n.IDENTITY_MANAGE,n.AGENTS_MANAGE,n.CONNECTIONS_MANAGE,n.GOVERNANCE_MANAGE,n.AUTOMATION_MANAGE,n.REPLY_SEND,n.AUDIT_READ],r={"comms.room.read":n.ROOMS_READ,"comms.room.write":n.ROOMS_WRITE,"comms.room.members.manage":n.ROOM_MEMBERS_MANAGE,"comms.connections.manage":n.CONNECTIONS_MANAGE,"comms.authority.manage":n.GOVERNANCE_MANAGE,"comms.search":n.SEARCH,"comms.thread.write":n.REPLY_SEND,"comms.inbox.archive":n.INBOX_MANAGE,"comms.action.approve":n.ACTIONS_APPROVE,"comms.handoff.approve":n.HANDOFFS_APPROVE,"comms.identity.merge":n.IDENTITY_MERGE,"comms.audit.export":n.AUDIT_EXPORT,"comms.ai":n.AI_USE,"comms.thread.explain":n.THREAD_EXPLAIN},T=Object.freeze(Object.keys(r));function d(o){return r[o]??o}function b(o){return[...new Set(o.map(d))]}function R(o){return o.some((s)=>(s in r))}var p=["platform.communication-os","platform.ai-routing"],l={FULL:n.AI_USE,AUDITOR:n.THREAD_EXPLAIN},k=c({meta:{key:l.FULL,version:"2.0.0",kind:"api",stability:m.Experimental,description:"Full CommunicationOS AI routing capability: thread summarization, reply drafting, and handoff suggestion",owners:[...p],tags:["comms","ai","routing","summarize","draft","handoff"]},provides:[{surface:"operation",key:"comms.thread.summarize",version:"1.0.0",description:"AI thread summarization with persona-adaptive redaction (audiencePersona resolved from actor role)"},{surface:"operation",key:"comms.reply.draft",version:"1.0.0",description:"AI reply drafting; draft status reflects policy evaluation (drafted | requires_review)"},{surface:"operation",key:"comms.handoff.suggest",version:"1.0.0",description:"AI handoff suggestion (suggestion only — does not create HandoffPacket)"}],requires:[{key:"communication-spec",version:"1.0.0",reason:"Core communication contracts (thread, message, handoff models) must be available"}]}),P=c({meta:{key:l.AUDITOR,version:"2.0.0",kind:"api",stability:m.Experimental,description:"Auditor read-only AI capability: thread explanation (summarize) only, with forced PII redaction",owners:[...p],tags:["comms","ai","auditor","read-only","explain","thread"]},provides:[{surface:"operation",key:"comms.thread.summarize",version:"1.0.0",description:"Read-only thread explanation for auditor persona; handler forces audiencePersona=auditor and redacts PII"}],requires:[{key:"communication-spec",version:"1.0.0",reason:"Core communication contracts (thread, message models) must be available"}]});import{defineCapability as E,docId as C,StabilityEnum as I}from"@lssm/lib.contracts-spec";import{defineEnum as a,defineSchemaModel as t,ScalarTypeEnum as e}from"@lssm/lib.schema";var y=a("CommunicationSpaceKind",["personal","organization"]),O=a("CommunicationPrincipalKind",["human","agent","system"]),A=a("CommunicationConnectionPlacement",["device","managed_cloud","self_hosted"]),w=a("CommunicationConnectionNetwork",["email","sms","slack","teams","telegram","whatsapp","discord","matrix"]),g=a("CommunicationEncryptionMode",["client_encrypted","governed_server_indexable"]),f=a("CommunicationMembershipState",["active","revoked"]),V=a("CommunicationReceiptKind",["delivered","read"]),_=a("CommunicationConnectionHealth",["connecting","healthy","degraded","offline","revoked"]),u={id:"communication-os.ecosystem-messaging.v2",title:"CommunicationOS ecosystem messaging contracts",body:"Versioned, workspace-scoped contracts for personal and organization spaces, rooms, human and agent membership, hybrid channel connections, synchronized messages, and revocable outbound authority. CommunicationSpec remains canonical; provider protocols are adapters. V1 thread and draft-only operations remain unchanged.",kind:"reference",route:"/docs/communication-os/ecosystem-messaging-v2",visibility:"public"},B=t({name:"CommunicationScopeV2",description:"Strict tenant, workspace, and space boundary for messaging state",fields:{tenantId:{type:e.String_unsecure(),isOptional:!1},workspaceId:{type:e.String_unsecure(),isOptional:!1},spaceId:{type:e.String_unsecure(),isOptional:!1}}}),L=t({name:"CommunicationSpaceV2",description:"Personal or organization messaging boundary under one account",fields:{id:{type:e.String_unsecure(),isOptional:!1},tenantId:{type:e.String_unsecure(),isOptional:!1},workspaceId:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},kind:{type:y,isOptional:!1},encryptionMode:{type:g,isOptional:!1},createdAt:{type:e.DateTime(),isOptional:!1}}}),K=t({name:"CommunicationPrincipalV2",description:"Auditable human, agent, or system identity",fields:{id:{type:e.String_unsecure(),isOptional:!1},kind:{type:O,isOptional:!1},displayName:{type:e.String_unsecure(),isOptional:!1},ownerPrincipalId:{type:e.String_unsecure(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),U=t({name:"CommunicationRoomV2",description:"Room or direct-message projection inside one space",fields:{id:{type:e.String_unsecure(),isOptional:!1},tenantId:{type:e.String_unsecure(),isOptional:!1},workspaceId:{type:e.String_unsecure(),isOptional:!1},spaceId:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!0},roomKind:{type:e.String_unsecure(),isOptional:!1},connectionIds:{type:e.String_unsecure(),isArray:!0,isOptional:!1},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),z=t({name:"CommunicationRoomMembershipV2",description:"Revocable principal membership and room-scoped capabilities",fields:{id:{type:e.String_unsecure(),isOptional:!1},tenantId:{type:e.String_unsecure(),isOptional:!1},workspaceId:{type:e.String_unsecure(),isOptional:!1},spaceId:{type:e.String_unsecure(),isOptional:!1},roomId:{type:e.String_unsecure(),isOptional:!1},principalId:{type:e.String_unsecure(),isOptional:!1},role:{type:e.String_unsecure(),isOptional:!1},state:{type:f,isOptional:!1},capabilities:{type:e.String_unsecure(),isArray:!0,isOptional:!1},expiresAt:{type:e.DateTime(),isOptional:!0},revokedAt:{type:e.DateTime(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),H=t({name:"CommunicationChannelConnectionV2",description:"Credential-reference-only local, managed, or self-hosted channel connection",fields:{id:{type:e.String_unsecure(),isOptional:!1},tenantId:{type:e.String_unsecure(),isOptional:!1},workspaceId:{type:e.String_unsecure(),isOptional:!1},spaceId:{type:e.String_unsecure(),isOptional:!1},network:{type:e.String_unsecure(),isOptional:!1},placement:{type:A,isOptional:!1},externalAccountRef:{type:e.String_unsecure(),isOptional:!1},credentialRef:{type:e.String_unsecure(),isOptional:!1},health:{type:_,isOptional:!1},capabilities:{type:e.String_unsecure(),isArray:!0,isOptional:!1},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),S=t({name:"CommunicationAttachmentV2",description:"Public-safe metadata for an opaque, scope-bound message attachment",fields:{id:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},mimeType:{type:e.String_unsecure(),isOptional:!1},sizeBytes:{type:e.Int_unsecure(),isOptional:!1},sha256:{type:e.String_unsecure(),isOptional:!1},createdAt:{type:e.DateTime(),isOptional:!1}}}),X=t({name:"CommunicationMessageV2",description:"Canonical room message with explicit author and encryption posture",fields:{id:{type:e.String_unsecure(),isOptional:!1},tenantId:{type:e.String_unsecure(),isOptional:!1},workspaceId:{type:e.String_unsecure(),isOptional:!1},spaceId:{type:e.String_unsecure(),isOptional:!1},roomId:{type:e.String_unsecure(),isOptional:!1},authorPrincipalId:{type:e.String_unsecure(),isOptional:!1},connectionId:{type:e.String_unsecure(),isOptional:!0},externalMessageId:{type:e.String_unsecure(),isOptional:!0},body:{type:e.String_unsecure(),isOptional:!0},encryptedEnvelope:{type:e.JSONObject(),isOptional:!0},attachments:{type:S,isArray:!0,isOptional:!0},replyToMessageId:{type:e.String_unsecure(),isOptional:!0},revision:{type:e.Int_unsecure(),isOptional:!1},deletedAt:{type:e.DateTime(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),F=t({name:"CommunicationAuthorityGrantV2",description:"Explicit, revocable messaging authority granted to one principal",fields:{id:{type:e.String_unsecure(),isOptional:!1},tenantId:{type:e.String_unsecure(),isOptional:!1},workspaceId:{type:e.String_unsecure(),isOptional:!1},spaceId:{type:e.String_unsecure(),isOptional:!1},roomId:{type:e.String_unsecure(),isOptional:!0},connectionId:{type:e.String_unsecure(),isOptional:!0},principalId:{type:e.String_unsecure(),isOptional:!1},capabilities:{type:e.String_unsecure(),isArray:!0,isOptional:!1},grantedBy:{type:e.String_unsecure(),isOptional:!1},expiresAt:{type:e.DateTime(),isOptional:!0},revokedAt:{type:e.DateTime(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}});var Q={READ:n.ROOMS_READ,WRITE:n.ROOMS_WRITE,MANAGE_MEMBERS:n.ROOM_MEMBERS_MANAGE,MANAGE_CONNECTIONS:n.CONNECTIONS_MANAGE,MANAGE_AUTHORITY:n.GOVERNANCE_MANAGE,SEARCH:n.SEARCH},i=(o,s)=>({surface:"operation",key:o,version:"2.0.0",description:s}),Z=E({meta:{key:"communication-os.ecosystem-messaging",version:"3.0.0",kind:"api",stability:I.Experimental,description:"Standalone and embeddable unified messaging for humans and explicitly authorized agents",owners:["platform.communication-os"],tags:["communication","messaging","agents","hybrid","cross-platform"],docId:[C(u.id)]},provides:[i("communication.space.create","Create isolated messaging spaces"),i("communication.room.create","Create rooms and direct messages"),i("communication.membership.set","Manage room membership"),i("communication.authority.set","Manage revocable principal authority"),i("communication.connection.connect","Connect messaging networks"),i("communication.connection.sync","Synchronize network events"),i("communication.message.send","Send an attributed room message"),i("communication.message.edit","Edit a message revision"),i("communication.message.delete","Delete message content"),i("communication.reaction.set","Set a message reaction"),i("communication.receipt.record","Record delivery and read state"),i("communication.inbox-state.set","Organize the unified inbox"),i("communication.message.search","Search one authorized space")],requires:[{key:"communication-spec",version:"1.0.0",reason:"V2 extends the existing canonical CommunicationSpec surface"}]});import{defineCapability as M,StabilityEnum as N}from"@lssm/lib.contracts-spec";var ie=M({meta:{key:"communication-spec",version:"1.0.0",kind:"data",stability:N.Experimental,description:"Canonical communication contracts for threads, messages, governance, and agent-callable work.",owners:["@platform.core"],tags:["communication","contracts","threads","messages"]}});export{l as COMMS_AI_CAPABILITY_KEYS,n as COMMUNICATION_OS_CAPABILITY_KEYS,h as COMMUNICATION_OS_ROUTE_CAPABILITY_KEYS,P as CommsAiAuditorCapability,k as CommsAiFullCapability,ie as CommunicationSpecCapability,Q as ECOSYSTEM_MESSAGING_CAPABILITY_KEYS,Z as EcosystemMessagingCapability,T as LEGACY_COMMUNICATION_OS_CAPABILITY_KEYS,b as canonicalCommunicationOsCapabilities,d as canonicalCommunicationOsCapability,R as hasLegacyCommunicationOsCapability};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineCommand as s}from"@lssm/lib.contracts-spec";import{defineSchemaModel as o,ScalarTypeEnum as i}from"@lssm/lib.schema";import{defineSchemaModel as t,ScalarTypeEnum as e}from"@lssm/lib.schema";import{defineEnum as a}from"@lssm/lib.schema";var n=a("ChannelType",["email","sms","whatsapp","telegram","matrix","web_chat","voice","internal_chat","custom_adapter","future_bridge","unknown"]),u=a("ThreadStatus",["open","waiting_on_human","waiting_on_external_party","action_required","resolved","archived"]),l=a("MessageStatus",["received","normalized","classified","linked","triaged","replied","archived"]),d=a("ReplyStatus",["drafted","requires_review","approved","sent","failed","blocked_by_policy"]),c=a("HandoffStatus",["created","assigned","acknowledged","completed","reopened"]),r=a("SuggestionStatus",["generated","shown","accepted","edited","rejected","applied","expired"]),y=a("IntentCategory",["support","sales","bug_report","feature_request","billing","onboarding","coordination","general","spam","escalation"]),m=a("ActionSafetyMode",["read_only","draft_only","requires_review","policy_executable","blocked"]),w=a("FeedbackOutcome",["accepted","edited","rejected","unsafe","incomplete"]);var S=t({name:"ChannelAccount",description:"A channel account belonging to a participant",fields:{id:{type:e.String_unsecure(),isOptional:!1},participantId:{type:e.String_unsecure(),isOptional:!1},channelType:{type:n,isOptional:!1},externalId:{type:e.String_unsecure(),isOptional:!1},displayName:{type:e.String_unsecure(),isOptional:!0},metadata:{type:e.JSONObject(),isOptional:!0},isPrimary:{type:e.Boolean(),isOptional:!1,defaultValue:!1},createdAt:{type:e.DateTime(),isOptional:!1}}}),_=t({name:"IdentityLink",description:"Proposed or confirmed relationship between participant identities",fields:{id:{type:e.String_unsecure(),isOptional:!1},participantId:{type:e.String_unsecure(),isOptional:!1},candidateParticipantId:{type:e.String_unsecure(),isOptional:!1},status:{type:r,isOptional:!1,defaultValue:"generated"},confidence:{type:e.Float_unsecure(),isOptional:!1},reasoning:{type:e.String_unsecure(),isOptional:!0},reviewedBy:{type:e.String_unsecure(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),E=t({name:"CommunicationParticipant",description:"A person or system that participates in conversations",fields:{id:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!0},email:{type:e.EmailAddress(),isOptional:!0},accounts:{type:S,isArray:!0,isOptional:!1},identityLinks:{type:_,isArray:!0,isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),A=t({name:"Attachment",description:"A file or media attachment on a message",fields:{id:{type:e.String_unsecure(),isOptional:!1},messageId:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},mimeType:{type:e.String_unsecure(),isOptional:!0},sizeBytes:{type:e.Int_unsecure(),isOptional:!0},url:{type:e.URL(),isOptional:!0},metadata:{type:e.JSONObject(),isOptional:!0}}}),I=t({name:"ThreadLink",description:"Link between a thread and an external business object (V2: rich-reference objectRef replaces V1 objectType/objectId)",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},objectRef:{type:e.JSONObject(),isOptional:!1},relation:{type:e.String_unsecure(),isOptional:!0},confidence:{type:e.Float_unsecure(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),T=t({name:"MessageIntent",description:"Classified message or thread intent with confidence and evidence",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},messageId:{type:e.String_unsecure(),isOptional:!0},category:{type:y,isOptional:!1},confidence:{type:e.Float_unsecure(),isOptional:!1},reasoning:{type:e.String_unsecure(),isOptional:!0},evidenceMessageIds:{type:e.String_unsecure(),isArray:!0,isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),C=t({name:"CommunicationMessage",description:"A single message within a communication thread",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},channelType:{type:n,isOptional:!1},channelAccountId:{type:e.String_unsecure(),isOptional:!1},participantId:{type:e.String_unsecure(),isOptional:!0},externalMessageId:{type:e.String_unsecure(),isOptional:!0},body:{type:e.String_unsecure(),isOptional:!1},bodyNormalized:{type:e.String_unsecure(),isOptional:!0},status:{type:l,isOptional:!1,defaultValue:"received"},intent:{type:T,isOptional:!0},attachments:{type:A,isArray:!0,isOptional:!0},metadata:{type:e.JSONObject(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),N=t({name:"CommunicationFormIntake",description:"Declarative source reference for a communication message mapped into an entity-bound form intake result",fields:{id:{type:e.String_unsecure(),isOptional:!1},messageId:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},channelType:{type:n,isOptional:!1},channelAccountId:{type:e.String_unsecure(),isOptional:!1},participantId:{type:e.String_unsecure(),isOptional:!0},entityKey:{type:e.String_unsecure(),isOptional:!1},projectionKind:{type:e.String_unsecure(),isOptional:!1},formKey:{type:e.String_unsecure(),isOptional:!0},formVersion:{type:e.String_unsecure(),isOptional:!0},completionProfileKey:{type:e.String_unsecure(),isOptional:!0},acceptedValues:{type:e.JSONObject(),isOptional:!1},completionDebt:{type:e.JSONObject(),isArray:!0,isOptional:!1},captureStatus:{type:e.String_unsecure(),isOptional:!1,defaultValue:"accepted"},completionStatus:{type:e.String_unsecure(),isOptional:!1},createdAt:{type:e.DateTime(),isOptional:!1}}}),M=t({name:"CommunicationThread",description:"A conversation thread spanning one or more channels",fields:{id:{type:e.String_unsecure(),isOptional:!1},title:{type:e.String_unsecure(),isOptional:!0},status:{type:u,isOptional:!1,defaultValue:"open"},participantIds:{type:e.String_unsecure(),isArray:!0,isOptional:!1},channelTypes:{type:n,isArray:!0,isOptional:!1},links:{type:I,isArray:!0,isOptional:!0},assignedTo:{type:e.String_unsecure(),isOptional:!0},priority:{type:e.String_unsecure(),isOptional:!0},tags:{type:e.String_unsecure(),isArray:!0,isOptional:!0},metadata:{type:e.JSONObject(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),f=t({name:"CommunicationAction",description:"Structured action extracted from a conversation",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},title:{type:e.String_unsecure(),isOptional:!1},owner:{type:e.String_unsecure(),isOptional:!0},deadline:{type:e.DateTime(),isOptional:!0},blockers:{type:e.String_unsecure(),isArray:!0,isOptional:!0},sourceMessageIds:{type:e.String_unsecure(),isArray:!0,isOptional:!1},safetyMode:{type:m,isOptional:!1,defaultValue:"draft_only"}}}),g=t({name:"ReplyDraft",description:"An AI-generated or human-authored reply draft",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},messageId:{type:e.String_unsecure(),isOptional:!0},body:{type:e.String_unsecure(),isOptional:!1},status:{type:d,isOptional:!1,defaultValue:"drafted"},generatedBy:{type:e.String_unsecure(),isOptional:!0},modelName:{type:e.String_unsecure(),isOptional:!0},promptVersion:{type:e.String_unsecure(),isOptional:!0},policyVersion:{type:e.String_unsecure(),isOptional:!0},reviewedBy:{type:e.String_unsecure(),isOptional:!0},reviewedAt:{type:e.DateTime(),isOptional:!0},metadata:{type:e.JSONObject(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),k=t({name:"HandoffPacket",description:"A structured handoff between owners, teams, or systems",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},status:{type:c,isOptional:!1,defaultValue:"created"},fromOwner:{type:e.String_unsecure(),isOptional:!1},toOwner:{type:e.String_unsecure(),isOptional:!1},summary:{type:e.String_unsecure(),isOptional:!1},keyFacts:{type:e.String_unsecure(),isArray:!0,isOptional:!0},openQuestions:{type:e.String_unsecure(),isArray:!0,isOptional:!0},requiredActions:{type:f,isArray:!0,isOptional:!0},evidenceLinks:{type:e.String_unsecure(),isArray:!0,isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),O=t({name:"CommunicationSummary",description:"AI-generated summary of a thread or message range",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},messageIds:{type:e.String_unsecure(),isArray:!0,isOptional:!0},content:{type:e.String_unsecure(),isOptional:!1},facts:{type:e.JSONObject(),isArray:!0,isOptional:!0},actions:{type:f,isArray:!0,isOptional:!0},decisions:{type:e.JSONObject(),isArray:!0,isOptional:!0},risks:{type:e.JSONObject(),isArray:!0,isOptional:!0},modelName:{type:e.String_unsecure(),isOptional:!0},generatedAt:{type:e.DateTime(),isOptional:!1}}}),h=t({name:"AgentSuggestion",description:"An AI-generated suggestion attached to a thread or message",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},messageId:{type:e.String_unsecure(),isOptional:!0},suggestionType:{type:e.String_unsecure(),isOptional:!1},content:{type:e.String_unsecure(),isOptional:!1},status:{type:r,isOptional:!1,defaultValue:"generated"},modelName:{type:e.String_unsecure(),isOptional:!0},confidence:{type:e.Float_unsecure(),isOptional:!0},policyVersion:{type:e.String_unsecure(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}});var p=["platform.communication-os","platform.ai-routing"],L=s({meta:{key:"comms.thread.summarize",version:"1.0.0",stability:"experimental",owners:[...p],tags:["comms","ai","thread","summarize"],description:"Produce a persona-scoped summary of a communication thread via the AI routing layer",goal:"Give each persona a concise, role-appropriate digest of a thread without exposing cross-persona data",context:"Capability-gated AI operation. Auditor variant omits PII and redacts sensitive identifiers. "+"Draft-only — summary is returned to caller, not persisted by this command. "+"Handler routes to the appropriate model via lib.ai-agent provider selection."},io:{input:o({name:"CommsThreadSummarizeInput",fields:{threadId:{type:i.String_unsecure(),isOptional:!1},messageIds:{type:i.String_unsecure(),isArray:!0,isOptional:!0},audiencePersona:{type:i.String_unsecure(),isOptional:!0}}}),output:O,errors:{THREAD_NOT_FOUND:{description:"No thread exists for the provided threadId",http:404,when:"threadId does not resolve to a persisted thread"},INSUFFICIENT_MESSAGES:{description:"Thread has too few messages to produce a meaningful summary",http:422,when:"Thread contains fewer messages than the minimum required for summarization"},AI_PROVIDER_UNAVAILABLE:{description:"Upstream AI provider could not be reached or returned an error",http:503,when:"lib.ai-agent provider selection fails or provider returns a non-retryable error"},CONTENT_POLICY_BLOCKED:{description:"Summary blocked by content safety policy",http:422,when:"Thread content triggers a content policy gate; summary cannot be generated without redaction"}}},policy:{auth:"user"}}),P=s({meta:{key:"comms.reply.draft",version:"1.0.0",stability:"experimental",owners:[...p],tags:["comms","ai","reply","draft"],description:"Generate a context-aware reply draft via the AI routing layer",goal:"Produce a safe, policy-checked reply draft that the actor can review and send",context:"Capability-gated AI operation. Not available to auditor persona. Draft status reflects policy evaluation: requires_review when policy gates apply. Handler calls communication.reply.draft internals after capability check."},io:{input:o({name:"CommsReplyDraftInput",fields:{threadId:{type:i.String_unsecure(),isOptional:!1},messageId:{type:i.String_unsecure(),isOptional:!0},instruction:{type:i.String_unsecure(),isOptional:!0},toneHint:{type:i.String_unsecure(),isOptional:!0}}}),output:g,errors:{THREAD_NOT_FOUND:{description:"No thread exists for the provided threadId",http:404,when:"threadId does not resolve to a persisted thread"},POLICY_BLOCKED:{description:"Reply draft blocked by content or safety policy",http:422,when:"Thread content or instruction triggers a policy gate; draft cannot be generated"},AI_PROVIDER_UNAVAILABLE:{description:"Upstream AI provider could not be reached or returned an error",http:503,when:"lib.ai-agent provider selection fails or provider returns a non-retryable error"},DRAFT_LIMIT_EXCEEDED:{description:"Too many pending drafts exist for this thread",http:429,when:"Actor has reached the maximum number of unreviewed drafts on this thread"}}},policy:{auth:"user"}}),H=s({meta:{key:"comms.handoff.suggest",version:"1.0.0",stability:"experimental",owners:[...p],tags:["comms","ai","handoff","suggest"],description:"Suggest whether a thread warrants a handoff and to whom, via the AI routing layer",goal:"Surface handoff opportunities with evidence before the actor decides to act",context:"AI suggestion only — does not create a HandoffPacket. "+"Handler evaluates thread urgency, owner gaps, and work-graph signals to produce a ranked suggestion. Auditor variant is read-only and may not trigger the `communication.handoff.create` action."},io:{input:o({name:"CommsHandoffSuggestInput",fields:{threadId:{type:i.String_unsecure(),isOptional:!1},suggestedToOwner:{type:i.String_unsecure(),isOptional:!0},context:{type:i.String_unsecure(),isOptional:!0}}}),output:h,errors:{THREAD_NOT_FOUND:{description:"No thread exists for the provided threadId",http:404,when:"threadId does not resolve to a persisted thread"},INSUFFICIENT_CONTEXT:{description:"Thread has insufficient context to produce a handoff suggestion",http:422,when:"Thread is too short or lacks ownership/urgency signals for the model to reason about"},HANDOFF_NOT_WARRANTED:{description:"Analysis concludes no handoff is needed at this time",http:422,when:"Thread signals are below the handoff threshold; caller should surface this as a no-op result rather than an error"},AI_PROVIDER_UNAVAILABLE:{description:"Upstream AI provider could not be reached or returned an error",http:503,when:"lib.ai-agent provider selection fails or provider returns a non-retryable error"}}},policy:{auth:"user"}});export{H as CommsHandoffSuggestCommand,P as CommsReplyDraftCommand,L as CommsThreadSummarizeCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineCommand as L}from"@lssm/lib.contracts-spec";import{defineSchemaModel as O,ScalarTypeEnum as c}from"@lssm/lib.schema";import{defineEnum as y}from"@lssm/lib.schema";var C=y("ChannelType",["email","sms","whatsapp","telegram","matrix","web_chat","voice","internal_chat","custom_adapter","future_bridge","unknown"]),N=y("ThreadStatus",["open","waiting_on_human","waiting_on_external_party","action_required","resolved","archived"]),K=y("MessageStatus",["received","normalized","classified","linked","triaged","replied","archived"]),Q=y("ReplyStatus",["drafted","requires_review","approved","sent","failed","blocked_by_policy"]),Ae=y("HandoffStatus",["created","assigned","acknowledged","completed","reopened"]),le=y("SuggestionStatus",["generated","shown","accepted","edited","rejected","applied","expired"]),Te=y("IntentCategory",["support","sales","bug_report","feature_request","billing","onboarding","coordination","general","spam","escalation"]),J=y("ActionSafetyMode",["read_only","draft_only","requires_review","policy_executable","blocked"]),Ee=y("FeedbackOutcome",["accepted","edited","rejected","unsafe","incomplete"]);import{defineSchemaModel as r,ScalarTypeEnum as e}from"@lssm/lib.schema";var $e=r({name:"ChannelAccount",description:"A channel account belonging to a participant",fields:{id:{type:e.String_unsecure(),isOptional:!1},participantId:{type:e.String_unsecure(),isOptional:!1},channelType:{type:C,isOptional:!1},externalId:{type:e.String_unsecure(),isOptional:!1},displayName:{type:e.String_unsecure(),isOptional:!0},metadata:{type:e.JSONObject(),isOptional:!0},isPrimary:{type:e.Boolean(),isOptional:!1,defaultValue:!1},createdAt:{type:e.DateTime(),isOptional:!1}}}),Y=r({name:"IdentityLink",description:"Proposed or confirmed relationship between participant identities",fields:{id:{type:e.String_unsecure(),isOptional:!1},participantId:{type:e.String_unsecure(),isOptional:!1},candidateParticipantId:{type:e.String_unsecure(),isOptional:!1},status:{type:le,isOptional:!1,defaultValue:"generated"},confidence:{type:e.Float_unsecure(),isOptional:!1},reasoning:{type:e.String_unsecure(),isOptional:!0},reviewedBy:{type:e.String_unsecure(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),Xt=r({name:"CommunicationParticipant",description:"A person or system that participates in conversations",fields:{id:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!0},email:{type:e.EmailAddress(),isOptional:!0},accounts:{type:$e,isArray:!0,isOptional:!1},identityLinks:{type:Y,isArray:!0,isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),et=r({name:"Attachment",description:"A file or media attachment on a message",fields:{id:{type:e.String_unsecure(),isOptional:!1},messageId:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},mimeType:{type:e.String_unsecure(),isOptional:!0},sizeBytes:{type:e.Int_unsecure(),isOptional:!0},url:{type:e.URL(),isOptional:!0},metadata:{type:e.JSONObject(),isOptional:!0}}}),E=r({name:"ThreadLink",description:"Link between a thread and an external business object (V2: rich-reference objectRef replaces V1 objectType/objectId)",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},objectRef:{type:e.JSONObject(),isOptional:!1},relation:{type:e.String_unsecure(),isOptional:!0},confidence:{type:e.Float_unsecure(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),de=r({name:"MessageIntent",description:"Classified message or thread intent with confidence and evidence",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},messageId:{type:e.String_unsecure(),isOptional:!0},category:{type:Te,isOptional:!1},confidence:{type:e.Float_unsecure(),isOptional:!1},reasoning:{type:e.String_unsecure(),isOptional:!0},evidenceMessageIds:{type:e.String_unsecure(),isArray:!0,isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),j=r({name:"CommunicationMessage",description:"A single message within a communication thread",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},channelType:{type:C,isOptional:!1},channelAccountId:{type:e.String_unsecure(),isOptional:!1},participantId:{type:e.String_unsecure(),isOptional:!0},externalMessageId:{type:e.String_unsecure(),isOptional:!0},body:{type:e.String_unsecure(),isOptional:!1},bodyNormalized:{type:e.String_unsecure(),isOptional:!0},status:{type:K,isOptional:!1,defaultValue:"received"},intent:{type:de,isOptional:!0},attachments:{type:et,isArray:!0,isOptional:!0},metadata:{type:e.JSONObject(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),Zt=r({name:"CommunicationFormIntake",description:"Declarative source reference for a communication message mapped into an entity-bound form intake result",fields:{id:{type:e.String_unsecure(),isOptional:!1},messageId:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},channelType:{type:C,isOptional:!1},channelAccountId:{type:e.String_unsecure(),isOptional:!1},participantId:{type:e.String_unsecure(),isOptional:!0},entityKey:{type:e.String_unsecure(),isOptional:!1},projectionKind:{type:e.String_unsecure(),isOptional:!1},formKey:{type:e.String_unsecure(),isOptional:!0},formVersion:{type:e.String_unsecure(),isOptional:!0},completionProfileKey:{type:e.String_unsecure(),isOptional:!0},acceptedValues:{type:e.JSONObject(),isOptional:!1},completionDebt:{type:e.JSONObject(),isArray:!0,isOptional:!1},captureStatus:{type:e.String_unsecure(),isOptional:!1,defaultValue:"accepted"},completionStatus:{type:e.String_unsecure(),isOptional:!1},createdAt:{type:e.DateTime(),isOptional:!1}}}),k=r({name:"CommunicationThread",description:"A conversation thread spanning one or more channels",fields:{id:{type:e.String_unsecure(),isOptional:!1},title:{type:e.String_unsecure(),isOptional:!0},status:{type:N,isOptional:!1,defaultValue:"open"},participantIds:{type:e.String_unsecure(),isArray:!0,isOptional:!1},channelTypes:{type:C,isArray:!0,isOptional:!1},links:{type:E,isArray:!0,isOptional:!0},assignedTo:{type:e.String_unsecure(),isOptional:!0},priority:{type:e.String_unsecure(),isOptional:!0},tags:{type:e.String_unsecure(),isArray:!0,isOptional:!0},metadata:{type:e.JSONObject(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),X=r({name:"CommunicationAction",description:"Structured action extracted from a conversation",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},title:{type:e.String_unsecure(),isOptional:!1},owner:{type:e.String_unsecure(),isOptional:!0},deadline:{type:e.DateTime(),isOptional:!0},blockers:{type:e.String_unsecure(),isArray:!0,isOptional:!0},sourceMessageIds:{type:e.String_unsecure(),isArray:!0,isOptional:!1},safetyMode:{type:J,isOptional:!1,defaultValue:"draft_only"}}}),P=r({name:"ReplyDraft",description:"An AI-generated or human-authored reply draft",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},messageId:{type:e.String_unsecure(),isOptional:!0},body:{type:e.String_unsecure(),isOptional:!1},status:{type:Q,isOptional:!1,defaultValue:"drafted"},generatedBy:{type:e.String_unsecure(),isOptional:!0},modelName:{type:e.String_unsecure(),isOptional:!0},promptVersion:{type:e.String_unsecure(),isOptional:!0},policyVersion:{type:e.String_unsecure(),isOptional:!0},reviewedBy:{type:e.String_unsecure(),isOptional:!0},reviewedAt:{type:e.DateTime(),isOptional:!0},metadata:{type:e.JSONObject(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),Me=r({name:"HandoffPacket",description:"A structured handoff between owners, teams, or systems",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},status:{type:Ae,isOptional:!1,defaultValue:"created"},fromOwner:{type:e.String_unsecure(),isOptional:!1},toOwner:{type:e.String_unsecure(),isOptional:!1},summary:{type:e.String_unsecure(),isOptional:!1},keyFacts:{type:e.String_unsecure(),isArray:!0,isOptional:!0},openQuestions:{type:e.String_unsecure(),isArray:!0,isOptional:!0},requiredActions:{type:X,isArray:!0,isOptional:!0},evidenceLinks:{type:e.String_unsecure(),isArray:!0,isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),Z=r({name:"CommunicationSummary",description:"AI-generated summary of a thread or message range",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},messageIds:{type:e.String_unsecure(),isArray:!0,isOptional:!0},content:{type:e.String_unsecure(),isOptional:!1},facts:{type:e.JSONObject(),isArray:!0,isOptional:!0},actions:{type:X,isArray:!0,isOptional:!0},decisions:{type:e.JSONObject(),isArray:!0,isOptional:!0},risks:{type:e.JSONObject(),isArray:!0,isOptional:!0},modelName:{type:e.String_unsecure(),isOptional:!0},generatedAt:{type:e.DateTime(),isOptional:!1}}}),ee=r({name:"AgentSuggestion",description:"An AI-generated suggestion attached to a thread or message",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},messageId:{type:e.String_unsecure(),isOptional:!0},suggestionType:{type:e.String_unsecure(),isOptional:!1},content:{type:e.String_unsecure(),isOptional:!1},status:{type:le,isOptional:!1,defaultValue:"generated"},modelName:{type:e.String_unsecure(),isOptional:!0},confidence:{type:e.Float_unsecure(),isOptional:!0},policyVersion:{type:e.String_unsecure(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}});var B=["platform.communication-os"],an=L({meta:{key:"communication.decision.extract",version:"1.0.0",stability:"experimental",owners:[...B],tags:["communication","decision","extract"],description:"Extract decisions and open questions from a thread",goal:"Make buried decisions reviewable with source references",context:"Read-only/draft-only operation for summaries and handoffs"},io:{input:O({name:"ExtractDecisionsInput",fields:{threadId:{type:c.String_unsecure(),isOptional:!1}}}),output:O({name:"ExtractDecisionsOutput",fields:{decisions:{type:c.JSONObject(),isArray:!0,isOptional:!1}}})},policy:{auth:"user"}}),sn=L({meta:{key:"communication.risk.extract",version:"1.0.0",stability:"experimental",owners:[...B],tags:["communication","risk","blocker"],description:"Extract risks and blockers from a thread",goal:"Surface blockers, policy risks, and unresolved dependencies",context:"Read-only/draft-only operation for triage and escalation"},io:{input:O({name:"ExtractRisksInput",fields:{threadId:{type:c.String_unsecure(),isOptional:!1}}}),output:O({name:"ExtractRisksOutput",fields:{risks:{type:c.JSONObject(),isArray:!0,isOptional:!1}}})},policy:{auth:"user"}}),rn=L({meta:{key:"communication.reply.draft",version:"1.0.0",stability:"experimental",owners:[...B],tags:["communication","reply","draft"],description:"Draft a reply using thread context and policy",goal:"Generate a safe, context-aware reply draft",context:"Draft-only operation; policy may require review or block the draft"},io:{input:O({name:"DraftReplyInput",fields:{threadId:{type:c.String_unsecure(),isOptional:!1},messageId:{type:c.String_unsecure(),isOptional:!0},instruction:{type:c.String_unsecure(),isOptional:!0}}}),output:P},policy:{auth:"user"}}),cn=L({meta:{key:"communication.reply.send",version:"1.0.0",stability:"experimental",owners:[...B],tags:["communication","reply","send"],description:"Send an approved reply through its channel",goal:"Deliver a reply only when policy allows",context:"Policy-executable operation; every sent reply must be auditable"},io:{input:O({name:"SendReplyInput",fields:{draftId:{type:c.String_unsecure(),isOptional:!1}}}),output:O({name:"SendReplyOutput",fields:{draftId:{type:c.String_unsecure(),isOptional:!1},status:{type:Q,isOptional:!1},sentAt:{type:c.DateTime(),isOptional:!0}}})},policy:{auth:"user"}}),pn=L({meta:{key:"communication.reply.blockByPolicy",version:"1.0.0",stability:"experimental",owners:[...B],tags:["communication","reply","policy","blocked"],description:"Record that a reply was blocked by policy",goal:"Keep blocked reply decisions explicit and auditable",context:"Used by reply policy gates before any outbound side effect"},io:{input:O({name:"BlockReplyByPolicyInput",fields:{draftId:{type:c.String_unsecure(),isOptional:!1},policyRef:{type:c.String_unsecure(),isOptional:!1},reason:{type:c.String_unsecure(),isOptional:!1}}}),output:P},policy:{auth:"admin"}});import{defineCommand as q}from"@lssm/lib.contracts-spec";import{defineSchemaModel as te,ScalarTypeEnum as p}from"@lssm/lib.schema";var G=["platform.communication-os"],fn=q({meta:{key:"communication.handoff.create",version:"1.0.0",stability:"experimental",owners:[...G],tags:["communication","handoff"],description:"Create a handoff packet for a thread",goal:"Transfer context safely between owners or systems",context:"Requires evidence links and does not close source thread automatically"},io:{input:te({name:"CreateHandoffInput",fields:{threadId:{type:p.String_unsecure(),isOptional:!1},fromOwner:{type:p.String_unsecure(),isOptional:!1},toOwner:{type:p.String_unsecure(),isOptional:!1},reason:{type:p.String_unsecure(),isOptional:!0}}}),output:Me},policy:{auth:"user"}}),gn=q({meta:{key:"communication.threadLink.propose",version:"1.0.0",stability:"experimental",owners:[...G],tags:["communication","thread-link","propose"],description:"Propose a link between a thread and a business object",goal:"Let future vertical consumers bind domain objects without changing the core",context:"Draft-only operation; domain packs own object semantics"},io:{input:E,output:E},policy:{auth:"user"}}),hn=q({meta:{key:"communication.identityLink.propose",version:"1.0.0",stability:"experimental",owners:[...G],tags:["communication","identity","propose"],description:"Propose a participant identity link",goal:"Resolve cross-channel identities without reckless auto-merge",context:"Draft-only operation; high-impact merges require human review"},io:{input:Y,output:Y},policy:{auth:"user"}}),On=q({meta:{key:"communication.escalation.request",version:"1.0.0",stability:"experimental",owners:[...G],tags:["communication","escalation"],description:"Request human escalation for a thread",goal:"Surface high-risk, blocked, or unresolved conversations to a human owner",context:"Policy-executable operation that emits escalation evidence"},io:{input:te({name:"EscalateToHumanInput",fields:{threadId:{type:p.String_unsecure(),isOptional:!1},reason:{type:p.String_unsecure(),isOptional:!1},targetOwner:{type:p.String_unsecure(),isOptional:!0}}}),output:ee},policy:{auth:"user"}}),Sn=q({meta:{key:"communication.feedback.record",version:"1.0.0",stability:"experimental",owners:[...G],tags:["communication","feedback"],description:"Record human feedback on a suggestion, draft, or extraction",goal:"Make AI correction signals auditable and replayable",context:"Used by review surfaces and future evaluation runs"},io:{input:te({name:"RecordHumanFeedbackInput",fields:{targetId:{type:p.String_unsecure(),isOptional:!1},targetType:{type:p.String_unsecure(),isOptional:!1},outcome:{type:Ee,isOptional:!1},notes:{type:p.String_unsecure(),isOptional:!0}}}),output:te({name:"RecordHumanFeedbackOutput",fields:{feedbackId:{type:p.String_unsecure(),isOptional:!1},safetyMode:{type:J,isOptional:!1}}})},policy:{auth:"user"}});import{defineCommand as De,defineQuery as ct,docId as pt}from"@lssm/lib.contracts-spec";import{defineEnum as Ve,defineSchemaModel as ge,ScalarTypeEnum as u}from"@lssm/lib.schema";import{defineEnum as S,defineSchemaModel as f,ScalarTypeEnum as t}from"@lssm/lib.schema";var tt=S("CommunicationSpaceKind",["personal","organization"]),nt=S("CommunicationPrincipalKind",["human","agent","system"]),it=S("CommunicationConnectionPlacement",["device","managed_cloud","self_hosted"]),In=S("CommunicationConnectionNetwork",["email","sms","slack","teams","telegram","whatsapp","discord","matrix"]),ot=S("CommunicationEncryptionMode",["client_encrypted","governed_server_indexable"]),at=S("CommunicationMembershipState",["active","revoked"]),Re=S("CommunicationReceiptKind",["delivered","read"]),st=S("CommunicationConnectionHealth",["connecting","healthy","degraded","offline","revoked"]),ne={id:"communication-os.ecosystem-messaging.v2",title:"CommunicationOS ecosystem messaging contracts",body:"Versioned, workspace-scoped contracts for personal and organization spaces, rooms, human and agent membership, hybrid channel connections, synchronized messages, and revocable outbound authority. CommunicationSpec remains canonical; provider protocols are adapters. V1 thread and draft-only operations remain unchanged.",kind:"reference",route:"/docs/communication-os/ecosystem-messaging-v2",visibility:"public"},_=f({name:"CommunicationScopeV2",description:"Strict tenant, workspace, and space boundary for messaging state",fields:{tenantId:{type:t.String_unsecure(),isOptional:!1},workspaceId:{type:t.String_unsecure(),isOptional:!1},spaceId:{type:t.String_unsecure(),isOptional:!1}}}),ie=f({name:"CommunicationSpaceV2",description:"Personal or organization messaging boundary under one account",fields:{id:{type:t.String_unsecure(),isOptional:!1},tenantId:{type:t.String_unsecure(),isOptional:!1},workspaceId:{type:t.String_unsecure(),isOptional:!1},name:{type:t.String_unsecure(),isOptional:!1},kind:{type:tt,isOptional:!1},encryptionMode:{type:ot,isOptional:!1},createdAt:{type:t.DateTime(),isOptional:!1}}}),bn=f({name:"CommunicationPrincipalV2",description:"Auditable human, agent, or system identity",fields:{id:{type:t.String_unsecure(),isOptional:!1},kind:{type:nt,isOptional:!1},displayName:{type:t.String_unsecure(),isOptional:!1},ownerPrincipalId:{type:t.String_unsecure(),isOptional:!0},createdAt:{type:t.DateTime(),isOptional:!1}}}),oe=f({name:"CommunicationRoomV2",description:"Room or direct-message projection inside one space",fields:{id:{type:t.String_unsecure(),isOptional:!1},tenantId:{type:t.String_unsecure(),isOptional:!1},workspaceId:{type:t.String_unsecure(),isOptional:!1},spaceId:{type:t.String_unsecure(),isOptional:!1},name:{type:t.String_unsecure(),isOptional:!0},roomKind:{type:t.String_unsecure(),isOptional:!1},connectionIds:{type:t.String_unsecure(),isArray:!0,isOptional:!1},createdAt:{type:t.DateTime(),isOptional:!1},updatedAt:{type:t.DateTime(),isOptional:!1}}}),me=f({name:"CommunicationRoomMembershipV2",description:"Revocable principal membership and room-scoped capabilities",fields:{id:{type:t.String_unsecure(),isOptional:!1},tenantId:{type:t.String_unsecure(),isOptional:!1},workspaceId:{type:t.String_unsecure(),isOptional:!1},spaceId:{type:t.String_unsecure(),isOptional:!1},roomId:{type:t.String_unsecure(),isOptional:!1},principalId:{type:t.String_unsecure(),isOptional:!1},role:{type:t.String_unsecure(),isOptional:!1},state:{type:at,isOptional:!1},capabilities:{type:t.String_unsecure(),isArray:!0,isOptional:!1},expiresAt:{type:t.DateTime(),isOptional:!0},revokedAt:{type:t.DateTime(),isOptional:!0},createdAt:{type:t.DateTime(),isOptional:!1}}}),ye=f({name:"CommunicationChannelConnectionV2",description:"Credential-reference-only local, managed, or self-hosted channel connection",fields:{id:{type:t.String_unsecure(),isOptional:!1},tenantId:{type:t.String_unsecure(),isOptional:!1},workspaceId:{type:t.String_unsecure(),isOptional:!1},spaceId:{type:t.String_unsecure(),isOptional:!1},network:{type:t.String_unsecure(),isOptional:!1},placement:{type:it,isOptional:!1},externalAccountRef:{type:t.String_unsecure(),isOptional:!1},credentialRef:{type:t.String_unsecure(),isOptional:!1},health:{type:st,isOptional:!1},capabilities:{type:t.String_unsecure(),isArray:!0,isOptional:!1},createdAt:{type:t.DateTime(),isOptional:!1},updatedAt:{type:t.DateTime(),isOptional:!1}}}),rt=f({name:"CommunicationAttachmentV2",description:"Public-safe metadata for an opaque, scope-bound message attachment",fields:{id:{type:t.String_unsecure(),isOptional:!1},name:{type:t.String_unsecure(),isOptional:!1},mimeType:{type:t.String_unsecure(),isOptional:!1},sizeBytes:{type:t.Int_unsecure(),isOptional:!1},sha256:{type:t.String_unsecure(),isOptional:!1},createdAt:{type:t.DateTime(),isOptional:!1}}}),w=f({name:"CommunicationMessageV2",description:"Canonical room message with explicit author and encryption posture",fields:{id:{type:t.String_unsecure(),isOptional:!1},tenantId:{type:t.String_unsecure(),isOptional:!1},workspaceId:{type:t.String_unsecure(),isOptional:!1},spaceId:{type:t.String_unsecure(),isOptional:!1},roomId:{type:t.String_unsecure(),isOptional:!1},authorPrincipalId:{type:t.String_unsecure(),isOptional:!1},connectionId:{type:t.String_unsecure(),isOptional:!0},externalMessageId:{type:t.String_unsecure(),isOptional:!0},body:{type:t.String_unsecure(),isOptional:!0},encryptedEnvelope:{type:t.JSONObject(),isOptional:!0},attachments:{type:rt,isArray:!0,isOptional:!0},replyToMessageId:{type:t.String_unsecure(),isOptional:!0},revision:{type:t.Int_unsecure(),isOptional:!1},deletedAt:{type:t.DateTime(),isOptional:!0},createdAt:{type:t.DateTime(),isOptional:!1},updatedAt:{type:t.DateTime(),isOptional:!1}}}),fe=f({name:"CommunicationAuthorityGrantV2",description:"Explicit, revocable messaging authority granted to one principal",fields:{id:{type:t.String_unsecure(),isOptional:!1},tenantId:{type:t.String_unsecure(),isOptional:!1},workspaceId:{type:t.String_unsecure(),isOptional:!1},spaceId:{type:t.String_unsecure(),isOptional:!1},roomId:{type:t.String_unsecure(),isOptional:!0},connectionId:{type:t.String_unsecure(),isOptional:!0},principalId:{type:t.String_unsecure(),isOptional:!1},capabilities:{type:t.String_unsecure(),isArray:!0,isOptional:!1},grantedBy:{type:t.String_unsecure(),isOptional:!1},expiresAt:{type:t.DateTime(),isOptional:!0},revokedAt:{type:t.DateTime(),isOptional:!0},createdAt:{type:t.DateTime(),isOptional:!1}}});var he=["platform.communication-os"],ut={id:"communication-os.governed-work.v1",title:"CommunicationOS governed work contracts",body:"Persisted, scope-isolated reviews for identity, drafts, actions, handoffs, escalations, triage, summaries, agents, consent, retention, and policy. Managed decisions require current manager authority and every transition appends evidence.",kind:"reference",route:"/docs/communication-os/governed-work-v1",visibility:"public"},Oe=[pt(ut.id)],lt=Ve("CommunicationGovernedWorkKind",["identity_review","draft","action","handoff","escalation","triage","summary","agent","consent","retention","policy"]),Ne=Ve("CommunicationGovernedWorkStatus",["pending","approved","rejected","blocked","resolved","revoked"]),ae=ge({name:"CommunicationGovernedWorkV1",fields:{id:{type:u.String_unsecure(),isOptional:!1},kind:{type:lt,isOptional:!1},status:{type:Ne,isOptional:!1},title:{type:u.String_unsecure(),isOptional:!1},threadId:{type:u.String_unsecure(),isOptional:!0},details:{type:u.JSONObject(),isOptional:!1},revision:{type:u.Int_unsecure(),isOptional:!1},createdBy:{type:u.String_unsecure(),isOptional:!1},createdAt:{type:u.DateTime(),isOptional:!1},updatedBy:{type:u.String_unsecure(),isOptional:!1},updatedAt:{type:u.DateTime(),isOptional:!1}}}),An=ct({meta:{key:"communication.governed_work.list",version:"1.0.0",stability:"experimental",owners:[...he],tags:["communication","governance","work","query"],description:"List governed work in one authorized messaging space",goal:"Drive review queues from replayable state rather than fixtures",context:"The server derives scope and filters optional kinds",docId:Oe},io:{input:_,output:ge({name:"ListCommunicationGovernedWorkV1Output",fields:{items:{type:ae,isArray:!0,isOptional:!1}}})},policy:{auth:"user"}}),dt=De({meta:{key:"communication.governed_work.create",version:"1.0.0",stability:"experimental",owners:[...he],tags:["communication","governance","work","create"],description:"Create one idempotent governed work item",goal:"Start an accountable review from a real user or runtime action",context:"Client-supplied tenant or principal authority is rejected",docId:Oe},io:{input:ae,output:ae},policy:{auth:"user"}}),mt=De({meta:{key:"communication.governed_work.transition",version:"1.0.0",stability:"experimental",owners:[...he],tags:["communication","governance","work","transition"],description:"Apply one policy-valid governed work transition",goal:"Record approval, denial, resolution, blocking, or revocation evidence",context:"Managed kinds require current manager authority and terminal transitions fail closed",docId:Oe},io:{input:ge({name:"TransitionCommunicationGovernedWorkV1Input",fields:{workId:{type:u.String_unsecure(),isOptional:!1},status:{type:Ne,isOptional:!1},reason:{type:u.String_unsecure(),isOptional:!0}}}),output:ae},policy:{auth:"user"}});import{defineCommand as yt,defineQuery as Pe,docId as ft}from"@lssm/lib.contracts-spec";import{defineEnum as gt,defineSchemaModel as M,ScalarTypeEnum as o}from"@lssm/lib.schema";var Se=["platform.communication-os"],ht={id:"communication-os.identity-resolution.v1",title:"CommunicationOS identity resolution contracts",body:"Scope-isolated account and contact projections plus a human-reviewed identity merge or rejection lifecycle. Provider credentials and raw identity evidence never enter public outputs.",kind:"reference",route:"/docs/communication-os/identity-resolution-v1",visibility:"public"},_e=[ft(ht.id)],je=gt("CommunicationIdentityReviewStatus",["pending","merged","rejected"]),Ot=M({name:"CommunicationAccountV2",description:"Public-safe provider account projection in one authorized space",fields:{id:{type:o.String_unsecure(),isOptional:!1},network:{type:o.String_unsecure(),isOptional:!1},externalAccountRef:{type:o.String_unsecure(),isOptional:!1},placement:{type:o.String_unsecure(),isOptional:!1},health:{type:o.String_unsecure(),isOptional:!1},createdAt:{type:o.DateTime(),isOptional:!1},updatedAt:{type:o.DateTime(),isOptional:!1}}}),St=M({name:"CommunicationContactV2",description:"Participant projection derived from persisted scoped messages",fields:{principalId:{type:o.String_unsecure(),isOptional:!1},displayName:{type:o.String_unsecure(),isOptional:!0},roomIds:{type:o.String_unsecure(),isArray:!0,isOptional:!1},messageCount:{type:o.Int_unsecure(),isOptional:!1},lastSeenAt:{type:o.DateTime(),isOptional:!1}}}),_t=M({name:"ListCommunicationAccountsV2Output",fields:{accounts:{type:Ot,isArray:!0,isOptional:!1}}}),vt=M({name:"ListCommunicationContactsV2Output",fields:{contacts:{type:St,isArray:!0,isOptional:!1}}}),Dn=Pe({meta:{key:"communication.account.list",version:"2.0.0",stability:"experimental",owners:[...Se],tags:["communication","account","identity"],description:"List public-safe provider accounts in one authorized space",goal:"Expose account readiness without leaking credential references",context:"Authority is derived by the server from the authenticated scope",docId:_e},io:{input:_,output:_t},policy:{auth:"user"}}),Vn=Pe({meta:{key:"communication.contact.list",version:"2.0.0",stability:"experimental",owners:[...Se],tags:["communication","contact","identity"],description:"List persisted participant projections in one authorized space",goal:"Provide a real scoped contact index without provider identity leakage",context:"Contacts are replayable projections, never transient UI inference",docId:_e},io:{input:_,output:vt},policy:{auth:"user"}}),It=yt({meta:{key:"communication.identity.decide",version:"1.0.0",stability:"experimental",owners:[...Se],tags:["communication","identity","review","governance"],description:"Merge or reject one pending identity review",goal:"Require an auditable human decision before cross-channel identity linkage",context:"Only authorized managers may decide and each review is single-transition",docId:_e},io:{input:M({name:"DecideCommunicationIdentityV1Input",fields:{reviewId:{type:o.String_unsecure(),isOptional:!1},decision:{type:je,isOptional:!1},reason:{type:o.String_unsecure(),isOptional:!0}}}),output:M({name:"DecideCommunicationIdentityV1Output",fields:{reviewId:{type:o.String_unsecure(),isOptional:!1},status:{type:je,isOptional:!1},revision:{type:o.Int_unsecure(),isOptional:!1}}})},policy:{auth:"admin"}});import{defineCommand as A,defineQuery as Ge,docId as bt}from"@lssm/lib.contracts-spec";import{defineSchemaModel as v,ScalarTypeEnum as n}from"@lssm/lib.schema";var g=["platform.communication-os"],h=[bt(ne.id)],ze={VALIDATION_FAILED:{description:"Message content, replay key, or attachment references are invalid.",http:422,when:"The request is malformed, empty, duplicated, or exceeds a declared limit."},FORBIDDEN:{description:"The authenticated principal cannot access or mutate the selected room.",http:403,when:"Workspace, space, room membership, connection binding, or send authority is absent."},SERVICE_UNAVAILABLE:{description:"The scoped messaging runtime or search projection is unavailable.",http:503,when:"A required durable runtime dependency cannot safely answer the operation."}},Bn=A({meta:{key:"communication.message.send",version:"2.1.0",stability:"experimental",owners:[...g],tags:["communication","message","send","authority"],description:"Send a canonical room message as an explicitly attributed principal",goal:"Give authorized humans and agents the same audited messaging path",context:"The runtime must re-evaluate membership, authority, consent, encryption posture, and connection policy immediately before dispatch",docId:h},io:{input:w,output:w},policy:{auth:"user"}}),xt=v({name:"SendCommunicationMessageV3Input",fields:{workspaceId:{type:n.String_unsecure(),isOptional:!1},spaceId:{type:n.String_unsecure(),isOptional:!1},roomId:{type:n.String_unsecure(),isOptional:!1},connectionId:{type:n.String_unsecure(),isOptional:!0},idempotencyKey:{type:n.String_unsecure(),isOptional:!1},body:{type:n.String_unsecure(),isOptional:!0},encryptedEnvelope:{type:n.JSONObject(),isOptional:!0},attachmentIds:{type:n.String_unsecure(),isArray:!0,isOptional:!0},replyToMessageId:{type:n.String_unsecure(),isOptional:!0}}}),qn=A({meta:{key:"communication.message.send",version:"3.0.0",stability:"experimental",owners:[...g],tags:["communication","message","send","authority","idempotency"],description:"Send a canonical room message from a JSON-safe, replay-safe client intent",goal:"Keep tenant, author, revision, identifiers, and timestamps server-owned",context:"The runtime derives tenant and author from the authenticated context, verifies workspace/space/room membership and attachment ownership, then applies the idempotency key before dispatch",docId:h},io:{input:xt,output:w,errors:ze},policy:{auth:"user"}}),Ue=v({name:"MutateCommunicationMessageV2Input",fields:{tenantId:{type:n.String_unsecure(),isOptional:!1},workspaceId:{type:n.String_unsecure(),isOptional:!1},spaceId:{type:n.String_unsecure(),isOptional:!1},roomId:{type:n.String_unsecure(),isOptional:!1},messageId:{type:n.String_unsecure(),isOptional:!1},actorPrincipalId:{type:n.String_unsecure(),isOptional:!1},body:{type:n.String_unsecure(),isOptional:!0},encryptedEnvelope:{type:n.JSONObject(),isOptional:!0},expectedRevision:{type:n.Int_unsecure(),isOptional:!1}}}),Gn=A({meta:{key:"communication.message.edit",version:"2.0.0",stability:"experimental",owners:[...g],tags:["communication","message","edit"],description:"Edit a message with optimistic revision protection",goal:"Preserve provider edits in the canonical event journal without rewriting history",context:"Unsupported provider edits must return an explicit capability error rather than silently diverge",docId:h},io:{input:Ue,output:w},policy:{auth:"user"}}),zn=A({meta:{key:"communication.message.delete",version:"2.0.0",stability:"experimental",owners:[...g],tags:["communication","message","delete"],description:"Append an auditable message deletion or provider-retention marker",goal:"Represent local and provider deletion honestly across heterogeneous networks",context:"The event journal retains non-content evidence even when message content is erased",docId:h},io:{input:Ue,output:w},policy:{auth:"user"}}),Le=v({name:"CommunicationReactionV2Input",fields:{tenantId:{type:n.String_unsecure(),isOptional:!1},workspaceId:{type:n.String_unsecure(),isOptional:!1},spaceId:{type:n.String_unsecure(),isOptional:!1},roomId:{type:n.String_unsecure(),isOptional:!1},messageId:{type:n.String_unsecure(),isOptional:!1},principalId:{type:n.String_unsecure(),isOptional:!1},reaction:{type:n.String_unsecure(),isOptional:!1},active:{type:n.Boolean(),isOptional:!1}}}),Un=A({meta:{key:"communication.reaction.set",version:"2.0.0",stability:"experimental",owners:[...g],tags:["communication","message","reaction"],description:"Add or remove a reaction on a canonical message",goal:"Normalize lightweight acknowledgement across supported networks",context:"Adapters report unsupported reactions explicitly",docId:h},io:{input:Le,output:Le},policy:{auth:"user"}}),Be=v({name:"CommunicationReceiptV2Input",fields:{tenantId:{type:n.String_unsecure(),isOptional:!1},workspaceId:{type:n.String_unsecure(),isOptional:!1},spaceId:{type:n.String_unsecure(),isOptional:!1},roomId:{type:n.String_unsecure(),isOptional:!1},messageId:{type:n.String_unsecure(),isOptional:!1},principalId:{type:n.String_unsecure(),isOptional:!1},kind:{type:Re,isOptional:!1},occurredAt:{type:n.DateTime(),isOptional:!1}}}),Fn=A({meta:{key:"communication.receipt.record",version:"2.0.0",stability:"experimental",owners:[...g],tags:["communication","message","receipt"],description:"Record a delivered or read receipt",goal:"Keep unread and delivery projections consistent across clients",context:"Privacy policy may suppress outbound read receipts per space or connection",docId:h},io:{input:Be,output:Be},policy:{auth:"user"}}),qe=v({name:"CommunicationInboxStateV2Input",fields:{tenantId:{type:n.String_unsecure(),isOptional:!1},workspaceId:{type:n.String_unsecure(),isOptional:!1},spaceId:{type:n.String_unsecure(),isOptional:!1},roomId:{type:n.String_unsecure(),isOptional:!1},principalId:{type:n.String_unsecure(),isOptional:!1},pinned:{type:n.Boolean(),isOptional:!1},archived:{type:n.Boolean(),isOptional:!1},snoozedUntil:{type:n.DateTime(),isOptional:!0},reminderAt:{type:n.DateTime(),isOptional:!0}}}),Hn=A({meta:{key:"communication.inbox-state.set",version:"2.0.0",stability:"experimental",owners:[...g],tags:["communication","inbox","pin","archive","snooze","reminder"],description:"Set one principal's pin, archive, snooze, and reminder state",goal:"Synchronize inbox organization without leaking message content",context:"Personal inbox state is principal-private even inside organization workspaces",docId:h},io:{input:qe,output:qe},policy:{auth:"user"}}),Ct=v({name:"SearchCommunicationMessagesV2Input",fields:{tenantId:{type:n.String_unsecure(),isOptional:!1},workspaceId:{type:n.String_unsecure(),isOptional:!1},spaceId:{type:n.String_unsecure(),isOptional:!1},query:{type:n.String_unsecure(),isOptional:!1},roomIds:{type:n.String_unsecure(),isArray:!0,isOptional:!0},limit:{type:n.Int_unsecure(),isOptional:!0}}}),Fe=v({name:"SearchCommunicationMessagesV2Output",fields:{messages:{type:w,isArray:!0,isOptional:!1},nextCursor:{type:n.String_unsecure(),isOptional:!0}}}),Wn=Ge({meta:{key:"communication.message.search",version:"2.0.0",stability:"experimental",owners:[...g],tags:["communication","message","search"],description:"Search messages within exactly one authorized space",goal:"Provide cross-network search without cross-space index leakage",context:"Client-encrypted spaces search a local decrypted projection; server-indexable spaces use governed indexes",docId:h},io:{input:Ct,output:Fe},policy:{auth:"user"}}),kt=v({name:"SearchCommunicationMessagesV3Input",fields:{workspaceId:{type:n.String_unsecure(),isOptional:!1},spaceId:{type:n.String_unsecure(),isOptional:!1},query:{type:n.String_unsecure(),isOptional:!1},roomIds:{type:n.String_unsecure(),isArray:!0,isOptional:!0},limit:{type:n.Int_unsecure(),isOptional:!0}}}),Kn=Ge({meta:{key:"communication.message.search",version:"3.0.0",stability:"experimental",owners:[...g],tags:["communication","message","search","authority"],description:"Search messages inside the authenticated tenant and an authorized selected space",goal:"Remove client-supplied tenant authority from canonical search transport",context:"The runtime derives tenant from the authenticated context and verifies workspace, space, and optional room filters before querying any index",docId:h},io:{input:kt,output:Fe,errors:ze},policy:{auth:"user"}}),Qn={key:"communication.message.replay-authority",version:"1.0.0",invariants:["Recheck current room membership and connection authority before returning a prior send result.","A request key cannot substitute principal, room, connection, text, subject, HTML, metadata, encryption envelope, reply target or attachment IDs.","Queued acceptance is not provider delivery.","Requested attachments require a complete resolved manifest; missing attachment support must not silently send an incomplete message."]},Jn={key:"communication.message.queue-custody",version:"1.0.0",invariants:["An external send requires a durable journal-and-outbox adapter before it can be accepted.","Queued acceptance requires an exact persisted delivery record for the accepted message, connection and scope.","Outbox-key conflicts cannot silently drop provider delivery or report false success.","Message delivery uses delivery:<send idempotency key>; alternate delivery keys cannot duplicate a prior accepted message.","Message identity allocated by an atomic journal replay remains the delivery target; retries do not refer to discarded candidate IDs."]},Yn={key:"communication.delivery.context-reproof",version:"1.0.0",invariants:["Resolve the current delivery context before adapter access and again after provider health checks immediately before send.","Changed recipient, connection, credential binding, content, reply, attachment or routing metadata invalidates the pending send.","Missing or changed context yields a definitive rejection without invoking provider.send.","Journal delivery resolution requires current active sender membership and applicable agent grants; revoked or deleted messages cannot resolve for sending.","Context reproof supplements canonical Runtime Node authority and does not replace its approval or effect fence."]};import{defineCommand as R,defineQuery as He,docId as wt}from"@lssm/lib.contracts-spec";import{defineSchemaModel as se,ScalarTypeEnum as d}from"@lssm/lib.schema";var I=["platform.communication-os"],b=[wt(ne.id)],ti=R({meta:{key:"communication.space.create",version:"2.0.0",stability:"experimental",owners:[...I],tags:["communication","space","workspace"],description:"Create an isolated personal or organization messaging space",goal:"Keep messages, identities, agents, search, and policy inside one explicit boundary",context:"The caller must already have access to the containing tenant and workspace",docId:b},io:{input:ie,output:ie},policy:{auth:"user"}}),ni=R({meta:{key:"communication.room.create",version:"2.0.0",stability:"experimental",owners:[...I],tags:["communication","room","membership"],description:"Create a room or direct-message projection inside one space",goal:"Give humans and agents one canonical collaboration container",context:"Connection-backed rooms retain provider identifiers only through connection references",docId:b},io:{input:oe,output:oe},policy:{auth:"user"}}),At=se({name:"ListCommunicationSpacesV2Output",fields:{spaces:{type:ie,isArray:!0,isOptional:!1}}}),ii=He({meta:{key:"communication.space.list",version:"2.0.0",stability:"experimental",owners:[...I],tags:["communication","space","workspace","query"],description:"List messaging spaces visible inside an authorized scope",goal:"Make space switching explicit without crossing an isolation boundary",context:"The authorization layer resolves accessible scopes; this query never widens the supplied scope",docId:b},io:{input:_,output:At},policy:{auth:"user"}}),Tt=se({name:"ListCommunicationRoomsV2Output",fields:{rooms:{type:oe,isArray:!0,isOptional:!1}}}),oi=He({meta:{key:"communication.room.list",version:"2.0.0",stability:"experimental",owners:[...I],tags:["communication","room","workspace","query"],description:"List canonical rooms inside one authorized messaging space",goal:"Drive inbox and room navigation from a replayable projection",context:"Rooms are projected only from the append-only journal partition selected by the supplied scope",docId:b},io:{input:_,output:Tt},policy:{auth:"user"}}),ai=R({meta:{key:"communication.membership.set",version:"2.0.0",stability:"experimental",owners:[...I],tags:["communication","membership","agent","authority"],description:"Add, update, or revoke a human, agent, or system room membership",goal:"Make every participant and its capabilities explicit and auditable",context:"Revocation takes effect before the next effect-bearing operation",docId:b},io:{input:me,output:me},policy:{auth:"admin"}}),si=R({meta:{key:"communication.authority.set",version:"2.0.0",stability:"experimental",owners:[...I],tags:["communication","agent","authority","revocation"],description:"Grant or revoke scoped messaging authority for one principal",goal:"Permit human-equivalent agents without implicit or unbounded send access",context:"The runtime re-evaluates active membership, grant scope, expiry, and channel policy immediately before dispatch",docId:b},io:{input:fe,output:fe},policy:{auth:"admin"}}),ri=R({meta:{key:"communication.connection.connect",version:"2.0.0",stability:"experimental",owners:[...I],tags:["communication","connection","hybrid","credentials"],description:"Register a device, managed-cloud, or self-hosted channel connection",goal:"Use one provider-neutral connection contract across all clients and workers",context:"Only a secret-manager reference may be persisted; raw provider credentials are forbidden",docId:b},io:{input:ye,output:ye},policy:{auth:"user"}}),Et=se({name:"SyncCommunicationConnectionV2Input",fields:{tenantId:{type:d.String_unsecure(),isOptional:!1},workspaceId:{type:d.String_unsecure(),isOptional:!1},spaceId:{type:d.String_unsecure(),isOptional:!1},connectionId:{type:d.String_unsecure(),isOptional:!1},cursor:{type:d.String_unsecure(),isOptional:!0},limit:{type:d.Int_unsecure(),isOptional:!0}}}),Mt=se({name:"SyncCommunicationConnectionV2Output",fields:{connectionId:{type:d.String_unsecure(),isOptional:!1},nextCursor:{type:d.String_unsecure(),isOptional:!0},acceptedEventIds:{type:d.String_unsecure(),isArray:!0,isOptional:!1},hasMore:{type:d.Boolean(),isOptional:!1}}}),ci=R({meta:{key:"communication.connection.sync",version:"2.0.0",stability:"experimental",owners:[...I],tags:["communication","connection","sync","cursor"],description:"Advance an authenticated channel connection from a cursor",goal:"Provide deterministic, resumable synchronization across device and server workers",context:"Duplicate provider events must be suppressed by their connection-scoped idempotency key",docId:b},io:{input:Et,output:Mt},policy:{auth:"user"}});import{defineCommand as Nt,defineQuery as jt}from"@lssm/lib.contracts-spec/operations";import{defineSchemaModel as pe,ScalarTypeEnum as s}from"@lssm/lib.schema";import{defineEnum as D,defineSchemaModel as ve,ScalarTypeEnum as a}from"@lssm/lib.schema";var Rt=D("ResidencyRegion",["eu","eu_fr","eu_de","us","uk","apac","self_managed"]),Dt=D("HostingMode",["saas","self_host","on_prem"]),re=D("DataClass",["message_body","participant_identity","channel_account","attachment","ai_derived","audit_evidence"]),ce=D("ConsentBasis",["consent","contract","legal_obligation","legitimate_interest"]),Ie=D("ConsentStatus",["granted","withdrawn","expired","not_recorded"]),Vt=ve({name:"RetentionWindow",description:"Documented retention window for a single governed data class.",fields:{dataClass:{type:re,isOptional:!1},retentionDays:{type:a.Int_unsecure(),isOptional:!1},basis:{type:ce,isOptional:!1},description:{type:a.String_unsecure(),isOptional:!0}}}),li=ve({name:"SovereigntyProfile",description:"Residency, retention, sovereign LLM provider and hosting posture for a tenant.",fields:{id:{type:a.String_unsecure(),isOptional:!1},tenantId:{type:a.String_unsecure(),isOptional:!1},residencyRegion:{type:Rt,isOptional:!1,defaultValue:"eu"},hostingMode:{type:Dt,isOptional:!1,defaultValue:"saas"},llmProviderId:{type:a.String_unsecure(),isOptional:!1},retentionWindows:{type:Vt,isArray:!0,isOptional:!1},dataResidencyEnforced:{type:a.Boolean(),isOptional:!1,defaultValue:!0},createdAt:{type:a.DateTime(),isOptional:!1},updatedAt:{type:a.DateTime(),isOptional:!1}}}),di=ve({name:"SubjectConsent",description:"Recorded RGPD consent decision for a single data subject.",fields:{id:{type:a.String_unsecure(),isOptional:!1},tenantId:{type:a.String_unsecure(),isOptional:!1},subjectId:{type:a.String_unsecure(),isOptional:!1},basis:{type:ce,isOptional:!1},status:{type:Ie,isOptional:!1,defaultValue:"not_recorded"},grantedAt:{type:a.DateTime(),isOptional:!0},withdrawnAt:{type:a.DateTime(),isOptional:!0},expiresAt:{type:a.DateTime(),isOptional:!0},evidenceRef:{type:a.String_unsecure(),isOptional:!0}}}),We=D("ErasureOutcome",["erased_local","erased_local_and_channel","erased_local_provider_retained_documented"]);var Ke=["platform.communication-os"],hi=Nt({meta:{key:"communication.subject.erase",version:"1.0.0",stability:"experimental",owners:[...Ke],tags:["communication","gdpr","rgpd","erasure","sovereignty"],description:"Erase a data subject across local persistence and channel providers",goal:"Honor a GDPR/RGPD right-to-erasure request with an auditable, three-state outcome that documents irrecoverable provider retention rather than failing closed",context:"Governed by ContractSpec Connect; handler emits a local delete descriptor plus ChannelAdapter.eraseSubject; provider-unrecallable channels (email/SMTP) resolve to a documented retention window from the Sovereignty Profile"},io:{input:pe({name:"EraseSubjectInput",description:"Right-to-erasure request for a single data subject.",fields:{tenantId:{type:s.String_unsecure(),isOptional:!1},subjectId:{type:s.String_unsecure(),isOptional:!1},requestedBy:{type:s.String_unsecure(),isOptional:!1},reason:{type:s.String_unsecure(),isOptional:!0},dataClasses:{type:re,isArray:!0,isOptional:!0}}}),output:pe({name:"EraseSubjectOutput",description:"Three-state erasure outcome with optional documented provider retention.",fields:{subjectId:{type:s.String_unsecure(),isOptional:!1},outcome:{type:We,isOptional:!1},localDeleted:{type:s.Boolean(),isOptional:!1},channelErased:{type:s.Boolean(),isOptional:!1},providerRetainedDataClass:{type:re,isOptional:!0},providerRetentionDays:{type:s.Int_unsecure(),isOptional:!0},retentionWindowRef:{type:s.String_unsecure(),isOptional:!0},auditEventRef:{type:s.String_unsecure(),isOptional:!1},erasedAt:{type:s.DateTime(),isOptional:!1}}}),errors:{SUBJECT_NOT_FOUND:{description:"No data subject exists for the provided subjectId",http:404,when:"subjectId does not resolve to any local persistence record"},SOVEREIGNTY_PROFILE_MISSING:{description:"No Sovereignty Profile is configured for the tenant; retention window cannot be documented",http:422,when:"A provider cannot recall data but no documented retention window exists to reference"},CHANNEL_ADAPTER_UNAVAILABLE:{description:"The channel adapter required to attempt provider erasure could not be reached",http:503,when:"ChannelAdapter.eraseSubject cannot be invoked; erasure fails closed rather than reporting an unverified outcome"},ERASURE_NOT_AUTHORIZED:{description:"The requesting actor is not authorized to erase this subject",http:403,when:"Policy gate denies the erasure request for the actor/tenant"}}},policy:{auth:"admin"}}),Oi=jt({meta:{key:"communication.subject.consent.check",version:"1.0.0",stability:"experimental",owners:[...Ke],tags:["communication","gdpr","rgpd","consent"],description:"Check the recorded RGPD consent state for a data subject",goal:"Let runtime gate processing on a subject lawful basis before side effects",context:"Read-only; returns the recorded consent status and lawful basis, never mutates consent"},io:{input:pe({name:"CheckSubjectConsentInput",fields:{tenantId:{type:s.String_unsecure(),isOptional:!1},subjectId:{type:s.String_unsecure(),isOptional:!1}}}),output:pe({name:"CheckSubjectConsentOutput",fields:{subjectId:{type:s.String_unsecure(),isOptional:!1},status:{type:Ie,isOptional:!1},basis:{type:ce,isOptional:!0},mayProcess:{type:s.Boolean(),isOptional:!1}}})},policy:{auth:"admin"}});import{defineCommand as Pt,defineQuery as be}from"@lssm/lib.contracts-spec/operations";import{defineSchemaModel as T,ScalarTypeEnum as l}from"@lssm/lib.schema";var ue=["platform.communication-os"],xi=Pt({meta:{key:"communication.thread.updateStatus",version:"1.0.0",stability:"experimental",owners:[...ue],tags:["communication","thread","status"],description:"Update a thread lifecycle status",goal:"Move operational conversations through explicit lifecycle states",context:"Runtime must enforce valid transitions from lifecycle definitions"},io:{input:T({name:"UpdateThreadStatusInput",fields:{threadId:{type:l.String_unsecure(),isOptional:!1},status:{type:N,isOptional:!1},reason:{type:l.String_unsecure(),isOptional:!0}}}),output:k},policy:{auth:"user"}}),Ci=be({meta:{key:"communication.thread.get",version:"1.0.0",stability:"experimental",owners:[...ue],tags:["communication","thread","get"],description:"Get a thread by ID with messages and links",goal:"Retrieve full thread context",context:"Read-only operation for inbox views, detail views, and agent context"},io:{input:T({name:"GetThreadInput",fields:{threadId:{type:l.String_unsecure(),isOptional:!1}}}),output:T({name:"GetThreadOutput",fields:{thread:{type:k,isOptional:!1},messages:{type:j,isArray:!0,isOptional:!1},links:{type:E,isArray:!0,isOptional:!0}}})},policy:{auth:"user"}}),ki=be({meta:{key:"communication.thread.search",version:"1.0.0",stability:"experimental",owners:[...ue],tags:["communication","thread","search"],description:"Search threads by status, participant, channel, or linked object",goal:"Find relevant conversations quickly",context:"Read-only operation for operational inboxes, agent search, and dashboards"},io:{input:T({name:"SearchThreadsInput",fields:{status:{type:N,isOptional:!0},participantId:{type:l.String_unsecure(),isOptional:!0},channelType:{type:C,isOptional:!0},linkedKindId:{type:l.String_unsecure(),isOptional:!0},linkedInstanceId:{type:l.String_unsecure(),isOptional:!0},assignedTo:{type:l.String_unsecure(),isOptional:!0},limit:{type:l.Int_unsecure(),isOptional:!0,defaultValue:20}}}),output:T({name:"SearchThreadsOutput",fields:{threads:{type:k,isArray:!0,isOptional:!1},total:{type:l.Int_unsecure(),isOptional:!1},hasMore:{type:l.Boolean(),isOptional:!1}}})},policy:{auth:"user"}}),wi=be({meta:{key:"communication.message.list",version:"1.0.0",stability:"experimental",owners:[...ue],tags:["communication","message","list"],description:"List messages for a thread",goal:"Provide ordered message context without loading unrelated operational state",context:"Read-only operation for inboxes, agent context, and handoff evidence"},io:{input:T({name:"ListMessagesInput",fields:{threadId:{type:l.String_unsecure(),isOptional:!1}}}),output:T({name:"ListMessagesOutput",fields:{messages:{type:j,isArray:!0,isOptional:!1}}})},policy:{auth:"user"}});import{defineCommand as U}from"@lssm/lib.contracts-spec/operations";import{defineSchemaModel as z,ScalarTypeEnum as x}from"@lssm/lib.schema";var F=["platform.communication-os"],Di=U({meta:{key:"communication.thread.create",version:"1.0.0",stability:"experimental",owners:[...F],tags:["communication","thread","create"],description:"Create a communication thread from normalized input",goal:"Persist a reusable conversation container before downstream work binds to it",context:"Used by ingest flows and generic operational inbox consumers"},io:{input:k,output:k},policy:{auth:"admin"}}),Vi=U({meta:{key:"communication.message.ingest",version:"1.0.0",stability:"experimental",owners:[...F],tags:["communication","message","ingest"],description:"Ingest an inbound message from a channel adapter",goal:"Normalize and store an inbound message for triage",context:"Called by channel adapters after webhook verification and deduplication"},io:{input:j,output:z({name:"IngestMessageOutput",fields:{messageId:{type:x.String_unsecure(),isOptional:!1},threadId:{type:x.String_unsecure(),isOptional:!1},status:{type:K,isOptional:!1}}})},policy:{auth:"admin"}}),Ni=U({meta:{key:"communication.intent.classify",version:"1.0.0",stability:"experimental",owners:[...F],tags:["communication","intent","classify"],description:"Classify the intent of a message or thread",goal:"Route and triage based on intent category and confidence",context:"Read-only AI operation; returns suggestion state, not canonical truth"},io:{input:z({name:"ClassifyIntentInput",fields:{threadId:{type:x.String_unsecure(),isOptional:!1},messageId:{type:x.String_unsecure(),isOptional:!0}}}),output:de},policy:{auth:"admin"}}),ji=U({meta:{key:"communication.summary.generate",version:"1.0.0",stability:"experimental",owners:[...F],tags:["communication","summary"],description:"Generate a summary of a thread",goal:"Produce a concise summary with facts, actions, decisions, risks, and source references",context:"Draft-only AI operation used for handoffs, inbox views, and agent context"},io:{input:z({name:"GenerateSummaryInput",fields:{threadId:{type:x.String_unsecure(),isOptional:!1},messageIds:{type:x.String_unsecure(),isArray:!0,isOptional:!0}}}),output:Z},policy:{auth:"user"}}),Pi=U({meta:{key:"communication.action.extract",version:"1.0.0",stability:"experimental",owners:[...F],tags:["communication","action","extract"],description:"Extract implied actions from a thread",goal:"Turn conversation text into structured work candidates with evidence",context:"Draft-only AI operation; does not mutate external work items"},io:{input:z({name:"ExtractActionsInput",fields:{threadId:{type:x.String_unsecure(),isOptional:!1},messageIds:{type:x.String_unsecure(),isArray:!0,isOptional:!0}}}),output:z({name:"ExtractActionsOutput",fields:{actions:{type:X,isArray:!0,isOptional:!1}}})},policy:{auth:"user"}});import{defineCommand as Qe,defineEvent as Je,defineQuery as Lt,docId as Bt}from"@lssm/lib.contracts-spec";import{defineEnum as Ye,defineSchemaModel as V,ScalarTypeEnum as i}from"@lssm/lib.schema";var H=["platform.communication-os","platform.support-os"],qt={id:"communication-os.support-internal-note.v1",title:"CommunicationOS private Support note authority",body:"CommunicationOS owns private note content and immutable evidence. SupportOS stores only opaque note and evidence references. Service requests derive tenant, workspace, actor, audience, and capabilities from a short-lived AuthOS grant; verification is redacted and never returns note content.",kind:"reference",route:"/docs/communication-os/support-internal-notes-v1",visibility:"public"},W=[Bt(qt.id)],Xe=Ye("CommunicationSupportInternalNoteVisibility",["internal"]),Gt=V({name:"CommunicationSupportInternalNoteCreateV1Input",fields:{caseRef:{type:i.String_unsecure(),isOptional:!1},body:{type:i.String_unsecure(),isOptional:!1},idempotencyKey:{type:i.String_unsecure(),isOptional:!1}}}),zt=V({name:"CommunicationSupportInternalNoteCreateForIntentV1Input",fields:{caseRef:{type:i.String_unsecure(),isOptional:!1},intentRef:{type:i.String_unsecure(),isOptional:!1},body:{type:i.String_unsecure(),isOptional:!1},idempotencyKey:{type:i.String_unsecure(),isOptional:!1}}}),xe=V({name:"CommunicationSupportInternalNoteEvidenceV1",fields:{noteRef:{type:i.String_unsecure(),isOptional:!1},caseRef:{type:i.String_unsecure(),isOptional:!1},evidenceRef:{type:i.String_unsecure(),isOptional:!1},visibility:{type:Xe,isOptional:!1},createdAt:{type:i.DateTime(),isOptional:!1}}}),Ze=V({name:"CommunicationSupportInternalNoteIntentEvidenceV1",fields:{...xe.config.fields,intentRef:{type:i.String_unsecure(),isOptional:!1},deliveryRef:{type:i.String_unsecure(),isOptional:!1},grantEvidenceRef:{type:i.String_unsecure(),isOptional:!1}}}),Ut=V({name:"CommunicationSupportInternalNoteVerifyV1Input",fields:{caseRef:{type:i.String_unsecure(),isOptional:!1},noteRef:{type:i.String_unsecure(),isOptional:!1},evidenceRef:{type:i.String_unsecure(),isOptional:!1}}}),Ft=V({name:"CommunicationSupportInternalNoteVerificationV1",fields:{status:{type:Ye("CommunicationSupportInternalNoteVerificationStatus",["verified"]),isOptional:!1},caseRef:{type:i.String_unsecure(),isOptional:!1},noteRef:{type:i.String_unsecure(),isOptional:!1},evidenceRef:{type:i.String_unsecure(),isOptional:!1},visibility:{type:Xe,isOptional:!1}}}),Ht=Qe({meta:{key:"communication.support.internal-note.create",version:"1.0.0",stability:"experimental",owners:[...H],tags:["communication","support","internal-note","private"],description:"Create one encrypted private Support note in CommunicationOS",goal:"Keep note content in CommunicationOS while SupportOS stores opaque evidence",context:"Server scope and actor come only from a short-lived AuthOS downstream grant",docId:W},io:{input:Gt,output:xe},policy:{auth:"admin"}}),Wt=Qe({meta:{key:"communication.support.internal-note.create-for-intent",version:"1.0.0",stability:"experimental",owners:[...H],tags:["communication","support","internal-note","private","reconciliation"],description:"Create an encrypted Support note bound to a body-free SupportOS intent",goal:"Make cross-service note attachment replayable without copying content",context:"The short-lived AuthOS grant binds scope and actor; the intent is opaque, redacted correlation metadata",docId:W},io:{input:zt,output:Ze},policy:{auth:"admin"}}),Ki=Lt({meta:{key:"communication.support.internal-note.verify",version:"1.0.0",stability:"experimental",owners:[...H],tags:["communication","support","internal-note","verify"],description:"Verify exact private-note evidence without returning content",goal:"Let SupportOS validate its opaque note reference at the authority boundary",context:"The query requires exact tenant, workspace, case, note, evidence, audience, and capability binding",docId:W},io:{input:Ut,output:Ft},policy:{auth:"admin"}}),Qi=Je({meta:{key:"communication.support.internal-note.created",version:"1.0.0",stability:"experimental",owners:[...H],tags:["communication","support","internal-note","event"],description:"Immutable redacted evidence that a private Support note was created",docId:W},payload:xe}),Ji=Je({meta:{key:"communication.support.internal-note.reconciliation-ready",version:"1.0.0",stability:"experimental",owners:[...H],tags:["communication","support","internal-note","reconciliation"],description:"Redacted durable delivery evidence for a SupportOS note intent",docId:W},payload:Ze}),Yi={create:"communication.support.internal-note.create",createForIntent:"communication.support.internal-note.create-for-intent",verify:"communication.support.internal-note.verify"};import{defineCommand as Ce}from"@lssm/lib.contracts-spec";import{defineSchemaModel as ke,ScalarTypeEnum as m}from"@lssm/lib.schema";var we=["platform.communication-os","platform.ai-routing"],to=Ce({meta:{key:"comms.thread.summarize",version:"1.0.0",stability:"experimental",owners:[...we],tags:["comms","ai","thread","summarize"],description:"Produce a persona-scoped summary of a communication thread via the AI routing layer",goal:"Give each persona a concise, role-appropriate digest of a thread without exposing cross-persona data",context:"Capability-gated AI operation. Auditor variant omits PII and redacts sensitive identifiers. "+"Draft-only — summary is returned to caller, not persisted by this command. "+"Handler routes to the appropriate model via lib.ai-agent provider selection."},io:{input:ke({name:"CommsThreadSummarizeInput",fields:{threadId:{type:m.String_unsecure(),isOptional:!1},messageIds:{type:m.String_unsecure(),isArray:!0,isOptional:!0},audiencePersona:{type:m.String_unsecure(),isOptional:!0}}}),output:Z,errors:{THREAD_NOT_FOUND:{description:"No thread exists for the provided threadId",http:404,when:"threadId does not resolve to a persisted thread"},INSUFFICIENT_MESSAGES:{description:"Thread has too few messages to produce a meaningful summary",http:422,when:"Thread contains fewer messages than the minimum required for summarization"},AI_PROVIDER_UNAVAILABLE:{description:"Upstream AI provider could not be reached or returned an error",http:503,when:"lib.ai-agent provider selection fails or provider returns a non-retryable error"},CONTENT_POLICY_BLOCKED:{description:"Summary blocked by content safety policy",http:422,when:"Thread content triggers a content policy gate; summary cannot be generated without redaction"}}},policy:{auth:"user"}}),no=Ce({meta:{key:"comms.reply.draft",version:"1.0.0",stability:"experimental",owners:[...we],tags:["comms","ai","reply","draft"],description:"Generate a context-aware reply draft via the AI routing layer",goal:"Produce a safe, policy-checked reply draft that the actor can review and send",context:"Capability-gated AI operation. Not available to auditor persona. Draft status reflects policy evaluation: requires_review when policy gates apply. Handler calls communication.reply.draft internals after capability check."},io:{input:ke({name:"CommsReplyDraftInput",fields:{threadId:{type:m.String_unsecure(),isOptional:!1},messageId:{type:m.String_unsecure(),isOptional:!0},instruction:{type:m.String_unsecure(),isOptional:!0},toneHint:{type:m.String_unsecure(),isOptional:!0}}}),output:P,errors:{THREAD_NOT_FOUND:{description:"No thread exists for the provided threadId",http:404,when:"threadId does not resolve to a persisted thread"},POLICY_BLOCKED:{description:"Reply draft blocked by content or safety policy",http:422,when:"Thread content or instruction triggers a policy gate; draft cannot be generated"},AI_PROVIDER_UNAVAILABLE:{description:"Upstream AI provider could not be reached or returned an error",http:503,when:"lib.ai-agent provider selection fails or provider returns a non-retryable error"},DRAFT_LIMIT_EXCEEDED:{description:"Too many pending drafts exist for this thread",http:429,when:"Actor has reached the maximum number of unreviewed drafts on this thread"}}},policy:{auth:"user"}}),io=Ce({meta:{key:"comms.handoff.suggest",version:"1.0.0",stability:"experimental",owners:[...we],tags:["comms","ai","handoff","suggest"],description:"Suggest whether a thread warrants a handoff and to whom, via the AI routing layer",goal:"Surface handoff opportunities with evidence before the actor decides to act",context:"AI suggestion only — does not create a HandoffPacket. "+"Handler evaluates thread urgency, owner gaps, and work-graph signals to produce a ranked suggestion. Auditor variant is read-only and may not trigger the `communication.handoff.create` action."},io:{input:ke({name:"CommsHandoffSuggestInput",fields:{threadId:{type:m.String_unsecure(),isOptional:!1},suggestedToOwner:{type:m.String_unsecure(),isOptional:!0},context:{type:m.String_unsecure(),isOptional:!0}}}),output:ee,errors:{THREAD_NOT_FOUND:{description:"No thread exists for the provided threadId",http:404,when:"threadId does not resolve to a persisted thread"},INSUFFICIENT_CONTEXT:{description:"Thread has insufficient context to produce a handoff suggestion",http:422,when:"Thread is too short or lacks ownership/urgency signals for the model to reason about"},HANDOFF_NOT_WARRANTED:{description:"Analysis concludes no handoff is needed at this time",http:422,when:"Thread signals are below the handoff threshold; caller should surface this as a no-op result rather than an error"},AI_PROVIDER_UNAVAILABLE:{description:"Upstream AI provider could not be reached or returned an error",http:503,when:"lib.ai-agent provider selection fails or provider returns a non-retryable error"}}},policy:{auth:"user"}});export{pn as BlockReplyByPolicyCommand,Yn as COMMUNICATION_DELIVERY_REPROOF_CONTRACT,Jn as COMMUNICATION_MESSAGE_QUEUE_CUSTODY_CONTRACT,Qn as COMMUNICATION_MESSAGE_REPLAY_CONTRACT,Oi as CheckSubjectConsentQuery,Ni as ClassifyIntentCommand,io as CommsHandoffSuggestCommand,no as CommsReplyDraftCommand,to as CommsThreadSummarizeCommand,ri as ConnectCommunicationChannelV2Command,dt as CreateCommunicationGovernedWorkV1Command,ni as CreateCommunicationRoomV2Command,ti as CreateCommunicationSpaceV2Command,Wt as CreateCommunicationSupportInternalNoteForIntentV1Command,Ht as CreateCommunicationSupportInternalNoteV1Command,fn as CreateHandoffCommand,Di as CreateThreadCommand,It as DecideCommunicationIdentityV1Command,zn as DeleteCommunicationMessageV2Command,rn as DraftReplyCommand,Gn as EditCommunicationMessageV2Command,hi as EraseSubjectCommand,On as EscalateToHumanCommand,Pi as ExtractActionsCommand,an as ExtractDecisionsCommand,sn as ExtractRisksCommand,ji as GenerateSummaryCommand,Ci as GetThreadQuery,Vi as IngestMessageCommand,oi as ListCommunicationRoomsV2Query,ii as ListCommunicationSpacesV2Query,wi as ListMessagesQuery,hn as ProposeIdentityLinkCommand,gn as ProposeThreadLinkCommand,Fn as RecordCommunicationReceiptV2Command,Sn as RecordHumanFeedbackCommand,Wn as SearchCommunicationMessagesV2Query,Kn as SearchCommunicationMessagesV3Query,ki as SearchThreadsQuery,Bn as SendCommunicationMessageV2Command,qn as SendCommunicationMessageV3Command,xt as SendCommunicationMessageV3Input,cn as SendReplyCommand,si as SetCommunicationAuthorityGrantV2Command,Hn as SetCommunicationInboxStateV2Command,ai as SetCommunicationMembershipV2Command,Un as SetCommunicationReactionV2Command,ci as SyncCommunicationConnectionV2Command,mt as TransitionCommunicationGovernedWorkV1Command,xi as UpdateThreadStatusCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as o}from"zod";var d="1.0.0",g="1.0.0",y={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"},t=o.string().trim().min(1),a=o.string().datetime({offset:!0}),f=o.string().regex(/^sha256:[a-f0-9]{64}$/),p=o.object({ref:t,digest:f}).strict(),r=p.extend({revision:o.number().int().positive()}).strict(),m=o.object({tenantRef:t,workspaceRef:t.optional(),spaceRef:t.optional(),subjectRef:t}).strict(),h=o.object({schemaVersion:o.literal(d),profileRef:t,revision:o.number().int().positive(),agentRef:t,applicationRef:t,scope:m,routeBindings:o.array(r),connectionRefs:o.array(t),preferenceSet:r,policyRefs:o.array(t).min(1),evidenceRefs:o.array(t).min(1),createdAt:a,updatedAt:a,profileDigest:f}).strict().superRefine((e,i)=>{for(let s of["connectionRefs","policyRefs","evidenceRefs"])if(new Set(e[s]).size!==e[s].length)i.addIssue({code:o.ZodIssueCode.custom,path:[s],message:`${s} must be unique`});let n=e.routeBindings.map((s)=>s.ref);if(new Set(n).size!==n.length)i.addIssue({code:o.ZodIssueCode.custom,path:["routeBindings"],message:"route bindings must be unique"})}),C=o.object({schemaVersion:o.literal(g),linkRef:t,profile:r,agentRef:t,applicationRef:t,scope:m,runRef:t.optional(),taskRef:t.optional(),helpRequestRef:t.optional(),approvalRequestRef:t.optional(),backgroundResultRef:t.optional(),canonicalConversation:p.optional(),session:r.optional(),correlationRef:t,evidenceRefs:o.array(t).min(1)}).strict().superRefine((e,i)=>{if(new Set(e.evidenceRefs).size!==e.evidenceRefs.length)i.addIssue({code:o.ZodIssueCode.custom,path:["evidenceRefs"],message:"evidenceRefs must be unique"});if(!e.runRef&&!e.taskRef&&!e.helpRequestRef&&!e.approvalRequestRef&&!e.backgroundResultRef)i.addIssue({code:o.ZodIssueCode.custom,path:["runRef"],message:"at least one run, task, help request, approval request, or background result ref is required"})});function u(e,i){return e.tenantRef===i.tenantRef&&e.workspaceRef===i.workspaceRef&&e.spaceRef===i.spaceRef&&e.subjectRef===i.subjectRef}function v(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(!u(e.profile.scope,e.lifecycleLink.scope))i.push("Lifecycle scope does not match the agent profile");return i}function V(e){let{intent:i,progress:n}=e,s=[];if(n.deliveryRef!==i.deliveryRef||n.intent.ref!==i.deliveryRef||n.intent.digest!==i.deliveryDigest)s.push("Progress delivery does not match the intent");if(!u(n.scope,i.scope))s.push("Progress scope does not match the intent");if(n.recipientRef!==i.recipientRefs[0])s.push("Progress recipient does not match the intent");let c=i.requestedRoutes.find((l)=>l.ref===n.route.ref);if(!c||c.revision!==n.route.revision||c.digest!==n.route.digest)s.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))s.push("Progress occurred outside the intent validity window");return s}export{g as COMMUNICATION_AGENT_LIFECYCLE_LINK_SCHEMA_VERSION,d as COMMUNICATION_AGENT_PROFILE_SCHEMA_VERSION,C as CommunicationAgentLifecycleLinkV1Schema,y as CommunicationAgentOmnichannelDocBlock,h as CommunicationAgentProfileV1Schema,p as CommunicationArtifactBindingV1Schema,f as CommunicationDigestV1Schema,m as CommunicationScopeBindingV1Schema,r as CommunicationVersionedArtifactBindingV1Schema,u as communicationScopeBindingsEqualV1,v as validateCommunicationAgentLifecycleBindingV1,V as validateCommunicationDeliveryProgressBindingV1};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as s}from"zod";import{z as c}from"zod";var R="1.0.0",y="1.0.0",q={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"},t=c.string().trim().min(1),d=c.string().datetime({offset:!0}),p=c.string().regex(/^sha256:[a-f0-9]{64}$/),r=c.object({ref:t,digest:p}).strict(),a=r.extend({revision:c.number().int().positive()}).strict(),f=c.object({tenantRef:t,workspaceRef:t.optional(),spaceRef:t.optional(),subjectRef:t}).strict(),S=c.object({schemaVersion:c.literal(R),profileRef:t,revision:c.number().int().positive(),agentRef:t,applicationRef:t,scope:f,routeBindings:c.array(a),connectionRefs:c.array(t),preferenceSet:a,policyRefs:c.array(t).min(1),evidenceRefs:c.array(t).min(1),createdAt:d,updatedAt:d,profileDigest:p}).strict().superRefine((e,i)=>{for(let n of["connectionRefs","policyRefs","evidenceRefs"])if(new Set(e[n]).size!==e[n].length)i.addIssue({code:c.ZodIssueCode.custom,path:[n],message:`${n} must be unique`});let o=e.routeBindings.map((n)=>n.ref);if(new Set(o).size!==o.length)i.addIssue({code:c.ZodIssueCode.custom,path:["routeBindings"],message:"route bindings must be unique"})}),g=c.object({schemaVersion:c.literal(y),linkRef:t,profile:a,agentRef:t,applicationRef:t,scope:f,runRef:t.optional(),taskRef:t.optional(),helpRequestRef:t.optional(),approvalRequestRef:t.optional(),backgroundResultRef:t.optional(),canonicalConversation:r.optional(),session:a.optional(),correlationRef:t,evidenceRefs:c.array(t).min(1)}).strict().superRefine((e,i)=>{if(new Set(e.evidenceRefs).size!==e.evidenceRefs.length)i.addIssue({code:c.ZodIssueCode.custom,path:["evidenceRefs"],message:"evidenceRefs must be unique"});if(!e.runRef&&!e.taskRef&&!e.helpRequestRef&&!e.approvalRequestRef&&!e.backgroundResultRef)i.addIssue({code:c.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 k(e){let i=[];for(let o of["agentRef","applicationRef"])if(e.profile[o]!==e.lifecycleLink[o])i.push(`Lifecycle ${o} 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 b(e){let{intent:i,progress:o}=e,n=[];if(o.deliveryRef!==i.deliveryRef||o.intent.ref!==i.deliveryRef||o.intent.digest!==i.deliveryDigest)n.push("Progress delivery does not match the intent");if(!l(o.scope,i.scope))n.push("Progress scope does not match the intent");if(o.recipientRef!==i.recipientRefs[0])n.push("Progress recipient does not match the intent");let u=i.requestedRoutes.find((h)=>h.ref===o.route.ref);if(!u||u.revision!==o.route.revision||u.digest!==o.route.digest)n.push("Progress route was not requested by the intent");if(Date.parse(o.occurredAt)<Date.parse(i.createdAt)||Date.parse(o.occurredAt)>Date.parse(i.expiresAt))n.push("Progress occurred outside the intent validity window");return n}var C="1.0.0",m=s.string().trim().min(1),v=s.string().datetime({offset:!0}),V=s.enum(["queued","running","waiting_for_help","waiting_for_approval","blocked","completed","failed","cancelled"]),B=s.object({schemaVersion:s.literal(C),projectionRef:m,projectionDigest:p,scope:f,lifecycleLink:g,status:V,checkpoint:r,canonicalConversation:r.optional(),helpRequest:r.optional(),approvalRequest:r.optional(),progressSummaryRef:m,occurredAt:v,evidenceRefs:s.array(m).min(1),effectAuthority:s.literal("none")}).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.status==="waiting_for_help"!==Boolean(e.helpRequest))i.addIssue({code:s.ZodIssueCode.custom,path:["helpRequest"],message:"help binding is required only while waiting for help"});if(e.status==="waiting_for_approval"!==Boolean(e.approvalRequest))i.addIssue({code:s.ZodIssueCode.custom,path:["approvalRequest"],message:"approval binding is required only while waiting for approval"})});function A(e){let i=[],{projection:o,helpRequest:n}=e;if(o.canonicalConversation&&(o.canonicalConversation.ref!==o.lifecycleLink.canonicalConversation?.ref||o.canonicalConversation.digest!==o.lifecycleLink.canonicalConversation?.digest))i.push("Lifecycle projection conversation does not match its link");if(o.status==="waiting_for_help"&&!n)i.push("Waiting-for-help projection requires the durable help request");if(!l(o.scope,o.lifecycleLink.scope))i.push("Projection scope does not match the lifecycle link");if(n&&(o.lifecycleLink.runRef!==n.runRef||o.lifecycleLink.helpRequestRef!==n.id))i.push("Help request does not match the lifecycle link");if(n&&o.helpRequest?.ref!==n.id)i.push("Projection help binding does not match the help request");if(n&&o.checkpoint.ref!==n.checkpointRef)i.push("Projection checkpoint does not match the help request");if(o.approvalRequest?.ref!==o.lifecycleLink.approvalRequestRef)i.push("Projection approval binding does not match the lifecycle link");return i}function _(e){let{projection:i}=e;if(!i.canonicalConversation)return["Lifecycle projection requires a canonical conversation"];if(!i.lifecycleLink.session)return["Lifecycle projection requires a canonical session"];return A(e)}export{C as COMMUNICATION_AGENT_LIFECYCLE_PROJECTION_SCHEMA_VERSION,V as CommunicationAgentLifecycleProjectionStatusV1Schema,B as CommunicationAgentLifecycleProjectionV1Schema,_ as validateCanonicalAgentLifecycleProjectionV1,A as validateCommunicationAgentLifecycleProjectionV1};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as o}from"zod";import{z as r}from"zod";var A="1.0.0",V="1.0.0",L={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"},i=r.string().trim().min(1),h=r.string().datetime({offset:!0}),a=r.string().regex(/^sha256:[a-f0-9]{64}$/),l=r.object({ref:i,digest:a}).strict(),d=l.extend({revision:r.number().int().positive()}).strict(),m=r.object({tenantRef:i,workspaceRef:i.optional(),spaceRef:i.optional(),subjectRef:i}).strict(),q=r.object({schemaVersion:r.literal(A),profileRef:i,revision:r.number().int().positive(),agentRef:i,applicationRef:i,scope:m,routeBindings:r.array(d),connectionRefs:r.array(i),preferenceSet:d,policyRefs:r.array(i).min(1),evidenceRefs:r.array(i).min(1),createdAt:h,updatedAt:h,profileDigest:a}).strict().superRefine((e,t)=>{for(let c of["connectionRefs","policyRefs","evidenceRefs"])if(new Set(e[c]).size!==e[c].length)t.addIssue({code:r.ZodIssueCode.custom,path:[c],message:`${c} must be unique`});let n=e.routeBindings.map((c)=>c.ref);if(new Set(n).size!==n.length)t.addIssue({code:r.ZodIssueCode.custom,path:["routeBindings"],message:"route bindings must be unique"})}),R=r.object({schemaVersion:r.literal(V),linkRef:i,profile:d,agentRef:i,applicationRef:i,scope:m,runRef:i.optional(),taskRef:i.optional(),helpRequestRef:i.optional(),approvalRequestRef:i.optional(),backgroundResultRef:i.optional(),canonicalConversation:l.optional(),session:d.optional(),correlationRef:i,evidenceRefs:r.array(i).min(1)}).strict().superRefine((e,t)=>{if(new Set(e.evidenceRefs).size!==e.evidenceRefs.length)t.addIssue({code:r.ZodIssueCode.custom,path:["evidenceRefs"],message:"evidenceRefs must be unique"});if(!e.runRef&&!e.taskRef&&!e.helpRequestRef&&!e.approvalRequestRef&&!e.backgroundResultRef)t.addIssue({code:r.ZodIssueCode.custom,path:["runRef"],message:"at least one run, task, help request, approval request, or background result ref is required"})});function p(e,t){return e.tenantRef===t.tenantRef&&e.workspaceRef===t.workspaceRef&&e.spaceRef===t.spaceRef&&e.subjectRef===t.subjectRef}function I(e){let t=[];for(let n of["agentRef","applicationRef"])if(e.profile[n]!==e.lifecycleLink[n])t.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)t.push("Lifecycle profile binding does not match the agent profile");if(!p(e.profile.scope,e.lifecycleLink.scope))t.push("Lifecycle scope does not match the agent profile");return t}function B(e){let{intent:t,progress:n}=e,c=[];if(n.deliveryRef!==t.deliveryRef||n.intent.ref!==t.deliveryRef||n.intent.digest!==t.deliveryDigest)c.push("Progress delivery does not match the intent");if(!p(n.scope,t.scope))c.push("Progress scope does not match the intent");if(n.recipientRef!==t.recipientRefs[0])c.push("Progress recipient does not match the intent");let f=t.requestedRoutes.find((g)=>g.ref===n.route.ref);if(!f||f.revision!==n.route.revision||f.digest!==n.route.digest)c.push("Progress route was not requested by the intent");if(Date.parse(n.occurredAt)<Date.parse(t.createdAt)||Date.parse(n.occurredAt)>Date.parse(t.expiresAt))c.push("Progress occurred outside the intent validity window");return c}async function C(e){let t=new TextEncoder().encode(y(e)),n=new Uint8Array(t.byteLength);n.set(t);let c=await crypto.subtle.digest("SHA-256",n.buffer),f=Array.from(new Uint8Array(c),(g)=>g.toString(16).padStart(2,"0")).join("");return a.parse(`sha256:${f}`)}function y(e){if(Array.isArray(e))return`[${e.map(y).join(",")}]`;if(e&&typeof e==="object")return`{${Object.entries(e).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>`${JSON.stringify(t)}:${y(n)}`).join(",")}}`;return JSON.stringify(e)}var S="communication.agent-surface-control.v1",v="communication.agent-surface-control-result.v1",u=o.string().trim().min(1),s=l,x=o.discriminatedUnion("kind",[o.object({kind:o.literal("help_response"),helpRequest:s,response:s}).strict(),o.object({kind:o.literal("approval_decision"),approvalRequest:s,decision:o.enum(["approved","rejected"]),effect:s}).strict(),o.object({kind:o.literal("steer"),instruction:s}).strict(),o.object({kind:o.literal("queue"),instruction:s}).strict(),o.object({kind:o.literal("pause"),reasonRef:u}).strict(),o.object({kind:o.literal("cancel"),reasonRef:u}).strict(),o.object({kind:o.literal("branch"),branchRequest:s}).strict()]),w=o.object({schemaVersion:o.literal(S),controlRef:u,controlDigest:a,scope:m,canonicalConversation:l,lifecycleLink:R,actorPrincipalRef:u,actorIdentityEvidence:s,authorityDecision:s,payload:x,idempotencyKey:u,createdAt:o.string().datetime({offset:!0}),expiresAt:o.string().datetime({offset:!0}),effectAuthority:o.literal("none")}).strict().superRefine((e,t)=>{if(Date.parse(e.expiresAt)<=Date.parse(e.createdAt))t.addIssue({code:o.ZodIssueCode.custom,path:["expiresAt"],message:"control expiry must follow creation"})}),T=o.object({schemaVersion:o.literal(v),resultRef:u,resultDigest:a,control:s,scope:m,canonicalConversation:s,authorityDecision:s,outcome:o.enum(["applied","duplicate","denied","expired"]),executionReceipt:s.optional(),decidedAt:o.string().datetime({offset:!0}),evidenceRefs:o.array(u).min(1),effectAuthority:o.literal("none")}).strict().superRefine((e,t)=>{if((e.outcome==="applied"||e.outcome==="duplicate")!==Boolean(e.executionReceipt))t.addIssue({code:o.ZodIssueCode.custom,path:["executionReceipt"],message:"executed controls require an execution receipt"})});async function b(e){return C(e)}async function z(e){let{controlDigest:t,...n}=e;return t===await b(n)}async function k(e){return C(e)}async function M(e){let{resultDigest:t,...n}=e;return t===await k(n)}function U(e){let t=[];if(!p(e.scope,e.lifecycleLink.scope))t.push("Agent surface control scope does not match lifecycle scope");if(e.lifecycleLink.canonicalConversation?.ref!==e.canonicalConversation.ref||e.lifecycleLink.canonicalConversation?.digest!==e.canonicalConversation.digest)t.push("Agent surface control conversation does not match lifecycle link");if(!e.lifecycleLink.runRef)t.push("Agent surface control requires a run-bound lifecycle link");if(e.payload.kind==="help_response"&&e.payload.helpRequest.ref!==e.lifecycleLink.helpRequestRef)t.push("Help response does not match the lifecycle help request");if(e.payload.kind==="approval_decision"&&e.payload.approvalRequest.ref!==e.lifecycleLink.approvalRequestRef)t.push("Approval decision does not match the lifecycle approval request");return t}function Z(e){let t=[];if(e.result.control.ref!==e.control.controlRef||e.result.control.digest!==e.control.controlDigest)t.push("Agent surface result control binding does not match");if(!p(e.result.scope,e.control.scope))t.push("Agent surface result scope does not match");if(e.result.canonicalConversation.ref!==e.control.canonicalConversation.ref||e.result.canonicalConversation.digest!==e.control.canonicalConversation.digest)t.push("Agent surface result conversation does not match");if(e.result.authorityDecision.ref!==e.control.authorityDecision.ref||e.result.authorityDecision.digest!==e.control.authorityDecision.digest)t.push("Agent surface result authority decision does not match");return t}export{v as COMMUNICATION_AGENT_SURFACE_CONTROL_RESULT_V1,S as COMMUNICATION_AGENT_SURFACE_CONTROL_V1,x as CommunicationAgentSurfaceControlPayloadV1Schema,T as CommunicationAgentSurfaceControlResultV1Schema,w as CommunicationAgentSurfaceControlV1Schema,k as digestCommunicationAgentSurfaceControlResultV1,b as digestCommunicationAgentSurfaceControlV1,U as validateCommunicationAgentSurfaceControlBindingV1,Z as validateCommunicationAgentSurfaceControlResultBindingV1,M as verifyCommunicationAgentSurfaceControlResultV1,z as verifyCommunicationAgentSurfaceControlV1};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineCommand as r}from"@lssm/lib.contracts-spec";import{defineSchemaModel as a,ScalarTypeEnum as i}from"@lssm/lib.schema";import{defineEnum as n}from"@lssm/lib.schema";var s=n("ChannelType",["email","sms","whatsapp","telegram","matrix","web_chat","voice","internal_chat","custom_adapter","future_bridge","unknown"]),c=n("ThreadStatus",["open","waiting_on_human","waiting_on_external_party","action_required","resolved","archived"]),d=n("MessageStatus",["received","normalized","classified","linked","triaged","replied","archived"]),p=n("ReplyStatus",["drafted","requires_review","approved","sent","failed","blocked_by_policy"]),y=n("HandoffStatus",["created","assigned","acknowledged","completed","reopened"]),l=n("SuggestionStatus",["generated","shown","accepted","edited","rejected","applied","expired"]),m=n("IntentCategory",["support","sales","bug_report","feature_request","billing","onboarding","coordination","general","spam","escalation"]),f=n("ActionSafetyMode",["read_only","draft_only","requires_review","policy_executable","blocked"]),x=n("FeedbackOutcome",["accepted","edited","rejected","unsafe","incomplete"]);import{defineSchemaModel as t,ScalarTypeEnum as e}from"@lssm/lib.schema";var g=t({name:"ChannelAccount",description:"A channel account belonging to a participant",fields:{id:{type:e.String_unsecure(),isOptional:!1},participantId:{type:e.String_unsecure(),isOptional:!1},channelType:{type:s,isOptional:!1},externalId:{type:e.String_unsecure(),isOptional:!1},displayName:{type:e.String_unsecure(),isOptional:!0},metadata:{type:e.JSONObject(),isOptional:!0},isPrimary:{type:e.Boolean(),isOptional:!1,defaultValue:!1},createdAt:{type:e.DateTime(),isOptional:!1}}}),S=t({name:"IdentityLink",description:"Proposed or confirmed relationship between participant identities",fields:{id:{type:e.String_unsecure(),isOptional:!1},participantId:{type:e.String_unsecure(),isOptional:!1},candidateParticipantId:{type:e.String_unsecure(),isOptional:!1},status:{type:l,isOptional:!1,defaultValue:"generated"},confidence:{type:e.Float_unsecure(),isOptional:!1},reasoning:{type:e.String_unsecure(),isOptional:!0},reviewedBy:{type:e.String_unsecure(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),D=t({name:"CommunicationParticipant",description:"A person or system that participates in conversations",fields:{id:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!0},email:{type:e.EmailAddress(),isOptional:!0},accounts:{type:g,isArray:!0,isOptional:!1},identityLinks:{type:S,isArray:!0,isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),_=t({name:"Attachment",description:"A file or media attachment on a message",fields:{id:{type:e.String_unsecure(),isOptional:!1},messageId:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},mimeType:{type:e.String_unsecure(),isOptional:!0},sizeBytes:{type:e.Int_unsecure(),isOptional:!0},url:{type:e.URL(),isOptional:!0},metadata:{type:e.JSONObject(),isOptional:!0}}}),h=t({name:"ThreadLink",description:"Link between a thread and an external business object (V2: rich-reference objectRef replaces V1 objectType/objectId)",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},objectRef:{type:e.JSONObject(),isOptional:!1},relation:{type:e.String_unsecure(),isOptional:!0},confidence:{type:e.Float_unsecure(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),A=t({name:"MessageIntent",description:"Classified message or thread intent with confidence and evidence",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},messageId:{type:e.String_unsecure(),isOptional:!0},category:{type:m,isOptional:!1},confidence:{type:e.Float_unsecure(),isOptional:!1},reasoning:{type:e.String_unsecure(),isOptional:!0},evidenceMessageIds:{type:e.String_unsecure(),isArray:!0,isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),w=t({name:"CommunicationMessage",description:"A single message within a communication thread",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},channelType:{type:s,isOptional:!1},channelAccountId:{type:e.String_unsecure(),isOptional:!1},participantId:{type:e.String_unsecure(),isOptional:!0},externalMessageId:{type:e.String_unsecure(),isOptional:!0},body:{type:e.String_unsecure(),isOptional:!1},bodyNormalized:{type:e.String_unsecure(),isOptional:!0},status:{type:d,isOptional:!1,defaultValue:"received"},intent:{type:A,isOptional:!0},attachments:{type:_,isArray:!0,isOptional:!0},metadata:{type:e.JSONObject(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),M=t({name:"CommunicationFormIntake",description:"Declarative source reference for a communication message mapped into an entity-bound form intake result",fields:{id:{type:e.String_unsecure(),isOptional:!1},messageId:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},channelType:{type:s,isOptional:!1},channelAccountId:{type:e.String_unsecure(),isOptional:!1},participantId:{type:e.String_unsecure(),isOptional:!0},entityKey:{type:e.String_unsecure(),isOptional:!1},projectionKind:{type:e.String_unsecure(),isOptional:!1},formKey:{type:e.String_unsecure(),isOptional:!0},formVersion:{type:e.String_unsecure(),isOptional:!0},completionProfileKey:{type:e.String_unsecure(),isOptional:!0},acceptedValues:{type:e.JSONObject(),isOptional:!1},completionDebt:{type:e.JSONObject(),isArray:!0,isOptional:!1},captureStatus:{type:e.String_unsecure(),isOptional:!1,defaultValue:"accepted"},completionStatus:{type:e.String_unsecure(),isOptional:!1},createdAt:{type:e.DateTime(),isOptional:!1}}}),E=t({name:"CommunicationThread",description:"A conversation thread spanning one or more channels",fields:{id:{type:e.String_unsecure(),isOptional:!1},title:{type:e.String_unsecure(),isOptional:!0},status:{type:c,isOptional:!1,defaultValue:"open"},participantIds:{type:e.String_unsecure(),isArray:!0,isOptional:!1},channelTypes:{type:s,isArray:!0,isOptional:!1},links:{type:h,isArray:!0,isOptional:!0},assignedTo:{type:e.String_unsecure(),isOptional:!0},priority:{type:e.String_unsecure(),isOptional:!0},tags:{type:e.String_unsecure(),isArray:!0,isOptional:!0},metadata:{type:e.JSONObject(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),O=t({name:"CommunicationAction",description:"Structured action extracted from a conversation",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},title:{type:e.String_unsecure(),isOptional:!1},owner:{type:e.String_unsecure(),isOptional:!0},deadline:{type:e.DateTime(),isOptional:!0},blockers:{type:e.String_unsecure(),isArray:!0,isOptional:!0},sourceMessageIds:{type:e.String_unsecure(),isArray:!0,isOptional:!1},safetyMode:{type:f,isOptional:!1,defaultValue:"draft_only"}}}),u=t({name:"ReplyDraft",description:"An AI-generated or human-authored reply draft",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},messageId:{type:e.String_unsecure(),isOptional:!0},body:{type:e.String_unsecure(),isOptional:!1},status:{type:p,isOptional:!1,defaultValue:"drafted"},generatedBy:{type:e.String_unsecure(),isOptional:!0},modelName:{type:e.String_unsecure(),isOptional:!0},promptVersion:{type:e.String_unsecure(),isOptional:!0},policyVersion:{type:e.String_unsecure(),isOptional:!0},reviewedBy:{type:e.String_unsecure(),isOptional:!0},reviewedAt:{type:e.DateTime(),isOptional:!0},metadata:{type:e.JSONObject(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),v=t({name:"HandoffPacket",description:"A structured handoff between owners, teams, or systems",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},status:{type:y,isOptional:!1,defaultValue:"created"},fromOwner:{type:e.String_unsecure(),isOptional:!1},toOwner:{type:e.String_unsecure(),isOptional:!1},summary:{type:e.String_unsecure(),isOptional:!1},keyFacts:{type:e.String_unsecure(),isArray:!0,isOptional:!0},openQuestions:{type:e.String_unsecure(),isArray:!0,isOptional:!0},requiredActions:{type:O,isArray:!0,isOptional:!0},evidenceLinks:{type:e.String_unsecure(),isArray:!0,isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),C=t({name:"CommunicationSummary",description:"AI-generated summary of a thread or message range",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},messageIds:{type:e.String_unsecure(),isArray:!0,isOptional:!0},content:{type:e.String_unsecure(),isOptional:!1},facts:{type:e.JSONObject(),isArray:!0,isOptional:!0},actions:{type:O,isArray:!0,isOptional:!0},decisions:{type:e.JSONObject(),isArray:!0,isOptional:!0},risks:{type:e.JSONObject(),isArray:!0,isOptional:!0},modelName:{type:e.String_unsecure(),isOptional:!0},generatedAt:{type:e.DateTime(),isOptional:!1}}}),R=t({name:"AgentSuggestion",description:"An AI-generated suggestion attached to a thread or message",fields:{id:{type:e.String_unsecure(),isOptional:!1},threadId:{type:e.String_unsecure(),isOptional:!1},messageId:{type:e.String_unsecure(),isOptional:!0},suggestionType:{type:e.String_unsecure(),isOptional:!1},content:{type:e.String_unsecure(),isOptional:!1},status:{type:l,isOptional:!1,defaultValue:"generated"},modelName:{type:e.String_unsecure(),isOptional:!0},confidence:{type:e.Float_unsecure(),isOptional:!0},policyVersion:{type:e.String_unsecure(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}});var o=["platform.communication-os"],B=r({meta:{key:"communication.decision.extract",version:"1.0.0",stability:"experimental",owners:[...o],tags:["communication","decision","extract"],description:"Extract decisions and open questions from a thread",goal:"Make buried decisions reviewable with source references",context:"Read-only/draft-only operation for summaries and handoffs"},io:{input:a({name:"ExtractDecisionsInput",fields:{threadId:{type:i.String_unsecure(),isOptional:!1}}}),output:a({name:"ExtractDecisionsOutput",fields:{decisions:{type:i.JSONObject(),isArray:!0,isOptional:!1}}})},policy:{auth:"user"}}),F=r({meta:{key:"communication.risk.extract",version:"1.0.0",stability:"experimental",owners:[...o],tags:["communication","risk","blocker"],description:"Extract risks and blockers from a thread",goal:"Surface blockers, policy risks, and unresolved dependencies",context:"Read-only/draft-only operation for triage and escalation"},io:{input:a({name:"ExtractRisksInput",fields:{threadId:{type:i.String_unsecure(),isOptional:!1}}}),output:a({name:"ExtractRisksOutput",fields:{risks:{type:i.JSONObject(),isArray:!0,isOptional:!1}}})},policy:{auth:"user"}}),L=r({meta:{key:"communication.reply.draft",version:"1.0.0",stability:"experimental",owners:[...o],tags:["communication","reply","draft"],description:"Draft a reply using thread context and policy",goal:"Generate a safe, context-aware reply draft",context:"Draft-only operation; policy may require review or block the draft"},io:{input:a({name:"DraftReplyInput",fields:{threadId:{type:i.String_unsecure(),isOptional:!1},messageId:{type:i.String_unsecure(),isOptional:!0},instruction:{type:i.String_unsecure(),isOptional:!0}}}),output:u},policy:{auth:"user"}}),q=r({meta:{key:"communication.reply.send",version:"1.0.0",stability:"experimental",owners:[...o],tags:["communication","reply","send"],description:"Send an approved reply through its channel",goal:"Deliver a reply only when policy allows",context:"Policy-executable operation; every sent reply must be auditable"},io:{input:a({name:"SendReplyInput",fields:{draftId:{type:i.String_unsecure(),isOptional:!1}}}),output:a({name:"SendReplyOutput",fields:{draftId:{type:i.String_unsecure(),isOptional:!1},status:{type:p,isOptional:!1},sentAt:{type:i.DateTime(),isOptional:!0}}})},policy:{auth:"user"}}),H=r({meta:{key:"communication.reply.blockByPolicy",version:"1.0.0",stability:"experimental",owners:[...o],tags:["communication","reply","policy","blocked"],description:"Record that a reply was blocked by policy",goal:"Keep blocked reply decisions explicit and auditable",context:"Used by reply policy gates before any outbound side effect"},io:{input:a({name:"BlockReplyByPolicyInput",fields:{draftId:{type:i.String_unsecure(),isOptional:!1},policyRef:{type:i.String_unsecure(),isOptional:!1},reason:{type:i.String_unsecure(),isOptional:!1}}}),output:u},policy:{auth:"admin"}});export{H as BlockReplyByPolicyCommand,L as DraftReplyCommand,B as ExtractDecisionsCommand,F as ExtractRisksCommand,q as SendReplyCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as o}from"zod";var g="1.0.0",y="1.0.0",h={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"},n=o.string().trim().min(1),m=o.string().datetime({offset:!0}),a=o.string().regex(/^sha256:[a-f0-9]{64}$/),u=o.object({ref:n,digest:a}).strict(),c=u.extend({revision:o.number().int().positive()}).strict(),d=o.object({tenantRef:n,workspaceRef:n.optional(),spaceRef:n.optional(),subjectRef:n}).strict(),C=o.object({schemaVersion:o.literal(g),profileRef:n,revision:o.number().int().positive(),agentRef:n,applicationRef:n,scope:d,routeBindings:o.array(c),connectionRefs:o.array(n),preferenceSet:c,policyRefs:o.array(n).min(1),evidenceRefs:o.array(n).min(1),createdAt:m,updatedAt:m,profileDigest:a}).strict().superRefine((e,t)=>{for(let s of["connectionRefs","policyRefs","evidenceRefs"])if(new Set(e[s]).size!==e[s].length)t.addIssue({code:o.ZodIssueCode.custom,path:[s],message:`${s} must be unique`});let i=e.routeBindings.map((s)=>s.ref);if(new Set(i).size!==i.length)t.addIssue({code:o.ZodIssueCode.custom,path:["routeBindings"],message:"route bindings must be unique"})}),V=o.object({schemaVersion:o.literal(y),linkRef:n,profile:c,agentRef:n,applicationRef:n,scope:d,runRef:n.optional(),taskRef:n.optional(),helpRequestRef:n.optional(),approvalRequestRef:n.optional(),backgroundResultRef:n.optional(),canonicalConversation:u.optional(),session:c.optional(),correlationRef:n,evidenceRefs:o.array(n).min(1)}).strict().superRefine((e,t)=>{if(new Set(e.evidenceRefs).size!==e.evidenceRefs.length)t.addIssue({code:o.ZodIssueCode.custom,path:["evidenceRefs"],message:"evidenceRefs must be unique"});if(!e.runRef&&!e.taskRef&&!e.helpRequestRef&&!e.approvalRequestRef&&!e.backgroundResultRef)t.addIssue({code:o.ZodIssueCode.custom,path:["runRef"],message:"at least one run, task, help request, approval request, or background result ref is required"})});function l(e,t){return e.tenantRef===t.tenantRef&&e.workspaceRef===t.workspaceRef&&e.spaceRef===t.spaceRef&&e.subjectRef===t.subjectRef}function v(e){let t=[];for(let i of["agentRef","applicationRef"])if(e.profile[i]!==e.lifecycleLink[i])t.push(`Lifecycle ${i} 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)t.push("Lifecycle profile binding does not match the agent profile");if(!l(e.profile.scope,e.lifecycleLink.scope))t.push("Lifecycle scope does not match the agent profile");return t}function A(e){let{intent:t,progress:i}=e,s=[];if(i.deliveryRef!==t.deliveryRef||i.intent.ref!==t.deliveryRef||i.intent.digest!==t.deliveryDigest)s.push("Progress delivery does not match the intent");if(!l(i.scope,t.scope))s.push("Progress scope does not match the intent");if(i.recipientRef!==t.recipientRefs[0])s.push("Progress recipient does not match the intent");let r=t.requestedRoutes.find((f)=>f.ref===i.route.ref);if(!r||r.revision!==i.route.revision||r.digest!==i.route.digest)s.push("Progress route was not requested by the intent");if(Date.parse(i.occurredAt)<Date.parse(t.createdAt)||Date.parse(i.occurredAt)>Date.parse(t.expiresAt))s.push("Progress occurred outside the intent validity window");return s}async function k(e){let t=new TextEncoder().encode(p(e)),i=new Uint8Array(t.byteLength);i.set(t);let s=await crypto.subtle.digest("SHA-256",i.buffer),r=Array.from(new Uint8Array(s),(f)=>f.toString(16).padStart(2,"0")).join("");return a.parse(`sha256:${r}`)}function p(e){if(Array.isArray(e))return`[${e.map(p).join(",")}]`;if(e&&typeof e==="object")return`{${Object.entries(e).sort(([t],[i])=>t.localeCompare(i)).map(([t,i])=>`${JSON.stringify(t)}:${p(i)}`).join(",")}}`;return JSON.stringify(e)}export{k as digestCommunicationArtifactV1};
|