@scotthuang/agent-knock-knock 0.14.2 → 0.14.3

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 (116) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +233 -108
  3. package/dist/src/backend-callback-public-projection.d.ts +27 -0
  4. package/dist/src/backend-callback-public-projection.js +58 -0
  5. package/dist/src/backend-callback-public-projection.js.map +1 -0
  6. package/dist/src/backend-public-progress.d.ts +2 -0
  7. package/dist/src/backend-public-progress.js +4 -1
  8. package/dist/src/backend-public-progress.js.map +1 -1
  9. package/dist/src/backend-recovery-semantic.js +5 -4
  10. package/dist/src/backend-recovery-semantic.js.map +1 -1
  11. package/dist/src/callback-transport.d.ts +1 -1
  12. package/dist/src/callback-transport.js +2 -2
  13. package/dist/src/callback-transport.js.map +1 -1
  14. package/dist/src/claude-conversation-routing-cli-adapter.d.ts +2 -0
  15. package/dist/src/claude-conversation-routing-cli-adapter.js +127 -0
  16. package/dist/src/claude-conversation-routing-cli-adapter.js.map +1 -0
  17. package/dist/src/claude-conversation-routing-identity.d.ts +11 -0
  18. package/dist/src/claude-conversation-routing-identity.js +46 -0
  19. package/dist/src/claude-conversation-routing-identity.js.map +1 -0
  20. package/dist/src/claude-native-cli-adapter.d.ts +18 -0
  21. package/dist/src/claude-native-cli-adapter.js +159 -0
  22. package/dist/src/claude-native-cli-adapter.js.map +1 -0
  23. package/dist/src/claude-native-client.d.ts +57 -0
  24. package/dist/src/claude-native-client.js +197 -0
  25. package/dist/src/claude-native-client.js.map +1 -0
  26. package/dist/src/claude-native-discovery.d.ts +20 -0
  27. package/dist/src/claude-native-discovery.js +111 -0
  28. package/dist/src/claude-native-discovery.js.map +1 -0
  29. package/dist/src/claude-native-identity.d.ts +29 -0
  30. package/dist/src/claude-native-identity.js +54 -0
  31. package/dist/src/claude-native-identity.js.map +1 -0
  32. package/dist/src/claude-native-monitor.d.ts +13 -0
  33. package/dist/src/claude-native-monitor.js +123 -0
  34. package/dist/src/claude-native-monitor.js.map +1 -0
  35. package/dist/src/claude-native-observation.d.ts +54 -0
  36. package/dist/src/claude-native-observation.js +418 -0
  37. package/dist/src/claude-native-observation.js.map +1 -0
  38. package/dist/src/claude-native-outbox.d.ts +16 -0
  39. package/dist/src/claude-native-outbox.js +122 -0
  40. package/dist/src/claude-native-outbox.js.map +1 -0
  41. package/dist/src/claude-native-peer-helper.d.ts +2 -0
  42. package/dist/src/claude-native-peer-helper.js +121 -0
  43. package/dist/src/claude-native-peer-helper.js.map +1 -0
  44. package/dist/src/claude-native-public-projection.d.ts +605 -0
  45. package/dist/src/claude-native-public-projection.js +98 -0
  46. package/dist/src/claude-native-public-projection.js.map +1 -0
  47. package/dist/src/claude-native-runtime.d.ts +25 -0
  48. package/dist/src/claude-native-runtime.js +74 -0
  49. package/dist/src/claude-native-runtime.js.map +1 -0
  50. package/dist/src/claude-native-state-store.d.ts +49 -0
  51. package/dist/src/claude-native-state-store.js +96 -0
  52. package/dist/src/claude-native-state-store.js.map +1 -0
  53. package/dist/src/claude-native-task-service.d.ts +70 -0
  54. package/dist/src/claude-native-task-service.js +327 -0
  55. package/dist/src/claude-native-task-service.js.map +1 -0
  56. package/dist/src/cli-core.js +2 -1
  57. package/dist/src/cli-core.js.map +1 -1
  58. package/dist/src/cli-runtime-context.d.ts +2 -0
  59. package/dist/src/cli-runtime-context.js.map +1 -1
  60. package/dist/src/codex-native-outbox.js +7 -5
  61. package/dist/src/codex-native-outbox.js.map +1 -1
  62. package/dist/src/codex-native-public-projection.d.ts +17 -7
  63. package/dist/src/codex-native-public-projection.js +4 -4
  64. package/dist/src/codex-native-public-projection.js.map +1 -1
  65. package/dist/src/codex-native-semantic.js +15 -5
  66. package/dist/src/codex-native-semantic.js.map +1 -1
  67. package/dist/src/conversation-list.js +8 -2
  68. package/dist/src/conversation-list.js.map +1 -1
  69. package/dist/src/conversation-routing-cli-adapter.d.ts +2 -7
  70. package/dist/src/conversation-routing-cli-adapter.js +4 -2
  71. package/dist/src/conversation-routing-cli-adapter.js.map +1 -1
  72. package/dist/src/conversation-routing-commands.d.ts +5 -0
  73. package/dist/src/conversation-routing-commands.js.map +1 -1
  74. package/dist/src/desktop-command-presentation.js +3 -1
  75. package/dist/src/desktop-command-presentation.js.map +1 -1
  76. package/dist/src/desktop-public-projection.js +3 -6
  77. package/dist/src/desktop-public-projection.js.map +1 -1
  78. package/dist/src/desktop-task-service.js +10 -3
  79. package/dist/src/desktop-task-service.js.map +1 -1
  80. package/dist/src/durable-notification-kernel.d.ts +10 -0
  81. package/dist/src/durable-notification-kernel.js +18 -1
  82. package/dist/src/durable-notification-kernel.js.map +1 -1
  83. package/dist/src/host-monitor-reconciliation.js +9 -1
  84. package/dist/src/host-monitor-reconciliation.js.map +1 -1
  85. package/dist/src/host-profile-runtime.js +3 -1
  86. package/dist/src/host-profile-runtime.js.map +1 -1
  87. package/dist/src/local-codex-cli-adapter.js +4 -3
  88. package/dist/src/local-codex-cli-adapter.js.map +1 -1
  89. package/dist/src/openclaw-callback-evidence.d.ts +17 -0
  90. package/dist/src/openclaw-callback-evidence.js +75 -0
  91. package/dist/src/openclaw-callback-evidence.js.map +1 -0
  92. package/dist/src/openclaw-callback-transport.js +90 -9
  93. package/dist/src/openclaw-callback-transport.js.map +1 -1
  94. package/dist/src/semantic-conversation-target.js +1 -1
  95. package/dist/src/semantic-conversation-target.js.map +1 -1
  96. package/dist/src/semantic-tool-command-helpers.d.ts +0 -1
  97. package/dist/src/semantic-tool-command-helpers.js +27 -17
  98. package/dist/src/semantic-tool-command-helpers.js.map +1 -1
  99. package/dist/src/semantic-tool-descriptions.js +3 -3
  100. package/dist/src/semantic-tool-descriptions.js.map +1 -1
  101. package/dist/src/semantic-tool-list-projection.js +11 -4
  102. package/dist/src/semantic-tool-list-projection.js.map +1 -1
  103. package/dist/src/semantic-tool-presentation.js +17 -3
  104. package/dist/src/semantic-tool-presentation.js.map +1 -1
  105. package/dist/src/semantic-tool-runtime.js +8 -1
  106. package/dist/src/semantic-tool-runtime.js.map +1 -1
  107. package/dist/src/semantic-tool-schemas.js +15 -15
  108. package/dist/src/semantic-tool-schemas.js.map +1 -1
  109. package/dist/src/terminal-list-cli-adapter.js +5 -1
  110. package/dist/src/terminal-list-cli-adapter.js.map +1 -1
  111. package/dist/src/terminal-list-ownership-service.js +1 -1
  112. package/dist/src/terminal-list-ownership-service.js.map +1 -1
  113. package/docs/backend-task-recovery.md +43 -0
  114. package/docs/claude-cli-direct.md +60 -0
  115. package/package.json +2 -2
  116. package/templates/openclaw-skills/agent-knock-knock/SKILL.md +14 -4
