@a5c-ai/babysitter-opencode 5.0.1-staging.e4f17eff → 5.0.1-staging.ef4e872c
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 +2 -2
- package/bin/cli.cjs +1 -191
- package/bin/cli.js +90 -49
- package/bin/install-shared.cjs +1 -478
- package/bin/install-shared.js +615 -0
- package/bin/install.cjs +1 -143
- package/bin/install.js +18 -98
- package/bin/uninstall.cjs +1 -87
- package/bin/uninstall.js +12 -34
- package/commands/doctor.md +5 -5
- package/commands/help.md +245 -244
- package/commands/observe.md +12 -12
- package/hooks/babysitter-proxied-session-created.js +18 -212
- package/hooks/babysitter-proxied-session-created.sh +11 -0
- package/hooks/babysitter-proxied-session-idle.js +18 -167
- package/hooks/babysitter-proxied-session-idle.sh +3 -0
- package/hooks/babysitter-proxied-shell-env.js +21 -145
- package/hooks/babysitter-proxied-shell-env.sh +3 -0
- package/hooks/babysitter-proxied-tool-execute-after.js +20 -160
- package/hooks/babysitter-proxied-tool-execute-after.sh +3 -0
- package/hooks/babysitter-proxied-tool-execute-before.js +20 -162
- package/hooks/babysitter-proxied-tool-execute-before.sh +3 -0
- package/hooks/hooks.json +18 -18
- package/package.json +22 -18
- package/plugin.json +6 -4
- package/scripts/team-install.js +23 -0
- package/skills/contrib/SKILL.md +25 -25
- package/skills/doctor/SKILL.md +5 -5
- package/skills/help/SKILL.md +3 -2
- package/skills/observe/SKILL.md +1 -1
- package/skills/plugins/SKILL.md +243 -243
- package/skills/project-install/SKILL.md +3 -3
- package/skills/resume/SKILL.md +1 -1
- package/skills/retrospect/SKILL.md +48 -48
- package/skills/user-install/SKILL.md +3 -3
- package/versions.json +2 -2
- package/hooks/hooks.json.legacy +0 -46
- package/hooks/proxied-hooks.json +0 -47
- package/hooks/session-created.js +0 -182
- package/hooks/session-idle.js +0 -124
- package/hooks/shell-env.js +0 -88
- package/hooks/tool-execute-after.js +0 -107
- package/hooks/tool-execute-before.js +0 -109
|
@@ -1,164 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Unified Tool Execute After Hook for OpenCode
|
|
4
|
-
* Routes through hooks-proxy for all hook execution.
|
|
5
|
-
*
|
|
6
|
-
* Fires after a tool execution in OpenCode. Delegates to
|
|
7
|
-
* `babysitter hook:run --hook-type post-tool-use` via hooks-proxy.
|
|
8
|
-
*
|
|
9
|
-
* This hook can be used to:
|
|
10
|
-
* - Log tool execution results for babysitter run observability
|
|
11
|
-
* - Trigger babysitter effects based on tool outputs
|
|
12
|
-
* - Update session state after tool executions
|
|
13
|
-
*
|
|
14
|
-
* OpenCode plugin protocol:
|
|
15
|
-
* - Receives tool result context as JSON via stdin
|
|
16
|
-
* - Outputs JSON to stdout
|
|
17
|
-
* - Exit 0 = success
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
2
|
"use strict";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
function blog(msg) {
|
|
39
|
-
ensureDir(LOG_DIR);
|
|
40
|
-
const ts = new Date().toISOString();
|
|
41
|
-
try {
|
|
42
|
-
appendFileSync(LOG_FILE, `[INFO] ${ts} ${msg}\n`);
|
|
43
|
-
} catch { /* best-effort */ }
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function getSdkVersion() {
|
|
47
|
-
try {
|
|
48
|
-
const versions = JSON.parse(readFileSync(path.join(PLUGIN_ROOT, "versions.json"), "utf8"));
|
|
49
|
-
return versions.sdkVersion || "latest";
|
|
50
|
-
} catch {
|
|
51
|
-
return "latest";
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function resolveHooksProxy() {
|
|
56
|
-
try {
|
|
57
|
-
execSync("a5c-hooks-proxy --version", { stdio: "pipe", timeout: 5000 });
|
|
58
|
-
return "a5c-hooks-proxy";
|
|
59
|
-
} catch { /* not in PATH */ }
|
|
60
|
-
|
|
61
|
-
const localProxy = path.join(
|
|
62
|
-
process.env.HOME || process.env.USERPROFILE || "~",
|
|
63
|
-
".local", "bin", process.platform === "win32" ? "a5c-hooks-proxy.exe" : "a5c-hooks-proxy"
|
|
64
|
-
);
|
|
65
|
-
if (existsSync(localProxy)) {
|
|
66
|
-
return localProxy;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function installHooksProxy(version) {
|
|
73
|
-
if (existsSync(PROXY_MARKER)) return;
|
|
74
|
-
|
|
75
|
-
try {
|
|
76
|
-
execSync(`npm i -g "@a5c-ai/hooks-proxy-cli@${version}" --loglevel=error`, {
|
|
77
|
-
stdio: "pipe",
|
|
78
|
-
timeout: 120000,
|
|
79
|
-
});
|
|
80
|
-
blog(`Installed hooks-proxy globally (${version})`);
|
|
81
|
-
} catch {
|
|
82
|
-
try {
|
|
83
|
-
const prefix = path.join(process.env.HOME || process.env.USERPROFILE || "~", ".local");
|
|
84
|
-
execSync(`npm i -g "@a5c-ai/hooks-proxy-cli@${version}" --prefix "${prefix}" --loglevel=error`, {
|
|
85
|
-
stdio: "pipe",
|
|
86
|
-
timeout: 120000,
|
|
87
|
-
});
|
|
88
|
-
blog(`Installed hooks-proxy to user prefix (${version})`);
|
|
89
|
-
} catch {
|
|
90
|
-
blog("hooks-proxy installation failed");
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
try { writeFileSync(PROXY_MARKER, version); } catch { /* best-effort */ }
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function main() {
|
|
98
|
-
const sessionId = process.env.BABYSITTER_SESSION_ID
|
|
99
|
-
|| process.env.OPENCODE_SESSION_ID
|
|
100
|
-
|| "";
|
|
101
|
-
|
|
102
|
-
if (!sessionId) {
|
|
103
|
-
process.stdout.write("{}\n");
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Read stdin for tool result context
|
|
108
|
-
let inputData = "";
|
|
109
|
-
try {
|
|
110
|
-
inputData = require("fs").readFileSync(0, "utf8");
|
|
111
|
-
} catch {
|
|
112
|
-
// No stdin available
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
blog(`Unified tool-execute-after: session=${sessionId}`);
|
|
116
|
-
|
|
117
|
-
const hookInput = JSON.stringify({
|
|
118
|
-
session_id: sessionId,
|
|
119
|
-
cwd: process.cwd(),
|
|
120
|
-
harness: "opencode",
|
|
121
|
-
plugin_root: PLUGIN_ROOT,
|
|
122
|
-
tool_result: inputData ? JSON.parse(inputData) : {},
|
|
3
|
+
var execSync = require("child_process").execSync;
|
|
4
|
+
var path = require("path");
|
|
5
|
+
var readFileSync = require("fs").readFileSync;
|
|
6
|
+
|
|
7
|
+
var PLUGIN_ROOT = process.env.PLUGIN_ROOT || process.env.PLUGIN_ROOT || path.resolve(__dirname, "..");
|
|
8
|
+
var stdin = "";
|
|
9
|
+
try { stdin = readFileSync(0, "utf8"); } catch {}
|
|
10
|
+
try {
|
|
11
|
+
var result = execSync("bash " + JSON.stringify(path.join(PLUGIN_ROOT, "hooks/post-tool-use.sh")), {
|
|
12
|
+
input: stdin,
|
|
13
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
14
|
+
timeout: 30000,
|
|
15
|
+
env: Object.assign({}, process.env, {
|
|
16
|
+
HOOK_TYPE: process.env.HOOK_TYPE || "",
|
|
17
|
+
ADAPTER_NAME: process.env.ADAPTER_NAME || "opencode",
|
|
18
|
+
PLUGIN_ROOT: PLUGIN_ROOT
|
|
19
|
+
})
|
|
123
20
|
});
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
// Ensure hooks-proxy is installed
|
|
128
|
-
let proxy = resolveHooksProxy();
|
|
129
|
-
if (!proxy) {
|
|
130
|
-
installHooksProxy(sdkVersion);
|
|
131
|
-
proxy = resolveHooksProxy();
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const handler = `babysitter hook:run --harness unified --hook-type post-tool-use --plugin-root ${PLUGIN_ROOT} --state-dir ${STATE_DIR} --json`;
|
|
135
|
-
|
|
136
|
-
try {
|
|
137
|
-
let result;
|
|
138
|
-
if (proxy) {
|
|
139
|
-
blog(`Using hooks-proxy: ${proxy}`);
|
|
140
|
-
result = execSync(`"${proxy}" invoke --adapter opencode --handler "${handler}" --json`, {
|
|
141
|
-
input: hookInput,
|
|
142
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
143
|
-
timeout: 10000,
|
|
144
|
-
env: { ...process.env, BABYSITTER_STATE_DIR: STATE_DIR },
|
|
145
|
-
});
|
|
146
|
-
} else {
|
|
147
|
-
blog("hooks-proxy not found after install, using npx fallback");
|
|
148
|
-
result = execSync(`npx -y "@a5c-ai/hooks-proxy-cli@${sdkVersion}" invoke --adapter opencode --handler "${handler}" --json`, {
|
|
149
|
-
input: hookInput,
|
|
150
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
151
|
-
timeout: 30000,
|
|
152
|
-
env: { ...process.env, BABYSITTER_STATE_DIR: STATE_DIR },
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
const output = result.toString("utf8").trim();
|
|
156
|
-
blog(`Hook result: ${output}`);
|
|
157
|
-
process.stdout.write((output || "{}") + "\n");
|
|
158
|
-
} catch (err) {
|
|
159
|
-
blog(`Post-tool-use hook failed: ${err.message} -- non-blocking`);
|
|
160
|
-
process.stdout.write("{}\n");
|
|
161
|
-
}
|
|
21
|
+
process.stdout.write(result);
|
|
22
|
+
} catch (e) {
|
|
23
|
+
process.stdout.write("{}\n");
|
|
162
24
|
}
|
|
163
|
-
|
|
164
|
-
main();
|
|
@@ -1,166 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Unified Tool Execute Before Hook for OpenCode
|
|
4
|
-
* Routes through hooks-proxy for all hook execution.
|
|
5
|
-
*
|
|
6
|
-
* Fires before a tool execution in OpenCode. Delegates to
|
|
7
|
-
* `babysitter hook:run --hook-type pre-tool-use` via hooks-proxy.
|
|
8
|
-
*
|
|
9
|
-
* This hook can be used to:
|
|
10
|
-
* - Log tool invocations for babysitter run observability
|
|
11
|
-
* - Block certain tool calls during specific orchestration phases
|
|
12
|
-
* - Inject babysitter context into tool arguments
|
|
13
|
-
*
|
|
14
|
-
* OpenCode plugin protocol:
|
|
15
|
-
* - Receives tool context as JSON via stdin
|
|
16
|
-
* - Outputs JSON to stdout (empty = allow, { block: true } = block)
|
|
17
|
-
* - Exit 0 = success
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
2
|
"use strict";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
function blog(msg) {
|
|
39
|
-
ensureDir(LOG_DIR);
|
|
40
|
-
const ts = new Date().toISOString();
|
|
41
|
-
try {
|
|
42
|
-
appendFileSync(LOG_FILE, `[INFO] ${ts} ${msg}\n`);
|
|
43
|
-
} catch { /* best-effort */ }
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function getSdkVersion() {
|
|
47
|
-
try {
|
|
48
|
-
const versions = JSON.parse(readFileSync(path.join(PLUGIN_ROOT, "versions.json"), "utf8"));
|
|
49
|
-
return versions.sdkVersion || "latest";
|
|
50
|
-
} catch {
|
|
51
|
-
return "latest";
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function resolveHooksProxy() {
|
|
56
|
-
try {
|
|
57
|
-
execSync("a5c-hooks-proxy --version", { stdio: "pipe", timeout: 5000 });
|
|
58
|
-
return "a5c-hooks-proxy";
|
|
59
|
-
} catch { /* not in PATH */ }
|
|
60
|
-
|
|
61
|
-
const localProxy = path.join(
|
|
62
|
-
process.env.HOME || process.env.USERPROFILE || "~",
|
|
63
|
-
".local", "bin", process.platform === "win32" ? "a5c-hooks-proxy.exe" : "a5c-hooks-proxy"
|
|
64
|
-
);
|
|
65
|
-
if (existsSync(localProxy)) {
|
|
66
|
-
return localProxy;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function installHooksProxy(version) {
|
|
73
|
-
if (existsSync(PROXY_MARKER)) return;
|
|
74
|
-
|
|
75
|
-
try {
|
|
76
|
-
execSync(`npm i -g "@a5c-ai/hooks-proxy-cli@${version}" --loglevel=error`, {
|
|
77
|
-
stdio: "pipe",
|
|
78
|
-
timeout: 120000,
|
|
79
|
-
});
|
|
80
|
-
blog(`Installed hooks-proxy globally (${version})`);
|
|
81
|
-
} catch {
|
|
82
|
-
try {
|
|
83
|
-
const prefix = path.join(process.env.HOME || process.env.USERPROFILE || "~", ".local");
|
|
84
|
-
execSync(`npm i -g "@a5c-ai/hooks-proxy-cli@${version}" --prefix "${prefix}" --loglevel=error`, {
|
|
85
|
-
stdio: "pipe",
|
|
86
|
-
timeout: 120000,
|
|
87
|
-
});
|
|
88
|
-
blog(`Installed hooks-proxy to user prefix (${version})`);
|
|
89
|
-
} catch {
|
|
90
|
-
blog("hooks-proxy installation failed");
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
try { writeFileSync(PROXY_MARKER, version); } catch { /* best-effort */ }
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function main() {
|
|
98
|
-
const sessionId = process.env.BABYSITTER_SESSION_ID
|
|
99
|
-
|| process.env.OPENCODE_SESSION_ID
|
|
100
|
-
|| "";
|
|
101
|
-
|
|
102
|
-
if (!sessionId) {
|
|
103
|
-
// No session -- pass through without intervention
|
|
104
|
-
process.stdout.write("{}\n");
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Read stdin for tool context
|
|
109
|
-
let inputData = "";
|
|
110
|
-
try {
|
|
111
|
-
inputData = require("fs").readFileSync(0, "utf8");
|
|
112
|
-
} catch {
|
|
113
|
-
// No stdin available
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
blog(`Unified tool-execute-before: session=${sessionId}`);
|
|
117
|
-
|
|
118
|
-
const hookInput = JSON.stringify({
|
|
119
|
-
session_id: sessionId,
|
|
120
|
-
cwd: process.cwd(),
|
|
121
|
-
harness: "opencode",
|
|
122
|
-
plugin_root: PLUGIN_ROOT,
|
|
123
|
-
tool_context: inputData ? JSON.parse(inputData) : {},
|
|
3
|
+
var execSync = require("child_process").execSync;
|
|
4
|
+
var path = require("path");
|
|
5
|
+
var readFileSync = require("fs").readFileSync;
|
|
6
|
+
|
|
7
|
+
var PLUGIN_ROOT = process.env.PLUGIN_ROOT || process.env.PLUGIN_ROOT || path.resolve(__dirname, "..");
|
|
8
|
+
var stdin = "";
|
|
9
|
+
try { stdin = readFileSync(0, "utf8"); } catch {}
|
|
10
|
+
try {
|
|
11
|
+
var result = execSync("bash " + JSON.stringify(path.join(PLUGIN_ROOT, "hooks/pre-tool-use.sh")), {
|
|
12
|
+
input: stdin,
|
|
13
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
14
|
+
timeout: 30000,
|
|
15
|
+
env: Object.assign({}, process.env, {
|
|
16
|
+
HOOK_TYPE: process.env.HOOK_TYPE || "",
|
|
17
|
+
ADAPTER_NAME: process.env.ADAPTER_NAME || "opencode",
|
|
18
|
+
PLUGIN_ROOT: PLUGIN_ROOT
|
|
19
|
+
})
|
|
124
20
|
});
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
// Ensure hooks-proxy is installed
|
|
129
|
-
let proxy = resolveHooksProxy();
|
|
130
|
-
if (!proxy) {
|
|
131
|
-
installHooksProxy(sdkVersion);
|
|
132
|
-
proxy = resolveHooksProxy();
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const handler = `babysitter hook:run --harness unified --hook-type pre-tool-use --plugin-root ${PLUGIN_ROOT} --state-dir ${STATE_DIR} --json`;
|
|
136
|
-
|
|
137
|
-
try {
|
|
138
|
-
let result;
|
|
139
|
-
if (proxy) {
|
|
140
|
-
blog(`Using hooks-proxy: ${proxy}`);
|
|
141
|
-
result = execSync(`"${proxy}" invoke --adapter opencode --handler "${handler}" --json`, {
|
|
142
|
-
input: hookInput,
|
|
143
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
144
|
-
timeout: 10000,
|
|
145
|
-
env: { ...process.env, BABYSITTER_STATE_DIR: STATE_DIR },
|
|
146
|
-
});
|
|
147
|
-
} else {
|
|
148
|
-
blog("hooks-proxy not found after install, using npx fallback");
|
|
149
|
-
result = execSync(`npx -y "@a5c-ai/hooks-proxy-cli@${sdkVersion}" invoke --adapter opencode --handler "${handler}" --json`, {
|
|
150
|
-
input: hookInput,
|
|
151
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
152
|
-
timeout: 30000,
|
|
153
|
-
env: { ...process.env, BABYSITTER_STATE_DIR: STATE_DIR },
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
const output = result.toString("utf8").trim();
|
|
157
|
-
blog(`Hook result: ${output}`);
|
|
158
|
-
process.stdout.write((output || "{}") + "\n");
|
|
159
|
-
} catch (err) {
|
|
160
|
-
// On failure, allow the tool execution to proceed
|
|
161
|
-
blog(`Pre-tool-use hook failed: ${err.message} -- allowing execution`);
|
|
162
|
-
process.stdout.write("{}\n");
|
|
163
|
-
}
|
|
21
|
+
process.stdout.write(result);
|
|
22
|
+
} catch (e) {
|
|
23
|
+
process.stdout.write("{}\n");
|
|
164
24
|
}
|
|
165
|
-
|
|
166
|
-
main();
|
package/hooks/hooks.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
|
-
"description": "
|
|
3
|
+
"description": "babysitter hook registration for OpenCode.",
|
|
4
4
|
"hooks": {
|
|
5
5
|
"session.created": [
|
|
6
6
|
{
|
|
7
7
|
"type": "command",
|
|
8
|
-
"script": "hooks/babysitter-proxied-session-created.js",
|
|
9
|
-
"description": "
|
|
8
|
+
"script": "./hooks/babysitter-proxied-session-created.js",
|
|
9
|
+
"description": "babysitter SessionStart hook",
|
|
10
10
|
"timeoutMs": 30000
|
|
11
11
|
}
|
|
12
12
|
],
|
|
13
|
-
"
|
|
13
|
+
"tool.execute.before": [
|
|
14
14
|
{
|
|
15
15
|
"type": "command",
|
|
16
|
-
"script": "hooks/babysitter-proxied-
|
|
17
|
-
"description": "
|
|
16
|
+
"script": "./hooks/babysitter-proxied-tool-execute-before.js",
|
|
17
|
+
"description": "babysitter PreToolUse hook",
|
|
18
18
|
"timeoutMs": 30000
|
|
19
19
|
}
|
|
20
20
|
],
|
|
21
|
-
"
|
|
21
|
+
"tool.execute.after": [
|
|
22
22
|
{
|
|
23
23
|
"type": "command",
|
|
24
|
-
"script": "hooks/babysitter-proxied-
|
|
25
|
-
"description": "
|
|
26
|
-
"timeoutMs":
|
|
24
|
+
"script": "./hooks/babysitter-proxied-tool-execute-after.js",
|
|
25
|
+
"description": "babysitter PostToolUse hook",
|
|
26
|
+
"timeoutMs": 30000
|
|
27
27
|
}
|
|
28
28
|
],
|
|
29
|
-
"
|
|
29
|
+
"session.idle": [
|
|
30
30
|
{
|
|
31
31
|
"type": "command",
|
|
32
|
-
"script": "hooks/babysitter-proxied-
|
|
33
|
-
"description": "
|
|
34
|
-
"timeoutMs":
|
|
32
|
+
"script": "./hooks/babysitter-proxied-session-idle.js",
|
|
33
|
+
"description": "babysitter SessionIdle hook",
|
|
34
|
+
"timeoutMs": 30000
|
|
35
35
|
}
|
|
36
36
|
],
|
|
37
|
-
"
|
|
37
|
+
"shell.env": [
|
|
38
38
|
{
|
|
39
39
|
"type": "command",
|
|
40
|
-
"script": "hooks/babysitter-proxied-
|
|
41
|
-
"description": "
|
|
42
|
-
"timeoutMs":
|
|
40
|
+
"script": "./hooks/babysitter-proxied-shell-env.js",
|
|
41
|
+
"description": "babysitter ShellEnv hook",
|
|
42
|
+
"timeoutMs": 5000
|
|
43
43
|
}
|
|
44
44
|
]
|
|
45
45
|
}
|
package/package.json
CHANGED
|
@@ -1,46 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a5c-ai/babysitter-opencode",
|
|
3
|
-
"version": "5.0.1-staging.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "5.0.1-staging.ef4e872c",
|
|
4
|
+
"description": "Orchestrate complex, multi-step workflows with event-sourced state management, hook-based extensibility, and human-in-the-loop approval",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"test": "node test/integration.test.js",
|
|
7
|
-
"test:integration": "node test/integration.test.js",
|
|
8
|
-
"sync:commands": "node scripts/sync-command-docs.cjs",
|
|
9
|
-
"postinstall": "node bin/install.cjs",
|
|
10
|
-
"preuninstall": "node bin/uninstall.cjs",
|
|
11
6
|
"deploy": "npm publish --access public",
|
|
12
|
-
"deploy:staging": "npm publish --access public --tag staging"
|
|
7
|
+
"deploy:staging": "npm publish --access public --tag staging",
|
|
8
|
+
"postinstall": "node bin/install.js",
|
|
9
|
+
"preuninstall": "node bin/uninstall.js",
|
|
10
|
+
"team:install": "node scripts/team-install.js",
|
|
11
|
+
"test": "node test/integration.test.js",
|
|
12
|
+
"sync:commands": "node scripts/sync-command-docs.cjs"
|
|
13
13
|
},
|
|
14
14
|
"bin": {
|
|
15
|
-
"babysitter-opencode": "bin/cli.
|
|
15
|
+
"babysitter-opencode": "bin/cli.js"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"bin/",
|
|
19
|
-
"commands/",
|
|
20
19
|
"hooks/",
|
|
21
|
-
"scripts/",
|
|
22
20
|
"skills/",
|
|
21
|
+
"commands/",
|
|
22
|
+
"scripts/",
|
|
23
23
|
"plugin.json",
|
|
24
|
-
"
|
|
24
|
+
"README.md",
|
|
25
|
+
"versions.json",
|
|
26
|
+
"package.json"
|
|
25
27
|
],
|
|
26
28
|
"keywords": [
|
|
27
29
|
"babysitter",
|
|
28
30
|
"opencode",
|
|
29
|
-
"orchestration"
|
|
30
|
-
"ai-agent",
|
|
31
|
-
"sdk-integration"
|
|
31
|
+
"orchestration"
|
|
32
32
|
],
|
|
33
33
|
"author": "a5c.ai",
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@a5c-ai/babysitter-sdk": "5.0.1-staging.ef4e872c"
|
|
40
|
+
},
|
|
38
41
|
"repository": {
|
|
39
42
|
"type": "git",
|
|
40
|
-
"url": "https://github.com/a5c-ai/babysitter"
|
|
43
|
+
"url": "git+https://github.com/a5c-ai/babysitter.git",
|
|
44
|
+
"directory": "plugins/babysitter-opencode"
|
|
41
45
|
},
|
|
42
46
|
"homepage": "https://github.com/a5c-ai/babysitter/tree/main/plugins/babysitter-opencode#readme",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/a5c-ai/babysitter/issues"
|
|
45
49
|
}
|
|
46
50
|
}
|
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babysitter",
|
|
3
|
-
"version": "5.0.1-staging.
|
|
4
|
-
"description": "Orchestrate complex, multi-step workflows with event-sourced state management, hook-based extensibility, and human-in-the-loop approval
|
|
3
|
+
"version": "5.0.1-staging.ef4e872c",
|
|
4
|
+
"description": "Orchestrate complex, multi-step workflows with event-sourced state management, hook-based extensibility, and human-in-the-loop approval",
|
|
5
5
|
"author": "a5c.ai",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"harness": "opencode",
|
|
@@ -18,8 +18,10 @@
|
|
|
18
18
|
"automation",
|
|
19
19
|
"event-sourced",
|
|
20
20
|
"hooks",
|
|
21
|
-
"
|
|
21
|
+
"TDD",
|
|
22
|
+
"quality-convergence",
|
|
22
23
|
"agent",
|
|
23
|
-
"LLM"
|
|
24
|
+
"LLM",
|
|
25
|
+
"opencode"
|
|
24
26
|
]
|
|
25
27
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var path = require('path');
|
|
5
|
+
var shared = require('../bin/install-shared');
|
|
6
|
+
|
|
7
|
+
var workspace = process.cwd();
|
|
8
|
+
for (var i = 0; i < process.argv.length; i++) {
|
|
9
|
+
if (process.argv[i] === '--workspace' && process.argv[i + 1]) {
|
|
10
|
+
workspace = path.resolve(process.argv[i + 1]);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
var src = process.env.PLUGIN_PACKAGE_ROOT || path.resolve(__dirname, '..');
|
|
15
|
+
var dest = shared.getHomePluginRoot('workspace');
|
|
16
|
+
console.log('[babysitter] Team install to ' + dest);
|
|
17
|
+
|
|
18
|
+
shared.copyPluginBundle(src, dest);
|
|
19
|
+
if (typeof shared.harnessTeamInstall === 'function') {
|
|
20
|
+
shared.harnessTeamInstall(src, dest, workspace);
|
|
21
|
+
}
|
|
22
|
+
shared.runPostInstall(dest);
|
|
23
|
+
console.log('[babysitter] Team install complete.');
|
package/skills/contrib/SKILL.md
CHANGED
|
@@ -5,30 +5,30 @@ description: Submit feedback or contribute to babysitter project
|
|
|
5
5
|
|
|
6
6
|
# contrib
|
|
7
7
|
|
|
8
|
-
Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md).
|
|
9
|
-
|
|
10
|
-
## Process Routing
|
|
11
|
-
|
|
8
|
+
Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md).
|
|
9
|
+
|
|
10
|
+
## Process Routing
|
|
11
|
+
|
|
12
12
|
Contribution processes live under the active process library's `cradle/` directory. Resolve the active library root with `babysitter process-library:active --json` and route based on arguments:
|
|
13
|
-
|
|
14
|
-
### Issue-based (opens a GitHub issue in a5c-ai/babysitter)
|
|
15
|
-
* **Bug report** → `cradle/bug-report.js#process` — Report a bug in the SDK, CLI, process library, etc.
|
|
16
|
-
* **Feature request** → `cradle/feature-request.js#process` — Request a new feature or enhancement
|
|
17
|
-
* **Documentation question** → `cradle/documentation-question.js#process` — Ask about undocumented behavior or missing docs
|
|
18
|
-
|
|
19
|
-
### PR-based (forks repo, creates branch, submits PR to a5c-ai/babysitter)
|
|
20
|
-
* **Bugfix** → `cradle/bugfix.js#process` — User already has the fix for a bug
|
|
21
|
-
* **Feature implementation** → `cradle/feature-implementation-contribute.js#process` — User already has a feature implementation
|
|
22
|
-
* **Harness integration** → `cradle/feature-harness-integration-contribute.js#process` — User has a harness (CI/CD, IDE, editor) integration
|
|
23
|
-
* **Library contribution** → `cradle/library-contribution.js#process` — New or improved process/skill/subagent for the library
|
|
24
|
-
* **Documentation answer** → `cradle/documentation-contribute-answer.js#process` — User has an answer for an unanswered docs question
|
|
25
|
-
|
|
26
|
-
### Router (when arguments are empty or general)
|
|
27
|
-
* **Contribute** → `cradle/contribute.js#process` — Explains contribution types and routes to the specific process
|
|
28
|
-
|
|
29
|
-
## Contribution Rules
|
|
30
|
-
|
|
31
|
-
* PR-based contributions: fork the babysitter repo (a5c-ai/babysitter) for the user, ask to star if not already starred, perform changes, submit PR
|
|
32
|
-
* Issue-based contributions: gather details, search for duplicates, review, then open an issue in a5c-ai/babysitter
|
|
33
|
-
* Add breakpoints (permissions) before ALL gh actions (fork, star, submit PR/issue) to allow user review and cancellation
|
|
13
|
+
|
|
14
|
+
### Issue-based (opens a GitHub issue in a5c-ai/babysitter)
|
|
15
|
+
* **Bug report** → `cradle/bug-report.js#process` — Report a bug in the SDK, CLI, process library, etc.
|
|
16
|
+
* **Feature request** → `cradle/feature-request.js#process` — Request a new feature or enhancement
|
|
17
|
+
* **Documentation question** → `cradle/documentation-question.js#process` — Ask about undocumented behavior or missing docs
|
|
18
|
+
|
|
19
|
+
### PR-based (forks repo, creates branch, submits PR to a5c-ai/babysitter)
|
|
20
|
+
* **Bugfix** → `cradle/bugfix.js#process` — User already has the fix for a bug
|
|
21
|
+
* **Feature implementation** → `cradle/feature-implementation-contribute.js#process` — User already has a feature implementation
|
|
22
|
+
* **Harness integration** → `cradle/feature-harness-integration-contribute.js#process` — User has a harness (CI/CD, IDE, editor) integration
|
|
23
|
+
* **Library contribution** → `cradle/library-contribution.js#process` — New or improved process/skill/subagent for the library
|
|
24
|
+
* **Documentation answer** → `cradle/documentation-contribute-answer.js#process` — User has an answer for an unanswered docs question
|
|
25
|
+
|
|
26
|
+
### Router (when arguments are empty or general)
|
|
27
|
+
* **Contribute** → `cradle/contribute.js#process` — Explains contribution types and routes to the specific process
|
|
28
|
+
|
|
29
|
+
## Contribution Rules
|
|
30
|
+
|
|
31
|
+
* PR-based contributions: fork the babysitter repo (a5c-ai/babysitter) for the user, ask to star if not already starred, perform changes, submit PR
|
|
32
|
+
* Issue-based contributions: gather details, search for duplicates, review, then open an issue in a5c-ai/babysitter
|
|
33
|
+
* Add breakpoints (permissions) before ALL gh actions (fork, star, submit PR/issue) to allow user review and cancellation
|
|
34
34
|
* If arguments are empty: use the `contribute.js` router process to show options and route accordingly
|
package/skills/doctor/SKILL.md
CHANGED
|
@@ -363,13 +363,13 @@ Mark as FAIL if:
|
|
|
363
363
|
- Parse the output and inspect the `resolvedFrom` field. Classify as follows:
|
|
364
364
|
- `resolvedFrom: "pid-marker"` → mark as PASS ("Session ID derives from the live Claude Code ancestor process -- authoritative").
|
|
365
365
|
- `resolvedFrom: "env-file"` → mark as PASS with a note ("CLAUDE_ENV_FILE was used; typically healthy").
|
|
366
|
-
- `resolvedFrom: "env-var"` → mark as WARN ("`
|
|
367
|
-
- Remediation: run `babysitter session:cleanup` and start a fresh Claude Code session, or `unset
|
|
366
|
+
- `resolvedFrom: "env-var"` → mark as WARN ("`AGENT_SESSION_ID` is set without a corroborating PID marker. Likely stale from a prior Claude Code session -- see GitHub issue #130").
|
|
367
|
+
- Remediation: run `babysitter session:cleanup` and start a fresh Claude Code session, or `unset AGENT_SESSION_ID` before invoking babysitter.
|
|
368
368
|
- `resolvedFrom: "none"` → mark as ERROR ("No session ID resolvable. Either no session-start hook fired, or the ancestor walk failed").
|
|
369
369
|
|
|
370
370
|
**Env-var shadow check:**
|
|
371
371
|
- Independently inspect `envVarPresent` and `envVarMatches` in the output.
|
|
372
|
-
- If `envVarPresent && !envVarMatches`, mark as WARN ("`
|
|
372
|
+
- If `envVarPresent && !envVarMatches`, mark as WARN ("`AGENT_SESSION_ID` in env does not match the resolved session ID; a stale value is shadowing the authoritative one. Unset the env var").
|
|
373
373
|
|
|
374
374
|
---
|
|
375
375
|
|
|
@@ -391,7 +391,7 @@ Mark as FAIL if:
|
|
|
391
391
|
|
|
392
392
|
- Enumerate files in `~/.a5c/` matching the pattern `current-session-*-pid-*`.
|
|
393
393
|
- Count markers per harness (derived from the filename).
|
|
394
|
-
- If more than one live marker exists for the same harness, mark as INFO ("Multiple live Claude Code / harness sessions detected; ensure each shell scopes `
|
|
394
|
+
- If more than one live marker exists for the same harness, mark as INFO ("Multiple live Claude Code / harness sessions detected; ensure each shell scopes `AGENT_SESSION_ID` appropriately -- the PID marker handles this automatically").
|
|
395
395
|
- Otherwise mark as PASS.
|
|
396
396
|
|
|
397
397
|
---
|
|
@@ -502,7 +502,7 @@ babysitter session:cleanup --dry-run # preview
|
|
|
502
502
|
babysitter session:cleanup # apply
|
|
503
503
|
|
|
504
504
|
# 2. Unset a stale env var
|
|
505
|
-
unset
|
|
505
|
+
unset AGENT_SESSION_ID
|
|
506
506
|
|
|
507
507
|
# 3. Re-bind a run explicitly if needed
|
|
508
508
|
babysitter session:resume --session-id <fresh-id> --state-dir ~/.a5c --run-id <runId> --runs-dir .a5c/runs
|