@ziggs-ai/contracts 0.43.0 → 0.45.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.
@@ -3,7 +3,7 @@
3
3
  * Family: grants. Regenerate: backend 'pnpm docs:generate' then this script.
4
4
  */
5
5
  export type GrantScopeView = {
6
- kind: "message" | "address" | "agreement" | "org" | "artifact" | "task" | "person" | "connection" | "wallet" | "consent" | "inbox";
6
+ kind: "message" | "address" | "agreement" | "org" | "artifact" | "task" | "person" | "contact" | "connection" | "wallet" | "consent" | "inbox";
7
7
  id: string;
8
8
  label?: string;
9
9
  };
@@ -12,7 +12,7 @@ export type GrantCaveatView = {
12
12
  value: unknown;
13
13
  };
14
14
  export type GrantBasis = {
15
- kind: "creation" | "publication" | "membership" | "acceptance" | "agreement" | "vouch" | "owner";
15
+ kind: "creation" | "publication" | "membership" | "acceptance" | "agreement" | "vouch" | "owner" | "contact";
16
16
  id: string | null;
17
17
  };
18
18
  export type GrantView = {
package/dist/inbox.d.ts CHANGED
@@ -76,7 +76,8 @@ export interface AccessAsk {
76
76
  * `list` (ZIG-2170) is asked of a person scope: which rooms they are in,
77
77
  * never what is in them.
78
78
  */
79
- permission?: 'list' | 'read' | 'reply';
79
+ /** `send` (ZIG-2321): one-way permission to message the scope's destination; no read. */
80
+ permission?: 'list' | 'read' | 'reply' | 'send';
80
81
  /** The one thing. `name` is absent when nothing readable resolves. */
81
82
  scope: {
82
83
  kind: string;
@@ -154,11 +154,11 @@ function parseMessageCommand(value) {
154
154
  }
155
155
  case 'answer':
156
156
  object(effect, ['kind', 'action', 'artifacts'], 'effect');
157
- effectValue = {
158
- kind: 'answer',
159
- action: messageAction(effect.action),
160
- artifacts: list(effect.artifacts, exactArtifact, 'answer artifacts'),
161
- };
157
+ // Published 0.43 clients require this field. Normalize the empty wire
158
+ // value away; actual files use relationships.artifacts on every message.
159
+ if (effect.artifacts !== undefined)
160
+ list(effect.artifacts, exactArtifact, 'answer artifacts', 0);
161
+ effectValue = { kind: 'answer', action: messageAction(effect.action) };
162
162
  break;
163
163
  case 'provide-input': {
164
164
  object(effect, ['kind', 'action'], 'effect');
@@ -65,12 +65,15 @@ export type MessageActionEffect = {
65
65
  } | {
66
66
  kind: 'provide-input';
67
67
  action: import('./actions').ActionSlotRef;
68
- } | {
68
+ }
69
+ /** Files on an answer go in relationships.artifacts, like any message. */
70
+ | {
69
71
  kind: 'answer';
70
72
  action: Extract<import('./actions').ActionSlotRef, {
71
73
  kind: 'message';
72
74
  }>;
73
- artifacts: ExactArtifactRef[];
75
+ /** @deprecated Accepted empty for published 0.43 clients; files belong in relationships. */
76
+ artifacts?: [];
74
77
  };
75
78
  export interface MessageCommand {
76
79
  /** Authenticated accountable principal scopes this identity. Changed input conflicts. */
@@ -83,7 +86,7 @@ export interface MessageCommand {
83
86
  /** Resolve once and persist the snapshot atomically with the message. */
84
87
  deliveries: MessageDeliveries;
85
88
  effect: MessageActionEffect;
86
- /** Private provenance, never included in the message presentation. */
89
+ /** Private provenance: only the sender sees it back, as `sentFrom`. */
87
90
  sources?: MessageSourceRef[];
88
91
  /** Required when the selected work/spending relies on an agreement. No fallback. */
89
92
  mandate?: {
@@ -122,6 +125,12 @@ export interface MessageRecord {
122
125
  importedFrom: {
123
126
  channel: 'slack' | 'email' | 'github';
124
127
  } | null;
128
+ /** Null for every viewer but the sender. For the sender: the pages they sent
129
+ * it from that they can still read. Other readers never learn the source. */
130
+ sentFrom: Array<{
131
+ artifactId: string;
132
+ name: string;
133
+ }> | null;
125
134
  }
126
135
  export interface MessageCommandResult {
127
136
  outcome: 'created' | 'existing';
@@ -135,12 +135,12 @@ export declare const AGREEMENT_TERMINAL_STATES: readonly AgreementStatusValue[];
135
135
  * Context-rail scopes, then the other rails a grant can name.
136
136
  * Order is the order the grants read and the OpenAPI enum publish.
137
137
  */
138
- export declare const CONTEXT_GRANT_SCOPE_KINDS: readonly ["message", "address", "agreement", "org", "artifact", "task", "person"];
139
- export declare const GRANT_SCOPE_KINDS: readonly ["message", "address", "agreement", "org", "artifact", "task", "person", "connection", "wallet", "consent", "inbox"];
138
+ export declare const CONTEXT_GRANT_SCOPE_KINDS: readonly ["message", "address", "agreement", "org", "artifact", "task", "person", "contact"];
139
+ export declare const GRANT_SCOPE_KINDS: readonly ["message", "address", "agreement", "org", "artifact", "task", "person", "contact", "connection", "wallet", "consent", "inbox"];
140
140
  export type GrantScopeKind = (typeof GRANT_SCOPE_KINDS)[number];
141
141
  export type ContextGrantScopeKind = (typeof CONTEXT_GRANT_SCOPE_KINDS)[number];
142
142
  /** What an access request may name. Always one resource. */
143
- export declare const ACCESS_REQUEST_SCOPE_KINDS: readonly ["message", "artifact", "agreement", "task"];
143
+ export declare const ACCESS_REQUEST_SCOPE_KINDS: readonly ["message", "artifact", "agreement", "task", "contact"];
144
144
  export type AccessRequestScopeKind = (typeof ACCESS_REQUEST_SCOPE_KINDS)[number];
145
145
  /**
146
146
  * Who an artifact access request may ask a grant FOR. Each reader is named
@@ -160,6 +160,10 @@ exports.CONTEXT_GRANT_SCOPE_KINDS = [
160
160
  'task',
161
161
  // Historical person-wide room discovery. New grants cannot use this scope.
162
162
  'person',
163
+ // A one-way send grant: the holder may send messages to this destination
164
+ // principal (scope id). Held at write only, never delegated, and minted only
165
+ // by an approved access request.
166
+ 'contact',
163
167
  ];
164
168
  exports.GRANT_SCOPE_KINDS = [
165
169
  ...exports.CONTEXT_GRANT_SCOPE_KINDS,
@@ -174,6 +178,9 @@ exports.ACCESS_REQUEST_SCOPE_KINDS = [
174
178
  'artifact',
175
179
  'agreement',
176
180
  'task',
181
+ // Permission to send messages to one destination (a person, an agent, or a
182
+ // workspace inbox). Its approver is the destination's owner.
183
+ 'contact',
177
184
  ];
178
185
  /**
179
186
  * Who an artifact access request may ask a grant FOR. Each reader is named
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggs-ai/contracts",
3
- "version": "0.43.0",
3
+ "version": "0.45.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",