@keska/sandbox 0.46.2 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +506 -138
  2. package/dist/index.js +325 -461
  3. package/package.json +1 -2
package/dist/index.d.ts CHANGED
@@ -1605,15 +1605,11 @@ type Agent$2 = Message<"numen.sandbox.v1.Agent"> & {
1605
1605
  */
1606
1606
  activeSandboxId: string;
1607
1607
  /**
1608
- * Unset means true (provision a Matrix identity and a direct message).
1608
+ * Unset means true (provision a Matrix identity). Conversations are separate rooms.
1609
1609
  *
1610
1610
  * @generated from field: optional bool messaging = 9;
1611
1611
  */
1612
1612
  messaging?: boolean | undefined;
1613
- /**
1614
- * @generated from field: string matrix_room_id = 10;
1615
- */
1616
- matrixRoomId: string;
1617
1613
  /**
1618
1614
  * @generated from field: string template_id = 11;
1619
1615
  */
@@ -1626,6 +1622,19 @@ type Agent$2 = Message<"numen.sandbox.v1.Agent"> & {
1626
1622
  * @generated from field: string profile_id = 13;
1627
1623
  */
1628
1624
  profileId: string;
1625
+ /**
1626
+ * Shown to end users. Empty means name.
1627
+ *
1628
+ * @generated from field: string display_name = 14;
1629
+ */
1630
+ displayName: string;
1631
+ /**
1632
+ * End user this agent is for. Several agents may share one user_id.
1633
+ * Empty means the caller (a solo developer).
1634
+ *
1635
+ * @generated from field: string user_id = 15;
1636
+ */
1637
+ userId: string;
1629
1638
  };
1630
1639
  /**
1631
1640
  * Describes the message numen.sandbox.v1.Agent.
@@ -1650,12 +1659,244 @@ type CreateAgentRequest = Message<"numen.sandbox.v1.CreateAgentRequest"> & {
1650
1659
  * @generated from field: optional bool messaging = 4;
1651
1660
  */
1652
1661
  messaging?: boolean | undefined;
1662
+ /**
1663
+ * @generated from field: string user_id = 5;
1664
+ */
1665
+ userId: string;
1666
+ /**
1667
+ * @generated from field: string display_name = 6;
1668
+ */
1669
+ displayName: string;
1653
1670
  };
1654
1671
  /**
1655
1672
  * Describes the message numen.sandbox.v1.CreateAgentRequest.
1656
1673
  * Use `create(CreateAgentRequestSchema)` to create a new message.
1657
1674
  */
1658
1675
  declare const CreateAgentRequestSchema: GenMessage<CreateAgentRequest>;
