agentic-drive 0.6.0 → 0.6.1

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.1
4
+
5
+ ### Changed
6
+
7
+ - **Bearer tokens are checked by the agentic-identity HTTP helper.** The Worker and the local key check now call `requirePrincipal` from `agentic-identity/http` (agentic-identity 0.6). The package no longer has its own copy of the bearer-token check in `src/auth.ts` and `src/local.ts`. A request without an `authorization` header still gets no caller, so a session cookie does not sign in. A bad key still gives 401, and `resolveToken` still throws `AuthError` with the code `UNAUTHENTICATED`.
8
+ - **The dependency is agentic-identity 0.6.** The package now needs `agentic-identity` `^0.6.0`.
9
+
3
10
  ## 0.6.0
4
11
 
5
12
  ### Added
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  Store, sort, and share files and folders.
9
9
 
10
- > Status: 0.6.0, early. The library, CLI, MCP server, and HTTP API work, with sharing in the SDK and the HTTP API.
10
+ > Status: 0.6.1, early. The library, CLI, MCP server, and HTTP API work, with sharing in the SDK and the HTTP API.
11
11
  > A small web UI works. See [UI](#ui).
12
12
 
13
13
  ## Live demo
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ROOT_ID,
3
3
  rootResource
4
- } from "./chunk-WJZNXLTR.js";
4
+ } from "./chunk-EAKQK7ST.js";
5
5
 
6
6
  // src/migrate.ts
7
7
  var PAGE = 10;
@@ -1346,10 +1346,12 @@ async function buildExport(drive, ctx, now = Date.now) {
1346
1346
 
1347
1347
  // src/auth.ts
1348
1348
  import { createStoreAuth } from "agentic-identity";
1349
+ import { requirePrincipal } from "agentic-identity/http";
1349
1350
  async function authenticate(request, store, now) {
1350
- if (!/^Bearer [A-Za-z0-9_-]{1,512}$/.test(request.headers.get("authorization") ?? "")) return null;
1351
- const principal = await createStoreAuth(store, now ? { now } : {}).authenticate(request);
1352
- return principal ? { owner: principal.chain[0].id, actor: { id: principal.principalId, kind: principal.kind }, principal } : null;
1351
+ if (!request.headers.has("authorization")) return null;
1352
+ const principal = await requirePrincipal(request, createStoreAuth(store, now ? { now } : {}));
1353
+ if (principal instanceof Response) return null;
1354
+ return { owner: principal.chain[0].id, actor: { id: principal.principalId, kind: principal.kind }, principal };
1353
1355
  }
1354
1356
 
1355
1357
  // src/local.ts
@@ -1367,8 +1369,13 @@ var NO_TOKEN = "no principal: pass --token <key> or set AGENTIC_DRIVE_TOKEN to a
1367
1369
  var BAD_TOKEN = "the key is not valid: it is unknown, revoked, or expired, or its principal is revoked";
1368
1370
  async function resolveToken(store, token) {
1369
1371
  if (!token) throw new AuthError(NO_TOKEN);
1370
- if (!/^[A-Za-z0-9_-]{1,512}$/.test(token)) throw new AuthError(BAD_TOKEN);
1371
- const ctx = await authenticate(new Request("http://local", { headers: { authorization: `Bearer ${token}` } }), store);
1372
+ let request;
1373
+ try {
1374
+ request = new Request("http://local", { headers: { authorization: `Bearer ${token}` } });
1375
+ } catch {
1376
+ throw new AuthError(BAD_TOKEN);
1377
+ }
1378
+ const ctx = await authenticate(request, store);
1372
1379
  if (!ctx) throw new AuthError(BAD_TOKEN);
1373
1380
  return ctx;
1374
1381
  }
@@ -1,6 +1,6 @@
1
1
  // src/version.ts
2
2
  import { createRequire } from "module";
3
- var VERSION = true ? "0.6.0" : readPackageVersion();
3
+ var VERSION = true ? "0.6.1" : readPackageVersion();
4
4
 
5
5
  export {
6
6
  VERSION
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  VERSION
4
- } from "./chunk-ES3NZ7SX.js";
4
+ } from "./chunk-H6JK62SP.js";
5
5
  import {
6
6
  AuthError,
7
7
  DriveError,
@@ -15,7 +15,7 @@ import {
15
15
  revokeKey,
16
16
  revokePrincipal,
17
17
  upload
18
- } from "./chunk-WJZNXLTR.js";
18
+ } from "./chunk-EAKQK7ST.js";
19
19
 
20
20
  // src/cli.ts
21
21
  import { createReadStream, realpathSync, writeFileSync } from "fs";
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-ES3NZ7SX.js";
3
+ } from "./chunk-H6JK62SP.js";
4
4
  import {
5
5
  backfillAuthorIds,
6
6
  backfillResources
7
- } from "./chunk-BXFK3QXK.js";
7
+ } from "./chunk-5Z3SFBUK.js";
8
8
  import {
9
9
  ACTOR_KINDS,
10
10
  AuthError,
@@ -29,7 +29,7 @@ import {
29
29
  subjectKindOf,
30
30
  upload,
31
31
  writeZip
32
- } from "./chunk-WJZNXLTR.js";
32
+ } from "./chunk-EAKQK7ST.js";
33
33
  export {
34
34
  ACTOR_KINDS,
35
35
  AuthError,
package/dist/mcp.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-ES3NZ7SX.js";
3
+ } from "./chunk-H6JK62SP.js";
4
4
  import {
5
5
  ACTOR_KINDS,
6
6
  DriveError,
7
7
  buildExport,
8
8
  publicNode,
9
9
  upload
10
- } from "./chunk-WJZNXLTR.js";
10
+ } from "./chunk-EAKQK7ST.js";
11
11
 
12
12
  // src/mcp.ts
13
13
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
package/dist/worker.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  backfillAuthorIds,
3
3
  backfillResources
4
- } from "./chunk-BXFK3QXK.js";
4
+ } from "./chunk-5Z3SFBUK.js";
5
5
  import {
6
6
  DEFAULT_MAX_BYTES,
7
7
  DEFAULT_URL_SECONDS,
@@ -12,7 +12,7 @@ import {
12
12
  publicNode,
13
13
  safeMime,
14
14
  upload
15
- } from "./chunk-WJZNXLTR.js";
15
+ } from "./chunk-EAKQK7ST.js";
16
16
 
17
17
  // src/worker.ts
18
18
  import { Hono } from "hono";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-drive",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Store, sort, and share files and folders.",
5
5
  "keywords": [
6
6
  "drive",
@@ -73,7 +73,7 @@
73
73
  "dependencies": {
74
74
  "@modelcontextprotocol/sdk": "^1.12.0",
75
75
  "agentic-design": "^0.1.0",
76
- "agentic-identity": "^0.4.0",
76
+ "agentic-identity": "^0.6.0",
77
77
  "hono": "^4.13.14",
78
78
  "zod": "^3.25.0"
79
79
  },