@alook/cli 0.0.150 → 0.0.151

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/index.js CHANGED
@@ -207,10 +207,22 @@ var COMMUNITY_BOT_NAME_MIN = 1;
207
207
  var COMMUNITY_BOT_NAME_MAX = 32;
208
208
  var COMMUNITY_BOT_DESCRIPTION_MAX = 1024;
209
209
  var COMMUNITY_BOT_IMAGE_URL_MAX = 2048;
210
- var DEV_WEB_URL = process.env.ALOOK_SERVER_URL || "http://localhost:3000";
211
- var DEV_WS_DO_URL = process.env.DEV_WS_DO_URL || "http://localhost:8789";
212
- var DEV_EMAIL_WORKER_URL = process.env.DEV_EMAIL_WORKER_URL || "http://localhost:8787";
210
+ var DEV_PORTS = {
211
+ web: 3000,
212
+ emailWorker: 8787,
213
+ wsDo: 8789,
214
+ wakeWorker: 8790
215
+ };
216
+ var DEV_WEB_URL = process.env.ALOOK_SERVER_URL || `http://localhost:${DEV_PORTS.web}`;
217
+ var DEV_WS_DO_URL = process.env.DEV_WS_DO_URL || `http://localhost:${DEV_PORTS.wsDo}`;
218
+ var DEV_EMAIL_WORKER_URL = process.env.DEV_EMAIL_WORKER_URL || `http://localhost:${DEV_PORTS.emailWorker}`;
219
+ var DEV_WAKE_WORKER_URL = process.env.DEV_WAKE_WORKER_URL || `http://localhost:${DEV_PORTS.wakeWorker}`;
220
+ function devWsDoPort() {
221
+ const port = Number(new URL(DEV_WS_DO_URL).port);
222
+ return port || DEV_PORTS.wsDo;
223
+ }
213
224
  // ../shared/src/constants/community.ts
225
+ var MAX_MESSAGE_CONTENT_LENGTH = 4000;
214
226
  var MAX_ATTACHMENT_SIZE_BYTES = 25 * 1024 * 1024;
215
227
  var MAX_SERVER_ICON_SIZE_BYTES = 5 * 1024 * 1024;
