@doingdev/opencode-claude-manager-plugin 0.1.65 → 0.1.66

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.
Files changed (123) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/manager/team-orchestrator.js +1 -1
  3. package/dist/plugin/agents/common.d.ts +2 -2
  4. package/dist/plugin/agents/common.js +5 -0
  5. package/dist/plugin/claude-manager.plugin.js +104 -0
  6. package/dist/plugin/inbox-ops.d.ts +50 -0
  7. package/dist/plugin/inbox-ops.js +166 -0
  8. package/dist/types/contracts.d.ts +18 -0
  9. package/package.json +1 -1
  10. package/dist/claude/session-live-tailer.d.ts +0 -51
  11. package/dist/claude/session-live-tailer.js +0 -269
  12. package/dist/manager/session-controller.d.ts +0 -41
  13. package/dist/manager/session-controller.js +0 -97
  14. package/dist/metadata/claude-metadata.service.d.ts +0 -12
  15. package/dist/metadata/claude-metadata.service.js +0 -38
  16. package/dist/metadata/repo-claude-config-reader.d.ts +0 -7
  17. package/dist/metadata/repo-claude-config-reader.js +0 -154
  18. package/dist/plugin/orchestrator.plugin.d.ts +0 -2
  19. package/dist/plugin/orchestrator.plugin.js +0 -116
  20. package/dist/providers/claude-code-wrapper.d.ts +0 -13
  21. package/dist/providers/claude-code-wrapper.js +0 -13
  22. package/dist/safety/bash-safety.d.ts +0 -21
  23. package/dist/safety/bash-safety.js +0 -62
  24. package/dist/src/claude/claude-agent-sdk-adapter.d.ts +0 -28
  25. package/dist/src/claude/claude-agent-sdk-adapter.js +0 -559
  26. package/dist/src/claude/claude-session.service.d.ts +0 -9
  27. package/dist/src/claude/claude-session.service.js +0 -15
  28. package/dist/src/claude/session-live-tailer.d.ts +0 -51
  29. package/dist/src/claude/session-live-tailer.js +0 -269
  30. package/dist/src/claude/tool-approval-manager.d.ts +0 -30
  31. package/dist/src/claude/tool-approval-manager.js +0 -279
  32. package/dist/src/index.d.ts +0 -5
  33. package/dist/src/index.js +0 -3
  34. package/dist/src/manager/context-tracker.d.ts +0 -32
  35. package/dist/src/manager/context-tracker.js +0 -103
  36. package/dist/src/manager/git-operations.d.ts +0 -18
  37. package/dist/src/manager/git-operations.js +0 -86
  38. package/dist/src/manager/persistent-manager.d.ts +0 -39
  39. package/dist/src/manager/persistent-manager.js +0 -44
  40. package/dist/src/manager/session-controller.d.ts +0 -41
  41. package/dist/src/manager/session-controller.js +0 -97
  42. package/dist/src/manager/team-orchestrator.d.ts +0 -81
  43. package/dist/src/manager/team-orchestrator.js +0 -612
  44. package/dist/src/plugin/agent-hierarchy.d.ts +0 -1
  45. package/dist/src/plugin/agent-hierarchy.js +0 -2
  46. package/dist/src/plugin/agents/browser-qa.d.ts +0 -14
  47. package/dist/src/plugin/agents/browser-qa.js +0 -31
  48. package/dist/src/plugin/agents/common.d.ts +0 -36
  49. package/dist/src/plugin/agents/common.js +0 -59
  50. package/dist/src/plugin/agents/cto.d.ts +0 -9
  51. package/dist/src/plugin/agents/cto.js +0 -39
  52. package/dist/src/plugin/agents/engineers.d.ts +0 -9
  53. package/dist/src/plugin/agents/engineers.js +0 -11
  54. package/dist/src/plugin/agents/index.d.ts +0 -5
  55. package/dist/src/plugin/agents/index.js +0 -5
  56. package/dist/src/plugin/agents/team-planner.d.ts +0 -10
  57. package/dist/src/plugin/agents/team-planner.js +0 -23
  58. package/dist/src/plugin/claude-manager.plugin.d.ts +0 -10
  59. package/dist/src/plugin/claude-manager.plugin.js +0 -950
  60. package/dist/src/plugin/service-factory.d.ts +0 -38
  61. package/dist/src/plugin/service-factory.js +0 -101
  62. package/dist/src/prompts/registry.d.ts +0 -2
  63. package/dist/src/prompts/registry.js +0 -210
  64. package/dist/src/state/file-run-state-store.d.ts +0 -14
  65. package/dist/src/state/file-run-state-store.js +0 -85
  66. package/dist/src/state/team-state-store.d.ts +0 -14
  67. package/dist/src/state/team-state-store.js +0 -88
  68. package/dist/src/state/transcript-store.d.ts +0 -15
  69. package/dist/src/state/transcript-store.js +0 -44
  70. package/dist/src/team/roster.d.ts +0 -5
  71. package/dist/src/team/roster.js +0 -40
  72. package/dist/src/types/contracts.d.ts +0 -261
  73. package/dist/src/types/contracts.js +0 -2
  74. package/dist/src/util/fs-helpers.d.ts +0 -8
  75. package/dist/src/util/fs-helpers.js +0 -21
  76. package/dist/src/util/project-context.d.ts +0 -10
  77. package/dist/src/util/project-context.js +0 -105
  78. package/dist/src/util/transcript-append.d.ts +0 -7
  79. package/dist/src/util/transcript-append.js +0 -29
  80. package/dist/state/file-run-state-store.d.ts +0 -14
  81. package/dist/state/file-run-state-store.js +0 -85
  82. package/dist/test/claude-agent-sdk-adapter.test.d.ts +0 -1
  83. package/dist/test/claude-agent-sdk-adapter.test.js +0 -707
  84. package/dist/test/claude-manager.plugin.test.d.ts +0 -1
  85. package/dist/test/claude-manager.plugin.test.js +0 -316
  86. package/dist/test/context-tracker.test.d.ts +0 -1
  87. package/dist/test/context-tracker.test.js +0 -130
  88. package/dist/test/cto-active-team.test.d.ts +0 -1
  89. package/dist/test/cto-active-team.test.js +0 -199
  90. package/dist/test/file-run-state-store.test.d.ts +0 -1
  91. package/dist/test/file-run-state-store.test.js +0 -82
  92. package/dist/test/fs-helpers.test.d.ts +0 -1
  93. package/dist/test/fs-helpers.test.js +0 -56
  94. package/dist/test/git-operations.test.d.ts +0 -1
  95. package/dist/test/git-operations.test.js +0 -133
  96. package/dist/test/persistent-manager.test.d.ts +0 -1
  97. package/dist/test/persistent-manager.test.js +0 -48
  98. package/dist/test/project-context.test.d.ts +0 -1
  99. package/dist/test/project-context.test.js +0 -92
  100. package/dist/test/prompt-registry.test.d.ts +0 -1
  101. package/dist/test/prompt-registry.test.js +0 -117
  102. package/dist/test/report-claude-event.test.d.ts +0 -1
  103. package/dist/test/report-claude-event.test.js +0 -304
  104. package/dist/test/session-controller.test.d.ts +0 -1
  105. package/dist/test/session-controller.test.js +0 -149
  106. package/dist/test/session-live-tailer.test.d.ts +0 -1
  107. package/dist/test/session-live-tailer.test.js +0 -313
  108. package/dist/test/team-orchestrator.test.d.ts +0 -1
  109. package/dist/test/team-orchestrator.test.js +0 -583
  110. package/dist/test/team-state-store.test.d.ts +0 -1
  111. package/dist/test/team-state-store.test.js +0 -54
  112. package/dist/test/tool-approval-manager.test.d.ts +0 -1
  113. package/dist/test/tool-approval-manager.test.js +0 -260
  114. package/dist/test/transcript-append.test.d.ts +0 -1
  115. package/dist/test/transcript-append.test.js +0 -37
  116. package/dist/test/transcript-store.test.d.ts +0 -1
  117. package/dist/test/transcript-store.test.js +0 -50
  118. package/dist/test/undo-propagation.test.d.ts +0 -1
  119. package/dist/test/undo-propagation.test.js +0 -837
  120. package/dist/util/project-context.d.ts +0 -10
  121. package/dist/util/project-context.js +0 -105
  122. package/dist/vitest.config.d.ts +0 -2
  123. package/dist/vitest.config.js +0 -11
