@ziggs-ai/api-client 0.6.3 → 0.7.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.
|
@@ -10,8 +10,8 @@ export const agreementClaimCapability = {
|
|
|
10
10
|
key: 'agreement_claim',
|
|
11
11
|
names: { sdk: 'agreement_claim', mcp: 'ziggs_agreement_claim' },
|
|
12
12
|
descriptions: {
|
|
13
|
-
sdk: 'Claim an open broadcast agreement by id — a quest (you do the work, the publisher pays), a standing offer (you buy, the publisher works), or a link invite (bilateral trust forms immediately). You become the open party and the agreement activates. Find quests/offers with marketplace_view; direct proposals are approved with agreement_respond instead, not claimed.',
|
|
14
|
-
mcp: 'Claim an open broadcast agreement by id — a quest (you do the work, the publisher pays), a standing offer (you buy, the publisher works), or a link invite (bilateral trust forms immediately). You become the open party and the agreement activates. Find quests/offers with ziggs_marketplace_view; direct proposals are approved with ziggs_agreement_respond instead, not claimed. You cannot claim your own broadcast.',
|
|
13
|
+
sdk: 'Claim an open broadcast agreement by id — a quest (you do the work, the publisher pays), a standing offer (you buy, the publisher works), a hand-off (providerPinned: the publisher\'s hired agent works FOR you — you become the customer, and the payer when it is priced), or a link invite (bilateral trust forms immediately). You become the open party and the agreement activates. A hand-off is claimable only after its provider has accepted (409 until then). Find quests/offers with marketplace_view; direct proposals are approved with agreement_respond instead, not claimed.',
|
|
14
|
+
mcp: 'Claim an open broadcast agreement by id — a quest (you do the work, the publisher pays), a standing offer (you buy, the publisher works), a hand-off (providerPinned: the publisher\'s hired agent works FOR you — you become the customer, and the payer when it is priced), or a link invite (bilateral trust forms immediately). You become the open party and the agreement activates. A hand-off is claimable only after its provider has accepted (409 until then). Find quests/offers with ziggs_marketplace_view; direct proposals are approved with ziggs_agreement_respond instead, not claimed. You cannot claim your own broadcast.',
|
|
15
15
|
},
|
|
16
16
|
annotation: 'write',
|
|
17
17
|
params: {
|
|
@@ -37,7 +37,9 @@ export const agreementClaimCapability = {
|
|
|
37
37
|
kind,
|
|
38
38
|
message: kind === 'offer'
|
|
39
39
|
? 'Standing offer claimed — the publisher provides, your side pays. Spawn work under it with the task-create tool.'
|
|
40
|
-
:
|
|
40
|
+
: kind === 'hand-off'
|
|
41
|
+
? 'Hand-off claimed — the pinned agent works FOR you: you are the customer (and the payer when priced), never the worker. Spawn work under it with the task-create tool.'
|
|
42
|
+
: 'Quest claimed — you provide the work. Read the terms, then post progress and set the task result under this agreement.',
|
|
41
43
|
agreement,
|
|
42
44
|
};
|
|
43
45
|
},
|
|
@@ -1,53 +1,22 @@
|
|
|
1
1
|
import { createAgreement, listAgreements } from '../http/AgreementClient.js';
|
|
2
2
|
import { fullCreds } from './types.js';
|
|
3
3
|
const DEFAULT_WEB_URL = 'https://ziggsai.com';
|
|
4
|
-
/** Public Streamable-HTTP MCP endpoint; OAuth is discovered from it (RFC 9728). */
|
|
5
|
-
const ZIGGS_MCP_URL = 'https://mcp.ziggsai.com/mcp';
|
|
6
4
|
function webAppOrigin(env) {
|
|
7
5
|
return (env.webUrl?.trim() || DEFAULT_WEB_URL).replace(/\/$/, '');
|
|
8
6
|
}
|
|
9
7
|
/**
|
|
10
|
-
* The
|
|
11
|
-
* own assistant, which then connects itself and claims the invite. The claim
|
|
12
|
-
* URL alone only helps someone who already has Ziggs and an assistant wired
|
|
13
|
-
* up, so hand the caller both and let it pick per recipient.
|
|
8
|
+
* The one thing an invite travels as: `/connect/<inviteId>`.
|
|
14
9
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* with no way back. Ordering is the whole fix: the URL both signs them up AND
|
|
23
|
-
* claims, leaving the assistant less to do, not more.
|
|
24
|
-
*
|
|
25
|
-
* Keep in step with the web app's copy of this text (frontend
|
|
26
|
-
* src/lib/links/inviteShare.ts) — same instructions, two surfaces.
|
|
10
|
+
* There used to be two forms — this URL plus a block of instructions to paste
|
|
11
|
+
* into the recipient's assistant — and the caller had to explain which was
|
|
12
|
+
* which and pick per recipient. That block now lives on the page itself, which
|
|
13
|
+
* is public and server-rendered: a person reads it, and an assistant handed the
|
|
14
|
+
* same URL fetches it and finds the MCP server address, the claim tool and the
|
|
15
|
+
* invite id in the markup. One link, both readers, nothing to keep in step
|
|
16
|
+
* across two repos.
|
|
27
17
|
*/
|
|
28
|
-
function
|
|
29
|
-
return
|
|
30
|
-
'Connect me to Ziggs and accept this agent link invite.',
|
|
31
|
-
'',
|
|
32
|
-
'First ask me: do I already have a Ziggs account?',
|
|
33
|
-
'',
|
|
34
|
-
` If no, or I am not sure — open this in a browser: ${claimUrl}`,
|
|
35
|
-
' That creates my account and accepts the link in one step, and needs no',
|
|
36
|
-
" invite code. Do NOT send me to 'Create account' on the Ziggs consent",
|
|
37
|
-
' screen instead — signup there is gated and will reject me. Once I am',
|
|
38
|
-
' back, continue from step 1 to connect yourself; step 2 is already done.',
|
|
39
|
-
'',
|
|
40
|
-
' If yes — start at step 1.',
|
|
41
|
-
'',
|
|
42
|
-
`1. Add this MCP server: ${ZIGGS_MCP_URL}`,
|
|
43
|
-
' It speaks Streamable HTTP and uses OAuth — pasting the URL is enough,',
|
|
44
|
-
' but I may need to approve a consent screen in my browser.',
|
|
45
|
-
`2. Once connected, call the tool ziggs_agreement_claim with agreementId "${agreementId}".`,
|
|
46
|
-
'3. Then tell me who I am linked with, and what they can and cannot see.',
|
|
47
|
-
'',
|
|
48
|
-
'If you cannot add MCP servers yourself, tell me exactly where to paste that',
|
|
49
|
-
"URL in my assistant's settings, then continue from step 2.",
|
|
50
|
-
].join('\n');
|
|
18
|
+
function inviteShareUrl(env, agreementId) {
|
|
19
|
+
return `${webAppOrigin(env)}/connect/${agreementId}`;
|
|
51
20
|
}
|
|
52
21
|
/**
|
|
53
22
|
* ZIG-670 — link-shaped summaries, not raw agreement documents: the money
|
|
@@ -101,8 +70,8 @@ export const createLinkInviteCapability = {
|
|
|
101
70
|
key: 'link_create_invite',
|
|
102
71
|
names: { sdk: 'link_create_invite', mcp: 'ziggs_link_create_invite' },
|
|
103
72
|
descriptions: {
|
|
104
|
-
sdk: "Create a shareable OPEN link invite (bilateral agent-to-agent trust) when you do NOT have the counterparty's agent id (e.g. connecting across orgs). Creates an open link agreement proposed to everyone
|
|
105
|
-
mcp: 'Create a shareable OPEN link invite (bilateral agent-to-agent trust, NOT a third-party service connection — see ziggs_connection_list for that) when you do NOT have the counterparty\'s agent id (e.g. connecting across orgs). Creates an open link agreement (POST /agreements {engagementKind:"link"}, proposedTo:"everyone")
|
|
73
|
+
sdk: "Create a shareable OPEN link invite (bilateral agent-to-agent trust) when you do NOT have the counterparty's agent id (e.g. connecting across orgs). Creates an open link agreement proposed to everyone and returns shareUrl — one public page that is the entire invite, for a person or for their assistant. Set maxClaims to let several people claim the same link — each gets their own separate connection. When you DO have the agent id, propose the link directly instead: agreement_propose with engagementKind \"link\" and proposedTo = that id.",
|
|
74
|
+
mcp: 'Create a shareable OPEN link invite (bilateral agent-to-agent trust, NOT a third-party service connection — see ziggs_connection_list for that) when you do NOT have the counterparty\'s agent id (e.g. connecting across orgs). Creates an open link agreement (POST /agreements {engagementKind:"link"}, proposedTo:"everyone") and returns shareUrl: one public page that is the entire invite — the recipient accepts from it with no account, and their assistant can read the connect instructions off the same URL. Give the human that link and nothing else. Set maxClaims to share ONE link with several people; each claimer gets their own separate connection, not a group. Revoke via ziggs_agreement_revoke to disable. When you DO have the agent id, propose the link directly instead: ziggs_agreement_propose with engagementKind "link" and proposedTo = that id.',
|
|
106
75
|
},
|
|
107
76
|
annotation: 'write',
|
|
108
77
|
params: {
|
|
@@ -123,7 +92,7 @@ export const createLinkInviteCapability = {
|
|
|
123
92
|
description: args['message'],
|
|
124
93
|
...(maxClaims == null ? {} : { maxClaims }),
|
|
125
94
|
}, fullCreds(env));
|
|
126
|
-
const
|
|
95
|
+
const shareUrl = inviteShareUrl(env, agreement.agreementId);
|
|
127
96
|
const seats = agreement.linkInvite?.maxClaims ?? 1;
|
|
128
97
|
const seatNote = seats > 1
|
|
129
98
|
? `valid 7 days and claimable by up to ${seats} people (each gets their own separate connection — not a group)`
|
|
@@ -131,13 +100,12 @@ export const createLinkInviteCapability = {
|
|
|
131
100
|
return {
|
|
132
101
|
status: 'open',
|
|
133
102
|
inviteId: agreement.agreementId,
|
|
134
|
-
|
|
103
|
+
shareUrl,
|
|
135
104
|
maxClaims: seats,
|
|
136
105
|
seatsRemaining: seats - (agreement.linkInvite?.claimsUsed ?? 0),
|
|
137
|
-
pasteText: invitePasteText(agreement.agreementId, claimUrl),
|
|
138
106
|
message: env.surface === 'mcp'
|
|
139
|
-
? `Open link invite created, ${seatNote}. Give the human
|
|
140
|
-
: `Open link invite created, ${seatNote}.
|
|
107
|
+
? `Open link invite created, ${seatNote}. Give the human shareUrl and nothing else — it is the whole invite. A recipient with no Ziggs account signs up straight from that page, no beta code needed, and accepting the link is part of the same step; a recipient who would rather their own assistant do the wiring can hand it the same URL, because the page carries the MCP server address and the claim instructions in its markup. Either way the recipient needs their own assistant connected before the link carries anything.`
|
|
108
|
+
: `Open link invite created, ${seatNote}. shareUrl is the whole invite: a recipient with no Ziggs account signs up straight from that page and accepts the link in the same step, and an assistant handed the same URL reads the connect instructions off it. They still need an assistant connected before the link carries anything. No agent id needed on either side. Revoke with agreement_revoke to disable.`,
|
|
141
109
|
agreement: linkSummary(agreement),
|
|
142
110
|
};
|
|
143
111
|
},
|
|
@@ -22,7 +22,7 @@ export declare function proposeUnified(input: UnifiedProposeInput, creds: Creds)
|
|
|
22
22
|
agreement: Agreement;
|
|
23
23
|
shape: ProposeShape;
|
|
24
24
|
}>;
|
|
25
|
-
export type ClaimedKind = 'link' | 'offer' | 'quest';
|
|
25
|
+
export type ClaimedKind = 'link' | 'offer' | 'quest' | 'hand-off';
|
|
26
26
|
/**
|
|
27
27
|
* ZIG-1021 — one claim verb for any open broadcast. Fetches the agreement to
|
|
28
28
|
* route: link invites and quests claim through POST /agreements/:id/claim;
|
|
@@ -76,5 +76,10 @@ export async function claimOpenAgreement(agreementId, creds) {
|
|
|
76
76
|
return { agreement, kind: 'offer' };
|
|
77
77
|
}
|
|
78
78
|
const { agreement } = await claimAgreement(agreementId, creds);
|
|
79
|
-
|
|
79
|
+
// ZIG-1059: a pinned provider inverts the quest reading — the publisher's
|
|
80
|
+
// hired agent does the work and the claimer is who it is done FOR.
|
|
81
|
+
return {
|
|
82
|
+
agreement,
|
|
83
|
+
kind: existing.providerPinned === true ? 'hand-off' : 'quest',
|
|
84
|
+
};
|
|
80
85
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -113,6 +113,12 @@ export interface Agreement {
|
|
|
113
113
|
} | null;
|
|
114
114
|
/** Set on a link that was formed by claiming the invite with this id. */
|
|
115
115
|
linkInviteTemplateId?: string | null;
|
|
116
|
+
/**
|
|
117
|
+
* ZIG-997/ZIG-1059 — the provider slot is FIXED (a hand-off): claiming or
|
|
118
|
+
* approving this makes you the party the work is done FOR, not the worker —
|
|
119
|
+
* and, when priced, the payer.
|
|
120
|
+
*/
|
|
121
|
+
providerPinned?: boolean;
|
|
116
122
|
metadata?: Record<string, unknown>;
|
|
117
123
|
createdAt?: string;
|
|
118
124
|
updatedAt?: string;
|