1676
+ /**
1677
+ * @generated from message numen.sandbox.v1.Conversation
1678
+ */
1679
+ type Conversation$1 = Message<"numen.sandbox.v1.Conversation"> & {
1680
+ /**
1681
+ * @generated from field: string id = 1;
1682
+ */
1683
+ id: string;
1684
+ /**
1685
+ * @generated from field: string agent_id = 2;
1686
+ */
1687
+ agentId: string;
1688
+ /**
1689
+ * @generated from field: string user_id = 3;
1690
+ */
1691
+ userId: string;
1692
+ /**
1693
+ * @generated from field: string title = 4;
1694
+ */
1695
+ title: string;
1696
+ /**
1697
+ * @generated from field: google.protobuf.Timestamp created_at = 5;
1698
+ */
1699
+ createdAt?: Timestamp | undefined;
1700
+ };
1701
+ /**
1702
+ * Describes the message numen.sandbox.v1.Conversation.
1703
+ * Use `create(ConversationSchema)` to create a new message.
1704
+ */
1705
+ declare const ConversationSchema: GenMessage<Conversation$1>;
1706
+ /**
1707
+ * @generated from message numen.sandbox.v1.CreateConversationRequest
1708
+ */
1709
+ type CreateConversationRequest = Message<"numen.sandbox.v1.CreateConversationRequest"> & {
1710
+ /**
1711
+ * @generated from field: string agent_id = 1;
1712
+ */
1713
+ agentId: string;
1714
+ /**
1715
+ * @generated from field: string user_id = 2;
1716
+ */
1717
+ userId: string;
1718
+ /**
1719
+ * @generated from field: string title = 3;
1720
+ */
1721
+ title: string;
1722
+ };
1723
+ /**
1724
+ * Describes the message numen.sandbox.v1.CreateConversationRequest.
1725
+ * Use `create(CreateConversationRequestSchema)` to create a new message.
1726
+ */
1727
+ declare const CreateConversationRequestSchema: GenMessage<CreateConversationRequest>;
1728
+ /**
1729
+ * @generated from message numen.sandbox.v1.ListConversationsRequest
1730
+ */
1731
+ type ListConversationsRequest = Message<"numen.sandbox.v1.ListConversationsRequest"> & {
1732
+ /**
1733
+ * @generated from field: string agent_id = 1;
1734
+ */
1735
+ agentId: string;
1736
+ /**
1737
+ * @generated from field: string user_id = 2;
1738
+ */
1739
+ userId: string;
1740
+ /**
1741
+ * @generated from field: int32 page_size = 3;
1742
+ */
1743
+ pageSize: number;
1744
+ /**
1745
+ * @generated from field: string page_token = 4;
1746
+ */
1747
+ pageToken: string;
1748
+ };
1749
+ /**
1750
+ * Describes the message numen.sandbox.v1.ListConversationsRequest.
1751
+ * Use `create(ListConversationsRequestSchema)` to create a new message.
1752
+ */
1753
+ declare const ListConversationsRequestSchema: GenMessage<ListConversationsRequest>;
1754
+ /**
1755
+ * @generated from message numen.sandbox.v1.ListConversationsResponse
1756
+ */
1757
+ type ListConversationsResponse = Message<"numen.sandbox.v1.ListConversationsResponse"> & {
1758
+ /**
1759
+ * @generated from field: repeated numen.sandbox.v1.Conversation conversations = 1;
1760
+ */
1761
+ conversations: Conversation$1[];
1762
+ /**
1763
+ * @generated from field: string next_page_token = 2;
1764
+ */
1765
+ nextPageToken: string;
1766
+ };
1767
+ /**
1768
+ * Describes the message numen.sandbox.v1.ListConversationsResponse.
1769
+ * Use `create(ListConversationsResponseSchema)` to create a new message.
1770
+ */
1771
+ declare const ListConversationsResponseSchema: GenMessage<ListConversationsResponse>;
1772
+ /**
1773
+ * @generated from message numen.sandbox.v1.DeleteConversationRequest
1774
+ */
1775
+ type DeleteConversationRequest = Message<"numen.sandbox.v1.DeleteConversationRequest"> & {
1776
+ /**
1777
+ * @generated from field: string id = 1;
1778
+ */
1779
+ id: string;
1780
+ };
1781
+ /**
1782
+ * Describes the message numen.sandbox.v1.DeleteConversationRequest.
1783
+ * Use `create(DeleteConversationRequestSchema)` to create a new message.
1784
+ */
1785
+ declare const DeleteConversationRequestSchema: GenMessage<DeleteConversationRequest>;
1786
+ /**
1787
+ * @generated from message numen.sandbox.v1.LoginToken
1788
+ */
1789
+ type LoginToken$1 = Message<"numen.sandbox.v1.LoginToken"> & {
1790
+ /**
1791
+ * @generated from field: string token = 1;
1792
+ */
1793
+ token: string;
1794
+ /**
1795
+ * @generated from field: google.protobuf.Timestamp expires_at = 2;
1796
+ */
1797
+ expiresAt?: Timestamp | undefined;
1798
+ };
1799
+ /**
1800
+ * Describes the message numen.sandbox.v1.LoginToken.
1801
+ * Use `create(LoginTokenSchema)` to create a new message.
1802
+ */
1803
+ declare const LoginTokenSchema: GenMessage<LoginToken$1>;
1804
+ /**
1805
+ * @generated from message numen.sandbox.v1.CreateLoginTokenRequest
1806
+ */
1807
+ type CreateLoginTokenRequest = Message<"numen.sandbox.v1.CreateLoginTokenRequest"> & {
1808
+ /**
1809
+ * @generated from field: string user_id = 1;
1810
+ */
1811
+ userId: string;
1812
+ };
1813
+ /**
1814
+ * Describes the message numen.sandbox.v1.CreateLoginTokenRequest.
1815
+ * Use `create(CreateLoginTokenRequestSchema)` to create a new message.
1816
+ */
1817
+ declare const CreateLoginTokenRequestSchema: GenMessage<CreateLoginTokenRequest>;
1818
+ /**
1819
+ * @generated from message numen.sandbox.v1.RevokeEndUserRequest
1820
+ */
1821
+ type RevokeEndUserRequest = Message<"numen.sandbox.v1.RevokeEndUserRequest"> & {
1822
+ /**
1823
+ * @generated from field: string user_id = 1;
1824
+ */
1825
+ userId: string;
1826
+ };
1827
+ /**
1828
+ * Describes the message numen.sandbox.v1.RevokeEndUserRequest.
1829
+ * Use `create(RevokeEndUserRequestSchema)` to create a new message.
1830
+ */
1831
+ declare const RevokeEndUserRequestSchema: GenMessage<RevokeEndUserRequest>;
1832
+ /**
1833
+ * @generated from message numen.sandbox.v1.DeleteEndUserRequest
1834
+ */
1835
+ type DeleteEndUserRequest = Message<"numen.sandbox.v1.DeleteEndUserRequest"> & {
1836
+ /**
1837
+ * @generated from field: string user_id = 1;
1838
+ */
1839
+ userId: string;
1840
+ };
1841
+ /**
1842
+ * Describes the message numen.sandbox.v1.DeleteEndUserRequest.
1843
+ * Use `create(DeleteEndUserRequestSchema)` to create a new message.
1844
+ */
1845
+ declare const DeleteEndUserRequestSchema: GenMessage<DeleteEndUserRequest>;
1846
+ /**
1847
+ * EndUser is one person an app has registered. The id is the app's string.
1848
+ *
1849
+ * @generated from message numen.sandbox.v1.EndUser
1850
+ */
1851
+ type EndUser$1 = Message<"numen.sandbox.v1.EndUser"> & {
1852
+ /**
1853
+ * @generated from field: string id = 1;
1854
+ */
1855
+ id: string;
1856
+ /**
1857
+ * @generated from field: google.protobuf.Timestamp created_at = 2;
1858
+ */
1859
+ createdAt?: Timestamp | undefined;
1860
+ };
1861
+ /**
1862
+ * Describes the message numen.sandbox.v1.EndUser.
1863
+ * Use `create(EndUserSchema)` to create a new message.
1864
+ */
1865
+ declare const EndUserSchema: GenMessage<EndUser$1>;
1866
+ /**
1867
+ * @generated from message numen.sandbox.v1.CreateEndUserRequest
1868
+ */
1869
+ type CreateEndUserRequest = Message<"numen.sandbox.v1.CreateEndUserRequest"> & {
1870
+ /**
1871
+ * @generated from field: string id = 1;
1872
+ */
1873
+ id: string;
1874
+ /**
1875
+ * exist_ok returns the existing user. Otherwise a taken id is NAME_TAKEN.
1876
+ *
1877
+ * @generated from field: bool exist_ok = 2;
1878
+ */
1879
+ existOk: boolean;
1880
+ };
1881
+ /**
1882
+ * Describes the message numen.sandbox.v1.CreateEndUserRequest.
1883
+ * Use `create(CreateEndUserRequestSchema)` to create a new message.
1884
+ */
1885
+ declare const CreateEndUserRequestSchema: GenMessage<CreateEndUserRequest>;
1886
+ /**
1887
+ * @generated from message numen.sandbox.v1.GetEndUserRequest
1888
+ */
1889
+ type GetEndUserRequest = Message<"numen.sandbox.v1.GetEndUserRequest"> & {
1890
+ /**
1891
+ * @generated from field: string id = 1;
1892
+ */
1893
+ id: string;
1894
+ };
1895
+ /**
1896
+ * Describes the message numen.sandbox.v1.GetEndUserRequest.
1897
+ * Use `create(GetEndUserRequestSchema)` to create a new message.
1898
+ */
1899
+ declare const GetEndUserRequestSchema: GenMessage<GetEndUserRequest>;
1659
1900
  /**
1660
1901
  * @generated from message numen.sandbox.v1.BindAgentSecretRequest
1661
1902
  */
