@hasna/skills 0.5.4 → 0.5.5
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 +72 -7
- package/bin/index.js +1875 -595
- package/bin/mcp.js +1780 -328
- package/bin/migrate.js +176 -4
- package/bin/server.js +300 -76
- package/bin/worker.js +294 -103
- package/dist/admin-contract.js +166 -168
- package/dist/cli/commands/private-publications.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1059 -410
- package/dist/lib/fleet-credentials.d.ts +6 -1
- package/dist/lib/home-adoption.d.ts +2 -7
- package/dist/lib/mcp-contracts.d.ts +1 -0
- package/dist/lib/private-publication-customer.d.ts +10 -0
- package/dist/lib/private-publication-recovery.d.ts +43 -0
- package/dist/lib/remote-account.d.ts +5 -0
- package/dist/lib/remote-auth.d.ts +3 -0
- package/dist/lib/remote-client.d.ts +2 -2
- package/dist/lib/remote-private-publications.d.ts +74 -0
- package/dist/mcp/private-publication-tools.d.ts +2 -0
- package/dist/sdk/execution/dispatchers/ecs.d.ts +25 -14
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.js +1137 -463
- package/dist/server/types.d.ts +2 -0
- package/dist/storage.js +33 -35
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -20,14 +20,12 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
20
20
|
}
|
|
21
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
22
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
-
}
|
|
23
|
+
for (let key of __getOwnPropNames(mod))
|
|
24
|
+
if (!__hasOwnProp.call(to, key))
|
|
25
|
+
__defProp(to, key, {
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
27
|
+
enumerable: true
|
|
28
|
+
});
|
|
31
29
|
if (canCache)
|
|
32
30
|
cache.set(mod, to);
|
|
33
31
|
return to;
|
|
@@ -50,7 +48,7 @@ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
|
50
48
|
var __require = import.meta.require;
|
|
51
49
|
|
|
52
50
|
// ../../node_modules/.bun/react@18.3.1/node_modules/react/cjs/react.development.js
|
|
53
|
-
var require_react_development = __commonJS(
|
|
51
|
+
var require_react_development = __commonJS((exports, module) => {
|
|
54
52
|
if (true) {
|
|
55
53
|
(function() {
|
|
56
54
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
|
@@ -1853,7 +1851,7 @@ Check the top-level render call using <` + parentName + ">.";
|
|
|
1853
1851
|
});
|
|
1854
1852
|
|
|
1855
1853
|
// ../../node_modules/.bun/react@18.3.1/node_modules/react/index.js
|
|
1856
|
-
var require_react = __commonJS(
|
|
1854
|
+
var require_react = __commonJS((exports, module) => {
|
|
1857
1855
|
var react_development = __toESM(require_react_development());
|
|
1858
1856
|
if (false) {} else {
|
|
1859
1857
|
module.exports = react_development;
|
|
@@ -1861,7 +1859,7 @@ var require_react = __commonJS(function(exports, module) {
|
|
|
1861
1859
|
});
|
|
1862
1860
|
|
|
1863
1861
|
// ../../node_modules/.bun/signal-exit@3.0.7/node_modules/signal-exit/signals.js
|
|
1864
|
-
var require_signals = __commonJS(
|
|
1862
|
+
var require_signals = __commonJS((exports, module) => {
|
|
1865
1863
|
module.exports = [
|
|
1866
1864
|
"SIGABRT",
|
|
1867
1865
|
"SIGALRM",
|
|
@@ -1878,7 +1876,7 @@ var require_signals = __commonJS(function(exports, module) {
|
|
|
1878
1876
|
});
|
|
1879
1877
|
|
|
1880
1878
|
// ../../node_modules/.bun/signal-exit@3.0.7/node_modules/signal-exit/index.js
|
|
1881
|
-
var require_signal_exit = __commonJS(
|
|
1879
|
+
var require_signal_exit = __commonJS((exports, module) => {
|
|
1882
1880
|
var process3 = global.process;
|
|
1883
1881
|
var processOk = function(process4) {
|
|
1884
1882
|
return process4 && typeof process4 === "object" && typeof process4.removeListener === "function" && typeof process4.emit === "function" && typeof process4.reallyExit === "function" && typeof process4.listeners === "function" && typeof process4.kill === "function" && typeof process4.pid === "number" && typeof process4.on === "function";
|
|
@@ -2031,7 +2029,7 @@ var require_signal_exit = __commonJS(function(exports, module) {
|
|
|
2031
2029
|
});
|
|
2032
2030
|
|
|
2033
2031
|
// ../../node_modules/.bun/scheduler@0.23.2/node_modules/scheduler/cjs/scheduler.development.js
|
|
2034
|
-
var require_scheduler_development = __commonJS(
|
|
2032
|
+
var require_scheduler_development = __commonJS((exports) => {
|
|
2035
2033
|
if (true) {
|
|
2036
2034
|
(function() {
|
|
2037
2035
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
|
@@ -2474,7 +2472,7 @@ var require_scheduler_development = __commonJS(function(exports) {
|
|
|
2474
2472
|
});
|
|
2475
2473
|
|
|
2476
2474
|
// ../../node_modules/.bun/scheduler@0.23.2/node_modules/scheduler/index.js
|
|
2477
|
-
var require_scheduler = __commonJS(
|
|
2475
|
+
var require_scheduler = __commonJS((exports, module) => {
|
|
2478
2476
|
var scheduler_development = __toESM(require_scheduler_development());
|
|
2479
2477
|
if (false) {} else {
|
|
2480
2478
|
module.exports = scheduler_development;
|
|
@@ -2482,7 +2480,7 @@ var require_scheduler = __commonJS(function(exports, module) {
|
|
|
2482
2480
|
});
|
|
2483
2481
|
|
|
2484
2482
|
// ../../node_modules/.bun/react-reconciler@0.29.2+f4eacebf2041cd4f/node_modules/react-reconciler/cjs/react-reconciler.development.js
|
|
2485
|
-
var require_react_reconciler_development = __commonJS(
|
|
2483
|
+
var require_react_reconciler_development = __commonJS((exports, module) => {
|
|
2486
2484
|
var React = __toESM(require_react());
|
|
2487
2485
|
var Scheduler = __toESM(require_scheduler());
|
|
2488
2486
|
if (true) {
|
|
@@ -17228,14 +17226,14 @@ Check the render method of \`` + ownerName + "`.";
|
|
|
17228
17226
|
});
|
|
17229
17227
|
|
|
17230
17228
|
// ../../node_modules/.bun/react-reconciler@0.29.2+f4eacebf2041cd4f/node_modules/react-reconciler/index.js
|
|
17231
|
-
var require_react_reconciler = __commonJS(
|
|
17229
|
+
var require_react_reconciler = __commonJS((exports, module) => {
|
|
17232
17230
|
if (false) {} else {
|
|
17233
17231
|
module.exports = require_react_reconciler_development();
|
|
17234
17232
|
}
|
|
17235
17233
|
});
|
|
17236
17234
|
|
|
17237
17235
|
// ../../node_modules/.bun/react-reconciler@0.29.2+f4eacebf2041cd4f/node_modules/react-reconciler/cjs/react-reconciler-constants.development.js
|
|
17238
|
-
var require_react_reconciler_constants_development = __commonJS(
|
|
17236
|
+
var require_react_reconciler_constants_development = __commonJS((exports) => {
|
|
17239
17237
|
if (true) {
|
|
17240
17238
|
(function() {
|
|
17241
17239
|
var SyncLane = 1;
|
|
@@ -17259,7 +17257,7 @@ var require_react_reconciler_constants_development = __commonJS(function(exports
|
|
|
17259
17257
|
});
|
|
17260
17258
|
|
|
17261
17259
|
// ../../node_modules/.bun/react-reconciler@0.29.2+f4eacebf2041cd4f/node_modules/react-reconciler/constants.js
|
|
17262
|
-
var require_constants = __commonJS(
|
|
17260
|
+
var require_constants = __commonJS((exports, module) => {
|
|
17263
17261
|
if (false) {} else {
|
|
17264
17262
|
module.exports = require_react_reconciler_constants_development();
|
|
17265
17263
|
}
|
|
@@ -17319,7 +17317,7 @@ var init_devtools_window_polyfill = __esm(() => {
|
|
|
17319
17317
|
});
|
|
17320
17318
|
|
|
17321
17319
|
// ../../node_modules/.bun/react-devtools-core@7.0.1/node_modules/react-devtools-core/dist/backend.js
|
|
17322
|
-
var require_backend = __commonJS(
|
|
17320
|
+
var require_backend = __commonJS((exports, module) => {
|
|
17323
17321
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
17324
17322
|
if (typeof exports === "object" && typeof module === "object")
|
|
17325
17323
|
module.exports = factory();
|
|
@@ -34122,7 +34120,7 @@ var init_devtools = __esm(() => {
|
|
|
34122
34120
|
});
|
|
34123
34121
|
|
|
34124
34122
|
// ../../node_modules/.bun/cli-boxes@3.0.0/node_modules/cli-boxes/boxes.json
|
|
34125
|
-
var require_boxes = __commonJS(
|
|
34123
|
+
var require_boxes = __commonJS((exports, module) => {
|
|
34126
34124
|
module.exports = {
|
|
34127
34125
|
single: {
|
|
34128
34126
|
topLeft: "\u250C",
|
|
@@ -34208,7 +34206,7 @@ var require_boxes = __commonJS(function(exports, module) {
|
|
|
34208
34206
|
});
|
|
34209
34207
|
|
|
34210
34208
|
// ../../node_modules/.bun/cli-boxes@3.0.0/node_modules/cli-boxes/index.js
|
|
34211
|
-
var require_cli_boxes = __commonJS(
|
|
34209
|
+
var require_cli_boxes = __commonJS((exports, module) => {
|
|
34212
34210
|
var cliBoxes = require_boxes();
|
|
34213
34211
|
module.exports = cliBoxes;
|
|
34214
34212
|
module.exports.default = cliBoxes;
|
|
@@ -34704,7 +34702,7 @@ var init_source = __esm(() => {
|
|
|
34704
34702
|
});
|
|
34705
34703
|
|
|
34706
34704
|
// ../../node_modules/.bun/mimic-fn@2.1.0/node_modules/mimic-fn/index.js
|
|
34707
|
-
var require_mimic_fn = __commonJS(
|
|
34705
|
+
var require_mimic_fn = __commonJS((exports, module) => {
|
|
34708
34706
|
var mimicFn = (to, from) => {
|
|
34709
34707
|
for (const prop of Reflect.ownKeys(from)) {
|
|
34710
34708
|
Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
|
|
@@ -34716,7 +34714,7 @@ var require_mimic_fn = __commonJS(function(exports, module) {
|
|
|
34716
34714
|
});
|
|
34717
34715
|
|
|
34718
34716
|
// ../../node_modules/.bun/onetime@5.1.2/node_modules/onetime/index.js
|
|
34719
|
-
var require_onetime = __commonJS(
|
|
34717
|
+
var require_onetime = __commonJS((exports, module) => {
|
|
34720
34718
|
var mimicFn = require_mimic_fn();
|
|
34721
34719
|
var calledFunctions = new WeakMap;
|
|
34722
34720
|
var onetime = (function_, options = {}) => {
|
|
@@ -34751,7 +34749,7 @@ var require_onetime = __commonJS(function(exports, module) {
|
|
|
34751
34749
|
});
|
|
34752
34750
|
|
|
34753
34751
|
// ../../node_modules/.bun/escape-string-regexp@2.0.0/node_modules/escape-string-regexp/index.js
|
|
34754
|
-
var require_escape_string_regexp = __commonJS(
|
|
34752
|
+
var require_escape_string_regexp = __commonJS((exports, module) => {
|
|
34755
34753
|
var matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g;
|
|
34756
34754
|
module.exports = (string) => {
|
|
34757
34755
|
if (typeof string !== "string") {
|
|
@@ -34762,7 +34760,7 @@ var require_escape_string_regexp = __commonJS(function(exports, module) {
|
|
|
34762
34760
|
});
|
|
34763
34761
|
|
|
34764
34762
|
// ../../node_modules/.bun/stack-utils@2.0.6/node_modules/stack-utils/index.js
|
|
34765
|
-
var require_stack_utils = __commonJS(
|
|
34763
|
+
var require_stack_utils = __commonJS((exports, module) => {
|
|
34766
34764
|
var escapeStringRegexp = require_escape_string_regexp();
|
|
34767
34765
|
var cwd = typeof process === "object" && process && typeof process.cwd === "function" ? process.cwd() : ".";
|
|
34768
34766
|
var natives = [].concat(__require("module").builtinModules, "bootstrap_node", "node").map((n) => new RegExp(`(?:\\((?:node:)?${n}(?:\\.js)?:\\d+:\\d+\\)$|^\\s*at (?:node:)?${n}(?:\\.js)?:\\d+:\\d+$)`));
|
|
@@ -35000,7 +34998,7 @@ var require_stack_utils = __commonJS(function(exports, module) {
|
|
|
35000
34998
|
});
|
|
35001
34999
|
|
|
35002
35000
|
// ../../node_modules/.bun/commander@12.1.0/node_modules/commander/lib/error.js
|
|
35003
|
-
var require_error = __commonJS(
|
|
35001
|
+
var require_error = __commonJS((exports) => {
|
|
35004
35002
|
class CommanderError extends Error {
|
|
35005
35003
|
constructor(exitCode, code, message) {
|
|
35006
35004
|
super(message);
|
|
@@ -35024,7 +35022,7 @@ var require_error = __commonJS(function(exports) {
|
|
|
35024
35022
|
});
|
|
35025
35023
|
|
|
35026
35024
|
// ../../node_modules/.bun/commander@12.1.0/node_modules/commander/lib/argument.js
|
|
35027
|
-
var require_argument = __commonJS(
|
|
35025
|
+
var require_argument = __commonJS((exports) => {
|
|
35028
35026
|
var { InvalidArgumentError } = require_error();
|
|
35029
35027
|
|
|
35030
35028
|
class Argument {
|
|
@@ -35103,7 +35101,7 @@ var require_argument = __commonJS(function(exports) {
|
|
|
35103
35101
|
});
|
|
35104
35102
|
|
|
35105
35103
|
// ../../node_modules/.bun/commander@12.1.0/node_modules/commander/lib/help.js
|
|
35106
|
-
var require_help = __commonJS(
|
|
35104
|
+
var require_help = __commonJS((exports) => {
|
|
35107
35105
|
var { humanReadableArgName } = require_argument();
|
|
35108
35106
|
|
|
35109
35107
|
class Help {
|
|
@@ -35352,7 +35350,7 @@ var require_help = __commonJS(function(exports) {
|
|
|
35352
35350
|
});
|
|
35353
35351
|
|
|
35354
35352
|
// ../../node_modules/.bun/commander@12.1.0/node_modules/commander/lib/option.js
|
|
35355
|
-
var require_option = __commonJS(
|
|
35353
|
+
var require_option = __commonJS((exports) => {
|
|
35356
35354
|
var { InvalidArgumentError } = require_error();
|
|
35357
35355
|
|
|
35358
35356
|
class Option {
|
|
@@ -35503,7 +35501,7 @@ var require_option = __commonJS(function(exports) {
|
|
|
35503
35501
|
});
|
|
35504
35502
|
|
|
35505
35503
|
// ../../node_modules/.bun/commander@12.1.0/node_modules/commander/lib/suggestSimilar.js
|
|
35506
|
-
var require_suggestSimilar = __commonJS(
|
|
35504
|
+
var require_suggestSimilar = __commonJS((exports) => {
|
|
35507
35505
|
var maxDistance = 3;
|
|
35508
35506
|
function editDistance(a, b) {
|
|
35509
35507
|
if (Math.abs(a.length - b.length) > maxDistance)
|
|
@@ -35576,7 +35574,7 @@ var require_suggestSimilar = __commonJS(function(exports) {
|
|
|
35576
35574
|
});
|
|
35577
35575
|
|
|
35578
35576
|
// ../../node_modules/.bun/commander@12.1.0/node_modules/commander/lib/command.js
|
|
35579
|
-
var require_command = __commonJS(
|
|
35577
|
+
var require_command = __commonJS((exports) => {
|
|
35580
35578
|
var EventEmitter3 = __require("events").EventEmitter;
|
|
35581
35579
|
var childProcess = __require("child_process");
|
|
35582
35580
|
var path = __require("path");
|
|
@@ -36819,7 +36817,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
36819
36817
|
});
|
|
36820
36818
|
|
|
36821
36819
|
// ../../node_modules/.bun/commander@12.1.0/node_modules/commander/index.js
|
|
36822
|
-
var require_commander = __commonJS(
|
|
36820
|
+
var require_commander = __commonJS((exports) => {
|
|
36823
36821
|
var { Argument } = require_argument();
|
|
36824
36822
|
var { Command } = require_command();
|
|
36825
36823
|
var { CommanderError, InvalidArgumentError } = require_error();
|
|
@@ -36862,7 +36860,7 @@ var package_default;
|
|
|
36862
36860
|
var init_package = __esm(() => {
|
|
36863
36861
|
package_default = {
|
|
36864
36862
|
name: "@hasna/skills",
|
|
36865
|
-
version: "0.5.
|
|
36863
|
+
version: "0.5.5",
|
|
36866
36864
|
description: "Skills library for AI coding agents",
|
|
36867
36865
|
type: "module",
|
|
36868
36866
|
bin: {
|
|
@@ -36986,7 +36984,7 @@ var init_package = __esm(() => {
|
|
|
36986
36984
|
});
|
|
36987
36985
|
|
|
36988
36986
|
// ../../node_modules/.bun/react@18.3.1/node_modules/react/cjs/react-jsx-dev-runtime.development.js
|
|
36989
|
-
var require_react_jsx_dev_runtime_development = __commonJS(
|
|
36987
|
+
var require_react_jsx_dev_runtime_development = __commonJS((exports) => {
|
|
36990
36988
|
var React13 = __toESM(require_react());
|
|
36991
36989
|
if (true) {
|
|
36992
36990
|
(function() {
|
|
@@ -37867,7 +37865,7 @@ Check the top-level render call using <` + parentName + ">.";
|
|
|
37867
37865
|
});
|
|
37868
37866
|
|
|
37869
37867
|
// ../../node_modules/.bun/react@18.3.1/node_modules/react/jsx-dev-runtime.js
|
|
37870
|
-
var require_jsx_dev_runtime = __commonJS(
|
|
37868
|
+
var require_jsx_dev_runtime = __commonJS((exports, module) => {
|
|
37871
37869
|
var react_jsx_dev_runtime_development = __toESM(require_react_jsx_dev_runtime_development());
|
|
37872
37870
|
if (false) {} else {
|
|
37873
37871
|
module.exports = react_jsx_dev_runtime_development;
|
|
@@ -39324,6 +39322,39 @@ var init_skill_validation = __esm(() => {
|
|
|
39324
39322
|
VALID_PROVENANCE_SOURCES = new Set(["official", "custom", "remote", "private", "private-hosted", "upstream", "extension"]);
|
|
39325
39323
|
VALID_BIN_COMMAND = /^[a-z0-9][a-z0-9._-]*$/;
|
|
39326
39324
|
});
|
|
39325
|
+
|
|
39326
|
+
// src/lib/skill-entry-path.ts
|
|
39327
|
+
class SkillEntryPaths {
|
|
39328
|
+
files = new Set;
|
|
39329
|
+
directories = new Set;
|
|
39330
|
+
add(path, maxBytes, invalid, limit) {
|
|
39331
|
+
if (path.length > maxBytes)
|
|
39332
|
+
limit();
|
|
39333
|
+
const encoded = new TextEncoder().encode(path);
|
|
39334
|
+
if (encoded.byteLength > maxBytes)
|
|
39335
|
+
limit();
|
|
39336
|
+
if (new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(encoded) !== path)
|
|
39337
|
+
invalid("Invalid UTF-8 entry path");
|
|
39338
|
+
if (!path || /[\\:\x00-\x1f\x7f]/u.test(path))
|
|
39339
|
+
invalid("Unsafe entry path");
|
|
39340
|
+
if (path.split("/").some((segment) => !segment || segment === "." || segment === ".."))
|
|
39341
|
+
invalid("Unsafe entry path segment");
|
|
39342
|
+
const key = path.normalize("NFC").toLowerCase().normalize("NFC");
|
|
39343
|
+
if (this.files.has(key) || this.directories.has(key))
|
|
39344
|
+
invalid("Duplicate or conflicting entry path");
|
|
39345
|
+
const parents = key.split("/");
|
|
39346
|
+
parents.pop();
|
|
39347
|
+
while (parents.length) {
|
|
39348
|
+
const parent = parents.join("/");
|
|
39349
|
+
if (this.files.has(parent))
|
|
39350
|
+
invalid("Conflicting entry file ancestor");
|
|
39351
|
+
this.directories.add(parent);
|
|
39352
|
+
parents.pop();
|
|
39353
|
+
}
|
|
39354
|
+
this.files.add(key);
|
|
39355
|
+
}
|
|
39356
|
+
}
|
|
39357
|
+
|
|
39327
39358
|
// src/lib/skill-hash.ts
|
|
39328
39359
|
import { createHash } from "crypto";
|
|
39329
39360
|
import { existsSync as existsSync9, readdirSync as readdirSync4, readFileSync as readFileSync5, statSync as statSync4 } from "fs";
|
|
@@ -39441,6 +39472,186 @@ function hashBundleFiles(files) {
|
|
|
39441
39472
|
hash.update(part);
|
|
39442
39473
|
return hash.digest("hex");
|
|
39443
39474
|
}
|
|
39475
|
+
async function hashBundleFilesCooperatively(files, check) {
|
|
39476
|
+
const hash = createHash(CONTENT_HASH_ALGORITHM);
|
|
39477
|
+
let bytesSinceYield = 0;
|
|
39478
|
+
for (const part of bundleHashParts(files)) {
|
|
39479
|
+
for (let offset = 0;offset < part.byteLength; offset += 64 * 1024) {
|
|
39480
|
+
check();
|
|
39481
|
+
const chunk2 = part.subarray(offset, offset + 64 * 1024);
|
|
39482
|
+
hash.update(chunk2);
|
|
39483
|
+
bytesSinceYield += chunk2.byteLength;
|
|
39484
|
+
if (bytesSinceYield >= 256 * 1024) {
|
|
39485
|
+
await new Promise((resolve3) => setImmediate(resolve3));
|
|
39486
|
+
bytesSinceYield = 0;
|
|
39487
|
+
}
|
|
39488
|
+
}
|
|
39489
|
+
}
|
|
39490
|
+
check();
|
|
39491
|
+
return hash.digest("hex");
|
|
39492
|
+
}
|
|
39493
|
+
function invalidContent(message = "Invalid content hash input") {
|
|
39494
|
+
throw new ContentHashInputError("CONTENT_HASH_INVALID", message);
|
|
39495
|
+
}
|
|
39496
|
+
function contentLimit(message) {
|
|
39497
|
+
throw new ContentHashInputError("CONTENT_HASH_LIMIT", message);
|
|
39498
|
+
}
|
|
39499
|
+
function contentRecord(value, allowed) {
|
|
39500
|
+
if (!value || typeof value !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(value)))
|
|
39501
|
+
invalidContent();
|
|
39502
|
+
const result2 = Object.create(null);
|
|
39503
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
39504
|
+
if (typeof key !== "string" || !allowed.includes(key))
|
|
39505
|
+
invalidContent();
|
|
39506
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
39507
|
+
if (!descriptor || !("value" in descriptor))
|
|
39508
|
+
invalidContent("Accessor content hash input is unsupported");
|
|
39509
|
+
result2[key] = descriptor.value;
|
|
39510
|
+
}
|
|
39511
|
+
return result2;
|
|
39512
|
+
}
|
|
39513
|
+
function contentOptions(options) {
|
|
39514
|
+
const record = contentRecord(options, ["limits", "signal"]);
|
|
39515
|
+
const limits = { ...CONTENT_HASH_LIMITS };
|
|
39516
|
+
if (record.limits !== undefined) {
|
|
39517
|
+
const supplied = contentRecord(record.limits, Object.keys(limits));
|
|
39518
|
+
for (const key of Object.keys(supplied)) {
|
|
39519
|
+
const value = supplied[key];
|
|
39520
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0 || value > limits[key])
|
|
39521
|
+
contentLimit("Invalid content hash limit");
|
|
39522
|
+
limits[key] = value;
|
|
39523
|
+
}
|
|
39524
|
+
}
|
|
39525
|
+
if (record.signal !== undefined && !(record.signal instanceof AbortSignal))
|
|
39526
|
+
invalidContent("Invalid content hash signal");
|
|
39527
|
+
return { limits, signal: record.signal };
|
|
39528
|
+
}
|
|
39529
|
+
function snapshotContentEntries(entries, limits, check) {
|
|
39530
|
+
if (!Array.isArray(entries))
|
|
39531
|
+
invalidContent("Content hash entries must be an array");
|
|
39532
|
+
if (entries.length > limits.entries)
|
|
39533
|
+
contentLimit("Content hash entry limit exceeded");
|
|
39534
|
+
if (Reflect.ownKeys(entries).length !== entries.length + 1)
|
|
39535
|
+
invalidContent("Invalid content hash entry array");
|
|
39536
|
+
const snapshot = [];
|
|
39537
|
+
const paths = new SkillEntryPaths;
|
|
39538
|
+
let rawBytes = 0;
|
|
39539
|
+
for (let index = 0;index < entries.length; index++) {
|
|
39540
|
+
check();
|
|
39541
|
+
const descriptor = Object.getOwnPropertyDescriptor(entries, String(index));
|
|
39542
|
+
if (!descriptor || !("value" in descriptor))
|
|
39543
|
+
invalidContent("Invalid content hash entry array");
|
|
39544
|
+
const entry = contentRecord(descriptor.value, ["path", "bytes", "mode"]);
|
|
39545
|
+
if (typeof entry.path !== "string" || typeof entry.mode !== "number" || !Number.isInteger(entry.mode) || entry.mode < 0 || entry.mode > 511)
|
|
39546
|
+
invalidContent("Invalid regular-file content hash entry");
|
|
39547
|
+
paths.add(entry.path, limits.pathBytes, invalidContent, () => contentLimit("Content hash path limit exceeded"));
|
|
39548
|
+
if (!(entry.bytes instanceof Uint8Array) || !ArrayBuffer.isView(entry.bytes))
|
|
39549
|
+
invalidContent("Content hash entry requires bytes");
|
|
39550
|
+
const size2 = byteLengthOf.call(entry.bytes);
|
|
39551
|
+
if (!(bufferOf.call(entry.bytes) instanceof ArrayBuffer))
|
|
39552
|
+
invalidContent("Shared content hash bytes are unsupported");
|
|
39553
|
+
if (size2 > limits.fileBytes || rawBytes + size2 > limits.rawBytes)
|
|
39554
|
+
contentLimit("Content hash raw byte limit exceeded");
|
|
39555
|
+
if (entry.path === "skill.json" && size2 > limits.manifestBytes)
|
|
39556
|
+
contentLimit("Content hash manifest byte limit exceeded");
|
|
39557
|
+
rawBytes += size2;
|
|
39558
|
+
const bytes = new Uint8Array(new ArrayBuffer(size2));
|
|
39559
|
+
bytes.set(entry.bytes);
|
|
39560
|
+
snapshot.push({ path: entry.path, bytes, mode: entry.mode });
|
|
39561
|
+
}
|
|
39562
|
+
check();
|
|
39563
|
+
return snapshot;
|
|
39564
|
+
}
|
|
39565
|
+
function coveredContentPath(path) {
|
|
39566
|
+
const segments = path.split("/");
|
|
39567
|
+
if (!HASH_COVERAGE.includes(segments[0]))
|
|
39568
|
+
return false;
|
|
39569
|
+
return !segments.slice(1).some((segment, index) => excludedHashEntry(segment, index < segments.length - 2));
|
|
39570
|
+
}
|
|
39571
|
+
function boundedManifest(raw, maxDepth) {
|
|
39572
|
+
let parsed;
|
|
39573
|
+
try {
|
|
39574
|
+
parsed = JSON.parse(raw);
|
|
39575
|
+
} catch {
|
|
39576
|
+
return;
|
|
39577
|
+
}
|
|
39578
|
+
const pending = [{ value: parsed, depth: 1 }];
|
|
39579
|
+
while (pending.length) {
|
|
39580
|
+
const { value, depth } = pending.pop();
|
|
39581
|
+
if (!value || typeof value !== "object")
|
|
39582
|
+
continue;
|
|
39583
|
+
if (depth > maxDepth)
|
|
39584
|
+
contentLimit("Content hash manifest depth limit exceeded");
|
|
39585
|
+
for (const child of Object.values(value))
|
|
39586
|
+
pending.push({ value: child, depth: depth + 1 });
|
|
39587
|
+
}
|
|
39588
|
+
return parsed;
|
|
39589
|
+
}
|
|
39590
|
+
async function hashContentEntries(entries, options) {
|
|
39591
|
+
const { limits, signal } = contentOptions(options);
|
|
39592
|
+
const deadline = performance.now() + limits.timeoutMs;
|
|
39593
|
+
let terminal;
|
|
39594
|
+
const abort = () => {
|
|
39595
|
+
terminal ??= new ContentHashInputError("CONTENT_HASH_ABORTED", "Content hashing aborted");
|
|
39596
|
+
};
|
|
39597
|
+
const timer = setTimeout(() => {
|
|
39598
|
+
terminal ??= new ContentHashInputError("CONTENT_HASH_TIMEOUT", "Content hashing deadline exceeded");
|
|
39599
|
+
}, limits.timeoutMs);
|
|
39600
|
+
const check = () => {
|
|
39601
|
+
if (signal?.aborted)
|
|
39602
|
+
abort();
|
|
39603
|
+
if (terminal)
|
|
39604
|
+
throw terminal;
|
|
39605
|
+
if (performance.now() >= deadline)
|
|
39606
|
+
throw new ContentHashInputError("CONTENT_HASH_TIMEOUT", "Content hashing deadline exceeded");
|
|
39607
|
+
};
|
|
39608
|
+
try {
|
|
39609
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
39610
|
+
check();
|
|
39611
|
+
const snapshot = snapshotContentEntries(entries, limits, check);
|
|
39612
|
+
const normalized = [];
|
|
39613
|
+
let normalizedBytes = 0;
|
|
39614
|
+
let manifest;
|
|
39615
|
+
await new Promise((resolve3) => setImmediate(resolve3));
|
|
39616
|
+
for (const entry of snapshot) {
|
|
39617
|
+
check();
|
|
39618
|
+
if (!coveredContentPath(entry.path))
|
|
39619
|
+
continue;
|
|
39620
|
+
if (entry.path === "skill.json")
|
|
39621
|
+
manifest = boundedManifest(new TextDecoder().decode(entry.bytes), limits.manifestDepth);
|
|
39622
|
+
const file = normalizeBundleFile(entry.path, entry.bytes);
|
|
39623
|
+
check();
|
|
39624
|
+
if (file.content.byteLength > limits.normalizedFileBytes || normalizedBytes + file.content.byteLength > limits.normalizedBytes)
|
|
39625
|
+
contentLimit("Content hash normalized byte limit exceeded");
|
|
39626
|
+
normalizedBytes += file.content.byteLength;
|
|
39627
|
+
normalized.push(file);
|
|
39628
|
+
await new Promise((resolve3) => setImmediate(resolve3));
|
|
39629
|
+
}
|
|
39630
|
+
normalized.sort((a, b) => a.rel < b.rel ? -1 : a.rel > b.rel ? 1 : 0);
|
|
39631
|
+
check();
|
|
39632
|
+
return { hash: await hashBundleFilesCooperatively(normalized, check), manifest };
|
|
39633
|
+
} catch (error) {
|
|
39634
|
+
if (error instanceof ContentHashInputError)
|
|
39635
|
+
throw error;
|
|
39636
|
+
throw new ContentHashInputError("CONTENT_HASH_INVALID", "Invalid content hash input");
|
|
39637
|
+
} finally {
|
|
39638
|
+
clearTimeout(timer);
|
|
39639
|
+
signal?.removeEventListener("abort", abort);
|
|
39640
|
+
}
|
|
39641
|
+
}
|
|
39642
|
+
async function verifyContentHashFromEntries(entries, options = {}) {
|
|
39643
|
+
const { hash, manifest } = await hashContentEntries(entries, options);
|
|
39644
|
+
const provenance = manifest && typeof manifest === "object" && !Array.isArray(manifest) ? manifest.provenance : undefined;
|
|
39645
|
+
const value = provenance && typeof provenance === "object" && !Array.isArray(provenance) ? provenance.content_hash : undefined;
|
|
39646
|
+
if (value !== undefined && typeof value !== "string")
|
|
39647
|
+
invalidContent("Invalid content hash declaration");
|
|
39648
|
+
const declaredHash = value?.trim() || undefined;
|
|
39649
|
+
if (!declaredHash)
|
|
39650
|
+
return { declared: false, valid: false };
|
|
39651
|
+
if (!/^[a-f0-9]{64}$/.test(declaredHash))
|
|
39652
|
+
return { declared: true, valid: false, declaredHash };
|
|
39653
|
+
return { declared: true, valid: hash === declaredHash, declaredHash, computedHash: hash };
|
|
39654
|
+
}
|
|
39444
39655
|
function verifyContentHash(skillPath, manifest) {
|
|
39445
39656
|
const declaredHash = manifest?.provenance?.content_hash?.trim() || undefined;
|
|
39446
39657
|
if (!declaredHash)
|
|
@@ -39475,7 +39686,7 @@ function hashSkillMarkdown(content) {
|
|
|
39475
39686
|
function hashSkillMarkdownFile(path) {
|
|
39476
39687
|
return hashSkillMarkdown(readFileSync5(path, "utf-8"));
|
|
39477
39688
|
}
|
|
39478
|
-
var CONTENT_HASH_ALGORITHM = "sha256", HASH_EXCLUDE_DIRS, HASH_COVERAGE, CONTENT_HASH_LIMITS, typedArrayPrototype, byteLengthOf, bufferOf;
|
|
39689
|
+
var CONTENT_HASH_ALGORITHM = "sha256", HASH_EXCLUDE_DIRS, HASH_COVERAGE, CONTENT_HASH_LIMITS, ContentHashInputError, typedArrayPrototype, byteLengthOf, bufferOf;
|
|
39479
39690
|
var init_skill_hash = __esm(() => {
|
|
39480
39691
|
HASH_EXCLUDE_DIRS = new Set([".git", "node_modules", "dist", "build", ".turbo"]);
|
|
39481
39692
|
HASH_COVERAGE = [
|
|
@@ -39500,6 +39711,14 @@ var init_skill_hash = __esm(() => {
|
|
|
39500
39711
|
manifestDepth: 64,
|
|
39501
39712
|
timeoutMs: 5000
|
|
39502
39713
|
});
|
|
39714
|
+
ContentHashInputError = class ContentHashInputError extends Error {
|
|
39715
|
+
code;
|
|
39716
|
+
constructor(code, message) {
|
|
39717
|
+
super(message);
|
|
39718
|
+
this.code = code;
|
|
39719
|
+
this.name = "ContentHashInputError";
|
|
39720
|
+
}
|
|
39721
|
+
};
|
|
39503
39722
|
typedArrayPrototype = Object.getPrototypeOf(Uint8Array.prototype);
|
|
39504
39723
|
byteLengthOf = Object.getOwnPropertyDescriptor(typedArrayPrototype, "byteLength").get;
|
|
39505
39724
|
bufferOf = Object.getOwnPropertyDescriptor(typedArrayPrototype, "buffer").get;
|
|
@@ -40917,21 +41136,21 @@ var init_search = __esm(() => {
|
|
|
40917
41136
|
// src/lib/registry.ts
|
|
40918
41137
|
var exports_registry = {};
|
|
40919
41138
|
__export(exports_registry, {
|
|
40920
|
-
|
|
40921
|
-
CATEGORIES: () => CATEGORIES,
|
|
40922
|
-
SKILLS: () => SKILLS,
|
|
40923
|
-
clearRegistryCache: () => clearRegistryCache,
|
|
40924
|
-
findExtensionSkillPath: () => findExtensionSkillPath,
|
|
40925
|
-
findSimilarSkills: () => findSimilarSkills,
|
|
40926
|
-
getAllTags: () => getAllTags,
|
|
40927
|
-
getSkill: () => getSkill,
|
|
40928
|
-
getSkillsByCategory: () => getSkillsByCategory,
|
|
40929
|
-
getSkillsByTag: () => getSkillsByTag,
|
|
40930
|
-
isBasicSkillName: () => isBasicSkillName,
|
|
40931
|
-
loadBasicRegistry: () => loadBasicRegistry,
|
|
40932
|
-
loadRegistry: () => loadRegistry,
|
|
41139
|
+
searchSkills: () => searchSkills,
|
|
40933
41140
|
loadRegistryProfile: () => loadRegistryProfile,
|
|
40934
|
-
|
|
41141
|
+
loadRegistry: () => loadRegistry,
|
|
41142
|
+
loadBasicRegistry: () => loadBasicRegistry,
|
|
41143
|
+
isBasicSkillName: () => isBasicSkillName,
|
|
41144
|
+
getSkillsByTag: () => getSkillsByTag,
|
|
41145
|
+
getSkillsByCategory: () => getSkillsByCategory,
|
|
41146
|
+
getSkill: () => getSkill,
|
|
41147
|
+
getAllTags: () => getAllTags,
|
|
41148
|
+
findSimilarSkills: () => findSimilarSkills,
|
|
41149
|
+
findExtensionSkillPath: () => findExtensionSkillPath,
|
|
41150
|
+
clearRegistryCache: () => clearRegistryCache,
|
|
41151
|
+
SKILLS: () => SKILLS,
|
|
41152
|
+
CATEGORIES: () => CATEGORIES,
|
|
41153
|
+
BASIC_SKILL_NAMES: () => BASIC_SKILL_NAMES
|
|
40935
41154
|
});
|
|
40936
41155
|
import { existsSync as existsSync12, readFileSync as readFileSync7, readdirSync as readdirSync6 } from "fs";
|
|
40937
41156
|
import { join as join12 } from "path";
|
|
@@ -41108,7 +41327,7 @@ var init_registry = __esm(() => {
|
|
|
41108
41327
|
});
|
|
41109
41328
|
|
|
41110
41329
|
// ../../node_modules/.bun/cli-spinners@2.9.2/node_modules/cli-spinners/spinners.json
|
|
41111
|
-
var require_spinners = __commonJS(
|
|
41330
|
+
var require_spinners = __commonJS((exports, module) => {
|
|
41112
41331
|
module.exports = {
|
|
41113
41332
|
dots: {
|
|
41114
41333
|
interval: 80,
|
|
@@ -42734,7 +42953,7 @@ var require_spinners = __commonJS(function(exports, module) {
|
|
|
42734
42953
|
});
|
|
42735
42954
|
|
|
42736
42955
|
// ../../node_modules/.bun/cli-spinners@2.9.2/node_modules/cli-spinners/index.js
|
|
42737
|
-
var require_cli_spinners = __commonJS(
|
|
42956
|
+
var require_cli_spinners = __commonJS((exports, module) => {
|
|
42738
42957
|
var spinners = Object.assign({}, require_spinners());
|
|
42739
42958
|
var spinnersList = Object.keys(spinners);
|
|
42740
42959
|
Object.defineProperty(spinners, "random", {
|
|
@@ -43364,30 +43583,30 @@ var init_project_state = __esm(() => {
|
|
|
43364
43583
|
// src/lib/installer.ts
|
|
43365
43584
|
var exports_installer = {};
|
|
43366
43585
|
__export(exports_installer, {
|
|
43367
|
-
|
|
43368
|
-
AGENT_TARGETS: () => AGENT_TARGETS,
|
|
43369
|
-
createLocalSkillManifest: () => createLocalSkillManifest,
|
|
43370
|
-
disableSkill: () => disableSkill,
|
|
43371
|
-
enableSkill: () => enableSkill,
|
|
43372
|
-
getAgentSkillPath: () => getAgentSkillPath,
|
|
43373
|
-
getAgentSkillsDir: () => getAgentSkillsDir,
|
|
43374
|
-
getDisabledSkills: () => getDisabledSkills,
|
|
43375
|
-
getInstallMeta: () => getInstallMeta,
|
|
43376
|
-
getInstalledSkills: () => getInstalledSkills,
|
|
43377
|
-
getPinnedSkills: () => getPinnedSkills,
|
|
43378
|
-
getSkillPath: () => getSkillPath,
|
|
43379
|
-
installRemoteSkill: () => installRemoteSkill,
|
|
43380
|
-
installSkill: () => installSkill,
|
|
43381
|
-
installSkillForAgent: () => installSkillForAgent,
|
|
43382
|
-
installSkillManifest: () => installSkillManifest,
|
|
43383
|
-
installSkillSource: () => installSkillSource,
|
|
43384
|
-
installSkills: () => installSkills,
|
|
43385
|
-
pinSkill: () => pinSkill,
|
|
43386
|
-
removeSkill: () => removeSkill,
|
|
43387
|
-
removeSkillForAgent: () => removeSkillForAgent,
|
|
43388
|
-
resolveAgents: () => resolveAgents,
|
|
43586
|
+
unpinSkill: () => unpinSkill,
|
|
43389
43587
|
skillExists: () => skillExists,
|
|
43390
|
-
|
|
43588
|
+
resolveAgents: () => resolveAgents,
|
|
43589
|
+
removeSkillForAgent: () => removeSkillForAgent,
|
|
43590
|
+
removeSkill: () => removeSkill,
|
|
43591
|
+
pinSkill: () => pinSkill,
|
|
43592
|
+
installSkills: () => installSkills,
|
|
43593
|
+
installSkillSource: () => installSkillSource,
|
|
43594
|
+
installSkillManifest: () => installSkillManifest,
|
|
43595
|
+
installSkillForAgent: () => installSkillForAgent,
|
|
43596
|
+
installSkill: () => installSkill,
|
|
43597
|
+
installRemoteSkill: () => installRemoteSkill,
|
|
43598
|
+
getSkillPath: () => getSkillPath,
|
|
43599
|
+
getPinnedSkills: () => getPinnedSkills,
|
|
43600
|
+
getInstalledSkills: () => getInstalledSkills,
|
|
43601
|
+
getInstallMeta: () => getInstallMeta,
|
|
43602
|
+
getDisabledSkills: () => getDisabledSkills,
|
|
43603
|
+
getAgentSkillsDir: () => getAgentSkillsDir,
|
|
43604
|
+
getAgentSkillPath: () => getAgentSkillPath,
|
|
43605
|
+
enableSkill: () => enableSkill,
|
|
43606
|
+
disableSkill: () => disableSkill,
|
|
43607
|
+
createLocalSkillManifest: () => createLocalSkillManifest,
|
|
43608
|
+
AGENT_TARGETS: () => AGENT_TARGETS,
|
|
43609
|
+
AGENT_LABELS: () => AGENT_LABELS
|
|
43391
43610
|
});
|
|
43392
43611
|
import { existsSync as existsSync16, readFileSync as readFileSync10, rmSync as rmSync4 } from "fs";
|
|
43393
43612
|
import { dirname as dirname5, join as join16 } from "path";
|
|
@@ -44600,31 +44819,32 @@ var init_local_opt_in = __esm(() => {
|
|
|
44600
44819
|
// src/lib/fleet-credentials.ts
|
|
44601
44820
|
var exports_fleet_credentials = {};
|
|
44602
44821
|
__export(exports_fleet_credentials, {
|
|
44603
|
-
|
|
44604
|
-
SKILLS_API_KEY_ENV: () => SKILLS_API_KEY_ENV,
|
|
44605
|
-
SKILLS_API_KEY_ENV_KEYS: () => SKILLS_API_KEY_ENV_KEYS,
|
|
44606
|
-
SKILLS_API_URL_ENV: () => SKILLS_API_URL_ENV,
|
|
44607
|
-
SKILLS_API_URL_ENV_KEYS: () => SKILLS_API_URL_ENV_KEYS,
|
|
44608
|
-
SKILLS_APP: () => SKILLS_APP,
|
|
44609
|
-
SKILLS_LOCAL_OPT_IN_ENV_KEYS: () => SKILLS_LOCAL_OPT_IN_ENV_KEYS,
|
|
44610
|
-
SkillsFleetCredentialError: () => SkillsFleetCredentialError,
|
|
44611
|
-
configuredSkillsApiUrl: () => configuredSkillsApiUrl,
|
|
44612
|
-
isSkillsFleetCredentialError: () => isSkillsFleetCredentialError,
|
|
44613
|
-
isSkillsLocalOptIn: () => isSkillsLocalOptIn,
|
|
44614
|
-
normalizeSkillsApiOrigin: () => normalizeSkillsApiOrigin,
|
|
44615
|
-
noticeLocalSkillsMode: () => noticeLocalSkillsMode,
|
|
44616
|
-
requireSkillsApiKey: () => requireSkillsApiKey,
|
|
44617
|
-
requireSkillsApiOrigin: () => requireSkillsApiOrigin,
|
|
44618
|
-
requireSkillsFleet: () => requireSkillsFleet,
|
|
44619
|
-
resetLocalSkillsModeNotice: () => resetLocalSkillsModeNotice,
|
|
44620
|
-
resolveSkillsApiKey: () => resolveSkillsApiKey,
|
|
44621
|
-
resolveSkillsApiOrigin: () => resolveSkillsApiOrigin,
|
|
44622
|
-
resolveSkillsConnection: () => resolveSkillsConnection,
|
|
44623
|
-
resolveSkillsFleet: () => resolveSkillsFleet,
|
|
44624
|
-
selectsSkillsLocalMode: () => selectsSkillsLocalMode,
|
|
44625
|
-
skillsCredentialFilePath: () => skillsCredentialFilePath,
|
|
44822
|
+
skillsCredentialOrReason: () => skillsCredentialOrReason,
|
|
44626
44823
|
skillsCredentialFiles: () => skillsCredentialFiles,
|
|
44627
|
-
|
|
44824
|
+
skillsCredentialFilePath: () => skillsCredentialFilePath,
|
|
44825
|
+
skillsApiRequestUrl: () => skillsApiRequestUrl,
|
|
44826
|
+
selectsSkillsLocalMode: () => selectsSkillsLocalMode,
|
|
44827
|
+
resolveSkillsFleet: () => resolveSkillsFleet,
|
|
44828
|
+
resolveSkillsConnection: () => resolveSkillsConnection,
|
|
44829
|
+
resolveSkillsApiOrigin: () => resolveSkillsApiOrigin,
|
|
44830
|
+
resolveSkillsApiKey: () => resolveSkillsApiKey,
|
|
44831
|
+
resetLocalSkillsModeNotice: () => resetLocalSkillsModeNotice,
|
|
44832
|
+
requireSkillsFleet: () => requireSkillsFleet,
|
|
44833
|
+
requireSkillsApiOrigin: () => requireSkillsApiOrigin,
|
|
44834
|
+
requireSkillsApiKey: () => requireSkillsApiKey,
|
|
44835
|
+
noticeLocalSkillsMode: () => noticeLocalSkillsMode,
|
|
44836
|
+
normalizeSkillsApiOrigin: () => normalizeSkillsApiOrigin,
|
|
44837
|
+
isSkillsLocalOptIn: () => isSkillsLocalOptIn,
|
|
44838
|
+
isSkillsFleetCredentialError: () => isSkillsFleetCredentialError,
|
|
44839
|
+
configuredSkillsApiUrl: () => configuredSkillsApiUrl,
|
|
44840
|
+
SkillsFleetCredentialError: () => SkillsFleetCredentialError,
|
|
44841
|
+
SKILLS_LOCAL_OPT_IN_ENV_KEYS: () => SKILLS_LOCAL_OPT_IN_ENV_KEYS,
|
|
44842
|
+
SKILLS_APP: () => SKILLS_APP,
|
|
44843
|
+
SKILLS_API_URL_ENV_KEYS: () => SKILLS_API_URL_ENV_KEYS,
|
|
44844
|
+
SKILLS_API_URL_ENV: () => SKILLS_API_URL_ENV,
|
|
44845
|
+
SKILLS_API_KEY_ENV_KEYS: () => SKILLS_API_KEY_ENV_KEYS,
|
|
44846
|
+
SKILLS_API_KEY_ENV: () => SKILLS_API_KEY_ENV,
|
|
44847
|
+
MissingSkillsFleetError: () => MissingSkillsFleetError
|
|
44628
44848
|
});
|
|
44629
44849
|
function isCredentialResolutionError(error) {
|
|
44630
44850
|
return error instanceof CredentialResolutionError || typeof error === "object" && error !== null && error.name === "CredentialResolutionError";
|
|
@@ -44643,7 +44863,9 @@ function normalizeSkillsApiOrigin(apiUrl) {
|
|
|
44643
44863
|
throw new SkillsFleetCredentialError("A Skills API URL must use HTTPS (or loopback HTTP), without credentials, query or fragment", "INVALID_API_URL");
|
|
44644
44864
|
}
|
|
44645
44865
|
const pathname = url.pathname.replace(/\/+$/, "");
|
|
44646
|
-
if (
|
|
44866
|
+
if (url.origin === "https://api.hasna.com" && pathname === "/skills/v1") {
|
|
44867
|
+
url.pathname = "/skills";
|
|
44868
|
+
} else if (pathname === "/api" || pathname === "/api/v1") {
|
|
44647
44869
|
url.pathname = "/";
|
|
44648
44870
|
} else if (pathname.endsWith("/api/v1")) {
|
|
44649
44871
|
url.pathname = pathname.slice(0, -"/api/v1".length) || "/";
|
|
@@ -44652,6 +44874,21 @@ function normalizeSkillsApiOrigin(apiUrl) {
|
|
|
44652
44874
|
}
|
|
44653
44875
|
return url.toString().replace(/\/+$/, "");
|
|
44654
44876
|
}
|
|
44877
|
+
function skillsApiRequestUrl(apiUrl, route) {
|
|
44878
|
+
const origin = normalizeSkillsApiOrigin(apiUrl);
|
|
44879
|
+
if (!route.startsWith("/api/") || route.includes("#") || route.includes("\\")) {
|
|
44880
|
+
throw new SkillsFleetCredentialError("Invalid Skills API route", "INVALID_API_URL");
|
|
44881
|
+
}
|
|
44882
|
+
if (origin === "https://api.hasna.com/skills") {
|
|
44883
|
+
if (route === "/api/auth/whoami")
|
|
44884
|
+
return `${origin}/v1/auth/whoami`;
|
|
44885
|
+
if (!route.startsWith("/api/v1/")) {
|
|
44886
|
+
throw new SkillsFleetCredentialError("The internal Skills gateway has no established login contract yet. Select an explicitly configured instance with supported authentication.", "GATEWAY_AUTH_UNAVAILABLE");
|
|
44887
|
+
}
|
|
44888
|
+
return `${origin}${route.slice("/api".length)}`;
|
|
44889
|
+
}
|
|
44890
|
+
return `${origin}${route}`;
|
|
44891
|
+
}
|
|
44655
44892
|
function configuredSkillsApiUrl(env3 = process.env, keychain, profile) {
|
|
44656
44893
|
const declared = SKILLS_API_URL_ENV_KEYS.filter((key) => env3[key] !== undefined).map((key) => ({ key, value: env3[key] }));
|
|
44657
44894
|
for (const entry of declared) {
|
|
@@ -48730,113 +48967,113 @@ var init_types = __esm(() => {
|
|
|
48730
48967
|
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
|
|
48731
48968
|
var exports_external = {};
|
|
48732
48969
|
__export(exports_external, {
|
|
48733
|
-
|
|
48734
|
-
DIRTY: () => DIRTY,
|
|
48735
|
-
EMPTY_PATH: () => EMPTY_PATH,
|
|
48736
|
-
INVALID: () => INVALID,
|
|
48737
|
-
NEVER: () => NEVER,
|
|
48738
|
-
OK: () => OK,
|
|
48739
|
-
ParseStatus: () => ParseStatus,
|
|
48740
|
-
Schema: () => ZodType,
|
|
48741
|
-
ZodAny: () => ZodAny,
|
|
48742
|
-
ZodArray: () => ZodArray,
|
|
48743
|
-
ZodBigInt: () => ZodBigInt,
|
|
48744
|
-
ZodBoolean: () => ZodBoolean,
|
|
48745
|
-
ZodBranded: () => ZodBranded,
|
|
48746
|
-
ZodCatch: () => ZodCatch,
|
|
48747
|
-
ZodDate: () => ZodDate,
|
|
48748
|
-
ZodDefault: () => ZodDefault,
|
|
48749
|
-
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
48750
|
-
ZodEffects: () => ZodEffects,
|
|
48751
|
-
ZodEnum: () => ZodEnum,
|
|
48752
|
-
ZodError: () => ZodError,
|
|
48753
|
-
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
48754
|
-
ZodFunction: () => ZodFunction,
|
|
48755
|
-
ZodIntersection: () => ZodIntersection,
|
|
48756
|
-
ZodIssueCode: () => ZodIssueCode,
|
|
48757
|
-
ZodLazy: () => ZodLazy,
|
|
48758
|
-
ZodLiteral: () => ZodLiteral,
|
|
48759
|
-
ZodMap: () => ZodMap,
|
|
48760
|
-
ZodNaN: () => ZodNaN,
|
|
48761
|
-
ZodNativeEnum: () => ZodNativeEnum,
|
|
48762
|
-
ZodNever: () => ZodNever,
|
|
48763
|
-
ZodNull: () => ZodNull,
|
|
48764
|
-
ZodNullable: () => ZodNullable,
|
|
48765
|
-
ZodNumber: () => ZodNumber,
|
|
48766
|
-
ZodObject: () => ZodObject,
|
|
48767
|
-
ZodOptional: () => ZodOptional,
|
|
48768
|
-
ZodParsedType: () => ZodParsedType,
|
|
48769
|
-
ZodPipeline: () => ZodPipeline,
|
|
48770
|
-
ZodPromise: () => ZodPromise,
|
|
48771
|
-
ZodReadonly: () => ZodReadonly,
|
|
48772
|
-
ZodRecord: () => ZodRecord,
|
|
48773
|
-
ZodSchema: () => ZodType,
|
|
48774
|
-
ZodSet: () => ZodSet,
|
|
48775
|
-
ZodString: () => ZodString,
|
|
48776
|
-
ZodSymbol: () => ZodSymbol,
|
|
48777
|
-
ZodTransformer: () => ZodEffects,
|
|
48778
|
-
ZodTuple: () => ZodTuple,
|
|
48779
|
-
ZodType: () => ZodType,
|
|
48780
|
-
ZodUndefined: () => ZodUndefined,
|
|
48781
|
-
ZodUnion: () => ZodUnion,
|
|
48782
|
-
ZodUnknown: () => ZodUnknown,
|
|
48783
|
-
ZodVoid: () => ZodVoid,
|
|
48784
|
-
addIssueToContext: () => addIssueToContext,
|
|
48785
|
-
any: () => anyType,
|
|
48786
|
-
array: () => arrayType,
|
|
48787
|
-
bigint: () => bigIntType,
|
|
48788
|
-
boolean: () => booleanType,
|
|
48789
|
-
coerce: () => coerce,
|
|
48790
|
-
custom: () => custom,
|
|
48791
|
-
date: () => dateType,
|
|
48792
|
-
datetimeRegex: () => datetimeRegex,
|
|
48793
|
-
defaultErrorMap: () => en_default,
|
|
48794
|
-
discriminatedUnion: () => discriminatedUnionType,
|
|
48795
|
-
effect: () => effectsType,
|
|
48796
|
-
enum: () => enumType,
|
|
48797
|
-
function: () => functionType,
|
|
48798
|
-
getErrorMap: () => getErrorMap,
|
|
48799
|
-
getParsedType: () => getParsedType,
|
|
48800
|
-
instanceof: () => instanceOfType,
|
|
48801
|
-
intersection: () => intersectionType,
|
|
48802
|
-
isAborted: () => isAborted,
|
|
48803
|
-
isAsync: () => isAsync,
|
|
48804
|
-
isDirty: () => isDirty,
|
|
48805
|
-
isValid: () => isValid,
|
|
48806
|
-
late: () => late,
|
|
48807
|
-
lazy: () => lazyType,
|
|
48808
|
-
literal: () => literalType,
|
|
48809
|
-
makeIssue: () => makeIssue,
|
|
48810
|
-
map: () => mapType,
|
|
48811
|
-
nan: () => nanType,
|
|
48812
|
-
nativeEnum: () => nativeEnumType,
|
|
48813
|
-
never: () => neverType,
|
|
48814
|
-
null: () => nullType,
|
|
48815
|
-
nullable: () => nullableType,
|
|
48816
|
-
number: () => numberType,
|
|
48817
|
-
object: () => objectType,
|
|
48818
|
-
objectUtil: () => objectUtil,
|
|
48819
|
-
oboolean: () => oboolean,
|
|
48820
|
-
onumber: () => onumber,
|
|
48821
|
-
optional: () => optionalType,
|
|
48822
|
-
ostring: () => ostring,
|
|
48823
|
-
pipeline: () => pipelineType,
|
|
48824
|
-
preprocess: () => preprocessType,
|
|
48825
|
-
promise: () => promiseType,
|
|
48826
|
-
quotelessJson: () => quotelessJson,
|
|
48827
|
-
record: () => recordType,
|
|
48828
|
-
set: () => setType,
|
|
48829
|
-
setErrorMap: () => setErrorMap,
|
|
48830
|
-
strictObject: () => strictObjectType,
|
|
48831
|
-
string: () => stringType,
|
|
48832
|
-
symbol: () => symbolType,
|
|
48833
|
-
transformer: () => effectsType,
|
|
48834
|
-
tuple: () => tupleType,
|
|
48835
|
-
undefined: () => undefinedType,
|
|
48836
|
-
union: () => unionType,
|
|
48837
|
-
unknown: () => unknownType,
|
|
48970
|
+
void: () => voidType,
|
|
48838
48971
|
util: () => util,
|
|
48839
|
-
|
|
48972
|
+
unknown: () => unknownType,
|
|
48973
|
+
union: () => unionType,
|
|
48974
|
+
undefined: () => undefinedType,
|
|
48975
|
+
tuple: () => tupleType,
|
|
48976
|
+
transformer: () => effectsType,
|
|
48977
|
+
symbol: () => symbolType,
|
|
48978
|
+
string: () => stringType,
|
|
48979
|
+
strictObject: () => strictObjectType,
|
|
48980
|
+
setErrorMap: () => setErrorMap,
|
|
48981
|
+
set: () => setType,
|
|
48982
|
+
record: () => recordType,
|
|
48983
|
+
quotelessJson: () => quotelessJson,
|
|
48984
|
+
promise: () => promiseType,
|
|
48985
|
+
preprocess: () => preprocessType,
|
|
48986
|
+
pipeline: () => pipelineType,
|
|
48987
|
+
ostring: () => ostring,
|
|
48988
|
+
optional: () => optionalType,
|
|
48989
|
+
onumber: () => onumber,
|
|
48990
|
+
oboolean: () => oboolean,
|
|
48991
|
+
objectUtil: () => objectUtil,
|
|
48992
|
+
object: () => objectType,
|
|
48993
|
+
number: () => numberType,
|
|
48994
|
+
nullable: () => nullableType,
|
|
48995
|
+
null: () => nullType,
|
|
48996
|
+
never: () => neverType,
|
|
48997
|
+
nativeEnum: () => nativeEnumType,
|
|
48998
|
+
nan: () => nanType,
|
|
48999
|
+
map: () => mapType,
|
|
49000
|
+
makeIssue: () => makeIssue,
|
|
49001
|
+
literal: () => literalType,
|
|
49002
|
+
lazy: () => lazyType,
|
|
49003
|
+
late: () => late,
|
|
49004
|
+
isValid: () => isValid,
|
|
49005
|
+
isDirty: () => isDirty,
|
|
49006
|
+
isAsync: () => isAsync,
|
|
49007
|
+
isAborted: () => isAborted,
|
|
49008
|
+
intersection: () => intersectionType,
|
|
49009
|
+
instanceof: () => instanceOfType,
|
|
49010
|
+
getParsedType: () => getParsedType,
|
|
49011
|
+
getErrorMap: () => getErrorMap,
|
|
49012
|
+
function: () => functionType,
|
|
49013
|
+
enum: () => enumType,
|
|
49014
|
+
effect: () => effectsType,
|
|
49015
|
+
discriminatedUnion: () => discriminatedUnionType,
|
|
49016
|
+
defaultErrorMap: () => en_default,
|
|
49017
|
+
datetimeRegex: () => datetimeRegex,
|
|
49018
|
+
date: () => dateType,
|
|
49019
|
+
custom: () => custom,
|
|
49020
|
+
coerce: () => coerce,
|
|
49021
|
+
boolean: () => booleanType,
|
|
49022
|
+
bigint: () => bigIntType,
|
|
49023
|
+
array: () => arrayType,
|
|
49024
|
+
any: () => anyType,
|
|
49025
|
+
addIssueToContext: () => addIssueToContext,
|
|
49026
|
+
ZodVoid: () => ZodVoid,
|
|
49027
|
+
ZodUnknown: () => ZodUnknown,
|
|
49028
|
+
ZodUnion: () => ZodUnion,
|
|
49029
|
+
ZodUndefined: () => ZodUndefined,
|
|
49030
|
+
ZodType: () => ZodType,
|
|
49031
|
+
ZodTuple: () => ZodTuple,
|
|
49032
|
+
ZodTransformer: () => ZodEffects,
|
|
49033
|
+
ZodSymbol: () => ZodSymbol,
|
|
49034
|
+
ZodString: () => ZodString,
|
|
49035
|
+
ZodSet: () => ZodSet,
|
|
49036
|
+
ZodSchema: () => ZodType,
|
|
49037
|
+
ZodRecord: () => ZodRecord,
|
|
49038
|
+
ZodReadonly: () => ZodReadonly,
|
|
49039
|
+
ZodPromise: () => ZodPromise,
|
|
49040
|
+
ZodPipeline: () => ZodPipeline,
|
|
49041
|
+
ZodParsedType: () => ZodParsedType,
|
|
49042
|
+
ZodOptional: () => ZodOptional,
|
|
49043
|
+
ZodObject: () => ZodObject,
|
|
49044
|
+
ZodNumber: () => ZodNumber,
|
|
49045
|
+
ZodNullable: () => ZodNullable,
|
|
49046
|
+
ZodNull: () => ZodNull,
|
|
49047
|
+
ZodNever: () => ZodNever,
|
|
49048
|
+
ZodNativeEnum: () => ZodNativeEnum,
|
|
49049
|
+
ZodNaN: () => ZodNaN,
|
|
49050
|
+
ZodMap: () => ZodMap,
|
|
49051
|
+
ZodLiteral: () => ZodLiteral,
|
|
49052
|
+
ZodLazy: () => ZodLazy,
|
|
49053
|
+
ZodIssueCode: () => ZodIssueCode,
|
|
49054
|
+
ZodIntersection: () => ZodIntersection,
|
|
49055
|
+
ZodFunction: () => ZodFunction,
|
|
49056
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
49057
|
+
ZodError: () => ZodError,
|
|
49058
|
+
ZodEnum: () => ZodEnum,
|
|
49059
|
+
ZodEffects: () => ZodEffects,
|
|
49060
|
+
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
49061
|
+
ZodDefault: () => ZodDefault,
|
|
49062
|
+
ZodDate: () => ZodDate,
|
|
49063
|
+
ZodCatch: () => ZodCatch,
|
|
49064
|
+
ZodBranded: () => ZodBranded,
|
|
49065
|
+
ZodBoolean: () => ZodBoolean,
|
|
49066
|
+
ZodBigInt: () => ZodBigInt,
|
|
49067
|
+
ZodArray: () => ZodArray,
|
|
49068
|
+
ZodAny: () => ZodAny,
|
|
49069
|
+
Schema: () => ZodType,
|
|
49070
|
+
ParseStatus: () => ParseStatus,
|
|
49071
|
+
OK: () => OK,
|
|
49072
|
+
NEVER: () => NEVER,
|
|
49073
|
+
INVALID: () => INVALID,
|
|
49074
|
+
EMPTY_PATH: () => EMPTY_PATH,
|
|
49075
|
+
DIRTY: () => DIRTY,
|
|
49076
|
+
BRAND: () => BRAND
|
|
48840
49077
|
});
|
|
48841
49078
|
var init_external = __esm(() => {
|
|
48842
49079
|
init_errors();
|
|
@@ -48872,7 +49109,14 @@ function getConfiguredApiUrl(env3 = process.env) {
|
|
|
48872
49109
|
}
|
|
48873
49110
|
function buildSkillsApiUrl(apiUrl, endpoint = "/skills") {
|
|
48874
49111
|
const url = new URL(apiUrl);
|
|
49112
|
+
if (url.origin === "https://api.hasna.com" && /^\/skills\/(?:api\/)?v1\/skills\/?$/.test(url.pathname)) {
|
|
49113
|
+
url.pathname = "/skills";
|
|
49114
|
+
apiUrl = url.toString();
|
|
49115
|
+
}
|
|
48875
49116
|
const cleanEndpoint = endpoint.startsWith("/") ? endpoint : `/${endpoint}`;
|
|
49117
|
+
if (normalizeSkillsApiOrigin(apiUrl) === "https://api.hasna.com/skills") {
|
|
49118
|
+
return skillsApiRequestUrl(apiUrl, `/api/v1${cleanEndpoint}`);
|
|
49119
|
+
}
|
|
48876
49120
|
const pathname = url.pathname.replace(/\/+$/, "");
|
|
48877
49121
|
const apiBase = /\/api(?:\/v1)?\/skills$/.test(pathname) ? pathname.slice(0, -"/skills".length) : pathname;
|
|
48878
49122
|
if (/\/api(?:\/v1)?$/.test(apiBase)) {
|
|
@@ -49713,8 +49957,17 @@ function creditCount(value) {
|
|
|
49713
49957
|
}
|
|
49714
49958
|
return value;
|
|
49715
49959
|
}
|
|
49960
|
+
function runQuoteReceipt(value) {
|
|
49961
|
+
if (value === undefined)
|
|
49962
|
+
return;
|
|
49963
|
+
if (typeof value !== "string" || !value.length || Buffer.byteLength(value, "utf8") > 4096) {
|
|
49964
|
+
throw new Error("Invalid quote receipt");
|
|
49965
|
+
}
|
|
49966
|
+
return value;
|
|
49967
|
+
}
|
|
49716
49968
|
function parseRemoteRunQuote(value) {
|
|
49717
49969
|
const quote = object(value);
|
|
49970
|
+
runQuoteReceipt(quote.quoteReceipt);
|
|
49718
49971
|
const pricing = object(quote.pricing);
|
|
49719
49972
|
if (typeof quote.skill !== "string" || !/^[a-z0-9][a-z0-9-]*$/.test(quote.skill))
|
|
49720
49973
|
throw new Error("Invalid quoted skill");
|
|
@@ -49788,11 +50041,11 @@ var init_remote_account = __esm(() => {
|
|
|
49788
50041
|
// src/lib/remote-files.ts
|
|
49789
50042
|
var exports_remote_files = {};
|
|
49790
50043
|
__export(exports_remote_files, {
|
|
49791
|
-
|
|
49792
|
-
decodeRemoteFiles: () => decodeRemoteFiles,
|
|
49793
|
-
describeRemoteFiles: () => describeRemoteFiles,
|
|
50044
|
+
sha256: () => sha256,
|
|
49794
50045
|
readBoundedResponse: () => readBoundedResponse,
|
|
49795
|
-
|
|
50046
|
+
describeRemoteFiles: () => describeRemoteFiles,
|
|
50047
|
+
decodeRemoteFiles: () => decodeRemoteFiles,
|
|
50048
|
+
MAX_REMOTE_FILE_BYTES: () => MAX_REMOTE_FILE_BYTES
|
|
49796
50049
|
});
|
|
49797
50050
|
import { createHash as createHash2 } from "crypto";
|
|
49798
50051
|
function describeRemoteFiles(files) {
|
|
@@ -49969,15 +50222,15 @@ var init_remote_quote_errors = __esm(() => {
|
|
|
49969
50222
|
// src/lib/remote-client.ts
|
|
49970
50223
|
var exports_remote_client = {};
|
|
49971
50224
|
__export(exports_remote_client, {
|
|
49972
|
-
|
|
49973
|
-
RemoteQuoteUnavailableError: () => RemoteQuoteUnavailableError,
|
|
49974
|
-
RemoteRequestError: () => RemoteRequestError,
|
|
49975
|
-
RemoteRouteUnsupportedError: () => RemoteRouteUnsupportedError,
|
|
49976
|
-
RemoteSkillsClient: () => RemoteSkillsClient,
|
|
49977
|
-
RemoteWorkspaceMemberError: () => RemoteWorkspaceMemberError,
|
|
49978
|
-
RemoteWorkspaceSelectionError: () => RemoteWorkspaceSelectionError,
|
|
50225
|
+
createRemoteSkillsClientReadOnly: () => createRemoteSkillsClientReadOnly,
|
|
49979
50226
|
createRemoteSkillsClient: () => createRemoteSkillsClient,
|
|
49980
|
-
|
|
50227
|
+
RemoteWorkspaceSelectionError: () => RemoteWorkspaceSelectionError,
|
|
50228
|
+
RemoteWorkspaceMemberError: () => RemoteWorkspaceMemberError,
|
|
50229
|
+
RemoteSkillsClient: () => RemoteSkillsClient,
|
|
50230
|
+
RemoteRouteUnsupportedError: () => RemoteRouteUnsupportedError,
|
|
50231
|
+
RemoteRequestError: () => RemoteRequestError,
|
|
50232
|
+
RemoteQuoteUnavailableError: () => RemoteQuoteUnavailableError,
|
|
50233
|
+
RemoteCapabilityUnavailableError: () => RemoteCapabilityUnavailableError
|
|
49981
50234
|
});
|
|
49982
50235
|
|
|
49983
50236
|
class RemoteSkillsClient {
|
|
@@ -49989,7 +50242,7 @@ class RemoteSkillsClient {
|
|
|
49989
50242
|
this.apiUrl = normalizeSkillsApiOrigin(apiUrl);
|
|
49990
50243
|
}
|
|
49991
50244
|
async request(path, options) {
|
|
49992
|
-
return fetch(
|
|
50245
|
+
return fetch(skillsApiRequestUrl(this.apiUrl, path), {
|
|
49993
50246
|
...options,
|
|
49994
50247
|
redirect: "error",
|
|
49995
50248
|
credentials: "omit",
|
|
@@ -50049,6 +50302,7 @@ class RemoteSkillsClient {
|
|
|
50049
50302
|
return { status: res.status, body };
|
|
50050
50303
|
}
|
|
50051
50304
|
async submitRun(slug, input, args, approval = {}) {
|
|
50305
|
+
const quoteReceipt = runQuoteReceipt(approval.quoteReceipt);
|
|
50052
50306
|
if (approval.idempotencyKey !== undefined && !/^[A-Za-z0-9._:-]{1,128}$/.test(approval.idempotencyKey))
|
|
50053
50307
|
throw new Error("Idempotency key must be 1-128 URL-safe characters");
|
|
50054
50308
|
if (approval.maxCostCents !== undefined)
|
|
@@ -50065,15 +50319,20 @@ class RemoteSkillsClient {
|
|
|
50065
50319
|
...approval.maxCredits !== undefined ? { maxCredits: approval.maxCredits } : {},
|
|
50066
50320
|
...approval.maxCostCents !== undefined ? { maxCostCents: approval.maxCostCents } : {},
|
|
50067
50321
|
...approval.idempotencyKey !== undefined ? { idempotencyKey: approval.idempotencyKey } : {},
|
|
50068
|
-
...approval.inputFiles !== undefined ? { files: approval.inputFiles } : {}
|
|
50322
|
+
...approval.inputFiles !== undefined ? { files: approval.inputFiles } : {},
|
|
50323
|
+
...quoteReceipt !== undefined ? { quoteReceipt } : {}
|
|
50069
50324
|
})
|
|
50070
50325
|
});
|
|
50326
|
+
if (!res.ok) {
|
|
50327
|
+
res.body?.cancel().catch(() => {});
|
|
50328
|
+
throw new RemoteRequestError(`/api/v1/runs/${encodeURIComponent(slug)}`, res.status);
|
|
50329
|
+
}
|
|
50071
50330
|
return normalizeRemoteSkillRunContract(await res.json(), slug);
|
|
50072
50331
|
}
|
|
50073
|
-
async quoteRun(slug, input = {}, args = []) {
|
|
50332
|
+
async quoteRun(slug, input = {}, args = [], files) {
|
|
50074
50333
|
const response = await this.requestNewRoute(`/api/v1/skills/${encodeURIComponent(slug)}/quote`, {
|
|
50075
50334
|
method: "POST",
|
|
50076
|
-
body: JSON.stringify({ input, args })
|
|
50335
|
+
body: JSON.stringify({ input, args, ...files === undefined ? {} : { files } })
|
|
50077
50336
|
}, { quoteRefusal: true });
|
|
50078
50337
|
return parseRemoteRunQuote(await response.json());
|
|
50079
50338
|
}
|
|
@@ -50089,17 +50348,24 @@ class RemoteSkillsClient {
|
|
|
50089
50348
|
return this.capabilities;
|
|
50090
50349
|
}
|
|
50091
50350
|
async submitQuotedRun(slug, input = {}, args = [], approval = {}) {
|
|
50351
|
+
runQuoteReceipt(approval.quoteReceipt);
|
|
50352
|
+
({ input, args, approval } = JSON.parse(JSON.stringify({ input, args, approval })));
|
|
50092
50353
|
const maximum = creditCount(approval.maxCredits ?? approval.maxCostCents ?? 0);
|
|
50093
50354
|
if (approval.maxCostCents !== undefined && approval.maxCostCents !== maximum)
|
|
50094
50355
|
throw new Error("Credit approval fields disagree");
|
|
50095
|
-
const quote = await this.quoteRun(slug, input, args);
|
|
50096
|
-
if (quote.pricing.costCents > maximum)
|
|
50356
|
+
const quote = approval.quoteReceipt === undefined ? await this.quoteRun(slug, input, args, approval.inputFiles?.length ? approval.inputFiles : undefined) : undefined;
|
|
50357
|
+
if (quote && quote.pricing.costCents > maximum)
|
|
50097
50358
|
throw new RemoteCreditApprovalError(quote.pricing.costCents, maximum);
|
|
50098
50359
|
const capabilities = await this.getCapabilities();
|
|
50099
50360
|
if (!capabilities.capabilities.includes("runs.submit") || capabilities.billing?.boundedRunApproval !== true || capabilities.billing.unit !== "credits") {
|
|
50100
50361
|
throw new Error("The configured server does not support bounded credit approval; refusing remote submission");
|
|
50101
50362
|
}
|
|
50102
|
-
return this.submitRun(quote
|
|
50363
|
+
return this.submitRun(quote?.skill ?? slug, input, args, {
|
|
50364
|
+
...approval,
|
|
50365
|
+
maxCredits: maximum,
|
|
50366
|
+
maxCostCents: maximum,
|
|
50367
|
+
...(quote?.quoteReceipt ?? approval.quoteReceipt) === undefined ? {} : { quoteReceipt: quote?.quoteReceipt ?? approval.quoteReceipt }
|
|
50368
|
+
});
|
|
50103
50369
|
}
|
|
50104
50370
|
async getIdentity() {
|
|
50105
50371
|
return (await this.requestNewRoute("/api/auth/whoami")).json();
|
|
@@ -50387,6 +50653,10 @@ class RemoteSkillsClient {
|
|
|
50387
50653
|
return { id: artifactId, fileName: String(artifact.fileName ?? artifactId), bytes, byteSize: bytes.byteLength, sha256: artifact.sha256 };
|
|
50388
50654
|
}
|
|
50389
50655
|
async submitQuotedRunWithFiles(slug, input, args, files, approval = {}) {
|
|
50656
|
+
runQuoteReceipt(approval.quoteReceipt);
|
|
50657
|
+
({ input, args, approval } = JSON.parse(JSON.stringify({ input, args, approval })));
|
|
50658
|
+
describeRemoteFiles(files);
|
|
50659
|
+
files = files.map((file) => ({ name: file.name, contentType: file.contentType, bytes: new Uint8Array(file.bytes) }));
|
|
50390
50660
|
const inputFiles = describeRemoteFiles(files);
|
|
50391
50661
|
if (files.length && !(await this.getCapabilities()).capabilities.includes("runs.uploads"))
|
|
50392
50662
|
throw new Error("The configured server does not support input uploads");
|
|
@@ -50450,7 +50720,7 @@ class RemoteSkillsClient {
|
|
|
50450
50720
|
const headers = { Authorization: `Bearer ${this.apiKey}` };
|
|
50451
50721
|
if (ifMatch)
|
|
50452
50722
|
headers["If-Match"] = ifMatch;
|
|
50453
|
-
return fetch(
|
|
50723
|
+
return fetch(skillsApiRequestUrl(this.apiUrl, "/api/v1/skills"), {
|
|
50454
50724
|
method: "POST",
|
|
50455
50725
|
headers,
|
|
50456
50726
|
body: form,
|
|
@@ -50773,6 +51043,7 @@ var init_revision = __esm(() => {
|
|
|
50773
51043
|
import { createHash as createHash4 } from "crypto";
|
|
50774
51044
|
import { readFileSync as readFileSync13, readdirSync as readdirSync9, statSync as statSync10 } from "fs";
|
|
50775
51045
|
import { join as join19, relative as relative2 } from "path";
|
|
51046
|
+
import { createGunzip } from "zlib";
|
|
50776
51047
|
function isDotenvFile(lower) {
|
|
50777
51048
|
if (lower === ".env" || lower.startsWith(".env."))
|
|
50778
51049
|
return true;
|
|
@@ -50972,7 +51243,211 @@ function concat2(chunks) {
|
|
|
50972
51243
|
}
|
|
50973
51244
|
return merged;
|
|
50974
51245
|
}
|
|
50975
|
-
|
|
51246
|
+
function invalidBundle(message) {
|
|
51247
|
+
throw new SkillBundleInspectionError("BUNDLE_INVALID", message);
|
|
51248
|
+
}
|
|
51249
|
+
function inspectionLimits(options) {
|
|
51250
|
+
const limits = { ...SKILL_BUNDLE_INSPECTION_LIMITS };
|
|
51251
|
+
for (const key of Object.keys(options.limits ?? {})) {
|
|
51252
|
+
if (!Object.hasOwn(limits, key))
|
|
51253
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Unknown bundle limit");
|
|
51254
|
+
const field = key;
|
|
51255
|
+
const value = options.limits[field];
|
|
51256
|
+
if (!Number.isSafeInteger(value) || value <= 0 || value > limits[field]) {
|
|
51257
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle limits must be positive integers within the hard ceilings");
|
|
51258
|
+
}
|
|
51259
|
+
limits[field] = value;
|
|
51260
|
+
}
|
|
51261
|
+
return limits;
|
|
51262
|
+
}
|
|
51263
|
+
async function inspectSkillBundle(bundle, options = {}) {
|
|
51264
|
+
const signal = options.signal;
|
|
51265
|
+
const limits = inspectionLimits(options);
|
|
51266
|
+
const deadline = performance.now() + limits.timeoutMs;
|
|
51267
|
+
const check = () => {
|
|
51268
|
+
if (signal?.aborted)
|
|
51269
|
+
throw new SkillBundleInspectionError("BUNDLE_ABORTED", "Bundle inspection aborted");
|
|
51270
|
+
if (performance.now() >= deadline)
|
|
51271
|
+
throw new SkillBundleInspectionError("BUNDLE_TIMEOUT", "Bundle inspection deadline exceeded");
|
|
51272
|
+
};
|
|
51273
|
+
check();
|
|
51274
|
+
if (bundle.byteLength > limits.compressedBytes)
|
|
51275
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Compressed bundle exceeds byte limit");
|
|
51276
|
+
const snapshot = ownBytes(bundle);
|
|
51277
|
+
check();
|
|
51278
|
+
const sha2562 = sha256Hex(snapshot);
|
|
51279
|
+
check();
|
|
51280
|
+
const parser = new BoundedTarReader(limits, check);
|
|
51281
|
+
const streamOptions = { chunkSize: 16 * 1024, highWaterMark: 16 * 1024 };
|
|
51282
|
+
const decoder = createGunzip(streamOptions);
|
|
51283
|
+
let terminalError;
|
|
51284
|
+
const stop = (code) => {
|
|
51285
|
+
terminalError ??= new SkillBundleInspectionError(code, code === "BUNDLE_ABORTED" ? "Bundle inspection aborted" : "Bundle inspection deadline exceeded");
|
|
51286
|
+
decoder.destroy(terminalError);
|
|
51287
|
+
};
|
|
51288
|
+
const onAbort = () => stop("BUNDLE_ABORTED");
|
|
51289
|
+
const timer = setTimeout(() => stop("BUNDLE_TIMEOUT"), Math.max(1, deadline - performance.now()));
|
|
51290
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
51291
|
+
let decompressedByteSize = 0;
|
|
51292
|
+
let bytesSinceYield = 0;
|
|
51293
|
+
try {
|
|
51294
|
+
check();
|
|
51295
|
+
decoder.end(snapshot);
|
|
51296
|
+
for await (const chunk2 of decoder) {
|
|
51297
|
+
check();
|
|
51298
|
+
decompressedByteSize += chunk2.byteLength;
|
|
51299
|
+
if (decompressedByteSize > limits.decompressedBytes)
|
|
51300
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Decompressed bundle exceeds byte limit");
|
|
51301
|
+
parser.push(chunk2);
|
|
51302
|
+
bytesSinceYield += chunk2.byteLength;
|
|
51303
|
+
if (bytesSinceYield >= 256 * 1024) {
|
|
51304
|
+
await new Promise((resolve3) => setTimeout(resolve3, 0));
|
|
51305
|
+
bytesSinceYield = 0;
|
|
51306
|
+
check();
|
|
51307
|
+
}
|
|
51308
|
+
}
|
|
51309
|
+
check();
|
|
51310
|
+
const entries = parser.finish();
|
|
51311
|
+
return {
|
|
51312
|
+
entries,
|
|
51313
|
+
sha256: sha2562,
|
|
51314
|
+
compressedByteSize: snapshot.byteLength,
|
|
51315
|
+
decompressedByteSize,
|
|
51316
|
+
unpackedByteSize: parser.fileBytes,
|
|
51317
|
+
fileCount: entries.length
|
|
51318
|
+
};
|
|
51319
|
+
} catch (error) {
|
|
51320
|
+
if (terminalError)
|
|
51321
|
+
throw terminalError;
|
|
51322
|
+
if (error instanceof SkillBundleInspectionError)
|
|
51323
|
+
throw error;
|
|
51324
|
+
throw new SkillBundleInspectionError("BUNDLE_INVALID", "Invalid or truncated gzip bundle");
|
|
51325
|
+
} finally {
|
|
51326
|
+
clearTimeout(timer);
|
|
51327
|
+
signal?.removeEventListener("abort", onAbort);
|
|
51328
|
+
decoder.destroy();
|
|
51329
|
+
}
|
|
51330
|
+
}
|
|
51331
|
+
|
|
51332
|
+
class BoundedTarReader {
|
|
51333
|
+
limits;
|
|
51334
|
+
check;
|
|
51335
|
+
header = new Uint8Array(BLOCK);
|
|
51336
|
+
headerOffset = 0;
|
|
51337
|
+
pending;
|
|
51338
|
+
bodyOffset = 0;
|
|
51339
|
+
padding = 0;
|
|
51340
|
+
zeroBlocks = 0;
|
|
51341
|
+
entries = [];
|
|
51342
|
+
paths = new SkillEntryPaths;
|
|
51343
|
+
fileBytes = 0;
|
|
51344
|
+
constructor(limits, check) {
|
|
51345
|
+
this.limits = limits;
|
|
51346
|
+
this.check = check;
|
|
51347
|
+
}
|
|
51348
|
+
push(chunk2) {
|
|
51349
|
+
let offset = 0;
|
|
51350
|
+
while (offset < chunk2.byteLength) {
|
|
51351
|
+
this.check();
|
|
51352
|
+
if (this.pending) {
|
|
51353
|
+
const count = Math.min(this.pending.bytes.byteLength - this.bodyOffset, chunk2.byteLength - offset);
|
|
51354
|
+
this.pending.bytes.set(chunk2.subarray(offset, offset + count), this.bodyOffset);
|
|
51355
|
+
offset += count;
|
|
51356
|
+
this.bodyOffset += count;
|
|
51357
|
+
if (this.bodyOffset === this.pending.bytes.byteLength) {
|
|
51358
|
+
this.entries.push(this.pending);
|
|
51359
|
+
this.pending = undefined;
|
|
51360
|
+
}
|
|
51361
|
+
} else if (this.padding) {
|
|
51362
|
+
const count = Math.min(this.padding, chunk2.byteLength - offset);
|
|
51363
|
+
if (chunk2.subarray(offset, offset + count).some((byte) => byte !== 0))
|
|
51364
|
+
invalidBundle("Nonzero tar body padding");
|
|
51365
|
+
offset += count;
|
|
51366
|
+
this.padding -= count;
|
|
51367
|
+
} else {
|
|
51368
|
+
const count = Math.min(BLOCK - this.headerOffset, chunk2.byteLength - offset);
|
|
51369
|
+
this.header.set(chunk2.subarray(offset, offset + count), this.headerOffset);
|
|
51370
|
+
offset += count;
|
|
51371
|
+
this.headerOffset += count;
|
|
51372
|
+
if (this.headerOffset === BLOCK) {
|
|
51373
|
+
this.readHeader();
|
|
51374
|
+
this.headerOffset = 0;
|
|
51375
|
+
}
|
|
51376
|
+
}
|
|
51377
|
+
}
|
|
51378
|
+
}
|
|
51379
|
+
finish() {
|
|
51380
|
+
this.check();
|
|
51381
|
+
if (this.pending || this.padding || this.headerOffset || this.zeroBlocks < 2)
|
|
51382
|
+
invalidBundle("Truncated tar bundle");
|
|
51383
|
+
return this.entries;
|
|
51384
|
+
}
|
|
51385
|
+
readHeader() {
|
|
51386
|
+
this.check();
|
|
51387
|
+
const h = this.header;
|
|
51388
|
+
if (h.every((byte) => byte === 0)) {
|
|
51389
|
+
this.zeroBlocks++;
|
|
51390
|
+
return;
|
|
51391
|
+
}
|
|
51392
|
+
if (this.zeroBlocks)
|
|
51393
|
+
invalidBundle("Nonzero tar data after terminator");
|
|
51394
|
+
if (this.entries.length >= this.limits.entries)
|
|
51395
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle entry limit exceeded");
|
|
51396
|
+
let checksum = 0;
|
|
51397
|
+
for (let i = 0;i < BLOCK; i++)
|
|
51398
|
+
checksum += i >= 148 && i < 156 ? 32 : h[i];
|
|
51399
|
+
if (tarOctal(h.subarray(148, 156)) !== checksum)
|
|
51400
|
+
invalidBundle("Invalid tar header checksum");
|
|
51401
|
+
if (new TextDecoder().decode(h.subarray(257, 265)) !== "ustar\x00" + "00")
|
|
51402
|
+
invalidBundle("Unsupported tar format");
|
|
51403
|
+
if (h[156] !== 48 && h[156] !== 0 || h.subarray(157, 257).some((b) => b !== 0) || h.subarray(345).some((b) => b !== 0))
|
|
51404
|
+
invalidBundle("Unsupported tar entry or path prefix");
|
|
51405
|
+
const mode = tarOctal(h.subarray(100, 108));
|
|
51406
|
+
if (mode > 511)
|
|
51407
|
+
invalidBundle("Unsupported tar permission bits");
|
|
51408
|
+
tarOctal(h.subarray(108, 116));
|
|
51409
|
+
tarOctal(h.subarray(116, 124));
|
|
51410
|
+
tarOctal(h.subarray(136, 148));
|
|
51411
|
+
const size2 = tarOctal(h.subarray(124, 136));
|
|
51412
|
+
if (size2 > this.limits.fileBytes || this.fileBytes + size2 > this.limits.decompressedBytes) {
|
|
51413
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle file byte limit exceeded");
|
|
51414
|
+
}
|
|
51415
|
+
const name = h.subarray(0, 100);
|
|
51416
|
+
const end = name.indexOf(0);
|
|
51417
|
+
if (end !== -1 && name.subarray(end).some((b) => b !== 0))
|
|
51418
|
+
invalidBundle("Invalid tar path padding");
|
|
51419
|
+
const raw = end === -1 ? name : name.subarray(0, end);
|
|
51420
|
+
if (raw.byteLength > this.limits.pathBytes)
|
|
51421
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle path byte limit exceeded");
|
|
51422
|
+
let path;
|
|
51423
|
+
try {
|
|
51424
|
+
path = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(raw);
|
|
51425
|
+
} catch {
|
|
51426
|
+
return invalidBundle("Invalid UTF-8 bundle path");
|
|
51427
|
+
}
|
|
51428
|
+
this.paths.add(path, this.limits.pathBytes, invalidBundle, () => {
|
|
51429
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle path byte limit exceeded");
|
|
51430
|
+
});
|
|
51431
|
+
this.fileBytes += size2;
|
|
51432
|
+
this.pending = { path, mode, bytes: new Uint8Array(new ArrayBuffer(size2)) };
|
|
51433
|
+
this.bodyOffset = 0;
|
|
51434
|
+
this.padding = (BLOCK - size2 % BLOCK) % BLOCK;
|
|
51435
|
+
if (!size2) {
|
|
51436
|
+
this.entries.push(this.pending);
|
|
51437
|
+
this.pending = undefined;
|
|
51438
|
+
}
|
|
51439
|
+
}
|
|
51440
|
+
}
|
|
51441
|
+
function tarOctal(field) {
|
|
51442
|
+
const text2 = new TextDecoder().decode(field);
|
|
51443
|
+
if (!/^[0-7]+[\0 ]*$/.test(text2))
|
|
51444
|
+
invalidBundle("Invalid tar octal field");
|
|
51445
|
+
const value = Number.parseInt(text2, 8);
|
|
51446
|
+
if (!Number.isSafeInteger(value))
|
|
51447
|
+
invalidBundle("Tar integer is out of range");
|
|
51448
|
+
return value;
|
|
51449
|
+
}
|
|
51450
|
+
var BLOCK = 512, ANY_SEGMENT_EXCLUDES, ROOT_EXCLUDES, TOOL_SIDECAR_FILENAMES, CREDENTIAL_FILENAMES, CREDENTIAL_EXTENSIONS, ENV_TEMPLATE_NAMES, NON_DOTENV_EXTENSIONS, SKILL_BUNDLE_INSPECTION_LIMITS, SkillBundleInspectionError;
|
|
50976
51451
|
var init_skill_bundle = __esm(() => {
|
|
50977
51452
|
ANY_SEGMENT_EXCLUDES = new Set([
|
|
50978
51453
|
".git",
|
|
@@ -51104,6 +51579,14 @@ var init_skill_bundle = __esm(() => {
|
|
|
51104
51579
|
pathBytes: 100,
|
|
51105
51580
|
timeoutMs: 5000
|
|
51106
51581
|
});
|
|
51582
|
+
SkillBundleInspectionError = class SkillBundleInspectionError extends Error {
|
|
51583
|
+
code;
|
|
51584
|
+
constructor(code, message) {
|
|
51585
|
+
super(message);
|
|
51586
|
+
this.code = code;
|
|
51587
|
+
this.name = "SkillBundleInspectionError";
|
|
51588
|
+
}
|
|
51589
|
+
};
|
|
51107
51590
|
});
|
|
51108
51591
|
|
|
51109
51592
|
// src/lib/skill-version.ts
|
|
@@ -51559,8 +52042,8 @@ var init_pull = __esm(() => {
|
|
|
51559
52042
|
// src/cli/commands/install.ts
|
|
51560
52043
|
var exports_install = {};
|
|
51561
52044
|
__export(exports_install, {
|
|
51562
|
-
|
|
51563
|
-
|
|
52045
|
+
registerInstall: () => registerInstall,
|
|
52046
|
+
pinExactVersion: () => pinExactVersion
|
|
51564
52047
|
});
|
|
51565
52048
|
function registerInstall(parent) {
|
|
51566
52049
|
parent.command("install").argument("[args...]", "Deprecated. Use 'skills pin <name>' for project skill pins.").option("--json", "Output result as JSON", false).description("Deprecated. Render skills into native agent folders with 'skills render'.").action((args, options) => handleDeprecatedInstall(args, options));
|
|
@@ -52239,14 +52722,14 @@ var init_list = __esm(() => {
|
|
|
52239
52722
|
// src/lib/skillinfo.ts
|
|
52240
52723
|
var exports_skillinfo = {};
|
|
52241
52724
|
__export(exports_skillinfo, {
|
|
52242
|
-
|
|
52243
|
-
generateEnvExample: () => generateEnvExample,
|
|
52244
|
-
generateSkillMd: () => generateSkillMd,
|
|
52245
|
-
getSkillBestDoc: () => getSkillBestDoc,
|
|
52246
|
-
getSkillDependencyStatus: () => getSkillDependencyStatus,
|
|
52247
|
-
getSkillDocs: () => getSkillDocs,
|
|
52725
|
+
runSkill: () => runSkill,
|
|
52248
52726
|
getSkillRequirements: () => getSkillRequirements,
|
|
52249
|
-
|
|
52727
|
+
getSkillDocs: () => getSkillDocs,
|
|
52728
|
+
getSkillDependencyStatus: () => getSkillDependencyStatus,
|
|
52729
|
+
getSkillBestDoc: () => getSkillBestDoc,
|
|
52730
|
+
generateSkillMd: () => generateSkillMd,
|
|
52731
|
+
generateEnvExample: () => generateEnvExample,
|
|
52732
|
+
detectProjectSkills: () => detectProjectSkills
|
|
52250
52733
|
});
|
|
52251
52734
|
import { existsSync as existsSync19, readFileSync as readFileSync15 } from "fs";
|
|
52252
52735
|
import { join as join21 } from "path";
|
|
@@ -53718,7 +54201,7 @@ var init_init = __esm(() => {
|
|
|
53718
54201
|
});
|
|
53719
54202
|
|
|
53720
54203
|
// src/lib/home-adoption.ts
|
|
53721
|
-
import { existsSync as existsSync22, mkdirSync as mkdirSync9, readdirSync as readdirSync10, readFileSync as readFileSync18, rmSync as rmSync6, statSync as statSync11, writeFileSync as writeFileSync10 } from "fs";
|
|
54204
|
+
import { constants as constants3, closeSync as closeSync3, fstatSync as fstatSync3, lstatSync as lstatSync5, openSync as openSync3, readSync as readSync2, existsSync as existsSync22, mkdirSync as mkdirSync9, readdirSync as readdirSync10, readFileSync as readFileSync18, rmSync as rmSync6, statSync as statSync11, writeFileSync as writeFileSync10 } from "fs";
|
|
53722
54205
|
import { homedir as homedir5 } from "os";
|
|
53723
54206
|
import { join as join24 } from "path";
|
|
53724
54207
|
function indexCanonicalCorpus(corpusRoot) {
|
|
@@ -53870,6 +54353,41 @@ function adoptUnmarkedHomes(options = {}) {
|
|
|
53870
54353
|
}
|
|
53871
54354
|
return { ...scan, applied: true, rollbackFile };
|
|
53872
54355
|
}
|
|
54356
|
+
function pruneOwnership(dir) {
|
|
54357
|
+
let descriptor;
|
|
54358
|
+
try {
|
|
54359
|
+
const directory = lstatSync5(dir);
|
|
54360
|
+
if (!directory.isDirectory())
|
|
54361
|
+
return;
|
|
54362
|
+
const markerPath = join24(dir, SYNC_MARKER_FILE), markerPathBefore = lstatSync5(markerPath);
|
|
54363
|
+
if (!markerPathBefore.isFile())
|
|
54364
|
+
return;
|
|
54365
|
+
descriptor = openSync3(markerPath, constants3.O_RDONLY | constants3.O_NOFOLLOW | constants3.O_NONBLOCK);
|
|
54366
|
+
const before2 = fstatSync3(descriptor);
|
|
54367
|
+
if (!before2.isFile() || before2.dev !== markerPathBefore.dev || before2.ino !== markerPathBefore.ino || before2.size !== markerPathBefore.size || before2.mtimeMs !== markerPathBefore.mtimeMs || before2.ctimeMs !== markerPathBefore.ctimeMs || before2.size < 1 || before2.size > 65536)
|
|
54368
|
+
return;
|
|
54369
|
+
const bytes = Buffer.alloc(before2.size + 1);
|
|
54370
|
+
let length = 0;
|
|
54371
|
+
while (length < bytes.length) {
|
|
54372
|
+
const count = readSync2(descriptor, bytes, length, bytes.length - length, length);
|
|
54373
|
+
if (!count)
|
|
54374
|
+
break;
|
|
54375
|
+
length += count;
|
|
54376
|
+
}
|
|
54377
|
+
const after2 = fstatSync3(descriptor), current = lstatSync5(dir), markerPathAfter = lstatSync5(markerPath);
|
|
54378
|
+
if (!markerPathAfter.isFile() || markerPathAfter.dev !== before2.dev || markerPathAfter.ino !== before2.ino || markerPathAfter.size !== before2.size || markerPathAfter.mtimeMs !== before2.mtimeMs || markerPathAfter.ctimeMs !== before2.ctimeMs || length !== before2.size || after2.size !== before2.size || after2.mtimeMs !== before2.mtimeMs || after2.ctimeMs !== before2.ctimeMs || !current.isDirectory() || current.dev !== directory.dev || current.ino !== directory.ino)
|
|
54379
|
+
return;
|
|
54380
|
+
const text2 = bytes.subarray(0, length).toString("utf8"), marker = JSON.parse(text2);
|
|
54381
|
+
if (!isSkillsOwnershipMarker(marker))
|
|
54382
|
+
return;
|
|
54383
|
+
return { marker, identity: JSON.stringify([directory.dev, directory.ino, before2.dev, before2.ino, before2.mtimeMs, before2.ctimeMs, text2]) };
|
|
54384
|
+
} catch {
|
|
54385
|
+
return;
|
|
54386
|
+
} finally {
|
|
54387
|
+
if (descriptor !== undefined)
|
|
54388
|
+
closeSync3(descriptor);
|
|
54389
|
+
}
|
|
54390
|
+
}
|
|
53873
54391
|
function pruneStrayHomes(options = {}) {
|
|
53874
54392
|
const homeDir2 = options.homeDir ?? homedir5();
|
|
53875
54393
|
const corpusRoot = resolveCorpusRoot(options);
|
|
@@ -53877,6 +54395,7 @@ function pruneStrayHomes(options = {}) {
|
|
|
53877
54395
|
const agents = options.agents?.length ? options.agents : [...SYNC_AGENTS];
|
|
53878
54396
|
const names = selectedHomeNames(options, index, homeDir2, agents);
|
|
53879
54397
|
const candidates = [];
|
|
54398
|
+
const ownership = new Map;
|
|
53880
54399
|
for (const agent of agents) {
|
|
53881
54400
|
const home = agentGlobalSkillsDir(agent, homeDir2);
|
|
53882
54401
|
if (!existsSync22(home))
|
|
@@ -53899,20 +54418,13 @@ function pruneStrayHomes(options = {}) {
|
|
|
53899
54418
|
} catch {
|
|
53900
54419
|
continue;
|
|
53901
54420
|
}
|
|
53902
|
-
const markerPath = join24(dir, SYNC_MARKER_FILE);
|
|
53903
|
-
if (!existsSync22(markerPath))
|
|
53904
|
-
continue;
|
|
53905
54421
|
if (index.has(skill))
|
|
53906
54422
|
continue;
|
|
53907
|
-
|
|
53908
|
-
|
|
53909
|
-
const parsed = JSON.parse(readFileSync18(markerPath, "utf-8"));
|
|
53910
|
-
if (!parsed || typeof parsed !== "object" || parsed.managedBy !== SYNC_MARKER_MANAGED_BY)
|
|
53911
|
-
continue;
|
|
53912
|
-
marker = parsed;
|
|
53913
|
-
} catch {
|
|
54423
|
+
const owned = pruneOwnership(dir);
|
|
54424
|
+
if (!owned)
|
|
53914
54425
|
continue;
|
|
53915
|
-
|
|
54426
|
+
const marker = owned.marker;
|
|
54427
|
+
ownership.set(dir, owned.identity);
|
|
53916
54428
|
const skillMdPath = join24(dir, "SKILL.md");
|
|
53917
54429
|
const hash = existsSync22(skillMdPath) ? hashSkillMarkdownFile(skillMdPath) : "";
|
|
53918
54430
|
candidates.push({ agent, skill, home, path: dir, hash, marker });
|
|
@@ -53923,10 +54435,14 @@ function pruneStrayHomes(options = {}) {
|
|
|
53923
54435
|
}
|
|
53924
54436
|
const appDir = options.homeDir ? join24(options.homeDir, ".hasna", "skills") : getDataDir();
|
|
53925
54437
|
const rollbackFile = writeRollbackRecord("prune", candidates.map(({ agent, skill, path, hash, marker }) => ({ agent, skill, path, hash, marker })), appDir);
|
|
54438
|
+
let pruned = 0;
|
|
53926
54439
|
for (const candidate of candidates) {
|
|
54440
|
+
if (pruneOwnership(candidate.path)?.identity !== ownership.get(candidate.path))
|
|
54441
|
+
continue;
|
|
53927
54442
|
rmSync6(candidate.path, { recursive: true, force: true });
|
|
54443
|
+
pruned++;
|
|
53928
54444
|
}
|
|
53929
|
-
return { candidates, pruned
|
|
54445
|
+
return { candidates, pruned, dryRun: false, rollbackFile };
|
|
53930
54446
|
}
|
|
53931
54447
|
var CONFLICTS_LEDGER_FILE = "conflicts.json", ROLLBACK_DIRNAME = "rollback";
|
|
53932
54448
|
var init_home_adoption = __esm(() => {
|
|
@@ -54054,7 +54570,7 @@ var init_home_census = __esm(() => {
|
|
|
54054
54570
|
});
|
|
54055
54571
|
|
|
54056
54572
|
// src/cli/env-assignment.ts
|
|
54057
|
-
import { closeSync as
|
|
54573
|
+
import { closeSync as closeSync4, constants as constants4, fstatSync as fstatSync4, ftruncateSync, lstatSync as lstatSync6, openSync as openSync4, readFileSync as readFileSync20, writeSync } from "fs";
|
|
54058
54574
|
function serializeValue(value) {
|
|
54059
54575
|
if (controls.test(value))
|
|
54060
54576
|
throw new EnvAssignmentError("Environment values cannot contain control characters or newlines.");
|
|
@@ -54133,7 +54649,7 @@ function setEnvAssignment(path, assignment) {
|
|
|
54133
54649
|
try {
|
|
54134
54650
|
const previous = (() => {
|
|
54135
54651
|
try {
|
|
54136
|
-
return
|
|
54652
|
+
return lstatSync6(path);
|
|
54137
54653
|
} catch (error) {
|
|
54138
54654
|
if (error.code === "ENOENT")
|
|
54139
54655
|
return;
|
|
@@ -54142,8 +54658,8 @@ function setEnvAssignment(path, assignment) {
|
|
|
54142
54658
|
})();
|
|
54143
54659
|
if (previous && !previous.isFile())
|
|
54144
54660
|
throw new EnvAssignmentError("The project .env must be a regular file, not a symlink or special file.");
|
|
54145
|
-
descriptor =
|
|
54146
|
-
const opened =
|
|
54661
|
+
descriptor = openSync4(path, previous ? constants4.O_RDWR | constants4.O_NOFOLLOW | constants4.O_NONBLOCK : constants4.O_WRONLY | constants4.O_CREAT | constants4.O_EXCL | constants4.O_NOFOLLOW, 384);
|
|
54662
|
+
const opened = fstatSync4(descriptor);
|
|
54147
54663
|
if (!opened.isFile() || previous && (opened.ino !== previous.ino || opened.dev !== previous.dev)) {
|
|
54148
54664
|
throw new EnvAssignmentError("The project .env changed while opening it; retry with a regular file.");
|
|
54149
54665
|
}
|
|
@@ -54170,7 +54686,7 @@ function setEnvAssignment(path, assignment) {
|
|
|
54170
54686
|
throw new EnvAssignmentError("Cannot safely read or write the project .env file.");
|
|
54171
54687
|
} finally {
|
|
54172
54688
|
if (descriptor !== undefined)
|
|
54173
|
-
|
|
54689
|
+
closeSync4(descriptor);
|
|
54174
54690
|
}
|
|
54175
54691
|
}
|
|
54176
54692
|
var INVALID_LAYOUT = "Cannot safely update .env with multiline or unsupported assignments. Use single-line KEY=VALUE entries or edit the file manually.", controls, EnvAssignmentError;
|
|
@@ -54533,10 +55049,10 @@ var init_diagnostic = __esm(() => {
|
|
|
54533
55049
|
// src/lib/blog-article.ts
|
|
54534
55050
|
var exports_blog_article = {};
|
|
54535
55051
|
__export(exports_blog_article, {
|
|
54536
|
-
|
|
54537
|
-
ARTICLE_GENERATION_SLUG: () => ARTICLE_GENERATION_SLUG,
|
|
55052
|
+
validateBlogArticleRunOptions: () => validateBlogArticleRunOptions,
|
|
54538
55053
|
ARTICLE_MAX_COUNT: () => ARTICLE_MAX_COUNT,
|
|
54539
|
-
|
|
55054
|
+
ARTICLE_GENERATION_SLUG: () => ARTICLE_GENERATION_SLUG,
|
|
55055
|
+
ARTICLE_COUNT_ERROR: () => ARTICLE_COUNT_ERROR
|
|
54540
55056
|
});
|
|
54541
55057
|
function validateBlogArticleRunOptions(input, args = [], validation = {}) {
|
|
54542
55058
|
const options = collectRunOptions(input, args);
|
|
@@ -54976,55 +55492,55 @@ var init_core = __esm(() => {
|
|
|
54976
55492
|
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/util.js
|
|
54977
55493
|
var exports_util = {};
|
|
54978
55494
|
__export(exports_util, {
|
|
54979
|
-
|
|
54980
|
-
Class: () => Class,
|
|
54981
|
-
NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,
|
|
54982
|
-
aborted: () => aborted,
|
|
54983
|
-
allowsEval: () => allowsEval,
|
|
54984
|
-
assert: () => assert,
|
|
54985
|
-
assertEqual: () => assertEqual,
|
|
54986
|
-
assertIs: () => assertIs,
|
|
54987
|
-
assertNever: () => assertNever,
|
|
54988
|
-
assertNotEqual: () => assertNotEqual,
|
|
54989
|
-
assignProp: () => assignProp,
|
|
54990
|
-
cached: () => cached,
|
|
54991
|
-
captureStackTrace: () => captureStackTrace,
|
|
54992
|
-
cleanEnum: () => cleanEnum,
|
|
54993
|
-
cleanRegex: () => cleanRegex,
|
|
54994
|
-
clone: () => clone3,
|
|
54995
|
-
createTransparentProxy: () => createTransparentProxy,
|
|
54996
|
-
defineLazy: () => defineLazy,
|
|
54997
|
-
esc: () => esc,
|
|
54998
|
-
escapeRegex: () => escapeRegex,
|
|
54999
|
-
extend: () => extend,
|
|
55000
|
-
finalizeIssue: () => finalizeIssue,
|
|
55001
|
-
floatSafeRemainder: () => floatSafeRemainder2,
|
|
55002
|
-
getElementAtPath: () => getElementAtPath,
|
|
55003
|
-
getEnumValues: () => getEnumValues,
|
|
55004
|
-
getLengthableOrigin: () => getLengthableOrigin,
|
|
55005
|
-
getParsedType: () => getParsedType2,
|
|
55006
|
-
getSizableOrigin: () => getSizableOrigin,
|
|
55007
|
-
isObject: () => isObject2,
|
|
55008
|
-
isPlainObject: () => isPlainObject2,
|
|
55009
|
-
issue: () => issue,
|
|
55010
|
-
joinValues: () => joinValues,
|
|
55011
|
-
jsonStringifyReplacer: () => jsonStringifyReplacer,
|
|
55012
|
-
merge: () => merge2,
|
|
55013
|
-
normalizeParams: () => normalizeParams,
|
|
55014
|
-
nullish: () => nullish,
|
|
55015
|
-
numKeys: () => numKeys,
|
|
55016
|
-
omit: () => omit2,
|
|
55017
|
-
optionalKeys: () => optionalKeys,
|
|
55018
|
-
partial: () => partial2,
|
|
55019
|
-
pick: () => pick2,
|
|
55020
|
-
prefixIssues: () => prefixIssues,
|
|
55021
|
-
primitiveTypes: () => primitiveTypes,
|
|
55022
|
-
promiseAllObject: () => promiseAllObject,
|
|
55023
|
-
propertyKeyTypes: () => propertyKeyTypes,
|
|
55024
|
-
randomString: () => randomString,
|
|
55025
|
-
required: () => required,
|
|
55495
|
+
unwrapMessage: () => unwrapMessage,
|
|
55026
55496
|
stringifyPrimitive: () => stringifyPrimitive,
|
|
55027
|
-
|
|
55497
|
+
required: () => required,
|
|
55498
|
+
randomString: () => randomString,
|
|
55499
|
+
propertyKeyTypes: () => propertyKeyTypes,
|
|
55500
|
+
promiseAllObject: () => promiseAllObject,
|
|
55501
|
+
primitiveTypes: () => primitiveTypes,
|
|
55502
|
+
prefixIssues: () => prefixIssues,
|
|
55503
|
+
pick: () => pick2,
|
|
55504
|
+
partial: () => partial2,
|
|
55505
|
+
optionalKeys: () => optionalKeys,
|
|
55506
|
+
omit: () => omit2,
|
|
55507
|
+
numKeys: () => numKeys,
|
|
55508
|
+
nullish: () => nullish,
|
|
55509
|
+
normalizeParams: () => normalizeParams,
|
|
55510
|
+
merge: () => merge2,
|
|
55511
|
+
jsonStringifyReplacer: () => jsonStringifyReplacer,
|
|
55512
|
+
joinValues: () => joinValues,
|
|
55513
|
+
issue: () => issue,
|
|
55514
|
+
isPlainObject: () => isPlainObject2,
|
|
55515
|
+
isObject: () => isObject2,
|
|
55516
|
+
getSizableOrigin: () => getSizableOrigin,
|
|
55517
|
+
getParsedType: () => getParsedType2,
|
|
55518
|
+
getLengthableOrigin: () => getLengthableOrigin,
|
|
55519
|
+
getEnumValues: () => getEnumValues,
|
|
55520
|
+
getElementAtPath: () => getElementAtPath,
|
|
55521
|
+
floatSafeRemainder: () => floatSafeRemainder2,
|
|
55522
|
+
finalizeIssue: () => finalizeIssue,
|
|
55523
|
+
extend: () => extend,
|
|
55524
|
+
escapeRegex: () => escapeRegex,
|
|
55525
|
+
esc: () => esc,
|
|
55526
|
+
defineLazy: () => defineLazy,
|
|
55527
|
+
createTransparentProxy: () => createTransparentProxy,
|
|
55528
|
+
clone: () => clone3,
|
|
55529
|
+
cleanRegex: () => cleanRegex,
|
|
55530
|
+
cleanEnum: () => cleanEnum,
|
|
55531
|
+
captureStackTrace: () => captureStackTrace,
|
|
55532
|
+
cached: () => cached,
|
|
55533
|
+
assignProp: () => assignProp,
|
|
55534
|
+
assertNotEqual: () => assertNotEqual,
|
|
55535
|
+
assertNever: () => assertNever,
|
|
55536
|
+
assertIs: () => assertIs,
|
|
55537
|
+
assertEqual: () => assertEqual,
|
|
55538
|
+
assert: () => assert,
|
|
55539
|
+
allowsEval: () => allowsEval,
|
|
55540
|
+
aborted: () => aborted,
|
|
55541
|
+
NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,
|
|
55542
|
+
Class: () => Class,
|
|
55543
|
+
BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES
|
|
55028
55544
|
});
|
|
55029
55545
|
function assertEqual(val) {
|
|
55030
55546
|
return val;
|
|
@@ -58763,14 +59279,14 @@ var init_checks2 = __esm(() => {
|
|
|
58763
59279
|
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v4/classic/iso.js
|
|
58764
59280
|
var exports_iso = {};
|
|
58765
59281
|
__export(exports_iso, {
|
|
58766
|
-
|
|
58767
|
-
ZodISODateTime: () => ZodISODateTime,
|
|
58768
|
-
ZodISODuration: () => ZodISODuration,
|
|
58769
|
-
ZodISOTime: () => ZodISOTime,
|
|
58770
|
-
date: () => date2,
|
|
58771
|
-
datetime: () => datetime2,
|
|
59282
|
+
time: () => time2,
|
|
58772
59283
|
duration: () => duration2,
|
|
58773
|
-
|
|
59284
|
+
datetime: () => datetime2,
|
|
59285
|
+
date: () => date2,
|
|
59286
|
+
ZodISOTime: () => ZodISOTime,
|
|
59287
|
+
ZodISODuration: () => ZodISODuration,
|
|
59288
|
+
ZodISODateTime: () => ZodISODateTime,
|
|
59289
|
+
ZodISODate: () => ZodISODate
|
|
58774
59290
|
});
|
|
58775
59291
|
function datetime2(params) {
|
|
58776
59292
|
return _isoDateTime(ZodISODateTime, params);
|
|
@@ -62992,7 +63508,7 @@ var init_protocol = __esm(() => {
|
|
|
62992
63508
|
});
|
|
62993
63509
|
|
|
62994
63510
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js
|
|
62995
|
-
var require_code = __commonJS(
|
|
63511
|
+
var require_code = __commonJS((exports) => {
|
|
62996
63512
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62997
63513
|
exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = undefined;
|
|
62998
63514
|
|
|
@@ -63146,7 +63662,7 @@ var require_code = __commonJS(function(exports) {
|
|
|
63146
63662
|
});
|
|
63147
63663
|
|
|
63148
63664
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js
|
|
63149
|
-
var require_scope = __commonJS(
|
|
63665
|
+
var require_scope = __commonJS((exports) => {
|
|
63150
63666
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63151
63667
|
exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = undefined;
|
|
63152
63668
|
var code_1 = require_code();
|
|
@@ -63292,7 +63808,7 @@ var require_scope = __commonJS(function(exports) {
|
|
|
63292
63808
|
});
|
|
63293
63809
|
|
|
63294
63810
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js
|
|
63295
|
-
var require_codegen = __commonJS(
|
|
63811
|
+
var require_codegen = __commonJS((exports) => {
|
|
63296
63812
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63297
63813
|
exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = undefined;
|
|
63298
63814
|
var code_1 = require_code();
|
|
@@ -63369,11 +63885,11 @@ var require_codegen = __commonJS(function(exports) {
|
|
|
63369
63885
|
const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}`;
|
|
63370
63886
|
return `${varKind} ${this.name}${rhs};` + _n;
|
|
63371
63887
|
}
|
|
63372
|
-
optimizeNames(names,
|
|
63888
|
+
optimizeNames(names, constants5) {
|
|
63373
63889
|
if (!names[this.name.str])
|
|
63374
63890
|
return;
|
|
63375
63891
|
if (this.rhs)
|
|
63376
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
63892
|
+
this.rhs = optimizeExpr(this.rhs, names, constants5);
|
|
63377
63893
|
return this;
|
|
63378
63894
|
}
|
|
63379
63895
|
get names() {
|
|
@@ -63391,10 +63907,10 @@ var require_codegen = __commonJS(function(exports) {
|
|
|
63391
63907
|
render({ _n }) {
|
|
63392
63908
|
return `${this.lhs} = ${this.rhs};` + _n;
|
|
63393
63909
|
}
|
|
63394
|
-
optimizeNames(names,
|
|
63910
|
+
optimizeNames(names, constants5) {
|
|
63395
63911
|
if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
|
|
63396
63912
|
return;
|
|
63397
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
63913
|
+
this.rhs = optimizeExpr(this.rhs, names, constants5);
|
|
63398
63914
|
return this;
|
|
63399
63915
|
}
|
|
63400
63916
|
get names() {
|
|
@@ -63460,8 +63976,8 @@ var require_codegen = __commonJS(function(exports) {
|
|
|
63460
63976
|
optimizeNodes() {
|
|
63461
63977
|
return `${this.code}` ? this : undefined;
|
|
63462
63978
|
}
|
|
63463
|
-
optimizeNames(names,
|
|
63464
|
-
this.code = optimizeExpr(this.code, names,
|
|
63979
|
+
optimizeNames(names, constants5) {
|
|
63980
|
+
this.code = optimizeExpr(this.code, names, constants5);
|
|
63465
63981
|
return this;
|
|
63466
63982
|
}
|
|
63467
63983
|
get names() {
|
|
@@ -63491,12 +64007,12 @@ var require_codegen = __commonJS(function(exports) {
|
|
|
63491
64007
|
}
|
|
63492
64008
|
return nodes.length > 0 ? this : undefined;
|
|
63493
64009
|
}
|
|
63494
|
-
optimizeNames(names,
|
|
64010
|
+
optimizeNames(names, constants5) {
|
|
63495
64011
|
const { nodes } = this;
|
|
63496
64012
|
let i = nodes.length;
|
|
63497
64013
|
while (i--) {
|
|
63498
64014
|
const n = nodes[i];
|
|
63499
|
-
if (n.optimizeNames(names,
|
|
64015
|
+
if (n.optimizeNames(names, constants5))
|
|
63500
64016
|
continue;
|
|
63501
64017
|
subtractNames(names, n.names);
|
|
63502
64018
|
nodes.splice(i, 1);
|
|
@@ -63553,12 +64069,12 @@ var require_codegen = __commonJS(function(exports) {
|
|
|
63553
64069
|
return;
|
|
63554
64070
|
return this;
|
|
63555
64071
|
}
|
|
63556
|
-
optimizeNames(names,
|
|
64072
|
+
optimizeNames(names, constants5) {
|
|
63557
64073
|
var _a;
|
|
63558
|
-
this.else = (_a = this.else) === null || _a === undefined ? undefined : _a.optimizeNames(names,
|
|
63559
|
-
if (!(super.optimizeNames(names,
|
|
64074
|
+
this.else = (_a = this.else) === null || _a === undefined ? undefined : _a.optimizeNames(names, constants5);
|
|
64075
|
+
if (!(super.optimizeNames(names, constants5) || this.else))
|
|
63560
64076
|
return;
|
|
63561
|
-
this.condition = optimizeExpr(this.condition, names,
|
|
64077
|
+
this.condition = optimizeExpr(this.condition, names, constants5);
|
|
63562
64078
|
return this;
|
|
63563
64079
|
}
|
|
63564
64080
|
get names() {
|
|
@@ -63583,10 +64099,10 @@ var require_codegen = __commonJS(function(exports) {
|
|
|
63583
64099
|
render(opts) {
|
|
63584
64100
|
return `for(${this.iteration})` + super.render(opts);
|
|
63585
64101
|
}
|
|
63586
|
-
optimizeNames(names,
|
|
63587
|
-
if (!super.optimizeNames(names,
|
|
64102
|
+
optimizeNames(names, constants5) {
|
|
64103
|
+
if (!super.optimizeNames(names, constants5))
|
|
63588
64104
|
return;
|
|
63589
|
-
this.iteration = optimizeExpr(this.iteration, names,
|
|
64105
|
+
this.iteration = optimizeExpr(this.iteration, names, constants5);
|
|
63590
64106
|
return this;
|
|
63591
64107
|
}
|
|
63592
64108
|
get names() {
|
|
@@ -63624,10 +64140,10 @@ var require_codegen = __commonJS(function(exports) {
|
|
|
63624
64140
|
render(opts) {
|
|
63625
64141
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
63626
64142
|
}
|
|
63627
|
-
optimizeNames(names,
|
|
63628
|
-
if (!super.optimizeNames(names,
|
|
64143
|
+
optimizeNames(names, constants5) {
|
|
64144
|
+
if (!super.optimizeNames(names, constants5))
|
|
63629
64145
|
return;
|
|
63630
|
-
this.iterable = optimizeExpr(this.iterable, names,
|
|
64146
|
+
this.iterable = optimizeExpr(this.iterable, names, constants5);
|
|
63631
64147
|
return this;
|
|
63632
64148
|
}
|
|
63633
64149
|
get names() {
|
|
@@ -63672,11 +64188,11 @@ var require_codegen = __commonJS(function(exports) {
|
|
|
63672
64188
|
(_b = this.finally) === null || _b === undefined || _b.optimizeNodes();
|
|
63673
64189
|
return this;
|
|
63674
64190
|
}
|
|
63675
|
-
optimizeNames(names,
|
|
64191
|
+
optimizeNames(names, constants5) {
|
|
63676
64192
|
var _a, _b;
|
|
63677
|
-
super.optimizeNames(names,
|
|
63678
|
-
(_a = this.catch) === null || _a === undefined || _a.optimizeNames(names,
|
|
63679
|
-
(_b = this.finally) === null || _b === undefined || _b.optimizeNames(names,
|
|
64193
|
+
super.optimizeNames(names, constants5);
|
|
64194
|
+
(_a = this.catch) === null || _a === undefined || _a.optimizeNames(names, constants5);
|
|
64195
|
+
(_b = this.finally) === null || _b === undefined || _b.optimizeNames(names, constants5);
|
|
63680
64196
|
return this;
|
|
63681
64197
|
}
|
|
63682
64198
|
get names() {
|
|
@@ -63950,7 +64466,7 @@ var require_codegen = __commonJS(function(exports) {
|
|
|
63950
64466
|
function addExprNames(names, from) {
|
|
63951
64467
|
return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
|
|
63952
64468
|
}
|
|
63953
|
-
function optimizeExpr(expr, names,
|
|
64469
|
+
function optimizeExpr(expr, names, constants5) {
|
|
63954
64470
|
if (expr instanceof code_1.Name)
|
|
63955
64471
|
return replaceName(expr);
|
|
63956
64472
|
if (!canOptimize(expr))
|
|
@@ -63965,14 +64481,14 @@ var require_codegen = __commonJS(function(exports) {
|
|
|
63965
64481
|
return items;
|
|
63966
64482
|
}, []));
|
|
63967
64483
|
function replaceName(n) {
|
|
63968
|
-
const c =
|
|
64484
|
+
const c = constants5[n.str];
|
|
63969
64485
|
if (c === undefined || names[n.str] !== 1)
|
|
63970
64486
|
return n;
|
|
63971
64487
|
delete names[n.str];
|
|
63972
64488
|
return c;
|
|
63973
64489
|
}
|
|
63974
64490
|
function canOptimize(e) {
|
|
63975
|
-
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 &&
|
|
64491
|
+
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants5[c.str] !== undefined);
|
|
63976
64492
|
}
|
|
63977
64493
|
}
|
|
63978
64494
|
function subtractNames(names, from) {
|
|
@@ -64002,7 +64518,7 @@ var require_codegen = __commonJS(function(exports) {
|
|
|
64002
64518
|
});
|
|
64003
64519
|
|
|
64004
64520
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/util.js
|
|
64005
|
-
var require_util = __commonJS(
|
|
64521
|
+
var require_util = __commonJS((exports) => {
|
|
64006
64522
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64007
64523
|
exports.checkStrictMode = exports.getErrorPath = exports.Type = exports.useFunc = exports.setEvaluated = exports.evaluatedPropsToName = exports.mergeEvaluated = exports.eachItem = exports.unescapeJsonPointer = exports.escapeJsonPointer = exports.escapeFragment = exports.unescapeFragment = exports.schemaRefOrVal = exports.schemaHasRulesButRef = exports.schemaHasRules = exports.checkUnknownRules = exports.alwaysValidSchema = exports.toHash = undefined;
|
|
64008
64524
|
var codegen_1 = require_codegen();
|
|
@@ -64166,7 +64682,7 @@ var require_util = __commonJS(function(exports) {
|
|
|
64166
64682
|
});
|
|
64167
64683
|
|
|
64168
64684
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/names.js
|
|
64169
|
-
var require_names = __commonJS(
|
|
64685
|
+
var require_names = __commonJS((exports) => {
|
|
64170
64686
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64171
64687
|
var codegen_1 = require_codegen();
|
|
64172
64688
|
var names = {
|
|
@@ -64191,7 +64707,7 @@ var require_names = __commonJS(function(exports) {
|
|
|
64191
64707
|
});
|
|
64192
64708
|
|
|
64193
64709
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js
|
|
64194
|
-
var require_errors = __commonJS(
|
|
64710
|
+
var require_errors = __commonJS((exports) => {
|
|
64195
64711
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64196
64712
|
exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = undefined;
|
|
64197
64713
|
var codegen_1 = require_codegen();
|
|
@@ -64309,7 +64825,7 @@ var require_errors = __commonJS(function(exports) {
|
|
|
64309
64825
|
});
|
|
64310
64826
|
|
|
64311
64827
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js
|
|
64312
|
-
var require_boolSchema = __commonJS(
|
|
64828
|
+
var require_boolSchema = __commonJS((exports) => {
|
|
64313
64829
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64314
64830
|
exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = undefined;
|
|
64315
64831
|
var errors_1 = require_errors();
|
|
@@ -64357,7 +64873,7 @@ var require_boolSchema = __commonJS(function(exports) {
|
|
|
64357
64873
|
});
|
|
64358
64874
|
|
|
64359
64875
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js
|
|
64360
|
-
var require_rules = __commonJS(
|
|
64876
|
+
var require_rules = __commonJS((exports) => {
|
|
64361
64877
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64362
64878
|
exports.getRules = exports.isJSONType = undefined;
|
|
64363
64879
|
var _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array"];
|
|
@@ -64385,7 +64901,7 @@ var require_rules = __commonJS(function(exports) {
|
|
|
64385
64901
|
});
|
|
64386
64902
|
|
|
64387
64903
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js
|
|
64388
|
-
var require_applicability = __commonJS(
|
|
64904
|
+
var require_applicability = __commonJS((exports) => {
|
|
64389
64905
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64390
64906
|
exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = undefined;
|
|
64391
64907
|
function schemaHasRulesForType({ schema, self: self2 }, type) {
|
|
@@ -64405,7 +64921,7 @@ var require_applicability = __commonJS(function(exports) {
|
|
|
64405
64921
|
});
|
|
64406
64922
|
|
|
64407
64923
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js
|
|
64408
|
-
var require_dataType = __commonJS(
|
|
64924
|
+
var require_dataType = __commonJS((exports) => {
|
|
64409
64925
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64410
64926
|
exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = undefined;
|
|
64411
64927
|
var rules_1 = require_rules();
|
|
@@ -64586,7 +65102,7 @@ var require_dataType = __commonJS(function(exports) {
|
|
|
64586
65102
|
});
|
|
64587
65103
|
|
|
64588
65104
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js
|
|
64589
|
-
var require_defaults = __commonJS(
|
|
65105
|
+
var require_defaults = __commonJS((exports) => {
|
|
64590
65106
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64591
65107
|
exports.assignDefaults = undefined;
|
|
64592
65108
|
var codegen_1 = require_codegen();
|
|
@@ -64620,7 +65136,7 @@ var require_defaults = __commonJS(function(exports) {
|
|
|
64620
65136
|
});
|
|
64621
65137
|
|
|
64622
65138
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/code.js
|
|
64623
|
-
var require_code2 = __commonJS(
|
|
65139
|
+
var require_code2 = __commonJS((exports) => {
|
|
64624
65140
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64625
65141
|
exports.validateUnion = exports.validateArray = exports.usePattern = exports.callValidateCode = exports.schemaProperties = exports.allSchemaProperties = exports.noPropertyInData = exports.propertyInData = exports.isOwnProperty = exports.hasPropFunc = exports.reportMissingProp = exports.checkMissingProp = exports.checkReportMissingProp = undefined;
|
|
64626
65142
|
var codegen_1 = require_codegen();
|
|
@@ -64749,7 +65265,7 @@ var require_code2 = __commonJS(function(exports) {
|
|
|
64749
65265
|
});
|
|
64750
65266
|
|
|
64751
65267
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js
|
|
64752
|
-
var require_keyword = __commonJS(
|
|
65268
|
+
var require_keyword = __commonJS((exports) => {
|
|
64753
65269
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64754
65270
|
exports.validateKeywordUsage = exports.validSchemaType = exports.funcKeywordCode = exports.macroKeywordCode = undefined;
|
|
64755
65271
|
var codegen_1 = require_codegen();
|
|
@@ -64864,7 +65380,7 @@ var require_keyword = __commonJS(function(exports) {
|
|
|
64864
65380
|
});
|
|
64865
65381
|
|
|
64866
65382
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js
|
|
64867
|
-
var require_subschema = __commonJS(
|
|
65383
|
+
var require_subschema = __commonJS((exports) => {
|
|
64868
65384
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64869
65385
|
exports.extendSubschemaMode = exports.extendSubschemaData = exports.getSubschema = undefined;
|
|
64870
65386
|
var codegen_1 = require_codegen();
|
|
@@ -64944,7 +65460,7 @@ var require_subschema = __commonJS(function(exports) {
|
|
|
64944
65460
|
});
|
|
64945
65461
|
|
|
64946
65462
|
// ../../node_modules/.bun/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
|
|
64947
|
-
var require_fast_deep_equal = __commonJS(
|
|
65463
|
+
var require_fast_deep_equal = __commonJS((exports, module) => {
|
|
64948
65464
|
module.exports = function equal(a, b) {
|
|
64949
65465
|
if (a === b)
|
|
64950
65466
|
return true;
|
|
@@ -64986,7 +65502,7 @@ var require_fast_deep_equal = __commonJS(function(exports, module) {
|
|
|
64986
65502
|
});
|
|
64987
65503
|
|
|
64988
65504
|
// ../../node_modules/.bun/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js
|
|
64989
|
-
var require_json_schema_traverse = __commonJS(
|
|
65505
|
+
var require_json_schema_traverse = __commonJS((exports, module) => {
|
|
64990
65506
|
var traverse = module.exports = function(schema, opts, cb) {
|
|
64991
65507
|
if (typeof opts == "function") {
|
|
64992
65508
|
cb = opts;
|
|
@@ -65069,7 +65585,7 @@ var require_json_schema_traverse = __commonJS(function(exports, module) {
|
|
|
65069
65585
|
});
|
|
65070
65586
|
|
|
65071
65587
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js
|
|
65072
|
-
var require_resolve = __commonJS(
|
|
65588
|
+
var require_resolve = __commonJS((exports) => {
|
|
65073
65589
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65074
65590
|
exports.getSchemaRefs = exports.resolveUrl = exports.normalizeId = exports._getFullPath = exports.getFullPath = exports.inlineRef = undefined;
|
|
65075
65591
|
var util_1 = require_util();
|
|
@@ -65222,7 +65738,7 @@ var require_resolve = __commonJS(function(exports) {
|
|
|
65222
65738
|
});
|
|
65223
65739
|
|
|
65224
65740
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js
|
|
65225
|
-
var require_validate = __commonJS(
|
|
65741
|
+
var require_validate = __commonJS((exports) => {
|
|
65226
65742
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65227
65743
|
exports.getData = exports.KeywordCxt = exports.validateFunctionCode = undefined;
|
|
65228
65744
|
var boolSchema_1 = require_boolSchema();
|
|
@@ -65727,7 +66243,7 @@ var require_validate = __commonJS(function(exports) {
|
|
|
65727
66243
|
});
|
|
65728
66244
|
|
|
65729
66245
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js
|
|
65730
|
-
var require_validation_error = __commonJS(
|
|
66246
|
+
var require_validation_error = __commonJS((exports) => {
|
|
65731
66247
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65732
66248
|
|
|
65733
66249
|
class ValidationError extends Error {
|
|
@@ -65741,7 +66257,7 @@ var require_validation_error = __commonJS(function(exports) {
|
|
|
65741
66257
|
});
|
|
65742
66258
|
|
|
65743
66259
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js
|
|
65744
|
-
var require_ref_error = __commonJS(
|
|
66260
|
+
var require_ref_error = __commonJS((exports) => {
|
|
65745
66261
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65746
66262
|
var resolve_1 = require_resolve();
|
|
65747
66263
|
|
|
@@ -65756,7 +66272,7 @@ var require_ref_error = __commonJS(function(exports) {
|
|
|
65756
66272
|
});
|
|
65757
66273
|
|
|
65758
66274
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/compile/index.js
|
|
65759
|
-
var require_compile = __commonJS(
|
|
66275
|
+
var require_compile = __commonJS((exports) => {
|
|
65760
66276
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65761
66277
|
exports.resolveSchema = exports.getCompilingSchema = exports.resolveRef = exports.compileSchema = exports.SchemaEnv = undefined;
|
|
65762
66278
|
var codegen_1 = require_codegen();
|
|
@@ -65977,7 +66493,7 @@ var require_compile = __commonJS(function(exports) {
|
|
|
65977
66493
|
});
|
|
65978
66494
|
|
|
65979
66495
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/refs/data.json
|
|
65980
|
-
var require_data = __commonJS(
|
|
66496
|
+
var require_data = __commonJS((exports, module) => {
|
|
65981
66497
|
module.exports = {
|
|
65982
66498
|
$id: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",
|
|
65983
66499
|
description: "Meta-schema for $data reference (JSON AnySchema extension proposal)",
|
|
@@ -65994,7 +66510,7 @@ var require_data = __commonJS(function(exports, module) {
|
|
|
65994
66510
|
});
|
|
65995
66511
|
|
|
65996
66512
|
// ../../node_modules/.bun/fast-uri@3.1.7/node_modules/fast-uri/lib/utils.js
|
|
65997
|
-
var require_utils = __commonJS(
|
|
66513
|
+
var require_utils = __commonJS((exports, module) => {
|
|
65998
66514
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
65999
66515
|
var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
66000
66516
|
var isPort = RegExp.prototype.test.bind(/^\d*$/u);
|
|
@@ -66511,7 +67027,7 @@ var require_utils = __commonJS(function(exports, module) {
|
|
|
66511
67027
|
});
|
|
66512
67028
|
|
|
66513
67029
|
// ../../node_modules/.bun/fast-uri@3.1.7/node_modules/fast-uri/lib/schemes.js
|
|
66514
|
-
var require_schemes = __commonJS(
|
|
67030
|
+
var require_schemes = __commonJS((exports, module) => {
|
|
66515
67031
|
var { isUUID } = require_utils();
|
|
66516
67032
|
var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
|
|
66517
67033
|
var supportedSchemeNames = [
|
|
@@ -66686,7 +67202,7 @@ var require_schemes = __commonJS(function(exports, module) {
|
|
|
66686
67202
|
});
|
|
66687
67203
|
|
|
66688
67204
|
// ../../node_modules/.bun/fast-uri@3.1.7/node_modules/fast-uri/index.js
|
|
66689
|
-
var require_fast_uri = __commonJS(
|
|
67205
|
+
var require_fast_uri = __commonJS((exports, module) => {
|
|
66690
67206
|
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
66691
67207
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
66692
67208
|
var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
@@ -67088,7 +67604,7 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
67088
67604
|
});
|
|
67089
67605
|
|
|
67090
67606
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js
|
|
67091
|
-
var require_uri = __commonJS(
|
|
67607
|
+
var require_uri = __commonJS((exports) => {
|
|
67092
67608
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67093
67609
|
var uri = require_fast_uri();
|
|
67094
67610
|
uri.code = 'require("ajv/dist/runtime/uri").default';
|
|
@@ -67096,7 +67612,7 @@ var require_uri = __commonJS(function(exports) {
|
|
|
67096
67612
|
});
|
|
67097
67613
|
|
|
67098
67614
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/core.js
|
|
67099
|
-
var require_core = __commonJS(
|
|
67615
|
+
var require_core = __commonJS((exports) => {
|
|
67100
67616
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67101
67617
|
exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = undefined;
|
|
67102
67618
|
var validate_1 = require_validate();
|
|
@@ -67689,7 +68205,7 @@ var require_core = __commonJS(function(exports) {
|
|
|
67689
68205
|
});
|
|
67690
68206
|
|
|
67691
68207
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js
|
|
67692
|
-
var require_id = __commonJS(
|
|
68208
|
+
var require_id = __commonJS((exports) => {
|
|
67693
68209
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67694
68210
|
var def = {
|
|
67695
68211
|
keyword: "id",
|
|
@@ -67701,7 +68217,7 @@ var require_id = __commonJS(function(exports) {
|
|
|
67701
68217
|
});
|
|
67702
68218
|
|
|
67703
68219
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js
|
|
67704
|
-
var require_ref = __commonJS(
|
|
68220
|
+
var require_ref = __commonJS((exports) => {
|
|
67705
68221
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67706
68222
|
exports.callRef = exports.getValidate = undefined;
|
|
67707
68223
|
var ref_error_1 = require_ref_error();
|
|
@@ -67820,7 +68336,7 @@ var require_ref = __commonJS(function(exports) {
|
|
|
67820
68336
|
});
|
|
67821
68337
|
|
|
67822
68338
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js
|
|
67823
|
-
var require_core2 = __commonJS(
|
|
68339
|
+
var require_core2 = __commonJS((exports) => {
|
|
67824
68340
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67825
68341
|
var id_1 = require_id();
|
|
67826
68342
|
var ref_1 = require_ref();
|
|
@@ -67838,7 +68354,7 @@ var require_core2 = __commonJS(function(exports) {
|
|
|
67838
68354
|
});
|
|
67839
68355
|
|
|
67840
68356
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js
|
|
67841
|
-
var require_limitNumber = __commonJS(
|
|
68357
|
+
var require_limitNumber = __commonJS((exports) => {
|
|
67842
68358
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67843
68359
|
var codegen_1 = require_codegen();
|
|
67844
68360
|
var ops = codegen_1.operators;
|
|
@@ -67867,7 +68383,7 @@ var require_limitNumber = __commonJS(function(exports) {
|
|
|
67867
68383
|
});
|
|
67868
68384
|
|
|
67869
68385
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js
|
|
67870
|
-
var require_multipleOf = __commonJS(
|
|
68386
|
+
var require_multipleOf = __commonJS((exports) => {
|
|
67871
68387
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67872
68388
|
var codegen_1 = require_codegen();
|
|
67873
68389
|
var error2 = {
|
|
@@ -67892,7 +68408,7 @@ var require_multipleOf = __commonJS(function(exports) {
|
|
|
67892
68408
|
});
|
|
67893
68409
|
|
|
67894
68410
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js
|
|
67895
|
-
var require_ucs2length = __commonJS(
|
|
68411
|
+
var require_ucs2length = __commonJS((exports) => {
|
|
67896
68412
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67897
68413
|
function ucs2length(str2) {
|
|
67898
68414
|
const len = str2.length;
|
|
@@ -67915,7 +68431,7 @@ var require_ucs2length = __commonJS(function(exports) {
|
|
|
67915
68431
|
});
|
|
67916
68432
|
|
|
67917
68433
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js
|
|
67918
|
-
var require_limitLength = __commonJS(
|
|
68434
|
+
var require_limitLength = __commonJS((exports) => {
|
|
67919
68435
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67920
68436
|
var codegen_1 = require_codegen();
|
|
67921
68437
|
var util_1 = require_util();
|
|
@@ -67944,7 +68460,7 @@ var require_limitLength = __commonJS(function(exports) {
|
|
|
67944
68460
|
});
|
|
67945
68461
|
|
|
67946
68462
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js
|
|
67947
|
-
var require_pattern = __commonJS(
|
|
68463
|
+
var require_pattern = __commonJS((exports) => {
|
|
67948
68464
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67949
68465
|
var code_1 = require_code2();
|
|
67950
68466
|
var util_1 = require_util();
|
|
@@ -67978,7 +68494,7 @@ var require_pattern = __commonJS(function(exports) {
|
|
|
67978
68494
|
});
|
|
67979
68495
|
|
|
67980
68496
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js
|
|
67981
|
-
var require_limitProperties = __commonJS(
|
|
68497
|
+
var require_limitProperties = __commonJS((exports) => {
|
|
67982
68498
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67983
68499
|
var codegen_1 = require_codegen();
|
|
67984
68500
|
var error2 = {
|
|
@@ -68004,7 +68520,7 @@ var require_limitProperties = __commonJS(function(exports) {
|
|
|
68004
68520
|
});
|
|
68005
68521
|
|
|
68006
68522
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js
|
|
68007
|
-
var require_required = __commonJS(
|
|
68523
|
+
var require_required = __commonJS((exports) => {
|
|
68008
68524
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68009
68525
|
var code_1 = require_code2();
|
|
68010
68526
|
var codegen_1 = require_codegen();
|
|
@@ -68083,7 +68599,7 @@ var require_required = __commonJS(function(exports) {
|
|
|
68083
68599
|
});
|
|
68084
68600
|
|
|
68085
68601
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js
|
|
68086
|
-
var require_limitItems = __commonJS(
|
|
68602
|
+
var require_limitItems = __commonJS((exports) => {
|
|
68087
68603
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68088
68604
|
var codegen_1 = require_codegen();
|
|
68089
68605
|
var error2 = {
|
|
@@ -68109,7 +68625,7 @@ var require_limitItems = __commonJS(function(exports) {
|
|
|
68109
68625
|
});
|
|
68110
68626
|
|
|
68111
68627
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js
|
|
68112
|
-
var require_equal = __commonJS(
|
|
68628
|
+
var require_equal = __commonJS((exports) => {
|
|
68113
68629
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68114
68630
|
var equal = require_fast_deep_equal();
|
|
68115
68631
|
equal.code = 'require("ajv/dist/runtime/equal").default';
|
|
@@ -68117,7 +68633,7 @@ var require_equal = __commonJS(function(exports) {
|
|
|
68117
68633
|
});
|
|
68118
68634
|
|
|
68119
68635
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js
|
|
68120
|
-
var require_uniqueItems = __commonJS(
|
|
68636
|
+
var require_uniqueItems = __commonJS((exports) => {
|
|
68121
68637
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68122
68638
|
var dataType_1 = require_dataType();
|
|
68123
68639
|
var codegen_1 = require_codegen();
|
|
@@ -68181,7 +68697,7 @@ var require_uniqueItems = __commonJS(function(exports) {
|
|
|
68181
68697
|
});
|
|
68182
68698
|
|
|
68183
68699
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js
|
|
68184
|
-
var require_const = __commonJS(
|
|
68700
|
+
var require_const = __commonJS((exports) => {
|
|
68185
68701
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68186
68702
|
var codegen_1 = require_codegen();
|
|
68187
68703
|
var util_1 = require_util();
|
|
@@ -68207,7 +68723,7 @@ var require_const = __commonJS(function(exports) {
|
|
|
68207
68723
|
});
|
|
68208
68724
|
|
|
68209
68725
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js
|
|
68210
|
-
var require_enum = __commonJS(
|
|
68726
|
+
var require_enum = __commonJS((exports) => {
|
|
68211
68727
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68212
68728
|
var codegen_1 = require_codegen();
|
|
68213
68729
|
var util_1 = require_util();
|
|
@@ -68253,7 +68769,7 @@ var require_enum = __commonJS(function(exports) {
|
|
|
68253
68769
|
});
|
|
68254
68770
|
|
|
68255
68771
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js
|
|
68256
|
-
var require_validation = __commonJS(
|
|
68772
|
+
var require_validation = __commonJS((exports) => {
|
|
68257
68773
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68258
68774
|
var limitNumber_1 = require_limitNumber();
|
|
68259
68775
|
var multipleOf_1 = require_multipleOf();
|
|
@@ -68283,7 +68799,7 @@ var require_validation = __commonJS(function(exports) {
|
|
|
68283
68799
|
});
|
|
68284
68800
|
|
|
68285
68801
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js
|
|
68286
|
-
var require_additionalItems = __commonJS(
|
|
68802
|
+
var require_additionalItems = __commonJS((exports) => {
|
|
68287
68803
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68288
68804
|
exports.validateAdditionalItems = undefined;
|
|
68289
68805
|
var codegen_1 = require_codegen();
|
|
@@ -68333,7 +68849,7 @@ var require_additionalItems = __commonJS(function(exports) {
|
|
|
68333
68849
|
});
|
|
68334
68850
|
|
|
68335
68851
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js
|
|
68336
|
-
var require_items = __commonJS(
|
|
68852
|
+
var require_items = __commonJS((exports) => {
|
|
68337
68853
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68338
68854
|
exports.validateTuple = undefined;
|
|
68339
68855
|
var codegen_1 = require_codegen();
|
|
@@ -68387,7 +68903,7 @@ var require_items = __commonJS(function(exports) {
|
|
|
68387
68903
|
});
|
|
68388
68904
|
|
|
68389
68905
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js
|
|
68390
|
-
var require_prefixItems = __commonJS(
|
|
68906
|
+
var require_prefixItems = __commonJS((exports) => {
|
|
68391
68907
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68392
68908
|
var items_1 = require_items();
|
|
68393
68909
|
var def = {
|
|
@@ -68401,7 +68917,7 @@ var require_prefixItems = __commonJS(function(exports) {
|
|
|
68401
68917
|
});
|
|
68402
68918
|
|
|
68403
68919
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js
|
|
68404
|
-
var require_items2020 = __commonJS(
|
|
68920
|
+
var require_items2020 = __commonJS((exports) => {
|
|
68405
68921
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68406
68922
|
var codegen_1 = require_codegen();
|
|
68407
68923
|
var util_1 = require_util();
|
|
@@ -68433,7 +68949,7 @@ var require_items2020 = __commonJS(function(exports) {
|
|
|
68433
68949
|
});
|
|
68434
68950
|
|
|
68435
68951
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js
|
|
68436
|
-
var require_contains = __commonJS(
|
|
68952
|
+
var require_contains = __commonJS((exports) => {
|
|
68437
68953
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68438
68954
|
var codegen_1 = require_codegen();
|
|
68439
68955
|
var util_1 = require_util();
|
|
@@ -68524,7 +69040,7 @@ var require_contains = __commonJS(function(exports) {
|
|
|
68524
69040
|
});
|
|
68525
69041
|
|
|
68526
69042
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js
|
|
68527
|
-
var require_dependencies = __commonJS(
|
|
69043
|
+
var require_dependencies = __commonJS((exports) => {
|
|
68528
69044
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68529
69045
|
exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = undefined;
|
|
68530
69046
|
var codegen_1 = require_codegen();
|
|
@@ -68609,7 +69125,7 @@ var require_dependencies = __commonJS(function(exports) {
|
|
|
68609
69125
|
});
|
|
68610
69126
|
|
|
68611
69127
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js
|
|
68612
|
-
var require_propertyNames = __commonJS(
|
|
69128
|
+
var require_propertyNames = __commonJS((exports) => {
|
|
68613
69129
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68614
69130
|
var codegen_1 = require_codegen();
|
|
68615
69131
|
var util_1 = require_util();
|
|
@@ -68649,7 +69165,7 @@ var require_propertyNames = __commonJS(function(exports) {
|
|
|
68649
69165
|
});
|
|
68650
69166
|
|
|
68651
69167
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js
|
|
68652
|
-
var require_additionalProperties = __commonJS(
|
|
69168
|
+
var require_additionalProperties = __commonJS((exports) => {
|
|
68653
69169
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68654
69170
|
var code_1 = require_code2();
|
|
68655
69171
|
var codegen_1 = require_codegen();
|
|
@@ -68752,7 +69268,7 @@ var require_additionalProperties = __commonJS(function(exports) {
|
|
|
68752
69268
|
});
|
|
68753
69269
|
|
|
68754
69270
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js
|
|
68755
|
-
var require_properties = __commonJS(
|
|
69271
|
+
var require_properties = __commonJS((exports) => {
|
|
68756
69272
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68757
69273
|
var validate_1 = require_validate();
|
|
68758
69274
|
var code_1 = require_code2();
|
|
@@ -68807,7 +69323,7 @@ var require_properties = __commonJS(function(exports) {
|
|
|
68807
69323
|
});
|
|
68808
69324
|
|
|
68809
69325
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js
|
|
68810
|
-
var require_patternProperties = __commonJS(
|
|
69326
|
+
var require_patternProperties = __commonJS((exports) => {
|
|
68811
69327
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68812
69328
|
var code_1 = require_code2();
|
|
68813
69329
|
var codegen_1 = require_codegen();
|
|
@@ -68878,7 +69394,7 @@ var require_patternProperties = __commonJS(function(exports) {
|
|
|
68878
69394
|
});
|
|
68879
69395
|
|
|
68880
69396
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js
|
|
68881
|
-
var require_not = __commonJS(
|
|
69397
|
+
var require_not = __commonJS((exports) => {
|
|
68882
69398
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68883
69399
|
var util_1 = require_util();
|
|
68884
69400
|
var def = {
|
|
@@ -68906,7 +69422,7 @@ var require_not = __commonJS(function(exports) {
|
|
|
68906
69422
|
});
|
|
68907
69423
|
|
|
68908
69424
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js
|
|
68909
|
-
var require_anyOf = __commonJS(
|
|
69425
|
+
var require_anyOf = __commonJS((exports) => {
|
|
68910
69426
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68911
69427
|
var code_1 = require_code2();
|
|
68912
69428
|
var def = {
|
|
@@ -68920,7 +69436,7 @@ var require_anyOf = __commonJS(function(exports) {
|
|
|
68920
69436
|
});
|
|
68921
69437
|
|
|
68922
69438
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js
|
|
68923
|
-
var require_oneOf = __commonJS(
|
|
69439
|
+
var require_oneOf = __commonJS((exports) => {
|
|
68924
69440
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68925
69441
|
var codegen_1 = require_codegen();
|
|
68926
69442
|
var util_1 = require_util();
|
|
@@ -68975,7 +69491,7 @@ var require_oneOf = __commonJS(function(exports) {
|
|
|
68975
69491
|
});
|
|
68976
69492
|
|
|
68977
69493
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js
|
|
68978
|
-
var require_allOf = __commonJS(
|
|
69494
|
+
var require_allOf = __commonJS((exports) => {
|
|
68979
69495
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68980
69496
|
var util_1 = require_util();
|
|
68981
69497
|
var def = {
|
|
@@ -68999,7 +69515,7 @@ var require_allOf = __commonJS(function(exports) {
|
|
|
68999
69515
|
});
|
|
69000
69516
|
|
|
69001
69517
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js
|
|
69002
|
-
var require_if = __commonJS(
|
|
69518
|
+
var require_if = __commonJS((exports) => {
|
|
69003
69519
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69004
69520
|
var codegen_1 = require_codegen();
|
|
69005
69521
|
var util_1 = require_util();
|
|
@@ -69065,7 +69581,7 @@ var require_if = __commonJS(function(exports) {
|
|
|
69065
69581
|
});
|
|
69066
69582
|
|
|
69067
69583
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js
|
|
69068
|
-
var require_thenElse = __commonJS(
|
|
69584
|
+
var require_thenElse = __commonJS((exports) => {
|
|
69069
69585
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69070
69586
|
var util_1 = require_util();
|
|
69071
69587
|
var def = {
|
|
@@ -69080,7 +69596,7 @@ var require_thenElse = __commonJS(function(exports) {
|
|
|
69080
69596
|
});
|
|
69081
69597
|
|
|
69082
69598
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js
|
|
69083
|
-
var require_applicator = __commonJS(
|
|
69599
|
+
var require_applicator = __commonJS((exports) => {
|
|
69084
69600
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69085
69601
|
var additionalItems_1 = require_additionalItems();
|
|
69086
69602
|
var prefixItems_1 = require_prefixItems();
|
|
@@ -69123,7 +69639,7 @@ var require_applicator = __commonJS(function(exports) {
|
|
|
69123
69639
|
});
|
|
69124
69640
|
|
|
69125
69641
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js
|
|
69126
|
-
var require_format = __commonJS(
|
|
69642
|
+
var require_format = __commonJS((exports) => {
|
|
69127
69643
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69128
69644
|
var codegen_1 = require_codegen();
|
|
69129
69645
|
var error2 = {
|
|
@@ -69210,7 +69726,7 @@ var require_format = __commonJS(function(exports) {
|
|
|
69210
69726
|
});
|
|
69211
69727
|
|
|
69212
69728
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js
|
|
69213
|
-
var require_format2 = __commonJS(
|
|
69729
|
+
var require_format2 = __commonJS((exports) => {
|
|
69214
69730
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69215
69731
|
var format_1 = require_format();
|
|
69216
69732
|
var format = [format_1.default];
|
|
@@ -69218,7 +69734,7 @@ var require_format2 = __commonJS(function(exports) {
|
|
|
69218
69734
|
});
|
|
69219
69735
|
|
|
69220
69736
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js
|
|
69221
|
-
var require_metadata = __commonJS(
|
|
69737
|
+
var require_metadata = __commonJS((exports) => {
|
|
69222
69738
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69223
69739
|
exports.contentVocabulary = exports.metadataVocabulary = undefined;
|
|
69224
69740
|
exports.metadataVocabulary = [
|
|
@@ -69238,7 +69754,7 @@ var require_metadata = __commonJS(function(exports) {
|
|
|
69238
69754
|
});
|
|
69239
69755
|
|
|
69240
69756
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft7.js
|
|
69241
|
-
var require_draft7 = __commonJS(
|
|
69757
|
+
var require_draft7 = __commonJS((exports) => {
|
|
69242
69758
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69243
69759
|
var core_1 = require_core2();
|
|
69244
69760
|
var validation_1 = require_validation();
|
|
@@ -69257,7 +69773,7 @@ var require_draft7 = __commonJS(function(exports) {
|
|
|
69257
69773
|
});
|
|
69258
69774
|
|
|
69259
69775
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js
|
|
69260
|
-
var require_types = __commonJS(
|
|
69776
|
+
var require_types = __commonJS((exports) => {
|
|
69261
69777
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69262
69778
|
exports.DiscrError = undefined;
|
|
69263
69779
|
var DiscrError;
|
|
@@ -69268,7 +69784,7 @@ var require_types = __commonJS(function(exports) {
|
|
|
69268
69784
|
});
|
|
69269
69785
|
|
|
69270
69786
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js
|
|
69271
|
-
var require_discriminator = __commonJS(
|
|
69787
|
+
var require_discriminator = __commonJS((exports) => {
|
|
69272
69788
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69273
69789
|
var codegen_1 = require_codegen();
|
|
69274
69790
|
var types_1 = require_types();
|
|
@@ -69370,7 +69886,7 @@ var require_discriminator = __commonJS(function(exports) {
|
|
|
69370
69886
|
});
|
|
69371
69887
|
|
|
69372
69888
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-draft-07.json
|
|
69373
|
-
var require_json_schema_draft_07 = __commonJS(
|
|
69889
|
+
var require_json_schema_draft_07 = __commonJS((exports, module) => {
|
|
69374
69890
|
module.exports = {
|
|
69375
69891
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
69376
69892
|
$id: "http://json-schema.org/draft-07/schema#",
|
|
@@ -69525,7 +70041,7 @@ var require_json_schema_draft_07 = __commonJS(function(exports, module) {
|
|
|
69525
70041
|
});
|
|
69526
70042
|
|
|
69527
70043
|
// ../../node_modules/.bun/ajv@8.20.0/node_modules/ajv/dist/ajv.js
|
|
69528
|
-
var require_ajv = __commonJS(
|
|
70044
|
+
var require_ajv = __commonJS((exports, module) => {
|
|
69529
70045
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69530
70046
|
exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = undefined;
|
|
69531
70047
|
var core_1 = require_core();
|
|
@@ -69593,7 +70109,7 @@ var require_ajv = __commonJS(function(exports, module) {
|
|
|
69593
70109
|
});
|
|
69594
70110
|
|
|
69595
70111
|
// ../../node_modules/.bun/ajv-formats@3.0.1/node_modules/ajv-formats/dist/formats.js
|
|
69596
|
-
var require_formats = __commonJS(
|
|
70112
|
+
var require_formats = __commonJS((exports) => {
|
|
69597
70113
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69598
70114
|
exports.formatNames = exports.fastFormats = exports.fullFormats = undefined;
|
|
69599
70115
|
function fmtDef(validate2, compare) {
|
|
@@ -69770,7 +70286,7 @@ var require_formats = __commonJS(function(exports) {
|
|
|
69770
70286
|
});
|
|
69771
70287
|
|
|
69772
70288
|
// ../../node_modules/.bun/ajv-formats@3.0.1/node_modules/ajv-formats/dist/limit.js
|
|
69773
|
-
var require_limit = __commonJS(
|
|
70289
|
+
var require_limit = __commonJS((exports) => {
|
|
69774
70290
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69775
70291
|
exports.formatLimitDefinition = undefined;
|
|
69776
70292
|
var ajv_1 = require_ajv();
|
|
@@ -69839,7 +70355,7 @@ var require_limit = __commonJS(function(exports) {
|
|
|
69839
70355
|
});
|
|
69840
70356
|
|
|
69841
70357
|
// ../../node_modules/.bun/ajv-formats@3.0.1/node_modules/ajv-formats/dist/index.js
|
|
69842
|
-
var require_dist = __commonJS(
|
|
70358
|
+
var require_dist = __commonJS((exports, module) => {
|
|
69843
70359
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69844
70360
|
var formats_1 = require_formats();
|
|
69845
70361
|
var limit_1 = require_limit();
|
|
@@ -71588,7 +72104,7 @@ var MCP_CONTRACT_SCHEMA_VERSION = 1, stringSchema = (description) => ({
|
|
|
71588
72104
|
type: "array",
|
|
71589
72105
|
items,
|
|
71590
72106
|
...description ? { description } : {}
|
|
71591
|
-
}), skillNameInput, optionalAgentInput, scopeInput, runInputSchema, runArgsSchema, errorSchema, skillSummarySchema, toolPrimitiveSummarySchema, skillToolDependencySchema, validationMessageSchema, validationOutputSchema, installOutputSchema, runOutputSchema, toolContracts, remoteCustomerContracts, contracts, resourceContracts;
|
|
72107
|
+
}), skillNameInput, optionalAgentInput, scopeInput, runInputSchema, runArgsSchema, errorSchema, skillSummarySchema, toolPrimitiveSummarySchema, skillToolDependencySchema, validationMessageSchema, validationOutputSchema, installOutputSchema, runOutputSchema, toolContracts, remoteCustomerContracts, publicationUuidSchema, publicationVerification, privatePublicationContracts, contracts, resourceContracts;
|
|
71592
72108
|
var init_mcp_contracts = __esm(() => {
|
|
71593
72109
|
init_remote_customer_operations();
|
|
71594
72110
|
skillNameInput = stringSchema("skill name or alias.");
|
|
@@ -72094,7 +72610,7 @@ var init_mcp_contracts = __esm(() => {
|
|
|
72094
72610
|
name: "run_skill",
|
|
72095
72611
|
title: "Run Skill",
|
|
72096
72612
|
description: "Run a skill locally or through a configured remote runner. Returns compact stdout/stderr previews and run summaries by default; pass detail:true for full records.",
|
|
72097
|
-
params: ["name", "input?", "args?", "detail?", "remote?", "maxCredits?", "maxCostCents?", "idempotency_key?", "files?"],
|
|
72613
|
+
params: ["name", "input?", "args?", "detail?", "remote?", "maxCredits?", "maxCostCents?", "quoteReceipt?", "idempotency_key?", "files?"],
|
|
72098
72614
|
category: "execution",
|
|
72099
72615
|
sideEffects: "local-process-or-remote-run",
|
|
72100
72616
|
stable: true,
|
|
@@ -72106,6 +72622,7 @@ var init_mcp_contracts = __esm(() => {
|
|
|
72106
72622
|
remote: { type: "boolean", description: "Use the configured server catalog." },
|
|
72107
72623
|
maxCredits: { type: "integer", minimum: 0, description: "Maximum explicitly approved integer credits; omitted permits only free remote runs." },
|
|
72108
72624
|
maxCostCents: { type: "integer", minimum: 0, description: "Legacy alias for maxCredits; both must agree." },
|
|
72625
|
+
quoteReceipt: { type: "string", minLength: 1, maxLength: 4096, description: "Opaque approved quote receipt, at most 4096 UTF-8 bytes. Preserve it and the quoted input/args unchanged; never refresh after confirmation." },
|
|
72109
72626
|
idempotency_key: { type: "string", pattern: "^[A-Za-z0-9._:-]{1,128}$", description: "Stable retry key for the same remote submission." },
|
|
72110
72627
|
files: { type: "array", maxItems: 10, items: objectSchema({ name: stringSchema("Safe basename"), base64: { type: "string", maxLength: 1398104 }, contentType: stringSchema("MIME type") }, ["name", "base64"]), description: "Inline remote inputs, at most 1 MiB combined." }
|
|
72111
72628
|
}, ["name"]),
|
|
@@ -72389,12 +72906,17 @@ var init_mcp_contracts = __esm(() => {
|
|
|
72389
72906
|
name: "quote_skill",
|
|
72390
72907
|
title: "Quote Remote Skill",
|
|
72391
72908
|
description: "Get a server credit quote without submitting a run.",
|
|
72392
|
-
params: ["name", "input?", "args?"],
|
|
72909
|
+
params: ["name", "input?", "args?", "files?"],
|
|
72393
72910
|
category: "execution",
|
|
72394
72911
|
sideEffects: "none",
|
|
72395
72912
|
stable: true,
|
|
72396
|
-
inputSchema: objectSchema({
|
|
72397
|
-
|
|
72913
|
+
inputSchema: objectSchema({
|
|
72914
|
+
name: skillNameInput,
|
|
72915
|
+
input: runInputSchema,
|
|
72916
|
+
args: runArgsSchema,
|
|
72917
|
+
files: { type: "array", maxItems: 10, items: objectSchema({ name: stringSchema("Safe basename"), base64: { type: "string", maxLength: 1398104 }, contentType: stringSchema("MIME type") }, ["name", "base64"]), description: "Same inline files to submit after approval, at most 1 MiB combined." }
|
|
72918
|
+
}, ["name"]),
|
|
72919
|
+
outputSchema: objectSchema({ skill: stringSchema("Canonical server skill."), pricing: objectSchema({}, [], "Quoted integer credits.", true), quoteReceipt: { type: "string", minLength: 1, maxLength: 4096, description: "Opaque server quote binding, at most 4096 UTF-8 bytes; preserve verbatim for approval." } }, ["skill", "pricing"], undefined, true)
|
|
72398
72920
|
});
|
|
72399
72921
|
remoteCustomerContracts.push({
|
|
72400
72922
|
name: "download_run_artifact",
|
|
@@ -72407,7 +72929,47 @@ var init_mcp_contracts = __esm(() => {
|
|
|
72407
72929
|
inputSchema: objectSchema({ run_id: stringSchema("Run identifier."), artifact_id: stringSchema("Artifact identifier.") }, ["run_id", "artifact_id"]),
|
|
72408
72930
|
outputSchema: objectSchema({ id: stringSchema("Artifact identifier."), fileName: stringSchema("Artifact file name."), base64: stringSchema("Verified bytes."), sha256: stringSchema("SHA256 digest."), byteSize: { type: "integer", minimum: 0 } }, ["id", "fileName", "base64", "sha256", "byteSize"])
|
|
72409
72931
|
});
|
|
72410
|
-
|
|
72932
|
+
publicationUuidSchema = { type: "string", pattern: "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$" };
|
|
72933
|
+
publicationVerification = {
|
|
72934
|
+
email: { type: "string", format: "email", maxLength: 254 },
|
|
72935
|
+
code: { type: "string", pattern: "^\\d{6}$" },
|
|
72936
|
+
userId: publicationUuidSchema,
|
|
72937
|
+
membershipId: publicationUuidSchema,
|
|
72938
|
+
recoveryDirectory: { type: "string", maxLength: 4096, description: "Absolute host-local recovery directory without symbolic links." }
|
|
72939
|
+
};
|
|
72940
|
+
privatePublicationContracts = [
|
|
72941
|
+
{ name: "publish_private_skill", title: "Publish private skill", extras: {
|
|
72942
|
+
directory: { type: "string", maxLength: 4096, description: "Absolute local skill source directory." },
|
|
72943
|
+
skillId: publicationUuidSchema,
|
|
72944
|
+
expectedCurrentVersionId: { oneOf: [publicationUuidSchema, { type: "null" }] },
|
|
72945
|
+
idempotencyKey: publicationUuidSchema,
|
|
72946
|
+
confirm: { const: true },
|
|
72947
|
+
waitMs: { type: "integer", minimum: 0, maximum: 300000 }
|
|
72948
|
+
}, required: ["directory", "skillId", "expectedCurrentVersionId", "confirm"] },
|
|
72949
|
+
{ name: "get_private_publication", title: "Get private publication", extras: {}, required: [] },
|
|
72950
|
+
{ name: "resume_private_publication", title: "Resume private publication", extras: { confirm: { const: true }, waitMs: { type: "integer", minimum: 0, maximum: 300000 } }, required: ["confirm"] },
|
|
72951
|
+
{ name: "cancel_private_publication", title: "Cancel private publication", extras: { confirm: { const: true } }, required: ["confirm"] }
|
|
72952
|
+
].map((operation) => ({
|
|
72953
|
+
name: operation.name,
|
|
72954
|
+
title: operation.title,
|
|
72955
|
+
description: "Manage private source publication with fresh workspace verification and durable host-local recovery. Upload consent and current version comparison are explicit; private execution remains unavailable.",
|
|
72956
|
+
params: [...Object.keys(publicationVerification), ...Object.keys(operation.extras)],
|
|
72957
|
+
category: "storage",
|
|
72958
|
+
sideEffects: "filesystem",
|
|
72959
|
+
stable: true,
|
|
72960
|
+
inputSchema: objectSchema({ ...publicationVerification, ...operation.extras }, [...Object.keys(publicationVerification), ...operation.required]),
|
|
72961
|
+
outputSchema: objectSchema({
|
|
72962
|
+
recoveryDirectory: { type: "string" },
|
|
72963
|
+
skillId: publicationUuidSchema,
|
|
72964
|
+
intentId: { oneOf: [publicationUuidSchema, { type: "null" }] },
|
|
72965
|
+
state: { type: "string" },
|
|
72966
|
+
versionId: { oneOf: [publicationUuidSchema, { type: "null" }] },
|
|
72967
|
+
committed: { type: "boolean" },
|
|
72968
|
+
executionEnabled: { const: false },
|
|
72969
|
+
nextAction: { type: "string" }
|
|
72970
|
+
}, ["recoveryDirectory", "skillId", "intentId", "state", "versionId", "committed", "executionEnabled", "nextAction"])
|
|
72971
|
+
}));
|
|
72972
|
+
contracts = [...toolContracts, ...remoteCustomerContracts, ...privatePublicationContracts].sort((a, b) => a.name.localeCompare(b.name));
|
|
72411
72973
|
resourceContracts = [
|
|
72412
72974
|
{
|
|
72413
72975
|
uri: "skills://mcp/contracts",
|
|
@@ -72664,9 +73226,9 @@ var init_discovery_tools = __esm(() => {
|
|
|
72664
73226
|
// src/lib/run-routing.ts
|
|
72665
73227
|
var exports_run_routing = {};
|
|
72666
73228
|
__export(exports_run_routing, {
|
|
72667
|
-
|
|
73229
|
+
resolveRunRouting: () => resolveRunRouting,
|
|
72668
73230
|
resolveConfiguredRunRouting: () => resolveConfiguredRunRouting,
|
|
72669
|
-
|
|
73231
|
+
isServerOwnedSkill: () => isServerOwnedSkill
|
|
72670
73232
|
});
|
|
72671
73233
|
function isServerOwnedSkill(skill) {
|
|
72672
73234
|
return skill.serverOwned === true;
|
|
@@ -72922,11 +73484,12 @@ function registerOperationTools(server) {
|
|
|
72922
73484
|
detail: exports_external.boolean().optional(),
|
|
72923
73485
|
maxCostCents: exports_external.number().int().min(0).max(2147483647).optional().describe("Maximum integer credits explicitly approved by the user for a remote run; omitted permits only free runs"),
|
|
72924
73486
|
maxCredits: exports_external.number().int().min(0).max(2147483647).optional(),
|
|
73487
|
+
quoteReceipt: exports_external.string().min(1).max(4096).refine((value) => Buffer.byteLength(value, "utf8") <= 4096, "Quote receipt exceeds 4096 UTF-8 bytes").optional().describe("Opaque receipt from the approved quote; send unchanged with the same input, args and files. Never refresh after confirmation."),
|
|
72925
73488
|
remote: exports_external.boolean().optional().describe("Use the configured server catalog, including skills not installed locally"),
|
|
72926
73489
|
idempotency_key: exports_external.string().regex(/^[A-Za-z0-9._:-]{1,128}$/).optional().describe("Reuse for the same approved submission after an interrupted response"),
|
|
72927
73490
|
files: exports_external.array(exports_external.object({ name: exports_external.string(), base64: exports_external.string().max(1398104), contentType: exports_external.string().optional() })).max(10).optional().describe("Inline remote inputs, at most 1 MiB combined; use CLI or SDK for larger files")
|
|
72928
73491
|
}
|
|
72929
|
-
}, async ({ name, input, args, detail, maxCostCents, maxCredits, remote, idempotency_key, files }) => {
|
|
73492
|
+
}, async ({ name, input, args, detail, maxCostCents, maxCredits, quoteReceipt, remote, idempotency_key, files }) => {
|
|
72930
73493
|
const skill = remote ? { name, serverOwned: true } : getSkill(name);
|
|
72931
73494
|
if (!skill) {
|
|
72932
73495
|
return mcpError("SKILL_NOT_FOUND", `Skill '${name}' not found`, findSimilarSkills(name));
|
|
@@ -72967,7 +73530,7 @@ function registerOperationTools(server) {
|
|
|
72967
73530
|
try {
|
|
72968
73531
|
const { RemoteSkillsClient: RemoteSkillsClient2 } = await Promise.resolve().then(() => (init_remote_client(), exports_remote_client));
|
|
72969
73532
|
const client = new RemoteSkillsClient2(routing.apiKey, routing.apiOrigin);
|
|
72970
|
-
const run = await client.submitQuotedRunWithFiles(skillName, runInput, runArgs, inputFiles, { maxCredits, maxCostCents, idempotencyKey: idempotency_key ?? runContext.record.id });
|
|
73533
|
+
const run = await client.submitQuotedRunWithFiles(skillName, runInput, runArgs, inputFiles, { maxCredits, maxCostCents, quoteReceipt, idempotencyKey: idempotency_key ?? runContext.record.id });
|
|
72971
73534
|
if (run.error) {
|
|
72972
73535
|
writeRunLogs(runContext, "", String(run.error) + `
|
|
72973
73536
|
`);
|
|
@@ -73988,7 +74551,7 @@ async function requestInvitationEmail(origin, action, input) {
|
|
|
73988
74551
|
}
|
|
73989
74552
|
const body = JSON.stringify({ invitationId: value.invitationId, token: value.token, challengeId: value.challengeId, ...action === "accept" ? { code: value.code } : {} });
|
|
73990
74553
|
try {
|
|
73991
|
-
const response = await fetch(
|
|
74554
|
+
const response = await fetch(skillsApiRequestUrl(target, `/api/v1/account/invitations/email-${action}`), {
|
|
73992
74555
|
method: "POST",
|
|
73993
74556
|
headers: { "Content-Type": "application/json" },
|
|
73994
74557
|
body,
|
|
@@ -74063,14 +74626,318 @@ var init_remote_invitation_recovery = __esm(() => {
|
|
|
74063
74626
|
};
|
|
74064
74627
|
});
|
|
74065
74628
|
|
|
74629
|
+
// src/lib/remote-private-publications.ts
|
|
74630
|
+
import { createHash as createHash7 } from "crypto";
|
|
74631
|
+
function checkedPublicationDeclaration(value) {
|
|
74632
|
+
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 || !hash(value.archiveSha256) || !Number.isSafeInteger(value.archiveByteSize) || Number(value.archiveByteSize) < 1 || Number(value.archiveByteSize) > PRIVATE_PUBLICATION_MAX_BYTES)
|
|
74633
|
+
return bad();
|
|
74634
|
+
try {
|
|
74635
|
+
const manifest = JSON.parse(value.manifestText);
|
|
74636
|
+
if (!record7(manifest) || manifest.version !== value.version || validatePortableManifestContract(manifest, { strict: true }).length || !hash(manifest.provenance?.content_hash))
|
|
74637
|
+
return bad();
|
|
74638
|
+
} catch {
|
|
74639
|
+
return bad();
|
|
74640
|
+
}
|
|
74641
|
+
return Object.freeze({ ...value });
|
|
74642
|
+
}
|
|
74643
|
+
function checkedPublicationView(value, skillId, intentId, declaration) {
|
|
74644
|
+
if (!exact(value, ["id", "skillId", "version", "expectedCurrentVersionId", "archiveSha256", "archiveByteSize", "state", "expiresAt", "createdAt", "versionId"]) || !publicationUuid(value.id) || value.skillId !== skillId || intentId !== undefined && value.id !== intentId || typeof value.version !== "string" || !value.version || value.version.length > 128 || /[\p{Cc}\p{Cs}]/u.test(value.version) || !(value.expectedCurrentVersionId === null || publicationUuid(value.expectedCurrentVersionId)) || !hash(value.archiveSha256) || !Number.isSafeInteger(value.archiveByteSize) || Number(value.archiveByteSize) < 1 || Number(value.archiveByteSize) > PRIVATE_PUBLICATION_MAX_BYTES || typeof value.state !== "string" || !["awaiting_upload", "queued", "verifying", "needs_attention", "committed", "rejected", "cancelled", "expired"].includes(value.state) || !date4(value.expiresAt) || !date4(value.createdAt) || !(value.versionId === null || publicationUuid(value.versionId)) || value.state === "committed" && value.versionId === null)
|
|
74645
|
+
return invalid3();
|
|
74646
|
+
if (declaration && ["version", "expectedCurrentVersionId", "archiveSha256", "archiveByteSize"].some((k) => value[k] !== declaration[k]))
|
|
74647
|
+
return invalid3();
|
|
74648
|
+
return Object.freeze({ ...value });
|
|
74649
|
+
}
|
|
74650
|
+
async function boundedJson(url, init, token, mutation, budget = 15000, signal) {
|
|
74651
|
+
const controller = new AbortController;
|
|
74652
|
+
let reader;
|
|
74653
|
+
let response;
|
|
74654
|
+
const timeout = new PrivatePublicationError("PUBLICATION_UNCONFIRMED", "No confirmed publication result. Inspect the saved intent before retrying.", mutation);
|
|
74655
|
+
let timer;
|
|
74656
|
+
let abort;
|
|
74657
|
+
try {
|
|
74658
|
+
return await Promise.race([(async () => {
|
|
74659
|
+
if (signal?.aborted)
|
|
74660
|
+
throw timeout;
|
|
74661
|
+
response = await fetch(url, {
|
|
74662
|
+
...init,
|
|
74663
|
+
redirect: "error",
|
|
74664
|
+
credentials: "omit",
|
|
74665
|
+
signal: controller.signal,
|
|
74666
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` }
|
|
74667
|
+
});
|
|
74668
|
+
const length = response.headers.get("content-length");
|
|
74669
|
+
if (length !== null && (!/^\d+$/.test(length) || Number(length) > 65536))
|
|
74670
|
+
return invalid3();
|
|
74671
|
+
reader = response.body?.getReader();
|
|
74672
|
+
const chunks = [];
|
|
74673
|
+
let size2 = 0;
|
|
74674
|
+
if (reader)
|
|
74675
|
+
while (true) {
|
|
74676
|
+
const part = await reader.read();
|
|
74677
|
+
if (part.done)
|
|
74678
|
+
break;
|
|
74679
|
+
size2 += part.value.byteLength;
|
|
74680
|
+
if (size2 > 65536)
|
|
74681
|
+
return invalid3();
|
|
74682
|
+
chunks.push(part.value);
|
|
74683
|
+
}
|
|
74684
|
+
if (controller.signal.aborted)
|
|
74685
|
+
throw timeout;
|
|
74686
|
+
const bytes = Buffer.concat(chunks);
|
|
74687
|
+
let body;
|
|
74688
|
+
try {
|
|
74689
|
+
body = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
74690
|
+
} catch {
|
|
74691
|
+
return invalid3();
|
|
74692
|
+
}
|
|
74693
|
+
if (!response.ok) {
|
|
74694
|
+
const code = record7(body) && typeof body.code === "string" && Object.hasOwn(failures, body.code) ? body.code : null;
|
|
74695
|
+
if (code && failures[code][0] === response.status)
|
|
74696
|
+
throw new PrivatePublicationError(code, failures[code][1], mutation && code === "PUBLICATION_UNCERTAIN", response.status);
|
|
74697
|
+
throw new PrivatePublicationError("PUBLICATION_REQUEST_FAILED", "The publication request was refused. Inspect its status before retrying.", mutation && response.status >= 500, response.status);
|
|
74698
|
+
}
|
|
74699
|
+
return body;
|
|
74700
|
+
})(), new Promise((_, reject2) => {
|
|
74701
|
+
abort = () => {
|
|
74702
|
+
controller.abort();
|
|
74703
|
+
reject2(timeout);
|
|
74704
|
+
};
|
|
74705
|
+
timer = setTimeout(abort, Math.max(1, Math.min(15000, budget)));
|
|
74706
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
74707
|
+
})]);
|
|
74708
|
+
} catch (error2) {
|
|
74709
|
+
if (error2 instanceof PrivatePublicationError) {
|
|
74710
|
+
if (mutation && error2.code === "INVALID_PUBLICATION_RESPONSE")
|
|
74711
|
+
throw timeout;
|
|
74712
|
+
throw error2;
|
|
74713
|
+
}
|
|
74714
|
+
throw timeout;
|
|
74715
|
+
} finally {
|
|
74716
|
+
if (timer)
|
|
74717
|
+
clearTimeout(timer);
|
|
74718
|
+
if (abort)
|
|
74719
|
+
signal?.removeEventListener("abort", abort);
|
|
74720
|
+
controller.abort();
|
|
74721
|
+
if (reader)
|
|
74722
|
+
reader.cancel().catch(() => {});
|
|
74723
|
+
else
|
|
74724
|
+
response?.body?.cancel().catch(() => {});
|
|
74725
|
+
}
|
|
74726
|
+
}
|
|
74727
|
+
|
|
74728
|
+
class RemotePrivatePublicationsClient {
|
|
74729
|
+
apiOrigin;
|
|
74730
|
+
organizationId;
|
|
74731
|
+
userId;
|
|
74732
|
+
membershipId;
|
|
74733
|
+
#token;
|
|
74734
|
+
constructor(apiUrl, session) {
|
|
74735
|
+
const checked = parseWorkspaceSession(session, { userId: session?.user?.id, membershipId: session?.user?.membershipId });
|
|
74736
|
+
if (checked.user.role === "viewer")
|
|
74737
|
+
throw new PrivatePublicationError("PUBLICATION_FORBIDDEN", failures.PUBLICATION_FORBIDDEN[1]);
|
|
74738
|
+
this.apiOrigin = normalizeSkillsApiOrigin(apiUrl);
|
|
74739
|
+
this.#token = checked.token;
|
|
74740
|
+
this.organizationId = checked.organization.id;
|
|
74741
|
+
this.userId = checked.user.id;
|
|
74742
|
+
this.membershipId = checked.user.membershipId;
|
|
74743
|
+
Object.freeze(this);
|
|
74744
|
+
}
|
|
74745
|
+
async getCapability(options = {}) {
|
|
74746
|
+
if (options.timeoutMs !== undefined && (!Number.isSafeInteger(options.timeoutMs) || options.timeoutMs < 1 || options.timeoutMs > 15000))
|
|
74747
|
+
return bad();
|
|
74748
|
+
const response = await boundedJson(skillsApiRequestUrl(this.apiOrigin, "/api/v1/capabilities"), {}, this.#token, false, options.timeoutMs, options.signal);
|
|
74749
|
+
const p = record7(response) && response.privatePublishing;
|
|
74750
|
+
if (!record7(response) || response.contractVersion !== 1 || response.apiVersion !== 1 || !exact(p, ["contractVersion", "enabled", "authentication", "maxArchiveBytes", "uploadMaxTtlSeconds", "executionEnabled"]) || p.contractVersion !== 1 || typeof p.enabled !== "boolean" || p.authentication !== "interactive-session" || p.maxArchiveBytes !== PRIVATE_PUBLICATION_MAX_BYTES || p.uploadMaxTtlSeconds !== 300 || p.executionEnabled !== false)
|
|
74751
|
+
throw new PrivatePublicationError("PUBLICATION_CONTRACT_UNAVAILABLE", "This server does not support the hosted private publication contract.");
|
|
74752
|
+
return Object.freeze({ ...p });
|
|
74753
|
+
}
|
|
74754
|
+
async#gate(enabled, options = {}) {
|
|
74755
|
+
if (!(await this.getCapability(options)).enabled && enabled)
|
|
74756
|
+
throw new PrivatePublicationError("PUBLICATION_CAPABILITY_UNAVAILABLE", failures.PUBLICATION_CAPABILITY_UNAVAILABLE[1]);
|
|
74757
|
+
}
|
|
74758
|
+
#path(skillId, intentId) {
|
|
74759
|
+
if (!publicationUuid(skillId) || intentId !== undefined && !publicationUuid(intentId))
|
|
74760
|
+
return bad();
|
|
74761
|
+
return skillsApiRequestUrl(this.apiOrigin, `/api/v1/skills/${skillId}/publication-uploads${intentId ? `/${intentId}` : ""}`);
|
|
74762
|
+
}
|
|
74763
|
+
async#view(path, method2, skillId, intentId, declaration, options = {}) {
|
|
74764
|
+
const value = await boundedJson(path, { method: method2, ...method2 === "GET" ? {} : { body: JSON.stringify(declaration ?? {}) } }, this.#token, method2 !== "GET", options.timeoutMs, options.signal);
|
|
74765
|
+
try {
|
|
74766
|
+
if (!record7(value) || !Object.keys(value).every((k) => k === "upload" || k === "changed") || value.changed !== undefined && typeof value.changed !== "boolean")
|
|
74767
|
+
return invalid3();
|
|
74768
|
+
return checkedPublicationView(value.upload, skillId, intentId, declaration);
|
|
74769
|
+
} catch (error2) {
|
|
74770
|
+
if (method2 !== "GET")
|
|
74771
|
+
throw new PrivatePublicationError("PUBLICATION_UNCONFIRMED", "The publication result could not be confirmed. Reconcile the saved intent before another action.", true);
|
|
74772
|
+
throw error2;
|
|
74773
|
+
}
|
|
74774
|
+
}
|
|
74775
|
+
async begin(skillId, input) {
|
|
74776
|
+
const path = this.#path(skillId), declaration = checkedPublicationDeclaration(input);
|
|
74777
|
+
await this.#gate(true);
|
|
74778
|
+
return this.#view(path, "POST", skillId, undefined, declaration);
|
|
74779
|
+
}
|
|
74780
|
+
async get(skillId, intentId, options = {}) {
|
|
74781
|
+
const path = this.#path(skillId, intentId), until = Date.now() + (options.timeoutMs ?? 15000);
|
|
74782
|
+
await this.#gate(false, options);
|
|
74783
|
+
return this.#view(path, "GET", skillId, intentId, undefined, { ...options, timeoutMs: Math.max(1, until - Date.now()) });
|
|
74784
|
+
}
|
|
74785
|
+
async finalize(skillId, intentId) {
|
|
74786
|
+
const path = this.#path(skillId, intentId);
|
|
74787
|
+
await this.#gate(true);
|
|
74788
|
+
return this.#view(`${path}/finalize`, "POST", skillId, intentId);
|
|
74789
|
+
}
|
|
74790
|
+
async cancel(skillId, intentId) {
|
|
74791
|
+
const path = this.#path(skillId, intentId);
|
|
74792
|
+
await this.#gate(false);
|
|
74793
|
+
return this.#view(path, "DELETE", skillId, intentId);
|
|
74794
|
+
}
|
|
74795
|
+
async upload(skillId, intent, bytes) {
|
|
74796
|
+
const captured = checkedPublicationView(intent, skillId), path = this.#path(skillId, captured.id);
|
|
74797
|
+
if (!(bytes instanceof Uint8Array) || bytes.byteLength !== captured.archiveByteSize)
|
|
74798
|
+
return bad();
|
|
74799
|
+
const owned = Buffer.from(bytes);
|
|
74800
|
+
if (captured.state !== "awaiting_upload" || owned.byteLength !== captured.archiveByteSize || publicationSha256(owned) !== captured.archiveSha256)
|
|
74801
|
+
return bad();
|
|
74802
|
+
await this.#gate(true);
|
|
74803
|
+
const value = await boundedJson(`${path}/upload-url`, { method: "POST", body: "{}" }, this.#token, false);
|
|
74804
|
+
const upload = this.#upload(value, captured);
|
|
74805
|
+
const controller = new AbortController;
|
|
74806
|
+
let timer;
|
|
74807
|
+
const uncertain = () => new PrivatePublicationError("PUBLICATION_UPLOAD_UNCONFIRMED", "Upload acceptance is uncertain. Resume this saved intent to finalize and inspect it; do not upload again.", true);
|
|
74808
|
+
try {
|
|
74809
|
+
await Promise.race([(async () => {
|
|
74810
|
+
const response = await fetch(upload.uploadUrl, { method: "PUT", headers: upload.headers, body: owned, redirect: "error", credentials: "omit", signal: controller.signal });
|
|
74811
|
+
response.body?.cancel().catch(() => {});
|
|
74812
|
+
if (response.status !== 200 || controller.signal.aborted)
|
|
74813
|
+
throw uncertain();
|
|
74814
|
+
})(), new Promise((_, reject2) => {
|
|
74815
|
+
timer = setTimeout(() => {
|
|
74816
|
+
controller.abort();
|
|
74817
|
+
reject2(uncertain());
|
|
74818
|
+
}, 30000);
|
|
74819
|
+
})]);
|
|
74820
|
+
} catch {
|
|
74821
|
+
throw uncertain();
|
|
74822
|
+
} finally {
|
|
74823
|
+
if (timer)
|
|
74824
|
+
clearTimeout(timer);
|
|
74825
|
+
controller.abort();
|
|
74826
|
+
}
|
|
74827
|
+
}
|
|
74828
|
+
#upload(value, intent) {
|
|
74829
|
+
if (!exact(value, ["upload"]) || !exact(value.upload, ["method", "uploadUrl", "headers", "expiresAt"]))
|
|
74830
|
+
return invalid3();
|
|
74831
|
+
const p = value.upload;
|
|
74832
|
+
if (p.method !== "PUT" || typeof p.uploadUrl !== "string" || p.uploadUrl.length > 8192 || /[\x00-\x20\x7f]/.test(p.uploadUrl) || !date4(p.expiresAt) || Date.parse(p.expiresAt) - Date.now() < 1000 || Date.parse(p.expiresAt) - Date.now() > 300000 || Date.parse(p.expiresAt) > Date.parse(intent.expiresAt) || !exact(p.headers, ["content-type", "content-length", "x-amz-checksum-sha256", "x-amz-expected-bucket-owner"]) || p.headers["content-type"] !== "application/gzip" || p.headers["content-length"] !== String(intent.archiveByteSize) || p.headers["x-amz-checksum-sha256"] !== Buffer.from(intent.archiveSha256, "hex").toString("base64") || typeof p.headers["x-amz-expected-bucket-owner"] !== "string" || !/^\d{12}$/.test(p.headers["x-amz-expected-bucket-owner"]))
|
|
74833
|
+
return invalid3();
|
|
74834
|
+
let url;
|
|
74835
|
+
try {
|
|
74836
|
+
url = new URL(p.uploadUrl);
|
|
74837
|
+
} catch {
|
|
74838
|
+
return invalid3();
|
|
74839
|
+
}
|
|
74840
|
+
if (url.protocol !== "https:" || url.port || url.username || url.password || url.hash || !/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]\.s3\.[a-z]{2}(?:-[a-z]+)+-[1-9]\.amazonaws\.com$/.test(url.hostname) || url.pathname !== `/private-publication-staging/${this.organizationId}/${intent.id}/bundle.tgz` || !url.search || url.searchParams.get("X-Amz-Algorithm") !== "AWS4-HMAC-SHA256" || url.searchParams.get("X-Amz-SignedHeaders") !== "content-length;content-type;host;x-amz-checksum-sha256;x-amz-expected-bucket-owner" || !/^[a-f0-9]{64}$/.test(url.searchParams.get("X-Amz-Signature") ?? ""))
|
|
74841
|
+
return invalid3();
|
|
74842
|
+
const queryKeys = ["X-Amz-Algorithm", "X-Amz-Credential", "X-Amz-Date", "X-Amz-Expires", "X-Amz-Security-Token", "X-Amz-Signature", "X-Amz-SignedHeaders"];
|
|
74843
|
+
if ([...url.searchParams.keys()].sort().join(",") !== queryKeys.sort().join(","))
|
|
74844
|
+
return invalid3();
|
|
74845
|
+
const issued = url.searchParams.get("X-Amz-Date"), ttl = url.searchParams.get("X-Amz-Expires"), credential = url.searchParams.get("X-Amz-Credential");
|
|
74846
|
+
const timestamp3 = /^(\d{4})(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)Z$/.exec(issued);
|
|
74847
|
+
const region = url.hostname.split(".s3.")[1].split(".amazonaws.com")[0];
|
|
74848
|
+
if (!timestamp3 || !/^[1-9]\d{0,2}$/.test(ttl) || Number(ttl) > 300 || !/^[A-Z0-9]{16,128}\//.test(credential) || credential.split("/").slice(1).join("/") !== `${issued.slice(0, 8)}/${region}/s3/aws4_request` || !/^[\x21-\x7e]{1,4096}$/.test(url.searchParams.get("X-Amz-Security-Token")))
|
|
74849
|
+
return invalid3();
|
|
74850
|
+
const issuedAt = Date.parse(`${timestamp3[1]}-${timestamp3[2]}-${timestamp3[3]}T${timestamp3[4]}:${timestamp3[5]}:${timestamp3[6]}Z`);
|
|
74851
|
+
if (!Number.isFinite(issuedAt) || issuedAt > Date.now() + 1000 || issuedAt + Number(ttl) * 1000 !== Date.parse(p.expiresAt))
|
|
74852
|
+
return invalid3();
|
|
74853
|
+
return { method: "PUT", uploadUrl: url.href, expiresAt: p.expiresAt, headers: Object.freeze({ ...p.headers }) };
|
|
74854
|
+
}
|
|
74855
|
+
async wait(skillId, intentId, options = {}) {
|
|
74856
|
+
const timeout = options.timeoutMs ?? 60000;
|
|
74857
|
+
if (!Number.isSafeInteger(timeout) || timeout < 0 || timeout > 300000)
|
|
74858
|
+
return bad();
|
|
74859
|
+
const until = Date.now() + timeout;
|
|
74860
|
+
let previous;
|
|
74861
|
+
while (true) {
|
|
74862
|
+
if (options.signal?.aborted)
|
|
74863
|
+
throw new PrivatePublicationError("PUBLICATION_WAIT_ABORTED", "Stopped waiting. The server publication continues; inspect the saved intent.");
|
|
74864
|
+
let view;
|
|
74865
|
+
try {
|
|
74866
|
+
view = await this.get(skillId, intentId, { timeoutMs: timeout === 0 ? 15000 : Math.max(1, Math.min(15000, until - Date.now())), signal: options.signal });
|
|
74867
|
+
} catch (error2) {
|
|
74868
|
+
if (previous && Date.now() >= until && !options.signal?.aborted)
|
|
74869
|
+
return previous;
|
|
74870
|
+
throw error2;
|
|
74871
|
+
}
|
|
74872
|
+
previous = view;
|
|
74873
|
+
if (!["queued", "verifying"].includes(view.state) || Date.now() >= until)
|
|
74874
|
+
return view;
|
|
74875
|
+
await new Promise((resolve3) => {
|
|
74876
|
+
const timer = setTimeout(done, Math.min(1000, until - Date.now()));
|
|
74877
|
+
function done() {
|
|
74878
|
+
clearTimeout(timer);
|
|
74879
|
+
options.signal?.removeEventListener("abort", done);
|
|
74880
|
+
resolve3();
|
|
74881
|
+
}
|
|
74882
|
+
options.signal?.addEventListener("abort", done, { once: true });
|
|
74883
|
+
});
|
|
74884
|
+
}
|
|
74885
|
+
}
|
|
74886
|
+
}
|
|
74887
|
+
var PRIVATE_PUBLICATION_MAX_BYTES, failures, PrivatePublicationError, bad = () => {
|
|
74888
|
+
throw new PrivatePublicationError("INVALID_PUBLICATION_INPUT", "Invalid publication input or recovery data.");
|
|
74889
|
+
}, invalid3 = () => {
|
|
74890
|
+
throw new PrivatePublicationError("INVALID_PUBLICATION_RESPONSE", "The server returned an invalid publication result.");
|
|
74891
|
+
}, 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), hash = (v) => typeof v === "string" && /^[a-f0-9]{64}$/.test(v), record7 = (v) => !!v && typeof v === "object" && !Array.isArray(v), exact = (v, keys2) => record7(v) && Object.keys(v).sort().join(",") === keys2.sort().join(","), date4 = (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) => createHash7("sha256").update(bytes).digest("hex");
|
|
74892
|
+
var init_remote_private_publications = __esm(() => {
|
|
74893
|
+
init_fleet_credentials();
|
|
74894
|
+
init_remote_workspace_selection();
|
|
74895
|
+
init_skill_contract();
|
|
74896
|
+
PRIVATE_PUBLICATION_MAX_BYTES = 16 * 1024 * 1024;
|
|
74897
|
+
failures = {
|
|
74898
|
+
INVALID_REQUEST: [400, "The publication request is invalid."],
|
|
74899
|
+
SESSION_EXPIRED: [401, "Sign in again to manage this publication."],
|
|
74900
|
+
ACCOUNT_UNAVAILABLE: [403, "The account is unavailable."],
|
|
74901
|
+
INTERACTIVE_SESSION_REQUIRED: [403, "An interactive account session is required."],
|
|
74902
|
+
PUBLICATION_FORBIDDEN: [403, "This session cannot manage the publication."],
|
|
74903
|
+
PUBLICATION_ENTITLEMENT_REQUIRED: [403, "The workspace is not entitled to publish private skills."],
|
|
74904
|
+
PUBLICATION_UNAVAILABLE: [404, "The publication is unavailable to this session."],
|
|
74905
|
+
MANIFEST_NAME_MISMATCH: [409, "The manifest name does not match the selected skill."],
|
|
74906
|
+
IDEMPOTENCY_CONFLICT: [409, "This request key already identifies different publication bytes. Use the saved recovery directory."],
|
|
74907
|
+
CURRENT_VERSION_CHANGED: [409, "The current version changed. Inspect it before explicitly starting another publication."],
|
|
74908
|
+
VERSION_EXISTS: [409, "This version already exists."],
|
|
74909
|
+
VERSION_RESERVED: [409, "This version is reserved by another publication."],
|
|
74910
|
+
PUBLICATION_COMMITTED: [409, "The publication is already committed."],
|
|
74911
|
+
PUBLICATION_UPLOAD_UNAVAILABLE: [409, "This publication cannot receive another upload."],
|
|
74912
|
+
PUBLICATION_LIMIT: [429, "The workspace publication limit has been reached."],
|
|
74913
|
+
PUBLICATION_BUSY: [503, "The publication is busy. Reconcile the saved intent before retrying."],
|
|
74914
|
+
PUBLICATION_UNCERTAIN: [503, "The publication outcome is uncertain. Reconcile the saved intent."],
|
|
74915
|
+
PUBLICATION_CAPABILITY_UNAVAILABLE: [503, "Private publishing is not enabled on this server."],
|
|
74916
|
+
PUBLICATION_SIGNING_UNAVAILABLE: [503, "Upload authorization is temporarily unavailable. Keep the same intent."]
|
|
74917
|
+
};
|
|
74918
|
+
PrivatePublicationError = class PrivatePublicationError extends Error {
|
|
74919
|
+
code;
|
|
74920
|
+
uncertain;
|
|
74921
|
+
status;
|
|
74922
|
+
constructor(code, message, uncertain = false, status) {
|
|
74923
|
+
super(message);
|
|
74924
|
+
this.code = code;
|
|
74925
|
+
this.uncertain = uncertain;
|
|
74926
|
+
this.status = status;
|
|
74927
|
+
this.name = "PrivatePublicationError";
|
|
74928
|
+
}
|
|
74929
|
+
};
|
|
74930
|
+
});
|
|
74931
|
+
|
|
74066
74932
|
// src/lib/remote-auth.ts
|
|
74067
74933
|
async function requestAuthApi(instance, path, options) {
|
|
74068
74934
|
const url = normalizeSkillsApiOrigin(instance);
|
|
74069
74935
|
const safeUrl = url;
|
|
74070
|
-
const
|
|
74936
|
+
const requestUrl = skillsApiRequestUrl(url, path);
|
|
74937
|
+
const endpoint = `${(options?.method || "GET").toUpperCase()} ${requestUrl}`;
|
|
74071
74938
|
let res;
|
|
74072
74939
|
try {
|
|
74073
|
-
res = await fetch(
|
|
74940
|
+
res = await fetch(requestUrl, {
|
|
74074
74941
|
...options,
|
|
74075
74942
|
redirect: "error",
|
|
74076
74943
|
signal: options?.signal ?? AbortSignal.timeout(15000),
|
|
@@ -74085,10 +74952,10 @@ async function requestAuthApi(instance, path, options) {
|
|
|
74085
74952
|
const text2 = await res.text();
|
|
74086
74953
|
const body = text2 ? parseJsonBody(text2) : {};
|
|
74087
74954
|
if (!res.ok) {
|
|
74088
|
-
const
|
|
74089
|
-
const detail = typeof
|
|
74090
|
-
const error2 = typeof
|
|
74091
|
-
const code = typeof
|
|
74955
|
+
const record8 = isRecord5(body) ? body : {};
|
|
74956
|
+
const detail = typeof record8.detail === "string" ? record8.detail : undefined;
|
|
74957
|
+
const error2 = typeof record8.error === "string" ? record8.error : undefined;
|
|
74958
|
+
const code = typeof record8.code === "string" ? record8.code : undefined;
|
|
74092
74959
|
throw new HostedApiError(detail || error2 || `${res.status} ${res.statusText}`, {
|
|
74093
74960
|
status: res.status,
|
|
74094
74961
|
code,
|
|
@@ -74122,6 +74989,10 @@ class RemoteSkillsAuthClient {
|
|
|
74122
74989
|
constructor(apiUrl) {
|
|
74123
74990
|
this.apiOrigin = normalizeSkillsApiOrigin(apiUrl);
|
|
74124
74991
|
}
|
|
74992
|
+
async openPrivatePublications(email3, code, context) {
|
|
74993
|
+
const origin = this.apiOrigin, captured = workspaceContext(context);
|
|
74994
|
+
return new RemotePrivatePublicationsClient(origin, await this.switchWorkspace(email3, code, captured));
|
|
74995
|
+
}
|
|
74125
74996
|
requestInvitationEmailChallenge(input) {
|
|
74126
74997
|
return requestInvitationEmail(this.apiOrigin, "challenge", input);
|
|
74127
74998
|
}
|
|
@@ -74169,9 +75040,10 @@ class RemoteSkillsAuthClient {
|
|
|
74169
75040
|
const apiOrigin = this.apiOrigin;
|
|
74170
75041
|
if (typeof email3 !== "string" || !email3.includes("@") || typeof code !== "string" || !/^\d{6}$/.test(code))
|
|
74171
75042
|
throw new Error("Fresh email and six-digit verification code are required to manage this account");
|
|
75043
|
+
const requestUrl = skillsApiRequestUrl(apiOrigin, "/api/auth/verify");
|
|
74172
75044
|
let response;
|
|
74173
75045
|
try {
|
|
74174
|
-
response = await fetch(
|
|
75046
|
+
response = await fetch(requestUrl, {
|
|
74175
75047
|
method: "POST",
|
|
74176
75048
|
redirect: "error",
|
|
74177
75049
|
credentials: "omit",
|
|
@@ -74265,6 +75137,7 @@ class RemoteSkillsAuthClient {
|
|
|
74265
75137
|
var MAX_ERROR_DETAIL_LENGTH = 200, HostedApiError;
|
|
74266
75138
|
var init_remote_auth = __esm(() => {
|
|
74267
75139
|
init_remote_invitation_recovery();
|
|
75140
|
+
init_remote_private_publications();
|
|
74268
75141
|
init_remote_invitations();
|
|
74269
75142
|
init_remote_workspace_leave();
|
|
74270
75143
|
init_remote_workspace_selection();
|
|
@@ -74292,11 +75165,11 @@ var init_remote_auth = __esm(() => {
|
|
|
74292
75165
|
});
|
|
74293
75166
|
|
|
74294
75167
|
// src/lib/workspace-profile.ts
|
|
74295
|
-
import { constants as
|
|
75168
|
+
import { constants as constants5, closeSync as closeSync5, fstatSync as fstatSync5, lstatSync as lstatSync7, mkdirSync as mkdirSync14, mkdtempSync as mkdtempSync4, openSync as openSync5, readFileSync as readFileSync25, renameSync as renameSync6, rmSync as rmSync7, writeFileSync as writeFileSync14 } from "fs";
|
|
74296
75169
|
import { dirname as dirname10, join as join32 } from "path";
|
|
74297
75170
|
function stat(path) {
|
|
74298
75171
|
try {
|
|
74299
|
-
return
|
|
75172
|
+
return lstatSync7(path);
|
|
74300
75173
|
} catch (error2) {
|
|
74301
75174
|
if (error2.code === "ENOENT")
|
|
74302
75175
|
return null;
|
|
@@ -74306,14 +75179,14 @@ function stat(path) {
|
|
|
74306
75179
|
function safeText(file) {
|
|
74307
75180
|
if (stat(file) === null)
|
|
74308
75181
|
return null;
|
|
74309
|
-
const fd =
|
|
75182
|
+
const fd = openSync5(file, constants5.O_RDONLY | constants5.O_NOFOLLOW | constants5.O_NONBLOCK);
|
|
74310
75183
|
try {
|
|
74311
|
-
const s =
|
|
75184
|
+
const s = fstatSync5(fd);
|
|
74312
75185
|
if (!s.isFile() || s.size > 65536 || ![256, 384].includes(s.mode & 4095) || process.getuid && s.uid !== process.getuid())
|
|
74313
75186
|
return fail2("The selected profile must use bounded owner-only regular files.");
|
|
74314
75187
|
return readFileSync25(fd, "utf8");
|
|
74315
75188
|
} finally {
|
|
74316
|
-
|
|
75189
|
+
closeSync5(fd);
|
|
74317
75190
|
}
|
|
74318
75191
|
}
|
|
74319
75192
|
function checkIdentityMetadata(file, identity2) {
|
|
@@ -74603,9 +75476,325 @@ var init_remote_invitation_tools = __esm(() => {
|
|
|
74603
75476
|
init_helpers();
|
|
74604
75477
|
});
|
|
74605
75478
|
|
|
75479
|
+
// src/lib/private-publication-customer.ts
|
|
75480
|
+
async function privatePublicationSession(email3, code, requested) {
|
|
75481
|
+
const target = await captureProfileWorkspace("Manage private publications");
|
|
75482
|
+
const context = requested ?? target.context;
|
|
75483
|
+
if (!context || !publicationUuid(context.userId) || !publicationUuid(context.membershipId) || target.context && (context.userId !== target.context.userId || context.membershipId !== target.context.membershipId))
|
|
75484
|
+
throw new PrivatePublicationError("PUBLICATION_CONTEXT_REQUIRED", "Provide the observed user and membership IDs, or select an enrolled workspace profile.");
|
|
75485
|
+
target.unchanged();
|
|
75486
|
+
const client = await new RemoteSkillsAuthClient(target.origin).openPrivatePublications(email3, code, context);
|
|
75487
|
+
target.unchanged();
|
|
75488
|
+
return client;
|
|
75489
|
+
}
|
|
75490
|
+
function privatePublicationCustomerError(error2) {
|
|
75491
|
+
return error2 instanceof PrivatePublicationError ? { error: error2.message, code: error2.code, uncertain: error2.uncertain } : { error: "The publication action could not be confirmed. Preserve the recovery directory and inspect the same intent; credentials were not changed.", code: "PUBLICATION_ACTION_UNCONFIRMED", uncertain: true };
|
|
75492
|
+
}
|
|
75493
|
+
var init_private_publication_customer = __esm(() => {
|
|
75494
|
+
init_remote_auth();
|
|
75495
|
+
init_remote_private_publications();
|
|
75496
|
+
init_workspace_profile();
|
|
75497
|
+
});
|
|
75498
|
+
|
|
75499
|
+
// src/lib/private-publication-recovery.ts
|
|
75500
|
+
import { constants as constants6, closeSync as closeSync6, fsyncSync, fstatSync as fstatSync6, lstatSync as lstatSync8, mkdirSync as mkdirSync15, openSync as openSync6, readSync as readSync3, realpathSync as realpathSync2, renameSync as renameSync7, unlinkSync as unlinkSync2, writeFileSync as writeFileSync15 } from "fs";
|
|
75501
|
+
import { dirname as dirname11, isAbsolute as isAbsolute4, join as join33, resolve as resolve3 } from "path";
|
|
75502
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
75503
|
+
function safeDirectory(directory) {
|
|
75504
|
+
if (!isAbsolute4(directory) || directory !== resolve3(directory) || realpathSync2(directory) !== directory)
|
|
75505
|
+
return fail3();
|
|
75506
|
+
for (let path = directory;; path = dirname11(path)) {
|
|
75507
|
+
const stat2 = lstatSync8(path);
|
|
75508
|
+
if (!stat2.isDirectory() || stat2.isSymbolicLink())
|
|
75509
|
+
return fail3();
|
|
75510
|
+
if (path === dirname11(path))
|
|
75511
|
+
break;
|
|
75512
|
+
}
|
|
75513
|
+
const own = lstatSync8(directory);
|
|
75514
|
+
if ((own.mode & 63) !== 0 || process.getuid && own.uid !== process.getuid())
|
|
75515
|
+
return fail3();
|
|
75516
|
+
return { dev: own.dev, ino: own.ino };
|
|
75517
|
+
}
|
|
75518
|
+
function unchangedDirectory(directory, identity2) {
|
|
75519
|
+
const now3 = safeDirectory(directory);
|
|
75520
|
+
if (now3.dev !== identity2.dev || now3.ino !== identity2.ino)
|
|
75521
|
+
return fail3();
|
|
75522
|
+
}
|
|
75523
|
+
function readOwned(directory, name, max2) {
|
|
75524
|
+
const identity2 = safeDirectory(directory), file = join33(directory, name);
|
|
75525
|
+
const fd = openSync6(file, constants6.O_RDONLY | constants6.O_NOFOLLOW);
|
|
75526
|
+
try {
|
|
75527
|
+
const stat2 = fstatSync6(fd);
|
|
75528
|
+
if (!stat2.isFile() || stat2.nlink !== 1 || stat2.size > max2 || stat2.size < 1 || (stat2.mode & 63) !== 0 || process.getuid && stat2.uid !== process.getuid())
|
|
75529
|
+
return fail3();
|
|
75530
|
+
const buffer = Buffer.alloc(Math.min(max2, stat2.size) + 1);
|
|
75531
|
+
let length = 0;
|
|
75532
|
+
while (length < buffer.length) {
|
|
75533
|
+
const count = readSync3(fd, buffer, length, buffer.length - length, length);
|
|
75534
|
+
if (count === 0)
|
|
75535
|
+
break;
|
|
75536
|
+
length += count;
|
|
75537
|
+
}
|
|
75538
|
+
const bytes = buffer.subarray(0, length), after2 = fstatSync6(fd);
|
|
75539
|
+
unchangedDirectory(directory, identity2);
|
|
75540
|
+
if (bytes.length !== stat2.size || stat2.size !== after2.size || stat2.mtimeMs !== after2.mtimeMs || stat2.ctimeMs !== after2.ctimeMs)
|
|
75541
|
+
return fail3();
|
|
75542
|
+
return bytes;
|
|
75543
|
+
} finally {
|
|
75544
|
+
closeSync6(fd);
|
|
75545
|
+
}
|
|
75546
|
+
}
|
|
75547
|
+
function writeOwned(directory, name, bytes) {
|
|
75548
|
+
const fd = openSync6(join33(directory, name), constants6.O_WRONLY | constants6.O_CREAT | constants6.O_EXCL | constants6.O_NOFOLLOW, 384);
|
|
75549
|
+
try {
|
|
75550
|
+
writeFileSync15(fd, bytes);
|
|
75551
|
+
fsyncSync(fd);
|
|
75552
|
+
} finally {
|
|
75553
|
+
closeSync6(fd);
|
|
75554
|
+
}
|
|
75555
|
+
}
|
|
75556
|
+
function save(directory, value) {
|
|
75557
|
+
const identity2 = safeDirectory(directory), temporary = `.receipt-${randomUUID3()}.json`;
|
|
75558
|
+
writeOwned(directory, temporary, JSON.stringify(value) + `
|
|
75559
|
+
`);
|
|
75560
|
+
unchangedDirectory(directory, identity2);
|
|
75561
|
+
renameSync7(join33(directory, temporary), join33(directory, "receipt.json"));
|
|
75562
|
+
const fd = openSync6(directory, constants6.O_RDONLY | constants6.O_NOFOLLOW);
|
|
75563
|
+
try {
|
|
75564
|
+
fsyncSync(fd);
|
|
75565
|
+
} finally {
|
|
75566
|
+
closeSync6(fd);
|
|
75567
|
+
}
|
|
75568
|
+
}
|
|
75569
|
+
function bind2(client, receipt) {
|
|
75570
|
+
if (["apiOrigin", "organizationId", "userId", "membershipId"].some((k) => client[k] !== receipt[k]))
|
|
75571
|
+
throw new PrivatePublicationError("PUBLICATION_IDENTITY_CHANGED", "The fresh session does not match the recovery directory's server, account and membership.");
|
|
75572
|
+
}
|
|
75573
|
+
async function locked(directory, action) {
|
|
75574
|
+
const identity2 = safeDirectory(directory), file = join33(directory, "operation.lock");
|
|
75575
|
+
let fd;
|
|
75576
|
+
try {
|
|
75577
|
+
fd = openSync6(file, constants6.O_WRONLY | constants6.O_CREAT | constants6.O_EXCL | constants6.O_NOFOLLOW, 384);
|
|
75578
|
+
} catch {
|
|
75579
|
+
throw new PrivatePublicationError("PUBLICATION_RECOVERY_BUSY", "Another operation holds this recovery directory. If it crashed, confirm that process has stopped before explicitly removing operation.lock and resuming.");
|
|
75580
|
+
}
|
|
75581
|
+
const lock = fstatSync6(fd);
|
|
75582
|
+
try {
|
|
75583
|
+
writeFileSync15(fd, JSON.stringify({ pid: process.pid }) + `
|
|
75584
|
+
`);
|
|
75585
|
+
fsyncSync(fd);
|
|
75586
|
+
return await action();
|
|
75587
|
+
} finally {
|
|
75588
|
+
closeSync6(fd);
|
|
75589
|
+
unchangedDirectory(directory, identity2);
|
|
75590
|
+
const now3 = lstatSync8(file);
|
|
75591
|
+
if (now3.dev !== lock.dev || now3.ino !== lock.ino || !now3.isFile() || now3.isSymbolicLink())
|
|
75592
|
+
fail3();
|
|
75593
|
+
unlinkSync2(file);
|
|
75594
|
+
}
|
|
75595
|
+
}
|
|
75596
|
+
function readPrivatePublicationRecovery(directory) {
|
|
75597
|
+
try {
|
|
75598
|
+
const value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(readOwned(directory, "receipt.json", 65536)));
|
|
75599
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || Object.keys(value).sort().join(",") !== ["contractVersion", "apiOrigin", "organizationId", "userId", "membershipId", "skillId", "declaration", "phase", "intent"].sort().join(",") || value.contractVersion !== 1 || ![value.organizationId, value.userId, value.membershipId, value.skillId].every(publicationUuid) || typeof value.apiOrigin !== "string" || normalizeSkillsApiOrigin(value.apiOrigin) !== value.apiOrigin || !["prepared", "begin_uncertain", "awaiting_upload", "upload_uncertain", "uploaded", "finalize_uncertain", "observed"].includes(value.phase))
|
|
75600
|
+
return fail3();
|
|
75601
|
+
value.declaration = checkedPublicationDeclaration(value.declaration);
|
|
75602
|
+
if (value.intent !== null)
|
|
75603
|
+
value.intent = checkedPublicationView(value.intent, value.skillId, undefined, value.declaration);
|
|
75604
|
+
if (value.intent === null && !["prepared", "begin_uncertain"].includes(value.phase))
|
|
75605
|
+
return fail3();
|
|
75606
|
+
const bytes = readOwned(directory, "bundle.tgz", PRIVATE_PUBLICATION_MAX_BYTES);
|
|
75607
|
+
if (bytes.length !== value.declaration.archiveByteSize || publicationSha256(bytes) !== value.declaration.archiveSha256)
|
|
75608
|
+
return fail3();
|
|
75609
|
+
return { receipt: value, bytes };
|
|
75610
|
+
} catch {
|
|
75611
|
+
return fail3();
|
|
75612
|
+
}
|
|
75613
|
+
}
|
|
75614
|
+
async function preparePrivatePublication(client, sourceDirectory, recoveryDirectory, input) {
|
|
75615
|
+
if (!publicationUuid(input.skillId) || !(input.expectedCurrentVersionId === null || publicationUuid(input.expectedCurrentVersionId)) || input.idempotencyKey !== undefined && !publicationUuid(input.idempotencyKey))
|
|
75616
|
+
return fail3();
|
|
75617
|
+
const packed = packSkillBundle(sourceDirectory, { maxUnpackedBytes: 32 * 1024 * 1024 });
|
|
75618
|
+
const inspected = await inspectSkillBundle(packed.bytes, { limits: { compressedBytes: PRIVATE_PUBLICATION_MAX_BYTES } });
|
|
75619
|
+
const manifest = inspected.entries.find((entry) => entry.path === "skill.json");
|
|
75620
|
+
if (!manifest || manifest.bytes.length > 16384 || !(await verifyContentHashFromEntries(inspected.entries)).valid)
|
|
75621
|
+
throw new PrivatePublicationError("PUBLICATION_BUNDLE_INVALID", "The skill must have a valid skill.json with its current content hash. Validate the skill before publishing.");
|
|
75622
|
+
const manifestText = new TextDecoder("utf-8", { fatal: true }).decode(manifest.bytes);
|
|
75623
|
+
const declaration = checkedPublicationDeclaration({
|
|
75624
|
+
idempotencyKey: input.idempotencyKey ?? randomUUID3(),
|
|
75625
|
+
version: JSON.parse(manifestText).version,
|
|
75626
|
+
expectedCurrentVersionId: input.expectedCurrentVersionId,
|
|
75627
|
+
manifestText,
|
|
75628
|
+
archiveSha256: inspected.sha256,
|
|
75629
|
+
archiveByteSize: packed.bytes.length
|
|
75630
|
+
});
|
|
75631
|
+
const receipt = {
|
|
75632
|
+
contractVersion: 1,
|
|
75633
|
+
apiOrigin: client.apiOrigin,
|
|
75634
|
+
organizationId: client.organizationId,
|
|
75635
|
+
userId: client.userId,
|
|
75636
|
+
membershipId: client.membershipId,
|
|
75637
|
+
skillId: input.skillId,
|
|
75638
|
+
declaration,
|
|
75639
|
+
phase: "prepared",
|
|
75640
|
+
intent: null
|
|
75641
|
+
};
|
|
75642
|
+
if (!isAbsolute4(recoveryDirectory) || resolve3(recoveryDirectory) !== recoveryDirectory || realpathSync2(dirname11(recoveryDirectory)) !== dirname11(recoveryDirectory))
|
|
75643
|
+
return fail3();
|
|
75644
|
+
mkdirSync15(recoveryDirectory, { mode: 448 });
|
|
75645
|
+
safeDirectory(recoveryDirectory);
|
|
75646
|
+
const parent = openSync6(dirname11(recoveryDirectory), constants6.O_RDONLY | constants6.O_NOFOLLOW);
|
|
75647
|
+
try {
|
|
75648
|
+
fsyncSync(parent);
|
|
75649
|
+
} finally {
|
|
75650
|
+
closeSync6(parent);
|
|
75651
|
+
}
|
|
75652
|
+
writeOwned(recoveryDirectory, "bundle.tgz", packed.bytes);
|
|
75653
|
+
save(recoveryDirectory, receipt);
|
|
75654
|
+
return receipt;
|
|
75655
|
+
}
|
|
75656
|
+
function privatePublicationResult(directory, receipt) {
|
|
75657
|
+
const state = receipt.intent?.state ?? receipt.phase, committed = state === "committed";
|
|
75658
|
+
const nextAction = committed ? "The version is published. Private execution remains unavailable." : ["rejected", "cancelled", "expired"].includes(state) ? "This intent is terminal. Inspect the result before explicitly preparing another version." : state === "needs_attention" ? "Keep this intent and contact the service operator; do not create a replacement or upload again." : receipt.phase === "upload_uncertain" ? "Run publication resume with this recovery directory to finalize the same intent without another upload." : receipt.intent ? "Run publication status or resume with this recovery directory; cancel explicitly if you want to stop." : "Run publication resume with this recovery directory to reconcile the identical request key and declaration.";
|
|
75659
|
+
return {
|
|
75660
|
+
recoveryDirectory: directory,
|
|
75661
|
+
skillId: receipt.skillId,
|
|
75662
|
+
intentId: receipt.intent?.id ?? null,
|
|
75663
|
+
state,
|
|
75664
|
+
versionId: receipt.intent?.versionId ?? null,
|
|
75665
|
+
committed,
|
|
75666
|
+
executionEnabled: false,
|
|
75667
|
+
nextAction
|
|
75668
|
+
};
|
|
75669
|
+
}
|
|
75670
|
+
async function continuePrivatePublication(client, directory, options) {
|
|
75671
|
+
if (options.confirm !== true)
|
|
75672
|
+
throw new PrivatePublicationError("PUBLICATION_CONFIRM_REQUIRED", "Explicit upload confirmation is required.");
|
|
75673
|
+
if (options.waitMs !== undefined && (!Number.isSafeInteger(options.waitMs) || options.waitMs < 0 || options.waitMs > 300000))
|
|
75674
|
+
return fail3();
|
|
75675
|
+
return locked(directory, () => continueLocked(client, directory, options));
|
|
75676
|
+
}
|
|
75677
|
+
async function continueLocked(client, directory, options) {
|
|
75678
|
+
const { receipt, bytes } = readPrivatePublicationRecovery(directory);
|
|
75679
|
+
bind2(client, receipt);
|
|
75680
|
+
if (!receipt.intent) {
|
|
75681
|
+
receipt.phase = "begin_uncertain";
|
|
75682
|
+
save(directory, receipt);
|
|
75683
|
+
receipt.intent = await client.begin(receipt.skillId, receipt.declaration);
|
|
75684
|
+
receipt.phase = "awaiting_upload";
|
|
75685
|
+
save(directory, receipt);
|
|
75686
|
+
} else {
|
|
75687
|
+
receipt.intent = checkedPublicationView(await client.get(receipt.skillId, receipt.intent.id), receipt.skillId, receipt.intent.id, receipt.declaration);
|
|
75688
|
+
save(directory, receipt);
|
|
75689
|
+
}
|
|
75690
|
+
if (receipt.intent.state === "awaiting_upload") {
|
|
75691
|
+
if (receipt.phase === "awaiting_upload") {
|
|
75692
|
+
receipt.phase = "upload_uncertain";
|
|
75693
|
+
save(directory, receipt);
|
|
75694
|
+
try {
|
|
75695
|
+
await client.upload(receipt.skillId, receipt.intent, bytes);
|
|
75696
|
+
} catch (error2) {
|
|
75697
|
+
if (error2 instanceof PrivatePublicationError && !error2.uncertain) {
|
|
75698
|
+
receipt.phase = "awaiting_upload";
|
|
75699
|
+
save(directory, receipt);
|
|
75700
|
+
}
|
|
75701
|
+
throw error2;
|
|
75702
|
+
}
|
|
75703
|
+
receipt.phase = "uploaded";
|
|
75704
|
+
save(directory, receipt);
|
|
75705
|
+
}
|
|
75706
|
+
receipt.phase = "finalize_uncertain";
|
|
75707
|
+
save(directory, receipt);
|
|
75708
|
+
receipt.intent = checkedPublicationView(await client.finalize(receipt.skillId, receipt.intent.id), receipt.skillId, receipt.intent.id, receipt.declaration);
|
|
75709
|
+
receipt.phase = "observed";
|
|
75710
|
+
save(directory, receipt);
|
|
75711
|
+
}
|
|
75712
|
+
if (options.waitMs !== undefined && options.waitMs > 0 && ["queued", "verifying"].includes(receipt.intent.state)) {
|
|
75713
|
+
receipt.intent = checkedPublicationView(await client.wait(receipt.skillId, receipt.intent.id, { timeoutMs: options.waitMs }), receipt.skillId, receipt.intent.id, receipt.declaration);
|
|
75714
|
+
receipt.phase = "observed";
|
|
75715
|
+
save(directory, receipt);
|
|
75716
|
+
}
|
|
75717
|
+
return privatePublicationResult(directory, receipt);
|
|
75718
|
+
}
|
|
75719
|
+
async function inspectPrivatePublication(client, directory, cancel = false) {
|
|
75720
|
+
return locked(directory, () => inspectLocked(client, directory, cancel));
|
|
75721
|
+
}
|
|
75722
|
+
async function inspectLocked(client, directory, cancel) {
|
|
75723
|
+
const { receipt } = readPrivatePublicationRecovery(directory);
|
|
75724
|
+
bind2(client, receipt);
|
|
75725
|
+
if (receipt.intent) {
|
|
75726
|
+
receipt.intent = checkedPublicationView(await (cancel ? client.cancel(receipt.skillId, receipt.intent.id) : client.get(receipt.skillId, receipt.intent.id)), receipt.skillId, receipt.intent.id, receipt.declaration);
|
|
75727
|
+
save(directory, receipt);
|
|
75728
|
+
} else if (cancel)
|
|
75729
|
+
throw new PrivatePublicationError("PUBLICATION_INTENT_UNKNOWN", "Reconcile the saved begin request with publication resume before cancelling its intent.");
|
|
75730
|
+
return privatePublicationResult(directory, receipt);
|
|
75731
|
+
}
|
|
75732
|
+
var fail3 = () => {
|
|
75733
|
+
throw new PrivatePublicationError("PUBLICATION_RECOVERY_INVALID", "The recovery directory is invalid or changed. Preserve it and inspect the existing intent; do not start a replacement automatically.");
|
|
75734
|
+
};
|
|
75735
|
+
var init_private_publication_recovery = __esm(() => {
|
|
75736
|
+
init_skill_bundle();
|
|
75737
|
+
init_skill_hash();
|
|
75738
|
+
init_remote_private_publications();
|
|
75739
|
+
init_fleet_credentials();
|
|
75740
|
+
});
|
|
75741
|
+
|
|
75742
|
+
// src/mcp/private-publication-tools.ts
|
|
75743
|
+
import { isAbsolute as isAbsolute5 } from "path";
|
|
75744
|
+
function registerPrivatePublicationTools(server) {
|
|
75745
|
+
const uuid6 = exports_external.string().regex(/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/);
|
|
75746
|
+
const directory = exports_external.string().max(4096).refine(isAbsolute5, "Use an absolute local directory");
|
|
75747
|
+
const verification = { email: exports_external.string().email().max(254), code: exports_external.string().regex(/^\d{6}$/), userId: uuid6, membershipId: uuid6, recoveryDirectory: directory };
|
|
75748
|
+
const description = "Manage a private source publication using fresh workspace-bound verification and a host-local recovery directory. Publishing requires explicit UUID current-version comparison and upload consent. Resume reuses immutable saved bytes and intent; an uncertain PUT is finalized for server verification, never uploaded twice. Sessions and signed URLs are not returned or persisted. Private execution is unavailable. Host request history may contain the supplied verification code.";
|
|
75749
|
+
const handler = (action) => async (value) => {
|
|
75750
|
+
try {
|
|
75751
|
+
const client = await privatePublicationSession(String(value.email), String(value.code), { userId: String(value.userId), membershipId: String(value.membershipId) });
|
|
75752
|
+
const recovery = String(value.recoveryDirectory);
|
|
75753
|
+
if (action === "publish")
|
|
75754
|
+
await preparePrivatePublication(client, String(value.directory), recovery, { skillId: String(value.skillId), expectedCurrentVersionId: value.expectedCurrentVersionId, idempotencyKey: value.idempotencyKey });
|
|
75755
|
+
const result2 = action === "publish" || action === "resume" ? await continuePrivatePublication(client, recovery, { confirm: true, waitMs: value.waitMs }) : await inspectPrivatePublication(client, recovery, action === "cancel");
|
|
75756
|
+
return mcpJson(result2);
|
|
75757
|
+
} catch (error2) {
|
|
75758
|
+
const result2 = privatePublicationCustomerError(error2);
|
|
75759
|
+
return mcpError(result2.code, result2.error);
|
|
75760
|
+
}
|
|
75761
|
+
};
|
|
75762
|
+
server.registerTool("publish_private_skill", {
|
|
75763
|
+
title: "Publish private skill",
|
|
75764
|
+
description,
|
|
75765
|
+
annotations: { destructiveHint: true, readOnlyHint: false, idempotentHint: false },
|
|
75766
|
+
inputSchema: exports_external.object({ ...verification, directory, skillId: uuid6, expectedCurrentVersionId: uuid6.nullable(), idempotencyKey: uuid6.optional(), confirm: exports_external.literal(true), waitMs: exports_external.number().int().min(0).max(300000).optional() }).strict()
|
|
75767
|
+
}, handler("publish"));
|
|
75768
|
+
server.registerTool("get_private_publication", {
|
|
75769
|
+
title: "Get private publication",
|
|
75770
|
+
description,
|
|
75771
|
+
annotations: { destructiveHint: false, readOnlyHint: true, idempotentHint: true },
|
|
75772
|
+
inputSchema: exports_external.object(verification).strict()
|
|
75773
|
+
}, handler("get"));
|
|
75774
|
+
server.registerTool("resume_private_publication", {
|
|
75775
|
+
title: "Resume private publication",
|
|
75776
|
+
description,
|
|
75777
|
+
annotations: { destructiveHint: true, readOnlyHint: false, idempotentHint: true },
|
|
75778
|
+
inputSchema: exports_external.object({ ...verification, confirm: exports_external.literal(true), waitMs: exports_external.number().int().min(0).max(300000).optional() }).strict()
|
|
75779
|
+
}, handler("resume"));
|
|
75780
|
+
server.registerTool("cancel_private_publication", {
|
|
75781
|
+
title: "Cancel private publication",
|
|
75782
|
+
description,
|
|
75783
|
+
annotations: { destructiveHint: true, readOnlyHint: false, idempotentHint: true },
|
|
75784
|
+
inputSchema: exports_external.object({ ...verification, confirm: exports_external.literal(true) }).strict()
|
|
75785
|
+
}, handler("cancel"));
|
|
75786
|
+
}
|
|
75787
|
+
var init_private_publication_tools = __esm(() => {
|
|
75788
|
+
init_zod();
|
|
75789
|
+
init_private_publication_customer();
|
|
75790
|
+
init_private_publication_recovery();
|
|
75791
|
+
init_helpers();
|
|
75792
|
+
});
|
|
75793
|
+
|
|
74606
75794
|
// src/mcp/remote-customer-tools.ts
|
|
74607
75795
|
function registerRemoteCustomerTools(server) {
|
|
74608
75796
|
registerRemoteInvitationTools(server);
|
|
75797
|
+
registerPrivatePublicationTools(server);
|
|
74609
75798
|
const memberRole = exports_external.enum(["owner", "admin", "member", "viewer"]);
|
|
74610
75799
|
const memberInput = {
|
|
74611
75800
|
membershipId: exports_external.string().regex(/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/),
|
|
@@ -74723,8 +75912,16 @@ function registerRemoteCustomerTools(server) {
|
|
|
74723
75912
|
server.registerTool("quote_skill", {
|
|
74724
75913
|
title: "Quote Remote Skill",
|
|
74725
75914
|
description: "Get the configured server's credit quote without submitting a run.",
|
|
74726
|
-
inputSchema: {
|
|
74727
|
-
|
|
75915
|
+
inputSchema: {
|
|
75916
|
+
name: exports_external.string(),
|
|
75917
|
+
input: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
|
|
75918
|
+
args: exports_external.array(exports_external.string()).optional(),
|
|
75919
|
+
files: exports_external.array(exports_external.object({ name: exports_external.string(), base64: exports_external.string().max(1398104), contentType: exports_external.string().optional() })).max(10).optional().describe("The same inline files to submit after approval; quoted descriptors bind their exact bytes, names and types.")
|
|
75920
|
+
}
|
|
75921
|
+
}, ({ name, input, args, files }) => callRemote((client) => {
|
|
75922
|
+
const descriptors = describeRemoteFiles(decodeRemoteFiles(files ?? []));
|
|
75923
|
+
return client.quoteRun(name, input, args, descriptors.length ? descriptors : undefined);
|
|
75924
|
+
}));
|
|
74728
75925
|
server.registerTool("download_run_artifact", {
|
|
74729
75926
|
title: "Download Verified Run Artifact",
|
|
74730
75927
|
description: "Return verified artifact bytes as base64 (at most 1 MiB); use the CLI for larger files.",
|
|
@@ -74758,6 +75955,7 @@ async function freshAccount(action, operation) {
|
|
|
74758
75955
|
}
|
|
74759
75956
|
var init_remote_customer_tools = __esm(() => {
|
|
74760
75957
|
init_remote_invitation_tools();
|
|
75958
|
+
init_private_publication_tools();
|
|
74761
75959
|
init_zod();
|
|
74762
75960
|
init_remote_auth();
|
|
74763
75961
|
init_workspace_profile();
|
|
@@ -74765,13 +75963,14 @@ var init_remote_customer_tools = __esm(() => {
|
|
|
74765
75963
|
init_remote_client();
|
|
74766
75964
|
init_remote_workspace_leave();
|
|
74767
75965
|
init_helpers();
|
|
75966
|
+
init_remote_files();
|
|
74768
75967
|
});
|
|
74769
75968
|
|
|
74770
75969
|
// src/mcp/server.ts
|
|
74771
75970
|
var exports_server = {};
|
|
74772
75971
|
__export(exports_server, {
|
|
74773
|
-
|
|
74774
|
-
|
|
75972
|
+
server: () => server,
|
|
75973
|
+
buildServer: () => buildServer
|
|
74775
75974
|
});
|
|
74776
75975
|
function buildServer() {
|
|
74777
75976
|
const server = new McpServer({
|
|
@@ -74802,8 +76001,8 @@ var init_server3 = __esm(() => {
|
|
|
74802
76001
|
// src/mcp/index.ts
|
|
74803
76002
|
var exports_mcp = {};
|
|
74804
76003
|
__export(exports_mcp, {
|
|
74805
|
-
|
|
74806
|
-
|
|
76004
|
+
startMcpStdio: () => startMcpStdio,
|
|
76005
|
+
assertSkillsMcpConfigured: () => assertSkillsMcpConfigured
|
|
74807
76006
|
});
|
|
74808
76007
|
function printHelp() {
|
|
74809
76008
|
console.log(`Usage: skills-mcp [options]
|
|
@@ -74852,9 +76051,9 @@ var init_mcp2 = __esm(() => {
|
|
|
74852
76051
|
});
|
|
74853
76052
|
|
|
74854
76053
|
// src/cli/commands/runtime-mcp.ts
|
|
74855
|
-
import { existsSync as existsSync30, mkdirSync as
|
|
76054
|
+
import { existsSync as existsSync30, mkdirSync as mkdirSync16, readFileSync as readFileSync26, writeFileSync as writeFileSync16 } from "fs";
|
|
74856
76055
|
import { homedir as homedir7 } from "os";
|
|
74857
|
-
import { dirname as
|
|
76056
|
+
import { dirname as dirname12, join as join34 } from "path";
|
|
74858
76057
|
async function handleMcp(options) {
|
|
74859
76058
|
if (options.register) {
|
|
74860
76059
|
let agents;
|
|
@@ -74897,24 +76096,24 @@ async function registerMcpForAgent(agent, command) {
|
|
|
74897
76096
|
case "codex":
|
|
74898
76097
|
return registerCodexMcp(command);
|
|
74899
76098
|
case "gemini":
|
|
74900
|
-
return registerJsonMcpServer(agent,
|
|
76099
|
+
return registerJsonMcpServer(agent, join34(homedir7(), ".gemini", "settings.json"), "mcpServers", {
|
|
74901
76100
|
command,
|
|
74902
76101
|
args: []
|
|
74903
76102
|
});
|
|
74904
76103
|
case "pi":
|
|
74905
|
-
return registerJsonMcpServer(agent,
|
|
76104
|
+
return registerJsonMcpServer(agent, join34(homedir7(), ".pi", "agent", "mcp.json"), "mcpServers", {
|
|
74906
76105
|
command,
|
|
74907
76106
|
args: []
|
|
74908
76107
|
});
|
|
74909
76108
|
case "opencode":
|
|
74910
76109
|
return registerOpenCodeMcp(command);
|
|
74911
76110
|
case "cursor":
|
|
74912
|
-
return registerJsonMcpServer(agent,
|
|
76111
|
+
return registerJsonMcpServer(agent, join34(homedir7(), ".cursor", "mcp.json"), "mcpServers", {
|
|
74913
76112
|
command,
|
|
74914
76113
|
args: []
|
|
74915
76114
|
});
|
|
74916
76115
|
case "windsurf":
|
|
74917
|
-
return registerJsonMcpServer(agent,
|
|
76116
|
+
return registerJsonMcpServer(agent, join34(homedir7(), ".windsurf", "mcp.json"), "mcpServers", {
|
|
74918
76117
|
command,
|
|
74919
76118
|
args: []
|
|
74920
76119
|
});
|
|
@@ -74937,7 +76136,7 @@ async function registerClaudeMcp(command) {
|
|
|
74937
76136
|
if (exitCode === 0) {
|
|
74938
76137
|
return { agent: "claude", success: true, command: cliCommand };
|
|
74939
76138
|
}
|
|
74940
|
-
const fallback = registerJsonMcpServer("claude",
|
|
76139
|
+
const fallback = registerJsonMcpServer("claude", join34(homedir7(), ".claude", ".mcp.json"), "mcpServers", {
|
|
74941
76140
|
command,
|
|
74942
76141
|
args: []
|
|
74943
76142
|
});
|
|
@@ -74947,7 +76146,7 @@ async function registerClaudeMcp(command) {
|
|
|
74947
76146
|
error: fallback.success ? undefined : `claude exited with ${exitCode}: ${(stderr || stdout).trim()}`
|
|
74948
76147
|
};
|
|
74949
76148
|
} catch (err) {
|
|
74950
|
-
const fallback = registerJsonMcpServer("claude",
|
|
76149
|
+
const fallback = registerJsonMcpServer("claude", join34(homedir7(), ".claude", ".mcp.json"), "mcpServers", {
|
|
74951
76150
|
command,
|
|
74952
76151
|
args: []
|
|
74953
76152
|
});
|
|
@@ -74959,7 +76158,7 @@ async function registerClaudeMcp(command) {
|
|
|
74959
76158
|
}
|
|
74960
76159
|
}
|
|
74961
76160
|
function registerCodexMcp(command) {
|
|
74962
|
-
const path =
|
|
76161
|
+
const path = join34(homedir7(), ".codex", "config.toml");
|
|
74963
76162
|
const config2 = `[mcp_servers.${MCP_SERVER_NAME}]
|
|
74964
76163
|
command = ${JSON.stringify(command)}`;
|
|
74965
76164
|
try {
|
|
@@ -74971,7 +76170,7 @@ command = ${JSON.stringify(command)}`;
|
|
|
74971
76170
|
}
|
|
74972
76171
|
}
|
|
74973
76172
|
function registerOpenCodeMcp(command) {
|
|
74974
|
-
const path =
|
|
76173
|
+
const path = join34(homedir7(), ".config", "opencode", "opencode.json");
|
|
74975
76174
|
const config2 = JSON.stringify({
|
|
74976
76175
|
$schema: "https://opencode.ai/config.json",
|
|
74977
76176
|
mcp: {
|
|
@@ -75028,8 +76227,8 @@ function writeJsonObject(path, data) {
|
|
|
75028
76227
|
`);
|
|
75029
76228
|
}
|
|
75030
76229
|
function writeTextFile(path, content) {
|
|
75031
|
-
|
|
75032
|
-
|
|
76230
|
+
mkdirSync16(dirname12(path), { recursive: true });
|
|
76231
|
+
writeFileSync16(path, content.endsWith(`
|
|
75033
76232
|
`) ? content : `${content}
|
|
75034
76233
|
`);
|
|
75035
76234
|
}
|
|
@@ -75059,7 +76258,7 @@ function findCommandOnPath(command) {
|
|
|
75059
76258
|
for (const dir of pathValue.split(":")) {
|
|
75060
76259
|
if (!dir)
|
|
75061
76260
|
continue;
|
|
75062
|
-
const candidate =
|
|
76261
|
+
const candidate = join34(dir, command);
|
|
75063
76262
|
if (existsSync30(candidate))
|
|
75064
76263
|
return candidate;
|
|
75065
76264
|
}
|
|
@@ -75077,8 +76276,8 @@ var init_runtime_mcp = __esm(() => {
|
|
|
75077
76276
|
// src/cli/commands/remote-account.ts
|
|
75078
76277
|
var exports_remote_account = {};
|
|
75079
76278
|
__export(exports_remote_account, {
|
|
75080
|
-
|
|
75081
|
-
|
|
76279
|
+
registerRemoteAccount: () => registerRemoteAccount,
|
|
76280
|
+
execute: () => execute
|
|
75082
76281
|
});
|
|
75083
76282
|
function registerRemoteAccount(parent) {
|
|
75084
76283
|
parent.command("capabilities").option("--json", "Output as JSON", false).description("Inspect the selected server's supported API contract").action((options) => execute(options, (client) => client.getCapabilities()));
|
|
@@ -75121,8 +76320,8 @@ var exports_runtime = {};
|
|
|
75121
76320
|
__export(exports_runtime, {
|
|
75122
76321
|
registerRuntime: () => registerRuntime
|
|
75123
76322
|
});
|
|
75124
|
-
import { lstatSync as
|
|
75125
|
-
import { basename as basename5, isAbsolute as
|
|
76323
|
+
import { lstatSync as lstatSync9, mkdirSync as mkdirSync17, readFileSync as readFileSync27, realpathSync as realpathSync3, writeFileSync as writeFileSync17 } from "fs";
|
|
76324
|
+
import { basename as basename5, isAbsolute as isAbsolute6, join as join35 } from "path";
|
|
75126
76325
|
import { createInterface } from "readline";
|
|
75127
76326
|
function registerRuntime(parent) {
|
|
75128
76327
|
parent.command("run").argument("<skill>", "Skill name").argument("[args...]", "Arguments to pass to the skill").allowUnknownOption(true).passThroughOptions(true).option("--json", "Output result as JSON", false).option("--remote", "Run on the configured server, using its catalog and quote", false).option("--yes", "Approve the server's quoted credit cost for this run", false).option("--idempotency-key <key>", "Reuse this key when retrying the same remote submission").option("--file <path>", "Attach a local input file to a remote run (repeatable)", (value, prior) => [...prior, value], []).option("--wait", "Poll remote runs until a terminal status", false).option("--poll-interval-ms <ms>", "Remote polling interval in milliseconds", "1000").option("--poll-timeout-ms <ms>", "Maximum time to wait for a remote run", "300000").description("Run a skill directly").action(async (name, args2, options) => handleRun(name, args2, options));
|
|
@@ -75205,14 +76404,14 @@ Updating ${name}...
|
|
|
75205
76404
|
async function readUpdatedVersion(bunExecutable) {
|
|
75206
76405
|
const output = await readUpdateCommand([bunExecutable, "pm", "bin", "-g"]);
|
|
75207
76406
|
const globalBin = output.replace(/\r?\n$/, "");
|
|
75208
|
-
if (!globalBin || !
|
|
76407
|
+
if (!globalBin || !isAbsolute6(globalBin) || /[\r\n\0]/.test(globalBin))
|
|
75209
76408
|
throw new Error("Update bin discovery failed");
|
|
75210
76409
|
const installed = Bun.which("skills", { PATH: globalBin, cwd: globalBin });
|
|
75211
76410
|
const selected = Bun.which("skills");
|
|
75212
76411
|
if (!installed || !selected)
|
|
75213
76412
|
throw new Error("Updated command is unavailable");
|
|
75214
|
-
const selectedPath =
|
|
75215
|
-
if (selectedPath !==
|
|
76413
|
+
const selectedPath = realpathSync3(selected);
|
|
76414
|
+
if (selectedPath !== realpathSync3(installed))
|
|
75216
76415
|
throw new Error("Updated command is shadowed on PATH");
|
|
75217
76416
|
const version2 = (await readUpdateCommand([selectedPath, "--version"])).trim();
|
|
75218
76417
|
if (!new RegExp(SEMVER_PATTERN).test(version2))
|
|
@@ -75341,14 +76540,14 @@ function requireHttpUrl(value) {
|
|
|
75341
76540
|
}
|
|
75342
76541
|
function promptLine(question) {
|
|
75343
76542
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
75344
|
-
return new Promise((
|
|
76543
|
+
return new Promise((resolve4) => {
|
|
75345
76544
|
let settled = false;
|
|
75346
76545
|
const finish = (answer) => {
|
|
75347
76546
|
if (settled)
|
|
75348
76547
|
return;
|
|
75349
76548
|
settled = true;
|
|
75350
76549
|
rl.close();
|
|
75351
|
-
|
|
76550
|
+
resolve4(answer);
|
|
75352
76551
|
};
|
|
75353
76552
|
rl.once("SIGINT", () => finish(null));
|
|
75354
76553
|
rl.once("close", () => finish(null));
|
|
@@ -75391,20 +76590,23 @@ async function handleRun(name, args2, options) {
|
|
|
75391
76590
|
}
|
|
75392
76591
|
let client;
|
|
75393
76592
|
let approvedCredits = 0;
|
|
76593
|
+
let quoteReceipt;
|
|
75394
76594
|
let inputFiles = [];
|
|
75395
76595
|
if (routing.route === "remote") {
|
|
75396
76596
|
try {
|
|
75397
76597
|
parsePollingOptions(options);
|
|
75398
76598
|
inputFiles = (options.file ?? []).map((path) => {
|
|
75399
|
-
const info =
|
|
76599
|
+
const info = lstatSync9(path);
|
|
75400
76600
|
if (!info.isFile() || info.size > 20 * 1024 * 1024)
|
|
75401
76601
|
throw new Error("Input must be a regular file no larger than 20 MiB");
|
|
75402
76602
|
return { name: basename5(path), bytes: new Uint8Array(readFileSync27(path)) };
|
|
75403
76603
|
});
|
|
75404
76604
|
describeRemoteFiles(inputFiles);
|
|
75405
76605
|
client = new RemoteSkillsClient(routing.apiKey, routing.apiOrigin);
|
|
75406
|
-
const
|
|
76606
|
+
const descriptors = describeRemoteFiles(inputFiles);
|
|
76607
|
+
const quote = await client.quoteRun(skill.name, {}, args2, descriptors.length ? descriptors : undefined);
|
|
75407
76608
|
approvedCredits = quote.pricing.costCents;
|
|
76609
|
+
quoteReceipt = quote.quoteReceipt;
|
|
75408
76610
|
if (approvedCredits > 0 && !options.yes) {
|
|
75409
76611
|
if (options.json || !process.stdin.isTTY || !process.stdout.isTTY) {
|
|
75410
76612
|
throw new Error(`CREDIT_APPROVAL_REQUIRED: This run costs ${approvedCredits} credits. Review skills quote, then rerun with --yes before the skill name.`);
|
|
@@ -75453,6 +76655,7 @@ async function handleRun(name, args2, options) {
|
|
|
75453
76655
|
try {
|
|
75454
76656
|
const run = await client.submitQuotedRunWithFiles(skill.name, {}, args2, inputFiles, {
|
|
75455
76657
|
maxCredits: approvedCredits,
|
|
76658
|
+
quoteReceipt,
|
|
75456
76659
|
idempotencyKey: options.idempotencyKey ?? runContext.record.id
|
|
75457
76660
|
});
|
|
75458
76661
|
if (run.error) {
|
|
@@ -75770,7 +76973,7 @@ async function handleExportsDownload(runId, options) {
|
|
|
75770
76973
|
const canonicalSkill = typeof remoteRun.skill === "string" ? remoteRun.skill : "remote";
|
|
75771
76974
|
const requestedSkill = typeof remoteRun.requestedSlug === "string" && remoteRun.requestedSlug.trim() ? remoteRun.requestedSlug : canonicalSkill;
|
|
75772
76975
|
const exportDir = getRunExportDir(runId, requestedSkill);
|
|
75773
|
-
|
|
76976
|
+
mkdirSync17(exportDir, { recursive: true });
|
|
75774
76977
|
const downloaded = [];
|
|
75775
76978
|
for (const artifact of artifacts) {
|
|
75776
76979
|
const artifactId = String(artifact.id || "");
|
|
@@ -75778,9 +76981,9 @@ async function handleExportsDownload(runId, options) {
|
|
|
75778
76981
|
continue;
|
|
75779
76982
|
const verified = await client.getVerifiedRunArtifact(runId, artifactId);
|
|
75780
76983
|
const relativePath = safeArtifactRelativePath(typeof artifact.relativePath === "string" ? artifact.relativePath : artifact.fileName, String(artifact.fileName || artifactId));
|
|
75781
|
-
const outputPath =
|
|
76984
|
+
const outputPath = join35(exportDir, relativePath);
|
|
75782
76985
|
ensureSafeExportParent(exportDir, relativePath);
|
|
75783
|
-
|
|
76986
|
+
writeFileSync17(outputPath, verified.bytes, { flag: "wx", mode: 384 });
|
|
75784
76987
|
downloaded.push({ id: artifactId, path: outputPath, byteSize: verified.byteSize });
|
|
75785
76988
|
}
|
|
75786
76989
|
const payload = {
|
|
@@ -75817,14 +77020,14 @@ function ensureSafeExportParent(root, relativePath) {
|
|
|
75817
77020
|
let parent = root;
|
|
75818
77021
|
for (const part of ["", ...parts]) {
|
|
75819
77022
|
if (part)
|
|
75820
|
-
parent =
|
|
77023
|
+
parent = join35(parent, part);
|
|
75821
77024
|
try {
|
|
75822
|
-
if (!
|
|
77025
|
+
if (!lstatSync9(parent).isDirectory() || lstatSync9(parent).isSymbolicLink())
|
|
75823
77026
|
throw new Error("Unsafe artifact directory");
|
|
75824
77027
|
} catch (error2) {
|
|
75825
77028
|
if (error2.code !== "ENOENT")
|
|
75826
77029
|
throw error2;
|
|
75827
|
-
|
|
77030
|
+
mkdirSync17(parent, { mode: 448 });
|
|
75828
77031
|
}
|
|
75829
77032
|
}
|
|
75830
77033
|
}
|
|
@@ -75852,7 +77055,7 @@ async function pollRemoteRun(client, runId, options) {
|
|
|
75852
77055
|
const remaining = deadline - Date.now();
|
|
75853
77056
|
if (remaining <= 0)
|
|
75854
77057
|
break;
|
|
75855
|
-
await new Promise((
|
|
77058
|
+
await new Promise((resolve4) => setTimeout(resolve4, Math.min(options.intervalMs, remaining)));
|
|
75856
77059
|
}
|
|
75857
77060
|
return {
|
|
75858
77061
|
run: current ?? { id: runId, status: "queued" },
|
|
@@ -76162,7 +77365,7 @@ var init_completion = __esm(() => {
|
|
|
76162
77365
|
// src/lib/portable-snapshot-filter.ts
|
|
76163
77366
|
import { readdirSync as readdirSync16, statSync as statSync17 } from "fs";
|
|
76164
77367
|
import { homedir as homedir8 } from "os";
|
|
76165
|
-
import { join as
|
|
77368
|
+
import { join as join36, sep as sep3 } from "path";
|
|
76166
77369
|
function isExcludedSkillFileName(fileName) {
|
|
76167
77370
|
if (EXCLUDE_FILE_NAMES.has(fileName)) {
|
|
76168
77371
|
return true;
|
|
@@ -76185,16 +77388,16 @@ function isPortableWithinSkill(relativeParts) {
|
|
|
76185
77388
|
function homePathFor(definition, homesRoot) {
|
|
76186
77389
|
const home = homesRoot ?? homedir8();
|
|
76187
77390
|
if (definition.subClass === "skills" || definition.subClass === "custom") {
|
|
76188
|
-
return
|
|
77391
|
+
return join36(skillsDataRootForHome(home), definition.name);
|
|
76189
77392
|
}
|
|
76190
77393
|
if (definition.agent === "opencode") {
|
|
76191
|
-
return
|
|
77394
|
+
return join36(home, ".config", "opencode", "skills");
|
|
76192
77395
|
}
|
|
76193
|
-
return
|
|
77396
|
+
return join36(home, `.${definition.agent}`, "skills");
|
|
76194
77397
|
}
|
|
76195
77398
|
function destinationFor(definition, stationId, relativePath) {
|
|
76196
|
-
const category = definition.subClass === "agent-homes" ?
|
|
76197
|
-
return
|
|
77399
|
+
const category = definition.subClass === "agent-homes" ? join36("agent-homes", definition.agent ?? "") : definition.name;
|
|
77400
|
+
return join36("resources", stationId, "skills", category, ...relativePath.split(sep3));
|
|
76198
77401
|
}
|
|
76199
77402
|
function walkEntries(absoluteRoot) {
|
|
76200
77403
|
let entries;
|
|
@@ -76205,7 +77408,7 @@ function walkEntries(absoluteRoot) {
|
|
|
76205
77408
|
}
|
|
76206
77409
|
const output = [];
|
|
76207
77410
|
for (const entry of entries) {
|
|
76208
|
-
const childFull =
|
|
77411
|
+
const childFull = join36(absoluteRoot, entry.name);
|
|
76209
77412
|
if (entry.isSymbolicLink()) {
|
|
76210
77413
|
output.push({ kind: "symlink", relativePath: entry.name, fullPath: childFull });
|
|
76211
77414
|
continue;
|
|
@@ -76216,7 +77419,7 @@ function walkEntries(absoluteRoot) {
|
|
|
76216
77419
|
}
|
|
76217
77420
|
const nested = walkEntries(childFull);
|
|
76218
77421
|
for (const item of nested) {
|
|
76219
|
-
output.push({ ...item, relativePath:
|
|
77422
|
+
output.push({ ...item, relativePath: join36(entry.name, item.relativePath) });
|
|
76220
77423
|
}
|
|
76221
77424
|
continue;
|
|
76222
77425
|
}
|
|
@@ -76309,22 +77512,22 @@ var init_portable_snapshot_filter = __esm(() => {
|
|
|
76309
77512
|
});
|
|
76310
77513
|
|
|
76311
77514
|
// src/lib/station-snapshot.ts
|
|
76312
|
-
import { createHash as
|
|
77515
|
+
import { createHash as createHash8 } from "crypto";
|
|
76313
77516
|
import {
|
|
76314
77517
|
copyFileSync as copyFileSync2,
|
|
76315
|
-
mkdirSync as
|
|
77518
|
+
mkdirSync as mkdirSync18,
|
|
76316
77519
|
readFileSync as readFileSync28,
|
|
76317
77520
|
statSync as statSync18,
|
|
76318
|
-
writeFileSync as
|
|
77521
|
+
writeFileSync as writeFileSync18
|
|
76319
77522
|
} from "fs";
|
|
76320
|
-
import { dirname as
|
|
77523
|
+
import { dirname as dirname14, isAbsolute as isAbsolute7, relative as relative5, resolve as resolve4, sep as sep4 } from "path";
|
|
76321
77524
|
function validateStationId(stationId) {
|
|
76322
77525
|
if (!/^[a-z0-9-]+$/.test(stationId)) {
|
|
76323
77526
|
throw new StationSnapshotError("INVALID_STATION", `station id must be a slug, got: ${stationId}`);
|
|
76324
77527
|
}
|
|
76325
77528
|
}
|
|
76326
77529
|
function sha256File(filePath) {
|
|
76327
|
-
return
|
|
77530
|
+
return createHash8("sha256").update(readFileSync28(filePath)).digest("hex");
|
|
76328
77531
|
}
|
|
76329
77532
|
function scanHome(definition, homesRoot) {
|
|
76330
77533
|
const homePath = homePathFor(definition, homesRoot);
|
|
@@ -76395,7 +77598,7 @@ function humanHomes(scanned) {
|
|
|
76395
77598
|
}));
|
|
76396
77599
|
}
|
|
76397
77600
|
function writeStationSnapshot(options) {
|
|
76398
|
-
const repoRoot =
|
|
77601
|
+
const repoRoot = resolve4(options.repoRoot ?? process.cwd());
|
|
76399
77602
|
const { scanned, plans, totalBytes } = planStationSnapshot(options);
|
|
76400
77603
|
const manifestFiles = plans.map((plan) => ({
|
|
76401
77604
|
relativePath: plan.source.relativePath,
|
|
@@ -76421,9 +77624,9 @@ function writeStationSnapshot(options) {
|
|
|
76421
77624
|
const conflicts = [];
|
|
76422
77625
|
const untouched = [];
|
|
76423
77626
|
for (const plan of plans) {
|
|
76424
|
-
const destination =
|
|
77627
|
+
const destination = resolve4(repoRoot, plan.destination);
|
|
76425
77628
|
const destinationRelative = relative5(repoRoot, destination);
|
|
76426
|
-
if (destinationRelative.startsWith("..") || destinationRelative.startsWith(sep4) ||
|
|
77629
|
+
if (destinationRelative.startsWith("..") || destinationRelative.startsWith(sep4) || isAbsolute7(destinationRelative)) {
|
|
76427
77630
|
throw new StationSnapshotError("DESTINATION_ESCAPE", `destination escapes repo root: ${plan.destination}`);
|
|
76428
77631
|
}
|
|
76429
77632
|
let existingDigest = null;
|
|
@@ -76444,8 +77647,8 @@ function writeStationSnapshot(options) {
|
|
|
76444
77647
|
}
|
|
76445
77648
|
let written = 0;
|
|
76446
77649
|
for (const plan of untouched) {
|
|
76447
|
-
const destination =
|
|
76448
|
-
|
|
77650
|
+
const destination = resolve4(repoRoot, plan.destination);
|
|
77651
|
+
mkdirSync18(dirname14(destination), { recursive: true });
|
|
76449
77652
|
copyFileSync2(plan.source.fullPath, destination);
|
|
76450
77653
|
written += 1;
|
|
76451
77654
|
}
|
|
@@ -76463,9 +77666,9 @@ function writeStationSnapshot(options) {
|
|
|
76463
77666
|
},
|
|
76464
77667
|
files: manifestFiles
|
|
76465
77668
|
};
|
|
76466
|
-
const manifestPath =
|
|
76467
|
-
|
|
76468
|
-
|
|
77669
|
+
const manifestPath = resolve4(repoRoot, "resources", options.stationId, "skills", "sync-manifest.json");
|
|
77670
|
+
mkdirSync18(dirname14(manifestPath), { recursive: true });
|
|
77671
|
+
writeFileSync18(manifestPath, `${JSON.stringify(manifest, null, 2)}
|
|
76469
77672
|
`);
|
|
76470
77673
|
return {
|
|
76471
77674
|
...base2,
|
|
@@ -76497,7 +77700,7 @@ __export(exports_create_sync_config, {
|
|
|
76497
77700
|
registerCreateSync: () => registerCreateSync
|
|
76498
77701
|
});
|
|
76499
77702
|
import { existsSync as existsSync31 } from "fs";
|
|
76500
|
-
import { join as
|
|
77703
|
+
import { join as join37 } from "path";
|
|
76501
77704
|
function registerCreateSync(parent) {
|
|
76502
77705
|
const configCmd = parent.command("config").description("Manage skills configuration");
|
|
76503
77706
|
configCmd.command("show", { isDefault: true }).option("--json", "Output as JSON", false).description("Show current merged configuration").action((options) => {
|
|
@@ -76603,7 +77806,7 @@ function handleCreate(name, options) {
|
|
|
76603
77806
|
console.log(source_default.green(`\u2713 Created custom skill '${result2.name}' at ${result2.path}`));
|
|
76604
77807
|
console.log(source_default.dim(` Category: ${result2.manifest.category}`));
|
|
76605
77808
|
console.log(source_default.dim(` Tags: ${result2.manifest.tags?.join(", ")}`));
|
|
76606
|
-
console.log(` ${source_default.cyan("Edit:")} ${
|
|
77809
|
+
console.log(` ${source_default.cyan("Edit:")} ${join37(result2.path, "src", "index.ts")}`);
|
|
76607
77810
|
console.log(` ${source_default.cyan("Run:")} skills run ${result2.name} --help`);
|
|
76608
77811
|
}
|
|
76609
77812
|
} catch (error2) {
|
|
@@ -76879,30 +78082,30 @@ var init_create_sync_config = __esm(() => {
|
|
|
76879
78082
|
});
|
|
76880
78083
|
|
|
76881
78084
|
// src/lib/station-hydrate.ts
|
|
76882
|
-
import { createHash as
|
|
78085
|
+
import { createHash as createHash9 } from "crypto";
|
|
76883
78086
|
import {
|
|
76884
78087
|
copyFileSync as copyFileSync3,
|
|
76885
|
-
mkdirSync as
|
|
78088
|
+
mkdirSync as mkdirSync19,
|
|
76886
78089
|
readdirSync as readdirSync17,
|
|
76887
78090
|
readFileSync as readFileSync29,
|
|
76888
78091
|
statSync as statSync19,
|
|
76889
|
-
writeFileSync as
|
|
78092
|
+
writeFileSync as writeFileSync19
|
|
76890
78093
|
} from "fs";
|
|
76891
|
-
import { dirname as
|
|
76892
|
-
function
|
|
78094
|
+
import { dirname as dirname15, join as join38, resolve as resolve5, sep as sep5 } from "path";
|
|
78095
|
+
function fail4(code, message, detail = []) {
|
|
76893
78096
|
throw new StationSnapshotError(code, message, detail);
|
|
76894
78097
|
}
|
|
76895
78098
|
function snapshotRootFor(repoRoot, stationId) {
|
|
76896
|
-
return
|
|
78099
|
+
return join38(repoRoot, "resources", stationId, "skills");
|
|
76897
78100
|
}
|
|
76898
78101
|
function readSnapshotManifest(repoRoot, stationId) {
|
|
76899
78102
|
const snapshotRoot = snapshotRootFor(repoRoot, stationId);
|
|
76900
|
-
const manifestPath =
|
|
78103
|
+
const manifestPath = join38(snapshotRoot, "sync-manifest.json");
|
|
76901
78104
|
let manifest;
|
|
76902
78105
|
try {
|
|
76903
78106
|
manifest = JSON.parse(readFileSync29(manifestPath, "utf8"));
|
|
76904
78107
|
} catch (error2) {
|
|
76905
|
-
|
|
78108
|
+
fail4("MANIFEST_UNREADABLE", `cannot read snapshot manifest: ${manifestPath}: ${error2.message}`);
|
|
76906
78109
|
}
|
|
76907
78110
|
const sourceSnapshotSha = sha256File(manifestPath);
|
|
76908
78111
|
return { manifest, manifestPath, sourceSnapshotSha };
|
|
@@ -76924,7 +78127,7 @@ function planStationHydration(stationId, repoRoot) {
|
|
|
76924
78127
|
const hashMismatches = [];
|
|
76925
78128
|
const skippedByRule = [];
|
|
76926
78129
|
for (const agent of SYNC_AGENTS) {
|
|
76927
|
-
const agentRoot =
|
|
78130
|
+
const agentRoot = join38(snapshotRoot, "agent-homes", agent);
|
|
76928
78131
|
let identEntries;
|
|
76929
78132
|
try {
|
|
76930
78133
|
identEntries = readdirSync17(agentRoot, { withFileTypes: true });
|
|
@@ -76935,7 +78138,7 @@ function planStationHydration(stationId, repoRoot) {
|
|
|
76935
78138
|
if (!identEntry.isDirectory() || identEntry.name.startsWith(".")) {
|
|
76936
78139
|
continue;
|
|
76937
78140
|
}
|
|
76938
|
-
const identRoot =
|
|
78141
|
+
const identRoot = join38(agentRoot, identEntry.name);
|
|
76939
78142
|
const entries = walkEntries(identRoot);
|
|
76940
78143
|
for (const entry of entries) {
|
|
76941
78144
|
const relativeParts = [identEntry.name, ...entry.relativePath.split(sep5)];
|
|
@@ -77009,10 +78212,10 @@ function planStationHydration(stationId, repoRoot) {
|
|
|
77009
78212
|
}
|
|
77010
78213
|
}
|
|
77011
78214
|
if (symlinks.length > 0) {
|
|
77012
|
-
|
|
78215
|
+
fail4("SYMLINKS_REFUSED", `${symlinks.length} symlink(s) inside the snapshot; symlinks are refused (fail closed)`);
|
|
77013
78216
|
}
|
|
77014
78217
|
if (hashMismatches.length > 0) {
|
|
77015
|
-
|
|
78218
|
+
fail4("MANIFEST_HASH_MISMATCH", `${hashMismatches.length} snapshot file(s) no longer match their sync-manifest sha256; ` + "stale or tampered content is refused (fail closed), nothing written \u2014 re-run sync to refresh the manifest", hashMismatches.map((mismatch) => `agent-homes/${mismatch.agent}/${mismatch.ident}/${mismatch.relativePath}`));
|
|
77016
78219
|
}
|
|
77017
78220
|
const byIdent = new Map;
|
|
77018
78221
|
for (const candidate of candidates) {
|
|
@@ -77082,12 +78285,12 @@ function skillSha256(skill) {
|
|
|
77082
78285
|
return sha256File(skill.files[0].winner.fullPath);
|
|
77083
78286
|
}
|
|
77084
78287
|
const joined = skill.files.map((file) => sha256File(file.winner.fullPath));
|
|
77085
|
-
return
|
|
78288
|
+
return createHash9("sha256").update(joined.sort().join(`
|
|
77086
78289
|
`)).digest("hex");
|
|
77087
78290
|
}
|
|
77088
78291
|
function writeStationHydration(options) {
|
|
77089
|
-
const repoRoot =
|
|
77090
|
-
const cacheRoot =
|
|
78292
|
+
const repoRoot = resolve5(options.repoRoot ?? process.cwd());
|
|
78293
|
+
const cacheRoot = resolve5(options.cacheRoot ?? resolveCorpusRoot());
|
|
77091
78294
|
const plan = planStationHydration(options.stationId, repoRoot);
|
|
77092
78295
|
const resultSkills = plan.winners.map((skill) => ({
|
|
77093
78296
|
ident: skill.ident,
|
|
@@ -77120,7 +78323,7 @@ function writeStationHydration(options) {
|
|
|
77120
78323
|
const toWrite = [];
|
|
77121
78324
|
for (const skill of plan.winners) {
|
|
77122
78325
|
for (const file of skill.files) {
|
|
77123
|
-
const destination =
|
|
78326
|
+
const destination = join38(cacheRoot, skill.ident, file.withinIdent);
|
|
77124
78327
|
const digest = sha256File(file.winner.fullPath);
|
|
77125
78328
|
let existingDigest = null;
|
|
77126
78329
|
try {
|
|
@@ -77137,11 +78340,11 @@ function writeStationHydration(options) {
|
|
|
77137
78340
|
}
|
|
77138
78341
|
}
|
|
77139
78342
|
if (conflicts.length > 0) {
|
|
77140
|
-
|
|
78343
|
+
fail4("CONFLICT", `${conflicts.length} conflict(s); terminal non-acceptance, nothing written`, conflicts);
|
|
77141
78344
|
}
|
|
77142
78345
|
let written = 0;
|
|
77143
78346
|
for (const entry of toWrite) {
|
|
77144
|
-
|
|
78347
|
+
mkdirSync19(dirname15(entry.destination), { recursive: true });
|
|
77145
78348
|
copyFileSync3(entry.fullPath, entry.destination);
|
|
77146
78349
|
written += 1;
|
|
77147
78350
|
}
|
|
@@ -77162,9 +78365,9 @@ function writeStationHydration(options) {
|
|
|
77162
78365
|
},
|
|
77163
78366
|
skills: resultSkills
|
|
77164
78367
|
};
|
|
77165
|
-
const hydrationManifestPath =
|
|
77166
|
-
|
|
77167
|
-
|
|
78368
|
+
const hydrationManifestPath = join38(dirname15(cacheRoot), `hydration-${options.stationId}.json`);
|
|
78369
|
+
mkdirSync19(dirname15(hydrationManifestPath), { recursive: true });
|
|
78370
|
+
writeFileSync19(hydrationManifestPath, `${JSON.stringify(hydration, null, 2)}
|
|
77168
78371
|
`);
|
|
77169
78372
|
return {
|
|
77170
78373
|
...base2,
|
|
@@ -77592,8 +78795,8 @@ var init_schedule = __esm(() => {
|
|
|
77592
78795
|
});
|
|
77593
78796
|
|
|
77594
78797
|
// src/lib/registry-sync.ts
|
|
77595
|
-
import { mkdirSync as
|
|
77596
|
-
import { dirname as
|
|
78798
|
+
import { mkdirSync as mkdirSync20, writeFileSync as writeFileSync20 } from "fs";
|
|
78799
|
+
import { dirname as dirname16, relative as relative6 } from "path";
|
|
77597
78800
|
function createRegistrySyncArtifact(options = {}) {
|
|
77598
78801
|
const profile = options.profile ?? "all";
|
|
77599
78802
|
const includeDocs = options.includeDocs ?? true;
|
|
@@ -77650,8 +78853,8 @@ function createRegistrySyncArtifact(options = {}) {
|
|
|
77650
78853
|
};
|
|
77651
78854
|
}
|
|
77652
78855
|
function writeRegistrySyncArtifact(path, artifact) {
|
|
77653
|
-
|
|
77654
|
-
|
|
78856
|
+
mkdirSync20(dirname16(path), { recursive: true });
|
|
78857
|
+
writeFileSync20(path, `${JSON.stringify(artifact, null, 2)}
|
|
77655
78858
|
`);
|
|
77656
78859
|
}
|
|
77657
78860
|
function buildDocs(name) {
|
|
@@ -77672,9 +78875,9 @@ var init_registry_sync = __esm(() => {
|
|
|
77672
78875
|
// src/cli/commands/registry.ts
|
|
77673
78876
|
var exports_registry2 = {};
|
|
77674
78877
|
__export(exports_registry2, {
|
|
77675
|
-
|
|
78878
|
+
registerVersions: () => registerVersions,
|
|
77676
78879
|
registerRegistry: () => registerRegistry,
|
|
77677
|
-
|
|
78880
|
+
registerPull: () => registerPull
|
|
77678
78881
|
});
|
|
77679
78882
|
function registerRegistry(parent) {
|
|
77680
78883
|
const registry2 = parent.command("registry").description("Generate registry artifacts for hosted skills services");
|
|
@@ -77683,12 +78886,12 @@ function registerRegistry(parent) {
|
|
|
77683
78886
|
async function writeJson2(value, space) {
|
|
77684
78887
|
const text2 = `${JSON.stringify(value, null, space)}
|
|
77685
78888
|
`;
|
|
77686
|
-
await new Promise((
|
|
78889
|
+
await new Promise((resolve6, reject2) => {
|
|
77687
78890
|
process.stdout.write(text2, (error2) => {
|
|
77688
78891
|
if (error2)
|
|
77689
78892
|
reject2(error2);
|
|
77690
78893
|
else
|
|
77691
|
-
|
|
78894
|
+
resolve6();
|
|
77692
78895
|
});
|
|
77693
78896
|
});
|
|
77694
78897
|
}
|
|
@@ -77716,10 +78919,10 @@ async function handleRegistrySync(options) {
|
|
|
77716
78919
|
await writeJson2(artifact, 2);
|
|
77717
78920
|
return;
|
|
77718
78921
|
}
|
|
77719
|
-
const
|
|
78922
|
+
const invalid4 = artifact.summary.invalidSkillCount ?? "not checked";
|
|
77720
78923
|
console.log(source_default.green(`Registry sync artifact written to ${options.output}`));
|
|
77721
78924
|
console.log(source_default.dim(` Skills: ${artifact.summary.skillCount}`));
|
|
77722
|
-
console.log(source_default.dim(` Invalid: ${
|
|
78925
|
+
console.log(source_default.dim(` Invalid: ${invalid4}`));
|
|
77723
78926
|
}
|
|
77724
78927
|
function registerPull(parent) {
|
|
77725
78928
|
parent.command("pull").argument("[names...]", "Skills to pull from the configured instance (name or name@version)").option("--all", "Pull every skill the instance serves", false).option("--for-machine", "Prepare this machine with the instance's full catalog (implies --all)", false).option("--json", "Output results as JSON", false).description("Fetch skills from the configured Skills instance into this machine's corpus").action(async (names, options) => {
|
|
@@ -77816,17 +79019,17 @@ var init_registry2 = __esm(() => {
|
|
|
77816
79019
|
// src/cli/commands/publish.ts
|
|
77817
79020
|
var exports_publish = {};
|
|
77818
79021
|
__export(exports_publish, {
|
|
77819
|
-
|
|
77820
|
-
buildVersionManifest: () => buildVersionManifest,
|
|
77821
|
-
bumpPatch: () => bumpPatch,
|
|
77822
|
-
pushSkill: () => pushSkill,
|
|
79022
|
+
sanitizeGitRemote: () => sanitizeGitRemote,
|
|
77823
79023
|
registerPublish: () => registerPublish,
|
|
77824
|
-
|
|
79024
|
+
pushSkill: () => pushSkill,
|
|
79025
|
+
bumpPatch: () => bumpPatch,
|
|
79026
|
+
buildVersionManifest: () => buildVersionManifest,
|
|
79027
|
+
PushSkillError: () => PushSkillError
|
|
77825
79028
|
});
|
|
77826
79029
|
import { execFileSync } from "child_process";
|
|
77827
79030
|
import { existsSync as existsSync32, readFileSync as readFileSync30 } from "fs";
|
|
77828
79031
|
import { hostname as hostname2 } from "os";
|
|
77829
|
-
import { join as
|
|
79032
|
+
import { join as join39 } from "path";
|
|
77830
79033
|
function registerPublish(parent) {
|
|
77831
79034
|
parent.command("push").argument("<name>", "Name of a skill in the local corpus (~/.hasna/skills/installed or the migrated ~/.hasna/skills/skills)").option("--version <version>", "Override the version recorded on the instance").option("--force-new-version", "If name@version already exists with different content, publish as the next patch version", false).option("--dry-run", "Pack and validate without uploading", false).option("--json", "Output result as JSON", false).description("Publish a local skill to the configured skills instance").action(async (name, options) => {
|
|
77832
79035
|
try {
|
|
@@ -77873,7 +79076,7 @@ async function pushSkill(name, options = {}) {
|
|
|
77873
79076
|
}
|
|
77874
79077
|
const packed = packSkillBundle(skill.path, { maxUnpackedBytes: MAX_UNPACKED_BYTES });
|
|
77875
79078
|
const versionManifest = buildVersionManifest(skill.path, packed);
|
|
77876
|
-
const skillMdPath =
|
|
79079
|
+
const skillMdPath = join39(skill.path, "SKILL.md");
|
|
77877
79080
|
const skillMd = existsSync32(skillMdPath) ? readFileSync30(skillMdPath, "utf-8") : undefined;
|
|
77878
79081
|
const base2 = {
|
|
77879
79082
|
slug: skill.name,
|
|
@@ -77939,21 +79142,21 @@ async function readPublishRevision(client, slug) {
|
|
|
77939
79142
|
throw new PushSkillError("Publishing was refused because the current skill revision could not be verified.", ["Check the configured instance and connection, then retry the push. No upload was attempted."]);
|
|
77940
79143
|
}
|
|
77941
79144
|
const body = lookup.body;
|
|
77942
|
-
const
|
|
77943
|
-
const nestedError =
|
|
77944
|
-
const code = typeof
|
|
79145
|
+
const record8 = body !== null && typeof body === "object" && !Array.isArray(body) ? body : undefined;
|
|
79146
|
+
const nestedError = record8?.error;
|
|
79147
|
+
const code = typeof record8?.code === "string" ? record8.code : nestedError !== null && typeof nestedError === "object" && !Array.isArray(nestedError) ? nestedError.code : undefined;
|
|
77945
79148
|
if (lookup.status === 404 && code === "SKILL_NOT_FOUND")
|
|
77946
79149
|
return;
|
|
77947
79150
|
if (lookup.status < 200 || lookup.status >= 300) {
|
|
77948
79151
|
throw new PushSkillError(`Publishing was refused because the current skill lookup failed: HTTP ${lookup.status}.`, ["Only an explicit SKILL_NOT_FOUND response establishes an initial publish. Check access and server compatibility before retrying."]);
|
|
77949
79152
|
}
|
|
77950
|
-
const revision =
|
|
77951
|
-
if (
|
|
77952
|
-
if (
|
|
79153
|
+
const revision = record8?.revisionId;
|
|
79154
|
+
if (record8?.publicationState === "catalogue-only") {
|
|
79155
|
+
if (record8.name === slug && (record8.slug === undefined || record8.slug === slug) && revision === null)
|
|
77953
79156
|
return;
|
|
77954
79157
|
throw new PushSkillError("Publishing was refused because the catalogue-only response had contradictory identity or revision state.", ["Check the configured instance and server compatibility. No upload was attempted."]);
|
|
77955
79158
|
}
|
|
77956
|
-
if (
|
|
79159
|
+
if (record8?.slug !== slug || typeof revision !== "string" || revision.length === 0 || revision !== revision.trim() || !/^[\x21-\x7e]+$/.test(revision)) {
|
|
77957
79160
|
throw new PushSkillError("Publishing was refused because the current skill response did not contain a matching slug and valid revision.", ["Check the configured instance and server compatibility. No upload was attempted."]);
|
|
77958
79161
|
}
|
|
77959
79162
|
return revision;
|
|
@@ -78114,7 +79317,7 @@ async function readCode() {
|
|
|
78114
79317
|
function promptCode() {
|
|
78115
79318
|
const { stdin, stderr: output } = process;
|
|
78116
79319
|
const { isRaw: wasRaw, readableFlowing: wasFlowing } = stdin;
|
|
78117
|
-
return new Promise((
|
|
79320
|
+
return new Promise((resolve6) => {
|
|
78118
79321
|
let value = "", settled = false;
|
|
78119
79322
|
const finish = (answer) => {
|
|
78120
79323
|
if (settled)
|
|
@@ -78131,7 +79334,7 @@ function promptCode() {
|
|
|
78131
79334
|
`);
|
|
78132
79335
|
if (answer === null)
|
|
78133
79336
|
process.exitCode = 130;
|
|
78134
|
-
|
|
79337
|
+
resolve6(answer);
|
|
78135
79338
|
};
|
|
78136
79339
|
const cancel = () => finish(null);
|
|
78137
79340
|
const keypress = (text2, key) => {
|
|
@@ -78171,6 +79374,81 @@ var init_customer_verification = __esm(() => {
|
|
|
78171
79374
|
};
|
|
78172
79375
|
});
|
|
78173
79376
|
|
|
79377
|
+
// src/cli/commands/private-publications.ts
|
|
79378
|
+
var exports_private_publications = {};
|
|
79379
|
+
__export(exports_private_publications, {
|
|
79380
|
+
registerPrivatePublications: () => registerPrivatePublications
|
|
79381
|
+
});
|
|
79382
|
+
import { resolve as resolve6 } from "path";
|
|
79383
|
+
function verifyOptions(options, action) {
|
|
79384
|
+
if (options.userId === undefined !== (options.membershipId === undefined) || options.userId !== undefined && (!publicationUuid(options.userId) || !publicationUuid(options.membershipId)))
|
|
79385
|
+
throw new PrivatePublicationError("PUBLICATION_CONTEXT_REQUIRED", "Provide both observed --user-id and --membership-id UUIDs.");
|
|
79386
|
+
if ((action === "publish" || action === "resume" || action === "cancel") && options.confirm !== true)
|
|
79387
|
+
throw new PrivatePublicationError("PUBLICATION_CONFIRM_REQUIRED", "Use --confirm to approve this publication action.");
|
|
79388
|
+
if (action === "publish" && (!publicationUuid(options.skillId) || Boolean(options.expectEmpty) === (options.expectedCurrentVersion !== undefined) || options.expectedCurrentVersion !== undefined && !publicationUuid(options.expectedCurrentVersion) || options.idempotencyKey !== undefined && !publicationUuid(options.idempotencyKey)))
|
|
79389
|
+
throw new PrivatePublicationError("INVALID_PUBLICATION_INPUT", "Provide --skill-id and exactly one of --expect-empty or --expected-current-version; optional --idempotency-key must be a UUID.");
|
|
79390
|
+
if (options.waitSeconds !== undefined && (!/^(?:0|[1-9]\d{0,2})$/.test(options.waitSeconds) || Number(options.waitSeconds) > 300))
|
|
79391
|
+
throw new PrivatePublicationError("INVALID_PUBLICATION_INPUT", "Use --wait-seconds from 0 to 300.");
|
|
79392
|
+
if (!options.codeStdin && (options.json || !process.stdin.isTTY || !process.stderr.isTTY))
|
|
79393
|
+
throw new PrivatePublicationError("PUBLICATION_CODE_REQUIRED", "Use --code-stdin with a fresh code for noninteractive publishing.");
|
|
79394
|
+
}
|
|
79395
|
+
function print2(result2, json) {
|
|
79396
|
+
if (json)
|
|
79397
|
+
console.log(JSON.stringify(result2));
|
|
79398
|
+
else {
|
|
79399
|
+
console.log(`Publication: ${result2.state}`);
|
|
79400
|
+
console.log(`Recovery: ${result2.recoveryDirectory}`);
|
|
79401
|
+
console.log(result2.nextAction);
|
|
79402
|
+
}
|
|
79403
|
+
if (!result2.committed && !["cancelled", "expired"].includes(result2.state))
|
|
79404
|
+
process.exitCode = 2;
|
|
79405
|
+
}
|
|
79406
|
+
function registerPrivatePublications(parent) {
|
|
79407
|
+
const group = parent.command("publication").description("Publish and reconcile private source versions on a compatible hosted server; execution is separate");
|
|
79408
|
+
const publishCommand = group.command("publish").allowExcessArguments(false).description("Publish private source with explicit current-version comparison").requiredOption("--recovery-dir <directory>", "New recovery directory for publish; existing directory for other actions").requiredOption("--email <email>", "Account email for fresh interactive verification").option("--user-id <uuid>", "Observed account UUID (required without an enrolled named profile)").option("--membership-id <uuid>", "Observed workspace membership UUID").option("--code-stdin", "Read a fresh six-digit verification code from stdin").option("--json", "Output a safe result without session credentials or upload URLs").option("--confirm", "Explicitly approve this action").argument("<directory>", "Validated local skill directory").requiredOption("--skill-id <uuid>", "Existing private/team skill UUID").option("--expected-current-version <uuid>", "Compare against the observed current version UUID").option("--expect-empty", "Require the skill to have no current version").option("--idempotency-key <uuid>", "Stable intent key; generated and saved before begin when omitted").option("--wait-seconds <seconds>", "Bounded status wait from 0 to 300", "60");
|
|
79409
|
+
const statusCommand = group.command("status").allowExcessArguments(false).description("Inspect the exact saved publication").requiredOption("--recovery-dir <directory>", "New recovery directory for publish; existing directory for other actions").requiredOption("--email <email>", "Account email for fresh interactive verification").option("--user-id <uuid>", "Observed account UUID (required without an enrolled named profile)").option("--membership-id <uuid>", "Observed workspace membership UUID").option("--code-stdin", "Read a fresh six-digit verification code from stdin").option("--json", "Output a safe result without session credentials or upload URLs");
|
|
79410
|
+
const resumeCommand = group.command("resume").allowExcessArguments(false).description("Reconcile the saved intent without creating a replacement").requiredOption("--recovery-dir <directory>", "New recovery directory for publish; existing directory for other actions").requiredOption("--email <email>", "Account email for fresh interactive verification").option("--user-id <uuid>", "Observed account UUID (required without an enrolled named profile)").option("--membership-id <uuid>", "Observed workspace membership UUID").option("--code-stdin", "Read a fresh six-digit verification code from stdin").option("--json", "Output a safe result without session credentials or upload URLs").option("--confirm", "Explicitly approve this action").option("--wait-seconds <seconds>", "Bounded status wait from 0 to 300", "60");
|
|
79411
|
+
const cancelCommand = group.command("cancel").allowExcessArguments(false).description("Cancel the exact saved publication").requiredOption("--recovery-dir <directory>", "New recovery directory for publish; existing directory for other actions").requiredOption("--email <email>", "Account email for fresh interactive verification").option("--user-id <uuid>", "Observed account UUID (required without an enrolled named profile)").option("--membership-id <uuid>", "Observed workspace membership UUID").option("--code-stdin", "Read a fresh six-digit verification code from stdin").option("--json", "Output a safe result without session credentials or upload URLs").option("--confirm", "Explicitly approve this action");
|
|
79412
|
+
for (const [action, command] of [["publish", publishCommand], ["status", statusCommand], ["resume", resumeCommand], ["cancel", cancelCommand]]) {
|
|
79413
|
+
command.action(async (...args2) => {
|
|
79414
|
+
const options = action === "publish" ? args2[1] : args2[0];
|
|
79415
|
+
try {
|
|
79416
|
+
verifyOptions(options, action);
|
|
79417
|
+
let code;
|
|
79418
|
+
if (options.codeStdin)
|
|
79419
|
+
code = await readCode();
|
|
79420
|
+
else {
|
|
79421
|
+
await new RemoteSkillsAuthClient(getApiUrl("Publish private skills")).requestCode(options.email);
|
|
79422
|
+
code = await promptCode();
|
|
79423
|
+
}
|
|
79424
|
+
if (code === null)
|
|
79425
|
+
return;
|
|
79426
|
+
const context = options.userId ? { userId: options.userId, membershipId: options.membershipId } : undefined;
|
|
79427
|
+
const client = await privatePublicationSession(options.email, code, context), directory = resolve6(options.recoveryDir);
|
|
79428
|
+
if (action === "publish")
|
|
79429
|
+
await preparePrivatePublication(client, resolve6(args2[0]), directory, { skillId: options.skillId, expectedCurrentVersionId: options.expectedCurrentVersion ?? null, idempotencyKey: options.idempotencyKey });
|
|
79430
|
+
const result2 = action === "publish" || action === "resume" ? await continuePrivatePublication(client, directory, { confirm: true, waitMs: Number(options.waitSeconds) * 1000 }) : await inspectPrivatePublication(client, directory, action === "cancel");
|
|
79431
|
+
print2(result2, options.json);
|
|
79432
|
+
} catch (error2) {
|
|
79433
|
+
const result2 = privatePublicationCustomerError(error2);
|
|
79434
|
+
if (options.json)
|
|
79435
|
+
console.log(JSON.stringify(result2));
|
|
79436
|
+
else
|
|
79437
|
+
console.error(result2.error);
|
|
79438
|
+
process.exitCode = 1;
|
|
79439
|
+
}
|
|
79440
|
+
});
|
|
79441
|
+
}
|
|
79442
|
+
}
|
|
79443
|
+
var init_private_publications = __esm(() => {
|
|
79444
|
+
init_remote_auth();
|
|
79445
|
+
init_auth_store();
|
|
79446
|
+
init_private_publication_customer();
|
|
79447
|
+
init_private_publication_recovery();
|
|
79448
|
+
init_remote_private_publications();
|
|
79449
|
+
init_customer_verification();
|
|
79450
|
+
});
|
|
79451
|
+
|
|
78174
79452
|
// src/cli/commands/workspace-selection.ts
|
|
78175
79453
|
async function codeFor(client, options) {
|
|
78176
79454
|
if (!options.email?.includes("@"))
|
|
@@ -78249,7 +79527,7 @@ __export(exports_auth, {
|
|
|
78249
79527
|
import { createInterface as createInterface2 } from "readline";
|
|
78250
79528
|
function prompt(question) {
|
|
78251
79529
|
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
78252
|
-
return new Promise((
|
|
79530
|
+
return new Promise((resolve7) => {
|
|
78253
79531
|
let settled = false;
|
|
78254
79532
|
const finish = (answer) => {
|
|
78255
79533
|
if (settled)
|
|
@@ -78258,7 +79536,7 @@ function prompt(question) {
|
|
|
78258
79536
|
rl.close();
|
|
78259
79537
|
if (answer === null)
|
|
78260
79538
|
process.exitCode = 130;
|
|
78261
|
-
|
|
79539
|
+
resolve7(answer);
|
|
78262
79540
|
};
|
|
78263
79541
|
rl.once("SIGINT", () => finish(null));
|
|
78264
79542
|
rl.once("close", () => finish(null));
|
|
@@ -78360,7 +79638,7 @@ function printWhoami(payload) {
|
|
|
78360
79638
|
console.log(source_default.dim("(offline \u2014 showing cached info)"));
|
|
78361
79639
|
}
|
|
78362
79640
|
function sleep(ms) {
|
|
78363
|
-
return new Promise((
|
|
79641
|
+
return new Promise((resolve7) => setTimeout(resolve7, ms));
|
|
78364
79642
|
}
|
|
78365
79643
|
function browserCommand(url) {
|
|
78366
79644
|
if (process.platform === "darwin")
|
|
@@ -78853,7 +80131,7 @@ function promptInvitationProof(kind) {
|
|
|
78853
80131
|
const label = kind === "token" ? "invitation token" : "recovery code";
|
|
78854
80132
|
const character = kind === "token" ? /^[A-Za-z0-9_-]$/ : /^\d$/;
|
|
78855
80133
|
const { stdin, stderr: output } = process, wasRaw = stdin.isRaw, wasFlowing = stdin.readableFlowing;
|
|
78856
|
-
return new Promise((
|
|
80134
|
+
return new Promise((resolve7) => {
|
|
78857
80135
|
let value = "", settled = false, overflow = false;
|
|
78858
80136
|
const finish = (answer) => {
|
|
78859
80137
|
if (settled)
|
|
@@ -78870,7 +80148,7 @@ function promptInvitationProof(kind) {
|
|
|
78870
80148
|
`);
|
|
78871
80149
|
if (answer === null)
|
|
78872
80150
|
process.exitCode = 130;
|
|
78873
|
-
|
|
80151
|
+
resolve7(answer);
|
|
78874
80152
|
};
|
|
78875
80153
|
const cancel = () => finish(null);
|
|
78876
80154
|
const keypress = (text2, key) => {
|
|
@@ -79442,8 +80720,8 @@ var init_storage = __esm(() => {
|
|
|
79442
80720
|
});
|
|
79443
80721
|
|
|
79444
80722
|
// src/lib/registry-reconcile.ts
|
|
79445
|
-
import { existsSync as existsSync33, readFileSync as readFileSync31, statSync as statSync20, writeFileSync as
|
|
79446
|
-
import { join as
|
|
80723
|
+
import { existsSync as existsSync33, readFileSync as readFileSync31, statSync as statSync20, writeFileSync as writeFileSync21 } from "fs";
|
|
80724
|
+
import { join as join40 } from "path";
|
|
79447
80725
|
function isDirectory2(path) {
|
|
79448
80726
|
try {
|
|
79449
80727
|
return statSync20(path).isDirectory();
|
|
@@ -79454,11 +80732,11 @@ function isDirectory2(path) {
|
|
|
79454
80732
|
function migrationNeeded(options) {
|
|
79455
80733
|
if (options.rootDir)
|
|
79456
80734
|
return false;
|
|
79457
|
-
const appDir = options.homeDir ?
|
|
79458
|
-
return !(isOwnerLayoutMigrated(appDir) && isDirectory2(
|
|
80735
|
+
const appDir = options.homeDir ? join40(options.homeDir, ".hasna", "skills") : getDataDir();
|
|
80736
|
+
return !(isOwnerLayoutMigrated(appDir) && isDirectory2(join40(appDir, SKILLS_CACHE_DIRNAME)));
|
|
79459
80737
|
}
|
|
79460
80738
|
function readBaseline(skillDir) {
|
|
79461
|
-
const markerPath =
|
|
80739
|
+
const markerPath = join40(skillDir, PULL_MARKER_FILE);
|
|
79462
80740
|
if (!existsSync33(markerPath))
|
|
79463
80741
|
return;
|
|
79464
80742
|
try {
|
|
@@ -79474,7 +80752,7 @@ function readBaseline(skillDir) {
|
|
|
79474
80752
|
}
|
|
79475
80753
|
}
|
|
79476
80754
|
function readCursor(root) {
|
|
79477
|
-
const path =
|
|
80755
|
+
const path = join40(root, SYNC_CURSOR_FILE);
|
|
79478
80756
|
if (!existsSync33(path))
|
|
79479
80757
|
return { runCount: 0 };
|
|
79480
80758
|
try {
|
|
@@ -79487,21 +80765,21 @@ function readCursor(root) {
|
|
|
79487
80765
|
function resolveCorpusRootReadOnly(options) {
|
|
79488
80766
|
if (options.rootDir)
|
|
79489
80767
|
return { root: options.rootDir, migrationPending: false };
|
|
79490
|
-
const appDir = options.homeDir ?
|
|
79491
|
-
const cache3 =
|
|
80768
|
+
const appDir = options.homeDir ? join40(options.homeDir, ".hasna", "skills") : getDataDirReadOnly();
|
|
80769
|
+
const cache3 = join40(appDir, SKILLS_CACHE_DIRNAME);
|
|
79492
80770
|
if (isOwnerLayoutMigrated(appDir) && isDirectory2(cache3)) {
|
|
79493
80771
|
return { root: cache3, migrationPending: false };
|
|
79494
80772
|
}
|
|
79495
|
-
return { root:
|
|
80773
|
+
return { root: join40(appDir, INSTALLED_SKILLS_DIRNAME), migrationPending: true };
|
|
79496
80774
|
}
|
|
79497
|
-
function remoteRowToSkill(
|
|
79498
|
-
const slug = typeof
|
|
80775
|
+
function remoteRowToSkill(record8) {
|
|
80776
|
+
const slug = typeof record8.slug === "string" ? record8.slug : typeof record8.name === "string" ? record8.name : undefined;
|
|
79499
80777
|
if (!slug)
|
|
79500
80778
|
return;
|
|
79501
80779
|
return {
|
|
79502
80780
|
slug,
|
|
79503
|
-
version: typeof
|
|
79504
|
-
sha256: typeof
|
|
80781
|
+
version: typeof record8.version === "string" ? record8.version : undefined,
|
|
80782
|
+
sha256: typeof record8.bundleSha256 === "string" && record8.bundleSha256 ? record8.bundleSha256 : undefined
|
|
79505
80783
|
};
|
|
79506
80784
|
}
|
|
79507
80785
|
function recheckLocalSide(plannedLocal, localDir, ops = {
|
|
@@ -79626,7 +80904,7 @@ async function reconcileRegistry(options = {}) {
|
|
|
79626
80904
|
for (const slug of allSlugs) {
|
|
79627
80905
|
const local = locals.get(slug);
|
|
79628
80906
|
const remote = remotes.get(slug);
|
|
79629
|
-
const baseline = local ? readBaseline(
|
|
80907
|
+
const baseline = local ? readBaseline(join40(root, slug)) : undefined;
|
|
79630
80908
|
const { state, reason } = classifySkill(local, remote, baseline);
|
|
79631
80909
|
let { action, reason: actionReason } = resolveAction(state, direction, conflict);
|
|
79632
80910
|
if (state === "remote-only" && isDigestless(remote)) {
|
|
@@ -79685,7 +80963,7 @@ async function reconcileRegistry(options = {}) {
|
|
|
79685
80963
|
try {
|
|
79686
80964
|
await pushSkill(slug, { rootDir: root, client });
|
|
79687
80965
|
const pushed = locals.get(slug);
|
|
79688
|
-
writePullMarker(
|
|
80966
|
+
writePullMarker(join40(root, slug), {
|
|
79689
80967
|
skill: slug,
|
|
79690
80968
|
...pushed?.version ? { version: pushed.version } : {},
|
|
79691
80969
|
...pushed?.sha256 ? { contentHash: pushed.sha256 } : {},
|
|
@@ -79757,7 +81035,7 @@ async function reconcileRegistry(options = {}) {
|
|
|
79757
81035
|
runCount: readCursor(root).runCount + 1,
|
|
79758
81036
|
summary
|
|
79759
81037
|
};
|
|
79760
|
-
|
|
81038
|
+
writeFileSync21(join40(root, SYNC_CURSOR_FILE), `${JSON.stringify(cursor2, null, 2)}
|
|
79761
81039
|
`);
|
|
79762
81040
|
return {
|
|
79763
81041
|
corpusRoot: root,
|
|
@@ -79986,43 +81264,43 @@ function throttle(func, throttleMs = 0, options = {}) {
|
|
|
79986
81264
|
// ../../node_modules/.bun/ansi-escapes@7.3.0/node_modules/ansi-escapes/base.js
|
|
79987
81265
|
var exports_base = {};
|
|
79988
81266
|
__export(exports_base, {
|
|
79989
|
-
|
|
79990
|
-
beep: () => beep,
|
|
79991
|
-
beginSynchronizedOutput: () => beginSynchronizedOutput,
|
|
79992
|
-
clearScreen: () => clearScreen,
|
|
79993
|
-
clearTerminal: () => clearTerminal,
|
|
79994
|
-
clearViewport: () => clearViewport,
|
|
79995
|
-
cursorBackward: () => cursorBackward,
|
|
79996
|
-
cursorDown: () => cursorDown,
|
|
79997
|
-
cursorForward: () => cursorForward,
|
|
79998
|
-
cursorGetPosition: () => cursorGetPosition,
|
|
79999
|
-
cursorHide: () => cursorHide,
|
|
80000
|
-
cursorLeft: () => cursorLeft,
|
|
80001
|
-
cursorMove: () => cursorMove,
|
|
80002
|
-
cursorNextLine: () => cursorNextLine,
|
|
80003
|
-
cursorPrevLine: () => cursorPrevLine,
|
|
80004
|
-
cursorRestorePosition: () => cursorRestorePosition,
|
|
80005
|
-
cursorSavePosition: () => cursorSavePosition,
|
|
80006
|
-
cursorShow: () => cursorShow,
|
|
80007
|
-
cursorTo: () => cursorTo,
|
|
80008
|
-
cursorUp: () => cursorUp,
|
|
80009
|
-
endSynchronizedOutput: () => endSynchronizedOutput,
|
|
80010
|
-
enterAlternativeScreen: () => enterAlternativeScreen,
|
|
80011
|
-
eraseDown: () => eraseDown,
|
|
80012
|
-
eraseEndLine: () => eraseEndLine,
|
|
80013
|
-
eraseLine: () => eraseLine,
|
|
80014
|
-
eraseLines: () => eraseLines,
|
|
80015
|
-
eraseScreen: () => eraseScreen,
|
|
80016
|
-
eraseStartLine: () => eraseStartLine,
|
|
80017
|
-
eraseUp: () => eraseUp,
|
|
80018
|
-
exitAlternativeScreen: () => exitAlternativeScreen,
|
|
80019
|
-
iTerm: () => iTerm,
|
|
80020
|
-
image: () => image,
|
|
80021
|
-
link: () => link,
|
|
80022
|
-
scrollDown: () => scrollDown,
|
|
80023
|
-
scrollUp: () => scrollUp,
|
|
81267
|
+
synchronizedOutput: () => synchronizedOutput,
|
|
80024
81268
|
setCwd: () => setCwd,
|
|
80025
|
-
|
|
81269
|
+
scrollUp: () => scrollUp,
|
|
81270
|
+
scrollDown: () => scrollDown,
|
|
81271
|
+
link: () => link,
|
|
81272
|
+
image: () => image,
|
|
81273
|
+
iTerm: () => iTerm,
|
|
81274
|
+
exitAlternativeScreen: () => exitAlternativeScreen,
|
|
81275
|
+
eraseUp: () => eraseUp,
|
|
81276
|
+
eraseStartLine: () => eraseStartLine,
|
|
81277
|
+
eraseScreen: () => eraseScreen,
|
|
81278
|
+
eraseLines: () => eraseLines,
|
|
81279
|
+
eraseLine: () => eraseLine,
|
|
81280
|
+
eraseEndLine: () => eraseEndLine,
|
|
81281
|
+
eraseDown: () => eraseDown,
|
|
81282
|
+
enterAlternativeScreen: () => enterAlternativeScreen,
|
|
81283
|
+
endSynchronizedOutput: () => endSynchronizedOutput,
|
|
81284
|
+
cursorUp: () => cursorUp,
|
|
81285
|
+
cursorTo: () => cursorTo,
|
|
81286
|
+
cursorShow: () => cursorShow,
|
|
81287
|
+
cursorSavePosition: () => cursorSavePosition,
|
|
81288
|
+
cursorRestorePosition: () => cursorRestorePosition,
|
|
81289
|
+
cursorPrevLine: () => cursorPrevLine,
|
|
81290
|
+
cursorNextLine: () => cursorNextLine,
|
|
81291
|
+
cursorMove: () => cursorMove,
|
|
81292
|
+
cursorLeft: () => cursorLeft,
|
|
81293
|
+
cursorHide: () => cursorHide,
|
|
81294
|
+
cursorGetPosition: () => cursorGetPosition,
|
|
81295
|
+
cursorForward: () => cursorForward,
|
|
81296
|
+
cursorDown: () => cursorDown,
|
|
81297
|
+
cursorBackward: () => cursorBackward,
|
|
81298
|
+
clearViewport: () => clearViewport,
|
|
81299
|
+
clearTerminal: () => clearTerminal,
|
|
81300
|
+
clearScreen: () => clearScreen,
|
|
81301
|
+
beginSynchronizedOutput: () => beginSynchronizedOutput,
|
|
81302
|
+
beep: () => beep,
|
|
81303
|
+
ConEmu: () => ConEmu
|
|
80026
81304
|
});
|
|
80027
81305
|
import process2 from "process";
|
|
80028
81306
|
import os from "os";
|
|
@@ -87720,6 +88998,8 @@ registerPull2(program2);
|
|
|
87720
88998
|
registerVersions2(program2);
|
|
87721
88999
|
var { registerPublish: registerPublish2 } = await Promise.resolve().then(() => (init_publish(), exports_publish));
|
|
87722
89000
|
registerPublish2(program2);
|
|
89001
|
+
var { registerPrivatePublications: registerPrivatePublications2 } = await Promise.resolve().then(() => (init_private_publications(), exports_private_publications));
|
|
89002
|
+
registerPrivatePublications2(program2);
|
|
87723
89003
|
var { registerAuth: registerAuth2 } = await Promise.resolve().then(() => (init_auth(), exports_auth));
|
|
87724
89004
|
registerAuth2(program2);
|
|
87725
89005
|
var { registerCustomerProfileCommands: registerCustomerProfileCommands2 } = await Promise.resolve().then(() => (init_customer_profile(), exports_customer_profile));
|