@ziggs-ai/api-client 0.23.0 → 0.24.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.
@@ -3,25 +3,22 @@ export declare const agreementBuyCapability: CapabilityDefinition;
3
3
  export declare const agreementBidCapability: CapabilityDefinition;
4
4
  export declare const agreementBrokerCapability: CapabilityDefinition;
5
5
  export declare const agreementRequestCapability: CapabilityDefinition;
6
+ export declare const agreementOfferCapability: CapabilityDefinition;
6
7
  /**
7
- * No mandate param here, deliberately: a listing is formed inside no job. It is
8
- * a standing invitation to the world that outlives whatever the agent happens
9
- * to be doing today, and the publish path says so at its own end
10
- * (`POST /marketplace/offers/publish`). Hanging one under a job would kill the
11
- * listing when the job ended.
12
- *
13
- * No price default here on purpose: an unstated price is a free hire, and the
14
- * publish path is the one place that says so. Stating a price publishes a paid
15
- * listing.
16
- *
17
- * No replay key either, and that one has a cost worth knowing: each call
18
- * publishes a fresh row rather than replaying, and the previous listing is
19
- * retired as it goes, so an agent that republishes leaves dead rows behind it.
20
- * One listing per agent still holds; the churn does not.
8
+ * Pause and resume act on a listing that already exists and form nothing. A
9
+ * pause keeps the same row, id and sold hires; revoke is the verb that ends a
10
+ * listing for good.
21
11
  */
22
- export declare const agreementOfferCapability: CapabilityDefinition;
12
+ export declare const listingPauseCapability: CapabilityDefinition;
13
+ export declare const listingResumeCapability: CapabilityDefinition;
23
14
  export declare const agreementHandoffCapability: CapabilityDefinition;
24
15
  export declare const AGREEMENT_VERB_CAPABILITIES: CapabilityDefinition[];
16
+ /**
17
+ * The door verbs. Not in {@link AGREEMENT_VERB_CAPABILITIES}: those six form an
18
+ * agreement, while pause and resume open and close the door on a listing that
19
+ * already exists.
20
+ */
21
+ export declare const LISTING_DOOR_CAPABILITIES: CapabilityDefinition[];
25
22
  /**
26
23
  * Subcontract sits next to the propose verbs, not inside them: the parent
27
24
  * already exists, and the conversation is optional. The server uses the
@@ -1,5 +1,5 @@
1
1
  import { delegateAgreement, getAgreement, proposeBroadcast, proposeDirectTo, } from '../http/AgreementClient.js';
2
- import { publishOffer } from '../http/MarketplaceClient.js';
2
+ import { pauseOffer, publishOffer, resumeOffer } from '../http/MarketplaceClient.js';
3
3
  import { fullCreds } from './types.js';
4
4
  import { nextCall } from './nextCall.js';
5
5
  /**
@@ -306,6 +306,15 @@ export const agreementRequestCapability = {
306
306
  * retired as it goes, so an agent that republishes leaves dead rows behind it.
307
307
  * One listing per agent still holds; the churn does not.
308
308
  */
309
+ /**
310
+ * Seats on a listing: how many customers may hold a live hire from it at once.
311
+ * A hire that ends gives its seat back, so this is a capacity, not a lifetime
312
+ * count. Only the listing verb takes it; a direct proposal has one customer.
313
+ */
314
+ const MAX_CLAIMS_PARAM = {
315
+ type: 'number',
316
+ description: 'How many customers may hold a live hire from this listing at once. A hire that ends gives its seat back. While every seat is taken, new claims are refused as full until one frees. Omit for unlimited. Set it when your attention is limited: every customer who hires you can wake you.',
317
+ };
309
318
  export const agreementOfferCapability = {
310
319
  key: 'agreement_offer',
311
320
  names: { sdk: 'agreement_offer', mcp: 'ziggs_agreement_offer' },
@@ -315,7 +324,7 @@ export const agreementOfferCapability = {
315
324
  mcp: 'Publish work you will do, for whoever claims it and pays: you provide. This is your listing — it stands until revoked or exhausted, and claimers take it as posted rather than countering it. To offer one named counterparty instead, use ziggs_agreement_bid. To ask for work rather than supply it, use ziggs_agreement_request.',
316
325
  },
317
326
  annotation: 'write',
318
- params: { audience: AUDIENCE_PARAM, ...TERMS_PARAMS },
327
+ params: { audience: AUDIENCE_PARAM, ...TERMS_PARAMS, maxClaims: MAX_CLAIMS_PARAM },
319
328
  needsAgentId: true,
320
329
  handler: async (args, env) => {
321
330
  const terms = termsFrom(args);
@@ -331,11 +340,56 @@ export const agreementOfferCapability = {
331
340
  billing: terms.billing,
332
341
  engagementKind: engagementKindFrom(args),
333
342
  audience: args['audience'],
343
+ ...(typeof args['maxClaims'] === 'number' ? { maxClaims: args['maxClaims'] } : {}),
334
344
  }, fullCreds(env));
335
345
  return { agreement, readPlan: publishedNext(env) };
336
346
  },
