@alook/cli 0.0.151 → 0.0.152

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
@@ -189,6 +189,8 @@ var TERMINAL_ISSUE_STATUSES = [
189
189
  ];
190
190
  var POLL_INTERVAL_MS = Number(process.env.POLL_INTERVAL_MS) || 3000;
191
191
  var OFFLINE_THRESHOLD_MS = Number(process.env.OFFLINE_THRESHOLD_MS) || 30000;
192
+ var COMMUNITY_MACHINE_HEARTBEAT_MS = 30000;
193
+ var COMMUNITY_MACHINE_OFFLINE_THRESHOLD_MS = 3 * COMMUNITY_MACHINE_HEARTBEAT_MS;
192
194
  var COMMUNITY_MACHINE_PAIR_TOKEN_TTL_MS = 15 * 60000;
193
195
  var EVENT_POLL_INTERVAL_MS = Number(process.env.EVENT_POLL_INTERVAL_MS) || 2000;
194
196
  var MeetingStatus = {
@@ -225,6 +227,7 @@ function devWsDoPort() {
225
227
  var MAX_MESSAGE_CONTENT_LENGTH = 4000;
226
228
  var MAX_ATTACHMENT_SIZE_BYTES = 25 * 1024 * 1024;
227
229
  var MAX_SERVER_ICON_SIZE_BYTES = 5 * 1024 * 1024;
230
+ var MAX_ICON_SOURCE_FILE_SIZE_BYTES = 15 * 1024 * 1024;
228
231
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
229
232
  var exports_external = {};
230
233
  __export(exports_external, {
@@ -15055,6 +15058,11 @@ var SessionErrorFrameSchema = exports_external.object({
15055
15058
  agentId: exports_external.string().optional(),
15056
15059
  payload: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
15057
15060
  });
15061
+ var AgentActivityMessageSchema = exports_external.object({
15062
+ type: exports_external.literal("agent_activity"),
15063
+ agentId: exports_external.string(),
15064
+ state: exports_external.enum(["idle", "starting", "running", "stopping"])
15065
+ });
15058
15066
  var CommunityPairTokenResponseSchema = exports_external.object({
15059
15067
  tokenId: exports_external.string(),
15060
15068
  expiresAt: exports_external.string()
@@ -15079,8 +15087,9 @@ var CommunityDaemonEnrollAgentResponseSchema = exports_external.object({
15079
15087
  runnerKey: exports_external.string(),
15080
15088
  expiresAt: exports_external.string().nullable()
15081
15089
  });
15082
- var BotImageUrlSchema = exports_external.string().max(COMMUNITY_BOT_IMAGE_URL_MAX).refine((v) => v.startsWith("https://") || v.startsWith("avatar:"), {
15083
- message: "image must be an https URL or an avatar: config"
15090
+ var BOT_AVATAR_ROUTE_PATTERN = /^\/api\/community\/bots\/[A-Za-z0-9_-]+\/avatar$/;
15091
+ var BotImageUrlSchema = exports_external.string().max(COMMUNITY_BOT_IMAGE_URL_MAX).refine((v) => v.startsWith("https://") || v.startsWith("avatar:") || BOT_AVATAR_ROUTE_PATTERN.test(v), {
15092
+ message: "image must be an https URL, the bot avatar route, or an avatar: config"
15084
15093
  });
15085
15094
  var CommunityBotCreateRequestSchema = exports_external.object({
15086
15095
  name: exports_external.string().trim().min(COMMUNITY_BOT_NAME_MIN).max(COMMUNITY_BOT_NAME_MAX),
@@ -15131,6 +15140,40 @@ var CommunityAgentResolveRequestSchema = exports_external.object({
15131
15140
  var CommunityAgentListChannelsRequestSchema = exports_external.object({
15132
15141
  server: exports_external.string().min(1).optional()
15133
15142
  });
15143
+ var CommunityAgentListMembersRequestSchema = exports_external.object({
15144
+ server: exports_external.string().min(1)
15145
+ });
15146
+ var CommunityAgentJoinServerRequestSchema = exports_external.object({
15147
+ invite: exports_external.string().min(1)
15148
+ });
15149
+ var AuditLogCliInvocationPayloadSchema = exports_external.object({
15150
+ subcommand: exports_external.string().min(1)
15151
+ });
15152
+ var AuditLogToolCallPayloadSchema = exports_external.object({
15153
+ name: exports_external.string().min(1)
15154
+ });
15155
+ var AuditLogThinkingPayloadSchema = exports_external.object({
15156
+ text: exports_external.string(),
15157
+ truncated: exports_external.boolean(),
15158
+ chars: exports_external.number().int().nonnegative()
15159
+ });
15160
+ var BotAuditEventSchema = exports_external.discriminatedUnion("kind", [
15161
+ exports_external.object({ kind: exports_external.literal("cli_invocation"), payload: AuditLogCliInvocationPayloadSchema }),
15162
+ exports_external.object({ kind: exports_external.literal("tool_call"), payload: AuditLogToolCallPayloadSchema }),
15163
+ exports_external.object({ kind: exports_external.literal("thinking"), payload: AuditLogThinkingPayloadSchema })
15164
+ ]);
15165
+ var BotAuditEventKindSchema = exports_external.enum([
15166
+ "cli_invocation",
15167
+ "tool_call",
15168
+ "thinking"
15169
+ ]);
15170
+ var HostBotAuditEventFrameSchema = exports_external.object({
15171
+ type: exports_external.literal("bot_audit_event"),
15172
+ agentId: exports_external.string().min(1),
15173
+ sessionId: exports_external.string().nullable().optional(),
15174
+ launchId: exports_external.string().nullable().optional(),
15175
+ event: BotAuditEventSchema
15176
+ });
15134
15177
  // ../../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
15135
15178
  var entityKind = Symbol.for("drizzle:entityKind");
15136
15179
  var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
@@ -15813,6 +15856,7 @@ var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder;
15813
15856
  var exports_community_schema = {};
15814
15857
  __export(exports_community_schema, {
15815
15858
  communityUserProfile: () => communityUserProfile,
15859
+ communityThreadParticipant: () => communityThreadParticipant,
15816
15860
  communityServerMember: () => communityServerMember,
15817
15861
  communityServerInvite: () => communityServerInvite,
15818
15862
  communityServerFolderItem: () => communityServerFolderItem,
@@ -15827,9 +15871,11 @@ __export(exports_community_schema, {
15827
15871
  communityMention: () => communityMention,
15828
15872
  communityFriendship: () => communityFriendship,
15829
15873
  communityDmConversation: () => communityDmConversation,
15874
+ communityChannelMember: () => communityChannelMember,
15830
15875
  communityChannel: () => communityChannel,
15831
15876
  communityCategory: () => communityCategory,
15832
15877
  communityBotApprovalRequest: () => communityBotApprovalRequest,
15878
+ communityBotActivityEvent: () => communityBotActivityEvent,
15833
15879
  communityAuditLog: () => communityAuditLog,
15834
15880
  communityAttachment: () => communityAttachment
15835
15881
  });
@@ -16553,7 +16599,7 @@ var user = sqliteTable("user", {
16553
16599
  createdAt: text("createdAt").notNull().$defaultFn(() => new Date().toISOString()),
16554
16600
  updatedAt: text("updatedAt").notNull().$defaultFn(() => new Date().toISOString()),
16555
16601
  isBot: integer2("isBot", { mode: "boolean" }).notNull().default(false),
16556
- ownerUserId: text("ownerUserId"),
16602
+ ownerUserId: text("ownerUserId").references(() => user.id, { onDelete: "no action" }),
16557
16603
  deletedAt: text("deletedAt"),
16558
16604
  discriminator: text("discriminator").notNull().default("0000")
16559
16605
  }, (t) => [index("idx_user_ownerUserId_isBot").on(t.ownerUserId, t.isBot)]);
@@ -17135,6 +17181,26 @@ var communityChannel = sqliteTable("community_channel", {
17135
17181
  index("idx_channel_server_last_message").on(t.serverId, t.lastMessageAt),
17136
17182
  index("idx_channel_parent").on(t.parentChannelId)
17137
17183
  ]);
17184
+ var communityChannelMember = sqliteTable("community_channel_member", {
17185
+ id: text("id").primaryKey().$defaultFn(() => nanoid3()),
17186
+ channelId: text("channel_id").notNull().references(() => communityChannel.id, { onDelete: "cascade" }),
17187
+ userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
17188
+ addedBy: text("added_by").references(() => user.id, { onDelete: "set null" }),
17189
+ addedAt: text("added_at").notNull().$defaultFn(() => new Date().toISOString())
17190
+ }, (t) => [
17191
+ unique("uq_channel_member").on(t.channelId, t.userId),
17192
+ index("idx_channel_member_user").on(t.userId)
17193
+ ]);
17194
+ var communityThreadParticipant = sqliteTable("community_thread_participant", {
17195
+ id: text("id").primaryKey().$defaultFn(() => nanoid3()),
17196
+ threadChannelId: text("thread_channel_id").notNull().references(() => communityChannel.id, { onDelete: "cascade" }),
17197
+ userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
17198
+ source: text("source").notNull().default("mention"),
17199
+ addedAt: text("added_at").notNull().$defaultFn(() => new Date().toISOString())
17200
+ }, (t) => [
17201
+ unique("uq_thread_participant").on(t.threadChannelId, t.userId),
17202
+ index("idx_thread_participant_user").on(t.userId)
17203
+ ]);
17138
17204
  var communityDmConversation = sqliteTable("community_dm_conversation", {
17139
17205
  id: text("id").primaryKey().$defaultFn(() => nanoid3()),
17140
17206
  user1Id: text("user1_id").references(() => user.id, { onDelete: "set null" }),
@@ -17275,7 +17341,9 @@ var communityMention = sqliteTable("community_mention", {
17275
17341
  var communityUserProfile = sqliteTable("community_user_profile", {
17276
17342
  userId: text("user_id").primaryKey().references(() => user.id, { onDelete: "cascade" }),
17277
17343
  aboutMe: text("about_me").default(""),
17278
- bannerColor: text("banner_color")
17344
+ bannerColor: text("banner_color"),
17345
+ statusEmoji: text("status_emoji"),
17346
+ statusText: text("status_text").default("")
17279
17347
  });
17280
17348
  var communityNotificationSetting = sqliteTable("community_notification_setting", {
17281
17349
  id: text("id").primaryKey().$defaultFn(() => nanoid3()),
@@ -17318,6 +17386,17 @@ var communityBotApprovalRequest = sqliteTable("community_bot_approval_request",
17318
17386
  createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),
17319
17387
  resolvedAt: text("resolved_at")
17320
17388
  }, (t) => [index("idx_community_bot_approval_bot").on(t.botId, t.status)]);
17389
+ var communityBotActivityEvent = sqliteTable("community_bot_activity_event", {
17390
+ id: text("id").primaryKey().$defaultFn(() => "bae_" + nanoid3()),
17391
+ botId: text("bot_id").notNull().references(() => user.id, { onDelete: "cascade" }),
17392
+ sessionId: text("session_id"),
17393
+ launchId: text("launch_id"),
17394
+ kind: text("kind").notNull(),
17395
+ payload: text("payload").notNull(),
17396
+ createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
17397
+ }, (t) => [
17398
+ index("idx_bot_activity_event_bot_created").on(t.botId, t.createdAt, t.id)
17399
+ ]);
17321
17400
 
17322
17401
  // ../shared/src/logger.ts
17323
17402
  var LEVELS = {
@@ -17401,6 +17480,22 @@ function createLogger(opts) {
17401
17480
 
17402
17481
  // ../shared/src/db/queries/community/message.ts
17403
17482
  var log = createLogger({ service: "community-queries" });
17483
+ var listedMessageProjection = {
17484
+ id: communityMessage.id,
17485
+ authorId: communityMessage.authorId,
17486
+ content: communityMessage.content,
17487
+ type: communityMessage.type,
17488
+ mentionType: communityMessage.mentionType,
17489
+ replyToId: communityMessage.replyToId,
17490
+ embeds: communityMessage.embeds,
17491
+ flags: communityMessage.flags,
17492
+ createdAt: communityMessage.createdAt,
17493
+ channelId: communityMessage.channelId,
17494
+ dmConversationId: communityMessage.dmConversationId,
17495
+ authorName: user.name,
17496
+ authorEmail: user.email,
17497
+ authorImage: user.image
17498
+ };
17404
17499
 
17405
17500
  // ../shared/src/db/community-machine-schema.ts
17406
17501
  var exports_community_machine_schema = {};
@@ -17476,18 +17571,6 @@ var communityAgentRunnerKey = sqliteTable("community_agent_runner_key", {
17476
17571
  index("idx_community_agent_runner_key_machine_agent").on(t.machineId, t.agentId)
17477
17572
  ]);
17478
17573
 
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
- };
17489
- // ../shared/src/db/index.ts
17490
- var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema };
17491
17574
  // ../shared/src/db/queries/user.ts
17492
17575
  var publicUserColumns = {
17493
17576
  id: user.id,
@@ -17505,6 +17588,53 @@ var internalUserColumns = {
17505
17588
  ownerUserId: user.ownerUserId,
17506
17589
  deletedAt: user.deletedAt
17507
17590
  };
17591
+
17592
+ // ../shared/src/db/queries/community/channel.ts
17593
+ var log2 = createLogger({ service: "community-queries" });
17594
+ var CHANNEL_COLUMNS = {
17595
+ id: communityChannel.id,
17596
+ serverId: communityChannel.serverId,
17597
+ categoryId: communityChannel.categoryId,
17598
+ name: communityChannel.name,
17599
+ type: communityChannel.type,
17600
+ topic: communityChannel.topic,
17601
+ position: communityChannel.position,
17602
+ forumTags: communityChannel.forumTags,
17603
+ parentChannelId: communityChannel.parentChannelId,
17604
+ creatorId: communityChannel.creatorId,
17605
+ messageCount: communityChannel.messageCount,
17606
+ archived: communityChannel.archived,
17607
+ parentMessageId: communityChannel.parentMessageId,
17608
+ lastMessageAt: communityChannel.lastMessageAt,
17609
+ createdAt: communityChannel.createdAt
17610
+ };
17611
+
17612
+ // ../shared/src/db/queries/community/agent-inbox.ts
17613
+ var AGENT_MESSAGE_COLUMNS = {
17614
+ id: communityMessage.id,
17615
+ authorId: communityMessage.authorId,
17616
+ content: communityMessage.content,
17617
+ createdAt: communityMessage.createdAt,
17618
+ channelId: communityMessage.channelId,
17619
+ dmConversationId: communityMessage.dmConversationId,
17620
+ seq: communityMessage.seq
17621
+ };
17622
+ // ../shared/src/community/bot-activity-presets.ts
17623
+ var BOT_ACTIVITY_PRESETS = {
17624
+ idle: { emoji: "\uD83D\uDCA4", text: "Idle" },
17625
+ starting: { emoji: "\uD83C\uDF00", text: "Waking up" },
17626
+ stopping: { emoji: "\uD83C\uDF19", text: "Wrapping up" }
17627
+ };
17628
+ var RUNNING_PRESETS = [
17629
+ { emoji: "⚡", text: "Working on it" },
17630
+ { emoji: "\uD83D\uDEE0️", text: "Cooking" },
17631
+ { emoji: "\uD83E\uDDE0", text: "Thinking hard" },
17632
+ { emoji: "\uD83D\uDD27", text: "Tinkering" },
17633
+ { emoji: "\uD83D\uDE80", text: "On it" },
17634
+ { emoji: "\uD83D\uDD25", text: "In the zone" }
17635
+ ];
17636
+ // ../shared/src/db/index.ts
17637
+ var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema };
17508
17638
  // ../shared/src/db/queries/task.ts
17509
17639
  var DEFAULT_STALE_SECONDS = Number(process.env.ALOOK_STALE_DISPATCH_TIMEOUT_S) || 20;
17510
17640
  var DEFAULT_STALE_RUNNING_SECONDS = Number(process.env.ALOOK_STALE_RUNNING_TIMEOUT_S) || 3600;
@@ -17530,27 +17660,15 @@ var RESERVED_HANDLES = new Set([
17530
17660
  function toAlookAddress(h) {
17531
17661
  return `${h}${DOMAIN}`;
17532
17662
  }
17533
- // ../shared/src/db/queries/community/channel.ts
17534
- var log2 = createLogger({ service: "community-queries" });
17535
- var CHANNEL_COLUMNS = {
17536
- id: communityChannel.id,
17537
- serverId: communityChannel.serverId,
17538
- categoryId: communityChannel.categoryId,
17539
- name: communityChannel.name,
17540
- type: communityChannel.type,
17541
- topic: communityChannel.topic,
17542
- position: communityChannel.position,
17543
- forumTags: communityChannel.forumTags,
17544
- parentChannelId: communityChannel.parentChannelId,
17545
- creatorId: communityChannel.creatorId,
17546
- messageCount: communityChannel.messageCount,
17547
- archived: communityChannel.archived,
17548
- parentMessageId: communityChannel.parentMessageId,
17549
- lastMessageAt: communityChannel.lastMessageAt,
17550
- createdAt: communityChannel.createdAt
17551
- };
17552
17663
  // ../shared/src/db/queries/community/search.ts
17553
17664
  var FTS_KEYWORDS = new Set(["and", "or", "not", "near"]);
17665
+ // ../shared/src/db/queries/community/machine.ts
17666
+ var BOT_ACTIVITY_STATUS_PAIRS = [
17667
+ BOT_ACTIVITY_PRESETS.idle,
17668
+ BOT_ACTIVITY_PRESETS.starting,
17669
+ BOT_ACTIVITY_PRESETS.stopping,
17670
+ ...RUNNING_PRESETS
17671
+ ];
17554
17672
  // ../shared/src/semver.ts
17555
17673
  function semverGte(a, b) {
17556
17674
  const pa = a.split(".").map(Number);
@@ -18153,23 +18271,15 @@ function isAlive(pid) {
18153
18271
  }
18154
18272
  }
18155
18273
  function signalTree(pid, signal) {
18156
- if (isPosix) {
18157
- try {
18158
- process.kill(-pid, signal);
18159
- return;
18160
- } catch (e) {
18161
- const code = e?.code;
18162
- if (code === "ESRCH")
18163
- return;
18164
- }
18165
- }
18166
18274
  if (!isPosix) {
18167
18275
  try {
18168
18276
  execSync(`taskkill /PID ${pid} /T /F`, { stdio: "ignore" });
18169
- return;
18170
18277
  } catch {}
18171
18278
  return;
18172
18279
  }
18280
+ try {
18281
+ process.kill(-pid, signal);
18282
+ } catch {}
18173
18283
  try {
18174
18284
  process.kill(pid, signal);
18175
18285
  } catch {}
@@ -25547,7 +25657,7 @@ function syncCommand() {
25547
25657
  // commands/workspace.ts
25548
25658
  import { Command as Command13 } from "commander";
25549
25659
  import { readFileSync as readFileSync15 } from "fs";
25550
- function slugify2(name) {
25660
+ function slugify3(name) {
25551
25661
  return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 60);
25552
25662
  }
25553
25663
  function sleep4(ms) {
@@ -25571,7 +25681,7 @@ async function resolveWorkspaceId(client, configName) {
25571
25681
  }
25572
25682
  const wsName = configName || "Personal";
25573
25683
  try {
25574
- const newWs = await client.postJSON("/api/workspaces", { name: wsName, slug: slugify2(wsName) });
25684
+ const newWs = await client.postJSON("/api/workspaces", { name: wsName, slug: slugify3(wsName) });
25575
25685
  console.log(`Created workspace: ${newWs.name} (${newWs.id})`);
25576
25686
  return { workspaceId: newWs.id, created: true };
25577
25687
  } catch (err) {
@@ -25697,7 +25807,7 @@ Workspace initialized: ${res.studio.name || res.workspace.name}`);
25697
25807
  if (agents.length > 0) {
25698
25808
  console.log("Current workspace has existing agents. Creating a new workspace...");
25699
25809
  const wsName = opts.name || config2.name || "New Workspace";
25700
- const newWs = await targetClient.postJSON("/api/workspaces", { name: wsName, slug: slugify2(wsName) });
25810
+ const newWs = await targetClient.postJSON("/api/workspaces", { name: wsName, slug: slugify3(wsName) });
25701
25811
  targetWorkspaceId = newWs.id;
25702
25812
  targetClient = new APIClient(serverUrl, token, targetWorkspaceId);
25703
25813
  console.log(`Created workspace: ${newWs.name} (${newWs.id})`);
@@ -98,6 +98,8 @@ var TERMINAL_ISSUE_STATUSES = [
98
98
  ];
99
99
  var POLL_INTERVAL_MS = Number(process.env.POLL_INTERVAL_MS) || 3000;
100
100
  var OFFLINE_THRESHOLD_MS = Number(process.env.OFFLINE_THRESHOLD_MS) || 30000;
101
+ var COMMUNITY_MACHINE_HEARTBEAT_MS = 30000;
102
+ var COMMUNITY_MACHINE_OFFLINE_THRESHOLD_MS = 3 * COMMUNITY_MACHINE_HEARTBEAT_MS;
101
103
  var COMMUNITY_MACHINE_PAIR_TOKEN_TTL_MS = 15 * 60000;
102
104
  var EVENT_POLL_INTERVAL_MS = Number(process.env.EVENT_POLL_INTERVAL_MS) || 2000;
103
105
  var MeetingStatus = {
@@ -130,6 +132,7 @@ var DEV_WAKE_WORKER_URL = process.env.DEV_WAKE_WORKER_URL || `http://localhost:$
130
132
  var MAX_MESSAGE_CONTENT_LENGTH = 4000;
131
133
  var MAX_ATTACHMENT_SIZE_BYTES = 25 * 1024 * 1024;
132
134
  var MAX_SERVER_ICON_SIZE_BYTES = 5 * 1024 * 1024;
135
+ var MAX_ICON_SOURCE_FILE_SIZE_BYTES = 15 * 1024 * 1024;
133
136
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
134
137
  var exports_external = {};
135
138
  __export(exports_external, {
@@ -14960,6 +14963,11 @@ var SessionErrorFrameSchema = exports_external.object({
14960
14963
  agentId: exports_external.string().optional(),
14961
14964
  payload: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
14962
14965
  });
14966
+ var AgentActivityMessageSchema = exports_external.object({
14967
+ type: exports_external.literal("agent_activity"),
14968
+ agentId: exports_external.string(),
14969
+ state: exports_external.enum(["idle", "starting", "running", "stopping"])
14970
+ });
14963
14971
  var CommunityPairTokenResponseSchema = exports_external.object({
14964
14972
  tokenId: exports_external.string(),
14965
14973
  expiresAt: exports_external.string()
@@ -14984,8 +14992,9 @@ var CommunityDaemonEnrollAgentResponseSchema = exports_external.object({
14984
14992
  runnerKey: exports_external.string(),
14985
14993
  expiresAt: exports_external.string().nullable()
14986
14994
  });
14987
- var BotImageUrlSchema = exports_external.string().max(COMMUNITY_BOT_IMAGE_URL_MAX).refine((v) => v.startsWith("https://") || v.startsWith("avatar:"), {
14988
- message: "image must be an https URL or an avatar: config"
14995
+ var BOT_AVATAR_ROUTE_PATTERN = /^\/api\/community\/bots\/[A-Za-z0-9_-]+\/avatar$/;
14996
+ var BotImageUrlSchema = exports_external.string().max(COMMUNITY_BOT_IMAGE_URL_MAX).refine((v) => v.startsWith("https://") || v.startsWith("avatar:") || BOT_AVATAR_ROUTE_PATTERN.test(v), {
14997
+ message: "image must be an https URL, the bot avatar route, or an avatar: config"
14989
14998
  });
14990
14999
  var CommunityBotCreateRequestSchema = exports_external.object({
14991
15000
  name: exports_external.string().trim().min(COMMUNITY_BOT_NAME_MIN).max(COMMUNITY_BOT_NAME_MAX),
@@ -15036,6 +15045,40 @@ var CommunityAgentResolveRequestSchema = exports_external.object({
15036
15045
  var CommunityAgentListChannelsRequestSchema = exports_external.object({
15037
15046
  server: exports_external.string().min(1).optional()
15038
15047
  });
15048
+ var CommunityAgentListMembersRequestSchema = exports_external.object({
15049
+ server: exports_external.string().min(1)
15050
+ });
15051
+ var CommunityAgentJoinServerRequestSchema = exports_external.object({
15052
+ invite: exports_external.string().min(1)
15053
+ });
15054
+ var AuditLogCliInvocationPayloadSchema = exports_external.object({
15055
+ subcommand: exports_external.string().min(1)
15056
+ });
15057
+ var AuditLogToolCallPayloadSchema = exports_external.object({
15058
+ name: exports_external.string().min(1)
15059
+ });
15060
+ var AuditLogThinkingPayloadSchema = exports_external.object({
15061
+ text: exports_external.string(),
15062
+ truncated: exports_external.boolean(),
15063
+ chars: exports_external.number().int().nonnegative()
15064
+ });
15065
+ var BotAuditEventSchema = exports_external.discriminatedUnion("kind", [
15066
+ exports_external.object({ kind: exports_external.literal("cli_invocation"), payload: AuditLogCliInvocationPayloadSchema }),
15067
+ exports_external.object({ kind: exports_external.literal("tool_call"), payload: AuditLogToolCallPayloadSchema }),
15068
+ exports_external.object({ kind: exports_external.literal("thinking"), payload: AuditLogThinkingPayloadSchema })
15069
+ ]);
15070
+ var BotAuditEventKindSchema = exports_external.enum([
15071
+ "cli_invocation",
15072
+ "tool_call",
15073
+ "thinking"
15074
+ ]);
15075
+ var HostBotAuditEventFrameSchema = exports_external.object({
15076
+ type: exports_external.literal("bot_audit_event"),
15077
+ agentId: exports_external.string().min(1),
15078
+ sessionId: exports_external.string().nullable().optional(),
15079
+ launchId: exports_external.string().nullable().optional(),
15080
+ event: BotAuditEventSchema
15081
+ });
15039
15082
  // ../../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
15040
15083
  var entityKind = Symbol.for("drizzle:entityKind");
15041
15084
  var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
@@ -15718,6 +15761,7 @@ var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder;
15718
15761
  var exports_community_schema = {};
15719
15762
  __export(exports_community_schema, {
15720
15763
  communityUserProfile: () => communityUserProfile,
15764
+ communityThreadParticipant: () => communityThreadParticipant,
15721
15765
  communityServerMember: () => communityServerMember,
15722
15766
  communityServerInvite: () => communityServerInvite,
15723
15767
  communityServerFolderItem: () => communityServerFolderItem,
@@ -15732,9 +15776,11 @@ __export(exports_community_schema, {
15732
15776
  communityMention: () => communityMention,
15733
15777
  communityFriendship: () => communityFriendship,
15734
15778
  communityDmConversation: () => communityDmConversation,
15779
+ communityChannelMember: () => communityChannelMember,
15735
15780
  communityChannel: () => communityChannel,
15736
15781
  communityCategory: () => communityCategory,
15737
15782
  communityBotApprovalRequest: () => communityBotApprovalRequest,
15783
+ communityBotActivityEvent: () => communityBotActivityEvent,
15738
15784
  communityAuditLog: () => communityAuditLog,
15739
15785
  communityAttachment: () => communityAttachment
15740
15786
  });
@@ -16458,7 +16504,7 @@ var user = sqliteTable("user", {
16458
16504
  createdAt: text("createdAt").notNull().$defaultFn(() => new Date().toISOString()),
16459
16505
  updatedAt: text("updatedAt").notNull().$defaultFn(() => new Date().toISOString()),
16460
16506
  isBot: integer2("isBot", { mode: "boolean" }).notNull().default(false),
16461
- ownerUserId: text("ownerUserId"),
16507
+ ownerUserId: text("ownerUserId").references(() => user.id, { onDelete: "no action" }),
16462
16508
  deletedAt: text("deletedAt"),
16463
16509
  discriminator: text("discriminator").notNull().default("0000")
16464
16510
  }, (t) => [index("idx_user_ownerUserId_isBot").on(t.ownerUserId, t.isBot)]);
@@ -17040,6 +17086,26 @@ var communityChannel = sqliteTable("community_channel", {
17040
17086
  index("idx_channel_server_last_message").on(t.serverId, t.lastMessageAt),
17041
17087
  index("idx_channel_parent").on(t.parentChannelId)
17042
17088
  ]);
17089
+ var communityChannelMember = sqliteTable("community_channel_member", {
17090
+ id: text("id").primaryKey().$defaultFn(() => nanoid3()),
17091
+ channelId: text("channel_id").notNull().references(() => communityChannel.id, { onDelete: "cascade" }),
17092
+ userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
17093
+ addedBy: text("added_by").references(() => user.id, { onDelete: "set null" }),
17094
+ addedAt: text("added_at").notNull().$defaultFn(() => new Date().toISOString())
17095
+ }, (t) => [
17096
+ unique("uq_channel_member").on(t.channelId, t.userId),
17097
+ index("idx_channel_member_user").on(t.userId)
17098
+ ]);
17099
+ var communityThreadParticipant = sqliteTable("community_thread_participant", {
17100
+ id: text("id").primaryKey().$defaultFn(() => nanoid3()),
17101
+ threadChannelId: text("thread_channel_id").notNull().references(() => communityChannel.id, { onDelete: "cascade" }),
17102
+ userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
17103
+ source: text("source").notNull().default("mention"),
17104
+ addedAt: text("added_at").notNull().$defaultFn(() => new Date().toISOString())
17105
+ }, (t) => [
17106
+ unique("uq_thread_participant").on(t.threadChannelId, t.userId),
17107
+ index("idx_thread_participant_user").on(t.userId)
17108
+ ]);
17043
17109
  var communityDmConversation = sqliteTable("community_dm_conversation", {
17044
17110
  id: text("id").primaryKey().$defaultFn(() => nanoid3()),
17045
17111
  user1Id: text("user1_id").references(() => user.id, { onDelete: "set null" }),
@@ -17180,7 +17246,9 @@ var communityMention = sqliteTable("community_mention", {
17180
17246
  var communityUserProfile = sqliteTable("community_user_profile", {
17181
17247
  userId: text("user_id").primaryKey().references(() => user.id, { onDelete: "cascade" }),
17182
17248
  aboutMe: text("about_me").default(""),
17183
- bannerColor: text("banner_color")
17249
+ bannerColor: text("banner_color"),
17250
+ statusEmoji: text("status_emoji"),
17251
+ statusText: text("status_text").default("")
17184
17252
  });
17185
17253
  var communityNotificationSetting = sqliteTable("community_notification_setting", {
17186
17254
  id: text("id").primaryKey().$defaultFn(() => nanoid3()),
@@ -17223,6 +17291,17 @@ var communityBotApprovalRequest = sqliteTable("community_bot_approval_request",
17223
17291
  createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),
17224
17292
  resolvedAt: text("resolved_at")
17225
17293
  }, (t) => [index("idx_community_bot_approval_bot").on(t.botId, t.status)]);
17294
+ var communityBotActivityEvent = sqliteTable("community_bot_activity_event", {
17295
+ id: text("id").primaryKey().$defaultFn(() => "bae_" + nanoid3()),
17296
+ botId: text("bot_id").notNull().references(() => user.id, { onDelete: "cascade" }),
17297
+ sessionId: text("session_id"),
17298
+ launchId: text("launch_id"),
17299
+ kind: text("kind").notNull(),
17300
+ payload: text("payload").notNull(),
17301
+ createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
17302
+ }, (t) => [
17303
+ index("idx_bot_activity_event_bot_created").on(t.botId, t.createdAt, t.id)
17304
+ ]);
17226
17305
 
17227
17306
  // ../shared/src/logger.ts
17228
17307
  var LEVELS = {
@@ -17306,6 +17385,22 @@ function createLogger(opts) {
17306
17385
 
17307
17386
  // ../shared/src/db/queries/community/message.ts
17308
17387
  var log = createLogger({ service: "community-queries" });
17388
+ var listedMessageProjection = {
17389
+ id: communityMessage.id,
17390
+ authorId: communityMessage.authorId,
17391
+ content: communityMessage.content,
17392
+ type: communityMessage.type,
17393
+ mentionType: communityMessage.mentionType,
17394
+ replyToId: communityMessage.replyToId,
17395
+ embeds: communityMessage.embeds,
17396
+ flags: communityMessage.flags,
17397
+ createdAt: communityMessage.createdAt,
17398
+ channelId: communityMessage.channelId,
17399
+ dmConversationId: communityMessage.dmConversationId,
17400
+ authorName: user.name,
17401
+ authorEmail: user.email,
17402
+ authorImage: user.image
17403
+ };
17309
17404
 
17310
17405
  // ../shared/src/db/community-machine-schema.ts
17311
17406
  var exports_community_machine_schema = {};
@@ -17381,18 +17476,6 @@ var communityAgentRunnerKey = sqliteTable("community_agent_runner_key", {
17381
17476
  index("idx_community_agent_runner_key_machine_agent").on(t.machineId, t.agentId)
17382
17477
  ]);
17383
17478
 
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
- };
17394
- // ../shared/src/db/index.ts
17395
- var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema };
17396
17479
  // ../shared/src/db/queries/user.ts
17397
17480
  var publicUserColumns = {
17398
17481
  id: user.id,
@@ -17410,6 +17493,53 @@ var internalUserColumns = {
17410
17493
  ownerUserId: user.ownerUserId,
17411
17494
  deletedAt: user.deletedAt
17412
17495
  };
17496
+
17497
+ // ../shared/src/db/queries/community/channel.ts
17498
+ var log2 = createLogger({ service: "community-queries" });
17499
+ var CHANNEL_COLUMNS = {
17500
+ id: communityChannel.id,
17501
+ serverId: communityChannel.serverId,
17502
+ categoryId: communityChannel.categoryId,
17503
+ name: communityChannel.name,
17504
+ type: communityChannel.type,
17505
+ topic: communityChannel.topic,
17506
+ position: communityChannel.position,
17507
+ forumTags: communityChannel.forumTags,
17508
+ parentChannelId: communityChannel.parentChannelId,
17509
+ creatorId: communityChannel.creatorId,
17510
+ messageCount: communityChannel.messageCount,
17511
+ archived: communityChannel.archived,
17512
+ parentMessageId: communityChannel.parentMessageId,
17513
+ lastMessageAt: communityChannel.lastMessageAt,
17514
+ createdAt: communityChannel.createdAt
17515
+ };
17516
+
17517
+ // ../shared/src/db/queries/community/agent-inbox.ts
17518
+ var AGENT_MESSAGE_COLUMNS = {
17519
+ id: communityMessage.id,
17520
+ authorId: communityMessage.authorId,
17521
+ content: communityMessage.content,
17522
+ createdAt: communityMessage.createdAt,
17523
+ channelId: communityMessage.channelId,
17524
+ dmConversationId: communityMessage.dmConversationId,
17525
+ seq: communityMessage.seq
17526
+ };
17527
+ // ../shared/src/community/bot-activity-presets.ts
17528
+ var BOT_ACTIVITY_PRESETS = {
17529
+ idle: { emoji: "\uD83D\uDCA4", text: "Idle" },
17530
+ starting: { emoji: "\uD83C\uDF00", text: "Waking up" },
17531
+ stopping: { emoji: "\uD83C\uDF19", text: "Wrapping up" }
17532
+ };
17533
+ var RUNNING_PRESETS = [
17534
+ { emoji: "⚡", text: "Working on it" },
17535
+ { emoji: "\uD83D\uDEE0️", text: "Cooking" },
17536
+ { emoji: "\uD83E\uDDE0", text: "Thinking hard" },
17537
+ { emoji: "\uD83D\uDD27", text: "Tinkering" },
17538
+ { emoji: "\uD83D\uDE80", text: "On it" },
17539
+ { emoji: "\uD83D\uDD25", text: "In the zone" }
17540
+ ];
17541
+ // ../shared/src/db/index.ts
17542
+ var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema };
17413
17543
  // ../shared/src/db/queries/task.ts
17414
17544
  var DEFAULT_STALE_SECONDS = Number(process.env.ALOOK_STALE_DISPATCH_TIMEOUT_S) || 20;
17415
17545
  var DEFAULT_STALE_RUNNING_SECONDS = Number(process.env.ALOOK_STALE_RUNNING_TIMEOUT_S) || 3600;
@@ -17435,27 +17565,15 @@ var RESERVED_HANDLES = new Set([
17435
17565
  function toAlookAddress(h) {
17436
17566
  return `${h}${DOMAIN}`;
17437
17567
  }
17438
- // ../shared/src/db/queries/community/channel.ts
17439
- var log2 = createLogger({ service: "community-queries" });
17440
- var CHANNEL_COLUMNS = {
17441
- id: communityChannel.id,
17442
- serverId: communityChannel.serverId,
17443
- categoryId: communityChannel.categoryId,
17444
- name: communityChannel.name,
17445
- type: communityChannel.type,
17446
- topic: communityChannel.topic,
17447
- position: communityChannel.position,
17448
- forumTags: communityChannel.forumTags,
17449
- parentChannelId: communityChannel.parentChannelId,
17450
- creatorId: communityChannel.creatorId,
17451
- messageCount: communityChannel.messageCount,
17452
- archived: communityChannel.archived,
17453
- parentMessageId: communityChannel.parentMessageId,
17454
- lastMessageAt: communityChannel.lastMessageAt,
17455
- createdAt: communityChannel.createdAt
17456
- };
17457
17568
  // ../shared/src/db/queries/community/search.ts
17458
17569
  var FTS_KEYWORDS = new Set(["and", "or", "not", "near"]);
17570
+ // ../shared/src/db/queries/community/machine.ts
17571
+ var BOT_ACTIVITY_STATUS_PAIRS = [
17572
+ BOT_ACTIVITY_PRESETS.idle,
17573
+ BOT_ACTIVITY_PRESETS.starting,
17574
+ BOT_ACTIVITY_PRESETS.stopping,
17575
+ ...RUNNING_PRESETS
17576
+ ];
17459
17577
  // ../shared/src/mode.ts
17460
17578
  function isLocalUrl(url2) {
17461
17579
  try {
@@ -17770,23 +17888,15 @@ function isAlive(pid) {
17770
17888
  }
17771
17889
  }
17772
17890
  function signalTree(pid, signal) {
17773
- if (isPosix) {
17774
- try {
17775
- process.kill(-pid, signal);
17776
- return;
17777
- } catch (e) {
17778
- const code = e?.code;
17779
- if (code === "ESRCH")
17780
- return;
17781
- }
17782
- }
17783
17891
  if (!isPosix) {
17784
17892
  try {
17785
17893
  execSync(`taskkill /PID ${pid} /T /F`, { stdio: "ignore" });
17786
- return;
17787
17894
  } catch {}
17788
17895
  return;
17789
17896
  }
17897
+ try {
17898
+ process.kill(-pid, signal);
17899
+ } catch {}
17790
17900
  try {
17791
17901
  process.kill(pid, signal);
17792
17902
  } catch {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alook/cli",
3
- "version": "0.0.151",
3
+ "version": "0.0.152",
4
4
  "description": "Alook CLI — Enable Your Person Colleague",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/alookai/alook#readme",
@@ -56,10 +56,10 @@
56
56
  "devDependencies": {
57
57
  "@alook/shared": "workspace:*",
58
58
  "@types/bun": "^1.3.14",
59
- "eslint": "^10.3.0",
60
- "knip": "^6.24.0",
59
+ "eslint": "^9.39.5",
60
+ "knip": "^6.26.0",
61
61
  "typescript": "^6.0.3",
62
- "typescript-eslint": "^8.62.1",
63
- "vitest": "^4.1.9"
62
+ "typescript-eslint": "^8.64.0",
63
+ "vitest": "^4.1.10"
64
64
  }
65
65
  }