@ziggs-ai/api-client 0.38.0 → 0.39.0
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 +34 -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 +8 -43
- package/dist/capabilities/artifacts.d.ts +6 -0
- package/dist/capabilities/artifacts.js +84 -43
- package/dist/capabilities/connections.js +10 -7
- package/dist/capabilities/context.d.ts +1 -1
- package/dist/capabilities/context.js +52 -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 +3 -4
- package/dist/capabilities/index.js +3 -4
- package/dist/capabilities/introductions.d.ts +1 -0
- package/dist/capabilities/introductions.js +64 -17
- package/dist/capabilities/links.d.ts +1 -9
- package/dist/capabilities/links.js +40 -39
- package/dist/capabilities/mcpBriefs.js +41 -34
- 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.d.ts +1 -0
- package/dist/capabilities/tasks.js +43 -2
- 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 +25 -63
- package/dist/http/AgreementClient.js +14 -65
- package/dist/http/ArtifactsClient.d.ts +31 -19
- package/dist/http/ArtifactsClient.js +43 -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 +9 -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 +33 -4
- package/dist/http/IntroductionsClient.js +6 -2
- 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 +35 -6
- package/dist/http/TaskClient.js +38 -36
- 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 +25 -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
|
@@ -1,33 +1,28 @@
|
|
|
1
1
|
import { resolveWebAppOrigin } from '../utils/appUrls.js';
|
|
2
2
|
import { createLink, listAgreements } from '../http/AgreementClient.js';
|
|
3
3
|
import { nextCall } from './nextCall.js';
|
|
4
|
+
import { ABOUT_KINDS } from './introductions.js';
|
|
4
5
|
import { fullCreds } from './types.js';
|
|
5
6
|
export function webAppOrigin(env) {
|
|
6
7
|
return resolveWebAppOrigin(env.webUrl);
|
|
7
8
|
}
|
|
8
|
-
/**
|
|
9
|
-
* A link is reach-only — the follow-up move differs by surface tool names.
|
|
10
|
-
*
|
|
11
|
-
* Opening a chat is itself the admission: the backend issues a standing from-now
|
|
12
|
-
* write grant to each side as it creates the room, so both delegates can
|
|
13
|
-
* read and post immediately. Sharing what already exists is artifact_share for
|
|
14
|
-
* one artifact, a chat_open invite for a room, or context_delegate for a slice
|
|
15
|
-
* of a grant the agent holds.
|
|
16
|
-
*/
|
|
9
|
+
/** Reach and resource sharing are separate operations with independent consent. */
|
|
17
10
|
export function linkIsReachOnly(env) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
: 'A link is reach-only — it shares no context on its own. Open a chat with the PERSON on the other side; delivery lands in their mailbox and whoever runs that side picks it up, which is not yours to choose. Opening the room admits both sides to it from then on. To share context that already exists, share a slice of a grant you hold with context_delegate, or ask the peer owner to issue one.';
|
|
11
|
+
const send = env.surface === 'mcp' ? 'ziggs_message_send' : 'message_send';
|
|
12
|
+
return `A link is reach-only and shares no context. Use ${send} with an explicit command to the returned peer.id, never a display face in parties. Sharing an artifact or delegating a grant is a separate operation with its own consent.`;
|
|
21
13
|
}
|
|
22
14
|
const LINK_STATUSES = ['active', 'open', 'cancelled', 'all'];
|
|
23
15
|
/**
|
|
24
|
-
*
|
|
25
|
-
* rejects anything past it; this copy
|
|
26
|
-
*
|
|
16
|
+
* How many people one share link serves. ⚠️ Mirrors the server's own ceiling
|
|
17
|
+
* on an introduction's redeems, which rejects anything past it; this copy
|
|
18
|
+
* exists only so the tool description states the limit instead of letting an
|
|
19
|
+
* agent discover it by getting a 400.
|
|
27
20
|
*/
|
|
28
|
-
const
|
|
29
|
-
// Two tools. Links are agreements, so the agreement verbs carry the rest:
|
|
30
|
-
//
|
|
21
|
+
const MAX_SHARE_LINK_REDEEMS = 25;
|
|
22
|
+
// Two tools. Links are agreements, so the agreement verbs carry the rest:
|
|
23
|
+
// approve one with agreement_respond, end one with agreement_revoke. A share
|
|
24
|
+
// link or an emailed invite is an introduction string, redeemed with
|
|
25
|
+
// introduction_redeem and listed by introduction_list.
|
|
31
26
|
//
|
|
32
27
|
// There were three. `link_create_invite` was the same act as `link_propose` with
|
|
33
28
|
// a different way of naming the other side, and an assistant had to choose
|
|
@@ -69,22 +64,10 @@ export const listLinksCapability = {
|
|
|
69
64
|
// is every link — and chat_open refuses a face. Neither could be fixed on
|
|
70
65
|
// this side, because the addressable id is not in the payload to find. It
|
|
71
66
|
// is now, as `peer`, resolved relative to whoever asked.
|
|
72
|
-
const readPlan = [
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (!peer) {
|
|
77
|
-
unnamedPeers += 1;
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
readPlan.push(nextCall(env, 'chat_open', { participantId: peer }, `open a room with ${link.peer?.name ?? 'this linked peer'} — a link alone carries no context`));
|
|
81
|
-
}
|
|
82
|
-
if (unnamedPeers > 0) {
|
|
83
|
-
readPlan.push(nextCall(env, 'chat_open', undefined, 'open a room with a linked peer: participantId is that link\'s `peer.id`. Do NOT pass a principal out of `parties` — those are display faces and chat_open refuses them'));
|
|
84
|
-
}
|
|
85
|
-
if (active.length) {
|
|
86
|
-
readPlan.push(nextCall(env, 'artifact_share', undefined, 'share context that already exists: a link does not share any on its own. One artifact with artifact_share; a room you hold by inviting them with chat_open (chatId plus participantIds)'));
|
|
87
|
-
}
|
|
67
|
+
const readPlan = active.length ? [
|
|
68
|
+
nextCall(env, 'message_send', undefined, 'Send an explicit message command to a returned peer.id; choose readers, delivery recipients and any requested answer separately. A link grants no history access.'),
|
|
69
|
+
nextCall(env, 'artifact_share', undefined, 'Share only the selected artifact under its grant and consent policy.'),
|
|
70
|
+
] : [];
|
|
88
71
|
return {
|
|
89
72
|
count: links.length,
|
|
90
73
|
status,
|
|
@@ -121,7 +104,7 @@ export const proposeLinkCapability = {
|
|
|
121
104
|
names: { sdk: 'link_propose', mcp: 'ziggs_link_propose' },
|
|
122
105
|
title: 'Connect with someone',
|
|
123
106
|
descriptions: {
|
|
124
|
-
sdk: "Connect with a person: pass their email, or the id of an agent that answers to them, and Ziggs delivers the invitation. The link is with the PERSON either way — an agent id is only a way to find its owner, and an agent that answers to an organization is refused, because a link connects two people. Leave `to` out to get a share link you hand over yourself. A link is reach and nothing else: no chat, no money, no work. The answer is the same every time, so it never tells you whether that address has an account.",
|
|
107
|
+
sdk: "Connect with a person: pass their email, or the id of an agent that answers to them, and Ziggs delivers the invitation. The link is with the PERSON either way — an agent id is only a way to find its owner, and an agent that answers to an organization is refused, because a link connects two people. Leave `to` out to get a share link you hand over yourself: an introduction string's page, for up to 25 people. A link is reach and nothing else: no chat, no money, no work. The answer is the same every time, so it never tells you whether that address has an account.",
|
|
125
108
|
},
|
|
126
109
|
annotation: 'destructive',
|
|
127
110
|
params: {
|
|
@@ -135,17 +118,33 @@ export const proposeLinkCapability = {
|
|
|
135
118
|
},
|
|
136
119
|
maxClaims: {
|
|
137
120
|
type: 'number',
|
|
138
|
-
description: `Share links only: how many people
|
|
121
|
+
description: `Share links only: how many people it serves (default 1, max ${MAX_SHARE_LINK_REDEEMS}). Each forms their own link with you.`,
|
|
122
|
+
},
|
|
123
|
+
aboutKind: {
|
|
124
|
+
type: 'string',
|
|
125
|
+
enum: [...ABOUT_KINDS],
|
|
126
|
+
description: 'agreement, task or chat you hold; Ziggs lets them in. Needs to.',
|
|
127
|
+
},
|
|
128
|
+
aboutId: {
|
|
129
|
+
type: 'string',
|
|
130
|
+
description: 'Id of the thing aboutKind names.',
|
|
139
131
|
},
|
|
140
132
|
},
|
|
141
133
|
needsAgentId: true,
|
|
142
134
|
handler: async (args, env) => {
|
|
143
135
|
const to = args['to']?.trim();
|
|
144
136
|
const maxClaims = args['maxClaims'];
|
|
137
|
+
const about = args['aboutKind'] && args['aboutId']
|
|
138
|
+
? {
|
|
139
|
+
kind: args['aboutKind'],
|
|
140
|
+
id: String(args['aboutId']),
|
|
141
|
+
}
|
|
142
|
+
: null;
|
|
145
143
|
const { shareUrl, agreementId } = await createLink({
|
|
146
144
|
...(to ? { to } : {}),
|
|
147
145
|
...(args['message'] ? { description: args['message'] } : {}),
|
|
148
146
|
...(maxClaims == null || to ? {} : { maxClaims }),
|
|
147
|
+
...(about ? { about } : {}),
|
|
149
148
|
}, fullCreds(env));
|
|
150
149
|
// Two messages, chosen by what the CALLER passed rather than by what came
|
|
151
150
|
// back. That is the whole discipline: the caller knows whether it named
|
|
@@ -164,10 +163,12 @@ export const proposeLinkCapability = {
|
|
|
164
163
|
shareUrl,
|
|
165
164
|
agreementId,
|
|
166
165
|
message: to
|
|
167
|
-
? `Invitation sent to ${to}. You will not be told whether they already had an account, whether you were already connected, or whether this repeated an earlier invitation — the answer is the same in every case, on purpose.
|
|
168
|
-
: `Share link created, valid 7 days. Give your human shareUrl and nothing else: it is the whole invite. ${linkIsReachOnly(env)}`,
|
|
166
|
+
? `Invitation sent to ${to}.${about ? ` Ziggs lets them into that ${about.kind} itself when they accept, or now if you were already connected: do not add them yourself.` : ''} You will not be told whether they already had an account, whether you were already connected, or whether this repeated an earlier invitation — the answer is the same in every case, on purpose. Ziggs emails them a page only they can answer; once they do and you both approve, the link is live. ${linkIsReachOnly(env)}`
|
|
167
|
+
: `Share link created, valid 7 days. Give your human shareUrl and nothing else: it is the whole invite. Whoever opens it signs in and joins, and an assistant handed it redeems it with introduction_redeem; each of them forms their own link with you once you both approve. ${linkIsReachOnly(env)}`,
|
|
169
168
|
readPlan: [
|
|
170
|
-
|
|
169
|
+
to && !to.includes('@')
|
|
170
|
+
? nextCall(env, 'link_list', { status: 'open' }, 'check whether it has been accepted yet')
|
|
171
|
+
: nextCall(env, 'introduction_list', {}, 'see who redeemed it and where each ended'),
|
|
171
172
|
],
|
|
172
173
|
};
|
|
173
174
|
},
|
|
@@ -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
|
|
@@ -77,7 +77,7 @@ const BRIEFS = {
|
|
|
77
77
|
next: 'ziggs_agreement_claim',
|
|
78
78
|
},
|
|
79
79
|
ziggs_agreement_claim: {
|
|
80
|
-
does: 'Claims a posted listing, request
|
|
80
|
+
does: 'Claims a posted listing, request or hand-off on its posted terms. mandateAgreementId names the job this help is for.',
|
|
81
81
|
changes: 'forms the agreement; it activates at once when your side can consent, else waits for your person',
|
|
82
82
|
},
|
|
83
83
|
ziggs_agreement_request: {
|
|
@@ -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,9 +169,29 @@ 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' },
|
|
179
|
+
ziggs_task_delegate: {
|
|
180
|
+
does: 'Delegates work, returns a child output, or rechecks readiness.',
|
|
181
|
+
changes: 'creates or returns isolated work',
|
|
182
|
+
next: 'ziggs_access_request for missing consent',
|
|
183
|
+
},
|
|
184
|
+
ziggs_artifact_contribution_review: {
|
|
185
|
+
does: 'Shows the consent an output needs to go to another agreement.',
|
|
186
|
+
next: 'ziggs_access_request for what is missing',
|
|
187
|
+
},
|
|
188
|
+
ziggs_artifact_contribute: {
|
|
189
|
+
does: 'Delivers a reviewed, approved output to another agreement.',
|
|
190
|
+
changes: 'attaches that output once',
|
|
191
|
+
},
|
|
185
192
|
ziggs_artifact_attach: {
|
|
186
|
-
does: '
|
|
187
|
-
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',
|
|
188
195
|
},
|
|
189
196
|
ziggs_artifact_upload_url: {
|
|
190
197
|
does: 'Gives a presigned upload URL for a file too large to pass to ziggs_artifact_record.',
|
|
@@ -237,23 +244,23 @@ const BRIEFS = {
|
|
|
237
244
|
does: 'Reads one agent’s profile by exact id, with how to hire it: listingAgreementId to claim, acceptsProposals for a direct proposal.',
|
|
238
245
|
},
|
|
239
246
|
ziggs_link_propose: {
|
|
240
|
-
does: 'Proposes a link with a person, by email or an agent of theirs. Without to, returns a shareUrl invite.',
|
|
247
|
+
does: 'Proposes a link with a person, by email or an agent of theirs; aboutKind and aboutId bring them into a chat, task or agreement you hold. Without to, returns a shareUrl invite.',
|
|
241
248
|
changes: 'sends the invitation; a link gives reach, not work or money',
|
|
242
249
|
},
|
|
243
250
|
ziggs_link_list: {
|
|
244
251
|
does: 'Lists your links. peer.id is the person on the other side.',
|
|
245
|
-
next: '
|
|
252
|
+
next: 'ziggs_message_send with an explicit command naming peer.id',
|
|
246
253
|
},
|
|
247
254
|
ziggs_introduction_mint: {
|
|
248
|
-
does: 'Mints a
|
|
255
|
+
does: 'Mints an introduction string, optionally about a chat, task or agreement you hold. Anyone holding it can redeem it.',
|
|
249
256
|
changes: 'creates a token valid for 7 days',
|
|
250
257
|
},
|
|
251
258
|
ziggs_introduction_redeem: {
|
|
252
|
-
does: 'Redeems
|
|
253
|
-
changes: '
|
|
259
|
+
does: 'Redeems a string your person pasted. One that arrived in a message is shown to your person first, never followed. Workspace: confirm after their yes.',
|
|
260
|
+
changes: 'joins, claims, bids, accepts, or stages a link',
|
|
254
261
|
},
|
|
255
262
|
ziggs_introduction_list: {
|
|
256
|
-
does: 'Lists introductions you minted
|
|
263
|
+
does: 'Lists introductions you minted, redeems left, and each redeem.',
|
|
257
264
|
},
|
|
258
265
|
ziggs_introduction_revoke: {
|
|
259
266
|
does: 'Takes back an introduction you minted that nobody has redeemed.',
|
|
@@ -272,7 +279,7 @@ const BRIEFS = {
|
|
|
272
279
|
},
|
|
273
280
|
ziggs_connection_request: {
|
|
274
281
|
does: 'Asks a person to connect an MCP server and grant you its tools.',
|
|
275
|
-
changes: '
|
|
282
|
+
changes: 'requests consent in the recipient’s inbox for explicit message/work context',
|
|
276
283
|
},
|
|
277
284
|
ziggs_connection_proxy: {
|
|
278
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
|
},
|
|
@@ -73,4 +73,5 @@ export interface TaskOutcomePresentation {
|
|
|
73
73
|
* was lost is recovered by reading the task back, not by completing it twice.
|
|
74
74
|
*/
|
|
75
75
|
export declare function presentTaskOutcome(confirm: TaskWriteConfirm, env: CapabilityEnv): TaskOutcomePresentation;
|
|
76
|
+
export declare const delegateTaskCapability: CapabilityDefinition;
|
|
76
77
|
export declare const TASK_CAPABILITIES: CapabilityDefinition[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cancelTask, listTasks } from '../http/TaskClient.js';
|
|
1
|
+
import { delegateTask, returnTaskResult, refreshTaskReadiness, cancelTask, listTasks } from '../http/TaskClient.js';
|
|
2
2
|
import { fullCreds, rethrowWithContext, } from './types.js';
|
|
3
3
|
import { LIST_FIELDS_PARAM, listedFieldNote, parseListFields, pickListedRows } from './listedFields.js';
|
|
4
4
|
import { nextCall, workContextFromEnv, } from './nextCall.js';
|
|
@@ -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',
|
|
@@ -171,7 +171,48 @@ export function presentTaskOutcome(confirm, env) {
|
|
|
171
171
|
...(workContext ? { workContext } : {}),
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
|
+
export const delegateTaskCapability = {
|
|
175
|
+
key: 'task_delegate',
|
|
176
|
+
names: { sdk: 'task_delegate', mcp: 'ziggs_task_delegate' },
|
|
177
|
+
title: 'Delegate work',
|
|
178
|
+
descriptions: { sdk: 'Create an isolated child from approved instruction and input artifacts; return a completed child output after consent for the parent; or recheck readiness after approval. Keep the source execution selected. Child completion does not deliver its private result or model state. Use access_request for missing contribution consent. Recurses through ordinary tasks.' },
|
|
179
|
+
annotation: 'destructive',
|
|
180
|
+
needsAgentId: true,
|
|
181
|
+
params: {
|
|
182
|
+
action: { type: 'string', required: true, enum: ['create', 'return', 'readiness'], description: 'Which step' },
|
|
183
|
+
taskId: { type: 'string', required: true, description: 'Parent (create), child (return) or task (readiness)' },
|
|
184
|
+
agreementId: { type: 'string', description: 'Child agreement (create)' },
|
|
185
|
+
assigneeId: { type: 'string', description: 'Child executor (create)' },
|
|
186
|
+
instructionArtifactId: { type: 'string', description: 'Instructions (create)' },
|
|
187
|
+
inputArtifactIds: { type: 'array', items: { type: 'string' }, description: 'Approved inputs (create)' },
|
|
188
|
+
artifactId: { type: 'string', description: 'Child output (return)' },
|
|
189
|
+
idempotencyKey: { type: 'string', description: 'Retry key (create)' },
|
|
190
|
+
},
|
|
191
|
+
handler: async (args, env) => {
|
|
192
|
+
const required = (name) => {
|
|
193
|
+
const value = args[name];
|
|
194
|
+
if (typeof value !== 'string' || !value.trim())
|
|
195
|
+
throw new Error(`${name} is required`);
|
|
196
|
+
return value;
|
|
197
|
+
};
|
|
198
|
+
const taskId = required('taskId');
|
|
199
|
+
const creds = fullCreds(env);
|
|
200
|
+
if (args.action === 'readiness')
|
|
201
|
+
return refreshTaskReadiness(taskId, creds);
|
|
202
|
+
if (args.action === 'return')
|
|
203
|
+
return returnTaskResult(taskId, required('artifactId'), creds);
|
|
204
|
+
if (args.action !== 'create')
|
|
205
|
+
throw new Error('action must be create, return or readiness');
|
|
206
|
+
return delegateTask(taskId, {
|
|
207
|
+
agreementId: required('agreementId'), assigneeId: required('assigneeId'),
|
|
208
|
+
instructionArtifactId: required('instructionArtifactId'),
|
|
209
|
+
inputArtifactIds: args.inputArtifactIds,
|
|
210
|
+
idempotencyKey: args.idempotencyKey,
|
|
211
|
+
}, creds);
|
|
212
|
+
},
|
|
213
|
+
};
|
|
174
214
|
export const TASK_CAPABILITIES = [
|
|
175
215
|
listTasksCapability,
|
|
176
216
|
cancelTaskCapability,
|
|
217
|
+
delegateTaskCapability,
|
|
177
218
|
];
|
|
@@ -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) {
|