@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
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { type HttpClient } from '../client.js';
|
|
2
|
+
export type DriveVisibility = 'agent' | 'account';
|
|
3
|
+
export interface DriveFile {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
content_type: string;
|
|
7
|
+
size_bytes: number;
|
|
8
|
+
sha256: string;
|
|
9
|
+
/** `owner`: only the owner sees it (an attachment of a message STACK withheld); the owner can change it to `agent` or `account`. */
|
|
10
|
+
visibility: DriveVisibility | 'owner';
|
|
11
|
+
/** The agent that wrote it; null for a file the owner uploaded. */
|
|
12
|
+
agent_id: string | null;
|
|
13
|
+
created_at: string;
|
|
14
|
+
expires_at: string | null;
|
|
15
|
+
/** `skipped_too_large`: a received text file over what is read whole, kept without being scanned. Null for every other file. */
|
|
16
|
+
scan: 'skipped_too_large' | null;
|
|
17
|
+
/** Always `untrusted`: a file is whatever its writer put in it. */
|
|
18
|
+
trust: 'untrusted';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A file of `DRIVE_BUFFERED_MAX_BYTES` (10 MB) or less, sent in a JSON body. Send exactly one of `content_text`
|
|
22
|
+
* (stored as UTF-8) and `content_base64`. A larger file, or one that is not in memory as text, goes through
|
|
23
|
+
* `UploadDriveContentInput` or `UploadDrivePathInput`, which send the bytes themselves as the request body.
|
|
24
|
+
*/
|
|
25
|
+
export interface UploadDriveFileInput {
|
|
26
|
+
/** A display name: no path separators or control characters, 200 characters at most. */
|
|
27
|
+
name: string;
|
|
28
|
+
/** The label the file carries, any media type such as `model/stl`; `application/octet-stream` when left out. The drive takes a file of any type and does not read it to check this. */
|
|
29
|
+
content_type?: string;
|
|
30
|
+
content_text?: string;
|
|
31
|
+
content_base64?: string;
|
|
32
|
+
/** An agent's file is private to it unless this is `account`; the owner's upload is always `account`. */
|
|
33
|
+
visibility?: DriveVisibility;
|
|
34
|
+
/** 60 seconds to a year from now. Without it the file stays until deleted. */
|
|
35
|
+
expires_in_seconds?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface ListDriveFilesQuery {
|
|
38
|
+
/** 1 to 100, default 50. */
|
|
39
|
+
limit?: number;
|
|
40
|
+
/** `next_cursor` of the previous page. */
|
|
41
|
+
cursor?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface DriveUsage {
|
|
44
|
+
files: number;
|
|
45
|
+
/** The storage total: the files' bytes and the bytes of the account's messages, which count in the same total. */
|
|
46
|
+
bytes: number;
|
|
47
|
+
/** The part of `bytes` that is messages (mail, texts, voicemails, call and meeting transcripts). Unpaid storage never deletes a message. */
|
|
48
|
+
message_bytes: number;
|
|
49
|
+
/** The bytes that cost nothing; what is held past them is charged at cost from the wallet. */
|
|
50
|
+
free_bytes: number;
|
|
51
|
+
max_file_bytes: number;
|
|
52
|
+
/** Bytes held past `free_bytes`. */
|
|
53
|
+
overage_bytes: number;
|
|
54
|
+
/** Bytes served through share links this month (UTC), and the free bytes of the month. */
|
|
55
|
+
download_bytes_month: number;
|
|
56
|
+
download_free_bytes: number;
|
|
57
|
+
/** Set while STACK has paused the account's share links after a download spike: none downloads and none can be made (`DRIVE_LINKS_PAUSED`). */
|
|
58
|
+
links_paused: {
|
|
59
|
+
since: string;
|
|
60
|
+
reason: string;
|
|
61
|
+
} | null;
|
|
62
|
+
/**
|
|
63
|
+
* Set while the wallet could not pay for the storage past `free_bytes`: the drive is read-only since `since` (uploads, edits and
|
|
64
|
+
* new share links answer `DRIVE_READ_ONLY`; reading, downloading, listing and deleting still work), and on `delete_on` the newest
|
|
65
|
+
* files past `free_bytes` are deleted unless the wallet is topped up to cover what is due or files are deleted until the drive is
|
|
66
|
+
* within `free_bytes`. `over_bytes` is what is held past them. Null when in good standing.
|
|
67
|
+
*/
|
|
68
|
+
storage_unpaid: {
|
|
69
|
+
since: string;
|
|
70
|
+
delete_on: string;
|
|
71
|
+
over_bytes: number;
|
|
72
|
+
} | null;
|
|
73
|
+
}
|
|
74
|
+
export interface ListDriveFilesResult {
|
|
75
|
+
files: DriveFile[];
|
|
76
|
+
next_cursor: string | null;
|
|
77
|
+
usage: DriveUsage;
|
|
78
|
+
}
|
|
79
|
+
/** An inline read: the bytes of a file of 256 KiB or less. Larger files go out through a share link. */
|
|
80
|
+
export interface DriveFileContent {
|
|
81
|
+
file: DriveFile;
|
|
82
|
+
/** `utf8` when the file's bytes are text (whatever type it carries), `base64` otherwise. */
|
|
83
|
+
encoding: 'utf8' | 'base64';
|
|
84
|
+
content: string | null;
|
|
85
|
+
/** True when a security check held the content back (the owner's controls are on); `content` is then null. */
|
|
86
|
+
withheld: boolean;
|
|
87
|
+
/** Set when the content was flagged and delivered anyway (controls off). */
|
|
88
|
+
flag: {
|
|
89
|
+
security_event_id: string | null;
|
|
90
|
+
} | null;
|
|
91
|
+
}
|
|
92
|
+
export interface UpdateDriveFileInput {
|
|
93
|
+
visibility?: DriveVisibility;
|
|
94
|
+
/** Seconds from now; `null` removes the expiry. */
|
|
95
|
+
expires_in_seconds?: number | null;
|
|
96
|
+
}
|
|
97
|
+
export interface CopyDriveFileInput {
|
|
98
|
+
/** The copy's name; the original's when not given. */
|
|
99
|
+
name?: string;
|
|
100
|
+
/** Who sees the copy: the caller alone (`agent`, the default for an agent) or every agent of the account. */
|
|
101
|
+
visibility?: DriveVisibility;
|
|
102
|
+
/** Seconds from now until the copy ends; it never ends when not given. */
|
|
103
|
+
expires_in_seconds?: number;
|
|
104
|
+
}
|
|
105
|
+
export interface ShareDriveFileInput {
|
|
106
|
+
/** 60 seconds to 7 days, default 15 minutes. */
|
|
107
|
+
ttl_seconds?: number;
|
|
108
|
+
/** 1 or more; 100 without it. A link stops working after that many downloads or when it expires. */
|
|
109
|
+
max_downloads?: number;
|
|
110
|
+
}
|
|
111
|
+
export interface DriveShare {
|
|
112
|
+
id: string;
|
|
113
|
+
file_id: string;
|
|
114
|
+
/** The signed download link. Returned once; it is not stored and cannot be read back. */
|
|
115
|
+
url: string;
|
|
116
|
+
expires_at: string;
|
|
117
|
+
max_downloads: number | null;
|
|
118
|
+
}
|
|
119
|
+
export interface DriveLink {
|
|
120
|
+
id: string;
|
|
121
|
+
file_id: string;
|
|
122
|
+
created_at: string;
|
|
123
|
+
expires_at: string;
|
|
124
|
+
max_downloads: number | null;
|
|
125
|
+
download_count: number;
|
|
126
|
+
revoked: boolean;
|
|
127
|
+
}
|
|
128
|
+
/** An agent caller passes its Passport as `passportToken`, sent as `X-Passport-Token`; an operator credential omits it. */
|
|
129
|
+
export interface DriveCallOptions {
|
|
130
|
+
passportToken?: string;
|
|
131
|
+
}
|
|
132
|
+
/** The most a text type (plain, Markdown, CSV, JSON) may be, and the most a JSON body of `POST /v1/drive/files` may carry. */
|
|
133
|
+
export declare const DRIVE_BUFFERED_MAX_BYTES: number;
|
|
134
|
+
/** A file whose bytes are sent as the request body: held in memory, a `Blob`, or a stream read as it goes. */
|
|
135
|
+
export type DriveUploadBytes = Uint8Array | Blob | ReadableStream<Uint8Array>;
|
|
136
|
+
interface UploadDriveFileFacts {
|
|
137
|
+
/** A display name: no path separators or control characters, 200 characters at most. */
|
|
138
|
+
name: string;
|
|
139
|
+
/** The label the file carries, any media type; `application/octet-stream` when left out. The drive does not read the file to check it. */
|
|
140
|
+
content_type?: string;
|
|
141
|
+
/** An agent's file is private to it unless this is `account`; the owner's upload is always `account`. */
|
|
142
|
+
visibility?: DriveVisibility;
|
|
143
|
+
/** 60 seconds to a year from now. Without it the file stays until deleted. */
|
|
144
|
+
expires_in_seconds?: number;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A file given as bytes, sent as the one request body. A `Uint8Array` (a Node `Buffer` is one) or a `Blob` goes as it is; a
|
|
148
|
+
* stream is read as it is sent. Up to 1 GB; a file declared as plain text, Markdown, CSV or JSON is limited to 10 MB.
|
|
149
|
+
*/
|
|
150
|
+
export interface UploadDriveContentInput extends UploadDriveFileFacts {
|
|
151
|
+
content: DriveUploadBytes;
|
|
152
|
+
/** The length of a stream, when known: sent as `Content-Length`, so the API can refuse a file that is too large before it reads it. Bytes and a `Blob` know their own. */
|
|
153
|
+
size_bytes?: number;
|
|
154
|
+
}
|
|
155
|
+
/** A file on disk (Node), streamed from the path as it is sent: it is never read into memory whole. */
|
|
156
|
+
export interface UploadDrivePathInput extends UploadDriveFileFacts {
|
|
157
|
+
path: string;
|
|
158
|
+
}
|
|
159
|
+
export interface DriveUploadProgress {
|
|
160
|
+
/** Bytes handed to the connection so far. */
|
|
161
|
+
uploaded_bytes: number;
|
|
162
|
+
/** The whole file's size, or null for a stream whose length was not given. */
|
|
163
|
+
total_bytes: number | null;
|
|
164
|
+
}
|
|
165
|
+
export interface DriveUploadOptions extends DriveCallOptions {
|
|
166
|
+
/** Called as the bytes are sent. Needs the body to be read in pieces, so bytes and a `Blob` are then sent as a stream. */
|
|
167
|
+
onProgress?: (progress: DriveUploadProgress) => void;
|
|
168
|
+
/** Aborts the upload. */
|
|
169
|
+
signal?: AbortSignal;
|
|
170
|
+
}
|
|
171
|
+
/** What `createUploadLink` asks for: the facts the one-time URL binds. */
|
|
172
|
+
export interface CreateDriveUploadLinkInput extends UploadDriveFileFacts {
|
|
173
|
+
/** The most the upload may send, 1 byte to 1 GB (10 MB for a file declared as plain text, Markdown, CSV or JSON); checked against the drive's room when the URL is made. */
|
|
174
|
+
size_bytes?: number;
|
|
175
|
+
}
|
|
176
|
+
/** A one-time upload URL. Metered when it is made; the PUT to it carries only the bytes. */
|
|
177
|
+
export interface DriveUploadLink {
|
|
178
|
+
id: string;
|
|
179
|
+
/** `PUT` the file's bytes here as the whole body (`curl -T ./file '<url>'`), with no other header. It works once and is a bearer URL: keep it out of logs. */
|
|
180
|
+
url: string;
|
|
181
|
+
method: 'PUT';
|
|
182
|
+
name: string;
|
|
183
|
+
content_type: string;
|
|
184
|
+
/** The most the upload may send. */
|
|
185
|
+
max_bytes: number;
|
|
186
|
+
/** The URL stops working then (30 minutes after it was made) if it was not used. */
|
|
187
|
+
expires_at: string;
|
|
188
|
+
}
|
|
189
|
+
/** Where an upload's bytes come from: memory, a `Blob` or a stream (with its length when known), or a file on disk. */
|
|
190
|
+
type BodySource = {
|
|
191
|
+
content: DriveUploadBytes;
|
|
192
|
+
size_bytes?: number;
|
|
193
|
+
} | {
|
|
194
|
+
path: string;
|
|
195
|
+
};
|
|
196
|
+
/** The calls the drive makes: `HttpClient` has them, and a program with its own sign-in (the CLI) can supply the same five. */
|
|
197
|
+
export type DriveClient = Pick<HttpClient, 'get' | 'post' | 'patch' | 'delete' | 'putRaw'>;
|
|
198
|
+
export declare class DriveService {
|
|
199
|
+
private readonly client;
|
|
200
|
+
constructor(client: DriveClient);
|
|
201
|
+
/**
|
|
202
|
+
* Upload one file in one request. Metered and checked against the account's controls, like any action.
|
|
203
|
+
*
|
|
204
|
+
* With `content_text` or `content_base64` the file goes in a JSON body (`POST /v1/drive/files`, 10 MB at most). With
|
|
205
|
+
* `content` (bytes, a `Blob` or a stream) or `path` (a file on disk, Node) the file's own bytes are the request body
|
|
206
|
+
* (`PUT /v1/drive/files`): up to 1 GB, a file declared as plain text, Markdown, CSV or JSON 10 MB. A file of any type is
|
|
207
|
+
* taken and stored as it is; `content_type` is only its label. A path is streamed from disk and a stream as it is read, so
|
|
208
|
+
* a large file is never held in memory. The API computes the SHA-256 itself; there is nothing to hash or declare. A
|
|
209
|
+
* failed upload is not retried by the SDK (a stream cannot be replayed): call again.
|
|
210
|
+
*
|
|
211
|
+
* Refusals worth branching on: `DRIVE_FILE_TOO_LARGE` (413), `DRIVE_FILE_EMPTY` (400),
|
|
212
|
+
* `DRIVE_TOO_MANY_UPLOADS` (429: five are running, try when one has finished), `DRIVE_READ_ONLY` (409: the wallet could
|
|
213
|
+
* not pay for storage past the free amount) and `INSUFFICIENT_BALANCE` (402: the upload would take the drive past the
|
|
214
|
+
* free amount and the wallet cannot cover the storage past it).
|
|
215
|
+
*/
|
|
216
|
+
upload(input: UploadDriveFileInput | UploadDriveContentInput | UploadDrivePathInput, options?: DriveUploadOptions): Promise<DriveFile>;
|
|
217
|
+
/**
|
|
218
|
+
* Ask for a one-time upload URL, for a program that cannot send a body itself (an agent that only has tools). This is the
|
|
219
|
+
* metered action; sending the bytes (`uploadToLink`, or `curl -T ./file '<url>'`) is not. The URL works once, for 30
|
|
220
|
+
* minutes, with no credential; it is a secret, so do not log it. Making the URL takes no upload slot: it answers
|
|
221
|
+
* `DRIVE_READ_ONLY` (409) like `upload`, and `DRIVE_TOO_MANY_UPLOADS` (429) is what the `PUT` to the URL answers.
|
|
222
|
+
*/
|
|
223
|
+
createUploadLink(input: CreateDriveUploadLinkInput, options?: DriveCallOptions): Promise<DriveUploadLink>;
|
|
224
|
+
/**
|
|
225
|
+
* Send a file's bytes to an upload URL from `createUploadLink` (the link, or its `url`), with no credential, and answer the
|
|
226
|
+
* file. The URL works once: a used, expired or foreign one is `DRIVE_UPLOAD_LINK_INVALID` (404), and a failed attempt gives it
|
|
227
|
+
* back. The URL is never put in an error.
|
|
228
|
+
*/
|
|
229
|
+
uploadToLink(link: DriveUploadLink | string, source: BodySource, options?: Pick<DriveUploadOptions, 'onProgress' | 'signal'>): Promise<DriveFile>;
|
|
230
|
+
/** The files the caller may see, newest first, with the account's usage. */
|
|
231
|
+
list(query?: ListDriveFilesQuery, options?: DriveCallOptions): Promise<ListDriveFilesResult>;
|
|
232
|
+
get(fileId: string, options?: DriveCallOptions): Promise<DriveFile>;
|
|
233
|
+
/**
|
|
234
|
+
* The file's bytes inline: UTF-8 text as text (`encoding: 'utf8'`, scanned) whatever type the file carries, anything else as base64.
|
|
235
|
+
* Throws `DRIVE_INLINE_READ_TOO_LARGE` over 256 KiB; use `share` for those. The content is untrusted.
|
|
236
|
+
*/
|
|
237
|
+
read(fileId: string, options?: DriveCallOptions): Promise<DriveFileContent>;
|
|
238
|
+
/** Answers `DRIVE_READ_ONLY` (409) while the drive is read-only because the wallet could not pay for storage. A file that arrived with an email changes like any file. */
|
|
239
|
+
update(fileId: string, input: UpdateDriveFileInput, options?: DriveCallOptions): Promise<DriveFile>;
|
|
240
|
+
/**
|
|
241
|
+
* A new file of the caller's own from one it can see, with its own id. The copy never ends unless `expires_in_seconds` is given. It counts
|
|
242
|
+
* as an upload (one action, put to the account's controls) and answers `DRIVE_READ_ONLY` (409) while the drive is read-only.
|
|
243
|
+
*/
|
|
244
|
+
copy(fileId: string, input?: CopyDriveFileInput, options?: DriveCallOptions): Promise<DriveFile>;
|
|
245
|
+
/** Delete the file and every share link to it. */
|
|
246
|
+
delete(fileId: string, options?: DriveCallOptions): Promise<void>;
|
|
247
|
+
/** Make a download link for the file. The URL is in the result once and cannot be read back. Answers `DRIVE_LINKS_PAUSED` (409) while the account's links are paused and `DRIVE_READ_ONLY` (409) while the drive is read-only because the wallet could not pay for storage. */
|
|
248
|
+
share(fileId: string, input?: ShareDriveFileInput, options?: DriveCallOptions): Promise<DriveShare>;
|
|
249
|
+
/** The file's links with their download counts. The URLs themselves are not stored. */
|
|
250
|
+
links(fileId: string, options?: DriveCallOptions): Promise<{
|
|
251
|
+
links: DriveLink[];
|
|
252
|
+
}>;
|
|
253
|
+
/** Stop a link working at once. */
|
|
254
|
+
revokeLink(fileId: string, linkId: string, options?: DriveCallOptions): Promise<void>;
|
|
255
|
+
}
|
|
256
|
+
export {};
|
|
257
|
+
//# sourceMappingURL=drive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive.d.ts","sourceRoot":"","sources":["../../src/services/drive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,UAAU,EAAgB,MAAM,cAAc,CAAC;AAmBtE,MAAM,MAAM,e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AAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,SAAS,EAAE,CAAA;KAAE,CAAC;IAIxF,mCAAmC;IAC7B,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAG5F"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { sendRaw } from '../client.js';
|
|
2
|
+
import { StackError } from '../errors.js';
|
|
3
|
+
/** The most a text type (plain, Markdown, CSV, JSON) may be, and the most a JSON body of `POST /v1/drive/files` may carry. */
|
|
4
|
+
export const DRIVE_BUFFERED_MAX_BYTES = 10 * 1024 * 1024;
|
|
5
|
+
const CHUNK_BYTES = 1024 * 1024;
|
|
6
|
+
const seg = encodeURIComponent;
|
|
7
|
+
function passport(options) {
|
|
8
|
+
return options?.passportToken ? { headers: { 'X-Passport-Token': options.passportToken } } : undefined;
|
|
9
|
+
}
|
|
10
|
+
function chunked(bytes) {
|
|
11
|
+
let offset = 0;
|
|
12
|
+
return new ReadableStream({
|
|
13
|
+
pull(controller) {
|
|
14
|
+
if (offset >= bytes.byteLength) {
|
|
15
|
+
controller.close();
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
controller.enqueue(bytes.subarray(offset, offset + CHUNK_BYTES));
|
|
19
|
+
offset += CHUNK_BYTES;
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** The same bytes, counted as they pass. */
|
|
24
|
+
function counted(stream, total, report) {
|
|
25
|
+
let done = 0;
|
|
26
|
+
report({ uploaded_bytes: 0, total_bytes: total });
|
|
27
|
+
return stream.pipeThrough(new TransformStream({
|
|
28
|
+
transform(chunk, controller) {
|
|
29
|
+
controller.enqueue(chunk);
|
|
30
|
+
done += chunk.byteLength;
|
|
31
|
+
report({ uploaded_bytes: done, total_bytes: total });
|
|
32
|
+
},
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
/** A file on disk as a stream and its size; Node only, loaded when a path is given. */
|
|
36
|
+
async function pathBody(path) {
|
|
37
|
+
const [{ createReadStream }, { stat }, { Readable }] = await Promise.all([import('node:fs'), import('node:fs/promises'), import('node:stream')]);
|
|
38
|
+
const info = await stat(path);
|
|
39
|
+
if (!info.isFile())
|
|
40
|
+
throw new StackError('The path is not a file', 'DRIVE_UPLOAD_SOURCE_INVALID', 0);
|
|
41
|
+
return { stream: Readable.toWeb(createReadStream(path)), size: info.size };
|
|
42
|
+
}
|
|
43
|
+
async function prepareBody(input, onProgress) {
|
|
44
|
+
let body;
|
|
45
|
+
let length;
|
|
46
|
+
if ('path' in input) {
|
|
47
|
+
const file = await pathBody(input.path);
|
|
48
|
+
body = file.stream;
|
|
49
|
+
length = file.size;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
body = input.content;
|
|
53
|
+
length = input.content instanceof Uint8Array ? input.content.byteLength : input.content instanceof Blob ? input.content.size : input.size_bytes;
|
|
54
|
+
}
|
|
55
|
+
if (onProgress) {
|
|
56
|
+
const stream = body instanceof Uint8Array ? chunked(body) : body instanceof Blob ? body.stream() : body;
|
|
57
|
+
body = counted(stream, length ?? null, onProgress);
|
|
58
|
+
}
|
|
59
|
+
return { body, length };
|
|
60
|
+
}
|
|
61
|
+
function uploadQuery(input) {
|
|
62
|
+
return {
|
|
63
|
+
name: input.name,
|
|
64
|
+
content_type: input.content_type,
|
|
65
|
+
visibility: input.visibility,
|
|
66
|
+
expires_in_seconds: input.expires_in_seconds !== undefined ? String(input.expires_in_seconds) : undefined,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export class DriveService {
|
|
70
|
+
client;
|
|
71
|
+
constructor(client) {
|
|
72
|
+
this.client = client;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Upload one file in one request. Metered and checked against the account's controls, like any action.
|
|
76
|
+
*
|
|
77
|
+
* With `content_text` or `content_base64` the file goes in a JSON body (`POST /v1/drive/files`, 10 MB at most). With
|
|
78
|
+
* `content` (bytes, a `Blob` or a stream) or `path` (a file on disk, Node) the file's own bytes are the request body
|
|
79
|
+
* (`PUT /v1/drive/files`): up to 1 GB, a file declared as plain text, Markdown, CSV or JSON 10 MB. A file of any type is
|
|
80
|
+
* taken and stored as it is; `content_type` is only its label. A path is streamed from disk and a stream as it is read, so
|
|
81
|
+
* a large file is never held in memory. The API computes the SHA-256 itself; there is nothing to hash or declare. A
|
|
82
|
+
* failed upload is not retried by the SDK (a stream cannot be replayed): call again.
|
|
83
|
+
*
|
|
84
|
+
* Refusals worth branching on: `DRIVE_FILE_TOO_LARGE` (413), `DRIVE_FILE_EMPTY` (400),
|
|
85
|
+
* `DRIVE_TOO_MANY_UPLOADS` (429: five are running, try when one has finished), `DRIVE_READ_ONLY` (409: the wallet could
|
|
86
|
+
* not pay for storage past the free amount) and `INSUFFICIENT_BALANCE` (402: the upload would take the drive past the
|
|
87
|
+
* free amount and the wallet cannot cover the storage past it).
|
|
88
|
+
*/
|
|
89
|
+
async upload(input, options) {
|
|
90
|
+
if (!('path' in input) && !('content' in input && input.content !== undefined)) {
|
|
91
|
+
return this.client.post('/v1/drive/files', input, passport(options));
|
|
92
|
+
}
|
|
93
|
+
const { body, length } = await prepareBody(input, options?.onProgress);
|
|
94
|
+
return this.client.putRaw('/v1/drive/files', body, {
|
|
95
|
+
query: uploadQuery(input),
|
|
96
|
+
headers: passport(options)?.headers,
|
|
97
|
+
contentLength: length,
|
|
98
|
+
signal: options?.signal,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Ask for a one-time upload URL, for a program that cannot send a body itself (an agent that only has tools). This is the
|
|
103
|
+
* metered action; sending the bytes (`uploadToLink`, or `curl -T ./file '<url>'`) is not. The URL works once, for 30
|
|
104
|
+
* minutes, with no credential; it is a secret, so do not log it. Making the URL takes no upload slot: it answers
|
|
105
|
+
* `DRIVE_READ_ONLY` (409) like `upload`, and `DRIVE_TOO_MANY_UPLOADS` (429) is what the `PUT` to the URL answers.
|
|
106
|
+
*/
|
|
107
|
+
async createUploadLink(input, options) {
|
|
108
|
+
return this.client.post('/v1/drive/uploads', input, passport(options));
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Send a file's bytes to an upload URL from `createUploadLink` (the link, or its `url`), with no credential, and answer the
|
|
112
|
+
* file. The URL works once: a used, expired or foreign one is `DRIVE_UPLOAD_LINK_INVALID` (404), and a failed attempt gives it
|
|
113
|
+
* back. The URL is never put in an error.
|
|
114
|
+
*/
|
|
115
|
+
async uploadToLink(link, source, options) {
|
|
116
|
+
const { body, length } = await prepareBody(source, options?.onProgress);
|
|
117
|
+
return sendRaw(typeof link === 'string' ? link : link.url, 'PUT', body, {
|
|
118
|
+
contentLength: length,
|
|
119
|
+
signal: options?.signal,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/** The files the caller may see, newest first, with the account's usage. */
|
|
123
|
+
async list(query = {}, options) {
|
|
124
|
+
return this.client.get('/v1/drive/files', {
|
|
125
|
+
limit: query.limit !== undefined ? String(query.limit) : undefined,
|
|
126
|
+
cursor: query.cursor,
|
|
127
|
+
}, passport(options));
|
|
128
|
+
}
|
|
129
|
+
async get(fileId, options) {
|
|
130
|
+
return this.client.get(`/v1/drive/files/${seg(fileId)}`, undefined, passport(options));
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* The file's bytes inline: UTF-8 text as text (`encoding: 'utf8'`, scanned) whatever type the file carries, anything else as base64.
|
|
134
|
+
* Throws `DRIVE_INLINE_READ_TOO_LARGE` over 256 KiB; use `share` for those. The content is untrusted.
|
|
135
|
+
*/
|
|
136
|
+
async read(fileId, options) {
|
|
137
|
+
return this.client.get(`/v1/drive/files/${seg(fileId)}/content`, undefined, passport(options));
|
|
138
|
+
}
|
|
139
|
+
/** Answers `DRIVE_READ_ONLY` (409) while the drive is read-only because the wallet could not pay for storage. A file that arrived with an email changes like any file. */
|
|
140
|
+
async update(fileId, input, options) {
|
|
141
|
+
return this.client.patch(`/v1/drive/files/${seg(fileId)}`, input, passport(options));
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A new file of the caller's own from one it can see, with its own id. The copy never ends unless `expires_in_seconds` is given. It counts
|
|
145
|
+
* as an upload (one action, put to the account's controls) and answers `DRIVE_READ_ONLY` (409) while the drive is read-only.
|
|
146
|
+
*/
|
|
147
|
+
async copy(fileId, input = {}, options) {
|
|
148
|
+
return this.client.post(`/v1/drive/files/${seg(fileId)}/copy`, input, passport(options));
|
|
149
|
+
}
|
|
150
|
+
/** Delete the file and every share link to it. */
|
|
151
|
+
async delete(fileId, options) {
|
|
152
|
+
await this.client.delete(`/v1/drive/files/${seg(fileId)}`, passport(options));
|
|
153
|
+
}
|
|
154
|
+
/** Make a download link for the file. The URL is in the result once and cannot be read back. Answers `DRIVE_LINKS_PAUSED` (409) while the account's links are paused and `DRIVE_READ_ONLY` (409) while the drive is read-only because the wallet could not pay for storage. */
|
|
155
|
+
async share(fileId, input = {}, options) {
|
|
156
|
+
return this.client.post(`/v1/drive/files/${seg(fileId)}/links`, input, passport(options));
|
|
157
|
+
}
|
|
158
|
+
/** The file's links with their download counts. The URLs themselves are not stored. */
|
|
159
|
+
async links(fileId, options) {
|
|
160
|
+
return this.client.get(`/v1/drive/files/${seg(fileId)}/links`, undefined, passport(options));
|
|
161
|
+
}
|
|
162
|
+
/** Stop a link working at once. */
|
|
163
|
+
async revokeLink(fileId, linkId, options) {
|
|
164
|
+
await this.client.delete(`/v1/drive/files/${seg(fileId)}/links/${seg(linkId)}`, passport(options));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=drive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive.js","sourceRoot":"","sources":["../../src/services/drive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiC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AC/Q,KAAK,CAAC,KAAK,CAAC,MAAc,EAAE,QAA6B,EAAE,EAAE,OAA0B;QACrF,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAa,mBAAmB,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IACxG,CAAC;IAED,uFAAuF;IACvF,KAAK,CAAC,KAAK,CAAC,MAAc,EAAE,OAA0B;QACpD,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAyB,mBAAmB,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IACvH,CAAC;IAED,mCAAmC;IACnC,KAAK,CAAC,UAAU,CAAC,MAAc,EAAE,MAAc,EAAE,OAA0B;QACzE,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAO,mBAAmB,GAAG,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3G,CAAC;CACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { HttpClient } from '../client.js';
|
|
2
2
|
import type { Dropoff, DropoffStatus, CreateDropoffInput } from '../types.js';
|
|
3
|
+
import type { DriveFile } from './drive.js';
|
|
3
4
|
export declare class DropoffService {
|
|
4
5
|
private client;
|
|
5
6
|
constructor(client: HttpClient);
|
|
@@ -7,16 +8,19 @@ export declare class DropoffService {
|
|
|
7
8
|
create(input: CreateDropoffInput, options?: {
|
|
8
9
|
passportToken?: string;
|
|
9
10
|
}): Promise<Dropoff>;
|
|
11
|
+
/** `driveFiles` are drive file ids the drop-off hands over: they open to the collector when it collects. */
|
|
10
12
|
deposit(id: string, agentId: string, payload: Record<string, unknown>, attribution?: {
|
|
11
13
|
passportToken?: string;
|
|
12
14
|
passportJti?: string;
|
|
13
15
|
missionId?: string;
|
|
16
|
+
driveFiles?: string[];
|
|
14
17
|
}): Promise<Dropoff>;
|
|
15
|
-
/** An agent caller passes its Mission Passport as `passportToken`. */
|
|
18
|
+
/** An agent caller passes its Mission Passport as `passportToken`. `drive_files` are the files the depositor handed over, now open to the collector; their content is untrusted. */
|
|
16
19
|
collect(id: string, agentId: string, options?: {
|
|
17
20
|
passportToken?: string;
|
|
18
21
|
}): Promise<{
|
|
19
22
|
payload: unknown;
|
|
23
|
+
drive_files?: DriveFile[];
|
|
20
24
|
}>;
|
|
21
25
|
get(id: string): Promise<DropoffStatus>;
|
|
22
26
|
list(): Promise<Dropoff[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropoffs.d.ts","sourceRoot":"","sources":["../../src/services/dropoffs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"dropoffs.d.ts","sourceRoot":"","sources":["../../src/services/dropoffs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAO5C,qBAAa,cAAc;IACb,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC,iFAAiF;IAC3E,MAAM,CAAC,KAAK,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAI/F,4GAA4G;IACtG,OAAO,CACX,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,WAAW,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GACxG,OAAO,CAAC,OAAO,CAAC;IAUnB,oLAAoL;IAC9K,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,SAAS,EAAE,CAAA;KAAE,CAAC;IAIpI,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIvC,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAI1B,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAG3C"}
|
|
@@ -11,15 +11,17 @@ export class DropoffService {
|
|
|
11
11
|
async create(input, options) {
|
|
12
12
|
return this.client.post('/v1/dropoffs', input, passportHeaders(options?.passportToken));
|
|
13
13
|
}
|
|
14
|
+
/** `driveFiles` are drive file ids the drop-off hands over: they open to the collector when it collects. */
|
|
14
15
|
async deposit(id, agentId, payload, attribution) {
|
|
15
16
|
return this.client.post(`/v1/dropoffs/${id}/deposit`, {
|
|
16
17
|
agent_id: agentId,
|
|
17
18
|
payload,
|
|
18
19
|
...(attribution?.passportJti ? { passport_jti: attribution.passportJti } : {}),
|
|
19
20
|
...(attribution?.missionId ? { mission_id: attribution.missionId } : {}),
|
|
21
|
+
...(attribution?.driveFiles ? { drive_files: attribution.driveFiles } : {}),
|
|
20
22
|
}, passportHeaders(attribution?.passportToken));
|
|
21
23
|
}
|
|
22
|
-
/** An agent caller passes its Mission Passport as `passportToken`. */
|
|
24
|
+
/** An agent caller passes its Mission Passport as `passportToken`. `drive_files` are the files the depositor handed over, now open to the collector; their content is untrusted. */
|
|
23
25
|
async collect(id, agentId, options) {
|
|
24
26
|
return this.client.post(`/v1/dropoffs/${id}/collect`, { agent_id: agentId }, passportHeaders(options?.passportToken));
|
|
25
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropoffs.js","sourceRoot":"","sources":["../../src/services/dropoffs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dropoffs.js","sourceRoot":"","sources":["../../src/services/dropoffs.ts"],"names":[],"mappings":"AAIA,4FAA4F;AAC5F,SAAS,eAAe,CAAC,aAAsB;IAC7C,OAAO,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,kBAAkB,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACxF,CAAC;AAED,MAAM,OAAO,cAAc;IACL;IAApB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C,iFAAiF;IACjF,KAAK,CAAC,MAAM,CAAC,KAAyB,EAAE,OAAoC;QAC1E,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAU,cAAc,EAAE,KAAK,EAAE,eAAe,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;IACnG,CAAC;IAED,4GAA4G;IAC5G,KAAK,CAAC,OAAO,CACX,EAAU,EACV,OAAe,EACf,OAAgC,EAChC,WAAyG;QAEzG,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAU,gBAAgB,EAAE,UAAU,EAAE;YAC7D,QAAQ,EAAE,OAAO;YACjB,OAAO;YACP,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9E,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,WAAW,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACxE,GAAG,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,WAAW,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5E,EAAE,eAAe,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,oLAAoL;IACpL,KAAK,CAAC,OAAO,CAAC,EAAU,EAAE,OAAe,EAAE,OAAoC;QAC7E,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,eAAe,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;IACxH,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAgB,gBAAgB,EAAE,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAY,cAAc,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAU,gBAAgB,EAAE,SAAS,CAAC,CAAC;IAChE,CAAC;CACF"}
|
|
@@ -131,9 +131,11 @@ export declare class EvidencePacksService {
|
|
|
131
131
|
* auditor handoff should use the standard one-file convention
|
|
132
132
|
* (`${pack_id}.json`).
|
|
133
133
|
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
134
|
+
* Signed records are a controls feature: every call here throws
|
|
135
|
+
* `ControlsRequiredError` (402 `CONTROLS_REQUIRED`) without controls,
|
|
136
|
+
* and a self-managed install also needs its licence to export
|
|
137
|
+
* (`LICENCE_REQUIRED`). Incident scope and malformed period refs get a
|
|
138
|
+
* `StackError` with `status` 400.
|
|
137
139
|
*/
|
|
138
140
|
export(input: ExportPackInput): Promise<ExportPackResult>;
|
|
139
141
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evidence-packs.d.ts","sourceRoot":"","sources":["../../src/services/evidence-packs.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;AAElF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,iBAAiB,CAAC;IACzB,gFAAgF;IAChF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAMD,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,CAAC,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtF,MAAM,EAAE,KAAK,CAAC;QACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;KAC9B,CAAC,CAAC;IACH,kBAAkB,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACjG,qBAAqB,EAAE;QACrB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,oBAAoB,EAAE;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OAAO,CAAC,aAAa,CAAC;IAMjD,0EAA0E;IACpE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAMnD;;;;OAIG;IACG,IAAI,CAAC,KAAK,GAAE,cAAmB,GAAG,OAAO,CAAC,eAAe,CAAC;CAQjE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// EvidencePacksService TS SDK wrapper.
|
|
2
2
|
//
|
|
3
3
|
// Four methods over /v1/evidence-packs:
|
|
4
4
|
//
|
|
@@ -22,9 +22,11 @@ export class EvidencePacksService {
|
|
|
22
22
|
* auditor handoff should use the standard one-file convention
|
|
23
23
|
* (`${pack_id}.json`).
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* Signed records are a controls feature: every call here throws
|
|
26
|
+
* `ControlsRequiredError` (402 `CONTROLS_REQUIRED`) without controls,
|
|
27
|
+
* and a self-managed install also needs its licence to export
|
|
28
|
+
* (`LICENCE_REQUIRED`). Incident scope and malformed period refs get a
|
|
29
|
+
* `StackError` with `status` 400.
|
|
28
30
|
*/
|
|
29
31
|
async export(input) {
|
|
30
32
|
return this.client.post('/v1/evidence-packs', input);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evidence-packs.js","sourceRoot":"","sources":["../../src/services/evidence-packs.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"evidence-packs.js","sourceRoot":"","sources":["../../src/services/evidence-packs.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,EAAE;AACF,wCAAwC;AACxC,EAAE;AACF,wCAAwC;AACxC,iDAAiD;AACjD,0DAA0D;AAC1D,kDAAkD;AAClD,EAAE;AACF,oEAAoE;AACpE,qEAAqE;AACrE,iEAAiE;AACjE,kBAAkB;AA6GlB,MAAM,OAAO,oBAAoB;IACX;IAApB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,MAAM,CAAC,KAAsB;QACjC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAmB,oBAAoB,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,GAAG,CAAC,MAAc;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CACpB,sBAAsB,kBAAkB,CAAC,MAAM,CAAC,EAAE,CACnD,CAAC;IACJ,CAAC;IAED,0EAA0E;IAC1E,KAAK,CAAC,QAAQ,CAAC,MAAc;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CACzB,sBAAsB,kBAAkB,CAAC,MAAM,CAAC,WAAW,CAC5D,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,IAAI,CAAC,QAAwB,EAAE;QACnC,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QACrC,IAAI,KAAK,CAAC,KAAK;YAAE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CACpB,qBAAqB,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAClD,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
/** What the customer's controls do with flagged content of one severity: keep it from the agent, or hand it over with its flag. */
|
|
3
|
+
export type FlaggedContentHandling = 'withhold' | 'deliver';
|
|
4
|
+
export interface FlaggedContentSettings {
|
|
5
|
+
/** Content the detectors flag with a warning. */
|
|
6
|
+
warning: FlaggedContentHandling;
|
|
7
|
+
/** Content the detectors flag as critical. */
|
|
8
|
+
critical: FlaggedContentHandling;
|
|
9
|
+
/** Whether the setting applies now: it does only while the account has controls. */
|
|
10
|
+
controls: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface SetFlaggedContentSettingsInput {
|
|
13
|
+
warning?: FlaggedContentHandling;
|
|
14
|
+
critical?: FlaggedContentHandling;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* What the customer's controls do with content the detectors flag in what reaches its agents (mail, texts, voicemail,
|
|
18
|
+
* page text, tool output, drive files, memory writes), separately for a warning and a critical verdict: `withhold`
|
|
19
|
+
* (the default for both) or `deliver` with its flag. With controls off flagged content is always delivered with its
|
|
20
|
+
* flag. Owner or admin only; an agent is refused. A change applies at once, with no approval, and is recorded.
|
|
21
|
+
*/
|
|
22
|
+
export declare class FlaggedContentService {
|
|
23
|
+
private readonly client;
|
|
24
|
+
constructor(client: HttpClient);
|
|
25
|
+
/** The setting in force, and whether controls are on. */
|
|
26
|
+
get(): Promise<FlaggedContentSettings>;
|
|
27
|
+
/** Change one severity or both; a severity left out keeps its value. Refused client-side when neither is named. */
|
|
28
|
+
set(input: SetFlaggedContentSettingsInput): Promise<FlaggedContentSettings>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=flagged-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagged-content.d.ts","sourceRoot":"","sources":["../../src/services/flagged-content.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,mIAAmI;AACnI,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,SAAS,CAAC;AAE5D,MAAM,WAAW,sBAAsB;IACrC,iDAAiD;IACjD,OAAO,EAAE,sBAAsB,CAAC;IAChC,8CAA8C;IAC9C,QAAQ,EAAE,sBAAsB,CAAC;IACjC,oFAAoF;IACpF,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,QAAQ,CAAC,EAAE,sBAAsB,CAAC;CACnC;AAED;;;;;GAKG;AACH,qBAAa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAE/C,yDAAyD;IACnD,GAAG,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAI5C,mHAAmH;IAC7G,GAAG,CAAC,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAMlF"}
|