appostle-installer 0.0.16 → 0.0.18

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/appostle.js CHANGED
@@ -2409,6 +2409,13 @@ var ChatRoomSchema = z4.object({
2409
2409
  id: z4.string(),
2410
2410
  name: z4.string(),
2411
2411
  purpose: z4.string().nullable(),
2412
+ /**
2413
+ * Auth-server user-id of the user who created the room. `null` = legacy
2414
+ * room (created before multi-tenant scoping) — visible to all users on
2415
+ * the daemon. New rooms get the creator's userId and are scoped to that
2416
+ * user only. See gitlab issue #25.
2417
+ */
2418
+ ownerUserId: z4.string().nullable().default(null),
2412
2419
  createdAt: z4.string(),
2413
2420
  updatedAt: z4.string()
2414
2421
  });
@@ -37370,6 +37377,7 @@ var Session = class _Session {
37370
37377
  this.getSpeechReadiness = dictation?.getSpeechReadiness;
37371
37378
  this.agentProviderRuntimeSettings = agentProviderRuntimeSettings;
37372
37379
  this.providerOverrides = providerOverrides;
37380
+ this.onAccountLinked = options.onAccountLinked;
37373
37381
  this.abortController = new AbortController();
37374
37382
  this.providerRegistry = buildProviderRegistry(this.sessionLogger, {
37375
37383
  runtimeSettings: this.agentProviderRuntimeSettings,
@@ -38681,9 +38689,20 @@ var Session = class _Session {
38681
38689
  savePersistedConfig(this.appostleHome, nextConfig, log2);
38682
38690
  log2.info(
38683
38691
  { hostId: body.hostId, userId: body.userId, authServerUrl },
38684
- "daemon linked to account \u2014 restart daemon to start allow-list sync"
38692
+ "daemon linked to account \u2014 starting allow-list sync"
38685
38693
  );
38686
38694
  respond({ ok: true, hostId: body.hostId, userId: body.userId });
38695
+ if (this.onAccountLinked) {
38696
+ void this.onAccountLinked({
38697
+ daemonToken: body.daemonToken,
38698
+ serverPubkey: body.serverPubkey,
38699
+ userId: body.userId,
38700
+ hostId: body.hostId,
38701
+ authServerUrl
38702
+ }).catch((err) => {
38703
+ log2.error({ err }, "onAccountLinked callback failed");
38704
+ });
38705
+ }
38687
38706
  } catch (err) {
38688
38707
  const message = err instanceof Error ? err.message : "unknown_error";
38689
38708
  log2.error({ err }, "link_account_request: unexpected error");
@@ -44874,7 +44893,8 @@ ${details}`.trim());
44874
44893
  try {
44875
44894
  const room = await this.chatService.createRoom({
44876
44895
  name: request.name,
44877
- purpose: request.purpose
44896
+ purpose: request.purpose,
44897
+ ownerUserId: this.ownerUserId
44878
44898
  });
44879
44899
  this.emit({
44880
44900
  type: "chat/create/response",
@@ -44890,7 +44910,7 @@ ${details}`.trim());
44890
44910
  }
44891
44911
  async handleChatListRequest(request) {
44892
44912
  try {
44893
- const rooms = await this.chatService.listRooms();
44913
+ const rooms = await this.chatService.listRooms(this.ownerUserId);
44894
44914
  this.emit({
44895
44915
  type: "chat/list/response",
44896
44916
  payload: {
@@ -44906,7 +44926,8 @@ ${details}`.trim());
44906
44926
  async handleChatInspectRequest(request) {
44907
44927
  try {
44908
44928
  const result = await this.chatService.inspectRoom({
44909
- room: request.room
44929
+ room: request.room,
44930
+ requesterUserId: this.ownerUserId
44910
44931
  });
44911
44932
  this.emit({
44912
44933
  type: "chat/inspect/response",
@@ -44923,7 +44944,8 @@ ${details}`.trim());
44923
44944
  async handleChatDeleteRequest(request) {
44924
44945
  try {
44925
44946
  const result = await this.chatService.deleteRoom({
44926
- room: request.room
44947
+ room: request.room,
44948
+ requesterUserId: this.ownerUserId
44927
44949
  });
44928
44950
  this.emit({
44929
44951
  type: "chat/delete/response",
@@ -44944,7 +44966,8 @@ ${details}`.trim());
44944
44966
  room: request.room,
44945
44967
  authorAgentId,
44946
44968
  body: request.body,
44947
- replyToMessageId: request.replyToMessageId
44969
+ replyToMessageId: request.replyToMessageId,
44970
+ requesterUserId: this.ownerUserId
44948
44971
  });
44949
44972
  this.emit({
44950
44973
  type: "chat/post/response",
@@ -44977,7 +45000,8 @@ ${details}`.trim());
44977
45000
  room: request.room,
44978
45001
  limit: request.limit,
44979
45002
  since: request.since,
44980
- authorAgentId: request.authorAgentId
45003
+ authorAgentId: request.authorAgentId,
45004
+ requesterUserId: this.ownerUserId
44981
45005
  });
44982
45006
  this.emit({
44983
45007
  type: "chat/read/response",
@@ -44996,7 +45020,8 @@ ${details}`.trim());
44996
45020
  const messages = await this.chatService.waitForMessages({
44997
45021
  room: request.room,
44998
45022
  afterMessageId: request.afterMessageId,
44999
- timeoutMs: request.timeoutMs
45023
+ timeoutMs: request.timeoutMs,
45024
+ requesterUserId: this.ownerUserId
45000
45025
  });
45001
45026
  this.emit({
45002
45027
  type: "chat/wait/response",