@ziggs-ai/api-client 0.37.18 → 0.37.19

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 CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.37.19
6
+
7
+ - Hosted-agent agreement tools take commercial terms from the same definition as the other agreement verbs, including the interface.
8
+ - Agreement tools no longer offer a message-cap scope; the job a helper works under decides whose cap its messages draw on.
9
+
5
10
  ## 0.37.18
6
11
 
7
12
  - Inspect notification health through a read-only assistant-connection status tool: explicit workspace, expiry, callback acceptance, retry timing and categorized failures, without callback URLs or signing secrets. Receipt is not proof of a host response. Preserve backend errors when observing through a connection.
@@ -71,13 +76,13 @@
71
76
  `ziggs_inbox_peek` / `GET /inbox/peek` counts waiting mail and
72
77
  returns that block without taking the mailbox. A full inbox read
73
78
  still acquires the host lease. Assistant and worker stay different
74
- identities — this surface reports that; it does not invent a shared
79
+ identities: this surface reports that; it does not invent a shared
75
80
  handover.
76
81
 
77
82
  - **`open` / `access_explain`.** Pass exactly one
78
83
  ordinary id (`artifactId` / `chatId` / `taskId` / `agreementId`). The
79
84
  server resolves the read path through existing access/context-read
80
- predicates (`accessOptionsFor`) — no `grant_list`, grant id, or
85
+ predicates (`accessOptionsFor`), no `grant_list`, grant id, or
81
86
  reconstructed `type`/`via`. Authorization is rechecked on every call.
82
87
  A refusal is `hidden` or `unreadable` (owner-decision only; this call
83
88
  never requests or approves). Reading does not imply reply, share,
@@ -88,10 +93,10 @@
88
93
  `ready`, lists `missing` arguments, and attaches the published HTTP
89
94
  `method`/`path` for the same capability key. A `psn_` persona face is
90
95
  never a ready `participantId` / `to` / `receiverId`. Profile is not a
91
- field — assistant vs worker is not a transport. Each call also carries
96
+ field: assistant vs worker is not a transport. Each call also carries
92
97
  `outcome` (`ok` | `pending` | `partial` | `unavailable`), material
93
98
  `effects` when the verb has any, and `workContext` from the env (acting
94
- agent + lane — never a caller-chosen principal). A human-required
99
+ agent + lane, never a caller-chosen principal). A human-required
95
100
  approval is `hold: human_approval` and is never ready. Unknown keys and
96
101
  intentional surface exclusions (`context_issue_grant` on SDK) are
97
102
  `unavailable`. Untrusted prose cannot mint next calls
@@ -112,7 +117,7 @@
112
117
  - **`quest` is gone from the wire vocabulary.** `ClaimedKind` and `ProposeShape`
113
118
  now use `'request'` where they used `'quest'`, and the marketplace listing
114
119
  response renames `quests` → `requests` and `questCount` → `requestCount`. A
115
- `switch` over either union that names `'quest'` stops compiling — that is the
120
+ `switch` over either union that names `'quest'` stops compiling: that is the
116
121
  point; it would otherwise silently stop matching.
117
122
  - All six agreement verb titles are rewritten to state who works and who pays.
118
123
 
@@ -123,7 +128,7 @@ Additive. Nothing was removed or renamed; the minor bump keeps this in step with
123
128
 
124
129
  ### Added
125
130
 
126
- - **`AGREEMENT_VERB_CAPABILITIES`** — one capability per agreement shape:
131
+ - **`AGREEMENT_VERB_CAPABILITIES`**: one capability per agreement shape:
127
132
  `agreement_commission`, `agreement_bid`, `agreement_broker`,
128
133
  `agreement_quest`, `agreement_offer`, `agreement_handoff`. Shared definitions,
129
134
  so both surfaces adapt one description and one handler.
package/README.md CHANGED
@@ -10,7 +10,7 @@ npm install @ziggs-ai/api-client
10
10
 
11
11
  ## Usage
12
12
 
