@dennisonbertram/agent-drive 0.0.0-stage → 0.1.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 +21 -0
- package/README.md +10 -2
- package/dist/SKILL.md +118 -0
- package/dist/backup-targets.d.ts +24 -0
- package/dist/backup-targets.js +104 -0
- package/dist/backup-targets.js.map +1 -0
- package/dist/backup.d.ts +16 -0
- package/dist/backup.js +151 -0
- package/dist/backup.js.map +1 -0
- package/dist/capture-codex.d.ts +5 -0
- package/dist/capture-codex.js +40 -0
- package/dist/capture-codex.js.map +1 -0
- package/dist/capture-spool.d.ts +58 -0
- package/dist/capture-spool.js +299 -0
- package/dist/capture-spool.js.map +1 -0
- package/dist/capture.d.ts +66 -0
- package/dist/capture.js +536 -0
- package/dist/capture.js.map +1 -0
- package/dist/check.d.ts +17 -0
- package/dist/check.js +119 -0
- package/dist/check.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +584 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +259 -0
- package/dist/client.js +456 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +41 -0
- package/dist/config.js +220 -0
- package/dist/config.js.map +1 -0
- package/dist/credentials.d.ts +108 -0
- package/dist/credentials.js +336 -0
- package/dist/credentials.js.map +1 -0
- package/dist/crypto-format.d.ts +8 -0
- package/dist/crypto-format.js +96 -0
- package/dist/crypto-format.js.map +1 -0
- package/dist/crypto.d.ts +20 -0
- package/dist/crypto.js +124 -0
- package/dist/crypto.js.map +1 -0
- package/dist/device.d.ts +33 -0
- package/dist/device.js +229 -0
- package/dist/device.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp.d.ts +7 -0
- package/dist/mcp.js +348 -0
- package/dist/mcp.js.map +1 -0
- package/dist/safe-write.d.ts +9 -0
- package/dist/safe-write.js +34 -0
- package/dist/safe-write.js.map +1 -0
- package/dist/seal.d.ts +12 -0
- package/dist/seal.js +49 -0
- package/dist/seal.js.map +1 -0
- package/dist/skill.d.ts +4 -0
- package/dist/skill.js +42 -0
- package/dist/skill.js.map +1 -0
- package/dist/sync.d.ts +13 -0
- package/dist/sync.js +301 -0
- package/dist/sync.js.map +1 -0
- package/dist/trace-inbox.d.ts +26 -0
- package/dist/trace-inbox.js +126 -0
- package/dist/trace-inbox.js.map +1 -0
- package/dist/trace-path.d.ts +10 -0
- package/dist/trace-path.js +18 -0
- package/dist/trace-path.js.map +1 -0
- package/package.json +61 -4
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import type { TraceInboxRecord } from './trace-inbox.js';
|
|
2
|
+
import type { SealedDriveKey } from './seal.js';
|
|
3
|
+
export type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
4
|
+
export type Page<T> = {
|
|
5
|
+
items: T[];
|
|
6
|
+
nextCursor: string | null;
|
|
7
|
+
};
|
|
8
|
+
export type ClientOptions = {
|
|
9
|
+
apiUrl: string;
|
|
10
|
+
apiKey: string;
|
|
11
|
+
machine?: string;
|
|
12
|
+
driveKey?: string | ((driveId: string) => string | undefined);
|
|
13
|
+
fetch?: FetchLike;
|
|
14
|
+
};
|
|
15
|
+
export type PutOptions = {
|
|
16
|
+
tags?: string[];
|
|
17
|
+
description?: string;
|
|
18
|
+
userId?: string;
|
|
19
|
+
mode?: 'create' | 'overwrite';
|
|
20
|
+
ifVersionId?: string;
|
|
21
|
+
/** Aborts an in-flight upload (used by capture shutdown). */
|
|
22
|
+
signal?: AbortSignal;
|
|
23
|
+
};
|
|
24
|
+
export type GetOptions = {
|
|
25
|
+
versionId?: string;
|
|
26
|
+
};
|
|
27
|
+
export type Version = {
|
|
28
|
+
id: string;
|
|
29
|
+
path: string;
|
|
30
|
+
ciphertextSize: number;
|
|
31
|
+
wrappedKey: string;
|
|
32
|
+
agentId: string;
|
|
33
|
+
machineId: string | null;
|
|
34
|
+
userId: string | null;
|
|
35
|
+
tags: string[];
|
|
36
|
+
description: string | null;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
};
|
|
39
|
+
export type FileEntry = {
|
|
40
|
+
fileId: string;
|
|
41
|
+
versionId: string;
|
|
42
|
+
path: string;
|
|
43
|
+
ciphertextSize: number;
|
|
44
|
+
agentId: string;
|
|
45
|
+
machineId: string | null;
|
|
46
|
+
userId: string | null;
|
|
47
|
+
tags: string[];
|
|
48
|
+
description: string | null;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
};
|
|
51
|
+
export type FolderEntry = {
|
|
52
|
+
kind: 'folder';
|
|
53
|
+
path: string;
|
|
54
|
+
items: number;
|
|
55
|
+
ciphertextSize: number;
|
|
56
|
+
createdAt: string;
|
|
57
|
+
};
|
|
58
|
+
export type Drive = {
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
quota_bytes: number;
|
|
62
|
+
created_at: string;
|
|
63
|
+
created?: boolean;
|
|
64
|
+
};
|
|
65
|
+
export type Agent = {
|
|
66
|
+
id: string;
|
|
67
|
+
name: string;
|
|
68
|
+
created_at: string;
|
|
69
|
+
};
|
|
70
|
+
export type ApiKey = {
|
|
71
|
+
id: string;
|
|
72
|
+
agent_id: string;
|
|
73
|
+
label: string;
|
|
74
|
+
drive_ids: string[];
|
|
75
|
+
scopes: string[];
|
|
76
|
+
write_paths?: string[];
|
|
77
|
+
issued_by_agent_id?: string | null;
|
|
78
|
+
revoked_at?: string | null;
|
|
79
|
+
created_at: string;
|
|
80
|
+
token?: string;
|
|
81
|
+
};
|
|
82
|
+
export type Whoami = {
|
|
83
|
+
accountId: string;
|
|
84
|
+
agentId: string;
|
|
85
|
+
keyId: string;
|
|
86
|
+
scopes: string[];
|
|
87
|
+
writePaths?: string[];
|
|
88
|
+
driveIds: string[] | null;
|
|
89
|
+
};
|
|
90
|
+
export type DeviceRequestFacts = {
|
|
91
|
+
user_code: string;
|
|
92
|
+
client_name: string;
|
|
93
|
+
machine: string | null;
|
|
94
|
+
created_at: string;
|
|
95
|
+
expires_at: string;
|
|
96
|
+
public_key: string;
|
|
97
|
+
};
|
|
98
|
+
export type RecentEvent = {
|
|
99
|
+
id: string;
|
|
100
|
+
operation: 'put' | 'copy' | 'restore' | 'move' | 'delete';
|
|
101
|
+
path: string;
|
|
102
|
+
previousPath: string | null;
|
|
103
|
+
versionId: string | null;
|
|
104
|
+
agentId: string;
|
|
105
|
+
agentName: string | null;
|
|
106
|
+
machineId: string | null;
|
|
107
|
+
userId: string | null;
|
|
108
|
+
createdAt: string;
|
|
109
|
+
};
|
|
110
|
+
export type RecentPage = Page<RecentEvent> & {
|
|
111
|
+
latestCursor: string | null;
|
|
112
|
+
};
|
|
113
|
+
export type Share = {
|
|
114
|
+
id: string;
|
|
115
|
+
path: string;
|
|
116
|
+
versionId: string;
|
|
117
|
+
expiresAt: string;
|
|
118
|
+
revokedAt: string | null;
|
|
119
|
+
createdAt: string;
|
|
120
|
+
status?: 'active' | 'expired' | 'revoked' | 'unavailable';
|
|
121
|
+
url?: string;
|
|
122
|
+
};
|
|
123
|
+
export type ConflictState = 'exists' | 'changed' | 'trashed' | 'absent';
|
|
124
|
+
export declare class AgentDriveApiError extends Error {
|
|
125
|
+
readonly code: string;
|
|
126
|
+
readonly status: number;
|
|
127
|
+
readonly upgradeUrl: string | undefined;
|
|
128
|
+
readonly retryAfter: number | undefined;
|
|
129
|
+
readonly currentVersionId: string | null | undefined;
|
|
130
|
+
readonly state: ConflictState | undefined;
|
|
131
|
+
constructor(code: string, status: number, message: string, details?: {
|
|
132
|
+
upgradeUrl?: string | undefined;
|
|
133
|
+
retryAfter?: number | undefined;
|
|
134
|
+
currentVersionId?: string | null | undefined;
|
|
135
|
+
state?: ConflictState | undefined;
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
export declare function validateUrl(value: string, api: boolean): URL;
|
|
139
|
+
export declare class AgentDriveClient {
|
|
140
|
+
private readonly options;
|
|
141
|
+
private readonly baseUrl;
|
|
142
|
+
private readonly fetcher;
|
|
143
|
+
constructor(options: ClientOptions);
|
|
144
|
+
get apiOrigin(): string;
|
|
145
|
+
private request;
|
|
146
|
+
private storage;
|
|
147
|
+
private readonly inboxes;
|
|
148
|
+
/** The drive's trace inbox record, or null. Only a found record is cached (an inbox may be created later). */
|
|
149
|
+
traceInbox(driveId: string): Promise<TraceInboxRecord | null>;
|
|
150
|
+
/** For a v2 envelope: the inbox record bound to the requested drive. v1 never calls the server. */
|
|
151
|
+
private inboxFor;
|
|
152
|
+
private keyFor;
|
|
153
|
+
whoami(): Promise<Whoami>;
|
|
154
|
+
createAgent(name: string): Promise<Agent>;
|
|
155
|
+
createDrive(name: string, quotaBytes?: number): Promise<Drive>;
|
|
156
|
+
createKey(agentId: string | undefined, label: string, driveIds: string[], scopes: string[], writePaths?: string[], agentName?: string): Promise<ApiKey>;
|
|
157
|
+
deviceRequest(code: string): Promise<DeviceRequestFacts>;
|
|
158
|
+
grantDevice(code: string, body: {
|
|
159
|
+
driveId: string;
|
|
160
|
+
scopes: string[];
|
|
161
|
+
writePaths: string[];
|
|
162
|
+
sealedDriveKey: SealedDriveKey;
|
|
163
|
+
}): Promise<{
|
|
164
|
+
status: "offered";
|
|
165
|
+
revision: number;
|
|
166
|
+
}>;
|
|
167
|
+
revokeKey(keyId: string): Promise<{
|
|
168
|
+
id: string;
|
|
169
|
+
revoked_at: string;
|
|
170
|
+
}>;
|
|
171
|
+
listAgents(limit?: number, cursor?: string): Promise<Page<Agent>>;
|
|
172
|
+
listDrives(limit?: number, cursor?: string): Promise<Page<Drive>>;
|
|
173
|
+
listKeys(limit?: number, cursor?: string): Promise<Page<ApiKey>>;
|
|
174
|
+
browse(driveId: string, options: {
|
|
175
|
+
folder?: string;
|
|
176
|
+
prefix?: string;
|
|
177
|
+
sort?: 'path' | 'modified';
|
|
178
|
+
limit?: number;
|
|
179
|
+
cursor?: string;
|
|
180
|
+
filters?: {
|
|
181
|
+
tag?: string;
|
|
182
|
+
agentId?: string;
|
|
183
|
+
machine?: string;
|
|
184
|
+
user?: string;
|
|
185
|
+
};
|
|
186
|
+
}): Promise<Page<FileEntry | FolderEntry>>;
|
|
187
|
+
list(driveId: string, prefix?: string, limit?: number, cursor?: string, filters?: {
|
|
188
|
+
tag?: string;
|
|
189
|
+
agentId?: string;
|
|
190
|
+
machine?: string;
|
|
191
|
+
user?: string;
|
|
192
|
+
}): Promise<Page<FileEntry>>;
|
|
193
|
+
versions(driveId: string, path: string, limit?: number, cursor?: string): Promise<Page<Version>>;
|
|
194
|
+
recent(driveId: string, since?: string, limit?: number, cursor?: string, signal?: AbortSignal): Promise<RecentPage>;
|
|
195
|
+
/**
|
|
196
|
+
* Polls `recent` until an event appears or `waitMs` passes. Returns within `waitMs` plus the
|
|
197
|
+
* abort latency of one in-flight request; a stalled server cannot hold it longer. Each poll is
|
|
198
|
+
* one metered `drive.recent` operation.
|
|
199
|
+
*/
|
|
200
|
+
waitForRecent(driveId: string, options: {
|
|
201
|
+
since?: string;
|
|
202
|
+
cursor?: string;
|
|
203
|
+
limit?: number;
|
|
204
|
+
waitMs: number;
|
|
205
|
+
signal?: AbortSignal;
|
|
206
|
+
}, sleep?: (ms: number) => Promise<void>): Promise<RecentPage>;
|
|
207
|
+
search(driveId: string, query?: {
|
|
208
|
+
q?: string;
|
|
209
|
+
tag?: string;
|
|
210
|
+
agentId?: string;
|
|
211
|
+
machine?: string;
|
|
212
|
+
user?: string;
|
|
213
|
+
}, limit?: number, cursor?: string): Promise<Page<Version>>;
|
|
214
|
+
createShare(driveId: string, path: string, options?: {
|
|
215
|
+
versionId?: string;
|
|
216
|
+
expiresAt?: string;
|
|
217
|
+
}): Promise<{
|
|
218
|
+
id: string;
|
|
219
|
+
path: string;
|
|
220
|
+
versionId: string;
|
|
221
|
+
expiresAt: string;
|
|
222
|
+
url: string;
|
|
223
|
+
}>;
|
|
224
|
+
listShares(driveId: string, limit?: number, cursor?: string): Promise<Page<Share>>;
|
|
225
|
+
revokeShare(driveId: string, shareId: string): Promise<{
|
|
226
|
+
id: string;
|
|
227
|
+
revokedAt: string;
|
|
228
|
+
}>;
|
|
229
|
+
put(driveId: string, path: string, plaintext: Uint8Array, options?: PutOptions): Promise<Version>;
|
|
230
|
+
/** Uploads bytes that were already encrypted with `encryptFile`. */
|
|
231
|
+
putEncrypted(driveId: string, path: string, ciphertext: Uint8Array<ArrayBuffer>, wrappedKey: string, options?: PutOptions): Promise<Version>;
|
|
232
|
+
get(driveId: string, path: string, options?: GetOptions): Promise<{
|
|
233
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
234
|
+
version: Version & {
|
|
235
|
+
downloadUrl: string;
|
|
236
|
+
};
|
|
237
|
+
}>;
|
|
238
|
+
move(driveId: string, path: string, destinationPath: string, userId?: string): Promise<{
|
|
239
|
+
id: string;
|
|
240
|
+
path: string;
|
|
241
|
+
}>;
|
|
242
|
+
copy(driveId: string, path: string, destinationPath: string, options?: {
|
|
243
|
+
versionId?: string;
|
|
244
|
+
userId?: string;
|
|
245
|
+
}): Promise<{
|
|
246
|
+
version: Version;
|
|
247
|
+
}>;
|
|
248
|
+
delete(driveId: string, path: string, userId?: string): Promise<{
|
|
249
|
+
id: string;
|
|
250
|
+
path: string;
|
|
251
|
+
deleted_at: string;
|
|
252
|
+
}>;
|
|
253
|
+
restore(driveId: string, path: string, versionId?: string, userId?: string): Promise<{
|
|
254
|
+
version: Version;
|
|
255
|
+
}>;
|
|
256
|
+
private pagePath;
|
|
257
|
+
}
|
|
258
|
+
/** Drops the presigned download URL and the wrapped file key from anything an agent is shown. */
|
|
259
|
+
export declare function publicOutput<T>(value: T): T;
|