@getstackrun/sdk 3.0.0 → 4.4.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/LICENSE +1 -1
- package/README.md +366 -22
- package/dist/agent-auth.js +5 -6
- package/dist/agent-auth.js.map +1 -1
- package/dist/browser-bootstrap.js +2 -2
- package/dist/browser-bootstrap.js.map +1 -1
- package/dist/client.d.ts +88 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +237 -42
- package/dist/client.js.map +1 -1
- package/dist/control-socket-server.d.ts +134 -0
- package/dist/control-socket-server.d.ts.map +1 -0
- package/dist/control-socket-server.js +108 -0
- package/dist/control-socket-server.js.map +1 -0
- package/dist/credentials-file.d.ts +7 -0
- package/dist/credentials-file.d.ts.map +1 -1
- package/dist/credentials-file.js +57 -2
- package/dist/credentials-file.js.map +1 -1
- package/dist/errors.d.ts +316 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +572 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +130 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +157 -29
- package/dist/index.js.map +1 -1
- package/dist/network-install-key.d.ts +56 -0
- package/dist/network-install-key.d.ts.map +1 -0
- package/dist/network-install-key.js +92 -0
- package/dist/network-install-key.js.map +1 -0
- package/dist/network-install.d.ts +134 -0
- package/dist/network-install.d.ts.map +1 -0
- package/dist/network-install.js +70 -0
- package/dist/network-install.js.map +1 -0
- package/dist/service-mcp.d.ts +49 -0
- package/dist/service-mcp.d.ts.map +1 -0
- package/dist/service-mcp.js +122 -0
- package/dist/service-mcp.js.map +1 -0
- package/dist/services/accounts.d.ts +1548 -0
- package/dist/services/accounts.d.ts.map +1 -0
- package/dist/services/accounts.js +724 -0
- package/dist/services/accounts.js.map +1 -0
- package/dist/services/agent-identity.d.ts +58 -0
- package/dist/services/agent-identity.d.ts.map +1 -0
- package/dist/services/agent-identity.js +50 -0
- package/dist/services/agent-identity.js.map +1 -0
- package/dist/services/agents.d.ts +79 -4
- package/dist/services/agents.d.ts.map +1 -1
- package/dist/services/agents.js +30 -3
- package/dist/services/agents.js.map +1 -1
- package/dist/services/audit.d.ts +5 -0
- package/dist/services/audit.d.ts.map +1 -1
- package/dist/services/audit.js +5 -0
- package/dist/services/audit.js.map +1 -1
- package/dist/services/billing.d.ts +67 -0
- package/dist/services/billing.d.ts.map +1 -0
- package/dist/services/billing.js +42 -0
- package/dist/services/billing.js.map +1 -0
- package/dist/services/brain.d.ts +122 -0
- package/dist/services/brain.d.ts.map +1 -0
- package/dist/services/brain.js +40 -0
- package/dist/services/brain.js.map +1 -0
- package/dist/services/calendar.d.ts +256 -0
- package/dist/services/calendar.d.ts.map +1 -0
- package/dist/services/calendar.js +75 -0
- package/dist/services/calendar.js.map +1 -0
- package/dist/services/catalogue.d.ts +185 -0
- package/dist/services/catalogue.d.ts.map +1 -0
- package/dist/services/catalogue.js +31 -0
- package/dist/services/catalogue.js.map +1 -0
- package/dist/services/chat-channels.d.ts +82 -0
- package/dist/services/chat-channels.d.ts.map +1 -0
- package/dist/services/chat-channels.js +42 -0
- package/dist/services/chat-channels.js.map +1 -0
- package/dist/services/control-policies.d.ts +409 -0
- package/dist/services/control-policies.d.ts.map +1 -0
- package/dist/services/control-policies.js +101 -0
- package/dist/services/control-policies.js.map +1 -0
- package/dist/services/control-socket.d.ts +201 -0
- package/dist/services/control-socket.d.ts.map +1 -0
- package/dist/services/control-socket.js +165 -0
- package/dist/services/control-socket.js.map +1 -0
- package/dist/services/credentials.d.ts +2 -1
- package/dist/services/credentials.d.ts.map +1 -1
- package/dist/services/credentials.js +3 -2
- package/dist/services/credentials.js.map +1 -1
- package/dist/services/detector-config.d.ts +13 -12
- package/dist/services/detector-config.d.ts.map +1 -1
- package/dist/services/detector-config.js +13 -12
- package/dist/services/detector-config.js.map +1 -1
- package/dist/services/drive.d.ts +257 -0
- package/dist/services/drive.d.ts.map +1 -0
- package/dist/services/drive.js +167 -0
- package/dist/services/drive.js.map +1 -0
- package/dist/services/dropoffs.d.ts +5 -1
- package/dist/services/dropoffs.d.ts.map +1 -1
- package/dist/services/dropoffs.js +3 -1
- package/dist/services/dropoffs.js.map +1 -1
- package/dist/services/evidence-packs.d.ts +5 -3
- package/dist/services/evidence-packs.d.ts.map +1 -1
- package/dist/services/evidence-packs.js +6 -4
- package/dist/services/evidence-packs.js.map +1 -1
- package/dist/services/flagged-content.d.ts +30 -0
- package/dist/services/flagged-content.d.ts.map +1 -0
- package/dist/services/flagged-content.js +24 -0
- package/dist/services/flagged-content.js.map +1 -0
- package/dist/services/governance.d.ts +69 -0
- package/dist/services/governance.d.ts.map +1 -0
- package/dist/services/governance.js +39 -0
- package/dist/services/governance.js.map +1 -0
- package/dist/services/identity.d.ts +44 -4
- package/dist/services/identity.d.ts.map +1 -1
- package/dist/services/identity.js +54 -6
- package/dist/services/identity.js.map +1 -1
- package/dist/services/inbound-webhooks.d.ts +12 -1
- package/dist/services/inbound-webhooks.d.ts.map +1 -1
- package/dist/services/inbound-webhooks.js +7 -0
- package/dist/services/inbound-webhooks.js.map +1 -1
- package/dist/services/intents.d.ts +9 -3
- package/dist/services/intents.d.ts.map +1 -1
- package/dist/services/intents.js +11 -7
- package/dist/services/intents.js.map +1 -1
- package/dist/services/llm.d.ts +73 -1
- package/dist/services/llm.d.ts.map +1 -1
- package/dist/services/llm.js +63 -1
- package/dist/services/llm.js.map +1 -1
- package/dist/services/making.d.ts +263 -0
- package/dist/services/making.d.ts.map +1 -0
- package/dist/services/making.js +114 -0
- package/dist/services/making.js.map +1 -0
- package/dist/services/meetings.d.ts +183 -0
- package/dist/services/meetings.d.ts.map +1 -0
- package/dist/services/meetings.js +148 -0
- package/dist/services/meetings.js.map +1 -0
- package/dist/services/memory.d.ts +288 -0
- package/dist/services/memory.d.ts.map +1 -0
- package/dist/services/memory.js +116 -0
- package/dist/services/memory.js.map +1 -0
- package/dist/services/message-access.d.ts +50 -0
- package/dist/services/message-access.d.ts.map +1 -0
- package/dist/services/message-access.js +36 -0
- package/dist/services/message-access.js.map +1 -0
- package/dist/services/missions.d.ts +93 -7
- package/dist/services/missions.d.ts.map +1 -1
- package/dist/services/missions.js +31 -3
- package/dist/services/missions.js.map +1 -1
- package/dist/services/network.d.ts +266 -0
- package/dist/services/network.d.ts.map +1 -0
- package/dist/services/network.js +209 -0
- package/dist/services/network.js.map +1 -0
- package/dist/services/partner-accounts.d.ts +215 -0
- package/dist/services/partner-accounts.d.ts.map +1 -0
- package/dist/services/partner-accounts.js +133 -0
- package/dist/services/partner-accounts.js.map +1 -0
- package/dist/services/passport-header-verify.js +1 -1
- package/dist/services/passport-header-verify.js.map +1 -1
- package/dist/services/passport-session.js +1 -1
- package/dist/services/passport-session.js.map +1 -1
- package/dist/services/passports.d.ts +6 -4
- package/dist/services/passports.d.ts.map +1 -1
- package/dist/services/passports.js +5 -4
- package/dist/services/passports.js.map +1 -1
- package/dist/services/payments.d.ts +126 -0
- package/dist/services/payments.d.ts.map +1 -0
- package/dist/services/payments.js +66 -0
- package/dist/services/payments.js.map +1 -0
- package/dist/services/pii-config.d.ts +7 -17
- package/dist/services/pii-config.d.ts.map +1 -1
- package/dist/services/pii-config.js +9 -19
- package/dist/services/pii-config.js.map +1 -1
- package/dist/services/post.d.ts +240 -0
- package/dist/services/post.d.ts.map +1 -0
- package/dist/services/post.js +99 -0
- package/dist/services/post.js.map +1 -0
- package/dist/services/proxy.d.ts +22 -5
- package/dist/services/proxy.d.ts.map +1 -1
- package/dist/services/proxy.js +33 -4
- package/dist/services/proxy.js.map +1 -1
- package/dist/services/rentahuman.d.ts +92 -0
- package/dist/services/rentahuman.d.ts.map +1 -0
- package/dist/services/rentahuman.js +53 -0
- package/dist/services/rentahuman.js.map +1 -0
- package/dist/services/scan.d.ts +1 -1
- package/dist/services/scan.d.ts.map +1 -1
- package/dist/services/scan.js +1 -1
- package/dist/services/scan.js.map +1 -1
- package/dist/services/services.d.ts +29 -2
- package/dist/services/services.d.ts.map +1 -1
- package/dist/services/services.js +55 -1
- package/dist/services/services.js.map +1 -1
- package/dist/services/skills.d.ts +1 -1
- package/dist/services/skills.js +1 -1
- package/dist/services/team.d.ts +13 -1
- package/dist/services/team.d.ts.map +1 -1
- package/dist/services/team.js +12 -0
- package/dist/services/team.js.map +1 -1
- package/dist/services/trust.d.ts +39 -0
- package/dist/services/trust.d.ts.map +1 -0
- package/dist/services/trust.js +35 -0
- package/dist/services/trust.js.map +1 -0
- package/dist/services/usage.d.ts +1 -1
- package/dist/services/usage.js +1 -1
- package/dist/services/wake.d.ts +257 -0
- package/dist/services/wake.d.ts.map +1 -0
- package/dist/services/wake.js +80 -0
- package/dist/services/wake.js.map +1 -0
- package/dist/services/website.d.ts +188 -0
- package/dist/services/website.d.ts.map +1 -0
- package/dist/services/website.js +135 -0
- package/dist/services/website.js.map +1 -0
- package/dist/sign-claim.d.ts +1 -1
- package/dist/sign-claim.js +2 -2
- package/dist/types.d.ts +292 -51
- package/dist/types.d.ts.map +1 -1
- package/dist/verify-agent-identity.d.ts +73 -0
- package/dist/verify-agent-identity.d.ts.map +1 -0
- package/dist/verify-agent-identity.js +106 -0
- package/dist/verify-agent-identity.js.map +1 -0
- package/dist/verify-network.d.ts +159 -0
- package/dist/verify-network.d.ts.map +1 -0
- package/dist/verify-network.js +153 -0
- package/dist/verify-network.js.map +1 -0
- package/dist/wake-webhook.d.ts +57 -0
- package/dist/wake-webhook.d.ts.map +1 -0
- package/dist/wake-webhook.js +60 -0
- package/dist/wake-webhook.js.map +1 -0
- package/dist/wallet-key.d.ts +30 -0
- package/dist/wallet-key.d.ts.map +1 -0
- package/dist/wallet-key.js +108 -0
- package/dist/wallet-key.js.map +1 -0
- package/dist/webhook.d.ts +63 -0
- package/dist/webhook.d.ts.map +1 -0
- package/dist/webhook.js +136 -0
- package/dist/webhook.js.map +1 -0
- package/dist/x402-pay.d.ts +139 -0
- package/dist/x402-pay.d.ts.map +1 -0
- package/dist/x402-pay.js +235 -0
- package/dist/x402-pay.js.map +1 -0
- package/package.json +3 -1
- package/dist/services/partner-connect.d.ts +0 -64
- package/dist/services/partner-connect.d.ts.map +0 -1
- package/dist/services/partner-connect.js +0 -42
- package/dist/services/partner-connect.js.map +0 -1
- package/dist/services/partner-tenants.d.ts +0 -126
- package/dist/services/partner-tenants.d.ts.map +0 -1
- package/dist/services/partner-tenants.js +0 -79
- package/dist/services/partner-tenants.js.map +0 -1
package/dist/services/proxy.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { authorityRequestHeaders, createAuthorityRequestId } from '../authority-request.js';
|
|
2
|
+
import { serviceMcpRequest, serviceMcpUrlOf, toolListOf, toolResultOf, } from '../service-mcp.js';
|
|
2
3
|
function normalizeProxyRequest(input) {
|
|
3
4
|
const candidate = input;
|
|
4
5
|
const hasService = candidate.service !== undefined;
|
|
@@ -13,6 +14,10 @@ function normalizeProxyRequest(input) {
|
|
|
13
14
|
const { service: _service, provider: _provider, ...request } = candidate;
|
|
14
15
|
return { ...request, service };
|
|
15
16
|
}
|
|
17
|
+
/** The `connection` selector of a call's options, sent only when given. */
|
|
18
|
+
function connectionOf(options) {
|
|
19
|
+
return options?.connection !== undefined ? { connection: options.connection } : {};
|
|
20
|
+
}
|
|
16
21
|
export class ProxyService {
|
|
17
22
|
client;
|
|
18
23
|
constructor(client) {
|
|
@@ -24,13 +29,14 @@ export class ProxyService {
|
|
|
24
29
|
* @param input - service (or legacy provider)/method/url/body shape, validated server-side
|
|
25
30
|
* @param options - optional headers:
|
|
26
31
|
* - `passportToken`: passport JWT (REQUIRED by /v1/proxy — sent as
|
|
27
|
-
* `X-Passport-Token`).
|
|
28
|
-
* had to use the raw HTTP API. Added in 2.4 alongside approvalId.
|
|
32
|
+
* `X-Passport-Token`).
|
|
29
33
|
* - `approvalId`: approval id from `intents.submitAndWait`
|
|
30
|
-
*
|
|
34
|
+
* . Sent as `X-Intent-Approval-Id`. Required when
|
|
31
35
|
* the calling passport is in enforced mode — submit the intent
|
|
32
36
|
* first via `stack.intents.submitAndWait` and pass the returned
|
|
33
37
|
* `final.id` here.
|
|
38
|
+
* - `input.connection`: the connection to use when the service has several (its name, any case, or its `scon_` id); sent only
|
|
39
|
+
* when given.
|
|
34
40
|
* - `authorityRequestId`: stable operation handle. Non-GET calls create
|
|
35
41
|
* one before network I/O when omitted and expose it as
|
|
36
42
|
* `response.operationId` or `error.operationId`. Persist it and reuse
|
|
@@ -63,12 +69,35 @@ export class ProxyService {
|
|
|
63
69
|
throw recoverable;
|
|
64
70
|
}
|
|
65
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* The tools a connected service that speaks MCP over HTTP offers (`tools/list`), sent through the credential proxy: the Passport,
|
|
74
|
+
* the Mission, the grant, the customer's decider, the meter and the audit record all apply. Works for any connected service whose
|
|
75
|
+
* connection carries its MCP address (`mcp_url`, given when it was connected) and for RentAHuman, whose address STACK knows. What comes
|
|
76
|
+
* back is the provider's words: `untrusted` is always true.
|
|
77
|
+
*/
|
|
78
|
+
async serviceTools(service, options) {
|
|
79
|
+
const response = await this.request({ service, url: await this.mcpUrl(service, options?.connection), method: 'POST', body: serviceMcpRequest('tools/list'), ...connectionOf(options) }, options);
|
|
80
|
+
return toolListOf(service, response);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Call one tool of a connected service (`tools/call`) through the credential proxy. Reuse `authorityRequestId` for an exact retry of
|
|
84
|
+
* a call with an effect (posting or funding a bounty, sending a message): one id is one operation. A service's own error is thrown;
|
|
85
|
+
* a tool that reports an error in its result comes back with `is_error` true. The result is the provider's words: `untrusted`.
|
|
86
|
+
*/
|
|
87
|
+
async serviceCallTool(service, tool, args = {}, options) {
|
|
88
|
+
const response = await this.request({ service, url: await this.mcpUrl(service, options?.connection), method: 'POST', body: serviceMcpRequest('tools/call', { name: tool, arguments: args }), ...connectionOf(options) }, options);
|
|
89
|
+
return toolResultOf(service, tool, response);
|
|
90
|
+
}
|
|
91
|
+
/** The service's MCP address: its connection's own (never one a caller names; the proxy checks it against the connection's allowed hosts). */
|
|
92
|
+
async mcpUrl(service, connection) {
|
|
93
|
+
return serviceMcpUrlOf(await this.client.get('/v1/services/connected'), service, connection);
|
|
94
|
+
}
|
|
66
95
|
/** Read delivery state and, when authorized, the stored screened response. */
|
|
67
96
|
async getOperation(operationId, options) {
|
|
68
97
|
authorityRequestHeaders(operationId);
|
|
69
98
|
return this.client.post('/v1/proxy/operations/get', { operation_id: operationId, include_response: options.includeResponse ?? false }, { headers: { 'X-Passport-Token': options.passportToken } });
|
|
70
99
|
}
|
|
71
|
-
/** Month-to-date action pool. `pooled` is set on
|
|
100
|
+
/** Month-to-date action pool. `pooled` is set on the accounts of a partner on a negotiated hard cap. */
|
|
72
101
|
async usage() {
|
|
73
102
|
return this.client.get('/v1/proxy/usage');
|
|
74
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/services/proxy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/services/proxy.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,YAAY,GAGb,MAAM,mBAAmB,CAAC;AAI3B,SAAS,qBAAqB,CAAC,KAAmB;IAChD,MAAM,SAAS,GAAG,KAAiE,CAAC;IACpF,MAAM,UAAU,GAAG,SAAS,CAAC,OAAO,KAAK,SAAS,CAAC;IACnD,MAAM,WAAW,GAAG,SAAS,CAAC,QAAQ,KAAK,SAAS,CAAC;IAErD,IAAI,UAAU,KAAK,WAAW,EAAE,CAAC;QAC/B,MAAM,IAAI,SAAS,CAAC,8DAA8D,CAAC,CAAC;IACtF,CAAC;IAED,MAAM,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC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
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
import { type AgentWalletKey } from '../wallet-key.js';
|
|
3
|
+
import type { AccountAgentCallOptions } from './accounts.js';
|
|
4
|
+
/** The payment the agent signs, and what to sign it with. */
|
|
5
|
+
interface PaymentToSign {
|
|
6
|
+
/** What RentAHuman asks, in US cents (USDC on Base). Look at it before signing. */
|
|
7
|
+
amount_cents: number;
|
|
8
|
+
/** The address RentAHuman is paid at. */
|
|
9
|
+
pay_to: string;
|
|
10
|
+
/** The EIP-712 TransferWithAuthorization, as the wallet takes it. */
|
|
11
|
+
typed_data: Record<string, unknown>;
|
|
12
|
+
/** The account's wallet at Privy: with `typed_data` it makes the string the agent signs. */
|
|
13
|
+
wallet: {
|
|
14
|
+
privy_app_id: string;
|
|
15
|
+
wallet_id: string;
|
|
16
|
+
};
|
|
17
|
+
/** Sign before this time. */
|
|
18
|
+
expires_at: string;
|
|
19
|
+
}
|
|
20
|
+
export interface RentAHumanJoinInput {
|
|
21
|
+
/** The country the agent works in: an ISO code ("US") or a name. */
|
|
22
|
+
country: string;
|
|
23
|
+
city?: string;
|
|
24
|
+
/** The display name of the new account at RentAHuman (at least 2 characters; RentAHuman refuses one it will not take). */
|
|
25
|
+
agent_name?: string;
|
|
26
|
+
/** The customer accepting RentAHuman's terms of service and privacy policy through its agent. */
|
|
27
|
+
accept_terms: true;
|
|
28
|
+
}
|
|
29
|
+
export interface RentAHumanJoinStart extends PaymentToSign {
|
|
30
|
+
join_id: string;
|
|
31
|
+
}
|
|
32
|
+
export interface RentAHumanFundStart extends PaymentToSign {
|
|
33
|
+
fund_id: string;
|
|
34
|
+
}
|
|
35
|
+
export type RentAHumanFlowStatus = 'awaiting_signature' | 'paying' | 'completed' | 'unconfirmed' | 'failed' | 'expired';
|
|
36
|
+
export interface RentAHumanJoinResult {
|
|
37
|
+
join_id: string;
|
|
38
|
+
status: RentAHumanFlowStatus;
|
|
39
|
+
/** The customer's `rentahuman` connection, now holding the new account's key (never returned). */
|
|
40
|
+
connection_id: string;
|
|
41
|
+
agent_id: string;
|
|
42
|
+
/** Whether the account's events wake the agent. False: call `completeJoin` again with the same `join_id` to register them. */
|
|
43
|
+
wake_registered: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface RentAHumanFundResult {
|
|
46
|
+
fund_id: string;
|
|
47
|
+
status: RentAHumanFlowStatus;
|
|
48
|
+
amount_cents: number;
|
|
49
|
+
}
|
|
50
|
+
export interface RentAHumanConnection {
|
|
51
|
+
connection_id: string;
|
|
52
|
+
origin: 'owner_key' | 'joined';
|
|
53
|
+
wake_registered: boolean;
|
|
54
|
+
created_at: string;
|
|
55
|
+
}
|
|
56
|
+
/** What the agent signs for a payment `join` or `fund` returned: Privy's authorization payload for the wallet's signing request. */
|
|
57
|
+
export declare function signRentAHumanPayment(key: AgentWalletKey, start: PaymentToSign): string;
|
|
58
|
+
export declare class RentAHumanService {
|
|
59
|
+
private readonly client;
|
|
60
|
+
constructor(client: HttpClient);
|
|
61
|
+
/**
|
|
62
|
+
* Step one of opening a RentAHuman account for the customer, paid from the agent's wallet: asks RentAHuman what it costs and returns
|
|
63
|
+
* the payment to sign. Takes nothing. One metered action. `accept_terms: true` is the customer accepting RentAHuman's terms.
|
|
64
|
+
*/
|
|
65
|
+
join(accountId: string, input: RentAHumanJoinInput, options?: AccountAgentCallOptions): Promise<RentAHumanJoinStart>;
|
|
66
|
+
/**
|
|
67
|
+
* Step two: `signed` is the agent's signature (`signRentAHumanPayment`). Only the account's own agent, under its Passport. The
|
|
68
|
+
* payment goes through the wallet's per-payment and daily caps, the account's budget and the customer's decider; RentAHuman's key goes
|
|
69
|
+
* into the vault. Called again with the same `join_id` it answers the same and, when the account's events were not registered, tries again.
|
|
70
|
+
*/
|
|
71
|
+
completeJoin(accountId: string, input: {
|
|
72
|
+
join_id: string;
|
|
73
|
+
signed: string;
|
|
74
|
+
}, options: AccountAgentCallOptions): Promise<RentAHumanJoinResult>;
|
|
75
|
+
/** Both steps: ask, sign with the agent's wallet key, and send the signature. */
|
|
76
|
+
joinWithKey(accountId: string, key: AgentWalletKey, input: RentAHumanJoinInput, options: AccountAgentCallOptions): Promise<RentAHumanJoinResult>;
|
|
77
|
+
/** Step one of topping up the customer's RentAHuman wallet with USDC from the agent's wallet (`amount_cents` from 100 to 1,000,000). */
|
|
78
|
+
fund(accountId: string, amountCents: number, options?: AccountAgentCallOptions): Promise<RentAHumanFundStart>;
|
|
79
|
+
/** Step two of a top-up: the agent's signature of the payment `fund` returned. */
|
|
80
|
+
completeFund(accountId: string, input: {
|
|
81
|
+
fund_id: string;
|
|
82
|
+
signed: string;
|
|
83
|
+
}, options: AccountAgentCallOptions): Promise<RentAHumanFundResult>;
|
|
84
|
+
/** Both steps of a top-up. */
|
|
85
|
+
fundWithKey(accountId: string, key: AgentWalletKey, amountCents: number, options: AccountAgentCallOptions): Promise<RentAHumanFundResult>;
|
|
86
|
+
/** The customer's RentAHuman connection, or null when there is none. It shows no key. */
|
|
87
|
+
get(accountId: string, options?: AccountAgentCallOptions): Promise<{
|
|
88
|
+
connection: RentAHumanConnection | null;
|
|
89
|
+
}>;
|
|
90
|
+
}
|
|
91
|
+
export {};
|
|
92
|
+
//# sourceMappingURL=rentahuman.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rentahuman.d.ts","sourceRoot":"","sources":["../../src/services/rentahuman.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAqC,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAgB7D,6DAA6D;AAC7D,UAAU,aAAa;IACrB,mFAAmF;IACnF,YAAY,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC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,CAAA;KAAE,CAAC;CAGtH"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { walletPaymentAuthorizationPayload } from '../wallet-key.js';
|
|
2
|
+
const seg = encodeURIComponent;
|
|
3
|
+
function passport(options) {
|
|
4
|
+
return options?.passportToken ? { headers: { 'X-Passport-Token': options.passportToken } } : undefined;
|
|
5
|
+
}
|
|
6
|
+
/** What the agent signs for a payment `join` or `fund` returned: Privy's authorization payload for the wallet's signing request. */
|
|
7
|
+
export function signRentAHumanPayment(key, start) {
|
|
8
|
+
return key.sign(walletPaymentAuthorizationPayload({ appId: start.wallet.privy_app_id, walletId: start.wallet.wallet_id, typedData: start.typed_data }));
|
|
9
|
+
}
|
|
10
|
+
export class RentAHumanService {
|
|
11
|
+
client;
|
|
12
|
+
constructor(client) {
|
|
13
|
+
this.client = client;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Step one of opening a RentAHuman account for the customer, paid from the agent's wallet: asks RentAHuman what it costs and returns
|
|
17
|
+
* the payment to sign. Takes nothing. One metered action. `accept_terms: true` is the customer accepting RentAHuman's terms.
|
|
18
|
+
*/
|
|
19
|
+
async join(accountId, input, options) {
|
|
20
|
+
return this.client.post(`/v1/accounts/${seg(accountId)}/rentahuman/join`, input, passport(options));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Step two: `signed` is the agent's signature (`signRentAHumanPayment`). Only the account's own agent, under its Passport. The
|
|
24
|
+
* payment goes through the wallet's per-payment and daily caps, the account's budget and the customer's decider; RentAHuman's key goes
|
|
25
|
+
* into the vault. Called again with the same `join_id` it answers the same and, when the account's events were not registered, tries again.
|
|
26
|
+
*/
|
|
27
|
+
async completeJoin(accountId, input, options) {
|
|
28
|
+
return this.client.post(`/v1/accounts/${seg(accountId)}/rentahuman/join/complete`, input, passport(options));
|
|
29
|
+
}
|
|
30
|
+
/** Both steps: ask, sign with the agent's wallet key, and send the signature. */
|
|
31
|
+
async joinWithKey(accountId, key, input, options) {
|
|
32
|
+
const start = await this.join(accountId, input, options);
|
|
33
|
+
return this.completeJoin(accountId, { join_id: start.join_id, signed: signRentAHumanPayment(key, start) }, options);
|
|
34
|
+
}
|
|
35
|
+
/** Step one of topping up the customer's RentAHuman wallet with USDC from the agent's wallet (`amount_cents` from 100 to 1,000,000). */
|
|
36
|
+
async fund(accountId, amountCents, options) {
|
|
37
|
+
return this.client.post(`/v1/accounts/${seg(accountId)}/rentahuman/fund`, { amount_cents: amountCents }, passport(options));
|
|
38
|
+
}
|
|
39
|
+
/** Step two of a top-up: the agent's signature of the payment `fund` returned. */
|
|
40
|
+
async completeFund(accountId, input, options) {
|
|
41
|
+
return this.client.post(`/v1/accounts/${seg(accountId)}/rentahuman/fund/complete`, input, passport(options));
|
|
42
|
+
}
|
|
43
|
+
/** Both steps of a top-up. */
|
|
44
|
+
async fundWithKey(accountId, key, amountCents, options) {
|
|
45
|
+
const start = await this.fund(accountId, amountCents, options);
|
|
46
|
+
return this.completeFund(accountId, { fund_id: start.fund_id, signed: signRentAHumanPayment(key, start) }, options);
|
|
47
|
+
}
|
|
48
|
+
/** The customer's RentAHuman connection, or null when there is none. It shows no key. */
|
|
49
|
+
async get(accountId, options) {
|
|
50
|
+
return this.client.get(`/v1/accounts/${seg(accountId)}/rentahuman`, undefined, passport(options));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=rentahuman.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rentahuman.js","sourceRoot":"","sources":["../../src/services/rentahuman.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iCAAiC,EAAuB,MAAM,kBAAkB,CAAC;AA0E1F,MAAM,GAAG,GAAG,kBAAkB,CAAC;AAE/B,SAAS,QAAQ,CAAC,OAAiC;IACjD,OAAO,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,kBAAkB,EAAE,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,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portToken?: string;
|
|
31
31
|
}): Promise<ScanResponse>;
|
|
32
|
-
/** Current month's scan usage against the
|
|
32
|
+
/** Current month's scan usage against the account's allowance; `plan` names the plan it is on. */
|
|
33
33
|
usage(): Promise<ScanUsage>;
|
|
34
34
|
}
|
|
35
35
|
//# sourceMappingURL=scan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../src/services/scan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC,2DAA2D;IACrD,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC;IAQ3F,
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../src/services/scan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC,2DAA2D;IACrD,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC;IAQ3F,kGAAkG;IAC5F,KAAK,IAAI,OAAO,CAAC,SAAS,CAAC;CAGlC"}
|
package/dist/services/scan.js
CHANGED
|
@@ -33,7 +33,7 @@ export class ScanService {
|
|
|
33
33
|
}
|
|
34
34
|
return this.client.post('/v1/scan', input, { headers });
|
|
35
35
|
}
|
|
36
|
-
/** Current month's scan usage against the
|
|
36
|
+
/** Current month's scan usage against the account's allowance; `plan` names the plan it is on. */
|
|
37
37
|
async usage() {
|
|
38
38
|
return this.client.get('/v1/scan/usage');
|
|
39
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan.js","sourceRoot":"","sources":["../../src/services/scan.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,WAAW;IACF;IAApB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C,2DAA2D;IAC3D,KAAK,CAAC,IAAI,CAAC,KAAkB,EAAE,OAAoC;QACjE,MAAM,OAAO,GAA2B,EAAE,CAAC;QAC3C,IAAI,OAAO,EAAE,aAAa,EAAE,CAAC;YAC3B,OAAO,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;QACtD,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAe,UAAU,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;IAED,
|
|
1
|
+
{"version":3,"file":"scan.js","sourceRoot":"","sources":["../../src/services/scan.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,WAAW;IACF;IAApB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C,2DAA2D;IAC3D,KAAK,CAAC,IAAI,CAAC,KAAkB,EAAE,OAAoC;QACjE,MAAM,OAAO,GAA2B,EAAE,CAAC;QAC3C,IAAI,OAAO,EAAE,aAAa,EAAE,CAAC;YAC3B,OAAO,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;QACtD,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAe,UAAU,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;IAED,kGAAkG;IAClG,KAAK,CAAC,KAAK;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAY,gBAAgB,CAAC,CAAC;IACtD,CAAC;CACF"}
|
|
@@ -1,16 +1,43 @@
|
|
|
1
1
|
import type { HttpClient } from '../client.js';
|
|
2
|
-
import type { Service, ServiceConnection, ConnectServiceInput, ConnectCustomServiceInput, GrantAgentAccessInput } from '../types.js';
|
|
2
|
+
import type { Service, ServiceConnection, ConnectServiceInput, ConnectCustomServiceInput, GrantAgentAccessInput, ConnectLink, CreateConnectLinkInput, CreatedConnectLink } from '../types.js';
|
|
3
|
+
import type { GrantAgentAccessResult } from './control-policies.js';
|
|
3
4
|
export declare class ServiceService {
|
|
4
5
|
private client;
|
|
5
6
|
constructor(client: HttpClient);
|
|
6
7
|
listAvailable(): Promise<Service[]>;
|
|
7
8
|
listConnected(): Promise<ServiceConnection[]>;
|
|
9
|
+
/** The API reads the credential from `oauth_token`; `provider` is not sent. */
|
|
8
10
|
connect(input: ConnectServiceInput): Promise<ServiceConnection>;
|
|
11
|
+
/** Rename a connection (owner or admin). Calls name it by the new name from then on; the id never changes. */
|
|
12
|
+
rename(connectionId: string, connectionName: string): Promise<ServiceConnection>;
|
|
13
|
+
/**
|
|
14
|
+
* Connect a service without the credential passing through this program or
|
|
15
|
+
* a chat: create a one-time link the person opens in their own browser,
|
|
16
|
+
* signed in to STACK. It is bound to this account and member, works once,
|
|
17
|
+
* expires after 10 minutes, and any number can be open at once. The returned `url` is the only copy; read the
|
|
18
|
+
* outcome with {@link ServiceService.getConnectLink}. Pass `custom` instead
|
|
19
|
+
* of `service_id` for the customer's own API that takes a key or token: its
|
|
20
|
+
* name and the hosts the key may be sent to, which the page shows and the
|
|
21
|
+
* owner may correct there. Pass `connect` for a key of one of the customer's own supplier accounts (a print-on-demand
|
|
22
|
+
* supplier, an agent's Telegram bot, the street address's mailbox.bot key): the owner or an admin enters it on the page,
|
|
23
|
+
* so it never passes through this program or a chat. An agent context is refused: an agent never adds credentials.
|
|
24
|
+
*/
|
|
25
|
+
createConnectLink(input: CreateConnectLinkInput): Promise<CreatedConnectLink>;
|
|
26
|
+
/** The state of a connect link: pending, connected (with the connection id) or expired. Never the URL. */
|
|
27
|
+
getConnectLink(linkId: string): Promise<ConnectLink>;
|
|
28
|
+
/** The connect links still waiting for the person: pending and not yet expired, newest first, at most 50. Never a URL or a token. */
|
|
29
|
+
listConnectLinks(): Promise<ConnectLink[]>;
|
|
9
30
|
connectCustom(input: ConnectCustomServiceInput): Promise<ServiceConnection>;
|
|
10
31
|
disconnect(connectionId: string): Promise<{
|
|
11
32
|
disconnected: boolean;
|
|
12
33
|
}>;
|
|
13
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Create or replace an agent's grant on a connection. With hosted controls on
|
|
36
|
+
* and a policy that lists connections, the answer carries `control_policy`:
|
|
37
|
+
* the connection is not callable until a revision of that policy lists it,
|
|
38
|
+
* a loosening a person approves in a browser (`controlPolicies.set`).
|
|
39
|
+
*/
|
|
40
|
+
grantAgentAccess(input: GrantAgentAccessInput): Promise<GrantAgentAccessResult>;
|
|
14
41
|
revokeAgentAccess(agentId: string): Promise<{
|
|
15
42
|
success: boolean;
|
|
16
43
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/services/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EACV,OAAO,EACP,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/services/services.ts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AA;KAAE,CAAC;IAIjE,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAIzD,aAAa,IAAI,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC;CAGzD"}
|
|
@@ -9,8 +9,56 @@ export class ServiceService {
|
|
|
9
9
|
async listConnected() {
|
|
10
10
|
return this.client.get('/v1/services/connected');
|
|
11
11
|
}
|
|
12
|
+
/** The API reads the credential from `oauth_token`; `provider` is not sent. */
|
|
12
13
|
async connect(input) {
|
|
13
|
-
|
|
14
|
+
const { service_id, scopes, credential, mcp_url, connection_name } = input;
|
|
15
|
+
return this.client.post('/v1/services/connect', {
|
|
16
|
+
service_id,
|
|
17
|
+
scopes,
|
|
18
|
+
oauth_token: credential,
|
|
19
|
+
...(mcp_url !== undefined ? { mcp_url } : {}),
|
|
20
|
+
...(connection_name !== undefined ? { connection_name } : {}),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** Rename a connection (owner or admin). Calls name it by the new name from then on; the id never changes. */
|
|
24
|
+
async rename(connectionId, connectionName) {
|
|
25
|
+
return this.client.patch(`/v1/services/${encodeURIComponent(connectionId)}`, { connection_name: connectionName });
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Connect a service without the credential passing through this program or
|
|
29
|
+
* a chat: create a one-time link the person opens in their own browser,
|
|
30
|
+
* signed in to STACK. It is bound to this account and member, works once,
|
|
31
|
+
* expires after 10 minutes, and any number can be open at once. The returned `url` is the only copy; read the
|
|
32
|
+
* outcome with {@link ServiceService.getConnectLink}. Pass `custom` instead
|
|
33
|
+
* of `service_id` for the customer's own API that takes a key or token: its
|
|
34
|
+
* name and the hosts the key may be sent to, which the page shows and the
|
|
35
|
+
* owner may correct there. Pass `connect` for a key of one of the customer's own supplier accounts (a print-on-demand
|
|
36
|
+
* supplier, an agent's Telegram bot, the street address's mailbox.bot key): the owner or an admin enters it on the page,
|
|
37
|
+
* so it never passes through this program or a chat. An agent context is refused: an agent never adds credentials.
|
|
38
|
+
*/
|
|
39
|
+
async createConnectLink(input) {
|
|
40
|
+
// The API takes the name at the top level for a catalog link, inside `custom` for a custom one, and not at all for a key link.
|
|
41
|
+
if ('custom' in input) {
|
|
42
|
+
return this.client.post('/v1/services/connect-links', { custom: input.custom });
|
|
43
|
+
}
|
|
44
|
+
if ('connect' in input) {
|
|
45
|
+
return this.client.post('/v1/services/connect-links', { connect: input.connect });
|
|
46
|
+
}
|
|
47
|
+
const { service_id, scopes, connection_name } = input;
|
|
48
|
+
return this.client.post('/v1/services/connect-links', {
|
|
49
|
+
service_id,
|
|
50
|
+
...(scopes ? { scopes } : {}),
|
|
51
|
+
...(connection_name !== undefined ? { connection_name } : {}),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/** The state of a connect link: pending, connected (with the connection id) or expired. Never the URL. */
|
|
55
|
+
async getConnectLink(linkId) {
|
|
56
|
+
return this.client.get(`/v1/services/connect-links/${encodeURIComponent(linkId)}`);
|
|
57
|
+
}
|
|
58
|
+
/** The connect links still waiting for the person: pending and not yet expired, newest first, at most 50. Never a URL or a token. */
|
|
59
|
+
async listConnectLinks() {
|
|
60
|
+
const answer = await this.client.get('/v1/services/connect-links');
|
|
61
|
+
return answer.links;
|
|
14
62
|
}
|
|
15
63
|
async connectCustom(input) {
|
|
16
64
|
return this.client.post('/v1/services/custom', input);
|
|
@@ -18,6 +66,12 @@ export class ServiceService {
|
|
|
18
66
|
async disconnect(connectionId) {
|
|
19
67
|
return this.client.delete(`/v1/services/${connectionId}/disconnect`);
|
|
20
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Create or replace an agent's grant on a connection. With hosted controls on
|
|
71
|
+
* and a policy that lists connections, the answer carries `control_policy`:
|
|
72
|
+
* the connection is not callable until a revision of that policy lists it,
|
|
73
|
+
* a loosening a person approves in a browser (`controlPolicies.set`).
|
|
74
|
+
*/
|
|
21
75
|
async grantAgentAccess(input) {
|
|
22
76
|
return this.client.post('/v1/services/grant', input);
|
|
23
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../src/services/services.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../src/services/services.ts"],"names":[],"mappings":"AAaA,MAAM,OAAO,cAAc;IACL;IAApB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAY,cAAc,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAsB,wBAAwB,CAAC,CAAC;IACxE,CAAC;IAED,+EAA+E;IAC/E,KAAK,CAAC,OAAO,CAAC,KAA0B;QACtC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;QAC3E,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAoB,sBAAsB,EAAE;YACjE,UAAU;YACV,MAAM;YACN,WAAW,EAAE,UAAU;YACvB,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7C,GAAG,CAAC,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9D,CAAC,CAAC;IACL,CAAC;IAED,8GAA8G;IAC9G,KAAK,CAAC,MAAM,CAAC,YAAoB,EAAE,cAAsB;QACvD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAoB,gBAAgB,kBAAkB,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,cAAc,EAAE,CAA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AoB,qBAAqB,EAAE,KAAK,CAAC,CAAC;IAC3E,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,YAAoB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,YAAY,aAAa,CAAC,CAAC;IACvE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,gBAAgB,CAAC,KAA4B;QACjD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAyB,oBAAoB,EAAE,KAAK,CAAC,CAAC;IAC/E,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAAe;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,uBAAuB,OAAO,SAAS,CAAC,CAAC;IACrE,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,YAAoB;QAC/B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,YAAY,SAAS,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACnD,CAAC;CACF"}
|
|
@@ -27,7 +27,7 @@ export declare class SkillService {
|
|
|
27
27
|
* paid invocations.
|
|
28
28
|
* @param options - per-call options:
|
|
29
29
|
* - `approvalId`: approval id from `intents.submitAndWait`
|
|
30
|
-
*
|
|
30
|
+
* . Sent as `X-Intent-Approval-Id`. Required
|
|
31
31
|
* when the calling agent is in enforced mode.
|
|
32
32
|
*/
|
|
33
33
|
invoke(skillId: string, input: InvokeSkillInput & {
|
package/dist/services/skills.js
CHANGED
|
@@ -39,7 +39,7 @@ export class SkillService {
|
|
|
39
39
|
* paid invocations.
|
|
40
40
|
* @param options - per-call options:
|
|
41
41
|
* - `approvalId`: approval id from `intents.submitAndWait`
|
|
42
|
-
*
|
|
42
|
+
* . Sent as `X-Intent-Approval-Id`. Required
|
|
43
43
|
* when the calling agent is in enforced mode.
|
|
44
44
|
*/
|
|
45
45
|
async invoke(skillId, input, options) {
|
package/dist/services/team.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HttpClient } from '../client.js';
|
|
2
|
-
import type { TeamMember, InviteMemberInput, UpdateMemberInput } from '../types.js';
|
|
2
|
+
import type { TeamMember, InviteMemberInput, UpdateMemberInput, ClearSsoBindingsInput, ClearSsoBindingsResult } from '../types.js';
|
|
3
3
|
export declare class TeamService {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: HttpClient);
|
|
@@ -9,5 +9,17 @@ export declare class TeamService {
|
|
|
9
9
|
revoke(id: string): Promise<{
|
|
10
10
|
success: boolean;
|
|
11
11
|
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Forget the single sign-on binding of one member (`{ member_id }`) or of every member bound to one issuer
|
|
14
|
+
* (`{ issuer }`, the `iss` of the provider that was replaced), so the next verified sign-in with the provider in
|
|
15
|
+
* use binds them again. A person bound to the old provider's subject is refused under the new one, so replacing
|
|
16
|
+
* the provider locks out everyone who had signed in until this is called. Owner or admin only; an agent is
|
|
17
|
+
* refused. It needs a person in a signed-in browser: without a dashboard session the call throws
|
|
18
|
+
* `GovernanceApprovalRequiredError` first, and once they approve at its link, send the same call again with its
|
|
19
|
+
* `governanceApprovalId`. The role, status and sessions of a member are untouched.
|
|
20
|
+
*/
|
|
21
|
+
clearSsoBindings(input: ClearSsoBindingsInput, options?: {
|
|
22
|
+
governanceApprovalId?: string;
|
|
23
|
+
}): Promise<ClearSsoBindingsResult>;
|
|
12
24
|
}
|
|
13
25
|
//# sourceMappingURL=team.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"team.d.ts","sourceRoot":"","sources":["../../src/services/team.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"team.d.ts","sourceRoot":"","sources":["../../src/services/team.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEnI,qBAAa,WAAW;IACV,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEhC,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC;IAIrD,IAAI,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAI7B,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC;IAIjE,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAIvD;;;;;;;;OAQG;IACG,gBAAgB,CACpB,KAAK,EAAE,qBAAqB,EAC5B,OAAO,CAAC,EAAE;QAAE,oBAAoB,CAAC,EAAE,MAAM,CAAA;KAAE,GAC1C,OAAO,CAAC,sBAAsB,CAAC;CAOnC"}
|
package/dist/services/team.js
CHANGED
|
@@ -15,5 +15,17 @@ export class TeamService {
|
|
|
15
15
|
async revoke(id) {
|
|
16
16
|
return this.client.delete(`/v1/team/members/${id}`);
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Forget the single sign-on binding of one member (`{ member_id }`) or of every member bound to one issuer
|
|
20
|
+
* (`{ issuer }`, the `iss` of the provider that was replaced), so the next verified sign-in with the provider in
|
|
21
|
+
* use binds them again. A person bound to the old provider's subject is refused under the new one, so replacing
|
|
22
|
+
* the provider locks out everyone who had signed in until this is called. Owner or admin only; an agent is
|
|
23
|
+
* refused. It needs a person in a signed-in browser: without a dashboard session the call throws
|
|
24
|
+
* `GovernanceApprovalRequiredError` first, and once they approve at its link, send the same call again with its
|
|
25
|
+
* `governanceApprovalId`. The role, status and sessions of a member are untouched.
|
|
26
|
+
*/
|
|
27
|
+
async clearSsoBindings(input, options) {
|
|
28
|
+
return this.client.post('/v1/team/sso-bindings/clear', input, options?.governanceApprovalId ? { headers: { 'X-Governance-Approval': options.governanceApprovalId } } : undefined);
|
|
29
|
+
}
|
|
18
30
|
}
|
|
19
31
|
//# sourceMappingURL=team.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"team.js","sourceRoot":"","sources":["../../src/services/team.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,WAAW;IACF;IAApB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C,KAAK,CAAC,MAAM,CAAC,KAAwB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAa,kBAAkB,EAAE,KAAK,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAe,kBAAkB,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,KAAwB;QAC/C,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAa,oBAAoB,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAuB,oBAAoB,EAAE,EAAE,CAAC,CAAC;IAC5E,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"team.js","sourceRoot":"","sources":["../../src/services/team.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,WAAW;IACF;IAApB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C,KAAK,CAAC,MAAM,CAAC,KAAwB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAa,kBAAkB,EAAE,KAAK,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAe,kBAAkB,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,KAAwB;QAC/C,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAa,oBAAoB,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAuB,oBAAoB,EAAE,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,gBAAgB,CACpB,KAA4B,EAC5B,OAA2C;QAE3C,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CACrB,6BAA6B,EAC7B,KAAK,EACL,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,uBAAuB,EAAE,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CACnH,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
/** `ask_first`: what needs a person waits for one. `trust_agents`: nothing waits for a person. */
|
|
3
|
+
export type TrustValue = 'ask_first' | 'trust_agents';
|
|
4
|
+
/** What is set at one scope, and what is in force there. */
|
|
5
|
+
export interface TrustSetting {
|
|
6
|
+
/** The agent this is for, or null for the account. */
|
|
7
|
+
agent_id: string | null;
|
|
8
|
+
/** What is set at this scope: null when it has no value of its own (an agent following its account, an account on STACK's default). */
|
|
9
|
+
trust: TrustValue | null;
|
|
10
|
+
/** What is in force here: the agent's value, else the account's, else STACK's default (`trust_agents`). */
|
|
11
|
+
effective: TrustValue;
|
|
12
|
+
/** Which of those the effective value is. */
|
|
13
|
+
source: 'agent' | 'account' | 'default';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The trust switch: whether the account's agents ask first or are trusted to act. With `trust_agents` nothing waits for
|
|
17
|
+
* a person on card purchases, orders on the customer's own supplier account, and governance changes made with the
|
|
18
|
+
* owner's own API key; with `ask_first` they wait, as they always have. In both, a wallet balance or spend limit, a
|
|
19
|
+
* revoked or suspended agent, a control policy's review rule and the browser-only actions still apply. A new account
|
|
20
|
+
* starts on `trust_agents`. Owner or admin only; an agent is refused. It is not part of any control policy. A change that
|
|
21
|
+
* makes a scope trust where it asked first before needs a person's approval (`trust_widen`: 403
|
|
22
|
+
* `GOVERNANCE_APPROVAL_REQUIRED` with the approval link; retry with `governanceApprovalId` once it is approved); a
|
|
23
|
+
* change to `ask_first` applies at once. Every change is recorded in the audit log.
|
|
24
|
+
*/
|
|
25
|
+
export declare class TrustService {
|
|
26
|
+
private readonly client;
|
|
27
|
+
constructor(client: HttpClient);
|
|
28
|
+
/** The account's value, or one agent's own value over the account's. */
|
|
29
|
+
get(agentId?: string): Promise<TrustSetting>;
|
|
30
|
+
/** Set the account's value, or one agent's (it wins over the account's). */
|
|
31
|
+
set(trust: TrustValue, agentId?: string, opts?: {
|
|
32
|
+
governanceApprovalId?: string;
|
|
33
|
+
}): Promise<TrustSetting>;
|
|
34
|
+
/** Remove an agent's own value, so it follows the account again. */
|
|
35
|
+
clear(agentId: string, opts?: {
|
|
36
|
+
governanceApprovalId?: string;
|
|
37
|
+
}): Promise<TrustSetting>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=trust.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trust.d.ts","sourceRoot":"","sources":["../../src/services/trust.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,kGAAkG;AAClG,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,cAAc,CAAC;AAEtD,4DAA4D;AAC5D,MAAM,WAAW,YAAY;IAC3B,sDAAsD;IACtD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,uIAAuI;IACvI,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACzB,2GAA2G;IAC3G,SAAS,EAAE,UAAU,CAAC;IACtB,6CAA6C;IAC7C,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;CACzC;AAED;;;;;;;;;GASG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAE/C,wEAAwE;IAClE,GAAG,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAIlD,4EAA4E;IACtE,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,oBAAoB,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC;IAI/G,oEAAoE;IAC9D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,oBAAoB,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC;CAG9F"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The trust switch: whether the account's agents ask first or are trusted to act. With `trust_agents` nothing waits for
|
|
3
|
+
* a person on card purchases, orders on the customer's own supplier account, and governance changes made with the
|
|
4
|
+
* owner's own API key; with `ask_first` they wait, as they always have. In both, a wallet balance or spend limit, a
|
|
5
|
+
* revoked or suspended agent, a control policy's review rule and the browser-only actions still apply. A new account
|
|
6
|
+
* starts on `trust_agents`. Owner or admin only; an agent is refused. It is not part of any control policy. A change that
|
|
7
|
+
* makes a scope trust where it asked first before needs a person's approval (`trust_widen`: 403
|
|
8
|
+
* `GOVERNANCE_APPROVAL_REQUIRED` with the approval link; retry with `governanceApprovalId` once it is approved); a
|
|
9
|
+
* change to `ask_first` applies at once. Every change is recorded in the audit log.
|
|
10
|
+
*/
|
|
11
|
+
export class TrustService {
|
|
12
|
+
client;
|
|
13
|
+
constructor(client) {
|
|
14
|
+
this.client = client;
|
|
15
|
+
}
|
|
16
|
+
/** The account's value, or one agent's own value over the account's. */
|
|
17
|
+
async get(agentId) {
|
|
18
|
+
return this.client.get(trustPath(agentId));
|
|
19
|
+
}
|
|
20
|
+
/** Set the account's value, or one agent's (it wins over the account's). */
|
|
21
|
+
async set(trust, agentId, opts) {
|
|
22
|
+
return this.client.put(trustPath(agentId), { trust }, approvalHeaders(opts));
|
|
23
|
+
}
|
|
24
|
+
/** Remove an agent's own value, so it follows the account again. */
|
|
25
|
+
async clear(agentId, opts) {
|
|
26
|
+
return this.client.put(trustPath(agentId), { trust: null }, approvalHeaders(opts));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function trustPath(agentId) {
|
|
30
|
+
return agentId === undefined ? '/v1/trust' : `/v1/agents/${encodeURIComponent(agentId)}/trust`;
|
|
31
|
+
}
|
|
32
|
+
function approvalHeaders(opts) {
|
|
33
|
+
return opts?.governanceApprovalId ? { headers: { 'X-Governance-Approval': opts.governanceApprovalId } } : undefined;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=trust.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trust.js","sourceRoot":"","sources":["../../src/services/trust.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;GASG;AACH,MAAM,OAAO,YAAY;IACM;IAA7B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAEnD,wEAAwE;IACxE,KAAK,CAAC,GAAG,CAAC,OAAgB;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAe,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,4EAA4E;IAC5E,KAAK,CAAC,GAAG,CAAC,KAAiB,EAAE,OAAgB,EAAE,IAAwC;QACrF,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAe,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7F,CAAC;IAED,oEAAoE;IACpE,KAAK,CAAC,KAAK,CAAC,OAAe,EAAE,IAAwC;QACnE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAe,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IACnG,CAAC;CACF;AAED,SAAS,SAAS,CAAC,OAA2B;IAC5C,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC;AACjG,CAAC;AAED,SAAS,eAAe,CAAC,IAAmD;IAC1E,OAAO,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,uBAAuB,EAAE,IAAI,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACtH,CAAC"}
|
package/dist/services/usage.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { UsageResponse } from '../types.js';
|
|
|
11
11
|
* `consumption.activity` is every audit event. `consumption.actions` is only
|
|
12
12
|
* the published allowance meter. Its `allowance_coverage` states whether the
|
|
13
13
|
* limit belongs to that exact UTC month. An old unknown month never borrows
|
|
14
|
-
* the current
|
|
14
|
+
* the current plan. Pass `since` / `until` (ISO-8601 or unix-ms) to scope the
|
|
15
15
|
* flow metrics to a window. Inventory metrics always report the current count,
|
|
16
16
|
* plus `created_in_window` when a window is set.
|
|
17
17
|
*
|
package/dist/services/usage.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* `consumption.activity` is every audit event. `consumption.actions` is only
|
|
10
10
|
* the published allowance meter. Its `allowance_coverage` states whether the
|
|
11
11
|
* limit belongs to that exact UTC month. An old unknown month never borrows
|
|
12
|
-
* the current
|
|
12
|
+
* the current plan. Pass `since` / `until` (ISO-8601 or unix-ms) to scope the
|
|
13
13
|
* flow metrics to a window. Inventory metrics always report the current count,
|
|
14
14
|
* plus `created_in_window` when a window is set.
|
|
15
15
|
*
|