@ziggs-ai/api-client 0.42.7 → 0.42.9

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/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.42.9
6
+
7
+ - `bucket_send` with `page` says that a page sent as a reply is the page's new version, and only the page's side may send one.
8
+
9
+ - `message_send` and `bucket_send` say what a reply that names someone new to its thread does: it shares the earlier messages your side wrote there with them, and asks each other writer to share theirs.
10
+
11
+ - `task_create` that hands work and files from a parent task to another hire now waits on the same cards as `task_delegate` when that hire cannot read the files yet. `HeldTaskCreate.handOver` can be the card list.
12
+
13
+ - `delegateTask` can return a `HeldDelegation` (`status: 'pending_approval'`): the hand-over waits on one card per approver, and the server makes the child after the last yes. The `task_delegate` description says so.
14
+
15
+ ## 0.42.8
16
+
17
+ - `bucket_send` with `replyTo`: the reply is read by the bucket's people and by those who read the message it answers and have it in a bucket of theirs. Someone with no bucket for the chat is no longer written to from a bucket they are not in; telling them is refused (409 `NOT_IN_THIS_BUCKET`, with who), and adding them to the bucket is how. Work under an agreement goes into a bucket only with the agreement's other side in it (409 `WORK_SIDE_NOT_IN_BUCKET`, with who to add). `BucketContents.agreements` no longer carries `missing`.
18
+
5
19
  ## 0.42.7
6
20
 
7
21
  - `passTaskOn(taskId, assigneeId)` and the `task_pass_on` capability pass live work on (`PUT /tasks/:taskId/assignee`): someone else becomes the assignee, so only they can finish it. Whoever works the task, or whoever opened it, may pass it on; the new assignee must be able to work under the task's agreement. The agreement stays the same.
