@goodfoot/agent-hooks 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -124,8 +124,8 @@ export default defineOpenCodePlugin({
124
124
  event: guardAdvisory('event', async ({ event }) => {
125
125
  if (event.type === 'session.created') {
126
126
  sessions.observe(event.properties.info.id, event.properties.info.parentID);
127
- } else {
128
- sessions.observeResumed(event.properties.info?.id ?? '');
127
+ } else if (event.type === 'session.updated') {
128
+ sessions.observeResumed(event.properties.info.id, event.properties.info.parentID);
129
129
  }
130
130
  }, 'continue'),
131
131
 
@@ -1,6 +1,7 @@
1
1
  import * as fs from "node:fs";
2
2
  import * as path from "node:path";
3
3
  import { HOOK_FACTORY_TO_EVENT, PACKAGE_NAME } from "./constants.js";
4
+ const CODEX_IMPORT_SPECIFIER = `${PACKAGE_NAME}/codex`;
4
5
  const VALID_HOOK_EVENT_NAMES = new Set(Object.values(HOOK_FACTORY_TO_EVENT));
5
6
  const EVENT_LOOKUP = new Map(Array.from(VALID_HOOK_EVENT_NAMES).map((value) => [value.toLowerCase(), value]));
6
7
  const EVENT_TO_FACTORY = Object.fromEntries(Object.entries(HOOK_FACTORY_TO_EVENT).map(([factory, eventName]) => [eventName, factory]));
@@ -54,7 +55,7 @@ function generatePackageJson(projectName, outputPath) {
54
55
  typecheck: "tsc --noEmit",
55
56
  },
56
57
  dependencies: {
57
- [PACKAGE_NAME]: "^1.0.2",
58
+ [PACKAGE_NAME]: "^1.0.3",
58
59
  },
59
60
  devDependencies: {
60
61
  "@biomejs/biome": "2.4.9",
@@ -130,7 +131,7 @@ function generateHookSource(eventName) {
130
131
  const importItems = [factory, output].join(", ");
131
132
  switch (eventName) {
132
133
  case "PreToolUse":
133
- return `import { ${importItems} } from "${PACKAGE_NAME}";
134
+ return `import { ${importItems} } from "${CODEX_IMPORT_SPECIFIER}";
134
135
 
135
136
  export default ${factory}({ matcher: "Bash" }, (input) => {
136
137
  if (input.tool_input.command.includes("rm -rf")) {
@@ -143,7 +144,7 @@ export default ${factory}({ matcher: "Bash" }, (input) => {
143
144
  });
144
145
  `;
145
146
  case "PostToolUse":
146
- return `import { ${importItems} } from "${PACKAGE_NAME}";
147
+ return `import { ${importItems} } from "${CODEX_IMPORT_SPECIFIER}";
147
148
 
148
149
  export default ${factory}({ matcher: "Bash" }, (input) => {
149
150
  return ${output}({
@@ -152,7 +153,7 @@ export default ${factory}({ matcher: "Bash" }, (input) => {
152
153
  });
153
154
  `;
154
155
  case "SessionStart":
155
- return `import { ${importItems} } from "${PACKAGE_NAME}";
156
+ return `import { ${importItems} } from "${CODEX_IMPORT_SPECIFIER}";
156
157
 
157
158
  export default ${factory}({ matcher: "startup" }, () => {
158
159
  return ${output}({
@@ -161,7 +162,7 @@ export default ${factory}({ matcher: "startup" }, () => {
161
162
  });
162
163
  `;
163
164
  case "UserPromptSubmit":
164
- return `import { ${importItems} } from "${PACKAGE_NAME}";
165
+ return `import { ${importItems} } from "${CODEX_IMPORT_SPECIFIER}";
165
166
 
166
167
  export default ${factory}({}, (input) => {
167
168
  if (input.prompt.trim().length === 0) {
@@ -173,7 +174,7 @@ export default ${factory}({}, (input) => {
173
174
  });
174
175
  `;
175
176
  case "Stop":
176
- return `import { ${importItems} } from "${PACKAGE_NAME}";
177
+ return `import { ${importItems} } from "${CODEX_IMPORT_SPECIFIER}";
177
178
 
178
179
  export default ${factory}({}, (input) => {
179
180
  if (input.stop_hook_active && input.last_assistant_message === null) {
@@ -185,7 +186,7 @@ export default ${factory}({}, (input) => {
185
186
  });
186
187
  `;
187
188
  case "PermissionRequest":
188
- return `import { ${importItems} } from "${PACKAGE_NAME}";
189
+ return `import { ${importItems} } from "${CODEX_IMPORT_SPECIFIER}";
189
190
 
190
191
  export default ${factory}({ matcher: "Bash" }, (input) => {
191
192
  return ${output}({
@@ -195,7 +196,7 @@ export default ${factory}({ matcher: "Bash" }, (input) => {
195
196
  });
196
197
  `;
197
198
  case "SubagentStart":
198
- return `import { ${importItems} } from "${PACKAGE_NAME}";
199
+ return `import { ${importItems} } from "${CODEX_IMPORT_SPECIFIER}";
199
200
 
200
201
  export default ${factory}({ matcher: ".*" }, (input) => {
201
202
  return ${output}({
@@ -204,7 +205,7 @@ export default ${factory}({ matcher: ".*" }, (input) => {
204
205
  });
205
206
  `;
206
207
  case "SubagentStop":
207
- return `import { ${importItems} } from "${PACKAGE_NAME}";
208
+ return `import { ${importItems} } from "${CODEX_IMPORT_SPECIFIER}";
208
209
 
209
210
  export default ${factory}({ matcher: ".*" }, (input) => {
210
211
  if (input.last_assistant_message === null) {
@@ -216,7 +217,7 @@ export default ${factory}({ matcher: ".*" }, (input) => {
216
217
  });
217
218
  `;
218
219
  case "PreCompact":
219
- return `import { ${importItems} } from "${PACKAGE_NAME}";
220
+ return `import { ${importItems} } from "${CODEX_IMPORT_SPECIFIER}";
220
221
 
221
222
  export default ${factory}({ matcher: "manual" }, () => {
222
223
  return ${output}({
@@ -225,7 +226,7 @@ export default ${factory}({ matcher: "manual" }, () => {
225
226
  });
226
227
  `;
227
228
  case "PostCompact":
228
- return `import { ${importItems} } from "${PACKAGE_NAME}";
229
+ return `import { ${importItems} } from "${CODEX_IMPORT_SPECIFIER}";
229
230
 
230
231
  export default ${factory}({ matcher: "manual" }, () => {
231
232
  return ${output}({
package/dist/cli.js CHANGED
@@ -26,7 +26,7 @@ import { scaffoldProject } from "./scaffold.js";
26
26
  // ============================================================================
27
27
  // Constants
28
28
  // ============================================================================
29
- const VERSION = "1.0.2";
29
+ const VERSION = "1.0.3";
30
30
  const DEFAULT_ESBUILD_LOADERS = {
31
31
  ".md": "text",
32
32
  };
package/dist/scaffold.js CHANGED
@@ -131,7 +131,7 @@ function generatePackageJson(projectName, outputPath) {
131
131
  typecheck: "tsc --noEmit",
132
132
  },
133
133
  dependencies: {
134
- "@goodfoot/agent-hooks": "^1.0.2",
134
+ "@goodfoot/agent-hooks": "^1.0.3",
135
135
  },
136
136
  devDependencies: {
137
137
  "@biomejs/biome": "2.4.16",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodfoot/agent-hooks",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Unified agent hooks library: shared core runtime with per-agent entry points for Claude Code, Codex, and Antigravity",
5
5
  "homepage": "https://github.com/goodfoot-io/marketplace/tree/main/packages/agent-hooks",
6
6
  "repository": {