@vibefield/puppeteer-adapter-claude 0.0.0-stage → 0.2.0

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.
Files changed (215) hide show
  1. package/LICENSE +21 -0
  2. package/dist/detection.d.ts +78 -0
  3. package/dist/detection.d.ts.map +1 -0
  4. package/dist/detection.js +167 -0
  5. package/dist/detection.js.map +1 -0
  6. package/dist/driver.d.ts +145 -0
  7. package/dist/driver.d.ts.map +1 -0
  8. package/dist/driver.js +840 -0
  9. package/dist/driver.js.map +1 -0
  10. package/dist/generated/detection-surface.d.ts +30 -0
  11. package/dist/generated/detection-surface.d.ts.map +1 -0
  12. package/dist/generated/detection-surface.js +34 -0
  13. package/dist/generated/detection-surface.js.map +1 -0
  14. package/dist/generated/registry.d.ts +45 -0
  15. package/dist/generated/registry.d.ts.map +1 -0
  16. package/dist/generated/registry.js +287 -0
  17. package/dist/generated/registry.js.map +1 -0
  18. package/dist/index.d.ts +27 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +27 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/launch/hook-switches.d.ts +32 -0
  23. package/dist/launch/hook-switches.d.ts.map +1 -0
  24. package/dist/launch/hook-switches.js +56 -0
  25. package/dist/launch/hook-switches.js.map +1 -0
  26. package/dist/launch/invocation-grammar.d.ts +196 -0
  27. package/dist/launch/invocation-grammar.d.ts.map +1 -0
  28. package/dist/launch/invocation-grammar.js +857 -0
  29. package/dist/launch/invocation-grammar.js.map +1 -0
  30. package/dist/launch/native-invocation.d.ts +42 -0
  31. package/dist/launch/native-invocation.d.ts.map +1 -0
  32. package/dist/launch/native-invocation.js +130 -0
  33. package/dist/launch/native-invocation.js.map +1 -0
  34. package/dist/launch/prepare.d.ts +137 -0
  35. package/dist/launch/prepare.d.ts.map +1 -0
  36. package/dist/launch/prepare.js +317 -0
  37. package/dist/launch/prepare.js.map +1 -0
  38. package/dist/launch/settings.d.ts +63 -0
  39. package/dist/launch/settings.d.ts.map +1 -0
  40. package/dist/launch/settings.js +94 -0
  41. package/dist/launch/settings.js.map +1 -0
  42. package/dist/normalization/adapter.d.ts +3 -0
  43. package/dist/normalization/adapter.d.ts.map +1 -0
  44. package/dist/normalization/adapter.js +4 -0
  45. package/dist/normalization/adapter.js.map +1 -0
  46. package/dist/normalization/compaction.d.ts +4 -0
  47. package/dist/normalization/compaction.d.ts.map +1 -0
  48. package/dist/normalization/compaction.js +7 -0
  49. package/dist/normalization/compaction.js.map +1 -0
  50. package/dist/normalization/context-window.d.ts +3 -0
  51. package/dist/normalization/context-window.d.ts.map +1 -0
  52. package/dist/normalization/context-window.js +4 -0
  53. package/dist/normalization/context-window.js.map +1 -0
  54. package/dist/normalization/conversation.d.ts +3 -0
  55. package/dist/normalization/conversation.d.ts.map +1 -0
  56. package/dist/normalization/conversation.js +4 -0
  57. package/dist/normalization/conversation.js.map +1 -0
  58. package/dist/normalization/delegation.d.ts +4 -0
  59. package/dist/normalization/delegation.d.ts.map +1 -0
  60. package/dist/normalization/delegation.js +7 -0
  61. package/dist/normalization/delegation.js.map +1 -0
  62. package/dist/normalization/effort.d.ts +8 -0
  63. package/dist/normalization/effort.d.ts.map +1 -0
  64. package/dist/normalization/effort.js +16 -0
  65. package/dist/normalization/effort.js.map +1 -0
  66. package/dist/normalization/environment.d.ts +5 -0
  67. package/dist/normalization/environment.d.ts.map +1 -0
  68. package/dist/normalization/environment.js +10 -0
  69. package/dist/normalization/environment.js.map +1 -0
  70. package/dist/normalization/index.d.ts +20 -0
  71. package/dist/normalization/index.d.ts.map +1 -0
  72. package/dist/normalization/index.js +20 -0
  73. package/dist/normalization/index.js.map +1 -0
  74. package/dist/normalization/interaction.d.ts +38 -0
  75. package/dist/normalization/interaction.d.ts.map +1 -0
  76. package/dist/normalization/interaction.js +60 -0
  77. package/dist/normalization/interaction.js.map +1 -0
  78. package/dist/normalization/mode.d.ts +11 -0
  79. package/dist/normalization/mode.d.ts.map +1 -0
  80. package/dist/normalization/mode.js +37 -0
  81. package/dist/normalization/mode.js.map +1 -0
  82. package/dist/normalization/model.d.ts +5 -0
  83. package/dist/normalization/model.d.ts.map +1 -0
  84. package/dist/normalization/model.js +7 -0
  85. package/dist/normalization/model.js.map +1 -0
  86. package/dist/normalization/monitor-capabilities.d.ts +4 -0
  87. package/dist/normalization/monitor-capabilities.d.ts.map +1 -0
  88. package/dist/normalization/monitor-capabilities.js +121 -0
  89. package/dist/normalization/monitor-capabilities.js.map +1 -0
  90. package/dist/normalization/monitor.d.ts +46 -0
  91. package/dist/normalization/monitor.d.ts.map +1 -0
  92. package/dist/normalization/monitor.js +332 -0
  93. package/dist/normalization/monitor.js.map +1 -0
  94. package/dist/normalization/notification.d.ts +4 -0
  95. package/dist/normalization/notification.d.ts.map +1 -0
  96. package/dist/normalization/notification.js +9 -0
  97. package/dist/normalization/notification.js.map +1 -0
  98. package/dist/normalization/pipeline.d.ts +56 -0
  99. package/dist/normalization/pipeline.d.ts.map +1 -0
  100. package/dist/normalization/pipeline.js +472 -0
  101. package/dist/normalization/pipeline.js.map +1 -0
  102. package/dist/normalization/session.d.ts +6 -0
  103. package/dist/normalization/session.d.ts.map +1 -0
  104. package/dist/normalization/session.js +17 -0
  105. package/dist/normalization/session.js.map +1 -0
  106. package/dist/normalization/tool.d.ts +8 -0
  107. package/dist/normalization/tool.d.ts.map +1 -0
  108. package/dist/normalization/tool.js +64 -0
  109. package/dist/normalization/tool.js.map +1 -0
  110. package/dist/normalization/turn.d.ts +6 -0
  111. package/dist/normalization/turn.d.ts.map +1 -0
  112. package/dist/normalization/turn.js +15 -0
  113. package/dist/normalization/turn.js.map +1 -0
  114. package/dist/normalization/types.d.ts +47 -0
  115. package/dist/normalization/types.d.ts.map +1 -0
  116. package/dist/normalization/types.js +2 -0
  117. package/dist/normalization/types.js.map +1 -0
  118. package/dist/normalization/wire.d.ts +10 -0
  119. package/dist/normalization/wire.d.ts.map +1 -0
  120. package/dist/normalization/wire.js +75 -0
  121. package/dist/normalization/wire.js.map +1 -0
  122. package/dist/normalization/workspace.d.ts +5 -0
  123. package/dist/normalization/workspace.d.ts.map +1 -0
  124. package/dist/normalization/workspace.js +68 -0
  125. package/dist/normalization/workspace.js.map +1 -0
  126. package/dist/observation/hook-bridge.d.ts +72 -0
  127. package/dist/observation/hook-bridge.d.ts.map +1 -0
  128. package/dist/observation/hook-bridge.js +250 -0
  129. package/dist/observation/hook-bridge.js.map +1 -0
  130. package/dist/observation/otel/actor.d.ts +14 -0
  131. package/dist/observation/otel/actor.d.ts.map +1 -0
  132. package/dist/observation/otel/actor.js +44 -0
  133. package/dist/observation/otel/actor.js.map +1 -0
  134. package/dist/observation/otel/capability.d.ts +4 -0
  135. package/dist/observation/otel/capability.d.ts.map +1 -0
  136. package/dist/observation/otel/capability.js +24 -0
  137. package/dist/observation/otel/capability.js.map +1 -0
  138. package/dist/observation/otel/index.d.ts +6 -0
  139. package/dist/observation/otel/index.d.ts.map +1 -0
  140. package/dist/observation/otel/index.js +6 -0
  141. package/dist/observation/otel/index.js.map +1 -0
  142. package/dist/observation/otel/model.d.ts +9 -0
  143. package/dist/observation/otel/model.d.ts.map +1 -0
  144. package/dist/observation/otel/model.js +16 -0
  145. package/dist/observation/otel/model.js.map +1 -0
  146. package/dist/observation/otel/usage.d.ts +16 -0
  147. package/dist/observation/otel/usage.d.ts.map +1 -0
  148. package/dist/observation/otel/usage.js +75 -0
  149. package/dist/observation/otel/usage.js.map +1 -0
  150. package/dist/observation/otel/wire.d.ts +15 -0
  151. package/dist/observation/otel/wire.d.ts.map +1 -0
  152. package/dist/observation/otel/wire.js +147 -0
  153. package/dist/observation/otel/wire.js.map +1 -0
  154. package/dist/observation/semantic-provider.d.ts +45 -0
  155. package/dist/observation/semantic-provider.d.ts.map +1 -0
  156. package/dist/observation/semantic-provider.js +8 -0
  157. package/dist/observation/semantic-provider.js.map +1 -0
  158. package/dist/observation/status-channel.d.ts +70 -0
  159. package/dist/observation/status-channel.d.ts.map +1 -0
  160. package/dist/observation/status-channel.js +268 -0
  161. package/dist/observation/status-channel.js.map +1 -0
  162. package/dist/observation/transcript/conversation.d.ts +6 -0
  163. package/dist/observation/transcript/conversation.d.ts.map +1 -0
  164. package/dist/observation/transcript/conversation.js +170 -0
  165. package/dist/observation/transcript/conversation.js.map +1 -0
  166. package/dist/observation/transcript/index.d.ts +5 -0
  167. package/dist/observation/transcript/index.d.ts.map +1 -0
  168. package/dist/observation/transcript/index.js +5 -0
  169. package/dist/observation/transcript/index.js.map +1 -0
  170. package/dist/observation/transcript/provider.d.ts +7 -0
  171. package/dist/observation/transcript/provider.d.ts.map +1 -0
  172. package/dist/observation/transcript/provider.js +132 -0
  173. package/dist/observation/transcript/provider.js.map +1 -0
  174. package/dist/observation/transcript/services/jsonl-reader.d.ts +12 -0
  175. package/dist/observation/transcript/services/jsonl-reader.d.ts.map +1 -0
  176. package/dist/observation/transcript/services/jsonl-reader.js +140 -0
  177. package/dist/observation/transcript/services/jsonl-reader.js.map +1 -0
  178. package/dist/observation/transcript/services/yield.d.ts +3 -0
  179. package/dist/observation/transcript/services/yield.d.ts.map +1 -0
  180. package/dist/observation/transcript/services/yield.js +15 -0
  181. package/dist/observation/transcript/services/yield.js.map +1 -0
  182. package/dist/observation/transcript/wire.d.ts +26 -0
  183. package/dist/observation/transcript/wire.d.ts.map +1 -0
  184. package/dist/observation/transcript/wire.js +89 -0
  185. package/dist/observation/transcript/wire.js.map +1 -0
  186. package/dist/services/account-usage.d.ts +86 -0
  187. package/dist/services/account-usage.d.ts.map +1 -0
  188. package/dist/services/account-usage.js +813 -0
  189. package/dist/services/account-usage.js.map +1 -0
  190. package/dist/services/distribution.d.ts +64 -0
  191. package/dist/services/distribution.d.ts.map +1 -0
  192. package/dist/services/distribution.js +255 -0
  193. package/dist/services/distribution.js.map +1 -0
  194. package/dist/services/event-source.d.ts +29 -0
  195. package/dist/services/event-source.d.ts.map +1 -0
  196. package/dist/services/event-source.js +38 -0
  197. package/dist/services/event-source.js.map +1 -0
  198. package/dist/services/extensions.d.ts +46 -0
  199. package/dist/services/extensions.d.ts.map +1 -0
  200. package/dist/services/extensions.js +1263 -0
  201. package/dist/services/extensions.js.map +1 -0
  202. package/dist/services/models.d.ts +6 -0
  203. package/dist/services/models.d.ts.map +1 -0
  204. package/dist/services/models.js +90 -0
  205. package/dist/services/models.js.map +1 -0
  206. package/dist/services/profiles.d.ts +48 -0
  207. package/dist/services/profiles.d.ts.map +1 -0
  208. package/dist/services/profiles.js +176 -0
  209. package/dist/services/profiles.js.map +1 -0
  210. package/dist/services/prompt.d.ts +39 -0
  211. package/dist/services/prompt.d.ts.map +1 -0
  212. package/dist/services/prompt.js +107 -0
  213. package/dist/services/prompt.js.map +1 -0
  214. package/package.json +46 -3
  215. package/README.md +0 -3
