@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/cli/index.js CHANGED
@@ -44100,11 +44100,53 @@ var CommunityResourceBundleSchema = CommunityMessageResourcesSchema.safeExtend({
44100
44100
  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)))
44101
44101
  ctx.addIssue({ code: "custom", message: "Resource bundle scope mismatch" });
44102
44102
  });
44103
+ var CommunityResolvedChannelRefSchema = exports_external.discriminatedUnion("status", [
44104
+ exports_external.strictObject({
44105
+ ref: exports_external.string().min(1),
44106
+ status: exports_external.literal("ready"),
44107
+ serverId: id,
44108
+ channelId: id
44109
+ }),
44110
+ exports_external.strictObject({
44111
+ ref: exports_external.string().min(1),
44112
+ status: exports_external.enum(["forbidden", "missing"])
44113
+ })
44114
+ ]);
44115
+ var CommunityMessageRefsSchema = exports_external.strictObject({
44116
+ servers: exports_external.array(CommunityServerResourceSchema),
44117
+ channels: exports_external.array(CommunityChannelResourceSchema),
44118
+ resolvedRefs: exports_external.array(CommunityResolvedChannelRefSchema)
44119
+ }).superRefine((refs, ctx) => {
44120
+ const serverIds = new Set(refs.servers.map((row) => row.id));
44121
+ const channelById = new Map(refs.channels.map((row) => [row.id, row]));
44122
+ const refKeys = new Set(refs.resolvedRefs.map((row) => row.ref));
44123
+ if (serverIds.size !== refs.servers.length || channelById.size !== refs.channels.length || refKeys.size !== refs.resolvedRefs.length) {
44124
+ ctx.addIssue({ code: "custom", message: "Duplicated ref resource" });
44125
+ return;
44126
+ }
44127
+ for (const channel of refs.channels) {
44128
+ if (channel.serverId === null || !serverIds.has(channel.serverId)) {
44129
+ ctx.addIssue({ code: "custom", path: ["channels"], message: "Ref channel server missing" });
44130
+ }
44131
+ if (channel.parentChannelId !== null && !channelById.has(channel.parentChannelId)) {
44132
+ ctx.addIssue({ code: "custom", path: ["channels"], message: "Ref channel parent missing" });
44133
+ }
44134
+ }
44135
+ for (const resolved of refs.resolvedRefs) {
44136
+ if (resolved.status !== "ready")
44137
+ continue;
44138
+ const channel = channelById.get(resolved.channelId);
44139
+ if (!serverIds.has(resolved.serverId) || !channel || channel.serverId !== resolved.serverId) {
44140
+ ctx.addIssue({ code: "custom", path: ["resolvedRefs"], message: "Resolved ref target missing from resources" });
44141
+ }
44142
+ }
44143
+ });
44103
44144
  var CommunityChannelReadSchema = exports_external.strictObject({ ...envelope, channel: CommunityChannelResourceSchema, access: CommunityAccessDecisionSchema });
44104
44145
  var CommunityMessagesReadSchema = CommunityMessageResourcesSchema.safeExtend({
44105
44146
  ...envelope,
44106
44147
  page: CommunityPageSchema,
44107
44148
  relatedMessages: exports_external.array(CommunityMessageResourceSchema).optional(),
44149
+ refs: CommunityMessageRefsSchema.optional(),
44108
44150
  surfaceReceipt: exports_external.strictObject({ channelId: id, surfaceKind: exports_external.enum(["channel", "forum", "thread", "dm"]) })
44109
44151
  }).superRefine(validateRelatedMessageGraph);
