@brutalsystems/muster 0.11.0 → 1.0.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/README.md +108 -1038
- package/dist/agents.js +47 -0
- package/dist/claude-policy.js +25 -0
- package/dist/codex-policy.js +19 -1
- package/dist/config.js +30 -1
- package/dist/enforcement.js +2 -1
- package/dist/guard.js +10 -19
- package/dist/help.js +4 -0
- package/dist/identity/processes.js +10 -0
- package/dist/identity/workspace-key.js +59 -0
- package/dist/mcp-tools.js +5 -0
- package/dist/mcp.js +0 -44
- package/dist/muster.js +1 -0
- package/dist/options.js +63 -0
- package/dist/refresh/index.js +66 -0
- package/dist/run.js +546 -373
- package/dist/stop/opencode.js +32 -0
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { OpenCodeHttp } from "../opencode-http.js";
|
|
2
|
+
import { openCodeEndpointOwnedBy } from "../identity/opencode.js";
|
|
3
|
+
import { isSame } from "../identity/processes.js";
|
|
4
|
+
/**
|
|
5
|
+
* Ask an OpenCode session to abort before anything is signalled.
|
|
6
|
+
*
|
|
7
|
+
* OpenCode is a server with work possibly in flight, so it gets told to stop
|
|
8
|
+
* rather than only being killed — Claude and Codex have nothing equivalent to
|
|
9
|
+
* say. Best effort by design: a failure here is not a reason to leave processes
|
|
10
|
+
* running, and the kill that follows is what actually guarantees the stop.
|
|
11
|
+
*
|
|
12
|
+
* Every precondition is a reason not to shout at a stranger. The endpoint must
|
|
13
|
+
* still be owned by the process Muster started, because a loopback port is a
|
|
14
|
+
* shared resource and a pid can be reused — without that check an abort could
|
|
15
|
+
* be sent to whatever now happens to be listening on that port.
|
|
16
|
+
*
|
|
17
|
+
* Lives outside `opencode-policy.ts` deliberately: that module imports
|
|
18
|
+
* `guard.ts`, which imports the agent table, so referencing it from a row would
|
|
19
|
+
* close a cycle and leave the slot undefined depending on evaluation order.
|
|
20
|
+
*/
|
|
21
|
+
export async function abortOpenCodeSession(entry, deadline) {
|
|
22
|
+
const sessionId = entry.peer?.session_id;
|
|
23
|
+
if (!entry.root ||
|
|
24
|
+
!entry.server_url ||
|
|
25
|
+
typeof sessionId !== "string" ||
|
|
26
|
+
!(await isSame(entry.root)) ||
|
|
27
|
+
!(await openCodeEndpointOwnedBy(entry.root.pid, entry.server_url, deadline)))
|
|
28
|
+
return;
|
|
29
|
+
await new OpenCodeHttp(entry.server_url)
|
|
30
|
+
.abort(sessionId, deadline)
|
|
31
|
+
.catch(() => { });
|
|
32
|
+
}
|