@ziggs-ai/contracts 0.31.0 → 0.33.0

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.
@@ -0,0 +1,57 @@
1
+ /** Server-issued work boundary. This reference never grants authority. */
2
+ export interface WorkExecutionContext {
3
+ contextId: string;
4
+ actorId: string;
5
+ principalId: string;
6
+ agreementId: string | null;
7
+ position: 'payer' | 'provider' | 'participant';
8
+ /** Delivery destination. Its readers constrain execution; it grants no authority. */
9
+ chatId: string | null;
10
+ /** Explicit readers of this work, expanded by the server from its parties. */
11
+ audienceIds: string[];
12
+ audienceRevision: string;
13
+ }
14
+ /** Assigned mail is handled by responsibility id, never by the underlying resource. */
15
+ export declare function deliveryHandlingId(row: {
16
+ responsibilityId?: string | null;
17
+ }): string;
18
+ /** A pending assignment whose execution cannot currently be prepared. */
19
+ export interface ExecutionBlock {
20
+ code: 'EXECUTION_ACCESS_REQUIRED' | 'EXECUTION_UNAVAILABLE';
21
+ message: string;
22
+ }
23
+ /** Where an owner consents to use a contributed artifact. This is not read authority. */
24
+ export interface ContributionTarget {
25
+ kind: 'chat' | 'agreement';
26
+ id: string;
27
+ }
28
+ export interface ContextContribution {
29
+ target: ContributionTarget;
30
+ /** Frozen, expanded audience approved by the owner; joining does not expand it. */
31
+ audienceIds: string[];
32
+ }
33
+ /** Display of the selected position. References are viewer-safe, not authority tokens. */
34
+ export interface WorkPositionView {
35
+ state: 'execution' | 'view';
36
+ actor: {
37
+ ref: string;
38
+ kind: 'agent' | 'person' | 'chatter';
39
+ };
40
+ accountable: {
41
+ ref: string;
42
+ } | null;
43
+ agreementId: string | null;
44
+ role: WorkExecutionContext['position'] | null;
45
+ executionContextId: string | null;
46
+ destination: {
47
+ kind: 'chat';
48
+ id: string;
49
+ } | null;
50
+ audience: {
51
+ state: 'resolved';
52
+ refs: string[];
53
+ unnamedReaders: number;
54
+ } | {
55
+ state: 'not_evaluated';
56
+ };
57
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deliveryHandlingId = deliveryHandlingId;
4
+ /** Assigned mail is handled by responsibility id, never by the underlying resource. */
5
+ function deliveryHandlingId(row) {
6
+ if (!row.responsibilityId)
7
+ throw new Error('Assigned delivery is missing its responsibilityId');
8
+ return row.responsibilityId;
9
+ }
package/dist/inbox.d.ts CHANGED
@@ -63,6 +63,8 @@ export interface DecisionRef {
63
63
  * than leaving the reader to assume it.
64
64
  */
65
65
  export interface AccessAsk {
66
+ /** Explicit use consent, in addition to the readers' access. */
67
+ contributionTo?: import('./execution').ContributionTarget;
66
68
  /**
67
69
  * A reply grant includes reading and writing in this one conversation.
68
70
  * `list` (ZIG-2170) is asked of a person scope: which rooms they are in,
@@ -125,6 +127,10 @@ export interface InboxDeliveryRef {
125
127
  resourceId: string;
126
128
  /** One emit, one id — collapse copies of the same event on this. */
127
129
  eventId: string;
130
+ /** Explicit assignment identity; use this for acknowledgement when present. */
131
+ responsibilityId?: string;
132
+ executionContext?: import('./execution').WorkExecutionContext;
133
+ executionBlocked?: import('./execution').ExecutionBlock;
128
134
  /** The mailbox this copy lives in. */
129
135
  partyId: string;
130
136
  partyKind: InboxPartyKind;
@@ -249,6 +255,7 @@ export interface MarkInboxSeenBody {
249
255
  }
250
256
  /** Marketplace request triage channel shared by the server and hosted clients. */
251
257
  export interface InboxOpenRequestRef {
258
+ responsibilityId: string;
252
259
  agreementId: string;
253
260
  /** Exact-match triage string from the publisher (`metadata.match`). */
254
261
  match: string;
package/dist/index.d.ts CHANGED
@@ -21,3 +21,4 @@ export * from './generated/agreements';
21
21
  export * from './generated/artifacts';
22
22
  export * from './identifiers';
23
23
  export * from './generated/chat-send';
24
+ export * from './execution';
package/dist/index.js CHANGED
@@ -38,3 +38,4 @@ __exportStar(require("./generated/agreements"), exports);
38
38
  __exportStar(require("./generated/artifacts"), exports);
39
39
  __exportStar(require("./identifiers"), exports);
40
40
  __exportStar(require("./generated/chat-send"), exports);
41
+ __exportStar(require("./execution"), exports);
package/dist/socket.d.ts CHANGED
@@ -86,9 +86,24 @@ export interface ChatMessageReadFrame {
86
86
  messageIds: string[];
87
87
  kind?: 'agent_handover';
88
88
  }
89
+ /**
90
+ * ZIG-857 — non-persisted "the agent is working" cue for the room.
91
+ *
92
+ * Agents never open a socket (inbox is HTTP). The server emits this when an
93
+ * agent picks up chat mail (`working`) so the room is not dead air until the
94
+ * first `chat:message:new`. Cleared by `done`, by that agent's next message,
95
+ * or by the client after a short idle.
96
+ */
97
+ export interface ChatMessageActivityFrame {
98
+ chatId: string;
99
+ /** Agent (or person) the indicator is about. */
100
+ senderId: string;
101
+ kind: 'working' | 'done';
102
+ }
89
103
  export interface ServerToClientEvents {
90
104
  'chat:message:new': ChatMessageNewFrame;
91
105
  'chat:message:read': ChatMessageReadFrame;
106
+ 'chat:message:activity': ChatMessageActivityFrame;
92
107
  'chat:read': ChatReadFrame;
93
108
  'chat:participants_changed': ChatParticipantsChangedFrame;
94
109
  'agent:liveness': AgentLivenessFrame;
@@ -102,6 +117,7 @@ export interface ClientToServerEvents {
102
117
  export declare const SERVER_EVENTS: {
103
118
  readonly chatMessageNew: "chat:message:new";
104
119
  readonly chatMessageRead: "chat:message:read";
120
+ readonly chatMessageActivity: "chat:message:activity";
105
121
  readonly chatRead: "chat:read";
106
122
  readonly chatParticipantsChanged: "chat:participants_changed";
107
123
  readonly agentLiveness: "agent:liveness";
package/dist/socket.js CHANGED
@@ -5,6 +5,7 @@ exports.CLIENT_EVENTS = exports.SERVER_EVENTS = void 0;
5
5
  exports.SERVER_EVENTS = {
6
6
  chatMessageNew: 'chat:message:new',
7
7
  chatMessageRead: 'chat:message:read',
8
+ chatMessageActivity: 'chat:message:activity',
8
9
  chatRead: 'chat:read',
9
10
  chatParticipantsChanged: 'chat:participants_changed',
10
11
  agentLiveness: 'agent:liveness',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggs-ai/contracts",
3
- "version": "0.31.0",
3
+ "version": "0.33.0",
4
4
  "description": "Wire contracts for the Ziggs API — response shapes, error body, and socket events, shared by every client.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",