@monoes/monomindcli 2.16.13 → 2.16.14

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 (171) hide show
  1. package/README.md +1 -1
  2. package/dist/src/commands/org-control.d.ts +117 -0
  3. package/dist/src/commands/org-control.d.ts.map +1 -0
  4. package/dist/src/commands/org-control.js +274 -0
  5. package/dist/src/commands/org-control.js.map +1 -0
  6. package/dist/src/commands/org-lifecycle.d.ts +7 -0
  7. package/dist/src/commands/org-lifecycle.d.ts.map +1 -0
  8. package/dist/src/commands/org-lifecycle.js +298 -0
  9. package/dist/src/commands/org-lifecycle.js.map +1 -0
  10. package/dist/src/commands/org-manage.d.ts +7 -0
  11. package/dist/src/commands/org-manage.d.ts.map +1 -0
  12. package/dist/src/commands/org-manage.js +357 -0
  13. package/dist/src/commands/org-manage.js.map +1 -0
  14. package/dist/src/commands/org-memory-command.d.ts +3 -0
  15. package/dist/src/commands/org-memory-command.d.ts.map +1 -0
  16. package/dist/src/commands/org-memory-command.js +178 -0
  17. package/dist/src/commands/org-memory-command.js.map +1 -0
  18. package/dist/src/commands/org-observe-approvals.d.ts +8 -0
  19. package/dist/src/commands/org-observe-approvals.d.ts.map +1 -0
  20. package/dist/src/commands/org-observe-approvals.js +211 -0
  21. package/dist/src/commands/org-observe-approvals.js.map +1 -0
  22. package/dist/src/commands/org-observe-checkpoint.d.ts +26 -0
  23. package/dist/src/commands/org-observe-checkpoint.d.ts.map +1 -0
  24. package/dist/src/commands/org-observe-checkpoint.js +180 -0
  25. package/dist/src/commands/org-observe-checkpoint.js.map +1 -0
  26. package/dist/src/commands/org-observe-config.d.ts +8 -0
  27. package/dist/src/commands/org-observe-config.d.ts.map +1 -0
  28. package/dist/src/commands/org-observe-config.js +160 -0
  29. package/dist/src/commands/org-observe-config.js.map +1 -0
  30. package/dist/src/commands/org-observe-gates.d.ts +4 -0
  31. package/dist/src/commands/org-observe-gates.d.ts.map +1 -0
  32. package/dist/src/commands/org-observe-gates.js +182 -0
  33. package/dist/src/commands/org-observe-gates.js.map +1 -0
  34. package/dist/src/commands/org-observe-inbox.d.ts +18 -0
  35. package/dist/src/commands/org-observe-inbox.d.ts.map +1 -0
  36. package/dist/src/commands/org-observe-inbox.js +154 -0
  37. package/dist/src/commands/org-observe-inbox.js.map +1 -0
  38. package/dist/src/commands/org-observe-logs.d.ts +31 -0
  39. package/dist/src/commands/org-observe-logs.d.ts.map +1 -0
  40. package/dist/src/commands/org-observe-logs.js +272 -0
  41. package/dist/src/commands/org-observe-logs.js.map +1 -0
  42. package/dist/src/commands/org-observe-questions.d.ts +8 -0
  43. package/dist/src/commands/org-observe-questions.d.ts.map +1 -0
  44. package/dist/src/commands/org-observe-questions.js +201 -0
  45. package/dist/src/commands/org-observe-questions.js.map +1 -0
  46. package/dist/src/commands/org-observe-report.d.ts +8 -0
  47. package/dist/src/commands/org-observe-report.d.ts.map +1 -0
  48. package/dist/src/commands/org-observe-report.js +366 -0
  49. package/dist/src/commands/org-observe-report.js.map +1 -0
  50. package/dist/src/commands/org-observe-shared.d.ts +20 -0
  51. package/dist/src/commands/org-observe-shared.d.ts.map +1 -0
  52. package/dist/src/commands/org-observe-shared.js +55 -0
  53. package/dist/src/commands/org-observe-shared.js.map +1 -0
  54. package/dist/src/commands/org-observe.d.ts +9 -101
  55. package/dist/src/commands/org-observe.d.ts.map +1 -1
  56. package/dist/src/commands/org-observe.js +12 -1675
  57. package/dist/src/commands/org-observe.js.map +1 -1
  58. package/dist/src/commands/org-poll.d.ts +57 -0
  59. package/dist/src/commands/org-poll.d.ts.map +1 -0
  60. package/dist/src/commands/org-poll.js +194 -0
  61. package/dist/src/commands/org-poll.js.map +1 -0
  62. package/dist/src/commands/org-run.d.ts +3 -0
  63. package/dist/src/commands/org-run.d.ts.map +1 -0
  64. package/dist/src/commands/org-run.js +449 -0
  65. package/dist/src/commands/org-run.js.map +1 -0
  66. package/dist/src/commands/org-serve.d.ts +19 -0
  67. package/dist/src/commands/org-serve.d.ts.map +1 -0
  68. package/dist/src/commands/org-serve.js +395 -0
  69. package/dist/src/commands/org-serve.js.map +1 -0
  70. package/dist/src/commands/org-subcommands-config.d.ts +8 -0
  71. package/dist/src/commands/org-subcommands-config.d.ts.map +1 -0
  72. package/dist/src/commands/org-subcommands-config.js +93 -0
  73. package/dist/src/commands/org-subcommands-config.js.map +1 -0
  74. package/dist/src/commands/org-subcommands-hil.d.ts +11 -0
  75. package/dist/src/commands/org-subcommands-hil.d.ts.map +1 -0
  76. package/dist/src/commands/org-subcommands-hil.js +216 -0
  77. package/dist/src/commands/org-subcommands-hil.js.map +1 -0
  78. package/dist/src/commands/org-subcommands-observe.d.ts +12 -0
  79. package/dist/src/commands/org-subcommands-observe.d.ts.map +1 -0
  80. package/dist/src/commands/org-subcommands-observe.js +249 -0
  81. package/dist/src/commands/org-subcommands-observe.js.map +1 -0
  82. package/dist/src/commands/org-subcommands-runtime.d.ts +12 -0
  83. package/dist/src/commands/org-subcommands-runtime.d.ts.map +1 -0
  84. package/dist/src/commands/org-subcommands-runtime.js +163 -0
  85. package/dist/src/commands/org-subcommands-runtime.js.map +1 -0
  86. package/dist/src/commands/org.d.ts +3 -151
  87. package/dist/src/commands/org.d.ts.map +1 -1
  88. package/dist/src/commands/org.js +43 -2735
  89. package/dist/src/commands/org.js.map +1 -1
  90. package/dist/src/orgrt/daemon-types.d.ts +196 -0
  91. package/dist/src/orgrt/daemon-types.d.ts.map +1 -0
  92. package/dist/src/orgrt/daemon-types.js +38 -0
  93. package/dist/src/orgrt/daemon-types.js.map +1 -0
  94. package/dist/src/orgrt/daemon.d.ts +70 -300
  95. package/dist/src/orgrt/daemon.d.ts.map +1 -1
  96. package/dist/src/orgrt/daemon.js +41 -2536
  97. package/dist/src/orgrt/daemon.js.map +1 -1
  98. package/dist/src/orgrt/idle-watchdog.d.ts +39 -0
  99. package/dist/src/orgrt/idle-watchdog.d.ts.map +1 -0
  100. package/dist/src/orgrt/idle-watchdog.js +289 -0
  101. package/dist/src/orgrt/idle-watchdog.js.map +1 -0
  102. package/dist/src/orgrt/org-reload.d.ts +7 -0
  103. package/dist/src/orgrt/org-reload.d.ts.map +1 -0
  104. package/dist/src/orgrt/org-reload.js +111 -0
  105. package/dist/src/orgrt/org-reload.js.map +1 -0
  106. package/dist/src/orgrt/org-start-steps.d.ts +21 -0
  107. package/dist/src/orgrt/org-start-steps.d.ts.map +1 -0
  108. package/dist/src/orgrt/org-start-steps.js +305 -0
  109. package/dist/src/orgrt/org-start-steps.js.map +1 -0
  110. package/dist/src/orgrt/org-start.d.ts +7 -0
  111. package/dist/src/orgrt/org-start.d.ts.map +1 -0
  112. package/dist/src/orgrt/org-start.js +435 -0
  113. package/dist/src/orgrt/org-start.js.map +1 -0
  114. package/dist/src/orgrt/org-state-file.d.ts +8 -0
  115. package/dist/src/orgrt/org-state-file.d.ts.map +1 -0
  116. package/dist/src/orgrt/org-state-file.js +116 -0
  117. package/dist/src/orgrt/org-state-file.js.map +1 -0
  118. package/dist/src/orgrt/org-stop.d.ts +6 -0
  119. package/dist/src/orgrt/org-stop.d.ts.map +1 -0
  120. package/dist/src/orgrt/org-stop.js +332 -0
  121. package/dist/src/orgrt/org-stop.js.map +1 -0
  122. package/dist/src/orgrt/org-tools.d.ts +11 -0
  123. package/dist/src/orgrt/org-tools.d.ts.map +1 -0
  124. package/dist/src/orgrt/org-tools.js +305 -0
  125. package/dist/src/orgrt/org-tools.js.map +1 -0
  126. package/dist/src/orgrt/role-incarnation.d.ts +18 -0
  127. package/dist/src/orgrt/role-incarnation.d.ts.map +1 -0
  128. package/dist/src/orgrt/role-incarnation.js +374 -0
  129. package/dist/src/orgrt/role-incarnation.js.map +1 -0
  130. package/dist/src/orgrt/role-respawn.d.ts +7 -0
  131. package/dist/src/orgrt/role-respawn.d.ts.map +1 -0
  132. package/dist/src/orgrt/role-respawn.js +318 -0
  133. package/dist/src/orgrt/role-respawn.js.map +1 -0
  134. package/dist/src/orgrt/role-session-opts.d.ts +389 -0
  135. package/dist/src/orgrt/role-session-opts.d.ts.map +1 -0
  136. package/dist/src/orgrt/role-session-opts.js +289 -0
  137. package/dist/src/orgrt/role-session-opts.js.map +1 -0
  138. package/dist/src/orgrt/runner-resolve.d.ts +43 -0
  139. package/dist/src/orgrt/runner-resolve.d.ts.map +1 -0
  140. package/dist/src/orgrt/runner-resolve.js +77 -0
  141. package/dist/src/orgrt/runner-resolve.js.map +1 -0
  142. package/dist/src/orgrt/session-gate.d.ts +34 -0
  143. package/dist/src/orgrt/session-gate.d.ts.map +1 -0
  144. package/dist/src/orgrt/session-gate.js +74 -0
  145. package/dist/src/orgrt/session-gate.js.map +1 -0
  146. package/dist/src/orgrt/session-prompt.d.ts +31 -0
  147. package/dist/src/orgrt/session-prompt.d.ts.map +1 -0
  148. package/dist/src/orgrt/session-prompt.js +115 -0
  149. package/dist/src/orgrt/session-prompt.js.map +1 -0
  150. package/dist/src/orgrt/session-run.d.ts +18 -0
  151. package/dist/src/orgrt/session-run.d.ts.map +1 -0
  152. package/dist/src/orgrt/session-run.js +429 -0
  153. package/dist/src/orgrt/session-run.js.map +1 -0
  154. package/dist/src/orgrt/session-stream.d.ts +21 -0
  155. package/dist/src/orgrt/session-stream.d.ts.map +1 -0
  156. package/dist/src/orgrt/session-stream.js +173 -0
  157. package/dist/src/orgrt/session-stream.js.map +1 -0
  158. package/dist/src/orgrt/session-types.d.ts +219 -0
  159. package/dist/src/orgrt/session-types.d.ts.map +1 -0
  160. package/dist/src/orgrt/session-types.js +2 -0
  161. package/dist/src/orgrt/session-types.js.map +1 -0
  162. package/dist/src/orgrt/session-usage.d.ts +29 -0
  163. package/dist/src/orgrt/session-usage.d.ts.map +1 -0
  164. package/dist/src/orgrt/session-usage.js +64 -0
  165. package/dist/src/orgrt/session-usage.js.map +1 -0
  166. package/dist/src/orgrt/session.d.ts +5 -281
  167. package/dist/src/orgrt/session.d.ts.map +1 -1
  168. package/dist/src/orgrt/session.js +8 -1117
  169. package/dist/src/orgrt/session.js.map +1 -1
  170. package/dist/tsconfig.tsbuildinfo +1 -1
  171. package/package.json +6 -6
