@ziggs-ai/api-client 0.42.19 → 0.42.21

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,19 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.42.21
6
+
7
+ - `page` posts a page: a live view, tracker or form, in a bucket (`bucketId`) or to the people it is for (`to`); `replaces` posts a new version. `page_guide` stays the read-only how-to.
8
+ - `bucket_send` and `message_send` no longer take `page`, `pageName` or `forms`. Post a page with `page`. `formEntry` (answering a page's form) stays on both.
9
+ - `task_create` children take `agreementId` as optional, like the task itself. The tool text says who can be given a task without one.
10
+ - `task_pass_on` says a task under no agreement goes to a teammate or an agent you run.
11
+ - `AssistantConnectionClient.roster()` returns the connection's workspaces and the person it is for.
12
+ - `people` finds teammates by name, with the id a task or a message needs.
13
+
14
+ ## 0.42.20
15
+
16
+ - `access_request` takes its `scopeKind` list from `@ziggs-ai/contracts` `ACCESS_REQUEST_SCOPE_KINDS`, and passes `connectionTools` (a connection) and `spendingMaxAmount` (a wallet, hundredths of a point) through.
17
+
5
18
  ## 0.42.19
6
19
 
7
20
  - Taking a grant back uses `DELETE /grants/:grantId`.
@@ -8,6 +8,13 @@ export declare const bucketDuplicateCapability: CapabilityDefinition;
8
8
  export declare const bucketAddMembersCapability: CapabilityDefinition;
9
9
  export declare const bucketJoinCapability: CapabilityDefinition;
10
10
  export declare const bucketSendCapability: CapabilityDefinition;
11
+ /**
12
+ * A page: a thread shown as HTML instead of messages. Its own tool, so an
13
+ * agent asked for a view, a tracker or a form finds it by name. How to write
14
+ * one is the read-only page_guide; this posts it, in a bucket or straight to
15
+ * the people it is for, and posts its new versions.
16
+ */
17
+ export declare const pageCapability: CapabilityDefinition;
11
18
  export declare const bucketRemoveMemberCapability: CapabilityDefinition;
12
19
  export declare const bucketRenameCapability: CapabilityDefinition;
13
20
  export declare const bucketDeleteCapability: CapabilityDefinition;
@@ -1,5 +1,6 @@
1
1
  import { BucketsClient, BUCKET_ITEM_KINDS, } from '../http/BucketsClient.js';
2
2
  import { ArtifactsClient } from '../http/ArtifactsClient.js';
3
+ import { MessageRecordsClient } from '../http/MessageRecordsClient.js';
3
4
  import { fullCreds, rethrowWithContext } from './types.js';
4
5
  import { pageGuideCapability } from './pageGuide.js';
5
6
  /**
@@ -32,6 +33,7 @@ const SHARE = {
32
33
  type: 'boolean',
33
34
  description: 'Share misfits first.',
34
35
  };
36
+ const FORMS = { type: 'array', description: 'The page\'s forms, fields and choices.', items: { type: 'object', required: ['name', 'fields'], properties: { name: { type: 'string' }, fields: { type: 'array', items: { type: 'object', properties: { name: { type: 'string' }, label: { type: 'string' }, choices: { type: 'array', items: { type: 'string' } }, freeText: { type: 'boolean' } } } } } } };
35
37
  const AUDIENCE = {
36
38
  type: 'array',
37
39
  description: 'Other person, agent or workspace ids.',
@@ -238,19 +240,13 @@ export const bucketSendCapability = {
238
240
  names: { sdk: 'bucket_send', mcp: 'ziggs_bucket_send' },
239
241
  title: 'Send in a bucket',
240
242
  descriptions: {
241
- 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.",
243
+ 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. A page is made with page.",
242
244
  },
243
245
  annotation: 'destructive',
244
246
  needsAgentId: true,
245
247
  params: {
246
248
  bucketId: BUCKET_ID,
247
249
  text: { type: 'string', required: true },
248
- page: {
249
- type: 'string',
250
- description: "Read page_guide (MCP: ziggs_page_guide) before writing a page. 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).",
251
- },
252
- pageName: { type: 'string', description: 'Short, stable name of the page.' },
253
- forms: { type: 'array', description: 'With page: the page\'s forms, fields and choices.', items: { type: 'object', required: ['name', 'fields'], properties: { name: { type: 'string' }, fields: { type: 'array', items: { type: 'object', properties: { name: { type: 'string' }, label: { type: 'string' }, choices: { type: 'array', items: { type: 'string' } }, freeText: { type: 'boolean' } } } } } } },
254
250
  formEntry: { type: 'object', description: 'Reply to the page version filled; goes to its poster.', properties: { form: { type: 'string', required: true }, fields: { type: 'object' } } },
255
251
  recipients: {
256
252
  type: 'array',
@@ -258,7 +254,7 @@ export const bucketSendCapability = {
258
254
  description: 'Who is told, among the readers. Under work, name at least one person the work is with.',
259
255
  },
260
256
  intent: { type: 'string', enum: ['fyi', 'request'] },
261
- replyTo: { type: 'string', description: 'The message this answers. Not for a new page.' },
257
+ replyTo: { type: 'string', description: 'The message this answers.' },
262
258
  operationId: { type: 'string', description: 'Reuse on retry.' },
263
259
  agreementId: {
264
260
  type: 'string',
@@ -278,22 +274,74 @@ export const bucketSendCapability = {
278
274
  throw new Error('replyTo is a message id');
279
275
  const named = args['operationId'];
280
276
  const operationId = typeof named === 'string' && named.trim() ? named.trim() : `bucket-send-${globalThis.crypto.randomUUID()}`;
281
- const page = await pageOf(args, env, operationId);
282
- const sent = await client(env).sendMessage(bucketId(args), {
277
+ return client(env).sendMessage(bucketId(args), {
283
278
  operationId,
284
279
  content: { text },
285
280
  deliveries: { kind: 'explicit', principalIds: principals(args['recipients'], 'recipients') ?? [] },
286
281
  intent,
287
282
  ...(typeof replyTo === 'string' ? { relationships: { replyToMessageId: replyTo.trim() } } : {}),
288
283
  ...mandateOf(args, env),
289
- // The message carries the page. Without replyTo it starts a thread of
290
- // its own. Whoever reads the message opens the page: no share needed.
291
- ...(page ? { page } : {}),
292
- // Passed as given: forms without a page is refused by the server, with why.
293
- ...(Array.isArray(args['forms']) ? { forms: args['forms'] } : {}),
294
284
  ...(args['formEntry'] && typeof args['formEntry'] === 'object' ? { formEntry: args['formEntry'] } : {}),
295
285
  });
296
- return page ? { ...sent, page: { artifactId: page.id, address: `/pages/${sent.message.rootMessageId}` } } : sent;
286
+ }),
287
+ };
288
+ /**
289
+ * A page: a thread shown as HTML instead of messages. Its own tool, so an
290
+ * agent asked for a view, a tracker or a form finds it by name. How to write
291
+ * one is the read-only page_guide; this posts it, in a bucket or straight to
292
+ * the people it is for, and posts its new versions.
293
+ */
294
+ export const pageCapability = {
295
+ key: 'page',
296
+ names: { sdk: 'page', mcp: 'ziggs_page' },
297
+ title: 'Post a page',
298
+ descriptions: {
299
+ sdk: 'Post a page: a live view, tracker or form people open in Ziggs. Read page_guide first. It goes in a bucket (bucketId) or to the people it is for (to). replaces posts a new version of your page.',
300
+ },
301
+ annotation: 'destructive',
302
+ needsAgentId: true,
303
+ params: {
304
+ html: { type: 'string', required: true, description: 'A full HTML document (<!DOCTYPE html>), written as page_guide says.' },
305
+ name: { type: 'string', required: true, description: 'Short, stable name of the page.' },
306
+ text: { type: 'string', description: 'One line saying what the page is. Defaults to its name.' },
307
+ bucketId: { type: 'string', description: 'The bucket it goes in; everyone in it can open it.' },
308
+ to: { type: 'array', items: { type: 'string' }, description: 'Who it is for: they can open it and are told. In a bucket, among its people.' },
309
+ replaces: { type: 'string', description: 'The first message of a page you posted: this is its new version.' },
310
+ forms: FORMS,
311
+ operationId: { type: 'string', description: 'Reuse on retry.' },
312
+ },
313
+ // Work under an agreement keeps its mandate: the one the wake is under.
314
+ handler: (args, env) => run('page', async () => {
315
+ const named = args['operationId'];
316
+ const operationId = typeof named === 'string' && named.trim() ? named.trim() : `page-send-${globalThis.crypto.randomUUID()}`;
317
+ const page = await pageOf(args['html'], args['name'], env, operationId);
318
+ const name = String(args['name']).trim();
319
+ const said = args['text'];
320
+ const text = typeof said === 'string' && said.trim() ? said.trim() : name;
321
+ const to = principals(args['to'], 'to') ?? [];
322
+ const replaces = args['replaces'];
323
+ if (replaces !== undefined && (typeof replaces !== 'string' || !replaces.trim()))
324
+ throw new Error('replaces is the first message of your page');
325
+ const inThread = typeof replaces === 'string' ? { relationships: { replyToMessageId: replaces.trim() } } : {};
326
+ const forms = Array.isArray(args['forms']) ? { forms: args['forms'] } : {};
327
+ const inBucket = typeof args['bucketId'] === 'string' && args['bucketId'].trim();
328
+ if (!inBucket && !to.length)
329
+ throw new Error('Name where the page goes: bucketId, or to with who it is for');
330
+ let sent;
331
+ if (inBucket) {
332
+ sent = await client(env).sendMessage(bucketId(args), {
333
+ operationId, content: { text }, deliveries: { kind: 'explicit', principalIds: to }, intent: 'fyi',
334
+ ...inThread, ...mandateOf(args, env), page, ...forms,
335
+ });
336
+ }
337
+ else {
338
+ const creds = fullCreds(env);
339
+ sent = await new MessageRecordsClient(creds.operatorKey, creds.agentId, env.baseUrl).send({
340
+ operationId, content: { text }, audience: { kind: 'explicit', principalIds: to }, deliveries: { kind: 'explicit', principalIds: to }, intent: 'fyi',
341
+ ...inThread, ...mandateOf(args, env), page, ...forms,
342
+ });
343
+ }
344
+ return { ...sent, page: { artifactId: page.id, address: `/pages/${sent.message.rootMessageId}` } };
297
345
  }),
298
346
  };
299
347
  /**
@@ -301,16 +349,13 @@ export const bucketSendCapability = {
301
349
  * exact version. The file is saved under the same retry identity as the
302
350
  * message, so a retry links the same file.
303
351
  */
304
- async function pageOf(args, env, operationId) {
305
- const html = args['page'];
306
- if (html === undefined)
307
- return null;
352
+ async function pageOf(html, pageName, env, operationId) {
308
353
  if (typeof html !== 'string' || !/^\s*(?:<!doctype\s+html|<html)(?:\s|>)/i.test(html)) {
309
- throw new Error('page is a full HTML document starting with <!DOCTYPE html>');
354
+ throw new Error('html is a full HTML document starting with <!DOCTYPE html>');
310
355
  }
311
- const name = typeof args['pageName'] === 'string' ? args['pageName'].trim() : '';
356
+ const name = typeof pageName === 'string' ? pageName.trim() : '';
312
357
  if (!name)
313
- throw new Error('pageName is required with page');
358
+ throw new Error('name is required');
314
359
  const creds = fullCreds(env);
315
360
  // The stored text is trimmed; the link names exactly what is stored.
316
361
  const text = html.trim();
@@ -387,6 +432,7 @@ export const bucketDeleteCapability = {
387
432
  };
388
433
  export const BUCKET_CAPABILITIES = [
389
434
  pageGuideCapability,
435
+ pageCapability,
390
436
  bucketCreateCapability,
391
437
  bucketListCapability,
392
438
  bucketReadCapability,
@@ -6,6 +6,7 @@ import { ContextOpenClient } from '../http/ContextOpenClient.js';
6
6
  import { ContextGrantsClient, } from '../http/ContextGrantsClient.js';
7
7
  import { ContextDiscoveryClient } from '../http/ContextDiscoveryClient.js';
8
8
  import { grantCaveat, CONTEXT_GRANT_SCOPE_KINDS, } from '../http/grants.js';
9
+ import { ACCESS_REQUEST_SCOPE_KINDS, } from '@ziggs-ai/contracts';
9
10
  import { fetchMyOrgs, resolveOrgSelector } from '../http/OrgsClient.js';
10
11
  import { fullCreds } from './types.js';
11
12
  // What an agent may give or pass on through these tools. The context rail
@@ -433,14 +434,14 @@ export const accessRequestCapability = {
433
434
  title: 'Request access for yourself or named readers',
434
435
  annotation: 'destructive', needsAgentId: true,
435
436
  descriptions: {
436
- sdk: 'Request optional bounded access to one message, artifact, agreement context or task, or ask to send messages to a destination (scopeKind=contact). Creates only a pending approval; never grants access or approves. Choose recipientId when several approvers are offered; with one, it is selected automatically: your work brief offers them for this wake — workBrief.actingFor.customer.id (the customer of the hire you are working in, for their own accounts and resources) or workBrief.actingFor.operator.id (your operator, for tools you bring). Anyone else is refused, and the refusal lists who you can ask. Artifact requests go to the selected approver inbox; no conversation is needed. To create work under an agreement you can read but not work on (a task create refused with WORK_ACCESS_REQUIRED), request permission=work on it; only someone who can work on it may approve, and it lasts until the agreement ends. To work on one task only, request permission=work with scopeKind=task: a yes makes you its assignee. Use scopeId for a known artifact; or scopeKind=artifact with agreementId of your active hire to request its system-maintained workspace summary (workspace name/type and agents, including future updates, not private conversations or document bodies). Send the returned appUrl, wait for human approval, then follow the returned resume action. To arrange reading of one artifact for others, name them in holders (agents by id, people or workspaces by their authorized principal IDs); include yourself only if you need to read it too. The owner approves that exact list once and each reader gets its own grant; readers who can already read it come back as already_readable. For releaseSource, explicitly name its authority in recipientId; approval releases only the exact output. Hiring alone grants no source access. Revocation and expiry are checked by the system.',
437
+ sdk: 'Request optional bounded access to one message, artifact, agreement context or task, or ask to send messages to a destination (scopeKind=contact), to use a connection (scopeKind=connection, name connectionTools), to spend from a wallet (scopeKind=wallet, name spendingMaxAmount in hundredths of a point: 500 is ϟ5.00), or to change a page (scopeKind=thread). Creates only a pending approval; never grants access or approves. Choose recipientId when several approvers are offered; with one, it is selected automatically: your work brief offers them for this wake — workBrief.actingFor.customer.id (the customer of the hire you are working in, for their own accounts and resources) or workBrief.actingFor.operator.id (your operator, for tools you bring). Anyone else is refused, and the refusal lists who you can ask. Artifact requests go to the selected approver inbox; no conversation is needed. To create work under an agreement you can read but not work on (a task create refused with WORK_ACCESS_REQUIRED), request permission=work on it; only someone who can work on it may approve, and it lasts until the agreement ends. To work on one task only, request permission=work with scopeKind=task: a yes makes you its assignee. Use scopeId for a known artifact; or scopeKind=artifact with agreementId of your active hire to request its system-maintained workspace summary (workspace name/type and agents, including future updates, not private conversations or document bodies). Send the returned appUrl, wait for human approval, then follow the returned resume action. To arrange reading of one artifact for others, name them in holders (agents by id, people or workspaces by their authorized principal IDs); include yourself only if you need to read it too. The owner approves that exact list once and each reader gets its own grant; readers who can already read it come back as already_readable. For releaseSource, explicitly name its authority in recipientId; approval releases only the exact output. Hiring alone grants no source access. Revocation and expiry are checked by the system.',
437
438
  },
438
439
  params: {
439
- scopeKind: { type: 'string', required: true, enum: ['message', 'artifact', 'agreement', 'task', 'contact'], description: 'contact: ask to send messages to scopeId (a person, an agent or a workspace inbox). One-way; it reads nothing and gives no reply path.' },
440
+ scopeKind: { type: 'string', required: true, enum: [...ACCESS_REQUEST_SCOPE_KINDS], description: 'contact: send to scopeId. connection: use of a connection (connectionTools). wallet: spend (spendingMaxAmount). thread: post a new page version.' },
440
441
  scopeId: { type: 'string', description: 'Original resource id. Omit when using a hire agreementId to request its workspace summary.' },
441
442
  agreementId: { type: 'string', description: 'Artifact scope only: current hire id, used instead of scopeId to request the system-maintained workspace summary.' },
442
443
  reason: { type: 'string', required: true, description: 'Why access is needed and who will receive the reply or summary' },
443
- permission: { type: 'string', enum: ['read', 'work'], description: 'read by default. work: agreement work, or with scopeKind=task, that task.' },
444
+ permission: { type: 'string', enum: ['read', 'work', 'change'], description: 'read by default. work: agreement work, or with scopeKind=task, that task. change: a page (scopeKind=thread).' },
444
445
  temporal: { type: 'string', enum: ['from-start'], description: 'Retained resource access uses from-start; owner policy remains authoritative.' },
445
446
  durationHours: { type: 'number', description: 'Integer 1–168 hours after approval; reads default to 24' },
446
447
  // Not required here: the server requires it, and a request without it
@@ -466,6 +467,15 @@ export const accessRequestCapability = {
466
467
  },
467
468
  },
468
469
  idempotencyKey: { type: 'string', description: 'Reuse for the same logical request' },
470
+ connectionTools: {
471
+ type: 'array',
472
+ description: 'Connection only: MCP tool names to request. The person can approve a subset.',
473
+ items: { type: 'string' },
474
+ },
475
+ spendingMaxAmount: {
476
+ type: 'number',
477
+ description: 'Wallet only: most this grant may spend, in hundredths of a point (500 is ϟ5.00). The person can approve a lower amount.',
478
+ },
469
479
  },
470
480
  handler: async (args, env) => {
471
481
  // recipientId is resolved by the server: it picks the sole eligible recipient
@@ -474,16 +484,14 @@ export const accessRequestCapability = {
474
484
  if (typeof args[key] !== 'string' || !String(args[key]).trim())
475
485
  throw new Error(`${key} is required`);
476
486
  }
477
- const scopeKind = args.scopeKind;
478
- if (!['message', 'artifact', 'agreement', 'task', 'contact'].includes(scopeKind))
479
- throw new Error('Unsupported scopeKind');
487
+ const scopeKind = String(args.scopeKind).trim();
480
488
  const contact = scopeKind === 'contact';
481
489
  const agreementId = typeof args.agreementId === 'string' ? args.agreementId.trim() : undefined;
482
490
  const scopeId = typeof args.scopeId === 'string' ? args.scopeId.trim() : undefined;
483
491
  if (Boolean(agreementId) === Boolean(scopeId) || (agreementId && scopeKind !== 'artifact'))
484
492
  throw new Error('Provide scopeId, or agreementId for its workspace summary artifact');
485
493
  const permission = args.permission ?? 'read';
486
- if (!['read', 'work'].includes(String(permission)))
494
+ if (!['read', 'work', 'change'].includes(String(permission)))
487
495
  throw new Error('permission must be read or work');
488
496
  // Which scope takes which permission is the server's answer, with its reason.
489
497
  if (args.temporal !== undefined && args.temporal !== 'from-start')
@@ -513,6 +521,8 @@ export const accessRequestCapability = {
513
521
  releaseSource = { kind: source.kind, id: source.id.trim() };
514
522
  }
515
523
  const creds = fullCreds(env);
524
+ const connectionTools = Array.isArray(args.connectionTools) ? args.connectionTools : undefined;
525
+ const spendingMaxAmount = typeof args.spendingMaxAmount === 'number' ? args.spendingMaxAmount : undefined;
516
526
  const result = await new ContextGrantsClient(creds.operatorKey, creds.agentId, env.baseUrl).requestAccess({
517
527
  scopeKind, scopeId, agreementId, reason: String(args.reason).trim(),
518
528
  // A contact request carries no permission unless the caller named one;
@@ -523,6 +533,8 @@ export const accessRequestCapability = {
523
533
  ...(holders ? { holders } : {}),
524
534
  ...(contributionTo ? { contributionTo } : {}),
525
535
  ...(releaseSource ? { releaseSource } : {}),
536
+ ...(connectionTools ? { connectionTools } : {}),
537
+ ...(spendingMaxAmount !== undefined ? { spendingMaxAmount } : {}),
526
538
  }, { idempotencyKey: args.idempotencyKey, laneId: creds.laneId });
527
539
  const actingAgentId = result.actingAgentId ?? (creds.agentId || undefined);
528
540
  if (result.status === 'already_readable') {
@@ -1,4 +1,11 @@
1
1
  import { type CapabilityDefinition } from './types.js';
2
2
  export declare const agentSearchCapability: CapabilityDefinition;
3
3
  export declare const agentGetCapability: CapabilityDefinition;
4
+ /**
5
+ * Teammates by name. A person asks for "Ana", never for an id; without this
6
+ * an assistant had no way from the name to the id a task or a message needs,
7
+ * and asked its person for the id instead. The same match agent_search makes
8
+ * for teammates, on its own tool so it is found by what it does.
9
+ */
10
+ export declare const peopleCapability: CapabilityDefinition;
4
11
  export declare const DISCOVERY_CAPABILITIES: CapabilityDefinition[];
@@ -111,9 +111,40 @@ export const agentGetCapability = {
111
111
  return { agent };
112
112
  },
113
113
  };
114
+ /**
115
+ * Teammates by name. A person asks for "Ana", never for an id; without this
116
+ * an assistant had no way from the name to the id a task or a message needs,
117
+ * and asked its person for the id instead. The same match agent_search makes
118
+ * for teammates, on its own tool so it is found by what it does.
119
+ */
120
+ export const peopleCapability = {
121
+ key: 'people',
122
+ names: { sdk: 'people', mcp: 'ziggs_people' },
123
+ title: 'Find people',
124
+ descriptions: {
125
+ sdk: 'Finds teammates in your workspace by name, with the id a task or a message needs. Your own person is not listed: the session read names them.',
126
+ },
127
+ annotation: 'read-only',
128
+ params: {
129
+ name: { type: 'string', required: true, description: 'All or part of their name.' },
130
+ },
131
+ needsAgentId: true,
132
+ handler: async (args, env) => {
133
+ const name = typeof args['name'] === 'string' ? args['name'].trim() : '';
134
+ if (!name)
135
+ throw new Error('name is required');
136
+ const creds = fullCreds(env);
137
+ const result = await new AgentSearchClient(creds.operatorKey, creds.agentId).searchAgents(name, { limit: 1 });
138
+ if (!result.success)
139
+ throw new Error(result.error ?? result.message ?? 'search failed');
140
+ const people = (result.people ?? []).map((p) => ({ id: p.userId, name: p.displayName }));
141
+ return people.length ? { people } : { people, note: `No teammate's name matches "${name}".` };
142
+ },
143
+ };
114
144
  export const DISCOVERY_CAPABILITIES = [
115
145
  agentSearchCapability,
116
146
  agentGetCapability,
147
+ peopleCapability,
117
148
  ];
118
149
  function withHire(agent, hired) {
119
150
  const hires = hired.byAgent.get(agent.agentId);
@@ -14,10 +14,10 @@ export { AGREEMENT_PROPOSE_PROVIDER_ID_DESCRIPTION } from './proposeProviderId.j
14
14
  export { MARKETPLACE_CAPABILITIES, marketplaceViewCapability } from './marketplace.js';
15
15
  export { GRANTS_CAPABILITIES, listGrantsCapability } from './grants.js';
16
16
  export { PAGE_GUIDE, pageGuideCapability } from './pageGuide.js';
17
- export { BUCKET_CAPABILITIES, bucketCreateCapability, bucketListCapability, bucketReadCapability, bucketInsertCapability, bucketRemoveCapability, bucketAddMembersCapability, bucketJoinCapability, bucketSendCapability, bucketRemoveMemberCapability, bucketDuplicateCapability, bucketRenameCapability, bucketDeleteCapability, } from './buckets.js';
17
+ export { BUCKET_CAPABILITIES, bucketCreateCapability, bucketListCapability, bucketReadCapability, bucketInsertCapability, bucketRemoveCapability, bucketAddMembersCapability, bucketJoinCapability, bucketSendCapability, pageCapability, bucketRemoveMemberCapability, bucketDuplicateCapability, bucketRenameCapability, bucketDeleteCapability, } from './buckets.js';
18
18
  export { CONTEXT_CAPABILITIES, contextCallersCapability, contextReadCapability, openCapability, accessExplainCapability, contextDelegateCapability, accessRequestCapability, contextExpandReachCapability, contextDiscoverGrantableCapability, contextBounds, resolveOrgScopeId, explainRefusedRead, RESOURCE_HIDDEN_MESSAGE, RESOURCE_UNREADABLE_MESSAGE, type RefusedRead, } from './context.js';
19
19
  export { CONNECTION_CAPABILITIES, connectionProxyCapability, requestConnectionCapability, } from './connections.js';
20
- export { DISCOVERY_CAPABILITIES, agentSearchCapability, agentGetCapability, } from './discovery.js';
20
+ export { DISCOVERY_CAPABILITIES, agentSearchCapability, agentGetCapability, peopleCapability, } from './discovery.js';
21
21
  export { ARTIFACT_CAPABILITIES, recordArtifactCapability, listArtifactsCapability, findArtifactsCapability, type UnsearchedContext, attachArtifactCapability, reviewArtifactContributionCapability, contributeArtifactCapability, uploadArtifactUrlCapability, completeArtifactFileCapability, downloadArtifactCapability, reextractArtifactCapability, } from './artifacts.js';
22
22
  export { EVERYDAY_MCP_TOOLS, EVERYDAY_NO_SDK_TWIN, EVERYDAY_SDK_ONLY, EVERYDAY_SDK_TOOLS, } from './everyday.js';
23
23
  export { annotationForSdkTool } from './toolLane.js';
@@ -14,10 +14,10 @@ export { AGREEMENT_PROPOSE_PROVIDER_ID_DESCRIPTION } from './proposeProviderId.j
14
14
  export { MARKETPLACE_CAPABILITIES, marketplaceViewCapability } from './marketplace.js';
15
15
  export { GRANTS_CAPABILITIES, listGrantsCapability } from './grants.js';
16
16
  export { PAGE_GUIDE, pageGuideCapability } from './pageGuide.js';
17
- export { BUCKET_CAPABILITIES, bucketCreateCapability, bucketListCapability, bucketReadCapability, bucketInsertCapability, bucketRemoveCapability, bucketAddMembersCapability, bucketJoinCapability, bucketSendCapability, bucketRemoveMemberCapability, bucketDuplicateCapability, bucketRenameCapability, bucketDeleteCapability, } from './buckets.js';
17
+ export { BUCKET_CAPABILITIES, bucketCreateCapability, bucketListCapability, bucketReadCapability, bucketInsertCapability, bucketRemoveCapability, bucketAddMembersCapability, bucketJoinCapability, bucketSendCapability, pageCapability, bucketRemoveMemberCapability, bucketDuplicateCapability, bucketRenameCapability, bucketDeleteCapability, } from './buckets.js';
18
18
  export { CONTEXT_CAPABILITIES, contextCallersCapability, contextReadCapability, openCapability, accessExplainCapability, contextDelegateCapability, accessRequestCapability, contextExpandReachCapability, contextDiscoverGrantableCapability, contextBounds, resolveOrgScopeId, explainRefusedRead, RESOURCE_HIDDEN_MESSAGE, RESOURCE_UNREADABLE_MESSAGE, } from './context.js';
19
19
  export { CONNECTION_CAPABILITIES, connectionProxyCapability, requestConnectionCapability, } from './connections.js';
20
- export { DISCOVERY_CAPABILITIES, agentSearchCapability, agentGetCapability, } from './discovery.js';
20
+ export { DISCOVERY_CAPABILITIES, agentSearchCapability, agentGetCapability, peopleCapability, } from './discovery.js';
21
21
  export { ARTIFACT_CAPABILITIES, recordArtifactCapability, listArtifactsCapability, findArtifactsCapability, attachArtifactCapability, reviewArtifactContributionCapability, contributeArtifactCapability, uploadArtifactUrlCapability, completeArtifactFileCapability, downloadArtifactCapability, reextractArtifactCapability, } from './artifacts.js';
22
22
  export { EVERYDAY_MCP_TOOLS, EVERYDAY_NO_SDK_TWIN, EVERYDAY_SDK_ONLY, EVERYDAY_SDK_TOOLS, } from './everyday.js';
23
23
  export { annotationForSdkTool } from './toolLane.js';
@@ -148,7 +148,7 @@ const BRIEFS = {
148
148
  does: 'Lists grants you hold, or with role issuer the grants you caused. An empty list means no grants of your own, not no access.',
149
149
  },
150
150
  ziggs_access_request: {
151
- does: 'Requests access to a specific resource. recipientId names the approver; refusals list eligible approvers. No conversation is needed.',
151
+ does: 'Requests access to a named resource, a connection (connectionTools), or wallet spend (spendingMaxAmount). recipientId names the approver; refusals list eligible approvers.',
152
152
  changes: 'creates a pending approval; grants nothing until approved',
153
153
  },
154
154
  ziggs_context_delegate: {
@@ -206,7 +206,7 @@ const BRIEFS = {
206
206
  },
207
207
  // Tasks
208
208
  ziggs_task_create: {
209
- does: 'Creates a task under an active agreement, or a job with its children in one call. plan sets its checklist.',
209
+ does: 'Gives someone a task: your person, a teammate, an agent you run, or anyone under an agreement. dueAt and checkBack set the chasing. Children make a job.',
210
210
  changes: 'creates the tasks and notifies their assignees',
211
211
  },
212
212
  ziggs_task_get: {
@@ -216,7 +216,7 @@ const BRIEFS = {
216
216
  does: 'Lists tasks you can reach. assignedToMe and createdByMe filter them.',
217
217
  },
218
218
  ziggs_task_pass_on: {
219
- does: 'Makes someone else the assignee of a live task you work or opened, so only they can finish it. They must be able to work under its agreement, which stays.',
219
+ does: 'Makes someone else the assignee of a live task you work or opened, so only they can finish it. Its agreement, if any, stays; with none, a teammate or an agent you run.',
220
220
  changes: 'the assignee; the previous one loses write on the task',
221
221
  },
222
222
  ziggs_task_update_steps: {
@@ -241,7 +241,10 @@ const BRIEFS = {
241
241
  },
242
242
  // Agents, links and introductions
243
243
  ziggs_agent_search: {
244
- does: 'Finds agents in the store, your workspaces and your own; teammates come back as people; people you are connected with are in ziggs_link_list. A row you hire says already hired and names that agreement and workspace.',
244
+ does: 'Finds agents in the store, your workspaces and your own. A row you hire says already hired and names that agreement and workspace. People are found with ziggs_people.',
245
+ },
246
+ ziggs_people: {
247
+ does: 'Finds teammates in your workspace by name, with the id a task or a message needs. ziggs_auth_status names your own person.',
245
248
  },
246
249
  ziggs_agent_get: {
247
250
  does: 'Reads one agent’s profile by exact id, with how to hire it: listingAgreementId to claim, acceptsProposals for a direct proposal.',
@@ -298,7 +301,7 @@ const BRIEFS = {
298
301
  },
299
302
  // Buckets: pointers to items and people; access is computed from the items' grants.
300
303
  ziggs_bucket_create: {
301
- does: 'Creates a bucket, with items if given.',
304
+ does: 'Creates a bucket (a brain, in the app): people and the things they share on one subject, with items if given.',
302
305
  changes: 'creates it with what fits',
303
306
  },
304
307
  ziggs_bucket_list: {
@@ -330,11 +333,15 @@ const BRIEFS = {
330
333
  ziggs_page_guide: {
331
334
  does: 'Returns how to build a page that works: window.ziggs, forms, feeding, and the fallback text.',
332
335
  when: 'before writing a page',
333
- next: 'ziggs_bucket_send with page',
336
+ next: 'ziggs_page',
337
+ },
338
+ ziggs_page: {
339
+ does: 'Posts a page: a live view, tracker or form people open in Ziggs. In a bucket or to who it is for; replaces posts a new version.',
340
+ when: 'after ziggs_page_guide',
341
+ changes: 'posts it; they are told',
334
342
  },
335
343
  ziggs_bucket_send: {
336
344
  does: "Sends inside a bucket, to its people and the readers of replyTo.",
337
- when: 'a page, after ziggs_page_guide',
338
345
  changes: 'sends it',
339
346
  },
340
347
  ziggs_bucket_rename: {
@@ -3,7 +3,8 @@ export declare const readMessageCapability: CapabilityDefinition;
3
3
  /**
4
4
  * The command's real shape, the same keys the server accepts (contracts
5
5
  * `parseMessageCommand`), so a caller sees it in the schema and a wrong key is
6
- * refused by name before it is sent.
6
+ * refused by name before it is sent. A page is posted with the page tool,
7
+ * which saves its HTML and links that version; it is not hand-built here.
7
8
  */
8
9
  export declare const MESSAGE_COMMAND_PARAM: CapabilityParam;
9
10
  export declare const sendMessageCapability: CapabilityDefinition;
@@ -6,7 +6,8 @@ const principals = { type: 'object', required: true, properties: { kind: { type:
6
6
  /**
7
7
  * The command's real shape, the same keys the server accepts (contracts
8
8
  * `parseMessageCommand`), so a caller sees it in the schema and a wrong key is
9
- * refused by name before it is sent.
9
+ * refused by name before it is sent. A page is posted with the page tool,
10
+ * which saves its HTML and links that version; it is not hand-built here.
10
11
  */
11
12
  export const MESSAGE_COMMAND_PARAM = { type: 'object', required: true, properties: {
12
13
  operationId: { type: 'string', required: true, description: 'Reuse on retry.' },
@@ -17,8 +18,6 @@ export const MESSAGE_COMMAND_PARAM = { type: 'object', required: true, propertie
17
18
  mandate: { type: 'object', properties: { agreementId: { type: 'string', required: true }, taskId: { type: 'string' } } },
18
19
  relationships: { type: 'object', properties: { replyToMessageId: { type: 'string' }, taskIds: { type: 'array', items: { type: 'string' } }, artifacts: { type: 'array', items: { type: 'object' } } } },
19
20
  sources: { type: 'array', items: { type: 'object' } },
20
- page: { type: 'object', properties: { kind: { type: 'string', enum: ['artifact'], required: true }, id: { type: 'string', required: true }, sha256: { type: 'string', required: true } } },
21
- forms: { type: 'array', description: 'With page: the page\'s forms, fields and choices.', items: { type: 'object', required: ['name', 'fields'], properties: { name: { type: 'string' }, fields: { type: 'array', items: { type: 'object', properties: { name: { type: 'string' }, label: { type: 'string' }, choices: { type: 'array', items: { type: 'string' } }, freeText: { type: 'boolean' } } } } } } },
22
21
  formEntry: { type: 'object', description: 'Reply to the page version filled; goes to its poster.', properties: { form: { type: 'string', required: true }, fields: { type: 'object' } } },
23
22
  } };
24
23
  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) };
@@ -2,7 +2,7 @@ import type { CapabilityDefinition } from './types.js';
2
2
  /**
3
3
  * How to build a page that works. One text, returned by `page_guide` /
4
4
  * `ziggs_page_guide`. Every agent that writes a page reads it from here,
5
- * only when it is about to write one.
5
+ * only when it is about to write one, and posts it with `page` / `ziggs_page`.
6
6
  */
7
- export declare const PAGE_GUIDE = "LIVE HTML PAGES\n- A page is a thread shown as HTML instead of messages. When asked for a live view or a form,\n post one: bucket_send in the bucket you work in, with page (a complete HTML document that\n starts with <!DOCTYPE html>), pageName (short and stable) and a short text saying what it is,\n and no replyTo, even when you post it in answer to someone: a new page starts a thread of its\n own, and that thread is the page. Name whoever asked in recipients so they are told.\n Everyone in the bucket opens that thread as the page. Its own address is the result's\n page.address (/pages/<thread>); use it, never invent one.\n- Post a page into the conversation it is for: a customer's bucket, a visitor's conversation.\n A page in the bucket your listing is invited into reaches everyone who comes in through the\n listing: each gets a bucket of their own with it, and their form entries stay there. Everything\n in that bucket goes to each newcomer, so keep it free of anything private.\n- To change a page, post the new one in the same thread: bucket_send with replyTo the page's first\n message, the same pageName and the new page. The newest page you posted in the thread is the\n one shown, and open pages switch on their own. Only you, the poster, can replace it.\n- A page runs as the signed-in VIEWER, not you. Fetch every viewer's data when it opens. Never\n paste fetched tasks, agreements, messages, names or other private data into the HTML: everyone\n who reads the message can read those saved bytes.\n- Use inline CSS and inline JavaScript. No CDNs, imports, external images, fetch, websockets,\n cookies or storage. Optional images must be embedded data URLs. Do not add a CSP; Ziggs\n supplies it. Build a responsive page with accessible labels and visible focus states.\n- A form is inputs plus <button type=\"button\"> with a click handler that calls ziggs.act on a\n submit action. Never use a <form> that submits or a type=\"submit\" button: the page's frame\n blocks form submission, so a submit handler never runs and the button does nothing.\n- Plain HTML must say \"Open this as a page to use it\". When window.ziggs is present, replace\n that fallback with the live view. A file opened on its own shows a static preview.\n- window.ziggs is injected before your script. Every method returns a Promise; catch errors,\n show loading/error/empty states, and offer a Refresh button. Use textContent for fetched\n strings, never insert returned text as HTML. Call only what the view needs.\n- Three reads, same as the signed-in app:\n * ziggs.me() -> who the viewer is here: {principalId, activeOrgId, userId, username, orgId}.\n * ziggs.list(kind, filters) -> what they can see. kind is thread, agreement, task, artifact,\n person, agent, bucket, or message. Each reach item carries id, title, side, actions. Filters:\n id, cursor, limit (1..100), state (tasks), assigneeId, before (messages), agreementId,\n taskId, participantIds (message lists). Items expose server-returned actions; pages never invent them.\n Page thread: ziggs.list('message', {limit?, before?}) -> {page, messages, nextCursor}.\n One message: ziggs.list('message', {id}). Replies: ziggs.list('message', {id, replies: 1, before?}).\n Open body for one artifact id: ziggs.list('artifact', {id}) -> {item}.\n * ziggs.open(kind, id) -> {opened:true}; kind is message, task, agreement, decision, or artifact.\n Call from a button the person clicks. decision opens review in Ziggs's own UI.\n * ziggs.on('change', fn) -> grant-scoped changes; fn({eventId, kind, resourceId}). Reload what you\n already listed instead of polling.\n- Writes: ziggs.act(action, label?). action is an object from an item's actions array, or:\n {action:'send', command:<MessageCommand>} or {action:'submit', form, fields}. The host confirms\n outside the frame; payments, keys, connections, hire, approve, and similar acts are refused.\n- Minimal script pattern: if (window.ziggs) { load(); ziggs.on('change', load); }\n async function load() {\n try {\n const {messages} = await ziggs.list('message', {limit: 50});\n document.getElementById('status').textContent = messages.length + ' messages';\n } catch (error) { document.getElementById('status').textContent = error.message; }\n }\n The example assumes a <p id=\"status\">Open this as a page to use it</p> in the HTML.\n\nFEEDING A PAGE\n- Put your data on a page as replies in its thread, never by posting a new page for each change:\n bucket_send with replyTo the page's message, no recipients (nobody is told, nobody is woken),\n intent fyi, and text holding the data as JSON, for example {\"feed\":\"ops\",\"data\":{...}}.\n Open pages get it through ziggs.on('change') or ziggs.list('message'); a page opened later\n reads it from the thread list.\n- Every reply is kept; the page decides what it needs. Write a whole snapshot per reply, or one\n event per reply, as the page is written to read. A reply is read by the bucket it is sent in:\n in a customer's bucket, that customer and nobody else.\n\nFORMS ON A PAGE\n- act runs as the viewer after Ziggs's own confirmation outside the frame. Call from a button,\n never on load; the page cannot approve its own confirmation.\n * ziggs.act({action:'submit', form, fields}) -> a form entry, a reply in the page's thread\n to you, the page's poster, asking you, so you wake. fields is a flat object of strings,\n numbers, booleans or null (1..100 keys, strings up to 4000 characters).\n * ziggs.act({action:'send', command}) -> the same MessageCommand used by message_send.\n Reuse the same operationId and command on retry; never invent recipients or authority.\n- Both refuse a cancelled confirmation or unavailable access. Keep the form filled on failure.\n- Use fixed form names and field keys. When an entry wakes you, answer in the same thread.\n";
7
+ export declare const PAGE_GUIDE = "LIVE HTML PAGES\n- A page is a thread shown as HTML instead of messages. When asked for a live view, a tracker\n or a form, post one with page: html (a complete HTML document that starts with\n <!DOCTYPE html>), name (short and stable) and a short text saying what it is. Put it in the\n bucket you work in (bucketId), or send it to the people it is for (to). Name whoever asked in\n to so they are told. A new page starts a thread of its own, even when you post it in answer\n to someone, and that thread is the page. Its own address is the result's page.address\n (/pages/<thread>); use it, never invent one.\n- Post a page into the conversation it is for: a customer's bucket, a visitor's conversation.\n A page in the bucket your listing is invited into reaches everyone who comes in through the\n listing: each gets a bucket of their own with it, and their form entries stay there. Everything\n in that bucket goes to each newcomer, so keep it free of anything private.\n- To change a page, post the new one in the same thread: page with replaces naming the page's\n first message, the same name, the same bucketId or to, and the new html. The newest page you\n posted in the thread is the one shown, and open pages switch on their own. Only you, the\n poster, can replace it.\n- A page runs as the signed-in VIEWER, not you. Fetch every viewer's data when it opens. Never\n paste fetched tasks, agreements, messages, names or other private data into the HTML: everyone\n who reads the message can read those saved bytes.\n- Use inline CSS and inline JavaScript. No CDNs, imports, external images, fetch, websockets,\n cookies or storage. Optional images must be embedded data URLs. Do not add a CSP; Ziggs\n supplies it. Build a responsive page with accessible labels and visible focus states.\n- A form is inputs plus <button type=\"button\"> with a click handler that calls ziggs.act on a\n submit action. Never use a <form> that submits or a type=\"submit\" button: the page's frame\n blocks form submission, so a submit handler never runs and the button does nothing.\n- Plain HTML must say \"Open this as a page to use it\". When window.ziggs is present, replace\n that fallback with the live view. A file opened on its own shows a static preview.\n- window.ziggs is injected before your script. Every method returns a Promise; catch errors,\n show loading/error/empty states, and offer a Refresh button. Use textContent for fetched\n strings, never insert returned text as HTML. Call only what the view needs.\n- Three reads, same as the signed-in app:\n * ziggs.me() -> who the viewer is here: {principalId, activeOrgId, userId, username, orgId}.\n * ziggs.list(kind, filters) -> what they can see. kind is thread, agreement, task, artifact,\n person, agent, bucket, or message. Each reach item carries id, title, side, actions. Filters:\n id, cursor, limit (1..100), state (tasks), assigneeId, before (messages), agreementId,\n taskId, participantIds (message lists). Items expose server-returned actions; pages never invent them.\n Page thread: ziggs.list('message', {limit?, before?}) -> {page, messages, nextCursor}.\n One message: ziggs.list('message', {id}). Replies: ziggs.list('message', {id, replies: 1, before?}).\n Open body for one artifact id: ziggs.list('artifact', {id}) -> {item}.\n * ziggs.open(kind, id) -> {opened:true}; kind is message, task, agreement, decision, or artifact.\n Call from a button the person clicks. decision opens review in Ziggs's own UI.\n * ziggs.on('change', fn) -> grant-scoped changes; fn({eventId, kind, resourceId}). Reload what you\n already listed instead of polling.\n- Writes: ziggs.act(action, label?). action is an object from an item's actions array, or:\n {action:'send', command:<MessageCommand>} or {action:'submit', form, fields}. The host confirms\n outside the frame; payments, keys, connections, hire, approve, and similar acts are refused.\n- Minimal script pattern: if (window.ziggs) { load(); ziggs.on('change', load); }\n async function load() {\n try {\n const {messages} = await ziggs.list('message', {limit: 50});\n document.getElementById('status').textContent = messages.length + ' messages';\n } catch (error) { document.getElementById('status').textContent = error.message; }\n }\n The example assumes a <p id=\"status\">Open this as a page to use it</p> in the HTML.\n\nFEEDING A PAGE\n- Put your data on a page as replies in its thread, never by posting a new page for each change:\n a reply to the page's message (bucket_send with replyTo in its bucket, message_send with\n relationships.replyToMessageId outside one), no recipients (nobody is told, nobody is woken),\n intent fyi, and text holding the data as JSON, for example {\"feed\":\"ops\",\"data\":{...}}.\n Open pages get it through ziggs.on('change') or ziggs.list('message'); a page opened later\n reads it from the thread list.\n- Every reply is kept; the page decides what it needs. Write a whole snapshot per reply, or one\n event per reply, as the page is written to read. A reply is read by the bucket it is sent in:\n in a customer's bucket, that customer and nobody else.\n\nFORMS ON A PAGE\n- act runs as the viewer after Ziggs's own confirmation outside the frame. Call from a button,\n never on load; the page cannot approve its own confirmation.\n * ziggs.act({action:'submit', form, fields}) -> a form entry, a reply in the page's thread\n to you, the page's poster, asking you, so you wake. fields is a flat object of strings,\n numbers, booleans or null (1..100 keys, strings up to 4000 characters).\n * ziggs.act({action:'send', command}) -> the same MessageCommand used by message_send.\n Reuse the same operationId and command on retry; never invent recipients or authority.\n- Both refuse a cancelled confirmation or unavailable access. Keep the form filled on failure.\n- Use fixed form names and field keys. When an entry wakes you, answer in the same thread.\n";
8
8
  export declare const pageGuideCapability: CapabilityDefinition;
@@ -1,23 +1,24 @@
1
1
  /**
2
2
  * How to build a page that works. One text, returned by `page_guide` /
3
3
  * `ziggs_page_guide`. Every agent that writes a page reads it from here,
4
- * only when it is about to write one.
4
+ * only when it is about to write one, and posts it with `page` / `ziggs_page`.
5
5
  */
6
6
  export const PAGE_GUIDE = `LIVE HTML PAGES
7
- - A page is a thread shown as HTML instead of messages. When asked for a live view or a form,
8
- post one: bucket_send in the bucket you work in, with page (a complete HTML document that
9
- starts with <!DOCTYPE html>), pageName (short and stable) and a short text saying what it is,
10
- and no replyTo, even when you post it in answer to someone: a new page starts a thread of its
11
- own, and that thread is the page. Name whoever asked in recipients so they are told.
12
- Everyone in the bucket opens that thread as the page. Its own address is the result's
13
- page.address (/pages/<thread>); use it, never invent one.
7
+ - A page is a thread shown as HTML instead of messages. When asked for a live view, a tracker
8
+ or a form, post one with page: html (a complete HTML document that starts with
9
+ <!DOCTYPE html>), name (short and stable) and a short text saying what it is. Put it in the
10
+ bucket you work in (bucketId), or send it to the people it is for (to). Name whoever asked in
11
+ to so they are told. A new page starts a thread of its own, even when you post it in answer
12
+ to someone, and that thread is the page. Its own address is the result's page.address
13
+ (/pages/<thread>); use it, never invent one.
14
14
  - Post a page into the conversation it is for: a customer's bucket, a visitor's conversation.
15
15
  A page in the bucket your listing is invited into reaches everyone who comes in through the
16
16
  listing: each gets a bucket of their own with it, and their form entries stay there. Everything
17
17
  in that bucket goes to each newcomer, so keep it free of anything private.
18
- - To change a page, post the new one in the same thread: bucket_send with replyTo the page's first
19
- message, the same pageName and the new page. The newest page you posted in the thread is the
20
- one shown, and open pages switch on their own. Only you, the poster, can replace it.
18
+ - To change a page, post the new one in the same thread: page with replaces naming the page's
19
+ first message, the same name, the same bucketId or to, and the new html. The newest page you
20
+ posted in the thread is the one shown, and open pages switch on their own. Only you, the
21
+ poster, can replace it.
21
22
  - A page runs as the signed-in VIEWER, not you. Fetch every viewer's data when it opens. Never
22
23
  paste fetched tasks, agreements, messages, names or other private data into the HTML: everyone
23
24
  who reads the message can read those saved bytes.
@@ -59,7 +60,8 @@ export const PAGE_GUIDE = `LIVE HTML PAGES
59
60
 
60
61
  FEEDING A PAGE
61
62
  - Put your data on a page as replies in its thread, never by posting a new page for each change:
62
- bucket_send with replyTo the page's message, no recipients (nobody is told, nobody is woken),
63
+ a reply to the page's message (bucket_send with replyTo in its bucket, message_send with
64
+ relationships.replyToMessageId outside one), no recipients (nobody is told, nobody is woken),
63
65
  intent fyi, and text holding the data as JSON, for example {"feed":"ops","data":{...}}.
64
66
  Open pages get it through ziggs.on('change') or ziggs.list('message'); a page opened later
65
67
  reads it from the thread list.
@@ -83,7 +85,7 @@ export const pageGuideCapability = {
83
85
  names: { sdk: 'page_guide', mcp: 'ziggs_page_guide' },
84
86
  title: 'How to build a page',
85
87
  descriptions: {
86
- sdk: 'How to build a page that works: window.ziggs, forms, feeding the thread, and the fallback text. Read this before writing a page for bucket_send.',
88
+ sdk: 'How to build a page that works: window.ziggs, forms, feeding the thread, and the fallback text. Read this before writing a page, then post it with page.',
87
89
  },
88
90
  annotation: 'read-only',
89
91
  params: {},
@@ -109,7 +109,7 @@ export const passTaskOnCapability = {
109
109
  names: { sdk: 'task_pass_on', mcp: 'ziggs_task_pass_on' },
110
110
  title: 'Pass a task on',
111
111
  descriptions: {
112
- sdk: "Make someone else the assignee of a live task (PUT /tasks/:id/assignee), so only they can finish it. You may pass on a task you work or one you opened. The new assignee must be able to work under the task's agreement, for example another member of the workspace for a teammate's task. The agreement stays the same, and the previous assignee loses their write on the task.",
112
+ sdk: "Make someone else the assignee of a live task (PUT /tasks/:id/assignee), so only they can finish it. You may pass on a task you work or one you opened. Under an agreement, the new assignee must be able to work under it, and it stays the same. A task under none goes to a teammate or an agent you run. The previous assignee loses their write on the task.",
113
113
  },
114
114
  annotation: 'destructive',
115
115
  needsAgentId: true,
@@ -122,7 +122,7 @@ export const passTaskOnCapability = {
122
122
  assigneeId: {
123
123
  type: 'string',
124
124
  required: true,
125
- description: "Who works it from now on: a person or agent who can work under the task's agreement",
125
+ description: "Who works it from now on: under the task's agreement, someone who can work under it; with none, a teammate or an agent you run",
126
126
  },
127
127
  },
128
128
  handler: async (args, env) => {
@@ -46,6 +46,13 @@ export declare class AssistantConnectionClient {
46
46
  request<T>(path: string, body?: unknown, signal?: AbortSignal): Promise<T>;
47
47
  /** Read existing enabled assistant hires. Provisioning is an explicit sync action. */
48
48
  workspaces(): Promise<AssistantWorkspace[]>;
49
+ /** The workspaces, and the person the connection's assistant is for (null from a server that does not say). */
50
+ roster(): Promise<{
51
+ person: {
52
+ id: string;
53
+ } | null;
54
+ workspaces: AssistantWorkspace[];
55
+ }>;
49
56
  /** Which of the connection's assistants is on an existing thing. */
50
57
  resolve(kind: string, id: string): Promise<{
51
58
  workspace: AssistantWorkspace | null;
@@ -38,8 +38,12 @@ export class AssistantConnectionClient {
38
38
  }
39
39
  /** Read existing enabled assistant hires. Provisioning is an explicit sync action. */
40
40
  async workspaces() {
41
- return (await this.request('workspaces'))
42
- .workspaces;
41
+ return (await this.roster()).workspaces;
42
+ }
43
+ /** The workspaces, and the person the connection's assistant is for (null from a server that does not say). */
44
+ async roster() {
45
+ const read = await this.request('workspaces');
46
+ return { person: read.person?.id ? { id: read.person.id } : null, workspaces: read.workspaces };
43
47
  }
44
48
  /** Which of the connection's assistants is on an existing thing. */
45
49
  resolve(kind, id) {
@@ -96,11 +96,11 @@ export declare class ContextGrantsClient {
96
96
  issueGrant(input: IssueContextGrantInput): Promise<GrantView>;
97
97
  /** Request-only endpoint: a successful call must still have granted no access. */
98
98
  requestAccess(input: {
99
- scopeKind: 'message' | 'artifact' | 'address' | 'agreement' | 'task' | 'person' | 'contact';
99
+ scopeKind: import('@ziggs-ai/contracts').AccessRequestScopeKind;
100
100
  scopeId?: string;
101
101
  agreementId?: string;
102
102
  reason: string;
103
- permission?: 'read' | 'reply' | 'work' | 'list';
103
+ permission?: 'read' | 'reply' | 'work' | 'list' | 'change';
104
104
  temporal?: 'from-now' | 'from-start';
105
105
  durationHours?: number;
106
106
  ownerId?: string;
@@ -108,6 +108,10 @@ export declare class ContextGrantsClient {
108
108
  recipientId?: string;
109
109
  /** Artifact only: who should read it, if not only the caller. One grant each. */
110
110
  holders?: AccessReader[];
111
+ /** Connection scope only: MCP tool names to request. */
112
+ connectionTools?: string[];
113
+ /** Wallet scope only: max spend after approval, in hundredths of a point. */
114
+ spendingMaxAmount?: number;
111
115
  contributionTo?: import('@ziggs-ai/contracts').ContributionTarget;
112
116
  releaseSource?: import('@ziggs-ai/contracts').ContributionSource;
113
117
  }, opts?: {
@@ -1,3 +1,5 @@
1
+ import type { ResourceAction } from '@ziggs-ai/contracts';
2
+ export type { ResourceAction, ResourceActionCall } from '@ziggs-ai/contracts';
1
3
  export declare const CONTEXT_OPEN_KINDS: readonly ["artifact", "task", "agreement"];
2
4
  export type ContextOpenKind = (typeof CONTEXT_OPEN_KINDS)[number];
3
5
  export type ContextOpenOutcome = 'ok' | 'unreadable' | 'hidden';
@@ -17,30 +19,6 @@ export interface ContextOpenBody {
17
19
  /** An HTML page comes as its text; true returns the HTML as written. */
18
20
  html?: boolean;
19
21
  }
20
- /** Backend-evaluated action, scoped to a resource. Never a permission token. */
21
- export interface ResourceActionCall {
22
- tool: string;
23
- args: Record<string, unknown>;
24
- required?: string[];
25
- unavailableReason?: string;
26
- approvers?: Array<{
27
- id: string;
28
- name: string | null;
29
- role: string;
30
- }>;
31
- }
32
- export interface ResourceAction extends Partial<ResourceActionCall> {
33
- action: string;
34
- state: 'available' | 'needs_decision' | 'unavailable' | 'not_evaluated';
35
- reasonCode?: string;
36
- reason?: unknown;
37
- scope?: {
38
- kind: string;
39
- id: string;
40
- agreementId?: string;
41
- };
42
- recovery?: ResourceActionCall;
43
- }
44
22
  export interface ContextOpenAccess {
45
23
  summary: string;
46
24
  document?: {
@@ -52,7 +52,8 @@ export type PlanReviewTiming = 'with_proposal' | 'before_execution';
52
52
  */
53
53
  export interface CreateTaskChildData {
54
54
  name: string;
55
- agreementId: string;
55
+ /** The agreement it is done under. Left out, it goes to `assigneeId` the way a single task with none does. */
56
+ agreementId?: string;
56
57
  description: string;
57
58
  title?: string;
58
59
  assigneeId?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggs-ai/api-client",
3
- "version": "0.42.19",
3
+ "version": "0.42.21",
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.52.0",
34
+ "@ziggs-ai/contracts": "0.53.5",
35
35
  "socket.io-client": "^4.7.0"
36
36
  },
37
37
  "keywords": [