@linxiraos/pi-messenger 1.1.0 → 1.3.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/CHANGELOG.md +741 -676
- package/LICENSE +45 -0
- package/README.md +424 -424
- package/THIRD-PARTY-NOTICES.txt +22951 -0
- package/config-overlay.ts +175 -171
- package/config.ts +221 -209
- package/crew/agents/crew-plan-sync.md +66 -64
- package/crew/agents/crew-planner.md +173 -172
- package/crew/agents/crew-reviewer.md +58 -58
- package/crew/agents/crew-worker.md +130 -129
- package/crew/agents.ts +507 -434
- package/crew/handlers/coordination.ts +350 -332
- package/crew/handlers/plan.ts +988 -906
- package/crew/handlers/review.ts +354 -333
- package/crew/handlers/revise.ts +400 -376
- package/crew/handlers/status.ts +303 -295
- package/crew/handlers/sync.ts +237 -233
- package/crew/handlers/task.ts +820 -792
- package/crew/handlers/team.ts +294 -235
- package/crew/handlers/work.ts +467 -425
- package/crew/id-allocator.ts +30 -30
- package/crew/index.ts +297 -257
- package/crew/live-progress.ts +58 -58
- package/crew/lobby.ts +504 -473
- package/crew/prompt.ts +262 -252
- package/crew/registry.ts +114 -114
- package/crew/spawn.ts +135 -111
- package/crew/state-autonomous.ts +163 -164
- package/crew/state-planning.ts +264 -263
- package/crew/state.ts +20 -20
- package/crew/store.ts +646 -642
- package/crew/task-actions.ts +162 -131
- package/crew/team/store.ts +572 -479
- package/crew/team/subagent-roles.ts +105 -87
- package/crew/team/types.ts +50 -50
- package/crew/types.ts +194 -194
- package/crew/utils/artifacts.ts +57 -62
- package/crew/utils/config.ts +158 -156
- package/crew/utils/discover.ts +221 -219
- package/crew/utils/install.ts +94 -85
- package/crew/utils/migrations.ts +126 -0
- package/crew/utils/progress.ts +191 -187
- package/crew/utils/result.ts +16 -16
- package/crew/utils/risk-labels.ts +5 -7
- package/crew/utils/task-format.ts +14 -14
- package/crew/utils/team-roles.ts +44 -28
- package/crew/utils/truncate.ts +76 -79
- package/crew/utils/verdict.ts +55 -55
- package/editor-binary.ts +150 -0
- package/editor-command.ts +107 -0
- package/editor-target.ts +40 -0
- package/feed.ts +321 -268
- package/handlers.ts +1041 -1107
- package/index.ts +1314 -1206
- package/install.mjs +187 -189
- package/lib.ts +587 -467
- package/overlay-actions.ts +519 -511
- package/overlay-coordinator.ts +150 -150
- package/overlay-render.ts +770 -676
- package/overlay.ts +872 -830
- package/package.json +64 -60
- package/paths.ts +60 -0
- package/skills/pi-messenger-crew/SKILL.md +375 -347
- package/store.ts +1147 -1139
- package/teamagent-command.ts +321 -0
- package/vitest.config.ts +10 -10
package/crew/types.ts
CHANGED
|
@@ -1,194 +1,194 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Crew - Type Definitions
|
|
3
|
-
*
|
|
4
|
-
* Simplified PRD-based workflow types.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { MaxOutputConfig } from "./utils/truncate.ts";
|
|
8
|
-
import type { AgentProgress } from "./utils/progress.ts";
|
|
9
|
-
import type { CrewAgentConfig } from "./utils/discover.ts";
|
|
10
|
-
|
|
11
|
-
// =============================================================================
|
|
12
|
-
// Plan Types
|
|
13
|
-
// =============================================================================
|
|
14
|
-
|
|
15
|
-
export interface Plan {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// =============================================================================
|
|
25
|
-
// Task Types
|
|
26
|
-
// =============================================================================
|
|
27
|
-
|
|
28
|
-
export type TaskStatus = "todo" | "in_progress" | "done" | "blocked";
|
|
29
|
-
|
|
30
|
-
export interface TaskEvidence {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export type TaskApprovalDecisionStatus = "pending" | "approved" | "rejected";
|
|
37
|
-
export type TaskApprovalStatus = "not_required" | TaskApprovalDecisionStatus;
|
|
38
|
-
|
|
39
|
-
interface TaskApprovalMetadata {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export type TaskApproval =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
export interface Task {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface ReviewFeedback {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// =============================================================================
|
|
84
|
-
// Crew Params (Tool Parameters)
|
|
85
|
-
// =============================================================================
|
|
86
|
-
|
|
87
|
-
export interface CrewParams {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// =============================================================================
|
|
148
|
-
// Review Types
|
|
149
|
-
// =============================================================================
|
|
150
|
-
|
|
151
|
-
export type ReviewVerdict = "SHIP" | "NEEDS_WORK" | "MAJOR_RETHINK";
|
|
152
|
-
|
|
153
|
-
export interface ReviewResult {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// =============================================================================
|
|
161
|
-
// Agent Spawning Types
|
|
162
|
-
// =============================================================================
|
|
163
|
-
|
|
164
|
-
export interface AgentTask {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export interface AgentResult {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// =============================================================================
|
|
191
|
-
// Callback Types
|
|
192
|
-
// =============================================================================
|
|
193
|
-
|
|
194
|
-
export type AppendEntryFn = (type: string, data: unknown) => void;
|
|
1
|
+
/**
|
|
2
|
+
* Crew - Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Simplified PRD-based workflow types.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { MaxOutputConfig } from "./utils/truncate.ts";
|
|
8
|
+
import type { AgentProgress } from "./utils/progress.ts";
|
|
9
|
+
import type { CrewAgentConfig } from "./utils/discover.ts";
|
|
10
|
+
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// Plan Types
|
|
13
|
+
// =============================================================================
|
|
14
|
+
|
|
15
|
+
export interface Plan {
|
|
16
|
+
prd: string; // Path to PRD file (relative to cwd)
|
|
17
|
+
prompt?: string; // Inline prompt text (when no PRD file)
|
|
18
|
+
created_at: string; // ISO timestamp
|
|
19
|
+
updated_at: string; // ISO timestamp
|
|
20
|
+
task_count: number; // Total tasks
|
|
21
|
+
completed_count: number; // Completed tasks
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// =============================================================================
|
|
25
|
+
// Task Types
|
|
26
|
+
// =============================================================================
|
|
27
|
+
|
|
28
|
+
export type TaskStatus = "todo" | "in_progress" | "done" | "blocked";
|
|
29
|
+
|
|
30
|
+
export interface TaskEvidence {
|
|
31
|
+
commits?: string[]; // Commit SHAs
|
|
32
|
+
tests?: string[]; // Test commands/files run
|
|
33
|
+
prs?: string[]; // PR URLs
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type TaskApprovalDecisionStatus = "pending" | "approved" | "rejected";
|
|
37
|
+
export type TaskApprovalStatus = "not_required" | TaskApprovalDecisionStatus;
|
|
38
|
+
|
|
39
|
+
interface TaskApprovalMetadata {
|
|
40
|
+
plan?: string;
|
|
41
|
+
feedback?: string;
|
|
42
|
+
decided_by?: string;
|
|
43
|
+
decided_at?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type TaskApproval =
|
|
47
|
+
| ({ required: false; status: "not_required" } & TaskApprovalMetadata)
|
|
48
|
+
| ({ required: true; status: TaskApprovalDecisionStatus } & TaskApprovalMetadata);
|
|
49
|
+
|
|
50
|
+
export interface Task {
|
|
51
|
+
id: string; // task-N format
|
|
52
|
+
title: string;
|
|
53
|
+
status: TaskStatus;
|
|
54
|
+
milestone?: boolean;
|
|
55
|
+
model?: string;
|
|
56
|
+
role?: string; // Team role assignment
|
|
57
|
+
risk_labels?: string[]; // Team risk labels for approval policy
|
|
58
|
+
approval?: TaskApproval; // Team lead approval state
|
|
59
|
+
depends_on: string[]; // Task IDs this depends on
|
|
60
|
+
skills?: string[]; // Skill names from planner
|
|
61
|
+
created_at: string; // ISO timestamp
|
|
62
|
+
updated_at: string; // ISO timestamp
|
|
63
|
+
started_at?: string; // When task.start was called
|
|
64
|
+
completed_at?: string; // When task.done was called
|
|
65
|
+
base_commit?: string; // Git commit SHA at task.start
|
|
66
|
+
assigned_to?: string; // Agent name currently working on it
|
|
67
|
+
summary?: string; // Completion summary from task.done
|
|
68
|
+
evidence?: TaskEvidence; // Evidence from task.done
|
|
69
|
+
blocked_reason?: string; // Reason from task.block
|
|
70
|
+
attempt_count: number; // How many times attempted (for auto-block)
|
|
71
|
+
review_count?: number; // How many times reviewed
|
|
72
|
+
last_review?: ReviewFeedback; // Feedback from last review (for retry)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface ReviewFeedback {
|
|
76
|
+
verdict: ReviewVerdict;
|
|
77
|
+
summary: string;
|
|
78
|
+
issues: string[];
|
|
79
|
+
suggestions: string[];
|
|
80
|
+
reviewed_at: string; // ISO timestamp
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// =============================================================================
|
|
84
|
+
// Crew Params (Tool Parameters)
|
|
85
|
+
// =============================================================================
|
|
86
|
+
|
|
87
|
+
export interface CrewParams {
|
|
88
|
+
// Action
|
|
89
|
+
action?: string;
|
|
90
|
+
|
|
91
|
+
// Plan
|
|
92
|
+
prd?: string; // PRD file path for plan action
|
|
93
|
+
|
|
94
|
+
// Task IDs
|
|
95
|
+
id?: string; // Task ID (task-N)
|
|
96
|
+
taskId?: string; // Swarm task ID (for claim/unclaim/complete)
|
|
97
|
+
|
|
98
|
+
// Creation
|
|
99
|
+
title?: string;
|
|
100
|
+
dependsOn?: string[];
|
|
101
|
+
role?: string;
|
|
102
|
+
riskLabels?: string[];
|
|
103
|
+
approval?: TaskApproval;
|
|
104
|
+
|
|
105
|
+
// Completion
|
|
106
|
+
summary?: string;
|
|
107
|
+
evidence?: TaskEvidence;
|
|
108
|
+
|
|
109
|
+
// Content
|
|
110
|
+
content?: string; // Task description/spec content
|
|
111
|
+
count?: number;
|
|
112
|
+
subtasks?: { title: string; content?: string }[];
|
|
113
|
+
|
|
114
|
+
// Review / Team memory
|
|
115
|
+
target?: string; // Task ID to review
|
|
116
|
+
type?: "plan" | "impl" | "decision" | "interface" | "risk" | "handoff";
|
|
117
|
+
|
|
118
|
+
// Plan options
|
|
119
|
+
autoWork?: boolean;
|
|
120
|
+
|
|
121
|
+
// Work options
|
|
122
|
+
autonomous?: boolean;
|
|
123
|
+
concurrency?: number;
|
|
124
|
+
model?: string;
|
|
125
|
+
|
|
126
|
+
// Task reset
|
|
127
|
+
cascade?: boolean;
|
|
128
|
+
|
|
129
|
+
// Revision
|
|
130
|
+
prompt?: string;
|
|
131
|
+
|
|
132
|
+
// Feed
|
|
133
|
+
limit?: number;
|
|
134
|
+
|
|
135
|
+
// Coordination
|
|
136
|
+
spec?: string;
|
|
137
|
+
to?: string | string[];
|
|
138
|
+
message?: string;
|
|
139
|
+
replyTo?: string;
|
|
140
|
+
paths?: string[];
|
|
141
|
+
reason?: string;
|
|
142
|
+
name?: string;
|
|
143
|
+
notes?: string;
|
|
144
|
+
autoRegisterPath?: "add" | "remove" | "list";
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// =============================================================================
|
|
148
|
+
// Review Types
|
|
149
|
+
// =============================================================================
|
|
150
|
+
|
|
151
|
+
export type ReviewVerdict = "SHIP" | "NEEDS_WORK" | "MAJOR_RETHINK";
|
|
152
|
+
|
|
153
|
+
export interface ReviewResult {
|
|
154
|
+
verdict: ReviewVerdict;
|
|
155
|
+
summary: string;
|
|
156
|
+
issues?: string[];
|
|
157
|
+
suggestions?: string[];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// =============================================================================
|
|
161
|
+
// Agent Spawning Types
|
|
162
|
+
// =============================================================================
|
|
163
|
+
|
|
164
|
+
export interface AgentTask {
|
|
165
|
+
agent: string;
|
|
166
|
+
task: string;
|
|
167
|
+
taskId?: string;
|
|
168
|
+
modelOverride?: string;
|
|
169
|
+
maxOutput?: MaxOutputConfig;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface AgentResult {
|
|
173
|
+
agent: string;
|
|
174
|
+
exitCode: number;
|
|
175
|
+
output: string;
|
|
176
|
+
truncated: boolean;
|
|
177
|
+
progress: AgentProgress;
|
|
178
|
+
config?: CrewAgentConfig;
|
|
179
|
+
taskId?: string;
|
|
180
|
+
wasGracefullyShutdown?: boolean;
|
|
181
|
+
error?: string;
|
|
182
|
+
artifactPaths?: {
|
|
183
|
+
input: string;
|
|
184
|
+
output: string;
|
|
185
|
+
jsonl: string;
|
|
186
|
+
metadata: string;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// =============================================================================
|
|
191
|
+
// Callback Types
|
|
192
|
+
// =============================================================================
|
|
193
|
+
|
|
194
|
+
export type AppendEntryFn = (type: string, data: unknown) => void;
|
package/crew/utils/artifacts.ts
CHANGED
|
@@ -1,62 +1,57 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Crew - Debug Artifacts
|
|
3
|
-
*
|
|
4
|
-
* Writes debug files for troubleshooting agent failures.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import * as fs from "node:fs";
|
|
8
|
-
import * as path from "node:path";
|
|
9
|
-
|
|
10
|
-
export interface ArtifactPaths {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function getArtifactPaths(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function appendJsonl(filePath: string, line: string): void {
|
|
60
|
-
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
61
|
-
fs.appendFileSync(filePath, `${line}\n`);
|
|
62
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Crew - Debug Artifacts
|
|
3
|
+
*
|
|
4
|
+
* Writes debug files for troubleshooting agent failures.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as fs from "node:fs";
|
|
8
|
+
import * as path from "node:path";
|
|
9
|
+
|
|
10
|
+
export interface ArtifactPaths {
|
|
11
|
+
inputPath: string;
|
|
12
|
+
outputPath: string;
|
|
13
|
+
jsonlPath: string;
|
|
14
|
+
metadataPath: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getArtifactPaths(artifactsDir: string, runId: string, agent: string, index?: number): ArtifactPaths {
|
|
18
|
+
const suffix = index !== undefined ? `_${index}` : "";
|
|
19
|
+
const safeAgent = agent.replace(/[^\w.-]/g, "_");
|
|
20
|
+
const base = `${runId}_${safeAgent}${suffix}`;
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
inputPath: path.join(artifactsDir, `${base}_input.md`),
|
|
24
|
+
outputPath: path.join(artifactsDir, `${base}_output.md`),
|
|
25
|
+
jsonlPath: path.join(artifactsDir, `${base}.jsonl`),
|
|
26
|
+
metadataPath: path.join(artifactsDir, `${base}_meta.json`),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function ensureArtifactsDir(dir: string, cleanupDays?: number): void {
|
|
31
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
32
|
+
if (cleanupDays === undefined || cleanupDays <= 0) return;
|
|
33
|
+
|
|
34
|
+
const cutoff = Date.now() - cleanupDays * 24 * 60 * 60 * 1000;
|
|
35
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
36
|
+
if (!entry.isFile()) continue;
|
|
37
|
+
const filePath = path.join(dir, entry.name);
|
|
38
|
+
try {
|
|
39
|
+
if (fs.statSync(filePath).mtimeMs < cutoff) fs.rmSync(filePath, { force: true });
|
|
40
|
+
} catch {}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function writeArtifact(filePath: string, content: string): void {
|
|
45
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
46
|
+
fs.writeFileSync(filePath, content, "utf-8");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function writeMetadata(filePath: string, metadata: object): void {
|
|
50
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
51
|
+
fs.writeFileSync(filePath, JSON.stringify(metadata, null, 2), "utf-8");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function appendJsonl(filePath: string, line: string): void {
|
|
55
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
56
|
+
fs.appendFileSync(filePath, `${line}\n`);
|
|
57
|
+
}
|