@@ -3866,6 +4107,70 @@ declare const SandboxService: GenService<{
3866
4107
  input: typeof DeleteMatrixSessionRequestSchema;
3867
4108
  output: typeof EmptySchema;
3868
4109
  };
4110
+ /**
4111
+ * @generated from rpc numen.sandbox.v1.SandboxService.CreateConversation
4112
+ */
4113
+ createConversation: {
4114
+ methodKind: "unary";
4115
+ input: typeof CreateConversationRequestSchema;
4116
+ output: typeof ConversationSchema;
4117
+ };
4118
+ /**
4119
+ * @generated from rpc numen.sandbox.v1.SandboxService.ListConversations
4120
+ */
4121
+ listConversations: {
4122
+ methodKind: "unary";
4123
+ input: typeof ListConversationsRequestSchema;
4124
+ output: typeof ListConversationsResponseSchema;
4125
+ };
4126
+ /**
4127
+ * @generated from rpc numen.sandbox.v1.SandboxService.DeleteConversation
4128
+ */
4129
+ deleteConversation: {
4130
+ methodKind: "unary";
4131
+ input: typeof DeleteConversationRequestSchema;
4132
+ output: typeof EmptySchema;
4133
+ };
4134
+ /**
4135
+ * @generated from rpc numen.sandbox.v1.SandboxService.CreateLoginToken
4136
+ */
4137
+ createLoginToken: {
4138
+ methodKind: "unary";
4139
+ input: typeof CreateLoginTokenRequestSchema;
4140
+ output: typeof LoginTokenSchema;
4141
+ };
4142
+ /**
4143
+ * @generated from rpc numen.sandbox.v1.SandboxService.RevokeEndUser
4144
+ */
4145
+ revokeEndUser: {
4146
+ methodKind: "unary";
4147
+ input: typeof RevokeEndUserRequestSchema;
4148
+ output: typeof EmptySchema;
4149
+ };
4150
+ /**
4151
+ * @generated from rpc numen.sandbox.v1.SandboxService.DeleteEndUser
4152
+ */
4153
+ deleteEndUser: {
4154
+ methodKind: "unary";
4155
+ input: typeof DeleteEndUserRequestSchema;
4156
+ output: typeof EmptySchema;
4157
+ };
4158
+ /**
4159
+ * @generated from rpc numen.sandbox.v1.SandboxService.CreateEndUser
4160
+ */
4161
+ createEndUser: {
4162
+ methodKind: "unary";
4163
+ input: typeof CreateEndUserRequestSchema;
4164
+ output: typeof EndUserSchema;
4165
+ };
4166
+ /**
4167
+ * @generated from rpc numen.sandbox.v1.SandboxService.GetEndUser
4168
+ */
4169
+ getEndUser: {
4170
+ methodKind: "unary";
4171
+ input: typeof GetEndUserRequestSchema;
4172
+ output: typeof EndUserSchema;
4173
+ };
3869
4174
  /**
3870
4175
  * @generated from rpc numen.sandbox.v1.SandboxService.CreateHTTPGrant
3871
4176
  */
