@alook/daemon 0.1.45 → 0.1.46

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
@@ -23020,7 +23020,7 @@ var REASONING_EFFORT_RE = /^[A-Za-z0-9._-]+$/;
23020
23020
  var COMMUNITY_REASONING_EFFORT_MAX = 32;
23021
23021
  var COMMUNITY_REASONING_DESCRIPTION_MAX = 256;
23022
23022
  var COMMUNITY_REASONING_OPTIONS_MAX = 16;
23023
- var COMMUNITY_REASONING_MODELS_MAX = 512;
23023
+ var COMMUNITY_REASONING_MODELS_MAX = 1024;
23024
23024
  var ReasoningEffortSchema = exports_external.string().min(1).max(COMMUNITY_REASONING_EFFORT_MAX).regex(REASONING_EFFORT_RE, "invalid reasoning effort charset");
23025
23025
  var RuntimeReasoningOptionSchema = exports_external.object({
23026
23026
  value: ReasoningEffortSchema,
@@ -23050,18 +23050,22 @@ var RuntimeReasoningModelSchema = exports_external.object({
23050
23050
  var RuntimeReasoningCatalogSchema = exports_external.object({
23051
23051
  updateMode: exports_external.enum(["live_next_turn", "context_preserving_restart", "unsupported"]),
23052
23052
  defaultModelId: exports_external.string().min(1).max(100).optional().catch(undefined),
23053
- models: exports_external.array(exports_external.unknown()).max(COMMUNITY_REASONING_MODELS_MAX).transform((models) => {
23053
+ models: exports_external.array(exports_external.unknown()).transform((models) => {
23054
23054
  const seen = new Set;
23055
- return models.flatMap((candidate) => {
23055
+ const retained = [];
23056
+ for (const candidate of models) {
23056
23057
  const parsed = RuntimeReasoningModelSchema.safeParse(candidate);
23057
23058
  if (!parsed.success)
23058
- return [];
23059
+ continue;
23059
23060
  const model = parsed.data;
23060
23061
  if (seen.has(model.id))
23061
- return [];
23062
+ continue;
23062
23063
  seen.add(model.id);
23063
- return [model];
23064
- });
23064
+ retained.push(model);
23065
+ if (retained.length >= COMMUNITY_REASONING_MODELS_MAX)
23066
+ break;
23067
+ }
23068
+ return retained;
23065
23069
  })
23066
23070
  });
23067
23071
  var CommunityMachineRuntimeSchema = exports_external.object({
@@ -23899,7 +23903,7 @@ function maxRowsPerInsert(paramsPerRow) {
23899
23903
 
23900
23904
  // ../shared/src/db/queries/community/message.ts
23901
23905
  var log = createLogger({ service: "community-queries" });
23902
- var listedMessageProjection = {
23906
+ var messageProjection = {
23903
23907
  id: communityMessage.id,
23904
23908
  authorId: communityMessage.authorId,
23905
23909
  content: communityMessage.content,
@@ -23907,16 +23911,19 @@ var listedMessageProjection = {
23907
23911
  mentionType: communityMessage.mentionType,
23908
23912
  replyToId: communityMessage.replyToId,
23909
23913
  embeds: communityMessage.embeds,
23910
- seq: communityMessage.seq,
23911
23914
  createdAt: communityMessage.createdAt,
23912
23915
  channelId: communityMessage.channelId,
23913
- friendshipId: communityMessage.friendshipId,
23914
- clientNonce: communityMessage.clientNonce,
23915
23916
  authorName: user.name,
23916
- authorEmail: user.email,
23917
23917
  authorImage: user.image,
23918
23918
  authorAvatarVersion: user.avatarVersion
23919
23919
  };
23920
+ var listedMessageProjection = {
23921
+ ...messageProjection,
23922
+ seq: communityMessage.seq,
23923
+ friendshipId: communityMessage.friendshipId,
23924
+ clientNonce: communityMessage.clientNonce,
23925
+ authorEmail: user.email
23926
+ };
23920
23927
  var wakeContextMessageProjection = {
23921
23928
  id: communityMessage.id,
23922
23929
  authorId: communityMessage.authorId,
@@ -24035,26 +24042,207 @@ var AGENT_UNREAD_CHANNEL_CHUNK_SIZE = maxInParams(13);
24035
24042
 
24036
24043
  // ../shared/src/db/queries/community/mention.ts
24037
24044
  var MENTION_INSERT_MAX_ROWS = maxRowsPerInsert(5);
24038
- // ../shared/src/community-ws-events.ts
24039
- var string4 = exports_external.string();
24040
- var nullableString = string4.nullable();
24041
- var channelTypeSchema = exports_external.enum(["text", "forum"]);
24042
- var mentionTypeSchema = exports_external.literal("everyone");
24043
- var friendApprovalProfileSchema = exports_external.strictObject({
24044
- id: string4,
24045
- name: string4,
24046
- discriminator: string4,
24047
- image: nullableString,
24045
+ // ../shared/src/community-friend-approval.ts
24046
+ var profile = exports_external.strictObject({
24047
+ id: exports_external.string(),
24048
+ name: exports_external.string(),
24049
+ discriminator: exports_external.string(),
24050
+ image: exports_external.string().nullable(),
24048
24051
  avatarVersion: exports_external.number().int().nonnegative()
24049
24052
  });
24050
24053
  var FriendApprovalPayloadSchema = exports_external.strictObject({
24051
- friendshipId: string4,
24054
+ friendshipId: exports_external.string(),
24052
24055
  status: exports_external.enum(["pending", "approved", "denied", "superseded", "cancelled"]),
24053
24056
  waitingOn: exports_external.enum(["you", "other-owner", "addressee"]).nullable(),
24054
- otherProfile: friendApprovalProfileSchema,
24055
- botProfile: friendApprovalProfileSchema,
24056
- waitingOnProfile: friendApprovalProfileSchema.nullable().optional()
24057
+ otherProfile: profile,
24058
+ botProfile: profile,
24059
+ waitingOnProfile: profile.nullable().optional()
24060
+ });
24061
+
24062
+ // ../shared/src/community-contract.ts
24063
+ var COMMUNITY_CONTRACT_VERSION = 2;
24064
+
24065
+ // ../shared/src/community-resources.ts
24066
+ var id2 = exports_external.string().min(1);
24067
+ var nullableId = id2.nullable();
24068
+ var legacyArchivedSchema = exports_external.union([exports_external.boolean(), exports_external.literal(0), exports_external.literal(1)]).transform((value) => value === true || value === 1);
24069
+ var CommunityChannelResourceSchema = exports_external.strictObject({
24070
+ id: id2,
24071
+ type: exports_external.enum(["text", "forum", "thread", "dm"]),
24072
+ serverId: nullableId,
24073
+ categoryId: nullableId,
24074
+ name: exports_external.string().nullable(),
24075
+ topic: exports_external.string(),
24076
+ parentChannelId: nullableId,
24077
+ parentMessageId: nullableId,
24078
+ creatorId: nullableId,
24079
+ position: exports_external.number(),
24080
+ archived: exports_external.boolean(),
24081
+ createdAt: exports_external.string(),
24082
+ lastMessageAt: exports_external.string().nullable(),
24083
+ messageCount: exports_external.number().int().nonnegative()
24084
+ });
24085
+ var CommunityChannelIdentitySchema = CommunityChannelResourceSchema.pick({
24086
+ id: true,
24087
+ type: true,
24088
+ serverId: true,
24089
+ name: true,
24090
+ parentChannelId: true,
24091
+ parentMessageId: true,
24092
+ creatorId: true,
24093
+ archived: true,
24094
+ lastMessageAt: true,
24095
+ createdAt: true
24096
+ }).partial({ createdAt: true }).strip();
24097
+ var legacyChannelIdentitySchema = CommunityChannelIdentitySchema.extend({
24098
+ archived: legacyArchivedSchema,
24099
+ parentChannelId: nullableId.default(null),
24100
+ parentMessageId: nullableId.default(null),
24101
+ creatorId: nullableId.default(null),
24102
+ lastMessageAt: CommunityChannelResourceSchema.shape.lastMessageAt.default(null)
24103
+ });
24104
+ var CommunityAccessDecisionSchema = exports_external.strictObject({
24105
+ channelId: id2,
24106
+ canRead: exports_external.boolean(),
24107
+ canSend: exports_external.boolean(),
24108
+ canCreateDiscussion: exports_external.boolean()
24109
+ });
24110
+ var CommunityMessageAttachmentSchema = exports_external.strictObject({
24111
+ kind: exports_external.enum(["image", "file"]),
24112
+ name: exports_external.string(),
24113
+ url: exports_external.string(),
24114
+ thumbnailUrl: exports_external.string().optional(),
24115
+ contentType: exports_external.string().optional(),
24116
+ size: exports_external.string().optional(),
24117
+ sizeBytes: exports_external.number().nonnegative().optional(),
24118
+ width: exports_external.number().nonnegative().optional(),
24119
+ height: exports_external.number().nonnegative().optional()
24120
+ });
24121
+ var CommunityMessageResourceSchema = exports_external.strictObject({
24122
+ id: id2,
24123
+ channelId: id2,
24124
+ seq: exports_external.number().int().nonnegative(),
24125
+ authorId: id2,
24126
+ createdAt: exports_external.string(),
24127
+ type: exports_external.enum(["chat", "system"]),
24128
+ content: exports_external.string(),
24129
+ replyToId: nullableId,
24130
+ clientNonce: exports_external.string().nullable(),
24131
+ attachments: exports_external.array(CommunityMessageAttachmentSchema),
24132
+ systemKind: exports_external.literal("thread").optional(),
24133
+ authorName: exports_external.string().optional(),
24134
+ authorAvatar: exports_external.string().optional(),
24135
+ authorAvatarVersion: exports_external.number().int().nonnegative().optional(),
24136
+ mentionType: exports_external.literal("everyone").nullable().optional(),
24137
+ replyTo: exports_external.strictObject({
24138
+ id: id2,
24139
+ authorId: id2.optional(),
24140
+ authorName: exports_external.string(),
24141
+ text: exports_external.string(),
24142
+ deleted: exports_external.boolean().optional()
24143
+ }).optional(),
24144
+ embeds: exports_external.array(exports_external.unknown()).optional(),
24145
+ reactions: exports_external.array(exports_external.strictObject({
24146
+ emoji: exports_external.string(),
24147
+ count: exports_external.number().int().nonnegative(),
24148
+ me: exports_external.boolean(),
24149
+ userIds: exports_external.array(id2)
24150
+ })).optional(),
24151
+ thread: exports_external.strictObject({
24152
+ id: id2,
24153
+ name: exports_external.string(),
24154
+ messageCount: exports_external.number().int().nonnegative(),
24155
+ lastReplyAt: exports_external.string().optional(),
24156
+ tags: exports_external.array(exports_external.string()).optional(),
24157
+ preview: exports_external.string().optional(),
24158
+ participants: exports_external.array(exports_external.strictObject({ id: id2, name: exports_external.string(), avatar: exports_external.string(), avatarVersion: exports_external.number().int().nonnegative() })).optional(),
24159
+ participantCount: exports_external.number().int().nonnegative().optional()
24160
+ }).optional(),
24161
+ approval: FriendApprovalPayloadSchema.optional()
24162
+ });
24163
+ var CommunityReadStateResourceSchema = exports_external.strictObject({
24164
+ channelId: id2,
24165
+ lastReadMessageId: nullableId,
24166
+ lastReadAt: exports_external.string().nullable(),
24167
+ lastReadSeq: exports_external.number().int().nonnegative()
24168
+ });
24169
+ var CommunityMemberRelationSchema = exports_external.strictObject({
24170
+ channelId: id2,
24171
+ userId: id2,
24172
+ relation: exports_external.enum(["access", "notify"]),
24173
+ source: exports_external.string(),
24174
+ isCreator: exports_external.boolean(),
24175
+ role: exports_external.string().nullable(),
24176
+ memberId: nullableId
24177
+ });
24178
+ var CommunityResourceProfileSchema = exports_external.strictObject({
24179
+ id: id2,
24180
+ name: exports_external.string(),
24181
+ discriminator: exports_external.string().nullable(),
24182
+ avatar: exports_external.string().nullable(),
24183
+ avatarVersion: exports_external.number().int().nonnegative(),
24184
+ statusEmoji: exports_external.string().nullable(),
24185
+ statusText: exports_external.string()
24186
+ });
24187
+ var CommunityPageSchema = exports_external.strictObject({
24188
+ olderCursor: exports_external.string().nullable(),
24189
+ newerCursor: exports_external.string().nullable(),
24190
+ hasMoreOlder: exports_external.boolean(),
24191
+ hasMoreNewer: exports_external.boolean(),
24192
+ latestSeq: exports_external.number().int().nonnegative()
24193
+ });
24194
+ var envelope = { contractVersion: exports_external.literal(COMMUNITY_CONTRACT_VERSION), channelId: id2 };
24195
+ var CommunityChannelReadSchema = exports_external.strictObject({ ...envelope, channel: CommunityChannelResourceSchema, access: CommunityAccessDecisionSchema });
24196
+ var CommunityMessagesReadSchema = exports_external.strictObject({
24197
+ ...envelope,
24198
+ messages: exports_external.array(CommunityMessageResourceSchema),
24199
+ page: CommunityPageSchema,
24200
+ surfaceReceipt: exports_external.strictObject({ channelId: id2, surfaceKind: exports_external.enum(["channel", "forum", "thread", "dm"]) })
24201
+ });
24202
+ var CommunityReadStateReadSchema = exports_external.strictObject({ ...envelope, readState: CommunityReadStateResourceSchema });
24203
+ var CommunityMembersReadSchema = exports_external.strictObject({ ...envelope, relation: exports_external.enum(["access", "notify"]), members: exports_external.array(CommunityMemberRelationSchema), profiles: exports_external.array(CommunityResourceProfileSchema) });
24204
+ var CommunityThreadsReadSchema = exports_external.strictObject({
24205
+ ...envelope,
24206
+ channel: CommunityChannelResourceSchema,
24207
+ threads: exports_external.array(CommunityChannelResourceSchema),
24208
+ included: exports_external.strictObject({
24209
+ messages: exports_external.array(CommunityMessageResourceSchema),
24210
+ members: exports_external.array(CommunityMemberRelationSchema),
24211
+ profiles: exports_external.array(CommunityResourceProfileSchema),
24212
+ tags: exports_external.array(exports_external.strictObject({ messageId: id2, tag: exports_external.string() })),
24213
+ participantCounts: exports_external.array(exports_external.strictObject({ channelId: id2, count: exports_external.number().int().nonnegative() }))
24214
+ }),
24215
+ page: exports_external.strictObject({ nextCursor: exports_external.string().nullable(), hasMore: exports_external.boolean() })
24216
+ });
24217
+ var CommunityReadAdvanceSchema = exports_external.strictObject({ ...envelope, changed: exports_external.boolean(), targetSeq: exports_external.number().int().nonnegative(), revision: exports_external.number().int().nonnegative() });
24218
+ var CommunityReadErrorSchema = exports_external.strictObject({ contractVersion: exports_external.literal(COMMUNITY_CONTRACT_VERSION), error: exports_external.strictObject({
24219
+ code: exports_external.enum(["invalid_input", "invalid_reply_target", "unauthenticated", "not_found", "not_allowed", "blocked", "idempotency_conflict", "rate_limited", "temporarily_unavailable"]),
24220
+ message: exports_external.string(),
24221
+ retryable: exports_external.boolean()
24222
+ }) });
24223
+ var legacyChannelResourceSchema = CommunityChannelResourceSchema.strip().extend({
24224
+ topic: CommunityChannelResourceSchema.shape.topic.nullish().transform((value) => value ?? ""),
24225
+ position: CommunityChannelResourceSchema.shape.position.nullish().transform((value) => value ?? 0),
24226
+ messageCount: CommunityChannelResourceSchema.shape.messageCount.nullish().transform((value) => value ?? 0),
24227
+ categoryId: nullableId.default(null),
24228
+ parentChannelId: nullableId.default(null),
24229
+ parentMessageId: nullableId.default(null),
24230
+ creatorId: nullableId.default(null),
24231
+ lastMessageAt: CommunityChannelResourceSchema.shape.lastMessageAt.default(null),
24232
+ archived: legacyArchivedSchema
24233
+ });
24234
+ var legacyMessageResourceSchema = CommunityMessageResourceSchema.strip().extend({
24235
+ channelId: id2.optional(),
24236
+ replyToId: nullableId.optional(),
24237
+ clientNonce: CommunityMessageResourceSchema.shape.clientNonce.default(null),
24238
+ attachments: CommunityMessageResourceSchema.shape.attachments.default([]),
24239
+ embeds: CommunityMessageResourceSchema.shape.embeds.nullable().transform((value) => value ?? undefined)
24057
24240
  });
24241
+
24242
+ // ../shared/src/community-ws-events.ts
24243
+ var string4 = exports_external.string();
24244
+ var nullableString = string4.nullable();
24245
+ var channelTypeSchema = CommunityChannelResourceSchema.shape.type.extract(["text", "forum"]);
24058
24246
  var messageAttachmentSchema = exports_external.strictObject({
24059
24247
  id: string4,
24060
24248
  filename: string4,
@@ -24065,30 +24253,29 @@ var messageAttachmentSchema = exports_external.strictObject({
24065
24253
  width: exports_external.number().nullable().optional(),
24066
24254
  height: exports_external.number().nullable().optional()
24067
24255
  });
24068
- var messageSchema = exports_external.strictObject({
24256
+ var messageSchema = CommunityMessageResourceSchema.pick({
24257
+ content: true,
24258
+ type: true,
24259
+ systemKind: true,
24260
+ authorAvatar: true,
24261
+ authorAvatarVersion: true,
24262
+ mentionType: true,
24263
+ embeds: true,
24264
+ createdAt: true,
24265
+ approval: true
24266
+ }).extend({
24069
24267
  id: string4,
24070
24268
  seq: exports_external.number(),
24071
24269
  authorId: string4,
24072
24270
  authorName: string4,
24073
- authorAvatar: string4.optional(),
24074
- authorAvatarVersion: exports_external.number().int().nonnegative(),
24075
- content: string4,
24076
- type: exports_external.enum(["chat", "system"]),
24077
- systemKind: exports_external.literal("thread").optional(),
24078
- mentionType: mentionTypeSchema.nullable().optional(),
24271
+ authorAvatarVersion: CommunityMessageResourceSchema.shape.authorAvatarVersion.unwrap(),
24079
24272
  replyToId: nullableString.optional(),
24080
- replyTo: exports_external.strictObject({
24273
+ replyTo: CommunityMessageResourceSchema.shape.replyTo.unwrap().extend({
24081
24274
  id: string4,
24082
- authorId: string4.optional(),
24083
- authorName: string4,
24084
- text: string4,
24085
- deleted: exports_external.boolean().optional()
24275
+ authorId: string4.optional()
24086
24276
  }).optional(),
24087
- embeds: exports_external.array(exports_external.unknown()).optional(),
24088
24277
  attachments: exports_external.array(messageAttachmentSchema).optional(),
24089
- createdAt: string4,
24090
- clientNonce: string4.optional(),
24091
- approval: FriendApprovalPayloadSchema.optional()
24278
+ clientNonce: string4.optional()
24092
24279
  });
24093
24280
  var communityMessageCreateSchema = exports_external.strictObject({
24094
24281
  type: exports_external.literal("community:message.create"),
@@ -24235,6 +24422,14 @@ var communityChannelMemberRemoveSchema = exports_external.strictObject({
24235
24422
  channelId: string4,
24236
24423
  userId: string4
24237
24424
  });
24425
+ var communityChannelMembershipChangeSchema = exports_external.strictObject({
24426
+ type: exports_external.literal("community:channel.membership.change"),
24427
+ channelId: string4,
24428
+ serverId: string4.nullable(),
24429
+ userId: string4,
24430
+ relation: CommunityMemberRelationSchema.shape.relation,
24431
+ present: exports_external.boolean()
24432
+ });
24238
24433
  var communityCategoryCreateSchema = exports_external.strictObject({
24239
24434
  type: exports_external.literal("community:category.create"),
24240
24435
  serverId: string4,
@@ -24319,7 +24514,8 @@ var communityFriendRemoveSchema = exports_external.strictObject({
24319
24514
  });
24320
24515
  var communityFriendBlockSchema = exports_external.strictObject({
24321
24516
  type: exports_external.literal("community:friend.block"),
24322
- userId: string4
24517
+ userId: string4,
24518
+ blockedByViewer: exports_external.boolean().optional()
24323
24519
  });
24324
24520
  var communityInviteCreateSchema = exports_external.strictObject({
24325
24521
  type: exports_external.literal("community:invite.create"),
@@ -24462,6 +24658,7 @@ var CommunityWsEventDiscriminatedSchema = exports_external.discriminatedUnion("t
24462
24658
  communityChannelReorderSchema,
24463
24659
  communityChannelMemberAddSchema,
24464
24660
  communityChannelMemberRemoveSchema,
24661
+ communityChannelMembershipChangeSchema,
24465
24662
  communityCategoryCreateSchema,
24466
24663
  communityCategoryUpdateSchema,
24467
24664
  communityCategoryDeleteSchema,
@@ -24510,6 +24707,7 @@ var WS_EVENTS = {
24510
24707
  CHANNEL_REORDER: "community:channel.reorder",
24511
24708
  CHANNEL_MEMBER_ADD: "community:channel.member_add",
24512
24709
  CHANNEL_MEMBER_REMOVE: "community:channel.member_remove",
24710
+ CHANNEL_MEMBERSHIP_CHANGE: "community:channel.membership.change",
24513
24711
  CATEGORY_CREATE: "community:category.create",
24514
24712
  CATEGORY_UPDATE: "community:category.update",
24515
24713
  CATEGORY_DELETE: "community:category.delete",
@@ -24579,6 +24777,8 @@ var batchShape = exports_external.strictObject({
24579
24777
  unreadMentionUserIds: targetList,
24580
24778
  mentionUserIds: targetList,
24581
24779
  memberAdded: memberAddedSchema.optional(),
24780
+ joinedParticipantUserIds: targetList.optional(),
24781
+ rosterRefreshUserId: target.optional(),
24582
24782
  parentProjection: exports_external.unknown().optional(),
24583
24783
  parentProjectionUserIds: targetList.optional()
24584
24784
  });
@@ -26225,27 +26425,27 @@ async function queryNativeRows(path4, cursor, loadSqlite = async () => {
26225
26425
  }
26226
26426
 
26227
26427
  // agent-driver/dist/internal/modelCatalog.js
26228
- var RUNTIME_MODEL_CATALOG_MAX = 512;
26428
+ var RUNTIME_MODEL_CATALOG_MAX = 1024;
26229
26429
  var RUNTIME_MODEL_ID_MAX = 100;
26230
26430
  function normalizeRuntimeModelId(value) {
26231
26431
  if (typeof value !== "string")
26232
26432
  return;
26233
- const id2 = value.trim();
26234
- if (!id2 || id2.length > RUNTIME_MODEL_ID_MAX || /\s/.test(id2))
26433
+ const id3 = value.trim();
26434
+ if (!id3 || id3.length > RUNTIME_MODEL_ID_MAX || /\s/.test(id3))
26235
26435
  return;
26236
- return id2;
26436
+ return id3;
26237
26437
  }
26238
26438
  function catalogFromIds(ids) {
26239
26439
  const seen = new Set;
26240
26440
  const models = [];
26241
26441
  for (const rawId of ids) {
26242
- const id2 = normalizeRuntimeModelId(rawId);
26243
- if (!id2 || seen.has(id2))
26442
+ const id3 = normalizeRuntimeModelId(rawId);
26443
+ if (!id3 || seen.has(id3))
26244
26444
  continue;
26245
26445
  if (models.length >= RUNTIME_MODEL_CATALOG_MAX)
26246
- return;
26247
- seen.add(id2);
26248
- models.push({ id: id2, supportedReasoningEfforts: [] });
26446
+ break;
26447
+ seen.add(id3);
26448
+ models.push({ id: id3, supportedReasoningEfforts: [] });
26249
26449
  }
26250
26450
  if (models.length === 0)
26251
26451
  return;
@@ -26253,8 +26453,8 @@ function catalogFromIds(ids) {
26253
26453
  }
26254
26454
  function parseOpenCodeModelCatalog(output2) {
26255
26455
  const ids = output2.split(/\r?\n/).flatMap((line) => {
26256
- const id2 = normalizeRuntimeModelId(line);
26257
- return id2 && /^[^/]+\/.+$/.test(id2) ? [id2] : [];
26456
+ const id3 = normalizeRuntimeModelId(line);
26457
+ return id3 && /^[^/]+\/.+$/.test(id3) ? [id3] : [];
26258
26458
  });
26259
26459
  return catalogFromIds(ids);
26260
26460
  }
@@ -26266,16 +26466,16 @@ function parsePiModelCatalog(values) {
26266
26466
  return [];
26267
26467
  const model = value;
26268
26468
  const provider = normalizeRuntimeModelId(model.provider);
26269
- const id2 = normalizeRuntimeModelId(model.id);
26270
- return provider && id2 && !provider.includes("/") ? [`${provider}/${id2}`] : [];
26469
+ const id3 = normalizeRuntimeModelId(model.id);
26470
+ return provider && id3 && !provider.includes("/") ? [`${provider}/${id3}`] : [];
26271
26471
  });
26272
26472
  return catalogFromIds(ids);
26273
26473
  }
26274
26474
 
26275
26475
  // agent-driver/dist/internal/utils.js
26276
26476
  import { randomUUID as randomUUID3 } from "crypto";
26277
- function jsonRpcRequest(method, params, id2) {
26278
- return JSON.stringify({ jsonrpc: "2.0", id: id2 ?? randomUUID3(), method, params });
26477
+ function jsonRpcRequest(method, params, id3) {
26478
+ return JSON.stringify({ jsonrpc: "2.0", id: id3 ?? randomUUID3(), method, params });
26279
26479
  }
26280
26480
  function tryParseJsonLine(line) {
26281
26481
  try {
@@ -26293,26 +26493,28 @@ function tryParseJsonRecord(line) {
26293
26493
 
26294
26494
  // agent-driver/dist/adapters/antigravity/catalog.js
26295
26495
  function choices(value) {
26296
- if (!Array.isArray(value) || value.length > RUNTIME_MODEL_CATALOG_MAX)
26496
+ if (!Array.isArray(value))
26297
26497
  return [];
26298
26498
  const rows = [];
26499
+ const seen = new Set;
26299
26500
  for (const item of value) {
26300
26501
  const row = asRecord(item);
26301
26502
  if (!row)
26302
26503
  continue;
26303
26504
  const nested2 = Array.isArray(row.options) ? row.options : [row];
26304
- if (nested2.length + rows.length > RUNTIME_MODEL_CATALOG_MAX)
26305
- return [];
26306
26505
  for (const child of nested2) {
26307
26506
  const option = asRecord(child);
26308
- const id2 = normalizeRuntimeModelId(option?.value ?? option?.modelId);
26309
- if (!id2)
26507
+ const id3 = normalizeRuntimeModelId(option?.value ?? option?.modelId);
26508
+ if (!id3 || seen.has(id3))
26310
26509
  continue;
26510
+ seen.add(id3);
26311
26511
  const name = option?.name;
26312
- rows.push({ id: id2, ...typeof name === "string" && name.length <= 256 ? { displayName: name } : {} });
26512
+ rows.push({ id: id3, ...typeof name === "string" && name.length <= 256 ? { displayName: name } : {} });
26513
+ if (rows.length >= RUNTIME_MODEL_CATALOG_MAX)
26514
+ return rows;
26313
26515
  }
26314
26516
  }
26315
- return rows.filter((row, index2) => rows.findIndex((other) => other.id === row.id) === index2);
26517
+ return rows;
26316
26518
  }
26317
26519
  function parseAntigravityCatalog(value) {
26318
26520
  const session2 = asRecord(value);
@@ -26329,8 +26531,8 @@ function parseAntigravityCatalog(value) {
26329
26531
  ...configId ? { configId } : {}
26330
26532
  };
26331
26533
  }
26332
- function variant(id2) {
26333
- const match = /^(gemini-[a-z0-9.-]+)-(high|medium|low)$/.exec(id2);
26534
+ function variant(id3) {
26535
+ const match = /^(gemini-[a-z0-9.-]+)-(high|medium|low)$/.exec(id3);
26334
26536
  return match ? { family: match[1], effort: match[2] } : undefined;
26335
26537
  }
26336
26538
  function antigravityReasoningCatalog(catalog) {
@@ -26746,7 +26948,7 @@ class AntigravityAcpLane {
26746
26948
  return this.request(method, params, this.options.handshakeTimeoutMs ?? HANDSHAKE_TIMEOUT_MS).promise;
26747
26949
  }
26748
26950
  request(method, params, timeoutMs) {
26749
- const id2 = ++this.requestSequence;
26951
+ const id3 = ++this.requestSequence;
26750
26952
  let resolve2;
26751
26953
  let reject;
26752
26954
  const promise2 = new Promise((accept, decline) => {
@@ -26754,24 +26956,24 @@ class AntigravityAcpLane {
26754
26956
  reject = decline;
26755
26957
  });
26756
26958
  const timer = timeoutMs === undefined ? undefined : setTimeout(() => {
26757
- const pending = this.pending.get(id2);
26959
+ const pending = this.pending.get(id3);
26758
26960
  if (!pending || pending.kind !== "call")
26759
26961
  return;
26760
- this.pending.delete(id2);
26962
+ this.pending.delete(id3);
26761
26963
  pending.reject(new Error(`Antigravity ACP ${method} timed out`));
26762
26964
  }, timeoutMs);
26763
26965
  timer?.unref?.();
26764
- this.pending.set(id2, { kind: "call", method, resolve: resolve2, reject, ...timer ? { timer } : {} });
26966
+ this.pending.set(id3, { kind: "call", method, resolve: resolve2, reject, ...timer ? { timer } : {} });
26765
26967
  try {
26766
- this.write({ jsonrpc: "2.0", id: id2, method, params });
26968
+ this.write({ jsonrpc: "2.0", id: id3, method, params });
26767
26969
  } catch (error62) {
26768
- const pending = this.pending.get(id2);
26769
- this.pending.delete(id2);
26970
+ const pending = this.pending.get(id3);
26971
+ this.pending.delete(id3);
26770
26972
  if (pending?.kind === "call" && pending.timer)
26771
26973
  clearTimeout(pending.timer);
26772
26974
  throw error62 instanceof Error ? error62 : new Error(String(error62));
26773
26975
  }
26774
- return { id: id2, promise: promise2 };
26976
+ return { id: id3, promise: promise2 };
26775
26977
  }
26776
26978
  write(message2) {
26777
26979
  const stdin = this.process?.stdin;
@@ -26882,14 +27084,14 @@ class AntigravityAcpLane {
26882
27084
  }
26883
27085
  this.protocolFailure("Antigravity ACP emitted an unrecognized JSON-RPC message");
26884
27086
  }
26885
- handleResponse(id2, message2) {
26886
- const pending = typeof id2 === "number" ? this.pending.get(id2) : undefined;
26887
- if (typeof id2 !== "number" || !pending) {
27087
+ handleResponse(id3, message2) {
27088
+ const pending = typeof id3 === "number" ? this.pending.get(id3) : undefined;
27089
+ if (typeof id3 !== "number" || !pending) {
26888
27090
  this.diagnostic("warning", "Antigravity ACP emitted a duplicate or unknown response id");
26889
27091
  return;
26890
27092
  }
26891
27093
  if (pending.kind === "prompt") {
26892
- this.pending.delete(id2);
27094
+ this.pending.delete(id3);
26893
27095
  const finish = () => {
26894
27096
  if (message2.error !== undefined) {
26895
27097
  const payload = record2(message2.error);
@@ -26933,23 +27135,23 @@ class AntigravityAcpLane {
26933
27135
  if (message2.error !== undefined) {
26934
27136
  const payload = record2(message2.error);
26935
27137
  if (/authentication required|not authenticated|login required/i.test(rpcErrorMessage(message2.error))) {
26936
- this.settleRequest(id2, false, new AntigravityAcpAuthenticationError("Antigravity ACP requires local authentication; complete its Google sign-in before starting this agent"));
27138
+ this.settleRequest(id3, false, new AntigravityAcpAuthenticationError("Antigravity ACP requires local authentication; complete its Google sign-in before starting this agent"));
26937
27139
  return;
26938
27140
  }
26939
- this.settleRequest(id2, false, new AntigravityAcpRpcError(pending.method, typeof payload?.code === "number" ? payload.code : undefined, rpcErrorMessage(message2.error)));
27141
+ this.settleRequest(id3, false, new AntigravityAcpRpcError(pending.method, typeof payload?.code === "number" ? payload.code : undefined, rpcErrorMessage(message2.error)));
26940
27142
  return;
26941
27143
  }
26942
27144
  if (!("result" in message2)) {
26943
- this.settleRequest(id2, false, new Error("Antigravity ACP response omitted result"));
27145
+ this.settleRequest(id3, false, new Error("Antigravity ACP response omitted result"));
26944
27146
  return;
26945
27147
  }
26946
- this.settleRequest(id2, true, message2.result);
27148
+ this.settleRequest(id3, true, message2.result);
26947
27149
  }
26948
- settleRequest(id2, ok, value) {
26949
- const pending = this.pending.get(id2);
27150
+ settleRequest(id3, ok, value) {
27151
+ const pending = this.pending.get(id3);
26950
27152
  if (!pending || pending.kind !== "call")
26951
27153
  return;
26952
- this.pending.delete(id2);
27154
+ this.pending.delete(id3);
26953
27155
  if (pending.timer)
26954
27156
  clearTimeout(pending.timer);
26955
27157
  if (ok)
@@ -26957,11 +27159,11 @@ class AntigravityAcpLane {
26957
27159
  else
26958
27160
  pending.reject(value instanceof Error ? value : new Error(String(value)));
26959
27161
  }
26960
- handleRequest(id2, method, params) {
27162
+ handleRequest(id3, method, params) {
26961
27163
  if (method !== "session/request_permission") {
26962
27164
  this.write({
26963
27165
  jsonrpc: "2.0",
26964
- id: id2,
27166
+ id: id3,
26965
27167
  error: { code: -32601, message: "Unsupported Antigravity ACP client request" }
26966
27168
  });
26967
27169
  this.diagnostic("warning", `Unsupported Antigravity ACP client request: ${safeLabel(method)}`);
@@ -26972,13 +27174,13 @@ class AntigravityAcpLane {
26972
27174
  const options = Array.isArray(payload?.options) ? payload.options.map(record2).filter(Boolean) : [];
26973
27175
  const allowOnce = options.find((option) => option.kind === "allow_once" && typeof option.optionId === "string" && option.optionId.trim().length > 0);
26974
27176
  if (!this.ready || this.cancelling || this.currentPromptRequestId === null || !sameSession || !allowOnce) {
26975
- this.write({ jsonrpc: "2.0", id: id2, result: { outcome: { outcome: "cancelled" } } });
27177
+ this.write({ jsonrpc: "2.0", id: id3, result: { outcome: { outcome: "cancelled" } } });
26976
27178
  this.diagnostic("error", "Antigravity ACP permission request was not allowed for the active prompt");
26977
27179
  return;
26978
27180
  }
26979
27181
  this.write({
26980
27182
  jsonrpc: "2.0",
26981
- id: id2,
27183
+ id: id3,
26982
27184
  result: { outcome: { outcome: "selected", optionId: allowOnce.optionId } }
26983
27185
  });
26984
27186
  }
@@ -27085,8 +27287,8 @@ class AntigravityAcpLane {
27085
27287
  this.stop({ reason: "protocol_error", forceAfterMs: 0 }).catch(() => {});
27086
27288
  }
27087
27289
  rejectAllPending(error62) {
27088
- for (const [id2, pending] of [...this.pending]) {
27089
- this.pending.delete(id2);
27290
+ for (const [id3, pending] of [...this.pending]) {
27291
+ this.pending.delete(id3);
27090
27292
  if (pending.kind === "call") {
27091
27293
  if (pending.timer)
27092
27294
  clearTimeout(pending.timer);
@@ -28415,8 +28617,8 @@ async function discoverClaudeRecentContext(request, dependencies = {}) {
28415
28617
  // agent-driver/dist/adapters/claude/index.js
28416
28618
  var CLAUDE_MODEL_CATALOG = {
28417
28619
  updateMode: "unsupported",
28418
- models: ["opus", "sonnet", "haiku"].map((id2) => ({
28419
- id: id2,
28620
+ models: ["opus", "sonnet", "haiku"].map((id3) => ({
28621
+ id: id3,
28420
28622
  supportedReasoningEfforts: []
28421
28623
  }))
28422
28624
  };
@@ -29263,7 +29465,6 @@ class CodexDriver {
29263
29465
  let listId = 0;
29264
29466
  const models = [];
29265
29467
  const seenModels = new Set;
29266
- let overflow = false;
29267
29468
  let defaultModelId;
29268
29469
  const finish = (catalog) => {
29269
29470
  if (settled)
@@ -29284,13 +29485,9 @@ class CodexDriver {
29284
29485
  if (!value || typeof value !== "object")
29285
29486
  return;
29286
29487
  const model = value;
29287
- const id2 = normalizeRuntimeModelId(model.id);
29288
- if (!id2 || seenModels.has(id2))
29488
+ const id3 = normalizeRuntimeModelId(model.id);
29489
+ if (!id3 || seenModels.has(id3))
29289
29490
  return;
29290
- if (models.length >= MODEL_LIST_MAX) {
29291
- overflow = true;
29292
- return;
29293
- }
29294
29491
  const rawOptions = Array.isArray(model.supportedReasoningEfforts) ? model.supportedReasoningEfforts : [];
29295
29492
  const seenEfforts = new Set;
29296
29493
  const supportedReasoningEfforts = rawOptions.flatMap((raw) => {
@@ -29305,11 +29502,11 @@ class CodexDriver {
29305
29502
  return [{ value: value2, ...description ? { description } : {} }];
29306
29503
  }).slice(0, MODEL_EFFORT_MAX);
29307
29504
  const candidateDefault = typeof model.defaultReasoningEffort === "string" ? model.defaultReasoningEffort : undefined;
29308
- seenModels.add(id2);
29505
+ seenModels.add(id3);
29309
29506
  if (model.isDefault === true)
29310
- defaultModelId = id2;
29507
+ defaultModelId = id3;
29311
29508
  models.push({
29312
- id: id2,
29509
+ id: id3,
29313
29510
  supportedReasoningEfforts,
29314
29511
  ...candidateDefault && supportedReasoningEfforts.some((item) => item.value === candidateDefault) ? { defaultReasoningEffort: candidateDefault } : {}
29315
29512
  });
@@ -29332,14 +29529,13 @@ class CodexDriver {
29332
29529
  if (message2.error || !message2.result || typeof message2.result !== "object")
29333
29530
  return finish();
29334
29531
  const result = message2.result;
29335
- for (const model of Array.isArray(result.data) ? result.data : [])
29532
+ for (const model of Array.isArray(result.data) ? result.data : []) {
29336
29533
  consumeModel(model);
29337
- if (overflow)
29338
- return finish();
29534
+ if (models.length >= MODEL_LIST_MAX)
29535
+ break;
29536
+ }
29339
29537
  const cursor = typeof result.nextCursor === "string" ? result.nextCursor : undefined;
29340
- if (cursor && models.length >= MODEL_LIST_MAX)
29341
- return finish();
29342
- if (cursor)
29538
+ if (cursor && models.length < MODEL_LIST_MAX)
29343
29539
  return requestModelPage(cursor);
29344
29540
  if (models.length === 0)
29345
29541
  return finish();
@@ -29463,10 +29659,10 @@ class CodexDriver {
29463
29659
  error: this.settingsError("process", "settings_thread_unavailable", "Codex thread is not available for a settings update", true)
29464
29660
  });
29465
29661
  }
29466
- const id2 = this.nextRequestId();
29662
+ const id3 = this.nextRequestId();
29467
29663
  return new Promise((resolve3) => {
29468
29664
  const timer = setTimeout(() => {
29469
- if (!this.pendingSettingsUpdates.delete(id2))
29665
+ if (!this.pendingSettingsUpdates.delete(id3))
29470
29666
  return;
29471
29667
  resolve3({
29472
29668
  status: "failed",
@@ -29474,13 +29670,13 @@ class CodexDriver {
29474
29670
  });
29475
29671
  }, SETTINGS_UPDATE_TIMEOUT_MS);
29476
29672
  timer.unref?.();
29477
- this.pendingSettingsUpdates.set(id2, { resolve: resolve3, timer });
29673
+ this.pendingSettingsUpdates.set(id3, { resolve: resolve3, timer });
29478
29674
  try {
29479
- stdin.write(jsonRpcRequest("thread/settings/update", { threadId, effort: input2.reasoningEffort }, id2) + `
29675
+ stdin.write(jsonRpcRequest("thread/settings/update", { threadId, effort: input2.reasoningEffort }, id3) + `
29480
29676
  `);
29481
29677
  } catch (error62) {
29482
29678
  clearTimeout(timer);
29483
- this.pendingSettingsUpdates.delete(id2);
29679
+ this.pendingSettingsUpdates.delete(id3);
29484
29680
  resolve3({
29485
29681
  status: "failed",
29486
29682
  error: this.settingsError("process", "settings_update_write_failed", String(error62), true)
@@ -29529,9 +29725,9 @@ class CodexDriver {
29529
29725
  return { category, code, message: scrubDriverErrorMessage(message2), retryable };
29530
29726
  }
29531
29727
  failPendingSettingsUpdates(code, message2) {
29532
- for (const [id2, pending] of this.pendingSettingsUpdates) {
29728
+ for (const [id3, pending] of this.pendingSettingsUpdates) {
29533
29729
  clearTimeout(pending.timer);
29534
- this.pendingSettingsUpdates.delete(id2);
29730
+ this.pendingSettingsUpdates.delete(id3);
29535
29731
  pending.resolve({
29536
29732
  status: "failed",
29537
29733
  error: this.settingsError("process", code, message2, true)
@@ -29621,7 +29817,7 @@ function parseCursorAcpModelCatalog(session2) {
29621
29817
  if (option.value === "default[]" || seen.has(option.value))
29622
29818
  continue;
29623
29819
  if (models.length >= RUNTIME_MODEL_CATALOG_MAX)
29624
- return;
29820
+ break;
29625
29821
  seen.add(option.value);
29626
29822
  models.push({
29627
29823
  id: option.value,
@@ -30085,7 +30281,7 @@ class CursorAcpLane {
30085
30281
  return this.request(method, params, this.options.handshakeTimeoutMs ?? HANDSHAKE_TIMEOUT_MS2).promise;
30086
30282
  }
30087
30283
  request(method, params, timeoutMs) {
30088
- const id2 = ++this.requestSequence;
30284
+ const id3 = ++this.requestSequence;
30089
30285
  let resolve3;
30090
30286
  let reject;
30091
30287
  const promise2 = new Promise((accept, decline) => {
@@ -30093,24 +30289,24 @@ class CursorAcpLane {
30093
30289
  reject = decline;
30094
30290
  });
30095
30291
  const timer = timeoutMs === undefined ? undefined : setTimeout(() => {
30096
- const pending = this.pending.get(id2);
30292
+ const pending = this.pending.get(id3);
30097
30293
  if (!pending || pending.kind !== "call")
30098
30294
  return;
30099
- this.pending.delete(id2);
30295
+ this.pending.delete(id3);
30100
30296
  pending.reject(new Error(`Cursor ACP ${method} timed out`));
30101
30297
  }, timeoutMs);
30102
30298
  timer?.unref?.();
30103
- this.pending.set(id2, { kind: "call", method, resolve: resolve3, reject, ...timer ? { timer } : {} });
30299
+ this.pending.set(id3, { kind: "call", method, resolve: resolve3, reject, ...timer ? { timer } : {} });
30104
30300
  try {
30105
- this.write({ jsonrpc: "2.0", id: id2, method, params });
30301
+ this.write({ jsonrpc: "2.0", id: id3, method, params });
30106
30302
  } catch (error62) {
30107
- const pending = this.pending.get(id2);
30108
- this.pending.delete(id2);
30303
+ const pending = this.pending.get(id3);
30304
+ this.pending.delete(id3);
30109
30305
  if (pending?.kind === "call" && pending.timer)
30110
30306
  clearTimeout(pending.timer);
30111
30307
  throw error62 instanceof Error ? error62 : new Error(String(error62));
30112
30308
  }
30113
- return { id: id2, promise: promise2 };
30309
+ return { id: id3, promise: promise2 };
30114
30310
  }
30115
30311
  write(message2) {
30116
30312
  const stdin = this.process?.stdin;
@@ -30216,14 +30412,14 @@ class CursorAcpLane {
30216
30412
  }
30217
30413
  this.protocolFailure("Cursor ACP emitted an unrecognized JSON-RPC message");
30218
30414
  }
30219
- handleResponse(id2, message2) {
30220
- const pending = typeof id2 === "number" ? this.pending.get(id2) : undefined;
30221
- if (typeof id2 !== "number" || !pending) {
30415
+ handleResponse(id3, message2) {
30416
+ const pending = typeof id3 === "number" ? this.pending.get(id3) : undefined;
30417
+ if (typeof id3 !== "number" || !pending) {
30222
30418
  this.diagnostic("warning", "Cursor ACP emitted a duplicate or unknown response id");
30223
30419
  return;
30224
30420
  }
30225
30421
  if (pending.kind === "prompt") {
30226
- this.pending.delete(id2);
30422
+ this.pending.delete(id3);
30227
30423
  if (message2.error !== undefined) {
30228
30424
  const payload = record4(message2.error);
30229
30425
  const rpcCode = typeof payload?.code === "number" && Number.isSafeInteger(payload.code) ? payload.code : undefined;
@@ -30237,20 +30433,20 @@ class CursorAcpLane {
30237
30433
  }
30238
30434
  if (message2.error !== undefined) {
30239
30435
  const payload = record4(message2.error);
30240
- this.settleRequest(id2, false, new CursorAcpRpcError(pending.method, typeof payload?.code === "number" ? payload.code : undefined, rpcErrorMessage2(message2.error)));
30436
+ this.settleRequest(id3, false, new CursorAcpRpcError(pending.method, typeof payload?.code === "number" ? payload.code : undefined, rpcErrorMessage2(message2.error)));
30241
30437
  return;
30242
30438
  }
30243
30439
  if (!("result" in message2)) {
30244
- this.settleRequest(id2, false, new Error("Cursor ACP response omitted result"));
30440
+ this.settleRequest(id3, false, new Error("Cursor ACP response omitted result"));
30245
30441
  return;
30246
30442
  }
30247
- this.settleRequest(id2, true, message2.result);
30443
+ this.settleRequest(id3, true, message2.result);
30248
30444
  }
30249
- settleRequest(id2, ok, value) {
30250
- const pending = this.pending.get(id2);
30445
+ settleRequest(id3, ok, value) {
30446
+ const pending = this.pending.get(id3);
30251
30447
  if (!pending || pending.kind !== "call")
30252
30448
  return;
30253
- this.pending.delete(id2);
30449
+ this.pending.delete(id3);
30254
30450
  if (pending.timer)
30255
30451
  clearTimeout(pending.timer);
30256
30452
  if (ok)
@@ -30258,11 +30454,11 @@ class CursorAcpLane {
30258
30454
  else
30259
30455
  pending.reject(value instanceof Error ? value : new Error(String(value)));
30260
30456
  }
30261
- handleRequest(id2, method, params) {
30457
+ handleRequest(id3, method, params) {
30262
30458
  if (method !== "session/request_permission") {
30263
30459
  this.write({
30264
30460
  jsonrpc: "2.0",
30265
- id: id2,
30461
+ id: id3,
30266
30462
  error: { code: -32601, message: "Unsupported Cursor ACP client request" }
30267
30463
  });
30268
30464
  this.diagnostic("warning", `Unsupported Cursor ACP client request: ${safeLabel2(method)}`);
@@ -30273,13 +30469,13 @@ class CursorAcpLane {
30273
30469
  const options = Array.isArray(payload?.options) ? payload.options.map(record4).filter(Boolean) : [];
30274
30470
  const allowOnce = options.find((option) => option.kind === "allow_once" && typeof option.optionId === "string" && option.optionId.trim().length > 0);
30275
30471
  if (!this.ready || this.currentPromptRequestId === null || !sameSession || !allowOnce) {
30276
- this.write({ jsonrpc: "2.0", id: id2, result: { outcome: { outcome: "cancelled" } } });
30472
+ this.write({ jsonrpc: "2.0", id: id3, result: { outcome: { outcome: "cancelled" } } });
30277
30473
  this.diagnostic("error", "Cursor ACP permission request was not allowed for the active prompt");
30278
30474
  return;
30279
30475
  }
30280
30476
  this.write({
30281
30477
  jsonrpc: "2.0",
30282
- id: id2,
30478
+ id: id3,
30283
30479
  result: { outcome: { outcome: "selected", optionId: allowOnce.optionId } }
30284
30480
  });
30285
30481
  }
@@ -30367,8 +30563,8 @@ class CursorAcpLane {
30367
30563
  this.stop({ reason: "protocol_error", forceAfterMs: 0 }).catch(() => {});
30368
30564
  }
30369
30565
  rejectAllPending(error62) {
30370
- for (const [id2, pending] of [...this.pending]) {
30371
- this.pending.delete(id2);
30566
+ for (const [id3, pending] of [...this.pending]) {
30567
+ this.pending.delete(id3);
30372
30568
  if (pending.kind === "call") {
30373
30569
  if (pending.timer)
30374
30570
  clearTimeout(pending.timer);
@@ -30676,14 +30872,14 @@ function parseGrokModelCatalog(value) {
30676
30872
  const models = [];
30677
30873
  for (const item of available) {
30678
30874
  const model = asRecord(item);
30679
- const id2 = normalizeRuntimeModelId(model?.modelId);
30680
- if (!model || !id2 || seen.has(id2))
30875
+ const id3 = normalizeRuntimeModelId(model?.modelId);
30876
+ if (!model || !id3 || seen.has(id3))
30681
30877
  continue;
30682
30878
  if (models.length >= RUNTIME_MODEL_CATALOG_MAX)
30683
- return;
30684
- seen.add(id2);
30879
+ break;
30880
+ seen.add(id3);
30685
30881
  const displayName = boundedText2(model.name, MODEL_DISPLAY_NAME_MAX2);
30686
- models.push({ id: id2, ...displayName ? { displayName } : {}, ...reasoningCatalog(model) });
30882
+ models.push({ id: id3, ...displayName ? { displayName } : {}, ...reasoningCatalog(model) });
30687
30883
  }
30688
30884
  if (models.length === 0)
30689
30885
  return;
@@ -30737,13 +30933,13 @@ async function probeGrokAcpCatalog(command, options = {}) {
30737
30933
  const cleanup = options.cleanup ?? cleanupProbeProcess2;
30738
30934
  Promise.resolve().then(() => cleanup(processHandle)).catch(() => {}).finally(() => resolve3(value));
30739
30935
  };
30740
- const write = (method, params, id2) => {
30936
+ const write = (method, params, id3) => {
30741
30937
  const stdin = processHandle.stdin;
30742
30938
  if (!stdin || stdin.destroyed || stdin.writableEnded || stdin.writable === false) {
30743
30939
  return finish({ status: "unhealthy", lastError: "grok_acp_transport_unavailable" });
30744
30940
  }
30745
30941
  try {
30746
- stdin.write(`${jsonRpcRequest(method, params, id2)}
30942
+ stdin.write(`${jsonRpcRequest(method, params, id3)}
30747
30943
  `);
30748
30944
  } catch {
30749
30945
  finish({ status: "unhealthy", lastError: "grok_acp_transport_unavailable" });
@@ -30777,8 +30973,8 @@ async function probeGrokAcpCatalog(command, options = {}) {
30777
30973
  const capabilities = asRecord(result.agentCapabilities);
30778
30974
  const methods = Array.isArray(result.authMethods) ? result.authMethods : [];
30779
30975
  const methodIds = methods.flatMap((method) => {
30780
- const id2 = asRecord(method)?.id;
30781
- return typeof id2 === "string" ? [id2] : [];
30976
+ const id3 = asRecord(method)?.id;
30977
+ return typeof id3 === "string" ? [id3] : [];
30782
30978
  });
30783
30979
  if (result.protocolVersion !== ACP_PROTOCOL_VERSION5) {
30784
30980
  return finish({ status: "unhealthy", lastError: "grok_acp_protocol_incompatible" });
@@ -30787,7 +30983,7 @@ async function probeGrokAcpCatalog(command, options = {}) {
30787
30983
  return finish({ status: "unhealthy", lastError: "grok_acp_load_session_unsupported" });
30788
30984
  }
30789
30985
  if (!methodIds.includes(AUTH_METHOD_ID4)) {
30790
- if (methodIds.some((id2) => INTERACTIVE_AUTH_METHOD_IDS.has(id2))) {
30986
+ if (methodIds.some((id3) => INTERACTIVE_AUTH_METHOD_IDS.has(id3))) {
30791
30987
  return finish({ status: "unhealthy", lastError: "grok_acp_authentication_failed" });
30792
30988
  }
30793
30989
  return finish({ status: "unhealthy", lastError: "grok_acp_cached_auth_unsupported" });
@@ -31144,11 +31340,11 @@ class GrokAcpLane {
31144
31340
  }
31145
31341
  const authMethods = Array.isArray(initialize.authMethods) ? initialize.authMethods : [];
31146
31342
  const authMethodIds = authMethods.flatMap((method) => {
31147
- const id2 = asRecord(method)?.id;
31148
- return typeof id2 === "string" ? [id2] : [];
31343
+ const id3 = asRecord(method)?.id;
31344
+ return typeof id3 === "string" ? [id3] : [];
31149
31345
  });
31150
31346
  if (!authMethodIds.includes(AUTH_METHOD_ID5)) {
31151
- if (authMethodIds.some((id2) => INTERACTIVE_AUTH_METHOD_IDS2.has(id2))) {
31347
+ if (authMethodIds.some((id3) => INTERACTIVE_AUTH_METHOD_IDS2.has(id3))) {
31152
31348
  throw new GrokAcpAuthenticationError("Grok authentication failed; run `grok login` and retry");
31153
31349
  }
31154
31350
  throw new GrokAcpIncompatibleError("Installed Grok ACP does not expose cached-token authentication");
@@ -31314,7 +31510,7 @@ class GrokAcpLane {
31314
31510
  return this.request(method, params, timeoutMs ?? this.options.handshakeTimeoutMs ?? HANDSHAKE_TIMEOUT_MS3).promise;
31315
31511
  }
31316
31512
  request(method, params, timeoutMs) {
31317
- const id2 = ++this.requestSequence;
31513
+ const id3 = ++this.requestSequence;
31318
31514
  let resolve3;
31319
31515
  let reject;
31320
31516
  const promise2 = new Promise((accept, decline) => {
@@ -31322,24 +31518,24 @@ class GrokAcpLane {
31322
31518
  reject = decline;
31323
31519
  });
31324
31520
  const timer = timeoutMs === undefined ? undefined : setTimeout(() => {
31325
- const pending = this.pending.get(id2);
31521
+ const pending = this.pending.get(id3);
31326
31522
  if (!pending || pending.kind !== "call")
31327
31523
  return;
31328
- this.pending.delete(id2);
31524
+ this.pending.delete(id3);
31329
31525
  pending.reject(new Error(`Grok ACP ${method} timed out`));
31330
31526
  }, timeoutMs);
31331
31527
  timer?.unref?.();
31332
- this.pending.set(id2, { kind: "call", method, resolve: resolve3, reject, ...timer ? { timer } : {} });
31528
+ this.pending.set(id3, { kind: "call", method, resolve: resolve3, reject, ...timer ? { timer } : {} });
31333
31529
  try {
31334
- this.write({ jsonrpc: "2.0", id: id2, method, params });
31530
+ this.write({ jsonrpc: "2.0", id: id3, method, params });
31335
31531
  } catch (error62) {
31336
- const pending = this.pending.get(id2);
31337
- this.pending.delete(id2);
31532
+ const pending = this.pending.get(id3);
31533
+ this.pending.delete(id3);
31338
31534
  if (pending?.kind === "call" && pending.timer)
31339
31535
  clearTimeout(pending.timer);
31340
31536
  throw error62 instanceof Error ? error62 : new Error(String(error62));
31341
31537
  }
31342
- return { id: id2, promise: promise2 };
31538
+ return { id: id3, promise: promise2 };
31343
31539
  }
31344
31540
  write(message2) {
31345
31541
  const stdin = this.process?.stdin;
@@ -31439,14 +31635,14 @@ class GrokAcpLane {
31439
31635
  }
31440
31636
  this.protocolFailure("Grok ACP emitted an unrecognized JSON-RPC message");
31441
31637
  }
31442
- handleResponse(id2, message2) {
31443
- const pending = typeof id2 === "number" ? this.pending.get(id2) : undefined;
31444
- if (typeof id2 !== "number" || !pending) {
31638
+ handleResponse(id3, message2) {
31639
+ const pending = typeof id3 === "number" ? this.pending.get(id3) : undefined;
31640
+ if (typeof id3 !== "number" || !pending) {
31445
31641
  this.diagnostic("warning", "Grok ACP emitted a duplicate or unknown response id");
31446
31642
  return;
31447
31643
  }
31448
31644
  if (pending.kind === "prompt") {
31449
- this.pending.delete(id2);
31645
+ this.pending.delete(id3);
31450
31646
  if (message2.error !== undefined) {
31451
31647
  const payload = asRecord(message2.error);
31452
31648
  const code = typeof payload?.code === "number" && Number.isSafeInteger(payload.code) ? payload.code : undefined;
@@ -31460,20 +31656,20 @@ class GrokAcpLane {
31460
31656
  }
31461
31657
  if (message2.error !== undefined) {
31462
31658
  const payload = asRecord(message2.error);
31463
- this.settleRequest(id2, false, new GrokAcpRpcError(pending.method, typeof payload?.code === "number" && Number.isSafeInteger(payload.code) ? payload.code : undefined, rpcErrorMessage3(message2.error)));
31659
+ this.settleRequest(id3, false, new GrokAcpRpcError(pending.method, typeof payload?.code === "number" && Number.isSafeInteger(payload.code) ? payload.code : undefined, rpcErrorMessage3(message2.error)));
31464
31660
  return;
31465
31661
  }
31466
31662
  if (!("result" in message2)) {
31467
- this.settleRequest(id2, false, new Error("Grok ACP response omitted result"));
31663
+ this.settleRequest(id3, false, new Error("Grok ACP response omitted result"));
31468
31664
  return;
31469
31665
  }
31470
- this.settleRequest(id2, true, message2.result);
31666
+ this.settleRequest(id3, true, message2.result);
31471
31667
  }
31472
- settleRequest(id2, ok, value) {
31473
- const pending = this.pending.get(id2);
31668
+ settleRequest(id3, ok, value) {
31669
+ const pending = this.pending.get(id3);
31474
31670
  if (!pending || pending.kind !== "call")
31475
31671
  return;
31476
- this.pending.delete(id2);
31672
+ this.pending.delete(id3);
31477
31673
  if (pending.timer)
31478
31674
  clearTimeout(pending.timer);
31479
31675
  if (ok)
@@ -31481,9 +31677,9 @@ class GrokAcpLane {
31481
31677
  else
31482
31678
  pending.reject(value instanceof Error ? value : new Error(String(value)));
31483
31679
  }
31484
- handleRequest(id2, method, params) {
31680
+ handleRequest(id3, method, params) {
31485
31681
  if (method !== "session/request_permission") {
31486
- this.write({ jsonrpc: "2.0", id: id2, error: { code: -32601, message: "Unsupported Grok ACP client request" } });
31682
+ this.write({ jsonrpc: "2.0", id: id3, error: { code: -32601, message: "Unsupported Grok ACP client request" } });
31487
31683
  this.diagnostic("warning", `Unsupported Grok ACP client request: ${safeLabel3(method)}`);
31488
31684
  return;
31489
31685
  }
@@ -31491,13 +31687,13 @@ class GrokAcpLane {
31491
31687
  const options = Array.isArray(payload?.options) ? payload.options.map(asRecord).filter(Boolean) : [];
31492
31688
  const allowOnce = options.find((option) => option.kind === "allow_once" && typeof option.optionId === "string" && option.optionId.trim());
31493
31689
  if (!this.ready || this.currentPromptRequestId === null || payload?.sessionId !== this.sessionId || !allowOnce) {
31494
- this.write({ jsonrpc: "2.0", id: id2, result: { outcome: { outcome: "cancelled" } } });
31690
+ this.write({ jsonrpc: "2.0", id: id3, result: { outcome: { outcome: "cancelled" } } });
31495
31691
  this.diagnostic("error", "Grok ACP permission request was not allowed for the active prompt");
31496
31692
  return;
31497
31693
  }
31498
31694
  this.write({
31499
31695
  jsonrpc: "2.0",
31500
- id: id2,
31696
+ id: id3,
31501
31697
  result: { outcome: { outcome: "selected", optionId: allowOnce.optionId } }
31502
31698
  });
31503
31699
  }
@@ -31659,8 +31855,8 @@ class GrokAcpLane {
31659
31855
  this.stop({ reason: "protocol_error", forceAfterMs: 0 }).catch(() => {});
31660
31856
  }
31661
31857
  rejectAllPending(error62) {
31662
- for (const [id2, pending] of [...this.pending]) {
31663
- this.pending.delete(id2);
31858
+ for (const [id3, pending] of [...this.pending]) {
31859
+ this.pending.delete(id3);
31664
31860
  if (pending.kind === "call") {
31665
31861
  if (pending.timer)
31666
31862
  clearTimeout(pending.timer);
@@ -31839,7 +32035,6 @@ import { randomBytes as randomBytes4 } from "node:crypto";
31839
32035
  import { randomBytes as randomBytes3 } from "node:crypto";
31840
32036
  import { EventEmitter as EventEmitter5 } from "node:events";
31841
32037
  import { createServer as createServer2 } from "node:net";
31842
- var SUPPORTED_VERSION = "1.17.20";
31843
32038
  var HOST = "127.0.0.1";
31844
32039
  var START_TIMEOUT_MS = 15000;
31845
32040
  var REQUEST_TIMEOUT_MS = 15000;
@@ -32257,8 +32452,8 @@ class OpenCodeServiceLane {
32257
32452
  const { response, body } = await this.fetchJsonWithTimeout("/global/health", { method: "GET" }, "health", healthTimeoutMs);
32258
32453
  if (response.ok) {
32259
32454
  const health = record5(body);
32260
- if (health?.healthy !== true || health.version !== SUPPORTED_VERSION) {
32261
- throw new OpenCodeIncompatibleError(`Installed OpenCode service must be version ${SUPPORTED_VERSION}`);
32455
+ if (health?.healthy !== true) {
32456
+ throw new OpenCodeIncompatibleError("Installed OpenCode service did not report healthy status");
32262
32457
  }
32263
32458
  await this.verifyOpenApi();
32264
32459
  return;
@@ -33072,7 +33267,7 @@ class OpenCodeDriver {
33072
33267
  instructionDelivery = { kind: "workspace_file", canonical: "AGENTS.md", aliases: ["CLAUDE.md"] };
33073
33268
  execution = {
33074
33269
  lifetime: "session",
33075
- transport: { kind: "http_sse", protocol: "opencode.v2.service.1.17.20" },
33270
+ transport: { kind: "http_sse", protocol: "opencode.v2.service" },
33076
33271
  wakeStart: "immediate",
33077
33272
  terminalOwnership: "transport_request"
33078
33273
  };
@@ -33637,10 +33832,10 @@ function createAgentDriverRegistry(registrations) {
33637
33832
  const backendIds = Object.freeze([...entries.keys()]);
33638
33833
  return Object.freeze({
33639
33834
  backendIds,
33640
- get(id2) {
33641
- const registration = entries.get(id2);
33835
+ get(id3) {
33836
+ const registration = entries.get(id3);
33642
33837
  if (!registration)
33643
- throw new Error(`Unknown agent backend: ${id2}`);
33838
+ throw new Error(`Unknown agent backend: ${id3}`);
33644
33839
  return registration;
33645
33840
  }
33646
33841
  });
@@ -35535,11 +35730,11 @@ function getDriver(runtimeId) {
35535
35730
  if (!BUILTIN_BACKEND_IDS.includes(runtimeId)) {
35536
35731
  throw new Error(`Unknown runtime: ${runtimeId}. Available: ${BUILTIN_BACKEND_IDS.join(", ")}`);
35537
35732
  }
35538
- const id2 = runtimeId;
35733
+ const id3 = runtimeId;
35539
35734
  return {
35540
- id: id2,
35541
- capabilities: capabilitiesFor(id2),
35542
- probe: () => createAgentDriverSdk2().probe({ backend: id2 })
35735
+ id: id3,
35736
+ capabilities: capabilitiesFor(id3),
35737
+ probe: () => createAgentDriverSdk2().probe({ backend: id3 })
35543
35738
  };
35544
35739
  }
35545
35740
  function listRuntimeIds() {
@@ -35583,20 +35778,20 @@ async function detectRuntimes() {
35583
35778
  const ids = listRuntimeIds();
35584
35779
  const results = [];
35585
35780
  const nowIso = new Date().toISOString();
35586
- for (const id2 of ids) {
35781
+ for (const id3 of ids) {
35587
35782
  try {
35588
- const driver = getDriver(id2);
35783
+ const driver = getDriver(id3);
35589
35784
  const probe = await driver.probe();
35590
35785
  if (probe.status === "healthy") {
35591
35786
  results.push({
35592
- id: id2,
35787
+ id: id3,
35593
35788
  status: "healthy",
35594
35789
  version: probe.version,
35595
35790
  reasoning: probe.reasoning
35596
35791
  });
35597
35792
  } else {
35598
35793
  results.push({
35599
- id: id2,
35794
+ id: id3,
35600
35795
  status: "unhealthy",
35601
35796
  lastError: probe.error.code ?? "probe_failed",
35602
35797
  lastErrorAt: nowIso
@@ -35604,7 +35799,7 @@ async function detectRuntimes() {
35604
35799
  }
35605
35800
  } catch (err) {
35606
35801
  results.push({
35607
- id: id2,
35802
+ id: id3,
35608
35803
  status: "unhealthy",
35609
35804
  lastError: err?.code ?? "probe_threw",
35610
35805
  lastErrorAt: nowIso
@@ -36670,8 +36865,8 @@ var DEFAULT_HEADER_NAMES = {
36670
36865
  function randomVoucher(prefix) {
36671
36866
  return prefix + crypto3.randomBytes(32).toString("base64url");
36672
36867
  }
36673
- function sanitizeIdSegment(id2) {
36674
- return id2.replace(/[^A-Za-z0-9._-]/g, "_") || "_";
36868
+ function sanitizeIdSegment(id3) {
36869
+ return id3.replace(/[^A-Za-z0-9._-]/g, "_") || "_";
36675
36870
  }
36676
36871
 
36677
36872
  class CredentialBroker {
@@ -37627,14 +37822,14 @@ function onExit(state, agentId) {
37627
37822
  function onTick(state, nowMs) {
37628
37823
  const effects = [];
37629
37824
  const agents = { ...state.agents };
37630
- for (const id2 of Object.keys(agents)) {
37631
- const a = agents[id2];
37825
+ for (const id3 of Object.keys(agents)) {
37826
+ const a = agents[id3];
37632
37827
  const lease = a.execution.lease;
37633
37828
  const stalled = a.status === "running" && (lease.state === "active" || lease.state === "suspect_active") && (lease.outstandingToolUses ?? 0) === 0 && nowMs - lease.lastWorkAt >= a.turnSilence.normalBudgetMs && nowMs >= lease.nativeDeadlineAt;
37634
37829
  if (stalled) {
37635
37830
  const repeatedSessionStall = a.sessionId !== null && a.stalledSessionId === a.sessionId;
37636
37831
  const forgetSessionId = repeatedSessionStall ? a.sessionId : undefined;
37637
- agents[id2] = {
37832
+ agents[id3] = {
37638
37833
  ...a,
37639
37834
  status: "stopping",
37640
37835
  sessionId: repeatedSessionStall ? null : a.sessionId,
@@ -37642,12 +37837,12 @@ function onTick(state, nowMs) {
37642
37837
  idleSince: null,
37643
37838
  stoppingSince: nowMs
37644
37839
  };
37645
- effects.push(forgetSessionId ? { type: "terminate_stalled", agentId: id2, forgetSessionId } : a.sessionId !== null ? { type: "terminate_stalled", agentId: id2, recordSessionId: a.sessionId } : { type: "terminate_stalled", agentId: id2 });
37840
+ effects.push(forgetSessionId ? { type: "terminate_stalled", agentId: id3, forgetSessionId } : a.sessionId !== null ? { type: "terminate_stalled", agentId: id3, recordSessionId: a.sessionId } : { type: "terminate_stalled", agentId: id3 });
37646
37841
  continue;
37647
37842
  }
37648
37843
  const expiredAdmission = a.status === "running" && a.pendingAdmissions.filter((entry) => !entry.driverAcknowledged && nowMs - entry.admittedAt >= state.staleThresholdMs);
37649
37844
  if (expiredAdmission && expiredAdmission.length > 0 && a.execution.sessionInstanceId !== null) {
37650
- agents[id2] = {
37845
+ agents[id3] = {
37651
37846
  ...a,
37652
37847
  pendingAdmissions: a.pendingAdmissions.filter((entry) => !expiredAdmission.includes(entry)),
37653
37848
  status: "stopping",
@@ -37657,7 +37852,7 @@ function onTick(state, nowMs) {
37657
37852
  effects.push(...recoveryEffects(a, expiredAdmission));
37658
37853
  effects.push({
37659
37854
  type: "expire_admission",
37660
- agentId: id2,
37855
+ agentId: id3,
37661
37856
  sessionInstanceId: a.execution.sessionInstanceId,
37662
37857
  commandIds: expiredAdmission.map((entry) => entry.commandId)
37663
37858
  });
@@ -37665,25 +37860,25 @@ function onTick(state, nowMs) {
37665
37860
  }
37666
37861
  const resetStuck = a.resetting && a.status !== "stopping" && a.resettingSince !== null && nowMs - a.resettingSince >= state.resetStuckThresholdMs;
37667
37862
  if (resetStuck) {
37668
- agents[id2] = { ...a, status: "stopping", idleSince: null, stoppingSince: nowMs };
37669
- effects.push({ type: "terminate_stalled", agentId: id2 });
37863
+ agents[id3] = { ...a, status: "stopping", idleSince: null, stoppingSince: nowMs };
37864
+ effects.push({ type: "terminate_stalled", agentId: id3 });
37670
37865
  continue;
37671
37866
  }
37672
37867
  const stoppingStuck = a.status === "stopping" && a.stoppingSince !== null && nowMs - a.stoppingSince >= state.stoppingStuckThresholdMs;
37673
37868
  if (stoppingStuck) {
37674
- effects.push({ type: "force_exit", agentId: id2, reason: "stopping_stuck" });
37869
+ effects.push({ type: "force_exit", agentId: id3, reason: "stopping_stuck" });
37675
37870
  continue;
37676
37871
  }
37677
37872
  const idleResetEligible = a.idleSince !== null && a.sessionId !== null && a.inbox.length === 0 && a.pendingAdmissions.length === 0 && !a.resetting && state.idleResetTimeoutMs > 0 && Number.isFinite(state.idleResetTimeoutMs) && (a.status === "idle" && lease.state === "detached" || a.status === "running" && lease.state === "none" && lease.lastTerminal !== null);
37678
37873
  if (idleResetEligible && nowMs - a.idleSince >= state.idleResetTimeoutMs) {
37679
- agents[id2] = { ...a, idleSince: nowMs };
37680
- effects.push({ type: "maintain_idle_memory", agentId: id2, sessionId: a.sessionId });
37874
+ agents[id3] = { ...a, idleSince: nowMs };
37875
+ effects.push({ type: "maintain_idle_memory", agentId: id3, sessionId: a.sessionId });
37681
37876
  continue;
37682
37877
  }
37683
37878
  const idleEligible = a.status === "running" && lease.state === "none" && a.pendingAdmissions.length === 0 && lease.lastTerminal !== null && a.inbox.length === 0 && state.idleTimeoutMs > 0 && Number.isFinite(state.idleTimeoutMs);
37684
37879
  if (idleEligible && a.idleSince !== null && nowMs - a.idleSince >= state.idleTimeoutMs) {
37685
- agents[id2] = { ...a, status: "stopping", stoppingSince: nowMs };
37686
- effects.push({ type: "stop", agentId: id2, reason: "idle_timeout" });
37880
+ agents[id3] = { ...a, status: "stopping", stoppingSince: nowMs };
37881
+ effects.push({ type: "stop", agentId: id3, reason: "idle_timeout" });
37687
37882
  }
37688
37883
  }
37689
37884
  return { state: { ...state, agents }, effects };
@@ -37856,18 +38051,18 @@ function parseAntigravityQuota(value) {
37856
38051
  return;
37857
38052
  if (row.disabled === true)
37858
38053
  continue;
37859
- const id2 = label(row.bucketId);
38054
+ const id3 = label(row.bucketId);
37860
38055
  const fraction = row.remainingFraction;
37861
38056
  const windowId = row.window === undefined || row.window === "" ? "unspecified" : label(row.window);
37862
- if (!id2 || !windowId || typeof fraction !== "number" || !Number.isFinite(fraction) || fraction < 0 || fraction > 1)
38057
+ if (!id3 || !windowId || typeof fraction !== "number" || !Number.isFinite(fraction) || fraction < 0 || fraction > 1)
37863
38058
  return;
37864
- const windowName = label(row.displayName) ?? item.group ?? id2;
38059
+ const windowName = label(row.displayName) ?? item.group ?? id3;
37865
38060
  const resetsAt = text2(row.resetTime);
37866
38061
  if (resetsAt && !Number.isFinite(Date.parse(resetsAt)))
37867
38062
  return;
37868
38063
  const limit = {
37869
38064
  bucket: {
37870
- limitId: id2,
38065
+ limitId: id3,
37871
38066
  product: { kind: "reported", id: "antigravity", displayName: "Antigravity" },
37872
38067
  model: { kind: "unknown" },
37873
38068
  window: { kind: "provider_defined", id: windowId, displayName: windowName }
@@ -37875,7 +38070,7 @@ function parseAntigravityQuota(value) {
37875
38070
  usedPercent: (1 - fraction) * 100,
37876
38071
  ...resetsAt ? { resetsAt: new Date(resetsAt).toISOString() } : {}
37877
38072
  };
37878
- const key = `${id2}\x00${windowId}`;
38073
+ const key = `${id3}\x00${windowId}`;
37879
38074
  const previous = limits.get(key);
37880
38075
  if (previous && (previous.usedPercent !== limit.usedPercent || previous.resetsAt !== limit.resetsAt))
37881
38076
  return;
@@ -39280,8 +39475,8 @@ class AgentProcessManager {
39280
39475
  if (eventAgentId) {
39281
39476
  emit(eventAgentId);
39282
39477
  } else if (event.type === "tick") {
39283
- for (const id2 of Object.keys(this.state.agents))
39284
- emit(id2);
39478
+ for (const id3 of Object.keys(this.state.agents))
39479
+ emit(id3);
39285
39480
  }
39286
39481
  }
39287
39482
  if (closingOwner && closingSpan) {
@@ -40312,32 +40507,32 @@ class AgentRouter {
40312
40507
  }
40313
40508
  return out;
40314
40509
  }
40315
- isRuntimeHealthy(id2) {
40316
- return this.runtimes.get(id2)?.status === "healthy";
40510
+ isRuntimeHealthy(id3) {
40511
+ return this.runtimes.get(id3)?.status === "healthy";
40317
40512
  }
40318
- recordRuntimeSpawnFailure(id2, reason) {
40513
+ recordRuntimeSpawnFailure(id3, reason) {
40319
40514
  if (!DEFINITIVE_EXECUTABLE_FAILURES.has(reason))
40320
40515
  return;
40321
- this.markRuntimeUnhealthy(id2, reason);
40516
+ this.markRuntimeUnhealthy(id3, reason);
40322
40517
  }
40323
- markRuntimeUnhealthy(id2, reason) {
40324
- const existing = this.runtimes.get(id2);
40518
+ markRuntimeUnhealthy(id3, reason) {
40519
+ const existing = this.runtimes.get(id3);
40325
40520
  if (!existing)
40326
40521
  return;
40327
40522
  const nowIso = new Date().toISOString();
40328
40523
  if (existing.status === "unhealthy" && existing.lastError === reason)
40329
40524
  return;
40330
- this.runtimes.set(id2, {
40525
+ this.runtimes.set(id3, {
40331
40526
  ...existing,
40332
40527
  status: "unhealthy",
40333
40528
  lastError: reason,
40334
40529
  lastErrorAt: nowIso
40335
40530
  });
40336
- this.log.warn("runtime marked unhealthy", { runtimeId: id2, reason });
40531
+ this.log.warn("runtime marked unhealthy", { runtimeId: id3, reason });
40337
40532
  this.scheduleReadyFrameResend();
40338
40533
  }
40339
- markRuntimeHealthy(id2) {
40340
- const existing = this.runtimes.get(id2);
40534
+ markRuntimeHealthy(id3) {
40535
+ const existing = this.runtimes.get(id3);
40341
40536
  if (!existing)
40342
40537
  return;
40343
40538
  if (existing.status === "healthy" && !existing.lastError && !existing.lastErrorAt)
@@ -40345,8 +40540,8 @@ class AgentRouter {
40345
40540
  const healthy = { ...existing, status: "healthy" };
40346
40541
  delete healthy.lastError;
40347
40542
  delete healthy.lastErrorAt;
40348
- this.runtimes.set(id2, healthy);
40349
- this.log.info("runtime marked healthy again", { runtimeId: id2 });
40543
+ this.runtimes.set(id3, healthy);
40544
+ this.log.info("runtime marked healthy again", { runtimeId: id3 });
40350
40545
  this.scheduleReadyFrameResend();
40351
40546
  }
40352
40547
  markLocallyStopped(agentId) {
@@ -42579,7 +42774,7 @@ function appendRecentContextToPrompt(prompt, result) {
42579
42774
  return lines.join(`
42580
42775
  `);
42581
42776
  }
42582
- function createRecentContextPromptAppender(discover, recentSessionFilesTopK = 10, recentProjectsTopK = 5) {
42777
+ function createRecentContextPromptAppender(discover, recentSessionFilesTopK = 20, recentProjectsTopK = 5) {
42583
42778
  return async (prompt, runtimeConfig) => {
42584
42779
  const selected = toAgentBackendSelection(runtimeConfig);
42585
42780
  const command = selected.config.command;
@@ -42613,8 +42808,6 @@ var RUNTIME_RAW_TRACE_MAX_BYTES = 8 * 1024 * 1024;
42613
42808
  var RUNTIME_RAW_TRACE_AGENT_IDS_ENV = "ALOOK_RUNTIME_RAW_TRACE_AGENT_IDS";
42614
42809
  var STATUS_WRITE_INTERVAL_MS = 5000;
42615
42810
  var TOKEN_USAGE_BACKENDS = new Set(["claude", "codex", "grok", "opencode", "pi", "antigravity"]);
42616
- var ONBOARDING_RECENT_SESSION_FILES_TOP_K = 10;
42617
- var ONBOARDING_RECENT_PROJECTS_TOP_K = 5;
42618
42811
  function parseRuntimeRawTraceAgentIds(value) {
42619
42812
  return new Set((value ?? "").split(",").map((agentId) => agentId.trim()).filter((agentId) => agentId.length > 0 && agentId !== "*"));
42620
42813
  }
@@ -42749,7 +42942,7 @@ function createBuiltinDaemonSessionFactory(onRuntimeRawLine) {
42749
42942
  async function createDaemon(opts) {
42750
42943
  const log2 = opts.logger ?? createLogger2({ header: "@alook/daemon" });
42751
42944
  const recentContextSdk = createAgentDriverSdk();
42752
- const appendRecentContext = createRecentContextPromptAppender((input2) => recentContextSdk.discoverRecentContext(input2), ONBOARDING_RECENT_SESSION_FILES_TOP_K, ONBOARDING_RECENT_PROJECTS_TOP_K);
42945
+ const appendRecentContext = createRecentContextPromptAppender((input2) => recentContextSdk.discoverRecentContext(input2));
42753
42946
  const fallbackBase = (process.env.ALOOK_PROJECT_ROOT || `${homedir10()}/.alook`) + "/daemon";
42754
42947
  const workingDirectoryBase = opts.workingDirectoryBase ?? fallbackBase;
42755
42948
  const workdirFor = (agentId) => `${workingDirectoryBase}/${agentId}`;
@@ -44025,7 +44218,7 @@ async function buildDiagnosticBundle(args) {
44025
44218
  let truncated = false;
44026
44219
  const counts = { status: args.status ? 1 : 0, daemon_log: 0, fsm: 0 };
44027
44220
  const statusTime = typeof args.status?.timeMs === "number" ? args.status.timeMs : null;
44028
- const envelope = () => {
44221
+ const envelope2 = () => {
44029
44222
  const firstEvent = retained[head]?.row.timeMs ?? null;
44030
44223
  const lastEvent = retained.at(-1)?.row.timeMs ?? null;
44031
44224
  const earliestAt = statusTime === null ? firstEvent : firstEvent === null ? statusTime : Math.min(statusTime, firstEvent);
@@ -44056,7 +44249,7 @@ async function buildDiagnosticBundle(args) {
44056
44249
  retained.push({ row, bytes: serialized });
44057
44250
  retainedBytes += serialized.byteLength;
44058
44251
  counts[row.recordType] += 1;
44059
- while (envelope().total > maxUncompressed && head < retained.length) {
44252
+ while (envelope2().total > maxUncompressed && head < retained.length) {
44060
44253
  const removed = retained[head];
44061
44254
  delete retained[head];
44062
44255
  head += 1;
@@ -44070,7 +44263,7 @@ async function buildDiagnosticBundle(args) {
44070
44263
  head = 0;
44071
44264
  }
44072
44265
  }
44073
- const { footer, total } = envelope();
44266
+ const { footer, total } = envelope2();
44074
44267
  if (total > maxUncompressed)
44075
44268
  throw new BundleTooLargeError;
44076
44269
  const hash2 = createHash6("sha256");
@@ -45291,27 +45484,27 @@ var log2 = createLogger2({ header: "@alook/daemon" });
45291
45484
  function daemonsDir(baseDir) {
45292
45485
  return path17.join(baseDir, "daemons");
45293
45486
  }
45294
- function daemonDirById(baseDir, id2) {
45295
- return path17.join(daemonsDir(baseDir), validateDaemonId(id2));
45487
+ function daemonDirById(baseDir, id3) {
45488
+ return path17.join(daemonsDir(baseDir), validateDaemonId(id3));
45296
45489
  }
45297
45490
  function validateMachineId(machineId) {
45298
45491
  if (!MACHINE_ID_PATTERN.test(machineId))
45299
45492
  throw new Error("invalid machine identity returned by server");
45300
45493
  return machineId;
45301
45494
  }
45302
- function isDaemonId(id2) {
45303
- return MACHINE_ID_PATTERN.test(id2) || LEGACY_DAEMON_ID_PATTERN.test(id2);
45495
+ function isDaemonId(id3) {
45496
+ return MACHINE_ID_PATTERN.test(id3) || LEGACY_DAEMON_ID_PATTERN.test(id3);
45304
45497
  }
45305
- function validateDaemonId(id2) {
45306
- if (!isDaemonId(id2))
45498
+ function validateDaemonId(id3) {
45499
+ if (!isDaemonId(id3))
45307
45500
  throw new Error("invalid daemon id");
45308
- return id2;
45501
+ return id3;
45309
45502
  }
45310
- function pidfilePathById(baseDir, id2) {
45311
- return path17.join(daemonDirById(baseDir, id2), "daemon.pid");
45503
+ function pidfilePathById(baseDir, id3) {
45504
+ return path17.join(daemonDirById(baseDir, id3), "daemon.pid");
45312
45505
  }
45313
- function statusFilePathById(baseDir, id2) {
45314
- return path17.join(daemonDirById(baseDir, id2), "status.json");
45506
+ function statusFilePathById(baseDir, id3) {
45507
+ return path17.join(daemonDirById(baseDir, id3), "status.json");
45315
45508
  }
45316
45509
  function isProcessAlive(pid) {
45317
45510
  try {
@@ -45647,7 +45840,7 @@ function daemonList(opts) {
45647
45840
  return [];
45648
45841
  const results = [];
45649
45842
  const now = Date.now();
45650
- const pushRow = (id2, pidfile, statusPath) => {
45843
+ const pushRow = (id3, pidfile, statusPath) => {
45651
45844
  const data = readPidFile(pidfile);
45652
45845
  if (!data)
45653
45846
  return;
@@ -45671,12 +45864,12 @@ function daemonList(opts) {
45671
45864
  lastActiveMs = daemonLastActiveMs(s, now);
45672
45865
  }
45673
45866
  }
45674
- results.push({ id: id2, pid: data.pid, alive, agents, running, lastActiveMs });
45867
+ results.push({ id: id3, pid: data.pid, alive, agents, running, lastActiveMs });
45675
45868
  };
45676
45869
  for (const entry of fs12.readdirSync(dir, { withFileTypes: true })) {
45677
45870
  if (entry.isDirectory() && isDaemonId(entry.name)) {
45678
- const id2 = entry.name;
45679
- pushRow(id2, path17.join(dir, id2, "daemon.pid"), path17.join(dir, id2, "status.json"));
45871
+ const id3 = entry.name;
45872
+ pushRow(id3, path17.join(dir, id3, "daemon.pid"), path17.join(dir, id3, "status.json"));
45680
45873
  }
45681
45874
  }
45682
45875
  return results;
@@ -46456,10 +46649,10 @@ function getApi() {
46456
46649
  throw new CliError("no ServerApi available — ALOOK_PROXY_URL + ALOOK_PROXY_TOKEN_FILE must be set");
46457
46650
  }
46458
46651
  function agentId(opts) {
46459
- const id2 = opts.agent || process.env.ALOOK_AGENT_ID || process.env.ALOOK_ID;
46460
- if (!id2)
46652
+ const id3 = opts.agent || process.env.ALOOK_AGENT_ID || process.env.ALOOK_ID;
46653
+ if (!id3)
46461
46654
  throw new CliError("agent identity required — pass --agent <id> or set ALOOK_AGENT_ID");
46462
- return id2;
46655
+ return id3;
46463
46656
  }
46464
46657
  var TEXT_ESCAPE_MAP = { n: `
46465
46658
  `, t: "\t", r: "\r", "\\": "\\" };
@@ -46748,14 +46941,14 @@ async function cmdAttachmentUpload(opts) {
46748
46941
  async function cmdAttachmentDownload(opts) {
46749
46942
  const api2 = getApi();
46750
46943
  const agent2 = agentId(opts);
46751
- const id2 = opts.id;
46752
- if (!id2)
46944
+ const id3 = opts.id;
46945
+ if (!id3)
46753
46946
  throw new CliError("message attachment download: --id <id> is required");
46754
46947
  const outFlag = opts.out;
46755
46948
  const os4 = await import("os");
46756
46949
  const pathMod = await import("path");
46757
- const destPath = outFlag ?? pathMod.join(os4.tmpdir(), "alook-attachments", agent2, id2, "file");
46758
- const result = await api2.attachmentDownload({ agentId: agent2, id: id2, destPath });
46950
+ const destPath = outFlag ?? pathMod.join(os4.tmpdir(), "alook-attachments", agent2, id3, "file");
46951
+ const result = await api2.attachmentDownload({ agentId: agent2, id: id3, destPath });
46759
46952
  if (!outFlag) {
46760
46953
  const fs13 = await import("fs/promises");
46761
46954
  const destDir = pathMod.dirname(destPath);
@@ -47124,13 +47317,13 @@ function buildProgram(stdin) {
47124
47317
  daemon.command("start").description("start the daemon (connects to server, manages agent lifecycles)").option("--machine-key <key>", "machine key for first-time pairing").option("--id <machineId>", "restart a previously paired machine by id").option("--server-url <url>", "server HTTP URL (or ALOOK_SERVER_URL; defaults to production)").option("--ws-url <url>", "server WebSocket URL (or ALOOK_SERVER_WS_URL; defaults to production)").option("--base-dir <path>", "data directory for agent workspaces and pidfile (or ALOOK_DATA_DIR env)").option("--foreground", "run in the current process and tee daemon logs to the terminal").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
47125
47318
  const localOpts = this.opts();
47126
47319
  const machineKey = localOpts.machineKey;
47127
- const id2 = localOpts.id;
47128
- if (!machineKey && !id2 || machineKey && id2) {
47320
+ const id3 = localOpts.id;
47321
+ if (!machineKey && !id3 || machineKey && id3) {
47129
47322
  throw new CliError("daemon start requires exactly one of --machine-key <key> or --id <machineId>");
47130
47323
  }
47131
- if (id2) {
47324
+ if (id3) {
47132
47325
  await daemonStartById({
47133
- id: id2,
47326
+ id: id3,
47134
47327
  baseDir: localOpts.baseDir,
47135
47328
  foreground: localOpts.foreground === true
47136
47329
  });
@@ -47173,10 +47366,10 @@ function buildProgram(stdin) {
47173
47366
  requestId: localOpts.requestId
47174
47367
  });
47175
47368
  });
47176
- daemon.command("stop").argument("<id>", "daemon id from `alook daemon list` (the ID column)").description("stop a daemon by its id (from `alook daemon list`)").option("--base-dir <path>", "data directory (or ALOOK_DATA_DIR env)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function(id2) {
47369
+ daemon.command("stop").argument("<id>", "daemon id from `alook daemon list` (the ID column)").description("stop a daemon by its id (from `alook daemon list`)").option("--base-dir <path>", "data directory (or ALOOK_DATA_DIR env)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function(id3) {
47177
47370
  const localOpts = this.opts();
47178
47371
  await daemonStop({
47179
- id: id2,
47372
+ id: id3,
47180
47373
  baseDir: localOpts.baseDir
47181
47374
  });
47182
47375
  });
@@ -47190,9 +47383,9 @@ function buildProgram(stdin) {
47190
47383
  process.stdout.write(renderDaemonList(daemons) + `
47191
47384
  `);
47192
47385
  });
47193
- daemon.command("status").argument("[id]", "daemon id from `alook daemon list` (omit if only one daemon)").description("dump each agent's current FSM state from a daemon's status snapshot").option("--base-dir <path>", "data directory (or ALOOK_DATA_DIR env)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(function(id2) {
47386
+ daemon.command("status").argument("[id]", "daemon id from `alook daemon list` (omit if only one daemon)").description("dump each agent's current FSM state from a daemon's status snapshot").option("--base-dir <path>", "data directory (or ALOOK_DATA_DIR env)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(function(id3) {
47194
47387
  const localOpts = this.opts();
47195
- const status = daemonStatus({ id: id2, baseDir: localOpts.baseDir });
47388
+ const status = daemonStatus({ id: id3, baseDir: localOpts.baseDir });
47196
47389
  if (status.ambiguous) {
47197
47390
  printEnvelope({
47198
47391
  error: "multiple daemons on this machine — pass an id: `alook daemon status <id>`",