swarmdo 1.30.0 → 1.37.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 (65) hide show
  1. package/README.md +6 -3
  2. package/package.json +1 -1
  3. package/v3/@swarmdo/cli/dist/src/affected/affected.d.ts +6 -1
  4. package/v3/@swarmdo/cli/dist/src/affected/affected.js +7 -2
  5. package/v3/@swarmdo/cli/dist/src/apply/apply.js +18 -7
  6. package/v3/@swarmdo/cli/dist/src/changelog/changelog.js +4 -1
  7. package/v3/@swarmdo/cli/dist/src/codegraph/codegraph.js +11 -1
  8. package/v3/@swarmdo/cli/dist/src/commands/comms.d.ts +16 -0
  9. package/v3/@swarmdo/cli/dist/src/commands/comms.js +280 -0
  10. package/v3/@swarmdo/cli/dist/src/commands/compact.js +6 -2
  11. package/v3/@swarmdo/cli/dist/src/commands/config.js +1 -0
  12. package/v3/@swarmdo/cli/dist/src/commands/hooks.js +121 -1
  13. package/v3/@swarmdo/cli/dist/src/commands/hotspots.js +8 -2
  14. package/v3/@swarmdo/cli/dist/src/commands/index.js +6 -0
  15. package/v3/@swarmdo/cli/dist/src/commands/permissions.d.ts +14 -0
  16. package/v3/@swarmdo/cli/dist/src/commands/permissions.js +92 -0
  17. package/v3/@swarmdo/cli/dist/src/commands/usage.js +34 -1
  18. package/v3/@swarmdo/cli/dist/src/comms/mailbox.d.ts +88 -0
  19. package/v3/@swarmdo/cli/dist/src/comms/mailbox.js +138 -0
  20. package/v3/@swarmdo/cli/dist/src/comms/store.d.ts +21 -0
  21. package/v3/@swarmdo/cli/dist/src/comms/store.js +44 -0
  22. package/v3/@swarmdo/cli/dist/src/compact/compact.js +4 -1
  23. package/v3/@swarmdo/cli/dist/src/compact-snapshot/compact-snapshot.js +8 -3
  24. package/v3/@swarmdo/cli/dist/src/config-lint/lint.d.ts +3 -1
  25. package/v3/@swarmdo/cli/dist/src/config-lint/lint.js +11 -4
  26. package/v3/@swarmdo/cli/dist/src/env/env.js +40 -14
  27. package/v3/@swarmdo/cli/dist/src/hooks-recipe/recipe.js +20 -1
  28. package/v3/@swarmdo/cli/dist/src/hotspots/hotspots.d.ts +3 -0
  29. package/v3/@swarmdo/cli/dist/src/hotspots/hotspots.js +9 -0
  30. package/v3/@swarmdo/cli/dist/src/index.js +8 -0
  31. package/v3/@swarmdo/cli/dist/src/license/license.js +4 -1
  32. package/v3/@swarmdo/cli/dist/src/mcp-client.js +2 -0
  33. package/v3/@swarmdo/cli/dist/src/mcp-tools/comms-tools.d.ts +11 -0
  34. package/v3/@swarmdo/cli/dist/src/mcp-tools/comms-tools.js +93 -0
  35. package/v3/@swarmdo/cli/dist/src/mcp-tools/index.d.ts +1 -0
  36. package/v3/@swarmdo/cli/dist/src/mcp-tools/index.js +1 -0
  37. package/v3/@swarmdo/cli/dist/src/mcp-tools/task-tools.js +4 -0
  38. package/v3/@swarmdo/cli/dist/src/memory/memory-bridge.d.ts +2 -0
  39. package/v3/@swarmdo/cli/dist/src/memory/memory-bridge.js +4 -2
  40. package/v3/@swarmdo/cli/dist/src/memory-inject/select.d.ts +82 -0
  41. package/v3/@swarmdo/cli/dist/src/memory-inject/select.js +164 -0
  42. package/v3/@swarmdo/cli/dist/src/memory-vault/import.js +11 -1
  43. package/v3/@swarmdo/cli/dist/src/pack/pack.js +6 -2
  44. package/v3/@swarmdo/cli/dist/src/permissions/audit.d.ts +50 -0
  45. package/v3/@swarmdo/cli/dist/src/permissions/audit.js +127 -0
  46. package/v3/@swarmdo/cli/dist/src/plugins/store/search.js +1 -1
  47. package/v3/@swarmdo/cli/dist/src/redact/redact.js +7 -2
  48. package/v3/@swarmdo/cli/dist/src/release/release.js +1 -1
  49. package/v3/@swarmdo/cli/dist/src/sbom/sbom.d.ts +2 -0
  50. package/v3/@swarmdo/cli/dist/src/sbom/sbom.js +5 -0
  51. package/v3/@swarmdo/cli/dist/src/swarmvector/semantic-router.js +8 -3
  52. package/v3/@swarmdo/cli/dist/src/testreport/testreport.js +9 -2
  53. package/v3/@swarmdo/cli/dist/src/transcript/export.js +8 -4
  54. package/v3/@swarmdo/cli/dist/src/update/checker.d.ts +1 -0
  55. package/v3/@swarmdo/cli/dist/src/update/checker.js +7 -2
  56. package/v3/@swarmdo/cli/dist/src/usage/model-efficiency.d.ts +29 -0
  57. package/v3/@swarmdo/cli/dist/src/usage/model-efficiency.js +28 -0
  58. package/v3/@swarmdo/cli/dist/src/usage/reflect-html.js +1 -0
  59. package/v3/@swarmdo/cli/dist/src/usage/reflect.d.ts +26 -0
  60. package/v3/@swarmdo/cli/dist/src/usage/reflect.js +44 -0
  61. package/v3/@swarmdo/cli/dist/src/usage/transcript-usage.d.ts +8 -1
  62. package/v3/@swarmdo/cli/dist/src/usage/transcript-usage.js +21 -1
  63. package/v3/@swarmdo/cli/dist/src/util/stdout.d.ts +23 -1
  64. package/v3/@swarmdo/cli/dist/src/util/stdout.js +34 -2
  65. package/v3/@swarmdo/cli/package.json +1 -1
