@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.
Files changed (66) hide show
  1. package/CHANGELOG.md +741 -676
  2. package/LICENSE +45 -0
  3. package/README.md +424 -424
  4. package/THIRD-PARTY-NOTICES.txt +22951 -0
  5. package/config-overlay.ts +175 -171
  6. package/config.ts +221 -209
  7. package/crew/agents/crew-plan-sync.md +66 -64
  8. package/crew/agents/crew-planner.md +173 -172
  9. package/crew/agents/crew-reviewer.md +58 -58
  10. package/crew/agents/crew-worker.md +130 -129
  11. package/crew/agents.ts +507 -434
  12. package/crew/handlers/coordination.ts +350 -332
  13. package/crew/handlers/plan.ts +988 -906
  14. package/crew/handlers/review.ts +354 -333
  15. package/crew/handlers/revise.ts +400 -376
  16. package/crew/handlers/status.ts +303 -295
  17. package/crew/handlers/sync.ts +237 -233
  18. package/crew/handlers/task.ts +820 -792
  19. package/crew/handlers/team.ts +294 -235
  20. package/crew/handlers/work.ts +467 -425
  21. package/crew/id-allocator.ts +30 -30
  22. package/crew/index.ts +297 -257
  23. package/crew/live-progress.ts +58 -58
  24. package/crew/lobby.ts +504 -473
  25. package/crew/prompt.ts +262 -252
  26. package/crew/registry.ts +114 -114
  27. package/crew/spawn.ts +135 -111
  28. package/crew/state-autonomous.ts +163 -164
  29. package/crew/state-planning.ts +264 -263
  30. package/crew/state.ts +20 -20
  31. package/crew/store.ts +646 -642
  32. package/crew/task-actions.ts +162 -131
  33. package/crew/team/store.ts +572 -479
  34. package/crew/team/subagent-roles.ts +105 -87
  35. package/crew/team/types.ts +50 -50
  36. package/crew/types.ts +194 -194
  37. package/crew/utils/artifacts.ts +57 -62
  38. package/crew/utils/config.ts +158 -156
  39. package/crew/utils/discover.ts +221 -219
  40. package/crew/utils/install.ts +94 -85
  41. package/crew/utils/migrations.ts +126 -0
  42. package/crew/utils/progress.ts +191 -187
  43. package/crew/utils/result.ts +16 -16
  44. package/crew/utils/risk-labels.ts +5 -7
  45. package/crew/utils/task-format.ts +14 -14
  46. package/crew/utils/team-roles.ts +44 -28
  47. package/crew/utils/truncate.ts +76 -79
  48. package/crew/utils/verdict.ts +55 -55
  49. package/editor-binary.ts +150 -0
  50. package/editor-command.ts +107 -0
  51. package/editor-target.ts +40 -0
  52. package/feed.ts +321 -268
  53. package/handlers.ts +1041 -1107
  54. package/index.ts +1314 -1206
  55. package/install.mjs +187 -189
  56. package/lib.ts +587 -467
  57. package/overlay-actions.ts +519 -511
  58. package/overlay-coordinator.ts +150 -150
  59. package/overlay-render.ts +770 -676
  60. package/overlay.ts +872 -830
  61. package/package.json +64 -60
  62. package/paths.ts +60 -0
  63. package/skills/pi-messenger-crew/SKILL.md +375 -347
  64. package/store.ts +1147 -1139
  65. package/teamagent-command.ts +321 -0
  66. package/vitest.config.ts +10 -10
