-
-
Notifications
You must be signed in to change notification settings - Fork 184
Expand file tree
/
Copy pathopenapi.yaml
More file actions
8502 lines (8491 loc) · 324 KB
/
Copy pathopenapi.yaml
File metadata and controls
8502 lines (8491 loc) · 324 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# DO NOT EDIT BY HAND. Generated from server/openapi.js via `npm run openapi:yaml`.
# This YAML mirrors the live spec served at GET /api/openapi.json.
openapi: 3.0.3
info:
title: Agent Dashboard for Claude Code API
version: 1.3.0
description: HTTP API for real-time Claude Code session monitoring, agent lifecycle tracking, analytics, pricing, hooks ingestion, and workflow intelligence.
contact:
name: Son Nguyen
email: hoangson091104@gmail.com
url: https://github.com/hoangsonww/Claude-Code-Agent-Monitor
license:
name: MIT
url: https://github.com/hoangsonww/Claude-Code-Agent-Monitor/blob/main/LICENSE
externalDocs:
description: Project documentation
url: https://github.com/hoangsonww/Claude-Code-Agent-Monitor#readme
servers:
- url: http://localhost:4820
description: Local dashboard server (default)
- url: http://127.0.0.1:4820
description: Local loopback endpoint used by hook-handler
tags:
- name: Health
description: Service liveness checks
- name: Sessions
description: Claude Code session lifecycle
- name: Agents
description: Main/subagent records and status
- name: Events
description: Event stream persistence
- name: Stats
description: High-level dashboard counters
- name: Analytics
description: Aggregated analytics views
- name: Hooks
description: Claude hook ingestion endpoint
- name: Pricing
description: Model pricing and token cost calculations
- name: Workflows
description: Workflow intelligence and session drill-in
- name: Settings
description: Operational maintenance endpoints
- name: Updates
description: Detect upstream git changes so users can pull and restart manually (local dashboard installs)
- name: Alerts
description: 'Rules-based alerting: rule CRUD, fired-alert feed, acknowledgement'
- name: Webhooks
description: 'Universal webhook delivery for fired alerts: target CRUD (Slack/Discord/Teams/generic), test probe, and delivery log. Secrets are never returned.'
- name: Documentation
description: OpenAPI/Swagger endpoints
- name: CcConfig
description: 'Claude Code configuration explorer: discover and (for low-risk artifacts) edit skills, agents, commands, output styles, MCP servers, hooks, settings, memory, plugins, marketplaces, keybindings, statusline'
- name: Run
description: Spawn and supervise Claude Code runs from the dashboard (headless or interactive conversation), stream output over WebSocket, and manage run history
- name: Push
description: Web Push notification subscriptions and broadcast (VAPID); also fires native Electron notifications when hosted in the desktop app
components:
parameters:
SessionIdPath:
name: id
in: path
required: true
schema:
type: string
description: Session ID
AgentIdPath:
name: id
in: path
required: true
schema:
type: string
description: Agent ID
PatternPath:
name: pattern
in: path
required: true
schema:
type: string
description: Model pattern (URL-encoded)
LimitQuery:
name: limit
in: query
required: false
schema:
type: integer
minimum: 0
description: Page size
OffsetQuery:
name: offset
in: query
required: false
schema:
type: integer
minimum: 0
description: Pagination offset
SessionStatusQuery:
name: status
in: query
required: false
schema:
type: string
enum:
- active
- completed
- error
- abandoned
description: Filter by session status
AgentStatusQuery:
name: status
in: query
required: false
schema:
type: string
enum:
- working
- waiting
- completed
- error
description: Filter by agent status
SessionFilterQuery:
name: session_id
in: query
required: false
schema:
type: string
description: Filter by session ID
WorkflowStatusQuery:
name: status
in: query
required: false
schema:
type: string
enum:
- all
- active
- completed
- error
- abandoned
description: Filter workflow aggregates by session status
schemas:
ErrorObject:
type: object
required:
- code
- message
properties:
code:
type: string
message:
type: string
ErrorResponse:
type: object
required:
- error
properties:
error:
$ref: '#/components/schemas/ErrorObject'
MessageErrorObject:
type: object
required:
- message
properties:
message:
type: string
MessageErrorResponse:
type: object
required:
- error
properties:
error:
$ref: '#/components/schemas/MessageErrorObject'
CountMap:
type: object
additionalProperties:
type: integer
Session:
type: object
required:
- id
- status
- started_at
- updated_at
properties:
id:
type: string
name:
type: string
nullable: true
status:
type: string
enum:
- active
- completed
- error
- abandoned
cwd:
type: string
nullable: true
model:
type: string
nullable: true
started_at:
type: string
format: date-time
ended_at:
type: string
format: date-time
nullable: true
metadata:
type: string
nullable: true
description: JSON-encoded session metadata
updated_at:
type: string
format: date-time
agent_count:
type: integer
nullable: true
last_activity:
type: string
format: date-time
nullable: true
cost:
type: number
nullable: true
awaiting_input_since:
type: string
format: date-time
nullable: true
description: ISO timestamp set when Claude Code is blocked waiting for the user (permission prompt or input request). Null when not waiting; cleared on the next non-Notification hook event.
awaiting_reason:
type: string
enum:
- notification
- stop
- session_start
- interrupted
nullable: true
description: 'Why the session is awaiting input: ''notification'' (Claude asked the user something), ''stop'' (turn completed, waiting for the next prompt), ''session_start'' (new/resumed session waiting for the first prompt), or ''interrupted'' (watchdog/Esc recovery). Null when not waiting; cleared alongside awaiting_input_since.'
Agent:
type: object
required:
- id
- session_id
- name
- type
- status
- started_at
- updated_at
properties:
id:
type: string
session_id:
type: string
name:
type: string
type:
type: string
enum:
- main
- subagent
subagent_type:
type: string
nullable: true
status:
type: string
enum:
- working
- waiting
- completed
- error
task:
type: string
nullable: true
current_tool:
type: string
nullable: true
started_at:
type: string
format: date-time
ended_at:
type: string
format: date-time
nullable: true
parent_agent_id:
type: string
nullable: true
metadata:
type: string
nullable: true
description: JSON-encoded agent metadata
updated_at:
type: string
format: date-time
awaiting_input_since:
type: string
format: date-time
nullable: true
description: ISO timestamp set when this agent is blocked waiting for user input. Cleared on the next non-Notification hook event for the session.
awaiting_reason:
type: string
enum:
- notification
- stop
- session_start
- interrupted
nullable: true
description: 'Why this agent is awaiting input: ''notification'' (Claude asked the user something), ''stop'' (turn completed, waiting for the next prompt), ''session_start'' (new/resumed session waiting for the first prompt), or ''interrupted'' (watchdog/Esc recovery). Null when not waiting; cleared alongside awaiting_input_since.'
DashboardEvent:
type: object
required:
- session_id
- event_type
- created_at
properties:
id:
type: integer
nullable: true
session_id:
type: string
agent_id:
type: string
nullable: true
event_type:
type: string
tool_name:
type: string
nullable: true
summary:
type: string
nullable: true
data:
type: string
nullable: true
description: JSON-encoded event payload
created_at:
type: string
format: date-time
HealthResponse:
type: object
required:
- status
- timestamp
properties:
status:
type: string
enum:
- ok
timestamp:
type: string
format: date-time
SessionsListResponse:
type: object
required:
- sessions
- limit
- offset
- total
properties:
sessions:
type: array
items:
$ref: '#/components/schemas/Session'
limit:
type: integer
offset:
type: integer
total:
type: integer
description: Total sessions matching the filters (independent of limit/offset). Used by paginators.
SessionCreateRequest:
type: object
required:
- id
properties:
id:
type: string
name:
type: string
cwd:
type: string
model:
type: string
metadata:
type: object
additionalProperties: true
SessionCreateResponse:
type: object
required:
- session
- created
properties:
session:
$ref: '#/components/schemas/Session'
created:
type: boolean
SessionDetailResponse:
type: object
required:
- session
- agents
- events
properties:
session:
$ref: '#/components/schemas/Session'
agents:
type: array
items:
$ref: '#/components/schemas/Agent'
events:
type: array
items:
$ref: '#/components/schemas/DashboardEvent'
TranscriptInfo:
type: object
required:
- id
- name
- type
- has_transcript
properties:
id:
type: string
description: '''main'' for the session''s main transcript, otherwise a subagent or compaction id.'
name:
type: string
type:
type: string
enum:
- main
- subagent
- compaction
subagent_type:
type: string
nullable: true
has_transcript:
type: boolean
db_agent_id:
type: string
nullable: true
description: Foreign key into agents.id when this transcript belongs to a tracked subagent.
TranscriptListResponse:
type: object
required:
- transcripts
properties:
transcripts:
type: array
items:
$ref: '#/components/schemas/TranscriptInfo'
TranscriptContent:
type: object
required:
- type
properties:
type:
type: string
enum:
- text
- tool_use
- tool_result
- thinking
text:
type: string
name:
type: string
description: Tool name when type === tool_use.
id:
type: string
description: Tool-use id used to pair tool_use with tool_result.
input:
description: 'Tool input payload (object) or { _truncated: string } when oversized.'
oneOf:
- type: object
additionalProperties: true
- type: string
output:
type: string
description: Tool output text when type === tool_result.
is_error:
type: boolean
TranscriptMessage:
type: object
required:
- type
- content
properties:
type:
type: string
enum:
- user
- assistant
- session_event
description: Raw line type. session_event is a synthetic marker (e.g. a /rename) injected by the server, not a real transcript line. Mid-turn queued messages (queued_command attachments) surface as type user.
sender:
type: string
enum:
- user
- assistant
- orchestrator
- system
- tool
description: 'TRUE sender of the line: the human (user), the agent (assistant), a subagent''s task assigned by its parent (orchestrator), a harness injection such as a task-notification or [SYSTEM NOTIFICATION …] banner (system), or a tool_result echoed on a user line (tool).'
timestamp:
type: string
format: date-time
nullable: true
content:
type: array
items:
$ref: '#/components/schemas/TranscriptContent'
line:
type: integer
minimum: 1
description: JSONL line number the message was parsed from (pagination cursor).
model:
type: string
usage:
type: object
properties:
input_tokens:
type: integer
minimum: 0
output_tokens:
type: integer
minimum: 0
cache_read_input_tokens:
type: integer
minimum: 0
cache_creation_input_tokens:
type: integer
minimum: 0
event_kind:
type: string
enum:
- rename
description: 'For type === session_event: the TUI action this marker represents.'
title:
type: string
description: 'For type === session_event: the new session title.'
TranscriptResponse:
type: object
required:
- messages
- total
- has_more
- last_line
- first_line
properties:
messages:
type: array
items:
$ref: '#/components/schemas/TranscriptMessage'
total:
type: integer
minimum: 0
description: Total messages available in the transcript.
has_more:
type: boolean
description: True when older messages remain (use `before` to load them).
last_line:
type: integer
minimum: 0
description: JSONL line number of the newest returned message — pass back as `after` for incremental fetches.
first_line:
type: integer
minimum: 0
description: JSONL line number of the oldest returned message — pass back as `before` to page backwards.
SessionStatsResponse:
type: object
description: Aggregated counts powering the SessionOverview panel on the Session Detail page. All aggregation runs in SQL.
required:
- session_id
- total_events
- events_by_type
- tools_used
- error_count
- first_event_at
- last_event_at
- agents
- subagent_types
- tokens
properties:
session_id:
type: string
total_events:
type: integer
minimum: 0
events_by_type:
type: array
items:
type: object
required:
- event_type
- count
properties:
event_type:
type: string
count:
type: integer
minimum: 0
tools_used:
type: array
description: Top 15 tools used in this session, sorted by count descending.
items:
type: object
required:
- tool_name
- count
properties:
tool_name:
type: string
count:
type: integer
minimum: 0
error_count:
type: integer
minimum: 0
description: Events whose event_type or summary matches /error/i or /failed/i (case-insensitive).
first_event_at:
type: string
format: date-time
nullable: true
last_event_at:
type: string
format: date-time
nullable: true
agents:
type: object
required:
- total
- main
- subagent
- compaction
- by_status
properties:
total:
type: integer
minimum: 0
main:
type: integer
minimum: 0
subagent:
type: integer
minimum: 0
compaction:
type: integer
minimum: 0
by_status:
type: object
additionalProperties:
type: integer
minimum: 0
subagent_types:
type: array
description: Subagent types in this session with counts. Excludes the special 'compaction' type which is surfaced via agents.compaction.
items:
type: object
required:
- subagent_type
- count
properties:
subagent_type:
type: string
count:
type: integer
minimum: 0
tokens:
type: object
required:
- input_tokens
- output_tokens
- cache_read_tokens
- cache_write_tokens
properties:
input_tokens:
type: integer
minimum: 0
output_tokens:
type: integer
minimum: 0
cache_read_tokens:
type: integer
minimum: 0
cache_write_tokens:
type: integer
minimum: 0
SessionUpdateRequest:
type: object
properties:
name:
type: string
status:
type: string
enum:
- active
- completed
- error
- abandoned
ended_at:
type: string
format: date-time
metadata:
type: object
additionalProperties: true
SessionUpdateResponse:
type: object
required:
- session
properties:
session:
$ref: '#/components/schemas/Session'
AgentsListResponse:
type: object
required:
- agents
- limit
- offset
properties:
agents:
type: array
items:
$ref: '#/components/schemas/Agent'
limit:
type: integer
offset:
type: integer
AgentCreateRequest:
type: object
required:
- id
- session_id
- name
properties:
id:
type: string
session_id:
type: string
name:
type: string
type:
type: string
enum:
- main
- subagent
subagent_type:
type: string
status:
type: string
enum:
- working
- waiting
- completed
- error
task:
type: string
parent_agent_id:
type: string
metadata:
type: object
additionalProperties: true
AgentCreateResponse:
type: object
required:
- agent
- created
properties:
agent:
$ref: '#/components/schemas/Agent'
created:
type: boolean
AgentDetailResponse:
type: object
required:
- agent
properties:
agent:
$ref: '#/components/schemas/Agent'
AgentUpdateRequest:
type: object
properties:
name:
type: string
status:
type: string
enum:
- working
- waiting
- completed
- error
task:
type: string
current_tool:
type: string
nullable: true
ended_at:
type: string
format: date-time
metadata:
type: object
additionalProperties: true
AgentUpdateResponse:
type: object
required:
- agent
properties:
agent:
$ref: '#/components/schemas/Agent'
EventsListResponse:
type: object
required:
- events
- limit
- offset
- total
properties:
events:
type: array
items:
$ref: '#/components/schemas/DashboardEvent'
limit:
type: integer
offset:
type: integer
total:
type: integer
description: Total rows matching the current filter (for UI pagination)
EventsFacetsResponse:
type: object
required:
- event_types
- tool_names
properties:
event_types:
type: array
items:
type: string
tool_names:
type: array
items:
type: string
StatsResponse:
type: object
required:
- total_sessions
- active_sessions
- active_agents
- total_agents
- total_events
- events_today
- ws_connections
- agents_by_status
- sessions_by_status
properties:
total_sessions:
type: integer
active_sessions:
type: integer
active_agents:
type: integer
total_agents:
type: integer
total_events:
type: integer
events_today:
type: integer
ws_connections:
type: integer
agents_by_status:
$ref: '#/components/schemas/CountMap'
sessions_by_status:
$ref: '#/components/schemas/CountMap'
AnalyticsResponse:
type: object
required:
- tokens
- tool_usage
- daily_events
- daily_sessions
- agent_types
- event_types
- avg_events_per_session
- total_subagents
- overview
- agents_by_status
- sessions_by_status
properties:
tokens:
type: object
required:
- total_input
- total_output
- total_cache_read
- total_cache_write
properties:
total_input:
type: integer
total_output:
type: integer
total_cache_read:
type: integer
total_cache_write:
type: integer
tool_usage:
type: array
items:
type: object
required:
- tool_name
- count
properties:
tool_name:
type: string
count:
type: integer
daily_events:
type: array
items:
type: object
required:
- date
- count
properties:
date:
type: string
count:
type: integer
daily_sessions:
type: array
items:
type: object
required:
- date
- count
properties:
date:
type: string
count:
type: integer
agent_types:
type: array
items:
type: object
required:
- subagent_type
- count
properties:
subagent_type:
type: string
nullable: true
count:
type: integer
event_types:
type: array
items:
type: object
required:
- event_type
- count
properties:
event_type:
type: string
count:
type: integer
avg_events_per_session:
type: number
total_subagents:
type: integer
overview:
type: object
required:
- total_sessions
- active_sessions
- active_agents
- total_agents
- total_events
properties:
total_sessions:
type: integer
active_sessions:
type: integer
active_agents:
type: integer
total_agents:
type: integer
total_events:
type: integer
agents_by_status:
$ref: '#/components/schemas/CountMap'
sessions_by_status:
$ref: '#/components/schemas/CountMap'
HookEventRequest:
type: object
required:
- hook_type
- data
properties:
hook_type:
type: string