agentic-drive 0.2.0 → 0.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/CHANGELOG.md +64 -0
- package/README.md +124 -8
- package/SKILL.md +11 -0
- package/dist/{chunk-6CWBHSJ7.js → chunk-ATJDMCRV.js} +118 -35
- package/dist/{chunk-RWMBGIAS.js → chunk-DRACF66Y.js} +1 -1
- package/dist/{chunk-3LISWG7H.js → chunk-L7GASKBQ.js} +1 -1
- package/dist/cli.js +44 -14
- package/dist/client.d.ts +173 -0
- package/dist/client.js +240 -0
- package/dist/{drive-DKOs1FyM.d.ts → drive-Cn3mpuDW.d.ts} +16 -7
- package/dist/index.d.ts +26 -16
- package/dist/index.js +19 -3
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +2 -2
- package/dist/worker.d.ts +8 -7
- package/dist/worker.js +6 -10
- package/llms.txt +2 -1
- package/package.json +21 -4
- package/ui-dist/_headers +4 -0
- package/ui-dist/assets/index-e_cefh0u.js +49 -0
- package/ui-dist/assets/index-xUEd8lQS.css +1 -0
- package/ui-dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/ui-dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/ui-dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/ui-dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/ui-dist/index.html +14 -0
- package/ui-dist/theme-init.js +1 -0
package/dist/index.js
CHANGED
|
@@ -1,44 +1,60 @@
|
|
|
1
1
|
import {
|
|
2
2
|
VERSION
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DRACF66Y.js";
|
|
4
4
|
import {
|
|
5
5
|
backfillAuthorIds,
|
|
6
6
|
backfillResources
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-L7GASKBQ.js";
|
|
8
8
|
import {
|
|
9
9
|
ACTOR_KINDS,
|
|
10
|
+
AuthError,
|
|
10
11
|
DEFAULT_MAX_BYTES,
|
|
11
12
|
DriveError,
|
|
12
13
|
ROOT_ID,
|
|
14
|
+
addPrincipal,
|
|
13
15
|
buildExport,
|
|
14
16
|
createDrive,
|
|
15
17
|
createFileBlobs,
|
|
16
18
|
createFileStore,
|
|
19
|
+
issueKey,
|
|
17
20
|
openLocal,
|
|
18
21
|
parseName,
|
|
22
|
+
parseSubject,
|
|
19
23
|
publicNode,
|
|
20
24
|
readZip,
|
|
25
|
+
resolveToken,
|
|
26
|
+
revokeKey,
|
|
27
|
+
revokePrincipal,
|
|
21
28
|
sniffMime,
|
|
29
|
+
subjectKindOf,
|
|
22
30
|
upload,
|
|
23
31
|
writeZip
|
|
24
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-ATJDMCRV.js";
|
|
25
33
|
export {
|
|
26
34
|
ACTOR_KINDS,
|
|
35
|
+
AuthError,
|
|
27
36
|
DEFAULT_MAX_BYTES,
|
|
28
37
|
DriveError,
|
|
29
38
|
ROOT_ID,
|
|
30
39
|
VERSION,
|
|
40
|
+
addPrincipal,
|
|
31
41
|
backfillAuthorIds,
|
|
32
42
|
backfillResources,
|
|
33
43
|
buildExport,
|
|
34
44
|
createDrive,
|
|
35
45
|
createFileBlobs,
|
|
36
46
|
createFileStore,
|
|
47
|
+
issueKey,
|
|
37
48
|
openLocal,
|
|
38
49
|
parseName,
|
|
50
|
+
parseSubject,
|
|
39
51
|
publicNode,
|
|
40
52
|
readZip,
|
|
53
|
+
resolveToken,
|
|
54
|
+
revokeKey,
|
|
55
|
+
revokePrincipal,
|
|
41
56
|
sniffMime,
|
|
57
|
+
subjectKindOf,
|
|
42
58
|
upload,
|
|
43
59
|
writeZip
|
|
44
60
|
};
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import { D as Drive, C as Ctx } from './drive-
|
|
2
|
+
import { D as Drive, C as Ctx } from './drive-Cn3mpuDW.js';
|
|
3
3
|
import 'agentic-identity';
|
|
4
4
|
|
|
5
5
|
declare function createMcpServer(drive: Drive, ctx: Ctx, exportDir: string): McpServer;
|
package/dist/mcp.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
VERSION
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DRACF66Y.js";
|
|
4
4
|
import {
|
|
5
5
|
ACTOR_KINDS,
|
|
6
6
|
DriveError,
|
|
7
7
|
buildExport,
|
|
8
8
|
publicNode,
|
|
9
9
|
upload
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ATJDMCRV.js";
|
|
11
11
|
|
|
12
12
|
// src/mcp.ts
|
|
13
13
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
package/dist/worker.d.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
2
|
import { D1Like, R2Like } from 'agentic-identity/cloudflare';
|
|
3
3
|
import { Store } from 'agentic-identity';
|
|
4
|
-
import { C as Ctx, D as Drive } from './drive-
|
|
4
|
+
import { C as Ctx, D as Drive } from './drive-Cn3mpuDW.js';
|
|
5
5
|
export { B as BackfillOptions, a as BackfillResult, b as backfillAuthorIds, c as backfillResources } from './migrate-B79gRPMu.js';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* The caller behind a bearer token, resolved by the store-backed Auth of agentic-identity: the credential
|
|
9
|
+
* names a principal, and the whole delegation chain must be live. Only a bearer token counts. A session
|
|
10
|
+
* cookie is refused, because no check of the request origin stands behind it here. Any problem gives null.
|
|
11
|
+
*/
|
|
12
|
+
declare function authenticate(request: Request, store: Store, now?: () => number): Promise<Ctx | null>;
|
|
13
|
+
|
|
7
14
|
interface WorkerEnv {
|
|
8
15
|
DB: D1Like;
|
|
9
16
|
FILES: R2Like;
|
|
@@ -22,12 +29,6 @@ type App = {
|
|
|
22
29
|
ctx: Ctx;
|
|
23
30
|
};
|
|
24
31
|
};
|
|
25
|
-
/**
|
|
26
|
-
* The caller behind a bearer token, resolved by the store-backed Auth of agentic-identity: the credential
|
|
27
|
-
* names a principal, and the whole delegation chain must be live. Only a bearer token counts. A session
|
|
28
|
-
* cookie is refused, because no check of the request origin stands behind it here. Any problem gives null.
|
|
29
|
-
*/
|
|
30
|
-
declare function authenticate(request: Request, store: Store, now?: () => number): Promise<Ctx | null>;
|
|
31
32
|
declare function createApp(): Hono<App>;
|
|
32
33
|
declare const _default: {
|
|
33
34
|
fetch: (request: Request, env: WorkerEnv, ctx: unknown) => Response | Promise<Response>;
|
package/dist/worker.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
backfillAuthorIds,
|
|
3
3
|
backfillResources
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-L7GASKBQ.js";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_MAX_BYTES,
|
|
7
7
|
DEFAULT_URL_SECONDS,
|
|
8
8
|
DriveError,
|
|
9
|
+
authenticate,
|
|
9
10
|
buildExport,
|
|
10
11
|
createDrive,
|
|
11
12
|
publicNode,
|
|
12
13
|
safeMime,
|
|
13
14
|
upload
|
|
14
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ATJDMCRV.js";
|
|
15
16
|
|
|
16
17
|
// src/worker.ts
|
|
17
18
|
import { Hono } from "hono";
|
|
18
19
|
import { D1_SCHEMA, createD1Store, createR2Blobs, verifySignedBlobUrl } from "agentic-identity/cloudflare";
|
|
19
|
-
import { createSharing,
|
|
20
|
+
import { createSharing, parseRegion } from "agentic-identity";
|
|
20
21
|
var STATUS = {
|
|
21
22
|
CROSS_DRIVE: 409,
|
|
22
23
|
INVALID_SHARE: 400,
|
|
@@ -42,11 +43,6 @@ var STATUS = {
|
|
|
42
43
|
TOO_LARGE: 413
|
|
43
44
|
};
|
|
44
45
|
var fail = (code, message, status) => new Response(JSON.stringify({ error: { code, message } }), { status, headers: { "content-type": "application/json" } });
|
|
45
|
-
async function authenticate(request, store, now) {
|
|
46
|
-
if (!/^Bearer [A-Za-z0-9_-]{1,512}$/.test(request.headers.get("authorization") ?? "")) return null;
|
|
47
|
-
const principal = await createStoreAuth(store, now ? { now } : {}).authenticate(request);
|
|
48
|
-
return principal ? { owner: principal.chain[0].id, actor: { id: principal.principalId, kind: principal.kind }, principal } : null;
|
|
49
|
-
}
|
|
50
46
|
var schemas = /* @__PURE__ */ new WeakMap();
|
|
51
47
|
function settings(env) {
|
|
52
48
|
let publicUrl;
|
|
@@ -214,11 +210,11 @@ function createApp() {
|
|
|
214
210
|
api.get("/shares", async (c) => c.json(await c.var.drive.shares(c.var.ctx, need(q(c, "path"), "path"))));
|
|
215
211
|
api.post("/shares", async (c) => {
|
|
216
212
|
const b = await body(c);
|
|
217
|
-
await c.var.drive.shareWith(c.var.ctx, str(b.path, "path"), str(b.subjectId, "subjectId"), roleOf(b.role));
|
|
213
|
+
await c.var.drive.shareWith(c.var.ctx, str(b.path, "path"), { kind: b.subjectKind, id: str(b.subjectId, "subjectId") }, roleOf(b.role));
|
|
218
214
|
return c.json({ ok: true });
|
|
219
215
|
});
|
|
220
216
|
api.delete("/shares", async (c) => {
|
|
221
|
-
await c.var.drive.unshare(c.var.ctx, need(q(c, "path"), "path"), need(q(c, "subjectId"), "subjectId"));
|
|
217
|
+
await c.var.drive.unshare(c.var.ctx, need(q(c, "path"), "path"), { kind: q(c, "subjectKind"), id: need(q(c, "subjectId"), "subjectId") });
|
|
222
218
|
return c.json({ ok: true });
|
|
223
219
|
});
|
|
224
220
|
api.post("/invites", async (c) => {
|
package/llms.txt
CHANGED
|
@@ -5,7 +5,8 @@ Store, sort, and share files and folders.
|
|
|
5
5
|
Keywords: drive,files,folders,storage,upload,sharing,agents,mcp,cli,r2.
|
|
6
6
|
|
|
7
7
|
- SDK: import { createDrive } from "agentic-drive".
|
|
8
|
-
-
|
|
8
|
+
- 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.
|
|
9
|
+
- 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.
|
|
9
10
|
- MCP: run agentic-drive mcp, then call drive_ls.
|
|
10
11
|
|
|
11
12
|
## Docs
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-drive",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Store, sort, and share files and folders.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"drive",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"dist",
|
|
30
|
+
"ui-dist",
|
|
30
31
|
"README.md",
|
|
31
32
|
"CHANGELOG.md",
|
|
32
33
|
"LICENSE",
|
|
@@ -44,6 +45,10 @@
|
|
|
44
45
|
"types": "./dist/index.d.ts",
|
|
45
46
|
"import": "./dist/index.js"
|
|
46
47
|
},
|
|
48
|
+
"./client": {
|
|
49
|
+
"types": "./dist/client.d.ts",
|
|
50
|
+
"import": "./dist/client.js"
|
|
51
|
+
},
|
|
47
52
|
"./worker": {
|
|
48
53
|
"types": "./dist/worker.d.ts",
|
|
49
54
|
"import": "./dist/worker.js"
|
|
@@ -54,20 +59,32 @@
|
|
|
54
59
|
"typecheck": "tsc --noEmit",
|
|
55
60
|
"test": "vitest run",
|
|
56
61
|
"clean": "rm -rf dist",
|
|
57
|
-
"prepack": "npm run build --silent >&2",
|
|
58
|
-
"ci:local": "npm run build && npm run typecheck && npm test"
|
|
62
|
+
"prepack": "npm run build --silent >&2 && npm run build:ui --silent >&2",
|
|
63
|
+
"ci:local": "npm run build && npm run build:ui && npm run typecheck && npm test && npm run test:e2e",
|
|
64
|
+
"build:ui": "vite build",
|
|
65
|
+
"deploy:demo": "npm run build:ui && wrangler deploy -c wrangler.demo.jsonc",
|
|
66
|
+
"test:e2e": "playwright test"
|
|
59
67
|
},
|
|
60
68
|
"dependencies": {
|
|
61
69
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
62
|
-
"agentic-identity": "^0.
|
|
70
|
+
"agentic-identity": "^0.4.0",
|
|
63
71
|
"hono": "^4.13.14",
|
|
64
72
|
"zod": "^3.25.0"
|
|
65
73
|
},
|
|
66
74
|
"devDependencies": {
|
|
75
|
+
"@axe-core/playwright": "^4.14.0",
|
|
76
|
+
"@playwright/test": "^1.64.1",
|
|
67
77
|
"@types/node": "^22.0.0",
|
|
78
|
+
"@types/react": "^19.3.0",
|
|
79
|
+
"@types/react-dom": "^19.3.0",
|
|
80
|
+
"@vitejs/plugin-react": "^5.2.0",
|
|
81
|
+
"agentic-design": "^0.1.0",
|
|
68
82
|
"miniflare": "^4.20260730.0",
|
|
83
|
+
"react": "^19.3.1",
|
|
84
|
+
"react-dom": "^19.3.1",
|
|
69
85
|
"tsup": "^8.0.0",
|
|
70
86
|
"typescript": "^5.6.0",
|
|
87
|
+
"vite": "^7.3.7",
|
|
71
88
|
"vitest": "^3.0.0",
|
|
72
89
|
"wrangler": "^4.155.0"
|
|
73
90
|
},
|
package/ui-dist/_headers
ADDED