@ziggs-ai/api-client 0.37.6 → 0.37.7

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.
@@ -110,11 +110,16 @@ export const agreementClaimCapability = {
110
110
  type: 'object',
111
111
  description: 'Only when the listing\'s requiredConnections name a kind (e.g. ledger, customer): one of YOUR connections for each, as { "<kind>": "<connectionId>" }. The hire is granted exactly that connection and the grant ends with it. Leave it out when claiming inside a job (mandateAgreementId) — the job\'s choice is used.',
112
112
  },
113
+ hireFor: {
114
+ type: 'string',
115
+ enum: ['me', 'workspace'],
116
+ description: 'Only when hiring an agent\'s listing: who the hire is for. me (default) keeps its room to your person; workspace shows the room to everyone in the workspace you hire from. Ask your person when it is not clear.',
117
+ },
113
118
  },
114
119
  needsAgentId: true,
115
120
  handler: async (args, env) => {
116
121
  const declaredMandate = args['mandateAgreementId'];
117
- const { agreement, kind, room } = await claimOpenAgreement(args['agreementId'], fullCreds(env), { ...(typeof declaredMandate === 'string' && declaredMandate ? { mandateAgreementId: declaredMandate } : {}), ...(typeof args['parentAgreementId'] === 'string' ? { parentAgreementId: args['parentAgreementId'] } : {}), ...(typeof args['chatId'] === 'string' && args['chatId'] ? { chatId: args['chatId'] } : {}), ...(claimConnections(args['connections']) ?? {}) });
122
+ const { agreement, kind, room } = await claimOpenAgreement(args['agreementId'], fullCreds(env), { ...(typeof declaredMandate === 'string' && declaredMandate ? { mandateAgreementId: declaredMandate } : {}), ...(typeof args['parentAgreementId'] === 'string' ? { parentAgreementId: args['parentAgreementId'] } : {}), ...(typeof args['chatId'] === 'string' && args['chatId'] ? { chatId: args['chatId'] } : {}), ...(claimConnections(args['connections']) ?? {}), ...(args['hireFor'] === 'workspace' ? { hireFor: 'workspace' } : {}) });
118
123
  return presentClaimResult(agreement, kind, env, room);
119
124
  },
120
125
  };
@@ -338,6 +338,12 @@ export interface ClaimOptions {
338
338
  * takes the job's and names none.
339
339
  */
340
340
  connections?: Record<string, string>;
341
+ /**
342
+ * Who a hire of a listing is for. `me` (the default) keeps its room to the
343
+ * person; `workspace` makes the workspace the payer and shows the room to
344
+ * every member.
345
+ */
346
+ hireFor?: 'me' | 'workspace';
341
347
  }
342
348
  /**
343
349
  * Where a hire made in a room stands on getting its agent in.
@@ -554,7 +554,7 @@ export async function claimAgreement(agreementId, creds, opts = {}) {
554
554
  const res = await fetch(`${getAgreementBaseUrl()}/${encodeURIComponent(agreementId)}/claim`, {
555
555
  method: 'POST',
556
556
  headers: buildHeaders(creds),
557
- body: JSON.stringify({ ...(opts.mandateAgreementId ? { mandateAgreementId: opts.mandateAgreementId } : {}), ...(opts.parentAgreementId ? { parentAgreementId: opts.parentAgreementId } : {}), ...(opts.chatId ? { chatId: opts.chatId } : {}), ...(opts.connections && Object.keys(opts.connections).length ? { connections: opts.connections } : {}) }),
557
+ body: JSON.stringify({ ...(opts.mandateAgreementId ? { mandateAgreementId: opts.mandateAgreementId } : {}), ...(opts.parentAgreementId ? { parentAgreementId: opts.parentAgreementId } : {}), ...(opts.chatId ? { chatId: opts.chatId } : {}), ...(opts.connections && Object.keys(opts.connections).length ? { connections: opts.connections } : {}), ...(opts.hireFor === 'workspace' ? { hireFor: 'workspace' } : {}) }),
558
558
  });
559
559
  if (!res.ok) {
560
560
  const body = await res.text().catch(() => '');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggs-ai/api-client",
3
- "version": "0.37.6",
3
+ "version": "0.37.7",
4
4
  "description": "HTTP and WebSocket client for the Ziggs backend API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",