oh-my-opencode-slim 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -2
- package/dist/goal/index.d.ts +3 -0
- package/dist/goal/manager.d.ts +41 -0
- package/dist/goal/prompts.d.ts +4 -0
- package/dist/goal/store.d.ts +15 -0
- package/dist/goal/types.d.ts +28 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/session-goal/index.d.ts +38 -0
- package/dist/index.js +559 -321
- package/dist/multiplexer/session-manager.d.ts +3 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
32
32
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
33
33
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
34
34
|
|
|
35
|
-
// node_modules/@mozilla/readability/Readability.js
|
|
35
|
+
// node_modules/.pnpm/@mozilla+readability@0.6.0/node_modules/@mozilla/readability/Readability.js
|
|
36
36
|
var require_Readability = __commonJS((exports, module) => {
|
|
37
37
|
function Readability(doc, options) {
|
|
38
38
|
if (options && options.documentElement) {
|
|
@@ -1603,7 +1603,7 @@ var require_Readability = __commonJS((exports, module) => {
|
|
|
1603
1603
|
}
|
|
1604
1604
|
});
|
|
1605
1605
|
|
|
1606
|
-
// node_modules/@mozilla/readability/Readability-readerable.js
|
|
1606
|
+
// node_modules/.pnpm/@mozilla+readability@0.6.0/node_modules/@mozilla/readability/Readability-readerable.js
|
|
1607
1607
|
var require_Readability_readerable = __commonJS((exports, module) => {
|
|
1608
1608
|
var REGEXPS = {
|
|
1609
1609
|
unlikelyCandidates: /-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,
|
|
@@ -1659,7 +1659,7 @@ var require_Readability_readerable = __commonJS((exports, module) => {
|
|
|
1659
1659
|
}
|
|
1660
1660
|
});
|
|
1661
1661
|
|
|
1662
|
-
// node_modules/@mozilla/readability/index.js
|
|
1662
|
+
// node_modules/.pnpm/@mozilla+readability@0.6.0/node_modules/@mozilla/readability/index.js
|
|
1663
1663
|
var require_readability = __commonJS((exports, module) => {
|
|
1664
1664
|
var Readability = require_Readability();
|
|
1665
1665
|
var isProbablyReaderable = require_Readability_readerable();
|
|
@@ -1669,7 +1669,7 @@ var require_readability = __commonJS((exports, module) => {
|
|
|
1669
1669
|
};
|
|
1670
1670
|
});
|
|
1671
1671
|
|
|
1672
|
-
// node_modules/@mixmark-io/domino/lib/Event.js
|
|
1672
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/Event.js
|
|
1673
1673
|
var require_Event = __commonJS((exports, module) => {
|
|
1674
1674
|
module.exports = Event;
|
|
1675
1675
|
Event.CAPTURING_PHASE = 1;
|
|
@@ -1726,7 +1726,7 @@ var require_Event = __commonJS((exports, module) => {
|
|
|
1726
1726
|
});
|
|
1727
1727
|
});
|
|
1728
1728
|
|
|
1729
|
-
// node_modules/@mixmark-io/domino/lib/UIEvent.js
|
|
1729
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/UIEvent.js
|
|
1730
1730
|
var require_UIEvent = __commonJS((exports, module) => {
|
|
1731
1731
|
var Event = require_Event();
|
|
1732
1732
|
module.exports = UIEvent;
|
|
@@ -1745,7 +1745,7 @@ var require_UIEvent = __commonJS((exports, module) => {
|
|
|
1745
1745
|
});
|
|
1746
1746
|
});
|
|
1747
1747
|
|
|
1748
|
-
// node_modules/@mixmark-io/domino/lib/MouseEvent.js
|
|
1748
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/MouseEvent.js
|
|
1749
1749
|
var require_MouseEvent = __commonJS((exports, module) => {
|
|
1750
1750
|
var UIEvent = require_UIEvent();
|
|
1751
1751
|
module.exports = MouseEvent;
|
|
@@ -1803,7 +1803,7 @@ var require_MouseEvent = __commonJS((exports, module) => {
|
|
|
1803
1803
|
});
|
|
1804
1804
|
});
|
|
1805
1805
|
|
|
1806
|
-
// node_modules/@mixmark-io/domino/lib/DOMException.js
|
|
1806
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/DOMException.js
|
|
1807
1807
|
var require_DOMException = __commonJS((exports, module) => {
|
|
1808
1808
|
module.exports = DOMException;
|
|
1809
1809
|
var INDEX_SIZE_ERR = 1;
|
|
@@ -1927,12 +1927,12 @@ var require_DOMException = __commonJS((exports, module) => {
|
|
|
1927
1927
|
var c;
|
|
1928
1928
|
});
|
|
1929
1929
|
|
|
1930
|
-
// node_modules/@mixmark-io/domino/lib/config.js
|
|
1930
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/config.js
|
|
1931
1931
|
var require_config = __commonJS((exports) => {
|
|
1932
1932
|
exports.isApiWritable = !globalThis.__domino_frozen__;
|
|
1933
1933
|
});
|
|
1934
1934
|
|
|
1935
|
-
// node_modules/@mixmark-io/domino/lib/utils.js
|
|
1935
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/utils.js
|
|
1936
1936
|
var require_utils = __commonJS((exports) => {
|
|
1937
1937
|
var DOMException = require_DOMException();
|
|
1938
1938
|
var ERR = DOMException;
|
|
@@ -2045,7 +2045,7 @@ var require_utils = __commonJS((exports) => {
|
|
|
2045
2045
|
};
|
|
2046
2046
|
});
|
|
2047
2047
|
|
|
2048
|
-
// node_modules/@mixmark-io/domino/lib/EventTarget.js
|
|
2048
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/EventTarget.js
|
|
2049
2049
|
var require_EventTarget = __commonJS((exports, module) => {
|
|
2050
2050
|
var Event = require_Event();
|
|
2051
2051
|
var MouseEvent = require_MouseEvent();
|
|
@@ -2233,7 +2233,7 @@ var require_EventTarget = __commonJS((exports, module) => {
|
|
|
2233
2233
|
};
|
|
2234
2234
|
});
|
|
2235
2235
|
|
|
2236
|
-
// node_modules/@mixmark-io/domino/lib/LinkedList.js
|
|
2236
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/LinkedList.js
|
|
2237
2237
|
var require_LinkedList = __commonJS((exports, module) => {
|
|
2238
2238
|
var utils = require_utils();
|
|
2239
2239
|
var LinkedList = module.exports = {
|
|
@@ -2276,7 +2276,7 @@ var require_LinkedList = __commonJS((exports, module) => {
|
|
|
2276
2276
|
};
|
|
2277
2277
|
});
|
|
2278
2278
|
|
|
2279
|
-
// node_modules/@mixmark-io/domino/lib/NodeUtils.js
|
|
2279
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/NodeUtils.js
|
|
2280
2280
|
var require_NodeUtils = __commonJS((exports, module) => {
|
|
2281
2281
|
module.exports = {
|
|
2282
2282
|
serializeOne,
|
|
@@ -2452,7 +2452,7 @@ var require_NodeUtils = __commonJS((exports, module) => {
|
|
|
2452
2452
|
}
|
|
2453
2453
|
});
|
|
2454
2454
|
|
|
2455
|
-
// node_modules/@mixmark-io/domino/lib/Node.js
|
|
2455
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/Node.js
|
|
2456
2456
|
var require_Node = __commonJS((exports, module) => {
|
|
2457
2457
|
module.exports = Node;
|
|
2458
2458
|
var EventTarget = require_EventTarget();
|
|
@@ -3013,7 +3013,7 @@ var require_Node = __commonJS((exports, module) => {
|
|
|
3013
3013
|
});
|
|
3014
3014
|
});
|
|
3015
3015
|
|
|
3016
|
-
// node_modules/@mixmark-io/domino/lib/NodeList.es6.js
|
|
3016
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/NodeList.es6.js
|
|
3017
3017
|
var require_NodeList_es6 = __commonJS((exports, module) => {
|
|
3018
3018
|
module.exports = class NodeList extends Array {
|
|
3019
3019
|
constructor(a) {
|
|
@@ -3030,7 +3030,7 @@ var require_NodeList_es6 = __commonJS((exports, module) => {
|
|
|
3030
3030
|
};
|
|
3031
3031
|
});
|
|
3032
3032
|
|
|
3033
|
-
// node_modules/@mixmark-io/domino/lib/NodeList.es5.js
|
|
3033
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/NodeList.es5.js
|
|
3034
3034
|
var require_NodeList_es5 = __commonJS((exports, module) => {
|
|
3035
3035
|
function item(i) {
|
|
3036
3036
|
return this[i] || null;
|
|
@@ -3044,7 +3044,7 @@ var require_NodeList_es5 = __commonJS((exports, module) => {
|
|
|
3044
3044
|
module.exports = NodeList;
|
|
3045
3045
|
});
|
|
3046
3046
|
|
|
3047
|
-
// node_modules/@mixmark-io/domino/lib/NodeList.js
|
|
3047
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/NodeList.js
|
|
3048
3048
|
var require_NodeList = __commonJS((exports, module) => {
|
|
3049
3049
|
var NodeList;
|
|
3050
3050
|
try {
|
|
@@ -3055,7 +3055,7 @@ var require_NodeList = __commonJS((exports, module) => {
|
|
|
3055
3055
|
module.exports = NodeList;
|
|
3056
3056
|
});
|
|
3057
3057
|
|
|
3058
|
-
// node_modules/@mixmark-io/domino/lib/ContainerNode.js
|
|
3058
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/ContainerNode.js
|
|
3059
3059
|
var require_ContainerNode = __commonJS((exports, module) => {
|
|
3060
3060
|
module.exports = ContainerNode;
|
|
3061
3061
|
var Node = require_Node();
|
|
@@ -3123,7 +3123,7 @@ var require_ContainerNode = __commonJS((exports, module) => {
|
|
|
3123
3123
|
});
|
|
3124
3124
|
});
|
|
3125
3125
|
|
|
3126
|
-
// node_modules/@mixmark-io/domino/lib/xmlnames.js
|
|
3126
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/xmlnames.js
|
|
3127
3127
|
var require_xmlnames = __commonJS((exports) => {
|
|
3128
3128
|
exports.isValidName = isValidName;
|
|
3129
3129
|
exports.isValidQName = isValidQName;
|
|
@@ -3172,7 +3172,7 @@ var require_xmlnames = __commonJS((exports) => {
|
|
|
3172
3172
|
}
|
|
3173
3173
|
});
|
|
3174
3174
|
|
|
3175
|
-
// node_modules/@mixmark-io/domino/lib/attributes.js
|
|
3175
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/attributes.js
|
|
3176
3176
|
var require_attributes = __commonJS((exports) => {
|
|
3177
3177
|
var utils = require_utils();
|
|
3178
3178
|
exports.property = function(attr) {
|
|
@@ -3308,7 +3308,7 @@ var require_attributes = __commonJS((exports) => {
|
|
|
3308
3308
|
};
|
|
3309
3309
|
});
|
|
3310
3310
|
|
|
3311
|
-
// node_modules/@mixmark-io/domino/lib/FilteredElementList.js
|
|
3311
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/FilteredElementList.js
|
|
3312
3312
|
var require_FilteredElementList = __commonJS((exports, module) => {
|
|
3313
3313
|
module.exports = FilteredElementList;
|
|
3314
3314
|
var Node = require_Node();
|
|
@@ -3374,7 +3374,7 @@ var require_FilteredElementList = __commonJS((exports, module) => {
|
|
|
3374
3374
|
});
|
|
3375
3375
|
});
|
|
3376
3376
|
|
|
3377
|
-
// node_modules/@mixmark-io/domino/lib/DOMTokenList.js
|
|
3377
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/DOMTokenList.js
|
|
3378
3378
|
var require_DOMTokenList = __commonJS((exports, module) => {
|
|
3379
3379
|
var utils = require_utils();
|
|
3380
3380
|
module.exports = DOMTokenList;
|
|
@@ -3536,7 +3536,7 @@ var require_DOMTokenList = __commonJS((exports, module) => {
|
|
|
3536
3536
|
}
|
|
3537
3537
|
});
|
|
3538
3538
|
|
|
3539
|
-
// node_modules/@mixmark-io/domino/lib/select.js
|
|
3539
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/select.js
|
|
3540
3540
|
var require_select = __commonJS((exports, module) => {
|
|
3541
3541
|
var window2 = Object.create(null, {
|
|
3542
3542
|
location: { get: function() {
|
|
@@ -4279,7 +4279,7 @@ var require_select = __commonJS((exports, module) => {
|
|
|
4279
4279
|
};
|
|
4280
4280
|
});
|
|
4281
4281
|
|
|
4282
|
-
// node_modules/@mixmark-io/domino/lib/ChildNode.js
|
|
4282
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/ChildNode.js
|
|
4283
4283
|
var require_ChildNode = __commonJS((exports, module) => {
|
|
4284
4284
|
var Node = require_Node();
|
|
4285
4285
|
var LinkedList = require_LinkedList();
|
|
@@ -4369,7 +4369,7 @@ var require_ChildNode = __commonJS((exports, module) => {
|
|
|
4369
4369
|
module.exports = ChildNode;
|
|
4370
4370
|
});
|
|
4371
4371
|
|
|
4372
|
-
// node_modules/@mixmark-io/domino/lib/NonDocumentTypeChildNode.js
|
|
4372
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/NonDocumentTypeChildNode.js
|
|
4373
4373
|
var require_NonDocumentTypeChildNode = __commonJS((exports, module) => {
|
|
4374
4374
|
var Node = require_Node();
|
|
4375
4375
|
var NonDocumentTypeChildNode = {
|
|
@@ -4395,7 +4395,7 @@ var require_NonDocumentTypeChildNode = __commonJS((exports, module) => {
|
|
|
4395
4395
|
module.exports = NonDocumentTypeChildNode;
|
|
4396
4396
|
});
|
|
4397
4397
|
|
|
4398
|
-
// node_modules/@mixmark-io/domino/lib/NamedNodeMap.js
|
|
4398
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/NamedNodeMap.js
|
|
4399
4399
|
var require_NamedNodeMap = __commonJS((exports, module) => {
|
|
4400
4400
|
module.exports = NamedNodeMap;
|
|
4401
4401
|
var utils = require_utils();
|
|
@@ -4432,7 +4432,7 @@ var require_NamedNodeMap = __commonJS((exports, module) => {
|
|
|
4432
4432
|
});
|
|
4433
4433
|
});
|
|
4434
4434
|
|
|
4435
|
-
// node_modules/@mixmark-io/domino/lib/Element.js
|
|
4435
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/Element.js
|
|
4436
4436
|
var require_Element = __commonJS((exports, module) => {
|
|
4437
4437
|
module.exports = Element;
|
|
4438
4438
|
var xml = require_xmlnames();
|
|
@@ -5333,7 +5333,7 @@ var require_Element = __commonJS((exports, module) => {
|
|
|
5333
5333
|
}
|
|
5334
5334
|
});
|
|
5335
5335
|
|
|
5336
|
-
// node_modules/@mixmark-io/domino/lib/Leaf.js
|
|
5336
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/Leaf.js
|
|
5337
5337
|
var require_Leaf = __commonJS((exports, module) => {
|
|
5338
5338
|
module.exports = Leaf;
|
|
5339
5339
|
var Node = require_Node();
|
|
@@ -5374,7 +5374,7 @@ var require_Leaf = __commonJS((exports, module) => {
|
|
|
5374
5374
|
});
|
|
5375
5375
|
});
|
|
5376
5376
|
|
|
5377
|
-
// node_modules/@mixmark-io/domino/lib/CharacterData.js
|
|
5377
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/CharacterData.js
|
|
5378
5378
|
var require_CharacterData = __commonJS((exports, module) => {
|
|
5379
5379
|
module.exports = CharacterData;
|
|
5380
5380
|
var Leaf = require_Leaf();
|
|
@@ -5431,7 +5431,7 @@ var require_CharacterData = __commonJS((exports, module) => {
|
|
|
5431
5431
|
Object.defineProperties(CharacterData.prototype, NonDocumentTypeChildNode);
|
|
5432
5432
|
});
|
|
5433
5433
|
|
|
5434
|
-
// node_modules/@mixmark-io/domino/lib/Text.js
|
|
5434
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/Text.js
|
|
5435
5435
|
var require_Text = __commonJS((exports, module) => {
|
|
5436
5436
|
module.exports = Text;
|
|
5437
5437
|
var utils = require_utils();
|
|
@@ -5501,7 +5501,7 @@ var require_Text = __commonJS((exports, module) => {
|
|
|
5501
5501
|
});
|
|
5502
5502
|
});
|
|
5503
5503
|
|
|
5504
|
-
// node_modules/@mixmark-io/domino/lib/Comment.js
|
|
5504
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/Comment.js
|
|
5505
5505
|
var require_Comment = __commonJS((exports, module) => {
|
|
5506
5506
|
module.exports = Comment;
|
|
5507
5507
|
var Node = require_Node();
|
|
@@ -5544,7 +5544,7 @@ var require_Comment = __commonJS((exports, module) => {
|
|
|
5544
5544
|
});
|
|
5545
5545
|
});
|
|
5546
5546
|
|
|
5547
|
-
// node_modules/@mixmark-io/domino/lib/DocumentFragment.js
|
|
5547
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/DocumentFragment.js
|
|
5548
5548
|
var require_DocumentFragment = __commonJS((exports, module) => {
|
|
5549
5549
|
module.exports = DocumentFragment;
|
|
5550
5550
|
var Node = require_Node();
|
|
@@ -5601,7 +5601,7 @@ var require_DocumentFragment = __commonJS((exports, module) => {
|
|
|
5601
5601
|
});
|
|
5602
5602
|
});
|
|
5603
5603
|
|
|
5604
|
-
// node_modules/@mixmark-io/domino/lib/ProcessingInstruction.js
|
|
5604
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/ProcessingInstruction.js
|
|
5605
5605
|
var require_ProcessingInstruction = __commonJS((exports, module) => {
|
|
5606
5606
|
module.exports = ProcessingInstruction;
|
|
5607
5607
|
var Node = require_Node();
|
|
@@ -5650,7 +5650,7 @@ var require_ProcessingInstruction = __commonJS((exports, module) => {
|
|
|
5650
5650
|
});
|
|
5651
5651
|
});
|
|
5652
5652
|
|
|
5653
|
-
// node_modules/@mixmark-io/domino/lib/NodeFilter.js
|
|
5653
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/NodeFilter.js
|
|
5654
5654
|
var require_NodeFilter = __commonJS((exports, module) => {
|
|
5655
5655
|
var NodeFilter = {
|
|
5656
5656
|
FILTER_ACCEPT: 1,
|
|
@@ -5673,7 +5673,7 @@ var require_NodeFilter = __commonJS((exports, module) => {
|
|
|
5673
5673
|
module.exports = NodeFilter.constructor = NodeFilter.prototype = NodeFilter;
|
|
5674
5674
|
});
|
|
5675
5675
|
|
|
5676
|
-
// node_modules/@mixmark-io/domino/lib/NodeTraversal.js
|
|
5676
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/NodeTraversal.js
|
|
5677
5677
|
var require_NodeTraversal = __commonJS((exports, module) => {
|
|
5678
5678
|
var NodeTraversal = module.exports = {
|
|
5679
5679
|
nextSkippingChildren,
|
|
@@ -5737,7 +5737,7 @@ var require_NodeTraversal = __commonJS((exports, module) => {
|
|
|
5737
5737
|
}
|
|
5738
5738
|
});
|
|
5739
5739
|
|
|
5740
|
-
// node_modules/@mixmark-io/domino/lib/TreeWalker.js
|
|
5740
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/TreeWalker.js
|
|
5741
5741
|
var require_TreeWalker = __commonJS((exports, module) => {
|
|
5742
5742
|
module.exports = TreeWalker;
|
|
5743
5743
|
var Node = require_Node();
|
|
@@ -5967,7 +5967,7 @@ var require_TreeWalker = __commonJS((exports, module) => {
|
|
|
5967
5967
|
});
|
|
5968
5968
|
});
|
|
5969
5969
|
|
|
5970
|
-
// node_modules/@mixmark-io/domino/lib/NodeIterator.js
|
|
5970
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/NodeIterator.js
|
|
5971
5971
|
var require_NodeIterator = __commonJS((exports, module) => {
|
|
5972
5972
|
module.exports = NodeIterator;
|
|
5973
5973
|
var NodeFilter = require_NodeFilter();
|
|
@@ -6108,7 +6108,7 @@ var require_NodeIterator = __commonJS((exports, module) => {
|
|
|
6108
6108
|
});
|
|
6109
6109
|
});
|
|
6110
6110
|
|
|
6111
|
-
// node_modules/@mixmark-io/domino/lib/URL.js
|
|
6111
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/URL.js
|
|
6112
6112
|
var require_URL = __commonJS((exports, module) => {
|
|
6113
6113
|
module.exports = URL4;
|
|
6114
6114
|
function URL4(url) {
|
|
@@ -6281,7 +6281,7 @@ var require_URL = __commonJS((exports, module) => {
|
|
|
6281
6281
|
};
|
|
6282
6282
|
});
|
|
6283
6283
|
|
|
6284
|
-
// node_modules/@mixmark-io/domino/lib/CustomEvent.js
|
|
6284
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/CustomEvent.js
|
|
6285
6285
|
var require_CustomEvent = __commonJS((exports, module) => {
|
|
6286
6286
|
module.exports = CustomEvent;
|
|
6287
6287
|
var Event = require_Event();
|
|
@@ -6293,7 +6293,7 @@ var require_CustomEvent = __commonJS((exports, module) => {
|
|
|
6293
6293
|
});
|
|
6294
6294
|
});
|
|
6295
6295
|
|
|
6296
|
-
// node_modules/@mixmark-io/domino/lib/events.js
|
|
6296
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/events.js
|
|
6297
6297
|
var require_events = __commonJS((exports, module) => {
|
|
6298
6298
|
module.exports = {
|
|
6299
6299
|
Event: require_Event(),
|
|
@@ -6303,7 +6303,7 @@ var require_events = __commonJS((exports, module) => {
|
|
|
6303
6303
|
};
|
|
6304
6304
|
});
|
|
6305
6305
|
|
|
6306
|
-
// node_modules/@mixmark-io/domino/lib/style_parser.js
|
|
6306
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/style_parser.js
|
|
6307
6307
|
var require_style_parser = __commonJS((exports) => {
|
|
6308
6308
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6309
6309
|
exports.hyphenate = exports.parse = undefined;
|
|
@@ -6370,7 +6370,7 @@ var require_style_parser = __commonJS((exports) => {
|
|
|
6370
6370
|
exports.hyphenate = hyphenate;
|
|
6371
6371
|
});
|
|
6372
6372
|
|
|
6373
|
-
// node_modules/@mixmark-io/domino/lib/CSSStyleDeclaration.js
|
|
6373
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/CSSStyleDeclaration.js
|
|
6374
6374
|
var require_CSSStyleDeclaration = __commonJS((exports, module) => {
|
|
6375
6375
|
var { parse } = require_style_parser();
|
|
6376
6376
|
module.exports = function(elt) {
|
|
@@ -6546,7 +6546,7 @@ var require_CSSStyleDeclaration = __commonJS((exports, module) => {
|
|
|
6546
6546
|
});
|
|
6547
6547
|
});
|
|
6548
6548
|
|
|
6549
|
-
// node_modules/@mixmark-io/domino/lib/URLUtils.js
|
|
6549
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/URLUtils.js
|
|
6550
6550
|
var require_URLUtils = __commonJS((exports, module) => {
|
|
6551
6551
|
var URL4 = require_URL();
|
|
6552
6552
|
module.exports = URLUtils;
|
|
@@ -6780,7 +6780,7 @@ var require_URLUtils = __commonJS((exports, module) => {
|
|
|
6780
6780
|
};
|
|
6781
6781
|
});
|
|
6782
6782
|
|
|
6783
|
-
// node_modules/@mixmark-io/domino/lib/defineElement.js
|
|
6783
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/defineElement.js
|
|
6784
6784
|
var require_defineElement = __commonJS((exports, module) => {
|
|
6785
6785
|
var attributes = require_attributes();
|
|
6786
6786
|
var isApiWritable = require_config().isApiWritable;
|
|
@@ -6842,7 +6842,7 @@ var require_defineElement = __commonJS((exports, module) => {
|
|
|
6842
6842
|
}
|
|
6843
6843
|
});
|
|
6844
6844
|
|
|
6845
|
-
// node_modules/@mixmark-io/domino/lib/htmlelts.js
|
|
6845
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/htmlelts.js
|
|
6846
6846
|
var require_htmlelts = __commonJS((exports) => {
|
|
6847
6847
|
var Node = require_Node();
|
|
6848
6848
|
var Element = require_Element();
|
|
@@ -8306,7 +8306,7 @@ var require_htmlelts = __commonJS((exports) => {
|
|
|
8306
8306
|
});
|
|
8307
8307
|
});
|
|
8308
8308
|
|
|
8309
|
-
// node_modules/@mixmark-io/domino/lib/svg.js
|
|
8309
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/svg.js
|
|
8310
8310
|
var require_svg = __commonJS((exports) => {
|
|
8311
8311
|
var Element = require_Element();
|
|
8312
8312
|
var defineElement = require_defineElement();
|
|
@@ -8432,7 +8432,7 @@ var require_svg = __commonJS((exports) => {
|
|
|
8432
8432
|
});
|
|
8433
8433
|
});
|
|
8434
8434
|
|
|
8435
|
-
// node_modules/@mixmark-io/domino/lib/MutationConstants.js
|
|
8435
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/MutationConstants.js
|
|
8436
8436
|
var require_MutationConstants = __commonJS((exports, module) => {
|
|
8437
8437
|
module.exports = {
|
|
8438
8438
|
VALUE: 1,
|
|
@@ -8444,7 +8444,7 @@ var require_MutationConstants = __commonJS((exports, module) => {
|
|
|
8444
8444
|
};
|
|
8445
8445
|
});
|
|
8446
8446
|
|
|
8447
|
-
// node_modules/@mixmark-io/domino/lib/Document.js
|
|
8447
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/Document.js
|
|
8448
8448
|
var require_Document = __commonJS((exports, module) => {
|
|
8449
8449
|
module.exports = Document;
|
|
8450
8450
|
var Node = require_Node();
|
|
@@ -9156,7 +9156,7 @@ var require_Document = __commonJS((exports, module) => {
|
|
|
9156
9156
|
};
|
|
9157
9157
|
});
|
|
9158
9158
|
|
|
9159
|
-
// node_modules/@mixmark-io/domino/lib/DocumentType.js
|
|
9159
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/DocumentType.js
|
|
9160
9160
|
var require_DocumentType = __commonJS((exports, module) => {
|
|
9161
9161
|
module.exports = DocumentType;
|
|
9162
9162
|
var Node = require_Node();
|
|
@@ -9190,7 +9190,7 @@ var require_DocumentType = __commonJS((exports, module) => {
|
|
|
9190
9190
|
Object.defineProperties(DocumentType.prototype, ChildNode);
|
|
9191
9191
|
});
|
|
9192
9192
|
|
|
9193
|
-
// node_modules/@mixmark-io/domino/lib/HTMLParser.js
|
|
9193
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/HTMLParser.js
|
|
9194
9194
|
var require_HTMLParser = __commonJS((exports, module) => {
|
|
9195
9195
|
module.exports = HTMLParser;
|
|
9196
9196
|
var Document = require_Document();
|
|
@@ -17241,7 +17241,7 @@ var require_HTMLParser = __commonJS((exports, module) => {
|
|
|
17241
17241
|
}
|
|
17242
17242
|
});
|
|
17243
17243
|
|
|
17244
|
-
// node_modules/@mixmark-io/domino/lib/DOMImplementation.js
|
|
17244
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/DOMImplementation.js
|
|
17245
17245
|
var require_DOMImplementation = __commonJS((exports, module) => {
|
|
17246
17246
|
module.exports = DOMImplementation;
|
|
17247
17247
|
var Document = require_Document();
|
|
@@ -17315,7 +17315,7 @@ var require_DOMImplementation = __commonJS((exports, module) => {
|
|
|
17315
17315
|
};
|
|
17316
17316
|
});
|
|
17317
17317
|
|
|
17318
|
-
// node_modules/@mixmark-io/domino/lib/Location.js
|
|
17318
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/Location.js
|
|
17319
17319
|
var require_Location = __commonJS((exports, module) => {
|
|
17320
17320
|
var URL4 = require_URL();
|
|
17321
17321
|
var URLUtils = require_URLUtils();
|
|
@@ -17351,7 +17351,7 @@ var require_Location = __commonJS((exports, module) => {
|
|
|
17351
17351
|
});
|
|
17352
17352
|
});
|
|
17353
17353
|
|
|
17354
|
-
// node_modules/@mixmark-io/domino/lib/NavigatorID.js
|
|
17354
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/NavigatorID.js
|
|
17355
17355
|
var require_NavigatorID = __commonJS((exports, module) => {
|
|
17356
17356
|
var NavigatorID = Object.create(null, {
|
|
17357
17357
|
appCodeName: { value: "Mozilla" },
|
|
@@ -17370,7 +17370,7 @@ var require_NavigatorID = __commonJS((exports, module) => {
|
|
|
17370
17370
|
module.exports = NavigatorID;
|
|
17371
17371
|
});
|
|
17372
17372
|
|
|
17373
|
-
// node_modules/@mixmark-io/domino/lib/WindowTimers.js
|
|
17373
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/WindowTimers.js
|
|
17374
17374
|
var require_WindowTimers = __commonJS((exports, module) => {
|
|
17375
17375
|
var WindowTimers = {
|
|
17376
17376
|
setTimeout,
|
|
@@ -17381,7 +17381,7 @@ var require_WindowTimers = __commonJS((exports, module) => {
|
|
|
17381
17381
|
module.exports = WindowTimers;
|
|
17382
17382
|
});
|
|
17383
17383
|
|
|
17384
|
-
// node_modules/@mixmark-io/domino/lib/impl.js
|
|
17384
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/impl.js
|
|
17385
17385
|
var require_impl = __commonJS((exports, module) => {
|
|
17386
17386
|
var utils = require_utils();
|
|
17387
17387
|
exports = module.exports = {
|
|
@@ -17409,7 +17409,7 @@ var require_impl = __commonJS((exports, module) => {
|
|
|
17409
17409
|
utils.merge(exports, require_svg().elements);
|
|
17410
17410
|
});
|
|
17411
17411
|
|
|
17412
|
-
// node_modules/@mixmark-io/domino/lib/Window.js
|
|
17412
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/Window.js
|
|
17413
17413
|
var require_Window = __commonJS((exports, module) => {
|
|
17414
17414
|
var DOMImplementation = require_DOMImplementation();
|
|
17415
17415
|
var EventTarget = require_EventTarget();
|
|
@@ -17464,7 +17464,7 @@ var require_Window = __commonJS((exports, module) => {
|
|
|
17464
17464
|
utils.expose(require_impl(), Window);
|
|
17465
17465
|
});
|
|
17466
17466
|
|
|
17467
|
-
// node_modules/@mixmark-io/domino/lib/index.js
|
|
17467
|
+
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/index.js
|
|
17468
17468
|
var require_lib = __commonJS((exports) => {
|
|
17469
17469
|
var DOMImplementation = require_DOMImplementation();
|
|
17470
17470
|
var HTMLParser = require_HTMLParser();
|
|
@@ -17514,7 +17514,7 @@ var require_lib = __commonJS((exports) => {
|
|
|
17514
17514
|
exports.impl = impl;
|
|
17515
17515
|
});
|
|
17516
17516
|
|
|
17517
|
-
// node_modules/turndown/lib/turndown.cjs.js
|
|
17517
|
+
// node_modules/.pnpm/turndown@7.2.4/node_modules/turndown/lib/turndown.cjs.js
|
|
17518
17518
|
var require_turndown_cjs = __commonJS((exports, module) => {
|
|
17519
17519
|
function extend(destination) {
|
|
17520
17520
|
for (var i = 1;i < arguments.length; i++) {
|
|
@@ -23720,8 +23720,338 @@ function createPostFileToolNudgeHook(options = {}) {
|
|
|
23720
23720
|
}
|
|
23721
23721
|
};
|
|
23722
23722
|
}
|
|
23723
|
+
// src/hooks/session-goal/index.ts
|
|
23724
|
+
import * as fs7 from "node:fs/promises";
|
|
23725
|
+
|
|
23726
|
+
// src/interview/document.ts
|
|
23727
|
+
import * as fsSync from "node:fs";
|
|
23728
|
+
import * as fs6 from "node:fs/promises";
|
|
23729
|
+
import * as path9 from "node:path";
|
|
23730
|
+
var DEFAULT_OUTPUT_FOLDER = "interview";
|
|
23731
|
+
function normalizeOutputFolder(outputFolder) {
|
|
23732
|
+
const normalized = outputFolder.trim().replace(/^\/+|\/+$/g, "");
|
|
23733
|
+
return normalized || DEFAULT_OUTPUT_FOLDER;
|
|
23734
|
+
}
|
|
23735
|
+
function createInterviewDirectoryPath(directory, outputFolder) {
|
|
23736
|
+
return path9.join(directory, normalizeOutputFolder(outputFolder));
|
|
23737
|
+
}
|
|
23738
|
+
function createInterviewFilePath(directory, outputFolder, idea) {
|
|
23739
|
+
const fileName = `${slugify(idea) || "interview"}.md`;
|
|
23740
|
+
return path9.join(createInterviewDirectoryPath(directory, outputFolder), fileName);
|
|
23741
|
+
}
|
|
23742
|
+
function relativeInterviewPath(directory, filePath) {
|
|
23743
|
+
return path9.relative(directory, filePath) || path9.basename(filePath);
|
|
23744
|
+
}
|
|
23745
|
+
function resolveExistingInterviewPath(directory, outputFolder, value) {
|
|
23746
|
+
const trimmed = value.trim();
|
|
23747
|
+
if (!trimmed) {
|
|
23748
|
+
return null;
|
|
23749
|
+
}
|
|
23750
|
+
const outputDir = createInterviewDirectoryPath(directory, outputFolder);
|
|
23751
|
+
const candidates = new Set;
|
|
23752
|
+
const resolvedRoot = path9.resolve(directory);
|
|
23753
|
+
if (path9.isAbsolute(trimmed)) {
|
|
23754
|
+
candidates.add(trimmed);
|
|
23755
|
+
} else {
|
|
23756
|
+
candidates.add(path9.resolve(directory, trimmed));
|
|
23757
|
+
candidates.add(path9.join(outputDir, trimmed));
|
|
23758
|
+
if (!trimmed.endsWith(".md")) {
|
|
23759
|
+
candidates.add(path9.join(outputDir, `${trimmed}.md`));
|
|
23760
|
+
}
|
|
23761
|
+
}
|
|
23762
|
+
for (const candidate of candidates) {
|
|
23763
|
+
if (path9.extname(candidate) !== ".md") {
|
|
23764
|
+
continue;
|
|
23765
|
+
}
|
|
23766
|
+
const resolved = path9.resolve(candidate);
|
|
23767
|
+
if (!resolved.startsWith(resolvedRoot + path9.sep) && resolved !== resolvedRoot) {
|
|
23768
|
+
continue;
|
|
23769
|
+
}
|
|
23770
|
+
if (fsSync.existsSync(candidate)) {
|
|
23771
|
+
return candidate;
|
|
23772
|
+
}
|
|
23773
|
+
}
|
|
23774
|
+
return null;
|
|
23775
|
+
}
|
|
23776
|
+
function slugify(value) {
|
|
23777
|
+
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48);
|
|
23778
|
+
}
|
|
23779
|
+
function extractHistorySection(document) {
|
|
23780
|
+
const marker = `## Q&A history
|
|
23781
|
+
|
|
23782
|
+
`;
|
|
23783
|
+
const index = document.indexOf(marker);
|
|
23784
|
+
return index >= 0 ? document.slice(index + marker.length).trim() : "";
|
|
23785
|
+
}
|
|
23786
|
+
function extractSummarySection(document) {
|
|
23787
|
+
const marker = `## Current spec
|
|
23788
|
+
|
|
23789
|
+
`;
|
|
23790
|
+
const historyMarker = `
|
|
23791
|
+
|
|
23792
|
+
## Q&A history`;
|
|
23793
|
+
const start = document.indexOf(marker);
|
|
23794
|
+
if (start < 0) {
|
|
23795
|
+
return "";
|
|
23796
|
+
}
|
|
23797
|
+
const summaryStart = start + marker.length;
|
|
23798
|
+
const summaryEnd = document.indexOf(historyMarker, summaryStart);
|
|
23799
|
+
return document.slice(summaryStart, summaryEnd >= 0 ? summaryEnd : undefined).trim();
|
|
23800
|
+
}
|
|
23801
|
+
function extractTitle(document) {
|
|
23802
|
+
const match = document.match(/^#\s+(.+)$/m);
|
|
23803
|
+
return match?.[1]?.trim() ?? "";
|
|
23804
|
+
}
|
|
23805
|
+
function buildInterviewDocument(idea, summary, history, meta) {
|
|
23806
|
+
const normalizedSummary = summary.trim() || "Waiting for interview answers.";
|
|
23807
|
+
const normalizedHistory = history.trim() || "No answers yet.";
|
|
23808
|
+
const frontmatter = meta?.sessionID ? [
|
|
23809
|
+
"---",
|
|
23810
|
+
`sessionID: ${meta.sessionID}`,
|
|
23811
|
+
`baseMessageCount: ${meta.baseMessageCount ?? 0}`,
|
|
23812
|
+
`updatedAt: ${new Date().toISOString()}`,
|
|
23813
|
+
"---",
|
|
23814
|
+
""
|
|
23815
|
+
].join(`
|
|
23816
|
+
`) : "";
|
|
23817
|
+
return [
|
|
23818
|
+
frontmatter,
|
|
23819
|
+
`# ${idea}`,
|
|
23820
|
+
"",
|
|
23821
|
+
"## Current spec",
|
|
23822
|
+
"",
|
|
23823
|
+
normalizedSummary,
|
|
23824
|
+
"",
|
|
23825
|
+
"## Q&A history",
|
|
23826
|
+
"",
|
|
23827
|
+
normalizedHistory,
|
|
23828
|
+
""
|
|
23829
|
+
].join(`
|
|
23830
|
+
`);
|
|
23831
|
+
}
|
|
23832
|
+
function parseFrontmatter(content) {
|
|
23833
|
+
const match = content.match(/^---\n([\s\S]*?)\n---\n/);
|
|
23834
|
+
if (!match)
|
|
23835
|
+
return null;
|
|
23836
|
+
const result = {};
|
|
23837
|
+
for (const line of match[1].split(`
|
|
23838
|
+
`)) {
|
|
23839
|
+
const colonIdx = line.indexOf(":");
|
|
23840
|
+
if (colonIdx > 0) {
|
|
23841
|
+
result[line.slice(0, colonIdx).trim()] = line.slice(colonIdx + 1).trim();
|
|
23842
|
+
}
|
|
23843
|
+
}
|
|
23844
|
+
return result;
|
|
23845
|
+
}
|
|
23846
|
+
async function ensureInterviewFile(record) {
|
|
23847
|
+
await fs6.mkdir(path9.dirname(record.markdownPath), { recursive: true });
|
|
23848
|
+
try {
|
|
23849
|
+
await fs6.access(record.markdownPath);
|
|
23850
|
+
} catch {
|
|
23851
|
+
await fs6.writeFile(record.markdownPath, buildInterviewDocument(record.idea, "", "", {
|
|
23852
|
+
sessionID: record.sessionID,
|
|
23853
|
+
baseMessageCount: record.baseMessageCount
|
|
23854
|
+
}), "utf8");
|
|
23855
|
+
}
|
|
23856
|
+
}
|
|
23857
|
+
async function readInterviewDocument(record) {
|
|
23858
|
+
try {
|
|
23859
|
+
return await fs6.readFile(record.markdownPath, "utf8");
|
|
23860
|
+
} catch {}
|
|
23861
|
+
await ensureInterviewFile(record);
|
|
23862
|
+
return fs6.readFile(record.markdownPath, "utf8");
|
|
23863
|
+
}
|
|
23864
|
+
async function rewriteInterviewDocument(record, summary) {
|
|
23865
|
+
const existing = await readInterviewDocument(record);
|
|
23866
|
+
const history = extractHistorySection(existing);
|
|
23867
|
+
const next = buildInterviewDocument(record.idea, summary, history, {
|
|
23868
|
+
sessionID: record.sessionID,
|
|
23869
|
+
baseMessageCount: record.baseMessageCount
|
|
23870
|
+
});
|
|
23871
|
+
await fs6.writeFile(record.markdownPath, next, "utf8");
|
|
23872
|
+
return next;
|
|
23873
|
+
}
|
|
23874
|
+
async function appendInterviewAnswers(record, questions, answers) {
|
|
23875
|
+
const existing = await readInterviewDocument(record);
|
|
23876
|
+
const summary = extractSummarySection(existing);
|
|
23877
|
+
const history = extractHistorySection(existing);
|
|
23878
|
+
const questionMap = new Map(questions.map((question) => [question.id, question]));
|
|
23879
|
+
const appended = answers.map((answer) => {
|
|
23880
|
+
const question = questionMap.get(answer.questionId);
|
|
23881
|
+
return question ? `Q: ${question.question}
|
|
23882
|
+
A: ${answer.answer.trim()}` : null;
|
|
23883
|
+
}).filter((value) => value !== null).join(`
|
|
23884
|
+
|
|
23885
|
+
`);
|
|
23886
|
+
const nextHistory = [history === "No answers yet." ? "" : history, appended].filter(Boolean).join(`
|
|
23887
|
+
|
|
23888
|
+
`);
|
|
23889
|
+
await fs6.writeFile(record.markdownPath, buildInterviewDocument(record.idea, summary, nextHistory, {
|
|
23890
|
+
sessionID: record.sessionID,
|
|
23891
|
+
baseMessageCount: record.baseMessageCount
|
|
23892
|
+
}), "utf8");
|
|
23893
|
+
}
|
|
23894
|
+
|
|
23895
|
+
// src/hooks/session-goal/index.ts
|
|
23896
|
+
var COMMAND_NAME = "goal";
|
|
23897
|
+
var MAX_GOAL_LENGTH = 4000;
|
|
23898
|
+
function normalizeGoalText(text) {
|
|
23899
|
+
return text.trim().replace(/\s+/g, " ").slice(0, MAX_GOAL_LENGTH);
|
|
23900
|
+
}
|
|
23901
|
+
function trimGoalText(text) {
|
|
23902
|
+
return text.trim().slice(0, MAX_GOAL_LENGTH);
|
|
23903
|
+
}
|
|
23904
|
+
function pushText(output, text) {
|
|
23905
|
+
output.parts.push(createInternalAgentTextPart(text));
|
|
23906
|
+
}
|
|
23907
|
+
function formatGoal(state, inherited) {
|
|
23908
|
+
const tag = inherited ? "parent_goal" : "active_goal";
|
|
23909
|
+
const guidance = inherited ? "This is context only. Your delegated prompt remains the bounded task." : "Use todos as the execution ledger. Keep planning, delegation, edits, and verification aligned to this goal. Do not broaden scope unless the user changes the goal.";
|
|
23910
|
+
return `<${tag}>
|
|
23911
|
+
Objective: ${state.text}
|
|
23912
|
+
${guidance}
|
|
23913
|
+
</${tag}>`;
|
|
23914
|
+
}
|
|
23915
|
+
async function readInterviewGoal(directory, outputFolder, value) {
|
|
23916
|
+
try {
|
|
23917
|
+
const sourcePath = resolveExistingInterviewPath(directory, outputFolder, value);
|
|
23918
|
+
if (!sourcePath)
|
|
23919
|
+
return null;
|
|
23920
|
+
const content = await fs7.readFile(sourcePath, "utf8");
|
|
23921
|
+
const title = extractTitle(content);
|
|
23922
|
+
const summary = extractSummarySection(content);
|
|
23923
|
+
const text = trimGoalText([title ? `From interview: ${title}` : "", summary].filter(Boolean).join(`
|
|
23924
|
+
|
|
23925
|
+
`));
|
|
23926
|
+
return text ? { text, sourcePath } : null;
|
|
23927
|
+
} catch {
|
|
23928
|
+
return null;
|
|
23929
|
+
}
|
|
23930
|
+
}
|
|
23931
|
+
function resolveGoal(goals, sessionID) {
|
|
23932
|
+
const seen = new Set;
|
|
23933
|
+
let currentSessionID = sessionID;
|
|
23934
|
+
let inherited = false;
|
|
23935
|
+
while (true) {
|
|
23936
|
+
if (seen.has(currentSessionID)) {
|
|
23937
|
+
goals.delete(sessionID);
|
|
23938
|
+
return null;
|
|
23939
|
+
}
|
|
23940
|
+
seen.add(currentSessionID);
|
|
23941
|
+
const goal = goals.get(currentSessionID);
|
|
23942
|
+
if (!goal) {
|
|
23943
|
+
goals.delete(sessionID);
|
|
23944
|
+
return null;
|
|
23945
|
+
}
|
|
23946
|
+
if (!goal.inheritedFrom) {
|
|
23947
|
+
return { goal, inherited };
|
|
23948
|
+
}
|
|
23949
|
+
inherited = true;
|
|
23950
|
+
currentSessionID = goal.inheritedFrom;
|
|
23951
|
+
}
|
|
23952
|
+
}
|
|
23953
|
+
function createSessionGoalHook(ctx, config, options) {
|
|
23954
|
+
const goals = new Map;
|
|
23955
|
+
const outputFolder = config.interview?.outputFolder ?? "interview";
|
|
23956
|
+
return {
|
|
23957
|
+
registerCommand: (opencodeConfig) => {
|
|
23958
|
+
const commandConfig = opencodeConfig.command;
|
|
23959
|
+
if (commandConfig?.[COMMAND_NAME])
|
|
23960
|
+
return;
|
|
23961
|
+
if (!opencodeConfig.command)
|
|
23962
|
+
opencodeConfig.command = {};
|
|
23963
|
+
opencodeConfig.command[COMMAND_NAME] = {
|
|
23964
|
+
template: "Set or show the current session goal",
|
|
23965
|
+
description: "Pin a session objective that keeps todos, delegation, and verification aligned"
|
|
23966
|
+
};
|
|
23967
|
+
},
|
|
23968
|
+
handleCommandExecuteBefore: async (input, output) => {
|
|
23969
|
+
if (input.command !== COMMAND_NAME)
|
|
23970
|
+
return;
|
|
23971
|
+
output.parts.length = 0;
|
|
23972
|
+
const args = input.arguments.trim();
|
|
23973
|
+
if (!args) {
|
|
23974
|
+
const resolved = resolveGoal(goals, input.sessionID);
|
|
23975
|
+
pushText(output, resolved ? `Active goal:
|
|
23976
|
+
${resolved.goal.text}
|
|
23977
|
+
|
|
23978
|
+
Use todos for execution steps. Auto-continuation continues only while todos remain.` : "No active goal. Set one with /goal <objective>.");
|
|
23979
|
+
return;
|
|
23980
|
+
}
|
|
23981
|
+
if (args === "clear") {
|
|
23982
|
+
goals.delete(input.sessionID);
|
|
23983
|
+
pushText(output, "Cleared the active goal for this session.");
|
|
23984
|
+
return;
|
|
23985
|
+
}
|
|
23986
|
+
if (args.startsWith("from ")) {
|
|
23987
|
+
const value = args.slice("from ".length).trim();
|
|
23988
|
+
const interviewGoal = await readInterviewGoal(ctx.directory, outputFolder, value);
|
|
23989
|
+
if (!interviewGoal) {
|
|
23990
|
+
pushText(output, `Could not find a readable interview spec for "${value}".`);
|
|
23991
|
+
return;
|
|
23992
|
+
}
|
|
23993
|
+
goals.set(input.sessionID, {
|
|
23994
|
+
text: interviewGoal.text,
|
|
23995
|
+
source: "interview",
|
|
23996
|
+
sourcePath: interviewGoal.sourcePath,
|
|
23997
|
+
createdAt: Date.now()
|
|
23998
|
+
});
|
|
23999
|
+
pushText(output, `Set active goal from interview:
|
|
24000
|
+
${interviewGoal.text}`);
|
|
24001
|
+
return;
|
|
24002
|
+
}
|
|
24003
|
+
const text = normalizeGoalText(args);
|
|
24004
|
+
goals.set(input.sessionID, {
|
|
24005
|
+
text,
|
|
24006
|
+
source: "manual",
|
|
24007
|
+
createdAt: Date.now()
|
|
24008
|
+
});
|
|
24009
|
+
pushText(output, `Set active goal:
|
|
24010
|
+
${text}`);
|
|
24011
|
+
},
|
|
24012
|
+
handleEvent: (input) => {
|
|
24013
|
+
const event = input.event;
|
|
24014
|
+
if (event.type === "session.created") {
|
|
24015
|
+
const info = event.properties?.info;
|
|
24016
|
+
if (!info?.id || !info.parentID)
|
|
24017
|
+
return;
|
|
24018
|
+
const parentGoal = goals.get(info.parentID);
|
|
24019
|
+
if (!parentGoal)
|
|
24020
|
+
return;
|
|
24021
|
+
goals.set(info.id, {
|
|
24022
|
+
inheritedFrom: info.parentID,
|
|
24023
|
+
createdAt: Date.now(),
|
|
24024
|
+
text: ""
|
|
24025
|
+
});
|
|
24026
|
+
return;
|
|
24027
|
+
}
|
|
24028
|
+
if (event.type === "session.deleted") {
|
|
24029
|
+
const props = event.properties;
|
|
24030
|
+
const sessionID = props?.info?.id ?? props?.sessionID;
|
|
24031
|
+
if (sessionID)
|
|
24032
|
+
goals.delete(sessionID);
|
|
24033
|
+
}
|
|
24034
|
+
},
|
|
24035
|
+
handleSystemTransform: (input, output) => {
|
|
24036
|
+
if (!input.sessionID)
|
|
24037
|
+
return;
|
|
24038
|
+
const resolved = resolveGoal(goals, input.sessionID);
|
|
24039
|
+
if (!resolved)
|
|
24040
|
+
return;
|
|
24041
|
+
const agentName = options?.getAgentName?.(input.sessionID);
|
|
24042
|
+
const { goal, inherited } = resolved;
|
|
24043
|
+
if (!inherited && agentName && agentName !== "orchestrator")
|
|
24044
|
+
return;
|
|
24045
|
+
const block = formatGoal(goal, inherited);
|
|
24046
|
+
if (output.system.some((entry) => entry.includes(block)))
|
|
24047
|
+
return;
|
|
24048
|
+
output.system.push(block);
|
|
24049
|
+
},
|
|
24050
|
+
getGoal: (sessionID) => resolveGoal(goals, sessionID)?.goal
|
|
24051
|
+
};
|
|
24052
|
+
}
|
|
23723
24053
|
// src/hooks/task-session-manager/index.ts
|
|
23724
|
-
import
|
|
24054
|
+
import path10 from "node:path";
|
|
23725
24055
|
var AGENT_NAME_SET = new Set([
|
|
23726
24056
|
"orchestrator",
|
|
23727
24057
|
"oracle",
|
|
@@ -23746,11 +24076,11 @@ function extractPath(output) {
|
|
|
23746
24076
|
return /<path>([^<]+)<\/path>/.exec(output)?.[1];
|
|
23747
24077
|
}
|
|
23748
24078
|
function normalizePath(root, file) {
|
|
23749
|
-
const
|
|
23750
|
-
if (!
|
|
24079
|
+
const relative2 = path10.relative(root, file);
|
|
24080
|
+
if (!relative2 || relative2.startsWith("..") || path10.isAbsolute(relative2)) {
|
|
23751
24081
|
return file;
|
|
23752
24082
|
}
|
|
23753
|
-
return
|
|
24083
|
+
return relative2;
|
|
23754
24084
|
}
|
|
23755
24085
|
function extractReadFiles(root, output) {
|
|
23756
24086
|
if (typeof output.output !== "string")
|
|
@@ -24138,7 +24468,7 @@ function createTodoHygiene(options) {
|
|
|
24138
24468
|
|
|
24139
24469
|
// src/hooks/todo-continuation/index.ts
|
|
24140
24470
|
var HOOK_NAME = "todo-continuation";
|
|
24141
|
-
var
|
|
24471
|
+
var COMMAND_NAME2 = "auto-continue";
|
|
24142
24472
|
var TODO_STATE_TIMEOUT_MS = 500;
|
|
24143
24473
|
var CONTINUATION_PROMPT = "[Auto-continue: enabled - there are incomplete todos remaining. Continue with the next uncompleted item. Press Esc to cancel. If you need user input or review for the next item, ask instead of proceeding.]";
|
|
24144
24474
|
var TODO_HYGIENE_INSTRUCTION_OPEN = '<instruction name="todo_hygiene">';
|
|
@@ -24629,7 +24959,7 @@ function createTodoContinuationHook(ctx, config) {
|
|
|
24629
24959
|
}
|
|
24630
24960
|
}
|
|
24631
24961
|
async function handleCommandExecuteBefore(input, output) {
|
|
24632
|
-
if (input.command !==
|
|
24962
|
+
if (input.command !== COMMAND_NAME2) {
|
|
24633
24963
|
return;
|
|
24634
24964
|
}
|
|
24635
24965
|
registerOrchestratorSession(input.sessionID);
|
|
@@ -24648,11 +24978,11 @@ function createTodoContinuationHook(ctx, config) {
|
|
|
24648
24978
|
if (!newEnabled) {
|
|
24649
24979
|
cancelPendingTimer(state);
|
|
24650
24980
|
output.parts.push(createInternalAgentTextPart("[Auto-continue: disabled by user command.]"));
|
|
24651
|
-
log(`[${HOOK_NAME}] Disabled via /${
|
|
24981
|
+
log(`[${HOOK_NAME}] Disabled via /${COMMAND_NAME2} command`);
|
|
24652
24982
|
return;
|
|
24653
24983
|
}
|
|
24654
24984
|
state.suppressUntil = 0;
|
|
24655
|
-
log(`[${HOOK_NAME}] Enabled via /${
|
|
24985
|
+
log(`[${HOOK_NAME}] Enabled via /${COMMAND_NAME2} command`, {
|
|
24656
24986
|
maxContinuations
|
|
24657
24987
|
});
|
|
24658
24988
|
let hasIncompleteTodos = false;
|
|
@@ -24686,7 +25016,7 @@ import path13 from "node:path";
|
|
|
24686
25016
|
// src/interview/dashboard.ts
|
|
24687
25017
|
import crypto from "node:crypto";
|
|
24688
25018
|
import * as fsSync2 from "node:fs";
|
|
24689
|
-
import
|
|
25019
|
+
import fs8 from "node:fs/promises";
|
|
24690
25020
|
import {
|
|
24691
25021
|
createServer
|
|
24692
25022
|
} from "node:http";
|
|
@@ -24694,175 +25024,6 @@ import os4 from "node:os";
|
|
|
24694
25024
|
import path11 from "node:path";
|
|
24695
25025
|
import { URL as URL2 } from "node:url";
|
|
24696
25026
|
|
|
24697
|
-
// src/interview/document.ts
|
|
24698
|
-
import * as fsSync from "node:fs";
|
|
24699
|
-
import * as fs6 from "node:fs/promises";
|
|
24700
|
-
import * as path10 from "node:path";
|
|
24701
|
-
var DEFAULT_OUTPUT_FOLDER = "interview";
|
|
24702
|
-
function normalizeOutputFolder(outputFolder) {
|
|
24703
|
-
const normalized = outputFolder.trim().replace(/^\/+|\/+$/g, "");
|
|
24704
|
-
return normalized || DEFAULT_OUTPUT_FOLDER;
|
|
24705
|
-
}
|
|
24706
|
-
function createInterviewDirectoryPath(directory, outputFolder) {
|
|
24707
|
-
return path10.join(directory, normalizeOutputFolder(outputFolder));
|
|
24708
|
-
}
|
|
24709
|
-
function createInterviewFilePath(directory, outputFolder, idea) {
|
|
24710
|
-
const fileName = `${slugify(idea) || "interview"}.md`;
|
|
24711
|
-
return path10.join(createInterviewDirectoryPath(directory, outputFolder), fileName);
|
|
24712
|
-
}
|
|
24713
|
-
function relativeInterviewPath(directory, filePath) {
|
|
24714
|
-
return path10.relative(directory, filePath) || path10.basename(filePath);
|
|
24715
|
-
}
|
|
24716
|
-
function resolveExistingInterviewPath(directory, outputFolder, value) {
|
|
24717
|
-
const trimmed = value.trim();
|
|
24718
|
-
if (!trimmed) {
|
|
24719
|
-
return null;
|
|
24720
|
-
}
|
|
24721
|
-
const outputDir = createInterviewDirectoryPath(directory, outputFolder);
|
|
24722
|
-
const candidates = new Set;
|
|
24723
|
-
const resolvedRoot = path10.resolve(directory);
|
|
24724
|
-
if (path10.isAbsolute(trimmed)) {
|
|
24725
|
-
candidates.add(trimmed);
|
|
24726
|
-
} else {
|
|
24727
|
-
candidates.add(path10.resolve(directory, trimmed));
|
|
24728
|
-
candidates.add(path10.join(outputDir, trimmed));
|
|
24729
|
-
if (!trimmed.endsWith(".md")) {
|
|
24730
|
-
candidates.add(path10.join(outputDir, `${trimmed}.md`));
|
|
24731
|
-
}
|
|
24732
|
-
}
|
|
24733
|
-
for (const candidate of candidates) {
|
|
24734
|
-
if (path10.extname(candidate) !== ".md") {
|
|
24735
|
-
continue;
|
|
24736
|
-
}
|
|
24737
|
-
const resolved = path10.resolve(candidate);
|
|
24738
|
-
if (!resolved.startsWith(resolvedRoot + path10.sep) && resolved !== resolvedRoot) {
|
|
24739
|
-
continue;
|
|
24740
|
-
}
|
|
24741
|
-
if (fsSync.existsSync(candidate)) {
|
|
24742
|
-
return candidate;
|
|
24743
|
-
}
|
|
24744
|
-
}
|
|
24745
|
-
return null;
|
|
24746
|
-
}
|
|
24747
|
-
function slugify(value) {
|
|
24748
|
-
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48);
|
|
24749
|
-
}
|
|
24750
|
-
function extractHistorySection(document) {
|
|
24751
|
-
const marker = `## Q&A history
|
|
24752
|
-
|
|
24753
|
-
`;
|
|
24754
|
-
const index = document.indexOf(marker);
|
|
24755
|
-
return index >= 0 ? document.slice(index + marker.length).trim() : "";
|
|
24756
|
-
}
|
|
24757
|
-
function extractSummarySection(document) {
|
|
24758
|
-
const marker = `## Current spec
|
|
24759
|
-
|
|
24760
|
-
`;
|
|
24761
|
-
const historyMarker = `
|
|
24762
|
-
|
|
24763
|
-
## Q&A history`;
|
|
24764
|
-
const start = document.indexOf(marker);
|
|
24765
|
-
if (start < 0) {
|
|
24766
|
-
return "";
|
|
24767
|
-
}
|
|
24768
|
-
const summaryStart = start + marker.length;
|
|
24769
|
-
const summaryEnd = document.indexOf(historyMarker, summaryStart);
|
|
24770
|
-
return document.slice(summaryStart, summaryEnd >= 0 ? summaryEnd : undefined).trim();
|
|
24771
|
-
}
|
|
24772
|
-
function extractTitle(document) {
|
|
24773
|
-
const match = document.match(/^#\s+(.+)$/m);
|
|
24774
|
-
return match?.[1]?.trim() ?? "";
|
|
24775
|
-
}
|
|
24776
|
-
function buildInterviewDocument(idea, summary, history, meta) {
|
|
24777
|
-
const normalizedSummary = summary.trim() || "Waiting for interview answers.";
|
|
24778
|
-
const normalizedHistory = history.trim() || "No answers yet.";
|
|
24779
|
-
const frontmatter = meta?.sessionID ? [
|
|
24780
|
-
"---",
|
|
24781
|
-
`sessionID: ${meta.sessionID}`,
|
|
24782
|
-
`baseMessageCount: ${meta.baseMessageCount ?? 0}`,
|
|
24783
|
-
`updatedAt: ${new Date().toISOString()}`,
|
|
24784
|
-
"---",
|
|
24785
|
-
""
|
|
24786
|
-
].join(`
|
|
24787
|
-
`) : "";
|
|
24788
|
-
return [
|
|
24789
|
-
frontmatter,
|
|
24790
|
-
`# ${idea}`,
|
|
24791
|
-
"",
|
|
24792
|
-
"## Current spec",
|
|
24793
|
-
"",
|
|
24794
|
-
normalizedSummary,
|
|
24795
|
-
"",
|
|
24796
|
-
"## Q&A history",
|
|
24797
|
-
"",
|
|
24798
|
-
normalizedHistory,
|
|
24799
|
-
""
|
|
24800
|
-
].join(`
|
|
24801
|
-
`);
|
|
24802
|
-
}
|
|
24803
|
-
function parseFrontmatter(content) {
|
|
24804
|
-
const match = content.match(/^---\n([\s\S]*?)\n---\n/);
|
|
24805
|
-
if (!match)
|
|
24806
|
-
return null;
|
|
24807
|
-
const result = {};
|
|
24808
|
-
for (const line of match[1].split(`
|
|
24809
|
-
`)) {
|
|
24810
|
-
const colonIdx = line.indexOf(":");
|
|
24811
|
-
if (colonIdx > 0) {
|
|
24812
|
-
result[line.slice(0, colonIdx).trim()] = line.slice(colonIdx + 1).trim();
|
|
24813
|
-
}
|
|
24814
|
-
}
|
|
24815
|
-
return result;
|
|
24816
|
-
}
|
|
24817
|
-
async function ensureInterviewFile(record) {
|
|
24818
|
-
await fs6.mkdir(path10.dirname(record.markdownPath), { recursive: true });
|
|
24819
|
-
try {
|
|
24820
|
-
await fs6.access(record.markdownPath);
|
|
24821
|
-
} catch {
|
|
24822
|
-
await fs6.writeFile(record.markdownPath, buildInterviewDocument(record.idea, "", "", {
|
|
24823
|
-
sessionID: record.sessionID,
|
|
24824
|
-
baseMessageCount: record.baseMessageCount
|
|
24825
|
-
}), "utf8");
|
|
24826
|
-
}
|
|
24827
|
-
}
|
|
24828
|
-
async function readInterviewDocument(record) {
|
|
24829
|
-
try {
|
|
24830
|
-
return await fs6.readFile(record.markdownPath, "utf8");
|
|
24831
|
-
} catch {}
|
|
24832
|
-
await ensureInterviewFile(record);
|
|
24833
|
-
return fs6.readFile(record.markdownPath, "utf8");
|
|
24834
|
-
}
|
|
24835
|
-
async function rewriteInterviewDocument(record, summary) {
|
|
24836
|
-
const existing = await readInterviewDocument(record);
|
|
24837
|
-
const history = extractHistorySection(existing);
|
|
24838
|
-
const next = buildInterviewDocument(record.idea, summary, history, {
|
|
24839
|
-
sessionID: record.sessionID,
|
|
24840
|
-
baseMessageCount: record.baseMessageCount
|
|
24841
|
-
});
|
|
24842
|
-
await fs6.writeFile(record.markdownPath, next, "utf8");
|
|
24843
|
-
return next;
|
|
24844
|
-
}
|
|
24845
|
-
async function appendInterviewAnswers(record, questions, answers) {
|
|
24846
|
-
const existing = await readInterviewDocument(record);
|
|
24847
|
-
const summary = extractSummarySection(existing);
|
|
24848
|
-
const history = extractHistorySection(existing);
|
|
24849
|
-
const questionMap = new Map(questions.map((question) => [question.id, question]));
|
|
24850
|
-
const appended = answers.map((answer) => {
|
|
24851
|
-
const question = questionMap.get(answer.questionId);
|
|
24852
|
-
return question ? `Q: ${question.question}
|
|
24853
|
-
A: ${answer.answer.trim()}` : null;
|
|
24854
|
-
}).filter((value) => value !== null).join(`
|
|
24855
|
-
|
|
24856
|
-
`);
|
|
24857
|
-
const nextHistory = [history === "No answers yet." ? "" : history, appended].filter(Boolean).join(`
|
|
24858
|
-
|
|
24859
|
-
`);
|
|
24860
|
-
await fs6.writeFile(record.markdownPath, buildInterviewDocument(record.idea, summary, nextHistory, {
|
|
24861
|
-
sessionID: record.sessionID,
|
|
24862
|
-
baseMessageCount: record.baseMessageCount
|
|
24863
|
-
}), "utf8");
|
|
24864
|
-
}
|
|
24865
|
-
|
|
24866
25027
|
// src/interview/helpers.ts
|
|
24867
25028
|
function sendJson(response, status, value) {
|
|
24868
25029
|
response.statusCode = status;
|
|
@@ -26507,7 +26668,7 @@ function removeAuthFile(port) {
|
|
|
26507
26668
|
}
|
|
26508
26669
|
async function readDashboardAuthFile(port) {
|
|
26509
26670
|
try {
|
|
26510
|
-
const content = await
|
|
26671
|
+
const content = await fs8.readFile(getAuthFilePath(port), "utf8");
|
|
26511
26672
|
const data = JSON.parse(content);
|
|
26512
26673
|
try {
|
|
26513
26674
|
process.kill(data.pid, 0);
|
|
@@ -26630,7 +26791,7 @@ function createDashboardServer(config) {
|
|
|
26630
26791
|
const interviewDir = path11.join(dir, config.outputFolder);
|
|
26631
26792
|
let entries;
|
|
26632
26793
|
try {
|
|
26633
|
-
entries = await
|
|
26794
|
+
entries = await fs8.readdir(interviewDir);
|
|
26634
26795
|
} catch {
|
|
26635
26796
|
continue;
|
|
26636
26797
|
}
|
|
@@ -26639,7 +26800,7 @@ function createDashboardServer(config) {
|
|
|
26639
26800
|
continue;
|
|
26640
26801
|
let content;
|
|
26641
26802
|
try {
|
|
26642
|
-
content = await
|
|
26803
|
+
content = await fs8.readFile(path11.join(interviewDir, entry), "utf8");
|
|
26643
26804
|
} catch {
|
|
26644
26805
|
continue;
|
|
26645
26806
|
}
|
|
@@ -26668,7 +26829,7 @@ function createDashboardServer(config) {
|
|
|
26668
26829
|
const interviewDir = path11.join(dir, config.outputFolder);
|
|
26669
26830
|
let entries;
|
|
26670
26831
|
try {
|
|
26671
|
-
entries = await
|
|
26832
|
+
entries = await fs8.readdir(interviewDir);
|
|
26672
26833
|
} catch {
|
|
26673
26834
|
continue;
|
|
26674
26835
|
}
|
|
@@ -26677,7 +26838,7 @@ function createDashboardServer(config) {
|
|
|
26677
26838
|
continue;
|
|
26678
26839
|
let content;
|
|
26679
26840
|
try {
|
|
26680
|
-
content = await
|
|
26841
|
+
content = await fs8.readFile(path11.join(interviewDir, entry), "utf8");
|
|
26681
26842
|
} catch {
|
|
26682
26843
|
continue;
|
|
26683
26844
|
}
|
|
@@ -26961,7 +27122,7 @@ function createDashboardServer(config) {
|
|
|
26961
27122
|
let markdownPath = entry.filePath;
|
|
26962
27123
|
if (entry.filePath) {
|
|
26963
27124
|
try {
|
|
26964
|
-
document = await
|
|
27125
|
+
document = await fs8.readFile(entry.filePath, "utf8");
|
|
26965
27126
|
} catch {}
|
|
26966
27127
|
} else {
|
|
26967
27128
|
const dirs = getKnownDirectories();
|
|
@@ -26969,7 +27130,7 @@ function createDashboardServer(config) {
|
|
|
26969
27130
|
const slug = extractResumeSlug(interviewId);
|
|
26970
27131
|
const candidate = path11.join(dir, config.outputFolder, `${slug}.md`);
|
|
26971
27132
|
try {
|
|
26972
|
-
document = await
|
|
27133
|
+
document = await fs8.readFile(candidate, "utf8");
|
|
26973
27134
|
markdownPath = candidate;
|
|
26974
27135
|
entry.filePath = candidate;
|
|
26975
27136
|
break;
|
|
@@ -27494,7 +27655,7 @@ function createInterviewServer(deps) {
|
|
|
27494
27655
|
|
|
27495
27656
|
// src/interview/service.ts
|
|
27496
27657
|
import { spawn as spawn2 } from "node:child_process";
|
|
27497
|
-
import * as
|
|
27658
|
+
import * as fs9 from "node:fs/promises";
|
|
27498
27659
|
import * as path12 from "node:path";
|
|
27499
27660
|
|
|
27500
27661
|
// src/interview/types.ts
|
|
@@ -27667,7 +27828,7 @@ function buildAnswerPrompt(answers, questions, maxQuestions) {
|
|
|
27667
27828
|
}
|
|
27668
27829
|
|
|
27669
27830
|
// src/interview/service.ts
|
|
27670
|
-
var
|
|
27831
|
+
var COMMAND_NAME3 = "interview";
|
|
27671
27832
|
var DEFAULT_MAX_QUESTIONS = 2;
|
|
27672
27833
|
function isTruthyEnvFlag(value) {
|
|
27673
27834
|
if (!value) {
|
|
@@ -27769,11 +27930,11 @@ function createInterviewService(ctx, config, deps) {
|
|
|
27769
27930
|
const dir = path12.dirname(interview.markdownPath);
|
|
27770
27931
|
const newPath = path12.join(dir, `${newSlug}.md`);
|
|
27771
27932
|
try {
|
|
27772
|
-
await
|
|
27933
|
+
await fs9.access(newPath);
|
|
27773
27934
|
return;
|
|
27774
27935
|
} catch {}
|
|
27775
27936
|
try {
|
|
27776
|
-
await
|
|
27937
|
+
await fs9.rename(interview.markdownPath, newPath);
|
|
27777
27938
|
interview.markdownPath = newPath;
|
|
27778
27939
|
log("[interview] renamed file with assistant title:", {
|
|
27779
27940
|
from: currentFileName,
|
|
@@ -27839,7 +28000,7 @@ function createInterviewService(ctx, config, deps) {
|
|
|
27839
28000
|
active.status = "abandoned";
|
|
27840
28001
|
}
|
|
27841
28002
|
}
|
|
27842
|
-
const document = await
|
|
28003
|
+
const document = await fs9.readFile(markdownPath, "utf8");
|
|
27843
28004
|
const messages = await loadMessages(sessionID);
|
|
27844
28005
|
const title = extractTitle(document);
|
|
27845
28006
|
const record = {
|
|
@@ -27914,11 +28075,11 @@ function createInterviewService(ctx, config, deps) {
|
|
|
27914
28075
|
}
|
|
27915
28076
|
function registerCommand(opencodeConfig) {
|
|
27916
28077
|
const configCommand = opencodeConfig.command;
|
|
27917
|
-
if (!configCommand?.[
|
|
28078
|
+
if (!configCommand?.[COMMAND_NAME3]) {
|
|
27918
28079
|
if (!opencodeConfig.command) {
|
|
27919
28080
|
opencodeConfig.command = {};
|
|
27920
28081
|
}
|
|
27921
|
-
opencodeConfig.command[
|
|
28082
|
+
opencodeConfig.command[COMMAND_NAME3] = {
|
|
27922
28083
|
template: "Start an interview and write a live markdown spec",
|
|
27923
28084
|
description: "Open a localhost interview UI linked to the current OpenCode session"
|
|
27924
28085
|
};
|
|
@@ -27992,7 +28153,7 @@ function createInterviewService(ctx, config, deps) {
|
|
|
27992
28153
|
}
|
|
27993
28154
|
}
|
|
27994
28155
|
async function handleCommandExecuteBefore(input, output) {
|
|
27995
|
-
if (input.command !==
|
|
28156
|
+
if (input.command !== COMMAND_NAME3) {
|
|
27996
28157
|
return;
|
|
27997
28158
|
}
|
|
27998
28159
|
const idea = input.arguments.trim();
|
|
@@ -28011,7 +28172,7 @@ function createInterviewService(ctx, config, deps) {
|
|
|
28011
28172
|
const resumePath = resolveExistingInterviewPath(ctx.directory, outputFolder, idea);
|
|
28012
28173
|
if (resumePath) {
|
|
28013
28174
|
const interview2 = await resumeInterview(input.sessionID, resumePath);
|
|
28014
|
-
const document = await
|
|
28175
|
+
const document = await fs9.readFile(interview2.markdownPath, "utf8");
|
|
28015
28176
|
await notifyInterviewUrl(input.sessionID, interview2);
|
|
28016
28177
|
output.parts.push(createInternalAgentTextPart(buildResumePrompt(document, maxQuestions)));
|
|
28017
28178
|
return;
|
|
@@ -28075,7 +28236,7 @@ function createInterviewService(ctx, config, deps) {
|
|
|
28075
28236
|
const activePaths = new Set([...interviewsById.values()].filter((i) => i.status === "active").map((i) => path12.resolve(i.markdownPath)));
|
|
28076
28237
|
let entries;
|
|
28077
28238
|
try {
|
|
28078
|
-
entries = await
|
|
28239
|
+
entries = await fs9.readdir(outputDir);
|
|
28079
28240
|
} catch {
|
|
28080
28241
|
return [];
|
|
28081
28242
|
}
|
|
@@ -28088,7 +28249,7 @@ function createInterviewService(ctx, config, deps) {
|
|
|
28088
28249
|
continue;
|
|
28089
28250
|
let content;
|
|
28090
28251
|
try {
|
|
28091
|
-
content = await
|
|
28252
|
+
content = await fs9.readFile(fullPath, "utf8");
|
|
28092
28253
|
} catch {
|
|
28093
28254
|
continue;
|
|
28094
28255
|
}
|
|
@@ -29161,29 +29322,46 @@ function startAvailabilityCheck(config) {
|
|
|
29161
29322
|
// src/multiplexer/session-manager.ts
|
|
29162
29323
|
var SESSION_TIMEOUT_MS = 10 * 60 * 1000;
|
|
29163
29324
|
var SESSION_MISSING_GRACE_MS = POLL_INTERVAL_BACKGROUND_MS * 3;
|
|
29164
|
-
|
|
29325
|
+
var SHARED_STATE_KEY = Symbol.for("oh-my-opencode-slim.multiplexer-session-manager.state");
|
|
29326
|
+
function getSharedState() {
|
|
29327
|
+
const globalWithState = globalThis;
|
|
29328
|
+
globalWithState[SHARED_STATE_KEY] ??= {
|
|
29329
|
+
sessions: new Map,
|
|
29330
|
+
knownSessions: new Map,
|
|
29331
|
+
spawningSessions: new Set,
|
|
29332
|
+
closingSessions: new Map
|
|
29333
|
+
};
|
|
29334
|
+
return globalWithState[SHARED_STATE_KEY];
|
|
29335
|
+
}
|
|
29165
29336
|
class MultiplexerSessionManager {
|
|
29166
|
-
|
|
29337
|
+
instanceId = Math.random().toString(36).slice(2, 8);
|
|
29167
29338
|
serverUrl;
|
|
29168
29339
|
directory;
|
|
29169
29340
|
multiplexer = null;
|
|
29170
|
-
sessions
|
|
29171
|
-
knownSessions
|
|
29172
|
-
spawningSessions
|
|
29173
|
-
closingSessions
|
|
29341
|
+
sessions;
|
|
29342
|
+
knownSessions;
|
|
29343
|
+
spawningSessions;
|
|
29344
|
+
closingSessions;
|
|
29174
29345
|
pollInterval;
|
|
29175
29346
|
enabled = false;
|
|
29176
29347
|
constructor(ctx, config) {
|
|
29177
|
-
|
|
29348
|
+
const sharedState = getSharedState();
|
|
29349
|
+
this.sessions = sharedState.sessions;
|
|
29350
|
+
this.knownSessions = sharedState.knownSessions;
|
|
29351
|
+
this.spawningSessions = sharedState.spawningSessions;
|
|
29352
|
+
this.closingSessions = sharedState.closingSessions;
|
|
29178
29353
|
this.directory = ctx.directory;
|
|
29179
29354
|
const defaultPort = process.env.OPENCODE_PORT ?? "4096";
|
|
29180
29355
|
this.serverUrl = ctx.serverUrl?.toString() ?? `http://localhost:${defaultPort}`;
|
|
29181
29356
|
this.multiplexer = getMultiplexer(config);
|
|
29182
29357
|
this.enabled = config.type !== "none" && this.multiplexer !== null && this.multiplexer.isInsideSession();
|
|
29183
29358
|
log("[multiplexer-session-manager] initialized", {
|
|
29359
|
+
instanceId: this.instanceId,
|
|
29184
29360
|
enabled: this.enabled,
|
|
29185
29361
|
type: config.type,
|
|
29186
|
-
serverUrl: this.serverUrl
|
|
29362
|
+
serverUrl: this.serverUrl,
|
|
29363
|
+
trackedSessions: this.sessions.size,
|
|
29364
|
+
knownSessions: this.knownSessions.size
|
|
29187
29365
|
});
|
|
29188
29366
|
}
|
|
29189
29367
|
async onSessionCreated(event) {
|
|
@@ -29201,6 +29379,7 @@ class MultiplexerSessionManager {
|
|
|
29201
29379
|
const directory = info.directory ?? this.directory;
|
|
29202
29380
|
if (this.isTrackedOrSpawning(sessionId)) {
|
|
29203
29381
|
log("[multiplexer-session-manager] session already tracked or spawning", {
|
|
29382
|
+
instanceId: this.instanceId,
|
|
29204
29383
|
sessionId
|
|
29205
29384
|
});
|
|
29206
29385
|
return;
|
|
@@ -29220,6 +29399,7 @@ class MultiplexerSessionManager {
|
|
|
29220
29399
|
const serverRunning = await isServerRunning(this.serverUrl);
|
|
29221
29400
|
if (!serverRunning) {
|
|
29222
29401
|
log("[multiplexer-session-manager] server not running, skipping", {
|
|
29402
|
+
instanceId: this.instanceId,
|
|
29223
29403
|
serverUrl: this.serverUrl
|
|
29224
29404
|
});
|
|
29225
29405
|
return;
|
|
@@ -29230,10 +29410,12 @@ class MultiplexerSessionManager {
|
|
|
29230
29410
|
log("[multiplexer-session-manager] child session created, spawning pane", {
|
|
29231
29411
|
sessionId,
|
|
29232
29412
|
parentId,
|
|
29233
|
-
title
|
|
29413
|
+
title,
|
|
29414
|
+
instanceId: this.instanceId
|
|
29234
29415
|
});
|
|
29235
29416
|
const paneResult = await this.multiplexer.spawnPane(sessionId, title, this.serverUrl, directory).catch((err) => {
|
|
29236
29417
|
log("[multiplexer-session-manager] failed to spawn pane", {
|
|
29418
|
+
instanceId: this.instanceId,
|
|
29237
29419
|
error: String(err)
|
|
29238
29420
|
});
|
|
29239
29421
|
return { success: false, paneId: undefined };
|
|
@@ -29244,6 +29426,7 @@ class MultiplexerSessionManager {
|
|
|
29244
29426
|
await this.multiplexer.closePane(paneResult.paneId).catch((err) => log("[multiplexer-session-manager] closing stale spawned pane failed", {
|
|
29245
29427
|
sessionId,
|
|
29246
29428
|
paneId: paneResult.paneId,
|
|
29429
|
+
instanceId: this.instanceId,
|
|
29247
29430
|
error: String(err)
|
|
29248
29431
|
}));
|
|
29249
29432
|
return;
|
|
@@ -29259,6 +29442,7 @@ class MultiplexerSessionManager {
|
|
|
29259
29442
|
lastSeenAt: now
|
|
29260
29443
|
});
|
|
29261
29444
|
log("[multiplexer-session-manager] pane spawned", {
|
|
29445
|
+
instanceId: this.instanceId,
|
|
29262
29446
|
sessionId,
|
|
29263
29447
|
paneId: paneResult.paneId
|
|
29264
29448
|
});
|
|
@@ -29270,6 +29454,19 @@ class MultiplexerSessionManager {
|
|
|
29270
29454
|
async onSessionStatus(event) {
|
|
29271
29455
|
if (!this.enabled)
|
|
29272
29456
|
return;
|
|
29457
|
+
if (event.type === "session.idle") {
|
|
29458
|
+
const sessionId2 = event.properties?.sessionID;
|
|
29459
|
+
if (!sessionId2)
|
|
29460
|
+
return;
|
|
29461
|
+
log("[multiplexer-session-manager] session idle event received", {
|
|
29462
|
+
instanceId: this.instanceId,
|
|
29463
|
+
sessionId: sessionId2,
|
|
29464
|
+
tracked: this.sessions.has(sessionId2),
|
|
29465
|
+
known: this.knownSessions.has(sessionId2)
|
|
29466
|
+
});
|
|
29467
|
+
await this.closeSession(sessionId2, "idle");
|
|
29468
|
+
return;
|
|
29469
|
+
}
|
|
29273
29470
|
if (event.type !== "session.status")
|
|
29274
29471
|
return;
|
|
29275
29472
|
const sessionId = event.properties?.sessionID;
|
|
@@ -29280,6 +29477,12 @@ class MultiplexerSessionManager {
|
|
|
29280
29477
|
return;
|
|
29281
29478
|
}
|
|
29282
29479
|
if (event.properties?.status?.type === "busy") {
|
|
29480
|
+
log("[multiplexer-session-manager] session busy event received", {
|
|
29481
|
+
instanceId: this.instanceId,
|
|
29482
|
+
sessionId,
|
|
29483
|
+
tracked: this.sessions.has(sessionId),
|
|
29484
|
+
known: this.knownSessions.has(sessionId)
|
|
29485
|
+
});
|
|
29283
29486
|
await this.respawnIfKnown(sessionId);
|
|
29284
29487
|
}
|
|
29285
29488
|
}
|
|
@@ -29292,6 +29495,7 @@ class MultiplexerSessionManager {
|
|
|
29292
29495
|
if (!sessionId)
|
|
29293
29496
|
return;
|
|
29294
29497
|
log("[multiplexer-session-manager] session deleted, closing pane", {
|
|
29498
|
+
instanceId: this.instanceId,
|
|
29295
29499
|
sessionId
|
|
29296
29500
|
});
|
|
29297
29501
|
await this.closeSession(sessionId, "deleted");
|
|
@@ -29300,13 +29504,17 @@ class MultiplexerSessionManager {
|
|
|
29300
29504
|
if (this.pollInterval)
|
|
29301
29505
|
return;
|
|
29302
29506
|
this.pollInterval = setInterval(() => this.pollSessions(), POLL_INTERVAL_BACKGROUND_MS);
|
|
29303
|
-
log("[multiplexer-session-manager] polling started"
|
|
29507
|
+
log("[multiplexer-session-manager] polling started", {
|
|
29508
|
+
instanceId: this.instanceId
|
|
29509
|
+
});
|
|
29304
29510
|
}
|
|
29305
29511
|
stopPolling() {
|
|
29306
29512
|
if (this.pollInterval) {
|
|
29307
29513
|
clearInterval(this.pollInterval);
|
|
29308
29514
|
this.pollInterval = undefined;
|
|
29309
|
-
log("[multiplexer-session-manager] polling stopped"
|
|
29515
|
+
log("[multiplexer-session-manager] polling stopped", {
|
|
29516
|
+
instanceId: this.instanceId
|
|
29517
|
+
});
|
|
29310
29518
|
}
|
|
29311
29519
|
}
|
|
29312
29520
|
async pollSessions() {
|
|
@@ -29315,8 +29523,7 @@ class MultiplexerSessionManager {
|
|
|
29315
29523
|
return;
|
|
29316
29524
|
}
|
|
29317
29525
|
try {
|
|
29318
|
-
const
|
|
29319
|
-
const allStatuses = statusResult.data ?? {};
|
|
29526
|
+
const allStatuses = await this.fetchSessionStatuses();
|
|
29320
29527
|
const now = Date.now();
|
|
29321
29528
|
const sessionsToClose = [];
|
|
29322
29529
|
for (const [sessionId, tracked] of this.sessions.entries()) {
|
|
@@ -29344,6 +29551,14 @@ class MultiplexerSessionManager {
|
|
|
29344
29551
|
log("[multiplexer-session-manager] poll error", { error: String(err) });
|
|
29345
29552
|
}
|
|
29346
29553
|
}
|
|
29554
|
+
async fetchSessionStatuses() {
|
|
29555
|
+
const url = new URL("/session/status", this.serverUrl);
|
|
29556
|
+
const response = await fetch(url, { signal: AbortSignal.timeout(2000) });
|
|
29557
|
+
if (!response.ok) {
|
|
29558
|
+
throw new Error(`session status request failed: ${response.status} ${response.statusText}`);
|
|
29559
|
+
}
|
|
29560
|
+
return await response.json();
|
|
29561
|
+
}
|
|
29347
29562
|
async closeSession(sessionId, reason) {
|
|
29348
29563
|
if (reason === "deleted") {
|
|
29349
29564
|
this.knownSessions.delete(sessionId);
|
|
@@ -29352,10 +29567,19 @@ class MultiplexerSessionManager {
|
|
|
29352
29567
|
if (existingClose)
|
|
29353
29568
|
return existingClose;
|
|
29354
29569
|
const tracked = this.sessions.get(sessionId);
|
|
29355
|
-
if (!tracked || !this.multiplexer)
|
|
29570
|
+
if (!tracked || !this.multiplexer) {
|
|
29571
|
+
log("[multiplexer-session-manager] close skipped; session not tracked", {
|
|
29572
|
+
instanceId: this.instanceId,
|
|
29573
|
+
sessionId,
|
|
29574
|
+
reason,
|
|
29575
|
+
tracked: !!tracked,
|
|
29576
|
+
hasMultiplexer: !!this.multiplexer
|
|
29577
|
+
});
|
|
29356
29578
|
return;
|
|
29579
|
+
}
|
|
29357
29580
|
this.sessions.delete(sessionId);
|
|
29358
29581
|
log("[multiplexer-session-manager] closing session pane", {
|
|
29582
|
+
instanceId: this.instanceId,
|
|
29359
29583
|
sessionId,
|
|
29360
29584
|
paneId: tracked.paneId,
|
|
29361
29585
|
reason
|
|
@@ -29363,6 +29587,7 @@ class MultiplexerSessionManager {
|
|
|
29363
29587
|
const closePromise = this.multiplexer.closePane(tracked.paneId).then(() => {
|
|
29364
29588
|
return;
|
|
29365
29589
|
}).catch((err) => log("[multiplexer-session-manager] failed to close session pane", {
|
|
29590
|
+
instanceId: this.instanceId,
|
|
29366
29591
|
sessionId,
|
|
29367
29592
|
paneId: tracked.paneId,
|
|
29368
29593
|
reason,
|
|
@@ -29391,6 +29616,7 @@ class MultiplexerSessionManager {
|
|
|
29391
29616
|
const serverRunning = await isServerRunning(this.serverUrl);
|
|
29392
29617
|
if (!serverRunning) {
|
|
29393
29618
|
log("[multiplexer-session-manager] server not running, skipping busy respawn", {
|
|
29619
|
+
instanceId: this.instanceId,
|
|
29394
29620
|
serverUrl: this.serverUrl,
|
|
29395
29621
|
sessionId
|
|
29396
29622
|
});
|
|
@@ -29400,12 +29626,14 @@ class MultiplexerSessionManager {
|
|
|
29400
29626
|
return;
|
|
29401
29627
|
}
|
|
29402
29628
|
log("[multiplexer-session-manager] child session busy again, respawning pane", {
|
|
29629
|
+
instanceId: this.instanceId,
|
|
29403
29630
|
sessionId,
|
|
29404
29631
|
parentId: known.parentId,
|
|
29405
29632
|
title: known.title
|
|
29406
29633
|
});
|
|
29407
29634
|
const paneResult = await this.multiplexer.spawnPane(sessionId, known.title, this.serverUrl, known.directory).catch((err) => {
|
|
29408
29635
|
log("[multiplexer-session-manager] failed to respawn pane", {
|
|
29636
|
+
instanceId: this.instanceId,
|
|
29409
29637
|
error: String(err)
|
|
29410
29638
|
});
|
|
29411
29639
|
return { success: false, paneId: undefined };
|
|
@@ -29414,6 +29642,7 @@ class MultiplexerSessionManager {
|
|
|
29414
29642
|
return;
|
|
29415
29643
|
if (!this.knownSessions.has(sessionId) || this.closingSessions.has(sessionId)) {
|
|
29416
29644
|
await this.multiplexer.closePane(paneResult.paneId).catch((err) => log("[multiplexer-session-manager] closing stale respawned pane failed", {
|
|
29645
|
+
instanceId: this.instanceId,
|
|
29417
29646
|
sessionId,
|
|
29418
29647
|
paneId: paneResult.paneId,
|
|
29419
29648
|
error: String(err)
|
|
@@ -29431,6 +29660,7 @@ class MultiplexerSessionManager {
|
|
|
29431
29660
|
lastSeenAt: now
|
|
29432
29661
|
});
|
|
29433
29662
|
log("[multiplexer-session-manager] pane respawned on busy", {
|
|
29663
|
+
instanceId: this.instanceId,
|
|
29434
29664
|
sessionId,
|
|
29435
29665
|
paneId: paneResult.paneId
|
|
29436
29666
|
});
|
|
@@ -30109,7 +30339,7 @@ Returns the councillor responses with a summary footer.`,
|
|
|
30109
30339
|
return { council_session };
|
|
30110
30340
|
}
|
|
30111
30341
|
// src/tui-state.ts
|
|
30112
|
-
import * as
|
|
30342
|
+
import * as fs10 from "node:fs";
|
|
30113
30343
|
import * as os5 from "node:os";
|
|
30114
30344
|
import * as path14 from "node:path";
|
|
30115
30345
|
var STATE_DIR = "oh-my-opencode-slim";
|
|
@@ -30139,14 +30369,14 @@ function parseSnapshot(value) {
|
|
|
30139
30369
|
}
|
|
30140
30370
|
function readTuiSnapshot() {
|
|
30141
30371
|
try {
|
|
30142
|
-
return parseSnapshot(
|
|
30372
|
+
return parseSnapshot(fs10.readFileSync(getTuiStatePath(), "utf8"));
|
|
30143
30373
|
} catch {
|
|
30144
30374
|
return emptySnapshot();
|
|
30145
30375
|
}
|
|
30146
30376
|
}
|
|
30147
30377
|
async function readTuiSnapshotAsync() {
|
|
30148
30378
|
try {
|
|
30149
|
-
return parseSnapshot(await
|
|
30379
|
+
return parseSnapshot(await fs10.promises.readFile(getTuiStatePath(), "utf8"));
|
|
30150
30380
|
} catch {
|
|
30151
30381
|
return emptySnapshot();
|
|
30152
30382
|
}
|
|
@@ -30154,8 +30384,8 @@ async function readTuiSnapshotAsync() {
|
|
|
30154
30384
|
function writeTuiSnapshot(snapshot) {
|
|
30155
30385
|
try {
|
|
30156
30386
|
const filePath = getTuiStatePath();
|
|
30157
|
-
|
|
30158
|
-
|
|
30387
|
+
fs10.mkdirSync(path14.dirname(filePath), { recursive: true });
|
|
30388
|
+
fs10.writeFileSync(filePath, `${JSON.stringify(snapshot)}
|
|
30159
30389
|
`);
|
|
30160
30390
|
} catch {}
|
|
30161
30391
|
}
|
|
@@ -30177,11 +30407,11 @@ function recordTuiAgentModel(input) {
|
|
|
30177
30407
|
}
|
|
30178
30408
|
|
|
30179
30409
|
// src/tools/preset-manager.ts
|
|
30180
|
-
var
|
|
30410
|
+
var COMMAND_NAME4 = "preset";
|
|
30181
30411
|
function createPresetManager(ctx, config) {
|
|
30182
30412
|
let activePreset = getActiveRuntimePreset() ?? config.preset ?? null;
|
|
30183
30413
|
async function handleCommandExecuteBefore(input, output) {
|
|
30184
|
-
if (input.command !==
|
|
30414
|
+
if (input.command !== COMMAND_NAME4) {
|
|
30185
30415
|
return;
|
|
30186
30416
|
}
|
|
30187
30417
|
output.parts.length = 0;
|
|
@@ -30200,11 +30430,11 @@ function createPresetManager(ctx, config) {
|
|
|
30200
30430
|
}
|
|
30201
30431
|
function registerCommand(opencodeConfig) {
|
|
30202
30432
|
const configCommand = opencodeConfig.command;
|
|
30203
|
-
if (!configCommand?.[
|
|
30433
|
+
if (!configCommand?.[COMMAND_NAME4]) {
|
|
30204
30434
|
if (!opencodeConfig.command) {
|
|
30205
30435
|
opencodeConfig.command = {};
|
|
30206
30436
|
}
|
|
30207
|
-
opencodeConfig.command[
|
|
30437
|
+
opencodeConfig.command[COMMAND_NAME4] = {
|
|
30208
30438
|
template: "List available presets and switch between them",
|
|
30209
30439
|
description: "Switch agent presets at runtime (e.g., /preset cheap, /preset powerful)"
|
|
30210
30440
|
};
|
|
@@ -30416,21 +30646,21 @@ async function saveBinary(binaryDir, data, contentType, filename) {
|
|
|
30416
30646
|
throw new Error("Unable to allocate unique filename for binary content");
|
|
30417
30647
|
}
|
|
30418
30648
|
|
|
30419
|
-
// node_modules/lru-cache/dist/esm/node/index.min.js
|
|
30420
|
-
import { tracingChannel as
|
|
30421
|
-
var S =
|
|
30422
|
-
var W =
|
|
30649
|
+
// node_modules/.pnpm/lru-cache@11.3.6/node_modules/lru-cache/dist/esm/node/index.min.js
|
|
30650
|
+
import { tracingChannel as I, channel as G } from "node:diagnostics_channel";
|
|
30651
|
+
var S = G("lru-cache:metrics");
|
|
30652
|
+
var W = I("lru-cache");
|
|
30653
|
+
var C = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
|
|
30423
30654
|
var D = () => S.hasSubscribers || W.hasSubscribers;
|
|
30424
|
-
var
|
|
30425
|
-
var
|
|
30426
|
-
var C = typeof process == "object" && process ? process : {};
|
|
30655
|
+
var U = new Set;
|
|
30656
|
+
var L = typeof process == "object" && process ? process : {};
|
|
30427
30657
|
var P = (u, e, t, i) => {
|
|
30428
|
-
typeof
|
|
30658
|
+
typeof L.emitWarning == "function" ? L.emitWarning(u, e, t, i) : console.error(`[${t}] ${e}: ${u}`);
|
|
30429
30659
|
};
|
|
30430
|
-
var H = (u) => !
|
|
30431
|
-
var
|
|
30660
|
+
var H = (u) => !U.has(u);
|
|
30661
|
+
var X = Symbol("type");
|
|
30432
30662
|
var F = (u) => !!u && u === Math.floor(u) && u > 0 && isFinite(u);
|
|
30433
|
-
var
|
|
30663
|
+
var j = (u) => F(u) ? u <= Math.pow(2, 8) ? Uint8Array : u <= Math.pow(2, 16) ? Uint16Array : u <= Math.pow(2, 32) ? Uint32Array : u <= Number.MAX_SAFE_INTEGER ? O : null : null;
|
|
30434
30664
|
var O = class extends Array {
|
|
30435
30665
|
constructor(e) {
|
|
30436
30666
|
super(e), this.fill(0);
|
|
@@ -30441,7 +30671,7 @@ var R = class u {
|
|
|
30441
30671
|
length;
|
|
30442
30672
|
static #o = false;
|
|
30443
30673
|
static create(e) {
|
|
30444
|
-
let t =
|
|
30674
|
+
let t = j(e);
|
|
30445
30675
|
if (!t)
|
|
30446
30676
|
return [];
|
|
30447
30677
|
u.#o = true;
|
|
@@ -30460,11 +30690,11 @@ var R = class u {
|
|
|
30460
30690
|
return this.heap[--this.length];
|
|
30461
30691
|
}
|
|
30462
30692
|
};
|
|
30463
|
-
var
|
|
30693
|
+
var M = class u2 {
|
|
30464
30694
|
#o;
|
|
30465
30695
|
#u;
|
|
30466
30696
|
#w;
|
|
30467
|
-
#
|
|
30697
|
+
#x;
|
|
30468
30698
|
#S;
|
|
30469
30699
|
#M;
|
|
30470
30700
|
#U;
|
|
@@ -30535,7 +30765,7 @@ var L = class u2 {
|
|
|
30535
30765
|
return this.#w;
|
|
30536
30766
|
}
|
|
30537
30767
|
get onInsert() {
|
|
30538
|
-
return this.#
|
|
30768
|
+
return this.#x;
|
|
30539
30769
|
}
|
|
30540
30770
|
get disposeAfter() {
|
|
30541
30771
|
return this.#S;
|
|
@@ -30544,9 +30774,9 @@ var L = class u2 {
|
|
|
30544
30774
|
let { max: t = 0, ttl: i, ttlResolution: s = 1, ttlAutopurge: n, updateAgeOnGet: o, updateAgeOnHas: r, allowStale: h, dispose: l, onInsert: c, disposeAfter: f, noDisposeOnSet: g, noUpdateTTL: p, maxSize: T = 0, maxEntrySize: w = 0, sizeCalculation: y, fetchMethod: a, memoMethod: m, noDeleteOnFetchRejection: _, noDeleteOnStaleGet: b, allowStaleOnFetchRejection: d, allowStaleOnFetchAbort: A, ignoreFetchAbort: z5, perf: x } = e;
|
|
30545
30775
|
if (x !== undefined && typeof x?.now != "function")
|
|
30546
30776
|
throw new TypeError("perf option must have a now() method if specified");
|
|
30547
|
-
if (this.#m = x ??
|
|
30777
|
+
if (this.#m = x ?? C, t !== 0 && !F(t))
|
|
30548
30778
|
throw new TypeError("max option must be a nonnegative integer");
|
|
30549
|
-
let v = t ?
|
|
30779
|
+
let v = t ? j(t) : Array;
|
|
30550
30780
|
if (!v)
|
|
30551
30781
|
throw new Error("invalid max value: " + t);
|
|
30552
30782
|
if (this.#o = t, this.#u = T, this.maxEntrySize = w || this.#u, this.sizeCalculation = y, this.sizeCalculation) {
|
|
@@ -30559,7 +30789,7 @@ var L = class u2 {
|
|
|
30559
30789
|
throw new TypeError("memoMethod must be a function if defined");
|
|
30560
30790
|
if (this.#U = m, a !== undefined && typeof a != "function")
|
|
30561
30791
|
throw new TypeError("fetchMethod must be a function if specified");
|
|
30562
|
-
if (this.#M = a, this.#W = !!a, this.#s = new Map, this.#i = Array.from({ length: t }).fill(undefined), this.#t = Array.from({ length: t }).fill(undefined), this.#a = new v(t), this.#c = new v(t), this.#l = 0, this.#h = 0, this.#y = R.create(t), this.#n = 0, this.#b = 0, typeof l == "function" && (this.#w = l), typeof c == "function" && (this.#
|
|
30792
|
+
if (this.#M = a, this.#W = !!a, this.#s = new Map, this.#i = Array.from({ length: t }).fill(undefined), this.#t = Array.from({ length: t }).fill(undefined), this.#a = new v(t), this.#c = new v(t), this.#l = 0, this.#h = 0, this.#y = R.create(t), this.#n = 0, this.#b = 0, typeof l == "function" && (this.#w = l), typeof c == "function" && (this.#x = c), typeof f == "function" ? (this.#S = f, this.#r = []) : (this.#S = undefined, this.#r = undefined), this.#T = !!this.#w, this.#j = !!this.#x, this.#f = !!this.#S, this.noDisposeOnSet = !!g, this.noUpdateTTL = !!p, this.noDeleteOnFetchRejection = !!_, this.allowStaleOnFetchRejection = !!d, this.allowStaleOnFetchAbort = !!A, this.ignoreFetchAbort = !!z5, this.maxEntrySize !== 0) {
|
|
30563
30793
|
if (this.#u !== 0 && !F(this.#u))
|
|
30564
30794
|
throw new TypeError("maxSize must be a positive integer if specified");
|
|
30565
30795
|
if (!F(this.maxEntrySize))
|
|
@@ -30575,7 +30805,7 @@ var L = class u2 {
|
|
|
30575
30805
|
throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
30576
30806
|
if (!this.ttlAutopurge && !this.#o && !this.#u) {
|
|
30577
30807
|
let E = "LRU_CACHE_UNBOUNDED";
|
|
30578
|
-
H(E) && (
|
|
30808
|
+
H(E) && (U.add(E), P("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", E, u2));
|
|
30579
30809
|
}
|
|
30580
30810
|
}
|
|
30581
30811
|
getRemainingTTL(e) {
|
|
@@ -30587,7 +30817,7 @@ var L = class u2 {
|
|
|
30587
30817
|
let i = this.ttlAutopurge ? Array.from({ length: this.#o }) : undefined;
|
|
30588
30818
|
this.#g = i, this.#N = (r, h, l = this.#m.now()) => {
|
|
30589
30819
|
t[r] = h !== 0 ? l : 0, e[r] = h, s(r, h);
|
|
30590
|
-
}, this.#
|
|
30820
|
+
}, this.#D = (r) => {
|
|
30591
30821
|
t[r] = e[r] !== 0 ? this.#m.now() : 0, s(r, e[r]);
|
|
30592
30822
|
};
|
|
30593
30823
|
let s = this.ttlAutopurge ? (r, h) => {
|
|
@@ -30631,7 +30861,7 @@ var L = class u2 {
|
|
|
30631
30861
|
return !!l && !!h && (n || o()) - h > l;
|
|
30632
30862
|
};
|
|
30633
30863
|
}
|
|
30634
|
-
#
|
|
30864
|
+
#D = () => {};
|
|
30635
30865
|
#E = () => {};
|
|
30636
30866
|
#N = () => {};
|
|
30637
30867
|
#p = () => false;
|
|
@@ -30797,7 +31027,7 @@ var L = class u2 {
|
|
|
30797
31027
|
return this.#v(e, "set"), h && (h.set = "miss", h.maxEntrySizeExceeded = true), this;
|
|
30798
31028
|
let f = this.#n === 0 ? undefined : this.#s.get(e);
|
|
30799
31029
|
if (f === undefined)
|
|
30800
|
-
f = this.#n === 0 ? this.#h : this.#y.length !== 0 ? this.#y.pop() : this.#n === this.#o ? this.#G(false) : this.#n, this.#i[f] = e, this.#t[f] = t, this.#s.set(e, f), this.#a[this.#h] = f, this.#c[f] = this.#h, this.#h = f, this.#n++, this.#I(f, c, h), h && (h.set = "add"), l = false, this.#j && this.#
|
|
31030
|
+
f = this.#n === 0 ? this.#h : this.#y.length !== 0 ? this.#y.pop() : this.#n === this.#o ? this.#G(false) : this.#n, this.#i[f] = e, this.#t[f] = t, this.#s.set(e, f), this.#a[this.#h] = f, this.#c[f] = this.#h, this.#h = f, this.#n++, this.#I(f, c, h), h && (h.set = "add"), l = false, this.#j && this.#x?.(t, e, "add");
|
|
30801
31031
|
else {
|
|
30802
31032
|
this.#L(f);
|
|
30803
31033
|
let g = this.#t[f];
|
|
@@ -30861,7 +31091,7 @@ var L = class u2 {
|
|
|
30861
31091
|
if (this.#p(n))
|
|
30862
31092
|
s && (s.has = "stale", this.#E(s, n));
|
|
30863
31093
|
else
|
|
30864
|
-
return i && this.#
|
|
31094
|
+
return i && this.#D(n), s && (s.has = "hit", this.#E(s, n)), true;
|
|
30865
31095
|
} else
|
|
30866
31096
|
s && (s.has = "miss");
|
|
30867
31097
|
return false;
|
|
@@ -30919,7 +31149,7 @@ var L = class u2 {
|
|
|
30919
31149
|
let i = W.hasSubscribers, { status: s = D() ? {} : undefined } = t;
|
|
30920
31150
|
t.status = s, s && t.context && (s.context = t.context);
|
|
30921
31151
|
let n = this.#B(e, t);
|
|
30922
|
-
return s &&
|
|
31152
|
+
return s && i && (s.trace = true, W.tracePromise(() => n, s).catch(() => {})), n;
|
|
30923
31153
|
}
|
|
30924
31154
|
async#B(e, t = {}) {
|
|
30925
31155
|
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: r = this.noDisposeOnSet, size: h = 0, sizeCalculation: l = this.sizeCalculation, noUpdateTTL: c = this.noUpdateTTL, noDeleteOnFetchRejection: f = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: g = this.allowStaleOnFetchRejection, ignoreFetchAbort: p = this.ignoreFetchAbort, allowStaleOnFetchAbort: T = this.allowStaleOnFetchAbort, context: w, forceRefresh: y = false, status: a, signal: m } = t;
|
|
@@ -30938,7 +31168,7 @@ var L = class u2 {
|
|
|
30938
31168
|
}
|
|
30939
31169
|
let A = this.#p(b);
|
|
30940
31170
|
if (!y && !A)
|
|
30941
|
-
return a && (a.fetch = "hit"), this.#L(b), s && this.#
|
|
31171
|
+
return a && (a.fetch = "hit"), this.#L(b), s && this.#D(b), a && this.#E(a, b), d;
|
|
30942
31172
|
let z5 = this.#P(e, b, _, w), v = z5.__staleWhileFetching !== undefined && i;
|
|
30943
31173
|
return a && (a.fetch = A ? "stale" : "refresh", v && A && (a.returnedStale = true)), v ? z5.__staleWhileFetching : z5.__returned = z5;
|
|
30944
31174
|
}
|
|
@@ -30947,7 +31177,7 @@ var L = class u2 {
|
|
|
30947
31177
|
let i = W.hasSubscribers, { status: s = D() ? {} : undefined } = t;
|
|
30948
31178
|
t.status = s, s && t.context && (s.context = t.context);
|
|
30949
31179
|
let n = this.#K(e, t);
|
|
30950
|
-
return s &&
|
|
31180
|
+
return s && i && (s.trace = true, W.tracePromise(() => n, s).catch(() => {})), n;
|
|
30951
31181
|
}
|
|
30952
31182
|
async#K(e, t = {}) {
|
|
30953
31183
|
let i = await this.#B(e, t);
|
|
@@ -30986,7 +31216,7 @@ var L = class u2 {
|
|
|
30986
31216
|
return;
|
|
30987
31217
|
}
|
|
30988
31218
|
let h = this.#t[r], l = this.#e(h);
|
|
30989
|
-
return o && this.#E(o, r), this.#p(r) ? l ? (o && (o.get = "stale-fetching"), i && h.__staleWhileFetching !== undefined ? (o && (o.returnedStale = true), h.__staleWhileFetching) : undefined) : (n || this.#v(e, "expire"), o && (o.get = "stale"), i ? (o && (o.returnedStale = true), h) : undefined) : (o && (o.get = l ? "fetching" : "hit"), this.#L(r), s && this.#
|
|
31219
|
+
return o && this.#E(o, r), this.#p(r) ? l ? (o && (o.get = "stale-fetching"), i && h.__staleWhileFetching !== undefined ? (o && (o.returnedStale = true), h.__staleWhileFetching) : undefined) : (n || this.#v(e, "expire"), o && (o.get = "stale"), i ? (o && (o.returnedStale = true), h) : undefined) : (o && (o.get = l ? "fetching" : "hit"), this.#L(r), s && this.#D(r), l ? h.__staleWhileFetching : h);
|
|
30990
31220
|
}
|
|
30991
31221
|
#$(e, t) {
|
|
30992
31222
|
this.#c[t] = e, this.#a[e] = t;
|
|
@@ -31154,7 +31384,7 @@ function extractStructuredText(root) {
|
|
|
31154
31384
|
]);
|
|
31155
31385
|
const isText = (node) => node.nodeType === node.TEXT_NODE;
|
|
31156
31386
|
const isElement = (node) => node.nodeType === node.ELEMENT_NODE;
|
|
31157
|
-
const
|
|
31387
|
+
const pushText2 = (value) => {
|
|
31158
31388
|
const normalized = value.replace(/\s+/g, " ");
|
|
31159
31389
|
if (!normalized.trim())
|
|
31160
31390
|
return;
|
|
@@ -31180,7 +31410,7 @@ function extractStructuredText(root) {
|
|
|
31180
31410
|
};
|
|
31181
31411
|
const visit = (node) => {
|
|
31182
31412
|
if (isText(node)) {
|
|
31183
|
-
|
|
31413
|
+
pushText2(node.textContent || "");
|
|
31184
31414
|
return;
|
|
31185
31415
|
}
|
|
31186
31416
|
if (!isElement(node))
|
|
@@ -31891,7 +32121,7 @@ async function probeLlmsText(url, timeoutMs, signal, fallbackOrigin) {
|
|
|
31891
32121
|
}
|
|
31892
32122
|
|
|
31893
32123
|
// src/tools/smartfetch/cache.ts
|
|
31894
|
-
var CACHE = new
|
|
32124
|
+
var CACHE = new M({
|
|
31895
32125
|
maxSize: 50 * 1024 * 1024,
|
|
31896
32126
|
ttl: 15 * 60 * 1000,
|
|
31897
32127
|
sizeCalculation: (value) => {
|
|
@@ -31952,7 +32182,7 @@ function isInvalidLlmsResult(fetchResult) {
|
|
|
31952
32182
|
|
|
31953
32183
|
// src/tools/smartfetch/secondary-model.ts
|
|
31954
32184
|
import { existsSync as existsSync10 } from "node:fs";
|
|
31955
|
-
import { readFile as
|
|
32185
|
+
import { readFile as readFile5 } from "node:fs/promises";
|
|
31956
32186
|
import path17 from "node:path";
|
|
31957
32187
|
function parseModelRef(value) {
|
|
31958
32188
|
if (!value)
|
|
@@ -31989,7 +32219,7 @@ async function readOpenCodeConfigFile(configPath) {
|
|
|
31989
32219
|
if (!configPath)
|
|
31990
32220
|
return;
|
|
31991
32221
|
try {
|
|
31992
|
-
const content = await
|
|
32222
|
+
const content = await readFile5(configPath, "utf8");
|
|
31993
32223
|
return JSON.parse(stripJsonComments(content));
|
|
31994
32224
|
} catch {
|
|
31995
32225
|
return;
|
|
@@ -32639,7 +32869,7 @@ function createWebfetchTool(pluginCtx, options = {}) {
|
|
|
32639
32869
|
});
|
|
32640
32870
|
}
|
|
32641
32871
|
// src/tools/subtask/command.ts
|
|
32642
|
-
var
|
|
32872
|
+
var COMMAND_NAME5 = "subtask";
|
|
32643
32873
|
var SUBTASK_COMMAND_TEMPLATE = `Start a focused subtask worker.
|
|
32644
32874
|
|
|
32645
32875
|
The user's request below is the full scope for the worker. Do not broaden it.
|
|
@@ -32660,11 +32890,11 @@ Only include files that are clearly relevant. If no files are needed, omit files
|
|
|
32660
32890
|
function createSubtaskCommandManager(_ctx, state) {
|
|
32661
32891
|
function registerCommand(opencodeConfig) {
|
|
32662
32892
|
const configCommand = opencodeConfig.command;
|
|
32663
|
-
if (!configCommand?.[
|
|
32893
|
+
if (!configCommand?.[COMMAND_NAME5]) {
|
|
32664
32894
|
if (!opencodeConfig.command) {
|
|
32665
32895
|
opencodeConfig.command = {};
|
|
32666
32896
|
}
|
|
32667
|
-
opencodeConfig.command[
|
|
32897
|
+
opencodeConfig.command[COMMAND_NAME5] = {
|
|
32668
32898
|
description: "Create a focused subtask prompt for a new session",
|
|
32669
32899
|
template: SUBTASK_COMMAND_TEMPLATE
|
|
32670
32900
|
};
|
|
@@ -32691,11 +32921,11 @@ function createSubtaskCommandManager(_ctx, state) {
|
|
|
32691
32921
|
};
|
|
32692
32922
|
}
|
|
32693
32923
|
// src/tools/subtask/files.ts
|
|
32694
|
-
import * as
|
|
32924
|
+
import * as fs12 from "node:fs/promises";
|
|
32695
32925
|
import * as path20 from "node:path";
|
|
32696
32926
|
|
|
32697
32927
|
// src/tools/subtask/vendor.ts
|
|
32698
|
-
import * as
|
|
32928
|
+
import * as fs11 from "node:fs/promises";
|
|
32699
32929
|
import * as path19 from "node:path";
|
|
32700
32930
|
var DEFAULT_READ_LIMIT = 2000;
|
|
32701
32931
|
var MAX_LINE_LENGTH = 2000;
|
|
@@ -32739,7 +32969,7 @@ async function isBinaryFile(filepath) {
|
|
|
32739
32969
|
return true;
|
|
32740
32970
|
}
|
|
32741
32971
|
try {
|
|
32742
|
-
const file = await
|
|
32972
|
+
const file = await fs11.open(filepath, "r");
|
|
32743
32973
|
try {
|
|
32744
32974
|
const buffer = Buffer.alloc(SAMPLE_BYTES);
|
|
32745
32975
|
const result = await file.read(buffer, 0, SAMPLE_BYTES, 0);
|
|
@@ -32825,24 +33055,24 @@ function parseFileReferences(text) {
|
|
|
32825
33055
|
}
|
|
32826
33056
|
async function buildSyntheticFileParts(directory, refs) {
|
|
32827
33057
|
const parts = [];
|
|
32828
|
-
const realDirectory = await
|
|
33058
|
+
const realDirectory = await fs12.realpath(directory);
|
|
32829
33059
|
for (const ref of refs) {
|
|
32830
33060
|
const filepath = path20.resolve(directory, ref);
|
|
32831
33061
|
const relative3 = path20.relative(directory, filepath);
|
|
32832
33062
|
if (relative3.startsWith("..") || path20.isAbsolute(relative3))
|
|
32833
33063
|
continue;
|
|
32834
33064
|
try {
|
|
32835
|
-
const realFilepath = await
|
|
33065
|
+
const realFilepath = await fs12.realpath(filepath);
|
|
32836
33066
|
const realRelative = path20.relative(realDirectory, realFilepath);
|
|
32837
33067
|
if (realRelative.startsWith("..") || path20.isAbsolute(realRelative)) {
|
|
32838
33068
|
continue;
|
|
32839
33069
|
}
|
|
32840
|
-
const stats = await
|
|
33070
|
+
const stats = await fs12.stat(realFilepath);
|
|
32841
33071
|
if (!stats.isFile())
|
|
32842
33072
|
continue;
|
|
32843
33073
|
if (await isBinaryFile(realFilepath))
|
|
32844
33074
|
continue;
|
|
32845
|
-
const content = await
|
|
33075
|
+
const content = await fs12.readFile(realFilepath, "utf-8");
|
|
32846
33076
|
parts.push({
|
|
32847
33077
|
type: "text",
|
|
32848
33078
|
synthetic: true,
|
|
@@ -33204,6 +33434,7 @@ var OhMyOpenCodeLite = async (ctx) => {
|
|
|
33204
33434
|
let jsonErrorRecoveryHook;
|
|
33205
33435
|
let foregroundFallback;
|
|
33206
33436
|
let todoContinuationHook;
|
|
33437
|
+
let sessionGoalHook;
|
|
33207
33438
|
let taskSessionManagerHook;
|
|
33208
33439
|
let interviewManager;
|
|
33209
33440
|
let presetManager;
|
|
@@ -33296,6 +33527,9 @@ var OhMyOpenCodeLite = async (ctx) => {
|
|
|
33296
33527
|
autoEnable: config.todoContinuation?.autoEnable ?? false,
|
|
33297
33528
|
autoEnableThreshold: config.todoContinuation?.autoEnableThreshold ?? 4
|
|
33298
33529
|
});
|
|
33530
|
+
sessionGoalHook = createSessionGoalHook(ctx, config, {
|
|
33531
|
+
getAgentName: (sessionID) => sessionAgentMap.get(sessionID)
|
|
33532
|
+
});
|
|
33299
33533
|
taskSessionManagerHook = createTaskSessionManagerHook(ctx, {
|
|
33300
33534
|
maxSessionsPerAgent: config.sessionManager?.maxSessionsPerAgent ?? 2,
|
|
33301
33535
|
readContextMinLines: config.sessionManager?.readContextMinLines ?? 10,
|
|
@@ -33550,6 +33784,7 @@ var OhMyOpenCodeLite = async (ctx) => {
|
|
|
33550
33784
|
};
|
|
33551
33785
|
}
|
|
33552
33786
|
interviewManager.registerCommand(opencodeConfig);
|
|
33787
|
+
sessionGoalHook.registerCommand(opencodeConfig);
|
|
33553
33788
|
presetManager.registerCommand(opencodeConfig);
|
|
33554
33789
|
subtaskCommandManager.registerCommand(opencodeConfig);
|
|
33555
33790
|
},
|
|
@@ -33571,12 +33806,13 @@ var OhMyOpenCodeLite = async (ctx) => {
|
|
|
33571
33806
|
depthTracker.registerChild(parentSessionId, childSessionId);
|
|
33572
33807
|
}
|
|
33573
33808
|
}
|
|
33574
|
-
await foregroundFallback.handleEvent(input.event);
|
|
33575
|
-
await todoContinuationHook.handleEvent(input);
|
|
33576
|
-
await autoUpdateChecker.event(input);
|
|
33577
33809
|
await multiplexerSessionManager.onSessionCreated(event);
|
|
33578
33810
|
await multiplexerSessionManager.onSessionStatus(event);
|
|
33579
33811
|
await multiplexerSessionManager.onSessionDeleted(event);
|
|
33812
|
+
await foregroundFallback.handleEvent(input.event);
|
|
33813
|
+
await todoContinuationHook.handleEvent(input);
|
|
33814
|
+
sessionGoalHook.handleEvent(input);
|
|
33815
|
+
await autoUpdateChecker.event(input);
|
|
33580
33816
|
await interviewManager.handleEvent(input);
|
|
33581
33817
|
await taskSessionManagerHook.event(input);
|
|
33582
33818
|
subtaskCommandManager.handleEvent(input);
|
|
@@ -33637,6 +33873,7 @@ var OhMyOpenCodeLite = async (ctx) => {
|
|
|
33637
33873
|
await todoContinuationHook.handleCommandExecuteBefore(input, output);
|
|
33638
33874
|
await interviewManager.handleCommandExecuteBefore(input, output);
|
|
33639
33875
|
await presetManager.handleCommandExecuteBefore(input, output);
|
|
33876
|
+
await sessionGoalHook.handleCommandExecuteBefore(input, output);
|
|
33640
33877
|
},
|
|
33641
33878
|
"chat.headers": chatHeadersHook["chat.headers"],
|
|
33642
33879
|
"chat.message": async (input, output) => {
|
|
@@ -33665,6 +33902,7 @@ var OhMyOpenCodeLite = async (ctx) => {
|
|
|
33665
33902
|
${output.system[0]}` : "");
|
|
33666
33903
|
}
|
|
33667
33904
|
}
|
|
33905
|
+
sessionGoalHook.handleSystemTransform(input, output);
|
|
33668
33906
|
collapseSystemInPlace(output.system);
|
|
33669
33907
|
},
|
|
33670
33908
|
"experimental.chat.messages.transform": async (input, output) => {
|