@a5c-ai/babysitter-sdk 5.0.1-staging.7e55da10 → 5.0.1-staging.88ee6beee

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/cli/commands/hooks/log.d.ts.map +1 -1
  2. package/dist/cli/commands/hooks/log.js +4 -1
  3. package/dist/cli/commands/skill/remoteDiscovery.js +1 -1
  4. package/dist/harness/amuxFallbackMetadata.d.ts.map +1 -1
  5. package/dist/harness/amuxFallbackMetadata.js +2 -1
  6. package/dist/harness/hooks/promptContexts.d.ts +6 -1
  7. package/dist/harness/hooks/promptContexts.d.ts.map +1 -1
  8. package/dist/harness/hooks/promptContexts.js +65 -142
  9. package/dist/harness/registry.d.ts.map +1 -1
  10. package/dist/harness/registry.js +64 -68
  11. package/dist/hooks/dispatcher.d.ts +2 -2
  12. package/dist/hooks/dispatcher.d.ts.map +1 -1
  13. package/dist/hooks/dispatcher.js +56 -15
  14. package/dist/logging/runLogger.d.ts.map +1 -1
  15. package/dist/logging/runLogger.js +2 -0
  16. package/dist/prompts/capabilityCollector.d.ts.map +1 -1
  17. package/dist/prompts/capabilityCollector.js +23 -14
  18. package/dist/prompts/compose.d.ts.map +1 -1
  19. package/dist/prompts/compose.js +13 -2
  20. package/dist/prompts/parts/criticalRules.d.ts.map +1 -1
  21. package/dist/prompts/parts/criticalRules.js +14 -1
  22. package/dist/prompts/parts/runCreation.d.ts.map +1 -1
  23. package/dist/prompts/parts/runCreation.js +23 -3
  24. package/dist/prompts/parts/taskKinds.d.ts.map +1 -1
  25. package/dist/prompts/parts/taskKinds.js +11 -3
  26. package/dist/prompts/templates/commands/assimilate.md +1 -1
  27. package/dist/prompts/templates/commands/cleanup.md +31 -9
  28. package/dist/prompts/templates/commands/contrib.md +1 -1
  29. package/dist/prompts/templates/commands/doctor.md +3 -4
  30. package/dist/prompts/templates/commands/forever.md +1 -1
  31. package/dist/prompts/templates/commands/project-install.md +1 -1
  32. package/dist/prompts/templates/commands/retrospect.md +1 -1
  33. package/dist/prompts/templates/commands/user-install.md +1 -1
  34. package/dist/runtime/replay/stateCache.d.ts +2 -0
  35. package/dist/runtime/replay/stateCache.d.ts.map +1 -1
  36. package/dist/runtime/replay/stateCache.js +14 -3
  37. package/dist/sdkVersion.d.ts +5 -0
  38. package/dist/sdkVersion.d.ts.map +1 -0
  39. package/dist/sdkVersion.js +49 -0
  40. package/dist/storage/createRunDir.d.ts.map +1 -1
  41. package/dist/storage/createRunDir.js +2 -1
  42. package/dist/storage/journal.d.ts.map +1 -1
  43. package/dist/storage/journal.js +4 -2
  44. package/dist/storage/tasks.d.ts.map +1 -1
  45. package/dist/storage/tasks.js +3 -2
  46. package/dist/storage/types.d.ts +3 -0
  47. package/dist/storage/types.d.ts.map +1 -1
  48. package/dist/tasks/defineTask.d.ts +28 -0
  49. package/dist/tasks/defineTask.d.ts.map +1 -1
  50. package/dist/tasks/defineTask.js +42 -1
  51. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/hooks/log.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;CACf;AA4LD,wBAAsB,aAAa,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwG7E"}
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/hooks/log.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;CACf;AA8LD,wBAAsB,aAAa,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwG7E"}
@@ -45,6 +45,7 @@ exports.handleHookLog = handleHookLog;
45
45
  const node_fs_1 = require("node:fs");
46
46
  const path = __importStar(require("node:path"));
47
47
  const resolveInputPath_1 = require("../../resolveInputPath");
48
+ const sdkVersion_1 = require("../../../sdkVersion");
48
49
  // ---------------------------------------------------------------------------
49
50
  // Event label mapping (matches the label used in the original logger.sh)
50
51
  // ---------------------------------------------------------------------------
