@quantiya/codevibe-claude-plugin 2.0.99 → 2.0.101

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/hooks/stop.sh CHANGED
@@ -111,6 +111,11 @@ read -r -d '' JQ_FILTER <<'JQEOF' || true
111
111
  # here as ASSISTANT_RESPONSE (a Stop after an in-turn fallback retry would
112
112
  # otherwise double-post it as a green assistant bubble).
113
113
  .[($startIdx + 1):] |
114
+ # Only this turn can emit tool calls. Match their native completions before
115
+ # walking assistant records, even after a hook reset turn fingerprints.
116
+ ([ .[] | select(.type == "user") | .message.content | arrays | .[] | objects
117
+ | select(.type == "tool_result") | .tool_use_id | strings | select(length > 0)
118
+ | {key: ., value: true} ] | from_entries) as $completedTools |
114
119
  .[] |
115
120
  select(.type == "assistant") |
116
121
  . as $msg |
@@ -136,7 +141,10 @@ read -r -d '' JQ_FILTER <<'JQEOF' || true
136
141
  # Emit tool_use content as JSON (tojson escapes newlines, safe for line read)
137
142
  (
138
143
  $msg.message.content[]? | select(.type == "tool_use") |
139
- "\($msg.uuid)\ttool_use\t\(. | tojson | @base64)"
144
+ . as $tool |
145
+ (if .name == "AskUserQuestion" and ($completedTools[.id // ""] // false)
146
+ then "completed_tool_use" else "tool_use" end) as $kind |
147
+ "\($msg.uuid)\t\($kind)\t\($tool | tojson | @base64)"
140
148
  )
141
149
  end
142
150
  end
@@ -208,7 +216,7 @@ if [ -n "$TRANSCRIPT_EVENTS" ]; then
208
216
  fi
209
217
  fi
210
218
 
211
- if [ "$MSG_TYPE" = "tool_use" ] && [ -n "$MSG_CONTENT" ]; then
219
+ if { [ "$MSG_TYPE" = "tool_use" ] || [ "$MSG_TYPE" = "completed_tool_use" ]; } && [ -n "$MSG_CONTENT" ]; then
212
220
  # Decode base64-encoded tool_use JSON
213
221
  DECODED_TOOL=$(echo "$MSG_CONTENT" | base64 -d 2>/dev/null || echo "$MSG_CONTENT")
214
222
  TOOL_NAME=$(echo "$DECODED_TOOL" | jq -r '.name // empty')
@@ -221,7 +229,7 @@ if [ -n "$TRANSCRIPT_EVENTS" ]; then
221
229
 
222
230
  if [ -n "$TOOL_NAME" ]; then
223
231
  # Check if this is an interactive prompt (AskUserQuestion)
224
- if [ "$TOOL_NAME" = "AskUserQuestion" ]; then
232
+ if [ "$TOOL_NAME" = "AskUserQuestion" ] && [ "$MSG_TYPE" != "completed_tool_use" ] && [ -n "$TOOL_USE_ID" ]; then
225
233
  QUESTION_TEXT=$(echo "$TOOL_INPUT" | jq -r '.questions[0].question // empty')
226
234
 
227
235
  if [ -n "$QUESTION_TEXT" ]; then
@@ -230,6 +238,7 @@ if [ -n "$TRANSCRIPT_EVENTS" ]; then
230
238
  --arg transcript_path "$TRANSCRIPT_PATH" \
231
239
  --arg hook_event_name "Stop" \
232
240
  --arg type "INTERACTIVE_PROMPT" \
241
+ --arg tool_use_id "$TOOL_USE_ID" \
233
242
  --arg content "$QUESTION_TEXT" \
234
243
  --argjson tool_input "$TOOL_INPUT" \
235
244
  '{
@@ -237,9 +246,11 @@ if [ -n "$TRANSCRIPT_EVENTS" ]; then
237
246
  transcript_path: $transcript_path,
238
247
  hook_event_name: $hook_event_name,
239
248
  type: $type,
249
+ tool_use_id: $tool_use_id,
240
250
  content: $content,
241
251
  metadata: {
242
252
  tool_name: "AskUserQuestion",
253
+ tool_use_id: $tool_use_id,
243
254
  tool_input: $tool_input
244
255
  }
245
256
  }')
@@ -17,6 +17,15 @@ declare const answerSchema: z.ZodObject<{
17
17
  export type CodexNativeQuestionAnswer = z.infer<typeof answerSchema>;
18
18
  /** Accept only a complete native carrier. Ordinary, quoted, malformed and
19
19
  * mixed-content user messages remain ordinary transcript input. Callers must
20
- * additionally match thread, exact question identity, title and choices. */
20
+ * additionally match the thread and exact question identity for closure. */
21
21
  export declare function parseCodexNativeQuestionAnswers(value: unknown): CodexNativeQuestionAnswer[] | null;
22
+ /** Presentation closure only, never mobile admission or an execution receipt.
23
+ * Native replies may shorten the displayed title or supply a free-text answer
24
+ * to a choice question. Neither display text nor choice membership is identity. */
25
+ export declare function matchesCodexNativeQuestionClosure(question: {
26
+ threadId: string;
27
+ itemId: string;
28
+ questionIndex: unknown;
29
+ questionItemId: unknown;
30
+ }, threadId: string, answer: CodexNativeQuestionAnswer): boolean;
22
31
  export {};
@@ -27,7 +27,7 @@ export { DurableDesktopSyncWriter, SyncJournalError } from './appsync';
27
27
  export type { ShellSyncSource, ShellSyncTicket, ShellSyncSourceInventory } from './appsync';
28
28
  export type { DurableSyncResult, DurableDesktopSyncWriterOptions, DesktopSyncSessionScope, DesktopSyncSourceIdentity } from './appsync';
29
29
  export { CodexNativeStateStore, CodexNativeStateError, snapshotCodexNativeEvent } from './companion-mode/codex-native-state';
30
- export { parseCodexNativeQuestionAnswers } from './companion-mode/codex-native-question-reply';
30
+ export { matchesCodexNativeQuestionClosure, parseCodexNativeQuestionAnswers } from './companion-mode/codex-native-question-reply';
31
31
  export type { CodexNativeQuestionAnswer } from './companion-mode/codex-native-question-reply';
32
32
  export type { CodexNativeStateOptions, CodexNativeScope, CodexNativeStableIdentity, CodexNativeOwner, CodexNativeEvent, CodexNativeControl, CodexNativeIntent, CodexNativeState, CodexNativeEntry, CodexNativeRejection, CodexNativeApprovalDecision } from './companion-mode/codex-native-state';
33
33
  export { CodexNativeDispatcher } from './companion-mode/codex-native-dispatcher';