@a5c-ai/babysitter-pi 0.1.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.
@@ -0,0 +1,74 @@
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."
@@ -0,0 +1,115 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+ const {
5
+ normalizeNewlines,
6
+ reportCheckResult,
7
+ writeFileIfChanged,
8
+ } = require('../../../scripts/plugin-command-sync-lib.cjs');
9
+
10
+ const PACKAGE_ROOT = path.resolve(__dirname, '..');
11
+ const COMMANDS_ROOT = path.join(PACKAGE_ROOT, 'commands');
12
+ const LABEL = 'babysitter-pi sync';
13
+
14
+ const HARNESS_LABEL = 'pi';
15
+ const TROUBLESHOOT_CMD = 'where pi';
16
+
17
+ const COMMAND_DOCS = {
18
+ 'babysitter-call.md': `---
19
+ name: babysitter:call
20
+ description: Start a babysitter orchestration run
21
+ arguments:
22
+ - name: prompt
23
+ description: The task to orchestrate
24
+ required: true
25
+ ---
26
+
27
+ Start a babysitter orchestration run. Creates a new run using the SDK, binds it to the current session, and begins iteration.
28
+
29
+ This command initialises a fresh babysitter run with the given prompt, associates it with the active ${HARNESS_LABEL} session, and kicks off the first orchestration iteration. The loop driver will continue iterating automatically on subsequent \`agent_end\` events until the run completes, fails, or a guard trips.
30
+ `,
31
+ 'babysitter-resume.md': `---
32
+ name: babysitter:resume
33
+ description: Resume a previously stopped or interrupted babysitter run
34
+ arguments:
35
+ - name: runId
36
+ description: The run ID to resume
37
+ required: true
38
+ ---
39
+
40
+ Resume an existing babysitter orchestration run that was previously stopped, interrupted, or is in a waiting state. Re-binds the run to the current session and continues iteration from where it left off.
41
+
42
+ ## Behaviour
43
+
44
+ 1. Locates the run directory for the given run ID.
45
+ 2. Reads run metadata and journal to determine current state.
46
+ 3. Re-binds the run to the active ${HARNESS_LABEL} session.
47
+ `,
48
+ 'babysitter-doctor.md': `---
49
+ name: babysitter:doctor
50
+ description: Diagnose the health of a babysitter run
51
+ arguments:
52
+ - name: runId
53
+ description: Optional run ID to diagnose (defaults to the active run)
54
+ required: false
55
+ ---
56
+
57
+ Run diagnostic checks against a babysitter run to identify potential issues. Inspects run metadata, journal integrity, state cache, lock files, and effect health.
58
+ `,
59
+ 'babysitter-status.md': `---
60
+ name: babysitter:status
61
+ description: Check the status of the active babysitter run
62
+ arguments:
63
+ - name: runId
64
+ description: Optional run ID to check (defaults to the active run)
65
+ required: false
66
+ ---
67
+
68
+ Check the current status of a babysitter orchestration run.
69
+
70
+ ## Notes
71
+
72
+ - When called without arguments, reports on the run bound to the current session.
73
+ - If discovery reports \`${HARNESS_LABEL}\` as installed but direct invocation fails, validate \`${TROUBLESHOOT_CMD}\`.
74
+ `,
75
+ };
76
+
77
+ function main() {
78
+ const check = process.argv.includes('--check');
79
+ const stale = [];
80
+ let updated = 0;
81
+
82
+ for (const [fileName, expectedRaw] of Object.entries(COMMAND_DOCS)) {
83
+ const targetPath = path.join(COMMANDS_ROOT, fileName);
84
+ const expected = normalizeNewlines(expectedRaw);
85
+
86
+ if (check) {
87
+ const actual = require('fs').existsSync(targetPath)
88
+ ? normalizeNewlines(require('fs').readFileSync(targetPath, 'utf8'))
89
+ : null;
90
+ if (actual !== expected) {
91
+ stale.push(path.relative(PACKAGE_ROOT, targetPath));
92
+ }
93
+ continue;
94
+ }
95
+
96
+ if (writeFileIfChanged(targetPath, expected)) {
97
+ updated += 1;
98
+ console.log(`[${LABEL}] updated ${path.relative(PACKAGE_ROOT, targetPath)}`);
99
+ }
100
+ }
101
+
102
+ if (check) {
103
+ reportCheckResult(LABEL, stale);
104
+ return;
105
+ }
106
+
107
+ if (updated === 0) {
108
+ console.log(`[${LABEL}] no PI command doc changes were needed.`);
109
+ return;
110
+ }
111
+
112
+ console.log(`[${LABEL}] updated ${updated} PI command doc file(s).`);
113
+ }
114
+
115
+ main();
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: babysitter
3
+ description: Orchestrate via @babysitter. Use this skill when asked to babysit a run, orchestrate a process or whenever it is called explicitly. (babysit, babysitter, orchestrate, orchestrate a run, workflow, etc.)
4
+ ---
5
+
6
+ # babysitter
7
+
8
+ Orchestrate `.a5c/runs/<runId>/` through iterative execution.
9
+
10
+ ## Dependencies
11
+
12
+ ### Babysitter SDK and CLI
13
+
14
+ Read the SDK version from the plugin manifest to ensure version compatibility:
15
+
16
+ ```bash
17
+ PLUGIN_ROOT="${PI_PLUGIN_ROOT:-$OMP_PLUGIN_ROOT}"
18
+ SDK_VERSION=$(node -e "try{const root=process.env.PI_PLUGIN_ROOT||process.env.OMP_PLUGIN_ROOT;console.log(root?JSON.parse(require('fs').readFileSync(require('path').join(root,'versions.json'),'utf8')).sdkVersion||'latest':'latest')}catch{console.log('latest')}")
19
+ sudo npm i -g @a5c-ai/babysitter-sdk@$SDK_VERSION
20
+ # sudo is depending on the env and system
21
+ ```
22
+
23
+ then use the CLI alias: CLI="babysitter"
24
+
25
+ **Alternatively, use the CLI alias:** `CLI="npx -y @a5c-ai/babysitter-sdk@$SDK_VERSION"`
26
+
27
+ ### jq
28
+
29
+ make sure you have jq installed and available in the path. if not, install it.
30
+
31
+ ## Instructions
32
+
33
+ Run the following command to get full orchestration instructions:
34
+
35
+ ```bash
36
+ babysitter instructions:babysit-skill --harness pi --interactive
37
+ ```
38
+
39
+ For non-interactive mode (running with `-p` flag or no AskUserQuestion tool):
40
+
41
+ ```bash
42
+ babysitter instructions:babysit-skill --harness pi --no-interactive
43
+ ```
44
+
45
+ Follow the instructions returned by the command above to orchestrate the run.