@defend-tech/opencode-optima 0.1.68 → 0.1.69
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/dist/index.js +261 -258
- package/dist/sanitize_cli.js +284 -281
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -108,17 +108,17 @@ var require_visit = __commonJS({
|
|
|
108
108
|
visit.BREAK = BREAK;
|
|
109
109
|
visit.SKIP = SKIP;
|
|
110
110
|
visit.REMOVE = REMOVE;
|
|
111
|
-
function visit_(key, node, visitor,
|
|
112
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
111
|
+
function visit_(key, node, visitor, path7) {
|
|
112
|
+
const ctrl = callVisitor(key, node, visitor, path7);
|
|
113
113
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
114
|
-
replaceNode(key,
|
|
115
|
-
return visit_(key, ctrl, visitor,
|
|
114
|
+
replaceNode(key, path7, ctrl);
|
|
115
|
+
return visit_(key, ctrl, visitor, path7);
|
|
116
116
|
}
|
|
117
117
|
if (typeof ctrl !== "symbol") {
|
|
118
118
|
if (identity.isCollection(node)) {
|
|
119
|
-
|
|
119
|
+
path7 = Object.freeze(path7.concat(node));
|
|
120
120
|
for (let i = 0; i < node.items.length; ++i) {
|
|
121
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
121
|
+
const ci = visit_(i, node.items[i], visitor, path7);
|
|
122
122
|
if (typeof ci === "number")
|
|
123
123
|
i = ci - 1;
|
|
124
124
|
else if (ci === BREAK)
|
|
@@ -129,13 +129,13 @@ var require_visit = __commonJS({
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
} else if (identity.isPair(node)) {
|
|
132
|
-
|
|
133
|
-
const ck = visit_("key", node.key, visitor,
|
|
132
|
+
path7 = Object.freeze(path7.concat(node));
|
|
133
|
+
const ck = visit_("key", node.key, visitor, path7);
|
|
134
134
|
if (ck === BREAK)
|
|
135
135
|
return BREAK;
|
|
136
136
|
else if (ck === REMOVE)
|
|
137
137
|
node.key = null;
|
|
138
|
-
const cv = visit_("value", node.value, visitor,
|
|
138
|
+
const cv = visit_("value", node.value, visitor, path7);
|
|
139
139
|
if (cv === BREAK)
|
|
140
140
|
return BREAK;
|
|
141
141
|
else if (cv === REMOVE)
|
|
@@ -156,17 +156,17 @@ var require_visit = __commonJS({
|
|
|
156
156
|
visitAsync.BREAK = BREAK;
|
|
157
157
|
visitAsync.SKIP = SKIP;
|
|
158
158
|
visitAsync.REMOVE = REMOVE;
|
|
159
|
-
async function visitAsync_(key, node, visitor,
|
|
160
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
159
|
+
async function visitAsync_(key, node, visitor, path7) {
|
|
160
|
+
const ctrl = await callVisitor(key, node, visitor, path7);
|
|
161
161
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
162
|
-
replaceNode(key,
|
|
163
|
-
return visitAsync_(key, ctrl, visitor,
|
|
162
|
+
replaceNode(key, path7, ctrl);
|
|
163
|
+
return visitAsync_(key, ctrl, visitor, path7);
|
|
164
164
|
}
|
|
165
165
|
if (typeof ctrl !== "symbol") {
|
|
166
166
|
if (identity.isCollection(node)) {
|
|
167
|
-
|
|
167
|
+
path7 = Object.freeze(path7.concat(node));
|
|
168
168
|
for (let i = 0; i < node.items.length; ++i) {
|
|
169
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
169
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path7);
|
|
170
170
|
if (typeof ci === "number")
|
|
171
171
|
i = ci - 1;
|
|
172
172
|
else if (ci === BREAK)
|
|
@@ -177,13 +177,13 @@ var require_visit = __commonJS({
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
} else if (identity.isPair(node)) {
|
|
180
|
-
|
|
181
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
180
|
+
path7 = Object.freeze(path7.concat(node));
|
|
181
|
+
const ck = await visitAsync_("key", node.key, visitor, path7);
|
|
182
182
|
if (ck === BREAK)
|
|
183
183
|
return BREAK;
|
|
184
184
|
else if (ck === REMOVE)
|
|
185
185
|
node.key = null;
|
|
186
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
186
|
+
const cv = await visitAsync_("value", node.value, visitor, path7);
|
|
187
187
|
if (cv === BREAK)
|
|
188
188
|
return BREAK;
|
|
189
189
|
else if (cv === REMOVE)
|
|
@@ -210,23 +210,23 @@ var require_visit = __commonJS({
|
|
|
210
210
|
}
|
|
211
211
|
return visitor;
|
|
212
212
|
}
|
|
213
|
-
function callVisitor(key, node, visitor,
|
|
213
|
+
function callVisitor(key, node, visitor, path7) {
|
|
214
214
|
if (typeof visitor === "function")
|
|
215
|
-
return visitor(key, node,
|
|
215
|
+
return visitor(key, node, path7);
|
|
216
216
|
if (identity.isMap(node))
|
|
217
|
-
return visitor.Map?.(key, node,
|
|
217
|
+
return visitor.Map?.(key, node, path7);
|
|
218
218
|
if (identity.isSeq(node))
|
|
219
|
-
return visitor.Seq?.(key, node,
|
|
219
|
+
return visitor.Seq?.(key, node, path7);
|
|
220
220
|
if (identity.isPair(node))
|
|
221
|
-
return visitor.Pair?.(key, node,
|
|
221
|
+
return visitor.Pair?.(key, node, path7);
|
|
222
222
|
if (identity.isScalar(node))
|
|
223
|
-
return visitor.Scalar?.(key, node,
|
|
223
|
+
return visitor.Scalar?.(key, node, path7);
|
|
224
224
|
if (identity.isAlias(node))
|
|
225
|
-
return visitor.Alias?.(key, node,
|
|
225
|
+
return visitor.Alias?.(key, node, path7);
|
|
226
226
|
return void 0;
|
|
227
227
|
}
|
|
228
|
-
function replaceNode(key,
|
|
229
|
-
const parent =
|
|
228
|
+
function replaceNode(key, path7, node) {
|
|
229
|
+
const parent = path7[path7.length - 1];
|
|
230
230
|
if (identity.isCollection(parent)) {
|
|
231
231
|
parent.items[key] = node;
|
|
232
232
|
} else if (identity.isPair(parent)) {
|
|
@@ -834,10 +834,10 @@ var require_Collection = __commonJS({
|
|
|
834
834
|
var createNode = require_createNode();
|
|
835
835
|
var identity = require_identity();
|
|
836
836
|
var Node = require_Node();
|
|
837
|
-
function collectionFromPath(schema,
|
|
837
|
+
function collectionFromPath(schema, path7, value) {
|
|
838
838
|
let v = value;
|
|
839
|
-
for (let i =
|
|
840
|
-
const k =
|
|
839
|
+
for (let i = path7.length - 1; i >= 0; --i) {
|
|
840
|
+
const k = path7[i];
|
|
841
841
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
842
842
|
const a = [];
|
|
843
843
|
a[k] = v;
|
|
@@ -856,7 +856,7 @@ var require_Collection = __commonJS({
|
|
|
856
856
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
857
857
|
});
|
|
858
858
|
}
|
|
859
|
-
var isEmptyPath = (
|
|
859
|
+
var isEmptyPath = (path7) => path7 == null || typeof path7 === "object" && !!path7[Symbol.iterator]().next().done;
|
|
860
860
|
var Collection = class extends Node.NodeBase {
|
|
861
861
|
constructor(type, schema) {
|
|
862
862
|
super(type);
|
|
@@ -886,11 +886,11 @@ var require_Collection = __commonJS({
|
|
|
886
886
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
887
887
|
* that already exists in the map.
|
|
888
888
|
*/
|
|
889
|
-
addIn(
|
|
890
|
-
if (isEmptyPath(
|
|
889
|
+
addIn(path7, value) {
|
|
890
|
+
if (isEmptyPath(path7))
|
|
891
891
|
this.add(value);
|
|
892
892
|
else {
|
|
893
|
-
const [key, ...rest] =
|
|
893
|
+
const [key, ...rest] = path7;
|
|
894
894
|
const node = this.get(key, true);
|
|
895
895
|
if (identity.isCollection(node))
|
|
896
896
|
node.addIn(rest, value);
|
|
@@ -904,8 +904,8 @@ var require_Collection = __commonJS({
|
|
|
904
904
|
* Removes a value from the collection.
|
|
905
905
|
* @returns `true` if the item was found and removed.
|
|
906
906
|
*/
|
|
907
|
-
deleteIn(
|
|
908
|
-
const [key, ...rest] =
|
|
907
|
+
deleteIn(path7) {
|
|
908
|
+
const [key, ...rest] = path7;
|
|
909
909
|
if (rest.length === 0)
|
|
910
910
|
return this.delete(key);
|
|
911
911
|
const node = this.get(key, true);
|
|
@@ -919,8 +919,8 @@ var require_Collection = __commonJS({
|
|
|
919
919
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
920
920
|
* `true` (collections are always returned intact).
|
|
921
921
|
*/
|
|
922
|
-
getIn(
|
|
923
|
-
const [key, ...rest] =
|
|
922
|
+
getIn(path7, keepScalar) {
|
|
923
|
+
const [key, ...rest] = path7;
|
|
924
924
|
const node = this.get(key, true);
|
|
925
925
|
if (rest.length === 0)
|
|
926
926
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -938,8 +938,8 @@ var require_Collection = __commonJS({
|
|
|
938
938
|
/**
|
|
939
939
|
* Checks if the collection includes a value with the key `key`.
|
|
940
940
|
*/
|
|
941
|
-
hasIn(
|
|
942
|
-
const [key, ...rest] =
|
|
941
|
+
hasIn(path7) {
|
|
942
|
+
const [key, ...rest] = path7;
|
|
943
943
|
if (rest.length === 0)
|
|
944
944
|
return this.has(key);
|
|
945
945
|
const node = this.get(key, true);
|
|
@@ -949,8 +949,8 @@ var require_Collection = __commonJS({
|
|
|
949
949
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
950
950
|
* boolean to add/remove the item from the set.
|
|
951
951
|
*/
|
|
952
|
-
setIn(
|
|
953
|
-
const [key, ...rest] =
|
|
952
|
+
setIn(path7, value) {
|
|
953
|
+
const [key, ...rest] = path7;
|
|
954
954
|
if (rest.length === 0) {
|
|
955
955
|
this.set(key, value);
|
|
956
956
|
} else {
|
|
@@ -3454,9 +3454,9 @@ var require_Document = __commonJS({
|
|
|
3454
3454
|
this.contents.add(value);
|
|
3455
3455
|
}
|
|
3456
3456
|
/** Adds a value to the document. */
|
|
3457
|
-
addIn(
|
|
3457
|
+
addIn(path7, value) {
|
|
3458
3458
|
if (assertCollection(this.contents))
|
|
3459
|
-
this.contents.addIn(
|
|
3459
|
+
this.contents.addIn(path7, value);
|
|
3460
3460
|
}
|
|
3461
3461
|
/**
|
|
3462
3462
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3531,14 +3531,14 @@ var require_Document = __commonJS({
|
|
|
3531
3531
|
* Removes a value from the document.
|
|
3532
3532
|
* @returns `true` if the item was found and removed.
|
|
3533
3533
|
*/
|
|
3534
|
-
deleteIn(
|
|
3535
|
-
if (Collection.isEmptyPath(
|
|
3534
|
+
deleteIn(path7) {
|
|
3535
|
+
if (Collection.isEmptyPath(path7)) {
|
|
3536
3536
|
if (this.contents == null)
|
|
3537
3537
|
return false;
|
|
3538
3538
|
this.contents = null;
|
|
3539
3539
|
return true;
|
|
3540
3540
|
}
|
|
3541
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3541
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path7) : false;
|
|
3542
3542
|
}
|
|
3543
3543
|
/**
|
|
3544
3544
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3553,10 +3553,10 @@ var require_Document = __commonJS({
|
|
|
3553
3553
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3554
3554
|
* `true` (collections are always returned intact).
|
|
3555
3555
|
*/
|
|
3556
|
-
getIn(
|
|
3557
|
-
if (Collection.isEmptyPath(
|
|
3556
|
+
getIn(path7, keepScalar) {
|
|
3557
|
+
if (Collection.isEmptyPath(path7))
|
|
3558
3558
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3559
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
3559
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path7, keepScalar) : void 0;
|
|
3560
3560
|
}
|
|
3561
3561
|
/**
|
|
3562
3562
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3567,10 +3567,10 @@ var require_Document = __commonJS({
|
|
|
3567
3567
|
/**
|
|
3568
3568
|
* Checks if the document includes a value at `path`.
|
|
3569
3569
|
*/
|
|
3570
|
-
hasIn(
|
|
3571
|
-
if (Collection.isEmptyPath(
|
|
3570
|
+
hasIn(path7) {
|
|
3571
|
+
if (Collection.isEmptyPath(path7))
|
|
3572
3572
|
return this.contents !== void 0;
|
|
3573
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
3573
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path7) : false;
|
|
3574
3574
|
}
|
|
3575
3575
|
/**
|
|
3576
3576
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3587,13 +3587,13 @@ var require_Document = __commonJS({
|
|
|
3587
3587
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3588
3588
|
* boolean to add/remove the item from the set.
|
|
3589
3589
|
*/
|
|
3590
|
-
setIn(
|
|
3591
|
-
if (Collection.isEmptyPath(
|
|
3590
|
+
setIn(path7, value) {
|
|
3591
|
+
if (Collection.isEmptyPath(path7)) {
|
|
3592
3592
|
this.contents = value;
|
|
3593
3593
|
} else if (this.contents == null) {
|
|
3594
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
3594
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path7), value);
|
|
3595
3595
|
} else if (assertCollection(this.contents)) {
|
|
3596
|
-
this.contents.setIn(
|
|
3596
|
+
this.contents.setIn(path7, value);
|
|
3597
3597
|
}
|
|
3598
3598
|
}
|
|
3599
3599
|
/**
|
|
@@ -5545,9 +5545,9 @@ var require_cst_visit = __commonJS({
|
|
|
5545
5545
|
visit.BREAK = BREAK;
|
|
5546
5546
|
visit.SKIP = SKIP;
|
|
5547
5547
|
visit.REMOVE = REMOVE;
|
|
5548
|
-
visit.itemAtPath = (cst,
|
|
5548
|
+
visit.itemAtPath = (cst, path7) => {
|
|
5549
5549
|
let item = cst;
|
|
5550
|
-
for (const [field, index] of
|
|
5550
|
+
for (const [field, index] of path7) {
|
|
5551
5551
|
const tok = item?.[field];
|
|
5552
5552
|
if (tok && "items" in tok) {
|
|
5553
5553
|
item = tok.items[index];
|
|
@@ -5556,23 +5556,23 @@ var require_cst_visit = __commonJS({
|
|
|
5556
5556
|
}
|
|
5557
5557
|
return item;
|
|
5558
5558
|
};
|
|
5559
|
-
visit.parentCollection = (cst,
|
|
5560
|
-
const parent = visit.itemAtPath(cst,
|
|
5561
|
-
const field =
|
|
5559
|
+
visit.parentCollection = (cst, path7) => {
|
|
5560
|
+
const parent = visit.itemAtPath(cst, path7.slice(0, -1));
|
|
5561
|
+
const field = path7[path7.length - 1][0];
|
|
5562
5562
|
const coll = parent?.[field];
|
|
5563
5563
|
if (coll && "items" in coll)
|
|
5564
5564
|
return coll;
|
|
5565
5565
|
throw new Error("Parent collection not found");
|
|
5566
5566
|
};
|
|
5567
|
-
function _visit(
|
|
5568
|
-
let ctrl = visitor(item,
|
|
5567
|
+
function _visit(path7, item, visitor) {
|
|
5568
|
+
let ctrl = visitor(item, path7);
|
|
5569
5569
|
if (typeof ctrl === "symbol")
|
|
5570
5570
|
return ctrl;
|
|
5571
5571
|
for (const field of ["key", "value"]) {
|
|
5572
5572
|
const token = item[field];
|
|
5573
5573
|
if (token && "items" in token) {
|
|
5574
5574
|
for (let i = 0; i < token.items.length; ++i) {
|
|
5575
|
-
const ci = _visit(Object.freeze(
|
|
5575
|
+
const ci = _visit(Object.freeze(path7.concat([[field, i]])), token.items[i], visitor);
|
|
5576
5576
|
if (typeof ci === "number")
|
|
5577
5577
|
i = ci - 1;
|
|
5578
5578
|
else if (ci === BREAK)
|
|
@@ -5583,10 +5583,10 @@ var require_cst_visit = __commonJS({
|
|
|
5583
5583
|
}
|
|
5584
5584
|
}
|
|
5585
5585
|
if (typeof ctrl === "function" && field === "key")
|
|
5586
|
-
ctrl = ctrl(item,
|
|
5586
|
+
ctrl = ctrl(item, path7);
|
|
5587
5587
|
}
|
|
5588
5588
|
}
|
|
5589
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5589
|
+
return typeof ctrl === "function" ? ctrl(item, path7) : ctrl;
|
|
5590
5590
|
}
|
|
5591
5591
|
exports.visit = visit;
|
|
5592
5592
|
}
|
|
@@ -7550,17 +7550,17 @@ var require_ignore = __commonJS({
|
|
|
7550
7550
|
var throwError = (message, Ctor) => {
|
|
7551
7551
|
throw new Ctor(message);
|
|
7552
7552
|
};
|
|
7553
|
-
var checkPath = (
|
|
7554
|
-
if (!isString(
|
|
7553
|
+
var checkPath = (path7, originalPath, doThrow) => {
|
|
7554
|
+
if (!isString(path7)) {
|
|
7555
7555
|
return doThrow(
|
|
7556
7556
|
`path must be a string, but got \`${originalPath}\``,
|
|
7557
7557
|
TypeError
|
|
7558
7558
|
);
|
|
7559
7559
|
}
|
|
7560
|
-
if (!
|
|
7560
|
+
if (!path7) {
|
|
7561
7561
|
return doThrow(`path must not be empty`, TypeError);
|
|
7562
7562
|
}
|
|
7563
|
-
if (checkPath.isNotRelative(
|
|
7563
|
+
if (checkPath.isNotRelative(path7)) {
|
|
7564
7564
|
const r = "`path.relative()`d";
|
|
7565
7565
|
return doThrow(
|
|
7566
7566
|
`path should be a ${r} string, but got "${originalPath}"`,
|
|
@@ -7569,7 +7569,7 @@ var require_ignore = __commonJS({
|
|
|
7569
7569
|
}
|
|
7570
7570
|
return true;
|
|
7571
7571
|
};
|
|
7572
|
-
var isNotRelative = (
|
|
7572
|
+
var isNotRelative = (path7) => REGEX_TEST_INVALID_PATH.test(path7);
|
|
7573
7573
|
checkPath.isNotRelative = isNotRelative;
|
|
7574
7574
|
checkPath.convert = (p) => p;
|
|
7575
7575
|
var Ignore = class {
|
|
@@ -7628,7 +7628,7 @@ var require_ignore = __commonJS({
|
|
|
7628
7628
|
// setting `checkUnignored` to `false` could reduce additional
|
|
7629
7629
|
// path matching.
|
|
7630
7630
|
// @returns {TestResult} true if a file is ignored
|
|
7631
|
-
_testOne(
|
|
7631
|
+
_testOne(path7, checkUnignored) {
|
|
7632
7632
|
let ignored = false;
|
|
7633
7633
|
let unignored = false;
|
|
7634
7634
|
this._rules.forEach((rule) => {
|
|
@@ -7636,7 +7636,7 @@ var require_ignore = __commonJS({
|
|
|
7636
7636
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
7637
7637
|
return;
|
|
7638
7638
|
}
|
|
7639
|
-
const matched = rule.regex.test(
|
|
7639
|
+
const matched = rule.regex.test(path7);
|
|
7640
7640
|
if (matched) {
|
|
7641
7641
|
ignored = !negative;
|
|
7642
7642
|
unignored = negative;
|
|
@@ -7649,24 +7649,24 @@ var require_ignore = __commonJS({
|
|
|
7649
7649
|
}
|
|
7650
7650
|
// @returns {TestResult}
|
|
7651
7651
|
_test(originalPath, cache, checkUnignored, slices) {
|
|
7652
|
-
const
|
|
7652
|
+
const path7 = originalPath && checkPath.convert(originalPath);
|
|
7653
7653
|
checkPath(
|
|
7654
|
-
|
|
7654
|
+
path7,
|
|
7655
7655
|
originalPath,
|
|
7656
7656
|
this._allowRelativePaths ? RETURN_FALSE : throwError
|
|
7657
7657
|
);
|
|
7658
|
-
return this._t(
|
|
7658
|
+
return this._t(path7, cache, checkUnignored, slices);
|
|
7659
7659
|
}
|
|
7660
|
-
_t(
|
|
7661
|
-
if (
|
|
7662
|
-
return cache[
|
|
7660
|
+
_t(path7, cache, checkUnignored, slices) {
|
|
7661
|
+
if (path7 in cache) {
|
|
7662
|
+
return cache[path7];
|
|
7663
7663
|
}
|
|
7664
7664
|
if (!slices) {
|
|
7665
|
-
slices =
|
|
7665
|
+
slices = path7.split(SLASH);
|
|
7666
7666
|
}
|
|
7667
7667
|
slices.pop();
|
|
7668
7668
|
if (!slices.length) {
|
|
7669
|
-
return cache[
|
|
7669
|
+
return cache[path7] = this._testOne(path7, checkUnignored);
|
|
7670
7670
|
}
|
|
7671
7671
|
const parent = this._t(
|
|
7672
7672
|
slices.join(SLASH) + SLASH,
|
|
@@ -7674,24 +7674,24 @@ var require_ignore = __commonJS({
|
|
|
7674
7674
|
checkUnignored,
|
|
7675
7675
|
slices
|
|
7676
7676
|
);
|
|
7677
|
-
return cache[
|
|
7677
|
+
return cache[path7] = parent.ignored ? parent : this._testOne(path7, checkUnignored);
|
|
7678
7678
|
}
|
|
7679
|
-
ignores(
|
|
7680
|
-
return this._test(
|
|
7679
|
+
ignores(path7) {
|
|
7680
|
+
return this._test(path7, this._ignoreCache, false).ignored;
|
|
7681
7681
|
}
|
|
7682
7682
|
createFilter() {
|
|
7683
|
-
return (
|
|
7683
|
+
return (path7) => !this.ignores(path7);
|
|
7684
7684
|
}
|
|
7685
7685
|
filter(paths) {
|
|
7686
7686
|
return makeArray(paths).filter(this.createFilter());
|
|
7687
7687
|
}
|
|
7688
7688
|
// @returns {TestResult}
|
|
7689
|
-
test(
|
|
7690
|
-
return this._test(
|
|
7689
|
+
test(path7) {
|
|
7690
|
+
return this._test(path7, this._testCache, true);
|
|
7691
7691
|
}
|
|
7692
7692
|
};
|
|
7693
7693
|
var factory = (options) => new Ignore(options);
|
|
7694
|
-
var isPathValid = (
|
|
7694
|
+
var isPathValid = (path7) => checkPath(path7 && checkPath.convert(path7), path7, RETURN_FALSE);
|
|
7695
7695
|
factory.isPathValid = isPathValid;
|
|
7696
7696
|
factory.default = factory;
|
|
7697
7697
|
module.exports = factory;
|
|
@@ -7702,7 +7702,7 @@ var require_ignore = __commonJS({
|
|
|
7702
7702
|
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
7703
7703
|
checkPath.convert = makePosix;
|
|
7704
7704
|
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
7705
|
-
checkPath.isNotRelative = (
|
|
7705
|
+
checkPath.isNotRelative = (path7) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path7) || isNotRelative(path7);
|
|
7706
7706
|
}
|
|
7707
7707
|
}
|
|
7708
7708
|
});
|
|
@@ -7714,8 +7714,7 @@ import crypto from "node:crypto";
|
|
|
7714
7714
|
import fs5 from "node:fs";
|
|
7715
7715
|
import http from "node:http";
|
|
7716
7716
|
import os from "node:os";
|
|
7717
|
-
import
|
|
7718
|
-
import { fileURLToPath } from "node:url";
|
|
7717
|
+
import path6 from "node:path";
|
|
7719
7718
|
import { tool } from "@opencode-ai/plugin/tool";
|
|
7720
7719
|
|
|
7721
7720
|
// src/git_utils.js
|
|
@@ -8486,7 +8485,9 @@ async function optima_validate_logic(worktree) {
|
|
|
8486
8485
|
};
|
|
8487
8486
|
}
|
|
8488
8487
|
|
|
8489
|
-
// src/
|
|
8488
|
+
// src/constants.js
|
|
8489
|
+
import path5 from "node:path";
|
|
8490
|
+
import { fileURLToPath } from "node:url";
|
|
8490
8491
|
var PKG_ROOT = path5.resolve(path5.dirname(fileURLToPath(import.meta.url)), "..");
|
|
8491
8492
|
var BUNDLE_ASSETS_DIR = path5.join(PKG_ROOT, "assets");
|
|
8492
8493
|
var BUNDLE_AGENTS_DIR = path5.join(BUNDLE_ASSETS_DIR, "agents");
|
|
@@ -8617,20 +8618,22 @@ var REPO_LOCAL_POLICIES_README = [
|
|
|
8617
8618
|
"Only files in `.optima/policies/` affect runtime prompt behavior.",
|
|
8618
8619
|
""
|
|
8619
8620
|
].join("\n");
|
|
8621
|
+
var CLICKUP_WEBHOOK_CLEANUP_TIMEOUT_MS = 8e3;
|
|
8622
|
+
var CLICKUP_WEBHOOK_SIGNAL_STATE = Symbol.for("opencode-optima.clickup-webhook.signal-state");
|
|
8623
|
+
|
|
8624
|
+
// src/index.js
|
|
8620
8625
|
var activeWorkflows = /* @__PURE__ */ new Map();
|
|
8621
8626
|
var activeClickUpWebhookListeners = /* @__PURE__ */ new Map();
|
|
8622
8627
|
var activeClickUpWebhookLifecycleRegistry = /* @__PURE__ */ new Map();
|
|
8623
|
-
var CLICKUP_WEBHOOK_CLEANUP_TIMEOUT_MS = 8e3;
|
|
8624
|
-
var CLICKUP_WEBHOOK_SIGNAL_STATE = Symbol.for("opencode-optima.clickup-webhook.signal-state");
|
|
8625
8628
|
var activeClickUpTaskRoutes = /* @__PURE__ */ new Map();
|
|
8626
8629
|
function isRootDirectory(candidate) {
|
|
8627
|
-
const resolved =
|
|
8628
|
-
return resolved ===
|
|
8630
|
+
const resolved = path6.resolve(candidate);
|
|
8631
|
+
return resolved === path6.parse(resolved).root;
|
|
8629
8632
|
}
|
|
8630
8633
|
function isSafeWritableDirectory(candidate) {
|
|
8631
8634
|
if (typeof candidate !== "string" || !candidate.trim()) return false;
|
|
8632
|
-
if (!
|
|
8633
|
-
const resolved =
|
|
8635
|
+
if (!path6.isAbsolute(candidate)) return false;
|
|
8636
|
+
const resolved = path6.resolve(candidate);
|
|
8634
8637
|
if (isRootDirectory(resolved)) return false;
|
|
8635
8638
|
try {
|
|
8636
8639
|
const stat = fs5.statSync(resolved);
|
|
@@ -8651,7 +8654,7 @@ function resolveSafeWorktree(context = {}, pluginWorktree = null) {
|
|
|
8651
8654
|
];
|
|
8652
8655
|
for (const candidate of candidates) {
|
|
8653
8656
|
if (typeof candidate !== "string" || !candidate.trim()) continue;
|
|
8654
|
-
const resolved =
|
|
8657
|
+
const resolved = path6.resolve(candidate);
|
|
8655
8658
|
if (isSafeWritableDirectory(resolved)) return resolved;
|
|
8656
8659
|
}
|
|
8657
8660
|
throw new Error(SAFE_WORKTREE_FAILURE);
|
|
@@ -8666,13 +8669,13 @@ function safeWorktreeOrFailure(context, pluginWorktree) {
|
|
|
8666
8669
|
function explicitSafeInputWorktree(input = {}) {
|
|
8667
8670
|
for (const candidate of [input?.worktree, input?.directory]) {
|
|
8668
8671
|
if (typeof candidate !== "string" || !candidate.trim()) continue;
|
|
8669
|
-
const resolved =
|
|
8672
|
+
const resolved = path6.resolve(candidate);
|
|
8670
8673
|
if (isSafeWritableDirectory(resolved)) return resolved;
|
|
8671
8674
|
}
|
|
8672
8675
|
return null;
|
|
8673
8676
|
}
|
|
8674
8677
|
function isGitRepository(worktree) {
|
|
8675
|
-
return fs5.existsSync(
|
|
8678
|
+
return fs5.existsSync(path6.join(worktree, ".git"));
|
|
8676
8679
|
}
|
|
8677
8680
|
function normalizeLooseToken(value) {
|
|
8678
8681
|
return String(value ?? "").trim().normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -9167,7 +9170,7 @@ function buildClickUpSummaryPayload({ summaryMarkdown = "", summaryPath = "", ta
|
|
|
9167
9170
|
function deriveClickUpWorktree({ baseWorktree = "", taskId, taskType, parentTaskId, subtaskId } = {}) {
|
|
9168
9171
|
const branch = deriveClickUpBranchName({ taskType, parentTaskId, subtaskId, taskId });
|
|
9169
9172
|
const root = baseWorktree || process.cwd();
|
|
9170
|
-
return
|
|
9173
|
+
return path6.join(path6.dirname(root), `${path6.basename(root)}-${branch.replace(/\//g, "-")}`);
|
|
9171
9174
|
}
|
|
9172
9175
|
function clickUpCustomFieldValue(task = {}, names = []) {
|
|
9173
9176
|
const fields = Array.isArray(task.custom_fields) ? task.custom_fields : [];
|
|
@@ -9191,12 +9194,12 @@ function safeExistingClickUpWorktree({ metadata = {}, branch = "" } = {}) {
|
|
|
9191
9194
|
const taskMetadata = metadataTaskRouting(metadata);
|
|
9192
9195
|
const existingWorktree = typeof taskMetadata.worktree === "string" ? taskMetadata.worktree.trim() : "";
|
|
9193
9196
|
const existingBranch = typeof taskMetadata.branch === "string" ? taskMetadata.branch.trim() : "";
|
|
9194
|
-
if (!existingWorktree || !
|
|
9197
|
+
if (!existingWorktree || !path6.isAbsolute(existingWorktree) || !fs5.existsSync(existingWorktree)) return null;
|
|
9195
9198
|
try {
|
|
9196
9199
|
const stat = fs5.statSync(existingWorktree);
|
|
9197
9200
|
if (!stat.isDirectory()) return null;
|
|
9198
9201
|
if (branch && existingBranch && existingBranch !== branch) return null;
|
|
9199
|
-
return { branch: existingBranch || branch, worktree:
|
|
9202
|
+
return { branch: existingBranch || branch, worktree: path6.resolve(existingWorktree), reused: true };
|
|
9200
9203
|
} catch {
|
|
9201
9204
|
return null;
|
|
9202
9205
|
}
|
|
@@ -9282,17 +9285,17 @@ function openChamberEntryBranch(entry) {
|
|
|
9282
9285
|
return String(entry?.branch || entry?.branchName || entry?.branch_name || entry?.worktree?.branch || "").replace(/^refs\/heads\//, "");
|
|
9283
9286
|
}
|
|
9284
9287
|
function openChamberListIncludesDirectory(list, directory) {
|
|
9285
|
-
const resolved =
|
|
9288
|
+
const resolved = path6.resolve(directory);
|
|
9286
9289
|
return normalizeOpenChamberCollection(list).some((entry) => {
|
|
9287
9290
|
const entryDirectory = openChamberEntryDirectory(entry);
|
|
9288
|
-
return entryDirectory &&
|
|
9291
|
+
return entryDirectory && path6.resolve(entryDirectory) === resolved;
|
|
9289
9292
|
});
|
|
9290
9293
|
}
|
|
9291
9294
|
function openChamberListIncludesBranch(list, directory, branch) {
|
|
9292
|
-
const resolved =
|
|
9295
|
+
const resolved = path6.resolve(directory);
|
|
9293
9296
|
return normalizeOpenChamberCollection(list).some((entry) => {
|
|
9294
9297
|
const entryDirectory = openChamberEntryDirectory(entry);
|
|
9295
|
-
if (!entryDirectory ||
|
|
9298
|
+
if (!entryDirectory || path6.resolve(entryDirectory) !== resolved) return false;
|
|
9296
9299
|
const entryBranch = openChamberEntryBranch(entry);
|
|
9297
9300
|
return !entryBranch || entryBranch === branch;
|
|
9298
9301
|
});
|
|
@@ -9300,8 +9303,8 @@ function openChamberListIncludesBranch(list, directory, branch) {
|
|
|
9300
9303
|
async function findOpenChamberProject({ opencodeBaseUrl, baseWorktree, fetchImpl = globalThis.fetch } = {}) {
|
|
9301
9304
|
const projects = await requestOpenCodeJson({ baseUrl: opencodeBaseUrl, endpoint: "/project", directory: baseWorktree, fetchImpl });
|
|
9302
9305
|
if (!Array.isArray(projects)) return null;
|
|
9303
|
-
const resolvedBase =
|
|
9304
|
-
return projects.find((project) =>
|
|
9306
|
+
const resolvedBase = path6.resolve(baseWorktree);
|
|
9307
|
+
return projects.find((project) => path6.resolve(String(project?.worktree || project?.path || "")) === resolvedBase) || null;
|
|
9305
9308
|
}
|
|
9306
9309
|
async function refreshOpenChamberProjectCopy({ opencodeBaseUrl, projectId, fetchImpl = globalThis.fetch } = {}) {
|
|
9307
9310
|
if (!projectId) return { refreshed: false, reason: "project_id_unavailable" };
|
|
@@ -9356,18 +9359,18 @@ async function createOpenChamberClickUpWorktree({ openchamberBaseUrl, baseUrl, b
|
|
|
9356
9359
|
}
|
|
9357
9360
|
const createdDirectory = openChamberEntryDirectory(created);
|
|
9358
9361
|
const createdBranch = openChamberEntryBranch(created);
|
|
9359
|
-
if (!createdDirectory || !
|
|
9362
|
+
if (!createdDirectory || !path6.isAbsolute(createdDirectory)) {
|
|
9360
9363
|
throw new Error(`OpenChamber did not return an absolute worktree path for ${branch}.`);
|
|
9361
9364
|
}
|
|
9362
9365
|
if (createdBranch !== branch) {
|
|
9363
9366
|
throw new Error(`OpenChamber created unexpected branch ${createdBranch || "<unknown>"}; expected ${branch}.`);
|
|
9364
9367
|
}
|
|
9365
9368
|
const verified = await verifyOpenChamberGitWorktree({ openchamberBaseUrl: effectiveOpenChamberBaseUrl, baseWorktree, worktreePath: createdDirectory, branch, fetchImpl });
|
|
9366
|
-
return { created, worktree:
|
|
9369
|
+
return { created, worktree: path6.resolve(createdDirectory), branch: createdBranch, verified };
|
|
9367
9370
|
}
|
|
9368
9371
|
async function registerOpenChamberClickUpWorktree({ openchamberBaseUrl, opencodeBaseUrl, baseUrl, baseWorktree, branch, worktreePath, fetchImpl = globalThis.fetch, source = "reuse" } = {}) {
|
|
9369
9372
|
const visibility = await syncOpenChamberWorktreeVisibility({ openchamberBaseUrl: openchamberBaseUrl || baseUrl, opencodeBaseUrl: opencodeBaseUrl || baseUrl, baseWorktree, worktreePath, branch, fetchImpl });
|
|
9370
|
-
return { branch, worktree:
|
|
9373
|
+
return { branch, worktree: path6.resolve(worktreePath), reused: true, provider: "openchamber", openChamber: { source, visibility } };
|
|
9371
9374
|
}
|
|
9372
9375
|
async function ensureClickUpTaskWorktreeOpenChamber({ baseWorktree = "", taskId, taskType = "Tarea", parentTaskId = "", subtaskId = "", existingMetadata = {}, runGitFn = runGit, openchamberBaseUrl = "", opencodeBaseUrl = "", baseUrl = "", fetchImpl = globalThis.fetch, log = null } = {}) {
|
|
9373
9376
|
const effectiveOpenChamberBaseUrl = openchamberBaseUrl || baseUrl;
|
|
@@ -9430,10 +9433,10 @@ function ensureClickUpTaskWorktree({ baseWorktree = "", taskId, taskType = "Tare
|
|
|
9430
9433
|
const existing = safeExistingClickUpWorktree({ metadata: existingMetadata, branch });
|
|
9431
9434
|
if (existing) return { ...existing, branch, parentBranch: parentBranch || void 0, prTarget: parentBranch || "dev" };
|
|
9432
9435
|
const worktreePath = deriveClickUpWorktree({ baseWorktree, taskId, taskType, parentTaskId: effectiveParent, subtaskId });
|
|
9433
|
-
if (fs5.existsSync(worktreePath)) return { branch, worktree:
|
|
9436
|
+
if (fs5.existsSync(worktreePath)) return { branch, worktree: path6.resolve(worktreePath), reused: true, parentBranch: parentBranch || void 0, prTarget: parentBranch || "dev" };
|
|
9434
9437
|
if (allowNonGitFallback) {
|
|
9435
9438
|
fs5.mkdirSync(worktreePath, { recursive: true });
|
|
9436
|
-
return { branch, worktree:
|
|
9439
|
+
return { branch, worktree: path6.resolve(worktreePath), reused: false, fallback: "non_git", parentBranch: parentBranch || void 0, prTarget: parentBranch || "dev", startPoint: parentBranch || "dev" };
|
|
9437
9440
|
}
|
|
9438
9441
|
let parentBootstrap = null;
|
|
9439
9442
|
if (isSubtask) {
|
|
@@ -9442,14 +9445,14 @@ function ensureClickUpTaskWorktree({ baseWorktree = "", taskId, taskType = "Tare
|
|
|
9442
9445
|
const parentStartPoint = resolveClickUpDevStartPoint(baseWorktree, runGitFn);
|
|
9443
9446
|
const parentBranchExists = clickUpGitRefExists(baseWorktree, parentBranch, runGitFn);
|
|
9444
9447
|
addClickUpWorktreeForBranch({ baseWorktree, branch: parentBranch, worktreePath: parentWorktree, startPoint: parentStartPoint, runGitFn });
|
|
9445
|
-
parentBootstrap = { branch: parentBranch, worktree:
|
|
9448
|
+
parentBootstrap = { branch: parentBranch, worktree: path6.resolve(parentWorktree), startPoint: parentBranchExists ? parentBranch : parentStartPoint, reused: parentBranchExists };
|
|
9446
9449
|
} else {
|
|
9447
|
-
parentBootstrap = { branch: parentBranch, worktree:
|
|
9450
|
+
parentBootstrap = { branch: parentBranch, worktree: path6.resolve(parentWorktree), reused: true };
|
|
9448
9451
|
}
|
|
9449
9452
|
}
|
|
9450
9453
|
const startPoint = isSubtask ? parentBranch : resolveClickUpDevStartPoint(baseWorktree, runGitFn);
|
|
9451
9454
|
addClickUpWorktreeForBranch({ baseWorktree, branch, worktreePath, startPoint, runGitFn });
|
|
9452
|
-
return { branch, worktree:
|
|
9455
|
+
return { branch, worktree: path6.resolve(worktreePath), reused: false, startPoint, parentBranch: parentBranch || void 0, prTarget: parentBranch || "dev", parentBootstrap: parentBootstrap || void 0 };
|
|
9453
9456
|
}
|
|
9454
9457
|
function normalizeClickUpDefinitionDocParent(parent = {}) {
|
|
9455
9458
|
const docId = String(parent.doc_id || parent.docId || CLICKUP_DEFINITION_DOC_PARENT.doc_id).trim();
|
|
@@ -9599,7 +9602,7 @@ function buildClickUpTransitionPayload({ fromStatus, toStatus, validationPassed
|
|
|
9599
9602
|
}
|
|
9600
9603
|
function ensureOptimaGitignoreRules(worktree) {
|
|
9601
9604
|
if (!isGitRepository(worktree)) return { touched: false, added: [] };
|
|
9602
|
-
const gitignorePath =
|
|
9605
|
+
const gitignorePath = path6.join(worktree, ".gitignore");
|
|
9603
9606
|
const existing = fs5.existsSync(gitignorePath) ? fs5.readFileSync(gitignorePath, "utf8") : "";
|
|
9604
9607
|
const existingRules = new Set(existing.split(/\r?\n/).map((line) => line.trim()).filter(Boolean));
|
|
9605
9608
|
const missingRules = OPTIMA_GITIGNORE_RULES.filter((rule) => !existingRules.has(rule));
|
|
@@ -9615,40 +9618,40 @@ function ensureOptimaGitignoreRules(worktree) {
|
|
|
9615
9618
|
return { touched: true, added: missingRules };
|
|
9616
9619
|
}
|
|
9617
9620
|
function optimaDir(worktree) {
|
|
9618
|
-
return
|
|
9621
|
+
return path6.join(worktree, OPTIMA_DIRNAME);
|
|
9619
9622
|
}
|
|
9620
9623
|
function optimaLocalConfigDir(worktree) {
|
|
9621
|
-
return
|
|
9624
|
+
return path6.join(optimaDir(worktree), ".config");
|
|
9622
9625
|
}
|
|
9623
9626
|
function optimaConfigDir(worktree) {
|
|
9624
9627
|
return optimaLocalConfigDir(worktree);
|
|
9625
9628
|
}
|
|
9626
9629
|
function optimaCodemapPath(worktree) {
|
|
9627
|
-
return
|
|
9630
|
+
return path6.join(optimaDir(worktree), "codemap.yml");
|
|
9628
9631
|
}
|
|
9629
9632
|
function optimaTasksDir(worktree) {
|
|
9630
|
-
return
|
|
9633
|
+
return path6.join(optimaDir(worktree), "tasks");
|
|
9631
9634
|
}
|
|
9632
9635
|
function optimaEvidencesDir(worktree) {
|
|
9633
|
-
return
|
|
9636
|
+
return path6.join(optimaDir(worktree), "evidences");
|
|
9634
9637
|
}
|
|
9635
9638
|
function optimaScrsDir(worktree) {
|
|
9636
|
-
return
|
|
9639
|
+
return path6.join(optimaDir(worktree), "docs", "scrs");
|
|
9637
9640
|
}
|
|
9638
9641
|
function legacyNomadworkDir(worktree) {
|
|
9639
|
-
return
|
|
9642
|
+
return path6.join(worktree, LEGACY_NOMADWORK_DIRNAME);
|
|
9640
9643
|
}
|
|
9641
9644
|
function legacyNomadworksDir(worktree) {
|
|
9642
|
-
return
|
|
9645
|
+
return path6.join(worktree, LEGACY_NOMADWORKS_DIRNAME);
|
|
9643
9646
|
}
|
|
9644
9647
|
function legacyOrbitaDir(worktree) {
|
|
9645
|
-
return
|
|
9648
|
+
return path6.join(worktree, LEGACY_ORBITA_DIRNAME);
|
|
9646
9649
|
}
|
|
9647
9650
|
function legacyStaticEngDir(worktree) {
|
|
9648
|
-
return
|
|
9651
|
+
return path6.join(worktree, LEGACY_STATICENG_DIRNAME);
|
|
9649
9652
|
}
|
|
9650
9653
|
function repoConfigPath(worktree) {
|
|
9651
|
-
return
|
|
9654
|
+
return path6.join(optimaConfigDir(worktree), "optima.yaml");
|
|
9652
9655
|
}
|
|
9653
9656
|
function normalizeLegacyDiscussionEntry(entry) {
|
|
9654
9657
|
if (!entry || typeof entry !== "object") return entry;
|
|
@@ -9661,25 +9664,25 @@ function normalizeLegacyDiscussionEntry(entry) {
|
|
|
9661
9664
|
return next;
|
|
9662
9665
|
}
|
|
9663
9666
|
function repoPoliciesDir(worktree) {
|
|
9664
|
-
return
|
|
9667
|
+
return path6.join(optimaDir(worktree), "policies");
|
|
9665
9668
|
}
|
|
9666
9669
|
function generatedPoliciesDir(worktree) {
|
|
9667
|
-
return
|
|
9670
|
+
return path6.join(optimaLocalConfigDir(worktree), "generated", "policies");
|
|
9668
9671
|
}
|
|
9669
9672
|
function generatedAgentsDir(worktree) {
|
|
9670
|
-
return
|
|
9673
|
+
return path6.join(optimaLocalConfigDir(worktree), "generated", "agents");
|
|
9671
9674
|
}
|
|
9672
9675
|
function repoAgentsDir(worktree) {
|
|
9673
|
-
return
|
|
9676
|
+
return path6.join(optimaDir(worktree), "agents");
|
|
9674
9677
|
}
|
|
9675
9678
|
function repoAgentAdditionsDir(worktree) {
|
|
9676
|
-
return
|
|
9679
|
+
return path6.join(optimaDir(worktree), "agent-additions");
|
|
9677
9680
|
}
|
|
9678
9681
|
function legacyRepoAgentsDir(worktree) {
|
|
9679
|
-
return
|
|
9682
|
+
return path6.join(legacyNomadworksDir(worktree), "agents");
|
|
9680
9683
|
}
|
|
9681
9684
|
function runtimeDiscussionRegistryPath(worktree) {
|
|
9682
|
-
return
|
|
9685
|
+
return path6.join(optimaLocalConfigDir(worktree), "runtime", "discussions.json");
|
|
9683
9686
|
}
|
|
9684
9687
|
function resolveConfigPath(worktree) {
|
|
9685
9688
|
return repoConfigPath(worktree);
|
|
@@ -9722,32 +9725,32 @@ function mergeClickUpAgentMetadata(existing, update = {}) {
|
|
|
9722
9725
|
return JSON.stringify(sortJsonValue(merged), null, 2);
|
|
9723
9726
|
}
|
|
9724
9727
|
function optimaRuntimeDir(worktree) {
|
|
9725
|
-
return
|
|
9728
|
+
return path6.join(optimaLocalConfigDir(worktree), "runtime");
|
|
9726
9729
|
}
|
|
9727
9730
|
function clickUpWebhookStatePath(worktree) {
|
|
9728
|
-
return
|
|
9731
|
+
return path6.join(optimaRuntimeDir(worktree), "clickup-webhook.json");
|
|
9729
9732
|
}
|
|
9730
9733
|
function clickUpCommentLedgerPath(worktree) {
|
|
9731
|
-
return
|
|
9734
|
+
return path6.join(optimaRuntimeDir(worktree), "clickup-comment-ledger.jsonl");
|
|
9732
9735
|
}
|
|
9733
9736
|
function clickUpWebhookLogPath(worktree) {
|
|
9734
|
-
return
|
|
9737
|
+
return path6.join(optimaRuntimeDir(worktree), "clickup-webhook.log.jsonl");
|
|
9735
9738
|
}
|
|
9736
9739
|
function normalizeClickUpWebhookLogLevel(value) {
|
|
9737
9740
|
const level = String(value || "info").trim().toLowerCase();
|
|
9738
9741
|
return CLICKUP_WEBHOOK_LOG_LEVELS.has(level) ? level : "info";
|
|
9739
9742
|
}
|
|
9740
9743
|
function clickUpWebhookAuditLogDir() {
|
|
9741
|
-
const dataHome = process.env.XDG_DATA_HOME &&
|
|
9742
|
-
return
|
|
9744
|
+
const dataHome = process.env.XDG_DATA_HOME && path6.isAbsolute(process.env.XDG_DATA_HOME) ? process.env.XDG_DATA_HOME : path6.join(os.homedir(), ".local", "share", "opencode");
|
|
9745
|
+
return path6.join(dataHome, "opencode-optima");
|
|
9743
9746
|
}
|
|
9744
9747
|
function clickUpWebhookAuditLogPath(at = /* @__PURE__ */ new Date(), logDir = clickUpWebhookAuditLogDir()) {
|
|
9745
|
-
return
|
|
9748
|
+
return path6.join(logDir, `clickup-webhook-${at.toISOString().slice(0, 10)}.jsonl`);
|
|
9746
9749
|
}
|
|
9747
9750
|
function clickUpWebhookRequestFilePath(at = /* @__PURE__ */ new Date(), logDir = clickUpWebhookAuditLogDir()) {
|
|
9748
9751
|
const stamp = at.toISOString().replace(/:/g, "-").replace(/\./g, "-");
|
|
9749
9752
|
const shortId = crypto.randomBytes(4).toString("hex");
|
|
9750
|
-
return
|
|
9753
|
+
return path6.join(logDir, "requests", `clickup-webhook-${stamp}-${shortId}.json`);
|
|
9751
9754
|
}
|
|
9752
9755
|
function findOptimaPluginTupleOptions(pluginEntries = []) {
|
|
9753
9756
|
if (!Array.isArray(pluginEntries)) return null;
|
|
@@ -9846,7 +9849,7 @@ function normalizeClickUpWebhookConfig(rawClickUp = null, worktree = process.cwd
|
|
|
9846
9849
|
};
|
|
9847
9850
|
const errors = [];
|
|
9848
9851
|
if (!config.enabled) errors.push("clickup.enabled must be true");
|
|
9849
|
-
if (!config.basePath || !
|
|
9852
|
+
if (!config.basePath || !path6.isAbsolute(config.basePath)) errors.push("clickup.base_path must be an absolute path");
|
|
9850
9853
|
if (!config.teamId) errors.push("clickup.team_id is required");
|
|
9851
9854
|
if (!config.apiToken) errors.push("clickup.api_token is required");
|
|
9852
9855
|
if (!config.webhook.publicUrl) errors.push("clickup.webhook.public_url is required");
|
|
@@ -9904,7 +9907,7 @@ function readClickUpWebhookState(worktree, config = null) {
|
|
|
9904
9907
|
}
|
|
9905
9908
|
function writeClickUpWebhookState(worktree, state, config = null) {
|
|
9906
9909
|
const statePath = clickUpWebhookStatePath(worktree);
|
|
9907
|
-
fs5.mkdirSync(
|
|
9910
|
+
fs5.mkdirSync(path6.dirname(statePath), { recursive: true, mode: 448 });
|
|
9908
9911
|
const next = sanitizeClickUpWebhookState(state, config);
|
|
9909
9912
|
fs5.writeFileSync(statePath, `${JSON.stringify(next, null, 2)}
|
|
9910
9913
|
`, { encoding: "utf8", mode: 384 });
|
|
@@ -9925,7 +9928,7 @@ function isClickUpWebhookStateActive(state, config) {
|
|
|
9925
9928
|
function expandHomePath(value = "") {
|
|
9926
9929
|
const input = String(value || "").trim();
|
|
9927
9930
|
if (input === "~") return os.homedir();
|
|
9928
|
-
if (input.startsWith("~/")) return
|
|
9931
|
+
if (input.startsWith("~/")) return path6.join(os.homedir(), input.slice(2));
|
|
9929
9932
|
return input;
|
|
9930
9933
|
}
|
|
9931
9934
|
function resolveSecretReference(value = "") {
|
|
@@ -10301,7 +10304,7 @@ function readClickUpCommentLedger(ledgerPath) {
|
|
|
10301
10304
|
}
|
|
10302
10305
|
function appendClickUpCommentLedgerEntry(ledgerPath, entry = {}) {
|
|
10303
10306
|
if (!ledgerPath || !entry.key) return;
|
|
10304
|
-
fs5.mkdirSync(
|
|
10307
|
+
fs5.mkdirSync(path6.dirname(ledgerPath), { recursive: true, mode: 448 });
|
|
10305
10308
|
fs5.appendFileSync(ledgerPath, `${JSON.stringify(entry)}
|
|
10306
10309
|
`, { encoding: "utf8", mode: 384 });
|
|
10307
10310
|
try {
|
|
@@ -11164,7 +11167,7 @@ function formatClickUpWebhookPrompt({ eventType, taskId, payload, branch = "", w
|
|
|
11164
11167
|
}
|
|
11165
11168
|
function appendClickUpWebhookLocalLog(worktree, entry) {
|
|
11166
11169
|
const logPath = clickUpWebhookLogPath(worktree);
|
|
11167
|
-
fs5.mkdirSync(
|
|
11170
|
+
fs5.mkdirSync(path6.dirname(logPath), { recursive: true });
|
|
11168
11171
|
const safeEntry = { ...entry, at: entry.at || (/* @__PURE__ */ new Date()).toISOString() };
|
|
11169
11172
|
fs5.appendFileSync(logPath, `${JSON.stringify(safeEntry)}
|
|
11170
11173
|
`, "utf8");
|
|
@@ -11195,7 +11198,7 @@ function closeClickUpWebhookServer(server) {
|
|
|
11195
11198
|
});
|
|
11196
11199
|
}
|
|
11197
11200
|
function managedClickUpWebhookKey({ worktree, state, config } = {}) {
|
|
11198
|
-
return [
|
|
11201
|
+
return [path6.resolve(worktree || process.cwd()), state?.webhookId || "", config?.webhook?.publicUrl || ""].join("|");
|
|
11199
11202
|
}
|
|
11200
11203
|
async function deleteClickUpWebhookBestEffort({ webhookId, clickupClient, worktree, reason = "cleanup" } = {}) {
|
|
11201
11204
|
const id = String(webhookId || "").trim();
|
|
@@ -11300,8 +11303,8 @@ function writeClickUpWebhookAuditLog({ method, url, headers = {}, rawBody = "",
|
|
|
11300
11303
|
let requestFile;
|
|
11301
11304
|
if (level === "verbose") {
|
|
11302
11305
|
const absoluteRequestFile = clickUpWebhookRequestFilePath(at, logDir);
|
|
11303
|
-
fs5.mkdirSync(
|
|
11304
|
-
requestFile =
|
|
11306
|
+
fs5.mkdirSync(path6.dirname(absoluteRequestFile), { recursive: true });
|
|
11307
|
+
requestFile = path6.relative(logDir, absoluteRequestFile).split(path6.sep).join("/");
|
|
11305
11308
|
const parsedBody = payload || (() => {
|
|
11306
11309
|
try {
|
|
11307
11310
|
return JSON.parse(Buffer.isBuffer(rawBody) ? rawBody.toString("utf8") : String(rawBody || ""));
|
|
@@ -11912,17 +11915,17 @@ function startClickUpWebhookListener({ config, state, worktree, clickupClient, o
|
|
|
11912
11915
|
return result;
|
|
11913
11916
|
}
|
|
11914
11917
|
function legacyVariantPath(destinationPath) {
|
|
11915
|
-
const parsed =
|
|
11918
|
+
const parsed = path6.parse(destinationPath);
|
|
11916
11919
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:TZ.]/g, "").slice(0, 14);
|
|
11917
|
-
if (parsed.ext) return
|
|
11918
|
-
return
|
|
11920
|
+
if (parsed.ext) return path6.join(parsed.dir, `${parsed.name}.legacy-${stamp}${parsed.ext}`);
|
|
11921
|
+
return path6.join(parsed.dir, `${parsed.base}.legacy-${stamp}`);
|
|
11919
11922
|
}
|
|
11920
11923
|
function normalizeWorkflowTaskPath(taskPath) {
|
|
11921
11924
|
if (typeof taskPath !== "string") return { ok: false, message: "Error: task_path is required." };
|
|
11922
11925
|
const trimmed = taskPath.trim();
|
|
11923
11926
|
if (!trimmed) return { ok: false, message: "Error: task_path is required." };
|
|
11924
11927
|
const normalized = trimmed.replace(/\\/g, "/");
|
|
11925
|
-
if (
|
|
11928
|
+
if (path6.isAbsolute(trimmed)) return { ok: true, taskPath: trimmed };
|
|
11926
11929
|
if (normalized === "tasks" || normalized.startsWith("tasks/")) {
|
|
11927
11930
|
return {
|
|
11928
11931
|
ok: false,
|
|
@@ -11941,12 +11944,12 @@ function mergeFileIntoDestination(sourcePath, destinationPath, relativeSource, g
|
|
|
11941
11944
|
const sourceWasTracked = isGitTracked(gitState, sourcePath);
|
|
11942
11945
|
if (gitAwareMoveIfTracked(sourcePath, destinationPath, gitState)) return;
|
|
11943
11946
|
if (!fs5.existsSync(destinationPath)) {
|
|
11944
|
-
fs5.mkdirSync(
|
|
11947
|
+
fs5.mkdirSync(path6.dirname(destinationPath), { recursive: true });
|
|
11945
11948
|
fs5.renameSync(sourcePath, destinationPath);
|
|
11946
11949
|
if (sourceWasTracked) stageGitAwareMerge(sourcePath, destinationPath, gitState);
|
|
11947
11950
|
return;
|
|
11948
11951
|
}
|
|
11949
|
-
const ext =
|
|
11952
|
+
const ext = path6.extname(destinationPath).toLowerCase();
|
|
11950
11953
|
if ([".yaml", ".yml", ".json"].includes(ext)) {
|
|
11951
11954
|
const sourceRaw = fs5.readFileSync(sourcePath, "utf8");
|
|
11952
11955
|
const destRaw = fs5.readFileSync(destinationPath, "utf8");
|
|
@@ -11981,14 +11984,14 @@ ${sourceRaw}
|
|
|
11981
11984
|
fs5.renameSync(sourcePath, preservedPath);
|
|
11982
11985
|
stageGitAwareMerge(sourcePath, preservedPath, gitState);
|
|
11983
11986
|
}
|
|
11984
|
-
function mergePathIntoDestination(sourcePath, destinationPath, relativeSource =
|
|
11987
|
+
function mergePathIntoDestination(sourcePath, destinationPath, relativeSource = path6.basename(sourcePath), gitState = null) {
|
|
11985
11988
|
if (!fs5.existsSync(sourcePath)) return;
|
|
11986
11989
|
const stat = fs5.statSync(sourcePath);
|
|
11987
11990
|
if (stat.isDirectory()) {
|
|
11988
11991
|
const sourceWasTracked = isGitTracked(gitState, sourcePath) || hasGitTrackedChildren(gitState, sourcePath);
|
|
11989
11992
|
if (gitAwareMoveIfTracked(sourcePath, destinationPath, gitState)) return;
|
|
11990
11993
|
if (!fs5.existsSync(destinationPath)) {
|
|
11991
|
-
fs5.mkdirSync(
|
|
11994
|
+
fs5.mkdirSync(path6.dirname(destinationPath), { recursive: true });
|
|
11992
11995
|
fs5.renameSync(sourcePath, destinationPath);
|
|
11993
11996
|
if (sourceWasTracked) stageGitAwareMerge(sourcePath, destinationPath, gitState);
|
|
11994
11997
|
return;
|
|
@@ -11996,9 +11999,9 @@ function mergePathIntoDestination(sourcePath, destinationPath, relativeSource =
|
|
|
11996
11999
|
fs5.mkdirSync(destinationPath, { recursive: true });
|
|
11997
12000
|
for (const entry of fs5.readdirSync(sourcePath)) {
|
|
11998
12001
|
mergePathIntoDestination(
|
|
11999
|
-
|
|
12000
|
-
|
|
12001
|
-
|
|
12002
|
+
path6.join(sourcePath, entry),
|
|
12003
|
+
path6.join(destinationPath, entry),
|
|
12004
|
+
path6.join(relativeSource, entry),
|
|
12002
12005
|
gitState
|
|
12003
12006
|
);
|
|
12004
12007
|
}
|
|
@@ -12008,7 +12011,7 @@ function mergePathIntoDestination(sourcePath, destinationPath, relativeSource =
|
|
|
12008
12011
|
mergeFileIntoDestination(sourcePath, destinationPath, relativeSource, gitState);
|
|
12009
12012
|
}
|
|
12010
12013
|
function isOptimaPluginPackageWorktree(worktree) {
|
|
12011
|
-
const packageJsonPath =
|
|
12014
|
+
const packageJsonPath = path6.join(worktree, "package.json");
|
|
12012
12015
|
if (!fs5.existsSync(packageJsonPath)) return false;
|
|
12013
12016
|
try {
|
|
12014
12017
|
const pkg = JSON.parse(fs5.readFileSync(packageJsonPath, "utf8"));
|
|
@@ -12020,51 +12023,51 @@ function isOptimaPluginPackageWorktree(worktree) {
|
|
|
12020
12023
|
function migrateLegacyOptimaLayout(worktree) {
|
|
12021
12024
|
const gitState = gitMigrationState(worktree);
|
|
12022
12025
|
const migrations = [
|
|
12023
|
-
[
|
|
12024
|
-
[
|
|
12025
|
-
[
|
|
12026
|
-
[
|
|
12027
|
-
[
|
|
12028
|
-
[
|
|
12026
|
+
[path6.join(legacyOrbitaDir(worktree), "orbita.yaml"), repoConfigPath(worktree), path6.join(".orbita", "orbita.yaml")],
|
|
12027
|
+
[path6.join(legacyOrbitaDir(worktree), "staticeng.yaml"), repoConfigPath(worktree), path6.join(".orbita", "staticeng.yaml")],
|
|
12028
|
+
[path6.join(legacyOrbitaDir(worktree), ".config"), optimaLocalConfigDir(worktree), path6.join(".orbita", ".config")],
|
|
12029
|
+
[path6.join(legacyOrbitaDir(worktree), "config"), optimaLocalConfigDir(worktree), path6.join(".orbita", "config")],
|
|
12030
|
+
[path6.join(legacyOrbitaDir(worktree), "runtime"), path6.join(optimaLocalConfigDir(worktree), "runtime"), path6.join(".orbita", "runtime")],
|
|
12031
|
+
[path6.join(legacyOrbitaDir(worktree), "generated"), path6.join(optimaLocalConfigDir(worktree), "generated"), path6.join(".orbita", "generated")],
|
|
12029
12032
|
[legacyOrbitaDir(worktree), optimaDir(worktree), ".orbita"],
|
|
12030
|
-
[
|
|
12031
|
-
[
|
|
12032
|
-
[
|
|
12033
|
-
[
|
|
12034
|
-
[
|
|
12035
|
-
[
|
|
12033
|
+
[path6.join(legacyStaticEngDir(worktree), "staticeng.yaml"), repoConfigPath(worktree), path6.join(".staticeng", "staticeng.yaml")],
|
|
12034
|
+
[path6.join(legacyStaticEngDir(worktree), "orbita.yaml"), repoConfigPath(worktree), path6.join(".staticeng", "orbita.yaml")],
|
|
12035
|
+
[path6.join(legacyStaticEngDir(worktree), ".config"), optimaLocalConfigDir(worktree), path6.join(".staticeng", ".config")],
|
|
12036
|
+
[path6.join(legacyStaticEngDir(worktree), "config"), optimaLocalConfigDir(worktree), path6.join(".staticeng", "config")],
|
|
12037
|
+
[path6.join(legacyStaticEngDir(worktree), "runtime"), path6.join(optimaLocalConfigDir(worktree), "runtime"), path6.join(".staticeng", "runtime")],
|
|
12038
|
+
[path6.join(legacyStaticEngDir(worktree), "generated"), path6.join(optimaLocalConfigDir(worktree), "generated"), path6.join(".staticeng", "generated")],
|
|
12036
12039
|
[legacyStaticEngDir(worktree), optimaDir(worktree), ".staticeng"],
|
|
12037
|
-
[
|
|
12038
|
-
[
|
|
12039
|
-
[
|
|
12040
|
-
[
|
|
12041
|
-
[
|
|
12042
|
-
[
|
|
12043
|
-
[
|
|
12044
|
-
[
|
|
12045
|
-
[
|
|
12046
|
-
[
|
|
12047
|
-
[
|
|
12048
|
-
[
|
|
12040
|
+
[path6.join(legacyNomadworkDir(worktree), "nomadworks.yaml"), repoConfigPath(worktree), path6.join(".nomadwork", "nomadworks.yaml")],
|
|
12041
|
+
[path6.join(legacyNomadworksDir(worktree), "nomadworks.yaml"), repoConfigPath(worktree), path6.join(".nomadworks", "nomadworks.yaml")],
|
|
12042
|
+
[path6.join(legacyNomadworkDir(worktree), "staticeng.yaml"), repoConfigPath(worktree), path6.join(".nomadwork", "staticeng.yaml")],
|
|
12043
|
+
[path6.join(legacyNomadworksDir(worktree), "staticeng.yaml"), repoConfigPath(worktree), path6.join(".nomadworks", "staticeng.yaml")],
|
|
12044
|
+
[path6.join(legacyNomadworkDir(worktree), "orbita.yaml"), repoConfigPath(worktree), path6.join(".nomadwork", "orbita.yaml")],
|
|
12045
|
+
[path6.join(legacyNomadworksDir(worktree), "orbita.yaml"), repoConfigPath(worktree), path6.join(".nomadworks", "orbita.yaml")],
|
|
12046
|
+
[path6.join(legacyNomadworkDir(worktree), "runtime"), path6.join(optimaLocalConfigDir(worktree), "runtime"), path6.join(".nomadwork", "runtime")],
|
|
12047
|
+
[path6.join(legacyNomadworksDir(worktree), "runtime"), path6.join(optimaLocalConfigDir(worktree), "runtime"), path6.join(".nomadworks", "runtime")],
|
|
12048
|
+
[path6.join(legacyNomadworkDir(worktree), "generated"), path6.join(optimaLocalConfigDir(worktree), "generated"), path6.join(".nomadwork", "generated")],
|
|
12049
|
+
[path6.join(legacyNomadworksDir(worktree), "generated"), path6.join(optimaLocalConfigDir(worktree), "generated"), path6.join(".nomadworks", "generated")],
|
|
12050
|
+
[path6.join(legacyNomadworkDir(worktree), "config"), optimaLocalConfigDir(worktree), path6.join(".nomadwork", "config")],
|
|
12051
|
+
[path6.join(legacyNomadworksDir(worktree), "config"), optimaLocalConfigDir(worktree), path6.join(".nomadworks", "config")],
|
|
12049
12052
|
[legacyNomadworkDir(worktree), optimaDir(worktree), ".nomadwork"],
|
|
12050
12053
|
[legacyNomadworksDir(worktree), optimaDir(worktree), ".nomadworks"],
|
|
12051
|
-
[
|
|
12052
|
-
[
|
|
12053
|
-
[
|
|
12054
|
-
[
|
|
12055
|
-
[
|
|
12054
|
+
[path6.join(worktree, "tasks"), optimaTasksDir(worktree), "tasks"],
|
|
12055
|
+
[path6.join(worktree, "evidences"), optimaEvidencesDir(worktree), "evidences"],
|
|
12056
|
+
[path6.join(worktree, "docs", "scrs"), optimaScrsDir(worktree), path6.join("docs", "scrs")],
|
|
12057
|
+
[path6.join(worktree, "codemap.yml"), optimaCodemapPath(worktree), "codemap.yml"],
|
|
12058
|
+
[path6.join(worktree, "codemap.yaml"), optimaCodemapPath(worktree), "codemap.yaml"]
|
|
12056
12059
|
];
|
|
12057
12060
|
if (!isOptimaPluginPackageWorktree(worktree)) {
|
|
12058
|
-
migrations.push([
|
|
12061
|
+
migrations.push([path6.join(worktree, "policies"), repoPoliciesDir(worktree), "policies"]);
|
|
12059
12062
|
}
|
|
12060
12063
|
for (const [source, destination, relativeSource] of migrations) {
|
|
12061
12064
|
if (fs5.existsSync(source)) mergePathIntoDestination(source, destination, relativeSource, gitState);
|
|
12062
12065
|
}
|
|
12063
12066
|
for (const [source, destination, relativeSource] of [
|
|
12064
|
-
[
|
|
12065
|
-
[
|
|
12066
|
-
[
|
|
12067
|
-
[
|
|
12067
|
+
[path6.join(optimaDir(worktree), "optima.yaml"), repoConfigPath(worktree), path6.join(".optima", "optima.yaml")],
|
|
12068
|
+
[path6.join(optimaDir(worktree), "config"), optimaLocalConfigDir(worktree), path6.join(".optima", "config")],
|
|
12069
|
+
[path6.join(optimaDir(worktree), "runtime"), path6.join(optimaLocalConfigDir(worktree), "runtime"), path6.join(".optima", "runtime")],
|
|
12070
|
+
[path6.join(optimaDir(worktree), "generated"), path6.join(optimaLocalConfigDir(worktree), "generated"), path6.join(".optima", "generated")]
|
|
12068
12071
|
]) {
|
|
12069
12072
|
if (fs5.existsSync(source)) mergePathIntoDestination(source, destination, relativeSource, gitState);
|
|
12070
12073
|
}
|
|
@@ -12113,7 +12116,7 @@ function toModelString(provider, model) {
|
|
|
12113
12116
|
}
|
|
12114
12117
|
function readTaskMetadata(taskPath, worktree) {
|
|
12115
12118
|
if (!taskPath) return {};
|
|
12116
|
-
const absoluteTaskPath =
|
|
12119
|
+
const absoluteTaskPath = path6.isAbsolute(taskPath) ? taskPath : path6.join(worktree, taskPath);
|
|
12117
12120
|
if (!fs5.existsSync(absoluteTaskPath)) return {};
|
|
12118
12121
|
try {
|
|
12119
12122
|
const raw = fs5.readFileSync(absoluteTaskPath, "utf8");
|
|
@@ -12158,18 +12161,18 @@ function loadDiscussionRegistry(worktree) {
|
|
|
12158
12161
|
}
|
|
12159
12162
|
function saveDiscussionRegistry(worktree, registry) {
|
|
12160
12163
|
const registryPath = runtimeDiscussionRegistryPath(worktree);
|
|
12161
|
-
const runtimeDir =
|
|
12164
|
+
const runtimeDir = path6.dirname(registryPath);
|
|
12162
12165
|
if (!fs5.existsSync(runtimeDir)) fs5.mkdirSync(runtimeDir, { recursive: true });
|
|
12163
12166
|
fs5.writeFileSync(registryPath, JSON.stringify(registry, null, 2), "utf8");
|
|
12164
12167
|
}
|
|
12165
12168
|
function runtimeDiscussionsDir(worktree) {
|
|
12166
|
-
return
|
|
12169
|
+
return path6.join(optimaLocalConfigDir(worktree), "runtime", "discussions");
|
|
12167
12170
|
}
|
|
12168
12171
|
function archivedRuntimeDiscussionsDir(worktree) {
|
|
12169
|
-
return
|
|
12172
|
+
return path6.join(runtimeDiscussionsDir(worktree), "archive");
|
|
12170
12173
|
}
|
|
12171
12174
|
function finalDiscussionsDir(worktree) {
|
|
12172
|
-
return
|
|
12175
|
+
return path6.join(optimaTasksDir(worktree), "discussions");
|
|
12173
12176
|
}
|
|
12174
12177
|
function nextDiscussionIdentity(worktree, title) {
|
|
12175
12178
|
const discussionsDir = finalDiscussionsDir(worktree);
|
|
@@ -12180,11 +12183,11 @@ function nextDiscussionIdentity(worktree, title) {
|
|
|
12180
12183
|
while (true) {
|
|
12181
12184
|
const id = `DISCUSSION-${String(sequence).padStart(3, "0")}`;
|
|
12182
12185
|
const filename = `${id}-${slugifyTitle(title)}.md`;
|
|
12183
|
-
const summaryRelativePath =
|
|
12184
|
-
const summaryAbsolutePath =
|
|
12186
|
+
const summaryRelativePath = path6.join(".optima", "tasks", "discussions", filename);
|
|
12187
|
+
const summaryAbsolutePath = path6.join(worktree, summaryRelativePath);
|
|
12185
12188
|
const transcriptFilename = `${id}-transcript.md`;
|
|
12186
|
-
const transcriptRelativePath =
|
|
12187
|
-
const transcriptAbsolutePath =
|
|
12189
|
+
const transcriptRelativePath = path6.join(".optima", ".config", "runtime", "discussions", transcriptFilename);
|
|
12190
|
+
const transcriptAbsolutePath = path6.join(worktree, transcriptRelativePath);
|
|
12188
12191
|
if (!fs5.existsSync(summaryAbsolutePath) && !fs5.existsSync(transcriptAbsolutePath)) {
|
|
12189
12192
|
return {
|
|
12190
12193
|
id,
|
|
@@ -12209,11 +12212,11 @@ function findDiscussionById(worktree, discussionID) {
|
|
|
12209
12212
|
return {
|
|
12210
12213
|
id: discussionID,
|
|
12211
12214
|
filename,
|
|
12212
|
-
summaryRelativePath:
|
|
12213
|
-
summaryAbsolutePath:
|
|
12215
|
+
summaryRelativePath: path6.join(".optima", "tasks", "discussions", filename),
|
|
12216
|
+
summaryAbsolutePath: path6.join(discussionsDir, filename),
|
|
12214
12217
|
transcriptFilename,
|
|
12215
|
-
transcriptRelativePath:
|
|
12216
|
-
transcriptAbsolutePath:
|
|
12218
|
+
transcriptRelativePath: path6.join(".optima", ".config", "runtime", "discussions", transcriptFilename),
|
|
12219
|
+
transcriptAbsolutePath: path6.join(runtimeDiscussionsDir(worktree), transcriptFilename)
|
|
12217
12220
|
};
|
|
12218
12221
|
}
|
|
12219
12222
|
function parseDiscussionFile(filePath) {
|
|
@@ -12296,15 +12299,15 @@ async function appendMessageIfNeeded(client, worktree, registry, sessionID, mess
|
|
|
12296
12299
|
});
|
|
12297
12300
|
const text = extractTextParts(response.data.parts || []);
|
|
12298
12301
|
if (!text) return;
|
|
12299
|
-
appendDiscussionMessage(
|
|
12302
|
+
appendDiscussionMessage(path6.join(worktree, discussion.transcriptPath), speaker, text, messageID);
|
|
12300
12303
|
discussion.appendedMessageIDs ??= [];
|
|
12301
12304
|
discussion.appendedMessageIDs.push(messageID);
|
|
12302
12305
|
saveDiscussionRegistry(worktree, registry);
|
|
12303
12306
|
}
|
|
12304
12307
|
async function summarizeDiscussionWithBA(client, worktree, discussion) {
|
|
12305
|
-
const transcriptPath =
|
|
12306
|
-
const summaryPath =
|
|
12307
|
-
const summaryDir =
|
|
12308
|
+
const transcriptPath = path6.join(worktree, discussion.transcriptPath);
|
|
12309
|
+
const summaryPath = path6.join(worktree, discussion.summaryPath);
|
|
12310
|
+
const summaryDir = path6.dirname(summaryPath);
|
|
12308
12311
|
if (!fs5.existsSync(summaryDir)) fs5.mkdirSync(summaryDir, { recursive: true });
|
|
12309
12312
|
const hasExistingSummary = fs5.existsSync(summaryPath);
|
|
12310
12313
|
const priorMtimeMs = hasExistingSummary ? fs5.statSync(summaryPath).mtimeMs : null;
|
|
@@ -12407,11 +12410,11 @@ async function summarizeDiscussionWithBA(client, worktree, discussion) {
|
|
|
12407
12410
|
return { confirmation, summaryPath, transcriptPath, hasExistingSummary, priorMtimeMs };
|
|
12408
12411
|
}
|
|
12409
12412
|
function archiveDiscussionTranscript(worktree, transcriptRelativePath) {
|
|
12410
|
-
const sourcePath =
|
|
12413
|
+
const sourcePath = path6.join(worktree, transcriptRelativePath);
|
|
12411
12414
|
if (!fs5.existsSync(sourcePath)) return null;
|
|
12412
12415
|
const archiveDir = archivedRuntimeDiscussionsDir(worktree);
|
|
12413
12416
|
if (!fs5.existsSync(archiveDir)) fs5.mkdirSync(archiveDir, { recursive: true });
|
|
12414
|
-
const targetPath =
|
|
12417
|
+
const targetPath = path6.join(archiveDir, path6.basename(sourcePath));
|
|
12415
12418
|
fs5.renameSync(sourcePath, targetPath);
|
|
12416
12419
|
return targetPath;
|
|
12417
12420
|
}
|
|
@@ -12430,7 +12433,7 @@ async function finalizeClosingDiscussion(client, worktree, registry, sessionID,
|
|
|
12430
12433
|
if (!summaryContent) {
|
|
12431
12434
|
throw new Error(`Discussion summary file is empty at ${discussion.summaryPath}`);
|
|
12432
12435
|
}
|
|
12433
|
-
const transcriptPath =
|
|
12436
|
+
const transcriptPath = path6.join(worktree, discussion.transcriptPath);
|
|
12434
12437
|
setDiscussionStatus(transcriptPath, "closed");
|
|
12435
12438
|
const archivedTranscriptPath = archiveDiscussionTranscript(worktree, discussion.transcriptPath);
|
|
12436
12439
|
delete registry.active[sessionID];
|
|
@@ -12438,7 +12441,7 @@ async function finalizeClosingDiscussion(client, worktree, registry, sessionID,
|
|
|
12438
12441
|
return {
|
|
12439
12442
|
confirmation,
|
|
12440
12443
|
summaryPath: discussion.summaryPath,
|
|
12441
|
-
archivedTranscriptPath: archivedTranscriptPath ?
|
|
12444
|
+
archivedTranscriptPath: archivedTranscriptPath ? path6.relative(worktree, archivedTranscriptPath) : path6.join(".optima", ".config", "runtime", "discussions", "archive", path6.basename(discussion.transcriptPath))
|
|
12442
12445
|
};
|
|
12443
12446
|
}
|
|
12444
12447
|
function normalizeTeamMode(value) {
|
|
@@ -12510,7 +12513,7 @@ function syncGeneratedPolicies(worktree, repoCfg) {
|
|
|
12510
12513
|
if (!fs5.existsSync(generatedDir)) fs5.mkdirSync(generatedDir, { recursive: true });
|
|
12511
12514
|
const policyFiles = fs5.readdirSync(BUNDLE_POLICIES_DIR).filter((file) => file.endsWith(".md") && file !== "README.md");
|
|
12512
12515
|
for (const file of policyFiles) {
|
|
12513
|
-
const sourcePath =
|
|
12516
|
+
const sourcePath = path6.join(BUNDLE_POLICIES_DIR, file);
|
|
12514
12517
|
const source = fs5.readFileSync(sourcePath, "utf8").trimEnd();
|
|
12515
12518
|
const generated = [
|
|
12516
12519
|
"<!--",
|
|
@@ -12522,18 +12525,18 @@ function syncGeneratedPolicies(worktree, repoCfg) {
|
|
|
12522
12525
|
source,
|
|
12523
12526
|
""
|
|
12524
12527
|
].join("\n");
|
|
12525
|
-
fs5.writeFileSync(
|
|
12528
|
+
fs5.writeFileSync(path6.join(generatedDir, file), generated, "utf8");
|
|
12526
12529
|
}
|
|
12527
12530
|
}
|
|
12528
12531
|
function ensureReadmeFile(dirPath, content) {
|
|
12529
12532
|
if (!fs5.existsSync(dirPath)) fs5.mkdirSync(dirPath, { recursive: true });
|
|
12530
|
-
const readmePath =
|
|
12533
|
+
const readmePath = path6.join(dirPath, "README.md");
|
|
12531
12534
|
if (!fs5.existsSync(readmePath)) {
|
|
12532
12535
|
fs5.writeFileSync(readmePath, content, "utf8");
|
|
12533
12536
|
}
|
|
12534
12537
|
}
|
|
12535
12538
|
function ensureFileIfMissing(filePath, content) {
|
|
12536
|
-
if (!fs5.existsSync(
|
|
12539
|
+
if (!fs5.existsSync(path6.dirname(filePath))) fs5.mkdirSync(path6.dirname(filePath), { recursive: true });
|
|
12537
12540
|
if (!fs5.existsSync(filePath)) fs5.writeFileSync(filePath, content, "utf8");
|
|
12538
12541
|
}
|
|
12539
12542
|
function currentTasksRegistryContent() {
|
|
@@ -12620,13 +12623,13 @@ Never place implementation evidence under root \`evidences/\`.
|
|
|
12620
12623
|
}
|
|
12621
12624
|
function ensureOptimaTaskTemplates(worktree) {
|
|
12622
12625
|
const tasksDir = optimaTasksDir(worktree);
|
|
12623
|
-
ensureFileIfMissing(
|
|
12624
|
-
ensureFileIfMissing(
|
|
12626
|
+
ensureFileIfMissing(path6.join(tasksDir, "task-template.md"), taskTemplateContent());
|
|
12627
|
+
ensureFileIfMissing(path6.join(tasksDir, "subtask-template.md"), subtaskTemplateContent());
|
|
12625
12628
|
}
|
|
12626
12629
|
function scaffoldOptimaConfig(worktree, teamMode = "full") {
|
|
12627
12630
|
const configPath = repoConfigPath(worktree);
|
|
12628
12631
|
if (fs5.existsSync(configPath)) return false;
|
|
12629
|
-
const templatePath =
|
|
12632
|
+
const templatePath = path6.join(TEMPLATES_DIR, "optima.yaml.template");
|
|
12630
12633
|
if (!fs5.existsSync(templatePath)) return false;
|
|
12631
12634
|
const agentIds = fs5.existsSync(BUNDLE_AGENTS_DIR) ? fs5.readdirSync(BUNDLE_AGENTS_DIR).filter((f) => f.endsWith(".md")).map((f) => f.replace(".md", "")) : [];
|
|
12632
12635
|
let optimaConfig = fs5.readFileSync(templatePath, "utf8");
|
|
@@ -12645,9 +12648,9 @@ function scaffoldOptimaConfig(worktree, teamMode = "full") {
|
|
|
12645
12648
|
function scaffoldOptimaRootCodemap(worktree) {
|
|
12646
12649
|
const rootCodemapPath = optimaCodemapPath(worktree);
|
|
12647
12650
|
if (fs5.existsSync(rootCodemapPath)) return false;
|
|
12648
|
-
const templatePath =
|
|
12651
|
+
const templatePath = path6.join(TEMPLATES_DIR, "codemap.yml.template");
|
|
12649
12652
|
if (!fs5.existsSync(templatePath)) return false;
|
|
12650
|
-
const codemapConfig = fs5.readFileSync(templatePath, "utf8").replace("{{projectName}}",
|
|
12653
|
+
const codemapConfig = fs5.readFileSync(templatePath, "utf8").replace("{{projectName}}", path6.basename(worktree));
|
|
12651
12654
|
ensureFileIfMissing(rootCodemapPath, codemapConfig);
|
|
12652
12655
|
return fs5.existsSync(rootCodemapPath);
|
|
12653
12656
|
}
|
|
@@ -12656,10 +12659,10 @@ function ensureOptimaRegistries(worktree) {
|
|
|
12656
12659
|
const scrsDir = optimaScrsDir(worktree);
|
|
12657
12660
|
if (!fs5.existsSync(tasksDir)) fs5.mkdirSync(tasksDir, { recursive: true });
|
|
12658
12661
|
if (!fs5.existsSync(scrsDir)) fs5.mkdirSync(scrsDir, { recursive: true });
|
|
12659
|
-
ensureFileIfMissing(
|
|
12660
|
-
ensureFileIfMissing(
|
|
12661
|
-
ensureFileIfMissing(
|
|
12662
|
-
ensureFileIfMissing(
|
|
12662
|
+
ensureFileIfMissing(path6.join(tasksDir, "current.md"), currentTasksRegistryContent());
|
|
12663
|
+
ensureFileIfMissing(path6.join(tasksDir, "done.md"), doneTasksRegistryContent());
|
|
12664
|
+
ensureFileIfMissing(path6.join(scrsDir, "current.md"), currentScrRegistryContent());
|
|
12665
|
+
ensureFileIfMissing(path6.join(scrsDir, "done.md"), doneScrRegistryContent());
|
|
12663
12666
|
}
|
|
12664
12667
|
function scaffoldOptimaReadmes(worktree) {
|
|
12665
12668
|
ensureReadmeFile(repoPoliciesDir(worktree), REPO_LOCAL_POLICIES_README);
|
|
@@ -12821,12 +12824,12 @@ function shouldRegisterWorkflowProductManager(options = {}, worktree = process.c
|
|
|
12821
12824
|
}
|
|
12822
12825
|
function isClickUpDerivedWorktreeSibling(candidate, basePath) {
|
|
12823
12826
|
if (typeof candidate !== "string" || typeof basePath !== "string" || !candidate.trim() || !basePath.trim()) return false;
|
|
12824
|
-
const resolvedCandidate =
|
|
12825
|
-
const resolvedBase =
|
|
12826
|
-
const baseParent =
|
|
12827
|
-
if (
|
|
12828
|
-
const baseName =
|
|
12829
|
-
const candidateName =
|
|
12827
|
+
const resolvedCandidate = path6.resolve(candidate);
|
|
12828
|
+
const resolvedBase = path6.resolve(basePath);
|
|
12829
|
+
const baseParent = path6.dirname(resolvedBase);
|
|
12830
|
+
if (path6.dirname(resolvedCandidate) !== baseParent) return false;
|
|
12831
|
+
const baseName = path6.basename(resolvedBase);
|
|
12832
|
+
const candidateName = path6.basename(resolvedCandidate);
|
|
12830
12833
|
if (!candidateName.startsWith(`${baseName}-`)) return false;
|
|
12831
12834
|
const branchSlug = candidateName.slice(baseName.length + 1);
|
|
12832
12835
|
const parts = branchSlug.split("-").filter(Boolean);
|
|
@@ -12838,7 +12841,7 @@ function isClickUpDerivedWorktreeSibling(candidate, basePath) {
|
|
|
12838
12841
|
if (!candidateStat.isDirectory() || candidateStat.isSymbolicLink()) return false;
|
|
12839
12842
|
const realCandidate = fs5.realpathSync.native(resolvedCandidate);
|
|
12840
12843
|
const realBaseParent = fs5.realpathSync.native(baseParent);
|
|
12841
|
-
return
|
|
12844
|
+
return path6.dirname(realCandidate) === realBaseParent && path6.basename(realCandidate) === candidateName;
|
|
12842
12845
|
} catch {
|
|
12843
12846
|
return false;
|
|
12844
12847
|
}
|
|
@@ -12846,15 +12849,15 @@ function isClickUpDerivedWorktreeSibling(candidate, basePath) {
|
|
|
12846
12849
|
function resolveSessionToolDirectory({ requestedDirectory, context, pluginWorktree, clickUpWebhookValidation } = {}) {
|
|
12847
12850
|
const safe = safeWorktreeOrFailure(context, pluginWorktree);
|
|
12848
12851
|
if (!safe.ok) return { ok: false, error: safe.message };
|
|
12849
|
-
const requested = String(requestedDirectory || "").trim() ?
|
|
12852
|
+
const requested = String(requestedDirectory || "").trim() ? path6.resolve(safe.worktree, String(requestedDirectory).trim()) : safe.worktree;
|
|
12850
12853
|
if (!isSafeWritableDirectory(requested)) return { ok: false, error: `Directory is not a safe writable directory: ${requested}` };
|
|
12851
12854
|
if (isSameOrNestedPath(requested, safe.worktree)) return { ok: true, directory: requested, safeWorktree: safe.worktree, scope: "context_worktree" };
|
|
12852
12855
|
const clickUpBasePath = clickUpWebhookValidation?.complete === true && clickUpWebhookValidation?.ok !== false ? clickUpWebhookValidation.config?.basePath : "";
|
|
12853
12856
|
if (clickUpBasePath && isSameOrNestedPath(requested, clickUpBasePath)) {
|
|
12854
|
-
return { ok: true, directory: requested, safeWorktree: safe.worktree, scope: "clickup_base_path", clickupBasePath:
|
|
12857
|
+
return { ok: true, directory: requested, safeWorktree: safe.worktree, scope: "clickup_base_path", clickupBasePath: path6.resolve(clickUpBasePath) };
|
|
12855
12858
|
}
|
|
12856
12859
|
if (clickUpBasePath && isClickUpDerivedWorktreeSibling(requested, clickUpBasePath)) {
|
|
12857
|
-
return { ok: true, directory: requested, safeWorktree: safe.worktree, scope: "clickup_derived_worktree", clickupBasePath:
|
|
12860
|
+
return { ok: true, directory: requested, safeWorktree: safe.worktree, scope: "clickup_derived_worktree", clickupBasePath: path6.resolve(clickUpBasePath) };
|
|
12858
12861
|
}
|
|
12859
12862
|
return {
|
|
12860
12863
|
ok: false,
|
|
@@ -12888,8 +12891,8 @@ function buildOptimaAgents(repoCfg, operatingTeamMode, worktree, debugDir, optio
|
|
|
12888
12891
|
if (!enabled) continue;
|
|
12889
12892
|
}
|
|
12890
12893
|
const promptOptions = { preferCompactPromptDocs: repoCfg.features?.compact_prompt_docs !== false };
|
|
12891
|
-
const bundledDefinition = loadAgentDefinition(
|
|
12892
|
-
const repoDefinition = loadAgentDefinition(
|
|
12894
|
+
const bundledDefinition = loadAgentDefinition(path6.join(BUNDLE_AGENTS_DIR, file), worktree, promptOptions);
|
|
12895
|
+
const repoDefinition = loadAgentDefinition(path6.join(repoAgentDefinitions, file), worktree, promptOptions) || loadAgentDefinition(path6.join(legacyAgentsDir, file), worktree, promptOptions);
|
|
12893
12896
|
const activeDefinition = repoDefinition || bundledDefinition;
|
|
12894
12897
|
if (!activeDefinition) continue;
|
|
12895
12898
|
const { data } = activeDefinition;
|
|
@@ -12898,7 +12901,7 @@ function buildOptimaAgents(repoCfg, operatingTeamMode, worktree, debugDir, optio
|
|
|
12898
12901
|
if (modePromptFragment) finalPrompt = `${finalPrompt}
|
|
12899
12902
|
|
|
12900
12903
|
${modePromptFragment}`;
|
|
12901
|
-
const additionFragment = loadMarkdownFragment(
|
|
12904
|
+
const additionFragment = loadMarkdownFragment(path6.join(repoAgentAdditions, file), worktree);
|
|
12902
12905
|
if (additionFragment) {
|
|
12903
12906
|
finalPrompt = `${finalPrompt}
|
|
12904
12907
|
|
|
@@ -12951,7 +12954,7 @@ Use this Optima-provided fallback when the current task worktree lacks docs/core
|
|
|
12951
12954
|
}
|
|
12952
12955
|
ourAgents[id] = agentConfig;
|
|
12953
12956
|
if (repoCfg.features?.debug_dumps !== false) {
|
|
12954
|
-
const debugPath =
|
|
12957
|
+
const debugPath = path6.join(debugDir, `${id}.md`);
|
|
12955
12958
|
const { prompt, ...dumpConfig } = agentConfig;
|
|
12956
12959
|
const debugHeader = `---
|
|
12957
12960
|
${import_yaml3.default.stringify(dumpConfig).trim()}
|
|
@@ -13103,8 +13106,8 @@ async function OptimaPlugin(input = {}, pluginOptions = {}) {
|
|
|
13103
13106
|
migrateLegacyOptimaLayout(toolWorktree);
|
|
13104
13107
|
const cfgDir = optimaConfigDir(toolWorktree);
|
|
13105
13108
|
if (!fs5.existsSync(cfgDir)) fs5.mkdirSync(cfgDir, { recursive: true });
|
|
13106
|
-
const optimaTmplPath =
|
|
13107
|
-
const codemapTmplPath =
|
|
13109
|
+
const optimaTmplPath = path6.join(TEMPLATES_DIR, "optima.yaml.template");
|
|
13110
|
+
const codemapTmplPath = path6.join(TEMPLATES_DIR, "codemap.yml.template");
|
|
13108
13111
|
if (!fs5.existsSync(optimaTmplPath) || !fs5.existsSync(codemapTmplPath)) {
|
|
13109
13112
|
return "Error: Initialization templates not found in plugin.";
|
|
13110
13113
|
}
|
|
@@ -13226,14 +13229,14 @@ Restart or reload OpenCode manually if the newly scaffolded config or agents are
|
|
|
13226
13229
|
async execute(args, context) {
|
|
13227
13230
|
const safe = safeWorktreeOrFailure(context, worktree);
|
|
13228
13231
|
if (!safe.ok) return safe.message;
|
|
13229
|
-
const summaryPath =
|
|
13232
|
+
const summaryPath = path6.resolve(safe.worktree, args.summary_path || "");
|
|
13230
13233
|
if (!fs5.existsSync(summaryPath)) return `FAIL: summary_path not found: ${summaryPath}`;
|
|
13231
|
-
const taskPath = args.task_path ?
|
|
13234
|
+
const taskPath = args.task_path ? path6.resolve(safe.worktree, args.task_path) : "";
|
|
13232
13235
|
const payload = buildClickUpSummaryPayload({
|
|
13233
13236
|
summaryMarkdown: fs5.readFileSync(summaryPath, "utf8"),
|
|
13234
|
-
summaryPath:
|
|
13237
|
+
summaryPath: path6.relative(safe.worktree, summaryPath),
|
|
13235
13238
|
taskMarkdown: taskPath && fs5.existsSync(taskPath) ? fs5.readFileSync(taskPath, "utf8") : "",
|
|
13236
|
-
taskPath: taskPath ?
|
|
13239
|
+
taskPath: taskPath ? path6.relative(safe.worktree, taskPath) : "",
|
|
13237
13240
|
branch: args.branch,
|
|
13238
13241
|
worktree: args.worktree,
|
|
13239
13242
|
pr: args.pr
|
|
@@ -13312,12 +13315,12 @@ Restart or reload OpenCode manually if the newly scaffolded config or agents are
|
|
|
13312
13315
|
async execute(args, context) {
|
|
13313
13316
|
const safe = safeWorktreeOrFailure(context, worktree);
|
|
13314
13317
|
if (!safe.ok) return safe.message;
|
|
13315
|
-
const markdownPath =
|
|
13318
|
+
const markdownPath = path6.resolve(safe.worktree, args.markdown_path || "");
|
|
13316
13319
|
if (!fs5.existsSync(markdownPath)) return `FAIL: markdown_path not found: ${markdownPath}`;
|
|
13317
13320
|
const payload = buildClickUpCreateSubtasksPayload({
|
|
13318
13321
|
parentTaskId: args.parent_task_id,
|
|
13319
13322
|
markdown: fs5.readFileSync(markdownPath, "utf8"),
|
|
13320
|
-
sourcePath:
|
|
13323
|
+
sourcePath: path6.relative(safe.worktree, markdownPath),
|
|
13321
13324
|
parentBranch: args.parent_branch,
|
|
13322
13325
|
parentTaskType: args.parent_task_type || "Tarea",
|
|
13323
13326
|
apply: String(args.apply || "").toLowerCase() === "true"
|
|
@@ -13516,7 +13519,7 @@ Backfilled messages: ${backfilled}`;
|
|
|
13516
13519
|
if (!existing) {
|
|
13517
13520
|
return "FAIL: No active discussion exists for this session.";
|
|
13518
13521
|
}
|
|
13519
|
-
const discussionPath =
|
|
13522
|
+
const discussionPath = path6.join(toolWorktree, existing.transcriptPath);
|
|
13520
13523
|
setDiscussionStatus(discussionPath, "summarizing");
|
|
13521
13524
|
existing.status = "summarizing";
|
|
13522
13525
|
saveDiscussionRegistry(toolWorktree, toolRegistry);
|
|
@@ -13568,7 +13571,7 @@ Reason: ${err.message}`;
|
|
|
13568
13571
|
try {
|
|
13569
13572
|
const sessionResult = await client.session.create({
|
|
13570
13573
|
query: { directory: workflowDirectory },
|
|
13571
|
-
body: { title: `Workflow Run: ${
|
|
13574
|
+
body: { title: `Workflow Run: ${path6.basename(workflowTaskPath)}` }
|
|
13572
13575
|
});
|
|
13573
13576
|
const sessionId = sessionResult.data.id;
|
|
13574
13577
|
activeWorkflows.set(sessionId, { pmaSessionId, taskPath: workflowTaskPath, track: workflowTrack, directory: workflowDirectory });
|