package/README.md CHANGED
@@ -36,7 +36,7 @@ Monomind is an **open-source CLI and MCP server** that plugs into Claude Code, [
36
36
  - **Codebase knowledge graph** — tree-sitter parses your code into a SQLite-backed graph of files, functions, classes, and their relationships. Query imports, callers, and blast radius before making changes.
37
37
  - **Persistent memory** — a JSON pattern store with episodic recall that survives across sessions. Agents and orgs share context without re-prompting.
38
38
  - **Multi-agent coordination** — in-session, spawn ad-hoc agent teams via Claude Code's Task tool; for persistent background work, `monomind org run` starts a real SDK-backed daemon with policy-gated role agents and a live dashboard.
39
- - **Agents, skills and picking** — ships <!-- doc-count:pickable-agents -->84<!-- /doc-count:pickable-agents --> pickable agents, <!-- doc-count:pickable-skills -->83<!-- /doc-count:pickable-skills --> skills and <!-- doc-count:org-skills -->376<!-- /doc-count:org-skills --> Org skills, and you add your own as Markdown files. One index of all of them ranks the best fit for each task; the prompt hook puts it in Claude's context as a `[PICK]` line, and `monomind pick` or the `pick` MCP tool return it on request. See [Agents & Skills](doc/concepts/agents-and-skills.md) and [Routing](doc/concepts/routing.md).
39
+ - **Agents, skills and picking** — ships <!-- doc-count:pickable-agents -->84<!-- /doc-count:pickable-agents --> pickable agents, <!-- doc-count:pickable-skills -->84<!-- /doc-count:pickable-skills --> skills and <!-- doc-count:org-skills -->376<!-- /doc-count:org-skills --> Org skills, and you add your own as Markdown files. One index of all of them ranks the best fit for each task; the prompt hook puts it in Claude's context as a `[PICK]` line, and `monomind pick` or the `pick` MCP tool return it on request. See [Agents & Skills](doc/concepts/agents-and-skills.md) and [Routing](doc/concepts/routing.md).
40
40
  - **Reusable slash commands** — <!-- doc-count:mastermind-commands -->42<!-- /doc-count:mastermind-commands --> workflows (plan, execute, review, debug, release, research, worktree) available as `/mastermind:*` commands inside Claude Code.
41
41
 
42
42
  ```bash
@@ -0,0 +1,117 @@
1
+ import type { CommandResult } from '../types.js';
2
+ /** Org names are used to build filesystem paths under .monomind/orgs — reject
3
+ * anything that isn't a plain identifier to prevent path traversal (e.g.
4
+ * `monomind org stop '../../../../tmp/x'`). */
5
+ export declare const ORG_NAME_RE: RegExp;
6
+ export declare function validateOrgName(name: string | undefined): {
7
+ ok: true;
8
+ name: string;
9
+ } | {
10
+ ok: false;
11
+ result: CommandResult;
12
+ };
13
+ /** Suffixes of org-internal artifact files (state/goals/threads/etc) that
14
+ * share the `<org>.json`/`.jsonl` naming pattern with the org's own config
15
+ * file. Single source of truth for both listOrgConfigFiles() (which must
16
+ * exclude them when discovering real org configs) and deleteAction (which
17
+ * must remove all of them when deleting an org). */
18
+ export declare const ORG_ARTIFACT_SUFFIXES: string[];
19
+ export declare function listOrgConfigFiles(orgsDir: string): string[];
20
+ /** Remove a lingering stopfile so a fresh `org run` doesn't self-terminate. */
21
+ export declare const clearStopfile: (cwd: string, name: string) => void;
22
+ /** Remove a lingering reload request so a fresh `org run` doesn't apply it on
23
+ * its first tick. One is left behind when a previous run's stop and reload
24
+ * landed in the same tick: the stop ends the wait before the reload poll runs. */
25
+ export declare const clearReloadfile: (cwd: string, name: string) => void;
26
+ /** Drop stop/reload requests left behind by a previous run, for every org
27
+ * `org serve` serves. #264: runAction clears these before its wait loop, but
28
+ * serveAction started polling with whatever was on disk — so an `org stop`
29
+ * that landed after the last daemon exited stopped the next daemon's org
30
+ * seconds into its run, and a leftover `org reload` was applied to a
31
+ * definition nobody had touched.
32
+ *
33
+ * Scope is the org config files, not `daemon.listRunning()` (what
34
+ * pollStopfiles/pollReloadfiles walk): nothing is running yet at startup, so
35
+ * sweeping by that would sweep nothing. Called before the first org can
36
+ * start, so a request that arrives once serve is up is never discarded.
37
+ *
38
+ * Runfiles are deliberately left in place. `.../run` is not the same kind of
39
+ * leftover: runAction writes one only against a live daemon and retracts it
40
+ * itself when nothing consumes it within 15s, and it reads the file's
41
+ * disappearance as "the daemon took the run". Deleting one here would report
42
+ * success to a waiting `org run` and start nothing — the silent loss that ack
43
+ * loop exists to prevent. A stale runfile at worst starts an org the operator
44
+ * did ask for; pollRunfiles already no-ops on one that is running.
45
+ *
46
+ * Returns the orgs it cleared something for. */
47
+ export declare const clearStaleControlFiles: (cwd: string) => string[];
48
+ /** True when a pause sentinel exists for an org. */
49
+ export declare const isOrgPaused: (cwd: string, name: string) => boolean;
50
+ export declare const clearPausefile: (cwd: string, name: string) => void;
51
+ /** PID of a live `org serve` daemon for this project, or null.
52
+ *
53
+ * The heartbeat file is written every 30s and removed on clean exit, but a
54
+ * SIGKILLed daemon leaves it behind — so liveness is confirmed against the pid
55
+ * itself, not the file's presence. A stale heartbeat must not make `org run`
56
+ * post a runfile nobody will ever read. */
57
+ export declare function liveServeDaemonPid(cwd: string): number | null;
58
+ /** Verdict of {@link classifyRun} — what `org status` should say about a
59
+ * runtime.json record that claims to be running.
60
+ * - `running` — alive and producing events.
61
+ * - `idle` — alive, but its event log has been silent for a while.
62
+ * - `crashed` — nothing says it is alive any more. */
63
+ export type RunState = 'running' | 'idle' | 'crashed';
64
+ /** Why a run was judged alive — `pid` is the recorded one still answering;
65
+ * the others mean the recorded pid is stale but the run demonstrably isn't. */
66
+ export type RunLiveEvidence = 'pid' | 'daemon-heartbeat' | 'run-activity';
67
+ /** Liveness verdict for one org's runtime.json record.
68
+ *
69
+ * #274: a single `process.kill(pid, 0)` probe used to be the whole verdict, so
70
+ * a run whose recorded pid had gone stale — the orchestrating process was
71
+ * restarted or re-attached without runtime.json being rewritten — was reported
72
+ * as "crashed" while its roles were actively exchanging messages, with a
73
+ * `mark-complete` suggestion that would have closed out live work. The pid is
74
+ * still the first and best signal; when it is gone, two independent signs of
75
+ * life are cross-checked before declaring a crash: a fresh `org serve`
76
+ * heartbeat that still lists this org, and the run's own event log still
77
+ * growing.
78
+ *
79
+ * Unchanged from before: a record that already says 'crashed' (including one
80
+ * written by the process-level crash handler) stays crashed — that is a
81
+ * recorded fact, not an inference. */
82
+ export declare function classifyRun(cwd: string, org: string, state: {
83
+ status?: string;
84
+ run?: string;
85
+ pid?: number;
86
+ closedBy?: string;
87
+ }, now?: number): {
88
+ state: RunState;
89
+ evidence?: RunLiveEvidence;
90
+ };
91
+ /** Result of {@link checkServeLock}. */
92
+ export type ServeLockCheck = {
93
+ ok: true;
94
+ staleHeartbeatRemoved: boolean;
95
+ } | {
96
+ ok: false;
97
+ pid: number;
98
+ };
99
+ /** Mutual-exclusion check for `org serve` startup.
100
+ *
101
+ * Two `org serve` processes started against the same project root have zero
102
+ * visibility into each other — each builds its own in-memory `OrgDaemon` and
103
+ * independently decides which orgs are "due now", so both can call
104
+ * `daemon.startOrg(name)` for the same org and have both processes write to
105
+ * the same on-disk state (runtime.json, decisions.jsonl, history.jsonl,
106
+ * .mail/) at once. `liveServeDaemonPid` already knows how to read this
107
+ * project's serve-heartbeat.json and tell a live daemon's heartbeat from a
108
+ * stale one (dead pid, or aged past a few missed 30s beats) — reused here
109
+ * as the actual pidfile lock, rather than inventing a second file, since it
110
+ * already IS a pidfile (pid + timestamp, written at startup and every
111
+ * heartbeat, removed on clean shutdown by `daemon.clearHeartbeat()`).
112
+ *
113
+ * Call this before the daemon/server/scheduler are constructed, so a
114
+ * refusal never opens a port, binds a broker lease, or touches any org's
115
+ * state. */
116
+ export declare function checkServeLock(cwd: string): ServeLockCheck;
117
+ //# sourceMappingURL=org-control.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org-control.d.ts","sourceRoot":"","sources":["../../../src/commands/org-control.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAMjD;;+CAE+C;AAC/C,eAAO,MAAM,WAAW,QAA2B,CAAC;AAEpD,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;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,MAAM,MAAM,cAAc,GACtB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,qBAAqB,EAAE,OAAO,CAAA;CAAE,GAC5C;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/B;;;;;;;;;;;;;;;;aAgBa;AACb,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAW1D"}
@@ -0,0 +1,274 @@
1
+ // packages/@monomind/cli/src/commands/org-control.ts
2
+ //
3
+ // Shared org helpers used across the `org` subcommand modules: org-name
4
+ // validation, org config discovery, the stop/reload/pause control files, and
5
+ // run/serve-daemon liveness checks.
6
+ import { existsSync, readdirSync, readFileSync, rmSync, statSync } from 'node:fs';
7
+ import { join } from 'node:path';
8
+ import { ORG_DIR, OrgDefSchema } from '../orgrt/types.js';
9
+ import { output } from '../output.js';
10
+ const log = (text) => {
11
+ console.log(text);
12
+ };
13
+ /** Org names are used to build filesystem paths under .monomind/orgs — reject
14
+ * anything that isn't a plain identifier to prevent path traversal (e.g.
15
+ * `monomind org stop '../../../../tmp/x'`). */
16
+ export const ORG_NAME_RE = /^[a-z0-9][a-z0-9_-]*$/i;
17
+ export function validateOrgName(name) {
18
+ if (!name)
19
+ return { ok: false, result: { success: false, message: 'org name required' } };
20
+ if (!ORG_NAME_RE.test(name)) {
21
+ log(output.error(`Invalid org name: ${name}`));
22
+ return { ok: false, result: { success: false, message: 'invalid org name' } };
23
+ }
24
+ return { ok: true, name };
25
+ }
26
+ /** Suffixes of org-internal artifact files (state/goals/threads/etc) that
27
+ * share the `<org>.json`/`.jsonl` naming pattern with the org's own config
28
+ * file. Single source of truth for both listOrgConfigFiles() (which must
29
+ * exclude them when discovering real org configs) and deleteAction (which
30
+ * must remove all of them when deleting an org). */
31
+ export const ORG_ARTIFACT_SUFFIXES = [
32
+ '-state',
33
+ '-goals',
34
+ '-threads',
35
+ '-activity',
36
+ '-approvals',
37
+ '-members',
38
+ '-secrets',
39
+ '-budgets',
40
+ '-routines',
41
+ '-issues',
42
+ '-projects',
43
+ '-workspaces',
44
+ '-worktrees',
45
+ '-environments',
46
+ '-plugins',
47
+ '-adapters',
48
+ '-join-requests',
49
+ '-bootstrap',
50
+ '-project-workspaces',
51
+ '-approval-comments',
52
+ '-runstate',
53
+ '-skills',
54
+ ];
55
+ export function listOrgConfigFiles(orgsDir) {
56
+ // endsWith, not includes: substring matching hid legitimate orgs whose NAME
57
+ // merely contains an artifact suffix anywhere (e.g. "state-machine.json",
58
+ // "issues-triage.json") — and anything hidden here is also invisible to
59
+ // run/list/serve while `org delete <sibling>` would still remove its files.
60
+ //
61
+ // ORG_NAME_RE on the stem (#309): a file is only an org config if its stem
62
+ // is a name an org could actually have. Otherwise any stray `.json` in the
63
+ // orgs dir (a tool's `.mcp.json`, `.DS_Store.json`, ...) becomes a phantom
64
+ // org that `org list` reports but validateOrgName rejects everywhere else.
65
+ // This subsumes the old `._` AppleDouble check (a leading dot fails the
66
+ // pattern) since a leading `.` doesn't match the required first character.
67
+ //
68
+ // A valid-looking stem isn't enough (#309 follow-up): a same-directory
69
+ // tool config can still pass ORG_NAME_RE (e.g. `toolconfig.json`). When a
70
+ // candidate parses as JSON, also require it to carry the one field every
71
+ // org config schema requires (OrgDefSchema's `name`) before calling it an
72
+ // org, so an unrelated tool config is skipped rather than surfaced as one.
73
+ // A file that fails to parse at all is left in the list on purpose: that's
74
+ // a real org config corrupted on disk, and callers like `org validate`
75
+ // (no name given) and `org list` already detect and report that case
76
+ // (invalid-config / validation failure) rather than treating it as healthy
77
+ // — silently dropping it here would hide the corruption instead.
78
+ return readdirSync(orgsDir).filter((f) => {
79
+ if (!f.endsWith('.json') ||
80
+ f.endsWith('.v1.json') ||
81
+ ORG_ARTIFACT_SUFFIXES.some((suf) => f.endsWith(`${suf}.json`)) ||
82
+ !ORG_NAME_RE.test(f.slice(0, -'.json'.length))) {
83
+ return false;
84
+ }
85
+ let parsed;
86
+ try {
87
+ parsed = JSON.parse(readFileSync(join(orgsDir, f), 'utf8'));
88
+ }
89
+ catch {
90
+ return true;
91
+ }
92
+ return OrgDefSchema.pick({ name: true }).safeParse(parsed).success;
93
+ });
94
+ }
95
+ /** Remove a lingering stopfile so a fresh `org run` doesn't self-terminate. */
96
+ export const clearStopfile = (cwd, name) => {
97
+ rmSync(join(cwd, ORG_DIR, name, 'stop'), { force: true });
98
+ };
99
+ /** Remove a lingering reload request so a fresh `org run` doesn't apply it on
100
+ * its first tick. One is left behind when a previous run's stop and reload
101
+ * landed in the same tick: the stop ends the wait before the reload poll runs. */
102
+ export const clearReloadfile = (cwd, name) => {
103
+ rmSync(join(cwd, ORG_DIR, name, 'reload'), { force: true });
104
+ };
105
+ /** Drop stop/reload requests left behind by a previous run, for every org
106
+ * `org serve` serves. #264: runAction clears these before its wait loop, but
107
+ * serveAction started polling with whatever was on disk — so an `org stop`
108
+ * that landed after the last daemon exited stopped the next daemon's org
109
+ * seconds into its run, and a leftover `org reload` was applied to a
110
+ * definition nobody had touched.
111
+ *
112
+ * Scope is the org config files, not `daemon.listRunning()` (what
113
+ * pollStopfiles/pollReloadfiles walk): nothing is running yet at startup, so
114
+ * sweeping by that would sweep nothing. Called before the first org can
115
+ * start, so a request that arrives once serve is up is never discarded.
116
+ *
117
+ * Runfiles are deliberately left in place. `.../run` is not the same kind of
118
+ * leftover: runAction writes one only against a live daemon and retracts it
119
+ * itself when nothing consumes it within 15s, and it reads the file's
120
+ * disappearance as "the daemon took the run". Deleting one here would report
121
+ * success to a waiting `org run` and start nothing — the silent loss that ack
122
+ * loop exists to prevent. A stale runfile at worst starts an org the operator
123
+ * did ask for; pollRunfiles already no-ops on one that is running.
124
+ *
125
+ * Returns the orgs it cleared something for. */
126
+ export const clearStaleControlFiles = (cwd) => {
127
+ const orgDir = join(cwd, ORG_DIR);
128
+ if (!existsSync(orgDir))
129
+ return [];
130
+ const cleared = [];
131
+ for (const f of listOrgConfigFiles(orgDir)) {
132
+ const name = f.replace(/\.json$/, '');
133
+ const stale = ['stop', 'reload'].filter((kind) => existsSync(join(orgDir, name, kind)));
134
+ if (!stale.length)
135
+ continue;
136
+ clearStopfile(cwd, name);
137
+ clearReloadfile(cwd, name);
138
+ log(output.warning(`org ${name}: discarding stale ${stale.join(' and ')} request left by a previous run`));
139
+ cleared.push(name);
140
+ }
141
+ return cleared;
142
+ };
143
+ /** True when a pause sentinel exists for an org. */
144
+ export const isOrgPaused = (cwd, name) => existsSync(join(cwd, ORG_DIR, name, 'pause'));
145
+ export const clearPausefile = (cwd, name) => {
146
+ rmSync(join(cwd, ORG_DIR, name, 'pause'), { force: true });
147
+ };
148
+ /** PID of a live `org serve` daemon for this project, or null.
149
+ *
150
+ * The heartbeat file is written every 30s and removed on clean exit, but a
151
+ * SIGKILLed daemon leaves it behind — so liveness is confirmed against the pid
152
+ * itself, not the file's presence. A stale heartbeat must not make `org run`
153
+ * post a runfile nobody will ever read. */
154
+ export function liveServeDaemonPid(cwd) {
155
+ try {
156
+ const hb = JSON.parse(readFileSync(join(cwd, '.monomind', 'serve-heartbeat.json'), 'utf8'));
157
+ if (typeof hb.pid !== 'number' || hb.pid === process.pid)
158
+ return null;
159
+ // Freshness as well as liveness. The daemon beats every 30s, so a stamp
160
+ // older than a few beats means it is gone or wedged — and a pid alone can
161
+ // be recycled onto an unrelated process, which would send the runfile to
162
+ // something that will never read it.
163
+ const age = Date.now() - Date.parse(hb.updatedAt ?? '');
164
+ if (!Number.isFinite(age) || age > 3 * 60_000)
165
+ return null;
166
+ process.kill(hb.pid, 0); // throws if the process is gone
167
+ return hb.pid;
168
+ }
169
+ catch {
170
+ return null;
171
+ }
172
+ }
173
+ /** How long a run's own event log counts as proof of life after its last
174
+ * appended event. Deliberately generous: calling a live run "crashed" sends
175
+ * the operator to `org mark-complete`, which closes out a run that is still
176
+ * working, while being slow to notice a genuinely dead one costs nothing. */
177
+ const RUN_ACTIVITY_WINDOW_MS = 10 * 60_000;
178
+ /** Liveness verdict for one org's runtime.json record.
179
+ *
180
+ * #274: a single `process.kill(pid, 0)` probe used to be the whole verdict, so
181
+ * a run whose recorded pid had gone stale — the orchestrating process was
182
+ * restarted or re-attached without runtime.json being rewritten — was reported
183
+ * as "crashed" while its roles were actively exchanging messages, with a
184
+ * `mark-complete` suggestion that would have closed out live work. The pid is
185
+ * still the first and best signal; when it is gone, two independent signs of
186
+ * life are cross-checked before declaring a crash: a fresh `org serve`
187
+ * heartbeat that still lists this org, and the run's own event log still
188
+ * growing.
189
+ *
190
+ * Unchanged from before: a record that already says 'crashed' (including one
191
+ * written by the process-level crash handler) stays crashed — that is a
192
+ * recorded fact, not an inference. */
193
+ export function classifyRun(cwd, org, state, now = Date.now()) {
194
+ if (state.status === 'crashed')
195
+ return { state: 'crashed' };
196
+ const busAge = () => {
197
+ if (!state.run)
198
+ return null;
199
+ try {
200
+ const age = now - statSync(join(cwd, ORG_DIR, org, state.run, 'bus.jsonl')).mtimeMs;
201
+ return age >= 0 ? age : 0;
202
+ }
203
+ catch {
204
+ return null;
205
+ }
206
+ };
207
+ const live = (evidence) => {
208
+ const age = busAge();
209
+ return { state: age !== null && age > RUN_ACTIVITY_WINDOW_MS ? 'idle' : 'running', evidence };
210
+ };
211
+ if (state.pid) {
212
+ try {
213
+ process.kill(state.pid, 0);
214
+ return live('pid');
215
+ }
216
+ catch {
217
+ /* recorded pid is gone — fall through to the cross-checks */
218
+ }
219
+ }
220
+ else {
221
+ // No pid was ever recorded; there is nothing to call stale.
222
+ return live('pid');
223
+ }
224
+ try {
225
+ const hb = JSON.parse(readFileSync(join(cwd, '.monomind', 'serve-heartbeat.json'), 'utf8'));
226
+ const age = now - Date.parse(hb.updatedAt ?? '');
227
+ if (typeof hb.pid === 'number' &&
228
+ Number.isFinite(age) &&
229
+ age <= 3 * 60_000 &&
230
+ (hb.running ?? []).includes(org)) {
231
+ process.kill(hb.pid, 0); // throws if that daemon is gone too
232
+ return live('daemon-heartbeat');
233
+ }
234
+ }
235
+ catch {
236
+ /* no heartbeat file, unparseable, or its daemon is gone as well */
237
+ }
238
+ const age = busAge();
239
+ if (age !== null && age <= RUN_ACTIVITY_WINDOW_MS)
240
+ return { state: 'running', evidence: 'run-activity' };
241
+ return { state: 'crashed' };
242
+ }
243
+ /** Mutual-exclusion check for `org serve` startup.
244
+ *
245
+ * Two `org serve` processes started against the same project root have zero
246
+ * visibility into each other — each builds its own in-memory `OrgDaemon` and
247
+ * independently decides which orgs are "due now", so both can call
248
+ * `daemon.startOrg(name)` for the same org and have both processes write to
249
+ * the same on-disk state (runtime.json, decisions.jsonl, history.jsonl,
250
+ * .mail/) at once. `liveServeDaemonPid` already knows how to read this
251
+ * project's serve-heartbeat.json and tell a live daemon's heartbeat from a
252
+ * stale one (dead pid, or aged past a few missed 30s beats) — reused here
253
+ * as the actual pidfile lock, rather than inventing a second file, since it
254
+ * already IS a pidfile (pid + timestamp, written at startup and every
255
+ * heartbeat, removed on clean shutdown by `daemon.clearHeartbeat()`).
256
+ *
257
+ * Call this before the daemon/server/scheduler are constructed, so a
258
+ * refusal never opens a port, binds a broker lease, or touches any org's
259
+ * state. */
260
+ export function checkServeLock(cwd) {
261
+ const owner = liveServeDaemonPid(cwd);
262
+ if (owner != null)
263
+ return { ok: false, pid: owner };
264
+ // liveServeDaemonPid() has already ruled out a live owner — any heartbeat
265
+ // file still on disk here is stale (dead pid, or a SIGKILLed daemon that
266
+ // never reached clearHeartbeat()). Remove it so it can't be misread by
267
+ // `org run`/`org status` before this daemon's own writeHeartbeat() lands.
268
+ const heartbeatPath = join(cwd, '.monomind', 'serve-heartbeat.json');
269
+ const staleHeartbeatRemoved = existsSync(heartbeatPath);
270
+ if (staleHeartbeatRemoved)
271
+ rmSync(heartbeatPath, { force: true });
272
+ return { ok: true, staleHeartbeatRemoved };
273
+ }
274
+ //# sourceMappingURL=org-control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org-control.js","sourceRoot":"","sources":["../../../src/commands/org-control.ts"],"names":[],"mappings":"AAAA,q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ACxD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAC9B,CAAC;AAOD;;;;;;;;;;;;;;;;aAgBa;AACb,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACtC,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IACpD,0EAA0E;IAC1E,yEAAyE;IACzE,uEAAuE;IACvE,0EAA0E;IAC1E,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,sBAAsB,CAAC,CAAC;IACrE,MAAM,qBAAqB,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IACxD,IAAI,qBAAqB;QAAE,MAAM,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { CommandContext, CommandResult } from '../types.js';
2
+ export declare const stopAction: (ctx: CommandContext) => Promise<CommandResult>;
3
+ export declare const pauseAction: (ctx: CommandContext) => Promise<CommandResult>;
4
+ export declare const resumeAction: (ctx: CommandContext) => Promise<CommandResult>;
5
+ export declare const reloadAction: (ctx: CommandContext) => Promise<CommandResult>;
6
+ export declare const statusAction: (ctx: CommandContext) => Promise<CommandResult>;
7
+ //# sourceMappingURL=org-lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org-lifecycle.d.ts","sourceRoot":"","sources":["../../../src/commands/org-lifecycle.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAajE,eAAO,MAAM,UAAU,QAAe,cAAc,KAAG,OAAO,CAAC,aAAa,CAkD3E,CAAC;AAEF,eAAO,MAAM,WAAW,QAAe,cAAc,KAAG,OAAO,CAAC,aAAa,CAoB5E,CAAC;AAEF,eAAO,MAAM,YAAY,QAAe,cAAc,KAAG,OAAO,CAAC,aAAa,CAW7E,CAAC;AAEF,eAAO,MAAM,YAAY,QAAe,cAAc,KAAG,OAAO,CAAC,aAAa,CAS7E,CAAC;AAEF,eAAO,MAAM,YAAY,QAAe,cAAc,KAAG,OAAO,CAAC,aAAa,CAuN7E,CAAC"}