@base44-preview/cli 0.3.2-pr.699.00cdc4d → 0.3.3-pr.700.d3249f9

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/dist/cli/index.js CHANGED
@@ -228845,13 +228845,19 @@ function findEnvDir(cwd) {
228845
228845
  const configDir = dirname3(found.configPath);
228846
228846
  return basename(configDir) === PROJECT_SUBDIR ? dirname3(configDir) : configDir;
228847
228847
  }
228848
+ var accessTokenFromEnvFile = false;
228849
+ function isAccessTokenFromEnvFile() {
228850
+ return accessTokenFromEnvFile;
228851
+ }
228848
228852
  function loadProjectEnvFiles(cwd = process.cwd()) {
228849
228853
  const root = findEnvDir(cwd);
228854
+ const ambientAccessToken = process.env.BASE44_ACCESS_TOKEN ?? process.env[`${STRIPE_ENV_PREFIX}BASE44_ACCESS_TOKEN`];
228850
228855
  import_dotenv.config({
228851
228856
  path: [join(root, ".env.local"), join(root, ".env")],
228852
228857
  quiet: true
228853
228858
  });
228854
228859
  normalizeBase44Env();
228860
+ accessTokenFromEnvFile = ambientAccessToken === undefined && process.env.BASE44_ACCESS_TOKEN !== undefined;
228855
228861
  }
