@ziggs-ai/api-client 0.10.3 → 0.11.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 (48) hide show
  1. package/dist/capabilities/agreementVerbs.d.ts +2 -2
  2. package/dist/capabilities/agreementVerbs.js +19 -19
  3. package/dist/capabilities/agreements.d.ts +1 -1
  4. package/dist/capabilities/agreements.js +5 -5
  5. package/dist/capabilities/artifacts.d.ts +4 -2
  6. package/dist/capabilities/artifacts.js +169 -34
  7. package/dist/capabilities/chat.d.ts +2 -3
  8. package/dist/capabilities/chat.js +5 -6
  9. package/dist/capabilities/connections.js +1 -1
  10. package/dist/capabilities/context.js +3 -0
  11. package/dist/capabilities/grants.d.ts +7 -6
  12. package/dist/capabilities/grants.js +9 -8
  13. package/dist/capabilities/index.d.ts +2 -2
  14. package/dist/capabilities/index.js +2 -2
  15. package/dist/capabilities/links.d.ts +1 -1
  16. package/dist/capabilities/links.js +8 -11
  17. package/dist/capabilities/marketplace.js +63 -13
  18. package/dist/capabilities/payments.d.ts +24 -8
  19. package/dist/capabilities/payments.js +28 -392
  20. package/dist/capabilities/proposeProviderId.d.ts +1 -1
  21. package/dist/capabilities/proposeProviderId.js +1 -1
  22. package/dist/http/AgreementClient.d.ts +28 -22
  23. package/dist/http/AgreementClient.js +26 -17
  24. package/dist/http/ArtifactsClient.d.ts +3 -3
  25. package/dist/http/ArtifactsClient.js +6 -8
  26. package/dist/http/ChatClient.d.ts +1 -0
  27. package/dist/http/ChatClient.js +4 -1
  28. package/dist/http/ConnectionsClient.js +12 -1
  29. package/dist/http/ContextGrantsClient.d.ts +15 -1
  30. package/dist/http/ContextGrantsClient.js +2 -0
  31. package/dist/http/ContextReadClient.d.ts +18 -8
  32. package/dist/http/ContextReadClient.js +4 -3
  33. package/dist/http/GrantsClient.d.ts +14 -0
  34. package/dist/http/GrantsClient.js +18 -2
  35. package/dist/http/InboxClient.d.ts +1 -1
  36. package/dist/http/InboxClient.js +1 -1
  37. package/dist/http/MarketplaceClient.d.ts +6 -6
  38. package/dist/http/MarketplaceClient.js +11 -11
  39. package/dist/http/TaskClient.d.ts +13 -2
  40. package/dist/http/TaskClient.js +4 -2
  41. package/dist/http/agreementFlows.d.ts +4 -4
  42. package/dist/http/agreementFlows.js +9 -10
  43. package/dist/http/grants.d.ts +28 -0
  44. package/dist/http/index.d.ts +2 -2
  45. package/dist/index.d.ts +1 -1
  46. package/dist/types.d.ts +59 -22
  47. package/dist/types.js +6 -6
  48. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { type Creds, type Task, type TaskState } from '../types.js';
2
2
  /**
3
- * ZIG-1321 — thin confirmation from task write verbs. Full object stays on
3
+ * Thin confirmation from task write verbs. Full object stays on
4
4
  * getTask / ziggs_task_get.
5
5
  */
