@ziggs-ai/api-client 0.38.2 → 0.39.1
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 +23 -0
- package/README.md +14 -36
- package/dist/capabilities/agreementVerbs.js +13 -21
- package/dist/capabilities/agreements.d.ts +2 -3
- package/dist/capabilities/agreements.js +7 -42
- package/dist/capabilities/artifacts.js +41 -43
- package/dist/capabilities/connections.js +10 -7
- package/dist/capabilities/context.d.ts +1 -1
- package/dist/capabilities/context.js +41 -45
- package/dist/capabilities/discovery.js +5 -5
- package/dist/capabilities/everyday.d.ts +1 -1
- package/dist/capabilities/everyday.js +1 -2
- package/dist/capabilities/index.d.ts +1 -2
- package/dist/capabilities/index.js +1 -2
- package/dist/capabilities/introductions.d.ts +1 -1
- package/dist/capabilities/introductions.js +3 -11
- package/dist/capabilities/links.d.ts +1 -9
- package/dist/capabilities/links.js +7 -28
- package/dist/capabilities/mcpBriefs.js +22 -28
- package/dist/capabilities/messaging.d.ts +9 -0
- package/dist/capabilities/messaging.js +11 -0
- package/dist/capabilities/nextCall.js +8 -17
- package/dist/capabilities/sources.d.ts +2 -3
- package/dist/capabilities/sources.js +1 -2
- package/dist/capabilities/tasks.js +1 -1
- package/dist/capabilities/toolLane.js +2 -2
- package/dist/engagementGuide.d.ts +2 -2
- package/dist/engagementGuide.js +6 -6
- package/dist/handles.d.ts +1 -1
- package/dist/handles.js +2 -2
- package/dist/http/AgreementClient.d.ts +17 -64
- package/dist/http/AgreementClient.js +14 -65
- package/dist/http/ArtifactsClient.d.ts +17 -19
- package/dist/http/ArtifactsClient.js +30 -62
- package/dist/http/ConnectionsClient.d.ts +6 -7
- package/dist/http/ConnectionsClient.js +5 -3
- package/dist/http/ContextDiscoveryClient.d.ts +2 -2
- package/dist/http/ContextGrantsClient.d.ts +8 -15
- package/dist/http/ContextGrantsClient.js +3 -5
- package/dist/http/ContextOpenClient.d.ts +5 -6
- package/dist/http/ContextOpenClient.js +11 -4
- package/dist/http/ContextReadClient.d.ts +23 -27
- package/dist/http/ContextReadClient.js +24 -23
- package/dist/http/ExecutionContextClient.d.ts +5 -1
- package/dist/http/ExecutionContextClient.js +48 -1
- package/dist/http/IntroductionsClient.d.ts +6 -4
- package/dist/http/MessageRecordsClient.d.ts +36 -0
- package/dist/http/MessageRecordsClient.js +30 -0
- package/dist/http/SessionsClient.d.ts +5 -5
- package/dist/http/SessionsClient.js +6 -6
- package/dist/http/TaskClient.d.ts +11 -5
- package/dist/http/TaskClient.js +11 -34
- package/dist/http/agreementFlows.d.ts +2 -3
- package/dist/http/agreementFlows.js +5 -5
- package/dist/http/index.d.ts +3 -5
- package/dist/http/index.js +3 -4
- package/dist/http/operatorHeaders.d.ts +3 -0
- package/dist/http/operatorHeaders.js +14 -5
- package/dist/inboxAck.d.ts +2 -2
- package/dist/inboxAck.js +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/types.d.ts +15 -55
- package/package.json +2 -2
- package/dist/capabilities/chat.d.ts +0 -43
- package/dist/capabilities/chat.js +0 -196
- package/dist/capabilities/chatListFields.d.ts +0 -14
- package/dist/capabilities/chatListFields.js +0 -61
- package/dist/http/ChatClient.d.ts +0 -187
- package/dist/http/ChatClient.js +0 -219
- package/dist/http/MessagesClient.d.ts +0 -40
- package/dist/http/MessagesClient.js +0 -81
|
@@ -53,16 +53,16 @@ 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 executions each holds. Sibling windows of the same assistant key.',
|
|
57
57
|
returns: 'sessions[] for this assistant',
|
|
58
|
-
next: 'ziggs_session_hold to
|
|
58
|
+
next: 'ziggs_session_hold to route an execution to this window',
|
|
59
59
|
},
|
|
60
60
|
ziggs_session_hold: {
|
|
61
|
-
does: '
|
|
62
|
-
changes: '
|
|
61
|
+
does: 'Routes an authorized execution to this window (the X-Ziggs-Session host). Removes its routing hint from siblings.',
|
|
62
|
+
changes: 'changes session routing, not authority or responsibility',
|
|
63
63
|
},
|
|
64
64
|
ziggs_context_snapshot: {
|
|
65
|
-
does: 'Reads
|
|
65
|
+
does: 'Reads authorized context for an explicit message, artifact, task or agreement.',
|
|
66
66
|
returns: 'a cursor for more messages',
|
|
67
67
|
},
|
|
68
68
|
// Agreements
|
|
@@ -120,32 +120,19 @@ const BRIEFS = {
|
|
|
120
120
|
does: 'Ends an agreement you provide, for good, once its whole scope is delivered. A finished task closes with ziggs_task_set_result instead.',
|
|
121
121
|
changes: 'revokes every grant it conferred; it cannot be reopened',
|
|
122
122
|
},
|
|
123
|
-
//
|
|
124
|
-
ziggs_chat_list: {
|
|
125
|
-
does: 'Lists rooms you hold a grant on, with last message and unread count, plus the rooms a person let you list, marked readable: false with no message and the read request to file. fields adds members or rosterSummary.',
|
|
126
|
-
},
|
|
127
|
-
ziggs_chat_open: {
|
|
128
|
-
does: 'Opens or reuses a conversation with a person or agent (participantId), starts a group (participantIds), or invites people into a room (chatId).',
|
|
129
|
-
changes: 'creates the room or invitation; sends no message',
|
|
130
|
-
next: 'ziggs_chat_send',
|
|
131
|
-
},
|
|
132
|
-
ziggs_chat_send: {
|
|
133
|
-
does: 'Sends a message as you into a room where you hold an active write grant; a refusal names what is missing. First contact goes through ziggs_chat_open.',
|
|
134
|
-
changes: 'delivers the message; it cannot be unsent',
|
|
135
|
-
},
|
|
136
|
-
// Reading context
|
|
123
|
+
// Resource context
|
|
137
124
|
ziggs_open: {
|
|
138
|
-
does: 'Reads
|
|
125
|
+
does: 'Reads an authorized resource by handle, URL or id, with available actions. Hidden and unknown look the same. For agreement messages use ziggs_message_list.',
|
|
139
126
|
},
|
|
140
127
|
ziggs_access_explain: {
|
|
141
|
-
does: 'Explains what you may do with one
|
|
128
|
+
does: 'Explains what you may do with one resource, and the recovery calls; runs none of them.',
|
|
142
129
|
},
|
|
143
130
|
ziggs_context_read: {
|
|
144
|
-
does: 'Reads
|
|
131
|
+
does: 'Reads artifacts, agreements or tasks via agreement:, task: or artifact:<id>. Use ziggs_message_read for exact messages. Preserves selected work and resource scope.',
|
|
145
132
|
returns: 'a readPlan with the next call pre-filled',
|
|
146
133
|
},
|
|
147
134
|
ziggs_context_expand_reach: {
|
|
148
|
-
does: 'Lists
|
|
135
|
+
does: 'Lists resource references covered by a grant you hold, as labels only.',
|
|
149
136
|
},
|
|
150
137
|
ziggs_context_discover_grantable: {
|
|
151
138
|
does: 'Lists context in workspaces you work in that you cannot read yet, as labels only.',
|
|
@@ -156,7 +143,7 @@ const BRIEFS = {
|
|
|
156
143
|
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.',
|
|
157
144
|
},
|
|
158
145
|
ziggs_access_request: {
|
|
159
|
-
does: '
|
|
146
|
+
does: 'Requests access to a specific resource. recipientId names the approver; refusals list eligible approvers. No conversation is needed.',
|
|
160
147
|
changes: 'creates a pending approval; grants nothing until approved',
|
|
161
148
|
},
|
|
162
149
|
ziggs_context_delegate: {
|
|
@@ -182,6 +169,13 @@ const BRIEFS = {
|
|
|
182
169
|
does: 'Shares one artifact you authored with another agent.',
|
|
183
170
|
changes: 'grants it at once to a connected agent; otherwise asks your owner to approve (pending_approval)',
|
|
184
171
|
},
|
|
172
|
+
ziggs_message_send: { does: 'Sends a canonical command with independent readers, recipients, answer effect and optional mandate.', changes: 'delivers a message and grants its readers access' },
|
|
173
|
+
ziggs_message_replies: { does: 'Reads authorized causal replies by messageId; a reference grants no access and receipt expiry does not erase history.' },
|
|
174
|
+
ziggs_message_read: { does: 'Reads an exact message by messageId under current access and execution policy. Does not acknowledge its receipt.' },
|
|
175
|
+
ziggs_message_list: { does: 'Queries authorized messages by participants, agreement or task. Filters select history, not authority.' },
|
|
176
|
+
ziggs_message_controls: { does: 'Inspects recipients and authority for an explicit agreement or task without reading history.' },
|
|
177
|
+
ziggs_message_answers: { does: 'Reads durable answer requests and their outcomes independently of inbox acknowledgment.' },
|
|
178
|
+
ziggs_message_answer_cancel: { does: 'Cancels one exact pending answer request as its author.', changes: 'closes the request without deleting history or cancelling tasks' },
|
|
185
179
|
ziggs_task_delegate: {
|
|
186
180
|
does: 'Delegates work, returns a child output, or rechecks readiness.',
|
|
187
181
|
changes: 'creates or returns isolated work',
|
|
@@ -196,8 +190,8 @@ const BRIEFS = {
|
|
|
196
190
|
changes: 'attaches that output once',
|
|
197
191
|
},
|
|
198
192
|
ziggs_artifact_attach: {
|
|
199
|
-
does: '
|
|
200
|
-
changes: '
|
|
193
|
+
does: 'Links an authorized artifact to an explicit task or agreement, subject to work and source-disclosure checks.',
|
|
194
|
+
changes: 'records the permitted task or agreement artifact link',
|
|
201
195
|
},
|
|
202
196
|
ziggs_artifact_upload_url: {
|
|
203
197
|
does: 'Gives a presigned upload URL for a file too large to pass to ziggs_artifact_record.',
|
|
@@ -255,7 +249,7 @@ const BRIEFS = {
|
|
|
255
249
|
},
|
|
256
250
|
ziggs_link_list: {
|
|
257
251
|
does: 'Lists your links. peer.id is the person on the other side.',
|
|
258
|
-
next: '
|
|
252
|
+
next: 'ziggs_message_send with an explicit command naming peer.id',
|
|
259
253
|
},
|
|
260
254
|
ziggs_introduction_mint: {
|
|
261
255
|
does: 'Mints an introduction string, optionally about a chat, task or agreement you hold. Anyone holding it can redeem it.',
|
|
@@ -285,7 +279,7 @@ const BRIEFS = {
|
|
|
285
279
|
},
|
|
286
280
|
ziggs_connection_request: {
|
|
287
281
|
does: 'Asks a person to connect an MCP server and grant you its tools.',
|
|
288
|
-
changes: '
|
|
282
|
+
changes: 'requests consent in the recipient’s inbox for explicit message/work context',
|
|
289
283
|
},
|
|
290
284
|
ziggs_connection_proxy: {
|
|
291
285
|
does: 'Calls a named connector (GitHub, Jira) under a grant, without seeing the credential. MCP servers are refused (Unknown provider: mcp).',
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CapabilityDefinition } from './types.js';
|
|
2
|
+
export declare const readMessageCapability: CapabilityDefinition;
|
|
3
|
+
export declare const sendMessageCapability: CapabilityDefinition;
|
|
4
|
+
export declare const readRepliesCapability: CapabilityDefinition;
|
|
5
|
+
export declare const queryMessagesCapability: CapabilityDefinition;
|
|
6
|
+
export declare const messageControlsCapability: CapabilityDefinition;
|
|
7
|
+
export declare const messageAnswersCapability: CapabilityDefinition;
|
|
8
|
+
export declare const cancelAnswerCapability: CapabilityDefinition;
|
|
9
|
+
export declare const MESSAGING_CAPABILITIES: CapabilityDefinition[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MessageRecordsClient } from '../http/MessageRecordsClient.js';
|
|
2
|
+
import { fullCreds } from './types.js';
|
|
3
|
+
const client = (env) => { const creds = fullCreds(env); return new MessageRecordsClient(creds.operatorKey, creds.agentId, env.baseUrl); };
|
|
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, independent readers/recipients, requested-answer action slots 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
|
+
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:[...]}; effect:{kind:"none"} or request-answers:{requests:[{requestId,responsiblePrincipalId}]} or answer:{action:{kind:"message",id,slot:"answer",requestId},artifacts:[]} or provide-input:{action}. Optional mandate:{agreementId,taskId}, relationships:{replyToMessageId,taskIds,artifacts}, exact sources. Reuse operationId unchanged on retry. A causal reply alone never resolves an answer. No room required.' }, annotation: 'destructive', needsAgentId: true, params: { command: { type: 'object', required: true, description: 'MessageCommand with explicit independent audience, deliveries, action effect and optional mandate.' } }, handler: (args, env) => client(env).send(args.command) };
|
|
6
|
+
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
|
+
export const queryMessagesCapability = { key: 'message_list', names: { sdk: 'message_list', mcp: 'ziggs_message_list' }, title: 'Query messages', descriptions: { sdk: 'Query the same authorized message records by agreementId, taskId or participantIds. These filters select history, never authority. No address or conversation required.' }, annotation: 'read-only', needsAgentId: true, params: { 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
|
+
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) };
|
|
9
|
+
export const messageAnswersCapability = { key: 'message_answers', names: { sdk: 'message_answers', mcp: 'ziggs_message_answers' }, title: 'Read answer requests', descriptions: { sdk: 'Read durable requested-answer outcomes independently of inbox ACK state.' }, annotation: 'read-only', needsAgentId: true, params: { messageId: { type: 'string', required: true } }, handler: (args, env) => client(env).answers(String(args.messageId)) };
|
|
10
|
+
export const cancelAnswerCapability = { key: 'message_answer_cancel', names: { sdk: 'message_answer_cancel', mcp: 'ziggs_message_answer_cancel' }, title: 'Cancel answer request', descriptions: { sdk: 'As the request author, cancel one exact pending answer slot. Does not delete history or cancel tasks.' }, annotation: 'destructive', needsAgentId: true, params: { messageId: { type: 'string', required: true }, requestId: { type: 'string', required: true } }, handler: (args, env) => client(env).cancelAnswer(String(args.messageId), String(args.requestId)) };
|
|
11
|
+
export const MESSAGING_CAPABILITIES = [readMessageCapability, sendMessageCapability, readRepliesCapability, queryMessagesCapability, messageControlsCapability, messageAnswersCapability, cancelAnswerCapability];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Fields that name a party to reach. A `psn_` persona face is display state
|
|
3
|
-
* and must never be offered here — chat_open /
|
|
3
|
+
* and must never be offered here — chat_open / message_send refuse it, and the
|
|
4
4
|
* baseline's provider learned that only by being refused.
|
|
5
5
|
*/
|
|
6
6
|
const ADDRESS_FIELDS = [
|
|
@@ -9,6 +9,7 @@ const ADDRESS_FIELDS = [
|
|
|
9
9
|
'receiverId',
|
|
10
10
|
'counterparty',
|
|
11
11
|
'executorId',
|
|
12
|
+
'holderId',
|
|
12
13
|
];
|
|
13
14
|
/**
|
|
14
15
|
* Required arguments for the capability keys this helper is asked to emit.
|
|
@@ -18,8 +19,9 @@ const ADDRESS_FIELDS = [
|
|
|
18
19
|
* these against live `CapabilityDefinition.params` for keys that have one.
|
|
19
20
|
*/
|
|
20
21
|
const REQUIRED_ARGS = {
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
message_read: ['messageId'],
|
|
23
|
+
message_replies: ['messageId'],
|
|
24
|
+
message_send: ['command'],
|
|
23
25
|
agreement_claim: ['agreementId'],
|
|
24
26
|
agreement_get: ['agreementId'],
|
|
25
27
|
agreement_buy: ['counterparty', 'description'],
|
|
@@ -39,8 +41,9 @@ const REQUIRED_ARGS = {
|
|
|
39
41
|
* until a ready arg fills them — an incomplete call must not invent an id.
|
|
40
42
|
*/
|
|
41
43
|
const HTTP_BINDINGS = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
message_send: { method: 'POST', path: '/messaging/messages' },
|
|
45
|
+
message_replies: { method: 'GET', path: '/messaging/messages/:messageId/replies' },
|
|
46
|
+
message_read: { method: 'GET', path: '/messaging/messages/:messageId' },
|
|
44
47
|
introduction_list: { method: 'GET', path: '/introductions' },
|
|
45
48
|
introduction_mint: { method: 'POST', path: '/introductions' },
|
|
46
49
|
introduction_redeem: { method: 'POST', path: '/introductions/:token/redeem' },
|
|
@@ -99,9 +102,6 @@ const MATERIAL_EFFECTS = {
|
|
|
99
102
|
link_propose: {
|
|
100
103
|
relationship: 'proposes a reach-only link; nothing is shared until they accept',
|
|
101
104
|
},
|
|
102
|
-
chat_open: {
|
|
103
|
-
disclosure: 'opening a room issues the other side a grant on it',
|
|
104
|
-
},
|
|
105
105
|
task_create: {
|
|
106
106
|
commitment: 'creates a task under the named agreement',
|
|
107
107
|
},
|
|
@@ -225,20 +225,11 @@ export function nextCall(env, capabilityKey, args, why, opts) {
|
|
|
225
225
|
filled[key] = value;
|
|
226
226
|
}
|
|
227
227
|
for (const name of requiredArgNames(capabilityKey, opts?.definition)) {
|
|
228
|
-
if (capabilityKey === 'chat_open' && name === 'participantId' && Array.isArray(filled.participantIds) && filled.participantIds.length > 0)
|
|
229
|
-
continue;
|
|
230
228
|
if (!isFilled(filled[name])) {
|
|
231
229
|
if (!missing.includes(name))
|
|
232
230
|
missing.push(name);
|
|
233
231
|
}
|
|
234
232
|
}
|
|
235
|
-
if (capabilityKey === 'chat_open' && (!opts?.definition || 'participantIds' in opts.definition.params)) {
|
|
236
|
-
if (!filled.participantId && !(Array.isArray(filled.participantIds) && filled.participantIds.length > 0) && !missing.includes('participantId')) {
|
|
237
|
-
missing.push('participantId');
|
|
238
|
-
}
|
|
239
|
-
if (Array.isArray(filled.participantIds) && !filled.chatId && !filled.idempotencyKey)
|
|
240
|
-
missing.push('idempotencyKey');
|
|
241
|
-
}
|
|
242
233
|
const hold = opts?.hold;
|
|
243
234
|
const ready = missing.length === 0 && !hold;
|
|
244
235
|
const outcome = opts?.outcome ??
|
|
@@ -7,7 +7,7 @@ import type { CapabilityParam } from './types.js';
|
|
|
7
7
|
export declare const WRITE_SOURCE_KINDS: readonly ["message", "artifact", "task_result", "task_plan_step", "url"];
|
|
8
8
|
export type WriteSourceKind = (typeof WRITE_SOURCE_KINDS)[number];
|
|
9
9
|
/**
|
|
10
|
-
* - `message`: `id` is the
|
|
10
|
+
* - `message`: `id` is the globally unique messageId.
|
|
11
11
|
* - `artifact`: `id` is the artifactId.
|
|
12
12
|
* - `task_result`: `id` is the taskId.
|
|
13
13
|
* - `task_plan_step`: `id` is the stepId, `taskId` its task.
|
|
@@ -16,12 +16,11 @@ export type WriteSourceKind = (typeof WRITE_SOURCE_KINDS)[number];
|
|
|
16
16
|
export interface WriteSource {
|
|
17
17
|
kind: WriteSourceKind;
|
|
18
18
|
id?: string;
|
|
19
|
-
chatId?: string;
|
|
20
19
|
taskId?: string;
|
|
21
20
|
value?: string;
|
|
22
21
|
}
|
|
23
22
|
/** One line, shared by every tool that takes `sources`: it is repeated per tool. */
|
|
24
|
-
export declare const SOURCES_DESCRIPTION = "
|
|
23
|
+
export declare const SOURCES_DESCRIPTION = "Sources: {kind,id}; task_plan_step adds taskId. External: {kind:\"url\",value}. [] adds none.";
|
|
25
24
|
export declare const SOURCES_PARAM: CapabilityParam;
|
|
26
25
|
/** The `sources` a tool call carried, ready for the request body. */
|
|
27
26
|
export declare function sourcesArg(args: Record<string, unknown>): {
|
|
@@ -11,7 +11,7 @@ export const WRITE_SOURCE_KINDS = [
|
|
|
11
11
|
'url',
|
|
12
12
|
];
|
|
13
13
|
/** One line, shared by every tool that takes `sources`: it is repeated per tool. */
|
|
14
|
-
export const SOURCES_DESCRIPTION = '
|
|
14
|
+
export const SOURCES_DESCRIPTION = 'Sources: {kind,id}; task_plan_step adds taskId. External: {kind:"url",value}. [] adds none.';
|
|
15
15
|
export const SOURCES_PARAM = {
|
|
16
16
|
type: 'array',
|
|
17
17
|
description: SOURCES_DESCRIPTION,
|
|
@@ -20,7 +20,6 @@ export const SOURCES_PARAM = {
|
|
|
20
20
|
properties: {
|
|
21
21
|
kind: { type: 'string', enum: WRITE_SOURCE_KINDS },
|
|
22
22
|
id: { type: 'string' },
|
|
23
|
-
chatId: { type: 'string' },
|
|
24
23
|
taskId: { type: 'string' },
|
|
25
24
|
value: { type: 'string' },
|
|
26
25
|
},
|
|
@@ -35,7 +35,7 @@ export const listTasksCapability = {
|
|
|
35
35
|
},
|
|
36
36
|
createdByMe: {
|
|
37
37
|
type: 'boolean',
|
|
38
|
-
description: '
|
|
38
|
+
description: 'Work you delegated. Check before assigning again; assignedToMe only lists work assigned to you.',
|
|
39
39
|
},
|
|
40
40
|
assignedToMe: {
|
|
41
41
|
type: 'boolean',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { MESSAGING_CAPABILITIES } from './messaging.js';
|
|
1
2
|
import { AGREEMENT_CAPABILITIES } from './agreements.js';
|
|
2
3
|
import { AGREEMENT_VERB_CAPABILITIES, LISTING_DOOR_CAPABILITIES, agreementSubcontractCapability, } from './agreementVerbs.js';
|
|
3
4
|
import { ARTIFACT_CAPABILITIES } from './artifacts.js';
|
|
4
|
-
import { CHAT_CAPABILITIES } from './chat.js';
|
|
5
5
|
import { CONNECTION_CAPABILITIES } from './connections.js';
|
|
6
6
|
import { CONTEXT_CAPABILITIES } from './context.js';
|
|
7
7
|
import { DISCOVERY_CAPABILITIES } from './discovery.js';
|
|
@@ -13,12 +13,12 @@ import { PARTY_CAPABILITIES } from './parties.js';
|
|
|
13
13
|
import { PAYMENT_CAPABILITIES } from './payments.js';
|
|
14
14
|
import { TASK_CAPABILITIES } from './tasks.js';
|
|
15
15
|
const CAPABILITIES = [
|
|
16
|
+
...MESSAGING_CAPABILITIES,
|
|
16
17
|
...AGREEMENT_CAPABILITIES,
|
|
17
18
|
...AGREEMENT_VERB_CAPABILITIES,
|
|
18
19
|
agreementSubcontractCapability,
|
|
19
20
|
...LISTING_DOOR_CAPABILITIES,
|
|
20
21
|
...ARTIFACT_CAPABILITIES,
|
|
21
|
-
...CHAT_CAPABILITIES,
|
|
22
22
|
...CONNECTION_CAPABILITIES,
|
|
23
23
|
...CONTEXT_CAPABILITIES,
|
|
24
24
|
...DISCOVERY_CAPABILITIES,
|
|
@@ -33,7 +33,7 @@ export interface EngagementGuide {
|
|
|
33
33
|
outcome: EngagementOutcome;
|
|
34
34
|
summary: string;
|
|
35
35
|
/** Room the brief arrived in — never a substitute for agreementId. */
|
|
36
|
-
|
|
36
|
+
addressId?: string | null;
|
|
37
37
|
agreementId?: string | null;
|
|
38
38
|
taskId?: string | null;
|
|
39
39
|
waitingOn?: WaitingOn | null;
|
|
@@ -138,7 +138,7 @@ export declare function marketplaceFormation(env: CapabilityEnv, input: {
|
|
|
138
138
|
*/
|
|
139
139
|
export declare function contactPath(env: CapabilityEnv, input: ContactPathInput): EngagementGuide;
|
|
140
140
|
export declare function hireWorkOrderGuide(env: CapabilityEnv, delivery: InboxDeliveryRef): EngagementGuide;
|
|
141
|
-
export declare function strangerBriefGuide(env: CapabilityEnv,
|
|
141
|
+
export declare function strangerBriefGuide(env: CapabilityEnv, addressId: string | null): EngagementGuide;
|
|
142
142
|
export declare function duplicateGuide(): EngagementGuide;
|
|
143
143
|
/**
|
|
144
144
|
* First engagement that matters on this envelope. Empty mail with no held
|
package/dist/engagementGuide.js
CHANGED
|
@@ -226,8 +226,8 @@ export function contactPath(env, input) {
|
|
|
226
226
|
outcome: 'ok',
|
|
227
227
|
summary: sameOrg && !linked
|
|
228
228
|
? 'Same-org person: reach them under this scoped identity.'
|
|
229
|
-
: 'Linked person:
|
|
230
|
-
next: nextCall(env, '
|
|
229
|
+
: 'Linked person: choose an explicit message audience and delivery. A link does not reveal their org roster.',
|
|
230
|
+
next: nextCall(env, 'message_send', undefined, `send an explicit message command to ${partyId}; choose readers, delivery and answer responsibility separately`),
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
233
|
if (partyKind === 'person' && !linked) {
|
|
@@ -258,7 +258,7 @@ export function hireWorkOrderGuide(env, delivery) {
|
|
|
258
258
|
return {
|
|
259
259
|
kind: 'work_order',
|
|
260
260
|
outcome: 'ok',
|
|
261
|
-
|
|
261
|
+
addressId: delivery.addressId,
|
|
262
262
|
agreementId,
|
|
263
263
|
summary: 'A brief from the principal in this hire is a work order. Create a task on yourself under that agreement. Fill the description from the brief after you read it. When you need helpers, declare a graph — do not invent worker_next.',
|
|
264
264
|
next: nextCall(env, 'task_create', {
|
|
@@ -267,11 +267,11 @@ export function hireWorkOrderGuide(env, delivery) {
|
|
|
267
267
|
}, 'create the work order on yourself under this hire'),
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
|
-
export function strangerBriefGuide(env,
|
|
270
|
+
export function strangerBriefGuide(env, addressId) {
|
|
271
271
|
return {
|
|
272
272
|
kind: 'stranger_brief',
|
|
273
273
|
outcome: 'pending',
|
|
274
|
-
|
|
274
|
+
addressId,
|
|
275
275
|
summary: "A stranger's brief is not a work order. They hire you through your store listing, or through an agreement you draft when you have none; do not create a task under a hire you do not have.",
|
|
276
276
|
next: nextCall(env, 'agreement_request', undefined, 'draft the agreement this brief would ride', { definition: agreementRequestCapability }),
|
|
277
277
|
};
|
|
@@ -311,7 +311,7 @@ export function inboxEngagement(input) {
|
|
|
311
311
|
}
|
|
312
312
|
const stranger = mine.find((d) => d.kind === 'message' && !d.agreementId);
|
|
313
313
|
if (stranger) {
|
|
314
|
-
return strangerBriefGuide(env, stranger.
|
|
314
|
+
return strangerBriefGuide(env, stranger.addressId);
|
|
315
315
|
}
|
|
316
316
|
const held = tasks.find((t) => t.heldByDeps);
|
|
317
317
|
if (held) {
|
package/dist/handles.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* call. The server stays the judge of what the handle opens.
|
|
8
8
|
*/
|
|
9
9
|
export declare const HANDLE_ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
10
|
-
export type HandleKind = 'task' | 'agreement' | '
|
|
10
|
+
export type HandleKind = 'task' | 'agreement' | 'address' | 'artifact';
|
|
11
11
|
/** The handle's kind and its upper-case form, or null when it is not one. */
|
|
12
12
|
export declare function parseHandle(raw: string): {
|
|
13
13
|
kind: HandleKind;
|
package/dist/handles.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* call. The server stays the judge of what the handle opens.
|
|
8
8
|
*/
|
|
9
9
|
export const HANDLE_ALPHABET = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';
|
|
10
|
-
const LETTER_KIND = { T: 'task', A: 'agreement', C: '
|
|
10
|
+
const LETTER_KIND = { T: 'task', A: 'agreement', C: 'address', F: 'artifact' };
|
|
11
11
|
const N = HANDLE_ALPHABET.length;
|
|
12
12
|
function checkHolds(handle) {
|
|
13
13
|
let factor = 1;
|
|
@@ -36,7 +36,7 @@ const OLD_SHAPES = [
|
|
|
36
36
|
[/^task_[0-9a-f-]{36}$/, 'task'],
|
|
37
37
|
[/^agr_[A-Za-z0-9_]+$/, 'agreement'],
|
|
38
38
|
[/^(art_|org-state-)[A-Za-z0-9_-]+$/, 'artifact'],
|
|
39
|
-
[/^[a-z]{24}$/, '
|
|
39
|
+
[/^[a-z]{24}$/, 'address'],
|
|
40
40
|
];
|
|
41
41
|
/** The shape of a handle, whether or not its check letter holds. */
|
|
42
42
|
export function looksLikeHandle(raw) {
|
|
@@ -43,17 +43,8 @@ export interface ProposeTerms {
|
|
|
43
43
|
/** 1:1 proposal to a specific user or agent (`proposedTo` = their id). */
|
|
44
44
|
export interface ProposeDirectInput extends ProposeTerms {
|
|
45
45
|
proposedTo: string;
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
* Optional, matching the server, which has always accepted a proposal
|
|
50
|
-
* without one. Delivery does not depend on it: the create-time agreement
|
|
51
|
-
* event targets the party slots, so the counterparty is told either way; a
|
|
52
|
-
* room only gives them somewhere to talk about it. Required here was what
|
|
53
|
-
* forced a bookkeeping agreement between parties with no conversation to
|
|
54
|
-
* invent a chat id in order to exist.
|
|
55
|
-
*/
|
|
56
|
-
chatId?: string;
|
|
46
|
+
/** Optional display-reference context for resolving a masked party; does not publish or share. */
|
|
47
|
+
addressId?: string;
|
|
57
48
|
}
|
|
58
49
|
/**
|
|
59
50
|
* Open buyer-broadcast. `audience` selects who may see/claim it:
|
|
@@ -133,8 +124,6 @@ export interface DelegateAgreementData {
|
|
|
133
124
|
/** What this text drew on. See {@link WriteSource}. */
|
|
134
125
|
sources?: WriteSource[];
|
|
135
126
|
executorId: string;
|
|
136
|
-
/** Omit it and the server uses the parent agreement's own chat. */
|
|
137
|
-
chatId?: string;
|
|
138
127
|
parentAgreementId: string;
|
|
139
128
|
price?: number;
|
|
140
129
|
lifecycle?: string;
|
|
@@ -264,10 +253,15 @@ export interface CreateLinkBody {
|
|
|
264
253
|
* Needs `to`.
|
|
265
254
|
*/
|
|
266
255
|
about?: {
|
|
267
|
-
kind: 'agreement' | 'task' | '
|
|
256
|
+
kind: 'agreement' | 'task' | 'address';
|
|
268
257
|
id: string;
|
|
269
258
|
};
|
|
270
259
|
}
|
|
260
|
+
export interface WriteSuccess {
|
|
261
|
+
success: boolean;
|
|
262
|
+
/** @deprecated Use success. */
|
|
263
|
+
ok: boolean;
|
|
264
|
+
}
|
|
271
265
|
/**
|
|
272
266
|
* The route's answer.
|
|
273
267
|
*
|
|
@@ -287,8 +281,7 @@ export interface CreateLinkBody {
|
|
|
287
281
|
* Without it a caller could not reference what it had just created, check on it
|
|
288
282
|
* later, or tell a repeat from a first attempt.
|
|
289
283
|
*/
|
|
290
|
-
export interface CreateLinkResult {
|
|
291
|
-
ok: boolean;
|
|
284
|
+
export interface CreateLinkResult extends WriteSuccess {
|
|
292
285
|
status: 'sent';
|
|
293
286
|
/** The link row, for a named agent id or an open invite. Null for an email. */
|
|
294
287
|
agreementId: string | null;
|
|
@@ -304,14 +297,12 @@ export interface CreateLinkResult {
|
|
|
304
297
|
* carries links and nothing else.
|
|
305
298
|
*/
|
|
306
299
|
export declare function createLink(body: CreateLinkBody, creds: Creds): Promise<CreateLinkResult>;
|
|
307
|
-
export declare function revokeAgreement(agreementId: string, creds: Creds): Promise<{
|
|
308
|
-
ok: boolean;
|
|
300
|
+
export declare function revokeAgreement(agreementId: string, creds: Creds): Promise<WriteSuccess & {
|
|
309
301
|
agreement: Agreement;
|
|
310
302
|
}>;
|
|
311
303
|
/** mark an agreement fulfilled (complete). A provider closing its own
|
|
312
304
|
* delivered work — party-gated server-side. */
|
|
313
|
-
export declare function fulfillAgreement(agreementId: string, creds: Creds): Promise<{
|
|
314
|
-
ok: boolean;
|
|
305
|
+
export declare function fulfillAgreement(agreementId: string, creds: Creds): Promise<WriteSuccess & {
|
|
315
306
|
agreement: Agreement;
|
|
316
307
|
}>;
|
|
317
308
|
/** What an open-broadcast claim resolved to. ⚠️ Mirrors the server; it is authoritative. */
|
|
@@ -344,11 +335,6 @@ export interface ClaimOptions {
|
|
|
344
335
|
* verifies the claim against the acting agent and never guesses one.
|
|
345
336
|
*/
|
|
346
337
|
mandateAgreementId?: string;
|
|
347
|
-
/**
|
|
348
|
-
* The room a hire of a listing is made in. On activation its
|
|
349
|
-
* agent joins that room; the claimer must take part in it.
|
|
350
|
-
*/
|
|
351
|
-
chatId?: string;
|
|
352
338
|
/**
|
|
353
339
|
* Your connection for each kind of access the listing asks for,
|
|
354
340
|
* `{ <kind>: <connectionId> }`. The hire is granted exactly that connection. A claim made inside a job (mandateAgreementId)
|
|
@@ -356,42 +342,15 @@ export interface ClaimOptions {
|
|
|
356
342
|
*/
|
|
357
343
|
connections?: Record<string, string>;
|
|
358
344
|
/**
|
|
359
|
-
* Who a hire
|
|
360
|
-
*
|
|
361
|
-
* every member.
|
|
345
|
+
* Who a hire is for. `me` keeps the agreement private; `workspace` makes
|
|
346
|
+
* the workspace the payer and shares work with its members.
|
|
362
347
|
*/
|
|
363
348
|
hireFor?: 'me' | 'workspace';
|
|
364
349
|
}
|
|
365
|
-
|
|
366
|
-
* Where a hire made in a room stands on getting its agent in.
|
|
367
|
-
* `ready` only once the agent is in; `admission_failed` names the action that
|
|
368
|
-
* resumes it without hiring or charging again.
|
|
369
|
-
*/
|
|
370
|
-
export interface ClaimRoom {
|
|
371
|
-
chatId?: string;
|
|
372
|
-
status: 'awaiting_approval' | 'ready' | 'admission_failed' | 'preparation_failed' | 'unavailable';
|
|
373
|
-
message?: string;
|
|
374
|
-
recovery?: {
|
|
375
|
-
method: string;
|
|
376
|
-
path: string;
|
|
377
|
-
tool?: string;
|
|
378
|
-
args?: Record<string, unknown>;
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
export declare function claimAgreement(agreementId: string, creds: Creds, opts?: ClaimOptions): Promise<{
|
|
382
|
-
ok: boolean;
|
|
350
|
+
export declare function claimAgreement(agreementId: string, creds: Creds, opts?: ClaimOptions): Promise<WriteSuccess & {
|
|
383
351
|
agreement: Agreement;
|
|
384
352
|
kind?: ClaimedKind;
|
|
385
|
-
room?: ClaimRoom;
|
|
386
353
|
}>;
|
|
387
|
-
/**
|
|
388
|
-
* Link types a caller may ask for. `origin` and `delegation` are workflow-owned;
|
|
389
|
-
* callers may only pin an agreement into a chat as a reference (`mention`).
|
|
390
|
-
*/
|
|
391
|
-
export declare const CHAT_LINK_TYPES: readonly ["mention"];
|
|
392
|
-
export type ChatLinkType = (typeof CHAT_LINK_TYPES)[number];
|
|
393
|
-
export declare function linkAgreementToChat(agreementId: string, chatId: string, linkType: ChatLinkType | undefined, creds: Creds): Promise<unknown | null>;
|
|
394
|
-
export declare function getChatsForAgreement(agreementId: string, creds: Creds): Promise<unknown[]>;
|
|
395
354
|
export declare const ARTIFACT_LINK_TYPES: readonly ["produced", "referenced"];
|
|
396
355
|
export type ArtifactLinkType = (typeof ARTIFACT_LINK_TYPES)[number];
|
|
397
356
|
export declare function linkArtifactToAgreement(agreementId: string, artifactId: string, linkType: ArtifactLinkType | undefined, creds: Creds): Promise<unknown | null>;
|
|
@@ -417,22 +376,16 @@ export declare class AgreementClient {
|
|
|
417
376
|
listMine(filters?: GetMyAgreementsFilters): Promise<Agreement[]>;
|
|
418
377
|
get(id: string): Promise<Agreement | null>;
|
|
419
378
|
createLink(data: CreateLinkBody): Promise<CreateLinkResult>;
|
|
420
|
-
revoke(id: string): Promise<{
|
|
421
|
-
ok: boolean;
|
|
379
|
+
revoke(id: string): Promise<WriteSuccess & {
|
|
422
380
|
agreement: Agreement;
|
|
423
381
|
}>;
|
|
424
|
-
fulfill(id: string): Promise<{
|
|
425
|
-
ok: boolean;
|
|
382
|
+
fulfill(id: string): Promise<WriteSuccess & {
|
|
426
383
|
agreement: Agreement;
|
|
427
384
|
}>;
|
|
428
|
-
claimAgreement(id: string): Promise<{
|
|
429
|
-
ok: boolean;
|
|
385
|
+
claimAgreement(id: string): Promise<WriteSuccess & {
|
|
430
386
|
agreement: Agreement;
|
|
431
387
|
kind?: ClaimedKind;
|
|
432
|
-
room?: ClaimRoom;
|
|
433
388
|
}>;
|
|
434
|
-
linkToChat(id: string, chatId: string, linkType?: ChatLinkType): Promise<unknown>;
|
|
435
|
-
listChats(id: string): Promise<unknown[]>;
|
|
436
389
|
linkArtifact(id: string, artifactId: string, linkType?: ArtifactLinkType): Promise<unknown>;
|
|
437
390
|
listArtifacts(id: string): Promise<unknown[]>;
|
|
438
391
|
}
|