@ghl-ai/aw 0.1.37-beta.78 → 0.1.37-beta.79
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/integrate.mjs +21 -10
- package/package.json +1 -1
package/integrate.mjs
CHANGED
|
@@ -669,25 +669,36 @@ export function installIdeHooks() {
|
|
|
669
669
|
for (const [event, { cmd, timeout }] of Object.entries(codexEvents)) {
|
|
670
670
|
if (!codexHooksFile.hooks[event]) codexHooksFile.hooks[event] = [];
|
|
671
671
|
|
|
672
|
-
//
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
);
|
|
672
|
+
// Codex expects grouped hook entries:
|
|
673
|
+
// { matcher?, hooks: [{ type, command, timeoutSec, statusMessage }] }
|
|
674
|
+
// Preserve non-AW groups and non-AW hooks inside mixed groups.
|
|
675
|
+
const existingGroups = Array.isArray(codexHooksFile.hooks[event]) ? codexHooksFile.hooks[event] : [];
|
|
676
|
+
const preservedGroups = existingGroups
|
|
677
|
+
.map(group => {
|
|
678
|
+
if (!group || !Array.isArray(group.hooks)) return null;
|
|
679
|
+
const hooks = group.hooks.filter(h => !h.command?.includes('.aw/hooks/'));
|
|
680
|
+
return hooks.length > 0 ? { ...group, hooks } : null;
|
|
681
|
+
})
|
|
682
|
+
.filter(Boolean);
|
|
676
683
|
|
|
677
|
-
|
|
678
|
-
codexHooksFile.hooks[event].push({
|
|
684
|
+
const awHook = {
|
|
679
685
|
type: 'command',
|
|
680
686
|
command: cmd,
|
|
681
687
|
timeoutSec: timeout,
|
|
682
688
|
statusMessage: `AW telemetry (${event})`,
|
|
683
|
-
}
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
const awGroup = event === 'SessionStart'
|
|
692
|
+
? { matcher: 'startup', hooks: [awHook] }
|
|
693
|
+
: { hooks: [awHook] };
|
|
694
|
+
|
|
695
|
+
codexHooksFile.hooks[event] = [...preservedGroups, awGroup];
|
|
684
696
|
|
|
685
|
-
// Clean up
|
|
686
|
-
// has a single canonical hook definition and we avoid duplicate execution.
|
|
697
|
+
// Clean up incorrect top-level event wrappers from prior installs.
|
|
687
698
|
if (Array.isArray(codexHooksFile[event])) {
|
|
688
699
|
const cleaned = codexHooksFile[event]
|
|
689
700
|
.map(group => {
|
|
690
|
-
if (!group || !Array.isArray(group.hooks)) return
|
|
701
|
+
if (!group || !Array.isArray(group.hooks)) return null;
|
|
691
702
|
const hooks = group.hooks.filter(h => !h.command?.includes('.aw/hooks/'));
|
|
692
703
|
return hooks.length > 0 ? { ...group, hooks } : null;
|
|
693
704
|
})
|