pi-mission-control 0.0.0-dev
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 +205 -0
- package/agents/auditor.md +45 -0
- package/agents/worker.md +44 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +526 -0
- package/dist/index.js.map +1 -0
- package/dist/state.d.ts +265 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +474 -0
- package/dist/state.js.map +1 -0
- package/dist/tools/add-phase.d.ts +28 -0
- package/dist/tools/add-phase.d.ts.map +1 -0
- package/dist/tools/add-phase.js +69 -0
- package/dist/tools/add-phase.js.map +1 -0
- package/dist/tools/add-task.d.ts +30 -0
- package/dist/tools/add-task.d.ts.map +1 -0
- package/dist/tools/add-task.js +85 -0
- package/dist/tools/add-task.js.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +16 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/init.d.ts +34 -0
- package/dist/tools/init.d.ts.map +1 -0
- package/dist/tools/init.js +75 -0
- package/dist/tools/init.js.map +1 -0
- package/dist/tools/mission-complete.d.ts +30 -0
- package/dist/tools/mission-complete.d.ts.map +1 -0
- package/dist/tools/mission-complete.js +85 -0
- package/dist/tools/mission-complete.js.map +1 -0
- package/dist/tools/mission-resume.d.ts +35 -0
- package/dist/tools/mission-resume.d.ts.map +1 -0
- package/dist/tools/mission-resume.js +87 -0
- package/dist/tools/mission-resume.js.map +1 -0
- package/dist/tools/scaffold.d.ts +24 -0
- package/dist/tools/scaffold.d.ts.map +1 -0
- package/dist/tools/scaffold.js +129 -0
- package/dist/tools/scaffold.js.map +1 -0
- package/dist/tools/update-phase.d.ts +33 -0
- package/dist/tools/update-phase.d.ts.map +1 -0
- package/dist/tools/update-phase.js +101 -0
- package/dist/tools/update-phase.js.map +1 -0
- package/dist/tools/update-task.d.ts +34 -0
- package/dist/tools/update-task.d.ts.map +1 -0
- package/dist/tools/update-task.js +104 -0
- package/dist/tools/update-task.js.map +1 -0
- package/dist/tui/dashboard.d.ts +146 -0
- package/dist/tui/dashboard.d.ts.map +1 -0
- package/dist/tui/dashboard.js +381 -0
- package/dist/tui/dashboard.js.map +1 -0
- package/dist/tui/header.d.ts +39 -0
- package/dist/tui/header.d.ts.map +1 -0
- package/dist/tui/header.js +62 -0
- package/dist/tui/header.js.map +1 -0
- package/dist/tui/idle-view.d.ts +44 -0
- package/dist/tui/idle-view.d.ts.map +1 -0
- package/dist/tui/idle-view.js +87 -0
- package/dist/tui/idle-view.js.map +1 -0
- package/dist/tui/index.d.ts +13 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +15 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/past-runs.d.ts +49 -0
- package/dist/tui/past-runs.d.ts.map +1 -0
- package/dist/tui/past-runs.js +207 -0
- package/dist/tui/past-runs.js.map +1 -0
- package/dist/tui/phases-panel.d.ts +46 -0
- package/dist/tui/phases-panel.d.ts.map +1 -0
- package/dist/tui/phases-panel.js +161 -0
- package/dist/tui/phases-panel.js.map +1 -0
- package/dist/tui/progress-bar.d.ts +37 -0
- package/dist/tui/progress-bar.d.ts.map +1 -0
- package/dist/tui/progress-bar.js +123 -0
- package/dist/tui/progress-bar.js.map +1 -0
- package/dist/tui/styles.d.ts +8 -0
- package/dist/tui/styles.d.ts.map +1 -0
- package/dist/tui/styles.js +22 -0
- package/dist/tui/styles.js.map +1 -0
- package/dist/tui/tasks-panel.d.ts +48 -0
- package/dist/tui/tasks-panel.d.ts.map +1 -0
- package/dist/tui/tasks-panel.js +191 -0
- package/dist/tui/tasks-panel.js.map +1 -0
- package/package.json +42 -0
- package/skills/mission-memory/SKILL.md +88 -0
- package/skills/mission-orchestrator/SKILL.md +167 -0
- package/skills/mission-pm/SKILL.md +83 -0
- package/skills/mission-research/SKILL.md +66 -0
- package/skills/mission-tech-lead/SKILL.md +68 -0
- package/src/index.ts +659 -0
- package/src/state.ts +623 -0
- package/src/tools/add-phase.ts +98 -0
- package/src/tools/add-task.ts +121 -0
- package/src/tools/index.ts +18 -0
- package/src/tools/init.ts +109 -0
- package/src/tools/mission-complete.ts +118 -0
- package/src/tools/mission-resume.ts +119 -0
- package/src/tools/scaffold.ts +167 -0
- package/src/tools/update-phase.ts +140 -0
- package/src/tools/update-task.ts +145 -0
- package/src/tui/dashboard.ts +441 -0
- package/src/tui/header.ts +85 -0
- package/src/tui/idle-view.ts +114 -0
- package/src/tui/index.ts +20 -0
- package/src/tui/past-runs.ts +261 -0
- package/src/tui/phases-panel.ts +199 -0
- package/src/tui/progress-bar.ts +152 -0
- package/src/tui/styles.ts +27 -0
- package/src/tui/tasks-panel.ts +228 -0
- package/templates/state.json +5 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mission_scaffold tool
|
|
3
|
+
*
|
|
4
|
+
* First-time setup tool - copies bundled worker/auditor agents and skills
|
|
5
|
+
* into project .pi dirs and creates mission-control directory structure.
|
|
6
|
+
*
|
|
7
|
+
* This is a command-only tool (not exposed to agents).
|
|
8
|
+
*/
|
|
9
|
+
import * as path from "path";
|
|
10
|
+
import * as fs from "fs";
|
|
11
|
+
import { fileURLToPath } from "url";
|
|
12
|
+
import { getProjectRoot, getMissionControlDir, getMemoryDir, getRunsDir, ensureDir, copyDir, fileExists, writeJson, defaultState } from "../state.js";
|
|
13
|
+
const packageRoot = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
14
|
+
/**
|
|
15
|
+
* Get the bundled agents directory path (within the npm package)
|
|
16
|
+
*/
|
|
17
|
+
function getBundledAgentsDir() {
|
|
18
|
+
return path.join(packageRoot, "agents");
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the bundled skills directory path (within the npm package)
|
|
22
|
+
*/
|
|
23
|
+
function getBundledSkillsDir() {
|
|
24
|
+
return path.join(packageRoot, "skills");
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get the bundled templates directory path (within the npm package)
|
|
28
|
+
*/
|
|
29
|
+
function getBundledTemplatesDir() {
|
|
30
|
+
return path.join(packageRoot, "templates");
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get target paths in the project
|
|
34
|
+
*/
|
|
35
|
+
function getTargetPaths() {
|
|
36
|
+
const projectRoot = getProjectRoot();
|
|
37
|
+
return {
|
|
38
|
+
agents: path.join(projectRoot, ".pi", "agents"),
|
|
39
|
+
skills: path.join(projectRoot, ".pi", "skills"),
|
|
40
|
+
missionControl: getMissionControlDir(),
|
|
41
|
+
memory: getMemoryDir(),
|
|
42
|
+
runs: getRunsDir()
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Scaffold the mission-control environment
|
|
47
|
+
*
|
|
48
|
+
* Copies bundled worker/auditor agents and skills to project .pi dirs and creates
|
|
49
|
+
* the mission-control directory structure. Non-destructive -
|
|
50
|
+
* skips existing files rather than overwriting.
|
|
51
|
+
*/
|
|
52
|
+
export function missionScaffold() {
|
|
53
|
+
const result = {
|
|
54
|
+
success: true,
|
|
55
|
+
message: "",
|
|
56
|
+
created: [],
|
|
57
|
+
skipped: [],
|
|
58
|
+
errors: []
|
|
59
|
+
};
|
|
60
|
+
try {
|
|
61
|
+
const bundledDirs = {
|
|
62
|
+
agents: getBundledAgentsDir(),
|
|
63
|
+
skills: getBundledSkillsDir(),
|
|
64
|
+
templates: getBundledTemplatesDir()
|
|
65
|
+
};
|
|
66
|
+
const targetPaths = getTargetPaths();
|
|
67
|
+
// Verify bundled directories exist
|
|
68
|
+
for (const [name, dirPath] of Object.entries(bundledDirs)) {
|
|
69
|
+
if (!fileExists(dirPath)) {
|
|
70
|
+
result.errors.push(`Bundled ${name} directory not found: ${dirPath}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (result.errors.length > 0) {
|
|
74
|
+
result.success = false;
|
|
75
|
+
result.message = "Scaffolding failed: bundled resources not found";
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
// Create base directory structure
|
|
79
|
+
ensureDir(targetPaths.missionControl);
|
|
80
|
+
ensureDir(targetPaths.memory);
|
|
81
|
+
ensureDir(targetPaths.runs);
|
|
82
|
+
result.created.push(".pi/mission-control/");
|
|
83
|
+
result.created.push(".pi/mission-control/memory/");
|
|
84
|
+
result.created.push(".pi/mission-control/runs/");
|
|
85
|
+
// Create state.json if it doesn't exist
|
|
86
|
+
const statePath = path.join(targetPaths.missionControl, "state.json");
|
|
87
|
+
if (!fileExists(statePath)) {
|
|
88
|
+
writeJson(statePath, defaultState);
|
|
89
|
+
result.created.push(".pi/mission-control/state.json");
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
result.skipped.push(".pi/mission-control/state.json (already exists)");
|
|
93
|
+
}
|
|
94
|
+
// Copy worker/auditor agents (skip existing files)
|
|
95
|
+
const agentsCopied = copyDir(bundledDirs.agents, targetPaths.agents, true);
|
|
96
|
+
if (agentsCopied > 0) {
|
|
97
|
+
result.created.push(`.pi/agents/ (${agentsCopied} files copied)`);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
result.skipped.push(".pi/agents/ (all files already exist)");
|
|
101
|
+
}
|
|
102
|
+
// Copy skills (skip existing files)
|
|
103
|
+
const skillsCopied = copyDir(bundledDirs.skills, targetPaths.skills, true);
|
|
104
|
+
if (skillsCopied > 0) {
|
|
105
|
+
result.created.push(`.pi/skills/ (${skillsCopied} files copied)`);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
result.skipped.push(".pi/skills/ (all files already exist)");
|
|
109
|
+
}
|
|
110
|
+
// Create long_term.md if it doesn't exist
|
|
111
|
+
const longTermPath = path.join(targetPaths.memory, "long_term.md");
|
|
112
|
+
if (!fileExists(longTermPath)) {
|
|
113
|
+
fs.writeFileSync(longTermPath, "# Long-term Memory\n\nDistilled knowledge from past missions.\n\n## Repo Conventions\n\n## Tooling Quirks\n\n## Architecture Decisions\n\n## Common Failures\n\n## Performance Notes\n", "utf-8");
|
|
114
|
+
result.created.push(".pi/mission-control/memory/long_term.md");
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
result.skipped.push(".pi/mission-control/memory/long_term.md (already exists)");
|
|
118
|
+
}
|
|
119
|
+
result.success = true;
|
|
120
|
+
result.message = "Mission Control scaffolding complete";
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
result.success = false;
|
|
124
|
+
result.message = `Scaffolding error: ${error instanceof Error ? error.message : String(error)}`;
|
|
125
|
+
result.errors.push(String(error));
|
|
126
|
+
}
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=scaffold.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../../src/tools/scaffold.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,UAAU,EACV,SAAS,EACT,OAAO,EACP,UAAU,EACV,SAAS,EACT,YAAY,EAEb,MAAM,aAAa,CAAC;AAUrB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAExF;;GAEG;AACH,SAAS,mBAAmB;IAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB;IAC1B,OAAO,IAAI,CAAC,IAAI,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Agent tool to update a phase's status.
|
|
5
|
+
* Auto-sets started_at when transitioning to "in_progress".
|
|
6
|
+
* Auto-sets finish_at when transitioning to "done" or "removed".
|
|
7
|
+
*
|
|
8
|
+
* Used by: mission-orchestrator skill
|
|
9
|
+
*/
|
|
10
|
+
import { PhaseStatus } from "../state.js";
|
|
11
|
+
export interface UpdatePhaseParams {
|
|
12
|
+
phase_id: string;
|
|
13
|
+
status: PhaseStatus;
|
|
14
|
+
}
|
|
15
|
+
export interface UpdatePhaseResult {
|
|
16
|
+
success: boolean;
|
|
17
|
+
message: string;
|
|
18
|
+
phaseId: string | null;
|
|
19
|
+
previousStatus: PhaseStatus | null;
|
|
20
|
+
newStatus: PhaseStatus | null;
|
|
21
|
+
startedAt: string | null;
|
|
22
|
+
finishAt: string | null;
|
|
23
|
+
errors: string[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Update a phase's status in the active mission run
|
|
27
|
+
*
|
|
28
|
+
* @param params.phase_id - ID of the phase to update
|
|
29
|
+
* @param params.status - New status ("pending" | "in_progress" | "done" | "removed")
|
|
30
|
+
* @returns Result with updated phase info
|
|
31
|
+
*/
|
|
32
|
+
export declare function updatePhase(params: UpdatePhaseParams): UpdatePhaseResult;
|
|
33
|
+
//# sourceMappingURL=update-phase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-phase.d.ts","sourceRoot":"","sources":["../../src/tools/update-phase.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAOL,WAAW,EACZ,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,cAAc,EAAE,WAAW,GAAG,IAAI,CAAC;IACnC,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAgGxE"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* update_phase tool
|
|
3
|
+
*
|
|
4
|
+
* Agent tool to update a phase's status.
|
|
5
|
+
* Auto-sets started_at when transitioning to "in_progress".
|
|
6
|
+
* Auto-sets finish_at when transitioning to "done" or "removed".
|
|
7
|
+
*
|
|
8
|
+
* Used by: mission-orchestrator skill
|
|
9
|
+
*/
|
|
10
|
+
import { readState, readRun, writeRun, findPhase, updatePhaseInRun, getTimestamp } from "../state.js";
|
|
11
|
+
/**
|
|
12
|
+
* Update a phase's status in the active mission run
|
|
13
|
+
*
|
|
14
|
+
* @param params.phase_id - ID of the phase to update
|
|
15
|
+
* @param params.status - New status ("pending" | "in_progress" | "done" | "removed")
|
|
16
|
+
* @returns Result with updated phase info
|
|
17
|
+
*/
|
|
18
|
+
export function updatePhase(params) {
|
|
19
|
+
const result = {
|
|
20
|
+
success: false,
|
|
21
|
+
message: "",
|
|
22
|
+
phaseId: null,
|
|
23
|
+
previousStatus: null,
|
|
24
|
+
newStatus: null,
|
|
25
|
+
startedAt: null,
|
|
26
|
+
finishAt: null,
|
|
27
|
+
errors: []
|
|
28
|
+
};
|
|
29
|
+
try {
|
|
30
|
+
// Validate parameters
|
|
31
|
+
if (!params.phase_id || params.phase_id.trim() === "") {
|
|
32
|
+
result.errors.push("Phase ID is required");
|
|
33
|
+
result.message = "Failed to update phase: phase_id is required";
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
if (!params.status) {
|
|
37
|
+
result.errors.push("Status is required");
|
|
38
|
+
result.message = "Failed to update phase: status is required";
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
const validStatuses = ["pending", "in_progress", "done", "removed"];
|
|
42
|
+
if (!validStatuses.includes(params.status)) {
|
|
43
|
+
result.errors.push(`Invalid status: ${params.status}. Must be one of: ${validStatuses.join(", ")}`);
|
|
44
|
+
result.message = "Failed to update phase: invalid status";
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
// Get active run
|
|
48
|
+
const state = readState();
|
|
49
|
+
if (!state.active_run_id) {
|
|
50
|
+
result.errors.push("No active run");
|
|
51
|
+
result.message = "Failed to update phase: no active mission run";
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
// Read run.json
|
|
55
|
+
const run = readRun(state.active_run_id);
|
|
56
|
+
if (!run) {
|
|
57
|
+
result.errors.push(`Run not found: ${state.active_run_id}`);
|
|
58
|
+
result.message = "Failed to update phase: run not found";
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
// Find phase
|
|
62
|
+
const phase = findPhase(run, params.phase_id.trim());
|
|
63
|
+
if (!phase) {
|
|
64
|
+
result.errors.push(`Phase not found: ${params.phase_id}`);
|
|
65
|
+
result.message = "Failed to update phase: phase not found";
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
// Capture previous status
|
|
69
|
+
result.previousStatus = phase.status;
|
|
70
|
+
result.phaseId = phase.id;
|
|
71
|
+
// Calculate timestamp updates
|
|
72
|
+
const updates = {
|
|
73
|
+
status: params.status
|
|
74
|
+
};
|
|
75
|
+
const now = getTimestamp();
|
|
76
|
+
// Set started_at when transitioning to in_progress
|
|
77
|
+
if (params.status === "in_progress" && phase.status !== "in_progress") {
|
|
78
|
+
updates.started_at = now;
|
|
79
|
+
result.startedAt = now;
|
|
80
|
+
}
|
|
81
|
+
// Set finish_at when transitioning to terminal states
|
|
82
|
+
const terminalStatuses = ["done", "removed"];
|
|
83
|
+
if (terminalStatuses.includes(params.status) && !terminalStatuses.includes(phase.status)) {
|
|
84
|
+
updates.finish_at = now;
|
|
85
|
+
result.finishAt = now;
|
|
86
|
+
}
|
|
87
|
+
// Update run
|
|
88
|
+
const updatedRun = updatePhaseInRun(run, phase.id, updates);
|
|
89
|
+
writeRun(updatedRun);
|
|
90
|
+
result.success = true;
|
|
91
|
+
result.newStatus = params.status;
|
|
92
|
+
result.message = `Phase ${phase.id} updated: ${phase.status} → ${params.status}`;
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
result.success = false;
|
|
96
|
+
result.message = `Error updating phase: ${error instanceof Error ? error.message : String(error)}`;
|
|
97
|
+
result.errors.push(String(error));
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=update-phase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-phase.js","sourceRoot":"","sources":["../../src/tools/update-phase.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,SAAS,EACT,OAAO,EACP,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,YAAY,EAEb,MAAM,aAAa,CAAC;AAkBrB;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,MAAyB;IACnD,MAAM,MAAM,GAAsB;QAChC,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,IAAI;QACb,cAAc,EAAE,IAAI;QACpB,SAAS,EAAE,IAAI;QACf,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE;KACX,CAAC;IAEF,IAAI,CAAC;QACH,sBAAsB;QACtB,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACtD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;YAC3C,MAAM,CAAC,OAAO,GA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AM,CAAC;QACjC,MAAM,CAAC,OAAO,GAAG,SAAS,KAAK,CAAC,EAAE,aAAa,KAAK,CAAC,MAAM,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;IAEnF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC;QACvB,MAAM,CAAC,OAAO,GAAG,yBAAyB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACnG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* update_task tool
|
|
3
|
+
*
|
|
4
|
+
* Agent tool to update a task's status.
|
|
5
|
+
* Auto-sets started_at when transitioning to "in_progress".
|
|
6
|
+
* Auto-sets finish_at when transitioning to "done", "failed", or "removed".
|
|
7
|
+
*
|
|
8
|
+
* Used by: mission-orchestrator skill
|
|
9
|
+
*/
|
|
10
|
+
import { TaskStatus } from "../state.js";
|
|
11
|
+
export interface UpdateTaskParams {
|
|
12
|
+
task_id: string;
|
|
13
|
+
status: TaskStatus;
|
|
14
|
+
}
|
|
15
|
+
export interface UpdateTaskResult {
|
|
16
|
+
success: boolean;
|
|
17
|
+
message: string;
|
|
18
|
+
taskId: string | null;
|
|
19
|
+
phaseId: string | null;
|
|
20
|
+
previousStatus: TaskStatus | null;
|
|
21
|
+
newStatus: TaskStatus | null;
|
|
22
|
+
startedAt: string | null;
|
|
23
|
+
finishAt: string | null;
|
|
24
|
+
errors: string[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Update a task's status in the active mission run
|
|
28
|
+
*
|
|
29
|
+
* @param params.task_id - ID of the task to update (e.g., "phase1-task1")
|
|
30
|
+
* @param params.status - New status ("pending" | "in_progress" | "done" | "failed" | "removed")
|
|
31
|
+
* @returns Result with updated task info
|
|
32
|
+
*/
|
|
33
|
+
export declare function updateTask(params: UpdateTaskParams): UpdateTaskResult;
|
|
34
|
+
//# sourceMappingURL=update-task.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-task.d.ts","sourceRoot":"","sources":["../../src/tools/update-task.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAOL,UAAU,EACX,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,cAAc,EAAE,UAAU,GAAG,IAAI,CAAC;IAClC,SAAS,EAAE,UAAU,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAoGrE"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* update_task tool
|
|
3
|
+
*
|
|
4
|
+
* Agent tool to update a task's status.
|
|
5
|
+
* Auto-sets started_at when transitioning to "in_progress".
|
|
6
|
+
* Auto-sets finish_at when transitioning to "done", "failed", or "removed".
|
|
7
|
+
*
|
|
8
|
+
* Used by: mission-orchestrator skill
|
|
9
|
+
*/
|
|
10
|
+
import { readState, readRun, writeRun, findTask, updateTaskInRun, getTimestamp } from "../state.js";
|
|
11
|
+
/**
|
|
12
|
+
* Update a task's status in the active mission run
|
|
13
|
+
*
|
|
14
|
+
* @param params.task_id - ID of the task to update (e.g., "phase1-task1")
|
|
15
|
+
* @param params.status - New status ("pending" | "in_progress" | "done" | "failed" | "removed")
|
|
16
|
+
* @returns Result with updated task info
|
|
17
|
+
*/
|
|
18
|
+
export function updateTask(params) {
|
|
19
|
+
const result = {
|
|
20
|
+
success: false,
|
|
21
|
+
message: "",
|
|
22
|
+
taskId: null,
|
|
23
|
+
phaseId: null,
|
|
24
|
+
previousStatus: null,
|
|
25
|
+
newStatus: null,
|
|
26
|
+
startedAt: null,
|
|
27
|
+
finishAt: null,
|
|
28
|
+
errors: []
|
|
29
|
+
};
|
|
30
|
+
try {
|
|
31
|
+
// Validate parameters
|
|
32
|
+
if (!params.task_id || params.task_id.trim() === "") {
|
|
33
|
+
result.errors.push("Task ID is required");
|
|
34
|
+
result.message = "Failed to update task: task_id is required";
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
if (!params.status) {
|
|
38
|
+
result.errors.push("Status is required");
|
|
39
|
+
result.message = "Failed to update task: status is required";
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
const validStatuses = ["pending", "in_progress", "done", "failed", "removed"];
|
|
43
|
+
if (!validStatuses.includes(params.status)) {
|
|
44
|
+
result.errors.push(`Invalid status: ${params.status}. Must be one of: ${validStatuses.join(", ")}`);
|
|
45
|
+
result.message = "Failed to update task: invalid status";
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
// Get active run
|
|
49
|
+
const state = readState();
|
|
50
|
+
if (!state.active_run_id) {
|
|
51
|
+
result.errors.push("No active run");
|
|
52
|
+
result.message = "Failed to update task: no active mission run";
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
// Read run.json
|
|
56
|
+
const run = readRun(state.active_run_id);
|
|
57
|
+
if (!run) {
|
|
58
|
+
result.errors.push(`Run not found: ${state.active_run_id}`);
|
|
59
|
+
result.message = "Failed to update task: run not found";
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
// Find task
|
|
63
|
+
const taskInfo = findTask(run, params.task_id.trim());
|
|
64
|
+
if (!taskInfo) {
|
|
65
|
+
result.errors.push(`Task not found: ${params.task_id}`);
|
|
66
|
+
result.message = "Failed to update task: task not found";
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
const { task, phase } = taskInfo;
|
|
70
|
+
// Capture previous status
|
|
71
|
+
result.previousStatus = task.status;
|
|
72
|
+
result.taskId = task.id;
|
|
73
|
+
result.phaseId = phase.id;
|
|
74
|
+
// Calculate timestamp updates
|
|
75
|
+
const updates = {
|
|
76
|
+
status: params.status
|
|
77
|
+
};
|
|
78
|
+
const now = getTimestamp();
|
|
79
|
+
// Set started_at when transitioning to in_progress
|
|
80
|
+
if (params.status === "in_progress" && task.status !== "in_progress") {
|
|
81
|
+
updates.started_at = now;
|
|
82
|
+
result.startedAt = now;
|
|
83
|
+
}
|
|
84
|
+
// Set finish_at when transitioning to terminal states
|
|
85
|
+
const terminalStatuses = ["done", "failed", "removed"];
|
|
86
|
+
if (terminalStatuses.includes(params.status) && !terminalStatuses.includes(task.status)) {
|
|
87
|
+
updates.finish_at = now;
|
|
88
|
+
result.finishAt = now;
|
|
89
|
+
}
|
|
90
|
+
// Update run
|
|
91
|
+
const updatedRun = updateTaskInRun(run, task.id, updates);
|
|
92
|
+
writeRun(updatedRun);
|
|
93
|
+
result.success = true;
|
|
94
|
+
result.newStatus = params.status;
|
|
95
|
+
result.message = `Task ${task.id} updated: ${task.status} → ${params.status}`;
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
result.success = false;
|
|
99
|
+
result.message = `Error updating task: ${error instanceof Error ? error.message : String(error)}`;
|
|
100
|
+
result.errors.push(String(error));
|
|
101
|
+
}
|
|
102
|
+
return result;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=update-task.js.map
|
|
@@ -0,0 +1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C;QAClG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mission Control TUI Dashboard
|
|
3
|
+
*
|
|
4
|
+
* Main dashboard component that composes:
|
|
5
|
+
* - Header (run ID, timer, phase)
|
|
6
|
+
* - Phases panel (left)
|
|
7
|
+
* - Tasks panel (right)
|
|
8
|
+
* - Progress bar (bottom)
|
|
9
|
+
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - Keyboard navigation (Up/Down/Left/Right)
|
|
12
|
+
* - Esc to close
|
|
13
|
+
* - Enter to init new mission when idle
|
|
14
|
+
* - Timed refresh for clock/file state
|
|
15
|
+
* - Overlay support via ctx.ui.custom(..., { overlay: true })
|
|
16
|
+
*/
|
|
17
|
+
import type { Theme } from "@mariozechner/pi-coding-agent";
|
|
18
|
+
import type { TUI } from "@mariozechner/pi-tui";
|
|
19
|
+
import type { Run } from "../state.js";
|
|
20
|
+
type DashboardMode = "idle" | "active";
|
|
21
|
+
export interface DashboardProps {
|
|
22
|
+
onClose: () => void;
|
|
23
|
+
onInitMission?: () => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Mission Control Dashboard Component
|
|
27
|
+
*
|
|
28
|
+
* Usage:
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const handle = ctx.ui.custom(
|
|
31
|
+
* (tui, theme, keybindings, done) => new MissionDashboard({ onClose: done }),
|
|
32
|
+
* { overlay: true }
|
|
33
|
+
* );
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare class MissionDashboard {
|
|
37
|
+
private header;
|
|
38
|
+
private phasesPanel;
|
|
39
|
+
private tasksPanel;
|
|
40
|
+
private progressBar;
|
|
41
|
+
private idleView;
|
|
42
|
+
private pastRuns;
|
|
43
|
+
private mode;
|
|
44
|
+
private run;
|
|
45
|
+
private state;
|
|
46
|
+
private refreshInterval;
|
|
47
|
+
private cachedWidth?;
|
|
48
|
+
private cachedLines?;
|
|
49
|
+
private tui;
|
|
50
|
+
private theme;
|
|
51
|
+
private onClose;
|
|
52
|
+
private onInitMission?;
|
|
53
|
+
constructor(props: DashboardProps);
|
|
54
|
+
/**
|
|
55
|
+
* Start the refresh interval for clock/timer updates
|
|
56
|
+
*/
|
|
57
|
+
startRefresh(tui: TUI): void;
|
|
58
|
+
/**
|
|
59
|
+
* Stop the refresh interval
|
|
60
|
+
*/
|
|
61
|
+
stopRefresh(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Refresh data from files
|
|
64
|
+
*/
|
|
65
|
+
refreshData(): void;
|
|
66
|
+
/**
|
|
67
|
+
* Handle init mission action (Enter in idle mode)
|
|
68
|
+
*/
|
|
69
|
+
private handleInitMission;
|
|
70
|
+
/**
|
|
71
|
+
* Handle keyboard input
|
|
72
|
+
*/
|
|
73
|
+
handleInput(data: string): void;
|
|
74
|
+
/**
|
|
75
|
+
* Request a re-render from TUI
|
|
76
|
+
*/
|
|
77
|
+
private requestRender;
|
|
78
|
+
/**
|
|
79
|
+
* Render the dashboard
|
|
80
|
+
*/
|
|
81
|
+
render(width: number, theme: Theme): string[];
|
|
82
|
+
private renderShortcutLegend;
|
|
83
|
+
/**
|
|
84
|
+
* Render idle mode
|
|
85
|
+
*/
|
|
86
|
+
private renderIdle;
|
|
87
|
+
/**
|
|
88
|
+
* Render active mode with a simple 40/60 split
|
|
89
|
+
*/
|
|
90
|
+
private renderActive;
|
|
91
|
+
/**
|
|
92
|
+
* Invalidate cached render output
|
|
93
|
+
*/
|
|
94
|
+
invalidate(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Get current mode
|
|
97
|
+
*/
|
|
98
|
+
getMode(): DashboardMode;
|
|
99
|
+
/**
|
|
100
|
+
* Get active run (if any)
|
|
101
|
+
*/
|
|
102
|
+
getRun(): Run | null;
|
|
103
|
+
/**
|
|
104
|
+
* Dispose of resources
|
|
105
|
+
*/
|
|
106
|
+
dispose(): void;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Open the Mission Control dashboard
|
|
110
|
+
*
|
|
111
|
+
* Usage in extension:
|
|
112
|
+
* ```typescript
|
|
113
|
+
* pi.registerCommand("mission", {
|
|
114
|
+
* handler: async (_args, ctx) => {
|
|
115
|
+
* const result = await ctx.ui.custom<string | null>(
|
|
116
|
+
* (tui, theme, _kb, done) => {
|
|
117
|
+
* const dashboard = new MissionDashboard({
|
|
118
|
+
* onClose: () => done(null),
|
|
119
|
+
* onInitMission: () => {
|
|
120
|
+
* // Trigger mission_init tool
|
|
121
|
+
* done("init");
|
|
122
|
+
* }
|
|
123
|
+
* });
|
|
124
|
+
* dashboard.startRefresh(tui);
|
|
125
|
+
* return dashboard;
|
|
126
|
+
* },
|
|
127
|
+
* { overlay: true }
|
|
128
|
+
* );
|
|
129
|
+
*
|
|
130
|
+
* if (result === "init") {
|
|
131
|
+
* // Handle init action
|
|
132
|
+
* }
|
|
133
|
+
* }
|
|
134
|
+
* });
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
export declare function openMissionControl(ctx: {
|
|
138
|
+
ui: {
|
|
139
|
+
custom: (factory: (tui: TUI, theme: Theme, keybindings: unknown, done: (result: string | null) => void) => MissionDashboard, options: {
|
|
140
|
+
overlay: boolean;
|
|
141
|
+
}) => Promise<string | null>;
|
|
142
|
+
notify: (message: string, type: "info" | "warning" | "error") => void;
|
|
143
|
+
};
|
|
144
|
+
}): Promise<void>;
|
|
145
|
+
export default MissionDashboard;
|
|
146
|
+
//# sourceMappingURL=dashboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/tui/dashboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BA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