@a5c-ai/babysitter-omp 5.0.1-staging.71bb37a4 → 5.0.1-staging.75c8fb21

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 (38) hide show
  1. package/bin/cli.cjs +43 -17
  2. package/bin/install-shared.cjs +219 -0
  3. package/bin/install.cjs +18 -33
  4. package/bin/uninstall.cjs +15 -11
  5. package/commands/call.md +7 -7
  6. package/commands/contrib.md +31 -31
  7. package/commands/doctor.md +5 -5
  8. package/commands/forever.md +6 -6
  9. package/commands/help.md +3 -2
  10. package/commands/observe.md +1 -1
  11. package/commands/plan.md +7 -7
  12. package/commands/plugins.md +249 -249
  13. package/commands/project-install.md +10 -10
  14. package/commands/resume.md +8 -8
  15. package/commands/retrospect.md +55 -55
  16. package/commands/user-install.md +10 -10
  17. package/commands/yolo.md +7 -7
  18. package/package.json +10 -15
  19. package/scripts/team-install.cjs +23 -0
  20. package/skills/contrib/SKILL.md +25 -25
  21. package/skills/doctor/SKILL.md +5 -5
  22. package/skills/help/SKILL.md +3 -2
  23. package/skills/observe/SKILL.md +1 -1
  24. package/skills/plugins/SKILL.md +243 -243
  25. package/skills/project-install/SKILL.md +3 -3
  26. package/skills/resume/SKILL.md +1 -1
  27. package/skills/retrospect/SKILL.md +48 -48
  28. package/skills/user-install/SKILL.md +3 -3
  29. package/versions.json +2 -1
  30. package/extensions/index.legacy.ts +0 -55
  31. package/hooks/babysitter-proxied-before-provider-request.js +0 -167
  32. package/hooks/babysitter-proxied-context.js +0 -165
  33. package/hooks/babysitter-proxied-session-start.js +0 -227
  34. package/hooks/babysitter-proxied-stop.js +0 -179
  35. package/hooks/babysitter-proxied-tool-call.js +0 -166
  36. package/hooks/hooks.json +0 -46
  37. package/hooks/proxied-hooks.json +0 -47
  38. package/scripts/setup.sh +0 -74
