@skillstate/claude 2.0.7 → 2.2.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/dist/claude-adapter.d.ts +28 -13
- package/dist/claude-adapter.d.ts.map +1 -1
- package/dist/claude-adapter.js +140 -316
- package/dist/claude-adapter.js.map +1 -1
- package/package.json +1 -1
package/dist/claude-adapter.d.ts
CHANGED
|
@@ -83,8 +83,12 @@ export declare class ClaudeAdapter implements PlatformAdapter {
|
|
|
83
83
|
* with the `^compact$` matcher);
|
|
84
84
|
* - `post-tool-use`: extracts a `state_patch` from the tool_response
|
|
85
85
|
* (fenced ```json block or raw JSON), applies the ⊕ null-deletion merge
|
|
86
|
-
* and writes the state file
|
|
87
|
-
* the patch is invalid.
|
|
86
|
+
* and writes the state file (under the built-in cross-process lock);
|
|
87
|
+
* stdout is `{}` or a `systemMessage` when the patch is invalid.
|
|
88
|
+
*
|
|
89
|
+
* AGENT-SCOPED STATE: the hook stdin's `session_id` scopes the state to
|
|
90
|
+
* `<cwd>/.skillstate/agents/<session-prefix>/skillstate.json`, so
|
|
91
|
+
* parallel Claude Code sessions never last-writer-win over each other.
|
|
88
92
|
*
|
|
89
93
|
* `statePath` is accepted for `{ root, name }` confinement (traversal
|
|
90
94
|
* refs throw) and documented in the script header; the content itself is
|
|
@@ -95,8 +99,8 @@ export declare class ClaudeAdapter implements PlatformAdapter {
|
|
|
95
99
|
* Generate a SKILL.md for Claude Code's skill directory
|
|
96
100
|
* (`~/.claude/skills/<name>/SKILL.md`). The body instructs the agent to
|
|
97
101
|
* treat the hook-injected state as authoritative (history is not
|
|
98
|
-
* reliable), to
|
|
99
|
-
* to persist via `state.patch` — the PostToolUse hook also merges any
|
|
102
|
+
* reliable), to orient via `state.summary` (full dump via `state.get`),
|
|
103
|
+
* and to persist via `state.patch` — the PostToolUse hook also merges any
|
|
100
104
|
* fenced ```json `state_patch` block printed by a Bash tool call.
|
|
101
105
|
*/
|
|
102
106
|
generateSkillMd(spec: ProceduralSpec, statePath?: string): string;
|
|
@@ -107,33 +111,44 @@ export declare class ClaudeAdapter implements PlatformAdapter {
|
|
|
107
111
|
* skillstate command is already wired, the ORIGINAL text is returned
|
|
108
112
|
* byte-unchanged. Malformed/empty input starts from a fresh hooks-only
|
|
109
113
|
* document (the CLI guards a live settings.json before calling).
|
|
114
|
+
*
|
|
115
|
+
* The mechanics live in the shared {@link mergeHookGroups}; this method
|
|
116
|
+
* supplies only the format specifics (generated settings.json groups and
|
|
117
|
+
* the `node <script> <event>` skillstate commands).
|
|
110
118
|
*/
|
|
111
119
|
mergeHooksConfig(existingJson: string, options?: ClaudeHooksConfigOptions): string;
|
|
112
120
|
/**
|
|
113
|
-
* Generate a hook script and persist it via
|
|
114
|
-
* is the script destination (usually
|
|
121
|
+
* Generate a hook script and persist it via the shared `saveGenerated`
|
|
122
|
+
* (atomic temp-rename write). `target` is the script destination (usually
|
|
115
123
|
* {@link ClaudeAdapter.claudeHookScriptPath}); `statePath` is forwarded
|
|
116
124
|
* to {@link generateHookScript}. Returns the absolute destination path.
|
|
117
125
|
*/
|
|
118
126
|
saveHookScript(event: ClaudeHookEvent, target: string | StatePathRef, statePath?: string | StatePathRef): Promise<string>;
|
|
119
127
|
/**
|
|
120
|
-
* Generate the hooks config document and persist it via
|
|
121
|
-
* `
|
|
128
|
+
* Generate the hooks config document and persist it via the shared
|
|
129
|
+
* `saveGenerated`. Both the destination and the embedded state path
|
|
122
130
|
* accept raw strings or `{ root, name }` refs confined by
|
|
123
131
|
* `resolveStatePath`. Returns the absolute destination path.
|
|
124
132
|
*/
|
|
125
133
|
saveHooksConfig(target: string | StatePathRef, statePath?: string | StatePathRef, options?: ClaudeHooksConfigOptions): Promise<string>;
|
|
126
134
|
/**
|
|
127
|
-
* Generate a SKILL.md and persist it via `
|
|
128
|
-
* absolute destination path.
|
|
135
|
+
* Generate a SKILL.md and persist it via the shared `saveGenerated`.
|
|
136
|
+
* Returns the absolute destination path.
|
|
129
137
|
*/
|
|
130
138
|
saveSkillMd(target: string | StatePathRef, spec: ProceduralSpec, statePath?: string): Promise<string>;
|
|
131
139
|
generateAppendPrompt(): string;
|
|
132
|
-
/**
|
|
133
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Inject-script template (`UserPromptSubmit` / `SessionStart`): brand
|
|
142
|
+
* header + the shared hook-runtime snippet ({@link hookRuntimeSnippet}
|
|
143
|
+
* inlined via `fn.toString()`) + a stdin loop that emits
|
|
144
|
+
* `{ hookSpecificOutput: { hookEventName, additionalContext } }` with the
|
|
145
|
+
* current state JSON read from the SESSION cwd. Brand specifics stay in
|
|
146
|
+
* the adapter (comment lines only); the `contextSuffix` is the shared
|
|
147
|
+
* {@link HISTORY_UNRELIABLE_NOTE} from `@skillstate/core`.
|
|
148
|
+
*/
|
|
149
|
+
private buildInjectScriptTemplate;
|
|
134
150
|
/** PostToolUse script: extract state_patch, ⊕ merge, persist. */
|
|
135
151
|
private buildPostToolUseScript;
|
|
136
|
-
private describeSchema;
|
|
137
152
|
}
|
|
138
153
|
/**
|
|
139
154
|
* Surgically remove every skillstate hook handler from an existing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-adapter.d.ts","sourceRoot":"","sources":["../src/claude-adapter.ts"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,WAAW,EACX,eAAe,EAChB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"claude-adapter.d.ts","sourceRoot":"","sources":["../src/claude-adapter.ts"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,WAAW,EACX,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAe1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,sBAAsB,IAAI,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEhF,qFAAqF;A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AAe,EACtB,SAAS,CAAC,EAAE,MAAM,GAAG,YAAY,GAChC,MAAM,CAiBR;IAED;;;;;;;OAOG;IACH,eAAe,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAOhE;IAED;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,MAAM,CAYjF;IAED;;;;;OAKG;IACG,cAAc,CAClB,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,MAAM,GAAG,YAAY,EAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,YAAY,GAChC,OAAO,CAAC,MAAM,CAAC,CAEjB;IAED;;;;;OAKG;IACG,eAAe,CACnB,MAAM,EAAE,MAAM,GAAG,YAAY,EAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,YAAY,EACjC,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,MAAM,CAAC,CAEjB;IAED;;;OAGG;IACG,WAAW,CACf,MAAM,EAAE,MAAM,GAAG,YAAY,EAC7B,IAAI,EAAE,cAAc,EACpB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CAEjB;IAED,oBAAoB,IAAI,MAAM,CAS7B;IAMD;;;;;;;;OAQG;IACH,OAAO,CAAC,yBAAyB;IA2EjC,iEAAiE;IACjE,OAAO,CAAC,sBAAsB;CAwE/B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,GACnB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAiDpC"}
|
package/dist/claude-adapter.js
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
*/
|
|
39
39
|
import * as path from 'node:path';
|
|
40
40
|
import { PromptTransformer } from '@skillstate/core';
|
|
41
|
-
import {
|
|
41
|
+
import { describeSchema, HISTORY_UNRELIABLE_NOTE, hookRuntimeSnippet, INTERRUPTED_SESSION_NOTE, isPlainObject, mergeHookGroups, resolveTarget, saveGenerated, skillMdBody, STATE_PATCH_CONTRACT, } from '@skillstate/core';
|
|
42
42
|
export { resolveHostStateForCwd as resolveStateForCwd } from '@skillstate/core';
|
|
43
43
|
/** All {@link ClaudeHookEvent} values in generation order. */
|
|
44
44
|
export const CLAUDE_HOOK_EVENTS = [
|
|
@@ -55,10 +55,6 @@ export const CLAUDE_POST_TOOL_USE_MATCHER = '^Bash$';
|
|
|
55
55
|
* UserPromptSubmit default, spelled out so the budget is explicit.
|
|
56
56
|
*/
|
|
57
57
|
export const CLAUDE_HOOK_TIMEOUT_SECONDS = 30;
|
|
58
|
-
/** Narrow record check for settings.json documents (module scope). */
|
|
59
|
-
function isPlainObjectDoc(value) {
|
|
60
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
61
|
-
}
|
|
62
58
|
/**
|
|
63
59
|
* Claude Code platform adapter (@non-paper; see module doc for the 2.1.260
|
|
64
60
|
* hooks contract and the honest O(T) limitation).
|
|
@@ -68,7 +64,7 @@ export class ClaudeAdapter {
|
|
|
68
64
|
transformer = new PromptTransformer({ platform: 'claude' });
|
|
69
65
|
injectState(state, spec) {
|
|
70
66
|
const stateJson = JSON.stringify(state);
|
|
71
|
-
const schemaDesc =
|
|
67
|
+
const schemaDesc = describeSchema(spec.schema);
|
|
72
68
|
return `# System
|
|
73
69
|
|
|
74
70
|
You are ${spec.name}. ${spec.instructions}
|
|
@@ -85,17 +81,7 @@ ${stateJson}
|
|
|
85
81
|
|
|
86
82
|
Based on your current state, provide your response with:
|
|
87
83
|
|
|
88
|
-
|
|
89
|
-
2. A JSON block containing both your State Patch and your Action. The JSON block MUST have exactly these two keys:
|
|
90
|
-
|
|
91
|
-
\`\`\`json
|
|
92
|
-
{
|
|
93
|
-
"state_patch": { "key": "new_value", "obsolete_key": null },
|
|
94
|
-
"action": "your_action_here"
|
|
95
|
-
}
|
|
96
|
-
\`\`\`
|
|
97
|
-
|
|
98
|
-
In \`state_patch\`, set keys to null to delete them. Only include fields you want to change. Omit fields to leave them unchanged.`;
|
|
84
|
+
${STATE_PATCH_CONTRACT}`;
|
|
99
85
|
}
|
|
100
86
|
extractPatch(response) {
|
|
101
87
|
return this.transformer.extractStatePatch(response);
|
|
@@ -139,7 +125,7 @@ In \`state_patch\`, set keys to null to delete them. Only include fields you wan
|
|
|
139
125
|
*/
|
|
140
126
|
generateHooksConfig(statePath, options) {
|
|
141
127
|
const scriptDir = options?.scriptDir ??
|
|
142
|
-
(statePath === undefined ? '<stateDir>/hooks' : path.dirname(
|
|
128
|
+
(statePath === undefined ? '<stateDir>/hooks' : path.dirname(resolveTarget(statePath)));
|
|
143
129
|
const command = (event) => options?.command ?? `node ${JSON.stringify(this.claudeHookScriptPath(scriptDir, event))} ${event}`;
|
|
144
130
|
const timeout = options?.timeoutSeconds ?? CLAUDE_HOOK_TIMEOUT_SECONDS;
|
|
145
131
|
const entry = (event) => ({
|
|
@@ -186,147 +172,47 @@ In \`state_patch\`, set keys to null to delete them. Only include fields you wan
|
|
|
186
172
|
* with the `^compact$` matcher);
|
|
187
173
|
* - `post-tool-use`: extracts a `state_patch` from the tool_response
|
|
188
174
|
* (fenced ```json block or raw JSON), applies the ⊕ null-deletion merge
|
|
189
|
-
* and writes the state file
|
|
190
|
-
* the patch is invalid.
|
|
175
|
+
* and writes the state file (under the built-in cross-process lock);
|
|
176
|
+
* stdout is `{}` or a `systemMessage` when the patch is invalid.
|
|
177
|
+
*
|
|
178
|
+
* AGENT-SCOPED STATE: the hook stdin's `session_id` scopes the state to
|
|
179
|
+
* `<cwd>/.skillstate/agents/<session-prefix>/skillstate.json`, so
|
|
180
|
+
* parallel Claude Code sessions never last-writer-win over each other.
|
|
191
181
|
*
|
|
192
182
|
* `statePath` is accepted for `{ root, name }` confinement (traversal
|
|
193
183
|
* refs throw) and documented in the script header; the content itself is
|
|
194
184
|
* cwd-resolving and never bakes an absolute state path in.
|
|
195
185
|
*/
|
|
196
186
|
generateHookScript(event, statePath) {
|
|
197
|
-
const resolved = statePath === undefined ? undefined :
|
|
187
|
+
const resolved = statePath === undefined ? undefined : resolveTarget(statePath);
|
|
198
188
|
const header = `// State file (per-project resolver): ${resolved ?? '<cwd>/.skillstate/skillstate.json (global bucket when cwd === home)'}`;
|
|
199
189
|
if (event === 'post-tool-use') {
|
|
200
190
|
return this.buildPostToolUseScript(header);
|
|
201
191
|
}
|
|
202
192
|
const hookEventName = event === 'session-start-compact' ? 'SessionStart' : 'UserPromptSubmit';
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
'// Self-contained CommonJS: reads one hook JSON document on stdin,',
|
|
207
|
-
'// resolves the state from the SESSION cwd, and emits',
|
|
208
|
-
'// { hookSpecificOutput: { hookEventName, additionalContext } }.',
|
|
193
|
+
// A1 text is shared: both hosts append the SAME HISTORY_UNRELIABLE_NOTE
|
|
194
|
+
// (MCP tools + fenced state_patch channel) after the state JSON.
|
|
195
|
+
return this.buildInjectScriptTemplate({
|
|
209
196
|
header,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
'const path = require("path");',
|
|
214
|
-
'',
|
|
215
|
-
`const HOOK_EVENT_NAME = ${JSON.stringify(hookEventName)};`,
|
|
216
|
-
'',
|
|
217
|
-
'function resolveStatePathForCwd(cwd) {',
|
|
218
|
-
' const resolvedCwd = path.resolve(cwd);',
|
|
219
|
-
' const resolvedHome = path.resolve(os.homedir());',
|
|
220
|
-
' if (resolvedCwd === resolvedHome) {',
|
|
221
|
-
' return path.join(resolvedHome, ".skillstate", "global", "skillstate.json");',
|
|
222
|
-
' }',
|
|
223
|
-
' return path.join(resolvedCwd, ".skillstate", "skillstate.json");',
|
|
224
|
-
'}',
|
|
225
|
-
'',
|
|
226
|
-
'function readState(statePath) {',
|
|
227
|
-
' try {',
|
|
228
|
-
' if (fs.existsSync(statePath)) {',
|
|
229
|
-
' const parsed = JSON.parse(fs.readFileSync(statePath, "utf-8"));',
|
|
230
|
-
' if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {',
|
|
231
|
-
' if (parsed.state !== null && typeof parsed.state === "object" && !Array.isArray(parsed.state)) {',
|
|
232
|
-
' return parsed.state;',
|
|
233
|
-
' }',
|
|
234
|
-
' return parsed;',
|
|
235
|
-
' }',
|
|
236
|
-
' }',
|
|
237
|
-
' } catch (error) {}',
|
|
238
|
-
' return {};',
|
|
239
|
-
'}',
|
|
240
|
-
'',
|
|
241
|
-
'let raw = "";',
|
|
242
|
-
'process.stdin.setEncoding("utf-8");',
|
|
243
|
-
'process.stdin.on("data", (chunk) => { raw += chunk; });',
|
|
244
|
-
'process.stdin.on("end", () => {',
|
|
245
|
-
' let cwd = process.cwd();',
|
|
246
|
-
' try {',
|
|
247
|
-
' const input = JSON.parse(raw);',
|
|
248
|
-
' if (typeof input.cwd === "string" && input.cwd.length > 0) {',
|
|
249
|
-
' cwd = input.cwd;',
|
|
250
|
-
' }',
|
|
251
|
-
' } catch (error) {}',
|
|
252
|
-
' const state = readState(resolveStatePathForCwd(cwd));',
|
|
253
|
-
' const output = {',
|
|
254
|
-
' hookSpecificOutput: {',
|
|
255
|
-
' hookEventName: HOOK_EVENT_NAME,',
|
|
256
|
-
' additionalContext: "Current skill state (JSON): " + JSON.stringify(state)',
|
|
257
|
-
' + "\\nPersist anything you need into state via the skillstate MCP tools (state.patch) or a fenced ```json state_patch block inside a Bash command. History is not reliable.",',
|
|
258
|
-
' },',
|
|
259
|
-
' };',
|
|
260
|
-
' process.stdout.write(JSON.stringify(output));',
|
|
261
|
-
'});',
|
|
262
|
-
'',
|
|
263
|
-
].join('\n');
|
|
197
|
+
hookEventName,
|
|
198
|
+
contextSuffix: HISTORY_UNRELIABLE_NOTE,
|
|
199
|
+
});
|
|
264
200
|
}
|
|
265
201
|
/**
|
|
266
202
|
* Generate a SKILL.md for Claude Code's skill directory
|
|
267
203
|
* (`~/.claude/skills/<name>/SKILL.md`). The body instructs the agent to
|
|
268
204
|
* treat the hook-injected state as authoritative (history is not
|
|
269
|
-
* reliable), to
|
|
270
|
-
* to persist via `state.patch` — the PostToolUse hook also merges any
|
|
205
|
+
* reliable), to orient via `state.summary` (full dump via `state.get`),
|
|
206
|
+
* and to persist via `state.patch` — the PostToolUse hook also merges any
|
|
271
207
|
* fenced ```json `state_patch` block printed by a Bash tool call.
|
|
272
208
|
*/
|
|
273
209
|
generateSkillMd(spec, statePath) {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
`version: ${spec.version}`,
|
|
281
|
-
'execution_context:',
|
|
282
|
-
` state_path: ${resolvedStatePath}`,
|
|
283
|
-
' format: json',
|
|
284
|
-
'---',
|
|
285
|
-
'',
|
|
286
|
-
`# ${spec.name}`,
|
|
287
|
-
'',
|
|
288
|
-
spec.instructions,
|
|
289
|
-
'',
|
|
290
|
-
'## Execution Context',
|
|
291
|
-
'',
|
|
292
|
-
`Your execution state lives at \`${resolvedStatePath}\` (per project; a`,
|
|
293
|
-
'session started in $HOME uses `~/.skillstate/global/skillstate.json`).',
|
|
294
|
-
'The skillstate Claude Code hooks:',
|
|
295
|
-
'',
|
|
296
|
-
'- inject the CURRENT state into context on every prompt submit',
|
|
297
|
-
' (`UserPromptSubmit`) and re-inject it after compaction',
|
|
298
|
-
' (`SessionStart` matcher `^compact$`);',
|
|
299
|
-
'- watch every Bash tool result and merge a fenced ```json block carrying',
|
|
300
|
-
' a `state_patch` into the state file (`PostToolUse`).',
|
|
301
|
-
'',
|
|
302
|
-
'The injected state is authoritative — history is not reliable. Never',
|
|
303
|
-
'reconstruct execution context from the conversation.',
|
|
304
|
-
'',
|
|
305
|
-
'## Process',
|
|
306
|
-
'',
|
|
307
|
-
'1. Read the current state from the injected context, or fetch it with',
|
|
308
|
-
' the skillstate MCP tool `state.get`.',
|
|
309
|
-
'2. Observe the result of your last action.',
|
|
310
|
-
'3. Reason about what to do next, given the state and the observation.',
|
|
311
|
-
'4. Persist progress with the skillstate MCP tool `state.patch` (sparse',
|
|
312
|
-
' patch; set a key to `null` to delete it), and/or emit a fenced JSON',
|
|
313
|
-
' block with exactly two keys inside a Bash tool call so the',
|
|
314
|
-
' `PostToolUse` hook merges it:',
|
|
315
|
-
'',
|
|
316
|
-
`${fence}json`,
|
|
317
|
-
'{',
|
|
318
|
-
' "state_patch": { "key": "new_value", "obsolete_key": null },',
|
|
319
|
-
' "action": "next_action_name"',
|
|
320
|
-
'}',
|
|
321
|
-
fence,
|
|
322
|
-
'',
|
|
323
|
-
'- In `state_patch`, set keys to `null` to delete them. Only include',
|
|
324
|
-
' fields you want to change. Omit fields to leave them unchanged.',
|
|
325
|
-
'- Put anything you need to survive into `state_patch`; never rely on',
|
|
326
|
-
' the conversation remembering it.',
|
|
327
|
-
'- `action` names what you will do next (e.g. "continue", "done").',
|
|
328
|
-
'',
|
|
329
|
-
].join('\n');
|
|
210
|
+
return skillMdBody({
|
|
211
|
+
hostLabel: 'Claude Code',
|
|
212
|
+
injectionPhrase: 'injected into your context via hooks',
|
|
213
|
+
spec,
|
|
214
|
+
statePath,
|
|
215
|
+
});
|
|
330
216
|
}
|
|
331
217
|
/**
|
|
332
218
|
* Merge the skillstate hook groups into an existing `settings.json`
|
|
@@ -335,102 +221,137 @@ In \`state_patch\`, set keys to null to delete them. Only include fields you wan
|
|
|
335
221
|
* skillstate command is already wired, the ORIGINAL text is returned
|
|
336
222
|
* byte-unchanged. Malformed/empty input starts from a fresh hooks-only
|
|
337
223
|
* document (the CLI guards a live settings.json before calling).
|
|
224
|
+
*
|
|
225
|
+
* The mechanics live in the shared {@link mergeHookGroups}; this method
|
|
226
|
+
* supplies only the format specifics (generated settings.json groups and
|
|
227
|
+
* the `node <script> <event>` skillstate commands).
|
|
338
228
|
*/
|
|
339
229
|
mergeHooksConfig(existingJson, options) {
|
|
340
|
-
let doc = {};
|
|
341
|
-
try {
|
|
342
|
-
doc = JSON.parse(existingJson);
|
|
343
|
-
}
|
|
344
|
-
catch {
|
|
345
|
-
// Missing or malformed input: start from a fresh document.
|
|
346
|
-
}
|
|
347
|
-
if (!isPlainObjectDoc(doc.hooks)) {
|
|
348
|
-
doc.hooks = {};
|
|
349
|
-
}
|
|
350
230
|
const scriptDir = options?.scriptDir ?? '<stateDir>/hooks';
|
|
351
231
|
const command = (event) => `node ${JSON.stringify(this.claudeHookScriptPath(scriptDir, event))} ${event}`;
|
|
352
|
-
const skillstateCommands = new Set(CLAUDE_HOOK_EVENTS.map((event) => JSON.stringify(command(event))));
|
|
353
|
-
let alreadyWired = false;
|
|
354
|
-
for (const groups of Object.values(doc.hooks)) {
|
|
355
|
-
if (!Array.isArray(groups))
|
|
356
|
-
continue;
|
|
357
|
-
for (const group of groups) {
|
|
358
|
-
if (!isPlainObjectDoc(group) || !Array.isArray(group['hooks']))
|
|
359
|
-
continue;
|
|
360
|
-
for (const handler of group['hooks']) {
|
|
361
|
-
if (isPlainObjectDoc(handler) && skillstateCommands.has(JSON.stringify(handler['command']))) {
|
|
362
|
-
alreadyWired = true;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
if (alreadyWired) {
|
|
368
|
-
return existingJson;
|
|
369
|
-
}
|
|
370
232
|
const generated = JSON.parse(this.generateHooksConfig(undefined, { ...options, scriptDir }));
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
}
|
|
377
|
-
return `${JSON.stringify(doc, null, 2)}\n`;
|
|
233
|
+
return mergeHookGroups({
|
|
234
|
+
existingJson,
|
|
235
|
+
generatedGroups: generated.hooks,
|
|
236
|
+
commandsOf: new Set(CLAUDE_HOOK_EVENTS.map((event) => JSON.stringify(command(event)))),
|
|
237
|
+
});
|
|
378
238
|
}
|
|
379
239
|
/**
|
|
380
|
-
* Generate a hook script and persist it via
|
|
381
|
-
* is the script destination (usually
|
|
240
|
+
* Generate a hook script and persist it via the shared `saveGenerated`
|
|
241
|
+
* (atomic temp-rename write). `target` is the script destination (usually
|
|
382
242
|
* {@link ClaudeAdapter.claudeHookScriptPath}); `statePath` is forwarded
|
|
383
243
|
* to {@link generateHookScript}. Returns the absolute destination path.
|
|
384
244
|
*/
|
|
385
245
|
async saveHookScript(event, target, statePath) {
|
|
386
|
-
|
|
387
|
-
await atomicWriteFile(dest, this.generateHookScript(event, statePath));
|
|
388
|
-
return dest;
|
|
246
|
+
return saveGenerated(target, this.generateHookScript(event, statePath));
|
|
389
247
|
}
|
|
390
248
|
/**
|
|
391
|
-
* Generate the hooks config document and persist it via
|
|
392
|
-
* `
|
|
249
|
+
* Generate the hooks config document and persist it via the shared
|
|
250
|
+
* `saveGenerated`. Both the destination and the embedded state path
|
|
393
251
|
* accept raw strings or `{ root, name }` refs confined by
|
|
394
252
|
* `resolveStatePath`. Returns the absolute destination path.
|
|
395
253
|
*/
|
|
396
254
|
async saveHooksConfig(target, statePath, options) {
|
|
397
|
-
|
|
398
|
-
await atomicWriteFile(dest, this.generateHooksConfig(statePath, options));
|
|
399
|
-
return dest;
|
|
255
|
+
return saveGenerated(target, this.generateHooksConfig(statePath, options));
|
|
400
256
|
}
|
|
401
257
|
/**
|
|
402
|
-
* Generate a SKILL.md and persist it via `
|
|
403
|
-
* absolute destination path.
|
|
258
|
+
* Generate a SKILL.md and persist it via the shared `saveGenerated`.
|
|
259
|
+
* Returns the absolute destination path.
|
|
404
260
|
*/
|
|
405
261
|
async saveSkillMd(target, spec, statePath) {
|
|
406
|
-
|
|
407
|
-
await atomicWriteFile(dest, this.generateSkillMd(spec, statePath));
|
|
408
|
-
return dest;
|
|
262
|
+
return saveGenerated(target, this.generateSkillMd(spec, statePath));
|
|
409
263
|
}
|
|
410
264
|
generateAppendPrompt() {
|
|
411
265
|
return `You are operating in state-based execution mode. Your state is maintained across steps.
|
|
412
266
|
|
|
413
|
-
After each step, you MUST respond with
|
|
267
|
+
After each step, you MUST respond with:
|
|
414
268
|
|
|
415
|
-
|
|
416
|
-
{
|
|
417
|
-
"state_patch": { "field_to_update": "new_value", "obsolete_field": null },
|
|
418
|
-
"action": "next_action_name"
|
|
419
|
-
}
|
|
420
|
-
\`\`\`
|
|
269
|
+
${STATE_PATCH_CONTRACT}
|
|
421
270
|
|
|
422
|
-
- In \`state_patch\`, set keys to null to delete them. Only include fields you want to change. Omit fields to leave them unchanged.
|
|
423
271
|
- \`action\` indicates what you want to do next (e.g., "continue", "done", "deploy").
|
|
424
|
-
-
|
|
272
|
+
- Put anything you need to persist into \`state_patch\`.`;
|
|
425
273
|
}
|
|
426
274
|
/* ------------------------------------------------------------------ */
|
|
427
275
|
/* Internal helpers */
|
|
428
276
|
/* ------------------------------------------------------------------ */
|
|
429
|
-
/**
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
277
|
+
/**
|
|
278
|
+
* Inject-script template (`UserPromptSubmit` / `SessionStart`): brand
|
|
279
|
+
* header + the shared hook-runtime snippet ({@link hookRuntimeSnippet}
|
|
280
|
+
* inlined via `fn.toString()`) + a stdin loop that emits
|
|
281
|
+
* `{ hookSpecificOutput: { hookEventName, additionalContext } }` with the
|
|
282
|
+
* current state JSON read from the SESSION cwd. Brand specifics stay in
|
|
283
|
+
* the adapter (comment lines only); the `contextSuffix` is the shared
|
|
284
|
+
* {@link HISTORY_UNRELIABLE_NOTE} from `@skillstate/core`.
|
|
285
|
+
*/
|
|
286
|
+
buildInjectScriptTemplate(options) {
|
|
287
|
+
// SessionStart is a real session boundary: when the session-meta
|
|
288
|
+
// sidecar still carries `status: "interrupted"` (the previous run of
|
|
289
|
+
// this session was killed before it could finalize), the hook appends
|
|
290
|
+
// the shared INTERRUPTED_SESSION_NOTE — with the preserved state path
|
|
291
|
+
// substituted — so the model reviews progress/blockers first. A fresh
|
|
292
|
+
// MCP launch overwrites the status back to `running`.
|
|
293
|
+
const interruptedCheck = options.hookEventName === 'SessionStart';
|
|
294
|
+
return [
|
|
295
|
+
'#!/usr/bin/env node',
|
|
296
|
+
`// skillstate Claude Code hook — ${options.hookEventName} (generated by @skillstate/claude).`,
|
|
297
|
+
'// Self-contained CommonJS: reads one hook JSON document on stdin,',
|
|
298
|
+
'// resolves the state from the SESSION cwd, and emits',
|
|
299
|
+
'// { hookSpecificOutput: { hookEventName, additionalContext } }.',
|
|
300
|
+
options.header,
|
|
301
|
+
"'use strict';",
|
|
302
|
+
'const fs = require("fs");',
|
|
303
|
+
'const os = require("os");',
|
|
304
|
+
'const path = require("path");',
|
|
305
|
+
'',
|
|
306
|
+
`const HOOK_EVENT_NAME = ${JSON.stringify(options.hookEventName)};`,
|
|
307
|
+
`const INTERRUPTED_SESSION_NOTE = ${JSON.stringify(INTERRUPTED_SESSION_NOTE)};`,
|
|
308
|
+
'',
|
|
309
|
+
hookRuntimeSnippet(),
|
|
310
|
+
'',
|
|
311
|
+
'let raw = "";',
|
|
312
|
+
'process.stdin.setEncoding("utf-8");',
|
|
313
|
+
'process.stdin.on("data", (chunk) => { raw += chunk; });',
|
|
314
|
+
'process.stdin.on("end", () => {',
|
|
315
|
+
' let cwd = process.cwd();',
|
|
316
|
+
' let agentId = "";',
|
|
317
|
+
' try {',
|
|
318
|
+
' const input = JSON.parse(raw);',
|
|
319
|
+
' if (typeof input.cwd === "string" && input.cwd.length > 0) {',
|
|
320
|
+
' cwd = input.cwd;',
|
|
321
|
+
' }',
|
|
322
|
+
' agentId = resolveAgentIdFromSession(input.session_id);',
|
|
323
|
+
' } catch (error) {}',
|
|
324
|
+
' const statePath = resolveStatePathForCwd(',
|
|
325
|
+
' path.resolve(cwd),',
|
|
326
|
+
' path.resolve(os.homedir()),',
|
|
327
|
+
' agentId,',
|
|
328
|
+
' );',
|
|
329
|
+
' const state = readStateEnvelope(statePath, (p) => fs.readFileSync(p, "utf-8"));',
|
|
330
|
+
' let contextSuffix = ' + JSON.stringify(options.contextSuffix) + ';',
|
|
331
|
+
...(interruptedCheck
|
|
332
|
+
? [
|
|
333
|
+
' const metaStatus = readSessionMetaStatus(',
|
|
334
|
+
' statePath.replace(/\\/+[^/]*$/, "") + "/.session-meta.json",',
|
|
335
|
+
' (p) => fs.readFileSync(p, "utf-8"),',
|
|
336
|
+
' );',
|
|
337
|
+
' if (metaStatus === "interrupted") {',
|
|
338
|
+
' contextSuffix += INTERRUPTED_SESSION_NOTE.replace("<path>", function () {',
|
|
339
|
+
' return statePath;',
|
|
340
|
+
' });',
|
|
341
|
+
' }',
|
|
342
|
+
]
|
|
343
|
+
: []),
|
|
344
|
+
' const output = {',
|
|
345
|
+
' hookSpecificOutput: {',
|
|
346
|
+
' hookEventName: HOOK_EVENT_NAME,',
|
|
347
|
+
' additionalContext: "Current skill state (JSON): " + JSON.stringify(state)',
|
|
348
|
+
' + contextSuffix,',
|
|
349
|
+
' },',
|
|
350
|
+
' };',
|
|
351
|
+
' process.stdout.write(JSON.stringify(output));',
|
|
352
|
+
'});',
|
|
353
|
+
'',
|
|
354
|
+
].join('\n');
|
|
434
355
|
}
|
|
435
356
|
/** PostToolUse script: extract state_patch, ⊕ merge, persist. */
|
|
436
357
|
buildPostToolUseScript(header) {
|
|
@@ -448,109 +369,9 @@ After each step, you MUST respond with a JSON block containing your State Patch
|
|
|
448
369
|
'const os = require("os");',
|
|
449
370
|
'const path = require("path");',
|
|
450
371
|
'',
|
|
451
|
-
'function isPlainObject(value) {',
|
|
452
|
-
' return typeof value === "object" && value !== null && !Array.isArray(value);',
|
|
453
|
-
'}',
|
|
454
|
-
'',
|
|
455
|
-
'function resolveStatePathForCwd(cwd) {',
|
|
456
|
-
' const resolvedCwd = path.resolve(cwd);',
|
|
457
|
-
' const resolvedHome = path.resolve(os.homedir());',
|
|
458
|
-
' if (resolvedCwd === resolvedHome) {',
|
|
459
|
-
' return path.join(resolvedHome, ".skillstate", "global", "skillstate.json");',
|
|
460
|
-
' }',
|
|
461
|
-
' return path.join(resolvedCwd, ".skillstate", "skillstate.json");',
|
|
462
|
-
'}',
|
|
463
|
-
'',
|
|
464
|
-
'function readState(statePath) {',
|
|
465
|
-
' try {',
|
|
466
|
-
' if (fs.existsSync(statePath)) {',
|
|
467
|
-
' const parsed = JSON.parse(fs.readFileSync(statePath, "utf-8"));',
|
|
468
|
-
' if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {',
|
|
469
|
-
' if (parsed.state !== null && typeof parsed.state === "object" && !Array.isArray(parsed.state)) {',
|
|
470
|
-
' return parsed.state;',
|
|
471
|
-
' }',
|
|
472
|
-
' return parsed;',
|
|
473
|
-
' }',
|
|
474
|
-
' }',
|
|
475
|
-
' } catch (error) {}',
|
|
476
|
-
' return {};',
|
|
477
|
-
'}',
|
|
478
|
-
'',
|
|
479
|
-
'// Paper ⊕ merge: null deletes a key, nested plain objects merge',
|
|
480
|
-
'// recursively, everything else replaces.',
|
|
481
|
-
'function mergePatch(base, patch) {',
|
|
482
|
-
' const result = { ...base };',
|
|
483
|
-
' for (const key of Object.keys(patch)) {',
|
|
484
|
-
' const value = patch[key];',
|
|
485
|
-
' if (value === null) {',
|
|
486
|
-
' delete result[key];',
|
|
487
|
-
' } else if (isPlainObject(value) && isPlainObject(result[key])) {',
|
|
488
|
-
' result[key] = mergePatch(result[key], value);',
|
|
489
|
-
' } else {',
|
|
490
|
-
' result[key] = value;',
|
|
491
|
-
' }',
|
|
492
|
-
' }',
|
|
493
|
-
' return result;',
|
|
494
|
-
'}',
|
|
495
|
-
'',
|
|
496
|
-
'function readResponseText(response) {',
|
|
497
|
-
' if (typeof response === "string") return response;',
|
|
498
|
-
' if (isPlainObject(response)) {',
|
|
499
|
-
' if (typeof response.content === "string") return response.content;',
|
|
500
|
-
' if (typeof response.text === "string") return response.text;',
|
|
501
|
-
' return JSON.stringify(response);',
|
|
502
|
-
' }',
|
|
503
|
-
' return response === null || response === undefined ? "" : String(response);',
|
|
504
|
-
'}',
|
|
505
|
-
'',
|
|
506
372
|
`const FENCE = ${JSON.stringify(fence)};`,
|
|
507
|
-
'const FENCE_RE = /' + '```' + 'json\\s*\\n?([\\s\\S]*?)\\n?\\s*' + '```' + '/;',
|
|
508
|
-
'// An open fence that never closes (truncated output) is still a patch',
|
|
509
|
-
'// attempt: match from ```json to end-of-text so it classifies as invalid.',
|
|
510
|
-
'const OPEN_FENCE_RE = /' + '```' + 'json\\s*\\n?([\\s\\S]+)$/',
|
|
511
373
|
'',
|
|
512
|
-
|
|
513
|
-
'// an object state_patch, { invalid: true } when a block exists but is',
|
|
514
|
-
'// malformed, { absent: true } when there is no block at all.',
|
|
515
|
-
'function findFencedPatch(text) {',
|
|
516
|
-
' const match = text.match(FENCE_RE) || text.match(OPEN_FENCE_RE);',
|
|
517
|
-
' if (!match) return { absent: true };',
|
|
518
|
-
' try {',
|
|
519
|
-
' const parsed = JSON.parse(match[1]);',
|
|
520
|
-
' if (isPlainObject(parsed) && isPlainObject(parsed.state_patch)) {',
|
|
521
|
-
' return { patch: parsed.state_patch };',
|
|
522
|
-
' }',
|
|
523
|
-
' } catch (error) {}',
|
|
524
|
-
' return { invalid: true };',
|
|
525
|
-
'}',
|
|
526
|
-
'',
|
|
527
|
-
'// Fallback: a raw JSON object with state_patch anywhere in the text.',
|
|
528
|
-
'// Ordinary JSON output without a state_patch key is simply not a patch.',
|
|
529
|
-
'function findRawPatch(text) {',
|
|
530
|
-
' const trimmed = text.trim();',
|
|
531
|
-
' const candidates = [];',
|
|
532
|
-
' try {',
|
|
533
|
-
' candidates.push(JSON.parse(trimmed));',
|
|
534
|
-
' } catch (error) {}',
|
|
535
|
-
' const first = trimmed.indexOf("{");',
|
|
536
|
-
' const last = trimmed.lastIndexOf("}");',
|
|
537
|
-
' if (first !== -1 && last > first) {',
|
|
538
|
-
' try {',
|
|
539
|
-
' candidates.push(JSON.parse(trimmed.slice(first, last + 1)));',
|
|
540
|
-
' } catch (error) {}',
|
|
541
|
-
' }',
|
|
542
|
-
' for (const candidate of candidates) {',
|
|
543
|
-
' if (isPlainObject(candidate)) {',
|
|
544
|
-
' if (isPlainObject(candidate.state_patch)) {',
|
|
545
|
-
' return { patch: candidate.state_patch };',
|
|
546
|
-
' }',
|
|
547
|
-
' if (Object.prototype.hasOwnProperty.call(candidate, "state_patch")) {',
|
|
548
|
-
' return { invalid: true };',
|
|
549
|
-
' }',
|
|
550
|
-
' }',
|
|
551
|
-
' }',
|
|
552
|
-
' return { absent: true };',
|
|
553
|
-
'}',
|
|
374
|
+
hookRuntimeSnippet(),
|
|
554
375
|
'',
|
|
555
376
|
'let raw = "";',
|
|
556
377
|
'process.stdin.setEncoding("utf-8");',
|
|
@@ -563,7 +384,11 @@ After each step, you MUST respond with a JSON block containing your State Patch
|
|
|
563
384
|
' if (typeof input.cwd === "string" && input.cwd.length > 0) {',
|
|
564
385
|
' cwd = input.cwd;',
|
|
565
386
|
' }',
|
|
566
|
-
' const statePath = resolveStatePathForCwd(
|
|
387
|
+
' const statePath = resolveStatePathForCwd(',
|
|
388
|
+
' path.resolve(cwd),',
|
|
389
|
+
' path.resolve(os.homedir()),',
|
|
390
|
+
' resolveAgentIdFromSession(input.session_id),',
|
|
391
|
+
' );',
|
|
567
392
|
' const response = input.tool_response;',
|
|
568
393
|
' let result;',
|
|
569
394
|
' if (isPlainObject(response) && isPlainObject(response.state_patch)) {',
|
|
@@ -574,10 +399,15 @@ After each step, you MUST respond with a JSON block containing your State Patch
|
|
|
574
399
|
' if (result.absent) result = findRawPatch(text);',
|
|
575
400
|
' }',
|
|
576
401
|
' if (result.patch !== undefined) {',
|
|
577
|
-
' const merged = mergePatch(readState(statePath), result.patch);',
|
|
578
402
|
' try {',
|
|
579
403
|
' fs.mkdirSync(path.dirname(statePath), { recursive: true });',
|
|
580
|
-
'
|
|
404
|
+
' lockStateWrite(statePath, fs, () => {',
|
|
405
|
+
' const merged = mergePatch(',
|
|
406
|
+
' readStateEnvelope(statePath, (p) => fs.readFileSync(p, "utf-8")),',
|
|
407
|
+
' result.patch,',
|
|
408
|
+
' );',
|
|
409
|
+
' saveStateEnvelope(statePath, merged, (p, data) => fs.writeFileSync(p, data));',
|
|
410
|
+
' });',
|
|
581
411
|
' } catch (writeError) {',
|
|
582
412
|
" output.systemMessage = 'skillstate: failed to persist state (' + writeError.message + ')';",
|
|
583
413
|
' }',
|
|
@@ -596,12 +426,6 @@ After each step, you MUST respond with a JSON block containing your State Patch
|
|
|
596
426
|
'',
|
|
597
427
|
].join('\n');
|
|
598
428
|
}
|
|
599
|
-
describeSchema(schema) {
|
|
600
|
-
const fields = Object.entries(schema)
|
|
601
|
-
.map(([name, field]) => `- ${name} (${field.type}): ${field.description ?? 'no description'}`)
|
|
602
|
-
.join('\n');
|
|
603
|
-
return `## Schema\n${fields}`;
|
|
604
|
-
}
|
|
605
429
|
}
|
|
606
430
|
/**
|
|
607
431
|
* Surgically remove every skillstate hook handler from an existing
|
|
@@ -627,7 +451,7 @@ export function removeSkillstateHookGroups(existingJson) {
|
|
|
627
451
|
catch {
|
|
628
452
|
return { text: existingJson, changed: false };
|
|
629
453
|
}
|
|
630
|
-
if (!
|
|
454
|
+
if (!isPlainObject(doc) || !isPlainObject(doc['hooks'])) {
|
|
631
455
|
return { text: existingJson, changed: false };
|
|
632
456
|
}
|
|
633
457
|
const scriptBasenames = CLAUDE_HOOK_EVENTS.map((event) => `${event}.cjs`);
|
|
@@ -641,12 +465,12 @@ export function removeSkillstateHookGroups(existingJson) {
|
|
|
641
465
|
const keptGroups = [];
|
|
642
466
|
let eventChanged = false;
|
|
643
467
|
for (const group of groups) {
|
|
644
|
-
if (!
|
|
468
|
+
if (!isPlainObject(group) || !Array.isArray(group['hooks'])) {
|
|
645
469
|
keptGroups.push(group);
|
|
646
470
|
continue;
|
|
647
471
|
}
|
|
648
472
|
const handlers = group['hooks'];
|
|
649
|
-
const keptHandlers = handlers.filter((handler) => !(
|
|
473
|
+
const keptHandlers = handlers.filter((handler) => !(isPlainObject(handler) && isSkillstateCommand(handler['command'])));
|
|
650
474
|
if (keptHandlers.length === handlers.length) {
|
|
651
475
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