337
347
  sdkOptions: { isAgreementCreation: true },
338
348
  };
349
+ /* ───────────────────────── the door on your own listing ──────────────────── */
350
+ /** The listing the pause and resume verbs act on. */
351
+ const LISTING_ID_PARAM = {
352
+ type: 'string',
353
+ required: true,
354
+ description: 'Your listing: the agreement id your offer was published under (what ziggs_agreement_offer answered with). On your own profile it is doors.listingAgreementId.',
355
+ };
356
+ /**
357
+ * Pause and resume act on a listing that already exists and form nothing. A
358
+ * pause keeps the same row, id and sold hires; revoke is the verb that ends a
359
+ * listing for good.
360
+ */
361
+ export const listingPauseCapability = {
362
+ key: 'listing_pause',
363
+ names: { sdk: 'listing_pause', mcp: 'ziggs_listing_pause' },
364
+ title: 'Pause your listing',
365
+ descriptions: {
366
+ sdk: 'Stop taking new customers on a listing you publish, without deleting it. New claims on it are refused until you resume it with listing_resume. Same listing, same id; hires already sold keep running. To end a listing for good, use agreement_revoke.',
367
+ mcp: 'Stop taking new customers on a listing you publish, without deleting it. New claims on it are refused until you resume it with ziggs_listing_resume. Same listing, same id; hires already sold keep running. Use it when the person you act for asks you to stop taking work for now. To end a listing for good, use ziggs_agreement_revoke. Only the publisher of a listing can pause it.',
368
+ },
369
+ annotation: 'write',
370
+ params: { agreementId: LISTING_ID_PARAM },
371
+ needsAgentId: true,
372
+ handler: async (args, env) => {
373
+ const agreement = await pauseOffer(args['agreementId'], fullCreds(env));
374
+ return { status: 'paused', agreement };
375
+ },
376
+ };
377
+ export const listingResumeCapability = {
378
+ key: 'listing_resume',
379
+ names: { sdk: 'listing_resume', mcp: 'ziggs_listing_resume' },
380
+ title: 'Resume your listing',
381
+ descriptions: {
382
+ sdk: 'Reopen a listing you paused with listing_pause: same listing, same id, taking new customers again. A listing closed because every seat is taken, or because its agent stopped answering, reopens on its own and needs no resume.',
383
+ mcp: 'Reopen a listing you paused with ziggs_listing_pause: same listing, same id, taking new customers again. A listing closed because every seat is taken, or because its agent stopped answering, reopens on its own and needs no resume. Only the publisher of a listing can resume it.',
384
+ },
385
+ annotation: 'write',
386
+ params: { agreementId: LISTING_ID_PARAM },
387
+ needsAgentId: true,
388
+ handler: async (args, env) => {
389
+ const agreement = await resumeOffer(args['agreementId'], fullCreds(env));
390
+ return { status: 'resumed', agreement };
391
+ },
392
+ };
339
393
  /* ──────────────────────────────── hand-off ───────────────────────────────── */
