@promptframe/creation 0.2.3 → 0.2.4
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/.agents/plugins/marketplace.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +3 -1
- package/dist/THIRD_PARTY_NOTICES.txt +28 -0
- package/dist/cli.mjs +908 -40
- package/dist/cli.mjs.LEGAL.txt +37 -0
- package/docs/development.md +4 -0
- package/docs/installing.md +10 -4
- package/docs/releases/0.2.4.md +10 -0
- package/lib/cli.mjs +2 -1
- package/lib/user-installation.mjs +109 -27
- package/lib/version.mjs +1 -1
- package/package.json +3 -2
- package/skills/video-creation/SKILL.md +6 -0
package/dist/cli.mjs
CHANGED
|
@@ -158,10 +158,10 @@ var require_code = __commonJS({
|
|
|
158
158
|
function interpolate(x) {
|
|
159
159
|
return typeof x == "number" || typeof x == "boolean" || x === null ? x : safeStringify(Array.isArray(x) ? x.join(",") : x);
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function stringify2(x) {
|
|
162
162
|
return new _Code(safeStringify(x));
|
|
163
163
|
}
|
|
164
|
-
exports.stringify =
|
|
164
|
+
exports.stringify = stringify2;
|
|
165
165
|
function safeStringify(x) {
|
|
166
166
|
return JSON.stringify(x).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
167
167
|
}
|
|
@@ -3834,7 +3834,7 @@ var require_fast_uri = __commonJS({
|
|
|
3834
3834
|
normalizeString(uri, options);
|
|
3835
3835
|
} else if (typeof uri === "object") {
|
|
3836
3836
|
uri = /** @type {T} */
|
|
3837
|
-
|
|
3837
|
+
parse4(serialize(uri, options), options);
|
|
3838
3838
|
}
|
|
3839
3839
|
return uri;
|
|
3840
3840
|
}
|
|
@@ -3874,8 +3874,8 @@ var require_fast_uri = __commonJS({
|
|
|
3874
3874
|
function resolveComponent(base, relative, options, skipNormalization) {
|
|
3875
3875
|
const target = {};
|
|
3876
3876
|
if (!skipNormalization) {
|
|
3877
|
-
base =
|
|
3878
|
-
relative =
|
|
3877
|
+
base = parse4(serialize(base, options), options);
|
|
3878
|
+
relative = parse4(serialize(relative, options), options);
|
|
3879
3879
|
}
|
|
3880
3880
|
options = options || {};
|
|
3881
3881
|
if (!options.tolerant && relative.scheme) {
|
|
@@ -4174,7 +4174,7 @@ var require_fast_uri = __commonJS({
|
|
|
4174
4174
|
}
|
|
4175
4175
|
return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
|
|
4176
4176
|
}
|
|
4177
|
-
function
|
|
4177
|
+
function parse4(uri, opts) {
|
|
4178
4178
|
return parseWithStatus(uri, opts).parsed;
|
|
4179
4179
|
}
|
|
4180
4180
|
function normalizeString(uri, opts) {
|
|
@@ -4211,7 +4211,7 @@ var require_fast_uri = __commonJS({
|
|
|
4211
4211
|
resolveComponent,
|
|
4212
4212
|
equal,
|
|
4213
4213
|
serialize,
|
|
4214
|
-
parse:
|
|
4214
|
+
parse: parse4
|
|
4215
4215
|
};
|
|
4216
4216
|
module.exports = fastUri;
|
|
4217
4217
|
module.exports.default = fastUri;
|
|
@@ -7207,7 +7207,7 @@ var require_content_type = __commonJS({
|
|
|
7207
7207
|
var QUOTE_REGEXP = /([\\"])/g;
|
|
7208
7208
|
var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
7209
7209
|
exports.format = format;
|
|
7210
|
-
exports.parse =
|
|
7210
|
+
exports.parse = parse4;
|
|
7211
7211
|
function format(obj) {
|
|
7212
7212
|
if (!obj || typeof obj !== "object") {
|
|
7213
7213
|
throw new TypeError("argument obj is required");
|
|
@@ -7231,7 +7231,7 @@ var require_content_type = __commonJS({
|
|
|
7231
7231
|
}
|
|
7232
7232
|
return string4;
|
|
7233
7233
|
}
|
|
7234
|
-
function
|
|
7234
|
+
function parse4(string4) {
|
|
7235
7235
|
if (!string4) {
|
|
7236
7236
|
throw new TypeError("argument string is required");
|
|
7237
7237
|
}
|
|
@@ -7301,7 +7301,7 @@ var require_content_type = __commonJS({
|
|
|
7301
7301
|
});
|
|
7302
7302
|
|
|
7303
7303
|
// lib/version.mjs
|
|
7304
|
-
var CLIENT_VERSION = "0.2.
|
|
7304
|
+
var CLIENT_VERSION = "0.2.4";
|
|
7305
7305
|
var CLIENT_PROTOCOL = "creation-client/v1";
|
|
7306
7306
|
|
|
7307
7307
|
// lib/cli.mjs
|
|
@@ -8505,17 +8505,17 @@ var validateAsync = async (schema, value2, _ctx) => {
|
|
|
8505
8505
|
return result.issues.length === 0;
|
|
8506
8506
|
};
|
|
8507
8507
|
var _encode = (_Err) => {
|
|
8508
|
-
const
|
|
8508
|
+
const parse4 = _parse(_Err);
|
|
8509
8509
|
const fn = (schema, value2, _ctx, _params) => {
|
|
8510
8510
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
8511
|
-
return
|
|
8511
|
+
return parse4(schema, value2, ctx, finalizeParams(fn, _params));
|
|
8512
8512
|
};
|
|
8513
8513
|
return fn;
|
|
8514
8514
|
};
|
|
8515
8515
|
var _decode = (_Err) => {
|
|
8516
|
-
const
|
|
8516
|
+
const parse4 = _parse(_Err);
|
|
8517
8517
|
const fn = (schema, value2, _ctx, _params) => {
|
|
8518
|
-
return
|
|
8518
|
+
return parse4(schema, value2, _ctx, finalizeParams(fn, _params));
|
|
8519
8519
|
};
|
|
8520
8520
|
return fn;
|
|
8521
8521
|
};
|
|
@@ -9601,7 +9601,7 @@ function capSize(inst, size) {
|
|
|
9601
9601
|
if (!caps.length)
|
|
9602
9602
|
return;
|
|
9603
9603
|
const cap = Math.min(...caps.map((c) => c[0]));
|
|
9604
|
-
const
|
|
9604
|
+
const parse4 = inst._zod.parse;
|
|
9605
9605
|
inst._zod.parse = (payload, ctx) => {
|
|
9606
9606
|
const n = size(payload.value);
|
|
9607
9607
|
if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
|
|
@@ -9615,7 +9615,7 @@ function capSize(inst, size) {
|
|
|
9615
9615
|
}
|
|
9616
9616
|
}
|
|
9617
9617
|
}
|
|
9618
|
-
return
|
|
9618
|
+
return parse4(payload, ctx);
|
|
9619
9619
|
};
|
|
9620
9620
|
}
|
|
9621
9621
|
var arraySize = (input) => Array.isArray(input) ? input.length : -1;
|
|
@@ -19853,9 +19853,769 @@ function createHostCallBridge(client) {
|
|
|
19853
19853
|
import { execFile } from "node:child_process";
|
|
19854
19854
|
import { promisify } from "node:util";
|
|
19855
19855
|
import { createHash, randomBytes as randomBytes2 } from "node:crypto";
|
|
19856
|
-
import { lstat as lstat2, mkdir as mkdir2, readdir, readFile as readFile2, writeFile as writeFile2, rename as rename2, rm } from "node:fs/promises";
|
|
19856
|
+
import { lstat as lstat2, mkdir as mkdir2, readdir, readFile as readFile2, writeFile as writeFile2, rename as rename2, rm, open as open2 } from "node:fs/promises";
|
|
19857
19857
|
import { homedir as homedir2 } from "node:os";
|
|
19858
19858
|
import path2 from "node:path";
|
|
19859
|
+
|
|
19860
|
+
// node_modules/smol-toml/dist/error.js
|
|
19861
|
+
function getLineColFromPtr(string4, ptr) {
|
|
19862
|
+
let lines = string4.slice(0, ptr).split(/\r?\n/);
|
|
19863
|
+
return [lines.length, lines.pop().length + 1];
|
|
19864
|
+
}
|
|
19865
|
+
function makeCodeBlock(string4, line, column) {
|
|
19866
|
+
let lines = string4.split(/\r?\n/);
|
|
19867
|
+
let codeblock = "";
|
|
19868
|
+
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
19869
|
+
for (let i = line - 1; i <= line + 1; i++) {
|
|
19870
|
+
let l = lines[i - 1];
|
|
19871
|
+
if (!l)
|
|
19872
|
+
continue;
|
|
19873
|
+
codeblock += i.toString().padEnd(numberLen, " ");
|
|
19874
|
+
codeblock += ": ";
|
|
19875
|
+
codeblock += l;
|
|
19876
|
+
codeblock += "\n";
|
|
19877
|
+
if (i === line) {
|
|
19878
|
+
codeblock += " ".repeat(numberLen + column + 2);
|
|
19879
|
+
codeblock += "^\n";
|
|
19880
|
+
}
|
|
19881
|
+
}
|
|
19882
|
+
return codeblock;
|
|
19883
|
+
}
|
|
19884
|
+
var TomlError = class _TomlError extends Error {
|
|
19885
|
+
line;
|
|
19886
|
+
column;
|
|
19887
|
+
codeblock;
|
|
19888
|
+
constructor(message, options) {
|
|
19889
|
+
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
19890
|
+
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
19891
|
+
super(`Invalid TOML document: ${message}
|
|
19892
|
+
|
|
19893
|
+
${codeblock}`, options);
|
|
19894
|
+
this.line = line;
|
|
19895
|
+
this.column = column;
|
|
19896
|
+
this.codeblock = codeblock;
|
|
19897
|
+
}
|
|
19898
|
+
/** @internal */
|
|
19899
|
+
static x(message, ctx, ptr) {
|
|
19900
|
+
throw new _TomlError(message, { toml: ctx.s, ptr: ptr ?? ctx.p });
|
|
19901
|
+
}
|
|
19902
|
+
};
|
|
19903
|
+
|
|
19904
|
+
// node_modules/smol-toml/dist/primitive.js
|
|
19905
|
+
function parseString(ctx) {
|
|
19906
|
+
let startPtr = ctx.p;
|
|
19907
|
+
let c = ctx.s.charCodeAt(ctx.p++);
|
|
19908
|
+
let first = c;
|
|
19909
|
+
let isLiteral = c === 39;
|
|
19910
|
+
let isMultiline = c === ctx.s.charCodeAt(ctx.p) && c === ctx.s.charCodeAt(ctx.p + 1);
|
|
19911
|
+
if (isMultiline) {
|
|
19912
|
+
if ((c = ctx.s.charCodeAt(ctx.p += 2)) === 10)
|
|
19913
|
+
ctx.p++;
|
|
19914
|
+
else if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)
|
|
19915
|
+
ctx.p += 2;
|
|
19916
|
+
}
|
|
19917
|
+
let parsed = "";
|
|
19918
|
+
let sliceStart = ctx.p;
|
|
19919
|
+
let state = 0;
|
|
19920
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
19921
|
+
c = ctx.s.charCodeAt(ctx.p);
|
|
19922
|
+
if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
|
|
19923
|
+
state = state && 3;
|
|
19924
|
+
} else if (c < 32 && c !== 9 || c === 127) {
|
|
19925
|
+
TomlError.x("control characters are not allowed in strings", ctx);
|
|
19926
|
+
} else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
|
|
19927
|
+
if (isMultiline) {
|
|
19928
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
19929
|
+
ctx.p++;
|
|
19930
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
19931
|
+
ctx.p++;
|
|
19932
|
+
}
|
|
19933
|
+
if (!state) {
|
|
19934
|
+
let s = ctx.s.slice(sliceStart, ctx.p);
|
|
19935
|
+
parsed = parsed ? parsed + s : s;
|
|
19936
|
+
}
|
|
19937
|
+
ctx.p += isMultiline ? 3 : 1;
|
|
19938
|
+
return parsed;
|
|
19939
|
+
} else if (!state) {
|
|
19940
|
+
if (!isLiteral && c === 92) {
|
|
19941
|
+
parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
|
|
19942
|
+
state = 1;
|
|
19943
|
+
}
|
|
19944
|
+
} else if (state === 1) {
|
|
19945
|
+
if (c === 120 || c === 117 || c === 85) {
|
|
19946
|
+
let errPtr = ctx.p++ - 1;
|
|
19947
|
+
let value2 = 0;
|
|
19948
|
+
let len = c === 120 ? 2 : c === 117 ? 4 : 8;
|
|
19949
|
+
for (let j = 0; j < len; j++, ctx.p++) {
|
|
19950
|
+
let hex = ctx.s.charCodeAt(ctx.p);
|
|
19951
|
+
let digit = (
|
|
19952
|
+
/* 0-9 */
|
|
19953
|
+
hex >= 48 && hex <= 57 ? hex - 48 : (
|
|
19954
|
+
/* A-F */
|
|
19955
|
+
hex >= 65 && hex <= 70 ? hex - 65 + 10 : (
|
|
19956
|
+
/* a-f */
|
|
19957
|
+
hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1
|
|
19958
|
+
)
|
|
19959
|
+
)
|
|
19960
|
+
);
|
|
19961
|
+
if (digit < 0)
|
|
19962
|
+
TomlError.x("invalid non-hex character in unicode escape", ctx);
|
|
19963
|
+
value2 = value2 << 4 | digit;
|
|
19964
|
+
}
|
|
19965
|
+
if (value2 < 0 || value2 > 1114111 || value2 >= 55296 && value2 <= 57343) {
|
|
19966
|
+
TomlError.x("invalid unicode escape", ctx, errPtr);
|
|
19967
|
+
}
|
|
19968
|
+
parsed += String.fromCodePoint(value2);
|
|
19969
|
+
sliceStart = ctx.p--;
|
|
19970
|
+
state = 0;
|
|
19971
|
+
} else if (isMultiline && (c === 32 || c === 9)) {
|
|
19972
|
+
state = 2;
|
|
19973
|
+
} else {
|
|
19974
|
+
if (c === 98)
|
|
19975
|
+
parsed += "\b";
|
|
19976
|
+
else if (c === 116)
|
|
19977
|
+
parsed += " ";
|
|
19978
|
+
else if (c === 110)
|
|
19979
|
+
parsed += "\n";
|
|
19980
|
+
else if (c === 102)
|
|
19981
|
+
parsed += "\f";
|
|
19982
|
+
else if (c === 114)
|
|
19983
|
+
parsed += "\r";
|
|
19984
|
+
else if (c === 101)
|
|
19985
|
+
parsed += "\x1B";
|
|
19986
|
+
else if (c === 34)
|
|
19987
|
+
parsed += '"';
|
|
19988
|
+
else if (c === 92)
|
|
19989
|
+
parsed += "\\";
|
|
19990
|
+
else
|
|
19991
|
+
TomlError.x("unrecognised escape sequence", ctx);
|
|
19992
|
+
sliceStart = ctx.p + 1;
|
|
19993
|
+
state = 0;
|
|
19994
|
+
}
|
|
19995
|
+
} else if (c !== 32 && c !== 9) {
|
|
19996
|
+
if (state === 2)
|
|
19997
|
+
TomlError.x("invalid escape: only line-ending whitespace may be escaped", ctx, sliceStart);
|
|
19998
|
+
state = !isLiteral && c === 92 ? 1 : 0;
|
|
19999
|
+
sliceStart = ctx.p;
|
|
20000
|
+
}
|
|
20001
|
+
}
|
|
20002
|
+
TomlError.x("unfinished string", ctx, startPtr);
|
|
20003
|
+
}
|
|
20004
|
+
|
|
20005
|
+
// node_modules/smol-toml/dist/date.js
|
|
20006
|
+
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i;
|
|
20007
|
+
var TomlDate = class _TomlDate extends Date {
|
|
20008
|
+
#hasDate = false;
|
|
20009
|
+
#hasTime = false;
|
|
20010
|
+
#offset = null;
|
|
20011
|
+
constructor(date4, fasttype, unsafeDelim) {
|
|
20012
|
+
let hasDate = true;
|
|
20013
|
+
let hasTime = true;
|
|
20014
|
+
let offset = "Z";
|
|
20015
|
+
let c;
|
|
20016
|
+
if (typeof date4 === "string") {
|
|
20017
|
+
if (fasttype)
|
|
20018
|
+
prep: {
|
|
20019
|
+
if (fasttype < 3) {
|
|
20020
|
+
if (+date4.slice(11, 13) > 23) {
|
|
20021
|
+
date4 = "";
|
|
20022
|
+
break prep;
|
|
20023
|
+
}
|
|
20024
|
+
if (fasttype === 2) {
|
|
20025
|
+
offset = null;
|
|
20026
|
+
date4 += "Z";
|
|
20027
|
+
} else if ((c = date4.charCodeAt(date4.length - 1)) !== 90 && c !== 122) {
|
|
20028
|
+
offset = date4.slice(date4.length - 6);
|
|
20029
|
+
}
|
|
20030
|
+
if (unsafeDelim)
|
|
20031
|
+
date4 = date4.slice(0, 10) + "T" + date4.slice(11);
|
|
20032
|
+
} else if (fasttype === 4) {
|
|
20033
|
+
date4 = +date4.slice(0, 2) > 23 ? "" : `0000-01-01T${date4}Z`;
|
|
20034
|
+
}
|
|
20035
|
+
hasDate = fasttype !== 4;
|
|
20036
|
+
hasTime = fasttype !== 3;
|
|
20037
|
+
}
|
|
20038
|
+
else {
|
|
20039
|
+
let match = date4.match(DATE_TIME_RE);
|
|
20040
|
+
if (match) {
|
|
20041
|
+
if (!match[1]) {
|
|
20042
|
+
hasDate = false;
|
|
20043
|
+
date4 = `0000-01-01T${date4}`;
|
|
20044
|
+
}
|
|
20045
|
+
hasTime = !!match[2];
|
|
20046
|
+
hasTime && date4[10] === " " && (date4 = date4.replace(" ", "T"));
|
|
20047
|
+
if (match[2] && +match[2] > 23) {
|
|
20048
|
+
date4 = "";
|
|
20049
|
+
} else {
|
|
20050
|
+
offset = match[3] || null;
|
|
20051
|
+
if (!offset && hasTime)
|
|
20052
|
+
date4 += "Z";
|
|
20053
|
+
}
|
|
20054
|
+
} else {
|
|
20055
|
+
date4 = "";
|
|
20056
|
+
}
|
|
20057
|
+
}
|
|
20058
|
+
}
|
|
20059
|
+
super(date4);
|
|
20060
|
+
if (!isNaN(this.getTime())) {
|
|
20061
|
+
this.#hasDate = hasDate;
|
|
20062
|
+
this.#hasTime = hasTime;
|
|
20063
|
+
this.#offset = offset;
|
|
20064
|
+
}
|
|
20065
|
+
}
|
|
20066
|
+
isDateTime() {
|
|
20067
|
+
return this.#hasDate && this.#hasTime;
|
|
20068
|
+
}
|
|
20069
|
+
isLocal() {
|
|
20070
|
+
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
20071
|
+
}
|
|
20072
|
+
isDate() {
|
|
20073
|
+
return this.#hasDate && !this.#hasTime;
|
|
20074
|
+
}
|
|
20075
|
+
isTime() {
|
|
20076
|
+
return this.#hasTime && !this.#hasDate;
|
|
20077
|
+
}
|
|
20078
|
+
isValid() {
|
|
20079
|
+
return this.#hasDate || this.#hasTime;
|
|
20080
|
+
}
|
|
20081
|
+
toISOString() {
|
|
20082
|
+
let iso = super.toISOString();
|
|
20083
|
+
if (this.isDate())
|
|
20084
|
+
return iso.slice(0, 10);
|
|
20085
|
+
if (this.isTime())
|
|
20086
|
+
return iso.slice(11, 23);
|
|
20087
|
+
if (this.#offset === null)
|
|
20088
|
+
return iso.slice(0, -1);
|
|
20089
|
+
if (this.#offset === "Z" || this.#offset === "z")
|
|
20090
|
+
return iso;
|
|
20091
|
+
let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
|
|
20092
|
+
offset = this.#offset[0] === "-" ? offset : -offset;
|
|
20093
|
+
let offsetDate = new Date(this.getTime() - offset * 6e4);
|
|
20094
|
+
return offsetDate.toISOString().slice(0, -1) + this.#offset;
|
|
20095
|
+
}
|
|
20096
|
+
static wrapAsOffsetDateTime(jsDate, offset = "Z") {
|
|
20097
|
+
let date4 = new _TomlDate(jsDate);
|
|
20098
|
+
date4.#offset = offset;
|
|
20099
|
+
return date4;
|
|
20100
|
+
}
|
|
20101
|
+
static wrapAsLocalDateTime(jsDate) {
|
|
20102
|
+
let date4 = new _TomlDate(jsDate);
|
|
20103
|
+
date4.#offset = null;
|
|
20104
|
+
return date4;
|
|
20105
|
+
}
|
|
20106
|
+
static wrapAsLocalDate(jsDate) {
|
|
20107
|
+
let date4 = new _TomlDate(jsDate);
|
|
20108
|
+
date4.#hasTime = false;
|
|
20109
|
+
date4.#offset = null;
|
|
20110
|
+
return date4;
|
|
20111
|
+
}
|
|
20112
|
+
static wrapAsLocalTime(jsDate) {
|
|
20113
|
+
let date4 = new _TomlDate(jsDate);
|
|
20114
|
+
date4.#hasDate = false;
|
|
20115
|
+
date4.#offset = null;
|
|
20116
|
+
return date4;
|
|
20117
|
+
}
|
|
20118
|
+
};
|
|
20119
|
+
|
|
20120
|
+
// node_modules/smol-toml/dist/extract.js
|
|
20121
|
+
function isDigit(char, base = 10) {
|
|
20122
|
+
return base === 16 ? char > 47 && char < 58 || char > 64 && char < 71 || char > 96 && char < 103 : char > 47 && char < 48 + base;
|
|
20123
|
+
}
|
|
20124
|
+
function isEndOfValue(char, delim) {
|
|
20125
|
+
return char === 32 || char === 9 || char === 10 || char === 13 || // Structure end or next value delimiter
|
|
20126
|
+
delim && (char === delim || char === 44) || // Comment
|
|
20127
|
+
char === 35;
|
|
20128
|
+
}
|
|
20129
|
+
function extractValue(ctx, end) {
|
|
20130
|
+
let errPtr = ctx.p;
|
|
20131
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
20132
|
+
if (c === 91 || c === 123) {
|
|
20133
|
+
ctx.d-- || TomlError.x("document contains excessively nested structures. aborting.", ctx);
|
|
20134
|
+
let value2 = c === 91 ? parseArray(ctx) : parseInlineTable(ctx);
|
|
20135
|
+
ctx.d++;
|
|
20136
|
+
return value2;
|
|
20137
|
+
}
|
|
20138
|
+
if (c === 34 || c === 39) {
|
|
20139
|
+
return parseString(ctx);
|
|
20140
|
+
}
|
|
20141
|
+
if (c === 116) {
|
|
20142
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
20143
|
+
TomlError.x("invalid value", ctx, errPtr);
|
|
20144
|
+
return ctx.p++, true;
|
|
20145
|
+
}
|
|
20146
|
+
if (c === 102) {
|
|
20147
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
20148
|
+
TomlError.x("invalid value", ctx, errPtr);
|
|
20149
|
+
return ctx.p++, false;
|
|
20150
|
+
}
|
|
20151
|
+
if (c === 43 || c === 45) {
|
|
20152
|
+
return parseNumber(ctx, ctx.p, ctx.s.charCodeAt(++ctx.p), 44 - c, end);
|
|
20153
|
+
}
|
|
20154
|
+
if (ctx.s.charCodeAt(ctx.p + 4) === 45 && ctx.s.charCodeAt(ctx.p + 7) === 45) {
|
|
20155
|
+
return parseDate(ctx, c, end);
|
|
20156
|
+
}
|
|
20157
|
+
if (ctx.s.charCodeAt(ctx.p + 2) === 58) {
|
|
20158
|
+
return parseTime(ctx, c, end);
|
|
20159
|
+
}
|
|
20160
|
+
return parseNumber(ctx, ctx.p, c, 0, end);
|
|
20161
|
+
}
|
|
20162
|
+
function parseNumber(ctx, startPtr, startChr, sign, endChr) {
|
|
20163
|
+
let c = startChr;
|
|
20164
|
+
let state = 0;
|
|
20165
|
+
let hasUnderscores = false;
|
|
20166
|
+
if (c === 105) {
|
|
20167
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 110 || ctx.s.charCodeAt(++ctx.p) !== 102)
|
|
20168
|
+
TomlError.x("invalid value", ctx, startPtr);
|
|
20169
|
+
return ctx.p++, (sign || 1) / 0;
|
|
20170
|
+
}
|
|
20171
|
+
if (c === 110) {
|
|
20172
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 110)
|
|
20173
|
+
TomlError.x("invalid value", ctx, startPtr);
|
|
20174
|
+
return ctx.p++, NaN;
|
|
20175
|
+
}
|
|
20176
|
+
if (c === 48) {
|
|
20177
|
+
if (++ctx.p >= ctx.s.length || isEndOfValue(c = ctx.s.charCodeAt(ctx.p), endChr))
|
|
20178
|
+
return ctx.bi === true ? 0n : 0;
|
|
20179
|
+
if (!sign) {
|
|
20180
|
+
if (c === 120)
|
|
20181
|
+
return parseIntegerBaseN(ctx, startPtr, 16, endChr);
|
|
20182
|
+
else if (c === 98)
|
|
20183
|
+
return parseIntegerBaseN(ctx, startPtr, 2, endChr);
|
|
20184
|
+
else if (c === 111)
|
|
20185
|
+
return parseIntegerBaseN(ctx, startPtr, 8, endChr);
|
|
20186
|
+
}
|
|
20187
|
+
if (c === 46)
|
|
20188
|
+
state = 2;
|
|
20189
|
+
else if (c === 101 || c === 69)
|
|
20190
|
+
state = 4;
|
|
20191
|
+
else
|
|
20192
|
+
TomlError.x("illegal leading zero", ctx, startPtr);
|
|
20193
|
+
} else if (!isDigit(c))
|
|
20194
|
+
TomlError.x("invalid value", ctx, startPtr);
|
|
20195
|
+
while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
|
|
20196
|
+
if (!state)
|
|
20197
|
+
state = 1;
|
|
20198
|
+
if (c === 95) {
|
|
20199
|
+
if (!(state & 1))
|
|
20200
|
+
TomlError.x("illegal underscore", ctx);
|
|
20201
|
+
state += 11;
|
|
20202
|
+
hasUnderscores = true;
|
|
20203
|
+
} else if (state === 1 && c === 46)
|
|
20204
|
+
state = 2;
|
|
20205
|
+
else if ((state === 1 || state === 3) && (c === 101 || c === 69))
|
|
20206
|
+
state = 4;
|
|
20207
|
+
else if (state === 4 && (c === 43 || c === 45)) {
|
|
20208
|
+
state = 6;
|
|
20209
|
+
} else if (!isDigit(c))
|
|
20210
|
+
TomlError.x(`illegal character in numeric literal`, ctx);
|
|
20211
|
+
else if (state > 9)
|
|
20212
|
+
state -= 11;
|
|
20213
|
+
else if (!(state & 1))
|
|
20214
|
+
state++;
|
|
20215
|
+
}
|
|
20216
|
+
if (!state) {
|
|
20217
|
+
let val = (startChr - 48) * (sign || 1);
|
|
20218
|
+
return ctx.bi === true ? BigInt(val) : val;
|
|
20219
|
+
}
|
|
20220
|
+
if (!(state & 1))
|
|
20221
|
+
TomlError.x("unfinished numeric value", ctx, startPtr);
|
|
20222
|
+
let str = ctx.s.slice(startPtr, ctx.p);
|
|
20223
|
+
if (hasUnderscores)
|
|
20224
|
+
str = str.replaceAll("_", "");
|
|
20225
|
+
return state > 1 ? parseFloat(str) : parseInteger(ctx, str, 10, startPtr);
|
|
20226
|
+
}
|
|
20227
|
+
function parseIntegerBaseN(ctx, startPtr, base, endChr) {
|
|
20228
|
+
let c, underscore = 1;
|
|
20229
|
+
while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
|
|
20230
|
+
if (c === 95) {
|
|
20231
|
+
if (underscore & 1)
|
|
20232
|
+
TomlError.x("illegal underscore", ctx);
|
|
20233
|
+
underscore = 3;
|
|
20234
|
+
} else if (!isDigit(c, base))
|
|
20235
|
+
TomlError.x(`illegal character in numeric literal`, ctx);
|
|
20236
|
+
else if (underscore & 1)
|
|
20237
|
+
underscore--;
|
|
20238
|
+
}
|
|
20239
|
+
if (underscore & 1)
|
|
20240
|
+
TomlError.x("unfinished numeric value", ctx);
|
|
20241
|
+
let str = ctx.s.slice(startPtr + 2, ctx.p);
|
|
20242
|
+
if (underscore)
|
|
20243
|
+
str = str.replaceAll("_", "");
|
|
20244
|
+
return parseInteger(ctx, str, base, startPtr);
|
|
20245
|
+
}
|
|
20246
|
+
function parseInteger(ctx, str, base, startPtr) {
|
|
20247
|
+
if (ctx.bi !== true)
|
|
20248
|
+
int: {
|
|
20249
|
+
let val = parseInt(str, base);
|
|
20250
|
+
if (!Number.isSafeInteger(val)) {
|
|
20251
|
+
if (ctx.bi)
|
|
20252
|
+
break int;
|
|
20253
|
+
TomlError.x("integer value cannot be represented losslessly", ctx, startPtr);
|
|
20254
|
+
}
|
|
20255
|
+
return val;
|
|
20256
|
+
}
|
|
20257
|
+
return base === 10 ? BigInt(str) : BigInt((base === 2 ? "0b" : base === 8 ? "0o" : "0x") + str);
|
|
20258
|
+
}
|
|
20259
|
+
function parseDate(ctx, c, endChr) {
|
|
20260
|
+
let startPtr = ctx.p++, unsafeSeparator;
|
|
20261
|
+
if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++))) {
|
|
20262
|
+
return parseNumber(ctx, ctx.p = startPtr, c, 0, endChr);
|
|
20263
|
+
}
|
|
20264
|
+
ctx.p += 5;
|
|
20265
|
+
if (!isDigit(ctx.s.charCodeAt(ctx.p++)))
|
|
20266
|
+
TomlError.x("invalid date-time: date part is malformed", ctx, startPtr);
|
|
20267
|
+
if (ctx.p >= ctx.s.length || ((c = ctx.s.charCodeAt(ctx.p)) !== 32 || (unsafeSeparator = true, !isDigit(ctx.s.charCodeAt(ctx.p + 1)))) && c !== 84 && c !== 116) {
|
|
20268
|
+
let t2 = ctx.s.slice(startPtr, ctx.p);
|
|
20269
|
+
return readDate(ctx, t2, 3, false, startPtr);
|
|
20270
|
+
}
|
|
20271
|
+
if (ctx.s.charCodeAt(ctx.p += 3) !== 58)
|
|
20272
|
+
TomlError.x("invalid date-time: time part is malformed", ctx, startPtr);
|
|
20273
|
+
if (ctx.s.charCodeAt(ctx.p += 3) === 58)
|
|
20274
|
+
ctx.p += 3;
|
|
20275
|
+
if (ctx.s.charCodeAt(ctx.p) === 46)
|
|
20276
|
+
while (isDigit(ctx.s.charCodeAt(++ctx.p)))
|
|
20277
|
+
;
|
|
20278
|
+
if (c = ctx.s.charCodeAt(ctx.p)) {
|
|
20279
|
+
if (c === 90 || c === 122) {
|
|
20280
|
+
let t2 = ctx.s.slice(startPtr, ++ctx.p);
|
|
20281
|
+
return readDate(ctx, t2, 1, unsafeSeparator, startPtr, "[+00:00]");
|
|
20282
|
+
}
|
|
20283
|
+
if (c === 43 || c === 45) {
|
|
20284
|
+
let t2 = ctx.s.slice(startPtr, ctx.p += 6);
|
|
20285
|
+
return readDate(ctx, t2, 1, unsafeSeparator, startPtr, !ctx.ld && "[" + ctx.s.slice(ctx.p - 6, ctx.p) + "]");
|
|
20286
|
+
}
|
|
20287
|
+
}
|
|
20288
|
+
let t = ctx.s.slice(startPtr, ctx.p);
|
|
20289
|
+
return readDate(ctx, t, 2, unsafeSeparator, startPtr);
|
|
20290
|
+
}
|
|
20291
|
+
function parseTime(ctx, c, endChr) {
|
|
20292
|
+
let start = ctx.p;
|
|
20293
|
+
if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(++ctx.p))) {
|
|
20294
|
+
return parseNumber(ctx, --ctx.p, c, 0, endChr);
|
|
20295
|
+
}
|
|
20296
|
+
if (ctx.s.charCodeAt(ctx.p += 4) === 58)
|
|
20297
|
+
ctx.p += 3;
|
|
20298
|
+
if (ctx.s.charCodeAt(ctx.p) === 46)
|
|
20299
|
+
while (isDigit(ctx.s.charCodeAt(++ctx.p)))
|
|
20300
|
+
;
|
|
20301
|
+
let t = ctx.s.slice(start, ctx.p);
|
|
20302
|
+
return readDate(ctx, t, 4, false, start);
|
|
20303
|
+
}
|
|
20304
|
+
function readDate(ctx, str, type, unsafeDelim, errPtr, temporalSuffix) {
|
|
20305
|
+
if (ctx.ld) {
|
|
20306
|
+
let date4 = new TomlDate(str, type, unsafeDelim);
|
|
20307
|
+
if (!date4.isValid())
|
|
20308
|
+
TomlError.x("invalid date", ctx, errPtr);
|
|
20309
|
+
return date4;
|
|
20310
|
+
}
|
|
20311
|
+
try {
|
|
20312
|
+
if (temporalSuffix)
|
|
20313
|
+
str += temporalSuffix;
|
|
20314
|
+
switch (type) {
|
|
20315
|
+
case 1:
|
|
20316
|
+
return Temporal.ZonedDateTime.from(str);
|
|
20317
|
+
case 2:
|
|
20318
|
+
return Temporal.PlainDateTime.from(str);
|
|
20319
|
+
case 3:
|
|
20320
|
+
return Temporal.PlainDate.from(str);
|
|
20321
|
+
case 4:
|
|
20322
|
+
return Temporal.PlainTime.from(str);
|
|
20323
|
+
}
|
|
20324
|
+
} catch (e) {
|
|
20325
|
+
TomlError.x(e instanceof Error ? e.message : "" + e, ctx, errPtr);
|
|
20326
|
+
}
|
|
20327
|
+
}
|
|
20328
|
+
|
|
20329
|
+
// node_modules/smol-toml/dist/util.js
|
|
20330
|
+
function skipComment(ctx) {
|
|
20331
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
20332
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
20333
|
+
if (c === 10)
|
|
20334
|
+
break;
|
|
20335
|
+
if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
|
|
20336
|
+
ctx.p++;
|
|
20337
|
+
break;
|
|
20338
|
+
}
|
|
20339
|
+
if (c < 32 && c !== 9 || c === 127) {
|
|
20340
|
+
TomlError.x("control characters are not allowed in comments", ctx);
|
|
20341
|
+
}
|
|
20342
|
+
}
|
|
20343
|
+
}
|
|
20344
|
+
function skipVoid(ctx, banNewLines, banComments) {
|
|
20345
|
+
let c;
|
|
20346
|
+
while (ctx.p < ctx.s.length) {
|
|
20347
|
+
while (ctx.p < ctx.s.length && ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)))
|
|
20348
|
+
ctx.p++;
|
|
20349
|
+
if (banComments || c !== 35)
|
|
20350
|
+
break;
|
|
20351
|
+
skipComment(ctx);
|
|
20352
|
+
}
|
|
20353
|
+
}
|
|
20354
|
+
|
|
20355
|
+
// node_modules/smol-toml/dist/struct.js
|
|
20356
|
+
function parseKey(ctx, end = 61) {
|
|
20357
|
+
let startPtr;
|
|
20358
|
+
let state = 0;
|
|
20359
|
+
let parsed = [];
|
|
20360
|
+
let sliceStart;
|
|
20361
|
+
let c = ctx.s.charCodeAt(startPtr = ctx.p);
|
|
20362
|
+
do {
|
|
20363
|
+
if (c === end) {
|
|
20364
|
+
if (!state)
|
|
20365
|
+
TomlError.x("unexpected end of key", ctx);
|
|
20366
|
+
if (state === 1)
|
|
20367
|
+
parsed.push(ctx.s.slice(sliceStart, ctx.p));
|
|
20368
|
+
return ctx.p++, parsed;
|
|
20369
|
+
} else if (c === 46) {
|
|
20370
|
+
if (!state)
|
|
20371
|
+
TomlError.x("illegal empty bare key", ctx);
|
|
20372
|
+
if (state === 1)
|
|
20373
|
+
parsed.push(ctx.s.slice(sliceStart, ctx.p));
|
|
20374
|
+
state = 0;
|
|
20375
|
+
} else if (!state && (c === 34 || c === 39)) {
|
|
20376
|
+
if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2))
|
|
20377
|
+
TomlError.x("illegal quoted key: multiline strings are not allowed", ctx);
|
|
20378
|
+
parsed.push(parseString(ctx));
|
|
20379
|
+
state = 2;
|
|
20380
|
+
ctx.p--;
|
|
20381
|
+
} else if (c === 32 || c === 9) {
|
|
20382
|
+
if (state === 1) {
|
|
20383
|
+
parsed.push(ctx.s.slice(sliceStart, ctx.p));
|
|
20384
|
+
state = 2;
|
|
20385
|
+
}
|
|
20386
|
+
} else if (state === 2 || c < 48 && c !== 45 || c > 57 && c < 65 || c > 90 && c < 97 && c !== 95 || c > 122) {
|
|
20387
|
+
TomlError.x("illegal character in key", ctx);
|
|
20388
|
+
} else if (!state) {
|
|
20389
|
+
state = 1;
|
|
20390
|
+
sliceStart = ctx.p;
|
|
20391
|
+
}
|
|
20392
|
+
} while (c = ctx.s.charCodeAt(++ctx.p));
|
|
20393
|
+
TomlError.x("incomplete key-value: cannot find end of key", ctx, startPtr);
|
|
20394
|
+
}
|
|
20395
|
+
function parseInlineTable(ctx) {
|
|
20396
|
+
let startPtr = ctx.p++;
|
|
20397
|
+
let res = /* @__PURE__ */ Object.create(null);
|
|
20398
|
+
let seen = /* @__PURE__ */ new Set();
|
|
20399
|
+
let c;
|
|
20400
|
+
while (ctx.p < ctx.s.length) {
|
|
20401
|
+
skipVoid(ctx);
|
|
20402
|
+
if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
|
|
20403
|
+
ctx.p++;
|
|
20404
|
+
return res;
|
|
20405
|
+
}
|
|
20406
|
+
let k;
|
|
20407
|
+
let t = res;
|
|
20408
|
+
let hasOwn = false;
|
|
20409
|
+
let errPtr = ctx.p;
|
|
20410
|
+
let key = parseKey(ctx);
|
|
20411
|
+
for (let i = 0; i < key.length; i++) {
|
|
20412
|
+
if (i)
|
|
20413
|
+
t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
|
|
20414
|
+
k = key[i];
|
|
20415
|
+
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
|
|
20416
|
+
TomlError.x("trying to redefine an already defined value", ctx, errPtr);
|
|
20417
|
+
}
|
|
20418
|
+
let unsafe = k === "__proto__";
|
|
20419
|
+
if (ctx.uk && (unsafe || k === "constructor")) {
|
|
20420
|
+
t = ctx.uk !== 1 && TomlError.x("document contains an unsafe property", ctx, errPtr);
|
|
20421
|
+
break;
|
|
20422
|
+
}
|
|
20423
|
+
if (!hasOwn && unsafe) {
|
|
20424
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
20425
|
+
}
|
|
20426
|
+
}
|
|
20427
|
+
if (hasOwn) {
|
|
20428
|
+
TomlError.x("trying to redefine an already defined value", ctx, errPtr);
|
|
20429
|
+
}
|
|
20430
|
+
skipVoid(ctx, true, true);
|
|
20431
|
+
let value2 = extractValue(
|
|
20432
|
+
ctx,
|
|
20433
|
+
125
|
|
20434
|
+
/* } */
|
|
20435
|
+
);
|
|
20436
|
+
if (t && typeof (t[k] = value2) === "object")
|
|
20437
|
+
seen.add(value2);
|
|
20438
|
+
skipVoid(ctx);
|
|
20439
|
+
if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
|
|
20440
|
+
return res;
|
|
20441
|
+
}
|
|
20442
|
+
if (c !== 44)
|
|
20443
|
+
TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
|
|
20444
|
+
}
|
|
20445
|
+
TomlError.x("unfinished table", ctx, startPtr);
|
|
20446
|
+
}
|
|
20447
|
+
function parseArray(ctx) {
|
|
20448
|
+
let startPtr = ctx.p++;
|
|
20449
|
+
let res = [];
|
|
20450
|
+
let c;
|
|
20451
|
+
while (ctx.p < ctx.s.length) {
|
|
20452
|
+
skipVoid(ctx);
|
|
20453
|
+
if ((c = ctx.s.charCodeAt(ctx.p)) === 93) {
|
|
20454
|
+
ctx.p++;
|
|
20455
|
+
return res;
|
|
20456
|
+
}
|
|
20457
|
+
res.push(extractValue(
|
|
20458
|
+
ctx,
|
|
20459
|
+
93
|
|
20460
|
+
/* ] */
|
|
20461
|
+
));
|
|
20462
|
+
skipVoid(ctx);
|
|
20463
|
+
if ((c = ctx.s.charCodeAt(ctx.p++)) === 93) {
|
|
20464
|
+
return res;
|
|
20465
|
+
}
|
|
20466
|
+
if (c !== 44)
|
|
20467
|
+
TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
|
|
20468
|
+
}
|
|
20469
|
+
TomlError.x("unfinished array", ctx, startPtr);
|
|
20470
|
+
}
|
|
20471
|
+
|
|
20472
|
+
// node_modules/smol-toml/dist/parse.js
|
|
20473
|
+
function peekTable(ctx, key, table, meta2, type) {
|
|
20474
|
+
let t = table;
|
|
20475
|
+
let m = meta2;
|
|
20476
|
+
let k;
|
|
20477
|
+
let hasOwn = false;
|
|
20478
|
+
let state;
|
|
20479
|
+
for (let i = 0; i < key.length; i++) {
|
|
20480
|
+
if (i) {
|
|
20481
|
+
t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
|
|
20482
|
+
m = (state = m[k]).c;
|
|
20483
|
+
if (type === 0 && (state.t === 1 || state.t === 2)) {
|
|
20484
|
+
return null;
|
|
20485
|
+
}
|
|
20486
|
+
if (state.t === 2) {
|
|
20487
|
+
let l = t.length - 1;
|
|
20488
|
+
t = t[l];
|
|
20489
|
+
m = m[l].c;
|
|
20490
|
+
}
|
|
20491
|
+
}
|
|
20492
|
+
k = key[i];
|
|
20493
|
+
if ((hasOwn = Object.hasOwn(t, k)) && m[k]?.t === 0 && m[k]?.d) {
|
|
20494
|
+
return null;
|
|
20495
|
+
}
|
|
20496
|
+
if (!hasOwn) {
|
|
20497
|
+
let unsafe = k === "__proto__";
|
|
20498
|
+
if (ctx.uk && (unsafe || k === "constructor"))
|
|
20499
|
+
return false;
|
|
20500
|
+
if (unsafe) {
|
|
20501
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
20502
|
+
Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
|
|
20503
|
+
}
|
|
20504
|
+
m[k] = {
|
|
20505
|
+
t: i < key.length - 1 && type === 2 ? 3 : type,
|
|
20506
|
+
d: false,
|
|
20507
|
+
i: 0,
|
|
20508
|
+
c: /* @__PURE__ */ Object.create(null)
|
|
20509
|
+
};
|
|
20510
|
+
}
|
|
20511
|
+
}
|
|
20512
|
+
state = m[k];
|
|
20513
|
+
if (state.t !== type && !(type === 1 && state.t === 3)) {
|
|
20514
|
+
return null;
|
|
20515
|
+
}
|
|
20516
|
+
if (type === 2) {
|
|
20517
|
+
if (!state.d) {
|
|
20518
|
+
state.d = true;
|
|
20519
|
+
t[k] = [];
|
|
20520
|
+
}
|
|
20521
|
+
t[k].push(t = /* @__PURE__ */ Object.create(null));
|
|
20522
|
+
state.c[state.i++] = state = { t: 1, d: false, i: 0, c: /* @__PURE__ */ Object.create(null) };
|
|
20523
|
+
}
|
|
20524
|
+
if (state.d) {
|
|
20525
|
+
return null;
|
|
20526
|
+
}
|
|
20527
|
+
state.d = true;
|
|
20528
|
+
if (type === 1) {
|
|
20529
|
+
t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
|
|
20530
|
+
} else if (type === 0 && hasOwn) {
|
|
20531
|
+
return null;
|
|
20532
|
+
}
|
|
20533
|
+
return [k, t, state.c];
|
|
20534
|
+
}
|
|
20535
|
+
function validateTablePeek(ctx, peek, ptr) {
|
|
20536
|
+
if (peek === null || ctx.uk === 2)
|
|
20537
|
+
TomlError.x(peek === null ? "trying to redefine an already defined table or value" : "document contains an unsafe property", ctx, ptr);
|
|
20538
|
+
}
|
|
20539
|
+
function parse3(toml, options = {}) {
|
|
20540
|
+
let ctx = {
|
|
20541
|
+
s: toml,
|
|
20542
|
+
p: 0,
|
|
20543
|
+
d: options.maxDepth ?? 1e3,
|
|
20544
|
+
bi: options.integersAsBigInt ?? false,
|
|
20545
|
+
ld: options.useLegacyDate ?? true,
|
|
20546
|
+
uk: options.unsafeKeyBehaviour === "throw" ? 2 : options.unsafeKeyBehaviour === "drop" ? 1 : 0
|
|
20547
|
+
};
|
|
20548
|
+
let res = /* @__PURE__ */ Object.create(null);
|
|
20549
|
+
let meta2 = /* @__PURE__ */ Object.create(null);
|
|
20550
|
+
let tmp;
|
|
20551
|
+
let skipping = false;
|
|
20552
|
+
let tbl = res;
|
|
20553
|
+
let m = meta2;
|
|
20554
|
+
if (toml.charCodeAt(0) === 65279)
|
|
20555
|
+
ctx.p++;
|
|
20556
|
+
skipVoid(ctx);
|
|
20557
|
+
while (ctx.p < toml.length) {
|
|
20558
|
+
if (toml.charCodeAt(ctx.p) === 91) {
|
|
20559
|
+
let isTableArray = toml.charCodeAt(++ctx.p) === 91;
|
|
20560
|
+
tmp = ctx.p += +isTableArray;
|
|
20561
|
+
skipping = false;
|
|
20562
|
+
let k = parseKey(
|
|
20563
|
+
ctx,
|
|
20564
|
+
93
|
|
20565
|
+
/* ] */
|
|
20566
|
+
);
|
|
20567
|
+
if (isTableArray) {
|
|
20568
|
+
if (toml.charCodeAt(ctx.p) !== 93) {
|
|
20569
|
+
TomlError.x("expected end of table array declaration", ctx);
|
|
20570
|
+
}
|
|
20571
|
+
ctx.p++;
|
|
20572
|
+
}
|
|
20573
|
+
let p = peekTable(
|
|
20574
|
+
ctx,
|
|
20575
|
+
k,
|
|
20576
|
+
res,
|
|
20577
|
+
meta2,
|
|
20578
|
+
isTableArray ? 2 : 1
|
|
20579
|
+
/* Type.EXPLICIT */
|
|
20580
|
+
);
|
|
20581
|
+
if (!p) {
|
|
20582
|
+
validateTablePeek(ctx, p, tmp);
|
|
20583
|
+
skipping = true;
|
|
20584
|
+
} else {
|
|
20585
|
+
m = p[2];
|
|
20586
|
+
tbl = p[1];
|
|
20587
|
+
}
|
|
20588
|
+
} else {
|
|
20589
|
+
tmp = ctx.p;
|
|
20590
|
+
let k = parseKey(ctx);
|
|
20591
|
+
let p = peekTable(
|
|
20592
|
+
ctx,
|
|
20593
|
+
k,
|
|
20594
|
+
tbl,
|
|
20595
|
+
m,
|
|
20596
|
+
0
|
|
20597
|
+
/* Type.DOTTED */
|
|
20598
|
+
);
|
|
20599
|
+
if (!p && !skipping)
|
|
20600
|
+
validateTablePeek(ctx, p, tmp);
|
|
20601
|
+
skipVoid(ctx, true, true);
|
|
20602
|
+
let v = extractValue(ctx, void 0);
|
|
20603
|
+
if (p && !skipping)
|
|
20604
|
+
p[1][p[0]] = v;
|
|
20605
|
+
}
|
|
20606
|
+
skipVoid(ctx, true);
|
|
20607
|
+
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && (tmp !== 13 || toml.charCodeAt(ctx.p + 1) !== 10)) {
|
|
20608
|
+
TomlError.x("each key-value declaration must be followed by an end-of-line", ctx);
|
|
20609
|
+
}
|
|
20610
|
+
skipVoid(ctx);
|
|
20611
|
+
}
|
|
20612
|
+
return res;
|
|
20613
|
+
}
|
|
20614
|
+
|
|
20615
|
+
// node_modules/smol-toml/dist/stringify.js
|
|
20616
|
+
var HAS_WELLFORMED = !!"".isWellFormed;
|
|
20617
|
+
|
|
20618
|
+
// lib/user-installation.mjs
|
|
19859
20619
|
var execute = promisify(execFile);
|
|
19860
20620
|
var hash = (b) => createHash("sha256").update(b).digest("hex");
|
|
19861
20621
|
var InstallationError = class extends CreationClientError {
|
|
@@ -19963,8 +20723,20 @@ async function officialNpmInstallation(installed, servers, env, profile, configF
|
|
|
19963
20723
|
async function atomicJSON(file, value2) {
|
|
19964
20724
|
const temp = file + "." + randomBytes2(12).toString("hex") + ".tmp";
|
|
19965
20725
|
try {
|
|
19966
|
-
await
|
|
20726
|
+
const out = await open2(temp, "wx", 384);
|
|
20727
|
+
try {
|
|
20728
|
+
await out.writeFile(JSON.stringify(value2, null, 2) + "\n");
|
|
20729
|
+
await out.sync();
|
|
20730
|
+
} finally {
|
|
20731
|
+
await out.close();
|
|
20732
|
+
}
|
|
19967
20733
|
await rename2(temp, file);
|
|
20734
|
+
const directory = await open2(path2.dirname(file), "r");
|
|
20735
|
+
try {
|
|
20736
|
+
await directory.sync();
|
|
20737
|
+
} finally {
|
|
20738
|
+
await directory.close();
|
|
20739
|
+
}
|
|
19968
20740
|
} finally {
|
|
19969
20741
|
await rm(temp, { force: true });
|
|
19970
20742
|
}
|
|
@@ -20018,12 +20790,89 @@ async function acquire(root, signal) {
|
|
|
20018
20790
|
}
|
|
20019
20791
|
return () => rm(lock, { recursive: true, force: true });
|
|
20020
20792
|
}
|
|
20793
|
+
function commandKind(args2) {
|
|
20794
|
+
if (args2[0] === "--version") return "host_version";
|
|
20795
|
+
if (args2[0] === "mcp" && args2[1] === "list") return "mcp_read";
|
|
20796
|
+
if (args2[1] === "marketplace") return args2[2] === "list" ? "marketplace_read" : "marketplace_register";
|
|
20797
|
+
return args2[1] === "list" ? "plugin_read" : "plugin_register";
|
|
20798
|
+
}
|
|
20021
20799
|
async function runCodexCommand(args2, { env = process.env } = {}) {
|
|
20800
|
+
const kind = commandKind(args2), write = kind.endsWith("_register"), timeoutMs = write ? 3e4 : 5e3, start = performance.now();
|
|
20022
20801
|
try {
|
|
20023
|
-
return (await execute("codex", args2, { env, encoding: "utf8", timeout:
|
|
20802
|
+
return (await execute("codex", args2, { env, encoding: "utf8", timeout: timeoutMs, maxBuffer: 2 * 1024 * 1024 })).stdout;
|
|
20024
20803
|
} catch (e) {
|
|
20025
|
-
|
|
20804
|
+
const cause = e.code === "ENOENT" ? "codex_required" : e.code === "ERR_CHILD_PROCESS_STDIO_MAXBUFFER" ? "command_output_limit" : e.killed ? "command_timeout" : "command_failed";
|
|
20805
|
+
fail(cause, {
|
|
20806
|
+
phase: write ? "registration" : "local_check",
|
|
20807
|
+
commandKind: kind,
|
|
20808
|
+
elapsedMs: Math.round(performance.now() - start),
|
|
20809
|
+
timeoutMs,
|
|
20810
|
+
exitCode: Number.isInteger(e.code) ? e.code : null,
|
|
20811
|
+
signal: ["SIGTERM", "SIGKILL", "SIGINT"].includes(e.signal) ? e.signal : null,
|
|
20812
|
+
localRegistrationState: "unknown",
|
|
20813
|
+
action: write ? "observe_same_registration_before_retry" : "retry_local_read"
|
|
20814
|
+
});
|
|
20815
|
+
}
|
|
20816
|
+
}
|
|
20817
|
+
async function codexJSON(runCodex, args2) {
|
|
20818
|
+
const body = await runCodex(args2);
|
|
20819
|
+
try {
|
|
20820
|
+
if (typeof body !== "string" || Buffer.byteLength(body) > 2 * 1024 * 1024) throw Error();
|
|
20821
|
+
return JSON.parse(body);
|
|
20822
|
+
} catch {
|
|
20823
|
+
fail("command_json_unconfirmed", { phase: "local_check", commandKind: commandKind(args2), localRegistrationState: "unknown", action: "retry_local_read" });
|
|
20824
|
+
}
|
|
20825
|
+
}
|
|
20826
|
+
async function relatedPlugins(runCodex, pluginName, env) {
|
|
20827
|
+
const related = /* @__PURE__ */ new Set(), registered = /* @__PURE__ */ new Set(), config2 = path2.join(path2.resolve(env.CODEX_HOME ?? path2.join(homedir2(), ".codex")), "config.toml");
|
|
20828
|
+
try {
|
|
20829
|
+
const s = await info(config2);
|
|
20830
|
+
if (s) {
|
|
20831
|
+
if (!s.isFile() || s.isSymbolicLink() || s.size > 2 * 1024 * 1024) throw Error();
|
|
20832
|
+
const plugins = parse3(await readFile2(config2, "utf8")).plugins ?? {};
|
|
20833
|
+
if (!plugins || typeof plugins !== "object" || Array.isArray(plugins) || Object.keys(plugins).length > 1024) throw Error();
|
|
20834
|
+
for (const id of Object.keys(plugins)) if (id.startsWith(pluginName + "@")) {
|
|
20835
|
+
const market = id.slice(pluginName.length + 1);
|
|
20836
|
+
if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,140}$/.test(market)) throw Error();
|
|
20837
|
+
related.add(market);
|
|
20838
|
+
registered.add(id);
|
|
20839
|
+
}
|
|
20840
|
+
}
|
|
20841
|
+
} catch {
|
|
20842
|
+
fail("local_config_unconfirmed", { phase: "local_check", commandKind: "local_config_read", localRegistrationState: "unknown", action: "review_local_plugin_registration" });
|
|
20026
20843
|
}
|
|
20844
|
+
const state = await codexJSON(runCodex, ["plugin", "marketplace", "list", "--json"]);
|
|
20845
|
+
if (!Array.isArray(state?.marketplaces) || state.marketplaces.length > 128) fail("local_catalog_unconfirmed");
|
|
20846
|
+
for (const market of state.marketplaces) {
|
|
20847
|
+
if (typeof market.name !== "string" || !/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,140}$/.test(market.name) || typeof market.root !== "string" || !path2.isAbsolute(market.root)) fail("local_catalog_unconfirmed");
|
|
20848
|
+
let catalog;
|
|
20849
|
+
try {
|
|
20850
|
+
catalog = await packageJSON(path2.join(market.root, ".agents/plugins/marketplace.json"));
|
|
20851
|
+
} catch {
|
|
20852
|
+
fail("local_catalog_unconfirmed", { phase: "local_check", commandKind: "marketplace_read", localRegistrationState: "unknown", action: "restore_local_marketplace_catalog" });
|
|
20853
|
+
}
|
|
20854
|
+
if (!Array.isArray(catalog?.plugins) || catalog.plugins.length > 1024) fail("local_catalog_unconfirmed");
|
|
20855
|
+
if (catalog.plugins.some((p) => p?.name === pluginName)) related.add(market.name);
|
|
20856
|
+
}
|
|
20857
|
+
const installed = [];
|
|
20858
|
+
for (const market of related) {
|
|
20859
|
+
const list = await codexJSON(runCodex, ["plugin", "list", "--marketplace", market, "--json"]);
|
|
20860
|
+
if (!Array.isArray(list?.installed) || list.installed.length > 1024) fail("local_registration_unconfirmed");
|
|
20861
|
+
for (const p of list.installed) {
|
|
20862
|
+
if (typeof p?.pluginId !== "string" || typeof p.enabled !== "boolean") fail("local_registration_unconfirmed");
|
|
20863
|
+
if (p?.pluginId !== pluginName + "@" + market) continue;
|
|
20864
|
+
if (p.marketplaceName !== void 0 && p.marketplaceName !== market) fail("local_registration_unconfirmed");
|
|
20865
|
+
installed.push(p);
|
|
20866
|
+
}
|
|
20867
|
+
}
|
|
20868
|
+
if (new Set(installed.map((p) => p.pluginId)).size !== installed.length) fail("local_registration_unconfirmed");
|
|
20869
|
+
if ([...registered].some((id) => !installed.some((p) => p.pluginId === id))) fail("local_registration_unconfirmed", {
|
|
20870
|
+
phase: "local_check",
|
|
20871
|
+
commandKind: "plugin_read",
|
|
20872
|
+
localRegistrationState: "unknown",
|
|
20873
|
+
action: "review_same_local_registration"
|
|
20874
|
+
});
|
|
20875
|
+
return installed;
|
|
20027
20876
|
}
|
|
20028
20877
|
async function runNode(root, version2) {
|
|
20029
20878
|
try {
|
|
@@ -20071,24 +20920,37 @@ async function installForUser({
|
|
|
20071
20920
|
const root = path2.resolve(env.XDG_DATA_HOME ?? path2.join(homedir2(), ".local/share"), "promptframe-creation", profile);
|
|
20072
20921
|
await privateDirectory(root);
|
|
20073
20922
|
const release = await acquire(root, signal);
|
|
20074
|
-
const versions = path2.join(root, "versions"), currentFile = path2.join(root, "current.json");
|
|
20923
|
+
const versions = path2.join(root, "versions"), currentFile = path2.join(root, "current.json"), pendingFile = path2.join(root, "registration-pending.json");
|
|
20075
20924
|
const marketplaceFile = path2.join(root, ".agents/plugins/marketplace.json");
|
|
20076
20925
|
const pluginName = "promptframe-creation" + (profile === "default" ? "" : "-" + profile), marketplace = "promptframe-creation-user" + (profile === "default" ? "" : "-" + profile);
|
|
20077
20926
|
const pluginId = pluginName + "@" + marketplace;
|
|
20078
20927
|
const versionRoot = path2.join(versions, payload.version), temporary = path2.join(versions, ".partial-" + randomBytes2(12).toString("hex"));
|
|
20079
|
-
let
|
|
20928
|
+
let previous, registrationStarted = false, newFiles = 0;
|
|
20080
20929
|
try {
|
|
20081
20930
|
signal?.throwIfAborted();
|
|
20082
20931
|
await privateDirectory(versions);
|
|
20083
20932
|
await privateDirectory(path2.dirname(marketplaceFile));
|
|
20084
20933
|
previous = await privateRead(currentFile);
|
|
20085
|
-
previousCatalog = await privateRead(marketplaceFile);
|
|
20086
20934
|
if (previous && (previous.profile !== profile || previous.pluginId !== pluginId || previous.configFile !== configFile2)) fail("profile_binding_conflict");
|
|
20087
|
-
const state =
|
|
20088
|
-
const installed = state.installed
|
|
20089
|
-
const legacy =
|
|
20935
|
+
const state = { installed: await relatedPlugins(runCodex, pluginName, env) };
|
|
20936
|
+
const installed = state.installed.find((x) => x.pluginId === pluginId);
|
|
20937
|
+
const legacy = await codexJSON(runCodex, ["mcp", "list", "--json"]);
|
|
20938
|
+
if (!Array.isArray(legacy)) fail("local_registration_unconfirmed");
|
|
20090
20939
|
const serverName = "promptframe" + (profile === "default" ? "" : "-" + profile);
|
|
20091
20940
|
const servers = legacy.filter((x) => x.name === serverName);
|
|
20941
|
+
const pending = await privateRead(pendingFile);
|
|
20942
|
+
if (pending) {
|
|
20943
|
+
if (pending.profile !== profile || pending.pluginId !== pluginId || pending.configFile !== configFile2 || pending.versionRoot !== path2.join(versions, pending.version)) fail("profile_binding_conflict");
|
|
20944
|
+
if (installed?.version !== pending.version || installed.enabled !== true || installed.source?.path !== pending.versionRoot)
|
|
20945
|
+
fail("registration_unconfirmed_keep_existing", { phase: "registration_observation", localRegistrationState: "unknown", action: "inspect_same_registration_no_second_add" });
|
|
20946
|
+
const transport = await managedTransport(installed, versions, serverName, profile, configFile2);
|
|
20947
|
+
if (servers.length !== 1 || servers[0].enabled === false || !sameTransport(servers[0].transport, transport)) fail("registration_unconfirmed_keep_existing");
|
|
20948
|
+
const ready = await privateRead(path2.join(pending.versionRoot, "installation.json"));
|
|
20949
|
+
if (ready?.payloadDigest !== pending.payloadDigest) fail("installed_files_invalid");
|
|
20950
|
+
previous = pending;
|
|
20951
|
+
await atomicJSON(currentFile, pending);
|
|
20952
|
+
await rm(pendingFile);
|
|
20953
|
+
}
|
|
20092
20954
|
const official = await officialNpmInstallation(state.installed ?? [], servers, env, profile, configFile2);
|
|
20093
20955
|
if (official) {
|
|
20094
20956
|
if (installed || previous) fail("existing_registration_requires_review");
|
|
@@ -20110,6 +20972,7 @@ async function installForUser({
|
|
|
20110
20972
|
if (x.name !== serverName) return false;
|
|
20111
20973
|
return !recorded || !sameTransport(x.transport, recorded);
|
|
20112
20974
|
})) fail("legacy_mcp_entry_requires_review");
|
|
20975
|
+
if (state.installed.some((p) => p.pluginId !== pluginId)) fail("existing_registration_requires_review");
|
|
20113
20976
|
if (installed && compareVersions(installed.version, payload.version) > 0) {
|
|
20114
20977
|
if (!previous || previous.version !== installed.version || previous.versionRoot !== installed.source.path || installed.enabled !== true)
|
|
20115
20978
|
fail("existing_registration_requires_review");
|
|
@@ -20179,12 +21042,19 @@ async function installForUser({
|
|
|
20179
21042
|
}] };
|
|
20180
21043
|
await atomicJSON(marketplaceFile, catalog);
|
|
20181
21044
|
signal?.throwIfAborted();
|
|
21045
|
+
await atomicJSON(pendingFile, complete);
|
|
20182
21046
|
registrationStarted = true;
|
|
20183
21047
|
await runCodex(["plugin", "marketplace", "add", root, "--json"]);
|
|
20184
21048
|
await runCodex(["plugin", "add", pluginId, "--json"]);
|
|
20185
|
-
const observed =
|
|
21049
|
+
const observed = (await relatedPlugins(runCodex, pluginName, env)).find((x) => x.pluginId === pluginId);
|
|
20186
21050
|
if (observed?.version !== payload.version || observed.enabled !== true) fail("registration_unconfirmed");
|
|
21051
|
+
const launch = await managedTransport(observed, versions, serverName, profile, configFile2);
|
|
21052
|
+
const hostMcp = await codexJSON(runCodex, ["mcp", "list", "--json"]);
|
|
21053
|
+
if (!Array.isArray(hostMcp)) fail("registration_unconfirmed");
|
|
21054
|
+
const effective = hostMcp.filter((x) => x.name === serverName);
|
|
21055
|
+
if (effective.length !== 1 || effective[0].enabled === false || !sameTransport(effective[0].transport, launch)) fail("registration_unconfirmed");
|
|
20187
21056
|
await atomicJSON(currentFile, complete);
|
|
21057
|
+
await rm(pendingFile);
|
|
20188
21058
|
}
|
|
20189
21059
|
return {
|
|
20190
21060
|
...complete,
|
|
@@ -20199,18 +21069,12 @@ async function installForUser({
|
|
|
20199
21069
|
};
|
|
20200
21070
|
} catch (error2) {
|
|
20201
21071
|
if (registrationStarted) {
|
|
20202
|
-
|
|
20203
|
-
|
|
20204
|
-
|
|
20205
|
-
|
|
20206
|
-
|
|
20207
|
-
|
|
20208
|
-
if (restored?.version !== previous.version || restored.enabled !== true) fail("registration_unconfirmed");
|
|
20209
|
-
} catch {
|
|
20210
|
-
}
|
|
20211
|
-
}
|
|
20212
|
-
} else await rm(marketplaceFile, { force: true });
|
|
20213
|
-
fail("registration_unconfirmed_keep_existing");
|
|
21072
|
+
fail("registration_unconfirmed_keep_existing", {
|
|
21073
|
+
...installationErrorDetails(error2),
|
|
21074
|
+
phase: "registration_observation",
|
|
21075
|
+
localRegistrationState: "unknown",
|
|
21076
|
+
action: "inspect_same_registration_no_second_add"
|
|
21077
|
+
});
|
|
20214
21078
|
}
|
|
20215
21079
|
if (error2 instanceof CreationClientError) throw error2;
|
|
20216
21080
|
if (signal?.aborted) fail("interrupted_keep_existing");
|
|
@@ -20418,12 +21282,16 @@ try {
|
|
|
20418
21282
|
...connection,
|
|
20419
21283
|
pluginRegistered: installed.registered,
|
|
20420
21284
|
version: installed.version,
|
|
21285
|
+
pluginInstalled: true,
|
|
21286
|
+
pluginEnabled: true,
|
|
21287
|
+
hostMcpConnected: "not_verified",
|
|
21288
|
+
sessionLoaded: "not_verified",
|
|
20421
21289
|
installationReused: installed.reused,
|
|
20422
21290
|
profile: installed.profile,
|
|
20423
21291
|
requestedVersion: installed.requestedVersion,
|
|
20424
21292
|
versionStatus: installed.versionStatus,
|
|
20425
21293
|
recordedRuntimeRetained: installed.recordedRuntimeRetained ?? false,
|
|
20426
|
-
next:
|
|
21294
|
+
next: "On this host, open a new Local chat (CLI: start a new session). Check creation-setup, video-creation 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." : ""),
|
|
20427
21295
|
hostThreadIdentity: "verified_by_the_platform_on_actual_host_tool_calls"
|
|
20428
21296
|
});
|
|
20429
21297
|
} finally {
|