@alook/cli 0.0.160 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +867 -259
- package/dist/session-runner.js +756 -148
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -11738,7 +11738,7 @@ function finalize(ctx, schema) {
|
|
|
11738
11738
|
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
11739
11739
|
} else if (ctx.target === "draft-04") {
|
|
11740
11740
|
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
11741
|
-
} else if (ctx.target === "openapi-3.0") {}
|
|
11741
|
+
} else if (ctx.target === "openapi-3.0") {} else {}
|
|
11742
11742
|
if (ctx.external?.uri) {
|
|
11743
11743
|
const id = ctx.external.registry.get(schema)?.id;
|
|
11744
11744
|
if (!id)
|
|
@@ -11982,7 +11982,7 @@ var literalProcessor = (schema, ctx, json, _params) => {
|
|
|
11982
11982
|
if (val === undefined) {
|
|
11983
11983
|
if (ctx.unrepresentable === "throw") {
|
|
11984
11984
|
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
11985
|
-
}
|
|
11985
|
+
} else {}
|
|
11986
11986
|
} else if (typeof val === "bigint") {
|
|
11987
11987
|
if (ctx.unrepresentable === "throw") {
|
|
11988
11988
|
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
@@ -15124,6 +15124,7 @@ var SessionErrorFrameSchema = exports_external.object({
|
|
|
15124
15124
|
type: exports_external.literal("session.error"),
|
|
15125
15125
|
code: exports_external.enum(["runtime_not_available"]),
|
|
15126
15126
|
agentId: exports_external.string().optional(),
|
|
15127
|
+
launchId: exports_external.string().optional(),
|
|
15127
15128
|
payload: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
|
|
15128
15129
|
});
|
|
15129
15130
|
var AgentActivityMessageSchema = exports_external.object({
|
|
@@ -15134,12 +15135,25 @@ var AgentActivityMessageSchema = exports_external.object({
|
|
|
15134
15135
|
var AgentTypingMessageSchema = exports_external.object({
|
|
15135
15136
|
type: exports_external.literal("agent_typing"),
|
|
15136
15137
|
agentId: exports_external.string(),
|
|
15137
|
-
|
|
15138
|
+
channelId: exports_external.string().min(1)
|
|
15138
15139
|
});
|
|
15139
15140
|
var AgentTypingStopMessageSchema = exports_external.object({
|
|
15140
15141
|
type: exports_external.literal("agent_typing_stop"),
|
|
15141
15142
|
agentId: exports_external.string(),
|
|
15142
|
-
|
|
15143
|
+
channelId: exports_external.string().min(1)
|
|
15144
|
+
});
|
|
15145
|
+
var AgentSessionMessageSchema = exports_external.object({
|
|
15146
|
+
type: exports_external.literal("agent_session"),
|
|
15147
|
+
agentId: exports_external.string().min(1),
|
|
15148
|
+
sessionId: exports_external.string().min(1),
|
|
15149
|
+
launchId: exports_external.string().min(1)
|
|
15150
|
+
});
|
|
15151
|
+
var AgentWakeAckMessageSchema = exports_external.object({
|
|
15152
|
+
type: exports_external.literal("agent_wake_ack"),
|
|
15153
|
+
agentId: exports_external.string().min(1),
|
|
15154
|
+
launchId: exports_external.string().min(1),
|
|
15155
|
+
status: exports_external.enum(["ok", "error"]),
|
|
15156
|
+
error: exports_external.object({ code: exports_external.string().optional(), message: exports_external.string().optional() }).optional()
|
|
15143
15157
|
});
|
|
15144
15158
|
var CommunityPairTokenResponseSchema = exports_external.object({
|
|
15145
15159
|
tokenId: exports_external.string(),
|
|
@@ -15176,13 +15190,16 @@ var CommunityBotCreateRequestSchema = exports_external.object({
|
|
|
15176
15190
|
description: exports_external.string().max(COMMUNITY_BOT_DESCRIPTION_MAX).optional(),
|
|
15177
15191
|
machineId: exports_external.string().min(1),
|
|
15178
15192
|
runtime: exports_external.string().min(1),
|
|
15179
|
-
image: BotImageUrlSchema.optional()
|
|
15193
|
+
image: BotImageUrlSchema.optional(),
|
|
15194
|
+
model: exports_external.string().trim().min(1).max(100).nullable().optional()
|
|
15180
15195
|
});
|
|
15181
15196
|
var CommunityBotPatchRequestSchema = exports_external.object({
|
|
15182
15197
|
name: exports_external.string().trim().min(COMMUNITY_BOT_NAME_MIN).max(COMMUNITY_BOT_NAME_MAX).refine(isMentionSafeName, { message: MENTION_SAFE_NAME_MSG }).optional(),
|
|
15183
15198
|
description: exports_external.string().max(COMMUNITY_BOT_DESCRIPTION_MAX).optional(),
|
|
15184
|
-
image: BotImageUrlSchema.nullable().optional()
|
|
15185
|
-
|
|
15199
|
+
image: BotImageUrlSchema.nullable().optional(),
|
|
15200
|
+
model: exports_external.string().trim().min(1).max(100).nullable().optional(),
|
|
15201
|
+
runtime: exports_external.string().trim().min(1).max(COMMUNITY_RUNTIME_ID_MAX).optional()
|
|
15202
|
+
}).refine((v) => v.name !== undefined || v.description !== undefined || v.image !== undefined || v.runtime !== undefined || ("model" in v), {
|
|
15186
15203
|
message: "at least one field must be provided"
|
|
15187
15204
|
});
|
|
15188
15205
|
var CommunityBotAddToServerRequestSchema = exports_external.object({
|
|
@@ -15199,7 +15216,9 @@ var CommunityAgentSendRequestSchema = exports_external.object({
|
|
|
15199
15216
|
channel: exports_external.string().min(1),
|
|
15200
15217
|
content: CommunityAgentMessageContentSchema,
|
|
15201
15218
|
attachments: exports_external.array(exports_external.string().min(1)).max(MAX_ATTACHMENTS_PER_MESSAGE).default([]),
|
|
15202
|
-
seenUpToSeq: CommunityAgentSeqSchema.optional()
|
|
15219
|
+
seenUpToSeq: CommunityAgentSeqSchema.optional(),
|
|
15220
|
+
replyToSeq: CommunityAgentPositiveSeqSchema.optional(),
|
|
15221
|
+
nonce: exports_external.string().min(1).max(128).optional()
|
|
15203
15222
|
}).refine((d) => d.content.text.trim().length > 0 || d.attachments.length > 0, { message: "message must have text or attachments" });
|
|
15204
15223
|
var CommunityAgentAttachmentUploadResponseSchema = exports_external.object({
|
|
15205
15224
|
id: exports_external.string(),
|
|
@@ -15230,8 +15249,17 @@ var CommunityAgentResolveRequestSchema = exports_external.object({
|
|
|
15230
15249
|
var CommunityAgentListChannelsRequestSchema = exports_external.object({
|
|
15231
15250
|
server: exports_external.string().min(1).optional()
|
|
15232
15251
|
});
|
|
15252
|
+
var CommunityAgentCreatePostRequestSchema = exports_external.object({
|
|
15253
|
+
forum: exports_external.string().min(1),
|
|
15254
|
+
title: exports_external.string().min(1),
|
|
15255
|
+
content: CommunityAgentMessageContentSchema,
|
|
15256
|
+
attachments: exports_external.array(exports_external.string().min(1)).max(MAX_ATTACHMENTS_PER_MESSAGE).default([]),
|
|
15257
|
+
nonce: exports_external.string().min(1).max(128).optional()
|
|
15258
|
+
}).refine((d) => d.content.text.trim().length > 0 || d.attachments.length > 0, { message: "post must have text or attachments" });
|
|
15233
15259
|
var CommunityAgentListMembersRequestSchema = exports_external.object({
|
|
15234
|
-
server: exports_external.string().min(1)
|
|
15260
|
+
server: exports_external.string().min(1),
|
|
15261
|
+
limit: exports_external.number().int().positive().optional(),
|
|
15262
|
+
cursor: exports_external.string().min(1).optional()
|
|
15235
15263
|
});
|
|
15236
15264
|
var CommunityAgentChannelMemberRequestSchema = exports_external.object({
|
|
15237
15265
|
channel: exports_external.string().min(1),
|
|
@@ -15240,11 +15268,18 @@ var CommunityAgentChannelMemberRequestSchema = exports_external.object({
|
|
|
15240
15268
|
var CommunityAgentJoinServerRequestSchema = exports_external.object({
|
|
15241
15269
|
invite: exports_external.string().min(1)
|
|
15242
15270
|
});
|
|
15271
|
+
var CommunityAgentNapRequestSchema = exports_external.object({
|
|
15272
|
+
handoff: exports_external.string().trim().min(1)
|
|
15273
|
+
});
|
|
15243
15274
|
var CommunityAgentReactAddRequestSchema = exports_external.object({
|
|
15244
15275
|
channel: exports_external.string().min(1),
|
|
15245
15276
|
seq: CommunityAgentPositiveSeqSchema,
|
|
15246
15277
|
emoji: exports_external.string().min(1)
|
|
15247
15278
|
});
|
|
15279
|
+
var CommunityAgentFriendRequestSchema = exports_external.object({
|
|
15280
|
+
username: exports_external.string().min(1)
|
|
15281
|
+
});
|
|
15282
|
+
var CommunityAgentListFriendsSchema = exports_external.object({});
|
|
15248
15283
|
var AuditLogCliInvocationPayloadSchema = exports_external.object({
|
|
15249
15284
|
subcommand: exports_external.string().min(1)
|
|
15250
15285
|
});
|
|
@@ -15265,20 +15300,47 @@ var AuditLogWakeTriggerPayloadSchema = exports_external.object({
|
|
|
15265
15300
|
senderHandle: exports_external.string().min(1),
|
|
15266
15301
|
reason: exports_external.enum(["unread", "mention"])
|
|
15267
15302
|
});
|
|
15268
|
-
var AuditLogSessionResetPayloadSchema = exports_external.object({
|
|
15303
|
+
var AuditLogSessionResetPayloadSchema = exports_external.object({
|
|
15304
|
+
trigger: exports_external.enum(["single", "reset_all"])
|
|
15305
|
+
});
|
|
15306
|
+
var AuditLogNapPayloadSchema = exports_external.object({
|
|
15307
|
+
trigger: exports_external.literal("nap")
|
|
15308
|
+
});
|
|
15309
|
+
var AuditLogModelChangedPayloadSchema = exports_external.object({
|
|
15310
|
+
from: exports_external.string().nullable(),
|
|
15311
|
+
to: exports_external.string().nullable()
|
|
15312
|
+
});
|
|
15313
|
+
var AuditLogProviderChangedPayloadSchema = exports_external.object({
|
|
15314
|
+
from: exports_external.string().min(1),
|
|
15315
|
+
to: exports_external.string().min(1)
|
|
15316
|
+
});
|
|
15317
|
+
var AuditLogErrorPayloadSchema = exports_external.object({
|
|
15318
|
+
scope: exports_external.enum(["spawn", "runtime", "exit", "handshake_timeout", "model_switch", "reset"]),
|
|
15319
|
+
code: exports_external.string().min(1).max(120),
|
|
15320
|
+
message: exports_external.string().max(2048),
|
|
15321
|
+
model: exports_external.string().nullable()
|
|
15322
|
+
});
|
|
15269
15323
|
var BotAuditEventSchema = exports_external.discriminatedUnion("kind", [
|
|
15270
15324
|
exports_external.object({ kind: exports_external.literal("cli_invocation"), payload: AuditLogCliInvocationPayloadSchema }),
|
|
15271
15325
|
exports_external.object({ kind: exports_external.literal("tool_call"), payload: AuditLogToolCallPayloadSchema }),
|
|
15272
15326
|
exports_external.object({ kind: exports_external.literal("thinking"), payload: AuditLogThinkingPayloadSchema }),
|
|
15273
15327
|
exports_external.object({ kind: exports_external.literal("wake_trigger"), payload: AuditLogWakeTriggerPayloadSchema }),
|
|
15274
|
-
exports_external.object({ kind: exports_external.literal("session_reset"), payload: AuditLogSessionResetPayloadSchema })
|
|
15328
|
+
exports_external.object({ kind: exports_external.literal("session_reset"), payload: AuditLogSessionResetPayloadSchema }),
|
|
15329
|
+
exports_external.object({ kind: exports_external.literal("nap"), payload: AuditLogNapPayloadSchema }),
|
|
15330
|
+
exports_external.object({ kind: exports_external.literal("model_changed"), payload: AuditLogModelChangedPayloadSchema }),
|
|
15331
|
+
exports_external.object({ kind: exports_external.literal("provider_changed"), payload: AuditLogProviderChangedPayloadSchema }),
|
|
15332
|
+
exports_external.object({ kind: exports_external.literal("error"), payload: AuditLogErrorPayloadSchema })
|
|
15275
15333
|
]);
|
|
15276
15334
|
var BotAuditEventKindSchema = exports_external.enum([
|
|
15277
15335
|
"cli_invocation",
|
|
15278
15336
|
"tool_call",
|
|
15279
15337
|
"thinking",
|
|
15280
15338
|
"wake_trigger",
|
|
15281
|
-
"session_reset"
|
|
15339
|
+
"session_reset",
|
|
15340
|
+
"nap",
|
|
15341
|
+
"model_changed",
|
|
15342
|
+
"provider_changed",
|
|
15343
|
+
"error"
|
|
15282
15344
|
]);
|
|
15283
15345
|
var HostBotAuditEventFrameSchema = exports_external.object({
|
|
15284
15346
|
type: exports_external.literal("bot_audit_event"),
|
|
@@ -15287,7 +15349,71 @@ var HostBotAuditEventFrameSchema = exports_external.object({
|
|
|
15287
15349
|
launchId: exports_external.string().nullable().optional(),
|
|
15288
15350
|
event: BotAuditEventSchema
|
|
15289
15351
|
});
|
|
15290
|
-
//
|
|
15352
|
+
// ../shared/src/community-cli-contract.ts
|
|
15353
|
+
var HostCommandSchema = exports_external.discriminatedUnion("type", [
|
|
15354
|
+
exports_external.object({
|
|
15355
|
+
type: exports_external.literal("agent:wake"),
|
|
15356
|
+
agentId: exports_external.string().min(1),
|
|
15357
|
+
config: exports_external.unknown(),
|
|
15358
|
+
sessionId: exports_external.string().optional(),
|
|
15359
|
+
launchId: exports_external.string().min(1),
|
|
15360
|
+
unreadNotice: exports_external.unknown()
|
|
15361
|
+
}),
|
|
15362
|
+
exports_external.object({
|
|
15363
|
+
type: exports_external.literal("agent:stop"),
|
|
15364
|
+
agentId: exports_external.string().min(1)
|
|
15365
|
+
}),
|
|
15366
|
+
exports_external.object({
|
|
15367
|
+
type: exports_external.literal("agent:reset"),
|
|
15368
|
+
agentId: exports_external.string().min(1),
|
|
15369
|
+
config: exports_external.unknown(),
|
|
15370
|
+
launchId: exports_external.string().min(1)
|
|
15371
|
+
}),
|
|
15372
|
+
exports_external.object({
|
|
15373
|
+
type: exports_external.literal("agent:nap"),
|
|
15374
|
+
agentId: exports_external.string().min(1),
|
|
15375
|
+
config: exports_external.unknown(),
|
|
15376
|
+
launchId: exports_external.string().min(1),
|
|
15377
|
+
handoff: exports_external.string().min(1)
|
|
15378
|
+
}),
|
|
15379
|
+
exports_external.object({
|
|
15380
|
+
type: exports_external.literal("agent:model_switch"),
|
|
15381
|
+
agentId: exports_external.string().min(1),
|
|
15382
|
+
config: exports_external.unknown(),
|
|
15383
|
+
launchId: exports_external.string().min(1)
|
|
15384
|
+
}),
|
|
15385
|
+
exports_external.object({
|
|
15386
|
+
type: exports_external.literal("machine:reset_all"),
|
|
15387
|
+
resets: exports_external.array(exports_external.object({
|
|
15388
|
+
agentId: exports_external.string().min(1),
|
|
15389
|
+
config: exports_external.unknown(),
|
|
15390
|
+
launchId: exports_external.string().min(1)
|
|
15391
|
+
}))
|
|
15392
|
+
}),
|
|
15393
|
+
exports_external.object({
|
|
15394
|
+
type: exports_external.literal("bot:added"),
|
|
15395
|
+
botId: exports_external.string().min(1),
|
|
15396
|
+
name: exports_external.string().optional(),
|
|
15397
|
+
discriminator: exports_external.string().optional(),
|
|
15398
|
+
description: exports_external.string().optional(),
|
|
15399
|
+
ownerName: exports_external.string().optional(),
|
|
15400
|
+
ownerDiscriminator: exports_external.string().optional()
|
|
15401
|
+
}),
|
|
15402
|
+
exports_external.object({
|
|
15403
|
+
type: exports_external.literal("bot:updated"),
|
|
15404
|
+
botId: exports_external.string().min(1),
|
|
15405
|
+
name: exports_external.string().optional(),
|
|
15406
|
+
discriminator: exports_external.string().optional(),
|
|
15407
|
+
description: exports_external.string().optional(),
|
|
15408
|
+
ownerName: exports_external.string().optional(),
|
|
15409
|
+
ownerDiscriminator: exports_external.string().optional()
|
|
15410
|
+
}),
|
|
15411
|
+
exports_external.object({
|
|
15412
|
+
type: exports_external.literal("bot:removed"),
|
|
15413
|
+
botId: exports_external.string().min(1)
|
|
15414
|
+
})
|
|
15415
|
+
]);
|
|
15416
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/entity.js
|
|
15291
15417
|
var entityKind = Symbol.for("drizzle:entityKind");
|
|
15292
15418
|
var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
|
|
15293
15419
|
function is(value, type) {
|
|
@@ -15312,7 +15438,7 @@ function is(value, type) {
|
|
|
15312
15438
|
return false;
|
|
15313
15439
|
}
|
|
15314
15440
|
|
|
15315
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15441
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/column.js
|
|
15316
15442
|
class Column {
|
|
15317
15443
|
constructor(table, config2) {
|
|
15318
15444
|
this.table = table;
|
|
@@ -15362,7 +15488,7 @@ class Column {
|
|
|
15362
15488
|
}
|
|
15363
15489
|
}
|
|
15364
15490
|
|
|
15365
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15491
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/column-builder.js
|
|
15366
15492
|
class ColumnBuilder {
|
|
15367
15493
|
static [entityKind] = "ColumnBuilder";
|
|
15368
15494
|
config;
|
|
@@ -15418,20 +15544,20 @@ class ColumnBuilder {
|
|
|
15418
15544
|
}
|
|
15419
15545
|
}
|
|
15420
15546
|
|
|
15421
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15547
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/table.utils.js
|
|
15422
15548
|
var TableName = Symbol.for("drizzle:Name");
|
|
15423
15549
|
|
|
15424
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15550
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/tracing-utils.js
|
|
15425
15551
|
function iife(fn, ...args) {
|
|
15426
15552
|
return fn(...args);
|
|
15427
15553
|
}
|
|
15428
15554
|
|
|
15429
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15555
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/pg-core/unique-constraint.js
|
|
15430
15556
|
function uniqueKeyName(table, columns) {
|
|
15431
15557
|
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
15432
15558
|
}
|
|
15433
15559
|
|
|
15434
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15560
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/pg-core/columns/common.js
|
|
15435
15561
|
class PgColumn extends Column {
|
|
15436
15562
|
constructor(table, config2) {
|
|
15437
15563
|
if (!config2.uniqueName) {
|
|
@@ -15480,7 +15606,7 @@ class ExtraConfigColumn extends PgColumn {
|
|
|
15480
15606
|
}
|
|
15481
15607
|
}
|
|
15482
15608
|
|
|
15483
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15609
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/pg-core/columns/enum.js
|
|
15484
15610
|
class PgEnumObjectColumn extends PgColumn {
|
|
15485
15611
|
static [entityKind] = "PgEnumObjectColumn";
|
|
15486
15612
|
enum;
|
|
@@ -15510,7 +15636,7 @@ class PgEnumColumn extends PgColumn {
|
|
|
15510
15636
|
}
|
|
15511
15637
|
}
|
|
15512
15638
|
|
|
15513
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15639
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/subquery.js
|
|
15514
15640
|
class Subquery {
|
|
15515
15641
|
static [entityKind] = "Subquery";
|
|
15516
15642
|
constructor(sql, fields, alias, isWith = false, usedTables = []) {
|
|
@@ -15525,10 +15651,10 @@ class Subquery {
|
|
|
15525
15651
|
}
|
|
15526
15652
|
}
|
|
15527
15653
|
|
|
15528
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15654
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/version.js
|
|
15529
15655
|
var version2 = "0.45.2";
|
|
15530
15656
|
|
|
15531
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15657
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/tracing.js
|
|
15532
15658
|
var otel;
|
|
15533
15659
|
var rawTracer;
|
|
15534
15660
|
var tracer = {
|
|
@@ -15555,10 +15681,10 @@ var tracer = {
|
|
|
15555
15681
|
}
|
|
15556
15682
|
};
|
|
15557
15683
|
|
|
15558
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15684
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/view-common.js
|
|
15559
15685
|
var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
|
|
15560
15686
|
|
|
15561
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15687
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/table.js
|
|
15562
15688
|
var Schema = Symbol.for("drizzle:Schema");
|
|
15563
15689
|
var Columns = Symbol.for("drizzle:Columns");
|
|
15564
15690
|
var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
|
|
@@ -15596,7 +15722,7 @@ class Table {
|
|
|
15596
15722
|
}
|
|
15597
15723
|
}
|
|
15598
15724
|
|
|
15599
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15725
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sql/sql.js
|
|
15600
15726
|
function isSQLWrapper(value) {
|
|
15601
15727
|
return value !== null && value !== undefined && typeof value.getSQL === "function";
|
|
15602
15728
|
}
|
|
@@ -15956,7 +16082,7 @@ Subquery.prototype.getSQL = function() {
|
|
|
15956
16082
|
return new SQL([this]);
|
|
15957
16083
|
};
|
|
15958
16084
|
|
|
15959
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16085
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/utils.js
|
|
15960
16086
|
function getColumnNameAndConfig(a, b) {
|
|
15961
16087
|
return {
|
|
15962
16088
|
name: typeof a === "string" && a.length > 0 ? a : "",
|
|
@@ -15969,7 +16095,6 @@ var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder;
|
|
|
15969
16095
|
var exports_community_schema = {};
|
|
15970
16096
|
__export(exports_community_schema, {
|
|
15971
16097
|
communityUserProfile: () => communityUserProfile,
|
|
15972
|
-
communityThreadParticipant: () => communityThreadParticipant,
|
|
15973
16098
|
communityServerMember: () => communityServerMember,
|
|
15974
16099
|
communityServerInvite: () => communityServerInvite,
|
|
15975
16100
|
communityServerFolderItem: () => communityServerFolderItem,
|
|
@@ -15979,21 +16104,23 @@ __export(exports_community_schema, {
|
|
|
15979
16104
|
communityReaction: () => communityReaction,
|
|
15980
16105
|
communityPin: () => communityPin,
|
|
15981
16106
|
communityNotificationSetting: () => communityNotificationSetting,
|
|
16107
|
+
communityMessageTag: () => communityMessageTag,
|
|
15982
16108
|
communityMessageSeq: () => communityMessageSeq,
|
|
16109
|
+
communityMessageMark: () => communityMessageMark,
|
|
15983
16110
|
communityMessage: () => communityMessage,
|
|
15984
16111
|
communityMention: () => communityMention,
|
|
15985
16112
|
communityFriendship: () => communityFriendship,
|
|
15986
|
-
communityDmConversation: () => communityDmConversation,
|
|
15987
16113
|
communityChannelMember: () => communityChannelMember,
|
|
15988
16114
|
communityChannel: () => communityChannel,
|
|
15989
16115
|
communityCategory: () => communityCategory,
|
|
16116
|
+
communityBotDailyActivity: () => communityBotDailyActivity,
|
|
15990
16117
|
communityBotApprovalRequest: () => communityBotApprovalRequest,
|
|
15991
16118
|
communityBotActivityEvent: () => communityBotActivityEvent,
|
|
15992
16119
|
communityAuditLog: () => communityAuditLog,
|
|
15993
16120
|
communityAttachment: () => communityAttachment
|
|
15994
16121
|
});
|
|
15995
16122
|
|
|
15996
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16123
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sqlite-core/foreign-keys.js
|
|
15997
16124
|
class ForeignKeyBuilder {
|
|
15998
16125
|
static [entityKind] = "SQLiteForeignKeyBuilder";
|
|
15999
16126
|
reference;
|
|
@@ -16061,7 +16188,7 @@ function foreignKey(config2) {
|
|
|
16061
16188
|
return new ForeignKeyBuilder(mappedConfig);
|
|
16062
16189
|
}
|
|
16063
16190
|
|
|
16064
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16191
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sqlite-core/unique-constraint.js
|
|
16065
16192
|
function uniqueKeyName2(table, columns) {
|
|
16066
16193
|
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
16067
16194
|
}
|
|
@@ -16106,7 +16233,7 @@ class UniqueConstraint {
|
|
|
16106
16233
|
}
|
|
16107
16234
|
}
|
|
16108
16235
|
|
|
16109
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16236
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sqlite-core/columns/common.js
|
|
16110
16237
|
class SQLiteColumnBuilder extends ColumnBuilder {
|
|
16111
16238
|
static [entityKind] = "SQLiteColumnBuilder";
|
|
16112
16239
|
foreignKeyConfigs = [];
|
|
@@ -16157,7 +16284,7 @@ class SQLiteColumn extends Column {
|
|
|
16157
16284
|
static [entityKind] = "SQLiteColumn";
|
|
16158
16285
|
}
|
|
16159
16286
|
|
|
16160
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16287
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sqlite-core/columns/blob.js
|
|
16161
16288
|
class SQLiteBigIntBuilder extends SQLiteColumnBuilder {
|
|
16162
16289
|
static [entityKind] = "SQLiteBigIntBuilder";
|
|
16163
16290
|
constructor(name) {
|
|
@@ -16245,7 +16372,7 @@ function blob(a, b) {
|
|
|
16245
16372
|
return new SQLiteBlobBufferBuilder(name);
|
|
16246
16373
|
}
|
|
16247
16374
|
|
|
16248
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16375
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sqlite-core/columns/custom.js
|
|
16249
16376
|
class SQLiteCustomColumnBuilder extends SQLiteColumnBuilder {
|
|
16250
16377
|
static [entityKind] = "SQLiteCustomColumnBuilder";
|
|
16251
16378
|
constructor(name, fieldConfig, customTypeParams) {
|
|
@@ -16286,7 +16413,7 @@ function customType(customTypeParams) {
|
|
|
16286
16413
|
};
|
|
16287
16414
|
}
|
|
16288
16415
|
|
|
16289
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16416
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sqlite-core/columns/integer.js
|
|
16290
16417
|
class SQLiteBaseIntegerBuilder extends SQLiteColumnBuilder {
|
|
16291
16418
|
static [entityKind] = "SQLiteBaseIntegerBuilder";
|
|
16292
16419
|
constructor(name, dataType, columnType) {
|
|
@@ -16388,7 +16515,7 @@ function integer2(a, b) {
|
|
|
16388
16515
|
return new SQLiteIntegerBuilder(name);
|
|
16389
16516
|
}
|
|
16390
16517
|
|
|
16391
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16518
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sqlite-core/columns/numeric.js
|
|
16392
16519
|
class SQLiteNumericBuilder extends SQLiteColumnBuilder {
|
|
16393
16520
|
static [entityKind] = "SQLiteNumericBuilder";
|
|
16394
16521
|
constructor(name) {
|
|
@@ -16458,7 +16585,7 @@ function numeric(a, b) {
|
|
|
16458
16585
|
return mode === "number" ? new SQLiteNumericNumberBuilder(name) : mode === "bigint" ? new SQLiteNumericBigIntBuilder(name) : new SQLiteNumericBuilder(name);
|
|
16459
16586
|
}
|
|
16460
16587
|
|
|
16461
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16588
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sqlite-core/columns/real.js
|
|
16462
16589
|
class SQLiteRealBuilder extends SQLiteColumnBuilder {
|
|
16463
16590
|
static [entityKind] = "SQLiteRealBuilder";
|
|
16464
16591
|
constructor(name) {
|
|
@@ -16479,7 +16606,7 @@ function real(name) {
|
|
|
16479
16606
|
return new SQLiteRealBuilder(name ?? "");
|
|
16480
16607
|
}
|
|
16481
16608
|
|
|
16482
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16609
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sqlite-core/columns/text.js
|
|
16483
16610
|
class SQLiteTextBuilder extends SQLiteColumnBuilder {
|
|
16484
16611
|
static [entityKind] = "SQLiteTextBuilder";
|
|
16485
16612
|
constructor(name, config2) {
|
|
@@ -16534,7 +16661,7 @@ function text(a, b = {}) {
|
|
|
16534
16661
|
return new SQLiteTextBuilder(name, config2);
|
|
16535
16662
|
}
|
|
16536
16663
|
|
|
16537
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16664
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sqlite-core/columns/all.js
|
|
16538
16665
|
function getSQLiteColumnBuilders() {
|
|
16539
16666
|
return {
|
|
16540
16667
|
blob,
|
|
@@ -16546,7 +16673,7 @@ function getSQLiteColumnBuilders() {
|
|
|
16546
16673
|
};
|
|
16547
16674
|
}
|
|
16548
16675
|
|
|
16549
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16676
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sqlite-core/table.js
|
|
16550
16677
|
var InlineForeignKeys = Symbol.for("drizzle:SQLiteInlineForeignKeys");
|
|
16551
16678
|
|
|
16552
16679
|
class SQLiteTable extends Table {
|
|
@@ -16580,7 +16707,7 @@ var sqliteTable = (name, columns, extraConfig) => {
|
|
|
16580
16707
|
return sqliteTableBase(name, columns, extraConfig);
|
|
16581
16708
|
};
|
|
16582
16709
|
|
|
16583
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16710
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sqlite-core/indexes.js
|
|
16584
16711
|
class IndexBuilderOn {
|
|
16585
16712
|
constructor(name, unique2) {
|
|
16586
16713
|
this.name = name;
|
|
@@ -16626,7 +16753,7 @@ function uniqueIndex(name) {
|
|
|
16626
16753
|
return new IndexBuilderOn(name, true);
|
|
16627
16754
|
}
|
|
16628
16755
|
|
|
16629
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16756
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sqlite-core/primary-keys.js
|
|
16630
16757
|
function primaryKey(...config2) {
|
|
16631
16758
|
if (config2[0].columns) {
|
|
16632
16759
|
return new PrimaryKeyBuilder(config2[0].columns, config2[0].name);
|
|
@@ -16714,7 +16841,8 @@ var user = sqliteTable("user", {
|
|
|
16714
16841
|
isBot: integer2("isBot", { mode: "boolean" }).notNull().default(false),
|
|
16715
16842
|
ownerUserId: text("ownerUserId").references(() => user.id, { onDelete: "no action" }),
|
|
16716
16843
|
deletedAt: text("deletedAt"),
|
|
16717
|
-
discriminator: text("discriminator").notNull().default("0000")
|
|
16844
|
+
discriminator: text("discriminator").notNull().default("0000"),
|
|
16845
|
+
lastRefreshContextAt: text("lastRefreshContextAt")
|
|
16718
16846
|
}, (t) => [index("idx_user_ownerUserId_isBot").on(t.ownerUserId, t.isBot)]);
|
|
16719
16847
|
var session = sqliteTable("session", {
|
|
16720
16848
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
@@ -17256,11 +17384,14 @@ var inboxUnread = sqliteTable("inbox_unread", {
|
|
|
17256
17384
|
var communityServer = sqliteTable("community_server", {
|
|
17257
17385
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17258
17386
|
name: text("name").notNull(),
|
|
17387
|
+
discriminator: text("discriminator").notNull().default("0000"),
|
|
17259
17388
|
description: text("description").default(""),
|
|
17260
17389
|
icon: text("icon"),
|
|
17261
17390
|
ownerId: text("owner_id").notNull().references(() => user.id, { onDelete: "restrict" }),
|
|
17262
17391
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17263
|
-
})
|
|
17392
|
+
}, (t) => [
|
|
17393
|
+
uniqueIndex("idx_community_server_name_discriminator").on(t.name, t.discriminator)
|
|
17394
|
+
]);
|
|
17264
17395
|
var communityCategory = sqliteTable("community_category", {
|
|
17265
17396
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17266
17397
|
serverId: text("server_id").notNull().references(() => communityServer.id, { onDelete: "cascade" }),
|
|
@@ -17271,15 +17402,16 @@ var communityCategory = sqliteTable("community_category", {
|
|
|
17271
17402
|
}, (t) => [unique("uq_category_server_name").on(t.serverId, t.name)]);
|
|
17272
17403
|
var communityChannel = sqliteTable("community_channel", {
|
|
17273
17404
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17274
|
-
serverId: text("server_id").
|
|
17405
|
+
serverId: text("server_id").references(() => communityServer.id, {
|
|
17406
|
+
onDelete: "cascade"
|
|
17407
|
+
}),
|
|
17275
17408
|
categoryId: text("category_id").references(() => communityCategory.id, {
|
|
17276
17409
|
onDelete: "set null"
|
|
17277
17410
|
}),
|
|
17278
|
-
name: text("name")
|
|
17411
|
+
name: text("name"),
|
|
17279
17412
|
type: text("type").notNull().default("text"),
|
|
17280
17413
|
topic: text("topic").default(""),
|
|
17281
17414
|
position: integer2("position").default(0),
|
|
17282
|
-
forumTags: text("forum_tags"),
|
|
17283
17415
|
parentChannelId: text("parent_channel_id").references(() => communityChannel.id, {
|
|
17284
17416
|
onDelete: "cascade"
|
|
17285
17417
|
}),
|
|
@@ -17299,33 +17431,14 @@ var communityChannelMember = sqliteTable("community_channel_member", {
|
|
|
17299
17431
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17300
17432
|
channelId: text("channel_id").notNull().references(() => communityChannel.id, { onDelete: "cascade" }),
|
|
17301
17433
|
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17434
|
+
relation: text("relation").notNull().default("access"),
|
|
17435
|
+
source: text("source").notNull().default("added"),
|
|
17302
17436
|
addedBy: text("added_by").references(() => user.id, { onDelete: "set null" }),
|
|
17303
17437
|
addedAt: text("added_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17304
17438
|
}, (t) => [
|
|
17305
|
-
unique("uq_channel_member").on(t.channelId, t.userId),
|
|
17439
|
+
unique("uq_channel_member").on(t.channelId, t.userId, t.relation),
|
|
17306
17440
|
index("idx_channel_member_user").on(t.userId)
|
|
17307
17441
|
]);
|
|
17308
|
-
var communityThreadParticipant = sqliteTable("community_thread_participant", {
|
|
17309
|
-
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17310
|
-
threadChannelId: text("thread_channel_id").notNull().references(() => communityChannel.id, { onDelete: "cascade" }),
|
|
17311
|
-
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17312
|
-
source: text("source").notNull().default("mention"),
|
|
17313
|
-
addedAt: text("added_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17314
|
-
}, (t) => [
|
|
17315
|
-
unique("uq_thread_participant").on(t.threadChannelId, t.userId),
|
|
17316
|
-
index("idx_thread_participant_user").on(t.userId)
|
|
17317
|
-
]);
|
|
17318
|
-
var communityDmConversation = sqliteTable("community_dm_conversation", {
|
|
17319
|
-
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17320
|
-
user1Id: text("user1_id").references(() => user.id, { onDelete: "set null" }),
|
|
17321
|
-
user2Id: text("user2_id").references(() => user.id, { onDelete: "set null" }),
|
|
17322
|
-
lastMessageAt: text("last_message_at"),
|
|
17323
|
-
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17324
|
-
}, (t) => [
|
|
17325
|
-
unique("uq_dm_conversation_users").on(t.user1Id, t.user2Id),
|
|
17326
|
-
index("idx_dm_conversation_user1_last_message").on(t.user1Id, t.lastMessageAt),
|
|
17327
|
-
index("idx_dm_conversation_user2_last_message").on(t.user2Id, t.lastMessageAt)
|
|
17328
|
-
]);
|
|
17329
17442
|
var communityMessage = sqliteTable("community_message", {
|
|
17330
17443
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17331
17444
|
authorId: text("author_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
@@ -17334,20 +17447,19 @@ var communityMessage = sqliteTable("community_message", {
|
|
|
17334
17447
|
mentionType: text("mention_type"),
|
|
17335
17448
|
replyToId: text("reply_to_id"),
|
|
17336
17449
|
embeds: text("embeds"),
|
|
17337
|
-
flags: integer2("flags").default(0),
|
|
17338
17450
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),
|
|
17339
|
-
channelId: text("channel_id").references(() => communityChannel.id, {
|
|
17451
|
+
channelId: text("channel_id").notNull().references(() => communityChannel.id, {
|
|
17340
17452
|
onDelete: "cascade"
|
|
17341
17453
|
}),
|
|
17342
|
-
|
|
17343
|
-
|
|
17454
|
+
seq: integer2("seq").notNull().default(0),
|
|
17455
|
+
friendshipId: text("friendship_id").references(() => communityFriendship.id, { onDelete: "set null" }),
|
|
17456
|
+
clientNonce: text("client_nonce")
|
|
17344
17457
|
}, (t) => [
|
|
17345
17458
|
index("idx_message_channel_created").on(t.channelId, t.createdAt),
|
|
17346
|
-
index("idx_message_channel_mention_created").on(t.channelId, t.mentionType, t.createdAt)
|
|
17347
|
-
index("idx_message_dm_created").on(t.dmConversationId, t.createdAt)
|
|
17459
|
+
index("idx_message_channel_mention_created").on(t.channelId, t.mentionType, t.createdAt)
|
|
17348
17460
|
]);
|
|
17349
17461
|
var communityMessageSeq = sqliteTable("community_message_seq", {
|
|
17350
|
-
|
|
17462
|
+
channelId: text("channel_id").primaryKey().references(() => communityChannel.id, { onDelete: "cascade" }),
|
|
17351
17463
|
nextSeq: integer2("next_seq").notNull()
|
|
17352
17464
|
});
|
|
17353
17465
|
var communityServerMember = sqliteTable("community_server_member", {
|
|
@@ -17355,7 +17467,6 @@ var communityServerMember = sqliteTable("community_server_member", {
|
|
|
17355
17467
|
serverId: text("server_id").notNull().references(() => communityServer.id, { onDelete: "cascade" }),
|
|
17356
17468
|
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17357
17469
|
role: text("role").default("member"),
|
|
17358
|
-
nickname: text("nickname"),
|
|
17359
17470
|
railOrder: integer2("rail_order").default(0),
|
|
17360
17471
|
joinedAt: text("joined_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17361
17472
|
}, (t) => [
|
|
@@ -17393,21 +17504,21 @@ var communityFriendship = sqliteTable("community_friendship", {
|
|
|
17393
17504
|
requesterId: text("requester_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17394
17505
|
addresseeId: text("addressee_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17395
17506
|
status: text("status").notNull().default("pending"),
|
|
17507
|
+
needsOwnerApproval: text("needs_owner_approval").references(() => user.id),
|
|
17396
17508
|
blockerId: text("blocker_id"),
|
|
17397
17509
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),
|
|
17398
|
-
updatedAt: text("updated_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17510
|
+
updatedAt: text("updated_at").notNull().$defaultFn(() => new Date().toISOString()),
|
|
17511
|
+
resolvedAt: text("resolved_at")
|
|
17399
17512
|
}, (t) => [
|
|
17400
|
-
unique("uq_friendship_requester_addressee").on(t.requesterId, t.addresseeId),
|
|
17401
17513
|
index("idx_friendship_addressee_status").on(t.addresseeId, t.status),
|
|
17402
17514
|
index("idx_friendship_requester_status").on(t.requesterId, t.status)
|
|
17403
17515
|
]);
|
|
17404
17516
|
var communityReadState = sqliteTable("community_read_state", {
|
|
17405
17517
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17406
17518
|
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17407
|
-
channelId: text("channel_id").references(() => communityChannel.id, {
|
|
17519
|
+
channelId: text("channel_id").notNull().references(() => communityChannel.id, {
|
|
17408
17520
|
onDelete: "cascade"
|
|
17409
17521
|
}),
|
|
17410
|
-
dmConversationId: text("dm_conversation_id").references(() => communityDmConversation.id, { onDelete: "cascade" }),
|
|
17411
17522
|
lastReadAt: text("last_read_at").notNull(),
|
|
17412
17523
|
lastReadMessageId: text("last_read_message_id"),
|
|
17413
17524
|
lastReadSeq: integer2("last_read_seq").notNull().default(0)
|
|
@@ -17428,7 +17539,6 @@ var communityAttachment = sqliteTable("community_attachment", {
|
|
|
17428
17539
|
onDelete: "cascade"
|
|
17429
17540
|
}),
|
|
17430
17541
|
uploaderId: text("uploader_id").notNull(),
|
|
17431
|
-
kind: text("kind").notNull(),
|
|
17432
17542
|
targetId: text("target_id").notNull(),
|
|
17433
17543
|
r2Key: text("r2_key").notNull(),
|
|
17434
17544
|
filename: text("filename").notNull(),
|
|
@@ -17520,6 +17630,30 @@ var communityBotActivityEvent = sqliteTable("community_bot_activity_event", {
|
|
|
17520
17630
|
}, (t) => [
|
|
17521
17631
|
index("idx_bot_activity_event_bot_created").on(t.botId, t.createdAt, t.id)
|
|
17522
17632
|
]);
|
|
17633
|
+
var communityBotDailyActivity = sqliteTable("community_bot_daily_activity", {
|
|
17634
|
+
botId: text("bot_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17635
|
+
day: text("day").notNull(),
|
|
17636
|
+
handledCount: integer2("handled_count").notNull().default(0),
|
|
17637
|
+
sentCount: integer2("sent_count").notNull().default(0)
|
|
17638
|
+
}, (t) => [primaryKey({ columns: [t.botId, t.day] })]);
|
|
17639
|
+
var communityMessageMark = sqliteTable("community_message_mark", {
|
|
17640
|
+
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17641
|
+
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17642
|
+
channelId: text("channel_id").notNull().references(() => communityChannel.id, { onDelete: "cascade" }),
|
|
17643
|
+
messageId: text("message_id").notNull().references(() => communityMessage.id, { onDelete: "cascade" }),
|
|
17644
|
+
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17645
|
+
}, (t) => [
|
|
17646
|
+
unique("uq_mark_user_message").on(t.userId, t.messageId),
|
|
17647
|
+
index("idx_mark_user_created").on(t.userId, t.createdAt)
|
|
17648
|
+
]);
|
|
17649
|
+
var communityMessageTag = sqliteTable("community_message_tag", {
|
|
17650
|
+
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17651
|
+
messageId: text("message_id").notNull().references(() => communityMessage.id, { onDelete: "cascade" }),
|
|
17652
|
+
tag: text("tag").notNull()
|
|
17653
|
+
}, (t) => [
|
|
17654
|
+
unique("uq_message_tag").on(t.messageId, t.tag),
|
|
17655
|
+
index("idx_message_tag_tag").on(t.tag, t.messageId)
|
|
17656
|
+
]);
|
|
17523
17657
|
|
|
17524
17658
|
// ../shared/src/logger.ts
|
|
17525
17659
|
var LEVELS = {
|
|
@@ -17601,6 +17735,14 @@ function createLogger(opts) {
|
|
|
17601
17735
|
return new Logger(opts);
|
|
17602
17736
|
}
|
|
17603
17737
|
|
|
17738
|
+
// ../shared/src/db/queries/_chunk.ts
|
|
17739
|
+
var D1_MAX_BIND_PARAMS = 100;
|
|
17740
|
+
function maxRowsPerInsert(paramsPerRow) {
|
|
17741
|
+
if (paramsPerRow < 1)
|
|
17742
|
+
throw new Error("paramsPerRow must be >= 1");
|
|
17743
|
+
return Math.floor(D1_MAX_BIND_PARAMS / paramsPerRow);
|
|
17744
|
+
}
|
|
17745
|
+
|
|
17604
17746
|
// ../shared/src/db/queries/community/message.ts
|
|
17605
17747
|
var log = createLogger({ service: "community-queries" });
|
|
17606
17748
|
var listedMessageProjection = {
|
|
@@ -17611,11 +17753,11 @@ var listedMessageProjection = {
|
|
|
17611
17753
|
mentionType: communityMessage.mentionType,
|
|
17612
17754
|
replyToId: communityMessage.replyToId,
|
|
17613
17755
|
embeds: communityMessage.embeds,
|
|
17614
|
-
flags: communityMessage.flags,
|
|
17615
17756
|
seq: communityMessage.seq,
|
|
17616
17757
|
createdAt: communityMessage.createdAt,
|
|
17617
17758
|
channelId: communityMessage.channelId,
|
|
17618
|
-
|
|
17759
|
+
friendshipId: communityMessage.friendshipId,
|
|
17760
|
+
clientNonce: communityMessage.clientNonce,
|
|
17619
17761
|
authorName: user.name,
|
|
17620
17762
|
authorEmail: user.email,
|
|
17621
17763
|
authorImage: user.image
|
|
@@ -17680,6 +17822,7 @@ var communityBotBinding = sqliteTable("community_bot_binding", {
|
|
|
17680
17822
|
userId: text("user_id").primaryKey().references(() => user.id, { onDelete: "cascade" }),
|
|
17681
17823
|
machineId: text("machine_id").notNull().references(() => communityMachine.id, { onDelete: "restrict" }),
|
|
17682
17824
|
runtime: text("runtime").notNull(),
|
|
17825
|
+
modelName: text("model_name"),
|
|
17683
17826
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17684
17827
|
}, (t) => [index("idx_community_bot_binding_machine").on(t.machineId)]);
|
|
17685
17828
|
var communityAgentRunnerKey = sqliteTable("community_agent_runner_key", {
|
|
@@ -17714,7 +17857,6 @@ var internalUserColumns = {
|
|
|
17714
17857
|
};
|
|
17715
17858
|
|
|
17716
17859
|
// ../shared/src/db/queries/community/channel.ts
|
|
17717
|
-
var log2 = createLogger({ service: "community-queries" });
|
|
17718
17860
|
var CHANNEL_COLUMNS = {
|
|
17719
17861
|
id: communityChannel.id,
|
|
17720
17862
|
serverId: communityChannel.serverId,
|
|
@@ -17723,7 +17865,6 @@ var CHANNEL_COLUMNS = {
|
|
|
17723
17865
|
type: communityChannel.type,
|
|
17724
17866
|
topic: communityChannel.topic,
|
|
17725
17867
|
position: communityChannel.position,
|
|
17726
|
-
forumTags: communityChannel.forumTags,
|
|
17727
17868
|
parentChannelId: communityChannel.parentChannelId,
|
|
17728
17869
|
creatorId: communityChannel.creatorId,
|
|
17729
17870
|
messageCount: communityChannel.messageCount,
|
|
@@ -17733,6 +17874,16 @@ var CHANNEL_COLUMNS = {
|
|
|
17733
17874
|
createdAt: communityChannel.createdAt
|
|
17734
17875
|
};
|
|
17735
17876
|
|
|
17877
|
+
// ../shared/src/db/queries/community/thread.ts
|
|
17878
|
+
var NOTIFY_CONFLICT_TARGET = [
|
|
17879
|
+
communityChannelMember.channelId,
|
|
17880
|
+
communityChannelMember.userId,
|
|
17881
|
+
communityChannelMember.relation
|
|
17882
|
+
];
|
|
17883
|
+
|
|
17884
|
+
// ../shared/src/db/resilience.ts
|
|
17885
|
+
var defaultLogger = createLogger({ service: "d1-resilience" });
|
|
17886
|
+
|
|
17736
17887
|
// ../shared/src/db/queries/community/agent-inbox.ts
|
|
17737
17888
|
var AGENT_MESSAGE_COLUMNS = {
|
|
17738
17889
|
id: communityMessage.id,
|
|
@@ -17740,9 +17891,13 @@ var AGENT_MESSAGE_COLUMNS = {
|
|
|
17740
17891
|
content: communityMessage.content,
|
|
17741
17892
|
createdAt: communityMessage.createdAt,
|
|
17742
17893
|
channelId: communityMessage.channelId,
|
|
17743
|
-
|
|
17744
|
-
|
|
17894
|
+
seq: communityMessage.seq,
|
|
17895
|
+
replyToId: communityMessage.replyToId
|
|
17745
17896
|
};
|
|
17897
|
+
var channelJoinBaselineGuard = sql`${communityMessage.createdAt} > COALESCE(${communityChannelMember.addedAt}, ${communityServerMember.joinedAt}, '')`;
|
|
17898
|
+
|
|
17899
|
+
// ../shared/src/db/queries/community/mention.ts
|
|
17900
|
+
var MENTION_INSERT_MAX_ROWS = maxRowsPerInsert(5);
|
|
17746
17901
|
// ../shared/src/community/bot-activity-presets.ts
|
|
17747
17902
|
var BOT_ACTIVITY_PRESETS = {
|
|
17748
17903
|
idle: { emoji: "\uD83D\uDCA4", text: "Idle" },
|
|
@@ -17757,9 +17912,467 @@ var RUNNING_PRESETS = [
|
|
|
17757
17912
|
{ emoji: "\uD83D\uDE80", text: "On it" },
|
|
17758
17913
|
{ emoji: "\uD83D\uDD25", text: "In the zone" }
|
|
17759
17914
|
];
|
|
17760
|
-
|
|
17761
|
-
|
|
17762
|
-
|
|
17915
|
+
var BOT_ACTIVITY_STATUS_PAIRS = [
|
|
17916
|
+
BOT_ACTIVITY_PRESETS.idle,
|
|
17917
|
+
BOT_ACTIVITY_PRESETS.starting,
|
|
17918
|
+
BOT_ACTIVITY_PRESETS.stopping,
|
|
17919
|
+
...RUNNING_PRESETS
|
|
17920
|
+
];
|
|
17921
|
+
// ../shared/src/community-ws-events.ts
|
|
17922
|
+
var string4 = exports_external.string();
|
|
17923
|
+
var nullableString = string4.nullable();
|
|
17924
|
+
var channelTypeSchema = exports_external.enum(["text", "forum"]);
|
|
17925
|
+
var mentionTypeSchema = exports_external.literal("everyone");
|
|
17926
|
+
var friendApprovalProfileSchema = exports_external.strictObject({
|
|
17927
|
+
id: string4,
|
|
17928
|
+
name: string4,
|
|
17929
|
+
discriminator: string4,
|
|
17930
|
+
image: nullableString
|
|
17931
|
+
});
|
|
17932
|
+
var FriendApprovalPayloadSchema = exports_external.strictObject({
|
|
17933
|
+
friendshipId: string4,
|
|
17934
|
+
status: exports_external.enum(["pending", "approved", "denied", "superseded", "cancelled"]),
|
|
17935
|
+
waitingOn: exports_external.enum(["you", "other-owner", "addressee"]).nullable(),
|
|
17936
|
+
otherProfile: friendApprovalProfileSchema,
|
|
17937
|
+
botProfile: friendApprovalProfileSchema,
|
|
17938
|
+
waitingOnProfile: friendApprovalProfileSchema.nullable().optional()
|
|
17939
|
+
});
|
|
17940
|
+
var messageAttachmentSchema = exports_external.strictObject({
|
|
17941
|
+
id: string4,
|
|
17942
|
+
filename: string4,
|
|
17943
|
+
url: string4,
|
|
17944
|
+
contentType: string4.optional(),
|
|
17945
|
+
size: exports_external.number().optional(),
|
|
17946
|
+
width: exports_external.number().nullable().optional(),
|
|
17947
|
+
height: exports_external.number().nullable().optional()
|
|
17948
|
+
});
|
|
17949
|
+
var messageSchema = exports_external.strictObject({
|
|
17950
|
+
id: string4,
|
|
17951
|
+
seq: exports_external.number(),
|
|
17952
|
+
authorId: string4,
|
|
17953
|
+
authorName: string4,
|
|
17954
|
+
authorAvatar: string4.optional(),
|
|
17955
|
+
content: string4,
|
|
17956
|
+
type: exports_external.enum(["chat", "system"]),
|
|
17957
|
+
systemKind: exports_external.literal("thread").optional(),
|
|
17958
|
+
mentionType: mentionTypeSchema.nullable().optional(),
|
|
17959
|
+
replyToId: nullableString.optional(),
|
|
17960
|
+
replyTo: exports_external.strictObject({
|
|
17961
|
+
id: string4,
|
|
17962
|
+
authorName: string4,
|
|
17963
|
+
text: string4,
|
|
17964
|
+
deleted: exports_external.boolean().optional()
|
|
17965
|
+
}).optional(),
|
|
17966
|
+
embeds: exports_external.array(exports_external.unknown()).optional(),
|
|
17967
|
+
attachments: exports_external.array(messageAttachmentSchema).optional(),
|
|
17968
|
+
createdAt: string4,
|
|
17969
|
+
clientNonce: string4.optional(),
|
|
17970
|
+
approval: FriendApprovalPayloadSchema.optional()
|
|
17971
|
+
});
|
|
17972
|
+
var communityMessageCreateSchema = exports_external.strictObject({
|
|
17973
|
+
type: exports_external.literal("community:message.create"),
|
|
17974
|
+
channelId: string4,
|
|
17975
|
+
serverId: string4.optional(),
|
|
17976
|
+
parentChannelId: string4.optional(),
|
|
17977
|
+
message: messageSchema
|
|
17978
|
+
});
|
|
17979
|
+
var communityMessageUpdatedSchema = exports_external.strictObject({
|
|
17980
|
+
type: exports_external.literal("community:message.updated"),
|
|
17981
|
+
channelId: string4,
|
|
17982
|
+
messageId: string4,
|
|
17983
|
+
approval: FriendApprovalPayloadSchema
|
|
17984
|
+
});
|
|
17985
|
+
var communityMessageEditedSchema = exports_external.strictObject({
|
|
17986
|
+
type: exports_external.literal("community:message.edited"),
|
|
17987
|
+
channelId: string4,
|
|
17988
|
+
messageId: string4,
|
|
17989
|
+
content: string4,
|
|
17990
|
+
parentChannelId: string4.optional(),
|
|
17991
|
+
serverId: string4.optional()
|
|
17992
|
+
}).refine((event) => event.parentChannelId === undefined || event.serverId !== undefined);
|
|
17993
|
+
var communityReactionAddSchema = exports_external.strictObject({
|
|
17994
|
+
type: exports_external.literal("community:reaction.add"),
|
|
17995
|
+
channelId: string4,
|
|
17996
|
+
messageId: string4,
|
|
17997
|
+
userId: string4,
|
|
17998
|
+
emoji: string4
|
|
17999
|
+
});
|
|
18000
|
+
var communityReactionRemoveSchema = exports_external.strictObject({
|
|
18001
|
+
type: exports_external.literal("community:reaction.remove"),
|
|
18002
|
+
channelId: string4,
|
|
18003
|
+
messageId: string4,
|
|
18004
|
+
userId: string4,
|
|
18005
|
+
emoji: string4
|
|
18006
|
+
});
|
|
18007
|
+
var communityPinAddSchema = exports_external.strictObject({
|
|
18008
|
+
type: exports_external.literal("community:pin.add"),
|
|
18009
|
+
channelId: string4,
|
|
18010
|
+
messageId: string4
|
|
18011
|
+
});
|
|
18012
|
+
var communityPinRemoveSchema = exports_external.strictObject({
|
|
18013
|
+
type: exports_external.literal("community:pin.remove"),
|
|
18014
|
+
channelId: string4,
|
|
18015
|
+
messageId: string4
|
|
18016
|
+
});
|
|
18017
|
+
var typingFields = {
|
|
18018
|
+
channelId: string4,
|
|
18019
|
+
userId: string4,
|
|
18020
|
+
name: string4.optional(),
|
|
18021
|
+
discriminator: string4.optional()
|
|
18022
|
+
};
|
|
18023
|
+
var communityTypingStartSchema = exports_external.strictObject({
|
|
18024
|
+
type: exports_external.literal("community:typing.start"),
|
|
18025
|
+
...typingFields
|
|
18026
|
+
});
|
|
18027
|
+
var communityTypingStopSchema = exports_external.strictObject({
|
|
18028
|
+
type: exports_external.literal("community:typing.stop"),
|
|
18029
|
+
...typingFields
|
|
18030
|
+
});
|
|
18031
|
+
var communityChildChannelCreateSchema = exports_external.strictObject({
|
|
18032
|
+
type: exports_external.literal("community:channel.child_create"),
|
|
18033
|
+
parentChannelId: string4,
|
|
18034
|
+
channel: exports_external.strictObject({
|
|
18035
|
+
id: string4,
|
|
18036
|
+
name: string4,
|
|
18037
|
+
type: exports_external.literal("thread"),
|
|
18038
|
+
creatorId: string4.optional(),
|
|
18039
|
+
createdAt: string4
|
|
18040
|
+
}),
|
|
18041
|
+
parentMessageId: string4.optional()
|
|
18042
|
+
});
|
|
18043
|
+
var communityChildChannelUpdateSchema = exports_external.strictObject({
|
|
18044
|
+
type: exports_external.literal("community:channel.child_update"),
|
|
18045
|
+
parentChannelId: string4,
|
|
18046
|
+
channelId: string4,
|
|
18047
|
+
changes: exports_external.strictObject({
|
|
18048
|
+
name: string4.optional(),
|
|
18049
|
+
archived: exports_external.boolean().optional(),
|
|
18050
|
+
tags: exports_external.array(string4).nullable().optional(),
|
|
18051
|
+
lastMessageAt: string4.optional(),
|
|
18052
|
+
messageCount: exports_external.number().optional()
|
|
18053
|
+
})
|
|
18054
|
+
});
|
|
18055
|
+
var communityServerUpdateSchema = exports_external.strictObject({
|
|
18056
|
+
type: exports_external.literal("community:server.update"),
|
|
18057
|
+
serverId: string4,
|
|
18058
|
+
changes: exports_external.strictObject({
|
|
18059
|
+
name: string4.optional(),
|
|
18060
|
+
description: string4.optional(),
|
|
18061
|
+
icon: nullableString.optional()
|
|
18062
|
+
})
|
|
18063
|
+
});
|
|
18064
|
+
var communityServerDeleteSchema = exports_external.strictObject({
|
|
18065
|
+
type: exports_external.literal("community:server.delete"),
|
|
18066
|
+
serverId: string4
|
|
18067
|
+
});
|
|
18068
|
+
var communityChannelCreateSchema = exports_external.strictObject({
|
|
18069
|
+
type: exports_external.literal("community:channel.create"),
|
|
18070
|
+
serverId: string4,
|
|
18071
|
+
channel: exports_external.strictObject({
|
|
18072
|
+
id: string4,
|
|
18073
|
+
name: string4,
|
|
18074
|
+
type: channelTypeSchema,
|
|
18075
|
+
categoryId: nullableString.optional(),
|
|
18076
|
+
topic: string4.optional(),
|
|
18077
|
+
position: exports_external.number(),
|
|
18078
|
+
createdAt: string4
|
|
18079
|
+
})
|
|
18080
|
+
});
|
|
18081
|
+
var communityChannelUpdateSchema = exports_external.strictObject({
|
|
18082
|
+
type: exports_external.literal("community:channel.update"),
|
|
18083
|
+
serverId: string4,
|
|
18084
|
+
channelId: string4,
|
|
18085
|
+
changes: exports_external.strictObject({
|
|
18086
|
+
name: string4.optional(),
|
|
18087
|
+
topic: string4.optional(),
|
|
18088
|
+
categoryId: nullableString.optional(),
|
|
18089
|
+
type: channelTypeSchema.optional()
|
|
18090
|
+
})
|
|
18091
|
+
});
|
|
18092
|
+
var communityChannelDeleteSchema = exports_external.strictObject({
|
|
18093
|
+
type: exports_external.literal("community:channel.delete"),
|
|
18094
|
+
serverId: string4,
|
|
18095
|
+
channelId: string4,
|
|
18096
|
+
parentChannelId: nullableString.optional()
|
|
18097
|
+
});
|
|
18098
|
+
var positionedIdSchema = exports_external.strictObject({ id: string4, position: exports_external.number() });
|
|
18099
|
+
var communityChannelReorderSchema = exports_external.strictObject({
|
|
18100
|
+
type: exports_external.literal("community:channel.reorder"),
|
|
18101
|
+
serverId: string4,
|
|
18102
|
+
channels: exports_external.array(positionedIdSchema)
|
|
18103
|
+
});
|
|
18104
|
+
var communityChannelMemberAddSchema = exports_external.strictObject({
|
|
18105
|
+
type: exports_external.literal("community:channel.member_add"),
|
|
18106
|
+
serverId: string4,
|
|
18107
|
+
channelId: string4,
|
|
18108
|
+
userId: string4
|
|
18109
|
+
});
|
|
18110
|
+
var communityChannelMemberRemoveSchema = exports_external.strictObject({
|
|
18111
|
+
type: exports_external.literal("community:channel.member_remove"),
|
|
18112
|
+
serverId: string4,
|
|
18113
|
+
channelId: string4,
|
|
18114
|
+
userId: string4
|
|
18115
|
+
});
|
|
18116
|
+
var communityCategoryCreateSchema = exports_external.strictObject({
|
|
18117
|
+
type: exports_external.literal("community:category.create"),
|
|
18118
|
+
serverId: string4,
|
|
18119
|
+
category: exports_external.strictObject({
|
|
18120
|
+
id: string4,
|
|
18121
|
+
name: string4,
|
|
18122
|
+
position: exports_external.number(),
|
|
18123
|
+
private: exports_external.boolean()
|
|
18124
|
+
})
|
|
18125
|
+
});
|
|
18126
|
+
var communityCategoryUpdateSchema = exports_external.strictObject({
|
|
18127
|
+
type: exports_external.literal("community:category.update"),
|
|
18128
|
+
serverId: string4,
|
|
18129
|
+
categoryId: string4,
|
|
18130
|
+
changes: exports_external.strictObject({
|
|
18131
|
+
name: string4.optional(),
|
|
18132
|
+
position: exports_external.number().optional(),
|
|
18133
|
+
private: exports_external.boolean().optional()
|
|
18134
|
+
})
|
|
18135
|
+
});
|
|
18136
|
+
var communityCategoryDeleteSchema = exports_external.strictObject({
|
|
18137
|
+
type: exports_external.literal("community:category.delete"),
|
|
18138
|
+
serverId: string4,
|
|
18139
|
+
categoryId: string4
|
|
18140
|
+
});
|
|
18141
|
+
var communityCategoryReorderSchema = exports_external.strictObject({
|
|
18142
|
+
type: exports_external.literal("community:category.reorder"),
|
|
18143
|
+
serverId: string4,
|
|
18144
|
+
categories: exports_external.array(positionedIdSchema)
|
|
18145
|
+
});
|
|
18146
|
+
var communityMemberJoinSchema = exports_external.strictObject({
|
|
18147
|
+
type: exports_external.literal("community:member.join"),
|
|
18148
|
+
serverId: string4,
|
|
18149
|
+
member: exports_external.strictObject({
|
|
18150
|
+
id: string4,
|
|
18151
|
+
userId: string4,
|
|
18152
|
+
name: string4,
|
|
18153
|
+
discriminator: string4,
|
|
18154
|
+
avatar: string4.optional(),
|
|
18155
|
+
role: string4,
|
|
18156
|
+
joinedAt: string4
|
|
18157
|
+
})
|
|
18158
|
+
});
|
|
18159
|
+
var communityMemberLeaveSchema = exports_external.strictObject({
|
|
18160
|
+
type: exports_external.literal("community:member.leave"),
|
|
18161
|
+
serverId: string4,
|
|
18162
|
+
userId: string4
|
|
18163
|
+
});
|
|
18164
|
+
var communityMemberUpdateSchema = exports_external.strictObject({
|
|
18165
|
+
type: exports_external.literal("community:member.update"),
|
|
18166
|
+
serverId: string4,
|
|
18167
|
+
memberId: string4,
|
|
18168
|
+
userId: string4.optional(),
|
|
18169
|
+
changes: exports_external.strictObject({
|
|
18170
|
+
role: string4.optional(),
|
|
18171
|
+
nickname: nullableString.optional()
|
|
18172
|
+
})
|
|
18173
|
+
});
|
|
18174
|
+
var communityFriendRequestSchema = exports_external.strictObject({
|
|
18175
|
+
type: exports_external.literal("community:friend.request"),
|
|
18176
|
+
friendship: exports_external.strictObject({
|
|
18177
|
+
id: string4,
|
|
18178
|
+
requesterId: string4,
|
|
18179
|
+
addresseeId: string4,
|
|
18180
|
+
status: exports_external.literal("pending"),
|
|
18181
|
+
createdAt: string4
|
|
18182
|
+
})
|
|
18183
|
+
});
|
|
18184
|
+
var friendshipIdFields = { friendshipId: string4 };
|
|
18185
|
+
var communityFriendAcceptSchema = exports_external.strictObject({
|
|
18186
|
+
type: exports_external.literal("community:friend.accept"),
|
|
18187
|
+
...friendshipIdFields
|
|
18188
|
+
});
|
|
18189
|
+
var communityFriendRejectSchema = exports_external.strictObject({
|
|
18190
|
+
type: exports_external.literal("community:friend.reject"),
|
|
18191
|
+
...friendshipIdFields
|
|
18192
|
+
});
|
|
18193
|
+
var communityFriendRemoveSchema = exports_external.strictObject({
|
|
18194
|
+
type: exports_external.literal("community:friend.remove"),
|
|
18195
|
+
...friendshipIdFields
|
|
18196
|
+
});
|
|
18197
|
+
var communityFriendBlockSchema = exports_external.strictObject({
|
|
18198
|
+
type: exports_external.literal("community:friend.block"),
|
|
18199
|
+
userId: string4
|
|
18200
|
+
});
|
|
18201
|
+
var communityInviteCreateSchema = exports_external.strictObject({
|
|
18202
|
+
type: exports_external.literal("community:invite.create"),
|
|
18203
|
+
serverId: string4,
|
|
18204
|
+
invite: exports_external.strictObject({
|
|
18205
|
+
id: string4,
|
|
18206
|
+
token: string4,
|
|
18207
|
+
maxUses: exports_external.number().nullable().optional(),
|
|
18208
|
+
uses: exports_external.number().nullable().optional(),
|
|
18209
|
+
expiresAt: nullableString.optional(),
|
|
18210
|
+
createdAt: string4
|
|
18211
|
+
})
|
|
18212
|
+
});
|
|
18213
|
+
var communityMentionCreateSchema = exports_external.strictObject({
|
|
18214
|
+
type: exports_external.literal("community:mention.create"),
|
|
18215
|
+
userId: string4,
|
|
18216
|
+
messageId: string4,
|
|
18217
|
+
channelId: string4.optional(),
|
|
18218
|
+
authorName: string4
|
|
18219
|
+
});
|
|
18220
|
+
var communityUnreadBumpSchema = exports_external.strictObject({
|
|
18221
|
+
type: exports_external.literal("community:unread.bump"),
|
|
18222
|
+
userId: string4,
|
|
18223
|
+
channelId: string4,
|
|
18224
|
+
serverId: string4.optional(),
|
|
18225
|
+
railChannelId: string4.optional(),
|
|
18226
|
+
isMention: exports_external.boolean().optional()
|
|
18227
|
+
});
|
|
18228
|
+
var communityPresenceUpdateSchema = exports_external.strictObject({
|
|
18229
|
+
type: exports_external.literal("community:presence.update"),
|
|
18230
|
+
userId: string4,
|
|
18231
|
+
online: exports_external.boolean()
|
|
18232
|
+
});
|
|
18233
|
+
var communityStatusUpdateSchema = exports_external.strictObject({
|
|
18234
|
+
type: exports_external.literal("community:status.update"),
|
|
18235
|
+
userId: string4,
|
|
18236
|
+
statusEmoji: nullableString,
|
|
18237
|
+
statusText: nullableString
|
|
18238
|
+
});
|
|
18239
|
+
var machineRuntimeSchema = CommunityMachineRuntimeSchema.strict();
|
|
18240
|
+
var CommunityMachineSummarySchema2 = exports_external.strictObject({
|
|
18241
|
+
id: string4,
|
|
18242
|
+
hostname: string4,
|
|
18243
|
+
displayName: string4,
|
|
18244
|
+
platform: string4,
|
|
18245
|
+
arch: string4,
|
|
18246
|
+
osRelease: string4,
|
|
18247
|
+
daemonVersion: string4,
|
|
18248
|
+
lastSeenAt: nullableString,
|
|
18249
|
+
status: exports_external.enum(["online", "offline"]),
|
|
18250
|
+
availableRuntimes: exports_external.array(machineRuntimeSchema),
|
|
18251
|
+
lastRuntimeError: exports_external.strictObject({
|
|
18252
|
+
requested: string4,
|
|
18253
|
+
available: exports_external.array(string4),
|
|
18254
|
+
at: string4
|
|
18255
|
+
}).optional(),
|
|
18256
|
+
createdAt: string4,
|
|
18257
|
+
updatedAt: string4
|
|
18258
|
+
});
|
|
18259
|
+
var communityMachineCreatedSchema = exports_external.strictObject({
|
|
18260
|
+
type: exports_external.literal("community:machine.created"),
|
|
18261
|
+
machine: CommunityMachineSummarySchema2,
|
|
18262
|
+
tokenId: string4
|
|
18263
|
+
});
|
|
18264
|
+
var communityMachineStatusSchema = exports_external.strictObject({
|
|
18265
|
+
type: exports_external.literal("community:machine.status"),
|
|
18266
|
+
machineId: string4,
|
|
18267
|
+
status: exports_external.enum(["online", "offline"]),
|
|
18268
|
+
lastSeenAt: string4
|
|
18269
|
+
});
|
|
18270
|
+
var communityMachineUpdatedSchema = exports_external.strictObject({
|
|
18271
|
+
type: exports_external.literal("community:machine.updated"),
|
|
18272
|
+
machine: CommunityMachineSummarySchema2
|
|
18273
|
+
});
|
|
18274
|
+
var communityMachineRemovedSchema = exports_external.strictObject({
|
|
18275
|
+
type: exports_external.literal("community:machine.removed"),
|
|
18276
|
+
machineId: string4
|
|
18277
|
+
});
|
|
18278
|
+
var communityBotAuditEventSchema = exports_external.strictObject({
|
|
18279
|
+
type: exports_external.literal("community:bot.audit_event"),
|
|
18280
|
+
botId: string4,
|
|
18281
|
+
id: string4,
|
|
18282
|
+
kind: exports_external.enum(["cli_invocation", "tool_call", "thinking", "wake_trigger", "session_reset", "nap", "model_changed", "provider_changed", "error"]),
|
|
18283
|
+
payload: exports_external.unknown(),
|
|
18284
|
+
sessionId: nullableString.optional(),
|
|
18285
|
+
launchId: nullableString.optional(),
|
|
18286
|
+
createdAt: string4
|
|
18287
|
+
}).refine((event) => Object.prototype.hasOwnProperty.call(event, "payload"));
|
|
18288
|
+
var CommunityWsEventDiscriminatedSchema = exports_external.discriminatedUnion("type", [
|
|
18289
|
+
communityMessageCreateSchema,
|
|
18290
|
+
communityMessageUpdatedSchema,
|
|
18291
|
+
communityMessageEditedSchema,
|
|
18292
|
+
communityReactionAddSchema,
|
|
18293
|
+
communityReactionRemoveSchema,
|
|
18294
|
+
communityPinAddSchema,
|
|
18295
|
+
communityPinRemoveSchema,
|
|
18296
|
+
communityTypingStartSchema,
|
|
18297
|
+
communityTypingStopSchema,
|
|
18298
|
+
communityChildChannelCreateSchema,
|
|
18299
|
+
communityChildChannelUpdateSchema,
|
|
18300
|
+
communityServerUpdateSchema,
|
|
18301
|
+
communityServerDeleteSchema,
|
|
18302
|
+
communityChannelCreateSchema,
|
|
18303
|
+
communityChannelUpdateSchema,
|
|
18304
|
+
communityChannelDeleteSchema,
|
|
18305
|
+
communityChannelReorderSchema,
|
|
18306
|
+
communityChannelMemberAddSchema,
|
|
18307
|
+
communityChannelMemberRemoveSchema,
|
|
18308
|
+
communityCategoryCreateSchema,
|
|
18309
|
+
communityCategoryUpdateSchema,
|
|
18310
|
+
communityCategoryDeleteSchema,
|
|
18311
|
+
communityCategoryReorderSchema,
|
|
18312
|
+
communityMemberJoinSchema,
|
|
18313
|
+
communityMemberLeaveSchema,
|
|
18314
|
+
communityMemberUpdateSchema,
|
|
18315
|
+
communityFriendRequestSchema,
|
|
18316
|
+
communityFriendAcceptSchema,
|
|
18317
|
+
communityFriendRejectSchema,
|
|
18318
|
+
communityFriendRemoveSchema,
|
|
18319
|
+
communityFriendBlockSchema,
|
|
18320
|
+
communityInviteCreateSchema,
|
|
18321
|
+
communityMentionCreateSchema,
|
|
18322
|
+
communityUnreadBumpSchema,
|
|
18323
|
+
communityPresenceUpdateSchema,
|
|
18324
|
+
communityStatusUpdateSchema,
|
|
18325
|
+
communityMachineCreatedSchema,
|
|
18326
|
+
communityMachineStatusSchema,
|
|
18327
|
+
communityMachineUpdatedSchema,
|
|
18328
|
+
communityMachineRemovedSchema,
|
|
18329
|
+
communityBotAuditEventSchema
|
|
18330
|
+
]);
|
|
18331
|
+
var CommunityWsEventSchema = CommunityWsEventDiscriminatedSchema.transform((event) => event);
|
|
18332
|
+
var WS_EVENTS = {
|
|
18333
|
+
MESSAGE_CREATE: "community:message.create",
|
|
18334
|
+
MESSAGE_UPDATED: "community:message.updated",
|
|
18335
|
+
MESSAGE_EDITED: "community:message.edited",
|
|
18336
|
+
REACTION_ADD: "community:reaction.add",
|
|
18337
|
+
REACTION_REMOVE: "community:reaction.remove",
|
|
18338
|
+
PIN_ADD: "community:pin.add",
|
|
18339
|
+
PIN_REMOVE: "community:pin.remove",
|
|
18340
|
+
TYPING_START: "community:typing.start",
|
|
18341
|
+
TYPING_STOP: "community:typing.stop",
|
|
18342
|
+
CHILD_CHANNEL_CREATE: "community:channel.child_create",
|
|
18343
|
+
CHILD_CHANNEL_UPDATE: "community:channel.child_update",
|
|
18344
|
+
SERVER_UPDATE: "community:server.update",
|
|
18345
|
+
SERVER_DELETE: "community:server.delete",
|
|
18346
|
+
CHANNEL_CREATE: "community:channel.create",
|
|
18347
|
+
CHANNEL_UPDATE: "community:channel.update",
|
|
18348
|
+
CHANNEL_DELETE: "community:channel.delete",
|
|
18349
|
+
CHANNEL_REORDER: "community:channel.reorder",
|
|
18350
|
+
CHANNEL_MEMBER_ADD: "community:channel.member_add",
|
|
18351
|
+
CHANNEL_MEMBER_REMOVE: "community:channel.member_remove",
|
|
18352
|
+
CATEGORY_CREATE: "community:category.create",
|
|
18353
|
+
CATEGORY_UPDATE: "community:category.update",
|
|
18354
|
+
CATEGORY_DELETE: "community:category.delete",
|
|
18355
|
+
CATEGORY_REORDER: "community:category.reorder",
|
|
18356
|
+
MEMBER_JOIN: "community:member.join",
|
|
18357
|
+
MEMBER_LEAVE: "community:member.leave",
|
|
18358
|
+
MEMBER_UPDATE: "community:member.update",
|
|
18359
|
+
FRIEND_REQUEST: "community:friend.request",
|
|
18360
|
+
FRIEND_ACCEPT: "community:friend.accept",
|
|
18361
|
+
FRIEND_REJECT: "community:friend.reject",
|
|
18362
|
+
FRIEND_REMOVE: "community:friend.remove",
|
|
18363
|
+
FRIEND_BLOCK: "community:friend.block",
|
|
18364
|
+
INVITE_CREATE: "community:invite.create",
|
|
18365
|
+
MENTION_CREATE: "community:mention.create",
|
|
18366
|
+
UNREAD_BUMP: "community:unread.bump",
|
|
18367
|
+
PRESENCE_UPDATE: "community:presence.update",
|
|
18368
|
+
STATUS_UPDATE: "community:status.update",
|
|
18369
|
+
MACHINE_CREATED: "community:machine.created",
|
|
18370
|
+
MACHINE_STATUS: "community:machine.status",
|
|
18371
|
+
MACHINE_UPDATED: "community:machine.updated",
|
|
18372
|
+
MACHINE_REMOVED: "community:machine.removed",
|
|
18373
|
+
BOT_AUDIT_EVENT: "community:bot.audit_event"
|
|
18374
|
+
};
|
|
18375
|
+
var COMMUNITY_EVENT_TYPES = new Set(Object.values(WS_EVENTS));
|
|
17763
18376
|
// ../shared/src/db/index.ts
|
|
17764
18377
|
var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema };
|
|
17765
18378
|
// ../shared/src/db/queries/task.ts
|
|
@@ -17789,13 +18402,8 @@ function toAlookAddress(h) {
|
|
|
17789
18402
|
}
|
|
17790
18403
|
// ../shared/src/db/queries/community/search.ts
|
|
17791
18404
|
var FTS_KEYWORDS = new Set(["and", "or", "not", "near"]);
|
|
17792
|
-
// ../shared/src/db/queries/community/
|
|
17793
|
-
var
|
|
17794
|
-
BOT_ACTIVITY_PRESETS.idle,
|
|
17795
|
-
BOT_ACTIVITY_PRESETS.starting,
|
|
17796
|
-
BOT_ACTIVITY_PRESETS.stopping,
|
|
17797
|
-
...RUNNING_PRESETS
|
|
17798
|
-
];
|
|
18405
|
+
// ../shared/src/db/queries/community/server-folder.ts
|
|
18406
|
+
var FOLDER_ITEM_INSERT_MAX_ROWS = maxRowsPerInsert(3);
|
|
17799
18407
|
// ../shared/src/semver.ts
|
|
17800
18408
|
function semverGte(a, b) {
|
|
17801
18409
|
const pa = a.split(".").map(Number);
|
|
@@ -18211,10 +18819,10 @@ class Logger2 {
|
|
|
18211
18819
|
function createLogger2(opts) {
|
|
18212
18820
|
return new Logger2(opts);
|
|
18213
18821
|
}
|
|
18214
|
-
var
|
|
18822
|
+
var log2 = createLogger2();
|
|
18215
18823
|
|
|
18216
18824
|
// daemon/pidfile.ts
|
|
18217
|
-
var
|
|
18825
|
+
var log3 = createLogger2({ module: "pidfile" });
|
|
18218
18826
|
function isProcessAlive(pid) {
|
|
18219
18827
|
try {
|
|
18220
18828
|
process.kill(pid, 0);
|
|
@@ -18238,7 +18846,7 @@ function acquireDaemonPid(profile) {
|
|
|
18238
18846
|
const content = readFileSync3(pidPath, "utf-8").trim();
|
|
18239
18847
|
const existingPid = parseInt(content, 10);
|
|
18240
18848
|
if (!isNaN(existingPid) && isProcessAlive(existingPid)) {
|
|
18241
|
-
|
|
18849
|
+
log3.error(`Another daemon is already running (PID ${existingPid}). ` + `Remove ${pidPath} if this is stale.`);
|
|
18242
18850
|
return false;
|
|
18243
18851
|
}
|
|
18244
18852
|
} catch {}
|
|
@@ -18416,7 +19024,7 @@ import { createInterface } from "readline";
|
|
|
18416
19024
|
|
|
18417
19025
|
// daemon/kill-tree.ts
|
|
18418
19026
|
import { execSync } from "child_process";
|
|
18419
|
-
var
|
|
19027
|
+
var log4 = createLogger2({ module: "kill-tree" });
|
|
18420
19028
|
function killGraceMs() {
|
|
18421
19029
|
return Number(process.env.ALOOK_KILL_GRACE_MS) || 2000;
|
|
18422
19030
|
}
|
|
@@ -18462,7 +19070,7 @@ async function killProcessTree(pid, opts) {
|
|
|
18462
19070
|
await new Promise((r) => setTimeout(r, POLL_MS));
|
|
18463
19071
|
}
|
|
18464
19072
|
if (isAlive(pid)) {
|
|
18465
|
-
|
|
19073
|
+
log4.warn(`pid=${pid} survived SIGTERM after ${graceMs}ms — escalating to SIGKILL`);
|
|
18466
19074
|
signalTree(pid, "SIGKILL");
|
|
18467
19075
|
}
|
|
18468
19076
|
}
|
|
@@ -18717,8 +19325,8 @@ class ClaudeBackend {
|
|
|
18717
19325
|
};
|
|
18718
19326
|
const resultPromise = new Promise((resolve) => {
|
|
18719
19327
|
const stderrChunks = [];
|
|
18720
|
-
proc.stderr?.on("data", (
|
|
18721
|
-
stderrChunks.push(
|
|
19328
|
+
proc.stderr?.on("data", (chunk2) => {
|
|
19329
|
+
stderrChunks.push(chunk2.toString());
|
|
18722
19330
|
});
|
|
18723
19331
|
const rl = createInterface({ input: proc.stdout });
|
|
18724
19332
|
if (useStdinPrompt) {
|
|
@@ -19528,8 +20136,8 @@ class CodexBackend {
|
|
|
19528
20136
|
};
|
|
19529
20137
|
const resultPromise = new Promise((resolve) => {
|
|
19530
20138
|
const stderrChunks = [];
|
|
19531
|
-
proc.stderr?.on("data", (
|
|
19532
|
-
stderrChunks.push(
|
|
20139
|
+
proc.stderr?.on("data", (chunk2) => {
|
|
20140
|
+
stderrChunks.push(chunk2.toString());
|
|
19533
20141
|
});
|
|
19534
20142
|
const rl = createInterface2({ input: proc.stdout });
|
|
19535
20143
|
rl.on("line", (line) => {
|
|
@@ -19925,8 +20533,8 @@ class OpenCodeBackend {
|
|
|
19925
20533
|
};
|
|
19926
20534
|
const resultPromise = new Promise((resolve) => {
|
|
19927
20535
|
const stderrChunks = [];
|
|
19928
|
-
proc.stderr?.on("data", (
|
|
19929
|
-
stderrChunks.push(
|
|
20536
|
+
proc.stderr?.on("data", (chunk2) => {
|
|
20537
|
+
stderrChunks.push(chunk2.toString());
|
|
19930
20538
|
});
|
|
19931
20539
|
const rl = createInterface3({ input: proc.stdout });
|
|
19932
20540
|
rl.on("line", (line) => {
|
|
@@ -20669,7 +21277,7 @@ function releaseLock(lockPath) {
|
|
|
20669
21277
|
}
|
|
20670
21278
|
|
|
20671
21279
|
// daemon/execenv/timeline.ts
|
|
20672
|
-
var
|
|
21280
|
+
var log5 = createLogger2({ module: "timeline" });
|
|
20673
21281
|
function readJsonl(filePath) {
|
|
20674
21282
|
let content;
|
|
20675
21283
|
try {
|
|
@@ -20738,7 +21346,7 @@ async function initEntryAsync(timelineDir, entry) {
|
|
|
20738
21346
|
acquired = acquireLock(lockPath);
|
|
20739
21347
|
}
|
|
20740
21348
|
if (!acquired) {
|
|
20741
|
-
|
|
21349
|
+
log5.debug(`Timeline initEntry: could not acquire lock for ${filename}`);
|
|
20742
21350
|
return;
|
|
20743
21351
|
}
|
|
20744
21352
|
try {
|
|
@@ -20748,7 +21356,7 @@ async function initEntryAsync(timelineDir, entry) {
|
|
|
20748
21356
|
releaseLock(lockPath);
|
|
20749
21357
|
}
|
|
20750
21358
|
} catch (err) {
|
|
20751
|
-
|
|
21359
|
+
log5.debug("Timeline initEntry failed", err);
|
|
20752
21360
|
}
|
|
20753
21361
|
}
|
|
20754
21362
|
function updateEntry(timelineDir, taskId, updater) {
|
|
@@ -20758,7 +21366,7 @@ function updateEntry(timelineDir, taskId, updater) {
|
|
|
20758
21366
|
try {
|
|
20759
21367
|
const acquired = acquireLock(lockPath);
|
|
20760
21368
|
if (!acquired) {
|
|
20761
|
-
|
|
21369
|
+
log5.debug(`Timeline updateEntry: lock held for ${filename}, skipping`);
|
|
20762
21370
|
continue;
|
|
20763
21371
|
}
|
|
20764
21372
|
try {
|
|
@@ -20791,10 +21399,10 @@ function updateEntry(timelineDir, taskId, updater) {
|
|
|
20791
21399
|
releaseLock(lockPath);
|
|
20792
21400
|
}
|
|
20793
21401
|
} catch (err) {
|
|
20794
|
-
|
|
21402
|
+
log5.debug(`Timeline updateEntry failed for ${filename}`, err);
|
|
20795
21403
|
}
|
|
20796
21404
|
}
|
|
20797
|
-
|
|
21405
|
+
log5.debug(`Timeline updateEntry: task_id ${taskId} not found in last 7 days`);
|
|
20798
21406
|
}
|
|
20799
21407
|
function createTimelineEntry(taskId, prompt, type, sessionId, pid, provider, contextKey, detailedLog) {
|
|
20800
21408
|
return {
|
|
@@ -20863,7 +21471,7 @@ function findSupersedablePredecessor(timelineDir, contextKey, provider, warmupGr
|
|
|
20863
21471
|
// daemon/execenv/steering.ts
|
|
20864
21472
|
import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync5, readFileSync as readFileSync6, unlinkSync as unlinkSync3, readdirSync, statSync as statSync2 } from "fs";
|
|
20865
21473
|
import { join as join8 } from "path";
|
|
20866
|
-
var
|
|
21474
|
+
var log6 = createLogger2({ module: "steering" });
|
|
20867
21475
|
var INTENT_DIR_NAME = ".kill_intents";
|
|
20868
21476
|
var STEERING_LOCK_DIR = ".steering_locks";
|
|
20869
21477
|
var INTENT_STALE_MS = 10 * 60 * 1000;
|
|
@@ -20917,7 +21525,7 @@ function cleanupStaleIntents(baseDir) {
|
|
|
20917
21525
|
const stat = statSync2(filePath);
|
|
20918
21526
|
if (now - stat.mtimeMs > INTENT_STALE_MS) {
|
|
20919
21527
|
unlinkSync3(filePath);
|
|
20920
|
-
|
|
21528
|
+
log6.debug(`Cleaned up stale kill intent for task ${intent.targetTaskId}`);
|
|
20921
21529
|
}
|
|
20922
21530
|
} catch {}
|
|
20923
21531
|
}
|
|
@@ -20937,7 +21545,7 @@ function releaseSteeringLock(baseDir, contextKey) {
|
|
|
20937
21545
|
// daemon/steering/mailbox.ts
|
|
20938
21546
|
import { mkdirSync as mkdirSync6, writeFileSync as writeFileSync6, readFileSync as readFileSync7, renameSync as renameSync2, readdirSync as readdirSync2, unlinkSync as unlinkSync4, rmSync, existsSync as existsSync2, watch } from "fs";
|
|
20939
21547
|
import { join as join9 } from "path";
|
|
20940
|
-
var
|
|
21548
|
+
var log7 = createLogger2({ module: "mailbox" });
|
|
20941
21549
|
function inboxDir(baseDir, contextKey) {
|
|
20942
21550
|
const safeKey = contextKey.replace(/[^a-zA-Z0-9_:-]/g, "_");
|
|
20943
21551
|
return join9(baseDir, ".steering", safeKey, "inbox");
|
|
@@ -21067,7 +21675,7 @@ function watchInbox(baseDir, contextKey, onMessage) {
|
|
|
21067
21675
|
scan();
|
|
21068
21676
|
});
|
|
21069
21677
|
} catch {
|
|
21070
|
-
|
|
21678
|
+
log7.debug("fs.watch failed, relying on polling only");
|
|
21071
21679
|
}
|
|
21072
21680
|
const pollTimer = setInterval(scan, 200);
|
|
21073
21681
|
return {
|
|
@@ -21715,7 +22323,7 @@ function buildMergedPrompt(tasks, attachmentsMap) {
|
|
|
21715
22323
|
}
|
|
21716
22324
|
|
|
21717
22325
|
// daemon/session-runner.ts
|
|
21718
|
-
var
|
|
22326
|
+
var log8 = createLogger2({ module: "session-runner" });
|
|
21719
22327
|
var ATTACHMENTS_BASE = tempDir("alook-attachments");
|
|
21720
22328
|
async function writeMarkerFile(workspacesRoot, marker) {
|
|
21721
22329
|
const dir = path.join(workspacesRoot, ".pending_completions");
|
|
@@ -21763,20 +22371,20 @@ async function reportToServer(fn, markerData, workspacesRoot) {
|
|
|
21763
22371
|
} catch (e) {
|
|
21764
22372
|
lastErr = e;
|
|
21765
22373
|
if (isClientError(e)) {
|
|
21766
|
-
|
|
22374
|
+
log8.info(`server report for task ${markerData.taskId}: task already in terminal state (${e})`);
|
|
21767
22375
|
return;
|
|
21768
22376
|
}
|
|
21769
22377
|
if (attempt < RETRY_DELAYS.length && isRetryableError(e)) {
|
|
21770
|
-
|
|
22378
|
+
log8.debug(`server report attempt ${attempt + 1} failed for task ${markerData.taskId}, retrying in ${RETRY_DELAYS[attempt]}ms`);
|
|
21771
22379
|
await new Promise((r) => setTimeout(r, RETRY_DELAYS[attempt]));
|
|
21772
22380
|
}
|
|
21773
22381
|
}
|
|
21774
22382
|
}
|
|
21775
|
-
|
|
22383
|
+
log8.warn(`server report failed for task ${markerData.taskId} after retries, writing marker: ${lastErr}`);
|
|
21776
22384
|
try {
|
|
21777
22385
|
await writeMarkerFile(workspacesRoot, markerData);
|
|
21778
22386
|
} catch (writeErr) {
|
|
21779
|
-
|
|
22387
|
+
log8.error(`marker write also failed for task ${markerData.taskId}: ${writeErr}`);
|
|
21780
22388
|
}
|
|
21781
22389
|
}
|
|
21782
22390
|
function sanitizeFilename(name) {
|
|
@@ -21807,7 +22415,7 @@ async function downloadAttachments(client, token, workspaceId, taskId, attachmen
|
|
|
21807
22415
|
}
|
|
21808
22416
|
async function runSession(input) {
|
|
21809
22417
|
const { task, provider, cliPath, model, serverURL, token, workspacesRoot, agentTimeout, messageInactivityTimeout } = input;
|
|
21810
|
-
|
|
22418
|
+
log8.info(`starting (task=${task.id}, type=${task.type}, agent=${task.agentId}, provider=${provider}, model=${model || "default"})`);
|
|
21811
22419
|
const client = new DaemonClient(serverURL);
|
|
21812
22420
|
const backend = createBackend(provider, cliPath);
|
|
21813
22421
|
const agentBaseDir = path.join(workspacesRoot, task.workspaceId, task.agentId, "workdir");
|
|
@@ -21830,7 +22438,7 @@ async function runSession(input) {
|
|
|
21830
22438
|
try {
|
|
21831
22439
|
await client.reportMessages(token, task.id, batch);
|
|
21832
22440
|
} catch (e) {
|
|
21833
|
-
|
|
22441
|
+
log8.debug("message report failed", e);
|
|
21834
22442
|
}
|
|
21835
22443
|
};
|
|
21836
22444
|
let mailboxWatcher = null;
|
|
@@ -21839,13 +22447,13 @@ async function runSession(input) {
|
|
|
21839
22447
|
if (killed)
|
|
21840
22448
|
return;
|
|
21841
22449
|
killed = true;
|
|
21842
|
-
|
|
22450
|
+
log8.info(`killed by signal (messages=${seq}, tools=${toolCount})`);
|
|
21843
22451
|
if (mailboxWatcher)
|
|
21844
22452
|
mailboxWatcher.stop();
|
|
21845
22453
|
if (stalledRecoveryTimer)
|
|
21846
22454
|
clearInterval(stalledRecoveryTimer);
|
|
21847
22455
|
if (agentPid !== undefined) {
|
|
21848
|
-
|
|
22456
|
+
log8.info(`killing inner agent group (pid=${agentPid})`);
|
|
21849
22457
|
await killProcessTree(agentPid);
|
|
21850
22458
|
}
|
|
21851
22459
|
if (flushTimer)
|
|
@@ -21888,14 +22496,14 @@ async function runSession(input) {
|
|
|
21888
22496
|
const attachmentIds = task.context?.attachment_ids ?? [];
|
|
21889
22497
|
let attachments;
|
|
21890
22498
|
if (attachmentIds.length > 0) {
|
|
21891
|
-
|
|
22499
|
+
log8.info(`downloading ${attachmentIds.length} attachment(s)`);
|
|
21892
22500
|
try {
|
|
21893
22501
|
attachments = await downloadAttachments(client, token, task.workspaceId, task.id, attachmentIds);
|
|
21894
|
-
|
|
22502
|
+
log8.info(`attachments ready (${attachments.length} file(s))`);
|
|
21895
22503
|
} catch (e) {
|
|
21896
22504
|
await cleanupAttachments(task.id);
|
|
21897
22505
|
const errMsg = `failed to download attachments: ${e}`;
|
|
21898
|
-
|
|
22506
|
+
log8.error(errMsg);
|
|
21899
22507
|
updateEntry(timelineDir, task.id, (entry) => {
|
|
21900
22508
|
entry.pid = null;
|
|
21901
22509
|
entry.status = "failed";
|
|
@@ -21912,7 +22520,7 @@ async function runSession(input) {
|
|
|
21912
22520
|
const prompt = input.promptOverride ?? buildPrompt(task, attachments);
|
|
21913
22521
|
const resumeSessionId = task.contextKey ? findResumableSessionByContextKey(timelineDir, task.contextKey, provider) ?? undefined : undefined;
|
|
21914
22522
|
if (resumeSessionId) {
|
|
21915
|
-
|
|
22523
|
+
log8.info(`resuming session ${resumeSessionId} (context_key: ${task.contextKey})`);
|
|
21916
22524
|
}
|
|
21917
22525
|
const session2 = backend.execute(prompt, {
|
|
21918
22526
|
cwd: workDir,
|
|
@@ -21925,14 +22533,14 @@ async function runSession(input) {
|
|
|
21925
22533
|
agentPid = session2.pid;
|
|
21926
22534
|
if (killed) {
|
|
21927
22535
|
if (agentPid !== undefined) {
|
|
21928
|
-
|
|
22536
|
+
log8.info(`kill landed during spawn — reaping inner agent group (pid=${agentPid})`);
|
|
21929
22537
|
await killProcessTree(agentPid);
|
|
21930
22538
|
}
|
|
21931
22539
|
process.exit(1);
|
|
21932
22540
|
}
|
|
21933
22541
|
const earlySessionId = await session2.sessionId;
|
|
21934
|
-
|
|
21935
|
-
|
|
22542
|
+
log8.info(`agent started (pid=${agentPid ?? "unknown"}, session=${earlySessionId})`);
|
|
22543
|
+
log8.info(JSON.stringify({ role: "user", type: "text", content: prompt }));
|
|
21936
22544
|
updateEntry(timelineDir, task.id, (entry) => {
|
|
21937
22545
|
entry.session_id = earlySessionId || null;
|
|
21938
22546
|
if (earlySessionId)
|
|
@@ -21964,7 +22572,7 @@ async function runSession(input) {
|
|
|
21964
22572
|
apmState = recentResult.nextState;
|
|
21965
22573
|
if (event.kind === "error") {
|
|
21966
22574
|
const classified = classifyRuntimeError(event.message);
|
|
21967
|
-
|
|
22575
|
+
log8.info(`steering: error classified as ${classified.errorClass}: ${scrubDiagnosticText(event.message)}`);
|
|
21968
22576
|
const errResult = reduceApmGatedError(apmState, { disableToolBoundaryFlush: true });
|
|
21969
22577
|
apmState = errResult.nextState;
|
|
21970
22578
|
}
|
|
@@ -22072,7 +22680,7 @@ async function runSession(input) {
|
|
|
22072
22680
|
for (const msg of apmState.pendingMessages) {
|
|
22073
22681
|
const sendResult = session2.send(msg, eff.stdinMode);
|
|
22074
22682
|
if (!sendResult.ok) {
|
|
22075
|
-
|
|
22683
|
+
log8.warn("steering: send failed during turn_end flush", { reason: sendResult.reason });
|
|
22076
22684
|
allSent = false;
|
|
22077
22685
|
break;
|
|
22078
22686
|
}
|
|
@@ -22093,7 +22701,7 @@ async function runSession(input) {
|
|
|
22093
22701
|
if (flushedOk || apmState.pendingMessages.length === 0) {
|
|
22094
22702
|
for (const steeredId of pendingSteeredTasks) {
|
|
22095
22703
|
client.completeTask(token, steeredId, { output: "" }).catch((e) => {
|
|
22096
|
-
|
|
22704
|
+
log8.debug(`steering: failed to complete steered task ${steeredId}`, e);
|
|
22097
22705
|
});
|
|
22098
22706
|
}
|
|
22099
22707
|
pendingSteeredTasks.clear();
|
|
@@ -22104,11 +22712,11 @@ async function runSession(input) {
|
|
|
22104
22712
|
}
|
|
22105
22713
|
}
|
|
22106
22714
|
} catch (err) {
|
|
22107
|
-
|
|
22715
|
+
log8.warn("steering: consumeParsedEvents error", { err: err instanceof Error ? err.message : String(err) });
|
|
22108
22716
|
}
|
|
22109
22717
|
};
|
|
22110
22718
|
consumeParsedEvents().catch((err) => {
|
|
22111
|
-
|
|
22719
|
+
log8.error("steering: consumeParsedEvents unhandled error", { err: err instanceof Error ? err.message : String(err) });
|
|
22112
22720
|
});
|
|
22113
22721
|
}
|
|
22114
22722
|
stalledRecoveryTimer = setInterval(() => {
|
|
@@ -22120,7 +22728,7 @@ async function runSession(input) {
|
|
|
22120
22728
|
});
|
|
22121
22729
|
apmState = startupResult.nextState;
|
|
22122
22730
|
if (startupResult.shouldTerminate) {
|
|
22123
|
-
|
|
22731
|
+
log8.warn("steering: startup timeout — no progress events received, killing agent");
|
|
22124
22732
|
if (agentPid !== undefined)
|
|
22125
22733
|
killProcessTree(agentPid);
|
|
22126
22734
|
return;
|
|
@@ -22141,7 +22749,7 @@ async function runSession(input) {
|
|
|
22141
22749
|
});
|
|
22142
22750
|
apmState = stalledResult.nextState;
|
|
22143
22751
|
if (stalledResult.shouldTerminate) {
|
|
22144
|
-
|
|
22752
|
+
log8.warn(`steering: stalled recovery — agent stale for ${(staleForMs / 1000).toFixed(1)}s with ${apmState.pendingMessages.length} pending messages, killing`);
|
|
22145
22753
|
if (agentPid !== undefined)
|
|
22146
22754
|
killProcessTree(agentPid);
|
|
22147
22755
|
}
|
|
@@ -22201,7 +22809,7 @@ async function runSession(input) {
|
|
|
22201
22809
|
if (delivered && message2.taskId) {
|
|
22202
22810
|
pendingSteeredTasks.add(message2.taskId);
|
|
22203
22811
|
client.startTask(token, message2.taskId).catch((e) => {
|
|
22204
|
-
|
|
22812
|
+
log8.debug(`steering: failed to start steered task ${message2.taskId}`, e);
|
|
22205
22813
|
});
|
|
22206
22814
|
}
|
|
22207
22815
|
cleanupInboxFile(agentBaseDir, task.contextKey, seq2);
|
|
@@ -22222,7 +22830,7 @@ async function runSession(input) {
|
|
|
22222
22830
|
]) : next);
|
|
22223
22831
|
if (raceResult === "timeout") {
|
|
22224
22832
|
inactivityTimedOut = true;
|
|
22225
|
-
|
|
22833
|
+
log8.warn(`message inactivity timeout (${INACTIVITY_TIMEOUT_MS / 1000}s) — killing agent`);
|
|
22226
22834
|
if (session2.pid !== undefined) {
|
|
22227
22835
|
await killProcessTree(session2.pid);
|
|
22228
22836
|
}
|
|
@@ -22237,9 +22845,9 @@ async function runSession(input) {
|
|
|
22237
22845
|
if (msg.type === "tool-use")
|
|
22238
22846
|
toolCount++;
|
|
22239
22847
|
if (msg.type === "tool-result" && msg.output && msg.output.length > 500) {
|
|
22240
|
-
|
|
22848
|
+
log8.info(JSON.stringify({ role: "assistant", ...msg, output: msg.output.slice(0, 500) + `... (${msg.output.length} chars)` }));
|
|
22241
22849
|
} else {
|
|
22242
|
-
|
|
22850
|
+
log8.info(JSON.stringify({ role: "assistant", ...msg }));
|
|
22243
22851
|
}
|
|
22244
22852
|
if (msg.type === "status" || msg.type === "log")
|
|
22245
22853
|
continue;
|
|
@@ -22307,18 +22915,18 @@ async function runSession(input) {
|
|
|
22307
22915
|
body.session_id = result.sessionId;
|
|
22308
22916
|
await reportToServer(() => client.completeTask(token, task.id, body), { taskId: task.id, type: "complete", payload: body, token, serverURL, createdAt: new Date().toISOString() }, workspacesRoot);
|
|
22309
22917
|
const dur = (result.durationMs / 1000).toFixed(1);
|
|
22310
|
-
|
|
22918
|
+
log8.info(`completed (duration=${dur}s, messages=${seq}, tools=${toolCount})`);
|
|
22311
22919
|
} else {
|
|
22312
22920
|
const errorMsg = result.error || "agent exited unexpectedly";
|
|
22313
22921
|
await reportToServer(() => client.failTask(token, task.id, errorMsg), { taskId: task.id, type: "fail", payload: { error: errorMsg }, token, serverURL, createdAt: new Date().toISOString() }, workspacesRoot);
|
|
22314
22922
|
const dur = (result.durationMs / 1000).toFixed(1);
|
|
22315
|
-
|
|
22923
|
+
log8.info(`failed (duration=${dur}s, messages=${seq}, tools=${toolCount}) — ${result.error}`);
|
|
22316
22924
|
}
|
|
22317
22925
|
}
|
|
22318
22926
|
async function main() {
|
|
22319
22927
|
const encoded = process.argv[2];
|
|
22320
22928
|
if (!encoded) {
|
|
22321
|
-
|
|
22929
|
+
log8.error("session-runner: missing base64-encoded input argument");
|
|
22322
22930
|
process.exit(1);
|
|
22323
22931
|
}
|
|
22324
22932
|
let input;
|
|
@@ -22326,14 +22934,14 @@ async function main() {
|
|
|
22326
22934
|
const json2 = Buffer.from(encoded, "base64").toString("utf-8");
|
|
22327
22935
|
input = JSON.parse(json2);
|
|
22328
22936
|
} catch (e) {
|
|
22329
|
-
|
|
22937
|
+
log8.error("session-runner: failed to parse input", e);
|
|
22330
22938
|
process.exit(1);
|
|
22331
22939
|
}
|
|
22332
22940
|
const client = new DaemonClient(input.serverURL);
|
|
22333
22941
|
try {
|
|
22334
22942
|
await runSession(input);
|
|
22335
22943
|
} catch (e) {
|
|
22336
|
-
|
|
22944
|
+
log8.error(`session-runner: unhandled error for task ${input.task.id}`, e);
|
|
22337
22945
|
await cleanupAttachments(input.task.id);
|
|
22338
22946
|
const timelineDir = path.join(input.workspacesRoot, input.task.workspaceId, input.task.agentId, "workdir", ".context_timeline").replace(/\\/g, "/");
|
|
22339
22947
|
updateEntry(timelineDir, input.task.id, (entry) => {
|
|
@@ -22352,7 +22960,7 @@ if (isDirectExecution) {
|
|
|
22352
22960
|
}
|
|
22353
22961
|
|
|
22354
22962
|
// daemon/ws-client.ts
|
|
22355
|
-
var
|
|
22963
|
+
var log9 = createLogger2({ module: "ws-client" });
|
|
22356
22964
|
var WS_RECONNECT_INIT = 1000;
|
|
22357
22965
|
var WS_RECONNECT_MAX = 30000;
|
|
22358
22966
|
var WS_PING_INTERVAL = 25000;
|
|
@@ -22389,11 +22997,11 @@ class DaemonWsClient {
|
|
|
22389
22997
|
return;
|
|
22390
22998
|
this.cleanup();
|
|
22391
22999
|
const wsUrl = this.getUrl();
|
|
22392
|
-
|
|
23000
|
+
log9.info("connecting", { url: wsUrl });
|
|
22393
23001
|
try {
|
|
22394
23002
|
this.ws = new WebSocket(wsUrl);
|
|
22395
23003
|
} catch (err) {
|
|
22396
|
-
|
|
23004
|
+
log9.warn("ws creation failed", { err: String(err) });
|
|
22397
23005
|
this.scheduleReconnect();
|
|
22398
23006
|
return;
|
|
22399
23007
|
}
|
|
@@ -22415,36 +23023,36 @@ class DaemonWsClient {
|
|
|
22415
23023
|
try {
|
|
22416
23024
|
const msg = JSON.parse(str);
|
|
22417
23025
|
if (msg.type === "auth.ok") {
|
|
22418
|
-
|
|
23026
|
+
log9.info("authenticated");
|
|
22419
23027
|
this.connected = true;
|
|
22420
23028
|
this.opts.onConnected();
|
|
22421
23029
|
return;
|
|
22422
23030
|
}
|
|
22423
23031
|
if (msg.type === "error" && msg.code === "AUTH_REJECTED") {
|
|
22424
|
-
|
|
23032
|
+
log9.warn("machine token rejected by server (AUTH_REJECTED)", { reason: msg.reason });
|
|
22425
23033
|
this.opts.onAuthRejected?.(msg.reason);
|
|
22426
23034
|
return;
|
|
22427
23035
|
}
|
|
22428
23036
|
const parsed = DaemonPushMessageSchema.safeParse(msg);
|
|
22429
23037
|
if (!parsed.success) {
|
|
22430
|
-
|
|
23038
|
+
log9.warn("invalid push message", { err: parsed.error.message });
|
|
22431
23039
|
return;
|
|
22432
23040
|
}
|
|
22433
23041
|
this.opts.onMessage(parsed.data);
|
|
22434
23042
|
} catch (err) {
|
|
22435
|
-
|
|
23043
|
+
log9.debug("message parse error", { err: String(err) });
|
|
22436
23044
|
}
|
|
22437
23045
|
});
|
|
22438
23046
|
this.ws.addEventListener("error", (event) => {
|
|
22439
23047
|
const err = event;
|
|
22440
|
-
|
|
23048
|
+
log9.warn("ws error", { err: String(err?.message ?? err?.error ?? "unknown") });
|
|
22441
23049
|
});
|
|
22442
23050
|
this.ws.addEventListener("close", (event) => {
|
|
22443
23051
|
const { code, reason } = event;
|
|
22444
23052
|
const wasConnected = this.connected;
|
|
22445
23053
|
this.connected = false;
|
|
22446
23054
|
this.stopHeartbeat();
|
|
22447
|
-
|
|
23055
|
+
log9.info("ws closed", { code, reason, wasConnected });
|
|
22448
23056
|
if (wasConnected) {
|
|
22449
23057
|
this.opts.onDisconnected();
|
|
22450
23058
|
}
|
|
@@ -22477,7 +23085,7 @@ class DaemonWsClient {
|
|
|
22477
23085
|
const delay = Math.min(this.reconnectDelay, WS_RECONNECT_MAX);
|
|
22478
23086
|
this.reconnectDelay = Math.min(delay * 2, WS_RECONNECT_MAX);
|
|
22479
23087
|
const jitter = Math.random() * 500;
|
|
22480
|
-
|
|
23088
|
+
log9.info("reconnecting", { delayMs: Math.round(delay + jitter) });
|
|
22481
23089
|
this.reconnectTimer = setTimeout(() => {
|
|
22482
23090
|
this.reconnectTimer = null;
|
|
22483
23091
|
this.connect();
|
|
@@ -22491,7 +23099,7 @@ class DaemonWsClient {
|
|
|
22491
23099
|
}, WS_PING_INTERVAL);
|
|
22492
23100
|
this.livenessInterval = setInterval(() => {
|
|
22493
23101
|
if (Date.now() - this.lastMessageAt > WS_LIVENESS_TIMEOUT) {
|
|
22494
|
-
|
|
23102
|
+
log9.warn("liveness timeout, closing");
|
|
22495
23103
|
this.ws?.close();
|
|
22496
23104
|
}
|
|
22497
23105
|
}, 5000);
|
|
@@ -22539,7 +23147,7 @@ function runNpmUpdate(targetVersion) {
|
|
|
22539
23147
|
}
|
|
22540
23148
|
|
|
22541
23149
|
// daemon/update-handler.ts
|
|
22542
|
-
var
|
|
23150
|
+
var log10 = createLogger2({ module: "updater" });
|
|
22543
23151
|
var updating = false;
|
|
22544
23152
|
var retryCount = 0;
|
|
22545
23153
|
var MAX_RETRIES = 3;
|
|
@@ -22569,29 +23177,29 @@ async function handleCliUpdate(version3, onSuccess, profile) {
|
|
|
22569
23177
|
if (retryCount >= MAX_RETRIES)
|
|
22570
23178
|
return;
|
|
22571
23179
|
if (process.env.ALOOK_CMD_PREFIX) {
|
|
22572
|
-
|
|
23180
|
+
log10.info(`Skipping auto-update in app mode — user should run: npx @alook/app@latest update`);
|
|
22573
23181
|
return;
|
|
22574
23182
|
}
|
|
22575
23183
|
const marker = readUpdateMarker(profile);
|
|
22576
23184
|
if (marker === version3) {
|
|
22577
|
-
|
|
23185
|
+
log10.info(`Skipping update to v${version3} — already attempted (marker exists)`);
|
|
22578
23186
|
return;
|
|
22579
23187
|
}
|
|
22580
23188
|
updating = true;
|
|
22581
23189
|
try {
|
|
22582
|
-
|
|
23190
|
+
log10.info(`Updating CLI to v${version3}...`);
|
|
22583
23191
|
const result = await runNpmUpdate(version3);
|
|
22584
23192
|
if (result.success) {
|
|
22585
23193
|
writeUpdateMarker(version3, profile);
|
|
22586
|
-
|
|
23194
|
+
log10.info(`CLI updated to v${version3} — restarting`);
|
|
22587
23195
|
onSuccess();
|
|
22588
23196
|
} else {
|
|
22589
23197
|
retryCount++;
|
|
22590
|
-
|
|
23198
|
+
log10.error(`CLI update failed (attempt ${retryCount}/${MAX_RETRIES}): ${result.output}`);
|
|
22591
23199
|
}
|
|
22592
23200
|
} catch (e) {
|
|
22593
23201
|
retryCount++;
|
|
22594
|
-
|
|
23202
|
+
log10.error(`CLI update error (attempt ${retryCount}/${MAX_RETRIES})`, e);
|
|
22595
23203
|
} finally {
|
|
22596
23204
|
updating = false;
|
|
22597
23205
|
}
|
|
@@ -22700,7 +23308,7 @@ import { existsSync as existsSync3, mkdirSync as mkdirSync8, readFileSync as rea
|
|
|
22700
23308
|
import { join as join11, basename } from "path";
|
|
22701
23309
|
import { homedir as homedir2 } from "os";
|
|
22702
23310
|
import { createHash as createHash2 } from "crypto";
|
|
22703
|
-
var
|
|
23311
|
+
var log11 = createLogger2({ module: "skill-scanner" });
|
|
22704
23312
|
function getCacheDir() {
|
|
22705
23313
|
return join11(configDir(), "skills");
|
|
22706
23314
|
}
|
|
@@ -22996,7 +23604,7 @@ function runScan() {
|
|
|
22996
23604
|
const prevHash = readCacheHash(globalCachePath(scannerConfig.daemonId, runtime));
|
|
22997
23605
|
if (prevHash !== hash2) {
|
|
22998
23606
|
const skillItems = skills.map((s) => ({ name: s.name, description: s.description }));
|
|
22999
|
-
|
|
23607
|
+
log11.debug(`Syncing global ${runtime} — ${skills.length} skills`);
|
|
23000
23608
|
const daemonId = scannerConfig.daemonId;
|
|
23001
23609
|
const syncPromises = scannerConfig.workspaces.map((ws) => clientRef.syncSkills(ws.token, {
|
|
23002
23610
|
scope: "global",
|
|
@@ -23010,11 +23618,11 @@ function runScan() {
|
|
|
23010
23618
|
if (isClientError2(e)) {
|
|
23011
23619
|
writeCacheFile(globalCachePath(daemonId, runtime), hash2, skills);
|
|
23012
23620
|
}
|
|
23013
|
-
|
|
23621
|
+
log11.debug("Global skill sync failed", e);
|
|
23014
23622
|
});
|
|
23015
23623
|
}
|
|
23016
23624
|
} catch (e) {
|
|
23017
|
-
|
|
23625
|
+
log11.debug(`Global scan error for ${runtime}`, e);
|
|
23018
23626
|
}
|
|
23019
23627
|
}
|
|
23020
23628
|
const targets = discoverTargets();
|
|
@@ -23027,7 +23635,7 @@ function runScan() {
|
|
|
23027
23635
|
const prevHash = readCacheHash(agentCachePath(target.agentId, target.runtime));
|
|
23028
23636
|
if (prevHash !== hash2) {
|
|
23029
23637
|
const skillItems = skills.map((s) => ({ name: s.name, description: s.description }));
|
|
23030
|
-
|
|
23638
|
+
log11.debug(`Syncing ${target.agentId}:${target.runtime} — ${skills.length} agent skills`);
|
|
23031
23639
|
clientRef.syncSkills(target.token, {
|
|
23032
23640
|
scope: "agent",
|
|
23033
23641
|
agent_id: target.agentId,
|
|
@@ -23039,11 +23647,11 @@ function runScan() {
|
|
|
23039
23647
|
if (isClientError2(e)) {
|
|
23040
23648
|
writeCacheFile(agentCachePath(target.agentId, target.runtime), hash2, skills);
|
|
23041
23649
|
}
|
|
23042
|
-
|
|
23650
|
+
log11.debug("Agent skill sync failed", e);
|
|
23043
23651
|
});
|
|
23044
23652
|
}
|
|
23045
23653
|
} catch (e) {
|
|
23046
|
-
|
|
23654
|
+
log11.debug(`Agent scan error for ${target.agentId}:${target.runtime}`, e);
|
|
23047
23655
|
}
|
|
23048
23656
|
}
|
|
23049
23657
|
}
|
|
@@ -23099,7 +23707,7 @@ import { readdir as readdir2, readFile as readFile2, unlink, stat as fsStat } fr
|
|
|
23099
23707
|
import { execSync as execSync4, spawn as spawn5 } from "child_process";
|
|
23100
23708
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
23101
23709
|
import { dirname as dirname3, join as join12 } from "path";
|
|
23102
|
-
var
|
|
23710
|
+
var log12 = createLogger2({ module: "daemon" });
|
|
23103
23711
|
var _dir = dirname3(fileURLToPath2(import.meta.url));
|
|
23104
23712
|
var sessionRunnerPath = existsSync4(join12(_dir, "session-runner.js")) ? join12(_dir, "session-runner.js") : join12(_dir, "session-runner.ts");
|
|
23105
23713
|
var meetingRunnerPath = existsSync4(join12(_dir, "meeting-runner.js")) ? join12(_dir, "meeting-runner.js") : join12(_dir, "meeting-runner.ts");
|
|
@@ -23207,14 +23815,14 @@ async function reconcilePendingCompletions(workspacesRoot) {
|
|
|
23207
23815
|
try {
|
|
23208
23816
|
parsed = JSON.parse(raw);
|
|
23209
23817
|
} catch {
|
|
23210
|
-
|
|
23818
|
+
log12.warn(`reconcile: malformed marker ${name}, deleting`);
|
|
23211
23819
|
try {
|
|
23212
23820
|
await unlink(filePath);
|
|
23213
23821
|
} catch {}
|
|
23214
23822
|
continue;
|
|
23215
23823
|
}
|
|
23216
23824
|
if (!isValidMarker(parsed)) {
|
|
23217
|
-
|
|
23825
|
+
log12.warn(`reconcile: invalid marker structure ${name}, deleting`);
|
|
23218
23826
|
try {
|
|
23219
23827
|
await unlink(filePath);
|
|
23220
23828
|
} catch {}
|
|
@@ -23223,7 +23831,7 @@ async function reconcilePendingCompletions(workspacesRoot) {
|
|
|
23223
23831
|
const marker = parsed;
|
|
23224
23832
|
const age = Date.now() - new Date(marker.createdAt).getTime();
|
|
23225
23833
|
if (age > MARKER_STALE_MS) {
|
|
23226
|
-
|
|
23834
|
+
log12.warn(`reconcile: stale marker ${name} (${Math.round(age / 3600000)}h old), deleting`);
|
|
23227
23835
|
try {
|
|
23228
23836
|
await unlink(filePath);
|
|
23229
23837
|
} catch {}
|
|
@@ -23239,7 +23847,7 @@ async function reconcilePendingCompletions(workspacesRoot) {
|
|
|
23239
23847
|
try {
|
|
23240
23848
|
await unlink(filePath);
|
|
23241
23849
|
} catch (delErr) {
|
|
23242
|
-
|
|
23850
|
+
log12.warn(`reconcile: delivered marker ${name} but failed to delete: ${delErr}`);
|
|
23243
23851
|
}
|
|
23244
23852
|
} catch (deliverErr) {
|
|
23245
23853
|
if (isClientError3(deliverErr)) {
|
|
@@ -23247,11 +23855,11 @@ async function reconcilePendingCompletions(workspacesRoot) {
|
|
|
23247
23855
|
await unlink(filePath);
|
|
23248
23856
|
} catch {}
|
|
23249
23857
|
} else {
|
|
23250
|
-
|
|
23858
|
+
log12.debug(`reconcile: delivery failed for ${name}, will retry next cycle`);
|
|
23251
23859
|
}
|
|
23252
23860
|
}
|
|
23253
23861
|
} catch (e) {
|
|
23254
|
-
|
|
23862
|
+
log12.debug(`reconcile: error processing ${name}`, e);
|
|
23255
23863
|
}
|
|
23256
23864
|
}
|
|
23257
23865
|
}
|
|
@@ -23262,7 +23870,7 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23262
23870
|
}
|
|
23263
23871
|
process.once("exit", () => releaseDaemonPid(profile));
|
|
23264
23872
|
const bailOnUnexpected = (label, err) => {
|
|
23265
|
-
|
|
23873
|
+
log12.error(`${label} — shutting down`, err);
|
|
23266
23874
|
releaseDaemonPid(profile);
|
|
23267
23875
|
process.exit(1);
|
|
23268
23876
|
};
|
|
@@ -23275,20 +23883,20 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23275
23883
|
if (marker) {
|
|
23276
23884
|
clearUpdateMarker(profile);
|
|
23277
23885
|
if (marker === config2.cliVersion) {
|
|
23278
|
-
|
|
23886
|
+
log12.info(`Cleared update marker — now running v${config2.cliVersion}`);
|
|
23279
23887
|
} else {
|
|
23280
|
-
|
|
23888
|
+
log12.info(`Cleared stale update marker (was v${marker}, running v${config2.cliVersion}) — update will be retried`);
|
|
23281
23889
|
}
|
|
23282
23890
|
}
|
|
23283
23891
|
const cliConfig = loadCLIConfigForProfile(profile);
|
|
23284
23892
|
const workspaces = activeWorkspaces(cliConfig.watched_workspaces);
|
|
23285
23893
|
if (workspaces.length === 0) {
|
|
23286
|
-
|
|
23894
|
+
log12.info("No workspaces configured — daemon starting in standby mode. Register a workspace to begin.");
|
|
23287
23895
|
}
|
|
23288
23896
|
if (workspaces.length > 0) {
|
|
23289
23897
|
const hasPerWorkspaceTokens = workspaces.every((ws) => !!ws.token);
|
|
23290
23898
|
if (!hasPerWorkspaceTokens) {
|
|
23291
|
-
|
|
23899
|
+
log12.error(`Config uses old format. Run '${cmdPrefix()} register --token <token>' for each workspace to upgrade.`);
|
|
23292
23900
|
process.exit(1);
|
|
23293
23901
|
return;
|
|
23294
23902
|
}
|
|
@@ -23309,11 +23917,11 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23309
23917
|
}
|
|
23310
23918
|
}
|
|
23311
23919
|
if (providers.length === 0) {
|
|
23312
|
-
|
|
23920
|
+
log12.error("No agent CLI tools found on PATH.");
|
|
23313
23921
|
process.exit(1);
|
|
23314
23922
|
return;
|
|
23315
23923
|
}
|
|
23316
|
-
|
|
23924
|
+
log12.info(`Detected providers: ${providers.map((p) => `${p.type}@${p.version}`).join(", ")}`);
|
|
23317
23925
|
const workspaceStates = [];
|
|
23318
23926
|
const runtimeIndex = new Map;
|
|
23319
23927
|
let hadWorkspaces = workspaces.length > 0;
|
|
@@ -23323,7 +23931,7 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23323
23931
|
type: p.type,
|
|
23324
23932
|
version: p.version
|
|
23325
23933
|
}));
|
|
23326
|
-
|
|
23934
|
+
log12.info(`Registering workspace ${ws.id} (${ws.name ?? "unnamed"}) with ${runtimes.length} runtime(s)...`);
|
|
23327
23935
|
let resp;
|
|
23328
23936
|
try {
|
|
23329
23937
|
resp = await client.register(ws.token, {
|
|
@@ -23336,13 +23944,13 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23336
23944
|
});
|
|
23337
23945
|
} catch (e) {
|
|
23338
23946
|
if (e instanceof Error && e.message.startsWith("HTTP 401")) {
|
|
23339
|
-
|
|
23947
|
+
log12.warn(`Workspace ${ws.id} token invalid — skipping (run '${cmdPrefix()} register --token <token>' to fix)`);
|
|
23340
23948
|
} else {
|
|
23341
|
-
|
|
23949
|
+
log12.error(`Failed to register workspace ${ws.id}, skipping`, e);
|
|
23342
23950
|
}
|
|
23343
23951
|
continue;
|
|
23344
23952
|
}
|
|
23345
|
-
|
|
23953
|
+
log12.info(`Workspace ${ws.id} registered — ${resp.runtimes.length} runtime(s)`);
|
|
23346
23954
|
const runtimeIds = resp.runtimes.map((r) => r.id);
|
|
23347
23955
|
workspaceStates.push({ workspaceId: ws.id, token: ws.token, runtimeIds });
|
|
23348
23956
|
for (let i = 0;i < runtimeIds.length; i++) {
|
|
@@ -23354,13 +23962,13 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23354
23962
|
}
|
|
23355
23963
|
}
|
|
23356
23964
|
if (workspaceStates.length === 0 && hadWorkspaces) {
|
|
23357
|
-
|
|
23965
|
+
log12.error("No workspaces registered successfully.");
|
|
23358
23966
|
process.exit(1);
|
|
23359
23967
|
return;
|
|
23360
23968
|
}
|
|
23361
23969
|
const allRuntimeIds = workspaceStates.flatMap((ws) => ws.runtimeIds);
|
|
23362
23970
|
health.setRuntimeCount(allRuntimeIds.length);
|
|
23363
|
-
|
|
23971
|
+
log12.info(`Daemon started — ${allRuntimeIds.length} runtime(s) across ${workspaceStates.length} workspace(s)`);
|
|
23364
23972
|
const activeTasks = new Set;
|
|
23365
23973
|
const pendingSteer = new Map;
|
|
23366
23974
|
const knownAgentIds = new Set(workspaces.flatMap((ws) => ws.agent_ids ?? []));
|
|
@@ -23398,7 +24006,7 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23398
24006
|
saveCLIConfigForProfile(profile, cfg);
|
|
23399
24007
|
}
|
|
23400
24008
|
} catch {}
|
|
23401
|
-
|
|
24009
|
+
log12.info(`Workspace ${workspaceId} removed from polling — ${reason}`);
|
|
23402
24010
|
}
|
|
23403
24011
|
const pollCycle = async () => {
|
|
23404
24012
|
let remaining = config2.maxConcurrentTasks - activeTasks.size;
|
|
@@ -23425,7 +24033,7 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23425
24033
|
handleCliUpdate(pending_update.version, () => requestRestart(), profile);
|
|
23426
24034
|
}
|
|
23427
24035
|
if (pending_rescan) {
|
|
23428
|
-
|
|
24036
|
+
log12.info("Rescan requested — restarting daemon to re-detect runtimes");
|
|
23429
24037
|
for (const [id, reason] of toRemove) {
|
|
23430
24038
|
markWorkspaceDeleted(id, reason);
|
|
23431
24039
|
}
|
|
@@ -23438,13 +24046,13 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23438
24046
|
activeTasks.add(task.id);
|
|
23439
24047
|
remaining--;
|
|
23440
24048
|
handleTask(client, config2, runtimeIndex, task, ws.token, activeTasks, pendingSteer).catch((e) => {
|
|
23441
|
-
|
|
24049
|
+
log12.error("Task error", e);
|
|
23442
24050
|
activeTasks.delete(task.id);
|
|
23443
24051
|
});
|
|
23444
24052
|
}
|
|
23445
24053
|
if (file_requests) {
|
|
23446
24054
|
for (const req of file_requests) {
|
|
23447
|
-
handleFileRequest(client, config2, ws.workspaceId, req, ws.token).catch((e) =>
|
|
24055
|
+
handleFileRequest(client, config2, ws.workspaceId, req, ws.token).catch((e) => log12.debug("File request error", e));
|
|
23448
24056
|
}
|
|
23449
24057
|
}
|
|
23450
24058
|
if (meetings) {
|
|
@@ -23472,11 +24080,11 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23472
24080
|
if (n >= WS_AUTH_401_THRESHOLD) {
|
|
23473
24081
|
toRemove.set(ws.workspaceId, `poll 401 x${n}`);
|
|
23474
24082
|
} else {
|
|
23475
|
-
|
|
24083
|
+
log12.warn(`Workspace ${ws.workspaceId} poll 401 (${n}/${WS_AUTH_401_THRESHOLD}) — will retry`);
|
|
23476
24084
|
}
|
|
23477
24085
|
} else {
|
|
23478
24086
|
consecutive401.delete(ws.workspaceId);
|
|
23479
|
-
|
|
24087
|
+
log12.debug("Poll error", e);
|
|
23480
24088
|
}
|
|
23481
24089
|
}
|
|
23482
24090
|
}
|
|
@@ -23489,7 +24097,7 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23489
24097
|
rebuildWsClient();
|
|
23490
24098
|
}
|
|
23491
24099
|
if (workspaceStates.length === 0 && hadWorkspaces) {
|
|
23492
|
-
|
|
24100
|
+
log12.info("All workspaces evicted — shutting down");
|
|
23493
24101
|
shutdown();
|
|
23494
24102
|
}
|
|
23495
24103
|
};
|
|
@@ -23497,7 +24105,7 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23497
24105
|
const heartbeatPing = () => {
|
|
23498
24106
|
for (const ws of workspaceStates) {
|
|
23499
24107
|
client.heartbeat(ws.token, config2.daemonId).catch((e) => {
|
|
23500
|
-
|
|
24108
|
+
log12.debug("heartbeat failed", { workspaceId: ws.workspaceId, err: String(e) });
|
|
23501
24109
|
});
|
|
23502
24110
|
}
|
|
23503
24111
|
};
|
|
@@ -23522,7 +24130,7 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23522
24130
|
syncAgentId(task.agentId, ws.workspaceId);
|
|
23523
24131
|
activeTasks.add(task.id);
|
|
23524
24132
|
handleTask(client, config2, runtimeIndex, task, ws.token, activeTasks, pendingSteer).catch((e) => {
|
|
23525
|
-
|
|
24133
|
+
log12.error("WS task error", e);
|
|
23526
24134
|
activeTasks.delete(task.id);
|
|
23527
24135
|
});
|
|
23528
24136
|
}
|
|
@@ -23531,7 +24139,7 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23531
24139
|
const ws = wsMap.get(msg.workspaceId);
|
|
23532
24140
|
if (ws) {
|
|
23533
24141
|
for (const req of msg.requests) {
|
|
23534
|
-
handleFileRequest(client, config2, ws.workspaceId, req, ws.token).catch((e) =>
|
|
24142
|
+
handleFileRequest(client, config2, ws.workspaceId, req, ws.token).catch((e) => log12.debug("WS file request error", e));
|
|
23535
24143
|
}
|
|
23536
24144
|
}
|
|
23537
24145
|
break;
|
|
@@ -23563,7 +24171,7 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23563
24171
|
if (wasWsToken)
|
|
23564
24172
|
rebuildWsClient();
|
|
23565
24173
|
if (workspaceStates.length === 0 && hadWorkspaces) {
|
|
23566
|
-
|
|
24174
|
+
log12.info("All workspaces removed — shutting down");
|
|
23567
24175
|
shutdown();
|
|
23568
24176
|
}
|
|
23569
24177
|
break;
|
|
@@ -23574,7 +24182,7 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23574
24182
|
}
|
|
23575
24183
|
break;
|
|
23576
24184
|
case "daemon.rescan":
|
|
23577
|
-
|
|
24185
|
+
log12.info("WS rescan requested — restarting daemon");
|
|
23578
24186
|
requestRestart();
|
|
23579
24187
|
break;
|
|
23580
24188
|
case "daemon.kill": {
|
|
@@ -23602,7 +24210,7 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23602
24210
|
});
|
|
23603
24211
|
activeTasks.add(killTask.id);
|
|
23604
24212
|
handleTask(client, config2, runtimeIndex, killTask, ws.token, activeTasks, pendingSteer).catch((e) => {
|
|
23605
|
-
|
|
24213
|
+
log12.error("WS kill task error", e);
|
|
23606
24214
|
activeTasks.delete(killTask.id);
|
|
23607
24215
|
});
|
|
23608
24216
|
}
|
|
@@ -23615,11 +24223,11 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23615
24223
|
const wsCallbacks = {
|
|
23616
24224
|
onMessage: handleWsPush,
|
|
23617
24225
|
onConnected: () => {
|
|
23618
|
-
|
|
24226
|
+
log12.info("WS connected — switching to low-frequency poll");
|
|
23619
24227
|
updatePollInterval(config2.wsPollInterval);
|
|
23620
24228
|
},
|
|
23621
24229
|
onDisconnected: () => {
|
|
23622
|
-
|
|
24230
|
+
log12.info("WS disconnected — reverting to high-frequency poll");
|
|
23623
24231
|
updatePollInterval(config2.pollInterval);
|
|
23624
24232
|
},
|
|
23625
24233
|
onAuthRejected: (reason) => {
|
|
@@ -23639,18 +24247,18 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23639
24247
|
let confirmedDead = false;
|
|
23640
24248
|
try {
|
|
23641
24249
|
await client.poll(token, config2.daemonId, 0, config2.cliVersion);
|
|
23642
|
-
|
|
24250
|
+
log12.info(`Workspace ${workspaceId} WS auth rejection not confirmed by poll — keeping (likely transient)`);
|
|
23643
24251
|
} catch (e) {
|
|
23644
24252
|
if (e instanceof Error && e.message.startsWith("HTTP 401")) {
|
|
23645
24253
|
confirmedDead = true;
|
|
23646
24254
|
markWorkspaceDeleted(workspaceId, `WS auth rejected${reason ? ` (${reason})` : ""} — confirmed by poll 401`);
|
|
23647
24255
|
} else {
|
|
23648
|
-
|
|
24256
|
+
log12.debug("Confirm-poll error (transient) — keeping workspace", e);
|
|
23649
24257
|
}
|
|
23650
24258
|
}
|
|
23651
24259
|
rebuildWsClient();
|
|
23652
24260
|
if (confirmedDead && workspaceStates.length === 0 && hadWorkspaces) {
|
|
23653
|
-
|
|
24261
|
+
log12.info("All workspaces removed — shutting down");
|
|
23654
24262
|
shutdown();
|
|
23655
24263
|
}
|
|
23656
24264
|
}
|
|
@@ -23675,13 +24283,13 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23675
24283
|
const sweepTick = async () => {
|
|
23676
24284
|
for (const ws of workspaceStates) {
|
|
23677
24285
|
client.sweep(ws.token, config2.daemonId).catch((e) => {
|
|
23678
|
-
|
|
24286
|
+
log12.debug("sweep ping failed", { workspaceId: ws.workspaceId, err: String(e) });
|
|
23679
24287
|
});
|
|
23680
24288
|
}
|
|
23681
24289
|
try {
|
|
23682
24290
|
await reconcilePendingCompletions(config2.workspacesRoot);
|
|
23683
24291
|
} catch (e) {
|
|
23684
|
-
|
|
24292
|
+
log12.debug("reconciliation error", e);
|
|
23685
24293
|
}
|
|
23686
24294
|
};
|
|
23687
24295
|
const sweepTimer = setInterval(sweepTick, config2.sweepInterval);
|
|
@@ -23705,7 +24313,7 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23705
24313
|
if (shuttingDown)
|
|
23706
24314
|
return;
|
|
23707
24315
|
shuttingDown = true;
|
|
23708
|
-
|
|
24316
|
+
log12.info(restartRequested ? "Restarting..." : "Shutting down...");
|
|
23709
24317
|
clearInterval(pollTimer);
|
|
23710
24318
|
clearInterval(heartbeatTimer);
|
|
23711
24319
|
clearInterval(sweepTimer);
|
|
@@ -23733,7 +24341,7 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23733
24341
|
mkdirSync9(dirname3(logPath), { recursive: true, mode: 448 });
|
|
23734
24342
|
logFd = openSync(logPath, "a", 384);
|
|
23735
24343
|
} catch (e) {
|
|
23736
|
-
|
|
24344
|
+
log12.error(`Failed to open daemon log file ${logPath}`, e);
|
|
23737
24345
|
}
|
|
23738
24346
|
const child = spawn5(process.execPath, args, {
|
|
23739
24347
|
detached: true,
|
|
@@ -23743,7 +24351,7 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23743
24351
|
child.unref();
|
|
23744
24352
|
if (logFd != null)
|
|
23745
24353
|
closeSync(logFd);
|
|
23746
|
-
|
|
24354
|
+
log12.info(`Spawned new daemon (pid=${child.pid}), logs: ${logPath}`);
|
|
23747
24355
|
}
|
|
23748
24356
|
clearTimeout(timeout);
|
|
23749
24357
|
process.exit(0);
|
|
@@ -23754,7 +24362,7 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23754
24362
|
process.on("SIGHUP", async () => {
|
|
23755
24363
|
if (shuttingDown)
|
|
23756
24364
|
return;
|
|
23757
|
-
|
|
24365
|
+
log12.info("SIGHUP received — reloading config...");
|
|
23758
24366
|
try {
|
|
23759
24367
|
const freshConfig = loadCLIConfigForProfile(profile);
|
|
23760
24368
|
const freshWorkspaces = activeWorkspaces(freshConfig.watched_workspaces);
|
|
@@ -23762,7 +24370,7 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23762
24370
|
const newWorkspaces = freshWorkspaces.filter((ws) => ws.token && !existingIds.has(ws.id));
|
|
23763
24371
|
for (const ws of newWorkspaces) {
|
|
23764
24372
|
const runtimes = providers.map((p) => ({ type: p.type, version: p.version }));
|
|
23765
|
-
|
|
24373
|
+
log12.info(`Registering new workspace ${ws.id} (${ws.name ?? "unnamed"})...`);
|
|
23766
24374
|
try {
|
|
23767
24375
|
const resp = await client.register(ws.token, {
|
|
23768
24376
|
workspace_id: ws.id,
|
|
@@ -23781,9 +24389,9 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23781
24389
|
provider: providers[i].type
|
|
23782
24390
|
});
|
|
23783
24391
|
}
|
|
23784
|
-
|
|
24392
|
+
log12.info(`Workspace ${ws.id} added — ${runtimeIds.length} runtime(s)`);
|
|
23785
24393
|
} catch (e) {
|
|
23786
|
-
|
|
24394
|
+
log12.error(`Failed to register new workspace ${ws.id}`, e);
|
|
23787
24395
|
}
|
|
23788
24396
|
}
|
|
23789
24397
|
if (newWorkspaces.length > 0) {
|
|
@@ -23791,14 +24399,14 @@ async function startDaemon(profile, serverUrl) {
|
|
|
23791
24399
|
health.setRuntimeCount(workspaceStates.reduce((sum, w) => sum + w.runtimeIds.length, 0));
|
|
23792
24400
|
if (!wsClient && workspaceStates.length > 0) {
|
|
23793
24401
|
rebuildWsClient();
|
|
23794
|
-
|
|
24402
|
+
log12.info("WS push client initialized after SIGHUP reload");
|
|
23795
24403
|
}
|
|
23796
|
-
|
|
24404
|
+
log12.info(`Reload complete — now polling ${workspaceStates.length} workspace(s)`);
|
|
23797
24405
|
} else {
|
|
23798
|
-
|
|
24406
|
+
log12.info("Reload complete — no new workspaces found");
|
|
23799
24407
|
}
|
|
23800
24408
|
} catch (e) {
|
|
23801
|
-
|
|
24409
|
+
log12.error("Failed to reload config", e);
|
|
23802
24410
|
}
|
|
23803
24411
|
});
|
|
23804
24412
|
await pollCycle();
|
|
@@ -23813,7 +24421,7 @@ function spawnSessionRunner(input) {
|
|
|
23813
24421
|
try {
|
|
23814
24422
|
fd = openSync(logFilePath, "a");
|
|
23815
24423
|
} catch (e) {
|
|
23816
|
-
|
|
24424
|
+
log12.error(`Failed to open log file ${logFilePath}`, e);
|
|
23817
24425
|
}
|
|
23818
24426
|
const child = spawn5(process.execPath, [sessionRunnerPath, encoded], {
|
|
23819
24427
|
detached: true,
|
|
@@ -23833,7 +24441,7 @@ function spawnMeetingRunner(input) {
|
|
|
23833
24441
|
try {
|
|
23834
24442
|
fd = openSync(logFilePath, "a");
|
|
23835
24443
|
} catch (e) {
|
|
23836
|
-
|
|
24444
|
+
log12.error(`Failed to open meeting log file ${logFilePath}`, e);
|
|
23837
24445
|
}
|
|
23838
24446
|
const child = spawn5(process.execPath, [meetingRunnerPath, encoded], {
|
|
23839
24447
|
detached: true,
|
|
@@ -23842,7 +24450,7 @@ function spawnMeetingRunner(input) {
|
|
|
23842
24450
|
child.unref();
|
|
23843
24451
|
if (fd != null)
|
|
23844
24452
|
closeSync(fd);
|
|
23845
|
-
|
|
24453
|
+
log12.info(`Spawned meeting runner for ${input.meetingId} (pid=${child.pid})`);
|
|
23846
24454
|
return child;
|
|
23847
24455
|
}
|
|
23848
24456
|
async function handleFileRequest(client, config2, workspaceId, req, token) {
|
|
@@ -23884,7 +24492,7 @@ async function killAndVerify(pid) {
|
|
|
23884
24492
|
await new Promise((r) => setTimeout(r, 100));
|
|
23885
24493
|
}
|
|
23886
24494
|
if (isAlive(pid)) {
|
|
23887
|
-
|
|
24495
|
+
log12.warn(`session-runner pid=${pid} survived SIGTERM after ${verifyMs}ms — escalating to SIGKILL`);
|
|
23888
24496
|
try {
|
|
23889
24497
|
process.kill(pid, "SIGKILL");
|
|
23890
24498
|
} catch {}
|
|
@@ -23892,7 +24500,7 @@ async function killAndVerify(pid) {
|
|
|
23892
24500
|
return true;
|
|
23893
24501
|
}
|
|
23894
24502
|
async function handleTask(client, config2, runtimeIndex, task, token, activeTasks, pendingSteer) {
|
|
23895
|
-
|
|
24503
|
+
log12.info(`Task ${task.id} claimed agent=${task.agentId}`);
|
|
23896
24504
|
if (task.type === TASK_TYPES.KILL_TASK) {
|
|
23897
24505
|
const targetTaskId = task.context?.target_task_id;
|
|
23898
24506
|
if (!targetTaskId) {
|
|
@@ -23922,17 +24530,17 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
23922
24530
|
const delivered = await killAndVerify(pid);
|
|
23923
24531
|
if (delivered) {
|
|
23924
24532
|
await client.failTask(token, task.id, "killed");
|
|
23925
|
-
|
|
24533
|
+
log12.info(`Kill task ${task.id}: terminated pid=${pid} for target=${targetTaskId}`);
|
|
23926
24534
|
} else {
|
|
23927
24535
|
await client.failTask(token, task.id, "target process already exited");
|
|
23928
|
-
|
|
24536
|
+
log12.info(`Kill task ${task.id}: target pid=${pid} already exited`);
|
|
23929
24537
|
}
|
|
23930
24538
|
} catch (e) {
|
|
23931
24539
|
await client.failTask(token, task.id, `kill failed: ${e}`);
|
|
23932
24540
|
}
|
|
23933
24541
|
} else {
|
|
23934
24542
|
await client.failTask(token, task.id, "target not found in timeline");
|
|
23935
|
-
|
|
24543
|
+
log12.info(`Kill task ${task.id}: target ${targetTaskId} not found in timeline`);
|
|
23936
24544
|
}
|
|
23937
24545
|
activeTasks.delete(task.id);
|
|
23938
24546
|
return;
|
|
@@ -23974,7 +24582,7 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
23974
24582
|
}
|
|
23975
24583
|
existing.tasks.push(task);
|
|
23976
24584
|
existing.attachments.set(task.id, myAttachments);
|
|
23977
|
-
|
|
24585
|
+
log12.info(`Steering: ${task.id} merged into pending entry (lock contention) for context_key=${ctxKey} (${existing.tasks.length} tasks)`);
|
|
23978
24586
|
existing.wake();
|
|
23979
24587
|
try {
|
|
23980
24588
|
await client.supersedeTask(token, task.id);
|
|
@@ -23988,7 +24596,7 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
23988
24596
|
await new Promise((r) => setTimeout(r, MERGE_POLL_MS));
|
|
23989
24597
|
}
|
|
23990
24598
|
if (!lockAcquired) {
|
|
23991
|
-
|
|
24599
|
+
log12.warn(`Steering lock contention for context_key=${ctxKey}, proceeding without steering`);
|
|
23992
24600
|
}
|
|
23993
24601
|
}
|
|
23994
24602
|
if (lockAcquired) {
|
|
@@ -24003,7 +24611,7 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
24003
24611
|
try {
|
|
24004
24612
|
myAttachments = await downloadAttachments(client, token, task.workspaceId, task.id, attachmentIds);
|
|
24005
24613
|
} catch (e) {
|
|
24006
|
-
|
|
24614
|
+
log12.warn(`Steering: failed to download attachments for ${task.id}`, e);
|
|
24007
24615
|
}
|
|
24008
24616
|
}
|
|
24009
24617
|
let ownerWake;
|
|
@@ -24019,7 +24627,7 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
24019
24627
|
pendingSteer.set(ctxKey, entry);
|
|
24020
24628
|
let predecessor = "entry" in result ? result.entry : null;
|
|
24021
24629
|
if (!predecessor) {
|
|
24022
|
-
|
|
24630
|
+
log12.info(`Steering: predecessor ${result.pending.task_id} warming up; ${task.id} waiting`);
|
|
24023
24631
|
const POLL_MS2 = 200;
|
|
24024
24632
|
const MAX_WAIT_MS = steerWarmupGraceMs();
|
|
24025
24633
|
const waitStart = Date.now();
|
|
@@ -24030,7 +24638,7 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
24030
24638
|
continue;
|
|
24031
24639
|
const r = findSupersedablePredecessor(timelineDir, ctxKey, provider, steerWarmupGraceMs(), Date.now());
|
|
24032
24640
|
if (!r) {
|
|
24033
|
-
|
|
24641
|
+
log12.info(`Steering: predecessor vanished; ${task.id} proceeding`);
|
|
24034
24642
|
break;
|
|
24035
24643
|
}
|
|
24036
24644
|
if ("entry" in r) {
|
|
@@ -24051,7 +24659,7 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
24051
24659
|
const backendInst = createBackend(provider, "");
|
|
24052
24660
|
const isPersistent = backendInst.lifecycle?.kind === "persistent";
|
|
24053
24661
|
if (config2.enableSteering && isPersistent && predecessor.pid != null) {
|
|
24054
|
-
|
|
24662
|
+
log12.info(`Steering: task ${task.id} steering into predecessor ${predecessor.task_id} via mailbox (context_key=${ctxKey})`);
|
|
24055
24663
|
try {
|
|
24056
24664
|
ensureMailboxDirs(agentBaseDir, ctxKey);
|
|
24057
24665
|
const attachmentIds2 = task.context?.attachment_ids ?? [];
|
|
@@ -24061,7 +24669,7 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
24061
24669
|
const downloaded = await downloadAttachments(client, token, task.workspaceId, task.id, attachmentIds2);
|
|
24062
24670
|
steerAttachments = downloaded.map((a) => ({ localPath: a.path, filename: a.filename, contentType: a.content_type }));
|
|
24063
24671
|
} catch (e) {
|
|
24064
|
-
|
|
24672
|
+
log12.warn(`Steering mailbox: failed to download attachments for ${task.id}`, e);
|
|
24065
24673
|
}
|
|
24066
24674
|
}
|
|
24067
24675
|
const seq = writeSteerMessage(agentBaseDir, ctxKey, {
|
|
@@ -24072,7 +24680,7 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
24072
24680
|
});
|
|
24073
24681
|
const ackResult = await waitForAck(agentBaseDir, ctxKey, seq);
|
|
24074
24682
|
if (ackResult.acked) {
|
|
24075
|
-
|
|
24683
|
+
log12.info(`Steering: task ${task.id} steered into predecessor ${predecessor.task_id} (acked)`);
|
|
24076
24684
|
try {
|
|
24077
24685
|
await client.startTask(token, task.id);
|
|
24078
24686
|
} catch {}
|
|
@@ -24080,19 +24688,19 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
24080
24688
|
activeTasks.delete(task.id);
|
|
24081
24689
|
return;
|
|
24082
24690
|
}
|
|
24083
|
-
|
|
24691
|
+
log12.info(`Steering: mailbox delivery failed for ${task.id} (${ackResult.nackReason}), falling back to kill-and-respawn`);
|
|
24084
24692
|
} catch (e) {
|
|
24085
|
-
|
|
24693
|
+
log12.warn(`Steering: mailbox error for ${task.id}, falling back to kill-and-respawn`, e);
|
|
24086
24694
|
}
|
|
24087
24695
|
}
|
|
24088
|
-
|
|
24696
|
+
log12.info(`Steering: task ${task.id} supersedes predecessor ${predecessor.task_id} (context_key=${ctxKey})`);
|
|
24089
24697
|
if (predecessor.pid != null) {
|
|
24090
24698
|
writeKillIntent(agentBaseDir, { reason: "superseded", targetTaskId: predecessor.task_id, expectedPid: predecessor.pid, successorTaskId: task.id });
|
|
24091
24699
|
try {
|
|
24092
24700
|
const delivered = await killAndVerify(predecessor.pid);
|
|
24093
|
-
|
|
24701
|
+
log12.info(delivered ? `Steering: terminated predecessor pid=${predecessor.pid}` : `Steering: predecessor pid=${predecessor.pid} already exited`);
|
|
24094
24702
|
} catch (e) {
|
|
24095
|
-
|
|
24703
|
+
log12.warn(`Steering: kill failed for pid=${predecessor.pid}`, e);
|
|
24096
24704
|
}
|
|
24097
24705
|
const killWaitStart = Date.now();
|
|
24098
24706
|
while (Date.now() - killWaitStart < 15000) {
|
|
@@ -24108,7 +24716,7 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
24108
24716
|
const finalEntry = pendingSteer.get(ctxKey);
|
|
24109
24717
|
if (finalEntry && finalEntry.tasks.length > 1) {
|
|
24110
24718
|
promptOverride = buildMergedPrompt(finalEntry.tasks, finalEntry.attachments);
|
|
24111
|
-
|
|
24719
|
+
log12.info(`Steering: merged ${finalEntry.tasks.length} tasks for context_key=${ctxKey}`);
|
|
24112
24720
|
} else if (finalEntry && finalEntry.tasks.length === 1) {
|
|
24113
24721
|
const att = finalEntry.attachments.get(task.id);
|
|
24114
24722
|
if (att && att.length > 0) {
|
|
@@ -24123,7 +24731,7 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
24123
24731
|
try {
|
|
24124
24732
|
myAttachments = await downloadAttachments(client, token, task.workspaceId, task.id, attachmentIds);
|
|
24125
24733
|
} catch (e) {
|
|
24126
|
-
|
|
24734
|
+
log12.warn(`Steering: failed to download attachments for ${task.id}`, e);
|
|
24127
24735
|
}
|
|
24128
24736
|
}
|
|
24129
24737
|
for (const prev of existing.tasks) {
|
|
@@ -24135,7 +24743,7 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
24135
24743
|
}
|
|
24136
24744
|
existing.tasks.push(task);
|
|
24137
24745
|
existing.attachments.set(task.id, myAttachments);
|
|
24138
|
-
|
|
24746
|
+
log12.info(`Steering: ${task.id} merged into pending entry for context_key=${ctxKey} (${existing.tasks.length} tasks)`);
|
|
24139
24747
|
existing.wake();
|
|
24140
24748
|
try {
|
|
24141
24749
|
await client.supersedeTask(token, task.id);
|
|
@@ -24182,14 +24790,14 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
24182
24790
|
const agentBaseDir = join12(config2.workspacesRoot, task.workspaceId, task.agentId, "workdir");
|
|
24183
24791
|
const killIntent = readKillIntent(agentBaseDir, task.id);
|
|
24184
24792
|
if (killIntent) {
|
|
24185
|
-
|
|
24793
|
+
log12.info(`Task ${task.id} exited (${killIntent.reason}) — expected, skipping failTask`);
|
|
24186
24794
|
clearKillIntent(agentBaseDir, task.id);
|
|
24187
24795
|
return;
|
|
24188
24796
|
}
|
|
24189
24797
|
const errorMsg = code === null ? "killed by signal" : `session-runner exited with code ${code}`;
|
|
24190
24798
|
try {
|
|
24191
24799
|
await client.failTask(token, task.id, errorMsg);
|
|
24192
|
-
|
|
24800
|
+
log12.warn(`session-runner crashed (${errorMsg}, task ${task.id})`);
|
|
24193
24801
|
const timelineDir = join12(agentBaseDir, ".context_timeline");
|
|
24194
24802
|
updateEntry(timelineDir, task.id, (entry) => {
|
|
24195
24803
|
entry.pid = null;
|
|
@@ -24198,10 +24806,10 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
24198
24806
|
});
|
|
24199
24807
|
} catch (e) {
|
|
24200
24808
|
if (isClientError3(e)) {
|
|
24201
|
-
|
|
24809
|
+
log12.info(`Task ${task.id} exited (already terminal) — session-runner handled cleanup`);
|
|
24202
24810
|
return;
|
|
24203
24811
|
}
|
|
24204
|
-
|
|
24812
|
+
log12.error(`Failed to report crash for task ${task.id}`, e);
|
|
24205
24813
|
try {
|
|
24206
24814
|
await writeMarkerFile(config2.workspacesRoot, {
|
|
24207
24815
|
taskId: task.id,
|
|
@@ -24215,7 +24823,7 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
24215
24823
|
}
|
|
24216
24824
|
}
|
|
24217
24825
|
});
|
|
24218
|
-
|
|
24826
|
+
log12.info(`Task ${task.id} dispatched to session-runner (pid=${child.pid})`);
|
|
24219
24827
|
}
|
|
24220
24828
|
|
|
24221
24829
|
// lib/runtimes.ts
|
|
@@ -24955,7 +25563,7 @@ function gatherContextEnvVars() {
|
|
|
24955
25563
|
}
|
|
24956
25564
|
|
|
24957
25565
|
// commands/email.ts
|
|
24958
|
-
var
|
|
25566
|
+
var log13 = createLogger2({ module: "email" });
|
|
24959
25567
|
var VALID_STATUSES = ["unread", "read", "archived", "sent"];
|
|
24960
25568
|
var VALID_FOLDERS = ["inbox", "sent", "untrust"];
|
|
24961
25569
|
var EMAIL_BASE = tempDir("alook-emails");
|
|
@@ -25042,7 +25650,7 @@ function emailCommand() {
|
|
|
25042
25650
|
} catch (err) {
|
|
25043
25651
|
const msg = err instanceof Error ? err.message : String(err);
|
|
25044
25652
|
if (msg.includes("404")) {
|
|
25045
|
-
|
|
25653
|
+
log13.warn(`email body not available for ${email3.id}, skipping`);
|
|
25046
25654
|
continue;
|
|
25047
25655
|
}
|
|
25048
25656
|
throw err;
|
|
@@ -25136,7 +25744,7 @@ function emailCommand() {
|
|
|
25136
25744
|
references = [parentEmail.references, parentEmail.message_id].filter(Boolean).join(" ").trim() || undefined;
|
|
25137
25745
|
}
|
|
25138
25746
|
} catch {
|
|
25139
|
-
|
|
25747
|
+
log13.warn(`could not fetch parent email ${opts.inReplyTo}, sending without threading`);
|
|
25140
25748
|
}
|
|
25141
25749
|
}
|
|
25142
25750
|
const ctx = gatherContextEnvVars();
|