44110
44152
  var CommunityConversationEntryReadSchema = CommunityMessagesReadSchema.safeExtend({
@@ -44184,7 +44226,13 @@ var CommunityMessageReadSchema = exports_external.strictObject({
44184
44226
  validateRelatedMessageGraph({ messages: [read.message], relatedMessages: read.relatedMessages, profiles: read.profiles }, ctx);
44185
44227
  });
44186
44228
  var CommunityMessagePostedSchema = CommunityMessageReadSchema.safeExtend({ deduped: exports_external.boolean(), threadId: id.optional() });
44187
- var CommunityMembersReadSchema = exports_external.strictObject({ ...envelope, relation: exports_external.enum(["access", "notify"]), members: exports_external.array(CommunityMemberRelationSchema), profiles: exports_external.array(CommunityResourceProfileSchema) });
44229
+ var CommunityMembersReadSchema = exports_external.strictObject({
44230
+ ...envelope,
44231
+ relation: exports_external.enum(["access", "notify"]),
44232
+ members: exports_external.array(CommunityMemberRelationSchema),
44233
+ profiles: exports_external.array(CommunityResourceProfileSchema),
44234
+ page: exports_external.strictObject({ nextCursor: exports_external.string().nullable(), hasMore: exports_external.boolean() }).optional()
44235
+ });
44188
44236
  var CommunityThreadsReadSchema = exports_external.strictObject({
44189
44237
  ...envelope,
44190
44238
  channel: CommunityChannelResourceSchema,
@@ -46150,7 +46198,7 @@ var nativeOauthAttempt = sqliteTable("native_oauth_attempt", {
46150
46198
  AND ${t.openedAt} IS NOT NULL AND ${t.readyAt} IS NOT NULL AND ${t.consumedAt} IS NULL
46151
46199
  AND ${t.failedAt} IS NULL AND ${t.cancelledAt} IS NULL AND ${t.replacedAt} IS NULL
46152
46200
  AND ${t.handoffCodeHash} IS NOT NULL AND ${t.handoffExpiresAt} IS NOT NULL
46153
- AND ${t.handoffExpiresAt} = ${t.readyAt} + 120000
46201
+ AND ${t.handoffExpiresAt} = min(${t.readyAt} + 120000, ${t.attemptExpiresAt})
46154
46202
  AND ${t.authKind} IS NOT NULL AND ${t.failureCode} IS NULL
46155
46203
  ) OR (
46156
46204
  ${t.status} = 'consumed'
@@ -46244,6 +46292,7 @@ var communityChannelMember = sqliteTable("community_channel_member", {
46244
46292
  }, (t) => [
46245
46293
  index("idx_community_channel_member_added_by_lookup").on(t.addedBy),
46246
46294
  unique("uq_channel_member").on(t.channelId, t.userId, t.relation),
46295
+ index("idx_channel_member_channel_relation_user").on(t.channelId, t.relation, t.userId),
46247
46296
  index("idx_channel_member_user").on(t.userId)
46248
46297
  ]);
46249
46298
  var communityMessage = sqliteTable("community_message", {
@@ -46263,6 +46312,7 @@ var communityMessage = sqliteTable("community_message", {
46263
46312
  clientNonce: text("client_nonce")
46264
46313
  }, (t) => [
46265
46314
  index("idx_community_message_author_id_lookup").on(t.authorId),
46315
+ index("idx_message_channel_seq").on(t.channelId, t.seq),
46266
46316
  index("idx_message_channel_created").on(t.channelId, t.createdAt),
46267
46317
  index("idx_message_channel_mention_created").on(t.channelId, t.mentionType, t.createdAt),
46268
46318
  index("idx_community_message_channel_reply_author").on(t.channelId, t.replyToId, t.authorId).where(sql`${t.replyToId} IS NOT NULL`)
@@ -46367,7 +46417,8 @@ var communityReaction = sqliteTable("community_reaction", {
46367
46417
  }, (t) => [
46368
46418
  index("idx_community_reaction_user_id_lookup").on(t.userId),
46369
46419
  unique("uq_reaction_message_user_emoji").on(t.messageId, t.userId, t.emoji),
46370
- index("idx_reaction_message").on(t.messageId)
46420
+ index("idx_reaction_message").on(t.messageId),
46421
+ index("idx_reaction_message_emoji_created").on(t.messageId, t.emoji, t.createdAt, t.userId)
46371
46422
  ]);
46372
46423
  var communityAttachment = sqliteTable("community_attachment", {
46373
46424
  id: text("id").primaryKey().$defaultFn(() => nanoid3()),
@@ -46529,18 +46580,6 @@ var communityMessageTag = sqliteTable("community_message_tag", {
46529
46580
  index("idx_message_tag_tag").on(t.tag, t.messageId)
46530
46581
  ]);
46531
46582
 
46532
- // ../shared/src/db/queries/_chunk.ts
46533
- var D1_MAX_BIND_PARAMS = 100;
46534
- function maxInParams(fixedParams) {
46535
- if (!Number.isInteger(fixedParams) || fixedParams < 0) {
46536
- throw new Error("fixed params must be a non-negative integer");
46537
- }
46538
- if (fixedParams >= D1_MAX_BIND_PARAMS) {
46539
- throw new Error("fixed params must leave room for at least one IN parameter");
46540
- }
46541
- return D1_MAX_BIND_PARAMS - fixedParams;
46542
- }
46543
-
46544
46583
  // ../shared/src/community-server-rail.ts
46545
46584
  var MAX_SERVER_RAIL_COMMANDS = 3;
46546
46585
  var idSchema = exports_external.string().trim().min(1);
@@ -46948,7 +46987,6 @@ var AGENT_MESSAGE_COLUMNS = {
46948
46987
  embeds: communityMessage.embeds
46949
46988
  };
46950
46989
  var channelJoinBaselineGuard = sql`${communityMessage.createdAt} > COALESCE(${communityChannelMember.addedAt}, ${communityServerMember.joinedAt}, '')`;
46951
- var AGENT_UNREAD_CHANNEL_CHUNK_SIZE = maxInParams(13);
46952
46990
  // ../shared/src/community-ws-events.ts
46953
46991
  var string4 = exports_external.string();
46954
46992
  var nullableString = string4.nullable();
@@ -47106,7 +47144,8 @@ var communityMemberJoinSchema = exports_external.strictObject({
47106
47144
  userId: string4,
47107
47145
  role: string4,
47108
47146
  joinedAt: string4
47109
- })
47147
+ }),
47148
+ online: exports_external.boolean().optional()
47110
47149
  });
47111
47150
  var communityMemberLeaveSchema = exports_external.strictObject({
47112
47151
  type: exports_external.literal("community:member.leave"),
@@ -47202,6 +47241,10 @@ var communityPresenceUpdateSchema = exports_external.strictObject({
47202
47241
  userId: string4,
47203
47242
  online: exports_external.boolean()
47204
47243
  });
47244
+ var communityPresenceSnapshotSchema = exports_external.strictObject({
47245
+ type: exports_external.literal("community:presence.snapshot"),
47246
+ onlineUserIds: exports_external.array(string4)
47247
+ });
47205
47248
  var communityStatusUpdateSchema = exports_external.strictObject({
47206
47249
  type: exports_external.literal("community:status.update"),
47207
47250
  userId: string4,
@@ -47260,6 +47303,11 @@ var communityBotPiiSchema = exports_external.strictObject({
47260
47303
  requestId: exports_external.string().min(1).max(128),
47261
47304
  result: PiiResultSchema
47262
47305
  });
47306
+ var communityScheduleChangedSchema = exports_external.strictObject({
47307
+ type: exports_external.literal("community:schedule.changed"),
47308
+ eventId: string4,
47309
+ reason: exports_external.enum(["created", "updated", "deleted", "run_updated"])
47310
+ });
47263
47311
  var commonCommunityEventSchemas = [
47264
47312
  communityBotPiiSchema,
47265
47313
  communityMessageUpdatedSchema,
@@ -47293,13 +47341,15 @@ var commonCommunityEventSchemas = [
47293
47341
  communityReadStateAdvancedSchema,
47294
47342
  communityInboxChangedSchema,
47295
47343
  communityPresenceUpdateSchema,
47344
+ communityPresenceSnapshotSchema,
47296
47345
  communityStatusUpdateSchema,
47297
47346
  communityMachineCreatedSchema,
47298
47347
  communityMachineStatusSchema,
47299
47348
  communityMachineUpdatedSchema,
47300
47349
  communityRuntimeModelsSchema,
47301
47350
  communityMachineRemovedSchema,
47302
- communityBotAuditEventSchema
47351
+ communityBotAuditEventSchema,
47352
+ communityScheduleChangedSchema
47303
47353
  ];
47304
47354
  var CommunityWsEventSchema = exports_external.discriminatedUnion("type", [
47305
47355
  ...commonCommunityEventSchemas,
@@ -47348,6 +47398,7 @@ var WS_EVENTS = {
47348
47398
  READ_STATE_ADVANCED: "community:read_state.advanced",
47349
47399
  INBOX_CHANGED: "community:inbox.changed",
47350
47400
  PRESENCE_UPDATE: "community:presence.update",
47401
+ PRESENCE_SNAPSHOT: "community:presence.snapshot",
47351
47402
  STATUS_UPDATE: "community:status.update",
47352
47403
  IDENTITY_UPDATE: "community:identity.update",
47353
47404
  PROFILE_UPDATE: "community:profile.update",
@@ -47357,7 +47408,8 @@ var WS_EVENTS = {
47357
47408
  RUNTIME_MODELS: "community:runtime.models",
47358
47409
  BOT_PII: "community:bot.pii",
47359
47410
  MACHINE_REMOVED: "community:machine.removed",
47360
- BOT_AUDIT_EVENT: "community:bot.audit_event"
47411
+ BOT_AUDIT_EVENT: "community:bot.audit_event",
47412
+ SCHEDULE_CHANGED: "community:schedule.changed"
47361
47413
  };
47362
47414
  var COMMUNITY_EVENT_TYPES = new Set(Object.values(WS_EVENTS));
47363
47415
  var COMMUNITY_BROWSER_EVENT_MAX_BYTES = 65536;
@@ -47578,8 +47630,58 @@ var communityBotFeedback = sqliteTable("community_bot_feedback", {
47578
47630
  check2("bot_feedback_text_bytes", sql`length(cast(${t.text} as blob)) between 1 and ${sql.raw(String(BOT_FEEDBACK_MAX_BYTES))}`)
47579
47631
  ]);
47580
47632
 
47633
+ // ../shared/src/db/community-schedule-schema.ts
47634
+ var exports_community_schedule_schema = {};
47635
+ __export(exports_community_schedule_schema, {
47636
+ communityScheduleRun: () => communityScheduleRun,
47637
+ communityScheduleEvent: () => communityScheduleEvent
47638
+ });
47639
+ var communityScheduleEvent = sqliteTable("community_schedule_event", {
47640
+ id: text("id").primaryKey(),
47641
+ ownerUserId: text("owner_user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
47642
+ createdByUserId: text("created_by_user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
47643
+ title: text("title").notNull(),
47644
+ description: text("description").notNull().default(""),
47645
+ startAtMs: integer2("start_at_ms").notNull(),
47646
+ durationMinutes: integer2("duration_minutes").notNull().default(30),
47647
+ timeZone: text("time_zone").notNull(),
47648
+ recurrenceJson: text("recurrence_json"),
47649
+ occurrenceCount: integer2("occurrence_count").notNull().default(0),
47650
+ nextRunAtMs: integer2("next_run_at_ms"),
47651
+ sourceMessageId: text("source_message_id").notNull(),
47652
+ sourceChannelId: text("source_channel_id").notNull(),
47653
+ version: integer2("version").notNull().default(1),
47654
+ createdAtMs: integer2("created_at_ms").notNull(),
47655
+ updatedAtMs: integer2("updated_at_ms").notNull()
47656
+ }, (t) => [
47657
+ index("idx_community_schedule_event_owner_created").on(t.ownerUserId, t.createdAtMs),
47658
+ index("idx_community_schedule_event_owner_next_run").on(t.ownerUserId, t.nextRunAtMs).where(sql`${t.nextRunAtMs} IS NOT NULL`),
47659
+ index("idx_community_schedule_event_creator_id_lookup").on(t.createdByUserId)
47660
+ ]);
47661
+ var communityScheduleRun = sqliteTable("community_schedule_run", {
47662
+ id: text("id").primaryKey(),
47663
+ ownerUserId: text("owner_user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
47664
+ eventId: text("event_id").notNull().references(() => communityScheduleEvent.id, { onDelete: "cascade" }),
47665
+ eventVersion: integer2("event_version").notNull(),
47666
+ botUserId: text("bot_user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
47667
+ scheduledAtMs: integer2("scheduled_at_ms").notNull(),
47668
+ sourceMessageId: text("source_message_id").notNull(),
47669
+ sourceChannelId: text("source_channel_id").notNull(),
47670
+ titleSnapshot: text("title_snapshot").notNull(),
47671
+ descriptionSnapshot: text("description_snapshot").notNull(),
47672
+ status: text("status").$type().notNull(),
47673
+ lastError: text("last_error"),
47674
+ ackedAtMs: integer2("acked_at_ms"),
47675
+ createdAtMs: integer2("created_at_ms").notNull(),
47676
+ updatedAtMs: integer2("updated_at_ms").notNull()
47677
+ }, (t) => [
47678
+ uniqueIndex("uq_community_schedule_run_event_scheduled").on(t.eventId, t.scheduledAtMs),
47679
+ index("idx_community_schedule_run_owner_status_scheduled").on(t.ownerUserId, t.status, t.scheduledAtMs),
47680
+ index("idx_community_schedule_run_bot_id_lookup").on(t.botUserId)
47681
+ ]);
47682
+
47581
47683
  // ../shared/src/db/index.ts
47582
- 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 };
47684
+ 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 };
47583
47685
  // ../shared/src/db/queries/native-oauth.ts
47584
47686
  var ATTEMPT_TTL_MS = 10 * 60 * 1000;
47585
47687
  var HANDOFF_TTL_MS = 2 * 60 * 1000;
@@ -47608,6 +47710,126 @@ var metadataProjection = {
47608
47710
  };
47609
47711
  // ../shared/src/db/queries/community/diagnostic-report.ts
47610
47712
  var diagnosticOwner = alias(user, "diagnostic_owner");
47713
+ // ../shared/src/schedule.ts
47714
+ var SCHEDULE_TITLE_MAX_LENGTH = 160;
47715
+ var SCHEDULE_DESCRIPTION_MAX_LENGTH = 4000;
47716
+ var SCHEDULE_MIN_DURATION_MINUTES = 5;
47717
+ var SCHEDULE_MAX_DURATION_MINUTES = 1440;
47718
+ var SCHEDULE_MAX_RANGE_MS = 62 * 24 * 60 * 60 * 1000;
47719
+ var ScheduleRecurrenceFreqSchema = exports_external.enum(["hourly", "daily", "weekly", "monthly"]);
47720
+ var ScheduleRecurrenceSchema = exports_external.strictObject({
47721
+ freq: ScheduleRecurrenceFreqSchema,
47722
+ interval: exports_external.number().int().min(1).max(365),
47723
+ byWeekday: exports_external.array(exports_external.number().int().min(0).max(6)).min(1).max(7).optional(),
47724
+ untilAt: exports_external.iso.datetime({ offset: true }).nullable().optional(),
47725
+ count: exports_external.number().int().min(1).max(1000).nullable().optional()
47726
+ }).superRefine((value, ctx) => {
47727
+ if (value.byWeekday !== undefined && value.freq !== "weekly") {
47728
+ ctx.addIssue({
47729
+ code: "custom",
47730
+ path: ["byWeekday"],
47731
+ message: "byWeekday is only supported for weekly recurrence"
47732
+ });
47733
+ }
47734
+ });
47735
+ var ScheduleRunStatusSchema = exports_external.enum([
47736
+ "pending",
47737
+ "dispatched",
47738
+ "completed",
47739
+ "blocked_access"
47740
+ ]);
47741
+ var ScheduleOccurrenceStatusSchema = exports_external.enum([
47742
+ "scheduled",
47743
+ "pending",
47744
+ "dispatched",
47745
+ "completed",
47746
+ "blocked_access"
47747
+ ]);
47748
+ var ScheduleSourceMessageStatusSchema = exports_external.enum([
47749
+ "accessible",
47750
+ "inaccessible",
47751
+ "deleted"
47752
+ ]);
47753
+ var ScheduleActorSummarySchema = exports_external.strictObject({
47754
+ id: exports_external.string().min(1),
47755
+ handle: exports_external.string().min(1),
47756
+ name: exports_external.string().min(1),
47757
+ avatarVersion: exports_external.number().int().nonnegative(),
47758
+ isBot: exports_external.boolean()
47759
+ });
47760
+ var ScheduleLastExecutionSchema = exports_external.strictObject({
47761
+ scheduledAt: exports_external.iso.datetime(),
47762
+ status: ScheduleRunStatusSchema,
47763
+ lastError: exports_external.string().nullable(),
47764
+ ackedAt: exports_external.iso.datetime().nullable(),
47765
+ updatedAt: exports_external.iso.datetime()
47766
+ });
47767
+ var ScheduleSourceMessageSchema = exports_external.strictObject({
47768
+ id: exports_external.string().min(1),
47769
+ accessible: exports_external.boolean(),
47770
+ status: ScheduleSourceMessageStatusSchema,
47771
+ ref: exports_external.string().nullable(),
47772
+ channelRef: exports_external.string().nullable(),
47773
+ seq: exports_external.number().int().positive().nullable(),
47774
+ preview: exports_external.string().nullable()
47775
+ });
47776
+ var ScheduleEventSchema = exports_external.strictObject({
47777
+ id: exports_external.string().min(1),
47778
+ title: exports_external.string().min(1),
47779
+ description: exports_external.string(),
47780
+ createdBy: ScheduleActorSummarySchema,
47781
+ startAt: exports_external.iso.datetime(),
47782
+ durationMinutes: exports_external.number().int().min(SCHEDULE_MIN_DURATION_MINUTES).max(SCHEDULE_MAX_DURATION_MINUTES),
47783
+ timeZone: exports_external.string().min(1),
47784
+ recurrence: ScheduleRecurrenceSchema.nullable(),
47785
+ nextRunAt: exports_external.iso.datetime().nullable(),
47786
+ sourceMessage: ScheduleSourceMessageSchema,
47787
+ lastExecution: ScheduleLastExecutionSchema.nullable(),
47788
+ createdAt: exports_external.iso.datetime(),
47789
+ updatedAt: exports_external.iso.datetime()
47790
+ });
47791
+ var ScheduleOccurrenceSchema = exports_external.strictObject({
47792
+ eventId: exports_external.string().min(1),
47793
+ occurrenceKey: exports_external.string().min(1),
47794
+ startAt: exports_external.iso.datetime(),
47795
+ endAt: exports_external.iso.datetime(),
47796
+ runStatus: ScheduleOccurrenceStatusSchema
47797
+ });
47798
+ var ScheduleListResponseSchema = exports_external.strictObject({
47799
+ events: exports_external.array(ScheduleEventSchema),
47800
+ occurrences: exports_external.array(ScheduleOccurrenceSchema),
47801
+ creators: exports_external.array(ScheduleActorSummarySchema)
47802
+ });
47803
+ var ScheduleCreateRequestSchema = exports_external.strictObject({
47804
+ title: exports_external.string().trim().min(1).max(SCHEDULE_TITLE_MAX_LENGTH),
47805
+ description: exports_external.string().max(SCHEDULE_DESCRIPTION_MAX_LENGTH).optional(),
47806
+ startAt: exports_external.iso.datetime({ offset: true }),
47807
+ durationMinutes: exports_external.number().int().min(SCHEDULE_MIN_DURATION_MINUTES).max(SCHEDULE_MAX_DURATION_MINUTES).optional(),
47808
+ timeZone: exports_external.string().trim().min(1).max(128),
47809
+ recurrence: ScheduleRecurrenceSchema.nullable().optional(),
47810
+ sourceMessageRef: exports_external.string().trim().min(1).max(512)
47811
+ });
47812
+ var ScheduleUpdateRequestSchema = exports_external.strictObject({
47813
+ title: exports_external.string().trim().min(1).max(SCHEDULE_TITLE_MAX_LENGTH).optional(),
47814
+ description: exports_external.string().max(SCHEDULE_DESCRIPTION_MAX_LENGTH).optional(),
47815
+ startAt: exports_external.iso.datetime({ offset: true }).optional(),
47816
+ durationMinutes: exports_external.number().int().min(SCHEDULE_MIN_DURATION_MINUTES).max(SCHEDULE_MAX_DURATION_MINUTES).optional(),
47817
+ timeZone: exports_external.string().trim().min(1).max(128).optional(),
47818
+ recurrence: ScheduleRecurrenceSchema.nullable().optional(),
47819
+ sourceMessageRef: exports_external.string().trim().min(1).max(512).optional(),
47820
+ ack: exports_external.literal(true).optional()
47821
+ });
47822
+ function isValidIanaTimeZone(timeZone) {
47823
+ if (!timeZone || typeof timeZone !== "string")
47824
+ return false;
47825
+ try {
47826
+ new Intl.DateTimeFormat("en-US", { timeZone }).format(0);
47827
+ return true;
47828
+ } catch {
47829
+ return false;
47830
+ }
47831
+ }
47832
+ var formatterCache = new Map;
47611
47833
  // ../shared/src/lib/invite-link.ts
47612
47834
  var INVITE_URL_RE = /(?:https?:\/\/[^\s/]+)?\/c\/invite\/([A-Za-z0-9_-]{6,64})/;
47613
47835
  var BARE_TOKEN_RE = /^[A-Za-z0-9_-]{6,64}$/;
@@ -47620,6 +47842,12 @@ function parseInviteToken(input2) {
47620
47842
  return urlMatch[1];
47621
47843
  return BARE_TOKEN_RE.test(trimmed) ? trimmed : null;
47622
47844
  }
47845
+ // ../shared/src/lib/channel-ref-syntax.ts
47846
+ 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`;
47847
+ var REF_SEG = `[^\\s/#${REF_TERM}]+`;
47848
+ var HANDLE_SEG = `${REF_SEG}#\\d{4,}`;
47849
+ var CHANNEL_REF_RE = new RegExp(`(?<!/[^\\s${REF_TERM}]*)(?:/${HANDLE_SEG}/${REF_SEG}|/\\.dm/${HANDLE_SEG})(?:#\\d+|/#\\d+(?:#\\d+)?)?(?=\\s|$|[${REF_TERM}])`, "gu");
47850
+ var SERVER_REF_RE = new RegExp(`(?<=^|\\s)/${HANDLE_SEG}(?=\\s|$|[${REF_TERM}])`, "gu");
47623
47851
  // ../shared/src/utils/email.ts
47624
47852
  var DOMAIN = `@${process.env.ALOOK_DOMAIN || "alook.ai"}`;
47625
47853
  // ../shared/src/lib/safe-redirect.ts
@@ -61513,11 +61741,6 @@ var exitSpoiler = function(token) {
61513
61741
  };
61514
61742
 
61515
61743
  // ../shared/src/lib/chat-syntax-plugin.ts
61516
- 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`;
61517
- var REF_SEG = `[^\\s/#${REF_TERM}]+`;
61518
- var HANDLE_SEG = `${REF_SEG}#\\d{4,}`;
61519
- var CHANNEL_REF_RE = new RegExp(`(?<!/[^\\s${REF_TERM}]*)(?:/${HANDLE_SEG}/${REF_SEG}|/\\.dm/${HANDLE_SEG})(?:#\\d+|/#\\d+(?:#\\d+)?)?(?=\\s|$|[${REF_TERM}])`, "gu");
61520
- var SERVER_REF_RE = new RegExp(`(?<=^|\\s)/${HANDLE_SEG}(?=\\s|$|[${REF_TERM}])`, "gu");
61521
61744
  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");
61522
61745
  function memberMentionSyntax() {
61523
61746
  const construct = {
@@ -61873,7 +62096,7 @@ function checkProfiles(rows, resources, ctx) {
61873
62096
  }
61874
62097
  }
61875
62098
  var CommunityAcceptedFriendsReadSchema = exports_external.union([
61876
- exports_external.strictObject({ ...fresh, friends: exports_external.array(CommunityAcceptedFriendDescriptorSchema) }).superRefine((value, ctx) => checkProfiles(value.friends, value.resources, ctx)),
62099
+ 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)),
61877
62100
  exports_external.strictObject({ ...stale, friends: exports_external.array(CommunityAcceptedFriendDescriptorSchema).length(0) })
61878
62101
  ]);
61879
62102
  var CommunityBlockedFriendsReadSchema = exports_external.union([
@@ -61978,7 +62201,10 @@ var CommunityReactionDetailsReadSchema = exports_external.strictObject({
61978
62201
  exports_external.strictObject({ kind: exports_external.literal("server"), serverId: CommunityServerMembershipResourceSchema.shape.serverId, channelId: CommunityResourceProfileSchema.shape.id }),
61979
62202
  exports_external.strictObject({ kind: exports_external.literal("dm"), channelId: CommunityResourceProfileSchema.shape.id })
61980
62203
  ]),
61981
- actors: exports_external.array(exports_external.strictObject({ userId: CommunityResourceProfileSchema.shape.id, profile: CommunityReactionActorProfileSchema.nullable() }))
62204
+ actors: exports_external.array(exports_external.strictObject({ userId: CommunityResourceProfileSchema.shape.id, profile: CommunityReactionActorProfileSchema.nullable() })),
62205
+ emoji: exports_external.string().optional(),
62206
+ hasMore: exports_external.boolean().optional(),
62207
+ cursor: exports_external.string().nullable().optional()
61982
62208
  }).superRefine((value, ctx) => {
61983
62209
  if (new Set(value.actors.map((row) => row.userId)).size !== value.actors.length || value.actors.some((row) => row.profile && row.profile.id !== row.userId))
61984
62210
  ctx.addIssue({ code: "custom", message: "Reaction actor identity mismatch" });
@@ -64083,8 +64309,7 @@ class AgyAcpLane {
64083
64309
  stop(input2 = {}) {
64084
64310
  this.requestedStopReason ??= input2.reason ?? "requested_stop";
64085
64311
  this.ready = false;
64086
- if (this.activityTimer)
64087
- clearTimeout(this.activityTimer);
64312
+ this.clearActivityTimer();
64088
64313
  this.currentPromptRequestId = null;
64089
64314
  this.terminalOwner = null;
64090
64315
  this.toolCalls.clear();
@@ -64092,12 +64317,7 @@ class AgyAcpLane {
64092
64317
  this.promptOutcomes.clear();
64093
64318
  this.observedPrompts.clear();
64094
64319
  this.usage.reset();
64095
- const waiter = this.configWaiter;
64096
- if (waiter) {
64097
- clearTimeout(waiter.timer);
64098
- this.configWaiter = undefined;
64099
- waiter.reject(new Error("Antigravity CLI lane stopped"));
64100
- }
64320
+ this.rejectConfigWaiter(new Error("Antigravity CLI lane stopped"));
64101
64321
  this.stopPromise ??= this.stopPhysicalOnce(input2);
64102
64322
  return this.stopPromise;
64103
64323
  }
@@ -64600,6 +64820,8 @@ class AgyAcpLane {
64600
64820
  }
64601
64821
  this.processTerminal = true;
64602
64822
  this.ready = false;
64823
+ this.clearActivityTimer();
64824
+ this.rejectConfigWaiter(normalized);
64603
64825
  this.currentPromptRequestId = null;
64604
64826
  this.terminalOwner = null;
64605
64827
  this.toolCalls.clear();
@@ -64619,10 +64841,13 @@ class AgyAcpLane {
64619
64841
  return;
64620
64842
  this.processTerminal = true;
64621
64843
  this.ready = false;
64844
+ this.clearActivityTimer();
64845
+ const exitError = new Error("Agy ACP process exited");
64846
+ this.rejectConfigWaiter(exitError);
64622
64847
  this.currentPromptRequestId = null;
64623
64848
  this.terminalOwner = null;
64624
64849
  this.toolCalls.clear();
64625
- this.rejectAllPending(new Error("Agy ACP process exited"));
64850
+ this.rejectAllPending(exitError);
64626
64851
  if (this.suppressExit || !this.processActivated)
64627
64852
  return;
64628
64853
  this.events.emit("exit", {
@@ -64907,8 +65132,22 @@ class AgyAcpLane {
64907
65132
  });
64908
65133
  return reading;
64909
65134
  }
65135
+ clearActivityTimer() {
65136
+ if (!this.activityTimer)
65137
+ return;
65138
+ clearTimeout(this.activityTimer);
65139
+ this.activityTimer = undefined;
65140
+ }
65141
+ rejectConfigWaiter(error62) {
65142
+ const waiter = this.configWaiter;
65143
+ if (!waiter)
65144
+ return;
65145
+ clearTimeout(waiter.timer);
65146
+ this.configWaiter = undefined;
65147
+ waiter.reject(error62);
65148
+ }
64910
65149
  scheduleActivity() {
64911
- if (!this.ready || this.requestedStopReason || this.processTerminal)
65150
+ if (!this.ready || this.requestedStopReason || this.processTerminal || this.activityTimer)
64912
65151
  return;
64913
65152
  this.activityTimer = setTimeout(() => {
64914
65153
  this.activityTimer = undefined;
@@ -76913,6 +77152,9 @@ function resolveProxyCapability(method, pathname) {
76913
77152
  return "read";
76914
77153
  if (pathname === "/api/community/bots/creation-requests" && method === "POST")
76915
77154
  return "send";
77155
+ if (/^\/api\/community\/schedule\/events(\/[^/]+)?$/.test(pathname)) {
77156
+ return method === "GET" ? "read" : "send";
77157
+ }
76916
77158
  if ((method === "GET" || method === "PATCH") && pathname === communityProxyRoutes.profile || method === "POST" && pathname === communityProxyRoutes.avatar)
76917
77159
  return "profile";
76918
77160
  if (pathname.includes("/attachment"))
@@ -76987,6 +77229,22 @@ function resolveProxyAuditOperation(pathname, method) {
76987
77229
  return "profileAvatarUpdate";
76988
77230
  if (/^\/api\/community\/bots\/me\/nap(\/|$|\?)/.test(canonical))
76989
77231
  return "nap";
77232
+ if (/^\/api\/community\/schedule\/events$/.test(canonical)) {
77233
+ if (method === "GET")
77234
+ return "scheduleList";
77235
+ if (method === "POST")
77236
+ return "scheduleCreate";
77237
+ return null;
77238
+ }
77239
+ if (/^\/api\/community\/schedule\/events\/[^/]+$/.test(canonical)) {
77240
+ if (method === "GET")
77241
+ return "scheduleGet";
77242
+ if (method === "PATCH")
77243
+ return "scheduleUpdate";
77244
+ if (method === "DELETE")
77245
+ return "scheduleDelete";
77246
+ return null;
77247
+ }
76990
77248
  return null;
76991
77249
  }
76992
77250
  function propertyAuditMetadata(method, pathname, requestUrl) {
@@ -82074,6 +82332,11 @@ function messagingSection() {
82074
82332
  "- 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.",
82075
82333
  "- Use `0` only when no later action depends on a reply. It disables the timer.",
82076
82334
  "",
82335
+ "#### Schedule future or recurring work",
82336
+ "",
82337
+ "- Use `--remind-after` (`1m` to `24h`) only to follow up when an active conversation goes quiet; a newer message or daemon restart cancels it.",
82338
+ `- 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.`,
82339
+ "",
82077
82340
  "#### Sending mechanics",
82078
82341
  "",
82079
82342
  `- Long detail: upload it with \`${CLI} message attachment upload --file <path>.md\`; ` + "add the returned id as `--attachment <id>` on the short stdin send.",
@@ -82253,6 +82516,15 @@ function cliCommandsSection() {
82253
82516
  "Adding stores a source copy. Later edits to the input file do not update the installed filter. " + "Do not edit daemon-managed copies.",
82254
82517
  "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.",
82255
82518
  "",
82519
+ "### Schedule",
82520
+ "",
82521
+ "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.",
82522
+ "",
82523
+ `1. \`${CLI} schedule list [--from <iso> --to <iso>] [--creator <handle>]\` — list scheduled tasks and, when \`--from\` and \`--to\` are given, expanded occurrences.`,
82524
+ `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.`,
82525
+ `3. \`${CLI} schedule update <id> [fields...] [--message <ref>] [--ack]\` — update a task, or pass \`--ack\` after finishing the triggered run to mark it completed.`,
82526
+ `4. \`${CLI} schedule delete <id>\` — delete a scheduled task.`,
82527
+ "",
82256
82528
  "### Settings",
82257
82529
  "",
82258
82530
  `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.`,
@@ -90141,6 +90413,208 @@ function registerPlatformCommands(program, getApi, output2, readFeedbackInput) {
90141
90413
  });
90142
90414
  }
90143
90415
 
90416
+ // src/cli/schedule.ts
90417
+ var WEEKDAY_TOKENS = {
90418
+ "0": 0,
90419
+ sun: 0,
90420
+ sunday: 0,
90421
+ "1": 1,
90422
+ mon: 1,
90423
+ monday: 1,
90424
+ "2": 2,
90425
+ tue: 2,
90426
+ tues: 2,
90427
+ tuesday: 2,
90428
+ "3": 3,
90429
+ wed: 3,
90430
+ wednesday: 3,
90431
+ "4": 4,
90432
+ thu: 4,
90433
+ thur: 4,
90434
+ thurs: 4,
90435
+ thursday: 4,
90436
+ "5": 5,
90437
+ fri: 5,
90438
+ friday: 5,
90439
+ "6": 6,
90440
+ sat: 6,
90441
+ saturday: 6
90442
+ };
90443
+ function parseIsoOption(raw, flag) {
90444
+ const ms = Date.parse(raw);
90445
+ if (!Number.isFinite(ms)) {
90446
+ throw new Error(`${flag} must be a valid ISO-8601 timestamp (e.g. 2026-11-26T09:00:00+08:00)`);
90447
+ }
90448
+ return new Date(ms).toISOString();
90449
+ }
90450
+ function parsePositiveIntOption(raw, flag) {
90451
+ if (!/^\d+$/.test(raw.trim()))
90452
+ throw new Error(`${flag} must be a positive integer`);
90453
+ const value = Number(raw.trim());
90454
+ if (!Number.isSafeInteger(value) || value <= 0)
90455
+ throw new Error(`${flag} must be a positive integer`);
90456
+ return value;
90457
+ }
90458
+ function parseWeekdaysOption(raw) {
90459
+ const tokens = raw.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean);
90460
+ if (tokens.length === 0)
90461
+ throw new Error("--weekdays requires at least one weekday (0-6 or sun..sat)");
90462
+ const days = [];
90463
+ for (const token of tokens) {
90464
+ const mapped = WEEKDAY_TOKENS[token];
90465
+ if (mapped === undefined)
90466
+ throw new Error(`invalid weekday "${token}" (use 0-6 or sun..sat)`);
90467
+ days.push(mapped);
90468
+ }
90469
+ return [...new Set(days)].sort((a, b) => a - b);
90470
+ }
90471
+ function parseRecurrenceOptions(opts) {
90472
+ const hasRecurrenceFlags = opts.repeat !== undefined || opts.interval !== undefined || opts.weekdays !== undefined || opts.until !== undefined || opts.count !== undefined;
90473
+ if (!hasRecurrenceFlags)
90474
+ return;
90475
+ if (opts.repeat?.trim().toLowerCase() === "none")
90476
+ return null;
90477
+ if (!opts.repeat) {
90478
+ throw new Error("--repeat <hourly|daily|weekly|monthly> is required when using --interval, --weekdays, --until, or --count");
90479
+ }
90480
+ const freq = ScheduleRecurrenceFreqSchema.safeParse(opts.repeat.trim().toLowerCase());
90481
+ if (!freq.success) {
90482
+ throw new Error("--repeat must be one of hourly, daily, weekly, monthly, or none");
90483
+ }
90484
+ const interval = opts.interval ? parsePositiveIntOption(opts.interval, "--interval") : 1;
90485
+ const byWeekday = opts.weekdays ? parseWeekdaysOption(opts.weekdays) : undefined;
90486
+ const untilAt = opts.until && opts.until.trim().toLowerCase() !== "none" ? parseIsoOption(opts.until, "--until") : undefined;
90487
+ const count2 = opts.count && opts.count.trim().toLowerCase() !== "none" ? parsePositiveIntOption(opts.count, "--count") : undefined;
90488
+ return {
90489
+ freq: freq.data,
90490
+ interval,
90491
+ ...byWeekday ? { byWeekday } : {},
90492
+ ...untilAt ? { untilAt } : {},
90493
+ ...count2 ? { count: count2 } : {}
90494
+ };
90495
+ }
90496
+ function defaultLocalTimeZone() {
90497
+ const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
90498
+ return tz && isValidIanaTimeZone(tz) ? tz : "UTC";
90499
+ }
90500
+ function presentScheduleEventForAgent(event) {
90501
+ return {
90502
+ id: event.id,
90503
+ title: event.title,
90504
+ description: event.description,
90505
+ createdBy: event.createdBy.handle,
90506
+ startAt: toLocalISO(event.startAt),
90507
+ durationMinutes: event.durationMinutes,
90508
+ timeZone: event.timeZone,
90509
+ recurrence: event.recurrence ? {
90510
+ ...event.recurrence,
90511
+ ...event.recurrence.untilAt ? { untilAt: toLocalISO(event.recurrence.untilAt) } : {}
90512
+ } : null,
90513
+ nextRunAt: event.nextRunAt ? toLocalISO(event.nextRunAt) : null,
90514
+ sourceMessage: {
90515
+ accessible: event.sourceMessage.accessible,
90516
+ status: event.sourceMessage.status,
90517
+ ...event.sourceMessage.ref ? { ref: event.sourceMessage.ref } : {},
90518
+ ...event.sourceMessage.preview ? { preview: event.sourceMessage.preview } : {}
90519
+ },
90520
+ ...event.lastExecution ? {
90521
+ lastExecution: {
90522
+ scheduledAt: toLocalISO(event.lastExecution.scheduledAt),
90523
+ status: event.lastExecution.status,
90524
+ ...event.lastExecution.ackedAt ? { ackedAt: toLocalISO(event.lastExecution.ackedAt) } : {},
90525
+ ...event.lastExecution.lastError ? { lastError: event.lastExecution.lastError } : {},
90526
+ updatedAt: toLocalISO(event.lastExecution.updatedAt)
90527
+ }
90528
+ } : {},
90529
+ createdAt: toLocalISO(event.createdAt),
90530
+ updatedAt: toLocalISO(event.updatedAt)
90531
+ };
90532
+ }
90533
+ function presentOccurrenceForAgent(occ) {
90534
+ return {
90535
+ eventId: occ.eventId,
90536
+ startAt: toLocalISO(occ.startAt),
90537
+ endAt: toLocalISO(occ.endAt),
90538
+ runStatus: occ.runStatus
90539
+ };
90540
+ }
90541
+ function registerScheduleCommands(program, getApi, output2) {
90542
+ const schedule2 = program.command("schedule").description("manage the household shared schedule (owner and bots)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} });
90543
+ schedule2.command("list").description("list shared schedule events and optional expanded occurrences").option("--from <iso>", "window start (ISO-8601, pair with --to)").option("--to <iso>", "window end (ISO-8601, pair with --from)").option("--creator <handle>", "filter by creator handle (e.g. @Elwira#8700)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
90544
+ const opts = this.opts();
90545
+ const api2 = getApi();
90546
+ if (!api2.scheduleList)
90547
+ throw new Error("Schedule commands are unavailable");
90548
+ const from = opts.from ? parseIsoOption(opts.from, "--from") : undefined;
90549
+ const to = opts.to ? parseIsoOption(opts.to, "--to") : undefined;
90550
+ const res = await api2.scheduleList({
90551
+ ...from ? { from } : {},
90552
+ ...to ? { to } : {},
90553
+ ...opts.creator ? { creatorHandle: opts.creator } : {}
90554
+ });
90555
+ output2({
90556
+ success: {
90557
+ events: res.events.map(presentScheduleEventForAgent),
90558
+ ...res.occurrences.length > 0 ? { occurrences: res.occurrences.map(presentOccurrenceForAgent) } : {},
90559
+ creators: res.creators.map((c) => c.handle)
90560
+ }
90561
+ });
90562
+ });
90563
+ schedule2.command("create").description("create a shared schedule event bound to a concrete message").requiredOption("--title <text>", "event title (1-160 chars)").requiredOption("--at <iso>", "first scheduled trigger time (ISO-8601)").requiredOption("--message <ref>", "full message ref bound for reply context (e.g. /Server#1234/chan#42)").option("--description <text>", "instructions/context for the scheduled execution").option("--tz <iana>", "IANA timezone (defaults to local machine timezone)").option("--duration <minutes>", "event duration in minutes (5-1440, default 30)").option("--repeat <freq>", "recurrence frequency: hourly, daily, weekly, monthly").option("--interval <n>", "recurrence interval (default 1)").option("--weekdays <days>", "comma-separated weekdays for weekly repeat (0-6 or sun..sat)").option("--until <iso>", "recurrence end timestamp (ISO-8601)").option("--count <n>", "maximum total occurrences (1-1000)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
90564
+ const opts = this.opts();
90565
+ const api2 = getApi();
90566
+ if (!api2.scheduleCreate)
90567
+ throw new Error("Schedule commands are unavailable");
90568
+ const timeZone = opts.tz?.trim() || defaultLocalTimeZone();
90569
+ if (!isValidIanaTimeZone(timeZone))
90570
+ throw new Error(`invalid IANA timezone: ${timeZone}`);
90571
+ const recurrence = parseRecurrenceOptions(opts);
90572
+ const payload = ScheduleCreateRequestSchema.parse({
90573
+ title: opts.title,
90574
+ ...opts.description !== undefined ? { description: opts.description } : {},
90575
+ startAt: parseIsoOption(opts.at, "--at"),
90576
+ ...opts.duration !== undefined ? { durationMinutes: parsePositiveIntOption(opts.duration, "--duration") } : {},
90577
+ timeZone,
90578
+ ...recurrence !== undefined ? { recurrence } : {},
90579
+ sourceMessageRef: opts.message
90580
+ });
90581
+ const res = await api2.scheduleCreate(payload);
90582
+ output2({ success: { event: presentScheduleEventForAgent(res.event) } });
90583
+ });
90584
+ schedule2.command("update").argument("<id>", "schedule event id (sch_...)").description("update a shared schedule event").option("--title <text>", "new title").option("--description <text>", "new instructions/context").option("--at <iso>", "new start time (ISO-8601)").option("--tz <iana>", "new IANA timezone").option("--duration <minutes>", "new duration in minutes (5-1440)").option("--repeat <freq>", "hourly, daily, weekly, monthly, or none to clear recurrence").option("--interval <n>", "recurrence interval").option("--weekdays <days>", "comma-separated weekdays for weekly repeat (0-6 or sun..sat)").option("--until <iso>", "recurrence end timestamp (ISO-8601)").option("--count <n>", "maximum total occurrences").option("--message <ref>", "rebind to another accessible message ref").option("--ack", "mark the current scheduled execution as completed").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function(id4) {
90585
+ const opts = this.opts();
90586
+ const api2 = getApi();
90587
+ if (!api2.scheduleUpdate)
90588
+ throw new Error("Schedule commands are unavailable");
90589
+ if (opts.tz !== undefined && !isValidIanaTimeZone(opts.tz.trim())) {
90590
+ throw new Error(`invalid IANA timezone: ${opts.tz}`);
90591
+ }
90592
+ const recurrence = parseRecurrenceOptions(opts);
90593
+ const patch = ScheduleUpdateRequestSchema.parse({
90594
+ ...opts.title !== undefined ? { title: opts.title } : {},
90595
+ ...opts.description !== undefined ? { description: opts.description } : {},
90596
+ ...opts.at !== undefined ? { startAt: parseIsoOption(opts.at, "--at") } : {},
90597
+ ...opts.tz !== undefined ? { timeZone: opts.tz.trim() } : {},
90598
+ ...opts.duration !== undefined ? { durationMinutes: parsePositiveIntOption(opts.duration, "--duration") } : {},
90599
+ ...recurrence !== undefined ? { recurrence } : {},
90600
+ ...opts.message !== undefined ? { sourceMessageRef: opts.message } : {},
90601
+ ...opts.ack ? { ack: true } : {}
90602
+ });
90603
+ if (Object.keys(patch).length === 0) {
90604
+ throw new Error("provide at least one field to update");
90605
+ }
90606
+ const res = await api2.scheduleUpdate({ id: id4, patch });
90607
+ output2({ success: { event: presentScheduleEventForAgent(res.event) } });
90608
+ });
90609
+ schedule2.command("delete").argument("<id>", "schedule event id (sch_...)").description("delete a shared schedule event").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async (id4) => {
90610
+ const api2 = getApi();
90611
+ if (!api2.scheduleDelete)
90612
+ throw new Error("Schedule commands are unavailable");
90613
+ await api2.scheduleDelete({ id: id4 });
90614
+ output2({ success: { deleted: true, id: id4 } });
90615
+ });
90616
+ }
90617
+
90144
90618
  // src/cli/use-onboard-setup.ts
90145
90619
  import { readFile as readFile5, stat as stat2 } from "node:fs/promises";
90146
90620
  function registerOnboardSetup(use, request, output2) {
@@ -90838,10 +91312,59 @@ function createProxyServerApi(config2) {
90838
91312
  return platformCall("/bots");
90839
91313
  return platformCall("/bots/creation-requests", "POST", { requestId: req.requestId, bots: req.bots });
90840
91314
  }
91315
+ async function callScheduleList(req) {
91316
+ const params = new URLSearchParams;
91317
+ if (req.from)
91318
+ params.set("from", req.from);
91319
+ if (req.to)
91320
+ params.set("to", req.to);
91321
+ if (req.creatorHandle)
91322
+ params.set("creatorHandle", req.creatorHandle);
91323
+ const suffix = params.size > 0 ? `?${params.toString()}` : "";
91324
+ const res = await fetchImpl(`${base}/api/community/schedule/events${suffix}`, {
91325
+ method: "GET",
91326
+ headers: { authorization: `Bearer ${config2.voucher}` }
91327
+ });
91328
+ return parseJsonResponse(res, "scheduleList");
91329
+ }
91330
+ async function callScheduleCreate(req) {
91331
+ const res = await fetchImpl(`${base}/api/community/schedule/events`, {
91332
+ method: "POST",
91333
+ headers: {
91334
+ "content-type": "application/json",
91335
+ authorization: `Bearer ${config2.voucher}`
91336
+ },
91337
+ body: JSON.stringify(req)
91338
+ });
91339
+ return parseJsonResponse(res, "scheduleCreate");
91340
+ }
91341
+ async function callScheduleUpdate(req) {
91342
+ const res = await fetchImpl(`${base}/api/community/schedule/events/${encodeURIComponent(req.id)}`, {
91343
+ method: "PATCH",
91344
+ headers: {
91345
+ "content-type": "application/json",
91346
+ authorization: `Bearer ${config2.voucher}`
91347
+ },
91348
+ body: JSON.stringify(req.patch)
91349
+ });
91350
+ return parseJsonResponse(res, "scheduleUpdate");
91351
+ }
91352
+ async function callScheduleDelete(req) {
91353
+ const res = await fetchImpl(`${base}/api/community/schedule/events/${encodeURIComponent(req.id)}`, {
91354
+ method: "DELETE",
91355
+ headers: { authorization: `Bearer ${config2.voucher}` }
91356
+ });
91357
+ await parseJsonResponse(res, "scheduleDelete");
91358
+ return { deleted: true };
91359
+ }
90841
91360
  return {
90842
91361
  platformFeedback: (req) => platformCall("/platform/feedback", "POST", req),
90843
91362
  platformMachine: callPlatformMachine,
90844
91363
  platformBot: callPlatformBot,
91364
+ scheduleList: callScheduleList,
91365
+ scheduleCreate: callScheduleCreate,
91366
+ scheduleUpdate: callScheduleUpdate,
91367
+ scheduleDelete: callScheduleDelete,
90845
91368
  listServers: (_r) => callListServers(),
90846
91369
  joinServer: callJoinServer,
90847
91370
  leaveServer: callLeaveServer,
@@ -91735,6 +92258,7 @@ function buildProgram(stdin) {
91735
92258
  writeErr: () => {}
91736
92259
  }).option("--agent <id>", "agent identity (or ALOOK_AGENT_ID env)");
91737
92260
  registerPlatformCommands(program, getApi, printEnvelope, () => readLiteralInput({ command: "platform feedback", stdinSelected: true, stdin, maxBytes: BOT_FEEDBACK_MAX_BYTES }));
92261
+ registerScheduleCommands(program, getApi, printEnvelope);
91738
92262
  registerUseCommands(program, printEnvelope);
91739
92263
  registerPiiCommands(program, printEnvelope);
91740
92264
  const message = program.command("message").description("message operations").exitOverride();