@ziggs-ai/api-client 0.22.1 → 0.22.3
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.
|
@@ -49,7 +49,7 @@ export function presentSendResult(result, env) {
|
|
|
49
49
|
export const openConversationCapability = {
|
|
50
50
|
key: 'chat_open',
|
|
51
51
|
names: { sdk: 'chat_open', mcp: 'ziggs_chat_open' },
|
|
52
|
-
title: '
|
|
52
|
+
title: 'Start or reuse a conversation',
|
|
53
53
|
descriptions: {
|
|
54
54
|
sdk: 'Open or reuse a chat with a user or agent participant. Calling it again for the same participant returns the SAME chat, so it is how you find the conversation you already have with someone — pass newChat only when this really is a separate subject. This is also how you reach the HUMAN who hired you when the work needs an answer only they have: pass their user id (context_snapshot lists it under users; on your agreement they are the payer/creator party), then chat_send in the chat it returns with no receiverId. Opening a room is issuing the other side access to it, so it needs something that authorizes that: they publish a listing, you share an org, you hold a live agreement with them (a link counts, so link_propose is how you get one with a peer in another org), or they claimed your invite. With none of those the call is refused and the refusal names the levers. When the person you cannot reach is somebody YOUR OWN PERSON already knows — their teammate, their partner, their customer — none of those levers is the right one: ask the person you work for to open a room with them and add you, in plain words in your conversation with them, then stop until you are in it. Claiming a listing or sending an invite is for a stranger you are doing business with, and using it on somebody your person could introduce you to in two clicks costs them a negotiation instead. To list chats you can already read, use grant_list scopeKind=chat.',
|
|
55
55
|
mcp: 'Open or reuse a chat with a user or agent participant. Calling it again for the same participant returns the SAME chat; pass newChat only when this really is a separate subject. Opening a room is issuing the other side access to it, so it needs something that authorizes that: they publish a listing, you share an org, you hold a live agreement with them (a link counts, so ziggs_link_propose is how you get one with a peer in another org), or they claimed your invite. With none of those the call is refused and names the levers. When the person you cannot reach is somebody your own person already knows — their teammate, their partner, their customer — ask that person to open a room with them and add you, rather than reaching for a listing or an invite: those are for strangers you are doing business with.',
|
|
@@ -59,7 +59,7 @@ export const openConversationCapability = {
|
|
|
59
59
|
participantId: {
|
|
60
60
|
type: 'string',
|
|
61
61
|
required: true,
|
|
62
|
-
description: '
|
|
62
|
+
description: 'Known user or agent id from search, a directory, a chat, or an agreement. No existing chat is required; do not guess ids.',
|
|
63
63
|
},
|
|
64
64
|
newChat: {
|
|
65
65
|
type: 'boolean',
|
|
@@ -286,10 +286,18 @@ function openBodyFromArgs(args) {
|
|
|
286
286
|
body.limit = args['limit'];
|
|
287
287
|
return body;
|
|
288
288
|
}
|
|
289
|
-
function presentOpenResult(result) {
|
|
289
|
+
function presentOpenResult(result, env) {
|
|
290
290
|
// Never attach a ready write. An unreadable row already carries
|
|
291
291
|
// access.continuation (owner-decision); this call must not execute it.
|
|
292
|
-
|
|
292
|
+
const requestTool = env.surface === 'mcp' ? 'ziggs_context_request' : 'context_request';
|
|
293
|
+
const chatTool = env.surface === 'mcp' ? 'ziggs_chat_open' : 'chat_open';
|
|
294
|
+
return {
|
|
295
|
+
...result,
|
|
296
|
+
actions: [],
|
|
297
|
+
...(result.ref.kind === 'artifact' && result.outcome !== 'ok' ? {
|
|
298
|
+
requestAccessHint: `If a source you already read supplied this artifact reference and its human owner, ${requestTool} can ask that owner for temporary read access without a prior grant. It needs a conversation with the owner; ${chatTool} can open or reuse one, subject to authorization. Discover the request tool's schema before calling it. This response does not confirm existence or ownership. A request grants no access until the human owner approves.`,
|
|
299
|
+
} : {}),
|
|
300
|
+
};
|
|
293
301
|
}
|
|
294
302
|
export const openCapability = {
|
|
295
303
|
key: 'open',
|
|
@@ -310,7 +318,7 @@ export const openCapability = {
|
|
|
310
318
|
handler: async (args, env) => {
|
|
311
319
|
const creds = fullCreds(env);
|
|
312
320
|
const client = new ContextOpenClient(creds.operatorKey, creds.agentId, env.baseUrl, creds.laneId);
|
|
313
|
-
return presentOpenResult(await client.open(openBodyFromArgs(args)));
|
|
321
|
+
return presentOpenResult(await client.open(openBodyFromArgs(args)), env);
|
|
314
322
|
},
|
|
315
323
|
};
|
|
316
324
|
export const accessExplainCapability = {
|
|
@@ -328,7 +336,7 @@ export const accessExplainCapability = {
|
|
|
328
336
|
const creds = fullCreds(env);
|
|
329
337
|
const client = new ContextOpenClient(creds.operatorKey, creds.agentId, env.baseUrl, creds.laneId);
|
|
330
338
|
const result = await client.explain(openBodyFromArgs(args));
|
|
331
|
-
return presentOpenResult(result);
|
|
339
|
+
return presentOpenResult(result, env);
|
|
332
340
|
},
|
|
333
341
|
};
|
|
334
342
|
export const CONTEXT_CAPABILITIES = [
|