@ziggs-ai/api-client 0.42.11 → 0.42.13
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 +6 -0
- package/dist/capabilities/context.js +10 -10
- package/dist/http/BucketsClient.d.ts +2 -14
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.42.13
|
|
6
|
+
|
|
7
|
+
## 0.42.12
|
|
8
|
+
|
|
9
|
+
- `access_request` leaves which scope takes which permission to the server, which answers with its reason. A work ask (an agreement or one task) gets no 24-hour default: work lasts as long as its agreement, and a task hand-over does not time out. Reads still default to 24 hours.
|
|
10
|
+
|
|
5
11
|
## 0.42.11
|
|
6
12
|
|
|
7
13
|
- `page_guide` / `ziggs_page_guide` returns how to build a working page. `bucket_send`'s `page` field says to read it first.
|
|
@@ -423,7 +423,7 @@ export const accessRequestCapability = {
|
|
|
423
423
|
reason: { type: 'string', required: true, description: 'Why access is needed and who will receive the reply or summary' },
|
|
424
424
|
permission: { type: 'string', enum: ['read', 'work'], description: 'read by default. work: agreement work, or with scopeKind=task, that task.' },
|
|
425
425
|
temporal: { type: 'string', enum: ['from-start'], description: 'Retained resource access uses from-start; owner policy remains authoritative.' },
|
|
426
|
-
durationHours: { type: 'number', description: 'Integer 1–168 hours after approval; default 24' },
|
|
426
|
+
durationHours: { type: 'number', description: 'Integer 1–168 hours after approval; reads default to 24' },
|
|
427
427
|
// Not required here: the server requires it, and a request without it
|
|
428
428
|
// comes back refused with the people this agent may ask. Required in the
|
|
429
429
|
// schema, a host refused the call before that list could arrive.
|
|
@@ -466,14 +466,13 @@ export const accessRequestCapability = {
|
|
|
466
466
|
const permission = args.permission ?? 'read';
|
|
467
467
|
if (!['read', 'work'].includes(String(permission)))
|
|
468
468
|
throw new Error('permission must be read or work');
|
|
469
|
-
|
|
470
|
-
throw new Error('Only an agreement or a task may request work permission');
|
|
471
|
-
if (contact && args.permission !== undefined && permission !== 'read')
|
|
472
|
-
throw new Error('A contact request asks to send only; omit permission');
|
|
469
|
+
// Which scope takes which permission is the server's answer, with its reason.
|
|
473
470
|
if (args.temporal !== undefined && args.temporal !== 'from-start')
|
|
474
471
|
throw new Error('Retained resources use from-start access');
|
|
475
|
-
|
|
476
|
-
|
|
472
|
+
// A read lasts 24 hours unless asked otherwise. Work lasts as long as its
|
|
473
|
+
// agreement, or is a hand-over that never times out, so it gets no default.
|
|
474
|
+
const durationHours = args.durationHours ?? (permission === 'work' ? undefined : 24);
|
|
475
|
+
if (durationHours !== undefined && (typeof durationHours !== 'number' || !Number.isInteger(durationHours) || durationHours < 1 || durationHours > 168))
|
|
477
476
|
throw new Error('durationHours must be an integer between 1 and 168');
|
|
478
477
|
const holders = args.holders === undefined ? undefined : readersOf(args.holders);
|
|
479
478
|
if (holders && contact && holders.length !== 1)
|
|
@@ -497,9 +496,10 @@ export const accessRequestCapability = {
|
|
|
497
496
|
const creds = fullCreds(env);
|
|
498
497
|
const result = await new ContextGrantsClient(creds.operatorKey, creds.agentId, env.baseUrl).requestAccess({
|
|
499
498
|
scopeKind, scopeId, agreementId, reason: String(args.reason).trim(),
|
|
500
|
-
// A contact request carries no permission
|
|
501
|
-
|
|
502
|
-
|
|
499
|
+
// A contact request carries no permission unless the caller named one;
|
|
500
|
+
// the server makes it send-only and refuses any other with its reason.
|
|
501
|
+
...(contact && args.permission === undefined ? {} : { permission: permission }), temporal: args.temporal,
|
|
502
|
+
...(durationHours !== undefined ? { durationHours: durationHours } : {}),
|
|
503
503
|
recipientId: typeof args.recipientId === 'string' ? args.recipientId.trim() : undefined,
|
|
504
504
|
...(holders ? { holders } : {}),
|
|
505
505
|
...(contributionTo ? { contributionTo } : {}),
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
import { BUCKET_ITEM_KINDS, type BucketAddMembersResult, type BucketContents, type BucketInsertResult, type BucketItemKind, type BucketItemPage, type BucketItemRef, type BucketMisfit, type BucketShare, type BucketThread, type BucketView, type MessageCommand, type MessageCommandResult } from '@ziggs-ai/contracts';
|
|
1
|
+
import { BUCKET_ITEM_KINDS, type BucketAddMembersResult, type BucketContents, type BucketInsertResult, type BucketItemKind, type BucketItemPage, type BucketItemRef, type BucketJoinResult, type BucketMisfit, type BucketMisfitChoice, type BucketShare, type BucketThread, type BucketView, type MessageCommand, type MessageCommandResult } from '@ziggs-ai/contracts';
|
|
2
2
|
export { BUCKET_ITEM_KINDS };
|
|
3
|
-
export type { BucketAddMembersResult, BucketContents, BucketInsertResult, BucketItemKind, BucketItemPage, BucketItemRef, BucketMisfit, BucketShare, BucketThread, BucketView, };
|
|
4
|
-
/**
|
|
5
|
-
* What to do when someone being added cannot read an item: share it with
|
|
6
|
-
* them, or split: start a narrower bucket with them and only what everyone
|
|
7
|
-
* can read, leaving this one as it is.
|
|
8
|
-
*/
|
|
9
|
-
export type BucketMisfitChoice = 'share' | 'split';
|
|
10
|
-
export interface BucketJoinResult {
|
|
11
|
-
bucket: BucketView;
|
|
12
|
-
added: string[];
|
|
13
|
-
joined: BucketItemRef[];
|
|
14
|
-
shared: BucketShare[];
|
|
15
|
-
}
|
|
3
|
+
export type { BucketAddMembersResult, BucketContents, BucketInsertResult, BucketItemKind, BucketItemPage, BucketItemRef, BucketJoinResult, BucketMisfit, BucketMisfitChoice, BucketShare, BucketThread, BucketView, };
|
|
16
4
|
/**
|
|
17
5
|
* A message sent inside a bucket: its readers are the bucket's people, and for
|
|
18
6
|
* a reply that names the message it answers, those who read that message and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ziggs-ai/api-client",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.13",
|
|
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.
|
|
34
|
+
"@ziggs-ai/contracts": "0.50.12",
|
|
35
35
|
"socket.io-client": "^4.7.0"
|
|
36
36
|
},
|
|
37
37
|
"keywords": [
|