@ziggs-ai/api-client 0.9.10 → 0.9.12
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/README.md +1 -1
- package/dist/ConnectionManager.d.ts +1 -1
- package/dist/ConnectionManager.js +1 -1
- package/dist/capabilities/agreements.d.ts +1 -1
- package/dist/capabilities/agreements.js +1 -1
- package/dist/capabilities/artifacts.d.ts +3 -3
- package/dist/capabilities/artifacts.js +6 -6
- package/dist/capabilities/chat.d.ts +4 -4
- package/dist/capabilities/chat.js +5 -5
- package/dist/capabilities/connections.js +13 -8
- package/dist/capabilities/context.d.ts +4 -4
- package/dist/capabilities/context.js +6 -6
- package/dist/capabilities/discovery.js +1 -1
- package/dist/capabilities/grants.d.ts +3 -3
- package/dist/capabilities/grants.js +3 -3
- package/dist/capabilities/links.js +1 -1
- package/dist/capabilities/marketplace.d.ts +1 -1
- package/dist/capabilities/marketplace.js +1 -1
- package/dist/capabilities/payments.js +1 -1
- package/dist/capabilities/proposeProviderId.d.ts +1 -1
- package/dist/capabilities/proposeProviderId.js +1 -1
- package/dist/capabilities/types.d.ts +3 -3
- package/dist/capabilities/types.js +2 -2
- package/dist/http/AgentSearchClient.d.ts +1 -2
- package/dist/http/AgreementClient.d.ts +11 -21
- package/dist/http/AgreementClient.js +29 -59
- package/dist/http/ArtifactsClient.d.ts +8 -8
- package/dist/http/ArtifactsClient.js +10 -10
- package/dist/http/ChatClient.d.ts +3 -3
- package/dist/http/ChatClient.js +6 -6
- package/dist/http/ConnectionsClient.d.ts +8 -8
- package/dist/http/ConnectionsClient.js +7 -7
- package/dist/http/ContextDiscoveryClient.d.ts +1 -1
- package/dist/http/ContextGrantsClient.d.ts +7 -7
- package/dist/http/ContextGrantsClient.js +3 -3
- package/dist/http/ContextReadClient.d.ts +3 -3
- package/dist/http/ContextReadClient.js +4 -4
- package/dist/http/GrantsClient.d.ts +4 -4
- package/dist/http/GrantsClient.js +1 -1
- package/dist/http/InboxClient.d.ts +9 -5
- package/dist/http/InboxClient.js +13 -6
- package/dist/http/MarketplaceClient.js +3 -3
- package/dist/http/OrgsClient.d.ts +10 -10
- package/dist/http/OrgsClient.js +11 -11
- package/dist/http/PaymentsClient.d.ts +4 -4
- package/dist/http/PaymentsClient.js +7 -7
- package/dist/http/TaskClient.d.ts +6 -6
- package/dist/http/TaskClient.js +3 -3
- package/dist/http/agreementFlows.d.ts +3 -3
- package/dist/http/agreementFlows.js +2 -2
- package/dist/http/grants.d.ts +1 -1
- package/dist/http/grants.js +1 -1
- package/dist/http/index.js +1 -1
- package/dist/http/operatorHeaders.d.ts +2 -2
- package/dist/http/operatorHeaders.js +2 -2
- package/dist/index.js +2 -2
- package/dist/shared/apiError.d.ts +1 -1
- package/dist/shared/apiError.js +1 -1
- package/dist/shared/rateLimit.d.ts +2 -2
- package/dist/shared/rateLimit.js +2 -2
- package/dist/types.d.ts +30 -28
- package/dist/types.js +4 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ await inbox.ack([{ kind: 'chat', id: '<chatId>', upTo: env.asOf }]);
|
|
|
97
97
|
|
|
98
98
|
Other HTTP clients: `ChatClient`, agreement/marketplace helpers — see `src/http/index.ts`.
|
|
99
99
|
|
|
100
|
-
### Persona wire shapes
|
|
100
|
+
### Persona wire shapes
|
|
101
101
|
|
|
102
102
|
Cross-org inbox and chat payloads mask counterparties behind presentation faces:
|
|
103
103
|
|
|
@@ -14,7 +14,7 @@ export interface QueryFilter {
|
|
|
14
14
|
/**
|
|
15
15
|
* ConnectionManager — the set of agent hosts this process runs.
|
|
16
16
|
*
|
|
17
|
-
* Every registered agent is connected and stays connected
|
|
17
|
+
* Every registered agent is connected and stays connected. There is
|
|
18
18
|
* no subset, no cap, no idle sweep and no lifecycle policy: an agent is alive
|
|
19
19
|
* because its launcher registered it, and the only thing that takes it down is
|
|
20
20
|
* the process exiting. Whether work has arrived recently is not a fact about
|
|
@@ -2,7 +2,7 @@ import { runtimeLog } from './shared/runtimeLog.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* ConnectionManager — the set of agent hosts this process runs.
|
|
4
4
|
*
|
|
5
|
-
* Every registered agent is connected and stays connected
|
|
5
|
+
* Every registered agent is connected and stays connected. There is
|
|
6
6
|
* no subset, no cap, no idle sweep and no lifecycle policy: an agent is alive
|
|
7
7
|
* because its launcher registered it, and the only thing that takes it down is
|
|
8
8
|
* the process exiting. Whether work has arrived recently is not a fact about
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CapabilityDefinition } from './types.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* the one claim verb. Quests, standing offers, and link invites
|
|
4
4
|
* are all open broadcasts; claiming any of them is this call. The respond
|
|
5
5
|
* tool no longer claims — it approves/rejects direct proposals only.
|
|
6
6
|
*/
|
|
@@ -2,7 +2,7 @@ import { claimOpenAgreement } from '../http/agreementFlows.js';
|
|
|
2
2
|
import { linkIsReachOnly } from './links.js';
|
|
3
3
|
import { fullCreds } from './types.js';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* the one claim verb. Quests, standing offers, and link invites
|
|
6
6
|
* are all open broadcasts; claiming any of them is this call. The respond
|
|
7
7
|
* tool no longer claims — it approves/rejects direct proposals only.
|
|
8
8
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CapabilityDefinition } from './types.js';
|
|
2
2
|
export declare const recordArtifactCapability: CapabilityDefinition;
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* the artifacts you wrote, across every scope and none.
|
|
5
5
|
*
|
|
6
6
|
* The scope listings (`context_read` via chat / agreement / task) read attach
|
|
7
7
|
* tables, so a free-standing artifact appears in none of them. This is how an
|
|
@@ -9,7 +9,7 @@ export declare const recordArtifactCapability: CapabilityDefinition;
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const listArtifactsCapability: CapabilityDefinition;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* hand one artifact you authored to one other agent.
|
|
13
13
|
*
|
|
14
14
|
* Deliberately not part of `context_delegate`: there is no parent grant to
|
|
15
15
|
* attenuate here. An agent holds no grant over its own output — authorship is
|
|
@@ -20,7 +20,7 @@ export declare const listArtifactsCapability: CapabilityDefinition;
|
|
|
20
20
|
*/
|
|
21
21
|
export declare const shareArtifactCapability: CapabilityDefinition;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* attach an artifact you already have to a chat or a task.
|
|
24
24
|
*
|
|
25
25
|
* The other half of "record now, decide where later". Attaching confers nothing
|
|
26
26
|
* by itself: it puts the artifact inside the container, and that container's
|
|
@@ -2,7 +2,7 @@ import { ArtifactsClient } from '../http/ArtifactsClient.js';
|
|
|
2
2
|
import { ContextGrantsClient } from '../http/ContextGrantsClient.js';
|
|
3
3
|
import { fullCreds } from './types.js';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* teaching: name the result slot on the success path so an agent finds
|
|
6
6
|
* the right move unaided — worded in each surface's task grammar (SDK
|
|
7
7
|
* task_set_result carries the terminal result; MCP has ziggs_task_set_result).
|
|
8
8
|
*/
|
|
@@ -68,9 +68,9 @@ export const recordArtifactCapability = {
|
|
|
68
68
|
// was worse: the artifact landed somewhere the caller had just been told it
|
|
69
69
|
// would also appear. The refusal itself lives in ArtifactsClient, the one
|
|
70
70
|
// gate every writer goes through, so this surface cannot drift from the
|
|
71
|
-
// others by wording its own verdict
|
|
71
|
+
// others by wording its own verdict.
|
|
72
72
|
const chatId = args['chatId'];
|
|
73
|
-
//
|
|
73
|
+
// no scope is legal. The throw that used to live here ("Pass
|
|
74
74
|
// chatId or agreementId") is the exact failure this ticket removed — it cost
|
|
75
75
|
// a live agent a turn mid-delivery for naming no container, when the record
|
|
76
76
|
// itself never needed one.
|
|
@@ -102,7 +102,7 @@ export const recordArtifactCapability = {
|
|
|
102
102
|
},
|
|
103
103
|
};
|
|
104
104
|
/**
|
|
105
|
-
*
|
|
105
|
+
* the artifacts you wrote, across every scope and none.
|
|
106
106
|
*
|
|
107
107
|
* The scope listings (`context_read` via chat / agreement / task) read attach
|
|
108
108
|
* tables, so a free-standing artifact appears in none of them. This is how an
|
|
@@ -136,7 +136,7 @@ export const listArtifactsCapability = {
|
|
|
136
136
|
},
|
|
137
137
|
};
|
|
138
138
|
/**
|
|
139
|
-
*
|
|
139
|
+
* hand one artifact you authored to one other agent.
|
|
140
140
|
*
|
|
141
141
|
* Deliberately not part of `context_delegate`: there is no parent grant to
|
|
142
142
|
* attenuate here. An agent holds no grant over its own output — authorship is
|
|
@@ -204,7 +204,7 @@ export const shareArtifactCapability = {
|
|
|
204
204
|
},
|
|
205
205
|
};
|
|
206
206
|
/**
|
|
207
|
-
*
|
|
207
|
+
* attach an artifact you already have to a chat or a task.
|
|
208
208
|
*
|
|
209
209
|
* The other half of "record now, decide where later". Attaching confers nothing
|
|
210
210
|
* by itself: it puts the artifact inside the container, and that container's
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type CapabilityDefinition } from './types.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* the decided chat surface for agents: chat_open only.
|
|
4
4
|
* There is deliberately NO chat-listing tool on the SDK: agents read context
|
|
5
|
-
* only via held grants
|
|
6
|
-
*
|
|
7
|
-
* scopeKind=chat
|
|
5
|
+
* only via held grants and chat membership auto-mints a chat grant,
|
|
6
|
+
* so "what chats can I see" is already answered by grant_list
|
|
7
|
+
* scopeKind=chat. MCP keeps its rich session-UX lister
|
|
8
8
|
* (ziggs_chat_list) for humans in Cursor/Claude.
|
|
9
9
|
*/
|
|
10
10
|
export declare const openConversationCapability: CapabilityDefinition;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { openConversation } from '../http/ChatClient.js';
|
|
2
2
|
import { fullCreds } from './types.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* the decided chat surface for agents: chat_open only.
|
|
5
5
|
* There is deliberately NO chat-listing tool on the SDK: agents read context
|
|
6
|
-
* only via held grants
|
|
7
|
-
*
|
|
8
|
-
* scopeKind=chat
|
|
6
|
+
* only via held grants and chat membership auto-mints a chat grant,
|
|
7
|
+
* so "what chats can I see" is already answered by grant_list
|
|
8
|
+
* scopeKind=chat. MCP keeps its rich session-UX lister
|
|
9
9
|
* (ziggs_chat_list) for humans in Cursor/Claude.
|
|
10
10
|
*/
|
|
11
11
|
export const openConversationCapability = {
|
|
@@ -38,7 +38,7 @@ export const openConversationCapability = {
|
|
|
38
38
|
const { chatId, reused } = await openConversation(args['participantId'], fullCreds(env), { newChat: args['newChat'] === true });
|
|
39
39
|
const lister = env.surface === 'mcp' ? 'ziggs_grant_list' : 'grant_list';
|
|
40
40
|
const grantNote = `Your membership auto-mints a chat grant, so the chat also appears in ${lister} scopeKind=chat for context reads.`;
|
|
41
|
-
//
|
|
41
|
+
// word the note from the outcome instead of covering both cases.
|
|
42
42
|
// "Open (or reused)" told the agent the distinction existed and then
|
|
43
43
|
// withheld it — worse than silence, because the agent cannot even tell
|
|
44
44
|
// there is something to look up. A backend too old to report it keeps the
|
|
@@ -10,10 +10,13 @@ export const connectionProxyCapability = {
|
|
|
10
10
|
key: 'connection_proxy',
|
|
11
11
|
names: { sdk: 'connection_proxy', mcp: 'ziggs_connection_proxy' },
|
|
12
12
|
descriptions: {
|
|
13
|
-
sdk: "Use a stored connection (
|
|
14
|
-
|
|
15
|
-
'
|
|
16
|
-
'
|
|
13
|
+
sdk: "Use a named-connector stored connection (e.g. the owner's GitHub/Jira) without ever seeing the credential. " +
|
|
14
|
+
'Calls the backend connections proxy with a grant the owner issued to this agent. ' +
|
|
15
|
+
'Not for remote MCP servers (provider "mcp") — those use mcp_tool_call / mcp_tools_list; proxy refuses them with "Unknown provider: mcp". ' +
|
|
16
|
+
"Don't know connectionId/grantId yet? Use grant_list (scopeKind=connection) or connection_list_grants first.",
|
|
17
|
+
mcp: "Use a named-connector stored connection (e.g. the owner's GitHub/Jira — NOT an agent-to-agent Link, see ziggs_link_list) without ever seeing the credential. " +
|
|
18
|
+
'Calls the backend connections proxy with a grant the owner issued to this agent. ' +
|
|
19
|
+
'Not for remote MCP servers (provider "mcp") — those use ziggs_mcp_tool_call / ziggs_mcp_tools_list; proxy refuses them with "Unknown provider: mcp". ' +
|
|
17
20
|
"Don't know connectionId/grantId yet? Call ziggs_connection_list first.",
|
|
18
21
|
},
|
|
19
22
|
annotation: 'write',
|
|
@@ -53,10 +56,12 @@ export const requestConnectionCapability = {
|
|
|
53
56
|
key: 'connection_request',
|
|
54
57
|
names: { sdk: 'connection_request', mcp: 'ziggs_connection_request' },
|
|
55
58
|
descriptions: {
|
|
56
|
-
sdk: 'Ask your principal (the human) to connect a remote MCP server and grant you the listed tools.
|
|
59
|
+
sdk: 'Ask your principal (the human) to connect a remote MCP server and grant you the listed tools. ' +
|
|
60
|
+
'Opens a connection-consent agreement as an approvable card in the chat you pass — the human approves it there like any other agreement. ' +
|
|
61
|
+
'On approval the server is connected (browser OAuth if needed) and you are granted the tools; call them with mcp_tool_call / mcp_tools_list (not connection_proxy).',
|
|
57
62
|
mcp: 'Ask your principal (the human) to connect a remote MCP server and grant you the listed tools. ' +
|
|
58
63
|
'Opens a connection-consent agreement as an approvable card in the chat you pass — the human approves it there like any other agreement (there is no MCP tool to approve it, so tell them to approve it in the chat). ' +
|
|
59
|
-
'On approval the server is connected (browser OAuth if needed) and you are granted the tools; the result shows up in ziggs_connection_list for use with ziggs_connection_proxy.',
|
|
64
|
+
'On approval the server is connected (browser OAuth if needed) and you are granted the tools; the result shows up in ziggs_connection_list for use with ziggs_mcp_tools_list / ziggs_mcp_tool_call (not ziggs_connection_proxy).',
|
|
60
65
|
},
|
|
61
66
|
annotation: 'write',
|
|
62
67
|
params: {
|
|
@@ -96,9 +101,9 @@ export const requestConnectionCapability = {
|
|
|
96
101
|
...result,
|
|
97
102
|
note: env.surface === 'mcp'
|
|
98
103
|
? 'A connection-consent card is now in the chat awaiting your principal. Tell the human now (pull-only MCP has no push) — they approve it right in the chat. ' +
|
|
99
|
-
'Once approved, the connection + grant appear in ziggs_connection_list for
|
|
104
|
+
'Once approved, the connection + grant appear in ziggs_connection_list for ziggs_mcp_tools_list / ziggs_mcp_tool_call.'
|
|
100
105
|
: 'A connection-consent card is now in the chat awaiting your principal — they approve it right there. ' +
|
|
101
|
-
'Once approved, the connection + grant appear in grant_list (scopeKind=connection) / connection_list_grants for
|
|
106
|
+
'Once approved, the connection + grant appear in grant_list (scopeKind=connection) / connection_list_grants for mcp_tools_list / mcp_tool_call.',
|
|
102
107
|
};
|
|
103
108
|
}
|
|
104
109
|
catch (e) {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { type GrantView } from '../http/grants.js';
|
|
2
2
|
import { type CapabilityDefinition, type CapabilityEnv } from './types.js';
|
|
3
3
|
/**
|
|
4
|
-
* Human/LLM-readable bounds for a context grant.
|
|
4
|
+
* Human/LLM-readable bounds for a context grant. folded a context
|
|
5
5
|
* grant's temporal mode + read watermark into the canonical `caveats` array,
|
|
6
6
|
* so pull them back out here to keep the `bounds` summary stable.
|
|
7
7
|
*/
|
|
8
8
|
export declare function contextBounds(grant: GrantView): Record<string, unknown>;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
* opaque org_
|
|
10
|
+
* #6 — org-scoped grants may name the org instead of pasting its
|
|
11
|
+
* opaque org_.. id: exact id or case-insensitive name against the operator's
|
|
12
12
|
* memberships. Ambiguous names throw with the candidate list rather than
|
|
13
13
|
* guessing; a name that matched nothing throws with a pointer to the org
|
|
14
|
-
* lister. An org_
|
|
14
|
+
* lister. An org_.. id that is not a membership passes through unchanged —
|
|
15
15
|
* you may hold a grant on an org you do not belong to, so the server stays
|
|
16
16
|
* the authority on the id.
|
|
17
17
|
*/
|
|
@@ -4,13 +4,13 @@ import { ContextDiscoveryClient } from '../http/ContextDiscoveryClient.js';
|
|
|
4
4
|
import { grantCaveat, CONTEXT_GRANT_SCOPE_KINDS, } from '../http/grants.js';
|
|
5
5
|
import { fetchMyOrgs, resolveOrgSelector } from '../http/OrgsClient.js';
|
|
6
6
|
import { fullCreds } from './types.js';
|
|
7
|
-
//
|
|
7
|
+
// `artifact` joined the context rail. Delegating an artifact grant
|
|
8
8
|
// onward works (same kind, same id — an exact re-grant); narrowing a container
|
|
9
9
|
// grant DOWN to an artifact inside it is deliberately not supported yet.
|
|
10
10
|
const GRANT_SCOPE_KINDS = CONTEXT_GRANT_SCOPE_KINDS;
|
|
11
11
|
const CONTEXT_TEMPORALS = ['from-now', 'from-start'];
|
|
12
12
|
/**
|
|
13
|
-
* Human/LLM-readable bounds for a context grant.
|
|
13
|
+
* Human/LLM-readable bounds for a context grant. folded a context
|
|
14
14
|
* grant's temporal mode + read watermark into the canonical `caveats` array,
|
|
15
15
|
* so pull them back out here to keep the `bounds` summary stable.
|
|
16
16
|
*/
|
|
@@ -22,11 +22,11 @@ export function contextBounds(grant) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
* opaque org_
|
|
25
|
+
* #6 — org-scoped grants may name the org instead of pasting its
|
|
26
|
+
* opaque org_.. id: exact id or case-insensitive name against the operator's
|
|
27
27
|
* memberships. Ambiguous names throw with the candidate list rather than
|
|
28
28
|
* guessing; a name that matched nothing throws with a pointer to the org
|
|
29
|
-
* lister. An org_
|
|
29
|
+
* lister. An org_.. id that is not a membership passes through unchanged —
|
|
30
30
|
* you may hold a grant on an org you do not belong to, so the server stays
|
|
31
31
|
* the authority on the id.
|
|
32
32
|
*/
|
|
@@ -202,7 +202,7 @@ export const contextDelegateCapability = {
|
|
|
202
202
|
if (!GRANT_SCOPE_KINDS.includes(scopeKind)) {
|
|
203
203
|
throw new Error(`scopeKind must be one of ${GRANT_SCOPE_KINDS.join(', ')}`);
|
|
204
204
|
}
|
|
205
|
-
//
|
|
205
|
+
// #6 — an org scope may be named rather than pasted as org_… id.
|
|
206
206
|
let scopeId = args['scopeId'];
|
|
207
207
|
if (scopeKind === 'org') {
|
|
208
208
|
scopeId = await resolveOrgScopeId(env, scopeId);
|
|
@@ -31,7 +31,7 @@ export const agentSearchCapability = {
|
|
|
31
31
|
throw new Error(result.error ?? result.message ?? 'search failed');
|
|
32
32
|
}
|
|
33
33
|
if (!result.agents?.length) {
|
|
34
|
-
//
|
|
34
|
+
// a bare {count: 0} reads as "discovery is down" to LLM
|
|
35
35
|
// callers — say what was searched and how to recover instead.
|
|
36
36
|
return {
|
|
37
37
|
count: 0,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type CapabilityDefinition } from './types.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* the single "what authority do I hold?" tool. One name, every rail
|
|
4
4
|
* (context chat/agreement/org/artifact, connection, wallet), holder-scoped,
|
|
5
|
-
* cross-session. `unreadableRails` comes from the backend
|
|
5
|
+
* cross-session. `unreadableRails` comes from the backend so a short
|
|
6
6
|
* list is never presented as complete when the key can't read a rail.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* HOLD, not reach. `GET /grants` queries three row collections and
|
|
9
9
|
* nothing else; the implicit arms in AccessService (authorship, chat
|
|
10
10
|
* membership, agreement party, org membership) leave no row behind, so a reader
|
|
11
11
|
* can be entitled to something this list will never mention. The description
|
|
@@ -22,12 +22,12 @@ function parseScopeKinds(raw) {
|
|
|
22
22
|
return out.length ? out : undefined;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* the single "what authority do I hold?" tool. One name, every rail
|
|
26
26
|
* (context chat/agreement/org/artifact, connection, wallet), holder-scoped,
|
|
27
|
-
* cross-session. `unreadableRails` comes from the backend
|
|
27
|
+
* cross-session. `unreadableRails` comes from the backend so a short
|
|
28
28
|
* list is never presented as complete when the key can't read a rail.
|
|
29
29
|
*
|
|
30
|
-
*
|
|
30
|
+
* HOLD, not reach. `GET /grants` queries three row collections and
|
|
31
31
|
* nothing else; the implicit arms in AccessService (authorship, chat
|
|
32
32
|
* membership, agreement party, org membership) leave no row behind, so a reader
|
|
33
33
|
* can be entitled to something this list will never mention. The description
|
|
@@ -41,7 +41,7 @@ const LINK_STATUSES = ['active', 'open', 'cancelled', 'all'];
|
|
|
41
41
|
* limit instead of letting an agent discover it by getting a 400.
|
|
42
42
|
*/
|
|
43
43
|
const MAX_LINK_INVITE_CLAIMS = 25;
|
|
44
|
-
|
|
44
|
+
///1022 — the link rail shrank to two tools. Links are agreements, so
|
|
45
45
|
// the agreement verbs carry the rest: request a direct link with
|
|
46
46
|
// agreement_propose (engagementKind 'link', proposedTo = the agent id), claim
|
|
47
47
|
// an invite with agreement_claim, end a link with agreement_revoke.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CapabilityDefinition } from './types.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* the marketplace read on both surfaces. Publishing and claiming
|
|
4
4
|
* ride the agreement grammar (propose-with-audience / agreement_claim); this
|
|
5
5
|
* is the browse that hands you the agreementIds those verbs need.
|
|
6
6
|
*/
|
|
@@ -9,7 +9,7 @@ function publishHint(env) {
|
|
|
9
9
|
`the same with providerId = your own id publishes a standing offer (you work, claimer pays).`);
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* the marketplace read on both surfaces. Publishing and claiming
|
|
13
13
|
* ride the agreement grammar (propose-with-audience / agreement_claim); this
|
|
14
14
|
* is the browse that hands you the agreementIds those verbs need.
|
|
15
15
|
*/
|
|
@@ -393,7 +393,7 @@ export const paymentRevokeGrantCapability = {
|
|
|
393
393
|
}
|
|
394
394
|
},
|
|
395
395
|
};
|
|
396
|
-
//
|
|
396
|
+
// payment_list_grants stays retired; the wallet rail is part of the
|
|
397
397
|
// unified grant_list capability (scopeKind: 'wallet'). Grant *mutations* stay
|
|
398
398
|
// on the payment rail above.
|
|
399
399
|
export const PAYMENT_CAPABILITIES = [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* `providerId` parameter description shared by SDK + MCP propose
|
|
3
3
|
* tools. Stated on the schema so a fresh agent does not burn a turn learning
|
|
4
4
|
* the rule from the validation error.
|
|
5
5
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* `providerId` parameter description shared by SDK + MCP propose
|
|
3
3
|
* tools. Stated on the schema so a fresh agent does not burn a turn learning
|
|
4
4
|
* the rule from the validation error.
|
|
5
5
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* one shared definition per SDK/MCP tool capability.
|
|
3
3
|
*
|
|
4
|
-
* The tool-surface-parity epic (
|
|
4
|
+
* The tool-surface-parity epic (→903) unified the HTTP layer here in
|
|
5
5
|
* api-client but left ~25 shared capabilities hand-written twice: once in the
|
|
6
6
|
* agent-sdk's defineTool DSL, once in ziggs-mcp zod. Each capability below is
|
|
7
7
|
* the single source for the tool's schema, validation, response shaping, and
|
|
@@ -54,7 +54,7 @@ export interface CapabilityEnv {
|
|
|
54
54
|
export interface CapabilityDefinition {
|
|
55
55
|
/** Stable capability key (the parity-table base name), e.g. 'payment_transfer'. */
|
|
56
56
|
key: string;
|
|
57
|
-
/** Registered tool name per surface — the
|
|
57
|
+
/** Registered tool name per surface — the parity table is the authority. */
|
|
58
58
|
names: {
|
|
59
59
|
sdk: string;
|
|
60
60
|
mcp: string;
|
|
@@ -5,7 +5,7 @@ export function fullCreds(env) {
|
|
|
5
5
|
throw new Error('operatorKey missing from tool context');
|
|
6
6
|
if (!agentId)
|
|
7
7
|
throw new Error('agentId missing from tool context');
|
|
8
|
-
//
|
|
8
|
+
// the lane rides along so every Creds-based client sends
|
|
9
9
|
// X-Ziggs-Lane without each capability having to remember to.
|
|
10
10
|
return { operatorKey, agentId, ...(laneId ? { laneId } : {}) };
|
|
11
11
|
}
|
|
@@ -21,7 +21,7 @@ export function rethrowWithContext(error, prefix) {
|
|
|
21
21
|
wrapped.status = e.status;
|
|
22
22
|
if (e.body !== undefined)
|
|
23
23
|
wrapped.body = e.body;
|
|
24
|
-
//
|
|
24
|
+
// keep the machine code so toolError can classify without prose.
|
|
25
25
|
if (typeof e.code === 'string' && e.code)
|
|
26
26
|
wrapped.code = e.code;
|
|
27
27
|
wrapped['cause'] = error;
|
|
@@ -16,7 +16,7 @@ export interface AgentProfile {
|
|
|
16
16
|
matchScore?: number;
|
|
17
17
|
status?: 'online' | 'available' | 'offline';
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* how the caller can reach this row, derived per row (never a
|
|
20
20
|
* hardcoded label). `restricted` = an exact-id lookup matched an unpublished
|
|
21
21
|
* agent the caller cannot reach — the id is echoed but no name is disclosed.
|
|
22
22
|
*/
|
|
@@ -29,7 +29,6 @@ export interface AgentProfile {
|
|
|
29
29
|
};
|
|
30
30
|
category?: string;
|
|
31
31
|
version?: string;
|
|
32
|
-
recentTaskSamples?: unknown[];
|
|
33
32
|
}
|
|
34
33
|
export declare class AgentSearchClient {
|
|
35
34
|
private readonly operatorKey;
|
|
@@ -50,10 +50,10 @@ export type ProposeBroadcastInput = Omit<ProposeDirectInput, 'proposedTo'> & {
|
|
|
50
50
|
*
|
|
51
51
|
* A link is reach, not commerce: it carries no money, no escrow, no execution
|
|
52
52
|
* state and no approvals ledger. Handing the raw document over anyway put Mongo
|
|
53
|
-
* bookkeeping in front of an LLM, which is what
|
|
53
|
+
* bookkeeping in front of an LLM, which is what forbade.
|
|
54
54
|
*
|
|
55
55
|
* Lives here rather than in `capabilities/links.ts` because this is where the
|
|
56
|
-
* rule is applied
|
|
56
|
+
* rule is applied; that module re-exports it so the public name is
|
|
57
57
|
* unchanged.
|
|
58
58
|
*/
|
|
59
59
|
export declare function linkSummary(a: Agreement): Record<string, unknown>;
|
|
@@ -64,7 +64,7 @@ export declare function linkSummary(a: Agreement): Record<string, unknown>;
|
|
|
64
64
|
* be written out at six call sites across the SDK runner, the MCP tools and the
|
|
65
65
|
* capability layer, and three verbs never got it: `agreement_counter`,
|
|
66
66
|
* `agreement_fulfill` and `agreement_subcontract` returned the raw document
|
|
67
|
-
|
|
67
|
+
*. Applying it at the parse boundary means a new verb inherits the
|
|
68
68
|
* rule instead of remembering to opt in, and no surface can word its own verdict.
|
|
69
69
|
*
|
|
70
70
|
* Typed as `Agreement` on the way out: every key the summary keeps IS an
|
|
@@ -98,7 +98,7 @@ export interface DelegateAgreementData {
|
|
|
98
98
|
}
|
|
99
99
|
export declare function delegateAgreement(proposalData: DelegateAgreementData, creds: Creds): Promise<Agreement>;
|
|
100
100
|
/**
|
|
101
|
-
* Approve or reject a pending agreement (
|
|
101
|
+
* Approve or reject a pending agreement (canonical client path).
|
|
102
102
|
*
|
|
103
103
|
* Routes to `POST /claim` (open or org-scoped broadcast) or
|
|
104
104
|
* `PUT /approvals/:partyId` (ledger). Legacy rows without approvals[] are
|
|
@@ -108,14 +108,14 @@ export declare function delegateAgreement(proposalData: DelegateAgreementData, c
|
|
|
108
108
|
export declare function respondToAgreement(agreementId: string, action: 'approve' | 'reject', creds: Creds, opts?: {
|
|
109
109
|
ownerUserId?: string | null;
|
|
110
110
|
agreement?: Agreement | null;
|
|
111
|
-
/** Where to send the human when the decision is theirs
|
|
111
|
+
/** Where to send the human when the decision is theirs. */
|
|
112
112
|
appUrl?: string;
|
|
113
113
|
}): Promise<Agreement>;
|
|
114
114
|
/**
|
|
115
115
|
* The approval facts a "who decides this?" question is answered from: the party
|
|
116
116
|
* ids still owing a decision, plus the named responder slot.
|
|
117
117
|
*
|
|
118
|
-
* Split out
|
|
118
|
+
* Split out so the inbox card and the respond call answer that
|
|
119
119
|
* question with ONE rule. The card had no rule at all — it offered the respond
|
|
120
120
|
* tool for every pending proposal, including the ones only the human can
|
|
121
121
|
* answer, and the agent found out by 403.
|
|
@@ -132,7 +132,7 @@ export interface PendingApprovalFacts {
|
|
|
132
132
|
*/
|
|
133
133
|
export declare function resolvePendingApprovalPartyId(facts: PendingApprovalFacts, candidateIds: ReadonlyArray<string | null | undefined>): string | null;
|
|
134
134
|
/**
|
|
135
|
-
*
|
|
135
|
+
* resolve which approvals.partyId the current operator may submit.
|
|
136
136
|
* Checks pending ledger entries against impersonated agent id and owner principal.
|
|
137
137
|
*/
|
|
138
138
|
export declare function resolveMyPendingApprovalPartyId(agreement: Agreement, opts: {
|
|
@@ -145,7 +145,7 @@ export declare function resolveMyPendingApprovalPartyId(agreement: Agreement, op
|
|
|
145
145
|
*
|
|
146
146
|
* `partyId` MUST match the authenticated actor (`actor.id === partyId`): owner
|
|
147
147
|
* principal when approving as human, delegate agent id when impersonating.
|
|
148
|
-
* Canonical for hire, service, link, and quest proposals
|
|
148
|
+
* Canonical for hire, service, link, and quest proposals.
|
|
149
149
|
*/
|
|
150
150
|
export declare function approveAgreementAsParty(agreementId: string, partyId: string, status: 'approved' | 'rejected', creds: Creds): Promise<Agreement>;
|
|
151
151
|
export interface CounterAgreementData {
|
|
@@ -170,7 +170,7 @@ export interface GetMyAgreementsFilters {
|
|
|
170
170
|
proposalStatus?: string;
|
|
171
171
|
hasTask?: boolean;
|
|
172
172
|
/**
|
|
173
|
-
*
|
|
173
|
+
* `scope=mine` alone returns every agreement the caller's grant can
|
|
174
174
|
* read in the active org — including ones the caller is not a party to
|
|
175
175
|
* (`isYou` all-false). Pass `partyOnly: true` for a true "mine": only
|
|
176
176
|
* agreements where the caller (key owner or impersonated agent) is a party.
|
|
@@ -202,7 +202,7 @@ export declare function revokeAgreement(agreementId: string, creds: Creds): Prom
|
|
|
202
202
|
ok: boolean;
|
|
203
203
|
agreement: Agreement;
|
|
204
204
|
}>;
|
|
205
|
-
/**
|
|
205
|
+
/** mark an agreement fulfilled (complete). A provider closing its own
|
|
206
206
|
* delivered work — party-gated server-side. */
|
|
207
207
|
export declare function fulfillAgreement(agreementId: string, creds: Creds): Promise<{
|
|
208
208
|
ok: boolean;
|
|
@@ -211,7 +211,7 @@ export declare function fulfillAgreement(agreementId: string, creds: Creds): Pro
|
|
|
211
211
|
/** What an open-broadcast claim turned out to be. ⚠️ SYNC: backend AgreementOpenService. */
|
|
212
212
|
export type ClaimedKind = 'link' | 'offer' | 'quest' | 'hand-off';
|
|
213
213
|
/**
|
|
214
|
-
* Claim an open agreement
|
|
214
|
+
* Claim an open agreement. Three shapes are claimable:
|
|
215
215
|
* - open link invite (`engagementKind: link`, proposedTo everyone)
|
|
216
216
|
* - open broadcast quest (proposedTo 'everyone', status open)
|
|
217
217
|
* - org-scoped broadcast quest (proposedTo 'org') — the server rejects the
|
|
@@ -235,11 +235,6 @@ export declare const CHAT_LINK_TYPES: readonly ["origin", "mention", "delegation
|
|
|
235
235
|
export type ChatLinkType = (typeof CHAT_LINK_TYPES)[number];
|
|
236
236
|
export declare function linkAgreementToChat(agreementId: string, chatId: string, linkType: ChatLinkType | undefined, creds: Creds): Promise<unknown | null>;
|
|
237
237
|
export declare function getChatsForAgreement(agreementId: string, creds: Creds): Promise<unknown[]>;
|
|
238
|
-
export declare function joinAgreement(agreementId: string, creds: Creds): Promise<{
|
|
239
|
-
chatId: string;
|
|
240
|
-
agentId: string | null;
|
|
241
|
-
isNew: boolean;
|
|
242
|
-
}>;
|
|
243
238
|
export declare const ARTIFACT_LINK_TYPES: readonly ["produced", "referenced"];
|
|
244
239
|
export type ArtifactLinkType = (typeof ARTIFACT_LINK_TYPES)[number];
|
|
245
240
|
export declare function linkArtifactToAgreement(agreementId: string, artifactId: string, linkType: ArtifactLinkType | undefined, creds: Creds): Promise<unknown | null>;
|
|
@@ -285,11 +280,6 @@ export declare class AgreementClient {
|
|
|
285
280
|
}>;
|
|
286
281
|
linkToChat(id: string, chatId: string, linkType?: ChatLinkType): Promise<unknown>;
|
|
287
282
|
listChats(id: string): Promise<unknown[]>;
|
|
288
|
-
join(id: string): Promise<{
|
|
289
|
-
chatId: string;
|
|
290
|
-
agentId: string | null;
|
|
291
|
-
isNew: boolean;
|
|
292
|
-
}>;
|
|
293
283
|
linkArtifact(id: string, artifactId: string, linkType?: ArtifactLinkType): Promise<unknown>;
|
|
294
284
|
listArtifacts(id: string): Promise<unknown[]>;
|
|
295
285
|
linkUser(id: string, userId: string, role: UserRole): Promise<unknown>;
|