@hung319/opencode-hive 1.3.1 → 1.3.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/agents/code-reviewer.d.ts +11 -0
- package/dist/agents/code-simplifier.d.ts +11 -0
- package/dist/agents/codebase-analyzer.d.ts +11 -0
- package/dist/agents/codebase-locator.d.ts +11 -0
- package/dist/agents/hive.d.ts +3 -3
- package/dist/agents/index.d.ts +58 -2
- package/dist/agents/pattern-finder.d.ts +11 -0
- package/dist/agents/project-initializer.d.ts +11 -0
- package/dist/index.js +1091 -256
- package/dist/mcp/ast-grep.d.ts +8 -1
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/websearch.d.ts +2 -1
- package/dist/skills/registry.generated.d.ts +1 -1
- package/dist/tools/artifact-search.d.ts +23 -0
- package/dist/tools/btca-ask.d.ts +24 -0
- package/dist/tools/gitingest.d.ts +9 -0
- package/dist/tools/look-at.d.ts +12 -0
- package/dist/tools/pty.d.ts +45 -0
- package/dist/utils/context-compression.d.ts +86 -0
- package/package.json +1 -1
- package/skills/ask-questions-if-underspecified/SKILL.md +59 -0
package/dist/mcp/ast-grep.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
import type { LocalMcpConfig } from './types';
|
|
1
|
+
import type { RemoteMcpConfig, LocalMcpConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Ast-grep MCP for code analysis
|
|
4
|
+
*
|
|
5
|
+
* Prefers remote MCP when available, falls back to local npx
|
|
6
|
+
* Remote is preferred to avoid local installation
|
|
7
|
+
*/
|
|
8
|
+
export declare const astGrepRemoteMcp: RemoteMcpConfig;
|
|
2
9
|
export declare const astGrepMcp: LocalMcpConfig;
|
package/dist/mcp/index.d.ts
CHANGED
package/dist/mcp/websearch.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { SkillDefinition } from './types.js';
|
|
|
7
7
|
/**
|
|
8
8
|
* List of builtin skill names.
|
|
9
9
|
*/
|
|
10
|
-
export declare const BUILTIN_SKILL_NAMES: readonly ["agents-md-mastery", "brainstorming", "code-reviewer", "dispatching-parallel-agents", "docker-mastery", "executing-plans", "parallel-exploration", "systematic-debugging", "test-driven-development", "verification-before-completion", "writing-plans"];
|
|
10
|
+
export declare const BUILTIN_SKILL_NAMES: readonly ["agents-md-mastery", "ask-questions-if-underspecified", "brainstorming", "code-reviewer", "dispatching-parallel-agents", "docker-mastery", "executing-plans", "parallel-exploration", "systematic-debugging", "test-driven-development", "verification-before-completion", "writing-plans"];
|
|
11
11
|
/**
|
|
12
12
|
* All builtin skill definitions.
|
|
13
13
|
*/
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ToolDefinition } from "@opencode-ai/plugin";
|
|
2
|
+
/**
|
|
3
|
+
* artifact_search tool
|
|
4
|
+
*
|
|
5
|
+
* Requires: SQLite artifact-index database
|
|
6
|
+
*
|
|
7
|
+
* This tool searches through indexed artifacts (code snippets, documents, etc.)
|
|
8
|
+
* stored in a SQLite database. Before using, you need to:
|
|
9
|
+
*
|
|
10
|
+
* 1. Install the artifact-index: npm install -g artifact-index
|
|
11
|
+
* 2. Initialize the index: artifact-index init
|
|
12
|
+
* 3. Index your artifacts: artifact-index add <path>
|
|
13
|
+
*
|
|
14
|
+
* If the dependency is not available, this tool returns an error message
|
|
15
|
+
* explaining how to set it up.
|
|
16
|
+
*/
|
|
17
|
+
export interface ArtifactSearchArgs {
|
|
18
|
+
query: string;
|
|
19
|
+
limit?: number;
|
|
20
|
+
type?: "code" | "doc" | "all";
|
|
21
|
+
}
|
|
22
|
+
export declare function searchArtifacts(args: ArtifactSearchArgs): Promise<string>;
|
|
23
|
+
export declare const artifactSearchTool: ToolDefinition;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ToolDefinition } from "@opencode-ai/plugin";
|
|
2
|
+
/**
|
|
3
|
+
* btca_ask tool
|
|
4
|
+
*
|
|
5
|
+
* Requires: btca CLI (Bluetooth Classic Audio)
|
|
6
|
+
*
|
|
7
|
+
* This tool allows interaction with Bluetooth Classic Audio devices.
|
|
8
|
+
* It can send commands to paired Bluetooth devices, query device status,
|
|
9
|
+
* and control audio playback.
|
|
10
|
+
*
|
|
11
|
+
* Before using, you need to:
|
|
12
|
+
* 1. Install btca CLI: npm install -g btca-cli
|
|
13
|
+
* 2. Pair your Bluetooth device
|
|
14
|
+
* 3. Connect to the device: btca connect <device-name>
|
|
15
|
+
*
|
|
16
|
+
* If the dependency is not available, this tool returns an error message.
|
|
17
|
+
*/
|
|
18
|
+
export interface BtcaAskArgs {
|
|
19
|
+
command: "status" | "play" | "pause" | "next" | "prev" | "volume" | "list" | "connect" | "disconnect";
|
|
20
|
+
device?: string;
|
|
21
|
+
value?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function btcaAsk(args: BtcaAskArgs): Promise<string>;
|
|
24
|
+
export declare const btcaAskTool: ToolDefinition;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ToolDefinition } from "@opencode-ai/plugin";
|
|
2
|
+
export interface GitingestArgs {
|
|
3
|
+
url: string;
|
|
4
|
+
maxFileSize?: number;
|
|
5
|
+
pattern?: string;
|
|
6
|
+
patternType?: "include" | "exclude";
|
|
7
|
+
}
|
|
8
|
+
export declare function fetchGitingest(args: GitingestArgs): Promise<string>;
|
|
9
|
+
export declare const gitingestTool: ToolDefinition;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Look At Tool
|
|
3
|
+
*
|
|
4
|
+
* Extract key information from a file to save context tokens.
|
|
5
|
+
* For large files, returns structure/outline instead of full content.
|
|
6
|
+
*/
|
|
7
|
+
import { type ToolDefinition } from "@opencode-ai/plugin";
|
|
8
|
+
export interface LookAtArgs {
|
|
9
|
+
filePath: string;
|
|
10
|
+
extract?: "structure" | "imports" | "exports" | "all";
|
|
11
|
+
}
|
|
12
|
+
export declare const lookAtTool: ToolDefinition;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type ToolDefinition } from "@opencode-ai/plugin";
|
|
2
|
+
/**
|
|
3
|
+
* PTY (Pseudo-Terminal) tools
|
|
4
|
+
*
|
|
5
|
+
* Requires: bun-pty package
|
|
6
|
+
*
|
|
7
|
+
* These tools provide interactive PTY management for running background processes,
|
|
8
|
+
* sending interactive input, and reading output on demand.
|
|
9
|
+
*
|
|
10
|
+
* Use cases:
|
|
11
|
+
* - Running dev servers (npm run dev, cargo watch)
|
|
12
|
+
* - Watch modes (npm test -- --watch)
|
|
13
|
+
* - Interactive programs (REPLs, prompts)
|
|
14
|
+
* - Long-running processes
|
|
15
|
+
*
|
|
16
|
+
* Before using, you need to:
|
|
17
|
+
* 1. Install opencode-pty plugin OR
|
|
18
|
+
* 2. Install bun-pty: npm install -g bun-pty
|
|
19
|
+
*
|
|
20
|
+
* Note: These tools provide a wrapper around the opencode-pty functionality.
|
|
21
|
+
* For full PTY support, consider using the opencode-pty plugin directly.
|
|
22
|
+
*/
|
|
23
|
+
export interface PtyStartArgs {
|
|
24
|
+
command: string;
|
|
25
|
+
cwd?: string;
|
|
26
|
+
env?: Record<string, string>;
|
|
27
|
+
}
|
|
28
|
+
export interface PtySendArgs {
|
|
29
|
+
id: string;
|
|
30
|
+
input: string;
|
|
31
|
+
}
|
|
32
|
+
export interface PtyReadArgs {
|
|
33
|
+
id: string;
|
|
34
|
+
clear?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface PtyKillArgs {
|
|
37
|
+
id: string;
|
|
38
|
+
}
|
|
39
|
+
export interface PtyListArgs {
|
|
40
|
+
}
|
|
41
|
+
export declare const ptyStartTool: ToolDefinition;
|
|
42
|
+
export declare const ptySendTool: ToolDefinition;
|
|
43
|
+
export declare const ptyReadTool: ToolDefinition;
|
|
44
|
+
export declare const ptyKillTool: ToolDefinition;
|
|
45
|
+
export declare const ptyListTool: ToolDefinition;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Compression Utility
|
|
3
|
+
*
|
|
4
|
+
* Provides automatic context compression for Hive when context reaches threshold.
|
|
5
|
+
* Similar to DCP (Dynamic Context Pruning) or oh-my-openagent's context management.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Automatic compression at 50% context threshold
|
|
9
|
+
* - Trimming unnecessary tool outputs
|
|
10
|
+
* - Deduplication, write superseding, and error purging strategies
|
|
11
|
+
* - Zero-cost automatic pruning strategies
|
|
12
|
+
*/
|
|
13
|
+
interface MessageContent {
|
|
14
|
+
type: "text";
|
|
15
|
+
text?: string;
|
|
16
|
+
}
|
|
17
|
+
interface ToolCall {
|
|
18
|
+
id?: string;
|
|
19
|
+
name: string;
|
|
20
|
+
arguments?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
interface Message {
|
|
23
|
+
role: "user" | "assistant" | "tool" | "system";
|
|
24
|
+
content?: string | MessageContent[];
|
|
25
|
+
tool_calls?: ToolCall[];
|
|
26
|
+
tool_call_id?: string;
|
|
27
|
+
name?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface CompressionConfig {
|
|
30
|
+
/** Context threshold to trigger compression (0-1, default: 0.5 = 50%) */
|
|
31
|
+
threshold?: number;
|
|
32
|
+
/** Enable automatic compression */
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
/** Protected tool output patterns (glob) */
|
|
35
|
+
protectedTools?: string[];
|
|
36
|
+
/** Protect user messages from compression */
|
|
37
|
+
protectUserMessages?: boolean;
|
|
38
|
+
/** Maximum tool calls to keep after compression */
|
|
39
|
+
maxToolCalls?: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Estimate token count from messages (rough approximation)
|
|
43
|
+
* ~4 characters per token on average
|
|
44
|
+
*/
|
|
45
|
+
export declare function estimateTokens(messages: Message[]): number;
|
|
46
|
+
/**
|
|
47
|
+
* Calculate context usage ratio (0-1)
|
|
48
|
+
*/
|
|
49
|
+
export declare function getContextUsage(messages: Message[], contextLimit: number): number;
|
|
50
|
+
/**
|
|
51
|
+
* Check if context compression is needed
|
|
52
|
+
*/
|
|
53
|
+
export declare function needsCompression(messages: Message[], contextLimit: number, config?: CompressionConfig): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Main compression function
|
|
56
|
+
* Applies all strategies to reduce context size
|
|
57
|
+
*/
|
|
58
|
+
export declare function compressContext(messages: Message[], config?: CompressionConfig, contextLimit?: number): {
|
|
59
|
+
compressed: Message[];
|
|
60
|
+
stats: CompressionStats;
|
|
61
|
+
};
|
|
62
|
+
export interface CompressionStats {
|
|
63
|
+
originalTokens: number;
|
|
64
|
+
compressedTokens: number;
|
|
65
|
+
reductionRatio: number;
|
|
66
|
+
originalMessages: number;
|
|
67
|
+
compressedMessages: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Build a compression hint prompt
|
|
71
|
+
* This is injected into context to guide the LLM
|
|
72
|
+
*/
|
|
73
|
+
export declare function buildCompressionHint(): string;
|
|
74
|
+
/**
|
|
75
|
+
* Create a session compaction hook for Hive
|
|
76
|
+
* This can be used with experimental.session.compacting hook
|
|
77
|
+
*/
|
|
78
|
+
export declare function createCompactionHook(config?: CompressionConfig): (input: {
|
|
79
|
+
sessionID: string;
|
|
80
|
+
messages?: Message[];
|
|
81
|
+
contextLimit?: number;
|
|
82
|
+
}, output: {
|
|
83
|
+
context: string[];
|
|
84
|
+
prompt?: string;
|
|
85
|
+
}) => void;
|
|
86
|
+
export {};
|
package/package.json
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ask-questions-if-underspecified
|
|
3
|
+
description: Clarify requirements before implementing. Use when serious doubts arise.
|
|
4
|
+
use_when: >
|
|
5
|
+
When a request has multiple plausible interpretations or key details
|
|
6
|
+
(objective, scope, constraints, environment, or safety) are unclear,
|
|
7
|
+
load this skill before starting implementation.
|
|
8
|
+
Do NOT use when the request is already clear or when a quick, low-risk
|
|
9
|
+
discovery read can answer the missing details.
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Ask Questions If Underspecified
|
|
13
|
+
|
|
14
|
+
## Goal
|
|
15
|
+
|
|
16
|
+
Ask the minimum set of clarifying questions needed to avoid wrong work; do not start implementing until the must-have questions are answered (or the user explicitly approves proceeding with stated assumptions).
|
|
17
|
+
|
|
18
|
+
## Workflow
|
|
19
|
+
|
|
20
|
+
### 1) Decide whether the request is underspecified
|
|
21
|
+
|
|
22
|
+
Treat a request as underspecified if after exploring how to perform the work, some or all of the following are not clear:
|
|
23
|
+
- Define the objective (what should change vs stay the same)
|
|
24
|
+
- Define "done" (acceptance criteria, examples, edge cases)
|
|
25
|
+
- Define scope (which files/components/users are in/out)
|
|
26
|
+
- Define constraints (compatibility, performance, style, deps, time)
|
|
27
|
+
- Identify environment (language/runtime versions, OS, build/test runner)
|
|
28
|
+
- Clarify safety/reversibility (data migration, rollout/rollback, risk)
|
|
29
|
+
|
|
30
|
+
If multiple plausible interpretations exist, assume it is underspecified.
|
|
31
|
+
|
|
32
|
+
### 2) Ask must-have questions first (keep it small)
|
|
33
|
+
|
|
34
|
+
Ask 1-5 questions in the first pass. Prefer questions that eliminate whole branches of work.
|
|
35
|
+
|
|
36
|
+
Use the `question` tool to present structured choices:
|
|
37
|
+
- Offer multiple-choice options with clear labels
|
|
38
|
+
- Mark recommended defaults with "(Recommended)" in the label
|
|
39
|
+
- Use `multiple: true` when the user can select several options
|
|
40
|
+
- The user can always select "Other" for custom input
|
|
41
|
+
|
|
42
|
+
### 3) Pause before acting
|
|
43
|
+
|
|
44
|
+
Until must-have answers arrive:
|
|
45
|
+
- Do not run commands, edit files, or produce a detailed plan that depends on unknowns
|
|
46
|
+
- Do perform a clearly labeled, low-risk discovery step only if it does not commit you to a direction (e.g., inspect repo structure, read relevant config files)
|
|
47
|
+
|
|
48
|
+
If the user explicitly asks you to proceed without answers:
|
|
49
|
+
- State your assumptions as a short numbered list
|
|
50
|
+
- Ask for confirmation; proceed only after they confirm or correct them
|
|
51
|
+
|
|
52
|
+
### 4) Confirm interpretation, then proceed
|
|
53
|
+
|
|
54
|
+
Once you have answers, restate the requirements in 1-3 sentences (including key constraints and what success looks like), then start work.
|
|
55
|
+
|
|
56
|
+
## Anti-patterns
|
|
57
|
+
|
|
58
|
+
- Don't ask questions you can answer with a quick, low-risk discovery read (e.g., configs, existing patterns, docs).
|
|
59
|
+
- Don't ask open-ended questions if a tight multiple-choice or yes/no would eliminate ambiguity faster.
|