@hasna/skills 0.10.20 → 0.10.23
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/README.md +39 -8
- package/bin/index.js +652 -354
- package/bin/mcp.js +310 -119
- package/bin/migrate.js +1 -1
- package/bin/server.js +1 -1
- package/bin/worker.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +466 -177
- package/dist/lib/agent-discovery.d.ts +4 -1
- package/dist/lib/agent-integration.d.ts +4 -0
- package/dist/lib/codex-hook-rpc.d.ts +1 -1
- package/dist/lib/codex-native-compatibility.d.ts +3 -0
- package/dist/lib/codex-native-skill-catalog.d.ts +4 -0
- package/dist/lib/codex-plugin-skill-controls.d.ts +2 -0
- package/dist/lib/codex-settings-witness-v1.d.ts +12 -0
- package/dist/lib/codex-settings-witness.d.ts +13 -5
- package/dist/sdk/index.js +537 -249
- package/package.json +1 -1
package/bin/mcp.js
CHANGED
|
@@ -20019,7 +20019,7 @@ var package_default;
|
|
|
20019
20019
|
var init_package = __esm(() => {
|
|
20020
20020
|
package_default = {
|
|
20021
20021
|
name: "@hasna/skills",
|
|
20022
|
-
version: "0.10.
|
|
20022
|
+
version: "0.10.23",
|
|
20023
20023
|
description: "Skills library for AI coding agents",
|
|
20024
20024
|
type: "module",
|
|
20025
20025
|
bin: {
|
|
@@ -38253,12 +38253,16 @@ function assertAgentPolicyCollections(policy) {
|
|
|
38253
38253
|
}
|
|
38254
38254
|
if (bridge.codexPluginSkills !== undefined)
|
|
38255
38255
|
for (const control of array3(bridge.codexPluginSkills, 4096)) {
|
|
38256
|
-
requireBound(object4(control) && Object.keys(control).every((key) => ["name", "pluginId", "namespace", "pluginParent", "manifestSha256", "appSha256"].includes(key)));
|
|
38256
|
+
requireBound(object4(control) && Object.keys(control).every((key) => ["name", "pluginId", "namespace", "pluginParent", "manifestSha256", "appSha256", "mcpSha256", "remotePluginId"].includes(key)));
|
|
38257
38257
|
text(control.name, 129);
|
|
38258
38258
|
text(control.pluginId, 1024);
|
|
38259
38259
|
text(control.namespace, 64);
|
|
38260
38260
|
text(control.pluginParent);
|
|
38261
38261
|
requireBound(isAbsolute3(control.pluginParent) && resolve2(control.pluginParent) === control.pluginParent && /^[a-f0-9]{64}$/.test(control.manifestSha256));
|
|
38262
|
+
if (control.remotePluginId !== undefined)
|
|
38263
|
+
requireBound(typeof control.remotePluginId === "string" && /^[A-Za-z0-9_~-]{1,1024}$/.test(control.remotePluginId));
|
|
38264
|
+
if (control.mcpSha256 !== undefined)
|
|
38265
|
+
requireBound(typeof control.mcpSha256 === "string" && /^[a-f0-9]{64}$/.test(control.mcpSha256));
|
|
38262
38266
|
if (control.appSha256 !== undefined)
|
|
38263
38267
|
requireBound(typeof control.appSha256 === "string" && /^[a-f0-9]{64}$/.test(control.appSha256));
|
|
38264
38268
|
}
|
|
@@ -38281,8 +38285,8 @@ function assertAgentPolicyCollections(policy) {
|
|
|
38281
38285
|
text(source.path);
|
|
38282
38286
|
requireBound(source.sha256 === null || typeof source.sha256 === "string" && /^[a-f0-9]{64}$/.test(source.sha256));
|
|
38283
38287
|
if (source.hashMode !== undefined)
|
|
38284
|
-
requireBound(["bytes", "path-bytes", "claude-plugin-registry", "claude-marketplace-registry", "claude-settings-v1", "claude-settings-v2", "claude-settings-v3", "claude-marketplace-registry-v2", "codex-settings-v1"].includes(source.hashMode) && source.format === undefined && source.fields === undefined && (source.hashMode === "bytes" || source.sha256 !== null));
|
|
38285
|
-
if (source.hashMode === "codex-settings-v1")
|
|
38288
|
+
requireBound(["bytes", "path-bytes", "claude-plugin-registry", "claude-marketplace-registry", "claude-settings-v1", "claude-settings-v2", "claude-settings-v3", "claude-marketplace-registry-v2", "codex-settings-v1", "codex-settings-v2"].includes(source.hashMode) && source.format === undefined && source.fields === undefined && (source.hashMode === "bytes" || source.sha256 !== null));
|
|
38289
|
+
if (source.hashMode === "codex-settings-v1" || source.hashMode === "codex-settings-v2")
|
|
38286
38290
|
requireBound(agent === "codex" && value.agent === "codex" && value.method === "reviewed" && !/[\x00-\x1f\x7f]/.test(source.path) && isAbsolute3(source.path) && resolve2(source.path) === source.path && basename3(source.path) === "config.toml");
|
|
38287
38291
|
if (source.hashMode === "claude-settings-v1" || source.hashMode === "claude-settings-v2" || source.hashMode === "claude-settings-v3")
|
|
38288
38292
|
requireBound(agent === "claude" && value.agent === "claude" && value.method === "reviewed" && !/[\x00-\x1f\x7f]/.test(source.path) && isAbsolute3(source.path) && resolve2(source.path) === source.path && basename3(source.path) === "settings.json");
|
|
@@ -47466,23 +47470,48 @@ var init_claude_settings_witness = __esm(() => {
|
|
|
47466
47470
|
PERSISTED_EFFORT_LEVELS = new Set(["low", "medium", "high", "xhigh"]);
|
|
47467
47471
|
});
|
|
47468
47472
|
|
|
47473
|
+
// src/lib/codex-native-compatibility.ts
|
|
47474
|
+
function supportsCodexNativeCapability(version2, capability) {
|
|
47475
|
+
return typeof version2 === "string" && Object.hasOwn(MEASURED_CODEX_CAPABILITIES, version2) && MEASURED_CODEX_CAPABILITIES[version2].includes(capability);
|
|
47476
|
+
}
|
|
47477
|
+
var MEASURED_CODEX_CAPABILITIES, SUPPORTED_CODEX_HOOK_VERSIONS;
|
|
47478
|
+
var init_codex_native_compatibility = __esm(() => {
|
|
47479
|
+
MEASURED_CODEX_CAPABILITIES = {
|
|
47480
|
+
"codex-cli 0.153.0": ["hooks"],
|
|
47481
|
+
"codex-cli 0.154.0": ["hooks"],
|
|
47482
|
+
"codex-cli 0.155.0": ["hooks"],
|
|
47483
|
+
"codex-cli 0.155.1": ["hooks"],
|
|
47484
|
+
"codex-cli 0.156.1": ["hooks"],
|
|
47485
|
+
"codex-cli 0.157.0": ["hooks"],
|
|
47486
|
+
"codex-cli 0.157.1": ["hooks"],
|
|
47487
|
+
"codex-cli 0.158.0": ["hooks"],
|
|
47488
|
+
"codex-cli 0.159.0": ["hooks"],
|
|
47489
|
+
"codex-cli 0.159.2": ["hooks", "qualified-skill-catalog"],
|
|
47490
|
+
"codex-cli 0.160.0": ["hooks", "qualified-skill-catalog"]
|
|
47491
|
+
};
|
|
47492
|
+
SUPPORTED_CODEX_HOOK_VERSIONS = Object.freeze(Object.keys(MEASURED_CODEX_CAPABILITIES).filter((version2) => supportsCodexNativeCapability(version2, "hooks")));
|
|
47493
|
+
});
|
|
47494
|
+
|
|
47469
47495
|
// src/lib/codex-hook-rpc.ts
|
|
47470
|
-
var init_codex_hook_rpc = () => {
|
|
47496
|
+
var init_codex_hook_rpc = __esm(() => {
|
|
47497
|
+
init_codex_native_compatibility();
|
|
47498
|
+
init_codex_native_compatibility();
|
|
47499
|
+
});
|
|
47471
47500
|
|
|
47472
47501
|
// src/lib/codex-native-skill-catalog.ts
|
|
47473
|
-
var SUPPORTED_NAME_CONTROL_VERSIONS;
|
|
47474
47502
|
var init_codex_native_skill_catalog = __esm(() => {
|
|
47475
47503
|
init_codex_hook_rpc();
|
|
47476
|
-
|
|
47504
|
+
init_codex_native_compatibility();
|
|
47477
47505
|
});
|
|
47478
47506
|
|
|
47479
47507
|
// src/lib/codex-plugin-skill-controls.ts
|
|
47480
47508
|
var init_codex_plugin_skill_controls = __esm(() => {
|
|
47481
47509
|
init_claude_settings_witness();
|
|
47510
|
+
init_codex_native_compatibility();
|
|
47482
47511
|
init_codex_native_skill_catalog();
|
|
47483
47512
|
});
|
|
47484
47513
|
|
|
47485
|
-
// src/lib/codex-settings-witness.ts
|
|
47514
|
+
// src/lib/codex-settings-witness-v1.ts
|
|
47486
47515
|
import { createHash as createHash9 } from "crypto";
|
|
47487
47516
|
function need3(value) {
|
|
47488
47517
|
if (!value)
|
|
@@ -47574,12 +47603,161 @@ function captureCodexSettings(path, budget = { remaining: 256 * 1024 * 1024 }) {
|
|
|
47574
47603
|
return { path, hashMode: "codex-settings-v1", sha256: hashCodexSettingsReplacement(text2) };
|
|
47575
47604
|
}
|
|
47576
47605
|
var sha = (text2) => createHash9("sha256").update(text2).digest("hex"), EFFORT, VERBOSITY;
|
|
47577
|
-
var
|
|
47606
|
+
var init_codex_settings_witness_v1 = __esm(() => {
|
|
47578
47607
|
init_claude_settings_witness();
|
|
47579
47608
|
EFFORT = new Set(["none", "minimal", "low", "medium", "high", "xhigh"]);
|
|
47580
47609
|
VERBOSITY = new Set(["low", "medium", "high"]);
|
|
47581
47610
|
});
|
|
47582
47611
|
|
|
47612
|
+
// src/lib/codex-settings-witness.ts
|
|
47613
|
+
import { createHash as createHash10 } from "crypto";
|
|
47614
|
+
function need4(value) {
|
|
47615
|
+
if (!value)
|
|
47616
|
+
throw new Error("Invalid Codex settings witness");
|
|
47617
|
+
}
|
|
47618
|
+
function isRecord3(value) {
|
|
47619
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
47620
|
+
}
|
|
47621
|
+
function isDate(value) {
|
|
47622
|
+
return value instanceof Date;
|
|
47623
|
+
}
|
|
47624
|
+
function numericTokens2(text2) {
|
|
47625
|
+
const result = [];
|
|
47626
|
+
for (let at = 0;at < text2.length; ) {
|
|
47627
|
+
const char = text2[at];
|
|
47628
|
+
if (char === "#") {
|
|
47629
|
+
while (at < text2.length && text2[at] !== `
|
|
47630
|
+
`)
|
|
47631
|
+
at++;
|
|
47632
|
+
continue;
|
|
47633
|
+
}
|
|
47634
|
+
if (char === '"' || char === "'") {
|
|
47635
|
+
const quote = char, triple = text2.slice(at, at + 3) === quote.repeat(3);
|
|
47636
|
+
at += triple ? 3 : 1;
|
|
47637
|
+
while (at < text2.length) {
|
|
47638
|
+
if (quote === '"' && text2[at] === "\\") {
|
|
47639
|
+
at += 2;
|
|
47640
|
+
continue;
|
|
47641
|
+
}
|
|
47642
|
+
if (text2.slice(at, at + (triple ? 3 : 1)) === quote.repeat(triple ? 3 : 1)) {
|
|
47643
|
+
at += triple ? 3 : 1;
|
|
47644
|
+
break;
|
|
47645
|
+
}
|
|
47646
|
+
at++;
|
|
47647
|
+
}
|
|
47648
|
+
continue;
|
|
47649
|
+
}
|
|
47650
|
+
if (/[0-9+-]/.test(char)) {
|
|
47651
|
+
const start = at;
|
|
47652
|
+
while (at < text2.length && !/[\s,\]{}#=]/.test(text2[at]))
|
|
47653
|
+
at++;
|
|
47654
|
+
if (at > start) {
|
|
47655
|
+
result.push(text2.slice(start, at));
|
|
47656
|
+
continue;
|
|
47657
|
+
}
|
|
47658
|
+
}
|
|
47659
|
+
at++;
|
|
47660
|
+
}
|
|
47661
|
+
return result.sort();
|
|
47662
|
+
}
|
|
47663
|
+
function canonical4(value, depth = 0, budget = { remaining: 65536 }) {
|
|
47664
|
+
need4(depth <= 32 && --budget.remaining >= 0);
|
|
47665
|
+
if (value === null)
|
|
47666
|
+
return ["null"];
|
|
47667
|
+
if (typeof value === "string")
|
|
47668
|
+
return ["string", value];
|
|
47669
|
+
if (typeof value === "boolean")
|
|
47670
|
+
return ["boolean", value];
|
|
47671
|
+
if (typeof value === "number") {
|
|
47672
|
+
need4(Number.isFinite(value));
|
|
47673
|
+
return ["number", String(value)];
|
|
47674
|
+
}
|
|
47675
|
+
if (isDate(value)) {
|
|
47676
|
+
need4(Number.isFinite(value.getTime()));
|
|
47677
|
+
return ["date", value.toISOString()];
|
|
47678
|
+
}
|
|
47679
|
+
if (Array.isArray(value))
|
|
47680
|
+
return ["array", value.map((child) => canonical4(child, depth + 1, budget))];
|
|
47681
|
+
need4(isRecord3(value));
|
|
47682
|
+
return ["object", Object.entries(value).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, child]) => [key, canonical4(child, depth + 1, budget)])];
|
|
47683
|
+
}
|
|
47684
|
+
function normalize2(config2) {
|
|
47685
|
+
if (isRecord3(config2.hooks)) {
|
|
47686
|
+
delete config2.hooks.state;
|
|
47687
|
+
if (!Object.keys(config2.hooks).length)
|
|
47688
|
+
delete config2.hooks;
|
|
47689
|
+
}
|
|
47690
|
+
if (isRecord3(config2.skills) && Array.isArray(config2.skills.config)) {
|
|
47691
|
+
const skills = config2.skills;
|
|
47692
|
+
const retained = skills.config.filter((entry) => !disablesOneSkill(entry));
|
|
47693
|
+
if (retained.length !== skills.config.length) {
|
|
47694
|
+
if (retained.length)
|
|
47695
|
+
skills.config = retained;
|
|
47696
|
+
else
|
|
47697
|
+
delete skills.config;
|
|
47698
|
+
}
|
|
47699
|
+
if (!Object.keys(skills).length)
|
|
47700
|
+
delete config2.skills;
|
|
47701
|
+
}
|
|
47702
|
+
inference(config2);
|
|
47703
|
+
if (isRecord3(config2.profiles)) {
|
|
47704
|
+
for (const profile of Object.values(config2.profiles))
|
|
47705
|
+
if (isRecord3(profile))
|
|
47706
|
+
inference(profile);
|
|
47707
|
+
}
|
|
47708
|
+
}
|
|
47709
|
+
function disablesOneSkill(entry) {
|
|
47710
|
+
if (!isRecord3(entry) || entry.enabled !== false)
|
|
47711
|
+
return false;
|
|
47712
|
+
const keys = Object.keys(entry);
|
|
47713
|
+
if (!keys.every((key) => key === "path" || key === "name" || key === "enabled"))
|
|
47714
|
+
return false;
|
|
47715
|
+
const selector = ["path", "name"].filter((key) => Object.hasOwn(entry, key));
|
|
47716
|
+
return selector.length === 1 && typeof entry[selector[0]] === "string" && entry[selector[0]].length > 0;
|
|
47717
|
+
}
|
|
47718
|
+
function inference(target) {
|
|
47719
|
+
for (const key of INFERENCE)
|
|
47720
|
+
if (Object.hasOwn(target, key)) {
|
|
47721
|
+
const value = target[key];
|
|
47722
|
+
if (key === "model")
|
|
47723
|
+
need4(typeof value === "string" && MODEL.test(value));
|
|
47724
|
+
else
|
|
47725
|
+
need4(typeof value === "string" && (key === "model_reasoning_effort" ? EFFORT2.has(value) : VERBOSITY2.has(value)));
|
|
47726
|
+
delete target[key];
|
|
47727
|
+
}
|
|
47728
|
+
}
|
|
47729
|
+
function settingsDigest2(text2) {
|
|
47730
|
+
let config2;
|
|
47731
|
+
try {
|
|
47732
|
+
config2 = Bun.TOML.parse(text2);
|
|
47733
|
+
} catch {
|
|
47734
|
+
throw new Error("Invalid Codex settings witness");
|
|
47735
|
+
}
|
|
47736
|
+
need4(isRecord3(config2));
|
|
47737
|
+
normalize2(config2);
|
|
47738
|
+
return sha2(`hasna.skills.codex-settings.v2\x00${JSON.stringify([canonical4(config2), numericTokens2(text2)])}`);
|
|
47739
|
+
}
|
|
47740
|
+
function hashCodexSettingsReplacementV2(text2, budget = { remaining: 256 * 1024 * 1024 }) {
|
|
47741
|
+
need4(Buffer.byteLength(text2) <= 1024 * 1024 && budget.remaining >= Buffer.byteLength(text2));
|
|
47742
|
+
budget.remaining -= Buffer.byteLength(text2);
|
|
47743
|
+
return settingsDigest2(text2);
|
|
47744
|
+
}
|
|
47745
|
+
function captureCodexSettingsV2(path, budget = { remaining: 256 * 1024 * 1024 }) {
|
|
47746
|
+
const text2 = readNativeSettingsWitnessFile(path, budget, "config.toml");
|
|
47747
|
+
return { path, hashMode: "codex-settings-v2", sha256: settingsDigest2(text2) };
|
|
47748
|
+
}
|
|
47749
|
+
var sha2 = (text2) => createHash10("sha256").update(text2).digest("hex"), EFFORT2, VERBOSITY2, MODEL, CODEX_DISCOVERY_PROJECTION_FIELDS, INFERENCE;
|
|
47750
|
+
var init_codex_settings_witness = __esm(() => {
|
|
47751
|
+
init_codex_settings_witness_v1();
|
|
47752
|
+
init_codex_settings_witness_v1();
|
|
47753
|
+
init_claude_settings_witness();
|
|
47754
|
+
EFFORT2 = new Set(["none", "minimal", "low", "medium", "high", "xhigh"]);
|
|
47755
|
+
VERBOSITY2 = new Set(["low", "medium", "high"]);
|
|
47756
|
+
MODEL = /^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/;
|
|
47757
|
+
CODEX_DISCOVERY_PROJECTION_FIELDS = ["plugins", "marketplaces", "skills"];
|
|
47758
|
+
INFERENCE = ["model", "model_reasoning_effort", "model_verbosity"];
|
|
47759
|
+
});
|
|
47760
|
+
|
|
47583
47761
|
// src/lib/managed-policy.ts
|
|
47584
47762
|
import { closeSync as closeSync9, constants as constants6, fstatSync as fstatSync9, lstatSync as lstatSync11, openSync as openSync9, readSync as readSync5 } from "fs";
|
|
47585
47763
|
import { join as join16 } from "path";
|
|
@@ -47660,7 +47838,7 @@ var init_managed_policy = __esm(() => {
|
|
|
47660
47838
|
});
|
|
47661
47839
|
|
|
47662
47840
|
// src/lib/agent-bridge.ts
|
|
47663
|
-
import { createHash as
|
|
47841
|
+
import { createHash as createHash11 } from "crypto";
|
|
47664
47842
|
var CLI_BRIDGE_VERSION = 1, markdown = `---
|
|
47665
47843
|
name: skills-cli
|
|
47666
47844
|
description: Discover, load, author, and run versioned skills through the Skills CLI when a task needs reusable instructions or an executable skill.
|
|
@@ -47676,7 +47854,7 @@ Use the Skills CLI as the skill authority for this station.
|
|
|
47676
47854
|
This bridge contains no skill payloads. Do not copy skill content into agent-native skill directories or load other native skill copies. If a Skills command refuses authority, selection, integrity, or native drift, report that refusal and use its repair guidance; do not substitute bundled or stale local content. Explicit local draft authoring remains available.
|
|
47677
47855
|
`, CLI_BRIDGE_DIGEST, CLI_BRIDGE_FILES;
|
|
47678
47856
|
var init_agent_bridge = __esm(() => {
|
|
47679
|
-
CLI_BRIDGE_DIGEST =
|
|
47857
|
+
CLI_BRIDGE_DIGEST = createHash11("sha256").update(markdown).digest("hex");
|
|
47680
47858
|
CLI_BRIDGE_FILES = Object.freeze({
|
|
47681
47859
|
"SKILL.md": markdown,
|
|
47682
47860
|
".hasna-skills.json": `${JSON.stringify({ managedBy: "@hasna/skills", kind: "cli-bridge", version: CLI_BRIDGE_VERSION, protocol: "selection-v1", contentSha256: CLI_BRIDGE_DIGEST }, null, 2)}
|
|
@@ -48370,7 +48548,7 @@ var init_selection_resolver = __esm(() => {
|
|
|
48370
48548
|
});
|
|
48371
48549
|
|
|
48372
48550
|
// src/lib/plugin-projection.ts
|
|
48373
|
-
import { createHash as
|
|
48551
|
+
import { createHash as createHash12 } from "crypto";
|
|
48374
48552
|
function pluginRefusal(message) {
|
|
48375
48553
|
throw new SkillSelectionError("PLUGIN_ADMISSION_REFUSED", message);
|
|
48376
48554
|
}
|
|
@@ -48448,7 +48626,7 @@ function pluginFileWitnesses(entries) {
|
|
|
48448
48626
|
return { path: item.path, mode: item.mode, size: item.bytes.byteLength, sha256: pluginHash(item.bytes) };
|
|
48449
48627
|
});
|
|
48450
48628
|
}
|
|
48451
|
-
var PLUGIN_PROJECTION_LIMITS, pluginHash = (bytes) =>
|
|
48629
|
+
var PLUGIN_PROJECTION_LIMITS, pluginHash = (bytes) => createHash12("sha256").update(bytes).digest("hex");
|
|
48452
48630
|
var init_plugin_projection = __esm(() => {
|
|
48453
48631
|
init_selection_cache();
|
|
48454
48632
|
PLUGIN_PROJECTION_LIMITS = Object.freeze({ files: 1024, bytes: 64 * 1024 * 1024, fileBytes: 16 * 1024 * 1024, metadataBytes: 512 * 1024, registrations: 64, history: 128 });
|
|
@@ -48466,7 +48644,7 @@ function stat(path) {
|
|
|
48466
48644
|
return pluginRefusal("Cannot inspect plugin filesystem entry");
|
|
48467
48645
|
}
|
|
48468
48646
|
}
|
|
48469
|
-
function
|
|
48647
|
+
function canonical5(path) {
|
|
48470
48648
|
pluginNeed(typeof path === "string" && path.length <= 8192 && isAbsolute9(path) && resolve9(path) === path && !/[\x00-\x1f\x7f]/.test(path), "Plugin storage paths must be canonical absolute paths");
|
|
48471
48649
|
}
|
|
48472
48650
|
function owner(stats, system = false) {
|
|
@@ -48477,7 +48655,7 @@ function same3(left, right, identityOnly = false) {
|
|
|
48477
48655
|
pluginNeed(right && left.dev === right.dev && left.ino === right.ino && left.mode === right.mode && left.uid === right.uid && left.gid === right.gid && (identityOnly || left.size === right.size && left.nlink === right.nlink && left.mtimeNs === right.mtimeNs && left.ctimeNs === right.ctimeNs), "Plugin filesystem entry changed during access");
|
|
48478
48656
|
}
|
|
48479
48657
|
function ancestors(path, create = false) {
|
|
48480
|
-
|
|
48658
|
+
canonical5(path);
|
|
48481
48659
|
const result = [], parent = dirname10(path), filesystemRoot = parse9(parent).root;
|
|
48482
48660
|
let current = filesystemRoot;
|
|
48483
48661
|
for (const segment of ["", ...parent.slice(filesystemRoot.length).split("/").filter(Boolean)]) {
|
|
@@ -49055,21 +49233,21 @@ var init_plugin_discovery = __esm(() => {
|
|
|
49055
49233
|
});
|
|
49056
49234
|
|
|
49057
49235
|
// src/lib/claude-marketplace-registry.ts
|
|
49058
|
-
import { createHash as
|
|
49236
|
+
import { createHash as createHash13 } from "crypto";
|
|
49059
49237
|
import { closeSync as closeSync12, constants as constants9, fstatSync as fstatSync12, lstatSync as lstatSync14, openSync as openSync12, readSync as readSync8 } from "fs";
|
|
49060
49238
|
import { basename as basename6, dirname as dirname12, isAbsolute as isAbsolute12, resolve as resolve12 } from "path";
|
|
49061
|
-
function
|
|
49239
|
+
function need5(value, reason) {
|
|
49062
49240
|
if (!value)
|
|
49063
49241
|
throw new Error(`Claude marketplace registry ${reason}`);
|
|
49064
49242
|
}
|
|
49065
49243
|
function absolutePath2(value) {
|
|
49066
|
-
|
|
49244
|
+
need5(typeof value === "string" && value.length > 0 && value.length <= CLAUDE_MARKETPLACE_REGISTRY_LIMITS.pathCharacters && !/[\x00-\x1f\x7f]/.test(value) && isAbsolute12(value) && resolve12(value) === value, "requires a normalized absolute path");
|
|
49067
49245
|
}
|
|
49068
49246
|
function parents2(path) {
|
|
49069
49247
|
const result = [];
|
|
49070
49248
|
for (let at = dirname12(path);; at = dirname12(at)) {
|
|
49071
49249
|
const stat2 = lstatSync14(at, { bigint: true });
|
|
49072
|
-
|
|
49250
|
+
need5(stat2.isDirectory() && !stat2.isSymbolicLink(), "path traverses a symlink or non-directory");
|
|
49073
49251
|
result.push([at, stat2]);
|
|
49074
49252
|
if (at === dirname12(at))
|
|
49075
49253
|
return result;
|
|
@@ -49077,15 +49255,15 @@ function parents2(path) {
|
|
|
49077
49255
|
}
|
|
49078
49256
|
function readRegistry2(path, budget) {
|
|
49079
49257
|
absolutePath2(path);
|
|
49080
|
-
|
|
49081
|
-
|
|
49258
|
+
need5(basename6(path) === "known_marketplaces.json", "requires known_marketplaces.json");
|
|
49259
|
+
need5(Number.isSafeInteger(budget.remaining) && budget.remaining >= 0, "has an invalid byte budget");
|
|
49082
49260
|
const ancestors2 = parents2(path), initial = lstatSync14(path, { bigint: true });
|
|
49083
|
-
|
|
49084
|
-
|
|
49261
|
+
need5(initial.isFile() && !initial.isSymbolicLink() && initial.size <= BigInt(CLAUDE_MARKETPLACE_REGISTRY_LIMITS.bytes), "is not a bounded regular file");
|
|
49262
|
+
need5(initial.size <= BigInt(budget.remaining), "exceeds its aggregate byte limit");
|
|
49085
49263
|
const fd = openSync12(path, constants9.O_RDONLY | constants9.O_NOFOLLOW | constants9.O_NONBLOCK);
|
|
49086
49264
|
try {
|
|
49087
49265
|
const opened = fstatSync12(fd, { bigint: true });
|
|
49088
|
-
|
|
49266
|
+
need5(opened.isFile() && sameFile2(initial, opened), "changed during open");
|
|
49089
49267
|
const bytes = Buffer.alloc(Number(opened.size) + 1);
|
|
49090
49268
|
let length = 0;
|
|
49091
49269
|
while (length < bytes.length) {
|
|
@@ -49095,10 +49273,10 @@ function readRegistry2(path, budget) {
|
|
|
49095
49273
|
length += count;
|
|
49096
49274
|
}
|
|
49097
49275
|
const after = fstatSync12(fd, { bigint: true }), current = lstatSync14(path, { bigint: true });
|
|
49098
|
-
|
|
49276
|
+
need5(current.isFile() && sameFile2(opened, after) && sameFile2(after, current) && BigInt(length) === opened.size, "changed during read");
|
|
49099
49277
|
for (const [ancestor, before] of ancestors2) {
|
|
49100
49278
|
const now = lstatSync14(ancestor, { bigint: true });
|
|
49101
|
-
|
|
49279
|
+
need5(now.isDirectory() && before.dev === now.dev && before.ino === now.ino && before.mode === now.mode, "parent changed during read");
|
|
49102
49280
|
}
|
|
49103
49281
|
budget.remaining -= length;
|
|
49104
49282
|
try {
|
|
@@ -49118,7 +49296,7 @@ function parse10(text2) {
|
|
|
49118
49296
|
at++;
|
|
49119
49297
|
};
|
|
49120
49298
|
function string5() {
|
|
49121
|
-
|
|
49299
|
+
need5(text2[at] === '"', "contains invalid JSON");
|
|
49122
49300
|
const start = at++;
|
|
49123
49301
|
while (at < text2.length) {
|
|
49124
49302
|
const character = text2[at++];
|
|
@@ -49129,7 +49307,7 @@ function parse10(text2) {
|
|
|
49129
49307
|
} catch {
|
|
49130
49308
|
throw new Error("Claude marketplace registry contains invalid JSON string");
|
|
49131
49309
|
}
|
|
49132
|
-
|
|
49310
|
+
need5(value2.length <= CLAUDE_MARKETPLACE_REGISTRY_LIMITS.stringCharacters, "exceeds its string limit");
|
|
49133
49311
|
return value2;
|
|
49134
49312
|
}
|
|
49135
49313
|
if (character === "\\")
|
|
@@ -49138,7 +49316,7 @@ function parse10(text2) {
|
|
|
49138
49316
|
throw new Error("Claude marketplace registry contains an unterminated JSON string");
|
|
49139
49317
|
}
|
|
49140
49318
|
function value(depth) {
|
|
49141
|
-
|
|
49319
|
+
need5(depth <= CLAUDE_MARKETPLACE_REGISTRY_LIMITS.depth && ++nodes <= CLAUDE_MARKETPLACE_REGISTRY_LIMITS.nodes, "exceeds its nesting or node limit");
|
|
49142
49320
|
space();
|
|
49143
49321
|
const character = text2[at];
|
|
49144
49322
|
if (character === '"')
|
|
@@ -49152,17 +49330,17 @@ function parse10(text2) {
|
|
|
49152
49330
|
if (object7) {
|
|
49153
49331
|
space();
|
|
49154
49332
|
const key = string5();
|
|
49155
|
-
|
|
49333
|
+
need5(!keys.has(key), "contains a duplicate JSON key");
|
|
49156
49334
|
keys.add(key);
|
|
49157
49335
|
space();
|
|
49158
|
-
|
|
49336
|
+
need5(text2[at++] === ":", "contains invalid JSON");
|
|
49159
49337
|
entries.push([key, value(depth + 1)]);
|
|
49160
49338
|
} else
|
|
49161
49339
|
items.push(value(depth + 1));
|
|
49162
49340
|
space();
|
|
49163
49341
|
if (text2[at] === end)
|
|
49164
49342
|
break;
|
|
49165
|
-
|
|
49343
|
+
need5(text2[at++] === ",", "contains invalid JSON");
|
|
49166
49344
|
}
|
|
49167
49345
|
at++;
|
|
49168
49346
|
return object7 ? { kind: "object", entries } : { kind: "array", items };
|
|
@@ -49174,21 +49352,21 @@ function parse10(text2) {
|
|
|
49174
49352
|
}
|
|
49175
49353
|
numberPattern.lastIndex = at;
|
|
49176
49354
|
const number5 = numberPattern.exec(text2);
|
|
49177
|
-
|
|
49355
|
+
need5(number5, "contains invalid JSON");
|
|
49178
49356
|
at += number5[0].length;
|
|
49179
49357
|
return { kind: "number", value: number5[0] };
|
|
49180
49358
|
}
|
|
49181
49359
|
const root = value(0);
|
|
49182
49360
|
space();
|
|
49183
|
-
|
|
49184
|
-
|
|
49361
|
+
need5(at === text2.length && root.kind === "object", "requires a JSON object without trailing content");
|
|
49362
|
+
need5(root.entries.length <= CLAUDE_MARKETPLACE_REGISTRY_LIMITS.rows, "exceeds its marketplace row limit");
|
|
49185
49363
|
return root;
|
|
49186
49364
|
}
|
|
49187
49365
|
function exactKeys(value, keys) {
|
|
49188
49366
|
return value?.kind === "object" && value.entries.length === keys.length && value.entries.every(([key]) => keys.includes(key));
|
|
49189
49367
|
}
|
|
49190
49368
|
function textField(value) {
|
|
49191
|
-
|
|
49369
|
+
need5(value?.kind === "string" && value.value.length > 0 && !/[\x00-\x1f\x7f]/.test(value.value), "contains an invalid recognized field");
|
|
49192
49370
|
return value.value;
|
|
49193
49371
|
}
|
|
49194
49372
|
function normalizeRow(row, version2 = 1) {
|
|
@@ -49196,7 +49374,7 @@ function normalizeRow(row, version2 = 1) {
|
|
|
49196
49374
|
if (version2 !== 2 || !exactKeys(row, ["source", "installLocation", "lastUpdated", "autoUpdate"]))
|
|
49197
49375
|
return;
|
|
49198
49376
|
const autoUpdate = field(row, "autoUpdate");
|
|
49199
|
-
|
|
49377
|
+
need5(autoUpdate?.kind === "literal" && (autoUpdate.value === "true" || autoUpdate.value === "false"), "contains an invalid automatic-update preference");
|
|
49200
49378
|
}
|
|
49201
49379
|
const source = field(row, "source");
|
|
49202
49380
|
if (source?.kind !== "object")
|
|
@@ -49212,23 +49390,23 @@ function normalizeRow(row, version2 = 1) {
|
|
|
49212
49390
|
absolutePath2(sourceLocation);
|
|
49213
49391
|
absolutePath2(textField(field(row, "installLocation")));
|
|
49214
49392
|
const updated = textField(field(row, "lastUpdated"));
|
|
49215
|
-
|
|
49393
|
+
need5(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(updated), "contains an invalid recognized update timestamp");
|
|
49216
49394
|
const millis = Date.parse(updated);
|
|
49217
|
-
|
|
49395
|
+
need5(Number.isFinite(millis) && new Date(millis).toISOString() === updated, "contains an invalid recognized update timestamp");
|
|
49218
49396
|
row.entries = row.entries.map(([key, value]) => [key, key === "lastUpdated" ? { kind: "validated-update-time" } : value]);
|
|
49219
49397
|
}
|
|
49220
49398
|
function captureClaudeMarketplaceRegistry(path, budget = { remaining: 256 * 1024 * 1024 }) {
|
|
49221
49399
|
const value = parse10(readRegistry2(path, budget));
|
|
49222
49400
|
for (const [, row] of value.entries)
|
|
49223
49401
|
normalizeRow(row);
|
|
49224
|
-
const sha2562 =
|
|
49402
|
+
const sha2562 = createHash13("sha256").update("hasna.skills.claude-marketplace-registry.v1\x00").update(JSON.stringify(value)).digest("hex");
|
|
49225
49403
|
return { path, hashMode: "claude-marketplace-registry", sha256: sha2562 };
|
|
49226
49404
|
}
|
|
49227
49405
|
function captureClaudeMarketplaceRegistryV2(path, budget = { remaining: 256 * 1024 * 1024 }) {
|
|
49228
49406
|
const value = parse10(readRegistry2(path, budget));
|
|
49229
49407
|
for (const [, row] of value.entries)
|
|
49230
49408
|
normalizeRow(row, 2);
|
|
49231
|
-
const sha2562 =
|
|
49409
|
+
const sha2562 = createHash13("sha256").update("hasna.skills.claude-marketplace-registry.v2\x00").update(JSON.stringify(value)).digest("hex");
|
|
49232
49410
|
return { path, hashMode: "claude-marketplace-registry-v2", sha256: sha2562 };
|
|
49233
49411
|
}
|
|
49234
49412
|
var CLAUDE_MARKETPLACE_REGISTRY_LIMITS, sameFile2 = (a, b) => a.dev === b.dev && a.ino === b.ino && a.mode === b.mode && a.uid === b.uid && a.gid === b.gid && a.nlink === b.nlink && a.size === b.size && a.mtimeNs === b.mtimeNs && a.ctimeNs === b.ctimeNs, field = (object7, key) => object7.entries.find(([name]) => name === key)?.[1];
|
|
@@ -49238,17 +49416,17 @@ var init_claude_marketplace_registry = __esm(() => {
|
|
|
49238
49416
|
|
|
49239
49417
|
// src/lib/codex-hook-trust-files.ts
|
|
49240
49418
|
import { closeSync as closeSync13, constants as constants10, fstatSync as fstatSync13, fsyncSync as fsyncSync3, lstatSync as lstatSync15, openSync as openSync13, readSync as readSync9, writeFileSync as writeFileSync5 } from "fs";
|
|
49241
|
-
import { createHash as
|
|
49419
|
+
import { createHash as createHash14 } from "crypto";
|
|
49242
49420
|
import { dirname as dirname13 } from "path";
|
|
49243
|
-
function
|
|
49421
|
+
function need6(value, code) {
|
|
49244
49422
|
if (!value)
|
|
49245
49423
|
throw new Error(`CODEX_HOOK_TRUST_${code}`);
|
|
49246
49424
|
}
|
|
49247
49425
|
function safeParents(file2) {
|
|
49248
49426
|
for (let p = dirname13(file2);; p = dirname13(p)) {
|
|
49249
49427
|
const s = lstatSync15(p);
|
|
49250
|
-
|
|
49251
|
-
|
|
49428
|
+
need6(s.isDirectory() && !s.isSymbolicLink(), "UNSAFE_PARENT");
|
|
49429
|
+
need6((s.mode & 18) === 0 || s.uid === 0 && (s.mode & 512) !== 0, "UNSAFE_PARENT");
|
|
49252
49430
|
if (dirname13(p) === p)
|
|
49253
49431
|
break;
|
|
49254
49432
|
}
|
|
@@ -49257,12 +49435,12 @@ function snapshot(file2, privateFile = false, options = {}) {
|
|
|
49257
49435
|
const readOnlyPackage = options.readOnlyPackage === true && !privateFile;
|
|
49258
49436
|
safeParents(file2);
|
|
49259
49437
|
const initial = lstatSync15(file2, { bigint: true });
|
|
49260
|
-
|
|
49261
|
-
|
|
49438
|
+
need6(initial.isFile() && initial.uid === BigInt(process.getuid()) && (initial.nlink === 1n || readOnlyPackage && initial.nlink > 1n) && (initial.mode & 0o022n) === 0n && (!privateFile || (initial.mode & 0o777n) === 0o600n), "UNSAFE_FILE");
|
|
49439
|
+
need6(initial.size <= 8n * 1024n * 1024n, "FILE_BOUND");
|
|
49262
49440
|
const fd = openSync13(file2, constants10.O_RDONLY | constants10.O_NOFOLLOW | constants10.O_NONBLOCK);
|
|
49263
49441
|
try {
|
|
49264
49442
|
const before = fstatSync13(fd, { bigint: true });
|
|
49265
|
-
|
|
49443
|
+
need6(sameStat(initial, before), "INPUT_CHANGED");
|
|
49266
49444
|
const bytes = Buffer.alloc(Number(before.size) + 1);
|
|
49267
49445
|
let length = 0;
|
|
49268
49446
|
while (length < bytes.length) {
|
|
@@ -49271,16 +49449,16 @@ function snapshot(file2, privateFile = false, options = {}) {
|
|
|
49271
49449
|
break;
|
|
49272
49450
|
length += n2;
|
|
49273
49451
|
}
|
|
49274
|
-
|
|
49452
|
+
need6(length === Number(before.size) && sameStat(before, fstatSync13(fd, { bigint: true })) && sameStat(before, lstatSync15(file2, { bigint: true })), "INPUT_CHANGED");
|
|
49275
49453
|
const content = bytes.subarray(0, length), text2 = new TextDecoder("utf-8", { fatal: true }).decode(content);
|
|
49276
|
-
return { file: file2, privateFile, readOnlyPackage, text: text2, bytes: content, stat: before, sha256:
|
|
49454
|
+
return { file: file2, privateFile, readOnlyPackage, text: text2, bytes: content, stat: before, sha256: createHash14("sha256").update(content).digest("hex") };
|
|
49277
49455
|
} finally {
|
|
49278
49456
|
closeSync13(fd);
|
|
49279
49457
|
}
|
|
49280
49458
|
}
|
|
49281
49459
|
function unchanged2(before) {
|
|
49282
49460
|
const after = snapshot(before.file, before.privateFile, before.readOnlyPackage ? { readOnlyPackage: true } : {});
|
|
49283
|
-
|
|
49461
|
+
need6(sameStat(before.stat, after.stat) && after.sha256 === before.sha256, "INPUT_CHANGED");
|
|
49284
49462
|
}
|
|
49285
49463
|
var sameStat = (a, b) => ["dev", "ino", "uid", "nlink", "mode", "size", "mtimeNs", "ctimeNs"].every((key) => a[key] === b[key]);
|
|
49286
49464
|
var init_codex_hook_trust_files = () => {};
|
|
@@ -49299,10 +49477,10 @@ var init_codex_hook_additions_review = __esm(() => {
|
|
|
49299
49477
|
});
|
|
49300
49478
|
|
|
49301
49479
|
// src/lib/codex-hook-discovery-recovery.ts
|
|
49302
|
-
import { createHash as
|
|
49480
|
+
import { createHash as createHash15 } from "crypto";
|
|
49303
49481
|
function assertCodexHookDiscoveryRecovery(binding, witness) {
|
|
49304
49482
|
const proof = proofs2.get(witness);
|
|
49305
|
-
|
|
49483
|
+
need6(!!proof && binding.agent === "codex" && witness.discoverySha256 === sha3(JSON.stringify(binding)), "RECONCILE_DISCOVERY_RECOVERY_CHANGED");
|
|
49306
49484
|
unchanged2(proof.before);
|
|
49307
49485
|
unchanged2(proof.current);
|
|
49308
49486
|
proof.recheckAdditions();
|
|
@@ -49311,19 +49489,21 @@ function verifiesCodexHookDiscoverySource(binding, source, currentDigest, witnes
|
|
|
49311
49489
|
if (!witness || source.path !== witness.configPath || source.hashMode !== "bytes")
|
|
49312
49490
|
return false;
|
|
49313
49491
|
assertCodexHookDiscoveryRecovery(binding, witness);
|
|
49314
|
-
|
|
49492
|
+
need6(source.sha256 === witness.beforeSha256 && currentDigest === witness.currentSha256, "RECONCILE_DISCOVERY_RECOVERY_CHANGED");
|
|
49315
49493
|
return true;
|
|
49316
49494
|
}
|
|
49317
|
-
var
|
|
49495
|
+
var sha3 = (text2) => createHash15("sha256").update(text2).digest("hex"), fields, proofs2;
|
|
49318
49496
|
var init_codex_hook_discovery_recovery = __esm(() => {
|
|
49319
49497
|
init_codex_hook_trust_files();
|
|
49320
49498
|
init_codex_hook_trust_layout();
|
|
49321
49499
|
init_codex_hook_additions_review();
|
|
49500
|
+
init_codex_settings_witness();
|
|
49501
|
+
fields = [...CODEX_DISCOVERY_PROJECTION_FIELDS];
|
|
49322
49502
|
proofs2 = new WeakMap;
|
|
49323
49503
|
});
|
|
49324
49504
|
|
|
49325
49505
|
// src/lib/agent-discovery.ts
|
|
49326
|
-
import { createHash as
|
|
49506
|
+
import { createHash as createHash16 } from "crypto";
|
|
49327
49507
|
import { lstatSync as lstatSync16, readFileSync as readFileSync15, readdirSync as readdirSync6, realpathSync as realpathSync3 } from "fs";
|
|
49328
49508
|
import { basename as basename7, dirname as dirname14, isAbsolute as isAbsolute13, join as join23, resolve as resolve13, sep as sep4 } from "path";
|
|
49329
49509
|
import { isDeepStrictEqual as isDeepStrictEqual2 } from "util";
|
|
@@ -49358,14 +49538,26 @@ function read(path, changes) {
|
|
|
49358
49538
|
throw new Error(`Unsupported or oversized native discovery input: ${path}`);
|
|
49359
49539
|
return readFileSync15(path, "utf8");
|
|
49360
49540
|
}
|
|
49541
|
+
function projectNativeDiscoveryFields(text2, format, fields2, path) {
|
|
49542
|
+
const object7 = format === "yaml" ? parseHermesConfig(text2) : parseConfig(text2, path, format === "toml");
|
|
49543
|
+
if (!object7 || typeof object7 !== "object" || Array.isArray(object7))
|
|
49544
|
+
throw new Error("Expected native discovery configuration object");
|
|
49545
|
+
return digest(JSON.stringify(Object.fromEntries(fields2.map((field2) => [field2, object7[field2] ?? null]))));
|
|
49546
|
+
}
|
|
49547
|
+
function isSupersededCodexProjection(agent, configPath, source) {
|
|
49548
|
+
return agent === "codex" && source.path === configPath && source.format === "toml" && isDeepStrictEqual2(source.fields, [...CODEX_DISCOVERY_PROJECTION_FIELDS]);
|
|
49549
|
+
}
|
|
49550
|
+
function supersedesCodexProjection(sources, configPath) {
|
|
49551
|
+
return sources.some((source) => source.path === configPath && source.hashMode === "codex-settings-v2");
|
|
49552
|
+
}
|
|
49361
49553
|
function projected(source, changes, budget = discoveryByteBudget()) {
|
|
49362
|
-
if (source.hashMode === "codex-settings-v1") {
|
|
49554
|
+
if (source.hashMode === "codex-settings-v1" || source.hashMode === "codex-settings-v2") {
|
|
49363
49555
|
if (source.format !== undefined || source.fields !== undefined || source.managedPlugins !== undefined || typeof source.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(source.sha256))
|
|
49364
49556
|
throw new Error("Codex settings witnesses require exact typed metadata");
|
|
49365
|
-
const current = captureCodexSettings(source.path, budget).sha256;
|
|
49557
|
+
const current = (source.hashMode === "codex-settings-v2" ? captureCodexSettingsV2 : captureCodexSettings)(source.path, budget).sha256;
|
|
49366
49558
|
if (current !== source.sha256)
|
|
49367
49559
|
throw new Error(`Native discovery input changed; run skills hook install with a fresh discovery review: ${source.path}`);
|
|
49368
|
-
return changes?.has(source.path) ? hashCodexSettingsReplacement(changes.get(source.path), budget) : current;
|
|
49560
|
+
return changes?.has(source.path) ? (source.hashMode === "codex-settings-v2" ? hashCodexSettingsReplacementV2 : hashCodexSettingsReplacement)(changes.get(source.path), budget) : current;
|
|
49369
49561
|
}
|
|
49370
49562
|
if (source.hashMode === "claude-settings-v1" || source.hashMode === "claude-settings-v2" || source.hashMode === "claude-settings-v3") {
|
|
49371
49563
|
if (source.format !== undefined || source.fields !== undefined || source.managedPlugins !== undefined || typeof source.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(source.sha256))
|
|
@@ -49404,10 +49596,7 @@ function projected(source, changes, budget = discoveryByteBudget()) {
|
|
|
49404
49596
|
return null;
|
|
49405
49597
|
if (!source.format)
|
|
49406
49598
|
return digest(text2);
|
|
49407
|
-
|
|
49408
|
-
if (!object7 || typeof object7 !== "object" || Array.isArray(object7))
|
|
49409
|
-
throw new Error("Expected native discovery configuration object");
|
|
49410
|
-
return digest(JSON.stringify(Object.fromEntries((source.fields ?? []).map((field2) => [field2, object7[field2] ?? null]))));
|
|
49599
|
+
return projectNativeDiscoveryFields(text2, source.format, source.fields ?? [], source.path);
|
|
49411
49600
|
}
|
|
49412
49601
|
function verifyAgentDiscovery(binding, codexRecovery) {
|
|
49413
49602
|
if (codexRecovery)
|
|
@@ -49435,7 +49624,7 @@ function verifyAgentDiscovery(binding, codexRecovery) {
|
|
|
49435
49624
|
safe4(root);
|
|
49436
49625
|
}
|
|
49437
49626
|
function assertMarketplaceBinding(binding, source) {
|
|
49438
|
-
if (source.hashMode === "codex-settings-v1" && (binding.agent !== "codex" || binding.method !== "reviewed" || basename7(source.path) !== "config.toml"))
|
|
49627
|
+
if ((source.hashMode === "codex-settings-v1" || source.hashMode === "codex-settings-v2") && (binding.agent !== "codex" || binding.method !== "reviewed" || basename7(source.path) !== "config.toml"))
|
|
49439
49628
|
throw new Error("Codex settings witnesses require explicit reviewed Codex configuration");
|
|
49440
49629
|
if ((source.hashMode === "claude-settings-v1" || source.hashMode === "claude-settings-v2" || source.hashMode === "claude-settings-v3") && (binding.agent !== "claude" || binding.method !== "reviewed" || basename7(source.path) !== "settings.json"))
|
|
49441
49630
|
throw new Error("Claude settings witnesses require explicit reviewed Claude configuration");
|
|
@@ -49446,10 +49635,10 @@ function agentDiscoveryConfigPath(home, agent) {
|
|
|
49446
49635
|
return join23(home, agent === "hermes" ? ".hermes/config.yaml" : agent === "opencode" ? ".config/opencode/opencode.json" : `.${agent}/${agent === "codex" ? "config.toml" : agent === "cursor" ? "hooks.json" : "settings.json"}`);
|
|
49447
49636
|
}
|
|
49448
49637
|
function resolveAgentDiscovery(options) {
|
|
49449
|
-
const
|
|
49638
|
+
const canonical6 = options.canonical ?? resolve13, home = resolve13(options.home), agent = options.agent;
|
|
49450
49639
|
const sources = [], roots = new Set, builtinNames = [];
|
|
49451
|
-
const witness = (path, format,
|
|
49452
|
-
const source = { path:
|
|
49640
|
+
const witness = (path, format, fields2) => {
|
|
49641
|
+
const source = { path: canonical6(path), sha256: null, ...format ? { format, fields: fields2 } : {} };
|
|
49453
49642
|
source.sha256 = projected(source);
|
|
49454
49643
|
sources.push(source);
|
|
49455
49644
|
return read(source.path);
|
|
@@ -49457,7 +49646,7 @@ function resolveAgentDiscovery(options) {
|
|
|
49457
49646
|
if (agent === "hermes")
|
|
49458
49647
|
assertHermesEnvironment(home);
|
|
49459
49648
|
const configPath = agentDiscoveryConfigPath(home, agent);
|
|
49460
|
-
const configText = witness(configPath, agent === "hermes" ? "yaml" : agent === "codex" ? "toml" : "json", agent === "hermes" ? ["skills", "plugins", "hooks"] : agent === "claude" ? ["enabledPlugins", "extraKnownMarketplaces"] : agent === "codex" ? [
|
|
49649
|
+
const configText = witness(configPath, agent === "hermes" ? "yaml" : agent === "codex" ? "toml" : "json", agent === "hermes" ? ["skills", "plugins", "hooks"] : agent === "claude" ? ["enabledPlugins", "extraKnownMarketplaces"] : agent === "codex" ? [...CODEX_DISCOVERY_PROJECTION_FIELDS] : agent === "gemini" ? ["skills", "extensions", "security"] : agent === "opencode" ? ["plugin", "skills"] : ["version"]);
|
|
49461
49650
|
const config2 = configText === null ? {} : agent === "hermes" ? parseHermesConfig(configText) : parseConfig(configText, configPath, agent === "codex");
|
|
49462
49651
|
const unresolved = (detail) => {
|
|
49463
49652
|
throw new Error(`Native discovery is unresolved (${agent}: ${detail}); provide a reviewed --discovery-inputs file`);
|
|
@@ -49516,11 +49705,12 @@ function resolveAgentDiscovery(options) {
|
|
|
49516
49705
|
if (retained.agent !== agent || retained.method !== "reviewed")
|
|
49517
49706
|
unresolved("invalid retained review");
|
|
49518
49707
|
verifyAgentDiscovery(retained);
|
|
49519
|
-
if (!retained.sources.some((source) => source.path ===
|
|
49708
|
+
if (!retained.sources.some((source) => source.path === canonical6(configPath) && source.format === undefined && source.fields === undefined))
|
|
49520
49709
|
unresolved("retained review is missing the full agent configuration source");
|
|
49521
|
-
if (retained.sources.some((source) => (source.hashMode === "claude-settings-v1" || source.hashMode === "claude-settings-v2" || (source.hashMode === "claude-settings-v3" || source.hashMode === "codex-settings-v1")) && source.path !==
|
|
49710
|
+
if (retained.sources.some((source) => (source.hashMode === "claude-settings-v1" || source.hashMode === "claude-settings-v2" || (source.hashMode === "claude-settings-v3" || (source.hashMode === "codex-settings-v1" || source.hashMode === "codex-settings-v2"))) && source.path !== canonical6(configPath)))
|
|
49522
49711
|
unresolved("retained settings witness names another configuration source");
|
|
49523
|
-
|
|
49712
|
+
const covered = supersedesCodexProjection(retained.sources, canonical6(configPath)) ? sources.filter((source) => !isSupersededCodexProjection(agent, canonical6(configPath), source)) : sources;
|
|
49713
|
+
if (covered.some((source) => !retained.sources.some((saved) => isDeepStrictEqual2(saved, source))) || [...roots].some((root) => !retained.roots.includes(root)) || agent === "gemini" && JSON.stringify(retained.builtinNames) !== JSON.stringify(builtinNames))
|
|
49524
49714
|
unresolved("retained review is missing current runtime discovery coverage");
|
|
49525
49715
|
return retained;
|
|
49526
49716
|
}
|
|
@@ -49534,14 +49724,15 @@ function resolveAgentDiscovery(options) {
|
|
|
49534
49724
|
if (review.sources.some((source) => source.format !== undefined || source.fields !== undefined))
|
|
49535
49725
|
throw new Error("Explicit discovery reviews require full source-file hashes");
|
|
49536
49726
|
verifyAgentDiscovery(supplied);
|
|
49537
|
-
if (review.sources.some((source) => (source.hashMode === "claude-settings-v1" || source.hashMode === "claude-settings-v2" || (source.hashMode === "claude-settings-v3" || source.hashMode === "codex-settings-v1")) && source.path !==
|
|
49727
|
+
if (review.sources.some((source) => (source.hashMode === "claude-settings-v1" || source.hashMode === "claude-settings-v2" || (source.hashMode === "claude-settings-v3" || (source.hashMode === "codex-settings-v1" || source.hashMode === "codex-settings-v2"))) && source.path !== canonical6(configPath)))
|
|
49538
49728
|
throw new Error("Semantic settings witnesses must name the configured Claude configuration source");
|
|
49539
|
-
if (!review.sources.some((source) => source.path ===
|
|
49729
|
+
if (!review.sources.some((source) => source.path === canonical6(configPath)))
|
|
49540
49730
|
throw new Error("Discovery review must include the agent configuration source");
|
|
49541
|
-
|
|
49731
|
+
const reviewedSources = supersedesCodexProjection(review.sources, canonical6(configPath)) ? sources.filter((source) => !isSupersededCodexProjection(agent, canonical6(configPath), source)) : sources;
|
|
49732
|
+
return { ...supplied, roots: [...new Set([...roots, ...supplied.roots])].sort(), sources: [...reviewedSources, ...review.sources], ...agent === "gemini" ? { builtinNames } : {} };
|
|
49542
49733
|
}
|
|
49543
49734
|
function plugin(root) {
|
|
49544
|
-
root =
|
|
49735
|
+
root = canonical6(root);
|
|
49545
49736
|
safe4(root);
|
|
49546
49737
|
const manifestPath = join23(root, agent === "claude" ? ".claude-plugin/plugin.json" : ".codex-plugin/plugin.json");
|
|
49547
49738
|
const raw = witness(manifestPath);
|
|
@@ -49573,7 +49764,7 @@ function resolveAgentDiscovery(options) {
|
|
|
49573
49764
|
if (agent === "claude") {
|
|
49574
49765
|
const registrations = witness(join23(home, ".claude/plugins/installed_plugins.json"));
|
|
49575
49766
|
const installed = registrations === null ? {} : parseConfig(registrations, join23(home, ".claude/plugins/installed_plugins.json")).plugins;
|
|
49576
|
-
const commands =
|
|
49767
|
+
const commands = canonical6(join23(home, ".claude/commands"));
|
|
49577
49768
|
safe4(commands);
|
|
49578
49769
|
if (lstatSync16(commands, { throwIfNoEntry: false })?.isDirectory() && readdirSync6(commands).length)
|
|
49579
49770
|
unresolved("legacy home command discovery requires a dedicated format adapter");
|
|
@@ -49647,9 +49838,9 @@ function resolveAgentDiscovery(options) {
|
|
|
49647
49838
|
roots.add(join23(root, "skills"));
|
|
49648
49839
|
}
|
|
49649
49840
|
}
|
|
49650
|
-
return { agent, roots: [...roots].sort(), sources, method: "automatic", ...agent === "gemini" ? { builtinNames } : {}, ...agent === "hermes" ? { directories: captureDiscoveryDirectories([join23(home, ".hermes/plugins"), join23(home, ".hermes/hermes-agent")].map((path) =>
|
|
49841
|
+
return { agent, roots: [...roots].sort(), sources, method: "automatic", ...agent === "gemini" ? { builtinNames } : {}, ...agent === "hermes" ? { directories: captureDiscoveryDirectories([join23(home, ".hermes/plugins"), join23(home, ".hermes/hermes-agent")].map((path) => canonical6(path))) } : {} };
|
|
49651
49842
|
}
|
|
49652
|
-
var digest = (text2) =>
|
|
49843
|
+
var digest = (text2) => createHash16("sha256").update(text2).digest("hex");
|
|
49653
49844
|
var init_agent_discovery = __esm(() => {
|
|
49654
49845
|
init_agent_policy_limits();
|
|
49655
49846
|
init_agent_hermes();
|
|
@@ -49782,7 +49973,7 @@ import {
|
|
|
49782
49973
|
statSync as statSync7,
|
|
49783
49974
|
writeFileSync as writeFileSync6
|
|
49784
49975
|
} from "fs";
|
|
49785
|
-
import { basename as basename9, dirname as dirname16, isAbsolute as isAbsolute14, join as join25, normalize as
|
|
49976
|
+
import { basename as basename9, dirname as dirname16, isAbsolute as isAbsolute14, join as join25, normalize as normalize3, relative as relative4, resolve as resolve15, sep as sep6 } from "path";
|
|
49786
49977
|
function getPortableSkillsRoot(options = {}) {
|
|
49787
49978
|
return resolvePortableSkillsRoot(options, true);
|
|
49788
49979
|
}
|
|
@@ -49897,7 +50088,7 @@ function assertDisjointImportPaths(source, destination) {
|
|
|
49897
50088
|
}
|
|
49898
50089
|
}
|
|
49899
50090
|
function portPortableSkill(sourcePath, options = {}) {
|
|
49900
|
-
const absoluteSource =
|
|
50091
|
+
const absoluteSource = normalize3(sourcePath);
|
|
49901
50092
|
if (!existsSync11(absoluteSource) || !statSync7(absoluteSource).isDirectory()) {
|
|
49902
50093
|
throw new Error(`Skill source directory not found: ${sourcePath}`);
|
|
49903
50094
|
}
|
|
@@ -50057,7 +50248,7 @@ function safeIsDirectory(path) {
|
|
|
50057
50248
|
function isSafeRelativePath2(value) {
|
|
50058
50249
|
if (!value.trim() || isAbsolute14(value))
|
|
50059
50250
|
return false;
|
|
50060
|
-
const normalized =
|
|
50251
|
+
const normalized = normalize3(value).replace(/\\/g, "/");
|
|
50061
50252
|
return normalized !== ".." && !normalized.startsWith("../") && !normalized.includes("/../");
|
|
50062
50253
|
}
|
|
50063
50254
|
function add3(target, code, message) {
|
|
@@ -50726,7 +50917,7 @@ var init_remote_customer_operations = __esm(() => {
|
|
|
50726
50917
|
});
|
|
50727
50918
|
|
|
50728
50919
|
// src/lib/canonical-json.ts
|
|
50729
|
-
import { createHash as
|
|
50920
|
+
import { createHash as createHash17 } from "crypto";
|
|
50730
50921
|
function canonicalJson2(value, maximumBytes = 2 * 1024 * 1024) {
|
|
50731
50922
|
return canonicalJsonAtDepth(value, maximumBytes, 64);
|
|
50732
50923
|
}
|
|
@@ -50770,7 +50961,7 @@ function canonicalJsonAtDepth(value, maximumBytes, maximumDepth) {
|
|
|
50770
50961
|
return visit3(value, 0);
|
|
50771
50962
|
}
|
|
50772
50963
|
function canonicalJsonSha256(value, maximumBytes) {
|
|
50773
|
-
return
|
|
50964
|
+
return createHash17("sha256").update(canonicalJson2(value, maximumBytes)).digest("hex");
|
|
50774
50965
|
}
|
|
50775
50966
|
var init_canonical_json = () => {};
|
|
50776
50967
|
|
|
@@ -51551,7 +51742,7 @@ var init_auth_store = __esm(() => {
|
|
|
51551
51742
|
|
|
51552
51743
|
// src/lib/remote-run-contract.ts
|
|
51553
51744
|
function normalizeRemoteSkillRunContract(payload, fallbackSkill) {
|
|
51554
|
-
const record7 =
|
|
51745
|
+
const record7 = isRecord4(payload) ? payload : {};
|
|
51555
51746
|
return {
|
|
51556
51747
|
contractVersion: REMOTE_SKILL_RUN_CONTRACT_VERSION,
|
|
51557
51748
|
...pickString(record7, "id"),
|
|
@@ -51573,7 +51764,7 @@ function normalizeRemoteSkillRunContract(payload, fallbackSkill) {
|
|
|
51573
51764
|
...hasOwn(record7, "details") ? { details: record7.details } : {}
|
|
51574
51765
|
};
|
|
51575
51766
|
}
|
|
51576
|
-
function
|
|
51767
|
+
function isRecord4(value) {
|
|
51577
51768
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
51578
51769
|
}
|
|
51579
51770
|
function hasOwn(record7, key) {
|
|
@@ -51712,7 +51903,7 @@ var init_remote_credit_checkout = __esm(() => {
|
|
|
51712
51903
|
|
|
51713
51904
|
// src/lib/remote-profile.ts
|
|
51714
51905
|
function customerNamePatch(input2, field2) {
|
|
51715
|
-
if (!
|
|
51906
|
+
if (!isRecord5(input2) || Object.keys(input2).length !== 1 || !Object.hasOwn(input2, field2))
|
|
51716
51907
|
throw new Error("Provide only the requested name field.");
|
|
51717
51908
|
const value = input2[field2];
|
|
51718
51909
|
if (typeof value !== "string" || /[\p{Cc}\p{Cs}\u2028\u2029]/u.test(value) || !value.trim() || [...value.trim()].length > 100) {
|
|
@@ -51720,22 +51911,22 @@ function customerNamePatch(input2, field2) {
|
|
|
51720
51911
|
}
|
|
51721
51912
|
return { [field2]: value.trim() };
|
|
51722
51913
|
}
|
|
51723
|
-
function
|
|
51914
|
+
function isRecord5(value) {
|
|
51724
51915
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
51725
51916
|
}
|
|
51726
51917
|
function string5(value) {
|
|
51727
51918
|
return typeof value === "string" && value.length > 0;
|
|
51728
51919
|
}
|
|
51729
51920
|
function parseUpdatedProfile(value) {
|
|
51730
|
-
const user =
|
|
51731
|
-
if (!
|
|
51921
|
+
const user = isRecord5(value) && value.user;
|
|
51922
|
+
if (!isRecord5(user) || !string5(user.id) || !string5(user.email) || !(user.displayName === null || typeof user.displayName === "string") || typeof user.role !== "string" || !["owner", "admin", "member", "viewer"].includes(user.role)) {
|
|
51732
51923
|
throw new Error("The server returned an invalid account profile.");
|
|
51733
51924
|
}
|
|
51734
51925
|
return { user: { id: user.id, email: user.email, displayName: user.displayName, role: user.role } };
|
|
51735
51926
|
}
|
|
51736
51927
|
function parseUpdatedWorkspace(value) {
|
|
51737
|
-
const organization2 =
|
|
51738
|
-
if (!
|
|
51928
|
+
const organization2 = isRecord5(value) && value.organization;
|
|
51929
|
+
if (!isRecord5(organization2) || !string5(organization2.id) || !string5(organization2.slug) || !string5(organization2.name)) {
|
|
51739
51930
|
throw new Error("The server returned an invalid workspace.");
|
|
51740
51931
|
}
|
|
51741
51932
|
return { organization: { id: organization2.id, slug: organization2.slug, name: organization2.name } };
|
|
@@ -52996,7 +53187,7 @@ var init_remote_invitation_recovery = __esm(() => {
|
|
|
52996
53187
|
});
|
|
52997
53188
|
|
|
52998
53189
|
// src/lib/remote-private-publications.ts
|
|
52999
|
-
import { createHash as
|
|
53190
|
+
import { createHash as createHash18 } from "crypto";
|
|
53000
53191
|
function checkedPublicationDeclaration(value) {
|
|
53001
53192
|
if (!exact(value, ["idempotencyKey", "version", "expectedCurrentVersionId", "manifestText", "archiveSha256", "archiveByteSize"]) || !publicationUuid(value.idempotencyKey) || !(value.expectedCurrentVersionId === null || publicationUuid(value.expectedCurrentVersionId)) || typeof value.version !== "string" || !value.version || value.version.length > 128 || /[\p{Cc}\p{Cs}]/u.test(value.version) || typeof value.manifestText !== "string" || Buffer.byteLength(value.manifestText) > 16384 || !hash3(value.archiveSha256) || !Number.isSafeInteger(value.archiveByteSize) || Number(value.archiveByteSize) < 1 || Number(value.archiveByteSize) > PRIVATE_PUBLICATION_MAX_BYTES)
|
|
53002
53193
|
return bad();
|
|
@@ -53257,7 +53448,7 @@ var PRIVATE_PUBLICATION_MAX_BYTES, failures2, PrivatePublicationError, bad = ()
|
|
|
53257
53448
|
throw new PrivatePublicationError("INVALID_PUBLICATION_INPUT", "Invalid publication input or recovery data.");
|
|
53258
53449
|
}, invalid4 = () => {
|
|
53259
53450
|
throw new PrivatePublicationError("INVALID_PUBLICATION_RESPONSE", "The server returned an invalid publication result.");
|
|
53260
|
-
}, publicationUuid = (v) => typeof v === "string" && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(v), hash3 = (v) => typeof v === "string" && /^[a-f0-9]{64}$/.test(v), record9 = (v) => !!v && typeof v === "object" && !Array.isArray(v), exact = (v, keys) => record9(v) && Object.keys(v).sort().join(",") === keys.sort().join(","), date6 = (v) => typeof v === "string" && /^\d{4}-\d\d-\d\dT[0-9:.]+(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/.test(v) && Number.isFinite(Date.parse(v)), publicationSha256 = (bytes) =>
|
|
53451
|
+
}, publicationUuid = (v) => typeof v === "string" && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(v), hash3 = (v) => typeof v === "string" && /^[a-f0-9]{64}$/.test(v), record9 = (v) => !!v && typeof v === "object" && !Array.isArray(v), exact = (v, keys) => record9(v) && Object.keys(v).sort().join(",") === keys.sort().join(","), date6 = (v) => typeof v === "string" && /^\d{4}-\d\d-\d\dT[0-9:.]+(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/.test(v) && Number.isFinite(Date.parse(v)), publicationSha256 = (bytes) => createHash18("sha256").update(bytes).digest("hex");
|
|
53261
53452
|
var init_remote_private_publications = __esm(() => {
|
|
53262
53453
|
init_fleet_credentials();
|
|
53263
53454
|
init_remote_workspace_selection();
|
|
@@ -53321,7 +53512,7 @@ async function requestAuthApi(instance, path, options) {
|
|
|
53321
53512
|
const text3 = await res.text();
|
|
53322
53513
|
const body = text3 ? parseJsonBody(text3) : {};
|
|
53323
53514
|
if (!res.ok) {
|
|
53324
|
-
const record10 =
|
|
53515
|
+
const record10 = isRecord6(body) ? body : {};
|
|
53325
53516
|
const detail = typeof record10.detail === "string" ? record10.detail : undefined;
|
|
53326
53517
|
const error61 = typeof record10.error === "string" ? record10.error : undefined;
|
|
53327
53518
|
const code = typeof record10.code === "string" ? record10.code : undefined;
|
|
@@ -53349,7 +53540,7 @@ function condenseErrorBody(text3) {
|
|
|
53349
53540
|
return collapsed;
|
|
53350
53541
|
return `${collapsed.slice(0, MAX_ERROR_DETAIL_LENGTH - 1).trimEnd()}\u2026`;
|
|
53351
53542
|
}
|
|
53352
|
-
function
|
|
53543
|
+
function isRecord6(value) {
|
|
53353
53544
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
53354
53545
|
}
|
|
53355
53546
|
|
|
@@ -54035,7 +54226,7 @@ async function continueRecurringRecovery(customer, directory, options) {
|
|
|
54035
54226
|
throw error61;
|
|
54036
54227
|
}
|
|
54037
54228
|
}
|
|
54038
|
-
var uuid12,
|
|
54229
|
+
var uuid12, sha4, common, intentSchema, stateSchema, invalid5 = () => {
|
|
54039
54230
|
throw new RecurringCustomerError("RECURRING_RECOVERY_INVALID", "The original recovery directory or record is invalid or changed. Preserve it; do not create a replacement activation automatically.");
|
|
54040
54231
|
};
|
|
54041
54232
|
var init_recurring_recovery = __esm(() => {
|
|
@@ -54045,7 +54236,7 @@ var init_recurring_recovery = __esm(() => {
|
|
|
54045
54236
|
init_remote_recurring();
|
|
54046
54237
|
init_recurring_customer();
|
|
54047
54238
|
uuid12 = exports_external.string().regex(/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/);
|
|
54048
|
-
|
|
54239
|
+
sha4 = exports_external.string().regex(/^[a-f0-9]{64}$/);
|
|
54049
54240
|
common = exports_external.object({
|
|
54050
54241
|
contractVersion: exports_external.literal(1),
|
|
54051
54242
|
apiOrigin: exports_external.string().min(1).max(4096),
|
|
@@ -54058,7 +54249,7 @@ var init_recurring_recovery = __esm(() => {
|
|
|
54058
54249
|
common.extend({
|
|
54059
54250
|
operation: exports_external.literal("activate"),
|
|
54060
54251
|
draftId: uuid12,
|
|
54061
|
-
termsSha256:
|
|
54252
|
+
termsSha256: sha4,
|
|
54062
54253
|
approvalDeadline: exports_external.string().datetime(),
|
|
54063
54254
|
approval: recurringActivationSchema
|
|
54064
54255
|
}).strict(),
|
|
@@ -54066,7 +54257,7 @@ var init_recurring_recovery = __esm(() => {
|
|
|
54066
54257
|
]);
|
|
54067
54258
|
stateSchema = exports_external.object({
|
|
54068
54259
|
contractVersion: exports_external.literal(1),
|
|
54069
|
-
intentSha256:
|
|
54260
|
+
intentSha256: sha4,
|
|
54070
54261
|
phase: exports_external.enum(["prepared", "pending", "observed"]),
|
|
54071
54262
|
consentId: uuid12.nullable()
|
|
54072
54263
|
}).strict();
|
|
@@ -56007,7 +56198,7 @@ var init_credential_state = __esm(() => {
|
|
|
56007
56198
|
});
|
|
56008
56199
|
|
|
56009
56200
|
// src/lib/run-state.ts
|
|
56010
|
-
import { createHash as
|
|
56201
|
+
import { createHash as createHash19, randomBytes } from "crypto";
|
|
56011
56202
|
import { existsSync as existsSync14, mkdirSync as mkdirSync11, readFileSync as readFileSync19, readdirSync as readdirSync9, statSync as statSync9, writeFileSync as writeFileSync10 } from "fs";
|
|
56012
56203
|
import { extname, join as join29, relative as relative5 } from "path";
|
|
56013
56204
|
function createSkillRun(params, targetDir = process.cwd()) {
|
|
@@ -56122,7 +56313,7 @@ function collectRunArtifacts(context2) {
|
|
|
56122
56313
|
artifacts.push({
|
|
56123
56314
|
path: toProjectRelative(context2.targetDir, path),
|
|
56124
56315
|
mime: mimeForPath(path),
|
|
56125
|
-
sha256:
|
|
56316
|
+
sha256: createHash19("sha256").update(bytes).digest("hex"),
|
|
56126
56317
|
sizeBytes: stat3.size
|
|
56127
56318
|
});
|
|
56128
56319
|
}
|
|
@@ -56578,14 +56769,14 @@ function assertUsableCredential2(appName, source, value) {
|
|
|
56578
56769
|
return;
|
|
56579
56770
|
throw new CredentialResolutionError2(appName, `The credential from ${source} contains characters that cannot be sent in an HTTP header ` + `(a control character or non-ASCII byte). A file written with CR-only line endings is the usual ` + `cause. Rewrite that credential file with one LF-terminated KEY=value line. ` + `The value is not shown here, and is deliberately never logged.`, [source]);
|
|
56580
56771
|
}
|
|
56581
|
-
function sealCredential2(
|
|
56582
|
-
const { apiKey } =
|
|
56772
|
+
function sealCredential2(fields2) {
|
|
56773
|
+
const { apiKey } = fields2;
|
|
56583
56774
|
const visible = {
|
|
56584
|
-
tier:
|
|
56585
|
-
source:
|
|
56586
|
-
deliberate:
|
|
56587
|
-
diskCandidates: Object.freeze([...
|
|
56588
|
-
warning:
|
|
56775
|
+
tier: fields2.tier,
|
|
56776
|
+
source: fields2.source,
|
|
56777
|
+
deliberate: fields2.deliberate,
|
|
56778
|
+
diskCandidates: Object.freeze([...fields2.diskCandidates]),
|
|
56779
|
+
warning: fields2.warning
|
|
56589
56780
|
};
|
|
56590
56781
|
const sealed = { ...visible };
|
|
56591
56782
|
Object.defineProperty(sealed, "apiKey", {
|
|
@@ -56594,9 +56785,9 @@ function sealCredential2(fields) {
|
|
|
56594
56785
|
writable: false,
|
|
56595
56786
|
configurable: false
|
|
56596
56787
|
});
|
|
56597
|
-
if (
|
|
56788
|
+
if (fields2.pointerVaultKey !== undefined) {
|
|
56598
56789
|
Object.defineProperty(sealed, "pointerVaultKey", {
|
|
56599
|
-
value:
|
|
56790
|
+
value: fields2.pointerVaultKey,
|
|
56600
56791
|
enumerable: false,
|
|
56601
56792
|
writable: false,
|
|
56602
56793
|
configurable: false
|
|
@@ -57936,7 +58127,7 @@ __export(exports_selected_run, {
|
|
|
57936
58127
|
prepareSelectedSecretBindings: () => prepareSelectedSecretBindings,
|
|
57937
58128
|
executeSelectedLocal: () => executeSelectedLocal
|
|
57938
58129
|
});
|
|
57939
|
-
import { createHash as
|
|
58130
|
+
import { createHash as createHash20 } from "crypto";
|
|
57940
58131
|
import { spawn } from "child_process";
|
|
57941
58132
|
import { mkdirSync as mkdirSync12, mkdtempSync as mkdtempSync3, writeFileSync as writeFileSync11, realpathSync as realpathSync8 } from "fs";
|
|
57942
58133
|
import { dirname as dirname19, join as join31, resolve as resolve17 } from "path";
|
|
@@ -58062,7 +58253,7 @@ async function executeSelectedLocal(selected, options = {}) {
|
|
|
58062
58253
|
selection: selection2,
|
|
58063
58254
|
target: "local",
|
|
58064
58255
|
runtime: runtimeName,
|
|
58065
|
-
inputDigest: `sha256:${
|
|
58256
|
+
inputDigest: `sha256:${createHash20("sha256").update(input2).digest("hex")}`,
|
|
58066
58257
|
runDirectory,
|
|
58067
58258
|
...executionGrant ? { executionGrant } : {},
|
|
58068
58259
|
...bindings ? { secretBinding: { schema: bindings.schema, selection: bindings.selection, consumer: bindings.consumer, secretsAuthority: bindings.secretsAuthority, bindings: bindings.bindings } } : {},
|
|
@@ -59061,11 +59252,11 @@ function validateCronField(expr, min, max, label) {
|
|
|
59061
59252
|
return { valid: true };
|
|
59062
59253
|
}
|
|
59063
59254
|
function validateCron(expr) {
|
|
59064
|
-
const
|
|
59065
|
-
if (
|
|
59066
|
-
return { valid: false, error: `Expected 5 fields, got ${
|
|
59255
|
+
const fields2 = expr.trim().split(/\s+/);
|
|
59256
|
+
if (fields2.length !== 5) {
|
|
59257
|
+
return { valid: false, error: `Expected 5 fields, got ${fields2.length}. Format: "minute hour day-of-month month day-of-week"` };
|
|
59067
59258
|
}
|
|
59068
|
-
const [minuteF, hourF, domF, monthF, dowF] =
|
|
59259
|
+
const [minuteF, hourF, domF, monthF, dowF] = fields2;
|
|
59069
59260
|
const checks4 = [
|
|
59070
59261
|
{ expr: minuteF, min: 0, max: 59, label: "minute" },
|
|
59071
59262
|
{ expr: hourF, min: 0, max: 23, label: "hour" },
|
|
@@ -59290,7 +59481,7 @@ var init_schedule_tools = __esm(() => {
|
|
|
59290
59481
|
});
|
|
59291
59482
|
|
|
59292
59483
|
// src/lib/native-storage.ts
|
|
59293
|
-
import { createHash as
|
|
59484
|
+
import { createHash as createHash21, createHmac } from "crypto";
|
|
59294
59485
|
import {
|
|
59295
59486
|
existsSync as existsSync18,
|
|
59296
59487
|
mkdirSync as mkdirSync15,
|
|
@@ -59299,7 +59490,7 @@ import {
|
|
|
59299
59490
|
statSync as statSync11,
|
|
59300
59491
|
writeFileSync as writeFileSync13
|
|
59301
59492
|
} from "fs";
|
|
59302
|
-
import { dirname as dirname21, join as join35, normalize as
|
|
59493
|
+
import { dirname as dirname21, join as join35, normalize as normalize4, relative as relative6, sep as sep7 } from "path";
|
|
59303
59494
|
function resolveSkillsNativeStorageConfig(env = process.env) {
|
|
59304
59495
|
assertNoRetiredModeEnvVars(env, {
|
|
59305
59496
|
app: SKILLS_ENV_NAMESPACE,
|
|
@@ -59367,7 +59558,7 @@ function exportSkillsLocalSnapshot(targetDir = process.cwd(), options = {}) {
|
|
|
59367
59558
|
files.push({
|
|
59368
59559
|
path: relativePath,
|
|
59369
59560
|
sizeBytes: bytes.byteLength,
|
|
59370
|
-
sha256:
|
|
59561
|
+
sha256: createHash21("sha256").update(bytes).digest("hex"),
|
|
59371
59562
|
...options.includeFileContents ? { contentBase64: Buffer.from(bytes).toString("base64") } : {}
|
|
59372
59563
|
});
|
|
59373
59564
|
}
|