@@ -237,7 +237,7 @@ export const bucketSendCapability = {
237
237
  names: { sdk: 'bucket_send', mcp: 'ziggs_bucket_send' },
238
238
  title: 'Send in a bucket',
239
239
  descriptions: {
240
- sdk: "Send a message inside a bucket. Its readers are the bucket's people; with replyTo, also everyone who read the message it answers. Name recipients among the readers. To reach anyone else, add them with bucket_add_members first. A request wakes the agents it is delivered to. With page, the message carries an HTML page: its thread shows as that page.",
240
+ sdk: "Send a message inside a bucket. Its readers are the bucket's people; with replyTo, also readers of the answered message who have it in a bucket. A reply that reaches someone new to its thread also shares the earlier messages your side wrote there with them, and asks each other writer to share theirs. Name recipients among the readers. To reach anyone else, add them with bucket_add_members first. A request wakes the agents it is delivered to. With page, the message carries an HTML page: its thread shows as that page.",
241
241
  },
242
242
  annotation: 'destructive',
243
243
  needsAgentId: true,
@@ -246,7 +246,7 @@ export const bucketSendCapability = {
246
246
  text: { type: 'string', required: true },
247
247
  page: {
248
248
  type: 'string',
249
- description: "A full HTML document (<!DOCTYPE html>), saved as a file that goes with the message. Without replyTo it starts a thread of its own, shown as the page; with replyTo that page's first message, it replaces that page.",
249
+ description: "A full HTML document (<!DOCTYPE html>), saved as a file that goes with the message. Without replyTo it starts a thread of its own, shown as the page; with replyTo that page's first message, it is its new version (the page's side only).",
250
250
  },
251
251
  pageName: { type: 'string', description: 'Short, stable name of the page.' },
252
252
  recipients: {
@@ -19,7 +19,7 @@ export const MESSAGE_COMMAND_PARAM = { type: 'object', required: true, propertie
19
19
  sources: { type: 'array', items: { type: 'object' } },
20
20
  page: { type: 'object' },
21
21
  } };
22
- export const sendMessageCapability = { key: 'message_send', names: { sdk: 'message_send', mcp: 'ziggs_message_send' }, title: 'Send message', descriptions: { sdk: 'Send the canonical command: operationId; content:{text}; audience:{kind:"explicit",principalIds:[...]}; deliveries:{kind:"explicit",principalIds:[...]}; intent:"fyi" or "request". A request wakes the agents it is delivered to; an fyi is delivered and filed, never woken on. Nothing records whether a request was answered: a reply is a message with relationships.replyToMessageId. Optional mandate:{agreementId,taskId}, relationships:{replyToMessageId,taskIds,artifacts}, exact sources. Send first messages and replies directly; no bucket is required. Buckets optionally organize messages and do not determine access on this route. Reuse operationId unchanged on retry. Refused with "Nothing authorizes giving … access to this message" means you have no contact basis for that reader (membership, a link, an agreement or a listing): ask its owner with access_request scopeKind=contact and scopeId=that reader, then send once they approve.' }, annotation: 'destructive', needsAgentId: true, params: { command: MESSAGE_COMMAND_PARAM }, handler: (args, env) => client(env).send(args.command) };
22
+ export const sendMessageCapability = { key: 'message_send', names: { sdk: 'message_send', mcp: 'ziggs_message_send' }, title: 'Send message', descriptions: { sdk: 'Send the canonical command: operationId; content:{text}; audience:{kind:"explicit",principalIds:[...]}; deliveries:{kind:"explicit",principalIds:[...]}; intent:"fyi" or "request". A request wakes the agents it is delivered to; an fyi is delivered and filed, never woken on. Nothing records whether a request was answered: a reply is a message with relationships.replyToMessageId. Optional mandate:{agreementId,taskId}, relationships:{replyToMessageId,taskIds,artifacts}, exact sources. Send first messages and replies directly; no bucket is required. A reply that names a reader new to its thread also shares the earlier messages your side wrote there with them, and asks each other writer in it to share theirs; those stay closed to the new reader until that writer says yes. Buckets optionally organize messages and do not determine access on this route. Reuse operationId unchanged on retry. Refused with "Nothing authorizes giving … access to this message" means you have no contact basis for that reader (membership, a link, an agreement or a listing): ask its owner with access_request scopeKind=contact and scopeId=that reader, then send once they approve.' }, annotation: 'destructive', needsAgentId: true, params: { command: MESSAGE_COMMAND_PARAM }, handler: (args, env) => client(env).send(args.command) };
23
23
  export const readRepliesCapability = { key: 'message_replies', names: { sdk: 'message_replies', mcp: 'ziggs_message_replies' }, title: 'Read replies', descriptions: { sdk: 'Read currently authorized causal replies; links never grant access. Continue using nextCursor as before.' }, annotation: 'read-only', needsAgentId: true, params: { messageId: { type: 'string', required: true }, before: { type: 'string' }, limit: { type: 'number' } }, handler: (args, env) => client(env).replies(String(args.messageId), { before: args.before, limit: args.limit }) };
24
24
  export const queryMessagesCapability = { key: 'message_list', names: { sdk: 'message_list', mcp: 'ziggs_message_list' }, title: 'Query messages', descriptions: { sdk: 'Query authorized messages. Use conversationOf with an exact message id to browse messages connected by readable reply relationships; use nextCursor as before for earlier turns. Select conversationOf independently of agreementId, taskId or participantIds. History never selects authority.' }, annotation: 'read-only', needsAgentId: true, params: { conversationOf: { type: 'string', description: 'Authorized anchor message; follows readable causal links, never a reader roster. Each result still requires read access and any execution input authorization.' }, q: { type: 'string' }, senderId: { type: 'string' }, recipientIds: { type: 'array', items: { type: 'string' } }, agreementId: { type: 'string' }, taskId: { type: 'string' }, participantIds: { type: 'array', items: { type: 'string' } }, before: { type: 'string' }, limit: { type: 'number' } }, handler: (args, env) => client(env).list(args) };
25
25
  export const messageControlsCapability = { key: 'message_controls', names: { sdk: 'message_controls', mcp: 'ziggs_message_controls' }, title: 'Inspect message mandate', descriptions: { sdk: 'Discover recipients and current authority under an explicitly selected agreement/task without reading message history.' }, annotation: 'read-only', needsAgentId: true, params: { q: { type: 'string' }, senderId: { type: 'string' }, recipientIds: { type: 'array', items: { type: 'string' } }, agreementId: { type: 'string', required: true }, taskId: { type: 'string' } }, handler: (args, env) => client(env).controls(String(args.agreementId), args.taskId) };
@@ -213,7 +213,7 @@ export const delegateTaskCapability = {
213
213
  key: 'task_delegate',
214
214
  names: { sdk: 'task_delegate', mcp: 'ziggs_task_delegate' },
215
215
  title: 'Delegate work',
216
- descriptions: { sdk: 'Create an isolated child from approved instruction and input artifacts; return a completed child output after consent for the parent; or recheck readiness after approval. Keep the source execution selected. Child completion does not deliver its private result or model state. Use access_request for missing contribution consent. Recurses through ordinary tasks.' },
216
+ descriptions: { sdk: 'Create an isolated child from approved instruction and input artifacts; return a completed child output after consent for the parent; or recheck readiness after approval. Keep the source execution selected. Child completion does not deliver its private result or model state. On create, if the destination cannot read a file yet, the call answers pending_approval: the server sent one card to each person who must say yes, and makes the child after the last yes. Do not call again or file access requests for those files. Recurses through ordinary tasks.' },
217
217
  annotation: 'destructive',
218
218
  needsAgentId: true,
219
219
  params: {
@@ -106,12 +106,11 @@ export interface BucketContents {
106
106
  title: string;
107
107
  state: string;
108
108
  }>;
109
- /** The agreements the work here is under, worked out from the work; `missing`: sides not in the bucket. */
109
+ /** The agreements the work here is under, worked out from the work. A chat brought in comes without its agreement. */
110
110
  agreements: Array<{
111
111
  agreementId: string;
112
112
  title: string;
113
113
  status: string;
114
- missing: string[];
115
114
  }>;
116
115
  /** Hires waiting for a yes whose people come in here when they start. */
117
116
  invites: Array<{
@@ -124,7 +123,8 @@ export interface BucketContents {
124
123
  }
125
124
  /**
126
125
  * A message sent inside a bucket: its readers are the bucket's people, and for
127
- * a reply that names the message it answers, everyone who read that message.
126
+ * a reply that names the message it answers, those who read that message and
127
+ * have it in a bucket of theirs. Work goes in only with its other side here.
128
128
  * `page` is the HTML file it carries, by its exact version (contracts 0.49).
129
129
  */
130
130
  export type BucketMessage = Omit<MessageCommand, 'audience'> & {
@@ -145,10 +145,14 @@ export interface CreateTaskCheckBackData {
145
145
  */
146
146
  export interface HeldTaskCreate {
147
147
  status: 'pending_approval';
148
+ /**
149
+ * One card to the agent's owner, or, when the task hands files to another
150
+ * hire that cannot read them yet, one card per person who must say yes.
151
+ */
148
152
  handOver: {
149
153
  agreementId: string;
150
154
  approverId: string;
151
- };
155
+ } | HeldDelegation['handOver'];
152
156
  message: string;
153
157
  }
154
158
  export declare function isHeldTaskCreate(value: unknown): value is HeldTaskCreate;
@@ -293,6 +297,22 @@ export declare class TaskClient {
293
297
  countTasks(filters?: CountTasksFilters): Promise<number>;
294
298
  }
295
299
  /** Controlled work transfer; the source execution header is preserved. */
300
+ /**
301
+ * A delegation the destination cannot read yet: it waits on one card per
302
+ * person who must say yes, and the server makes the child after the last.
303
+ */
304
+ export interface HeldDelegation {
305
+ status: 'pending_approval';
306
+ handOver: {
307
+ handOverId: string;
308
+ cards: Array<{
309
+ agreementId: string;
310
+ approverId: string;
311
+ artifactIds: string[];
312
+ }>;
313
+ };
314
+ message: string;
315
+ }
296
316
  export declare function delegateTask(taskId: string, body: {
297
317
  agreementId: string;
298
318
  assigneeId: string;
@@ -303,7 +323,7 @@ export declare function delegateTask(taskId: string, body: {
303
323
  taskId: string;
304
324
  agreementId: string;
305
325
  parentTaskId: string;
306
- }>;
326
+ } | HeldDelegation>;
307
327
  export declare function returnTaskResult(taskId: string, artifactId: string, creds: Creds): Promise<{
308
328
  taskId: string;
309
329
  parentTaskId: string;
@@ -514,7 +514,6 @@ export class TaskClient {
514
514
  listTasks(options) { return listTasks(options ?? {}, this.creds); }
515
515
  countTasks(filters) { return countTasks(filters, this.creds); }
516
516
  }
517
- /** Controlled work transfer; the source execution header is preserved. */
518
517
  export async function delegateTask(taskId, body, creds) {
519
518
  const { idempotencyKey, ...payload } = body;
520
519
  return taskTransfer(taskId, 'delegations', payload, creds, idempotencyKey);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggs-ai/api-client",
3
- "version": "0.42.7",
3
+ "version": "0.42.9",
4
4
  "description": "HTTP and WebSocket client for the Ziggs backend API",
5
5
  "homepage": "https://ziggsai.com/docs",
6
6
  "bugs": {
@@ -31,7 +31,7 @@
31
31
  "test:watch": "node --import tsx/esm --test --watch test/*.test.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@ziggs-ai/contracts": "0.50.1",
34
+ "@ziggs-ai/contracts": "0.50.4",
35
35
  "socket.io-client": "^4.7.0"
36
36
  },
37
37
  "keywords": [