@@ -4250,7 +4555,8 @@ type Agent$1 = {
4250
4555
  /** Sandbox this agent is attached to now. Empty when it has none. */
4251
4556
  activeSandboxId: string;
4252
4557
  messaging: boolean;
4253
- matrixRoomId: string;
4558
+ userId: string;
4559
+ displayName: string;
4254
4560
  templateId: string;
4255
4561
  image: string;
4256
4562
  profileId: string;
@@ -4259,6 +4565,28 @@ type AgentList = {
4259
4565
  agents: Agent$1[];
4260
4566
  nextPageToken: string;
4261
4567
  };
4568
+ /** One conversation. Pass it to agent-kit with a login token. */
4569
+ type Conversation = {
4570
+ id: string;
4571
+ agentId: string;
4572
+ userId: string;
4573
+ title: string;
4574
+ createdAt: string;
4575
+ };
4576
+ /** A person this project registered, or the API caller. */
4577
+ type EndUser = {
4578
+ id: string;
4579
+ createdAt: string;
4580
+ };
4581
+ type ConversationList = {
4582
+ conversations: Conversation[];
4583
+ nextPageToken: string;
4584
+ };
4585
+ /** A login token for one person. Pass `token` to agent-kit. */
4586
+ type LoginToken = {
4587
+ token: string;
4588
+ expiresAt: string;
4589
+ };
4262
4590
  /** Short-lived Matrix device for an SDK process (CreateMatrixSession). */
4263
4591
  type MatrixSession = {
4264
4592
  homeserver: string;
@@ -4822,6 +5150,8 @@ declare class Session {
4822
5150
  createAgent(name: string, opts?: CallOpts & {
4823
5151
  templateId?: string;
4824
5152
  messaging?: boolean;
5153
+ userId?: string;
5154
+ displayName?: string;
4825
5155
  }): Promise<Agent$1>;
4826
5156
  getAgent(id?: string, opts?: CallOpts & {
4827
5157
  name?: string;
@@ -4832,6 +5162,24 @@ declare class Session {
4832
5162
  messaging?: boolean;
4833
5163
  }): Promise<AgentList>;
4834
5164
  deleteAgent(id: string, opts?: CallOpts): Promise<void>;
5165
+ createConversation(agentId: string, opts?: CallOpts & {
5166
+ userId?: string;
5167
+ title?: string;
5168
+ }): Promise<Conversation>;
5169
+ listConversations(opts?: CallOpts & {
5170
+ agentId?: string;
5171
+ userId?: string;
5172
+ pageSize?: number;
5173
+ pageToken?: string;
5174
+ }): Promise<ConversationList>;
5175
+ deleteConversation(id: string, opts?: CallOpts): Promise<void>;
5176
+ createLoginToken(userId?: string, opts?: CallOpts): Promise<LoginToken>;
5177
+ createEndUser(id: string, opts?: CallOpts & {
5178
+ existOk?: boolean;
5179
+ }): Promise<EndUser>;
5180
+ getEndUser(id: string, opts?: CallOpts): Promise<EndUser>;
5181
+ revokeEndUser(userId: string, opts?: CallOpts): Promise<void>;
5182
+ deleteEndUser(userId: string, opts?: CallOpts): Promise<void>;
4835
5183
  bindAgentSecret(agentId: string, envName: string, secretName: string, opts?: CallOpts): Promise<Agent$1>;
4836
5184
  unbindAgentSecret(agentId: string, envName: string, opts?: CallOpts): Promise<Agent$1>;
4837
5185
  createMatrixSession(opts?: CallOpts): Promise<MatrixSession>;
@@ -4967,108 +5315,6 @@ declare class GuestHttp$1 {
4967
5315
  websocket(path?: string): Promise<WebSocket>;
4968
5316
  }
4969
5317
 
4970
- type RawEvent = {
4971
- type?: string;
4972
- event_id?: string;
4973
- sender?: string;
4974
- origin_server_ts?: number;
4975
- content?: Record<string, unknown>;
4976
- };
4977
- type SyncBody = {
4978
- next_batch?: string;
4979
- rooms?: {
4980
- join?: Record<string, {
4981
- timeline?: {
4982
- events?: RawEvent[];
4983
- prev_batch?: string;
4984
- };
4985
- }>;
4986
- };
4987
- };
4988
- interface RoomIO {
4989
- send(roomId: string, content: Record<string, unknown>): Promise<string>;
4990
- messages(roomId: string, fromToken: string, limit: number): Promise<{
4991
- chunk: RawEvent[];
4992
- end: string;
4993
- }>;
4994
- sync(since: string | null, timeoutMs: number): Promise<SyncBody>;
4995
- /**
4996
- * Optional first window for history: this room's recent message timeline
4997
- * only. A plain `sync(null, 0)` on a fresh device is an initial sync over
4998
- * every joined room, which takes seconds; implementations that can scope
4999
- * the request to one room should.
5000
- */
5001
- historyWindow?(roomId: string, limit: number): Promise<SyncBody>;
5002
- close(): void;
5003
- }
5004
-
5005
- /** Agent DM timeline and live-stream event shapes. */
5006
-
5007
- type SenderKind = "agent" | "user" | "unknown";
5008
- /** One text message in the agent DM. */
5009
- type MessageEvent = {
5010
- /** Discriminator; always `"message"`. */
5011
- type: "message";
5012
- /** Message body. */
5013
- content: string;
5014
- /** Matrix user id of the sender. */
5015
- sender: string;
5016
- /** Matrix event id. */
5017
- eventId: string;
5018
- /** Server timestamp in milliseconds. */
5019
- ts: number;
5020
- /** Whether the sender is the agent, the portal user, or unknown. */
5021
- senderKind?: SenderKind;
5022
- /** Human-readable sender label when known. */
5023
- senderLabel?: string;
5024
- /** Set when an agent posted a protocol final. */
5025
- isFinal?: boolean;
5026
- /** Agent final tied to a human trigger, when present on the Matrix event. */
5027
- triggerEventId?: string;
5028
- };
5029
-
5030
- /** Display labels for Matrix senders on agent message events. */
5031
-
5032
- type SenderLabelContext = {
5033
- agentMatrixUserId?: string;
5034
- agentName?: string;
5035
- projectUserId?: string;
5036
- };
5037
-
5038
- /** One sync pump per Client; room subscriptions receive live messaging events. */
5039
-
5040
- declare class RoomSyncPump {
5041
- private readonly io;
5042
- private since;
5043
- private primed;
5044
- private running;
5045
- private stopped;
5046
- private readonly rooms;
5047
- private readonly seenByRoom;
5048
- constructor(io: RoomIO);
5049
- subscribe(roomId: string, labels: SenderLabelContext): MessageSubscription;
5050
- unsubscribe(sub: MessageSubscription, roomId: string): void;
5051
- stop(): void;
5052
- private hasSubscribers;
5053
- private ensurePrimed;
5054
- private seen;
5055
- private deliver;
5056
- private loop;
5057
- take(sub: MessageSubscription, roomId: string): MessageEvent | undefined;
5058
- waitFor(sub: MessageSubscription, roomId: string): Promise<void>;
5059
- isOpen(sub: MessageSubscription, roomId: string): boolean;
5060
- }
5061
- /** Live messaging events for one room. Start before `post()` so fast replies are not missed. */
5062
- declare class MessageSubscription {
5063
- private readonly pump;
5064
- private readonly roomId;
5065
- constructor(pump: RoomSyncPump, roomId: string);
5066
- /** Stop receiving events. */
5067
- close(): void;
5068
- /** Iterate live agent messages until {@link MessageSubscription.close}. */
5069
- [Symbol.asyncIterator](): AsyncIterator<MessageEvent>;
5070
- }
5071
-
5072
5318
  type TimeoutOpts = {
5073
5319
  timeout?: number;
5074
5320
  signal?: AbortSignal;
@@ -5126,6 +5372,8 @@ declare class Agents$1 {
5126
5372
  create(name: string, opts?: {
5127
5373
  template?: string;
5128
5374
  messaging?: boolean;
5375
+ userId?: string;
5376
+ displayName?: string;
5129
5377
  } & TimeoutOpts): Promise<Agent$1>;
5130
5378
  /** Get by name. */
5131
5379
  getByName(name: string, opts?: TimeoutOpts): Promise<Agent$1>;
@@ -5143,6 +5391,56 @@ declare class Agents$1 {
5143
5391
  /** Remove one binding. Fails with reason `AGENT_BUSY` while a sandbox is live. */
5144
5392
  unbindSecret(id: string, envName: string, opts?: TimeoutOpts): Promise<Agent$1>;
5145
5393
  }
5394
+ /** Conversations with the project's agents. */
5395
+ declare class Conversations$1 {
5396
+ private readonly wire;
5397
+ /** Create the handle. */
5398
+ constructor(wire: Session);
5399
+ /** Start a new conversation. Omit `userId` to open one for the API caller. */
5400
+ create(agentId: string, opts?: {
5401
+ userId?: string;
5402
+ title?: string;
5403
+ } & TimeoutOpts): Promise<Conversation>;
5404
+ /** List, newest activity first. Pass an agent id or an end-user id. */
5405
+ list(opts?: {
5406
+ agentId?: string;
5407
+ userId?: string;
5408
+ pageSize?: number;
5409
+ pageToken?: string;
5410
+ } & TimeoutOpts): Promise<ConversationList>;
5411
+ /** Delete one conversation. */
5412
+ delete(id: string, opts?: TimeoutOpts): Promise<void>;
5413
+ }
5414
+ /** People an app registers. The API caller is not created here. */
5415
+ declare class Users$1 {
5416
+ private readonly wire;
5417
+ /** Create the handle. */
5418
+ constructor(wire: Session);
5419
+ /** Register one person. `existOk` returns the existing record. */
5420
+ create(id: string, opts?: {
5421
+ existOk?: boolean;
5422
+ } & TimeoutOpts): Promise<EndUser>;
5423
+ /** Fetch one person the app already created. */
5424
+ get(id: string, opts?: TimeoutOpts): Promise<EndUser>;
5425
+ }
5426
+ /** Login tokens. Prefer `Client.newToken` or `User.newToken`. */
5427
+ declare class Tokens {
5428
+ private readonly wire;
5429
+ /** Create the handle. */
5430
+ constructor(wire: Session);
5431
+ /** Mint a login JWT. An empty user id uses the authenticated subject. */
5432
+ create(userId?: string, opts?: TimeoutOpts): Promise<LoginToken>;
5433
+ }
5434
+ /** End users shared by every agent in the project. */
5435
+ declare class EndUsers {
5436
+ private readonly wire;
5437
+ /** Create the handle. */
5438
+ constructor(wire: Session);
5439
+ /** Revoke every Matrix device of this end user. */
5440
+ revoke(userId: string, opts?: TimeoutOpts): Promise<void>;
5441
+ /** Deactivate the Matrix user and erase their devices. */
5442
+ delete(userId: string, opts?: TimeoutOpts): Promise<void>;
5443
+ }
5146
5444
  /** Platform names and project images. */
5147
5445
  declare class Images$1 {
5148
5446
  private readonly wire;
@@ -5332,6 +5630,14 @@ declare class Client$1 {
5332
5630
  readonly secrets: Secrets$1;
5333
5631
  /** Agents. */
5334
5632
  readonly agents: Agents$1;
5633
+ /** Conversations. */
5634
+ readonly conversations: Conversations$1;
5635
+ /** People an app registers. */
5636
+ readonly users: Users$1;
5637
+ /** Login tokens. */
5638
+ readonly tokens: Tokens;
5639
+ /** End users across every agent. */
5640
+ readonly endUsers: EndUsers;
5335
5641
  /** Images. */
5336
5642
  readonly images: Images$1;
5337
5643
  /** Snapshots. */
@@ -5346,6 +5652,8 @@ declare class Client$1 {
5346
5652
  readonly templates: Templates$1;
5347
5653
  /** Create the handle. */
5348
5654
  constructor(baseUrl?: string | Session, opts?: ClientOpts);
5655
+ /** Log the API caller in. */
5656
+ newToken(opts?: TimeoutOpts): Promise<LoginToken>;
5349
5657
  /** Mint a Matrix device for this SDK process. */
5350
5658
  createMatrixSession(opts?: TimeoutOpts): Promise<MatrixSession>;
5351
5659
  /** Log out one SDK device. */
@@ -5372,20 +5680,6 @@ declare class Client$1 {
5372
5680
  listImagesIter(opts?: Omit<NonNullable<Parameters<Images$1["list"]>[0]>, "pageToken">): AsyncGenerator<Image>;
5373
5681
  }
5374
5682
 
5375
- /** Bounded message history snapshots from Matrix. */
5376
-
5377
- declare const UNLIMITED$1: number;
5378
- type HistoryOptions = {
5379
- /** Maximum eligible text messages. Default 50. */
5380
- limit?: number;
5381
- /** Present newest messages first. Default oldest first. */
5382
- newestFirst?: boolean;
5383
- /** Overall fetch deadline in seconds. Default 180. */
5384
- timeout?: number | typeof UNLIMITED$1;
5385
- /** @internal Resolved by `Agent.history`. */
5386
- labels?: SenderLabelContext;
5387
- };
5388
-
5389
5683
  /** Arguments for `Sandbox.create`. Fields say what omit means. */
5390
5684
  type SandboxCreateParams$1 = {
5391
5685
  /** Guest rootfs. Required. Platform aliases such as `numen/base` resolve on the control plane. */
@@ -5901,7 +6195,6 @@ declare function remove(path: string, recursive?: boolean): Remove;
5901
6195
  type FileOp = Write | Mkdir | Remove;
5902
6196
  /** One agent. One sandbox. Sleep stops the process you started. */
5903
6197
  declare class Agent {
5904
- #private;
5905
6198
  private readonly client;
5906
6199
  /** Agent id. */
5907
6200
  readonly id: string;
@@ -5915,6 +6208,10 @@ declare class Agent {
5915
6208
  activeSandboxId: string;
5916
6209
  /** False when this agent has no Matrix identity. */
5917
6210
  messaging: boolean;
6211
+ /** End user this agent is bound to. Empty means each conversation names its own. */
6212
+ userId: string;
6213
+ /** What end users see. Empty shows `name`. */
6214
+ displayName: string;
5918
6215
  /** Template this agent was copied from. */
5919
6216
  templateId: string;
5920
6217
  /** Image copied from the template. */
@@ -5935,13 +6232,14 @@ declare class Agent {
5935
6232
  newSandbox(opts?: Omit<SandboxCreateParams, "agentId" | "image"> & {
5936
6233
  image?: string;
5937
6234
  }): Promise<Sandbox>;
5938
- private requireMessaging;
5939
- /** Post plain text to this agent's DM. */
5940
- sendMessage(body: string): Promise<string>;
5941
- /** Live DM events. Call before `sendMessage` when you need to catch a fast reply. */
5942
- subscribe(): Promise<MessageSubscription>;
5943
- /** Bounded snapshot of DM text messages. */
5944
- history(opts?: HistoryOptions): AsyncGenerator<MessageEvent>;
6235
+ /** Chat goes through agent-kit. This client creates conversations and login tokens. */
6236
+ sendMessage(_body: string): Promise<string>;
6237
+ /** Chat goes through agent-kit. */
6238
+ subscribe(): Promise<never>;
6239
+ /** Chat goes through agent-kit. */
6240
+ history(): AsyncGenerator<never>;
6241
+ /** Messaging off is reported first. A messaging agent still chats through agent-kit. */
6242
+ private chatElsewhere;
5945
6243
  }
5946
6244
  /** Copied onto an agent at create. Later edits do not change existing agents. */
5947
6245
  declare class Template {
@@ -6009,6 +6307,8 @@ declare class Agents {
6009
6307
  create(name: string, opts?: {
6010
6308
  template?: string;
6011
6309
  messaging?: boolean;
6310
+ userId?: string;
6311
+ displayName?: string;
6012
6312
  timeout?: Timeout;
6013
6313
  }): Promise<Agent>;
6014
6314
  getByName(name: string, opts?: {
@@ -6026,6 +6326,71 @@ declare class Agents {
6026
6326
  timeout?: Timeout;
6027
6327
  }): Promise<void>;
6028
6328
  }
6329
+ /** Conversations with an agent. */
6330
+ declare class Conversations {
6331
+ private readonly client;
6332
+ constructor(client: Client);
6333
+ /** Start a new conversation. Omit the user to open one for yourself.
6334
+ *
6335
+ * A title is a label. A second conversation with the same title is a new conversation.
6336
+ */
6337
+ create(agent: Agent | string, userOrOpts?: User | string | {
6338
+ userId?: string;
6339
+ title?: string;
6340
+ timeout?: Timeout;
6341
+ }, opts?: {
6342
+ title?: string;
6343
+ timeout?: Timeout;
6344
+ }): Promise<Conversation>;
6345
+ /** Newest activity first. Pass an agent or an end-user id. */
6346
+ list(opts?: {
6347
+ agent?: Agent | string;
6348
+ userId?: string;
6349
+ pageSize?: number;
6350
+ pageToken?: string;
6351
+ timeout?: Timeout;
6352
+ }): Promise<ConversationList>;
6353
+ /** Delete one conversation. */
6354
+ delete(id: string, opts?: {
6355
+ missingOk?: boolean;
6356
+ timeout?: Timeout;
6357
+ }): Promise<void>;
6358
+ }
6359
+ /** A person this project registered. */
6360
+ declare class User {
6361
+ private readonly client;
6362
+ /** The name passed to `users.create`. */
6363
+ readonly id: string;
6364
+ /** When this person was registered. */
6365
+ readonly createdAt: string;
6366
+ constructor(client: Client, info: EndUser);
6367
+ /** Log this person in. The token opens every conversation they have. */
6368
+ newToken(opts?: {
6369
+ timeout?: Timeout;
6370
+ }): Promise<LoginToken>;
6371
+ /** Sign this person out of every device. */
6372
+ revoke(opts?: {
6373
+ timeout?: Timeout;
6374
+ }): Promise<void>;
6375
+ /** Remove this person. A later login fails until you create them again. */
6376
+ delete(opts?: {
6377
+ timeout?: Timeout;
6378
+ }): Promise<void>;
6379
+ }
6380
+ /** People an app registers. You do not create a user for yourself. */
6381
+ declare class Users {
6382
+ private readonly client;
6383
+ constructor(client: Client);
6384
+ /** Register one person. Creating the same id again fails unless existOk is set. */
6385
+ create(id: string, opts?: {
6386
+ existOk?: boolean;
6387
+ timeout?: Timeout;
6388
+ }): Promise<User>;
6389
+ /** Fetch one person the app already created. */
6390
+ get(id: string, opts?: {
6391
+ timeout?: Timeout;
6392
+ }): Promise<User>;
6393
+ }
6029
6394
  /** Where to connect. */
6030
6395
  type ClientOptions = {
6031
6396
  /** Control plane URL. Omit to use credentials, then the default cloud URL. */
@@ -6055,6 +6420,10 @@ declare class Client {
6055
6420
  readonly secrets: Secrets;
6056
6421
  /** Matrix agents. */
6057
6422
  readonly agents: Agents;
6423
+ /** Conversations. */
6424
+ readonly conversations: Conversations;
6425
+ /** People an app registers. */
6426
+ readonly users: Users;
6058
6427
  /** Platform and project images. */
6059
6428
  readonly images: Images;
6060
6429
  /** Filesystem snapshots. */
@@ -6066,12 +6435,11 @@ declare class Client {
6066
6435
  /** Create, list, and open sandboxes. */
6067
6436
  readonly sandboxes: Sandboxes;
6068
6437
  constructor(opts?: ClientOptions);
6069
- private matrix;
6070
- /** The Matrix client for send and receive. One device for this process. */
6071
- room(): Promise<RoomIO>;
6072
- /** @internal Matrix user id for the live SDK session. */
6073
- matrixUserId(): Promise<string>;
6074
- /** Close the connection and log out this process's Matrix device. */
6438
+ /** Log yourself in. You do not create a user first. The token opens every conversation you have. */
6439
+ newToken(opts?: {
6440
+ timeout?: Timeout;
6441
+ }): Promise<LoginToken>;
6442
+ /** Close the connection. */
6075
6443
  close(): void;
6076
6444
  /** `using` calls this. */
6077
6445
  [Symbol.dispose](): void;
@@ -6683,6 +7051,6 @@ type GuestHttp = GuestHttp$1;
6683
7051
  /** Body returned by `GuestHttp.get` and `GuestHttp.post`. */
6684
7052
  type GuestResponse = GuestResponse$1;
6685
7053
 
6686
- declare const publicExports: readonly ["Agent", "Template", "MessageSubscription", "AuthenticationError", "CapacityError", "Client", "CommandFailedError", "CommandTimeoutError", "CommandTooLargeError", "ConflictError", "DirectoryNotEmptyError", "ExecutableNotFoundError", "FileExistsError", "FileTooLargeError", "GuestRuntimeDeadError", "ImageTimeoutError", "InvalidArgumentError", "InvalidPathError", "Mkdir", "UNLIMITED", "NameTakenError", "NotFoundError", "Page", "PathNotFoundError", "PageExhaustedError", "PermissionDeniedError", "PortNotOpenError", "ProcessHandle", "Profile", "ResourceInUseError", "ResourcePolicy", "SecurityPolicy", "ProcessNotFoundError", "ProcessWaitTimeoutError", "Remove", "Sandbox", "SandboxConflictError", "SandboxError", "SandboxNotFoundError", "SandboxNotReadyError", "SandboxSleepingError", "SandboxStateError", "LogStream", "SandboxStatus", "SandboxWaitTimeoutError", "SandboxTimeoutError", "TimeoutError", "UnavailableError", "Write", "mkdir", "publicExports", "remove", "write"];
7054
+ declare const publicExports: readonly ["Agent", "Template", "AuthenticationError", "CapacityError", "Client", "CommandFailedError", "CommandTimeoutError", "CommandTooLargeError", "ConflictError", "DirectoryNotEmptyError", "ExecutableNotFoundError", "FileExistsError", "FileTooLargeError", "GuestRuntimeDeadError", "ImageTimeoutError", "InvalidArgumentError", "InvalidPathError", "Mkdir", "UNLIMITED", "NameTakenError", "NotFoundError", "Page", "PathNotFoundError", "PageExhaustedError", "PermissionDeniedError", "PortNotOpenError", "ProcessHandle", "Profile", "ResourceInUseError", "ResourcePolicy", "SecurityPolicy", "ProcessNotFoundError", "ProcessWaitTimeoutError", "Remove", "Sandbox", "SandboxConflictError", "SandboxError", "SandboxNotFoundError", "SandboxNotReadyError", "SandboxSleepingError", "SandboxStateError", "LogStream", "SandboxStatus", "SandboxWaitTimeoutError", "SandboxTimeoutError", "TimeoutError", "UnavailableError", "Write", "mkdir", "publicExports", "remove", "write"];
6687
7055
 
6688
- export { Agent, AuthenticationError, CapacityError, Client, type ClientOptions, CommandFailedError, CommandTimeoutError, CommandTooLargeError, ConflictError, DirectoryNotEmptyError, type ExecBytesResult, type ExecResult, ExecutableNotFoundError, FileExistsError, type FileInfo, type FileList, FileTooLargeError, type GuestHttp, type GuestResponse, GuestRuntimeDeadError, type HTTPGrant, type Image, type ImageKind, ImageTimeoutError, InvalidArgumentError, InvalidPathError, type LogEntry, LogStream, type MessageEvent, MessageSubscription, Mkdir, NameTakenError, NotFoundError, Page, PageExhaustedError, PathNotFoundError, PermissionDeniedError, PortNotOpenError, type Process, ProcessHandle, ProcessNotFoundError, ProcessWaitTimeoutError, Profile, Remove, ResourceInUseError, ResourcePolicy, type Resources, Sandbox, SandboxConflictError, type SandboxCreateParams, SandboxError, type SandboxInfo, SandboxNotFoundError, SandboxNotReadyError, type SandboxRow, SandboxSleepingError, SandboxStateError, SandboxStatus, SandboxTimeoutError, SandboxWaitTimeoutError, type Secret, SecurityPolicy, type Snapshot, type StreamChunk, Template, TimeoutError, UNLIMITED, UnavailableError, type Volume, Write, mkdir, publicExports, remove, write };
7056
+ export { Agent, AuthenticationError, CapacityError, Client, type ClientOptions, CommandFailedError, CommandTimeoutError, CommandTooLargeError, ConflictError, DirectoryNotEmptyError, type ExecBytesResult, type ExecResult, ExecutableNotFoundError, FileExistsError, type FileInfo, type FileList, FileTooLargeError, type GuestHttp, type GuestResponse, GuestRuntimeDeadError, type HTTPGrant, type Image, type ImageKind, ImageTimeoutError, InvalidArgumentError, InvalidPathError, type LogEntry, LogStream, Mkdir, NameTakenError, NotFoundError, Page, PageExhaustedError, PathNotFoundError, PermissionDeniedError, PortNotOpenError, type Process, ProcessHandle, ProcessNotFoundError, ProcessWaitTimeoutError, Profile, Remove, ResourceInUseError, ResourcePolicy, type Resources, Sandbox, SandboxConflictError, type SandboxCreateParams, SandboxError, type SandboxInfo, SandboxNotFoundError, SandboxNotReadyError, type SandboxRow, SandboxSleepingError, SandboxStateError, SandboxStatus, SandboxTimeoutError, SandboxWaitTimeoutError, type Secret, SecurityPolicy, type Snapshot, type StreamChunk, Template, TimeoutError, UNLIMITED, UnavailableError, type Volume, Write, mkdir, publicExports, remove, write };