@@ -0,0 +1,472 @@
1
+ /**
2
+ * Claude hook → normalized AgentEvent translation (DESIGN §16.7), corrected
3
+ * by the two censuses (packages/surface/vendors/claude/findings.md):
4
+ *
5
+ * - `prompt_id` is the native turn id; MessageDisplay additionally carries a
6
+ * distinct `turn_id` (assistant response cycle) — both are surfaced for
7
+ * candidate correlation metadata.
8
+ * - MessageDisplay STREAMS: deltas are accumulated per message_id and an
9
+ * conversation:assistant-message is emitted per delta with `final` marking completion.
10
+ * - PermissionRequest carries NO tool_use_id or request id. As of 2.1.226,
11
+ * PreToolUse fires first for every call and PermissionRequest follows only
12
+ * when a decision is needed. We correlate by prompt, tool name, and canonical
13
+ * tool input, while still tolerating the legacy reverse ordering. Execution
14
+ * completion proves allow; PermissionDenied or a turn boundary closes denial.
15
+ * - SubagentStop is re-entrant (1× stop_hook_active:false, then N× true):
16
+ * only the first occurrence per agent_id normalizes to delegation:subagent-stopped.
17
+ * - Unknown events are RETAINED (ADR-008) as adapter:native-event; the raw
18
+ * body always rides the envelope's nativeEvent upstream.
19
+ *
20
+ * Stateful by necessity (delta accumulation, permission FIFO, stop dedup) —
21
+ * one normalizer instance per Claude session.
22
+ */
23
+ import { normalizeClaudeNativeEvent } from './adapter.js';
24
+ import { normalizeClaudeCompactionCompleted, normalizeClaudeCompactionStarted } from './compaction.js';
25
+ import { normalizeClaudeAssistantMessage } from './conversation.js';
26
+ import { normalizeClaudeContextInvalidated } from './context-window.js';
27
+ import { normalizeClaudeSubagentStarted, normalizeClaudeSubagentStopped } from './delegation.js';
28
+ import { ClaudeEffortNormalizer } from './effort.js';
29
+ import { normalizeClaudeCwd, normalizeClaudeSessionEnvironment } from './environment.js';
30
+ import { claudeQuestionOutcome, normalizeClaudePermissionRequested, normalizeClaudePermissionResolved, normalizeClaudeQuestionRequested, normalizeClaudeQuestionResolved, parseClaudeStructuredQuestions, } from './interaction.js';
31
+ import { normalizeClaudeNotification } from './notification.js';
32
+ import { normalizeClaudeSessionModel } from './model.js';
33
+ import { ClaudeModeNormalizer } from './mode.js';
34
+ import { normalizeClaudeSessionExited, normalizeClaudeSessionReady, normalizeClaudeSessionStarted } from './session.js';
35
+ import { normalizeClaudeToolCompleted, normalizeClaudeToolFailed, normalizeClaudeToolRequested, sameClaudeTool, } from './tool.js';
36
+ import { normalizeClaudeTurnCompleted, normalizeClaudeTurnFailed, normalizeClaudeTurnStarted } from './turn.js';
37
+ import { canonicalClaudeValue, claudeHookDiagnostic, claudeNumber, claudeString } from './wire.js';
38
+ import { normalizeClaudeFileChanged, normalizeClaudeFileOperation } from './workspace.js';
39
+ const MAX_TRACKED_ITEMS = 64;
40
+ export class ClaudeHookNormalizer {
41
+ messageBuffers = new Map();
42
+ pendingPermissions = [];
43
+ pendingQuestions = new Map();
44
+ recentToolRequests = new Map();
45
+ stoppedSubagents = new Set();
46
+ permissionCounter = 0;
47
+ toolCounters = new Map();
48
+ compactionCounter = 0;
49
+ activeCompaction;
50
+ lastClosedCompaction;
51
+ effort = new ClaudeEffortNormalizer();
52
+ mode = new ClaudeModeNormalizer();
53
+ nextFallbackToolId(promptId, toolName) {
54
+ const key = promptId ?? 'unknown';
55
+ const next = (this.toolCounters.get(key) ?? 0) + 1;
56
+ if (!this.toolCounters.has(key) && this.toolCounters.size >= MAX_TRACKED_ITEMS) {
57
+ const oldest = this.toolCounters.keys().next().value;
58
+ if (oldest !== undefined)
59
+ this.toolCounters.delete(oldest);
60
+ }
61
+ this.toolCounters.set(key, next);
62
+ return `tool-${encodeURIComponent(key)}-${encodeURIComponent(toolName)}-${next}`;
63
+ }
64
+ findRecentToolForPayload(promptId, toolName, input, inputWasSupplied) {
65
+ const inputKey = canonicalClaudeValue(input);
66
+ const requests = [...this.recentToolRequests.values()];
67
+ for (let index = requests.length - 1; index >= 0; index -= 1) {
68
+ const request = requests[index];
69
+ if (request.promptId !== promptId || request.toolName !== toolName)
70
+ continue;
71
+ if (!inputWasSupplied || request.inputKey === inputKey)
72
+ return request;
73
+ }
74
+ return undefined;
75
+ }
76
+ toolCallId(body, promptId, toolName) {
77
+ return (claudeString(body.tool_use_id) ??
78
+ this.findRecentToolForPayload(promptId, toolName, body.tool_input, Object.hasOwn(body, 'tool_input'))
79
+ ?.toolCallId ??
80
+ this.nextFallbackToolId(promptId, toolName));
81
+ }
82
+ rememberTool(request) {
83
+ if (!this.recentToolRequests.has(request.toolCallId) && this.recentToolRequests.size >= MAX_TRACKED_ITEMS) {
84
+ const oldest = this.recentToolRequests.keys().next().value;
85
+ if (oldest !== undefined)
86
+ this.recentToolRequests.delete(oldest);
87
+ }
88
+ this.recentToolRequests.set(request.toolCallId, request);
89
+ }
90
+ rememberQuestion(result, question) {
91
+ if (!this.pendingQuestions.has(question.toolCallId) && this.pendingQuestions.size >= MAX_TRACKED_ITEMS) {
92
+ const oldest = this.pendingQuestions.keys().next().value;
93
+ if (oldest !== undefined) {
94
+ const evicted = this.pendingQuestions.get(oldest);
95
+ this.pendingQuestions.delete(oldest);
96
+ if (evicted) {
97
+ result.events.push(normalizeClaudeQuestionResolved(evicted.requestId, 'superseded'));
98
+ }
99
+ }
100
+ }
101
+ this.pendingQuestions.set(question.toolCallId, question);
102
+ }
103
+ resolveQuestions(result, outcome, predicate) {
104
+ for (const [toolCallId, question] of this.pendingQuestions) {
105
+ if (!predicate(question))
106
+ continue;
107
+ result.events.push(normalizeClaudeQuestionResolved(question.requestId, outcome));
108
+ this.pendingQuestions.delete(toolCallId);
109
+ }
110
+ }
111
+ closeActiveCompaction(result, outcome) {
112
+ if (!this.activeCompaction)
113
+ return;
114
+ result.events.push(normalizeClaudeCompactionCompleted(this.activeCompaction.id, this.activeCompaction.trigger, outcome));
115
+ this.lastClosedCompaction = {
116
+ id: this.activeCompaction.id,
117
+ promptId: this.activeCompaction.promptId,
118
+ };
119
+ this.activeCompaction = undefined;
120
+ }
121
+ permissionBoundaryDiagnostic(result, hookEventName, promptId) {
122
+ const count = this.pendingPermissions.filter((permission) => permission.promptId === undefined || permission.promptId === promptId).length;
123
+ if (count === 0)
124
+ return;
125
+ result.diagnostics.push({
126
+ code: 'permission-outlived-turn',
127
+ hookEventName,
128
+ issues: [`${count} pending permission request(s) closed at the owning turn boundary`],
129
+ });
130
+ }
131
+ findRecentTool(permission) {
132
+ const requests = [...this.recentToolRequests.values()];
133
+ for (let index = requests.length - 1; index >= 0; index -= 1) {
134
+ const request = requests[index];
135
+ if (!request.permissionRequestId && sameClaudeTool(permission, request))
136
+ return request;
137
+ }
138
+ return undefined;
139
+ }
140
+ evictOldestPermission(result) {
141
+ const permission = this.pendingPermissions.shift();
142
+ if (!permission)
143
+ return;
144
+ // Bounded adapter memory must not create unbounded reducer state. Close the
145
+ // request honestly before forgetting its correlation details.
146
+ result.events.push(normalizeClaudePermissionResolved(permission.requestId, 'unknown'));
147
+ if (permission.toolCallId)
148
+ this.recentToolRequests.delete(permission.toolCallId);
149
+ }
150
+ rememberStoppedSubagent(agentId) {
151
+ if (!this.stoppedSubagents.has(agentId) && this.stoppedSubagents.size >= MAX_TRACKED_ITEMS) {
152
+ const oldest = this.stoppedSubagents.values().next().value;
153
+ if (oldest !== undefined)
154
+ this.stoppedSubagents.delete(oldest);
155
+ }
156
+ this.stoppedSubagents.add(agentId);
157
+ }
158
+ resolvePermission(result, outcome, predicate) {
159
+ const remaining = [];
160
+ for (const permission of this.pendingPermissions) {
161
+ if (predicate(permission)) {
162
+ result.events.push(normalizeClaudePermissionResolved(permission.requestId, outcome));
163
+ if (permission.toolCallId)
164
+ this.recentToolRequests.delete(permission.toolCallId);
165
+ }
166
+ else {
167
+ remaining.push(permission);
168
+ }
169
+ }
170
+ this.pendingPermissions = remaining;
171
+ }
172
+ normalize(body) {
173
+ const name = claudeString(body.hook_event_name) ?? 'unknown';
174
+ const promptId = claudeString(body.prompt_id);
175
+ const result = {
176
+ events: [],
177
+ diagnostics: [],
178
+ sessionId: claudeString(body.session_id),
179
+ transcriptPath: claudeString(body.transcript_path),
180
+ promptId,
181
+ agentId: claudeString(body.agent_id),
182
+ agentType: claudeString(body.agent_type),
183
+ providerVersion: claudeString(body.version) ?? claudeString(body.claude_version),
184
+ };
185
+ const isRebind = name === 'SessionStart' && claudeString(body.source) === 'clear';
186
+ if (isRebind) {
187
+ this.effort.reset();
188
+ this.mode.reset();
189
+ }
190
+ const diagnostic = claudeHookDiagnostic(name, body);
191
+ if (diagnostic) {
192
+ result.diagnostics.push(diagnostic);
193
+ result.events.push(normalizeClaudeNativeEvent(name));
194
+ this.effort.append(result, body);
195
+ this.mode.append(result, body);
196
+ return result;
197
+ }
198
+ switch (name) {
199
+ case 'SessionStart':
200
+ this.closeActiveCompaction(result, 'unknown');
201
+ this.lastClosedCompaction = undefined;
202
+ result.events.push(normalizeClaudeSessionStarted(body, isRebind));
203
+ const environment = normalizeClaudeSessionEnvironment(body);
204
+ if (environment)
205
+ result.events.push(environment);
206
+ const model = normalizeClaudeSessionModel(body);
207
+ if (model)
208
+ result.events.push(model);
209
+ if (isRebind)
210
+ result.events.push(normalizeClaudeContextInvalidated('history-changed'));
211
+ break;
212
+ case 'CwdChanged': {
213
+ const environment = normalizeClaudeCwd(body);
214
+ if (environment)
215
+ result.events.push(environment);
216
+ else
217
+ result.events.push(normalizeClaudeNativeEvent(name));
218
+ break;
219
+ }
220
+ case 'InstructionsLoaded':
221
+ // load_reason "session_start" is the closest thing to a boot-finished
222
+ // signal; other loads (e.g. /memory edits) stay native-only.
223
+ if (claudeString(body.load_reason) === 'session_start') {
224
+ result.events.push(normalizeClaudeSessionReady());
225
+ }
226
+ else {
227
+ result.events.push(normalizeClaudeNativeEvent(name));
228
+ }
229
+ break;
230
+ case 'UserPromptSubmit':
231
+ // PreCompact can be followed by a native cancellation (for example,
232
+ // "not enough messages") with no PostCompact hook. A subsequently
233
+ // accepted prompt proves the attempt is no longer active, but does not
234
+ // prove whether compaction succeeded.
235
+ if (this.activeCompaction)
236
+ this.closeActiveCompaction(result, 'unknown');
237
+ else
238
+ this.lastClosedCompaction = undefined;
239
+ this.resolveQuestions(result, 'superseded', (question) => question.promptId === undefined || question.promptId !== promptId);
240
+ result.events.push(normalizeClaudeTurnStarted(body, promptId));
241
+ break;
242
+ case 'MessageDisplay': {
243
+ const messageId = claudeString(body.message_id) ?? 'unknown-message';
244
+ const final = body.final === true;
245
+ const text = (this.messageBuffers.get(messageId) ?? '') + (claudeString(body.delta) ?? '');
246
+ if (final) {
247
+ this.messageBuffers.delete(messageId);
248
+ }
249
+ else {
250
+ if (!this.messageBuffers.has(messageId) && this.messageBuffers.size >= MAX_TRACKED_ITEMS) {
251
+ const oldest = this.messageBuffers.keys().next().value;
252
+ if (oldest !== undefined)
253
+ this.messageBuffers.delete(oldest);
254
+ }
255
+ this.messageBuffers.set(messageId, text);
256
+ }
257
+ result.turnId = claudeString(body.turn_id);
258
+ result.events.push(normalizeClaudeAssistantMessage(messageId, result.turnId, text, final));
259
+ break;
260
+ }
261
+ case 'PermissionRequest': {
262
+ this.permissionCounter += 1;
263
+ const toolName = claudeString(body.tool_name) ?? 'unknown-tool';
264
+ // Claude emits PermissionRequest while presenting AskUserQuestion's
265
+ // picker. That record is the question interaction itself, not a second
266
+ // request to authorize the tool. PreToolUse already published the
267
+ // structured question; the raw envelope remains available as evidence.
268
+ // Checking the native tool name also covers legacy reverse ordering.
269
+ if (toolName.toLowerCase() === 'askuserquestion') {
270
+ result.events.push(normalizeClaudeNativeEvent(name));
271
+ break;
272
+ }
273
+ const requestId = `perm-${promptId ?? 'unknown'}-${toolName}-${this.permissionCounter}`;
274
+ const pending = {
275
+ requestId,
276
+ promptId,
277
+ toolName,
278
+ inputKey: canonicalClaudeValue(body.tool_input),
279
+ };
280
+ const tool = this.findRecentTool(pending);
281
+ if (tool) {
282
+ pending.toolCallId = tool.toolCallId;
283
+ tool.permissionRequestId = requestId;
284
+ }
285
+ if (this.pendingPermissions.length >= MAX_TRACKED_ITEMS)
286
+ this.evictOldestPermission(result);
287
+ this.pendingPermissions.push(pending);
288
+ result.events.push(normalizeClaudePermissionRequested(requestId, toolName, body.tool_input, pending.toolCallId));
289
+ break;
290
+ }
291
+ case 'PreToolUse': {
292
+ const toolName = claudeString(body.tool_name) ?? 'unknown-tool';
293
+ const toolCallId = claudeString(body.tool_use_id) ?? this.nextFallbackToolId(promptId, toolName);
294
+ const request = {
295
+ toolCallId,
296
+ promptId,
297
+ toolName,
298
+ inputKey: canonicalClaudeValue(body.tool_input),
299
+ input: body.tool_input,
300
+ };
301
+ const legacyPending = this.pendingPermissions.find((permission) => permission.toolCallId === undefined && sameClaudeTool(permission, request));
302
+ if (legacyPending) {
303
+ legacyPending.toolCallId = toolCallId;
304
+ request.permissionRequestId = legacyPending.requestId;
305
+ }
306
+ this.rememberTool(request);
307
+ result.events.push(normalizeClaudeToolRequested(toolCallId, toolName, body.tool_input));
308
+ const workspace = normalizeClaudeFileOperation(toolCallId, toolName, body.tool_input, 'proposed');
309
+ if (workspace)
310
+ result.events.push(workspace);
311
+ if (toolName.toLowerCase() === 'askuserquestion') {
312
+ const questions = parseClaudeStructuredQuestions(body.tool_input);
313
+ if (questions && !this.pendingQuestions.has(toolCallId)) {
314
+ const questionRequestId = `question:${toolCallId}`;
315
+ request.questionRequestId = questionRequestId;
316
+ this.rememberQuestion(result, {
317
+ requestId: questionRequestId,
318
+ promptId,
319
+ toolCallId,
320
+ });
321
+ result.events.push(normalizeClaudeQuestionRequested(questionRequestId, questions));
322
+ }
323
+ }
324
+ break;
325
+ }
326
+ case 'PostToolUse': {
327
+ const toolName = claudeString(body.tool_name) ?? 'unknown-tool';
328
+ const toolCallId = this.toolCallId(body, promptId, toolName);
329
+ const request = this.recentToolRequests.get(toolCallId);
330
+ this.resolvePermission(result, 'allowed', (permission) => permission.toolCallId === toolCallId);
331
+ this.resolveQuestions(result, claudeQuestionOutcome(body.tool_response), (question) => question.toolCallId === toolCallId);
332
+ this.recentToolRequests.delete(toolCallId);
333
+ result.events.push(normalizeClaudeToolCompleted(toolCallId, claudeString(body.tool_name) ?? request?.toolName, body.tool_response, claudeNumber(body.duration_ms)));
334
+ const workspace = normalizeClaudeFileOperation(toolCallId, claudeString(body.tool_name) ?? request?.toolName ?? toolName, request?.input ?? body.tool_input, 'applied');
335
+ if (workspace)
336
+ result.events.push(workspace);
337
+ break;
338
+ }
339
+ case 'PostToolUseFailure': {
340
+ const toolName = claudeString(body.tool_name) ?? 'unknown-tool';
341
+ const toolCallId = this.toolCallId(body, promptId, toolName);
342
+ const request = this.recentToolRequests.get(toolCallId);
343
+ this.resolvePermission(result, 'allowed', (permission) => permission.toolCallId === toolCallId);
344
+ this.resolveQuestions(result, 'failed', (question) => question.toolCallId === toolCallId);
345
+ this.recentToolRequests.delete(toolCallId);
346
+ result.events.push(normalizeClaudeToolFailed(toolCallId, claudeString(body.tool_name) ?? request?.toolName, claudeString(body.error)));
347
+ const workspace = normalizeClaudeFileOperation(toolCallId, claudeString(body.tool_name) ?? request?.toolName ?? toolName, request?.input ?? body.tool_input, 'failed');
348
+ if (workspace)
349
+ result.events.push(workspace);
350
+ break;
351
+ }
352
+ case 'PermissionDenied': {
353
+ const toolCallId = claudeString(body.tool_use_id);
354
+ const toolName = claudeString(body.tool_name) ?? 'unknown-tool';
355
+ const signature = { promptId, toolName, inputKey: canonicalClaudeValue(body.tool_input) };
356
+ const request = this.findRecentToolForPayload(promptId, toolName, body.tool_input, true);
357
+ const resolvedToolCallId = toolCallId ?? request?.toolCallId;
358
+ const terminalToolCallId = resolvedToolCallId ?? this.nextFallbackToolId(promptId, toolName);
359
+ const before = result.events.length;
360
+ this.resolvePermission(result, 'denied', (permission) => (toolCallId !== undefined && permission.toolCallId === toolCallId) || sameClaudeTool(permission, signature));
361
+ if (resolvedToolCallId)
362
+ this.recentToolRequests.delete(resolvedToolCallId);
363
+ result.events.push(normalizeClaudeToolFailed(terminalToolCallId, toolName, claudeString(body.reason) ?? 'permission denied'));
364
+ const workspace = normalizeClaudeFileOperation(terminalToolCallId, toolName, request?.input ?? body.tool_input, 'failed');
365
+ if (workspace)
366
+ result.events.push(workspace);
367
+ if (result.events.length === before) {
368
+ result.events.push(normalizeClaudeNativeEvent(name));
369
+ }
370
+ break;
371
+ }
372
+ case 'Stop':
373
+ this.permissionBoundaryDiagnostic(result, name, promptId);
374
+ this.resolvePermission(result, 'denied', (permission) => permission.promptId === undefined || permission.promptId === promptId);
375
+ this.resolveQuestions(result, 'cancelled', (question) => question.promptId === undefined || question.promptId === promptId);
376
+ if (this.activeCompaction && (!this.activeCompaction.promptId || this.activeCompaction.promptId === promptId)) {
377
+ this.closeActiveCompaction(result, 'cancelled');
378
+ }
379
+ result.events.push(normalizeClaudeTurnCompleted(body, promptId));
380
+ break;
381
+ case 'StopFailure':
382
+ this.permissionBoundaryDiagnostic(result, name, promptId);
383
+ this.resolvePermission(result, 'unknown', (permission) => permission.promptId === undefined || permission.promptId === promptId);
384
+ this.resolveQuestions(result, 'failed', (question) => question.promptId === undefined || question.promptId === promptId);
385
+ if (this.activeCompaction && (!this.activeCompaction.promptId || this.activeCompaction.promptId === promptId)) {
386
+ this.closeActiveCompaction(result, 'failed');
387
+ }
388
+ result.events.push(normalizeClaudeTurnFailed(body, promptId));
389
+ break;
390
+ case 'SessionEnd':
391
+ this.resolvePermission(result, 'dismissed', () => true);
392
+ this.resolveQuestions(result, 'cancelled', () => true);
393
+ this.closeActiveCompaction(result, 'cancelled');
394
+ this.messageBuffers.clear();
395
+ this.recentToolRequests.clear();
396
+ this.stoppedSubagents.clear();
397
+ this.toolCounters.clear();
398
+ result.events.push(normalizeClaudeSessionExited(body));
399
+ break;
400
+ case 'SubagentStart': {
401
+ const agentId = claudeString(body.agent_id) ?? 'unknown-agent';
402
+ this.stoppedSubagents.delete(agentId);
403
+ result.events.push(normalizeClaudeSubagentStarted(agentId, claudeString(body.agent_type)));
404
+ break;
405
+ }
406
+ case 'SubagentStop': {
407
+ const agentId = claudeString(body.agent_id) ?? 'unknown-agent';
408
+ // Re-entrant stop-hook guard: only the first Stop per agent is real.
409
+ if (this.stoppedSubagents.has(agentId)) {
410
+ result.events.push(normalizeClaudeNativeEvent(name));
411
+ }
412
+ else {
413
+ this.rememberStoppedSubagent(agentId);
414
+ result.events.push(normalizeClaudeSubagentStopped(agentId));
415
+ }
416
+ break;
417
+ }
418
+ case 'Notification':
419
+ result.events.push(normalizeClaudeNotification(body));
420
+ break;
421
+ case 'FileChanged': {
422
+ const workspace = normalizeClaudeFileChanged(body);
423
+ result.events.push(workspace ?? normalizeClaudeNativeEvent(name));
424
+ break;
425
+ }
426
+ case 'DirectoryAdded':
427
+ case 'ConfigChange':
428
+ result.events.push(normalizeClaudeNativeEvent(name));
429
+ break;
430
+ case 'PreCompact': {
431
+ if (this.activeCompaction)
432
+ this.closeActiveCompaction(result, 'superseded');
433
+ this.lastClosedCompaction = undefined;
434
+ this.compactionCounter += 1;
435
+ const compactionId = claudeString(body.compaction_id) ??
436
+ `compaction-${result.sessionId ?? 'unknown'}-${promptId ?? 'session'}-${this.compactionCounter}`;
437
+ this.activeCompaction = { id: compactionId, promptId, trigger: claudeString(body.trigger) };
438
+ result.events.push(normalizeClaudeCompactionStarted(compactionId, claudeString(body.trigger)));
439
+ break;
440
+ }
441
+ case 'PostCompact': {
442
+ const compactionId = claudeString(body.compaction_id) ??
443
+ this.activeCompaction?.id ??
444
+ this.lastClosedCompaction?.id ??
445
+ `compaction-${result.sessionId ?? 'unknown'}-${promptId ?? 'session'}-${++this.compactionCounter}`;
446
+ this.activeCompaction = undefined;
447
+ this.lastClosedCompaction = undefined;
448
+ result.events.push(normalizeClaudeCompactionCompleted(compactionId, claudeString(body.trigger), 'completed'), normalizeClaudeContextInvalidated('compacted'));
449
+ break;
450
+ }
451
+ default:
452
+ result.events.push(normalizeClaudeNativeEvent(name));
453
+ break;
454
+ }
455
+ this.effort.append(result, body);
456
+ this.mode.append(result, body);
457
+ if (name === 'SessionEnd') {
458
+ this.effort.reset();
459
+ this.mode.reset();
460
+ }
461
+ return result;
462
+ }
463
+ /** Pending (unresolved) permission requests — the deny-timeout input. */
464
+ pendingPermissionRequests() {
465
+ return this.pendingPermissions;
466
+ }
467
+ /** Pending native structured questions, kept independent from permissions. */
468
+ pendingQuestionRequests() {
469
+ return [...this.pendingQuestions.values()];
470
+ }
471
+ }
472
+ //# sourceMappingURL=pipeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/normalization/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,kCAAkC,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC;AACvG,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,iCAAiC,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AACjG,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,iCAAiC,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EACL,qBAAqB,EACrB,kCAAkC,EAClC,iCAAiC,EACjC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';
3
+ export declare function normalizeClaudeSessionStarted(body: ClaudeHookPayload, rebind: boolean): AgentEvent;
4
+ export declare function normalizeClaudeSessionReady(): AgentEvent;
5
+ export declare function normalizeClaudeSessionExited(body: ClaudeHookPayload): AgentEvent;
6
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/normalization/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGpD,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,OAAO,GAAG,UAAU,CAQlG;AAED,wBAAgB,2BAA2B,IAAI,UAAU,CAExD;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,iBAAiB,GAAG,UAAU,CAEhF"}
@@ -0,0 +1,17 @@
1
+ import { claudeString } from './wire.js';
2
+ export function normalizeClaudeSessionStarted(body, rebind) {
3
+ return {
4
+ type: 'session:started',
5
+ nativeSessionId: claudeString(body.session_id),
6
+ title: claudeString(body.session_title),
7
+ startSource: claudeString(body.source),
8
+ ...(rebind ? { rebind: true } : {}),
9
+ };
10
+ }
11
+ export function normalizeClaudeSessionReady() {
12
+ return { type: 'session:ready' };
13
+ }
14
+ export function normalizeClaudeSessionExited(body) {
15
+ return { type: 'session:exited', reason: claudeString(body.reason) };
16
+ }
17
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/normalization/session.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,UAAU,6BAA6B,CAAC,IAAuB,EAAE,MAAe;IACpF,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,eAAe,EAAE,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC;QAC9C,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC;QACvC,WAAW,EAAE,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC;QACtC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B;IACzC,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,IAAuB;IAClE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;AACvE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ToolPresentation } from '@vibefield/puppeteer-core';
2
+ import type { PendingPermission, RecentToolRequest } from './types.js';
3
+ export declare function sameClaudeTool(left: Pick<PendingPermission, 'promptId' | 'toolName' | 'inputKey'>, right: Pick<RecentToolRequest, 'promptId' | 'toolName' | 'inputKey'>): boolean;
4
+ export declare function claudeToolPresentation(tool: string, input: unknown, completed?: boolean): ToolPresentation;
5
+ export declare function normalizeClaudeToolRequested(toolCallId: string, tool: string, input: unknown): import('@vibefield/puppeteer-core').AgentEvent;
6
+ export declare function normalizeClaudeToolCompleted(toolCallId: string, tool: string | undefined, output: unknown, durationMs: number | undefined): import('@vibefield/puppeteer-core').AgentEvent;
7
+ export declare function normalizeClaudeToolFailed(toolCallId: string, tool: string | undefined, error: string | undefined): import('@vibefield/puppeteer-core').AgentEvent;
8
+ //# sourceMappingURL=tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/normalization/tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACpF,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGvE,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC,EACnE,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC,GACnE,OAAO,CAET;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,UAAQ,GAAG,gBAAgB,CAgCxG;AAED,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GACb,OAAO,2BAA2B,EAAE,UAAU,CAEhD;AAED,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,OAAO,2BAA2B,EAAE,UAAU,CAShD;AAED,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,OAAO,2BAA2B,EAAE,UAAU,CAQhD"}
@@ -0,0 +1,64 @@
1
+ import { claudeRecord, claudeString } from './wire.js';
2
+ export function sameClaudeTool(left, right) {
3
+ return left.promptId === right.promptId && left.toolName === right.toolName && left.inputKey === right.inputKey;
4
+ }
5
+ export function claudeToolPresentation(tool, input, completed = false) {
6
+ const name = tool.toLowerCase();
7
+ let kind = 'other';
8
+ let title = completed ? `Used ${tool}` : `Using ${tool}`;
9
+ if (['bash', 'shell', 'command', 'execute'].includes(name)) {
10
+ kind = 'command';
11
+ title = completed ? 'Ran command' : 'Running command';
12
+ }
13
+ else if (['websearch', 'web_search', 'search'].includes(name)) {
14
+ kind = 'web-search';
15
+ title = completed ? 'Searched the web' : 'Searching the web';
16
+ }
17
+ else if (['webfetch', 'fetch', 'browser'].includes(name)) {
18
+ kind = 'browser';
19
+ title = completed ? 'Fetched web content' : 'Fetching web content';
20
+ }
21
+ else if (['read', 'glob', 'grep'].includes(name)) {
22
+ kind = 'file-read';
23
+ title = completed ? 'Read files' : 'Reading files';
24
+ }
25
+ else if (['write', 'edit', 'multiedit', 'apply_patch', 'notebookedit'].includes(name)) {
26
+ kind = 'file-edit';
27
+ title = completed ? 'Edited files' : 'Editing files';
28
+ }
29
+ else if (name.startsWith('mcp__') || name.startsWith('mcp_')) {
30
+ kind = 'mcp';
31
+ }
32
+ const data = claudeRecord(input);
33
+ const detail = claudeString(data?.command) ??
34
+ claudeString(data?.query) ??
35
+ claudeString(data?.url) ??
36
+ claudeString(data?.file_path) ??
37
+ claudeString(data?.path) ??
38
+ claudeString(data?.pattern) ??
39
+ claudeString(data?.prompt);
40
+ return { kind, title, detail };
41
+ }
42
+ export function normalizeClaudeToolRequested(toolCallId, tool, input) {
43
+ return { type: 'tool:requested', toolCallId, tool, input, presentation: claudeToolPresentation(tool, input) };
44
+ }
45
+ export function normalizeClaudeToolCompleted(toolCallId, tool, output, durationMs) {
46
+ return {
47
+ type: 'tool:completed',
48
+ toolCallId,
49
+ tool,
50
+ output,
51
+ durationMs,
52
+ presentation: claudeToolPresentation(tool ?? 'tool', undefined, true),
53
+ };
54
+ }
55
+ export function normalizeClaudeToolFailed(toolCallId, tool, error) {
56
+ return {
57
+ type: 'tool:failed',
58
+ toolCallId,
59
+ tool,
60
+ error,
61
+ presentation: claudeToolPresentation(tool ?? 'tool', undefined, true),
62
+ };
63
+ }
64
+ //# sourceMappingURL=tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.js","sourceRoot":"","sources":["../../src/normalization/tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEvD,MAAM,UAAU,cAAc,CAC5B,IAAmE,EACnE,KA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xB,MAAe,EACf,UAA8B;IAE9B,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,UAAU;QACV,IAAI;QACJ,MAAM;QACN,UAAU;QACV,YAAY,EAAE,sBAAsB,CAAC,IAAI,IAAI,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC;KACtE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,UAAkB,EAClB,IAAwB,EACxB,KAAyB;IAEzB,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,UAAU;QACV,IAAI;QACJ,KAAK;QACL,YAAY,EAAE,sBAAsB,CAAC,IAAI,IAAI,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC;KACtE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { AgentEvent } from '@vibefield/puppeteer-core';
2
+ import type { ClaudeHookPayload } from './types.js';
3
+ export declare function normalizeClaudeTurnStarted(body: ClaudeHookPayload, turnId?: string): AgentEvent;
4
+ export declare function normalizeClaudeTurnCompleted(body: ClaudeHookPayload, turnId?: string): AgentEvent;
5
+ export declare function normalizeClaudeTurnFailed(body: ClaudeHookPayload, turnId?: string): AgentEvent;
6
+ //# sourceMappingURL=turn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"turn.d.ts","sourceRoot":"","sources":["../../src/normalization/turn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGpD,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,CAE/F;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,CAEjG;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,CAM9F"}