@cleocode/caamp 2026.10.8 → 2026.10.9

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.
@@ -0,0 +1,1239 @@
1
+ import {
2
+ resolveRegistryTemplatePath
3
+ } from "./chunk-5INWYMO4.js";
4
+
5
+ // src/core/hooks/generated.ts
6
+ var HOOK_CATEGORIES = [
7
+ "agent",
8
+ "context",
9
+ "memory",
10
+ "pipeline",
11
+ "prompt",
12
+ "session",
13
+ "task",
14
+ "tool"
15
+ ];
16
+ var CANONICAL_HOOK_EVENTS = [
17
+ // Provider events
18
+ "ConfigChange",
19
+ "Notification",
20
+ "PermissionRequest",
21
+ "PostCompact",
22
+ "PostModel",
23
+ "PostToolUse",
24
+ "PostToolUseFailure",
25
+ "PreCompact",
26
+ "PreModel",
27
+ "PreToolUse",
28
+ "PromptSubmit",
29
+ "ResponseComplete",
30
+ "SessionEnd",
31
+ "SessionStart",
32
+ "SubagentStart",
33
+ "SubagentStop",
34
+ // Domain events
35
+ "ApprovalExpired",
36
+ "ApprovalGranted",
37
+ "ApprovalRequested",
38
+ "MemoryDecisionStored",
39
+ "MemoryLearningStored",
40
+ "MemoryObserved",
41
+ "MemoryPatternStored",
42
+ "PipelineManifestAppended",
43
+ "PipelineStageCompleted",
44
+ "SessionEnded",
45
+ "SessionStarted",
46
+ "TaskBlocked",
47
+ "TaskCompleted",
48
+ "TaskCreated",
49
+ "TaskStarted"
50
+ ];
51
+ var PROVIDER_HOOK_EVENTS = [
52
+ "ConfigChange",
53
+ "Notification",
54
+ "PermissionRequest",
55
+ "PostCompact",
56
+ "PostModel",
57
+ "PostToolUse",
58
+ "PostToolUseFailure",
59
+ "PreCompact",
60
+ "PreModel",
61
+ "PreToolUse",
62
+ "PromptSubmit",
63
+ "ResponseComplete",
64
+ "SessionEnd",
65
+ "SessionStart",
66
+ "SubagentStart",
67
+ "SubagentStop"
68
+ ];
69
+ var EVENT_METADATA = {
70
+ ConfigChange: {
71
+ category: "context",
72
+ source: "provider",
73
+ canBlock: false,
74
+ description: "Configuration file changes during a session"
75
+ },
76
+ Notification: {
77
+ category: "context",
78
+ source: "provider",
79
+ canBlock: false,
80
+ description: "System notification or alert is emitted"
81
+ },
82
+ PermissionRequest: {
83
+ category: "tool",
84
+ source: "provider",
85
+ canBlock: true,
86
+ description: "Permission dialog appears for a tool action"
87
+ },
88
+ PostCompact: {
89
+ category: "context",
90
+ source: "provider",
91
+ canBlock: false,
92
+ description: "After context window compaction completes"
93
+ },
94
+ PostModel: {
95
+ category: "agent",
96
+ source: "provider",
97
+ canBlock: false,
98
+ description: "After receiving an LLM response"
99
+ },
100
+ PostToolUse: {
101
+ category: "tool",
102
+ source: "provider",
103
+ canBlock: false,
104
+ description: "After a tool call succeeds"
105
+ },
106
+ PostToolUseFailure: {
107
+ category: "tool",
108
+ source: "provider",
109
+ canBlock: false,
110
+ description: "After a tool call fails or times out"
111
+ },
112
+ PreCompact: {
113
+ category: "context",
114
+ source: "provider",
115
+ canBlock: false,
116
+ description: "Before context window compaction"
117
+ },
118
+ PreModel: {
119
+ category: "agent",
120
+ source: "provider",
121
+ canBlock: true,
122
+ description: "Before sending a request to the LLM"
123
+ },
124
+ PreToolUse: {
125
+ category: "tool",
126
+ source: "provider",
127
+ canBlock: true,
128
+ description: "Before a tool call executes (can block/modify)"
129
+ },
130
+ PromptSubmit: {
131
+ category: "prompt",
132
+ source: "provider",
133
+ canBlock: true,
134
+ description: "User submits a prompt, before agent processes it"
135
+ },
136
+ ResponseComplete: {
137
+ category: "prompt",
138
+ source: "provider",
139
+ canBlock: false,
140
+ description: "Agent finishes responding to a turn"
141
+ },
142
+ SessionEnd: {
143
+ category: "session",
144
+ source: "provider",
145
+ canBlock: false,
146
+ description: "Session terminates or exits"
147
+ },
148
+ SessionStart: {
149
+ category: "session",
150
+ source: "provider",
151
+ canBlock: false,
152
+ description: "Session begins, resumes, or is cleared"
153
+ },
154
+ SubagentStart: {
155
+ category: "agent",
156
+ source: "provider",
157
+ canBlock: true,
158
+ description: "A subagent is spawned"
159
+ },
160
+ SubagentStop: {
161
+ category: "agent",
162
+ source: "provider",
163
+ canBlock: false,
164
+ description: "A subagent finishes execution"
165
+ },
166
+ ApprovalExpired: {
167
+ category: "session",
168
+ source: "domain",
169
+ canBlock: false,
170
+ description: "A workflow approval token has expired without response"
171
+ },
172
+ ApprovalGranted: {
173
+ category: "session",
174
+ source: "domain",
175
+ canBlock: false,
176
+ description: "A workflow approval has been granted via /approve token"
177
+ },
178
+ ApprovalRequested: {
179
+ category: "session",
180
+ source: "domain",
181
+ canBlock: false,
182
+ description: "A workflow approval gate has fired, awaiting human approval"
183
+ },
184
+ MemoryDecisionStored: {
185
+ category: "memory",
186
+ source: "domain",
187
+ canBlock: false,
188
+ description: "A decision has been stored via memory.decision.store"
189
+ },
190
+ MemoryLearningStored: {
191
+ category: "memory",
192
+ source: "domain",
193
+ canBlock: false,
194
+ description: "A learning has been stored via memory.learning.store"
195
+ },
196
+ MemoryObserved: {
197
+ category: "memory",
198
+ source: "domain",
199
+ canBlock: false,
200
+ description: "An observation has been recorded to brain.db via memory.observe"
201
+ },
202
+ MemoryPatternStored: {
203
+ category: "memory",
204
+ source: "domain",
205
+ canBlock: false,
206
+ description: "A pattern has been stored via memory.pattern.store"
207
+ },
208
+ PipelineManifestAppended: {
209
+ category: "pipeline",
210
+ source: "domain",
211
+ canBlock: false,
212
+ description: "A manifest entry has been appended to `pipeline_manifest` (`SQLite` table per ADR-027)"
213
+ },
214
+ PipelineStageCompleted: {
215
+ category: "pipeline",
216
+ source: "domain",
217
+ canBlock: false,
218
+ description: "A LOOM lifecycle gate has passed validation"
219
+ },
220
+ SessionEnded: {
221
+ category: "session",
222
+ source: "domain",
223
+ canBlock: false,
224
+ description: "A CLEO session has ended via session.end"
225
+ },
226
+ SessionStarted: {
227
+ category: "session",
228
+ source: "domain",
229
+ canBlock: false,
230
+ description: "A CLEO session has been started via session.start"
231
+ },
232
+ TaskBlocked: {
233
+ category: "task",
234
+ source: "domain",
235
+ canBlock: false,
236
+ description: "A CLEO task has been blocked"
237
+ },
238
+ TaskCompleted: {
239
+ category: "task",
240
+ source: "domain",
241
+ canBlock: false,
242
+ description: "A CLEO task has been marked complete via tasks.complete"
243
+ },
244
+ TaskCreated: {
245
+ category: "task",
246
+ source: "domain",
247
+ canBlock: false,
248
+ description: "A CLEO task has been created via tasks.add"
249
+ },
250
+ TaskStarted: {
251
+ category: "task",
252
+ source: "domain",
253
+ canBlock: false,
254
+ description: "A CLEO task has been started via tasks.start"
255
+ }
256
+ };
257
+ var HOOK_REGISTRY_EVIDENCE = { version: "2.0.0", lastUpdated: "2026-10-10" };
258
+ var GENERATED_PROVIDER_HOOK_PROFILES = {
259
+ "claude-code": {
260
+ hookSystem: "config",
261
+ hookConfigPath: "$HOME/.claude/settings.json",
262
+ hookFormat: "json",
263
+ handlerTypes: ["command", "http", "prompt", "agent"],
264
+ experimental: false,
265
+ projectDelivery: {
266
+ configPath: ".claude/settings.local.json",
267
+ timeoutUnit: "seconds",
268
+ documentedVersions: ["2.1.296"],
269
+ verifiedVersions: [],
270
+ documentation: "https://code.claude.com/docs/en/hooks",
271
+ reviewedAt: "2026-10-10",
272
+ trust: "native-unverified"
273
+ },
274
+ mappings: {
275
+ SessionStart: {
276
+ nativeName: "SessionStart",
277
+ supported: true
278
+ },
279
+ SessionEnd: {
280
+ nativeName: "SessionEnd",
281
+ supported: true
282
+ },
283
+ PromptSubmit: {
284
+ nativeName: "UserPromptSubmit",
285
+ supported: true
286
+ },
287
+ ResponseComplete: {
288
+ nativeName: "Stop",
289
+ supported: true
290
+ },
291
+ PreToolUse: {
292
+ nativeName: "PreToolUse",
293
+ supported: true
294
+ },
295
+ PostToolUse: {
296
+ nativeName: "PostToolUse",
297
+ supported: true
298
+ },
299
+ PostToolUseFailure: {
300
+ nativeName: "PostToolUseFailure",
301
+ supported: true
302
+ },
303
+ PermissionRequest: {
304
+ nativeName: "PermissionRequest",
305
+ supported: true
306
+ },
307
+ SubagentStart: {
308
+ nativeName: "SubagentStart",
309
+ supported: true
310
+ },
311
+ SubagentStop: {
312
+ nativeName: "SubagentStop",
313
+ supported: true
314
+ },
315
+ PreModel: {
316
+ nativeName: null,
317
+ supported: false
318
+ },
319
+ PostModel: {
320
+ nativeName: null,
321
+ supported: false
322
+ },
323
+ PreCompact: {
324
+ nativeName: "PreCompact",
325
+ supported: true
326
+ },
327
+ PostCompact: {
328
+ nativeName: "PostCompact",
329
+ supported: true
330
+ },
331
+ Notification: {
332
+ nativeName: "Notification",
333
+ supported: true
334
+ },
335
+ ConfigChange: {
336
+ nativeName: "ConfigChange",
337
+ supported: true
338
+ }
339
+ },
340
+ providerOnlyEvents: [
341
+ "StopFailure",
342
+ "TeammateIdle",
343
+ "TaskCompleted",
344
+ "InstructionsLoaded",
345
+ "WorktreeCreate",
346
+ "WorktreeRemove",
347
+ "Elicitation",
348
+ "ElicitationResult"
349
+ ]
350
+ },
351
+ cursor: {
352
+ hookSystem: "config",
353
+ hookConfigPath: ".cursor/hooks.json",
354
+ hookFormat: "json",
355
+ handlerTypes: ["command", "prompt"],
356
+ experimental: true,
357
+ mappings: {
358
+ SessionStart: {
359
+ nativeName: "sessionStart",
360
+ supported: true
361
+ },
362
+ SessionEnd: {
363
+ nativeName: "sessionEnd",
364
+ supported: true
365
+ },
366
+ PromptSubmit: {
367
+ nativeName: "beforeSubmitPrompt",
368
+ supported: true
369
+ },
370
+ ResponseComplete: {
371
+ nativeName: "stop",
372
+ supported: true
373
+ },
374
+ PreToolUse: {
375
+ nativeName: "preToolUse",
376
+ supported: true
377
+ },
378
+ PostToolUse: {
379
+ nativeName: "postToolUse",
380
+ supported: true
381
+ },
382
+ PostToolUseFailure: {
383
+ nativeName: "postToolUseFailure",
384
+ supported: true
385
+ },
386
+ PermissionRequest: {
387
+ nativeName: null,
388
+ supported: false
389
+ },
390
+ SubagentStart: {
391
+ nativeName: "subagentStart",
392
+ supported: true
393
+ },
394
+ SubagentStop: {
395
+ nativeName: "subagentStop",
396
+ supported: true
397
+ },
398
+ PreModel: {
399
+ nativeName: null,
400
+ supported: false
401
+ },
402
+ PostModel: {
403
+ nativeName: null,
404
+ supported: false
405
+ },
406
+ PreCompact: {
407
+ nativeName: "preCompact",
408
+ supported: true
409
+ },
410
+ PostCompact: {
411
+ nativeName: null,
412
+ supported: false
413
+ },
414
+ Notification: {
415
+ nativeName: null,
416
+ supported: false
417
+ },
418
+ ConfigChange: {
419
+ nativeName: null,
420
+ supported: false
421
+ }
422
+ },
423
+ providerOnlyEvents: [
424
+ "beforeShellExecution",
425
+ "afterShellExecution",
426
+ "beforeMCPExecution",
427
+ "afterMCPExecution",
428
+ "beforeReadFile",
429
+ "afterFileEdit",
430
+ "afterAgentResponse",
431
+ "afterAgentThought",
432
+ "beforeTabFileRead",
433
+ "afterTabFileEdit"
434
+ ]
435
+ },
436
+ "gemini-cli": {
437
+ hookSystem: "config",
438
+ hookConfigPath: "$HOME/.gemini/settings.json",
439
+ hookFormat: "json",
440
+ handlerTypes: ["command"],
441
+ experimental: false,
442
+ mappings: {
443
+ SessionStart: {
444
+ nativeName: "SessionStart",
445
+ supported: true
446
+ },
447
+ SessionEnd: {
448
+ nativeName: "SessionEnd",
449
+ supported: true
450
+ },
451
+ PromptSubmit: {
452
+ nativeName: "BeforeAgent",
453
+ supported: true
454
+ },
455
+ ResponseComplete: {
456
+ nativeName: "AfterAgent",
457
+ supported: true
458
+ },
459
+ PreToolUse: {
460
+ nativeName: "BeforeTool",
461
+ supported: true
462
+ },
463
+ PostToolUse: {
464
+ nativeName: "AfterTool",
465
+ supported: true
466
+ },
467
+ PostToolUseFailure: {
468
+ nativeName: null,
469
+ supported: false
470
+ },
471
+ PermissionRequest: {
472
+ nativeName: null,
473
+ supported: false
474
+ },
475
+ SubagentStart: {
476
+ nativeName: null,
477
+ supported: false
478
+ },
479
+ SubagentStop: {
480
+ nativeName: null,
481
+ supported: false
482
+ },
483
+ PreModel: {
484
+ nativeName: "BeforeModel",
485
+ supported: true
486
+ },
487
+ PostModel: {
488
+ nativeName: "AfterModel",
489
+ supported: true
490
+ },
491
+ PreCompact: {
492
+ nativeName: "PreCompress",
493
+ supported: true
494
+ },
495
+ PostCompact: {
496
+ nativeName: null,
497
+ supported: false
498
+ },
499
+ Notification: {
500
+ nativeName: "Notification",
501
+ supported: true
502
+ },
503
+ ConfigChange: {
504
+ nativeName: null,
505
+ supported: false
506
+ }
507
+ },
508
+ providerOnlyEvents: ["BeforeToolSelection"]
509
+ },
510
+ codex: {
511
+ hookSystem: "config",
512
+ hookConfigPath: ".codex/hooks.json",
513
+ hookFormat: "json",
514
+ handlerTypes: ["command"],
515
+ experimental: true,
516
+ projectDelivery: {
517
+ configPath: ".codex/hooks.json",
518
+ timeoutUnit: "seconds",
519
+ documentedVersions: ["0.162.1"],
520
+ verifiedVersions: [],
521
+ documentation: "https://developers.openai.com/codex/hooks",
522
+ reviewedAt: "2026-10-10",
523
+ trust: "native-unverified"
524
+ },
525
+ mappings: {
526
+ SessionStart: {
527
+ nativeName: "SessionStart",
528
+ supported: true
529
+ },
530
+ SessionEnd: {
531
+ nativeName: null,
532
+ supported: false
533
+ },
534
+ PromptSubmit: {
535
+ nativeName: "UserPromptSubmit",
536
+ supported: true
537
+ },
538
+ ResponseComplete: {
539
+ nativeName: "Stop",
540
+ supported: true
541
+ },
542
+ PreToolUse: {
543
+ nativeName: "PreToolUse",
544
+ supported: true,
545
+ notes: "Documented by OpenAI; live version certification is separate from installation."
546
+ },
547
+ PostToolUse: {
548
+ nativeName: null,
549
+ supported: false
550
+ },
551
+ PostToolUseFailure: {
552
+ nativeName: null,
553
+ supported: false
554
+ },
555
+ PermissionRequest: {
556
+ nativeName: null,
557
+ supported: false
558
+ },
559
+ SubagentStart: {
560
+ nativeName: null,
561
+ supported: false
562
+ },
563
+ SubagentStop: {
564
+ nativeName: null,
565
+ supported: false
566
+ },
567
+ PreModel: {
568
+ nativeName: null,
569
+ supported: false
570
+ },
571
+ PostModel: {
572
+ nativeName: null,
573
+ supported: false
574
+ },
575
+ PreCompact: {
576
+ nativeName: null,
577
+ supported: false
578
+ },
579
+ PostCompact: {
580
+ nativeName: null,
581
+ supported: false
582
+ },
583
+ Notification: {
584
+ nativeName: null,
585
+ supported: false
586
+ },
587
+ ConfigChange: {
588
+ nativeName: null,
589
+ supported: false
590
+ }
591
+ },
592
+ providerOnlyEvents: []
593
+ },
594
+ opencode: {
595
+ hookSystem: "plugin",
596
+ hookConfigPath: ".opencode/plugins/",
597
+ hookFormat: "javascript",
598
+ handlerTypes: ["plugin"],
599
+ experimental: false,
600
+ projectDelivery: {
601
+ configPath: ".opencode/plugins/cleo-project-hooks.js",
602
+ timeoutUnit: "milliseconds",
603
+ documentedVersions: ["2.0.26"],
604
+ verifiedVersions: [],
605
+ documentation: "https://opencode.ai/docs/plugins/",
606
+ reviewedAt: "2026-10-10",
607
+ trust: "native-unverified"
608
+ },
609
+ mappings: {
610
+ SessionStart: {
611
+ nativeName: "event:session.created",
612
+ supported: true,
613
+ notes: "Via bus event subscriber"
614
+ },
615
+ SessionEnd: {
616
+ nativeName: "event:session.deleted",
617
+ supported: true,
618
+ notes: "Via bus event subscriber"
619
+ },
620
+ PromptSubmit: {
621
+ nativeName: "chat.message",
622
+ supported: true
623
+ },
624
+ ResponseComplete: {
625
+ nativeName: "event:session.idle",
626
+ supported: true,
627
+ notes: "Via bus event subscriber"
628
+ },
629
+ PreToolUse: {
630
+ nativeName: "tool.execute.before",
631
+ supported: true
632
+ },
633
+ PostToolUse: {
634
+ nativeName: "tool.execute.after",
635
+ supported: true
636
+ },
637
+ PostToolUseFailure: {
638
+ nativeName: null,
639
+ supported: false
640
+ },
641
+ PermissionRequest: {
642
+ nativeName: "permission.ask",
643
+ supported: true
644
+ },
645
+ SubagentStart: {
646
+ nativeName: null,
647
+ supported: false
648
+ },
649
+ SubagentStop: {
650
+ nativeName: null,
651
+ supported: false
652
+ },
653
+ PreModel: {
654
+ nativeName: "chat.params",
655
+ supported: true,
656
+ notes: "Modify LLM params before request"
657
+ },
658
+ PostModel: {
659
+ nativeName: null,
660
+ supported: false
661
+ },
662
+ PreCompact: {
663
+ nativeName: "experimental.session.compacting",
664
+ supported: true
665
+ },
666
+ PostCompact: {
667
+ nativeName: "event:session.compacted",
668
+ supported: true,
669
+ notes: "Via bus event subscriber"
670
+ },
671
+ Notification: {
672
+ nativeName: null,
673
+ supported: false
674
+ },
675
+ ConfigChange: {
676
+ nativeName: null,
677
+ supported: false
678
+ }
679
+ },
680
+ providerOnlyEvents: [
681
+ "chat.headers",
682
+ "shell.env",
683
+ "tool.definition",
684
+ "command.execute.before",
685
+ "experimental.chat.messages.transform",
686
+ "experimental.chat.system.transform",
687
+ "experimental.text.complete"
688
+ ]
689
+ },
690
+ kimi: {
691
+ hookSystem: "none",
692
+ hookConfigPath: null,
693
+ hookFormat: null,
694
+ handlerTypes: [],
695
+ experimental: false,
696
+ projectDelivery: {
697
+ configPath: null,
698
+ documentedVersions: [],
699
+ verifiedVersions: [],
700
+ documentation: "https://kimi-cli.com/en/customization/hooks.html",
701
+ reviewedAt: "2026-10-10",
702
+ trust: "native-unverified"
703
+ },
704
+ mappings: {
705
+ SessionStart: {
706
+ nativeName: null,
707
+ supported: false
708
+ },
709
+ SessionEnd: {
710
+ nativeName: null,
711
+ supported: false
712
+ },
713
+ PromptSubmit: {
714
+ nativeName: null,
715
+ supported: false
716
+ },
717
+ ResponseComplete: {
718
+ nativeName: null,
719
+ supported: false
720
+ },
721
+ PreToolUse: {
722
+ nativeName: null,
723
+ supported: false
724
+ },
725
+ PostToolUse: {
726
+ nativeName: null,
727
+ supported: false
728
+ },
729
+ PostToolUseFailure: {
730
+ nativeName: null,
731
+ supported: false
732
+ },
733
+ PermissionRequest: {
734
+ nativeName: null,
735
+ supported: false
736
+ },
737
+ SubagentStart: {
738
+ nativeName: null,
739
+ supported: false
740
+ },
741
+ SubagentStop: {
742
+ nativeName: null,
743
+ supported: false
744
+ },
745
+ PreModel: {
746
+ nativeName: null,
747
+ supported: false
748
+ },
749
+ PostModel: {
750
+ nativeName: null,
751
+ supported: false
752
+ },
753
+ PreCompact: {
754
+ nativeName: null,
755
+ supported: false
756
+ },
757
+ PostCompact: {
758
+ nativeName: null,
759
+ supported: false
760
+ },
761
+ Notification: {
762
+ nativeName: null,
763
+ supported: false
764
+ },
765
+ ConfigChange: {
766
+ nativeName: null,
767
+ supported: false
768
+ }
769
+ },
770
+ providerOnlyEvents: []
771
+ },
772
+ pi: {
773
+ hookSystem: "extension",
774
+ hookConfigPath: "$PI_CODING_AGENT_DIR/extensions/",
775
+ hookFormat: "typescript",
776
+ handlerTypes: ["extension"],
777
+ experimental: false,
778
+ notes: "Pi is CAAMP's first-class primary harness (ADR-035). Events use snake_case. Extensions live at ~/.pi/agent/extensions/ (global) or <projectDir>/.pi/extensions/ (project).",
779
+ nativeEventCatalog: "pi",
780
+ mappings: {
781
+ SessionStart: {
782
+ nativeName: "session_start",
783
+ supported: true
784
+ },
785
+ SessionEnd: {
786
+ nativeName: "session_shutdown",
787
+ supported: true
788
+ },
789
+ PromptSubmit: {
790
+ nativeName: "input",
791
+ supported: true
792
+ },
793
+ ResponseComplete: {
794
+ nativeName: null,
795
+ supported: false
796
+ },
797
+ PreToolUse: {
798
+ nativeName: "tool_call",
799
+ supported: true
800
+ },
801
+ PostToolUse: {
802
+ nativeName: "tool_result",
803
+ supported: true
804
+ },
805
+ PostToolUseFailure: {
806
+ nativeName: null,
807
+ supported: false
808
+ },
809
+ PermissionRequest: {
810
+ nativeName: null,
811
+ supported: false
812
+ },
813
+ SubagentStart: {
814
+ nativeName: "before_agent_start",
815
+ supported: true
816
+ },
817
+ SubagentStop: {
818
+ nativeName: "agent_end",
819
+ supported: true
820
+ },
821
+ PreModel: {
822
+ nativeName: "before_provider_request",
823
+ supported: true
824
+ },
825
+ PostModel: {
826
+ nativeName: null,
827
+ supported: false
828
+ },
829
+ PreCompact: {
830
+ nativeName: "context",
831
+ supported: true,
832
+ notes: "Pi's context assembly event is the closest proxy for pre-compaction"
833
+ },
834
+ PostCompact: {
835
+ nativeName: null,
836
+ supported: false
837
+ },
838
+ Notification: {
839
+ nativeName: "turn_end",
840
+ supported: true,
841
+ notes: "Pi emits turn_end when the assistant turn completes, which is the best proxy for a notification event"
842
+ },
843
+ ConfigChange: {
844
+ nativeName: null,
845
+ supported: false
846
+ }
847
+ },
848
+ providerOnlyEvents: [
849
+ "session_switch",
850
+ "session_fork",
851
+ "agent_start",
852
+ "turn_start",
853
+ "message_start",
854
+ "message_update",
855
+ "message_end",
856
+ "tool_execution_start",
857
+ "tool_execution_end",
858
+ "user_bash",
859
+ "model_select",
860
+ "resources_discover"
861
+ ]
862
+ },
863
+ antigravity: {
864
+ hookSystem: "none",
865
+ hookConfigPath: null,
866
+ hookFormat: null,
867
+ handlerTypes: [],
868
+ experimental: false,
869
+ mappings: {
870
+ SessionStart: {
871
+ nativeName: null,
872
+ supported: false
873
+ },
874
+ SessionEnd: {
875
+ nativeName: null,
876
+ supported: false
877
+ },
878
+ PromptSubmit: {
879
+ nativeName: null,
880
+ supported: false
881
+ },
882
+ ResponseComplete: {
883
+ nativeName: null,
884
+ supported: false
885
+ },
886
+ PreToolUse: {
887
+ nativeName: null,
888
+ supported: false
889
+ },
890
+ PostToolUse: {
891
+ nativeName: null,
892
+ supported: false
893
+ },
894
+ PostToolUseFailure: {
895
+ nativeName: null,
896
+ supported: false
897
+ },
898
+ PermissionRequest: {
899
+ nativeName: null,
900
+ supported: false
901
+ },
902
+ SubagentStart: {
903
+ nativeName: null,
904
+ supported: false
905
+ },
906
+ SubagentStop: {
907
+ nativeName: null,
908
+ supported: false
909
+ },
910
+ PreModel: {
911
+ nativeName: null,
912
+ supported: false
913
+ },
914
+ PostModel: {
915
+ nativeName: null,
916
+ supported: false
917
+ },
918
+ PreCompact: {
919
+ nativeName: null,
920
+ supported: false
921
+ },
922
+ PostCompact: {
923
+ nativeName: null,
924
+ supported: false
925
+ },
926
+ Notification: {
927
+ nativeName: null,
928
+ supported: false
929
+ },
930
+ ConfigChange: {
931
+ nativeName: null,
932
+ supported: false
933
+ }
934
+ },
935
+ providerOnlyEvents: []
936
+ }
937
+ };
938
+ var PROVIDER_NATIVE_EVENT_MAPS = {
939
+ "claude-code": {
940
+ SessionStart: "SessionStart",
941
+ SessionEnd: "SessionEnd",
942
+ UserPromptSubmit: "PromptSubmit",
943
+ Stop: "ResponseComplete",
944
+ PreToolUse: "PreToolUse",
945
+ PostToolUse: "PostToolUse",
946
+ PostToolUseFailure: "PostToolUseFailure",
947
+ PermissionRequest: "PermissionRequest",
948
+ SubagentStart: "SubagentStart",
949
+ SubagentStop: "SubagentStop",
950
+ PreCompact: "PreCompact",
951
+ PostCompact: "PostCompact",
952
+ Notification: "Notification",
953
+ ConfigChange: "ConfigChange"
954
+ },
955
+ cursor: {
956
+ sessionStart: "SessionStart",
957
+ sessionEnd: "SessionEnd",
958
+ beforeSubmitPrompt: "PromptSubmit",
959
+ stop: "ResponseComplete",
960
+ preToolUse: "PreToolUse",
961
+ postToolUse: "PostToolUse",
962
+ postToolUseFailure: "PostToolUseFailure",
963
+ subagentStart: "SubagentStart",
964
+ subagentStop: "SubagentStop",
965
+ preCompact: "PreCompact"
966
+ },
967
+ "gemini-cli": {
968
+ SessionStart: "SessionStart",
969
+ SessionEnd: "SessionEnd",
970
+ BeforeAgent: "PromptSubmit",
971
+ AfterAgent: "ResponseComplete",
972
+ BeforeTool: "PreToolUse",
973
+ AfterTool: "PostToolUse",
974
+ BeforeModel: "PreModel",
975
+ AfterModel: "PostModel",
976
+ PreCompress: "PreCompact",
977
+ Notification: "Notification"
978
+ },
979
+ codex: {
980
+ SessionStart: "SessionStart",
981
+ UserPromptSubmit: "PromptSubmit",
982
+ Stop: "ResponseComplete",
983
+ PreToolUse: "PreToolUse"
984
+ },
985
+ opencode: {
986
+ "event:session.created": "SessionStart",
987
+ "event:session.deleted": "SessionEnd",
988
+ "chat.message": "PromptSubmit",
989
+ "event:session.idle": "ResponseComplete",
990
+ "tool.execute.before": "PreToolUse",
991
+ "tool.execute.after": "PostToolUse",
992
+ "permission.ask": "PermissionRequest",
993
+ "chat.params": "PreModel",
994
+ "experimental.session.compacting": "PreCompact",
995
+ "event:session.compacted": "PostCompact"
996
+ },
997
+ kimi: {},
998
+ pi: {
999
+ session_start: "SessionStart",
1000
+ session_shutdown: "SessionEnd",
1001
+ input: "PromptSubmit",
1002
+ tool_call: "PreToolUse",
1003
+ tool_result: "PostToolUse",
1004
+ before_agent_start: "SubagentStart",
1005
+ agent_end: "SubagentStop",
1006
+ before_provider_request: "PreModel",
1007
+ context: "PreCompact",
1008
+ turn_end: "Notification",
1009
+ tool_execution_start: "PreToolUse",
1010
+ tool_execution_end: "PostToolUse"
1011
+ },
1012
+ antigravity: {}
1013
+ };
1014
+
1015
+ // src/core/hooks/normalizer.ts
1016
+ import { existsSync, readFileSync } from "fs";
1017
+ import { dirname, join } from "path";
1018
+ import { fileURLToPath } from "url";
1019
+ var _mappings = null;
1020
+ function findMappingsPath() {
1021
+ const thisDir = dirname(fileURLToPath(import.meta.url));
1022
+ return join(thisDir, "..", "..", "..", "providers", "hook-mappings.json");
1023
+ }
1024
+ function loadMappings() {
1025
+ if (_mappings) return _mappings;
1026
+ const mappingsPath = findMappingsPath();
1027
+ if (!existsSync(mappingsPath)) {
1028
+ const empty = {
1029
+ version: HOOK_REGISTRY_EVIDENCE.version,
1030
+ lastUpdated: HOOK_REGISTRY_EVIDENCE.lastUpdated,
1031
+ description: "Generated registry fallback \u2014 runtime JSON path unavailable",
1032
+ canonicalEvents: EVENT_METADATA,
1033
+ providerMappings: GENERATED_PROVIDER_HOOK_PROFILES
1034
+ };
1035
+ _mappings = empty;
1036
+ return empty;
1037
+ }
1038
+ const raw = readFileSync(mappingsPath, "utf-8");
1039
+ _mappings = JSON.parse(raw);
1040
+ return _mappings;
1041
+ }
1042
+ function resetHookMappings() {
1043
+ _mappings = null;
1044
+ }
1045
+ function getCanonicalEvent(event) {
1046
+ const data = loadMappings();
1047
+ return data.canonicalEvents[event];
1048
+ }
1049
+ function getAllCanonicalEvents() {
1050
+ return loadMappings().canonicalEvents;
1051
+ }
1052
+ function getCanonicalEventsByCategory(category) {
1053
+ const data = loadMappings();
1054
+ return CANONICAL_HOOK_EVENTS.filter((event) => data.canonicalEvents[event].category === category);
1055
+ }
1056
+ function getProviderHookProfile(providerId) {
1057
+ const data = loadMappings();
1058
+ return data.providerMappings[providerId];
1059
+ }
1060
+ function getMappedProviderIds() {
1061
+ return Object.keys(loadMappings().providerMappings);
1062
+ }
1063
+ function toNative(canonical, providerId) {
1064
+ const profile = getProviderHookProfile(providerId);
1065
+ if (!profile) return null;
1066
+ const mapping = profile.mappings[canonical];
1067
+ return mapping?.supported ? mapping.nativeName : null;
1068
+ }
1069
+ function toCanonical(nativeName, providerId) {
1070
+ const profile = getProviderHookProfile(providerId);
1071
+ if (!profile) return null;
1072
+ for (const [canonical, mapping] of Object.entries(profile.mappings)) {
1073
+ if (mapping?.supported && mapping.nativeName === nativeName) {
1074
+ return canonical;
1075
+ }
1076
+ }
1077
+ return null;
1078
+ }
1079
+ function toNativeBatch(canonicals, providerId) {
1080
+ const data = loadMappings();
1081
+ const profile = data.providerMappings[providerId];
1082
+ if (!profile) return [];
1083
+ const results = [];
1084
+ for (const canonical of canonicals) {
1085
+ const mapping = profile.mappings[canonical];
1086
+ if (mapping?.supported && mapping.nativeName) {
1087
+ results.push({
1088
+ canonical,
1089
+ native: mapping.nativeName,
1090
+ providerId,
1091
+ category: data.canonicalEvents[canonical].category,
1092
+ canBlock: data.canonicalEvents[canonical].canBlock
1093
+ });
1094
+ }
1095
+ }
1096
+ return results;
1097
+ }
1098
+ function supportsHook(canonical, providerId) {
1099
+ const profile = getProviderHookProfile(providerId);
1100
+ if (!profile) return false;
1101
+ return profile.mappings[canonical]?.supported ?? false;
1102
+ }
1103
+ function getHookSupport(canonical, providerId) {
1104
+ const profile = getProviderHookProfile(providerId);
1105
+ if (!profile) {
1106
+ return { canonical, supported: false, native: null };
1107
+ }
1108
+ const mapping = profile.mappings[canonical];
1109
+ return {
1110
+ canonical,
1111
+ supported: mapping?.supported ?? false,
1112
+ native: mapping?.nativeName ?? null,
1113
+ notes: mapping?.notes
1114
+ };
1115
+ }
1116
+ function getSupportedEvents(providerId) {
1117
+ const profile = getProviderHookProfile(providerId);
1118
+ if (!profile) return [];
1119
+ return PROVIDER_HOOK_EVENTS.filter((event) => profile.mappings[event]?.supported);
1120
+ }
1121
+ function getUnsupportedEvents(providerId) {
1122
+ const profile = getProviderHookProfile(providerId);
1123
+ if (!profile) return [...PROVIDER_HOOK_EVENTS];
1124
+ return PROVIDER_HOOK_EVENTS.filter((event) => !profile.mappings[event]?.supported);
1125
+ }
1126
+ function getProvidersForEvent(canonical) {
1127
+ const data = loadMappings();
1128
+ return Object.entries(data.providerMappings).filter(([, profile]) => profile.mappings[canonical]?.supported).map(([id]) => id);
1129
+ }
1130
+ function getCommonEvents(providerIds) {
1131
+ if (providerIds.length === 0) return [];
1132
+ return PROVIDER_HOOK_EVENTS.filter((event) => providerIds.every((id) => supportsHook(event, id)));
1133
+ }
1134
+ function getProviderSummary(providerId) {
1135
+ const profile = getProviderHookProfile(providerId);
1136
+ if (!profile) return void 0;
1137
+ const supported = getSupportedEvents(providerId);
1138
+ const unsupported = getUnsupportedEvents(providerId);
1139
+ return {
1140
+ providerId,
1141
+ hookSystem: profile.hookSystem,
1142
+ experimental: profile.experimental,
1143
+ supportedCount: supported.length,
1144
+ totalCanonical: PROVIDER_HOOK_EVENTS.length,
1145
+ supported,
1146
+ unsupported,
1147
+ providerOnly: profile.providerOnlyEvents,
1148
+ coverage: Math.round(supported.length / PROVIDER_HOOK_EVENTS.length * 100)
1149
+ };
1150
+ }
1151
+ function buildHookMatrix(providerIds) {
1152
+ const data = loadMappings();
1153
+ const ids = providerIds ?? Object.keys(data.providerMappings);
1154
+ const matrix = {};
1155
+ for (const event of PROVIDER_HOOK_EVENTS) {
1156
+ matrix[event] = {};
1157
+ for (const id of ids) {
1158
+ const profile = data.providerMappings[id];
1159
+ matrix[event][id] = profile?.mappings[event] ?? {
1160
+ nativeName: null,
1161
+ supported: false
1162
+ };
1163
+ }
1164
+ }
1165
+ return {
1166
+ events: [...PROVIDER_HOOK_EVENTS],
1167
+ providers: ids,
1168
+ matrix
1169
+ };
1170
+ }
1171
+ function getHookSystemType(providerId) {
1172
+ const profile = getProviderHookProfile(providerId);
1173
+ return profile?.hookSystem ?? "none";
1174
+ }
1175
+ function getHookConfigPath(providerId) {
1176
+ const profile = getProviderHookProfile(providerId);
1177
+ if (!profile?.hookConfigPath) return null;
1178
+ return resolveRegistryTemplatePath(profile.hookConfigPath);
1179
+ }
1180
+ function getProviderOnlyEvents(providerId) {
1181
+ const profile = getProviderHookProfile(providerId);
1182
+ return profile?.providerOnlyEvents ?? [];
1183
+ }
1184
+ function translateToAll(canonical, providerIds) {
1185
+ const result = {};
1186
+ for (const id of providerIds) {
1187
+ const native = toNative(canonical, id);
1188
+ if (native) {
1189
+ result[id] = native;
1190
+ }
1191
+ }
1192
+ return result;
1193
+ }
1194
+ function resolveNativeEvent(nativeName) {
1195
+ const data = loadMappings();
1196
+ const results = [];
1197
+ for (const [providerId, profile] of Object.entries(data.providerMappings)) {
1198
+ for (const [canonical, mapping] of Object.entries(profile.mappings)) {
1199
+ if (mapping?.supported && mapping.nativeName === nativeName) {
1200
+ results.push({ providerId, canonical });
1201
+ }
1202
+ }
1203
+ }
1204
+ return results;
1205
+ }
1206
+ function getHookMappingsVersion() {
1207
+ return loadMappings().version;
1208
+ }
1209
+
1210
+ export {
1211
+ HOOK_CATEGORIES,
1212
+ CANONICAL_HOOK_EVENTS,
1213
+ GENERATED_PROVIDER_HOOK_PROFILES,
1214
+ PROVIDER_NATIVE_EVENT_MAPS,
1215
+ resetHookMappings,
1216
+ getCanonicalEvent,
1217
+ getAllCanonicalEvents,
1218
+ getCanonicalEventsByCategory,
1219
+ getProviderHookProfile,
1220
+ getMappedProviderIds,
1221
+ toNative,
1222
+ toCanonical,
1223
+ toNativeBatch,
1224
+ supportsHook,
1225
+ getHookSupport,
1226
+ getSupportedEvents,
1227
+ getUnsupportedEvents,
1228
+ getProvidersForEvent,
1229
+ getCommonEvents,
1230
+ getProviderSummary,
1231
+ buildHookMatrix,
1232
+ getHookSystemType,
1233
+ getHookConfigPath,
1234
+ getProviderOnlyEvents,
1235
+ translateToAll,
1236
+ resolveNativeEvent,
1237
+ getHookMappingsVersion
1238
+ };
1239
+ //# sourceMappingURL=chunk-IYSZL7N7.js.map