boomkin 0.9.1 → 0.11.0
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/CHANGELOG.md +15 -0
- package/README.md +24 -16
- package/catalog/skills.json +8 -7
- package/catalog/templates.json +41 -0
- package/catalog/workflows.json +40 -0
- package/dist/cli.js +1619 -295
- package/dist/desk/app.js +421 -0
- package/dist/desk/assets/OFL-Manrope.txt +93 -0
- package/dist/desk/assets/favicon.svg +1 -0
- package/dist/desk/assets/manrope.ttf +0 -0
- package/dist/desk/data/bitcoin-180d.json +739 -0
- package/dist/desk/data/bitcoin-capture.json +14 -0
- package/dist/desk/data/synthetic-daily.json +258 -0
- package/dist/desk/desk.css +20 -0
- package/dist/desk/index.html +67 -0
- package/dist/desk/ui.d.ts +22 -0
- package/dist/desk/ui.js +114 -0
- package/dist/desk/vendor/LICENSE +21 -0
- package/dist/desk/vendor/provenance.json +12 -0
- package/dist/desk/vendor/strategy-engine.mjs +234 -0
- package/docs/AGENT-INDEX.md +6 -2
- package/docs/DESK.md +70 -0
- package/docs/GETTING-STARTED.md +20 -3
- package/docs/PROJECTS.md +17 -0
- package/docs/UPDATES.md +2 -2
- package/docs/WORKFLOWS.md +17 -1
- package/docs/assets/boomkin-desk.jpg +0 -0
- package/llms.txt +4 -2
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
3
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
set: __exportSetter.bind(all, name)
|
|
16
|
-
});
|
|
4
|
+
var __esm = (fn, res, err) => () => {
|
|
5
|
+
if (fn)
|
|
6
|
+
try {
|
|
7
|
+
res = fn(fn = 0);
|
|
8
|
+
} catch (e) {
|
|
9
|
+
err = [e];
|
|
10
|
+
}
|
|
11
|
+
if (err)
|
|
12
|
+
throw err[0];
|
|
13
|
+
return res;
|
|
17
14
|
};
|
|
18
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
19
15
|
var __require = import.meta.require;
|
|
20
16
|
|
|
21
17
|
// node_modules/yaml/dist/nodes/identity.js
|
|
22
|
-
var require_identity = __commonJS((exports)
|
|
18
|
+
var require_identity = __commonJS(function(exports) {
|
|
23
19
|
var ALIAS = Symbol.for("yaml.alias");
|
|
24
20
|
var DOC = Symbol.for("yaml.document");
|
|
25
21
|
var MAP = Symbol.for("yaml.map");
|
|
@@ -73,7 +69,7 @@ var require_identity = __commonJS((exports) => {
|
|
|
73
69
|
});
|
|
74
70
|
|
|
75
71
|
// node_modules/yaml/dist/visit.js
|
|
76
|
-
var require_visit = __commonJS((exports)
|
|
72
|
+
var require_visit = __commonJS(function(exports) {
|
|
77
73
|
var identity = require_identity();
|
|
78
74
|
var BREAK = Symbol("break visit");
|
|
79
75
|
var SKIP = Symbol("skip children");
|
|
@@ -228,7 +224,7 @@ var require_visit = __commonJS((exports) => {
|
|
|
228
224
|
});
|
|
229
225
|
|
|
230
226
|
// node_modules/yaml/dist/doc/directives.js
|
|
231
|
-
var require_directives = __commonJS((exports)
|
|
227
|
+
var require_directives = __commonJS(function(exports) {
|
|
232
228
|
var identity = require_identity();
|
|
233
229
|
var visit = require_visit();
|
|
234
230
|
var escapeChars = {
|
|
@@ -380,7 +376,7 @@ var require_directives = __commonJS((exports) => {
|
|
|
380
376
|
});
|
|
381
377
|
|
|
382
378
|
// node_modules/yaml/dist/doc/anchors.js
|
|
383
|
-
var require_anchors = __commonJS((exports)
|
|
379
|
+
var require_anchors = __commonJS(function(exports) {
|
|
384
380
|
var identity = require_identity();
|
|
385
381
|
var visit = require_visit();
|
|
386
382
|
function anchorIsValid(anchor) {
|
|
@@ -442,7 +438,7 @@ var require_anchors = __commonJS((exports) => {
|
|
|
442
438
|
});
|
|
443
439
|
|
|
444
440
|
// node_modules/yaml/dist/doc/applyReviver.js
|
|
445
|
-
var require_applyReviver = __commonJS((exports)
|
|
441
|
+
var require_applyReviver = __commonJS(function(exports) {
|
|
446
442
|
function applyReviver(reviver, obj, key, val) {
|
|
447
443
|
if (val && typeof val === "object") {
|
|
448
444
|
if (Array.isArray(val)) {
|
|
@@ -489,7 +485,7 @@ var require_applyReviver = __commonJS((exports) => {
|
|
|
489
485
|
});
|
|
490
486
|
|
|
491
487
|
// node_modules/yaml/dist/nodes/toJS.js
|
|
492
|
-
var require_toJS = __commonJS((exports)
|
|
488
|
+
var require_toJS = __commonJS(function(exports) {
|
|
493
489
|
var identity = require_identity();
|
|
494
490
|
function toJS(value, arg, ctx) {
|
|
495
491
|
if (Array.isArray(value))
|
|
@@ -499,8 +495,8 @@ var require_toJS = __commonJS((exports) => {
|
|
|
499
495
|
return value.toJSON(arg, ctx);
|
|
500
496
|
const data = { aliasCount: 0, count: 1, res: undefined };
|
|
501
497
|
ctx.anchors.set(value, data);
|
|
502
|
-
ctx.onCreate = (
|
|
503
|
-
data.res =
|
|
498
|
+
ctx.onCreate = (res) => {
|
|
499
|
+
data.res = res;
|
|
504
500
|
delete ctx.onCreate;
|
|
505
501
|
};
|
|
506
502
|
const res = value.toJSON(arg, ctx);
|
|
@@ -516,7 +512,7 @@ var require_toJS = __commonJS((exports) => {
|
|
|
516
512
|
});
|
|
517
513
|
|
|
518
514
|
// node_modules/yaml/dist/nodes/Node.js
|
|
519
|
-
var require_Node = __commonJS((exports)
|
|
515
|
+
var require_Node = __commonJS(function(exports) {
|
|
520
516
|
var applyReviver = require_applyReviver();
|
|
521
517
|
var identity = require_identity();
|
|
522
518
|
var toJS = require_toJS();
|
|
@@ -544,8 +540,8 @@ var require_Node = __commonJS((exports) => {
|
|
|
544
540
|
};
|
|
545
541
|
const res = toJS.toJS(this, "", ctx);
|
|
546
542
|
if (typeof onAnchor === "function")
|
|
547
|
-
for (const { count, res
|
|
548
|
-
onAnchor(
|
|
543
|
+
for (const { count, res } of ctx.anchors.values())
|
|
544
|
+
onAnchor(res, count);
|
|
549
545
|
return typeof reviver === "function" ? applyReviver.applyReviver(reviver, { "": res }, "", res) : res;
|
|
550
546
|
}
|
|
551
547
|
}
|
|
@@ -553,7 +549,7 @@ var require_Node = __commonJS((exports) => {
|
|
|
553
549
|
});
|
|
554
550
|
|
|
555
551
|
// node_modules/yaml/dist/nodes/Alias.js
|
|
556
|
-
var require_Alias = __commonJS((exports)
|
|
552
|
+
var require_Alias = __commonJS(function(exports) {
|
|
557
553
|
var anchors = require_anchors();
|
|
558
554
|
var visit = require_visit();
|
|
559
555
|
var identity = require_identity();
|
|
@@ -595,11 +591,11 @@ var require_Alias = __commonJS((exports) => {
|
|
|
595
591
|
found = node;
|
|
596
592
|
}
|
|
597
593
|
if (found && ctx) {
|
|
598
|
-
const { anchors
|
|
599
|
-
let data =
|
|
594
|
+
const { anchors, doc, maxAliasCount } = ctx;
|
|
595
|
+
let data = anchors.get(found);
|
|
600
596
|
if (!data) {
|
|
601
597
|
toJS.toJS(found, null, ctx);
|
|
602
|
-
data =
|
|
598
|
+
data = anchors.get(found);
|
|
603
599
|
}
|
|
604
600
|
if (data?.res === undefined) {
|
|
605
601
|
const msg = "This should not happen: Alias anchor was not resolved?";
|
|
@@ -608,7 +604,7 @@ var require_Alias = __commonJS((exports) => {
|
|
|
608
604
|
if (maxAliasCount >= 0) {
|
|
609
605
|
data.count += 1;
|
|
610
606
|
if (data.aliasCount === 0)
|
|
611
|
-
data.aliasCount = getAliasCount(
|
|
607
|
+
data.aliasCount = getAliasCount(doc, found, anchors);
|
|
612
608
|
if (data.count * data.aliasCount > maxAliasCount) {
|
|
613
609
|
const msg = "Excessive alias count indicates a resource exhaustion attack";
|
|
614
610
|
throw new ReferenceError(msg);
|
|
@@ -641,22 +637,22 @@ var require_Alias = __commonJS((exports) => {
|
|
|
641
637
|
return src;
|
|
642
638
|
}
|
|
643
639
|
}
|
|
644
|
-
function getAliasCount(doc, node,
|
|
640
|
+
function getAliasCount(doc, node, anchors) {
|
|
645
641
|
if (identity.isAlias(node)) {
|
|
646
642
|
const source = node.resolve(doc);
|
|
647
|
-
const anchor =
|
|
643
|
+
const anchor = anchors && source && anchors.get(source);
|
|
648
644
|
return anchor ? anchor.count * anchor.aliasCount : 0;
|
|
649
645
|
} else if (identity.isCollection(node)) {
|
|
650
646
|
let count = 0;
|
|
651
647
|
for (const item of node.items) {
|
|
652
|
-
const c = getAliasCount(doc, item,
|
|
648
|
+
const c = getAliasCount(doc, item, anchors);
|
|
653
649
|
if (c > count)
|
|
654
650
|
count = c;
|
|
655
651
|
}
|
|
656
652
|
return count;
|
|
657
653
|
} else if (identity.isPair(node)) {
|
|
658
|
-
const kc = getAliasCount(doc, node.key,
|
|
659
|
-
const vc = getAliasCount(doc, node.value,
|
|
654
|
+
const kc = getAliasCount(doc, node.key, anchors);
|
|
655
|
+
const vc = getAliasCount(doc, node.value, anchors);
|
|
660
656
|
return Math.max(kc, vc);
|
|
661
657
|
}
|
|
662
658
|
return 1;
|
|
@@ -665,7 +661,7 @@ var require_Alias = __commonJS((exports) => {
|
|
|
665
661
|
});
|
|
666
662
|
|
|
667
663
|
// node_modules/yaml/dist/nodes/Scalar.js
|
|
668
|
-
var require_Scalar = __commonJS((exports)
|
|
664
|
+
var require_Scalar = __commonJS(function(exports) {
|
|
669
665
|
var identity = require_identity();
|
|
670
666
|
var Node = require_Node();
|
|
671
667
|
var toJS = require_toJS();
|
|
@@ -693,7 +689,7 @@ var require_Scalar = __commonJS((exports) => {
|
|
|
693
689
|
});
|
|
694
690
|
|
|
695
691
|
// node_modules/yaml/dist/doc/createNode.js
|
|
696
|
-
var require_createNode = __commonJS((exports)
|
|
692
|
+
var require_createNode = __commonJS(function(exports) {
|
|
697
693
|
var Alias = require_Alias();
|
|
698
694
|
var identity = require_identity();
|
|
699
695
|
var Scalar = require_Scalar();
|
|
@@ -741,10 +737,10 @@ var require_createNode = __commonJS((exports) => {
|
|
|
741
737
|
value = value.toJSON();
|
|
742
738
|
}
|
|
743
739
|
if (!value || typeof value !== "object") {
|
|
744
|
-
const
|
|
740
|
+
const node = new Scalar.Scalar(value);
|
|
745
741
|
if (ref)
|
|
746
|
-
ref.node =
|
|
747
|
-
return
|
|
742
|
+
ref.node = node;
|
|
743
|
+
return node;
|
|
748
744
|
}
|
|
749
745
|
tagObj = value instanceof Map ? schema[identity.MAP] : (Symbol.iterator in Object(value)) ? schema[identity.SEQ] : schema[identity.MAP];
|
|
750
746
|
}
|
|
@@ -765,7 +761,7 @@ var require_createNode = __commonJS((exports) => {
|
|
|
765
761
|
});
|
|
766
762
|
|
|
767
763
|
// node_modules/yaml/dist/nodes/Collection.js
|
|
768
|
-
var require_Collection = __commonJS((exports)
|
|
764
|
+
var require_Collection = __commonJS(function(exports) {
|
|
769
765
|
var createNode = require_createNode();
|
|
770
766
|
var identity = require_identity();
|
|
771
767
|
var Node = require_Node();
|
|
@@ -880,7 +876,7 @@ var require_Collection = __commonJS((exports) => {
|
|
|
880
876
|
});
|
|
881
877
|
|
|
882
878
|
// node_modules/yaml/dist/stringify/stringifyComment.js
|
|
883
|
-
var require_stringifyComment = __commonJS((exports)
|
|
879
|
+
var require_stringifyComment = __commonJS(function(exports) {
|
|
884
880
|
var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
|
|
885
881
|
function indentComment(comment, indent) {
|
|
886
882
|
if (/^\n+$/.test(comment))
|
|
@@ -897,7 +893,7 @@ var require_stringifyComment = __commonJS((exports) => {
|
|
|
897
893
|
});
|
|
898
894
|
|
|
899
895
|
// node_modules/yaml/dist/stringify/foldFlowLines.js
|
|
900
|
-
var require_foldFlowLines = __commonJS((exports)
|
|
896
|
+
var require_foldFlowLines = __commonJS(function(exports) {
|
|
901
897
|
var FOLD_FLOW = "flow";
|
|
902
898
|
var FOLD_BLOCK = "block";
|
|
903
899
|
var FOLD_QUOTED = "quoted";
|
|
@@ -993,17 +989,17 @@ var require_foldFlowLines = __commonJS((exports) => {
|
|
|
993
989
|
if (onFold)
|
|
994
990
|
onFold();
|
|
995
991
|
let res = text.slice(0, folds[0]);
|
|
996
|
-
for (let
|
|
997
|
-
const fold = folds[
|
|
998
|
-
const
|
|
992
|
+
for (let i = 0;i < folds.length; ++i) {
|
|
993
|
+
const fold = folds[i];
|
|
994
|
+
const end = folds[i + 1] || text.length;
|
|
999
995
|
if (fold === 0)
|
|
1000
996
|
res = `
|
|
1001
|
-
${indent}${text.slice(0,
|
|
997
|
+
${indent}${text.slice(0, end)}`;
|
|
1002
998
|
else {
|
|
1003
999
|
if (mode === FOLD_QUOTED && escapedFolds[fold])
|
|
1004
1000
|
res += `${text[fold]}\\`;
|
|
1005
1001
|
res += `
|
|
1006
|
-
${indent}${text.slice(fold + 1,
|
|
1002
|
+
${indent}${text.slice(fold + 1, end)}`;
|
|
1007
1003
|
}
|
|
1008
1004
|
}
|
|
1009
1005
|
return res;
|
|
@@ -1034,7 +1030,7 @@ ${indent}${text.slice(fold + 1, end2)}`;
|
|
|
1034
1030
|
});
|
|
1035
1031
|
|
|
1036
1032
|
// node_modules/yaml/dist/stringify/stringifyString.js
|
|
1037
|
-
var require_stringifyString = __commonJS((exports)
|
|
1033
|
+
var require_stringifyString = __commonJS(function(exports) {
|
|
1038
1034
|
var Scalar = require_Scalar();
|
|
1039
1035
|
var foldFlowLines = require_foldFlowLines();
|
|
1040
1036
|
var getFoldOptions = (ctx, isBlock) => ({
|
|
@@ -1332,7 +1328,7 @@ ${indent}`);
|
|
|
1332
1328
|
});
|
|
1333
1329
|
|
|
1334
1330
|
// node_modules/yaml/dist/stringify/stringify.js
|
|
1335
|
-
var require_stringify = __commonJS((exports)
|
|
1331
|
+
var require_stringify = __commonJS(function(exports) {
|
|
1336
1332
|
var anchors = require_anchors();
|
|
1337
1333
|
var identity = require_identity();
|
|
1338
1334
|
var stringifyComment = require_stringifyComment();
|
|
@@ -1453,7 +1449,7 @@ ${ctx.indent}${str}`;
|
|
|
1453
1449
|
});
|
|
1454
1450
|
|
|
1455
1451
|
// node_modules/yaml/dist/stringify/stringifyPair.js
|
|
1456
|
-
var require_stringifyPair = __commonJS((exports)
|
|
1452
|
+
var require_stringifyPair = __commonJS(function(exports) {
|
|
1457
1453
|
var identity = require_identity();
|
|
1458
1454
|
var Scalar = require_Scalar();
|
|
1459
1455
|
var stringify = require_stringify();
|
|
@@ -1589,7 +1585,7 @@ ${ctx.indent}`;
|
|
|
1589
1585
|
});
|
|
1590
1586
|
|
|
1591
1587
|
// node_modules/yaml/dist/log.js
|
|
1592
|
-
var require_log = __commonJS((exports)
|
|
1588
|
+
var require_log = __commonJS(function(exports) {
|
|
1593
1589
|
var node_process = __require("process");
|
|
1594
1590
|
function debug(logLevel, ...messages) {
|
|
1595
1591
|
if (logLevel === "debug")
|
|
@@ -1608,7 +1604,7 @@ var require_log = __commonJS((exports) => {
|
|
|
1608
1604
|
});
|
|
1609
1605
|
|
|
1610
1606
|
// node_modules/yaml/dist/schema/yaml-1.1/merge.js
|
|
1611
|
-
var require_merge = __commonJS((exports)
|
|
1607
|
+
var require_merge = __commonJS(function(exports) {
|
|
1612
1608
|
var identity = require_identity();
|
|
1613
1609
|
var Scalar = require_Scalar();
|
|
1614
1610
|
var MERGE_KEY = "<<";
|
|
@@ -1639,15 +1635,15 @@ var require_merge = __commonJS((exports) => {
|
|
|
1639
1635
|
if (!identity.isMap(source))
|
|
1640
1636
|
throw new Error("Merge sources must be maps or map aliases");
|
|
1641
1637
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
1642
|
-
for (const [key,
|
|
1638
|
+
for (const [key, value] of srcMap) {
|
|
1643
1639
|
if (map instanceof Map) {
|
|
1644
1640
|
if (!map.has(key))
|
|
1645
|
-
map.set(key,
|
|
1641
|
+
map.set(key, value);
|
|
1646
1642
|
} else if (map instanceof Set) {
|
|
1647
1643
|
map.add(key);
|
|
1648
1644
|
} else if (!Object.prototype.hasOwnProperty.call(map, key)) {
|
|
1649
1645
|
Object.defineProperty(map, key, {
|
|
1650
|
-
value
|
|
1646
|
+
value,
|
|
1651
1647
|
writable: true,
|
|
1652
1648
|
enumerable: true,
|
|
1653
1649
|
configurable: true
|
|
@@ -1665,7 +1661,7 @@ var require_merge = __commonJS((exports) => {
|
|
|
1665
1661
|
});
|
|
1666
1662
|
|
|
1667
1663
|
// node_modules/yaml/dist/nodes/addPairToJSMap.js
|
|
1668
|
-
var require_addPairToJSMap = __commonJS((exports)
|
|
1664
|
+
var require_addPairToJSMap = __commonJS(function(exports) {
|
|
1669
1665
|
var log = require_log();
|
|
1670
1666
|
var merge = require_merge();
|
|
1671
1667
|
var stringify = require_stringify();
|
|
@@ -1726,7 +1722,7 @@ var require_addPairToJSMap = __commonJS((exports) => {
|
|
|
1726
1722
|
});
|
|
1727
1723
|
|
|
1728
1724
|
// node_modules/yaml/dist/nodes/Pair.js
|
|
1729
|
-
var require_Pair = __commonJS((exports)
|
|
1725
|
+
var require_Pair = __commonJS(function(exports) {
|
|
1730
1726
|
var createNode = require_createNode();
|
|
1731
1727
|
var stringifyPair = require_stringifyPair();
|
|
1732
1728
|
var addPairToJSMap = require_addPairToJSMap();
|
|
@@ -1764,14 +1760,14 @@ var require_Pair = __commonJS((exports) => {
|
|
|
1764
1760
|
});
|
|
1765
1761
|
|
|
1766
1762
|
// node_modules/yaml/dist/stringify/stringifyCollection.js
|
|
1767
|
-
var require_stringifyCollection = __commonJS((exports)
|
|
1763
|
+
var require_stringifyCollection = __commonJS(function(exports) {
|
|
1768
1764
|
var identity = require_identity();
|
|
1769
1765
|
var stringify = require_stringify();
|
|
1770
1766
|
var stringifyComment = require_stringifyComment();
|
|
1771
1767
|
function stringifyCollection(collection, ctx, options) {
|
|
1772
1768
|
const flow = ctx.inFlow ?? collection.flow;
|
|
1773
|
-
const
|
|
1774
|
-
return
|
|
1769
|
+
const stringify = flow ? stringifyFlowCollection : stringifyBlockCollection;
|
|
1770
|
+
return stringify(collection, ctx, options);
|
|
1775
1771
|
}
|
|
1776
1772
|
function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
|
|
1777
1773
|
const { indent, options: { commentString } } = ctx;
|
|
@@ -1780,13 +1776,13 @@ var require_stringifyCollection = __commonJS((exports) => {
|
|
|
1780
1776
|
const lines = [];
|
|
1781
1777
|
for (let i = 0;i < items.length; ++i) {
|
|
1782
1778
|
const item = items[i];
|
|
1783
|
-
let
|
|
1779
|
+
let comment = null;
|
|
1784
1780
|
if (identity.isNode(item)) {
|
|
1785
1781
|
if (!chompKeep && item.spaceBefore)
|
|
1786
1782
|
lines.push("");
|
|
1787
1783
|
addCommentBefore(ctx, lines, item.commentBefore, chompKeep);
|
|
1788
1784
|
if (item.comment)
|
|
1789
|
-
|
|
1785
|
+
comment = item.comment;
|
|
1790
1786
|
} else if (identity.isPair(item)) {
|
|
1791
1787
|
const ik = identity.isNode(item.key) ? item.key : null;
|
|
1792
1788
|
if (ik) {
|
|
@@ -1796,12 +1792,12 @@ var require_stringifyCollection = __commonJS((exports) => {
|
|
|
1796
1792
|
}
|
|
1797
1793
|
}
|
|
1798
1794
|
chompKeep = false;
|
|
1799
|
-
let
|
|
1800
|
-
if (
|
|
1801
|
-
|
|
1802
|
-
if (chompKeep &&
|
|
1795
|
+
let str = stringify.stringify(item, itemCtx, () => comment = null, () => chompKeep = true);
|
|
1796
|
+
if (comment)
|
|
1797
|
+
str += stringifyComment.lineComment(str, itemIndent, commentString(comment));
|
|
1798
|
+
if (chompKeep && comment)
|
|
1803
1799
|
chompKeep = false;
|
|
1804
|
-
lines.push(blockItemPrefix +
|
|
1800
|
+
lines.push(blockItemPrefix + str);
|
|
1805
1801
|
}
|
|
1806
1802
|
let str;
|
|
1807
1803
|
if (lines.length === 0) {
|
|
@@ -1916,7 +1912,7 @@ ${indent}${end}`;
|
|
|
1916
1912
|
});
|
|
1917
1913
|
|
|
1918
1914
|
// node_modules/yaml/dist/nodes/YAMLMap.js
|
|
1919
|
-
var require_YAMLMap = __commonJS((exports)
|
|
1915
|
+
var require_YAMLMap = __commonJS(function(exports) {
|
|
1920
1916
|
var stringifyCollection = require_stringifyCollection();
|
|
1921
1917
|
var addPairToJSMap = require_addPairToJSMap();
|
|
1922
1918
|
var Collection = require_Collection();
|
|
@@ -2043,7 +2039,7 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
2043
2039
|
});
|
|
2044
2040
|
|
|
2045
2041
|
// node_modules/yaml/dist/schema/common/map.js
|
|
2046
|
-
var require_map = __commonJS((exports)
|
|
2042
|
+
var require_map = __commonJS(function(exports) {
|
|
2047
2043
|
var identity = require_identity();
|
|
2048
2044
|
var YAMLMap = require_YAMLMap();
|
|
2049
2045
|
var map = {
|
|
@@ -2051,10 +2047,10 @@ var require_map = __commonJS((exports) => {
|
|
|
2051
2047
|
default: true,
|
|
2052
2048
|
nodeClass: YAMLMap.YAMLMap,
|
|
2053
2049
|
tag: "tag:yaml.org,2002:map",
|
|
2054
|
-
resolve(
|
|
2055
|
-
if (!identity.isMap(
|
|
2050
|
+
resolve(map, onError) {
|
|
2051
|
+
if (!identity.isMap(map))
|
|
2056
2052
|
onError("Expected a mapping for this tag");
|
|
2057
|
-
return
|
|
2053
|
+
return map;
|
|
2058
2054
|
},
|
|
2059
2055
|
createNode: (schema, obj, ctx) => YAMLMap.YAMLMap.from(schema, obj, ctx)
|
|
2060
2056
|
};
|
|
@@ -2062,7 +2058,7 @@ var require_map = __commonJS((exports) => {
|
|
|
2062
2058
|
});
|
|
2063
2059
|
|
|
2064
2060
|
// node_modules/yaml/dist/nodes/YAMLSeq.js
|
|
2065
|
-
var require_YAMLSeq = __commonJS((exports)
|
|
2061
|
+
var require_YAMLSeq = __commonJS(function(exports) {
|
|
2066
2062
|
var createNode = require_createNode();
|
|
2067
2063
|
var stringifyCollection = require_stringifyCollection();
|
|
2068
2064
|
var Collection = require_Collection();
|
|
@@ -2155,7 +2151,7 @@ var require_YAMLSeq = __commonJS((exports) => {
|
|
|
2155
2151
|
});
|
|
2156
2152
|
|
|
2157
2153
|
// node_modules/yaml/dist/schema/common/seq.js
|
|
2158
|
-
var require_seq = __commonJS((exports)
|
|
2154
|
+
var require_seq = __commonJS(function(exports) {
|
|
2159
2155
|
var identity = require_identity();
|
|
2160
2156
|
var YAMLSeq = require_YAMLSeq();
|
|
2161
2157
|
var seq = {
|
|
@@ -2163,10 +2159,10 @@ var require_seq = __commonJS((exports) => {
|
|
|
2163
2159
|
default: true,
|
|
2164
2160
|
nodeClass: YAMLSeq.YAMLSeq,
|
|
2165
2161
|
tag: "tag:yaml.org,2002:seq",
|
|
2166
|
-
resolve(
|
|
2167
|
-
if (!identity.isSeq(
|
|
2162
|
+
resolve(seq, onError) {
|
|
2163
|
+
if (!identity.isSeq(seq))
|
|
2168
2164
|
onError("Expected a sequence for this tag");
|
|
2169
|
-
return
|
|
2165
|
+
return seq;
|
|
2170
2166
|
},
|
|
2171
2167
|
createNode: (schema, obj, ctx) => YAMLSeq.YAMLSeq.from(schema, obj, ctx)
|
|
2172
2168
|
};
|
|
@@ -2174,7 +2170,7 @@ var require_seq = __commonJS((exports) => {
|
|
|
2174
2170
|
});
|
|
2175
2171
|
|
|
2176
2172
|
// node_modules/yaml/dist/schema/common/string.js
|
|
2177
|
-
var require_string = __commonJS((exports)
|
|
2173
|
+
var require_string = __commonJS(function(exports) {
|
|
2178
2174
|
var stringifyString = require_stringifyString();
|
|
2179
2175
|
var string = {
|
|
2180
2176
|
identify: (value) => typeof value === "string",
|
|
@@ -2190,7 +2186,7 @@ var require_string = __commonJS((exports) => {
|
|
|
2190
2186
|
});
|
|
2191
2187
|
|
|
2192
2188
|
// node_modules/yaml/dist/schema/common/null.js
|
|
2193
|
-
var require_null = __commonJS((exports)
|
|
2189
|
+
var require_null = __commonJS(function(exports) {
|
|
2194
2190
|
var Scalar = require_Scalar();
|
|
2195
2191
|
var nullTag = {
|
|
2196
2192
|
identify: (value) => value == null,
|
|
@@ -2205,7 +2201,7 @@ var require_null = __commonJS((exports) => {
|
|
|
2205
2201
|
});
|
|
2206
2202
|
|
|
2207
2203
|
// node_modules/yaml/dist/schema/core/bool.js
|
|
2208
|
-
var require_bool = __commonJS((exports)
|
|
2204
|
+
var require_bool = __commonJS(function(exports) {
|
|
2209
2205
|
var Scalar = require_Scalar();
|
|
2210
2206
|
var boolTag = {
|
|
2211
2207
|
identify: (value) => typeof value === "boolean",
|
|
@@ -2226,7 +2222,7 @@ var require_bool = __commonJS((exports) => {
|
|
|
2226
2222
|
});
|
|
2227
2223
|
|
|
2228
2224
|
// node_modules/yaml/dist/stringify/stringifyNumber.js
|
|
2229
|
-
var require_stringifyNumber = __commonJS((exports)
|
|
2225
|
+
var require_stringifyNumber = __commonJS(function(exports) {
|
|
2230
2226
|
function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
2231
2227
|
if (typeof value === "bigint")
|
|
2232
2228
|
return String(value);
|
|
@@ -2250,7 +2246,7 @@ var require_stringifyNumber = __commonJS((exports) => {
|
|
|
2250
2246
|
});
|
|
2251
2247
|
|
|
2252
2248
|
// node_modules/yaml/dist/schema/core/float.js
|
|
2253
|
-
var require_float = __commonJS((exports)
|
|
2249
|
+
var require_float = __commonJS(function(exports) {
|
|
2254
2250
|
var Scalar = require_Scalar();
|
|
2255
2251
|
var stringifyNumber = require_stringifyNumber();
|
|
2256
2252
|
var floatNaN = {
|
|
@@ -2293,7 +2289,7 @@ var require_float = __commonJS((exports) => {
|
|
|
2293
2289
|
});
|
|
2294
2290
|
|
|
2295
2291
|
// node_modules/yaml/dist/schema/core/int.js
|
|
2296
|
-
var require_int = __commonJS((exports)
|
|
2292
|
+
var require_int = __commonJS(function(exports) {
|
|
2297
2293
|
var stringifyNumber = require_stringifyNumber();
|
|
2298
2294
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
2299
2295
|
var intResolve = (str, offset, radix, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str.substring(offset), radix);
|
|
@@ -2335,7 +2331,7 @@ var require_int = __commonJS((exports) => {
|
|
|
2335
2331
|
});
|
|
2336
2332
|
|
|
2337
2333
|
// node_modules/yaml/dist/schema/core/schema.js
|
|
2338
|
-
var require_schema = __commonJS((exports)
|
|
2334
|
+
var require_schema = __commonJS(function(exports) {
|
|
2339
2335
|
var map = require_map();
|
|
2340
2336
|
var _null = require_null();
|
|
2341
2337
|
var seq = require_seq();
|
|
@@ -2360,7 +2356,7 @@ var require_schema = __commonJS((exports) => {
|
|
|
2360
2356
|
});
|
|
2361
2357
|
|
|
2362
2358
|
// node_modules/yaml/dist/schema/json/schema.js
|
|
2363
|
-
var require_schema2 = __commonJS((exports)
|
|
2359
|
+
var require_schema2 = __commonJS(function(exports) {
|
|
2364
2360
|
var Scalar = require_Scalar();
|
|
2365
2361
|
var map = require_map();
|
|
2366
2362
|
var seq = require_seq();
|
|
@@ -2424,7 +2420,7 @@ var require_schema2 = __commonJS((exports) => {
|
|
|
2424
2420
|
});
|
|
2425
2421
|
|
|
2426
2422
|
// node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
2427
|
-
var require_binary = __commonJS((exports)
|
|
2423
|
+
var require_binary = __commonJS(function(exports) {
|
|
2428
2424
|
var node_buffer = __require("buffer");
|
|
2429
2425
|
var Scalar = require_Scalar();
|
|
2430
2426
|
var stringifyString = require_stringifyString();
|
|
@@ -2479,7 +2475,7 @@ var require_binary = __commonJS((exports) => {
|
|
|
2479
2475
|
});
|
|
2480
2476
|
|
|
2481
2477
|
// node_modules/yaml/dist/schema/yaml-1.1/pairs.js
|
|
2482
|
-
var require_pairs = __commonJS((exports)
|
|
2478
|
+
var require_pairs = __commonJS(function(exports) {
|
|
2483
2479
|
var identity = require_identity();
|
|
2484
2480
|
var Pair = require_Pair();
|
|
2485
2481
|
var Scalar = require_Scalar();
|
|
@@ -2512,8 +2508,8 @@ ${cn.comment}` : item.comment;
|
|
|
2512
2508
|
}
|
|
2513
2509
|
function createPairs(schema, iterable, ctx) {
|
|
2514
2510
|
const { replacer } = ctx;
|
|
2515
|
-
const
|
|
2516
|
-
|
|
2511
|
+
const pairs = new YAMLSeq.YAMLSeq(schema);
|
|
2512
|
+
pairs.tag = "tag:yaml.org,2002:pairs";
|
|
2517
2513
|
let i = 0;
|
|
2518
2514
|
if (iterable && Symbol.iterator in Object(iterable))
|
|
2519
2515
|
for (let it of iterable) {
|
|
@@ -2537,9 +2533,9 @@ ${cn.comment}` : item.comment;
|
|
|
2537
2533
|
} else {
|
|
2538
2534
|
key = it;
|
|
2539
2535
|
}
|
|
2540
|
-
|
|
2536
|
+
pairs.items.push(Pair.createPair(key, value, ctx));
|
|
2541
2537
|
}
|
|
2542
|
-
return
|
|
2538
|
+
return pairs;
|
|
2543
2539
|
}
|
|
2544
2540
|
var pairs = {
|
|
2545
2541
|
collection: "seq",
|
|
@@ -2554,7 +2550,7 @@ ${cn.comment}` : item.comment;
|
|
|
2554
2550
|
});
|
|
2555
2551
|
|
|
2556
2552
|
// node_modules/yaml/dist/schema/yaml-1.1/omap.js
|
|
2557
|
-
var require_omap = __commonJS((exports)
|
|
2553
|
+
var require_omap = __commonJS(function(exports) {
|
|
2558
2554
|
var identity = require_identity();
|
|
2559
2555
|
var toJS = require_toJS();
|
|
2560
2556
|
var YAMLMap = require_YAMLMap();
|
|
@@ -2593,9 +2589,9 @@ var require_omap = __commonJS((exports) => {
|
|
|
2593
2589
|
}
|
|
2594
2590
|
static from(schema, iterable, ctx) {
|
|
2595
2591
|
const pairs$1 = pairs.createPairs(schema, iterable, ctx);
|
|
2596
|
-
const
|
|
2597
|
-
|
|
2598
|
-
return
|
|
2592
|
+
const omap = new this;
|
|
2593
|
+
omap.items = pairs$1.items;
|
|
2594
|
+
return omap;
|
|
2599
2595
|
}
|
|
2600
2596
|
}
|
|
2601
2597
|
YAMLOMap.tag = "tag:yaml.org,2002:omap";
|
|
@@ -2626,7 +2622,7 @@ var require_omap = __commonJS((exports) => {
|
|
|
2626
2622
|
});
|
|
2627
2623
|
|
|
2628
2624
|
// node_modules/yaml/dist/schema/yaml-1.1/bool.js
|
|
2629
|
-
var require_bool2 = __commonJS((exports)
|
|
2625
|
+
var require_bool2 = __commonJS(function(exports) {
|
|
2630
2626
|
var Scalar = require_Scalar();
|
|
2631
2627
|
function boolStringify({ value, source }, ctx) {
|
|
2632
2628
|
const boolObj = value ? trueTag : falseTag;
|
|
@@ -2655,7 +2651,7 @@ var require_bool2 = __commonJS((exports) => {
|
|
|
2655
2651
|
});
|
|
2656
2652
|
|
|
2657
2653
|
// node_modules/yaml/dist/schema/yaml-1.1/float.js
|
|
2658
|
-
var require_float2 = __commonJS((exports)
|
|
2654
|
+
var require_float2 = __commonJS(function(exports) {
|
|
2659
2655
|
var Scalar = require_Scalar();
|
|
2660
2656
|
var stringifyNumber = require_stringifyNumber();
|
|
2661
2657
|
var floatNaN = {
|
|
@@ -2701,7 +2697,7 @@ var require_float2 = __commonJS((exports) => {
|
|
|
2701
2697
|
});
|
|
2702
2698
|
|
|
2703
2699
|
// node_modules/yaml/dist/schema/yaml-1.1/int.js
|
|
2704
|
-
var require_int2 = __commonJS((exports)
|
|
2700
|
+
var require_int2 = __commonJS(function(exports) {
|
|
2705
2701
|
var stringifyNumber = require_stringifyNumber();
|
|
2706
2702
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
2707
2703
|
function intResolve(str, offset, radix, { intAsBigInt }) {
|
|
@@ -2721,8 +2717,8 @@ var require_int2 = __commonJS((exports) => {
|
|
|
2721
2717
|
str = `0x${str}`;
|
|
2722
2718
|
break;
|
|
2723
2719
|
}
|
|
2724
|
-
const
|
|
2725
|
-
return sign === "-" ? BigInt(-1) *
|
|
2720
|
+
const n = BigInt(str);
|
|
2721
|
+
return sign === "-" ? BigInt(-1) * n : n;
|
|
2726
2722
|
}
|
|
2727
2723
|
const n = parseInt(str, radix);
|
|
2728
2724
|
return sign === "-" ? -1 * n : n;
|
|
@@ -2777,7 +2773,7 @@ var require_int2 = __commonJS((exports) => {
|
|
|
2777
2773
|
});
|
|
2778
2774
|
|
|
2779
2775
|
// node_modules/yaml/dist/schema/yaml-1.1/set.js
|
|
2780
|
-
var require_set = __commonJS((exports)
|
|
2776
|
+
var require_set = __commonJS(function(exports) {
|
|
2781
2777
|
var identity = require_identity();
|
|
2782
2778
|
var Pair = require_Pair();
|
|
2783
2779
|
var YAMLMap = require_YAMLMap();
|
|
@@ -2826,14 +2822,14 @@ var require_set = __commonJS((exports) => {
|
|
|
2826
2822
|
}
|
|
2827
2823
|
static from(schema, iterable, ctx) {
|
|
2828
2824
|
const { replacer } = ctx;
|
|
2829
|
-
const
|
|
2825
|
+
const set = new this(schema);
|
|
2830
2826
|
if (iterable && Symbol.iterator in Object(iterable))
|
|
2831
2827
|
for (let value of iterable) {
|
|
2832
2828
|
if (typeof replacer === "function")
|
|
2833
2829
|
value = replacer.call(iterable, value, value);
|
|
2834
|
-
|
|
2830
|
+
set.items.push(Pair.createPair(value, null, ctx));
|
|
2835
2831
|
}
|
|
2836
|
-
return
|
|
2832
|
+
return set;
|
|
2837
2833
|
}
|
|
2838
2834
|
}
|
|
2839
2835
|
YAMLSet.tag = "tag:yaml.org,2002:set";
|
|
@@ -2860,13 +2856,13 @@ var require_set = __commonJS((exports) => {
|
|
|
2860
2856
|
});
|
|
2861
2857
|
|
|
2862
2858
|
// node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
|
|
2863
|
-
var require_timestamp = __commonJS((exports)
|
|
2859
|
+
var require_timestamp = __commonJS(function(exports) {
|
|
2864
2860
|
var stringifyNumber = require_stringifyNumber();
|
|
2865
2861
|
function parseSexagesimal(str, asBigInt) {
|
|
2866
2862
|
const sign = str[0];
|
|
2867
2863
|
const parts = sign === "-" || sign === "+" ? str.substring(1) : str;
|
|
2868
2864
|
const num = (n) => asBigInt ? BigInt(n) : Number(n);
|
|
2869
|
-
const res = parts.replace(/_/g, "").split(":").reduce((
|
|
2865
|
+
const res = parts.replace(/_/g, "").split(":").reduce((res, p) => res * num(60) + num(p), num(0));
|
|
2870
2866
|
return sign === "-" ? num(-1) * res : res;
|
|
2871
2867
|
}
|
|
2872
2868
|
function stringifySexagesimal(node) {
|
|
@@ -2942,7 +2938,7 @@ var require_timestamp = __commonJS((exports) => {
|
|
|
2942
2938
|
});
|
|
2943
2939
|
|
|
2944
2940
|
// node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
2945
|
-
var require_schema3 = __commonJS((exports)
|
|
2941
|
+
var require_schema3 = __commonJS(function(exports) {
|
|
2946
2942
|
var map = require_map();
|
|
2947
2943
|
var _null = require_null();
|
|
2948
2944
|
var seq = require_seq();
|
|
@@ -2983,7 +2979,7 @@ var require_schema3 = __commonJS((exports) => {
|
|
|
2983
2979
|
});
|
|
2984
2980
|
|
|
2985
2981
|
// node_modules/yaml/dist/schema/tags.js
|
|
2986
|
-
var require_tags = __commonJS((exports)
|
|
2982
|
+
var require_tags = __commonJS(function(exports) {
|
|
2987
2983
|
var map = require_map();
|
|
2988
2984
|
var _null = require_null();
|
|
2989
2985
|
var seq = require_seq();
|
|
@@ -3057,16 +3053,16 @@ var require_tags = __commonJS((exports) => {
|
|
|
3057
3053
|
}
|
|
3058
3054
|
if (addMergeTag)
|
|
3059
3055
|
tags = tags.concat(merge.merge);
|
|
3060
|
-
return tags.reduce((
|
|
3056
|
+
return tags.reduce((tags, tag) => {
|
|
3061
3057
|
const tagObj = typeof tag === "string" ? tagsByName[tag] : tag;
|
|
3062
3058
|
if (!tagObj) {
|
|
3063
3059
|
const tagName = JSON.stringify(tag);
|
|
3064
3060
|
const keys = Object.keys(tagsByName).map((key) => JSON.stringify(key)).join(", ");
|
|
3065
3061
|
throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
|
|
3066
3062
|
}
|
|
3067
|
-
if (!
|
|
3068
|
-
|
|
3069
|
-
return
|
|
3063
|
+
if (!tags.includes(tagObj))
|
|
3064
|
+
tags.push(tagObj);
|
|
3065
|
+
return tags;
|
|
3070
3066
|
}, []);
|
|
3071
3067
|
}
|
|
3072
3068
|
exports.coreKnownTags = coreKnownTags;
|
|
@@ -3074,7 +3070,7 @@ var require_tags = __commonJS((exports) => {
|
|
|
3074
3070
|
});
|
|
3075
3071
|
|
|
3076
3072
|
// node_modules/yaml/dist/schema/Schema.js
|
|
3077
|
-
var require_Schema = __commonJS((exports)
|
|
3073
|
+
var require_Schema = __commonJS(function(exports) {
|
|
3078
3074
|
var identity = require_identity();
|
|
3079
3075
|
var map = require_map();
|
|
3080
3076
|
var seq = require_seq();
|
|
@@ -3104,7 +3100,7 @@ var require_Schema = __commonJS((exports) => {
|
|
|
3104
3100
|
});
|
|
3105
3101
|
|
|
3106
3102
|
// node_modules/yaml/dist/stringify/stringifyDocument.js
|
|
3107
|
-
var require_stringifyDocument = __commonJS((exports)
|
|
3103
|
+
var require_stringifyDocument = __commonJS(function(exports) {
|
|
3108
3104
|
var identity = require_identity();
|
|
3109
3105
|
var stringify = require_stringify();
|
|
3110
3106
|
var stringifyComment = require_stringifyComment();
|
|
@@ -3184,7 +3180,7 @@ var require_stringifyDocument = __commonJS((exports) => {
|
|
|
3184
3180
|
});
|
|
3185
3181
|
|
|
3186
3182
|
// node_modules/yaml/dist/doc/Document.js
|
|
3187
|
-
var require_Document = __commonJS((exports)
|
|
3183
|
+
var require_Document = __commonJS(function(exports) {
|
|
3188
3184
|
var Alias = require_Alias();
|
|
3189
3185
|
var Collection = require_Collection();
|
|
3190
3186
|
var identity = require_identity();
|
|
@@ -3393,8 +3389,8 @@ var require_Document = __commonJS((exports) => {
|
|
|
3393
3389
|
};
|
|
3394
3390
|
const res = toJS.toJS(this.contents, jsonArg ?? "", ctx);
|
|
3395
3391
|
if (typeof onAnchor === "function")
|
|
3396
|
-
for (const { count, res
|
|
3397
|
-
onAnchor(
|
|
3392
|
+
for (const { count, res } of ctx.anchors.values())
|
|
3393
|
+
onAnchor(res, count);
|
|
3398
3394
|
return typeof reviver === "function" ? applyReviver.applyReviver(reviver, { "": res }, "", res) : res;
|
|
3399
3395
|
}
|
|
3400
3396
|
toJSON(jsonArg, onAnchor) {
|
|
@@ -3419,7 +3415,7 @@ var require_Document = __commonJS((exports) => {
|
|
|
3419
3415
|
});
|
|
3420
3416
|
|
|
3421
3417
|
// node_modules/yaml/dist/errors.js
|
|
3422
|
-
var require_errors = __commonJS((exports)
|
|
3418
|
+
var require_errors = __commonJS(function(exports) {
|
|
3423
3419
|
class YAMLError extends Error {
|
|
3424
3420
|
constructor(name, pos, code, message) {
|
|
3425
3421
|
super();
|
|
@@ -3484,7 +3480,7 @@ ${pointer}
|
|
|
3484
3480
|
});
|
|
3485
3481
|
|
|
3486
3482
|
// node_modules/yaml/dist/compose/resolve-props.js
|
|
3487
|
-
var require_resolve_props = __commonJS((exports)
|
|
3483
|
+
var require_resolve_props = __commonJS(function(exports) {
|
|
3488
3484
|
function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
|
|
3489
3485
|
let spaceBefore = false;
|
|
3490
3486
|
let atNewline = startOnNewline;
|
|
@@ -3614,7 +3610,7 @@ var require_resolve_props = __commonJS((exports) => {
|
|
|
3614
3610
|
});
|
|
3615
3611
|
|
|
3616
3612
|
// node_modules/yaml/dist/compose/util-contains-newline.js
|
|
3617
|
-
var require_util_contains_newline = __commonJS((exports)
|
|
3613
|
+
var require_util_contains_newline = __commonJS(function(exports) {
|
|
3618
3614
|
function containsNewline(key) {
|
|
3619
3615
|
if (!key)
|
|
3620
3616
|
return null;
|
|
@@ -3654,7 +3650,7 @@ var require_util_contains_newline = __commonJS((exports) => {
|
|
|
3654
3650
|
});
|
|
3655
3651
|
|
|
3656
3652
|
// node_modules/yaml/dist/compose/util-flow-indent-check.js
|
|
3657
|
-
var require_util_flow_indent_check = __commonJS((exports)
|
|
3653
|
+
var require_util_flow_indent_check = __commonJS(function(exports) {
|
|
3658
3654
|
var utilContainsNewline = require_util_contains_newline();
|
|
3659
3655
|
function flowIndentCheck(indent, fc, onError) {
|
|
3660
3656
|
if (fc?.type === "flow-collection") {
|
|
@@ -3669,7 +3665,7 @@ var require_util_flow_indent_check = __commonJS((exports) => {
|
|
|
3669
3665
|
});
|
|
3670
3666
|
|
|
3671
3667
|
// node_modules/yaml/dist/compose/util-map-includes.js
|
|
3672
|
-
var require_util_map_includes = __commonJS((exports)
|
|
3668
|
+
var require_util_map_includes = __commonJS(function(exports) {
|
|
3673
3669
|
var identity = require_identity();
|
|
3674
3670
|
function mapIncludes(ctx, items, search) {
|
|
3675
3671
|
const { uniqueKeys } = ctx.options;
|
|
@@ -3682,7 +3678,7 @@ var require_util_map_includes = __commonJS((exports) => {
|
|
|
3682
3678
|
});
|
|
3683
3679
|
|
|
3684
3680
|
// node_modules/yaml/dist/compose/resolve-block-map.js
|
|
3685
|
-
var require_resolve_block_map = __commonJS((exports)
|
|
3681
|
+
var require_resolve_block_map = __commonJS(function(exports) {
|
|
3686
3682
|
var Pair = require_Pair();
|
|
3687
3683
|
var YAMLMap = require_YAMLMap();
|
|
3688
3684
|
var resolveProps = require_resolve_props();
|
|
@@ -3789,7 +3785,7 @@ var require_resolve_block_map = __commonJS((exports) => {
|
|
|
3789
3785
|
});
|
|
3790
3786
|
|
|
3791
3787
|
// node_modules/yaml/dist/compose/resolve-block-seq.js
|
|
3792
|
-
var require_resolve_block_seq = __commonJS((exports)
|
|
3788
|
+
var require_resolve_block_seq = __commonJS(function(exports) {
|
|
3793
3789
|
var YAMLSeq = require_YAMLSeq();
|
|
3794
3790
|
var resolveProps = require_resolve_props();
|
|
3795
3791
|
var utilFlowIndentCheck = require_util_flow_indent_check();
|
|
@@ -3837,7 +3833,7 @@ var require_resolve_block_seq = __commonJS((exports) => {
|
|
|
3837
3833
|
});
|
|
3838
3834
|
|
|
3839
3835
|
// node_modules/yaml/dist/compose/resolve-end.js
|
|
3840
|
-
var require_resolve_end = __commonJS((exports)
|
|
3836
|
+
var require_resolve_end = __commonJS(function(exports) {
|
|
3841
3837
|
function resolveEnd(end, offset, reqSpace, onError) {
|
|
3842
3838
|
let comment = "";
|
|
3843
3839
|
if (end) {
|
|
@@ -3877,7 +3873,7 @@ var require_resolve_end = __commonJS((exports) => {
|
|
|
3877
3873
|
});
|
|
3878
3874
|
|
|
3879
3875
|
// node_modules/yaml/dist/compose/resolve-flow-collection.js
|
|
3880
|
-
var require_resolve_flow_collection = __commonJS((exports)
|
|
3876
|
+
var require_resolve_flow_collection = __commonJS(function(exports) {
|
|
3881
3877
|
var identity = require_identity();
|
|
3882
3878
|
var Pair = require_Pair();
|
|
3883
3879
|
var YAMLMap = require_YAMLMap();
|
|
@@ -4068,7 +4064,7 @@ var require_resolve_flow_collection = __commonJS((exports) => {
|
|
|
4068
4064
|
});
|
|
4069
4065
|
|
|
4070
4066
|
// node_modules/yaml/dist/compose/compose-collection.js
|
|
4071
|
-
var require_compose_collection = __commonJS((exports)
|
|
4067
|
+
var require_compose_collection = __commonJS(function(exports) {
|
|
4072
4068
|
var identity = require_identity();
|
|
4073
4069
|
var Scalar = require_Scalar();
|
|
4074
4070
|
var YAMLMap = require_YAMLMap();
|
|
@@ -4130,7 +4126,7 @@ var require_compose_collection = __commonJS((exports) => {
|
|
|
4130
4126
|
});
|
|
4131
4127
|
|
|
4132
4128
|
// node_modules/yaml/dist/compose/resolve-block-scalar.js
|
|
4133
|
-
var require_resolve_block_scalar = __commonJS((exports)
|
|
4129
|
+
var require_resolve_block_scalar = __commonJS(function(exports) {
|
|
4134
4130
|
var Scalar = require_Scalar();
|
|
4135
4131
|
function resolveBlockScalar(ctx, scalar, onError) {
|
|
4136
4132
|
const start = scalar.offset;
|
|
@@ -4148,12 +4144,12 @@ var require_resolve_block_scalar = __commonJS((exports) => {
|
|
|
4148
4144
|
break;
|
|
4149
4145
|
}
|
|
4150
4146
|
if (chompStart === 0) {
|
|
4151
|
-
const
|
|
4147
|
+
const value = header.chomp === "+" && lines.length > 0 ? `
|
|
4152
4148
|
`.repeat(Math.max(1, lines.length - 1)) : "";
|
|
4153
|
-
let
|
|
4149
|
+
let end = start + header.length;
|
|
4154
4150
|
if (scalar.source)
|
|
4155
|
-
|
|
4156
|
-
return { value
|
|
4151
|
+
end += scalar.source.length;
|
|
4152
|
+
return { value, type, comment: header.comment, range: [start, end, end] };
|
|
4157
4153
|
}
|
|
4158
4154
|
let trimIndent = scalar.indent + header.indent;
|
|
4159
4155
|
let offset = scalar.offset + header.length;
|
|
@@ -4323,7 +4319,7 @@ var require_resolve_block_scalar = __commonJS((exports) => {
|
|
|
4323
4319
|
});
|
|
4324
4320
|
|
|
4325
4321
|
// node_modules/yaml/dist/compose/resolve-flow-scalar.js
|
|
4326
|
-
var require_resolve_flow_scalar = __commonJS((exports)
|
|
4322
|
+
var require_resolve_flow_scalar = __commonJS(function(exports) {
|
|
4327
4323
|
var Scalar = require_Scalar();
|
|
4328
4324
|
var resolveEnd = require_resolve_end();
|
|
4329
4325
|
function resolveFlowScalar(scalar, strict, onError) {
|
|
@@ -4539,7 +4535,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
4539
4535
|
});
|
|
4540
4536
|
|
|
4541
4537
|
// node_modules/yaml/dist/compose/compose-scalar.js
|
|
4542
|
-
var require_compose_scalar = __commonJS((exports)
|
|
4538
|
+
var require_compose_scalar = __commonJS(function(exports) {
|
|
4543
4539
|
var identity = require_identity();
|
|
4544
4540
|
var Scalar = require_Scalar();
|
|
4545
4541
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
@@ -4601,9 +4597,9 @@ var require_compose_scalar = __commonJS((exports) => {
|
|
|
4601
4597
|
return schema[identity.SCALAR];
|
|
4602
4598
|
}
|
|
4603
4599
|
function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
|
|
4604
|
-
const tag = schema.tags.find((
|
|
4600
|
+
const tag = schema.tags.find((tag) => (tag.default === true || atKey && tag.default === "key") && tag.test?.test(value)) || schema[identity.SCALAR];
|
|
4605
4601
|
if (schema.compat) {
|
|
4606
|
-
const compat = schema.compat.find((
|
|
4602
|
+
const compat = schema.compat.find((tag) => tag.default && tag.test?.test(value)) ?? schema[identity.SCALAR];
|
|
4607
4603
|
if (tag.tag !== compat.tag) {
|
|
4608
4604
|
const ts = directives.tagString(tag.tag);
|
|
4609
4605
|
const cs = directives.tagString(compat.tag);
|
|
@@ -4617,7 +4613,7 @@ var require_compose_scalar = __commonJS((exports) => {
|
|
|
4617
4613
|
});
|
|
4618
4614
|
|
|
4619
4615
|
// node_modules/yaml/dist/compose/util-empty-scalar-position.js
|
|
4620
|
-
var require_util_empty_scalar_position = __commonJS((exports)
|
|
4616
|
+
var require_util_empty_scalar_position = __commonJS(function(exports) {
|
|
4621
4617
|
function emptyScalarPosition(offset, before, pos) {
|
|
4622
4618
|
if (before) {
|
|
4623
4619
|
pos ?? (pos = before.length);
|
|
@@ -4644,7 +4640,7 @@ var require_util_empty_scalar_position = __commonJS((exports) => {
|
|
|
4644
4640
|
});
|
|
4645
4641
|
|
|
4646
4642
|
// node_modules/yaml/dist/compose/compose-node.js
|
|
4647
|
-
var require_compose_node = __commonJS((exports)
|
|
4643
|
+
var require_compose_node = __commonJS(function(exports) {
|
|
4648
4644
|
var Alias = require_Alias();
|
|
4649
4645
|
var identity = require_identity();
|
|
4650
4646
|
var composeCollection = require_compose_collection();
|
|
@@ -4747,7 +4743,7 @@ var require_compose_node = __commonJS((exports) => {
|
|
|
4747
4743
|
});
|
|
4748
4744
|
|
|
4749
4745
|
// node_modules/yaml/dist/compose/compose-doc.js
|
|
4750
|
-
var require_compose_doc = __commonJS((exports)
|
|
4746
|
+
var require_compose_doc = __commonJS(function(exports) {
|
|
4751
4747
|
var Document = require_Document();
|
|
4752
4748
|
var composeNode = require_compose_node();
|
|
4753
4749
|
var resolveEnd = require_resolve_end();
|
|
@@ -4787,7 +4783,7 @@ var require_compose_doc = __commonJS((exports) => {
|
|
|
4787
4783
|
});
|
|
4788
4784
|
|
|
4789
4785
|
// node_modules/yaml/dist/compose/composer.js
|
|
4790
|
-
var require_composer = __commonJS((exports)
|
|
4786
|
+
var require_composer = __commonJS(function(exports) {
|
|
4791
4787
|
var node_process = __require("process");
|
|
4792
4788
|
var directives = require_directives();
|
|
4793
4789
|
var Document = require_Document();
|
|
@@ -4978,7 +4974,7 @@ ${end.comment}` : end.comment;
|
|
|
4978
4974
|
});
|
|
4979
4975
|
|
|
4980
4976
|
// node_modules/yaml/dist/parse/cst-scalar.js
|
|
4981
|
-
var require_cst_scalar = __commonJS((exports)
|
|
4977
|
+
var require_cst_scalar = __commonJS(function(exports) {
|
|
4982
4978
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
4983
4979
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
4984
4980
|
var errors = require_errors();
|
|
@@ -5168,7 +5164,7 @@ var require_cst_scalar = __commonJS((exports) => {
|
|
|
5168
5164
|
});
|
|
5169
5165
|
|
|
5170
5166
|
// node_modules/yaml/dist/parse/cst-stringify.js
|
|
5171
|
-
var require_cst_stringify = __commonJS((exports)
|
|
5167
|
+
var require_cst_stringify = __commonJS(function(exports) {
|
|
5172
5168
|
var stringify = (cst) => ("type" in cst) ? stringifyToken(cst) : stringifyItem(cst);
|
|
5173
5169
|
function stringifyToken(token) {
|
|
5174
5170
|
switch (token.type) {
|
|
@@ -5226,7 +5222,7 @@ var require_cst_stringify = __commonJS((exports) => {
|
|
|
5226
5222
|
});
|
|
5227
5223
|
|
|
5228
5224
|
// node_modules/yaml/dist/parse/cst-visit.js
|
|
5229
|
-
var require_cst_visit = __commonJS((exports)
|
|
5225
|
+
var require_cst_visit = __commonJS(function(exports) {
|
|
5230
5226
|
var BREAK = Symbol("break visit");
|
|
5231
5227
|
var SKIP = Symbol("skip children");
|
|
5232
5228
|
var REMOVE = Symbol("remove item");
|
|
@@ -5285,7 +5281,7 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
5285
5281
|
});
|
|
5286
5282
|
|
|
5287
5283
|
// node_modules/yaml/dist/parse/cst.js
|
|
5288
|
-
var require_cst = __commonJS((exports)
|
|
5284
|
+
var require_cst = __commonJS(function(exports) {
|
|
5289
5285
|
var cstScalar = require_cst_scalar();
|
|
5290
5286
|
var cstStringify = require_cst_stringify();
|
|
5291
5287
|
var cstVisit = require_cst_visit();
|
|
@@ -5386,7 +5382,7 @@ var require_cst = __commonJS((exports) => {
|
|
|
5386
5382
|
});
|
|
5387
5383
|
|
|
5388
5384
|
// node_modules/yaml/dist/parse/lexer.js
|
|
5389
|
-
var require_lexer = __commonJS((exports)
|
|
5385
|
+
var require_lexer = __commonJS(function(exports) {
|
|
5390
5386
|
var cst = require_cst();
|
|
5391
5387
|
function isEmpty(ch) {
|
|
5392
5388
|
switch (ch) {
|
|
@@ -5759,18 +5755,18 @@ var require_lexer = __commonJS((exports) => {
|
|
|
5759
5755
|
let indent = 0;
|
|
5760
5756
|
let ch;
|
|
5761
5757
|
loop:
|
|
5762
|
-
for (let
|
|
5758
|
+
for (let i = this.pos;ch = this.buffer[i]; ++i) {
|
|
5763
5759
|
switch (ch) {
|
|
5764
5760
|
case " ":
|
|
5765
5761
|
indent += 1;
|
|
5766
5762
|
break;
|
|
5767
5763
|
case `
|
|
5768
5764
|
`:
|
|
5769
|
-
nl =
|
|
5765
|
+
nl = i;
|
|
5770
5766
|
indent = 0;
|
|
5771
5767
|
break;
|
|
5772
5768
|
case "\r": {
|
|
5773
|
-
const next = this.buffer[
|
|
5769
|
+
const next = this.buffer[i + 1];
|
|
5774
5770
|
if (!next && !this.atEnd)
|
|
5775
5771
|
return this.setNext("block-scalar");
|
|
5776
5772
|
if (next === `
|
|
@@ -5813,16 +5809,16 @@ var require_lexer = __commonJS((exports) => {
|
|
|
5813
5809
|
nl = i - 1;
|
|
5814
5810
|
} else if (!this.blockScalarKeep) {
|
|
5815
5811
|
do {
|
|
5816
|
-
let
|
|
5817
|
-
let
|
|
5818
|
-
if (
|
|
5819
|
-
|
|
5820
|
-
const lastChar =
|
|
5821
|
-
while (
|
|
5822
|
-
|
|
5823
|
-
if (
|
|
5824
|
-
` &&
|
|
5825
|
-
nl =
|
|
5812
|
+
let i = nl - 1;
|
|
5813
|
+
let ch = this.buffer[i];
|
|
5814
|
+
if (ch === "\r")
|
|
5815
|
+
ch = this.buffer[--i];
|
|
5816
|
+
const lastChar = i;
|
|
5817
|
+
while (ch === " ")
|
|
5818
|
+
ch = this.buffer[--i];
|
|
5819
|
+
if (ch === `
|
|
5820
|
+
` && i >= this.pos && i + 1 + indent > lastChar)
|
|
5821
|
+
nl = i;
|
|
5826
5822
|
else
|
|
5827
5823
|
break;
|
|
5828
5824
|
} while (true);
|
|
@@ -5983,7 +5979,7 @@ var require_lexer = __commonJS((exports) => {
|
|
|
5983
5979
|
});
|
|
5984
5980
|
|
|
5985
5981
|
// node_modules/yaml/dist/parse/line-counter.js
|
|
5986
|
-
var require_line_counter = __commonJS((exports)
|
|
5982
|
+
var require_line_counter = __commonJS(function(exports) {
|
|
5987
5983
|
class LineCounter {
|
|
5988
5984
|
constructor() {
|
|
5989
5985
|
this.lineStarts = [];
|
|
@@ -6011,7 +6007,7 @@ var require_line_counter = __commonJS((exports) => {
|
|
|
6011
6007
|
});
|
|
6012
6008
|
|
|
6013
6009
|
// node_modules/yaml/dist/parse/parser.js
|
|
6014
|
-
var require_parser = __commonJS((exports)
|
|
6010
|
+
var require_parser = __commonJS(function(exports) {
|
|
6015
6011
|
var node_process = __require("process");
|
|
6016
6012
|
var cst = require_cst();
|
|
6017
6013
|
var lexer = require_lexer();
|
|
@@ -6509,12 +6505,12 @@ var require_parser = __commonJS((exports) => {
|
|
|
6509
6505
|
if (includesToken(it.start, "newline")) {
|
|
6510
6506
|
Object.assign(it, { key: null, sep: [this.sourceToken] });
|
|
6511
6507
|
} else {
|
|
6512
|
-
const
|
|
6508
|
+
const start = getFirstKeyStartProps(it.start);
|
|
6513
6509
|
this.stack.push({
|
|
6514
6510
|
type: "block-map",
|
|
6515
6511
|
offset: this.offset,
|
|
6516
6512
|
indent: this.indent,
|
|
6517
|
-
items: [{ start
|
|
6513
|
+
items: [{ start, key: null, sep: [this.sourceToken] }]
|
|
6518
6514
|
});
|
|
6519
6515
|
}
|
|
6520
6516
|
} else if (it.value) {
|
|
@@ -6527,7 +6523,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
6527
6523
|
items: [{ start, key: null, sep: [this.sourceToken] }]
|
|
6528
6524
|
});
|
|
6529
6525
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
6530
|
-
const
|
|
6526
|
+
const start = getFirstKeyStartProps(it.start);
|
|
6531
6527
|
const key = it.key;
|
|
6532
6528
|
const sep = it.sep;
|
|
6533
6529
|
sep.push(this.sourceToken);
|
|
@@ -6537,7 +6533,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
6537
6533
|
type: "block-map",
|
|
6538
6534
|
offset: this.offset,
|
|
6539
6535
|
indent: this.indent,
|
|
6540
|
-
items: [{ start
|
|
6536
|
+
items: [{ start, key, sep }]
|
|
6541
6537
|
});
|
|
6542
6538
|
} else if (start.length > 0) {
|
|
6543
6539
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -6867,7 +6863,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
6867
6863
|
});
|
|
6868
6864
|
|
|
6869
6865
|
// node_modules/yaml/dist/public-api.js
|
|
6870
|
-
var require_public_api = __commonJS((exports)
|
|
6866
|
+
var require_public_api = __commonJS(function(exports) {
|
|
6871
6867
|
var composer = require_composer();
|
|
6872
6868
|
var Document = require_Document();
|
|
6873
6869
|
var errors = require_errors();
|
|
@@ -6881,22 +6877,22 @@ var require_public_api = __commonJS((exports) => {
|
|
|
6881
6877
|
return { lineCounter: lineCounter$1, prettyErrors };
|
|
6882
6878
|
}
|
|
6883
6879
|
function parseAllDocuments(source, options = {}) {
|
|
6884
|
-
const { lineCounter
|
|
6885
|
-
const parser$1 = new parser.Parser(
|
|
6880
|
+
const { lineCounter, prettyErrors } = parseOptions(options);
|
|
6881
|
+
const parser$1 = new parser.Parser(lineCounter?.addNewLine);
|
|
6886
6882
|
const composer$1 = new composer.Composer(options);
|
|
6887
6883
|
const docs = Array.from(composer$1.compose(parser$1.parse(source)));
|
|
6888
|
-
if (prettyErrors &&
|
|
6884
|
+
if (prettyErrors && lineCounter)
|
|
6889
6885
|
for (const doc of docs) {
|
|
6890
|
-
doc.errors.forEach(errors.prettifyError(source,
|
|
6891
|
-
doc.warnings.forEach(errors.prettifyError(source,
|
|
6886
|
+
doc.errors.forEach(errors.prettifyError(source, lineCounter));
|
|
6887
|
+
doc.warnings.forEach(errors.prettifyError(source, lineCounter));
|
|
6892
6888
|
}
|
|
6893
6889
|
if (docs.length > 0)
|
|
6894
6890
|
return docs;
|
|
6895
6891
|
return Object.assign([], { empty: true }, composer$1.streamInfo());
|
|
6896
6892
|
}
|
|
6897
6893
|
function parseDocument(source, options = {}) {
|
|
6898
|
-
const { lineCounter
|
|
6899
|
-
const parser$1 = new parser.Parser(
|
|
6894
|
+
const { lineCounter, prettyErrors } = parseOptions(options);
|
|
6895
|
+
const parser$1 = new parser.Parser(lineCounter?.addNewLine);
|
|
6900
6896
|
const composer$1 = new composer.Composer(options);
|
|
6901
6897
|
let doc = null;
|
|
6902
6898
|
for (const _doc of composer$1.compose(parser$1.parse(source), true, source.length)) {
|
|
@@ -6907,9 +6903,9 @@ var require_public_api = __commonJS((exports) => {
|
|
|
6907
6903
|
break;
|
|
6908
6904
|
}
|
|
6909
6905
|
}
|
|
6910
|
-
if (prettyErrors &&
|
|
6911
|
-
doc.errors.forEach(errors.prettifyError(source,
|
|
6912
|
-
doc.warnings.forEach(errors.prettifyError(source,
|
|
6906
|
+
if (prettyErrors && lineCounter) {
|
|
6907
|
+
doc.errors.forEach(errors.prettifyError(source, lineCounter));
|
|
6908
|
+
doc.warnings.forEach(errors.prettifyError(source, lineCounter));
|
|
6913
6909
|
}
|
|
6914
6910
|
return doc;
|
|
6915
6911
|
}
|
|
@@ -7015,6 +7011,46 @@ var init_workflows = __esm(() => {
|
|
|
7015
7011
|
workflows_default = {
|
|
7016
7012
|
schemaVersion: 1,
|
|
7017
7013
|
workflows: [
|
|
7014
|
+
{
|
|
7015
|
+
id: "hyperliquid-wallet-audit",
|
|
7016
|
+
protocol: "Hyperliquid",
|
|
7017
|
+
title: "Find fees, funding costs and exposure in a public wallet",
|
|
7018
|
+
skill: "hyperliquid-wallet-audit",
|
|
7019
|
+
pack: "hyperliquid-skills",
|
|
7020
|
+
inputs: ["Public account address and mainnet or testnet", "UTC startTime and endTime for the activity window", "Maximum history pages and explicit coverage limits"],
|
|
7021
|
+
output: "Reproducible wallet diagnostics with captured source hashes, observed realized PnL, signed fees and funding, maker/taker costs, current exposure and explicit history gaps.",
|
|
7022
|
+
access: "Bounded official Hyperliquid public info reads; no trading key or wallet connection. Default perpetual activity is distinct from a complete portfolio or verified investment return."
|
|
7023
|
+
},
|
|
7024
|
+
{
|
|
7025
|
+
id: "strategy-validation",
|
|
7026
|
+
protocol: "Strategy research",
|
|
7027
|
+
title: "Validate a frozen rule with higher costs and a held-out period",
|
|
7028
|
+
skill: "galleon-defi-strategy-backtest",
|
|
7029
|
+
pack: "defi-strategy-skills",
|
|
7030
|
+
inputs: ["Absolute dataFile and specFile paths for a sourced daily USD series and frozen rule", "Optional splitIndex for the first held-out observation", "Baseline fees/slippage and higher-cost assumptions"],
|
|
7031
|
+
output: "Separate baseline and higher-cost results for development and held-out periods, same-cost benchmarks, trade logs, input hashes and explicit independent restart accounting.",
|
|
7032
|
+
access: "Local Node.js helper with no wallet or network request; no parameter optimization, live execution or forward-return claim."
|
|
7033
|
+
},
|
|
7034
|
+
{
|
|
7035
|
+
id: "hyperliquid-market",
|
|
7036
|
+
protocol: "Hyperliquid",
|
|
7037
|
+
title: "Research a Hyperliquid market before planning a trade",
|
|
7038
|
+
skill: "hyperliquid-analyze",
|
|
7039
|
+
pack: "hyperliquid-skills",
|
|
7040
|
+
inputs: ["Exact network, market and DEX identity", "Research question, observation window and freshness limit", "Liquidity, funding and catalyst evidence requirements"],
|
|
7041
|
+
output: "Cited market/funding/liquidity evidence, supported thesis and invalidation conditions with data gaps; historical, paper and live evidence stay separate.",
|
|
7042
|
+
access: "Existing official public info reads or explicitly configured tools; market analysis grants no financial authority."
|
|
7043
|
+
},
|
|
7044
|
+
{
|
|
7045
|
+
id: "hyperliquid-review",
|
|
7046
|
+
protocol: "Hyperliquid",
|
|
7047
|
+
title: "Review a completed trade against its original intent",
|
|
7048
|
+
skill: "hyperliquid-review",
|
|
7049
|
+
pack: "hyperliquid-skills",
|
|
7050
|
+
inputs: ["Account, market/DEX and completed trade window", "Original ticket, risk unit, order/fill identities and exchange history", "Signed fees/funding, position changes and incident record"],
|
|
7051
|
+
output: "Reconciled trade outcome and cost accounting with a separate process grade, incident findings and one supported follow-up test.",
|
|
7052
|
+
access: "Read-only exchange history and local arithmetic; a profitable result does not establish that controls or authorization were respected."
|
|
7053
|
+
},
|
|
7018
7054
|
{
|
|
7019
7055
|
id: "market-snapshot",
|
|
7020
7056
|
protocol: "Market data",
|
|
@@ -7387,20 +7423,6 @@ var init_workflows = __esm(() => {
|
|
|
7387
7423
|
});
|
|
7388
7424
|
|
|
7389
7425
|
// src/core.ts
|
|
7390
|
-
var exports_core = {};
|
|
7391
|
-
__export(exports_core, {
|
|
7392
|
-
selectPacks: () => selectPacks,
|
|
7393
|
-
parseHarness: () => parseHarness,
|
|
7394
|
-
parseConfig: () => parseConfig,
|
|
7395
|
-
parseCatalog: () => parseCatalog,
|
|
7396
|
-
installedVersion: () => installedVersion,
|
|
7397
|
-
installArgs: () => installArgs,
|
|
7398
|
-
identity: () => identity2,
|
|
7399
|
-
harnesses: () => harnesses,
|
|
7400
|
-
fetchCatalog: () => fetchCatalog,
|
|
7401
|
-
compatibilitySetupMessage: () => compatibilitySetupMessage,
|
|
7402
|
-
catalogChanges: () => catalogChanges
|
|
7403
|
-
});
|
|
7404
7426
|
import { resolve } from "path";
|
|
7405
7427
|
function compatibilitySetupMessage(harness) {
|
|
7406
7428
|
return harness === "hermes" ? undefined : harnesses[harness].setup;
|
|
@@ -7547,9 +7569,9 @@ var init_core = __esm(() => {
|
|
|
7547
7569
|
});
|
|
7548
7570
|
|
|
7549
7571
|
// src/cli.ts
|
|
7550
|
-
import { mkdir as
|
|
7551
|
-
import { resolve as
|
|
7552
|
-
import { fileURLToPath } from "url";
|
|
7572
|
+
import { mkdir as mkdir4, readFile as readFile7, writeFile as writeFile4, rename as rename4, rm as rm4, realpath, mkdtemp } from "fs/promises";
|
|
7573
|
+
import { resolve as resolve8, join as join8, dirname as dirname2, basename } from "path";
|
|
7574
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
7553
7575
|
import { parseArgs } from "util";
|
|
7554
7576
|
// catalog/skills.json
|
|
7555
7577
|
var skills_default = {
|
|
@@ -7577,9 +7599,9 @@ var skills_default = {
|
|
|
7577
7599
|
{
|
|
7578
7600
|
id: "hyperliquid-skills",
|
|
7579
7601
|
source: "galleonlabs/crypto-defi-skills",
|
|
7580
|
-
description: "
|
|
7581
|
-
version: "0.
|
|
7582
|
-
revision: "
|
|
7602
|
+
description: "Hyperliquid market research, trade planning, monitoring, performance review and reproducible public wallet cost audits.",
|
|
7603
|
+
version: "0.4.0",
|
|
7604
|
+
revision: "3f91a955d59a55b9927403ddc3c2e26660d48bf8",
|
|
7583
7605
|
skills: [
|
|
7584
7606
|
"hyperliquid-analyze",
|
|
7585
7607
|
"hyperliquid-engineer",
|
|
@@ -7587,7 +7609,8 @@ var skills_default = {
|
|
|
7587
7609
|
"hyperliquid-monitor",
|
|
7588
7610
|
"hyperliquid-plan",
|
|
7589
7611
|
"hyperliquid-review",
|
|
7590
|
-
"hyperliquid-setup"
|
|
7612
|
+
"hyperliquid-setup",
|
|
7613
|
+
"hyperliquid-wallet-audit"
|
|
7591
7614
|
],
|
|
7592
7615
|
path: "packages/hyperliquid",
|
|
7593
7616
|
package: "galleon-hyperliquid-skills"
|
|
@@ -7755,9 +7778,9 @@ var skills_default = {
|
|
|
7755
7778
|
{
|
|
7756
7779
|
id: "defi-strategy-skills",
|
|
7757
7780
|
source: "galleonlabs/crypto-defi-skills",
|
|
7758
|
-
description: "Test daily spot rules with
|
|
7759
|
-
version: "0.
|
|
7760
|
-
revision: "
|
|
7781
|
+
description: "Test frozen daily spot rules with chronological held-out periods, higher trading costs and reproducible same-cost benchmarks.",
|
|
7782
|
+
version: "0.2.0",
|
|
7783
|
+
revision: "3f91a955d59a55b9927403ddc3c2e26660d48bf8",
|
|
7761
7784
|
skills: [
|
|
7762
7785
|
"galleon-defi-strategy-backtest"
|
|
7763
7786
|
],
|
|
@@ -7795,7 +7818,7 @@ var skills_default = {
|
|
|
7795
7818
|
// package.json
|
|
7796
7819
|
var package_default = {
|
|
7797
7820
|
name: "boomkin",
|
|
7798
|
-
version: "0.
|
|
7821
|
+
version: "0.11.0",
|
|
7799
7822
|
description: "Your open-source DeFi desk: native Hermes research projects, verifiable evidence and independent financial skills.",
|
|
7800
7823
|
type: "module",
|
|
7801
7824
|
license: "MIT",
|
|
@@ -7805,7 +7828,7 @@ var package_default = {
|
|
|
7805
7828
|
test: "bun test test",
|
|
7806
7829
|
typecheck: "tsc --noEmit",
|
|
7807
7830
|
check: "bun run typecheck && bun run test",
|
|
7808
|
-
build: "bun build
|
|
7831
|
+
build: "bun scripts/build.ts",
|
|
7809
7832
|
smoke: "bun scripts/smoke.ts",
|
|
7810
7833
|
"build:site": "bun scripts/build-site.ts",
|
|
7811
7834
|
"serve:site": "bun scripts/serve-site.ts",
|
|
@@ -7901,10 +7924,10 @@ async function packageDirectory(pack, checkout) {
|
|
|
7901
7924
|
const manifest = JSON.parse(await readFile(join(path, "package.json"), "utf8"));
|
|
7902
7925
|
if (manifest.name !== pack.package || manifest.version !== pack.version)
|
|
7903
7926
|
throw new Error(`Package release metadata mismatch: ${pack.id}`);
|
|
7904
|
-
|
|
7927
|
+
await Promise.resolve().then(() => init_core());
|
|
7905
7928
|
for (const skill of pack.skills) {
|
|
7906
7929
|
const text = await readFile(join(path, "skills", skill, "SKILL.md"), "utf8");
|
|
7907
|
-
if (
|
|
7930
|
+
if (installedVersion(text) !== pack.version)
|
|
7908
7931
|
throw new Error(`Source skill version mismatch: ${skill}`);
|
|
7909
7932
|
}
|
|
7910
7933
|
return path;
|
|
@@ -7923,6 +7946,43 @@ import { access, chmod, lstat, mkdir, readFile, rename, rm, writeFile } from "fs
|
|
|
7923
7946
|
import { constants } from "fs";
|
|
7924
7947
|
import { resolve as resolve2, join } from "path";
|
|
7925
7948
|
import { createHash, randomUUID } from "crypto";
|
|
7949
|
+
|
|
7950
|
+
// src/processes.ts
|
|
7951
|
+
async function terminateOwnedProcess(child, group, graceMs = 2000) {
|
|
7952
|
+
const signal = (value) => {
|
|
7953
|
+
try {
|
|
7954
|
+
if (group)
|
|
7955
|
+
process.kill(-child.pid, value);
|
|
7956
|
+
else if (child.exitCode === null)
|
|
7957
|
+
child.kill(value);
|
|
7958
|
+
} catch {}
|
|
7959
|
+
};
|
|
7960
|
+
const groupExists = () => {
|
|
7961
|
+
try {
|
|
7962
|
+
process.kill(-child.pid, 0);
|
|
7963
|
+
return true;
|
|
7964
|
+
} catch (error) {
|
|
7965
|
+
return error.code !== "ESRCH";
|
|
7966
|
+
}
|
|
7967
|
+
};
|
|
7968
|
+
signal("SIGTERM");
|
|
7969
|
+
let timer;
|
|
7970
|
+
const escalation = new Promise((done) => {
|
|
7971
|
+
timer = setTimeout(() => {
|
|
7972
|
+
signal("SIGKILL");
|
|
7973
|
+
done();
|
|
7974
|
+
}, graceMs);
|
|
7975
|
+
});
|
|
7976
|
+
try {
|
|
7977
|
+
await child.exited;
|
|
7978
|
+
if (group && groupExists())
|
|
7979
|
+
await escalation;
|
|
7980
|
+
} finally {
|
|
7981
|
+
clearTimeout(timer);
|
|
7982
|
+
}
|
|
7983
|
+
}
|
|
7984
|
+
|
|
7985
|
+
// src/hermes.ts
|
|
7926
7986
|
var HERMES_VERSION = "0.21.5";
|
|
7927
7987
|
var HERMES_COMMIT = "f97608f178d1ffeca59860195ab7da295f7c8e5f";
|
|
7928
7988
|
var HERMES_INSTALLER_SHA256 = "2017ddf0cc7bc6cfb70d40dc9fba1d916f47dbcccf5fe73bdee2cf93a11262af";
|
|
@@ -7971,6 +8031,22 @@ async function readHermesConfig(directory) {
|
|
|
7971
8031
|
const root = await profilePath(directory);
|
|
7972
8032
|
return document(await textOrEmpty(join(root, "config.yaml"))).toJS({ maxAliasCount: 0 });
|
|
7973
8033
|
}
|
|
8034
|
+
function hermesModelConfigured(config) {
|
|
8035
|
+
const object = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
8036
|
+
const model = config.model;
|
|
8037
|
+
if (typeof model === "string")
|
|
8038
|
+
return !!model.trim();
|
|
8039
|
+
if (!object(model))
|
|
8040
|
+
return false;
|
|
8041
|
+
const flatten = (value) => {
|
|
8042
|
+
if (!object(value))
|
|
8043
|
+
return value;
|
|
8044
|
+
const id = value.model || value.default;
|
|
8045
|
+
return typeof id === "string" ? id.trim() : id;
|
|
8046
|
+
};
|
|
8047
|
+
const id = flatten(model.default) || flatten(model.model) || flatten(model.name);
|
|
8048
|
+
return typeof id === "string" && !!id.trim();
|
|
8049
|
+
}
|
|
7974
8050
|
async function executableAt(path) {
|
|
7975
8051
|
try {
|
|
7976
8052
|
await access(path, constants.X_OK);
|
|
@@ -7999,11 +8075,29 @@ async function runHermes(directory, args, options = {}) {
|
|
|
7999
8075
|
throw new Error("Hermes runtime is missing. Run onboarding with runtime installation enabled.");
|
|
8000
8076
|
if (args.some((arg) => ["-p", "--profile"].includes(arg) || arg.startsWith("--profile=")))
|
|
8001
8077
|
throw new Error("Select the Boomkin directory instead of overriding its Hermes profile");
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8078
|
+
options.signal?.throwIfAborted();
|
|
8079
|
+
const ownGroup = !!options.signal && process.platform !== "win32";
|
|
8080
|
+
const child = Bun.spawn([executable, "--profile", "default", ...args], { cwd: root, env: nativeEnvironment(root), stdin: "inherit", stdout: "inherit", stderr: "inherit", detached: ownGroup });
|
|
8081
|
+
let termination;
|
|
8082
|
+
const abort = () => {
|
|
8083
|
+
termination ??= terminateOwnedProcess(child, ownGroup);
|
|
8084
|
+
};
|
|
8085
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
8086
|
+
try {
|
|
8087
|
+
if (options.signal?.aborted)
|
|
8088
|
+
abort();
|
|
8089
|
+
const code = await child.exited;
|
|
8090
|
+
options.signal?.throwIfAborted();
|
|
8091
|
+
if (code !== 0)
|
|
8092
|
+
throw new Error("Hermes command failed; review its native output above.");
|
|
8093
|
+
} finally {
|
|
8094
|
+
options.signal?.removeEventListener("abort", abort);
|
|
8095
|
+
if (termination)
|
|
8096
|
+
await termination;
|
|
8097
|
+
}
|
|
8005
8098
|
}
|
|
8006
8099
|
async function ensureRuntime(directory, options) {
|
|
8100
|
+
options.signal?.throwIfAborted();
|
|
8007
8101
|
const root = await profilePath(directory);
|
|
8008
8102
|
const existing = await findRuntime(root);
|
|
8009
8103
|
if (existing) {
|
|
@@ -8012,7 +8106,7 @@ async function ensureRuntime(directory, options) {
|
|
|
8012
8106
|
return existing;
|
|
8013
8107
|
}
|
|
8014
8108
|
await mkdir(root, { recursive: true, mode: 448 });
|
|
8015
|
-
const status = await localProfileStatus(root);
|
|
8109
|
+
const status = await localProfileStatus(root, { signal: options.signal });
|
|
8016
8110
|
if (!status.runtime.available)
|
|
8017
8111
|
throw new Error("The existing Hermes executable did not report a valid version; repair it before onboarding");
|
|
8018
8112
|
const [major, minor] = status.runtime.version.split(".").map(Number);
|
|
@@ -8031,7 +8125,7 @@ async function ensureRuntime(directory, options) {
|
|
|
8031
8125
|
if (process.platform === "win32")
|
|
8032
8126
|
throw new Error("Install Hermes with the official Windows installer first, then rerun Boomkin onboarding.");
|
|
8033
8127
|
await mkdir(join(root, ".boomkin"), { recursive: true, mode: 448 });
|
|
8034
|
-
const response = await fetch(HERMES_INSTALLER_URL, { signal: AbortSignal.timeout(30000) });
|
|
8128
|
+
const response = await fetch(HERMES_INSTALLER_URL, { signal: AbortSignal.any([AbortSignal.timeout(30000), ...options.signal ? [options.signal] : []]) });
|
|
8035
8129
|
if (!response.ok)
|
|
8036
8130
|
throw new Error(`Official Hermes installer download failed (${response.status})`);
|
|
8037
8131
|
const installer = await response.text();
|
|
@@ -8040,16 +8134,33 @@ async function ensureRuntime(directory, options) {
|
|
|
8040
8134
|
const path = join(root, ".boomkin", `hermes-installer-${randomUUID()}.sh`);
|
|
8041
8135
|
await writeFile(path, installer, { flag: "wx", mode: 384 });
|
|
8042
8136
|
try {
|
|
8137
|
+
options.signal?.throwIfAborted();
|
|
8043
8138
|
console.log("Installing the official Hermes runtime. Its installer also manages the user-level hermes command and runtime dependencies.");
|
|
8044
|
-
const
|
|
8045
|
-
|
|
8046
|
-
|
|
8139
|
+
const group = !!options.signal;
|
|
8140
|
+
const child = Bun.spawn(["bash", path, "--commit", HERMES_COMMIT, "--dir", runtime, "--hermes-home", root, "--skip-setup", "--skip-browser", "--skip-computer-use", "--non-interactive"], { cwd: root, env: nativeEnvironment(root), stdin: "inherit", stdout: "inherit", stderr: "inherit", detached: group });
|
|
8141
|
+
let termination;
|
|
8142
|
+
const abort = () => {
|
|
8143
|
+
termination ??= terminateOwnedProcess(child, group);
|
|
8144
|
+
};
|
|
8145
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
8146
|
+
try {
|
|
8147
|
+
if (options.signal?.aborted)
|
|
8148
|
+
abort();
|
|
8149
|
+
const code = await child.exited;
|
|
8150
|
+
options.signal?.throwIfAborted();
|
|
8151
|
+
if (code !== 0)
|
|
8152
|
+
throw new Error("The official Hermes installer failed. Resolve its reported issue and retry onboarding.");
|
|
8153
|
+
} finally {
|
|
8154
|
+
options.signal?.removeEventListener("abort", abort);
|
|
8155
|
+
if (termination)
|
|
8156
|
+
await termination;
|
|
8157
|
+
}
|
|
8047
8158
|
const installed = await findRuntime(root);
|
|
8048
8159
|
if (!installed || !installed.startsWith(runtime + "/"))
|
|
8049
8160
|
throw new Error("The installer completed without a usable profile-managed Hermes executable");
|
|
8050
|
-
const
|
|
8051
|
-
const revision = (await new Response(
|
|
8052
|
-
if (await
|
|
8161
|
+
const git = Bun.spawn(["git", "-C", runtime, "rev-parse", "HEAD"], { stdout: "pipe", stderr: "ignore" });
|
|
8162
|
+
const revision = (await new Response(git.stdout).text()).trim();
|
|
8163
|
+
if (await git.exited !== 0 || revision !== HERMES_COMMIT)
|
|
8053
8164
|
throw new Error("Hermes installed revision differs from the reviewed pin. Existing runtime was preserved; review it before continuing.");
|
|
8054
8165
|
if (!(await localProfileStatus(root)).runtime.available)
|
|
8055
8166
|
throw new Error("Installed Hermes cannot report its version; runtime readiness is incomplete");
|
|
@@ -8058,12 +8169,12 @@ async function ensureRuntime(directory, options) {
|
|
|
8058
8169
|
await rm(path, { force: true });
|
|
8059
8170
|
}
|
|
8060
8171
|
}
|
|
8061
|
-
async function initializeProfile(directory,
|
|
8172
|
+
async function initializeProfile(directory, identity) {
|
|
8062
8173
|
const root = await profilePath(directory);
|
|
8063
8174
|
await mkdir(root, { recursive: true, mode: 448 });
|
|
8064
8175
|
await safePath(join(root, "SOUL.md"));
|
|
8065
8176
|
try {
|
|
8066
|
-
await writeFile(join(root, "SOUL.md"),
|
|
8177
|
+
await writeFile(join(root, "SOUL.md"), identity, { flag: "wx", mode: 384 });
|
|
8067
8178
|
return { createdSoul: true };
|
|
8068
8179
|
} catch (error) {
|
|
8069
8180
|
if (error.code === "EEXIST")
|
|
@@ -8092,7 +8203,7 @@ async function configureMcpServers(directory, servers) {
|
|
|
8092
8203
|
for (const [name, server] of Object.entries(servers)) {
|
|
8093
8204
|
if (!/^[a-z][a-z0-9_-]*$/.test(name))
|
|
8094
8205
|
throw new Error("Invalid MCP server name");
|
|
8095
|
-
if (server.trust !== "untrusted" || !Array.isArray(server.tools?.include) || server.tools.include.some((
|
|
8206
|
+
if (server.trust !== "untrusted" || !Array.isArray(server.tools?.include) || server.tools.include.some((name) => !name || /[*?\[\]]/.test(name)) || server.tools.resources !== false || server.tools.prompts !== false)
|
|
8096
8207
|
throw new Error("Boomkin MCP setup requires untrusted servers, explicit tool names, and disabled resource/prompt utilities");
|
|
8097
8208
|
if (Boolean(server.url) === Boolean(server.command))
|
|
8098
8209
|
throw new Error("Choose one MCP transport");
|
|
@@ -8163,7 +8274,7 @@ function envValues(text) {
|
|
|
8163
8274
|
}
|
|
8164
8275
|
return result;
|
|
8165
8276
|
}
|
|
8166
|
-
async function localProfileStatus(directory) {
|
|
8277
|
+
async function localProfileStatus(directory, options = {}) {
|
|
8167
8278
|
const root = await profilePath(directory);
|
|
8168
8279
|
const executable = await findRuntime(root);
|
|
8169
8280
|
let version;
|
|
@@ -8175,15 +8286,32 @@ async function localProfileStatus(directory) {
|
|
|
8175
8286
|
throw error;
|
|
8176
8287
|
}
|
|
8177
8288
|
if (executable && rootExists) {
|
|
8178
|
-
|
|
8179
|
-
const
|
|
8180
|
-
|
|
8181
|
-
|
|
8289
|
+
options.signal?.throwIfAborted();
|
|
8290
|
+
const group = process.platform !== "win32";
|
|
8291
|
+
const child = Bun.spawn([executable, "--profile", "default", "--version"], { cwd: root, env: nativeEnvironment(root), stdout: "pipe", stderr: "ignore", detached: group });
|
|
8292
|
+
let termination;
|
|
8293
|
+
const abort = () => {
|
|
8294
|
+
termination ??= terminateOwnedProcess(child, group);
|
|
8295
|
+
};
|
|
8296
|
+
const timeout = setTimeout(abort, 15000);
|
|
8297
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
8298
|
+
try {
|
|
8299
|
+
if (options.signal?.aborted)
|
|
8300
|
+
abort();
|
|
8301
|
+
const output = await new Response(child.stdout).text();
|
|
8302
|
+
if (await child.exited === 0)
|
|
8303
|
+
version = output.match(/\bHermes(?: Agent)?\s+v?(\d+\.\d+\.\d+(?:[-+][A-Za-z0-9.-]+)?)/i)?.[1];
|
|
8304
|
+
options.signal?.throwIfAborted();
|
|
8305
|
+
} finally {
|
|
8306
|
+
clearTimeout(timeout);
|
|
8307
|
+
options.signal?.removeEventListener("abort", abort);
|
|
8308
|
+
if (termination)
|
|
8309
|
+
await termination;
|
|
8310
|
+
}
|
|
8182
8311
|
}
|
|
8183
8312
|
const config = await readHermesConfig(root);
|
|
8184
8313
|
const env = { ...process.env, ...envValues(await textOrEmpty(join(root, ".env"))) };
|
|
8185
|
-
const
|
|
8186
|
-
const modelConfigured = typeof model.default === "string" && !!model.default.trim();
|
|
8314
|
+
const modelConfigured = hermesModelConfigured(config);
|
|
8187
8315
|
const knownModelKeys = ["OPENROUTER_API_KEY", "OPENAI_API_KEY", "ANTHROPIC_API_KEY", "NOUS_API_KEY", "GEMINI_API_KEY", "GROQ_API_KEY", "DEEPSEEK_API_KEY", "XAI_API_KEY"];
|
|
8188
8316
|
const credentialConfigured = knownModelKeys.some((key) => !!env[key]?.trim() && !env[key]?.includes("${"));
|
|
8189
8317
|
const servers = config.mcp_servers && typeof config.mcp_servers === "object" && !Array.isArray(config.mcp_servers) ? config.mcp_servers : {};
|
|
@@ -8456,16 +8584,18 @@ function coinbaseSettings(directory) {
|
|
|
8456
8584
|
};
|
|
8457
8585
|
}
|
|
8458
8586
|
async function prepareHermes(directory, options) {
|
|
8587
|
+
options.signal?.throwIfAborted();
|
|
8459
8588
|
if (!options.dryRun)
|
|
8460
8589
|
await initializeProfile(directory, identity2);
|
|
8461
8590
|
const executable = await ensureRuntime(directory, options);
|
|
8462
8591
|
if (options.dryRun)
|
|
8463
8592
|
return;
|
|
8593
|
+
options.signal?.throwIfAborted();
|
|
8464
8594
|
await configureMcpServers(directory, { coingecko: coinGeckoConfig });
|
|
8465
8595
|
if (!options.skipModelSetup) {
|
|
8466
8596
|
if (!process.stdin.isTTY)
|
|
8467
8597
|
throw new Error("Hermes model setup needs a terminal. Rerun onboard interactively, or use --skip-model-setup to prepare the profile and configure it later.");
|
|
8468
|
-
await runHermes(directory, ["setup", "model"], { executable });
|
|
8598
|
+
await runHermes(directory, ["setup", "model"], { executable, signal: options.signal });
|
|
8469
8599
|
}
|
|
8470
8600
|
}
|
|
8471
8601
|
async function connectProvider(directory, provider, dryRun = false, keyFile) {
|
|
@@ -11020,6 +11150,14 @@ function parseInputs(value) {
|
|
|
11020
11150
|
}
|
|
11021
11151
|
function workflowInputs(workflow, value) {
|
|
11022
11152
|
const inputs = parseInputs(value);
|
|
11153
|
+
if (workflow.id === "hyperliquid-wallet-audit") {
|
|
11154
|
+
if (typeof inputs.account !== "string" || !/^0x[0-9a-fA-F]{40}$/.test(inputs.account) || /^0x0{40}$/.test(inputs.account) || !timestamp(inputs.startTime) || !timestamp(inputs.endTime) || Date.parse(inputs.startTime) >= Date.parse(inputs.endTime) || inputs.network !== undefined && (typeof inputs.network !== "string" || !["mainnet", "testnet"].includes(inputs.network)) || inputs.maxPages !== undefined && (!Number.isInteger(inputs.maxPages) || Number(inputs.maxPages) < 1 || Number(inputs.maxPages) > 50))
|
|
11155
|
+
throw new Error("Wallet audit requires a public account address, ordered UTC startTime/endTime, mainnet or testnet, and maxPages from 1 to 50");
|
|
11156
|
+
}
|
|
11157
|
+
if (workflow.id === "strategy-validation" && (!["dataFile", "specFile"].every((key) => text(inputs[key]) && String(inputs[key]).startsWith("/")) || inputs.splitIndex !== undefined && (!Number.isInteger(inputs.splitIndex) || Number(inputs.splitIndex) < 2)))
|
|
11158
|
+
throw new Error("Strategy validation requires absolute dataFile/specFile paths and an optional integer splitIndex of at least 2");
|
|
11159
|
+
if (workflow.id === "strategy-validation" && ["stressFeeBps", "stressSlippageBps"].some((key) => inputs[key] !== undefined && (typeof inputs[key] !== "number" || Number(inputs[key]) < 0 || Number(inputs[key]) > 1000)))
|
|
11160
|
+
throw new Error("Strategy stress fee/slippage assumptions must be numbers from 0 to 1000 basis points");
|
|
11023
11161
|
if (workflow.id === "thesis-review" && (!["asset", "thesis", "evidenceStandard", "reviewFrequency", "notifyWhen"].every((key) => text(inputs[key])) || !Array.isArray(inputs.invalidationConditions) || !inputs.invalidationConditions.length || !inputs.invalidationConditions.every(text)))
|
|
11024
11162
|
throw new Error("Thesis review requires asset, thesis, evidenceStandard, reviewFrequency, notifyWhen and nonempty invalidationConditions");
|
|
11025
11163
|
return inputs;
|
|
@@ -11150,6 +11288,10 @@ Access: ${project.workflow.access}
|
|
|
11150
11288
|
History: ${previous ? `Previous run ${JSON.stringify(join4(dirname(output), previous.id))} has state ${previous.state}. Review its report and evidence for comparison; never reuse old reads as current state.` : "This is the first run. Establish a cited baseline and disclose missing history."}
|
|
11151
11289
|
${project.workflow.id === "thesis-review" ? `Assess every explicit invalidation condition against the saved evidence standard. Report holds, weakened, invalidated or unknown, with observation IDs for each verdict. Ordinary volatility is not invalidation. Record a review/notification handoff from the saved preferences; this run does not create a schedule or send notifications.
|
|
11152
11290
|
` : ""}
|
|
11291
|
+
${project.workflow.id === "hyperliquid-wallet-audit" ? `Use the installed skill's scripts/wallet-audit.mjs capture helper with --address from account, --start from startTime, --end from endTime, --network from network (default mainnet), and --max-pages from maxPages (default 10). Write its capture with --out into a new audit/ subdirectory inside this run. Preserve raw evidence under sources/ for the Boomkin observation contract; never label sampled activity a full portfolio return or assert missing stop protection from incomplete orders.
|
|
11292
|
+
` : ""}
|
|
11293
|
+
${project.workflow.id === "strategy-validation" ? `Use the installed backtest skill's scripts/validate-strategy.mjs with --data from dataFile, --spec from specFile, optional --split from splitIndex, --stress-fee-bps from stressFeeBps and --stress-slippage-bps from stressSlippageBps when supplied. Otherwise use the helper's disclosed higher-cost defaults. Freeze the supplied rule; do not optimize after viewing the held-out result. Report each period and cost scenario separately with independent restart accounting. Preserve the dataset, specification and validation result under sources/; local results cite the exact released engine source URL and explain the data provenance.
|
|
11294
|
+
` : ""}
|
|
11153
11295
|
|
|
11154
11296
|
This run is research and unsigned planning only. Do not sign, approve, fund, submit,
|
|
11155
11297
|
place or cancel orders, or change financial authority. Public reads are allowed;
|
|
@@ -11250,6 +11392,7 @@ async function checkProjectRun(directory, project, selectedRun, now = Date.now()
|
|
|
11250
11392
|
return { run, path, issues, observations: ids.size };
|
|
11251
11393
|
}
|
|
11252
11394
|
async function runProject(directory, projectName, options = {}) {
|
|
11395
|
+
options.signal?.throwIfAborted();
|
|
11253
11396
|
const project = await readProject(directory, projectName);
|
|
11254
11397
|
const id = new Date().toISOString().replaceAll(":", "-").replace(".", "-") + "-" + randomUUID2().slice(0, 8);
|
|
11255
11398
|
const parts = [".boomkin", "projects", projectName, "runs", id];
|
|
@@ -11260,6 +11403,7 @@ async function runProject(directory, projectName, options = {}) {
|
|
|
11260
11403
|
if (options.dryRun)
|
|
11261
11404
|
return { path: output, prompt };
|
|
11262
11405
|
const executable = options.executable ?? await findRuntime(directory);
|
|
11406
|
+
await options.onProgress?.("Checking the native Hermes profile and installed research tools");
|
|
11263
11407
|
if (!executable)
|
|
11264
11408
|
throw new Error("Hermes runtime is missing; onboard this profile before running a project");
|
|
11265
11409
|
const selected = parseCatalog(JSON.parse(await readLimited(await safePath2(directory, [".boomkin", "last-sync.json"]), 1048576)).catalog);
|
|
@@ -11272,11 +11416,32 @@ async function runProject(directory, projectName, options = {}) {
|
|
|
11272
11416
|
const integrityIssues = await verifyIntegrity(join4(directory, "skills"), { schemaVersion: 3, packs: [pack] }, await readIntegrity(directory));
|
|
11273
11417
|
if (integrityIssues.length)
|
|
11274
11418
|
throw new Error(integrityIssues.join("; "));
|
|
11275
|
-
|
|
11276
|
-
const
|
|
11277
|
-
|
|
11419
|
+
options.signal?.throwIfAborted();
|
|
11420
|
+
const group = process.platform !== "win32";
|
|
11421
|
+
const probe = Bun.spawn([executable, "--profile", "default", "chat", "--help"], { cwd: resolve4(directory), env: { ...process.env, HERMES_HOME: resolve4(directory), HERMES_CONFIG: join4(resolve4(directory), "config.yaml"), HERMES_ENV: join4(resolve4(directory), ".env") }, stdout: "pipe", stderr: "ignore", detached: group });
|
|
11422
|
+
let probeTermination;
|
|
11423
|
+
const abortProbe = () => {
|
|
11424
|
+
probeTermination ??= terminateOwnedProcess(probe, group);
|
|
11425
|
+
};
|
|
11426
|
+
const probeTimeout = setTimeout(abortProbe, 15000);
|
|
11427
|
+
options.signal?.addEventListener("abort", abortProbe, { once: true });
|
|
11428
|
+
let help, probeCode;
|
|
11429
|
+
try {
|
|
11430
|
+
if (options.signal?.aborted)
|
|
11431
|
+
abortProbe();
|
|
11432
|
+
help = await new Response(probe.stdout).text();
|
|
11433
|
+
probeCode = await probe.exited;
|
|
11434
|
+
options.signal?.throwIfAborted();
|
|
11435
|
+
} finally {
|
|
11436
|
+
clearTimeout(probeTimeout);
|
|
11437
|
+
options.signal?.removeEventListener("abort", abortProbe);
|
|
11438
|
+
if (probeTermination)
|
|
11439
|
+
await probeTermination;
|
|
11440
|
+
}
|
|
11441
|
+
if (probeCode !== 0 || ["--query-file", "--skills", "--max-turns", "--oneshot", "--cli"].some((flag) => !help.includes(flag)))
|
|
11278
11442
|
throw new Error("Existing Hermes lacks the reviewed project launch contract; preserve it and review its native update");
|
|
11279
11443
|
const lockParts = [".boomkin", "projects", projectName, "run.lock"];
|
|
11444
|
+
options.signal?.throwIfAborted();
|
|
11280
11445
|
const lock = await safePath2(directory, lockParts);
|
|
11281
11446
|
try {
|
|
11282
11447
|
await mkdir2(lock, { mode: 448 });
|
|
@@ -11296,14 +11461,18 @@ async function runProject(directory, projectName, options = {}) {
|
|
|
11296
11461
|
await writeFile2(join4(output, "prompt.md"), prompt, { flag: "wx", mode: 384 });
|
|
11297
11462
|
await atomicWrite(directory, [...parts, "run.json"], json(run));
|
|
11298
11463
|
recorded = true;
|
|
11464
|
+
await options.onPrepared?.(run, output);
|
|
11465
|
+
options.signal?.throwIfAborted();
|
|
11299
11466
|
run.state = "running";
|
|
11300
11467
|
await atomicWrite(directory, [...parts, "run.json"], json(run));
|
|
11301
11468
|
console.log(`Research run: ${output}. Native Hermes uses your configured model; provider usage may incur costs.`);
|
|
11302
|
-
await
|
|
11469
|
+
await options.onProgress?.("Native Hermes is researching your question");
|
|
11470
|
+
await runHermes(directory, args, { executable, signal: options.signal });
|
|
11303
11471
|
run.state = "needs-review";
|
|
11304
11472
|
run.finishedAt = new Date().toISOString();
|
|
11305
11473
|
await atomicWrite(directory, [...parts, "run.json"], json(run));
|
|
11306
11474
|
const checked = await checkProjectRun(directory, projectName, id);
|
|
11475
|
+
await options.onProgress?.("Checking the captured research files");
|
|
11307
11476
|
run.issues = checked.issues;
|
|
11308
11477
|
if (!checked.issues.length)
|
|
11309
11478
|
run.state = "ready-for-review";
|
|
@@ -11313,7 +11482,7 @@ async function runProject(directory, projectName, options = {}) {
|
|
|
11313
11482
|
if (recorded) {
|
|
11314
11483
|
run.state = "failed";
|
|
11315
11484
|
run.finishedAt = new Date().toISOString();
|
|
11316
|
-
run.issues = ["Hermes or artifact validation failed; review the native output and preserved run files before retrying"];
|
|
11485
|
+
run.issues = [options.signal?.aborted ? "Research was canceled; preserved files may be incomplete" : "Hermes or artifact validation failed; review the native output and preserved run files before retrying"];
|
|
11317
11486
|
await atomicWrite(directory, [...parts, "run.json"], json(run));
|
|
11318
11487
|
}
|
|
11319
11488
|
throw error;
|
|
@@ -11321,10 +11490,1076 @@ async function runProject(directory, projectName, options = {}) {
|
|
|
11321
11490
|
await rm2(lock, { recursive: true, force: true });
|
|
11322
11491
|
}
|
|
11323
11492
|
}
|
|
11493
|
+
// catalog/templates.json
|
|
11494
|
+
var templates_default = {
|
|
11495
|
+
schemaVersion: 1,
|
|
11496
|
+
templates: [
|
|
11497
|
+
{
|
|
11498
|
+
id: "wallet-audit",
|
|
11499
|
+
title: "Find the costs in a Hyperliquid wallet",
|
|
11500
|
+
workflow: "hyperliquid-wallet-audit",
|
|
11501
|
+
description: "Reconcile a public account's realized activity, fees, funding and current exposure. Preserve raw sources and explain incomplete history.",
|
|
11502
|
+
defaults: { network: "mainnet", maxPages: 10 },
|
|
11503
|
+
requiredInputs: ["account", "startTime", "endTime"],
|
|
11504
|
+
exampleInputs: { account: "YOUR_PUBLIC_ACCOUNT_ADDRESS", startTime: "2026-10-01T00:00:00.000Z", endTime: "2026-10-08T00:00:00.000Z" }
|
|
11505
|
+
},
|
|
11506
|
+
{
|
|
11507
|
+
id: "strategy-validation",
|
|
11508
|
+
title: "Test a rule on an untouched period",
|
|
11509
|
+
workflow: "strategy-validation",
|
|
11510
|
+
description: "Freeze a daily spot rule, compare higher trading costs and inspect a separate held-out period against the same-cost benchmark.",
|
|
11511
|
+
defaults: {},
|
|
11512
|
+
requiredInputs: ["dataFile", "specFile"],
|
|
11513
|
+
exampleInputs: { dataFile: "/absolute/path/to/daily-prices.json", specFile: "/absolute/path/to/frozen-rule.json" }
|
|
11514
|
+
},
|
|
11515
|
+
{
|
|
11516
|
+
id: "stablecoin-yields",
|
|
11517
|
+
title: "Screen stablecoin income",
|
|
11518
|
+
workflow: "yield-screen",
|
|
11519
|
+
description: "Separate base income from incentives and collect the missing exit and liquidity evidence before a deposit decision.",
|
|
11520
|
+
defaults: { minimumTvlUsd: "10000000", limit: 5, yieldPreference: "Separate base yield from incentive emissions" },
|
|
11521
|
+
requiredInputs: ["chain", "asset"],
|
|
11522
|
+
exampleInputs: { chain: "Ethereum", asset: "USDC" }
|
|
11523
|
+
},
|
|
11524
|
+
{
|
|
11525
|
+
id: "thesis-review",
|
|
11526
|
+
title: "Keep an investment thesis accountable",
|
|
11527
|
+
workflow: "thesis-review",
|
|
11528
|
+
description: "Save explicit invalidation conditions and review preferences, then compare each research run with its captured baseline.",
|
|
11529
|
+
defaults: { reviewFrequency: "Weekly", notifyWhen: "An invalidation condition changes verdict" },
|
|
11530
|
+
requiredInputs: ["asset", "thesis", "invalidationConditions", "evidenceStandard"],
|
|
11531
|
+
exampleInputs: { asset: "YOUR_EXACT_ASSET_IDENTITY", thesis: "YOUR_THESIS", invalidationConditions: ["YOUR_MEASURABLE_INVALIDATION_CONDITION"], evidenceStandard: "YOUR_PRIMARY_SOURCE_REQUIREMENTS" }
|
|
11532
|
+
}
|
|
11533
|
+
]
|
|
11534
|
+
};
|
|
11535
|
+
|
|
11536
|
+
// src/templates.ts
|
|
11537
|
+
var templates = templates_default.templates;
|
|
11538
|
+
function selectTemplate(id) {
|
|
11539
|
+
const template = templates.find((item) => item.id === id);
|
|
11540
|
+
if (!template)
|
|
11541
|
+
throw new Error(`Unknown template: ${id}. Run templates to list available starting points.`);
|
|
11542
|
+
selectWorkflow(template.workflow);
|
|
11543
|
+
return template;
|
|
11544
|
+
}
|
|
11545
|
+
function templateInputs(id, supplied) {
|
|
11546
|
+
const template = selectTemplate(id);
|
|
11547
|
+
const inputs = parseInputs({ ...template.defaults, ...parseInputs(supplied) });
|
|
11548
|
+
for (const key of template.requiredInputs) {
|
|
11549
|
+
const value = inputs[key];
|
|
11550
|
+
if (value === undefined || value === null || typeof template.exampleInputs[key] === "string" && typeof value !== "string" || Array.isArray(template.exampleInputs[key]) && !Array.isArray(value) || typeof value === "string" && (!value.trim() || /YOUR_|\/absolute\/path\/to\//.test(value)) || Array.isArray(value) && (!value.length || value.some((item) => typeof item !== "string" || !item.trim() || /YOUR_/.test(item)))) {
|
|
11551
|
+
throw new Error(`Template ${id} requires your ${key}; replace the example placeholders in the input file.`);
|
|
11552
|
+
}
|
|
11553
|
+
}
|
|
11554
|
+
return inputs;
|
|
11555
|
+
}
|
|
11556
|
+
function renderTemplate(template) {
|
|
11557
|
+
return `${template.id}: ${template.title}
|
|
11558
|
+
${template.description}
|
|
11559
|
+
Workflow: ${template.workflow}
|
|
11560
|
+
Supply: ${template.requiredInputs.join(", ")}
|
|
11561
|
+
Example input (replace placeholders): ${JSON.stringify({ ...template.defaults, ...template.exampleInputs })}
|
|
11562
|
+
Create: boomkin project create --name my-research --template ${template.id} --input-file ./inputs.json
|
|
11563
|
+
Preview: boomkin project run --name my-research --dry-run
|
|
11564
|
+
Install: boomkin onboard --workflow ${template.workflow}
|
|
11565
|
+
Creation and preview make no model or data call. Live runs use your configured model and tools.`;
|
|
11566
|
+
}
|
|
11567
|
+
|
|
11568
|
+
// src/desk.ts
|
|
11569
|
+
import { createHash as createHash5, randomBytes, randomUUID as randomUUID3, timingSafeEqual } from "crypto";
|
|
11570
|
+
import { lstat as lstat4, mkdir as mkdir3, readFile as readFile5, rename as rename3, rm as rm3, writeFile as writeFile3 } from "fs/promises";
|
|
11571
|
+
import { join as join5, resolve as resolve5 } from "path";
|
|
11572
|
+
import { pathToFileURL } from "url";
|
|
11573
|
+
init_core();
|
|
11574
|
+
var sha = (value) => createHash5("sha256").update(value).digest("hex");
|
|
11575
|
+
var json2 = (value) => JSON.stringify(value, null, 2) + `
|
|
11576
|
+
`;
|
|
11577
|
+
var object = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
11578
|
+
var slug = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
11579
|
+
var runPattern = /^\d{4}-\d{2}-\d{2}T[0-9-]+Z-[0-9a-f]{8}$/;
|
|
11580
|
+
var kinds = {
|
|
11581
|
+
wallet: { workflow: "hyperliquid-wallet-audit", pack: "hyperliquid-skills", skill: "hyperliquid-wallet-audit", module: "audit-engine.mjs" },
|
|
11582
|
+
market: { workflow: "market-snapshot", pack: "defi-data-skills", skill: "galleon-defi-market-snapshot", module: "market-data.mjs" },
|
|
11583
|
+
strategy: { workflow: "strategy-backtest", pack: "defi-strategy-skills", skill: "galleon-defi-strategy-backtest", module: "engine.mjs" }
|
|
11584
|
+
};
|
|
11585
|
+
|
|
11586
|
+
class DeskError extends Error {
|
|
11587
|
+
status;
|
|
11588
|
+
constructor(message, status = 400) {
|
|
11589
|
+
super(message);
|
|
11590
|
+
this.status = status;
|
|
11591
|
+
}
|
|
11592
|
+
}
|
|
11593
|
+
function validName(value) {
|
|
11594
|
+
if (!slug.test(value))
|
|
11595
|
+
throw new DeskError("Invalid project name");
|
|
11596
|
+
return value;
|
|
11597
|
+
}
|
|
11598
|
+
function validRun(value) {
|
|
11599
|
+
if (!runPattern.test(value))
|
|
11600
|
+
throw new DeskError("Invalid run ID");
|
|
11601
|
+
return value;
|
|
11602
|
+
}
|
|
11603
|
+
async function safe(root, parts = []) {
|
|
11604
|
+
let path = resolve5(root);
|
|
11605
|
+
for (const part of ["", ...parts]) {
|
|
11606
|
+
if (part) {
|
|
11607
|
+
if (!/^[a-zA-Z0-9.][a-zA-Z0-9._-]*$/.test(part) || part === "." || part === "..")
|
|
11608
|
+
throw new DeskError("Invalid managed path");
|
|
11609
|
+
path = join5(path, part);
|
|
11610
|
+
}
|
|
11611
|
+
try {
|
|
11612
|
+
if ((await lstat4(path)).isSymbolicLink())
|
|
11613
|
+
throw new DeskError("Refusing a symbolic link in a managed desk path", 409);
|
|
11614
|
+
} catch (error) {
|
|
11615
|
+
if (error.code !== "ENOENT")
|
|
11616
|
+
throw error;
|
|
11617
|
+
}
|
|
11618
|
+
}
|
|
11619
|
+
return path;
|
|
11620
|
+
}
|
|
11621
|
+
async function limitedBytes(path, maxBytes = 1048576) {
|
|
11622
|
+
const info = await lstat4(path);
|
|
11623
|
+
if (!info.isFile() || info.size > maxBytes)
|
|
11624
|
+
throw new DeskError("Expected a bounded regular file", 409);
|
|
11625
|
+
return readFile5(path);
|
|
11626
|
+
}
|
|
11627
|
+
async function limited(path, maxBytes = 1048576) {
|
|
11628
|
+
return (await limitedBytes(path, maxBytes)).toString("utf8");
|
|
11629
|
+
}
|
|
11630
|
+
async function atomic(root, parts, value) {
|
|
11631
|
+
const path = await safe(root, parts), temporary = path + "." + randomUUID3() + ".tmp";
|
|
11632
|
+
try {
|
|
11633
|
+
await writeFile3(temporary, value, { flag: "wx", mode: 384 });
|
|
11634
|
+
await safe(root, parts);
|
|
11635
|
+
await rename3(temporary, path);
|
|
11636
|
+
} finally {
|
|
11637
|
+
await rm3(temporary, { force: true });
|
|
11638
|
+
}
|
|
11639
|
+
}
|
|
11640
|
+
var projectParts = (name) => [".boomkin", "projects", validName(name)];
|
|
11641
|
+
var runParts = (name, id) => [...projectParts(name), "runs", validRun(id)];
|
|
11642
|
+
function parseRun(value, name, id) {
|
|
11643
|
+
if (!object(value) || value.schemaVersion !== 1 || value.project !== name || value.id !== id || !Object.hasOwn(kinds, value.kind) || !["queued", "running", "complete", "partial", "failed", "cancelled", "interrupted"].includes(value.state) || typeof value.createdAt !== "string" || !Number.isFinite(Date.parse(value.createdAt)) || typeof value.progress !== "string")
|
|
11644
|
+
throw new DeskError("Saved desk run is malformed; files were preserved", 409);
|
|
11645
|
+
return value;
|
|
11646
|
+
}
|
|
11647
|
+
function parseMetadata(value) {
|
|
11648
|
+
if (!object(value) || value.schemaVersion !== 1 || !Object.hasOwn(kinds, value.kind) || typeof value.title !== "string" || !value.title.trim() || value.title.length > 160)
|
|
11649
|
+
throw new DeskError("Saved desk project is malformed; files were preserved", 409);
|
|
11650
|
+
return value;
|
|
11651
|
+
}
|
|
11652
|
+
function normalizeInput(kind, input) {
|
|
11653
|
+
if (!object(input))
|
|
11654
|
+
throw new DeskError("Inputs must be an object");
|
|
11655
|
+
const allowed = kind === "wallet" ? ["account", "startTime", "endTime", "network", "maxPages"] : kind === "market" ? ["asset"] : ["asset", "days", "template", "initialCashUsd", "feeBps", "slippageBps", "amountUsd", "datasetSource", "dataset"];
|
|
11656
|
+
if (Object.keys(input).some((key) => !allowed.includes(key)))
|
|
11657
|
+
throw new DeskError("Unknown task input");
|
|
11658
|
+
if (kind === "wallet") {
|
|
11659
|
+
const network = input.network ?? "mainnet", maxPages = input.maxPages ?? 10;
|
|
11660
|
+
if (typeof input.account !== "string" || !/^0x[\da-f]{40}$/i.test(input.account) || /^0x0{40}$/i.test(input.account))
|
|
11661
|
+
throw new DeskError("Enter a nonzero public Hyperliquid address");
|
|
11662
|
+
for (const key of ["startTime", "endTime"])
|
|
11663
|
+
if (typeof input[key] !== "string" || !/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d{3})?Z$/.test(input[key]) || !Number.isFinite(Date.parse(input[key])))
|
|
11664
|
+
throw new DeskError("Choose UTC start and end times");
|
|
11665
|
+
if (Date.parse(input.startTime) >= Date.parse(input.endTime) || Date.parse(input.endTime) > Date.now() + 300000)
|
|
11666
|
+
throw new DeskError("Choose an ordered window ending no later than now");
|
|
11667
|
+
if (!["mainnet", "testnet"].includes(network) || !Number.isInteger(maxPages) || maxPages < 1 || maxPages > 50)
|
|
11668
|
+
throw new DeskError("Choose mainnet/testnet and 1\u201350 history pages");
|
|
11669
|
+
return { account: input.account.toLowerCase(), startTime: new Date(input.startTime).toISOString(), endTime: new Date(input.endTime).toISOString(), network, maxPages };
|
|
11670
|
+
}
|
|
11671
|
+
const asset = input.asset ?? "bitcoin";
|
|
11672
|
+
if (typeof asset !== "string" || !/^[a-z0-9][a-z0-9-]{0,99}$/.test(asset))
|
|
11673
|
+
throw new DeskError("Use the exact CoinGecko asset ID, for example ethereum");
|
|
11674
|
+
if (kind === "market")
|
|
11675
|
+
return { asset };
|
|
11676
|
+
const result = { asset, days: input.days ?? 180, template: input.template ?? "sma-10", initialCashUsd: input.initialCashUsd ?? 1e4, feeBps: input.feeBps ?? 10, slippageBps: input.slippageBps ?? 5, ...input.amountUsd !== undefined ? { amountUsd: input.amountUsd } : {}, datasetSource: input.datasetSource ?? "live", ...input.dataset !== undefined ? { dataset: input.dataset } : {} };
|
|
11677
|
+
if (!Number.isInteger(result.days) || result.days < 91 || result.days > 365 || !["buy-and-hold", "weekly-dca", "sma-10", "sma-30"].includes(result.template))
|
|
11678
|
+
throw new DeskError("Choose a documented rule and 91\u2013365 days");
|
|
11679
|
+
for (const key of ["initialCashUsd", "feeBps", "slippageBps", "amountUsd"])
|
|
11680
|
+
if (result[key] !== undefined && (typeof result[key] !== "number" || !Number.isFinite(result[key]) || result[key] < (key === "initialCashUsd" || key === "amountUsd" ? 0.01 : 0) || result[key] > (key === "feeBps" || key === "slippageBps" ? 1000 : 1e9)))
|
|
11681
|
+
throw new DeskError("Invalid cash or cost assumptions");
|
|
11682
|
+
if (result.template === "weekly-dca" && result.amountUsd === undefined)
|
|
11683
|
+
throw new DeskError("Weekly DCA requires an explicit purchase budget");
|
|
11684
|
+
if (!["live", "bundled", "upload"].includes(result.datasetSource) || result.datasetSource === "upload" && !object(result.dataset) || result.datasetSource !== "upload" && result.dataset !== undefined)
|
|
11685
|
+
throw new DeskError("Choose live, bundled or an uploaded daily dataset");
|
|
11686
|
+
if (result.dataset !== undefined && Buffer.byteLength(json2(result.dataset)) > 262144)
|
|
11687
|
+
throw new DeskError("Uploaded dataset exceeds 256 KiB", 413);
|
|
11688
|
+
if (result.datasetSource === "bundled" && result.asset !== "bitcoin")
|
|
11689
|
+
throw new DeskError("The bundled historical dataset is Bitcoin; choose its exact asset ID");
|
|
11690
|
+
return result;
|
|
11691
|
+
}
|
|
11692
|
+
async function startDesk(options) {
|
|
11693
|
+
const root = resolve5(options.directory), assets = resolve5(options.assetsDirectory ?? join5(import.meta.dir, "../desk"));
|
|
11694
|
+
const catalog = parseCatalog(options.catalog ?? skills_default), token = randomBytes(32).toString("hex");
|
|
11695
|
+
const active = new Map;
|
|
11696
|
+
const preparing = new Map;
|
|
11697
|
+
let stopped = false;
|
|
11698
|
+
let stopping;
|
|
11699
|
+
let profileCache = { runtimeAvailable: false, modelConfigured: false, credentialConfigured: false, authenticated: "unverified" };
|
|
11700
|
+
let profileCheckedAt = 0, profileGeneration = 0, profilePromise, profileController;
|
|
11701
|
+
let setup;
|
|
11702
|
+
let setupPromise;
|
|
11703
|
+
let setupController;
|
|
11704
|
+
await safe(root);
|
|
11705
|
+
await mkdir3(root, { recursive: true, mode: 448 });
|
|
11706
|
+
await mkdir3(await safe(root, [".boomkin"]), { recursive: true, mode: 448 });
|
|
11707
|
+
const lock = await safe(root, [".boomkin", "desk.lock"]);
|
|
11708
|
+
try {
|
|
11709
|
+
await mkdir3(lock, { mode: 448 });
|
|
11710
|
+
} catch (error) {
|
|
11711
|
+
if (error.code !== "EEXIST")
|
|
11712
|
+
throw error;
|
|
11713
|
+
const recovery = await safe(root, [".boomkin", "desk-recovery.lock"]);
|
|
11714
|
+
try {
|
|
11715
|
+
await mkdir3(recovery, { mode: 448 });
|
|
11716
|
+
} catch (error) {
|
|
11717
|
+
if (error.code === "EEXIST")
|
|
11718
|
+
throw new DeskError("Desk lock recovery is already in progress. Retry after it finishes; inspect a retained recovery lock before removing it", 409);
|
|
11719
|
+
throw error;
|
|
11720
|
+
}
|
|
11721
|
+
try {
|
|
11722
|
+
await writeFile3(join5(recovery, "owner.json"), json2({ pid: process.pid, startedAt: new Date().toISOString() }), { flag: "wx", mode: 384 });
|
|
11723
|
+
let owner;
|
|
11724
|
+
try {
|
|
11725
|
+
owner = JSON.parse(await limited(await safe(root, [".boomkin", "desk.lock", "owner.json"])));
|
|
11726
|
+
} catch {
|
|
11727
|
+
throw new DeskError("Desk lock has no verifiable owner; preserve it and inspect the profile", 409);
|
|
11728
|
+
}
|
|
11729
|
+
if (!object(owner) || !Number.isSafeInteger(owner.pid) || owner.pid <= 0)
|
|
11730
|
+
throw new DeskError("Desk lock owner is malformed", 409);
|
|
11731
|
+
let alive = true;
|
|
11732
|
+
try {
|
|
11733
|
+
process.kill(owner.pid, 0);
|
|
11734
|
+
} catch (error) {
|
|
11735
|
+
if (error.code === "ESRCH")
|
|
11736
|
+
alive = false;
|
|
11737
|
+
}
|
|
11738
|
+
if (alive)
|
|
11739
|
+
throw new DeskError("A desk already owns this profile. Use its existing window", 409);
|
|
11740
|
+
await rm3(lock, { recursive: true });
|
|
11741
|
+
await mkdir3(lock, { mode: 448 });
|
|
11742
|
+
} finally {
|
|
11743
|
+
await rm3(recovery, { recursive: true, force: true });
|
|
11744
|
+
}
|
|
11745
|
+
}
|
|
11746
|
+
await writeFile3(join5(lock, "owner.json"), json2({ pid: process.pid, startedAt: new Date().toISOString() }), { flag: "wx", mode: 384 });
|
|
11747
|
+
async function readMetadata(name) {
|
|
11748
|
+
return parseMetadata(JSON.parse(await limited(await safe(root, [...projectParts(name), "desk.json"]))));
|
|
11749
|
+
}
|
|
11750
|
+
async function readDeskRun(name, id) {
|
|
11751
|
+
return parseRun(JSON.parse(await limited(await safe(root, [...runParts(name, id), "desk.json"]))), name, id);
|
|
11752
|
+
}
|
|
11753
|
+
async function saveRun(run) {
|
|
11754
|
+
await atomic(root, [...runParts(run.project, run.id), "desk.json"], json2(run));
|
|
11755
|
+
}
|
|
11756
|
+
async function projectDto(project) {
|
|
11757
|
+
const meta = await readMetadata(project.name), runs = [];
|
|
11758
|
+
for (const run of await projectRuns(root, project.name)) {
|
|
11759
|
+
try {
|
|
11760
|
+
runs.push(await readDeskRun(project.name, run.id));
|
|
11761
|
+
} catch (error) {
|
|
11762
|
+
if (error.code !== "ENOENT")
|
|
11763
|
+
throw error;
|
|
11764
|
+
}
|
|
11765
|
+
}
|
|
11766
|
+
return { name: project.name, title: meta.title, kind: meta.kind, ...meta.execution ? { execution: meta.execution } : {}, createdAt: project.createdAt, inputs: project.inputs, runs: runs.reverse() };
|
|
11767
|
+
}
|
|
11768
|
+
async function projects() {
|
|
11769
|
+
const result = [];
|
|
11770
|
+
for (const project of await listProjects(root)) {
|
|
11771
|
+
try {
|
|
11772
|
+
result.push(await projectDto(project));
|
|
11773
|
+
} catch (error) {
|
|
11774
|
+
if (error.code !== "ENOENT")
|
|
11775
|
+
throw error;
|
|
11776
|
+
}
|
|
11777
|
+
}
|
|
11778
|
+
return result.sort((a, b) => b.createdAt.localeCompare(a.createdAt));
|
|
11779
|
+
}
|
|
11780
|
+
try {
|
|
11781
|
+
for (const project of await projects())
|
|
11782
|
+
for (const run of project.runs)
|
|
11783
|
+
if (["queued", "running"].includes(run.state)) {
|
|
11784
|
+
run.state = "interrupted";
|
|
11785
|
+
run.finishedAt = new Date().toISOString();
|
|
11786
|
+
run.progress = "The previous desk stopped before this run finished. Refresh to capture new evidence.";
|
|
11787
|
+
await saveRun(run);
|
|
11788
|
+
const previous = (await projectRuns(root, project.name)).find((item) => item.id === run.id);
|
|
11789
|
+
await atomic(root, [...runParts(project.name, run.id), "run.json"], json2({ ...previous, state: "failed", finishedAt: run.finishedAt, issues: [run.progress] }));
|
|
11790
|
+
if (run.execution !== "native-hermes")
|
|
11791
|
+
await rm3(await safe(root, [...projectParts(project.name), "run.lock"]), { recursive: true, force: true });
|
|
11792
|
+
}
|
|
11793
|
+
} catch (error) {
|
|
11794
|
+
await rm3(lock, { recursive: true, force: true });
|
|
11795
|
+
throw error;
|
|
11796
|
+
}
|
|
11797
|
+
async function installed(kind) {
|
|
11798
|
+
const contract = kinds[kind], recorded = JSON.parse(await limited(await safe(root, [".boomkin", "last-sync.json"])));
|
|
11799
|
+
const selected = parseCatalog(recorded.catalog), pack = selected.packs.find((item) => item.id === contract.pack && item.skills.includes(contract.skill));
|
|
11800
|
+
const reviewed = catalog.packs.find((item) => item.id === contract.pack);
|
|
11801
|
+
if (!pack || !reviewed)
|
|
11802
|
+
throw new DeskError(`Install ${contract.pack} in this profile`, 409);
|
|
11803
|
+
if (pack.version !== reviewed.version || pack.revision !== reviewed.revision || json2(pack) !== json2(reviewed))
|
|
11804
|
+
throw new DeskError("Installed release differs from the reviewed catalog; review update before running", 409);
|
|
11805
|
+
const skills = await safe(root, ["skills"]), skillPath = await safe(root, ["skills", contract.skill]);
|
|
11806
|
+
if (installedVersion(await limited(await safe(root, ["skills", contract.skill, "SKILL.md"]))) !== pack.version)
|
|
11807
|
+
throw new DeskError("Installed skill version differs from its recorded release", 409);
|
|
11808
|
+
const issues = await verifyIntegrity(skills, { schemaVersion: 3, packs: [pack] }, recorded.integrity);
|
|
11809
|
+
if (issues.length)
|
|
11810
|
+
throw new DeskError(issues.join("; "), 409);
|
|
11811
|
+
const path = await safe(root, ["skills", contract.skill, "scripts", contract.module]);
|
|
11812
|
+
await limited(path);
|
|
11813
|
+
return { pack, path };
|
|
11814
|
+
}
|
|
11815
|
+
async function reserve(key, operation) {
|
|
11816
|
+
if (stopped)
|
|
11817
|
+
throw new DeskError("This desk is shutting down", 503);
|
|
11818
|
+
if (setup?.state === "running")
|
|
11819
|
+
throw new DeskError("Finish setup before starting research", 409);
|
|
11820
|
+
if (preparing.has(key) || active.has(key))
|
|
11821
|
+
throw new DeskError("This project already has an active run", 409);
|
|
11822
|
+
const controller = new AbortController;
|
|
11823
|
+
let release;
|
|
11824
|
+
const done = new Promise((resolve) => {
|
|
11825
|
+
release = resolve;
|
|
11826
|
+
});
|
|
11827
|
+
preparing.set(key, { controller, done });
|
|
11828
|
+
try {
|
|
11829
|
+
return await operation(controller);
|
|
11830
|
+
} finally {
|
|
11831
|
+
preparing.delete(key);
|
|
11832
|
+
release();
|
|
11833
|
+
}
|
|
11834
|
+
}
|
|
11835
|
+
function checkProfile() {
|
|
11836
|
+
if (profilePromise || Date.now() - profileCheckedAt < 60000 || stopped)
|
|
11837
|
+
return;
|
|
11838
|
+
const generation = profileGeneration;
|
|
11839
|
+
profileController = new AbortController;
|
|
11840
|
+
profilePromise = localProfileStatus(root, { signal: profileController.signal }).then((value) => {
|
|
11841
|
+
if (generation === profileGeneration)
|
|
11842
|
+
profileCache = { runtimeAvailable: value.runtime.available, modelConfigured: value.modelConfigured, credentialConfigured: value.credentialConfigured, authenticated: value.authenticated };
|
|
11843
|
+
}, () => {
|
|
11844
|
+
if (generation === profileGeneration)
|
|
11845
|
+
profileCache.runtimeAvailable = false;
|
|
11846
|
+
}).finally(() => {
|
|
11847
|
+
profileCheckedAt = generation === profileGeneration ? Date.now() : 0;
|
|
11848
|
+
profilePromise = undefined;
|
|
11849
|
+
profileController = undefined;
|
|
11850
|
+
});
|
|
11851
|
+
}
|
|
11852
|
+
async function status() {
|
|
11853
|
+
checkProfile();
|
|
11854
|
+
let modelConfigured = false;
|
|
11855
|
+
try {
|
|
11856
|
+
modelConfigured = hermesModelConfigured(await readHermesConfig(root));
|
|
11857
|
+
} catch {}
|
|
11858
|
+
const profile = { ...profileCache, modelConfigured, runtimeChecking: !!profilePromise };
|
|
11859
|
+
const capabilities = await Promise.all(Object.keys(kinds).map(async (kind) => {
|
|
11860
|
+
try {
|
|
11861
|
+
await installed(kind);
|
|
11862
|
+
return { kind, ready: true, issues: [] };
|
|
11863
|
+
} catch (error) {
|
|
11864
|
+
return { kind, ready: false, issues: [error.code === "ENOENT" ? `Install ${kinds[kind].pack} in this profile` : error.message] };
|
|
11865
|
+
}
|
|
11866
|
+
}));
|
|
11867
|
+
return { schemaVersion: 1, version: package_default.version, ready: capabilities.every((item) => item.ready), profile, capabilities, activeRuns: active.size + preparing.size, ...setup ? { setup } : {}, setupAvailable: !!options.onSetup, modelSetupAvailable: !!options.onModelSetup };
|
|
11868
|
+
}
|
|
11869
|
+
async function create(body) {
|
|
11870
|
+
return reserve(`create-${randomUUID3()}`, async (controller) => {
|
|
11871
|
+
if (!object(body) || !Object.hasOwn(kinds, body.kind) || Object.keys(body).some((key) => !["kind", "title", "inputs"].includes(key)))
|
|
11872
|
+
throw new DeskError("Choose wallet, market or strategy");
|
|
11873
|
+
const kind = body.kind, input = normalizeInput(kind, body.inputs);
|
|
11874
|
+
const title = body.title ?? (kind === "wallet" ? "Hyperliquid wallet review" : kind === "market" ? `${input.asset} market research` : `${input.asset} strategy test`);
|
|
11875
|
+
if (typeof title !== "string" || !title.trim() || title.length > 160)
|
|
11876
|
+
throw new DeskError("Title must contain 1\u2013160 characters");
|
|
11877
|
+
const name = `${kind}-${randomUUID3().slice(0, 8)}`;
|
|
11878
|
+
controller.signal.throwIfAborted();
|
|
11879
|
+
const { dataset, ...savedInput } = input;
|
|
11880
|
+
if (dataset)
|
|
11881
|
+
savedInput.uploadedDatasetSha256 = sha(json2(dataset));
|
|
11882
|
+
const project = await createProject(root, { name, workflow: kinds[kind].workflow, inputs: savedInput, objective: title }, catalog);
|
|
11883
|
+
if (dataset)
|
|
11884
|
+
await writeFile3(await safe(root, [...projectParts(name), "input.json"]), json2(dataset), { flag: "wx", mode: 384 });
|
|
11885
|
+
await writeFile3(await safe(root, [...projectParts(name), "desk.json"]), json2({ schemaVersion: 1, kind, title }), { flag: "wx", mode: 384 });
|
|
11886
|
+
return projectDto(project);
|
|
11887
|
+
});
|
|
11888
|
+
}
|
|
11889
|
+
async function runDetails(name, id) {
|
|
11890
|
+
const run = await readDeskRun(name, id), parts = runParts(name, id);
|
|
11891
|
+
async function optional(file, parse = false) {
|
|
11892
|
+
try {
|
|
11893
|
+
const value = await limited(await safe(root, [...parts, file]), 20971520);
|
|
11894
|
+
return parse ? JSON.parse(value) : value;
|
|
11895
|
+
} catch (error) {
|
|
11896
|
+
if (error.code === "ENOENT")
|
|
11897
|
+
return null;
|
|
11898
|
+
throw error;
|
|
11899
|
+
}
|
|
11900
|
+
}
|
|
11901
|
+
let integrity = { issues: [] };
|
|
11902
|
+
if (["complete", "partial"].includes(run.state))
|
|
11903
|
+
integrity = { issues: (await checkProjectRun(root, name, id)).issues };
|
|
11904
|
+
return { run, report: await optional("report.md"), evidence: await optional("evidence.json", true), result: await optional("result.json", true), integrity };
|
|
11905
|
+
}
|
|
11906
|
+
async function startRun(name) {
|
|
11907
|
+
return reserve(name, async (controller) => {
|
|
11908
|
+
const project = await readProject(root, name), meta = await readMetadata(name), tools = await installed(meta.kind);
|
|
11909
|
+
controller.signal.throwIfAborted();
|
|
11910
|
+
if (meta.execution === "native-hermes")
|
|
11911
|
+
return startNative(project, meta, controller);
|
|
11912
|
+
const id = new Date().toISOString().replaceAll(":", "-").replace(".", "-") + "-" + randomUUID3().slice(0, 8), parts = runParts(name, id);
|
|
11913
|
+
const output = await safe(root, parts), createdAt = new Date().toISOString();
|
|
11914
|
+
const brief = json2(project), prompt = renderProjectPrompt(project, output, (await projectRuns(root, name)).at(-1));
|
|
11915
|
+
controller.signal.throwIfAborted();
|
|
11916
|
+
const projectLock = await safe(root, [...projectParts(name), "run.lock"]);
|
|
11917
|
+
try {
|
|
11918
|
+
await mkdir3(projectLock, { mode: 448 });
|
|
11919
|
+
} catch (error) {
|
|
11920
|
+
if (error.code === "EEXIST")
|
|
11921
|
+
throw new DeskError("This project already has an active run or an unresolved run lock", 409);
|
|
11922
|
+
throw error;
|
|
11923
|
+
}
|
|
11924
|
+
const run = { schemaVersion: 1, id, project: name, kind: meta.kind, createdAt, state: "queued", progress: "Preparing verified research tools" };
|
|
11925
|
+
const record = { schemaVersion: 1, id, project: name, createdAt, state: "prepared", briefSha256: sha(brief), promptSha256: sha(prompt), pack: tools.pack, maxTurns: 1 };
|
|
11926
|
+
try {
|
|
11927
|
+
await writeFile3(join5(projectLock, "owner.json"), json2({ pid: process.pid, runId: id, owner: "desk" }), { flag: "wx", mode: 384 });
|
|
11928
|
+
await mkdir3(output, { mode: 448 });
|
|
11929
|
+
await mkdir3(join5(output, "sources"), { mode: 448 });
|
|
11930
|
+
for (const [file, value] of [["brief.json", brief], ["prompt.md", prompt], ["run.json", json2(record)], ["desk.json", json2(run)]])
|
|
11931
|
+
await writeFile3(join5(output, file), value, { flag: "wx", mode: 384 });
|
|
11932
|
+
} catch (error) {
|
|
11933
|
+
await rm3(projectLock, { recursive: true, force: true });
|
|
11934
|
+
throw error;
|
|
11935
|
+
}
|
|
11936
|
+
const entry = { controller, done: Promise.resolve() };
|
|
11937
|
+
active.set(name, entry);
|
|
11938
|
+
entry.done = execute(project, tools, run, record, controller.signal).finally(async () => {
|
|
11939
|
+
active.delete(name);
|
|
11940
|
+
await rm3(projectLock, { recursive: true, force: true });
|
|
11941
|
+
});
|
|
11942
|
+
return run;
|
|
11943
|
+
});
|
|
11944
|
+
}
|
|
11945
|
+
async function followup(name, body) {
|
|
11946
|
+
return reserve(`followup-${name}`, async (controller) => {
|
|
11947
|
+
if (!object(body) || Object.keys(body).some((key) => !["question", "maxTurns"].includes(key)) || typeof body.question !== "string" || !body.question.trim() || body.question.length > 4000)
|
|
11948
|
+
throw new DeskError("Enter a follow-up question under 4000 characters");
|
|
11949
|
+
const maxTurns = body.maxTurns ?? 10;
|
|
11950
|
+
if (!Number.isInteger(maxTurns) || maxTurns < 1 || maxTurns > 30)
|
|
11951
|
+
throw new DeskError("Follow-up requires 1\u201330 native model turns");
|
|
11952
|
+
const previous = await readProject(root, name), meta = await readMetadata(name);
|
|
11953
|
+
await installed(meta.kind);
|
|
11954
|
+
const priorRun = (await projectRuns(root, name)).filter((item) => item.state === "ready-for-review").at(-1);
|
|
11955
|
+
if (!priorRun || (await checkProjectRun(root, name, priorRun.id)).issues.length)
|
|
11956
|
+
throw new DeskError("Follow up on a completed result with verified evidence", 409);
|
|
11957
|
+
checkProfile();
|
|
11958
|
+
await profilePromise;
|
|
11959
|
+
controller.signal.throwIfAborted();
|
|
11960
|
+
const config = await readHermesConfig(root);
|
|
11961
|
+
if (!profileCache.runtimeAvailable || !hermesModelConfigured(config))
|
|
11962
|
+
throw new DeskError("Configure the native Hermes runtime and model first", 409);
|
|
11963
|
+
const derivedName = `followup-${randomUUID3().slice(0, 8)}`;
|
|
11964
|
+
const question = body.question.trim(), title = `Follow-up: ${question}`.slice(0, 160);
|
|
11965
|
+
const project = await createProject(root, { name: derivedName, workflow: previous.workflow.id, objective: `Answer the user's follow-up using fresh public reads and the previous saved research as historical context. Question: ${question}`, inputs: { ...previous.inputs, followupQuestion: question, previousReport: await safe(root, [...runParts(name, priorRun.id), "report.md"]), previousEvidence: await safe(root, [...runParts(name, priorRun.id), "evidence.json"]) } }, catalog);
|
|
11966
|
+
const derived = { schemaVersion: 1, kind: meta.kind, title, execution: "native-hermes", maxTurns };
|
|
11967
|
+
await writeFile3(await safe(root, [...projectParts(derivedName), "desk.json"]), json2(derived), { flag: "wx", mode: 384 });
|
|
11968
|
+
const run = await startNative(project, derived, controller);
|
|
11969
|
+
return { project: await projectDto(project), run };
|
|
11970
|
+
});
|
|
11971
|
+
}
|
|
11972
|
+
async function startNative(project, meta, controller = new AbortController) {
|
|
11973
|
+
if (active.has(project.name))
|
|
11974
|
+
throw new DeskError("This project already has an active run", 409);
|
|
11975
|
+
let persisted, preparedResolve, preparedReject;
|
|
11976
|
+
const prepared = new Promise((resolve, reject) => {
|
|
11977
|
+
preparedResolve = resolve;
|
|
11978
|
+
preparedReject = reject;
|
|
11979
|
+
});
|
|
11980
|
+
const entry = { controller, done: Promise.resolve() };
|
|
11981
|
+
active.set(project.name, entry);
|
|
11982
|
+
entry.done = (async () => {
|
|
11983
|
+
try {
|
|
11984
|
+
const launched = await runProject(root, project.name, {
|
|
11985
|
+
signal: controller.signal,
|
|
11986
|
+
executable: options.nativeExecutable,
|
|
11987
|
+
maxTurns: meta.maxTurns ?? 10,
|
|
11988
|
+
onPrepared: async (record) => {
|
|
11989
|
+
persisted = { schemaVersion: 1, project: project.name, id: record.id, kind: meta.kind, execution: "native-hermes", createdAt: record.createdAt, state: "queued", progress: "Starting native Hermes with the configured model; provider usage may incur costs" };
|
|
11990
|
+
await saveRun(persisted);
|
|
11991
|
+
preparedResolve(persisted);
|
|
11992
|
+
},
|
|
11993
|
+
onProgress: async (message) => {
|
|
11994
|
+
if (persisted) {
|
|
11995
|
+
persisted.state = "running";
|
|
11996
|
+
persisted.progress = message;
|
|
11997
|
+
await saveRun(persisted);
|
|
11998
|
+
}
|
|
11999
|
+
}
|
|
12000
|
+
});
|
|
12001
|
+
if (!persisted || !launched.run)
|
|
12002
|
+
throw new Error("Native research did not produce its saved run record");
|
|
12003
|
+
persisted.state = launched.run.state === "ready-for-review" ? "complete" : "partial";
|
|
12004
|
+
persisted.finishedAt = launched.run.finishedAt;
|
|
12005
|
+
persisted.progress = launched.run.state === "ready-for-review" ? "Native research saved with validated evidence" : "Native research finished with evidence gaps that need review";
|
|
12006
|
+
await saveRun(persisted);
|
|
12007
|
+
} catch (error) {
|
|
12008
|
+
if (!persisted) {
|
|
12009
|
+
preparedReject(error);
|
|
12010
|
+
return;
|
|
12011
|
+
}
|
|
12012
|
+
persisted.state = controller.signal.aborted ? "cancelled" : "failed";
|
|
12013
|
+
persisted.finishedAt = new Date().toISOString();
|
|
12014
|
+
persisted.error = controller.signal.aborted ? "Native research cancelled; recorded evidence was preserved" : "Native research failed. Inspect the saved result and launching terminal before retrying.";
|
|
12015
|
+
persisted.progress = persisted.error;
|
|
12016
|
+
await saveRun(persisted);
|
|
12017
|
+
} finally {
|
|
12018
|
+
active.delete(project.name);
|
|
12019
|
+
}
|
|
12020
|
+
})();
|
|
12021
|
+
return prepared;
|
|
12022
|
+
}
|
|
12023
|
+
async function execute(project, tools, run, record, signal) {
|
|
12024
|
+
const parts = runParts(project.name, run.id), evidence = [];
|
|
12025
|
+
async function progress(message) {
|
|
12026
|
+
signal.throwIfAborted();
|
|
12027
|
+
run.progress = message;
|
|
12028
|
+
await saveRun(run);
|
|
12029
|
+
}
|
|
12030
|
+
async function artifact(filename, value, source, summary, limitations = [], observedAt = new Date().toISOString()) {
|
|
12031
|
+
signal.throwIfAborted();
|
|
12032
|
+
const id = filename.replace(/\.[^.]+$/, "").toLowerCase().replace(/[^a-z0-9-]/g, "-").slice(0, 63);
|
|
12033
|
+
await writeFile3(await safe(root, [...parts, "sources", filename]), value, { flag: "wx", mode: 384 });
|
|
12034
|
+
evidence.push({ id, source, observedAt, summary, artifact: `sources/${filename}`, sha256: sha(value), limitations });
|
|
12035
|
+
}
|
|
12036
|
+
let readSequence = 0;
|
|
12037
|
+
const fetcher = async (resource, init) => {
|
|
12038
|
+
signal.throwIfAborted();
|
|
12039
|
+
const url = String(resource), parsed = new URL(url);
|
|
12040
|
+
if (!["api.hyperliquid.xyz", "api.hyperliquid-testnet.xyz", "api.coingecko.com", "coins.llama.fi"].includes(parsed.hostname) || parsed.protocol !== "https:" || parsed.username || parsed.password || parsed.port)
|
|
12041
|
+
throw new DeskError("Helper requested an unreviewed endpoint", 409);
|
|
12042
|
+
let label = parsed.hostname.includes("hyperliquid") ? "Fetching account history" : "Fetching public market data";
|
|
12043
|
+
if (typeof init?.body === "string") {
|
|
12044
|
+
const type = JSON.parse(init.body).type;
|
|
12045
|
+
label = { userRole: "Checking public account identity", userAbstraction: "Checking account balance mode", clearinghouseState: "Fetching current perpetual exposure", spotClearinghouseState: "Fetching spot balances", frontendOpenOrders: "Fetching visible open orders", userFillsByTime: "Fetching fill history", userFunding: "Fetching funding cashflows" }[type] ?? label;
|
|
12046
|
+
}
|
|
12047
|
+
await progress(label);
|
|
12048
|
+
const sequence = ++readSequence;
|
|
12049
|
+
const response = await (options.fetcher ?? fetch)(resource, { ...init, credentials: "omit", redirect: "error", signal: init?.signal ? AbortSignal.any([signal, init.signal]) : signal });
|
|
12050
|
+
{
|
|
12051
|
+
const limit = run.kind === "wallet" ? 8388608 : 2097152, reader = response.body?.getReader();
|
|
12052
|
+
if (!reader || Number(response.headers.get("content-length")) > limit)
|
|
12053
|
+
throw new DeskError("Public response exceeds the capture bound", 502);
|
|
12054
|
+
const chunks = [];
|
|
12055
|
+
let length = 0;
|
|
12056
|
+
try {
|
|
12057
|
+
for (;; ) {
|
|
12058
|
+
const { done, value } = await reader.read();
|
|
12059
|
+
signal.throwIfAborted();
|
|
12060
|
+
if (done)
|
|
12061
|
+
break;
|
|
12062
|
+
length += value.length;
|
|
12063
|
+
if (length > limit)
|
|
12064
|
+
throw new DeskError("Public response exceeds the capture bound", 502);
|
|
12065
|
+
chunks.push(value);
|
|
12066
|
+
}
|
|
12067
|
+
} finally {
|
|
12068
|
+
await reader.cancel().catch(() => {});
|
|
12069
|
+
}
|
|
12070
|
+
const bytes = Buffer.concat(chunks);
|
|
12071
|
+
new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
12072
|
+
await artifact(`read-${String(sequence).padStart(3, "0")}.${run.kind === "wallet" ? "txt" : "json"}`, bytes, url, `Raw public response: HTTP ${response.status}; historical timestamps are contained in the response`, [run.kind === "wallet" ? "Sequential exchange snapshot; full-window completeness is unverified." : "Aggregate observations are not executable quotes."]);
|
|
12073
|
+
return new Response(bytes, { status: response.status, headers: response.headers });
|
|
12074
|
+
}
|
|
12075
|
+
};
|
|
12076
|
+
try {
|
|
12077
|
+
run.state = "running";
|
|
12078
|
+
record.state = "running";
|
|
12079
|
+
await saveRun(run);
|
|
12080
|
+
await atomic(root, [...parts, "run.json"], json2(record));
|
|
12081
|
+
const module = await import(pathToFileURL(tools.path).href + `?release=${tools.pack.revision}`);
|
|
12082
|
+
let result, report, partial = false;
|
|
12083
|
+
if (run.kind === "wallet") {
|
|
12084
|
+
const capture = await module.captureWallet({ address: project.inputs.account, network: project.inputs.network, startTime: Date.parse(String(project.inputs.startTime)), endTime: Date.parse(String(project.inputs.endTime)) }, { maxPages: project.inputs.maxPages, timeoutMs: 15000, fetchImpl: fetcher });
|
|
12085
|
+
signal.throwIfAborted();
|
|
12086
|
+
await progress("Calculating signed fees, funding and current exposure");
|
|
12087
|
+
const serialized = json2(capture), endpoint = project.inputs.network === "testnet" ? "https://api.hyperliquid-testnet.xyz/info" : "https://api.hyperliquid.xyz/info";
|
|
12088
|
+
if (Buffer.byteLength(serialized) <= 20971520)
|
|
12089
|
+
await artifact("capture.json", serialized, endpoint, "Captured public request/response manifest with hashes", ["Window completeness remains unverified."], capture.finishedAt);
|
|
12090
|
+
else {
|
|
12091
|
+
await writeFile3(await safe(root, [...parts, "sources", "capture.json"]), serialized, { flag: "wx", mode: 384 });
|
|
12092
|
+
const manifest = { ...capture, evidence: capture.evidence.map(({ responseText, ...entry }) => ({ ...entry, responseArtifact: responseText !== null ? `sources/read-${String(entry.sequence).padStart(3, "0")}.txt` : null })) };
|
|
12093
|
+
await artifact("capture-manifest.json", json2(manifest), endpoint, "Large capture manifest; raw responses are separate bounded evidence artifacts", ["Aggregate capture exceeds the individual evidence download bound; reconstruct from each response and this manifest."], capture.finishedAt);
|
|
12094
|
+
}
|
|
12095
|
+
result = module.analyzeCapture(capture);
|
|
12096
|
+
report = module.renderReport(result);
|
|
12097
|
+
partial = result.coverage.status === "partial";
|
|
12098
|
+
} else if (run.kind === "market") {
|
|
12099
|
+
result = await module.marketSnapshot({ ids: [project.inputs.asset], provider: "both" }, { fetch: fetcher, timeoutMs: 15000 });
|
|
12100
|
+
signal.throwIfAborted();
|
|
12101
|
+
if (result.status === "unavailable" || result.error) {
|
|
12102
|
+
await atomic(root, [...parts, "result.json"], json2(result));
|
|
12103
|
+
throw new DeskError("Market data is unavailable. Inspect provider errors and retry later.", 502);
|
|
12104
|
+
}
|
|
12105
|
+
const rows = result.reads.flatMap((read) => read.observations);
|
|
12106
|
+
report = `# ${project.inputs.asset} market snapshot
|
|
12107
|
+
|
|
12108
|
+
Exact identity: CoinGecko ID ${project.inputs.asset}. Public USD aggregate observations.
|
|
12109
|
+
|
|
12110
|
+
` + rows.map((row) => row.ok ? `${row.provider}: ${row.priceUsd} USD, observed ${row.observedAt}, retrieved ${row.retrievedAt}.` : `${row.provider}: unavailable (${row.error}).`).join(`
|
|
12111
|
+
|
|
12112
|
+
`) + `
|
|
12113
|
+
|
|
12114
|
+
${result.limitations.join(`
|
|
12115
|
+
|
|
12116
|
+
`)}
|
|
12117
|
+
|
|
12118
|
+
A price snapshot alone cannot establish valuation, investment quality or a complete asset thesis.
|
|
12119
|
+
`;
|
|
12120
|
+
partial = result.status !== "complete";
|
|
12121
|
+
} else {
|
|
12122
|
+
const input = project.inputs;
|
|
12123
|
+
const source = `https://raw.githubusercontent.com/galleonlabs/crypto-defi-skills/${tools.pack.revision}/packages/strategy/skills/galleon-defi-strategy-backtest/scripts/engine.mjs`;
|
|
12124
|
+
let dataset;
|
|
12125
|
+
if (input.datasetSource === "upload") {
|
|
12126
|
+
const uploaded = await limited(await safe(root, [...projectParts(project.name), "input.json"]), 262144);
|
|
12127
|
+
if (sha(uploaded) !== input.uploadedDatasetSha256)
|
|
12128
|
+
throw new DeskError("Saved uploaded dataset changed; create a new project", 409);
|
|
12129
|
+
dataset = JSON.parse(uploaded);
|
|
12130
|
+
await progress("Validating uploaded daily observations");
|
|
12131
|
+
} else if (input.datasetSource === "bundled") {
|
|
12132
|
+
dataset = JSON.parse(await limited(await safe(assets, ["data", "bitcoin-180d.json"]), 262144));
|
|
12133
|
+
await progress("Validating the explicitly selected historical Bitcoin series");
|
|
12134
|
+
} else {
|
|
12135
|
+
const dataTools = await installed("market"), dataModule = await import(pathToFileURL(dataTools.path).href + `?release=${dataTools.pack.revision}`);
|
|
12136
|
+
const collected = await dataModule.collectHistory({ id: input.asset, days: input.days }, { fetch: fetcher, timeoutMs: 15000 });
|
|
12137
|
+
signal.throwIfAborted();
|
|
12138
|
+
if (!collected.ok)
|
|
12139
|
+
throw new DeskError(`Daily history unavailable (${collected.error}); no substitute data was used`, 502);
|
|
12140
|
+
dataset = collected.dataset;
|
|
12141
|
+
}
|
|
12142
|
+
const valid = module.validateDataset(dataset);
|
|
12143
|
+
if (valid.identity.namespace !== "coingecko" || valid.identity.id !== input.asset)
|
|
12144
|
+
throw new DeskError("Dataset identity differs from the selected CoinGecko asset", 409);
|
|
12145
|
+
const spec = module.createStrategySpec(input.template, { initialCashUsd: input.initialCashUsd, feeBps: input.feeBps, slippageBps: input.slippageBps, ...input.amountUsd !== undefined ? { amountUsd: input.amountUsd } : {} });
|
|
12146
|
+
await artifact("dataset.json", json2(valid), valid.provenance.synthetic ? source : valid.provenance.source, `${valid.identity.id} daily USD observations, retrieved ${valid.provenance.retrievedAt}`, [valid.provenance.synthetic ? "Synthetic dataset: source URL documents the model, not market history. Dataset provenance remains in the captured JSON." : "Historical aggregate series; source timestamps and price type are retained."]);
|
|
12147
|
+
await artifact("specification.json", json2(spec), source, "Frozen rule and explicit cash, fee and slippage assumptions", ["No parameter optimization or future-return claim."]);
|
|
12148
|
+
await progress("Comparing reference and held-out periods with higher trading costs");
|
|
12149
|
+
result = module.runStrategyValidation(valid, spec);
|
|
12150
|
+
result.inputHashes = { datasetSha256: sha(json2(valid)), specificationSha256: sha(json2(spec)), engineSha256: sha(await readFile5(tools.path)) };
|
|
12151
|
+
report = `# ${input.asset} frozen-rule strategy validation
|
|
12152
|
+
|
|
12153
|
+
Evidence: ${valid.provenance.synthetic ? "synthetic example" : "historical simulation"}. Source: ${valid.provenance.source}. Dataset retrieved ${valid.provenance.retrievedAt}.
|
|
12154
|
+
|
|
12155
|
+
Rule: ${input.template}. Each period restarts independently with ${input.initialCashUsd} USD.
|
|
12156
|
+
|
|
12157
|
+
` + ["reference", "heldOut"].map((period) => {
|
|
12158
|
+
const row = result.periods[period];
|
|
12159
|
+
return `${period === "heldOut" ? "Held-out" : "Reference"}: ${row.period.firstObservation} to ${row.period.lastObservation}. Baseline ending equity ${row.baseline.metrics.endingEquityUsd} USD; maximum drawdown ${row.baseline.metrics.maxDrawdownPct}%. Higher-cost ending equity ${row.higherCosts.metrics.endingEquityUsd} USD. Same-cost buy-and-hold benchmark ${row.baseline.benchmark.metrics.endingEquityUsd} USD.`;
|
|
12160
|
+
}).join(`
|
|
12161
|
+
|
|
12162
|
+
`) + `
|
|
12163
|
+
|
|
12164
|
+
${result.limitations.join(`
|
|
12165
|
+
|
|
12166
|
+
`)}
|
|
12167
|
+
`;
|
|
12168
|
+
}
|
|
12169
|
+
signal.throwIfAborted();
|
|
12170
|
+
report += `
|
|
12171
|
+
|
|
12172
|
+
Captured evidence:
|
|
12173
|
+
` + evidence.map((item) => `
|
|
12174
|
+
- [${item.id}] ${item.summary}`).join("") + `
|
|
12175
|
+
`;
|
|
12176
|
+
await atomic(root, [...parts, "result.json"], json2(result));
|
|
12177
|
+
await atomic(root, [...parts, "report.md"], report);
|
|
12178
|
+
await atomic(root, [...parts, "evidence.json"], json2({ schemaVersion: 1, observations: evidence }));
|
|
12179
|
+
await atomic(root, [...parts, "plan.json"], json2({ schemaVersion: 1, status: "no-action", authorization: "not-granted", summary: "Read-only research; no financial action or authority", steps: [] }));
|
|
12180
|
+
record.state = "needs-review";
|
|
12181
|
+
record.finishedAt = new Date().toISOString();
|
|
12182
|
+
await atomic(root, [...parts, "run.json"], json2(record));
|
|
12183
|
+
const checked = await checkProjectRun(root, project.name, run.id);
|
|
12184
|
+
if (checked.issues.length)
|
|
12185
|
+
throw new DeskError("Saved result failed evidence validation: " + checked.issues.join("; "), 409);
|
|
12186
|
+
record.state = "ready-for-review";
|
|
12187
|
+
await atomic(root, [...parts, "run.json"], json2(record));
|
|
12188
|
+
run.state = partial ? "partial" : "complete";
|
|
12189
|
+
run.finishedAt = record.finishedAt;
|
|
12190
|
+
run.progress = partial ? "Saved with explicit missing or partial observations" : "Research saved; sources and methodology are available";
|
|
12191
|
+
await saveRun(run);
|
|
12192
|
+
} catch (error) {
|
|
12193
|
+
const message = signal.aborted ? "Capture cancelled. Refresh starts a new run; previous evidence was preserved." : error.message;
|
|
12194
|
+
run.state = signal.aborted ? "cancelled" : "failed";
|
|
12195
|
+
run.finishedAt = new Date().toISOString();
|
|
12196
|
+
run.error = message;
|
|
12197
|
+
run.progress = message;
|
|
12198
|
+
record.state = "failed";
|
|
12199
|
+
record.finishedAt = run.finishedAt;
|
|
12200
|
+
record.issues = [message];
|
|
12201
|
+
await atomic(root, [...parts, "evidence.json"], json2({ schemaVersion: 1, observations: evidence }));
|
|
12202
|
+
await atomic(root, [...parts, "report.md"], `# Research incomplete
|
|
12203
|
+
|
|
12204
|
+
${message}
|
|
12205
|
+
|
|
12206
|
+
${evidence.map((item) => `[${item.id}] ${item.summary}`).join(`
|
|
12207
|
+
|
|
12208
|
+
`)}
|
|
12209
|
+
`);
|
|
12210
|
+
await atomic(root, [...parts, "plan.json"], json2({ schemaVersion: 1, status: "no-action", authorization: "not-granted", summary: message, steps: [] }));
|
|
12211
|
+
await atomic(root, [...parts, "run.json"], json2(record));
|
|
12212
|
+
await saveRun(run);
|
|
12213
|
+
}
|
|
12214
|
+
}
|
|
12215
|
+
let origin = "";
|
|
12216
|
+
const headers = { "cache-control": "no-store", "x-content-type-options": "nosniff", "referrer-policy": "no-referrer", "content-security-policy": "default-src 'self'; connect-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; form-action 'self'" };
|
|
12217
|
+
function response(value, status = 200) {
|
|
12218
|
+
return Response.json(value, { status, headers });
|
|
12219
|
+
}
|
|
12220
|
+
async function requestJson(request) {
|
|
12221
|
+
if (request.headers.get("content-type")?.split(";")[0].trim() !== "application/json")
|
|
12222
|
+
throw new DeskError("Use application/json", 415);
|
|
12223
|
+
if (Number(request.headers.get("content-length")) > 327680)
|
|
12224
|
+
throw new DeskError("Request exceeds 320 KiB", 413);
|
|
12225
|
+
const reader = request.body?.getReader();
|
|
12226
|
+
if (!reader)
|
|
12227
|
+
throw new DeskError("JSON body is required");
|
|
12228
|
+
let length = 0;
|
|
12229
|
+
const chunks = [];
|
|
12230
|
+
try {
|
|
12231
|
+
for (;; ) {
|
|
12232
|
+
const { value, done } = await reader.read();
|
|
12233
|
+
if (done)
|
|
12234
|
+
break;
|
|
12235
|
+
length += value.length;
|
|
12236
|
+
if (length > 327680)
|
|
12237
|
+
throw new DeskError("Request exceeds 320 KiB", 413);
|
|
12238
|
+
chunks.push(value);
|
|
12239
|
+
}
|
|
12240
|
+
} finally {
|
|
12241
|
+
await reader.cancel().catch(() => {});
|
|
12242
|
+
}
|
|
12243
|
+
try {
|
|
12244
|
+
return JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
12245
|
+
} catch {
|
|
12246
|
+
throw new DeskError("Invalid JSON request");
|
|
12247
|
+
}
|
|
12248
|
+
}
|
|
12249
|
+
const server = await (async () => {
|
|
12250
|
+
try {
|
|
12251
|
+
return Bun.serve({
|
|
12252
|
+
hostname: "127.0.0.1",
|
|
12253
|
+
port: options.port ?? 0,
|
|
12254
|
+
maxRequestBodySize: 327680,
|
|
12255
|
+
async fetch(request) {
|
|
12256
|
+
try {
|
|
12257
|
+
if (stopped)
|
|
12258
|
+
throw new DeskError("This desk is shutting down", 503);
|
|
12259
|
+
const url = new URL(request.url);
|
|
12260
|
+
if (request.headers.get("host") !== new URL(origin).host || url.origin !== origin)
|
|
12261
|
+
throw new DeskError("Unexpected desk host", 403);
|
|
12262
|
+
const requestOrigin = request.headers.get("origin");
|
|
12263
|
+
if (requestOrigin && requestOrigin !== origin || request.headers.get("sec-fetch-site") === "cross-site")
|
|
12264
|
+
throw new DeskError("Only the local desk origin is allowed", 403);
|
|
12265
|
+
const path = url.pathname;
|
|
12266
|
+
if (path.startsWith("/api/")) {
|
|
12267
|
+
const supplied = request.headers.get("authorization")?.replace(/^Bearer /, "") ?? "";
|
|
12268
|
+
if (!/^[0-9a-f]{64}$/.test(supplied) || !timingSafeEqual(Buffer.from(supplied), Buffer.from(token)))
|
|
12269
|
+
throw new DeskError("This desk session requires its launch token", 401);
|
|
12270
|
+
if (!["GET", "POST"].includes(request.method))
|
|
12271
|
+
throw new DeskError("Method not allowed", 405);
|
|
12272
|
+
if (request.method === "GET" && path === "/api/status")
|
|
12273
|
+
return response(await status());
|
|
12274
|
+
if (request.method === "GET" && path === "/api/projects")
|
|
12275
|
+
return response({ projects: await projects() });
|
|
12276
|
+
if (request.method === "POST" && ["/api/setup", "/api/model-setup"].includes(path)) {
|
|
12277
|
+
if (active.size || preparing.size || setup?.state === "running")
|
|
12278
|
+
throw new DeskError("A capture or setup is already running", 409);
|
|
12279
|
+
const callback = path === "/api/setup" ? options.onSetup : options.onModelSetup;
|
|
12280
|
+
if (!callback)
|
|
12281
|
+
throw new DeskError("This launcher does not provide this setup action", 409);
|
|
12282
|
+
setup = { state: "running", action: path === "/api/setup" ? "public-tools" : "model", message: path === "/api/setup" ? "Installing reviewed public research tools" : "Preparing Hermes's browser setup; the first build can take several minutes" };
|
|
12283
|
+
setupController = new AbortController;
|
|
12284
|
+
setupPromise = Promise.resolve().then(() => callback(setupController.signal)).then((value) => {
|
|
12285
|
+
profileCheckedAt = 0;
|
|
12286
|
+
profileGeneration++;
|
|
12287
|
+
profileController?.abort();
|
|
12288
|
+
let result;
|
|
12289
|
+
if (object(value) && typeof value.url === "string") {
|
|
12290
|
+
const destination = new URL(value.url);
|
|
12291
|
+
if (destination.protocol === "http:" && destination.hostname === "127.0.0.1" && !destination.username && !destination.password)
|
|
12292
|
+
result = { url: value.url };
|
|
12293
|
+
}
|
|
12294
|
+
setup = { ...setup, state: "complete", message: result ? "Native model setup is available in its local window" : "Setup completed; readiness is checked against the selected profile", ...result ? { result } : {} };
|
|
12295
|
+
}).catch((error) => {
|
|
12296
|
+
setup = { ...setup, state: "failed", message: error.message };
|
|
12297
|
+
});
|
|
12298
|
+
return response({ setup }, 202);
|
|
12299
|
+
}
|
|
12300
|
+
if (request.method === "POST" && path === "/api/projects")
|
|
12301
|
+
return response({ project: await create(await requestJson(request)) }, 201);
|
|
12302
|
+
const match = path.match(/^\/api\/projects\/([a-z0-9-]+)(?:\/runs\/([^/]+)(?:\/(export|cancel|evidence)(?:\/([^/]+))?)?|\/(run|refresh|followup))?$/);
|
|
12303
|
+
if (!match)
|
|
12304
|
+
throw new DeskError("Unknown desk route", 404);
|
|
12305
|
+
const [, name, id, action, observationId, operation] = match;
|
|
12306
|
+
if (!id && !operation && request.method === "GET")
|
|
12307
|
+
return response({ project: await projectDto(await readProject(root, name)) });
|
|
12308
|
+
if (operation === "followup" && request.method === "POST")
|
|
12309
|
+
return response(await followup(name, await requestJson(request)), 202);
|
|
12310
|
+
if (operation && request.method === "POST")
|
|
12311
|
+
return response({ run: await startRun(name) }, 202);
|
|
12312
|
+
if (id) {
|
|
12313
|
+
if (action === "cancel" && request.method === "POST") {
|
|
12314
|
+
const run = await readDeskRun(name, id), pending = active.get(name);
|
|
12315
|
+
if (!pending || !["queued", "running"].includes(run.state))
|
|
12316
|
+
throw new DeskError("This run is no longer active", 409);
|
|
12317
|
+
const current = (await projectRuns(root, name)).at(-1);
|
|
12318
|
+
if (current?.id !== id)
|
|
12319
|
+
throw new DeskError("Only the active run can be cancelled", 409);
|
|
12320
|
+
pending.controller.abort();
|
|
12321
|
+
await pending.done;
|
|
12322
|
+
return response({ run: await readDeskRun(name, id) });
|
|
12323
|
+
}
|
|
12324
|
+
if (request.method === "GET" && action === "evidence") {
|
|
12325
|
+
if (!observationId || !slug.test(observationId))
|
|
12326
|
+
throw new DeskError("Invalid observation ID");
|
|
12327
|
+
const detail = await runDetails(name, id), evidence = detail.evidence?.observations?.find((item) => item.id === observationId);
|
|
12328
|
+
if (!evidence || !/^sources\/(?:[a-zA-Z0-9][a-zA-Z0-9._-]*\/)*[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(evidence.artifact))
|
|
12329
|
+
throw new DeskError("Unknown captured observation", 404);
|
|
12330
|
+
const bytes = await limitedBytes(await safe(root, [...runParts(name, id), ...evidence.artifact.split("/")]), 20971520);
|
|
12331
|
+
if (sha(bytes) !== evidence.sha256)
|
|
12332
|
+
throw new DeskError("Captured artifact hash differs from its evidence record", 409);
|
|
12333
|
+
return new Response(bytes, { headers: { ...headers, "content-type": "text/plain; charset=utf-8" } });
|
|
12334
|
+
}
|
|
12335
|
+
if (request.method === "GET" && (!action || action === "export")) {
|
|
12336
|
+
const detail = await runDetails(name, id);
|
|
12337
|
+
if (action === "export")
|
|
12338
|
+
return new Response(json2(detail), { headers: { ...headers, "content-type": "application/json", "content-disposition": `attachment; filename="${name}-${id}.json"` } });
|
|
12339
|
+
return response(detail);
|
|
12340
|
+
}
|
|
12341
|
+
}
|
|
12342
|
+
throw new DeskError("Unknown desk operation", 404);
|
|
12343
|
+
}
|
|
12344
|
+
if (request.method !== "GET" && request.method !== "HEAD")
|
|
12345
|
+
throw new DeskError("Method not allowed", 405);
|
|
12346
|
+
const files = {
|
|
12347
|
+
"/": { parts: ["index.html"], type: "text/html; charset=utf-8" },
|
|
12348
|
+
"/index.html": { parts: ["index.html"], type: "text/html; charset=utf-8" },
|
|
12349
|
+
"/app.js": { parts: ["app.js"], type: "text/javascript; charset=utf-8" },
|
|
12350
|
+
"/style.css": { parts: ["style.css"], type: "text/css; charset=utf-8" },
|
|
12351
|
+
"/assets/app.js": { parts: ["app.js"], type: "text/javascript; charset=utf-8" },
|
|
12352
|
+
"/assets/ui.js": { parts: ["ui.js"], type: "text/javascript; charset=utf-8" },
|
|
12353
|
+
"/assets/desk.css": { parts: ["desk.css"], type: "text/css; charset=utf-8" },
|
|
12354
|
+
"/assets/favicon.svg": { parts: ["assets", "favicon.svg"], type: "image/svg+xml" },
|
|
12355
|
+
"/assets/manrope.ttf": { parts: ["assets", "manrope.ttf"], type: "font/ttf" },
|
|
12356
|
+
"/assets/strategy-engine.mjs": { parts: ["vendor", "strategy-engine.mjs"], type: "text/javascript; charset=utf-8" },
|
|
12357
|
+
"/assets/bitcoin-180d.json": { parts: ["data", "bitcoin-180d.json"], type: "application/json" },
|
|
12358
|
+
"/assets/synthetic-daily.json": { parts: ["data", "synthetic-daily.json"], type: "application/json" }
|
|
12359
|
+
};
|
|
12360
|
+
if (!Object.hasOwn(files, path))
|
|
12361
|
+
throw new DeskError("Unknown desk asset", 404);
|
|
12362
|
+
const file = files[path], filePath = await safe(assets, file.parts);
|
|
12363
|
+
const stat = await lstat4(filePath);
|
|
12364
|
+
if (!stat.isFile() || stat.size > 1048576)
|
|
12365
|
+
throw new DeskError("Expected a bounded regular asset", 409);
|
|
12366
|
+
const contents = await readFile5(filePath);
|
|
12367
|
+
return new Response(request.method === "HEAD" ? null : contents, { headers: { ...headers, "content-type": file.type } });
|
|
12368
|
+
} catch (error) {
|
|
12369
|
+
const status = error instanceof DeskError ? error.status : error.code === "ENOENT" ? 404 : 500;
|
|
12370
|
+
return response({ error: { message: status === 500 ? "Desk operation failed; saved files were preserved" : error.message } }, status);
|
|
12371
|
+
}
|
|
12372
|
+
}
|
|
12373
|
+
});
|
|
12374
|
+
} catch (error) {
|
|
12375
|
+
await rm3(lock, { recursive: true, force: true });
|
|
12376
|
+
throw error;
|
|
12377
|
+
}
|
|
12378
|
+
})();
|
|
12379
|
+
origin = `http://127.0.0.1:${server.port}`;
|
|
12380
|
+
return { url: `${origin}/#token=${token}`, server, async stop() {
|
|
12381
|
+
if (stopping)
|
|
12382
|
+
return stopping;
|
|
12383
|
+
stopped = true;
|
|
12384
|
+
stopping = (async () => {
|
|
12385
|
+
profileController?.abort();
|
|
12386
|
+
setupController?.abort();
|
|
12387
|
+
for (const entry of preparing.values())
|
|
12388
|
+
entry.controller.abort();
|
|
12389
|
+
for (const entry of active.values())
|
|
12390
|
+
entry.controller.abort();
|
|
12391
|
+
await Promise.allSettled([...preparing.values()].map((entry) => entry.done));
|
|
12392
|
+
for (const entry of active.values())
|
|
12393
|
+
entry.controller.abort();
|
|
12394
|
+
await Promise.allSettled([...active.values()].map((entry) => entry.done));
|
|
12395
|
+
await Promise.allSettled([profilePromise, setupPromise]);
|
|
12396
|
+
server.stop(true);
|
|
12397
|
+
await rm3(lock, { recursive: true, force: true });
|
|
12398
|
+
})();
|
|
12399
|
+
return stopping;
|
|
12400
|
+
} };
|
|
12401
|
+
}
|
|
12402
|
+
|
|
12403
|
+
// src/desk-launch.ts
|
|
12404
|
+
init_core();
|
|
12405
|
+
import { lstat as lstat5, readFile as readFile6 } from "fs/promises";
|
|
12406
|
+
import { join as join6, resolve as resolve6 } from "path";
|
|
12407
|
+
import { fileURLToPath } from "url";
|
|
12408
|
+
var publicDeskPacks = ["defi-data-skills", "hyperliquid-skills", "defi-strategy-skills"];
|
|
12409
|
+
async function deskSetupPacks(directory, catalog) {
|
|
12410
|
+
const root = resolve6(directory);
|
|
12411
|
+
const file = join6(root, ".boomkin/config.json");
|
|
12412
|
+
let previous = [];
|
|
12413
|
+
try {
|
|
12414
|
+
for (const path of [root, join6(root, ".boomkin"), file])
|
|
12415
|
+
if ((await lstat5(path)).isSymbolicLink())
|
|
12416
|
+
throw new Error("Refusing a symlink in the selected profile");
|
|
12417
|
+
const config = parseConfig(JSON.parse(await readFile6(file, "utf8")), root);
|
|
12418
|
+
if (config.harness !== "hermes")
|
|
12419
|
+
throw new Error("The local desk requires a Hermes profile; choose another directory");
|
|
12420
|
+
previous = config.packs ?? catalog.packs.map((pack) => pack.id);
|
|
12421
|
+
} catch (error) {
|
|
12422
|
+
if (error.code !== "ENOENT")
|
|
12423
|
+
throw error;
|
|
12424
|
+
}
|
|
12425
|
+
return [...new Set([...previous, ...publicDeskPacks])];
|
|
12426
|
+
}
|
|
12427
|
+
function deskAssetsDirectory(moduleUrl) {
|
|
12428
|
+
const file = fileURLToPath(moduleUrl);
|
|
12429
|
+
return file.endsWith("/dist/cli.js") ? join6(file, "../desk") : join6(file, "../../dist/desk");
|
|
12430
|
+
}
|
|
12431
|
+
function deskPort(value) {
|
|
12432
|
+
if (value === undefined)
|
|
12433
|
+
return 0;
|
|
12434
|
+
if (!/^(?:0|[1-9]\d{0,4})$/.test(value) || Number(value) > 65535)
|
|
12435
|
+
throw new Error("--port must be an integer from 0 to 65535");
|
|
12436
|
+
return Number(value);
|
|
12437
|
+
}
|
|
12438
|
+
|
|
12439
|
+
// src/desk-model.ts
|
|
12440
|
+
import { join as join7, resolve as resolve7 } from "path";
|
|
12441
|
+
function dashboardEnvironment(directory, inherited = process.env) {
|
|
12442
|
+
const root = resolve7(directory);
|
|
12443
|
+
const env = { ...inherited, HERMES_HOME: root, HERMES_CONFIG: join7(root, "config.yaml"), HERMES_ENV: join7(root, ".env") };
|
|
12444
|
+
for (const key of ["HERMES_DESKTOP", "HERMES_SERVE_HEADLESS", "HERMES_WEB_DIST", "HERMES_DASHBOARD_SESSION_TOKEN", "HERMES_SESSION_KEY"])
|
|
12445
|
+
delete env[key];
|
|
12446
|
+
return env;
|
|
12447
|
+
}
|
|
12448
|
+
function createNativeDashboard(directory, options = {}) {
|
|
12449
|
+
let child;
|
|
12450
|
+
let probe;
|
|
12451
|
+
let opening;
|
|
12452
|
+
let readyUrl;
|
|
12453
|
+
let stopped = false;
|
|
12454
|
+
const terminate = async (target) => {
|
|
12455
|
+
if (!target)
|
|
12456
|
+
return;
|
|
12457
|
+
await terminateOwnedProcess(target, process.platform !== "win32");
|
|
12458
|
+
if (child === target) {
|
|
12459
|
+
child = undefined;
|
|
12460
|
+
readyUrl = undefined;
|
|
12461
|
+
}
|
|
12462
|
+
if (probe === target)
|
|
12463
|
+
probe = undefined;
|
|
12464
|
+
};
|
|
12465
|
+
const stop = async () => {
|
|
12466
|
+
stopped = true;
|
|
12467
|
+
await Promise.all([terminate(child), terminate(probe)]);
|
|
12468
|
+
readyUrl = undefined;
|
|
12469
|
+
};
|
|
12470
|
+
const open = async () => {
|
|
12471
|
+
if (stopped)
|
|
12472
|
+
throw new Error("The desk has stopped");
|
|
12473
|
+
if (readyUrl && child?.exitCode === null)
|
|
12474
|
+
return { url: readyUrl };
|
|
12475
|
+
if (opening)
|
|
12476
|
+
return opening;
|
|
12477
|
+
opening = (async () => {
|
|
12478
|
+
const executable = options.executable ?? await findRuntime(directory);
|
|
12479
|
+
if (!executable)
|
|
12480
|
+
throw new Error("Prepare native Hermes before connecting a model");
|
|
12481
|
+
const env = dashboardEnvironment(directory, options.environment);
|
|
12482
|
+
const helpProbe = probe = Bun.spawn([executable, "--profile", "default", "dashboard", "--help"], { cwd: resolve7(directory), env, stdin: "ignore", stdout: "pipe", stderr: "pipe", detached: process.platform !== "win32" });
|
|
12483
|
+
new Response(helpProbe.stderr).arrayBuffer();
|
|
12484
|
+
const probeTimeout = setTimeout(() => {
|
|
12485
|
+
terminate(helpProbe);
|
|
12486
|
+
}, 15000);
|
|
12487
|
+
let help, probeCode;
|
|
12488
|
+
try {
|
|
12489
|
+
help = await new Response(helpProbe.stdout).text();
|
|
12490
|
+
probeCode = await helpProbe.exited;
|
|
12491
|
+
} finally {
|
|
12492
|
+
clearTimeout(probeTimeout);
|
|
12493
|
+
}
|
|
12494
|
+
if (probe === helpProbe)
|
|
12495
|
+
probe = undefined;
|
|
12496
|
+
if (probeCode !== 0 || ["--no-open", "--isolated", "--host", "--port"].some((flag) => !help.includes(flag)))
|
|
12497
|
+
throw new Error("This Hermes installation lacks the reviewed browser setup contract. Use its native update or boomkin model in your terminal.");
|
|
12498
|
+
if (stopped)
|
|
12499
|
+
throw new Error("The desk has stopped");
|
|
12500
|
+
const started = child = Bun.spawn([executable, "--profile", "default", "dashboard", "--no-open", "--isolated", "--host", "127.0.0.1", "--port", "0"], { cwd: resolve7(directory), env, stdin: "ignore", stdout: "pipe", stderr: "pipe", detached: process.platform !== "win32" });
|
|
12501
|
+
let resolvePort;
|
|
12502
|
+
const portReady = new Promise((done) => {
|
|
12503
|
+
resolvePort = done;
|
|
12504
|
+
});
|
|
12505
|
+
const consume = async (stream) => {
|
|
12506
|
+
const decoder = new TextDecoder;
|
|
12507
|
+
let tail = "";
|
|
12508
|
+
for await (const bytes of stream) {
|
|
12509
|
+
const lines = (tail + decoder.decode(bytes, { stream: true })).split(`
|
|
12510
|
+
`);
|
|
12511
|
+
tail = lines.pop().slice(-4096);
|
|
12512
|
+
for (const line of lines) {
|
|
12513
|
+
const match = line.match(/^HERMES_DASHBOARD_READY port=(\d{1,5})\r?$/);
|
|
12514
|
+
if (match && Number(match[1]) >= 1 && Number(match[1]) <= 65535)
|
|
12515
|
+
resolvePort(Number(match[1]));
|
|
12516
|
+
}
|
|
12517
|
+
}
|
|
12518
|
+
};
|
|
12519
|
+
consume(started.stdout).catch(() => {});
|
|
12520
|
+
consume(started.stderr).catch(() => {});
|
|
12521
|
+
let timeout;
|
|
12522
|
+
try {
|
|
12523
|
+
const port = await Promise.race([
|
|
12524
|
+
portReady,
|
|
12525
|
+
started.exited.then(() => {
|
|
12526
|
+
throw new Error("Native browser setup exited before it was ready. Check Hermes's dashboard prerequisites, including its supported Node.js version, or use boomkin model in your terminal.");
|
|
12527
|
+
}),
|
|
12528
|
+
new Promise((_, reject) => {
|
|
12529
|
+
timeout = setTimeout(() => reject(new Error("Native browser setup timed out while preparing its dashboard. Check Hermes's prerequisites or use boomkin model in your terminal.")), options.startupTimeoutMs ?? 900000);
|
|
12530
|
+
})
|
|
12531
|
+
]);
|
|
12532
|
+
if (stopped || started.exitCode !== null)
|
|
12533
|
+
throw new Error("Native browser setup has stopped");
|
|
12534
|
+
const origin = `http://127.0.0.1:${port}`;
|
|
12535
|
+
const response = await fetch(`${origin}/api/health`, { redirect: "error", signal: AbortSignal.timeout(5000) });
|
|
12536
|
+
const health = await response.json();
|
|
12537
|
+
if (!response.ok || health.ok !== true || typeof health.version !== "string" || started.exitCode !== null)
|
|
12538
|
+
throw new Error("Native browser setup did not confirm its health");
|
|
12539
|
+
readyUrl = `${origin}/env`;
|
|
12540
|
+
return { url: readyUrl };
|
|
12541
|
+
} catch (error) {
|
|
12542
|
+
await terminate(started);
|
|
12543
|
+
throw error;
|
|
12544
|
+
} finally {
|
|
12545
|
+
if (timeout)
|
|
12546
|
+
clearTimeout(timeout);
|
|
12547
|
+
}
|
|
12548
|
+
})();
|
|
12549
|
+
try {
|
|
12550
|
+
return await opening;
|
|
12551
|
+
} finally {
|
|
12552
|
+
opening = undefined;
|
|
12553
|
+
}
|
|
12554
|
+
};
|
|
12555
|
+
return { open, stop };
|
|
12556
|
+
}
|
|
11324
12557
|
|
|
11325
12558
|
// src/cli.ts
|
|
11326
12559
|
var help = `Boomkin \u2014 your Hermes DeFi agent.
|
|
11327
12560
|
|
|
12561
|
+
boomkin desk
|
|
12562
|
+
boomkin desk --directory ~/.boomkin/hermes --no-open
|
|
11328
12563
|
boomkin onboard
|
|
11329
12564
|
boomkin doctor --live
|
|
11330
12565
|
boomkin start
|
|
@@ -11334,6 +12569,9 @@ boomkin providers --access keyless
|
|
|
11334
12569
|
boomkin providers --provider blockscout
|
|
11335
12570
|
boomkin workflows
|
|
11336
12571
|
boomkin workflows --workflow aave-health
|
|
12572
|
+
boomkin templates
|
|
12573
|
+
boomkin templates --template wallet-audit --json
|
|
12574
|
+
boomkin project create --name wallet-review --template wallet-audit --input-file ./inputs.json
|
|
11337
12575
|
boomkin project create --name my-research --workflow yield-screen --input-file ./inputs.json
|
|
11338
12576
|
boomkin project run --name my-research --dry-run
|
|
11339
12577
|
boomkin project run --name my-research
|
|
@@ -11349,6 +12587,10 @@ boomkin chatgpt --action status
|
|
|
11349
12587
|
boomkin check --directory ~/.boomkin/hermes
|
|
11350
12588
|
boomkin update --directory ~/.boomkin/hermes
|
|
11351
12589
|
|
|
12590
|
+
desk opens your local browser desk for public market data, wallet reviews and strategy tests.
|
|
12591
|
+
Prepare public tools in the desk; these jobs need no model or funded wallet.
|
|
12592
|
+
Optional research uses native Hermes and your selected model. --port chooses a loopback port.
|
|
12593
|
+
--no-open prints the local address without opening a browser. Stop with Ctrl-C.
|
|
11352
12594
|
onboard installs the official Hermes runtime if needed, prepares an isolated profile,
|
|
11353
12595
|
installs the selected Galleon skill packs and public CoinGecko MCP, then runs native model setup.
|
|
11354
12596
|
--directory chooses the Hermes home (default ~/.boomkin/hermes for the commands above).
|
|
@@ -11357,6 +12599,8 @@ installs the selected Galleon skill packs and public CoinGecko MCP, then runs na
|
|
|
11357
12599
|
--all-packs opts an existing onboarding profile into every pack in the current catalog.
|
|
11358
12600
|
--workflow chooses one task's pack for onboarding; updates keep that selection.
|
|
11359
12601
|
workflows lists inputs, concrete results and access requirements; --json emits structured data.
|
|
12602
|
+
templates lists reviewed starting points; --template inspects the required inputs and example.
|
|
12603
|
+
project create accepts either --template or --workflow with your --input-file.
|
|
11360
12604
|
providers discovers sourced provider tools locally; --search, --capability and --access narrow results.
|
|
11361
12605
|
--provider inspects one entry. Discovery does not install third-party skills or connect a service.
|
|
11362
12606
|
project saves workflow inputs and keeps separate native Hermes runs, evidence and unsigned plans.
|
|
@@ -11379,7 +12623,7 @@ async function canonicalPath(path) {
|
|
|
11379
12623
|
} catch (error) {
|
|
11380
12624
|
if (error.code !== "ENOENT")
|
|
11381
12625
|
throw error;
|
|
11382
|
-
return
|
|
12626
|
+
return join8(await canonicalPath(dirname2(path)), basename(path));
|
|
11383
12627
|
}
|
|
11384
12628
|
}
|
|
11385
12629
|
async function main() {
|
|
@@ -11389,11 +12633,14 @@ async function main() {
|
|
|
11389
12633
|
objective: { type: "string" },
|
|
11390
12634
|
"max-turns": { type: "string" },
|
|
11391
12635
|
"run-id": { type: "string" },
|
|
12636
|
+
template: { type: "string" },
|
|
11392
12637
|
version: { type: "boolean", short: "v" },
|
|
11393
12638
|
action: { type: "string" },
|
|
11394
12639
|
workflow: { type: "string" },
|
|
11395
12640
|
protocol: { type: "string" },
|
|
11396
12641
|
json: { type: "boolean" },
|
|
12642
|
+
port: { type: "string" },
|
|
12643
|
+
"no-open": { type: "boolean" },
|
|
11397
12644
|
search: { type: "string" },
|
|
11398
12645
|
capability: { type: "string" },
|
|
11399
12646
|
access: { type: "string" },
|
|
@@ -11415,14 +12662,20 @@ async function main() {
|
|
|
11415
12662
|
return console.log(`Boomkin ${package_default.version}`);
|
|
11416
12663
|
if (values.help || command === "help")
|
|
11417
12664
|
return console.log(help);
|
|
12665
|
+
if ((values.port !== undefined || values["no-open"]) && command !== "desk")
|
|
12666
|
+
throw new Error("--port and --no-open are only available for desk");
|
|
11418
12667
|
if (values.action && command !== "chatgpt")
|
|
11419
12668
|
throw new Error("--action is only available for chatgpt");
|
|
11420
12669
|
if (positionals.length > (command === "project" ? 2 : 1))
|
|
11421
12670
|
throw new Error("Unexpected positional arguments");
|
|
11422
12671
|
if (values.workflow !== undefined && !["workflows", "onboard", "project"].includes(command))
|
|
11423
12672
|
throw new Error("--workflow is available for workflows, onboard and project create");
|
|
11424
|
-
if (values.protocol !== undefined && command !== "workflows" || values.json && !["workflows", "project", "providers"].includes(command))
|
|
11425
|
-
throw new Error("--protocol is available for workflows; --json for workflows, providers and project");
|
|
12673
|
+
if (values.protocol !== undefined && command !== "workflows" || values.json && !["workflows", "project", "providers", "templates"].includes(command))
|
|
12674
|
+
throw new Error("--protocol is available for workflows; --json for workflows, providers, templates and project");
|
|
12675
|
+
if (values.template !== undefined && !["templates", "project"].includes(command))
|
|
12676
|
+
throw new Error("--template is available for templates and project create");
|
|
12677
|
+
if (values.template !== undefined && values.workflow !== undefined)
|
|
12678
|
+
throw new Error("Choose --template or --workflow separately");
|
|
11426
12679
|
if ([values.search, values.capability, values.access].some((value) => value !== undefined) && command !== "providers")
|
|
11427
12680
|
throw new Error("--search, --capability and --access are only available for providers");
|
|
11428
12681
|
if ([values.name, values["input-file"], values.objective, values["max-turns"], values["run-id"]].some((value) => value !== undefined) && command !== "project")
|
|
@@ -11437,16 +12690,78 @@ async function main() {
|
|
|
11437
12690
|
throw new Error("--live is only available for doctor");
|
|
11438
12691
|
if ((values["all-packs"] || values["skip-model-setup"] || values["no-install"]) && command !== "onboard")
|
|
11439
12692
|
throw new Error("Onboarding options are only available for onboard");
|
|
11440
|
-
if (values["dry-run"] && !["onboard", "setup", "update", "connect", "start", "model", "chatgpt", "project"].includes(command))
|
|
12693
|
+
if (values["dry-run"] && !["desk", "onboard", "setup", "update", "connect", "start", "model", "chatgpt", "project"].includes(command))
|
|
11441
12694
|
throw new Error("--dry-run is unavailable for this read-only command");
|
|
12695
|
+
if (command === "desk") {
|
|
12696
|
+
if (values.pack || values.harness || values["offline-catalog"])
|
|
12697
|
+
throw new Error("desk uses its selected Hermes profile; pack options belong to setup or onboard");
|
|
12698
|
+
const directory = await canonicalPath(resolve8(values.directory ?? defaultProfile()));
|
|
12699
|
+
const port = deskPort(values.port);
|
|
12700
|
+
if (values["dry-run"])
|
|
12701
|
+
return console.log(`Would serve the local desk on 127.0.0.1:${port || "an available port"} using ${directory}; no model, data read or setup starts in this preview.`);
|
|
12702
|
+
const catalog = parseCatalog(skills_default);
|
|
12703
|
+
const nativeDashboard = createNativeDashboard(directory);
|
|
12704
|
+
const desk = await startDesk({
|
|
12705
|
+
directory,
|
|
12706
|
+
catalog,
|
|
12707
|
+
port,
|
|
12708
|
+
assetsDirectory: deskAssetsDirectory(import.meta.url),
|
|
12709
|
+
onSetup: async (signal) => {
|
|
12710
|
+
const selected = await deskSetupPacks(directory, catalog);
|
|
12711
|
+
signal.throwIfAborted();
|
|
12712
|
+
const group = process.platform !== "win32";
|
|
12713
|
+
const child = Bun.spawn([process.execPath, fileURLToPath2(import.meta.url), "setup", "--harness", "hermes", "--directory", directory, ...selected.flatMap((id) => ["--pack", id])], { stdin: "inherit", stdout: "inherit", stderr: "inherit", detached: group });
|
|
12714
|
+
let termination;
|
|
12715
|
+
const abort = () => {
|
|
12716
|
+
termination ??= terminateOwnedProcess(child, group);
|
|
12717
|
+
};
|
|
12718
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
12719
|
+
try {
|
|
12720
|
+
if (signal.aborted)
|
|
12721
|
+
abort();
|
|
12722
|
+
const code = await child.exited;
|
|
12723
|
+
signal.throwIfAborted();
|
|
12724
|
+
if (code !== 0)
|
|
12725
|
+
throw new Error("Public tool preparation failed. Review the launching terminal and retry; completed packs remain installed.");
|
|
12726
|
+
} finally {
|
|
12727
|
+
signal.removeEventListener("abort", abort);
|
|
12728
|
+
if (termination)
|
|
12729
|
+
await termination;
|
|
12730
|
+
}
|
|
12731
|
+
},
|
|
12732
|
+
onModelSetup: async (signal) => {
|
|
12733
|
+
await prepareHermes(directory, { install: true, skipModelSetup: true, signal });
|
|
12734
|
+
signal.throwIfAborted();
|
|
12735
|
+
return nativeDashboard.open();
|
|
12736
|
+
}
|
|
12737
|
+
});
|
|
12738
|
+
console.log(`Boomkin desk: ${desk.url}
|
|
12739
|
+
Profile: ${directory}
|
|
12740
|
+
Public jobs use bounded keyless reads. Native model research is optional. Stop with Ctrl-C.`);
|
|
12741
|
+
if (!values["no-open"]) {
|
|
12742
|
+
const opener = process.platform === "darwin" ? "open" : process.platform === "win32" ? undefined : Bun.which("xdg-open");
|
|
12743
|
+
if (opener)
|
|
12744
|
+
Bun.spawn([opener, desk.url], { stdout: "ignore", stderr: "ignore" });
|
|
12745
|
+
}
|
|
12746
|
+
const stop = async () => {
|
|
12747
|
+
await nativeDashboard.stop();
|
|
12748
|
+
await desk.stop();
|
|
12749
|
+
process.exit(0);
|
|
12750
|
+
};
|
|
12751
|
+
process.once("SIGINT", stop);
|
|
12752
|
+
process.once("SIGTERM", stop);
|
|
12753
|
+
if (process.platform !== "win32")
|
|
12754
|
+
process.once("SIGHUP", stop);
|
|
12755
|
+
return;
|
|
12756
|
+
}
|
|
11442
12757
|
if (command === "project") {
|
|
11443
12758
|
const action = positionals[1];
|
|
11444
12759
|
if (!action || !["create", "list", "show", "run", "check"].includes(action))
|
|
11445
12760
|
throw new Error("Choose project create, list, show, run or check");
|
|
11446
12761
|
if (values.pack || values.harness || values["offline-catalog"])
|
|
11447
12762
|
throw new Error("Project commands use the selected Hermes profile; pack options belong to onboard");
|
|
11448
|
-
if (action !== "create" && [values.workflow, values["input-file"], values.objective].some((value) => value !== undefined))
|
|
11449
|
-
throw new Error("--workflow, --input-file and --objective are only available for project create");
|
|
12763
|
+
if (action !== "create" && [values.workflow, values.template, values["input-file"], values.objective].some((value) => value !== undefined))
|
|
12764
|
+
throw new Error("--workflow, --template, --input-file and --objective are only available for project create");
|
|
11450
12765
|
if (action !== "run" && values["max-turns"] !== undefined)
|
|
11451
12766
|
throw new Error("--max-turns is only available for project run");
|
|
11452
12767
|
if (action !== "check" && values["run-id"] !== undefined)
|
|
@@ -11455,40 +12770,49 @@ async function main() {
|
|
|
11455
12770
|
throw new Error("--dry-run is available for project create and run");
|
|
11456
12771
|
if (action === "run" && values.json && !values["dry-run"])
|
|
11457
12772
|
throw new Error("Live project run streams native Hermes output. Use --dry-run --json to preview, or project show/project check for saved JSON results");
|
|
11458
|
-
const
|
|
12773
|
+
const directory = await canonicalPath(resolve8(values.directory ?? defaultProfile()));
|
|
11459
12774
|
if (action === "list") {
|
|
11460
12775
|
if (values.name !== undefined)
|
|
11461
12776
|
throw new Error("project list does not accept --name");
|
|
11462
|
-
const projects = await listProjects(
|
|
12777
|
+
const projects = await listProjects(directory);
|
|
11463
12778
|
return console.log(values.json ? JSON.stringify({ schemaVersion: 1, projects }, null, 2) : projects.length ? projects.map((project) => `${project.name}: ${project.workflow.title}`).join(`
|
|
11464
12779
|
`) : "No saved projects. Use project create with a workflow and input file.");
|
|
11465
12780
|
}
|
|
11466
12781
|
if (!values.name)
|
|
11467
12782
|
throw new Error("Pass --name with the saved project name");
|
|
11468
12783
|
if (action === "create") {
|
|
11469
|
-
if (!values.workflow || !values["input-file"])
|
|
11470
|
-
throw new Error("project create requires --workflow and --input-file (a JSON object)");
|
|
11471
|
-
const file = Bun.file(
|
|
12784
|
+
if (!(values.workflow || values.template) || !values["input-file"])
|
|
12785
|
+
throw new Error("project create requires --workflow or --template, and --input-file (a JSON object)");
|
|
12786
|
+
const file = Bun.file(resolve8(values["input-file"]));
|
|
11472
12787
|
if (file.size > 65536)
|
|
11473
12788
|
throw new Error("Project input file exceeds 64 KiB");
|
|
11474
|
-
const
|
|
11475
|
-
|
|
12789
|
+
const supplied = await file.json();
|
|
12790
|
+
const project = await createProject(directory, { name: values.name, workflow: values.template ? selectTemplate(values.template).workflow : values.workflow, inputs: values.template ? templateInputs(values.template, supplied) : supplied, objective: values.objective, dryRun: values["dry-run"] }, parseCatalog(skills_default));
|
|
12791
|
+
return console.log(values.json ? JSON.stringify(project, null, 2) : `${values["dry-run"] ? "Would create" : "Saved"} ${project.name} in ${directory}. Preview with project run --name ${project.name} --dry-run.`);
|
|
11476
12792
|
}
|
|
11477
12793
|
if (action === "show")
|
|
11478
|
-
return console.log(JSON.stringify({ project: await readProject(
|
|
12794
|
+
return console.log(JSON.stringify({ project: await readProject(directory, values.name), runs: await projectRuns(directory, values.name) }, null, 2));
|
|
11479
12795
|
if (action === "run") {
|
|
11480
|
-
const
|
|
11481
|
-
return console.log(values.json ? JSON.stringify(
|
|
11482
|
-
${
|
|
12796
|
+
const result = await runProject(directory, values.name, { dryRun: values["dry-run"], maxTurns: values["max-turns"] === undefined ? undefined : Number(values["max-turns"]) });
|
|
12797
|
+
return console.log(values.json ? JSON.stringify(result, null, 2) : values["dry-run"] ? result.prompt : `${result.run.state}: ${result.path}${result.run.issues?.length ? `
|
|
12798
|
+
${result.run.issues.join(`
|
|
11483
12799
|
`)}` : `
|
|
11484
12800
|
Captured files passed structural and hash checks. Review the findings and unsigned plan.`}`);
|
|
11485
12801
|
}
|
|
11486
|
-
const result = await checkProjectRun(
|
|
12802
|
+
const result = await checkProjectRun(directory, values.name, values["run-id"]);
|
|
11487
12803
|
console.log(JSON.stringify(result, null, 2));
|
|
11488
12804
|
if (result.issues.length)
|
|
11489
12805
|
process.exitCode = 1;
|
|
11490
12806
|
return;
|
|
11491
12807
|
}
|
|
12808
|
+
if (command === "templates") {
|
|
12809
|
+
if (values.pack || values.harness || values.directory || values["offline-catalog"] || values.workflow)
|
|
12810
|
+
throw new Error("templates accepts --template and --json");
|
|
12811
|
+
const selected = values.template !== undefined ? [selectTemplate(values.template)] : templates;
|
|
12812
|
+
return console.log(values.json ? JSON.stringify({ schemaVersion: 1, templates: selected }, null, 2) : selected.map(renderTemplate).join(`
|
|
12813
|
+
|
|
12814
|
+
`));
|
|
12815
|
+
}
|
|
11492
12816
|
if (command === "workflows") {
|
|
11493
12817
|
if (values.pack || values.harness || values.directory)
|
|
11494
12818
|
throw new Error("workflows accepts --workflow, --protocol and --json");
|
|
@@ -11511,48 +12835,48 @@ Captured files passed structural and hash checks. Review the findings and unsign
|
|
|
11511
12835
|
if (["onboard", "doctor", "start", "connect", "model", "chatgpt"].includes(command)) {
|
|
11512
12836
|
if (values.harness && values.harness !== "hermes")
|
|
11513
12837
|
throw new Error("Boomkin onboarding uses Hermes. Use setup for skill-only compatibility with another harness.");
|
|
11514
|
-
const
|
|
12838
|
+
const directory = await canonicalPath(resolve8(values.directory ?? defaultProfile()));
|
|
11515
12839
|
if (command === "onboard") {
|
|
11516
12840
|
if (values.pack && values["all-packs"])
|
|
11517
12841
|
throw new Error("Choose --pack or --all-packs, not both");
|
|
11518
12842
|
const selected = values.workflow !== undefined ? workflowPacks(values.workflow, parseCatalog(skills_default)) : values["all-packs"] ? parseCatalog(skills_default).packs.map((pack) => pack.id) : values.pack;
|
|
11519
12843
|
const args = [
|
|
11520
12844
|
process.execPath,
|
|
11521
|
-
|
|
12845
|
+
fileURLToPath2(import.meta.url),
|
|
11522
12846
|
"setup",
|
|
11523
12847
|
"--harness",
|
|
11524
12848
|
"hermes",
|
|
11525
12849
|
"--directory",
|
|
11526
|
-
|
|
12850
|
+
directory,
|
|
11527
12851
|
...selected?.flatMap((id) => ["--pack", id]) ?? [],
|
|
11528
12852
|
...values["dry-run"] ? ["--dry-run"] : []
|
|
11529
12853
|
];
|
|
11530
12854
|
const child = Bun.spawn(args, { stdin: "inherit", stdout: "inherit", stderr: "inherit" });
|
|
11531
12855
|
if (await child.exited !== 0)
|
|
11532
12856
|
throw new Error("Skill setup did not finish. Resolve its reported issue and rerun onboard.");
|
|
11533
|
-
console.log(`Hermes home: ${
|
|
11534
|
-
await prepareHermes(
|
|
12857
|
+
console.log(`Hermes home: ${directory}. Native model setup and keyless CoinGecko data; other providers are opt-in.`);
|
|
12858
|
+
await prepareHermes(directory, { install: !values["no-install"], dryRun: values["dry-run"], skipModelSetup: values["skip-model-setup"] });
|
|
11535
12859
|
if (values["dry-run"])
|
|
11536
12860
|
return;
|
|
11537
|
-
console.log(JSON.stringify(await doctor(
|
|
12861
|
+
console.log(JSON.stringify(await doctor(directory, parseCatalog(skills_default)), null, 2));
|
|
11538
12862
|
console.log("Onboarding saved. Use doctor --live to check public data, then start to launch Hermes. Complete any listed setup gaps first.");
|
|
11539
12863
|
return;
|
|
11540
12864
|
}
|
|
11541
12865
|
if (values.pack || values["all-packs"] || values["skip-model-setup"] || values["no-install"])
|
|
11542
12866
|
throw new Error("Pack and installer options are only available for onboard here");
|
|
11543
12867
|
if (command === "chatgpt")
|
|
11544
|
-
return runChatGpt(
|
|
12868
|
+
return runChatGpt(directory, values.action ?? "status", values["dry-run"]);
|
|
11545
12869
|
if (command === "doctor")
|
|
11546
|
-
return console.log(JSON.stringify(await doctor(
|
|
12870
|
+
return console.log(JSON.stringify(await doctor(directory, parseCatalog(skills_default), values.live), null, 2));
|
|
11547
12871
|
if (command === "connect")
|
|
11548
|
-
return connectProvider(
|
|
12872
|
+
return connectProvider(directory, values.provider ?? "", values["dry-run"], values["key-file"] ? resolve8(values["key-file"]) : undefined);
|
|
11549
12873
|
if (values["dry-run"])
|
|
11550
|
-
return console.log(`Hermes ${command === "model" ? "setup model" : "chat"} in ${
|
|
11551
|
-
return runHermes(
|
|
12874
|
+
return console.log(`Hermes ${command === "model" ? "setup model" : "chat"} in ${directory}`);
|
|
12875
|
+
return runHermes(directory, command === "model" ? ["setup", "model"] : ["chat"]);
|
|
11552
12876
|
}
|
|
11553
12877
|
if (command === "harnesses") {
|
|
11554
|
-
for (const [
|
|
11555
|
-
console.log(`${
|
|
12878
|
+
for (const [name, h] of Object.entries(harnesses))
|
|
12879
|
+
console.log(`${name}
|
|
11556
12880
|
${h.setup}
|
|
11557
12881
|
${h.docs}
|
|
11558
12882
|
`);
|
|
@@ -11564,14 +12888,14 @@ Captured files passed structural and hash checks. Review the findings and unsign
|
|
|
11564
12888
|
throw new Error(`Unknown command: ${command}`);
|
|
11565
12889
|
if (!values.directory)
|
|
11566
12890
|
throw new Error("Pass --directory with your harness workspace (Hermes: its HERMES_HOME).");
|
|
11567
|
-
const directory = await canonicalPath(
|
|
11568
|
-
const stateDir =
|
|
11569
|
-
const configPath =
|
|
12891
|
+
const directory = await canonicalPath(resolve8(values.directory));
|
|
12892
|
+
const stateDir = join8(directory, ".boomkin");
|
|
12893
|
+
const configPath = join8(stateDir, "config.json");
|
|
11570
12894
|
let config;
|
|
11571
12895
|
if (command === "setup") {
|
|
11572
12896
|
config = { schemaVersion: 1, harness: parseHarness(values.harness), directory };
|
|
11573
12897
|
try {
|
|
11574
|
-
const existing = parseConfig(JSON.parse(await
|
|
12898
|
+
const existing = parseConfig(JSON.parse(await readFile7(configPath, "utf8")), directory);
|
|
11575
12899
|
if (existing.harness !== config.harness)
|
|
11576
12900
|
throw new Error("This directory belongs to another harness. Use a separate workspace.");
|
|
11577
12901
|
config = existing;
|
|
@@ -11580,24 +12904,24 @@ Captured files passed structural and hash checks. Review the findings and unsign
|
|
|
11580
12904
|
throw error;
|
|
11581
12905
|
}
|
|
11582
12906
|
} else
|
|
11583
|
-
config = parseConfig(JSON.parse(await
|
|
12907
|
+
config = parseConfig(JSON.parse(await readFile7(configPath, "utf8")), directory);
|
|
11584
12908
|
if (values.pack && !["setup", "update"].includes(command))
|
|
11585
12909
|
throw new Error("--pack is available for setup and update");
|
|
11586
12910
|
if (values.pack)
|
|
11587
12911
|
config.packs = values.pack;
|
|
11588
12912
|
const adapter = harnesses[config.harness];
|
|
11589
|
-
const env = { ...process.env, DISABLE_TELEMETRY: "1", XDG_STATE_HOME:
|
|
11590
|
-
const skillsBin =
|
|
12913
|
+
const env = { ...process.env, DISABLE_TELEMETRY: "1", XDG_STATE_HOME: join8(stateDir, "state"), ...config.harness === "hermes" ? { HERMES_HOME: directory } : {} };
|
|
12914
|
+
const skillsBin = fileURLToPath2(import.meta.resolve("skills/bin/cli.mjs"));
|
|
11591
12915
|
async function run(args) {
|
|
11592
12916
|
const child = Bun.spawn([process.execPath, skillsBin, ...args], { cwd: directory, env, stdin: "inherit", stdout: "inherit", stderr: "inherit" });
|
|
11593
12917
|
if (await child.exited !== 0)
|
|
11594
12918
|
throw new Error("Upstream skills command failed. Completed packs remain installed; rerun after resolving the error.");
|
|
11595
12919
|
}
|
|
11596
|
-
async function verifyInstalled(
|
|
11597
|
-
for (const pack of
|
|
12920
|
+
async function verifyInstalled(catalog) {
|
|
12921
|
+
for (const pack of catalog.packs) {
|
|
11598
12922
|
for (const skill of pack.skills) {
|
|
11599
|
-
const
|
|
11600
|
-
const version = installedVersion(
|
|
12923
|
+
const text = await readFile7(join8(directory, adapter.skillsPath, skill, "SKILL.md"), "utf8");
|
|
12924
|
+
const version = installedVersion(text);
|
|
11601
12925
|
if (version !== pack.version)
|
|
11602
12926
|
throw new Error(`Installed ${skill} has version ${version ?? "unknown"}; expected ${pack.version}. Sync not marked complete.`);
|
|
11603
12927
|
}
|
|
@@ -11605,13 +12929,13 @@ Captured files passed structural and hash checks. Review the findings and unsign
|
|
|
11605
12929
|
}
|
|
11606
12930
|
if (command === "status") {
|
|
11607
12931
|
console.log(JSON.stringify(config, null, 2));
|
|
11608
|
-
console.log(`Skills: ${
|
|
12932
|
+
console.log(`Skills: ${join8(directory, adapter.skillsPath)}
|
|
11609
12933
|
${adapter.setup}`);
|
|
11610
12934
|
return run(["list", "--agent", adapter.agent, ...adapter.global ? ["--global"] : []]);
|
|
11611
12935
|
}
|
|
11612
12936
|
let previous;
|
|
11613
12937
|
try {
|
|
11614
|
-
const record = JSON.parse(await
|
|
12938
|
+
const record = JSON.parse(await readFile7(join8(stateDir, "last-sync.json"), "utf8"));
|
|
11615
12939
|
if (record.catalog?.schemaVersion === 3)
|
|
11616
12940
|
previous = parseCatalog(record.catalog);
|
|
11617
12941
|
} catch (error) {
|
|
@@ -11623,7 +12947,7 @@ ${adapter.setup}`);
|
|
|
11623
12947
|
if (command === "check") {
|
|
11624
12948
|
const current = selectPacks(values["offline-catalog"] ? parseCatalog(skills_default) : await fetchCatalog(), config.packs);
|
|
11625
12949
|
const changes = catalogChanges(current, previous);
|
|
11626
|
-
const issues = previous ? await verifyIntegrity(
|
|
12950
|
+
const issues = previous ? await verifyIntegrity(join8(directory, adapter.skillsPath), previous, await readIntegrity(directory)) : [];
|
|
11627
12951
|
if (!changes.length && previous)
|
|
11628
12952
|
await verifyInstalled(current);
|
|
11629
12953
|
if (changes.length)
|
|
@@ -11648,27 +12972,27 @@ ${adapter.setup}`);
|
|
|
11648
12972
|
console.log(`Install ${pack.source}/${pack.path}@${pack.version} from verified commit ${pack.revision}`);
|
|
11649
12973
|
if (values["dry-run"])
|
|
11650
12974
|
return;
|
|
11651
|
-
await
|
|
11652
|
-
await
|
|
11653
|
-
const lock =
|
|
12975
|
+
await mkdir4(directory, { recursive: true });
|
|
12976
|
+
await mkdir4(stateDir, { recursive: true });
|
|
12977
|
+
const lock = join8(stateDir, "operation.lock");
|
|
11654
12978
|
try {
|
|
11655
|
-
await
|
|
12979
|
+
await mkdir4(lock);
|
|
11656
12980
|
} catch {
|
|
11657
12981
|
throw new Error(`Another operation is active. If it crashed, remove ${lock} after checking no installer is running.`);
|
|
11658
12982
|
}
|
|
11659
12983
|
try {
|
|
11660
12984
|
try {
|
|
11661
|
-
const existing = parseConfig(JSON.parse(await
|
|
12985
|
+
const existing = parseConfig(JSON.parse(await readFile7(configPath, "utf8")), directory);
|
|
11662
12986
|
if (existing.harness !== config.harness)
|
|
11663
12987
|
throw new Error("This directory belongs to another harness. Use a separate workspace.");
|
|
11664
12988
|
} catch (error) {
|
|
11665
12989
|
if (error.code !== "ENOENT")
|
|
11666
12990
|
throw error;
|
|
11667
12991
|
}
|
|
11668
|
-
await
|
|
12992
|
+
await writeFile4(`${configPath}.tmp`, JSON.stringify(config, null, 2) + `
|
|
11669
12993
|
`);
|
|
11670
|
-
await
|
|
11671
|
-
const staging = await mkdtemp(
|
|
12994
|
+
await rename4(`${configPath}.tmp`, configPath);
|
|
12995
|
+
const staging = await mkdtemp(join8(tmpdir(), "boomkin-sources-"));
|
|
11672
12996
|
const integrity = {};
|
|
11673
12997
|
try {
|
|
11674
12998
|
const sources = new Map;
|
|
@@ -11677,7 +13001,7 @@ ${adapter.setup}`);
|
|
|
11677
13001
|
const key = `${pack.source}@${pack.revision}`;
|
|
11678
13002
|
let checkout = sources.get(key);
|
|
11679
13003
|
if (!checkout) {
|
|
11680
|
-
checkout =
|
|
13004
|
+
checkout = join8(staging, `source-${sources.size}`);
|
|
11681
13005
|
await checkoutPack(pack, checkout);
|
|
11682
13006
|
sources.set(key, checkout);
|
|
11683
13007
|
}
|
|
@@ -11686,32 +13010,32 @@ ${adapter.setup}`);
|
|
|
11686
13010
|
for (const pack of catalog.packs) {
|
|
11687
13011
|
await run(installArgs(packages.get(pack.id), config.harness, pack.skills));
|
|
11688
13012
|
for (const skill of pack.skills)
|
|
11689
|
-
integrity[skill] = await verifyCopiedSkill(
|
|
13013
|
+
integrity[skill] = await verifyCopiedSkill(join8(packages.get(pack.id), "skills", skill), join8(directory, adapter.skillsPath, skill));
|
|
11690
13014
|
}
|
|
11691
13015
|
} finally {
|
|
11692
|
-
await
|
|
13016
|
+
await rm4(staging, { recursive: true, force: true });
|
|
11693
13017
|
}
|
|
11694
13018
|
await verifyInstalled(catalog);
|
|
11695
13019
|
for (const retired of ["lp-research", "lp-operate", "hyperliquid-research", "hyperliquid-operate"]) {
|
|
11696
|
-
if (await Bun.file(
|
|
13020
|
+
if (await Bun.file(join8(directory, adapter.skillsPath, retired, "SKILL.md")).exists())
|
|
11697
13021
|
console.log(`Legacy skill ${retired} remains. Review local edits and follow docs/UPDATES.md before removing it.`);
|
|
11698
13022
|
}
|
|
11699
|
-
const identityPath =
|
|
11700
|
-
await
|
|
13023
|
+
const identityPath = join8(directory, config.harness === "eve" ? "agent/instructions.md" : "AGENTS.md");
|
|
13024
|
+
await mkdir4(dirname2(identityPath), { recursive: true });
|
|
11701
13025
|
try {
|
|
11702
|
-
await
|
|
13026
|
+
await writeFile4(identityPath, identity2, { flag: "wx" });
|
|
11703
13027
|
} catch (error) {
|
|
11704
13028
|
if (error.code !== "EEXIST")
|
|
11705
13029
|
throw error;
|
|
11706
13030
|
console.log(`Preserved ${identityPath}. Add the Boomkin identity from docs/IDENTITY.md if wanted.`);
|
|
11707
13031
|
}
|
|
11708
|
-
await
|
|
13032
|
+
await writeFile4(join8(stateDir, "last-sync.json.tmp"), JSON.stringify({ syncedAt: new Date().toISOString(), catalog, integrity }, null, 2) + `
|
|
11709
13033
|
`);
|
|
11710
|
-
await
|
|
11711
|
-
console.log(`Skills ready in ${
|
|
13034
|
+
await rename4(join8(stateDir, "last-sync.json.tmp"), join8(stateDir, "last-sync.json"));
|
|
13035
|
+
console.log(`Skills ready in ${join8(directory, adapter.skillsPath)}. Use the installed skill matching your task; infrastructure and data skills establish tool readiness and evidence first. Restart the harness to reload.${setupHint ? `
|
|
11712
13036
|
${setupHint}` : ""}`);
|
|
11713
13037
|
} finally {
|
|
11714
|
-
await
|
|
13038
|
+
await rm4(lock, { recursive: true });
|
|
11715
13039
|
}
|
|
11716
13040
|
}
|
|
11717
13041
|
main().catch((error) => {
|