@linkshell/wire 0.2.19 → 0.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/rpc.d.ts CHANGED
@@ -59,11 +59,18 @@ export declare const rpcMessageSchema: z.ZodObject<{
59
59
  }>;
60
60
  export type RpcMessage = z.infer<typeof rpcMessageSchema>;
61
61
  /** Application error codes carried in `error.data.code`. */
62
- export declare const appErrorCodeSchema: z.ZodEnum<["invalid_params", "not_found", "agent_unavailable", "not_supported", "not_ready", "busy", "offline", "internal"]>;
62
+ export declare const appErrorCodeSchema: z.ZodEnum<["invalid_params", "not_found", "agent_unavailable", "not_supported", "not_ready", "busy", "offline", "locked", "internal"]>;
63
63
  export type AppErrorCode = z.infer<typeof appErrorCodeSchema>;
64
64
  export declare const RPC_INVALID_PARAMS = -32602;
65
65
  export declare const RPC_METHOD_NOT_FOUND = -32601;
66
66
  export declare const RPC_APP_ERROR = -32000;
67
+ /**
68
+ * The host's RPC revision, in `machine.info`. Goes up when the host gains
69
+ * methods or notifications an app may rely on, so an app can tell the
70
+ * computer is older than itself and say so (an absent revision is 0).
71
+ * 1: side conversations (`sessions.side`), `machine.info.protocol` itself.
72
+ */
73
+ export declare const HOST_PROTOCOL = 1;
67
74
  export declare const directoryEntrySchema: z.ZodObject<{
68
75
  name: z.ZodString;
69
76
  path: z.ZodString;
@@ -3898,6 +3905,7 @@ declare const coreMethods: {
3898
3905
  hostname: z.ZodString;
3899
3906
  platform: z.ZodString;
3900
3907
  hostVersion: z.ZodString;
3908
+ protocol: z.ZodOptional<z.ZodNumber>;
3901
3909
  home: z.ZodOptional<z.ZodString>;
3902
3910
  agents: z.ZodArray<z.ZodObject<{
3903
3911
  id: z.ZodString;
@@ -3928,6 +3936,7 @@ declare const coreMethods: {
3928
3936
  embeddedContext: z.ZodOptional<z.ZodBoolean>;
3929
3937
  acp: z.ZodOptional<z.ZodBoolean>;
3930
3938
  fork: z.ZodBoolean;
3939
+ side: z.ZodOptional<z.ZodBoolean>;
3931
3940
  models: z.ZodBoolean;
3932
3941
  modes: z.ZodBoolean;
3933
3942
  }, "strip", z.ZodTypeAny, {
@@ -3941,6 +3950,7 @@ declare const coreMethods: {
3941
3950
  acp?: boolean | undefined;
3942
3951
  audio?: boolean | undefined;
3943
3952
  embeddedContext?: boolean | undefined;
3953
+ side?: boolean | undefined;
3944
3954
  }, {
3945
3955
  interrupt: boolean;
3946
3956
  steer: boolean;
@@ -3952,6 +3962,7 @@ declare const coreMethods: {
3952
3962
  acp?: boolean | undefined;
3953
3963
  audio?: boolean | undefined;
3954
3964
  embeddedContext?: boolean | undefined;
3965
+ side?: boolean | undefined;
3955
3966
  }>;
3956
3967
  }, "strip", z.ZodTypeAny, {
3957
3968
  id: string;
@@ -3969,6 +3980,7 @@ declare const coreMethods: {
3969
3980
  acp?: boolean | undefined;
3970
3981
  audio?: boolean | undefined;
3971
3982
  embeddedContext?: boolean | undefined;
3983
+ side?: boolean | undefined;
3972
3984
  };
3973
3985
  version?: string | undefined;
3974
3986
  problem?: string | undefined;
@@ -3993,6 +4005,7 @@ declare const coreMethods: {
3993
4005
  acp?: boolean | undefined;
3994
4006
  audio?: boolean | undefined;
3995
4007
  embeddedContext?: boolean | undefined;
4008
+ side?: boolean | undefined;
3996
4009
  };
3997
4010
  version?: string | undefined;
3998
4011
  problem?: string | undefined;
@@ -4009,6 +4022,7 @@ declare const coreMethods: {
4009
4022
  }, {
4010
4023
  iceServers: string[];
4011
4024
  }>>;
4025
+ locked: z.ZodOptional<z.ZodBoolean>;
4012
4026
  }, "strip", z.ZodTypeAny, {
4013
4027
  agents: {
4014
4028
  id: string;
@@ -4026,6 +4040,7 @@ declare const coreMethods: {
4026
4040
  acp?: boolean | undefined;
4027
4041
  audio?: boolean | undefined;
4028
4042
  embeddedContext?: boolean | undefined;
4043
+ side?: boolean | undefined;
4029
4044
  };
4030
4045
  version?: string | undefined;
4031
4046
  problem?: string | undefined;
@@ -4039,10 +4054,12 @@ declare const coreMethods: {
4039
4054
  hostname: string;
4040
4055
  platform: string;
4041
4056
  hostVersion: string;
4057
+ protocol?: number | undefined;
4042
4058
  home?: string | undefined;
4043
4059
  direct?: {
4044
4060
  iceServers: string[];
4045
4061
  } | undefined;
4062
+ locked?: boolean | undefined;
4046
4063
  }, {
4047
4064
  agents: {
4048
4065
  id: string;
@@ -4060,6 +4077,7 @@ declare const coreMethods: {
4060
4077
  acp?: boolean | undefined;
4061
4078
  audio?: boolean | undefined;
4062
4079
  embeddedContext?: boolean | undefined;
4080
+ side?: boolean | undefined;
4063
4081
  };
4064
4082
  version?: string | undefined;
4065
4083
  problem?: string | undefined;
@@ -4073,10 +4091,12 @@ declare const coreMethods: {
4073
4091
  hostname: string;
4074
4092
  platform: string;
4075
4093
  hostVersion: string;
4094
+ protocol?: number | undefined;
4076
4095
  home?: string | undefined;
4077
4096
  direct?: {
4078
4097
  iceServers: string[];
4079
4098
  } | undefined;
4099
+ locked?: boolean | undefined;
4080
4100
  }>;
4081
4101
  };
4082
4102
  readonly "projects.list": {
@@ -21672,6 +21692,223 @@ declare const coreMethods: {
21672
21692
  }[];
21673
21693
  }>;
21674
21694
  };
21695
+ /**
21696
+ * Asks in a side conversation of the session (a new one without `sideId`):
21697
+ * answered from what the session knows, never added to it. Returns once the
21698
+ * question is on its way; the answer comes in `session.side`. Only for an
21699
+ * agent whose capabilities say `side`.
21700
+ */
21701
+ readonly "sessions.side": {
21702
+ readonly params: z.ZodObject<{
21703
+ sessionId: z.ZodString;
21704
+ sideId: z.ZodOptional<z.ZodString>;
21705
+ text: z.ZodString;
21706
+ }, "strip", z.ZodTypeAny, {
21707
+ text: string;
21708
+ sessionId: string;
21709
+ sideId?: string | undefined;
21710
+ }, {
21711
+ text: string;
21712
+ sessionId: string;
21713
+ sideId?: string | undefined;
21714
+ }>;
21715
+ readonly result: z.ZodObject<{
21716
+ side: z.ZodObject<{
21717
+ sideId: z.ZodString;
21718
+ createdAt: z.ZodNumber;
21719
+ running: z.ZodBoolean;
21720
+ revision: z.ZodNumber;
21721
+ messages: z.ZodArray<z.ZodObject<{
21722
+ id: z.ZodString;
21723
+ role: z.ZodEnum<["user", "assistant"]>;
21724
+ text: z.ZodString;
21725
+ activity: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
21726
+ error: z.ZodOptional<z.ZodString>;
21727
+ }, "strip", z.ZodTypeAny, {
21728
+ id: string;
21729
+ text: string;
21730
+ role: "user" | "assistant";
21731
+ error?: string | undefined;
21732
+ activity?: string[] | undefined;
21733
+ }, {
21734
+ id: string;
21735
+ text: string;
21736
+ role: "user" | "assistant";
21737
+ error?: string | undefined;
21738
+ activity?: string[] | undefined;
21739
+ }>, "many">;
21740
+ }, "strip", z.ZodTypeAny, {
21741
+ running: boolean;
21742
+ createdAt: number;
21743
+ sideId: string;
21744
+ revision: number;
21745
+ messages: {
21746
+ id: string;
21747
+ text: string;
21748
+ role: "user" | "assistant";
21749
+ error?: string | undefined;
21750
+ activity?: string[] | undefined;
21751
+ }[];
21752
+ }, {
21753
+ running: boolean;
21754
+ createdAt: number;
21755
+ sideId: string;
21756
+ revision: number;
21757
+ messages: {
21758
+ id: string;
21759
+ text: string;
21760
+ role: "user" | "assistant";
21761
+ error?: string | undefined;
21762
+ activity?: string[] | undefined;
21763
+ }[];
21764
+ }>;
21765
+ }, "strip", z.ZodTypeAny, {
21766
+ side: {
21767
+ running: boolean;
21768
+ createdAt: number;
21769
+ sideId: string;
21770
+ revision: number;
21771
+ messages: {
21772
+ id: string;
21773
+ text: string;
21774
+ role: "user" | "assistant";
21775
+ error?: string | undefined;
21776
+ activity?: string[] | undefined;
21777
+ }[];
21778
+ };
21779
+ }, {
21780
+ side: {
21781
+ running: boolean;
21782
+ createdAt: number;
21783
+ sideId: string;
21784
+ revision: number;
21785
+ messages: {
21786
+ id: string;
21787
+ text: string;
21788
+ role: "user" | "assistant";
21789
+ error?: string | undefined;
21790
+ activity?: string[] | undefined;
21791
+ }[];
21792
+ };
21793
+ }>;
21794
+ };
21795
+ /** The session's open side conversations, oldest first. */
21796
+ readonly "sessions.sides": {
21797
+ readonly params: z.ZodObject<{
21798
+ sessionId: z.ZodString;
21799
+ }, "strip", z.ZodTypeAny, {
21800
+ sessionId: string;
21801
+ }, {
21802
+ sessionId: string;
21803
+ }>;
21804
+ readonly result: z.ZodObject<{
21805
+ sides: z.ZodArray<z.ZodObject<{
21806
+ sideId: z.ZodString;
21807
+ createdAt: z.ZodNumber;
21808
+ running: z.ZodBoolean;
21809
+ revision: z.ZodNumber;
21810
+ messages: z.ZodArray<z.ZodObject<{
21811
+ id: z.ZodString;
21812
+ role: z.ZodEnum<["user", "assistant"]>;
21813
+ text: z.ZodString;
21814
+ activity: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
21815
+ error: z.ZodOptional<z.ZodString>;
21816
+ }, "strip", z.ZodTypeAny, {
21817
+ id: string;
21818
+ text: string;
21819
+ role: "user" | "assistant";
21820
+ error?: string | undefined;
21821
+ activity?: string[] | undefined;
21822
+ }, {
21823
+ id: string;
21824
+ text: string;
21825
+ role: "user" | "assistant";
21826
+ error?: string | undefined;
21827
+ activity?: string[] | undefined;
21828
+ }>, "many">;
21829
+ }, "strip", z.ZodTypeAny, {
21830
+ running: boolean;
21831
+ createdAt: number;
21832
+ sideId: string;
21833
+ revision: number;
21834
+ messages: {
21835
+ id: string;
21836
+ text: string;
21837
+ role: "user" | "assistant";
21838
+ error?: string | undefined;
21839
+ activity?: string[] | undefined;
21840
+ }[];
21841
+ }, {
21842
+ running: boolean;
21843
+ createdAt: number;
21844
+ sideId: string;
21845
+ revision: number;
21846
+ messages: {
21847
+ id: string;
21848
+ text: string;
21849
+ role: "user" | "assistant";
21850
+ error?: string | undefined;
21851
+ activity?: string[] | undefined;
21852
+ }[];
21853
+ }>, "many">;
21854
+ }, "strip", z.ZodTypeAny, {
21855
+ sides: {
21856
+ running: boolean;
21857
+ createdAt: number;
21858
+ sideId: string;
21859
+ revision: number;
21860
+ messages: {
21861
+ id: string;
21862
+ text: string;
21863
+ role: "user" | "assistant";
21864
+ error?: string | undefined;
21865
+ activity?: string[] | undefined;
21866
+ }[];
21867
+ }[];
21868
+ }, {
21869
+ sides: {
21870
+ running: boolean;
21871
+ createdAt: number;
21872
+ sideId: string;
21873
+ revision: number;
21874
+ messages: {
21875
+ id: string;
21876
+ text: string;
21877
+ role: "user" | "assistant";
21878
+ error?: string | undefined;
21879
+ activity?: string[] | undefined;
21880
+ }[];
21881
+ }[];
21882
+ }>;
21883
+ };
21884
+ /** Stops the answer under way. */
21885
+ readonly "sessions.sideCancel": {
21886
+ readonly params: z.ZodObject<{
21887
+ sessionId: z.ZodString;
21888
+ sideId: z.ZodString;
21889
+ }, "strip", z.ZodTypeAny, {
21890
+ sessionId: string;
21891
+ sideId: string;
21892
+ }, {
21893
+ sessionId: string;
21894
+ sideId: string;
21895
+ }>;
21896
+ readonly result: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
21897
+ };
21898
+ /** Ends a side conversation: it is forgotten, and whatever the agent kept for it let go. */
21899
+ readonly "sessions.sideClose": {
21900
+ readonly params: z.ZodObject<{
21901
+ sessionId: z.ZodString;
21902
+ sideId: z.ZodString;
21903
+ }, "strip", z.ZodTypeAny, {
21904
+ sessionId: string;
21905
+ sideId: string;
21906
+ }, {
21907
+ sessionId: string;
21908
+ sideId: string;
21909
+ }>;
21910
+ readonly result: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
21911
+ };
21675
21912
  /** The commands this session left running in the background, and the ones that have ended; newest first. */
21676
21913
  readonly "sessions.tasks": {
21677
21914
  readonly params: z.ZodObject<{
@@ -25266,6 +25503,61 @@ declare const coreMethods: {
25266
25503
  }>;
25267
25504
  readonly result: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
25268
25505
  };
25506
+ /**
25507
+ * Unlocks this connection with the password, or with a `token` an earlier unlock returned (so a
25508
+ * reconnect doesn't ask again). Hosts without the method have no password. Wrong guesses are
25509
+ * throttled per device (`busy`).
25510
+ */
25511
+ readonly "access.unlock": {
25512
+ readonly params: z.ZodObject<{
25513
+ password: z.ZodOptional<z.ZodString>;
25514
+ token: z.ZodOptional<z.ZodString>;
25515
+ }, "strip", z.ZodTypeAny, {
25516
+ token?: string | undefined;
25517
+ password?: string | undefined;
25518
+ }, {
25519
+ token?: string | undefined;
25520
+ password?: string | undefined;
25521
+ }>;
25522
+ readonly result: z.ZodObject<{
25523
+ token: z.ZodString;
25524
+ expiresAt: z.ZodNumber;
25525
+ }, "strip", z.ZodTypeAny, {
25526
+ expiresAt: number;
25527
+ token: string;
25528
+ }, {
25529
+ expiresAt: number;
25530
+ token: string;
25531
+ }>;
25532
+ };
25533
+ /** Whether this computer has a password (local only). */
25534
+ readonly "access.status": {
25535
+ readonly params: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
25536
+ readonly result: z.ZodObject<{
25537
+ password: z.ZodBoolean;
25538
+ }, "strip", z.ZodTypeAny, {
25539
+ password: boolean;
25540
+ }, {
25541
+ password: boolean;
25542
+ }>;
25543
+ };
25544
+ /** Sets the password, or removes it when none is given (local only). Remote connections reconnect. */
25545
+ readonly "access.set": {
25546
+ readonly params: z.ZodObject<{
25547
+ password: z.ZodOptional<z.ZodString>;
25548
+ }, "strip", z.ZodTypeAny, {
25549
+ password?: string | undefined;
25550
+ }, {
25551
+ password?: string | undefined;
25552
+ }>;
25553
+ readonly result: z.ZodObject<{
25554
+ password: z.ZodBoolean;
25555
+ }, "strip", z.ZodTypeAny, {
25556
+ password: boolean;
25557
+ }, {
25558
+ password: boolean;
25559
+ }>;
25560
+ };
25269
25561
  /** What git says about `path`; no `git` when it isn't in a repository. */
25270
25562
  readonly "git.info": {
25271
25563
  readonly params: z.ZodObject<{
@@ -25512,9 +25804,9 @@ declare const coreMethods: {
25512
25804
  revision?: string | undefined;
25513
25805
  }, {
25514
25806
  path: string;
25807
+ revision?: string | undefined;
25515
25808
  offset?: number | undefined;
25516
25809
  maxBytes?: number | undefined;
25517
- revision?: string | undefined;
25518
25810
  }>;
25519
25811
  readonly result: z.ZodObject<{
25520
25812
  size: z.ZodNumber;
@@ -25525,14 +25817,14 @@ declare const coreMethods: {
25525
25817
  }, "strip", z.ZodTypeAny, {
25526
25818
  data: string;
25527
25819
  size: number;
25528
- nextOffset: number;
25529
25820
  revision: string;
25821
+ nextOffset: number;
25530
25822
  done: boolean;
25531
25823
  }, {
25532
25824
  data: string;
25533
25825
  size: number;
25534
- nextOffset: number;
25535
25826
  revision: string;
25827
+ nextOffset: number;
25536
25828
  done: boolean;
25537
25829
  }>;
25538
25830
  };
@@ -26303,6 +26595,7 @@ export declare const notifications: {
26303
26595
  embeddedContext: z.ZodOptional<z.ZodBoolean>;
26304
26596
  acp: z.ZodOptional<z.ZodBoolean>;
26305
26597
  fork: z.ZodBoolean;
26598
+ side: z.ZodOptional<z.ZodBoolean>;
26306
26599
  models: z.ZodBoolean;
26307
26600
  modes: z.ZodBoolean;
26308
26601
  }, "strip", z.ZodTypeAny, {
@@ -26316,6 +26609,7 @@ export declare const notifications: {
26316
26609
  acp?: boolean | undefined;
26317
26610
  audio?: boolean | undefined;
26318
26611
  embeddedContext?: boolean | undefined;
26612
+ side?: boolean | undefined;
26319
26613
  }, {
26320
26614
  interrupt: boolean;
26321
26615
  steer: boolean;
@@ -26327,6 +26621,7 @@ export declare const notifications: {
26327
26621
  acp?: boolean | undefined;
26328
26622
  audio?: boolean | undefined;
26329
26623
  embeddedContext?: boolean | undefined;
26624
+ side?: boolean | undefined;
26330
26625
  }>;
26331
26626
  }, "strip", z.ZodTypeAny, {
26332
26627
  id: string;
@@ -26344,6 +26639,7 @@ export declare const notifications: {
26344
26639
  acp?: boolean | undefined;
26345
26640
  audio?: boolean | undefined;
26346
26641
  embeddedContext?: boolean | undefined;
26642
+ side?: boolean | undefined;
26347
26643
  };
26348
26644
  version?: string | undefined;
26349
26645
  problem?: string | undefined;
@@ -26368,6 +26664,7 @@ export declare const notifications: {
26368
26664
  acp?: boolean | undefined;
26369
26665
  audio?: boolean | undefined;
26370
26666
  embeddedContext?: boolean | undefined;
26667
+ side?: boolean | undefined;
26371
26668
  };
26372
26669
  version?: string | undefined;
26373
26670
  problem?: string | undefined;
@@ -26394,6 +26691,7 @@ export declare const notifications: {
26394
26691
  acp?: boolean | undefined;
26395
26692
  audio?: boolean | undefined;
26396
26693
  embeddedContext?: boolean | undefined;
26694
+ side?: boolean | undefined;
26397
26695
  };
26398
26696
  version?: string | undefined;
26399
26697
  problem?: string | undefined;
@@ -26420,6 +26718,7 @@ export declare const notifications: {
26420
26718
  acp?: boolean | undefined;
26421
26719
  audio?: boolean | undefined;
26422
26720
  embeddedContext?: boolean | undefined;
26721
+ side?: boolean | undefined;
26423
26722
  };
26424
26723
  version?: string | undefined;
26425
26724
  problem?: string | undefined;
@@ -33196,6 +33495,92 @@ export declare const notifications: {
33196
33495
  } | undefined;
33197
33496
  };
33198
33497
  }>;
33498
+ /** A side conversation changed (to every client), or ended (`closed`). */
33499
+ readonly "session.side": z.ZodObject<{
33500
+ sessionId: z.ZodString;
33501
+ side: z.ZodObject<{
33502
+ sideId: z.ZodString;
33503
+ createdAt: z.ZodNumber;
33504
+ running: z.ZodBoolean;
33505
+ revision: z.ZodNumber;
33506
+ messages: z.ZodArray<z.ZodObject<{
33507
+ id: z.ZodString;
33508
+ role: z.ZodEnum<["user", "assistant"]>;
33509
+ text: z.ZodString;
33510
+ activity: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
33511
+ error: z.ZodOptional<z.ZodString>;
33512
+ }, "strip", z.ZodTypeAny, {
33513
+ id: string;
33514
+ text: string;
33515
+ role: "user" | "assistant";
33516
+ error?: string | undefined;
33517
+ activity?: string[] | undefined;
33518
+ }, {
33519
+ id: string;
33520
+ text: string;
33521
+ role: "user" | "assistant";
33522
+ error?: string | undefined;
33523
+ activity?: string[] | undefined;
33524
+ }>, "many">;
33525
+ }, "strip", z.ZodTypeAny, {
33526
+ running: boolean;
33527
+ createdAt: number;
33528
+ sideId: string;
33529
+ revision: number;
33530
+ messages: {
33531
+ id: string;
33532
+ text: string;
33533
+ role: "user" | "assistant";
33534
+ error?: string | undefined;
33535
+ activity?: string[] | undefined;
33536
+ }[];
33537
+ }, {
33538
+ running: boolean;
33539
+ createdAt: number;
33540
+ sideId: string;
33541
+ revision: number;
33542
+ messages: {
33543
+ id: string;
33544
+ text: string;
33545
+ role: "user" | "assistant";
33546
+ error?: string | undefined;
33547
+ activity?: string[] | undefined;
33548
+ }[];
33549
+ }>;
33550
+ closed: z.ZodOptional<z.ZodBoolean>;
33551
+ }, "strip", z.ZodTypeAny, {
33552
+ side: {
33553
+ running: boolean;
33554
+ createdAt: number;
33555
+ sideId: string;
33556
+ revision: number;
33557
+ messages: {
33558
+ id: string;
33559
+ text: string;
33560
+ role: "user" | "assistant";
33561
+ error?: string | undefined;
33562
+ activity?: string[] | undefined;
33563
+ }[];
33564
+ };
33565
+ sessionId: string;
33566
+ closed?: boolean | undefined;
33567
+ }, {
33568
+ side: {
33569
+ running: boolean;
33570
+ createdAt: number;
33571
+ sideId: string;
33572
+ revision: number;
33573
+ messages: {
33574
+ id: string;
33575
+ text: string;
33576
+ role: "user" | "assistant";
33577
+ error?: string | undefined;
33578
+ activity?: string[] | undefined;
33579
+ }[];
33580
+ };
33581
+ sessionId: string;
33582
+ closed?: boolean | undefined;
33583
+ }>;
33199
33584
  /** A session was deleted (from any device, or natively by the agent). */
33200
33585
  readonly "session.removed": z.ZodObject<{
33201
33586
  sessionId: z.ZodString;
package/dist/rpc.js CHANGED
@@ -6,6 +6,7 @@ import { editorRequestSchema, editorResultSchema } from "./editor.js";
6
6
  import { liveActivityIdSchema, liveActivitySubscriptionSchema } from "./live-activity.js";
7
7
  import { backgroundTaskSchema, agentInfoSchema, gatewayStatusSchema, machineInfoSchema, portInfoSchema, projectSummarySchema, terminalInfoSchema, sessionDriverSchema, sessionSummarySchema, subagentInfoSchema, gitInfoSchema, worktreeEntrySchema, questionAnswerSchema, pendingPermissionSchema, } from "./model.js";
8
8
  import { contentBlockSchema, sessionEventSchema, sessionNoticeSchema } from "./updates.js";
9
+ import { sideChatSchema } from "./side.js";
9
10
  // ── JSON-RPC 2.0 framing ─────────────────────────────────────────────
10
11
  export const rpcIdSchema = z.union([z.string(), z.number()]);
11
12
  export const rpcErrorSchema = z.object({
@@ -32,12 +33,21 @@ export const appErrorCodeSchema = z.enum([
32
33
  "busy",
33
34
  /** Client side: the link to the computer is down. */
34
35
  "offline",
36
+ /** The computer has an access password and this connection hasn't been unlocked (`access.unlock`). */
37
+ "locked",
35
38
  "internal",
36
39
  ]);
37
40
  export const RPC_INVALID_PARAMS = -32602;
38
41
  export const RPC_METHOD_NOT_FOUND = -32601;
39
42
  export const RPC_APP_ERROR = -32000;
40
43
  // ── Methods (client → host) ──────────────────────────────────────────
44
+ /**
45
+ * The host's RPC revision, in `machine.info`. Goes up when the host gains
46
+ * methods or notifications an app may rely on, so an app can tell the
47
+ * computer is older than itself and say so (an absent revision is 0).
48
+ * 1: side conversations (`sessions.side`), `machine.info.protocol` itself.
49
+ */
50
+ export const HOST_PROTOCOL = 1;
41
51
  const empty = z.object({}).passthrough();
42
52
  export const directoryEntrySchema = z.object({
43
53
  name: z.string(),
@@ -185,6 +195,31 @@ const coreMethods = {
185
195
  params: z.object({ sessionId: z.string().min(1), toolCallId: z.string().min(1), lazyImages: z.boolean().optional() }),
186
196
  result: z.object({ events: z.array(sessionEventSchema) }),
187
197
  },
198
+ /**
199
+ * Asks in a side conversation of the session (a new one without `sideId`):
200
+ * answered from what the session knows, never added to it. Returns once the
201
+ * question is on its way; the answer comes in `session.side`. Only for an
202
+ * agent whose capabilities say `side`.
203
+ */
204
+ "sessions.side": {
205
+ params: z.object({ sessionId: z.string().min(1), sideId: z.string().min(1).optional(), text: z.string().min(1).max(20_000) }),
206
+ result: z.object({ side: sideChatSchema }),
207
+ },
208
+ /** The session's open side conversations, oldest first. */
209
+ "sessions.sides": {
210
+ params: z.object({ sessionId: z.string().min(1) }),
211
+ result: z.object({ sides: z.array(sideChatSchema) }),
212
+ },
213
+ /** Stops the answer under way. */
214
+ "sessions.sideCancel": {
215
+ params: z.object({ sessionId: z.string().min(1), sideId: z.string().min(1) }),
216
+ result: empty,
217
+ },
218
+ /** Ends a side conversation: it is forgotten, and whatever the agent kept for it let go. */
219
+ "sessions.sideClose": {
220
+ params: z.object({ sessionId: z.string().min(1), sideId: z.string().min(1) }),
221
+ result: empty,
222
+ },
188
223
  /** The commands this session left running in the background, and the ones that have ended; newest first. */
189
224
  "sessions.tasks": {
190
225
  params: z.object({ sessionId: z.string().min(1) }),
@@ -382,6 +417,23 @@ const coreMethods = {
382
417
  result: z.object({ link: z.string(), code: z.string(), expiresAt: z.number(), gateway: z.string() }),
383
418
  },
384
419
  "devices.revoke": { params: z.object({ deviceId: z.string().min(1) }), result: empty },
420
+ // ── Access password: optional, set on the computer itself ──
421
+ /**
422
+ * Unlocks this connection with the password, or with a `token` an earlier unlock returned (so a
423
+ * reconnect doesn't ask again). Hosts without the method have no password. Wrong guesses are
424
+ * throttled per device (`busy`).
425
+ */
426
+ "access.unlock": {
427
+ params: z.object({ password: z.string().max(256).optional(), token: z.string().max(512).optional() }),
428
+ result: z.object({ token: z.string(), expiresAt: z.number() }),
429
+ },
430
+ /** Whether this computer has a password (local only). */
431
+ "access.status": { params: empty, result: z.object({ password: z.boolean() }) },
432
+ /** Sets the password, or removes it when none is given (local only). Remote connections reconnect. */
433
+ "access.set": {
434
+ params: z.object({ password: z.string().min(4).max(128).optional() }),
435
+ result: z.object({ password: z.boolean() }),
436
+ },
385
437
  // ── Git: sessions in worktrees ──
386
438
  /** What git says about `path`; no `git` when it isn't in a repository. */
387
439
  "git.info": { params: z.object({ path: z.string().min(1) }), result: z.object({ git: gitInfoSchema.optional() }) },
@@ -632,6 +684,8 @@ export const notifications = {
632
684
  */
633
685
  "session.window": z.object({ sessionId: z.string(), startSeq: z.number().int().nonnegative() }),
634
686
  "session.summary": z.object({ session: sessionSummarySchema }),
687
+ /** A side conversation changed (to every client), or ended (`closed`). */
688
+ "session.side": z.object({ sessionId: z.string(), side: sideChatSchema, closed: z.boolean().optional() }),
635
689
  /** A session was deleted (from any device, or natively by the agent). */
636
690
  "session.removed": z.object({ sessionId: z.string() }),
637
691
  "session.preview.show": z.object({ sessionId: z.string() }),