@ascenda-one/codex-hooks 0.1.19 → 0.1.20

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
@@ -55,7 +55,7 @@ default, so pass the flag unless you mean one repo.
55
55
  ### 2. Check it
56
56
 
57
57
  ```bash
58
- npx @ascenda-one/codex-hooks status
58
+ npx @ascenda-one/codex-hooks status --scope user
59
59
  ```
60
60
 
61
61
  Names the pairing, the binary and how many of the 7 events are registered.
@@ -64,12 +64,19 @@ Exits non-zero when something is missing, so it can gate a CI step.
64
64
  To undo everything it wrote:
65
65
 
66
66
  ```bash
67
- npx @ascenda-one/codex-hooks uninstall
67
+ npx @ascenda-one/codex-hooks uninstall --scope user
68
68
  ```
69
69
 
70
- ### 3. Restart Codex
70
+ ### 3. Restart Codex and review hooks
71
71
 
72
- Hooks are read at startup.
72
+ Open `/hooks` in the Codex CLI and review and trust the Ascenda commands.
73
+ Codex skips untrusted hooks; registration and workspace trust alone do not
74
+ authorize them. Changes to a hook definition require review again. See the
75
+ [Codex hook trust reference](https://learn.chatgpt.com/docs/hooks).
76
+
77
+ The setup command registers hooks but does not write Codex trust hashes or
78
+ bypass review. A successful `status` checks installation, not runtime trust
79
+ or accepted delivery.
73
80
 
74
81
  ### On a Dev backend with no phone
75
82
 
@@ -98,17 +105,22 @@ timeout = 10
98
105
  ```
99
106
 
100
107
  A hand-merged file still needs a pairing — run `setup` for that, or export
101
- `ASCENDA_TOOL_INSTALLATION_ID` yourself. The environment variable wins over
102
- the credentials file when both are present, so exporting one id on a machine
103
- running two agents sends both agents' work under it.
108
+ `ASCENDA_TOOL_INSTALLATION_ID` yourself. A matching `cli_agent:` id or an unqualified id overrides the credentials
109
+ file. An id qualified for another tool type, such as `claude_code:`, is ignored
110
+ so a shell-wide setting cannot redirect Codex events to that pairing. Multiple
111
+ agents using `cli_agent` should use per-host credentials instead of a shared
112
+ environment override.
104
113
 
105
114
  ### Verify
106
115
 
107
116
  Run a Codex session, then read the send journal at
108
- `~/.ascenda/state/<installationId>.json`. It records every attempt including
109
- failures, so an absent file means "never ran" rather than "ran and failed" —
110
- which is the distinction the hook's own exit code cannot give you, since it
111
- always exits `0` (see the safety contract above).
117
+ `~/.ascenda/state/<installationId>.json`. Look for `lastOutcome: "accepted"` and a fresh attempt timestamp. The journal
118
+ records delivery attempts under the resolved installation id, not hook process
119
+ starts. An absent expected journal can also mean a different identity was
120
+ selected, input processing failed before delivery, or the hook mapped to no
121
+ event. Check the local event log for `metadata.host: "codex"` and confirm its
122
+ `toolInstallationId` matches `tools.codex` in the credentials file. The hook
123
+ always exits `0`, so its exit code alone cannot prove delivery.
112
124
 
113
125
  Set `ASCENDA_EVENT_LOG_FILE` to also log each payload locally.
114
126
 
package/dist/cli.js CHANGED
@@ -2672,10 +2672,10 @@ var require_hookAdapter = __commonJS({
2672
2672
  exports.MissingInstallationIdError = MissingInstallationIdError;
2673
2673
  function resolveCliAgentInstallationId(toolType, identity = {}) {
2674
2674
  const fromEnv = process.env.ASCENDA_TOOL_INSTALLATION_ID?.trim();
2675
- if (fromEnv)
2675
+ if (fromEnv && belongsToToolType(toolType, fromEnv))
2676
2676
  return { toolInstallationId: qualify(toolType, fromEnv), source: "env" };
2677
2677
  const fromCredentials = identity.host ? (0, credentials_1.readHostCredentials)(identity.host)?.toolInstallationId?.trim() : void 0;
2678
- if (fromCredentials)
2678
+ if (fromCredentials && belongsToToolType(toolType, fromCredentials))
2679
2679
  return { toolInstallationId: qualify(toolType, fromCredentials), source: "credentials" };
2680
2680
  const candidates = (0, tokenStore_1.listPersistedToolInstallationIds)(toolType);
2681
2681
  if (candidates.length === 1)
@@ -2685,6 +2685,9 @@ var require_hookAdapter = __commonJS({
2685
2685
  function defaultSetupCommand(host) {
2686
2686
  return host ? `npx @ascenda-one/${host.replace(/_cli$/, "")}-hooks setup` : "the agent's setup command";
2687
2687
  }
2688
+ function belongsToToolType(toolType, value) {
2689
+ return !value.includes(":") || value.startsWith(`${toolType}:`);
2690
+ }
2688
2691
  function qualify(toolType, value) {
2689
2692
  return value.includes(":") ? value : `${toolType}:${value}`;
2690
2693
  }
@@ -3893,7 +3896,7 @@ var SETUP = {
3893
3896
  packageName: "@ascenda-one/codex-hooks",
3894
3897
  binaryName: "ascenda-codex-hook",
3895
3898
  hookEvents: HOOK_EVENTS,
3896
- restartHint: "Restart Codex to load the hooks.",
3899
+ restartHint: "Restart Codex, then open /hooks to review and trust the Ascenda hooks. Registration alone does not enable execution. After a session, verify the cli_agent send journal and metadata.host: codex in the event log.",
3897
3900
  settings: {
3898
3901
  settingsPath: (scope, projectDir) => scope === "user" ? path.join(os.homedir(), ".codex", "hooks.json") : path.join(projectDir, ".codex", "hooks.json"),
3899
3902
  // Codex nests as Gemini does — each event maps to an array of
package/dist/setup.js CHANGED
@@ -27,7 +27,7 @@ export const SETUP = {
27
27
  packageName: "@ascenda-one/codex-hooks",
28
28
  binaryName: "ascenda-codex-hook",
29
29
  hookEvents: HOOK_EVENTS,
30
- restartHint: "Restart Codex to load the hooks.",
30
+ restartHint: "Restart Codex, then open /hooks to review and trust the Ascenda hooks. Registration alone does not enable execution. After a session, verify the cli_agent send journal and metadata.host: codex in the event log.",
31
31
  settings: {
32
32
  settingsPath: (scope, projectDir) => scope === "user" ? path.join(os.homedir(), ".codex", "hooks.json") : path.join(projectDir, ".codex", "hooks.json"),
33
33
  // Codex nests as Gemini does — each event maps to an array of
package/dist/setup.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,cAAc;IACd,kBAAkB;IAClB,YAAY,EAAE,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ClD,MAAM,OAAO,GAAG,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,EAAE,OAAO,KAAK,QAAQ,CAAC,EAAE,OAAO,CAAC;YACzF,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3D,CAAC;KACF;CACF,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "publishConfig": { "access": "public" },
3
3
  "name": "@ascenda-one/codex-hooks",
4
- "version": "0.1.19",
4
+ "version": "0.1.20",
5
5
  "description": "OpenAI Codex hooks adapter for Ascenda AI workload telemetry",
6
6
  "repository": {
7
7
  "type": "git",