@ziggs-ai/api-client 0.7.1 → 0.9.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.
Files changed (38) hide show
  1. package/README.md +10 -0
  2. package/dist/capabilities/artifacts.d.ts +28 -0
  3. package/dist/capabilities/artifacts.js +200 -17
  4. package/dist/capabilities/context.js +37 -16
  5. package/dist/capabilities/grants.d.ts +8 -1
  6. package/dist/capabilities/grants.js +17 -11
  7. package/dist/capabilities/index.d.ts +1 -1
  8. package/dist/capabilities/index.js +1 -1
  9. package/dist/capabilities/types.d.ts +1 -0
  10. package/dist/capabilities/types.js +4 -2
  11. package/dist/http/AgreementClient.d.ts +35 -16
  12. package/dist/http/AgreementClient.js +87 -33
  13. package/dist/http/ArtifactsClient.d.ts +38 -1
  14. package/dist/http/ArtifactsClient.js +70 -10
  15. package/dist/http/ChatClient.js +4 -14
  16. package/dist/http/ContextGrantsClient.d.ts +21 -1
  17. package/dist/http/ContextGrantsClient.js +36 -18
  18. package/dist/http/ContextReadClient.d.ts +30 -3
  19. package/dist/http/ContextReadClient.js +58 -1
  20. package/dist/http/InboxClient.d.ts +32 -3
  21. package/dist/http/MarketplaceClient.d.ts +0 -1
  22. package/dist/http/MarketplaceClient.js +4 -10
  23. package/dist/http/PaymentsClient.js +2 -12
  24. package/dist/http/TaskClient.d.ts +8 -0
  25. package/dist/http/TaskClient.js +4 -21
  26. package/dist/http/grants.d.ts +12 -1
  27. package/dist/http/grants.js +21 -0
  28. package/dist/http/index.d.ts +4 -4
  29. package/dist/http/index.js +2 -2
  30. package/dist/http/operatorHeaders.d.ts +7 -1
  31. package/dist/http/operatorHeaders.js +8 -1
  32. package/dist/index.d.ts +3 -1
  33. package/dist/index.js +5 -1
  34. package/dist/shared/apiError.d.ts +22 -0
  35. package/dist/shared/apiError.js +57 -0
  36. package/dist/types.d.ts +55 -0
  37. package/dist/types.js +19 -0
  38. package/package.json +1 -1
