bobs-workshop 0.3.3 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -2
- package/README.md +199 -210
- package/bin/bobs-workshop.js +109 -0
- package/config/agents.json +27 -0
- package/dist/plugins/bobs-workshop.js +34 -0
- package/dist/tools/background-agent/cancel.d.ts +3 -0
- package/dist/tools/background-agent/cancel.d.ts.map +1 -0
- package/dist/tools/background-agent/cancel.js +52 -0
- package/dist/tools/background-agent/concurrency.d.ts +15 -0
- package/dist/tools/background-agent/concurrency.d.ts.map +1 -0
- package/dist/tools/background-agent/concurrency.js +61 -0
- package/dist/tools/background-agent/index.d.ts +8 -0
- package/dist/tools/background-agent/index.d.ts.map +1 -0
- package/dist/tools/background-agent/index.js +7 -0
- package/dist/tools/background-agent/launch.d.ts +6 -0
- package/dist/tools/background-agent/launch.d.ts.map +1 -0
- package/dist/tools/background-agent/launch.js +33 -0
- package/dist/tools/background-agent/list.d.ts +7 -0
- package/dist/tools/background-agent/list.d.ts.map +1 -0
- package/dist/tools/background-agent/list.js +40 -0
- package/dist/tools/background-agent/manager.d.ts +29 -0
- package/dist/tools/background-agent/manager.d.ts.map +1 -0
- package/dist/tools/background-agent/manager.js +388 -0
- package/dist/tools/background-agent/output.d.ts +3 -0
- package/dist/tools/background-agent/output.d.ts.map +1 -0
- package/dist/tools/background-agent/output.js +41 -0
- package/dist/tools/background-agent/types.d.ts +46 -0
- package/dist/tools/background-agent/types.d.ts.map +1 -0
- package/dist/tools/background-agent/types.js +1 -0
- package/dist/tools/index.d.ts +9 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/manual/index.d.ts +3 -0
- package/dist/tools/manual/index.d.ts.map +1 -0
- package/dist/tools/manual/index.js +2 -0
- package/dist/tools/manual/manual-update.d.ts +4 -0
- package/dist/tools/manual/manual-update.d.ts.map +1 -0
- package/dist/tools/manual/manual-update.js +190 -0
- package/dist/tools/manual/verify-manual.d.ts +4 -0
- package/dist/tools/manual/verify-manual.d.ts.map +1 -0
- package/dist/tools/manual/verify-manual.js +51 -0
- package/package.json +34 -66
- package/postinstall.js +193 -0
- package/src/agents/alice.md +466 -0
- package/src/agents/bob-rev.md +493 -0
- package/src/agents/bob-send.md +277 -0
- package/src/agents/bob.md +442 -0
- package/src/agents/trace.md +451 -0
- package/src/plugins/bobs-workshop.ts +45 -0
- package/src/skills/api-patterns/SKILL.md +376 -0
- package/src/skills/architecture/SKILL.md +271 -0
- package/src/skills/bobs-workshop/performance/icon.svg +3 -0
- package/src/skills/brainstorming/SKILL.md +210 -0
- package/src/skills/clean-code/SKILL.md +151 -0
- package/src/skills/code-review-checklist/SKILL.md +220 -0
- package/src/skills/database-design/SKILL.md +271 -0
- package/src/skills/exploration/SKILL.md +257 -0
- package/src/skills/frontend-ui-ux/SKILL.md +78 -0
- package/src/skills/git-master/SKILL.md +1105 -0
- package/src/skills/performance/SKILL.md +144 -0
- package/src/skills/performance/icon.svg +3 -0
- package/src/skills/plan-writing/SKILL.md +225 -0
- package/src/skills/security/SKILL.md +410 -0
- package/src/skills/simplification/SKILL.md +238 -0
- package/src/skills/systematic-debugging/SKILL.md +175 -0
- package/src/skills/testing-patterns/SKILL.md +305 -0
- package/src/skills/verification/SKILL.md +286 -0
- package/src/tools/background-agent/cancel.ts +67 -0
- package/src/tools/background-agent/concurrency.ts +71 -0
- package/src/tools/background-agent/index.ts +7 -0
- package/src/tools/background-agent/launch.ts +39 -0
- package/src/tools/background-agent/list.ts +50 -0
- package/src/tools/background-agent/manager.ts +466 -0
- package/src/tools/background-agent/output.ts +57 -0
- package/src/tools/background-agent/types.ts +55 -0
- package/src/tools/index.ts +8 -0
- package/src/tools/manual/index.ts +2 -0
- package/src/tools/manual/manual-update.ts +197 -0
- package/src/tools/manual/verify-manual.ts +60 -0
- package/uninstall.js +64 -0
- package/Claude.md +0 -162
- package/bin/bobs-mcp-server.js +0 -11
- package/bin/bobs-mcp.js +0 -130
- package/dist/api/taskLogger.js +0 -106
- package/dist/api/taskLogger.js.map +0 -1
- package/dist/cli/checker.js +0 -401
- package/dist/cli/checker.js.map +0 -1
- package/dist/cli/cleanup.js +0 -131
- package/dist/cli/cleanup.js.map +0 -1
- package/dist/cli/debug.js +0 -157
- package/dist/cli/debug.js.map +0 -1
- package/dist/cli/health.js +0 -97
- package/dist/cli/health.js.map +0 -1
- package/dist/cli/setup.js +0 -81
- package/dist/cli/setup.js.map +0 -1
- package/dist/cli/workshop.js +0 -42
- package/dist/cli/workshop.js.map +0 -1
- package/dist/dashboard/server.js +0 -1203
- package/dist/dashboard/server.js.map +0 -1
- package/dist/index.js +0 -960
- package/dist/index.js.map +0 -1
- package/dist/prompts/architect.js +0 -221
- package/dist/prompts/architect.js.map +0 -1
- package/dist/prompts/debugger.js +0 -257
- package/dist/prompts/debugger.js.map +0 -1
- package/dist/prompts/engineer.js +0 -249
- package/dist/prompts/engineer.js.map +0 -1
- package/dist/prompts/orchestrator.js +0 -304
- package/dist/prompts/orchestrator.js.map +0 -1
- package/dist/prompts/reviewer.js +0 -289
- package/dist/prompts/reviewer.js.map +0 -1
- package/dist/services/activitySummarizer.js +0 -388
- package/dist/services/activitySummarizer.js.map +0 -1
- package/dist/services/changeValidator.js +0 -396
- package/dist/services/changeValidator.js.map +0 -1
- package/dist/services/claudeOrchestrator.js +0 -343
- package/dist/services/claudeOrchestrator.js.map +0 -1
- package/dist/services/fileMonitor.js +0 -250
- package/dist/services/fileMonitor.js.map +0 -1
- package/dist/services/implementationSummarizer.js +0 -306
- package/dist/services/implementationSummarizer.js.map +0 -1
- package/dist/services/liveMonitor.js +0 -315
- package/dist/services/liveMonitor.js.map +0 -1
- package/dist/services/mcpAuditLogger.js +0 -104
- package/dist/services/mcpAuditLogger.js.map +0 -1
- package/dist/services/mcpLogger.js +0 -223
- package/dist/services/mcpLogger.js.map +0 -1
- package/dist/services/tmuxManager.js +0 -541
- package/dist/services/tmuxManager.js.map +0 -1
- package/dist/tools/approvalTools.js +0 -244
- package/dist/tools/approvalTools.js.map +0 -1
- package/dist/tools/autoDebugger.js +0 -147
- package/dist/tools/autoDebugger.js.map +0 -1
- package/dist/tools/cleanupService.js +0 -221
- package/dist/tools/cleanupService.js.map +0 -1
- package/dist/tools/dashboardTools.js +0 -342
- package/dist/tools/dashboardTools.js.map +0 -1
- package/dist/tools/developmentNudges.js +0 -336
- package/dist/tools/developmentNudges.js.map +0 -1
- package/dist/tools/gitTools.js +0 -741
- package/dist/tools/gitTools.js.map +0 -1
- package/dist/tools/orchestratorTools.js +0 -832
- package/dist/tools/orchestratorTools.js.map +0 -1
- package/dist/tools/searchCache.js +0 -64
- package/dist/tools/searchCache.js.map +0 -1
- package/dist/tools/searchTools.js +0 -1107
- package/dist/tools/searchTools.js.map +0 -1
- package/dist/tools/semgrep-patterns.js +0 -296
- package/dist/tools/semgrep-patterns.js.map +0 -1
- package/dist/tools/specTools.js +0 -332
- package/dist/tools/specTools.js.map +0 -1
- package/dist/tools/structural/__tests__/orchestrator.test.js +0 -61
- package/dist/tools/structural/__tests__/orchestrator.test.js.map +0 -1
- package/dist/tools/structural/cache.js +0 -226
- package/dist/tools/structural/cache.js.map +0 -1
- package/dist/tools/structural/engines/python/index.js +0 -118
- package/dist/tools/structural/engines/python/index.js.map +0 -1
- package/dist/tools/structural/engines/typescript/__tests__/typescript-engine.test.js +0 -97
- package/dist/tools/structural/engines/typescript/__tests__/typescript-engine.test.js.map +0 -1
- package/dist/tools/structural/engines/typescript/analyzer.js +0 -433
- package/dist/tools/structural/engines/typescript/analyzer.js.map +0 -1
- package/dist/tools/structural/engines/typescript/index.js +0 -381
- package/dist/tools/structural/engines/typescript/index.js.map +0 -1
- package/dist/tools/structural/engines/typescript/utils.js +0 -279
- package/dist/tools/structural/engines/typescript/utils.js.map +0 -1
- package/dist/tools/structural/index.js +0 -248
- package/dist/tools/structural/index.js.map +0 -1
- package/dist/tools/structural/types.js +0 -18
- package/dist/tools/structural/types.js.map +0 -1
- package/dist/tools/tmuxTools.js +0 -100
- package/dist/tools/tmuxTools.js.map +0 -1
- package/dist/tools/workRecorder.js +0 -215
- package/dist/tools/workRecorder.js.map +0 -1
- package/dist/tools/worktreeTools.js +0 -705
- package/dist/tools/worktreeTools.js.map +0 -1
- package/dist/utils/__tests__/integration.test.js +0 -57
- package/dist/utils/__tests__/integration.test.js.map +0 -1
- package/dist/utils/__tests__/serverDetection.test.js +0 -151
- package/dist/utils/__tests__/serverDetection.test.js.map +0 -1
- package/dist/utils/errorHandling.js +0 -336
- package/dist/utils/errorHandling.js.map +0 -1
- package/dist/utils/processManager.js +0 -172
- package/dist/utils/processManager.js.map +0 -1
- package/dist/utils/reliability.js +0 -263
- package/dist/utils/reliability.js.map +0 -1
- package/dist/utils/responseFormatter.js +0 -250
- package/dist/utils/responseFormatter.js.map +0 -1
- package/dist/utils/serverDetection.js +0 -133
- package/dist/utils/serverDetection.js.map +0 -1
- package/dist/utils/specMigration.js +0 -105
- package/dist/utils/specMigration.js.map +0 -1
- package/dist/validation/schemas.js +0 -299
- package/dist/validation/schemas.js.map +0 -1
- package/public/.well-known/mcp/manifest.json +0 -473
- package/public/index.html +0 -3157
- package/public/index.html.backup +0 -2805
- package/public/index.html.backup2 +0 -1292
- package/scripts/cleanup-system-logs.ts +0 -121
- package/scripts/init-workspace.js +0 -63
- package/scripts/install-search-tools.js +0 -116
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"alice": {
|
|
3
|
+
"description": "Architect agent - planning and manual authoring",
|
|
4
|
+
"model": "zai-coding-plan/glm-4.7",
|
|
5
|
+
"temperature": 0.2
|
|
6
|
+
},
|
|
7
|
+
"bob": {
|
|
8
|
+
"description": "Unified orchestration & implementation - executes tasks and routes workflow",
|
|
9
|
+
"model": "minimax/MiniMax-M2.1",
|
|
10
|
+
"temperature": 0.1
|
|
11
|
+
},
|
|
12
|
+
"bob-rev": {
|
|
13
|
+
"description": "Reviewer - PASS/FAIL verification",
|
|
14
|
+
"model": "minimax/MiniMax-M2.1",
|
|
15
|
+
"temperature": 0
|
|
16
|
+
},
|
|
17
|
+
"trace": {
|
|
18
|
+
"description": "Debug agent - root cause analysis and fixes",
|
|
19
|
+
"model": "zai-coding-plan/glm-4.7",
|
|
20
|
+
"temperature": 0.15
|
|
21
|
+
},
|
|
22
|
+
"bob-send": {
|
|
23
|
+
"description": "Shipper - build, lint, test, final verify (fast)",
|
|
24
|
+
"model": "minimax/MiniMax-M2.1",
|
|
25
|
+
"temperature": 0
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { background_agent, manual_update, verify_manual, list_background_tasks, background_output, background_cancel, } from "../tools/index.js";
|
|
2
|
+
import { BackgroundManager } from "../tools/background-agent/manager.js";
|
|
3
|
+
export const BobWorkshopPlugin = async (ctx) => {
|
|
4
|
+
const manager = BackgroundManager.getInstance(ctx);
|
|
5
|
+
return {
|
|
6
|
+
tool: {
|
|
7
|
+
background_agent,
|
|
8
|
+
manual_update,
|
|
9
|
+
verify_manual,
|
|
10
|
+
list_background_tasks,
|
|
11
|
+
background_output,
|
|
12
|
+
background_cancel,
|
|
13
|
+
},
|
|
14
|
+
"session.idle": async (input) => {
|
|
15
|
+
const event = input;
|
|
16
|
+
if (event.properties?.sessionID) {
|
|
17
|
+
manager.handleEvent({
|
|
18
|
+
type: "session.idle",
|
|
19
|
+
properties: event.properties,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"session.deleted": async (input) => {
|
|
24
|
+
const event = input;
|
|
25
|
+
if (event.properties?.info?.id) {
|
|
26
|
+
manager.handleEvent({
|
|
27
|
+
type: "session.deleted",
|
|
28
|
+
properties: event.properties,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export default BobWorkshopPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancel.d.ts","sourceRoot":"","sources":["../../../src/tools/background-agent/cancel.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,oBAAoB,EAAE,GA4D1B,CAAC;AAEH,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { tool } from "@opencode-ai/plugin";
|
|
2
|
+
import { BackgroundManager } from "./manager.js";
|
|
3
|
+
const BackgroundCancelTool = tool({
|
|
4
|
+
description: "Cancel running background agent sessions (cleanup)",
|
|
5
|
+
args: {
|
|
6
|
+
task_id: tool.schema.string().optional()
|
|
7
|
+
.describe("Specific task ID to cancel (omit to cancel all)"),
|
|
8
|
+
all: tool.schema.boolean().optional()
|
|
9
|
+
.describe("Cancel all running tasks"),
|
|
10
|
+
},
|
|
11
|
+
async execute(args, context) {
|
|
12
|
+
const ctx = context;
|
|
13
|
+
const manager = BackgroundManager.getInstance(ctx);
|
|
14
|
+
if (!args.task_id && !args.all) {
|
|
15
|
+
return "❌ Must specify task_id OR all=true";
|
|
16
|
+
}
|
|
17
|
+
if (args.all) {
|
|
18
|
+
const runningTasks = manager.getRunningTasks();
|
|
19
|
+
if (runningTasks.length === 0) {
|
|
20
|
+
return "📭 No running tasks to cancel";
|
|
21
|
+
}
|
|
22
|
+
let cancelledCount = 0;
|
|
23
|
+
for (const task of runningTasks) {
|
|
24
|
+
if (task.sessionID) {
|
|
25
|
+
await ctx.client.session.delete({
|
|
26
|
+
path: { id: task.sessionID },
|
|
27
|
+
});
|
|
28
|
+
cancelledCount++;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return `🗑️ Cancelled ${cancelledCount} running tasks`;
|
|
32
|
+
}
|
|
33
|
+
if (args.task_id) {
|
|
34
|
+
const task = manager.getTask(args.task_id);
|
|
35
|
+
if (!task) {
|
|
36
|
+
return `❌ Task ${args.task_id} not found`;
|
|
37
|
+
}
|
|
38
|
+
if (task.status !== "running") {
|
|
39
|
+
return `⚠️ Task ${args.task_id} is ${task.status}, cannot cancel`;
|
|
40
|
+
}
|
|
41
|
+
if (!task.sessionID) {
|
|
42
|
+
return `❌ Task ${args.task_id} has no session`;
|
|
43
|
+
}
|
|
44
|
+
await ctx.client.session.delete({
|
|
45
|
+
path: { id: task.sessionID },
|
|
46
|
+
});
|
|
47
|
+
return `🗑️ Cancelled task ${args.task_id}`;
|
|
48
|
+
}
|
|
49
|
+
return "";
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
export default BackgroundCancelTool;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple concurrency manager for background agents.
|
|
3
|
+
* Limits concurrent tasks per model/agent.
|
|
4
|
+
*/
|
|
5
|
+
export declare class ConcurrencyManager {
|
|
6
|
+
private counts;
|
|
7
|
+
private queues;
|
|
8
|
+
private readonly defaultLimit;
|
|
9
|
+
getConcurrencyLimit(key: string): number;
|
|
10
|
+
acquire(key: string): Promise<void>;
|
|
11
|
+
release(key: string): void;
|
|
12
|
+
clear(): void;
|
|
13
|
+
private cancelWaiters;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=concurrency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concurrency.d.ts","sourceRoot":"","sources":["../../../src/tools/background-agent/concurrency.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,MAAM,CAA6C;IAC3D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAK;IAElC,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAIlC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBzC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAwB1B,KAAK,IAAI,IAAI;IAQb,OAAO,CAAC,aAAa;CAMtB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple concurrency manager for background agents.
|
|
3
|
+
* Limits concurrent tasks per model/agent.
|
|
4
|
+
*/
|
|
5
|
+
export class ConcurrencyManager {
|
|
6
|
+
counts = new Map();
|
|
7
|
+
queues = new Map();
|
|
8
|
+
defaultLimit = 5;
|
|
9
|
+
getConcurrencyLimit(key) {
|
|
10
|
+
return this.defaultLimit;
|
|
11
|
+
}
|
|
12
|
+
async acquire(key) {
|
|
13
|
+
const limit = this.getConcurrencyLimit(key);
|
|
14
|
+
if (limit === Infinity) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const current = this.counts.get(key) ?? 0;
|
|
18
|
+
if (current < limit) {
|
|
19
|
+
this.counts.set(key, current + 1);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
return new Promise((resolve) => {
|
|
23
|
+
const queue = this.queues.get(key) ?? [];
|
|
24
|
+
queue.push(resolve);
|
|
25
|
+
this.queues.set(key, queue);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
release(key) {
|
|
29
|
+
const limit = this.getConcurrencyLimit(key);
|
|
30
|
+
if (limit === Infinity) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const queue = this.queues.get(key);
|
|
34
|
+
// Try to hand off to a waiting entry
|
|
35
|
+
while (queue && queue.length > 0) {
|
|
36
|
+
const next = queue.shift();
|
|
37
|
+
if (next) {
|
|
38
|
+
next();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// No handoff occurred - decrement count to free slot
|
|
43
|
+
const current = this.counts.get(key) ?? 0;
|
|
44
|
+
if (current > 0) {
|
|
45
|
+
this.counts.set(key, current - 1);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
clear() {
|
|
49
|
+
for (const [key] of this.queues) {
|
|
50
|
+
this.cancelWaiters(key);
|
|
51
|
+
}
|
|
52
|
+
this.counts.clear();
|
|
53
|
+
this.queues.clear();
|
|
54
|
+
}
|
|
55
|
+
cancelWaiters(key) {
|
|
56
|
+
const queue = this.queues.get(key);
|
|
57
|
+
if (queue) {
|
|
58
|
+
this.queues.delete(key);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./types";
|
|
2
|
+
export { BackgroundManager } from "./manager";
|
|
3
|
+
export { ConcurrencyManager } from "./concurrency";
|
|
4
|
+
export { default as background_agent } from "./launch.js";
|
|
5
|
+
export { default as list_background_tasks } from "./list.js";
|
|
6
|
+
export { default as background_output } from "./output.js";
|
|
7
|
+
export { default as background_cancel } from "./cancel.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/background-agent/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./types";
|
|
2
|
+
export { BackgroundManager } from "./manager";
|
|
3
|
+
export { ConcurrencyManager } from "./concurrency";
|
|
4
|
+
export { default as background_agent } from "./launch.js";
|
|
5
|
+
export { default as list_background_tasks } from "./list.js";
|
|
6
|
+
export { default as background_output } from "./output.js";
|
|
7
|
+
export { default as background_cancel } from "./cancel.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ToolDefinition } from "@opencode-ai/plugin/tool";
|
|
2
|
+
import { BackgroundManager } from "./manager.js";
|
|
3
|
+
declare const BackgroundAgentTool: ToolDefinition;
|
|
4
|
+
export default BackgroundAgentTool;
|
|
5
|
+
export { BackgroundManager };
|
|
6
|
+
//# sourceMappingURL=launch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../../../src/tools/background-agent/launch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,QAAA,MAAM,mBAAmB,EAAE,cA8BzB,CAAC;AAEH,eAAe,mBAAmB,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { tool } from "@opencode-ai/plugin/tool";
|
|
2
|
+
import { BackgroundManager } from "./manager.js";
|
|
3
|
+
const BackgroundAgentTool = tool({
|
|
4
|
+
description: "Launch a background agent for LSP code exploration or verification",
|
|
5
|
+
args: {
|
|
6
|
+
agent: tool.schema.enum(["alice", "bob", "bob-eng", "bob-rev", "trace", "bob-send"])
|
|
7
|
+
.describe("Agent name to launch in background"),
|
|
8
|
+
prompt: tool.schema.string().describe("Prompt for the background agent"),
|
|
9
|
+
skills: tool.schema.array(tool.schema.string()).optional()
|
|
10
|
+
.describe("Skills to load from .opencode/skill/"),
|
|
11
|
+
model: tool.schema.string().optional()
|
|
12
|
+
.describe("Override model (defaults to agent's configured model)"),
|
|
13
|
+
manual_path: tool.schema.string().optional()
|
|
14
|
+
.describe("Path to MANUAL file (for bob/bob-rev agents)"),
|
|
15
|
+
},
|
|
16
|
+
async execute(args, context) {
|
|
17
|
+
const ctx = context;
|
|
18
|
+
const manager = BackgroundManager.getInstance(ctx);
|
|
19
|
+
const input = {
|
|
20
|
+
description: `${args.agent} - ${args.prompt.slice(0, 50)}`,
|
|
21
|
+
prompt: args.prompt,
|
|
22
|
+
agent: args.agent,
|
|
23
|
+
parentSessionID: ctx.sessionID,
|
|
24
|
+
model: args.model,
|
|
25
|
+
skills: args.skills,
|
|
26
|
+
manual_path: args.manual_path,
|
|
27
|
+
};
|
|
28
|
+
const task = await manager.launch(input);
|
|
29
|
+
return `✅ Started background ${args.agent} session: ${task.id}`;
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
export default BackgroundAgentTool;
|
|
33
|
+
export { BackgroundManager };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const ListBackgroundTasksTool: {
|
|
2
|
+
description: string;
|
|
3
|
+
args: {};
|
|
4
|
+
execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
5
|
+
};
|
|
6
|
+
export default ListBackgroundTasksTool;
|
|
7
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/tools/background-agent/list.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,uBAAuB;;;;CA2C3B,CAAC;AAEH,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { tool } from "@opencode-ai/plugin";
|
|
2
|
+
import { BackgroundManager } from "./index.js";
|
|
3
|
+
const ListBackgroundTasksTool = tool({
|
|
4
|
+
description: "List all running background agent sessions",
|
|
5
|
+
args: {},
|
|
6
|
+
async execute(args, context) {
|
|
7
|
+
const ctx = context;
|
|
8
|
+
const manager = BackgroundManager.getInstance(ctx);
|
|
9
|
+
const tasks = manager.getAllTasks();
|
|
10
|
+
if (tasks.length === 0) {
|
|
11
|
+
return "📭 No background sessions running";
|
|
12
|
+
}
|
|
13
|
+
const output = tasks.map((t) => {
|
|
14
|
+
const statusEmoji = {
|
|
15
|
+
pending: "⏳",
|
|
16
|
+
running: "🔄",
|
|
17
|
+
completed: "✅",
|
|
18
|
+
error: "❌",
|
|
19
|
+
cancelled: "🚫",
|
|
20
|
+
};
|
|
21
|
+
const emoji = statusEmoji[t.status] || "❓";
|
|
22
|
+
const duration = t.startedAt && t.completedAt
|
|
23
|
+
? `${Math.round((t.completedAt.getTime() - t.startedAt.getTime()) / 1000)}s`
|
|
24
|
+
: t.startedAt
|
|
25
|
+
? `${Math.round((Date.now() - t.startedAt.getTime()) / 1000)}s (running)`
|
|
26
|
+
: "-";
|
|
27
|
+
const skillInfo = t.skills && t.skills.length > 0
|
|
28
|
+
? ` [skills: ${t.skills.join(", ")}]`
|
|
29
|
+
: "";
|
|
30
|
+
return `${emoji} \`${t.id}\` - ${t.description} [${t.status}] ${duration}${skillInfo}`;
|
|
31
|
+
}).join('\n');
|
|
32
|
+
const runningCount = tasks.filter(t => t.status === "running").length;
|
|
33
|
+
const completedCount = tasks.filter(t => t.status === "completed").length;
|
|
34
|
+
const errorCount = tasks.filter(t => t.status === "error").length;
|
|
35
|
+
return `🗂️ Background Sessions (${tasks.length} total):\n` +
|
|
36
|
+
` 🔄 Running: ${runningCount} | ✅ Completed: ${completedCount} | ❌ Error: ${errorCount}\n\n` +
|
|
37
|
+
`${output}`;
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
export default ListBackgroundTasksTool;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
import type { BackgroundTask, LaunchInput } from "./types";
|
|
3
|
+
export declare class BackgroundManager {
|
|
4
|
+
private tasks;
|
|
5
|
+
private client;
|
|
6
|
+
private directory;
|
|
7
|
+
private pollingInterval?;
|
|
8
|
+
private concurrencyManager;
|
|
9
|
+
private shutdownTriggered;
|
|
10
|
+
private static instance;
|
|
11
|
+
static getInstance(ctx: PluginInput): BackgroundManager;
|
|
12
|
+
private constructor();
|
|
13
|
+
launch(input: LaunchInput): Promise<BackgroundTask>;
|
|
14
|
+
private startTask;
|
|
15
|
+
getTask(id: string): BackgroundTask | undefined;
|
|
16
|
+
getAllTasks(): BackgroundTask[];
|
|
17
|
+
getRunningTasks(): BackgroundTask[];
|
|
18
|
+
handleEvent(event: {
|
|
19
|
+
type: string;
|
|
20
|
+
properties?: Record<string, unknown>;
|
|
21
|
+
}): void;
|
|
22
|
+
private tryCompleteTask;
|
|
23
|
+
private validateSessionHasOutput;
|
|
24
|
+
private startPolling;
|
|
25
|
+
private stopPolling;
|
|
26
|
+
private pollRunningTasks;
|
|
27
|
+
shutdown(): void;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/tools/background-agent/manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EAGZ,MAAM,SAAS,CAAC;AAQjB,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,eAAe,CAAC,CAAiC;IACzD,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkC;IAEzD,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,iBAAiB;IAOvD,OAAO;IAOD,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;YAoC3C,SAAS;IAyGvB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAI/C,WAAW,IAAI,cAAc,EAAE;IAI/B,eAAe,IAAI,cAAc,EAAE;IAInC,WAAW,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,IAAI;YAuClE,eAAe;YAmCf,wBAAwB;IAoCtC,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,WAAW;YAOL,gBAAgB;IAkI9B,QAAQ,IAAI,IAAI;CAmBjB"}
|