@mediamonks/canopy-cli 0.7.39 → 0.7.40

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.
@@ -2,7 +2,7 @@ import { a as projectDirArgs, c as resolveProject, i as projectDialect, n as sit
2
2
  import { a as apiRequest, l as withContext, t as ApiError } from "./api-ArfD6-t5.mjs";
3
3
  import { r as reportErrors, t as formatDateTime } from "./ui-CaHgvvkJ.mjs";
4
4
  import { r as readMigrationFiles } from "./migrations-CG_O5Ghw.mjs";
5
- import { i as stampWorkerHeaders, n as WORKER_ATTEST_HEADER } from "./src-CxzGOEhP.mjs";
5
+ import { i as stampWorkerHeaders, n as WORKER_ATTEST_HEADER } from "./src-RUf3Gfuh.mjs";
6
6
  import { n as writeDevServerRecord } from "./dev-server-file-Dk9pk4AR.mjs";
7
7
  import { createRequire } from "node:module";
8
8
  import { defineCommand } from "citty";
@@ -41,7 +41,7 @@ async function workerPlugin(flags, slug, workerAttest, remoteUser) {
41
41
  console.log(`note: canopy.json points "worker" at ${entry}, which does not exist — skipping.`);
42
42
  return;
43
43
  }
44
- const { missingSecretNames, readDevVars, workerDevPlugin } = await import("./dev-worker-CpSB_Okh.mjs");
44
+ const { missingSecretNames, readDevVars, workerDevPlugin } = await import("./dev-worker-D78leKBJ.mjs");
45
45
  const secrets = readDevVars(flags.dir);
46
46
  const email = siteConfig().email;
47
47
  const user = await remoteUser?.() ?? (email ? {
@@ -251,7 +251,7 @@ async function devRemote(flags, slug) {
251
251
  async function devLocal(flags, slug) {
252
252
  let dump;
253
253
  if (flags.pull) {
254
- const { fetchProjectDump } = await import("./local-BnfAEwso.mjs");
254
+ const { fetchProjectDump } = await import("./local-CkS1XhRu.mjs");
255
255
  console.log(`Pulling a fresh export of ${slug}${flags.staging ? " [staging]" : ""}…`);
256
256
  dump = await fetchProjectDump(slug, flags.staging ? "staging" : "live");
257
257
  }
@@ -267,7 +267,7 @@ async function devLocal(flags, slug) {
267
267
  console.log(`Note: ai/services will be unavailable — could not reach the platform (${reason}).`);
268
268
  }
269
269
  const workerAttest = randomBytes(24).toString("base64url");
270
- const { createSandbox } = await import("./local-BnfAEwso.mjs");
270
+ const { createSandbox } = await import("./local-CkS1XhRu.mjs");
271
271
  const sandbox = await createSandbox({
272
272
  slug,
273
273
  persistDir: join(flags.dir, ".canopy", "local"),
@@ -0,0 +1,2 @@
1
+ import { n as devCommand } from "./dev-03LA_Etx.mjs";
2
+ export { devCommand };
@@ -1,4 +1,4 @@
1
- import { i as stampWorkerHeaders, n as WORKER_ATTEST_HEADER, r as redactCanopyCredentials, t as CALLER_HEADER } from "./src-CxzGOEhP.mjs";
1
+ import { i as stampWorkerHeaders, n as WORKER_ATTEST_HEADER, r as redactCanopyCredentials, t as CALLER_HEADER } from "./src-RUf3Gfuh.mjs";
2
2
  import { readFileSync } from "node:fs";
3
3
  import { relative, resolve, sep } from "node:path";
4
4
  //#region src/dev-worker.ts
@@ -200,6 +200,31 @@ function userFromHeaders(headers, fallback) {
200
200
  };
201
201
  }
202
202
  /**
203
+ * The caller in dev: stamped caller headers when a request poses as one
204
+ * (a client-password visitor, say), else the same monk env.USER resolves to —
205
+ * the developer, since no company login fronts a local server.
206
+ */
207
+ function callerFromHeaders(headers, fallback) {
208
+ const kind = (headers.get("x-canopy-identity-kind") ?? "").trim();
209
+ const id = (headers.get("x-canopy-identity-id") ?? "").trim();
210
+ const agent = headers.get("x-canopy-caller") === "agent";
211
+ if ((kind === "monk" || kind === "external") && id) return {
212
+ kind,
213
+ id,
214
+ email: (headers.get("x-canopy-identity-email") ?? "").trim(),
215
+ name: (headers.get("x-canopy-identity-name") ?? "").trim(),
216
+ agent
217
+ };
218
+ const user = userFromHeaders(headers, fallback);
219
+ return user ? {
220
+ kind: "monk",
221
+ id: user.sub,
222
+ email: user.email,
223
+ name: user.name,
224
+ agent
225
+ } : null;
226
+ }
227
+ /**
203
228
  * The env object the worker sees, in the shim's own key order: secrets first,
204
229
  * platform keys after, so a stray `.dev.vars` entry can never shadow
205
230
  * `CANOPY`/`DB`/`USER` (the dashboard rejects those names outright —
@@ -207,12 +232,14 @@ function userFromHeaders(headers, fallback) {
207
232
  */
208
233
  function buildWorkerEnv(options, request, parts) {
209
234
  const blobPrefix = `projects/${options.slug}/`;
235
+ const caller = callerFromHeaders(request.headers, options.user);
210
236
  return {
211
237
  ...options.secrets,
212
238
  CANOPY: { fetch: parts.canopyFetch },
213
239
  DB: parts.db,
214
240
  BLOB: parts.blob,
215
- USER: userFromHeaders(request.headers, options.user),
241
+ USER: caller?.kind === "external" ? null : userFromHeaders(request.headers, options.user),
242
+ CALLER: caller,
216
243
  PROJECT_SLUG: options.slug,
217
244
  BLOB_PREFIX: blobPrefix,
218
245
  CANOPY_CHANNEL: options.channel
@@ -316,6 +343,7 @@ function workerDevPlugin(options) {
316
343
  return;
317
344
  }
318
345
  env.USER = null;
346
+ env.CALLER = null;
319
347
  await worker.scheduled({
320
348
  name,
321
349
  cron: typeof body.cron === "string" ? body.cron : "",
@@ -39,7 +39,7 @@ With the lock in place, `--local` runs on an embedded SQLite engine instead —
39
39
 
40
40
  **Your backend worker.** If `canopy.json` names a `worker` entry (the worker scaffold does), `canopy dev` serves it too: requests to `/api/*` go to your worker, everything else to the SPA — the same split the platform makes once you deploy. There's no build step; save the file and the next request runs the new code.
41
41
 
42
- Your worker gets the same `env` it gets in production: `env.CANOPY.fetch` for the SDK, `env.DB` and `env.BLOB` for raw database and file access, `env.USER` for the signed-in person, `env.PROJECT_SLUG`. They all follow the mode you're in — live project data by default, your sandbox under `--local`. Two differences worth knowing: `env.USER` is you (the account you logged in with), since there's no company login in front of a local server, and a write through `env.DB` reports no row count locally.
42
+ Your worker gets the same `env` it gets in production: `env.CANOPY.fetch` for the SDK, `env.DB` and `env.BLOB` for raw database and file access, `env.CALLER` and `env.USER` for whoever is calling, `env.PROJECT_SLUG`. They all follow the mode you're in — live project data by default, your sandbox under `--local`. Two differences worth knowing: `env.CALLER` and `env.USER` are you (the account you logged in with), since there's no company login in front of a local server, and a write through `env.DB` reports no row count locally.
43
43
 
44
44
  To tick a schedule by hand, post its name to the same path the platform uses:
45
45
 
@@ -17,6 +17,7 @@ canopy feedback note <id> "stack trace and table names for the team"
17
17
  canopy feedback status <id> investigated --comment "root cause: the grant expires too early"
18
18
  canopy feedback list --status accepted
19
19
  canopy feedback status <id> resolved --comment "fixed in v42"
20
+ canopy feedback status <id> declined --comment "works as intended: drafts are private"
20
21
  canopy feedback mine
21
22
  canopy feedback watch --project my-project
22
23
  canopy feedback report "canopy deploy exits 1 after upload" --command "canopy deploy"
@@ -107,9 +108,10 @@ queries — goes in `note <id> "<detail>"`, which only project
107
108
  members see. An internal note counts as findings for `investigated`.
108
109
 
109
110
  **Build:** `list --status accepted` is what a person has asked for. Do the
110
- work, then `resolve` with a note, or `declined` if it turns out to be a bad
111
- idea. Set `accepted` yourself only when the person you are working with told
112
- you to.
111
+ work, then `status <id> resolved --comment "<what changed>"`, or
112
+ `status <id> declined --comment "<why>"` if it turns out to be a bad idea.
113
+ Set `accepted` yourself only when the person you are working with told you
114
+ to.
113
115
 
114
116
  When a `canopy` command itself fails: rule out user error, check
115
117
  `canopy feedback mine` for a duplicate, then `report` with the exact command
@@ -67,17 +67,29 @@ else is still static serving. A few things to know:
67
67
 
68
68
  - **Requests arrive authenticated.** The worker sits behind the same gateway
69
69
  wall as the frontend.
70
- - **The caller is already identified.** `c.env.USER` is the signed-in person
71
- (`null` during a scheduled run) — no round-trip needed:
70
+ - **The caller is already identified.** `c.env.CALLER` is whoever the
71
+ platform let in, with no round-trip needed: a signed-in Monk
72
+ (`kind: "monk"`) or a visitor who used the project's
73
+ [client password](https://docs.canopy.website/platform/client-access) (`kind: "external"`). It is
74
+ `null` only when nobody called, such as during a scheduled run:
72
75
 
73
76
  ```ts
74
77
  app.get("/api/hello", (c) => {
75
- const user = c.env.USER;
76
- if (!user) return c.json({ error: "unauthenticated" }, 401);
77
- return c.json({ message: `Hello, ${user.name}!` });
78
+ const caller = c.env.CALLER;
79
+ if (!caller) return c.json({ error: "no caller" }, 400); // a scheduled run
80
+ if (caller.kind === "external") return c.json({ message: "Hello!" });
81
+ return c.json({ message: `Hello, ${caller.name}!` });
78
82
  });
79
83
  ```
80
84
 
85
+ `c.env.USER` is the shorter Monk-only form: the signed-in Monk, or `null`
86
+ for client-password visitors and scheduled runs. Use it when a route is for
87
+ Monks only, and don't read a `null` `USER` as "nobody is here".
88
+
89
+ A backend gets `CALLER` from its next deploy. One deployed before then can
90
+ ask the platform instead: `await canopy.auth.user()` through the `CANOPY`
91
+ binding (below) answers for every visitor.
92
+
81
93
  - **Platform access goes through the same SDK**, via the `CANOPY` service
82
94
  binding — same budgets, same data isolation as the browser:
83
95
 
@@ -46,6 +46,14 @@ immediately, unlocked browsers included.
46
46
  > wrong for anything sensitive. Anyone who has it can view the app and share it further, so rotate
47
47
  > it when a review round ends.
48
48
 
49
+ ## Clients and your backend
50
+
51
+ A client who unlocks the project with the password can use its backend
52
+ routes too, as an anonymous visitor. The worker sees them on `env.CALLER`
53
+ with `kind: "external"`, while `env.USER` (Monks only) is `null` for them. So a
54
+ route that should serve clients checks `env.CALLER`, not `env.USER`. See
55
+ [Auth](https://docs.canopy.website/sdk/auth#in-a-backend-worker).
56
+
49
57
  ## Playing well with other access controls
50
58
 
51
59
  Client access is independent of
@@ -69,7 +69,7 @@ three buckets:
69
69
  | Route handlers (`app/api/*/route.ts`) | Worker endpoints under `/api/*` |
70
70
  | Server actions | Explicit worker endpoints, called with `fetch` from the client |
71
71
  | Middleware | Usually deleted (auth is platform-provided); anything else moves into the worker |
72
- | NextAuth / auth middleware | Deleted — use `canopy.auth.user()` (client) or `env.USER` (worker) |
72
+ | NextAuth / auth middleware | Deleted — use `canopy.auth.user()` (client) or `env.CALLER` (worker) |
73
73
  | Database (Prisma, Postgres, …) | `canopy.db` — per-project database, document API + SQL escape hatch |
74
74
  | File uploads (S3, …) | `canopy.blob` — per-project file storage with signed downloads |
75
75
  | AI SDK / OpenAI client | `canopy.ai.chat()`, or point the Vercel AI SDK at `canopy.ai.endpoint()` |
@@ -117,12 +117,14 @@ Route handlers and server actions become endpoints in one fetch handler.
117
117
 
118
118
  ```ts
119
119
  // worker/index.ts
120
- import { createCanopy } from "@mediamonks/canopy";
120
+ import { type CanopyCaller, createCanopy } from "@mediamonks/canopy";
121
121
  import { Hono } from "hono";
122
122
 
123
123
  type Env = {
124
124
  CANOPY: { fetch: typeof fetch };
125
- /** Signed-in monk, verified by the platform; null for cron. */
125
+ /** Whoever the platform let in, client-password visitors included; null for cron. */
126
+ CALLER: CanopyCaller | null;
127
+ /** The signed-in monk only; null for cron and client-password visitors. */
126
128
  USER: { sub: string; email: string; name: string } | null;
127
129
  /** Project secrets from dashboard Settings appear as plain keys. */
128
130
  MY_API_KEY?: string;
@@ -132,8 +134,10 @@ const app = new Hono<{ Bindings: Env }>();
132
134
 
133
135
  // was: app/api/report/route.ts
134
136
  app.post("/api/report", async (c) => {
137
+ // Reports belong to a Monk's email, so this route is Monks-only. A
138
+ // client-password visitor is still let in, as env.CALLER with no email.
135
139
  const user = c.env.USER;
136
- if (!user) return c.json({ error: "unauthenticated" }, 401);
140
+ if (!user) return c.json({ error: "monks_only" }, 403);
137
141
 
138
142
  // The SDK works inside the worker through the CANOPY binding —
139
143
  // same database and files the frontend sees, caller's identity attached.
@@ -184,8 +188,8 @@ egress allowlist, and even an allowed hop would arrive without your session.
184
188
  The platform recognizes this shape and short-circuits it: a fetch to the
185
189
  project's **own hostname** (or to `localhost` on any port — the common
186
190
  `BASE_URL` fallback) with a path under `/api/` re-enters your worker directly,
187
- in-process. No network hop, no allowlist entry, and `env.USER` is the same
188
- caller who made the original request. Two things to know:
191
+ in-process. No network hop, no allowlist entry, and `env.CALLER` and
192
+ `env.USER` are the same caller who made the original request. Two things to know:
189
193
 
190
194
  - The loopback covers `/api/*` only. A self-fetch to any other path fails
191
195
  like any other non-allowlisted host.
@@ -222,7 +226,8 @@ runs, so the ported app removes sign-in pages, session handling, and auth
222
226
  middleware entirely:
223
227
 
224
228
  - **Client:** `canopy.auth.user()` returns the signed-in monk.
225
- - **Worker:** `env.USER` carries the verified identity (no round-trip).
229
+ - **Worker:** `env.CALLER` carries the verified caller (no round-trip),
230
+ client-password visitors included; `env.USER` is the Monk-only form.
226
231
  - Client-facing access without OneLogin is a per-project
227
232
  [password](https://docs.canopy.website/platform/client-access), configured in Settings — not code.
228
233
 
@@ -252,7 +257,7 @@ past greenhouse size (see [Use cases](https://docs.canopy.website/overview/use-c
252
257
  - [ ] Frontend: `output: 'export'` or Vite SPA; fix dynamic segments and `next/image`
253
258
  - [ ] Worker: route handlers + server actions → `/api/*` endpoints in `worker/index.ts`
254
259
  - [ ] Data: ORM → `canopy.db`; uploads → `canopy.blob`; AI clients → `canopy.ai`
255
- - [ ] Delete NextAuth/middleware; read identity from `canopy.auth.user()` / `env.USER`
260
+ - [ ] Delete NextAuth/middleware; read identity from `canopy.auth.user()` / `env.CALLER`
256
261
  - [ ] Secrets via `canopy secrets set` (or dashboard Settings); `NEXT_PUBLIC_*` into your CI build
257
262
  - [ ] Crons into Settings → Schedules, handled in `scheduled()`
258
263
  - [ ] `canopy.json` with `build`, `dist`, `worker` — then `canopy deploy`
@@ -43,6 +43,38 @@ if (user.kind === "external") {
43
43
  > **Warning:** Branching on `kind` in the browser is presentation, not security — anything your page can fetch, a
44
44
  > visitor can fetch. The platform's access rules are what actually protect data.
45
45
 
46
+ ### In a backend worker
47
+
48
+ A worker route already knows who is calling, without asking: `env.CALLER`
49
+ holds the same `id`, `email`, `name` and `kind` that `auth.user()` returns,
50
+ plus `agent`, which is `true` when an AI agent is acting for a Monk.
51
+
52
+ ```ts
53
+ import type { CanopyCaller } from "@mediamonks/canopy";
54
+
55
+ app.get("/api/me", (c) => {
56
+ const caller: CanopyCaller | null = c.env.CALLER;
57
+ if (!caller) return c.json({ error: "no caller" }, 400); // a scheduled run
58
+ return c.json({ kind: caller.kind, name: caller.name });
59
+ });
60
+ ```
61
+
62
+ `env.CALLER` is `null` only when nobody called, such as during a scheduled
63
+ run. `env.USER` is the Monk-only form: the signed-in Monk, or `null` for a
64
+ client-password visitor.
65
+
66
+ A client-password visitor has no email address and is named `"Client"`. Its
67
+ `id` changes with every password unlock, so don't key data on it that has to
68
+ last.
69
+
70
+ A backend gets `env.CALLER` from its next deploy. Until it is redeployed,
71
+ `auth.user()` through the `CANOPY` binding gives the same answer:
72
+
73
+ ```ts
74
+ const canopy = createCanopy({ fetch: c.env.CANOPY.fetch.bind(c.env.CANOPY) });
75
+ const user = await canopy.auth.user();
76
+ ```
77
+
46
78
  ## auth.logout()
47
79
 
48
80
  Ends the platform session for the current visitor. Their next request hits the
@@ -66,8 +66,8 @@ export default {
66
66
  ```
67
67
 
68
68
  **Returns** `(request, env?, executionCtx?) => Promise<Response>`. Pass the
69
- backend's `env` so handlers and route tools see `env.USER`, `env.CANOPY` and
70
- your secrets.
69
+ backend's `env` so handlers and route tools see `env.USER`, `env.CALLER`,
70
+ `env.CANOPY` and your secrets.
71
71
 
72
72
  **Options:** `{ app?, name?, version? }`. `app` is required when the list has
73
73
  route tools: they run its routes.
@@ -197,8 +197,9 @@ app.get("/api/notes", (c) => {
197
197
  ```
198
198
 
199
199
  **Returns** `McpCaller`: `{ user: McpUser | null, agent: boolean }`.
200
- `user` comes from `env.USER`. Without `env`, it falls back to the identity the
201
- platform attached to the request.
200
+ `user` comes from `env.USER`, and `agent` from `env.CALLER` when the backend
201
+ has it. Without `env`, both fall back to what the platform attached to the
202
+ request.
202
203
 
203
204
  ## When the tool list is wrong
204
205
 
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-CJJpjVh_.mjs";
1
+ import { t as version } from "./package-C1xCnyOB.mjs";
2
2
  import { n as siteConfig } from "./site-DM2J10CB.mjs";
3
3
  import { i as latestKnownVersion, r as compareSemver } from "./version-check-CcsA1QjI.mjs";
4
4
  import { n as agentHeaders } from "./api-ArfD6-t5.mjs";
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-CJJpjVh_.mjs";
1
+ import { t as version } from "./package-C1xCnyOB.mjs";
2
2
  import { a as projectDirArgs, c as resolveProject, d as tryResolveProject, n as siteConfig, u as tryReadCanopyJson } from "./site-DM2J10CB.mjs";
3
3
  import { a as apiRequest, c as credentials, i as apiDownload, o as apiUpload, s as commonHeaders } from "./api-ArfD6-t5.mjs";
4
4
  import { r as reportErrors, t as formatDateTime } from "./ui-CaHgvvkJ.mjs";
@@ -307,7 +307,7 @@ function repeatedFlag(flag, value) {
307
307
  }
308
308
  return arg.startsWith(`${flag}=`) ? [arg.slice(flag.length + 1)] : [];
309
309
  });
310
- return (repeated.length > 0 ? repeated : value === void 0 ? [] : [String(value)]).flatMap((entry) => entry.split(",")).map((path) => path.trim()).filter((path) => path !== "");
310
+ return (repeated.length > 0 ? repeated : typeof value === "string" ? [value] : []).flatMap((entry) => entry.split(",")).map((path) => path.trim()).filter((path) => path !== "");
311
311
  }
312
312
  /** Upload each file to a report that already exists (docs/21 create-then-attach). */
313
313
  async function attachFiles(slug, itemId, paths, caption, commentId) {
@@ -316,7 +316,7 @@ async function attachFiles(slug, itemId, paths, caption, commentId) {
316
316
  const params = new URLSearchParams({ filename: basename(path) });
317
317
  if (caption) params.set("caption", paths.length > 1 ? `${caption} (${index + 1})` : caption);
318
318
  if (commentId) params.set("comment_id", commentId);
319
- await apiUpload(`/projects/${slug}/feedback/${encodeURIComponent(itemId)}/attachments?${params}`, bytes, IMAGE_TYPES[extname(path).toLowerCase()] ?? "application/octet-stream");
319
+ await apiUpload(`/projects/${slug}/feedback/${encodeURIComponent(itemId)}/attachments?${params.toString()}`, bytes, IMAGE_TYPES[extname(path).toLowerCase()] ?? "application/octet-stream");
320
320
  console.log(`Attached ${basename(path)}.`);
321
321
  }
322
322
  }
@@ -400,7 +400,7 @@ const listCommand = defineCommand({
400
400
  const params = new URLSearchParams();
401
401
  if (args.status) params.set("status", args.status);
402
402
  if (args.kind) params.set("kind", args.kind);
403
- const { items } = await apiRequest("GET", `/projects/${slug}/feedback${params.size > 0 ? `?${params}` : ""}`);
403
+ const { items } = await apiRequest("GET", `/projects/${slug}/feedback${params.size > 0 ? `?${params.toString()}` : ""}`);
404
404
  if (args.json) console.log(JSON.stringify(items, null, 2));
405
405
  else printItems(items);
406
406
  })
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as version } from "./package-CJJpjVh_.mjs";
2
+ import { t as version } from "./package-C1xCnyOB.mjs";
3
3
  import { r as siteHeaderLine, t as setInvocationProfile } from "./site-DM2J10CB.mjs";
4
4
  import { a as notifyOfUpdate, o as runRefresh } from "./version-check-CcsA1QjI.mjs";
5
5
  import { defineCommand, runMain } from "citty";
@@ -70,7 +70,7 @@ const main = defineCommand({
70
70
  init: () => import("./projects-B3Wi01lw.mjs").then((m) => m.initCommand),
71
71
  projects: () => import("./projects-B3Wi01lw.mjs").then((m) => m.projectsCommand),
72
72
  delete: () => import("./projects-B3Wi01lw.mjs").then((m) => m.deleteCommand),
73
- dev: () => import("./dev-BdSq6CGD.mjs").then((m) => m.devCommand),
73
+ dev: () => import("./dev-dJ88L73Y.mjs").then((m) => m.devCommand),
74
74
  deploy: () => import("./deploy-B7KItUnh.mjs").then((m) => m.deployCommand),
75
75
  promote: () => import("./deploy-B7KItUnh.mjs").then((m) => m.promoteCommand),
76
76
  staging: () => import("./staging-ypR79MlD.mjs").then((m) => m.stagingCommand),
@@ -80,17 +80,17 @@ const main = defineCommand({
80
80
  egress: () => import("./egress-CzxRD6Tp.mjs").then((m) => m.egressCommand),
81
81
  secrets: () => import("./secrets-CmY4dUHz.mjs").then((m) => m.secretsCommand),
82
82
  schedule: () => import("./schedule-CbaDIJXr.mjs").then((m) => m.scheduleCommand),
83
- feedback: () => import("./feedback-DFK0TXlt.mjs").then((m) => m.feedbackCommand),
83
+ feedback: () => import("./feedback-BsJ_6ke2.mjs").then((m) => m.feedbackCommand),
84
84
  db: () => import("./db-DGrCgj-R.mjs").then((m) => m.dbCommand),
85
85
  usage: () => import("./usage-CP8rBVZi.mjs").then((m) => m.usageCommand),
86
86
  ai: () => import("./ai-EyrXJC5z.mjs").then((m) => m.aiCommand),
87
87
  open: () => import("./open-COFMburt.mjs").then((m) => m.openCommand),
88
88
  browse: () => import("./browse-DEhnJAPT.mjs").then((m) => m.browseCommand),
89
- docs: () => import("./docs-Bplp4sOY.mjs").then((m) => m.docsCommand),
90
- skill: () => import("./skill-C2lGGz9n.mjs").then((m) => m.skillCommand),
91
- upgrade: () => import("./upgrade-Caj1RsA7.mjs").then((m) => m.upgradeCommand),
92
- logs: () => import("./logs-aJwWWaMx.mjs").then((m) => m.logsCommand),
93
- mcp: () => import("./mcp-DuT6_wei.mjs").then((m) => m.mcpCommand),
89
+ docs: () => import("./docs-B0-IEPjd.mjs").then((m) => m.docsCommand),
90
+ skill: () => import("./skill-AqZYYsE6.mjs").then((m) => m.skillCommand),
91
+ upgrade: () => import("./upgrade-DSjmifH_.mjs").then((m) => m.upgradeCommand),
92
+ logs: () => import("./logs-wSKh_FmL.mjs").then((m) => m.logsCommand),
93
+ mcp: () => import("./mcp-DtRIDtaL.mjs").then((m) => m.mcpCommand),
94
94
  repo: () => import("./repo-CmbakFVi.mjs").then((m) => m.repoCommand),
95
95
  template: () => import("./project-template-DlzMx8Oj.mjs").then((m) => m.templateCommand)
96
96
  }
@@ -1,6 +1,6 @@
1
1
  import { r as apiDataRequest } from "./api-ArfD6-t5.mjs";
2
- import { a as realtimeRouter, c as META_COLUMNS, l as blobRouter, n as WORKER_ATTEST_HEADER, o as dbRouter, s as hasPrivateNames } from "./src-CxzGOEhP.mjs";
3
- import { a as rewriteApiPath } from "./dev-BMWj4NDZ.mjs";
2
+ import { a as realtimeRouter, c as META_COLUMNS, l as blobRouter, n as WORKER_ATTEST_HEADER, o as dbRouter, s as hasPrivateNames } from "./src-RUf3Gfuh.mjs";
3
+ import { a as rewriteApiPath } from "./dev-03LA_Etx.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
6
6
  import { dirname, join, relative, sep } from "node:path";
@@ -33,7 +33,7 @@ async function fetchLogs(slug, params) {
33
33
  const query = new URLSearchParams({ channel: params.channel });
34
34
  if (params.since) query.set("since", params.since);
35
35
  if (params.limit) query.set("limit", String(params.limit));
36
- return withContext(apiRequest("GET", `/projects/${slug}/logs?${query}`), {
36
+ return withContext(apiRequest("GET", `/projects/${slug}/logs?${query.toString()}`), {
37
37
  action: `read worker logs for "${slug}"`,
38
38
  fixes: { not_supported_on_target: "Worker logs aren't available on this site yet." }
39
39
  });
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-CJJpjVh_.mjs";
1
+ import { t as version } from "./package-C1xCnyOB.mjs";
2
2
  import { d as tryResolveProject, l as stagingUrl, n as siteConfig, s as projectUrl } from "./site-DM2J10CB.mjs";
3
3
  import { a as apiRequest, t as ApiError } from "./api-ArfD6-t5.mjs";
4
4
  import { t as liveDevServer } from "./dev-server-file-Dk9pk4AR.mjs";
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.7.39";
2
+ var version = "0.7.40";
3
3
  //#endregion
4
4
  export { version as t };
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-CJJpjVh_.mjs";
1
+ import { t as version } from "./package-C1xCnyOB.mjs";
2
2
  import { r as reportErrors } from "./ui-CaHgvvkJ.mjs";
3
3
  import { defineCommand } from "citty";
4
4
  import { cpSync, existsSync, mkdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
@@ -852,11 +852,15 @@ function realtimeRouter(config) {
852
852
  * `worker-request.cases.ts` alongside this implementation, so the two cannot
853
853
  * drift silently.
854
854
  */
855
- /** Gateway-stamped identity, for the worker's own `env.USER` — never relayed. */
855
+ /** Gateway-stamped identity, for the worker's own `env.USER` / `env.CALLER` — never relayed. */
856
856
  const IDENTITY_STAMP_HEADERS = [
857
857
  "x-canopy-user-sub",
858
858
  "x-canopy-user-email",
859
- "x-canopy-user-name"
859
+ "x-canopy-user-name",
860
+ "x-canopy-identity-kind",
861
+ "x-canopy-identity-id",
862
+ "x-canopy-identity-email",
863
+ "x-canopy-identity-name"
860
864
  ];
861
865
  /**
862
866
  * Header carrying the project's worker token as runtime-origin proof (docs/35).
@@ -7,7 +7,7 @@
7
7
  "build": "tsc && vite build"
8
8
  },
9
9
  "dependencies": {
10
- "@mediamonks/canopy": "^0.0.11",
10
+ "@mediamonks/canopy": "^0.0.12",
11
11
  "react": "^19.1.0",
12
12
  "react-dom": "^19.1.0"
13
13
  },
@@ -7,7 +7,7 @@
7
7
  "build": "tsc && vite build"
8
8
  },
9
9
  "dependencies": {
10
- "@mediamonks/canopy": "^0.0.11",
10
+ "@mediamonks/canopy": "^0.0.12",
11
11
  "hono": "^4.8.0",
12
12
  "react": "^19.1.0",
13
13
  "react-dom": "^19.1.0"
@@ -112,7 +112,7 @@ const upgradeCommand = defineCommand({
112
112
  const spec = `${PACKAGE_NAME}@${args.version ?? "latest"}`;
113
113
  const command = pmCommand(pm);
114
114
  const cmd = installArgs(pm, spec);
115
- const { skillInstalled } = await import("./skill-C2lGGz9n.mjs");
115
+ const { skillInstalled } = await import("./skill-AqZYYsE6.mjs");
116
116
  const { homedir } = await import("node:os");
117
117
  const refreshGlobal = skillInstalled(homedir());
118
118
  const refreshRepo = process.cwd() !== homedir() && skillInstalled(process.cwd());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediamonks/canopy-cli",
3
- "version": "0.7.39",
3
+ "version": "0.7.40",
4
4
  "description": "Canopy CLI — create, develop and deploy Canopy projects.",
5
5
  "bin": {
6
6
  "canopy": "./dist/index.mjs"
@@ -22,7 +22,7 @@
22
22
  "esbuild": "^0.28.1",
23
23
  "hono": "^4.8.0",
24
24
  "vite-server": "npm:vite@^7",
25
- "@mediamonks/canopy": "0.0.11",
25
+ "@mediamonks/canopy": "0.0.12",
26
26
  "@mediamonks/canopy-data-plane": "0.0.4"
27
27
  },
28
28
  "devDependencies": {
@@ -1,2 +0,0 @@
1
- import { n as devCommand } from "./dev-BMWj4NDZ.mjs";
2
- export { devCommand };