oh-my-claude-sisyphus 3.3.10 → 3.4.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 +3 -3
- package/agents/explore-high.md +195 -0
- package/agents/qa-tester-high.md +141 -0
- package/agents/templates/README.md +110 -0
- package/agents/templates/base-agent.md +54 -0
- package/agents/templates/tier-instructions.md +94 -0
- package/commands/ecomode.md +60 -0
- package/commands/help.md +1 -1
- package/commands/mcp-setup.md +7 -6
- package/commands/ralplan.md +8 -1
- package/commands/ultrapilot.md +158 -0
- package/commands/ultrawork.md +1 -0
- package/dist/__tests__/delegation-enforcer-integration.test.d.ts +6 -0
- package/dist/__tests__/delegation-enforcer-integration.test.d.ts.map +1 -0
- package/dist/__tests__/delegation-enforcer-integration.test.js +136 -0
- package/dist/__tests__/delegation-enforcer-integration.test.js.map +1 -0
- package/dist/__tests__/delegation-enforcer.test.d.ts +5 -0
- package/dist/__tests__/delegation-enforcer.test.d.ts.map +1 -0
- package/dist/__tests__/delegation-enforcer.test.js +208 -0
- package/dist/__tests__/delegation-enforcer.test.js.map +1 -0
- package/dist/__tests__/hooks.test.js +2 -2
- package/dist/__tests__/hooks.test.js.map +1 -1
- package/dist/__tests__/installer.test.js +4 -6
- package/dist/__tests__/installer.test.js.map +1 -1
- package/dist/__tests__/ralph-prd.test.js +1 -1
- package/dist/__tests__/ralph-prd.test.js.map +1 -1
- package/dist/__tests__/ralph-progress.test.js +1 -1
- package/dist/__tests__/ralph-progress.test.js.map +1 -1
- package/dist/__tests__/skills.test.js +31 -24
- package/dist/__tests__/skills.test.js.map +1 -1
- package/dist/agents/analyst.d.ts.map +1 -1
- package/dist/agents/analyst.js +1 -0
- package/dist/agents/analyst.js.map +1 -1
- package/dist/agents/architect.d.ts.map +1 -1
- package/dist/agents/architect.js +1 -0
- package/dist/agents/architect.js.map +1 -1
- package/dist/agents/critic.d.ts.map +1 -1
- package/dist/agents/critic.js +1 -0
- package/dist/agents/critic.js.map +1 -1
- package/dist/agents/definitions.d.ts +5 -1
- package/dist/agents/definitions.d.ts.map +1 -1
- package/dist/agents/definitions.js +53 -155
- package/dist/agents/definitions.js.map +1 -1
- package/dist/agents/designer.d.ts.map +1 -1
- package/dist/agents/designer.js +1 -0
- package/dist/agents/designer.js.map +1 -1
- package/dist/agents/executor.d.ts.map +1 -1
- package/dist/agents/executor.js +1 -0
- package/dist/agents/executor.js.map +1 -1
- package/dist/agents/explore.d.ts.map +1 -1
- package/dist/agents/explore.js +1 -0
- package/dist/agents/explore.js.map +1 -1
- package/dist/agents/planner.d.ts.map +1 -1
- package/dist/agents/planner.js +1 -0
- package/dist/agents/planner.js.map +1 -1
- package/dist/agents/qa-tester.d.ts.map +1 -1
- package/dist/agents/qa-tester.js +1 -0
- package/dist/agents/qa-tester.js.map +1 -1
- package/dist/agents/researcher.d.ts.map +1 -1
- package/dist/agents/researcher.js +1 -0
- package/dist/agents/researcher.js.map +1 -1
- package/dist/agents/scientist.d.ts.map +1 -1
- package/dist/agents/scientist.js +1 -0
- package/dist/agents/scientist.js.map +1 -1
- package/dist/agents/types.d.ts +2 -0
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/types.js.map +1 -1
- package/dist/agents/vision.d.ts.map +1 -1
- package/dist/agents/vision.js +1 -0
- package/dist/agents/vision.js.map +1 -1
- package/dist/agents/writer.d.ts.map +1 -1
- package/dist/agents/writer.js +1 -0
- package/dist/agents/writer.js.map +1 -1
- package/dist/cli/index.js +0 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +1 -6
- package/dist/config/loader.js.map +1 -1
- package/dist/features/delegation-enforcer.d.ts +71 -0
- package/dist/features/delegation-enforcer.d.ts.map +1 -0
- package/dist/features/delegation-enforcer.js +128 -0
- package/dist/features/delegation-enforcer.js.map +1 -0
- package/dist/features/index.d.ts +3 -0
- package/dist/features/index.d.ts.map +1 -1
- package/dist/features/index.js +18 -0
- package/dist/features/index.js.map +1 -1
- package/dist/features/state-manager/index.d.ts +100 -0
- package/dist/features/state-manager/index.d.ts.map +1 -0
- package/dist/features/state-manager/index.js +407 -0
- package/dist/features/state-manager/index.js.map +1 -0
- package/dist/features/state-manager/types.d.ts +147 -0
- package/dist/features/state-manager/types.d.ts.map +1 -0
- package/dist/features/state-manager/types.js +30 -0
- package/dist/features/state-manager/types.js.map +1 -0
- package/dist/features/task-decomposer/index.d.ts +33 -0
- package/dist/features/task-decomposer/index.d.ts.map +1 -0
- package/dist/features/task-decomposer/index.js +698 -0
- package/dist/features/task-decomposer/index.js.map +1 -0
- package/dist/features/task-decomposer/types.d.ts +133 -0
- package/dist/features/task-decomposer/types.d.ts.map +1 -0
- package/dist/features/task-decomposer/types.js +8 -0
- package/dist/features/task-decomposer/types.js.map +1 -0
- package/dist/features/verification/example.d.ts +49 -0
- package/dist/features/verification/example.d.ts.map +1 -0
- package/dist/features/verification/example.js +235 -0
- package/dist/features/verification/example.js.map +1 -0
- package/dist/features/verification/index.d.ts +97 -0
- package/dist/features/verification/index.d.ts.map +1 -0
- package/dist/features/verification/index.js +439 -0
- package/dist/features/verification/index.js.map +1 -0
- package/dist/features/verification/types.d.ts +142 -0
- package/dist/features/verification/types.d.ts.map +1 -0
- package/dist/features/verification/types.js +7 -0
- package/dist/features/verification/types.js.map +1 -0
- package/dist/hooks/agent-usage-reminder/constants.d.ts.map +1 -1
- package/dist/hooks/agent-usage-reminder/constants.js +0 -1
- package/dist/hooks/agent-usage-reminder/constants.js.map +1 -1
- package/dist/hooks/autopilot/__tests__/cancel.test.js +4 -4
- package/dist/hooks/autopilot/__tests__/cancel.test.js.map +1 -1
- package/dist/hooks/autopilot/__tests__/summary.test.js +1 -1
- package/dist/hooks/autopilot/__tests__/summary.test.js.map +1 -1
- package/dist/hooks/autopilot/__tests__/transition.test.js +1 -2
- package/dist/hooks/autopilot/__tests__/transition.test.js.map +1 -1
- package/dist/hooks/autopilot/cancel.js +2 -2
- package/dist/hooks/autopilot/cancel.js.map +1 -1
- package/dist/hooks/autopilot/enforcement.d.ts +16 -2
- package/dist/hooks/autopilot/enforcement.d.ts.map +1 -1
- package/dist/hooks/autopilot/enforcement.js +78 -4
- package/dist/hooks/autopilot/enforcement.js.map +1 -1
- package/dist/hooks/autopilot/index.d.ts +3 -6
- package/dist/hooks/autopilot/index.d.ts.map +1 -1
- package/dist/hooks/autopilot/index.js +6 -12
- package/dist/hooks/autopilot/index.js.map +1 -1
- package/dist/hooks/autopilot/state.d.ts +36 -2
- package/dist/hooks/autopilot/state.d.ts.map +1 -1
- package/dist/hooks/autopilot/state.js +216 -2
- package/dist/hooks/autopilot/state.js.map +1 -1
- package/dist/hooks/autopilot/validation.d.ts +23 -2
- package/dist/hooks/autopilot/validation.d.ts.map +1 -1
- package/dist/hooks/autopilot/validation.js +158 -1
- package/dist/hooks/autopilot/validation.js.map +1 -1
- package/dist/hooks/bridge.js +3 -3
- package/dist/hooks/bridge.js.map +1 -1
- package/dist/hooks/index.d.ts +5 -9
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +31 -21
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/learner/promotion.js +1 -1
- package/dist/hooks/learner/promotion.js.map +1 -1
- package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/index.js +2 -3
- package/dist/hooks/persistent-mode/index.js.map +1 -1
- package/dist/hooks/ralph/index.d.ts +11 -0
- package/dist/hooks/ralph/index.d.ts.map +1 -0
- package/dist/hooks/ralph/index.js +53 -0
- package/dist/hooks/ralph/index.js.map +1 -0
- package/dist/hooks/ralph/loop.d.ts +116 -0
- package/dist/hooks/ralph/loop.d.ts.map +1 -0
- package/dist/hooks/ralph/loop.js +322 -0
- package/dist/hooks/ralph/loop.js.map +1 -0
- package/dist/hooks/ralph/prd.d.ts +130 -0
- package/dist/hooks/ralph/prd.d.ts.map +1 -0
- package/dist/hooks/ralph/prd.js +310 -0
- package/dist/hooks/ralph/prd.js.map +1 -0
- package/dist/hooks/ralph/progress.d.ts +102 -0
- package/dist/hooks/ralph/progress.d.ts.map +1 -0
- package/dist/hooks/ralph/progress.js +408 -0
- package/dist/hooks/ralph/progress.js.map +1 -0
- package/dist/hooks/ralph/verifier.d.ts +72 -0
- package/dist/hooks/ralph/verifier.d.ts.map +1 -0
- package/dist/hooks/ralph/verifier.js +223 -0
- package/dist/hooks/ralph/verifier.js.map +1 -0
- package/dist/hooks/recovery/constants.d.ts +114 -0
- package/dist/hooks/recovery/constants.d.ts.map +1 -0
- package/dist/hooks/recovery/constants.js +227 -0
- package/dist/hooks/recovery/constants.js.map +1 -0
- package/dist/hooks/recovery/context-window.d.ts +24 -0
- package/dist/hooks/recovery/context-window.d.ts.map +1 -0
- package/dist/hooks/recovery/context-window.js +321 -0
- package/dist/hooks/recovery/context-window.js.map +1 -0
- package/dist/hooks/recovery/edit-error.d.ts +24 -0
- package/dist/hooks/recovery/edit-error.d.ts.map +1 -0
- package/dist/hooks/recovery/edit-error.js +56 -0
- package/dist/hooks/recovery/edit-error.js.map +1 -0
- package/dist/hooks/recovery/index.d.ts +102 -0
- package/dist/hooks/recovery/index.d.ts.map +1 -0
- package/dist/hooks/recovery/index.js +166 -0
- package/dist/hooks/recovery/index.js.map +1 -0
- package/dist/hooks/recovery/session-recovery.d.ts +24 -0
- package/dist/hooks/recovery/session-recovery.d.ts.map +1 -0
- package/dist/hooks/recovery/session-recovery.js +281 -0
- package/dist/hooks/recovery/session-recovery.js.map +1 -0
- package/dist/hooks/recovery/storage.d.ts +75 -0
- package/dist/hooks/recovery/storage.d.ts.map +1 -0
- package/dist/hooks/recovery/storage.js +382 -0
- package/dist/hooks/recovery/storage.js.map +1 -0
- package/dist/hooks/recovery/types.d.ts +196 -0
- package/dist/hooks/recovery/types.d.ts.map +1 -0
- package/dist/hooks/recovery/types.js +32 -0
- package/dist/hooks/recovery/types.js.map +1 -0
- package/dist/hooks/ultrapilot/index.d.ts +90 -0
- package/dist/hooks/ultrapilot/index.d.ts.map +1 -0
- package/dist/hooks/ultrapilot/index.js +310 -0
- package/dist/hooks/ultrapilot/index.js.map +1 -0
- package/dist/hooks/ultrapilot/state.d.ts +72 -0
- package/dist/hooks/ultrapilot/state.d.ts.map +1 -0
- package/dist/hooks/ultrapilot/state.js +258 -0
- package/dist/hooks/ultrapilot/state.js.map +1 -0
- package/dist/hooks/ultrapilot/types.d.ts +113 -0
- package/dist/hooks/ultrapilot/types.d.ts.map +1 -0
- package/dist/hooks/ultrapilot/types.js +36 -0
- package/dist/hooks/ultrapilot/types.js.map +1 -0
- package/dist/hooks/ultraqa/index.d.ts +94 -0
- package/dist/hooks/ultraqa/index.d.ts.map +1 -0
- package/dist/hooks/ultraqa/index.js +216 -0
- package/dist/hooks/ultraqa/index.js.map +1 -0
- package/dist/hooks/ultrawork/index.d.ts +62 -0
- package/dist/hooks/ultrawork/index.d.ts.map +1 -0
- package/dist/hooks/ultrawork/index.js +208 -0
- package/dist/hooks/ultrawork/index.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/installer/index.d.ts +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +1 -1
- package/dist/installer/index.js.map +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/servers.d.ts +2 -18
- package/dist/mcp/servers.d.ts.map +1 -1
- package/dist/mcp/servers.js +4 -36
- package/dist/mcp/servers.js.map +1 -1
- package/dist/shared/types.d.ts +1 -3
- package/dist/shared/types.d.ts.map +1 -1
- package/docs/CLAUDE.md +170 -44
- package/docs/DELEGATION-ENFORCER.md +282 -0
- package/docs/FULL-README.md +1 -1
- package/docs/LOCAL_PLUGIN_INSTALL.md +1 -1
- package/docs/MIGRATION.md +298 -104
- package/package.json +2 -2
- package/scripts/test-mutual-exclusion.ts +1 -1
- package/skills/analyze/SKILL.md +0 -1
- package/skills/autopilot/SKILL.md +0 -1
- package/skills/cancel/SKILL.md +580 -0
- package/skills/cancel-autopilot/SKILL.md +0 -1
- package/skills/cancel-ecomode/SKILL.md +41 -0
- package/skills/cancel-ralph/SKILL.md +0 -1
- package/skills/cancel-ultraqa/SKILL.md +0 -1
- package/skills/cancel-ultrawork/SKILL.md +0 -1
- package/skills/deepinit/SKILL.md +0 -1
- package/skills/deepsearch/SKILL.md +0 -1
- package/skills/doctor/SKILL.md +0 -1
- package/skills/ecomode/SKILL.md +128 -0
- package/skills/frontend-ui-ux/SKILL.md +0 -1
- package/skills/git-master/SKILL.md +0 -1
- package/skills/help/SKILL.md +1 -2
- package/skills/hud/SKILL.md +0 -1
- package/skills/learner/SKILL.md +0 -1
- package/skills/mcp-setup/SKILL.md +8 -7
- package/skills/note/SKILL.md +0 -1
- package/skills/omc-default/SKILL.md +0 -1
- package/skills/omc-default-global/SKILL.md +0 -1
- package/skills/omc-setup/SKILL.md +176 -10
- package/skills/orchestrate/SKILL.md +0 -1
- package/skills/pipeline/SKILL.md +417 -0
- package/skills/plan/SKILL.md +138 -21
- package/skills/planner/SKILL.md +0 -1
- package/skills/ralph/SKILL.md +65 -1
- package/skills/ralph-init/SKILL.md +0 -1
- package/skills/ralplan/SKILL.md +0 -1
- package/skills/release/SKILL.md +0 -1
- package/skills/research/SKILL.md +0 -1
- package/skills/review/SKILL.md +0 -1
- package/skills/swarm/SKILL.md +349 -0
- package/skills/tdd/SKILL.md +0 -1
- package/skills/ultrapilot/SKILL.md +563 -0
- package/skills/ultraqa/SKILL.md +0 -1
- package/skills/ultrawork/SKILL.md +0 -1
- package/docs/MIGRATION-v3.md +0 -186
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ultrapilot State Management
|
|
3
|
+
*
|
|
4
|
+
* Persistent state for ultrapilot workflow - tracks parallel workers,
|
|
5
|
+
* file ownership, and progress.
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync, unlinkSync } from 'fs';
|
|
8
|
+
import { join } from 'path';
|
|
9
|
+
import { DEFAULT_CONFIG } from './types.js';
|
|
10
|
+
const STATE_FILE = 'ultrapilot-state.json';
|
|
11
|
+
const OWNERSHIP_FILE = 'ultrapilot-ownership.json';
|
|
12
|
+
/**
|
|
13
|
+
* Get the state file path
|
|
14
|
+
*/
|
|
15
|
+
function getStateFilePath(directory) {
|
|
16
|
+
const omcDir = join(directory, '.omc', 'state');
|
|
17
|
+
return join(omcDir, STATE_FILE);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get the ownership file path
|
|
21
|
+
*/
|
|
22
|
+
function getOwnershipFilePath(directory) {
|
|
23
|
+
const omcDir = join(directory, '.omc', 'state');
|
|
24
|
+
return join(omcDir, OWNERSHIP_FILE);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Ensure the state directory exists
|
|
28
|
+
*/
|
|
29
|
+
function ensureStateDir(directory) {
|
|
30
|
+
const stateDir = join(directory, '.omc', 'state');
|
|
31
|
+
if (!existsSync(stateDir)) {
|
|
32
|
+
mkdirSync(stateDir, { recursive: true });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Read ultrapilot state from disk
|
|
37
|
+
*/
|
|
38
|
+
export function readUltrapilotState(directory) {
|
|
39
|
+
const stateFile = getStateFilePath(directory);
|
|
40
|
+
if (!existsSync(stateFile)) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const content = readFileSync(stateFile, 'utf-8');
|
|
45
|
+
return JSON.parse(content);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Write ultrapilot state to disk
|
|
53
|
+
*/
|
|
54
|
+
export function writeUltrapilotState(directory, state) {
|
|
55
|
+
try {
|
|
56
|
+
ensureStateDir(directory);
|
|
57
|
+
const stateFile = getStateFilePath(directory);
|
|
58
|
+
writeFileSync(stateFile, JSON.stringify(state, null, 2));
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Clear ultrapilot state
|
|
67
|
+
*/
|
|
68
|
+
export function clearUltrapilotState(directory) {
|
|
69
|
+
const stateFile = getStateFilePath(directory);
|
|
70
|
+
const ownershipFile = getOwnershipFilePath(directory);
|
|
71
|
+
try {
|
|
72
|
+
if (existsSync(stateFile)) {
|
|
73
|
+
unlinkSync(stateFile);
|
|
74
|
+
}
|
|
75
|
+
if (existsSync(ownershipFile)) {
|
|
76
|
+
unlinkSync(ownershipFile);
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Check if ultrapilot is active
|
|
86
|
+
*/
|
|
87
|
+
export function isUltrapilotActive(directory) {
|
|
88
|
+
const state = readUltrapilotState(directory);
|
|
89
|
+
return state !== null && state.active === true;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Initialize a new ultrapilot session
|
|
93
|
+
*/
|
|
94
|
+
export function initUltrapilot(directory, task, subtasks, sessionId, config) {
|
|
95
|
+
const mergedConfig = { ...DEFAULT_CONFIG, ...config };
|
|
96
|
+
const now = new Date().toISOString();
|
|
97
|
+
const state = {
|
|
98
|
+
active: true,
|
|
99
|
+
iteration: 1,
|
|
100
|
+
maxIterations: mergedConfig.maxIterations,
|
|
101
|
+
originalTask: task,
|
|
102
|
+
subtasks,
|
|
103
|
+
workers: [],
|
|
104
|
+
ownership: {
|
|
105
|
+
coordinator: mergedConfig.sharedFiles,
|
|
106
|
+
workers: {},
|
|
107
|
+
conflicts: []
|
|
108
|
+
},
|
|
109
|
+
startedAt: now,
|
|
110
|
+
completedAt: null,
|
|
111
|
+
totalWorkersSpawned: 0,
|
|
112
|
+
successfulWorkers: 0,
|
|
113
|
+
failedWorkers: 0,
|
|
114
|
+
sessionId
|
|
115
|
+
};
|
|
116
|
+
writeUltrapilotState(directory, state);
|
|
117
|
+
return state;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Update worker state
|
|
121
|
+
*/
|
|
122
|
+
export function updateWorkerState(directory, workerId, updates) {
|
|
123
|
+
const state = readUltrapilotState(directory);
|
|
124
|
+
if (!state)
|
|
125
|
+
return false;
|
|
126
|
+
const workerIndex = state.workers.findIndex((w) => w.id === workerId);
|
|
127
|
+
if (workerIndex === -1)
|
|
128
|
+
return false;
|
|
129
|
+
state.workers[workerIndex] = { ...state.workers[workerIndex], ...updates };
|
|
130
|
+
return writeUltrapilotState(directory, state);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Add a new worker
|
|
134
|
+
*/
|
|
135
|
+
export function addWorker(directory, worker) {
|
|
136
|
+
const state = readUltrapilotState(directory);
|
|
137
|
+
if (!state)
|
|
138
|
+
return false;
|
|
139
|
+
state.workers.push(worker);
|
|
140
|
+
state.totalWorkersSpawned += 1;
|
|
141
|
+
// Update ownership
|
|
142
|
+
state.ownership.workers[worker.id] = worker.ownedFiles;
|
|
143
|
+
return writeUltrapilotState(directory, state);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Mark worker as complete
|
|
147
|
+
*/
|
|
148
|
+
export function completeWorker(directory, workerId, filesCreated, filesModified) {
|
|
149
|
+
const state = readUltrapilotState(directory);
|
|
150
|
+
if (!state)
|
|
151
|
+
return false;
|
|
152
|
+
const workerIndex = state.workers.findIndex((w) => w.id === workerId);
|
|
153
|
+
if (workerIndex === -1)
|
|
154
|
+
return false;
|
|
155
|
+
state.workers[workerIndex].status = 'complete';
|
|
156
|
+
state.workers[workerIndex].completedAt = new Date().toISOString();
|
|
157
|
+
state.workers[workerIndex].filesCreated = filesCreated;
|
|
158
|
+
state.workers[workerIndex].filesModified = filesModified;
|
|
159
|
+
state.successfulWorkers += 1;
|
|
160
|
+
return writeUltrapilotState(directory, state);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Mark worker as failed
|
|
164
|
+
*/
|
|
165
|
+
export function failWorker(directory, workerId, error) {
|
|
166
|
+
const state = readUltrapilotState(directory);
|
|
167
|
+
if (!state)
|
|
168
|
+
return false;
|
|
169
|
+
const workerIndex = state.workers.findIndex((w) => w.id === workerId);
|
|
170
|
+
if (workerIndex === -1)
|
|
171
|
+
return false;
|
|
172
|
+
state.workers[workerIndex].status = 'failed';
|
|
173
|
+
state.workers[workerIndex].completedAt = new Date().toISOString();
|
|
174
|
+
state.workers[workerIndex].error = error;
|
|
175
|
+
state.failedWorkers += 1;
|
|
176
|
+
return writeUltrapilotState(directory, state);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Complete ultrapilot session
|
|
180
|
+
*/
|
|
181
|
+
export function completeUltrapilot(directory) {
|
|
182
|
+
const state = readUltrapilotState(directory);
|
|
183
|
+
if (!state)
|
|
184
|
+
return false;
|
|
185
|
+
state.active = false;
|
|
186
|
+
state.completedAt = new Date().toISOString();
|
|
187
|
+
return writeUltrapilotState(directory, state);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Read file ownership mapping
|
|
191
|
+
*/
|
|
192
|
+
export function readFileOwnership(directory) {
|
|
193
|
+
const ownershipFile = getOwnershipFilePath(directory);
|
|
194
|
+
if (!existsSync(ownershipFile)) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
const content = readFileSync(ownershipFile, 'utf-8');
|
|
199
|
+
return JSON.parse(content);
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Write file ownership mapping
|
|
207
|
+
*/
|
|
208
|
+
export function writeFileOwnership(directory, ownership) {
|
|
209
|
+
try {
|
|
210
|
+
ensureStateDir(directory);
|
|
211
|
+
const ownershipFile = getOwnershipFilePath(directory);
|
|
212
|
+
writeFileSync(ownershipFile, JSON.stringify(ownership, null, 2));
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Record a file conflict
|
|
221
|
+
*/
|
|
222
|
+
export function recordConflict(directory, filePath) {
|
|
223
|
+
const state = readUltrapilotState(directory);
|
|
224
|
+
if (!state)
|
|
225
|
+
return false;
|
|
226
|
+
if (!state.ownership.conflicts.includes(filePath)) {
|
|
227
|
+
state.ownership.conflicts.push(filePath);
|
|
228
|
+
}
|
|
229
|
+
return writeUltrapilotState(directory, state);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Get all completed workers
|
|
233
|
+
*/
|
|
234
|
+
export function getCompletedWorkers(directory) {
|
|
235
|
+
const state = readUltrapilotState(directory);
|
|
236
|
+
if (!state)
|
|
237
|
+
return [];
|
|
238
|
+
return state.workers.filter((w) => w.status === 'complete');
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Get all running workers
|
|
242
|
+
*/
|
|
243
|
+
export function getRunningWorkers(directory) {
|
|
244
|
+
const state = readUltrapilotState(directory);
|
|
245
|
+
if (!state)
|
|
246
|
+
return [];
|
|
247
|
+
return state.workers.filter((w) => w.status === 'running');
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Get all failed workers
|
|
251
|
+
*/
|
|
252
|
+
export function getFailedWorkers(directory) {
|
|
253
|
+
const state = readUltrapilotState(directory);
|
|
254
|
+
if (!state)
|
|
255
|
+
return [];
|
|
256
|
+
return state.workers.filter((w) => w.status === 'failed');
|
|
257
|
+
}
|
|
258
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,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ACH,MAAM,UAAU,mBAAmB,CAAC,SAAiB;IACnD,MAAM,KAAK,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC7C,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IAEtB,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB;IACjD,MAAM,KAAK,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC7C,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IAEtB,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC;AAC7D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAiB;IAChD,MAAM,KAAK,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC7C,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IAEtB,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ultrapilot Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for the ultrapilot coordinator - manages parallel worker spawning
|
|
5
|
+
* and coordination with file ownership to avoid conflicts.
|
|
6
|
+
*
|
|
7
|
+
* Ultrapilot decomposes tasks into parallelizable subtasks, spawns workers (max 5),
|
|
8
|
+
* tracks progress, and integrates results while managing shared file access.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Configuration options for ultrapilot behavior
|
|
12
|
+
*/
|
|
13
|
+
export interface UltrapilotConfig {
|
|
14
|
+
/** Maximum number of parallel workers */
|
|
15
|
+
maxWorkers?: number;
|
|
16
|
+
/** Maximum iterations before giving up */
|
|
17
|
+
maxIterations?: number;
|
|
18
|
+
/** Timeout per worker in milliseconds */
|
|
19
|
+
workerTimeout?: number;
|
|
20
|
+
/** Model to use for workers (haiku/sonnet/opus) */
|
|
21
|
+
workerModel?: string;
|
|
22
|
+
/** List of shared files that only coordinator can modify */
|
|
23
|
+
sharedFiles?: string[];
|
|
24
|
+
/** Whether to enable verbose logging */
|
|
25
|
+
verbose?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* State of an individual worker
|
|
29
|
+
*/
|
|
30
|
+
export interface WorkerState {
|
|
31
|
+
/** Unique worker ID */
|
|
32
|
+
id: string;
|
|
33
|
+
/** Worker index (0-4) */
|
|
34
|
+
index: number;
|
|
35
|
+
/** Task assigned to this worker */
|
|
36
|
+
task: string;
|
|
37
|
+
/** Files this worker owns (can modify) */
|
|
38
|
+
ownedFiles: string[];
|
|
39
|
+
/** Current status */
|
|
40
|
+
status: 'pending' | 'running' | 'complete' | 'failed';
|
|
41
|
+
/** Task agent ID (from Task tool) */
|
|
42
|
+
taskId?: string;
|
|
43
|
+
/** Start timestamp */
|
|
44
|
+
startedAt?: string;
|
|
45
|
+
/** Completion timestamp */
|
|
46
|
+
completedAt?: string;
|
|
47
|
+
/** Error message if failed */
|
|
48
|
+
error?: string;
|
|
49
|
+
/** Files created by this worker */
|
|
50
|
+
filesCreated: string[];
|
|
51
|
+
/** Files modified by this worker */
|
|
52
|
+
filesModified: string[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* File ownership mapping to prevent conflicts
|
|
56
|
+
*/
|
|
57
|
+
export interface FileOwnership {
|
|
58
|
+
/** Files owned by the coordinator (shared files) */
|
|
59
|
+
coordinator: string[];
|
|
60
|
+
/** Files owned by each worker (keyed by worker ID) */
|
|
61
|
+
workers: Record<string, string[]>;
|
|
62
|
+
/** Files that have conflicts (multiple workers attempted to modify) */
|
|
63
|
+
conflicts: string[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Complete ultrapilot state
|
|
67
|
+
*/
|
|
68
|
+
export interface UltrapilotState {
|
|
69
|
+
/** Whether ultrapilot is currently active */
|
|
70
|
+
active: boolean;
|
|
71
|
+
/** Current iteration number */
|
|
72
|
+
iteration: number;
|
|
73
|
+
/** Maximum iterations before giving up */
|
|
74
|
+
maxIterations: number;
|
|
75
|
+
/** Original task provided by user */
|
|
76
|
+
originalTask: string;
|
|
77
|
+
/** Decomposed subtasks */
|
|
78
|
+
subtasks: string[];
|
|
79
|
+
/** State for each worker */
|
|
80
|
+
workers: WorkerState[];
|
|
81
|
+
/** File ownership mapping */
|
|
82
|
+
ownership: FileOwnership;
|
|
83
|
+
/** Metrics and timestamps */
|
|
84
|
+
startedAt: string;
|
|
85
|
+
completedAt: string | null;
|
|
86
|
+
totalWorkersSpawned: number;
|
|
87
|
+
successfulWorkers: number;
|
|
88
|
+
failedWorkers: number;
|
|
89
|
+
/** Session binding */
|
|
90
|
+
sessionId?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Result from integrating worker outputs
|
|
94
|
+
*/
|
|
95
|
+
export interface IntegrationResult {
|
|
96
|
+
/** Whether integration was successful */
|
|
97
|
+
success: boolean;
|
|
98
|
+
/** All files created across workers */
|
|
99
|
+
filesCreated: string[];
|
|
100
|
+
/** All files modified across workers */
|
|
101
|
+
filesModified: string[];
|
|
102
|
+
/** List of conflicts that need manual resolution */
|
|
103
|
+
conflicts: string[];
|
|
104
|
+
/** List of errors encountered */
|
|
105
|
+
errors: string[];
|
|
106
|
+
/** Summary of work completed */
|
|
107
|
+
summary: string;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Default configuration for ultrapilot
|
|
111
|
+
*/
|
|
112
|
+
export declare const DEFAULT_CONFIG: Required<UltrapilotConfig>;
|
|
113
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/hooks/ultrapilot/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yCAAyC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,qBAAqB;IACrB,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IACtD,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sBAAsB;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,oCAAoC;IACpC,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,oDAAoD;IACpD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,sDAAsD;IACtD,OAAO,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type definitions for the ultrapilot coordinator - manages parallel worker spawning
|
|
5
|
+
* and coordination with file ownership to avoid conflicts.
|
|
6
|
+
*
|
|
7
|
+
* Ultrapilot decomposes tasks into parallelizable subtasks, spawns workers (max 5),
|
|
8
|
+
* tracks progress, and integrates results while managing shared file access.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Default configuration for ultrapilot
|
|
12
|
+
*/
|
|
13
|
+
export const DEFAULT_CONFIG = {
|
|
14
|
+
maxWorkers: 5,
|
|
15
|
+
maxIterations: 3,
|
|
16
|
+
workerTimeout: 300000, // 5 minutes
|
|
17
|
+
workerModel: 'sonnet',
|
|
18
|
+
sharedFiles: [
|
|
19
|
+
'package.json',
|
|
20
|
+
'package-lock.json',
|
|
21
|
+
'tsconfig.json',
|
|
22
|
+
'jest.config.js',
|
|
23
|
+
'.gitignore',
|
|
24
|
+
'README.md',
|
|
25
|
+
'Makefile',
|
|
26
|
+
'go.mod',
|
|
27
|
+
'go.sum',
|
|
28
|
+
'Cargo.toml',
|
|
29
|
+
'Cargo.lock',
|
|
30
|
+
'pyproject.toml',
|
|
31
|
+
'requirements.txt',
|
|
32
|
+
'setup.py'
|
|
33
|
+
],
|
|
34
|
+
verbose: false
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/hooks/ultrapilot/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA0GH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAA+B;IACxD,UAAU,EAAE,CAAC;IACb,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,MAAM,EAAE,YAAY;IACnC,WAAW,EAAE,QAAQ;IACrB,WAAW,EAAE;QACX,cAAc;QACd,mBAAmB;QACnB,eAAe;QACf,gBAAgB;QAChB,YAAY;QACZ,WAAW;QACX,UAAU;QACV,QAAQ;QACR,QAAQ;QACR,YAAY;QACZ,YAAY;QACZ,gBAAgB;QAChB,kBAAkB;QAClB,UAAU;KACX;IACD,OAAO,EAAE,KAAK;CACf,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UltraQA Loop Hook
|
|
3
|
+
*
|
|
4
|
+
* QA cycling workflow that runs test → architect verify → fix → repeat
|
|
5
|
+
* until the QA goal is met or max cycles reached.
|
|
6
|
+
*/
|
|
7
|
+
export type UltraQAGoalType = 'tests' | 'build' | 'lint' | 'typecheck' | 'custom';
|
|
8
|
+
export interface UltraQAState {
|
|
9
|
+
/** Whether the loop is currently active */
|
|
10
|
+
active: boolean;
|
|
11
|
+
/** Type of QA goal */
|
|
12
|
+
goal_type: UltraQAGoalType;
|
|
13
|
+
/** Custom pattern to match (for custom goal type) */
|
|
14
|
+
goal_pattern: string | null;
|
|
15
|
+
/** Current cycle number */
|
|
16
|
+
cycle: number;
|
|
17
|
+
/** Maximum cycles before stopping */
|
|
18
|
+
max_cycles: number;
|
|
19
|
+
/** Array of failure descriptions for pattern detection */
|
|
20
|
+
failures: string[];
|
|
21
|
+
/** When the loop started */
|
|
22
|
+
started_at: string;
|
|
23
|
+
/** Session ID the loop is bound to */
|
|
24
|
+
session_id?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface UltraQAOptions {
|
|
27
|
+
/** Maximum cycles (default: 5) */
|
|
28
|
+
maxCycles?: number;
|
|
29
|
+
/** Custom pattern for custom goal type */
|
|
30
|
+
customPattern?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface UltraQAResult {
|
|
33
|
+
/** Whether the goal was met */
|
|
34
|
+
success: boolean;
|
|
35
|
+
/** Number of cycles taken */
|
|
36
|
+
cycles: number;
|
|
37
|
+
/** Reason for exit */
|
|
38
|
+
reason: 'goal_met' | 'max_cycles' | 'same_failure' | 'env_error' | 'cancelled';
|
|
39
|
+
/** Diagnosis message if failed */
|
|
40
|
+
diagnosis?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Read UltraQA state from disk
|
|
44
|
+
*/
|
|
45
|
+
export declare function readUltraQAState(directory: string): UltraQAState | null;
|
|
46
|
+
/**
|
|
47
|
+
* Write UltraQA state to disk
|
|
48
|
+
*/
|
|
49
|
+
export declare function writeUltraQAState(directory: string, state: UltraQAState): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Clear UltraQA state
|
|
52
|
+
*/
|
|
53
|
+
export declare function clearUltraQAState(directory: string): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Check if Ralph Loop is active (mutual exclusion check)
|
|
56
|
+
*/
|
|
57
|
+
export declare function isRalphLoopActive(directory: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Start a new UltraQA cycle
|
|
60
|
+
* Returns false if Ralph Loop is already active (mutual exclusion)
|
|
61
|
+
*/
|
|
62
|
+
export declare function startUltraQA(directory: string, goalType: UltraQAGoalType, sessionId: string, options?: UltraQAOptions): {
|
|
63
|
+
success: boolean;
|
|
64
|
+
error?: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Record a failure and increment cycle
|
|
68
|
+
*/
|
|
69
|
+
export declare function recordFailure(directory: string, failureDescription: string): {
|
|
70
|
+
state: UltraQAState | null;
|
|
71
|
+
shouldExit: boolean;
|
|
72
|
+
reason?: string;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Mark UltraQA as successful
|
|
76
|
+
*/
|
|
77
|
+
export declare function completeUltraQA(directory: string): UltraQAResult | null;
|
|
78
|
+
/**
|
|
79
|
+
* Stop UltraQA with failure
|
|
80
|
+
*/
|
|
81
|
+
export declare function stopUltraQA(directory: string, reason: 'max_cycles' | 'same_failure' | 'env_error', diagnosis: string): UltraQAResult | null;
|
|
82
|
+
/**
|
|
83
|
+
* Cancel UltraQA
|
|
84
|
+
*/
|
|
85
|
+
export declare function cancelUltraQA(directory: string): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Get goal command based on goal type
|
|
88
|
+
*/
|
|
89
|
+
export declare function getGoalCommand(goalType: UltraQAGoalType): string;
|
|
90
|
+
/**
|
|
91
|
+
* Format progress message
|
|
92
|
+
*/
|
|
93
|
+
export declare function formatProgressMessage(cycle: number, maxCycles: number, status: string): string;
|
|
94
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/ultraqa/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAElF,MAAM,WAAW,YAAY;IAC3B,2CAA2C;IAC3C,MAAM,EAAE,OAAO,CAAC;IAChB,sBAAsB;IACtB,SAAS,EAAE,eAAe,CAAC;IAC3B,qDAAqD;IACrD,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,MAAM,EAAE,UAAU,GAAG,YAAY,GAAG,cAAc,GAAG,WAAW,GAAG,WAAW,CAAC;IAC/E,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAuBD;;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