vibes-diy 14.3.351 → 14.3.352

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.
@@ -199926,6 +199926,7 @@ var BACKEND_LOG_COUNTRY_HEADER = "x-vibe-log-country";
199926
199926
  var BACKEND_INTERNAL_AUTH_HEADER = "x-backend-internal-auth";
199927
199927
  var BACKEND_DENY_HEADER = "x-backend-deny";
199928
199928
  var VIBES_SESSION_USER_HEADER = "x-vibes-session-user";
199929
+ var VIBES_SESSION_HANDLE_HEADER = "x-vibes-session-handle";
199929
199930
  function isControlPlaneAuthorized(secret, provided) {
199930
199931
  if (!secret || provided === null) return false;
199931
199932
  return timingSafeEqualString(provided, secret);
@@ -305809,7 +305810,11 @@ async function resolveBackendWriteIdentity(vctx, input3) {
305809
305810
  if (input3.userId === null) {
305810
305811
  return { userId: null, userContext: null, ...origin };
305811
305812
  }
305812
- const userHandle = await resolveActiveHandle(vctx, input3.userId);
305813
+ const acting = await resolveActingHandle(vctx, input3.userId, input3.requestedHandle);
305814
+ if (acting.ok === false) {
305815
+ return { userId: null, userContext: null, ...origin };
305816
+ }
305817
+ const userHandle = acting.handle;
305813
305818
  return {
305814
305819
  userId: input3.userId,
305815
305820
  ...origin,
@@ -409390,7 +409395,8 @@ async function attemptBackendFetch(vctx, input3) {
409390
409395
  ownerHandle: input3.ownerHandle,
409391
409396
  appSlug: input3.appSlug,
409392
409397
  userId: input3.userId ?? null,
409393
- backend: "fetch"
409398
+ backend: "fetch",
409399
+ ...input3.requestedHandle === void 0 ? {} : { requestedHandle: input3.requestedHandle }
409394
409400
  });
409395
409401
  timer.mark("identity");
409396
409402
  const db = makeBackendDbCallback(vctx, {
@@ -409516,7 +409522,8 @@ var STRIPPED_BACKEND_FETCH_HEADERS = /* @__PURE__ */ new Set([
409516
409522
  "cookie",
409517
409523
  "authorization",
409518
409524
  BACKEND_INTERNAL_AUTH_HEADER,
409519
- VIBES_SESSION_USER_HEADER
409525
+ VIBES_SESSION_USER_HEADER,
409526
+ VIBES_SESSION_HANDLE_HEADER
409520
409527
  ]);
409521
409528
  async function serializeRequest(req2) {
409522
409529
  const headers = {};
@@ -410103,6 +410110,14 @@ async function resolveBackendCallerUserId(vctx, request, internal) {
410103
410110
  return resolveBackendSessionUserId(vctx, request);
410104
410111
  }
410105
410112
  __name(resolveBackendCallerUserId, "resolveBackendCallerUserId");
410113
+ function resolveBackendCallerHandle(request, internal) {
410114
+ if (!isControlPlaneAuthorized(internal.internalSecret, internal.providedAuth ?? null)) return void 0;
410115
+ const user = request.headers.get(VIBES_SESSION_USER_HEADER);
410116
+ const handle = request.headers.get(VIBES_SESSION_HANDLE_HEADER);
410117
+ if (user === null || user === "" || handle === null || handle === "") return void 0;
410118
+ return handle;
410119
+ }
410120
+ __name(resolveBackendCallerHandle, "resolveBackendCallerHandle");
410106
410121
  function isPlatformGithubDelivery(request, internal) {
410107
410122
  if (!isControlPlaneAuthorized(internal.internalSecret, internal.providedAuth ?? null)) return false;
410108
410123
  const event = request.headers.get(VIBES_GITHUB_EVENT_HEADER);
@@ -410552,6 +410567,10 @@ var BackendDO = class {
410552
410567
  internalSecret: this.env.BACKEND_INTERNAL_SECRET,
410553
410568
  providedAuth: request.headers.get(BACKEND_INTERNAL_AUTH_HEADER)
410554
410569
  });
410570
+ const requestedHandle = resolveBackendCallerHandle(request, {
410571
+ internalSecret: this.env.BACKEND_INTERNAL_SECRET,
410572
+ providedAuth: request.headers.get(BACKEND_INTERNAL_AUTH_HEADER)
410573
+ });
410555
410574
  timer.mark("callerUser");
410556
410575
  const platformLane = isPlatformGithubDelivery(request, {
410557
410576
  internalSecret: this.env.BACKEND_INTERNAL_SECRET,
@@ -410565,6 +410584,7 @@ var BackendDO = class {
410565
410584
  timer,
410566
410585
  request,
410567
410586
  userId,
410587
+ ...requestedHandle === void 0 ? {} : { requestedHandle },
410568
410588
  platformLane,
410569
410589
  backendJs: this.env.BACKEND_JS,
410570
410590
  loader: this.env.LOADER,
@@ -26908,7 +26908,6 @@ var init_version_timeline = __esm({
26908
26908
  var POUF_ENTRY_EXPORTS, POUF_TAUGHT_NAMES;
26909
26909
  var init_exports = __esm({
26910
26910
  "../vibes.diy/pouf/exports.ts"() {
26911
- "use strict";
26912
26911
  POUF_ENTRY_EXPORTS = {
26913
26912
  index: [
26914
26913
  "AlertBell",
@@ -78759,7 +78758,11 @@ async function resolveBackendWriteIdentity(vctx, input) {
78759
78758
  if (input.userId === null) {
78760
78759
  return { userId: null, userContext: null, ...origin };
78761
78760
  }
78762
- const userHandle = await resolveActiveHandle(vctx, input.userId);
78761
+ const acting = await resolveActingHandle(vctx, input.userId, input.requestedHandle);
78762
+ if (acting.ok === false) {
78763
+ return { userId: null, userContext: null, ...origin };
78764
+ }
78765
+ const userHandle = acting.handle;
78763
78766
  return {
78764
78767
  userId: input.userId,
78765
78768
  ...origin,
@@ -85411,7 +85414,7 @@ function backendDoName(ownerHandle, appSlug) {
85411
85414
  const lenc = /* @__PURE__ */ __name((s) => `${s.length}:${s}`, "lenc");
85412
85415
  return `backend:${lenc(ownerHandle)}/${lenc(appSlug)}`;
85413
85416
  }
85414
- var BACKEND_OWNER_HEADER, BACKEND_SLUG_HEADER, BACKEND_OP_HEADER, BACKEND_OP_ARM, BACKEND_OP_ONCHANGE, BACKEND_OP_STATUS, BACKEND_OP_DISARM, BACKEND_DISARM_REASON_HEADER, BACKEND_OP_TOOL, BACKEND_LOG_COUNTRY_HEADER, BACKEND_INTERNAL_AUTH_HEADER, BACKEND_DENY_HEADER, VIBES_SESSION_USER_HEADER, VIBES_RESERVED_HEADER_PREFIX;
85417
+ var BACKEND_OWNER_HEADER, BACKEND_SLUG_HEADER, BACKEND_OP_HEADER, BACKEND_OP_ARM, BACKEND_OP_ONCHANGE, BACKEND_OP_STATUS, BACKEND_OP_DISARM, BACKEND_DISARM_REASON_HEADER, BACKEND_OP_TOOL, BACKEND_LOG_COUNTRY_HEADER, BACKEND_INTERNAL_AUTH_HEADER, BACKEND_DENY_HEADER, VIBES_SESSION_USER_HEADER, VIBES_SESSION_HANDLE_HEADER, VIBES_RESERVED_HEADER_PREFIX;
85415
85418
  var init_backend_do_addr = __esm({
85416
85419
  "../vibes.diy/api/svc/intern/backend-do-addr.ts"() {
85417
85420
  "use strict";
@@ -85429,6 +85432,7 @@ var init_backend_do_addr = __esm({
85429
85432
  BACKEND_INTERNAL_AUTH_HEADER = "x-backend-internal-auth";
85430
85433
  BACKEND_DENY_HEADER = "x-backend-deny";
85431
85434
  VIBES_SESSION_USER_HEADER = "x-vibes-session-user";
85435
+ VIBES_SESSION_HANDLE_HEADER = "x-vibes-session-handle";
85432
85436
  VIBES_RESERVED_HEADER_PREFIX = "x-vibes-";
85433
85437
  __name(sanitizeBackendApiForwardHeaders, "sanitizeBackendApiForwardHeaders");
85434
85438
  __name(buildBackendApiForward, "buildBackendApiForward");
@@ -162978,6 +162982,7 @@ function ownerApiFetchFor(env, ns) {
162978
162982
  ownerHandle: params.ownerHandle,
162979
162983
  appSlug: params.appSlug,
162980
162984
  userId: params.userId,
162985
+ ...params.asHandle === void 0 ? {} : { asHandle: params.asHandle },
162981
162986
  method: params.method,
162982
162987
  path: params.path,
162983
162988
  headers: params.contentType === void 0 ? {} : { "content-type": params.contentType },
@@ -163040,7 +163045,11 @@ function identifiedApiForwardFor(env, ns) {
163040
163045
  sanitizeBackendApiForwardHeaders(headers, { ownerHandle: params.ownerHandle, appSlug: params.appSlug });
163041
163046
  headers.set(BACKEND_INTERNAL_AUTH_HEADER, secret);
163042
163047
  headers.delete(VIBES_SESSION_USER_HEADER);
163043
- if (params.userId !== null) headers.set(VIBES_SESSION_USER_HEADER, params.userId);
163048
+ headers.delete(VIBES_SESSION_HANDLE_HEADER);
163049
+ if (params.userId !== null) {
163050
+ headers.set(VIBES_SESSION_USER_HEADER, params.userId);
163051
+ if (params.asHandle !== void 0) headers.set(VIBES_SESSION_HANDLE_HEADER, params.asHandle);
163052
+ }
163044
163053
  const rRes = await exception2Result366(() => {
163045
163054
  const stub = ns.get(ns.idFromName(backendDoName(params.ownerHandle, params.appSlug)));
163046
163055
  return stub.fetch(
@@ -168449,6 +168458,22 @@ var init_queue_ctx = __esm({
168449
168458
  const creds = ascCredsFromEnv(this.params.vibes.env);
168450
168459
  return creds === void 0 ? void 0 : createAscClient(creds, fetch.bind(globalThis));
168451
168460
  });
168461
+ /**
168462
+ * A vibe's own `_api` route, called as a named person through this worker's
168463
+ * BackendDO binding and `BACKEND_INTERNAL_SECRET` (the `call_own_api` lane).
168464
+ * Undefined without a BackendDO binding. Read by the sentinel lane only.
168465
+ */
168466
+ get backendOwnerApiFetch() {
168467
+ return this.ownerApiFetch();
168468
+ }
168469
+ ownerApiFetch = Lazy19(
168470
+ () => backendControlPlaneCallbacks({
168471
+ BACKEND_DO: this.params.cf.BACKEND_DO,
168472
+ BACKEND_INTERNAL_SECRET: this.params.vibes.env.BACKEND_INTERNAL_SECRET,
168473
+ VIBES_SVC_HOSTNAME_BASE: this.params.vibes.env.VIBES_SVC_HOSTNAME_BASE,
168474
+ ENVIRONMENT: this.params.vibes.env.VIBES_ENV_NAME
168475
+ }).backendOwnerApiFetch
168476
+ );
168452
168477
  /** Cloudflare Images, or undefined when the binding is not on this worker. */
168453
168478
  get images() {
168454
168479
  return this.params.cf.IMAGES;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibes-diy",
3
- "version": "14.3.351",
3
+ "version": "14.3.352",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "description": "Command-line tool for vibes.diy — generate, edit, pull, push, and publish AI-built apps",
@@ -41,13 +41,13 @@
41
41
  "@neondatabase/serverless": "~1.2.0",
42
42
  "@noble/hashes": "~2.4.0",
43
43
  "@shadcn/lint": "~0.2.3",
44
- "@vibes.diy/api-impl": "14.3.351",
45
- "@vibes.diy/api-types": "14.3.351",
46
- "@vibes.diy/call-ai-v2": "14.3.351",
47
- "@vibes.diy/cmd-harness": "14.3.351",
48
- "@vibes.diy/cmd-tools": "14.3.351",
49
- "@vibes.diy/identity": "14.3.351",
50
- "@vibes.diy/prompts": "14.3.351",
44
+ "@vibes.diy/api-impl": "14.3.352",
45
+ "@vibes.diy/api-types": "14.3.352",
46
+ "@vibes.diy/call-ai-v2": "14.3.352",
47
+ "@vibes.diy/cmd-harness": "14.3.352",
48
+ "@vibes.diy/cmd-tools": "14.3.352",
49
+ "@vibes.diy/identity": "14.3.352",
50
+ "@vibes.diy/prompts": "14.3.352",
51
51
  "acorn": "~8.19.0",
52
52
  "acorn-jsx": "~5.3.2",
53
53
  "arktype": "~2.2.9",