228856
228862
  function normalizeBase44Env() {
228857
228863
  for (const bareKey of BASE44_ENV_KEYS) {
@@ -230864,6 +230870,7 @@ function getTestOverrides() {
230864
230870
  var TOKEN_REFRESH_BUFFER_MS = 60 * 1000;
230865
230871
  var WORKSPACE_API_KEY_PREFIX = "b44k_";
230866
230872
  var refreshPromise = null;
230873
+ var envAccessTokenAuth = null;
230867
230874
  function getWorkspaceApiKeyFromEnv() {
230868
230875
  const key = process.env.BASE44_API_KEY?.trim();
230869
230876
  return key ? key : null;
@@ -230885,7 +230892,20 @@ async function seedAuthFromEnv() {
230885
230892
  const payload = claims !== null && typeof claims === "object" ? claims : null;
230886
230893
  const sub = typeof payload?.sub === "string" ? payload.sub : undefined;
230887
230894
  const exp = typeof payload?.exp === "number" ? payload.exp : undefined;
230888
- if (!refreshToken || !sub || !exp) {
230895
+ if (!sub || !exp) {
230896
+ return;
230897
+ }
230898
+ if (!refreshToken) {
230899
+ if (isAccessTokenFromEnvFile()) {
230900
+ return;
230901
+ }
230902
+ envAccessTokenAuth = {
230903
+ accessToken,
230904
+ refreshToken: "",
230905
+ expiresAt: exp * 1000,
230906
+ email: sub,
230907
+ name: sub
230908
+ };
230889
230909
  return;
230890
230910
  }
230891
230911
  await writeAuth({
@@ -230897,6 +230917,9 @@ async function seedAuthFromEnv() {
230897
230917
  });
230898
230918
  }
230899
230919
  async function readAuth() {
230920
+ if (envAccessTokenAuth) {
230921
+ return envAccessTokenAuth;
230922
+ }
230900
230923
  try {
230901
230924
  const authData = await readJsonFile(getAuthFilePath());
230902
230925
  const result = AuthDataSchema.safeParse(authData);
@@ -230933,6 +230956,9 @@ function isTokenExpired(auth) {
230933
230956
  return Date.now() >= auth.expiresAt - TOKEN_REFRESH_BUFFER_MS;
230934
230957
  }
230935
230958
  async function refreshAndSaveTokens() {
230959
+ if (envAccessTokenAuth) {
230960
+ return null;
230961
+ }
230936
230962
  if (refreshPromise) {
230937
230963
  return refreshPromise;
230938
230964
  }
@@ -237180,7 +237206,7 @@ var SKILL_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
237180
237206
  var AgentSkillSchema = object({
237181
237207
  name: string2().trim().min(1).max(64).regex(SKILL_NAME_REGEX, "Skill name must be lowercase-hyphenated (a-z, 0-9, -)"),
237182
237208
  description: string2().trim().min(1, "Description is required").max(1024),
237183
- body: string2().trim().min(1, "Body is required").max(15000)
237209
+ body: string2().trim().min(1, "Body is required").max(50000)
237184
237210
  });
237185
237211
  var AgentSkillApiResponseSchema = object({
237186
237212
  name: string2(),
@@ -239420,7 +239446,7 @@ import { join as join13 } from "node:path";
239420
239446
  // package.json
239421
239447
  var package_default = {
239422
239448
  name: "base44",
239423
- version: "0.3.2",
239449
+ version: "0.3.3",
239424
239450
  description: "Base44 CLI - Unified interface for managing Base44 applications",
239425
239451
  type: "module",
239426
239452
  bin: {
@@ -247073,6 +247099,7 @@ async function resolveBuildTarget(projectRoot, overrides = {}) {
247073
247099
  outputDir: resolve6(root, overrides.outputDir ?? site.outputDirectory ?? DEFAULT_SITE.outputDirectory),
247074
247100
  entitiesDir: project?.entitiesDir ?? "entities",
247075
247101
  agentsDir: project?.agentsDir ?? "agents",
247102
+ agentSkillsDir: project?.agentSkillsDir ?? "agent-skills",
247076
247103
  functionsDir: project?.functionsDir ?? "functions",
247077
247104
  actorsDir: project?.actorsDir ?? "actors"
247078
247105
  };
@@ -252878,6 +252905,7 @@ async function createVersion(artifacts, options = {}) {
252878
252905
  entities: artifacts.entities,
252879
252906
  agents: artifacts.agents,
252880
252907
  mcp_config: artifacts.mcpConfig,
252908
+ agent_skills: artifacts.agentSkills,
252881
252909
  source_commit: options.sourceCommit
252882
252910
  }, "declaring a version")).json(), "declare");
252883
252911
  const declaredFiles = [
@@ -255438,6 +255466,7 @@ var deno2 = Object.freeze({
255438
255466
  });
255439
255467
  globalThis.Deno = deno2;
255440
255468
  globalThis.Buffer = Buffer2;
255469
+ if (typeof process !== "undefined") process.version = "v22.23.4";
255441
255470
  try {
255442
255471
  new AsyncLocalStorage().enterWith(void 0);
255443
255472
  } catch {
@@ -256479,6 +256508,14 @@ var TickLoop = class {
256479
256508
  };
256480
256509
 
256481
256510
  // src/shim/actor.ts
256511
+ var ActorError = class extends Error {
256512
+ constructor(status, message) {
256513
+ super(message);
256514
+ this.status = status;
256515
+ this.name = "ActorError";
256516
+ }
256517
+ status;
256518
+ };
256482
256519
  var SUPERSEDED_PREFIX = "__superseded__:";
256483
256520
  function buildConn(ws, identity) {
256484
256521
  return {
@@ -256813,35 +256850,60 @@ var Actor = class _Actor extends Server {
256813
256850
  }
256814
256851
  handleWake(_key) {
256815
256852
  }
256816
- // Optional: the platform posted an event into this room. Delivery is
256817
- // at-least-once; a repeat of an event_id this instance already took is dropped
256818
- // here, so a room that must be exact across evictions dedups on event_id too.
256819
- handlePlatformEvent(_event) {
256820
- }
256821
- takenPlatformEvents = [];
256822
- platformEventsInFlight = /* @__PURE__ */ new Map();
256823
- static REMEMBERED_PLATFORM_EVENTS = 64;
256824
- // Called by the generated wrapper for a verified POST .../events; never user-facing.
256825
- async _b44PlatformEvent(request) {
256853
+ /** Methods a caller may run on this room, as \`base44.actors.<Name>(room).<method>(args)\`.
256854
+ * Nothing else is callable. Each is called as \`method(args, { identity, request })\`;
256855
+ * check \`identity\` before acting: a client can call any room it can name. */
256856
+ static callable;
256857
+ static NOT_CALLABLE = /^(?:handle[A-Z]|on[A-Z]|_)|^(?:constructor|fetch|alarm|setName|broadcast|schedule|cancelSchedule|getConnections|webSocket[A-Z].*)$/;
256858
+ static CALLER_AUTHORIZATION_HEADER = "X-Base44-Actor-Caller-Authorization";
256859
+ static parseCallIdentity(value) {
256860
+ if (value === '{"type":"service"}') return Object.freeze({ type: "service" });
256861
+ return _Actor.parseIdentity(value);
256862
+ }
256863
+ // Called by the generated wrapper for a verified POST .../requests; never user-facing.
256864
+ async _b44ActorCall(request) {
256826
256865
  const room = request.headers.get("x-partykit-room");
256827
256866
  if (room) await this.setName(room);
256828
- const event = await request.json();
256829
- const eventId = event.event_id;
256830
- if (!this.takenPlatformEvents.includes(eventId)) {
256831
- let delivery = this.platformEventsInFlight.get(eventId);
256832
- if (!delivery) {
256833
- delivery = this.takePlatformEvent(event).finally(() => this.platformEventsInFlight.delete(eventId));
256834
- this.platformEventsInFlight.set(eventId, delivery);
256835
- }
256836
- await delivery;
256837
- }
256838
- return new Response(null, { status: 204 });
256839
- }
256840
- async takePlatformEvent(event) {
256841
- await this.handlePlatformEvent(event);
256842
- this.takenPlatformEvents.push(event.event_id);
256843
- if (this.takenPlatformEvents.length > _Actor.REMEMBERED_PLATFORM_EVENTS) this.takenPlatformEvents.shift();
256867
+ const identity = _Actor.parseCallIdentity(request.headers.get(_Actor.IDENTITY_HEADER));
256868
+ if (!identity) return new Response("Unauthorized", { status: 401 });
256869
+ let call;
256870
+ try {
256871
+ call = JSON.parse(await request.text());
256872
+ } catch {
256873
+ return Response.json({ message: "Invalid call" }, { status: 400 });
256874
+ }
256875
+ const name = call?.method;
256876
+ const callable = this.constructor.callable;
256877
+ if (typeof name !== "string" || !Array.isArray(callable) || !callable.includes(name) || _Actor.NOT_CALLABLE.test(name) || typeof this[name] !== "function") {
256878
+ return Response.json({ message: \`No callable method "\${String(name)}"\` }, { status: 404 });
256879
+ }
256880
+ const headers = new Headers({
256881
+ "Content-Type": "application/json",
256882
+ "Base44-App-Id": String(this._b44Env.BASE44_APP_ID ?? ""),
256883
+ "Base44-Api-Url": String(this._b44Env.BASE44_API_URL ?? ""),
256884
+ "Base44-Functions-Version": String(this._b44Env.BASE44_FUNCTIONS_VERSION ?? "")
256885
+ });
256886
+ const callerAuthorization = request.headers.get(_Actor.CALLER_AUTHORIZATION_HEADER);
256887
+ if (callerAuthorization) headers.set("Authorization", callerAuthorization);
256888
+ const forMethod = new Request(
256889
+ \`https://actor.base44/rooms/\${encodeURIComponent(this.name)}/methods/\${encodeURIComponent(name)}\`,
256890
+ { method: "POST", headers, body: JSON.stringify(call.args ?? null) }
256891
+ );
256892
+ let response;
256893
+ try {
256894
+ const result = await this[name](call.args, { identity, request: forMethod });
256895
+ response = result === void 0 ? new Response(null, { status: 204 }) : Response.json(result);
256896
+ } catch (err) {
256897
+ const status = err?.status;
256898
+ if (typeof status === "number" && status >= 400 && status < 500) {
256899
+ response = Response.json({ message: err.message }, { status });
256900
+ } else {
256901
+ console.error(\`Actor.\${name} threw:\`, err);
256902
+ response = Response.json({ message: "Actor method failed" }, { status: 500 });
256903
+ }
256904
+ }
256844
256905
  await this.maintainTicker();
256906
+ return response;
256845
256907
  }
256846
256908
  async schedule(key, at) {
256847
256909
  const when = typeof at === "number" ? at : at.getTime();
@@ -256992,6 +257054,7 @@ var Actor = class _Actor extends Server {
256992
257054
  };
256993
257055
  export {
256994
257056
  Actor,
257057
+ ActorError,
256995
257058
  routePartykitRequest
256996
257059
  };
256997
257060
  `,
@@ -259082,12 +259145,12 @@ function buildActorAuth() {
259082
259145
  return `// Auto-generated by the base44 bundler. Do not edit.
259083
259146
  const TOKEN_HEADER = "X-Base44-Actor-Token";
259084
259147
  const IDENTITY_HEADER = "X-Base44-Actor-Identity";
259085
- const EVENT_TOKEN_HEADER = "X-Base44-Actor-Event-Token";
259148
+ const REQUEST_TOKEN_HEADER = "X-Base44-Actor-Request-Token";
259149
+ const CALLER_AUTHORIZATION_HEADER = "X-Base44-Actor-Caller-Authorization";
259086
259150
  const CLOCK_SKEW_SECONDS = 30;
259087
259151
  const TOKEN_TTL_SECONDS = 300;
259088
- const EVENT_TOKEN_TTL_SECONDS = 60;
259089
- const EVENT_MAX_BYTES = 64 * 1024;
259090
- const EVENT_TYPE_PREFIX = "__";
259152
+ const REQUEST_TOKEN_TTL_SECONDS = 60;
259153
+ const REQUEST_MAX_BYTES = 64 * 1024;
259091
259154
 
259092
259155
  const decodeSegment = (segment) => {
259093
259156
  const normalized = segment.replace(/-/g, "+").replace(/_/g, "/");
@@ -259197,11 +259260,22 @@ export function authorizedActorRequest(request, identity, actorName, room, runti
259197
259260
  return new Request(new Request(url.toString(), request), { headers });
259198
259261
  }
259199
259262
 
259200
- // A platform event the backend posts into one room. Same key as connection
259201
- // tokens, its own audience and purpose: neither token is accepted as the other.
259202
- // 401 is a token this key did not mint or that has lapsed; 403 is a good token
259203
- // for another app, actor, script or room.
259204
- export async function verifyActorEvent(request, env, actorName, room) {
259263
+ const validRequestPrincipal = (principal) =>
259264
+ validPrincipal(principal) ||
259265
+ (principal !== null && typeof principal === "object" && principal.type === "service" && Object.keys(principal).length === 1);
259266
+
259267
+ const sha256 = async (bytes) => {
259268
+ const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", bytes));
259269
+ return btoa(String.fromCharCode(...digest)).replace(/\\+/g, "-").replace(/\\//g, "_").replace(/=+$/, "");
259270
+ };
259271
+
259272
+ // A method call the backend relays into one room for a caller it authenticated. Same
259273
+ // key as connection tokens, its own audience and purpose: neither is accepted as
259274
+ // the other. The token is bound to the body and to the caller's forwarded
259275
+ // credential, so a leaked token can carry neither another call nor another caller.
259276
+ // 401 is a token this key did not mint, that has lapsed or whose hashes don't match;
259277
+ // 403 is a good token for another app, actor, script, room or runtime.
259278
+ export async function verifyActorRequest(request, env, actorName, room) {
259205
259279
  const publicKey = env.BASE44_ACTOR_PUBLIC_KEY;
259206
259280
  const scriptId = env.BASE44_ACTOR_SCRIPT_ID;
259207
259281
  if (
@@ -259209,60 +259283,67 @@ export async function verifyActorEvent(request, env, actorName, room) {
259209
259283
  typeof scriptId !== "string" || !scriptId
259210
259284
  ) return unauthorized();
259211
259285
  try {
259212
- const claims = await verifiedClaims(request.headers.get(EVENT_TOKEN_HEADER), publicKey);
259286
+ const claims = await verifiedClaims(request.headers.get(REQUEST_TOKEN_HEADER), publicKey);
259213
259287
  if (!claims) return unauthorized();
259214
259288
  const now = Math.floor(Date.now() / 1000);
259215
259289
  if (
259216
259290
  claims.iss !== "base44" ||
259217
- claims.aud !== "base44-actor-event" ||
259218
- claims.purpose !== "actor-platform-event" ||
259291
+ claims.aud !== "base44-actor-request" ||
259292
+ claims.purpose !== "actor-request" ||
259219
259293
  claims.v !== 1 ||
259220
259294
  typeof claims.jti !== "string" || !claims.jti || claims.jti.length > 64 ||
259221
- !validTimes(claims, now, EVENT_TOKEN_TTL_SECONDS) ||
259222
- typeof claims.event_id !== "string" || !claims.event_id || claims.event_id.length > 256
259295
+ !validTimes(claims, now, REQUEST_TOKEN_TTL_SECONDS) ||
259296
+ typeof claims.body_sha256 !== "string" ||
259297
+ !(claims.caller_token_sha256 === null || typeof claims.caller_token_sha256 === "string") ||
259298
+ !validRequestPrincipal(claims.principal)
259223
259299
  ) return unauthorized();
259224
259300
  if (
259225
259301
  claims.app_id !== env.BASE44_APP_ID ||
259226
259302
  claims.actor_name !== actorName ||
259227
259303
  claims.actor_script_id !== scriptId ||
259228
- claims.room !== room
259304
+ claims.room !== room ||
259305
+ claims.runtime_mode !== (env.BASE44_FUNCTIONS_VERSION === "prod" ? "prod" : "preview")
259229
259306
  ) return refused(403, "Forbidden");
259230
- return { ok: true, eventId: claims.event_id };
259307
+
259308
+ const body = new Uint8Array(await request.arrayBuffer());
259309
+ if (body.length > REQUEST_MAX_BYTES) return refused(413, "Request too large");
259310
+ if (await sha256(body) !== claims.body_sha256) return unauthorized();
259311
+ const callerAuthorization = request.headers.get(CALLER_AUTHORIZATION_HEADER);
259312
+ if (callerAuthorization === null) {
259313
+ if (claims.caller_token_sha256 !== null) return unauthorized();
259314
+ } else if (
259315
+ callerAuthorization.length > 8192 ||
259316
+ await sha256(new TextEncoder().encode(callerAuthorization)) !== claims.caller_token_sha256
259317
+ ) return unauthorized();
259318
+ return {
259319
+ ok: true,
259320
+ identity: Object.freeze({ ...claims.principal }),
259321
+ runtimeMode: claims.runtime_mode,
259322
+ body,
259323
+ callerAuthorization,
259324
+ };
259231
259325
  } catch {
259232
259326
  return unauthorized();
259233
259327
  }
259234
259328
  }
259235
259329
 
259236
- // The JSON body of a verified event: one object in the platform's "__" type
259237
- // namespace whose event_id is the one the token was minted for.
259238
- export async function readPlatformEvent(request, eventId) {
259239
- let text;
259240
- try { text = await request.text(); } catch { return refused(400, "Unreadable event"); }
259241
- if (new TextEncoder().encode(text).length > EVENT_MAX_BYTES) return refused(413, "Event too large");
259242
- let event;
259243
- try { event = JSON.parse(text); } catch { return refused(400, "Invalid event"); }
259244
- if (
259245
- event === null || typeof event !== "object" || Array.isArray(event) ||
259246
- typeof event.type !== "string" || !event.type.startsWith(EVENT_TYPE_PREFIX) || event.type.length > 128 ||
259247
- event.event_id !== eventId
259248
- ) return refused(400, "Invalid event");
259249
- return { ok: true, event };
259250
- }
259251
-
259252
- // Into the room as POST /parties/<actor>/<room>/events: a path no client route
259330
+ // Into the room as POST /parties/<actor>/<room>/requests: a path no client route
259253
259331
  // forwards (the legacy route is exactly four segments, the direct route rewrites
259254
- // the path), so the Durable Object can trust the shape alone.
259255
- export function platformEventRequest(request, env, actorName, room, event) {
259332
+ // the path), so the Durable Object can trust the shape and its identity and caller
259333
+ // headers.
259334
+ export function actorRequestToRoom(request, actorName, room, verified) {
259256
259335
  const url = new URL(request.url);
259257
259336
  url.search = "";
259258
- url.pathname = "/parties/" + encodeURIComponent(actorName) + "/" + encodeURIComponent(room) + "/events";
259337
+ url.pathname = "/parties/" + encodeURIComponent(actorName) + "/" + encodeURIComponent(room) + "/requests";
259259
259338
  return new Request(url.toString(), {
259260
259339
  method: "POST",
259261
259340
  headers: {
259262
- "Content-Type": "application/json",
259263
- "base44-functions-version": env.BASE44_FUNCTIONS_VERSION === "prod" ? "prod" : "preview",
259341
+ "Content-Type": request.headers.get("Content-Type") ?? "application/json",
259342
+ [IDENTITY_HEADER]: JSON.stringify(verified.identity),
259343
+ "base44-functions-version": verified.runtimeMode,
259344
+ ...(verified.callerAuthorization === null ? {} : { [CALLER_AUTHORIZATION_HEADER]: verified.callerAuthorization }),
259264
259345
  },
259265
- body: JSON.stringify(event),
259346
+ body: verified.body,
259266
259347
  });
259267
259348
  }
259268
259349
  `;
@@ -259286,11 +259367,10 @@ import "./${ACTOR_PRELUDE_FILENAME}";
259286
259367
  import Base44UserActor from ${JSON.stringify(userImport)};
259287
259368
  import { runWithWorkerEnvironment as _b44Run } from ${JSON.stringify(RUNTIME_CONTEXT_SPECIFIER)};
259288
259369
  import {
259370
+ actorRequestToRoom as _b44ActorRequestToRoom,
259289
259371
  authorizedActorRequest as _b44AuthorizedActorRequest,
259290
- platformEventRequest as _b44PlatformEventRequest,
259291
- readPlatformEvent as _b44ReadPlatformEvent,
259292
259372
  verifyActorConnection as _b44VerifyActorConnection,
259293
- verifyActorEvent as _b44VerifyActorEvent,
259373
+ verifyActorRequest as _b44VerifyActorRequest,
259294
259374
  } from "./${ACTOR_AUTH_FILENAME}";
259295
259375
 
259296
259376
  const _b44ActorState = new WeakMap();
@@ -259321,10 +259401,10 @@ const _b44RunActor = (actor, request, callback) => {
259321
259401
  state.runtimeEnv = runtimeEnv;
259322
259402
  return _b44RunWithActorEnvironment(state.ctx, state.env, runtimeEnv, callback);
259323
259403
  };
259324
- const _b44IsPlatformEvent = (request) => {
259404
+ const _b44IsActorRequest = (request) => {
259325
259405
  if (request.method !== "POST") return false;
259326
259406
  const parts = new URL(request.url).pathname.split("/");
259327
- return parts.length === 5 && parts[1] === "parties" && parts[4] === "events";
259407
+ return parts.length === 5 && parts[1] === "parties" && parts[4] === "requests";
259328
259408
  };
259329
259409
 
259330
259410
  export class ${doClassName} extends Base44UserActor {
@@ -259338,10 +259418,10 @@ export class ${doClassName} extends Base44UserActor {
259338
259418
  }
259339
259419
 
259340
259420
  fetch(request) {
259341
- // Ahead of the user's own fetch override: a platform event is the wrapper's,
259342
- // never a request the room handles itself.
259343
- if (_b44IsPlatformEvent(request)) {
259344
- return _b44RunActor(this, request, () => this._b44PlatformEvent(request));
259421
+ // Ahead of the user's own fetch override: a relayed call reaches the room only
259422
+ // through the shim, which runs a callable method with the verified identity.
259423
+ if (_b44IsActorRequest(request)) {
259424
+ return _b44RunActor(this, request, () => this._b44ActorCall(request));
259345
259425
  }
259346
259426
  return _b44RunActor(this, request, () => super.fetch(request));
259347
259427
  }
@@ -259376,8 +259456,8 @@ export default {
259376
259456
  const parts = url.pathname.split("/");
259377
259457
  const direct = parts[1] === "rooms" && parts.length === 3;
259378
259458
  const legacy = parts[1] === "parties" && parts.length === 4;
259379
- const event = request.method === "POST" && parts[1] === "rooms" && parts.length === 4 && parts[3] === "events";
259380
- if (direct || legacy || event) {
259459
+ const relayed = request.method === "POST" && parts[1] === "rooms" && parts.length === 4 && parts[3] === "requests";
259460
+ if (direct || legacy || relayed) {
259381
259461
  // Decode the room: the token was verified against the decoded instance id,
259382
259462
  // so an escaped room must map to the same Durable Object.
259383
259463
  const namespace = legacy ? parts[2] : "${doClassName}";
@@ -259385,12 +259465,10 @@ export default {
259385
259465
  let room;
259386
259466
  try { room = decodeURIComponent(encodedRoom); } catch { return new Response("Invalid room", { status: 400 }); }
259387
259467
  let actorRequest = request;
259388
- if (event) {
259389
- const verification = await _b44VerifyActorEvent(request, env, "${doClassName}", room);
259468
+ if (relayed) {
259469
+ const verification = await _b44VerifyActorRequest(request, env, "${doClassName}", room);
259390
259470
  if (!verification.ok) return verification.response;
259391
- const platformEvent = await _b44ReadPlatformEvent(request, verification.eventId);
259392
- if (!platformEvent.ok) return platformEvent.response;
259393
- actorRequest = _b44PlatformEventRequest(request, env, "${doClassName}", room, platformEvent.event);
259471
+ actorRequest = _b44ActorRequestToRoom(request, "${doClassName}", room, verification);
259394
259472
  } else if (direct || typeof env.BASE44_ACTOR_PUBLIC_KEY === "string") {
259395
259473
  const verification = await _b44VerifyActorConnection(request, env, "${doClassName}", room);
259396
259474
  if (!verification.ok) return verification.response;
@@ -264688,13 +264766,29 @@ async function readMcpConfig(configDir) {
264688
264766
  const path = join30(configDir, "mcp", "config.json");
264689
264767
  return await pathExists(path) ? await readTextFile(path) : "";
264690
264768
  }
264769
+ async function readAgentSkillFiles(dir) {
264770
+ if (!await pathExists(dir)) {
264771
+ return {};
264772
+ }
264773
+ const files = await globby("*.md", {
264774
+ cwd: dir,
264775
+ onlyFiles: true,
264776
+ followSymbolicLinks: false
264777
+ });
264778
+ const skills = {};
264779
+ for (const file of files.sort()) {
264780
+ skills[file.replace(/\.md$/, "")] = await readTextFile(join30(dir, file));
264781
+ }
264782
+ return skills;
264783
+ }
264691
264784
  async function collectResources(configDir, dirs) {
264692
- const [entities, agents, mcpConfig] = await Promise.all([
264785
+ const [entities, agents, mcpConfig, agentSkills] = await Promise.all([
264693
264786
  readRawResources(join30(configDir, dirs.entitiesDir)),
264694
264787
  readRawResources(join30(configDir, dirs.agentsDir)),
264695
- readMcpConfig(configDir)
264788
+ readMcpConfig(configDir),
264789
+ readAgentSkillFiles(join30(configDir, dirs.agentSkillsDir))
264696
264790
  ]);
264697
- return { entities, agents, mcpConfig };
264791
+ return { entities, agents, mcpConfig, agentSkills };
264698
264792
  }
264699
264793
  async function collectArtifacts(target) {
264700
264794
  const built = await resolveFullStackBuild(target.root);
@@ -275213,4 +275307,4 @@ export {
275213
275307
  runCLI
275214
275308
  };
275215
275309
 
275216
- //# debugId=CB629F837A2727B764756E2164756E21
275310
+ //# debugId=94AB1C17F7B06B9364756E2164756E21