@ziggs-ai/api-client 0.23.1 → 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.
- package/dist/capabilities/agreementVerbs.d.ts +12 -15
- package/dist/capabilities/agreementVerbs.js +65 -2
- package/dist/capabilities/everyday.d.ts +22 -0
- package/dist/capabilities/everyday.js +50 -0
- package/dist/capabilities/index.d.ts +3 -1
- package/dist/capabilities/index.js +3 -1
- package/dist/capabilities/toolLane.d.ts +3 -0
- package/dist/capabilities/toolLane.js +39 -0
- package/dist/http/ContextReadClient.d.ts +9 -0
- package/dist/http/MarketplaceClient.d.ts +15 -0
- package/dist/http/MarketplaceClient.js +29 -0
- package/dist/types.d.ts +6 -0
- package/package.json +1 -1
|
@@ -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
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
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
|
|
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
|
|
@@ -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,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
|
+
}
|
|
@@ -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 —
|