@@ -7,10 +7,42 @@
7
7
  * (`swarmdo sbom | …`, `pack`, `compact`, `redact`) truncates at the ~64 KiB
8
8
  * pipe buffer. Awaiting the write callback guarantees the data reached the OS
9
9
  * before we hand control back. For a TTY (synchronous) this is a no-op await.
10
+ *
11
+ * Broken-pipe (EPIPE) handling: when the reader closes the pipe early (`… |
12
+ * head`), Node emits an `'error'` event on the stdout Socket — often
13
+ * ASYNCHRONOUSLY, after our write callback has already fired — and an unhandled
14
+ * `'error'` event crashes the process with a raw stack trace. A per-write
15
+ * listener therefore doesn't cover it (it's gone by the time the async error
16
+ * lands). So we install ONE persistent EPIPE guard per stream that swallows the
17
+ * broken pipe (normal producer termination) while still rethrowing any other
18
+ * stream error, and additionally resolve the write promise on an EPIPE callback.
19
+ * The `stream` param is injectable so this is unit-testable without a subprocess.
20
+ */
21
+ const guarded = new WeakSet();
22
+ /**
23
+ * Install (once per stream) a persistent `'error'` handler that swallows EPIPE —
24
+ * a closed reader is normal termination for a Unix producer, not a crash — and
25
+ * rethrows everything else so genuine stream errors still surface. Exported for
26
+ * the CLI entry point to arm stdout/stderr before any write happens.
10
27
  */
11
- export function writeStdout(data) {
28
+ export function guardStreamEpipe(stream) {
29
+ if (guarded.has(stream))
30
+ return;
31
+ guarded.add(stream);
32
+ stream.on('error', (err) => {
33
+ if (err.code !== 'EPIPE')
34
+ throw err;
35
+ });
36
+ }
37
+ export function writeStdout(data, stream = process.stdout) {
38
+ guardStreamEpipe(stream);
12
39
  return new Promise((resolve, reject) => {
13
- process.stdout.write(data, (err) => (err ? reject(err) : resolve()));
40
+ stream.write(data, (err) => {
41
+ if (err && err.code !== 'EPIPE')
42
+ reject(err);
43
+ else
44
+ resolve();
45
+ });
14
46
  });
15
47
  }
16
48
  //# sourceMappingURL=stdout.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swarmdo/cli",
3
- "version": "1.30.0",
3
+ "version": "1.37.0",
4
4
  "type": "module",
5
5
  "description": "Swarmdo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",