opencode-hive 1.0.7 → 1.2.0
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 +5 -34
- package/dist/agents/architect.d.ts +1 -1
- package/dist/agents/forager.d.ts +1 -1
- package/dist/agents/hive.d.ts +1 -1
- package/dist/agents/hygienic.d.ts +1 -1
- package/dist/agents/scout.d.ts +1 -1
- package/dist/agents/swarm.d.ts +1 -1
- package/dist/index.js +1438 -2167
- package/dist/skills/registry.generated.d.ts +1 -1
- package/package.json +1 -1
- package/skills/agents-md-mastery/SKILL.md +253 -0
- package/skills/brainstorming/SKILL.md +1 -0
- package/skills/dispatching-parallel-agents/SKILL.md +3 -3
- package/skills/docker-mastery/SKILL.md +346 -0
- package/skills/executing-plans/SKILL.md +8 -3
- package/skills/parallel-exploration/SKILL.md +18 -133
- package/skills/test-driven-development/SKILL.md +1 -1
- package/skills/writing-plans/SKILL.md +7 -0
- package/dist/background/agent-gate.d.ts +0 -64
- package/dist/background/concurrency.d.ts +0 -102
- package/dist/background/index.d.ts +0 -27
- package/dist/background/manager.d.ts +0 -169
- package/dist/background/poller.d.ts +0 -131
- package/dist/background/store.d.ts +0 -100
- package/dist/background/types.d.ts +0 -246
- package/dist/tools/background-tools.d.ts +0 -37
- package/skills/onboarding/SKILL.md +0 -61
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Background Poller for session status and stability detection.
|
|
3
|
-
*
|
|
4
|
-
* This module provides READ-ONLY observation of background task sessions.
|
|
5
|
-
* It does NOT write to .hive - only updates in-memory task progress.
|
|
6
|
-
*
|
|
7
|
-
* Capabilities:
|
|
8
|
-
* - Track session status (running/idle)
|
|
9
|
-
* - Track message growth and last activity timestamps
|
|
10
|
-
* - Compute "maybe stuck" heuristics
|
|
11
|
-
* - Exponential backoff to avoid polling storms
|
|
12
|
-
*/
|
|
13
|
-
import { BackgroundTaskStore } from './store.js';
|
|
14
|
-
import { OpencodeClient } from './types.js';
|
|
15
|
-
/**
|
|
16
|
-
* Configuration for the background poller.
|
|
17
|
-
*/
|
|
18
|
-
export interface PollerConfig {
|
|
19
|
-
/** Base polling interval in ms (default: 5000) */
|
|
20
|
-
pollIntervalMs?: number;
|
|
21
|
-
/** Max polling interval with backoff (default: 30000) */
|
|
22
|
-
maxPollIntervalMs?: number;
|
|
23
|
-
/** Time before task is considered "maybe stuck" (default: 600000 = 10 min) */
|
|
24
|
-
stuckThresholdMs?: number;
|
|
25
|
-
/** Minimum runtime before stuck detection kicks in (default: 30000 = 30 sec) */
|
|
26
|
-
minRuntimeBeforeStuckMs?: number;
|
|
27
|
-
/** Consecutive stable polls before marking as stable (default: 3) */
|
|
28
|
-
stableCountThreshold?: number;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Optional callbacks for reacting to observed session state.
|
|
32
|
-
*
|
|
33
|
-
* NOTE: Poller remains "read-only" with respect to `.hive`.
|
|
34
|
-
* These callbacks are intended for in-memory lifecycle transitions (e.g. marking
|
|
35
|
-
* a background task completed) handled by the owning manager.
|
|
36
|
-
*/
|
|
37
|
-
export interface PollerHandlers {
|
|
38
|
-
/**
|
|
39
|
-
* Invoked when the poller observes that a background session is idle/complete.
|
|
40
|
-
*
|
|
41
|
-
* The owning manager should:
|
|
42
|
-
* - transition the task to a terminal state
|
|
43
|
-
* - release any concurrency slot
|
|
44
|
-
* - cleanup poller state
|
|
45
|
-
*/
|
|
46
|
-
onSessionIdle?: (sessionId: string, reason: 'status' | 'stable') => void;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Observation result for a single task.
|
|
50
|
-
*/
|
|
51
|
-
export interface TaskObservation {
|
|
52
|
-
taskId: string;
|
|
53
|
-
sessionId: string;
|
|
54
|
-
status: string;
|
|
55
|
-
messageCount: number;
|
|
56
|
-
lastActivityAt: string | null;
|
|
57
|
-
maybeStuck: boolean;
|
|
58
|
-
stablePolls: number;
|
|
59
|
-
isStable: boolean;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Background Poller - read-only observer for task sessions.
|
|
63
|
-
*
|
|
64
|
-
* IMPORTANT: This poller does NOT write to .hive.
|
|
65
|
-
* It only updates in-memory task progress for status reporting.
|
|
66
|
-
*/
|
|
67
|
-
export declare class BackgroundPoller {
|
|
68
|
-
private store;
|
|
69
|
-
private client;
|
|
70
|
-
private config;
|
|
71
|
-
private handlers;
|
|
72
|
-
private pollingState;
|
|
73
|
-
private pollInterval;
|
|
74
|
-
private isPolling;
|
|
75
|
-
private currentIntervalMs;
|
|
76
|
-
constructor(store: BackgroundTaskStore, client: OpencodeClient, config?: PollerConfig, handlers?: PollerHandlers);
|
|
77
|
-
/**
|
|
78
|
-
* Start the background poller.
|
|
79
|
-
* Automatically stops when no active tasks remain.
|
|
80
|
-
*/
|
|
81
|
-
start(): void;
|
|
82
|
-
/**
|
|
83
|
-
* Stop the background poller.
|
|
84
|
-
*/
|
|
85
|
-
stop(): void;
|
|
86
|
-
/**
|
|
87
|
-
* Check if poller is currently running.
|
|
88
|
-
*/
|
|
89
|
-
isRunning(): boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Get observations for all active tasks.
|
|
92
|
-
* This is a read-only snapshot of current state.
|
|
93
|
-
*/
|
|
94
|
-
getObservations(): TaskObservation[];
|
|
95
|
-
/**
|
|
96
|
-
* Get observation for a specific task.
|
|
97
|
-
*/
|
|
98
|
-
getTaskObservation(taskId: string): TaskObservation | null;
|
|
99
|
-
/**
|
|
100
|
-
* Perform a single poll cycle.
|
|
101
|
-
* Updates in-memory progress only - NO .hive writes.
|
|
102
|
-
*/
|
|
103
|
-
poll(): Promise<void>;
|
|
104
|
-
/**
|
|
105
|
-
* Poll a single task and update its progress.
|
|
106
|
-
* READ-ONLY: Only updates in-memory store, never writes .hive.
|
|
107
|
-
*/
|
|
108
|
-
private pollTask;
|
|
109
|
-
/**
|
|
110
|
-
* Build an observation from task and polling state.
|
|
111
|
-
*/
|
|
112
|
-
private buildObservation;
|
|
113
|
-
/**
|
|
114
|
-
* Adjust polling interval based on activity patterns.
|
|
115
|
-
* Uses exponential backoff when tasks are stable.
|
|
116
|
-
*/
|
|
117
|
-
private adjustPollingInterval;
|
|
118
|
-
/**
|
|
119
|
-
* Clean up polling state for a task.
|
|
120
|
-
* Call when task reaches terminal state.
|
|
121
|
-
*/
|
|
122
|
-
cleanupTask(taskId: string): void;
|
|
123
|
-
/**
|
|
124
|
-
* Clear all state (for testing or shutdown).
|
|
125
|
-
*/
|
|
126
|
-
clear(): void;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Create a new BackgroundPoller instance.
|
|
130
|
-
*/
|
|
131
|
-
export declare function createPoller(store: BackgroundTaskStore, client: OpencodeClient, config?: PollerConfig, handlers?: PollerHandlers): BackgroundPoller;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* In-memory store for background task records.
|
|
3
|
-
*
|
|
4
|
-
* Provides:
|
|
5
|
-
* - CRUD operations for task records
|
|
6
|
-
* - Idempotency key lookups
|
|
7
|
-
* - State machine enforcement
|
|
8
|
-
* - Query methods for task filtering
|
|
9
|
-
*/
|
|
10
|
-
import { BackgroundTaskRecord, BackgroundTaskStatus, BackgroundTaskProgress } from './types.js';
|
|
11
|
-
/**
|
|
12
|
-
* In-memory store for background tasks.
|
|
13
|
-
* Thread-safe for single-process Node.js (no concurrent access issues).
|
|
14
|
-
*/
|
|
15
|
-
export declare class BackgroundTaskStore {
|
|
16
|
-
private tasks;
|
|
17
|
-
private idempotencyIndex;
|
|
18
|
-
/**
|
|
19
|
-
* Create a new task record.
|
|
20
|
-
*
|
|
21
|
-
* @param options - Task creation options
|
|
22
|
-
* @returns The created task record
|
|
23
|
-
* @throws If idempotencyKey already exists (use getByIdempotencyKey first)
|
|
24
|
-
*/
|
|
25
|
-
create(options: {
|
|
26
|
-
agent: string;
|
|
27
|
-
description: string;
|
|
28
|
-
sessionId: string;
|
|
29
|
-
idempotencyKey?: string;
|
|
30
|
-
parentSessionId?: string;
|
|
31
|
-
parentMessageId?: string;
|
|
32
|
-
parentAgent?: string;
|
|
33
|
-
notifyParent?: boolean;
|
|
34
|
-
hiveFeature?: string;
|
|
35
|
-
hiveTaskFolder?: string;
|
|
36
|
-
workdir?: string;
|
|
37
|
-
}): BackgroundTaskRecord;
|
|
38
|
-
/**
|
|
39
|
-
* Get a task by ID.
|
|
40
|
-
*/
|
|
41
|
-
get(taskId: string): BackgroundTaskRecord | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Get a task by idempotency key.
|
|
44
|
-
*/
|
|
45
|
-
getByIdempotencyKey(key: string): BackgroundTaskRecord | undefined;
|
|
46
|
-
/**
|
|
47
|
-
* Get a task by Hive feature and task folder.
|
|
48
|
-
*/
|
|
49
|
-
getByHiveTask(feature: string, taskFolder: string): BackgroundTaskRecord | undefined;
|
|
50
|
-
/**
|
|
51
|
-
* Update task status with state machine enforcement.
|
|
52
|
-
*
|
|
53
|
-
* @param taskId - Task ID to update
|
|
54
|
-
* @param newStatus - New status
|
|
55
|
-
* @param updates - Additional field updates
|
|
56
|
-
* @returns Updated task record
|
|
57
|
-
* @throws If transition is invalid
|
|
58
|
-
*/
|
|
59
|
-
updateStatus(taskId: string, newStatus: BackgroundTaskStatus, updates?: Partial<Pick<BackgroundTaskRecord, 'errorMessage' | 'progress'>>): BackgroundTaskRecord;
|
|
60
|
-
/**
|
|
61
|
-
* Update task progress without changing status.
|
|
62
|
-
*/
|
|
63
|
-
updateProgress(taskId: string, progress: Partial<BackgroundTaskProgress>): BackgroundTaskRecord;
|
|
64
|
-
/**
|
|
65
|
-
* Delete a task.
|
|
66
|
-
*/
|
|
67
|
-
delete(taskId: string): boolean;
|
|
68
|
-
/**
|
|
69
|
-
* List all tasks, optionally filtered.
|
|
70
|
-
*/
|
|
71
|
-
list(filter?: {
|
|
72
|
-
status?: BackgroundTaskStatus | BackgroundTaskStatus[];
|
|
73
|
-
parentSessionId?: string;
|
|
74
|
-
hiveFeature?: string;
|
|
75
|
-
}): BackgroundTaskRecord[];
|
|
76
|
-
/**
|
|
77
|
-
* Get all active (non-terminal) tasks.
|
|
78
|
-
*/
|
|
79
|
-
getActive(): BackgroundTaskRecord[];
|
|
80
|
-
/**
|
|
81
|
-
* Get task count by status.
|
|
82
|
-
*/
|
|
83
|
-
countByStatus(): Record<BackgroundTaskStatus, number>;
|
|
84
|
-
/**
|
|
85
|
-
* Clear all tasks (for testing).
|
|
86
|
-
*/
|
|
87
|
-
clear(): void;
|
|
88
|
-
/**
|
|
89
|
-
* Get total task count.
|
|
90
|
-
*/
|
|
91
|
-
get size(): number;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Get or create the global store instance.
|
|
95
|
-
*/
|
|
96
|
-
export declare function getStore(): BackgroundTaskStore;
|
|
97
|
-
/**
|
|
98
|
-
* Reset the global store (for testing).
|
|
99
|
-
*/
|
|
100
|
-
export declare function resetStore(): void;
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Background tasking types for Hive worker execution.
|
|
3
|
-
*
|
|
4
|
-
* This module defines the core types for background task management,
|
|
5
|
-
* state machine transitions, and integration with Hive task lifecycle.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Background task status states.
|
|
9
|
-
*
|
|
10
|
-
* State machine:
|
|
11
|
-
* spawned -> pending -> running -> completed/error/cancelled
|
|
12
|
-
* -> blocked/failed (Hive-specific)
|
|
13
|
-
*
|
|
14
|
-
* - spawned: Task created, session not yet started
|
|
15
|
-
* - pending: Waiting for concurrency slot
|
|
16
|
-
* - running: Session active, work in progress
|
|
17
|
-
* - completed: Session idle, work finished successfully
|
|
18
|
-
* - error: Session errored or failed to start
|
|
19
|
-
* - cancelled: Explicitly cancelled by user/system
|
|
20
|
-
* - blocked: Worker reported blocker (Hive protocol)
|
|
21
|
-
* - failed: Worker reported failure (Hive protocol)
|
|
22
|
-
*/
|
|
23
|
-
export type BackgroundTaskStatus = 'spawned' | 'pending' | 'running' | 'completed' | 'error' | 'cancelled' | 'blocked' | 'failed';
|
|
24
|
-
/**
|
|
25
|
-
* Core background task record stored in memory.
|
|
26
|
-
*/
|
|
27
|
-
export interface BackgroundTaskRecord {
|
|
28
|
-
/** Unique task ID (generated or user-provided) */
|
|
29
|
-
taskId: string;
|
|
30
|
-
/** OpenCode session ID for this task */
|
|
31
|
-
sessionId: string;
|
|
32
|
-
/** Agent type handling this task */
|
|
33
|
-
agent: string;
|
|
34
|
-
/** Human-readable description */
|
|
35
|
-
description: string;
|
|
36
|
-
/** Current status */
|
|
37
|
-
status: BackgroundTaskStatus;
|
|
38
|
-
/** Provider identity for multi-provider support */
|
|
39
|
-
provider: 'hive';
|
|
40
|
-
/** Idempotency key for safe retries */
|
|
41
|
-
idempotencyKey?: string;
|
|
42
|
-
/** ISO timestamp when task was created */
|
|
43
|
-
createdAt: string;
|
|
44
|
-
/** ISO timestamp when task started running */
|
|
45
|
-
startedAt?: string;
|
|
46
|
-
/** ISO timestamp when task completed/failed/cancelled */
|
|
47
|
-
completedAt?: string;
|
|
48
|
-
/** ISO timestamp of last activity */
|
|
49
|
-
lastActiveAt?: string;
|
|
50
|
-
/** Parent session ID (orchestrator session) */
|
|
51
|
-
parentSessionId?: string;
|
|
52
|
-
/** Parent message ID */
|
|
53
|
-
parentMessageId?: string;
|
|
54
|
-
/** Parent agent name (used for completion notifications) */
|
|
55
|
-
parentAgent?: string;
|
|
56
|
-
/** Whether to notify the parent session when this task reaches terminal state */
|
|
57
|
-
notifyParent?: boolean;
|
|
58
|
-
/** Hive feature name (if Hive-linked) */
|
|
59
|
-
hiveFeature?: string;
|
|
60
|
-
/** Hive task folder (if Hive-linked) */
|
|
61
|
-
hiveTaskFolder?: string;
|
|
62
|
-
/** Working directory for task execution */
|
|
63
|
-
workdir?: string;
|
|
64
|
-
/** Error message if status is error */
|
|
65
|
-
errorMessage?: string;
|
|
66
|
-
/** Progress tracking */
|
|
67
|
-
progress?: BackgroundTaskProgress;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Progress tracking for a background task.
|
|
71
|
-
*/
|
|
72
|
-
export interface BackgroundTaskProgress {
|
|
73
|
-
/** Number of tool calls made */
|
|
74
|
-
toolCalls?: number;
|
|
75
|
-
/** Last tool used */
|
|
76
|
-
lastTool?: string;
|
|
77
|
-
/** Last message content (truncated) */
|
|
78
|
-
lastMessage?: string;
|
|
79
|
-
/** ISO timestamp of last message */
|
|
80
|
-
lastMessageAt?: string;
|
|
81
|
-
/** Number of messages in session */
|
|
82
|
-
messageCount?: number;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Options for spawning a new background task.
|
|
86
|
-
*/
|
|
87
|
-
export interface SpawnOptions {
|
|
88
|
-
/** Agent type to use */
|
|
89
|
-
agent: string;
|
|
90
|
-
/** Task prompt/instructions */
|
|
91
|
-
prompt: string;
|
|
92
|
-
/** Human-readable description */
|
|
93
|
-
description: string;
|
|
94
|
-
/** Idempotency key for safe retries */
|
|
95
|
-
idempotencyKey?: string;
|
|
96
|
-
/** Working directory for task execution */
|
|
97
|
-
workdir?: string;
|
|
98
|
-
/** Parent session ID (orchestrator session) */
|
|
99
|
-
parentSessionId?: string;
|
|
100
|
-
/** Parent message ID */
|
|
101
|
-
parentMessageId?: string;
|
|
102
|
-
/** Parent agent name (used for completion notifications) */
|
|
103
|
-
parentAgent?: string;
|
|
104
|
-
/** Whether to notify parent session on terminal state (default: true for sync=false) */
|
|
105
|
-
notifyParent?: boolean;
|
|
106
|
-
/** Hive feature name (if Hive-linked) */
|
|
107
|
-
hiveFeature?: string;
|
|
108
|
-
/** Hive task folder (if Hive-linked) */
|
|
109
|
-
hiveTaskFolder?: string;
|
|
110
|
-
/** Whether to wait for completion (sync mode) */
|
|
111
|
-
sync?: boolean;
|
|
112
|
-
/**
|
|
113
|
-
* Hive attempt number for this run.
|
|
114
|
-
* Used only for Hive-linked tasks to persist workerSession.attempt correctly.
|
|
115
|
-
*/
|
|
116
|
-
attempt?: number;
|
|
117
|
-
/**
|
|
118
|
-
* Model variant key to apply to the background task prompt.
|
|
119
|
-
* This is passed to OpenCode's session.prompt body and merged with
|
|
120
|
-
* model.variants[variantKey] into provider options.
|
|
121
|
-
*/
|
|
122
|
-
variant?: string;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Result of a spawn operation.
|
|
126
|
-
*/
|
|
127
|
-
export interface SpawnResult {
|
|
128
|
-
/** The created/existing task record */
|
|
129
|
-
task: BackgroundTaskRecord;
|
|
130
|
-
/** Whether an existing task was returned (idempotency hit) */
|
|
131
|
-
wasExisting: boolean;
|
|
132
|
-
/** Error message if spawn failed */
|
|
133
|
-
error?: string;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Valid state transitions for the background task state machine.
|
|
137
|
-
*/
|
|
138
|
-
export declare const VALID_TRANSITIONS: Record<BackgroundTaskStatus, BackgroundTaskStatus[]>;
|
|
139
|
-
/**
|
|
140
|
-
* Check if a status is terminal (no further transitions possible).
|
|
141
|
-
*/
|
|
142
|
-
export declare function isTerminalStatus(status: BackgroundTaskStatus): boolean;
|
|
143
|
-
/**
|
|
144
|
-
* Check if a transition is valid.
|
|
145
|
-
*/
|
|
146
|
-
export declare function isValidTransition(from: BackgroundTaskStatus, to: BackgroundTaskStatus): boolean;
|
|
147
|
-
/**
|
|
148
|
-
* OpenCode client interface (minimal subset needed for background tasks).
|
|
149
|
-
* This allows stubbing in tests without importing the full SDK.
|
|
150
|
-
*/
|
|
151
|
-
export interface OpencodeClient {
|
|
152
|
-
session: {
|
|
153
|
-
create(options: {
|
|
154
|
-
body: {
|
|
155
|
-
title?: string;
|
|
156
|
-
parentID?: string;
|
|
157
|
-
};
|
|
158
|
-
}): Promise<{
|
|
159
|
-
data?: {
|
|
160
|
-
id?: string;
|
|
161
|
-
};
|
|
162
|
-
}>;
|
|
163
|
-
prompt(options: {
|
|
164
|
-
path: {
|
|
165
|
-
id: string;
|
|
166
|
-
};
|
|
167
|
-
body: {
|
|
168
|
-
agent?: string;
|
|
169
|
-
parts: Array<{
|
|
170
|
-
type: string;
|
|
171
|
-
text: string;
|
|
172
|
-
}>;
|
|
173
|
-
tools?: Record<string, boolean>;
|
|
174
|
-
variant?: string;
|
|
175
|
-
};
|
|
176
|
-
}): Promise<{
|
|
177
|
-
data?: unknown;
|
|
178
|
-
}>;
|
|
179
|
-
get(options: {
|
|
180
|
-
path: {
|
|
181
|
-
id: string;
|
|
182
|
-
};
|
|
183
|
-
}): Promise<{
|
|
184
|
-
data?: {
|
|
185
|
-
id?: string;
|
|
186
|
-
status?: string;
|
|
187
|
-
parentID?: string;
|
|
188
|
-
};
|
|
189
|
-
}>;
|
|
190
|
-
messages(options: {
|
|
191
|
-
path: {
|
|
192
|
-
id: string;
|
|
193
|
-
};
|
|
194
|
-
}): Promise<{
|
|
195
|
-
data?: unknown[];
|
|
196
|
-
}>;
|
|
197
|
-
abort(options: {
|
|
198
|
-
path: {
|
|
199
|
-
id: string;
|
|
200
|
-
};
|
|
201
|
-
}): Promise<void>;
|
|
202
|
-
/** Get status of all sessions (optional - may not exist on all clients) */
|
|
203
|
-
status?(): Promise<{
|
|
204
|
-
data?: Record<string, {
|
|
205
|
-
type: string;
|
|
206
|
-
}>;
|
|
207
|
-
}>;
|
|
208
|
-
};
|
|
209
|
-
app: {
|
|
210
|
-
agents(options: Record<string, unknown>): Promise<{
|
|
211
|
-
data?: Array<{
|
|
212
|
-
name: string;
|
|
213
|
-
description?: string;
|
|
214
|
-
mode?: string;
|
|
215
|
-
}>;
|
|
216
|
-
}>;
|
|
217
|
-
log(options: {
|
|
218
|
-
body: {
|
|
219
|
-
service: string;
|
|
220
|
-
level: string;
|
|
221
|
-
message: string;
|
|
222
|
-
};
|
|
223
|
-
}): Promise<void>;
|
|
224
|
-
};
|
|
225
|
-
config: {
|
|
226
|
-
get(): Promise<{
|
|
227
|
-
data?: Record<string, unknown>;
|
|
228
|
-
}>;
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Agent info from OpenCode registry.
|
|
233
|
-
*/
|
|
234
|
-
export interface AgentInfo {
|
|
235
|
-
name: string;
|
|
236
|
-
description?: string;
|
|
237
|
-
mode?: string;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Result of agent validation.
|
|
241
|
-
*/
|
|
242
|
-
export interface AgentValidationResult {
|
|
243
|
-
valid: boolean;
|
|
244
|
-
error?: string;
|
|
245
|
-
agent?: AgentInfo;
|
|
246
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Background task tools for Hive worker delegation.
|
|
3
|
-
*
|
|
4
|
-
* Provides user-facing tools for spawning, monitoring, and cancelling
|
|
5
|
-
* background tasks that execute in separate OpenCode sessions.
|
|
6
|
-
*
|
|
7
|
-
* Tools:
|
|
8
|
-
* - hive_background_task: Spawn a new background task
|
|
9
|
-
* - hive_background_output: Get output from a running/completed task
|
|
10
|
-
* - hive_background_cancel: Cancel running task(s)
|
|
11
|
-
*/
|
|
12
|
-
import { type ToolDefinition } from '@opencode-ai/plugin';
|
|
13
|
-
import { type ConfigService } from 'hive-core';
|
|
14
|
-
import { BackgroundManager, type OpencodeClient } from '../background/index.js';
|
|
15
|
-
/**
|
|
16
|
-
* Options for creating background tools.
|
|
17
|
-
*/
|
|
18
|
-
export interface BackgroundToolsOptions {
|
|
19
|
-
/** The BackgroundManager instance for task lifecycle */
|
|
20
|
-
manager: BackgroundManager;
|
|
21
|
-
/** OpenCode client for session operations */
|
|
22
|
-
client: OpencodeClient;
|
|
23
|
-
/** Optional ConfigService for resolving per-agent variants */
|
|
24
|
-
configService?: ConfigService;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Create background task tools.
|
|
28
|
-
*
|
|
29
|
-
* @param manager - The BackgroundManager instance for task lifecycle
|
|
30
|
-
* @param client - OpenCode client for session operations
|
|
31
|
-
* @param configService - Optional ConfigService for resolving per-agent variants
|
|
32
|
-
*/
|
|
33
|
-
export declare function createBackgroundTools(manager: BackgroundManager, client: OpencodeClient, configService?: ConfigService): {
|
|
34
|
-
hive_background_task: ToolDefinition;
|
|
35
|
-
hive_background_output: ToolDefinition;
|
|
36
|
-
hive_background_cancel: ToolDefinition;
|
|
37
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: onboarding
|
|
3
|
-
description: "Ask about workflow preferences and store them in .hive/contexts/preferences.md before proceeding."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Onboarding Preferences
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
Gather workflow preferences so the assistant can match the user's desired working style.
|
|
11
|
-
|
|
12
|
-
## When to Ask
|
|
13
|
-
|
|
14
|
-
- **Immediately when the skill is loaded**, before any other work.
|
|
15
|
-
- If `.hive/contexts/preferences.md` does not exist, start onboarding.
|
|
16
|
-
- If later a decision is ambiguous and preferences are missing, ask again.
|
|
17
|
-
|
|
18
|
-
## Preference Storage
|
|
19
|
-
|
|
20
|
-
Use `hive_context_write` to write `.hive/contexts/preferences.md` with this exact template:
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
# Preferences
|
|
24
|
-
|
|
25
|
-
## Exploration Style
|
|
26
|
-
sync
|
|
27
|
-
|
|
28
|
-
## Research Depth
|
|
29
|
-
medium
|
|
30
|
-
|
|
31
|
-
## Confirmation Level
|
|
32
|
-
standard
|
|
33
|
-
|
|
34
|
-
## Commit Behavior
|
|
35
|
-
ask-before-commit
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## If Preferences Already Exist
|
|
39
|
-
|
|
40
|
-
Follow the same pattern used in `packages/vscode-hive/src/tools/plan.ts`:
|
|
41
|
-
|
|
42
|
-
1. Use `contextService.list(feature)` to detect existing contexts.
|
|
43
|
-
2. Ask **"Preferences already exist. Keep or overwrite?"** using the `question()` tool.
|
|
44
|
-
3. If keep → continue using existing preferences.
|
|
45
|
-
4. If overwrite → collect new answers and write them with `hive_context_write`.
|
|
46
|
-
|
|
47
|
-
## Questions to Ask (Always use `question()`)
|
|
48
|
-
|
|
49
|
-
Ask one at a time, with the provided options. Store the answers in `.hive/contexts/preferences.md`.
|
|
50
|
-
|
|
51
|
-
1. **Exploration Style:** sync | async
|
|
52
|
-
2. **Research Depth:** shallow | medium | deep
|
|
53
|
-
3. **Confirmation Level:** minimal | standard | high
|
|
54
|
-
4. **Commit Behavior:** ask-before-commit | auto-commit | never-commit
|
|
55
|
-
|
|
56
|
-
## Requirements
|
|
57
|
-
|
|
58
|
-
- Use the `question()` tool (no plain text questions).
|
|
59
|
-
- Ask immediately when the skill loads if preferences are missing.
|
|
60
|
-
- If later a decision is ambiguous and preferences are missing, ask again.
|
|
61
|
-
- Always store answers using `hive_context_write` with the template above.
|