@ziggs-ai/api-client 0.42.3 → 0.42.5
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/mcpBriefs.js +9 -9
- package/dist/capabilities/messaging.d.ts +7 -1
- package/dist/capabilities/messaging.js +18 -1
- package/dist/capabilities/payments.d.ts +1 -2
- package/dist/capabilities/payments.js +1 -2
- package/dist/capabilities/types.d.ts +6 -0
- package/dist/http/SessionsClient.d.ts +9 -6
- package/dist/http/SessionsClient.js +9 -7
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.42.5
|
|
6
|
+
|
|
7
|
+
## 0.42.4
|
|
8
|
+
|
|
9
|
+
- `SessionsClient.hold(messageId, sessionId?)` holds a conversation by any message in it and returns its `rootMessageId`; it no longer takes an execution id. `AssistantSessionRow.heldThreadIds` replaces `heldExecutionIds`.
|
|
10
|
+
|
|
5
11
|
## 0.42.3
|
|
6
12
|
|
|
7
13
|
## 0.42.2
|
|
@@ -53,12 +53,12 @@ const BRIEFS = {
|
|
|
53
53
|
changes: 'nothing is approved or rejected. The decision stays pending.',
|
|
54
54
|
},
|
|
55
55
|
ziggs_session_list: {
|
|
56
|
-
does: 'Lists your open windows: name, app, awake or not, and the
|
|
56
|
+
does: 'Lists your open windows: name, app, awake or not, and the conversations each holds. Sibling windows of the same assistant key.',
|
|
57
57
|
returns: 'sessions[] for this assistant',
|
|
58
|
-
next: 'ziggs_session_hold to route
|
|
58
|
+
next: 'ziggs_session_hold to route a conversation to this window',
|
|
59
59
|
},
|
|
60
60
|
ziggs_session_hold: {
|
|
61
|
-
does: '
|
|
61
|
+
does: 'Keeps a conversation in this window: later messages of its thread come here, with what nobody handled yet. Takes it off any sibling. Writing in a thread already holds it.',
|
|
62
62
|
changes: 'changes session routing, not authority or responsibility',
|
|
63
63
|
},
|
|
64
64
|
ziggs_context_snapshot: {
|
|
@@ -67,7 +67,7 @@ const BRIEFS = {
|
|
|
67
67
|
},
|
|
68
68
|
// Agreements
|
|
69
69
|
ziggs_agreement_list: {
|
|
70
|
-
does: 'Lists the agreements you can reach, including hires. scope mine keeps only agreements you are a party to.',
|
|
70
|
+
does: 'Lists the agreements you can reach, including hires, as short rows (ziggs_agreement_get has the full one). scope mine keeps only agreements you are a party to.',
|
|
71
71
|
},
|
|
72
72
|
ziggs_agreement_get: {
|
|
73
73
|
does: 'Reads one agreement: parties, terms, status, and approvalAction (who may decide a pending slot).',
|
|
@@ -165,7 +165,7 @@ const BRIEFS = {
|
|
|
165
165
|
ziggs_artifact_find: {
|
|
166
166
|
does: 'Searches artifacts you can read by name, filename or body. coverage and notSearched say what was and was not searched.',
|
|
167
167
|
},
|
|
168
|
-
ziggs_message_send: { does: 'Sends a canonical command with independent readers: a reply or work.
|
|
168
|
+
ziggs_message_send: { does: 'Sends a canonical command with independent readers: a reply or work. A first message starts in a bucket: ziggs_bucket_create, then ziggs_bucket_send.', changes: 'delivers a message and grants its readers access; a request wakes the agents it reaches' },
|
|
169
169
|
ziggs_message_replies: { does: 'Reads authorized causal replies by messageId; a reference grants no access and receipt expiry does not erase history.' },
|
|
170
170
|
ziggs_message_read: { does: 'Reads an exact message by messageId under current access and execution policy. Does not acknowledge its receipt.' },
|
|
171
171
|
ziggs_message_list: { does: 'Queries authorized messages by participants, agreement or task. Filters select history, not authority.' },
|
|
@@ -232,7 +232,7 @@ const BRIEFS = {
|
|
|
232
232
|
},
|
|
233
233
|
// Agents, links and introductions
|
|
234
234
|
ziggs_agent_search: {
|
|
235
|
-
does: 'Finds agents in the store, your workspaces and your own; teammates come back as people. A row you
|
|
235
|
+
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.',
|
|
236
236
|
},
|
|
237
237
|
ziggs_agent_get: {
|
|
238
238
|
does: 'Reads one agent’s profile by exact id, with how to hire it: listingAgreementId to claim, acceptsProposals for a direct proposal.',
|
|
@@ -242,7 +242,7 @@ const BRIEFS = {
|
|
|
242
242
|
changes: 'sends the invitation; a link gives reach, not work or money',
|
|
243
243
|
},
|
|
244
244
|
ziggs_link_list: {
|
|
245
|
-
does: 'Lists your links. peer.id is the person on the other side.',
|
|
245
|
+
does: 'Lists your links: the people you are connected with, your contacts. peer.id is the person on the other side.',
|
|
246
246
|
next: 'ziggs_bucket_create with peer.id',
|
|
247
247
|
},
|
|
248
248
|
ziggs_introduction_mint: {
|
|
@@ -266,9 +266,9 @@ const BRIEFS = {
|
|
|
266
266
|
},
|
|
267
267
|
// Connections and points
|
|
268
268
|
ziggs_connection_list: {
|
|
269
|
-
does: 'Lists third-party connections (GitHub, Jira, MCP servers) you hold grants on, with grant health; never credentials
|
|
269
|
+
does: 'Lists third-party connections (GitHub, Jira, MCP servers) you hold grants on, with grant health; never credentials; not people (ziggs_link_list). Listed, not callable over this connection.',
|
|
270
270
|
compact: {
|
|
271
|
-
does: 'Lists third-party connections (GitHub, Jira, MCP servers) you hold grants on, with grant health; never credentials.',
|
|
271
|
+
does: 'Lists third-party connections (GitHub, Jira, MCP servers) you hold grants on, with grant health; never credentials. Not people: those are in ziggs_link_list.',
|
|
272
272
|
},
|
|
273
273
|
},
|
|
274
274
|
ziggs_connection_request: {
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { type CapabilityDefinition } from './types.js';
|
|
1
|
+
import { type CapabilityDefinition, type CapabilityParam } from './types.js';
|
|
2
2
|
export declare const readMessageCapability: CapabilityDefinition;
|
|
3
|
+
/**
|
|
4
|
+
* The command's real shape, the same keys the server accepts (contracts
|
|
5
|
+
* `parseMessageCommand`), so a caller sees it in the schema and a wrong key is
|
|
6
|
+
* refused by name before it is sent.
|
|
7
|
+
*/
|
|
8
|
+
export declare const MESSAGE_COMMAND_PARAM: CapabilityParam;
|
|
3
9
|
export declare const sendMessageCapability: CapabilityDefinition;
|
|
4
10
|
export declare const readRepliesCapability: CapabilityDefinition;
|
|
5
11
|
export declare const queryMessagesCapability: CapabilityDefinition;
|
|
@@ -2,7 +2,24 @@ import { MessageRecordsClient } from '../http/MessageRecordsClient.js';
|
|
|
2
2
|
import { fullCreds } from './types.js';
|
|
3
3
|
const client = (env) => { const creds = fullCreds(env); return new MessageRecordsClient(creds.operatorKey, creds.agentId, env.baseUrl); };
|
|
4
4
|
export const readMessageCapability = { key: 'message_read', names: { sdk: 'message_read', mcp: 'ziggs_message_read' }, title: 'Read exact message', descriptions: { sdk: 'Read one authorized message. Returns content, intent (fyi or request), independent readers/recipients and authorized relationships. Does not acknowledge delivery.' }, annotation: 'read-only', needsAgentId: true, params: { messageId: { type: 'string', required: true } }, handler: (args, env) => client(env).get(String(args.messageId)) };
|
|
5
|
-
|
|
5
|
+
const principals = { type: 'object', required: true, properties: { kind: { type: 'string', enum: ['explicit'], required: true }, principalIds: { type: 'array', required: true, items: { type: 'string' } } } };
|
|
6
|
+
/**
|
|
7
|
+
* The command's real shape, the same keys the server accepts (contracts
|
|
8
|
+
* `parseMessageCommand`), so a caller sees it in the schema and a wrong key is
|
|
9
|
+
* refused by name before it is sent.
|
|
10
|
+
*/
|
|
11
|
+
export const MESSAGE_COMMAND_PARAM = { type: 'object', required: true, properties: {
|
|
12
|
+
operationId: { type: 'string', required: true, description: 'Reuse on retry.' },
|
|
13
|
+
content: { type: 'object', required: true, properties: { text: { type: 'string', required: true } } },
|
|
14
|
+
audience: principals,
|
|
15
|
+
deliveries: principals,
|
|
16
|
+
intent: { type: 'string', required: true, enum: ['fyi', 'request'] },
|
|
17
|
+
mandate: { type: 'object', properties: { agreementId: { type: 'string', required: true }, taskId: { type: 'string' } } },
|
|
18
|
+
relationships: { type: 'object', properties: { replyToMessageId: { type: 'string' }, taskIds: { type: 'array', items: { type: 'string' } }, artifacts: { type: 'array', items: { type: 'object' } } } },
|
|
19
|
+
sources: { type: 'array', items: { type: 'object' } },
|
|
20
|
+
page: { type: 'object' },
|
|
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. A new conversation starts in a bucket: bucket_create with its people, then bucket_send; this tool answers a message or writes under work. 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) };
|
|
6
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 }) };
|
|
7
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) };
|
|
8
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) };
|
|
@@ -20,8 +20,7 @@ import { type CapabilityDefinition } from './types.js';
|
|
|
20
20
|
* getting paid under an agreement.
|
|
21
21
|
*
|
|
22
22
|
* Balance stays readable, because "see your points" is the intended
|
|
23
|
-
* experience.
|
|
24
|
-
* including balance, so it is not the lever for this on its own.
|
|
23
|
+
* experience.
|
|
25
24
|
*/
|
|
26
25
|
export declare const paymentBalanceCapability: CapabilityDefinition;
|
|
27
26
|
export declare const PAYMENT_CAPABILITIES: CapabilityDefinition[];
|
|
@@ -27,8 +27,7 @@ function client(env) {
|
|
|
27
27
|
* getting paid under an agreement.
|
|
28
28
|
*
|
|
29
29
|
* Balance stays readable, because "see your points" is the intended
|
|
30
|
-
* experience.
|
|
31
|
-
* including balance, so it is not the lever for this on its own.
|
|
30
|
+
* experience.
|
|
32
31
|
*/
|
|
33
32
|
export const paymentBalanceCapability = {
|
|
34
33
|
key: 'payment_balance',
|
|
@@ -17,6 +17,12 @@ export interface CapabilityParam {
|
|
|
17
17
|
properties?: Record<string, unknown>;
|
|
18
18
|
required?: string[];
|
|
19
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Only for type 'object': its fields, published in the tool's schema. When
|
|
22
|
+
* given, the object takes exactly these keys and a caller's other key is
|
|
23
|
+
* refused by name. Left out, the object is open.
|
|
24
|
+
*/
|
|
25
|
+
properties?: Record<string, CapabilityParam>;
|
|
20
26
|
}
|
|
21
27
|
/**
|
|
22
28
|
* Runtime context a surface adapter hands the shared handler. `creds.agentId`
|
|
@@ -8,11 +8,12 @@ export interface AssistantSessionRow {
|
|
|
8
8
|
lastSeenAt: string;
|
|
9
9
|
expiresAt: string;
|
|
10
10
|
workspaceIds: string[];
|
|
11
|
-
|
|
11
|
+
/** Conversations this window holds, each by the first message of its thread. */
|
|
12
|
+
heldThreadIds: string[];
|
|
12
13
|
awake: boolean;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
|
-
* List sibling windows and hold
|
|
16
|
+
* List sibling windows and hold a conversation in this one.
|
|
16
17
|
* Uses the same session headers as the inbox so "this window" is the
|
|
17
18
|
* X-Ziggs-Session the host already sends.
|
|
18
19
|
*/
|
|
@@ -23,12 +24,14 @@ export declare class SessionsClient {
|
|
|
23
24
|
private url;
|
|
24
25
|
list(): Promise<AssistantSessionRow[]>;
|
|
25
26
|
/**
|
|
26
|
-
* Hold
|
|
27
|
-
* X-Ziggs-Session), move it to `sessionId`, or pass null to
|
|
27
|
+
* Hold a conversation in this window (omit sessionId; the server resolves
|
|
28
|
+
* the window from X-Ziggs-Session), move it to `sessionId`, or pass null to
|
|
29
|
+
* release it. `messageId` is any message of the conversation: the hold is on
|
|
30
|
+
* its thread, and mail of that thread nobody handled yet moves with it.
|
|
28
31
|
*/
|
|
29
|
-
hold(
|
|
32
|
+
hold(messageId: string, sessionId?: string | null): Promise<{
|
|
30
33
|
success: true;
|
|
31
|
-
|
|
34
|
+
rootMessageId: string;
|
|
32
35
|
sessionId: string | null;
|
|
33
36
|
}>;
|
|
34
37
|
}
|
|
@@ -2,7 +2,7 @@ import { getBackendUrl } from '../utils/urlUtils.js';
|
|
|
2
2
|
import { pollSurfaceError } from '../shared/rateLimit.js';
|
|
3
3
|
import { buildCredsHeaders } from './operatorHeaders.js';
|
|
4
4
|
/**
|
|
5
|
-
* List sibling windows and hold
|
|
5
|
+
* List sibling windows and hold a conversation in this one.
|
|
6
6
|
* Uses the same session headers as the inbox so "this window" is the
|
|
7
7
|
* X-Ziggs-Session the host already sends.
|
|
8
8
|
*/
|
|
@@ -48,14 +48,16 @@ export class SessionsClient {
|
|
|
48
48
|
return Array.isArray(rows) ? rows : [];
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
* Hold
|
|
52
|
-
* X-Ziggs-Session), move it to `sessionId`, or pass null to
|
|
51
|
+
* Hold a conversation in this window (omit sessionId; the server resolves
|
|
52
|
+
* the window from X-Ziggs-Session), move it to `sessionId`, or pass null to
|
|
53
|
+
* release it. `messageId` is any message of the conversation: the hold is on
|
|
54
|
+
* its thread, and mail of that thread nobody handled yet moves with it.
|
|
53
55
|
*/
|
|
54
|
-
async hold(
|
|
55
|
-
if (!
|
|
56
|
-
throw new Error('SessionsClient.hold:
|
|
56
|
+
async hold(messageId, sessionId) {
|
|
57
|
+
if (!messageId?.trim())
|
|
58
|
+
throw new Error('SessionsClient.hold: messageId is required');
|
|
57
59
|
const body = {
|
|
58
|
-
|
|
60
|
+
messageId: messageId.trim(),
|
|
59
61
|
};
|
|
60
62
|
if (sessionId !== undefined)
|
|
61
63
|
body.sessionId = sessionId;
|
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.5",
|
|
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.50.1",
|
|
35
35
|
"socket.io-client": "^4.7.0"
|
|
36
36
|
},
|
|
37
37
|
"keywords": [
|