@hung319/opencode-hive 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +9 -190
- package/package.json +1 -1
- package/dist/utils/dep-installer.d.ts +0 -80
package/dist/index.js
CHANGED
|
@@ -854,8 +854,8 @@ var init_context_compression = __esm(() => {
|
|
|
854
854
|
});
|
|
855
855
|
|
|
856
856
|
// src/index.ts
|
|
857
|
-
import * as
|
|
858
|
-
import * as
|
|
857
|
+
import * as path11 from "path";
|
|
858
|
+
import * as os4 from "os";
|
|
859
859
|
|
|
860
860
|
// ../../node_modules/.bun/zod@4.1.8/node_modules/zod/v4/classic/external.js
|
|
861
861
|
var exports_external = {};
|
|
@@ -21607,8 +21607,7 @@ var DEFAULT_HIVE_CONFIG = {
|
|
|
21607
21607
|
enabled: false,
|
|
21608
21608
|
indexPath: path7.join(os3.homedir(), ".config", "opencode", "hive", "vector-index"),
|
|
21609
21609
|
dimensions: 384
|
|
21610
|
-
}
|
|
21611
|
-
autoInstallDeps: true
|
|
21610
|
+
}
|
|
21612
21611
|
};
|
|
21613
21612
|
var HIVE_DIR = ".hive";
|
|
21614
21613
|
var FEATURES_DIR = "features";
|
|
@@ -28218,183 +28217,6 @@ function buildCompactionPrompt() {
|
|
|
28218
28217
|
return COMPACTION_RESUME_PROMPT;
|
|
28219
28218
|
}
|
|
28220
28219
|
|
|
28221
|
-
// src/utils/dep-installer.ts
|
|
28222
|
-
import { execSync as execSync5 } from "child_process";
|
|
28223
|
-
import * as path11 from "path";
|
|
28224
|
-
import * as os4 from "os";
|
|
28225
|
-
var PLUGIN_TOOLS = [
|
|
28226
|
-
{
|
|
28227
|
-
name: "btca",
|
|
28228
|
-
npmPackage: "btca-cli",
|
|
28229
|
-
installCommand: ["npm", "install", "-g", "btca-cli"],
|
|
28230
|
-
verifyCommand: "btca --version",
|
|
28231
|
-
description: "Bluetooth Classic Audio control",
|
|
28232
|
-
required: false
|
|
28233
|
-
},
|
|
28234
|
-
{
|
|
28235
|
-
name: "dora",
|
|
28236
|
-
npmPackage: "@butttons/dora",
|
|
28237
|
-
installCommand: ["npm", "install", "-g", "@butttons/dora"],
|
|
28238
|
-
verifyCommand: "dora --version",
|
|
28239
|
-
description: "SCIP-based code navigation",
|
|
28240
|
-
required: false
|
|
28241
|
-
},
|
|
28242
|
-
{
|
|
28243
|
-
name: "auto-cr",
|
|
28244
|
-
npmPackage: "auto-cr-cmd",
|
|
28245
|
-
installCommand: ["npm", "install", "-g", "auto-cr-cmd"],
|
|
28246
|
-
verifyCommand: "auto-cr-cmd --version",
|
|
28247
|
-
description: "SWC-based automated code review",
|
|
28248
|
-
required: false
|
|
28249
|
-
},
|
|
28250
|
-
{
|
|
28251
|
-
name: "scip-typescript",
|
|
28252
|
-
npmPackage: "@sourcegraph/scip-typescript",
|
|
28253
|
-
installCommand: ["npm", "install", "-g", "@sourcegraph/scip-typescript"],
|
|
28254
|
-
verifyCommand: "scip-typescript --version",
|
|
28255
|
-
description: "TypeScript SCIP indexer (for dora)",
|
|
28256
|
-
required: false
|
|
28257
|
-
},
|
|
28258
|
-
{
|
|
28259
|
-
name: "typescript-language-server",
|
|
28260
|
-
npmPackage: "typescript-language-server",
|
|
28261
|
-
installCommand: ["npm", "install", "-g", "typescript-language-server", "typescript"],
|
|
28262
|
-
verifyCommand: "typescript-language-server --version",
|
|
28263
|
-
description: "TypeScript/JavaScript LSP server",
|
|
28264
|
-
required: false
|
|
28265
|
-
},
|
|
28266
|
-
{
|
|
28267
|
-
name: "pyright",
|
|
28268
|
-
npmPackage: "pyright",
|
|
28269
|
-
installCommand: ["pip", "install", "pyright"],
|
|
28270
|
-
verifyCommand: "pyright --version",
|
|
28271
|
-
description: "Python LSP server",
|
|
28272
|
-
required: false
|
|
28273
|
-
}
|
|
28274
|
-
];
|
|
28275
|
-
|
|
28276
|
-
class DependencyInstaller {
|
|
28277
|
-
installDir;
|
|
28278
|
-
cache = new Map;
|
|
28279
|
-
cacheTimeout = 60000;
|
|
28280
|
-
constructor(installDir) {
|
|
28281
|
-
this.installDir = installDir || path11.join(os4.homedir(), ".local");
|
|
28282
|
-
}
|
|
28283
|
-
getBinDir() {
|
|
28284
|
-
return path11.join(this.installDir, "bin");
|
|
28285
|
-
}
|
|
28286
|
-
commandExists(cmd) {
|
|
28287
|
-
try {
|
|
28288
|
-
execSync5(`which ${cmd}`, { stdio: "ignore" });
|
|
28289
|
-
return true;
|
|
28290
|
-
} catch {
|
|
28291
|
-
return false;
|
|
28292
|
-
}
|
|
28293
|
-
}
|
|
28294
|
-
verifyTool(config2) {
|
|
28295
|
-
try {
|
|
28296
|
-
execSync5(config2.verifyCommand, { stdio: "ignore", timeout: 5000 });
|
|
28297
|
-
return true;
|
|
28298
|
-
} catch {
|
|
28299
|
-
return false;
|
|
28300
|
-
}
|
|
28301
|
-
}
|
|
28302
|
-
async install(config2) {
|
|
28303
|
-
console.log(`[dep-installer] Installing ${config2.name}...`);
|
|
28304
|
-
try {
|
|
28305
|
-
const [cmd, ...args2] = config2.installCommand;
|
|
28306
|
-
const fullCmd = `${cmd} ${args2.join(" ")}`;
|
|
28307
|
-
execSync5(fullCmd, {
|
|
28308
|
-
stdio: "inherit",
|
|
28309
|
-
timeout: 120000,
|
|
28310
|
-
env: {
|
|
28311
|
-
...process.env,
|
|
28312
|
-
...cmd === "npm" ? { npm_config_prefix: this.installDir } : {}
|
|
28313
|
-
}
|
|
28314
|
-
});
|
|
28315
|
-
const verified = this.verifyTool(config2);
|
|
28316
|
-
if (verified) {
|
|
28317
|
-
console.log(`[dep-installer] ✓ ${config2.name} installed successfully`);
|
|
28318
|
-
this.cache.set(config2.name, { installed: true, checked: Date.now() });
|
|
28319
|
-
return { success: true, output: `${config2.name} installed and verified` };
|
|
28320
|
-
} else {
|
|
28321
|
-
return { success: false, error: "Installation completed but verification failed" };
|
|
28322
|
-
}
|
|
28323
|
-
} catch (error45) {
|
|
28324
|
-
console.warn(`[dep-installer] ✗ ${config2.name} installation failed: ${error45.message}`);
|
|
28325
|
-
return { success: false, error: error45.message };
|
|
28326
|
-
}
|
|
28327
|
-
}
|
|
28328
|
-
isInstalled(toolName) {
|
|
28329
|
-
const cached2 = this.cache.get(toolName);
|
|
28330
|
-
if (cached2 && Date.now() - cached2.checked < this.cacheTimeout) {
|
|
28331
|
-
return cached2.installed;
|
|
28332
|
-
}
|
|
28333
|
-
const config2 = PLUGIN_TOOLS.find((t) => t.name === toolName);
|
|
28334
|
-
if (!config2)
|
|
28335
|
-
return false;
|
|
28336
|
-
const installed = this.verifyTool(config2);
|
|
28337
|
-
this.cache.set(toolName, { installed, checked: Date.now() });
|
|
28338
|
-
return installed;
|
|
28339
|
-
}
|
|
28340
|
-
getStatus() {
|
|
28341
|
-
return PLUGIN_TOOLS.map((config2) => ({
|
|
28342
|
-
name: config2.name,
|
|
28343
|
-
installed: this.isInstalled(config2.name),
|
|
28344
|
-
description: config2.description,
|
|
28345
|
-
required: config2.required
|
|
28346
|
-
}));
|
|
28347
|
-
}
|
|
28348
|
-
async ensureRequired() {
|
|
28349
|
-
const installed = [];
|
|
28350
|
-
const missing = [];
|
|
28351
|
-
const errors3 = {};
|
|
28352
|
-
for (const config2 of PLUGIN_TOOLS) {
|
|
28353
|
-
if (config2.required && !this.isInstalled(config2.name)) {
|
|
28354
|
-
const result = await this.install(config2);
|
|
28355
|
-
if (result.success) {
|
|
28356
|
-
installed.push(config2.name);
|
|
28357
|
-
} else {
|
|
28358
|
-
missing.push(config2.name);
|
|
28359
|
-
errors3[config2.name] = result.error || "Installation failed";
|
|
28360
|
-
}
|
|
28361
|
-
}
|
|
28362
|
-
}
|
|
28363
|
-
return { installed, missing, errors: errors3 };
|
|
28364
|
-
}
|
|
28365
|
-
async installAll() {
|
|
28366
|
-
const success2 = [];
|
|
28367
|
-
const failed = {};
|
|
28368
|
-
for (const config2 of PLUGIN_TOOLS) {
|
|
28369
|
-
if (!this.isInstalled(config2.name)) {
|
|
28370
|
-
const result = await this.install(config2);
|
|
28371
|
-
if (result.success) {
|
|
28372
|
-
success2.push(config2.name);
|
|
28373
|
-
} else {
|
|
28374
|
-
failed[config2.name] = result.error || "Installation failed";
|
|
28375
|
-
}
|
|
28376
|
-
} else {
|
|
28377
|
-
success2.push(config2.name);
|
|
28378
|
-
}
|
|
28379
|
-
}
|
|
28380
|
-
return { success: success2, failed };
|
|
28381
|
-
}
|
|
28382
|
-
async installTool(toolName) {
|
|
28383
|
-
const config2 = PLUGIN_TOOLS.find((t) => t.name === toolName);
|
|
28384
|
-
if (!config2) {
|
|
28385
|
-
return { success: false, error: `Unknown tool: ${toolName}. Available: ${PLUGIN_TOOLS.map((t) => t.name).join(", ")}` };
|
|
28386
|
-
}
|
|
28387
|
-
if (this.isInstalled(toolName)) {
|
|
28388
|
-
return { success: true, output: `${toolName} is already installed` };
|
|
28389
|
-
}
|
|
28390
|
-
return this.install(config2);
|
|
28391
|
-
}
|
|
28392
|
-
}
|
|
28393
|
-
var dependencyInstaller = new DependencyInstaller;
|
|
28394
|
-
async function ensurePluginDeps() {
|
|
28395
|
-
dependencyInstaller.ensureRequired().catch(console.error);
|
|
28396
|
-
}
|
|
28397
|
-
|
|
28398
28220
|
// src/index.ts
|
|
28399
28221
|
function formatSkillsXml(skills) {
|
|
28400
28222
|
if (skills.length === 0)
|
|
@@ -28420,7 +28242,7 @@ async function buildAutoLoadedSkillsContent(agentName, configService, projectRoo
|
|
|
28420
28242
|
if (autoLoadSkills.length === 0) {
|
|
28421
28243
|
return "";
|
|
28422
28244
|
}
|
|
28423
|
-
const homeDir = process.env.HOME ||
|
|
28245
|
+
const homeDir = process.env.HOME || os4.homedir();
|
|
28424
28246
|
const skillTemplates = [];
|
|
28425
28247
|
for (const skillId of autoLoadSkills) {
|
|
28426
28248
|
const builtinSkill = BUILTIN_SKILLS.find((entry) => entry.name === skillId);
|
|
@@ -28502,14 +28324,11 @@ var plugin = async (ctx) => {
|
|
|
28502
28324
|
const disabledMcps = configService.getDisabledMcps();
|
|
28503
28325
|
const disabledSkills = configService.getDisabledSkills();
|
|
28504
28326
|
const builtinMcps = createBuiltinMcps(disabledMcps);
|
|
28505
|
-
if (configService.get().autoInstallDeps !== false) {
|
|
28506
|
-
ensurePluginDeps();
|
|
28507
|
-
}
|
|
28508
28327
|
const filteredSkills = getFilteredSkills(disabledSkills);
|
|
28509
28328
|
const effectiveAutoLoadSkills = configService.getAgentConfig("zetta").autoLoadSkills ?? [];
|
|
28510
28329
|
const worktreeService = new WorktreeService({
|
|
28511
28330
|
baseDir: directory,
|
|
28512
|
-
hiveDir:
|
|
28331
|
+
hiveDir: path11.join(directory, ".hive")
|
|
28513
28332
|
});
|
|
28514
28333
|
const isOmoSlimEnabled = () => {
|
|
28515
28334
|
return configService.isOmoSlimEnabled();
|
|
@@ -28536,7 +28355,7 @@ var plugin = async (ctx) => {
|
|
|
28536
28355
|
};
|
|
28537
28356
|
const checkBlocked = (feature) => {
|
|
28538
28357
|
const fs12 = __require("fs");
|
|
28539
|
-
const blockedPath =
|
|
28358
|
+
const blockedPath = path11.join(directory, ".hive", "features", feature, "BLOCKED");
|
|
28540
28359
|
if (fs12.existsSync(blockedPath)) {
|
|
28541
28360
|
const reason = fs12.readFileSync(blockedPath, "utf-8").trim();
|
|
28542
28361
|
return `⛔ BLOCKED by Beekeeper
|
|
@@ -28690,9 +28509,9 @@ To unblock: Remove .hive/features/${feature}/BLOCKED`;
|
|
|
28690
28509
|
spec: specContent,
|
|
28691
28510
|
workerPrompt
|
|
28692
28511
|
});
|
|
28693
|
-
const hiveDir =
|
|
28512
|
+
const hiveDir = path11.join(directory, ".hive");
|
|
28694
28513
|
const workerPromptPath = writeWorkerPromptFile(feature, task, workerPrompt, hiveDir);
|
|
28695
|
-
const relativePromptPath = normalizePath(
|
|
28514
|
+
const relativePromptPath = normalizePath(path11.relative(directory, workerPromptPath));
|
|
28696
28515
|
const PREVIEW_MAX_LENGTH = 200;
|
|
28697
28516
|
const workerPromptPreview = workerPrompt.length > PREVIEW_MAX_LENGTH ? workerPrompt.slice(0, PREVIEW_MAX_LENGTH) + "..." : workerPrompt;
|
|
28698
28517
|
const taskToolPrompt = `Follow instructions in @${relativePromptPath}`;
|
|
@@ -29100,7 +28919,7 @@ ${snapshot}
|
|
|
29100
28919
|
if (sandboxConfig.mode !== "none") {
|
|
29101
28920
|
const workdir = output.args?.workdir;
|
|
29102
28921
|
if (workdir) {
|
|
29103
|
-
const hiveWorktreeBase =
|
|
28922
|
+
const hiveWorktreeBase = path11.join(directory, ".hive", ".worktrees");
|
|
29104
28923
|
if (workdir.startsWith(hiveWorktreeBase)) {
|
|
29105
28924
|
const wrapped = DockerSandboxService.wrapCommand(workdir, finalCommand, sandboxConfig);
|
|
29106
28925
|
output.args.command = wrapped;
|
package/package.json
CHANGED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plugin Dependencies that can be auto-installed
|
|
3
|
-
*/
|
|
4
|
-
interface ToolConfig {
|
|
5
|
-
name: string;
|
|
6
|
-
npmPackage: string;
|
|
7
|
-
installCommand: string[];
|
|
8
|
-
verifyCommand: string;
|
|
9
|
-
description: string;
|
|
10
|
-
required: boolean;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Dependency Installer for plugin tools
|
|
14
|
-
*/
|
|
15
|
-
export declare class DependencyInstaller {
|
|
16
|
-
private installDir;
|
|
17
|
-
private cache;
|
|
18
|
-
private cacheTimeout;
|
|
19
|
-
constructor(installDir?: string);
|
|
20
|
-
/**
|
|
21
|
-
* Get the bin directory for installed tools
|
|
22
|
-
*/
|
|
23
|
-
getBinDir(): string;
|
|
24
|
-
/**
|
|
25
|
-
* Check if a command exists
|
|
26
|
-
*/
|
|
27
|
-
commandExists(cmd: string): boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Verify a tool is installed and working
|
|
30
|
-
*/
|
|
31
|
-
verifyTool(config: ToolConfig): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Install a single tool
|
|
34
|
-
*/
|
|
35
|
-
install(config: ToolConfig): Promise<{
|
|
36
|
-
success: boolean;
|
|
37
|
-
output?: string;
|
|
38
|
-
error?: string;
|
|
39
|
-
}>;
|
|
40
|
-
/**
|
|
41
|
-
* Check if a tool is installed (with caching)
|
|
42
|
-
*/
|
|
43
|
-
isInstalled(toolName: string): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Get status of all tools
|
|
46
|
-
*/
|
|
47
|
-
getStatus(): Array<{
|
|
48
|
-
name: string;
|
|
49
|
-
installed: boolean;
|
|
50
|
-
description: string;
|
|
51
|
-
required: boolean;
|
|
52
|
-
}>;
|
|
53
|
-
/**
|
|
54
|
-
* Ensure all required tools are installed
|
|
55
|
-
*/
|
|
56
|
-
ensureRequired(): Promise<{
|
|
57
|
-
installed: string[];
|
|
58
|
-
missing: string[];
|
|
59
|
-
errors: Record<string, string>;
|
|
60
|
-
}>;
|
|
61
|
-
/**
|
|
62
|
-
* Install all optional tools (for full functionality)
|
|
63
|
-
*/
|
|
64
|
-
installAll(): Promise<{
|
|
65
|
-
success: string[];
|
|
66
|
-
failed: Record<string, string>;
|
|
67
|
-
}>;
|
|
68
|
-
/**
|
|
69
|
-
* Install specific tool by name
|
|
70
|
-
*/
|
|
71
|
-
installTool(toolName: string): Promise<{
|
|
72
|
-
success: boolean;
|
|
73
|
-
output?: string;
|
|
74
|
-
error?: string;
|
|
75
|
-
}>;
|
|
76
|
-
}
|
|
77
|
-
export declare const dependencyInstaller: DependencyInstaller;
|
|
78
|
-
export declare function ensurePluginDeps(): Promise<void>;
|
|
79
|
-
export declare function getInstalledTools(): string[];
|
|
80
|
-
export {};
|