@hung319/opencode-hive 1.3.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/README.md +383 -0
- package/dist/agents/architect.d.ts +12 -0
- package/dist/agents/custom-agents.d.ts +18 -0
- package/dist/agents/forager.d.ts +12 -0
- package/dist/agents/hive.d.ts +12 -0
- package/dist/agents/hygienic.d.ts +12 -0
- package/dist/agents/index.d.ts +60 -0
- package/dist/agents/scout.d.ts +6 -0
- package/dist/agents/swarm.d.ts +12 -0
- package/dist/hooks/system-hook.d.ts +8 -0
- package/dist/hooks/variant-hook.d.ts +17 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +24654 -0
- package/dist/mcp/ast-grep.d.ts +2 -0
- package/dist/mcp/context7.d.ts +2 -0
- package/dist/mcp/grep-app.d.ts +2 -0
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/types.d.ts +12 -0
- package/dist/mcp/websearch.d.ts +2 -0
- package/dist/skills/builtin.d.ts +38 -0
- package/dist/skills/file-loader.d.ts +22 -0
- package/dist/skills/index.d.ts +8 -0
- package/dist/skills/registry.generated.d.ts +14 -0
- package/dist/skills/types.d.ts +29 -0
- package/dist/utils/compaction-prompt.d.ts +1 -0
- package/dist/utils/format.d.ts +16 -0
- package/dist/utils/prompt-budgeting.d.ts +112 -0
- package/dist/utils/prompt-file.d.ts +58 -0
- package/dist/utils/prompt-observability.d.ts +93 -0
- package/dist/utils/worker-prompt.d.ts +43 -0
- package/package.json +60 -0
- package/skills/agents-md-mastery/SKILL.md +252 -0
- package/skills/brainstorming/SKILL.md +53 -0
- package/skills/code-reviewer/SKILL.md +208 -0
- package/skills/dispatching-parallel-agents/SKILL.md +200 -0
- package/skills/docker-mastery/SKILL.md +346 -0
- package/skills/executing-plans/SKILL.md +92 -0
- package/skills/parallel-exploration/SKILL.md +240 -0
- package/skills/systematic-debugging/SKILL.md +296 -0
- package/skills/test-driven-development/SKILL.md +371 -0
- package/skills/verification-before-completion/SKILL.md +139 -0
- package/skills/writing-plans/SKILL.md +148 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type RemoteMcpConfig = {
|
|
2
|
+
type: 'remote';
|
|
3
|
+
url: string;
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
|
+
oauth?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type LocalMcpConfig = {
|
|
8
|
+
type: 'local';
|
|
9
|
+
command: string[];
|
|
10
|
+
environment?: Record<string, string>;
|
|
11
|
+
};
|
|
12
|
+
export type McpConfig = RemoteMcpConfig | LocalMcpConfig;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builtin Skills for Hive
|
|
3
|
+
*
|
|
4
|
+
* Skills are loaded from the generated registry.
|
|
5
|
+
* This file provides the infrastructure to load builtin skills.
|
|
6
|
+
*/
|
|
7
|
+
import type { SkillDefinition, SkillLoadResult } from './types.js';
|
|
8
|
+
import { BUILTIN_SKILL_NAMES, BUILTIN_SKILLS } from './registry.generated.js';
|
|
9
|
+
export { BUILTIN_SKILL_NAMES, BUILTIN_SKILLS };
|
|
10
|
+
/**
|
|
11
|
+
* Type for builtin skill names.
|
|
12
|
+
*/
|
|
13
|
+
export type BuiltinSkillName = typeof BUILTIN_SKILL_NAMES[number];
|
|
14
|
+
/**
|
|
15
|
+
* Load a builtin skill by name.
|
|
16
|
+
*/
|
|
17
|
+
export declare function loadBuiltinSkill(name: string): SkillLoadResult;
|
|
18
|
+
/**
|
|
19
|
+
* Get all builtin skills.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getBuiltinSkills(): SkillDefinition[];
|
|
22
|
+
/**
|
|
23
|
+
* Get filtered skills based on global disable list and optional per-agent enable list.
|
|
24
|
+
*
|
|
25
|
+
* Logic:
|
|
26
|
+
* 1. Start with all builtin skills
|
|
27
|
+
* 2. Remove globally disabled skills
|
|
28
|
+
* 3. If agentSkills is provided and non-empty, intersect with that list
|
|
29
|
+
*
|
|
30
|
+
* @param disabledSkills - Skills to globally disable
|
|
31
|
+
* @param agentSkills - If provided, only these skills are enabled for the agent (intersection)
|
|
32
|
+
*/
|
|
33
|
+
export declare function getFilteredSkills(disabledSkills?: string[], agentSkills?: string[]): SkillDefinition[];
|
|
34
|
+
/**
|
|
35
|
+
* Get skill metadata for tool description (XML format).
|
|
36
|
+
* Uses (hive - Skill) prefix for consistency with formatSkillsXml in index.ts.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getBuiltinSkillsXml(): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-based Skill Loader
|
|
3
|
+
*
|
|
4
|
+
* Resolves and loads skill files from OpenCode and Claude-compatible paths.
|
|
5
|
+
* Implements strict skill ID validation and deterministic search order.
|
|
6
|
+
*/
|
|
7
|
+
import type { SkillLoadResult } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Load a skill from file-based locations.
|
|
10
|
+
*
|
|
11
|
+
* Searches for skill files in the following order:
|
|
12
|
+
* 1. Project OpenCode: `<projectRoot>/.opencode/skills/<skillId>/SKILL.md`
|
|
13
|
+
* 2. Global OpenCode: `~/.config/opencode/skills/<skillId>/SKILL.md`
|
|
14
|
+
* 3. Project Claude-compatible: `<projectRoot>/.claude/skills/<skillId>/SKILL.md`
|
|
15
|
+
* 4. Global Claude-compatible: `~/.claude/skills/<skillId>/SKILL.md`
|
|
16
|
+
*
|
|
17
|
+
* @param skillId - The skill ID to load
|
|
18
|
+
* @param projectRoot - The project root directory
|
|
19
|
+
* @param homeDir - The user's home directory
|
|
20
|
+
* @returns The skill load result
|
|
21
|
+
*/
|
|
22
|
+
export declare function loadFileSkill(skillId: string, projectRoot: string, homeDir: string): Promise<SkillLoadResult>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hive Skills System
|
|
3
|
+
*
|
|
4
|
+
* Export skill infrastructure for use in hive_skill tool.
|
|
5
|
+
*/
|
|
6
|
+
export type { SkillDefinition, SkillLoadResult } from './types.js';
|
|
7
|
+
export { BUILTIN_SKILLS, loadBuiltinSkill, getBuiltinSkills, getFilteredSkills, getBuiltinSkillsXml, type BuiltinSkillName } from './builtin.js';
|
|
8
|
+
export { loadFileSkill } from './file-loader.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUTO-GENERATED FILE - DO NOT EDIT
|
|
3
|
+
* Generated by: scripts/generate-skills.ts
|
|
4
|
+
* Run: bun run scripts/generate-skills.ts
|
|
5
|
+
*/
|
|
6
|
+
import type { SkillDefinition } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* List of builtin skill names.
|
|
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"];
|
|
11
|
+
/**
|
|
12
|
+
* All builtin skill definitions.
|
|
13
|
+
*/
|
|
14
|
+
export declare const BUILTIN_SKILLS: SkillDefinition[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hive Skill System Types
|
|
3
|
+
*
|
|
4
|
+
* Skill definitions for Hive.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Definition of a skill that can be loaded by agents.
|
|
8
|
+
*/
|
|
9
|
+
export interface SkillDefinition {
|
|
10
|
+
/** Unique identifier for the skill */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Brief description shown in available_skills list */
|
|
13
|
+
description: string;
|
|
14
|
+
/** Markdown content with detailed instructions */
|
|
15
|
+
template: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Result returned when loading a skill.
|
|
19
|
+
*/
|
|
20
|
+
export interface SkillLoadResult {
|
|
21
|
+
/** Whether the skill was found */
|
|
22
|
+
found: boolean;
|
|
23
|
+
/** The loaded skill definition if found */
|
|
24
|
+
skill?: SkillDefinition;
|
|
25
|
+
/** Error message if not found */
|
|
26
|
+
error?: string;
|
|
27
|
+
/** Source of the skill (builtin or file path) */
|
|
28
|
+
source?: 'builtin' | string;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function buildCompactionPrompt(): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time formatting utilities.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Format elapsed time in milliseconds.
|
|
6
|
+
*
|
|
7
|
+
* Rules:
|
|
8
|
+
* - < 60s → "Xs"
|
|
9
|
+
* - < 60m → "Xm Ys"
|
|
10
|
+
* - ≥ 60m → "Xh Ym"
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatElapsed(ms: number): string;
|
|
13
|
+
/**
|
|
14
|
+
* Format relative time from an ISO date string to now.
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatRelativeTime(isoDate: string): string;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic prompt budgeting utilities for Hive.
|
|
3
|
+
*
|
|
4
|
+
* Limits history/context included in prompts to bound growth:
|
|
5
|
+
* - Include only last N completed tasks
|
|
6
|
+
* - Truncate each task summary to max M chars (with clear truncation marker)
|
|
7
|
+
* - Apply max budget for inlined context (or switch to file references / name-only listing past a cap)
|
|
8
|
+
* - Emit warnings when any budget causes truncation so it's never silent
|
|
9
|
+
*
|
|
10
|
+
* IMPORTANT: Never removes access to full info - always provides file paths the worker can read.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Input task for budgeting.
|
|
14
|
+
*/
|
|
15
|
+
export interface TaskInput {
|
|
16
|
+
name: string;
|
|
17
|
+
summary: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Budgeted task with truncation info.
|
|
21
|
+
*/
|
|
22
|
+
export interface BudgetedTask {
|
|
23
|
+
name: string;
|
|
24
|
+
summary: string;
|
|
25
|
+
truncated: boolean;
|
|
26
|
+
originalLength?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Input context file for budgeting.
|
|
30
|
+
*/
|
|
31
|
+
export interface ContextInput {
|
|
32
|
+
name: string;
|
|
33
|
+
content: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Budgeted context file with truncation info.
|
|
37
|
+
*/
|
|
38
|
+
export interface BudgetedContext {
|
|
39
|
+
name: string;
|
|
40
|
+
content: string;
|
|
41
|
+
truncated: boolean;
|
|
42
|
+
originalLength?: number;
|
|
43
|
+
/** Hint for where to find full content */
|
|
44
|
+
pathHint?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Truncation event for observability.
|
|
48
|
+
*/
|
|
49
|
+
export interface TruncationEvent {
|
|
50
|
+
type: 'tasks_dropped' | 'summary_truncated' | 'context_truncated' | 'context_names_only';
|
|
51
|
+
message: string;
|
|
52
|
+
count?: number;
|
|
53
|
+
/** Names of affected items */
|
|
54
|
+
affected?: string[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Budget configuration.
|
|
58
|
+
*/
|
|
59
|
+
export interface BudgetConfig {
|
|
60
|
+
/** Max number of previous tasks to include (default: 10) */
|
|
61
|
+
maxTasks?: number;
|
|
62
|
+
/** Max chars per task summary (default: 2000) */
|
|
63
|
+
maxSummaryChars?: number;
|
|
64
|
+
/** Max chars per context file (default: 20000) */
|
|
65
|
+
maxContextChars?: number;
|
|
66
|
+
/** Max total chars for all context files combined (default: 60000) */
|
|
67
|
+
maxTotalContextChars?: number;
|
|
68
|
+
/** Feature name for generating file path hints */
|
|
69
|
+
feature?: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Result of applying task budget.
|
|
73
|
+
*/
|
|
74
|
+
export interface TaskBudgetResult {
|
|
75
|
+
tasks: BudgetedTask[];
|
|
76
|
+
truncationEvents: TruncationEvent[];
|
|
77
|
+
/** Hint about dropped tasks and where to find them */
|
|
78
|
+
droppedTasksHint?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Result of applying context budget.
|
|
82
|
+
*/
|
|
83
|
+
export interface ContextBudgetResult {
|
|
84
|
+
files: BudgetedContext[];
|
|
85
|
+
truncationEvents: TruncationEvent[];
|
|
86
|
+
/** Names of files that were converted to name-only */
|
|
87
|
+
namesOnlyFiles?: string[];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Default budget configuration.
|
|
91
|
+
*
|
|
92
|
+
* Conservative defaults that balance context richness with bounded growth.
|
|
93
|
+
*/
|
|
94
|
+
export declare const DEFAULT_BUDGET: Required<Omit<BudgetConfig, 'feature'>>;
|
|
95
|
+
/**
|
|
96
|
+
* Apply budget limits to previous tasks.
|
|
97
|
+
*
|
|
98
|
+
* - Keeps only the last N tasks (most recent)
|
|
99
|
+
* - Truncates summaries exceeding max chars
|
|
100
|
+
* - Emits truncation events for observability
|
|
101
|
+
* - Provides hints for accessing full info
|
|
102
|
+
*/
|
|
103
|
+
export declare function applyTaskBudget(tasks: TaskInput[], config?: BudgetConfig): TaskBudgetResult;
|
|
104
|
+
/**
|
|
105
|
+
* Apply budget limits to context files.
|
|
106
|
+
*
|
|
107
|
+
* - Truncates individual files exceeding max chars
|
|
108
|
+
* - Switches to name-only listing when total exceeds budget
|
|
109
|
+
* - Emits truncation events for observability
|
|
110
|
+
* - Provides file path hints for accessing full content
|
|
111
|
+
*/
|
|
112
|
+
export declare function applyContextBudget(files: ContextInput[], config?: BudgetConfig): ContextBudgetResult;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt file utilities for preventing tool output truncation.
|
|
3
|
+
*
|
|
4
|
+
* Instead of inlining large prompts in tool outputs, we write them to files
|
|
5
|
+
* and pass file references. This keeps tool output sizes bounded while
|
|
6
|
+
* preserving full prompt content for workers.
|
|
7
|
+
*
|
|
8
|
+
* Security: All file operations are restricted to workspace/.hive paths.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Result of resolving prompt content from a file.
|
|
12
|
+
*/
|
|
13
|
+
export interface PromptFileResult {
|
|
14
|
+
/** The prompt content if successfully read */
|
|
15
|
+
content?: string;
|
|
16
|
+
/** Error message if reading failed */
|
|
17
|
+
error?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Find the workspace root by walking up from a start directory.
|
|
21
|
+
*
|
|
22
|
+
* The workspace root is identified as the directory that contains a .hive folder.
|
|
23
|
+
* Returns null if no .hive directory is found.
|
|
24
|
+
*/
|
|
25
|
+
export declare function findWorkspaceRoot(startDir: string): string | null;
|
|
26
|
+
/**
|
|
27
|
+
* Check if a file path is valid for prompt file operations.
|
|
28
|
+
*
|
|
29
|
+
* Security: Only allows paths within the workspace directory.
|
|
30
|
+
* Rejects path traversal attempts (../).
|
|
31
|
+
*
|
|
32
|
+
* @param filePath - The path to validate
|
|
33
|
+
* @param workspaceRoot - The workspace root directory
|
|
34
|
+
* @returns true if the path is valid and safe
|
|
35
|
+
*/
|
|
36
|
+
export declare function isValidPromptFilePath(filePath: string, workspaceRoot: string): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Resolve prompt content from a file.
|
|
39
|
+
*
|
|
40
|
+
* Security: Validates that the file path is within the workspace.
|
|
41
|
+
*
|
|
42
|
+
* @param promptFilePath - Path to the prompt file
|
|
43
|
+
* @param workspaceRoot - The workspace root directory for security validation
|
|
44
|
+
* @returns The prompt content or an error
|
|
45
|
+
*/
|
|
46
|
+
export declare function resolvePromptFromFile(promptFilePath: string, workspaceRoot: string): Promise<PromptFileResult>;
|
|
47
|
+
/**
|
|
48
|
+
* Write worker prompt to a file and return the path.
|
|
49
|
+
*
|
|
50
|
+
* Creates the directory structure if it doesn't exist.
|
|
51
|
+
*
|
|
52
|
+
* @param feature - Feature name
|
|
53
|
+
* @param task - Task folder name
|
|
54
|
+
* @param prompt - The full worker prompt content
|
|
55
|
+
* @param hiveDir - The .hive directory path
|
|
56
|
+
* @returns The path to the written prompt file
|
|
57
|
+
*/
|
|
58
|
+
export declare function writeWorkerPromptFile(feature: string, task: string, prompt: string, hiveDir: string): string;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt and payload observability utilities for Hive.
|
|
3
|
+
*
|
|
4
|
+
* Provides visibility into prompt/payload sizes to detect when
|
|
5
|
+
* thresholds are exceeded, preventing silent truncation risks.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Metadata about prompt component sizes (in characters).
|
|
9
|
+
*/
|
|
10
|
+
export interface PromptMeta {
|
|
11
|
+
/** Size of the plan content in characters */
|
|
12
|
+
planChars: number;
|
|
13
|
+
/** Size of all context files combined in characters */
|
|
14
|
+
contextChars: number;
|
|
15
|
+
/** Size of previous task summaries in characters */
|
|
16
|
+
previousTasksChars: number;
|
|
17
|
+
/** Size of the task spec in characters */
|
|
18
|
+
specChars: number;
|
|
19
|
+
/** Size of the final worker prompt in characters */
|
|
20
|
+
workerPromptChars: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Metadata about the JSON payload.
|
|
24
|
+
*/
|
|
25
|
+
export interface PayloadMeta {
|
|
26
|
+
/** Size of the full JSON payload in characters */
|
|
27
|
+
jsonPayloadChars: number;
|
|
28
|
+
/** Whether the prompt is inlined in the payload */
|
|
29
|
+
promptInlined: boolean;
|
|
30
|
+
/** Whether the prompt is referenced by file path */
|
|
31
|
+
promptReferencedByFile: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Warning about threshold exceedance.
|
|
35
|
+
*/
|
|
36
|
+
export interface PromptWarning {
|
|
37
|
+
/** Type of warning */
|
|
38
|
+
type: 'workerPromptSize' | 'jsonPayloadSize' | 'contextSize' | 'previousTasksSize' | 'planSize';
|
|
39
|
+
/** Severity level */
|
|
40
|
+
severity: 'info' | 'warning' | 'critical';
|
|
41
|
+
/** Human-readable message */
|
|
42
|
+
message: string;
|
|
43
|
+
/** Current value */
|
|
44
|
+
currentValue: number;
|
|
45
|
+
/** Threshold that was exceeded */
|
|
46
|
+
threshold: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Configurable thresholds for warnings.
|
|
50
|
+
*/
|
|
51
|
+
export interface PromptThresholds {
|
|
52
|
+
/** Max chars for worker prompt before warning (default: 100KB) */
|
|
53
|
+
workerPromptMaxChars: number;
|
|
54
|
+
/** Max chars for JSON payload before warning (default: 150KB) */
|
|
55
|
+
jsonPayloadMaxChars: number;
|
|
56
|
+
/** Max chars for context before warning (default: 50KB) */
|
|
57
|
+
contextMaxChars: number;
|
|
58
|
+
/** Max chars for previous tasks before warning (default: 20KB) */
|
|
59
|
+
previousTasksMaxChars: number;
|
|
60
|
+
/** Max chars for plan before warning (default: 30KB) */
|
|
61
|
+
planMaxChars?: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Default thresholds for prompt/payload size warnings.
|
|
65
|
+
*
|
|
66
|
+
* These are conservative defaults based on typical LLM context limits
|
|
67
|
+
* and tool output size restrictions.
|
|
68
|
+
*/
|
|
69
|
+
export declare const DEFAULT_THRESHOLDS: PromptThresholds;
|
|
70
|
+
/**
|
|
71
|
+
* Calculate metadata about prompt component sizes.
|
|
72
|
+
*/
|
|
73
|
+
export declare function calculatePromptMeta(inputs: {
|
|
74
|
+
plan: string;
|
|
75
|
+
context: string;
|
|
76
|
+
previousTasks: string;
|
|
77
|
+
spec: string;
|
|
78
|
+
workerPrompt: string;
|
|
79
|
+
}): PromptMeta;
|
|
80
|
+
/**
|
|
81
|
+
* Calculate metadata about the JSON payload.
|
|
82
|
+
*/
|
|
83
|
+
export declare function calculatePayloadMeta(inputs: {
|
|
84
|
+
jsonPayload: string;
|
|
85
|
+
promptInlined: boolean;
|
|
86
|
+
promptReferencedByFile?: boolean;
|
|
87
|
+
}): PayloadMeta;
|
|
88
|
+
/**
|
|
89
|
+
* Check for threshold exceedances and generate warnings.
|
|
90
|
+
*
|
|
91
|
+
* Returns an array of warnings. Empty array means all sizes are within limits.
|
|
92
|
+
*/
|
|
93
|
+
export declare function checkWarnings(promptMeta: PromptMeta, payloadMeta: PayloadMeta, thresholds?: Partial<PromptThresholds>): PromptWarning[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker prompt builder for Hive delegated execution.
|
|
3
|
+
* Builds context-rich prompts for worker agents with all Hive context.
|
|
4
|
+
*/
|
|
5
|
+
export interface ContextFile {
|
|
6
|
+
name: string;
|
|
7
|
+
content: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CompletedTask {
|
|
10
|
+
name: string;
|
|
11
|
+
summary: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ContinueFromBlocked {
|
|
14
|
+
status: 'blocked';
|
|
15
|
+
previousSummary: string;
|
|
16
|
+
decision: string;
|
|
17
|
+
}
|
|
18
|
+
export interface WorkerPromptParams {
|
|
19
|
+
feature: string;
|
|
20
|
+
task: string;
|
|
21
|
+
taskOrder: number;
|
|
22
|
+
worktreePath: string;
|
|
23
|
+
branch: string;
|
|
24
|
+
plan: string;
|
|
25
|
+
contextFiles: ContextFile[];
|
|
26
|
+
spec: string;
|
|
27
|
+
previousTasks?: CompletedTask[];
|
|
28
|
+
continueFrom?: ContinueFromBlocked;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Build a context-rich prompt for a worker agent.
|
|
32
|
+
*
|
|
33
|
+
* Includes:
|
|
34
|
+
* - Assignment details (feature, task, worktree, branch)
|
|
35
|
+
* - Mission (spec) - contains plan section, context, and completed tasks
|
|
36
|
+
* - Blocker protocol (NOT question tool)
|
|
37
|
+
* - Completion protocol
|
|
38
|
+
*
|
|
39
|
+
* NOTE: Plan, context files, and previous tasks are NOT included separately
|
|
40
|
+
* because they are already embedded in the spec. This prevents duplication
|
|
41
|
+
* and keeps the prompt size bounded.
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildWorkerPrompt(params: WorkerPromptParams): string;
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hung319/opencode-hive",
|
|
3
|
+
"version": "1.3.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "OpenCode plugin for Agent Hive - from vibe coding to hive coding",
|
|
6
|
+
"license": "MIT WITH Commons-Clause",
|
|
7
|
+
"author": "hung319",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/hung319/agent-hive.git",
|
|
11
|
+
"directory": "packages/opencode-hive"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/hung319/agent-hive#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/hung319/agent-hive/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"opencode",
|
|
19
|
+
"ai",
|
|
20
|
+
"hive",
|
|
21
|
+
"vibe-coding",
|
|
22
|
+
"workflow",
|
|
23
|
+
"planning",
|
|
24
|
+
"agent"
|
|
25
|
+
],
|
|
26
|
+
"main": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"scripts": {
|
|
29
|
+
"clean": "rm -rf dist",
|
|
30
|
+
"generate-skills": "bun run scripts/generate-skills.ts",
|
|
31
|
+
"build": "npm run clean && npm run generate-skills && bun build src/index.ts --outdir dist --target node --format esm --packages=bundle && tsc --emitDeclarationOnly",
|
|
32
|
+
"dev": "opencode plugin dev",
|
|
33
|
+
"test": "bun test"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@opencode-ai/plugin": ">=0.13.7"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"simple-git": "^3.27.0"
|
|
40
|
+
},
|
|
41
|
+
"optionalDependencies": {
|
|
42
|
+
"grep-mcp": "^1.1.0",
|
|
43
|
+
"@notprolands/ast-grep-mcp": "^1.1.1",
|
|
44
|
+
"@upstash/context7-mcp": "^2.1.0",
|
|
45
|
+
"exa-mcp-server": "^3.1.5"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"hive-core": "workspace:*",
|
|
49
|
+
"@opencode-ai/plugin": "^1.0.143",
|
|
50
|
+
"@opencode-ai/sdk": "^0.13.0",
|
|
51
|
+
"@types/bun": "^1.2.0",
|
|
52
|
+
"@types/node": "^20.0.0",
|
|
53
|
+
"typescript": "^5.0.0"
|
|
54
|
+
},
|
|
55
|
+
"files": [
|
|
56
|
+
"dist/",
|
|
57
|
+
"skills/",
|
|
58
|
+
"README.md"
|
|
59
|
+
]
|
|
60
|
+
}
|