@a5c-ai/babysitter-omp 0.1.4-staging.f6cb97d6 → 5.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 +2 -0
- package/bin/cli.cjs +43 -17
- package/bin/install-shared.cjs +219 -0
- package/bin/install.cjs +18 -33
- package/bin/uninstall.cjs +15 -11
- package/commands/doctor.md +5 -5
- package/commands/help.md +3 -2
- package/commands/observe.md +1 -1
- package/extensions/index.ts +41 -0
- package/package.json +9 -13
- package/scripts/create-release-tag.mjs +18 -0
- package/scripts/publish-from-tag.mjs +12 -0
- package/scripts/team-install.cjs +23 -0
- package/skills/babysit/SKILL.md +2 -0
- package/skills/doctor/SKILL.md +5 -5
- package/skills/help/SKILL.md +3 -2
- package/skills/observe/SKILL.md +1 -1
- package/versions.json +2 -1
- package/scripts/setup.sh +0 -74
- package/scripts/sync-command-docs.cjs +0 -106
package/README.md
CHANGED
|
@@ -80,6 +80,8 @@ Read the pinned SDK version from `versions.json` when you need a local CLI:
|
|
|
80
80
|
```bash
|
|
81
81
|
PLUGIN_ROOT="${OMP_PLUGIN_ROOT:-$(pwd)}"
|
|
82
82
|
SDK_VERSION=$(node -e "try{const fs=require('fs');const path=require('path');const pluginRoot=process.env.OMP_PLUGIN_ROOT||process.env.PLUGIN_ROOT||process.cwd();const probes=[path.join(pluginRoot,'versions.json'),path.join(pluginRoot,'plugins','babysitter-omp','versions.json'),path.join(pluginRoot,'node_modules','@a5c-ai','babysitter-omp','versions.json'),path.join(process.cwd(),'node_modules','@a5c-ai','babysitter-omp','versions.json')];for(const probe of probes){if(fs.existsSync(probe)){console.log(JSON.parse(fs.readFileSync(probe,'utf8')).sdkVersion||'latest');process.exit(0)}}console.log('latest')}catch{console.log('latest')}")
|
|
83
|
+
npm i -g @a5c-ai/babysitter-sdk@$SDK_VERSION
|
|
84
|
+
|
|
83
85
|
CLI="npx -y @a5c-ai/babysitter-sdk@$SDK_VERSION"
|
|
84
86
|
```
|
|
85
87
|
|
package/bin/cli.cjs
CHANGED
|
@@ -5,45 +5,51 @@ const path = require('path');
|
|
|
5
5
|
const { spawnSync } = require('child_process');
|
|
6
6
|
|
|
7
7
|
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
8
|
+
let shared;
|
|
9
|
+
try { shared = require('./install-shared'); } catch {}
|
|
8
10
|
|
|
9
11
|
function printUsage() {
|
|
10
12
|
console.error([
|
|
11
13
|
'Usage:',
|
|
12
14
|
' babysitter-omp install [--global]',
|
|
13
15
|
' babysitter-omp install --workspace [path]',
|
|
14
|
-
' babysitter-omp uninstall [--global]',
|
|
15
16
|
' babysitter-omp uninstall',
|
|
16
17
|
].join('\n'));
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
function
|
|
20
|
+
function parseInstallArgs(argv) {
|
|
21
|
+
let scope = 'global';
|
|
20
22
|
let workspace = null;
|
|
23
|
+
const passthrough = [];
|
|
21
24
|
|
|
22
25
|
for (let i = 0; i < argv.length; i += 1) {
|
|
23
26
|
const arg = argv[i];
|
|
27
|
+
if (arg === '--global') {
|
|
28
|
+
scope = 'global';
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
24
31
|
if (arg === '--workspace') {
|
|
32
|
+
scope = 'workspace';
|
|
25
33
|
const next = argv[i + 1];
|
|
26
|
-
workspace = next && !next.startsWith('-') ? path.resolve(next) : process.cwd();
|
|
27
34
|
if (next && !next.startsWith('-')) {
|
|
35
|
+
workspace = path.resolve(next);
|
|
28
36
|
i += 1;
|
|
37
|
+
} else {
|
|
38
|
+
workspace = process.cwd();
|
|
29
39
|
}
|
|
30
40
|
continue;
|
|
31
41
|
}
|
|
32
|
-
|
|
33
|
-
workspace = null;
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
throw new Error(`unknown argument: ${arg}`);
|
|
42
|
+
passthrough.push(arg);
|
|
37
43
|
}
|
|
38
44
|
|
|
39
|
-
return { workspace };
|
|
45
|
+
return { scope, workspace, passthrough };
|
|
40
46
|
}
|
|
41
47
|
|
|
42
|
-
function runNodeScript(scriptPath, args) {
|
|
48
|
+
function runNodeScript(scriptPath, args, extraEnv = {}) {
|
|
43
49
|
const result = spawnSync(process.execPath, [scriptPath, ...args], {
|
|
44
50
|
cwd: process.cwd(),
|
|
45
51
|
stdio: 'inherit',
|
|
46
|
-
env: process.env,
|
|
52
|
+
env: { ...process.env, ...extraEnv },
|
|
47
53
|
});
|
|
48
54
|
process.exitCode = result.status ?? 1;
|
|
49
55
|
}
|
|
@@ -56,15 +62,35 @@ function main() {
|
|
|
56
62
|
return;
|
|
57
63
|
}
|
|
58
64
|
|
|
59
|
-
if (command
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
if (command === 'install') {
|
|
66
|
+
if (shared && typeof shared.harnessCliRoute === 'function' && shared.harnessCliRoute(rest, PACKAGE_ROOT, runNodeScript)) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const parsed = parseInstallArgs(rest);
|
|
70
|
+
if (parsed.scope === 'workspace') {
|
|
71
|
+
const args = [];
|
|
72
|
+
if (parsed.workspace) {
|
|
73
|
+
args.push('--workspace', parsed.workspace);
|
|
74
|
+
}
|
|
75
|
+
args.push(...parsed.passthrough);
|
|
76
|
+
runNodeScript(
|
|
77
|
+
path.join(PACKAGE_ROOT, 'scripts', 'team-install.cjs'),
|
|
78
|
+
args,
|
|
79
|
+
{ PLUGIN_PACKAGE_ROOT: PACKAGE_ROOT },
|
|
80
|
+
);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
runNodeScript(path.join(PACKAGE_ROOT, 'bin', 'install.cjs'), parsed.passthrough);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (command === 'uninstall') {
|
|
88
|
+
runNodeScript(path.join(PACKAGE_ROOT, 'bin', 'uninstall.cjs'), rest);
|
|
62
89
|
return;
|
|
63
90
|
}
|
|
64
91
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
runNodeScript(path.join(PACKAGE_ROOT, 'bin', `${command}.cjs`), args);
|
|
92
|
+
printUsage();
|
|
93
|
+
process.exitCode = 1;
|
|
68
94
|
}
|
|
69
95
|
|
|
70
96
|
main();
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const { spawnSync } = require('child_process');
|
|
7
|
+
|
|
8
|
+
const PLUGIN_NAME = "babysitter";
|
|
9
|
+
const PLUGIN_CATEGORY = 'Coding';
|
|
10
|
+
|
|
11
|
+
function getUserHome() {
|
|
12
|
+
return os.homedir();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function getHarnessHome() {
|
|
16
|
+
return path.join(os.homedir(), '.a5c');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function getHomePluginRoot(scope) {
|
|
20
|
+
if (scope === 'workspace') return path.join(process.cwd(), '.a5c', 'plugins', PLUGIN_NAME);
|
|
21
|
+
return path.join(path.join(getHarnessHome(), 'plugins'), PLUGIN_NAME);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getHomeMarketplacePath() {
|
|
25
|
+
return path.join(getHarnessHome(), 'plugins', 'marketplace.json');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function writeFileIfChanged(filePath, contents) {
|
|
29
|
+
try {
|
|
30
|
+
const existing = fs.readFileSync(filePath, 'utf8');
|
|
31
|
+
if (existing === contents) return false;
|
|
32
|
+
} catch {}
|
|
33
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
34
|
+
fs.writeFileSync(filePath, contents);
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function copyRecursive(src, dest) {
|
|
39
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
40
|
+
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
41
|
+
if (entry.name === 'node_modules' || entry.name === '.git') continue;
|
|
42
|
+
const s = path.join(src, entry.name);
|
|
43
|
+
const d = path.join(dest, entry.name);
|
|
44
|
+
if (entry.isDirectory()) {
|
|
45
|
+
copyRecursive(s, d);
|
|
46
|
+
} else {
|
|
47
|
+
fs.copyFileSync(s, d);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function copyPluginBundle(packageRoot, pluginRoot) {
|
|
53
|
+
const bundleEntries = fs.readdirSync(packageRoot).filter(
|
|
54
|
+
e => !['node_modules', '.git', 'test', 'dist'].includes(e)
|
|
55
|
+
);
|
|
56
|
+
fs.mkdirSync(pluginRoot, { recursive: true });
|
|
57
|
+
for (const entry of bundleEntries) {
|
|
58
|
+
const src = path.join(packageRoot, entry);
|
|
59
|
+
const dest = path.join(pluginRoot, entry);
|
|
60
|
+
const stat = fs.statSync(src);
|
|
61
|
+
if (stat.isDirectory()) {
|
|
62
|
+
copyRecursive(src, dest);
|
|
63
|
+
} else {
|
|
64
|
+
fs.copyFileSync(src, dest);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function readJson(filePath) {
|
|
70
|
+
try {
|
|
71
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
72
|
+
} catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function writeJson(filePath, value) {
|
|
78
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
79
|
+
fs.writeFileSync(filePath, JSON.stringify(value, null, 2) + '\n');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function ensureExecutable(filePath) {
|
|
83
|
+
try {
|
|
84
|
+
fs.chmodSync(filePath, 0o755);
|
|
85
|
+
} catch {}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function normalizeMarketplaceSourcePath(source, marketplacePath) {
|
|
89
|
+
if (typeof source === 'string') {
|
|
90
|
+
return path.relative(path.dirname(marketplacePath), source).replace(/\\/g, '/');
|
|
91
|
+
}
|
|
92
|
+
return source;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function ensureMarketplaceEntry(marketplacePath, pluginRoot) {
|
|
96
|
+
let marketplace = readJson(marketplacePath) || {
|
|
97
|
+
name: "a5c.ai",
|
|
98
|
+
plugins: [],
|
|
99
|
+
};
|
|
100
|
+
if (!Array.isArray(marketplace.plugins)) marketplace.plugins = [];
|
|
101
|
+
const idx = marketplace.plugins.findIndex(p => p.name === PLUGIN_NAME);
|
|
102
|
+
const relSource = './' + normalizeMarketplaceSourcePath(pluginRoot, marketplacePath);
|
|
103
|
+
const entry = {
|
|
104
|
+
name: PLUGIN_NAME,
|
|
105
|
+
source: relSource,
|
|
106
|
+
description: "Orchestrate complex, multi-step workflows with event-sourced state management, hook-based extensibility, and human-in-the-loop approval",
|
|
107
|
+
version: "5.0.0",
|
|
108
|
+
author: { name: "a5c.ai" },
|
|
109
|
+
};
|
|
110
|
+
if (idx >= 0) marketplace.plugins[idx] = entry;
|
|
111
|
+
else marketplace.plugins.push(entry);
|
|
112
|
+
writeJson(marketplacePath, marketplace);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function removeMarketplaceEntry(marketplacePath) {
|
|
116
|
+
const marketplace = readJson(marketplacePath);
|
|
117
|
+
if (!marketplace || !Array.isArray(marketplace.plugins)) return;
|
|
118
|
+
marketplace.plugins = marketplace.plugins.filter(p => p.name !== PLUGIN_NAME);
|
|
119
|
+
writeJson(marketplacePath, marketplace);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function warnWindowsHooks() {
|
|
123
|
+
if (process.platform === 'win32') {
|
|
124
|
+
console.warn('[' + PLUGIN_NAME + '] Windows detected — shell hooks (.sh) require Git Bash or WSL.');
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function runPostInstall(pluginRoot) {
|
|
129
|
+
const postInstall = path.join(pluginRoot, 'scripts', 'post-install.js');
|
|
130
|
+
if (fs.existsSync(postInstall)) {
|
|
131
|
+
spawnSync(process.execPath, [postInstall], {
|
|
132
|
+
cwd: pluginRoot, stdio: 'inherit',
|
|
133
|
+
env: { ...process.env, PLUGIN_ROOT: pluginRoot },
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function getGlobalStateDir() {
|
|
139
|
+
return process.env.BABYSITTER_GLOBAL_STATE_DIR || path.join(getUserHome(), '.a5c');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function resolveCliCommand(packageRoot) {
|
|
143
|
+
try {
|
|
144
|
+
const result = spawnSync('babysitter', ['--version'], { stdio: 'pipe', timeout: 10000 });
|
|
145
|
+
if (result.status === 0) return 'babysitter';
|
|
146
|
+
} catch {}
|
|
147
|
+
const versionsPath = path.join(packageRoot, 'versions.json');
|
|
148
|
+
const versions = readJson(versionsPath) || {};
|
|
149
|
+
const ver = versions.sdkVersion || 'latest';
|
|
150
|
+
return `npx -y @a5c-ai/babysitter-sdk@${ver}`;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function runCli(packageRoot, cliArgs, options = {}) {
|
|
154
|
+
const cmd = resolveCliCommand(packageRoot);
|
|
155
|
+
const parts = cmd.split(' ');
|
|
156
|
+
const result = spawnSync(parts[0], [...parts.slice(1), ...cliArgs], {
|
|
157
|
+
stdio: options.stdio || 'inherit',
|
|
158
|
+
timeout: options.timeout || 120000,
|
|
159
|
+
cwd: options.cwd || process.cwd(),
|
|
160
|
+
env: { ...process.env, ...options.env },
|
|
161
|
+
});
|
|
162
|
+
return result;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function ensureGlobalProcessLibrary(packageRoot) {
|
|
166
|
+
const stateDir = getGlobalStateDir();
|
|
167
|
+
const activeFile = path.join(stateDir, 'active', 'process-library.json');
|
|
168
|
+
let active = readJson(activeFile);
|
|
169
|
+
if (active && active.binding && active.binding.dir) {
|
|
170
|
+
return active;
|
|
171
|
+
}
|
|
172
|
+
const defaultSpec = readJson(path.join(stateDir, 'process-library-defaults.json'));
|
|
173
|
+
const cloneDir = defaultSpec && defaultSpec.cloneDir
|
|
174
|
+
? defaultSpec.cloneDir
|
|
175
|
+
: path.join(stateDir, 'process-library', PLUGIN_NAME + '-repo');
|
|
176
|
+
runCli(packageRoot, [
|
|
177
|
+
'process-library:clone',
|
|
178
|
+
'--dir', cloneDir,
|
|
179
|
+
'--state-dir', stateDir,
|
|
180
|
+
'--json',
|
|
181
|
+
], { stdio: 'pipe' });
|
|
182
|
+
runCli(packageRoot, [
|
|
183
|
+
'process-library:use',
|
|
184
|
+
'--dir', cloneDir,
|
|
185
|
+
'--state-dir', stateDir,
|
|
186
|
+
'--json',
|
|
187
|
+
], { stdio: 'pipe' });
|
|
188
|
+
active = readJson(activeFile);
|
|
189
|
+
return {
|
|
190
|
+
binding: active && active.binding ? active.binding : { dir: cloneDir },
|
|
191
|
+
defaultSpec: defaultSpec || { cloneDir },
|
|
192
|
+
stateFile: activeFile,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
module.exports = {
|
|
198
|
+
PLUGIN_NAME,
|
|
199
|
+
PLUGIN_CATEGORY,
|
|
200
|
+
getUserHome,
|
|
201
|
+
getHarnessHome,
|
|
202
|
+
getHomePluginRoot,
|
|
203
|
+
getHomeMarketplacePath,
|
|
204
|
+
writeFileIfChanged,
|
|
205
|
+
copyRecursive,
|
|
206
|
+
copyPluginBundle,
|
|
207
|
+
readJson,
|
|
208
|
+
writeJson,
|
|
209
|
+
ensureExecutable,
|
|
210
|
+
normalizeMarketplaceSourcePath,
|
|
211
|
+
ensureMarketplaceEntry,
|
|
212
|
+
removeMarketplaceEntry,
|
|
213
|
+
warnWindowsHooks,
|
|
214
|
+
runPostInstall,
|
|
215
|
+
getGlobalStateDir,
|
|
216
|
+
resolveCliCommand,
|
|
217
|
+
runCli,
|
|
218
|
+
ensureGlobalProcessLibrary,
|
|
219
|
+
};
|
package/bin/install.cjs
CHANGED
|
@@ -1,45 +1,30 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
const fs = require('fs');
|
|
5
4
|
const path = require('path');
|
|
6
|
-
const
|
|
5
|
+
const shared = require('./install-shared');
|
|
7
6
|
|
|
8
7
|
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
9
|
-
const PACKAGE_JSON = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT, 'package.json'), 'utf8'));
|
|
10
8
|
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
continue;
|
|
9
|
+
function main() {
|
|
10
|
+
const pluginRoot = shared.getHomePluginRoot();
|
|
11
|
+
const marketplacePath = shared.getHomeMarketplacePath();
|
|
12
|
+
|
|
13
|
+
console.log(`[${shared.PLUGIN_NAME}] Installing plugin to ${pluginRoot}`);
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
shared.copyPluginBundle(PACKAGE_ROOT, pluginRoot);
|
|
17
|
+
shared.ensureMarketplaceEntry(marketplacePath, pluginRoot);
|
|
18
|
+
if (typeof shared.harnessInstall === 'function') {
|
|
19
|
+
shared.harnessInstall(PACKAGE_ROOT, pluginRoot);
|
|
23
20
|
}
|
|
24
|
-
|
|
21
|
+
shared.runPostInstall && shared.runPostInstall(pluginRoot);
|
|
22
|
+
console.log(`[${shared.PLUGIN_NAME}] Installation complete!`);
|
|
23
|
+
console.log(`[${shared.PLUGIN_NAME}] Restart your IDE/CLI to pick up the plugin.`);
|
|
24
|
+
} catch (err) {
|
|
25
|
+
console.error(`[${shared.PLUGIN_NAME}] Failed to install: ${err.message}`);
|
|
26
|
+
process.exitCode = 1;
|
|
25
27
|
}
|
|
26
|
-
return { workspace };
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function main() {
|
|
30
|
-
const { workspace } = parseArgs(process.argv);
|
|
31
|
-
const result = workspace
|
|
32
|
-
? spawnSync('omp', ['plugin', 'link', path.resolve(workspace, 'plugins', 'babysitter-omp')], {
|
|
33
|
-
cwd: workspace,
|
|
34
|
-
stdio: 'inherit',
|
|
35
|
-
env: process.env,
|
|
36
|
-
})
|
|
37
|
-
: spawnSync('omp', ['plugin', 'install', `${PACKAGE_JSON.name}@${PACKAGE_JSON.version}`], {
|
|
38
|
-
cwd: process.cwd(),
|
|
39
|
-
stdio: 'inherit',
|
|
40
|
-
env: process.env,
|
|
41
|
-
});
|
|
42
|
-
process.exitCode = result.status ?? 1;
|
|
43
28
|
}
|
|
44
29
|
|
|
45
30
|
main();
|
package/bin/uninstall.cjs
CHANGED
|
@@ -2,19 +2,23 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
const fs = require('fs');
|
|
5
|
-
const
|
|
6
|
-
const { spawnSync } = require('child_process');
|
|
7
|
-
|
|
8
|
-
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
9
|
-
const PACKAGE_JSON = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT, 'package.json'), 'utf8'));
|
|
5
|
+
const shared = require('./install-shared');
|
|
10
6
|
|
|
11
7
|
function main() {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
const pluginRoot = shared.getHomePluginRoot();
|
|
9
|
+
|
|
10
|
+
if (!fs.existsSync(pluginRoot)) {
|
|
11
|
+
console.log(`[${shared.PLUGIN_NAME}] Plugin not installed at ${pluginRoot}`);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
fs.rmSync(pluginRoot, { recursive: true, force: true });
|
|
17
|
+
console.log(`[${shared.PLUGIN_NAME}] Uninstalled from ${pluginRoot}`);
|
|
18
|
+
} catch (err) {
|
|
19
|
+
console.error(`[${shared.PLUGIN_NAME}] Failed to uninstall: ${err.message}`);
|
|
20
|
+
process.exitCode = 1;
|
|
21
|
+
}
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
main();
|
package/commands/doctor.md
CHANGED
|
@@ -362,13 +362,13 @@ Mark as FAIL if:
|
|
|
362
362
|
- Parse the output and inspect the `resolvedFrom` field. Classify as follows:
|
|
363
363
|
- `resolvedFrom: "pid-marker"` → mark as PASS ("Session ID derives from the live Claude Code ancestor process -- authoritative").
|
|
364
364
|
- `resolvedFrom: "env-file"` → mark as PASS with a note ("CLAUDE_ENV_FILE was used; typically healthy").
|
|
365
|
-
- `resolvedFrom: "env-var"` → mark as WARN ("`
|
|
366
|
-
- Remediation: run `babysitter session:cleanup` and start a fresh Claude Code session, or `unset
|
|
365
|
+
- `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").
|
|
366
|
+
- Remediation: run `babysitter session:cleanup` and start a fresh Claude Code session, or `unset AGENT_SESSION_ID` before invoking babysitter.
|
|
367
367
|
- `resolvedFrom: "none"` → mark as ERROR ("No session ID resolvable. Either no session-start hook fired, or the ancestor walk failed").
|
|
368
368
|
|
|
369
369
|
**Env-var shadow check:**
|
|
370
370
|
- Independently inspect `envVarPresent` and `envVarMatches` in the output.
|
|
371
|
-
- If `envVarPresent && !envVarMatches`, mark as WARN ("`
|
|
371
|
+
- 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").
|
|
372
372
|
|
|
373
373
|
---
|
|
374
374
|
|
|
@@ -390,7 +390,7 @@ Mark as FAIL if:
|
|
|
390
390
|
|
|
391
391
|
- Enumerate files in `~/.a5c/` matching the pattern `current-session-*-pid-*`.
|
|
392
392
|
- Count markers per harness (derived from the filename).
|
|
393
|
-
- 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 `
|
|
393
|
+
- 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").
|
|
394
394
|
- Otherwise mark as PASS.
|
|
395
395
|
|
|
396
396
|
---
|
|
@@ -501,7 +501,7 @@ babysitter session:cleanup --dry-run # preview
|
|
|
501
501
|
babysitter session:cleanup # apply
|
|
502
502
|
|
|
503
503
|
# 2. Unset a stale env var
|
|
504
|
-
unset
|
|
504
|
+
unset AGENT_SESSION_ID
|
|
505
505
|
|
|
506
506
|
# 3. Re-bind a run explicitly if needed
|
|
507
507
|
babysitter session:resume --session-id <fresh-id> --state-dir ~/.a5c --run-id <runId> --runs-dir .a5c/runs
|
package/commands/help.md
CHANGED
|
@@ -230,9 +230,10 @@ SECONDARY COMMANDS
|
|
|
230
230
|
effect status in your browser. Useful when running /yolo or /forever to watch
|
|
231
231
|
progress without interrupting the run.
|
|
232
232
|
|
|
233
|
-
How it works: Runs npx @
|
|
233
|
+
How it works: Runs npx @a5c-ai/babysitter-observer-dashboard@latest which watches
|
|
234
234
|
the .a5c/runs/ directory (or a parent directory containing multiple projects) and
|
|
235
|
-
serves a live dashboard. The process is blocking -- it runs until you stop it
|
|
235
|
+
serves a live dashboard. The process is blocking -- it runs until you stop it, and
|
|
236
|
+
it prints the local URL to share with the user.
|
|
236
237
|
|
|
237
238
|
Example: /babysitter:observe
|
|
238
239
|
(opens browser showing all runs with live-updating task
|
package/commands/observe.md
CHANGED
|
@@ -9,4 +9,4 @@ Run the babysitter observer dashboard:
|
|
|
9
9
|
1. Determine the watch directory — this is usually the project's container directory (the parent of the project dir), or the current working directory if not specified.
|
|
10
10
|
2. Launch the dashboard: `npx -y @a5c-ai/babysitter-observer-dashboard@latest --watch-dir <dir>`
|
|
11
11
|
3. This is a blocking process — it will keep running until stopped.
|
|
12
|
-
4.
|
|
12
|
+
4. Report the URL printed by the dashboard to the user, then open it in the browser.
|
package/extensions/index.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@oh-my-pi/pi-coding-agent";
|
|
2
|
+
import { execSync } from "child_process";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
|
|
5
|
+
const PLUGIN_ROOT = path.resolve(__dirname, "..");
|
|
2
6
|
|
|
3
7
|
const COMMANDS = [
|
|
4
8
|
"assimilate",
|
|
@@ -22,7 +26,44 @@ function toSkillPrompt(name: string, args: string): string {
|
|
|
22
26
|
return `/skill:${name}${args ? ` ${args}` : ""}`;
|
|
23
27
|
}
|
|
24
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Run a proxied hook script and return parsed JSON result.
|
|
31
|
+
* Returns empty object on failure (hooks are best-effort).
|
|
32
|
+
*/
|
|
33
|
+
function runProxiedHook(
|
|
34
|
+
scriptName: string,
|
|
35
|
+
inputData?: Record<string, unknown>
|
|
36
|
+
): Record<string, unknown> {
|
|
37
|
+
const scriptPath = path.join(PLUGIN_ROOT, "hooks", scriptName);
|
|
38
|
+
try {
|
|
39
|
+
const result = execSync(`node "${scriptPath}"`, {
|
|
40
|
+
input: inputData ? JSON.stringify(inputData) : undefined,
|
|
41
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
42
|
+
timeout: 30000,
|
|
43
|
+
env: {
|
|
44
|
+
...process.env,
|
|
45
|
+
OMP_PLUGIN_ROOT: PLUGIN_ROOT,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
return JSON.parse(result.toString("utf8").trim());
|
|
49
|
+
} catch {
|
|
50
|
+
// Hooks are best-effort -- never break the extension
|
|
51
|
+
return {};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
25
55
|
export default function activate(pi: ExtensionAPI): void {
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
// Trigger session-start hook on activation
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
runProxiedHook("babysitter-proxied-session-start.js", {
|
|
60
|
+
event: "session_start",
|
|
61
|
+
cwd: process.cwd(),
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
// Register slash commands (unchanged from legacy)
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
26
67
|
const forwardBabysit = async (args: unknown) => {
|
|
27
68
|
pi.sendUserMessage(toSkillPrompt("babysit", String(args ?? "").trim()));
|
|
28
69
|
};
|
package/package.json
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a5c-ai/babysitter-omp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "Orchestrate complex, multi-step workflows with event-sourced state management, hook-based extensibility, and human-in-the-loop approval — oh-my-pi",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"oh-my-pi",
|
|
8
|
-
"omp",
|
|
9
8
|
"babysitter",
|
|
10
|
-
"orchestration"
|
|
11
|
-
"ai-agent"
|
|
9
|
+
"orchestration"
|
|
12
10
|
],
|
|
13
11
|
"omp": {
|
|
14
12
|
"extensions": [
|
|
@@ -18,17 +16,12 @@
|
|
|
18
16
|
"./skills"
|
|
19
17
|
]
|
|
20
18
|
},
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"@a5c-ai/babysitter-sdk": "0.0.188-staging.f6cb97d6"
|
|
23
|
-
},
|
|
24
19
|
"peerDependencies": {
|
|
25
20
|
"@oh-my-pi/pi-coding-agent": "*"
|
|
26
21
|
},
|
|
27
22
|
"scripts": {
|
|
28
23
|
"test": "node --test test/integration.test.js && node test/packaged-install.test.cjs",
|
|
29
|
-
"
|
|
30
|
-
"test:packaged-install": "node test/packaged-install.test.cjs",
|
|
31
|
-
"sync:commands": "node scripts/sync-command-docs.cjs",
|
|
24
|
+
"validate:ci": "npm test",
|
|
32
25
|
"deploy": "npm publish --access public",
|
|
33
26
|
"deploy:staging": "npm publish --access public --tag staging"
|
|
34
27
|
},
|
|
@@ -53,7 +46,10 @@
|
|
|
53
46
|
},
|
|
54
47
|
"repository": {
|
|
55
48
|
"type": "git",
|
|
56
|
-
"url": "https://github.com/a5c-ai/babysitter"
|
|
49
|
+
"url": "git+https://github.com/a5c-ai/babysitter-omp.git"
|
|
57
50
|
},
|
|
58
|
-
"homepage": "https://github.com/a5c-ai/babysitter
|
|
51
|
+
"homepage": "https://github.com/a5c-ai/babysitter-omp#readme",
|
|
52
|
+
"bugs": {
|
|
53
|
+
"url": "https://github.com/a5c-ai/babysitter-omp/issues"
|
|
54
|
+
}
|
|
59
55
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
4
|
+
|
|
5
|
+
function run(command, args) {
|
|
6
|
+
const result = spawnSync(command, args, { encoding: 'utf8', stdio: 'inherit' });
|
|
7
|
+
if (result.status !== 0) process.exit(result.status || 1);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const branch = process.env.GITHUB_REF_NAME || 'develop';
|
|
11
|
+
const sha = (process.env.GITHUB_SHA || '').slice(0, 12);
|
|
12
|
+
const version = existsSync('package.json') ? JSON.parse(readFileSync('package.json', 'utf8')).version : JSON.parse(readFileSync('versions.json', 'utf8')).sdkVersion;
|
|
13
|
+
const normalized = String(version).replace(/[^0-9A-Za-z._-]/g, '-');
|
|
14
|
+
const tag = 'release/' + branch + '/v' + normalized + '-' + sha;
|
|
15
|
+
run('git', ['config', 'user.name', 'github-actions[bot]']);
|
|
16
|
+
run('git', ['config', 'user.email', 'github-actions[bot]@users.noreply.github.com']);
|
|
17
|
+
run('git', ['tag', tag]);
|
|
18
|
+
run('git', ['push', 'origin', tag]);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
|
|
4
|
+
function run(command, args) {
|
|
5
|
+
const result = spawnSync(command, args, { stdio: 'inherit' });
|
|
6
|
+
if (result.status !== 0) process.exit(result.status || 1);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const ref = process.env.GITHUB_REF_NAME || '';
|
|
10
|
+
const branch = ref.split('/')[1] || 'develop';
|
|
11
|
+
const tag = branch === 'main' ? 'latest' : branch;
|
|
12
|
+
run('npm', ['publish', '--access', 'public', '--tag', tag]);
|
|
@@ -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/babysit/SKILL.md
CHANGED
|
@@ -16,6 +16,8 @@ Read the SDK version from `versions.json` to ensure version compatibility:
|
|
|
16
16
|
```bash
|
|
17
17
|
PLUGIN_ROOT="${OMP_PLUGIN_ROOT:-$(pwd)}"
|
|
18
18
|
SDK_VERSION=$(node -e "try{const fs=require('fs');const path=require('path');const pluginRoot=process.env.OMP_PLUGIN_ROOT||process.env.PLUGIN_ROOT||process.cwd();const probes=[path.join(pluginRoot,'versions.json'),path.join(pluginRoot,'plugins','babysitter-omp','versions.json'),path.join(pluginRoot,'node_modules','@a5c-ai','babysitter-omp','versions.json'),path.join(process.cwd(),'node_modules','@a5c-ai','babysitter-omp','versions.json')];for(const probe of probes){if(fs.existsSync(probe)){console.log(JSON.parse(fs.readFileSync(probe,'utf8')).sdkVersion||'latest');process.exit(0)}}console.log('latest')}catch{console.log('latest')}")
|
|
19
|
+
npm i -g @a5c-ai/babysitter-sdk@$SDK_VERSION
|
|
20
|
+
|
|
19
21
|
CLI="npx -y @a5c-ai/babysitter-sdk@$SDK_VERSION"
|
|
20
22
|
```
|
|
21
23
|
|
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
|
package/skills/help/SKILL.md
CHANGED
|
@@ -231,9 +231,10 @@ SECONDARY COMMANDS
|
|
|
231
231
|
effect status in your browser. Useful when running /yolo or /forever to watch
|
|
232
232
|
progress without interrupting the run.
|
|
233
233
|
|
|
234
|
-
How it works: Runs npx @
|
|
234
|
+
How it works: Runs npx @a5c-ai/babysitter-observer-dashboard@latest which watches
|
|
235
235
|
the .a5c/runs/ directory (or a parent directory containing multiple projects) and
|
|
236
|
-
serves a live dashboard. The process is blocking -- it runs until you stop it
|
|
236
|
+
serves a live dashboard. The process is blocking -- it runs until you stop it, and
|
|
237
|
+
it prints the local URL to share with the user.
|
|
237
238
|
|
|
238
239
|
Example: /babysitter:observe
|
|
239
240
|
(opens browser showing all runs with live-updating task
|
package/skills/observe/SKILL.md
CHANGED
|
@@ -10,4 +10,4 @@ Run the babysitter observer dashboard:
|
|
|
10
10
|
1. Determine the watch directory — this is usually the project's container directory (the parent of the project dir), or the current working directory if not specified.
|
|
11
11
|
2. Launch the dashboard: `npx -y @a5c-ai/babysitter-observer-dashboard@latest --watch-dir <dir>`
|
|
12
12
|
3. This is a blocking process — it will keep running until stopped.
|
|
13
|
-
4.
|
|
13
|
+
4. Report the URL printed by the dashboard to the user, then open it in the browser.
|
package/versions.json
CHANGED
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."
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const {
|
|
5
|
-
listMarkdownBasenames,
|
|
6
|
-
reportCheckResult,
|
|
7
|
-
syncCommandMirrors,
|
|
8
|
-
syncSkillsFromCommands,
|
|
9
|
-
writeFileIfChanged,
|
|
10
|
-
} = require('../../../scripts/plugin-command-sync-lib.cjs');
|
|
11
|
-
|
|
12
|
-
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
13
|
-
const REPO_ROOT = path.resolve(PACKAGE_ROOT, '..', '..');
|
|
14
|
-
const ROOT_COMMANDS = path.join(REPO_ROOT, 'plugins', 'babysitter', 'commands');
|
|
15
|
-
const COMMANDS_ROOT = path.join(PACKAGE_ROOT, 'commands');
|
|
16
|
-
const SKILLS_ROOT = path.join(PACKAGE_ROOT, 'skills');
|
|
17
|
-
const LABEL = 'babysitter-omp sync';
|
|
18
|
-
|
|
19
|
-
const BABYSIT_SKILL = `---
|
|
20
|
-
name: babysit
|
|
21
|
-
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.)
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
# babysit
|
|
25
|
-
|
|
26
|
-
Orchestrate \`.a5c/runs/<runId>/\` through iterative execution.
|
|
27
|
-
|
|
28
|
-
## Dependencies
|
|
29
|
-
|
|
30
|
-
### Babysitter SDK and CLI
|
|
31
|
-
|
|
32
|
-
Read the SDK version from \`versions.json\` to ensure version compatibility:
|
|
33
|
-
|
|
34
|
-
\`\`\`bash
|
|
35
|
-
PLUGIN_ROOT="\${OMP_PLUGIN_ROOT:-\$(pwd)}"
|
|
36
|
-
SDK_VERSION=$(node -e "try{const fs=require('fs');const path=require('path');const pluginRoot=process.env.OMP_PLUGIN_ROOT||process.env.PLUGIN_ROOT||process.cwd();const probes=[path.join(pluginRoot,'versions.json'),path.join(pluginRoot,'plugins','babysitter-omp','versions.json'),path.join(pluginRoot,'node_modules','@a5c-ai','babysitter-omp','versions.json'),path.join(process.cwd(),'node_modules','@a5c-ai','babysitter-omp','versions.json')];for(const probe of probes){if(fs.existsSync(probe)){console.log(JSON.parse(fs.readFileSync(probe,'utf8')).sdkVersion||'latest');process.exit(0)}}console.log('latest')}catch{console.log('latest')}")
|
|
37
|
-
CLI="npx -y @a5c-ai/babysitter-sdk@$SDK_VERSION"
|
|
38
|
-
\`\`\`
|
|
39
|
-
|
|
40
|
-
## Instructions
|
|
41
|
-
|
|
42
|
-
Run the following command to get full orchestration instructions:
|
|
43
|
-
|
|
44
|
-
\`\`\`bash
|
|
45
|
-
babysitter instructions:babysit-skill --harness oh-my-pi --interactive
|
|
46
|
-
\`\`\`
|
|
47
|
-
|
|
48
|
-
For non-interactive mode:
|
|
49
|
-
|
|
50
|
-
\`\`\`bash
|
|
51
|
-
babysitter instructions:babysit-skill --harness oh-my-pi --no-interactive
|
|
52
|
-
\`\`\`
|
|
53
|
-
|
|
54
|
-
Follow the instructions returned by the command above to orchestrate the run.
|
|
55
|
-
`;
|
|
56
|
-
|
|
57
|
-
function getCommandNames() {
|
|
58
|
-
return listMarkdownBasenames(ROOT_COMMANDS);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function main() {
|
|
62
|
-
const check = process.argv.includes('--check');
|
|
63
|
-
const commandNames = getCommandNames();
|
|
64
|
-
const mirrorResult = syncCommandMirrors({
|
|
65
|
-
label: LABEL,
|
|
66
|
-
sourceRoot: ROOT_COMMANDS,
|
|
67
|
-
targetRoot: COMMANDS_ROOT,
|
|
68
|
-
names: commandNames,
|
|
69
|
-
check,
|
|
70
|
-
cwd: PACKAGE_ROOT,
|
|
71
|
-
});
|
|
72
|
-
const skillsResult = syncSkillsFromCommands({
|
|
73
|
-
label: LABEL,
|
|
74
|
-
sourceRoot: COMMANDS_ROOT,
|
|
75
|
-
skillsRoot: SKILLS_ROOT,
|
|
76
|
-
names: commandNames,
|
|
77
|
-
check,
|
|
78
|
-
cwd: PACKAGE_ROOT,
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
const babysitSkillPath = path.join(SKILLS_ROOT, 'babysit', 'SKILL.md');
|
|
82
|
-
if (check) {
|
|
83
|
-
const fs = require('fs');
|
|
84
|
-
const stale = [...mirrorResult.stale, ...skillsResult.stale];
|
|
85
|
-
const current = fs.existsSync(babysitSkillPath)
|
|
86
|
-
? fs.readFileSync(babysitSkillPath, 'utf8')
|
|
87
|
-
: null;
|
|
88
|
-
if (current !== BABYSIT_SKILL) {
|
|
89
|
-
stale.push(path.relative(PACKAGE_ROOT, babysitSkillPath));
|
|
90
|
-
}
|
|
91
|
-
reportCheckResult(LABEL, stale);
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const babysitUpdated = writeFileIfChanged(babysitSkillPath, BABYSIT_SKILL) ? 1 : 0;
|
|
96
|
-
const updated = mirrorResult.updated + skillsResult.updated + babysitUpdated;
|
|
97
|
-
|
|
98
|
-
if (updated === 0) {
|
|
99
|
-
console.log(`[${LABEL}] no oh-my-pi command or skill changes were needed.`);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
console.log(`[${LABEL}] updated ${updated} oh-my-pi command/skill file(s).`);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
main();
|