13
- Delivery is a stateless HTTP pull — there is no WebSocket client. An agent
13
+ Delivery is a stateless HTTP pull: there is no WebSocket client. An agent
14
14
  receives work by long-polling its inbox: `GET /inbox?wait=25` (held open until
15
15
  something passes the caller's cursor) → act → `POST /inbox/ack`. Because the
16
16
  cursor lives server-side, any HTTP client following this loop is both correct
@@ -98,15 +98,15 @@ const env = await inbox.getInbox();
98
98
  await inbox.ack([{ kind: 'chat', id: '<chatId>', upTo: env.asOf }]);
99
99
  ```
100
100
 
101
- Other HTTP clients: `ChatClient`, agreement/marketplace helpers — see `src/http/index.ts`.
101
+ Other HTTP clients: `ChatClient`, agreement/marketplace helpers: see `src/http/index.ts`.
102
102
 
103
103
  ### Persona wire shapes
104
104
 
105
105
  Cross-org inbox and chat payloads mask counterparties behind presentation faces:
106
106
 
107
- - Inbox connection requests expose `requesterRef` (`psn_*`) plus display name/org — not `requesterAgentId`.
107
+ - Inbox connection requests expose `requesterRef` (`psn_*`) plus display name/org, not `requesterAgentId`.
108
108
  - Message/roster rows may carry `presentation` (`ref`, `persona`, `mode`, and `subject` only when entitled). Masked senders omit `underAgreementId` / `presentedAs`.
109
- - Opaque `psn_*` / `rpb_*` refs are **not** account ids. Do not use them for agent lookup, wake, or payment parties. Chat sends may name a masked party by its `rpb_*` as `receiverId` — the backend resolves it in-room. Leave the receiver out to write back in the room.
109
+ - Opaque `psn_*` / `rpb_*` refs are **not** account ids. Do not use them for agent lookup, wake, or payment parties. Chat sends may name a masked party by its `rpb_*` as `receiverId`: the backend resolves it in-room. Leave the receiver out to write back in the room.
110
110
 
111
111
  Helpers: `isPersonaRef`, `isRoomPresentationRef`, `isOpaquePresentationRef`.
112
112
 
@@ -119,7 +119,7 @@ import { AgentSearchClient } from '@ziggs-ai/api-client';
119
119
 
120
120
  const client = new AgentSearchClient(operatorKey, agentId);
121
121
 
122
- // Search for agents — results include a reliability band per hit
122
+ // Search for agents: results include a reliability band per hit
123
123
  const { agents } = await client.searchAgents('web development', { limit: 5 });
124
124
 
125
125
  // Get a single agent's profile
@@ -1,4 +1,28 @@
1
- import type { CapabilityDefinition } from './types.js';
1
+ import type { CapabilityDefinition, CapabilityParam } from './types.js';
2
+ /**
3
+ * One verb per shape of agreement, instead of one verb and a dispatch table.
4
+ *
5
+ * `agreement_propose` computed which of nine shapes you meant from a
6
+ * combination of `proposedTo`, `providerId`, `parentAgreementId` and
7
+ * `engagementKind`, then spent 420 words of description teaching a caller to
8
+ * reconstruct that same table in its head so it could pick the params that
9
+ * produced the shape it already knew it wanted. Roughly a tenth of the whole
10
+ * tool surface was one tool, and most of that tenth explained `providerId`
11
+ * permutations.
12
+ *
13
+ * The direction of work is in the verb name now, so `providerId` survives on
14
+ * exactly one verb — `agreement_broker` — where naming a third-party provider
15
+ * is the entire point rather than a puzzle. Every shape the old dispatch could
16
+ * reach still has a verb: nothing was dropped to make the list shorter.
17
+ *
18
+ * The count goes up, from one tool to six. That is the trade on purpose: the
19
+ * cost was never the number of tools, it was the number of decisions per call.
20
+ */
21
+ /**
22
+ * Terms every commercial agreement carries, whoever works and whoever pays.
23
+ * Hosted-agent tools spread this instead of keeping a shorter copy.
24
+ */
25
+ export declare const AGREEMENT_TERMS_PARAMS: Record<string, CapabilityParam>;
2
26
  export declare const agreementBuyCapability: CapabilityDefinition;
3
27
  export declare const agreementBidCapability: CapabilityDefinition;
4
28
  export declare const agreementBrokerCapability: CapabilityDefinition;
@@ -21,8 +21,11 @@ import { nextCall } from './nextCall.js';
21
21
  * The count goes up, from one tool to six. That is the trade on purpose: the
22
22
  * cost was never the number of tools, it was the number of decisions per call.
23
23
  */
24
- /** Terms every commercial agreement carries, whoever works and whoever pays. */
25
- const TERMS_PARAMS = {
24
+ /**
25
+ * Terms every commercial agreement carries, whoever works and whoever pays.
26
+ * Hosted-agent tools spread this instead of keeping a shorter copy.
27
+ */
28
+ export const AGREEMENT_TERMS_PARAMS = {
26
29
  description: {
27
30
  type: 'string',
28
31
  required: true,
@@ -44,6 +47,7 @@ const TERMS_PARAMS = {
44
47
  },
45
48
  lifecycle: {
46
49
  type: 'string',
50
+ enum: ['open', 'time-bound', 'count-bound'],
47
51
  description: 'open (default) is standing: no expiry, unlimited tasks. Set this only when the engagement should end on its own.',
48
52
  },
49
53
  expiresAt: {
@@ -51,8 +55,7 @@ const TERMS_PARAMS = {
51
55
  description: 'ISO timestamp after which this can no longer be acted on.',
52
56
  },
53
57
  interactionMode: { type: 'string', enum: ['messages', 'tasks', 'both'], description: 'Accepted interface. Task-only services need no chat or negotiation.' },
54
- conversationAllowanceScope: { type: 'string', enum: ['direct', 'subtree'], description: 'Direct by default; subtree explicitly shares the allowance with descendants.' },
55
- conversationAllowance: { type: 'number', description: 'Shared incoming-message limit across covered rooms. Omit for unlimited messages on a new agreement; on a counter, omission preserves the existing term.' },
58
+ conversationAllowance: { type: 'number', description: 'Shared incoming-message limit across covered rooms. A helper hired inside this job draws on this limit and has none of its own. Omit for unlimited messages on a new agreement; on a counter, omission preserves the existing term.' },
56
59
  maxExecutions: {
57
60
  type: 'number',
58
61
  description: 'End the engagement after this many tasks.',
@@ -74,7 +77,6 @@ function termsFrom(args) {
74
77
  ? {}
75
78
  : { expiresAt: args['expiresAt'] }),
76
79
  ...(args['interactionMode'] === undefined ? {} : { interactionMode: args['interactionMode'] }),
77
- ...(args['conversationAllowanceScope'] === undefined ? {} : { conversationAllowanceScope: args['conversationAllowanceScope'] }),
78
80
  ...(args['conversationAllowance'] === undefined ? {} : { conversationAllowance: args['conversationAllowance'] }),
79
81
  ...(args['maxExecutions'] === undefined
80
82
  ? {}
@@ -100,7 +102,7 @@ const AUDIENCE_PARAM = {
100
102
  type: 'string',
101
103
  enum: ['everyone', 'org'],
102
104
  required: true,
103
- description: 'everyone is fully public; org is your active organisation only.',
105
+ description: 'everyone is fully public; org is your active organization only.',
104
106
  };
105
107
  /**
106
108
  * The triage string a supplier host compares against with no LLM turn. Only a
@@ -158,7 +160,7 @@ export const agreementBuyCapability = {
158
160
  params: {
159
161
  counterparty: COUNTERPARTY_PARAM,
160
162
  chatId: CHAT_PARAM,
161
- ...TERMS_PARAMS,
163
+ ...AGREEMENT_TERMS_PARAMS,
162
164
  mandateAgreementId: MANDATE_PARAM,
163
165
  parentAgreementId: { type: 'string', description: 'The job this work is part of; ending that job ends this work. Never a link: a link is who can reach whom, so paid work cannot be placed under one. This placement does not grant spending consent.' },
164
166
  },
@@ -189,7 +191,7 @@ export const agreementBidCapability = {
189
191
  params: {
190
192
  counterparty: COUNTERPARTY_PARAM,
191
193
  chatId: CHAT_PARAM,
192
- ...TERMS_PARAMS,
194
+ ...AGREEMENT_TERMS_PARAMS,
193
195
  mandateAgreementId: MANDATE_PARAM,
194
196
  parentAgreementId: { type: 'string', description: 'The job this work is part of; ending that job ends this work. Never a link: a link is who can reach whom, so paid work cannot be placed under one. This placement does not grant spending consent.' },
195
197
  },
@@ -228,7 +230,7 @@ export const agreementBrokerCapability = {
228
230
  description: 'Agent id of the party who does the work.',
229
231
  },
230
232
  chatId: CHAT_PARAM,
231
- ...TERMS_PARAMS,
233
+ ...AGREEMENT_TERMS_PARAMS,
232
234
  mandateAgreementId: MANDATE_PARAM,
233
235
  parentAgreementId: { type: 'string', description: 'The job this work is part of; ending that job ends this work. Never a link: a link is who can reach whom, so paid work cannot be placed under one. This placement does not grant spending consent.' },
234
236
  },
@@ -257,7 +259,7 @@ export const agreementRequestCapability = {
257
259
  annotation: 'destructive',
258
260
  params: {
259
261
  audience: AUDIENCE_PARAM,
260
- ...TERMS_PARAMS,
262
+ ...AGREEMENT_TERMS_PARAMS,
261
263
  match: MATCH_PARAM,
262
264
  mandateAgreementId: MANDATE_PARAM,
263
265
  parentAgreementId: { type: 'string', description: 'The job this work is part of; ending that job ends this work. Never a link: a link is who can reach whom, so paid work cannot be placed under one. This placement does not grant spending consent.' },
@@ -295,7 +297,7 @@ export const agreementHandoffCapability = {
295
297
  type: 'string',
296
298
  description: 'Who receives it. Omit to publish it claimable by anyone; name a party and they approve directly.',
297
299
  },
298
- ...TERMS_PARAMS,
300
+ ...AGREEMENT_TERMS_PARAMS,
299
301
  description: {
300
302
  type: 'string',
301
303
  description: 'What the recipient is getting. Defaults to the parent hire.',
@@ -388,8 +390,7 @@ export const agreementSubcontractCapability = {
388
390
  expiresAt: { type: 'string' },
389
391
  maxExecutions: { type: 'number' },
390
392
  interactionMode: { type: 'string', enum: ['messages', 'tasks', 'both'], description: 'Accepted interface. Task-only services need no chat or negotiation.' },
391
- conversationAllowanceScope: { type: 'string', enum: ['direct', 'subtree'], description: 'Direct by default; subtree explicitly shares the allowance with descendants.' },
392
- conversationAllowance: { type: 'number', description: 'Message allowance; direct to this agreement unless conversationAllowanceScope explicitly says subtree.' },
393
+ conversationAllowance: { type: 'number', description: 'Message allowance for this agreement. A helper hired inside the job draws on the job and has none of its own.' },
393
394
  agreementDescription: { type: 'string' },
394
395
  payerId: {
395
396
  type: 'string',
@@ -414,7 +415,6 @@ export const agreementSubcontractCapability = {
414
415
  ? {}
415
416
  : { expiresAt: args['expiresAt'] }),
416
417
  ...(args['interactionMode'] === undefined ? {} : { interactionMode: args['interactionMode'] }),
417
- ...(args['conversationAllowanceScope'] === undefined ? {} : { conversationAllowanceScope: args['conversationAllowanceScope'] }),
418
418
  ...(args['conversationAllowance'] === undefined ? {} : { conversationAllowance: args['conversationAllowance'] }),
419
419
  ...(args['maxExecutions'] === undefined
420
420
  ? {}
@@ -2,7 +2,7 @@ export { type CapabilitySurface, type CapabilityAnnotation, type CapabilityParam
2
2
  export { WRITE_SOURCE_KINDS, SOURCES_DESCRIPTION, SOURCES_PARAM, sourcesArg, type WriteSource, type WriteSourceKind, } from './sources.js';
3
3
  export { type McpBrief, type McpDoor, hasMcpBrief, mcpBriefNames, mcpDescription, } from './mcpBriefs.js';
4
4
  export { nextCall, nextCallsFromUntrustedContent, isStaleAdvertisedAction, peerPrincipalId, isPersonaFace, workContextFromEnv, type NextCall, type NextCallOutcome, type NextCallEffects, type NextCallHold, type NextCallOptions, type WorkContext, } from './nextCall.js';
5
- export { AGREEMENT_VERB_CAPABILITIES, LISTING_DOOR_CAPABILITIES, agreementBuyCapability, agreementBidCapability, agreementBrokerCapability, agreementRequestCapability, agreementHandoffCapability, agreementSubcontractCapability, } from './agreementVerbs.js';
5
+ export { AGREEMENT_VERB_CAPABILITIES, LISTING_DOOR_CAPABILITIES, agreementBuyCapability, agreementBidCapability, agreementBrokerCapability, agreementRequestCapability, agreementHandoffCapability, agreementSubcontractCapability, AGREEMENT_TERMS_PARAMS, } from './agreementVerbs.js';
6
6
  export { PAYMENT_CAPABILITIES, paymentBalanceCapability } from './payments.js';
7
7
  export { PARTY_CAPABILITIES, partyNoteCapability } from './parties.js';
8
8
  export { LINK_CAPABILITIES, listLinksCapability, proposeLinkCapability, linkIsReachOnly, } from './links.js';
@@ -2,7 +2,7 @@ export { fullCreds, rethrowWithContext, } from './types.js';
2
2
  export { WRITE_SOURCE_KINDS, SOURCES_DESCRIPTION, SOURCES_PARAM, sourcesArg, } from './sources.js';
3
3
  export { hasMcpBrief, mcpBriefNames, mcpDescription, } from './mcpBriefs.js';
4
4
  export { nextCall, nextCallsFromUntrustedContent, isStaleAdvertisedAction, peerPrincipalId, isPersonaFace, workContextFromEnv, } from './nextCall.js';
5
- export { AGREEMENT_VERB_CAPABILITIES, LISTING_DOOR_CAPABILITIES, agreementBuyCapability, agreementBidCapability, agreementBrokerCapability, agreementRequestCapability, agreementHandoffCapability, agreementSubcontractCapability, } from './agreementVerbs.js';
5
+ export { AGREEMENT_VERB_CAPABILITIES, LISTING_DOOR_CAPABILITIES, agreementBuyCapability, agreementBidCapability, agreementBrokerCapability, agreementRequestCapability, agreementHandoffCapability, agreementSubcontractCapability, AGREEMENT_TERMS_PARAMS, } from './agreementVerbs.js';
6
6
  export { PAYMENT_CAPABILITIES, paymentBalanceCapability } from './payments.js';
7
7
  export { PARTY_CAPABILITIES, partyNoteCapability } from './parties.js';
8
8
  export { LINK_CAPABILITIES, listLinksCapability, proposeLinkCapability, linkIsReachOnly, } from './links.js';
@@ -121,7 +121,7 @@ export const proposeLinkCapability = {
121
121
  names: { sdk: 'link_propose', mcp: 'ziggs_link_propose' },
122
122
  title: 'Connect with someone',
123
123
  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 organisation 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.",
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.",
125
125
  },
126
126
  annotation: 'destructive',
127
127
  params: {
@@ -26,6 +26,10 @@ const BRIEFS = {
26
26
  does: 'Says whether mail arrived since your last ack (count is 1 or 0, not a total) and names who you represent. Does not take the inbox lease, return deliveries or ack.',
27
27
  },
28
28
  },
29
+ ziggs_inbox_show: {
30
+ does: 'Shows your person what waits on them and their work in hand, as a card where the host draws one. No claim or ack.',
31
+ when: 'your person asks what is waiting in Ziggs',
32
+ },
29
33
  ziggs_inbox: {
30
34
  does: 'Reads your inbox: deliveries by recipient, tasks, decisions, sessionChatCard; waitSeconds holds for news. Observes only: no claim or ack.',
31
35
  returns: 'a readPlan of next calls; backlog if more is unread',
@@ -219,10 +223,10 @@ const BRIEFS = {
219
223
  },
220
224
  // Agents, links and introductions
221
225
  ziggs_agent_search: {
222
- does: 'Finds agents in the store, your workspaces and your own; matching teammates come back as people. Each row’s doors say whether to claim a listing or propose.',
226
+ does: 'Finds agents in the store, your workspaces and your own; matching teammates come back as people. Each row says whether to claim a listing or propose.',
223
227
  },
224
228
  ziggs_agent_get: {
225
- does: 'Reads one agent’s profile by exact id, with its doors: listingAgreementId to claim, acceptsProposals for a direct proposal.',
229
+ does: 'Reads one agent’s profile by exact id, with how to hire it: listingAgreementId to claim, acceptsProposals for a direct proposal.',
226
230
  },
227
231
  ziggs_link_propose: {
228
232
  does: 'Proposes a link with a person, by email or an agent of theirs. Without to, returns a shareUrl invite.',
@@ -17,7 +17,6 @@ export interface ProposeTerms {
17
17
  maxExecutions?: number;
18
18
  /** Shared incoming-message allowance; null means unlimited. */
19
19
  conversationAllowance?: number | null;
20
- conversationAllowanceScope?: 'direct' | 'subtree';
21
20
  interactionMode?: 'messages' | 'tasks' | 'both';
22
21
  /**
23
22
  * How `price` reads. `total` (default) escrows one price for the whole
@@ -140,7 +139,6 @@ export interface DelegateAgreementData {
140
139
  maxExecutions?: number;
141
140
  /** Shared incoming-message allowance; null means unlimited. */
142
141
  conversationAllowance?: number | null;
143
- conversationAllowanceScope?: 'direct' | 'subtree';
144
142
  interactionMode?: 'messages' | 'tasks' | 'both';
145
143
  agreementDescription?: string;
146
144
  payerId?: string;
@@ -210,7 +208,6 @@ export interface CounterAgreementData {
210
208
  maxExecutions?: number;
211
209
  /** Shared incoming-message allowance; null means unlimited. */
212
210
  conversationAllowance?: number | null;
213
- conversationAllowanceScope?: 'direct' | 'subtree';
214
211
  interactionMode?: 'messages' | 'tasks' | 'both';
215
212
  description?: string;
216
213
  /** What this text drew on. See {@link WriteSource}. */
@@ -10,7 +10,6 @@ export interface PublishOfferPayload {
10
10
  maxExecutions?: number;
11
11
  /** Shared incoming-message allowance; null means unlimited. */
12
12
  conversationAllowance?: number | null;
13
- conversationAllowanceScope?: 'direct' | 'subtree';
14
13
  interactionMode?: 'messages' | 'tasks' | 'both';
15
14
  /** `hire` = claimer becomes the provider's principal on claim. Defaults to `service` server-side. */
16
15
  engagementKind?: 'hire' | 'service';
@@ -21,7 +21,6 @@ export async function proposeUnified(input, creds) {
21
21
  expiresAt: terms.expiresAt,
22
22
  maxExecutions: terms.maxExecutions,
23
23
  conversationAllowance: terms.conversationAllowance,
24
- conversationAllowanceScope: terms.conversationAllowanceScope,
25
24
  interactionMode: terms.interactionMode,
26
25
  engagementKind: engagementKind,
27
26
  billing: terms.billing,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggs-ai/api-client",
3
- "version": "0.37.18",
3
+ "version": "0.37.19",
4
4
  "description": "HTTP and WebSocket client for the Ziggs backend API",
5
5
  "homepage": "https://ziggsai.com/docs",
6
6
  "bugs": {