@@ -174,7 +175,9 @@ const FIELD_EXTRACTORS = {
174
175
  // ---------------------------------------------------------------------------
175
176
  function formatLogLine(hookType, eventLabel, fields) {
176
177
  const timestamp = new Date().toISOString();
177
- const kvPairs = fields.map(([k, v]) => `${k}=${v}`).join(" ");
178
+ const kvPairs = [...fields, ["sdkVersion", sdkVersion_1.BABYSITTER_SDK_VERSION]]
179
+ .map(([k, v]) => `${k}=${v}`)
180
+ .join(" ");
178
181
  return `[${timestamp}] [${eventLabel}] hook=${hookType} ${kvPairs}`;
179
182
  }
180
183
  // ---------------------------------------------------------------------------
@@ -128,7 +128,7 @@ async function discoverWellKnown(url) {
128
128
  async function fetchRemoteSkillSources(_pluginRoot) {
129
129
  const remoteSkills = [];
130
130
  const sources = [
131
- { type: 'github', url: 'https://github.com/MaTriXy/babysitter/tree/main/plugins/babysitter/skills' },
131
+ { type: 'github', url: 'https://github.com/a5c-ai/babysitter/tree/main/plugins/babysitter-unified/skills' },
132
132
  ];
133
133
  try {
134
134
  const content = await node_fs_1.promises.readFile('.a5c/skill-sources.json', 'utf8');
@@ -1 +1 @@
1
- {"version":3,"file":"amuxFallbackMetadata.d.ts","sourceRoot":"","sources":["../../src/harness/amuxFallbackMetadata.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAkM1D,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAiC,CAAC"}
1
+ {"version":3,"file":"amuxFallbackMetadata.d.ts","sourceRoot":"","sources":["../../src/harness/amuxFallbackMetadata.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAmM1D,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAiC,CAAC"}
@@ -176,7 +176,7 @@ const LOCAL_FALLBACK_METADATA = {
176
176
  };
177
177
  function buildStaticFallbackMetadata() {
178
178
  try {
179
- return Object.fromEntries(Object.values((0, agent_catalog_1.listFallbackHarnessMetadata)()).map((metadata) => [
179
+ const catalogMetadata = Object.fromEntries(Object.values((0, agent_catalog_1.listFallbackHarnessMetadata)()).map((metadata) => [
180
180
  metadata.adapterName,
181
181
  {
182
182
  name: metadata.adapterName,
@@ -185,6 +185,7 @@ function buildStaticFallbackMetadata() {
185
185
  sessionDir: resolveFallbackSessionDir(metadata.sessionDir),
186
186
  },
187
187
  ]));
188
+ return Object.keys(catalogMetadata).length > 0 ? catalogMetadata : LOCAL_FALLBACK_METADATA;
188
189
  }
189
190
  catch {
190
191
  return LOCAL_FALLBACK_METADATA;
@@ -4,9 +4,14 @@
4
4
  * @deprecated Adapters now derive their config from @a5c-ai/agent-mux metadata
5
5
  * via amuxMetadata.ts and derivePromptContext.ts. These factory functions are
6
6
  * retained for backward compatibility with prompts/context.ts re-exports.
7
- * New code should use createPromptContext() directly.
7
+ * New code should use createPromptContextForHarness() directly.
8
8
  */
9
9
  import type { PromptContext } from "../../prompts/types";
10
+ /**
11
+ * Build a PromptContext from catalog data for a given harness.
12
+ * Falls back to a minimal context when the catalog target is not found.
13
+ */
14
+ export declare function createPromptContextFromCatalog(harness: string, overrides?: Partial<PromptContext>): PromptContext;
10
15
  export declare function createCodexContext(overrides?: Partial<PromptContext>): PromptContext;
11
16
  export declare function createCursorContext(overrides?: Partial<PromptContext>): PromptContext;
12
17
  export declare function createGeminiCliContext(overrides?: Partial<PromptContext>): PromptContext;
@@ -1 +1 @@
1
- {"version":3,"file":"promptContexts.d.ts","sourceRoot":"","sources":["../../../src/harness/hooks/promptContexts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOzD,wBAAgB,kBAAkB,CAChC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAkBf;AAED,wBAAgB,mBAAmB,CACjC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAiBf;AAED,wBAAgB,sBAAsB,CACpC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAiBf;AAED,wBAAgB,0BAA0B,CACxC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAiBf;AAED,wBAAgB,mBAAmB,CACjC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAiBf;AAED,wBAAgB,qBAAqB,CACnC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAiBf;AAED,wBAAgB,qBAAqB,CACnC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAiBf;AAED,wBAAgB,eAAe,CAC7B,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAiBf;AAED,wBAAgB,uBAAuB,CACrC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAkBf"}
1
+ {"version":3,"file":"promptContexts.d.ts","sourceRoot":"","sources":["../../../src/harness/hooks/promptContexts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAuBzD;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAsCf;AAED,wBAAgB,kBAAkB,CAChC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAEf;AAED,wBAAgB,mBAAmB,CACjC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAEf;AAED,wBAAgB,sBAAsB,CACpC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAEf;AAED,wBAAgB,0BAA0B,CACxC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAEf;AAED,wBAAgB,mBAAmB,CACjC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAEf;AAED,wBAAgB,qBAAqB,CACnC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAEf;AAED,wBAAgB,qBAAqB,CACnC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAEf;AAED,wBAAgB,eAAe,CAC7B,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAEf;AAED,wBAAgB,uBAAuB,CACrC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,CAEf"}
@@ -5,9 +5,10 @@
5
5
  * @deprecated Adapters now derive their config from @a5c-ai/agent-mux metadata
6
6
  * via amuxMetadata.ts and derivePromptContext.ts. These factory functions are
7
7
  * retained for backward compatibility with prompts/context.ts re-exports.
8
- * New code should use createPromptContext() directly.
8
+ * New code should use createPromptContextForHarness() directly.
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.createPromptContextFromCatalog = createPromptContextFromCatalog;
11
12
  exports.createCodexContext = createCodexContext;
12
13
  exports.createCursorContext = createCursorContext;
13
14
  exports.createGeminiCliContext = createGeminiCliContext;
@@ -18,166 +19,88 @@ exports.createOpenCodeContext = createOpenCodeContext;
18
19
  exports.createPiContext = createPiContext;
19
20
  exports.createClaudeCodeContext = createClaudeCodeContext;
20
21
  const contextShared_1 = require("../../prompts/contextShared");
21
- function createCodexContext(overrides) {
22
+ const agent_catalog_1 = require("@a5c-ai/agent-catalog");
23
+ function getTargetDescriptors() {
24
+ return (0, agent_catalog_1.listPluginTargetDescriptors)();
25
+ }
26
+ function resolveCliSetupSnippet(target) {
27
+ if (target.cliSetupMode === 'claude-code')
28
+ return (0, contextShared_1.createClaudeCodeCliSetupSnippet)();
29
+ return (0, contextShared_1.createDefaultCliSetupSnippet)();
30
+ }
31
+ function resolvePluginRootVar(target) {
32
+ if (target.pluginRootEnvVar)
33
+ return `\${${target.pluginRootEnvVar}}`;
34
+ if (target.pluginRootEnvVarForExtension)
35
+ return `\${${target.pluginRootEnvVarForExtension}}`;
36
+ return '';
37
+ }
38
+ /**
39
+ * Build a PromptContext from catalog data for a given harness.
40
+ * Falls back to a minimal context when the catalog target is not found.
41
+ */
42
+ function createPromptContextFromCatalog(harness, overrides) {
43
+ const target = getTargetDescriptors().find(t => t.targetId === harness);
44
+ if (!target) {
45
+ return (0, contextShared_1.createPromptContext)({
46
+ harness,
47
+ harnessLabel: harness,
48
+ capabilities: [],
49
+ pluginRootVar: '',
50
+ loopControlTerm: 'in-turn',
51
+ sessionBindingFlags: '',
52
+ hookDriven: false,
53
+ interactiveToolName: '',
54
+ sessionEnvVars: '',
55
+ resumeFlags: '',
56
+ cliSetupSnippet: (0, contextShared_1.createDefaultCliSetupSnippet)(),
57
+ iterateFlags: '',
58
+ hasIntentFidelityChecks: false,
59
+ hasNonNegotiables: false,
60
+ }, overrides);
61
+ }
22
62
  return (0, contextShared_1.createPromptContext)({
23
- harness: 'codex',
24
- harnessLabel: 'Codex',
25
- capabilities: ['hooks', 'stop-hook', 'ask-user-question', 'task-tool', 'breakpoint-routing'],
26
- pluginRootVar: '${CODEX_PLUGIN_ROOT}',
27
- loopControlTerm: 'stop-hook',
63
+ harness: target.targetId,
64
+ harnessLabel: target.displayName,
65
+ capabilities: target.promptCapabilities ?? [],
66
+ pluginRootVar: resolvePluginRootVar(target),
67
+ loopControlTerm: target.loopControlTerm ?? 'in-turn',
28
68
  sessionBindingFlags: '',
29
- hookDriven: true,
30
- interactiveToolName: 'AskUserQuestion tool',
31
- sessionEnvVars: 'PID-scoped session marker (authoritative); CODEX_THREAD_ID/CODEX_SESSION_ID and AGENT_SESSION_ID are fallbacks',
69
+ hookDriven: target.hookDriven ?? false,
70
+ interactiveToolName: target.interactiveToolName ?? '',
71
+ sessionEnvVars: target.sessionEnvVarsDescription ?? '',
32
72
  resumeFlags: '',
33
- cliSetupSnippet: (0, contextShared_1.createDefaultCliSetupSnippet)(),
73
+ cliSetupSnippet: resolveCliSetupSnippet(target),
74
+ sdkVersionExpr: target.cliSetupMode === 'claude-code' ? '$SDK_VERSION' : '',
34
75
  iterateFlags: '',
35
- hasIntentFidelityChecks: true,
36
- hasNonNegotiables: true,
76
+ hasIntentFidelityChecks: target.hasIntentFidelityChecks ?? false,
77
+ hasNonNegotiables: target.hasNonNegotiables ?? false,
37
78
  }, overrides);
38
79
  }
80
+ function createCodexContext(overrides) {
81
+ return createPromptContextFromCatalog('codex', overrides);
82
+ }
39
83
  function createCursorContext(overrides) {
40
- return (0, contextShared_1.createPromptContext)({
41
- harness: 'cursor',
42
- harnessLabel: 'Cursor',
43
- capabilities: ['hooks', 'stop-hook', 'mcp', 'task-tool', 'breakpoint-routing'],
44
- pluginRootVar: '${CURSOR_PLUGIN_ROOT}',
45
- loopControlTerm: 'stop-hook',
46
- sessionBindingFlags: '',
47
- hookDriven: true,
48
- interactiveToolName: 'AskUserQuestion tool',
49
- sessionEnvVars: 'conversation_id from hook stdin (authoritative per-request); PID-scoped session marker; AGENT_SESSION_ID fallback',
50
- resumeFlags: '',
51
- cliSetupSnippet: (0, contextShared_1.createDefaultCliSetupSnippet)(),
52
- iterateFlags: '',
53
- hasIntentFidelityChecks: false,
54
- hasNonNegotiables: false,
55
- }, overrides);
84
+ return createPromptContextFromCatalog('cursor', overrides);
56
85
  }
57
86
  function createGeminiCliContext(overrides) {
58
- return (0, contextShared_1.createPromptContext)({
59
- harness: 'gemini-cli',
60
- harnessLabel: 'Gemini CLI',
61
- capabilities: ['hooks', 'stop-hook', 'task-tool', 'breakpoint-routing'],
62
- pluginRootVar: '${GEMINI_EXTENSION_PATH}',
63
- loopControlTerm: 'stop-hook',
64
- sessionBindingFlags: '',
65
- hookDriven: true,
66
- interactiveToolName: 'AskUserQuestion tool',
67
- sessionEnvVars: 'PID-scoped session marker (authoritative); GEMINI_SESSION_ID and AGENT_SESSION_ID are fallbacks',
68
- resumeFlags: '',
69
- cliSetupSnippet: (0, contextShared_1.createDefaultCliSetupSnippet)(),
70
- iterateFlags: '',
71
- hasIntentFidelityChecks: false,
72
- hasNonNegotiables: false,
73
- }, overrides);
87
+ return createPromptContextFromCatalog('gemini-cli', overrides);
74
88
  }
75
89
  function createGithubCopilotContext(overrides) {
76
- return (0, contextShared_1.createPromptContext)({
77
- harness: 'github-copilot',
78
- harnessLabel: 'GitHub Copilot CLI',
79
- capabilities: ['hooks', 'mcp', 'task-tool', 'breakpoint-routing'],
80
- pluginRootVar: '${COPILOT_PLUGIN_ROOT}',
81
- loopControlTerm: 'in-turn',
82
- sessionBindingFlags: '',
83
- hookDriven: false,
84
- interactiveToolName: 'AskUserQuestion tool',
85
- sessionEnvVars: 'PID-scoped session marker (authoritative); COPILOT_ENV_FILE / COPILOT_SESSION_ID and AGENT_SESSION_ID are fallbacks',
86
- resumeFlags: '',
87
- cliSetupSnippet: (0, contextShared_1.createDefaultCliSetupSnippet)(),
88
- iterateFlags: '',
89
- hasIntentFidelityChecks: false,
90
- hasNonNegotiables: false,
91
- }, overrides);
90
+ return createPromptContextFromCatalog('github-copilot', overrides);
92
91
  }
93
92
  function createOhMyPiContext(overrides) {
94
- return (0, contextShared_1.createPromptContext)({
95
- harness: 'oh-my-pi',
96
- harnessLabel: 'oh-my-pi',
97
- capabilities: ['skills', 'slash-commands', 'task-tool', 'harness-routing', 'programmatic-session', 'mcp'],
98
- pluginRootVar: '${OMP_PLUGIN_ROOT}',
99
- loopControlTerm: 'skill-driven',
100
- sessionBindingFlags: '',
101
- hookDriven: false,
102
- interactiveToolName: 'AskUserQuestion',
103
- sessionEnvVars: 'PID-scoped session marker (authoritative); OMP_SESSION_ID and AGENT_SESSION_ID are fallbacks',
104
- resumeFlags: '',
105
- cliSetupSnippet: (0, contextShared_1.createDefaultCliSetupSnippet)(),
106
- iterateFlags: '',
107
- hasIntentFidelityChecks: false,
108
- hasNonNegotiables: false,
109
- }, overrides);
93
+ return createPromptContextFromCatalog('oh-my-pi', overrides);
110
94
  }
111
95
  function createOpenClawContext(overrides) {
112
- return (0, contextShared_1.createPromptContext)({
113
- harness: 'openclaw',
114
- harnessLabel: 'OpenClaw',
115
- capabilities: ['session-binding', 'mcp', 'headless-prompt', 'task-tool', 'breakpoint-routing'],
116
- pluginRootVar: '',
117
- loopControlTerm: 'agent_end',
118
- sessionBindingFlags: '',
119
- hookDriven: false,
120
- interactiveToolName: 'AskUserQuestion tool',
121
- sessionEnvVars: 'PID-scoped session marker (authoritative); OPENCLAW_SHELL gateway injection and AGENT_SESSION_ID are fallbacks',
122
- resumeFlags: '',
123
- cliSetupSnippet: (0, contextShared_1.createDefaultCliSetupSnippet)(),
124
- iterateFlags: '',
125
- hasIntentFidelityChecks: false,
126
- hasNonNegotiables: false,
127
- }, overrides);
96
+ return createPromptContextFromCatalog('openclaw', overrides);
128
97
  }
129
98
  function createOpenCodeContext(overrides) {
130
- return (0, contextShared_1.createPromptContext)({
131
- harness: 'opencode',
132
- harnessLabel: 'OpenCode',
133
- capabilities: ['task-tool', 'breakpoint-routing'],
134
- pluginRootVar: '',
135
- loopControlTerm: 'in-turn',
136
- sessionBindingFlags: '',
137
- hookDriven: false,
138
- interactiveToolName: '',
139
- sessionEnvVars: 'PID-scoped session marker (authoritative); shell.env-injected session ID and AGENT_SESSION_ID are fallbacks',
140
- resumeFlags: '',
141
- cliSetupSnippet: (0, contextShared_1.createDefaultCliSetupSnippet)(),
142
- iterateFlags: '',
143
- hasIntentFidelityChecks: false,
144
- hasNonNegotiables: false,
145
- }, overrides);
99
+ return createPromptContextFromCatalog('opencode', overrides);
146
100
  }
147
101
  function createPiContext(overrides) {
148
- return (0, contextShared_1.createPromptContext)({
149
- harness: 'pi',
150
- harnessLabel: 'Pi Coding Agent',
151
- capabilities: ['skills', 'slash-commands', 'task-tool', 'harness-routing', 'programmatic-session'],
152
- pluginRootVar: '${PI_PLUGIN_ROOT}',
153
- loopControlTerm: 'skill-driven',
154
- sessionBindingFlags: '',
155
- hookDriven: false,
156
- interactiveToolName: 'AskUserQuestion',
157
- sessionEnvVars: 'PID-scoped session marker (authoritative); PI_SESSION_ID and AGENT_SESSION_ID are fallbacks',
158
- resumeFlags: '',
159
- cliSetupSnippet: (0, contextShared_1.createDefaultCliSetupSnippet)(),
160
- iterateFlags: '',
161
- hasIntentFidelityChecks: false,
162
- hasNonNegotiables: false,
163
- }, overrides);
102
+ return createPromptContextFromCatalog('pi', overrides);
164
103
  }
165
104
  function createClaudeCodeContext(overrides) {
166
- return (0, contextShared_1.createPromptContext)({
167
- harness: 'claude-code',
168
- harnessLabel: 'Claude Code',
169
- capabilities: ['hooks', 'stop-hook', 'ask-user-question', 'task-tool', 'breakpoint-routing'],
170
- pluginRootVar: '${CLAUDE_PLUGIN_ROOT}',
171
- loopControlTerm: 'stop-hook',
172
- sessionBindingFlags: '',
173
- hookDriven: true,
174
- interactiveToolName: 'AskUserQuestion tool',
175
- sessionEnvVars: 'PID-scoped session marker (authoritative); CLAUDE_ENV_FILE and AGENT_SESSION_ID are fallbacks',
176
- resumeFlags: '',
177
- cliSetupSnippet: (0, contextShared_1.createClaudeCodeCliSetupSnippet)(),
178
- sdkVersionExpr: '$SDK_VERSION',
179
- iterateFlags: '',
180
- hasIntentFidelityChecks: false,
181
- hasNonNegotiables: false,
182
- }, overrides);
105
+ return createPromptContextFromCatalog('cla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ExE;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAE9D;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,GAChB,wBAAwB,GAAG,IAAI,CAGjC;AAED,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACjC,aAAa,GAAG,IAAI,CAStB;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,cAAc,CAK9C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAGpE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAEjD;AAID;;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"}
@@ -31,71 +31,68 @@ const adapter_1 = require("./unified/adapter");
31
31
  const discovery_1 = require("./unified/discovery");
32
32
  const customAdapter_1 = require("./customAdapter");
33
33
  // ---------------------------------------------------------------------------
34
- // Inline discovery specs (previously in per-adapter discovery.ts files)
34
+ // Discovery specs — derived from agent-catalog (which reads Atlas graph)
35
35
  // ---------------------------------------------------------------------------
36
- exports.CLAUDE_CODE_DISCOVERY_SPEC = {
37
- name: "claude-code",
38
- cli: "claude",
39
- callerEnvVars: ["CLAUDE_ENV_FILE"],
40
- capabilities: [types_1.HarnessCapability.SessionBinding, types_1.HarnessCapability.StopHook, types_1.HarnessCapability.Mcp, types_1.HarnessCapability.HeadlessPrompt],
41
- configPaths: [".claude"],
42
- };
43
- exports.PI_DISCOVERY_SPEC = {
44
- name: "pi",
45
- cli: "pi",
46
- callerEnvVars: ["PI_SESSION_ID"],
47
- capabilities: [types_1.HarnessCapability.Programmatic, types_1.HarnessCapability.SessionBinding, types_1.HarnessCapability.HeadlessPrompt],
48
- configPaths: [".pi"],
49
- };
50
- exports.CODEX_DISCOVERY_SPEC = {
51
- name: "codex",
52
- cli: "codex",
53
- callerEnvVars: ["CODEX_THREAD_ID", "CODEX_SESSION_ID", "CODEX_PLUGIN_ROOT"],
54
- capabilities: [types_1.HarnessCapability.SessionBinding, types_1.HarnessCapability.StopHook, types_1.HarnessCapability.HeadlessPrompt],
55
- configPaths: [".codex"],
56
- };
57
- exports.CURSOR_DISCOVERY_SPEC = {
58
- name: "cursor",
59
- cli: "cursor",
60
- callerEnvVars: ["CURSOR_PROJECT_DIR", "CURSOR_VERSION"],
61
- capabilities: [types_1.HarnessCapability.SessionBinding, types_1.HarnessCapability.StopHook, types_1.HarnessCapability.HeadlessPrompt],
62
- configPaths: [".cursor"],
63
- };
64
- exports.GEMINI_CLI_DISCOVERY_SPEC = {
65
- name: "gemini-cli",
66
- cli: "gemini",
67
- callerEnvVars: ["GEMINI_SESSION_ID", "GEMINI_CWD", "GEMINI_PROJECT_DIR"],
68
- capabilities: [types_1.HarnessCapability.SessionBinding, types_1.HarnessCapability.StopHook, types_1.HarnessCapability.HeadlessPrompt],
69
- configPaths: [".gemini"],
70
- };
71
- exports.GITHUB_COPILOT_DISCOVERY_SPEC = {
72
- name: "github-copilot",
73
- cli: "gh",
74
- callerEnvVars: ["COPILOT_SESSION_ID"],
75
- capabilities: [types_1.HarnessCapability.SessionBinding, types_1.HarnessCapability.StopHook, types_1.HarnessCapability.HeadlessPrompt],
76
- configPaths: [".github", ".copilot"],
77
- };
78
- exports.OH_MY_PI_DISCOVERY_SPEC = {
79
- name: "oh-my-pi",
80
- cli: "pi",
81
- callerEnvVars: ["OMP_SESSION_ID"],
82
- capabilities: [types_1.HarnessCapability.SessionBinding, types_1.HarnessCapability.StopHook, types_1.HarnessCapability.Programmatic],
83
- configPaths: [".omp"],
84
- };
85
- exports.OPENCODE_DISCOVERY_SPEC = {
86
- name: "opencode",
87
- cli: "opencode",
88
- callerEnvVars: ["AGENT_SESSION_ID", "OPENCODE_SESSION_ID"],
89
- capabilities: [types_1.HarnessCapability.SessionBinding, types_1.HarnessCapability.StopHook, types_1.HarnessCapability.HeadlessPrompt],
90
- configPaths: [".opencode"],
91
- };
92
- exports.OPENCLAW_DISCOVERY_SPEC = {
93
- name: "openclaw",
94
- cli: "openclaw",
95
- callerEnvVars: [],
96
- capabilities: [types_1.HarnessCapability.Programmatic, types_1.HarnessCapability.HeadlessPrompt],
97
- configPaths: [".openclaw"],
36
+ const agent_catalog_1 = require("@a5c-ai/agent-catalog");
37
+ const CAPABILITY_MAP = {
38
+ SessionBinding: types_1.HarnessCapability.SessionBinding,
39
+ StopHook: types_1.HarnessCapability.StopHook,
40
+ Mcp: types_1.HarnessCapability.Mcp,
41
+ HeadlessPrompt: types_1.HarnessCapability.HeadlessPrompt,
42
+ Programmatic: types_1.HarnessCapability.Programmatic,
98
43
  };
44
+ function buildDiscoverySpecs() {
45
+ const specs = new Map();
46
+ try {
47
+ for (const target of (0, agent_catalog_1.listPluginTargetDescriptors)()) {
48
+ if (!target.cliCommand)
49
+ continue;
50
+ specs.set(target.targetId, {
51
+ name: target.targetId,
52
+ cli: target.cliCommand,
53
+ callerEnvVars: target.callerEnvVars ?? [],
54
+ capabilities: (target.harnessCapabilities ?? [])
55
+ .map((c) => CAPABILITY_MAP[c])
56
+ .filter((c) => c !== undefined),
57
+ configPaths: target.configPaths ?? [],
58
+ });
59
+ }
60
+ }
61
+ catch {
62
+ // Atlas/catalog not available (e.g. during initial bootstrap) — empty specs
63
+ }
64
+ return specs;
65
+ }
66
+ let cachedDiscoverySpecs;
67
+ function getDiscoverySpecs() {
68
+ if (!cachedDiscoverySpecs)
69
+ cachedDiscoverySpecs = buildDiscoverySpecs();
70
+ return cachedDiscoverySpecs;
71
+ }
72
+ function getDiscoverySpec(name) {
73
+ return getDiscoverySpecs().get(name);
74
+ }
75
+ // Named exports for backward compatibility (consumers import these directly).
76
+ // All fields are derived from the catalog with no hardcoded fallbacks --
77
+ // if the catalog is unavailable the spec returns empty defaults.
78
+ function specFor(id) {
79
+ return {
80
+ get name() { return getDiscoverySpec(id)?.name ?? id; },
81
+ get cli() { return getDiscoverySpec(id)?.cli ?? ''; },
82
+ get callerEnvVars() { return getDiscoverySpec(id)?.callerEnvVars ?? []; },
83
+ get capabilities() { return getDiscoverySpec(id)?.capabilities ?? []; },
84
+ get configPaths() { return getDiscoverySpec(id)?.configPaths ?? []; },
85
+ };
86
+ }
87
+ exports.CLAUDE_CODE_DISCOVERY_SPEC = specFor("claude-code");
88
+ exports.PI_DISCOVERY_SPEC = specFor("pi");
89
+ exports.CODEX_DISCOVERY_SPEC = specFor("codex");
90
+ exports.CURSOR_DISCOVERY_SPEC = specFor("cursor");
91
+ exports.GEMINI_CLI_DISCOVERY_SPEC = specFor("gemini-cli");
92
+ exports.GITHUB_COPILOT_DISCOVERY_SPEC = specFor("github-copilot");
93
+ exports.OH_MY_PI_DISCOVERY_SPEC = specFor("oh-my-pi");
94
+ exports.OPENCODE_DISCOVERY_SPEC = specFor("opencode");
95
+ exports.OPENCLAW_DISCOVERY_SPEC = specFor("openclaw");
99
96
  const HARNESS_REGISTRY = [
100
97
  {
101
98
  name: "codex",
@@ -157,14 +154,13 @@ const harnessRegistryByName = new Map(HARNESS_REGISTRY.map((entry) => [entry.nam
157
154
  exports.KNOWN_HARNESSES = [
158
155
  exports.CLAUDE_CODE_DISCOVERY_SPEC,
159
156
  exports.CODEX_DISCOVERY_SPEC,
160
- exports.CURSOR_DISCOVERY_SPEC,
157
+ exports.PI_DISCOVERY_SPEC,
158
+ exports.OH_MY_PI_DISCOVERY_SPEC,
161
159
  exports.GEMINI_CLI_DISCOVERY_SPEC,
162
- exports.GITHUB_COPILOT_DISCOVERY_SPEC,
160
+ exports.CURSOR_DISCOVERY_SPEC,
163
161
  exports.OPENCODE_DISCOVERY_SPEC,
164
- exports.OH_MY_PI_DISCOVERY_SPEC,
162
+ exports.GITHUB_COPILOT_DISCOVERY_SPEC,
165
163
  exports.OPENCLAW_DISCOVERY_SPEC,
166
- exports.PI_DISCOVERY_SPEC,
167
- // Unified is last — lowest priority in discovery and caller detection.
168
164
  discovery_1.UNIFIED_DISCOVERY_SPEC,
169
165
  ];
170
166
  function createKnownAdapters() {
@@ -6,14 +6,14 @@ import type { HookDispatcherOptions, HookResult } from "./types";
6
6
  export interface DiscoveredHook {
7
7
  path: string;
8
8
  name: string;
9
- location: "per-repo" | "per-user";
9
+ location: "per-repo" | "per-user" | "plugin";
10
10
  }
11
11
  /**
12
12
  * Discover hook scripts for a given hook type from project and user directories.
13
13
  */
14
14
  export declare function discoverHooks(hookType: string, cwd: string, homeDir?: string): Promise<DiscoveredHook[]>;
15
15
  /**
16
- * Find `plugins/babysitter/hooks/hook-dispatcher.sh` by walking up from cwd.
16
+ * Find `plugins/babysitter-unified/hooks/hook-dispatcher.sh` by walking up from cwd.
17
17
  * This allows running from nested projects/fixtures inside a mono-repo.
18
18
  *
19
19
  * First checks the active harness adapter for a harness-specific path
@@ -1 +1 @@
1
- {"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../../src/hooks/dispatcher.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EACV,qBAAqB,EACrB,UAAU,EAEX,MAAM,SAAS,CAAC;AAMjB,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,UAAU,GAAG,UAAU,CAAC;CACnC;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,MAAqB,GAC7B,OAAO,CAAC,cAAc,EAAE,CAAC,CAmC3B;AAkED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAetE;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,UAAU,CAAC,CAyHrB"}
1
+ {"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../../src/hooks/dispatcher.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EACV,qBAAqB,EACrB,UAAU,EAEX,MAAM,SAAS,CAAC;AAMjB,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;CAC9C;AAgCD;;GAEG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,MAAqB,GAC7B,OAAO,CAAC,cAAc,EAAE,CAAC,CA6C3B;AAkED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAoBtE;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,UAAU,CAAC,CAqHrB"}
@@ -47,6 +47,36 @@ const path = __importStar(require("node:path"));
47
47
  const defaults_1 = require("../config/defaults");
48
48
  const harness_1 = require("../harness");
49
49
  const HOOK_SCRIPT_EXTENSIONS = new Set([".sh", ".js", ".ts", ".py", ".bash"]);
50
+ function findPluginHookPath(startCwd, hookType) {
51
+ const candidateNames = Array.from(HOOK_SCRIPT_EXTENSIONS, (ext) => `${hookType}${ext}`);
52
+ const adapterPluginRoot = (0, harness_1.getAdapter)().resolvePluginRoot({});
53
+ if (adapterPluginRoot) {
54
+ for (const candidateName of candidateNames) {
55
+ const candidate = path.join(adapterPluginRoot, "hooks", candidateName);
56
+ if ((0, node_fs_1.existsSync)(candidate))
57
+ return candidate;
58
+ }
59
+ }
60
+ let current = path.resolve(startCwd);
61
+ for (let i = 0; i < 50; i++) {
62
+ const hookRoots = [
63
+ path.join(current, "plugins", "babysitter-unified", "hooks"),
64
+ path.join(current, "plugins", "babysitter", "hooks"),
65
+ ];
66
+ for (const hookRoot of hookRoots) {
67
+ for (const candidateName of candidateNames) {
68
+ const candidate = path.join(hookRoot, candidateName);
69
+ if ((0, node_fs_1.existsSync)(candidate))
70
+ return candidate;
71
+ }
72
+ }
73
+ const parent = path.dirname(current);
74
+ if (parent === current)
75
+ break;
76
+ current = parent;
77
+ }
78
+ return null;
79
+ }
50
80
  /**
51
81
  * Discover hook scripts for a given hook type from project and user directories.
52
82
  */
@@ -80,7 +110,16 @@ async function discoverHooks(hookType, cwd, homeDir = os.homedir()) {
80
110
  readHooksFromDir(projectHookDir, "per-repo"),
81
111
  readHooksFromDir(userHookDir, "per-user"),
82
112
  ]);
83
- return [...projectHooks, ...userHooks];
113
+ const hooks = [...projectHooks, ...userHooks];
114
+ const pluginHookPath = findPluginHookPath(cwd, hookType);
115
+ if (pluginHookPath) {
116
+ hooks.push({
117
+ path: pluginHookPath,
118
+ name: path.basename(pluginHookPath),
119
+ location: "plugin",
120
+ });
121
+ }
122
+ return hooks;
84
123
  }
85
124
  /**
86
125
  * Execute discovered hook scripts sequentially, passing payload as stdin JSON.
@@ -134,7 +173,7 @@ async function executeDiscoveredHooks(hooks, payload, hookType, cwd, timeout) {
134
173
  };
135
174
  }
136
175
  /**
137
- * Find `plugins/babysitter/hooks/hook-dispatcher.sh` by walking up from cwd.
176
+ * Find `plugins/babysitter-unified/hooks/hook-dispatcher.sh` by walking up from cwd.
138
177
  * This allows running from nested projects/fixtures inside a mono-repo.
139
178
  *
140
179
  * First checks the active harness adapter for a harness-specific path
@@ -150,9 +189,14 @@ function findHookDispatcherPath(startCwd) {
150
189
  let current = path.resolve(startCwd);
151
190
  // Guard against infinite loops: stop once we stop making progress.
152
191
  for (let i = 0; i < 50; i++) {
153
- const candidate = path.join(current, "plugins", "babysitter", "hooks", "hook-dispatcher.sh");
154
- if ((0, node_fs_1.existsSync)(candidate))
155
- return candidate;
192
+ const candidates = [
193
+ path.join(current, "plugins", "babysitter-unified", "hooks", "hook-dispatcher.sh"),
194
+ path.join(current, "plugins", "babysitter", "hooks", "hook-dispatcher.sh"),
195
+ ];
196
+ for (const candidate of candidates) {
197
+ if ((0, node_fs_1.existsSync)(candidate))
198
+ return candidate;
199
+ }
156
200
  const parent = path.dirname(current);
157
201
  if (parent === current)
158
202
  break;
@@ -167,18 +211,15 @@ async function callHook(options) {
167
211
  const { hookType, payload, cwd = process.cwd(), timeout = defaults_1.DEFAULTS.hookTimeout, throwOnFailure = false, } = options;
168
212
  const dispatcherPath = findHookDispatcherPath(cwd);
169
213
  if (!dispatcherPath) {
170
- // Fall back to filesystem-discovered hooks
171
214
  const discoveredHooks = await discoverHooks(hookType, cwd);
172
- if (discoveredHooks.length > 0) {
173
- return executeDiscoveredHooks(discoveredHooks, payload, hookType, cwd, timeout);
215
+ if (discoveredHooks.length === 0) {
216
+ return {
217
+ hookType,
218
+ success: true,
219
+ executedHooks: [],
220
+ };
174
221
  }
175
- return {
176
- hookType,
177
- success: false,
178
- error: `Hook dispatcher not found. Expected plugins/babysitter/hooks/hook-dispatcher.sh ` +
179
- `in ${cwd} or any parent directory.`,
180
- executedHooks: [],
181
- };
222
+ return executeDiscoveredHooks(discoveredHooks, payload, hookType, cwd, timeout);
182
223
  }
183
224
  const payloadJson = JSON.stringify(payload);
184
225
  const startTime = Date.now();
@@ -1 +1 @@
1
- {"version":3,"file":"runLogger.d.ts","sourceRoot":"","sources":["../../src/logging/runLogger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9D,oDAAoD;AACpD,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC;AAEjD,MAAM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fs_1 = require("node:fs");
59
59
  const path = __importStar(require("node:path"));
60
60
  const config_1 = require("../config");
61
+ const sdkVersion_1 = require("../sdkVersion");
61
62
  // ---------------------------------------------------------------------------
62
63
  // Paths
63
64
  // ---------------------------------------------------------------------------
@@ -99,6 +100,7 @@ function formatLogLine(entry) {
99
100
  const record = {
100
101
  ts: entry.timestamp,
101
102
  level: entry.level,
103
+ sdkVersion: sdkVersion_1.BABYSITTER_SDK_VERSION,
102
104
  };
103
105
  if (entry.type)
104
106
  record.type = entry.type;