package/dist/types.d.ts CHANGED
@@ -6,6 +6,21 @@ export declare class ApiError extends Error {
6
6
  export interface Creds {
7
7
  operatorKey: string;
8
8
  agentId: string;
9
+ /**
10
+ * ZIG-1092 — the lane (chat id, or `agrn-<agreementId>`) this call is being
11
+ * made from. Sent as `X-Ziggs-Lane` so the backend can fence the wake to the
12
+ * engagement the agent is actually acting inside.
13
+ *
14
+ * The operator key says WHO is calling; this says ON WHOSE BEHALF, RIGHT NOW.
15
+ * Without it an agent serving several customers carries its full authority
16
+ * into every call, and one tool call reaches another customer's work.
17
+ *
18
+ * Optional, and omitting it can only narrow what comes back (the backend
19
+ * falls back to the agent's own org) — never widen it. Nothing here is
20
+ * trusted: the server re-derives the party orgs itself and refuses a lane the
21
+ * agent is not in.
22
+ */
23
+ laneId?: string;
9
24
  }
10
25
  export type TaskState = 'active' | 'proposal' | 'completed' | 'failed' | 'cancelled' | 'ledger_open';
11
26
  export type PlanStepStatus = 'pending' | 'in_progress' | 'completed' | 'skipped';
@@ -159,6 +174,36 @@ export type BroadcastAudience = typeof OPEN_AGREEMENT_TARGET | typeof ORG_AGREEM
159
174
  export declare const BROADCAST_TARGETS: readonly ["everyone", "org"];
160
175
  /** True when `id` is a broadcast sentinel ('everyone' | 'org') rather than a concrete principal id. */
161
176
  export declare function isBroadcastTarget(id: string | null | undefined): boolean;
177
+ /**
178
+ * Persona face id (`psn_*`). Non-addressable — never use for agent lookup,
179
+ * wake, or payment parties (ZIG-1137).
180
+ */
181
+ export declare function isPersonaRef(id: string | null | undefined): boolean;
182
+ /**
183
+ * Room presentation binding id (`rpb_*`). Opaque to account lookup / wake /
184
+ * pay. Chat sends may echo it as `receiverId` — the backend resolves it in-room
185
+ * (ZIG-1137).
186
+ */
187
+ export declare function isRoomPresentationRef(id: string | null | undefined): boolean;
188
+ /** Either opaque presentation ref (`psn_*` | `rpb_*`). */
189
+ export declare function isOpaquePresentationRef(id: string | null | undefined): boolean;
190
+ /** Display + entitlement face for a principal on the message/roster wire. */
191
+ export interface PrincipalPresentation {
192
+ /** Public, non-addressable reference (`psn_*` or `rpb_*`). */
193
+ ref?: string;
194
+ persona: {
195
+ id: string;
196
+ name: string;
197
+ image?: string | null;
198
+ revision?: number;
199
+ };
200
+ mode: 'persona' | 'chain';
201
+ /** Present only when the viewer is entitled to resolve the subject. */
202
+ subject?: {
203
+ id: string;
204
+ type: 'user' | 'agent';
205
+ };
206
+ }
162
207
  export interface MessageMetadata {
163
208
  chatId: string;
164
209
  /** Stable id for dedup across push + inbox catch-up (ZIG-454). */
@@ -167,13 +212,23 @@ export interface MessageMetadata {
167
212
  sender: {
168
213
  id: string;
169
214
  type?: string;
215
+ presentation?: PrincipalPresentation | null;
216
+ /** Absent when the viewer is masked (persona layer). */
217
+ underAgreementId?: string | null;
218
+ presentedAs?: string | null;
170
219
  };
171
220
  senderId: string;
172
221
  senderType?: string;
173
222
  receiver?: {
174
223
  id: string;
224
+ presentation?: PrincipalPresentation | null;
175
225
  } | null;
176
226
  receiverId?: string | null;
227
+ /**
228
+ * Message-level presentation stamp when the backend attaches one
229
+ * (same shape as sender.presentation). Prefer sender.presentation.
230
+ */
231
+ presentation?: PrincipalPresentation | null;
177
232
  entryType?: string;
178
233
  content_type?: string;
179
234
  taskId?: string | null;
package/dist/types.js CHANGED
@@ -58,3 +58,22 @@ export const BROADCAST_TARGETS = [OPEN_AGREEMENT_TARGET, ORG_AGREEMENT_TARGET];
58
58
  export function isBroadcastTarget(id) {
59
59
  return id === OPEN_AGREEMENT_TARGET || id === ORG_AGREEMENT_TARGET;
60
60
  }
61
+ /**
62
+ * Persona face id (`psn_*`). Non-addressable — never use for agent lookup,
63
+ * wake, or payment parties (ZIG-1137).
64
+ */
65
+ export function isPersonaRef(id) {
66
+ return typeof id === 'string' && id.startsWith('psn_');
67
+ }
68
+ /**
69
+ * Room presentation binding id (`rpb_*`). Opaque to account lookup / wake /
70
+ * pay. Chat sends may echo it as `receiverId` — the backend resolves it in-room
71
+ * (ZIG-1137).
72
+ */
73
+ export function isRoomPresentationRef(id) {
74
+ return typeof id === 'string' && id.startsWith('rpb_');
75
+ }
76
+ /** Either opaque presentation ref (`psn_*` | `rpb_*`). */
77
+ export function isOpaquePresentationRef(id) {
78
+ return isPersonaRef(id) || isRoomPresentationRef(id);
79
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggs-ai/api-client",
3
- "version": "0.7.1",
3
+ "version": "0.9.0",
4
4
  "description": "HTTP and WebSocket client for the Ziggs backend API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",