Repository navigation
Expand file tree
/
Copy pathapi.ts
More file actions
3004 lines (2709 loc) · 128 KB
/
Copy pathapi.ts
File metadata and controls
3004 lines (2709 loc) · 128 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
// Generated by @opencode/httpapi-codegen. Do not edit.
import type { Effect, Stream } from "effect"
import type { Location } from "@opencode/schema/location"
import type { Agent } from "@opencode/schema/agent"
import type { Plugin } from "@opencode/schema/plugin"
import type { Session } from "@opencode/schema/session"
import type { AbsolutePath } from "@opencode/schema/schema"
import type { Project } from "@opencode/schema/project"
import type { RelativePath } from "@opencode/schema/schema"
import type { Model } from "@opencode/schema/model"
import type { Permission } from "@opencode/schema/permission"
import type { SessionMessage } from "@opencode/schema/session-message"
import type { SessionInbox } from "@opencode/schema/session-inbox"
import type { PromptInput } from "@opencode/schema/prompt-input"
import type { AgentAttachment } from "@opencode/schema/prompt"
import type { FileDiff } from "@opencode/schema/file-diff"
import type { Form } from "@opencode/schema/form"
import type { DateTime } from "effect"
import type { Money } from "@opencode/schema/money"
import type { Skill } from "@opencode/schema/skill"
import type { InstructionEntry } from "@opencode/schema/instruction-entry"
import type { Schema } from "effect"
import type { Event } from "@opencode/schema/event"
import type { EventLog } from "@opencode/schema/event-log"
import type { Workspace } from "@opencode/schema/workspace"
import type { Instruction } from "@opencode/schema/instruction"
import type { Snapshot } from "@opencode/schema/snapshot"
import type { Shell } from "@opencode/schema/shell"
import type { Generate } from "@opencode/schema/generate"
import type { Provider } from "@opencode/schema/provider"
import type { Integration } from "@opencode/schema/integration"
import type { Mcp } from "@opencode/schema/mcp"
import type { PtyTicket } from "@opencode/schema/pty-ticket"
import type { Credential } from "@opencode/schema/credential"
import type { PermissionSaved } from "@opencode/schema/permission-saved"
import type { FileSystem } from "@opencode/schema/filesystem"
import type { Command } from "@opencode/schema/command"
import type { OpenCodeEvent } from "@opencode/protocol/groups/event"
import type { Pty } from "@opencode/schema/pty"
import type { Schedule } from "@opencode/schema/schedule"
import type { Reference } from "@opencode/schema/reference"
import type { Worktree } from "@opencode/schema/worktree"
import type { Vcs } from "@opencode/schema/vcs"
import type { WebSearch } from "@opencode/schema/websearch"
import type { UsageLimits } from "@opencode/schema/usage-limits"
import type { Config } from "@opencode/schema/config"
export type ServerInfoOutput = {
readonly version: string
readonly pid: number
readonly hostname?: string | undefined
readonly urls: ReadonlyArray<string>
readonly paths: { readonly tmp: string }
readonly capabilities?: { readonly persistentPty?: boolean | undefined } | undefined
}
export type ServerInfoOperation<E = never> = () => Effect.Effect<ServerInfoOutput, E>
export type ServerPairOutput = { readonly code: string; readonly expires_in: number }
export type ServerPairOperation<E = never> = () => Effect.Effect<ServerPairOutput, E>
export type ServerConnectInput = { readonly code: string }
export type ServerConnectOutput = { readonly token: string }
export type ServerConnectOperation<E = never> = (input: ServerConnectInput) => Effect.Effect<ServerConnectOutput, E>
export interface ServerApi<E = never> {
readonly info: ServerInfoOperation<E>
readonly pair: ServerPairOperation<E>
readonly connect: ServerConnectOperation<E>
}
export type LocationGetInput = { readonly location?: { readonly directory?: string | undefined } | undefined }
export type LocationGetOutput = Location.PublicInfo
export type LocationGetOperation<E = never> = (input?: LocationGetInput) => Effect.Effect<LocationGetOutput, E>
export type LocationReloadOutput = void
export type LocationReloadOperation<E = never> = () => Effect.Effect<LocationReloadOutput, E>
export interface LocationApi<E = never> {
readonly get: LocationGetOperation<E>
readonly reload: LocationReloadOperation<E>
}
export type AgentListInput = { readonly location?: { readonly directory?: string | undefined } | undefined }
export type AgentListOutput = { readonly location: Location.PublicRef; readonly data: ReadonlyArray<Agent.Info> }
export type AgentListOperation<E = never> = (input?: AgentListInput) => Effect.Effect<AgentListOutput, E>
export type AgentGetInput = {
readonly agentID: Agent.ID
readonly location?: { readonly directory?: string | undefined } | undefined
}
export type AgentGetOutput = { readonly location: Location.PublicRef; readonly data: Agent.Info }
export type AgentGetOperation<E = never> = (input: AgentGetInput) => Effect.Effect<AgentGetOutput, E>
export interface AgentApi<E = never> {
readonly list: AgentListOperation<E>
readonly get: AgentGetOperation<E>
}
export type PluginListInput = { readonly location?: { readonly directory?: string | undefined } | undefined }
export type PluginListOutput = { readonly location: Location.PublicRef; readonly data: ReadonlyArray<Plugin.Info> }
export type PluginListOperation<E = never> = (input?: PluginListInput) => Effect.Effect<PluginListOutput, E>
export type PluginGuiInput = {
readonly location?: { readonly directory?: string | undefined } | undefined
readonly id: Plugin.ID
}
export type PluginGuiOutput = { readonly location: Location.PublicRef; readonly data: Plugin.GuiBundle }
export type PluginGuiOperation<E = never> = (input: PluginGuiInput) => Effect.Effect<PluginGuiOutput, E>
export type PluginCheckInput = {
readonly location?: { readonly directory?: string | undefined } | undefined
readonly target?: string | undefined
}
export type PluginCheckOutput = { readonly location: Location.PublicRef; readonly data: ReadonlyArray<Plugin.Info> }
export type PluginCheckOperation<E = never> = (input?: PluginCheckInput) => Effect.Effect<PluginCheckOutput, E>
export type PluginUpdateInput = {
readonly location?: { readonly directory?: string | undefined } | undefined
readonly targets: ReadonlyArray<string>
}
export type PluginUpdateOutput = void
export type PluginUpdateOperation<E = never> = (input: PluginUpdateInput) => Effect.Effect<PluginUpdateOutput, E>
export interface PluginApi<E = never> {
readonly list: PluginListOperation<E>
readonly gui: PluginGuiOperation<E>
readonly check: PluginCheckOperation<E>
readonly update: PluginUpdateOperation<E>
}
export type SessionListInput = {
readonly limit?: number | undefined
readonly order?: "asc" | "desc" | undefined
readonly search?: string | undefined
readonly parentID?: Session.ID | null | undefined
readonly archived?: boolean | undefined
readonly directory?: AbsolutePath | undefined
readonly project?: Project.ID | undefined
readonly subpath?: RelativePath | undefined
readonly cursor?: Session.ListCursor | undefined
}
export type SessionListOutput = {
readonly data: ReadonlyArray<Session.Info>
readonly cursor: {
readonly previous?: Session.ListCursor | undefined
readonly next?: Session.ListCursor | undefined
}
}
export type SessionListOperation<E = never> = (input?: SessionListInput) => Effect.Effect<SessionListOutput, E>
export type SessionCreateInput = {
readonly id?: Session.ID | undefined
readonly parentID?: Session.ID | undefined
readonly title?: string | undefined
readonly agent?: Agent.ID | undefined
readonly model?: Model.Ref | undefined
readonly location?: Location.PublicRef | undefined
readonly metadata?: Session.Metadata | undefined
readonly permissions?: Permission.Ruleset | undefined
}
export type SessionCreateOutput = Session.Info
export type SessionCreateOperation<E = never> = (input?: SessionCreateInput) => Effect.Effect<SessionCreateOutput, E>
export type SessionActiveOutput = { readonly [x: Session.ID]: { readonly type: "running" } }
export type SessionActiveOperation<E = never> = () => Effect.Effect<SessionActiveOutput, E>
export type SessionGetInput = { readonly sessionID: Session.ID }
export type SessionGetOutput = Session.Info
export type SessionGetOperation<E = never> = (input: SessionGetInput) => Effect.Effect<SessionGetOutput, E>
export type SessionRemoveInput = { readonly sessionID: Session.ID }
export type SessionRemoveOutput = void
export type SessionRemoveOperation<E = never> = (input: SessionRemoveInput) => Effect.Effect<SessionRemoveOutput, E>
export type SessionForkInput = { readonly sessionID: Session.ID; readonly before?: SessionMessage.ID | undefined }
export type SessionForkOutput = Session.Info
export type SessionForkOperation<E = never> = (input: SessionForkInput) => Effect.Effect<SessionForkOutput, E>
export type SessionSwitchAgentInput = { readonly sessionID: Session.ID; readonly agent: Agent.ID }
export type SessionSwitchAgentOutput = void
export type SessionSwitchAgentOperation<E = never> = (
input: SessionSwitchAgentInput,
) => Effect.Effect<SessionSwitchAgentOutput, E>
export type SessionSwitchModelInput = { readonly sessionID: Session.ID; readonly model: Model.Ref }
export type SessionSwitchModelOutput = void
export type SessionSwitchModelOperation<E = never> = (
input: SessionSwitchModelInput,
) => Effect.Effect<SessionSwitchModelOutput, E>
export type SessionUpdateInput = {
readonly sessionID: Session.ID
readonly title?: string | undefined
readonly metadata?: Session.Metadata | undefined
readonly permissions?: Permission.Ruleset | undefined
readonly archived?: boolean | undefined
}
export type SessionUpdateOutput = void
export type SessionUpdateOperation<E = never> = (input: SessionUpdateInput) => Effect.Effect<SessionUpdateOutput, E>
export type SessionMoveInput = {
readonly sessionID: Session.ID
readonly directory: AbsolutePath
readonly delivery?: SessionInbox.Delivery | undefined
}
export type SessionMoveOutput = void
export type SessionMoveOperation<E = never> = (input: SessionMoveInput) => Effect.Effect<SessionMoveOutput, E>
export type SessionPromptInput = {
readonly sessionID: Session.ID
readonly id?: SessionMessage.ID | undefined
readonly text: string
readonly files?: ReadonlyArray<PromptInput.FileAttachment> | undefined
readonly agents?: ReadonlyArray<AgentAttachment> | undefined
readonly skills?: ReadonlyArray<PromptInput.SkillAttachment> | undefined
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly delivery?: SessionInbox.Delivery | undefined
readonly resume?: boolean | undefined
}
export type SessionPromptOutput = SessionInbox.User
export type SessionPromptOperation<E = never> = (input: SessionPromptInput) => Effect.Effect<SessionPromptOutput, E>
export type SessionCommandInput = {
readonly sessionID: Session.ID
readonly name: string
readonly text: string
readonly files?: ReadonlyArray<PromptInput.FileAttachment> | undefined
readonly agents?: ReadonlyArray<AgentAttachment> | undefined
readonly skills?: ReadonlyArray<PromptInput.SkillAttachment> | undefined
readonly delivery?: SessionInbox.Delivery | undefined
}
export type SessionCommandOutput = void
export type SessionCommandOperation<E = never> = (input: SessionCommandInput) => Effect.Effect<SessionCommandOutput, E>
export type SessionSyntheticInput = {
readonly sessionID: Session.ID
readonly id?: SessionMessage.ID | undefined
readonly text: string
readonly description?: string | undefined
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly delivery?: SessionInbox.Delivery | undefined
readonly resume?: boolean | undefined
}
export type SessionSyntheticOutput = SessionInbox.Synthetic
export type SessionSyntheticOperation<E = never> = (
input: SessionSyntheticInput,
) => Effect.Effect<SessionSyntheticOutput, E>
export type SessionShellInput = {
readonly sessionID: Session.ID
readonly id?: SessionMessage.ID | undefined
readonly command: string
}
export type SessionShellOutput = void
export type SessionShellOperation<E = never> = (input: SessionShellInput) => Effect.Effect<SessionShellOutput, E>
export type SessionCompactInput = {
readonly sessionID: Session.ID
readonly id?: SessionMessage.ID | undefined
readonly delivery?: SessionInbox.Delivery | undefined
}
export type SessionCompactOutput = SessionInbox.Compaction
export type SessionCompactOperation<E = never> = (input: SessionCompactInput) => Effect.Effect<SessionCompactOutput, E>
export type SessionRevertStageInput = {
readonly sessionID: Session.ID
readonly messageID: SessionMessage.ID
readonly files?: boolean | undefined
}
export type SessionRevertStageOutput = Session.Revert
export type SessionRevertStageOperation<E = never> = (
input: SessionRevertStageInput,
) => Effect.Effect<SessionRevertStageOutput, E>
export type SessionRevertClearInput = { readonly sessionID: Session.ID }
export type SessionRevertClearOutput = void
export type SessionRevertClearOperation<E = never> = (
input: SessionRevertClearInput,
) => Effect.Effect<SessionRevertClearOutput, E>
export type SessionRevertCommitInput = { readonly sessionID: Session.ID }
export type SessionRevertCommitOutput = void
export type SessionRevertCommitOperation<E = never> = (
input: SessionRevertCommitInput,
) => Effect.Effect<SessionRevertCommitOutput, E>
export type SessionContextInput = { readonly sessionID: Session.ID }
export type SessionContextOutput = ReadonlyArray<SessionMessage.Info>
export type SessionContextOperation<E = never> = (input: SessionContextInput) => Effect.Effect<SessionContextOutput, E>
export type SessionDiffInput = {
readonly sessionID: Session.ID
readonly from?: SessionMessage.ID | undefined
readonly to?: SessionMessage.ID | undefined
readonly context?: number | undefined
}
export type SessionDiffOutput = ReadonlyArray<FileDiff.Info>
export type SessionDiffOperation<E = never> = (input: SessionDiffInput) => Effect.Effect<SessionDiffOutput, E>
export type SessionInboxListInput = { readonly sessionID: Session.ID }
export type SessionInboxListOutput = ReadonlyArray<SessionInbox.Info>
export type SessionInboxListOperation<E = never> = (
input: SessionInboxListInput,
) => Effect.Effect<SessionInboxListOutput, E>
export type SessionInboxCancelInput = { readonly sessionID: Session.ID; readonly inboxID: SessionMessage.ID }
export type SessionInboxCancelOutput = void
export type SessionInboxCancelOperation<E = never> = (
input: SessionInboxCancelInput,
) => Effect.Effect<SessionInboxCancelOutput, E>
export type SessionInboxUpdateInput = {
readonly sessionID: Session.ID
readonly inboxID: SessionMessage.ID
readonly delivery: SessionInbox.Delivery
}
export type SessionInboxUpdateOutput = void
export type SessionInboxUpdateOperation<E = never> = (
input: SessionInboxUpdateInput,
) => Effect.Effect<SessionInboxUpdateOutput, E>
export type SessionGenerateInput = { readonly sessionID: Session.ID; readonly prompt: string }
export type SessionGenerateOutput = { readonly text: string }
export type SessionGenerateOperation<E = never> = (
input: SessionGenerateInput,
) => Effect.Effect<SessionGenerateOutput, E>
export type SessionInterruptInput = { readonly sessionID: Session.ID; readonly resume?: boolean | undefined }
export type SessionInterruptOutput = { readonly interrupted: boolean }
export type SessionInterruptOperation<E = never> = (
input: SessionInterruptInput,
) => Effect.Effect<SessionInterruptOutput, E>
export type SessionBackgroundInput = { readonly sessionID: Session.ID }
export type SessionBackgroundOutput = void
export type SessionBackgroundOperation<E = never> = (
input: SessionBackgroundInput,
) => Effect.Effect<SessionBackgroundOutput, E>
export type SessionMessageGetInput = { readonly sessionID: Session.ID; readonly messageID: SessionMessage.ID }
export type SessionMessageGetOutput = SessionMessage.Info
export type SessionMessageGetOperation<E = never> = (
input: SessionMessageGetInput,
) => Effect.Effect<SessionMessageGetOutput, E>
export type SessionFormListInput = { readonly sessionID: string }
export type SessionFormListOutput = ReadonlyArray<Form.Info>
export type SessionFormListOperation<E = never> = (
input: SessionFormListInput,
) => Effect.Effect<SessionFormListOutput, E>
export type SessionFormCreateInput = {
readonly sessionID: string
readonly id?: Form.ID | undefined
readonly title: string
readonly metadata?: Form.Metadata | undefined
readonly fields: Form.Fields
}
export type SessionFormCreateOutput = Form.Info
export type SessionFormCreateOperation<E = never> = (
input: SessionFormCreateInput,
) => Effect.Effect<SessionFormCreateOutput, E>
export type SessionFormGetInput = { readonly sessionID: string; readonly formID: Form.ID }
export type SessionFormGetOutput = Form.Detail
export type SessionFormGetOperation<E = never> = (input: SessionFormGetInput) => Effect.Effect<SessionFormGetOutput, E>
export type SessionFormReplyInput = {
readonly sessionID: string
readonly formID: Form.ID
readonly answer: Form.Answer
}
export type SessionFormReplyOutput = void
export type SessionFormReplyOperation<E = never> = (
input: SessionFormReplyInput,
) => Effect.Effect<SessionFormReplyOutput, E>
export type SessionFormCancelInput = {
readonly sessionID: string
readonly formID: Form.ID
readonly message?: string | undefined
}
export type SessionFormCancelOutput = void
export type SessionFormCancelOperation<E = never> = (
input: SessionFormCancelInput,
) => Effect.Effect<SessionFormCancelOutput, E>
export type SessionEnvironmentInput = {
readonly sessionID: Session.ID
readonly variables: { readonly [x: string]: string }
}
export type SessionEnvironmentOutput = void
export type SessionEnvironmentOperation<E = never> = (
input: SessionEnvironmentInput,
) => Effect.Effect<SessionEnvironmentOutput, E>
export type SessionViewInput = { readonly sessionID: Session.ID; readonly idle: DateTime.Utc }
export type SessionViewOutput = void
export type SessionViewOperation<E = never> = (input: SessionViewInput) => Effect.Effect<SessionViewOutput, E>
export interface SessionApi<E = never> {
readonly list: SessionListOperation<E>
readonly create: SessionCreateOperation<E>
readonly active: SessionActiveOperation<E>
readonly get: SessionGetOperation<E>
readonly remove: SessionRemoveOperation<E>
readonly fork: SessionForkOperation<E>
readonly switchAgent: SessionSwitchAgentOperation<E>
readonly switchModel: SessionSwitchModelOperation<E>
readonly update: SessionUpdateOperation<E>
readonly move: SessionMoveOperation<E>
readonly prompt: SessionPromptOperation<E>
readonly command: SessionCommandOperation<E>
readonly synthetic: SessionSyntheticOperation<E>
readonly shell: SessionShellOperation<E>
readonly compact: SessionCompactOperation<E>
readonly revert: {
readonly stage: SessionRevertStageOperation<E>
readonly clear: SessionRevertClearOperation<E>
readonly commit: SessionRevertCommitOperation<E>
}
readonly context: SessionContextOperation<E>
readonly diff: SessionDiffOperation<E>
readonly inbox: {
readonly list: SessionInboxListOperation<E>
readonly cancel: SessionInboxCancelOperation<E>
readonly update: SessionInboxUpdateOperation<E>
}
readonly generate: SessionGenerateOperation<E>
readonly interrupt: SessionInterruptOperation<E>
readonly background: SessionBackgroundOperation<E>
readonly message: { readonly get: SessionMessageGetOperation<E> }
readonly form: {
readonly list: SessionFormListOperation<E>
readonly create: SessionFormCreateOperation<E>
readonly get: SessionFormGetOperation<E>
readonly reply: SessionFormReplyOperation<E>
readonly cancel: SessionFormCancelOperation<E>
}
readonly environment: SessionEnvironmentOperation<E>
readonly view: SessionViewOperation<E>
/** @deprecated Use `client.experimental.session.stats`. Removed in the next minor. */
readonly stats: ExperimentalSessionStatsOperation<E>
/** @deprecated Use `client.experimental.session.import`. Removed in the next minor. */
readonly import: ExperimentalSessionImportOperation<E>
/** @deprecated Use `client.experimental.session.export`. Removed in the next minor. */
readonly export: ExperimentalSessionExportOperation<E>
/** @deprecated Use `client.experimental.session.skill`. Removed in the next minor. */
readonly skill: ExperimentalSessionSkillOperation<E>
/** @deprecated Use `client.experimental.session.wait`. Removed in the next minor. */
readonly wait: ExperimentalSessionWaitOperation<E>
/** @deprecated Use `client.experimental.session.instructions`. Removed in the next minor. */
readonly instructions: {
/** @deprecated Use `client.experimental.session.instructions.entry`. Removed in the next minor. */
readonly entry: {
/** @deprecated Use `client.experimental.session.instructions.entry.list`. Removed in the next minor. */
readonly list: ExperimentalSessionInstructionsEntryListOperation<E>
/** @deprecated Use `client.experimental.session.instructions.entry.put`. Removed in the next minor. */
readonly put: ExperimentalSessionInstructionsEntryPutOperation<E>
/** @deprecated Use `client.experimental.session.instructions.entry.remove`. Removed in the next minor. */
readonly remove: ExperimentalSessionInstructionsEntryRemoveOperation<E>
}
}
/** @deprecated Use `client.experimental.session.log`. Removed in the next minor. */
readonly log: ExperimentalSessionLogOperation<E>
}
export type ExperimentalSessionStatsInput = {
readonly from?: number | undefined
readonly to?: number | undefined
readonly project?: Project.ID | undefined
readonly timezone?: string | undefined
readonly tools?: "none" | "summary" | "detail" | undefined
}
export type ExperimentalSessionStatsOutput = {
readonly range: { readonly from: DateTime.Utc; readonly to: DateTime.Utc }
readonly sessions: number
readonly subagents: number
readonly prompts: number
readonly steps: number
readonly tokens: {
readonly input: number
readonly output: number
readonly reasoning: number
readonly cache: { readonly read: number; readonly write: number }
}
readonly cost: Money.USD
readonly tools:
| { readonly mode: "none" }
| {
readonly mode: "summary"
readonly totals: {
readonly calls: number
readonly succeeded: number
readonly failed: number
readonly unfinished: number
}
}
| {
readonly mode: "detail"
readonly totals: {
readonly calls: number
readonly succeeded: number
readonly failed: number
readonly unfinished: number
}
readonly usage: ReadonlyArray<{
readonly name: string
readonly calls: number
readonly succeeded: number
readonly failed: number
readonly unfinished: number
readonly durationP50?: number | undefined
}>
}
readonly activeDays: number
readonly streak: number
readonly activity: ReadonlyArray<{ readonly date: string; readonly steps: number }>
readonly models: ReadonlyArray<{
readonly model: Model.Ref
readonly steps: number
readonly tokens: {
readonly input: number
readonly output: number
readonly reasoning: number
readonly cache: { readonly read: number; readonly write: number }
}
readonly cost: Money.USD
}>
}
export type ExperimentalSessionStatsOperation<E = never> = (
input?: ExperimentalSessionStatsInput,
) => Effect.Effect<ExperimentalSessionStatsOutput, E>
export type ExperimentalSessionImportInput = {
readonly info: Session.Info
readonly messages: ReadonlyArray<SessionMessage.Info>
readonly location?: Location.PublicRef | undefined
}
export type ExperimentalSessionImportOutput = Session.Info
export type ExperimentalSessionImportOperation<E = never> = (
input: ExperimentalSessionImportInput,
) => Effect.Effect<ExperimentalSessionImportOutput, E>
export type ExperimentalSessionExportInput = { readonly sessionID: Session.ID; readonly sanitize?: boolean | undefined }
export type ExperimentalSessionExportOutput = {
readonly info: Session.Info
readonly messages: ReadonlyArray<SessionMessage.Info>
}
export type ExperimentalSessionExportOperation<E = never> = (
input: ExperimentalSessionExportInput,
) => Effect.Effect<ExperimentalSessionExportOutput, E>
export type ExperimentalSessionSkillInput = {
readonly sessionID: Session.ID
readonly id: Skill.ID
readonly resume?: boolean | undefined
}
export type ExperimentalSessionSkillOutput = void
export type ExperimentalSessionSkillOperation<E = never> = (
input: ExperimentalSessionSkillInput,
) => Effect.Effect<ExperimentalSessionSkillOutput, E>
export type ExperimentalSessionWaitInput = { readonly sessionID: Session.ID }
export type ExperimentalSessionWaitOutput = void
export type ExperimentalSessionWaitOperation<E = never> = (
input: ExperimentalSessionWaitInput,
) => Effect.Effect<ExperimentalSessionWaitOutput, E>
export type ExperimentalSessionInstructionsEntryListInput = { readonly sessionID: Session.ID }
export type ExperimentalSessionInstructionsEntryListOutput = ReadonlyArray<InstructionEntry.Info>
export type ExperimentalSessionInstructionsEntryListOperation<E = never> = (
input: ExperimentalSessionInstructionsEntryListInput,
) => Effect.Effect<ExperimentalSessionInstructionsEntryListOutput, E>
export type ExperimentalSessionInstructionsEntryPutInput = {
readonly sessionID: Session.ID
readonly key: InstructionEntry.Key
readonly value: Schema.Json
}
export type ExperimentalSessionInstructionsEntryPutOutput = void
export type ExperimentalSessionInstructionsEntryPutOperation<E = never> = (
input: ExperimentalSessionInstructionsEntryPutInput,
) => Effect.Effect<ExperimentalSessionInstructionsEntryPutOutput, E>
export type ExperimentalSessionInstructionsEntryRemoveInput = {
readonly sessionID: Session.ID
readonly key: InstructionEntry.Key
}
export type ExperimentalSessionInstructionsEntryRemoveOutput = void
export type ExperimentalSessionInstructionsEntryRemoveOperation<E = never> = (
input: ExperimentalSessionInstructionsEntryRemoveInput,
) => Effect.Effect<ExperimentalSessionInstructionsEntryRemoveOutput, E>
export type ExperimentalSessionLogInput = {
readonly sessionID: Session.ID
readonly after?: Event.Seq | undefined
readonly follow?: boolean | undefined
}
export type ExperimentalSessionLogOutput =
| (
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.created"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: {
readonly sessionID: Session.ID
readonly projectID: Project.ID
readonly location: { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
readonly subpath?: RelativePath | undefined
readonly parentID?: Session.ID | undefined
readonly slug: string
readonly title?: string | undefined
readonly agent?: Agent.ID | undefined
readonly model?: Model.Ref | undefined
readonly metadata?: Session.Metadata | undefined
readonly permissions?: Permission.Ruleset | undefined
readonly version: string
}
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.agent.selected"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: {
readonly sessionID: Session.ID
readonly agent: Agent.ID
readonly previous?: Agent.ID | undefined
}
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.model.selected"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: {
readonly sessionID: Session.ID
readonly model: Model.Ref
readonly previous?: Model.Ref | undefined
}
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.moved"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: {
readonly sessionID: Session.ID
readonly location: { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
readonly projectID: Project.ID
readonly subpath?: RelativePath | undefined
}
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.renamed"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: { readonly sessionID: Session.ID; readonly title: string }
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.metadata.updated"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: { readonly sessionID: Session.ID; readonly metadata: Session.Metadata }
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.permissions"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: { readonly sessionID: Session.ID; readonly permissions: Permission.Ruleset }
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.viewed"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: { readonly sessionID: Session.ID; readonly idle: number }
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.archived"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: { readonly sessionID: Session.ID }
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.unarchived"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: { readonly sessionID: Session.ID }
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.deleted"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: { readonly sessionID: Session.ID }
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.forked"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: {
readonly sessionID: Session.ID
readonly parentID: Session.ID
readonly boundary: Session.ForkBoundary
readonly instructions?: { readonly [x: Instruction.Key]: Instruction.Hash } | undefined
readonly instructionEntries?: InstructionEntry.Snapshot | undefined
}
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.inbox.delivered"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: { readonly sessionID: Session.ID; readonly inboxID: SessionMessage.ID }
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.inbox.enqueued"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: {
readonly sessionID: Session.ID
readonly inboxID: SessionMessage.ID
readonly item: SessionInbox.Item
}
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.inbox.cancelled"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: { readonly sessionID: Session.ID; readonly inboxID: SessionMessage.ID }
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.inbox.delivery.changed"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: {
readonly sessionID: Session.ID
readonly inboxID: SessionMessage.ID
readonly delivery: SessionInbox.Delivery
}
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.execution.started"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: { readonly sessionID: Session.ID }
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.execution.succeeded"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: { readonly sessionID: Session.ID }
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.execution.failed"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: {
readonly sessionID: Session.ID
readonly error: {
readonly type: string
readonly message: string
readonly status?: number | undefined
readonly response?: { readonly body: string } | undefined
readonly retryAfterMs?: number | undefined
}
}
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.execution.interrupted"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: {
readonly sessionID: Session.ID
readonly reason: "user" | "shutdown" | "superseded" | "inactivity"
}
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.instructions.updated"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: {
readonly sessionID: Session.ID
readonly delta: { readonly [x: string]: Instruction.Hash | "removed" }
readonly text?: string | undefined
}
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.synthetic"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: {
readonly sessionID: Session.ID
readonly text: string
readonly description?: string | undefined
readonly metadata?: { readonly [x: string]: unknown } | undefined
}
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.skill.activated"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: {
readonly sessionID: Session.ID
readonly id: Skill.ID
readonly name: Skill.Name
readonly text: string
}
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.shell.started"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: { readonly sessionID: Session.ID; readonly shell: Shell.Info }
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.shell.ended"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: {
readonly sessionID: Session.ID
readonly shell: Shell.Info
readonly output: {
readonly output: string
readonly cursor: number
readonly size: number
readonly truncated: boolean
}
}
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.step.started"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: {
readonly sessionID: Session.ID
readonly assistantMessageID: SessionMessage.ID
readonly agent: Agent.ID
readonly model: Model.Ref
readonly snapshot?: Snapshot.ID | undefined
readonly started: number
}
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.step.streamed"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: { readonly sessionID: Session.ID; readonly assistantMessageID: SessionMessage.ID }
}
| {
readonly id: Event.ID
readonly created: number
readonly metadata?: { readonly [x: string]: unknown } | undefined
readonly type: "session.step.ended"
readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version }
readonly location?:
| { readonly directory: AbsolutePath; readonly workspaceID?: Workspace.ID | undefined }
| undefined
readonly data: {
readonly sessionID: Session.ID