agentic-drive 0.10.1 → 0.10.2
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/CHANGELOG.md +4 -0
- package/README.md +100 -1
- package/dist/{chunk-XXFLENYI.js → chunk-WOA2S56W.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp.js +1 -1
- package/llms.txt +110 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
Store, sort, and share files and folders.
|
|
9
9
|
|
|
10
|
-
> Status: 0.10.
|
|
10
|
+
> Status: 0.10.2, early. The library, CLI, MCP server, and HTTP API work, with sharing in the SDK, the HTTP API, the CLI, and the MCP server.
|
|
11
11
|
> A small web UI works. See [UI](#ui).
|
|
12
12
|
|
|
13
13
|
## Live demo
|
|
@@ -163,6 +163,105 @@ The root export, `agentic-drive`, also exports these names. The package typings
|
|
|
163
163
|
The local functions trust their caller. Local data is the trust boundary: anyone who can write the folder
|
|
164
164
|
can act as any principal in it.
|
|
165
165
|
|
|
166
|
+
## Public exports
|
|
167
|
+
|
|
168
|
+
Each import path below is part of the package. The examples use TypeScript.
|
|
169
|
+
The CLI and MCP are commands, not import paths. The package does not export
|
|
170
|
+
`agentic-drive/cli`, `agentic-drive/mcp`, or an adapters subpath.
|
|
171
|
+
|
|
172
|
+
### Root: `agentic-drive`
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
import { ROOT_ID, parseName, type SearchQuery } from "agentic-drive";
|
|
176
|
+
const name = parseName("report.txt");
|
|
177
|
+
const query: SearchQuery = { name: name.name };
|
|
178
|
+
console.log(ROOT_ID, query);
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
The root values are `VERSION` (version), `ROOT_ID` (root id), `ACTOR_KINDS`
|
|
182
|
+
(principal kinds), `createDrive` (drive factory), `DriveError` and `ERROR_STATUS`
|
|
183
|
+
(errors and HTTP statuses), `parseName`, `parseSubject`, `subjectKindOf` (input
|
|
184
|
+
checks), `upload`, `sniffMime`, `DEFAULT_MAX_BYTES` (upload helpers), `buildExport`
|
|
185
|
+
(account ZIP), `readZip` and `writeZip` (stored ZIP entries), `importLegacyLocal`
|
|
186
|
+
(old local data), `AuthError`, `openLocal`, `addPrincipal`, `issueKey`,
|
|
187
|
+
`resolveToken`, `revokeKey`, `revokePrincipal`, `publicNode` (local access),
|
|
188
|
+
`backfillAuthorIds` and `backfillResources` (migrations), and `driveAccount`
|
|
189
|
+
(account plug-in). See Other exports and Features for behavior and limits.
|
|
190
|
+
|
|
191
|
+
Root types: `ActivityAction`, `ActivityEntry`, `Action`, `Actor`, `ActorKind`,
|
|
192
|
+
`Can`, `Ctx`, `Drive`, `DriveDeps`, `ErrorCode`, `Node`, `OnConflict`,
|
|
193
|
+
`UploadOptions`, `SearchQuery`, `BackfillOptions`, `BackfillResult`,
|
|
194
|
+
`DriveAccount`, and `DriveAccountDeps`. They describe activity, callers, drive
|
|
195
|
+
operations, uploads, migrations, and account operations.
|
|
196
|
+
|
|
197
|
+
### Client: `agentic-drive/client`
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
import { createClient, type ClientOptions } from "agentic-drive/client";
|
|
201
|
+
const options: ClientOptions = { baseUrl: "https://drive.example.com", token: "your-token" };
|
|
202
|
+
const client = createClient(options);
|
|
203
|
+
await client.list("/");
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
`createClient` makes the HTTP client; `DriveApiError` reports failures. Types:
|
|
207
|
+
`ActivityAction`, `ActivityEntry`, `ErrorCode`, `Node`, `Role`, `OnConflict`,
|
|
208
|
+
`SubjectKind`, `Subject`, `Item`, `PathItem`, `ApiErrorCode`, `ClientErrorCode`,
|
|
209
|
+
`ClientOptions`, `CallOptions`, `UploadBody`, `Downloaded`, and `DriveClient`.
|
|
210
|
+
These describe API data, options, errors, and results.
|
|
211
|
+
|
|
212
|
+
### Account: `agentic-drive/account`
|
|
213
|
+
|
|
214
|
+
```ts
|
|
215
|
+
import { driveAccount, type DriveAccountDeps } from "agentic-drive/account";
|
|
216
|
+
// Use the subject's own drive and context.
|
|
217
|
+
async function exportMine(deps: DriveAccountDeps) {
|
|
218
|
+
return driveAccount.exportAccount({ id: "u1", kind: "human" }, deps);
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
`driveAccount` exports and erases an account. `DriveAccount` describes the plug-in;
|
|
223
|
+
`DriveAccountDeps` describes its drive and caller context.
|
|
224
|
+
|
|
225
|
+
### Worker: `agentic-drive/worker`
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
import { createApp, type WorkerEnv } from "agentic-drive/worker";
|
|
229
|
+
const app = createApp<WorkerEnv>();
|
|
230
|
+
export default { fetch: app.fetch };
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
The `default` export is the ready Worker. `createApp` makes an app with optional
|
|
234
|
+
injected ports. `authenticate` resolves a bearer token. `ERROR_STATUS` maps drive
|
|
235
|
+
errors to HTTP statuses. `backfillAuthorIds` and `backfillResources` migrate old
|
|
236
|
+
stores. Types: `ErrorCode`, `Node`, `BackfillOptions`, `BackfillResult`, `WorkerEnv`,
|
|
237
|
+
and `AppOptions` describe errors, items, migrations, bindings, and injected ports.
|
|
238
|
+
|
|
239
|
+
### UI: `agentic-drive/ui` and `agentic-drive/ui.css`
|
|
240
|
+
|
|
241
|
+
```ts
|
|
242
|
+
import "agentic-design/styles.css";
|
|
243
|
+
import "agentic-drive/ui.css";
|
|
244
|
+
import { mount, type DriveUiOptions } from "agentic-drive/ui";
|
|
245
|
+
const options: DriveUiOptions = { baseUrl: "https://drive.example.com", getToken: () => "your-token" };
|
|
246
|
+
const view = mount(document.getElementById("drive")!, options);
|
|
247
|
+
view.unmount();
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
`mount` returns a `MountedDrive` handle. `DriveBrowser` is the React component;
|
|
251
|
+
`DriveUiOptions` is its configuration. The CSS path supplies its styles.
|
|
252
|
+
|
|
253
|
+
### CLI, MCP, and adapters
|
|
254
|
+
|
|
255
|
+
```sh
|
|
256
|
+
npx agentic-drive ls /
|
|
257
|
+
npx agentic-drive mcp
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
The CLI uses `AGENTIC_DRIVE_TOKEN`. The MCP command serves tools over stdio;
|
|
261
|
+
call `drive_ls` with a path. Storage adapters are provided by `agentic-identity`,
|
|
262
|
+
not by a drive subpath. The Quick start shows `createFileStore` and
|
|
263
|
+
`createFileBlobs`; the Worker uses D1 and R2 adapters by default.
|
|
264
|
+
|
|
166
265
|
## Account export and erase
|
|
167
266
|
|
|
168
267
|
A host that runs account export and erase across many packages calls `driveAccount` (from `agentic-drive/account`). It has `exportAccount(subject, { drive, ctx })` and `eraseAccount(subject, { drive, ctx })`, so the host does not read the storage layout. `subject` is an id and a kind (`human`, or `agent` with its own identity), and `ctx` is the drive context of that subject. A context for someone else throws `FORBIDDEN`. A bad subject, or a missing `drive` or `ctx`, throws a `TypeError`.
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
package/dist/mcp.js
CHANGED
package/llms.txt
CHANGED
|
@@ -4,13 +4,7 @@ Store, sort, and share files and folders.
|
|
|
4
4
|
|
|
5
5
|
Keywords: drive,files,folders,storage,upload,sharing,agents,mcp,cli,r2.
|
|
6
6
|
|
|
7
|
-
- SDK: import { createDrive } from "agentic-drive".
|
|
8
|
-
- Other SDK exports: VERSION, ROOT_ID, ACTOR_KINDS, DEFAULT_MAX_BYTES, sniffMime, parseName, parseSubject, subjectKindOf, DriveError,
|
|
9
|
-
readZip, writeZip, AuthError, openLocal, addPrincipal, issueKey, resolveToken, revokeKey, revokePrincipal, publicNode.
|
|
10
|
-
See README, "Other exports".
|
|
11
|
-
- Remote SDK: import { createClient } from "agentic-drive/client". createClient({ baseUrl, token, fetch?, retries? }) has one method for each bearer route and each shared route (list, stat, mkdir, upload, download, move, trash, restore, purge, search, share, createLink, and more). A failed call throws DriveApiError with code and status. It runs in browsers, Workers, and Node 22.
|
|
12
|
-
- Worker: import { createApp } from "agentic-drive/worker". createApp({ store?, blobs?, auth? }) takes an injected Store, Blobs, and auth callback `(request, store, env) => Ctx | null`. Each may be a value or a function of the env. With no options, it uses D1, R2, and bearer tokens from the store. See README, "Inject a store, blobs, and sign-in".
|
|
13
|
-
- UI: import { mount } from "agentic-drive/ui"; import "agentic-drive/ui.css" (with agentic-design/styles.css). mount(element, { baseUrl, getToken }) renders the drive (files, trash, upload, share) and returns { update(options), unmount() }. getToken is called before each request and returns a token or undefined. It does not touch the page address or theme. DriveBrowser is the same as a React component. React 19 is an optional peer dependency.
|
|
7
|
+
- SDK: import { createDrive } from "agentic-drive". See the root example below.
|
|
14
8
|
- CLI: agentic-drive ls /. Needs a principal: set AGENTIC_DRIVE_TOKEN (or --token) to an API key. Make one with `principal add <id> [--of <person>]` and `key issue <id>`. No key, or a revoked key, exits 3.
|
|
15
9
|
- MCP: run agentic-drive mcp, then call drive_ls.
|
|
16
10
|
|
|
@@ -18,3 +12,112 @@ Keywords: drive,files,folders,storage,upload,sharing,agents,mcp,cli,r2.
|
|
|
18
12
|
|
|
19
13
|
- README: https://github.com/pooriaarab/agentic-drive
|
|
20
14
|
- License: MIT
|
|
15
|
+
|
|
16
|
+
## Public exports and usage
|
|
17
|
+
|
|
18
|
+
Each import path below is part of the package. The examples use TypeScript.
|
|
19
|
+
The CLI and MCP are commands, not import paths. The package does not export
|
|
20
|
+
`agentic-drive/cli`, `agentic-drive/mcp`, or an adapters subpath.
|
|
21
|
+
|
|
22
|
+
### Root: `agentic-drive`
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { ROOT_ID, parseName, type SearchQuery } from "agentic-drive";
|
|
26
|
+
const name = parseName("report.txt");
|
|
27
|
+
const query: SearchQuery = { name: name.name };
|
|
28
|
+
console.log(ROOT_ID, query);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The root values are `VERSION` (version), `ROOT_ID` (root id), `ACTOR_KINDS`
|
|
32
|
+
(principal kinds), `createDrive` (drive factory), `DriveError` and `ERROR_STATUS`
|
|
33
|
+
(errors and HTTP statuses), `parseName`, `parseSubject`, `subjectKindOf` (input
|
|
34
|
+
checks), `upload`, `sniffMime`, `DEFAULT_MAX_BYTES` (upload helpers), `buildExport`
|
|
35
|
+
(account ZIP), `readZip` and `writeZip` (stored ZIP entries), `importLegacyLocal`
|
|
36
|
+
(old local data), `AuthError`, `openLocal`, `addPrincipal`, `issueKey`,
|
|
37
|
+
`resolveToken`, `revokeKey`, `revokePrincipal`, `publicNode` (local access),
|
|
38
|
+
`backfillAuthorIds` and `backfillResources` (migrations), and `driveAccount`
|
|
39
|
+
(account plug-in). See README for behavior and limits.
|
|
40
|
+
|
|
41
|
+
Root types: `ActivityAction`, `ActivityEntry`, `Action`, `Actor`, `ActorKind`,
|
|
42
|
+
`Can`, `Ctx`, `Drive`, `DriveDeps`, `ErrorCode`, `Node`, `OnConflict`,
|
|
43
|
+
`UploadOptions`, `SearchQuery`, `BackfillOptions`, `BackfillResult`,
|
|
44
|
+
`DriveAccount`, and `DriveAccountDeps`. They describe activity, callers, drive
|
|
45
|
+
operations, uploads, migrations, and account operations.
|
|
46
|
+
|
|
47
|
+
### Client: `agentic-drive/client`
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { createClient, type ClientOptions } from "agentic-drive/client";
|
|
51
|
+
const options: ClientOptions = { baseUrl: "https://drive.example.com", token: "your-token" };
|
|
52
|
+
const client = createClient(options);
|
|
53
|
+
await client.list("/");
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`createClient` makes the HTTP client; `DriveApiError` reports failures. Types:
|
|
57
|
+
`ActivityAction`, `ActivityEntry`, `ErrorCode`, `Node`, `Role`, `OnConflict`,
|
|
58
|
+
`SubjectKind`, `Subject`, `Item`, `PathItem`, `ApiErrorCode`, `ClientErrorCode`,
|
|
59
|
+
`ClientOptions`, `CallOptions`, `UploadBody`, `Downloaded`, and `DriveClient`.
|
|
60
|
+
These describe API data, options, errors, and results. The client runs in browsers,
|
|
61
|
+
Workers, and Node 22. It has a method for each bearer and shared route.
|
|
62
|
+
`DriveApiError` carries `code` and `status`. Client options also accept
|
|
63
|
+
a `fetch` function and a `retries` count for reads.
|
|
64
|
+
|
|
65
|
+
### Account: `agentic-drive/account`
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import { driveAccount, type DriveAccountDeps } from "agentic-drive/account";
|
|
69
|
+
// Use the subject's own drive and context.
|
|
70
|
+
async function exportMine(deps: DriveAccountDeps) {
|
|
71
|
+
return driveAccount.exportAccount({ id: "u1", kind: "human" }, deps);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`driveAccount` exports and erases an account. `DriveAccount` describes the plug-in;
|
|
76
|
+
`DriveAccountDeps` describes its drive and caller context.
|
|
77
|
+
|
|
78
|
+
### Worker: `agentic-drive/worker`
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
import { createApp, type WorkerEnv } from "agentic-drive/worker";
|
|
82
|
+
const app = createApp<WorkerEnv>();
|
|
83
|
+
export default { fetch: app.fetch };
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The `default` export is the ready Worker. `createApp` makes an app with optional
|
|
87
|
+
injected ports. `authenticate` resolves a bearer token. `ERROR_STATUS` maps drive
|
|
88
|
+
errors to HTTP statuses. `backfillAuthorIds` and `backfillResources` migrate old
|
|
89
|
+
stores. Types: `ErrorCode`, `Node`, `BackfillOptions`, `BackfillResult`, `WorkerEnv`,
|
|
90
|
+
and `AppOptions` describe errors, items, migrations, bindings, and injected ports.
|
|
91
|
+
The `store`, `blobs`, and `auth` options each accept a value or a function of
|
|
92
|
+
the env. The auth callback has the signature `(request, store, env) => Ctx | null`
|
|
93
|
+
or returns a Promise of that result. With no options, the Worker uses bearer
|
|
94
|
+
tokens from the store.
|
|
95
|
+
|
|
96
|
+
### UI: `agentic-drive/ui` and `agentic-drive/ui.css`
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
import "agentic-design/styles.css";
|
|
100
|
+
import "agentic-drive/ui.css";
|
|
101
|
+
import { mount, type DriveUiOptions } from "agentic-drive/ui";
|
|
102
|
+
const options: DriveUiOptions = { baseUrl: "https://drive.example.com", getToken: () => "your-token" };
|
|
103
|
+
const view = mount(document.getElementById("drive")!, options);
|
|
104
|
+
view.unmount();
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
`mount` returns a `MountedDrive` handle. `DriveBrowser` is the React component;
|
|
108
|
+
`DriveUiOptions` is its configuration. The CSS path supplies its styles. The handle
|
|
109
|
+
has `update` and `unmount` methods. The `getToken` callback runs before each request
|
|
110
|
+
and may return undefined. The UI does not change the page address or theme.
|
|
111
|
+
React 19 and React DOM 19 are optional peer dependencies.
|
|
112
|
+
|
|
113
|
+
### CLI, MCP, and adapters
|
|
114
|
+
|
|
115
|
+
```sh
|
|
116
|
+
npx agentic-drive ls /
|
|
117
|
+
npx agentic-drive mcp
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The CLI uses `AGENTIC_DRIVE_TOKEN`. The MCP command serves tools over stdio;
|
|
121
|
+
call `drive_ls` with a path. Storage adapters are provided by `agentic-identity`,
|
|
122
|
+
not by a drive subpath. For example: `import { createFileStore, createFileBlobs } from "agentic-identity/file"`;
|
|
123
|
+
pass `createFileStore({ path: "./data/db" })` and `createFileBlobs({ dir: "./data/blobs" })` to `createDrive`. The Worker uses D1 and R2 adapters by default.
|