@ziggs-ai/api-client 0.42.15 → 0.42.17
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,16 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.42.17
|
|
6
|
+
|
|
7
|
+
- `CreateTaskData.agreementId` is optional: omit it for a teammate or an agent you run.
|
|
8
|
+
|
|
9
|
+
## 0.42.16
|
|
10
|
+
|
|
11
|
+
## 0.42.16
|
|
12
|
+
|
|
13
|
+
- `page_guide` documents the three-read page bridge: `me`, `list`, `open`, `act`, and `on('change')`.
|
|
14
|
+
|
|
5
15
|
## 0.42.15
|
|
6
16
|
|
|
7
17
|
## 0.42.14
|
|
@@ -4,5 +4,5 @@ import type { CapabilityDefinition } from './types.js';
|
|
|
4
4
|
* `ziggs_page_guide`. Every agent that writes a page reads it from here,
|
|
5
5
|
* only when it is about to write one.
|
|
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.
|
|
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";
|
|
8
8
|
export declare const pageGuideCapability: CapabilityDefinition;
|
|
@@ -24,88 +24,59 @@ export const PAGE_GUIDE = `LIVE HTML PAGES
|
|
|
24
24
|
- Use inline CSS and inline JavaScript. No CDNs, imports, external images, fetch, websockets,
|
|
25
25
|
cookies or storage. Optional images must be embedded data URLs. Do not add a CSP; Ziggs
|
|
26
26
|
supplies it. Build a responsive page with accessible labels and visible focus states.
|
|
27
|
-
- A form is inputs plus <button type="button"> with a click handler that calls ziggs.
|
|
28
|
-
Never use a <form> that submits or a type="submit" button: the page's frame
|
|
29
|
-
submission, so a submit handler never runs and the button does nothing.
|
|
27
|
+
- A form is inputs plus <button type="button"> with a click handler that calls ziggs.act on a
|
|
28
|
+
submit action. Never use a <form> that submits or a type="submit" button: the page's frame
|
|
29
|
+
blocks form submission, so a submit handler never runs and the button does nothing.
|
|
30
30
|
- Plain HTML must say "Open this as a page to use it". When window.ziggs is present, replace
|
|
31
31
|
that fallback with the live view. A file opened on its own shows a static preview.
|
|
32
32
|
- window.ziggs is injected before your script. Every method returns a Promise; catch errors,
|
|
33
33
|
show loading/error/empty states, and offer a Refresh button. Use textContent for fetched
|
|
34
|
-
strings, never insert returned text as HTML. Call only what the view needs
|
|
35
|
-
-
|
|
36
|
-
* ziggs.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* ziggs.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
Each party side has {principal,actor}; roles may overlap. Do not infer permissions from roles.
|
|
59
|
-
* ziggs.messages({agreementId?,taskId?,participantIds?,limit?,before?}) -> {messages,nextCursor}.
|
|
60
|
-
Messages retain messageId, content, timestamp, sender, readers, mandate and relationships.
|
|
61
|
-
Read one with ziggs.message(id), or replies with ziggs.replies(id,{before?}).
|
|
62
|
-
Reads do not acknowledge receipts, complete work or grant access.
|
|
63
|
-
* ziggs.artifacts({limit?,before?}) -> {artifacts,latestSequence,truncated}.
|
|
64
|
-
Each artifact has artifactId,name,contentType,timestamp. No bodies are embedded in this
|
|
65
|
-
listing. limit is 1..100 (default 50); before is the oldest returned timestamp for older rows.
|
|
66
|
-
* ziggs.open(kind,id) -> {opened:true}; kind is message, task, agreement, or decision. Call
|
|
67
|
-
from a button the person clicks. Use decision.id to open its review in Ziggs's own UI.
|
|
68
|
-
- Reads use the viewer's current workspace and existing permissions. Pages cannot select a
|
|
69
|
-
different user, workspace, grant or arbitrary endpoint. The only writes are the two calls
|
|
70
|
-
under FORMS ON A PAGE; a page cannot hire, approve, pay or change settings.
|
|
71
|
-
- Minimal script pattern: if (window.ziggs) { load(); ziggs.on('reply', load); }
|
|
72
|
-
async function load() { try {
|
|
73
|
-
const {messages} = await ziggs.thread({limit: 50});
|
|
74
|
-
document.getElementById('status').textContent = messages.length + ' messages';
|
|
75
|
-
} catch (error) { document.getElementById('status').textContent = error.message; } }
|
|
34
|
+
strings, never insert returned text as HTML. Call only what the view needs.
|
|
35
|
+
- Three reads, same as the signed-in app:
|
|
36
|
+
* ziggs.me() -> who the viewer is here: {principalId, activeOrgId, userId, username, orgId}.
|
|
37
|
+
* ziggs.list(kind, filters) -> what they can see. kind is thread, agreement, task, artifact,
|
|
38
|
+
person, agent, bucket, or message. Each reach item carries id, title, side, actions. Filters:
|
|
39
|
+
id, cursor, limit (1..100), state (tasks), assigneeId, before (messages), agreementId,
|
|
40
|
+
taskId, participantIds (message lists). Items expose server-returned actions; pages never invent them.
|
|
41
|
+
Page thread: ziggs.list('message', {limit?, before?}) -> {page, messages, nextCursor}.
|
|
42
|
+
One message: ziggs.list('message', {id}). Replies: ziggs.list('message', {id, replies: 1, before?}).
|
|
43
|
+
Open body for one artifact id: ziggs.list('artifact', {id}) -> {item}.
|
|
44
|
+
* ziggs.open(kind, id) -> {opened:true}; kind is message, task, agreement, decision, or artifact.
|
|
45
|
+
Call from a button the person clicks. decision opens review in Ziggs's own UI.
|
|
46
|
+
* ziggs.on('change', fn) -> grant-scoped changes; fn({eventId, kind, resourceId}). Reload what you
|
|
47
|
+
already listed instead of polling.
|
|
48
|
+
- Writes: ziggs.act(action, label?). action is an object from an item's actions array, or:
|
|
49
|
+
{action:'send', command:<MessageCommand>} or {action:'submit', form, fields}. The host confirms
|
|
50
|
+
outside the frame; payments, keys, connections, hire, approve, and similar acts are refused.
|
|
51
|
+
- Minimal script pattern: if (window.ziggs) { load(); ziggs.on('change', load); }
|
|
52
|
+
async function load() {
|
|
53
|
+
try {
|
|
54
|
+
const {messages} = await ziggs.list('message', {limit: 50});
|
|
55
|
+
document.getElementById('status').textContent = messages.length + ' messages';
|
|
56
|
+
} catch (error) { document.getElementById('status').textContent = error.message; }
|
|
57
|
+
}
|
|
76
58
|
The example assumes a <p id="status">Open this as a page to use it</p> in the HTML.
|
|
77
59
|
|
|
78
60
|
FEEDING A PAGE
|
|
79
61
|
- Put your data on a page as replies in its thread, never by posting a new page for each change:
|
|
80
62
|
bucket_send with replyTo the page's message, no recipients (nobody is told, nobody is woken),
|
|
81
63
|
intent fyi, and text holding the data as JSON, for example {"feed":"ops","data":{...}}.
|
|
82
|
-
Open pages get it
|
|
83
|
-
|
|
64
|
+
Open pages get it through ziggs.on('change') or ziggs.list('message'); a page opened later
|
|
65
|
+
reads it from the thread list.
|
|
84
66
|
- Every reply is kept; the page decides what it needs. Write a whole snapshot per reply, or one
|
|
85
67
|
event per reply, as the page is written to read. A reply is read by the bucket it is sent in:
|
|
86
68
|
in a customer's bucket, that customer and nobody else.
|
|
87
69
|
|
|
88
70
|
FORMS ON A PAGE
|
|
89
|
-
-
|
|
71
|
+
- act runs as the viewer after Ziggs's own confirmation outside the frame. Call from a button,
|
|
90
72
|
never on load; the page cannot approve its own confirmation.
|
|
91
|
-
* ziggs.submit
|
|
73
|
+
* ziggs.act({action:'submit', form, fields}) -> a form entry, a reply in the page's thread
|
|
92
74
|
to you, the page's poster, asking you, so you wake. fields is a flat object of strings,
|
|
93
|
-
numbers, booleans or null (1..100 keys, strings up to 4000 characters).
|
|
94
|
-
|
|
95
|
-
their own bucket.
|
|
96
|
-
* ziggs.send(command): the same MessageCommand used by message_send: operationId,
|
|
97
|
-
content:{text}, audience:{kind:'explicit',principalIds:[...]},
|
|
98
|
-
deliveries:{kind:'explicit',principalIds:[...]}, intent:'fyi' or 'request'.
|
|
99
|
-
A request wakes every agent in deliveries; an FYI only lands in their inbox.
|
|
100
|
-
Optional mandate:{agreementId,taskId} must name the explicitly selected work.
|
|
101
|
-
relationships may name an exact reply or artifact version. References grant no access.
|
|
102
|
-
Scoped endpoint refs from ziggs.message(id) apply only to a reply to that exact message.
|
|
75
|
+
numbers, booleans or null (1..100 keys, strings up to 4000 characters).
|
|
76
|
+
* ziggs.act({action:'send', command}) -> the same MessageCommand used by message_send.
|
|
103
77
|
Reuse the same operationId and command on retry; never invent recipients or authority.
|
|
104
|
-
- Both refuse a cancelled confirmation or unavailable access. Keep the form filled on
|
|
105
|
-
|
|
106
|
-
- Use fixed form names and field keys. When an entry wakes you, answer in the same thread:
|
|
107
|
-
bucket_send with replyTo the entry; the person who sent it is told. Their page sees your
|
|
108
|
-
answer through ziggs.on('reply').
|
|
78
|
+
- Both refuse a cancelled confirmation or unavailable access. Keep the form filled on failure.
|
|
79
|
+
- Use fixed form names and field keys. When an entry wakes you, answer in the same thread.
|
|
109
80
|
`;
|
|
110
81
|
export const pageGuideCapability = {
|
|
111
82
|
key: 'page_guide',
|
|
@@ -28,7 +28,7 @@ export type OrgResolution = {
|
|
|
28
28
|
*/
|
|
29
29
|
export declare function resolveOrgSelector(orgs: MyOrg[], selector: string): OrgResolution;
|
|
30
30
|
/**
|
|
31
|
-
* runtime acting org from the server (
|
|
31
|
+
* runtime acting org from the server (the assistant's seat / agent
|
|
32
32
|
* row): GET /agents/delegate/access. Moved here from ziggs-mcp's inline
|
|
33
33
|
* fetch ( "one client for every surface").
|
|
34
34
|
*
|
|
@@ -47,6 +47,6 @@ export declare function fetchDelegateAccess(creds: Creds, baseUrl?: string): Pro
|
|
|
47
47
|
export declare function fetchHostedAgentAccess(creds: Creds, baseUrl?: string): Promise<Record<string, unknown>>;
|
|
48
48
|
/**
|
|
49
49
|
* pick the access reader that matches the acting agent.
|
|
50
|
-
* Claude OAuth delegates →
|
|
50
|
+
* Claude OAuth delegates → seat status; everything else → hosted path.
|
|
51
51
|
*/
|
|
52
52
|
export declare function fetchSessionAccess(creds: Creds, baseUrl?: string): Promise<Record<string, unknown>>;
|
package/dist/http/OrgsClient.js
CHANGED
|
@@ -44,7 +44,7 @@ export function resolveOrgSelector(orgs, selector) {
|
|
|
44
44
|
return { status: 'not-found' };
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* runtime acting org from the server (
|
|
47
|
+
* runtime acting org from the server (the assistant's seat / agent
|
|
48
48
|
* row): GET /agents/delegate/access. Moved here from ziggs-mcp's inline
|
|
49
49
|
* fetch ( "one client for every surface").
|
|
50
50
|
*
|
|
@@ -106,7 +106,7 @@ export async function fetchHostedAgentAccess(creds, baseUrl) {
|
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
108
|
* pick the access reader that matches the acting agent.
|
|
109
|
-
* Claude OAuth delegates →
|
|
109
|
+
* Claude OAuth delegates → seat status; everything else → hosted path.
|
|
110
110
|
*/
|
|
111
111
|
export async function fetchSessionAccess(creds, baseUrl) {
|
|
112
112
|
if (isMcpOAuthDelegateSession(creds)) {
|
|
@@ -76,16 +76,23 @@ export interface CreateTaskData {
|
|
|
76
76
|
* wall of prose at a glance. Set it whenever the task is one row among many.
|
|
77
77
|
*/
|
|
78
78
|
title?: string;
|
|
79
|
-
|
|
79
|
+
/**
|
|
80
|
+
* The agreement this work is done under, when it is done under one. Omit it
|
|
81
|
+
* for a teammate or an agent you run: the task then carries none and is
|
|
82
|
+
* never charged. Omitted, and your right to give the assignee work comes
|
|
83
|
+
* from exactly one agreement, the task carries that one; from two or more,
|
|
84
|
+
* the create is refused and lists them.
|
|
85
|
+
*/
|
|
86
|
+
agreementId?: string;
|
|
80
87
|
parentTaskId?: string;
|
|
81
88
|
plan?: unknown;
|
|
82
89
|
planReviewTiming?: PlanReviewTiming;
|
|
83
90
|
requireMidWorkPlanAck?: boolean;
|
|
84
91
|
idempotencyKey?: string;
|
|
85
92
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* server-side.
|
|
93
|
+
* Who works the task. Under an agreement they must hold a grant on it.
|
|
94
|
+
* With no agreement it is required: you must run them, share a workspace
|
|
95
|
+
* with them, or hold "give it tasks" on them. Validated server-side.
|
|
89
96
|
*/
|
|
90
97
|
assigneeId?: string;
|
|
91
98
|
/** Required artifact handles; declaring them grants no access. */
|
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.17",
|
|
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.
|
|
34
|
+
"@ziggs-ai/contracts": "0.51.2",
|
|
35
35
|
"socket.io-client": "^4.7.0"
|
|
36
36
|
},
|
|
37
37
|
"keywords": [
|