lavish-axi 0.1.48 → 0.1.49

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.mjs CHANGED
@@ -4496,7 +4496,7 @@ function attrValue(attrs, name) {
4496
4496
  import crypto4 from "node:crypto";
4497
4497
  import { EventEmitter } from "node:events";
4498
4498
  import { existsSync as existsSync2 } from "node:fs";
4499
- import { readFile as readFile4 } from "node:fs/promises";
4499
+ import { readFile as readFile4, realpath as realpath3 } from "node:fs/promises";
4500
4500
  import { homedir } from "node:os";
4501
4501
  import path6 from "node:path";
4502
4502
  import { fileURLToPath as fileURLToPath3 } from "node:url";
@@ -7811,7 +7811,7 @@ async function serve({
7811
7811
  return;
7812
7812
  }
7813
7813
  const root = path6.dirname(session.file);
7814
- const file = resolveArtifactAsset(root, assetPath);
7814
+ const file = await resolveArtifactAsset(root, assetPath);
7815
7815
  if (!file) {
7816
7816
  res.status(403).send("Forbidden");
7817
7817
  return;
@@ -7936,9 +7936,9 @@ data: ${JSON.stringify({ state: computePresence(req.params.key, activePolls, del
7936
7936
  res.setHeader("cache-control", "no-store");
7937
7937
  res.type("html").send(createWhiteboardFrameHtml(createWhiteboardChannelToken(whiteboardChannelSecret)));
7938
7938
  });
7939
- app.get(/^\/whiteboard-assets\/(.+)$/, (req, res, next) => {
7939
+ app.get(/^\/whiteboard-assets\/(.+)$/, async (req, res, next) => {
7940
7940
  try {
7941
- const file = resolveArtifactAsset(whiteboardAssetsDir, req.params[0]);
7941
+ const file = await resolveArtifactAsset(whiteboardAssetsDir, req.params[0]);
7942
7942
  if (!file) {
7943
7943
  res.status(403).send("Forbidden");
7944
7944
  return;
@@ -8234,13 +8234,32 @@ function optionalBodyString(value) {
8234
8234
  const trimmed = String(value ?? "").trim();
8235
8235
  return trimmed || void 0;
8236
8236
  }
8237
- function resolveArtifactAsset(root, assetPath) {
8237
+ async function resolveArtifactAsset(root, assetPath) {
8238
8238
  const file = path6.resolve(root, assetPath);
8239
8239
  const relative = path6.relative(root, file);
8240
8240
  if (relative.startsWith("..") || path6.isAbsolute(relative)) {
8241
8241
  return null;
8242
8242
  }
8243
- return file;
8243
+ let real;
8244
+ try {
8245
+ real = await realpath3(file);
8246
+ } catch (error) {
8247
+ if (error?.code === "ENOENT" || error?.code === "ENOTDIR") {
8248
+ return file;
8249
+ }
8250
+ throw error;
8251
+ }
8252
+ let realRoot;
8253
+ try {
8254
+ realRoot = await realpath3(root);
8255
+ } catch {
8256
+ realRoot = path6.resolve(root);
8257
+ }
8258
+ const relativeReal = path6.relative(realRoot, real);
8259
+ if (relativeReal === ".." || relativeReal.startsWith(`..${path6.sep}`) || path6.isAbsolute(relativeReal)) {
8260
+ return null;
8261
+ }
8262
+ return real;
8244
8263
  }
8245
8264
  async function watchSession(session, watchers, events, logEvent, reloadDebounceMs = () => RELOAD_DEBOUNCE_MS) {
8246
8265
  if (watchers.has(session.key)) {
@@ -8716,7 +8735,7 @@ var POLL_WAKE_PATH_RULES = Object.freeze([
8716
8735
  ]);
8717
8736
  var POLL_SEND_AND_END_RULE = "`Send & End` ends the session. Its final feedback is still delivered once. After that response, polling stops, and the agent must not reopen the session uninvited.";
8718
8737
  var CODEX_POLL_WAKE_PATH_GUIDANCE = "Codex detected: completed background tasks may not resume Codex automatically, so keep the poll attached to the active turn.";
8719
- var VERSION = "0.1.48";
8738
+ var VERSION = "0.1.49";
8720
8739
  function detectInvokingAgent(env = process.env) {
8721
8740
  return ["CODEX_SANDBOX", "CODEX_THREAD_ID"].some((key) => Object.hasOwn(env, key)) ? "codex" : "generic";
8722
8741
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lavish-axi",
3
- "version": "0.1.48",
3
+ "version": "0.1.49",
4
4
  "packageManager": "pnpm@11.1.1",
5
5
  "description": "HTML is the new markdown. Lavish is the new editor for your HTML artifacts.",
6
6
  "type": "module",
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "lavish-axi",
4
- "version": "0.1.48",
4
+ "version": "0.1.49",
5
5
  "description": "HTML is the new markdown. Lavish is the new editor for your HTML artifacts.",
6
6
  "author": {
7
7
  "name": "Kun Chen",