@zcy2nn/agent-forge 1.1.2 → 1.1.3
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 +247 -247
- package/dist/agents/designer.d.ts +2 -0
- package/dist/agents/explorer.d.ts +2 -0
- package/dist/agents/fixer.d.ts +2 -0
- package/dist/agents/librarian.d.ts +2 -0
- package/dist/agents/observer.d.ts +2 -0
- package/dist/agents/oracle.d.ts +2 -0
- package/dist/cli/index.js +6 -129
- package/dist/cli/migration.d.ts +46 -0
- package/dist/hooks/filter-available-skills/index.d.ts +4 -13
- package/dist/index.js +124 -316
- package/dist/skills/systematic-debugging/condition-based-waiting-example.d.ts +51 -0
- package/dist/tui.js +0 -14
- package/package.json +104 -104
- package/src/skills/brainstorming/SKILL.md +186 -186
- package/src/skills/brainstorming/scripts/frame-template.html +214 -214
- package/src/skills/brainstorming/scripts/server.cjs +354 -354
- package/src/skills/systematic-debugging/SKILL.md +318 -318
- package/src/skills/test-driven-development/SKILL.md +392 -392
- package/src/skills/verification-before-completion/SKILL.md +153 -153
- package/src/skills/writing-skills/graphviz-conventions.dot +171 -171
- package/dist/cli/skill-sync.d.ts +0 -23
- package/dist/utils/package-root.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -30,175 +30,8 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
30
30
|
return to;
|
|
31
31
|
};
|
|
32
32
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
33
|
-
var __returnValue = (v) => v;
|
|
34
|
-
function __exportSetter(name, newValue) {
|
|
35
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
36
|
-
}
|
|
37
|
-
var __export = (target, all) => {
|
|
38
|
-
for (var name in all)
|
|
39
|
-
__defProp(target, name, {
|
|
40
|
-
get: all[name],
|
|
41
|
-
enumerable: true,
|
|
42
|
-
configurable: true,
|
|
43
|
-
set: __exportSetter.bind(all, name)
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
47
33
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
48
34
|
|
|
49
|
-
// src/cli/custom-skills.ts
|
|
50
|
-
var CUSTOM_SKILLS;
|
|
51
|
-
var init_custom_skills = __esm(() => {
|
|
52
|
-
CUSTOM_SKILLS = [
|
|
53
|
-
{
|
|
54
|
-
name: "simplify",
|
|
55
|
-
description: "Code simplification and readability-focused refactoring",
|
|
56
|
-
allowedAgents: ["reviewer"],
|
|
57
|
-
sourcePath: "src/skills/simplify"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
name: "codemap",
|
|
61
|
-
description: "Repository understanding and hierarchical codemap generation",
|
|
62
|
-
allowedAgents: ["orchestrator"],
|
|
63
|
-
sourcePath: "src/skills/codemap"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: "brainstorming",
|
|
67
|
-
description: "Turn ideas into designs through collaborative dialogue before implementation",
|
|
68
|
-
allowedAgents: ["orchestrator"],
|
|
69
|
-
sourcePath: "src/skills/brainstorming"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
name: "writing-plans",
|
|
73
|
-
description: "Create comprehensive implementation plans from specs before touching code",
|
|
74
|
-
allowedAgents: ["orchestrator"],
|
|
75
|
-
sourcePath: "src/skills/writing-plans"
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: "executing-plans",
|
|
79
|
-
description: "Execute written implementation plans with review checkpoints",
|
|
80
|
-
allowedAgents: ["orchestrator"],
|
|
81
|
-
sourcePath: "src/skills/executing-plans"
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: "subagent-driven-development",
|
|
85
|
-
description: "Execute plans by dispatching fresh subagent per task with two-stage review",
|
|
86
|
-
allowedAgents: ["orchestrator"],
|
|
87
|
-
sourcePath: "src/skills/subagent-driven-development"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: "dispatching-parallel-agents",
|
|
91
|
-
description: "Dispatch parallel agents for independent tasks without shared state",
|
|
92
|
-
allowedAgents: ["orchestrator"],
|
|
93
|
-
sourcePath: "src/skills/dispatching-parallel-agents"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
name: "using-git-worktrees",
|
|
97
|
-
description: "Create isolated git worktrees before executing implementation plans",
|
|
98
|
-
allowedAgents: ["orchestrator"],
|
|
99
|
-
sourcePath: "src/skills/using-git-worktrees"
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
name: "finishing-a-development-branch",
|
|
103
|
-
description: "Guide completion of development work with structured merge/PR options",
|
|
104
|
-
allowedAgents: ["orchestrator"],
|
|
105
|
-
sourcePath: "src/skills/finishing-a-development-branch"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
name: "requesting-code-review",
|
|
109
|
-
description: "Dispatch code reviewer subagent to catch issues before merging",
|
|
110
|
-
allowedAgents: ["orchestrator"],
|
|
111
|
-
sourcePath: "src/skills/requesting-code-review"
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
name: "test-driven-development",
|
|
115
|
-
description: "Write failing tests first, then minimal code to pass, before any implementation",
|
|
116
|
-
allowedAgents: ["implementer"],
|
|
117
|
-
sourcePath: "src/skills/test-driven-development"
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
name: "verification-before-completion",
|
|
121
|
-
description: "Run verification commands and confirm output before claiming work is complete",
|
|
122
|
-
allowedAgents: ["implementer"],
|
|
123
|
-
sourcePath: "src/skills/verification-before-completion"
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
name: "systematic-debugging",
|
|
127
|
-
description: "Find root cause before attempting fixes for any bug or test failure",
|
|
128
|
-
allowedAgents: ["reviewer"],
|
|
129
|
-
sourcePath: "src/skills/systematic-debugging"
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
name: "receiving-code-review",
|
|
133
|
-
description: "Evaluate code review feedback with technical rigor before implementing suggestions",
|
|
134
|
-
allowedAgents: ["reviewer"],
|
|
135
|
-
sourcePath: "src/skills/receiving-code-review"
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
name: "writing-skills",
|
|
139
|
-
description: "Create and edit skills using TDD methodology for process documentation",
|
|
140
|
-
allowedAgents: ["orchestrator"],
|
|
141
|
-
sourcePath: "src/skills/writing-skills"
|
|
142
|
-
}
|
|
143
|
-
];
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
// src/cli/paths.ts
|
|
147
|
-
import { homedir } from "node:os";
|
|
148
|
-
import { dirname, join } from "node:path";
|
|
149
|
-
function getDefaultOpenCodeConfigDir() {
|
|
150
|
-
const userConfigDir = process.env.XDG_CONFIG_HOME ? process.env.XDG_CONFIG_HOME : join(homedir(), ".config");
|
|
151
|
-
return join(userConfigDir, "opencode");
|
|
152
|
-
}
|
|
153
|
-
function getCustomOpenCodeConfigDir() {
|
|
154
|
-
const configDir = process.env.OPENCODE_CONFIG_DIR?.trim();
|
|
155
|
-
return configDir || undefined;
|
|
156
|
-
}
|
|
157
|
-
function getConfigDir() {
|
|
158
|
-
const customConfigDir = getCustomOpenCodeConfigDir();
|
|
159
|
-
if (customConfigDir) {
|
|
160
|
-
return customConfigDir;
|
|
161
|
-
}
|
|
162
|
-
return getDefaultOpenCodeConfigDir();
|
|
163
|
-
}
|
|
164
|
-
function getConfigSearchDirs() {
|
|
165
|
-
const dirs = [getCustomOpenCodeConfigDir(), getDefaultOpenCodeConfigDir()];
|
|
166
|
-
return dirs.filter((dir, index) => {
|
|
167
|
-
return Boolean(dir) && dirs.indexOf(dir) === index;
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
function getOpenCodeConfigPaths() {
|
|
171
|
-
const configDir = getDefaultOpenCodeConfigDir();
|
|
172
|
-
return [join(configDir, "opencode.json"), join(configDir, "opencode.jsonc")];
|
|
173
|
-
}
|
|
174
|
-
var init_paths = () => {};
|
|
175
|
-
|
|
176
|
-
// src/utils/package-root.ts
|
|
177
|
-
import { existsSync as existsSync10 } from "node:fs";
|
|
178
|
-
import { join as join13 } from "node:path";
|
|
179
|
-
function resolvePackageRoot() {
|
|
180
|
-
if (_cachedPackageRoot)
|
|
181
|
-
return _cachedPackageRoot;
|
|
182
|
-
const distDir = import.meta.dirname;
|
|
183
|
-
if (!distDir) {
|
|
184
|
-
throw new Error("import.meta.dirname is not available");
|
|
185
|
-
}
|
|
186
|
-
const npmRoot = join13(distDir, "..", "..");
|
|
187
|
-
if (existsSync10(join13(npmRoot, "src", "skills"))) {
|
|
188
|
-
_cachedPackageRoot = npmRoot;
|
|
189
|
-
return npmRoot;
|
|
190
|
-
}
|
|
191
|
-
const localRoot = join13(distDir, "..");
|
|
192
|
-
if (existsSync10(join13(localRoot, "src", "skills"))) {
|
|
193
|
-
_cachedPackageRoot = localRoot;
|
|
194
|
-
return localRoot;
|
|
195
|
-
}
|
|
196
|
-
_cachedPackageRoot = npmRoot;
|
|
197
|
-
return npmRoot;
|
|
198
|
-
}
|
|
199
|
-
var _cachedPackageRoot;
|
|
200
|
-
var init_package_root = () => {};
|
|
201
|
-
|
|
202
35
|
// node_modules/@mozilla/readability/Readability.js
|
|
203
36
|
var require_Readability = __commonJS((exports, module) => {
|
|
204
37
|
function Readability(doc, options) {
|
|
@@ -18317,14 +18150,14 @@ var require_turndown_cjs = __commonJS((exports, module) => {
|
|
|
18317
18150
|
} else if (node.nodeType === 1) {
|
|
18318
18151
|
replacement = replacementForNode.call(self, node);
|
|
18319
18152
|
}
|
|
18320
|
-
return
|
|
18153
|
+
return join14(output, replacement);
|
|
18321
18154
|
}, "");
|
|
18322
18155
|
}
|
|
18323
18156
|
function postProcess(output) {
|
|
18324
18157
|
var self = this;
|
|
18325
18158
|
this.rules.forEach(function(rule) {
|
|
18326
18159
|
if (typeof rule.append === "function") {
|
|
18327
|
-
output =
|
|
18160
|
+
output = join14(output, rule.append(self.options));
|
|
18328
18161
|
}
|
|
18329
18162
|
});
|
|
18330
18163
|
return output.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n\s]+$/, "");
|
|
@@ -18337,7 +18170,7 @@ var require_turndown_cjs = __commonJS((exports, module) => {
|
|
|
18337
18170
|
content = content.trim();
|
|
18338
18171
|
return whitespace.leading + rule.replacement(content, node, this.options) + whitespace.trailing;
|
|
18339
18172
|
}
|
|
18340
|
-
function
|
|
18173
|
+
function join14(output, replacement) {
|
|
18341
18174
|
var s1 = trimTrailingNewlines(output);
|
|
18342
18175
|
var s2 = trimLeadingNewlines(replacement);
|
|
18343
18176
|
var nls = Math.max(output.length - s1.length, replacement.length - s2.length);
|
|
@@ -18352,81 +18185,101 @@ var require_turndown_cjs = __commonJS((exports, module) => {
|
|
|
18352
18185
|
module.exports = TurndownService;
|
|
18353
18186
|
});
|
|
18354
18187
|
|
|
18355
|
-
// src/cli/
|
|
18356
|
-
var
|
|
18357
|
-
|
|
18358
|
-
|
|
18359
|
-
|
|
18360
|
-
|
|
18361
|
-
|
|
18362
|
-
|
|
18363
|
-
|
|
18364
|
-
|
|
18365
|
-
|
|
18366
|
-
|
|
18367
|
-
|
|
18368
|
-
}
|
|
18369
|
-
|
|
18370
|
-
|
|
18371
|
-
|
|
18372
|
-
|
|
18373
|
-
|
|
18374
|
-
|
|
18375
|
-
|
|
18376
|
-
|
|
18377
|
-
|
|
18378
|
-
|
|
18379
|
-
|
|
18380
|
-
|
|
18381
|
-
|
|
18382
|
-
|
|
18383
|
-
|
|
18384
|
-
|
|
18385
|
-
|
|
18386
|
-
|
|
18387
|
-
|
|
18388
|
-
|
|
18389
|
-
|
|
18390
|
-
|
|
18391
|
-
|
|
18392
|
-
|
|
18393
|
-
|
|
18394
|
-
|
|
18395
|
-
|
|
18396
|
-
|
|
18397
|
-
|
|
18398
|
-
|
|
18399
|
-
|
|
18400
|
-
|
|
18401
|
-
|
|
18402
|
-
|
|
18403
|
-
|
|
18404
|
-
|
|
18405
|
-
|
|
18406
|
-
|
|
18407
|
-
|
|
18408
|
-
|
|
18409
|
-
|
|
18410
|
-
|
|
18411
|
-
|
|
18412
|
-
|
|
18413
|
-
|
|
18414
|
-
|
|
18415
|
-
|
|
18416
|
-
|
|
18417
|
-
|
|
18418
|
-
|
|
18419
|
-
|
|
18188
|
+
// src/cli/custom-skills.ts
|
|
18189
|
+
var CUSTOM_SKILLS = [
|
|
18190
|
+
{
|
|
18191
|
+
name: "simplify",
|
|
18192
|
+
description: "Code simplification and readability-focused refactoring",
|
|
18193
|
+
allowedAgents: ["reviewer"],
|
|
18194
|
+
sourcePath: "src/skills/simplify"
|
|
18195
|
+
},
|
|
18196
|
+
{
|
|
18197
|
+
name: "codemap",
|
|
18198
|
+
description: "Repository understanding and hierarchical codemap generation",
|
|
18199
|
+
allowedAgents: ["orchestrator"],
|
|
18200
|
+
sourcePath: "src/skills/codemap"
|
|
18201
|
+
},
|
|
18202
|
+
{
|
|
18203
|
+
name: "brainstorming",
|
|
18204
|
+
description: "Turn ideas into designs through collaborative dialogue before implementation",
|
|
18205
|
+
allowedAgents: ["orchestrator"],
|
|
18206
|
+
sourcePath: "src/skills/brainstorming"
|
|
18207
|
+
},
|
|
18208
|
+
{
|
|
18209
|
+
name: "writing-plans",
|
|
18210
|
+
description: "Create comprehensive implementation plans from specs before touching code",
|
|
18211
|
+
allowedAgents: ["orchestrator"],
|
|
18212
|
+
sourcePath: "src/skills/writing-plans"
|
|
18213
|
+
},
|
|
18214
|
+
{
|
|
18215
|
+
name: "executing-plans",
|
|
18216
|
+
description: "Execute written implementation plans with review checkpoints",
|
|
18217
|
+
allowedAgents: ["orchestrator"],
|
|
18218
|
+
sourcePath: "src/skills/executing-plans"
|
|
18219
|
+
},
|
|
18220
|
+
{
|
|
18221
|
+
name: "subagent-driven-development",
|
|
18222
|
+
description: "Execute plans by dispatching fresh subagent per task with two-stage review",
|
|
18223
|
+
allowedAgents: ["orchestrator"],
|
|
18224
|
+
sourcePath: "src/skills/subagent-driven-development"
|
|
18225
|
+
},
|
|
18226
|
+
{
|
|
18227
|
+
name: "dispatching-parallel-agents",
|
|
18228
|
+
description: "Dispatch parallel agents for independent tasks without shared state",
|
|
18229
|
+
allowedAgents: ["orchestrator"],
|
|
18230
|
+
sourcePath: "src/skills/dispatching-parallel-agents"
|
|
18231
|
+
},
|
|
18232
|
+
{
|
|
18233
|
+
name: "using-git-worktrees",
|
|
18234
|
+
description: "Create isolated git worktrees before executing implementation plans",
|
|
18235
|
+
allowedAgents: ["orchestrator"],
|
|
18236
|
+
sourcePath: "src/skills/using-git-worktrees"
|
|
18237
|
+
},
|
|
18238
|
+
{
|
|
18239
|
+
name: "finishing-a-development-branch",
|
|
18240
|
+
description: "Guide completion of development work with structured merge/PR options",
|
|
18241
|
+
allowedAgents: ["orchestrator"],
|
|
18242
|
+
sourcePath: "src/skills/finishing-a-development-branch"
|
|
18243
|
+
},
|
|
18244
|
+
{
|
|
18245
|
+
name: "requesting-code-review",
|
|
18246
|
+
description: "Dispatch code reviewer subagent to catch issues before merging",
|
|
18247
|
+
allowedAgents: ["orchestrator"],
|
|
18248
|
+
sourcePath: "src/skills/requesting-code-review"
|
|
18249
|
+
},
|
|
18250
|
+
{
|
|
18251
|
+
name: "test-driven-development",
|
|
18252
|
+
description: "Write failing tests first, then minimal code to pass, before any implementation",
|
|
18253
|
+
allowedAgents: ["implementer"],
|
|
18254
|
+
sourcePath: "src/skills/test-driven-development"
|
|
18255
|
+
},
|
|
18256
|
+
{
|
|
18257
|
+
name: "verification-before-completion",
|
|
18258
|
+
description: "Run verification commands and confirm output before claiming work is complete",
|
|
18259
|
+
allowedAgents: ["implementer"],
|
|
18260
|
+
sourcePath: "src/skills/verification-before-completion"
|
|
18261
|
+
},
|
|
18262
|
+
{
|
|
18263
|
+
name: "systematic-debugging",
|
|
18264
|
+
description: "Find root cause before attempting fixes for any bug or test failure",
|
|
18265
|
+
allowedAgents: ["reviewer"],
|
|
18266
|
+
sourcePath: "src/skills/systematic-debugging"
|
|
18267
|
+
},
|
|
18268
|
+
{
|
|
18269
|
+
name: "receiving-code-review",
|
|
18270
|
+
description: "Evaluate code review feedback with technical rigor before implementing suggestions",
|
|
18271
|
+
allowedAgents: ["reviewer"],
|
|
18272
|
+
sourcePath: "src/skills/receiving-code-review"
|
|
18273
|
+
},
|
|
18274
|
+
{
|
|
18275
|
+
name: "writing-skills",
|
|
18276
|
+
description: "Create and edit skills using TDD methodology for process documentation",
|
|
18277
|
+
allowedAgents: ["orchestrator"],
|
|
18278
|
+
sourcePath: "src/skills/writing-skills"
|
|
18420
18279
|
}
|
|
18421
|
-
|
|
18422
|
-
var init_skill_sync = __esm(() => {
|
|
18423
|
-
init_package_root();
|
|
18424
|
-
init_custom_skills();
|
|
18425
|
-
init_paths();
|
|
18426
|
-
});
|
|
18280
|
+
];
|
|
18427
18281
|
|
|
18428
18282
|
// src/cli/skills.ts
|
|
18429
|
-
init_custom_skills();
|
|
18430
18283
|
var RECOMMENDED_SKILLS = [
|
|
18431
18284
|
{
|
|
18432
18285
|
name: "agent-browser",
|
|
@@ -18586,8 +18439,27 @@ var CouncilConfigSchema = z.object({
|
|
|
18586
18439
|
import * as fs from "node:fs";
|
|
18587
18440
|
import * as path from "node:path";
|
|
18588
18441
|
|
|
18589
|
-
// src/cli/
|
|
18590
|
-
|
|
18442
|
+
// src/cli/paths.ts
|
|
18443
|
+
import { homedir } from "node:os";
|
|
18444
|
+
import { dirname, join } from "node:path";
|
|
18445
|
+
function getDefaultOpenCodeConfigDir() {
|
|
18446
|
+
const userConfigDir = process.env.XDG_CONFIG_HOME ? process.env.XDG_CONFIG_HOME : join(homedir(), ".config");
|
|
18447
|
+
return join(userConfigDir, "opencode");
|
|
18448
|
+
}
|
|
18449
|
+
function getCustomOpenCodeConfigDir() {
|
|
18450
|
+
const configDir = process.env.OPENCODE_CONFIG_DIR?.trim();
|
|
18451
|
+
return configDir || undefined;
|
|
18452
|
+
}
|
|
18453
|
+
function getConfigSearchDirs() {
|
|
18454
|
+
const dirs = [getCustomOpenCodeConfigDir(), getDefaultOpenCodeConfigDir()];
|
|
18455
|
+
return dirs.filter((dir, index) => {
|
|
18456
|
+
return Boolean(dir) && dirs.indexOf(dir) === index;
|
|
18457
|
+
});
|
|
18458
|
+
}
|
|
18459
|
+
function getOpenCodeConfigPaths() {
|
|
18460
|
+
const configDir = getDefaultOpenCodeConfigDir();
|
|
18461
|
+
return [join(configDir, "opencode.json"), join(configDir, "opencode.jsonc")];
|
|
18462
|
+
}
|
|
18591
18463
|
|
|
18592
18464
|
// src/config/agent-mcps.ts
|
|
18593
18465
|
var DEFAULT_AGENT_MCPS = {
|
|
@@ -18621,9 +18493,6 @@ function getAgentMcpList(agentName, config) {
|
|
|
18621
18493
|
return defaultMcps ?? [];
|
|
18622
18494
|
}
|
|
18623
18495
|
|
|
18624
|
-
// src/cli/providers.ts
|
|
18625
|
-
init_custom_skills();
|
|
18626
|
-
|
|
18627
18496
|
// src/cli/config-io.ts
|
|
18628
18497
|
function stripJsonComments(json) {
|
|
18629
18498
|
const commentPattern = /\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g;
|
|
@@ -18631,9 +18500,6 @@ function stripJsonComments(json) {
|
|
|
18631
18500
|
return json.replace(commentPattern, (match, commentGroup) => commentGroup ? "" : match).replace(trailingCommaPattern, (match, comma, closing) => comma ? closing : match);
|
|
18632
18501
|
}
|
|
18633
18502
|
|
|
18634
|
-
// src/config/loader.ts
|
|
18635
|
-
init_paths();
|
|
18636
|
-
|
|
18637
18503
|
// src/config/schema.ts
|
|
18638
18504
|
import { z as z2 } from "zod";
|
|
18639
18505
|
var ProviderModelIdSchema = z2.string().regex(/^[^/\s]+\/[^\s]+$/, "Expected provider/model format (provider/.../model)");
|
|
@@ -21958,10 +21824,6 @@ async function crossWrite(path6, data) {
|
|
|
21958
21824
|
// src/hooks/auto-update-checker/cache.ts
|
|
21959
21825
|
import * as fs5 from "node:fs";
|
|
21960
21826
|
import * as path8 from "node:path";
|
|
21961
|
-
|
|
21962
|
-
// src/cli/config-manager.ts
|
|
21963
|
-
init_paths();
|
|
21964
|
-
|
|
21965
21827
|
// src/hooks/auto-update-checker/checker.ts
|
|
21966
21828
|
import * as fs4 from "node:fs";
|
|
21967
21829
|
import * as path7 from "node:path";
|
|
@@ -22933,22 +22795,8 @@ ${buildRetryGuidance(detected)}`;
|
|
|
22933
22795
|
};
|
|
22934
22796
|
}
|
|
22935
22797
|
// src/hooks/filter-available-skills/index.ts
|
|
22936
|
-
init_custom_skills();
|
|
22937
22798
|
var AVAILABLE_SKILLS_BLOCK_REGEX = /<available_skills>\s*([\s\S]*?)\s*<\/available_skills>/g;
|
|
22938
22799
|
var SKILL_NAME_REGEX = /<name>([^<]+)<\/name>/;
|
|
22939
|
-
function builtinSkillBlock(name, description) {
|
|
22940
|
-
return `<skill>
|
|
22941
|
-
<name>${name}</name>
|
|
22942
|
-
<description>${description}</description>
|
|
22943
|
-
<location>builtin</location>
|
|
22944
|
-
</skill>`;
|
|
22945
|
-
}
|
|
22946
|
-
function getBuiltinSkillEntries() {
|
|
22947
|
-
return CUSTOM_SKILLS.map((skill) => ({
|
|
22948
|
-
name: skill.name,
|
|
22949
|
-
block: builtinSkillBlock(skill.name, skill.description)
|
|
22950
|
-
}));
|
|
22951
|
-
}
|
|
22952
22800
|
function getCurrentAgent(messages) {
|
|
22953
22801
|
for (let index = messages.length - 1;index >= 0; index -= 1) {
|
|
22954
22802
|
const message = messages[index];
|
|
@@ -22981,20 +22829,9 @@ function isSkillAllowed(skillName, permissionRules) {
|
|
|
22981
22829
|
}
|
|
22982
22830
|
return permissionRules["*"] === "allow";
|
|
22983
22831
|
}
|
|
22984
|
-
function mergeWithBuiltinSkills(installedEntries) {
|
|
22985
|
-
const builtinEntries = getBuiltinSkillEntries();
|
|
22986
|
-
const installedNames = new Set(installedEntries.map((e) => e.name));
|
|
22987
|
-
for (const entry of builtinEntries) {
|
|
22988
|
-
if (!installedNames.has(entry.name)) {
|
|
22989
|
-
installedEntries.push(entry);
|
|
22990
|
-
}
|
|
22991
|
-
}
|
|
22992
|
-
return installedEntries;
|
|
22993
|
-
}
|
|
22994
22832
|
function filterAvailableSkillsText(text, permissionRules) {
|
|
22995
22833
|
return text.replace(AVAILABLE_SKILLS_BLOCK_REGEX, (_fullMatch, blockContent) => {
|
|
22996
|
-
|
|
22997
|
-
allEntries = mergeWithBuiltinSkills(allEntries);
|
|
22834
|
+
const allEntries = extractSkillEntries(blockContent);
|
|
22998
22835
|
const allowedEntries = allEntries.filter((entry) => isSkillAllowed(entry.name, permissionRules));
|
|
22999
22836
|
if (allowedEntries.length === 0) {
|
|
23000
22837
|
return `<available_skills>
|
|
@@ -23007,22 +22844,6 @@ ${allowedEntries.map((entry) => entry.block).join(`
|
|
|
23007
22844
|
</available_skills>`;
|
|
23008
22845
|
});
|
|
23009
22846
|
}
|
|
23010
|
-
function injectBuiltinSkillsIfMissing(text, permissionRules) {
|
|
23011
|
-
if (text.includes("<available_skills>")) {
|
|
23012
|
-
return text;
|
|
23013
|
-
}
|
|
23014
|
-
const builtinEntries = getBuiltinSkillEntries();
|
|
23015
|
-
const allowedEntries = builtinEntries.filter((entry) => isSkillAllowed(entry.name, permissionRules));
|
|
23016
|
-
if (allowedEntries.length === 0) {
|
|
23017
|
-
return text;
|
|
23018
|
-
}
|
|
23019
|
-
const block = `<available_skills>
|
|
23020
|
-
${allowedEntries.map((entry) => entry.block).join(`
|
|
23021
|
-
`)}
|
|
23022
|
-
</available_skills>`;
|
|
23023
|
-
return `${text}
|
|
23024
|
-
${block}`;
|
|
23025
|
-
}
|
|
23026
22847
|
function createFilterAvailableSkillsHook(_ctx, config) {
|
|
23027
22848
|
const permissionRulesByAgent = new Map;
|
|
23028
22849
|
const getPermissionRules = (agentName) => {
|
|
@@ -23050,8 +22871,6 @@ function createFilterAvailableSkillsHook(_ctx, config) {
|
|
|
23050
22871
|
}
|
|
23051
22872
|
if (part.text.includes("<available_skills>")) {
|
|
23052
22873
|
part.text = filterAvailableSkillsText(part.text, permissionRules);
|
|
23053
|
-
} else {
|
|
23054
|
-
part.text = injectBuiltinSkillsIfMissing(part.text, permissionRules);
|
|
23055
22874
|
}
|
|
23056
22875
|
}
|
|
23057
22876
|
}
|
|
@@ -30243,15 +30062,14 @@ Usage: /preset <name> to switch.`);
|
|
|
30243
30062
|
};
|
|
30244
30063
|
}
|
|
30245
30064
|
// src/tools/skill.ts
|
|
30246
|
-
import { existsSync as
|
|
30247
|
-
import { join as
|
|
30065
|
+
import { existsSync as existsSync10, readFileSync as readFileSync5 } from "node:fs";
|
|
30066
|
+
import { join as join13 } from "node:path";
|
|
30248
30067
|
import { tool as tool4 } from "@opencode-ai/plugin/tool";
|
|
30249
|
-
init_package_root();
|
|
30250
30068
|
var z5 = tool4.schema;
|
|
30251
30069
|
function resolveSkillPath(skillName) {
|
|
30252
|
-
const packageRoot =
|
|
30253
|
-
const bundledPath =
|
|
30254
|
-
if (
|
|
30070
|
+
const packageRoot = join13(import.meta.dirname, "..", "..");
|
|
30071
|
+
const bundledPath = join13(packageRoot, "src", "skills", skillName, "SKILL.md");
|
|
30072
|
+
if (existsSync10(bundledPath)) {
|
|
30255
30073
|
return bundledPath;
|
|
30256
30074
|
}
|
|
30257
30075
|
return;
|
|
@@ -31907,10 +31725,9 @@ function isInvalidLlmsResult(fetchResult) {
|
|
|
31907
31725
|
}
|
|
31908
31726
|
|
|
31909
31727
|
// src/tools/smartfetch/secondary-model.ts
|
|
31910
|
-
import { existsSync as
|
|
31728
|
+
import { existsSync as existsSync11 } from "node:fs";
|
|
31911
31729
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
31912
31730
|
import path17 from "node:path";
|
|
31913
|
-
init_paths();
|
|
31914
31731
|
function parseModelRef(value) {
|
|
31915
31732
|
if (!value)
|
|
31916
31733
|
return;
|
|
@@ -31937,7 +31754,7 @@ function pickAgentModelRef(value) {
|
|
|
31937
31754
|
function findPreferredOpenCodeConfigPath(baseDir) {
|
|
31938
31755
|
for (const file of ["opencode.jsonc", "opencode.json"]) {
|
|
31939
31756
|
const fullPath = path17.join(baseDir, file);
|
|
31940
|
-
if (
|
|
31757
|
+
if (existsSync11(fullPath))
|
|
31941
31758
|
return fullPath;
|
|
31942
31759
|
}
|
|
31943
31760
|
return;
|
|
@@ -32779,15 +32596,6 @@ var OhMyOpenCodeLite = async (ctx) => {
|
|
|
32779
32596
|
mcps = createBuiltinMcps(config.disabled_mcps, config.websearch);
|
|
32780
32597
|
webfetch = createWebfetchTool(ctx);
|
|
32781
32598
|
skillTools = createSkillTool(config);
|
|
32782
|
-
try {
|
|
32783
|
-
const { syncBuiltinSkills: syncBuiltinSkills2 } = await Promise.resolve().then(() => (init_skill_sync(), exports_skill_sync));
|
|
32784
|
-
const syncResult = syncBuiltinSkills2();
|
|
32785
|
-
if (syncResult.installed > 0 || syncResult.skipped > 0) {
|
|
32786
|
-
log("[plugin] skill sync:", syncResult);
|
|
32787
|
-
}
|
|
32788
|
-
} catch (err) {
|
|
32789
|
-
log("[plugin] skill sync failed (non-fatal):", err);
|
|
32790
|
-
}
|
|
32791
32599
|
multiplexerSessionManager = new MultiplexerSessionManager(ctx, multiplexerConfig);
|
|
32792
32600
|
autoUpdateChecker = createAutoUpdateCheckerHook(ctx, {
|
|
32793
32601
|
autoUpdate: config.autoUpdate ?? true
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ThreadManager } from '~/threads/thread-manager';
|
|
2
|
+
import type { LaceEvent, LaceEventType } from '~/threads/types';
|
|
3
|
+
/**
|
|
4
|
+
* Wait for a specific event type to appear in thread
|
|
5
|
+
*
|
|
6
|
+
* @param threadManager - The thread manager to query
|
|
7
|
+
* @param threadId - Thread to check for events
|
|
8
|
+
* @param eventType - Type of event to wait for
|
|
9
|
+
* @param timeoutMs - Maximum time to wait (default 5000ms)
|
|
10
|
+
* @returns Promise resolving to the first matching event
|
|
11
|
+
*
|
|
12
|
+
* Example:
|
|
13
|
+
* await waitForEvent(threadManager, agentThreadId, 'TOOL_RESULT');
|
|
14
|
+
*/
|
|
15
|
+
export declare function waitForEvent(threadManager: ThreadManager, threadId: string, eventType: LaceEventType, timeoutMs?: number): Promise<LaceEvent>;
|
|
16
|
+
/**
|
|
17
|
+
* Wait for a specific number of events of a given type
|
|
18
|
+
*
|
|
19
|
+
* @param threadManager - The thread manager to query
|
|
20
|
+
* @param threadId - Thread to check for events
|
|
21
|
+
* @param eventType - Type of event to wait for
|
|
22
|
+
* @param count - Number of events to wait for
|
|
23
|
+
* @param timeoutMs - Maximum time to wait (default 5000ms)
|
|
24
|
+
* @returns Promise resolving to all matching events once count is reached
|
|
25
|
+
*
|
|
26
|
+
* Example:
|
|
27
|
+
* // Wait for 2 AGENT_MESSAGE events (initial response + continuation)
|
|
28
|
+
* await waitForEventCount(threadManager, agentThreadId, 'AGENT_MESSAGE', 2);
|
|
29
|
+
*/
|
|
30
|
+
export declare function waitForEventCount(threadManager: ThreadManager, threadId: string, eventType: LaceEventType, count: number, timeoutMs?: number): Promise<LaceEvent[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Wait for an event matching a custom predicate
|
|
33
|
+
* Useful when you need to check event data, not just type
|
|
34
|
+
*
|
|
35
|
+
* @param threadManager - The thread manager to query
|
|
36
|
+
* @param threadId - Thread to check for events
|
|
37
|
+
* @param predicate - Function that returns true when event matches
|
|
38
|
+
* @param description - Human-readable description for error messages
|
|
39
|
+
* @param timeoutMs - Maximum time to wait (default 5000ms)
|
|
40
|
+
* @returns Promise resolving to the first matching event
|
|
41
|
+
*
|
|
42
|
+
* Example:
|
|
43
|
+
* // Wait for TOOL_RESULT with specific ID
|
|
44
|
+
* await waitForEventMatch(
|
|
45
|
+
* threadManager,
|
|
46
|
+
* agentThreadId,
|
|
47
|
+
* (e) => e.type === 'TOOL_RESULT' && e.data.id === 'call_123',
|
|
48
|
+
* 'TOOL_RESULT with id=call_123'
|
|
49
|
+
* );
|
|
50
|
+
*/
|
|
51
|
+
export declare function waitForEventMatch(threadManager: ThreadManager, threadId: string, predicate: (event: LaceEvent) => boolean, description: string, timeoutMs?: number): Promise<LaceEvent>;
|
package/dist/tui.js
CHANGED
|
@@ -30,20 +30,6 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
30
30
|
return to;
|
|
31
31
|
};
|
|
32
32
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
33
|
-
var __returnValue = (v) => v;
|
|
34
|
-
function __exportSetter(name, newValue) {
|
|
35
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
36
|
-
}
|
|
37
|
-
var __export = (target, all) => {
|
|
38
|
-
for (var name in all)
|
|
39
|
-
__defProp(target, name, {
|
|
40
|
-
get: all[name],
|
|
41
|
-
enumerable: true,
|
|
42
|
-
configurable: true,
|
|
43
|
-
set: __exportSetter.bind(all, name)
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
47
33
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
48
34
|
|
|
49
35
|
// src/tui.ts
|