@a5c-ai/babysitter-sdk 0.0.184 → 0.0.185
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/instructions.d.ts.map +1 -1
- package/dist/cli/commands/instructions.js +41 -0
- package/dist/cli/main.js +2 -2
- package/dist/config/defaults.d.ts +11 -0
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +55 -0
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +2 -1
- package/dist/harness/claudeCode.d.ts +2 -2
- package/dist/harness/claudeCode.d.ts.map +1 -1
- package/dist/harness/claudeCode.js +47 -72
- package/dist/harness/codex.d.ts.map +1 -1
- package/dist/harness/codex.js +10 -49
- package/dist/harness/cursor.d.ts.map +1 -1
- package/dist/harness/cursor.js +23 -34
- package/dist/harness/customAdapter.d.ts.map +1 -1
- package/dist/harness/customAdapter.js +8 -3
- package/dist/harness/discovery.js +7 -7
- package/dist/harness/geminiCli.d.ts.map +1 -1
- package/dist/harness/geminiCli.js +20 -27
- package/dist/harness/githubCopilot.d.ts.map +1 -1
- package/dist/harness/githubCopilot.js +17 -40
- package/dist/harness/index.d.ts +1 -0
- package/dist/harness/index.d.ts.map +1 -1
- package/dist/harness/index.js +3 -1
- package/dist/harness/installSupport.d.ts +1 -0
- package/dist/harness/installSupport.d.ts.map +1 -1
- package/dist/harness/installSupport.js +7 -3
- package/dist/harness/invoker.js +1 -1
- package/dist/harness/ohMyPi.d.ts +0 -14
- package/dist/harness/ohMyPi.d.ts.map +1 -1
- package/dist/harness/ohMyPi.js +163 -24
- package/dist/harness/opencode.d.ts +28 -0
- package/dist/harness/opencode.d.ts.map +1 -0
- package/dist/harness/opencode.js +578 -0
- package/dist/harness/pi.d.ts +1 -11
- package/dist/harness/pi.d.ts.map +1 -1
- package/dist/harness/pi.js +81 -105
- package/dist/harness/registry.d.ts.map +1 -1
- package/dist/harness/registry.js +2 -0
- package/dist/prompts/context.d.ts +9 -0
- package/dist/prompts/context.d.ts.map +1 -1
- package/dist/prompts/context.js +128 -20
- package/dist/prompts/index.d.ts +1 -1
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +2 -1
- package/dist/prompts/templates/completion-proof.md +8 -0
- package/dist/prompts/templates/critical-rules.md +5 -5
- package/dist/prompts/types.d.ts +4 -5
- package/dist/prompts/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/harness/cursor.js
CHANGED
|
@@ -76,12 +76,11 @@ const session_1 = require("../session");
|
|
|
76
76
|
const session_2 = require("../cli/commands/session");
|
|
77
77
|
const types_1 = require("./types");
|
|
78
78
|
const context_1 = require("../prompts/context");
|
|
79
|
+
const config_1 = require("../config");
|
|
79
80
|
// ---------------------------------------------------------------------------
|
|
80
81
|
// Constants
|
|
81
82
|
// ---------------------------------------------------------------------------
|
|
82
83
|
const HARNESS_NAME = "cursor";
|
|
83
|
-
/** Default state directory for Cursor sessions */
|
|
84
|
-
const DEFAULT_STATE_DIR = ".a5c/state";
|
|
85
84
|
function createHookLogger(hookName) {
|
|
86
85
|
const logDir = process.env.BABYSITTER_LOG_DIR || ".a5c/logs";
|
|
87
86
|
const logFile = logDir ? path.join(logDir, `${hookName}.log`) : null;
|
|
@@ -206,15 +205,7 @@ async function cleanupSession(filePath) {
|
|
|
206
205
|
function resolveStateDirInternal(args) {
|
|
207
206
|
if (args.stateDir)
|
|
208
207
|
return path.resolve(args.stateDir);
|
|
209
|
-
|
|
210
|
-
return path.resolve(args.pluginRoot, "state");
|
|
211
|
-
}
|
|
212
|
-
const pluginRoot = process.env.CURSOR_PLUGIN_ROOT;
|
|
213
|
-
if (pluginRoot) {
|
|
214
|
-
return path.resolve(pluginRoot, "state");
|
|
215
|
-
}
|
|
216
|
-
// Default: project-relative .a5c/state/
|
|
217
|
-
return path.resolve(DEFAULT_STATE_DIR);
|
|
208
|
+
return (0, config_1.getGlobalStateDir)();
|
|
218
209
|
}
|
|
219
210
|
// ---------------------------------------------------------------------------
|
|
220
211
|
// Stop hook handler
|
|
@@ -252,38 +243,32 @@ async function handleStopHookImpl(args) {
|
|
|
252
243
|
}
|
|
253
244
|
const hookInput = parseHookInput(rawInput);
|
|
254
245
|
log.info("Hook input received");
|
|
255
|
-
// 2. Resolve session ID from hook input
|
|
256
|
-
//
|
|
257
|
-
|
|
246
|
+
// 2. Resolve session ID from hook input or cross-harness env var
|
|
247
|
+
// Cursor provides conversation_id via stdin JSON only; BABYSITTER_SESSION_ID
|
|
248
|
+
// may be set externally as a cross-harness fallback.
|
|
249
|
+
const sessionId = safeStr(hookInput, "conversation_id") ||
|
|
250
|
+
process.env.BABYSITTER_SESSION_ID ||
|
|
251
|
+
"";
|
|
258
252
|
if (!sessionId) {
|
|
259
253
|
log.info("No conversation_id in hook input — allowing exit");
|
|
260
254
|
process.stdout.write("{}\n");
|
|
261
255
|
return 0;
|
|
262
256
|
}
|
|
263
257
|
log.setContext("session", sessionId);
|
|
264
|
-
log.info(`Session ID
|
|
258
|
+
log.info(`Session ID: ${sessionId}`);
|
|
265
259
|
// 3. Resolve state directory
|
|
266
260
|
const stateDir = resolveStateDirInternal(args);
|
|
267
261
|
const runsDir = args.runsDir || ".a5c/runs";
|
|
268
262
|
log.info(`Resolved stateDir: ${stateDir}`);
|
|
269
263
|
// 4. Read session state file
|
|
270
|
-
|
|
264
|
+
const filePath = (0, session_1.getSessionFilePath)(stateDir, sessionId);
|
|
271
265
|
log.info(`Checking session file at: ${filePath}`);
|
|
272
266
|
let sessionFile;
|
|
273
267
|
try {
|
|
274
268
|
if (!(await (0, session_1.sessionFileExists)(filePath))) {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
if (await (0, session_1.sessionFileExists)(fallbackPath)) {
|
|
279
|
-
filePath = fallbackPath;
|
|
280
|
-
log.info(`Found session file at fallback path: ${filePath}`);
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
log.info(`No active babysitter loop for session ${sessionId} — allowing exit`);
|
|
284
|
-
process.stdout.write("{}\n");
|
|
285
|
-
return 0;
|
|
286
|
-
}
|
|
269
|
+
log.info(`No active babysitter loop for session ${sessionId} — allowing exit`);
|
|
270
|
+
process.stdout.write("{}\n");
|
|
271
|
+
return 0;
|
|
287
272
|
}
|
|
288
273
|
sessionFile = await (0, session_1.readSessionFile)(filePath);
|
|
289
274
|
}
|
|
@@ -551,14 +536,18 @@ async function handleSessionStartHookImpl(args) {
|
|
|
551
536
|
}
|
|
552
537
|
const hookInput = parseHookInput(rawInput);
|
|
553
538
|
// 2. Resolve session ID from conversation_id in hook input
|
|
554
|
-
|
|
539
|
+
// Cursor has no env file mechanism; conversation_id is the only source.
|
|
540
|
+
// BABYSITTER_SESSION_ID used as cross-harness fallback if set externally.
|
|
541
|
+
const sessionId = safeStr(hookInput, "conversation_id") ||
|
|
542
|
+
process.env.BABYSITTER_SESSION_ID ||
|
|
543
|
+
"";
|
|
555
544
|
if (!sessionId) {
|
|
556
545
|
log.info("No conversation_id in hook input — skipping state file creation");
|
|
557
546
|
process.stdout.write("{}\n");
|
|
558
547
|
return 0;
|
|
559
548
|
}
|
|
560
549
|
log.setContext("session", sessionId);
|
|
561
|
-
log.info(`Session ID
|
|
550
|
+
log.info(`Session ID: ${sessionId}`);
|
|
562
551
|
// 3. Resolve state directory and create baseline session file
|
|
563
552
|
const stateDir = resolveStateDirInternal(args);
|
|
564
553
|
log.info(`Resolved stateDir: ${stateDir}`);
|
|
@@ -745,12 +734,12 @@ function createCursorAdapter() {
|
|
|
745
734
|
return `Hook type "${hookType}" is not supported by the Cursor adapter.`;
|
|
746
735
|
},
|
|
747
736
|
resolveSessionId(parsed) {
|
|
748
|
-
// Cursor has no session ID env var. The only source is the
|
|
749
|
-
// conversation_id from hook stdin JSON, which the sessionStart hook
|
|
750
|
-
// persists to the state file. If an explicit sessionId is passed
|
|
751
|
-
// (e.g. from CLI args), use it.
|
|
752
737
|
if (parsed.sessionId)
|
|
753
738
|
return parsed.sessionId;
|
|
739
|
+
// Cursor has no env file mechanism, but BABYSITTER_SESSION_ID may be
|
|
740
|
+
// set externally or by a wrapper script.
|
|
741
|
+
if (process.env.BABYSITTER_SESSION_ID)
|
|
742
|
+
return process.env.BABYSITTER_SESSION_ID;
|
|
754
743
|
return undefined;
|
|
755
744
|
},
|
|
756
745
|
resolveStateDir(args) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customAdapter.d.ts","sourceRoot":"","sources":["../../src/harness/customAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"customAdapter.d.ts","sourceRoot":"","sources":["../../src/harness/customAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,SAAS,CAAC;AAEjB,wBAAgB,mBAAmB,IAAI,cAAc,CAuEpD"}
|
|
@@ -46,6 +46,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
46
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
47
|
exports.createCustomAdapter = createCustomAdapter;
|
|
48
48
|
const path = __importStar(require("node:path"));
|
|
49
|
+
const config_1 = require("../config");
|
|
49
50
|
function createCustomAdapter() {
|
|
50
51
|
return {
|
|
51
52
|
name: "custom",
|
|
@@ -58,13 +59,17 @@ function createCustomAdapter() {
|
|
|
58
59
|
return false;
|
|
59
60
|
},
|
|
60
61
|
resolveSessionId(parsed) {
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
if (parsed.sessionId)
|
|
63
|
+
return parsed.sessionId;
|
|
64
|
+
// Cross-harness standard env var as fallback for custom adapters
|
|
65
|
+
if (process.env.BABYSITTER_SESSION_ID)
|
|
66
|
+
return process.env.BABYSITTER_SESSION_ID;
|
|
67
|
+
return undefined;
|
|
63
68
|
},
|
|
64
69
|
resolveStateDir(args) {
|
|
65
70
|
if (args.stateDir)
|
|
66
71
|
return path.resolve(args.stateDir);
|
|
67
|
-
return
|
|
72
|
+
return (0, config_1.getGlobalStateDir)();
|
|
68
73
|
},
|
|
69
74
|
resolvePluginRoot(args) {
|
|
70
75
|
return args.pluginRoot ? path.resolve(args.pluginRoot) : undefined;
|
|
@@ -65,13 +65,13 @@ exports.KNOWN_HARNESSES = [
|
|
|
65
65
|
{
|
|
66
66
|
name: "claude-code",
|
|
67
67
|
cli: "claude",
|
|
68
|
-
callerEnvVars: ["
|
|
68
|
+
callerEnvVars: ["CLAUDE_ENV_FILE"],
|
|
69
69
|
capabilities: [types_1.HarnessCapability.SessionBinding, types_1.HarnessCapability.StopHook, types_1.HarnessCapability.Mcp, types_1.HarnessCapability.HeadlessPrompt],
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
name: "codex",
|
|
73
73
|
cli: "codex",
|
|
74
|
-
callerEnvVars: ["CODEX_THREAD_ID", "CODEX_SESSION_ID", "
|
|
74
|
+
callerEnvVars: ["CODEX_THREAD_ID", "CODEX_SESSION_ID", "CODEX_PLUGIN_ROOT"],
|
|
75
75
|
capabilities: [types_1.HarnessCapability.SessionBinding, types_1.HarnessCapability.StopHook, types_1.HarnessCapability.HeadlessPrompt],
|
|
76
76
|
},
|
|
77
77
|
{
|
|
@@ -86,7 +86,7 @@ exports.KNOWN_HARNESSES = [
|
|
|
86
86
|
name: "gemini-cli",
|
|
87
87
|
cli: "gemini",
|
|
88
88
|
callerEnvVars: ["GEMINI_SESSION_ID", "GEMINI_PROJECT_DIR", "GEMINI_CWD"],
|
|
89
|
-
capabilities: [types_1.HarnessCapability.SessionBinding, types_1.HarnessCapability.HeadlessPrompt],
|
|
89
|
+
capabilities: [types_1.HarnessCapability.SessionBinding, types_1.HarnessCapability.HeadlessPrompt, types_1.HarnessCapability.StopHook],
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
92
|
name: "github-copilot",
|
|
@@ -100,20 +100,20 @@ exports.KNOWN_HARNESSES = [
|
|
|
100
100
|
{
|
|
101
101
|
name: "opencode",
|
|
102
102
|
cli: "opencode",
|
|
103
|
-
callerEnvVars: [],
|
|
103
|
+
callerEnvVars: ["BABYSITTER_SESSION_ID", "OPENCODE_CONFIG"],
|
|
104
104
|
capabilities: [types_1.HarnessCapability.HeadlessPrompt],
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
107
|
name: "oh-my-pi",
|
|
108
108
|
cli: "omp",
|
|
109
109
|
callerEnvVars: ["OMP_SESSION_ID", "OMP_PLUGIN_ROOT"],
|
|
110
|
-
capabilities: [types_1.HarnessCapability.Programmatic, types_1.HarnessCapability.SessionBinding, types_1.HarnessCapability.
|
|
110
|
+
capabilities: [types_1.HarnessCapability.Programmatic, types_1.HarnessCapability.SessionBinding, types_1.HarnessCapability.HeadlessPrompt, types_1.HarnessCapability.Mcp],
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
name: "pi",
|
|
114
114
|
cli: "pi",
|
|
115
|
-
callerEnvVars: ["
|
|
116
|
-
capabilities: [types_1.HarnessCapability.
|
|
115
|
+
callerEnvVars: ["PI_SESSION_ID", "PI_PLUGIN_ROOT"],
|
|
116
|
+
capabilities: [types_1.HarnessCapability.Programmatic, types_1.HarnessCapability.SessionBinding, types_1.HarnessCapability.HeadlessPrompt],
|
|
117
117
|
},
|
|
118
118
|
{
|
|
119
119
|
name: "internal",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geminiCli.d.ts","sourceRoot":"","sources":["../../src/harness/geminiCli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAsBH,OAAO,KAAK,EACV,cAAc,EAMf,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"geminiCli.d.ts","sourceRoot":"","sources":["../../src/harness/geminiCli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAsBH,OAAO,KAAK,EACV,cAAc,EAMf,MAAM,SAAS,CAAC;AAwyBjB,wBAAgB,sBAAsB,IAAI,cAAc,CAqFvD"}
|
|
@@ -71,12 +71,12 @@ const completionProof_1 = require("../cli/completionProof");
|
|
|
71
71
|
const session_1 = require("../session");
|
|
72
72
|
const session_2 = require("../cli/commands/session");
|
|
73
73
|
const installSupport_1 = require("./installSupport");
|
|
74
|
+
const context_1 = require("../prompts/context");
|
|
75
|
+
const config_1 = require("../config");
|
|
74
76
|
// ---------------------------------------------------------------------------
|
|
75
77
|
// Constants
|
|
76
78
|
// ---------------------------------------------------------------------------
|
|
77
79
|
const HARNESS_NAME = "gemini-cli";
|
|
78
|
-
/** Default state directory for Gemini CLI sessions */
|
|
79
|
-
const DEFAULT_STATE_DIR = ".a5c/state";
|
|
80
80
|
function createHookLogger(hookName) {
|
|
81
81
|
const logDir = process.env.BABYSITTER_LOG_DIR || ".a5c/logs";
|
|
82
82
|
const logFile = logDir ? path.join(logDir, `${hookName}.log`) : null;
|
|
@@ -201,17 +201,7 @@ async function cleanupSession(filePath) {
|
|
|
201
201
|
function resolveStateDirInternal(args) {
|
|
202
202
|
if (args.stateDir)
|
|
203
203
|
return path.resolve(args.stateDir);
|
|
204
|
-
|
|
205
|
-
return path.resolve(args.pluginRoot, "state");
|
|
206
|
-
}
|
|
207
|
-
// Check Gemini CLI extension path env var
|
|
208
|
-
const extensionPath = process.env.GEMINI_EXTENSION_PATH ||
|
|
209
|
-
process.env.BABYSITTER_EXTENSION_PATH;
|
|
210
|
-
if (extensionPath) {
|
|
211
|
-
return path.resolve(extensionPath, "state");
|
|
212
|
-
}
|
|
213
|
-
// Default: project-relative .a5c/state/
|
|
214
|
-
return path.resolve(DEFAULT_STATE_DIR);
|
|
204
|
+
return (0, config_1.getGlobalStateDir)();
|
|
215
205
|
}
|
|
216
206
|
// ---------------------------------------------------------------------------
|
|
217
207
|
// AfterAgent (Stop) hook handler
|
|
@@ -239,7 +229,9 @@ async function handleAfterAgentHookImpl(args) {
|
|
|
239
229
|
const hookInput = parseHookInput(rawInput);
|
|
240
230
|
log.info("Hook input received");
|
|
241
231
|
// 2. Resolve session ID from hook input or env var
|
|
232
|
+
// Priority: stdin session_id → BABYSITTER_SESSION_ID → GEMINI_SESSION_ID
|
|
242
233
|
const sessionId = safeStr(hookInput, "session_id") ||
|
|
234
|
+
process.env.BABYSITTER_SESSION_ID ||
|
|
243
235
|
process.env.GEMINI_SESSION_ID ||
|
|
244
236
|
"";
|
|
245
237
|
if (!sessionId) {
|
|
@@ -254,23 +246,14 @@ async function handleAfterAgentHookImpl(args) {
|
|
|
254
246
|
const runsDir = args.runsDir || ".a5c/runs";
|
|
255
247
|
log.info(`Resolved stateDir: ${stateDir}`);
|
|
256
248
|
// 4. Read session state file
|
|
257
|
-
|
|
249
|
+
const filePath = (0, session_1.getSessionFilePath)(stateDir, sessionId);
|
|
258
250
|
log.info(`Checking session file at: ${filePath}`);
|
|
259
251
|
let sessionFile;
|
|
260
252
|
try {
|
|
261
253
|
if (!(await (0, session_1.sessionFileExists)(filePath))) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
if (await (0, session_1.sessionFileExists)(fallbackPath)) {
|
|
266
|
-
filePath = fallbackPath;
|
|
267
|
-
log.info(`Found session file at fallback path: ${filePath}`);
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
log.info(`No active babysitter loop for session ${sessionId} — allowing exit`);
|
|
271
|
-
process.stdout.write("{}\n");
|
|
272
|
-
return 0;
|
|
273
|
-
}
|
|
254
|
+
log.info(`No active babysitter loop for session ${sessionId} — allowing exit`);
|
|
255
|
+
process.stdout.write("{}\n");
|
|
256
|
+
return 0;
|
|
274
257
|
}
|
|
275
258
|
sessionFile = await (0, session_1.readSessionFile)(filePath);
|
|
276
259
|
}
|
|
@@ -576,7 +559,10 @@ async function handleSessionStartHookImpl(args) {
|
|
|
576
559
|
}
|
|
577
560
|
const hookInput = parseHookInput(rawInput);
|
|
578
561
|
// 2. Resolve session ID
|
|
562
|
+
// Gemini auto-injects GEMINI_SESSION_ID; BABYSITTER_SESSION_ID takes priority
|
|
563
|
+
// if set (no env file mechanism — Gemini injects natively).
|
|
579
564
|
const sessionId = safeStr(hookInput, "session_id") ||
|
|
565
|
+
process.env.BABYSITTER_SESSION_ID ||
|
|
580
566
|
process.env.GEMINI_SESSION_ID ||
|
|
581
567
|
"";
|
|
582
568
|
if (!sessionId) {
|
|
@@ -723,7 +709,8 @@ function createGeminiCliAdapter() {
|
|
|
723
709
|
return {
|
|
724
710
|
name: HARNESS_NAME,
|
|
725
711
|
isActive() {
|
|
726
|
-
return !!(process.env.
|
|
712
|
+
return !!(process.env.BABYSITTER_SESSION_ID ||
|
|
713
|
+
process.env.GEMINI_SESSION_ID ||
|
|
727
714
|
process.env.GEMINI_PROJECT_DIR ||
|
|
728
715
|
process.env.GEMINI_CWD);
|
|
729
716
|
},
|
|
@@ -733,6 +720,9 @@ function createGeminiCliAdapter() {
|
|
|
733
720
|
resolveSessionId(parsed) {
|
|
734
721
|
if (parsed.sessionId)
|
|
735
722
|
return parsed.sessionId;
|
|
723
|
+
// Cross-harness standard first, then Gemini-native (auto-injected)
|
|
724
|
+
if (process.env.BABYSITTER_SESSION_ID)
|
|
725
|
+
return process.env.BABYSITTER_SESSION_ID;
|
|
736
726
|
if (process.env.GEMINI_SESSION_ID)
|
|
737
727
|
return process.env.GEMINI_SESSION_ID;
|
|
738
728
|
return undefined;
|
|
@@ -777,5 +767,8 @@ function createGeminiCliAdapter() {
|
|
|
777
767
|
installPlugin(options) {
|
|
778
768
|
return installGeminiPlugin(options);
|
|
779
769
|
},
|
|
770
|
+
getPromptContext(opts) {
|
|
771
|
+
return (0, context_1.createGeminiCliContext)(opts);
|
|
772
|
+
},
|
|
780
773
|
};
|
|
781
774
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubCopilot.d.ts","sourceRoot":"","sources":["../../src/harness/githubCopilot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAeH,OAAO,KAAK,EACV,cAAc,EAMf,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"githubCopilot.d.ts","sourceRoot":"","sources":["../../src/harness/githubCopilot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAeH,OAAO,KAAK,EACV,cAAc,EAMf,MAAM,SAAS,CAAC;AAykBjB,wBAAgB,0BAA0B,IAAI,cAAc,CAsG3D"}
|
|
@@ -73,12 +73,11 @@ const session_1 = require("../session");
|
|
|
73
73
|
const types_1 = require("./types");
|
|
74
74
|
const context_1 = require("../prompts/context");
|
|
75
75
|
const installSupport_1 = require("./installSupport");
|
|
76
|
+
const config_1 = require("../config");
|
|
76
77
|
// ---------------------------------------------------------------------------
|
|
77
78
|
// Constants
|
|
78
79
|
// ---------------------------------------------------------------------------
|
|
79
80
|
const HARNESS_NAME = "github-copilot";
|
|
80
|
-
/** Default state directory for GitHub Copilot CLI sessions */
|
|
81
|
-
const DEFAULT_STATE_DIR = ".a5c/state";
|
|
82
81
|
function createHookLogger(hookName) {
|
|
83
82
|
const logDir = process.env.BABYSITTER_LOG_DIR || ".a5c/logs";
|
|
84
83
|
const logFile = logDir ? path.join(logDir, `${hookName}.log`) : null;
|
|
@@ -183,20 +182,7 @@ async function cleanupSession(filePath) {
|
|
|
183
182
|
function resolveStateDirInternal(args) {
|
|
184
183
|
if (args.stateDir)
|
|
185
184
|
return path.resolve(args.stateDir);
|
|
186
|
-
|
|
187
|
-
return path.resolve(process.env.BABYSITTER_STATE_DIR);
|
|
188
|
-
}
|
|
189
|
-
if (args.pluginRoot) {
|
|
190
|
-
return path.resolve(args.pluginRoot, "skills", "babysit", "state");
|
|
191
|
-
}
|
|
192
|
-
// Check Copilot plugin root env vars
|
|
193
|
-
const pluginData = process.env.CLAUDE_PLUGIN_DATA ||
|
|
194
|
-
process.env.COPILOT_PLUGIN_ROOT;
|
|
195
|
-
if (pluginData) {
|
|
196
|
-
return path.resolve(pluginData, "skills", "babysit", "state");
|
|
197
|
-
}
|
|
198
|
-
// Default: project-relative .a5c/state/
|
|
199
|
-
return path.resolve(DEFAULT_STATE_DIR);
|
|
185
|
+
return (0, config_1.getGlobalStateDir)();
|
|
200
186
|
}
|
|
201
187
|
// ---------------------------------------------------------------------------
|
|
202
188
|
// Plugin root resolution
|
|
@@ -214,15 +200,15 @@ function resolveSessionIdInternal(parsed) {
|
|
|
214
200
|
// 1. Explicit arg (highest priority)
|
|
215
201
|
if (parsed.sessionId)
|
|
216
202
|
return parsed.sessionId;
|
|
217
|
-
// 2.
|
|
218
|
-
if (process.env.
|
|
219
|
-
return process.env.
|
|
203
|
+
// 2. Cross-harness standard env var (written by session-start hook to env file)
|
|
204
|
+
if (process.env.BABYSITTER_SESSION_ID)
|
|
205
|
+
return process.env.BABYSITTER_SESSION_ID;
|
|
220
206
|
// 3. Env file (if COPILOT_ENV_FILE or CLAUDE_ENV_FILE exists)
|
|
221
207
|
const envFile = process.env.COPILOT_ENV_FILE || process.env.CLAUDE_ENV_FILE;
|
|
222
208
|
if (envFile) {
|
|
223
209
|
try {
|
|
224
210
|
const content = (0, node_fs_1.readFileSync)(envFile, "utf-8");
|
|
225
|
-
const match = content.match(/(?:^|\n)\s*(?:export\s+)?
|
|
211
|
+
const match = content.match(/(?:^|\n)\s*(?:export\s+)?BABYSITTER_SESSION_ID="([^"]+)"/);
|
|
226
212
|
return match?.[1] || undefined;
|
|
227
213
|
}
|
|
228
214
|
catch {
|
|
@@ -270,10 +256,9 @@ async function handleSessionEndHookImpl(args) {
|
|
|
270
256
|
}
|
|
271
257
|
const hookInput = parseHookInput(rawInput);
|
|
272
258
|
log.info("Hook input received");
|
|
273
|
-
// 2. Resolve session ID from hook input (stdin JSON) or env var
|
|
274
|
-
// Note: official docs do not confirm env var injection, but we check as fallback
|
|
259
|
+
// 2. Resolve session ID from hook input (stdin JSON) or cross-harness env var
|
|
275
260
|
const sessionId = safeStr(hookInput, "session_id") ||
|
|
276
|
-
process.env.
|
|
261
|
+
process.env.BABYSITTER_SESSION_ID ||
|
|
277
262
|
"";
|
|
278
263
|
if (!sessionId) {
|
|
279
264
|
log.info("No session ID in hook input — allowing exit");
|
|
@@ -287,23 +272,14 @@ async function handleSessionEndHookImpl(args) {
|
|
|
287
272
|
const runsDir = args.runsDir || ".a5c/runs";
|
|
288
273
|
log.info(`Resolved stateDir: ${stateDir}`);
|
|
289
274
|
// 4. Read session state file
|
|
290
|
-
|
|
275
|
+
const filePath = (0, session_1.getSessionFilePath)(stateDir, sessionId);
|
|
291
276
|
log.info(`Checking session file at: ${filePath}`);
|
|
292
277
|
let sessionFile;
|
|
293
278
|
try {
|
|
294
279
|
if (!(await (0, session_1.sessionFileExists)(filePath))) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
if (await (0, session_1.sessionFileExists)(fallbackPath)) {
|
|
299
|
-
filePath = fallbackPath;
|
|
300
|
-
log.info(`Found session file at fallback path: ${filePath}`);
|
|
301
|
-
}
|
|
302
|
-
else {
|
|
303
|
-
log.info(`No active babysitter loop for session ${sessionId} — allowing exit`);
|
|
304
|
-
process.stdout.write("{}\n");
|
|
305
|
-
return 0;
|
|
306
|
-
}
|
|
280
|
+
log.info(`No active babysitter loop for session ${sessionId} — allowing exit`);
|
|
281
|
+
process.stdout.write("{}\n");
|
|
282
|
+
return 0;
|
|
307
283
|
}
|
|
308
284
|
sessionFile = await (0, session_1.readSessionFile)(filePath);
|
|
309
285
|
}
|
|
@@ -374,7 +350,7 @@ async function handleSessionStartHookImpl(args) {
|
|
|
374
350
|
const hookInput = parseHookInput(rawInput);
|
|
375
351
|
// 2. Resolve session ID
|
|
376
352
|
const sessionId = safeStr(hookInput, "session_id") ||
|
|
377
|
-
process.env.
|
|
353
|
+
process.env.BABYSITTER_SESSION_ID ||
|
|
378
354
|
"";
|
|
379
355
|
if (!sessionId) {
|
|
380
356
|
log.info("No session ID in hook input — skipping state file creation");
|
|
@@ -383,11 +359,11 @@ async function handleSessionStartHookImpl(args) {
|
|
|
383
359
|
}
|
|
384
360
|
log.setContext("session", sessionId);
|
|
385
361
|
log.info(`Session ID: ${sessionId}`);
|
|
386
|
-
// 3.
|
|
362
|
+
// 3. Persist BABYSITTER_SESSION_ID to env file (COPILOT_ENV_FILE or CLAUDE_ENV_FILE)
|
|
387
363
|
const envFile = process.env.COPILOT_ENV_FILE || process.env.CLAUDE_ENV_FILE;
|
|
388
364
|
if (envFile) {
|
|
389
365
|
try {
|
|
390
|
-
(0, node_fs_1.appendFileSync)(envFile, `export
|
|
366
|
+
(0, node_fs_1.appendFileSync)(envFile, `export BABYSITTER_SESSION_ID="${sessionId}"\n`);
|
|
391
367
|
}
|
|
392
368
|
catch {
|
|
393
369
|
if (verbose) {
|
|
@@ -555,7 +531,8 @@ function createGithubCopilotAdapter() {
|
|
|
555
531
|
// are injected into hook scripts. However, COPILOT_HOME or
|
|
556
532
|
// COPILOT_GITHUB_TOKEN may be present when running inside a Copilot
|
|
557
533
|
// CLI session. This distinguishes from Claude Code which uses CLAUDE_* vars.
|
|
558
|
-
return !!(process.env.
|
|
534
|
+
return !!(process.env.BABYSITTER_SESSION_ID ||
|
|
535
|
+
process.env.COPILOT_HOME ||
|
|
559
536
|
process.env.COPILOT_GITHUB_TOKEN);
|
|
560
537
|
},
|
|
561
538
|
autoResolvesSessionId() {
|
package/dist/harness/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { createCursorAdapter } from "./cursor";
|
|
|
7
7
|
export { createGithubCopilotAdapter } from "./githubCopilot";
|
|
8
8
|
export { createPiAdapter } from "./pi";
|
|
9
9
|
export { createOhMyPiAdapter } from "./ohMyPi";
|
|
10
|
+
export { createOpenCodeAdapter } from "./opencode";
|
|
10
11
|
export { createInternalAdapter } from "./internal";
|
|
11
12
|
export { createPiSession, PiSessionHandle, type PiEventListener } from "./piWrapper";
|
|
12
13
|
export { createNullAdapter } from "./nullAdapter";
|
|
@@ -1 +1 @@
|
|
|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Ae,EAAE,MAAM,aAAa,CAAC;AAEzG,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE7E,OAAO,EACL,4BAA4B,EAC5B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC"}
|
package/dist/harness/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AGENTIC_TOOL_NAMES = exports.createAgenticToolDefinitions = exports.HARNESS_CLI_MAP = exports.buildHarnessArgs = exports.invokeHarness = exports.KNOWN_HARNESSES = exports.checkCliAvailable = exports.detectCallerHarness = exports.discoverHarnesses = exports.resetAdapter = exports.setAdapter = exports.getAdapter = exports.listSupportedHarnesses = exports.getAdapterByName = exports.detectAdapter = exports.createCustomAdapter = exports.createNullAdapter = exports.PiSessionHandle = exports.createPiSession = exports.createInternalAdapter = exports.createOhMyPiAdapter = exports.createPiAdapter = exports.createGithubCopilotAdapter = exports.createCursorAdapter = exports.createGeminiCliAdapter = exports.createCodexAdapter = exports.createClaudeCodeAdapter = exports.HarnessCapability = void 0;
|
|
3
|
+
exports.AGENTIC_TOOL_NAMES = exports.createAgenticToolDefinitions = exports.HARNESS_CLI_MAP = exports.buildHarnessArgs = exports.invokeHarness = exports.KNOWN_HARNESSES = exports.checkCliAvailable = exports.detectCallerHarness = exports.discoverHarnesses = exports.resetAdapter = exports.setAdapter = exports.getAdapter = exports.listSupportedHarnesses = exports.getAdapterByName = exports.detectAdapter = exports.createCustomAdapter = exports.createNullAdapter = exports.PiSessionHandle = exports.createPiSession = exports.createInternalAdapter = exports.createOpenCodeAdapter = exports.createOhMyPiAdapter = exports.createPiAdapter = exports.createGithubCopilotAdapter = exports.createCursorAdapter = exports.createGeminiCliAdapter = exports.createCodexAdapter = exports.createClaudeCodeAdapter = exports.HarnessCapability = void 0;
|
|
4
4
|
var types_1 = require("./types");
|
|
5
5
|
Object.defineProperty(exports, "HarnessCapability", { enumerable: true, get: function () { return types_1.HarnessCapability; } });
|
|
6
6
|
var claudeCode_1 = require("./claudeCode");
|
|
@@ -17,6 +17,8 @@ var pi_1 = require("./pi");
|
|
|
17
17
|
Object.defineProperty(exports, "createPiAdapter", { enumerable: true, get: function () { return pi_1.createPiAdapter; } });
|
|
18
18
|
var ohMyPi_1 = require("./ohMyPi");
|
|
19
19
|
Object.defineProperty(exports, "createOhMyPiAdapter", { enumerable: true, get: function () { return ohMyPi_1.createOhMyPiAdapter; } });
|
|
20
|
+
var opencode_1 = require("./opencode");
|
|
21
|
+
Object.defineProperty(exports, "createOpenCodeAdapter", { enumerable: true, get: function () { return opencode_1.createOpenCodeAdapter; } });
|
|
20
22
|
var internal_1 = require("./internal");
|
|
21
23
|
Object.defineProperty(exports, "createInternalAdapter", { enumerable: true, get: function () { return internal_1.createInternalAdapter; } });
|
|
22
24
|
var piWrapper_1 = require("./piWrapper");
|
|
@@ -8,6 +8,7 @@ export declare function execFilePromise(command: string, args: string[], options
|
|
|
8
8
|
exitCode: number;
|
|
9
9
|
}>;
|
|
10
10
|
export declare function renderCommand(command: string, args: string[]): string;
|
|
11
|
+
export declare function getNpmCommand(): string;
|
|
11
12
|
export declare function getNpxCommand(): string;
|
|
12
13
|
export declare function runPackageBinaryViaNpx(args: {
|
|
13
14
|
harness: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installSupport.d.ts","sourceRoot":"","sources":["../../src/harness/installSupport.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CA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BAAgB,YAAY,IAAI,MAAM,CAErC;AAED,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAED,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAED,wBAAgB,6BAA6B,IAAI,MAAM,CAEtD;AAED,wBAAgB,uBAAuB,IAAI,OAAO,CAajD;AAED,wBAAgB,qBAAqB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAGhE;AAED,wBAAgB,uBAAuB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAEnE"}
|
|
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.execFilePromise = execFilePromise;
|
|
37
37
|
exports.renderCommand = renderCommand;
|
|
38
|
+
exports.getNpmCommand = getNpmCommand;
|
|
38
39
|
exports.getNpxCommand = getNpxCommand;
|
|
39
40
|
exports.runPackageBinaryViaNpx = runPackageBinaryViaNpx;
|
|
40
41
|
exports.installCliViaNpm = installCliViaNpm;
|
|
@@ -71,6 +72,9 @@ async function execFilePromise(command, args, options = {}) {
|
|
|
71
72
|
function renderCommand(command, args) {
|
|
72
73
|
return [command, ...args].join(" ");
|
|
73
74
|
}
|
|
75
|
+
function getNpmCommand() {
|
|
76
|
+
return process.platform === "win32" ? "npm.cmd" : "npm";
|
|
77
|
+
}
|
|
74
78
|
function getNpxCommand() {
|
|
75
79
|
return process.platform === "win32" ? "npx.cmd" : "npx";
|
|
76
80
|
}
|
|
@@ -118,14 +122,14 @@ async function installCliViaNpm(args) {
|
|
|
118
122
|
location: cliInfo.path,
|
|
119
123
|
};
|
|
120
124
|
}
|
|
121
|
-
const command =
|
|
125
|
+
const command = getNpmCommand();
|
|
122
126
|
const commandArgs = ["install", "-g", args.packageName];
|
|
123
127
|
if (args.options.dryRun) {
|
|
124
128
|
return {
|
|
125
129
|
harness: args.harness,
|
|
126
130
|
dryRun: true,
|
|
127
131
|
summary: args.summary,
|
|
128
|
-
command: renderCommand(
|
|
132
|
+
command: renderCommand("npm", commandArgs),
|
|
129
133
|
};
|
|
130
134
|
}
|
|
131
135
|
const result = await execFilePromise(command, commandArgs);
|
|
@@ -173,7 +177,7 @@ function isClaudePluginInstalled() {
|
|
|
173
177
|
}
|
|
174
178
|
function getGeminiExtensionDir(workspace) {
|
|
175
179
|
const base = path.resolve(workspace ?? os.homedir());
|
|
176
|
-
return path.join(base, ".gemini", "extensions", "babysitter
|
|
180
|
+
return path.join(base, ".gemini", "extensions", "babysitter");
|
|
177
181
|
}
|
|
178
182
|
function isGeminiPluginInstalled(workspace) {
|
|
179
183
|
return (0, node_fs_1.existsSync)(getGeminiExtensionDir(workspace));
|
package/dist/harness/invoker.js
CHANGED
|
@@ -67,7 +67,7 @@ exports.HARNESS_CLI_MAP = {
|
|
|
67
67
|
"gemini-cli": { cli: "gemini", supportsModel: true, promptStyle: "flag" },
|
|
68
68
|
"github-copilot": { cli: "copilot", supportsModel: true, promptStyle: "flag" },
|
|
69
69
|
cursor: { cli: "cursor", supportsModel: true, promptStyle: "positional", baseArgs: ["agent"], workspaceFlag: "--workspace" },
|
|
70
|
-
opencode: { cli: "opencode", supportsModel:
|
|
70
|
+
opencode: { cli: "opencode", supportsModel: true, promptStyle: "positional", baseArgs: ["run"] },
|
|
71
71
|
};
|
|
72
72
|
const PROGRAMMATIC_ONLY_HARNESSES = ["internal"];
|
|
73
73
|
const SUPPORTED_HARNESS_NAMES = [
|
package/dist/harness/ohMyPi.d.ts
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Oh-My-Pi harness adapter.
|
|
3
|
-
*
|
|
4
|
-
* Oh-my-pi (omp) is a fork of pi that shares the same environment variables,
|
|
5
|
-
* session conventions, and hook mechanisms. This adapter wraps the pi adapter
|
|
6
|
-
* with a different name so the registry can distinguish between the two when
|
|
7
|
-
* both are installed.
|
|
8
|
-
*/
|
|
9
1
|
import type { HarnessAdapter } from "./types";
|
|
10
|
-
/**
|
|
11
|
-
* Create an adapter for oh-my-pi.
|
|
12
|
-
*
|
|
13
|
-
* Reuses the pi adapter's implementation entirely — same env vars, same
|
|
14
|
-
* session binding, same hook handling — but reports `name: "oh-my-pi"`.
|
|
15
|
-
*/
|
|
16
2
|
export declare function createOhMyPiAdapter(): HarnessAdapter;
|
|
17
3
|
//# sourceMappingURL=ohMyPi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ohMyPi.d.ts","sourceRoot":"","sources":["../../src/harness/ohMyPi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ohMyPi.d.ts","sourceRoot":"","sources":["../../src/harness/ohMyPi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EAOf,MAAM,SAAS,CAAC;AAmHjB,wBAAgB,mBAAmB,IAAI,cAAc,CAmFpD"}
|