@doingdev/opencode-claude-manager-plugin 0.1.9 → 0.1.11
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 +26 -29
- package/dist/claude/claude-agent-sdk-adapter.js +249 -62
- package/dist/claude/delegated-can-use-tool.d.ts +7 -0
- package/dist/claude/delegated-can-use-tool.js +178 -0
- package/dist/index.d.ts +1 -1
- package/dist/manager/context-tracker.d.ts +33 -0
- package/dist/manager/context-tracker.js +108 -0
- package/dist/manager/git-operations.d.ts +12 -0
- package/dist/manager/git-operations.js +76 -0
- package/dist/manager/manager-orchestrator.d.ts +1 -4
- package/dist/manager/manager-orchestrator.js +37 -53
- package/dist/manager/persistent-manager.d.ts +64 -0
- package/dist/manager/persistent-manager.js +152 -0
- package/dist/manager/session-controller.d.ts +38 -0
- package/dist/manager/session-controller.js +135 -0
- package/dist/manager/task-planner.d.ts +2 -2
- package/dist/manager/task-planner.js +4 -31
- package/dist/plugin/claude-code-permission-bridge.d.ts +15 -0
- package/dist/plugin/claude-code-permission-bridge.js +184 -0
- package/dist/plugin/claude-manager.plugin.d.ts +2 -2
- package/dist/plugin/claude-manager.plugin.js +150 -192
- package/dist/plugin/service-factory.d.ts +2 -2
- package/dist/plugin/service-factory.js +12 -4
- package/dist/prompts/registry.js +42 -8
- package/dist/state/file-run-state-store.d.ts +5 -5
- package/dist/types/contracts.d.ts +68 -45
- package/dist/util/transcript-append.d.ts +7 -0
- package/dist/util/transcript-append.js +29 -0
- package/package.json +10 -10
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export interface ManagerPromptRegistry {
|
|
2
2
|
managerSystemPrompt: string;
|
|
3
|
-
|
|
3
|
+
claudeCodeSessionPrompt: string;
|
|
4
|
+
contextWarnings: {
|
|
5
|
+
moderate: string;
|
|
6
|
+
high: string;
|
|
7
|
+
critical: string;
|
|
8
|
+
};
|
|
4
9
|
}
|
|
5
10
|
export type ClaudeSettingSource = 'user' | 'project' | 'local';
|
|
6
11
|
export interface ClaudeCommandMetadata {
|
|
@@ -39,12 +44,13 @@ export interface ClaudeMetadataSnapshot {
|
|
|
39
44
|
settingsPaths: string[];
|
|
40
45
|
}
|
|
41
46
|
export interface ClaudeSessionEvent {
|
|
42
|
-
type: 'init' | 'assistant' | 'partial' | 'status' | 'system' | 'result' | 'error';
|
|
47
|
+
type: 'init' | 'assistant' | 'partial' | 'user' | 'tool_call' | 'status' | 'system' | 'result' | 'error';
|
|
43
48
|
sessionId?: string;
|
|
44
49
|
text: string;
|
|
45
50
|
turns?: number;
|
|
46
51
|
totalCostUsd?: number;
|
|
47
|
-
|
|
52
|
+
/** Present on live SDK-normalized events; omitted when compact-persisted to save space. */
|
|
53
|
+
rawType?: string;
|
|
48
54
|
}
|
|
49
55
|
export interface RunClaudeSessionInput {
|
|
50
56
|
cwd: string;
|
|
@@ -68,6 +74,9 @@ export interface ClaudeSessionRunResult {
|
|
|
68
74
|
finalText: string;
|
|
69
75
|
turns?: number;
|
|
70
76
|
totalCostUsd?: number;
|
|
77
|
+
inputTokens?: number;
|
|
78
|
+
outputTokens?: number;
|
|
79
|
+
contextWindowSize?: number;
|
|
71
80
|
}
|
|
72
81
|
export interface ClaudeSessionSummary {
|
|
73
82
|
sessionId: string;
|
|
@@ -88,58 +97,72 @@ export interface ClaudeCapabilitySnapshot {
|
|
|
88
97
|
agents: ClaudeAgentMetadata[];
|
|
89
98
|
models: string[];
|
|
90
99
|
}
|
|
91
|
-
export type
|
|
92
|
-
export
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
export type ContextWarningLevel = 'ok' | 'moderate' | 'high' | 'critical';
|
|
101
|
+
export interface SessionContextSnapshot {
|
|
102
|
+
sessionId: string | null;
|
|
103
|
+
totalTurns: number;
|
|
104
|
+
totalCostUsd: number;
|
|
105
|
+
latestInputTokens: number | null;
|
|
106
|
+
latestOutputTokens: number | null;
|
|
107
|
+
contextWindowSize: number | null;
|
|
108
|
+
estimatedContextPercent: number | null;
|
|
109
|
+
warningLevel: ContextWarningLevel;
|
|
110
|
+
compactionCount: number;
|
|
111
|
+
}
|
|
112
|
+
export interface GitDiffResult {
|
|
113
|
+
hasDiff: boolean;
|
|
114
|
+
diffText: string;
|
|
115
|
+
stats: {
|
|
116
|
+
filesChanged: number;
|
|
117
|
+
insertions: number;
|
|
118
|
+
deletions: number;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export interface GitOperationResult {
|
|
122
|
+
success: boolean;
|
|
123
|
+
output: string;
|
|
124
|
+
error?: string;
|
|
104
125
|
}
|
|
105
|
-
export interface
|
|
106
|
-
|
|
107
|
-
title: string;
|
|
108
|
-
prompt: string;
|
|
109
|
-
status: ManagerRunStatus;
|
|
126
|
+
export interface ActiveSessionState {
|
|
127
|
+
sessionId: string;
|
|
110
128
|
cwd: string;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
129
|
+
startedAt: string;
|
|
130
|
+
totalTurns: number;
|
|
131
|
+
totalCostUsd: number;
|
|
132
|
+
estimatedContextPercent: number | null;
|
|
133
|
+
contextWindowSize: number | null;
|
|
134
|
+
latestInputTokens: number | null;
|
|
135
|
+
}
|
|
136
|
+
export type PersistentRunStatus = 'running' | 'completed' | 'failed';
|
|
137
|
+
export interface PersistentRunMessageRecord {
|
|
138
|
+
timestamp: string;
|
|
139
|
+
direction: 'sent' | 'received';
|
|
140
|
+
text: string;
|
|
115
141
|
turns?: number;
|
|
116
142
|
totalCostUsd?: number;
|
|
117
|
-
|
|
118
|
-
|
|
143
|
+
inputTokens?: number;
|
|
144
|
+
outputTokens?: number;
|
|
145
|
+
}
|
|
146
|
+
export interface PersistentRunActionRecord {
|
|
147
|
+
timestamp: string;
|
|
148
|
+
type: 'git_diff' | 'git_commit' | 'git_reset' | 'compact' | 'clear';
|
|
149
|
+
result: string;
|
|
119
150
|
}
|
|
120
|
-
export interface
|
|
151
|
+
export interface PersistentRunRecord {
|
|
121
152
|
id: string;
|
|
122
153
|
cwd: string;
|
|
123
154
|
task: string;
|
|
124
|
-
|
|
125
|
-
useWorktrees: boolean;
|
|
126
|
-
includeProjectSettings: boolean;
|
|
127
|
-
status: ManagerRunStatus;
|
|
155
|
+
status: PersistentRunStatus;
|
|
128
156
|
createdAt: string;
|
|
129
157
|
updatedAt: string;
|
|
130
|
-
|
|
131
|
-
|
|
158
|
+
sessionId: string | null;
|
|
159
|
+
sessionHistory: string[];
|
|
160
|
+
messages: PersistentRunMessageRecord[];
|
|
161
|
+
actions: PersistentRunActionRecord[];
|
|
162
|
+
commits: string[];
|
|
163
|
+
context: SessionContextSnapshot;
|
|
132
164
|
finalSummary?: string;
|
|
133
165
|
}
|
|
134
|
-
export interface
|
|
135
|
-
|
|
136
|
-
task: string;
|
|
137
|
-
mode?: ManagerRunMode;
|
|
138
|
-
maxSubagents?: number;
|
|
139
|
-
useWorktrees?: boolean;
|
|
140
|
-
includeProjectSettings?: boolean;
|
|
141
|
-
model?: string;
|
|
142
|
-
}
|
|
143
|
-
export interface ManagerRunResult {
|
|
144
|
-
run: ManagerRunRecord;
|
|
166
|
+
export interface PersistentRunResult {
|
|
167
|
+
run: PersistentRunRecord;
|
|
145
168
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ClaudeSessionEvent } from '../types/contracts.js';
|
|
2
|
+
export declare function stripTrailingPartials(events: ClaudeSessionEvent[]): ClaudeSessionEvent[];
|
|
3
|
+
/**
|
|
4
|
+
* Append transcript events for run-state persistence: at most one trailing
|
|
5
|
+
* `partial`, dropped whenever a non-partial event is appended.
|
|
6
|
+
*/
|
|
7
|
+
export declare function appendTranscriptEvents(events: ClaudeSessionEvent[], incoming: ClaudeSessionEvent[]): ClaudeSessionEvent[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function stripTrailingPartials(events) {
|
|
2
|
+
let end = events.length;
|
|
3
|
+
while (end > 0 && events[end - 1].type === 'partial') {
|
|
4
|
+
end -= 1;
|
|
5
|
+
}
|
|
6
|
+
return end === events.length ? events : events.slice(0, end);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Append transcript events for run-state persistence: at most one trailing
|
|
10
|
+
* `partial`, dropped whenever a non-partial event is appended.
|
|
11
|
+
*/
|
|
12
|
+
export function appendTranscriptEvents(events, incoming) {
|
|
13
|
+
let next = events;
|
|
14
|
+
for (const event of incoming) {
|
|
15
|
+
if (event.type === 'partial') {
|
|
16
|
+
if (next.length > 0 && next[next.length - 1].type === 'partial') {
|
|
17
|
+
next = [...next.slice(0, -1), event];
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
next = [...next, event];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
next = stripTrailingPartials(next);
|
|
25
|
+
next = [...next, event];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return next;
|
|
29
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doingdev/opencode-claude-manager-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "OpenCode plugin that orchestrates Claude Code sessions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"opencode",
|
|
@@ -25,14 +25,6 @@
|
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
|
-
"scripts": {
|
|
29
|
-
"build": "tsc -p tsconfig.build.json",
|
|
30
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
31
|
-
"lint": "eslint .",
|
|
32
|
-
"format": "prettier --write .",
|
|
33
|
-
"test": "vitest run",
|
|
34
|
-
"release": "npm run build && npm version patch && npm publish"
|
|
35
|
-
},
|
|
36
28
|
"engines": {
|
|
37
29
|
"node": ">=22.0.0"
|
|
38
30
|
},
|
|
@@ -52,5 +44,13 @@
|
|
|
52
44
|
"typescript": "^5.9.3",
|
|
53
45
|
"typescript-eslint": "^8.57.1",
|
|
54
46
|
"vitest": "^4.1.0"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsc -p tsconfig.build.json",
|
|
50
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
51
|
+
"lint": "eslint .",
|
|
52
|
+
"format": "prettier --write .",
|
|
53
|
+
"test": "vitest run",
|
|
54
|
+
"release": "pnpm run build && pnpm version patch && pnpm publish"
|
|
55
55
|
}
|
|
56
|
-
}
|
|
56
|
+
}
|