@alook/daemon 0.1.72 → 0.1.73

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
@@ -24679,8 +24679,7 @@ class AgyAcpLane {
24679
24679
  stop(input = {}) {
24680
24680
  this.requestedStopReason ??= input.reason ?? "requested_stop";
24681
24681
  this.ready = false;
24682
- if (this.activityTimer)
24683
- clearTimeout(this.activityTimer);
24682
+ this.clearActivityTimer();
24684
24683
  this.currentPromptRequestId = null;
24685
24684
  this.terminalOwner = null;
24686
24685
  this.toolCalls.clear();
@@ -24688,12 +24687,7 @@ class AgyAcpLane {
24688
24687
  this.promptOutcomes.clear();
24689
24688
  this.observedPrompts.clear();
24690
24689
  this.usage.reset();
24691
- const waiter = this.configWaiter;
24692
- if (waiter) {
24693
- clearTimeout(waiter.timer);
24694
- this.configWaiter = undefined;
24695
- waiter.reject(new Error("Antigravity CLI lane stopped"));
24696
- }
24690
+ this.rejectConfigWaiter(new Error("Antigravity CLI lane stopped"));
24697
24691
  this.stopPromise ??= this.stopPhysicalOnce(input);
24698
24692
  return this.stopPromise;
24699
24693
  }
@@ -25196,6 +25190,8 @@ class AgyAcpLane {
25196
25190
  }
25197
25191
  this.processTerminal = true;
25198
25192
  this.ready = false;
25193
+ this.clearActivityTimer();
25194
+ this.rejectConfigWaiter(normalized);
25199
25195
  this.currentPromptRequestId = null;
25200
25196
  this.terminalOwner = null;
25201
25197
  this.toolCalls.clear();
@@ -25215,10 +25211,13 @@ class AgyAcpLane {
25215
25211
  return;
25216
25212
  this.processTerminal = true;
25217
25213
  this.ready = false;
25214
+ this.clearActivityTimer();
25215
+ const exitError = new Error("Agy ACP process exited");
25216
+ this.rejectConfigWaiter(exitError);
25218
25217
  this.currentPromptRequestId = null;
25219
25218
  this.terminalOwner = null;
25220
25219
  this.toolCalls.clear();
25221
- this.rejectAllPending(new Error("Agy ACP process exited"));
25220
+ this.rejectAllPending(exitError);
25222
25221
  if (this.suppressExit || !this.processActivated)
25223
25222
  return;
25224
25223
  this.events.emit("exit", {
@@ -25503,8 +25502,22 @@ class AgyAcpLane {
25503
25502
  });
25504
25503
  return reading;
25505
25504
  }
25505
+ clearActivityTimer() {
25506
+ if (!this.activityTimer)
25507
+ return;
25508
+ clearTimeout(this.activityTimer);
25509
+ this.activityTimer = undefined;
25510
+ }
25511
+ rejectConfigWaiter(error) {
25512
+ const waiter = this.configWaiter;
25513
+ if (!waiter)
25514
+ return;
25515
+ clearTimeout(waiter.timer);
25516
+ this.configWaiter = undefined;
25517
+ waiter.reject(error);
25518
+ }
25506
25519
  scheduleActivity() {
25507
- if (!this.ready || this.requestedStopReason || this.processTerminal)
25520
+ if (!this.ready || this.requestedStopReason || this.processTerminal || this.activityTimer)
25508
25521
  return;
25509
25522
  this.activityTimer = setTimeout(() => {
25510
25523
  this.activityTimer = undefined;
@@ -60292,11 +60305,53 @@ var CommunityResourceBundleSchema = CommunityMessageResourcesSchema.safeExtend({
60292
60305
  if (channels.size !== bundle.channels.length || servers.size !== bundle.servers.length || new Set(categories.map((row) => row.id)).size !== categories.length || categories.some((row) => readableCategories.get(row.id) !== row.serverId) || new Set(dmPeers.map((row) => row.channelId)).size !== dmPeers.length || dmPeers.some((row) => !dmChannels.has(row.channelId) || row.userId === bundle.viewerId || !profiles.has(row.userId)) || new Set(bundle.messages.map((row) => row.id)).size !== bundle.messages.length || profiles.size !== bundle.profiles.length || new Set(bundle.memberships.map((row) => `${row.channelId}:${row.userId}:${row.relation}`)).size !== bundle.memberships.length || new Set(bundle.serverMemberships.map((row) => `${row.serverId}:${row.userId}`)).size !== bundle.serverMemberships.length || bundle.messages.some((row) => !channels.has(row.channelId)) || bundle.servers.some((row) => !bundle.serverMemberships.some((member) => member.serverId === row.id && member.userId === bundle.viewerId)) || bundle.channels.some((row) => !bundle.memberships.some((member) => member.channelId === row.id && member.userId === bundle.viewerId && member.relation === "access")) || bundle.channels.some((row) => row.serverId !== null && !servers.has(row.serverId) || row.parentChannelId !== null && !channels.has(row.parentChannelId)) || bundle.memberships.some((row) => row.userId !== bundle.viewerId || !channels.has(row.channelId)) || bundle.serverMemberships.some((row) => row.userId !== bundle.viewerId || !servers.has(row.serverId)))
60293
60306
  ctx.addIssue({ code: "custom", message: "Resource bundle scope mismatch" });
60294
60307
  });
60308
+ var CommunityResolvedChannelRefSchema = exports_external.discriminatedUnion("status", [
60309
+ exports_external.strictObject({
60310
+ ref: exports_external.string().min(1),
60311
+ status: exports_external.literal("ready"),
60312
+ serverId: id2,
60313
+ channelId: id2
60314
+ }),
60315
+ exports_external.strictObject({
60316
+ ref: exports_external.string().min(1),
60317
+ status: exports_external.enum(["forbidden", "missing"])
60318
+ })
60319
+ ]);
60320
+ var CommunityMessageRefsSchema = exports_external.strictObject({
60321
+ servers: exports_external.array(CommunityServerResourceSchema),
60322
+ channels: exports_external.array(CommunityChannelResourceSchema),
60323
+ resolvedRefs: exports_external.array(CommunityResolvedChannelRefSchema)
60324
+ }).superRefine((refs, ctx) => {
60325
+ const serverIds = new Set(refs.servers.map((row) => row.id));
60326
+ const channelById = new Map(refs.channels.map((row) => [row.id, row]));
60327
+ const refKeys = new Set(refs.resolvedRefs.map((row) => row.ref));
60328
+ if (serverIds.size !== refs.servers.length || channelById.size !== refs.channels.length || refKeys.size !== refs.resolvedRefs.length) {
60329
+ ctx.addIssue({ code: "custom", message: "Duplicated ref resource" });
60330
+ return;
60331
+ }
60332
+ for (const channel of refs.channels) {
60333
+ if (channel.serverId === null || !serverIds.has(channel.serverId)) {
60334
+ ctx.addIssue({ code: "custom", path: ["channels"], message: "Ref channel server missing" });
60335
+ }
60336
+ if (channel.parentChannelId !== null && !channelById.has(channel.parentChannelId)) {
60337
+ ctx.addIssue({ code: "custom", path: ["channels"], message: "Ref channel parent missing" });
60338
+ }
60339
+ }
60340
+ for (const resolved of refs.resolvedRefs) {
60341
+ if (resolved.status !== "ready")
60342
+ continue;
60343
+ const channel = channelById.get(resolved.channelId);
60344
+ if (!serverIds.has(resolved.serverId) || !channel || channel.serverId !== resolved.serverId) {
60345
+ ctx.addIssue({ code: "custom", path: ["resolvedRefs"], message: "Resolved ref target missing from resources" });
60346
+ }
60347
+ }
60348
+ });
60295
60349
  var CommunityChannelReadSchema = exports_external.strictObject({ ...envelope, channel: CommunityChannelResourceSchema, access: CommunityAccessDecisionSchema });
60296
60350
  var CommunityMessagesReadSchema = CommunityMessageResourcesSchema.safeExtend({
60297
60351
  ...envelope,
60298
60352
  page: CommunityPageSchema,
60299
60353
  relatedMessages: exports_external.array(CommunityMessageResourceSchema).optional(),
60354
+ refs: CommunityMessageRefsSchema.optional(),
60300
60355
  surfaceReceipt: exports_external.strictObject({ channelId: id2, surfaceKind: exports_external.enum(["channel", "forum", "thread", "dm"]) })
60301
60356
  }).superRefine(validateRelatedMessageGraph);
60302
60357
  var CommunityConversationEntryReadSchema = CommunityMessagesReadSchema.safeExtend({
@@ -60376,7 +60431,13 @@ var CommunityMessageReadSchema = exports_external.strictObject({
60376
60431
  validateRelatedMessageGraph({ messages: [read.message], relatedMessages: read.relatedMessages, profiles: read.profiles }, ctx);
60377
60432
  });
60378
60433
  var CommunityMessagePostedSchema = CommunityMessageReadSchema.safeExtend({ deduped: exports_external.boolean(), threadId: id2.optional() });
60379
- var CommunityMembersReadSchema = exports_external.strictObject({ ...envelope, relation: exports_external.enum(["access", "notify"]), members: exports_external.array(CommunityMemberRelationSchema), profiles: exports_external.array(CommunityResourceProfileSchema) });
60434
+ var CommunityMembersReadSchema = exports_external.strictObject({
60435
+ ...envelope,
60436
+ relation: exports_external.enum(["access", "notify"]),
60437
+ members: exports_external.array(CommunityMemberRelationSchema),
60438
+ profiles: exports_external.array(CommunityResourceProfileSchema),
60439
+ page: exports_external.strictObject({ nextCursor: exports_external.string().nullable(), hasMore: exports_external.boolean() }).optional()
60440
+ });
60380
60441
  var CommunityThreadsReadSchema = exports_external.strictObject({
60381
60442
  ...envelope,
60382
60443
  channel: CommunityChannelResourceSchema,
@@ -62342,7 +62403,7 @@ var nativeOauthAttempt = sqliteTable("native_oauth_attempt", {
62342
62403
  AND ${t.openedAt} IS NOT NULL AND ${t.readyAt} IS NOT NULL AND ${t.consumedAt} IS NULL
62343
62404
  AND ${t.failedAt} IS NULL AND ${t.cancelledAt} IS NULL AND ${t.replacedAt} IS NULL
62344
62405
  AND ${t.handoffCodeHash} IS NOT NULL AND ${t.handoffExpiresAt} IS NOT NULL
62345
- AND ${t.handoffExpiresAt} = ${t.readyAt} + 120000
62406
+ AND ${t.handoffExpiresAt} = min(${t.readyAt} + 120000, ${t.attemptExpiresAt})
62346
62407
  AND ${t.authKind} IS NOT NULL AND ${t.failureCode} IS NULL
62347
62408
  ) OR (
62348
62409
  ${t.status} = 'consumed'
@@ -62436,6 +62497,7 @@ var communityChannelMember = sqliteTable("community_channel_member", {
62436
62497
  }, (t) => [
62437
62498
  index("idx_community_channel_member_added_by_lookup").on(t.addedBy),
62438
62499
  unique("uq_channel_member").on(t.channelId, t.userId, t.relation),
62500
+ index("idx_channel_member_channel_relation_user").on(t.channelId, t.relation, t.userId),
62439
62501
  index("idx_channel_member_user").on(t.userId)
62440
62502
  ]);
62441
62503
  var communityMessage = sqliteTable("community_message", {
@@ -62455,6 +62517,7 @@ var communityMessage = sqliteTable("community_message", {
62455
62517
  clientNonce: text2("client_nonce")
62456
62518
  }, (t) => [
62457
62519
  index("idx_community_message_author_id_lookup").on(t.authorId),
62520
+ index("idx_message_channel_seq").on(t.channelId, t.seq),
62458
62521
  index("idx_message_channel_created").on(t.channelId, t.createdAt),
62459
62522
  index("idx_message_channel_mention_created").on(t.channelId, t.mentionType, t.createdAt),
62460
62523
  index("idx_community_message_channel_reply_author").on(t.channelId, t.replyToId, t.authorId).where(sql`${t.replyToId} IS NOT NULL`)
@@ -62559,7 +62622,8 @@ var communityReaction = sqliteTable("community_reaction", {
62559
62622
  }, (t) => [
62560
62623
  index("idx_community_reaction_user_id_lookup").on(t.userId),
62561
62624
  unique("uq_reaction_message_user_emoji").on(t.messageId, t.userId, t.emoji),
62562
- index("idx_reaction_message").on(t.messageId)
62625
+ index("idx_reaction_message").on(t.messageId),
62626
+ index("idx_reaction_message_emoji_created").on(t.messageId, t.emoji, t.createdAt, t.userId)
62563
62627
  ]);
62564
62628
  var communityAttachment = sqliteTable("community_attachment", {
62565
62629
  id: text2("id").primaryKey().$defaultFn(() => nanoid3()),
@@ -62721,18 +62785,6 @@ var communityMessageTag = sqliteTable("community_message_tag", {
62721
62785
  index("idx_message_tag_tag").on(t.tag, t.messageId)
62722
62786
  ]);
62723
62787
 
62724
- // ../shared/src/db/queries/_chunk.ts
62725
- var D1_MAX_BIND_PARAMS = 100;
62726
- function maxInParams(fixedParams) {
62727
- if (!Number.isInteger(fixedParams) || fixedParams < 0) {
62728
- throw new Error("fixed params must be a non-negative integer");
62729
- }
62730
- if (fixedParams >= D1_MAX_BIND_PARAMS) {
62731
- throw new Error("fixed params must leave room for at least one IN parameter");
62732
- }
62733
- return D1_MAX_BIND_PARAMS - fixedParams;
62734
- }
62735
-
62736
62788
  // ../shared/src/community-server-rail.ts
62737
62789
  var MAX_SERVER_RAIL_COMMANDS = 3;
62738
62790
  var idSchema = exports_external.string().trim().min(1);
@@ -63140,7 +63192,6 @@ var AGENT_MESSAGE_COLUMNS = {
63140
63192
  embeds: communityMessage.embeds
63141
63193
  };
63142
63194
  var channelJoinBaselineGuard = sql`${communityMessage.createdAt} > COALESCE(${communityChannelMember.addedAt}, ${communityServerMember.joinedAt}, '')`;
63143
- var AGENT_UNREAD_CHANNEL_CHUNK_SIZE = maxInParams(13);
63144
63195
  // ../shared/src/community-ws-events.ts
63145
63196
  var string4 = exports_external.string();
63146
63197
  var nullableString = string4.nullable();
@@ -63298,7 +63349,8 @@ var communityMemberJoinSchema = exports_external.strictObject({
63298
63349
  userId: string4,
63299
63350
  role: string4,
63300
63351
  joinedAt: string4
63301
- })
63352
+ }),
63353
+ online: exports_external.boolean().optional()
63302
63354
  });
63303
63355
  var communityMemberLeaveSchema = exports_external.strictObject({
63304
63356
  type: exports_external.literal("community:member.leave"),
@@ -63394,6 +63446,10 @@ var communityPresenceUpdateSchema = exports_external.strictObject({
63394
63446
  userId: string4,
63395
63447
  online: exports_external.boolean()
63396
63448
  });
63449
+ var communityPresenceSnapshotSchema = exports_external.strictObject({
63450
+ type: exports_external.literal("community:presence.snapshot"),
63451
+ onlineUserIds: exports_external.array(string4)
63452
+ });
63397
63453
  var communityStatusUpdateSchema = exports_external.strictObject({
63398
63454
  type: exports_external.literal("community:status.update"),
63399
63455
  userId: string4,
@@ -63452,6 +63508,11 @@ var communityBotPiiSchema = exports_external.strictObject({
63452
63508
  requestId: exports_external.string().min(1).max(128),
63453
63509
  result: PiiResultSchema
63454
63510
  });
63511
+ var communityScheduleChangedSchema = exports_external.strictObject({
63512
+ type: exports_external.literal("community:schedule.changed"),
63513
+ eventId: string4,
63514
+ reason: exports_external.enum(["created", "updated", "deleted", "run_updated"])
63515
+ });
63455
63516
  var commonCommunityEventSchemas = [
63456
63517
  communityBotPiiSchema,
63457
63518
  communityMessageUpdatedSchema,
@@ -63485,13 +63546,15 @@ var commonCommunityEventSchemas = [
63485
63546
  communityReadStateAdvancedSchema,
63486
63547
  communityInboxChangedSchema,
63487
63548
  communityPresenceUpdateSchema,
63549
+ communityPresenceSnapshotSchema,
63488
63550
  communityStatusUpdateSchema,
63489
63551
  communityMachineCreatedSchema,
63490
63552
  communityMachineStatusSchema,
63491
63553
  communityMachineUpdatedSchema,
63492
63554
  communityRuntimeModelsSchema,
63493
63555
  communityMachineRemovedSchema,
63494
- communityBotAuditEventSchema
63556
+ communityBotAuditEventSchema,
63557
+ communityScheduleChangedSchema
63495
63558
  ];
63496
63559
  var CommunityWsEventSchema = exports_external.discriminatedUnion("type", [
63497
63560
  ...commonCommunityEventSchemas,
@@ -63540,6 +63603,7 @@ var WS_EVENTS = {
63540
63603
  READ_STATE_ADVANCED: "community:read_state.advanced",
63541
63604
  INBOX_CHANGED: "community:inbox.changed",
63542
63605
  PRESENCE_UPDATE: "community:presence.update",
63606
+ PRESENCE_SNAPSHOT: "community:presence.snapshot",
63543
63607
  STATUS_UPDATE: "community:status.update",
63544
63608
  IDENTITY_UPDATE: "community:identity.update",
63545
63609
  PROFILE_UPDATE: "community:profile.update",
@@ -63549,7 +63613,8 @@ var WS_EVENTS = {
63549
63613
  RUNTIME_MODELS: "community:runtime.models",
63550
63614
  BOT_PII: "community:bot.pii",
63551
63615
  MACHINE_REMOVED: "community:machine.removed",
63552
- BOT_AUDIT_EVENT: "community:bot.audit_event"
63616
+ BOT_AUDIT_EVENT: "community:bot.audit_event",
63617
+ SCHEDULE_CHANGED: "community:schedule.changed"
63553
63618
  };
63554
63619
  var COMMUNITY_EVENT_TYPES = new Set(Object.values(WS_EVENTS));
63555
63620
  var COMMUNITY_BROWSER_EVENT_MAX_BYTES = 65536;
@@ -63770,8 +63835,58 @@ var communityBotFeedback = sqliteTable("community_bot_feedback", {
63770
63835
  check2("bot_feedback_text_bytes", sql`length(cast(${t.text} as blob)) between 1 and ${sql.raw(String(BOT_FEEDBACK_MAX_BYTES))}`)
63771
63836
  ]);
63772
63837
 
63838
+ // ../shared/src/db/community-schedule-schema.ts
63839
+ var exports_community_schedule_schema = {};
63840
+ __export(exports_community_schedule_schema, {
63841
+ communityScheduleRun: () => communityScheduleRun,
63842
+ communityScheduleEvent: () => communityScheduleEvent
63843
+ });
63844
+ var communityScheduleEvent = sqliteTable("community_schedule_event", {
63845
+ id: text2("id").primaryKey(),
63846
+ ownerUserId: text2("owner_user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
63847
+ createdByUserId: text2("created_by_user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
63848
+ title: text2("title").notNull(),
63849
+ description: text2("description").notNull().default(""),
63850
+ startAtMs: integer2("start_at_ms").notNull(),
63851
+ durationMinutes: integer2("duration_minutes").notNull().default(30),
63852
+ timeZone: text2("time_zone").notNull(),
63853
+ recurrenceJson: text2("recurrence_json"),
63854
+ occurrenceCount: integer2("occurrence_count").notNull().default(0),
63855
+ nextRunAtMs: integer2("next_run_at_ms"),
63856
+ sourceMessageId: text2("source_message_id").notNull(),
63857
+ sourceChannelId: text2("source_channel_id").notNull(),
63858
+ version: integer2("version").notNull().default(1),
63859
+ createdAtMs: integer2("created_at_ms").notNull(),
63860
+ updatedAtMs: integer2("updated_at_ms").notNull()
63861
+ }, (t) => [
63862
+ index("idx_community_schedule_event_owner_created").on(t.ownerUserId, t.createdAtMs),
63863
+ index("idx_community_schedule_event_owner_next_run").on(t.ownerUserId, t.nextRunAtMs).where(sql`${t.nextRunAtMs} IS NOT NULL`),
63864
+ index("idx_community_schedule_event_creator_id_lookup").on(t.createdByUserId)
63865
+ ]);
63866
+ var communityScheduleRun = sqliteTable("community_schedule_run", {
63867
+ id: text2("id").primaryKey(),
63868
+ ownerUserId: text2("owner_user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
63869
+ eventId: text2("event_id").notNull().references(() => communityScheduleEvent.id, { onDelete: "cascade" }),
63870
+ eventVersion: integer2("event_version").notNull(),
63871
+ botUserId: text2("bot_user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
63872
+ scheduledAtMs: integer2("scheduled_at_ms").notNull(),
63873
+ sourceMessageId: text2("source_message_id").notNull(),
63874
+ sourceChannelId: text2("source_channel_id").notNull(),
63875
+ titleSnapshot: text2("title_snapshot").notNull(),
63876
+ descriptionSnapshot: text2("description_snapshot").notNull(),
63877
+ status: text2("status").$type().notNull(),
63878
+ lastError: text2("last_error"),
63879
+ ackedAtMs: integer2("acked_at_ms"),
63880
+ createdAtMs: integer2("created_at_ms").notNull(),
63881
+ updatedAtMs: integer2("updated_at_ms").notNull()
63882
+ }, (t) => [
63883
+ uniqueIndex("uq_community_schedule_run_event_scheduled").on(t.eventId, t.scheduledAtMs),
63884
+ index("idx_community_schedule_run_owner_status_scheduled").on(t.ownerUserId, t.status, t.scheduledAtMs),
63885
+ index("idx_community_schedule_run_bot_id_lookup").on(t.botUserId)
63886
+ ]);
63887
+
63773
63888
  // ../shared/src/db/index.ts
63774
- var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema, ...exports_product_plan_schema, ...exports_billing_schema, ...exports_community_funnel_analytics_schema, ...exports_bot_creation_schema, ...exports_automation_schema, ...exports_feedback_schema };
63889
+ var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema, ...exports_product_plan_schema, ...exports_billing_schema, ...exports_community_funnel_analytics_schema, ...exports_bot_creation_schema, ...exports_automation_schema, ...exports_feedback_schema, ...exports_community_schedule_schema };
63775
63890
  // ../shared/src/db/queries/native-oauth.ts
63776
63891
  var ATTEMPT_TTL_MS = 10 * 60 * 1000;
63777
63892
  var HANDOFF_TTL_MS = 2 * 60 * 1000;
@@ -63800,6 +63915,122 @@ var metadataProjection = {
63800
63915
  };
63801
63916
  // ../shared/src/db/queries/community/diagnostic-report.ts
63802
63917
  var diagnosticOwner = alias(user, "diagnostic_owner");
63918
+ // ../shared/src/schedule.ts
63919
+ var SCHEDULE_TITLE_MAX_LENGTH = 160;
63920
+ var SCHEDULE_DESCRIPTION_MAX_LENGTH = 4000;
63921
+ var SCHEDULE_MIN_DURATION_MINUTES = 5;
63922
+ var SCHEDULE_MAX_DURATION_MINUTES = 1440;
63923
+ var SCHEDULE_MAX_RANGE_MS = 62 * 24 * 60 * 60 * 1000;
63924
+ var ScheduleRecurrenceFreqSchema = exports_external.enum(["hourly", "daily", "weekly", "monthly"]);
63925
+ var ScheduleRecurrenceSchema = exports_external.strictObject({
63926
+ freq: ScheduleRecurrenceFreqSchema,
63927
+ interval: exports_external.number().int().min(1).max(365),
63928
+ byWeekday: exports_external.array(exports_external.number().int().min(0).max(6)).min(1).max(7).optional(),
63929
+ untilAt: exports_external.iso.datetime({ offset: true }).nullable().optional(),
63930
+ count: exports_external.number().int().min(1).max(1000).nullable().optional()
63931
+ }).superRefine((value, ctx) => {
63932
+ if (value.byWeekday !== undefined && value.freq !== "weekly") {
63933
+ ctx.addIssue({
63934
+ code: "custom",
63935
+ path: ["byWeekday"],
63936
+ message: "byWeekday is only supported for weekly recurrence"
63937
+ });
63938
+ }
63939
+ });
63940
+ var ScheduleRunStatusSchema = exports_external.enum([
63941
+ "pending",
63942
+ "dispatched",
63943
+ "completed",
63944
+ "blocked_access"
63945
+ ]);
63946
+ var ScheduleOccurrenceStatusSchema = exports_external.enum([
63947
+ "scheduled",
63948
+ "pending",
63949
+ "dispatched",
63950
+ "completed",
63951
+ "blocked_access"
63952
+ ]);
63953
+ var ScheduleSourceMessageStatusSchema = exports_external.enum([
63954
+ "accessible",
63955
+ "inaccessible",
63956
+ "deleted"
63957
+ ]);
63958
+ var ScheduleActorSummarySchema = exports_external.strictObject({
63959
+ id: exports_external.string().min(1),
63960
+ handle: exports_external.string().min(1),
63961
+ name: exports_external.string().min(1),
63962
+ avatarVersion: exports_external.number().int().nonnegative(),
63963
+ isBot: exports_external.boolean()
63964
+ });
63965
+ var ScheduleLastExecutionSchema = exports_external.strictObject({
63966
+ scheduledAt: exports_external.iso.datetime(),
63967
+ status: ScheduleRunStatusSchema,
63968
+ lastError: exports_external.string().nullable(),
63969
+ ackedAt: exports_external.iso.datetime().nullable(),
63970
+ updatedAt: exports_external.iso.datetime()
63971
+ });
63972
+ var ScheduleSourceMessageSchema = exports_external.strictObject({
63973
+ id: exports_external.string().min(1),
63974
+ accessible: exports_external.boolean(),
63975
+ status: ScheduleSourceMessageStatusSchema,
63976
+ ref: exports_external.string().nullable(),
63977
+ channelRef: exports_external.string().nullable(),
63978
+ seq: exports_external.number().int().positive().nullable(),
63979
+ preview: exports_external.string().nullable()
63980
+ });
63981
+ var ScheduleEventSchema = exports_external.strictObject({
63982
+ id: exports_external.string().min(1),
63983
+ title: exports_external.string().min(1),
63984
+ description: exports_external.string(),
63985
+ createdBy: ScheduleActorSummarySchema,
63986
+ startAt: exports_external.iso.datetime(),
63987
+ durationMinutes: exports_external.number().int().min(SCHEDULE_MIN_DURATION_MINUTES).max(SCHEDULE_MAX_DURATION_MINUTES),
63988
+ timeZone: exports_external.string().min(1),
63989
+ recurrence: ScheduleRecurrenceSchema.nullable(),
63990
+ nextRunAt: exports_external.iso.datetime().nullable(),
63991
+ sourceMessage: ScheduleSourceMessageSchema,
63992
+ lastExecution: ScheduleLastExecutionSchema.nullable(),
63993
+ createdAt: exports_external.iso.datetime(),
63994
+ updatedAt: exports_external.iso.datetime()
63995
+ });
63996
+ var ScheduleOccurrenceSchema = exports_external.strictObject({
63997
+ eventId: exports_external.string().min(1),
63998
+ occurrenceKey: exports_external.string().min(1),
63999
+ startAt: exports_external.iso.datetime(),
64000
+ endAt: exports_external.iso.datetime(),
64001
+ runStatus: ScheduleOccurrenceStatusSchema
64002
+ });
64003
+ var ScheduleListResponseSchema = exports_external.strictObject({
64004
+ events: exports_external.array(ScheduleEventSchema),
64005
+ occurrences: exports_external.array(ScheduleOccurrenceSchema),
64006
+ creators: exports_external.array(ScheduleActorSummarySchema)
64007
+ });
64008
+ var ScheduleCreateRequestSchema = exports_external.strictObject({
64009
+ title: exports_external.string().trim().min(1).max(SCHEDULE_TITLE_MAX_LENGTH),
64010
+ description: exports_external.string().max(SCHEDULE_DESCRIPTION_MAX_LENGTH).optional(),
64011
+ startAt: exports_external.iso.datetime({ offset: true }),
64012
+ durationMinutes: exports_external.number().int().min(SCHEDULE_MIN_DURATION_MINUTES).max(SCHEDULE_MAX_DURATION_MINUTES).optional(),
64013
+ timeZone: exports_external.string().trim().min(1).max(128),
64014
+ recurrence: ScheduleRecurrenceSchema.nullable().optional(),
64015
+ sourceMessageRef: exports_external.string().trim().min(1).max(512)
64016
+ });
64017
+ var ScheduleUpdateRequestSchema = exports_external.strictObject({
64018
+ title: exports_external.string().trim().min(1).max(SCHEDULE_TITLE_MAX_LENGTH).optional(),
64019
+ description: exports_external.string().max(SCHEDULE_DESCRIPTION_MAX_LENGTH).optional(),
64020
+ startAt: exports_external.iso.datetime({ offset: true }).optional(),
64021
+ durationMinutes: exports_external.number().int().min(SCHEDULE_MIN_DURATION_MINUTES).max(SCHEDULE_MAX_DURATION_MINUTES).optional(),
64022
+ timeZone: exports_external.string().trim().min(1).max(128).optional(),
64023
+ recurrence: ScheduleRecurrenceSchema.nullable().optional(),
64024
+ sourceMessageRef: exports_external.string().trim().min(1).max(512).optional(),
64025
+ ack: exports_external.literal(true).optional()
64026
+ });
64027
+ var formatterCache = new Map;
64028
+ // ../shared/src/lib/channel-ref-syntax.ts
64029
+ var REF_TERM = `.,;:!?)\\]}"'\\u2014\\u2019\\u201D\\u2026\\u3001\\u3002\\u3009\\u300B\\u300D\\u300F\\u3011\\u3015\\u3017\\u3019\\u301B\\uFF01\\uFF02\\uFF07\\uFF09\\uFF0C\\uFF0E\\uFF1A\\uFF1B\\uFF1F\\uFF3D\\uFF5D`;
64030
+ var REF_SEG = `[^\\s/#${REF_TERM}]+`;
64031
+ var HANDLE_SEG = `${REF_SEG}#\\d{4,}`;
64032
+ var CHANNEL_REF_RE = new RegExp(`(?<!/[^\\s${REF_TERM}]*)(?:/${HANDLE_SEG}/${REF_SEG}|/\\.dm/${HANDLE_SEG})(?:#\\d+|/#\\d+(?:#\\d+)?)?(?=\\s|$|[${REF_TERM}])`, "gu");
64033
+ var SERVER_REF_RE = new RegExp(`(?<=^|\\s)/${HANDLE_SEG}(?=\\s|$|[${REF_TERM}])`, "gu");
63803
64034
  // ../shared/src/utils/email.ts
63804
64035
  var DOMAIN = `@${process.env.ALOOK_DOMAIN || "alook.ai"}`;
63805
64036
  // ../shared/src/lib/safe-redirect.ts
@@ -77693,11 +77924,6 @@ var exitSpoiler = function(token) {
77693
77924
  };
77694
77925
 
77695
77926
  // ../shared/src/lib/chat-syntax-plugin.ts
77696
- var REF_TERM = `.,;:!?)\\]}"'\\u2014\\u2019\\u201D\\u2026\\u3001\\u3002\\u3009\\u300B\\u300D\\u300F\\u3011\\u3015\\u3017\\u3019\\u301B\\uFF01\\uFF02\\uFF07\\uFF09\\uFF0C\\uFF0E\\uFF1A\\uFF1B\\uFF1F\\uFF3D\\uFF5D`;
77697
- var REF_SEG = `[^\\s/#${REF_TERM}]+`;
77698
- var HANDLE_SEG = `${REF_SEG}#\\d{4,}`;
77699
- var CHANNEL_REF_RE = new RegExp(`(?<!/[^\\s${REF_TERM}]*)(?:/${HANDLE_SEG}/${REF_SEG}|/\\.dm/${HANDLE_SEG})(?:#\\d+|/#\\d+(?:#\\d+)?)?(?=\\s|$|[${REF_TERM}])`, "gu");
77700
- var SERVER_REF_RE = new RegExp(`(?<=^|\\s)/${HANDLE_SEG}(?=\\s|$|[${REF_TERM}])`, "gu");
77701
77927
  var MENTION_RE = new RegExp(String.raw`(?<!/|${MENTION_IDENTIFIER_CHARACTERS})(?:@everyone(?!${MENTION_IDENTIFIER_CHARACTERS})|@[^@#\n\r]*[^@#\n\r\s]#\d{4,}(?!${MENTION_IDENTIFIER_CHARACTERS}))`, "gu");
77702
77928
  function memberMentionSyntax() {
77703
77929
  const construct = {
@@ -78027,7 +78253,7 @@ function checkProfiles(rows, resources, ctx) {
78027
78253
  }
78028
78254
  }
78029
78255
  var CommunityAcceptedFriendsReadSchema = exports_external.union([
78030
- exports_external.strictObject({ ...fresh, friends: exports_external.array(CommunityAcceptedFriendDescriptorSchema) }).superRefine((value, ctx) => checkProfiles(value.friends, value.resources, ctx)),
78256
+ exports_external.strictObject({ ...fresh, friends: exports_external.array(CommunityAcceptedFriendDescriptorSchema), totalFriends: exports_external.number().int().nonnegative().optional() }).superRefine((value, ctx) => checkProfiles(value.friends, value.resources, ctx)),
78031
78257
  exports_external.strictObject({ ...stale, friends: exports_external.array(CommunityAcceptedFriendDescriptorSchema).length(0) })
78032
78258
  ]);
78033
78259
  var CommunityBlockedFriendsReadSchema = exports_external.union([
@@ -78132,7 +78358,10 @@ var CommunityReactionDetailsReadSchema = exports_external.strictObject({
78132
78358
  exports_external.strictObject({ kind: exports_external.literal("server"), serverId: CommunityServerMembershipResourceSchema.shape.serverId, channelId: CommunityResourceProfileSchema.shape.id }),
78133
78359
  exports_external.strictObject({ kind: exports_external.literal("dm"), channelId: CommunityResourceProfileSchema.shape.id })
78134
78360
  ]),
78135
- actors: exports_external.array(exports_external.strictObject({ userId: CommunityResourceProfileSchema.shape.id, profile: CommunityReactionActorProfileSchema.nullable() }))
78361
+ actors: exports_external.array(exports_external.strictObject({ userId: CommunityResourceProfileSchema.shape.id, profile: CommunityReactionActorProfileSchema.nullable() })),
78362
+ emoji: exports_external.string().optional(),
78363
+ hasMore: exports_external.boolean().optional(),
78364
+ cursor: exports_external.string().nullable().optional()
78136
78365
  }).superRefine((value, ctx) => {
78137
78366
  if (new Set(value.actors.map((row) => row.userId)).size !== value.actors.length || value.actors.some((row) => row.profile && row.profile.id !== row.userId))
78138
78367
  ctx.addIssue({ code: "custom", message: "Reaction actor identity mismatch" });
@@ -78236,6 +78465,11 @@ function messagingSection() {
78236
78465
  "- Use `1m` to `24h` when silence would leave work unfinished — for example, after a question, " + "approval request, handoff, or blocker. If no newer message arrives by T, you will be reminded " + "to return; a newer message or daemon restart cancels the timer.",
78237
78466
  "- Use `0` only when no later action depends on a reply. It disables the timer.",
78238
78467
  "",
78468
+ "#### Schedule future or recurring work",
78469
+ "",
78470
+ "- Use `--remind-after` (`1m` to `24h`) only to follow up when an active conversation goes quiet; a newer message or daemon restart cancels it.",
78471
+ `- Use \`${CLI} schedule\` for tasks that must run at a specific future time (>24h or across restarts/offline machines) or on a recurring cadence (\`hourly\`/\`daily\`/\`weekly\`/\`monthly\`), visible in Home -> Schedule. Always bind the request's message ref, and run \`--ack\` after finishing a triggered run.`,
78472
+ "",
78239
78473
  "#### Sending mechanics",
78240
78474
  "",
78241
78475
  `- Long detail: upload it with \`${CLI} message attachment upload --file <path>.md\`; ` + "add the returned id as `--attachment <id>` on the short stdin send.",
@@ -78415,6 +78649,15 @@ function cliCommandsSection() {
78415
78649
  "Adding stores a source copy. Later edits to the input file do not update the installed filter. " + "Do not edit daemon-managed copies.",
78416
78650
  "The CLI only lists or appends filters; it cannot replace, reorder, enable, disable, or delete them. " + "Your human owner manages enabled state and deletion in Privacy. Filter errors block sending.",
78417
78651
  "",
78652
+ "### Schedule",
78653
+ "",
78654
+ "Your household shares one bot schedule visible to your owner in Home -> Schedule and to sibling bots. Every scheduled task binds to a concrete message ref.",
78655
+ "",
78656
+ `1. \`${CLI} schedule list [--from <iso> --to <iso>] [--creator <handle>]\` — list scheduled tasks and, when \`--from\` and \`--to\` are given, expanded occurrences.`,
78657
+ `2. \`${CLI} schedule create --title <text> --at <iso> --message <ref> [--description <text>] [--tz <iana>] [--duration <minutes>] [--repeat <hourly|daily|weekly|monthly>] [--interval <n>] [--weekdays <days>] [--until <iso>] [--count <n>]\` — create a one-time or recurring task bound to a message you can read.`,
78658
+ `3. \`${CLI} schedule update <id> [fields...] [--message <ref>] [--ack]\` — update a task, or pass \`--ack\` after finishing the triggered run to mark it completed.`,
78659
+ `4. \`${CLI} schedule delete <id>\` — delete a scheduled task.`,
78660
+ "",
78418
78661
  "### Settings",
78419
78662
  "",
78420
78663
  `1. \`${CLI} setting profile --set-bio <text> --set-avatar <path>\` — update your public bio ` + `and/or avatar. At least one flag is required; pass \`--set-bio ""\` to clear the bio.`,
@@ -81126,6 +81369,9 @@ function resolveProxyCapability(method, pathname) {
81126
81369
  return "read";
81127
81370
  if (pathname === "/api/community/bots/creation-requests" && method === "POST")
81128
81371
  return "send";
81372
+ if (/^\/api\/community\/schedule\/events(\/[^/]+)?$/.test(pathname)) {
81373
+ return method === "GET" ? "read" : "send";
81374
+ }
81129
81375
  if ((method === "GET" || method === "PATCH") && pathname === communityProxyRoutes.profile || method === "POST" && pathname === communityProxyRoutes.avatar)
81130
81376
  return "profile";
81131
81377
  if (pathname.includes("/attachment"))
@@ -81200,6 +81446,22 @@ function resolveProxyAuditOperation(pathname, method) {
81200
81446
  return "profileAvatarUpdate";
81201
81447
  if (/^\/api\/community\/bots\/me\/nap(\/|$|\?)/.test(canonical))
81202
81448
  return "nap";
81449
+ if (/^\/api\/community\/schedule\/events$/.test(canonical)) {
81450
+ if (method === "GET")
81451
+ return "scheduleList";
81452
+ if (method === "POST")
81453
+ return "scheduleCreate";
81454
+ return null;
81455
+ }
81456
+ if (/^\/api\/community\/schedule\/events\/[^/]+$/.test(canonical)) {
81457
+ if (method === "GET")
81458
+ return "scheduleGet";
81459
+ if (method === "PATCH")
81460
+ return "scheduleUpdate";
81461
+ if (method === "DELETE")
81462
+ return "scheduleDelete";
81463
+ return null;
81464
+ }
81203
81465
  return null;
81204
81466
  }
81205
81467
  function propertyAuditMetadata(method, pathname, requestUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alook/daemon",
3
- "version": "0.1.72",
3
+ "version": "0.1.73",
4
4
  "description": "Alook agent daemon — host-side runtime backend, process manager, credential proxy, and control plane.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/alookai/alook#readme",