@promptframe/creation 0.3.12 → 0.3.13

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, constants8) {
410
+ optimizeNames(names, constants9) {
411
411
  if (!names[this.name.str])
412
412
  return;
413
413
  if (this.rhs)
414
- this.rhs = optimizeExpr(this.rhs, names, constants8);
414
+ this.rhs = optimizeExpr(this.rhs, names, constants9);
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, constants8) {
431
+ optimizeNames(names, constants9) {
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, constants8);
434
+ this.rhs = optimizeExpr(this.rhs, names, constants9);
435
435
  return this;
436
436
  }
437
437
  get names() {
@@ -470,9 +470,9 @@ var require_codegen = __commonJS({
470
470
  }
471
471
  };
472
472
  var Throw = class extends Node {
473
- constructor(error5) {
473
+ constructor(error6) {
474
474
  super();
475
- this.error = error5;
475
+ this.error = error6;
476
476
  }
477
477
  render({ _n: _n2 }) {
478
478
  return `throw ${this.error};` + _n2;
@@ -492,8 +492,8 @@ var require_codegen = __commonJS({
492
492
  optimizeNodes() {
493
493
  return `${this.code}` ? this : void 0;
494
494
  }
495
- optimizeNames(names, constants8) {
496
- this.code = optimizeExpr(this.code, names, constants8);
495
+ optimizeNames(names, constants9) {
496
+ this.code = optimizeExpr(this.code, names, constants9);
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, constants8) {
525
+ optimizeNames(names, constants9) {
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, constants8))
530
+ if (n.optimizeNames(names, constants9))
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, constants8) {
583
+ optimizeNames(names, constants9) {
584
584
  var _a3;
585
- this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants8);
586
- if (!(super.optimizeNames(names, constants8) || this.else))
585
+ this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants9);
586
+ if (!(super.optimizeNames(names, constants9) || this.else))
587
587
  return;
588
- this.condition = optimizeExpr(this.condition, names, constants8);
588
+ this.condition = optimizeExpr(this.condition, names, constants9);
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, constants8) {
612
- if (!super.optimizeNames(names, constants8))
611
+ optimizeNames(names, constants9) {
612
+ if (!super.optimizeNames(names, constants9))
613
613
  return;
614
- this.iteration = optimizeExpr(this.iteration, names, constants8);
614
+ this.iteration = optimizeExpr(this.iteration, names, constants9);
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, constants8) {
651
- if (!super.optimizeNames(names, constants8))
650
+ optimizeNames(names, constants9) {
651
+ if (!super.optimizeNames(names, constants9))
652
652
  return;
653
- this.iterable = optimizeExpr(this.iterable, names, constants8);
653
+ this.iterable = optimizeExpr(this.iterable, names, constants9);
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, constants8) {
695
+ optimizeNames(names, constants9) {
696
696
  var _a3, _b;
697
- super.optimizeNames(names, constants8);
698
- (_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants8);
699
- (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants8);
697
+ super.optimizeNames(names, constants9);
698
+ (_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants9);
699
+ (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants9);
700
700
  return this;
701
701
  }
702
702
  get names() {
@@ -709,9 +709,9 @@ var require_codegen = __commonJS({
709
709
  }
710
710
  };
711
711
  var Catch = class extends BlockNode {
712
- constructor(error5) {
712
+ constructor(error6) {
713
713
  super();
714
- this.error = error5;
714
+ this.error = error6;
715
715
  }
716
716
  render(opts) {
717
717
  return `catch(${this.error})` + super.render(opts);
@@ -902,9 +902,9 @@ var require_codegen = __commonJS({
902
902
  this._blockNode(node2);
903
903
  this.code(tryBody);
904
904
  if (catchCode) {
905
- const error5 = this.name("e");
906
- this._currNode = node2.catch = new Catch(error5);
907
- catchCode(error5);
905
+ const error6 = this.name("e");
906
+ this._currNode = node2.catch = new Catch(error6);
907
+ catchCode(error6);
908
908
  }
909
909
  if (finallyCode) {
910
910
  this._currNode = node2.finally = new Finally();
@@ -913,8 +913,8 @@ var require_codegen = __commonJS({
913
913
  return this._endBlockNode(Catch, Finally);
914
914
  }
915
915
  // `throw` statement
916
- throw(error5) {
917
- return this._leafNode(new Throw(error5));
916
+ throw(error6) {
917
+ return this._leafNode(new Throw(error6));
918
918
  }
919
919
  // start self-balancing block
920
920
  block(body, nodeCount) {
@@ -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, constants8) {
1000
+ function optimizeExpr(expr, names, constants9) {
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 = constants8[n.str];
1015
+ const c = constants9[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 && constants8[c.str] !== void 0);
1022
+ return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants9[c.str] !== void 0);
1023
1023
  }
1024
1024
  }
1025
1025
  function subtractNames(names, from) {
@@ -1058,10 +1058,10 @@ var require_util = __commonJS({
1058
1058
  var codegen_1 = require_codegen();
1059
1059
  var code_1 = require_code();
1060
1060
  function toHash(arr) {
1061
- const hash7 = {};
1061
+ const hash8 = {};
1062
1062
  for (const item of arr)
1063
- hash7[item] = true;
1064
- return hash7;
1063
+ hash8[item] = true;
1064
+ return hash8;
1065
1065
  }
1066
1066
  exports.toHash = toHash;
1067
1067
  function alwaysValidSchema(it2, schema) {
@@ -1270,10 +1270,10 @@ var require_errors = __commonJS({
1270
1270
  exports.keyword$DataError = {
1271
1271
  message: ({ keyword, schemaType }) => schemaType ? (0, codegen_1.str)`"${keyword}" keyword must be ${schemaType} ($data)` : (0, codegen_1.str)`"${keyword}" keyword is invalid ($data)`
1272
1272
  };
1273
- function reportError(cxt, error5 = exports.keywordError, errorPaths, overrideAllErrors) {
1273
+ function reportError(cxt, error6 = exports.keywordError, errorPaths, overrideAllErrors) {
1274
1274
  const { it: it2 } = cxt;
1275
1275
  const { gen, compositeRule, allErrors } = it2;
1276
- const errObj = errorObjectCode(cxt, error5, errorPaths);
1276
+ const errObj = errorObjectCode(cxt, error6, errorPaths);
1277
1277
  if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : compositeRule || allErrors) {
1278
1278
  addError(gen, errObj);
1279
1279
  } else {
@@ -1281,10 +1281,10 @@ var require_errors = __commonJS({
1281
1281
  }
1282
1282
  }
1283
1283
  exports.reportError = reportError;
1284
- function reportExtraError(cxt, error5 = exports.keywordError, errorPaths) {
1284
+ function reportExtraError(cxt, error6 = exports.keywordError, errorPaths) {
1285
1285
  const { it: it2 } = cxt;
1286
1286
  const { gen, compositeRule, allErrors } = it2;
1287
- const errObj = errorObjectCode(cxt, error5, errorPaths);
1287
+ const errObj = errorObjectCode(cxt, error6, errorPaths);
1288
1288
  addError(gen, errObj);
1289
1289
  if (!(compositeRule || allErrors)) {
1290
1290
  returnErrors(it2, names_1.default.vErrors);
@@ -1335,19 +1335,19 @@ var require_errors = __commonJS({
1335
1335
  schema: new codegen_1.Name("schema"),
1336
1336
  parentSchema: new codegen_1.Name("parentSchema")
1337
1337
  };
1338
- function errorObjectCode(cxt, error5, errorPaths) {
1338
+ function errorObjectCode(cxt, error6, errorPaths) {
1339
1339
  const { createErrors } = cxt.it;
1340
1340
  if (createErrors === false)
1341
1341
  return (0, codegen_1._)`{}`;
1342
- return errorObject(cxt, error5, errorPaths);
1342
+ return errorObject(cxt, error6, errorPaths);
1343
1343
  }
1344
- function errorObject(cxt, error5, errorPaths = {}) {
1344
+ function errorObject(cxt, error6, errorPaths = {}) {
1345
1345
  const { gen, it: it2 } = cxt;
1346
1346
  const keyValues = [
1347
1347
  errorInstancePath(it2, errorPaths),
1348
1348
  errorSchemaPath(cxt, errorPaths)
1349
1349
  ];
1350
- extraErrorProps(cxt, error5, keyValues);
1350
+ extraErrorProps(cxt, error6, keyValues);
1351
1351
  return gen.object(...keyValues);
1352
1352
  }
1353
1353
  function errorInstancePath({ errorPath }, { instancePath }) {
@@ -3259,8 +3259,8 @@ var require_utils = __commonJS({
3259
3259
  }
3260
3260
  return ind;
3261
3261
  }
3262
- function removeDotSegments(path21) {
3263
- let input = path21;
3262
+ function removeDotSegments(path23) {
3263
+ let input = path23;
3264
3264
  const output = [];
3265
3265
  let nextSlash = -1;
3266
3266
  let len = 0;
@@ -3349,9 +3349,9 @@ var require_utils = __commonJS({
3349
3349
  let output = "";
3350
3350
  for (let i = 0; i < input.length; i++) {
3351
3351
  if (input[i] === "%" && i + 2 < input.length) {
3352
- const hex2 = input.slice(i + 1, i + 3);
3353
- if (isHexPair(hex2)) {
3354
- const normalizedHex = hex2.toUpperCase();
3352
+ const hex3 = input.slice(i + 1, i + 3);
3353
+ if (isHexPair(hex3)) {
3354
+ const normalizedHex = hex3.toUpperCase();
3355
3355
  const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3356
3356
  if (decodeUnreserved && isUnreserved(decoded)) {
3357
3357
  output += decoded;
@@ -3371,9 +3371,9 @@ var require_utils = __commonJS({
3371
3371
  for (let i = 0; i < input.length; i++) {
3372
3372
  const ch = input[i];
3373
3373
  if (ch === "%" && i + 2 < input.length) {
3374
- const hex2 = input.slice(i + 1, i + 3);
3375
- if (isHexPair(hex2)) {
3376
- const normalizedHex = hex2.toUpperCase();
3374
+ const hex3 = input.slice(i + 1, i + 3);
3375
+ if (isHexPair(hex3)) {
3376
+ const normalizedHex = hex3.toUpperCase();
3377
3377
  const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3378
3378
  if (decoded !== "." && isUnreserved(decoded)) {
3379
3379
  output += decoded;
@@ -3413,9 +3413,9 @@ var require_utils = __commonJS({
3413
3413
  for (let i = 0; i < input.length; i++) {
3414
3414
  const ch = input[i];
3415
3415
  if (ch === "%" && i + 2 < input.length) {
3416
- const hex2 = input.slice(i + 1, i + 3);
3417
- if (isHexPair(hex2)) {
3418
- output += "%" + hex2.toUpperCase();
3416
+ const hex3 = input.slice(i + 1, i + 3);
3417
+ if (isHexPair(hex3)) {
3418
+ output += "%" + hex3.toUpperCase();
3419
3419
  i += 2;
3420
3420
  continue;
3421
3421
  }
@@ -3451,9 +3451,9 @@ var require_utils = __commonJS({
3451
3451
  for (let i = 0; i < input.length; i++) {
3452
3452
  const ch = input[i];
3453
3453
  if (ch === "%" && i + 2 < input.length) {
3454
- const hex2 = input.slice(i + 1, i + 3);
3455
- if (isHexPair(hex2)) {
3456
- output += "%" + hex2.toUpperCase();
3454
+ const hex3 = input.slice(i + 1, i + 3);
3455
+ if (isHexPair(hex3)) {
3456
+ output += "%" + hex3.toUpperCase();
3457
3457
  i += 2;
3458
3458
  continue;
3459
3459
  }
@@ -3498,9 +3498,9 @@ var require_utils = __commonJS({
3498
3498
  for (let i = 0; i < input.length; i++) {
3499
3499
  const ch = input[i];
3500
3500
  if (ch === "%" && i + 2 < input.length) {
3501
- const hex2 = input.slice(i + 1, i + 3);
3502
- if (isHexPair(hex2)) {
3503
- const normalizedHex = hex2.toUpperCase();
3501
+ const hex3 = input.slice(i + 1, i + 3);
3502
+ if (isHexPair(hex3)) {
3503
+ const normalizedHex = hex3.toUpperCase();
3504
3504
  const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3505
3505
  if (isUnreserved(decoded)) {
3506
3506
  output += decoded;
@@ -3538,9 +3538,9 @@ var require_utils = __commonJS({
3538
3538
  let output = "";
3539
3539
  for (let i = 0; i < input.length; i++) {
3540
3540
  if (input[i] === "%" && i + 2 < input.length) {
3541
- const hex2 = input.slice(i + 1, i + 3);
3542
- if (isHexPair(hex2)) {
3543
- output += "%" + hex2.toUpperCase();
3541
+ const hex3 = input.slice(i + 1, i + 3);
3542
+ if (isHexPair(hex3)) {
3543
+ output += "%" + hex3.toUpperCase();
3544
3544
  i += 2;
3545
3545
  continue;
3546
3546
  }
@@ -3669,8 +3669,8 @@ var require_schemes = __commonJS({
3669
3669
  }
3670
3670
  if (wsComponent.resourceName) {
3671
3671
  const queryIndex = wsComponent.resourceName.indexOf("?");
3672
- const path21 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
3673
- wsComponent.path = path21 && path21 !== "/" ? path21 : void 0;
3672
+ const path23 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
3673
+ wsComponent.path = path23 && path23 !== "/" ? path23 : void 0;
3674
3674
  wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
3675
3675
  wsComponent.resourceName = void 0;
3676
3676
  }
@@ -5012,7 +5012,7 @@ var require_limitNumber = __commonJS({
5012
5012
  exclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE },
5013
5013
  exclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }
5014
5014
  };
5015
- var error5 = {
5015
+ var error6 = {
5016
5016
  message: ({ keyword, schemaCode }) => (0, codegen_1.str)`must be ${KWDs[keyword].okStr} ${schemaCode}`,
5017
5017
  params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
5018
5018
  };
@@ -5021,7 +5021,7 @@ var require_limitNumber = __commonJS({
5021
5021
  type: "number",
5022
5022
  schemaType: "number",
5023
5023
  $data: true,
5024
- error: error5,
5024
+ error: error6,
5025
5025
  code(cxt) {
5026
5026
  const { keyword, data, schemaCode } = cxt;
5027
5027
  cxt.fail$data((0, codegen_1._)`${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`);
@@ -5037,7 +5037,7 @@ var require_multipleOf = __commonJS({
5037
5037
  "use strict";
5038
5038
  Object.defineProperty(exports, "__esModule", { value: true });
5039
5039
  var codegen_1 = require_codegen();
5040
- var error5 = {
5040
+ var error6 = {
5041
5041
  message: ({ schemaCode }) => (0, codegen_1.str)`must be multiple of ${schemaCode}`,
5042
5042
  params: ({ schemaCode }) => (0, codegen_1._)`{multipleOf: ${schemaCode}}`
5043
5043
  };
@@ -5046,7 +5046,7 @@ var require_multipleOf = __commonJS({
5046
5046
  type: "number",
5047
5047
  schemaType: "number",
5048
5048
  $data: true,
5049
- error: error5,
5049
+ error: error6,
5050
5050
  code(cxt) {
5051
5051
  const { gen, data, schemaCode, it: it2 } = cxt;
5052
5052
  const prec = it2.opts.multipleOfPrecision;
@@ -5093,7 +5093,7 @@ var require_limitLength = __commonJS({
5093
5093
  var codegen_1 = require_codegen();
5094
5094
  var util_1 = require_util();
5095
5095
  var ucs2length_1 = require_ucs2length();
5096
- var error5 = {
5096
+ var error6 = {
5097
5097
  message({ keyword, schemaCode }) {
5098
5098
  const comp = keyword === "maxLength" ? "more" : "fewer";
5099
5099
  return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} characters`;
@@ -5105,7 +5105,7 @@ var require_limitLength = __commonJS({
5105
5105
  type: "string",
5106
5106
  schemaType: "number",
5107
5107
  $data: true,
5108
- error: error5,
5108
+ error: error6,
5109
5109
  code(cxt) {
5110
5110
  const { keyword, data, schemaCode, it: it2 } = cxt;
5111
5111
  const op = keyword === "maxLength" ? codegen_1.operators.GT : codegen_1.operators.LT;
@@ -5125,7 +5125,7 @@ var require_pattern = __commonJS({
5125
5125
  var code_1 = require_code2();
5126
5126
  var util_1 = require_util();
5127
5127
  var codegen_1 = require_codegen();
5128
- var error5 = {
5128
+ var error6 = {
5129
5129
  message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
5130
5130
  params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}`
5131
5131
  };
@@ -5134,7 +5134,7 @@ var require_pattern = __commonJS({
5134
5134
  type: "string",
5135
5135
  schemaType: "string",
5136
5136
  $data: true,
5137
- error: error5,
5137
+ error: error6,
5138
5138
  code(cxt) {
5139
5139
  const { gen, data, $data, schema, schemaCode, it: it2 } = cxt;
5140
5140
  const u2 = it2.opts.unicodeRegExp ? "u" : "";
@@ -5160,7 +5160,7 @@ var require_limitProperties = __commonJS({
5160
5160
  "use strict";
5161
5161
  Object.defineProperty(exports, "__esModule", { value: true });
5162
5162
  var codegen_1 = require_codegen();
5163
- var error5 = {
5163
+ var error6 = {
5164
5164
  message({ keyword, schemaCode }) {
5165
5165
  const comp = keyword === "maxProperties" ? "more" : "fewer";
5166
5166
  return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} properties`;
@@ -5172,7 +5172,7 @@ var require_limitProperties = __commonJS({
5172
5172
  type: "object",
5173
5173
  schemaType: "number",
5174
5174
  $data: true,
5175
- error: error5,
5175
+ error: error6,
5176
5176
  code(cxt) {
5177
5177
  const { keyword, data, schemaCode } = cxt;
5178
5178
  const op = keyword === "maxProperties" ? codegen_1.operators.GT : codegen_1.operators.LT;
@@ -5191,7 +5191,7 @@ var require_required = __commonJS({
5191
5191
  var code_1 = require_code2();
5192
5192
  var codegen_1 = require_codegen();
5193
5193
  var util_1 = require_util();
5194
- var error5 = {
5194
+ var error6 = {
5195
5195
  message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`,
5196
5196
  params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}`
5197
5197
  };
@@ -5200,7 +5200,7 @@ var require_required = __commonJS({
5200
5200
  type: "object",
5201
5201
  schemaType: "array",
5202
5202
  $data: true,
5203
- error: error5,
5203
+ error: error6,
5204
5204
  code(cxt) {
5205
5205
  const { gen, schema, schemaCode, data, $data, it: it2 } = cxt;
5206
5206
  const { opts } = it2;
@@ -5271,7 +5271,7 @@ var require_limitItems = __commonJS({
5271
5271
  "use strict";
5272
5272
  Object.defineProperty(exports, "__esModule", { value: true });
5273
5273
  var codegen_1 = require_codegen();
5274
- var error5 = {
5274
+ var error6 = {
5275
5275
  message({ keyword, schemaCode }) {
5276
5276
  const comp = keyword === "maxItems" ? "more" : "fewer";
5277
5277
  return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} items`;
@@ -5283,7 +5283,7 @@ var require_limitItems = __commonJS({
5283
5283
  type: "array",
5284
5284
  schemaType: "number",
5285
5285
  $data: true,
5286
- error: error5,
5286
+ error: error6,
5287
5287
  code(cxt) {
5288
5288
  const { keyword, data, schemaCode } = cxt;
5289
5289
  const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT;
@@ -5314,7 +5314,7 @@ var require_uniqueItems = __commonJS({
5314
5314
  var codegen_1 = require_codegen();
5315
5315
  var util_1 = require_util();
5316
5316
  var equal_1 = require_equal();
5317
- var error5 = {
5317
+ var error6 = {
5318
5318
  message: ({ params: { i, j: j2 } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j2} and ${i} are identical)`,
5319
5319
  params: ({ params: { i, j: j2 } }) => (0, codegen_1._)`{i: ${i}, j: ${j2}}`
5320
5320
  };
@@ -5323,7 +5323,7 @@ var require_uniqueItems = __commonJS({
5323
5323
  type: "array",
5324
5324
  schemaType: "boolean",
5325
5325
  $data: true,
5326
- error: error5,
5326
+ error: error6,
5327
5327
  code(cxt) {
5328
5328
  const { gen, data, $data, schema, parentSchema, schemaCode, it: it2 } = cxt;
5329
5329
  if (!$data && !schema)
@@ -5380,14 +5380,14 @@ var require_const = __commonJS({
5380
5380
  var codegen_1 = require_codegen();
5381
5381
  var util_1 = require_util();
5382
5382
  var equal_1 = require_equal();
5383
- var error5 = {
5383
+ var error6 = {
5384
5384
  message: "must be equal to constant",
5385
5385
  params: ({ schemaCode }) => (0, codegen_1._)`{allowedValue: ${schemaCode}}`
5386
5386
  };
5387
5387
  var def = {
5388
5388
  keyword: "const",
5389
5389
  $data: true,
5390
- error: error5,
5390
+ error: error6,
5391
5391
  code(cxt) {
5392
5392
  const { gen, data, $data, schemaCode, schema } = cxt;
5393
5393
  if ($data || schema && typeof schema == "object") {
@@ -5409,7 +5409,7 @@ var require_enum = __commonJS({
5409
5409
  var codegen_1 = require_codegen();
5410
5410
  var util_1 = require_util();
5411
5411
  var equal_1 = require_equal();
5412
- var error5 = {
5412
+ var error6 = {
5413
5413
  message: "must be equal to one of the allowed values",
5414
5414
  params: ({ schemaCode }) => (0, codegen_1._)`{allowedValues: ${schemaCode}}`
5415
5415
  };
@@ -5417,7 +5417,7 @@ var require_enum = __commonJS({
5417
5417
  keyword: "enum",
5418
5418
  schemaType: "array",
5419
5419
  $data: true,
5420
- error: error5,
5420
+ error: error6,
5421
5421
  code(cxt) {
5422
5422
  const { gen, data, $data, schema, schemaCode, it: it2 } = cxt;
5423
5423
  if (!$data && schema.length === 0)
@@ -5496,7 +5496,7 @@ var require_additionalItems = __commonJS({
5496
5496
  exports.validateAdditionalItems = void 0;
5497
5497
  var codegen_1 = require_codegen();
5498
5498
  var util_1 = require_util();
5499
- var error5 = {
5499
+ var error6 = {
5500
5500
  message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
5501
5501
  params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
5502
5502
  };
@@ -5505,7 +5505,7 @@ var require_additionalItems = __commonJS({
5505
5505
  type: "array",
5506
5506
  schemaType: ["boolean", "object"],
5507
5507
  before: "uniqueItems",
5508
- error: error5,
5508
+ error: error6,
5509
5509
  code(cxt) {
5510
5510
  const { parentSchema, it: it2 } = cxt;
5511
5511
  const { items } = parentSchema;
@@ -5624,7 +5624,7 @@ var require_items2020 = __commonJS({
5624
5624
  var util_1 = require_util();
5625
5625
  var code_1 = require_code2();
5626
5626
  var additionalItems_1 = require_additionalItems();
5627
- var error5 = {
5627
+ var error6 = {
5628
5628
  message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
5629
5629
  params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
5630
5630
  };
@@ -5633,7 +5633,7 @@ var require_items2020 = __commonJS({
5633
5633
  type: "array",
5634
5634
  schemaType: ["object", "boolean"],
5635
5635
  before: "uniqueItems",
5636
- error: error5,
5636
+ error: error6,
5637
5637
  code(cxt) {
5638
5638
  const { schema, parentSchema, it: it2 } = cxt;
5639
5639
  const { prefixItems } = parentSchema;
@@ -5657,7 +5657,7 @@ var require_contains = __commonJS({
5657
5657
  Object.defineProperty(exports, "__esModule", { value: true });
5658
5658
  var codegen_1 = require_codegen();
5659
5659
  var util_1 = require_util();
5660
- var error5 = {
5660
+ var error6 = {
5661
5661
  message: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1.str)`must contain at least ${min} valid item(s)` : (0, codegen_1.str)`must contain at least ${min} and no more than ${max} valid item(s)`,
5662
5662
  params: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1._)`{minContains: ${min}}` : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}`
5663
5663
  };
@@ -5667,7 +5667,7 @@ var require_contains = __commonJS({
5667
5667
  schemaType: ["object", "boolean"],
5668
5668
  before: "uniqueItems",
5669
5669
  trackErrors: true,
5670
- error: error5,
5670
+ error: error6,
5671
5671
  code(cxt) {
5672
5672
  const { gen, schema, parentSchema, data, it: it2 } = cxt;
5673
5673
  let min;
@@ -5845,7 +5845,7 @@ var require_propertyNames = __commonJS({
5845
5845
  Object.defineProperty(exports, "__esModule", { value: true });
5846
5846
  var codegen_1 = require_codegen();
5847
5847
  var util_1 = require_util();
5848
- var error5 = {
5848
+ var error6 = {
5849
5849
  message: "property name must be valid",
5850
5850
  params: ({ params }) => (0, codegen_1._)`{propertyName: ${params.propertyName}}`
5851
5851
  };
@@ -5853,7 +5853,7 @@ var require_propertyNames = __commonJS({
5853
5853
  keyword: "propertyNames",
5854
5854
  type: "object",
5855
5855
  schemaType: ["object", "boolean"],
5856
- error: error5,
5856
+ error: error6,
5857
5857
  code(cxt) {
5858
5858
  const { gen, schema, data, it: it2 } = cxt;
5859
5859
  if ((0, util_1.alwaysValidSchema)(it2, schema))
@@ -5890,7 +5890,7 @@ var require_additionalProperties = __commonJS({
5890
5890
  var codegen_1 = require_codegen();
5891
5891
  var names_1 = require_names();
5892
5892
  var util_1 = require_util();
5893
- var error5 = {
5893
+ var error6 = {
5894
5894
  message: "must NOT have additional properties",
5895
5895
  params: ({ params }) => (0, codegen_1._)`{additionalProperty: ${params.additionalProperty}}`
5896
5896
  };
@@ -5900,7 +5900,7 @@ var require_additionalProperties = __commonJS({
5900
5900
  schemaType: ["boolean", "object"],
5901
5901
  allowUndefined: true,
5902
5902
  trackErrors: true,
5903
- error: error5,
5903
+ error: error6,
5904
5904
  code(cxt) {
5905
5905
  const { gen, schema, parentSchema, data, errsCount, it: it2 } = cxt;
5906
5906
  if (!errsCount)
@@ -6174,7 +6174,7 @@ var require_oneOf = __commonJS({
6174
6174
  Object.defineProperty(exports, "__esModule", { value: true });
6175
6175
  var codegen_1 = require_codegen();
6176
6176
  var util_1 = require_util();
6177
- var error5 = {
6177
+ var error6 = {
6178
6178
  message: "must match exactly one schema in oneOf",
6179
6179
  params: ({ params }) => (0, codegen_1._)`{passingSchemas: ${params.passing}}`
6180
6180
  };
@@ -6182,7 +6182,7 @@ var require_oneOf = __commonJS({
6182
6182
  keyword: "oneOf",
6183
6183
  schemaType: "array",
6184
6184
  trackErrors: true,
6185
- error: error5,
6185
+ error: error6,
6186
6186
  code(cxt) {
6187
6187
  const { gen, schema, parentSchema, it: it2 } = cxt;
6188
6188
  if (!Array.isArray(schema))
@@ -6259,7 +6259,7 @@ var require_if = __commonJS({
6259
6259
  Object.defineProperty(exports, "__esModule", { value: true });
6260
6260
  var codegen_1 = require_codegen();
6261
6261
  var util_1 = require_util();
6262
- var error5 = {
6262
+ var error6 = {
6263
6263
  message: ({ params }) => (0, codegen_1.str)`must match "${params.ifClause}" schema`,
6264
6264
  params: ({ params }) => (0, codegen_1._)`{failingKeyword: ${params.ifClause}}`
6265
6265
  };
@@ -6267,7 +6267,7 @@ var require_if = __commonJS({
6267
6267
  keyword: "if",
6268
6268
  schemaType: ["object", "boolean"],
6269
6269
  trackErrors: true,
6270
- error: error5,
6270
+ error: error6,
6271
6271
  code(cxt) {
6272
6272
  const { gen, parentSchema, it: it2 } = cxt;
6273
6273
  if (parentSchema.then === void 0 && parentSchema.else === void 0) {
@@ -6393,7 +6393,7 @@ var require_format = __commonJS({
6393
6393
  "use strict";
6394
6394
  Object.defineProperty(exports, "__esModule", { value: true });
6395
6395
  var codegen_1 = require_codegen();
6396
- var error5 = {
6396
+ var error6 = {
6397
6397
  message: ({ schemaCode }) => (0, codegen_1.str)`must match format "${schemaCode}"`,
6398
6398
  params: ({ schemaCode }) => (0, codegen_1._)`{format: ${schemaCode}}`
6399
6399
  };
@@ -6402,7 +6402,7 @@ var require_format = __commonJS({
6402
6402
  type: ["number", "string"],
6403
6403
  schemaType: "string",
6404
6404
  $data: true,
6405
- error: error5,
6405
+ error: error6,
6406
6406
  code(cxt, ruleType) {
6407
6407
  const { gen, data, $data, schema, schemaCode, it: it2 } = cxt;
6408
6408
  const { opts, errSchemaPath, schemaEnv, self } = it2;
@@ -6557,7 +6557,7 @@ var require_discriminator = __commonJS({
6557
6557
  var compile_1 = require_compile();
6558
6558
  var ref_error_1 = require_ref_error();
6559
6559
  var util_1 = require_util();
6560
- var error5 = {
6560
+ var error6 = {
6561
6561
  message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag ? `tag "${tagName}" must be string` : `value of tag "${tagName}" must be in oneOf`,
6562
6562
  params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._)`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`
6563
6563
  };
@@ -6565,7 +6565,7 @@ var require_discriminator = __commonJS({
6565
6565
  keyword: "discriminator",
6566
6566
  type: "object",
6567
6567
  schemaType: "object",
6568
- error: error5,
6568
+ error: error6,
6569
6569
  code(cxt) {
6570
6570
  const { gen, data, schema, parentSchema, it: it2 } = cxt;
6571
6571
  const { oneOf } = parentSchema;
@@ -7097,7 +7097,7 @@ var require_limit = __commonJS({
7097
7097
  formatExclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE },
7098
7098
  formatExclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }
7099
7099
  };
7100
- var error5 = {
7100
+ var error6 = {
7101
7101
  message: ({ keyword, schemaCode }) => (0, codegen_1.str)`should be ${KWDs[keyword].okStr} ${schemaCode}`,
7102
7102
  params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
7103
7103
  };
@@ -7106,7 +7106,7 @@ var require_limit = __commonJS({
7106
7106
  type: "string",
7107
7107
  schemaType: "string",
7108
7108
  $data: true,
7109
- error: error5,
7109
+ error: error6,
7110
7110
  code(cxt) {
7111
7111
  const { gen, data, schemaCode, keyword, it: it2 } = cxt;
7112
7112
  const { opts, self } = it2;
@@ -7351,9 +7351,9 @@ var secure = async (file, directory3 = false) => {
7351
7351
  let info5;
7352
7352
  try {
7353
7353
  info5 = await lstat(file);
7354
- } catch (error5) {
7355
- if (error5.code === "ENOENT") return null;
7356
- throw error5;
7354
+ } catch (error6) {
7355
+ if (error6.code === "ENOENT") return null;
7356
+ throw error6;
7357
7357
  }
7358
7358
  if (info5.isSymbolicLink() || !(directory3 ? info5.isDirectory() : info5.isFile()) || info5.uid !== process.getuid?.() || (info5.mode & 63) !== 0)
7359
7359
  throw new CreationClientError("credentials.private_owner_required");
@@ -7386,8 +7386,8 @@ async function writeCredentials(value2, file = credentialsPath()) {
7386
7386
  });
7387
7387
  await rename(temporary, file);
7388
7388
  } finally {
7389
- await unlink(temporary).catch((error5) => {
7390
- if (error5.code !== "ENOENT") throw error5;
7389
+ await unlink(temporary).catch((error6) => {
7390
+ if (error6.code !== "ENOENT") throw error6;
7391
7391
  });
7392
7392
  }
7393
7393
  }
@@ -7420,8 +7420,8 @@ async function openLocalUploadFile(selectedPath, { maxBytes: maxBytes2 = LOCAL_U
7420
7420
  let handle;
7421
7421
  try {
7422
7422
  handle = await open(selected, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
7423
- } catch (error5) {
7424
- throw failure(error5.code === "ELOOP" ? "file_not_regular" : error5.code === "EACCES" || error5.code === "EPERM" ? "file_read_denied" : "file_not_on_bridge_host");
7423
+ } catch (error6) {
7424
+ throw failure(error6.code === "ELOOP" ? "file_not_regular" : error6.code === "EACCES" || error6.code === "EPERM" ? "file_read_denied" : "file_not_on_bridge_host");
7425
7425
  }
7426
7426
  const abort = new AbortController(), streams = /* @__PURE__ */ new Map(), reads = /* @__PURE__ */ new Set();
7427
7427
  let closing = false, closed = false, original, closePromise;
@@ -7446,8 +7446,8 @@ async function openLocalUploadFile(selectedPath, { maxBytes: maxBytes2 = LOCAL_U
7446
7446
  try {
7447
7447
  const [current, named] = await Promise.all([handle.stat({ bigint: true }), lstat2(selected, { bigint: true })]);
7448
7448
  if (!current.isFile() || !named.isFile() || !equal(original, fingerprint(current)) || !equal(original, fingerprint(named))) throw failure("file_changed");
7449
- } catch (error5) {
7450
- if (error5 instanceof CreationClientError) throw error5;
7449
+ } catch (error6) {
7450
+ if (error6 instanceof CreationClientError) throw error6;
7451
7451
  throw failure("file_changed");
7452
7452
  }
7453
7453
  };
@@ -7466,17 +7466,17 @@ async function openLocalUploadFile(selectedPath, { maxBytes: maxBytes2 = LOCAL_U
7466
7466
  if (stat3.size <= 0n || stat3.size > BigInt(maxBytes2)) throw failure("file_size_limit");
7467
7467
  original = fingerprint(stat3);
7468
7468
  await assertUnchanged();
7469
- const hash7 = createHash("sha256"), buffer = Buffer.allocUnsafe(LOCAL_UPLOAD_READ_BYTES);
7469
+ const hash8 = createHash("sha256"), buffer = Buffer.allocUnsafe(LOCAL_UPLOAD_READ_BYTES);
7470
7470
  for (let position = 0; position < original.sizeBytes; ) {
7471
7471
  checkSignal();
7472
7472
  const length = Math.min(buffer.length, original.sizeBytes - position);
7473
7473
  const { bytesRead } = await read2(buffer, 0, length, position);
7474
7474
  if (bytesRead === 0) throw failure("file_changed");
7475
- hash7.update(buffer.subarray(0, bytesRead));
7475
+ hash8.update(buffer.subarray(0, bytesRead));
7476
7476
  position += bytesRead;
7477
7477
  }
7478
7478
  await assertUnchanged();
7479
- const checksum = "sha256:" + hash7.digest("hex");
7479
+ const checksum = "sha256:" + hash8.digest("hex");
7480
7480
  return {
7481
7481
  name,
7482
7482
  sizeBytes: original.sizeBytes,
@@ -7509,9 +7509,9 @@ async function openLocalUploadFile(selectedPath, { maxBytes: maxBytes2 = LOCAL_U
7509
7509
  return stream;
7510
7510
  }
7511
7511
  };
7512
- } catch (error5) {
7512
+ } catch (error6) {
7513
7513
  await close();
7514
- if (error5 instanceof CreationClientError) throw error5;
7514
+ if (error6 instanceof CreationClientError) throw error6;
7515
7515
  throw failure("file_read_failed");
7516
7516
  }
7517
7517
  }
@@ -7547,13 +7547,13 @@ var causes = /* @__PURE__ */ new Set([
7547
7547
  "validation_refused",
7548
7548
  "stream_unconfirmed"
7549
7549
  ]);
7550
- var localCause = (error5) => error5 instanceof CreationClientError ? {
7550
+ var localCause = (error6) => error6 instanceof CreationClientError ? {
7551
7551
  "creation.local_upload.file_read_failed": "local_read_failed",
7552
7552
  "creation.local_upload.file_changed": "local_file_changed",
7553
7553
  "creation.local_upload.file_read_cancelled": "local_read_cancelled"
7554
- }[error5.message] : void 0;
7555
- var networkCause = (error5) => {
7556
- const code = typeof error5?.cause?.code === "string" ? error5.cause.code : error5?.code;
7554
+ }[error6.message] : void 0;
7555
+ var networkCause = (error6) => {
7556
+ const code = typeof error6?.cause?.code === "string" ? error6.cause.code : error6?.code;
7557
7557
  if (["ENOTFOUND", "EAI_AGAIN"].includes(code)) return "dns_failure";
7558
7558
  if (code === "ECONNREFUSED") return "connection_refused";
7559
7559
  if (["ECONNRESET", "EPIPE", "UND_ERR_SOCKET"].includes(code)) return "connection_interrupted";
@@ -7624,9 +7624,9 @@ async function transferGrantedPart(file, authorization, grant, {
7624
7624
  report("checking_file", { bytesRead: 0 });
7625
7625
  try {
7626
7626
  await file.assertUnchanged();
7627
- } catch (error5) {
7628
- report("checking_file", { causeCode: localCause(error5) ?? "local_read_failed" });
7629
- throw error5;
7627
+ } catch (error6) {
7628
+ report("checking_file", { causeCode: localCause(error6) ?? "local_read_failed" });
7629
+ throw error6;
7630
7630
  }
7631
7631
  if (signal?.aborted) fail("transfer_cancelled");
7632
7632
  const controller = new AbortController();
@@ -7665,12 +7665,12 @@ async function transferGrantedPart(file, authorization, grant, {
7665
7665
  yield chunk;
7666
7666
  }
7667
7667
  report("awaiting_response", { bytesRead });
7668
- } catch (error5) {
7668
+ } catch (error6) {
7669
7669
  if (!reason && !closing) {
7670
7670
  streamFailure = true;
7671
- report("streaming", { bytesRead, causeCode: localCause(error5) ?? (["EIO", "EACCES", "EPERM", "ESTALE", "EBADF"].includes(error5?.code) ? "local_read_failed" : "stream_unconfirmed") });
7671
+ report("streaming", { bytesRead, causeCode: localCause(error6) ?? (["EIO", "EACCES", "EPERM", "ESTALE", "EBADF"].includes(error6?.code) ? "local_read_failed" : "stream_unconfirmed") });
7672
7672
  }
7673
- throw error5;
7673
+ throw error6;
7674
7674
  }
7675
7675
  }
7676
7676
  try {
@@ -7698,9 +7698,9 @@ async function transferGrantedPart(file, authorization, grant, {
7698
7698
  report("checking_file", { bytesRead });
7699
7699
  try {
7700
7700
  await file.assertUnchanged();
7701
- } catch (error5) {
7702
- report("checking_file", { bytesRead, causeCode: localCause(error5) ?? "local_read_failed" });
7703
- throw error5;
7701
+ } catch (error6) {
7702
+ report("checking_file", { bytesRead, causeCode: localCause(error6) ?? "local_read_failed" });
7703
+ throw error6;
7704
7704
  }
7705
7705
  report("reading_receipt", { bytesRead });
7706
7706
  const etag = response.headers.get("etag");
@@ -7709,13 +7709,13 @@ async function transferGrantedPart(file, authorization, grant, {
7709
7709
  fail("part_receipt_unconfirmed");
7710
7710
  }
7711
7711
  return { partNumber: grant.partNumber, etag, sizeBytes };
7712
- } catch (error5) {
7712
+ } catch (error6) {
7713
7713
  if (reason) fail(reason);
7714
- if (error5 instanceof CreationClientError) {
7715
- if (localCause(error5)) onTransferState({ causeCode: localCause(error5) });
7716
- throw error5;
7714
+ if (error6 instanceof CreationClientError) {
7715
+ if (localCause(error6)) onTransferState({ causeCode: localCause(error6) });
7716
+ throw error6;
7717
7717
  }
7718
- if (!streamFailure) onTransferState({ causeCode: networkCause(error5) });
7718
+ if (!streamFailure) onTransferState({ causeCode: networkCause(error6) });
7719
7719
  fail("part_transfer_unconfirmed");
7720
7720
  } finally {
7721
7721
  closing = true;
@@ -7733,8 +7733,8 @@ async function transferGrantedPart(file, authorization, grant, {
7733
7733
  }
7734
7734
  var effects = /* @__PURE__ */ new WeakMap();
7735
7735
  var diagnostics = /* @__PURE__ */ new WeakMap();
7736
- var readPartTransferEffect = (error5) => error5 && typeof error5 === "object" ? effects.get(error5) : void 0;
7737
- var readPartTransferDiagnostic = (error5) => error5 && typeof error5 === "object" ? diagnostics.get(error5) : void 0;
7736
+ var readPartTransferEffect = (error6) => error6 && typeof error6 === "object" ? effects.get(error6) : void 0;
7737
+ var readPartTransferDiagnostic = (error6) => error6 && typeof error6 === "object" ? diagnostics.get(error6) : void 0;
7738
7738
  async function uploadGrantedPart(file, authorization, grant, options = {}) {
7739
7739
  let dispatched = false, state = { stage: "validating", bytesRead: 0 };
7740
7740
  const monotonic = options.monotonicNow ?? (() => performance2.now()), started = monotonic();
@@ -7745,15 +7745,15 @@ async function uploadGrantedPart(file, authorization, grant, options = {}) {
7745
7745
  dispatched = true;
7746
7746
  return (options.fetch ?? globalThis.fetch)(...args2);
7747
7747
  } });
7748
- } catch (error5) {
7749
- if (error5 && typeof error5 === "object") effects.set(error5, dispatched ? "unknown" : "not_dispatched");
7750
- if (error5 && typeof error5 === "object") diagnostics.set(error5, safePartTransferDiagnostic({
7748
+ } catch (error6) {
7749
+ if (error6 && typeof error6 === "object") effects.set(error6, dispatched ? "unknown" : "not_dispatched");
7750
+ if (error6 && typeof error6 === "object") diagnostics.set(error6, safePartTransferDiagnostic({
7751
7751
  ...state,
7752
7752
  requestId: options.requestId,
7753
- causeCode: state.causeCode ?? (!dispatched && state.stage === "validating" ? "validation_refused" : networkCause(error5)),
7753
+ causeCode: state.causeCode ?? (!dispatched && state.stage === "validating" ? "validation_refused" : networkCause(error6)),
7754
7754
  elapsedMs: Math.max(0, Math.floor(monotonic() - started))
7755
7755
  }));
7756
- throw error5;
7756
+ throw error6;
7757
7757
  }
7758
7758
  }
7759
7759
 
@@ -7979,7 +7979,7 @@ var digest = (value2) => createHash2("sha256").update(JSON.stringify(value2)).di
7979
7979
  var fail3 = (code) => {
7980
7980
  throw new CreationClientError("creation.local_upload." + code);
7981
7981
  };
7982
- var knownError = (error5) => error5 instanceof CreationClientError && /^creation\.[a-z0-9_.:-]{1,180}$/.test(error5.message) ? error5.message : "creation.local_upload.control_unconfirmed";
7982
+ var knownError = (error6) => error6 instanceof CreationClientError && /^creation\.[a-z0-9_.:-]{1,180}$/.test(error6.message) ? error6.message : "creation.local_upload.control_unconfirmed";
7983
7983
  var createRefusal = (code) => /^creation\.direct_object_upload\.(?:size_limit_exceeded|pending_bytes_quota_exceeded|concurrent_multipart_quota_exceeded|daily_bytes_quota_exceeded|durable_storage_quota_exceeded|capacity_unavailable|admission_facts_unavailable)$/.test(code);
7984
7984
  var typeByExtension = {
7985
7985
  ".png": ["image", "image/png"],
@@ -8214,14 +8214,14 @@ function createLocalUploadManager({ stateRoot, fetch: fetch2 = globalThis.fetch,
8214
8214
  job.progress = progress.bytesRead;
8215
8215
  }
8216
8216
  });
8217
- } catch (error5) {
8218
- const diagnostic = readPartTransferDiagnostic(error5);
8217
+ } catch (error6) {
8218
+ const diagnostic = readPartTransferDiagnostic(error6);
8219
8219
  if (diagnostic) state.lastTransferDiagnostic = diagnostic;
8220
- if (readPartTransferEffect(error5) === "not_dispatched") {
8220
+ if (readPartTransferEffect(error6) === "not_dispatched") {
8221
8221
  delete state.pendingPart;
8222
8222
  await save();
8223
8223
  }
8224
- throw error5;
8224
+ throw error6;
8225
8225
  }
8226
8226
  state.parts.push(part);
8227
8227
  state.parts.sort((a, b2) => a.partNumber - b2.partNumber);
@@ -8348,11 +8348,11 @@ function createLocalUploadManager({ stateRoot, fetch: fetch2 = globalThis.fetch,
8348
8348
  let created;
8349
8349
  try {
8350
8350
  created = await rpc(send, { action: "create", request: state.request });
8351
- } catch (error5) {
8352
- const code = knownError(error5);
8351
+ } catch (error6) {
8352
+ const code = knownError(error6);
8353
8353
  state.createDisposition = createRefusal(code) ? "rejected" : "unconfirmed";
8354
8354
  if (createRefusal(code)) state.createErrorCode = code;
8355
- throw error5;
8355
+ throw error6;
8356
8356
  }
8357
8357
  authorization = created.authorization;
8358
8358
  const session = authorization?.session;
@@ -8370,9 +8370,9 @@ function createLocalUploadManager({ stateRoot, fetch: fetch2 = globalThis.fetch,
8370
8370
  job = { state, file, abort, progress: 0, save: () => persistence.write(key, state) };
8371
8371
  jobs.set(key, job);
8372
8372
  file = void 0;
8373
- job.done = Promise.resolve().then(() => transfer(job, authorization, (transfer2, options) => send(transfer2, { signal: abort.signal, ...options }), binding)).catch(async (error5) => {
8373
+ job.done = Promise.resolve().then(() => transfer(job, authorization, (transfer2, options) => send(transfer2, { signal: abort.signal, ...options }), binding)).catch(async (error6) => {
8374
8374
  state.phase = "paused";
8375
- state.errorCode = abort.signal.aborted ? "creation.local_upload.transfer_cancelled" : knownError(error5);
8375
+ state.errorCode = abort.signal.aborted ? "creation.local_upload.transfer_cancelled" : knownError(error6);
8376
8376
  await job.save();
8377
8377
  }).finally(async () => {
8378
8378
  try {
@@ -8388,13 +8388,13 @@ function createLocalUploadManager({ stateRoot, fetch: fetch2 = globalThis.fetch,
8388
8388
  job.done.catch(() => {
8389
8389
  });
8390
8390
  return view(state, job);
8391
- } catch (error5) {
8391
+ } catch (error6) {
8392
8392
  if (state) {
8393
8393
  state.phase = state.createDisposition === "rejected" && !state.uploadId ? "create_rejected" : "paused";
8394
- state.errorCode = knownError(error5);
8394
+ state.errorCode = knownError(error6);
8395
8395
  await persistence.write(key, state);
8396
8396
  }
8397
- throw error5;
8397
+ throw error6;
8398
8398
  } finally {
8399
8399
  if (!jobs.has(key)) {
8400
8400
  await file?.close();
@@ -8429,11 +8429,11 @@ function createLocalUploadManager({ stateRoot, fetch: fetch2 = globalThis.fetch,
8429
8429
  }
8430
8430
 
8431
8431
  // lib/version.mjs
8432
- var CLIENT_VERSION = "0.3.12";
8432
+ var CLIENT_VERSION = "0.3.13";
8433
8433
  var CLIENT_PROTOCOL = "creation-client/v1";
8434
8434
 
8435
8435
  // lib/cli.mjs
8436
- import { randomBytes as randomBytes8 } from "node:crypto";
8436
+ import { randomBytes as randomBytes10 } from "node:crypto";
8437
8437
  import { spawn as spawn2 } from "node:child_process";
8438
8438
 
8439
8439
  // node_modules/zod/v4/core/util.js
@@ -8673,10 +8673,10 @@ function mergeDefs(...defs) {
8673
8673
  function cloneDef(schema) {
8674
8674
  return mergeDefs(schema._zod.def);
8675
8675
  }
8676
- function getElementAtPath(obj, path21) {
8677
- if (!path21)
8676
+ function getElementAtPath(obj, path23) {
8677
+ if (!path23)
8678
8678
  return obj;
8679
- return path21.reduce((acc, key) => acc?.[key], obj);
8679
+ return path23.reduce((acc, key) => acc?.[key], obj);
8680
8680
  }
8681
8681
  function promiseAllObject(promisesObj) {
8682
8682
  const keys = Object.keys(promisesObj);
@@ -9016,11 +9016,11 @@ function explicitlyAborted(x, startIndex = 0) {
9016
9016
  }
9017
9017
  return false;
9018
9018
  }
9019
- function prefixIssues(path21, issues) {
9019
+ function prefixIssues(path23, issues) {
9020
9020
  return issues.map((iss) => {
9021
9021
  var _a3;
9022
9022
  (_a3 = iss).path ?? (_a3.path = []);
9023
- iss.path.unshift(path21);
9023
+ iss.path.unshift(path23);
9024
9024
  return iss;
9025
9025
  });
9026
9026
  }
@@ -9160,8 +9160,8 @@ function base64urlToUint8Array(base64url2) {
9160
9160
  function uint8ArrayToBase64url(bytes2) {
9161
9161
  return uint8ArrayToBase64(bytes2).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
9162
9162
  }
9163
- function hexToUint8Array(hex2) {
9164
- const cleanHex = hex2.replace(/^0x/, "");
9163
+ function hexToUint8Array(hex3) {
9164
+ const cleanHex = hex3.replace(/^0x/, "");
9165
9165
  if (cleanHex.length % 2 !== 0) {
9166
9166
  throw new Error("Invalid hex string length");
9167
9167
  }
@@ -9467,10 +9467,10 @@ function node(obj, key, make) {
9467
9467
  }
9468
9468
  return obj[key];
9469
9469
  }
9470
- function flattenError(error5, mapper = (issue2) => issue2.message) {
9470
+ function flattenError(error6, mapper = (issue2) => issue2.message) {
9471
9471
  const fieldErrors = {};
9472
9472
  const formErrors = [];
9473
- for (const sub of error5.issues) {
9473
+ for (const sub of error6.issues) {
9474
9474
  if (sub.path.length > 0) {
9475
9475
  node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
9476
9476
  } else {
@@ -9479,18 +9479,18 @@ function flattenError(error5, mapper = (issue2) => issue2.message) {
9479
9479
  }
9480
9480
  return { formErrors, fieldErrors };
9481
9481
  }
9482
- function formatError(error5, mapper = (issue2) => issue2.message) {
9482
+ function formatError(error6, mapper = (issue2) => issue2.message) {
9483
9483
  const fieldErrors = { _errors: [] };
9484
- const processError = (error6, path21 = []) => {
9485
- for (const issue2 of error6.issues) {
9484
+ const processError = (error7, path23 = []) => {
9485
+ for (const issue2 of error7.issues) {
9486
9486
  if (issue2.code === "invalid_union" && issue2.errors.length) {
9487
- issue2.errors.map((issues) => processError({ issues }, [...path21, ...issue2.path]));
9487
+ issue2.errors.map((issues) => processError({ issues }, [...path23, ...issue2.path]));
9488
9488
  } else if (issue2.code === "invalid_key") {
9489
- processError({ issues: issue2.issues }, [...path21, ...issue2.path]);
9489
+ processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
9490
9490
  } else if (issue2.code === "invalid_element") {
9491
- processError({ issues: issue2.issues }, [...path21, ...issue2.path]);
9491
+ processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
9492
9492
  } else {
9493
- const fullpath = [...path21, ...issue2.path];
9493
+ const fullpath = [...path23, ...issue2.path];
9494
9494
  if (fullpath.length === 0) {
9495
9495
  fieldErrors._errors.push(mapper(issue2));
9496
9496
  } else {
@@ -9524,7 +9524,7 @@ function formatError(error5, mapper = (issue2) => issue2.message) {
9524
9524
  }
9525
9525
  }
9526
9526
  };
9527
- processError(error5);
9527
+ processError(error6);
9528
9528
  return fieldErrors;
9529
9529
  }
9530
9530
 
@@ -9573,19 +9573,19 @@ var _safeParse = (_Err) => (schema, value2, _ctx) => {
9573
9573
  };
9574
9574
  var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
9575
9575
  function failure2(Err, issues, ctx) {
9576
- let error5;
9576
+ let error6;
9577
9577
  return {
9578
9578
  success: false,
9579
9579
  get error() {
9580
- if (!error5) {
9581
- error5 = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
9580
+ if (!error6) {
9581
+ error6 = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
9582
9582
  issues = void 0;
9583
9583
  ctx = void 0;
9584
9584
  }
9585
- return error5;
9585
+ return error6;
9586
9586
  },
9587
9587
  set error(e) {
9588
- error5 = e;
9588
+ error6 = e;
9589
9589
  issues = void 0;
9590
9590
  ctx = void 0;
9591
9591
  }
@@ -16726,8 +16726,8 @@ var Protocol = class {
16726
16726
  resolver(message);
16727
16727
  } else {
16728
16728
  const errorMessage = message;
16729
- const error5 = new McpError(errorMessage.error.code, errorMessage.error.message, errorMessage.error.data);
16730
- resolver(error5);
16729
+ const error6 = new McpError(errorMessage.error.code, errorMessage.error.message, errorMessage.error.data);
16730
+ resolver(error6);
16731
16731
  }
16732
16732
  } else {
16733
16733
  const messageType = queuedMessage.type === "response" ? "Response" : "Error";
@@ -16771,8 +16771,8 @@ var Protocol = class {
16771
16771
  nextCursor,
16772
16772
  _meta: {}
16773
16773
  };
16774
- } catch (error5) {
16775
- throw new McpError(ErrorCode.InvalidParams, `Failed to list tasks: ${error5 instanceof Error ? error5.message : String(error5)}`);
16774
+ } catch (error6) {
16775
+ throw new McpError(ErrorCode.InvalidParams, `Failed to list tasks: ${error6 instanceof Error ? error6.message : String(error6)}`);
16776
16776
  }
16777
16777
  });
16778
16778
  this.setRequestHandler(CancelTaskRequestSchema, async (request, extra) => {
@@ -16794,11 +16794,11 @@ var Protocol = class {
16794
16794
  _meta: {},
16795
16795
  ...cancelledTask
16796
16796
  };
16797
- } catch (error5) {
16798
- if (error5 instanceof McpError) {
16799
- throw error5;
16797
+ } catch (error6) {
16798
+ if (error6 instanceof McpError) {
16799
+ throw error6;
16800
16800
  }
16801
- throw new McpError(ErrorCode.InvalidRequest, `Failed to cancel task: ${error5 instanceof Error ? error5.message : String(error5)}`);
16801
+ throw new McpError(ErrorCode.InvalidRequest, `Failed to cancel task: ${error6 instanceof Error ? error6.message : String(error6)}`);
16802
16802
  }
16803
16803
  });
16804
16804
  }
@@ -16859,9 +16859,9 @@ var Protocol = class {
16859
16859
  this._onclose();
16860
16860
  };
16861
16861
  const _onerror = this.transport?.onerror;
16862
- this._transport.onerror = (error5) => {
16863
- _onerror?.(error5);
16864
- this._onerror(error5);
16862
+ this._transport.onerror = (error6) => {
16863
+ _onerror?.(error6);
16864
+ this._onerror(error6);
16865
16865
  };
16866
16866
  const _onmessage = this._transport?.onmessage;
16867
16867
  this._transport.onmessage = (message, extra) => {
@@ -16892,22 +16892,22 @@ var Protocol = class {
16892
16892
  controller.abort();
16893
16893
  }
16894
16894
  this._requestHandlerAbortControllers.clear();
16895
- const error5 = McpError.fromError(ErrorCode.ConnectionClosed, "Connection closed");
16895
+ const error6 = McpError.fromError(ErrorCode.ConnectionClosed, "Connection closed");
16896
16896
  this._transport = void 0;
16897
16897
  this.onclose?.();
16898
16898
  for (const handler of responseHandlers.values()) {
16899
- handler(error5);
16899
+ handler(error6);
16900
16900
  }
16901
16901
  }
16902
- _onerror(error5) {
16903
- this.onerror?.(error5);
16902
+ _onerror(error6) {
16903
+ this.onerror?.(error6);
16904
16904
  }
16905
16905
  _onnotification(notification) {
16906
16906
  const handler = this._notificationHandlers.get(notification.method) ?? this.fallbackNotificationHandler;
16907
16907
  if (handler === void 0) {
16908
16908
  return;
16909
16909
  }
16910
- Promise.resolve().then(() => handler(notification)).catch((error5) => this._onerror(new Error(`Uncaught error in notification handler: ${error5}`)));
16910
+ Promise.resolve().then(() => handler(notification)).catch((error6) => this._onerror(new Error(`Uncaught error in notification handler: ${error6}`)));
16911
16911
  }
16912
16912
  _onrequest(request, extra) {
16913
16913
  const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
@@ -16937,15 +16937,15 @@ var Protocol = class {
16937
16937
  };
16938
16938
  if (relatedTaskId && relatedTaskLookup) {
16939
16939
  const queuedError = { type: "error", message: errorResponse, timestamp: Date.now() };
16940
- relatedTaskLookup.then(() => this._enqueueTaskMessage(relatedTaskId, queuedError, sessionId), () => capturedTransport?.send(errorResponse)).catch((error5) => this._onerror(new Error(`Failed to send an error response: ${error5}`)));
16940
+ relatedTaskLookup.then(() => this._enqueueTaskMessage(relatedTaskId, queuedError, sessionId), () => capturedTransport?.send(errorResponse)).catch((error6) => this._onerror(new Error(`Failed to send an error response: ${error6}`)));
16941
16941
  } else if (relatedTaskId && this._taskMessageQueue) {
16942
16942
  this._enqueueTaskMessage(relatedTaskId, {
16943
16943
  type: "error",
16944
16944
  message: errorResponse,
16945
16945
  timestamp: Date.now()
16946
- }, capturedTransport?.sessionId).catch((error5) => this._onerror(new Error(`Failed to enqueue error response: ${error5}`)));
16946
+ }, capturedTransport?.sessionId).catch((error6) => this._onerror(new Error(`Failed to enqueue error response: ${error6}`)));
16947
16947
  } else {
16948
- capturedTransport?.send(errorResponse).catch((error5) => this._onerror(new Error(`Failed to send an error response: ${error5}`)));
16948
+ capturedTransport?.send(errorResponse).catch((error6) => this._onerror(new Error(`Failed to send an error response: ${error6}`)));
16949
16949
  }
16950
16950
  return;
16951
16951
  }
@@ -17014,7 +17014,7 @@ var Protocol = class {
17014
17014
  } else {
17015
17015
  await capturedTransport?.send(response);
17016
17016
  }
17017
- }, async (error5) => {
17017
+ }, async (error6) => {
17018
17018
  if (abortController.signal.aborted) {
17019
17019
  return;
17020
17020
  }
@@ -17022,9 +17022,9 @@ var Protocol = class {
17022
17022
  jsonrpc: "2.0",
17023
17023
  id: request.id,
17024
17024
  error: {
17025
- code: Number.isSafeInteger(error5["code"]) ? error5["code"] : ErrorCode.InternalError,
17026
- message: error5.message ?? "Internal error",
17027
- ...error5["data"] !== void 0 && { data: error5["data"] }
17025
+ code: Number.isSafeInteger(error6["code"]) ? error6["code"] : ErrorCode.InternalError,
17026
+ message: error6.message ?? "Internal error",
17027
+ ...error6["data"] !== void 0 && { data: error6["data"] }
17028
17028
  }
17029
17029
  };
17030
17030
  if (relatedTaskId && this._taskMessageQueue && relatedTaskFound) {
@@ -17036,7 +17036,7 @@ var Protocol = class {
17036
17036
  } else {
17037
17037
  await capturedTransport?.send(errorResponse);
17038
17038
  }
17039
- }).catch((error5) => this._onerror(new Error(`Failed to send response: ${error5}`))).finally(() => {
17039
+ }).catch((error6) => this._onerror(new Error(`Failed to send response: ${error6}`))).finally(() => {
17040
17040
  if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
17041
17041
  this._requestHandlerAbortControllers.delete(request.id);
17042
17042
  }
@@ -17055,11 +17055,11 @@ var Protocol = class {
17055
17055
  if (timeoutInfo && responseHandler && timeoutInfo.resetTimeoutOnProgress) {
17056
17056
  try {
17057
17057
  this._resetTimeout(messageId);
17058
- } catch (error5) {
17058
+ } catch (error6) {
17059
17059
  this._responseHandlers.delete(messageId);
17060
17060
  this._progressHandlers.delete(messageId);
17061
17061
  this._cleanupTimeout(messageId);
17062
- responseHandler(error5);
17062
+ responseHandler(error6);
17063
17063
  return;
17064
17064
  }
17065
17065
  }
@@ -17073,8 +17073,8 @@ var Protocol = class {
17073
17073
  if (isJSONRPCResultResponse(response)) {
17074
17074
  resolver(response);
17075
17075
  } else {
17076
- const error5 = new McpError(response.error.code, response.error.message, response.error.data);
17077
- resolver(error5);
17076
+ const error6 = new McpError(response.error.code, response.error.message, response.error.data);
17077
+ resolver(error6);
17078
17078
  }
17079
17079
  return;
17080
17080
  }
@@ -17102,8 +17102,8 @@ var Protocol = class {
17102
17102
  if (isJSONRPCResultResponse(response)) {
17103
17103
  handler(response);
17104
17104
  } else {
17105
- const error5 = McpError.fromError(response.error.code, response.error.message, response.error.data);
17106
- handler(error5);
17105
+ const error6 = McpError.fromError(response.error.code, response.error.message, response.error.data);
17106
+ handler(error6);
17107
17107
  }
17108
17108
  }
17109
17109
  get transport() {
@@ -17148,10 +17148,10 @@ var Protocol = class {
17148
17148
  try {
17149
17149
  const result = await this.request(request, resultSchema, options);
17150
17150
  yield { type: "result", result };
17151
- } catch (error5) {
17151
+ } catch (error6) {
17152
17152
  yield {
17153
17153
  type: "error",
17154
- error: error5 instanceof McpError ? error5 : new McpError(ErrorCode.InternalError, String(error5))
17154
+ error: error6 instanceof McpError ? error6 : new McpError(ErrorCode.InternalError, String(error6))
17155
17155
  };
17156
17156
  }
17157
17157
  return;
@@ -17194,10 +17194,10 @@ var Protocol = class {
17194
17194
  await new Promise((resolve) => setTimeout(resolve, pollInterval));
17195
17195
  options?.signal?.throwIfAborted();
17196
17196
  }
17197
- } catch (error5) {
17197
+ } catch (error6) {
17198
17198
  yield {
17199
17199
  type: "error",
17200
- error: error5 instanceof McpError ? error5 : new McpError(ErrorCode.InternalError, String(error5))
17200
+ error: error6 instanceof McpError ? error6 : new McpError(ErrorCode.InternalError, String(error6))
17201
17201
  };
17202
17202
  }
17203
17203
  }
@@ -17209,8 +17209,8 @@ var Protocol = class {
17209
17209
  request(request, resultSchema, options) {
17210
17210
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
17211
17211
  return new Promise((resolve, reject) => {
17212
- const earlyReject = (error5) => {
17213
- reject(error5);
17212
+ const earlyReject = (error6) => {
17213
+ reject(error6);
17214
17214
  };
17215
17215
  if (!this._transport) {
17216
17216
  earlyReject(new Error("Not connected"));
@@ -17270,9 +17270,9 @@ var Protocol = class {
17270
17270
  requestId: messageId,
17271
17271
  reason: String(reason)
17272
17272
  }
17273
- }, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error6) => this._onerror(new Error(`Failed to send cancellation: ${error6}`)));
17274
- const error5 = reason instanceof McpError ? reason : new McpError(ErrorCode.RequestTimeout, String(reason));
17275
- reject(error5);
17273
+ }, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error7) => this._onerror(new Error(`Failed to send cancellation: ${error7}`)));
17274
+ const error6 = reason instanceof McpError ? reason : new McpError(ErrorCode.RequestTimeout, String(reason));
17275
+ reject(error6);
17276
17276
  };
17277
17277
  this._responseHandlers.set(messageId, (response) => {
17278
17278
  if (options?.signal?.aborted) {
@@ -17288,8 +17288,8 @@ var Protocol = class {
17288
17288
  } else {
17289
17289
  resolve(parseResult.data);
17290
17290
  }
17291
- } catch (error5) {
17292
- reject(error5);
17291
+ } catch (error6) {
17292
+ reject(error6);
17293
17293
  }
17294
17294
  });
17295
17295
  options?.signal?.addEventListener("abort", () => {
@@ -17313,14 +17313,14 @@ var Protocol = class {
17313
17313
  type: "request",
17314
17314
  message: jsonrpcRequest,
17315
17315
  timestamp: Date.now()
17316
- }).catch((error5) => {
17316
+ }).catch((error6) => {
17317
17317
  this._cleanupTimeout(messageId);
17318
- reject(error5);
17318
+ reject(error6);
17319
17319
  });
17320
17320
  } else {
17321
- this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error5) => {
17321
+ this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error6) => {
17322
17322
  this._cleanupTimeout(messageId);
17323
- reject(error5);
17323
+ reject(error6);
17324
17324
  });
17325
17325
  }
17326
17326
  });
@@ -17413,7 +17413,7 @@ var Protocol = class {
17413
17413
  }
17414
17414
  };
17415
17415
  }
17416
- this._transport?.send(jsonrpcNotification2, options).catch((error5) => this._onerror(error5));
17416
+ this._transport?.send(jsonrpcNotification2, options).catch((error6) => this._onerror(error6));
17417
17417
  });
17418
17418
  return;
17419
17419
  }
@@ -18267,11 +18267,11 @@ var Server = class extends Protocol {
18267
18267
  if (!validationResult.valid) {
18268
18268
  throw new McpError(ErrorCode.InvalidParams, `Elicitation response content does not match requested schema: ${validationResult.errorMessage}`);
18269
18269
  }
18270
- } catch (error5) {
18271
- if (error5 instanceof McpError) {
18272
- throw error5;
18270
+ } catch (error6) {
18271
+ if (error6 instanceof McpError) {
18272
+ throw error6;
18273
18273
  }
18274
- throw new McpError(ErrorCode.InternalError, `Error validating elicitation response: ${error5 instanceof Error ? error5.message : String(error5)}`);
18274
+ throw new McpError(ErrorCode.InternalError, `Error validating elicitation response: ${error6 instanceof Error ? error6.message : String(error6)}`);
18275
18275
  }
18276
18276
  }
18277
18277
  return result;
@@ -18383,14 +18383,14 @@ var StdioServerTransport = class {
18383
18383
  try {
18384
18384
  this._readBuffer.append(chunk);
18385
18385
  this.processReadBuffer();
18386
- } catch (error5) {
18387
- this.onerror?.(error5);
18386
+ } catch (error6) {
18387
+ this.onerror?.(error6);
18388
18388
  this.close().catch(() => {
18389
18389
  });
18390
18390
  }
18391
18391
  };
18392
- this._onerror = (error5) => {
18393
- this.onerror?.(error5);
18392
+ this._onerror = (error6) => {
18393
+ this.onerror?.(error6);
18394
18394
  };
18395
18395
  this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize });
18396
18396
  }
@@ -18413,8 +18413,8 @@ var StdioServerTransport = class {
18413
18413
  break;
18414
18414
  }
18415
18415
  this.onmessage?.(message);
18416
- } catch (error5) {
18417
- this.onerror?.(error5);
18416
+ } catch (error6) {
18417
+ this.onerror?.(error6);
18418
18418
  }
18419
18419
  }
18420
18420
  }
@@ -18511,14 +18511,14 @@ var ExperimentalClientTasks = class {
18511
18511
  };
18512
18512
  return;
18513
18513
  }
18514
- } catch (error5) {
18515
- if (error5 instanceof McpError) {
18516
- yield { type: "error", error: error5 };
18514
+ } catch (error6) {
18515
+ if (error6 instanceof McpError) {
18516
+ yield { type: "error", error: error6 };
18517
18517
  return;
18518
18518
  }
18519
18519
  yield {
18520
18520
  type: "error",
18521
- error: new McpError(ErrorCode.InvalidParams, `Failed to validate structured content: ${error5 instanceof Error ? error5.message : String(error5)}`)
18521
+ error: new McpError(ErrorCode.InvalidParams, `Failed to validate structured content: ${error6 instanceof Error ? error6.message : String(error6)}`)
18522
18522
  };
18523
18523
  return;
18524
18524
  }
@@ -18831,9 +18831,9 @@ var Client = class extends Protocol {
18831
18831
  this._setupListChangedHandlers(this._pendingListChangedConfig);
18832
18832
  this._pendingListChangedConfig = void 0;
18833
18833
  }
18834
- } catch (error5) {
18834
+ } catch (error6) {
18835
18835
  void this.close();
18836
- throw error5;
18836
+ throw error6;
18837
18837
  }
18838
18838
  }
18839
18839
  /**
@@ -19003,11 +19003,11 @@ var Client = class extends Protocol {
19003
19003
  if (!validationResult.valid) {
19004
19004
  throw new McpError(ErrorCode.InvalidParams, `Structured content does not match the tool's output schema: ${validationResult.errorMessage}`);
19005
19005
  }
19006
- } catch (error5) {
19007
- if (error5 instanceof McpError) {
19008
- throw error5;
19006
+ } catch (error6) {
19007
+ if (error6 instanceof McpError) {
19008
+ throw error6;
19009
19009
  }
19010
- throw new McpError(ErrorCode.InvalidParams, `Failed to validate structured content: ${error5 instanceof Error ? error5.message : String(error5)}`);
19010
+ throw new McpError(ErrorCode.InvalidParams, `Failed to validate structured content: ${error6 instanceof Error ? error6.message : String(error6)}`);
19011
19011
  }
19012
19012
  }
19013
19013
  }
@@ -19082,8 +19082,8 @@ var Client = class extends Protocol {
19082
19082
  const items = await fetcher();
19083
19083
  onChanged(null, items);
19084
19084
  } catch (e) {
19085
- const error5 = e instanceof Error ? e : new Error(String(e));
19086
- onChanged(error5, null);
19085
+ const error6 = e instanceof Error ? e : new Error(String(e));
19086
+ onChanged(error6, null);
19087
19087
  }
19088
19088
  };
19089
19089
  const handler = () => {
@@ -19224,8 +19224,8 @@ async function random(size) {
19224
19224
  const evenDistCutoff = Math.pow(2, 8) - Math.pow(2, 8) % mask.length;
19225
19225
  let result = "";
19226
19226
  while (result.length < size) {
19227
- const randomBytes9 = await getRandomValues(size - result.length);
19228
- for (const randomByte of randomBytes9) {
19227
+ const randomBytes11 = await getRandomValues(size - result.length);
19228
+ for (const randomByte of randomBytes11) {
19229
19229
  if (randomByte < evenDistCutoff) {
19230
19230
  result += mask[randomByte % mask.length];
19231
19231
  }
@@ -19590,12 +19590,12 @@ async function parseErrorResponse(input) {
19590
19590
  const body = input instanceof Response ? await input.text() : input;
19591
19591
  try {
19592
19592
  const result = OAuthErrorResponseSchema.parse(JSON.parse(body));
19593
- const { error: error5, error_description, error_uri } = result;
19594
- const errorClass = OAUTH_ERRORS[error5] || ServerError;
19593
+ const { error: error6, error_description, error_uri } = result;
19594
+ const errorClass = OAUTH_ERRORS[error6] || ServerError;
19595
19595
  return new errorClass(error_description || "", error_uri);
19596
- } catch (error5) {
19596
+ } catch (error6) {
19597
19597
  const redirect = input instanceof Response ? unfollowedRedirect(input, input.url) : void 0;
19598
- const errorMessage = `${statusCode ? `HTTP ${statusCode}: ` : ""}${redirect ?? `Invalid OAuth error response: ${error5}. Raw body: ${body}`}`;
19598
+ const errorMessage = `${statusCode ? `HTTP ${statusCode}: ` : ""}${redirect ?? `Invalid OAuth error response: ${error6}. Raw body: ${body}`}`;
19599
19599
  return new ServerError(errorMessage);
19600
19600
  }
19601
19601
  }
@@ -19622,15 +19622,15 @@ function boundElsewhereError(stored, issuer) {
19622
19622
  async function auth(provider, options) {
19623
19623
  try {
19624
19624
  return await authInternal(provider, options);
19625
- } catch (error5) {
19626
- if (error5 instanceof InvalidClientError || error5 instanceof UnauthorizedClientError) {
19625
+ } catch (error6) {
19626
+ if (error6 instanceof InvalidClientError || error6 instanceof UnauthorizedClientError) {
19627
19627
  await provider.invalidateCredentials?.("all");
19628
19628
  return await authInternal(provider, options);
19629
- } else if (error5 instanceof InvalidGrantError) {
19629
+ } else if (error6 instanceof InvalidGrantError) {
19630
19630
  await provider.invalidateCredentials?.("tokens");
19631
19631
  return await authInternal(provider, options);
19632
19632
  }
19633
- throw error5;
19633
+ throw error6;
19634
19634
  }
19635
19635
  }
19636
19636
  async function authInternal(provider, { serverUrl, authorizationCode, scope, resourceMetadataUrl, fetchFn }) {
@@ -19746,10 +19746,10 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
19746
19746
  await bindClientInformation();
19747
19747
  await provider.saveTokens({ ...newTokens, issuer });
19748
19748
  return "AUTHORIZED";
19749
- } catch (error5) {
19750
- if (!(error5 instanceof OAuthError) || error5 instanceof ServerError) {
19749
+ } catch (error6) {
19750
+ if (!(error6 instanceof OAuthError) || error6 instanceof ServerError) {
19751
19751
  } else {
19752
- throw error5;
19752
+ throw error6;
19753
19753
  }
19754
19754
  }
19755
19755
  }
@@ -19807,11 +19807,11 @@ function extractWWWAuthenticateParams(res) {
19807
19807
  }
19808
19808
  }
19809
19809
  const scope = extractFieldFromWwwAuth(res, "scope") || void 0;
19810
- const error5 = extractFieldFromWwwAuth(res, "error") || void 0;
19810
+ const error6 = extractFieldFromWwwAuth(res, "error") || void 0;
19811
19811
  return {
19812
19812
  resourceMetadataUrl,
19813
19813
  scope,
19814
- error: error5
19814
+ error: error6
19815
19815
  };
19816
19816
  }
19817
19817
  function extractFieldFromWwwAuth(response, fieldName) {
@@ -19844,15 +19844,15 @@ async function discoverOAuthProtectedResourceMetadata(serverUrl, opts, fetchFn =
19844
19844
  async function fetchWithCorsRetry(url2, headers, fetchFn = fetch) {
19845
19845
  try {
19846
19846
  return await fetchWithinOrigin(fetchFn)(url2, { headers });
19847
- } catch (error5) {
19848
- if (error5 instanceof TypeError) {
19847
+ } catch (error6) {
19848
+ if (error6 instanceof TypeError) {
19849
19849
  if (headers) {
19850
19850
  return fetchWithCorsRetry(url2, void 0, fetchFn);
19851
19851
  } else {
19852
19852
  return void 0;
19853
19853
  }
19854
19854
  }
19855
- throw error5;
19855
+ throw error6;
19856
19856
  }
19857
19857
  }
19858
19858
  function buildWellKnownPath(wellKnownPrefix, pathname = "", options = {}) {
@@ -20301,8 +20301,8 @@ var EventSourceParserStream = class extends TransformStream {
20301
20301
  onEvent: (event) => {
20302
20302
  controller.enqueue(event);
20303
20303
  },
20304
- onError(error5) {
20305
- typeof onError == "function" && onError(error5), (onError === "terminate" || error5.type === "max-buffer-size-exceeded") && controller.error(error5);
20304
+ onError(error6) {
20305
+ typeof onError == "function" && onError(error6), (onError === "terminate" || error6.type === "max-buffer-size-exceeded") && controller.error(error6);
20306
20306
  },
20307
20307
  onRetry,
20308
20308
  onComment,
@@ -20364,9 +20364,9 @@ var StreamableHTTPClientTransport = class {
20364
20364
  scope: this._scope,
20365
20365
  fetchFn: this._fetchWithInit
20366
20366
  });
20367
- } catch (error5) {
20368
- this.onerror?.(error5);
20369
- throw error5;
20367
+ } catch (error6) {
20368
+ this.onerror?.(error6);
20369
+ throw error6;
20370
20370
  }
20371
20371
  if (result !== "AUTHORIZED") {
20372
20372
  throw new UnauthorizedError();
@@ -20419,9 +20419,9 @@ var StreamableHTTPClientTransport = class {
20419
20419
  throw new StreamableHTTPError(response.status, `Failed to open SSE stream: ${this._unfollowedRedirect(response, this._url) ?? response.statusText}`);
20420
20420
  }
20421
20421
  this._handleSseStream(response.body, options, true);
20422
- } catch (error5) {
20423
- this.onerror?.(error5);
20424
- throw error5;
20422
+ } catch (error6) {
20423
+ this.onerror?.(error6);
20424
+ throw error6;
20425
20425
  }
20426
20426
  }
20427
20427
  /**
@@ -20453,8 +20453,8 @@ var StreamableHTTPClientTransport = class {
20453
20453
  }
20454
20454
  const delay = this._getNextReconnectionDelay(attemptCount);
20455
20455
  this._reconnectionTimeout = setTimeout(() => {
20456
- this._startOrAuthSse(options).catch((error5) => {
20457
- this.onerror?.(new Error(`Failed to reconnect SSE stream: ${error5 instanceof Error ? error5.message : String(error5)}`));
20456
+ this._startOrAuthSse(options).catch((error6) => {
20457
+ this.onerror?.(new Error(`Failed to reconnect SSE stream: ${error6 instanceof Error ? error6.message : String(error6)}`));
20458
20458
  this._scheduleReconnection(options, attemptCount + 1);
20459
20459
  });
20460
20460
  }, delay);
@@ -20497,8 +20497,8 @@ var StreamableHTTPClientTransport = class {
20497
20497
  }
20498
20498
  }
20499
20499
  this.onmessage?.(message);
20500
- } catch (error5) {
20501
- this.onerror?.(error5);
20500
+ } catch (error6) {
20501
+ this.onerror?.(error6);
20502
20502
  }
20503
20503
  }
20504
20504
  }
@@ -20511,8 +20511,8 @@ var StreamableHTTPClientTransport = class {
20511
20511
  replayMessageId
20512
20512
  }, 0);
20513
20513
  }
20514
- } catch (error5) {
20515
- this.onerror?.(new Error(`SSE stream disconnected: ${error5}`));
20514
+ } catch (error6) {
20515
+ this.onerror?.(new Error(`SSE stream disconnected: ${error6}`));
20516
20516
  const canResume = isReconnectable || hasPrimingEvent;
20517
20517
  const needsReconnect = canResume && !receivedResponse;
20518
20518
  if (needsReconnect && this._abortController && !this._abortController.signal.aborted) {
@@ -20522,8 +20522,8 @@ var StreamableHTTPClientTransport = class {
20522
20522
  onresumptiontoken,
20523
20523
  replayMessageId
20524
20524
  }, 0);
20525
- } catch (error6) {
20526
- this.onerror?.(new Error(`Failed to reconnect: ${error6 instanceof Error ? error6.message : String(error6)}`));
20525
+ } catch (error7) {
20526
+ this.onerror?.(new Error(`Failed to reconnect: ${error7 instanceof Error ? error7.message : String(error7)}`));
20527
20527
  }
20528
20528
  }
20529
20529
  }
@@ -20606,8 +20606,8 @@ var StreamableHTTPClientTransport = class {
20606
20606
  return this.send(message);
20607
20607
  }
20608
20608
  if (response.status === 403 && this._authProvider) {
20609
- const { resourceMetadataUrl, scope, error: error5 } = extractWWWAuthenticateParams(response);
20610
- if (error5 === "insufficient_scope") {
20609
+ const { resourceMetadataUrl, scope, error: error6 } = extractWWWAuthenticateParams(response);
20610
+ if (error6 === "insufficient_scope") {
20611
20611
  const wwwAuthHeader = response.headers.get("WWW-Authenticate");
20612
20612
  if (this._lastUpscopingHeader === wwwAuthHeader) {
20613
20613
  throw new StreamableHTTPError(403, "Server returned 403 after trying upscoping");
@@ -20662,9 +20662,9 @@ var StreamableHTTPClientTransport = class {
20662
20662
  } else {
20663
20663
  await response.body?.cancel();
20664
20664
  }
20665
- } catch (error5) {
20666
- this.onerror?.(error5);
20667
- throw error5;
20665
+ } catch (error6) {
20666
+ this.onerror?.(error6);
20667
+ throw error6;
20668
20668
  }
20669
20669
  }
20670
20670
  get sessionId() {
@@ -20699,9 +20699,9 @@ var StreamableHTTPClientTransport = class {
20699
20699
  throw new StreamableHTTPError(response.status, `Failed to terminate session: ${this._unfollowedRedirect(response, this._url) ?? response.statusText}`);
20700
20700
  }
20701
20701
  this._sessionId = void 0;
20702
- } catch (error5) {
20703
- this.onerror?.(error5);
20704
- throw error5;
20702
+ } catch (error6) {
20703
+ this.onerror?.(error6);
20704
+ throw error6;
20705
20705
  }
20706
20706
  }
20707
20707
  setProtocolVersion(version3) {
@@ -20726,21 +20726,27 @@ var StreamableHTTPClientTransport = class {
20726
20726
  };
20727
20727
 
20728
20728
  // lib/host-identity.mjs
20729
+ var SUPPORTED_HOSTS = Object.freeze(["codex", "claude-code", "antigravity"]);
20730
+ var isHookProofHost = (kind) => kind === "claude-code" || kind === "antigravity";
20731
+ var DEFAULT_CLIENT_NAMES = Object.freeze({
20732
+ codex: "Codex PromptFrame",
20733
+ "claude-code": "Claude Code PromptFrame",
20734
+ antigravity: "Antigravity PromptFrame"
20735
+ });
20729
20736
  function hostClientName(savedName, host) {
20730
- return ["Codex PromptFrame", "Claude Code PromptFrame"].includes(savedName) ? host.kind === "claude-code" ? "Claude Code PromptFrame" : "Codex PromptFrame" : savedName;
20737
+ return Object.values(DEFAULT_CLIENT_NAMES).includes(savedName) ? DEFAULT_CLIENT_NAMES[host.kind] ?? DEFAULT_CLIENT_NAMES.codex : savedName;
20731
20738
  }
20732
20739
  var threadFormat = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
20733
20740
  function resolveHostIdentity({ host, env = process.env } = {}) {
20734
20741
  const kind = host ?? (env.CLAUDECODE === "1" ? "claude-code" : "codex");
20735
- if (!["codex", "claude-code"].includes(kind)) throw new CreationClientError("creation.host_unsupported");
20736
- if (kind === "codex") return Object.freeze({ kind });
20742
+ if (!SUPPORTED_HOSTS.includes(kind)) throw new CreationClientError("creation.host_unsupported");
20737
20743
  return Object.freeze({ kind });
20738
20744
  }
20739
20745
  function hostParameters(params, host, access2) {
20740
20746
  const meta2 = params._meta ?? {};
20741
20747
  if (Object.keys(meta2).some((key) => key.startsWith("promptframe.") || ["controlVersion", "controller", "clientDigest", "token", "catalogVersion", "platformDigest"].includes(key)))
20742
20748
  throw new CreationClientError("creation.transport_authority_managed_by_bridge");
20743
- if (host.kind === "claude-code") {
20749
+ if (isHookProofHost(host.kind)) {
20744
20750
  if (Object.hasOwn(meta2, "threadId")) throw new CreationClientError("creation.transport_authority_managed_by_bridge");
20745
20751
  if (!host.threadId) {
20746
20752
  if (access2 === "independent-read") return params;
@@ -20815,7 +20821,7 @@ var BridgeCompatibilityError = class extends CreationClientError {
20815
20821
  });
20816
20822
  }
20817
20823
  };
20818
- var bridgeErrorDetails = (error5) => error5 instanceof BridgeCompatibilityError ? error5.bridgeFacts : void 0;
20824
+ var bridgeErrorDetails = (error6) => error6 instanceof BridgeCompatibilityError ? error6.bridgeFacts : void 0;
20819
20825
  function declaredHostContentCapabilities(capabilities, { initialized = false, standardContent = false } = {}) {
20820
20826
  const requested = capabilities?.experimental?.["promptframe.contentTypes"];
20821
20827
  if (requested === void 0 && initialized && standardContent)
@@ -20877,9 +20883,9 @@ async function directory2(file, create = false) {
20877
20883
  try {
20878
20884
  privateOwner(await lstat4(file), true);
20879
20885
  return true;
20880
- } catch (error5) {
20881
- if (!create && error5.code === "ENOENT") return false;
20882
- throw error5;
20886
+ } catch (error6) {
20887
+ if (!create && error6.code === "ENOENT") return false;
20888
+ throw error6;
20883
20889
  }
20884
20890
  }
20885
20891
  async function ownedPath(root, segments, create = false) {
@@ -20907,10 +20913,10 @@ async function readJson(file) {
20907
20913
  } catch {
20908
20914
  throw failure3("record_invalid");
20909
20915
  }
20910
- } catch (error5) {
20911
- if (error5.code === "ENOENT") return void 0;
20912
- if (error5.code === "ELOOP") throw failure3("private_storage_required");
20913
- throw error5;
20916
+ } catch (error6) {
20917
+ if (error6.code === "ENOENT") return void 0;
20918
+ if (error6.code === "ELOOP") throw failure3("private_storage_required");
20919
+ throw error6;
20914
20920
  } finally {
20915
20921
  await fd?.close();
20916
20922
  }
@@ -20934,15 +20940,15 @@ async function writeJson(directoryPath, name, value2) {
20934
20940
  if (current.dev !== owner.dev || current.ino !== owner.ino) throw failure3("reference_changed");
20935
20941
  try {
20936
20942
  privateOwner(await lstat4(path5.join(directoryPath, name)));
20937
- } catch (error5) {
20938
- if (error5.code !== "ENOENT") throw error5;
20943
+ } catch (error6) {
20944
+ if (error6.code !== "ENOENT") throw error6;
20939
20945
  }
20940
20946
  await rename3(temporary, path5.join(directoryPath, name));
20941
20947
  await parent.sync();
20942
20948
  } finally {
20943
20949
  await parent.close();
20944
- await unlink3(temporary).catch((error5) => {
20945
- if (error5.code !== "ENOENT") throw error5;
20950
+ await unlink3(temporary).catch((error6) => {
20951
+ if (error6.code !== "ENOENT") throw error6;
20946
20952
  });
20947
20953
  }
20948
20954
  }
@@ -21080,7 +21086,7 @@ async function listAccounts({ root = localAccountsRoot(), now = Date.now() } = {
21080
21086
  return { accounts, complete: true };
21081
21087
  }
21082
21088
  function localAgentDigest(agent) {
21083
- if (!agent || !["codex", "claude-code"].includes(agent.kind) || typeof agent.sessionId !== "string" || !threadFormat.test(agent.sessionId)) throw failure3("agent_required");
21089
+ if (!agent || !["codex", "claude-code", "antigravity"].includes(agent.kind) || typeof agent.sessionId !== "string" || !threadFormat.test(agent.sessionId)) throw failure3("agent_required");
21084
21090
  return hash(JSON.stringify([agent.kind, agent.sessionId.toLowerCase()]));
21085
21091
  }
21086
21092
  async function selectAccount({ root = localAccountsRoot(), agent, identity }) {
@@ -21147,13 +21153,13 @@ async function clientObservationInstance({ root = localAccountsRoot(), identity,
21147
21153
  await directoryHandle.close();
21148
21154
  }
21149
21155
  return value2.instanceId;
21150
- } catch (error5) {
21151
- if (error5.code === "EEXIST") return parse4(await readJson(file));
21152
- throw error5;
21156
+ } catch (error6) {
21157
+ if (error6.code === "EEXIST") return parse4(await readJson(file));
21158
+ throw error6;
21153
21159
  } finally {
21154
21160
  await fd?.close();
21155
- await unlink3(temporary).catch((error5) => {
21156
- if (error5.code !== "ENOENT") throw error5;
21161
+ await unlink3(temporary).catch((error6) => {
21162
+ if (error6.code !== "ENOENT") throw error6;
21157
21163
  });
21158
21164
  }
21159
21165
  }
@@ -21220,7 +21226,7 @@ async function connectPlatform(credentials, { host = resolveHostIdentity(), cont
21220
21226
  contractVersion: "promptframe-client-observation/v1",
21221
21227
  instanceId,
21222
21228
  systemFamily,
21223
- application: host.kind === "claude-code" ? "Claude Code" : host.kind === "codex" ? "Codex" : "Creation",
21229
+ application: host.kind === "claude-code" ? "Claude Code" : host.kind === "antigravity" ? "Antigravity" : host.kind === "codex" ? "Codex" : "Creation",
21224
21230
  applicationVersion: CLIENT_VERSION
21225
21231
  };
21226
21232
  } catch {
@@ -21228,10 +21234,10 @@ async function connectPlatform(credentials, { host = resolveHostIdentity(), cont
21228
21234
  if (enforceMinimum) assertBridgeCompatible(client.getServerCapabilities(), CLIENT_VERSION);
21229
21235
  else readPlatformBridgePolicy(client.getServerCapabilities());
21230
21236
  return client;
21231
- } catch (error5) {
21237
+ } catch (error6) {
21232
21238
  await client.close().catch(() => {
21233
21239
  });
21234
- throw error5;
21240
+ throw error6;
21235
21241
  }
21236
21242
  }
21237
21243
 
@@ -21293,8 +21299,8 @@ async function claudeHostProcess({
21293
21299
  if (!entryFile || !command2.some((arg) => arg.includes(entryFile)) || !command2.some((arg) => arg === "claude-host-hook" || arg.includes(" claude-host-hook"))) return null;
21294
21300
  }
21295
21301
  const binding = { pid: host.pid, birth: host.birth, uid, device: host.device, inode: host.inode, exe: host.exe, boot };
21296
- const digest5 = hash2(binding);
21297
- return { binding, digest: digest5, eventOrder: { birth: child.birth, pid: child.pid }, async isCurrent() {
21302
+ const digest6 = hash2(binding);
21303
+ return { binding, digest: digest6, eventOrder: { birth: child.birth, pid: child.pid }, async isCurrent() {
21298
21304
  try {
21299
21305
  const current = await readBirth(binding.pid);
21300
21306
  return current.birth === binding.birth && current.uid === uid && current.device === binding.device && current.inode === binding.inode && current.exe === binding.exe && await readBoot() === boot;
@@ -21512,32 +21518,32 @@ import { open as open6, stat as stat2 } from "node:fs/promises";
21512
21518
  import { constants as constants5 } from "node:fs";
21513
21519
  import path9 from "node:path";
21514
21520
  async function readDevelopmentPairingFile(filePath, { signal } = {}) {
21515
- const fail8 = () => {
21521
+ const fail9 = () => {
21516
21522
  throw new CreationClientError("creation.development_pairing.private_file_unavailable");
21517
21523
  };
21518
- if (typeof filePath !== "string" || filePath.length > 4096 || !path9.isAbsolute(filePath)) fail8();
21524
+ if (typeof filePath !== "string" || filePath.length > 4096 || !path9.isAbsolute(filePath)) fail9();
21519
21525
  let file;
21520
21526
  try {
21521
21527
  signal?.throwIfAborted();
21522
21528
  file = await open6(filePath, constants5.O_RDONLY | constants5.O_NOFOLLOW | constants5.O_NONBLOCK);
21523
21529
  const before = await file.stat();
21524
- if (!before.isFile() || before.size < 2 || before.size > 8192 || process.platform !== "win32" && ((before.mode & 63) !== 0 || before.uid !== process.getuid())) fail8();
21530
+ if (!before.isFile() || before.size < 2 || before.size > 8192 || process.platform !== "win32" && ((before.mode & 63) !== 0 || before.uid !== process.getuid())) fail9();
21525
21531
  const bytes2 = Buffer.alloc(before.size);
21526
21532
  let offset = 0;
21527
21533
  while (offset < bytes2.length) {
21528
21534
  signal?.throwIfAborted();
21529
21535
  const read2 = await file.read(bytes2, offset, bytes2.length - offset, offset);
21530
- if (!read2.bytesRead) fail8();
21536
+ if (!read2.bytesRead) fail9();
21531
21537
  offset += read2.bytesRead;
21532
21538
  }
21533
21539
  const after = await file.stat(), named = await stat2(filePath);
21534
21540
  signal?.throwIfAborted();
21535
- 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();
21541
+ 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)) fail9();
21536
21542
  const value2 = JSON.parse(bytes2.toString("utf8"));
21537
- if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) fail8();
21543
+ if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) fail9();
21538
21544
  return Object.fromEntries(["url", "connectionId", "credential", "studioOrigin", "expiresAt", "contractVersion", "lifecycle"].filter((key) => Object.hasOwn(value2, key)).map((key) => [key, value2[key]]));
21539
21545
  } catch {
21540
- fail8();
21546
+ fail9();
21541
21547
  } finally {
21542
21548
  await file?.close();
21543
21549
  }
@@ -21562,10 +21568,10 @@ var boundedSet = (map, key, value2) => {
21562
21568
  async function resolveHostCallBinding(raw, { host = resolveHostIdentity(), hostSession } = {}) {
21563
21569
  for (const field of ["threadId", "controller", "clientDigest", "token", "controlVersion", "developmentPairing"]) if (Object.hasOwn(raw.arguments ?? {}, field))
21564
21570
  throw new CreationClientError("creation.transport_authority_managed_by_bridge");
21565
- if (host.kind === "claude-code") {
21571
+ if (isHookProofHost(host.kind)) {
21566
21572
  if (hostSession) return hostSession.begin(raw);
21567
21573
  if (raw.arguments?.[CLAUDE_HOST_PROOF] !== void 0) throw new CreationClientError("creation.host_identity_invalid");
21568
- return { host: { kind: "claude-code" }, arguments: raw.arguments, assertCurrent: async () => {
21574
+ return { host: { kind: host.kind }, arguments: raw.arguments, assertCurrent: async () => {
21569
21575
  } };
21570
21576
  }
21571
21577
  if (Object.hasOwn(raw.arguments ?? {}, CLAUDE_HOST_PROOF)) throw new CreationClientError("creation.transport_authority_managed_by_bridge");
@@ -21641,7 +21647,7 @@ function createHostCallBridge(client, { credentials, host = resolveHostIdentity(
21641
21647
  if (!schema || schema.type !== "object") throw new CreationClientError("creation.upgrade_required");
21642
21648
  const p2 = schema.properties;
21643
21649
  const { controlVersion: _managed, developmentPairing: _privatePairing, ...properties } = p2 ?? {};
21644
- return { ...tool, inputSchema: { ...schema, properties: { ...properties, ...host.kind === "claude-code" ? {
21650
+ return { ...tool, inputSchema: { ...schema, properties: { ...properties, ...isHookProofHost(host.kind) ? {
21645
21651
  [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" }
21646
21652
  } : {} }, ...schema.required ? { required: schema.required.filter((name) => name !== "controlVersion") } : {} } };
21647
21653
  }) };
@@ -21676,7 +21682,7 @@ function createHostCallBridge(client, { credentials, host = resolveHostIdentity(
21676
21682
  }
21677
21683
  async function knowledgeRead(kind, method, raw = {}) {
21678
21684
  if (!upstream[kind]) throw new CreationClientError("creation.knowledge_unsupported");
21679
- const params = hostParameters(raw, host.kind === "claude-code" ? { kind: host.kind } : host, "independent-read"), order = ++sequence;
21685
+ const params = hostParameters(raw, isHookProofHost(host.kind) ? { kind: host.kind } : host, "independent-read"), order = ++sequence;
21680
21686
  const result = assertMcpResponseBudget(await client[method](params, void 0, { timeout: 6e4 }));
21681
21687
  const version3 = result._meta?.[kind === "resources" && method === "listResources" ? "promptframe.guideDirectoryVersion" : "promptframe.guideVersion"];
21682
21688
  const key = JSON.stringify([kind, method, raw.uri ?? raw.arguments?.projectId ?? null]);
@@ -21799,9 +21805,9 @@ function createHostCallBridge(client, { credentials, host = resolveHostIdentity(
21799
21805
  let response;
21800
21806
  try {
21801
21807
  response = await send(outgoing, binding);
21802
- } catch (error5) {
21808
+ } catch (error6) {
21803
21809
  invalidate();
21804
- throw error5;
21810
+ throw error6;
21805
21811
  }
21806
21812
  if (response.result.isError) invalidate();
21807
21813
  return response.result;
@@ -21827,7 +21833,7 @@ function localTool(name, host) {
21827
21833
  identityKey: { type: "string", pattern: "^[a-f0-9]{64}-[a-f0-9]{64}$" },
21828
21834
  referenceId: { type: "string", pattern: "^sha256:[a-f0-9]{64}$", description: "\u540C\u4E00\u8D26\u53F7\u6709\u591A\u4EFD\u521B\u4F5C\u6388\u6743\u65F6\u53EF\u660E\u786E\u9009\u62E9\u5217\u8868\u4E2D\u7684\u5F15\u7528\u3002" }
21829
21835
  } : {};
21830
- if (host.kind === "claude-code") properties[CLAUDE_HOST_PROOF] = { type: "string", pattern: "^[a-f0-9]{64}$", description: "\u7531\u5F53\u524D\u5BBF\u4E3Bhook\u586B\u5165\uFF0C\u4FDD\u7559\u539F\u503C\u3002" };
21836
+ if (isHookProofHost(host.kind)) properties[CLAUDE_HOST_PROOF] = { type: "string", pattern: "^[a-f0-9]{64}$", description: "\u7531\u5F53\u524D\u5BBF\u4E3Bhook\u586B\u5165\uFF0C\u4FDD\u7559\u539F\u503C\u3002" };
21831
21837
  return {
21832
21838
  name,
21833
21839
  description: name === listName ? "\u5217\u51FA\u672C\u673A\u5DF2\u767B\u8BB0\u8D26\u53F7\u7684\u5B89\u5168\u6458\u8981\u548C\u7F3A\u5C11\u7684\u6388\u6743\u7C7B\u578B\uFF0C\u4E0D\u8FD4\u56DE\u51ED\u636E\u6216\u672C\u673A\u8DEF\u5F84\u3002" : "\u53EA\u4E3A\u5F53\u524D\u5BBF\u4E3B\u4F1A\u8BDD\u9009\u62E9\u672C\u673A\u5DF2\u6388\u6743\u8D26\u53F7\uFF1B\u4E0D\u5207\u6362\u5176\u5B83Agent\uFF0C\u4E0D\u7533\u8BF7\u7F16\u8F91\u6743\u6216\u91CD\u653E\u4E1A\u52A1\u3002",
@@ -21863,7 +21869,7 @@ function createAccountAwareBridge(defaultClient, {
21863
21869
  function caller(raw, binding, required2 = false) {
21864
21870
  const params = { ...raw, arguments: binding.arguments };
21865
21871
  hostParameters(params, binding.host, required2 ? "authority" : "independent-read");
21866
- const sessionId = binding.host.kind === "claude-code" ? binding.host.threadId : params._meta?.threadId;
21872
+ const sessionId = isHookProofHost(binding.host.kind) ? binding.host.threadId : params._meta?.threadId;
21867
21873
  return sessionId ? { kind: binding.host.kind, sessionId } : void 0;
21868
21874
  }
21869
21875
  async function context(identity, agent, referenceId) {
@@ -21969,8 +21975,189 @@ function createAccountAwareBridge(defaultClient, {
21969
21975
  };
21970
21976
  }
21971
21977
 
21978
+ // lib/antigravity-host-session.mjs
21979
+ import { constants as constants6 } from "node:fs";
21980
+ import { open as open7, mkdir as mkdir5, lstat as lstat6, rename as rename5, unlink as unlink5, rmdir as rmdir3 } from "node:fs/promises";
21981
+ import path11 from "node:path";
21982
+ import { homedir as homedir5 } from "node:os";
21983
+ import { createHash as createHash7, randomBytes as randomBytes4 } from "node:crypto";
21984
+ var hex2 = /^[0-9a-f]{64}$/;
21985
+ var TICKET_TTL_MS = 12e4;
21986
+ var MAX_TICKETS = 256;
21987
+ var error4 = (code) => new CreationClientError("creation." + code);
21988
+ var canonical3 = (value2) => {
21989
+ if (value2 === null || typeof value2 === "string" || typeof value2 === "boolean" || typeof value2 === "number" && Number.isFinite(value2)) return JSON.stringify(value2);
21990
+ if (Array.isArray(value2)) return "[" + value2.map(canonical3).join(",") + "]";
21991
+ if (value2 && typeof value2 === "object" && [Object.prototype, null].includes(Object.getPrototypeOf(value2)))
21992
+ return "{" + Object.keys(value2).sort().map((key) => JSON.stringify(key) + ":" + canonical3(value2[key])).join(",") + "}";
21993
+ throw error4("request_invalid");
21994
+ };
21995
+ var digest4 = (value2) => createHash7("sha256").update(canonical3(value2)).digest("hex");
21996
+ var withoutProof2 = (args2) => Object.fromEntries(Object.entries(args2 ?? {}).filter(([key]) => key !== CLAUDE_HOST_PROOF));
21997
+ function isPromptFrameToolName(name) {
21998
+ if (typeof name !== "string" || !name || name.length > 200) return false;
21999
+ return /(?:^|[_:])promptframe/i.test(name) || /^platform_[a-z0-9_]+$/i.test(name);
22000
+ }
22001
+ function toolNameMatches(hookToolName, bridgeToolName) {
22002
+ if (typeof hookToolName !== "string" || typeof bridgeToolName !== "string" || !bridgeToolName) return false;
22003
+ if (hookToolName === bridgeToolName) return true;
22004
+ return hookToolName.endsWith("_" + bridgeToolName) || hookToolName.endsWith(":" + bridgeToolName);
22005
+ }
22006
+ async function privateDirectory2(directory3) {
22007
+ try {
22008
+ await mkdir5(directory3, { recursive: true, mode: 448 });
22009
+ } catch (e) {
22010
+ if (e.code !== "EEXIST") throw e;
22011
+ }
22012
+ const info5 = await lstat6(directory3);
22013
+ if (!info5.isDirectory() || info5.isSymbolicLink() || info5.uid !== process.getuid?.() || info5.mode & 63) throw error4("host_identity_unavailable");
22014
+ }
22015
+ async function privateRead2(file) {
22016
+ let handle;
22017
+ try {
22018
+ handle = await open7(file, constants6.O_RDONLY | constants6.O_NOFOLLOW);
22019
+ const info5 = await handle.stat();
22020
+ if (!info5.isFile() || info5.uid !== process.getuid?.() || info5.mode & 63 || info5.size > 262144) throw error4("host_identity_unavailable");
22021
+ return JSON.parse(await handle.readFile("utf8"));
22022
+ } catch (e) {
22023
+ if (e.code === "ENOENT") return null;
22024
+ throw e;
22025
+ } finally {
22026
+ await handle?.close();
22027
+ }
22028
+ }
22029
+ function antigravityConfigRoot(env = process.env) {
22030
+ return path11.resolve(env.ANTIGRAVITY_CONFIG_DIR ?? env.GEMINI_CONFIG_DIR ?? path11.join(homedir5(), ".gemini", "config"));
22031
+ }
22032
+ async function createAntigravityHostSession({ configFile: configFile2, env = process.env, root, now = () => Date.now() } = {}) {
22033
+ const base = root ?? path11.join(antigravityConfigRoot(env), "promptframe-host-sessions");
22034
+ const namespace = path11.join(base, digest4(path11.resolve(configFile2)));
22035
+ const stateFile = path11.join(namespace, "state.json");
22036
+ async function readState() {
22037
+ const value2 = await privateRead2(stateFile);
22038
+ if (!value2) return { contractVersion: "antigravity-host-session/v1", tickets: {} };
22039
+ if (value2.contractVersion !== "antigravity-host-session/v1" || !value2.tickets || typeof value2.tickets !== "object" || Array.isArray(value2.tickets) || Object.keys(value2.tickets).length > MAX_TICKETS + 32) throw error4("host_identity_unavailable");
22040
+ return value2;
22041
+ }
22042
+ async function transaction(work) {
22043
+ await privateDirectory2(base);
22044
+ await privateDirectory2(namespace);
22045
+ const lock = path11.join(namespace, "write.lock");
22046
+ let acquired = false;
22047
+ for (let count = 0; count < 100; count++) try {
22048
+ await mkdir5(lock, { mode: 448 });
22049
+ acquired = true;
22050
+ break;
22051
+ } catch (e) {
22052
+ if (e.code !== "EEXIST") throw e;
22053
+ await new Promise((resolve) => setTimeout(resolve, 10));
22054
+ }
22055
+ if (!acquired) throw error4("host_identity_unavailable");
22056
+ let temporary;
22057
+ try {
22058
+ const current = await readState();
22059
+ const next = await work(current);
22060
+ if (next === void 0) return;
22061
+ const body = JSON.stringify(next);
22062
+ if (Buffer.byteLength(body) > 262144) throw error4("host_identity_unavailable");
22063
+ temporary = path11.join(namespace, "state-" + randomBytes4(16).toString("hex") + ".partial");
22064
+ const file = await open7(temporary, constants6.O_WRONLY | constants6.O_CREAT | constants6.O_EXCL | constants6.O_NOFOLLOW, 384);
22065
+ try {
22066
+ await file.writeFile(body);
22067
+ await file.sync();
22068
+ } finally {
22069
+ await file.close();
22070
+ }
22071
+ await rename5(temporary, stateFile);
22072
+ temporary = void 0;
22073
+ const directory3 = await open7(namespace, constants6.O_RDONLY | constants6.O_DIRECTORY | constants6.O_NOFOLLOW);
22074
+ try {
22075
+ await directory3.sync();
22076
+ } finally {
22077
+ await directory3.close();
22078
+ }
22079
+ } finally {
22080
+ if (temporary) await unlink5(temporary).catch(() => {
22081
+ });
22082
+ await rmdir3(lock).catch(() => {
22083
+ });
22084
+ }
22085
+ }
22086
+ function pruneTickets(tickets, currentTime) {
22087
+ const kept = {};
22088
+ for (const [k2, v2] of Object.entries(tickets)) {
22089
+ if (v2 && typeof v2 === "object" && typeof v2.expiresAt === "number" && v2.expiresAt > currentTime && typeof v2.conversationId === "string" && threadFormat.test(v2.conversationId)) kept[k2] = v2;
22090
+ }
22091
+ const keys = Object.keys(kept);
22092
+ while (keys.length >= MAX_TICKETS) delete kept[keys.shift()];
22093
+ return kept;
22094
+ }
22095
+ async function begin(raw) {
22096
+ const proof = raw.arguments?.[CLAUDE_HOST_PROOF], args2 = withoutProof2(raw.arguments);
22097
+ if (proof === void 0) return { host: { kind: "antigravity" }, assertCurrent: async () => {
22098
+ }, arguments: args2 };
22099
+ if (typeof proof !== "string" || !hex2.test(proof)) throw error4("host_identity_invalid");
22100
+ const argsHash = digest4(args2), currentTime = now();
22101
+ let accepted;
22102
+ try {
22103
+ await transaction((current) => {
22104
+ const ticket = current.tickets[proof];
22105
+ if (!ticket || ticket.expiresAt <= currentTime || ticket.argsDigest !== argsHash || !toolNameMatches(ticket.toolName, raw.name) || !threadFormat.test(ticket.conversationId ?? ""))
22106
+ throw error4("host_identity_invalid");
22107
+ accepted = { threadId: ticket.conversationId.toLowerCase() };
22108
+ delete current.tickets[proof];
22109
+ current.tickets = pruneTickets(current.tickets, currentTime);
22110
+ return current;
22111
+ });
22112
+ } catch (e) {
22113
+ if (e instanceof CreationClientError) throw e;
22114
+ throw error4("host_identity_unavailable");
22115
+ }
22116
+ return { host: { kind: "antigravity", threadId: accepted.threadId }, arguments: args2, assertCurrent: async () => {
22117
+ } };
22118
+ }
22119
+ async function hook(input) {
22120
+ const event = input?.hookEventName;
22121
+ if (event !== void 0 && event !== "PreToolUse") return {};
22122
+ const toolCall = input?.toolCall;
22123
+ if (!toolCall || typeof toolCall !== "object" || typeof toolCall.name !== "string") return { decision: "allow" };
22124
+ if (!isPromptFrameToolName(toolCall.name)) return { decision: "allow" };
22125
+ const rawArgs = toolCall.args && typeof toolCall.args === "object" && !Array.isArray(toolCall.args) ? toolCall.args : {};
22126
+ const conversationId = typeof input.conversationId === "string" && threadFormat.test(input.conversationId) ? input.conversationId.toLowerCase() : null;
22127
+ if (!conversationId) {
22128
+ return Object.hasOwn(rawArgs, CLAUDE_HOST_PROOF) ? { decision: "deny", reason: "Missing valid Antigravity conversationId for PromptFrame proof." } : { decision: "allow" };
22129
+ }
22130
+ const args2 = withoutProof2(rawArgs), argsHash = digest4(args2), currentTime = now();
22131
+ let token;
22132
+ await transaction((current) => {
22133
+ const tickets = pruneTickets(current.tickets, currentTime);
22134
+ token = randomBytes4(32).toString("hex");
22135
+ tickets[token] = { toolName: toolCall.name, argsDigest: argsHash, conversationId, expiresAt: currentTime + TICKET_TTL_MS };
22136
+ return { contractVersion: "antigravity-host-session/v1", tickets };
22137
+ });
22138
+ return { decision: "allow", overwrite: { [CLAUDE_HOST_PROOF]: token } };
22139
+ }
22140
+ return { begin, hook };
22141
+ }
22142
+ async function readAntigravityHookInput(input) {
22143
+ const chunks = [];
22144
+ let bytes2 = 0;
22145
+ for await (const value2 of input) {
22146
+ const chunk = Buffer.isBuffer(value2) ? value2 : Buffer.from(value2);
22147
+ bytes2 += chunk.length;
22148
+ if (bytes2 > 2 * 1024 * 1024 + 65536) throw error4("host_identity_invalid");
22149
+ chunks.push(chunk);
22150
+ }
22151
+ return JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(Buffer.concat(chunks, bytes2)));
22152
+ }
22153
+ async function runAntigravityHostHook({ configFile: configFile2, input = process.stdin, output = process.stdout, env = process.env } = {}) {
22154
+ const body = await readAntigravityHookInput(input);
22155
+ const store = await createAntigravityHostSession({ configFile: configFile2, env });
22156
+ output.write(JSON.stringify(await store.hook(body)) + "\n");
22157
+ }
22158
+
21972
22159
  // lib/runtime-bootstrap.mjs
21973
- import { createHash as createHash8, randomBytes as randomBytes4 } from "node:crypto";
22160
+ import { createHash as createHash9, randomBytes as randomBytes5 } from "node:crypto";
21974
22161
  import { gunzipSync } from "node:zlib";
21975
22162
 
21976
22163
  // node_modules/tar/dist/esm/index.min.js
@@ -24943,18 +25130,18 @@ var To = (s3) => {
24943
25130
  };
24944
25131
 
24945
25132
  // lib/runtime-bootstrap.mjs
24946
- import { lstat as lstat7, mkdir as mkdir5, open as open7, readFile as readFile5, readdir as readdir3, rename as rename5, rm, statfs } from "node:fs/promises";
25133
+ import { lstat as lstat8, mkdir as mkdir6, open as open8, readFile as readFile5, readdir as readdir3, rename as rename6, rm, statfs } from "node:fs/promises";
24947
25134
  import { execFile } from "node:child_process";
24948
25135
  import { promisify } from "node:util";
24949
- import path12 from "node:path";
25136
+ import path13 from "node:path";
24950
25137
 
24951
25138
  // lib/runtime-package.mjs
24952
- import { lstat as lstat6, readdir as readdir2, readFile as readFile4 } from "node:fs/promises";
24953
- import { createHash as createHash7 } from "node:crypto";
24954
- import path11 from "node:path";
25139
+ import { lstat as lstat7, readdir as readdir2, readFile as readFile4 } from "node:fs/promises";
25140
+ import { createHash as createHash8 } from "node:crypto";
25141
+ import path12 from "node:path";
24955
25142
  var RUNTIME_PACKAGE_ENTRIES = Object.freeze(["package.json", "README.md", "LICENSE", "bin", "dist", "lib", "skills", "docs", ".codex-plugin", ".mcp.json"]);
24956
25143
  var OPTIONAL_HOST_ENTRIES = Object.freeze([".claude-plugin", ".claude-mcp.json"]);
24957
- var hash3 = (b2) => createHash7("sha256").update(b2).digest("hex");
25144
+ var hash3 = (b2) => createHash8("sha256").update(b2).digest("hex");
24958
25145
  var invalid = (code) => {
24959
25146
  throw new CreationClientError("installation." + code);
24960
25147
  };
@@ -24963,7 +25150,7 @@ async function inspectRuntimePackage(root, { entries: entries2 } = {}) {
24963
25150
  entries2 = [...RUNTIME_PACKAGE_ENTRIES];
24964
25151
  for (const name of OPTIONAL_HOST_ENTRIES) {
24965
25152
  try {
24966
- await lstat6(path11.join(root, name));
25153
+ await lstat7(path12.join(root, name));
24967
25154
  entries2.push(name);
24968
25155
  } catch (e) {
24969
25156
  if (e.code !== "ENOENT") throw e;
@@ -24975,19 +25162,19 @@ async function inspectRuntimePackage(root, { entries: entries2 } = {}) {
24975
25162
  async function walk(relative) {
24976
25163
  let s3;
24977
25164
  try {
24978
- s3 = await lstat6(path11.join(root, relative));
24979
- } catch (error5) {
24980
- if (error5.code !== "ENOENT") throw error5;
25165
+ s3 = await lstat7(path12.join(root, relative));
25166
+ } catch (error6) {
25167
+ if (error6.code !== "ENOENT") throw error6;
24981
25168
  }
24982
25169
  if (!s3 || s3.isSymbolicLink()) invalid("package_file_invalid");
24983
25170
  if (s3.isDirectory()) {
24984
- for (const name of (await readdir2(path11.join(root, relative))).sort()) {
25171
+ for (const name of (await readdir2(path12.join(root, relative))).sort()) {
24985
25172
  if (name === "node_modules" || name === "credentials.json" || name.startsWith(".env")) invalid("package_file_invalid");
24986
- await walk(path11.join(relative, name));
25173
+ await walk(path12.join(relative, name));
24987
25174
  }
24988
25175
  } else if (s3.isFile()) {
24989
25176
  if (s3.size > 32 * 1024 * 1024) invalid("package_too_large");
24990
- const body = await readFile4(path11.join(root, relative));
25177
+ const body = await readFile4(path12.join(root, relative));
24991
25178
  bytes2 += body.length;
24992
25179
  if (files.length >= 1024 || bytes2 > 32 * 1024 * 1024) invalid("package_too_large");
24993
25180
  files.push({ path: relative, bytes: body.length, sha256: hash3(body), body });
@@ -25000,11 +25187,13 @@ async function inspectRuntimePackage(root, { entries: entries2 } = {}) {
25000
25187
  if (pkg.name !== "@promptframe/creation" || !/^\d+\.\d+\.\d+$/.test(pkg.version) || plugin.version !== pkg.version) invalid("package_identity_invalid");
25001
25188
  const claude = files.find((f2) => f2.path === ".claude-plugin/plugin.json");
25002
25189
  if (claude && JSON.parse(claude.body).version !== pkg.version) invalid("package_identity_invalid");
25190
+ const antigravity = files.some((f2) => f2.path === "lib/antigravity-host-session.mjs");
25191
+ const hosts = ["codex", ...claude ? ["claude-code"] : [], ...antigravity ? ["antigravity"] : []];
25003
25192
  return {
25004
25193
  files,
25005
25194
  version: pkg.version,
25006
- hosts: claude ? ["codex", "claude-code"] : ["codex"],
25007
- payloadDigest: hash3(JSON.stringify(files.map(({ path: path21, bytes: bytes3, sha256 }) => ({ path: path21, bytes: bytes3, sha256 }))))
25195
+ hosts,
25196
+ payloadDigest: hash3(JSON.stringify(files.map(({ path: path23, bytes: bytes3, sha256 }) => ({ path: path23, bytes: bytes3, sha256 }))))
25008
25197
  };
25009
25198
  }
25010
25199
 
@@ -25014,9 +25203,9 @@ var REGISTRY = "https://registry.npmjs.org";
25014
25203
  var MAX_ARCHIVE = 8 * 1024 * 1024;
25015
25204
  var MAX_PAYLOAD = 32 * 1024 * 1024;
25016
25205
  var MAX_TAR = 36 * 1024 * 1024;
25017
- var hash4 = (b2) => createHash8("sha256").update(b2).digest("hex");
25206
+ var hash4 = (b2) => createHash9("sha256").update(b2).digest("hex");
25018
25207
  var execute = promisify(execFile);
25019
- var error4 = (code) => new CreationClientError("creation." + code);
25208
+ var error5 = (code) => new CreationClientError("creation." + code);
25020
25209
  var version2 = (v2) => {
25021
25210
  compareBridgeVersions(v2, v2);
25022
25211
  return v2;
@@ -25034,34 +25223,34 @@ var RuntimeSelectionError = class extends CreationClientError {
25034
25223
  });
25035
25224
  }
25036
25225
  };
25037
- var runtimeErrorDetails = (error5) => error5 instanceof RuntimeSelectionError ? error5.runtimeFacts : void 0;
25226
+ var runtimeErrorDetails = (error6) => error6 instanceof RuntimeSelectionError ? error6.runtimeFacts : void 0;
25038
25227
  var snapshot = (payload) => ({
25039
25228
  version: payload.version,
25040
25229
  hosts: payload.hosts,
25041
25230
  payloadDigest: payload.payloadDigest,
25042
- files: payload.files.map(({ path: path21, bytes: bytes2, sha256 }) => ({ path: path21, bytes: bytes2, sha256 }))
25231
+ files: payload.files.map(({ path: path23, bytes: bytes2, sha256 }) => ({ path: path23, bytes: bytes2, sha256 }))
25043
25232
  });
25044
25233
  async function info(file) {
25045
25234
  try {
25046
- return await lstat7(file);
25235
+ return await lstat8(file);
25047
25236
  } catch (e) {
25048
25237
  if (e.code === "ENOENT") return null;
25049
25238
  throw e;
25050
25239
  }
25051
25240
  }
25052
- async function privateDirectory2(dir) {
25053
- await mkdir5(dir, { recursive: true, mode: 448 });
25054
- const s3 = await lstat7(dir);
25055
- if (!s3.isDirectory() || s3.isSymbolicLink() || s3.uid !== process.getuid?.() || s3.mode & 63) throw error4("runtime_cache_owner_invalid");
25241
+ async function privateDirectory3(dir) {
25242
+ await mkdir6(dir, { recursive: true, mode: 448 });
25243
+ const s3 = await lstat8(dir);
25244
+ if (!s3.isDirectory() || s3.isSymbolicLink() || s3.uid !== process.getuid?.() || s3.mode & 63) throw error5("runtime_cache_owner_invalid");
25056
25245
  }
25057
25246
  async function privateJSON(file) {
25058
25247
  const s3 = await info(file);
25059
25248
  if (!s3) return null;
25060
- if (!s3.isFile() || s3.isSymbolicLink() || s3.uid !== process.getuid?.() || s3.mode & 63 || s3.size > 512 * 1024) throw error4("runtime_cache_invalid");
25249
+ if (!s3.isFile() || s3.isSymbolicLink() || s3.uid !== process.getuid?.() || s3.mode & 63 || s3.size > 512 * 1024) throw error5("runtime_cache_invalid");
25061
25250
  return JSON.parse(await readFile5(file, "utf8"));
25062
25251
  }
25063
25252
  async function syncDirectory2(dir) {
25064
- const fd = await open7(dir, "r");
25253
+ const fd = await open8(dir, "r");
25065
25254
  try {
25066
25255
  await fd.sync();
25067
25256
  } finally {
@@ -25069,7 +25258,7 @@ async function syncDirectory2(dir) {
25069
25258
  }
25070
25259
  }
25071
25260
  async function exclusiveJSON(file, value2) {
25072
- const fd = await open7(file, "wx", 384);
25261
+ const fd = await open8(file, "wx", 384);
25073
25262
  try {
25074
25263
  await fd.writeFile(JSON.stringify(value2) + "\n");
25075
25264
  await fd.sync();
@@ -25081,9 +25270,9 @@ function checkedRuntimeMetadata(value2, expectedVersion) {
25081
25270
  version2(expectedVersion);
25082
25271
  const tarball = REGISTRY + "/@promptframe/creation/-/creation-" + expectedVersion + ".tgz";
25083
25272
  if (value2?.name !== PACKAGE || value2.version !== expectedVersion || value2.dist?.tarball !== tarball || typeof value2.dist.integrity !== "string" || !/^sha512-[A-Za-z0-9+/]{86}==$/.test(value2.dist.integrity))
25084
- throw error4("runtime_registry_identity_invalid");
25273
+ throw error5("runtime_registry_identity_invalid");
25085
25274
  const encoded = value2.dist.integrity.slice(7);
25086
- if (Buffer.from(encoded, "base64").toString("base64") !== encoded) throw error4("runtime_registry_identity_invalid");
25275
+ if (Buffer.from(encoded, "base64").toString("base64") !== encoded) throw error5("runtime_registry_identity_invalid");
25087
25276
  return { version: expectedVersion, integrity: value2.dist.integrity, tarball };
25088
25277
  }
25089
25278
  async function boundedGet(url2, { fetchImpl = fetch, signal, maxBytes: maxBytes2, timeoutMs }) {
@@ -25093,12 +25282,12 @@ async function boundedGet(url2, { fetchImpl = fetch, signal, maxBytes: maxBytes2
25093
25282
  let response;
25094
25283
  try {
25095
25284
  response = await fetchImpl(url2, { signal: controller.signal, redirect: "error" });
25096
- if (response.status !== 200 || Number(response.headers.get("content-length") ?? 0) > maxBytes2 || !response.body) throw error4("runtime_fetch_unavailable");
25285
+ if (response.status !== 200 || Number(response.headers.get("content-length") ?? 0) > maxBytes2 || !response.body) throw error5("runtime_fetch_unavailable");
25097
25286
  const chunks = [];
25098
25287
  let count = 0;
25099
25288
  for await (const chunk of response.body) {
25100
25289
  count += chunk.length;
25101
- if (count > maxBytes2) throw error4("runtime_download_capacity");
25290
+ if (count > maxBytes2) throw error5("runtime_download_capacity");
25102
25291
  chunks.push(Buffer.from(chunk));
25103
25292
  }
25104
25293
  return Buffer.concat(chunks, count);
@@ -25106,68 +25295,68 @@ async function boundedGet(url2, { fetchImpl = fetch, signal, maxBytes: maxBytes2
25106
25295
  await response?.body?.cancel().catch(() => {
25107
25296
  });
25108
25297
  if (e instanceof CreationClientError) throw e;
25109
- throw error4("runtime_fetch_unavailable");
25298
+ throw error5("runtime_fetch_unavailable");
25110
25299
  } finally {
25111
25300
  clearTimeout(timer);
25112
25301
  signal?.removeEventListener("abort", abort);
25113
25302
  }
25114
25303
  }
25115
25304
  async function readRuntimeArchive(archive, metadata) {
25116
- if (!Buffer.isBuffer(archive) || archive.length > MAX_ARCHIVE || "sha512-" + createHash8("sha512").update(archive).digest("base64") !== metadata.integrity) throw error4("runtime_integrity_invalid");
25305
+ if (!Buffer.isBuffer(archive) || archive.length > MAX_ARCHIVE || "sha512-" + createHash9("sha512").update(archive).digest("base64") !== metadata.integrity) throw error5("runtime_integrity_invalid");
25117
25306
  let raw;
25118
25307
  try {
25119
25308
  raw = gunzipSync(archive, { maxOutputLength: MAX_TAR });
25120
25309
  } catch {
25121
- throw error4("runtime_archive_invalid");
25310
+ throw error5("runtime_archive_invalid");
25122
25311
  }
25123
25312
  const files = [], names = /* @__PURE__ */ new Set();
25124
25313
  let total = 0, entries2 = 0, failure4;
25125
25314
  const parser = Ct({ strict: true, onReadEntry: (entry) => {
25126
25315
  const name = entry.path;
25127
- if (++entries2 > 2048 || !["File", "Directory"].includes(entry.type) || !Number.isSafeInteger(entry.size) || entry.size < 0 || entry.size > MAX_PAYLOAD || typeof name !== "string" || name.length > 240 || !name.startsWith("package/") || name.includes("\\") || /[\x00-\x1f\x7f]/.test(name)) failure4 = error4("runtime_archive_invalid");
25316
+ if (++entries2 > 2048 || !["File", "Directory"].includes(entry.type) || !Number.isSafeInteger(entry.size) || entry.size < 0 || entry.size > MAX_PAYLOAD || typeof name !== "string" || name.length > 240 || !name.startsWith("package/") || name.includes("\\") || /[\x00-\x1f\x7f]/.test(name)) failure4 = error5("runtime_archive_invalid");
25128
25317
  const relative = name.slice(8).replace(/\/$/, "");
25129
25318
  if (relative && (relative.normalize("NFC") !== relative || /[<>:"|?*]/.test(relative) || relative.split("/").some((p2) => !p2 || p2 === "." || p2 === ".." || /[. ]$/.test(p2) || /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(p2) || p2 === "node_modules" || p2 === "credentials.json" || p2.startsWith(".env")) || !roots.has(relative.split("/")[0])))
25130
- failure4 = error4("runtime_archive_invalid");
25319
+ failure4 = error5("runtime_archive_invalid");
25131
25320
  const portableName = relative.toLowerCase();
25132
- if (names.has(portableName)) failure4 = error4("runtime_archive_invalid");
25321
+ if (names.has(portableName)) failure4 = error5("runtime_archive_invalid");
25133
25322
  names.add(portableName);
25134
25323
  if (entry.type === "Directory") {
25135
- if (entry.size !== 0) failure4 = error4("runtime_archive_invalid");
25324
+ if (entry.size !== 0) failure4 = error5("runtime_archive_invalid");
25136
25325
  return;
25137
25326
  }
25138
25327
  total += entry.size;
25139
- if (total > MAX_PAYLOAD || files.length >= 1024 || !relative) failure4 = error4("runtime_archive_capacity");
25328
+ if (total > MAX_PAYLOAD || files.length >= 1024 || !relative) failure4 = error5("runtime_archive_capacity");
25140
25329
  const chunks = [];
25141
25330
  let bytes2 = 0;
25142
25331
  entry.on("data", (chunk) => {
25143
25332
  bytes2 += chunk.length;
25144
- if (bytes2 > entry.size) failure4 = error4("runtime_archive_invalid");
25333
+ if (bytes2 > entry.size) failure4 = error5("runtime_archive_invalid");
25145
25334
  if (!failure4) chunks.push(Buffer.from(chunk));
25146
25335
  });
25147
25336
  entry.on("end", () => {
25148
- if (bytes2 !== entry.size) failure4 = error4("runtime_archive_invalid");
25337
+ if (bytes2 !== entry.size) failure4 = error5("runtime_archive_invalid");
25149
25338
  if (!failure4) files.push({ path: relative, body: Buffer.concat(chunks, bytes2) });
25150
25339
  });
25151
25340
  } });
25152
25341
  await new Promise((resolve, reject) => {
25153
- parser.once("error", () => reject(error4("runtime_archive_invalid")));
25342
+ parser.once("error", () => reject(error5("runtime_archive_invalid")));
25154
25343
  parser.once("end", resolve);
25155
25344
  parser.end(raw);
25156
25345
  });
25157
25346
  if (failure4) throw failure4;
25158
- if (!files.length || files.length > 1024) throw error4("runtime_archive_invalid");
25347
+ if (!files.length || files.length > 1024) throw error5("runtime_archive_invalid");
25159
25348
  return files;
25160
25349
  }
25161
25350
  async function cacheLock(root, signal) {
25162
- const name = path12.join(root, "prepare.lock"), end = Date.now() + 5e3;
25351
+ const name = path13.join(root, "prepare.lock"), end = Date.now() + 5e3;
25163
25352
  let fd;
25164
25353
  while (!fd) {
25165
25354
  signal?.throwIfAborted();
25166
25355
  try {
25167
- fd = await open7(name, "wx", 384);
25356
+ fd = await open8(name, "wx", 384);
25168
25357
  } catch (e) {
25169
25358
  if (e.code !== "EEXIST") throw e;
25170
- if (Date.now() >= end) throw error4("runtime_cache_busy");
25359
+ if (Date.now() >= end) throw error5("runtime_cache_busy");
25171
25360
  await pause(50);
25172
25361
  }
25173
25362
  }
@@ -25185,51 +25374,51 @@ async function cacheLock(root, signal) {
25185
25374
  return async () => {
25186
25375
  const now = await info(name);
25187
25376
  await fd.close();
25188
- if (!now || now.dev !== owned.dev || now.ino !== owned.ino) throw error4("runtime_lock_changed");
25377
+ if (!now || now.dev !== owned.dev || now.ino !== owned.ino) throw error5("runtime_lock_changed");
25189
25378
  await rm(name);
25190
25379
  };
25191
25380
  }
25192
25381
  async function verifyCached(target, metadata, hostKind) {
25193
25382
  if (!await info(target)) return null;
25194
- await privateDirectory2(target);
25195
- const manifest = await privateJSON(path12.join(target, "runtime.json"));
25383
+ await privateDirectory3(target);
25384
+ const manifest = await privateJSON(path13.join(target, "runtime.json"));
25196
25385
  if (!manifest || manifest.contractVersion !== "creation-verified-runtime/v1" || manifest.version !== metadata.version || manifest.integrity !== metadata.integrity)
25197
- throw error4("runtime_cache_invalid");
25386
+ throw error5("runtime_cache_invalid");
25198
25387
  const names = (await readdir3(target)).filter((name) => name !== "runtime.json").sort();
25199
- if (names.some((name) => !roots.has(name)) || RUNTIME_PACKAGE_ENTRIES.some((name) => !names.includes(name))) throw error4("runtime_cache_invalid");
25388
+ if (names.some((name) => !roots.has(name)) || RUNTIME_PACKAGE_ENTRIES.some((name) => !names.includes(name))) throw error5("runtime_cache_invalid");
25200
25389
  const payload = await inspectRuntimePackage(target, { entries: names });
25201
- if (!payload.hosts.includes(hostKind)) throw error4("runtime_host_unsupported");
25202
- if (JSON.stringify(snapshot(payload)) !== JSON.stringify(manifest.payload)) throw error4("runtime_cache_invalid");
25390
+ if (!payload.hosts.includes(hostKind)) throw error5("runtime_host_unsupported");
25391
+ if (JSON.stringify(snapshot(payload)) !== JSON.stringify(manifest.payload)) throw error5("runtime_cache_invalid");
25203
25392
  return { version: payload.version, root: target, integrity: metadata.integrity, reused: true };
25204
25393
  }
25205
25394
  async function checkedVersionIndex(cacheRoot, metadata) {
25206
- const old = await privateJSON(path12.join(cacheRoot, "version-" + metadata.version + ".json"));
25207
- if (old && JSON.stringify(old) !== JSON.stringify(metadata)) throw error4("runtime_registry_identity_conflict");
25395
+ const old = await privateJSON(path13.join(cacheRoot, "version-" + metadata.version + ".json"));
25396
+ if (old && JSON.stringify(old) !== JSON.stringify(metadata)) throw error5("runtime_registry_identity_conflict");
25208
25397
  return old;
25209
25398
  }
25210
25399
  async function prepareVerifiedRuntime(metadata, { cacheRoot, fetchImpl = fetch, signal, checkRuntime, hostKind = "codex" } = {}) {
25211
- if (!["codex", "claude-code"].includes(hostKind)) throw error4("runtime_host_unsupported");
25212
- if (!path12.isAbsolute(cacheRoot ?? "")) throw error4("runtime_cache_owner_invalid");
25400
+ if (!SUPPORTED_HOSTS.includes(hostKind)) throw error5("runtime_host_unsupported");
25401
+ if (!path13.isAbsolute(cacheRoot ?? "")) throw error5("runtime_cache_owner_invalid");
25213
25402
  metadata = checkedRuntimeMetadata({ name: PACKAGE, version: metadata.version, dist: metadata }, metadata.version);
25214
- await privateDirectory2(cacheRoot);
25403
+ await privateDirectory3(cacheRoot);
25215
25404
  await checkedVersionIndex(cacheRoot, metadata);
25216
- const target = path12.join(cacheRoot, metadata.version + "-" + hash4(metadata.integrity)), existing = await verifyCached(target, metadata, hostKind);
25405
+ const target = path13.join(cacheRoot, metadata.version + "-" + hash4(metadata.integrity)), existing = await verifyCached(target, metadata, hostKind);
25217
25406
  if (existing) return existing;
25218
25407
  const archive = await boundedGet(metadata.tarball, { fetchImpl, signal, maxBytes: MAX_ARCHIVE, timeoutMs: 15e3 });
25219
25408
  const files = await readRuntimeArchive(archive, metadata), release = await cacheLock(cacheRoot, signal);
25220
- const temporary = path12.join(cacheRoot, ".partial-" + randomBytes4(12).toString("hex"));
25409
+ const temporary = path13.join(cacheRoot, ".partial-" + randomBytes5(12).toString("hex"));
25221
25410
  try {
25222
25411
  const index = await checkedVersionIndex(cacheRoot, metadata);
25223
25412
  const found = await verifyCached(target, metadata, hostKind);
25224
25413
  if (found) return found;
25225
25414
  const space = await statfs(cacheRoot, { bigint: true }), needed = BigInt(files.reduce((n, f2) => n + f2.body.length, 0) + 4 * 1024 * 1024);
25226
- if (space.bavail * space.bsize < needed) throw error4("runtime_cache_capacity");
25227
- await mkdir5(temporary, { mode: 448 });
25415
+ if (space.bavail * space.bsize < needed) throw error5("runtime_cache_capacity");
25416
+ await mkdir6(temporary, { mode: 448 });
25228
25417
  for (const file of files) {
25229
25418
  signal?.throwIfAborted();
25230
- const dest = path12.join(temporary, ...file.path.split("/"));
25231
- await mkdir5(path12.dirname(dest), { recursive: true, mode: 448 });
25232
- const fd = await open7(dest, "wx", 384);
25419
+ const dest = path13.join(temporary, ...file.path.split("/"));
25420
+ await mkdir6(path13.dirname(dest), { recursive: true, mode: 448 });
25421
+ const fd = await open8(dest, "wx", 384);
25233
25422
  try {
25234
25423
  await fd.writeFile(file.body);
25235
25424
  await fd.sync();
@@ -25238,26 +25427,26 @@ async function prepareVerifiedRuntime(metadata, { cacheRoot, fetchImpl = fetch,
25238
25427
  }
25239
25428
  }
25240
25429
  const entries2 = [...new Set(files.map((file) => file.path.split("/")[0]))].sort();
25241
- if (RUNTIME_PACKAGE_ENTRIES.some((name) => !entries2.includes(name))) throw error4("runtime_package_incomplete");
25430
+ if (RUNTIME_PACKAGE_ENTRIES.some((name) => !entries2.includes(name))) throw error5("runtime_package_incomplete");
25242
25431
  const payload = await inspectRuntimePackage(temporary, { entries: entries2 });
25243
- if (!payload.hosts.includes(hostKind)) throw error4("runtime_host_unsupported");
25244
- if (payload.version !== metadata.version) throw error4("runtime_package_version_invalid");
25432
+ if (!payload.hosts.includes(hostKind)) throw error5("runtime_host_unsupported");
25433
+ if (payload.version !== metadata.version) throw error5("runtime_package_version_invalid");
25245
25434
  const pkg = JSON.parse(payload.files.find((f2) => f2.path === "package.json").body);
25246
- if (pkg.repository?.url !== "git+https://github.com/ty-teams/promptframe-creation.git" || pkg.private === true) throw error4("runtime_package_identity_invalid");
25435
+ if (pkg.repository?.url !== "git+https://github.com/ty-teams/promptframe-creation.git" || pkg.private === true) throw error5("runtime_package_identity_invalid");
25247
25436
  if (checkRuntime) await checkRuntime(temporary, metadata.version);
25248
25437
  else {
25249
25438
  const result = await execute(
25250
25439
  process.execPath,
25251
- [path12.join(temporary, "bin/promptframe-creation.mjs"), "--version"],
25440
+ [path13.join(temporary, "bin/promptframe-creation.mjs"), "--version"],
25252
25441
  { timeout: 5e3, maxBuffer: 65536, windowsHide: true, signal, env: {
25253
25442
  ...process.env,
25254
- PROMPTFRAME_CREATION_CONFIG: path12.join(temporary, "no-credentials.json")
25443
+ PROMPTFRAME_CREATION_CONFIG: path13.join(temporary, "no-credentials.json")
25255
25444
  } }
25256
25445
  );
25257
- if (result.stdout.trim() !== metadata.version || result.stderr.trim()) throw error4("runtime_package_version_invalid");
25446
+ if (result.stdout.trim() !== metadata.version || result.stderr.trim()) throw error5("runtime_package_version_invalid");
25258
25447
  }
25259
25448
  signal?.throwIfAborted();
25260
- await exclusiveJSON(path12.join(temporary, "runtime.json"), {
25449
+ await exclusiveJSON(path13.join(temporary, "runtime.json"), {
25261
25450
  contractVersion: "creation-verified-runtime/v1",
25262
25451
  version: metadata.version,
25263
25452
  integrity: metadata.integrity,
@@ -25265,10 +25454,10 @@ async function prepareVerifiedRuntime(metadata, { cacheRoot, fetchImpl = fetch,
25265
25454
  });
25266
25455
  await syncDirectory2(temporary);
25267
25456
  if (!index) {
25268
- await exclusiveJSON(path12.join(cacheRoot, "version-" + metadata.version + ".json"), metadata);
25457
+ await exclusiveJSON(path13.join(cacheRoot, "version-" + metadata.version + ".json"), metadata);
25269
25458
  await syncDirectory2(cacheRoot);
25270
25459
  }
25271
- await rename5(temporary, target);
25460
+ await rename6(temporary, target);
25272
25461
  await syncDirectory2(cacheRoot);
25273
25462
  return { version: metadata.version, root: target, integrity: metadata.integrity, reused: false };
25274
25463
  } finally {
@@ -25282,7 +25471,7 @@ async function prepareVerifiedRuntime(metadata, { cacheRoot, fetchImpl = fetch,
25282
25471
  async function selectBridgeRuntime({ policy, currentVersion, lockedVersion, resolvedVersion, cacheRoot, fetchImpl = fetch, signal, checkRuntime, hostKind = "codex" } = {}) {
25283
25472
  version2(currentVersion);
25284
25473
  if (lockedVersion !== void 0) version2(lockedVersion);
25285
- if (resolvedVersion !== void 0 && resolvedVersion !== currentVersion) throw error4("runtime_selection_identity_invalid");
25474
+ if (resolvedVersion !== void 0 && resolvedVersion !== currentVersion) throw error5("runtime_selection_identity_invalid");
25286
25475
  if (!policy) throw new RuntimeSelectionError(
25287
25476
  "platform_bridge_policy_unavailable",
25288
25477
  currentVersion,
@@ -25301,13 +25490,13 @@ async function selectBridgeRuntime({ policy, currentVersion, lockedVersion, reso
25301
25490
  return { version: currentVersion, current: true, locked: lockedVersion !== void 0, status: "current" };
25302
25491
  }
25303
25492
  try {
25304
- await privateDirectory2(cacheRoot);
25493
+ await privateDirectory3(cacheRoot);
25305
25494
  let metadata, metadataSource = "registry";
25306
25495
  try {
25307
25496
  const raw = await boundedGet(REGISTRY + "/@promptframe%2fcreation/" + target, { fetchImpl, signal, maxBytes: 256 * 1024, timeoutMs: 5e3 });
25308
25497
  metadata = checkedRuntimeMetadata(JSON.parse(raw), target);
25309
25498
  } catch (e) {
25310
- const prior = await privateJSON(path12.join(cacheRoot, "version-" + target + ".json"));
25499
+ const prior = await privateJSON(path13.join(cacheRoot, "version-" + target + ".json"));
25311
25500
  if (!prior) throw e;
25312
25501
  metadata = checkedRuntimeMetadata({ name: PACKAGE, version: target, dist: prior }, target);
25313
25502
  metadataSource = "previously-verified-cache";
@@ -25320,29 +25509,29 @@ async function selectBridgeRuntime({ policy, currentVersion, lockedVersion, reso
25320
25509
  metadataSource
25321
25510
  };
25322
25511
  } catch (e) {
25323
- if (signal?.aborted) throw error4("runtime_selection_interrupted");
25512
+ if (signal?.aborted) throw error5("runtime_selection_interrupted");
25324
25513
  if (lockedVersion !== void 0)
25325
25514
  throw new RuntimeSelectionError("bridge_locked_version_unavailable", currentVersion, lockedVersion, policy, "retry_same_fixed_version_in_new_session");
25326
25515
  if (policy && compareBridgeVersions(currentVersion, policy.minBridge) >= 0)
25327
25516
  return { version: currentVersion, current: true, locked: false, status: "update_unavailable_current_compatible" };
25328
25517
  if (policy) assertBridgeCompatible({ experimental: { "promptframe.creation": policy } }, currentVersion);
25329
25518
  if (e instanceof CreationClientError) throw e;
25330
- throw error4("runtime_selection_unavailable");
25519
+ throw error5("runtime_selection_unavailable");
25331
25520
  }
25332
25521
  }
25333
25522
 
25334
25523
  // lib/runtime-launch.mjs
25335
25524
  import { spawn } from "node:child_process";
25336
- import path13 from "node:path";
25525
+ import path14 from "node:path";
25337
25526
  async function launchSelectedBridge(selection, { host, configFile: configFile2, spawnImpl = spawn, env = process.env } = {}) {
25338
- if (!path13.isAbsolute(selection.root ?? "") || !path13.isAbsolute(configFile2 ?? "") || !["codex", "claude-code"].includes(host?.kind))
25527
+ if (!path14.isAbsolute(selection.root ?? "") || !path14.isAbsolute(configFile2 ?? "") || !SUPPORTED_HOSTS.includes(host?.kind))
25339
25528
  throw new CreationClientError("creation.runtime_launch_invalid");
25340
25529
  let child;
25341
25530
  try {
25342
25531
  child = spawnImpl(
25343
25532
  process.execPath,
25344
25533
  [
25345
- path13.join(selection.root, "bin/promptframe-creation.mjs"),
25534
+ path14.join(selection.root, "bin/promptframe-creation.mjs"),
25346
25535
  "bridge",
25347
25536
  "--config",
25348
25537
  configFile2,
@@ -25384,10 +25573,10 @@ async function launchSelectedBridge(selection, { host, configFile: configFile2,
25384
25573
  // lib/user-installation.mjs
25385
25574
  import { execFile as execFile2 } from "node:child_process";
25386
25575
  import { promisify as promisify2 } from "node:util";
25387
- import { createHash as createHash9, randomBytes as randomBytes5 } from "node:crypto";
25388
- import { lstat as lstat8, mkdir as mkdir6, readdir as readdir4, readFile as readFile6, writeFile as writeFile2, rename as rename6, rm as rm2, open as open8 } from "node:fs/promises";
25389
- import { homedir as homedir5 } from "node:os";
25390
- import path14 from "node:path";
25576
+ import { createHash as createHash10, randomBytes as randomBytes6 } from "node:crypto";
25577
+ import { lstat as lstat9, mkdir as mkdir7, readdir as readdir4, readFile as readFile6, writeFile as writeFile2, rename as rename7, rm as rm2, open as open9 } from "node:fs/promises";
25578
+ import { homedir as homedir6 } from "node:os";
25579
+ import path15 from "node:path";
25391
25580
 
25392
25581
  // node_modules/smol-toml/dist/error.js
25393
25582
  function getLineColFromPtr(string4, ptr) {
@@ -25479,14 +25668,14 @@ function parseString(ctx) {
25479
25668
  let value2 = 0;
25480
25669
  let len = c === 120 ? 2 : c === 117 ? 4 : 8;
25481
25670
  for (let j2 = 0; j2 < len; j2++, ctx.p++) {
25482
- let hex2 = ctx.s.charCodeAt(ctx.p);
25671
+ let hex3 = ctx.s.charCodeAt(ctx.p);
25483
25672
  let digit = (
25484
25673
  /* 0-9 */
25485
- hex2 >= 48 && hex2 <= 57 ? hex2 - 48 : (
25674
+ hex3 >= 48 && hex3 <= 57 ? hex3 - 48 : (
25486
25675
  /* A-F */
25487
- hex2 >= 65 && hex2 <= 70 ? hex2 - 65 + 10 : (
25676
+ hex3 >= 65 && hex3 <= 70 ? hex3 - 65 + 10 : (
25488
25677
  /* a-f */
25489
- hex2 >= 97 && hex2 <= 102 ? hex2 - 97 + 10 : -1
25678
+ hex3 >= 97 && hex3 <= 102 ? hex3 - 97 + 10 : -1
25490
25679
  )
25491
25680
  )
25492
25681
  );
@@ -26149,7 +26338,7 @@ var HAS_WELLFORMED = !!"".isWellFormed;
26149
26338
 
26150
26339
  // lib/user-installation.mjs
26151
26340
  var execute2 = promisify2(execFile2);
26152
- var hash5 = (b2) => createHash9("sha256").update(b2).digest("hex");
26341
+ var hash5 = (b2) => createHash10("sha256").update(b2).digest("hex");
26153
26342
  var InstallationError = class extends CreationClientError {
26154
26343
  constructor(code, details) {
26155
26344
  super("installation." + code);
@@ -26159,7 +26348,7 @@ var InstallationError = class extends CreationClientError {
26159
26348
  var fail4 = (code, details) => {
26160
26349
  throw new InstallationError(code, details);
26161
26350
  };
26162
- var installationErrorDetails = (error5) => error5 instanceof InstallationError ? error5.details : void 0;
26351
+ var installationErrorDetails = (error6) => error6 instanceof InstallationError ? error6.details : void 0;
26163
26352
  function compareVersions(a, b2) {
26164
26353
  const left = a.split(".").map(BigInt), right = b2.split(".").map(BigInt);
26165
26354
  for (let i = 0; i < 3; i++) {
@@ -26188,8 +26377,8 @@ function validProfile(profile) {
26188
26377
  }
26189
26378
  function profileCredentialsPath(profile = "default", env = process.env) {
26190
26379
  validProfile(profile);
26191
- return profile === "default" ? credentialsPath(env) : path14.resolve(
26192
- env.XDG_CONFIG_HOME ?? path14.join(homedir5(), ".config"),
26380
+ return profile === "default" ? credentialsPath(env) : path15.resolve(
26381
+ env.XDG_CONFIG_HOME ?? path15.join(homedir6(), ".config"),
26193
26382
  "promptframe-creation",
26194
26383
  "profiles",
26195
26384
  profile,
@@ -26198,18 +26387,18 @@ function profileCredentialsPath(profile = "default", env = process.env) {
26198
26387
  }
26199
26388
  async function info2(file) {
26200
26389
  try {
26201
- return await lstat8(file);
26390
+ return await lstat9(file);
26202
26391
  } catch (e) {
26203
26392
  if (e.code === "ENOENT") return null;
26204
26393
  throw e;
26205
26394
  }
26206
26395
  }
26207
- async function privateDirectory3(dir) {
26208
- await mkdir6(dir, { recursive: true, mode: 448 });
26209
- const s3 = await lstat8(dir);
26396
+ async function privateDirectory4(dir) {
26397
+ await mkdir7(dir, { recursive: true, mode: 448 });
26398
+ const s3 = await lstat9(dir);
26210
26399
  if (!s3.isDirectory() || s3.isSymbolicLink() || s3.uid !== process.getuid?.() || s3.mode & 63) fail4("private_owner_required");
26211
26400
  }
26212
- async function privateRead2(file) {
26401
+ async function privateRead3(file) {
26213
26402
  const s3 = await info2(file);
26214
26403
  if (!s3) return null;
26215
26404
  if (!s3.isFile() || s3.isSymbolicLink() || s3.uid !== process.getuid?.() || s3.mode & 63 || s3.size > 512 * 1024) fail4("state_invalid");
@@ -26221,20 +26410,20 @@ async function packageJSON(file) {
26221
26410
  return json(file);
26222
26411
  }
26223
26412
  function sameTransport(actual, expected) {
26224
- return actual?.type === "stdio" && actual.command === expected.command && typeof actual.cwd === "string" && path14.resolve(actual.cwd) === path14.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;
26413
+ return actual?.type === "stdio" && actual.command === expected.command && typeof actual.cwd === "string" && path15.resolve(actual.cwd) === path15.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;
26225
26414
  }
26226
26415
  async function managedTransport(installed, versions, serverName, profile, configFile2) {
26227
26416
  if (!installed) return null;
26228
26417
  const root = installed.source?.path;
26229
- if (installed.source?.source !== "local" || typeof root !== "string" || !/^\d+\.\d+\.\d+$/.test(installed.version ?? "") || root !== path14.join(versions, installed.version)) fail4("existing_registration_requires_review");
26230
- const directory3 = await info2(root), definition = await info2(path14.join(root, ".mcp.json"));
26418
+ if (installed.source?.source !== "local" || typeof root !== "string" || !/^\d+\.\d+\.\d+$/.test(installed.version ?? "") || root !== path15.join(versions, installed.version)) fail4("existing_registration_requires_review");
26419
+ const directory3 = await info2(root), definition = await info2(path15.join(root, ".mcp.json"));
26231
26420
  if (!directory3?.isDirectory() || directory3.isSymbolicLink() || !definition?.isFile() || definition.isSymbolicLink()) fail4("installed_files_invalid");
26232
- const ready = await privateRead2(path14.join(root, "installation.json"));
26421
+ const ready = await privateRead3(path15.join(root, "installation.json"));
26233
26422
  if (!ready || ready.profile !== profile || ready.configFile !== configFile2 || ready.version !== installed.version) fail4("existing_registration_requires_review");
26234
- const bytes2 = await readFile6(path14.join(root, ".mcp.json")), entry = ready.files?.find((x) => x.path === ".mcp.json");
26423
+ const bytes2 = await readFile6(path15.join(root, ".mcp.json")), entry = ready.files?.find((x) => x.path === ".mcp.json");
26235
26424
  if (!entry || entry.bytes !== bytes2.length || entry.sha256 !== hash5(bytes2)) fail4("installed_files_invalid");
26236
26425
  const mcp = JSON.parse(bytes2).mcpServers?.[serverName];
26237
- if (!mcp || typeof mcp.command !== "string" || !mcp.command || mcp.cwd !== root || JSON.stringify(mcp.args) !== JSON.stringify([path14.join(root, "bin/promptframe-creation.mjs"), "bridge", "--config", configFile2])) fail4("existing_registration_requires_review");
26426
+ if (!mcp || typeof mcp.command !== "string" || !mcp.command || mcp.cwd !== root || JSON.stringify(mcp.args) !== JSON.stringify([path15.join(root, "bin/promptframe-creation.mjs"), "bridge", "--config", configFile2])) fail4("existing_registration_requires_review");
26238
26427
  return mcp;
26239
26428
  }
26240
26429
  async function officialNpmInstallation(installed, servers, env, profile, configFile2) {
@@ -26242,12 +26431,12 @@ async function officialNpmInstallation(installed, servers, env, profile, configF
26242
26431
  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));
26243
26432
  if (candidates.length > 1) fail4("existing_registration_requires_review");
26244
26433
  if (!candidates.length) return null;
26245
- const p2 = candidates[0], root = path14.join(path14.resolve(env.CODEX_HOME ?? path14.join(homedir5(), ".codex")), "plugins/cache", p2.marketplaceName, p2.name, p2.version);
26434
+ const p2 = candidates[0], root = path15.join(path15.resolve(env.CODEX_HOME ?? path15.join(homedir6(), ".codex")), "plugins/cache", p2.marketplaceName, p2.name, p2.version);
26246
26435
  const directory3 = await info2(root);
26247
26436
  if (!directory3?.isDirectory() || directory3.isSymbolicLink()) fail4("installed_files_invalid");
26248
- const pkg = await packageJSON(path14.join(root, "package.json")), manifest = await packageJSON(path14.join(root, ".codex-plugin/plugin.json"));
26437
+ const pkg = await packageJSON(path15.join(root, "package.json")), manifest = await packageJSON(path15.join(root, ".codex-plugin/plugin.json"));
26249
26438
  if (pkg.name !== "@promptframe/creation" || pkg.version !== p2.version || manifest.name !== p2.name || manifest.version !== p2.version) fail4("installed_files_invalid");
26250
- const definition = (await packageJSON(path14.join(root, ".mcp.json"))).mcpServers?.promptframe;
26439
+ const definition = (await packageJSON(path15.join(root, ".mcp.json"))).mcpServers?.promptframe;
26251
26440
  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");
26252
26441
  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");
26253
26442
  return {
@@ -26264,17 +26453,17 @@ async function officialNpmInstallation(installed, servers, env, profile, configF
26264
26453
  };
26265
26454
  }
26266
26455
  async function atomicJSON(file, value2) {
26267
- const temp = file + "." + randomBytes5(12).toString("hex") + ".tmp";
26456
+ const temp = file + "." + randomBytes6(12).toString("hex") + ".tmp";
26268
26457
  try {
26269
- const out = await open8(temp, "wx", 384);
26458
+ const out = await open9(temp, "wx", 384);
26270
26459
  try {
26271
26460
  await out.writeFile(JSON.stringify(value2, null, 2) + "\n");
26272
26461
  await out.sync();
26273
26462
  } finally {
26274
26463
  await out.close();
26275
26464
  }
26276
- await rename6(temp, file);
26277
- const directory3 = await open8(path14.dirname(file), "r");
26465
+ await rename7(temp, file);
26466
+ const directory3 = await open9(path15.dirname(file), "r");
26278
26467
  try {
26279
26468
  await directory3.sync();
26280
26469
  } finally {
@@ -26285,13 +26474,13 @@ async function atomicJSON(file, value2) {
26285
26474
  }
26286
26475
  }
26287
26476
  async function acquire(root, signal) {
26288
- const lock = path14.join(root, "install.lock");
26477
+ const lock = path15.join(root, "install.lock");
26289
26478
  const end = Date.now() + 3e4;
26290
26479
  let owned = false;
26291
26480
  while (!owned) {
26292
26481
  signal?.throwIfAborted();
26293
26482
  try {
26294
- await mkdir6(lock, { mode: 448 });
26483
+ await mkdir7(lock, { mode: 448 });
26295
26484
  owned = true;
26296
26485
  } catch (e) {
26297
26486
  if (e.code !== "EEXIST") throw e;
@@ -26300,7 +26489,7 @@ async function acquire(root, signal) {
26300
26489
  }
26301
26490
  }
26302
26491
  try {
26303
- await writeFile2(path14.join(lock, "owner.json"), JSON.stringify({ pid: process.pid, startedAt: (/* @__PURE__ */ new Date()).toISOString() }), { flag: "wx", mode: 384 });
26492
+ await writeFile2(path15.join(lock, "owner.json"), JSON.stringify({ pid: process.pid, startedAt: (/* @__PURE__ */ new Date()).toISOString() }), { flag: "wx", mode: 384 });
26304
26493
  } catch (e) {
26305
26494
  await rm2(lock, { recursive: true, force: true });
26306
26495
  throw e;
@@ -26341,7 +26530,7 @@ async function codexJSON(runCodex, args2) {
26341
26530
  }
26342
26531
  }
26343
26532
  async function relatedPlugins(runCodex, pluginName, env) {
26344
- const related = /* @__PURE__ */ new Set(), registered = /* @__PURE__ */ new Set(), pinnedMarketplaces = /* @__PURE__ */ new Map(), config2 = path14.join(path14.resolve(env.CODEX_HOME ?? path14.join(homedir5(), ".codex")), "config.toml");
26533
+ const related = /* @__PURE__ */ new Set(), registered = /* @__PURE__ */ new Set(), pinnedMarketplaces = /* @__PURE__ */ new Map(), config2 = path15.join(path15.resolve(env.CODEX_HOME ?? path15.join(homedir6(), ".codex")), "config.toml");
26345
26534
  try {
26346
26535
  const s3 = await info2(config2);
26347
26536
  if (s3) {
@@ -26361,10 +26550,10 @@ async function relatedPlugins(runCodex, pluginName, env) {
26361
26550
  const state = await codexJSON(runCodex, ["plugin", "marketplace", "list", "--json"]);
26362
26551
  if (!Array.isArray(state?.marketplaces) || state.marketplaces.length > 128) fail4("local_catalog_unconfirmed");
26363
26552
  for (const market of state.marketplaces) {
26364
- if (typeof market.name !== "string" || !/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,140}$/.test(market.name) || typeof market.root !== "string" || !path14.isAbsolute(market.root)) fail4("local_catalog_unconfirmed");
26553
+ if (typeof market.name !== "string" || !/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,140}$/.test(market.name) || typeof market.root !== "string" || !path15.isAbsolute(market.root)) fail4("local_catalog_unconfirmed");
26365
26554
  let catalog;
26366
26555
  try {
26367
- catalog = await packageJSON(path14.join(market.root, ".agents/plugins/marketplace.json"));
26556
+ catalog = await packageJSON(path15.join(market.root, ".agents/plugins/marketplace.json"));
26368
26557
  } catch {
26369
26558
  fail4("local_catalog_unconfirmed", { phase: "local_check", commandKind: "marketplace_read", localRegistrationState: "unknown", action: "restore_local_marketplace_catalog" });
26370
26559
  }
@@ -26395,7 +26584,7 @@ async function relatedPlugins(runCodex, pluginName, env) {
26395
26584
  }
26396
26585
  async function runNode(root, version3) {
26397
26586
  try {
26398
- const result = await execute2(process.execPath, [path14.join(root, "bin/promptframe-creation.mjs"), "--version"], { encoding: "utf8", timeout: 1e4, maxBuffer: 8192 });
26587
+ const result = await execute2(process.execPath, [path15.join(root, "bin/promptframe-creation.mjs"), "--version"], { encoding: "utf8", timeout: 1e4, maxBuffer: 8192 });
26399
26588
  if (result.stdout.trim() !== version3) fail4("runtime_version_mismatch");
26400
26589
  } catch (e) {
26401
26590
  if (e instanceof CreationClientError) throw e;
@@ -26409,7 +26598,7 @@ async function checkInstalledRuntime(root, version3, command2, { env = process.e
26409
26598
  if (!major || Number(major[1]) < 20) throw Error("unsupported_node");
26410
26599
  const result = await execute2(
26411
26600
  command2,
26412
- [path14.join(root, "bin/promptframe-creation.mjs"), "--version"],
26601
+ [path15.join(root, "bin/promptframe-creation.mjs"), "--version"],
26413
26602
  { env, encoding: "utf8", timeout: 1e4, maxBuffer: 8192 }
26414
26603
  );
26415
26604
  if (result.stdout.trim() !== version3) throw Error("wrong_version");
@@ -26423,8 +26612,8 @@ async function checkInstalledRuntime(root, version3, command2, { env = process.e
26423
26612
  }
26424
26613
  var installationFiles = Object.freeze({
26425
26614
  info: info2,
26426
- privateDirectory: privateDirectory3,
26427
- privateRead: privateRead2,
26615
+ privateDirectory: privateDirectory4,
26616
+ privateRead: privateRead3,
26428
26617
  atomicJSON,
26429
26618
  acquire,
26430
26619
  runNode,
@@ -26446,21 +26635,21 @@ async function installForUser({
26446
26635
  const versionOutput = await runCodex(["--version"]);
26447
26636
  const match = versionOutput.match(/codex-cli (\d+)\.(\d+)\.(\d+)/);
26448
26637
  if (!match || Number(match[1]) === 0 && Number(match[2]) < 160) fail4("codex_0160_required");
26449
- const payload = await inspectRuntimePackage(path14.resolve(sourceRoot));
26450
- const root = path14.resolve(env.XDG_DATA_HOME ?? path14.join(homedir5(), ".local/share"), "promptframe-creation", profile);
26451
- await privateDirectory3(root);
26638
+ const payload = await inspectRuntimePackage(path15.resolve(sourceRoot));
26639
+ const root = path15.resolve(env.XDG_DATA_HOME ?? path15.join(homedir6(), ".local/share"), "promptframe-creation", profile);
26640
+ await privateDirectory4(root);
26452
26641
  const release = await acquire(root, signal);
26453
- const versions = path14.join(root, "versions"), currentFile = path14.join(root, "current.json"), pendingFile = path14.join(root, "registration-pending.json");
26454
- const marketplaceFile = path14.join(root, ".agents/plugins/marketplace.json");
26642
+ const versions = path15.join(root, "versions"), currentFile = path15.join(root, "current.json"), pendingFile = path15.join(root, "registration-pending.json");
26643
+ const marketplaceFile = path15.join(root, ".agents/plugins/marketplace.json");
26455
26644
  const pluginName = "promptframe-creation" + (profile === "default" ? "" : "-" + profile), marketplace = "promptframe-creation-user" + (profile === "default" ? "" : "-" + profile);
26456
26645
  const pluginId = pluginName + "@" + marketplace;
26457
- const versionRoot = path14.join(versions, payload.version), temporary = path14.join(versions, ".partial-" + randomBytes5(12).toString("hex"));
26646
+ const versionRoot = path15.join(versions, payload.version), temporary = path15.join(versions, ".partial-" + randomBytes6(12).toString("hex"));
26458
26647
  let previous, registrationStarted = false, newFiles = 0;
26459
26648
  try {
26460
26649
  signal?.throwIfAborted();
26461
- await privateDirectory3(versions);
26462
- await privateDirectory3(path14.dirname(marketplaceFile));
26463
- previous = await privateRead2(currentFile);
26650
+ await privateDirectory4(versions);
26651
+ await privateDirectory4(path15.dirname(marketplaceFile));
26652
+ previous = await privateRead3(currentFile);
26464
26653
  if (previous && (previous.profile !== profile || previous.pluginId !== pluginId || previous.configFile !== configFile2)) fail4("profile_binding_conflict");
26465
26654
  const state = { installed: await relatedPlugins(runCodex, pluginName, env) };
26466
26655
  const installed = state.installed.find((x) => x.pluginId === pluginId);
@@ -26468,14 +26657,14 @@ async function installForUser({
26468
26657
  if (!Array.isArray(legacy)) fail4("local_registration_unconfirmed");
26469
26658
  const serverName = "promptframe" + (profile === "default" ? "" : "-" + profile);
26470
26659
  const servers = legacy.filter((x) => x.name === serverName);
26471
- const pending = await privateRead2(pendingFile);
26660
+ const pending = await privateRead3(pendingFile);
26472
26661
  if (pending) {
26473
- if (pending.profile !== profile || pending.pluginId !== pluginId || pending.configFile !== configFile2 || pending.versionRoot !== path14.join(versions, pending.version)) fail4("profile_binding_conflict");
26662
+ if (pending.profile !== profile || pending.pluginId !== pluginId || pending.configFile !== configFile2 || pending.versionRoot !== path15.join(versions, pending.version)) fail4("profile_binding_conflict");
26474
26663
  if (installed?.version !== pending.version || installed.enabled !== true || installed.source?.path !== pending.versionRoot)
26475
26664
  fail4("registration_unconfirmed_keep_existing", { phase: "registration_observation", localRegistrationState: "unknown", action: "inspect_same_registration_no_second_add" });
26476
26665
  const transport2 = await managedTransport(installed, versions, serverName, profile, configFile2);
26477
26666
  if (servers.length !== 1 || servers[0].enabled === false || !sameTransport(servers[0].transport, transport2)) fail4("registration_unconfirmed_keep_existing");
26478
- const ready = await privateRead2(path14.join(pending.versionRoot, "installation.json"));
26667
+ const ready = await privateRead3(path15.join(pending.versionRoot, "installation.json"));
26479
26668
  if (ready?.payloadDigest !== pending.payloadDigest) fail4("installed_files_invalid");
26480
26669
  previous = pending;
26481
26670
  await atomicJSON(currentFile, pending);
@@ -26530,43 +26719,43 @@ async function installForUser({
26530
26719
  const target = await info2(versionRoot);
26531
26720
  if (target) {
26532
26721
  if (!target.isDirectory() || target.isSymbolicLink()) fail4("version_content_conflict");
26533
- const ready = await privateRead2(path14.join(versionRoot, "installation.json"));
26722
+ const ready = await privateRead3(path15.join(versionRoot, "installation.json"));
26534
26723
  if (!ready || ready.payloadDigest !== payload.payloadDigest || ready.profile !== profile || ready.configFile !== configFile2) fail4("version_content_conflict");
26535
26724
  for (const f2 of ready.files) {
26536
26725
  if (!payload.files.some((p2) => p2.path === f2.path)) fail4("installed_files_invalid");
26537
- const file = path14.join(versionRoot, f2.path), s3 = await info2(file);
26726
+ const file = path15.join(versionRoot, f2.path), s3 = await info2(file);
26538
26727
  if (!s3?.isFile() || s3.isSymbolicLink() || s3.size !== f2.bytes || hash5(await readFile6(file)) !== f2.sha256) fail4("installed_files_invalid");
26539
26728
  }
26540
26729
  if (ready.files.length !== payload.files.length) fail4("installed_files_invalid");
26541
26730
  } else {
26542
- await mkdir6(temporary, { mode: 448 });
26731
+ await mkdir7(temporary, { mode: 448 });
26543
26732
  for (const f2 of payload.files) {
26544
26733
  signal?.throwIfAborted();
26545
- await mkdir6(path14.dirname(path14.join(temporary, f2.path)), { recursive: true, mode: 448 });
26546
- await writeFile2(path14.join(temporary, f2.path), f2.body, { flag: "wx", mode: 384 });
26734
+ await mkdir7(path15.dirname(path15.join(temporary, f2.path)), { recursive: true, mode: 448 });
26735
+ await writeFile2(path15.join(temporary, f2.path), f2.body, { flag: "wx", mode: 384 });
26547
26736
  }
26548
- const manifest = await json(path14.join(temporary, ".codex-plugin/plugin.json"));
26737
+ const manifest = await json(path15.join(temporary, ".codex-plugin/plugin.json"));
26549
26738
  manifest.name = pluginName;
26550
- await writeFile2(path14.join(temporary, ".codex-plugin/plugin.json"), JSON.stringify(manifest, null, 2) + "\n");
26739
+ await writeFile2(path15.join(temporary, ".codex-plugin/plugin.json"), JSON.stringify(manifest, null, 2) + "\n");
26551
26740
  const mcp = { mcpServers: { ["promptframe" + (profile === "default" ? "" : "-" + profile)]: {
26552
26741
  command: process.execPath,
26553
- args: [path14.join(versionRoot, "bin/promptframe-creation.mjs"), "bridge", "--config", configFile2],
26742
+ args: [path15.join(versionRoot, "bin/promptframe-creation.mjs"), "bridge", "--config", configFile2],
26554
26743
  cwd: versionRoot
26555
26744
  } } };
26556
- await writeFile2(path14.join(temporary, ".mcp.json"), JSON.stringify(mcp, null, 2) + "\n");
26745
+ await writeFile2(path15.join(temporary, ".mcp.json"), JSON.stringify(mcp, null, 2) + "\n");
26557
26746
  await checkRuntime(temporary, payload.version);
26558
26747
  const files = [];
26559
26748
  for (const f2 of payload.files) {
26560
- const body = await readFile6(path14.join(temporary, f2.path));
26749
+ const body = await readFile6(path15.join(temporary, f2.path));
26561
26750
  files.push({ path: f2.path, bytes: body.length, sha256: hash5(body) });
26562
26751
  }
26563
- await atomicJSON(path14.join(temporary, "installation.json"), { version: payload.version, profile, configFile: configFile2, payloadDigest: payload.payloadDigest, files });
26752
+ await atomicJSON(path15.join(temporary, "installation.json"), { version: payload.version, profile, configFile: configFile2, payloadDigest: payload.payloadDigest, files });
26564
26753
  signal?.throwIfAborted();
26565
- await rename6(temporary, versionRoot);
26754
+ await rename7(temporary, versionRoot);
26566
26755
  newFiles = payload.files.length;
26567
26756
  }
26568
26757
  if (newFiles === 0) {
26569
- const launch = (await json(path14.join(versionRoot, ".mcp.json"))).mcpServers?.[serverName];
26758
+ const launch = (await json(path15.join(versionRoot, ".mcp.json"))).mcpServers?.[serverName];
26570
26759
  await verifyInstalledRuntime(versionRoot, payload.version, launch.command, { env });
26571
26760
  }
26572
26761
  const complete = { version: payload.version, profile, configFile: configFile2, pluginId, versionRoot, payloadDigest: payload.payloadDigest };
@@ -26605,16 +26794,16 @@ async function installForUser({
26605
26794
  reloadRequired: !already,
26606
26795
  recordedRuntimeRetained: Boolean(already && recorded && recorded.command !== process.execPath)
26607
26796
  };
26608
- } catch (error5) {
26797
+ } catch (error6) {
26609
26798
  if (registrationStarted) {
26610
26799
  fail4("registration_unconfirmed_keep_existing", {
26611
- ...installationErrorDetails(error5),
26800
+ ...installationErrorDetails(error6),
26612
26801
  phase: "registration_observation",
26613
26802
  localRegistrationState: "unknown",
26614
26803
  action: "inspect_same_registration_no_second_add"
26615
26804
  });
26616
26805
  }
26617
- if (error5 instanceof CreationClientError) throw error5;
26806
+ if (error6 instanceof CreationClientError) throw error6;
26618
26807
  if (signal?.aborted) fail4("interrupted_keep_existing");
26619
26808
  fail4("failed_keep_existing");
26620
26809
  } finally {
@@ -26624,10 +26813,10 @@ async function installForUser({
26624
26813
  }
26625
26814
 
26626
26815
  // lib/claude-installation.mjs
26627
- import { createHash as createHash12, randomBytes as randomBytes7 } from "node:crypto";
26628
- import { mkdir as mkdir8, open as open11, readFile as readFile9, rename as rename8, rm as rm5 } from "node:fs/promises";
26629
- import { homedir as homedir10 } from "node:os";
26630
- import path19 from "node:path";
26816
+ import { createHash as createHash13, randomBytes as randomBytes8 } from "node:crypto";
26817
+ import { mkdir as mkdir9, open as open12, readFile as readFile9, rename as rename9, rm as rm5 } from "node:fs/promises";
26818
+ import { homedir as homedir11 } from "node:os";
26819
+ import path20 from "node:path";
26631
26820
 
26632
26821
  // lib/claude-hook-definition.mjs
26633
26822
  function claudeHostHooks({ pluginName = "promptframe-creation", serverName, configFile: configFile2, nodeCommand = "node", runtimeRoot = "${CLAUDE_PLUGIN_ROOT}" } = {}) {
@@ -26650,10 +26839,10 @@ function claudeHostHooks({ pluginName = "promptframe-creation", serverName, conf
26650
26839
  // lib/claude-command.mjs
26651
26840
  import { execFile as execFile3 } from "node:child_process";
26652
26841
  import { promisify as promisify3 } from "node:util";
26653
- import { access, lstat as lstat9, readdir as readdir5 } from "node:fs/promises";
26654
- import { constants as constants6 } from "node:fs";
26655
- import { homedir as homedir6 } from "node:os";
26656
- import path15 from "node:path";
26842
+ import { access, lstat as lstat10, readdir as readdir5 } from "node:fs/promises";
26843
+ import { constants as constants7 } from "node:fs";
26844
+ import { homedir as homedir7 } from "node:os";
26845
+ import path16 from "node:path";
26657
26846
  var execute3 = promisify3(execFile3);
26658
26847
  var ClaudeCommandError = class extends CreationClientError {
26659
26848
  constructor(code, details) {
@@ -26661,24 +26850,24 @@ var ClaudeCommandError = class extends CreationClientError {
26661
26850
  this.details = details;
26662
26851
  }
26663
26852
  };
26664
- var claudeErrorDetails = (error5) => error5 instanceof ClaudeCommandError ? error5.details : void 0;
26665
- async function resolveClaudeCommand({ env = process.env, homeDirectory = homedir6(), executable } = {}) {
26853
+ var claudeErrorDetails = (error6) => error6 instanceof ClaudeCommandError ? error6.details : void 0;
26854
+ async function resolveClaudeCommand({ env = process.env, homeDirectory = homedir7(), executable } = {}) {
26666
26855
  const selected = executable ?? env.PROMPTFRAME_CLAUDE_BIN;
26667
26856
  if (selected) {
26668
- if (!path15.isAbsolute(selected)) throw new CreationClientError("installation.claude_executable_invalid");
26669
- await access(selected, constants6.X_OK);
26857
+ if (!path16.isAbsolute(selected)) throw new CreationClientError("installation.claude_executable_invalid");
26858
+ await access(selected, constants7.X_OK);
26670
26859
  return selected;
26671
26860
  }
26672
- for (const directory3 of (env.PATH ?? "").split(path15.delimiter).filter(path15.isAbsolute)) {
26673
- const file = path15.join(directory3, process.platform === "win32" ? "claude.exe" : "claude");
26861
+ for (const directory3 of (env.PATH ?? "").split(path16.delimiter).filter(path16.isAbsolute)) {
26862
+ const file = path16.join(directory3, process.platform === "win32" ? "claude.exe" : "claude");
26674
26863
  try {
26675
- await access(file, constants6.X_OK);
26864
+ await access(file, constants7.X_OK);
26676
26865
  return file;
26677
26866
  } catch (e) {
26678
26867
  if (!["ENOENT", "EACCES", "ENOTDIR"].includes(e.code)) throw e;
26679
26868
  }
26680
26869
  }
26681
- const root = path15.join(homeDirectory, ".claude/remote/ccd-cli");
26870
+ const root = path16.join(homeDirectory, ".claude/remote/ccd-cli");
26682
26871
  let entries2;
26683
26872
  try {
26684
26873
  entries2 = await readdir5(root);
@@ -26691,9 +26880,9 @@ async function resolveClaudeCommand({ env = process.env, homeDirectory = homedir
26691
26880
  for (const name of entries2) {
26692
26881
  const match = name.match(/^(\d+)\.(\d+)\.(\d+)-[a-f0-9]{6,40}$/);
26693
26882
  if (!match) continue;
26694
- const file = path15.join(root, name), s3 = await lstat9(file);
26883
+ const file = path16.join(root, name), s3 = await lstat10(file);
26695
26884
  if (s3.isFile() && !s3.isSymbolicLink() && s3.uid === process.getuid?.()) {
26696
- await access(file, constants6.X_OK);
26885
+ await access(file, constants7.X_OK);
26697
26886
  candidates.push({ file, version: match.slice(1).map(Number) });
26698
26887
  }
26699
26888
  }
@@ -26729,17 +26918,17 @@ function createClaudeRunner({ env = process.env, executable, signal, resolve = r
26729
26918
  }
26730
26919
 
26731
26920
  // lib/claude-local-state.mjs
26732
- import { readFile as readFile7, lstat as lstat10 } from "node:fs/promises";
26733
- import { homedir as homedir7 } from "node:os";
26734
- import path16 from "node:path";
26921
+ import { readFile as readFile7, lstat as lstat11 } from "node:fs/promises";
26922
+ import { homedir as homedir8 } from "node:os";
26923
+ import path17 from "node:path";
26735
26924
  function claudeConfigRoot(env = process.env) {
26736
- return path16.resolve(env.CLAUDE_CONFIG_DIR ?? path16.join(homedir7(), ".claude"));
26925
+ return path17.resolve(env.CLAUDE_CONFIG_DIR ?? path17.join(homedir8(), ".claude"));
26737
26926
  }
26738
26927
  async function readClaudeUserServer(serverName, env = process.env) {
26739
- const file = env.CLAUDE_CONFIG_DIR ? path16.join(claudeConfigRoot(env), ".claude.json") : path16.join(homedir7(), ".claude.json");
26928
+ const file = env.CLAUDE_CONFIG_DIR ? path17.join(claudeConfigRoot(env), ".claude.json") : path17.join(homedir8(), ".claude.json");
26740
26929
  let info5;
26741
26930
  try {
26742
- info5 = await lstat10(file);
26931
+ info5 = await lstat11(file);
26743
26932
  } catch (e) {
26744
26933
  if (e.code === "ENOENT") return null;
26745
26934
  throw new CreationClientError("installation.claude_local_registration_unconfirmed");
@@ -26759,26 +26948,26 @@ async function readClaudeUserServer(serverName, env = process.env) {
26759
26948
  }
26760
26949
 
26761
26950
  // lib/claude-mcp-installation.mjs
26762
- import { createHash as createHash11, randomBytes as randomBytes6 } from "node:crypto";
26763
- import { mkdir as mkdir7, open as open10, readFile as readFile8, readdir as readdir6, rename as rename7, rm as rm4, lstat as lstat11 } from "node:fs/promises";
26764
- import { homedir as homedir9 } from "node:os";
26765
- import path18 from "node:path";
26951
+ import { createHash as createHash12, randomBytes as randomBytes7 } from "node:crypto";
26952
+ import { mkdir as mkdir8, open as open11, readFile as readFile8, readdir as readdir6, rename as rename8, rm as rm4, lstat as lstat12 } from "node:fs/promises";
26953
+ import { homedir as homedir10 } from "node:os";
26954
+ import path19 from "node:path";
26766
26955
 
26767
26956
  // lib/claude-hook-registration.mjs
26768
- import { createHash as createHash10 } from "node:crypto";
26769
- import { open as open9, rm as rm3 } from "node:fs/promises";
26770
- import { constants as constants7 } from "node:fs";
26771
- import path17 from "node:path";
26772
- import { homedir as homedir8 } from "node:os";
26773
- var { privateDirectory: privateDirectory4, privateRead: privateRead3, atomicJSON: atomicJSON2, acquire: acquire2 } = installationFiles;
26774
- var digest4 = (value2) => createHash10("sha256").update(JSON.stringify(value2)).digest("hex");
26957
+ import { createHash as createHash11 } from "node:crypto";
26958
+ import { open as open10, rm as rm3 } from "node:fs/promises";
26959
+ import { constants as constants8 } from "node:fs";
26960
+ import path18 from "node:path";
26961
+ import { homedir as homedir9 } from "node:os";
26962
+ var { privateDirectory: privateDirectory5, privateRead: privateRead4, atomicJSON: atomicJSON2, acquire: acquire2 } = installationFiles;
26963
+ var digest5 = (value2) => createHash11("sha256").update(JSON.stringify(value2)).digest("hex");
26775
26964
  var fail5 = () => {
26776
26965
  throw new CreationClientError("installation.claude_hooks_require_review");
26777
26966
  };
26778
26967
  async function settings(file) {
26779
26968
  let handle;
26780
26969
  try {
26781
- handle = await open9(file, constants7.O_RDONLY | constants7.O_NOFOLLOW);
26970
+ handle = await open10(file, constants8.O_RDONLY | constants8.O_NOFOLLOW);
26782
26971
  const info5 = await handle.stat();
26783
26972
  if (!info5.isFile() || info5.uid !== process.getuid?.() || info5.size > 512 * 1024) fail5();
26784
26973
  const value2 = JSON.parse(await handle.readFile("utf8"));
@@ -26791,29 +26980,29 @@ async function settings(file) {
26791
26980
  await handle?.close();
26792
26981
  }
26793
26982
  }
26794
- var contains = (value2, entries2) => Object.entries(entries2).every(([event, wanted]) => Array.isArray(value2.hooks?.[event]) && wanted.every((entry) => value2.hooks[event].filter((actual) => digest4(actual) === digest4(entry)).length === 1));
26983
+ var contains = (value2, entries2) => Object.entries(entries2).every(([event, wanted]) => Array.isArray(value2.hooks?.[event]) && wanted.every((entry) => value2.hooks[event].filter((actual) => digest5(actual) === digest5(entry)).length === 1));
26795
26984
  async function verifyClaudeFallbackHooks(record2, env) {
26796
- if (!record2?.settingsFile || record2.settingsFile !== path17.join(claudeConfigRoot(env), "settings.json") || !record2.entries) fail5();
26985
+ if (!record2?.settingsFile || record2.settingsFile !== path18.join(claudeConfigRoot(env), "settings.json") || !record2.entries) fail5();
26797
26986
  if (!contains(await settings(record2.settingsFile), record2.entries)) fail5();
26798
26987
  return true;
26799
26988
  }
26800
26989
  async function registerClaudeFallbackHooks({ record: record2, root, env, nodeCommand, signal }) {
26801
- const directory3 = claudeConfigRoot(env), file = path17.join(directory3, "settings.json");
26802
- const guard = path17.resolve(
26803
- env.XDG_DATA_HOME ?? path17.join(homedir8(), ".local/share"),
26990
+ const directory3 = claudeConfigRoot(env), file = path18.join(directory3, "settings.json");
26991
+ const guard = path18.resolve(
26992
+ env.XDG_DATA_HOME ?? path18.join(homedir9(), ".local/share"),
26804
26993
  "promptframe-creation",
26805
- "claude-hook-writer-" + digest4(directory3)
26994
+ "claude-hook-writer-" + digest5(directory3)
26806
26995
  );
26807
- await privateDirectory4(guard);
26996
+ await privateDirectory5(guard);
26808
26997
  const release = await acquire2(guard, signal);
26809
- const markerFile = path17.join(root, "hooks-current.json"), pendingFile = path17.join(root, "hooks-pending.json");
26998
+ const markerFile = path18.join(root, "hooks-current.json"), pendingFile = path18.join(root, "hooks-pending.json");
26810
26999
  try {
26811
- await privateDirectory4(directory3);
27000
+ await privateDirectory5(directory3);
26812
27001
  const entries2 = claudeHostHooks({ serverName: record2.serverName, configFile: record2.configFile, nodeCommand, runtimeRoot: record2.versionRoot });
26813
27002
  const expected = { contractVersion: "creation-claude-hooks/v1", settingsFile: file, profile: record2.profile, entries: entries2 };
26814
- const pending = await privateRead3(pendingFile), previous = await privateRead3(markerFile), before = await settings(file);
27003
+ const pending = await privateRead4(pendingFile), previous = await privateRead4(markerFile), before = await settings(file);
26815
27004
  if (pending) {
26816
- if (digest4(pending) !== digest4(expected) || !contains(before, entries2)) throw new CreationClientError("installation.registration_unconfirmed_keep_existing");
27005
+ if (digest5(pending) !== digest5(expected) || !contains(before, entries2)) throw new CreationClientError("installation.registration_unconfirmed_keep_existing");
26817
27006
  await atomicJSON2(markerFile, expected);
26818
27007
  await rm3(pendingFile);
26819
27008
  return expected;
@@ -26821,19 +27010,19 @@ async function registerClaudeFallbackHooks({ record: record2, root, env, nodeCom
26821
27010
  if (previous) {
26822
27011
  if (previous.contractVersion !== expected.contractVersion || previous.profile !== record2.profile || previous.settingsFile !== file) fail5();
26823
27012
  await verifyClaudeFallbackHooks(previous, env);
26824
- if (digest4(previous) === digest4(expected)) return previous;
27013
+ if (digest5(previous) === digest5(expected)) return previous;
26825
27014
  }
26826
27015
  const next = { ...before, hooks: { ...before.hooks } };
26827
27016
  for (const [event, wanted] of Object.entries(entries2)) {
26828
27017
  const actual = next.hooks[event] ?? [];
26829
27018
  if (!Array.isArray(actual)) fail5();
26830
- const owned = new Set((previous?.entries[event] ?? []).map(digest4));
26831
- if (wanted.some((entry) => actual.some((value2) => digest4(value2) === digest4(entry)) && !owned.has(digest4(entry)))) fail5();
26832
- next.hooks[event] = [...actual.filter((entry) => !owned.has(digest4(entry))), ...wanted];
27019
+ const owned = new Set((previous?.entries[event] ?? []).map(digest5));
27020
+ if (wanted.some((entry) => actual.some((value2) => digest5(value2) === digest5(entry)) && !owned.has(digest5(entry)))) fail5();
27021
+ next.hooks[event] = [...actual.filter((entry) => !owned.has(digest5(entry))), ...wanted];
26833
27022
  }
26834
27023
  signal?.throwIfAborted();
26835
27024
  await atomicJSON2(pendingFile, expected);
26836
- if (digest4(await settings(file)) !== digest4(before)) fail5();
27025
+ if (digest5(await settings(file)) !== digest5(before)) fail5();
26837
27026
  await atomicJSON2(file, next);
26838
27027
  if (!contains(await settings(file), entries2)) throw new CreationClientError("installation.registration_unconfirmed_keep_existing");
26839
27028
  await atomicJSON2(markerFile, expected);
@@ -26845,24 +27034,24 @@ async function registerClaudeFallbackHooks({ record: record2, root, env, nodeCom
26845
27034
  }
26846
27035
 
26847
27036
  // lib/claude-mcp-installation.mjs
26848
- var { info: info3, privateDirectory: privateDirectory5, privateRead: privateRead4, atomicJSON: atomicJSON3, acquire: acquire3, compareVersions: compareVersions2 } = installationFiles;
26849
- var hash6 = (body) => createHash11("sha256").update(body).digest("hex");
27037
+ var { info: info3, privateDirectory: privateDirectory6, privateRead: privateRead5, atomicJSON: atomicJSON3, acquire: acquire3, compareVersions: compareVersions2 } = installationFiles;
27038
+ var hash6 = (body) => createHash12("sha256").update(body).digest("hex");
26850
27039
  var FallbackError = class extends CreationClientError {
26851
27040
  constructor(code, details) {
26852
27041
  super("installation." + code);
26853
27042
  this.details = details;
26854
27043
  }
26855
27044
  };
26856
- var fallbackErrorDetails = (error5) => error5 instanceof FallbackError ? error5.details : void 0;
27045
+ var fallbackErrorDetails = (error6) => error6 instanceof FallbackError ? error6.details : void 0;
26857
27046
  var fail6 = (code, details) => {
26858
27047
  throw new FallbackError(code, details);
26859
27048
  };
26860
27049
  async function claimSkillDirectory(root) {
26861
27050
  try {
26862
- await mkdir7(root, { mode: 448 });
26863
- } catch (error5) {
26864
- if (error5.code === "EEXIST") fail6("claude_skill_requires_review");
26865
- throw error5;
27051
+ await mkdir8(root, { mode: 448 });
27052
+ } catch (error6) {
27053
+ if (error6.code === "EEXIST") fail6("claude_skill_requires_review");
27054
+ throw error6;
26866
27055
  }
26867
27056
  }
26868
27057
  function same(a, b2, depth = 0) {
@@ -26872,17 +27061,17 @@ function same(a, b2, depth = 0) {
26872
27061
  return left.length <= 256 && left.length === right.length && left.every((key, i) => key === right[i] && same(a[key], b2[key], depth + 1));
26873
27062
  }
26874
27063
  async function atomicText(file, body) {
26875
- const temporary = file + "." + randomBytes6(12).toString("hex") + ".tmp";
27064
+ const temporary = file + "." + randomBytes7(12).toString("hex") + ".tmp";
26876
27065
  try {
26877
- const fd = await open10(temporary, "wx", 384);
27066
+ const fd = await open11(temporary, "wx", 384);
26878
27067
  try {
26879
27068
  await fd.writeFile(body);
26880
27069
  await fd.sync();
26881
27070
  } finally {
26882
27071
  await fd.close();
26883
27072
  }
26884
- await rename7(temporary, file);
26885
- const dir = await open10(path18.dirname(file), "r");
27073
+ await rename8(temporary, file);
27074
+ const dir = await open11(path19.dirname(file), "r");
26886
27075
  try {
26887
27076
  await dir.sync();
26888
27077
  } finally {
@@ -26895,15 +27084,15 @@ async function atomicText(file, body) {
26895
27084
  async function verifyVersion(root, record2) {
26896
27085
  const directory3 = await info3(root);
26897
27086
  if (!directory3?.isDirectory() || directory3.isSymbolicLink() || directory3.uid !== process.getuid?.() || directory3.mode & 63) fail6("claude_installed_files_invalid");
26898
- const marker = await privateRead4(path18.join(root, "installation.json")), payload = await inspectRuntimePackage(root);
26899
- 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 || !path18.isAbsolute(marker.nodeCommand ?? "")) fail6("claude_installed_files_invalid");
27087
+ const marker = await privateRead5(path19.join(root, "installation.json")), payload = await inspectRuntimePackage(root);
27088
+ 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 || !path19.isAbsolute(marker.nodeCommand ?? "")) fail6("claude_installed_files_invalid");
26900
27089
  return marker;
26901
27090
  }
26902
27091
  function mcpDefinition(record2, nodeCommand) {
26903
27092
  return {
26904
27093
  type: "stdio",
26905
27094
  command: nodeCommand,
26906
- args: [path18.join(record2.versionRoot, "bin/promptframe-creation.mjs"), "bridge", "--config", record2.configFile, "--host", "claude-code"]
27095
+ args: [path19.join(record2.versionRoot, "bin/promptframe-creation.mjs"), "bridge", "--config", record2.configFile, "--host", "claude-code"]
26907
27096
  };
26908
27097
  }
26909
27098
  function skillBody(payload, sourceName, name) {
@@ -26919,14 +27108,14 @@ async function observedSkill(plan, record2, { allowBefore = false } = {}) {
26919
27108
  if (!directory3.isDirectory() || directory3.isSymbolicLink() || directory3.uid !== process.getuid?.() || directory3.mode & 63) fail6("claude_skill_requires_review");
26920
27109
  const names = await readdir6(plan.root);
26921
27110
  if (names.some((n) => !["SKILL.md", "promptframe-installation.json"].includes(n))) fail6("claude_skill_requires_review");
26922
- const marker = await privateRead4(path18.join(plan.root, "promptframe-installation.json")), file = path18.join(plan.root, "SKILL.md"), s3 = await info3(file);
27111
+ const marker = await privateRead5(path19.join(plan.root, "promptframe-installation.json")), file = path19.join(plan.root, "SKILL.md"), s3 = await info3(file);
26923
27112
  if (!marker || marker.host !== "claude-code" || marker.profile !== record2.profile || marker.configFile !== record2.configFile || marker.name !== plan.name)
26924
27113
  fail6("claude_skill_requires_review");
26925
27114
  if (!s3 && allowBefore && plan.beforeSHA === null && marker.sha256 === null) return false;
26926
27115
  if (!s3?.isFile() || s3.isSymbolicLink() || s3.size > 256 * 1024) fail6("claude_skill_requires_review");
26927
- const digest5 = hash6(await readFile8(file));
26928
- if (digest5 === plan.sha256 && marker.sha256 === plan.sha256) return true;
26929
- if (allowBefore && (digest5 === plan.beforeSHA || digest5 === plan.sha256) && marker.sha256 === plan.beforeSHA) return false;
27116
+ const digest6 = hash6(await readFile8(file));
27117
+ if (digest6 === plan.sha256 && marker.sha256 === plan.sha256) return true;
27118
+ if (allowBefore && (digest6 === plan.beforeSHA || digest6 === plan.sha256) && marker.sha256 === plan.beforeSHA) return false;
26930
27119
  fail6("claude_skill_requires_review");
26931
27120
  }
26932
27121
  async function installClaudeMcpFallback({
@@ -26941,17 +27130,17 @@ async function installClaudeMcpFallback({
26941
27130
  nodeCommand,
26942
27131
  writeSkill = atomicText
26943
27132
  }) {
26944
- const payload = await inspectRuntimePackage(path18.resolve(sourceRoot)), suffix = profile === "default" ? "" : "-" + profile, serverName = "promptframe" + suffix, root = path18.resolve(env.XDG_DATA_HOME ?? path18.join(homedir9(), ".local/share"), "promptframe-creation", profile, "claude-code-mcp");
26945
- await privateDirectory5(root);
26946
- const release = await acquire3(root, signal), versions = path18.join(root, "versions"), currentFile = path18.join(root, "current.json"), pendingFile = path18.join(root, "registration-pending.json"), versionRoot = path18.join(versions, payload.version), temporary = path18.join(versions, ".partial-" + randomBytes6(12).toString("hex"));
27133
+ const payload = await inspectRuntimePackage(path19.resolve(sourceRoot)), suffix = profile === "default" ? "" : "-" + profile, serverName = "promptframe" + suffix, root = path19.resolve(env.XDG_DATA_HOME ?? path19.join(homedir10(), ".local/share"), "promptframe-creation", profile, "claude-code-mcp");
27134
+ await privateDirectory6(root);
27135
+ const release = await acquire3(root, signal), versions = path19.join(root, "versions"), currentFile = path19.join(root, "current.json"), pendingFile = path19.join(root, "registration-pending.json"), versionRoot = path19.join(versions, payload.version), temporary = path19.join(versions, ".partial-" + randomBytes7(12).toString("hex"));
26947
27136
  let writeStarted = false, newFiles = 0;
26948
27137
  const complete = { host: "claude-code", mode: "mcp-and-skills", profile, configFile: configFile2, serverName, version: payload.version, versionRoot, payloadDigest: payload.payloadDigest };
26949
27138
  const checkBinding = (record2) => {
26950
- 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 !== path18.join(versions, record2.version))) fail6("profile_binding_conflict");
27139
+ 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 !== path19.join(versions, record2.version))) fail6("profile_binding_conflict");
26951
27140
  };
26952
27141
  try {
26953
- await privateDirectory5(versions);
26954
- let previous = await privateRead4(currentFile), pending = await privateRead4(pendingFile);
27142
+ await privateDirectory6(versions);
27143
+ let previous = await privateRead5(currentFile), pending = await privateRead5(pendingFile);
26955
27144
  checkBinding(previous);
26956
27145
  checkBinding(pending);
26957
27146
  let saved = await readClaudeUserServer(serverName, env);
@@ -26964,7 +27153,7 @@ async function installClaudeMcpFallback({
26964
27153
  if (!Array.isArray(record2.skills) || record2.skills.length !== 2) fail6("claude_skill_requires_review");
26965
27154
  for (const [i, skill] of record2.skills.entries()) {
26966
27155
  const name = ["creation-setup", "video-creation"][i] + suffix;
26967
- if (skill.name !== name || skill.root !== path18.join(claudeConfigRoot(env), "skills", name) || !/^[a-f0-9]{64}$/.test(skill.sha256 ?? ""))
27156
+ if (skill.name !== name || skill.root !== path19.join(claudeConfigRoot(env), "skills", name) || !/^[a-f0-9]{64}$/.test(skill.sha256 ?? ""))
26968
27157
  fail6("claude_skill_requires_review");
26969
27158
  if (!await observedSkill(skill, record2)) return false;
26970
27159
  }
@@ -27004,12 +27193,12 @@ async function installClaudeMcpFallback({
27004
27193
  } else if (saved && !pending) fail6("legacy_mcp_entry_requires_review");
27005
27194
  if (await info3(versionRoot)) await verifyVersion(versionRoot, complete);
27006
27195
  else {
27007
- await mkdir7(temporary, { mode: 448 });
27196
+ await mkdir8(temporary, { mode: 448 });
27008
27197
  for (const file of payload.files) {
27009
27198
  signal?.throwIfAborted();
27010
- const dest = path18.join(temporary, file.path);
27011
- await mkdir7(path18.dirname(dest), { recursive: true, mode: 448 });
27012
- const fd = await open10(dest, "wx", 384);
27199
+ const dest = path19.join(temporary, file.path);
27200
+ await mkdir8(path19.dirname(dest), { recursive: true, mode: 448 });
27201
+ const fd = await open11(dest, "wx", 384);
27013
27202
  try {
27014
27203
  await fd.writeFile(file.body);
27015
27204
  await fd.sync();
@@ -27018,21 +27207,21 @@ async function installClaudeMcpFallback({
27018
27207
  }
27019
27208
  }
27020
27209
  await checkRuntime(temporary, payload.version);
27021
- await atomicJSON3(path18.join(temporary, "installation.json"), { ...complete, nodeCommand });
27210
+ await atomicJSON3(path19.join(temporary, "installation.json"), { ...complete, nodeCommand });
27022
27211
  signal?.throwIfAborted();
27023
- await rename7(temporary, versionRoot);
27212
+ await rename8(temporary, versionRoot);
27024
27213
  newFiles = payload.files.length;
27025
27214
  }
27026
27215
  const ready = await verifyVersion(versionRoot, complete);
27027
27216
  complete.server = mcpDefinition(complete, ready.nodeCommand);
27028
27217
  if (newFiles === 0) await verifyInstalledRuntime(versionRoot, payload.version, ready.nodeCommand, { env });
27029
- const skillRoot = path18.join(claudeConfigRoot(env), "skills");
27030
- await mkdir7(skillRoot, { recursive: true, mode: 448 });
27031
- const parent = await lstat11(skillRoot);
27218
+ const skillRoot = path19.join(claudeConfigRoot(env), "skills");
27219
+ await mkdir8(skillRoot, { recursive: true, mode: 448 });
27220
+ const parent = await lstat12(skillRoot);
27032
27221
  if (!parent.isDirectory() || parent.isSymbolicLink() || parent.uid !== process.getuid?.()) fail6("claude_skill_requires_review");
27033
27222
  const plans = [];
27034
27223
  for (const sourceName of ["creation-setup", "video-creation"]) {
27035
- const name = sourceName + suffix, body = skillBody(payload, sourceName, name), skill = { name, root: path18.join(skillRoot, name), sha256: hash6(body) };
27224
+ const name = sourceName + suffix, body = skillBody(payload, sourceName, name), skill = { name, root: path19.join(skillRoot, name), sha256: hash6(body) };
27036
27225
  if (pending) {
27037
27226
  const old = pending.skills?.find((s3) => s3.name === name);
27038
27227
  if (!old || old.root !== skill.root || old.sha256 !== skill.sha256) fail6("registration_unconfirmed_keep_existing");
@@ -27041,7 +27230,7 @@ async function installClaudeMcpFallback({
27041
27230
  const existing = await info3(skill.root);
27042
27231
  let beforeSHA = null;
27043
27232
  if (existing) {
27044
- const marker = await privateRead4(path18.join(skill.root, "promptframe-installation.json"));
27233
+ const marker = await privateRead5(path19.join(skill.root, "promptframe-installation.json"));
27045
27234
  if (!marker || marker.profile !== profile || marker.configFile !== configFile2 || marker.name !== name) fail6("claude_skill_requires_review");
27046
27235
  const old = { ...skill, sha256: marker.sha256 };
27047
27236
  if (!await observedSkill(old, complete)) fail6("claude_skill_requires_review");
@@ -27062,10 +27251,10 @@ async function installClaudeMcpFallback({
27062
27251
  } else {
27063
27252
  if (plan.beforeSHA !== null) fail6("claude_skill_requires_review");
27064
27253
  await claimSkillDirectory(plan.root);
27065
- await atomicJSON3(path18.join(plan.root, "promptframe-installation.json"), { host: "claude-code", profile, configFile: configFile2, name: plan.name, sha256: null });
27254
+ await atomicJSON3(path19.join(plan.root, "promptframe-installation.json"), { host: "claude-code", profile, configFile: configFile2, name: plan.name, sha256: null });
27066
27255
  }
27067
- await writeSkill(path18.join(plan.root, "SKILL.md"), plan.body);
27068
- await atomicJSON3(path18.join(plan.root, "promptframe-installation.json"), { host: "claude-code", profile, configFile: configFile2, name: plan.name, sha256: plan.sha256 });
27256
+ await writeSkill(path19.join(plan.root, "SKILL.md"), plan.body);
27257
+ await atomicJSON3(path19.join(plan.root, "promptframe-installation.json"), { host: "claude-code", profile, configFile: configFile2, name: plan.name, sha256: plan.sha256 });
27069
27258
  }
27070
27259
  signal?.throwIfAborted();
27071
27260
  if (compareVersions2(payload.version, "0.3.1") >= 0) complete.hostHooks = await registerClaudeFallbackHooks({ record: complete, root, env, nodeCommand: ready.nodeCommand, signal });
@@ -27090,9 +27279,9 @@ async function installClaudeMcpFallback({
27090
27279
  requestedVersion: payload.version,
27091
27280
  versionStatus: "current"
27092
27281
  };
27093
- } catch (error5) {
27282
+ } catch (error6) {
27094
27283
  if (writeStarted) fail6("registration_unconfirmed_keep_existing", { phase: "registration_observation", localRegistrationState: "unknown", action: "inspect_same_registration_no_second_add" });
27095
- if (error5 instanceof CreationClientError) throw error5;
27284
+ if (error6 instanceof CreationClientError) throw error6;
27096
27285
  fail6(signal?.aborted ? "interrupted_keep_existing" : "failed_keep_existing");
27097
27286
  } finally {
27098
27287
  await rm4(temporary, { recursive: true, force: true });
@@ -27101,7 +27290,7 @@ async function installClaudeMcpFallback({
27101
27290
  }
27102
27291
 
27103
27292
  // lib/claude-installation.mjs
27104
- var { info: info4, privateDirectory: privateDirectory6, privateRead: privateRead5, atomicJSON: atomicJSON4, acquire: acquire4, runNode: runNode2, checkInstalledRuntime: checkInstalledRuntime2, compareVersions: compareVersions3, validProfile: validProfile2 } = installationFiles;
27293
+ var { info: info4, privateDirectory: privateDirectory7, privateRead: privateRead6, atomicJSON: atomicJSON4, acquire: acquire4, runNode: runNode2, checkInstalledRuntime: checkInstalledRuntime2, compareVersions: compareVersions3, validProfile: validProfile2 } = installationFiles;
27105
27294
  var effectiveRoot = (plugin) => plugin.readFromFolder ?? plugin.installPath;
27106
27295
  var effectiveVersion = (plugin) => plugin.readFromFolder !== void 0 ? plugin.folderVersion : plugin.version;
27107
27296
  var ClaudeInstallationError = class extends CreationClientError {
@@ -27110,7 +27299,7 @@ var ClaudeInstallationError = class extends CreationClientError {
27110
27299
  this.details = details;
27111
27300
  }
27112
27301
  };
27113
- var claudeInstallationDetails = (error5) => error5 instanceof ClaudeInstallationError ? error5.details : void 0;
27302
+ var claudeInstallationDetails = (error6) => error6 instanceof ClaudeInstallationError ? error6.details : void 0;
27114
27303
  var fail7 = (code, details) => {
27115
27304
  throw new ClaudeInstallationError(code, details);
27116
27305
  };
@@ -27134,7 +27323,7 @@ async function registrations(run, pluginName, marketplace, root) {
27134
27323
  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"))
27135
27324
  fail7("claude_local_registration_unconfirmed");
27136
27325
  const related = plugins.filter((p2) => typeof p2?.id === "string" && p2.id.startsWith(pluginName + "@"));
27137
- if (related.length > 1 || related.some((p2) => p2.id !== pluginName + "@" + marketplace || p2.scope !== "user" || typeof p2.enabled !== "boolean" || !/^\d+\.\d+\.\d+$/.test(p2.version ?? "") || !path19.isAbsolute(p2.installPath ?? "") || p2.readFromFolder !== void 0 && (!path19.isAbsolute(p2.readFromFolder) || !/^\d+\.\d+\.\d+$/.test(p2.folderVersion ?? ""))))
27326
+ if (related.length > 1 || related.some((p2) => p2.id !== pluginName + "@" + marketplace || p2.scope !== "user" || typeof p2.enabled !== "boolean" || !/^\d+\.\d+\.\d+$/.test(p2.version ?? "") || !path20.isAbsolute(p2.installPath ?? "") || p2.readFromFolder !== void 0 && (!path20.isAbsolute(p2.readFromFolder) || !/^\d+\.\d+\.\d+$/.test(p2.folderVersion ?? ""))))
27138
27327
  fail7("claude_existing_registration_requires_review");
27139
27328
  const found = markets.filter((p2) => p2?.name === marketplace);
27140
27329
  if (found.length > 1 || found.some((p2) => p2.source !== "directory" || p2.path !== root || p2.installLocation !== root))
@@ -27154,19 +27343,19 @@ async function verifyVersion2(root, { version: version3, profile, configFile: co
27154
27343
  const directory3 = await info4(root);
27155
27344
  if (!directory3?.isDirectory() || directory3.isSymbolicLink() || directory3.uid !== process.getuid?.() || directory3.mode & 63)
27156
27345
  fail7("claude_installed_files_invalid");
27157
- const ready = await privateRead5(path19.join(root, "installation.json"));
27346
+ const ready = await privateRead6(path20.join(root, "installation.json"));
27158
27347
  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");
27159
27348
  const actual = await inspectRuntimePackage(root);
27160
- if (actual.version !== version3 || JSON.stringify(actual.files.map(({ path: path21, bytes: bytes2, sha256 }) => ({ path: path21, bytes: bytes2, sha256 }))) !== JSON.stringify(ready.files))
27349
+ if (actual.version !== version3 || JSON.stringify(actual.files.map(({ path: path23, bytes: bytes2, sha256 }) => ({ path: path23, bytes: bytes2, sha256 }))) !== JSON.stringify(ready.files))
27161
27350
  fail7("claude_installed_files_invalid");
27162
- const manifest = JSON.parse(await readFile9(path19.join(root, ".claude-plugin/plugin.json"), "utf8"));
27351
+ const manifest = JSON.parse(await readFile9(path20.join(root, ".claude-plugin/plugin.json"), "utf8"));
27163
27352
  if (manifest.name !== pluginName || manifest.version !== version3 || manifest.skills !== "./skills/" || manifest.mcpServers !== "./.claude-mcp.json")
27164
27353
  fail7("claude_installed_files_invalid");
27165
27354
  let runtimeCommand;
27166
27355
  for (const file of [".mcp.json", ".claude-mcp.json"]) {
27167
- const mcp = JSON.parse(await readFile9(path19.join(root, file), "utf8"));
27356
+ const mcp = JSON.parse(await readFile9(path20.join(root, file), "utf8"));
27168
27357
  const command2 = mcp.mcpServers?.[serverName]?.command;
27169
- if (!path19.isAbsolute(command2 ?? "") || runtimeCommand !== void 0 && command2 !== runtimeCommand || JSON.stringify(mcp) !== JSON.stringify(transport(serverName, configFile2, command2))) fail7("claude_installed_files_invalid");
27358
+ if (!path20.isAbsolute(command2 ?? "") || runtimeCommand !== void 0 && command2 !== runtimeCommand || JSON.stringify(mcp) !== JSON.stringify(transport(serverName, configFile2, command2))) fail7("claude_installed_files_invalid");
27170
27359
  runtimeCommand = command2;
27171
27360
  }
27172
27361
  if (compareVersions3(version3, "0.3.1") >= 0 && JSON.stringify(manifest.hooks) !== JSON.stringify(claudeHostHooks({ pluginName, configFile: configFile2, nodeCommand: runtimeCommand })))
@@ -27176,8 +27365,8 @@ async function verifyVersion2(root, { version: version3, profile, configFile: co
27176
27365
  async function installForClaudeUser(options = {}) {
27177
27366
  const profile = options.profile ?? "default", env = options.env ?? process.env;
27178
27367
  validProfile2(profile);
27179
- const modeRoot = path19.resolve(env.XDG_DATA_HOME ?? path19.join(homedir10(), ".local/share"), "promptframe-creation", profile, "claude-code-mode");
27180
- await privateDirectory6(modeRoot);
27368
+ const modeRoot = path20.resolve(env.XDG_DATA_HOME ?? path20.join(homedir11(), ".local/share"), "promptframe-creation", profile, "claude-code-mode");
27369
+ await privateDirectory7(modeRoot);
27181
27370
  const release = await acquire4(modeRoot, options.signal);
27182
27371
  try {
27183
27372
  return await installClaudeUserLocked(options);
@@ -27198,37 +27387,37 @@ async function installClaudeUserLocked({
27198
27387
  nodeCommand = process.execPath
27199
27388
  } = {}) {
27200
27389
  validProfile2(profile);
27201
- if (!path19.isAbsolute(nodeCommand)) fail7("runtime_command_invalid");
27390
+ if (!path20.isAbsolute(nodeCommand)) fail7("runtime_command_invalid");
27202
27391
  const hostVersion = (await runClaude(["--version"])).trim().match(/^(\d+\.\d+\.\d+) \(Claude Code\)$/);
27203
27392
  if (!hostVersion || compareVersions3(hostVersion[1], "2.1.295") < 0) fail7("claude_21295_required");
27204
27393
  const help = await runClaude(["--help"]);
27205
27394
  if (typeof help !== "string" || Buffer.byteLength(help) > 128 * 1024) fail7("claude_capabilities_unconfirmed");
27206
27395
  const hasPlugin = /^\s+plugin(?:\|plugins)?\s/m.test(help), hasMcp = /^\s+mcp\s/m.test(help);
27207
- const base = path19.resolve(env.XDG_DATA_HOME ?? path19.join(homedir10(), ".local/share"), "promptframe-creation", profile), fallbackRoot = path19.join(base, "claude-code-mcp"), pluginRoot = path19.join(base, "claude-code");
27208
- const pluginPending = await info4(path19.join(pluginRoot, "registration-pending.json")), pluginCurrent = await info4(path19.join(pluginRoot, "current.json")), fallbackState = await info4(path19.join(fallbackRoot, "current.json")) || await info4(path19.join(fallbackRoot, "registration-pending.json"));
27396
+ const base = path20.resolve(env.XDG_DATA_HOME ?? path20.join(homedir11(), ".local/share"), "promptframe-creation", profile), fallbackRoot = path20.join(base, "claude-code-mcp"), pluginRoot = path20.join(base, "claude-code");
27397
+ const pluginPending = await info4(path20.join(pluginRoot, "registration-pending.json")), pluginCurrent = await info4(path20.join(pluginRoot, "current.json")), fallbackState = await info4(path20.join(fallbackRoot, "current.json")) || await info4(path20.join(fallbackRoot, "registration-pending.json"));
27209
27398
  if ((!hasPlugin || fallbackState) && (pluginPending || pluginCurrent)) fail7("registration_unconfirmed_keep_existing");
27210
27399
  if (!hasPlugin || fallbackState) {
27211
27400
  if (!hasMcp) fail7("claude_capabilities_unconfirmed");
27212
27401
  return installClaudeMcpFallback({ sourceRoot, profile, env, configFile: configFile2, signal, runClaude, checkRuntime, verifyInstalledRuntime, nodeCommand });
27213
27402
  }
27214
- const payload = await inspectRuntimePackage(path19.resolve(sourceRoot));
27403
+ const payload = await inspectRuntimePackage(path20.resolve(sourceRoot));
27215
27404
  if (!payload.files.some((f2) => f2.path === ".claude-plugin/plugin.json") || !payload.files.some((f2) => f2.path === ".claude-mcp.json"))
27216
27405
  fail7("claude_package_incomplete");
27217
- const root = path19.resolve(env.XDG_DATA_HOME ?? path19.join(homedir10(), ".local/share"), "promptframe-creation", profile, "claude-code");
27218
- await privateDirectory6(root);
27406
+ const root = path20.resolve(env.XDG_DATA_HOME ?? path20.join(homedir11(), ".local/share"), "promptframe-creation", profile, "claude-code");
27407
+ await privateDirectory7(root);
27219
27408
  const release = await acquire4(root, signal);
27220
27409
  const suffix = profile === "default" ? "" : "-" + profile, pluginName = "promptframe-creation" + suffix, marketplace = "promptframe-creation-user" + suffix, pluginId = pluginName + "@" + marketplace, serverName = "promptframe" + suffix;
27221
- const versions = path19.join(root, "versions"), currentFile = path19.join(root, "current.json"), pendingFile = path19.join(root, "registration-pending.json"), catalogFile = path19.join(root, ".claude-plugin/marketplace.json"), versionRoot = path19.join(versions, payload.version), temporary = path19.join(versions, ".partial-" + randomBytes7(12).toString("hex"));
27410
+ const versions = path20.join(root, "versions"), currentFile = path20.join(root, "current.json"), pendingFile = path20.join(root, "registration-pending.json"), catalogFile = path20.join(root, ".claude-plugin/marketplace.json"), versionRoot = path20.join(versions, payload.version), temporary = path20.join(versions, ".partial-" + randomBytes8(12).toString("hex"));
27222
27411
  let registrationStarted = false, newFiles = 0;
27223
27412
  try {
27224
27413
  signal?.throwIfAborted();
27225
- await privateDirectory6(versions);
27226
- await privateDirectory6(path19.dirname(catalogFile));
27414
+ await privateDirectory7(versions);
27415
+ await privateDirectory7(path20.dirname(catalogFile));
27227
27416
  await legacyUserMcp(env, serverName);
27228
- let previous = await privateRead5(currentFile), pending = await privateRead5(pendingFile), state = await registrations(runClaude, pluginName, marketplace, root);
27417
+ let previous = await privateRead6(currentFile), pending = await privateRead6(pendingFile), state = await registrations(runClaude, pluginName, marketplace, root);
27229
27418
  const binding = { profile, configFile: configFile2, pluginId, pluginName, serverName, host: "claude-code" };
27230
27419
  const checkBinding = (record2) => {
27231
- if (record2 && (record2.profile !== profile || record2.configFile !== configFile2 || record2.pluginId !== pluginId || record2.host !== "claude-code" || !/^\d+\.\d+\.\d+$/.test(record2.version ?? "") || record2.versionRoot !== path19.join(versions, record2.version))) fail7("profile_binding_conflict");
27420
+ if (record2 && (record2.profile !== profile || record2.configFile !== configFile2 || record2.pluginId !== pluginId || record2.host !== "claude-code" || !/^\d+\.\d+\.\d+$/.test(record2.version ?? "") || record2.versionRoot !== path20.join(versions, record2.version))) fail7("profile_binding_conflict");
27232
27421
  };
27233
27422
  checkBinding(previous);
27234
27423
  checkBinding(pending);
@@ -27272,12 +27461,12 @@ async function installClaudeUserLocked({
27272
27461
  const ready = await verifyVersion2(versionRoot, { ...complete, pluginName, serverName });
27273
27462
  runtimeCommands.set(versionRoot, ready.runtimeCommand);
27274
27463
  } else {
27275
- await mkdir8(temporary, { mode: 448 });
27464
+ await mkdir9(temporary, { mode: 448 });
27276
27465
  for (const file of payload.files) {
27277
27466
  signal?.throwIfAborted();
27278
- const dest = path19.join(temporary, file.path);
27279
- await mkdir8(path19.dirname(dest), { recursive: true, mode: 448 });
27280
- const fd = await open11(dest, "wx", 384);
27467
+ const dest = path20.join(temporary, file.path);
27468
+ await mkdir9(path20.dirname(dest), { recursive: true, mode: 448 });
27469
+ const fd = await open12(dest, "wx", 384);
27281
27470
  try {
27282
27471
  await fd.writeFile(file.body);
27283
27472
  await fd.sync();
@@ -27285,21 +27474,21 @@ async function installClaudeUserLocked({
27285
27474
  await fd.close();
27286
27475
  }
27287
27476
  }
27288
- const manifest = JSON.parse(await readFile9(path19.join(temporary, ".claude-plugin/plugin.json"), "utf8"));
27477
+ const manifest = JSON.parse(await readFile9(path20.join(temporary, ".claude-plugin/plugin.json"), "utf8"));
27289
27478
  manifest.name = pluginName;
27290
27479
  if (manifest.hooks) manifest.hooks = claudeHostHooks({ pluginName, configFile: configFile2, nodeCommand });
27291
- await atomicJSON4(path19.join(temporary, ".claude-plugin/plugin.json"), manifest);
27292
- for (const file of [".mcp.json", ".claude-mcp.json"]) await atomicJSON4(path19.join(temporary, file), transport(serverName, configFile2, nodeCommand));
27480
+ await atomicJSON4(path20.join(temporary, ".claude-plugin/plugin.json"), manifest);
27481
+ for (const file of [".mcp.json", ".claude-mcp.json"]) await atomicJSON4(path20.join(temporary, file), transport(serverName, configFile2, nodeCommand));
27293
27482
  await checkRuntime(temporary, payload.version);
27294
27483
  const installed = await inspectRuntimePackage(temporary);
27295
- await atomicJSON4(path19.join(temporary, "installation.json"), {
27484
+ await atomicJSON4(path20.join(temporary, "installation.json"), {
27296
27485
  ...binding,
27297
27486
  version: payload.version,
27298
27487
  payloadDigest: payload.payloadDigest,
27299
- files: installed.files.map(({ path: path21, bytes: bytes2, sha256 }) => ({ path: path21, bytes: bytes2, sha256 }))
27488
+ files: installed.files.map(({ path: path23, bytes: bytes2, sha256 }) => ({ path: path23, bytes: bytes2, sha256 }))
27300
27489
  });
27301
27490
  signal?.throwIfAborted();
27302
- await rename8(temporary, versionRoot);
27491
+ await rename9(temporary, versionRoot);
27303
27492
  newFiles = payload.files.length;
27304
27493
  }
27305
27494
  if (newFiles === 0) await verifyInstalledRuntime(versionRoot, payload.version, runtimeCommands.get(versionRoot), { env });
@@ -27334,14 +27523,14 @@ async function installClaudeUserLocked({
27334
27523
  requestedVersion: payload.version,
27335
27524
  recordedRuntimeRetained: runtimeCommands.has(versionRoot) && runtimeCommands.get(versionRoot) !== nodeCommand
27336
27525
  };
27337
- } catch (error5) {
27526
+ } catch (error6) {
27338
27527
  if (registrationStarted) fail7("registration_unconfirmed_keep_existing", {
27339
- ...claudeErrorDetails(error5),
27528
+ ...claudeErrorDetails(error6),
27340
27529
  phase: "registration_observation",
27341
27530
  localRegistrationState: "unknown",
27342
27531
  action: "inspect_same_registration_no_second_add"
27343
27532
  });
27344
- if (error5 instanceof CreationClientError) throw error5;
27533
+ if (error6 instanceof CreationClientError) throw error6;
27345
27534
  fail7(signal?.aborted ? "interrupted_keep_existing" : "failed_keep_existing");
27346
27535
  } finally {
27347
27536
  await rm5(temporary, { recursive: true, force: true });
@@ -27349,9 +27538,240 @@ async function installClaudeUserLocked({
27349
27538
  }
27350
27539
  }
27351
27540
 
27541
+ // lib/antigravity-installation.mjs
27542
+ import { lstat as lstat13, mkdir as mkdir10, open as open13, readFile as readFile10, rename as rename10, rm as rm6 } from "node:fs/promises";
27543
+ import { createHash as createHash14, randomBytes as randomBytes9 } from "node:crypto";
27544
+ import { homedir as homedir12 } from "node:os";
27545
+ import path21 from "node:path";
27546
+ var hash7 = (b2) => createHash14("sha256").update(b2).digest("hex");
27547
+ var fail8 = (code) => {
27548
+ throw new CreationClientError("installation." + code);
27549
+ };
27550
+ var profileFormat = /^[a-z0-9][a-z0-9-]{0,39}$/;
27551
+ function shellQuote(value2) {
27552
+ return '"' + String(value2).replace(/(["\\$`])/g, "\\$1") + '"';
27553
+ }
27554
+ function antigravityPluginManifest({ version: version3, name = "promptframe-creation", displayName = "PromptFrame Creation" }) {
27555
+ return {
27556
+ name,
27557
+ displayName,
27558
+ description: "PromptFrame video creation Skill and MCP bridge for Antigravity: inspect projects, plan shots, search/author components, preview and render videos.",
27559
+ version: version3,
27560
+ repository: "https://github.com/ty-teams/promptframe-creation",
27561
+ suggestedPrompts: [
27562
+ "\u5217\u51FA\u6211\u5728 PromptFrame \u5F53\u524D\u9879\u76EE\u4E2D\u7684\u4F5C\u54C1\u5E76\u8BFB\u53D6\u6700\u65B0\u72B6\u6001",
27563
+ "\u5E2E\u6211\u5728 PromptFrame \u4E2D\u89C4\u5212\u5E76\u521B\u5EFA\u4E00\u4E2A\u65B0\u7684\u79D1\u666E\u89C6\u9891\u5206\u955C",
27564
+ "\u5728\u7EC4\u4EF6\u5E02\u573A\u641C\u7D22\u9002\u5408\u6570\u636E\u5BF9\u6BD4\u5C55\u793A\u7684\u53EF\u89C6\u5316\u7EC4\u4EF6"
27565
+ ]
27566
+ };
27567
+ }
27568
+ function antigravityMcpConfig({ serverName, nodeCommand, runtimeRoot, configFile: configFile2 }) {
27569
+ return {
27570
+ mcpServers: {
27571
+ [serverName]: {
27572
+ command: nodeCommand,
27573
+ args: [path21.join(runtimeRoot, "bin", "promptframe-creation.mjs"), "bridge", "--config", configFile2, "--host", "antigravity"]
27574
+ }
27575
+ }
27576
+ };
27577
+ }
27578
+ function antigravityHooksConfig({ nodeCommand, runtimeRoot, configFile: configFile2 }) {
27579
+ const cliPath = path21.join(runtimeRoot, "bin", "promptframe-creation.mjs");
27580
+ const command2 = [shellQuote(nodeCommand), shellQuote(cliPath), "antigravity-host-hook", "--config", shellQuote(configFile2)].join(" ");
27581
+ return {
27582
+ "promptframe-host-identity": {
27583
+ PreToolUse: [
27584
+ {
27585
+ matcher: "(.*promptframe.*|^platform_.*)",
27586
+ hooks: [{ type: "command", command: command2, timeout: 5 }]
27587
+ }
27588
+ ]
27589
+ }
27590
+ };
27591
+ }
27592
+ async function readJsonOrNull(file) {
27593
+ try {
27594
+ return JSON.parse(await readFile10(file, "utf8"));
27595
+ } catch (e) {
27596
+ if (e.code === "ENOENT") return null;
27597
+ throw e;
27598
+ }
27599
+ }
27600
+ async function writeFileAtomic(file, content, mode = 384) {
27601
+ await mkdir10(path21.dirname(file), { recursive: true, mode: 448 });
27602
+ const tmp = file + "." + randomBytes9(8).toString("hex") + ".partial";
27603
+ const fd = await open13(tmp, "wx", mode);
27604
+ try {
27605
+ await fd.writeFile(content);
27606
+ await fd.sync();
27607
+ } finally {
27608
+ await fd.close();
27609
+ }
27610
+ await rename10(tmp, file);
27611
+ }
27612
+ async function copyPackagePayload(payload, destRoot) {
27613
+ const tmp = destRoot + ".partial-" + randomBytes9(8).toString("hex");
27614
+ await mkdir10(tmp, { recursive: true, mode: 448 });
27615
+ try {
27616
+ for (const file of payload.files) {
27617
+ const dest = path21.join(tmp, ...file.path.split("/"));
27618
+ await mkdir10(path21.dirname(dest), { recursive: true, mode: 448 });
27619
+ const fd = await open13(dest, "wx", 384);
27620
+ try {
27621
+ await fd.writeFile(file.body);
27622
+ await fd.sync();
27623
+ } finally {
27624
+ await fd.close();
27625
+ }
27626
+ }
27627
+ await rename10(tmp, destRoot);
27628
+ } catch (e) {
27629
+ await rm6(tmp, { recursive: true, force: true }).catch(() => {
27630
+ });
27631
+ throw e;
27632
+ }
27633
+ }
27634
+ async function installForAntigravityUser({
27635
+ sourceRoot,
27636
+ profile = "default",
27637
+ configFile: configFile2,
27638
+ env = process.env,
27639
+ nodeCommand = process.execPath,
27640
+ signal
27641
+ } = {}) {
27642
+ if (!profileFormat.test(profile)) fail8("profile_invalid");
27643
+ if (!path21.isAbsolute(configFile2 ?? "")) fail8("config_path_invalid");
27644
+ signal?.throwIfAborted();
27645
+ const payload = await inspectRuntimePackage(sourceRoot);
27646
+ const suffix = profile === "default" ? "" : "-" + profile;
27647
+ const pluginDirName = "promptframe-creation" + suffix;
27648
+ const serverName = "promptframe-creation" + suffix;
27649
+ const dataRoot = path21.resolve(env.XDG_DATA_HOME ?? path21.join(homedir12(), ".local", "share"), "promptframe-creation", profile, "antigravity");
27650
+ const versionRoot = path21.join(dataRoot, "versions", payload.version);
27651
+ const pluginsRoot = path21.join(antigravityConfigRoot(env), "plugins");
27652
+ const pluginDir = path21.join(pluginsRoot, pluginDirName);
27653
+ const markerFile = path21.join(pluginDir, "promptframe-installation.json");
27654
+ let pluginDirectoryExists = false;
27655
+ try {
27656
+ const status = await lstat13(pluginDir);
27657
+ if (!status.isDirectory() || status.isSymbolicLink()) fail8("managed_installation_invalid");
27658
+ pluginDirectoryExists = true;
27659
+ } catch (error6) {
27660
+ if (error6.code !== "ENOENT") throw error6;
27661
+ }
27662
+ const existing = await readJsonOrNull(markerFile);
27663
+ if (pluginDirectoryExists && !existing) fail8("managed_installation_invalid");
27664
+ if (existing) {
27665
+ if (existing.host !== "antigravity" || existing.profile !== profile || existing.configFile !== configFile2 || typeof existing.version !== "string" || !/^\d+\.\d+\.\d+$/.test(existing.version)) fail8("managed_installation_invalid");
27666
+ const cmp = compareBridgeVersions(existing.version, payload.version);
27667
+ if (cmp > 0) {
27668
+ return {
27669
+ registered: true,
27670
+ pluginInstalled: true,
27671
+ pluginEnabled: true,
27672
+ reused: true,
27673
+ host: "antigravity",
27674
+ installationMode: "antigravity-plugin",
27675
+ profile,
27676
+ version: existing.version,
27677
+ requestedVersion: payload.version,
27678
+ versionStatus: "newer_installed_kept",
27679
+ recordedRuntimeRetained: true,
27680
+ pluginDir,
27681
+ serverName,
27682
+ skillsInstalled: true,
27683
+ skills: [{ name: "creation-setup" }, { name: "video-creation" }]
27684
+ };
27685
+ }
27686
+ if (cmp === 0 && existing.payloadDigest === payload.payloadDigest && existing.versionRoot === versionRoot) {
27687
+ return {
27688
+ registered: true,
27689
+ pluginInstalled: true,
27690
+ pluginEnabled: true,
27691
+ reused: true,
27692
+ host: "antigravity",
27693
+ installationMode: "antigravity-plugin",
27694
+ profile,
27695
+ version: payload.version,
27696
+ requestedVersion: payload.version,
27697
+ versionStatus: "already_current",
27698
+ recordedRuntimeRetained: false,
27699
+ pluginDir,
27700
+ serverName,
27701
+ skillsInstalled: true,
27702
+ skills: [{ name: "creation-setup" }, { name: "video-creation" }]
27703
+ };
27704
+ }
27705
+ }
27706
+ let versionExists = false;
27707
+ try {
27708
+ const s3 = await lstat13(versionRoot);
27709
+ versionExists = s3.isDirectory() && !s3.isSymbolicLink();
27710
+ } catch (e) {
27711
+ if (e.code !== "ENOENT") throw e;
27712
+ }
27713
+ if (!versionExists) {
27714
+ await mkdir10(path21.dirname(versionRoot), { recursive: true, mode: 448 });
27715
+ await copyPackagePayload(payload, versionRoot);
27716
+ }
27717
+ signal?.throwIfAborted();
27718
+ if (!existing) {
27719
+ await mkdir10(pluginsRoot, { recursive: true, mode: 448 });
27720
+ await mkdir10(pluginDir, { mode: 448 });
27721
+ }
27722
+ const pluginJson = JSON.stringify(antigravityPluginManifest({
27723
+ version: payload.version,
27724
+ name: pluginDirName,
27725
+ displayName: profile === "default" ? "PromptFrame Creation" : "PromptFrame Creation (" + profile + ")"
27726
+ }), null, 2) + "\n";
27727
+ const mcpJson = JSON.stringify(antigravityMcpConfig({ serverName, nodeCommand, runtimeRoot: versionRoot, configFile: configFile2 }), null, 2) + "\n";
27728
+ const hooksJson = JSON.stringify(antigravityHooksConfig({ nodeCommand, runtimeRoot: versionRoot, configFile: configFile2 }), null, 2) + "\n";
27729
+ await writeFileAtomic(path21.join(pluginDir, "plugin.json"), pluginJson, 420);
27730
+ await writeFileAtomic(path21.join(pluginDir, "mcp_config.json"), mcpJson, 384);
27731
+ await writeFileAtomic(path21.join(pluginDir, "hooks.json"), hooksJson, 384);
27732
+ const skillEntries = payload.files.filter((f2) => f2.path.startsWith("skills/") && f2.path.endsWith("/SKILL.md"));
27733
+ for (const skill of skillEntries) {
27734
+ const dest = path21.join(pluginDir, ...skill.path.split("/"));
27735
+ await writeFileAtomic(dest, skill.body, 420);
27736
+ }
27737
+ const record2 = {
27738
+ contractVersion: "antigravity-plugin-installation/v1",
27739
+ host: "antigravity",
27740
+ profile,
27741
+ configFile: configFile2,
27742
+ pluginDirName,
27743
+ serverName,
27744
+ version: payload.version,
27745
+ versionRoot,
27746
+ nodeCommand,
27747
+ payloadDigest: payload.payloadDigest,
27748
+ mcpDigest: hash7(mcpJson),
27749
+ hooksDigest: hash7(hooksJson),
27750
+ installedAt: (/* @__PURE__ */ new Date()).toISOString()
27751
+ };
27752
+ await writeFileAtomic(markerFile, JSON.stringify(record2, null, 2) + "\n", 384);
27753
+ return {
27754
+ registered: true,
27755
+ pluginInstalled: true,
27756
+ pluginEnabled: true,
27757
+ reused: false,
27758
+ host: "antigravity",
27759
+ installationMode: "antigravity-plugin",
27760
+ profile,
27761
+ version: payload.version,
27762
+ requestedVersion: payload.version,
27763
+ versionStatus: existing ? "upgraded" : "installed",
27764
+ recordedRuntimeRetained: false,
27765
+ pluginDir,
27766
+ serverName,
27767
+ skillsInstalled: true,
27768
+ skills: skillEntries.map((s3) => ({ name: s3.path.split("/")[1] }))
27769
+ };
27770
+ }
27771
+
27352
27772
  // lib/cli.mjs
27353
27773
  import { fileURLToPath } from "node:url";
27354
- import path20 from "node:path";
27774
+ import path22 from "node:path";
27355
27775
  var args = process.argv.slice(2);
27356
27776
  var command = args.shift();
27357
27777
  var value = (key) => {
@@ -27359,7 +27779,7 @@ var value = (key) => {
27359
27779
  return i < 0 ? void 0 : args[i + 1];
27360
27780
  };
27361
27781
  var log = (value2) => process.stdout.write(JSON.stringify(value2) + "\n");
27362
- var configFile = () => value("--config") ? path20.resolve(value("--config")) : profileCredentialsPath(value("--profile") ?? "default");
27782
+ var configFile = () => value("--config") ? path22.resolve(value("--config")) : profileCredentialsPath(value("--profile") ?? "default");
27363
27783
  async function probe(credentials) {
27364
27784
  const client = await connectPlatform(credentials, { host: resolveHostIdentity({ host: value("--host") }), clientConfigFile: configFile() });
27365
27785
  try {
@@ -27380,8 +27800,8 @@ async function rememberAuthorization(credentials, file, accountIdentity) {
27380
27800
  profile: value("--profile") ?? "default"
27381
27801
  });
27382
27802
  return { status: "recorded" };
27383
- } catch (error5) {
27384
- return { status: "unavailable", reasonCode: error5 instanceof CreationClientError ? error5.message : "accounts.storage_unavailable" };
27803
+ } catch (error6) {
27804
+ return { status: "unavailable", reasonCode: error6 instanceof CreationClientError ? error6.message : "accounts.storage_unavailable" };
27385
27805
  }
27386
27806
  }
27387
27807
  async function tokenInput() {
@@ -27481,8 +27901,8 @@ async function setup({ silent = false } = {}) {
27481
27901
  version: 1,
27482
27902
  endpoint,
27483
27903
  token,
27484
- clientId: existing?.clientId ?? randomBytes8(24).toString("base64url"),
27485
- clientName: value("--name") ?? existing?.clientName ?? (resolveHostIdentity({ host: value("--host") }).kind === "claude-code" ? "Claude Code PromptFrame" : "Codex PromptFrame"),
27904
+ clientId: existing?.clientId ?? randomBytes10(24).toString("base64url"),
27905
+ clientName: value("--name") ?? existing?.clientName ?? hostClientName("Codex PromptFrame", resolveHostIdentity({ host: value("--host") })),
27486
27906
  createdAt: existing?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()
27487
27907
  };
27488
27908
  const { tools, accountIdentity } = await probe(credentials);
@@ -27518,14 +27938,14 @@ async function bridge() {
27518
27938
  resolvedVersion: value("--resolved-runtime-version"),
27519
27939
  signal: startup.signal,
27520
27940
  hostKind: identity.kind,
27521
- cacheRoot: path20.join(path20.dirname(configFile()), "runtime-cache")
27941
+ cacheRoot: path22.join(path22.dirname(configFile()), "runtime-cache")
27522
27942
  });
27523
27943
  startup.signal.throwIfAborted();
27524
- } catch (error5) {
27944
+ } catch (error6) {
27525
27945
  await client?.close().catch(() => {
27526
27946
  });
27527
27947
  if (startup.signal.aborted) throw new CreationClientError("creation.runtime_selection_interrupted");
27528
- throw error5;
27948
+ throw error6;
27529
27949
  } finally {
27530
27950
  process.removeListener("SIGINT", abort);
27531
27951
  process.removeListener("SIGTERM", abort);
@@ -27537,7 +27957,7 @@ async function bridge() {
27537
27957
  return;
27538
27958
  }
27539
27959
  await rememberAuthorization(credentials, configFile(), connectionAccountIdentity(client));
27540
- const hostSession = identity.kind === "claude-code" ? await createClaudeHostSession({ configFile: configFile() }) : void 0;
27960
+ const hostSession = identity.kind === "claude-code" ? await createClaudeHostSession({ configFile: configFile() }) : identity.kind === "antigravity" ? await createAntigravityHostSession({ configFile: configFile() }) : void 0;
27541
27961
  const server = new Server(
27542
27962
  { name: "promptframe-creation", version: CLIENT_VERSION },
27543
27963
  { capabilities: {
@@ -27557,9 +27977,9 @@ async function bridge() {
27557
27977
  hostSession,
27558
27978
  connectionOptions: { contentTypes: () => contentTypes, contentSource: () => contentSource },
27559
27979
  createLocalUploads: ({ identity: account, agent, configFile: file }) => createLocalUploadManager({
27560
- stateRoot: path20.join(path20.dirname(file), "local-upload-state", "accounts", localAccountKey(account), localAgentDigest(agent).slice(7))
27980
+ stateRoot: path22.join(path22.dirname(file), "local-upload-state", "accounts", localAccountKey(account), localAgentDigest(agent).slice(7))
27561
27981
  }),
27562
- localUploads: createLocalUploadManager({ stateRoot: path20.join(path20.dirname(configFile()), "local-upload-state") }),
27982
+ localUploads: createLocalUploadManager({ stateRoot: path22.join(path22.dirname(configFile()), "local-upload-state") }),
27563
27983
  onCatalogChange: () => server.sendToolListChanged(),
27564
27984
  onKnowledgeChange: (kind) => kind === "resources" ? server.sendResourceListChanged() : server.sendPromptListChanged()
27565
27985
  });
@@ -27574,11 +27994,11 @@ async function bridge() {
27574
27994
  const knowledgeHandler = (schema, method) => server.setRequestHandler(schema, async (request) => {
27575
27995
  try {
27576
27996
  return await host[method](request.params ?? {});
27577
- } catch (error5) {
27578
- const remote = error5?.data?.errorCode;
27579
- const code = error5 instanceof CreationClientError ? error5.message : typeof remote === "string" && /^(?:creation|creative_skill)\.[a-z0-9_.:-]{1,160}$/.test(remote) ? remote : "creation.connection_unresolved";
27580
- const knownRemote = typeof remote === "string" && code === remote && typeof error5.code === "number" && Object.values(ErrorCode).includes(error5.code);
27581
- throw new McpError(knownRemote ? error5.code : error5 instanceof CreationClientError ? ErrorCode.InvalidParams : ErrorCode.InternalError, code, { errorCode: code });
27997
+ } catch (error6) {
27998
+ const remote = error6?.data?.errorCode;
27999
+ const code = error6 instanceof CreationClientError ? error6.message : typeof remote === "string" && /^(?:creation|creative_skill)\.[a-z0-9_.:-]{1,160}$/.test(remote) ? remote : "creation.connection_unresolved";
28000
+ const knownRemote = typeof remote === "string" && code === remote && typeof error6.code === "number" && Object.values(ErrorCode).includes(error6.code);
28001
+ throw new McpError(knownRemote ? error6.code : error6 instanceof CreationClientError ? ErrorCode.InvalidParams : ErrorCode.InternalError, code, { errorCode: code });
27582
28002
  }
27583
28003
  });
27584
28004
  if (upstream.resources) {
@@ -27600,7 +28020,7 @@ async function bridge() {
27600
28020
  server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
27601
28021
  try {
27602
28022
  return await host.call(request.params, { signal: extra.signal });
27603
- } catch (error5) {
28023
+ } catch (error6) {
27604
28024
  return {
27605
28025
  isError: true,
27606
28026
  content: [
@@ -27608,9 +28028,9 @@ async function bridge() {
27608
28028
  type: "text",
27609
28029
  text: JSON.stringify({
27610
28030
  success: false,
27611
- errorCode: error5 instanceof CreationClientError ? error5.message : "creation.connection_unresolved",
27612
- ...error5 instanceof CreationClientError && error5.message === "creation.host_session_changed" ? { effectStatus: "unknown", automaticReplayAllowed: false } : {},
27613
- action: error5 instanceof CreationClientError ? error5.message === "creation.host_session_changed" ? "read_original_task_without_replaying_business" : error5.message.startsWith("creation.host_") ? "use_supported_host_with_session_identity" : error5.message === "creation.editor_not_current" ? "request_control_and_confirm_in_studio" : "read_current_platform_facts_without_replaying_business" : "read_original_task_or_retry_same_idempotency_key"
28031
+ errorCode: error6 instanceof CreationClientError ? error6.message : "creation.connection_unresolved",
28032
+ ...error6 instanceof CreationClientError && error6.message === "creation.host_session_changed" ? { effectStatus: "unknown", automaticReplayAllowed: false } : {},
28033
+ action: error6 instanceof CreationClientError ? error6.message === "creation.host_session_changed" ? "read_original_task_without_replaying_business" : error6.message.startsWith("creation.host_") ? "use_supported_host_with_session_identity" : error6.message === "creation.editor_not_current" ? "request_control_and_confirm_in_studio" : "read_current_platform_facts_without_replaying_business" : "read_original_task_or_retry_same_idempotency_key"
27614
28034
  })
27615
28035
  }
27616
28036
  ]
@@ -27647,7 +28067,8 @@ try {
27647
28067
  process.once("SIGINT", abort);
27648
28068
  process.once("SIGTERM", abort);
27649
28069
  try {
27650
- const host = resolveHostIdentity({ host: value("--host") }), installer = host.kind === "claude-code" ? installForClaudeUser : installForUser;
28070
+ const host = resolveHostIdentity({ host: value("--host") });
28071
+ const installer = host.kind === "claude-code" ? installForClaudeUser : host.kind === "antigravity" ? installForAntigravityUser : installForUser;
27651
28072
  const installed = await installer({
27652
28073
  sourceRoot: fileURLToPath(new URL("..", import.meta.url)),
27653
28074
  executable: value("--claude-bin"),
@@ -27656,6 +28077,7 @@ try {
27656
28077
  signal: signal.signal
27657
28078
  });
27658
28079
  const skillNames = installed.skills?.map((skill) => skill.name) ?? ["creation-setup", "video-creation"];
28080
+ const nextStep = host.kind === "claude-code" ? "On this host, start a new Claude Code session." : host.kind === "antigravity" ? "On this host, start a new Antigravity conversation (or check promptframe-creation in Customizations)." : "On this host, open a new Local chat (CLI: start a new session).";
27659
28081
  log({
27660
28082
  ...connection,
27661
28083
  pluginRegistered: (installed.pluginInstalled ?? true) && installed.registered,
@@ -27665,6 +28087,7 @@ try {
27665
28087
  pluginInstalled: installed.pluginInstalled ?? true,
27666
28088
  pluginEnabled: installed.pluginEnabled ?? true,
27667
28089
  ...installed.installationMode ? { installationMode: installed.installationMode, skillsInstalled: installed.skillsInstalled, skills: skillNames } : {},
28090
+ ...installed.pluginDir ? { pluginDir: installed.pluginDir } : {},
27668
28091
  hostMcpConnected: "not_verified",
27669
28092
  sessionLoaded: "not_verified",
27670
28093
  installationReused: installed.reused,
@@ -27672,7 +28095,7 @@ try {
27672
28095
  requestedVersion: installed.requestedVersion,
27673
28096
  versionStatus: installed.versionStatus,
27674
28097
  recordedRuntimeRetained: installed.recordedRuntimeRetained ?? false,
27675
- next: (host.kind === "claude-code" ? "On this host, start a new Claude Code session." : "On this host, open a new Local chat (CLI: start a new session).") + " Check " + skillNames.join(", ") + " and the PromptFrame MCP tools together. Keep the existing Token; no reinstall or product repository is needed." + (installed.recordedRuntimeRetained ? " Keep this version's recorded Node path available." : ""),
28098
+ next: nextStep + " Check " + skillNames.join(", ") + " and the PromptFrame MCP tools together. Keep the existing Token; no reinstall or product repository is needed." + (installed.recordedRuntimeRetained ? " Keep this version's recorded Node path available." : ""),
27676
28099
  hostThreadIdentity: "verified_by_the_platform_on_actual_host_tool_calls"
27677
28100
  });
27678
28101
  } finally {
@@ -27681,6 +28104,7 @@ try {
27681
28104
  }
27682
28105
  } else if (command === "bridge") await bridge();
27683
28106
  else if (command === "claude-host-hook") await runClaudeHostHook({ configFile: configFile() });
28107
+ else if (command === "antigravity-host-hook") await runAntigravityHostHook({ configFile: configFile() });
27684
28108
  else if (command === "--version") process.stdout.write(CLIENT_VERSION + "\n");
27685
28109
  else if (command === "accounts") {
27686
28110
  if (args[0] === "refresh") {
@@ -27704,19 +28128,19 @@ try {
27704
28128
  });
27705
28129
  } else if (command === "help" || command === "--help" || !command) {
27706
28130
  process.stdout.write(
27707
- "promptframe-creation connect --endpoint <platform-api-base> [--host codex|claude-code] [--profile <environment-account>] [--claude-bin <absolute-file>] [--no-open]\npromptframe-creation setup --endpoint <platform-api-base> [--host codex|claude-code] [--no-open] [--replace] [--name <client-name>]\npromptframe-creation status [--profile <environment-account>] [--host codex|claude-code]\npromptframe-creation accounts list\npromptframe-creation accounts refresh [--profile <environment-account>] [--host codex|claude-code]\npromptframe-creation bridge [--config <private-file>] [--host codex|claude-code] [--bridge-version <X.Y.Z>]\npromptframe-creation --version\nNode.js >=20 is required. Plugin installation supports Codex >=0.160.0 or Claude Code >=2.1.295 with its structured plugin commands. Token input is masked in a terminal or accepted through --token-stdin; never use a Token command argument.\nBridge startup checks the platform minimum/recommended version. --bridge-version locks one exact compatible version for this new session; active bridges are not replaced.\n"
28131
+ "promptframe-creation connect --endpoint <platform-api-base> [--host codex|claude-code|antigravity] [--profile <environment-account>] [--claude-bin <absolute-file>] [--no-open]\npromptframe-creation setup --endpoint <platform-api-base> [--host codex|claude-code|antigravity] [--no-open] [--replace] [--name <client-name>]\npromptframe-creation status [--profile <environment-account>] [--host codex|claude-code|antigravity]\npromptframe-creation accounts list\npromptframe-creation accounts refresh [--profile <environment-account>] [--host codex|claude-code|antigravity]\npromptframe-creation bridge [--config <private-file>] [--host codex|claude-code|antigravity] [--bridge-version <X.Y.Z>]\npromptframe-creation --version\nNode.js >=20 is required. Plugin installation supports Codex >=0.160.0, Claude Code >=2.1.295 or Google Antigravity. Token input is masked in a terminal or accepted through --token-stdin; never use a Token command argument.\nBridge startup checks the platform minimum/recommended version. --bridge-version locks one exact compatible version for this new session; active bridges are not replaced.\n"
27708
28132
  );
27709
28133
  } else throw new CreationClientError("command.unknown");
27710
- } catch (error5) {
28134
+ } catch (error6) {
27711
28135
  process.stderr.write(
27712
28136
  JSON.stringify({
27713
- ...installationErrorDetails(error5),
27714
- ...claudeInstallationDetails(error5),
27715
- ...claudeErrorDetails(error5),
27716
- ...fallbackErrorDetails(error5),
27717
- ...bridgeErrorDetails(error5),
27718
- ...runtimeErrorDetails(error5),
27719
- error: error5 instanceof CreationClientError ? error5.message : "creation.connection_failed"
28137
+ ...installationErrorDetails(error6),
28138
+ ...claudeInstallationDetails(error6),
28139
+ ...claudeErrorDetails(error6),
28140
+ ...fallbackErrorDetails(error6),
28141
+ ...bridgeErrorDetails(error6),
28142
+ ...runtimeErrorDetails(error6),
28143
+ error: error6 instanceof CreationClientError ? error6.message : "creation.connection_failed"
27720
28144
  }) + "\n"
27721
28145
  );
27722
28146
  process.exitCode = 1;