@@ -1,103 +0,0 @@
1
- const DEFAULT_CONTEXT_WINDOW = 200_000;
2
- export class ContextTracker {
3
- totalTurns = 0;
4
- totalCostUsd = 0;
5
- latestInputTokens = null;
6
- latestOutputTokens = null;
7
- contextWindowSize = null;
8
- compactionCount = 0;
9
- sessionId = null;
10
- recordResult(result) {
11
- if (result.sessionId) {
12
- this.sessionId = result.sessionId;
13
- }
14
- if (result.turns !== undefined) {
15
- this.totalTurns = result.turns;
16
- }
17
- if (result.totalCostUsd !== undefined) {
18
- this.totalCostUsd = result.totalCostUsd;
19
- }
20
- if (result.inputTokens !== undefined) {
21
- // If input tokens dropped significantly, compaction likely occurred
22
- if (this.latestInputTokens !== null && result.inputTokens < this.latestInputTokens * 0.5) {
23
- this.compactionCount++;
24
- }
25
- this.latestInputTokens = result.inputTokens;
26
- }
27
- if (result.outputTokens !== undefined) {
28
- this.latestOutputTokens = result.outputTokens;
29
- }
30
- if (result.contextWindowSize !== undefined) {
31
- this.contextWindowSize = result.contextWindowSize;
32
- }
33
- }
34
- recordCompaction() {
35
- this.compactionCount++;
36
- }
37
- snapshot() {
38
- return {
39
- sessionId: this.sessionId,
40
- totalTurns: this.totalTurns,
41
- totalCostUsd: this.totalCostUsd,
42
- latestInputTokens: this.latestInputTokens,
43
- latestOutputTokens: this.latestOutputTokens,
44
- contextWindowSize: this.contextWindowSize,
45
- estimatedContextPercent: this.estimateContextPercent(),
46
- warningLevel: this.warningLevel(),
47
- compactionCount: this.compactionCount,
48
- };
49
- }
50
- warningLevel() {
51
- const percent = this.estimateContextPercent();
52
- if (percent === null) {
53
- return 'ok';
54
- }
55
- if (percent >= 85) {
56
- return 'critical';
57
- }
58
- if (percent >= 70) {
59
- return 'high';
60
- }
61
- if (percent >= 50) {
62
- return 'moderate';
63
- }
64
- return 'ok';
65
- }
66
- estimateContextPercent() {
67
- // Tier 1: Token-based (most accurate)
68
- if (this.latestInputTokens !== null) {
69
- const window = this.contextWindowSize ?? DEFAULT_CONTEXT_WINDOW;
70
- return Math.min(100, Math.round((this.latestInputTokens / window) * 100));
71
- }
72
- // Tier 2: Cost-based heuristic
73
- if (this.totalCostUsd > 0) {
74
- const estimatedTokens = this.totalCostUsd * 130_000;
75
- const window = this.contextWindowSize ?? DEFAULT_CONTEXT_WINDOW;
76
- return Math.min(100, Math.round((estimatedTokens / window) * 100));
77
- }
78
- // Tier 3: Turns-based fallback
79
- if (this.totalTurns > 0) {
80
- const estimatedTokens = this.totalTurns * 6_000;
81
- const window = this.contextWindowSize ?? DEFAULT_CONTEXT_WINDOW;
82
- return Math.min(100, Math.round((estimatedTokens / window) * 100));
83
- }
84
- return null;
85
- }
86
- reset() {
87
- this.totalTurns = 0;
88
- this.totalCostUsd = 0;
89
- this.latestInputTokens = null;
90
- this.latestOutputTokens = null;
91
- this.contextWindowSize = null;
92
- this.compactionCount = 0;
93
- this.sessionId = null;
94
- }
95
- /** Restore from persisted active session state. */
96
- restore(state) {
97
- this.sessionId = state.sessionId;
98
- this.totalTurns = state.totalTurns;
99
- this.totalCostUsd = state.totalCostUsd;
100
- this.contextWindowSize = state.contextWindowSize;
101
- this.latestInputTokens = state.latestInputTokens;
102
- }
103
- }
@@ -1,18 +0,0 @@
1
- import type { GitDiffResult, GitOperationResult } from '../types/contracts.js';
2
- export declare class GitOperations {
3
- private readonly cwd;
4
- constructor(cwd: string);
5
- diff(options?: {
6
- paths?: string[];
7
- staged?: boolean;
8
- ref?: string;
9
- }): Promise<GitDiffResult>;
10
- commit(message: string, paths?: string[]): Promise<GitOperationResult>;
11
- resetHard(): Promise<GitOperationResult>;
12
- status(): Promise<{
13
- output: string;
14
- isClean: boolean;
15
- }>;
16
- log(count?: number): Promise<string>;
17
- private git;
18
- }
@@ -1,86 +0,0 @@
1
- import { execFile } from 'node:child_process';
2
- import { promisify } from 'node:util';
3
- const execFileAsync = promisify(execFile);
4
- export class GitOperations {
5
- cwd;
6
- constructor(cwd) {
7
- this.cwd = cwd;
8
- }
9
- async diff(options = {}) {
10
- const ref = options.staged ? '--cached' : (options.ref ?? 'HEAD');
11
- const args = ['diff', ref];
12
- if (options.paths && options.paths.length > 0) {
13
- args.push('--', ...options.paths);
14
- }
15
- const [diffText, statOutput] = await Promise.all([
16
- this.git(args),
17
- this.git([...args, '--stat']),
18
- ]);
19
- const stats = parseStatLine(statOutput);
20
- return {
21
- hasDiff: diffText.trim().length > 0,
22
- diffText,
23
- stats,
24
- };
25
- }
26
- async commit(message, paths) {
27
- try {
28
- if (paths && paths.length > 0) {
29
- await this.git(['add', '--', ...paths]);
30
- }
31
- else {
32
- await this.git(['add', '-A']);
33
- }
34
- const output = await this.git(['commit', '-m', message]);
35
- return { success: true, output };
36
- }
37
- catch (error) {
38
- return {
39
- success: false,
40
- output: '',
41
- error: error instanceof Error ? error.message : String(error),
42
- };
43
- }
44
- }
45
- async resetHard() {
46
- try {
47
- const output = await this.git(['reset', '--hard', 'HEAD']);
48
- // Also clean untracked files
49
- const cleanOutput = await this.git(['clean', '-fd']);
50
- return { success: true, output: `${output}\n${cleanOutput}`.trim() };
51
- }
52
- catch (error) {
53
- return {
54
- success: false,
55
- output: '',
56
- error: error instanceof Error ? error.message : String(error),
57
- };
58
- }
59
- }
60
- async status() {
61
- const output = await this.git(['status', '-s']);
62
- return {
63
- output,
64
- isClean: output.trim().length === 0,
65
- };
66
- }
67
- async log(count = 5) {
68
- return this.git(['log', '--oneline', `-${count}`]);
69
- }
70
- async git(args) {
71
- const { stdout } = await execFileAsync('git', args, { cwd: this.cwd });
72
- return stdout;
73
- }
74
- }
75
- function parseStatLine(statOutput) {
76
- // Parse the summary line like: "3 files changed, 10 insertions(+), 2 deletions(-)"
77
- const summaryLine = statOutput.trim().split('\n').pop() ?? '';
78
- const filesMatch = summaryLine.match(/(\d+)\s+files?\s+changed/);
79
- const insertionsMatch = summaryLine.match(/(\d+)\s+insertions?\(\+\)/);
80
- const deletionsMatch = summaryLine.match(/(\d+)\s+deletions?\(-\)/);
81
- return {
82
- filesChanged: filesMatch ? parseInt(filesMatch[1], 10) : 0,
83
- insertions: insertionsMatch ? parseInt(insertionsMatch[1], 10) : 0,
84
- deletions: deletionsMatch ? parseInt(deletionsMatch[1], 10) : 0,
85
- };
86
- }
@@ -1,39 +0,0 @@
1
- import type { ClaudeSessionEvent, GitDiffResult, GitOperationResult } from '../types/contracts.js';
2
- import type { TranscriptStore } from '../state/transcript-store.js';
3
- import type { GitOperations } from './git-operations.js';
4
- export declare class PersistentManager {
5
- private readonly gitOps;
6
- private readonly transcriptStore;
7
- constructor(gitOps: GitOperations, transcriptStore: TranscriptStore);
8
- /**
9
- * Get the current git diff.
10
- */
11
- gitDiff(options?: {
12
- paths?: string[];
13
- staged?: boolean;
14
- ref?: string;
15
- }): Promise<GitDiffResult>;
16
- /**
17
- * Commit all current changes.
18
- */
19
- gitCommit(message: string, paths?: string[]): Promise<GitOperationResult>;
20
- /**
21
- * Get git status summary.
22
- */
23
- gitStatus(): Promise<{
24
- output: string;
25
- isClean: boolean;
26
- }>;
27
- /**
28
- * Get recent commit log.
29
- */
30
- gitLog(count?: number): Promise<string>;
31
- /**
32
- * Hard reset to discard all uncommitted changes.
33
- */
34
- gitReset(): Promise<GitOperationResult>;
35
- /**
36
- * Read persisted transcript events for a session.
37
- */
38
- getTranscriptEvents(cwd: string, sessionId: string): Promise<ClaudeSessionEvent[]>;
39
- }
@@ -1,44 +0,0 @@
1
- export class PersistentManager {
2
- gitOps;
3
- transcriptStore;
4
- constructor(gitOps, transcriptStore) {
5
- this.gitOps = gitOps;
6
- this.transcriptStore = transcriptStore;
7
- }
8
- /**
9
- * Get the current git diff.
10
- */
11
- async gitDiff(options = {}) {
12
- return this.gitOps.diff(options);
13
- }
14
- /**
15
- * Commit all current changes.
16
- */
17
- async gitCommit(message, paths) {
18
- return this.gitOps.commit(message, paths);
19
- }
20
- /**
21
- * Get git status summary.
22
- */
23
- async gitStatus() {
24
- return this.gitOps.status();
25
- }
26
- /**
27
- * Get recent commit log.
28
- */
29
- async gitLog(count = 5) {
30
- return this.gitOps.log(count);
31
- }
32
- /**
33
- * Hard reset to discard all uncommitted changes.
34
- */
35
- async gitReset() {
36
- return this.gitOps.resetHard();
37
- }
38
- /**
39
- * Read persisted transcript events for a session.
40
- */
41
- getTranscriptEvents(cwd, sessionId) {
42
- return this.transcriptStore.readEvents(cwd, sessionId);
43
- }
44
- }
@@ -1,41 +0,0 @@
1
- import type { ClaudeAgentSdkAdapter, ClaudeSessionEventHandler } from '../claude/claude-agent-sdk-adapter.js';
2
- import type { ClaudeSessionRunResult, SessionContextSnapshot, SessionMode } from '../types/contracts.js';
3
- import type { ContextTracker } from './context-tracker.js';
4
- export declare class SessionController {
5
- private readonly sdkAdapter;
6
- private readonly contextTracker;
7
- private readonly sessionPrompt;
8
- private readonly wrapperType;
9
- private readonly worktree;
10
- private readonly modePrefixes;
11
- private activeSessionId;
12
- constructor(sdkAdapter: ClaudeAgentSdkAdapter, contextTracker: ContextTracker, sessionPrompt: string | undefined, wrapperType: string, worktree: string, modePrefixes?: {
13
- plan: string;
14
- free: string;
15
- });
16
- get isActive(): boolean;
17
- get sessionId(): string | null;
18
- /**
19
- * Send a message to the persistent session. Creates one if none exists.
20
- * Returns the session result including usage data.
21
- */
22
- sendMessage(message: string, options?: {
23
- model?: string;
24
- effort?: 'low' | 'medium' | 'high' | 'max';
25
- mode?: SessionMode;
26
- sessionSystemPrompt?: string;
27
- abortSignal?: AbortSignal;
28
- }, onEvent?: ClaudeSessionEventHandler): Promise<ClaudeSessionRunResult>;
29
- /**
30
- * Send /compact to the current session to compress context.
31
- */
32
- compactSession(onEvent?: ClaudeSessionEventHandler): Promise<ClaudeSessionRunResult>;
33
- /**
34
- * Clear the current session. The next sendMessage will create a fresh one.
35
- */
36
- clearSession(): Promise<string | null>;
37
- /**
38
- * Get current context tracking snapshot.
39
- */
40
- getContextSnapshot(): SessionContextSnapshot;
41
- }
@@ -1,97 +0,0 @@
1
- export class SessionController {
2
- sdkAdapter;
3
- contextTracker;
4
- sessionPrompt;
5
- wrapperType;
6
- worktree;
7
- modePrefixes;
8
- activeSessionId = null;
9
- constructor(sdkAdapter, contextTracker, sessionPrompt, wrapperType, worktree, modePrefixes = {
10
- plan: '',
11
- free: '',
12
- }) {
13
- this.sdkAdapter = sdkAdapter;
14
- this.contextTracker = contextTracker;
15
- this.sessionPrompt = sessionPrompt;
16
- this.wrapperType = wrapperType;
17
- this.worktree = worktree;
18
- this.modePrefixes = modePrefixes;
19
- }
20
- get isActive() {
21
- return this.activeSessionId !== null;
22
- }
23
- get sessionId() {
24
- return this.activeSessionId;
25
- }
26
- /**
27
- * Send a message to the persistent session. Creates one if none exists.
28
- * Returns the session result including usage data.
29
- */
30
- async sendMessage(message, options, onEvent) {
31
- const mode = options?.mode ?? 'free';
32
- const prefix = this.modePrefixes[mode];
33
- const prompt = prefix ? `${prefix}\n\n${message}` : message;
34
- const input = {
35
- cwd: this.worktree,
36
- prompt,
37
- persistSession: true,
38
- permissionMode: mode === 'plan' ? 'plan' : 'acceptEdits',
39
- includePartialMessages: true,
40
- model: options?.model,
41
- effort: options?.effort,
42
- settingSources: ['user'],
43
- abortSignal: options?.abortSignal,
44
- };
45
- if (this.activeSessionId) {
46
- // Resume existing session
47
- input.resumeSessionId = this.activeSessionId;
48
- }
49
- else {
50
- // New session — prefer dynamically constructed prompt from wrapper, fall back to static default
51
- input.systemPrompt = options?.sessionSystemPrompt ?? this.sessionPrompt;
52
- input.model ??= 'claude-opus-4-6';
53
- input.effort ??= 'high';
54
- }
55
- const result = await this.sdkAdapter.runSession(input, onEvent);
56
- // Track the session ID
57
- if (result.sessionId) {
58
- this.activeSessionId = result.sessionId;
59
- }
60
- // Update context tracking
61
- this.contextTracker.recordResult({
62
- sessionId: result.sessionId,
63
- turns: result.turns,
64
- totalCostUsd: result.totalCostUsd,
65
- inputTokens: result.inputTokens,
66
- outputTokens: result.outputTokens,
67
- contextWindowSize: result.contextWindowSize,
68
- });
69
- return result;
70
- }
71
- /**
72
- * Send /compact to the current session to compress context.
73
- */
74
- async compactSession(onEvent) {
75
- if (!this.activeSessionId) {
76
- throw new Error('No active session to compact');
77
- }
78
- const result = await this.sendMessage('/compact', undefined, onEvent);
79
- this.contextTracker.recordCompaction();
80
- return result;
81
- }
82
- /**
83
- * Clear the current session. The next sendMessage will create a fresh one.
84
- */
85
- async clearSession() {
86
- const clearedId = this.activeSessionId;
87
- this.activeSessionId = null;
88
- this.contextTracker.reset();
89
- return clearedId;
90
- }
91
- /**
92
- * Get current context tracking snapshot.
93
- */
94
- getContextSnapshot() {
95
- return this.contextTracker.snapshot();
96
- }
97
- }
@@ -1,81 +0,0 @@
1
- import type { ClaudeSessionEventHandler } from '../claude/claude-agent-sdk-adapter.js';
2
- import type { ClaudeSessionService } from '../claude/claude-session.service.js';
3
- import type { TeamStateStore } from '../state/team-state-store.js';
4
- import type { TranscriptStore } from '../state/transcript-store.js';
5
- import type { ActivePlan, EngineerFailureResult, EngineerName, EngineerTaskResult, EngineerWorkMode, SynthesizedPlanResult, TaskSize, TeamRecord, WorkerCapabilities } from '../types/contracts.js';
6
- interface DispatchEngineerInput {
7
- teamId: string;
8
- cwd: string;
9
- engineer: EngineerName;
10
- mode: EngineerWorkMode;
11
- message: string;
12
- model?: string;
13
- abortSignal?: AbortSignal;
14
- onEvent?: ClaudeSessionEventHandler;
15
- }
16
- export declare class TeamOrchestrator {
17
- private readonly sessions;
18
- private readonly teamStore;
19
- private readonly transcriptStore;
20
- private readonly engineerSessionPrompt;
21
- private readonly planSynthesisPrompt;
22
- private readonly workerCapabilities;
23
- constructor(sessions: ClaudeSessionService, teamStore: TeamStateStore, transcriptStore: TranscriptStore, engineerSessionPrompt: string, planSynthesisPrompt: string, workerCapabilities: Partial<Record<EngineerName, WorkerCapabilities>>);
24
- getOrCreateTeam(cwd: string, teamId: string): Promise<TeamRecord>;
25
- listTeams(cwd: string): Promise<TeamRecord[]>;
26
- recordWrapperSession(cwd: string, teamId: string, engineer: EngineerName, wrapperSessionId: string): Promise<void>;
27
- recordWrapperExchange(cwd: string, teamId: string, engineer: EngineerName, wrapperSessionId: string, mode: EngineerWorkMode, assignment: string, result: string): Promise<void>;
28
- getWrapperSystemContext(cwd: string, teamId: string, engineer: EngineerName): Promise<string | null>;
29
- findTeamByWrapperSession(cwd: string, wrapperSessionId: string): Promise<{
30
- teamId: string;
31
- engineer: EngineerName;
32
- } | null>;
33
- /**
34
- * Remove wrapper history entries whose timestamp is strictly after cutoffIso.
35
- * Used during CTO undo propagation to prune stale wrapper memory.
36
- */
37
- pruneWrapperHistoryAfter(cwd: string, teamId: string, engineer: EngineerName, cutoffIso: string): Promise<void>;
38
- resetEngineer(cwd: string, teamId: string, engineer: EngineerName, options?: {
39
- clearSession?: boolean;
40
- clearHistory?: boolean;
41
- }): Promise<void>;
42
- dispatchEngineer(input: DispatchEngineerInput, retryCount?: number): Promise<EngineerTaskResult>;
43
- static classifyError(error: unknown): EngineerFailureResult & {
44
- cause: unknown;
45
- };
46
- planWithTeam(input: {
47
- teamId: string;
48
- cwd: string;
49
- request: string;
50
- leadEngineer?: EngineerName;
51
- challengerEngineer?: EngineerName;
52
- model?: string;
53
- abortSignal?: AbortSignal;
54
- onLeadEvent?: ClaudeSessionEventHandler;
55
- onChallengerEvent?: ClaudeSessionEventHandler;
56
- onSynthesisEvent?: ClaudeSessionEventHandler;
57
- }): Promise<SynthesizedPlanResult>;
58
- private updateEngineer;
59
- private reserveEngineer;
60
- private getEngineerState;
61
- private normalizeTeamRecord;
62
- getAvailableEngineers(team: TeamRecord): EngineerName[];
63
- selectPlanEngineers(cwd: string, teamId: string, preferredLead?: EngineerName, preferredChallenger?: EngineerName): Promise<{
64
- lead: EngineerName;
65
- challenger: EngineerName;
66
- }>;
67
- getActivePlan(cwd: string, teamId: string): Promise<ActivePlan | null>;
68
- setActivePlan(cwd: string, teamId: string, plan: {
69
- summary: string;
70
- taskSize: TaskSize;
71
- slices: string[];
72
- preAuthorized: boolean;
73
- }): Promise<ActivePlan>;
74
- clearActivePlan(cwd: string, teamId: string): Promise<void>;
75
- updateActivePlanSlice(cwd: string, teamId: string, sliceIndex: number, status: 'in_progress' | 'done' | 'skipped'): Promise<void>;
76
- private buildSessionSystemPrompt;
77
- private buildEngineerPrompt;
78
- }
79
- export declare function getFailureGuidanceText(failureKind: string): string;
80
- export declare function createActionableError(failure: EngineerFailureResult, originalError: unknown): Error;
81
- export {};