@clipboard-health/groundcrew 4.43.3 → 4.44.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/dist/lib/agentLaunch.d.ts.map +1 -1
- package/dist/lib/agentLaunch.js +12 -1
- package/dist/lib/cmuxAgentHooks.d.ts +30 -0
- package/dist/lib/cmuxAgentHooks.d.ts.map +1 -0
- package/dist/lib/cmuxAgentHooks.js +35 -0
- package/dist/lib/launchCommand.d.ts +6 -0
- package/dist/lib/launchCommand.d.ts.map +1 -1
- package/dist/lib/launchCommand.js +3 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentLaunch.d.ts","sourceRoot":"","sources":["../../src/lib/agentLaunch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agentLaunch.d.ts","sourceRoot":"","sources":["../../src/lib/agentLaunch.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAErB,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;AAM5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,MAAM,EAAE,WAAW,CAAC;IACpB,aAAa,EAAE,oBAAoB,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,eAAe,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,sBAAsB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,aAAa,EAAE,aAAa,CAAC;IAC7B,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAClD,kBAAkB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACzC,oBAAoB,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CACtD,GAAG;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAqChE;AA4DD,UAAU,mBAAmB;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,iFAAiF;IACjF,aAAa,EAAE,oBAAoB,CAAC;IACpC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC;AAED,wBAAsB,kBAAkB,CAAC,KAAK,EAAE;IAC9C,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,eAAe,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAsD/B;AAwBD,wBAAsB,kBAAkB,CAAC,KAAK,EAAE;IAC9C,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,IAAI,CAAC,CAUhB"}
|
package/dist/lib/agentLaunch.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ensureClearance, resolveSafehouseCmuxIntegration, safehouseCmuxIntegrationWarningLines, } from "@clipboard-health/clearance";
|
|
2
2
|
import { clearanceAllowHostsFilesFromEnvironment } from "./clearanceAllowlist.js";
|
|
3
|
+
import { cmuxAgentHookSettingsJson } from "./cmuxAgentHooks.js";
|
|
4
|
+
import { shellSingleQuote } from "./shell.js";
|
|
3
5
|
import { hasPreLaunchEnv, } from "./config.js";
|
|
4
6
|
import { detectHostCapabilities } from "./host.js";
|
|
5
7
|
import { buildLaunchCommand, inferAgentCommandName, } from "./launchCommand.js";
|
|
@@ -72,7 +74,8 @@ function safehouseAgentIntegrationFor(workspaceKind, definition) {
|
|
|
72
74
|
if (workspaceKind !== "cmux") {
|
|
73
75
|
return undefined;
|
|
74
76
|
}
|
|
75
|
-
const
|
|
77
|
+
const agentCommandName = inferAgentCommandName(definition.cmd);
|
|
78
|
+
const isClaudeAgent = agentCommandName === "claude";
|
|
76
79
|
const cmuxIntegration = resolveSafehouseCmuxIntegration();
|
|
77
80
|
if (isClaudeAgent) {
|
|
78
81
|
warnOnCmuxIntegrationDrift({ unreviewedEnvNames: cmuxIntegration.unreviewedEnvNames });
|
|
@@ -81,6 +84,14 @@ function safehouseAgentIntegrationFor(workspaceKind, definition) {
|
|
|
81
84
|
addDirsReadOnly: cmuxIntegration.addDirsReadOnly,
|
|
82
85
|
envPass: cmuxIntegration.envPass,
|
|
83
86
|
commandPreludes: isClaudeAgent ? [cmuxIntegration.claudeCommandPrelude] : [],
|
|
87
|
+
...(isClaudeAgent
|
|
88
|
+
? {
|
|
89
|
+
agentArgs: [
|
|
90
|
+
"--settings",
|
|
91
|
+
shellSingleQuote(cmuxAgentHookSettingsJson({ agent: agentCommandName })),
|
|
92
|
+
],
|
|
93
|
+
}
|
|
94
|
+
: {}),
|
|
84
95
|
};
|
|
85
96
|
}
|
|
86
97
|
function warnOnCmuxIntegrationDrift(input) {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
interface CmuxAgentHookCommand {
|
|
2
|
+
type: "command";
|
|
3
|
+
command: string;
|
|
4
|
+
}
|
|
5
|
+
interface CmuxAgentHookGroup {
|
|
6
|
+
hooks: readonly CmuxAgentHookCommand[];
|
|
7
|
+
}
|
|
8
|
+
export interface CmuxAgentHookSettings {
|
|
9
|
+
hooks: Record<string, readonly CmuxAgentHookGroup[]>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Claude Code hook settings that report the agent's own lifecycle to the cmux
|
|
13
|
+
* sidebar. Passed to the agent as `--settings <json>` (Layer A of the live
|
|
14
|
+
* activity bridge), so the panel reflects what the agent is doing within a
|
|
15
|
+
* session rather than the single coarse milestone the orchestrator can paint.
|
|
16
|
+
*
|
|
17
|
+
* Each hook calls `cmux set-progress` against `$CMUX_WORKSPACE_ID` — present in
|
|
18
|
+
* the safehouse cmux env-pass allowlist, so the call reaches cmux from inside
|
|
19
|
+
* the sandbox and resolves identity by id rather than the brittle title match.
|
|
20
|
+
* The call is guarded and best-effort: a missing workspace id or a cmux failure
|
|
21
|
+
* is swallowed so a hook never breaks the agent.
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildCmuxAgentHookSettings(input: {
|
|
24
|
+
agent: string;
|
|
25
|
+
}): CmuxAgentHookSettings;
|
|
26
|
+
export declare function cmuxAgentHookSettingsJson(input: {
|
|
27
|
+
agent: string;
|
|
28
|
+
}): string;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=cmuxAgentHooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmuxAgentHooks.d.ts","sourceRoot":"","sources":["../../src/lib/cmuxAgentHooks.ts"],"names":[],"mappings":"AAEA,UAAU,oBAAoB;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,kBAAkB;IAC1B,KAAK,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,kBAAkB,EAAE,CAAC,CAAC;CACtD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,CAgB1F;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE1E"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { shellSingleQuote } from "./shell.js";
|
|
2
|
+
/**
|
|
3
|
+
* Claude Code hook settings that report the agent's own lifecycle to the cmux
|
|
4
|
+
* sidebar. Passed to the agent as `--settings <json>` (Layer A of the live
|
|
5
|
+
* activity bridge), so the panel reflects what the agent is doing within a
|
|
6
|
+
* session rather than the single coarse milestone the orchestrator can paint.
|
|
7
|
+
*
|
|
8
|
+
* Each hook calls `cmux set-progress` against `$CMUX_WORKSPACE_ID` — present in
|
|
9
|
+
* the safehouse cmux env-pass allowlist, so the call reaches cmux from inside
|
|
10
|
+
* the sandbox and resolves identity by id rather than the brittle title match.
|
|
11
|
+
* The call is guarded and best-effort: a missing workspace id or a cmux failure
|
|
12
|
+
* is swallowed so a hook never breaks the agent.
|
|
13
|
+
*/
|
|
14
|
+
export function buildCmuxAgentHookSettings(input) {
|
|
15
|
+
const { agent } = input;
|
|
16
|
+
const phases = [
|
|
17
|
+
{ event: "SessionStart", value: 0.05, label: `running · ${agent}` },
|
|
18
|
+
{ event: "UserPromptSubmit", value: 0.5, label: "working" },
|
|
19
|
+
{ event: "Notification", value: 0.5, label: "needs input" },
|
|
20
|
+
{ event: "Stop", value: 0.9, label: "idle" },
|
|
21
|
+
{ event: "SessionEnd", value: 1, label: "done" },
|
|
22
|
+
];
|
|
23
|
+
const hooks = {};
|
|
24
|
+
for (const phase of phases) {
|
|
25
|
+
hooks[phase.event] = [{ hooks: [{ type: "command", command: setProgressCommand(phase) }] }];
|
|
26
|
+
}
|
|
27
|
+
return { hooks };
|
|
28
|
+
}
|
|
29
|
+
export function cmuxAgentHookSettingsJson(input) {
|
|
30
|
+
return JSON.stringify(buildCmuxAgentHookSettings(input));
|
|
31
|
+
}
|
|
32
|
+
function setProgressCommand(phase) {
|
|
33
|
+
const setProgress = `"\${CMUX_BUNDLED_CLI_PATH:-cmux}" set-progress ${phase.value} --label ${shellSingleQuote(phase.label)} --workspace "$CMUX_WORKSPACE_ID" >/dev/null 2>&1 || true`;
|
|
34
|
+
return `if [ -n "$CMUX_WORKSPACE_ID" ]; then ${setProgress}; fi`;
|
|
35
|
+
}
|
|
@@ -49,6 +49,12 @@ export interface SafehouseAgentIntegration {
|
|
|
49
49
|
addDirsReadOnly: readonly string[];
|
|
50
50
|
envPass: readonly string[];
|
|
51
51
|
commandPreludes: readonly string[];
|
|
52
|
+
/**
|
|
53
|
+
* Extra, already-shell-safe argv tokens appended to the agent invocation
|
|
54
|
+
* before the prompt positional (e.g. `--settings <quoted-json>` to inject
|
|
55
|
+
* cmux activity-reporting hooks for a Claude agent).
|
|
56
|
+
*/
|
|
57
|
+
agentArgs?: readonly string[];
|
|
52
58
|
}
|
|
53
59
|
interface LaunchCommandArguments {
|
|
54
60
|
definition: AgentDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launchCommand.d.ts","sourceRoot":"","sources":["../../src/lib/launchCommand.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAC1B,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,GAAE,MAAwB,GAAG,MAAM,CAcvF;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,MAAwB,GAAG,MAAM,CAgB3E;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MA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sB,GAAG,MAAM,CAkC7E"}
|
|
@@ -159,8 +159,10 @@ function renderPrepareAndAgentCommand(arguments_) {
|
|
|
159
159
|
worktreeDir: arguments_.worktreeDir,
|
|
160
160
|
sandboxName: arguments_.sandboxName ?? "",
|
|
161
161
|
});
|
|
162
|
+
const agentArgs = arguments_.safehouseAgentIntegration?.agentArgs ?? [];
|
|
163
|
+
const agentInvocation = agentArgs.length === 0 ? agentCmd : `${agentCmd} ${agentArgs.join(" ")}`;
|
|
162
164
|
return {
|
|
163
|
-
agentCommand: `exec ${
|
|
165
|
+
agentCommand: `exec ${agentInvocation} "$@"`,
|
|
164
166
|
prepareWorktreeCommand: arguments_.prepareWorktreeCommand === undefined
|
|
165
167
|
? undefined
|
|
166
168
|
: prepareWorktreeWithStatusReporting(arguments_.prepareWorktreeCommand),
|
package/package.json
CHANGED