@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/handlers/team.ts
CHANGED
|
@@ -1,235 +1,294 @@
|
|
|
1
|
-
import type { ExtensionContext } from "@
|
|
2
|
-
import type { MessengerState } from "../../lib.ts";
|
|
3
|
-
import type { CrewParams } from "../types.ts";
|
|
4
|
-
import { result } from "../utils/result.ts";
|
|
5
|
-
import * as crewStore from "../store.ts";
|
|
6
|
-
import * as teamStore from "../team/store.ts";
|
|
7
|
-
import { TEAM_MEMORY_TYPES, type TeamMemoryType, type TeamProfile } from "../team/types.ts";
|
|
8
|
-
|
|
9
|
-
export async function execute(op: string, params: CrewParams, state: MessengerState, ctx: ExtensionContext) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function memoryType(value: unknown): TeamMemoryType | null {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
1
|
+
import type { ExtensionContext } from "@linxiraos/zeta";
|
|
2
|
+
import type { MessengerState } from "../../lib.ts";
|
|
3
|
+
import type { CrewParams } from "../types.ts";
|
|
4
|
+
import { result } from "../utils/result.ts";
|
|
5
|
+
import * as crewStore from "../store.ts";
|
|
6
|
+
import * as teamStore from "../team/store.ts";
|
|
7
|
+
import { TEAM_MEMORY_TYPES, type TeamMemoryType, type TeamProfile } from "../team/types.ts";
|
|
8
|
+
|
|
9
|
+
export async function execute(op: string, params: CrewParams, state: MessengerState, ctx: ExtensionContext) {
|
|
10
|
+
const cwd = ctx.cwd;
|
|
11
|
+
|
|
12
|
+
switch (op) {
|
|
13
|
+
case "setup":
|
|
14
|
+
return setup(cwd, params);
|
|
15
|
+
case "profile.list":
|
|
16
|
+
return profileList();
|
|
17
|
+
case "profile.use":
|
|
18
|
+
return profileUse(cwd, params);
|
|
19
|
+
case "profile.save":
|
|
20
|
+
return profileSave(cwd, params);
|
|
21
|
+
case "charter.show":
|
|
22
|
+
return charterShow(cwd);
|
|
23
|
+
case "charter.create":
|
|
24
|
+
return charterCreate(cwd, params);
|
|
25
|
+
case "charter.update":
|
|
26
|
+
return charterUpdate(cwd, params);
|
|
27
|
+
case "memory.note":
|
|
28
|
+
return memoryNote(cwd, params, state);
|
|
29
|
+
case "memory.list":
|
|
30
|
+
return memoryList(cwd, params);
|
|
31
|
+
case "roles":
|
|
32
|
+
return roles(cwd);
|
|
33
|
+
case "status":
|
|
34
|
+
return status(cwd);
|
|
35
|
+
default:
|
|
36
|
+
return result(`Unknown team operation: ${op}`, { mode: "team", error: "unknown_operation", operation: op });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function memoryType(value: unknown): TeamMemoryType | null {
|
|
41
|
+
return typeof value === "string" && TEAM_MEMORY_TYPES.includes(value as TeamMemoryType)
|
|
42
|
+
? (value as TeamMemoryType)
|
|
43
|
+
: null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function starterCharter(profile: TeamProfile): string {
|
|
47
|
+
const roles = Object.keys(profile.roles ?? {}).sort();
|
|
48
|
+
const approval =
|
|
49
|
+
profile.approval?.mode === "off"
|
|
50
|
+
? "No approval gates are configured for this profile."
|
|
51
|
+
: `High-risk editing tasks need lead approval for: ${(profile.approval?.labels ?? ["security", "database", "api-contract", "destructive", "migration", "auth", "payment"]).join(", ")}.`;
|
|
52
|
+
return [
|
|
53
|
+
`Use the ${profile.name} Team profile for this project.`,
|
|
54
|
+
profile.description ? `Profile intent: ${profile.description}.` : null,
|
|
55
|
+
roles.length > 0 ? `Planner may assign these roles: ${roles.join(", ")}.` : null,
|
|
56
|
+
approval,
|
|
57
|
+
"Keep Team memory current with decisions, interface notes, risks, and handoffs.",
|
|
58
|
+
]
|
|
59
|
+
.filter(Boolean)
|
|
60
|
+
.join("\n\n");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function setup(cwd: string, params: CrewParams) {
|
|
64
|
+
const name = params.name ?? "migration-squad";
|
|
65
|
+
if (!teamStore.isValidProfileName(name)) {
|
|
66
|
+
return result("Error: invalid team profile name. Use letters, numbers, underscore, or hyphen.", {
|
|
67
|
+
mode: "team.setup",
|
|
68
|
+
error: "invalid_name",
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const { team, profile, created } = teamStore.useProfile(cwd, name);
|
|
73
|
+
const existingCharter = teamStore.readCharter(cwd);
|
|
74
|
+
const customCharter =
|
|
75
|
+
typeof params.message === "string" && params.message.trim().length > 0 ? params.message : undefined;
|
|
76
|
+
const charter =
|
|
77
|
+
customCharter || !existingCharter
|
|
78
|
+
? teamStore.writeCharter(cwd, profile.name, customCharter ?? starterCharter(profile))
|
|
79
|
+
: existingCharter;
|
|
80
|
+
const charterStatus = customCharter ? "updated" : existingCharter ? "kept" : "created";
|
|
81
|
+
|
|
82
|
+
const text = `Set up Team profile **${profile.name}**.
|
|
83
|
+
|
|
84
|
+
Profile: ${created ? "created editable JSON" : "activated"}
|
|
85
|
+
Charter: ${charterStatus}
|
|
86
|
+
|
|
87
|
+
Next:
|
|
88
|
+
- Plan with this Team context: \`pi_messenger({ action: "plan", prompt: "..." })\`
|
|
89
|
+
- Check Team status: \`pi_messenger({ action: "team.status" })\`
|
|
90
|
+
- Approve gated work with \`task.approve\`; reject with \`task.reject\` and feedback.`;
|
|
91
|
+
|
|
92
|
+
return result(text, {
|
|
93
|
+
mode: "team.setup",
|
|
94
|
+
team,
|
|
95
|
+
profile,
|
|
96
|
+
created,
|
|
97
|
+
charter,
|
|
98
|
+
charterStatus,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function profileList() {
|
|
103
|
+
const profiles = teamStore.listProfiles();
|
|
104
|
+
const text = `# Team Profiles\n\n${profiles.map(p => `- ${p.name}${p.description ? ` — ${p.description}` : ""}`).join("\n")}`;
|
|
105
|
+
return result(text, { mode: "team.profile.list", profiles });
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function profileUse(cwd: string, params: CrewParams) {
|
|
109
|
+
if (!params.name)
|
|
110
|
+
return result("Error: name required for team.profile.use", { mode: "team.profile.use", error: "missing_name" });
|
|
111
|
+
if (!teamStore.isValidProfileName(params.name)) {
|
|
112
|
+
return result("Error: invalid team profile name. Use letters, numbers, underscore, or hyphen.", {
|
|
113
|
+
mode: "team.profile.use",
|
|
114
|
+
error: "invalid_name",
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
const { team, profile, created } = teamStore.useProfile(cwd, params.name);
|
|
118
|
+
const action = created ? "Created and activated" : "Activated";
|
|
119
|
+
return result(`${action} team profile **${profile.name}**.`, {
|
|
120
|
+
mode: "team.profile.use",
|
|
121
|
+
team,
|
|
122
|
+
profile,
|
|
123
|
+
created,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function profileSave(cwd: string, params: CrewParams) {
|
|
128
|
+
if (!params.name)
|
|
129
|
+
return result("Error: name required for team.profile.save", { mode: "team.profile.save", error: "missing_name" });
|
|
130
|
+
if (!teamStore.isValidProfileName(params.name)) {
|
|
131
|
+
return result("Error: invalid team profile name. Use letters, numbers, underscore, or hyphen.", {
|
|
132
|
+
mode: "team.profile.save",
|
|
133
|
+
error: "invalid_name",
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
const active = teamStore.getActiveTeam(cwd);
|
|
137
|
+
const activeProfile = teamStore.loadActiveProfile(cwd);
|
|
138
|
+
const profile: TeamProfile = {
|
|
139
|
+
...(activeProfile ?? teamStore.defaultTeamProfile(params.name)),
|
|
140
|
+
name: params.name,
|
|
141
|
+
};
|
|
142
|
+
teamStore.saveProfile(profile);
|
|
143
|
+
const team = teamStore.setActiveTeam(cwd, active?.name ?? params.name, profile.name);
|
|
144
|
+
return result(`Saved team profile **${profile.name}**.`, { mode: "team.profile.save", team, profile });
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function charterShow(cwd: string) {
|
|
148
|
+
const charter = teamStore.readCharter(cwd);
|
|
149
|
+
if (!charter) {
|
|
150
|
+
return result("No team charter found. Create one with `team.charter.create`.", {
|
|
151
|
+
mode: "team.charter.show",
|
|
152
|
+
charter: null,
|
|
153
|
+
exists: false,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return result(charter, {
|
|
157
|
+
mode: "team.charter.show",
|
|
158
|
+
charter,
|
|
159
|
+
exists: true,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function charterCreate(cwd: string, params: CrewParams) {
|
|
164
|
+
if (!params.name)
|
|
165
|
+
return result("Error: name required for team.charter.create", {
|
|
166
|
+
mode: "team.charter.create",
|
|
167
|
+
error: "missing_name",
|
|
168
|
+
});
|
|
169
|
+
if (!params.message)
|
|
170
|
+
return result("Error: message required for team.charter.create", {
|
|
171
|
+
mode: "team.charter.create",
|
|
172
|
+
error: "missing_message",
|
|
173
|
+
});
|
|
174
|
+
const charter = teamStore.writeCharter(cwd, params.name, params.message);
|
|
175
|
+
return result(`Created charter for **${params.name}**.`, {
|
|
176
|
+
mode: "team.charter.create",
|
|
177
|
+
charter,
|
|
178
|
+
team: teamStore.getActiveTeam(cwd),
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function charterUpdate(cwd: string, params: CrewParams) {
|
|
183
|
+
if (!params.message)
|
|
184
|
+
return result("Error: message required for team.charter.update", {
|
|
185
|
+
mode: "team.charter.update",
|
|
186
|
+
error: "missing_message",
|
|
187
|
+
});
|
|
188
|
+
const charter = teamStore.updateCharter(cwd, params.message);
|
|
189
|
+
return result("Updated team charter.", { mode: "team.charter.update", charter, team: teamStore.getActiveTeam(cwd) });
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function memoryNote(cwd: string, params: CrewParams, state: MessengerState) {
|
|
193
|
+
const type = memoryType(params.type);
|
|
194
|
+
if (!type)
|
|
195
|
+
return result("Error: type must be one of decision, interface, risk, or handoff", {
|
|
196
|
+
mode: "team.memory.note",
|
|
197
|
+
error: "invalid_type",
|
|
198
|
+
});
|
|
199
|
+
if (!params.message)
|
|
200
|
+
return result("Error: message required for team.memory.note", {
|
|
201
|
+
mode: "team.memory.note",
|
|
202
|
+
error: "missing_message",
|
|
203
|
+
});
|
|
204
|
+
const entry = teamStore.noteMemory(cwd, type, params.message, state.agentName || "unknown", params.id);
|
|
205
|
+
return result(`Saved team ${type} note.`, { mode: "team.memory.note", entry });
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function memoryList(cwd: string, params: CrewParams) {
|
|
209
|
+
const type = params.type ? memoryType(params.type) : null;
|
|
210
|
+
if (params.type && !type)
|
|
211
|
+
return result("Error: type must be one of decision, interface, risk, or handoff", {
|
|
212
|
+
mode: "team.memory.list",
|
|
213
|
+
error: "invalid_type",
|
|
214
|
+
});
|
|
215
|
+
const entries = teamStore.listMemory(cwd, type ?? undefined, params.limit);
|
|
216
|
+
const text =
|
|
217
|
+
entries.length > 0
|
|
218
|
+
? entries
|
|
219
|
+
.map(
|
|
220
|
+
entry => `- ${entry.ts} [${entry.type}] ${entry.message}${entry.taskId ? ` (${entry.taskId})` : ""}`,
|
|
221
|
+
)
|
|
222
|
+
.join("\n")
|
|
223
|
+
: "No team memory entries found.";
|
|
224
|
+
return result(text, { mode: "team.memory.list", type, entries });
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function roles(cwd: string) {
|
|
228
|
+
const roles = teamStore.resolveRoles(cwd);
|
|
229
|
+
const profile = teamStore.loadActiveProfile(cwd);
|
|
230
|
+
const activeNames = Object.keys(profile?.roles ?? {}).sort();
|
|
231
|
+
const builtInNames = Object.keys(roles)
|
|
232
|
+
.filter(name => !activeNames.includes(name))
|
|
233
|
+
.sort();
|
|
234
|
+
const formatRole = (name: string) => {
|
|
235
|
+
const role = roles[name];
|
|
236
|
+
return `- ${name}${role?.description ? ` — ${role.description}` : ""}`;
|
|
237
|
+
};
|
|
238
|
+
const activeText =
|
|
239
|
+
activeNames.length > 0
|
|
240
|
+
? `## Active profile roles\n${activeNames.map(formatRole).join("\n")}`
|
|
241
|
+
: "## Active profile roles\nNo Team profile is active.";
|
|
242
|
+
const availableText =
|
|
243
|
+
builtInNames.length > 0 ? `\n\n## Other available roles\n${builtInNames.map(formatRole).join("\n")}` : "";
|
|
244
|
+
const note =
|
|
245
|
+
"Team roles are labels and prompt context. Crew still runs tasks through Crew agents and does not launch pi-subagents.";
|
|
246
|
+
return result(`# Team Roles\n\n${note}\n\n${activeText}${availableText}`, {
|
|
247
|
+
mode: "team.roles",
|
|
248
|
+
activeRoles: activeNames,
|
|
249
|
+
availableRoles: builtInNames,
|
|
250
|
+
roles,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function status(cwd: string) {
|
|
255
|
+
const team = teamStore.getActiveTeam(cwd);
|
|
256
|
+
const profile = teamStore.loadActiveProfile(cwd);
|
|
257
|
+
const charter = teamStore.readCharter(cwd);
|
|
258
|
+
const roles = teamStore.resolveRoles(cwd);
|
|
259
|
+
const roleNames = Object.keys(roles).sort();
|
|
260
|
+
const activeRoleNames = Object.keys(profile?.roles ?? {}).sort();
|
|
261
|
+
const counts = teamStore.memoryCounts(cwd);
|
|
262
|
+
const needsLead = teamStore.needsLeadTasks(cwd);
|
|
263
|
+
const rejected = teamStore.rejectedTasks(cwd);
|
|
264
|
+
const approvalText =
|
|
265
|
+
needsLead.length > 0
|
|
266
|
+
? `\nNeeds approval:\n${needsLead.map(t => `- ${t.id}: ${t.title} [${t.approval?.status ?? "pending"}]`).join("\n")}`
|
|
267
|
+
: "\nNeeds approval: none";
|
|
268
|
+
const rejectedText =
|
|
269
|
+
rejected.length > 0
|
|
270
|
+
? `\nRejected tasks:\n${rejected.map(t => `- ${t.id}: ${t.title}${t.approval?.feedback ? ` — ${t.approval.feedback}` : ""}`).join("\n")}`
|
|
271
|
+
: "\nRejected tasks: none";
|
|
272
|
+
const nextAction =
|
|
273
|
+
rejected.length > 0
|
|
274
|
+
? `Revise rejected work with: pi_messenger({ action: "task.revise", id: "${rejected[0].id}", prompt: "Address approval feedback" })`
|
|
275
|
+
: needsLead.length > 0
|
|
276
|
+
? `Approve with: pi_messenger({ action: "task.approve", id: "${needsLead[0].id}" })`
|
|
277
|
+
: team
|
|
278
|
+
? "Next: plan or run Crew work with this Team context."
|
|
279
|
+
: "Next: activate a sample profile, e.g. migration-squad, review-squad, or research-squad.";
|
|
280
|
+
const text = `Team: ${team?.name ?? "(none)"}\nProfile: ${profile?.name ?? team?.profile ?? "(none)"}\nCharter: ${charter ? "present" : "missing"}\nActive roles: ${activeRoleNames.length > 0 ? activeRoleNames.join(", ") : "none"}\nMemory: decisions ${counts.decision}, interfaces ${counts.interface}, risks ${counts.risk}, handoffs ${counts.handoff}${approvalText}${rejectedText}\n${nextAction}`;
|
|
281
|
+
return result(text, {
|
|
282
|
+
mode: "team.status",
|
|
283
|
+
team,
|
|
284
|
+
profile,
|
|
285
|
+
charterPresent: !!charter,
|
|
286
|
+
roles: roleNames,
|
|
287
|
+
activeRoles: activeRoleNames,
|
|
288
|
+
nextAction,
|
|
289
|
+
memoryCounts: counts,
|
|
290
|
+
needsLead: needsLead.map(t => ({ id: t.id, title: t.title, approval: t.approval })),
|
|
291
|
+
rejected: rejected.map(t => ({ id: t.id, title: t.title, approval: t.approval })),
|
|
292
|
+
taskCount: crewStore.getTasks(cwd).length,
|
|
293
|
+
});
|
|
294
|
+
}
|