crewbee 0.1.4 → 0.1.6
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 +14 -2
- package/README.zh-CN.md +14 -2
- package/dist/opencode-plugin.mjs +789 -326
- package/dist/src/adapters/opencode/bootstrap.d.ts.map +1 -1
- package/dist/src/adapters/opencode/bootstrap.js +8 -51
- package/dist/src/adapters/opencode/bootstrap.js.map +1 -1
- package/dist/src/adapters/opencode/chat-message-hook.d.ts.map +1 -1
- package/dist/src/adapters/opencode/chat-message-hook.js +1 -2
- package/dist/src/adapters/opencode/chat-message-hook.js.map +1 -1
- package/dist/src/adapters/opencode/coexistence.d.ts +0 -4
- package/dist/src/adapters/opencode/coexistence.d.ts.map +1 -1
- package/dist/src/adapters/opencode/coexistence.js +0 -5
- package/dist/src/adapters/opencode/coexistence.js.map +1 -1
- package/dist/src/adapters/opencode/config-hook.d.ts.map +1 -1
- package/dist/src/adapters/opencode/config-hook.js +0 -1
- package/dist/src/adapters/opencode/config-hook.js.map +1 -1
- package/dist/src/adapters/opencode/config-merge.d.ts.map +1 -1
- package/dist/src/adapters/opencode/config-merge.js +2 -30
- package/dist/src/adapters/opencode/config-merge.js.map +1 -1
- package/dist/src/adapters/opencode/delegation/continuity.d.ts.map +1 -1
- package/dist/src/adapters/opencode/delegation/continuity.js +1 -2
- package/dist/src/adapters/opencode/delegation/continuity.js.map +1 -1
- package/dist/src/adapters/opencode/delegation/prompt.d.ts.map +1 -1
- package/dist/src/adapters/opencode/delegation/prompt.js +0 -1
- package/dist/src/adapters/opencode/delegation/prompt.js.map +1 -1
- package/dist/src/adapters/opencode/delegation/resolve-agent.d.ts +1 -1
- package/dist/src/adapters/opencode/delegation/resolve-agent.d.ts.map +1 -1
- package/dist/src/adapters/opencode/delegation/resolve-agent.js +4 -16
- package/dist/src/adapters/opencode/delegation/resolve-agent.js.map +1 -1
- package/dist/src/adapters/opencode/delegation/tools.js +10 -10
- package/dist/src/adapters/opencode/delegation/tools.js.map +1 -1
- package/dist/src/adapters/opencode/delegation/types.d.ts +3 -4
- package/dist/src/adapters/opencode/delegation/types.d.ts.map +1 -1
- package/dist/src/adapters/opencode/index.d.ts +2 -1
- package/dist/src/adapters/opencode/index.d.ts.map +1 -1
- package/dist/src/adapters/opencode/index.js +3 -5
- package/dist/src/adapters/opencode/index.js.map +1 -1
- package/dist/src/adapters/opencode/plugin.d.ts.map +1 -1
- package/dist/src/adapters/opencode/plugin.js +2 -0
- package/dist/src/adapters/opencode/plugin.js.map +1 -1
- package/dist/src/adapters/opencode/projection.d.ts +4 -11
- package/dist/src/adapters/opencode/projection.d.ts.map +1 -1
- package/dist/src/adapters/opencode/projection.js +11 -49
- package/dist/src/adapters/opencode/projection.js.map +1 -1
- package/dist/src/adapters/opencode/prompt-builder.d.ts.map +1 -1
- package/dist/src/adapters/opencode/prompt-builder.js +1 -11
- package/dist/src/adapters/opencode/prompt-builder.js.map +1 -1
- package/dist/src/agent-teams/canonical-agent-id.d.ts +12 -0
- package/dist/src/agent-teams/canonical-agent-id.d.ts.map +1 -0
- package/dist/src/agent-teams/canonical-agent-id.js +117 -0
- package/dist/src/agent-teams/canonical-agent-id.js.map +1 -0
- package/dist/src/agent-teams/embedded/coding-team/agents/coding-executor.d.ts.map +1 -1
- package/dist/src/agent-teams/embedded/coding-team/agents/coding-executor.js +0 -1
- package/dist/src/agent-teams/embedded/coding-team/agents/coding-executor.js.map +1 -1
- package/dist/src/agent-teams/embedded/coding-team/agents/coding-leader.d.ts.map +1 -1
- package/dist/src/agent-teams/embedded/coding-team/agents/coding-leader.js +0 -1
- package/dist/src/agent-teams/embedded/coding-team/agents/coding-leader.js.map +1 -1
- package/dist/src/agent-teams/embedded/coding-team/agents/coordination-leader.d.ts.map +1 -1
- package/dist/src/agent-teams/embedded/coding-team/agents/coordination-leader.js +0 -1
- package/dist/src/agent-teams/embedded/coding-team/agents/coordination-leader.js.map +1 -1
- package/dist/src/agent-teams/library.d.ts.map +1 -1
- package/dist/src/agent-teams/library.js +63 -19
- package/dist/src/agent-teams/library.js.map +1 -1
- package/dist/src/agent-teams/parsers.d.ts.map +1 -1
- package/dist/src/agent-teams/parsers.js +0 -1
- package/dist/src/agent-teams/parsers.js.map +1 -1
- package/dist/src/cli/install.js +1 -1
- package/dist/src/cli/install.js.map +1 -1
- package/dist/src/core/index.d.ts +2 -1
- package/dist/src/core/index.d.ts.map +1 -1
- package/dist/src/runtime/team-library-projection.d.ts +2 -2
- package/dist/src/runtime/team-library-projection.d.ts.map +1 -1
- package/dist/src/runtime/team-library-projection.js +8 -12
- package/dist/src/runtime/team-library-projection.js.map +1 -1
- package/dist/src/runtime/types.d.ts +1 -3
- package/dist/src/runtime/types.d.ts.map +1 -1
- package/dist/src/update/intent.d.ts +3 -0
- package/dist/src/update/intent.d.ts.map +1 -0
- package/dist/src/update/intent.js +58 -0
- package/dist/src/update/intent.js.map +1 -0
- package/dist/src/update/refresh.d.ts +6 -0
- package/dist/src/update/refresh.d.ts.map +1 -0
- package/dist/src/update/refresh.js +177 -0
- package/dist/src/update/refresh.js.map +1 -0
- package/dist/src/update/registry.d.ts +6 -0
- package/dist/src/update/registry.d.ts.map +1 -0
- package/dist/src/update/registry.js +16 -0
- package/dist/src/update/registry.js.map +1 -0
- package/dist/src/update/state.d.ts +13 -0
- package/dist/src/update/state.d.ts.map +1 -0
- package/dist/src/update/state.js +60 -0
- package/dist/src/update/state.js.map +1 -0
- package/dist/src/update/types.d.ts +20 -0
- package/dist/src/update/types.d.ts.map +1 -0
- package/dist/src/update/types.js +3 -0
- package/dist/src/update/types.js.map +1 -0
- package/dist/src/update/workspace.d.ts +7 -0
- package/dist/src/update/workspace.d.ts.map +1 -0
- package/dist/src/update/workspace.js +71 -0
- package/dist/src/update/workspace.js.map +1 -0
- package/package.json +2 -2
package/dist/opencode-plugin.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; import { fileURLToPath as __fileURLToPath } from 'node:url'; import { dirname as __pathDirname } from 'node:path'; const require = __createRequire(import.meta.url); const __dirname = __pathDirname(__fileURLToPath(import.meta.url));
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -111,17 +112,17 @@ var require_visit = __commonJS({
|
|
|
111
112
|
visit.BREAK = BREAK;
|
|
112
113
|
visit.SKIP = SKIP;
|
|
113
114
|
visit.REMOVE = REMOVE;
|
|
114
|
-
function visit_(key, node, visitor,
|
|
115
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
115
|
+
function visit_(key, node, visitor, path10) {
|
|
116
|
+
const ctrl = callVisitor(key, node, visitor, path10);
|
|
116
117
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
117
|
-
replaceNode(key,
|
|
118
|
-
return visit_(key, ctrl, visitor,
|
|
118
|
+
replaceNode(key, path10, ctrl);
|
|
119
|
+
return visit_(key, ctrl, visitor, path10);
|
|
119
120
|
}
|
|
120
121
|
if (typeof ctrl !== "symbol") {
|
|
121
122
|
if (identity.isCollection(node)) {
|
|
122
|
-
|
|
123
|
+
path10 = Object.freeze(path10.concat(node));
|
|
123
124
|
for (let i = 0; i < node.items.length; ++i) {
|
|
124
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
125
|
+
const ci = visit_(i, node.items[i], visitor, path10);
|
|
125
126
|
if (typeof ci === "number")
|
|
126
127
|
i = ci - 1;
|
|
127
128
|
else if (ci === BREAK)
|
|
@@ -132,13 +133,13 @@ var require_visit = __commonJS({
|
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
} else if (identity.isPair(node)) {
|
|
135
|
-
|
|
136
|
-
const ck = visit_("key", node.key, visitor,
|
|
136
|
+
path10 = Object.freeze(path10.concat(node));
|
|
137
|
+
const ck = visit_("key", node.key, visitor, path10);
|
|
137
138
|
if (ck === BREAK)
|
|
138
139
|
return BREAK;
|
|
139
140
|
else if (ck === REMOVE)
|
|
140
141
|
node.key = null;
|
|
141
|
-
const cv = visit_("value", node.value, visitor,
|
|
142
|
+
const cv = visit_("value", node.value, visitor, path10);
|
|
142
143
|
if (cv === BREAK)
|
|
143
144
|
return BREAK;
|
|
144
145
|
else if (cv === REMOVE)
|
|
@@ -159,17 +160,17 @@ var require_visit = __commonJS({
|
|
|
159
160
|
visitAsync.BREAK = BREAK;
|
|
160
161
|
visitAsync.SKIP = SKIP;
|
|
161
162
|
visitAsync.REMOVE = REMOVE;
|
|
162
|
-
async function visitAsync_(key, node, visitor,
|
|
163
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
163
|
+
async function visitAsync_(key, node, visitor, path10) {
|
|
164
|
+
const ctrl = await callVisitor(key, node, visitor, path10);
|
|
164
165
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
165
|
-
replaceNode(key,
|
|
166
|
-
return visitAsync_(key, ctrl, visitor,
|
|
166
|
+
replaceNode(key, path10, ctrl);
|
|
167
|
+
return visitAsync_(key, ctrl, visitor, path10);
|
|
167
168
|
}
|
|
168
169
|
if (typeof ctrl !== "symbol") {
|
|
169
170
|
if (identity.isCollection(node)) {
|
|
170
|
-
|
|
171
|
+
path10 = Object.freeze(path10.concat(node));
|
|
171
172
|
for (let i = 0; i < node.items.length; ++i) {
|
|
172
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
173
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path10);
|
|
173
174
|
if (typeof ci === "number")
|
|
174
175
|
i = ci - 1;
|
|
175
176
|
else if (ci === BREAK)
|
|
@@ -180,13 +181,13 @@ var require_visit = __commonJS({
|
|
|
180
181
|
}
|
|
181
182
|
}
|
|
182
183
|
} else if (identity.isPair(node)) {
|
|
183
|
-
|
|
184
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
184
|
+
path10 = Object.freeze(path10.concat(node));
|
|
185
|
+
const ck = await visitAsync_("key", node.key, visitor, path10);
|
|
185
186
|
if (ck === BREAK)
|
|
186
187
|
return BREAK;
|
|
187
188
|
else if (ck === REMOVE)
|
|
188
189
|
node.key = null;
|
|
189
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
190
|
+
const cv = await visitAsync_("value", node.value, visitor, path10);
|
|
190
191
|
if (cv === BREAK)
|
|
191
192
|
return BREAK;
|
|
192
193
|
else if (cv === REMOVE)
|
|
@@ -213,23 +214,23 @@ var require_visit = __commonJS({
|
|
|
213
214
|
}
|
|
214
215
|
return visitor;
|
|
215
216
|
}
|
|
216
|
-
function callVisitor(key, node, visitor,
|
|
217
|
+
function callVisitor(key, node, visitor, path10) {
|
|
217
218
|
if (typeof visitor === "function")
|
|
218
|
-
return visitor(key, node,
|
|
219
|
+
return visitor(key, node, path10);
|
|
219
220
|
if (identity.isMap(node))
|
|
220
|
-
return visitor.Map?.(key, node,
|
|
221
|
+
return visitor.Map?.(key, node, path10);
|
|
221
222
|
if (identity.isSeq(node))
|
|
222
|
-
return visitor.Seq?.(key, node,
|
|
223
|
+
return visitor.Seq?.(key, node, path10);
|
|
223
224
|
if (identity.isPair(node))
|
|
224
|
-
return visitor.Pair?.(key, node,
|
|
225
|
+
return visitor.Pair?.(key, node, path10);
|
|
225
226
|
if (identity.isScalar(node))
|
|
226
|
-
return visitor.Scalar?.(key, node,
|
|
227
|
+
return visitor.Scalar?.(key, node, path10);
|
|
227
228
|
if (identity.isAlias(node))
|
|
228
|
-
return visitor.Alias?.(key, node,
|
|
229
|
+
return visitor.Alias?.(key, node, path10);
|
|
229
230
|
return void 0;
|
|
230
231
|
}
|
|
231
|
-
function replaceNode(key,
|
|
232
|
-
const parent =
|
|
232
|
+
function replaceNode(key, path10, node) {
|
|
233
|
+
const parent = path10[path10.length - 1];
|
|
233
234
|
if (identity.isCollection(parent)) {
|
|
234
235
|
parent.items[key] = node;
|
|
235
236
|
} else if (identity.isPair(parent)) {
|
|
@@ -837,10 +838,10 @@ var require_Collection = __commonJS({
|
|
|
837
838
|
var createNode = require_createNode();
|
|
838
839
|
var identity = require_identity();
|
|
839
840
|
var Node = require_Node();
|
|
840
|
-
function collectionFromPath(schema,
|
|
841
|
+
function collectionFromPath(schema, path10, value) {
|
|
841
842
|
let v = value;
|
|
842
|
-
for (let i =
|
|
843
|
-
const k =
|
|
843
|
+
for (let i = path10.length - 1; i >= 0; --i) {
|
|
844
|
+
const k = path10[i];
|
|
844
845
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
845
846
|
const a = [];
|
|
846
847
|
a[k] = v;
|
|
@@ -859,7 +860,7 @@ var require_Collection = __commonJS({
|
|
|
859
860
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
860
861
|
});
|
|
861
862
|
}
|
|
862
|
-
var isEmptyPath = (
|
|
863
|
+
var isEmptyPath = (path10) => path10 == null || typeof path10 === "object" && !!path10[Symbol.iterator]().next().done;
|
|
863
864
|
var Collection = class extends Node.NodeBase {
|
|
864
865
|
constructor(type, schema) {
|
|
865
866
|
super(type);
|
|
@@ -889,11 +890,11 @@ var require_Collection = __commonJS({
|
|
|
889
890
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
890
891
|
* that already exists in the map.
|
|
891
892
|
*/
|
|
892
|
-
addIn(
|
|
893
|
-
if (isEmptyPath(
|
|
893
|
+
addIn(path10, value) {
|
|
894
|
+
if (isEmptyPath(path10))
|
|
894
895
|
this.add(value);
|
|
895
896
|
else {
|
|
896
|
-
const [key, ...rest] =
|
|
897
|
+
const [key, ...rest] = path10;
|
|
897
898
|
const node = this.get(key, true);
|
|
898
899
|
if (identity.isCollection(node))
|
|
899
900
|
node.addIn(rest, value);
|
|
@@ -907,8 +908,8 @@ var require_Collection = __commonJS({
|
|
|
907
908
|
* Removes a value from the collection.
|
|
908
909
|
* @returns `true` if the item was found and removed.
|
|
909
910
|
*/
|
|
910
|
-
deleteIn(
|
|
911
|
-
const [key, ...rest] =
|
|
911
|
+
deleteIn(path10) {
|
|
912
|
+
const [key, ...rest] = path10;
|
|
912
913
|
if (rest.length === 0)
|
|
913
914
|
return this.delete(key);
|
|
914
915
|
const node = this.get(key, true);
|
|
@@ -922,8 +923,8 @@ var require_Collection = __commonJS({
|
|
|
922
923
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
923
924
|
* `true` (collections are always returned intact).
|
|
924
925
|
*/
|
|
925
|
-
getIn(
|
|
926
|
-
const [key, ...rest] =
|
|
926
|
+
getIn(path10, keepScalar) {
|
|
927
|
+
const [key, ...rest] = path10;
|
|
927
928
|
const node = this.get(key, true);
|
|
928
929
|
if (rest.length === 0)
|
|
929
930
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -941,8 +942,8 @@ var require_Collection = __commonJS({
|
|
|
941
942
|
/**
|
|
942
943
|
* Checks if the collection includes a value with the key `key`.
|
|
943
944
|
*/
|
|
944
|
-
hasIn(
|
|
945
|
-
const [key, ...rest] =
|
|
945
|
+
hasIn(path10) {
|
|
946
|
+
const [key, ...rest] = path10;
|
|
946
947
|
if (rest.length === 0)
|
|
947
948
|
return this.has(key);
|
|
948
949
|
const node = this.get(key, true);
|
|
@@ -952,8 +953,8 @@ var require_Collection = __commonJS({
|
|
|
952
953
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
953
954
|
* boolean to add/remove the item from the set.
|
|
954
955
|
*/
|
|
955
|
-
setIn(
|
|
956
|
-
const [key, ...rest] =
|
|
956
|
+
setIn(path10, value) {
|
|
957
|
+
const [key, ...rest] = path10;
|
|
957
958
|
if (rest.length === 0) {
|
|
958
959
|
this.set(key, value);
|
|
959
960
|
} else {
|
|
@@ -3457,9 +3458,9 @@ var require_Document = __commonJS({
|
|
|
3457
3458
|
this.contents.add(value);
|
|
3458
3459
|
}
|
|
3459
3460
|
/** Adds a value to the document. */
|
|
3460
|
-
addIn(
|
|
3461
|
+
addIn(path10, value) {
|
|
3461
3462
|
if (assertCollection(this.contents))
|
|
3462
|
-
this.contents.addIn(
|
|
3463
|
+
this.contents.addIn(path10, value);
|
|
3463
3464
|
}
|
|
3464
3465
|
/**
|
|
3465
3466
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3534,14 +3535,14 @@ var require_Document = __commonJS({
|
|
|
3534
3535
|
* Removes a value from the document.
|
|
3535
3536
|
* @returns `true` if the item was found and removed.
|
|
3536
3537
|
*/
|
|
3537
|
-
deleteIn(
|
|
3538
|
-
if (Collection.isEmptyPath(
|
|
3538
|
+
deleteIn(path10) {
|
|
3539
|
+
if (Collection.isEmptyPath(path10)) {
|
|
3539
3540
|
if (this.contents == null)
|
|
3540
3541
|
return false;
|
|
3541
3542
|
this.contents = null;
|
|
3542
3543
|
return true;
|
|
3543
3544
|
}
|
|
3544
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3545
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path10) : false;
|
|
3545
3546
|
}
|
|
3546
3547
|
/**
|
|
3547
3548
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3556,10 +3557,10 @@ var require_Document = __commonJS({
|
|
|
3556
3557
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3557
3558
|
* `true` (collections are always returned intact).
|
|
3558
3559
|
*/
|
|
3559
|
-
getIn(
|
|
3560
|
-
if (Collection.isEmptyPath(
|
|
3560
|
+
getIn(path10, keepScalar) {
|
|
3561
|
+
if (Collection.isEmptyPath(path10))
|
|
3561
3562
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3562
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
3563
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path10, keepScalar) : void 0;
|
|
3563
3564
|
}
|
|
3564
3565
|
/**
|
|
3565
3566
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3570,10 +3571,10 @@ var require_Document = __commonJS({
|
|
|
3570
3571
|
/**
|
|
3571
3572
|
* Checks if the document includes a value at `path`.
|
|
3572
3573
|
*/
|
|
3573
|
-
hasIn(
|
|
3574
|
-
if (Collection.isEmptyPath(
|
|
3574
|
+
hasIn(path10) {
|
|
3575
|
+
if (Collection.isEmptyPath(path10))
|
|
3575
3576
|
return this.contents !== void 0;
|
|
3576
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
3577
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path10) : false;
|
|
3577
3578
|
}
|
|
3578
3579
|
/**
|
|
3579
3580
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3590,13 +3591,13 @@ var require_Document = __commonJS({
|
|
|
3590
3591
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3591
3592
|
* boolean to add/remove the item from the set.
|
|
3592
3593
|
*/
|
|
3593
|
-
setIn(
|
|
3594
|
-
if (Collection.isEmptyPath(
|
|
3594
|
+
setIn(path10, value) {
|
|
3595
|
+
if (Collection.isEmptyPath(path10)) {
|
|
3595
3596
|
this.contents = value;
|
|
3596
3597
|
} else if (this.contents == null) {
|
|
3597
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
3598
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path10), value);
|
|
3598
3599
|
} else if (assertCollection(this.contents)) {
|
|
3599
|
-
this.contents.setIn(
|
|
3600
|
+
this.contents.setIn(path10, value);
|
|
3600
3601
|
}
|
|
3601
3602
|
}
|
|
3602
3603
|
/**
|
|
@@ -5548,9 +5549,9 @@ var require_cst_visit = __commonJS({
|
|
|
5548
5549
|
visit.BREAK = BREAK;
|
|
5549
5550
|
visit.SKIP = SKIP;
|
|
5550
5551
|
visit.REMOVE = REMOVE;
|
|
5551
|
-
visit.itemAtPath = (cst,
|
|
5552
|
+
visit.itemAtPath = (cst, path10) => {
|
|
5552
5553
|
let item = cst;
|
|
5553
|
-
for (const [field, index] of
|
|
5554
|
+
for (const [field, index] of path10) {
|
|
5554
5555
|
const tok = item?.[field];
|
|
5555
5556
|
if (tok && "items" in tok) {
|
|
5556
5557
|
item = tok.items[index];
|
|
@@ -5559,23 +5560,23 @@ var require_cst_visit = __commonJS({
|
|
|
5559
5560
|
}
|
|
5560
5561
|
return item;
|
|
5561
5562
|
};
|
|
5562
|
-
visit.parentCollection = (cst,
|
|
5563
|
-
const parent = visit.itemAtPath(cst,
|
|
5564
|
-
const field =
|
|
5563
|
+
visit.parentCollection = (cst, path10) => {
|
|
5564
|
+
const parent = visit.itemAtPath(cst, path10.slice(0, -1));
|
|
5565
|
+
const field = path10[path10.length - 1][0];
|
|
5565
5566
|
const coll = parent?.[field];
|
|
5566
5567
|
if (coll && "items" in coll)
|
|
5567
5568
|
return coll;
|
|
5568
5569
|
throw new Error("Parent collection not found");
|
|
5569
5570
|
};
|
|
5570
|
-
function _visit(
|
|
5571
|
-
let ctrl = visitor(item,
|
|
5571
|
+
function _visit(path10, item, visitor) {
|
|
5572
|
+
let ctrl = visitor(item, path10);
|
|
5572
5573
|
if (typeof ctrl === "symbol")
|
|
5573
5574
|
return ctrl;
|
|
5574
5575
|
for (const field of ["key", "value"]) {
|
|
5575
5576
|
const token = item[field];
|
|
5576
5577
|
if (token && "items" in token) {
|
|
5577
5578
|
for (let i = 0; i < token.items.length; ++i) {
|
|
5578
|
-
const ci = _visit(Object.freeze(
|
|
5579
|
+
const ci = _visit(Object.freeze(path10.concat([[field, i]])), token.items[i], visitor);
|
|
5579
5580
|
if (typeof ci === "number")
|
|
5580
5581
|
i = ci - 1;
|
|
5581
5582
|
else if (ci === BREAK)
|
|
@@ -5586,10 +5587,10 @@ var require_cst_visit = __commonJS({
|
|
|
5586
5587
|
}
|
|
5587
5588
|
}
|
|
5588
5589
|
if (typeof ctrl === "function" && field === "key")
|
|
5589
|
-
ctrl = ctrl(item,
|
|
5590
|
+
ctrl = ctrl(item, path10);
|
|
5590
5591
|
}
|
|
5591
5592
|
}
|
|
5592
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5593
|
+
return typeof ctrl === "function" ? ctrl(item, path10) : ctrl;
|
|
5593
5594
|
}
|
|
5594
5595
|
exports.visit = visit;
|
|
5595
5596
|
}
|
|
@@ -7872,7 +7873,6 @@ function createCoordinationLeaderAgent() {
|
|
|
7872
7873
|
},
|
|
7873
7874
|
entryPoint: {
|
|
7874
7875
|
exposure: "user-selectable",
|
|
7875
|
-
selectionLabel: "coordination-leader",
|
|
7876
7876
|
selectionDescription: "CodingTeam \u7684\u534F\u8C03\u578B Leader \u6295\u5F71\uFF1B\u9002\u5408\u9AD8\u6A21\u7CCA\u3001\u8303\u56F4\u5F85\u6536\u675F\u3001\u591A\u5B50\u4EFB\u52A1\u7F16\u6392\u7684\u5F00\u5C40\u8DEF\u5F84\u3002",
|
|
7877
7877
|
selectionPriority: 1
|
|
7878
7878
|
},
|
|
@@ -8110,7 +8110,6 @@ function createCodingExecutorAgent() {
|
|
|
8110
8110
|
},
|
|
8111
8111
|
entryPoint: {
|
|
8112
8112
|
exposure: "user-selectable",
|
|
8113
|
-
selectionLabel: "executor",
|
|
8114
8113
|
selectionDescription: "CodingTeam \u7684\u76F4\u63A5\u6267\u884C\u5165\u53E3\uFF1B\u9002\u5408\u8FB9\u754C\u6E05\u6670\u3001\u5E0C\u671B\u76F4\u63A5\u8FDB\u5165\u5B9E\u73B0\u95ED\u73AF\u7684\u7528\u6237\u8DEF\u5F84\u3002",
|
|
8115
8114
|
selectionPriority: 2
|
|
8116
8115
|
}
|
|
@@ -8423,7 +8422,6 @@ function createCodingLeaderAgent() {
|
|
|
8423
8422
|
},
|
|
8424
8423
|
entryPoint: {
|
|
8425
8424
|
exposure: "user-selectable",
|
|
8426
|
-
selectionLabel: "leader",
|
|
8427
8425
|
selectionDescription: "CodingTeam \u7684\u9ED8\u8BA4\u4E3B\u6267\u884C Leader\uFF1B\u5728 OpenCode \u4E2D\u9009\u62E9\u5B83\uFF0C\u5C31\u8FDB\u5165\u4EE5 coding-leader \u4E3A\u4E3B owner \u7684 CodingTeam \u8DEF\u5F84\u3002",
|
|
8428
8426
|
selectionPriority: 0
|
|
8429
8427
|
},
|
|
@@ -9671,6 +9669,18 @@ function resolveOpenCodeConfigRoot(configPath) {
|
|
|
9671
9669
|
}
|
|
9672
9670
|
return crossPlatformRoot;
|
|
9673
9671
|
}
|
|
9672
|
+
function resolveOpenCodeConfigPath(configPath) {
|
|
9673
|
+
if (configPath) {
|
|
9674
|
+
return path2.resolve(configPath);
|
|
9675
|
+
}
|
|
9676
|
+
const configRoot = resolveOpenCodeConfigRoot();
|
|
9677
|
+
const jsoncPath = path2.join(configRoot, "opencode.jsonc");
|
|
9678
|
+
const jsonPath = path2.join(configRoot, "opencode.json");
|
|
9679
|
+
if (existsSync2(jsoncPath)) {
|
|
9680
|
+
return jsoncPath;
|
|
9681
|
+
}
|
|
9682
|
+
return jsonPath;
|
|
9683
|
+
}
|
|
9674
9684
|
function resolveInstallRoot(installRoot) {
|
|
9675
9685
|
if (installRoot) {
|
|
9676
9686
|
return path2.resolve(installRoot);
|
|
@@ -9735,9 +9745,9 @@ function normalizeProjectionPathList(value, label) {
|
|
|
9735
9745
|
if (!normalized) {
|
|
9736
9746
|
return void 0;
|
|
9737
9747
|
}
|
|
9738
|
-
for (const
|
|
9739
|
-
if (!isSnakeCasePath(
|
|
9740
|
-
throw new Error(`${label} only supports snake_case paths. Migrate '${
|
|
9748
|
+
for (const path10 of normalized) {
|
|
9749
|
+
if (!isSnakeCasePath(path10)) {
|
|
9750
|
+
throw new Error(`${label} only supports snake_case paths. Migrate '${path10}' to snake_case.`);
|
|
9741
9751
|
}
|
|
9742
9752
|
}
|
|
9743
9753
|
return normalized;
|
|
@@ -10204,7 +10214,6 @@ function mapEntryPoint(raw) {
|
|
|
10204
10214
|
}
|
|
10205
10215
|
return {
|
|
10206
10216
|
exposure: asString(raw.exposure, "entry_point.exposure"),
|
|
10207
|
-
selectionLabel: asOptionalString(raw.selection_label ?? raw.selectionLabel),
|
|
10208
10217
|
selectionDescription: asOptionalString(raw.selection_description ?? raw.selectionDescription),
|
|
10209
10218
|
selectionPriority: asOptionalNumber(raw.selection_priority ?? raw.selectionPriority, "entry_point.selection_priority")
|
|
10210
10219
|
};
|
|
@@ -10765,6 +10774,114 @@ function loadTeamDefinitionFromDirectory(teamDir, workspaceRoot = process.cwd())
|
|
|
10765
10774
|
// src/agent-teams/library.ts
|
|
10766
10775
|
import path4 from "node:path";
|
|
10767
10776
|
|
|
10777
|
+
// src/agent-teams/canonical-agent-id.ts
|
|
10778
|
+
function sanitizeSegment(value) {
|
|
10779
|
+
return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-");
|
|
10780
|
+
}
|
|
10781
|
+
function resolveTeamStem(teamId) {
|
|
10782
|
+
const normalized = sanitizeSegment(teamId);
|
|
10783
|
+
return normalized.endsWith("-team") ? normalized.slice(0, -5) : normalized;
|
|
10784
|
+
}
|
|
10785
|
+
function resolveAgentSlug(agentId) {
|
|
10786
|
+
return sanitizeSegment(agentId);
|
|
10787
|
+
}
|
|
10788
|
+
function createCanonicalAgentId(teamId, agentId) {
|
|
10789
|
+
const teamStem = resolveTeamStem(teamId);
|
|
10790
|
+
const agentSlug = resolveAgentSlug(agentId);
|
|
10791
|
+
if (!teamStem) {
|
|
10792
|
+
return agentSlug;
|
|
10793
|
+
}
|
|
10794
|
+
return agentSlug === teamStem || agentSlug.startsWith(`${teamStem}-`) ? agentSlug : `${teamStem}-${agentSlug}`;
|
|
10795
|
+
}
|
|
10796
|
+
function createFallbackCanonicalAgentId(teamId, agentId) {
|
|
10797
|
+
return `${sanitizeSegment(teamId)}-${resolveAgentSlug(agentId)}`;
|
|
10798
|
+
}
|
|
10799
|
+
function rewriteBinding(binding3, agentIdMap) {
|
|
10800
|
+
if (typeof binding3 === "string") {
|
|
10801
|
+
return agentIdMap.get(binding3) ?? binding3;
|
|
10802
|
+
}
|
|
10803
|
+
return {
|
|
10804
|
+
...binding3,
|
|
10805
|
+
agentRef: agentIdMap.get(binding3.agentRef) ?? binding3.agentRef
|
|
10806
|
+
};
|
|
10807
|
+
}
|
|
10808
|
+
function normalizeTeamAgentIds(input) {
|
|
10809
|
+
const issues = [];
|
|
10810
|
+
const nextUsedIds = new Set(input.usedCanonicalIds);
|
|
10811
|
+
const localAssignedIds = /* @__PURE__ */ new Set();
|
|
10812
|
+
const agentIdMap = /* @__PURE__ */ new Map();
|
|
10813
|
+
for (const agent of input.team.agents) {
|
|
10814
|
+
const sourceId = agent.metadata.id;
|
|
10815
|
+
const candidate = createCanonicalAgentId(input.team.manifest.id, sourceId);
|
|
10816
|
+
const fallback = createFallbackCanonicalAgentId(input.team.manifest.id, sourceId);
|
|
10817
|
+
let assigned = candidate;
|
|
10818
|
+
if (nextUsedIds.has(assigned) || localAssignedIds.has(assigned)) {
|
|
10819
|
+
assigned = fallback;
|
|
10820
|
+
}
|
|
10821
|
+
if (nextUsedIds.has(assigned) || localAssignedIds.has(assigned)) {
|
|
10822
|
+
issues.push({
|
|
10823
|
+
level: "error",
|
|
10824
|
+
message: `Team '${input.team.manifest.id}' cannot assign a unique canonicalAgentId for source agent '${sourceId}'. Candidate '${candidate}' and fallback '${fallback}' both collide.`
|
|
10825
|
+
});
|
|
10826
|
+
return { issues };
|
|
10827
|
+
}
|
|
10828
|
+
agentIdMap.set(sourceId, assigned);
|
|
10829
|
+
localAssignedIds.add(assigned);
|
|
10830
|
+
nextUsedIds.add(assigned);
|
|
10831
|
+
}
|
|
10832
|
+
const normalizedTeam = {
|
|
10833
|
+
...input.team,
|
|
10834
|
+
manifest: {
|
|
10835
|
+
...input.team.manifest,
|
|
10836
|
+
leader: {
|
|
10837
|
+
...input.team.manifest.leader,
|
|
10838
|
+
agentRef: agentIdMap.get(input.team.manifest.leader.agentRef) ?? input.team.manifest.leader.agentRef
|
|
10839
|
+
},
|
|
10840
|
+
members: Object.fromEntries(
|
|
10841
|
+
Object.entries(input.team.manifest.members).map(([agentId, guidance]) => [
|
|
10842
|
+
agentIdMap.get(agentId) ?? agentId,
|
|
10843
|
+
guidance
|
|
10844
|
+
])
|
|
10845
|
+
),
|
|
10846
|
+
agentRuntime: input.team.manifest.agentRuntime ? Object.fromEntries(
|
|
10847
|
+
Object.entries(input.team.manifest.agentRuntime).map(([agentId, runtime]) => [
|
|
10848
|
+
agentIdMap.get(agentId) ?? agentId,
|
|
10849
|
+
runtime
|
|
10850
|
+
])
|
|
10851
|
+
) : void 0
|
|
10852
|
+
},
|
|
10853
|
+
agents: input.team.agents.map((agent) => {
|
|
10854
|
+
const canonicalAgentId = agentIdMap.get(agent.metadata.id) ?? agent.metadata.id;
|
|
10855
|
+
return {
|
|
10856
|
+
...agent,
|
|
10857
|
+
canonicalAgentId,
|
|
10858
|
+
metadata: {
|
|
10859
|
+
...agent.metadata,
|
|
10860
|
+
id: canonicalAgentId,
|
|
10861
|
+
sourceId: agent.metadata.sourceId ?? agent.metadata.id,
|
|
10862
|
+
name: canonicalAgentId
|
|
10863
|
+
},
|
|
10864
|
+
collaboration: {
|
|
10865
|
+
defaultConsults: agent.collaboration.defaultConsults.map((binding3) => rewriteBinding(binding3, agentIdMap)),
|
|
10866
|
+
defaultHandoffs: agent.collaboration.defaultHandoffs.map((binding3) => rewriteBinding(binding3, agentIdMap))
|
|
10867
|
+
},
|
|
10868
|
+
entryPoint: agent.entryPoint ? {
|
|
10869
|
+
...agent.entryPoint,
|
|
10870
|
+
selectionLabel: canonicalAgentId
|
|
10871
|
+
} : agent.entryPoint
|
|
10872
|
+
};
|
|
10873
|
+
})
|
|
10874
|
+
};
|
|
10875
|
+
input.usedCanonicalIds.clear();
|
|
10876
|
+
for (const usedId of nextUsedIds) {
|
|
10877
|
+
input.usedCanonicalIds.add(usedId);
|
|
10878
|
+
}
|
|
10879
|
+
return {
|
|
10880
|
+
team: normalizedTeam,
|
|
10881
|
+
issues
|
|
10882
|
+
};
|
|
10883
|
+
}
|
|
10884
|
+
|
|
10768
10885
|
// src/agent-teams/validation.ts
|
|
10769
10886
|
function getBindingAgentRef(binding3) {
|
|
10770
10887
|
return typeof binding3 === "string" ? binding3 : binding3.agentRef;
|
|
@@ -10898,30 +11015,9 @@ function createSkippedTeamIssue(teamDir, message) {
|
|
|
10898
11015
|
message: `Skipped Team '${path4.basename(teamDir)}': ${message}`
|
|
10899
11016
|
};
|
|
10900
11017
|
}
|
|
10901
|
-
function loadValidatedTeamDefinition(input) {
|
|
10902
|
-
try {
|
|
10903
|
-
const team = loadTeamDefinitionFromDirectory(input.teamDir, input.workspaceRoot);
|
|
10904
|
-
const issues = validateTeamDefinition(team);
|
|
10905
|
-
const errors = issues.filter((issue2) => issue2.level === "error");
|
|
10906
|
-
if (errors.length > 0) {
|
|
10907
|
-
return {
|
|
10908
|
-
issues: errors.map((issue2) => createSkippedTeamIssue(input.teamDir, issue2.message))
|
|
10909
|
-
};
|
|
10910
|
-
}
|
|
10911
|
-
return {
|
|
10912
|
-
team,
|
|
10913
|
-
issues: issues.filter((issue2) => issue2.level === "warning")
|
|
10914
|
-
};
|
|
10915
|
-
} catch (error45) {
|
|
10916
|
-
const message = error45 instanceof Error ? error45.message : String(error45);
|
|
10917
|
-
return {
|
|
10918
|
-
issues: [createSkippedTeamIssue(input.teamDir, message)]
|
|
10919
|
-
};
|
|
10920
|
-
}
|
|
10921
|
-
}
|
|
10922
11018
|
function loadDefaultTeamLibrary(baseDir = process.cwd()) {
|
|
10923
11019
|
const configured = listConfiguredTeamSources();
|
|
10924
|
-
const
|
|
11020
|
+
const pendingTeams = [];
|
|
10925
11021
|
for (const source of configured.sources) {
|
|
10926
11022
|
if (!source.enabled) {
|
|
10927
11023
|
continue;
|
|
@@ -10932,37 +11028,68 @@ function loadDefaultTeamLibrary(baseDir = process.cwd()) {
|
|
|
10932
11028
|
if (!embeddedTeam.team) {
|
|
10933
11029
|
continue;
|
|
10934
11030
|
}
|
|
10935
|
-
|
|
10936
|
-
team: embeddedTeam.team,
|
|
11031
|
+
pendingTeams.push({
|
|
11032
|
+
loader: () => ({ team: embeddedTeam.team, issues: [] }),
|
|
10937
11033
|
priority: source.priority,
|
|
10938
11034
|
order: source.order
|
|
10939
11035
|
});
|
|
10940
11036
|
continue;
|
|
10941
11037
|
}
|
|
10942
|
-
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
11038
|
+
pendingTeams.push({
|
|
11039
|
+
loader: () => {
|
|
11040
|
+
try {
|
|
11041
|
+
return {
|
|
11042
|
+
team: loadTeamDefinitionFromDirectory(source.teamDir, baseDir),
|
|
11043
|
+
issues: []
|
|
11044
|
+
};
|
|
11045
|
+
} catch (error45) {
|
|
11046
|
+
const message = error45 instanceof Error ? error45.message : String(error45);
|
|
11047
|
+
return {
|
|
11048
|
+
issues: [createSkippedTeamIssue(source.teamDir, message)]
|
|
11049
|
+
};
|
|
11050
|
+
}
|
|
11051
|
+
},
|
|
10952
11052
|
priority: source.priority,
|
|
10953
11053
|
order: source.order
|
|
10954
11054
|
});
|
|
10955
11055
|
}
|
|
10956
|
-
|
|
11056
|
+
pendingTeams.sort((left, right) => {
|
|
10957
11057
|
const priorityOrder = left.priority - right.priority;
|
|
10958
11058
|
if (priorityOrder !== 0) {
|
|
10959
11059
|
return priorityOrder;
|
|
10960
11060
|
}
|
|
10961
11061
|
return left.order - right.order;
|
|
10962
11062
|
});
|
|
11063
|
+
const usedCanonicalIds = /* @__PURE__ */ new Set();
|
|
11064
|
+
const orderedTeams = [];
|
|
11065
|
+
for (const entry of pendingTeams) {
|
|
11066
|
+
const loaded = entry.loader();
|
|
11067
|
+
configured.issues.push(...loaded.issues);
|
|
11068
|
+
if (loaded.team) {
|
|
11069
|
+
const normalized = normalizeTeamAgentIds({
|
|
11070
|
+
team: loaded.team,
|
|
11071
|
+
usedCanonicalIds
|
|
11072
|
+
});
|
|
11073
|
+
configured.issues.push(...normalized.issues);
|
|
11074
|
+
if (normalized.team) {
|
|
11075
|
+
const validationIssues = validateTeamDefinition(normalized.team);
|
|
11076
|
+
const errors = validationIssues.filter((issue2) => issue2.level === "error");
|
|
11077
|
+
if (errors.length > 0) {
|
|
11078
|
+
configured.issues.push(...errors.map((issue2) => ({
|
|
11079
|
+
level: "warning",
|
|
11080
|
+
filePath: issue2.filePath,
|
|
11081
|
+
message: `Skipped Team '${normalized.team?.manifest.id ?? "unknown"}': ${issue2.message}`
|
|
11082
|
+
})));
|
|
11083
|
+
continue;
|
|
11084
|
+
}
|
|
11085
|
+
configured.issues.push(...validationIssues.filter((issue2) => issue2.level === "warning"));
|
|
11086
|
+
orderedTeams.push(normalized.team);
|
|
11087
|
+
}
|
|
11088
|
+
}
|
|
11089
|
+
}
|
|
10963
11090
|
return {
|
|
10964
11091
|
version: "config-driven-v1",
|
|
10965
|
-
teams: orderedTeams
|
|
11092
|
+
teams: orderedTeams,
|
|
10966
11093
|
loadIssues: configured.issues
|
|
10967
11094
|
};
|
|
10968
11095
|
}
|
|
@@ -10982,13 +11109,141 @@ function loadEmbeddedTeam(source) {
|
|
|
10982
11109
|
};
|
|
10983
11110
|
}
|
|
10984
11111
|
|
|
11112
|
+
// src/install/config-writer.ts
|
|
11113
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "node:fs";
|
|
11114
|
+
|
|
11115
|
+
// src/install/jsonc.ts
|
|
11116
|
+
function parseJsoncText(text) {
|
|
11117
|
+
const stripped = stripJsonComments(text);
|
|
11118
|
+
const normalized = stripTrailingCommas(stripped).trim();
|
|
11119
|
+
if (normalized.length === 0) {
|
|
11120
|
+
return {};
|
|
11121
|
+
}
|
|
11122
|
+
const parsed = JSON.parse(normalized);
|
|
11123
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
11124
|
+
throw new Error("OpenCode config must be a JSON object.");
|
|
11125
|
+
}
|
|
11126
|
+
return parsed;
|
|
11127
|
+
}
|
|
11128
|
+
function stripJsonComments(text) {
|
|
11129
|
+
let result = "";
|
|
11130
|
+
let inString = false;
|
|
11131
|
+
let escaped = false;
|
|
11132
|
+
let lineComment = false;
|
|
11133
|
+
let blockComment = false;
|
|
11134
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
11135
|
+
const current = text[index];
|
|
11136
|
+
const next = text[index + 1];
|
|
11137
|
+
if (lineComment) {
|
|
11138
|
+
if (current === "\n") {
|
|
11139
|
+
lineComment = false;
|
|
11140
|
+
result += current;
|
|
11141
|
+
}
|
|
11142
|
+
continue;
|
|
11143
|
+
}
|
|
11144
|
+
if (blockComment) {
|
|
11145
|
+
if (current === "*" && next === "/") {
|
|
11146
|
+
blockComment = false;
|
|
11147
|
+
index += 1;
|
|
11148
|
+
}
|
|
11149
|
+
continue;
|
|
11150
|
+
}
|
|
11151
|
+
if (inString) {
|
|
11152
|
+
result += current;
|
|
11153
|
+
if (escaped) {
|
|
11154
|
+
escaped = false;
|
|
11155
|
+
continue;
|
|
11156
|
+
}
|
|
11157
|
+
if (current === "\\") {
|
|
11158
|
+
escaped = true;
|
|
11159
|
+
continue;
|
|
11160
|
+
}
|
|
11161
|
+
if (current === '"') {
|
|
11162
|
+
inString = false;
|
|
11163
|
+
}
|
|
11164
|
+
continue;
|
|
11165
|
+
}
|
|
11166
|
+
if (current === '"') {
|
|
11167
|
+
inString = true;
|
|
11168
|
+
result += current;
|
|
11169
|
+
continue;
|
|
11170
|
+
}
|
|
11171
|
+
if (current === "/" && next === "/") {
|
|
11172
|
+
lineComment = true;
|
|
11173
|
+
index += 1;
|
|
11174
|
+
continue;
|
|
11175
|
+
}
|
|
11176
|
+
if (current === "/" && next === "*") {
|
|
11177
|
+
blockComment = true;
|
|
11178
|
+
index += 1;
|
|
11179
|
+
continue;
|
|
11180
|
+
}
|
|
11181
|
+
result += current;
|
|
11182
|
+
}
|
|
11183
|
+
return result;
|
|
11184
|
+
}
|
|
11185
|
+
function stripTrailingCommas(text) {
|
|
11186
|
+
let result = "";
|
|
11187
|
+
let inString = false;
|
|
11188
|
+
let escaped = false;
|
|
11189
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
11190
|
+
const current = text[index];
|
|
11191
|
+
if (inString) {
|
|
11192
|
+
result += current;
|
|
11193
|
+
if (escaped) {
|
|
11194
|
+
escaped = false;
|
|
11195
|
+
continue;
|
|
11196
|
+
}
|
|
11197
|
+
if (current === "\\") {
|
|
11198
|
+
escaped = true;
|
|
11199
|
+
continue;
|
|
11200
|
+
}
|
|
11201
|
+
if (current === '"') {
|
|
11202
|
+
inString = false;
|
|
11203
|
+
}
|
|
11204
|
+
continue;
|
|
11205
|
+
}
|
|
11206
|
+
if (current === '"') {
|
|
11207
|
+
inString = true;
|
|
11208
|
+
result += current;
|
|
11209
|
+
continue;
|
|
11210
|
+
}
|
|
11211
|
+
if (current === "," && findNextNonWhitespaceCharacter(text, index + 1)?.match(/[}\]]/)) {
|
|
11212
|
+
continue;
|
|
11213
|
+
}
|
|
11214
|
+
result += current;
|
|
11215
|
+
}
|
|
11216
|
+
return result;
|
|
11217
|
+
}
|
|
11218
|
+
function findNextNonWhitespaceCharacter(text, startIndex) {
|
|
11219
|
+
for (let index = startIndex; index < text.length; index += 1) {
|
|
11220
|
+
if (!/\s/.test(text[index])) {
|
|
11221
|
+
return text[index];
|
|
11222
|
+
}
|
|
11223
|
+
}
|
|
11224
|
+
return void 0;
|
|
11225
|
+
}
|
|
11226
|
+
|
|
11227
|
+
// src/install/config-writer.ts
|
|
11228
|
+
function readOpenCodeConfig(configPath) {
|
|
11229
|
+
if (!existsSync4(configPath)) {
|
|
11230
|
+
return {
|
|
11231
|
+
config: {},
|
|
11232
|
+
existed: false,
|
|
11233
|
+
path: configPath
|
|
11234
|
+
};
|
|
11235
|
+
}
|
|
11236
|
+
return {
|
|
11237
|
+
config: parseJsoncText(readFileSync3(configPath, "utf8")),
|
|
11238
|
+
existed: true,
|
|
11239
|
+
path: configPath
|
|
11240
|
+
};
|
|
11241
|
+
}
|
|
11242
|
+
|
|
10985
11243
|
// src/runtime/team-library-projection.ts
|
|
10986
11244
|
function isLeaderAgent(team, agent) {
|
|
10987
11245
|
return team.manifest.leader.agentRef === agent.metadata.id;
|
|
10988
11246
|
}
|
|
10989
|
-
function getSurfaceLabel(agent) {
|
|
10990
|
-
return agent.entryPoint?.selectionLabel ?? agent.metadata.id;
|
|
10991
|
-
}
|
|
10992
11247
|
function getExposure(agent) {
|
|
10993
11248
|
return agent.entryPoint?.exposure ?? "internal-only";
|
|
10994
11249
|
}
|
|
@@ -11016,15 +11271,15 @@ function sortTeamAgents(team) {
|
|
|
11016
11271
|
}
|
|
11017
11272
|
function createProjectedAgent(team, agent) {
|
|
11018
11273
|
const roleKind = isLeaderAgent(team, agent) ? "leader" : "member";
|
|
11274
|
+
const canonicalAgentId = agent.canonicalAgentId ?? agent.metadata.id;
|
|
11019
11275
|
return {
|
|
11020
11276
|
teamId: team.manifest.id,
|
|
11021
11277
|
teamName: team.manifest.name,
|
|
11022
11278
|
sourceTeam: team,
|
|
11023
|
-
|
|
11279
|
+
canonicalAgentId,
|
|
11024
11280
|
roleKind,
|
|
11025
11281
|
exposure: getExposure(agent),
|
|
11026
11282
|
selectionPriority: agent.entryPoint?.selectionPriority,
|
|
11027
|
-
surfaceLabel: getSurfaceLabel(agent),
|
|
11028
11283
|
description: getProjectionDescription(agent),
|
|
11029
11284
|
sourceAgent: agent
|
|
11030
11285
|
};
|
|
@@ -11046,21 +11301,20 @@ function createTeamLibraryProjection(library) {
|
|
|
11046
11301
|
agents: teams.flatMap((team) => team.agents)
|
|
11047
11302
|
};
|
|
11048
11303
|
}
|
|
11049
|
-
function findProjectedAgent(projection, teamId,
|
|
11050
|
-
return projection.agents.find((agent) => agent.teamId === teamId && agent.
|
|
11304
|
+
function findProjectedAgent(projection, teamId, canonicalAgentId) {
|
|
11305
|
+
return projection.agents.find((agent) => agent.teamId === teamId && agent.canonicalAgentId === canonicalAgentId);
|
|
11051
11306
|
}
|
|
11052
11307
|
function createSessionRuntimeBinding(input) {
|
|
11053
|
-
const selectedAgent = findProjectedAgent(input.projection, input.teamId, input.
|
|
11308
|
+
const selectedAgent = findProjectedAgent(input.projection, input.teamId, input.canonicalAgentId);
|
|
11054
11309
|
if (!selectedAgent) {
|
|
11055
|
-
throw new Error(`Unknown projected agent ${input.teamId}/${input.
|
|
11310
|
+
throw new Error(`Unknown projected agent ${input.teamId}/${input.canonicalAgentId}.`);
|
|
11056
11311
|
}
|
|
11057
11312
|
return {
|
|
11058
11313
|
sessionID: input.sessionID,
|
|
11059
11314
|
teamId: input.teamId,
|
|
11060
|
-
selectedAgentId: selectedAgent.
|
|
11061
|
-
selectedSurfaceLabel: selectedAgent.surfaceLabel,
|
|
11315
|
+
selectedAgentId: selectedAgent.canonicalAgentId,
|
|
11062
11316
|
mode: input.mode,
|
|
11063
|
-
activeOwnerId: selectedAgent.
|
|
11317
|
+
activeOwnerId: selectedAgent.canonicalAgentId,
|
|
11064
11318
|
source: input.source
|
|
11065
11319
|
};
|
|
11066
11320
|
}
|
|
@@ -11200,7 +11454,6 @@ function createDelegationEnvelope(input) {
|
|
|
11200
11454
|
function createCheckpoint(agent, model) {
|
|
11201
11455
|
return {
|
|
11202
11456
|
agent: agent.configKey,
|
|
11203
|
-
sourceAgentId: agent.sourceAgentId,
|
|
11204
11457
|
model,
|
|
11205
11458
|
tools: [...agent.runtimeConfig.requestedTools]
|
|
11206
11459
|
};
|
|
@@ -11272,11 +11525,11 @@ function detectNodeKind(value) {
|
|
|
11272
11525
|
}
|
|
11273
11526
|
return "scalar";
|
|
11274
11527
|
}
|
|
11275
|
-
function buildNode(
|
|
11528
|
+
function buildNode(path10, key, value, order) {
|
|
11276
11529
|
const kind = detectNodeKind(value);
|
|
11277
11530
|
if (kind !== "object") {
|
|
11278
11531
|
return {
|
|
11279
|
-
path:
|
|
11532
|
+
path: path10,
|
|
11280
11533
|
key,
|
|
11281
11534
|
label: toTitleLabel(key),
|
|
11282
11535
|
kind,
|
|
@@ -11286,10 +11539,10 @@ function buildNode(path6, key, value, order) {
|
|
|
11286
11539
|
};
|
|
11287
11540
|
}
|
|
11288
11541
|
const children = Object.entries(value).map(
|
|
11289
|
-
([childKey, childValue], index) => buildNode(`${
|
|
11542
|
+
([childKey, childValue], index) => buildNode(`${path10}.${childKey}`, childKey, childValue, index)
|
|
11290
11543
|
);
|
|
11291
11544
|
return {
|
|
11292
|
-
path:
|
|
11545
|
+
path: path10,
|
|
11293
11546
|
key,
|
|
11294
11547
|
label: toTitleLabel(key),
|
|
11295
11548
|
kind,
|
|
@@ -11524,13 +11777,13 @@ var AGENT_SECTION_ORDER = [
|
|
|
11524
11777
|
"tool_skill_strategy"
|
|
11525
11778
|
];
|
|
11526
11779
|
var TEAM_SECTION_ORDER = ["working_rules", "approval_safety"];
|
|
11527
|
-
function sectionRank(kind,
|
|
11780
|
+
function sectionRank(kind, path10) {
|
|
11528
11781
|
const list = kind === "team" ? TEAM_SECTION_ORDER : AGENT_SECTION_ORDER;
|
|
11529
|
-
const index = list.indexOf(
|
|
11782
|
+
const index = list.indexOf(path10);
|
|
11530
11783
|
return index === -1 ? Number.POSITIVE_INFINITY : index;
|
|
11531
11784
|
}
|
|
11532
|
-
function resolveSectionTitle(
|
|
11533
|
-
return CANONICAL_SECTION_TITLES[
|
|
11785
|
+
function resolveSectionTitle(path10, fallback) {
|
|
11786
|
+
return CANONICAL_SECTION_TITLES[path10] ?? fallback;
|
|
11534
11787
|
}
|
|
11535
11788
|
function buildPromptPlan(catalog) {
|
|
11536
11789
|
return {
|
|
@@ -11550,8 +11803,8 @@ function buildPromptPlan(catalog) {
|
|
|
11550
11803
|
}
|
|
11551
11804
|
|
|
11552
11805
|
// src/projection/apply-prompt-projection.ts
|
|
11553
|
-
function matchesPath(selected,
|
|
11554
|
-
return selected ===
|
|
11806
|
+
function matchesPath(selected, path10) {
|
|
11807
|
+
return selected === path10 || path10.startsWith(`${selected}.`);
|
|
11555
11808
|
}
|
|
11556
11809
|
function isAncestorPath(ancestor, descendant) {
|
|
11557
11810
|
return descendant === ancestor || descendant.startsWith(`${ancestor}.`);
|
|
@@ -11682,12 +11935,6 @@ function renderPromptPlan(plan, ctx = defaultRenderContext) {
|
|
|
11682
11935
|
}
|
|
11683
11936
|
|
|
11684
11937
|
// src/adapters/opencode/prompt-builder.ts
|
|
11685
|
-
function sanitizeSegment(value) {
|
|
11686
|
-
return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
11687
|
-
}
|
|
11688
|
-
function createProjectedConfigKey(teamId, surfaceLabel) {
|
|
11689
|
-
return `crewbee.${sanitizeSegment(teamId)}.${sanitizeSegment(surfaceLabel)}`;
|
|
11690
|
-
}
|
|
11691
11938
|
function resolveTargetAgent(team, agentRef) {
|
|
11692
11939
|
return team.agents.find((candidate) => candidate.metadata.id === agentRef);
|
|
11693
11940
|
}
|
|
@@ -11699,7 +11946,7 @@ function createCollaborationPromptValue(agent) {
|
|
|
11699
11946
|
const member = team.manifest.members[agentRef];
|
|
11700
11947
|
const fallbackDescription = typeof binding3 === "string" ? void 0 : binding3.description;
|
|
11701
11948
|
return {
|
|
11702
|
-
id: targetAgent ?
|
|
11949
|
+
id: targetAgent ? targetAgent.canonicalAgentId ?? targetAgent.metadata.id : agentRef,
|
|
11703
11950
|
description: member?.responsibility ?? targetAgent?.responsibilityCore.description ?? fallbackDescription ?? agentRef,
|
|
11704
11951
|
...member?.delegateWhen ? { when_to_delegate: member.delegateWhen } : {}
|
|
11705
11952
|
};
|
|
@@ -11738,30 +11985,20 @@ function createOpenCodeAgentPrompt(agent, _requestedTools) {
|
|
|
11738
11985
|
}
|
|
11739
11986
|
|
|
11740
11987
|
// src/adapters/opencode/projection.ts
|
|
11741
|
-
function sanitizeSegment2(value) {
|
|
11742
|
-
return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
11743
|
-
}
|
|
11744
|
-
function createOpenCodePublicAgentName(agent) {
|
|
11745
|
-
return `[${agent.teamName}]${agent.surfaceLabel}`;
|
|
11746
|
-
}
|
|
11747
11988
|
function createOpenCodeConfigKey(agent) {
|
|
11748
|
-
return
|
|
11749
|
-
}
|
|
11750
|
-
function createOpenCodePublicNameAliasKey(agent) {
|
|
11751
|
-
return agent.publicName;
|
|
11989
|
+
return agent.canonicalAgentId;
|
|
11752
11990
|
}
|
|
11753
11991
|
function createOpenCodeAgentConfig(agent, options = {}) {
|
|
11754
11992
|
const runtimeConfig = agent.sourceAgent.runtimeConfig;
|
|
11755
|
-
const runtimeOverride = agent.sourceTeam.manifest.agentRuntime?.[agent.
|
|
11993
|
+
const runtimeOverride = agent.sourceTeam.manifest.agentRuntime?.[agent.canonicalAgentId];
|
|
11756
11994
|
const availableToolContext = createAvailableToolContext(options.availableTools);
|
|
11757
11995
|
const requestedTools = mapOpenCodeToolNames(runtimeConfig.requestedTools);
|
|
11758
11996
|
const availableTools = availableToolContext.hasExplicitTools ? requestedTools.filter((toolId) => isAvailableTool(toolId, availableToolContext)) : [...requestedTools];
|
|
11759
11997
|
const missingTools = availableToolContext.hasExplicitTools ? requestedTools.filter((toolId) => !isAvailableTool(toolId, availableToolContext)) : [];
|
|
11760
11998
|
return {
|
|
11761
11999
|
configKey: createOpenCodeConfigKey(agent),
|
|
11762
|
-
publicName: createOpenCodePublicAgentName(agent),
|
|
11763
12000
|
teamId: agent.teamId,
|
|
11764
|
-
|
|
12001
|
+
canonicalAgentId: agent.canonicalAgentId,
|
|
11765
12002
|
mode: agent.exposure === "user-selectable" ? "primary" : "subagent",
|
|
11766
12003
|
hidden: agent.exposure !== "user-selectable",
|
|
11767
12004
|
description: agent.description,
|
|
@@ -11795,8 +12032,8 @@ function createOpenCodeAgentConfig(agent, options = {}) {
|
|
|
11795
12032
|
metadata: {
|
|
11796
12033
|
teamId: agent.teamId,
|
|
11797
12034
|
teamName: agent.teamName,
|
|
11798
|
-
|
|
11799
|
-
|
|
12035
|
+
canonicalAgentId: agent.canonicalAgentId,
|
|
12036
|
+
sourceAgentId: agent.sourceAgent.metadata.sourceId,
|
|
11800
12037
|
roleKind: agent.roleKind,
|
|
11801
12038
|
exposure: agent.exposure
|
|
11802
12039
|
}
|
|
@@ -11807,7 +12044,7 @@ function createOpenCodeAgentConfigs(projection, options = {}) {
|
|
|
11807
12044
|
}
|
|
11808
12045
|
function createOpenCodeAgentDefinition(agent) {
|
|
11809
12046
|
return {
|
|
11810
|
-
name: agent.
|
|
12047
|
+
name: agent.configKey,
|
|
11811
12048
|
description: agent.description,
|
|
11812
12049
|
mode: agent.mode,
|
|
11813
12050
|
hidden: agent.hidden || void 0,
|
|
@@ -11820,31 +12057,15 @@ function createOpenCodeAgentDefinition(agent) {
|
|
|
11820
12057
|
options: agent.resolvedModel?.options
|
|
11821
12058
|
};
|
|
11822
12059
|
}
|
|
11823
|
-
function createOpenCodePublicNameAliasDefinition(agent) {
|
|
11824
|
-
return {
|
|
11825
|
-
...createOpenCodeAgentDefinition(agent),
|
|
11826
|
-
hidden: true
|
|
11827
|
-
};
|
|
11828
|
-
}
|
|
11829
12060
|
function createOpenCodeProjectedIdentities(agent) {
|
|
11830
|
-
return [
|
|
11831
|
-
|
|
11832
|
-
|
|
11833
|
-
publicName: agent.publicName
|
|
11834
|
-
},
|
|
11835
|
-
{
|
|
11836
|
-
configKey: createOpenCodePublicNameAliasKey(agent),
|
|
11837
|
-
publicName: agent.publicName
|
|
11838
|
-
}
|
|
11839
|
-
];
|
|
12061
|
+
return [{
|
|
12062
|
+
configKey: agent.configKey
|
|
12063
|
+
}];
|
|
11840
12064
|
}
|
|
11841
12065
|
function createOpenCodeAgentConfigPatch(input) {
|
|
11842
12066
|
return {
|
|
11843
12067
|
agent: Object.fromEntries(
|
|
11844
|
-
input.agents.
|
|
11845
|
-
[agent.configKey, createOpenCodeAgentDefinition(agent)],
|
|
11846
|
-
[createOpenCodePublicNameAliasKey(agent), createOpenCodePublicNameAliasDefinition(agent)]
|
|
11847
|
-
])
|
|
12068
|
+
input.agents.map((agent) => [agent.configKey, createOpenCodeAgentDefinition(agent)])
|
|
11848
12069
|
),
|
|
11849
12070
|
defaultAgent: input.defaultAgentConfigKey
|
|
11850
12071
|
};
|
|
@@ -11852,9 +12073,6 @@ function createOpenCodeAgentConfigPatch(input) {
|
|
|
11852
12073
|
function findProjectedAgentByConfigKey(agents, configKey) {
|
|
11853
12074
|
return agents.find((agent) => agent.configKey === configKey);
|
|
11854
12075
|
}
|
|
11855
|
-
function findProjectedAgentByPublicName(agents, publicName) {
|
|
11856
|
-
return agents.find((agent) => agent.publicName === publicName);
|
|
11857
|
-
}
|
|
11858
12076
|
function resolveProjectedAgentSelection(agents, selection) {
|
|
11859
12077
|
if (selection.configKey) {
|
|
11860
12078
|
const byConfigKey = findProjectedAgentByConfigKey(agents, selection.configKey);
|
|
@@ -11862,20 +12080,13 @@ function resolveProjectedAgentSelection(agents, selection) {
|
|
|
11862
12080
|
return byConfigKey;
|
|
11863
12081
|
}
|
|
11864
12082
|
}
|
|
11865
|
-
if (selection.publicName) {
|
|
11866
|
-
return findProjectedAgentByPublicName(agents, selection.publicName);
|
|
11867
|
-
}
|
|
11868
12083
|
return void 0;
|
|
11869
12084
|
}
|
|
11870
12085
|
function normalizeAlias(value) {
|
|
11871
12086
|
return value.trim().toLowerCase();
|
|
11872
12087
|
}
|
|
11873
12088
|
function createProjectedAgentAliasEntries(agent) {
|
|
11874
|
-
return [
|
|
11875
|
-
{ alias: agent.configKey, agent, kind: "config-key" },
|
|
11876
|
-
{ alias: agent.publicName, agent, kind: "public-name" },
|
|
11877
|
-
{ alias: agent.sourceAgentId, agent, kind: "source-agent-id" }
|
|
11878
|
-
];
|
|
12089
|
+
return [{ alias: agent.configKey, agent, kind: "config-key" }];
|
|
11879
12090
|
}
|
|
11880
12091
|
function createProjectedAgentAliasIndex(agents) {
|
|
11881
12092
|
const index = /* @__PURE__ */ new Map();
|
|
@@ -11898,8 +12109,7 @@ function resolveProjectedAgentAlias(index, alias) {
|
|
|
11898
12109
|
}
|
|
11899
12110
|
function createProjectedAgentTaskAliasHelpLines(agents) {
|
|
11900
12111
|
return agents.map((agent) => {
|
|
11901
|
-
|
|
11902
|
-
return `- ${agent.sourceAgentId} => ${agent.configKey} (${agent.publicName}; accepts: ${aliases.join(" | ")})`;
|
|
12112
|
+
return `- ${agent.configKey}`;
|
|
11903
12113
|
});
|
|
11904
12114
|
}
|
|
11905
12115
|
|
|
@@ -11927,8 +12137,7 @@ function createChatMessageHook(input) {
|
|
|
11927
12137
|
return;
|
|
11928
12138
|
}
|
|
11929
12139
|
const agent = resolveProjectedAgentSelection(boot.projectedAgents, {
|
|
11930
|
-
configKey: selected
|
|
11931
|
-
publicName: selected
|
|
12140
|
+
configKey: selected
|
|
11932
12141
|
});
|
|
11933
12142
|
if (!agent) {
|
|
11934
12143
|
return;
|
|
@@ -11937,7 +12146,7 @@ function createChatMessageHook(input) {
|
|
|
11937
12146
|
projection: boot.projection,
|
|
11938
12147
|
sessionID: message.sessionID,
|
|
11939
12148
|
teamId: agent.teamId,
|
|
11940
|
-
|
|
12149
|
+
canonicalAgentId: agent.canonicalAgentId,
|
|
11941
12150
|
mode: "single-executor",
|
|
11942
12151
|
source: message.agent ? "host-agent-selection" : "plugin-default"
|
|
11943
12152
|
});
|
|
@@ -11963,7 +12172,7 @@ function formatDelegatedSessions(store, sessionID) {
|
|
|
11963
12172
|
return sessions.map((session) => {
|
|
11964
12173
|
const task = store.getTaskBySession(session.sessionID);
|
|
11965
12174
|
return [
|
|
11966
|
-
`- ${session.
|
|
12175
|
+
`- ${session.canonicalAgentId}`,
|
|
11967
12176
|
task?.status ?? "completed",
|
|
11968
12177
|
task?.description ?? "foreground delegation",
|
|
11969
12178
|
`session_id=${session.sessionID}`,
|
|
@@ -11985,7 +12194,6 @@ function formatCheckpointSummary(store, sessionID) {
|
|
|
11985
12194
|
}
|
|
11986
12195
|
return [
|
|
11987
12196
|
`- agent=${checkpoint.agent}`,
|
|
11988
|
-
checkpoint.sourceAgentId ? `- source_agent=${checkpoint.sourceAgentId}` : void 0,
|
|
11989
12197
|
checkpoint.model ? `- model=${checkpoint.model.providerID}/${checkpoint.model.modelID}` : void 0,
|
|
11990
12198
|
checkpoint.tools.length > 0 ? `- tools=${checkpoint.tools.join(", ")}` : "- tools=None"
|
|
11991
12199
|
].filter(Boolean).join("\n");
|
|
@@ -12061,39 +12269,11 @@ function isCrewBeeOwnedKey(key) {
|
|
|
12061
12269
|
function isCompatibleCrewBeeOwnedKey(key) {
|
|
12062
12270
|
return isCrewBeeOwnedKey(key) || isLegacyCrewBeeOwnedKey(key);
|
|
12063
12271
|
}
|
|
12064
|
-
function getConfiguredAgentName(definition) {
|
|
12065
|
-
if (typeof definition !== "object" || definition === null || !("name" in definition)) {
|
|
12066
|
-
return void 0;
|
|
12067
|
-
}
|
|
12068
|
-
const candidate = definition.name;
|
|
12069
|
-
return typeof candidate === "string" ? candidate : void 0;
|
|
12070
|
-
}
|
|
12071
|
-
function isCrewBeePublicNameAliasEntry(key, definition, allAgents) {
|
|
12072
|
-
const publicName = getConfiguredAgentName(definition);
|
|
12073
|
-
if (!publicName || key !== publicName || !publicName.startsWith("[")) {
|
|
12074
|
-
return false;
|
|
12075
|
-
}
|
|
12076
|
-
return Object.entries(allAgents).some(([otherKey, otherDefinition]) => {
|
|
12077
|
-
if (!isCompatibleCrewBeeOwnedKey(otherKey)) {
|
|
12078
|
-
return false;
|
|
12079
|
-
}
|
|
12080
|
-
return getConfiguredAgentName(otherDefinition) === publicName;
|
|
12081
|
-
});
|
|
12082
|
-
}
|
|
12083
12272
|
function applyOpenCodeAgentConfigPatch(config2, patch) {
|
|
12084
12273
|
const nextAgents = { ...config2.agent ?? {} };
|
|
12085
12274
|
const insertedAgentKeys = [];
|
|
12086
12275
|
const updatedAgentKeys = [];
|
|
12087
12276
|
const skippedAgentKeys = [];
|
|
12088
|
-
const nextPublicNames = new Set(
|
|
12089
|
-
Object.values(patch.agent).map((definition) => definition.name).filter((name) => Boolean(name))
|
|
12090
|
-
);
|
|
12091
|
-
for (const [key, definition] of Object.entries(nextAgents)) {
|
|
12092
|
-
const publicName = getConfiguredAgentName(definition);
|
|
12093
|
-
if (publicName && isLegacyCrewBeeOwnedKey(key) && nextPublicNames.has(publicName)) {
|
|
12094
|
-
delete nextAgents[key];
|
|
12095
|
-
}
|
|
12096
|
-
}
|
|
12097
12277
|
for (const [key, definition] of Object.entries(patch.agent)) {
|
|
12098
12278
|
if (!(key in nextAgents)) {
|
|
12099
12279
|
nextAgents[key] = definition;
|
|
@@ -12101,7 +12281,7 @@ function applyOpenCodeAgentConfigPatch(config2, patch) {
|
|
|
12101
12281
|
continue;
|
|
12102
12282
|
}
|
|
12103
12283
|
const existingDefinition = nextAgents[key];
|
|
12104
|
-
if (
|
|
12284
|
+
if (isCompatibleCrewBeeOwnedKey(key)) {
|
|
12105
12285
|
nextAgents[key] = definition;
|
|
12106
12286
|
updatedAgentKeys.push(key);
|
|
12107
12287
|
continue;
|
|
@@ -12112,7 +12292,7 @@ function applyOpenCodeAgentConfigPatch(config2, patch) {
|
|
|
12112
12292
|
...config2,
|
|
12113
12293
|
agent: nextAgents
|
|
12114
12294
|
};
|
|
12115
|
-
if (patch.defaultAgent
|
|
12295
|
+
if (patch.defaultAgent) {
|
|
12116
12296
|
nextConfig.default_agent = patch.defaultAgent;
|
|
12117
12297
|
}
|
|
12118
12298
|
return {
|
|
@@ -12131,16 +12311,13 @@ function createOpenCodeCoexistencePolicy() {
|
|
|
12131
12311
|
featureDevelopmentMode: "mutually-exclusive",
|
|
12132
12312
|
safeWhenCoInstalled: true,
|
|
12133
12313
|
reservedConfigKeyPrefix: "crewbee.",
|
|
12134
|
-
reservedPublicNamePrefix: "[",
|
|
12135
12314
|
neverMutateForeignAgents: true
|
|
12136
12315
|
};
|
|
12137
12316
|
}
|
|
12138
12317
|
function detectOpenCodeProjectionCollisions(input) {
|
|
12139
12318
|
const existingConfigKeys = new Set(input.existingConfigKeys ?? []);
|
|
12140
|
-
const existingPublicNames = new Set(input.existingPublicNames ?? []);
|
|
12141
12319
|
return {
|
|
12142
|
-
configKeyCollisions: input.projectedAgents.filter((agent) => existingConfigKeys.has(agent.configKey)).map((agent) => agent.configKey)
|
|
12143
|
-
publicNameCollisions: input.projectedAgents.filter((agent) => existingPublicNames.has(agent.publicName)).map((agent) => agent.publicName)
|
|
12320
|
+
configKeyCollisions: input.projectedAgents.filter((agent) => existingConfigKeys.has(agent.configKey)).map((agent) => agent.configKey)
|
|
12144
12321
|
};
|
|
12145
12322
|
}
|
|
12146
12323
|
|
|
@@ -12175,7 +12352,6 @@ function createOpenCodeAdapterDefinition() {
|
|
|
12175
12352
|
coexistence: {
|
|
12176
12353
|
independentFromForeignPlugins: true,
|
|
12177
12354
|
safeWhenCoInstalled: coexistence.safeWhenCoInstalled,
|
|
12178
|
-
reservedAgentNamePrefix: coexistence.reservedPublicNamePrefix,
|
|
12179
12355
|
reservedConfigKeyPrefix: coexistence.reservedConfigKeyPrefix
|
|
12180
12356
|
}
|
|
12181
12357
|
};
|
|
@@ -12184,13 +12360,12 @@ function resolveBindingAgent(input) {
|
|
|
12184
12360
|
if (input.selectedHostAgent) {
|
|
12185
12361
|
const normalizedHostAgent = input.selectedHostAgent.startsWith(LEGACY_PLUGIN_KEY_PREFIX2) ? `${CURRENT_PLUGIN_KEY_PREFIX2}${input.selectedHostAgent.slice(LEGACY_PLUGIN_KEY_PREFIX2.length)}` : input.selectedHostAgent;
|
|
12186
12362
|
const hostSelection = resolveProjectedAgentSelection(input.projectedAgents, {
|
|
12187
|
-
configKey: normalizedHostAgent
|
|
12188
|
-
publicName: input.selectedHostAgent
|
|
12363
|
+
configKey: normalizedHostAgent
|
|
12189
12364
|
});
|
|
12190
12365
|
if (hostSelection) {
|
|
12191
12366
|
return {
|
|
12192
12367
|
teamId: hostSelection.teamId,
|
|
12193
|
-
sourceAgentId: hostSelection.
|
|
12368
|
+
sourceAgentId: hostSelection.canonicalAgentId
|
|
12194
12369
|
};
|
|
12195
12370
|
}
|
|
12196
12371
|
}
|
|
@@ -12199,7 +12374,7 @@ function resolveBindingAgent(input) {
|
|
|
12199
12374
|
if (explicit) {
|
|
12200
12375
|
return {
|
|
12201
12376
|
teamId: explicit.teamId,
|
|
12202
|
-
sourceAgentId: explicit.
|
|
12377
|
+
sourceAgentId: explicit.canonicalAgentId
|
|
12203
12378
|
};
|
|
12204
12379
|
}
|
|
12205
12380
|
}
|
|
@@ -12215,81 +12390,42 @@ function resolveBindingAgent(input) {
|
|
|
12215
12390
|
}
|
|
12216
12391
|
return {
|
|
12217
12392
|
teamId: fallbackTeam.team.manifest.id,
|
|
12218
|
-
sourceAgentId: fallbackAgent.metadata.id
|
|
12393
|
+
sourceAgentId: fallbackAgent.canonicalAgentId ?? fallbackAgent.metadata.id
|
|
12219
12394
|
};
|
|
12220
12395
|
}
|
|
12221
12396
|
return void 0;
|
|
12222
12397
|
}
|
|
12223
12398
|
function filterSafeProjectedAgents(agents, collisions) {
|
|
12224
12399
|
const blockedConfigKeys = new Set(collisions.configKeyCollisions);
|
|
12225
|
-
const blockedPublicNames = new Set(collisions.publicNameCollisions);
|
|
12226
12400
|
return agents.filter((agent) => {
|
|
12227
12401
|
if (blockedConfigKeys.has(agent.configKey)) {
|
|
12228
12402
|
return false;
|
|
12229
12403
|
}
|
|
12230
|
-
|
|
12231
|
-
return false;
|
|
12232
|
-
}
|
|
12233
|
-
return !blockedPublicNames.has(agent.publicName);
|
|
12404
|
+
return true;
|
|
12234
12405
|
});
|
|
12235
12406
|
}
|
|
12236
12407
|
function isCompatibleCrewBeeOwnedKey2(key) {
|
|
12237
12408
|
return key.startsWith(CURRENT_PLUGIN_KEY_PREFIX2) || key.startsWith(LEGACY_PLUGIN_KEY_PREFIX2);
|
|
12238
12409
|
}
|
|
12239
|
-
function getConfiguredAgentName2(definition) {
|
|
12240
|
-
if (typeof definition !== "object" || definition === null || !("name" in definition)) {
|
|
12241
|
-
return void 0;
|
|
12242
|
-
}
|
|
12243
|
-
const candidate = definition.name;
|
|
12244
|
-
return typeof candidate === "string" ? candidate : void 0;
|
|
12245
|
-
}
|
|
12246
|
-
function isCrewBeePublicNameAliasEntry2(key, definition, allAgents) {
|
|
12247
|
-
const publicName = getConfiguredAgentName2(definition);
|
|
12248
|
-
if (!publicName || key !== publicName || !publicName.startsWith("[")) {
|
|
12249
|
-
return false;
|
|
12250
|
-
}
|
|
12251
|
-
return Object.entries(allAgents).some(([otherKey, otherDefinition]) => {
|
|
12252
|
-
if (!isCompatibleCrewBeeOwnedKey2(otherKey)) {
|
|
12253
|
-
return false;
|
|
12254
|
-
}
|
|
12255
|
-
return getConfiguredAgentName2(otherDefinition) === publicName;
|
|
12256
|
-
});
|
|
12257
|
-
}
|
|
12258
12410
|
function getForeignCollisionInputs(input) {
|
|
12259
12411
|
if (!input.existingConfig?.agent) {
|
|
12260
12412
|
return {
|
|
12261
|
-
existingConfigKeys: input.existingConfigKeys
|
|
12262
|
-
existingPublicNames: input.existingPublicNames
|
|
12413
|
+
existingConfigKeys: input.existingConfigKeys
|
|
12263
12414
|
};
|
|
12264
12415
|
}
|
|
12265
12416
|
const compatibleOwnedConfigKeys = /* @__PURE__ */ new Set();
|
|
12266
|
-
const compatibleOwnedPublicNames = /* @__PURE__ */ new Set();
|
|
12267
12417
|
for (const [key, definition] of Object.entries(input.existingConfig.agent)) {
|
|
12268
|
-
if (!isCompatibleCrewBeeOwnedKey2(key)
|
|
12418
|
+
if (!isCompatibleCrewBeeOwnedKey2(key)) {
|
|
12269
12419
|
continue;
|
|
12270
12420
|
}
|
|
12271
12421
|
compatibleOwnedConfigKeys.add(key);
|
|
12272
|
-
const publicName = getConfiguredAgentName2(definition);
|
|
12273
|
-
if (publicName) {
|
|
12274
|
-
compatibleOwnedPublicNames.add(publicName);
|
|
12275
|
-
}
|
|
12276
12422
|
}
|
|
12277
12423
|
return {
|
|
12278
|
-
existingConfigKeys: input.existingConfigKeys?.filter((key) => !compatibleOwnedConfigKeys.has(key))
|
|
12279
|
-
existingPublicNames: input.existingPublicNames?.filter((name) => !compatibleOwnedPublicNames.has(name))
|
|
12424
|
+
existingConfigKeys: input.existingConfigKeys?.filter((key) => !compatibleOwnedConfigKeys.has(key))
|
|
12280
12425
|
};
|
|
12281
12426
|
}
|
|
12282
12427
|
function shouldSetDefaultAgent(input) {
|
|
12283
|
-
|
|
12284
|
-
return void 0;
|
|
12285
|
-
}
|
|
12286
|
-
if (!input.existingDefaultAgent) {
|
|
12287
|
-
return input.defaultAgentConfigKey;
|
|
12288
|
-
}
|
|
12289
|
-
if (isCompatibleCrewBeeOwnedKey2(input.existingDefaultAgent)) {
|
|
12290
|
-
return input.defaultAgentConfigKey;
|
|
12291
|
-
}
|
|
12292
|
-
return void 0;
|
|
12428
|
+
return input.defaultAgentConfigKey;
|
|
12293
12429
|
}
|
|
12294
12430
|
function createOpenCodeBootstrap(input) {
|
|
12295
12431
|
const projection = createTeamLibraryProjection(input.teamLibrary);
|
|
@@ -12299,13 +12435,11 @@ function createOpenCodeBootstrap(input) {
|
|
|
12299
12435
|
});
|
|
12300
12436
|
const foreignCollisions = getForeignCollisionInputs({
|
|
12301
12437
|
existingConfig: input.existingConfig,
|
|
12302
|
-
existingConfigKeys: input.existingConfigKeys
|
|
12303
|
-
existingPublicNames: input.existingPublicNames
|
|
12438
|
+
existingConfigKeys: input.existingConfigKeys
|
|
12304
12439
|
});
|
|
12305
12440
|
const collisions = detectOpenCodeProjectionCollisions({
|
|
12306
12441
|
projectedAgents: projectedAgents.flatMap((agent) => createOpenCodeProjectedIdentities(agent)),
|
|
12307
|
-
existingConfigKeys: foreignCollisions.existingConfigKeys
|
|
12308
|
-
existingPublicNames: foreignCollisions.existingPublicNames
|
|
12442
|
+
existingConfigKeys: foreignCollisions.existingConfigKeys
|
|
12309
12443
|
});
|
|
12310
12444
|
const safeProjectedAgents = filterSafeProjectedAgents(projectedAgents, collisions);
|
|
12311
12445
|
const bindingAgent = resolveBindingAgent({
|
|
@@ -12320,12 +12454,12 @@ function createOpenCodeBootstrap(input) {
|
|
|
12320
12454
|
projection,
|
|
12321
12455
|
sessionID: input.sessionID,
|
|
12322
12456
|
teamId: bindingAgent.teamId,
|
|
12323
|
-
|
|
12457
|
+
canonicalAgentId: bindingAgent.sourceAgentId,
|
|
12324
12458
|
mode: input.selectedMode ?? input.defaults.defaultMode,
|
|
12325
12459
|
source: input.selectedHostAgent || input.selectedSourceAgentId ? "host-agent-selection" : "plugin-default"
|
|
12326
12460
|
}) : void 0;
|
|
12327
12461
|
const defaultProjectedAgent = bindingAgent ? safeProjectedAgents.find(
|
|
12328
|
-
(agent) => agent.teamId === bindingAgent.teamId && agent.
|
|
12462
|
+
(agent) => agent.teamId === bindingAgent.teamId && agent.canonicalAgentId === bindingAgent.sourceAgentId
|
|
12329
12463
|
) : void 0;
|
|
12330
12464
|
const configPatch = createOpenCodeAgentConfigPatch({
|
|
12331
12465
|
agents: safeProjectedAgents,
|
|
@@ -12368,7 +12502,6 @@ var DEFAULT_MODE = "single-executor";
|
|
|
12368
12502
|
function summarizeProjectedAgents(boot) {
|
|
12369
12503
|
return boot.projectedAgents.map((agent) => ({
|
|
12370
12504
|
configKey: agent.configKey,
|
|
12371
|
-
publicName: agent.publicName,
|
|
12372
12505
|
hidden: agent.hidden,
|
|
12373
12506
|
model: agent.resolvedModel ? `${agent.resolvedModel.providerID}/${agent.resolvedModel.modelID}` : void 0
|
|
12374
12507
|
}));
|
|
@@ -12526,7 +12659,7 @@ function createEventHook(ctx, store) {
|
|
|
12526
12659
|
|
|
12527
12660
|
// src/adapters/opencode/delegation/store.ts
|
|
12528
12661
|
import { createHash, randomUUID } from "node:crypto";
|
|
12529
|
-
import { existsSync as
|
|
12662
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
12530
12663
|
import path5 from "node:path";
|
|
12531
12664
|
function createEmptyState() {
|
|
12532
12665
|
return {
|
|
@@ -12643,11 +12776,11 @@ var DelegateStateStore = class {
|
|
|
12643
12776
|
if (this.cache) {
|
|
12644
12777
|
return this.cache;
|
|
12645
12778
|
}
|
|
12646
|
-
if (!
|
|
12779
|
+
if (!existsSync5(this.filePath)) {
|
|
12647
12780
|
this.cache = createEmptyState();
|
|
12648
12781
|
return this.cache;
|
|
12649
12782
|
}
|
|
12650
|
-
const raw =
|
|
12783
|
+
const raw = readFileSync4(this.filePath, "utf8");
|
|
12651
12784
|
const parsed = JSON.parse(raw);
|
|
12652
12785
|
this.cache = {
|
|
12653
12786
|
version: 1,
|
|
@@ -12658,9 +12791,9 @@ var DelegateStateStore = class {
|
|
|
12658
12791
|
return this.cache;
|
|
12659
12792
|
}
|
|
12660
12793
|
write(state) {
|
|
12661
|
-
|
|
12794
|
+
mkdirSync3(path5.dirname(this.filePath), { recursive: true });
|
|
12662
12795
|
this.cache = state;
|
|
12663
|
-
|
|
12796
|
+
writeFileSync3(this.filePath, `${JSON.stringify(state, null, 2)}
|
|
12664
12797
|
`, "utf8");
|
|
12665
12798
|
}
|
|
12666
12799
|
};
|
|
@@ -13396,10 +13529,10 @@ function mergeDefs(...defs) {
|
|
|
13396
13529
|
function cloneDef(schema) {
|
|
13397
13530
|
return mergeDefs(schema._zod.def);
|
|
13398
13531
|
}
|
|
13399
|
-
function getElementAtPath(obj,
|
|
13400
|
-
if (!
|
|
13532
|
+
function getElementAtPath(obj, path10) {
|
|
13533
|
+
if (!path10)
|
|
13401
13534
|
return obj;
|
|
13402
|
-
return
|
|
13535
|
+
return path10.reduce((acc, key) => acc?.[key], obj);
|
|
13403
13536
|
}
|
|
13404
13537
|
function promiseAllObject(promisesObj) {
|
|
13405
13538
|
const keys = Object.keys(promisesObj);
|
|
@@ -13760,11 +13893,11 @@ function aborted(x, startIndex = 0) {
|
|
|
13760
13893
|
}
|
|
13761
13894
|
return false;
|
|
13762
13895
|
}
|
|
13763
|
-
function prefixIssues(
|
|
13896
|
+
function prefixIssues(path10, issues) {
|
|
13764
13897
|
return issues.map((iss) => {
|
|
13765
13898
|
var _a;
|
|
13766
13899
|
(_a = iss).path ?? (_a.path = []);
|
|
13767
|
-
iss.path.unshift(
|
|
13900
|
+
iss.path.unshift(path10);
|
|
13768
13901
|
return iss;
|
|
13769
13902
|
});
|
|
13770
13903
|
}
|
|
@@ -13932,7 +14065,7 @@ function treeifyError(error45, _mapper) {
|
|
|
13932
14065
|
return issue2.message;
|
|
13933
14066
|
};
|
|
13934
14067
|
const result = { errors: [] };
|
|
13935
|
-
const processError = (error46,
|
|
14068
|
+
const processError = (error46, path10 = []) => {
|
|
13936
14069
|
var _a, _b;
|
|
13937
14070
|
for (const issue2 of error46.issues) {
|
|
13938
14071
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -13942,7 +14075,7 @@ function treeifyError(error45, _mapper) {
|
|
|
13942
14075
|
} else if (issue2.code === "invalid_element") {
|
|
13943
14076
|
processError({ issues: issue2.issues }, issue2.path);
|
|
13944
14077
|
} else {
|
|
13945
|
-
const fullpath = [...
|
|
14078
|
+
const fullpath = [...path10, ...issue2.path];
|
|
13946
14079
|
if (fullpath.length === 0) {
|
|
13947
14080
|
result.errors.push(mapper(issue2));
|
|
13948
14081
|
continue;
|
|
@@ -13974,8 +14107,8 @@ function treeifyError(error45, _mapper) {
|
|
|
13974
14107
|
}
|
|
13975
14108
|
function toDotPath(_path) {
|
|
13976
14109
|
const segs = [];
|
|
13977
|
-
const
|
|
13978
|
-
for (const seg of
|
|
14110
|
+
const path10 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
14111
|
+
for (const seg of path10) {
|
|
13979
14112
|
if (typeof seg === "number")
|
|
13980
14113
|
segs.push(`[${seg}]`);
|
|
13981
14114
|
else if (typeof seg === "symbol")
|
|
@@ -25085,27 +25218,15 @@ config(en_default());
|
|
|
25085
25218
|
var zod_default = external_exports;
|
|
25086
25219
|
|
|
25087
25220
|
// src/adapters/opencode/delegation/resolve-agent.ts
|
|
25088
|
-
function findBySourceAgentId(agents, agent) {
|
|
25089
|
-
return agents.find((item) => item.sourceAgentId === agent);
|
|
25090
|
-
}
|
|
25091
25221
|
function resolveDelegateAgent(input) {
|
|
25092
|
-
const bySource = findBySourceAgentId(input.agents, input.agent);
|
|
25093
|
-
if (bySource) {
|
|
25094
|
-
return {
|
|
25095
|
-
agent: bySource,
|
|
25096
|
-
configKey: bySource.configKey,
|
|
25097
|
-
sourceAgentId: bySource.sourceAgentId
|
|
25098
|
-
};
|
|
25099
|
-
}
|
|
25100
25222
|
const bySelection = resolveProjectedAgentSelection(input.agents, {
|
|
25101
|
-
configKey: input.agent
|
|
25102
|
-
publicName: input.agent
|
|
25223
|
+
configKey: input.agent
|
|
25103
25224
|
});
|
|
25104
25225
|
if (bySelection) {
|
|
25105
25226
|
return {
|
|
25106
25227
|
agent: bySelection,
|
|
25107
25228
|
configKey: bySelection.configKey,
|
|
25108
|
-
|
|
25229
|
+
canonicalAgentId: bySelection.canonicalAgentId
|
|
25109
25230
|
};
|
|
25110
25231
|
}
|
|
25111
25232
|
const byAlias = resolveProjectedAgentAlias(input.aliasIndex, input.agent);
|
|
@@ -25115,14 +25236,14 @@ function resolveDelegateAgent(input) {
|
|
|
25115
25236
|
return {
|
|
25116
25237
|
agent: byAlias.agent,
|
|
25117
25238
|
configKey: byAlias.agent.configKey,
|
|
25118
|
-
|
|
25239
|
+
canonicalAgentId: byAlias.agent.canonicalAgentId
|
|
25119
25240
|
};
|
|
25120
25241
|
}
|
|
25121
|
-
function isSelfDelegate(binding3,
|
|
25242
|
+
function isSelfDelegate(binding3, canonicalAgentId) {
|
|
25122
25243
|
if (!binding3) {
|
|
25123
25244
|
return false;
|
|
25124
25245
|
}
|
|
25125
|
-
return binding3.selectedAgentId ===
|
|
25246
|
+
return binding3.selectedAgentId === canonicalAgentId;
|
|
25126
25247
|
}
|
|
25127
25248
|
|
|
25128
25249
|
// src/adapters/opencode/delegation/tool-result.ts
|
|
@@ -25174,7 +25295,7 @@ async function resolveChildSession(input) {
|
|
|
25174
25295
|
input.store.putSession({
|
|
25175
25296
|
sessionID,
|
|
25176
25297
|
parentSessionID: input.parentSessionID,
|
|
25177
|
-
|
|
25298
|
+
canonicalAgentId: input.canonicalAgentId,
|
|
25178
25299
|
configKey: input.configKey
|
|
25179
25300
|
});
|
|
25180
25301
|
return { sessionID, existing: false };
|
|
@@ -25186,7 +25307,7 @@ async function resolveChildSession(input) {
|
|
|
25186
25307
|
if (known.parentSessionID !== input.parentSessionID) {
|
|
25187
25308
|
return createFailedResult(input.args.session_id, "invalid_session_id", "Use a delegated session_id created from the current parent session.");
|
|
25188
25309
|
}
|
|
25189
|
-
if (known.
|
|
25310
|
+
if (known.canonicalAgentId !== input.canonicalAgentId) {
|
|
25190
25311
|
return createFailedResult(input.args.session_id, "agent_session_mismatch", "The delegated session is already bound to a different agent.");
|
|
25191
25312
|
}
|
|
25192
25313
|
await input.client.session.get({ path: { id: input.args.session_id } }).catch(() => {
|
|
@@ -25198,7 +25319,7 @@ async function runForeground(input) {
|
|
|
25198
25319
|
const anchor = await getSessionAnchor(input.client, input.sessionID);
|
|
25199
25320
|
const model = resolveDelegateModel(input.target, input.store.getCheckpoint(input.ctx.sessionID)?.model);
|
|
25200
25321
|
const envelope = createDelegationEnvelope({
|
|
25201
|
-
agent: input.target.
|
|
25322
|
+
agent: input.target.canonicalAgentId,
|
|
25202
25323
|
parentSessionID: input.parentSessionID,
|
|
25203
25324
|
sessionID: input.sessionID,
|
|
25204
25325
|
prompt: input.args.prompt
|
|
@@ -25219,7 +25340,7 @@ async function runForeground(input) {
|
|
|
25219
25340
|
message,
|
|
25220
25341
|
resume_supported: true
|
|
25221
25342
|
};
|
|
25222
|
-
input.ctx.metadata({ title: input.title, metadata: { sessionId: input.sessionID, agent: input.target.
|
|
25343
|
+
input.ctx.metadata({ title: input.title, metadata: { sessionId: input.sessionID, agent: input.target.canonicalAgentId } });
|
|
25223
25344
|
return result;
|
|
25224
25345
|
}
|
|
25225
25346
|
function createBackgroundRecord(input) {
|
|
@@ -25228,7 +25349,7 @@ function createBackgroundRecord(input) {
|
|
|
25228
25349
|
sessionID: input.sessionID,
|
|
25229
25350
|
parentSessionID: input.ctx.sessionID,
|
|
25230
25351
|
parentMessageID: input.ctx.messageID,
|
|
25231
|
-
|
|
25352
|
+
canonicalAgentId: input.target.canonicalAgentId,
|
|
25232
25353
|
configKey: input.target.configKey,
|
|
25233
25354
|
description: input.description,
|
|
25234
25355
|
status: "queued",
|
|
@@ -25240,7 +25361,7 @@ function createBackgroundRecord(input) {
|
|
|
25240
25361
|
function launchBackground(input) {
|
|
25241
25362
|
const model = resolveDelegateModel(input.target, input.store.getCheckpoint(input.ctx.sessionID)?.model);
|
|
25242
25363
|
const envelope = createDelegationEnvelope({
|
|
25243
|
-
agent: input.target.
|
|
25364
|
+
agent: input.target.canonicalAgentId,
|
|
25244
25365
|
parentSessionID: input.ctx.sessionID,
|
|
25245
25366
|
sessionID: input.sessionID,
|
|
25246
25367
|
prompt: input.args.prompt
|
|
@@ -25289,17 +25410,17 @@ function createDelegateTools(input) {
|
|
|
25289
25410
|
return stringifyDelegateTaskResult(createFailedResult(ctx.sessionID, "unknown_agent", `Unknown CrewBee agent: ${args.agent}`));
|
|
25290
25411
|
}
|
|
25291
25412
|
const binding3 = input.bindings.get(ctx.sessionID);
|
|
25292
|
-
if (isSelfDelegate(binding3, target.
|
|
25413
|
+
if (isSelfDelegate(binding3, target.canonicalAgentId)) {
|
|
25293
25414
|
return stringifyDelegateTaskResult(createFailedResult(ctx.sessionID, "self_delegate_forbidden", "Do not delegate a CrewBee session back to the same active agent."));
|
|
25294
25415
|
}
|
|
25295
|
-
const title = createDelegatedTitle(target.
|
|
25416
|
+
const title = createDelegatedTitle(target.canonicalAgentId, args.prompt);
|
|
25296
25417
|
const child = await resolveChildSession({
|
|
25297
25418
|
args,
|
|
25298
25419
|
client: input.client,
|
|
25299
25420
|
parentSessionID: ctx.sessionID,
|
|
25300
25421
|
title,
|
|
25301
25422
|
store: input.store,
|
|
25302
|
-
|
|
25423
|
+
canonicalAgentId: target.canonicalAgentId,
|
|
25303
25424
|
configKey: target.configKey
|
|
25304
25425
|
}).catch((error45) => error45);
|
|
25305
25426
|
if (typeof child === "object" && "status" in child && child.status === "failed") {
|
|
@@ -25341,7 +25462,7 @@ function createDelegateTools(input) {
|
|
|
25341
25462
|
sessionID,
|
|
25342
25463
|
taskRef: record2.taskRef
|
|
25343
25464
|
});
|
|
25344
|
-
ctx.metadata({ title, metadata: { sessionId: sessionID, taskRef: record2.taskRef, agent: target.
|
|
25465
|
+
ctx.metadata({ title, metadata: { sessionId: sessionID, taskRef: record2.taskRef, agent: target.canonicalAgentId } });
|
|
25345
25466
|
return stringifyDelegateTaskResult({
|
|
25346
25467
|
status: "running",
|
|
25347
25468
|
session_id: sessionID,
|
|
@@ -25551,6 +25672,347 @@ function createToolExecuteAfterHook() {
|
|
|
25551
25672
|
};
|
|
25552
25673
|
}
|
|
25553
25674
|
|
|
25675
|
+
// src/update/refresh.ts
|
|
25676
|
+
import { spawn } from "node:child_process";
|
|
25677
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
25678
|
+
import path9 from "node:path";
|
|
25679
|
+
|
|
25680
|
+
// src/update/intent.ts
|
|
25681
|
+
import path6 from "node:path";
|
|
25682
|
+
var EXACT_SEMVER_REGEX = /^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/;
|
|
25683
|
+
var CREWBEE_PACKAGE_NAME2 = "crewbee";
|
|
25684
|
+
function findConfiguredCrewBeeReleaseIntent() {
|
|
25685
|
+
const configPath = resolveOpenCodeConfigPath();
|
|
25686
|
+
const config2 = readOpenCodeConfig(configPath).config;
|
|
25687
|
+
const plugins = Array.isArray(config2.plugin) ? config2.plugin : [];
|
|
25688
|
+
for (const entry of plugins) {
|
|
25689
|
+
if (typeof entry !== "string") {
|
|
25690
|
+
continue;
|
|
25691
|
+
}
|
|
25692
|
+
if (entry === CREWBEE_PACKAGE_NAME2) {
|
|
25693
|
+
return {
|
|
25694
|
+
configPath,
|
|
25695
|
+
entry,
|
|
25696
|
+
packageName: CREWBEE_PACKAGE_NAME2,
|
|
25697
|
+
requestedVersion: "latest",
|
|
25698
|
+
channel: "latest",
|
|
25699
|
+
isPinned: false,
|
|
25700
|
+
workspaceRoot: resolveReleaseWorkspaceRoot(entry)
|
|
25701
|
+
};
|
|
25702
|
+
}
|
|
25703
|
+
if (entry.startsWith(`${CREWBEE_PACKAGE_NAME2}@`)) {
|
|
25704
|
+
const requestedVersion = entry.slice(CREWBEE_PACKAGE_NAME2.length + 1).trim();
|
|
25705
|
+
if (!requestedVersion) {
|
|
25706
|
+
continue;
|
|
25707
|
+
}
|
|
25708
|
+
return {
|
|
25709
|
+
configPath,
|
|
25710
|
+
entry,
|
|
25711
|
+
packageName: CREWBEE_PACKAGE_NAME2,
|
|
25712
|
+
requestedVersion,
|
|
25713
|
+
channel: EXACT_SEMVER_REGEX.test(requestedVersion) ? "latest" : requestedVersion,
|
|
25714
|
+
isPinned: EXACT_SEMVER_REGEX.test(requestedVersion),
|
|
25715
|
+
workspaceRoot: resolveReleaseWorkspaceRoot(entry)
|
|
25716
|
+
};
|
|
25717
|
+
}
|
|
25718
|
+
}
|
|
25719
|
+
return void 0;
|
|
25720
|
+
}
|
|
25721
|
+
function resolveReleaseWorkspaceRoot(entry) {
|
|
25722
|
+
return path6.join(resolveInstallRoot(), "packages", sanitizePackageSpec(entry === CREWBEE_PACKAGE_NAME2 ? "crewbee@latest" : entry));
|
|
25723
|
+
}
|
|
25724
|
+
function sanitizePackageSpec(value) {
|
|
25725
|
+
const illegal = process.platform === "win32" ? /* @__PURE__ */ new Set(["<", ">", ":", '"', "|", "?", "*"]) : void 0;
|
|
25726
|
+
if (!illegal) {
|
|
25727
|
+
return value;
|
|
25728
|
+
}
|
|
25729
|
+
return Array.from(value, (char) => illegal.has(char) || char.charCodeAt(0) < 32 ? "_" : char).join("");
|
|
25730
|
+
}
|
|
25731
|
+
|
|
25732
|
+
// src/update/registry.ts
|
|
25733
|
+
async function fetchTargetVersion(input) {
|
|
25734
|
+
const url2 = `https://registry.npmjs.org/${input.intent.packageName}`;
|
|
25735
|
+
const payload = await input.fetchJson(url2).catch(() => void 0);
|
|
25736
|
+
if (!payload || typeof payload !== "object") {
|
|
25737
|
+
return void 0;
|
|
25738
|
+
}
|
|
25739
|
+
const distTags = "dist-tags" in payload && typeof payload["dist-tags"] === "object" && payload["dist-tags"] !== null ? payload["dist-tags"] : void 0;
|
|
25740
|
+
const candidate = distTags?.[input.intent.channel];
|
|
25741
|
+
return typeof candidate === "string" && candidate.trim().length > 0 ? candidate.trim() : void 0;
|
|
25742
|
+
}
|
|
25743
|
+
|
|
25744
|
+
// src/update/state.ts
|
|
25745
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync4, readFileSync as readFileSync5, unlinkSync, writeFileSync as writeFileSync4 } from "node:fs";
|
|
25746
|
+
import path7 from "node:path";
|
|
25747
|
+
function readCrewBeeReleaseState() {
|
|
25748
|
+
const filePath = resolveReleaseStatePath();
|
|
25749
|
+
if (!existsSync6(filePath)) {
|
|
25750
|
+
return {};
|
|
25751
|
+
}
|
|
25752
|
+
try {
|
|
25753
|
+
const parsed = JSON.parse(readFileSync5(filePath, "utf8"));
|
|
25754
|
+
return typeof parsed === "object" && parsed !== null ? parsed : {};
|
|
25755
|
+
} catch {
|
|
25756
|
+
return {};
|
|
25757
|
+
}
|
|
25758
|
+
}
|
|
25759
|
+
function writeCrewBeeReleaseState(state) {
|
|
25760
|
+
const filePath = resolveReleaseStatePath();
|
|
25761
|
+
mkdirSync4(path7.dirname(filePath), { recursive: true });
|
|
25762
|
+
writeFileSync4(filePath, `${JSON.stringify(state, null, 2)}
|
|
25763
|
+
`, "utf8");
|
|
25764
|
+
}
|
|
25765
|
+
function acquireCrewBeeReleaseLock() {
|
|
25766
|
+
const filePath = resolveReleaseLockPath();
|
|
25767
|
+
mkdirSync4(path7.dirname(filePath), { recursive: true });
|
|
25768
|
+
try {
|
|
25769
|
+
writeFileSync4(filePath, String(Date.now()), { encoding: "utf8", flag: "wx" });
|
|
25770
|
+
return true;
|
|
25771
|
+
} catch {
|
|
25772
|
+
return false;
|
|
25773
|
+
}
|
|
25774
|
+
}
|
|
25775
|
+
function releaseCrewBeeReleaseLock() {
|
|
25776
|
+
const filePath = resolveReleaseLockPath();
|
|
25777
|
+
if (!existsSync6(filePath)) {
|
|
25778
|
+
return;
|
|
25779
|
+
}
|
|
25780
|
+
try {
|
|
25781
|
+
unlinkSync(filePath);
|
|
25782
|
+
} catch {
|
|
25783
|
+
}
|
|
25784
|
+
}
|
|
25785
|
+
function resolveReleaseStatePath() {
|
|
25786
|
+
return path7.join(resolveInstallRoot(), "crewbee-release-state.json");
|
|
25787
|
+
}
|
|
25788
|
+
function resolveReleaseLockPath() {
|
|
25789
|
+
return path7.join(resolveInstallRoot(), "crewbee-release-refresh.lock");
|
|
25790
|
+
}
|
|
25791
|
+
|
|
25792
|
+
// src/update/workspace.ts
|
|
25793
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync5, readFileSync as readFileSync6, rmSync, writeFileSync as writeFileSync5 } from "node:fs";
|
|
25794
|
+
import path8 from "node:path";
|
|
25795
|
+
function readInstalledWorkspaceVersion(workspaceRoot) {
|
|
25796
|
+
const manifestPath = path8.join(workspaceRoot, "node_modules", "crewbee", "package.json");
|
|
25797
|
+
if (!existsSync7(manifestPath)) {
|
|
25798
|
+
return void 0;
|
|
25799
|
+
}
|
|
25800
|
+
try {
|
|
25801
|
+
const parsed = JSON.parse(readFileSync6(manifestPath, "utf8"));
|
|
25802
|
+
return typeof parsed.version === "string" ? parsed.version : void 0;
|
|
25803
|
+
} catch {
|
|
25804
|
+
return void 0;
|
|
25805
|
+
}
|
|
25806
|
+
}
|
|
25807
|
+
function syncWorkspaceDependencyIntent(intent, targetVersion) {
|
|
25808
|
+
const packageJsonPath = path8.join(intent.workspaceRoot, "package.json");
|
|
25809
|
+
const desiredVersion = intent.isPinned ? intent.requestedVersion : targetVersion;
|
|
25810
|
+
const current = readWorkspacePackageJson(packageJsonPath);
|
|
25811
|
+
const next = {
|
|
25812
|
+
...current,
|
|
25813
|
+
private: true,
|
|
25814
|
+
name: current.name ?? `${intent.packageName}-release-workspace`,
|
|
25815
|
+
version: current.version ?? "0.0.0",
|
|
25816
|
+
dependencies: {
|
|
25817
|
+
...current.dependencies ?? {},
|
|
25818
|
+
[intent.packageName]: desiredVersion
|
|
25819
|
+
}
|
|
25820
|
+
};
|
|
25821
|
+
const changed = JSON.stringify(current) !== JSON.stringify(next);
|
|
25822
|
+
if (changed) {
|
|
25823
|
+
mkdirSync5(intent.workspaceRoot, { recursive: true });
|
|
25824
|
+
writeFileSync5(packageJsonPath, `${JSON.stringify(next, null, 2)}
|
|
25825
|
+
`, "utf8");
|
|
25826
|
+
}
|
|
25827
|
+
return { changed };
|
|
25828
|
+
}
|
|
25829
|
+
function invalidateWorkspacePackage(intent) {
|
|
25830
|
+
const packageRoot = path8.join(intent.workspaceRoot, "node_modules", intent.packageName);
|
|
25831
|
+
const lockPath = path8.join(intent.workspaceRoot, "package-lock.json");
|
|
25832
|
+
let changed = false;
|
|
25833
|
+
if (existsSync7(packageRoot)) {
|
|
25834
|
+
rmSync(packageRoot, { recursive: true, force: true });
|
|
25835
|
+
changed = true;
|
|
25836
|
+
}
|
|
25837
|
+
if (existsSync7(lockPath)) {
|
|
25838
|
+
rmSync(lockPath, { force: true });
|
|
25839
|
+
changed = true;
|
|
25840
|
+
}
|
|
25841
|
+
return changed;
|
|
25842
|
+
}
|
|
25843
|
+
function readWorkspacePackageJson(packageJsonPath) {
|
|
25844
|
+
if (!existsSync7(packageJsonPath)) {
|
|
25845
|
+
return {};
|
|
25846
|
+
}
|
|
25847
|
+
try {
|
|
25848
|
+
const parsed = JSON.parse(readFileSync6(packageJsonPath, "utf8"));
|
|
25849
|
+
return typeof parsed === "object" && parsed !== null ? parsed : {};
|
|
25850
|
+
} catch {
|
|
25851
|
+
return {};
|
|
25852
|
+
}
|
|
25853
|
+
}
|
|
25854
|
+
|
|
25855
|
+
// src/update/refresh.ts
|
|
25856
|
+
var SUCCESS_RECHECK_MS = 60 * 60 * 1e3;
|
|
25857
|
+
var FAILURE_RECHECK_MS = 30 * 60 * 1e3;
|
|
25858
|
+
function startBackgroundReleaseRefresh(ctx, deps = createDefaultDependencies()) {
|
|
25859
|
+
if (!shouldEnableCrewBeeReleaseRefresh()) {
|
|
25860
|
+
return;
|
|
25861
|
+
}
|
|
25862
|
+
queueMicrotask(() => {
|
|
25863
|
+
void runBackgroundReleaseRefresh(ctx, deps).catch(() => void 0);
|
|
25864
|
+
});
|
|
25865
|
+
}
|
|
25866
|
+
async function runBackgroundReleaseRefresh(ctx, deps) {
|
|
25867
|
+
if (!acquireCrewBeeReleaseLock()) {
|
|
25868
|
+
await logCrewBee(ctx, "CrewBee release refresh skipped because another refresh is already running", void 0, "debug");
|
|
25869
|
+
return { needsRefresh: false, reason: "up-to-date" };
|
|
25870
|
+
}
|
|
25871
|
+
try {
|
|
25872
|
+
const intent = findConfiguredCrewBeeReleaseIntent();
|
|
25873
|
+
if (!intent) {
|
|
25874
|
+
await logCrewBee(ctx, "CrewBee release refresh skipped because plugin is not configured", void 0, "debug");
|
|
25875
|
+
return { needsRefresh: false, reason: "plugin-not-configured" };
|
|
25876
|
+
}
|
|
25877
|
+
const state = readCrewBeeReleaseState();
|
|
25878
|
+
const now = Date.now();
|
|
25879
|
+
const currentVersion = readInstalledWorkspaceVersion(intent.workspaceRoot) ?? state.lastKnownVersion;
|
|
25880
|
+
if (shouldSkipByCooldown(state, now)) {
|
|
25881
|
+
await logCrewBee(ctx, "CrewBee release refresh skipped by cooldown", {
|
|
25882
|
+
currentVersion,
|
|
25883
|
+
lastCheckedAt: state.lastCheckedAt,
|
|
25884
|
+
lastFailureAt: state.lastFailureAt,
|
|
25885
|
+
lastSucceededAt: state.lastSucceededAt
|
|
25886
|
+
}, "debug");
|
|
25887
|
+
return { currentVersion, needsRefresh: false, reason: "up-to-date" };
|
|
25888
|
+
}
|
|
25889
|
+
if (intent.isPinned) {
|
|
25890
|
+
await logCrewBee(ctx, "CrewBee release refresh skipped for pinned version", {
|
|
25891
|
+
entry: intent.entry,
|
|
25892
|
+
pinnedVersion: intent.requestedVersion,
|
|
25893
|
+
currentVersion
|
|
25894
|
+
});
|
|
25895
|
+
return { currentVersion, latestVersion: intent.requestedVersion, needsRefresh: false, reason: "pinned-version" };
|
|
25896
|
+
}
|
|
25897
|
+
const latestVersion = await fetchTargetVersion({ intent, fetchJson: deps.fetchJson });
|
|
25898
|
+
if (!latestVersion) {
|
|
25899
|
+
writeCrewBeeReleaseState({
|
|
25900
|
+
...state,
|
|
25901
|
+
lastCheckedAt: now
|
|
25902
|
+
});
|
|
25903
|
+
await logCrewBee(ctx, "CrewBee release refresh could not resolve latest version", {
|
|
25904
|
+
entry: intent.entry,
|
|
25905
|
+
channel: intent.channel,
|
|
25906
|
+
currentVersion
|
|
25907
|
+
}, "warn");
|
|
25908
|
+
return { currentVersion, needsRefresh: false, reason: "latest-unavailable" };
|
|
25909
|
+
}
|
|
25910
|
+
if (currentVersion === latestVersion) {
|
|
25911
|
+
writeCrewBeeReleaseState({
|
|
25912
|
+
...state,
|
|
25913
|
+
lastCheckedAt: now,
|
|
25914
|
+
lastKnownVersion: currentVersion,
|
|
25915
|
+
lastFailure: void 0,
|
|
25916
|
+
lastFailureAt: void 0,
|
|
25917
|
+
lastSucceededAt: now
|
|
25918
|
+
});
|
|
25919
|
+
await logCrewBee(ctx, "CrewBee release refresh found current version already up to date", {
|
|
25920
|
+
currentVersion,
|
|
25921
|
+
latestVersion,
|
|
25922
|
+
workspaceRoot: intent.workspaceRoot
|
|
25923
|
+
}, "debug");
|
|
25924
|
+
return { currentVersion, latestVersion, needsRefresh: false, reason: "up-to-date" };
|
|
25925
|
+
}
|
|
25926
|
+
await logCrewBee(ctx, "CrewBee release refresh found newer version", {
|
|
25927
|
+
currentVersion,
|
|
25928
|
+
latestVersion,
|
|
25929
|
+
workspaceRoot: intent.workspaceRoot,
|
|
25930
|
+
entry: intent.entry
|
|
25931
|
+
});
|
|
25932
|
+
syncWorkspaceDependencyIntent(intent, latestVersion);
|
|
25933
|
+
invalidateWorkspacePackage(intent);
|
|
25934
|
+
const installed = await deps.runInstall(intent.workspaceRoot);
|
|
25935
|
+
if (!installed) {
|
|
25936
|
+
writeCrewBeeReleaseState({
|
|
25937
|
+
...state,
|
|
25938
|
+
lastCheckedAt: now,
|
|
25939
|
+
lastAttemptedVersion: latestVersion,
|
|
25940
|
+
lastFailure: `Failed to install ${latestVersion}`,
|
|
25941
|
+
lastFailureAt: now,
|
|
25942
|
+
lastKnownVersion: currentVersion
|
|
25943
|
+
});
|
|
25944
|
+
await logCrewBee(ctx, "CrewBee release refresh failed to install latest version", {
|
|
25945
|
+
currentVersion,
|
|
25946
|
+
latestVersion,
|
|
25947
|
+
workspaceRoot: intent.workspaceRoot
|
|
25948
|
+
}, "warn");
|
|
25949
|
+
return { currentVersion, latestVersion, needsRefresh: true, reason: "refresh-required" };
|
|
25950
|
+
}
|
|
25951
|
+
writeCrewBeeReleaseState({
|
|
25952
|
+
lastCheckedAt: now,
|
|
25953
|
+
lastAttemptedVersion: latestVersion,
|
|
25954
|
+
lastKnownVersion: latestVersion,
|
|
25955
|
+
lastFailure: void 0,
|
|
25956
|
+
lastFailureAt: void 0,
|
|
25957
|
+
lastSucceededAt: now
|
|
25958
|
+
});
|
|
25959
|
+
await logCrewBee(ctx, "CrewBee release refresh installed newer version", {
|
|
25960
|
+
currentVersion,
|
|
25961
|
+
latestVersion,
|
|
25962
|
+
workspaceRoot: intent.workspaceRoot
|
|
25963
|
+
});
|
|
25964
|
+
return { currentVersion, latestVersion, needsRefresh: true, reason: "refresh-required" };
|
|
25965
|
+
} finally {
|
|
25966
|
+
releaseCrewBeeReleaseLock();
|
|
25967
|
+
}
|
|
25968
|
+
}
|
|
25969
|
+
function shouldEnableCrewBeeReleaseRefresh(currentPackageRoot = resolveCurrentPackageRoot()) {
|
|
25970
|
+
const override = process.env.CREWBEE_AUTO_UPDATE?.trim().toLowerCase();
|
|
25971
|
+
if (override === "1" || override === "true" || override === "on") {
|
|
25972
|
+
return true;
|
|
25973
|
+
}
|
|
25974
|
+
if (override === "0" || override === "false" || override === "off") {
|
|
25975
|
+
return false;
|
|
25976
|
+
}
|
|
25977
|
+
if (process.env.NODE_ENV === "test") {
|
|
25978
|
+
return false;
|
|
25979
|
+
}
|
|
25980
|
+
return !existsSync8(path9.join(currentPackageRoot, ".git"));
|
|
25981
|
+
}
|
|
25982
|
+
function shouldSkipByCooldown(state, now) {
|
|
25983
|
+
if (state.lastFailureAt && now - state.lastFailureAt < FAILURE_RECHECK_MS) {
|
|
25984
|
+
return true;
|
|
25985
|
+
}
|
|
25986
|
+
if (state.lastSucceededAt && now - state.lastSucceededAt < SUCCESS_RECHECK_MS) {
|
|
25987
|
+
return true;
|
|
25988
|
+
}
|
|
25989
|
+
return false;
|
|
25990
|
+
}
|
|
25991
|
+
function resolveCurrentPackageRoot() {
|
|
25992
|
+
return path9.resolve(__dirname, "../..");
|
|
25993
|
+
}
|
|
25994
|
+
function createDefaultDependencies() {
|
|
25995
|
+
return {
|
|
25996
|
+
async fetchJson(url2) {
|
|
25997
|
+
const response = await fetch(url2);
|
|
25998
|
+
if (!response.ok) {
|
|
25999
|
+
throw new Error(`Failed to fetch ${url2}: ${response.status}`);
|
|
26000
|
+
}
|
|
26001
|
+
return response.json();
|
|
26002
|
+
},
|
|
26003
|
+
async runInstall(workspaceRoot) {
|
|
26004
|
+
return new Promise((resolve) => {
|
|
26005
|
+
const child = spawn("npm", ["install", "--prefix", workspaceRoot, "--no-audit", "--no-fund"], {
|
|
26006
|
+
shell: process.platform === "win32",
|
|
26007
|
+
stdio: "ignore"
|
|
26008
|
+
});
|
|
26009
|
+
child.on("error", () => resolve(false));
|
|
26010
|
+
child.on("exit", (code) => resolve(code === 0));
|
|
26011
|
+
});
|
|
26012
|
+
}
|
|
26013
|
+
};
|
|
26014
|
+
}
|
|
26015
|
+
|
|
25554
26016
|
// src/adapters/opencode/plugin.ts
|
|
25555
26017
|
var OpenCodeCrewBeePlugin = async (ctx) => {
|
|
25556
26018
|
const crewbeeConfigUpdate = ensureCrewBeeConfigFile({
|
|
@@ -25573,6 +26035,7 @@ var OpenCodeCrewBeePlugin = async (ctx) => {
|
|
|
25573
26035
|
visibleAgentCount: initial.boot.projectedAgents.filter((agent) => !agent.hidden).length,
|
|
25574
26036
|
defaultAgent: initial.boot.configPatch.defaultAgent
|
|
25575
26037
|
});
|
|
26038
|
+
startBackgroundReleaseRefresh(ctx);
|
|
25576
26039
|
let boot = initial.boot;
|
|
25577
26040
|
let aliasIndex = initial.aliasIndex;
|
|
25578
26041
|
const bindings = /* @__PURE__ */ new Map();
|