@ascenda-one/codex-hooks 0.1.25 → 0.1.27
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 +6 -1
- package/dist/cli.js +91 -31
- package/dist/mapCodexEvent.js +11 -1
- package/dist/mapCodexEvent.js.map +1 -1
- package/dist/setup.js +14 -4
- package/dist/setup.js.map +1 -1
- package/examples/hooks.json +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -149,7 +149,12 @@ Codex's PATH, use the absolute path to the binary.
|
|
|
149
149
|
|
|
150
150
|
## Supported Codex hook events
|
|
151
151
|
|
|
152
|
-
`SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `PreCompact`, `PostCompact`, `Stop
|
|
152
|
+
`SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `PreCompact`, `PostCompact`, `Stop`, `PermissionRequest`. (`SubagentStart` and `SubagentStop` have no catalog counterpart and are skipped.)
|
|
153
|
+
|
|
154
|
+
`PermissionRequest` records that the agent stopped at an approval gate, and
|
|
155
|
+
nothing about what it was asking to do — one field, `interruptionKind:
|
|
156
|
+
"permission_request"`. The command, its arguments and the paths involved are
|
|
157
|
+
never read.
|
|
153
158
|
|
|
154
159
|
## Turn duration
|
|
155
160
|
|
package/dist/cli.js
CHANGED
|
@@ -540,6 +540,10 @@ var require_metricKeys = __commonJS({
|
|
|
540
540
|
orphanedBubbles: { readBy: ["diagnostic"] },
|
|
541
541
|
orphanedSubagentBubbles: { readBy: ["diagnostic"] },
|
|
542
542
|
sessionsWithoutTimeline: { readBy: ["diagnostic"] },
|
|
543
|
+
sessionsWithOnlyInheritedLines: {
|
|
544
|
+
readBy: ["diagnostic"],
|
|
545
|
+
note: "Claude Code transcripts holding nothing but a copy of an ancestor's history, so no line's instant is theirs and no session is emitted for them. Excluded by rule, not a read failure: the work is in the transcript that owns it."
|
|
546
|
+
},
|
|
543
547
|
emptyComposers: { readBy: ["diagnostic"] },
|
|
544
548
|
apiErrorCount: { readBy: ["diagnostic"] },
|
|
545
549
|
assistantTurns: { readBy: ["diagnostic"] },
|
|
@@ -735,6 +739,16 @@ var require_out = __commonJS({
|
|
|
735
739
|
// `ai_prompt_submitted` closes. Neutral so a marker sent once per turn
|
|
736
740
|
// doesn't weigh on any workload leg.
|
|
737
741
|
ai_turn_completed: "neutral",
|
|
742
|
+
// The agent stopped and is waiting on the person: Claude Code's
|
|
743
|
+
// `Notification`, Codex's `PermissionRequest`. Supervision, beside the other
|
|
744
|
+
// oversight overhead, because that is what it is — time the person spends
|
|
745
|
+
// attending to the agent rather than to the work.
|
|
746
|
+
//
|
|
747
|
+
// Deliberately NOT risk. Risk is the leg that reads as something going
|
|
748
|
+
// wrong, and being asked is not a failure; classifying it there is the first
|
|
749
|
+
// step toward an interruption count becoming a score, a streak, or something
|
|
750
|
+
// that fires on a miss. It must never become any of those.
|
|
751
|
+
supervision_interruption: "supervision",
|
|
738
752
|
// Semantic (agent-observed) — see SEMANTIC_WORK_SIGNAL_EVENT_TYPES.
|
|
739
753
|
approach_churn_detected: "risk",
|
|
740
754
|
goal_drift_detected: "risk",
|
|
@@ -3349,16 +3363,20 @@ var require_liveBus = __commonJS({
|
|
|
3349
3363
|
path2.join(home, "Library", "Containers", SAVER_HOST_BUNDLE_ID, "Data", "l.sock")
|
|
3350
3364
|
];
|
|
3351
3365
|
}
|
|
3352
|
-
function
|
|
3366
|
+
function existingSocketCandidates() {
|
|
3353
3367
|
const candidates = liveBusSocketCandidates();
|
|
3354
|
-
|
|
3368
|
+
if (process.env.ASCENDA_LIVE_BUS_SOCKET)
|
|
3369
|
+
return candidates;
|
|
3370
|
+
return candidates.filter((candidate) => {
|
|
3355
3371
|
try {
|
|
3356
|
-
|
|
3357
|
-
return candidate;
|
|
3372
|
+
return fs.statSync(candidate).isSocket();
|
|
3358
3373
|
} catch {
|
|
3374
|
+
return false;
|
|
3359
3375
|
}
|
|
3360
|
-
}
|
|
3361
|
-
|
|
3376
|
+
});
|
|
3377
|
+
}
|
|
3378
|
+
function liveBusSocketPath() {
|
|
3379
|
+
return existingSocketCandidates()[0] ?? liveBusSocketCandidates()[0];
|
|
3362
3380
|
}
|
|
3363
3381
|
function bucketPromptSize2(text) {
|
|
3364
3382
|
const length = typeof text === "string" ? text.length : 0;
|
|
@@ -3370,44 +3388,75 @@ var require_liveBus = __commonJS({
|
|
|
3370
3388
|
return "l";
|
|
3371
3389
|
return "xl";
|
|
3372
3390
|
}
|
|
3391
|
+
var NOBODY_LISTENING = /* @__PURE__ */ new Set(["ECONNREFUSED", "ENOENT"]);
|
|
3373
3392
|
function emitLiveSignal2(signal) {
|
|
3374
3393
|
return new Promise((resolve) => {
|
|
3394
|
+
const candidates = existingSocketCandidates();
|
|
3395
|
+
if (candidates.length === 0) {
|
|
3396
|
+
resolve();
|
|
3397
|
+
return;
|
|
3398
|
+
}
|
|
3375
3399
|
let settled = false;
|
|
3400
|
+
let socket;
|
|
3401
|
+
const drop = () => {
|
|
3402
|
+
try {
|
|
3403
|
+
socket?.destroy();
|
|
3404
|
+
} catch {
|
|
3405
|
+
}
|
|
3406
|
+
socket = void 0;
|
|
3407
|
+
};
|
|
3376
3408
|
const done = () => {
|
|
3377
3409
|
if (settled)
|
|
3378
3410
|
return;
|
|
3379
3411
|
settled = true;
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
} catch {
|
|
3383
|
-
}
|
|
3412
|
+
clearTimeout(timer);
|
|
3413
|
+
drop();
|
|
3384
3414
|
resolve();
|
|
3385
3415
|
};
|
|
3386
|
-
let socket;
|
|
3387
|
-
try {
|
|
3388
|
-
socket = net.createConnection(liveBusSocketPath());
|
|
3389
|
-
} catch {
|
|
3390
|
-
resolve();
|
|
3391
|
-
return;
|
|
3392
|
-
}
|
|
3393
3416
|
const timer = setTimeout(done, WRITE_TIMEOUT_MS);
|
|
3394
3417
|
if (typeof timer.unref === "function")
|
|
3395
3418
|
timer.unref();
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3419
|
+
const tryFrom = (index) => {
|
|
3420
|
+
if (settled)
|
|
3421
|
+
return;
|
|
3422
|
+
if (index >= candidates.length) {
|
|
3423
|
+
done();
|
|
3424
|
+
return;
|
|
3425
|
+
}
|
|
3426
|
+
let attempt;
|
|
3400
3427
|
try {
|
|
3401
|
-
|
|
3402
|
-
`, () => {
|
|
3403
|
-
clearTimeout(timer);
|
|
3404
|
-
done();
|
|
3405
|
-
});
|
|
3428
|
+
attempt = net.createConnection(candidates[index]);
|
|
3406
3429
|
} catch {
|
|
3407
|
-
|
|
3408
|
-
|
|
3430
|
+
tryFrom(index + 1);
|
|
3431
|
+
return;
|
|
3409
3432
|
}
|
|
3410
|
-
|
|
3433
|
+
socket = attempt;
|
|
3434
|
+
if (typeof attempt.unref === "function")
|
|
3435
|
+
attempt.unref();
|
|
3436
|
+
let connected = false;
|
|
3437
|
+
attempt.on("error", (error) => {
|
|
3438
|
+
if (settled || socket !== attempt)
|
|
3439
|
+
return;
|
|
3440
|
+
if (!connected && error.code && NOBODY_LISTENING.has(error.code)) {
|
|
3441
|
+
drop();
|
|
3442
|
+
tryFrom(index + 1);
|
|
3443
|
+
return;
|
|
3444
|
+
}
|
|
3445
|
+
done();
|
|
3446
|
+
});
|
|
3447
|
+
attempt.on("connect", () => {
|
|
3448
|
+
if (settled || socket !== attempt)
|
|
3449
|
+
return;
|
|
3450
|
+
connected = true;
|
|
3451
|
+
try {
|
|
3452
|
+
attempt.write(`${JSON.stringify(signal)}
|
|
3453
|
+
`, done);
|
|
3454
|
+
} catch {
|
|
3455
|
+
done();
|
|
3456
|
+
}
|
|
3457
|
+
});
|
|
3458
|
+
};
|
|
3459
|
+
tryFrom(0);
|
|
3411
3460
|
});
|
|
3412
3461
|
}
|
|
3413
3462
|
}
|
|
@@ -3803,8 +3852,18 @@ function mapEvent(hookName, input, turnDurationMs) {
|
|
|
3803
3852
|
return [{ eventType: "context_pressure_high", severity: "medium", metadata: withHost({ trigger: "inferred", reason: "context_limit" }) }];
|
|
3804
3853
|
case "Stop":
|
|
3805
3854
|
return mapStop(input, turnDurationMs);
|
|
3806
|
-
//
|
|
3855
|
+
// Codex's approval gate: the agent has stopped and is waiting for the
|
|
3856
|
+
// person to allow something. Same leg as Claude Code's `Notification`, and
|
|
3857
|
+
// unambiguous in a way that one is not — this hook fires for approvals and
|
|
3858
|
+
// nothing else, so the kind is a constant rather than a guess at wording.
|
|
3859
|
+
//
|
|
3860
|
+
// No part of the request is read. What is being approved would make this
|
|
3861
|
+
// content-derived and move it out of the `ide_telemetry` scope it rides;
|
|
3862
|
+
// the count is that a gate was reached, when, and in which session.
|
|
3807
3863
|
case "PermissionRequest":
|
|
3864
|
+
return [{ eventType: "supervision_interruption", severity: "low", metadata: withHost({ interruptionKind: "permission_request" }) }];
|
|
3865
|
+
// The subagent lifecycle is still deliberately unmapped: it is not an
|
|
3866
|
+
// interruption of the person, and it is out of scope here.
|
|
3808
3867
|
case "SubagentStart":
|
|
3809
3868
|
case "SubagentStop":
|
|
3810
3869
|
return [];
|
|
@@ -3932,7 +3991,8 @@ var HOOK_EVENTS = [
|
|
|
3932
3991
|
"PostToolUse",
|
|
3933
3992
|
"PreCompact",
|
|
3934
3993
|
"PostCompact",
|
|
3935
|
-
"Stop"
|
|
3994
|
+
"Stop",
|
|
3995
|
+
"PermissionRequest"
|
|
3936
3996
|
];
|
|
3937
3997
|
var HOOK_TIMEOUT_SECONDS = 10;
|
|
3938
3998
|
var SETUP = {
|
package/dist/mapCodexEvent.js
CHANGED
|
@@ -38,8 +38,18 @@ function mapEvent(hookName, input, turnDurationMs) {
|
|
|
38
38
|
// absence is the payload's, not a decision of ours.
|
|
39
39
|
case "PostCompact": return [{ eventType: "context_pressure_high", severity: "medium", metadata: withHost({ trigger: "inferred", reason: "context_limit" }) }];
|
|
40
40
|
case "Stop": return mapStop(input, turnDurationMs);
|
|
41
|
-
//
|
|
41
|
+
// Codex's approval gate: the agent has stopped and is waiting for the
|
|
42
|
+
// person to allow something. Same leg as Claude Code's `Notification`, and
|
|
43
|
+
// unambiguous in a way that one is not — this hook fires for approvals and
|
|
44
|
+
// nothing else, so the kind is a constant rather than a guess at wording.
|
|
45
|
+
//
|
|
46
|
+
// No part of the request is read. What is being approved would make this
|
|
47
|
+
// content-derived and move it out of the `ide_telemetry` scope it rides;
|
|
48
|
+
// the count is that a gate was reached, when, and in which session.
|
|
42
49
|
case "PermissionRequest":
|
|
50
|
+
return [{ eventType: "supervision_interruption", severity: "low", metadata: withHost({ interruptionKind: "permission_request" }) }];
|
|
51
|
+
// The subagent lifecycle is still deliberately unmapped: it is not an
|
|
52
|
+
// interruption of the person, and it is out of scope here.
|
|
43
53
|
case "SubagentStart":
|
|
44
54
|
case "SubagentStop":
|
|
45
55
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapCodexEvent.js","sourceRoot":"","sources":["../src/mapCodexEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,SAAS,EACT,eAAe,EACf,SAAS,EACT,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAwD,MAAM,YAAY,CAAC;AAE9F;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAAC,QAA4B,EAAE,KAAqB,EAAE,cAAuB;IACxG,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;IACzD,yEAAyE;IACzE,wDAAwD;IACxD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IAEvC,MAAM,UAAU,GAAG,sBAAsB,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACtF,IAAI,CAAC,UAAU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EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,QAAQ,EAAkC,CAAC;AAC3E,CAAC"}
|
package/dist/setup.js
CHANGED
|
@@ -2,16 +2,26 @@ import * as os from "os";
|
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import { ASCENDA_TOOL_TYPE, CODEX_HOST } from "./types.js";
|
|
4
4
|
/**
|
|
5
|
-
* Only the hooks that map to a catalog event
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Only the hooks that map to a catalog event — and this list moves with the
|
|
6
|
+
* mapper, never after it. A hook mapped here but absent there sends nothing; a
|
|
7
|
+
* hook mapped there but absent here never fires at all, which is how Claude
|
|
8
|
+
* Code's `PostToolUseFailure` reported zero failures for months.
|
|
9
|
+
*
|
|
10
|
+
* `PermissionRequest` is Codex's approval gate: the agent has stopped and is
|
|
11
|
+
* waiting on the person. It now maps to `supervision_interruption`, the same
|
|
12
|
+
* leg as Claude Code's `Notification`. One process per approval is bounded by
|
|
13
|
+
* how often a human is asked, not by tool volume.
|
|
14
|
+
*
|
|
15
|
+
* The subagent lifecycle pair stays unregistered: it maps to nothing, and a
|
|
16
|
+
* subagent starting is not an interruption of the person.
|
|
8
17
|
*/
|
|
9
18
|
export const HOOK_EVENTS = [
|
|
10
19
|
"SessionStart",
|
|
11
20
|
"UserPromptSubmit",
|
|
12
21
|
"PreToolUse", "PostToolUse",
|
|
13
22
|
"PreCompact", "PostCompact",
|
|
14
|
-
"Stop"
|
|
23
|
+
"Stop",
|
|
24
|
+
"PermissionRequest"
|
|
15
25
|
];
|
|
16
26
|
/**
|
|
17
27
|
* Matches the timeout in `examples/hooks.json`, so a hand-merged file and a
|
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;AAE7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BAAoB,EAAE,CAAC,EAAE,CAAC;QAC5H,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YACnB,MAAM,KAAK,GAAG,KAAmC,CAAC;YAClD,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/examples/hooks.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"PostToolUse": [{ "hooks": [{ "type": "command", "command": "npx -y @ascenda-one/codex-hooks PostToolUse", "timeout": 10 }] }],
|
|
7
7
|
"PreCompact": [{ "hooks": [{ "type": "command", "command": "npx -y @ascenda-one/codex-hooks PreCompact", "timeout": 10 }] }],
|
|
8
8
|
"PostCompact": [{ "hooks": [{ "type": "command", "command": "npx -y @ascenda-one/codex-hooks PostCompact", "timeout": 10 }] }],
|
|
9
|
-
"Stop": [{ "hooks": [{ "type": "command", "command": "npx -y @ascenda-one/codex-hooks Stop", "timeout": 10 }] }]
|
|
9
|
+
"Stop": [{ "hooks": [{ "type": "command", "command": "npx -y @ascenda-one/codex-hooks Stop", "timeout": 10 }] }],
|
|
10
|
+
"PermissionRequest": [{ "hooks": [{ "type": "command", "command": "npx -y @ascenda-one/codex-hooks PermissionRequest", "timeout": 10 }] }]
|
|
10
11
|
}
|
|
11
12
|
}
|
package/package.json
CHANGED