@@ -0,0 +1,605 @@
1
+ import { type ClaudeNativeCatalogEntry } from "./claude-native-identity.js";
2
+ import type { ClaudeNativeSnapshot, ClaudeNativePublicProgress } from "./claude-native-observation.js";
3
+ import type { ClaudeNativeTaskRecord } from "./claude-native-state-store.js";
4
+ /** The no-snapshot form is List-safe: no transcript read or progress/answer body. */
5
+ export declare function claudeNativeSessionProjection(entry: ClaudeNativeCatalogEntry, snapshot?: ClaudeNativeSnapshot): {
6
+ waiting_for: string | null;
7
+ attention_required: boolean;
8
+ manual_required: boolean;
9
+ interaction_requests_scanned: boolean;
10
+ pending_interaction_count: null;
11
+ interaction_hint?: {
12
+ kind: string;
13
+ actionable: boolean;
14
+ source: string;
15
+ } | undefined;
16
+ next_action?: string | undefined;
17
+ id: string;
18
+ conversation_id: string;
19
+ source: string;
20
+ agent: string;
21
+ title: string;
22
+ cwd: string;
23
+ native_thread_id: string;
24
+ pid: number;
25
+ agent_version: string;
26
+ connection_state: string;
27
+ activity_state: "idle" | "unknown" | "waiting" | "working";
28
+ observed_at: string;
29
+ capabilities: {
30
+ interaction_notify: false;
31
+ interaction_respond: false;
32
+ approve: false;
33
+ model_options: false;
34
+ set_model: false;
35
+ permission_options: false;
36
+ set_permissions: false;
37
+ cancel: false;
38
+ new_thread: false;
39
+ clear_thread: false;
40
+ resume_thread: false;
41
+ list_resumable_threads: false;
42
+ status: boolean;
43
+ send: boolean;
44
+ watch: boolean;
45
+ };
46
+ available_actions: {
47
+ status: {
48
+ tool: string;
49
+ input: {
50
+ conversation_id: string;
51
+ };
52
+ };
53
+ send?: {
54
+ tool: string;
55
+ input: {
56
+ conversation_id: string;
57
+ };
58
+ } | undefined;
59
+ watch?: {
60
+ tool: string;
61
+ input: {
62
+ conversation_id: string;
63
+ };
64
+ } | undefined;
65
+ };
66
+ native_input_id?: string | null | undefined;
67
+ task_anchor_kind?: string | undefined;
68
+ read_at?: string | undefined;
69
+ observation_error?: string | undefined;
70
+ input_state?: "completed" | "failed" | "inProgress" | "interrupted" | "unknown" | undefined;
71
+ input_is_latest?: boolean | undefined;
72
+ response_text?: string | undefined;
73
+ response_truncated?: boolean | undefined;
74
+ progress?: ClaudeNativePublicProgress | undefined;
75
+ };
76
+ /** Send's internal Watch is the only completion monitor, never a second hidden subscription. */
77
+ export declare function claudeNativeTaskProjection(task: ClaudeNativeTaskRecord, includeProgress?: boolean): {
78
+ task_kind: "send" | "watch";
79
+ turn_id?: string | undefined;
80
+ management_state: string;
81
+ deadline_at: string;
82
+ renewal_count: number;
83
+ closed_at: string | undefined;
84
+ close_reason: string | undefined;
85
+ unwatched_at: string | undefined;
86
+ renewed_at: string | undefined;
87
+ recovered_at: string | undefined;
88
+ callback_in_flight: boolean;
89
+ retryable_callback_ids: string[];
90
+ callback_state: string;
91
+ callback_delivery_scope: "controller_acceptance_only";
92
+ channel_delivery_state: "unknown";
93
+ callback_notifications: {
94
+ id: string;
95
+ notification_id: string;
96
+ status: string;
97
+ attempts: number;
98
+ controller_acceptance: string;
99
+ error_code?: string | undefined;
100
+ request_dispatched?: boolean | undefined;
101
+ request_phase?: string | undefined;
102
+ retry_budget_exhausted?: boolean | undefined;
103
+ max_delivery_attempts?: number | undefined;
104
+ next_attempt_at?: string | undefined;
105
+ automatic_retry_stopped?: boolean | undefined;
106
+ }[];
107
+ waiting_for: string | null;
108
+ attention_required: boolean;
109
+ manual_required: boolean;
110
+ interaction_requests_scanned: boolean;
111
+ pending_interaction_count: null;
112
+ interaction_hint?: {
113
+ kind: string;
114
+ actionable: boolean;
115
+ source: string;
116
+ } | undefined;
117
+ watch_id: string;
118
+ conversation_id: string;
119
+ source: string;
120
+ agent: string;
121
+ status: string;
122
+ observation_state: string;
123
+ task_origin: "send" | "watch";
124
+ observation_status: import("./claude-native-state-store.js").ClaudeNativeTaskStatus;
125
+ observation_active: boolean;
126
+ native_thread_id: string;
127
+ native_input_id: string | null;
128
+ task_anchor_kind: string;
129
+ observation_mode: string;
130
+ anchor_state: string;
131
+ needs_watch: boolean;
132
+ next_action: string;
133
+ created_at: string;
134
+ updated_at: string;
135
+ observed_at: string | undefined;
136
+ observation_error: string | undefined;
137
+ callback_configured: boolean;
138
+ callback_expected: boolean;
139
+ capabilities: {
140
+ interaction_notify: false;
141
+ interaction_respond: false;
142
+ approve: false;
143
+ model_options: false;
144
+ set_model: false;
145
+ permission_options: false;
146
+ set_permissions: false;
147
+ cancel: false;
148
+ new_thread: false;
149
+ clear_thread: false;
150
+ resume_thread: false;
151
+ list_resumable_threads: false;
152
+ status: boolean;
153
+ close: boolean;
154
+ unwatch: boolean;
155
+ renew: boolean;
156
+ recover: boolean;
157
+ retry_callback: boolean;
158
+ callback: boolean;
159
+ };
160
+ available_actions: {
161
+ recover?: {
162
+ tool: string;
163
+ input: {
164
+ watch_id: string;
165
+ };
166
+ } | undefined;
167
+ unwatch?: {
168
+ tool: string;
169
+ input: {
170
+ watch_id: string;
171
+ };
172
+ } | undefined;
173
+ close?: {
174
+ tool: string;
175
+ input: {
176
+ turn_id: string;
177
+ };
178
+ } | undefined;
179
+ retry_callback?: {
180
+ tool: string;
181
+ input: {
182
+ watch_id: string;
183
+ notification_id: string;
184
+ };
185
+ } | undefined;
186
+ renew?: {
187
+ tool: string;
188
+ input: {
189
+ watch_id: string;
190
+ };
191
+ } | undefined;
192
+ status: {
193
+ tool: string;
194
+ input: {
195
+ watch_id: string;
196
+ };
197
+ };
198
+ };
199
+ message_id?: undefined;
200
+ delivered?: undefined;
201
+ send_state?: undefined;
202
+ delivery_receipt?: undefined;
203
+ agent_acceptance?: undefined;
204
+ send_error?: undefined;
205
+ resend_allowed?: undefined;
206
+ response_text: string;
207
+ response_truncated: boolean;
208
+ progress: ClaudeNativePublicProgress | undefined;
209
+ } | {
210
+ task_kind: "send" | "watch";
211
+ turn_id?: string | undefined;
212
+ management_state: string;
213
+ deadline_at: string;
214
+ renewal_count: number;
215
+ closed_at: string | undefined;
216
+ close_reason: string | undefined;
217
+ unwatched_at: string | undefined;
218
+ renewed_at: string | undefined;
219
+ recovered_at: string | undefined;
220
+ callback_in_flight: boolean;
221
+ retryable_callback_ids: string[];
222
+ callback_state: string;
223
+ callback_delivery_scope: "controller_acceptance_only";
224
+ channel_delivery_state: "unknown";
225
+ callback_notifications: {
226
+ id: string;
227
+ notification_id: string;
228
+ status: string;
229
+ attempts: number;
230
+ controller_acceptance: string;
231
+ error_code?: string | undefined;
232
+ request_dispatched?: boolean | undefined;
233
+ request_phase?: string | undefined;
234
+ retry_budget_exhausted?: boolean | undefined;
235
+ max_delivery_attempts?: number | undefined;
236
+ next_attempt_at?: string | undefined;
237
+ automatic_retry_stopped?: boolean | undefined;
238
+ }[];
239
+ waiting_for: string | null;
240
+ attention_required: boolean;
241
+ manual_required: boolean;
242
+ interaction_requests_scanned: boolean;
243
+ pending_interaction_count: null;
244
+ interaction_hint?: {
245
+ kind: string;
246
+ actionable: boolean;
247
+ source: string;
248
+ } | undefined;
249
+ watch_id: string;
250
+ conversation_id: string;
251
+ source: string;
252
+ agent: string;
253
+ status: string;
254
+ observation_state: string;
255
+ task_origin: "send" | "watch";
256
+ observation_status: import("./claude-native-state-store.js").ClaudeNativeTaskStatus;
257
+ observation_active: boolean;
258
+ native_thread_id: string;
259
+ native_input_id: string | null;
260
+ task_anchor_kind: string;
261
+ observation_mode: string;
262
+ anchor_state: string;
263
+ needs_watch: boolean;
264
+ next_action: string;
265
+ created_at: string;
266
+ updated_at: string;
267
+ observed_at: string | undefined;
268
+ observation_error: string | undefined;
269
+ callback_configured: boolean;
270
+ callback_expected: boolean;
271
+ capabilities: {
272
+ interaction_notify: false;
273
+ interaction_respond: false;
274
+ approve: false;
275
+ model_options: false;
276
+ set_model: false;
277
+ permission_options: false;
278
+ set_permissions: false;
279
+ cancel: false;
280
+ new_thread: false;
281
+ clear_thread: false;
282
+ resume_thread: false;
283
+ list_resumable_threads: false;
284
+ status: boolean;
285
+ close: boolean;
286
+ unwatch: boolean;
287
+ renew: boolean;
288
+ recover: boolean;
289
+ retry_callback: boolean;
290
+ callback: boolean;
291
+ };
292
+ available_actions: {
293
+ recover?: {
294
+ tool: string;
295
+ input: {
296
+ watch_id: string;
297
+ };
298
+ } | undefined;
299
+ unwatch?: {
300
+ tool: string;
301
+ input: {
302
+ watch_id: string;
303
+ };
304
+ } | undefined;
305
+ close?: {
306
+ tool: string;
307
+ input: {
308
+ turn_id: string;
309
+ };
310
+ } | undefined;
311
+ retry_callback?: {
312
+ tool: string;
313
+ input: {
314
+ watch_id: string;
315
+ notification_id: string;
316
+ };
317
+ } | undefined;
318
+ renew?: {
319
+ tool: string;
320
+ input: {
321
+ watch_id: string;
322
+ };
323
+ } | undefined;
324
+ status: {
325
+ tool: string;
326
+ input: {
327
+ watch_id: string;
328
+ };
329
+ };
330
+ };
331
+ message_id?: undefined;
332
+ delivered?: undefined;
333
+ send_state?: undefined;
334
+ delivery_receipt?: undefined;
335
+ agent_acceptance?: undefined;
336
+ send_error?: undefined;
337
+ resend_allowed?: undefined;
338
+ response_text?: undefined;
339
+ response_truncated?: undefined;
340
+ progress?: undefined;
341
+ } | {
342
+ task_kind: "send" | "watch";
343
+ turn_id?: string | undefined;
344
+ management_state: string;
345
+ deadline_at: string;
346
+ renewal_count: number;
347
+ closed_at: string | undefined;
348
+ close_reason: string | undefined;
349
+ unwatched_at: string | undefined;
350
+ renewed_at: string | undefined;
351
+ recovered_at: string | undefined;
352
+ callback_in_flight: boolean;
353
+ retryable_callback_ids: string[];
354
+ callback_state: string;
355
+ callback_delivery_scope: "controller_acceptance_only";
356
+ channel_delivery_state: "unknown";
357
+ callback_notifications: {
358
+ id: string;
359
+ notification_id: string;
360
+ status: string;
361
+ attempts: number;
362
+ controller_acceptance: string;
363
+ error_code?: string | undefined;
364
+ request_dispatched?: boolean | undefined;
365
+ request_phase?: string | undefined;
366
+ retry_budget_exhausted?: boolean | undefined;
367
+ max_delivery_attempts?: number | undefined;
368
+ next_attempt_at?: string | undefined;
369
+ automatic_retry_stopped?: boolean | undefined;
370
+ }[];
371
+ waiting_for: string | null;
372
+ attention_required: boolean;
373
+ manual_required: boolean;
374
+ interaction_requests_scanned: boolean;
375
+ pending_interaction_count: null;
376
+ interaction_hint?: {
377
+ kind: string;
378
+ actionable: boolean;
379
+ source: string;
380
+ } | undefined;
381
+ watch_id: string;
382
+ conversation_id: string;
383
+ source: string;
384
+ agent: string;
385
+ status: string;
386
+ observation_state: string;
387
+ task_origin: "send" | "watch";
388
+ observation_status: import("./claude-native-state-store.js").ClaudeNativeTaskStatus;
389
+ observation_active: boolean;
390
+ native_thread_id: string;
391
+ native_input_id: string | null;
392
+ task_anchor_kind: string;
393
+ observation_mode: string;
394
+ anchor_state: string;
395
+ needs_watch: boolean;
396
+ next_action: string;
397
+ created_at: string;
398
+ updated_at: string;
399
+ observed_at: string | undefined;
400
+ observation_error: string | undefined;
401
+ callback_configured: boolean;
402
+ callback_expected: boolean;
403
+ capabilities: {
404
+ interaction_notify: false;
405
+ interaction_respond: false;
406
+ approve: false;
407
+ model_options: false;
408
+ set_model: false;
409
+ permission_options: false;
410
+ set_permissions: false;
411
+ cancel: false;
412
+ new_thread: false;
413
+ clear_thread: false;
414
+ resume_thread: false;
415
+ list_resumable_threads: false;
416
+ status: boolean;
417
+ close: boolean;
418
+ unwatch: boolean;
419
+ renew: boolean;
420
+ recover: boolean;
421
+ retry_callback: boolean;
422
+ callback: boolean;
423
+ };
424
+ available_actions: {
425
+ recover?: {
426
+ tool: string;
427
+ input: {
428
+ watch_id: string;
429
+ };
430
+ } | undefined;
431
+ unwatch?: {
432
+ tool: string;
433
+ input: {
434
+ watch_id: string;
435
+ };
436
+ } | undefined;
437
+ close?: {
438
+ tool: string;
439
+ input: {
440
+ turn_id: string;
441
+ };
442
+ } | undefined;
443
+ retry_callback?: {
444
+ tool: string;
445
+ input: {
446
+ watch_id: string;
447
+ notification_id: string;
448
+ };
449
+ } | undefined;
450
+ renew?: {
451
+ tool: string;
452
+ input: {
453
+ watch_id: string;
454
+ };
455
+ } | undefined;
456
+ status: {
457
+ tool: string;
458
+ input: {
459
+ watch_id: string;
460
+ };
461
+ };
462
+ };
463
+ message_id: string;
464
+ delivered: boolean;
465
+ send_state: "accepted" | "attached" | "held" | "not_sent" | "refused" | "reserved" | "uncertain";
466
+ delivery_receipt: string;
467
+ agent_acceptance: string;
468
+ send_error: string | undefined;
469
+ resend_allowed: boolean;
470
+ response_text: string;
471
+ response_truncated: boolean;
472
+ progress: ClaudeNativePublicProgress | undefined;
473
+ } | {
474
+ task_kind: "send" | "watch";
475
+ turn_id?: string | undefined;
476
+ management_state: string;
477
+ deadline_at: string;
478
+ renewal_count: number;
479
+ closed_at: string | undefined;
480
+ close_reason: string | undefined;
481
+ unwatched_at: string | undefined;
482
+ renewed_at: string | undefined;
483
+ recovered_at: string | undefined;
484
+ callback_in_flight: boolean;
485
+ retryable_callback_ids: string[];
486
+ callback_state: string;
487
+ callback_delivery_scope: "controller_acceptance_only";
488
+ channel_delivery_state: "unknown";
489
+ callback_notifications: {
490
+ id: string;
491
+ notification_id: string;
492
+ status: string;
493
+ attempts: number;
494
+ controller_acceptance: string;
495
+ error_code?: string | undefined;
496
+ request_dispatched?: boolean | undefined;
497
+ request_phase?: string | undefined;
498
+ retry_budget_exhausted?: boolean | undefined;
499
+ max_delivery_attempts?: number | undefined;
500
+ next_attempt_at?: string | undefined;
501
+ automatic_retry_stopped?: boolean | undefined;
502
+ }[];
503
+ waiting_for: string | null;
504
+ attention_required: boolean;
505
+ manual_required: boolean;
506
+ interaction_requests_scanned: boolean;
507
+ pending_interaction_count: null;
508
+ interaction_hint?: {
509
+ kind: string;
510
+ actionable: boolean;
511
+ source: string;
512
+ } | undefined;
513
+ watch_id: string;
514
+ conversation_id: string;
515
+ source: string;
516
+ agent: string;
517
+ status: string;
518
+ observation_state: string;
519
+ task_origin: "send" | "watch";
520
+ observation_status: import("./claude-native-state-store.js").ClaudeNativeTaskStatus;
521
+ observation_active: boolean;
522
+ native_thread_id: string;
523
+ native_input_id: string | null;
524
+ task_anchor_kind: string;
525
+ observation_mode: string;
526
+ anchor_state: string;
527
+ needs_watch: boolean;
528
+ next_action: string;
529
+ created_at: string;
530
+ updated_at: string;
531
+ observed_at: string | undefined;
532
+ observation_error: string | undefined;
533
+ callback_configured: boolean;
534
+ callback_expected: boolean;
535
+ capabilities: {
536
+ interaction_notify: false;
537
+ interaction_respond: false;
538
+ approve: false;
539
+ model_options: false;
540
+ set_model: false;
541
+ permission_options: false;
542
+ set_permissions: false;
543
+ cancel: false;
544
+ new_thread: false;
545
+ clear_thread: false;
546
+ resume_thread: false;
547
+ list_resumable_threads: false;
548
+ status: boolean;
549
+ close: boolean;
550
+ unwatch: boolean;
551
+ renew: boolean;
552
+ recover: boolean;
553
+ retry_callback: boolean;
554
+ callback: boolean;
555
+ };
556
+ available_actions: {
557
+ recover?: {
558
+ tool: string;
559
+ input: {
560
+ watch_id: string;
561
+ };
562
+ } | undefined;
563
+ unwatch?: {
564
+ tool: string;
565
+ input: {
566
+ watch_id: string;
567
+ };
568
+ } | undefined;
569
+ close?: {
570
+ tool: string;
571
+ input: {
572
+ turn_id: string;
573
+ };
574
+ } | undefined;
575
+ retry_callback?: {
576
+ tool: string;
577
+ input: {
578
+ watch_id: string;
579
+ notification_id: string;
580
+ };
581
+ } | undefined;
582
+ renew?: {
583
+ tool: string;
584
+ input: {
585
+ watch_id: string;
586
+ };
587
+ } | undefined;
588
+ status: {
589
+ tool: string;
590
+ input: {
591
+ watch_id: string;
592
+ };
593
+ };
594
+ };
595
+ message_id: string;
596
+ delivered: boolean;
597
+ send_state: "accepted" | "attached" | "held" | "not_sent" | "refused" | "reserved" | "uncertain";
598
+ delivery_receipt: string;
599
+ agent_acceptance: string;
600
+ send_error: string | undefined;
601
+ resend_allowed: boolean;
602
+ response_text?: undefined;
603
+ response_truncated?: undefined;
604
+ progress?: undefined;
605
+ };
@@ -0,0 +1,98 @@
1
+ import { backendObservationStopped, backendTaskRecoveryProjection, isBackendCallbackRetryable } from "./backend-task-recovery.js";
2
+ import { backendCallbackPublicProjection } from "./backend-callback-public-projection.js";
3
+ import { createClaudeNativeConversationId } from "./claude-native-identity.js";
4
+ const specialCapabilities = {
5
+ interaction_notify: false, interaction_respond: false, approve: false,
6
+ model_options: false, set_model: false, permission_options: false, set_permissions: false,
7
+ cancel: false, new_thread: false, clear_thread: false, resume_thread: false, list_resumable_threads: false
8
+ };
9
+ const activeStatus = (status) => status === "watching" || status === "awaiting_acceptance";
10
+ const settledStatus = (status) => ["completed", "failed", "interrupted", "exited"].includes(status);
11
+ function waitingProjection(waitingFor, waiting) {
12
+ const kind = waitingFor === "permission prompt" ? "approval" : waitingFor === "input needed" ? "input" : "unknown";
13
+ return { waiting_for: !waiting ? null : kind === "approval" ? "permission prompt" : kind === "input" ? "input needed" : "unknown",
14
+ attention_required: waiting, manual_required: waiting,
15
+ interaction_requests_scanned: false, pending_interaction_count: null,
16
+ ...(waiting ? { interaction_hint: { kind, actionable: false, source: "native_registry" },
17
+ next_action: "return_to_claude_terminal" } : {}) };
18
+ }
19
+ /** The no-snapshot form is List-safe: no transcript read or progress/answer body. */
20
+ export function claudeNativeSessionProjection(entry, snapshot) {
21
+ const id = createClaudeNativeConversationId(entry);
22
+ const selected = snapshot?.selectedInput;
23
+ const current = selected?.inputUuid === snapshot?.latestInputUuid;
24
+ const watching = entry.status === "working" || entry.status === "waiting";
25
+ const canWatch = watching && (!snapshot || !snapshot.readError && current && selected?.kind === "root_user" && selected.state === "inProgress");
26
+ const canSend = entry.status === "idle";
27
+ return {
28
+ id, conversation_id: id, source: "claude_cli", agent: "claude",
29
+ title: entry.name ?? "Claude Code", cwd: entry.cwd,
30
+ native_thread_id: entry.sessionId, pid: entry.pid, agent_version: entry.version,
31
+ connection_state: "native_registry_verified", activity_state: entry.status, observed_at: entry.observedAt,
32
+ ...waitingProjection(entry.waitingFor, entry.status === "waiting"),
33
+ capabilities: { status: true, send: canSend, watch: canWatch, ...specialCapabilities },
34
+ available_actions: {
35
+ status: { tool: "agent_knock_knock_status", input: { conversation_id: id } },
36
+ ...(canSend ? { send: { tool: "agent_knock_knock_send", input: { conversation_id: id } } } : {}),
37
+ ...(canWatch ? { watch: { tool: "agent_knock_knock_watch", input: { conversation_id: id } } } : {})
38
+ },
39
+ ...(snapshot ? {
40
+ native_input_id: selected?.inputUuid ?? null, task_anchor_kind: "native_input_uuid",
41
+ read_at: snapshot.readAt, observation_error: snapshot.readError ?? selected?.reason,
42
+ input_state: selected?.state ?? "unknown", input_is_latest: current,
43
+ response_text: selected?.responseText ?? "", response_truncated: selected?.responseTruncated ?? false,
44
+ progress: snapshot.progress
45
+ } : {})
46
+ };
47
+ }
48
+ /** Send's internal Watch is the only completion monitor, never a second hidden subscription. */
49
+ export function claudeNativeTaskProjection(task, includeProgress = false) {
50
+ const { recovery_actions: commonActions, ...recovery } = backendTaskRecoveryProjection(task);
51
+ const stopped = backendObservationStopped(task), active = !stopped && activeStatus(task.status);
52
+ const settled = settledStatus(task.status);
53
+ const canRenew = !task.closed_at && !settled;
54
+ const { renew: commonRenew, ...otherActions } = commonActions;
55
+ const recoveryActions = { ...otherActions, ...(canRenew && commonRenew ? { renew: commonRenew } : {}) };
56
+ const nextAction = active ? "wait_or_status" : task.status === "timed_out" && canRenew ? "renew_existing_watch"
57
+ : task.status === "exited" ? "return_to_claude_terminal" : "none";
58
+ return {
59
+ watch_id: task.id, conversation_id: task.native_id, source: "claude_cli", agent: "claude",
60
+ status: task.closed_at ? "closed" : task.status, ...recovery,
61
+ observation_state: stopped ? "stopped" : settled ? "settled" : task.status === "timed_out" ? "expired" : "watching",
62
+ task_origin: task.kind, observation_status: task.status, observation_active: active,
63
+ native_thread_id: task.target.sessionId, native_input_id: task.native_input_id ?? null,
64
+ task_anchor_kind: "native_input_uuid", observation_mode: task.native_input_id ? "exact_task" : "pending_acceptance",
65
+ anchor_state: task.native_input_id ? "verified" : "pending", needs_watch: false, next_action: nextAction,
66
+ created_at: task.created_at, updated_at: task.updated_at, observed_at: task.observed_at,
67
+ observation_error: task.observation_error,
68
+ ...waitingProjection(task.waiting_for, active && Boolean(task.waiting_for)),
69
+ callback_configured: Boolean(task.callback_route), callback_expected: callbackExpected(task, active, stopped),
70
+ ...backendCallbackPublicProjection(task, active, stopped),
71
+ capabilities: { status: true, close: task.kind === "send" && !task.closed_at, unwatch: !stopped,
72
+ renew: canRenew, recover: !task.closed_at,
73
+ retry_callback: task.notifications.some(note => isBackendCallbackRetryable(task, note)),
74
+ callback: Boolean(task.callback_route) && !stopped, ...specialCapabilities },
75
+ available_actions: {
76
+ status: { tool: "agent_knock_knock_status", input: { watch_id: task.id } }, ...recoveryActions
77
+ },
78
+ ...sendProjection(task), ...bodyProjection(task, includeProgress)
79
+ };
80
+ }
81
+ function sendProjection(task) {
82
+ const intent = task.send_intent;
83
+ if (!intent)
84
+ return {};
85
+ const accepted = intent.state === "accepted";
86
+ return { message_id: intent.message_id, delivered: accepted, send_state: intent.state,
87
+ delivery_receipt: accepted ? "native_task_verified" : intent.state === "not_sent" ? "not_sent" : "acceptance_unproven",
88
+ agent_acceptance: accepted ? "proven" : "unproven", send_error: intent.error_code, resend_allowed: false };
89
+ }
90
+ function bodyProjection(task, includeProgress) {
91
+ return includeProgress ? { response_text: task.response_text ?? "", response_truncated: task.response_truncated ?? false,
92
+ progress: task.progress } : {};
93
+ }
94
+ function callbackExpected(task, active, stopped) {
95
+ const pending = task.notifications.some(note => ["ready", "leased", "retry_wait"].includes(note.status));
96
+ return Boolean(task.callback_route && !stopped && (active || pending));
97
+ }
98
+ //# sourceMappingURL=claude-native-public-projection.js.map