@@ -1,179 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Unified Stop / Orchestration Hook for Oh-My-Pi
4
- * Routes through hooks-proxy for all hook execution.
5
- *
6
- * Fires when the Oh-My-Pi agent completes a turn. Checks if the current
7
- * babysitter run has pending effects that need attention. Delegates to
8
- * `babysitter hook:run --hook-type stop` via hooks-proxy.
9
- *
10
- * Oh-My-Pi plugin protocol (programmatic):
11
- * - Called from extension via execSync
12
- * - Receives event context as JSON via stdin
13
- * - Outputs JSON to stdout
14
- * - Exit 0 = success
15
- */
16
-
17
- "use strict";
18
-
19
- const { execSync } = require("child_process");
20
- const { readFileSync, mkdirSync, appendFileSync, existsSync, writeFileSync } = require("fs");
21
- const os = require("os");
22
- const path = require("path");
23
-
24
- const PLUGIN_ROOT = process.env.OMP_PLUGIN_ROOT || path.resolve(__dirname, "..");
25
- const GLOBAL_ROOT = process.env.BABYSITTER_GLOBAL_STATE_DIR || path.join(os.homedir(), ".a5c");
26
- const STATE_DIR = process.env.BABYSITTER_STATE_DIR || path.join(GLOBAL_ROOT, "state");
27
- const LOG_DIR = process.env.BABYSITTER_LOG_DIR || path.join(GLOBAL_ROOT, "logs");
28
- const LOG_FILE = path.join(LOG_DIR, "babysitter-omp-stop-hook.log");
29
- const PROXY_MARKER = path.join(PLUGIN_ROOT, ".hooks-proxy-install-attempted");
30
-
31
- function ensureDir(dir) {
32
- try { mkdirSync(dir, { recursive: true }); } catch { /* best-effort */ }
33
- }
34
-
35
- function blog(msg) {
36
- ensureDir(LOG_DIR);
37
- const ts = new Date().toISOString();
38
- try {
39
- appendFileSync(LOG_FILE, `[INFO] ${ts} ${msg}\n`);
40
- } catch { /* best-effort */ }
41
- }
42
-
43
- function getSdkVersion() {
44
- try {
45
- const versions = JSON.parse(readFileSync(path.join(PLUGIN_ROOT, "versions.json"), "utf8"));
46
- return versions.sdkVersion || "latest";
47
- } catch {
48
- return "latest";
49
- }
50
- }
51
-
52
- function resolveHooksProxy() {
53
- try {
54
- execSync("a5c-hooks-proxy --version", { stdio: "pipe", timeout: 5000 });
55
- return "a5c-hooks-proxy";
56
- } catch { /* not in PATH */ }
57
-
58
- const localProxy = path.join(
59
- process.env.HOME || process.env.USERPROFILE || "~",
60
- ".local", "bin", process.platform === "win32" ? "a5c-hooks-proxy.exe" : "a5c-hooks-proxy"
61
- );
62
- if (existsSync(localProxy)) {
63
- return localProxy;
64
- }
65
-
66
- return null;
67
- }
68
-
69
- function installHooksProxy(version) {
70
- if (existsSync(PROXY_MARKER)) return;
71
-
72
- try {
73
- execSync(`npm i -g "@a5c-ai/hooks-proxy-cli@${version}" --loglevel=error`, {
74
- stdio: "pipe",
75
- timeout: 120000,
76
- });
77
- blog(`Installed hooks-proxy globally (${version})`);
78
- } catch {
79
- try {
80
- const prefix = path.join(process.env.HOME || process.env.USERPROFILE || "~", ".local");
81
- execSync(`npm i -g "@a5c-ai/hooks-proxy-cli@${version}" --prefix "${prefix}" --loglevel=error`, {
82
- stdio: "pipe",
83
- timeout: 120000,
84
- });
85
- blog(`Installed hooks-proxy to user prefix (${version})`);
86
- } catch {
87
- blog("hooks-proxy installation failed");
88
- }
89
- }
90
-
91
- try { writeFileSync(PROXY_MARKER, version); } catch { /* best-effort */ }
92
- }
93
-
94
- function runViaProxy(proxy, hookType, inputJson) {
95
- const handler = `babysitter hook:run --harness unified --hook-type ${hookType} --plugin-root ${PLUGIN_ROOT} --state-dir ${STATE_DIR} --json`;
96
- const result = execSync(`"${proxy}" invoke --adapter oh-my-pi --handler "${handler}" --json`, {
97
- input: inputJson,
98
- stdio: ["pipe", "pipe", "pipe"],
99
- timeout: 30000,
100
- env: { ...process.env, BABYSITTER_STATE_DIR: STATE_DIR },
101
- });
102
- return result.toString("utf8").trim();
103
- }
104
-
105
- function runViaNpxProxy(version, hookType, inputJson) {
106
- const handler = `babysitter hook:run --harness unified --hook-type ${hookType} --plugin-root ${PLUGIN_ROOT} --state-dir ${STATE_DIR} --json`;
107
- const result = execSync(`npx -y "@a5c-ai/hooks-proxy-cli@${version}" invoke --adapter oh-my-pi --handler "${handler}" --json`, {
108
- input: inputJson,
109
- stdio: ["pipe", "pipe", "pipe"],
110
- timeout: 60000,
111
- env: { ...process.env, BABYSITTER_STATE_DIR: STATE_DIR },
112
- });
113
- return result.toString("utf8").trim();
114
- }
115
-
116
- function main() {
117
- blog("Unified stop hook invoked");
118
-
119
- const sessionId = process.env.BABYSITTER_SESSION_ID
120
- || process.env.OMP_SESSION_ID
121
- || process.env.PI_SESSION_ID
122
- || "";
123
-
124
- if (!sessionId) {
125
- blog("No session ID -- nothing to check");
126
- process.stdout.write("{}\n");
127
- return;
128
- }
129
-
130
- const sdkVersion = getSdkVersion();
131
-
132
- // Ensure hooks-proxy is installed
133
- let proxy = resolveHooksProxy();
134
- if (!proxy) {
135
- installHooksProxy(sdkVersion);
136
- proxy = resolveHooksProxy();
137
- }
138
-
139
- // Read stdin if available
140
- let stdinData = "";
141
- try {
142
- stdinData = readFileSync(0, "utf8");
143
- } catch { /* no stdin */ }
144
-
145
- const hookInput = JSON.stringify({
146
- session_id: sessionId,
147
- cwd: process.cwd(),
148
- harness: "oh-my-pi",
149
- plugin_root: PLUGIN_ROOT,
150
- ...(stdinData ? { event_data: JSON.parse(stdinData) } : {}),
151
- });
152
-
153
- blog(`Checking run status for session ${sessionId}`);
154
-
155
- let result;
156
- try {
157
- if (proxy) {
158
- blog(`Using hooks-proxy: ${proxy}`);
159
- result = runViaProxy(proxy, "stop", hookInput);
160
- } else {
161
- blog("hooks-proxy not found after install, using npx fallback");
162
- result = runViaNpxProxy(sdkVersion, "stop", hookInput);
163
- }
164
- } catch (err) {
165
- blog(`Hook execution failed: ${err.message}`);
166
- result = "{}";
167
- }
168
-
169
- blog(`Hook result: ${result}`);
170
-
171
- try {
172
- const parsed = JSON.parse(result);
173
- process.stdout.write(JSON.stringify(parsed) + "\n");
174
- } catch {
175
- process.stdout.write("{}\n");
176
- }
177
- }
178
-
179
- main();
@@ -1,166 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Unified Tool Call Hook for Oh-My-Pi
4
- * Routes through hooks-proxy for all hook execution.
5
- *
6
- * Fires before a tool execution in Oh-My-Pi. Delegates to
7
- * `babysitter hook:run --hook-type pre-tool-use` via hooks-proxy.
8
- *
9
- * Note: Unlike Pi, Oh-My-Pi does NOT support tool input mutation.
10
- * This hook is observer-only (logging/blocking but no mutation).
11
- *
12
- * Oh-My-Pi plugin protocol (programmatic):
13
- * - Called from extension via execSync
14
- * - Receives tool context as JSON via stdin
15
- * - Outputs JSON to stdout (empty = allow, { block: true } = block)
16
- * - Exit 0 = success
17
- */
18
-
19
- "use strict";
20
-
21
- const { execSync } = require("child_process");
22
- const { readFileSync, mkdirSync, appendFileSync, existsSync, writeFileSync } = require("fs");
23
- const os = require("os");
24
- const path = require("path");
25
-
26
- const PLUGIN_ROOT = process.env.OMP_PLUGIN_ROOT || path.resolve(__dirname, "..");
27
- const GLOBAL_ROOT = process.env.BABYSITTER_GLOBAL_STATE_DIR || path.join(os.homedir(), ".a5c");
28
- const STATE_DIR = process.env.BABYSITTER_STATE_DIR || path.join(GLOBAL_ROOT, "state");
29
- const LOG_DIR = process.env.BABYSITTER_LOG_DIR || path.join(GLOBAL_ROOT, "logs");
30
- const LOG_FILE = path.join(LOG_DIR, "babysitter-omp-tool-call-hook.log");
31
- const PROXY_MARKER = path.join(PLUGIN_ROOT, ".hooks-proxy-install-attempted");
32
-
33
- function ensureDir(dir) {
34
- try { mkdirSync(dir, { recursive: true }); } catch { /* best-effort */ }
35
- }
36
-
37
- function blog(msg) {
38
- ensureDir(LOG_DIR);
39
- const ts = new Date().toISOString();
40
- try {
41
- appendFileSync(LOG_FILE, `[INFO] ${ts} ${msg}\n`);
42
- } catch { /* best-effort */ }
43
- }
44
-
45
- function getSdkVersion() {
46
- try {
47
- const versions = JSON.parse(readFileSync(path.join(PLUGIN_ROOT, "versions.json"), "utf8"));
48
- return versions.sdkVersion || "latest";
49
- } catch {
50
- return "latest";
51
- }
52
- }
53
-
54
- function resolveHooksProxy() {
55
- try {
56
- execSync("a5c-hooks-proxy --version", { stdio: "pipe", timeout: 5000 });
57
- return "a5c-hooks-proxy";
58
- } catch { /* not in PATH */ }
59
-
60
- const localProxy = path.join(
61
- process.env.HOME || process.env.USERPROFILE || "~",
62
- ".local", "bin", process.platform === "win32" ? "a5c-hooks-proxy.exe" : "a5c-hooks-proxy"
63
- );
64
- if (existsSync(localProxy)) {
65
- return localProxy;
66
- }
67
-
68
- return null;
69
- }
70
-
71
- function installHooksProxy(version) {
72
- if (existsSync(PROXY_MARKER)) return;
73
-
74
- try {
75
- execSync(`npm i -g "@a5c-ai/hooks-proxy-cli@${version}" --loglevel=error`, {
76
- stdio: "pipe",
77
- timeout: 120000,
78
- });
79
- blog(`Installed hooks-proxy globally (${version})`);
80
- } catch {
81
- try {
82
- const prefix = path.join(process.env.HOME || process.env.USERPROFILE || "~", ".local");
83
- execSync(`npm i -g "@a5c-ai/hooks-proxy-cli@${version}" --prefix "${prefix}" --loglevel=error`, {
84
- stdio: "pipe",
85
- timeout: 120000,
86
- });
87
- blog(`Installed hooks-proxy to user prefix (${version})`);
88
- } catch {
89
- blog("hooks-proxy installation failed");
90
- }
91
- }
92
-
93
- try { writeFileSync(PROXY_MARKER, version); } catch { /* best-effort */ }
94
- }
95
-
96
- function main() {
97
- const sessionId = process.env.BABYSITTER_SESSION_ID
98
- || process.env.OMP_SESSION_ID
99
- || process.env.PI_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 = readFileSync(0, "utf8");
112
- } catch {
113
- // No stdin available
114
- }
115
-
116
- blog(`Unified tool-call: session=${sessionId}`);
117
-
118
- const hookInput = JSON.stringify({
119
- session_id: sessionId,
120
- cwd: process.cwd(),
121
- harness: "oh-my-pi",
122
- plugin_root: PLUGIN_ROOT,
123
- tool_context: inputData ? JSON.parse(inputData) : {},
124
- });
125
-
126
- const sdkVersion = getSdkVersion();
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 oh-my-pi --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 oh-my-pi --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
- }
164
- }
165
-
166
- main();
package/hooks/hooks.json DELETED
@@ -1,46 +0,0 @@
1
- {
2
- "version": 1,
3
- "description": "Babysitter hook registration for Oh-My-Pi. Maps Oh-My-Pi extension events to unified babysitter hook scripts with hooks-proxy support.",
4
- "hooks": {
5
- "session_start": [
6
- {
7
- "type": "command",
8
- "script": "hooks/babysitter-proxied-session-start.js",
9
- "description": "Initialize babysitter session state and inject context (proxied via a5c-hooks-proxy)",
10
- "timeoutMs": 30000
11
- }
12
- ],
13
- "tool_call": [
14
- {
15
- "type": "command",
16
- "script": "hooks/babysitter-proxied-tool-call.js",
17
- "description": "Pre-tool-use hook for babysitter awareness (proxied via a5c-hooks-proxy)",
18
- "timeoutMs": 10000
19
- }
20
- ],
21
- "context": [
22
- {
23
- "type": "command",
24
- "script": "hooks/babysitter-proxied-context.js",
25
- "description": "Context injection for babysitter orchestration (proxied via a5c-hooks-proxy)",
26
- "timeoutMs": 10000
27
- }
28
- ],
29
- "before_provider_request": [
30
- {
31
- "type": "command",
32
- "script": "hooks/babysitter-proxied-before-provider-request.js",
33
- "description": "Before provider request hook for babysitter observability (proxied via a5c-hooks-proxy)",
34
- "timeoutMs": 10000
35
- }
36
- ],
37
- "stop": [
38
- {
39
- "type": "command",
40
- "script": "hooks/babysitter-proxied-stop.js",
41
- "description": "Check for pending babysitter effects when agent completes a turn (proxied via a5c-hooks-proxy)",
42
- "timeoutMs": 30000
43
- }
44
- ]
45
- }
46
- }
@@ -1,47 +0,0 @@
1
- {
2
- "_comment": "Reference: hooks-proxy routing configuration for Oh-My-Pi. All hooks route through a5c-hooks-proxy with --adapter oh-my-pi.",
3
- "version": 1,
4
- "description": "Babysitter hook registration for Oh-My-Pi. Maps Oh-My-Pi extension events to unified babysitter hook scripts with hooks-proxy support.",
5
- "hooks": {
6
- "session_start": [
7
- {
8
- "type": "command",
9
- "script": "hooks/babysitter-proxied-session-start.js",
10
- "description": "Initialize babysitter session state and inject context (proxied via a5c-hooks-proxy)",
11
- "timeoutMs": 30000
12
- }
13
- ],
14
- "tool_call": [
15
- {
16
- "type": "command",
17
- "script": "hooks/babysitter-proxied-tool-call.js",
18
- "description": "Pre-tool-use hook for babysitter awareness (proxied via a5c-hooks-proxy)",
19
- "timeoutMs": 10000
20
- }
21
- ],
22
- "context": [
23
- {
24
- "type": "command",
25
- "script": "hooks/babysitter-proxied-context.js",
26
- "description": "Context injection for babysitter orchestration (proxied via a5c-hooks-proxy)",
27
- "timeoutMs": 10000
28
- }
29
- ],
30
- "before_provider_request": [
31
- {
32
- "type": "command",
33
- "script": "hooks/babysitter-proxied-before-provider-request.js",
34
- "description": "Before provider request hook for babysitter observability (proxied via a5c-hooks-proxy)",
35
- "timeoutMs": 10000
36
- }
37
- ],
38
- "stop": [
39
- {
40
- "type": "command",
41
- "script": "hooks/babysitter-proxied-stop.js",
42
- "description": "Check for pending babysitter effects when agent completes a turn (proxied via a5c-hooks-proxy)",
43
- "timeoutMs": 30000
44
- }
45
- ]
46
- }
47
- }
package/scripts/setup.sh DELETED
@@ -1,74 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- # setup.sh — Full setup script for babysitter-pi plugin
5
- #
6
- # Installs npm dependencies, verifies the babysitter SDK,
7
- # creates necessary directories, and prints usage instructions.
8
-
9
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
- PLUGIN_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
11
-
12
- GREEN='\033[0;32m'
13
- YELLOW='\033[1;33m'
14
- RED='\033[0;31m'
15
- NC='\033[0m' # No Color
16
-
17
- log() { echo -e "${GREEN}[setup]${NC} $1"; }
18
- warn() { echo -e "${YELLOW}[setup] WARNING:${NC} $1"; }
19
- error() { echo -e "${RED}[setup] ERROR:${NC} $1"; }
20
-
21
- # ── Check Node.js ──────────────────────────────────────────────────────
22
- log "Checking Node.js version..."
23
- if ! command -v node &>/dev/null; then
24
- error "Node.js is not installed. Please install Node.js >= 18."
25
- exit 1
26
- fi
27
-
28
- NODE_MAJOR=$(node -e "console.log(process.versions.node.split('.')[0])")
29
- if [ "$NODE_MAJOR" -lt 18 ]; then
30
- error "Node.js v$(node -v) detected. babysitter-pi requires Node.js >= 18."
31
- exit 1
32
- fi
33
- log "Node.js v$(node -v | tr -d 'v') — OK"
34
-
35
- # ── Install npm dependencies ──────────────────────────────────────────
36
- log "Installing npm dependencies..."
37
- cd "$PLUGIN_DIR"
38
- if [ -f "package.json" ]; then
39
- npm install --no-audit --no-fund 2>&1 || {
40
- warn "npm install encountered issues, but continuing setup."
41
- }
42
- log "Dependencies installed."
43
- else
44
- warn "No package.json found in $PLUGIN_DIR — skipping npm install."
45
- fi
46
-
47
- # ── Verify babysitter SDK ─────────────────────────────────────────────
48
- log "Checking for @a5c-ai/babysitter-sdk..."
49
- SDK_CHECK=$(node -e "try { require('@a5c-ai/babysitter-sdk'); console.log('ok'); } catch(e) { console.log('missing'); }" 2>/dev/null)
50
- if [ "$SDK_CHECK" = "ok" ]; then
51
- log "@a5c-ai/babysitter-sdk — OK"
52
- else
53
- warn "@a5c-ai/babysitter-sdk not found. Install it with: npm install @a5c-ai/babysitter-sdk"
54
- fi
55
-
56
- # ── Create necessary directories ─────────────────────────────────────
57
- log "Creating directories..."
58
- mkdir -p "$PLUGIN_DIR/state"
59
- log "State directory ready: $PLUGIN_DIR/state"
60
-
61
- # ── Print usage instructions ─────────────────────────────────────────
62
- echo ""
63
- echo "============================================"
64
- echo " babysitter-pi plugin setup complete"
65
- echo "============================================"
66
- echo ""
67
- echo "Usage:"
68
- echo " babysitter plugin:install pi --marketplace-name <name> --project"
69
- echo " babysitter plugin:configure pi --marketplace-name <name> --project"
70
- echo ""
71
- echo "For more information, see: $PLUGIN_DIR/README.md"
72
- echo ""
73
-
74
- log "Done."