@agentuity/opencode 1.0.19 → 1.0.21
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/expert-backend.d.ts +1 -1
- package/dist/agents/expert-backend.d.ts.map +1 -1
- package/dist/agents/expert-backend.js +0 -17
- package/dist/agents/expert-backend.js.map +1 -1
- package/dist/agents/expert.d.ts +1 -1
- package/dist/agents/expert.d.ts.map +1 -1
- package/dist/agents/expert.js +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +0 -2
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/lead.d.ts +1 -1
- package/dist/agents/lead.d.ts.map +1 -1
- package/dist/agents/lead.js +25 -145
- package/dist/agents/lead.js.map +1 -1
- package/dist/agents/scout.d.ts +1 -1
- package/dist/agents/scout.d.ts.map +1 -1
- package/dist/agents/scout.js +16 -0
- package/dist/agents/scout.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +1 -33
- package/dist/config/loader.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/plugin/hooks/cadence.d.ts +1 -2
- package/dist/plugin/hooks/cadence.d.ts.map +1 -1
- package/dist/plugin/hooks/cadence.js +7 -33
- package/dist/plugin/hooks/cadence.js.map +1 -1
- package/dist/plugin/hooks/compaction-utils.d.ts.map +1 -1
- package/dist/plugin/hooks/compaction-utils.js +6 -13
- package/dist/plugin/hooks/compaction-utils.js.map +1 -1
- package/dist/plugin/hooks/session-memory.d.ts +1 -2
- package/dist/plugin/hooks/session-memory.d.ts.map +1 -1
- package/dist/plugin/hooks/session-memory.js +6 -29
- package/dist/plugin/hooks/session-memory.js.map +1 -1
- package/dist/plugin/plugin.d.ts.map +1 -1
- package/dist/plugin/plugin.js +8 -222
- package/dist/plugin/plugin.js.map +1 -1
- package/dist/sqlite/types.d.ts +0 -6
- package/dist/sqlite/types.d.ts.map +1 -1
- package/dist/tmux/manager.d.ts +4 -4
- package/dist/tmux/manager.js +4 -4
- package/dist/tmux/types.d.ts +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/types.d.ts +2 -20
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -9
- package/dist/types.js.map +1 -1
- package/package.json +3 -3
- package/src/agents/expert-backend.ts +0 -17
- package/src/agents/expert.ts +1 -1
- package/src/agents/index.ts +0 -2
- package/src/agents/lead.ts +25 -145
- package/src/agents/scout.ts +16 -0
- package/src/config/loader.ts +1 -45
- package/src/index.ts +0 -1
- package/src/plugin/hooks/cadence.ts +6 -39
- package/src/plugin/hooks/compaction-utils.ts +6 -12
- package/src/plugin/hooks/session-memory.ts +5 -35
- package/src/plugin/plugin.ts +7 -257
- package/src/sqlite/types.ts +0 -2
- package/src/tmux/manager.ts +4 -4
- package/src/tmux/types.ts +2 -2
- package/src/tools/index.ts +2 -9
- package/src/types.ts +0 -13
- package/dist/agents/monitor.d.ts +0 -4
- package/dist/agents/monitor.d.ts.map +0 -1
- package/dist/agents/monitor.js +0 -159
- package/dist/agents/monitor.js.map +0 -1
- package/dist/background/concurrency.d.ts +0 -36
- package/dist/background/concurrency.d.ts.map +0 -1
- package/dist/background/concurrency.js +0 -92
- package/dist/background/concurrency.js.map +0 -1
- package/dist/background/index.d.ts +0 -5
- package/dist/background/index.d.ts.map +0 -1
- package/dist/background/index.js +0 -4
- package/dist/background/index.js.map +0 -1
- package/dist/background/manager.d.ts +0 -123
- package/dist/background/manager.d.ts.map +0 -1
- package/dist/background/manager.js +0 -1075
- package/dist/background/manager.js.map +0 -1
- package/dist/background/types.d.ts +0 -90
- package/dist/background/types.d.ts.map +0 -1
- package/dist/background/types.js +0 -2
- package/dist/background/types.js.map +0 -1
- package/dist/tools/background.d.ts +0 -67
- package/dist/tools/background.d.ts.map +0 -1
- package/dist/tools/background.js +0 -95
- package/dist/tools/background.js.map +0 -1
- package/src/agents/monitor.ts +0 -161
- package/src/background/concurrency.ts +0 -116
- package/src/background/index.ts +0 -4
- package/src/background/manager.ts +0 -1215
- package/src/background/types.ts +0 -82
- package/src/tools/background.ts +0 -179
package/src/background/types.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
// Task status and interfaces
|
|
2
|
-
export type BackgroundTaskStatus = 'pending' | 'running' | 'completed' | 'error' | 'cancelled';
|
|
3
|
-
|
|
4
|
-
export interface TaskProgress {
|
|
5
|
-
toolCalls: number;
|
|
6
|
-
lastTool?: string;
|
|
7
|
-
lastUpdate: Date;
|
|
8
|
-
lastMessage?: string;
|
|
9
|
-
lastMessageAt?: Date;
|
|
10
|
-
/** Number of tool calls currently in-flight (pending/running state) */
|
|
11
|
-
activeToolCallsInFlight: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface BackgroundTask {
|
|
15
|
-
id: string; // Format: bg_xxxxx
|
|
16
|
-
sessionId?: string; // OpenCode session ID (set when running)
|
|
17
|
-
parentSessionId: string; // Parent session that launched this
|
|
18
|
-
parentMessageId?: string;
|
|
19
|
-
description: string;
|
|
20
|
-
prompt: string;
|
|
21
|
-
agent: string; // Agent name
|
|
22
|
-
status: BackgroundTaskStatus;
|
|
23
|
-
queuedAt?: Date;
|
|
24
|
-
startedAt?: Date;
|
|
25
|
-
completedAt?: Date;
|
|
26
|
-
result?: string;
|
|
27
|
-
error?: string;
|
|
28
|
-
progress?: TaskProgress;
|
|
29
|
-
concurrencyKey?: string; // Active concurrency slot key
|
|
30
|
-
concurrencyGroup?: string; // Persistent key for re-acquiring on resume
|
|
31
|
-
notifiedStatuses?: Set<BackgroundTaskStatus>; // Tracks statuses already notified to prevent duplicates
|
|
32
|
-
isMonitor?: boolean; // True if this task is an auto-launched Monitor agent
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface LaunchInput {
|
|
36
|
-
description: string;
|
|
37
|
-
prompt: string;
|
|
38
|
-
agent: string;
|
|
39
|
-
parentSessionId: string;
|
|
40
|
-
parentMessageId?: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface ResumeInput {
|
|
44
|
-
sessionId: string;
|
|
45
|
-
prompt: string;
|
|
46
|
-
parentSessionId: string;
|
|
47
|
-
parentMessageId?: string;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface BackgroundTaskConfig {
|
|
51
|
-
enabled: boolean;
|
|
52
|
-
defaultConcurrency: number;
|
|
53
|
-
staleTimeoutMs: number;
|
|
54
|
-
providerConcurrency?: Record<string, number>;
|
|
55
|
-
modelConcurrency?: Record<string, number>;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Result of inspecting a background task's session.
|
|
60
|
-
* Provides access to session details and messages for debugging.
|
|
61
|
-
*/
|
|
62
|
-
export interface TaskInspection {
|
|
63
|
-
taskId: string;
|
|
64
|
-
sessionId: string;
|
|
65
|
-
status: BackgroundTaskStatus;
|
|
66
|
-
/** Session details from OpenCode SDK */
|
|
67
|
-
session: unknown;
|
|
68
|
-
/** Messages from the session */
|
|
69
|
-
messages: Array<{ info: unknown; parts: unknown[] }>;
|
|
70
|
-
/** Last activity timestamp from task progress */
|
|
71
|
-
lastActivity?: string;
|
|
72
|
-
/** Total message count when available */
|
|
73
|
-
messageCount?: number;
|
|
74
|
-
/** Active tools with status when available */
|
|
75
|
-
activeTools?: Array<{ tool: string; status: string; callId: string }>;
|
|
76
|
-
/** Todo items when available */
|
|
77
|
-
todos?: Array<{ content: string; status: string; priority: string }>;
|
|
78
|
-
/** Cost summary when available */
|
|
79
|
-
costSummary?: { totalCost: number; totalTokens: number };
|
|
80
|
-
/** Count of child sessions (nested LoL) when available */
|
|
81
|
-
childSessionCount?: number;
|
|
82
|
-
}
|
package/src/tools/background.ts
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { ToolContext } from '@opencode-ai/plugin';
|
|
3
|
-
import type { AgentRole } from '../types';
|
|
4
|
-
import { AgentRoleSchema } from '../types';
|
|
5
|
-
import { agents } from '../agents';
|
|
6
|
-
import type { BackgroundManager } from '../background';
|
|
7
|
-
|
|
8
|
-
export const BackgroundTaskArgsSchema = z.object({
|
|
9
|
-
agent: AgentRoleSchema.describe('Agent role to run the task'),
|
|
10
|
-
task: z.string().describe('Task prompt to run in the background'),
|
|
11
|
-
description: z.string().optional().describe('Short description of the task'),
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export const BackgroundOutputArgsSchema = z.object({
|
|
15
|
-
task_id: z.string().describe('Background task ID'),
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export const BackgroundCancelArgsSchema = z.object({
|
|
19
|
-
task_id: z.string().describe('Background task ID'),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export type BackgroundTaskArgs = z.infer<typeof BackgroundTaskArgsSchema>;
|
|
23
|
-
export type BackgroundOutputArgs = z.infer<typeof BackgroundOutputArgsSchema>;
|
|
24
|
-
export type BackgroundCancelArgs = z.infer<typeof BackgroundCancelArgsSchema>;
|
|
25
|
-
|
|
26
|
-
export function createBackgroundTools(manager: BackgroundManager): {
|
|
27
|
-
backgroundTaskTool: {
|
|
28
|
-
name: string;
|
|
29
|
-
description: string;
|
|
30
|
-
args: typeof BackgroundTaskArgsSchema;
|
|
31
|
-
execute: (
|
|
32
|
-
args: BackgroundTaskArgs,
|
|
33
|
-
context: ToolContext
|
|
34
|
-
) => Promise<{
|
|
35
|
-
taskId: string;
|
|
36
|
-
sessionId?: string;
|
|
37
|
-
status: string;
|
|
38
|
-
message: string;
|
|
39
|
-
}>;
|
|
40
|
-
};
|
|
41
|
-
backgroundOutputTool: {
|
|
42
|
-
name: string;
|
|
43
|
-
description: string;
|
|
44
|
-
args: typeof BackgroundOutputArgsSchema;
|
|
45
|
-
execute: (args: BackgroundOutputArgs) => Promise<{
|
|
46
|
-
taskId: string;
|
|
47
|
-
sessionId?: string;
|
|
48
|
-
status: string;
|
|
49
|
-
result?: string;
|
|
50
|
-
error?: string;
|
|
51
|
-
}>;
|
|
52
|
-
};
|
|
53
|
-
backgroundCancelTool: {
|
|
54
|
-
name: string;
|
|
55
|
-
description: string;
|
|
56
|
-
args: typeof BackgroundCancelArgsSchema;
|
|
57
|
-
execute: (args: BackgroundCancelArgs) => Promise<{
|
|
58
|
-
taskId: string;
|
|
59
|
-
success: boolean;
|
|
60
|
-
message: string;
|
|
61
|
-
}>;
|
|
62
|
-
};
|
|
63
|
-
} {
|
|
64
|
-
const backgroundTaskTool = {
|
|
65
|
-
name: 'agentuity_background_task',
|
|
66
|
-
description: 'Launch a task to run in the background.',
|
|
67
|
-
args: BackgroundTaskArgsSchema,
|
|
68
|
-
async execute(
|
|
69
|
-
args: BackgroundTaskArgs,
|
|
70
|
-
context: ToolContext
|
|
71
|
-
): Promise<{
|
|
72
|
-
taskId: string;
|
|
73
|
-
sessionId?: string;
|
|
74
|
-
status: string;
|
|
75
|
-
message: string;
|
|
76
|
-
}> {
|
|
77
|
-
const agentName = resolveAgentName(args.agent);
|
|
78
|
-
const task = await manager.launch({
|
|
79
|
-
description: args.description ?? args.task,
|
|
80
|
-
prompt: args.task,
|
|
81
|
-
agent: agentName,
|
|
82
|
-
parentSessionId: context.sessionID,
|
|
83
|
-
parentMessageId: context.messageID,
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
return {
|
|
87
|
-
taskId: task.id,
|
|
88
|
-
sessionId: task.sessionId,
|
|
89
|
-
status: task.status,
|
|
90
|
-
message:
|
|
91
|
-
task.status === 'error'
|
|
92
|
-
? (task.error ?? 'Failed to launch background task.')
|
|
93
|
-
: 'Background task launched.',
|
|
94
|
-
};
|
|
95
|
-
},
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const backgroundOutputTool = {
|
|
99
|
-
name: 'agentuity_background_output',
|
|
100
|
-
description: 'Retrieve output for a background task.',
|
|
101
|
-
args: BackgroundOutputArgsSchema,
|
|
102
|
-
async execute(args: BackgroundOutputArgs): Promise<{
|
|
103
|
-
taskId: string;
|
|
104
|
-
sessionId?: string;
|
|
105
|
-
status: string;
|
|
106
|
-
result?: string;
|
|
107
|
-
error?: string;
|
|
108
|
-
progress?: {
|
|
109
|
-
toolCalls: number;
|
|
110
|
-
lastTool?: string;
|
|
111
|
-
lastToolSec: number;
|
|
112
|
-
activeTools: number;
|
|
113
|
-
};
|
|
114
|
-
}> {
|
|
115
|
-
const task = manager.getTask(args.task_id);
|
|
116
|
-
if (!task) {
|
|
117
|
-
return {
|
|
118
|
-
taskId: args.task_id,
|
|
119
|
-
status: 'error',
|
|
120
|
-
error: 'Task not found.',
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Include compact progress snapshot only for active tasks.
|
|
125
|
-
// Three numbers + optional tool name — minimal context cost.
|
|
126
|
-
// lastToolSec: seconds since the last tool call event was received.
|
|
127
|
-
// 0 = active right now; >300 with activeTools=0 = genuinely stuck.
|
|
128
|
-
let progress:
|
|
129
|
-
| { toolCalls: number; lastTool?: string; lastToolSec: number; activeTools: number }
|
|
130
|
-
| undefined;
|
|
131
|
-
|
|
132
|
-
if ((task.status === 'running' || task.status === 'pending') && task.progress) {
|
|
133
|
-
const lastToolSec = Math.floor(
|
|
134
|
-
(Date.now() - task.progress.lastUpdate.getTime()) / 1000
|
|
135
|
-
);
|
|
136
|
-
progress = {
|
|
137
|
-
toolCalls: task.progress.toolCalls,
|
|
138
|
-
lastTool: task.progress.lastTool,
|
|
139
|
-
lastToolSec,
|
|
140
|
-
activeTools: task.progress.activeToolCallsInFlight,
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return {
|
|
145
|
-
taskId: task.id,
|
|
146
|
-
sessionId: task.sessionId,
|
|
147
|
-
status: task.status,
|
|
148
|
-
result: task.result,
|
|
149
|
-
error: task.error,
|
|
150
|
-
progress,
|
|
151
|
-
};
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
const backgroundCancelTool = {
|
|
156
|
-
name: 'agentuity_background_cancel',
|
|
157
|
-
description: 'Cancel a running background task.',
|
|
158
|
-
args: BackgroundCancelArgsSchema,
|
|
159
|
-
async execute(args: BackgroundCancelArgs): Promise<{
|
|
160
|
-
taskId: string;
|
|
161
|
-
success: boolean;
|
|
162
|
-
message: string;
|
|
163
|
-
}> {
|
|
164
|
-
const success = manager.cancel(args.task_id);
|
|
165
|
-
return {
|
|
166
|
-
taskId: args.task_id,
|
|
167
|
-
success,
|
|
168
|
-
message: success ? 'Background task cancelled.' : 'Unable to cancel task.',
|
|
169
|
-
};
|
|
170
|
-
},
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
return { backgroundTaskTool, backgroundOutputTool, backgroundCancelTool };
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function resolveAgentName(role: AgentRole): string {
|
|
177
|
-
const agent = agents[role];
|
|
178
|
-
return agent?.displayName ?? role;
|
|
179
|
-
}
|