216
228
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
@@ -15087,14 +15099,37 @@ var CommunityBotPatchRequestSchema = exports_external.object({
15087
15099
  var CommunityBotAddToServerRequestSchema = exports_external.object({
15088
15100
  botId: exports_external.string().min(1)
15089
15101
  });
15090
- var CommunityDaemonSendAsBotRequestSchema = exports_external.object({
15091
- target: exports_external.enum(["channel", "dm"]),
15092
- targetId: exports_external.string().min(1),
15093
- content: exports_external.string().max(4000),
15094
- replyToId: exports_external.string().optional(),
15095
- mentionType: exports_external.enum(["everyone", "here", "user"]).optional(),
15096
- embeds: exports_external.array(exports_external.unknown()).optional(),
15097
- attachments: exports_external.array(exports_external.unknown()).optional()
15102
+ var CommunityAgentMessageContentSchema = exports_external.object({ text: exports_external.string().min(1).max(MAX_MESSAGE_CONTENT_LENGTH) }).catchall(exports_external.unknown());
15103
+ var CommunityAgentSeqSchema = exports_external.number().int().min(0);
15104
+ var CommunityAgentPositiveSeqSchema = exports_external.number().int().min(1);
15105
+ var CommunityAgentCursorSchema = exports_external.object({
15106
+ channel: exports_external.string().min(1),
15107
+ seq: CommunityAgentPositiveSeqSchema
15108
+ });
15109
+ var CommunityAgentSendRequestSchema = exports_external.object({
15110
+ channel: exports_external.string().min(1),
15111
+ content: CommunityAgentMessageContentSchema,
15112
+ seenUpToSeq: CommunityAgentSeqSchema.optional()
15113
+ });
15114
+ var CommunityAgentInboxPullRequestSchema = exports_external.object({
15115
+ max: exports_external.number().int().min(1).max(200).optional()
15116
+ });
15117
+ var CommunityAgentAckRequestSchema = exports_external.object({
15118
+ cursors: exports_external.array(CommunityAgentCursorSchema).min(1)
15119
+ });
15120
+ var CommunityAgentReadRequestSchema = exports_external.object({
15121
+ channel: exports_external.string().min(1),
15122
+ before: CommunityAgentSeqSchema.optional(),
15123
+ after: CommunityAgentSeqSchema.optional(),
15124
+ around: CommunityAgentSeqSchema.optional(),
15125
+ limit: exports_external.number().int().min(1).max(200).optional()
15126
+ }).refine((v) => [v.before, v.after, v.around].filter((x) => x !== undefined).length <= 1, { message: "at most one of before/after/around may be supplied" });
15127
+ var CommunityAgentResolveRequestSchema = exports_external.object({
15128
+ channel: exports_external.string().min(1),
15129
+ seq: CommunityAgentSeqSchema
15130
+ });
15131
+ var CommunityAgentListChannelsRequestSchema = exports_external.object({
15132
+ server: exports_external.string().min(1).optional()
15098
15133
  });
15099
15134
  // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/entity.js
15100
15135
  var entityKind = Symbol.for("drizzle:entityKind");
@@ -15121,47 +15156,6 @@ function is(value, type) {
15121
15156
  return false;
15122
15157
  }
15123
15158
 
15124
- // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/table.utils.js
15125
- var TableName = Symbol.for("drizzle:Name");
15126
-
15127
- // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/table.js
15128
- var Schema = Symbol.for("drizzle:Schema");
15129
- var Columns = Symbol.for("drizzle:Columns");
15130
- var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
15131
- var OriginalName = Symbol.for("drizzle:OriginalName");
15132
- var BaseName = Symbol.for("drizzle:BaseName");
15133
- var IsAlias = Symbol.for("drizzle:IsAlias");
15134
- var ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
15135
- var IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
15136
-
15137
- class Table {
15138
- static [entityKind] = "Table";
15139
- static Symbol = {
15140
- Name: TableName,
15141
- Schema,
15142
- OriginalName,
15143
- Columns,
15144
- ExtraConfigColumns,
15145
- BaseName,
15146
- IsAlias,
15147
- ExtraConfigBuilder
15148
- };
15149
- [TableName];
15150
- [OriginalName];
15151
- [Schema];
15152
- [Columns];
15153
- [ExtraConfigColumns];
15154
- [BaseName];
15155
- [IsAlias] = false;
15156
- [IsDrizzleTable] = true;
15157
- [ExtraConfigBuilder] = undefined;
15158
- constructor(name, schema, baseName) {
15159
- this[TableName] = this[OriginalName] = name;
15160
- this[Schema] = schema;
15161
- this[BaseName] = baseName;
15162
- }
15163
- }
15164
-
15165
15159
  // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/column.js
15166
15160
  class Column {
15167
15161
  constructor(table, config2) {
@@ -15268,6 +15262,9 @@ class ColumnBuilder {
15268
15262
  }
15269
15263
  }
15270
15264
 
15265
+ // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/table.utils.js
15266
+ var TableName = Symbol.for("drizzle:Name");
15267
+
15271
15268
  // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/tracing-utils.js
15272
15269
  function iife(fn, ...args) {
15273
15270
  return fn(...args);
@@ -15405,6 +15402,44 @@ var tracer = {
15405
15402
  // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/view-common.js
15406
15403
  var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
15407
15404
 
15405
+ // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/table.js
15406
+ var Schema = Symbol.for("drizzle:Schema");
15407
+ var Columns = Symbol.for("drizzle:Columns");
15408
+ var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
15409
+ var OriginalName = Symbol.for("drizzle:OriginalName");
15410
+ var BaseName = Symbol.for("drizzle:BaseName");
15411
+ var IsAlias = Symbol.for("drizzle:IsAlias");
15412
+ var ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
15413
+ var IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
15414
+
15415
+ class Table {
15416
+ static [entityKind] = "Table";
15417
+ static Symbol = {
15418
+ Name: TableName,
15419
+ Schema,
15420
+ OriginalName,
15421
+ Columns,
15422
+ ExtraConfigColumns,
15423
+ BaseName,
15424
+ IsAlias,
15425
+ ExtraConfigBuilder
15426
+ };
15427
+ [TableName];
15428
+ [OriginalName];
15429
+ [Schema];
15430
+ [Columns];
15431
+ [ExtraConfigColumns];
15432
+ [BaseName];
15433
+ [IsAlias] = false;
15434
+ [IsDrizzleTable] = true;
15435
+ [ExtraConfigBuilder] = undefined;
15436
+ constructor(name, schema, baseName) {
15437
+ this[TableName] = this[OriginalName] = name;
15438
+ this[Schema] = schema;
15439
+ this[BaseName] = baseName;
15440
+ }
15441
+ }
15442
+
15408
15443
  // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/sql/sql.js
15409
15444
  function isSQLWrapper(value) {
15410
15445
  return value !== null && value !== undefined && typeof value.getSQL === "function";
@@ -15774,6 +15809,31 @@ function getColumnNameAndConfig(a, b) {
15774
15809
  }
15775
15810
  var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder;
15776
15811
 
15812
+ // ../shared/src/db/community-schema.ts
15813
+ var exports_community_schema = {};
15814
+ __export(exports_community_schema, {
15815
+ communityUserProfile: () => communityUserProfile,
15816
+ communityServerMember: () => communityServerMember,
15817
+ communityServerInvite: () => communityServerInvite,
15818
+ communityServerFolderItem: () => communityServerFolderItem,
15819
+ communityServerFolder: () => communityServerFolder,
15820
+ communityServer: () => communityServer,
15821
+ communityReadState: () => communityReadState,
15822
+ communityReaction: () => communityReaction,
15823
+ communityPin: () => communityPin,
15824
+ communityNotificationSetting: () => communityNotificationSetting,
15825
+ communityMessageSeq: () => communityMessageSeq,
15826
+ communityMessage: () => communityMessage,
15827
+ communityMention: () => communityMention,
15828
+ communityFriendship: () => communityFriendship,
15829
+ communityDmConversation: () => communityDmConversation,
15830
+ communityChannel: () => communityChannel,
15831
+ communityCategory: () => communityCategory,
15832
+ communityBotApprovalRequest: () => communityBotApprovalRequest,
15833
+ communityAuditLog: () => communityAuditLog,
15834
+ communityAttachment: () => communityAttachment
15835
+ });
15836
+
15777
15837
  // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/sqlite-core/foreign-keys.js
15778
15838
  class ForeignKeyBuilder {
15779
15839
  static [entityKind] = "SQLiteForeignKeyBuilder";
@@ -16442,6 +16502,9 @@ class PrimaryKey {
16442
16502
  }
16443
16503
  }
16444
16504
 
16505
+ // ../shared/src/db/community-schema.ts
16506
+ init_nanoid();
16507
+
16445
16508
  // ../shared/src/db/schema.ts
16446
16509
  var exports_schema = {};
16447
16510
  __export(exports_schema, {
@@ -17031,30 +17094,6 @@ var inboxUnread = sqliteTable("inbox_unread", {
17031
17094
  ]);
17032
17095
 
17033
17096
  // ../shared/src/db/community-schema.ts
17034
- var exports_community_schema = {};
17035
- __export(exports_community_schema, {
17036
- communityUserProfile: () => communityUserProfile,
17037
- communityServerMember: () => communityServerMember,
17038
- communityServerInvite: () => communityServerInvite,
17039
- communityServerFolderItem: () => communityServerFolderItem,
17040
- communityServerFolder: () => communityServerFolder,
17041
- communityServer: () => communityServer,
17042
- communityReadState: () => communityReadState,
17043
- communityReaction: () => communityReaction,
17044
- communityPin: () => communityPin,
17045
- communityNotificationSetting: () => communityNotificationSetting,
17046
- communityMessage: () => communityMessage,
17047
- communityMention: () => communityMention,
17048
- communityInboxDismissal: () => communityInboxDismissal,
17049
- communityFriendship: () => communityFriendship,
17050
- communityDmConversation: () => communityDmConversation,
17051
- communityChannel: () => communityChannel,
17052
- communityCategory: () => communityCategory,
17053
- communityBotApprovalRequest: () => communityBotApprovalRequest,
17054
- communityAuditLog: () => communityAuditLog,
17055
- communityAttachment: () => communityAttachment
17056
- });
17057
- init_nanoid();
17058
17097
  var communityServer = sqliteTable("community_server", {
17059
17098
  id: text("id").primaryKey().$defaultFn(() => nanoid3()),
17060
17099
  name: text("name").notNull(),
@@ -17120,12 +17159,17 @@ var communityMessage = sqliteTable("community_message", {
17120
17159
  channelId: text("channel_id").references(() => communityChannel.id, {
17121
17160
  onDelete: "cascade"
17122
17161
  }),
17123
- dmConversationId: text("dm_conversation_id").references(() => communityDmConversation.id, { onDelete: "cascade" })
17162
+ dmConversationId: text("dm_conversation_id").references(() => communityDmConversation.id, { onDelete: "cascade" }),
17163
+ seq: integer2("seq").notNull().default(0)
17124
17164
  }, (t) => [
17125
17165
  index("idx_message_channel_created").on(t.channelId, t.createdAt),
17126
17166
  index("idx_message_channel_mention_created").on(t.channelId, t.mentionType, t.createdAt),
17127
17167
  index("idx_message_dm_created").on(t.dmConversationId, t.createdAt)
17128
17168
  ]);
17169
+ var communityMessageSeq = sqliteTable("community_message_seq", {
17170
+ scopeKey: text("scope_key").primaryKey(),
17171
+ nextSeq: integer2("next_seq").notNull()
17172
+ });
17129
17173
  var communityServerMember = sqliteTable("community_server_member", {
17130
17174
  id: text("id").primaryKey().$defaultFn(() => nanoid3()),
17131
17175
  serverId: text("server_id").notNull().references(() => communityServer.id, { onDelete: "cascade" }),
@@ -17184,7 +17228,8 @@ var communityReadState = sqliteTable("community_read_state", {
17184
17228
  }),
17185
17229
  dmConversationId: text("dm_conversation_id").references(() => communityDmConversation.id, { onDelete: "cascade" }),
17186
17230
  lastReadAt: text("last_read_at").notNull(),
17187
- lastReadMessageId: text("last_read_message_id")
17231
+ lastReadMessageId: text("last_read_message_id"),
17232
+ lastReadSeq: integer2("last_read_seq").notNull().default(0)
17188
17233
  }, (t) => [index("idx_read_state_user").on(t.userId)]);
17189
17234
  var communityReaction = sqliteTable("community_reaction", {
17190
17235
  id: text("id").primaryKey().$defaultFn(() => nanoid3()),
@@ -17273,15 +17318,89 @@ var communityBotApprovalRequest = sqliteTable("community_bot_approval_request",
17273
17318
  createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),
17274
17319
  resolvedAt: text("resolved_at")
17275
17320
  }, (t) => [index("idx_community_bot_approval_bot").on(t.botId, t.status)]);
17276
- var communityInboxDismissal = sqliteTable("community_inbox_dismissal", {
17277
- id: text("id").primaryKey().$defaultFn(() => nanoid3()),
17278
- userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
17279
- eventKey: text("event_key").notNull(),
17280
- dismissedAt: text("dismissed_at").notNull().$defaultFn(() => new Date().toISOString())
17281
- }, (t) => [
17282
- unique("uq_inbox_dismissal_user_event").on(t.userId, t.eventKey),
17283
- index("idx_inbox_dismissal_user").on(t.userId)
17284
- ]);
17321
+
17322
+ // ../shared/src/logger.ts
17323
+ var LEVELS = {
17324
+ debug: 0,
17325
+ info: 1,
17326
+ warn: 2,
17327
+ error: 3,
17328
+ silent: 4
17329
+ };
17330
+
17331
+ class Logger {
17332
+ service;
17333
+ level;
17334
+ pretty;
17335
+ fields;
17336
+ constructor(opts, fields) {
17337
+ this.service = opts.service;
17338
+ this.level = LEVELS[opts.level ?? "info"];
17339
+ this.pretty = opts.pretty ?? false;
17340
+ this.fields = fields ?? {};
17341
+ }
17342
+ debug(msg, ctx) {
17343
+ this.write("debug", msg, ctx);
17344
+ }
17345
+ info(msg, ctx) {
17346
+ this.write("info", msg, ctx);
17347
+ }
17348
+ warn(msg, ctx) {
17349
+ this.write("warn", msg, ctx);
17350
+ }
17351
+ error(msg, ctx) {
17352
+ this.write("error", msg, ctx);
17353
+ }
17354
+ child(fields) {
17355
+ const merged = { ...this.fields, ...fields };
17356
+ const child = new Logger({ service: this.service, level: this.levelName(), pretty: this.pretty }, merged);
17357
+ return child;
17358
+ }
17359
+ levelName() {
17360
+ for (const [name, num] of Object.entries(LEVELS)) {
17361
+ if (num === this.level)
17362
+ return name;
17363
+ }
17364
+ return "info";
17365
+ }
17366
+ write(level, msg, ctx) {
17367
+ if (LEVELS[level] < this.level)
17368
+ return;
17369
+ const entry = {
17370
+ level,
17371
+ msg,
17372
+ service: this.service,
17373
+ ...this.fields,
17374
+ ...ctx,
17375
+ ts: new Date().toISOString()
17376
+ };
17377
+ for (const [k, v] of Object.entries(entry)) {
17378
+ if (v instanceof Error) {
17379
+ entry[k] = { message: v.message, stack: v.stack };
17380
+ }
17381
+ }
17382
+ let line;
17383
+ if (this.pretty) {
17384
+ const ts = entry.ts.replace("T", " ").replace("Z", "");
17385
+ const lvl = entry.level.toUpperCase().padEnd(5);
17386
+ const pairs = Object.entries(entry).filter(([k]) => k !== "level" && k !== "msg" && k !== "service" && k !== "ts").map(([k, v]) => `${k}=${typeof v === "object" ? JSON.stringify(v) : v}`).join(" ");
17387
+ line = `${ts} ${lvl} [${entry.service}] ${entry.msg}${pairs ? " " + pairs : ""}`;
17388
+ } else {
17389
+ line = JSON.stringify(entry);
17390
+ }
17391
+ if (level === "error") {
17392
+ console.error(line);
17393
+ } else {
17394
+ console.log(line);
17395
+ }
17396
+ }
17397
+ }
17398
+ function createLogger(opts) {
17399
+ return new Logger(opts);
17400
+ }
17401
+
17402
+ // ../shared/src/db/queries/community/message.ts
17403
+ var log = createLogger({ service: "community-queries" });
17285
17404
 
17286
17405
  // ../shared/src/db/community-machine-schema.ts
17287
17406
  var exports_community_machine_schema = {};
@@ -17357,6 +17476,16 @@ var communityAgentRunnerKey = sqliteTable("community_agent_runner_key", {
17357
17476
  index("idx_community_agent_runner_key_machine_agent").on(t.machineId, t.agentId)
17358
17477
  ]);
17359
17478
 
17479
+ // ../shared/src/db/queries/community/agent-inbox.ts
17480
+ var AGENT_MESSAGE_COLUMNS = {
17481
+ id: communityMessage.id,
17482
+ authorId: communityMessage.authorId,
17483
+ content: communityMessage.content,
17484
+ createdAt: communityMessage.createdAt,
17485
+ channelId: communityMessage.channelId,
17486
+ dmConversationId: communityMessage.dmConversationId,
17487
+ seq: communityMessage.seq
17488
+ };
17360
17489
  // ../shared/src/db/index.ts
17361
17490
  var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema };
17362
17491
  // ../shared/src/db/queries/user.ts
@@ -17401,88 +17530,8 @@ var RESERVED_HANDLES = new Set([
17401
17530
  function toAlookAddress(h) {
17402
17531
  return `${h}${DOMAIN}`;
17403
17532
  }
17404
- // ../shared/src/logger.ts
17405
- var LEVELS = {
17406
- debug: 0,
17407
- info: 1,
17408
- warn: 2,
17409
- error: 3,
17410
- silent: 4
17411
- };
17412
-
17413
- class Logger {
17414
- service;
17415
- level;
17416
- pretty;
17417
- fields;
17418
- constructor(opts, fields) {
17419
- this.service = opts.service;
17420
- this.level = LEVELS[opts.level ?? "info"];
17421
- this.pretty = opts.pretty ?? false;
17422
- this.fields = fields ?? {};
17423
- }
17424
- debug(msg, ctx) {
17425
- this.write("debug", msg, ctx);
17426
- }
17427
- info(msg, ctx) {
17428
- this.write("info", msg, ctx);
17429
- }
17430
- warn(msg, ctx) {
17431
- this.write("warn", msg, ctx);
17432
- }
17433
- error(msg, ctx) {
17434
- this.write("error", msg, ctx);
17435
- }
17436
- child(fields) {
17437
- const merged = { ...this.fields, ...fields };
17438
- const child = new Logger({ service: this.service, level: this.levelName(), pretty: this.pretty }, merged);
17439
- return child;
17440
- }
17441
- levelName() {
17442
- for (const [name, num] of Object.entries(LEVELS)) {
17443
- if (num === this.level)
17444
- return name;
17445
- }
17446
- return "info";
17447
- }
17448
- write(level, msg, ctx) {
17449
- if (LEVELS[level] < this.level)
17450
- return;
17451
- const entry = {
17452
- level,
17453
- msg,
17454
- service: this.service,
17455
- ...this.fields,
17456
- ...ctx,
17457
- ts: new Date().toISOString()
17458
- };
17459
- for (const [k, v] of Object.entries(entry)) {
17460
- if (v instanceof Error) {
17461
- entry[k] = { message: v.message, stack: v.stack };
17462
- }
17463
- }
17464
- let line;
17465
- if (this.pretty) {
17466
- const ts = entry.ts.replace("T", " ").replace("Z", "");
17467
- const lvl = entry.level.toUpperCase().padEnd(5);
17468
- const pairs = Object.entries(entry).filter(([k]) => k !== "level" && k !== "msg" && k !== "service" && k !== "ts").map(([k, v]) => `${k}=${typeof v === "object" ? JSON.stringify(v) : v}`).join(" ");
17469
- line = `${ts} ${lvl} [${entry.service}] ${entry.msg}${pairs ? " " + pairs : ""}`;
17470
- } else {
17471
- line = JSON.stringify(entry);
17472
- }
17473
- if (level === "error") {
17474
- console.error(line);
17475
- } else {
17476
- console.log(line);
17477
- }
17478
- }
17479
- }
17480
- function createLogger(opts) {
17481
- return new Logger(opts);
17482
- }
17483
-
17484
17533
  // ../shared/src/db/queries/community/channel.ts
17485
- var log = createLogger({ service: "community-queries" });
17534
+ var log2 = createLogger({ service: "community-queries" });
17486
17535
  var CHANNEL_COLUMNS = {
17487
17536
  id: communityChannel.id,
17488
17537
  serverId: communityChannel.serverId,
@@ -17500,8 +17549,6 @@ var CHANNEL_COLUMNS = {
17500
17549
  lastMessageAt: communityChannel.lastMessageAt,
17501
17550
  createdAt: communityChannel.createdAt
17502
17551
  };
17503
- // ../shared/src/db/queries/community/message.ts
17504
- var log2 = createLogger({ service: "community-queries" });
17505
17552
  // ../shared/src/db/queries/community/search.ts
17506
17553
  var FTS_KEYWORDS = new Set(["and", "or", "not", "near"]);
17507
17554
  // ../shared/src/semver.ts
@@ -17568,14 +17615,13 @@ function cliCommand(mode) {
17568
17615
  }
17569
17616
  }
17570
17617
  var DEFAULT_BASE_URL = "https://alook.ai";
17571
- var DEV_BASE_URL = "http://localhost:3000";
17572
17618
  function getBaseUrl(signals) {
17573
17619
  if (signals.serverUrl)
17574
17620
  return signals.serverUrl;
17575
17621
  if (signals.appUrl)
17576
17622
  return signals.appUrl;
17577
17623
  if (signals.nodeEnv === "development")
17578
- return DEV_BASE_URL;
17624
+ return DEV_WEB_URL;
17579
17625
  return DEFAULT_BASE_URL;
17580
17626
  }
17581
17627
  // lib/env.ts
@@ -22005,7 +22051,7 @@ var WS_RECONNECT_INIT = 1000;
22005
22051
  var WS_RECONNECT_MAX = 30000;
22006
22052
  var WS_PING_INTERVAL = 25000;
22007
22053
  var WS_LIVENESS_TIMEOUT = 50000;
22008
- var WS_DO_DEV_PORT = Number(process.env.ALOOK_WS_DO_PORT) || 8789;
22054
+ var WS_DO_DEV_PORT = Number(process.env.ALOOK_WS_DO_PORT) || devWsDoPort();
22009
22055
 
22010
22056
  class DaemonWsClient {
22011
22057
  opts;
@@ -116,10 +116,18 @@ var COMMUNITY_BOT_NAME_MIN = 1;
116
116
  var COMMUNITY_BOT_NAME_MAX = 32;
117
117
  var COMMUNITY_BOT_DESCRIPTION_MAX = 1024;
118
118
  var COMMUNITY_BOT_IMAGE_URL_MAX = 2048;
119
- var DEV_WEB_URL = process.env.ALOOK_SERVER_URL || "http://localhost:3000";
120
- var DEV_WS_DO_URL = process.env.DEV_WS_DO_URL || "http://localhost:8789";
121
- var DEV_EMAIL_WORKER_URL = process.env.DEV_EMAIL_WORKER_URL || "http://localhost:8787";
119
+ var DEV_PORTS = {
120
+ web: 3000,
121
+ emailWorker: 8787,
122
+ wsDo: 8789,
123
+ wakeWorker: 8790
124
+ };
125
+ var DEV_WEB_URL = process.env.ALOOK_SERVER_URL || `http://localhost:${DEV_PORTS.web}`;
126
+ var DEV_WS_DO_URL = process.env.DEV_WS_DO_URL || `http://localhost:${DEV_PORTS.wsDo}`;
127
+ var DEV_EMAIL_WORKER_URL = process.env.DEV_EMAIL_WORKER_URL || `http://localhost:${DEV_PORTS.emailWorker}`;
128
+ var DEV_WAKE_WORKER_URL = process.env.DEV_WAKE_WORKER_URL || `http://localhost:${DEV_PORTS.wakeWorker}`;
122
129
  // ../shared/src/constants/community.ts
130
+ var MAX_MESSAGE_CONTENT_LENGTH = 4000;
123
131
  var MAX_ATTACHMENT_SIZE_BYTES = 25 * 1024 * 1024;
124
132
  var MAX_SERVER_ICON_SIZE_BYTES = 5 * 1024 * 1024;
125
133
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
@@ -14996,14 +15004,37 @@ var CommunityBotPatchRequestSchema = exports_external.object({
14996
15004
  var CommunityBotAddToServerRequestSchema = exports_external.object({
14997
15005
  botId: exports_external.string().min(1)
14998
15006
  });
14999
- var CommunityDaemonSendAsBotRequestSchema = exports_external.object({
15000
- target: exports_external.enum(["channel", "dm"]),
15001
- targetId: exports_external.string().min(1),
15002
- content: exports_external.string().max(4000),
15003
- replyToId: exports_external.string().optional(),
15004
- mentionType: exports_external.enum(["everyone", "here", "user"]).optional(),
15005
- embeds: exports_external.array(exports_external.unknown()).optional(),
15006
- attachments: exports_external.array(exports_external.unknown()).optional()
15007
+ var CommunityAgentMessageContentSchema = exports_external.object({ text: exports_external.string().min(1).max(MAX_MESSAGE_CONTENT_LENGTH) }).catchall(exports_external.unknown());
15008
+ var CommunityAgentSeqSchema = exports_external.number().int().min(0);
15009
+ var CommunityAgentPositiveSeqSchema = exports_external.number().int().min(1);
15010
+ var CommunityAgentCursorSchema = exports_external.object({
15011
+ channel: exports_external.string().min(1),
15012
+ seq: CommunityAgentPositiveSeqSchema
15013
+ });
15014
+ var CommunityAgentSendRequestSchema = exports_external.object({
15015
+ channel: exports_external.string().min(1),
15016
+ content: CommunityAgentMessageContentSchema,
15017
+ seenUpToSeq: CommunityAgentSeqSchema.optional()
15018
+ });
15019
+ var CommunityAgentInboxPullRequestSchema = exports_external.object({
15020
+ max: exports_external.number().int().min(1).max(200).optional()
15021
+ });
15022
+ var CommunityAgentAckRequestSchema = exports_external.object({
15023
+ cursors: exports_external.array(CommunityAgentCursorSchema).min(1)
15024
+ });
15025
+ var CommunityAgentReadRequestSchema = exports_external.object({
15026
+ channel: exports_external.string().min(1),
15027
+ before: CommunityAgentSeqSchema.optional(),
15028
+ after: CommunityAgentSeqSchema.optional(),
15029
+ around: CommunityAgentSeqSchema.optional(),
15030
+ limit: exports_external.number().int().min(1).max(200).optional()
15031
+ }).refine((v) => [v.before, v.after, v.around].filter((x) => x !== undefined).length <= 1, { message: "at most one of before/after/around may be supplied" });
15032
+ var CommunityAgentResolveRequestSchema = exports_external.object({
15033
+ channel: exports_external.string().min(1),
15034
+ seq: CommunityAgentSeqSchema
15035
+ });
15036
+ var CommunityAgentListChannelsRequestSchema = exports_external.object({
15037
+ server: exports_external.string().min(1).optional()
15007
15038
  });
15008
15039
  // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/entity.js
15009
15040
  var entityKind = Symbol.for("drizzle:entityKind");
@@ -15030,47 +15061,6 @@ function is(value, type) {
15030
15061
  return false;
15031
15062
  }
15032
15063
 
15033
- // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/table.utils.js
15034
- var TableName = Symbol.for("drizzle:Name");
15035
-
15036
- // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/table.js
15037
- var Schema = Symbol.for("drizzle:Schema");
15038
- var Columns = Symbol.for("drizzle:Columns");
15039
- var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
15040
- var OriginalName = Symbol.for("drizzle:OriginalName");
15041
- var BaseName = Symbol.for("drizzle:BaseName");
15042
- var IsAlias = Symbol.for("drizzle:IsAlias");
15043
- var ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
15044
- var IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
15045
-
15046
- class Table {
15047
- static [entityKind] = "Table";
15048
- static Symbol = {
15049
- Name: TableName,
15050
- Schema,
15051
- OriginalName,
15052
- Columns,
15053
- ExtraConfigColumns,
15054
- BaseName,
15055
- IsAlias,
15056
- ExtraConfigBuilder
15057
- };
15058
- [TableName];
15059
- [OriginalName];
15060
- [Schema];
15061
- [Columns];
15062
- [ExtraConfigColumns];
15063
- [BaseName];
15064
- [IsAlias] = false;
15065
- [IsDrizzleTable] = true;
15066
- [ExtraConfigBuilder] = undefined;
15067
- constructor(name, schema, baseName) {
15068
- this[TableName] = this[OriginalName] = name;
15069
- this[Schema] = schema;
15070
- this[BaseName] = baseName;
15071
- }
15072
- }
15073
-
15074
15064
  // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/column.js
15075
15065
  class Column {
15076
15066
  constructor(table, config2) {
@@ -15177,6 +15167,9 @@ class ColumnBuilder {
15177
15167
  }
15178
15168
  }
15179
15169
 
15170
+ // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/table.utils.js
15171
+ var TableName = Symbol.for("drizzle:Name");
15172
+
15180
15173
  // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/tracing-utils.js
15181
15174
  function iife(fn, ...args) {
15182
15175
  return fn(...args);
@@ -15314,6 +15307,44 @@ var tracer = {
15314
15307
  // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/view-common.js
15315
15308
  var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
15316
15309
 
15310
+ // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/table.js
15311
+ var Schema = Symbol.for("drizzle:Schema");
15312
+ var Columns = Symbol.for("drizzle:Columns");
15313
+ var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
15314
+ var OriginalName = Symbol.for("drizzle:OriginalName");
15315
+ var BaseName = Symbol.for("drizzle:BaseName");
15316
+ var IsAlias = Symbol.for("drizzle:IsAlias");
15317
+ var ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
15318
+ var IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
15319
+
15320
+ class Table {
15321
+ static [entityKind] = "Table";
15322
+ static Symbol = {
15323
+ Name: TableName,
15324
+ Schema,
15325
+ OriginalName,
15326
+ Columns,
15327
+ ExtraConfigColumns,
15328
+ BaseName,
15329
+ IsAlias,
15330
+ ExtraConfigBuilder
15331
+ };
15332
+ [TableName];
15333
+ [OriginalName];
15334
+ [Schema];
15335
+ [Columns];
15336
+ [ExtraConfigColumns];
15337
+ [BaseName];
15338
+ [IsAlias] = false;
15339
+ [IsDrizzleTable] = true;
15340
+ [ExtraConfigBuilder] = undefined;
15341
+ constructor(name, schema, baseName) {
15342
+ this[TableName] = this[OriginalName] = name;
15343
+ this[Schema] = schema;
15344
+ this[BaseName] = baseName;
15345
+ }
15346
+ }
15347
+
15317
15348
  // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/sql/sql.js
15318
15349
  function isSQLWrapper(value) {
15319
15350
  return value !== null && value !== undefined && typeof value.getSQL === "function";
@@ -15683,6 +15714,31 @@ function getColumnNameAndConfig(a, b) {
15683
15714
  }
15684
15715
  var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder;
15685
15716
 
15717
+ // ../shared/src/db/community-schema.ts
15718
+ var exports_community_schema = {};
15719
+ __export(exports_community_schema, {
15720
+ communityUserProfile: () => communityUserProfile,
15721
+ communityServerMember: () => communityServerMember,
15722
+ communityServerInvite: () => communityServerInvite,
15723
+ communityServerFolderItem: () => communityServerFolderItem,
15724
+ communityServerFolder: () => communityServerFolder,
15725
+ communityServer: () => communityServer,
15726
+ communityReadState: () => communityReadState,
15727
+ communityReaction: () => communityReaction,
15728
+ communityPin: () => communityPin,
15729
+ communityNotificationSetting: () => communityNotificationSetting,
15730
+ communityMessageSeq: () => communityMessageSeq,
15731
+ communityMessage: () => communityMessage,
15732
+ communityMention: () => communityMention,
15733
+ communityFriendship: () => communityFriendship,
15734
+ communityDmConversation: () => communityDmConversation,
15735
+ communityChannel: () => communityChannel,
15736
+ communityCategory: () => communityCategory,
15737
+ communityBotApprovalRequest: () => communityBotApprovalRequest,
15738
+ communityAuditLog: () => communityAuditLog,
15739
+ communityAttachment: () => communityAttachment
15740
+ });
15741
+
15686
15742
  // ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/sqlite-core/foreign-keys.js
15687
15743
  class ForeignKeyBuilder {
15688
15744
  static [entityKind] = "SQLiteForeignKeyBuilder";
@@ -16351,6 +16407,9 @@ class PrimaryKey {
16351
16407
  }
16352
16408
  }
16353
16409
 
16410
+ // ../shared/src/db/community-schema.ts
16411
+ init_nanoid();
16412
+
16354
16413
  // ../shared/src/db/schema.ts
16355
16414
  var exports_schema = {};
16356
16415
  __export(exports_schema, {
@@ -16940,30 +16999,6 @@ var inboxUnread = sqliteTable("inbox_unread", {
16940
16999
  ]);
16941
17000
 
16942
17001
  // ../shared/src/db/community-schema.ts
16943
- var exports_community_schema = {};
16944
- __export(exports_community_schema, {
16945
- communityUserProfile: () => communityUserProfile,
16946
- communityServerMember: () => communityServerMember,
16947
- communityServerInvite: () => communityServerInvite,
16948
- communityServerFolderItem: () => communityServerFolderItem,
16949
- communityServerFolder: () => communityServerFolder,
16950
- communityServer: () => communityServer,
16951
- communityReadState: () => communityReadState,
16952
- communityReaction: () => communityReaction,
16953
- communityPin: () => communityPin,
16954
- communityNotificationSetting: () => communityNotificationSetting,
16955
- communityMessage: () => communityMessage,
16956
- communityMention: () => communityMention,
16957
- communityInboxDismissal: () => communityInboxDismissal,
16958
- communityFriendship: () => communityFriendship,
16959
- communityDmConversation: () => communityDmConversation,
16960
- communityChannel: () => communityChannel,
16961
- communityCategory: () => communityCategory,
16962
- communityBotApprovalRequest: () => communityBotApprovalRequest,
16963
- communityAuditLog: () => communityAuditLog,
16964
- communityAttachment: () => communityAttachment
16965
- });
16966
- init_nanoid();
16967
17002
  var communityServer = sqliteTable("community_server", {
16968
17003
  id: text("id").primaryKey().$defaultFn(() => nanoid3()),
16969
17004
  name: text("name").notNull(),
@@ -17029,12 +17064,17 @@ var communityMessage = sqliteTable("community_message", {
17029
17064
  channelId: text("channel_id").references(() => communityChannel.id, {
17030
17065
  onDelete: "cascade"
17031
17066
  }),
17032
- dmConversationId: text("dm_conversation_id").references(() => communityDmConversation.id, { onDelete: "cascade" })
17067
+ dmConversationId: text("dm_conversation_id").references(() => communityDmConversation.id, { onDelete: "cascade" }),
17068
+ seq: integer2("seq").notNull().default(0)
17033
17069
  }, (t) => [
17034
17070
  index("idx_message_channel_created").on(t.channelId, t.createdAt),
17035
17071
  index("idx_message_channel_mention_created").on(t.channelId, t.mentionType, t.createdAt),
17036
17072
  index("idx_message_dm_created").on(t.dmConversationId, t.createdAt)
17037
17073
  ]);
17074
+ var communityMessageSeq = sqliteTable("community_message_seq", {
17075
+ scopeKey: text("scope_key").primaryKey(),
17076
+ nextSeq: integer2("next_seq").notNull()
17077
+ });
17038
17078
  var communityServerMember = sqliteTable("community_server_member", {
17039
17079
  id: text("id").primaryKey().$defaultFn(() => nanoid3()),
17040
17080
  serverId: text("server_id").notNull().references(() => communityServer.id, { onDelete: "cascade" }),
@@ -17093,7 +17133,8 @@ var communityReadState = sqliteTable("community_read_state", {
17093
17133
  }),
17094
17134
  dmConversationId: text("dm_conversation_id").references(() => communityDmConversation.id, { onDelete: "cascade" }),
17095
17135
  lastReadAt: text("last_read_at").notNull(),
17096
- lastReadMessageId: text("last_read_message_id")
17136
+ lastReadMessageId: text("last_read_message_id"),
17137
+ lastReadSeq: integer2("last_read_seq").notNull().default(0)
17097
17138
  }, (t) => [index("idx_read_state_user").on(t.userId)]);
17098
17139
  var communityReaction = sqliteTable("community_reaction", {
17099
17140
  id: text("id").primaryKey().$defaultFn(() => nanoid3()),
@@ -17182,15 +17223,89 @@ var communityBotApprovalRequest = sqliteTable("community_bot_approval_request",
17182
17223
  createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),
17183
17224
  resolvedAt: text("resolved_at")
17184
17225
  }, (t) => [index("idx_community_bot_approval_bot").on(t.botId, t.status)]);
17185
- var communityInboxDismissal = sqliteTable("community_inbox_dismissal", {
17186
- id: text("id").primaryKey().$defaultFn(() => nanoid3()),
17187
- userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
17188
- eventKey: text("event_key").notNull(),
17189
- dismissedAt: text("dismissed_at").notNull().$defaultFn(() => new Date().toISOString())
17190
- }, (t) => [
17191
- unique("uq_inbox_dismissal_user_event").on(t.userId, t.eventKey),
17192
- index("idx_inbox_dismissal_user").on(t.userId)
17193
- ]);
17226
+
17227
+ // ../shared/src/logger.ts
17228
+ var LEVELS = {
17229
+ debug: 0,
17230
+ info: 1,
17231
+ warn: 2,
17232
+ error: 3,
17233
+ silent: 4
17234
+ };
17235
+
17236
+ class Logger {
17237
+ service;
17238
+ level;
17239
+ pretty;
17240
+ fields;
17241
+ constructor(opts, fields) {
17242
+ this.service = opts.service;
17243
+ this.level = LEVELS[opts.level ?? "info"];
17244
+ this.pretty = opts.pretty ?? false;
17245
+ this.fields = fields ?? {};
17246
+ }
17247
+ debug(msg, ctx) {
17248
+ this.write("debug", msg, ctx);
17249
+ }
17250
+ info(msg, ctx) {
17251
+ this.write("info", msg, ctx);
17252
+ }
17253
+ warn(msg, ctx) {
17254
+ this.write("warn", msg, ctx);
17255
+ }
17256
+ error(msg, ctx) {
17257
+ this.write("error", msg, ctx);
17258
+ }
17259
+ child(fields) {
17260
+ const merged = { ...this.fields, ...fields };
17261
+ const child = new Logger({ service: this.service, level: this.levelName(), pretty: this.pretty }, merged);
17262
+ return child;
17263
+ }
17264
+ levelName() {
17265
+ for (const [name, num] of Object.entries(LEVELS)) {
17266
+ if (num === this.level)
17267
+ return name;
17268
+ }
17269
+ return "info";
17270
+ }
17271
+ write(level, msg, ctx) {
17272
+ if (LEVELS[level] < this.level)
17273
+ return;
17274
+ const entry = {
17275
+ level,
17276
+ msg,
17277
+ service: this.service,
17278
+ ...this.fields,
17279
+ ...ctx,
17280
+ ts: new Date().toISOString()
17281
+ };
17282
+ for (const [k, v] of Object.entries(entry)) {
17283
+ if (v instanceof Error) {
17284
+ entry[k] = { message: v.message, stack: v.stack };
17285
+ }
17286
+ }
17287
+ let line;
17288
+ if (this.pretty) {
17289
+ const ts = entry.ts.replace("T", " ").replace("Z", "");
17290
+ const lvl = entry.level.toUpperCase().padEnd(5);
17291
+ const pairs = Object.entries(entry).filter(([k]) => k !== "level" && k !== "msg" && k !== "service" && k !== "ts").map(([k, v]) => `${k}=${typeof v === "object" ? JSON.stringify(v) : v}`).join(" ");
17292
+ line = `${ts} ${lvl} [${entry.service}] ${entry.msg}${pairs ? " " + pairs : ""}`;
17293
+ } else {
17294
+ line = JSON.stringify(entry);
17295
+ }
17296
+ if (level === "error") {
17297
+ console.error(line);
17298
+ } else {
17299
+ console.log(line);
17300
+ }
17301
+ }
17302
+ }
17303
+ function createLogger(opts) {
17304
+ return new Logger(opts);
17305
+ }
17306
+
17307
+ // ../shared/src/db/queries/community/message.ts
17308
+ var log = createLogger({ service: "community-queries" });
17194
17309
 
17195
17310
  // ../shared/src/db/community-machine-schema.ts
17196
17311
  var exports_community_machine_schema = {};
@@ -17266,6 +17381,16 @@ var communityAgentRunnerKey = sqliteTable("community_agent_runner_key", {
17266
17381
  index("idx_community_agent_runner_key_machine_agent").on(t.machineId, t.agentId)
17267
17382
  ]);
17268
17383
 
17384
+ // ../shared/src/db/queries/community/agent-inbox.ts
17385
+ var AGENT_MESSAGE_COLUMNS = {
17386
+ id: communityMessage.id,
17387
+ authorId: communityMessage.authorId,
17388
+ content: communityMessage.content,
17389
+ createdAt: communityMessage.createdAt,
17390
+ channelId: communityMessage.channelId,
17391
+ dmConversationId: communityMessage.dmConversationId,
17392
+ seq: communityMessage.seq
17393
+ };
17269
17394
  // ../shared/src/db/index.ts
17270
17395
  var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema };
17271
17396
  // ../shared/src/db/queries/user.ts
@@ -17310,88 +17435,8 @@ var RESERVED_HANDLES = new Set([
17310
17435
  function toAlookAddress(h) {
17311
17436
  return `${h}${DOMAIN}`;
17312
17437
  }
17313
- // ../shared/src/logger.ts
17314
- var LEVELS = {
17315
- debug: 0,
17316
- info: 1,
17317
- warn: 2,
17318
- error: 3,
17319
- silent: 4
17320
- };
17321
-
17322
- class Logger {
17323
- service;
17324
- level;
17325
- pretty;
17326
- fields;
17327
- constructor(opts, fields) {
17328
- this.service = opts.service;
17329
- this.level = LEVELS[opts.level ?? "info"];
17330
- this.pretty = opts.pretty ?? false;
17331
- this.fields = fields ?? {};
17332
- }
17333
- debug(msg, ctx) {
17334
- this.write("debug", msg, ctx);
17335
- }
17336
- info(msg, ctx) {
17337
- this.write("info", msg, ctx);
17338
- }
17339
- warn(msg, ctx) {
17340
- this.write("warn", msg, ctx);
17341
- }
17342
- error(msg, ctx) {
17343
- this.write("error", msg, ctx);
17344
- }
17345
- child(fields) {
17346
- const merged = { ...this.fields, ...fields };
17347
- const child = new Logger({ service: this.service, level: this.levelName(), pretty: this.pretty }, merged);
17348
- return child;
17349
- }
17350
- levelName() {
17351
- for (const [name, num] of Object.entries(LEVELS)) {
17352
- if (num === this.level)
17353
- return name;
17354
- }
17355
- return "info";
17356
- }
17357
- write(level, msg, ctx) {
17358
- if (LEVELS[level] < this.level)
17359
- return;
17360
- const entry = {
17361
- level,
17362
- msg,
17363
- service: this.service,
17364
- ...this.fields,
17365
- ...ctx,
17366
- ts: new Date().toISOString()
17367
- };
17368
- for (const [k, v] of Object.entries(entry)) {
17369
- if (v instanceof Error) {
17370
- entry[k] = { message: v.message, stack: v.stack };
17371
- }
17372
- }
17373
- let line;
17374
- if (this.pretty) {
17375
- const ts = entry.ts.replace("T", " ").replace("Z", "");
17376
- const lvl = entry.level.toUpperCase().padEnd(5);
17377
- const pairs = Object.entries(entry).filter(([k]) => k !== "level" && k !== "msg" && k !== "service" && k !== "ts").map(([k, v]) => `${k}=${typeof v === "object" ? JSON.stringify(v) : v}`).join(" ");
17378
- line = `${ts} ${lvl} [${entry.service}] ${entry.msg}${pairs ? " " + pairs : ""}`;
17379
- } else {
17380
- line = JSON.stringify(entry);
17381
- }
17382
- if (level === "error") {
17383
- console.error(line);
17384
- } else {
17385
- console.log(line);
17386
- }
17387
- }
17388
- }
17389
- function createLogger(opts) {
17390
- return new Logger(opts);
17391
- }
17392
-
17393
17438
  // ../shared/src/db/queries/community/channel.ts
17394
- var log = createLogger({ service: "community-queries" });
17439
+ var log2 = createLogger({ service: "community-queries" });
17395
17440
  var CHANNEL_COLUMNS = {
17396
17441
  id: communityChannel.id,
17397
17442
  serverId: communityChannel.serverId,
@@ -17409,8 +17454,6 @@ var CHANNEL_COLUMNS = {
17409
17454
  lastMessageAt: communityChannel.lastMessageAt,
17410
17455
  createdAt: communityChannel.createdAt
17411
17456
  };
17412
- // ../shared/src/db/queries/community/message.ts
17413
- var log2 = createLogger({ service: "community-queries" });
17414
17457
  // ../shared/src/db/queries/community/search.ts
17415
17458
  var FTS_KEYWORDS = new Set(["and", "or", "not", "near"]);
17416
17459
  // ../shared/src/mode.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alook/cli",
3
- "version": "0.0.150",
3
+ "version": "0.0.151",
4
4
  "description": "Alook CLI — Enable Your Person Colleague",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/alookai/alook#readme",