@a5c-ai/babysitter-sdk 0.0.180 → 0.0.181-staging.0b1ba012

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.
@@ -2,6 +2,7 @@ export type { HarnessAdapter, SessionBindOptions, SessionBindResult, HookHandler
2
2
  export { createClaudeCodeAdapter } from "./claudeCode";
3
3
  export { createCodexAdapter } from "./codex";
4
4
  export { createGeminiCliAdapter } from "./geminiCli";
5
+ export { createPiAdapter } from "./pi";
5
6
  export { createNullAdapter } from "./nullAdapter";
6
7
  export { detectAdapter, getAdapterByName, listSupportedHarnesses, getAdapter, setAdapter, resetAdapter, } from "./registry";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/harness/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,GAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,UAAU,EACV,UAAU,EACV,YAAY,GACb,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/harness/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,GAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,UAAU,EACV,UAAU,EACV,YAAY,GACb,MAAM,YAAY,CAAC"}
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resetAdapter = exports.setAdapter = exports.getAdapter = exports.listSupportedHarnesses = exports.getAdapterByName = exports.detectAdapter = exports.createNullAdapter = exports.createGeminiCliAdapter = exports.createCodexAdapter = exports.createClaudeCodeAdapter = void 0;
3
+ exports.resetAdapter = exports.setAdapter = exports.getAdapter = exports.listSupportedHarnesses = exports.getAdapterByName = exports.detectAdapter = exports.createNullAdapter = exports.createPiAdapter = exports.createGeminiCliAdapter = exports.createCodexAdapter = exports.createClaudeCodeAdapter = void 0;
4
4
  var claudeCode_1 = require("./claudeCode");
5
5
  Object.defineProperty(exports, "createClaudeCodeAdapter", { enumerable: true, get: function () { return claudeCode_1.createClaudeCodeAdapter; } });
6
6
  var codex_1 = require("./codex");
7
7
  Object.defineProperty(exports, "createCodexAdapter", { enumerable: true, get: function () { return codex_1.createCodexAdapter; } });
8
8
  var geminiCli_1 = require("./geminiCli");
9
9
  Object.defineProperty(exports, "createGeminiCliAdapter", { enumerable: true, get: function () { return geminiCli_1.createGeminiCliAdapter; } });
10
+ var pi_1 = require("./pi");
11
+ Object.defineProperty(exports, "createPiAdapter", { enumerable: true, get: function () { return pi_1.createPiAdapter; } });
10
12
  var nullAdapter_1 = require("./nullAdapter");
11
13
  Object.defineProperty(exports, "createNullAdapter", { enumerable: true, get: function () { return nullAdapter_1.createNullAdapter; } });
12
14
  var registry_1 = require("./registry");
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Oh-My-Pi harness adapter.
3
+ *
4
+ * Extends the SDK harness layer with "pi" support while reusing the
5
+ * mature Claude stop/session-start hook handlers. The Pi adapter maps
6
+ * Oh-My-Pi-specific environment conventions to the generic adapter interface.
7
+ */
8
+ import type { HarnessAdapter } from "./types";
9
+ export declare function createPiAdapter(): HarnessAdapter;
10
+ //# sourceMappingURL=pi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../src/harness/pi.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,SAAS,CAAC;AAmCjB,wBAAgB,eAAe,IAAI,cAAc,CAiFhD"}
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ /**
3
+ * Oh-My-Pi harness adapter.
4
+ *
5
+ * Extends the SDK harness layer with "pi" support while reusing the
6
+ * mature Claude stop/session-start hook handlers. The Pi adapter maps
7
+ * Oh-My-Pi-specific environment conventions to the generic adapter interface.
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || (function () {
26
+ var ownKeys = function(o) {
27
+ ownKeys = Object.getOwnPropertyNames || function (o) {
28
+ var ar = [];
29
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
+ return ar;
31
+ };
32
+ return ownKeys(o);
33
+ };
34
+ return function (mod) {
35
+ if (mod && mod.__esModule) return mod;
36
+ var result = {};
37
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
+ __setModuleDefault(result, mod);
39
+ return result;
40
+ };
41
+ })();
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ exports.createPiAdapter = createPiAdapter;
44
+ const path = __importStar(require("node:path"));
45
+ const node_fs_1 = require("node:fs");
46
+ const claudeCode_1 = require("./claudeCode");
47
+ function resolvePiPluginRoot(args = {}) {
48
+ const root = args.pluginRoot || process.env.OMP_PLUGIN_ROOT || process.env.PI_PLUGIN_ROOT;
49
+ return root ? path.resolve(root) : undefined;
50
+ }
51
+ function resolvePiStateDir(args) {
52
+ if (args.stateDir)
53
+ return path.resolve(args.stateDir);
54
+ if (process.env.BABYSITTER_STATE_DIR) {
55
+ return path.resolve(process.env.BABYSITTER_STATE_DIR);
56
+ }
57
+ const pluginRoot = resolvePiPluginRoot(args);
58
+ if (pluginRoot) {
59
+ // Oh-My-Pi plugins conventionally live under ".omp", while state is in ".a5c".
60
+ return path.resolve(pluginRoot, "..", ".a5c");
61
+ }
62
+ return path.resolve(".a5c");
63
+ }
64
+ function resolvePiSessionId(parsed) {
65
+ if (parsed.sessionId)
66
+ return parsed.sessionId;
67
+ if (process.env.OMP_SESSION_ID)
68
+ return process.env.OMP_SESSION_ID;
69
+ if (process.env.PI_SESSION_ID)
70
+ return process.env.PI_SESSION_ID;
71
+ return undefined;
72
+ }
73
+ function createPiAdapter() {
74
+ const claude = (0, claudeCode_1.createClaudeCodeAdapter)();
75
+ return {
76
+ name: "pi",
77
+ isActive() {
78
+ return !!(process.env.OMP_SESSION_ID ||
79
+ process.env.PI_SESSION_ID ||
80
+ process.env.OMP_PLUGIN_ROOT ||
81
+ process.env.PI_PLUGIN_ROOT);
82
+ },
83
+ resolveSessionId(parsed) {
84
+ return resolvePiSessionId(parsed);
85
+ },
86
+ resolveStateDir(args) {
87
+ return resolvePiStateDir(args);
88
+ },
89
+ resolvePluginRoot(args) {
90
+ return resolvePiPluginRoot(args);
91
+ },
92
+ async bindSession(opts) {
93
+ const stateDir = resolvePiStateDir({
94
+ stateDir: opts.stateDir,
95
+ pluginRoot: opts.pluginRoot,
96
+ });
97
+ const result = await claude.bindSession({
98
+ ...opts,
99
+ stateDir,
100
+ });
101
+ return { ...result, harness: "pi" };
102
+ },
103
+ handleStopHook(args) {
104
+ const pluginRoot = resolvePiPluginRoot(args);
105
+ const stateDir = resolvePiStateDir({
106
+ stateDir: args.stateDir,
107
+ pluginRoot,
108
+ });
109
+ return claude.handleStopHook({
110
+ ...args,
111
+ pluginRoot,
112
+ stateDir,
113
+ });
114
+ },
115
+ handleSessionStartHook(args) {
116
+ const pluginRoot = resolvePiPluginRoot(args);
117
+ const stateDir = resolvePiStateDir({
118
+ stateDir: args.stateDir,
119
+ pluginRoot,
120
+ });
121
+ return claude.handleSessionStartHook({
122
+ ...args,
123
+ pluginRoot,
124
+ stateDir,
125
+ });
126
+ },
127
+ findHookDispatcherPath(startCwd) {
128
+ const pluginRoot = resolvePiPluginRoot();
129
+ if (pluginRoot) {
130
+ const candidate = path.join(pluginRoot, "hooks", "hook-dispatcher.sh");
131
+ if ((0, node_fs_1.existsSync)(candidate))
132
+ return candidate;
133
+ }
134
+ const local = path.join(path.resolve(startCwd), ".omp", "hooks", "hook-dispatcher.sh");
135
+ if ((0, node_fs_1.existsSync)(local))
136
+ return local;
137
+ return null;
138
+ },
139
+ };
140
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/harness/registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAoB9C;;;GAGG;AACH,wBAAgB,aAAa,IAAI,cAAc,CAK9C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAKpE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAEjD;AAQD;;GAEG;AACH,wBAAgB,UAAU,IAAI,cAAc,CAK3C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAExD;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAEnC"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/harness/registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAsB9C;;;GAGG;AACH,wBAAgB,aAAa,IAAI,cAAc,CAK9C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAKpE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAEjD;AAQD;;GAEG;AACH,wBAAgB,UAAU,IAAI,cAAc,CAK3C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAExD;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAEnC"}
@@ -16,12 +16,14 @@ exports.resetAdapter = resetAdapter;
16
16
  const claudeCode_1 = require("./claudeCode");
17
17
  const codex_1 = require("./codex");
18
18
  const geminiCli_1 = require("./geminiCli");
19
+ const pi_1 = require("./pi");
19
20
  const nullAdapter_1 = require("./nullAdapter");
20
21
  // ---------------------------------------------------------------------------
21
22
  // Registry of known adapters (ordered by priority)
22
23
  // ---------------------------------------------------------------------------
23
24
  const knownAdapters = [
24
25
  (0, codex_1.createCodexAdapter)(),
26
+ (0, pi_1.createPiAdapter)(),
25
27
  (0, claudeCode_1.createClaudeCodeAdapter)(),
26
28
  (0, geminiCli_1.createGeminiCliAdapter)(),
27
29
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a5c-ai/babysitter-sdk",
3
- "version": "0.0.180",
3
+ "version": "0.0.181-staging.0b1ba012",
4
4
  "description": "Storage and run-registry primitives for event-sourced babysitter workflows.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "commonjs",