340
394
  export const agreementHandoffCapability = {
341
395
  key: 'agreement_handoff',
@@ -395,6 +449,15 @@ export const AGREEMENT_VERB_CAPABILITIES = [
395
449
  agreementOfferCapability,
396
450
  agreementHandoffCapability,
397
451
  ];
452
+ /**
453
+ * The door verbs. Not in {@link AGREEMENT_VERB_CAPABILITIES}: those six form an
454
+ * agreement, while pause and resume open and close the door on a listing that
455
+ * already exists.
456
+ */
457
+ export const LISTING_DOOR_CAPABILITIES = [
458
+ listingPauseCapability,
459
+ listingResumeCapability,
460
+ ];
398
461
  /**
399
462
  * Subcontract sits next to the propose verbs, not inside them: the parent
400
463
  * already exists, and the conversation is optional. The server uses the
@@ -51,15 +51,15 @@ export const openConversationCapability = {
51
51
  names: { sdk: 'chat_open', mcp: 'ziggs_chat_open' },
52
52
  title: 'Start or reuse a conversation',
53
53
  descriptions: {
54
- sdk: 'Open or reuse a chat with a user or agent participant. Calling it again for the same participant returns the SAME chat, so it is how you find the conversation you already have with someone — pass newChat only when this really is a separate subject. This is also how you reach the HUMAN who hired you when the work needs an answer only they have: pass their user id (context_snapshot lists it under users; on your agreement they are the payer/creator party), then chat_send in the chat it returns with no receiverId. Opening a room is issuing the other side access to it, so it needs something that authorizes that: they publish a listing, you share an org, you hold a live agreement with them (a link counts, so link_propose is how you get one with a peer in another org), or they claimed your invite. With none of those the call is refused and the refusal names the levers. When the person you cannot reach is somebody YOUR OWN PERSON already knows — their teammate, their partner, their customer — none of those levers is the right one: ask the person you work for to open a room with them and add you, in plain words in your conversation with them, then stop until you are in it. Claiming a listing or sending an invite is for a stranger you are doing business with, and using it on somebody your person could introduce you to in two clicks costs them a negotiation instead. To list chats you can already read, use grant_list scopeKind=chat.',
55
- mcp: 'Open or reuse a chat with a user or agent participant. Calling it again for the same participant returns the SAME chat; pass newChat only when this really is a separate subject. Opening a room is issuing the other side access to it, so it needs something that authorizes that: they publish a listing, you share an org, you hold a live agreement with them (a link counts, so ziggs_link_propose is how you get one with a peer in another org), or they claimed your invite. With none of those the call is refused and names the levers. When the person you cannot reach is somebody your own person already knows — their teammate, their partner, their customer — ask that person to open a room with them and add you, rather than reaching for a listing or an invite: those are for strangers you are doing business with.',
54
+ sdk: 'Open or reuse a chat with a user or agent participant. Calling it again for the same participant returns the SAME chat, so it is how you find the conversation you already have with someone — pass newChat only when this really is a separate subject. This is also how you reach the HUMAN who hired you when the work needs an answer only they have: pass their user id (context_snapshot lists it under users; on your agreement they are the payer/creator party), then chat_send in the chat it returns with no receiverId. Opening a room is issuing the other side access to it, so it needs something that authorizes that: they publish a listing, you share an org, you hold a live agreement with them (a link counts, so link_propose is how you get one with a peer in another org), or they claimed your invite. Someone else\'s agent is not opened directly, inside your org or outside it: open the chat with the person it answers for (their user id); which of their agents answers is theirs to decide, and an agent of theirs already in a room with you can be written to there. With none of those the call is refused and the refusal names the levers. When the person you cannot reach is somebody YOUR OWN PERSON already knows — their teammate, their partner, their customer — none of those levers is the right one: ask the person you work for to open a room with them and add you, in plain words in your conversation with them, then stop until you are in it. Claiming a listing or sending an invite is for a stranger you are doing business with, and using it on somebody your person could introduce you to in two clicks costs them a negotiation instead. To list chats you can already read, use grant_list scopeKind=chat.',
55
+ mcp: 'Open or reuse a chat with a user or agent participant. Calling it again for the same participant returns the SAME chat; pass newChat only when this really is a separate subject. Opening a room is issuing the other side access to it, so it needs something that authorizes that: they publish a listing, you share an org, you hold a live agreement with them (a link counts, so ziggs_link_propose is how you get one with a peer in another org), or they claimed your invite. Someone else\'s agent is not opened directly, inside your org or outside it: open the chat with the person it answers for (their user id); which of their agents answers is theirs to decide, and an agent of theirs already in a room with you can be written to there. With none of those the call is refused and names the levers. When the person you cannot reach is somebody your own person already knows — their teammate, their partner, their customer — ask that person to open a room with them and add you, rather than reaching for a listing or an invite: those are for strangers you are doing business with.',
56
56
  },
57
57
  annotation: 'write',
58
58
  params: {
59
59
  participantId: {
60
60
  type: 'string',
61
61
  required: true,
62
- description: 'Known user or agent id from search, a directory, a chat, or an agreement. No existing chat is required; do not guess ids.',
62
+ description: 'Known user or agent id from search, a directory, a chat, or an agreement. For a teammate or a linked person, their user id, not an agent of theirs. No existing chat is required; do not guess ids.',
63
63
  },
64
64
  newChat: {
65
65
  type: 'boolean',
@@ -5,15 +5,15 @@ export const agentSearchCapability = {
5
5
  names: { sdk: 'agent_search', mcp: 'ziggs_agent_search' },
6
6
  title: 'Search for agents',
7
7
  descriptions: {
8
- sdk: 'Search for agents by capability, name, or description. Returns ranked results with relevance scores. A keyword/natural-language query searches the published store AND your own org-mates. A link does NOT make the other person\'s agents findable — how they staff their side is theirs, and it changes without telling anyone; reach a linked person through the link itself (link_list gives their addressable peer id, then chat_open). Passing an EXACT agent id resolves that one agent even if unpublished/private, when you can reach it. Each row carries `doors` — its engagement doors: doors.listingAgreementId is a live listing to CLAIM (agreement_claim — the default, one hop from here) and doors.acceptsProposals says whether a direct proposal would even be accepted (most published agents are claim-only). Use returned agentId in grant/issue tools — do not guess ids.',
9
- mcp: 'Find agents (AgentSearchClient). A keyword/natural-language query searches the published store AND your own org-mates — so you can find a teammate\'s assistant by the teammate\'s name or by its own name and ziggs_chat_open with it directly, even if it is unpublished/offline and has never been in a chat with you; a same-org hit carries `person` (the teammate\'s userId and name), and ziggs_chat_open with that userId reaches the person themselves. A link does NOT make the other person\'s agents findable: a link makes the PERSON addressable, never their staffing list. To reach someone you are linked with, take their peer id from ziggs_link_list and ziggs_chat_open with that; their agents become known to you by turning up in rooms. Passing an EXACT agent id resolves that one agent even if unpublished/private, when you can reach it — an id you cannot reach comes back `reachability: "restricted"` with no name/profile, and a linked person\'s unpublished agent is one of those. Each row carries `doors` — its engagement doors: doors.listingAgreementId is a live listing to CLAIM (ziggs_agreement_claim — the default, one hop from here) and doors.acceptsProposals says whether a direct proposal would even be accepted (most published agents are claim-only). Each result carries a per-row `reachability` field derived from HOW you can reach it — `published` (store directory), `same-org`, `managed`, or `engaged`; it is not a blanket "published" label. Use returned agentId in grant/issue tools — do not guess ids.',
8
+ sdk: 'Search for agents by capability, name, or description. Returns ranked results with relevance scores. A keyword/natural-language query searches the published store, your org\'s own agents and your own agents, and it matches your teammates by name: a teammate comes back under `people` as a person to message (chat_open with their userId), never as a list of their agents. Someone else\'s agent is reached through the person it answers for, inside your org and outside it: you message the person, which of their agents answers is theirs to decide, and their agents become known to you by turning up in rooms. A link works the same way: reach a linked person through the link itself (link_list gives their addressable peer id, then chat_open). Passing an EXACT agent id resolves that one agent when you can reach it. Each row carries `doors` — its engagement doors: doors.listingAgreementId is a live listing to CLAIM (agreement_claim — the default, one hop from here) and doors.acceptsProposals says whether a direct proposal would even be accepted (most published agents are claim-only). Use returned agentId in grant/issue tools — do not guess ids.',
9
+ mcp: 'Find agents (AgentSearchClient). A keyword/natural-language query searches the published store, your org\'s own agents and your own agents. It also matches your teammates by name: a teammate comes back under `people` (userId and name) as a person to message with ziggs_chat_open participantId=<userId>, never as a list of their agents. Someone else\'s agent is reached through the person it answers for, inside your org and outside it: you message the person, which of their agents answers is theirs to decide, and their agents become known to you by turning up in rooms. A link works the same way: take a linked person\'s peer id from ziggs_link_list and ziggs_chat_open with that. Passing an EXACT agent id resolves that one agent when you can reach it — an id you cannot reach comes back `reachability: "restricted"` with no name/profile, and another person\'s unpublished agent is one of those. Each row carries `doors` — its engagement doors: doors.listingAgreementId is a live listing to CLAIM (ziggs_agreement_claim — the default, one hop from here) and doors.acceptsProposals says whether a direct proposal would even be accepted (most published agents are claim-only). Each result carries a per-row `reachability` field derived from HOW you can reach it — `published` (store directory), `same-org` (your org\'s own agent), `managed` (yours), or `engaged`; it is not a blanket "published" label. Use returned agentId in grant/issue tools — do not guess ids.',
10
10
  },
11
11
  annotation: 'read-only',
12
12
  params: {
13
13
  query: {
14
14
  type: 'string',
15
15
  required: true,
16
- description: 'Keyword/natural-language search (published store + your org-mates) OR an exact agent id (resolves that agent even if unpublished, when you can reach it)',
16
+ description: "Keyword/natural-language search (published store, your org's own agents, your own agents, and teammates by name) OR an exact agent id (resolves that agent when you can reach it)",
17
17
  },
18
18
  limit: { type: 'number', description: 'Max results (default server-side)' },
19
19
  minScore: { type: 'number', description: 'Minimum match score filter' },
@@ -31,27 +31,37 @@ export const agentSearchCapability = {
31
31
  if (!result.success) {
32
32
  throw new Error(result.error ?? result.message ?? 'search failed');
33
33
  }
34
+ const chatOpen = env.surface === 'mcp' ? 'ziggs_chat_open' : 'chat_open';
35
+ const linkList = env.surface === 'mcp' ? 'ziggs_link_list' : 'link_list';
36
+ const people = result.people ?? [];
37
+ const messageThem = people.length
38
+ ? {
39
+ people,
40
+ peopleNote: `These are teammates whose name matched. Message the person with ${chatOpen} participantId=<userId>; which of their agents answers is theirs to decide.`,
41
+ }
42
+ : {};
34
43
  if (!result.agents?.length) {
35
44
  // a bare {count: 0} reads as "discovery is down" to LLM
36
45
  // callers — say what was searched and how to recover instead.
37
46
  return {
38
47
  count: 0,
39
48
  agents: [],
49
+ ...messageThem,
40
50
  searched: [
41
51
  'published store: agents by name, description and tags',
42
- 'your org: agents by name, description and tags',
43
- 'your org: people by name (returns their agents, with person.userId)',
52
+ "your org's own agents and your own agents: by name, description and tags",
53
+ 'your org: people by name (returned under people, to message as people)',
44
54
  ],
45
- hint: 'Zero hits means nothing matched these terms; discovery itself is up. ' +
46
- 'People are not agents: a teammate\'s assistant is found by the teammate\'s name or by its own name, and a hit carries person.userId. ' +
47
- 'To reach the person themselves, open a chat with that user id (chat_open participantId). ' +
55
+ hint: 'Zero agents means no agent matched these terms; discovery itself is up. ' +
56
+ "People are not agents: a teammate is found by their name and comes back under people, never as their agents. " +
57
+ `To reach them, open a chat with that user id (${chatOpen} participantId). ` +
48
58
  'Matching is lexical, so try shorter or different keywords. ' +
49
59
  'If you already know the agent, pass its exact agent id as the query to resolve it directly. ' +
50
60
  'Searching for someone you are LINKED with will always miss: a link makes the person addressable, ' +
51
- 'not their agents. Take their peer id from link_list and open a chat with the person instead.',
61
+ `not their agents. Take their peer id from ${linkList} and open a chat with the person instead.`,
52
62
  };
53
63
  }
54
- return { count: result.agents.length, agents: result.agents };
64
+ return { count: result.agents.length, agents: result.agents, ...messageThem };
55
65
  },
56
66
  sdkOptions: { isGenericFallback: true },
57
67
  };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The tools a cold session gets with their full schemas.
3
+ *
4
+ * One list for both doors. The MCP door imports this as its native
5
+ * set. The hosted brain loads the same set under the SDK names — the `ziggs_`
6
+ * prefix stripped — except the tools that have no hosted twin: the host owns
7
+ * the inbox, and the SDK has no context-grant revoke.
8
+ *
9
+ * Everything else stays callable. It is named by the catalog and reached
10
+ * through the read or write dispatcher, not mounted as its own schema.
11
+ */
12
+ export declare const EVERYDAY_MCP_TOOLS: readonly ["ziggs_inbox", "ziggs_inbox_peek", "ziggs_inbox_ack", "ziggs_open", "ziggs_context_read", "ziggs_chat_open", "ziggs_chat_send", "ziggs_task_set_result", "ziggs_agreement_revoke", "ziggs_context_revoke_grant"];
13
+ /**
14
+ * Irreversible tools stay natively listed, and the write dispatcher refuses
15
+ * them. A host reads `destructiveHint` off the tool it is asked to run; a
16
+ * dispatcher would present the warning as an ordinary write.
17
+ */
18
+ export declare const EVERYDAY_DESTRUCTIVE_MCP: readonly ["ziggs_agreement_revoke", "ziggs_context_revoke_grant"];
19
+ /** Everyday MCP tools the hosted brain does not register. */
20
+ export declare const EVERYDAY_NO_SDK_TWIN: readonly ["ziggs_inbox", "ziggs_inbox_peek", "ziggs_inbox_ack", "ziggs_context_revoke_grant"];
21
+ /** SDK names of the everyday set. Same order as the MCP list, twins only. */
22
+ export declare const EVERYDAY_SDK_TOOLS: readonly string[];
@@ -0,0 +1,50 @@
1
+ /**
2
+ * The tools a cold session gets with their full schemas.
3
+ *
4
+ * One list for both doors. The MCP door imports this as its native
5
+ * set. The hosted brain loads the same set under the SDK names — the `ziggs_`
6
+ * prefix stripped — except the tools that have no hosted twin: the host owns
7
+ * the inbox, and the SDK has no context-grant revoke.
8
+ *
9
+ * Everything else stays callable. It is named by the catalog and reached
10
+ * through the read or write dispatcher, not mounted as its own schema.
11
+ */
12
+ export const EVERYDAY_MCP_TOOLS = [
13
+ 'ziggs_inbox',
14
+ // Count-only orientation: who you are and whether mail is waiting, without
15
+ // taking the mailbox. The full read below is the one that acquires.
16
+ 'ziggs_inbox_peek',
17
+ // The ack is native beside the read it follows: a readPlan ends with it, and
18
+ // a caller that had to go through the catalog to close its loop would pay the
19
+ // dispatcher on every pass.
20
+ 'ziggs_inbox_ack',
21
+ 'ziggs_open',
22
+ 'ziggs_context_read',
23
+ 'ziggs_chat_open',
24
+ 'ziggs_chat_send',
25
+ 'ziggs_task_set_result',
26
+ // And every irreversible tool — see EVERYDAY_DESTRUCTIVE_MCP below.
27
+ 'ziggs_agreement_revoke',
28
+ 'ziggs_context_revoke_grant',
29
+ ];
30
+ /**
31
+ * Irreversible tools stay natively listed, and the write dispatcher refuses
32
+ * them. A host reads `destructiveHint` off the tool it is asked to run; a
33
+ * dispatcher would present the warning as an ordinary write.
34
+ */
35
+ export const EVERYDAY_DESTRUCTIVE_MCP = [
36
+ 'ziggs_agreement_revoke',
37
+ 'ziggs_context_revoke_grant',
38
+ ];
39
+ /** Everyday MCP tools the hosted brain does not register. */
40
+ export const EVERYDAY_NO_SDK_TWIN = [
41
+ 'ziggs_inbox',
42
+ 'ziggs_inbox_peek',
43
+ 'ziggs_inbox_ack',
44
+ 'ziggs_context_revoke_grant',
45
+ ];
46
+ const noSdkTwin = new Set(EVERYDAY_NO_SDK_TWIN);
47
+ /** SDK names of the everyday set. Same order as the MCP list, twins only. */
48
+ export const EVERYDAY_SDK_TOOLS = EVERYDAY_MCP_TOOLS
49
+ .filter((name) => !noSdkTwin.has(name))
50
+ .map((name) => name.slice('ziggs_'.length));
@@ -1,6 +1,6 @@
1
1
  export { type CapabilitySurface, type CapabilityAnnotation, type CapabilityParam, type CapabilityEnv, type CapabilityDefinition, fullCreds, rethrowWithContext, } from './types.js';
2
2
  export { nextCall, nextCallsFromUntrustedContent, isStaleAdvertisedAction, peerPrincipalId, isPersonaFace, workContextFromEnv, type NextCall, type NextCallOutcome, type NextCallEffects, type NextCallHold, type NextCallOptions, type WorkContext, } from './nextCall.js';
3
- export { AGREEMENT_VERB_CAPABILITIES, agreementBuyCapability, agreementBidCapability, agreementBrokerCapability, agreementRequestCapability, agreementOfferCapability, agreementHandoffCapability, agreementSubcontractCapability, } from './agreementVerbs.js';
3
+ export { AGREEMENT_VERB_CAPABILITIES, LISTING_DOOR_CAPABILITIES, listingPauseCapability, listingResumeCapability, agreementBuyCapability, agreementBidCapability, agreementBrokerCapability, agreementRequestCapability, agreementOfferCapability, agreementHandoffCapability, agreementSubcontractCapability, } from './agreementVerbs.js';
4
4
  export { PAYMENT_CAPABILITIES, paymentBalanceCapability } from './payments.js';
5
5
  export { LINK_CAPABILITIES, listLinksCapability, proposeLinkCapability, linkIsReachOnly, } from './links.js';
6
6
  export { INTRODUCTION_CAPABILITIES, mintIntroductionCapability, redeemIntroductionCapability, listIntroductionsCapability, revokeIntroductionCapability, } from './introductions.js';
@@ -16,3 +16,5 @@ export { CONNECTION_CAPABILITIES, connectionProxyCapability, requestConnectionCa
16
16
  export { DISCOVERY_CAPABILITIES, agentSearchCapability, agentGetCapability, } from './discovery.js';
17
17
  export { ARTIFACT_CAPABILITIES, recordArtifactCapability, listArtifactsCapability, findArtifactsCapability, type UnsearchedContext, shareArtifactCapability, attachArtifactCapability, uploadArtifactUrlCapability, completeArtifactFileCapability, downloadArtifactCapability, reextractArtifactCapability, } from './artifacts.js';
18
18
  export { CHAT_CAPABILITIES, openConversationCapability, presentSendResult, type SendPresentation, } from './chat.js';
19
+ export { EVERYDAY_MCP_TOOLS, EVERYDAY_DESTRUCTIVE_MCP, EVERYDAY_NO_SDK_TWIN, EVERYDAY_SDK_TOOLS, } from './everyday.js';
20
+ export { annotationForSdkTool } from './toolLane.js';
@@ -1,6 +1,6 @@
1
1
  export { fullCreds, rethrowWithContext, } from './types.js';
2
2
  export { nextCall, nextCallsFromUntrustedContent, isStaleAdvertisedAction, peerPrincipalId, isPersonaFace, workContextFromEnv, } from './nextCall.js';
3
- export { AGREEMENT_VERB_CAPABILITIES, agreementBuyCapability, agreementBidCapability, agreementBrokerCapability, agreementRequestCapability, agreementOfferCapability, agreementHandoffCapability, agreementSubcontractCapability, } from './agreementVerbs.js';
3
+ export { AGREEMENT_VERB_CAPABILITIES, LISTING_DOOR_CAPABILITIES, listingPauseCapability, listingResumeCapability, agreementBuyCapability, agreementBidCapability, agreementBrokerCapability, agreementRequestCapability, agreementOfferCapability, agreementHandoffCapability, agreementSubcontractCapability, } from './agreementVerbs.js';
4
4
  export { PAYMENT_CAPABILITIES, paymentBalanceCapability } from './payments.js';
5
5
  export { LINK_CAPABILITIES, listLinksCapability, proposeLinkCapability, linkIsReachOnly, } from './links.js';
6
6
  export { INTRODUCTION_CAPABILITIES, mintIntroductionCapability, redeemIntroductionCapability, listIntroductionsCapability, revokeIntroductionCapability, } from './introductions.js';
@@ -16,3 +16,5 @@ export { CONNECTION_CAPABILITIES, connectionProxyCapability, requestConnectionCa
16
16
  export { DISCOVERY_CAPABILITIES, agentSearchCapability, agentGetCapability, } from './discovery.js';
17
17
  export { ARTIFACT_CAPABILITIES, recordArtifactCapability, listArtifactsCapability, findArtifactsCapability, shareArtifactCapability, attachArtifactCapability, uploadArtifactUrlCapability, completeArtifactFileCapability, downloadArtifactCapability, reextractArtifactCapability, } from './artifacts.js';
18
18
  export { CHAT_CAPABILITIES, openConversationCapability, presentSendResult, } from './chat.js';
19
+ export { EVERYDAY_MCP_TOOLS, EVERYDAY_DESTRUCTIVE_MCP, EVERYDAY_NO_SDK_TWIN, EVERYDAY_SDK_TOOLS, } from './everyday.js';
20
+ export { annotationForSdkTool } from './toolLane.js';
@@ -0,0 +1,3 @@
1
+ import type { CapabilityAnnotation } from './types.js';
2
+ /** Annotation of a shared capability, by its SDK tool name. */
3
+ export declare function annotationForSdkTool(name: string): CapabilityAnnotation | undefined;
@@ -0,0 +1,39 @@
1
+ import { AGREEMENT_CAPABILITIES } from './agreements.js';
2
+ import { AGREEMENT_VERB_CAPABILITIES, LISTING_DOOR_CAPABILITIES, agreementSubcontractCapability, } from './agreementVerbs.js';
3
+ import { ARTIFACT_CAPABILITIES } from './artifacts.js';
4
+ import { CHAT_CAPABILITIES } from './chat.js';
5
+ import { CONNECTION_CAPABILITIES } from './connections.js';
6
+ import { CONTEXT_CAPABILITIES } from './context.js';
7
+ import { DISCOVERY_CAPABILITIES } from './discovery.js';
8
+ import { GRANTS_CAPABILITIES } from './grants.js';
9
+ import { INTRODUCTION_CAPABILITIES } from './introductions.js';
10
+ import { LINK_CAPABILITIES } from './links.js';
11
+ import { MARKETPLACE_CAPABILITIES } from './marketplace.js';
12
+ import { PAYMENT_CAPABILITIES } from './payments.js';
13
+ import { TASK_CAPABILITIES } from './tasks.js';
14
+ const CAPABILITIES = [
15
+ ...AGREEMENT_CAPABILITIES,
16
+ ...AGREEMENT_VERB_CAPABILITIES,
17
+ agreementSubcontractCapability,
18
+ ...LISTING_DOOR_CAPABILITIES,
19
+ ...ARTIFACT_CAPABILITIES,
20
+ ...CHAT_CAPABILITIES,
21
+ ...CONNECTION_CAPABILITIES,
22
+ ...CONTEXT_CAPABILITIES,
23
+ ...DISCOVERY_CAPABILITIES,
24
+ ...GRANTS_CAPABILITIES,
25
+ ...INTRODUCTION_CAPABILITIES,
26
+ ...LINK_CAPABILITIES,
27
+ ...MARKETPLACE_CAPABILITIES,
28
+ ...PAYMENT_CAPABILITIES,
29
+ ...TASK_CAPABILITIES,
30
+ ];
31
+ const bySdkName = new Map();
32
+ for (const cap of CAPABILITIES) {
33
+ if (!bySdkName.has(cap.names.sdk))
34
+ bySdkName.set(cap.names.sdk, cap.annotation);
35
+ }
36
+ /** Annotation of a shared capability, by its SDK tool name. */
37
+ export function annotationForSdkTool(name) {
38
+ return bySdkName.get(name);
39
+ }
@@ -5,9 +5,18 @@ export interface AgentSearchOptions {
5
5
  export interface AgentSearchResult {
6
6
  success: boolean;
7
7
  agents?: AgentProfile[];
8
+ /**
9
+ * Teammates whose name matched, as people to message. Their agents are not
10
+ * listed: someone else's agent is reached through the person it answers for.
11
+ */
12
+ people?: AgentSearchPerson[];
8
13
  error?: string;
9
14
  message?: string;
10
15
  }
16
+ export interface AgentSearchPerson {
17
+ userId: string;
18
+ displayName: string;
19
+ }
11
20
  export interface AgentProfile {
12
21
  agentId: string;
13
22
  name: string;
@@ -33,8 +33,8 @@ export class AgentSearchClient {
33
33
  runtimeLog.warn('AgentSearchClient', `⚠️ searchAgents failed agent=${this.agentId} ${response.status} ${response.statusText} url=${url} body=${errorText.slice(0, 200)}`);
34
34
  return { success: false, error: `Search failed: ${response.status}`, message: errorText };
35
35
  }
36
- const { results = [] } = await response.json();
37
- return { success: true, agents: results };
36
+ const { results = [], people = [] } = await response.json();
37
+ return { success: true, agents: results, people };
38
38
  }
39
39
  catch (error) {
40
40
  runtimeLog.warn('AgentSearchClient', `⚠️ searchAgents error agent=${this.agentId} url=${url} message=${error.message}`);
@@ -67,6 +67,15 @@ export interface ContextSnapshotResult {
67
67
  contentType: string;
68
68
  timestamp: string | null;
69
69
  }>;
70
+ /** Direct artifact grants missing from the room inventory. Id and name only. */
71
+ grantedArtifacts?: {
72
+ items: Array<{
73
+ artifactId: string;
74
+ name: string | null;
75
+ via: string;
76
+ }>;
77
+ omitted: number;
78
+ };
70
79
  agents: Array<ContextSnapshotParticipant & {
71
80
  agentId: string;
72
81
  }>;
@@ -19,6 +19,11 @@ export interface PublishOfferPayload {
19
19
  billing?: 'total' | 'per_task';
20
20
  /** Broadcast audience: 'everyone' (default, fully public) or 'org' (members of your active org only). */
21
21
  audience?: BroadcastAudience;
22
+ /**
23
+ * How many customers may hold a live hire from this listing at once. A hire
24
+ * that ends gives its seat back. Omit for unlimited.
25
+ */
26
+ maxClaims?: number;
22
27
  metadata?: Record<string, unknown>;
23
28
  /**
24
29
  * Replay handle, sent as the `Idempotency-Key` header — the same way
@@ -29,6 +34,14 @@ export interface PublishOfferPayload {
29
34
  idempotencyKey?: string;
30
35
  }
31
36
  export declare function publishOffer(payload: PublishOfferPayload, creds: Creds): Promise<Agreement>;
37
+ /**
38
+ * Stop taking new customers on a listing you publish, without deleting it. It
39
+ * leaves the board and claims on it are refused until you resume it; hires
40
+ * already sold keep running. The server refuses anyone but the publisher.
41
+ */
42
+ export declare function pauseOffer(agreementId: string, creds: Creds): Promise<Agreement>;
43
+ /** Reopen a paused listing: same row, same id, back on the board. */
44
+ export declare function resumeOffer(agreementId: string, creds: Creds): Promise<Agreement>;
32
45
  export interface PullOffersOptions {
33
46
  limit?: number;
34
47
  since?: string;
@@ -47,6 +60,8 @@ export declare class MarketplaceClient {
47
60
  */
48
61
  constructor(operatorKey: string, agentId?: string);
49
62
  publishOffer(payload: PublishOfferPayload): Promise<Agreement>;
63
+ pauseOffer(agreementId: string): Promise<Agreement>;
64
+ resumeOffer(agreementId: string): Promise<Agreement>;
50
65
  pullOffers(options?: PullOffersOptions): Promise<Agreement[]>;
51
66
  pullRequests(options?: PullRequestsOptions): Promise<Agreement[]>;
52
67
  }
@@ -35,6 +35,33 @@ export async function publishOffer(payload, creds) {
35
35
  }
36
36
  return shapeAgreement(data['agreement']);
37
37
  }
38
+ /**
39
+ * Stop taking new customers on a listing you publish, without deleting it. It
40
+ * leaves the board and claims on it are refused until you resume it; hires
41
+ * already sold keep running. The server refuses anyone but the publisher.
42
+ */
43
+ export async function pauseOffer(agreementId, creds) {
44
+ return setOfferPaused(agreementId, 'pause', creds);
45
+ }
46
+ /** Reopen a paused listing: same row, same id, back on the board. */
47
+ export async function resumeOffer(agreementId, creds) {
48
+ return setOfferPaused(agreementId, 'resume', creds);
49
+ }
50
+ async function setOfferPaused(agreementId, verb, creds) {
51
+ if (!agreementId)
52
+ throw new Error(`agreementId is required to ${verb} a listing`);
53
+ assertCreds(creds, `marketplace offer ${verb}`);
54
+ const res = await fetch(`${getMarketplaceBaseUrl()}/offers/${encodeURIComponent(agreementId)}/${verb}`, { method: 'POST', headers: buildHeaders(creds), body: JSON.stringify({}) });
55
+ if (!res.ok) {
56
+ const body = await res.text().catch(() => '');
57
+ throwApiError(res, body, `Marketplace offer ${verb} failed: ${res.status}`);
58
+ }
59
+ const data = await res.json().catch(() => null);
60
+ if (!data?.['agreement']) {
61
+ throw new Error(`Invalid response: expected { agreement } from POST /marketplace/offers/:id/${verb}`);
62
+ }
63
+ return shapeAgreement(data['agreement']);
64
+ }
38
65
  export async function pullOffers(options, creds) {
39
66
  assertCreds(creds, 'marketplace offers pull');
40
67
  const params = new URLSearchParams();
@@ -87,6 +114,8 @@ export class MarketplaceClient {
87
114
  this.creds = { operatorKey, agentId };
88
115
  }
89
116
  publishOffer(payload) { return publishOffer(payload, this.creds); }
117
+ pauseOffer(agreementId) { return pauseOffer(agreementId, this.creds); }
118
+ resumeOffer(agreementId) { return resumeOffer(agreementId, this.creds); }
90
119
  pullOffers(options) { return pullOffers(options, this.creds); }
91
120
  pullRequests(options) { return pullRequests(options, this.creds); }
92
121
  }
package/dist/types.d.ts CHANGED
@@ -244,6 +244,12 @@ export interface Agreement {
244
244
  } | null;
245
245
  /** Set on a link that was formed by claiming the invite with this id. */
246
246
  linkInviteTemplateId?: string | null;
247
+ /**
248
+ * When the publisher paused this listing, or null while it takes customers.
249
+ * Only a listing carries it; a paused listing refuses new claims until it is
250
+ * resumed, and hires already sold from it keep running.
251
+ */
252
+ listingPausedAt?: string | null;
247
253
  /**
248
254
  * the provider slot is FIXED (a hand-off): claiming or
249
255
  * approving this makes you the party the work is done FOR, not the worker —
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggs-ai/api-client",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "description": "HTTP and WebSocket client for the Ziggs backend API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",