@promptframe/creation 0.3.7 → 0.3.8

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
@@ -407,11 +407,11 @@ var require_codegen = __commonJS({
407
407
  const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
408
408
  return `${varKind} ${this.name}${rhs};` + _n2;
409
409
  }
410
- optimizeNames(names, constants6) {
410
+ optimizeNames(names, constants7) {
411
411
  if (!names[this.name.str])
412
412
  return;
413
413
  if (this.rhs)
414
- this.rhs = optimizeExpr(this.rhs, names, constants6);
414
+ this.rhs = optimizeExpr(this.rhs, names, constants7);
415
415
  return this;
416
416
  }
417
417
  get names() {
@@ -428,10 +428,10 @@ var require_codegen = __commonJS({
428
428
  render({ _n: _n2 }) {
429
429
  return `${this.lhs} = ${this.rhs};` + _n2;
430
430
  }
431
- optimizeNames(names, constants6) {
431
+ optimizeNames(names, constants7) {
432
432
  if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
433
433
  return;
434
- this.rhs = optimizeExpr(this.rhs, names, constants6);
434
+ this.rhs = optimizeExpr(this.rhs, names, constants7);
435
435
  return this;
436
436
  }
437
437
  get names() {
@@ -492,8 +492,8 @@ var require_codegen = __commonJS({
492
492
  optimizeNodes() {
493
493
  return `${this.code}` ? this : void 0;
494
494
  }
495
- optimizeNames(names, constants6) {
496
- this.code = optimizeExpr(this.code, names, constants6);
495
+ optimizeNames(names, constants7) {
496
+ this.code = optimizeExpr(this.code, names, constants7);
497
497
  return this;
498
498
  }
499
499
  get names() {
@@ -522,12 +522,12 @@ var require_codegen = __commonJS({
522
522
  }
523
523
  return nodes.length > 0 ? this : void 0;
524
524
  }
525
- optimizeNames(names, constants6) {
525
+ optimizeNames(names, constants7) {
526
526
  const { nodes } = this;
527
527
  let i = nodes.length;
528
528
  while (i--) {
529
529
  const n = nodes[i];
530
- if (n.optimizeNames(names, constants6))
530
+ if (n.optimizeNames(names, constants7))
531
531
  continue;
532
532
  subtractNames(names, n.names);
533
533
  nodes.splice(i, 1);
@@ -580,12 +580,12 @@ var require_codegen = __commonJS({
580
580
  return void 0;
581
581
  return this;
582
582
  }
583
- optimizeNames(names, constants6) {
583
+ optimizeNames(names, constants7) {
584
584
  var _a3;
585
- this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants6);
586
- if (!(super.optimizeNames(names, constants6) || this.else))
585
+ this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants7);
586
+ if (!(super.optimizeNames(names, constants7) || this.else))
587
587
  return;
588
- this.condition = optimizeExpr(this.condition, names, constants6);
588
+ this.condition = optimizeExpr(this.condition, names, constants7);
589
589
  return this;
590
590
  }
591
591
  get names() {
@@ -608,10 +608,10 @@ var require_codegen = __commonJS({
608
608
  render(opts) {
609
609
  return `for(${this.iteration})` + super.render(opts);
610
610
  }
611
- optimizeNames(names, constants6) {
612
- if (!super.optimizeNames(names, constants6))
611
+ optimizeNames(names, constants7) {
612
+ if (!super.optimizeNames(names, constants7))
613
613
  return;
614
- this.iteration = optimizeExpr(this.iteration, names, constants6);
614
+ this.iteration = optimizeExpr(this.iteration, names, constants7);
615
615
  return this;
616
616
  }
617
617
  get names() {
@@ -647,10 +647,10 @@ var require_codegen = __commonJS({
647
647
  render(opts) {
648
648
  return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
649
649
  }
650
- optimizeNames(names, constants6) {
651
- if (!super.optimizeNames(names, constants6))
650
+ optimizeNames(names, constants7) {
651
+ if (!super.optimizeNames(names, constants7))
652
652
  return;
653
- this.iterable = optimizeExpr(this.iterable, names, constants6);
653
+ this.iterable = optimizeExpr(this.iterable, names, constants7);
654
654
  return this;
655
655
  }
656
656
  get names() {
@@ -692,11 +692,11 @@ var require_codegen = __commonJS({
692
692
  (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
693
693
  return this;
694
694
  }
695
- optimizeNames(names, constants6) {
695
+ optimizeNames(names, constants7) {
696
696
  var _a3, _b;
697
- super.optimizeNames(names, constants6);
698
- (_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants6);
699
- (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants6);
697
+ super.optimizeNames(names, constants7);
698
+ (_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants7);
699
+ (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants7);
700
700
  return this;
701
701
  }
702
702
  get names() {
@@ -997,7 +997,7 @@ var require_codegen = __commonJS({
997
997
  function addExprNames(names, from) {
998
998
  return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
999
999
  }
1000
- function optimizeExpr(expr, names, constants6) {
1000
+ function optimizeExpr(expr, names, constants7) {
1001
1001
  if (expr instanceof code_1.Name)
1002
1002
  return replaceName(expr);
1003
1003
  if (!canOptimize(expr))
@@ -1012,14 +1012,14 @@ var require_codegen = __commonJS({
1012
1012
  return items;
1013
1013
  }, []));
1014
1014
  function replaceName(n) {
1015
- const c = constants6[n.str];
1015
+ const c = constants7[n.str];
1016
1016
  if (c === void 0 || names[n.str] !== 1)
1017
1017
  return n;
1018
1018
  delete names[n.str];
1019
1019
  return c;
1020
1020
  }
1021
1021
  function canOptimize(e) {
1022
- return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants6[c.str] !== void 0);
1022
+ return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants7[c.str] !== void 0);
1023
1023
  }
1024
1024
  }
1025
1025
  function subtractNames(names, from) {
@@ -3259,8 +3259,8 @@ var require_utils = __commonJS({
3259
3259
  }
3260
3260
  return ind;
3261
3261
  }
3262
- function removeDotSegments(path17) {
3263
- let input = path17;
3262
+ function removeDotSegments(path18) {
3263
+ let input = path18;
3264
3264
  const output = [];
3265
3265
  let nextSlash = -1;
3266
3266
  let len = 0;
@@ -3669,8 +3669,8 @@ var require_schemes = __commonJS({
3669
3669
  }
3670
3670
  if (wsComponent.resourceName) {
3671
3671
  const queryIndex = wsComponent.resourceName.indexOf("?");
3672
- const path17 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
3673
- wsComponent.path = path17 && path17 !== "/" ? path17 : void 0;
3672
+ const path18 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
3673
+ wsComponent.path = path18 && path18 !== "/" ? path18 : void 0;
3674
3674
  wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
3675
3675
  wsComponent.resourceName = void 0;
3676
3676
  }
@@ -7401,12 +7401,12 @@ import { Readable } from "node:stream";
7401
7401
  import { finished } from "node:stream/promises";
7402
7402
  var LOCAL_UPLOAD_MAX_BYTES = 2 * 1024 ** 3;
7403
7403
  var LOCAL_UPLOAD_READ_BYTES = 64 * 1024;
7404
- var fingerprint = (stat2) => ({
7405
- dev: String(stat2.dev),
7406
- ino: String(stat2.ino),
7407
- sizeBytes: Number(stat2.size),
7408
- mtimeNs: String(stat2.mtimeNs),
7409
- ctimeNs: String(stat2.ctimeNs)
7404
+ var fingerprint = (stat3) => ({
7405
+ dev: String(stat3.dev),
7406
+ ino: String(stat3.ino),
7407
+ sizeBytes: Number(stat3.size),
7408
+ mtimeNs: String(stat3.mtimeNs),
7409
+ ctimeNs: String(stat3.ctimeNs)
7410
7410
  });
7411
7411
  var equal = (left, right) => Object.keys(left).every((key) => left[key] === right[key]);
7412
7412
  var failure = (code) => new CreationClientError("creation.local_upload." + code);
@@ -7461,10 +7461,10 @@ async function openLocalUploadFile(selectedPath, { maxBytes: maxBytes2 = LOCAL_U
7461
7461
  })();
7462
7462
  try {
7463
7463
  checkSignal();
7464
- const stat2 = await handle.stat({ bigint: true });
7465
- if (!stat2.isFile()) throw failure("file_not_regular");
7466
- if (stat2.size <= 0n || stat2.size > BigInt(maxBytes2)) throw failure("file_size_limit");
7467
- original = fingerprint(stat2);
7464
+ const stat3 = await handle.stat({ bigint: true });
7465
+ if (!stat3.isFile()) throw failure("file_not_regular");
7466
+ if (stat3.size <= 0n || stat3.size > BigInt(maxBytes2)) throw failure("file_size_limit");
7467
+ original = fingerprint(stat3);
7468
7468
  await assertUnchanged();
7469
7469
  const hash6 = createHash("sha256"), buffer = Buffer.allocUnsafe(LOCAL_UPLOAD_READ_BYTES);
7470
7470
  for (let position = 0; position < original.sizeBytes; ) {
@@ -7694,8 +7694,8 @@ async function syncDirectory(root) {
7694
7694
  async function birth(pid) {
7695
7695
  if (process.platform !== "linux") return null;
7696
7696
  try {
7697
- const stat2 = await readFile2(`/proc/${pid}/stat`, "utf8"), end = stat2.lastIndexOf(")");
7698
- return { boot: (await readFile2("/proc/sys/kernel/random/boot_id", "utf8")).trim(), start: stat2.slice(end + 2).split(" ")[19] };
7697
+ const stat3 = await readFile2(`/proc/${pid}/stat`, "utf8"), end = stat3.lastIndexOf(")");
7698
+ return { boot: (await readFile2("/proc/sys/kernel/random/boot_id", "utf8")).trim(), start: stat3.slice(end + 2).split(" ")[19] };
7699
7699
  } catch (e) {
7700
7700
  if (e.code === "ENOENT") return false;
7701
7701
  fail2();
@@ -8314,7 +8314,7 @@ function createLocalUploadManager({ stateRoot, fetch: fetch2 = globalThis.fetch,
8314
8314
  }
8315
8315
 
8316
8316
  // lib/version.mjs
8317
- var CLIENT_VERSION = "0.3.7";
8317
+ var CLIENT_VERSION = "0.3.8";
8318
8318
  var CLIENT_PROTOCOL = "creation-client/v1";
8319
8319
 
8320
8320
  // lib/cli.mjs
@@ -8558,10 +8558,10 @@ function mergeDefs(...defs) {
8558
8558
  function cloneDef(schema) {
8559
8559
  return mergeDefs(schema._zod.def);
8560
8560
  }
8561
- function getElementAtPath(obj, path17) {
8562
- if (!path17)
8561
+ function getElementAtPath(obj, path18) {
8562
+ if (!path18)
8563
8563
  return obj;
8564
- return path17.reduce((acc, key) => acc?.[key], obj);
8564
+ return path18.reduce((acc, key) => acc?.[key], obj);
8565
8565
  }
8566
8566
  function promiseAllObject(promisesObj) {
8567
8567
  const keys = Object.keys(promisesObj);
@@ -8901,11 +8901,11 @@ function explicitlyAborted(x, startIndex = 0) {
8901
8901
  }
8902
8902
  return false;
8903
8903
  }
8904
- function prefixIssues(path17, issues) {
8904
+ function prefixIssues(path18, issues) {
8905
8905
  return issues.map((iss) => {
8906
8906
  var _a3;
8907
8907
  (_a3 = iss).path ?? (_a3.path = []);
8908
- iss.path.unshift(path17);
8908
+ iss.path.unshift(path18);
8909
8909
  return iss;
8910
8910
  });
8911
8911
  }
@@ -9366,16 +9366,16 @@ function flattenError(error4, mapper = (issue2) => issue2.message) {
9366
9366
  }
9367
9367
  function formatError(error4, mapper = (issue2) => issue2.message) {
9368
9368
  const fieldErrors = { _errors: [] };
9369
- const processError = (error5, path17 = []) => {
9369
+ const processError = (error5, path18 = []) => {
9370
9370
  for (const issue2 of error5.issues) {
9371
9371
  if (issue2.code === "invalid_union" && issue2.errors.length) {
9372
- issue2.errors.map((issues) => processError({ issues }, [...path17, ...issue2.path]));
9372
+ issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
9373
9373
  } else if (issue2.code === "invalid_key") {
9374
- processError({ issues: issue2.issues }, [...path17, ...issue2.path]);
9374
+ processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
9375
9375
  } else if (issue2.code === "invalid_element") {
9376
- processError({ issues: issue2.issues }, [...path17, ...issue2.path]);
9376
+ processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
9377
9377
  } else {
9378
- const fullpath = [...path17, ...issue2.path];
9378
+ const fullpath = [...path18, ...issue2.path];
9379
9379
  if (fullpath.length === 0) {
9380
9380
  fieldErrors._errors.push(mapper(issue2));
9381
9381
  } else {
@@ -21021,6 +21021,42 @@ async function runClaudeHostHook({ configFile: configFile2, input = process.stdi
21021
21021
  output.write(JSON.stringify(await store.hook(body)) + "\n");
21022
21022
  }
21023
21023
 
21024
+ // lib/development-pairing.mjs
21025
+ import { open as open5, stat as stat2 } from "node:fs/promises";
21026
+ import { constants as constants4 } from "node:fs";
21027
+ import path7 from "node:path";
21028
+ async function readDevelopmentPairingFile(filePath, { signal } = {}) {
21029
+ const fail8 = () => {
21030
+ throw new CreationClientError("creation.development_pairing.private_file_unavailable");
21031
+ };
21032
+ if (typeof filePath !== "string" || filePath.length > 4096 || !path7.isAbsolute(filePath)) fail8();
21033
+ let file;
21034
+ try {
21035
+ signal?.throwIfAborted();
21036
+ file = await open5(filePath, constants4.O_RDONLY | constants4.O_NOFOLLOW | constants4.O_NONBLOCK);
21037
+ const before = await file.stat();
21038
+ if (!before.isFile() || before.size < 2 || before.size > 8192 || process.platform !== "win32" && ((before.mode & 63) !== 0 || before.uid !== process.getuid())) fail8();
21039
+ const bytes2 = Buffer.alloc(before.size);
21040
+ let offset = 0;
21041
+ while (offset < bytes2.length) {
21042
+ signal?.throwIfAborted();
21043
+ const read2 = await file.read(bytes2, offset, bytes2.length - offset, offset);
21044
+ if (!read2.bytesRead) fail8();
21045
+ offset += read2.bytesRead;
21046
+ }
21047
+ const after = await file.stat(), named = await stat2(filePath);
21048
+ signal?.throwIfAborted();
21049
+ if ([after, named].some((value3) => value3.dev !== before.dev || value3.ino !== before.ino || value3.size !== before.size || value3.mtimeMs !== before.mtimeMs || value3.ctimeMs !== before.ctimeMs)) fail8();
21050
+ const value2 = JSON.parse(bytes2.toString("utf8"));
21051
+ if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) fail8();
21052
+ return Object.fromEntries(["url", "connectionId", "credential", "studioOrigin", "expiresAt", "contractVersion", "lifecycle"].filter((key) => Object.hasOwn(value2, key)).map((key) => [key, value2[key]]));
21053
+ } catch {
21054
+ fail8();
21055
+ } finally {
21056
+ await file?.close();
21057
+ }
21058
+ }
21059
+
21024
21060
  // lib/host-context.mjs
21025
21061
  var digestPattern = /^sha256:[a-f0-9]{64}$/;
21026
21062
  var accesses = /* @__PURE__ */ new Set(["independent-read", "controlled", "authority"]);
@@ -21104,7 +21140,7 @@ function createHostCallBridge(client, { credentials, host = resolveHostIdentity(
21104
21140
  const schema = local?.contractVersion === LOCAL_UPLOAD_PROTOCOL ? local.inputSchema : tool.inputSchema;
21105
21141
  if (!schema || schema.type !== "object") throw new CreationClientError("creation.upgrade_required");
21106
21142
  const p2 = schema.properties;
21107
- const { controlVersion: _managed, ...properties } = p2 ?? {};
21143
+ const { controlVersion: _managed, developmentPairing: _privatePairing, ...properties } = p2 ?? {};
21108
21144
  return { ...tool, inputSchema: { ...schema, properties: { ...properties, ...host.kind === "claude-code" ? {
21109
21145
  [CLAUDE_HOST_PROOF]: { type: "string", pattern: "^[a-f0-9]{64}$", description: "\u7531\u5F53\u524D\u5BBF\u4E3Bhook\u586B\u5165\u7684\u5355\u6B21\u8EAB\u4EFD\u51ED\u8BC1\uFF1B\u8BF7\u4FDD\u7559\uFF0C\u4E0D\u81EA\u884C\u586B\u5199\u3002" }
21110
21146
  } : {} }, ...schema.required ? { required: schema.required.filter((name) => name !== "controlVersion") } : {} } };
@@ -21167,7 +21203,7 @@ function createHostCallBridge(client, { credentials, host = resolveHostIdentity(
21167
21203
  getPrompt: (params) => knowledgeRead("prompts", "getPrompt", params),
21168
21204
  close: () => localUploads?.close(),
21169
21205
  async call(raw, { signal } = {}) {
21170
- for (const field of ["threadId", "controller", "clientDigest", "token", "controlVersion"]) if (Object.hasOwn(raw.arguments ?? {}, field))
21206
+ for (const field of ["threadId", "controller", "clientDigest", "token", "controlVersion", "developmentPairing"]) if (Object.hasOwn(raw.arguments ?? {}, field))
21171
21207
  throw new CreationClientError("creation.transport_authority_managed_by_bridge");
21172
21208
  let binding = { host, arguments: raw.arguments, assertCurrent: async () => {
21173
21209
  } };
@@ -21251,6 +21287,13 @@ function createHostCallBridge(client, { credentials, host = resolveHostIdentity(
21251
21287
  }
21252
21288
  }
21253
21289
  const dispatched = key && versions.get(key);
21290
+ if (params.arguments?.tool === "studio_preview" && params.arguments.arguments?.connectionFile !== void 0) {
21291
+ if (definition._meta["promptframe.localDevelopmentPairing"] !== "creation-development-pairing/v1" || effectiveAccess !== "controlled" || params.arguments.arguments.action !== "connect_development")
21292
+ throw new CreationClientError("creation.development_pairing.unsupported");
21293
+ const pairing = await readDevelopmentPairingFile(params.arguments.arguments.connectionFile, { signal });
21294
+ await binding.assertCurrent();
21295
+ outgoing = { ...outgoing, arguments: { ...outgoing.arguments, developmentPairing: pairing } };
21296
+ }
21254
21297
  const invalidate = () => {
21255
21298
  if (host.kind === "claude-code" && binding.epoch !== hostEpoch) return;
21256
21299
  const current = key && versions.get(key);
@@ -24244,15 +24287,15 @@ var To = (s3) => {
24244
24287
  };
24245
24288
 
24246
24289
  // lib/runtime-bootstrap.mjs
24247
- import { lstat as lstat6, mkdir as mkdir4, open as open5, readFile as readFile5, readdir as readdir3, rename as rename4, rm, statfs } from "node:fs/promises";
24290
+ import { lstat as lstat6, mkdir as mkdir4, open as open6, readFile as readFile5, readdir as readdir3, rename as rename4, rm, statfs } from "node:fs/promises";
24248
24291
  import { execFile } from "node:child_process";
24249
24292
  import { promisify } from "node:util";
24250
- import path8 from "node:path";
24293
+ import path9 from "node:path";
24251
24294
 
24252
24295
  // lib/runtime-package.mjs
24253
24296
  import { lstat as lstat5, readdir as readdir2, readFile as readFile4 } from "node:fs/promises";
24254
24297
  import { createHash as createHash6 } from "node:crypto";
24255
- import path7 from "node:path";
24298
+ import path8 from "node:path";
24256
24299
  var RUNTIME_PACKAGE_ENTRIES = Object.freeze(["package.json", "README.md", "LICENSE", "bin", "dist", "lib", "skills", "docs", ".codex-plugin", ".mcp.json"]);
24257
24300
  var OPTIONAL_HOST_ENTRIES = Object.freeze([".claude-plugin", ".claude-mcp.json"]);
24258
24301
  var hash2 = (b2) => createHash6("sha256").update(b2).digest("hex");
@@ -24264,7 +24307,7 @@ async function inspectRuntimePackage(root, { entries } = {}) {
24264
24307
  entries = [...RUNTIME_PACKAGE_ENTRIES];
24265
24308
  for (const name of OPTIONAL_HOST_ENTRIES) {
24266
24309
  try {
24267
- await lstat5(path7.join(root, name));
24310
+ await lstat5(path8.join(root, name));
24268
24311
  entries.push(name);
24269
24312
  } catch (e) {
24270
24313
  if (e.code !== "ENOENT") throw e;
@@ -24276,19 +24319,19 @@ async function inspectRuntimePackage(root, { entries } = {}) {
24276
24319
  async function walk(relative) {
24277
24320
  let s3;
24278
24321
  try {
24279
- s3 = await lstat5(path7.join(root, relative));
24322
+ s3 = await lstat5(path8.join(root, relative));
24280
24323
  } catch (error4) {
24281
24324
  if (error4.code !== "ENOENT") throw error4;
24282
24325
  }
24283
24326
  if (!s3 || s3.isSymbolicLink()) invalid("package_file_invalid");
24284
24327
  if (s3.isDirectory()) {
24285
- for (const name of (await readdir2(path7.join(root, relative))).sort()) {
24328
+ for (const name of (await readdir2(path8.join(root, relative))).sort()) {
24286
24329
  if (name === "node_modules" || name === "credentials.json" || name.startsWith(".env")) invalid("package_file_invalid");
24287
- await walk(path7.join(relative, name));
24330
+ await walk(path8.join(relative, name));
24288
24331
  }
24289
24332
  } else if (s3.isFile()) {
24290
24333
  if (s3.size > 32 * 1024 * 1024) invalid("package_too_large");
24291
- const body = await readFile4(path7.join(root, relative));
24334
+ const body = await readFile4(path8.join(root, relative));
24292
24335
  bytes2 += body.length;
24293
24336
  if (files.length >= 1024 || bytes2 > 32 * 1024 * 1024) invalid("package_too_large");
24294
24337
  files.push({ path: relative, bytes: body.length, sha256: hash2(body), body });
@@ -24305,7 +24348,7 @@ async function inspectRuntimePackage(root, { entries } = {}) {
24305
24348
  files,
24306
24349
  version: pkg.version,
24307
24350
  hosts: claude ? ["codex", "claude-code"] : ["codex"],
24308
- payloadDigest: hash2(JSON.stringify(files.map(({ path: path17, bytes: bytes3, sha256 }) => ({ path: path17, bytes: bytes3, sha256 }))))
24351
+ payloadDigest: hash2(JSON.stringify(files.map(({ path: path18, bytes: bytes3, sha256 }) => ({ path: path18, bytes: bytes3, sha256 }))))
24309
24352
  };
24310
24353
  }
24311
24354
 
@@ -24340,7 +24383,7 @@ var snapshot = (payload) => ({
24340
24383
  version: payload.version,
24341
24384
  hosts: payload.hosts,
24342
24385
  payloadDigest: payload.payloadDigest,
24343
- files: payload.files.map(({ path: path17, bytes: bytes2, sha256 }) => ({ path: path17, bytes: bytes2, sha256 }))
24386
+ files: payload.files.map(({ path: path18, bytes: bytes2, sha256 }) => ({ path: path18, bytes: bytes2, sha256 }))
24344
24387
  });
24345
24388
  async function info(file) {
24346
24389
  try {
@@ -24362,7 +24405,7 @@ async function privateJSON(file) {
24362
24405
  return JSON.parse(await readFile5(file, "utf8"));
24363
24406
  }
24364
24407
  async function syncDirectory2(dir) {
24365
- const fd = await open5(dir, "r");
24408
+ const fd = await open6(dir, "r");
24366
24409
  try {
24367
24410
  await fd.sync();
24368
24411
  } finally {
@@ -24370,7 +24413,7 @@ async function syncDirectory2(dir) {
24370
24413
  }
24371
24414
  }
24372
24415
  async function exclusiveJSON(file, value2) {
24373
- const fd = await open5(file, "wx", 384);
24416
+ const fd = await open6(file, "wx", 384);
24374
24417
  try {
24375
24418
  await fd.writeFile(JSON.stringify(value2) + "\n");
24376
24419
  await fd.sync();
@@ -24460,12 +24503,12 @@ async function readRuntimeArchive(archive, metadata) {
24460
24503
  return files;
24461
24504
  }
24462
24505
  async function cacheLock(root, signal) {
24463
- const name = path8.join(root, "prepare.lock"), end = Date.now() + 5e3;
24506
+ const name = path9.join(root, "prepare.lock"), end = Date.now() + 5e3;
24464
24507
  let fd;
24465
24508
  while (!fd) {
24466
24509
  signal?.throwIfAborted();
24467
24510
  try {
24468
- fd = await open5(name, "wx", 384);
24511
+ fd = await open6(name, "wx", 384);
24469
24512
  } catch (e) {
24470
24513
  if (e.code !== "EEXIST") throw e;
24471
24514
  if (Date.now() >= end) throw error3("runtime_cache_busy");
@@ -24493,7 +24536,7 @@ async function cacheLock(root, signal) {
24493
24536
  async function verifyCached(target, metadata, hostKind) {
24494
24537
  if (!await info(target)) return null;
24495
24538
  await privateDirectory2(target);
24496
- const manifest = await privateJSON(path8.join(target, "runtime.json"));
24539
+ const manifest = await privateJSON(path9.join(target, "runtime.json"));
24497
24540
  if (!manifest || manifest.contractVersion !== "creation-verified-runtime/v1" || manifest.version !== metadata.version || manifest.integrity !== metadata.integrity)
24498
24541
  throw error3("runtime_cache_invalid");
24499
24542
  const names = (await readdir3(target)).filter((name) => name !== "runtime.json").sort();
@@ -24504,21 +24547,21 @@ async function verifyCached(target, metadata, hostKind) {
24504
24547
  return { version: payload.version, root: target, integrity: metadata.integrity, reused: true };
24505
24548
  }
24506
24549
  async function checkedVersionIndex(cacheRoot, metadata) {
24507
- const old = await privateJSON(path8.join(cacheRoot, "version-" + metadata.version + ".json"));
24550
+ const old = await privateJSON(path9.join(cacheRoot, "version-" + metadata.version + ".json"));
24508
24551
  if (old && JSON.stringify(old) !== JSON.stringify(metadata)) throw error3("runtime_registry_identity_conflict");
24509
24552
  return old;
24510
24553
  }
24511
24554
  async function prepareVerifiedRuntime(metadata, { cacheRoot, fetchImpl = fetch, signal, checkRuntime, hostKind = "codex" } = {}) {
24512
24555
  if (!["codex", "claude-code"].includes(hostKind)) throw error3("runtime_host_unsupported");
24513
- if (!path8.isAbsolute(cacheRoot ?? "")) throw error3("runtime_cache_owner_invalid");
24556
+ if (!path9.isAbsolute(cacheRoot ?? "")) throw error3("runtime_cache_owner_invalid");
24514
24557
  metadata = checkedRuntimeMetadata({ name: PACKAGE, version: metadata.version, dist: metadata }, metadata.version);
24515
24558
  await privateDirectory2(cacheRoot);
24516
24559
  await checkedVersionIndex(cacheRoot, metadata);
24517
- const target = path8.join(cacheRoot, metadata.version + "-" + hash3(metadata.integrity)), existing = await verifyCached(target, metadata, hostKind);
24560
+ const target = path9.join(cacheRoot, metadata.version + "-" + hash3(metadata.integrity)), existing = await verifyCached(target, metadata, hostKind);
24518
24561
  if (existing) return existing;
24519
24562
  const archive = await boundedGet(metadata.tarball, { fetchImpl, signal, maxBytes: MAX_ARCHIVE, timeoutMs: 15e3 });
24520
24563
  const files = await readRuntimeArchive(archive, metadata), release = await cacheLock(cacheRoot, signal);
24521
- const temporary = path8.join(cacheRoot, ".partial-" + randomBytes4(12).toString("hex"));
24564
+ const temporary = path9.join(cacheRoot, ".partial-" + randomBytes4(12).toString("hex"));
24522
24565
  try {
24523
24566
  const index = await checkedVersionIndex(cacheRoot, metadata);
24524
24567
  const found = await verifyCached(target, metadata, hostKind);
@@ -24528,9 +24571,9 @@ async function prepareVerifiedRuntime(metadata, { cacheRoot, fetchImpl = fetch,
24528
24571
  await mkdir4(temporary, { mode: 448 });
24529
24572
  for (const file of files) {
24530
24573
  signal?.throwIfAborted();
24531
- const dest = path8.join(temporary, ...file.path.split("/"));
24532
- await mkdir4(path8.dirname(dest), { recursive: true, mode: 448 });
24533
- const fd = await open5(dest, "wx", 384);
24574
+ const dest = path9.join(temporary, ...file.path.split("/"));
24575
+ await mkdir4(path9.dirname(dest), { recursive: true, mode: 448 });
24576
+ const fd = await open6(dest, "wx", 384);
24534
24577
  try {
24535
24578
  await fd.writeFile(file.body);
24536
24579
  await fd.sync();
@@ -24549,16 +24592,16 @@ async function prepareVerifiedRuntime(metadata, { cacheRoot, fetchImpl = fetch,
24549
24592
  else {
24550
24593
  const result = await execute(
24551
24594
  process.execPath,
24552
- [path8.join(temporary, "bin/promptframe-creation.mjs"), "--version"],
24595
+ [path9.join(temporary, "bin/promptframe-creation.mjs"), "--version"],
24553
24596
  { timeout: 5e3, maxBuffer: 65536, windowsHide: true, signal, env: {
24554
24597
  ...process.env,
24555
- PROMPTFRAME_CREATION_CONFIG: path8.join(temporary, "no-credentials.json")
24598
+ PROMPTFRAME_CREATION_CONFIG: path9.join(temporary, "no-credentials.json")
24556
24599
  } }
24557
24600
  );
24558
24601
  if (result.stdout.trim() !== metadata.version || result.stderr.trim()) throw error3("runtime_package_version_invalid");
24559
24602
  }
24560
24603
  signal?.throwIfAborted();
24561
- await exclusiveJSON(path8.join(temporary, "runtime.json"), {
24604
+ await exclusiveJSON(path9.join(temporary, "runtime.json"), {
24562
24605
  contractVersion: "creation-verified-runtime/v1",
24563
24606
  version: metadata.version,
24564
24607
  integrity: metadata.integrity,
@@ -24566,7 +24609,7 @@ async function prepareVerifiedRuntime(metadata, { cacheRoot, fetchImpl = fetch,
24566
24609
  });
24567
24610
  await syncDirectory2(temporary);
24568
24611
  if (!index) {
24569
- await exclusiveJSON(path8.join(cacheRoot, "version-" + metadata.version + ".json"), metadata);
24612
+ await exclusiveJSON(path9.join(cacheRoot, "version-" + metadata.version + ".json"), metadata);
24570
24613
  await syncDirectory2(cacheRoot);
24571
24614
  }
24572
24615
  await rename4(temporary, target);
@@ -24608,7 +24651,7 @@ async function selectBridgeRuntime({ policy, currentVersion, lockedVersion, reso
24608
24651
  const raw = await boundedGet(REGISTRY + "/@promptframe%2fcreation/" + target, { fetchImpl, signal, maxBytes: 256 * 1024, timeoutMs: 5e3 });
24609
24652
  metadata = checkedRuntimeMetadata(JSON.parse(raw), target);
24610
24653
  } catch (e) {
24611
- const prior = await privateJSON(path8.join(cacheRoot, "version-" + target + ".json"));
24654
+ const prior = await privateJSON(path9.join(cacheRoot, "version-" + target + ".json"));
24612
24655
  if (!prior) throw e;
24613
24656
  metadata = checkedRuntimeMetadata({ name: PACKAGE, version: target, dist: prior }, target);
24614
24657
  metadataSource = "previously-verified-cache";
@@ -24634,16 +24677,16 @@ async function selectBridgeRuntime({ policy, currentVersion, lockedVersion, reso
24634
24677
 
24635
24678
  // lib/runtime-launch.mjs
24636
24679
  import { spawn } from "node:child_process";
24637
- import path9 from "node:path";
24680
+ import path10 from "node:path";
24638
24681
  async function launchSelectedBridge(selection, { host, configFile: configFile2, spawnImpl = spawn, env = process.env } = {}) {
24639
- if (!path9.isAbsolute(selection.root ?? "") || !path9.isAbsolute(configFile2 ?? "") || !["codex", "claude-code"].includes(host?.kind))
24682
+ if (!path10.isAbsolute(selection.root ?? "") || !path10.isAbsolute(configFile2 ?? "") || !["codex", "claude-code"].includes(host?.kind))
24640
24683
  throw new CreationClientError("creation.runtime_launch_invalid");
24641
24684
  let child;
24642
24685
  try {
24643
24686
  child = spawnImpl(
24644
24687
  process.execPath,
24645
24688
  [
24646
- path9.join(selection.root, "bin/promptframe-creation.mjs"),
24689
+ path10.join(selection.root, "bin/promptframe-creation.mjs"),
24647
24690
  "bridge",
24648
24691
  "--config",
24649
24692
  configFile2,
@@ -24686,9 +24729,9 @@ async function launchSelectedBridge(selection, { host, configFile: configFile2,
24686
24729
  import { execFile as execFile2 } from "node:child_process";
24687
24730
  import { promisify as promisify2 } from "node:util";
24688
24731
  import { createHash as createHash8, randomBytes as randomBytes5 } from "node:crypto";
24689
- import { lstat as lstat7, mkdir as mkdir5, readdir as readdir4, readFile as readFile6, writeFile as writeFile2, rename as rename5, rm as rm2, open as open6 } from "node:fs/promises";
24732
+ import { lstat as lstat7, mkdir as mkdir5, readdir as readdir4, readFile as readFile6, writeFile as writeFile2, rename as rename5, rm as rm2, open as open7 } from "node:fs/promises";
24690
24733
  import { homedir as homedir4 } from "node:os";
24691
- import path10 from "node:path";
24734
+ import path11 from "node:path";
24692
24735
 
24693
24736
  // node_modules/smol-toml/dist/error.js
24694
24737
  function getLineColFromPtr(string4, ptr) {
@@ -25489,8 +25532,8 @@ function validProfile(profile) {
25489
25532
  }
25490
25533
  function profileCredentialsPath(profile = "default", env = process.env) {
25491
25534
  validProfile(profile);
25492
- return profile === "default" ? credentialsPath(env) : path10.resolve(
25493
- env.XDG_CONFIG_HOME ?? path10.join(homedir4(), ".config"),
25535
+ return profile === "default" ? credentialsPath(env) : path11.resolve(
25536
+ env.XDG_CONFIG_HOME ?? path11.join(homedir4(), ".config"),
25494
25537
  "promptframe-creation",
25495
25538
  "profiles",
25496
25539
  profile,
@@ -25522,20 +25565,20 @@ async function packageJSON(file) {
25522
25565
  return json(file);
25523
25566
  }
25524
25567
  function sameTransport(actual, expected) {
25525
- return actual?.type === "stdio" && actual.command === expected.command && typeof actual.cwd === "string" && path10.resolve(actual.cwd) === path10.resolve(expected.cwd) && JSON.stringify(actual.args) === JSON.stringify(expected.args) && JSON.stringify(actual.env_vars ?? []) === JSON.stringify(expected.env_vars ?? []) && !Object.keys(actual.env ?? {}).length;
25568
+ return actual?.type === "stdio" && actual.command === expected.command && typeof actual.cwd === "string" && path11.resolve(actual.cwd) === path11.resolve(expected.cwd) && JSON.stringify(actual.args) === JSON.stringify(expected.args) && JSON.stringify(actual.env_vars ?? []) === JSON.stringify(expected.env_vars ?? []) && !Object.keys(actual.env ?? {}).length;
25526
25569
  }
25527
25570
  async function managedTransport(installed, versions, serverName, profile, configFile2) {
25528
25571
  if (!installed) return null;
25529
25572
  const root = installed.source?.path;
25530
- if (installed.source?.source !== "local" || typeof root !== "string" || !/^\d+\.\d+\.\d+$/.test(installed.version ?? "") || root !== path10.join(versions, installed.version)) fail4("existing_registration_requires_review");
25531
- const directory2 = await info2(root), definition = await info2(path10.join(root, ".mcp.json"));
25573
+ if (installed.source?.source !== "local" || typeof root !== "string" || !/^\d+\.\d+\.\d+$/.test(installed.version ?? "") || root !== path11.join(versions, installed.version)) fail4("existing_registration_requires_review");
25574
+ const directory2 = await info2(root), definition = await info2(path11.join(root, ".mcp.json"));
25532
25575
  if (!directory2?.isDirectory() || directory2.isSymbolicLink() || !definition?.isFile() || definition.isSymbolicLink()) fail4("installed_files_invalid");
25533
- const ready = await privateRead2(path10.join(root, "installation.json"));
25576
+ const ready = await privateRead2(path11.join(root, "installation.json"));
25534
25577
  if (!ready || ready.profile !== profile || ready.configFile !== configFile2 || ready.version !== installed.version) fail4("existing_registration_requires_review");
25535
- const bytes2 = await readFile6(path10.join(root, ".mcp.json")), entry = ready.files?.find((x) => x.path === ".mcp.json");
25578
+ const bytes2 = await readFile6(path11.join(root, ".mcp.json")), entry = ready.files?.find((x) => x.path === ".mcp.json");
25536
25579
  if (!entry || entry.bytes !== bytes2.length || entry.sha256 !== hash4(bytes2)) fail4("installed_files_invalid");
25537
25580
  const mcp = JSON.parse(bytes2).mcpServers?.[serverName];
25538
- if (!mcp || typeof mcp.command !== "string" || !mcp.command || mcp.cwd !== root || JSON.stringify(mcp.args) !== JSON.stringify([path10.join(root, "bin/promptframe-creation.mjs"), "bridge", "--config", configFile2])) fail4("existing_registration_requires_review");
25581
+ if (!mcp || typeof mcp.command !== "string" || !mcp.command || mcp.cwd !== root || JSON.stringify(mcp.args) !== JSON.stringify([path11.join(root, "bin/promptframe-creation.mjs"), "bridge", "--config", configFile2])) fail4("existing_registration_requires_review");
25539
25582
  return mcp;
25540
25583
  }
25541
25584
  async function officialNpmInstallation(installed, servers, env, profile, configFile2) {
@@ -25543,12 +25586,12 @@ async function officialNpmInstallation(installed, servers, env, profile, configF
25543
25586
  const candidates = installed.filter((p3) => p3.enabled === true && p3.name === "promptframe-creation" && p3.pluginId === "promptframe-creation@" + p3.marketplaceName && /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,140}$/.test(p3.marketplaceName ?? "") && /^\d+\.\d+\.\d+$/.test(p3.version ?? "") && p3.source?.source === "npm" && p3.source.package === "@promptframe/creation" && p3.source.version === p3.version && ["https://registry.npmjs.org", "https://registry.npmjs.org/"].includes(p3.source.registry));
25544
25587
  if (candidates.length > 1) fail4("existing_registration_requires_review");
25545
25588
  if (!candidates.length) return null;
25546
- const p2 = candidates[0], root = path10.join(path10.resolve(env.CODEX_HOME ?? path10.join(homedir4(), ".codex")), "plugins/cache", p2.marketplaceName, p2.name, p2.version);
25589
+ const p2 = candidates[0], root = path11.join(path11.resolve(env.CODEX_HOME ?? path11.join(homedir4(), ".codex")), "plugins/cache", p2.marketplaceName, p2.name, p2.version);
25547
25590
  const directory2 = await info2(root);
25548
25591
  if (!directory2?.isDirectory() || directory2.isSymbolicLink()) fail4("installed_files_invalid");
25549
- const pkg = await packageJSON(path10.join(root, "package.json")), manifest = await packageJSON(path10.join(root, ".codex-plugin/plugin.json"));
25592
+ const pkg = await packageJSON(path11.join(root, "package.json")), manifest = await packageJSON(path11.join(root, ".codex-plugin/plugin.json"));
25550
25593
  if (pkg.name !== "@promptframe/creation" || pkg.version !== p2.version || manifest.name !== p2.name || manifest.version !== p2.version) fail4("installed_files_invalid");
25551
- const definition = (await packageJSON(path10.join(root, ".mcp.json"))).mcpServers?.promptframe;
25594
+ const definition = (await packageJSON(path11.join(root, ".mcp.json"))).mcpServers?.promptframe;
25552
25595
  if (!definition || definition.command !== "node" || definition.cwd !== "." || JSON.stringify(definition.args) !== JSON.stringify(["bin/promptframe-creation.mjs", "bridge"]) || JSON.stringify(definition.env_vars) !== JSON.stringify(["PROMPTFRAME_CREATION_CONFIG", "XDG_CONFIG_HOME"])) fail4("legacy_mcp_entry_requires_review");
25553
25596
  if (servers.length !== 1 || servers[0].enabled !== true || !sameTransport(servers[0].transport, { ...definition, cwd: root }) || JSON.stringify(servers[0].transport.env_vars) !== JSON.stringify(definition.env_vars)) fail4("legacy_mcp_entry_requires_review");
25554
25597
  return {
@@ -25567,7 +25610,7 @@ async function officialNpmInstallation(installed, servers, env, profile, configF
25567
25610
  async function atomicJSON(file, value2) {
25568
25611
  const temp = file + "." + randomBytes5(12).toString("hex") + ".tmp";
25569
25612
  try {
25570
- const out = await open6(temp, "wx", 384);
25613
+ const out = await open7(temp, "wx", 384);
25571
25614
  try {
25572
25615
  await out.writeFile(JSON.stringify(value2, null, 2) + "\n");
25573
25616
  await out.sync();
@@ -25575,7 +25618,7 @@ async function atomicJSON(file, value2) {
25575
25618
  await out.close();
25576
25619
  }
25577
25620
  await rename5(temp, file);
25578
- const directory2 = await open6(path10.dirname(file), "r");
25621
+ const directory2 = await open7(path11.dirname(file), "r");
25579
25622
  try {
25580
25623
  await directory2.sync();
25581
25624
  } finally {
@@ -25586,7 +25629,7 @@ async function atomicJSON(file, value2) {
25586
25629
  }
25587
25630
  }
25588
25631
  async function acquire(root, signal) {
25589
- const lock = path10.join(root, "install.lock");
25632
+ const lock = path11.join(root, "install.lock");
25590
25633
  const end = Date.now() + 3e4;
25591
25634
  let owned = false;
25592
25635
  while (!owned) {
@@ -25601,7 +25644,7 @@ async function acquire(root, signal) {
25601
25644
  }
25602
25645
  }
25603
25646
  try {
25604
- await writeFile2(path10.join(lock, "owner.json"), JSON.stringify({ pid: process.pid, startedAt: (/* @__PURE__ */ new Date()).toISOString() }), { flag: "wx", mode: 384 });
25647
+ await writeFile2(path11.join(lock, "owner.json"), JSON.stringify({ pid: process.pid, startedAt: (/* @__PURE__ */ new Date()).toISOString() }), { flag: "wx", mode: 384 });
25605
25648
  } catch (e) {
25606
25649
  await rm2(lock, { recursive: true, force: true });
25607
25650
  throw e;
@@ -25642,7 +25685,7 @@ async function codexJSON(runCodex, args2) {
25642
25685
  }
25643
25686
  }
25644
25687
  async function relatedPlugins(runCodex, pluginName, env) {
25645
- const related = /* @__PURE__ */ new Set(), registered = /* @__PURE__ */ new Set(), pinnedMarketplaces = /* @__PURE__ */ new Map(), config2 = path10.join(path10.resolve(env.CODEX_HOME ?? path10.join(homedir4(), ".codex")), "config.toml");
25688
+ const related = /* @__PURE__ */ new Set(), registered = /* @__PURE__ */ new Set(), pinnedMarketplaces = /* @__PURE__ */ new Map(), config2 = path11.join(path11.resolve(env.CODEX_HOME ?? path11.join(homedir4(), ".codex")), "config.toml");
25646
25689
  try {
25647
25690
  const s3 = await info2(config2);
25648
25691
  if (s3) {
@@ -25662,10 +25705,10 @@ async function relatedPlugins(runCodex, pluginName, env) {
25662
25705
  const state = await codexJSON(runCodex, ["plugin", "marketplace", "list", "--json"]);
25663
25706
  if (!Array.isArray(state?.marketplaces) || state.marketplaces.length > 128) fail4("local_catalog_unconfirmed");
25664
25707
  for (const market of state.marketplaces) {
25665
- if (typeof market.name !== "string" || !/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,140}$/.test(market.name) || typeof market.root !== "string" || !path10.isAbsolute(market.root)) fail4("local_catalog_unconfirmed");
25708
+ if (typeof market.name !== "string" || !/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,140}$/.test(market.name) || typeof market.root !== "string" || !path11.isAbsolute(market.root)) fail4("local_catalog_unconfirmed");
25666
25709
  let catalog;
25667
25710
  try {
25668
- catalog = await packageJSON(path10.join(market.root, ".agents/plugins/marketplace.json"));
25711
+ catalog = await packageJSON(path11.join(market.root, ".agents/plugins/marketplace.json"));
25669
25712
  } catch {
25670
25713
  fail4("local_catalog_unconfirmed", { phase: "local_check", commandKind: "marketplace_read", localRegistrationState: "unknown", action: "restore_local_marketplace_catalog" });
25671
25714
  }
@@ -25696,7 +25739,7 @@ async function relatedPlugins(runCodex, pluginName, env) {
25696
25739
  }
25697
25740
  async function runNode(root, version3) {
25698
25741
  try {
25699
- const result = await execute2(process.execPath, [path10.join(root, "bin/promptframe-creation.mjs"), "--version"], { encoding: "utf8", timeout: 1e4, maxBuffer: 8192 });
25742
+ const result = await execute2(process.execPath, [path11.join(root, "bin/promptframe-creation.mjs"), "--version"], { encoding: "utf8", timeout: 1e4, maxBuffer: 8192 });
25700
25743
  if (result.stdout.trim() !== version3) fail4("runtime_version_mismatch");
25701
25744
  } catch (e) {
25702
25745
  if (e instanceof CreationClientError) throw e;
@@ -25710,7 +25753,7 @@ async function checkInstalledRuntime(root, version3, command2, { env = process.e
25710
25753
  if (!major || Number(major[1]) < 20) throw Error("unsupported_node");
25711
25754
  const result = await execute2(
25712
25755
  command2,
25713
- [path10.join(root, "bin/promptframe-creation.mjs"), "--version"],
25756
+ [path11.join(root, "bin/promptframe-creation.mjs"), "--version"],
25714
25757
  { env, encoding: "utf8", timeout: 1e4, maxBuffer: 8192 }
25715
25758
  );
25716
25759
  if (result.stdout.trim() !== version3) throw Error("wrong_version");
@@ -25747,20 +25790,20 @@ async function installForUser({
25747
25790
  const versionOutput = await runCodex(["--version"]);
25748
25791
  const match = versionOutput.match(/codex-cli (\d+)\.(\d+)\.(\d+)/);
25749
25792
  if (!match || Number(match[1]) === 0 && Number(match[2]) < 160) fail4("codex_0160_required");
25750
- const payload = await inspectRuntimePackage(path10.resolve(sourceRoot));
25751
- const root = path10.resolve(env.XDG_DATA_HOME ?? path10.join(homedir4(), ".local/share"), "promptframe-creation", profile);
25793
+ const payload = await inspectRuntimePackage(path11.resolve(sourceRoot));
25794
+ const root = path11.resolve(env.XDG_DATA_HOME ?? path11.join(homedir4(), ".local/share"), "promptframe-creation", profile);
25752
25795
  await privateDirectory3(root);
25753
25796
  const release = await acquire(root, signal);
25754
- const versions = path10.join(root, "versions"), currentFile = path10.join(root, "current.json"), pendingFile = path10.join(root, "registration-pending.json");
25755
- const marketplaceFile = path10.join(root, ".agents/plugins/marketplace.json");
25797
+ const versions = path11.join(root, "versions"), currentFile = path11.join(root, "current.json"), pendingFile = path11.join(root, "registration-pending.json");
25798
+ const marketplaceFile = path11.join(root, ".agents/plugins/marketplace.json");
25756
25799
  const pluginName = "promptframe-creation" + (profile === "default" ? "" : "-" + profile), marketplace = "promptframe-creation-user" + (profile === "default" ? "" : "-" + profile);
25757
25800
  const pluginId = pluginName + "@" + marketplace;
25758
- const versionRoot = path10.join(versions, payload.version), temporary = path10.join(versions, ".partial-" + randomBytes5(12).toString("hex"));
25801
+ const versionRoot = path11.join(versions, payload.version), temporary = path11.join(versions, ".partial-" + randomBytes5(12).toString("hex"));
25759
25802
  let previous, registrationStarted = false, newFiles = 0;
25760
25803
  try {
25761
25804
  signal?.throwIfAborted();
25762
25805
  await privateDirectory3(versions);
25763
- await privateDirectory3(path10.dirname(marketplaceFile));
25806
+ await privateDirectory3(path11.dirname(marketplaceFile));
25764
25807
  previous = await privateRead2(currentFile);
25765
25808
  if (previous && (previous.profile !== profile || previous.pluginId !== pluginId || previous.configFile !== configFile2)) fail4("profile_binding_conflict");
25766
25809
  const state = { installed: await relatedPlugins(runCodex, pluginName, env) };
@@ -25771,12 +25814,12 @@ async function installForUser({
25771
25814
  const servers = legacy.filter((x) => x.name === serverName);
25772
25815
  const pending = await privateRead2(pendingFile);
25773
25816
  if (pending) {
25774
- if (pending.profile !== profile || pending.pluginId !== pluginId || pending.configFile !== configFile2 || pending.versionRoot !== path10.join(versions, pending.version)) fail4("profile_binding_conflict");
25817
+ if (pending.profile !== profile || pending.pluginId !== pluginId || pending.configFile !== configFile2 || pending.versionRoot !== path11.join(versions, pending.version)) fail4("profile_binding_conflict");
25775
25818
  if (installed?.version !== pending.version || installed.enabled !== true || installed.source?.path !== pending.versionRoot)
25776
25819
  fail4("registration_unconfirmed_keep_existing", { phase: "registration_observation", localRegistrationState: "unknown", action: "inspect_same_registration_no_second_add" });
25777
25820
  const transport2 = await managedTransport(installed, versions, serverName, profile, configFile2);
25778
25821
  if (servers.length !== 1 || servers[0].enabled === false || !sameTransport(servers[0].transport, transport2)) fail4("registration_unconfirmed_keep_existing");
25779
- const ready = await privateRead2(path10.join(pending.versionRoot, "installation.json"));
25822
+ const ready = await privateRead2(path11.join(pending.versionRoot, "installation.json"));
25780
25823
  if (ready?.payloadDigest !== pending.payloadDigest) fail4("installed_files_invalid");
25781
25824
  previous = pending;
25782
25825
  await atomicJSON(currentFile, pending);
@@ -25831,11 +25874,11 @@ async function installForUser({
25831
25874
  const target = await info2(versionRoot);
25832
25875
  if (target) {
25833
25876
  if (!target.isDirectory() || target.isSymbolicLink()) fail4("version_content_conflict");
25834
- const ready = await privateRead2(path10.join(versionRoot, "installation.json"));
25877
+ const ready = await privateRead2(path11.join(versionRoot, "installation.json"));
25835
25878
  if (!ready || ready.payloadDigest !== payload.payloadDigest || ready.profile !== profile || ready.configFile !== configFile2) fail4("version_content_conflict");
25836
25879
  for (const f2 of ready.files) {
25837
25880
  if (!payload.files.some((p2) => p2.path === f2.path)) fail4("installed_files_invalid");
25838
- const file = path10.join(versionRoot, f2.path), s3 = await info2(file);
25881
+ const file = path11.join(versionRoot, f2.path), s3 = await info2(file);
25839
25882
  if (!s3?.isFile() || s3.isSymbolicLink() || s3.size !== f2.bytes || hash4(await readFile6(file)) !== f2.sha256) fail4("installed_files_invalid");
25840
25883
  }
25841
25884
  if (ready.files.length !== payload.files.length) fail4("installed_files_invalid");
@@ -25843,31 +25886,31 @@ async function installForUser({
25843
25886
  await mkdir5(temporary, { mode: 448 });
25844
25887
  for (const f2 of payload.files) {
25845
25888
  signal?.throwIfAborted();
25846
- await mkdir5(path10.dirname(path10.join(temporary, f2.path)), { recursive: true, mode: 448 });
25847
- await writeFile2(path10.join(temporary, f2.path), f2.body, { flag: "wx", mode: 384 });
25889
+ await mkdir5(path11.dirname(path11.join(temporary, f2.path)), { recursive: true, mode: 448 });
25890
+ await writeFile2(path11.join(temporary, f2.path), f2.body, { flag: "wx", mode: 384 });
25848
25891
  }
25849
- const manifest = await json(path10.join(temporary, ".codex-plugin/plugin.json"));
25892
+ const manifest = await json(path11.join(temporary, ".codex-plugin/plugin.json"));
25850
25893
  manifest.name = pluginName;
25851
- await writeFile2(path10.join(temporary, ".codex-plugin/plugin.json"), JSON.stringify(manifest, null, 2) + "\n");
25894
+ await writeFile2(path11.join(temporary, ".codex-plugin/plugin.json"), JSON.stringify(manifest, null, 2) + "\n");
25852
25895
  const mcp = { mcpServers: { ["promptframe" + (profile === "default" ? "" : "-" + profile)]: {
25853
25896
  command: process.execPath,
25854
- args: [path10.join(versionRoot, "bin/promptframe-creation.mjs"), "bridge", "--config", configFile2],
25897
+ args: [path11.join(versionRoot, "bin/promptframe-creation.mjs"), "bridge", "--config", configFile2],
25855
25898
  cwd: versionRoot
25856
25899
  } } };
25857
- await writeFile2(path10.join(temporary, ".mcp.json"), JSON.stringify(mcp, null, 2) + "\n");
25900
+ await writeFile2(path11.join(temporary, ".mcp.json"), JSON.stringify(mcp, null, 2) + "\n");
25858
25901
  await checkRuntime(temporary, payload.version);
25859
25902
  const files = [];
25860
25903
  for (const f2 of payload.files) {
25861
- const body = await readFile6(path10.join(temporary, f2.path));
25904
+ const body = await readFile6(path11.join(temporary, f2.path));
25862
25905
  files.push({ path: f2.path, bytes: body.length, sha256: hash4(body) });
25863
25906
  }
25864
- await atomicJSON(path10.join(temporary, "installation.json"), { version: payload.version, profile, configFile: configFile2, payloadDigest: payload.payloadDigest, files });
25907
+ await atomicJSON(path11.join(temporary, "installation.json"), { version: payload.version, profile, configFile: configFile2, payloadDigest: payload.payloadDigest, files });
25865
25908
  signal?.throwIfAborted();
25866
25909
  await rename5(temporary, versionRoot);
25867
25910
  newFiles = payload.files.length;
25868
25911
  }
25869
25912
  if (newFiles === 0) {
25870
- const launch = (await json(path10.join(versionRoot, ".mcp.json"))).mcpServers?.[serverName];
25913
+ const launch = (await json(path11.join(versionRoot, ".mcp.json"))).mcpServers?.[serverName];
25871
25914
  await verifyInstalledRuntime(versionRoot, payload.version, launch.command, { env });
25872
25915
  }
25873
25916
  const complete = { version: payload.version, profile, configFile: configFile2, pluginId, versionRoot, payloadDigest: payload.payloadDigest };
@@ -25926,9 +25969,9 @@ async function installForUser({
25926
25969
 
25927
25970
  // lib/claude-installation.mjs
25928
25971
  import { createHash as createHash11, randomBytes as randomBytes7 } from "node:crypto";
25929
- import { mkdir as mkdir7, open as open9, readFile as readFile9, rename as rename7, rm as rm5 } from "node:fs/promises";
25972
+ import { mkdir as mkdir7, open as open10, readFile as readFile9, rename as rename7, rm as rm5 } from "node:fs/promises";
25930
25973
  import { homedir as homedir9 } from "node:os";
25931
- import path15 from "node:path";
25974
+ import path16 from "node:path";
25932
25975
 
25933
25976
  // lib/claude-hook-definition.mjs
25934
25977
  function claudeHostHooks({ pluginName = "promptframe-creation", serverName, configFile: configFile2, nodeCommand = "node", runtimeRoot = "${CLAUDE_PLUGIN_ROOT}" } = {}) {
@@ -25952,9 +25995,9 @@ function claudeHostHooks({ pluginName = "promptframe-creation", serverName, conf
25952
25995
  import { execFile as execFile3 } from "node:child_process";
25953
25996
  import { promisify as promisify3 } from "node:util";
25954
25997
  import { access, lstat as lstat8, readdir as readdir5 } from "node:fs/promises";
25955
- import { constants as constants4 } from "node:fs";
25998
+ import { constants as constants5 } from "node:fs";
25956
25999
  import { homedir as homedir5 } from "node:os";
25957
- import path11 from "node:path";
26000
+ import path12 from "node:path";
25958
26001
  var execute3 = promisify3(execFile3);
25959
26002
  var ClaudeCommandError = class extends CreationClientError {
25960
26003
  constructor(code, details) {
@@ -25966,20 +26009,20 @@ var claudeErrorDetails = (error4) => error4 instanceof ClaudeCommandError ? erro
25966
26009
  async function resolveClaudeCommand({ env = process.env, homeDirectory = homedir5(), executable } = {}) {
25967
26010
  const selected = executable ?? env.PROMPTFRAME_CLAUDE_BIN;
25968
26011
  if (selected) {
25969
- if (!path11.isAbsolute(selected)) throw new CreationClientError("installation.claude_executable_invalid");
25970
- await access(selected, constants4.X_OK);
26012
+ if (!path12.isAbsolute(selected)) throw new CreationClientError("installation.claude_executable_invalid");
26013
+ await access(selected, constants5.X_OK);
25971
26014
  return selected;
25972
26015
  }
25973
- for (const directory2 of (env.PATH ?? "").split(path11.delimiter).filter(path11.isAbsolute)) {
25974
- const file = path11.join(directory2, process.platform === "win32" ? "claude.exe" : "claude");
26016
+ for (const directory2 of (env.PATH ?? "").split(path12.delimiter).filter(path12.isAbsolute)) {
26017
+ const file = path12.join(directory2, process.platform === "win32" ? "claude.exe" : "claude");
25975
26018
  try {
25976
- await access(file, constants4.X_OK);
26019
+ await access(file, constants5.X_OK);
25977
26020
  return file;
25978
26021
  } catch (e) {
25979
26022
  if (!["ENOENT", "EACCES", "ENOTDIR"].includes(e.code)) throw e;
25980
26023
  }
25981
26024
  }
25982
- const root = path11.join(homeDirectory, ".claude/remote/ccd-cli");
26025
+ const root = path12.join(homeDirectory, ".claude/remote/ccd-cli");
25983
26026
  let entries;
25984
26027
  try {
25985
26028
  entries = await readdir5(root);
@@ -25992,9 +26035,9 @@ async function resolveClaudeCommand({ env = process.env, homeDirectory = homedir
25992
26035
  for (const name of entries) {
25993
26036
  const match = name.match(/^(\d+)\.(\d+)\.(\d+)-[a-f0-9]{6,40}$/);
25994
26037
  if (!match) continue;
25995
- const file = path11.join(root, name), s3 = await lstat8(file);
26038
+ const file = path12.join(root, name), s3 = await lstat8(file);
25996
26039
  if (s3.isFile() && !s3.isSymbolicLink() && s3.uid === process.getuid?.()) {
25997
- await access(file, constants4.X_OK);
26040
+ await access(file, constants5.X_OK);
25998
26041
  candidates.push({ file, version: match.slice(1).map(Number) });
25999
26042
  }
26000
26043
  }
@@ -26032,12 +26075,12 @@ function createClaudeRunner({ env = process.env, executable, signal, resolve = r
26032
26075
  // lib/claude-local-state.mjs
26033
26076
  import { readFile as readFile7, lstat as lstat9 } from "node:fs/promises";
26034
26077
  import { homedir as homedir6 } from "node:os";
26035
- import path12 from "node:path";
26078
+ import path13 from "node:path";
26036
26079
  function claudeConfigRoot(env = process.env) {
26037
- return path12.resolve(env.CLAUDE_CONFIG_DIR ?? path12.join(homedir6(), ".claude"));
26080
+ return path13.resolve(env.CLAUDE_CONFIG_DIR ?? path13.join(homedir6(), ".claude"));
26038
26081
  }
26039
26082
  async function readClaudeUserServer(serverName, env = process.env) {
26040
- const file = env.CLAUDE_CONFIG_DIR ? path12.join(claudeConfigRoot(env), ".claude.json") : path12.join(homedir6(), ".claude.json");
26083
+ const file = env.CLAUDE_CONFIG_DIR ? path13.join(claudeConfigRoot(env), ".claude.json") : path13.join(homedir6(), ".claude.json");
26041
26084
  let info5;
26042
26085
  try {
26043
26086
  info5 = await lstat9(file);
@@ -26061,15 +26104,15 @@ async function readClaudeUserServer(serverName, env = process.env) {
26061
26104
 
26062
26105
  // lib/claude-mcp-installation.mjs
26063
26106
  import { createHash as createHash10, randomBytes as randomBytes6 } from "node:crypto";
26064
- import { mkdir as mkdir6, open as open8, readFile as readFile8, readdir as readdir6, rename as rename6, rm as rm4, lstat as lstat10 } from "node:fs/promises";
26107
+ import { mkdir as mkdir6, open as open9, readFile as readFile8, readdir as readdir6, rename as rename6, rm as rm4, lstat as lstat10 } from "node:fs/promises";
26065
26108
  import { homedir as homedir8 } from "node:os";
26066
- import path14 from "node:path";
26109
+ import path15 from "node:path";
26067
26110
 
26068
26111
  // lib/claude-hook-registration.mjs
26069
26112
  import { createHash as createHash9 } from "node:crypto";
26070
- import { open as open7, rm as rm3 } from "node:fs/promises";
26071
- import { constants as constants5 } from "node:fs";
26072
- import path13 from "node:path";
26113
+ import { open as open8, rm as rm3 } from "node:fs/promises";
26114
+ import { constants as constants6 } from "node:fs";
26115
+ import path14 from "node:path";
26073
26116
  import { homedir as homedir7 } from "node:os";
26074
26117
  var { privateDirectory: privateDirectory4, privateRead: privateRead3, atomicJSON: atomicJSON2, acquire: acquire2 } = installationFiles;
26075
26118
  var digest4 = (value2) => createHash9("sha256").update(JSON.stringify(value2)).digest("hex");
@@ -26079,7 +26122,7 @@ var fail5 = () => {
26079
26122
  async function settings(file) {
26080
26123
  let handle;
26081
26124
  try {
26082
- handle = await open7(file, constants5.O_RDONLY | constants5.O_NOFOLLOW);
26125
+ handle = await open8(file, constants6.O_RDONLY | constants6.O_NOFOLLOW);
26083
26126
  const info5 = await handle.stat();
26084
26127
  if (!info5.isFile() || info5.uid !== process.getuid?.() || info5.size > 512 * 1024) fail5();
26085
26128
  const value2 = JSON.parse(await handle.readFile("utf8"));
@@ -26094,20 +26137,20 @@ async function settings(file) {
26094
26137
  }
26095
26138
  var contains = (value2, entries) => Object.entries(entries).every(([event, wanted]) => Array.isArray(value2.hooks?.[event]) && wanted.every((entry) => value2.hooks[event].filter((actual) => digest4(actual) === digest4(entry)).length === 1));
26096
26139
  async function verifyClaudeFallbackHooks(record2, env) {
26097
- if (!record2?.settingsFile || record2.settingsFile !== path13.join(claudeConfigRoot(env), "settings.json") || !record2.entries) fail5();
26140
+ if (!record2?.settingsFile || record2.settingsFile !== path14.join(claudeConfigRoot(env), "settings.json") || !record2.entries) fail5();
26098
26141
  if (!contains(await settings(record2.settingsFile), record2.entries)) fail5();
26099
26142
  return true;
26100
26143
  }
26101
26144
  async function registerClaudeFallbackHooks({ record: record2, root, env, nodeCommand, signal }) {
26102
- const directory2 = claudeConfigRoot(env), file = path13.join(directory2, "settings.json");
26103
- const guard = path13.resolve(
26104
- env.XDG_DATA_HOME ?? path13.join(homedir7(), ".local/share"),
26145
+ const directory2 = claudeConfigRoot(env), file = path14.join(directory2, "settings.json");
26146
+ const guard = path14.resolve(
26147
+ env.XDG_DATA_HOME ?? path14.join(homedir7(), ".local/share"),
26105
26148
  "promptframe-creation",
26106
26149
  "claude-hook-writer-" + digest4(directory2)
26107
26150
  );
26108
26151
  await privateDirectory4(guard);
26109
26152
  const release = await acquire2(guard, signal);
26110
- const markerFile = path13.join(root, "hooks-current.json"), pendingFile = path13.join(root, "hooks-pending.json");
26153
+ const markerFile = path14.join(root, "hooks-current.json"), pendingFile = path14.join(root, "hooks-pending.json");
26111
26154
  try {
26112
26155
  await privateDirectory4(directory2);
26113
26156
  const entries = claudeHostHooks({ serverName: record2.serverName, configFile: record2.configFile, nodeCommand, runtimeRoot: record2.versionRoot });
@@ -26175,7 +26218,7 @@ function same(a, b2, depth = 0) {
26175
26218
  async function atomicText(file, body) {
26176
26219
  const temporary = file + "." + randomBytes6(12).toString("hex") + ".tmp";
26177
26220
  try {
26178
- const fd = await open8(temporary, "wx", 384);
26221
+ const fd = await open9(temporary, "wx", 384);
26179
26222
  try {
26180
26223
  await fd.writeFile(body);
26181
26224
  await fd.sync();
@@ -26183,7 +26226,7 @@ async function atomicText(file, body) {
26183
26226
  await fd.close();
26184
26227
  }
26185
26228
  await rename6(temporary, file);
26186
- const dir = await open8(path14.dirname(file), "r");
26229
+ const dir = await open9(path15.dirname(file), "r");
26187
26230
  try {
26188
26231
  await dir.sync();
26189
26232
  } finally {
@@ -26196,15 +26239,15 @@ async function atomicText(file, body) {
26196
26239
  async function verifyVersion(root, record2) {
26197
26240
  const directory2 = await info3(root);
26198
26241
  if (!directory2?.isDirectory() || directory2.isSymbolicLink() || directory2.uid !== process.getuid?.() || directory2.mode & 63) fail6("claude_installed_files_invalid");
26199
- const marker = await privateRead4(path14.join(root, "installation.json")), payload = await inspectRuntimePackage(root);
26200
- if (!marker || marker.host !== "claude-code" || marker.mode !== "mcp-and-skills" || marker.profile !== record2.profile || marker.configFile !== record2.configFile || marker.version !== record2.version || marker.payloadDigest !== record2.payloadDigest || payload.payloadDigest !== marker.payloadDigest || !path14.isAbsolute(marker.nodeCommand ?? "")) fail6("claude_installed_files_invalid");
26242
+ const marker = await privateRead4(path15.join(root, "installation.json")), payload = await inspectRuntimePackage(root);
26243
+ if (!marker || marker.host !== "claude-code" || marker.mode !== "mcp-and-skills" || marker.profile !== record2.profile || marker.configFile !== record2.configFile || marker.version !== record2.version || marker.payloadDigest !== record2.payloadDigest || payload.payloadDigest !== marker.payloadDigest || !path15.isAbsolute(marker.nodeCommand ?? "")) fail6("claude_installed_files_invalid");
26201
26244
  return marker;
26202
26245
  }
26203
26246
  function mcpDefinition(record2, nodeCommand) {
26204
26247
  return {
26205
26248
  type: "stdio",
26206
26249
  command: nodeCommand,
26207
- args: [path14.join(record2.versionRoot, "bin/promptframe-creation.mjs"), "bridge", "--config", record2.configFile, "--host", "claude-code"]
26250
+ args: [path15.join(record2.versionRoot, "bin/promptframe-creation.mjs"), "bridge", "--config", record2.configFile, "--host", "claude-code"]
26208
26251
  };
26209
26252
  }
26210
26253
  function skillBody(payload, sourceName, name) {
@@ -26220,7 +26263,7 @@ async function observedSkill(plan, record2, { allowBefore = false } = {}) {
26220
26263
  if (!directory2.isDirectory() || directory2.isSymbolicLink() || directory2.uid !== process.getuid?.() || directory2.mode & 63) fail6("claude_skill_requires_review");
26221
26264
  const names = await readdir6(plan.root);
26222
26265
  if (names.some((n) => !["SKILL.md", "promptframe-installation.json"].includes(n))) fail6("claude_skill_requires_review");
26223
- const marker = await privateRead4(path14.join(plan.root, "promptframe-installation.json")), file = path14.join(plan.root, "SKILL.md"), s3 = await info3(file);
26266
+ const marker = await privateRead4(path15.join(plan.root, "promptframe-installation.json")), file = path15.join(plan.root, "SKILL.md"), s3 = await info3(file);
26224
26267
  if (!marker || marker.host !== "claude-code" || marker.profile !== record2.profile || marker.configFile !== record2.configFile || marker.name !== plan.name)
26225
26268
  fail6("claude_skill_requires_review");
26226
26269
  if (!s3 && allowBefore && plan.beforeSHA === null && marker.sha256 === null) return false;
@@ -26242,13 +26285,13 @@ async function installClaudeMcpFallback({
26242
26285
  nodeCommand,
26243
26286
  writeSkill = atomicText
26244
26287
  }) {
26245
- const payload = await inspectRuntimePackage(path14.resolve(sourceRoot)), suffix = profile === "default" ? "" : "-" + profile, serverName = "promptframe" + suffix, root = path14.resolve(env.XDG_DATA_HOME ?? path14.join(homedir8(), ".local/share"), "promptframe-creation", profile, "claude-code-mcp");
26288
+ const payload = await inspectRuntimePackage(path15.resolve(sourceRoot)), suffix = profile === "default" ? "" : "-" + profile, serverName = "promptframe" + suffix, root = path15.resolve(env.XDG_DATA_HOME ?? path15.join(homedir8(), ".local/share"), "promptframe-creation", profile, "claude-code-mcp");
26246
26289
  await privateDirectory5(root);
26247
- const release = await acquire3(root, signal), versions = path14.join(root, "versions"), currentFile = path14.join(root, "current.json"), pendingFile = path14.join(root, "registration-pending.json"), versionRoot = path14.join(versions, payload.version), temporary = path14.join(versions, ".partial-" + randomBytes6(12).toString("hex"));
26290
+ const release = await acquire3(root, signal), versions = path15.join(root, "versions"), currentFile = path15.join(root, "current.json"), pendingFile = path15.join(root, "registration-pending.json"), versionRoot = path15.join(versions, payload.version), temporary = path15.join(versions, ".partial-" + randomBytes6(12).toString("hex"));
26248
26291
  let writeStarted = false, newFiles = 0;
26249
26292
  const complete = { host: "claude-code", mode: "mcp-and-skills", profile, configFile: configFile2, serverName, version: payload.version, versionRoot, payloadDigest: payload.payloadDigest };
26250
26293
  const checkBinding = (record2) => {
26251
- if (record2 && (record2.host !== "claude-code" || record2.mode !== "mcp-and-skills" || record2.profile !== profile || record2.configFile !== configFile2 || record2.serverName !== serverName || !/^\d+\.\d+\.\d+$/.test(record2.version ?? "") || record2.versionRoot !== path14.join(versions, record2.version))) fail6("profile_binding_conflict");
26294
+ if (record2 && (record2.host !== "claude-code" || record2.mode !== "mcp-and-skills" || record2.profile !== profile || record2.configFile !== configFile2 || record2.serverName !== serverName || !/^\d+\.\d+\.\d+$/.test(record2.version ?? "") || record2.versionRoot !== path15.join(versions, record2.version))) fail6("profile_binding_conflict");
26252
26295
  };
26253
26296
  try {
26254
26297
  await privateDirectory5(versions);
@@ -26265,7 +26308,7 @@ async function installClaudeMcpFallback({
26265
26308
  if (!Array.isArray(record2.skills) || record2.skills.length !== 2) fail6("claude_skill_requires_review");
26266
26309
  for (const [i, skill] of record2.skills.entries()) {
26267
26310
  const name = ["creation-setup", "video-creation"][i] + suffix;
26268
- if (skill.name !== name || skill.root !== path14.join(claudeConfigRoot(env), "skills", name) || !/^[a-f0-9]{64}$/.test(skill.sha256 ?? ""))
26311
+ if (skill.name !== name || skill.root !== path15.join(claudeConfigRoot(env), "skills", name) || !/^[a-f0-9]{64}$/.test(skill.sha256 ?? ""))
26269
26312
  fail6("claude_skill_requires_review");
26270
26313
  if (!await observedSkill(skill, record2)) return false;
26271
26314
  }
@@ -26308,9 +26351,9 @@ async function installClaudeMcpFallback({
26308
26351
  await mkdir6(temporary, { mode: 448 });
26309
26352
  for (const file of payload.files) {
26310
26353
  signal?.throwIfAborted();
26311
- const dest = path14.join(temporary, file.path);
26312
- await mkdir6(path14.dirname(dest), { recursive: true, mode: 448 });
26313
- const fd = await open8(dest, "wx", 384);
26354
+ const dest = path15.join(temporary, file.path);
26355
+ await mkdir6(path15.dirname(dest), { recursive: true, mode: 448 });
26356
+ const fd = await open9(dest, "wx", 384);
26314
26357
  try {
26315
26358
  await fd.writeFile(file.body);
26316
26359
  await fd.sync();
@@ -26319,7 +26362,7 @@ async function installClaudeMcpFallback({
26319
26362
  }
26320
26363
  }
26321
26364
  await checkRuntime(temporary, payload.version);
26322
- await atomicJSON3(path14.join(temporary, "installation.json"), { ...complete, nodeCommand });
26365
+ await atomicJSON3(path15.join(temporary, "installation.json"), { ...complete, nodeCommand });
26323
26366
  signal?.throwIfAborted();
26324
26367
  await rename6(temporary, versionRoot);
26325
26368
  newFiles = payload.files.length;
@@ -26327,13 +26370,13 @@ async function installClaudeMcpFallback({
26327
26370
  const ready = await verifyVersion(versionRoot, complete);
26328
26371
  complete.server = mcpDefinition(complete, ready.nodeCommand);
26329
26372
  if (newFiles === 0) await verifyInstalledRuntime(versionRoot, payload.version, ready.nodeCommand, { env });
26330
- const skillRoot = path14.join(claudeConfigRoot(env), "skills");
26373
+ const skillRoot = path15.join(claudeConfigRoot(env), "skills");
26331
26374
  await mkdir6(skillRoot, { recursive: true, mode: 448 });
26332
26375
  const parent = await lstat10(skillRoot);
26333
26376
  if (!parent.isDirectory() || parent.isSymbolicLink() || parent.uid !== process.getuid?.()) fail6("claude_skill_requires_review");
26334
26377
  const plans = [];
26335
26378
  for (const sourceName of ["creation-setup", "video-creation"]) {
26336
- const name = sourceName + suffix, body = skillBody(payload, sourceName, name), skill = { name, root: path14.join(skillRoot, name), sha256: hash5(body) };
26379
+ const name = sourceName + suffix, body = skillBody(payload, sourceName, name), skill = { name, root: path15.join(skillRoot, name), sha256: hash5(body) };
26337
26380
  if (pending) {
26338
26381
  const old = pending.skills?.find((s3) => s3.name === name);
26339
26382
  if (!old || old.root !== skill.root || old.sha256 !== skill.sha256) fail6("registration_unconfirmed_keep_existing");
@@ -26342,7 +26385,7 @@ async function installClaudeMcpFallback({
26342
26385
  const existing = await info3(skill.root);
26343
26386
  let beforeSHA = null;
26344
26387
  if (existing) {
26345
- const marker = await privateRead4(path14.join(skill.root, "promptframe-installation.json"));
26388
+ const marker = await privateRead4(path15.join(skill.root, "promptframe-installation.json"));
26346
26389
  if (!marker || marker.profile !== profile || marker.configFile !== configFile2 || marker.name !== name) fail6("claude_skill_requires_review");
26347
26390
  const old = { ...skill, sha256: marker.sha256 };
26348
26391
  if (!await observedSkill(old, complete)) fail6("claude_skill_requires_review");
@@ -26363,10 +26406,10 @@ async function installClaudeMcpFallback({
26363
26406
  } else {
26364
26407
  if (plan.beforeSHA !== null) fail6("claude_skill_requires_review");
26365
26408
  await claimSkillDirectory(plan.root);
26366
- await atomicJSON3(path14.join(plan.root, "promptframe-installation.json"), { host: "claude-code", profile, configFile: configFile2, name: plan.name, sha256: null });
26409
+ await atomicJSON3(path15.join(plan.root, "promptframe-installation.json"), { host: "claude-code", profile, configFile: configFile2, name: plan.name, sha256: null });
26367
26410
  }
26368
- await writeSkill(path14.join(plan.root, "SKILL.md"), plan.body);
26369
- await atomicJSON3(path14.join(plan.root, "promptframe-installation.json"), { host: "claude-code", profile, configFile: configFile2, name: plan.name, sha256: plan.sha256 });
26411
+ await writeSkill(path15.join(plan.root, "SKILL.md"), plan.body);
26412
+ await atomicJSON3(path15.join(plan.root, "promptframe-installation.json"), { host: "claude-code", profile, configFile: configFile2, name: plan.name, sha256: plan.sha256 });
26370
26413
  }
26371
26414
  signal?.throwIfAborted();
26372
26415
  if (compareVersions2(payload.version, "0.3.1") >= 0) complete.hostHooks = await registerClaudeFallbackHooks({ record: complete, root, env, nodeCommand: ready.nodeCommand, signal });
@@ -26435,7 +26478,7 @@ async function registrations(run, pluginName, marketplace, root) {
26435
26478
  if (plugins.some((p2) => !p2 || typeof p2.id !== "string" || !p2.id || p2.id.length > 256 || typeof p2.scope !== "string" || typeof p2.version !== "string" || typeof p2.enabled !== "boolean" || typeof p2.installPath !== "string") || markets.some((p2) => !p2 || typeof p2.name !== "string" || !p2.name || typeof p2.source !== "string"))
26436
26479
  fail7("claude_local_registration_unconfirmed");
26437
26480
  const related = plugins.filter((p2) => typeof p2?.id === "string" && p2.id.startsWith(pluginName + "@"));
26438
- if (related.length > 1 || related.some((p2) => p2.id !== pluginName + "@" + marketplace || p2.scope !== "user" || typeof p2.enabled !== "boolean" || !/^\d+\.\d+\.\d+$/.test(p2.version ?? "") || !path15.isAbsolute(p2.installPath ?? "") || p2.readFromFolder !== void 0 && (!path15.isAbsolute(p2.readFromFolder) || !/^\d+\.\d+\.\d+$/.test(p2.folderVersion ?? ""))))
26481
+ if (related.length > 1 || related.some((p2) => p2.id !== pluginName + "@" + marketplace || p2.scope !== "user" || typeof p2.enabled !== "boolean" || !/^\d+\.\d+\.\d+$/.test(p2.version ?? "") || !path16.isAbsolute(p2.installPath ?? "") || p2.readFromFolder !== void 0 && (!path16.isAbsolute(p2.readFromFolder) || !/^\d+\.\d+\.\d+$/.test(p2.folderVersion ?? ""))))
26439
26482
  fail7("claude_existing_registration_requires_review");
26440
26483
  const found = markets.filter((p2) => p2?.name === marketplace);
26441
26484
  if (found.length > 1 || found.some((p2) => p2.source !== "directory" || p2.path !== root || p2.installLocation !== root))
@@ -26455,19 +26498,19 @@ async function verifyVersion2(root, { version: version3, profile, configFile: co
26455
26498
  const directory2 = await info4(root);
26456
26499
  if (!directory2?.isDirectory() || directory2.isSymbolicLink() || directory2.uid !== process.getuid?.() || directory2.mode & 63)
26457
26500
  fail7("claude_installed_files_invalid");
26458
- const ready = await privateRead5(path15.join(root, "installation.json"));
26501
+ const ready = await privateRead5(path16.join(root, "installation.json"));
26459
26502
  if (!ready || ready.host !== "claude-code" || ready.version !== version3 || ready.profile !== profile || ready.configFile !== configFile2 || ready.payloadDigest !== payloadDigest || !Array.isArray(ready.files) || ready.files.length > 1024) fail7("claude_installed_files_invalid");
26460
26503
  const actual = await inspectRuntimePackage(root);
26461
- if (actual.version !== version3 || JSON.stringify(actual.files.map(({ path: path17, bytes: bytes2, sha256 }) => ({ path: path17, bytes: bytes2, sha256 }))) !== JSON.stringify(ready.files))
26504
+ if (actual.version !== version3 || JSON.stringify(actual.files.map(({ path: path18, bytes: bytes2, sha256 }) => ({ path: path18, bytes: bytes2, sha256 }))) !== JSON.stringify(ready.files))
26462
26505
  fail7("claude_installed_files_invalid");
26463
- const manifest = JSON.parse(await readFile9(path15.join(root, ".claude-plugin/plugin.json"), "utf8"));
26506
+ const manifest = JSON.parse(await readFile9(path16.join(root, ".claude-plugin/plugin.json"), "utf8"));
26464
26507
  if (manifest.name !== pluginName || manifest.version !== version3 || manifest.skills !== "./skills/" || manifest.mcpServers !== "./.claude-mcp.json")
26465
26508
  fail7("claude_installed_files_invalid");
26466
26509
  let runtimeCommand;
26467
26510
  for (const file of [".mcp.json", ".claude-mcp.json"]) {
26468
- const mcp = JSON.parse(await readFile9(path15.join(root, file), "utf8"));
26511
+ const mcp = JSON.parse(await readFile9(path16.join(root, file), "utf8"));
26469
26512
  const command2 = mcp.mcpServers?.[serverName]?.command;
26470
- if (!path15.isAbsolute(command2 ?? "") || runtimeCommand !== void 0 && command2 !== runtimeCommand || JSON.stringify(mcp) !== JSON.stringify(transport(serverName, configFile2, command2))) fail7("claude_installed_files_invalid");
26513
+ if (!path16.isAbsolute(command2 ?? "") || runtimeCommand !== void 0 && command2 !== runtimeCommand || JSON.stringify(mcp) !== JSON.stringify(transport(serverName, configFile2, command2))) fail7("claude_installed_files_invalid");
26471
26514
  runtimeCommand = command2;
26472
26515
  }
26473
26516
  if (compareVersions3(version3, "0.3.1") >= 0 && JSON.stringify(manifest.hooks) !== JSON.stringify(claudeHostHooks({ pluginName, configFile: configFile2, nodeCommand: runtimeCommand })))
@@ -26477,7 +26520,7 @@ async function verifyVersion2(root, { version: version3, profile, configFile: co
26477
26520
  async function installForClaudeUser(options = {}) {
26478
26521
  const profile = options.profile ?? "default", env = options.env ?? process.env;
26479
26522
  validProfile2(profile);
26480
- const modeRoot = path15.resolve(env.XDG_DATA_HOME ?? path15.join(homedir9(), ".local/share"), "promptframe-creation", profile, "claude-code-mode");
26523
+ const modeRoot = path16.resolve(env.XDG_DATA_HOME ?? path16.join(homedir9(), ".local/share"), "promptframe-creation", profile, "claude-code-mode");
26481
26524
  await privateDirectory6(modeRoot);
26482
26525
  const release = await acquire4(modeRoot, options.signal);
26483
26526
  try {
@@ -26499,37 +26542,37 @@ async function installClaudeUserLocked({
26499
26542
  nodeCommand = process.execPath
26500
26543
  } = {}) {
26501
26544
  validProfile2(profile);
26502
- if (!path15.isAbsolute(nodeCommand)) fail7("runtime_command_invalid");
26545
+ if (!path16.isAbsolute(nodeCommand)) fail7("runtime_command_invalid");
26503
26546
  const hostVersion = (await runClaude(["--version"])).trim().match(/^(\d+\.\d+\.\d+) \(Claude Code\)$/);
26504
26547
  if (!hostVersion || compareVersions3(hostVersion[1], "2.1.295") < 0) fail7("claude_21295_required");
26505
26548
  const help = await runClaude(["--help"]);
26506
26549
  if (typeof help !== "string" || Buffer.byteLength(help) > 128 * 1024) fail7("claude_capabilities_unconfirmed");
26507
26550
  const hasPlugin = /^\s+plugin(?:\|plugins)?\s/m.test(help), hasMcp = /^\s+mcp\s/m.test(help);
26508
- const base = path15.resolve(env.XDG_DATA_HOME ?? path15.join(homedir9(), ".local/share"), "promptframe-creation", profile), fallbackRoot = path15.join(base, "claude-code-mcp"), pluginRoot = path15.join(base, "claude-code");
26509
- const pluginPending = await info4(path15.join(pluginRoot, "registration-pending.json")), pluginCurrent = await info4(path15.join(pluginRoot, "current.json")), fallbackState = await info4(path15.join(fallbackRoot, "current.json")) || await info4(path15.join(fallbackRoot, "registration-pending.json"));
26551
+ const base = path16.resolve(env.XDG_DATA_HOME ?? path16.join(homedir9(), ".local/share"), "promptframe-creation", profile), fallbackRoot = path16.join(base, "claude-code-mcp"), pluginRoot = path16.join(base, "claude-code");
26552
+ const pluginPending = await info4(path16.join(pluginRoot, "registration-pending.json")), pluginCurrent = await info4(path16.join(pluginRoot, "current.json")), fallbackState = await info4(path16.join(fallbackRoot, "current.json")) || await info4(path16.join(fallbackRoot, "registration-pending.json"));
26510
26553
  if ((!hasPlugin || fallbackState) && (pluginPending || pluginCurrent)) fail7("registration_unconfirmed_keep_existing");
26511
26554
  if (!hasPlugin || fallbackState) {
26512
26555
  if (!hasMcp) fail7("claude_capabilities_unconfirmed");
26513
26556
  return installClaudeMcpFallback({ sourceRoot, profile, env, configFile: configFile2, signal, runClaude, checkRuntime, verifyInstalledRuntime, nodeCommand });
26514
26557
  }
26515
- const payload = await inspectRuntimePackage(path15.resolve(sourceRoot));
26558
+ const payload = await inspectRuntimePackage(path16.resolve(sourceRoot));
26516
26559
  if (!payload.files.some((f2) => f2.path === ".claude-plugin/plugin.json") || !payload.files.some((f2) => f2.path === ".claude-mcp.json"))
26517
26560
  fail7("claude_package_incomplete");
26518
- const root = path15.resolve(env.XDG_DATA_HOME ?? path15.join(homedir9(), ".local/share"), "promptframe-creation", profile, "claude-code");
26561
+ const root = path16.resolve(env.XDG_DATA_HOME ?? path16.join(homedir9(), ".local/share"), "promptframe-creation", profile, "claude-code");
26519
26562
  await privateDirectory6(root);
26520
26563
  const release = await acquire4(root, signal);
26521
26564
  const suffix = profile === "default" ? "" : "-" + profile, pluginName = "promptframe-creation" + suffix, marketplace = "promptframe-creation-user" + suffix, pluginId = pluginName + "@" + marketplace, serverName = "promptframe" + suffix;
26522
- const versions = path15.join(root, "versions"), currentFile = path15.join(root, "current.json"), pendingFile = path15.join(root, "registration-pending.json"), catalogFile = path15.join(root, ".claude-plugin/marketplace.json"), versionRoot = path15.join(versions, payload.version), temporary = path15.join(versions, ".partial-" + randomBytes7(12).toString("hex"));
26565
+ const versions = path16.join(root, "versions"), currentFile = path16.join(root, "current.json"), pendingFile = path16.join(root, "registration-pending.json"), catalogFile = path16.join(root, ".claude-plugin/marketplace.json"), versionRoot = path16.join(versions, payload.version), temporary = path16.join(versions, ".partial-" + randomBytes7(12).toString("hex"));
26523
26566
  let registrationStarted = false, newFiles = 0;
26524
26567
  try {
26525
26568
  signal?.throwIfAborted();
26526
26569
  await privateDirectory6(versions);
26527
- await privateDirectory6(path15.dirname(catalogFile));
26570
+ await privateDirectory6(path16.dirname(catalogFile));
26528
26571
  await legacyUserMcp(env, serverName);
26529
26572
  let previous = await privateRead5(currentFile), pending = await privateRead5(pendingFile), state = await registrations(runClaude, pluginName, marketplace, root);
26530
26573
  const binding = { profile, configFile: configFile2, pluginId, pluginName, serverName, host: "claude-code" };
26531
26574
  const checkBinding = (record2) => {
26532
- if (record2 && (record2.profile !== profile || record2.configFile !== configFile2 || record2.pluginId !== pluginId || record2.host !== "claude-code" || !/^\d+\.\d+\.\d+$/.test(record2.version ?? "") || record2.versionRoot !== path15.join(versions, record2.version))) fail7("profile_binding_conflict");
26575
+ if (record2 && (record2.profile !== profile || record2.configFile !== configFile2 || record2.pluginId !== pluginId || record2.host !== "claude-code" || !/^\d+\.\d+\.\d+$/.test(record2.version ?? "") || record2.versionRoot !== path16.join(versions, record2.version))) fail7("profile_binding_conflict");
26533
26576
  };
26534
26577
  checkBinding(previous);
26535
26578
  checkBinding(pending);
@@ -26576,9 +26619,9 @@ async function installClaudeUserLocked({
26576
26619
  await mkdir7(temporary, { mode: 448 });
26577
26620
  for (const file of payload.files) {
26578
26621
  signal?.throwIfAborted();
26579
- const dest = path15.join(temporary, file.path);
26580
- await mkdir7(path15.dirname(dest), { recursive: true, mode: 448 });
26581
- const fd = await open9(dest, "wx", 384);
26622
+ const dest = path16.join(temporary, file.path);
26623
+ await mkdir7(path16.dirname(dest), { recursive: true, mode: 448 });
26624
+ const fd = await open10(dest, "wx", 384);
26582
26625
  try {
26583
26626
  await fd.writeFile(file.body);
26584
26627
  await fd.sync();
@@ -26586,18 +26629,18 @@ async function installClaudeUserLocked({
26586
26629
  await fd.close();
26587
26630
  }
26588
26631
  }
26589
- const manifest = JSON.parse(await readFile9(path15.join(temporary, ".claude-plugin/plugin.json"), "utf8"));
26632
+ const manifest = JSON.parse(await readFile9(path16.join(temporary, ".claude-plugin/plugin.json"), "utf8"));
26590
26633
  manifest.name = pluginName;
26591
26634
  if (manifest.hooks) manifest.hooks = claudeHostHooks({ pluginName, configFile: configFile2, nodeCommand });
26592
- await atomicJSON4(path15.join(temporary, ".claude-plugin/plugin.json"), manifest);
26593
- for (const file of [".mcp.json", ".claude-mcp.json"]) await atomicJSON4(path15.join(temporary, file), transport(serverName, configFile2, nodeCommand));
26635
+ await atomicJSON4(path16.join(temporary, ".claude-plugin/plugin.json"), manifest);
26636
+ for (const file of [".mcp.json", ".claude-mcp.json"]) await atomicJSON4(path16.join(temporary, file), transport(serverName, configFile2, nodeCommand));
26594
26637
  await checkRuntime(temporary, payload.version);
26595
26638
  const installed = await inspectRuntimePackage(temporary);
26596
- await atomicJSON4(path15.join(temporary, "installation.json"), {
26639
+ await atomicJSON4(path16.join(temporary, "installation.json"), {
26597
26640
  ...binding,
26598
26641
  version: payload.version,
26599
26642
  payloadDigest: payload.payloadDigest,
26600
- files: installed.files.map(({ path: path17, bytes: bytes2, sha256 }) => ({ path: path17, bytes: bytes2, sha256 }))
26643
+ files: installed.files.map(({ path: path18, bytes: bytes2, sha256 }) => ({ path: path18, bytes: bytes2, sha256 }))
26601
26644
  });
26602
26645
  signal?.throwIfAborted();
26603
26646
  await rename7(temporary, versionRoot);
@@ -26652,7 +26695,7 @@ async function installClaudeUserLocked({
26652
26695
 
26653
26696
  // lib/cli.mjs
26654
26697
  import { fileURLToPath } from "node:url";
26655
- import path16 from "node:path";
26698
+ import path17 from "node:path";
26656
26699
  var args = process.argv.slice(2);
26657
26700
  var command = args.shift();
26658
26701
  var value = (key) => {
@@ -26660,7 +26703,7 @@ var value = (key) => {
26660
26703
  return i < 0 ? void 0 : args[i + 1];
26661
26704
  };
26662
26705
  var log = (value2) => process.stdout.write(JSON.stringify(value2) + "\n");
26663
- var configFile = () => value("--config") ? path16.resolve(value("--config")) : profileCredentialsPath(value("--profile") ?? "default");
26706
+ var configFile = () => value("--config") ? path17.resolve(value("--config")) : profileCredentialsPath(value("--profile") ?? "default");
26664
26707
  async function probe(credentials) {
26665
26708
  const client = await connectPlatform(credentials, { host: resolveHostIdentity({ host: value("--host") }) });
26666
26709
  try {
@@ -26800,7 +26843,7 @@ async function bridge() {
26800
26843
  resolvedVersion: value("--resolved-runtime-version"),
26801
26844
  signal: startup.signal,
26802
26845
  hostKind: identity.kind,
26803
- cacheRoot: path16.join(path16.dirname(configFile()), "runtime-cache")
26846
+ cacheRoot: path17.join(path17.dirname(configFile()), "runtime-cache")
26804
26847
  });
26805
26848
  startup.signal.throwIfAborted();
26806
26849
  } catch (error4) {
@@ -26834,7 +26877,7 @@ async function bridge() {
26834
26877
  credentials,
26835
26878
  host: identity,
26836
26879
  hostSession,
26837
- localUploads: createLocalUploadManager({ stateRoot: path16.join(path16.dirname(configFile()), "local-upload-state") }),
26880
+ localUploads: createLocalUploadManager({ stateRoot: path17.join(path17.dirname(configFile()), "local-upload-state") }),
26838
26881
  onCatalogChange: () => server.sendToolListChanged(),
26839
26882
  onKnowledgeChange: (kind) => kind === "resources" ? server.sendResourceListChanged() : server.sendPromptListChanged()
26840
26883
  });