6
6
  export interface TaskWriteConfirm {
@@ -25,6 +25,12 @@ export interface TaskWriteConfirm {
25
25
  export type PlanReviewTiming = 'with_proposal' | 'before_execution';
26
26
  export interface CreateTaskData {
27
27
  description: string;
28
+ /**
29
+ * Short label for list rows, around 60 characters, 80 max.
30
+ * Optional: a task without one lists under a trimmed description, which is a
31
+ * wall of prose at a glance. Set it whenever the task is one row among many.
32
+ */
33
+ title?: string;
28
34
  agreementId: string;
29
35
  parentTaskId?: string;
30
36
  plan?: unknown;
@@ -62,7 +68,7 @@ export interface PlanReplaceStep {
62
68
  /** Omit to use the array index. */
63
69
  order?: number;
64
70
  /**
65
- * ZIG-1313: step progress. Omit for `pending`. Send `completed` /
71
+ * Step progress. Omit for `pending`. Send `completed` /
66
72
  * `in_progress` when replacing the plan so a later task completion does not
67
73
  * rewrite finished steps as skipped.
68
74
  */
@@ -80,6 +86,11 @@ export interface ListTasksOptions {
80
86
  limit?: number;
81
87
  /** Filter to tasks assigned to this id. */
82
88
  assignedTo?: string;
89
+ /**
90
+ * Filter to tasks CREATED by this id — what the caller handed out, as
91
+ * opposed to what was handed to it.
92
+ */
93
+ createdBy?: string;
83
94
  }
84
95
  export interface ListTasksResult {
85
96
  tasks: Task[];
@@ -24,8 +24,8 @@ function extractTask(data) {
24
24
  if (d['task'] && typeof d['task'] === 'object' && d['task']['taskId']) {
25
25
  return d['task'];
26
26
  }
27
- // Top-level task document (GET / create). Do not treat ZIG-1321 thin write
28
- // confirms (`ok: true`, no description) as a Task.
27
+ // Top-level task document (GET / create). Do not treat thin write confirms
28
+ // (`ok: true`, no description) as a Task.
29
29
  if (typeof d['taskId'] === 'string' && d['ok'] !== true) {
30
30
  return d;
31
31
  }
@@ -345,6 +345,8 @@ export async function listTasks(options = {}, creds) {
345
345
  url.searchParams.set('limit', String(options.limit));
346
346
  if (options.assignedTo)
347
347
  url.searchParams.set('assignedTo', options.assignedTo);
348
+ if (options.createdBy)
349
+ url.searchParams.set('createdBy', options.createdBy);
348
350
  const res = await fetch(url.toString(), {
349
351
  method: 'GET',
350
352
  headers: buildHeaders(creds),
@@ -1,14 +1,14 @@
1
1
  import { type ClaimedKind, type ProposeTerms } from './AgreementClient.js';
2
2
  import { type Agreement, type Creds, type EngagementKind } from '../types.js';
3
3
  /**
4
- * one propose grammar. Direct, broadcast (quest and standing
4
+ * one propose grammar. Direct, broadcast (request and standing
5
5
  * offer), and link proposals all flow through here; the surfaces expose a
6
6
  * single propose tool instead of dedicated publish/request tools.
7
7
  *
8
8
  * Routing:
9
9
  * - engagementKind 'link' → POST /agreements (link proposal / open invite)
10
10
  * - proposedTo 'everyone' | 'org', providerId = self → seller-broadcast standing offer
11
- * - proposedTo 'everyone' | 'org', no providerId → buyer-broadcast quest
11
+ * - proposedTo 'everyone' | 'org', no providerId → buyer-broadcast request
12
12
  * - anything else → direct proposal
13
13
  */
14
14
  export interface UnifiedProposeInput extends ProposeTerms {
@@ -17,13 +17,13 @@ export interface UnifiedProposeInput extends ProposeTerms {
17
17
  chatId?: string;
18
18
  engagementKind?: EngagementKind;
19
19
  }
20
- export type ProposeShape = 'direct' | 'quest' | 'offer' | 'link';
20
+ export type ProposeShape = 'direct' | 'request' | 'offer' | 'link';
21
21
  export declare function proposeUnified(input: UnifiedProposeInput, creds: Creds): Promise<{
22
22
  agreement: Agreement;
23
23
  shape: ProposeShape;
24
24
  }>;
25
25
  /**
26
- * one claim verb for any open broadcast: link invite, quest,
26
+ * one claim verb for any open broadcast: link invite, request,
27
27
  * hand-off, or standing offer.
28
28
  *
29
29
  * One request. This used to read the agreement first to decide which endpoint to
@@ -1,4 +1,4 @@
1
- import { createAgreement, claimAgreement, proposeBroadcast, proposeDirectTo, } from './AgreementClient.js';
1
+ import { createLink, claimAgreement, proposeBroadcast, proposeDirectTo, } from './AgreementClient.js';
2
2
  import { publishOffer } from './MarketplaceClient.js';
3
3
  import { isBroadcastTarget, } from '../types.js';
4
4
  export async function proposeUnified(input, creds) {
@@ -9,9 +9,8 @@ export async function proposeUnified(input, creds) {
9
9
  // A link is an agreement, proposed to one agent (providerId) or opened as
10
10
  // an invite (proposedTo 'everyone'); no chat, no money.
11
11
  const target = isBroadcastTarget(proposedTo) ? undefined : proposedTo;
12
- const { agreement } = await createAgreement({
13
- engagementKind: 'link',
14
- ...(target ? { providerId: target } : {}),
12
+ const { agreement } = await createLink({
13
+ ...(target ? { targetAgentId: target } : {}),
15
14
  ...(terms.description ? { description: terms.description } : {}),
16
15
  }, creds);
17
16
  return { agreement, shape: 'link' };
@@ -33,16 +32,16 @@ export async function proposeUnified(input, creds) {
33
32
  return { agreement, shape: 'offer' };
34
33
  }
35
34
  if (providerId) {
36
- throw new Error('On a broadcast, providerId must be your own agent id (a standing offer: you work, the claimer pays) or omitted (a quest: the claimer works, you pay). A third-party providerId is not broadcastable.');
35
+ throw new Error('On a broadcast, providerId must be your own agent id (a standing offer: you work, the claimer pays) or omitted (a request: the claimer works, you pay). A third-party providerId is not broadcastable.');
37
36
  }
38
- // Buyer-broadcast: the claimer works, your side pays — an open quest.
37
+ // Buyer-broadcast: the claimer works, your side pays — an open request.
39
38
  const agreement = await proposeBroadcast({
40
39
  ...terms,
41
40
  chatId: chatId ?? '',
42
41
  engagementKind: engagementKind ?? 'service',
43
42
  audience,
44
43
  }, creds);
45
- return { agreement, shape: 'quest' };
44
+ return { agreement, shape: 'request' };
46
45
  }
47
46
  if (!chatId)
48
47
  throw new Error('chatId is required on a direct proposal');
@@ -56,7 +55,7 @@ export async function proposeUnified(input, creds) {
56
55
  return { agreement, shape: 'direct' };
57
56
  }
58
57
  /**
59
- * one claim verb for any open broadcast: link invite, quest,
58
+ * one claim verb for any open broadcast: link invite, request,
60
59
  * hand-off, or standing offer.
61
60
  *
62
61
  * One request. This used to read the agreement first to decide which endpoint to
@@ -74,6 +73,6 @@ export async function claimOpenAgreement(agreementId, creds) {
74
73
  throw new Error('agreementId is required');
75
74
  const { agreement, kind } = await claimAgreement(agreementId, creds);
76
75
  // A server that has not shipped the `kind` field yet still claims correctly;
77
- // 'quest' is the shape the route has always handled.
78
- return { agreement, kind: kind ?? 'quest' };
76
+ // 'request' is the shape the route has always handled.
77
+ return { agreement, kind: kind ?? 'request' };
79
78
  }
@@ -11,6 +11,23 @@
11
11
  * watermark are presented as `temporal` / `watermark_at` caveats.
12
12
  */
13
13
  export type GrantHealth = 'active' | 'expired' | 'revoked';
14
+ /**
15
+ * Who holds a grant. Declared at issuance and carried on the row — nothing
16
+ * about an id says what it names. An `org` holder is how one grant covers every
17
+ * member of that organization.
18
+ */
19
+ export type GrantHolderKind = 'user' | 'org' | 'agent';
20
+ /**
21
+ * What a grant lets its holder do. `write` implies `read`, `admit` implies
22
+ * both: `read` sees the scope, `write` takes part in it, `admit` brings others
23
+ * in as well.
24
+ */
25
+ export type GrantAccessKind = 'read' | 'write' | 'admit';
26
+ /**
27
+ * The kind of principal-authored consent object a grant rests on. Every grant
28
+ * is minted by one of these, or delegated from a parent grant that was.
29
+ */
30
+ export type GrantBasisKind = 'creation' | 'publication' | 'membership' | 'acceptance' | 'agreement';
14
31
  /**
15
32
  * The context rail's scope kinds, as VALUES — the type below is derived from
16
33
  * them, so widening the rail is one edit rather than a type change plus however
@@ -51,6 +68,17 @@ export interface GrantView {
51
68
  /** ISO-8601. */
52
69
  createdAt: string;
53
70
  health: GrantHealth;
71
+ /**
72
+ * What the holder is, what the grant lets them do, and which consent object
73
+ * authorized it. Present on rails that record them (context grants do);
74
+ * absent means the rail does not say, not that there is nothing.
75
+ */
76
+ holderKind?: GrantHolderKind;
77
+ access?: GrantAccessKind;
78
+ basis?: {
79
+ kind: GrantBasisKind;
80
+ id: string | null;
81
+ };
54
82
  }
55
83
  /** Value of the first caveat of `type` on a grant, or undefined. */
56
84
  export declare function grantCaveat(grant: GrantView, type: string): unknown | undefined;
@@ -8,7 +8,7 @@ export type { ListMessagesOptions, ListMessagesResult } from './MessagesClient.j
8
8
  export { ArtifactsClient, artifactScopeForSession, AGREEMENT_LANE_PREFIX, ARTIFACT_INLINE_TEXT_MAX_CHARS, ARTIFACT_INLINE_TEXT_OVER_LIMIT_HINT, } from './ArtifactsClient.js';
9
9
  export type { ArtifactVisibility, ListArtifactsOptions, ListArtifactsQuery, ListArtifactsResult, WriteArtifactInput, } from './ArtifactsClient.js';
10
10
  export { ContextReadClient, CONTEXT_READ_TYPES, CONTEXT_READ_VIA, VIA_KINDS, parseVia, viaHint, } from './ContextReadClient.js';
11
- export type { ContextReadType, ContextReadQuery, ContextReadEnvelope, ContextSnapshotResult, ViaKind, } from './ContextReadClient.js';
11
+ export type { ContextReadType, ContextReadQuery, ContextReadEnvelope, ContextSnapshotResult, ContextSnapshotParticipant, ViaKind, } from './ContextReadClient.js';
12
12
  export { ContextDiscoveryClient } from './ContextDiscoveryClient.js';
13
13
  export type { DiscoverableItem } from './ContextDiscoveryClient.js';
14
14
  export { GrantsClient } from './GrantsClient.js';
@@ -16,7 +16,7 @@ export type { ListGrantsQuery, ListGrantsResult, UnreadableRail } from './Grants
16
16
  export { ContextGrantsClient } from './ContextGrantsClient.js';
17
17
  export type { ContextGrantRecord, ContextGrantScope, ContextGrantScopeKind, ContextTemporal, IssueContextGrantInput, DelegateContextGrantInput, DelegateContextGrantResult, ReachEntry, GrantReachResult, } from './ContextGrantsClient.js';
18
18
  export { grantCaveat, CONTEXT_GRANT_SCOPE_KINDS, GRANT_SCOPE_KINDS, } from './grants.js';
19
- export type { GrantView, GrantScopeKind, GrantScopeView, GrantCaveatView, GrantHealth, } from './grants.js';
19
+ export type { GrantView, GrantScopeKind, GrantScopeView, GrantCaveatView, GrantHealth, GrantHolderKind, GrantAccessKind, GrantBasisKind, } from './grants.js';
20
20
  export { PaymentsClient } from './PaymentsClient.js';
21
21
  export type { PaymentsError, WalletBalance, WalletRef, PaymentTransactionView, TransferResult, HoldResult, ReleaseResult, PaymentGrantView, PaymentGrantEnvelope, RevokeGrantResult, PaymentApproval, WaitForApprovalResult, } from './PaymentsClient.js';
22
22
  export { ConnectionsClient, assertNoLeakedConnectionSecret, } from './ConnectionsClient.js';
package/dist/index.d.ts CHANGED
@@ -11,5 +11,5 @@ export { runtimeLog, resetRuntimeLogLevelCache } from './shared/runtimeLog.js';
11
11
  export { RateLimitedError, isRateLimited, parseRetryAfterMs, pollSurfaceError, } from './shared/rateLimit.js';
12
12
  export { parseErrorMessage, parseErrorCode, throwApiError, } from './shared/apiError.js';
13
13
  export { ApiError } from './types.js';
14
- export type { Creds, Task, TaskState, PlanStep, PlanStepStatus, Agreement, EngagementKind, BroadcastAudience, EntryType, ContentType, MessageMetadata, MessageHandler, InboxDeliveryKind, InboxDeliveryRef, InboxChatNews, InboxProposalRef, InboxTaskRef, InboxQuestRef, InboxConnectionRequestRef, InboxHumanAttention, InboxEnvelope, InboxAckResult, InboxReadOptions, } from './types.js';
14
+ export type { Creds, Task, TaskState, PlanStep, PlanStepStatus, Agreement, EngagementKind, BroadcastAudience, EntryType, ContentType, MessageMetadata, MessageHandler, InboxDeliveryKind, InboxDeliveryRef, InboxChatNews, InboxProposalRef, InboxTaskRef, InboxRequestRef, InboxConnectionRequestRef, InboxHumanAttention, InboxEnvelope, InboxAckResult, InboxReadOptions, } from './types.js';
15
15
  export type { ProposeTerms, ProposeDirectInput, ProposeBroadcastInput, ProposeAgreementData, } from './http/AgreementClient.js';
package/dist/types.d.ts CHANGED
@@ -27,7 +27,8 @@ export interface Creds {
27
27
  *
28
28
  * The operator key says WHO is calling; this says ON WHOSE BEHALF, RIGHT NOW.
29
29
  * Without it an agent serving several customers carries its full authority
30
- * into every call, and one tool call reaches another customer's work.
30
+ * into every call, so a read spans every engagement it holds rather than
31
+ * staying inside the one being worked.
31
32
  *
32
33
  * Optional, and omitting it can only narrow what comes back (the backend
33
34
  * falls back to the agent's own org) — never widen it. Nothing here is
@@ -46,6 +47,13 @@ export interface PlanStep {
46
47
  export interface Task {
47
48
  taskId: string;
48
49
  description: string;
50
+ /**
51
+ * Short row label. The backend always resolves it — falling back
52
+ * to a trimmed description for tasks that never set one — so render it
53
+ * unconditionally instead of re-deriving the fallback. Optional here only
54
+ * because a server predating the field omits it.
55
+ */
56
+ title?: string;
49
57
  agentId?: string;
50
58
  executorId?: string;
51
59
  payerId?: string;
@@ -75,7 +83,7 @@ export interface Task {
75
83
  }
76
84
  export type AgreementStatus = 'pending' | 'active' | 'fulfilled' | 'cancelled' | 'rejected' | (string & {});
77
85
  export type ProposalStatus = 'pending' | 'approved' | 'rejected' | 'countered' | 'expired' | (string & {});
78
- /** ⚠️ SYNC: backend src/agreements/agreements.constants.ts AGREEMENT_ENGAGEMENT_KIND */
86
+ /** ⚠️ Mirrors the server's engagement-kind constant; the server is authoritative. */
79
87
  export declare const AGREEMENT_ENGAGEMENT_KIND: {
80
88
  readonly HIRE: "hire";
81
89
  readonly SERVICE: "service";
@@ -152,7 +160,7 @@ export interface Agreement {
152
160
  createdAt?: string;
153
161
  updatedAt?: string;
154
162
  }
155
- /** ⚠️ SYNC: Keep in sync with backend src/chat/chat.types.ts ENTRY_TYPE */
163
+ /** ⚠️ Mirrors the server's entry-type constant; the server is authoritative. */
156
164
  export declare const EntryTypes: {
157
165
  readonly MESSAGE: "message";
158
166
  readonly NOTIFICATION: "notification";
@@ -162,7 +170,7 @@ export declare const EntryTypes: {
162
170
  readonly TASK_HISTORY: "task_history";
163
171
  };
164
172
  export type EntryType = (typeof EntryTypes)[keyof typeof EntryTypes];
165
- /** ⚠️ SYNC: Keep in sync with backend src/chat/chat.types.ts CONTENT_TYPE */
173
+ /** ⚠️ Mirrors the server's content-type constant; the server is authoritative. */
166
174
  export declare const ContentTypes: {
167
175
  readonly TEXT: "text";
168
176
  readonly OPERATION: "operation";
@@ -176,11 +184,11 @@ export declare const ContentTypes: {
176
184
  readonly TASK_UPDATE: "task_update";
177
185
  };
178
186
  export type ContentType = (typeof ContentTypes)[keyof typeof ContentTypes];
179
- /** ⚠️ SYNC: Mirrors backend src/chat/chat.types.ts isValidContentType */
187
+ /** ⚠️ Mirrors the server's entry/content-type validation; the server is authoritative. */
180
188
  export declare function isValidContentType(contentType: string, entryType: string): boolean;
181
- /** ⚠️ SYNC: Keep in sync with backend agreements.constants.ts. Fully-public broadcast sentinel. */
189
+ /** ⚠️ Mirrors the server's sentinel. Fully-public broadcast target. */
182
190
  export declare const OPEN_AGREEMENT_TARGET: "everyone";
183
- /** ⚠️ SYNC: backend ORG_AGREEMENT_TARGET. Org-scoped broadcast: visible/claimable only by members of the agreement's orgId. */
191
+ /** ⚠️ Mirrors the server's sentinel. Org-scoped broadcast: visible/claimable only by members of the agreement's orgId. */
184
192
  export declare const ORG_AGREEMENT_TARGET: "org";
185
193
  /** Audience for a broadcast proposal: fully public ('everyone') or org-scoped ('org'). */
186
194
  export type BroadcastAudience = typeof OPEN_AGREEMENT_TARGET | typeof ORG_AGREEMENT_TARGET;
@@ -279,14 +287,34 @@ export type MessageHandler = (text: string, metadata: MessageMetadata) => Promis
279
287
  * on this side validates a delivery kind at runtime (the server does that on the
280
288
  * way in), and exhaustiveness checking is purely type-level.
281
289
  */
282
- export type InboxDeliveryKind = 'message' | 'artifact' | 'task-state' | 'agreement' | 'quest';
290
+ export type InboxDeliveryKind = 'message' | 'artifact' | 'task-state' | 'agreement' | 'request';
291
+ /** The two mailbox owners. Agents own no mailbox — they read through grants. */
292
+ export type InboxPartyKind = 'human' | 'org';
293
+ /** One mailbox this reader's merged view includes. */
294
+ export interface InboxSourceRef {
295
+ partyId: string;
296
+ partyKind: InboxPartyKind;
297
+ }
283
298
  /**
284
- * One thing addressed to this agent. A reference, never content — following it
285
- * (a chat read, a task read) is where this agent's grants are enforced.
299
+ * One row in this reader's merged view. A reference, never content — following
300
+ * it (a chat read, a task read) is where this agent's grants are enforced.
301
+ *
302
+ * "Mine to act on" is `assigneeId === my agent id`, nothing else. A row
303
+ * without my stamp is context I may read, never a wake and never mine to ack
304
+ * as handled.
286
305
  */
287
306
  export interface InboxDeliveryRef {
288
307
  kind: InboxDeliveryKind;
289
308
  resourceId: string;
309
+ /** One emit, one id — copies of the same event collapse on this. */
310
+ eventId: string;
311
+ /** The mailbox this copy lives in. */
312
+ partyId: string;
313
+ partyKind: InboxPartyKind;
314
+ /** The ONE agent stamped to act; null when nothing has to. */
315
+ assigneeId: string | null;
316
+ /** The owner's human should see this. */
317
+ needsHuman: boolean;
290
318
  chatId: string | null;
291
319
  agreementId: string | null;
292
320
  taskId: string | null;
@@ -369,10 +397,10 @@ export interface InboxTaskRef {
369
397
  updatedAt: string | null;
370
398
  }
371
399
  /**
372
- * A marketplace quest doorbell. Own channel so the host can
400
+ * A marketplace request doorbell. Own channel so the host can
373
401
  * exact-match triage with zero LLM tokens before any wake.
374
402
  */
375
- export interface InboxQuestRef {
403
+ export interface InboxRequestRef {
376
404
  agreementId: string;
377
405
  /** Exact-match string from the publisher — compare to the agent's tags. */
378
406
  match: string;
@@ -382,27 +410,36 @@ export interface InboxQuestRef {
382
410
  export interface InboxEnvelope {
383
411
  asOf: string;
384
412
  /**
385
- * Unacked deliveries addressed to this agent, newest first. This IS the
386
- * inbox — read straight out of the delivery log, not derived from grants.
413
+ * The mailboxes this reader's view merges — its owner's, plus whatever
414
+ * inbox grants add. Absent on older servers.
415
+ */
416
+ sources?: InboxSourceRef[];
417
+ /**
418
+ * Unacked rows across every source, newest first, copies of one event
419
+ * collapsed. This IS the inbox — read straight out of the party delivery
420
+ * logs, not derived from grants. Rows with `assigneeId === me` are mine to
421
+ * act on; the rest are readable context.
387
422
  */
388
423
  deliveries: InboxDeliveryRef[];
389
424
  /** True when there was more than one envelope's worth; the rest stay unacked. */
390
425
  deliveriesCapped: boolean;
391
- /** The chat-bearing deliveries above, folded by chat. */
426
+ /** This agent's ASSIGNED chat mail, folded by chat. */
392
427
  chats: InboxChatNews[];
393
428
  /**
394
- * Pass to `ack(upTo, { handledResourceIds })` after acting (ZIG-1305).
395
- * Null when there is nothing to ack. Ack after acting, not after reading:
396
- * a crash in between redelivers. Listing every handled resourceId is what
397
- * stops a partial triage from burying other chats.
429
+ * Opaque watermark bundle. Pass to `ack(upTo, { handledResourceIds })`
430
+ * VERBATIM after acting — never construct or parse one; the per-mailbox
431
+ * positions live inside the value. Null when there is nothing to ack. Ack
432
+ * after acting, not after reading: a crash in between redelivers. Listing
433
+ * every ASSIGNED resourceId is what stops a partial triage from burying
434
+ * work.
398
435
  */
399
436
  ackTo: string | null;
400
437
  /** Open tasks assigned to this agent — the work channel. */
401
438
  tasksAwaitingMe: InboxTaskRef[];
402
439
  truncatedTasks: number;
403
- /** Unacked quest deliveries — triaged before any LLM wake. */
404
- questsAwaitingMe?: InboxQuestRef[];
405
- truncatedQuests?: number;
440
+ /** Unacked request deliveries — triaged before any LLM wake. */
441
+ requestsAwaitingMe?: InboxRequestRef[];
442
+ truncatedRequests?: number;
406
443
  proposalsAwaitingMe: InboxProposalRef[];
407
444
  truncatedProposals: number;
408
445
  connectionRequestsAwaitingMe: InboxConnectionRequestRef[];
package/dist/types.js CHANGED
@@ -27,14 +27,14 @@ export class RateLimitedError extends ApiError {
27
27
  this.retryAfterMs = retryAfterMs;
28
28
  }
29
29
  }
30
- /** ⚠️ SYNC: backend src/agreements/agreements.constants.ts AGREEMENT_ENGAGEMENT_KIND */
30
+ /** ⚠️ Mirrors the server's engagement-kind constant; the server is authoritative. */
31
31
  export const AGREEMENT_ENGAGEMENT_KIND = {
32
32
  HIRE: 'hire',
33
33
  SERVICE: 'service',
34
34
  /** a bilateral reach link between two agents (no money, no work). */
35
35
  LINK: 'link',
36
36
  };
37
- /** ⚠️ SYNC: Keep in sync with backend src/chat/chat.types.ts ENTRY_TYPE */
37
+ /** ⚠️ Mirrors the server's entry-type constant; the server is authoritative. */
38
38
  export const EntryTypes = {
39
39
  MESSAGE: 'message',
40
40
  NOTIFICATION: 'notification',
@@ -43,7 +43,7 @@ export const EntryTypes = {
43
43
  /** @deprecated legacy alias for AGREEMENT_HISTORY */
44
44
  TASK_HISTORY: 'task_history',
45
45
  };
46
- /** ⚠️ SYNC: Keep in sync with backend src/chat/chat.types.ts CONTENT_TYPE */
46
+ /** ⚠️ Mirrors the server's content-type constant; the server is authoritative. */
47
47
  export const ContentTypes = {
48
48
  TEXT: 'text',
49
49
  OPERATION: 'operation',
@@ -63,13 +63,13 @@ const VALID_CONTENT_TYPES = {
63
63
  [EntryTypes.AGREEMENT_HISTORY]: [ContentTypes.AGREEMENT_UPDATE, ContentTypes.TASK_UPDATE],
64
64
  [EntryTypes.TASK_HISTORY]: [ContentTypes.AGREEMENT_UPDATE, ContentTypes.TASK_UPDATE],
65
65
  };
66
- /** ⚠️ SYNC: Mirrors backend src/chat/chat.types.ts isValidContentType */
66
+ /** ⚠️ Mirrors the server's entry/content-type validation; the server is authoritative. */
67
67
  export function isValidContentType(contentType, entryType) {
68
68
  return VALID_CONTENT_TYPES[entryType]?.includes(contentType) ?? false;
69
69
  }
70
- /** ⚠️ SYNC: Keep in sync with backend agreements.constants.ts. Fully-public broadcast sentinel. */
70
+ /** ⚠️ Mirrors the server's sentinel. Fully-public broadcast target. */
71
71
  export const OPEN_AGREEMENT_TARGET = 'everyone';
72
- /** ⚠️ SYNC: backend ORG_AGREEMENT_TARGET. Org-scoped broadcast: visible/claimable only by members of the agreement's orgId. */
72
+ /** ⚠️ Mirrors the server's sentinel. Org-scoped broadcast: visible/claimable only by members of the agreement's orgId. */
73
73
  export const ORG_AGREEMENT_TARGET = 'org';
74
74
  /** Both broadcast sentinels — values that occupy a party slot but are NOT real principal ids. */
75
75
  export const BROADCAST_TARGETS = [OPEN_AGREEMENT_TARGET, ORG_AGREEMENT_TARGET];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggs-ai/api-client",
3
- "version": "0.10.3",
3
+ "version": "0.11.0",
4
4
  "description": "HTTP and WebSocket client for the Ziggs backend API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",