package/install.mjs CHANGED
@@ -1,189 +1,187 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * pi-messenger installer
5
- *
6
- * Copies the npm package contents to ~/.pi/agent/extensions/pi-messenger.
7
- * No git dependency — the npm package IS the source.
8
- *
9
- * Usage:
10
- * npx pi-messenger # Install or update extension
11
- * npx pi-messenger --remove # Remove the extension
12
- * npx pi-messenger --crew-install # Show crew agent info
13
- * npx pi-messenger --crew-uninstall # Remove crew agents
14
- */
15
-
16
- import * as fs from "node:fs";
17
- import * as path from "node:path";
18
- import * as os from "node:os";
19
- import { fileURLToPath } from "node:url";
20
-
21
- const __filename = fileURLToPath(import.meta.url);
22
- const PACKAGE_DIR = path.dirname(__filename);
23
- const AGENT_DIR = path.join(os.homedir(), ".pi", "agent");
24
- const EXTENSION_DIR = path.join(AGENT_DIR, "extensions", "pi-messenger");
25
- const NATIVE_PACKAGE_DIR = path.join(AGENT_DIR, "npm", "node_modules", "pi-messenger");
26
- const SETTINGS_PATH = path.join(AGENT_DIR, "settings.json");
27
- const AGENTS_DIR = path.join(AGENT_DIR, "agents");
28
-
29
- const CREW_AGENTS = [
30
- "crew-planner.md",
31
- "crew-interview-generator.md",
32
- "crew-plan-sync.md",
33
- "crew-worker.md",
34
- "crew-reviewer.md",
35
- ];
36
-
37
- const DEPRECATED_AGENTS = [
38
- "crew-repo-scout.md",
39
- "crew-practice-scout.md",
40
- "crew-docs-scout.md",
41
- "crew-web-scout.md",
42
- "crew-github-scout.md",
43
- "crew-gap-analyst.md",
44
- ];
45
-
46
- const pkg = JSON.parse(fs.readFileSync(path.join(PACKAGE_DIR, "package.json"), "utf-8"));
47
- const VERSION = pkg.version;
48
-
49
- const args = process.argv.slice(2);
50
- const isRemove = args.includes("--remove") || args.includes("-r");
51
- const isCrewInstall = args.includes("--crew-install");
52
- const isCrewUninstall = args.includes("--crew-uninstall");
53
- const isHelp = args.includes("--help") || args.includes("-h");
54
-
55
- if (isHelp) {
56
- console.log(`
57
- pi-messenger v${VERSION} - Multi-agent coordination for pi
58
-
59
- Usage:
60
- npx pi-messenger Install or update extension
61
- npx pi-messenger --remove Remove the extension
62
- npx pi-messenger --crew-install Show crew agent info
63
- npx pi-messenger --crew-uninstall Remove crew agents
64
- npx pi-messenger --help Show this help
65
-
66
- Extension directory: ${EXTENSION_DIR}
67
- `);
68
- process.exit(0);
69
- }
70
-
71
- // ─── Crew install ────────────────────────────────────────────────────────────
72
-
73
- if (isCrewInstall) {
74
- const agentsDir = path.join(EXTENSION_DIR, "crew", "agents");
75
- if (!fs.existsSync(agentsDir)) {
76
- console.log("Extension not installed. Run: npx pi-messenger");
77
- process.exit(1);
78
- }
79
-
80
- const agents = fs.readdirSync(agentsDir).filter(f => f.endsWith(".md"));
81
- console.log(`Crew agents (${agents.length}) ship with the extension:`);
82
- console.log(` ${agentsDir}`);
83
- for (const agent of agents) {
84
- console.log(` - ${agent}`);
85
- }
86
- console.log("\nTo customize, copy an agent to .pi/messenger/crew/agents/ and edit it.");
87
- process.exit(0);
88
- }
89
-
90
- // ─── Crew uninstall ──────────────────────────────────────────────────────────
91
-
92
- if (isCrewUninstall) {
93
- let removed = 0;
94
-
95
- for (const agent of [...CREW_AGENTS, ...DEPRECATED_AGENTS]) {
96
- const target = path.join(AGENTS_DIR, agent);
97
- if (fs.existsSync(target)) {
98
- fs.unlinkSync(target);
99
- removed++;
100
- }
101
- }
102
-
103
- console.log(removed > 0
104
- ? `Removed ${removed} crew agent(s) from ${AGENTS_DIR}`
105
- : "Nothing to remove");
106
- process.exit(0);
107
- }
108
-
109
- // ─── Extension remove ────────────────────────────────────────────────────────
110
-
111
- if (isRemove) {
112
- if (fs.existsSync(EXTENSION_DIR)) {
113
- fs.rmSync(EXTENSION_DIR, { recursive: true });
114
- console.log("Removed pi-messenger from " + EXTENSION_DIR);
115
- } else {
116
- console.log("pi-messenger is not installed");
117
- }
118
- process.exit(0);
119
- }
120
-
121
- // Already running from the extension dir (e.g. local dev)
122
- if (path.resolve(PACKAGE_DIR) === path.resolve(EXTENSION_DIR)) {
123
- console.log(`Already installed at ${EXTENSION_DIR} (v${VERSION})`);
124
- process.exit(0);
125
- }
126
-
127
- const isUpdate = fs.existsSync(EXTENSION_DIR);
128
-
129
- function hasNativePackageInstall() {
130
- if (fs.existsSync(NATIVE_PACKAGE_DIR)) {
131
- return true;
132
- }
133
-
134
- try {
135
- const settings = JSON.parse(fs.readFileSync(SETTINGS_PATH, "utf-8"));
136
- const packages = Array.isArray(settings.packages) ? settings.packages : [];
137
- return packages.some(pkg => pkg === "npm:pi-messenger");
138
- } catch {
139
- return false;
140
- }
141
- }
142
-
143
- if (hasNativePackageInstall()) {
144
- console.log(`pi-messenger is already installed via pi's native package flow.
145
-
146
- Keep the native install and remove any legacy copy instead:
147
-
148
- npx pi-messenger --remove
149
-
150
- Do not run the legacy npx installer alongside \`pi install npm:pi-messenger\`; loading both copies registers the \`pi_messenger\` tool twice.`);
151
- process.exit(1);
152
- }
153
-
154
- // Warn if existing install is a git clone from the old installer
155
- if (isUpdate && fs.existsSync(path.join(EXTENSION_DIR, ".git"))) {
156
- console.log("Existing install is a git clone. Remove it first:\n");
157
- console.log(" npx pi-messenger --remove && npx pi-messenger");
158
- process.exit(1);
159
- }
160
-
161
- // Clean slate for updates so removed files don't linger between versions
162
- if (isUpdate) {
163
- fs.rmSync(EXTENSION_DIR, { recursive: true });
164
- }
165
-
166
- const SKIP = new Set([".git", "node_modules", ".DS_Store"]);
167
-
168
- function copyDir(src, dest) {
169
- fs.mkdirSync(dest, { recursive: true });
170
- for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
171
- if (SKIP.has(entry.name)) continue;
172
- const srcPath = path.join(src, entry.name);
173
- const destPath = path.join(dest, entry.name);
174
- if (entry.isDirectory()) {
175
- copyDir(srcPath, destPath);
176
- } else {
177
- fs.copyFileSync(srcPath, destPath);
178
- }
179
- }
180
- }
181
-
182
- copyDir(PACKAGE_DIR, EXTENSION_DIR);
183
-
184
- const action = isUpdate ? "Updated" : "Installed";
185
- console.log(`${action} pi-messenger v${VERSION} → ${EXTENSION_DIR}
186
-
187
- Tools: pi_messenger
188
- Commands: /messenger, /messenger config
189
- Docs: ${EXTENSION_DIR}/README.md`);
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * pi-messenger installer
5
+ *
6
+ * Copies the npm package contents to ~/.pi/agent/extensions/pi-messenger.
7
+ * No git dependency — the npm package IS the source.
8
+ *
9
+ * Usage:
10
+ * npx pi-messenger # Install or update extension
11
+ * npx pi-messenger --remove # Remove the extension
12
+ * npx pi-messenger --crew-install # Show crew agent info
13
+ * npx pi-messenger --crew-uninstall # Remove crew agents
14
+ */
15
+
16
+ import * as fs from "node:fs";
17
+ import * as path from "node:path";
18
+ import * as os from "node:os";
19
+ import { fileURLToPath } from "node:url";
20
+
21
+ const __filename = fileURLToPath(import.meta.url);
22
+ const PACKAGE_DIR = path.dirname(__filename);
23
+ const AGENT_DIR = path.join(os.homedir(), ".pi", "agent");
24
+ const EXTENSION_DIR = path.join(AGENT_DIR, "extensions", "pi-messenger");
25
+ const NATIVE_PACKAGE_DIR = path.join(AGENT_DIR, "npm", "node_modules", "pi-messenger");
26
+ const SETTINGS_PATH = path.join(AGENT_DIR, "settings.json");
27
+ const AGENTS_DIR = path.join(AGENT_DIR, "agents");
28
+
29
+ const CREW_AGENTS = [
30
+ "crew-planner.md",
31
+ "crew-interview-generator.md",
32
+ "crew-plan-sync.md",
33
+ "crew-worker.md",
34
+ "crew-reviewer.md",
35
+ ];
36
+
37
+ const DEPRECATED_AGENTS = [
38
+ "crew-repo-scout.md",
39
+ "crew-practice-scout.md",
40
+ "crew-docs-scout.md",
41
+ "crew-web-scout.md",
42
+ "crew-github-scout.md",
43
+ "crew-gap-analyst.md",
44
+ ];
45
+
46
+ const pkg = JSON.parse(fs.readFileSync(path.join(PACKAGE_DIR, "package.json"), "utf-8"));
47
+ const VERSION = pkg.version;
48
+
49
+ const args = process.argv.slice(2);
50
+ const isRemove = args.includes("--remove") || args.includes("-r");
51
+ const isCrewInstall = args.includes("--crew-install");
52
+ const isCrewUninstall = args.includes("--crew-uninstall");
53
+ const isHelp = args.includes("--help") || args.includes("-h");
54
+
55
+ if (isHelp) {
56
+ console.log(`
57
+ pi-messenger v${VERSION} - Multi-agent coordination for pi
58
+
59
+ Usage:
60
+ npx pi-messenger Install or update extension
61
+ npx pi-messenger --remove Remove the extension
62
+ npx pi-messenger --crew-install Show crew agent info
63
+ npx pi-messenger --crew-uninstall Remove crew agents
64
+ npx pi-messenger --help Show this help
65
+
66
+ Extension directory: ${EXTENSION_DIR}
67
+ `);
68
+ process.exit(0);
69
+ }
70
+
71
+ // ─── Crew install ────────────────────────────────────────────────────────────
72
+
73
+ if (isCrewInstall) {
74
+ const agentsDir = path.join(EXTENSION_DIR, "crew", "agents");
75
+ if (!fs.existsSync(agentsDir)) {
76
+ console.log("Extension not installed. Run: npx pi-messenger");
77
+ process.exit(1);
78
+ }
79
+
80
+ const agents = fs.readdirSync(agentsDir).filter(f => f.endsWith(".md"));
81
+ console.log(`Crew agents (${agents.length}) ship with the extension:`);
82
+ console.log(` ${agentsDir}`);
83
+ for (const agent of agents) {
84
+ console.log(` - ${agent}`);
85
+ }
86
+ console.log("\nTo customize, copy an agent to .pi/messenger/crew/agents/ and edit it.");
87
+ process.exit(0);
88
+ }
89
+
90
+ // ─── Crew uninstall ──────────────────────────────────────────────────────────
91
+
92
+ if (isCrewUninstall) {
93
+ let removed = 0;
94
+
95
+ for (const agent of [...CREW_AGENTS, ...DEPRECATED_AGENTS]) {
96
+ const target = path.join(AGENTS_DIR, agent);
97
+ if (fs.existsSync(target)) {
98
+ fs.unlinkSync(target);
99
+ removed++;
100
+ }
101
+ }
102
+
103
+ console.log(removed > 0 ? `Removed ${removed} crew agent(s) from ${AGENTS_DIR}` : "Nothing to remove");
104
+ process.exit(0);
105
+ }
106
+
107
+ // ─── Extension remove ────────────────────────────────────────────────────────
108
+
109
+ if (isRemove) {
110
+ if (fs.existsSync(EXTENSION_DIR)) {
111
+ fs.rmSync(EXTENSION_DIR, { recursive: true });
112
+ console.log("Removed pi-messenger from " + EXTENSION_DIR);
113
+ } else {
114
+ console.log("pi-messenger is not installed");
115
+ }
116
+ process.exit(0);
117
+ }
118
+
119
+ // Already running from the extension dir (e.g. local dev)
120
+ if (path.resolve(PACKAGE_DIR) === path.resolve(EXTENSION_DIR)) {
121
+ console.log(`Already installed at ${EXTENSION_DIR} (v${VERSION})`);
122
+ process.exit(0);
123
+ }
124
+
125
+ const isUpdate = fs.existsSync(EXTENSION_DIR);
126
+
127
+ function hasNativePackageInstall() {
128
+ if (fs.existsSync(NATIVE_PACKAGE_DIR)) {
129
+ return true;
130
+ }
131
+
132
+ try {
133
+ const settings = JSON.parse(fs.readFileSync(SETTINGS_PATH, "utf-8"));
134
+ const packages = Array.isArray(settings.packages) ? settings.packages : [];
135
+ return packages.some(pkg => pkg === "npm:pi-messenger");
136
+ } catch {
137
+ return false;
138
+ }
139
+ }
140
+
141
+ if (hasNativePackageInstall()) {
142
+ console.log(`pi-messenger is already installed via pi's native package flow.
143
+
144
+ Keep the native install and remove any legacy copy instead:
145
+
146
+ npx pi-messenger --remove
147
+
148
+ Do not run the legacy npx installer alongside \`pi install npm:pi-messenger\`; loading both copies registers the \`pi_messenger\` tool twice.`);
149
+ process.exit(1);
150
+ }
151
+
152
+ // Warn if existing install is a git clone from the old installer
153
+ if (isUpdate && fs.existsSync(path.join(EXTENSION_DIR, ".git"))) {
154
+ console.log("Existing install is a git clone. Remove it first:\n");
155
+ console.log(" npx pi-messenger --remove && npx pi-messenger");
156
+ process.exit(1);
157
+ }
158
+
159
+ // Clean slate for updates so removed files don't linger between versions
160
+ if (isUpdate) {
161
+ fs.rmSync(EXTENSION_DIR, { recursive: true });
162
+ }
163
+
164
+ const SKIP = new Set([".git", "node_modules", ".DS_Store"]);
165
+
166
+ function copyDir(src, dest) {
167
+ fs.mkdirSync(dest, { recursive: true });
168
+ for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
169
+ if (SKIP.has(entry.name)) continue;
170
+ const srcPath = path.join(src, entry.name);
171
+ const destPath = path.join(dest, entry.name);
172
+ if (entry.isDirectory()) {
173
+ copyDir(srcPath, destPath);
174
+ } else {
175
+ fs.copyFileSync(srcPath, destPath);
176
+ }
177
+ }
178
+ }
179
+
180
+ copyDir(PACKAGE_DIR, EXTENSION_DIR);
181
+
182
+ const action = isUpdate ? "Updated" : "Installed";
183
+ console.log(`${action} pi-messenger v${VERSION} → ${EXTENSION_DIR}
184
+
185
+ Tools: pi_messenger
186
+ Commands: /messenger, /messenger config
187
+ Docs: ${EXTENSION_DIR}/README.md`);