@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/session-runner.js
CHANGED
|
@@ -11643,7 +11643,7 @@ function finalize(ctx, schema) {
|
|
|
11643
11643
|
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
11644
11644
|
} else if (ctx.target === "draft-04") {
|
|
11645
11645
|
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
11646
|
-
} else if (ctx.target === "openapi-3.0") {}
|
|
11646
|
+
} else if (ctx.target === "openapi-3.0") {} else {}
|
|
11647
11647
|
if (ctx.external?.uri) {
|
|
11648
11648
|
const id = ctx.external.registry.get(schema)?.id;
|
|
11649
11649
|
if (!id)
|
|
@@ -11887,7 +11887,7 @@ var literalProcessor = (schema, ctx, json, _params) => {
|
|
|
11887
11887
|
if (val === undefined) {
|
|
11888
11888
|
if (ctx.unrepresentable === "throw") {
|
|
11889
11889
|
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
11890
|
-
}
|
|
11890
|
+
} else {}
|
|
11891
11891
|
} else if (typeof val === "bigint") {
|
|
11892
11892
|
if (ctx.unrepresentable === "throw") {
|
|
11893
11893
|
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
@@ -15029,6 +15029,7 @@ var SessionErrorFrameSchema = exports_external.object({
|
|
|
15029
15029
|
type: exports_external.literal("session.error"),
|
|
15030
15030
|
code: exports_external.enum(["runtime_not_available"]),
|
|
15031
15031
|
agentId: exports_external.string().optional(),
|
|
15032
|
+
launchId: exports_external.string().optional(),
|
|
15032
15033
|
payload: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
|
|
15033
15034
|
});
|
|
15034
15035
|
var AgentActivityMessageSchema = exports_external.object({
|
|
@@ -15039,12 +15040,25 @@ var AgentActivityMessageSchema = exports_external.object({
|
|
|
15039
15040
|
var AgentTypingMessageSchema = exports_external.object({
|
|
15040
15041
|
type: exports_external.literal("agent_typing"),
|
|
15041
15042
|
agentId: exports_external.string(),
|
|
15042
|
-
|
|
15043
|
+
channelId: exports_external.string().min(1)
|
|
15043
15044
|
});
|
|
15044
15045
|
var AgentTypingStopMessageSchema = exports_external.object({
|
|
15045
15046
|
type: exports_external.literal("agent_typing_stop"),
|
|
15046
15047
|
agentId: exports_external.string(),
|
|
15047
|
-
|
|
15048
|
+
channelId: exports_external.string().min(1)
|
|
15049
|
+
});
|
|
15050
|
+
var AgentSessionMessageSchema = exports_external.object({
|
|
15051
|
+
type: exports_external.literal("agent_session"),
|
|
15052
|
+
agentId: exports_external.string().min(1),
|
|
15053
|
+
sessionId: exports_external.string().min(1),
|
|
15054
|
+
launchId: exports_external.string().min(1)
|
|
15055
|
+
});
|
|
15056
|
+
var AgentWakeAckMessageSchema = exports_external.object({
|
|
15057
|
+
type: exports_external.literal("agent_wake_ack"),
|
|
15058
|
+
agentId: exports_external.string().min(1),
|
|
15059
|
+
launchId: exports_external.string().min(1),
|
|
15060
|
+
status: exports_external.enum(["ok", "error"]),
|
|
15061
|
+
error: exports_external.object({ code: exports_external.string().optional(), message: exports_external.string().optional() }).optional()
|
|
15048
15062
|
});
|
|
15049
15063
|
var CommunityPairTokenResponseSchema = exports_external.object({
|
|
15050
15064
|
tokenId: exports_external.string(),
|
|
@@ -15081,13 +15095,16 @@ var CommunityBotCreateRequestSchema = exports_external.object({
|
|
|
15081
15095
|
description: exports_external.string().max(COMMUNITY_BOT_DESCRIPTION_MAX).optional(),
|
|
15082
15096
|
machineId: exports_external.string().min(1),
|
|
15083
15097
|
runtime: exports_external.string().min(1),
|
|
15084
|
-
image: BotImageUrlSchema.optional()
|
|
15098
|
+
image: BotImageUrlSchema.optional(),
|
|
15099
|
+
model: exports_external.string().trim().min(1).max(100).nullable().optional()
|
|
15085
15100
|
});
|
|
15086
15101
|
var CommunityBotPatchRequestSchema = exports_external.object({
|
|
15087
15102
|
name: exports_external.string().trim().min(COMMUNITY_BOT_NAME_MIN).max(COMMUNITY_BOT_NAME_MAX).refine(isMentionSafeName, { message: MENTION_SAFE_NAME_MSG }).optional(),
|
|
15088
15103
|
description: exports_external.string().max(COMMUNITY_BOT_DESCRIPTION_MAX).optional(),
|
|
15089
|
-
image: BotImageUrlSchema.nullable().optional()
|
|
15090
|
-
|
|
15104
|
+
image: BotImageUrlSchema.nullable().optional(),
|
|
15105
|
+
model: exports_external.string().trim().min(1).max(100).nullable().optional(),
|
|
15106
|
+
runtime: exports_external.string().trim().min(1).max(COMMUNITY_RUNTIME_ID_MAX).optional()
|
|
15107
|
+
}).refine((v) => v.name !== undefined || v.description !== undefined || v.image !== undefined || v.runtime !== undefined || ("model" in v), {
|
|
15091
15108
|
message: "at least one field must be provided"
|
|
15092
15109
|
});
|
|
15093
15110
|
var CommunityBotAddToServerRequestSchema = exports_external.object({
|
|
@@ -15104,7 +15121,9 @@ var CommunityAgentSendRequestSchema = exports_external.object({
|
|
|
15104
15121
|
channel: exports_external.string().min(1),
|
|
15105
15122
|
content: CommunityAgentMessageContentSchema,
|
|
15106
15123
|
attachments: exports_external.array(exports_external.string().min(1)).max(MAX_ATTACHMENTS_PER_MESSAGE).default([]),
|
|
15107
|
-
seenUpToSeq: CommunityAgentSeqSchema.optional()
|
|
15124
|
+
seenUpToSeq: CommunityAgentSeqSchema.optional(),
|
|
15125
|
+
replyToSeq: CommunityAgentPositiveSeqSchema.optional(),
|
|
15126
|
+
nonce: exports_external.string().min(1).max(128).optional()
|
|
15108
15127
|
}).refine((d) => d.content.text.trim().length > 0 || d.attachments.length > 0, { message: "message must have text or attachments" });
|
|
15109
15128
|
var CommunityAgentAttachmentUploadResponseSchema = exports_external.object({
|
|
15110
15129
|
id: exports_external.string(),
|
|
@@ -15135,8 +15154,17 @@ var CommunityAgentResolveRequestSchema = exports_external.object({
|
|
|
15135
15154
|
var CommunityAgentListChannelsRequestSchema = exports_external.object({
|
|
15136
15155
|
server: exports_external.string().min(1).optional()
|
|
15137
15156
|
});
|
|
15157
|
+
var CommunityAgentCreatePostRequestSchema = exports_external.object({
|
|
15158
|
+
forum: exports_external.string().min(1),
|
|
15159
|
+
title: exports_external.string().min(1),
|
|
15160
|
+
content: CommunityAgentMessageContentSchema,
|
|
15161
|
+
attachments: exports_external.array(exports_external.string().min(1)).max(MAX_ATTACHMENTS_PER_MESSAGE).default([]),
|
|
15162
|
+
nonce: exports_external.string().min(1).max(128).optional()
|
|
15163
|
+
}).refine((d) => d.content.text.trim().length > 0 || d.attachments.length > 0, { message: "post must have text or attachments" });
|
|
15138
15164
|
var CommunityAgentListMembersRequestSchema = exports_external.object({
|
|
15139
|
-
server: exports_external.string().min(1)
|
|
15165
|
+
server: exports_external.string().min(1),
|
|
15166
|
+
limit: exports_external.number().int().positive().optional(),
|
|
15167
|
+
cursor: exports_external.string().min(1).optional()
|
|
15140
15168
|
});
|
|
15141
15169
|
var CommunityAgentChannelMemberRequestSchema = exports_external.object({
|
|
15142
15170
|
channel: exports_external.string().min(1),
|
|
@@ -15145,11 +15173,18 @@ var CommunityAgentChannelMemberRequestSchema = exports_external.object({
|
|
|
15145
15173
|
var CommunityAgentJoinServerRequestSchema = exports_external.object({
|
|
15146
15174
|
invite: exports_external.string().min(1)
|
|
15147
15175
|
});
|
|
15176
|
+
var CommunityAgentNapRequestSchema = exports_external.object({
|
|
15177
|
+
handoff: exports_external.string().trim().min(1)
|
|
15178
|
+
});
|
|
15148
15179
|
var CommunityAgentReactAddRequestSchema = exports_external.object({
|
|
15149
15180
|
channel: exports_external.string().min(1),
|
|
15150
15181
|
seq: CommunityAgentPositiveSeqSchema,
|
|
15151
15182
|
emoji: exports_external.string().min(1)
|
|
15152
15183
|
});
|
|
15184
|
+
var CommunityAgentFriendRequestSchema = exports_external.object({
|
|
15185
|
+
username: exports_external.string().min(1)
|
|
15186
|
+
});
|
|
15187
|
+
var CommunityAgentListFriendsSchema = exports_external.object({});
|
|
15153
15188
|
var AuditLogCliInvocationPayloadSchema = exports_external.object({
|
|
15154
15189
|
subcommand: exports_external.string().min(1)
|
|
15155
15190
|
});
|
|
@@ -15170,20 +15205,47 @@ var AuditLogWakeTriggerPayloadSchema = exports_external.object({
|
|
|
15170
15205
|
senderHandle: exports_external.string().min(1),
|
|
15171
15206
|
reason: exports_external.enum(["unread", "mention"])
|
|
15172
15207
|
});
|
|
15173
|
-
var AuditLogSessionResetPayloadSchema = exports_external.object({
|
|
15208
|
+
var AuditLogSessionResetPayloadSchema = exports_external.object({
|
|
15209
|
+
trigger: exports_external.enum(["single", "reset_all"])
|
|
15210
|
+
});
|
|
15211
|
+
var AuditLogNapPayloadSchema = exports_external.object({
|
|
15212
|
+
trigger: exports_external.literal("nap")
|
|
15213
|
+
});
|
|
15214
|
+
var AuditLogModelChangedPayloadSchema = exports_external.object({
|
|
15215
|
+
from: exports_external.string().nullable(),
|
|
15216
|
+
to: exports_external.string().nullable()
|
|
15217
|
+
});
|
|
15218
|
+
var AuditLogProviderChangedPayloadSchema = exports_external.object({
|
|
15219
|
+
from: exports_external.string().min(1),
|
|
15220
|
+
to: exports_external.string().min(1)
|
|
15221
|
+
});
|
|
15222
|
+
var AuditLogErrorPayloadSchema = exports_external.object({
|
|
15223
|
+
scope: exports_external.enum(["spawn", "runtime", "exit", "handshake_timeout", "model_switch", "reset"]),
|
|
15224
|
+
code: exports_external.string().min(1).max(120),
|
|
15225
|
+
message: exports_external.string().max(2048),
|
|
15226
|
+
model: exports_external.string().nullable()
|
|
15227
|
+
});
|
|
15174
15228
|
var BotAuditEventSchema = exports_external.discriminatedUnion("kind", [
|
|
15175
15229
|
exports_external.object({ kind: exports_external.literal("cli_invocation"), payload: AuditLogCliInvocationPayloadSchema }),
|
|
15176
15230
|
exports_external.object({ kind: exports_external.literal("tool_call"), payload: AuditLogToolCallPayloadSchema }),
|
|
15177
15231
|
exports_external.object({ kind: exports_external.literal("thinking"), payload: AuditLogThinkingPayloadSchema }),
|
|
15178
15232
|
exports_external.object({ kind: exports_external.literal("wake_trigger"), payload: AuditLogWakeTriggerPayloadSchema }),
|
|
15179
|
-
exports_external.object({ kind: exports_external.literal("session_reset"), payload: AuditLogSessionResetPayloadSchema })
|
|
15233
|
+
exports_external.object({ kind: exports_external.literal("session_reset"), payload: AuditLogSessionResetPayloadSchema }),
|
|
15234
|
+
exports_external.object({ kind: exports_external.literal("nap"), payload: AuditLogNapPayloadSchema }),
|
|
15235
|
+
exports_external.object({ kind: exports_external.literal("model_changed"), payload: AuditLogModelChangedPayloadSchema }),
|
|
15236
|
+
exports_external.object({ kind: exports_external.literal("provider_changed"), payload: AuditLogProviderChangedPayloadSchema }),
|
|
15237
|
+
exports_external.object({ kind: exports_external.literal("error"), payload: AuditLogErrorPayloadSchema })
|
|
15180
15238
|
]);
|
|
15181
15239
|
var BotAuditEventKindSchema = exports_external.enum([
|
|
15182
15240
|
"cli_invocation",
|
|
15183
15241
|
"tool_call",
|
|
15184
15242
|
"thinking",
|
|
15185
15243
|
"wake_trigger",
|
|
15186
|
-
"session_reset"
|
|
15244
|
+
"session_reset",
|
|
15245
|
+
"nap",
|
|
15246
|
+
"model_changed",
|
|
15247
|
+
"provider_changed",
|
|
15248
|
+
"error"
|
|
15187
15249
|
]);
|
|
15188
15250
|
var HostBotAuditEventFrameSchema = exports_external.object({
|
|
15189
15251
|
type: exports_external.literal("bot_audit_event"),
|
|
@@ -15192,7 +15254,71 @@ var HostBotAuditEventFrameSchema = exports_external.object({
|
|
|
15192
15254
|
launchId: exports_external.string().nullable().optional(),
|
|
15193
15255
|
event: BotAuditEventSchema
|
|
15194
15256
|
});
|
|
15195
|
-
//
|
|
15257
|
+
// ../shared/src/community-cli-contract.ts
|
|
15258
|
+
var HostCommandSchema = exports_external.discriminatedUnion("type", [
|
|
15259
|
+
exports_external.object({
|
|
15260
|
+
type: exports_external.literal("agent:wake"),
|
|
15261
|
+
agentId: exports_external.string().min(1),
|
|
15262
|
+
config: exports_external.unknown(),
|
|
15263
|
+
sessionId: exports_external.string().optional(),
|
|
15264
|
+
launchId: exports_external.string().min(1),
|
|
15265
|
+
unreadNotice: exports_external.unknown()
|
|
15266
|
+
}),
|
|
15267
|
+
exports_external.object({
|
|
15268
|
+
type: exports_external.literal("agent:stop"),
|
|
15269
|
+
agentId: exports_external.string().min(1)
|
|
15270
|
+
}),
|
|
15271
|
+
exports_external.object({
|
|
15272
|
+
type: exports_external.literal("agent:reset"),
|
|
15273
|
+
agentId: exports_external.string().min(1),
|
|
15274
|
+
config: exports_external.unknown(),
|
|
15275
|
+
launchId: exports_external.string().min(1)
|
|
15276
|
+
}),
|
|
15277
|
+
exports_external.object({
|
|
15278
|
+
type: exports_external.literal("agent:nap"),
|
|
15279
|
+
agentId: exports_external.string().min(1),
|
|
15280
|
+
config: exports_external.unknown(),
|
|
15281
|
+
launchId: exports_external.string().min(1),
|
|
15282
|
+
handoff: exports_external.string().min(1)
|
|
15283
|
+
}),
|
|
15284
|
+
exports_external.object({
|
|
15285
|
+
type: exports_external.literal("agent:model_switch"),
|
|
15286
|
+
agentId: exports_external.string().min(1),
|
|
15287
|
+
config: exports_external.unknown(),
|
|
15288
|
+
launchId: exports_external.string().min(1)
|
|
15289
|
+
}),
|
|
15290
|
+
exports_external.object({
|
|
15291
|
+
type: exports_external.literal("machine:reset_all"),
|
|
15292
|
+
resets: exports_external.array(exports_external.object({
|
|
15293
|
+
agentId: exports_external.string().min(1),
|
|
15294
|
+
config: exports_external.unknown(),
|
|
15295
|
+
launchId: exports_external.string().min(1)
|
|
15296
|
+
}))
|
|
15297
|
+
}),
|
|
15298
|
+
exports_external.object({
|
|
15299
|
+
type: exports_external.literal("bot:added"),
|
|
15300
|
+
botId: exports_external.string().min(1),
|
|
15301
|
+
name: exports_external.string().optional(),
|
|
15302
|
+
discriminator: exports_external.string().optional(),
|
|
15303
|
+
description: exports_external.string().optional(),
|
|
15304
|
+
ownerName: exports_external.string().optional(),
|
|
15305
|
+
ownerDiscriminator: exports_external.string().optional()
|
|
15306
|
+
}),
|
|
15307
|
+
exports_external.object({
|
|
15308
|
+
type: exports_external.literal("bot:updated"),
|
|
15309
|
+
botId: exports_external.string().min(1),
|
|
15310
|
+
name: exports_external.string().optional(),
|
|
15311
|
+
discriminator: exports_external.string().optional(),
|
|
15312
|
+
description: exports_external.string().optional(),
|
|
15313
|
+
ownerName: exports_external.string().optional(),
|
|
15314
|
+
ownerDiscriminator: exports_external.string().optional()
|
|
15315
|
+
}),
|
|
15316
|
+
exports_external.object({
|
|
15317
|
+
type: exports_external.literal("bot:removed"),
|
|
15318
|
+
botId: exports_external.string().min(1)
|
|
15319
|
+
})
|
|
15320
|
+
]);
|
|
15321
|
+
// ../../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
|
|
15196
15322
|
var entityKind = Symbol.for("drizzle:entityKind");
|
|
15197
15323
|
var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
|
|
15198
15324
|
function is(value, type) {
|
|
@@ -15217,7 +15343,7 @@ function is(value, type) {
|
|
|
15217
15343
|
return false;
|
|
15218
15344
|
}
|
|
15219
15345
|
|
|
15220
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15346
|
+
// ../../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
|
|
15221
15347
|
class Column {
|
|
15222
15348
|
constructor(table, config2) {
|
|
15223
15349
|
this.table = table;
|
|
@@ -15267,7 +15393,7 @@ class Column {
|
|
|
15267
15393
|
}
|
|
15268
15394
|
}
|
|
15269
15395
|
|
|
15270
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15396
|
+
// ../../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
|
|
15271
15397
|
class ColumnBuilder {
|
|
15272
15398
|
static [entityKind] = "ColumnBuilder";
|
|
15273
15399
|
config;
|
|
@@ -15323,20 +15449,20 @@ class ColumnBuilder {
|
|
|
15323
15449
|
}
|
|
15324
15450
|
}
|
|
15325
15451
|
|
|
15326
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15452
|
+
// ../../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
|
|
15327
15453
|
var TableName = Symbol.for("drizzle:Name");
|
|
15328
15454
|
|
|
15329
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15455
|
+
// ../../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
|
|
15330
15456
|
function iife(fn, ...args) {
|
|
15331
15457
|
return fn(...args);
|
|
15332
15458
|
}
|
|
15333
15459
|
|
|
15334
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15460
|
+
// ../../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
|
|
15335
15461
|
function uniqueKeyName(table, columns) {
|
|
15336
15462
|
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
15337
15463
|
}
|
|
15338
15464
|
|
|
15339
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15465
|
+
// ../../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
|
|
15340
15466
|
class PgColumn extends Column {
|
|
15341
15467
|
constructor(table, config2) {
|
|
15342
15468
|
if (!config2.uniqueName) {
|
|
@@ -15385,7 +15511,7 @@ class ExtraConfigColumn extends PgColumn {
|
|
|
15385
15511
|
}
|
|
15386
15512
|
}
|
|
15387
15513
|
|
|
15388
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15514
|
+
// ../../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
|
|
15389
15515
|
class PgEnumObjectColumn extends PgColumn {
|
|
15390
15516
|
static [entityKind] = "PgEnumObjectColumn";
|
|
15391
15517
|
enum;
|
|
@@ -15415,7 +15541,7 @@ class PgEnumColumn extends PgColumn {
|
|
|
15415
15541
|
}
|
|
15416
15542
|
}
|
|
15417
15543
|
|
|
15418
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15544
|
+
// ../../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
|
|
15419
15545
|
class Subquery {
|
|
15420
15546
|
static [entityKind] = "Subquery";
|
|
15421
15547
|
constructor(sql, fields, alias, isWith = false, usedTables = []) {
|
|
@@ -15430,10 +15556,10 @@ class Subquery {
|
|
|
15430
15556
|
}
|
|
15431
15557
|
}
|
|
15432
15558
|
|
|
15433
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15559
|
+
// ../../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
|
|
15434
15560
|
var version2 = "0.45.2";
|
|
15435
15561
|
|
|
15436
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15562
|
+
// ../../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
|
|
15437
15563
|
var otel;
|
|
15438
15564
|
var rawTracer;
|
|
15439
15565
|
var tracer = {
|
|
@@ -15460,10 +15586,10 @@ var tracer = {
|
|
|
15460
15586
|
}
|
|
15461
15587
|
};
|
|
15462
15588
|
|
|
15463
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15589
|
+
// ../../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
|
|
15464
15590
|
var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
|
|
15465
15591
|
|
|
15466
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15592
|
+
// ../../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
|
|
15467
15593
|
var Schema = Symbol.for("drizzle:Schema");
|
|
15468
15594
|
var Columns = Symbol.for("drizzle:Columns");
|
|
15469
15595
|
var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
|
|
@@ -15501,7 +15627,7 @@ class Table {
|
|
|
15501
15627
|
}
|
|
15502
15628
|
}
|
|
15503
15629
|
|
|
15504
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15630
|
+
// ../../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
|
|
15505
15631
|
function isSQLWrapper(value) {
|
|
15506
15632
|
return value !== null && value !== undefined && typeof value.getSQL === "function";
|
|
15507
15633
|
}
|
|
@@ -15861,7 +15987,7 @@ Subquery.prototype.getSQL = function() {
|
|
|
15861
15987
|
return new SQL([this]);
|
|
15862
15988
|
};
|
|
15863
15989
|
|
|
15864
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
15990
|
+
// ../../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
|
|
15865
15991
|
function getColumnNameAndConfig(a, b) {
|
|
15866
15992
|
return {
|
|
15867
15993
|
name: typeof a === "string" && a.length > 0 ? a : "",
|
|
@@ -15874,7 +16000,6 @@ var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder;
|
|
|
15874
16000
|
var exports_community_schema = {};
|
|
15875
16001
|
__export(exports_community_schema, {
|
|
15876
16002
|
communityUserProfile: () => communityUserProfile,
|
|
15877
|
-
communityThreadParticipant: () => communityThreadParticipant,
|
|
15878
16003
|
communityServerMember: () => communityServerMember,
|
|
15879
16004
|
communityServerInvite: () => communityServerInvite,
|
|
15880
16005
|
communityServerFolderItem: () => communityServerFolderItem,
|
|
@@ -15884,21 +16009,23 @@ __export(exports_community_schema, {
|
|
|
15884
16009
|
communityReaction: () => communityReaction,
|
|
15885
16010
|
communityPin: () => communityPin,
|
|
15886
16011
|
communityNotificationSetting: () => communityNotificationSetting,
|
|
16012
|
+
communityMessageTag: () => communityMessageTag,
|
|
15887
16013
|
communityMessageSeq: () => communityMessageSeq,
|
|
16014
|
+
communityMessageMark: () => communityMessageMark,
|
|
15888
16015
|
communityMessage: () => communityMessage,
|
|
15889
16016
|
communityMention: () => communityMention,
|
|
15890
16017
|
communityFriendship: () => communityFriendship,
|
|
15891
|
-
communityDmConversation: () => communityDmConversation,
|
|
15892
16018
|
communityChannelMember: () => communityChannelMember,
|
|
15893
16019
|
communityChannel: () => communityChannel,
|
|
15894
16020
|
communityCategory: () => communityCategory,
|
|
16021
|
+
communityBotDailyActivity: () => communityBotDailyActivity,
|
|
15895
16022
|
communityBotApprovalRequest: () => communityBotApprovalRequest,
|
|
15896
16023
|
communityBotActivityEvent: () => communityBotActivityEvent,
|
|
15897
16024
|
communityAuditLog: () => communityAuditLog,
|
|
15898
16025
|
communityAttachment: () => communityAttachment
|
|
15899
16026
|
});
|
|
15900
16027
|
|
|
15901
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16028
|
+
// ../../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
|
|
15902
16029
|
class ForeignKeyBuilder {
|
|
15903
16030
|
static [entityKind] = "SQLiteForeignKeyBuilder";
|
|
15904
16031
|
reference;
|
|
@@ -15966,7 +16093,7 @@ function foreignKey(config2) {
|
|
|
15966
16093
|
return new ForeignKeyBuilder(mappedConfig);
|
|
15967
16094
|
}
|
|
15968
16095
|
|
|
15969
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16096
|
+
// ../../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
|
|
15970
16097
|
function uniqueKeyName2(table, columns) {
|
|
15971
16098
|
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
15972
16099
|
}
|
|
@@ -16011,7 +16138,7 @@ class UniqueConstraint {
|
|
|
16011
16138
|
}
|
|
16012
16139
|
}
|
|
16013
16140
|
|
|
16014
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16141
|
+
// ../../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
|
|
16015
16142
|
class SQLiteColumnBuilder extends ColumnBuilder {
|
|
16016
16143
|
static [entityKind] = "SQLiteColumnBuilder";
|
|
16017
16144
|
foreignKeyConfigs = [];
|
|
@@ -16062,7 +16189,7 @@ class SQLiteColumn extends Column {
|
|
|
16062
16189
|
static [entityKind] = "SQLiteColumn";
|
|
16063
16190
|
}
|
|
16064
16191
|
|
|
16065
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16192
|
+
// ../../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
|
|
16066
16193
|
class SQLiteBigIntBuilder extends SQLiteColumnBuilder {
|
|
16067
16194
|
static [entityKind] = "SQLiteBigIntBuilder";
|
|
16068
16195
|
constructor(name) {
|
|
@@ -16150,7 +16277,7 @@ function blob(a, b) {
|
|
|
16150
16277
|
return new SQLiteBlobBufferBuilder(name);
|
|
16151
16278
|
}
|
|
16152
16279
|
|
|
16153
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16280
|
+
// ../../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
|
|
16154
16281
|
class SQLiteCustomColumnBuilder extends SQLiteColumnBuilder {
|
|
16155
16282
|
static [entityKind] = "SQLiteCustomColumnBuilder";
|
|
16156
16283
|
constructor(name, fieldConfig, customTypeParams) {
|
|
@@ -16191,7 +16318,7 @@ function customType(customTypeParams) {
|
|
|
16191
16318
|
};
|
|
16192
16319
|
}
|
|
16193
16320
|
|
|
16194
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16321
|
+
// ../../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
|
|
16195
16322
|
class SQLiteBaseIntegerBuilder extends SQLiteColumnBuilder {
|
|
16196
16323
|
static [entityKind] = "SQLiteBaseIntegerBuilder";
|
|
16197
16324
|
constructor(name, dataType, columnType) {
|
|
@@ -16293,7 +16420,7 @@ function integer2(a, b) {
|
|
|
16293
16420
|
return new SQLiteIntegerBuilder(name);
|
|
16294
16421
|
}
|
|
16295
16422
|
|
|
16296
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16423
|
+
// ../../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
|
|
16297
16424
|
class SQLiteNumericBuilder extends SQLiteColumnBuilder {
|
|
16298
16425
|
static [entityKind] = "SQLiteNumericBuilder";
|
|
16299
16426
|
constructor(name) {
|
|
@@ -16363,7 +16490,7 @@ function numeric(a, b) {
|
|
|
16363
16490
|
return mode === "number" ? new SQLiteNumericNumberBuilder(name) : mode === "bigint" ? new SQLiteNumericBigIntBuilder(name) : new SQLiteNumericBuilder(name);
|
|
16364
16491
|
}
|
|
16365
16492
|
|
|
16366
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16493
|
+
// ../../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
|
|
16367
16494
|
class SQLiteRealBuilder extends SQLiteColumnBuilder {
|
|
16368
16495
|
static [entityKind] = "SQLiteRealBuilder";
|
|
16369
16496
|
constructor(name) {
|
|
@@ -16384,7 +16511,7 @@ function real(name) {
|
|
|
16384
16511
|
return new SQLiteRealBuilder(name ?? "");
|
|
16385
16512
|
}
|
|
16386
16513
|
|
|
16387
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16514
|
+
// ../../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
|
|
16388
16515
|
class SQLiteTextBuilder extends SQLiteColumnBuilder {
|
|
16389
16516
|
static [entityKind] = "SQLiteTextBuilder";
|
|
16390
16517
|
constructor(name, config2) {
|
|
@@ -16439,7 +16566,7 @@ function text(a, b = {}) {
|
|
|
16439
16566
|
return new SQLiteTextBuilder(name, config2);
|
|
16440
16567
|
}
|
|
16441
16568
|
|
|
16442
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16569
|
+
// ../../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
|
|
16443
16570
|
function getSQLiteColumnBuilders() {
|
|
16444
16571
|
return {
|
|
16445
16572
|
blob,
|
|
@@ -16451,7 +16578,7 @@ function getSQLiteColumnBuilders() {
|
|
|
16451
16578
|
};
|
|
16452
16579
|
}
|
|
16453
16580
|
|
|
16454
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16581
|
+
// ../../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
|
|
16455
16582
|
var InlineForeignKeys = Symbol.for("drizzle:SQLiteInlineForeignKeys");
|
|
16456
16583
|
|
|
16457
16584
|
class SQLiteTable extends Table {
|
|
@@ -16485,7 +16612,7 @@ var sqliteTable = (name, columns, extraConfig) => {
|
|
|
16485
16612
|
return sqliteTableBase(name, columns, extraConfig);
|
|
16486
16613
|
};
|
|
16487
16614
|
|
|
16488
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16615
|
+
// ../../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
|
|
16489
16616
|
class IndexBuilderOn {
|
|
16490
16617
|
constructor(name, unique2) {
|
|
16491
16618
|
this.name = name;
|
|
@@ -16531,7 +16658,7 @@ function uniqueIndex(name) {
|
|
|
16531
16658
|
return new IndexBuilderOn(name, true);
|
|
16532
16659
|
}
|
|
16533
16660
|
|
|
16534
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@
|
|
16661
|
+
// ../../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
|
|
16535
16662
|
function primaryKey(...config2) {
|
|
16536
16663
|
if (config2[0].columns) {
|
|
16537
16664
|
return new PrimaryKeyBuilder(config2[0].columns, config2[0].name);
|
|
@@ -16619,7 +16746,8 @@ var user = sqliteTable("user", {
|
|
|
16619
16746
|
isBot: integer2("isBot", { mode: "boolean" }).notNull().default(false),
|
|
16620
16747
|
ownerUserId: text("ownerUserId").references(() => user.id, { onDelete: "no action" }),
|
|
16621
16748
|
deletedAt: text("deletedAt"),
|
|
16622
|
-
discriminator: text("discriminator").notNull().default("0000")
|
|
16749
|
+
discriminator: text("discriminator").notNull().default("0000"),
|
|
16750
|
+
lastRefreshContextAt: text("lastRefreshContextAt")
|
|
16623
16751
|
}, (t) => [index("idx_user_ownerUserId_isBot").on(t.ownerUserId, t.isBot)]);
|
|
16624
16752
|
var session = sqliteTable("session", {
|
|
16625
16753
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
@@ -17161,11 +17289,14 @@ var inboxUnread = sqliteTable("inbox_unread", {
|
|
|
17161
17289
|
var communityServer = sqliteTable("community_server", {
|
|
17162
17290
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17163
17291
|
name: text("name").notNull(),
|
|
17292
|
+
discriminator: text("discriminator").notNull().default("0000"),
|
|
17164
17293
|
description: text("description").default(""),
|
|
17165
17294
|
icon: text("icon"),
|
|
17166
17295
|
ownerId: text("owner_id").notNull().references(() => user.id, { onDelete: "restrict" }),
|
|
17167
17296
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17168
|
-
})
|
|
17297
|
+
}, (t) => [
|
|
17298
|
+
uniqueIndex("idx_community_server_name_discriminator").on(t.name, t.discriminator)
|
|
17299
|
+
]);
|
|
17169
17300
|
var communityCategory = sqliteTable("community_category", {
|
|
17170
17301
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17171
17302
|
serverId: text("server_id").notNull().references(() => communityServer.id, { onDelete: "cascade" }),
|
|
@@ -17176,15 +17307,16 @@ var communityCategory = sqliteTable("community_category", {
|
|
|
17176
17307
|
}, (t) => [unique("uq_category_server_name").on(t.serverId, t.name)]);
|
|
17177
17308
|
var communityChannel = sqliteTable("community_channel", {
|
|
17178
17309
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17179
|
-
serverId: text("server_id").
|
|
17310
|
+
serverId: text("server_id").references(() => communityServer.id, {
|
|
17311
|
+
onDelete: "cascade"
|
|
17312
|
+
}),
|
|
17180
17313
|
categoryId: text("category_id").references(() => communityCategory.id, {
|
|
17181
17314
|
onDelete: "set null"
|
|
17182
17315
|
}),
|
|
17183
|
-
name: text("name")
|
|
17316
|
+
name: text("name"),
|
|
17184
17317
|
type: text("type").notNull().default("text"),
|
|
17185
17318
|
topic: text("topic").default(""),
|
|
17186
17319
|
position: integer2("position").default(0),
|
|
17187
|
-
forumTags: text("forum_tags"),
|
|
17188
17320
|
parentChannelId: text("parent_channel_id").references(() => communityChannel.id, {
|
|
17189
17321
|
onDelete: "cascade"
|
|
17190
17322
|
}),
|
|
@@ -17204,33 +17336,14 @@ var communityChannelMember = sqliteTable("community_channel_member", {
|
|
|
17204
17336
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17205
17337
|
channelId: text("channel_id").notNull().references(() => communityChannel.id, { onDelete: "cascade" }),
|
|
17206
17338
|
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17339
|
+
relation: text("relation").notNull().default("access"),
|
|
17340
|
+
source: text("source").notNull().default("added"),
|
|
17207
17341
|
addedBy: text("added_by").references(() => user.id, { onDelete: "set null" }),
|
|
17208
17342
|
addedAt: text("added_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17209
17343
|
}, (t) => [
|
|
17210
|
-
unique("uq_channel_member").on(t.channelId, t.userId),
|
|
17344
|
+
unique("uq_channel_member").on(t.channelId, t.userId, t.relation),
|
|
17211
17345
|
index("idx_channel_member_user").on(t.userId)
|
|
17212
17346
|
]);
|
|
17213
|
-
var communityThreadParticipant = sqliteTable("community_thread_participant", {
|
|
17214
|
-
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17215
|
-
threadChannelId: text("thread_channel_id").notNull().references(() => communityChannel.id, { onDelete: "cascade" }),
|
|
17216
|
-
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17217
|
-
source: text("source").notNull().default("mention"),
|
|
17218
|
-
addedAt: text("added_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17219
|
-
}, (t) => [
|
|
17220
|
-
unique("uq_thread_participant").on(t.threadChannelId, t.userId),
|
|
17221
|
-
index("idx_thread_participant_user").on(t.userId)
|
|
17222
|
-
]);
|
|
17223
|
-
var communityDmConversation = sqliteTable("community_dm_conversation", {
|
|
17224
|
-
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17225
|
-
user1Id: text("user1_id").references(() => user.id, { onDelete: "set null" }),
|
|
17226
|
-
user2Id: text("user2_id").references(() => user.id, { onDelete: "set null" }),
|
|
17227
|
-
lastMessageAt: text("last_message_at"),
|
|
17228
|
-
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17229
|
-
}, (t) => [
|
|
17230
|
-
unique("uq_dm_conversation_users").on(t.user1Id, t.user2Id),
|
|
17231
|
-
index("idx_dm_conversation_user1_last_message").on(t.user1Id, t.lastMessageAt),
|
|
17232
|
-
index("idx_dm_conversation_user2_last_message").on(t.user2Id, t.lastMessageAt)
|
|
17233
|
-
]);
|
|
17234
17347
|
var communityMessage = sqliteTable("community_message", {
|
|
17235
17348
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17236
17349
|
authorId: text("author_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
@@ -17239,20 +17352,19 @@ var communityMessage = sqliteTable("community_message", {
|
|
|
17239
17352
|
mentionType: text("mention_type"),
|
|
17240
17353
|
replyToId: text("reply_to_id"),
|
|
17241
17354
|
embeds: text("embeds"),
|
|
17242
|
-
flags: integer2("flags").default(0),
|
|
17243
17355
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),
|
|
17244
|
-
channelId: text("channel_id").references(() => communityChannel.id, {
|
|
17356
|
+
channelId: text("channel_id").notNull().references(() => communityChannel.id, {
|
|
17245
17357
|
onDelete: "cascade"
|
|
17246
17358
|
}),
|
|
17247
|
-
|
|
17248
|
-
|
|
17359
|
+
seq: integer2("seq").notNull().default(0),
|
|
17360
|
+
friendshipId: text("friendship_id").references(() => communityFriendship.id, { onDelete: "set null" }),
|
|
17361
|
+
clientNonce: text("client_nonce")
|
|
17249
17362
|
}, (t) => [
|
|
17250
17363
|
index("idx_message_channel_created").on(t.channelId, t.createdAt),
|
|
17251
|
-
index("idx_message_channel_mention_created").on(t.channelId, t.mentionType, t.createdAt)
|
|
17252
|
-
index("idx_message_dm_created").on(t.dmConversationId, t.createdAt)
|
|
17364
|
+
index("idx_message_channel_mention_created").on(t.channelId, t.mentionType, t.createdAt)
|
|
17253
17365
|
]);
|
|
17254
17366
|
var communityMessageSeq = sqliteTable("community_message_seq", {
|
|
17255
|
-
|
|
17367
|
+
channelId: text("channel_id").primaryKey().references(() => communityChannel.id, { onDelete: "cascade" }),
|
|
17256
17368
|
nextSeq: integer2("next_seq").notNull()
|
|
17257
17369
|
});
|
|
17258
17370
|
var communityServerMember = sqliteTable("community_server_member", {
|
|
@@ -17260,7 +17372,6 @@ var communityServerMember = sqliteTable("community_server_member", {
|
|
|
17260
17372
|
serverId: text("server_id").notNull().references(() => communityServer.id, { onDelete: "cascade" }),
|
|
17261
17373
|
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17262
17374
|
role: text("role").default("member"),
|
|
17263
|
-
nickname: text("nickname"),
|
|
17264
17375
|
railOrder: integer2("rail_order").default(0),
|
|
17265
17376
|
joinedAt: text("joined_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17266
17377
|
}, (t) => [
|
|
@@ -17298,21 +17409,21 @@ var communityFriendship = sqliteTable("community_friendship", {
|
|
|
17298
17409
|
requesterId: text("requester_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17299
17410
|
addresseeId: text("addressee_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17300
17411
|
status: text("status").notNull().default("pending"),
|
|
17412
|
+
needsOwnerApproval: text("needs_owner_approval").references(() => user.id),
|
|
17301
17413
|
blockerId: text("blocker_id"),
|
|
17302
17414
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),
|
|
17303
|
-
updatedAt: text("updated_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17415
|
+
updatedAt: text("updated_at").notNull().$defaultFn(() => new Date().toISOString()),
|
|
17416
|
+
resolvedAt: text("resolved_at")
|
|
17304
17417
|
}, (t) => [
|
|
17305
|
-
unique("uq_friendship_requester_addressee").on(t.requesterId, t.addresseeId),
|
|
17306
17418
|
index("idx_friendship_addressee_status").on(t.addresseeId, t.status),
|
|
17307
17419
|
index("idx_friendship_requester_status").on(t.requesterId, t.status)
|
|
17308
17420
|
]);
|
|
17309
17421
|
var communityReadState = sqliteTable("community_read_state", {
|
|
17310
17422
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17311
17423
|
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17312
|
-
channelId: text("channel_id").references(() => communityChannel.id, {
|
|
17424
|
+
channelId: text("channel_id").notNull().references(() => communityChannel.id, {
|
|
17313
17425
|
onDelete: "cascade"
|
|
17314
17426
|
}),
|
|
17315
|
-
dmConversationId: text("dm_conversation_id").references(() => communityDmConversation.id, { onDelete: "cascade" }),
|
|
17316
17427
|
lastReadAt: text("last_read_at").notNull(),
|
|
17317
17428
|
lastReadMessageId: text("last_read_message_id"),
|
|
17318
17429
|
lastReadSeq: integer2("last_read_seq").notNull().default(0)
|
|
@@ -17333,7 +17444,6 @@ var communityAttachment = sqliteTable("community_attachment", {
|
|
|
17333
17444
|
onDelete: "cascade"
|
|
17334
17445
|
}),
|
|
17335
17446
|
uploaderId: text("uploader_id").notNull(),
|
|
17336
|
-
kind: text("kind").notNull(),
|
|
17337
17447
|
targetId: text("target_id").notNull(),
|
|
17338
17448
|
r2Key: text("r2_key").notNull(),
|
|
17339
17449
|
filename: text("filename").notNull(),
|
|
@@ -17425,6 +17535,30 @@ var communityBotActivityEvent = sqliteTable("community_bot_activity_event", {
|
|
|
17425
17535
|
}, (t) => [
|
|
17426
17536
|
index("idx_bot_activity_event_bot_created").on(t.botId, t.createdAt, t.id)
|
|
17427
17537
|
]);
|
|
17538
|
+
var communityBotDailyActivity = sqliteTable("community_bot_daily_activity", {
|
|
17539
|
+
botId: text("bot_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17540
|
+
day: text("day").notNull(),
|
|
17541
|
+
handledCount: integer2("handled_count").notNull().default(0),
|
|
17542
|
+
sentCount: integer2("sent_count").notNull().default(0)
|
|
17543
|
+
}, (t) => [primaryKey({ columns: [t.botId, t.day] })]);
|
|
17544
|
+
var communityMessageMark = sqliteTable("community_message_mark", {
|
|
17545
|
+
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17546
|
+
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17547
|
+
channelId: text("channel_id").notNull().references(() => communityChannel.id, { onDelete: "cascade" }),
|
|
17548
|
+
messageId: text("message_id").notNull().references(() => communityMessage.id, { onDelete: "cascade" }),
|
|
17549
|
+
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17550
|
+
}, (t) => [
|
|
17551
|
+
unique("uq_mark_user_message").on(t.userId, t.messageId),
|
|
17552
|
+
index("idx_mark_user_created").on(t.userId, t.createdAt)
|
|
17553
|
+
]);
|
|
17554
|
+
var communityMessageTag = sqliteTable("community_message_tag", {
|
|
17555
|
+
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17556
|
+
messageId: text("message_id").notNull().references(() => communityMessage.id, { onDelete: "cascade" }),
|
|
17557
|
+
tag: text("tag").notNull()
|
|
17558
|
+
}, (t) => [
|
|
17559
|
+
unique("uq_message_tag").on(t.messageId, t.tag),
|
|
17560
|
+
index("idx_message_tag_tag").on(t.tag, t.messageId)
|
|
17561
|
+
]);
|
|
17428
17562
|
|
|
17429
17563
|
// ../shared/src/logger.ts
|
|
17430
17564
|
var LEVELS = {
|
|
@@ -17506,6 +17640,14 @@ function createLogger(opts) {
|
|
|
17506
17640
|
return new Logger(opts);
|
|
17507
17641
|
}
|
|
17508
17642
|
|
|
17643
|
+
// ../shared/src/db/queries/_chunk.ts
|
|
17644
|
+
var D1_MAX_BIND_PARAMS = 100;
|
|
17645
|
+
function maxRowsPerInsert(paramsPerRow) {
|
|
17646
|
+
if (paramsPerRow < 1)
|
|
17647
|
+
throw new Error("paramsPerRow must be >= 1");
|
|
17648
|
+
return Math.floor(D1_MAX_BIND_PARAMS / paramsPerRow);
|
|
17649
|
+
}
|
|
17650
|
+
|
|
17509
17651
|
// ../shared/src/db/queries/community/message.ts
|
|
17510
17652
|
var log = createLogger({ service: "community-queries" });
|
|
17511
17653
|
var listedMessageProjection = {
|
|
@@ -17516,11 +17658,11 @@ var listedMessageProjection = {
|
|
|
17516
17658
|
mentionType: communityMessage.mentionType,
|
|
17517
17659
|
replyToId: communityMessage.replyToId,
|
|
17518
17660
|
embeds: communityMessage.embeds,
|
|
17519
|
-
flags: communityMessage.flags,
|
|
17520
17661
|
seq: communityMessage.seq,
|
|
17521
17662
|
createdAt: communityMessage.createdAt,
|
|
17522
17663
|
channelId: communityMessage.channelId,
|
|
17523
|
-
|
|
17664
|
+
friendshipId: communityMessage.friendshipId,
|
|
17665
|
+
clientNonce: communityMessage.clientNonce,
|
|
17524
17666
|
authorName: user.name,
|
|
17525
17667
|
authorEmail: user.email,
|
|
17526
17668
|
authorImage: user.image
|
|
@@ -17585,6 +17727,7 @@ var communityBotBinding = sqliteTable("community_bot_binding", {
|
|
|
17585
17727
|
userId: text("user_id").primaryKey().references(() => user.id, { onDelete: "cascade" }),
|
|
17586
17728
|
machineId: text("machine_id").notNull().references(() => communityMachine.id, { onDelete: "restrict" }),
|
|
17587
17729
|
runtime: text("runtime").notNull(),
|
|
17730
|
+
modelName: text("model_name"),
|
|
17588
17731
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17589
17732
|
}, (t) => [index("idx_community_bot_binding_machine").on(t.machineId)]);
|
|
17590
17733
|
var communityAgentRunnerKey = sqliteTable("community_agent_runner_key", {
|
|
@@ -17619,7 +17762,6 @@ var internalUserColumns = {
|
|
|
17619
17762
|
};
|
|
17620
17763
|
|
|
17621
17764
|
// ../shared/src/db/queries/community/channel.ts
|
|
17622
|
-
var log2 = createLogger({ service: "community-queries" });
|
|
17623
17765
|
var CHANNEL_COLUMNS = {
|
|
17624
17766
|
id: communityChannel.id,
|
|
17625
17767
|
serverId: communityChannel.serverId,
|
|
@@ -17628,7 +17770,6 @@ var CHANNEL_COLUMNS = {
|
|
|
17628
17770
|
type: communityChannel.type,
|
|
17629
17771
|
topic: communityChannel.topic,
|
|
17630
17772
|
position: communityChannel.position,
|
|
17631
|
-
forumTags: communityChannel.forumTags,
|
|
17632
17773
|
parentChannelId: communityChannel.parentChannelId,
|
|
17633
17774
|
creatorId: communityChannel.creatorId,
|
|
17634
17775
|
messageCount: communityChannel.messageCount,
|
|
@@ -17638,6 +17779,16 @@ var CHANNEL_COLUMNS = {
|
|
|
17638
17779
|
createdAt: communityChannel.createdAt
|
|
17639
17780
|
};
|
|
17640
17781
|
|
|
17782
|
+
// ../shared/src/db/queries/community/thread.ts
|
|
17783
|
+
var NOTIFY_CONFLICT_TARGET = [
|
|
17784
|
+
communityChannelMember.channelId,
|
|
17785
|
+
communityChannelMember.userId,
|
|
17786
|
+
communityChannelMember.relation
|
|
17787
|
+
];
|
|
17788
|
+
|
|
17789
|
+
// ../shared/src/db/resilience.ts
|
|
17790
|
+
var defaultLogger = createLogger({ service: "d1-resilience" });
|
|
17791
|
+
|
|
17641
17792
|
// ../shared/src/db/queries/community/agent-inbox.ts
|
|
17642
17793
|
var AGENT_MESSAGE_COLUMNS = {
|
|
17643
17794
|
id: communityMessage.id,
|
|
@@ -17645,9 +17796,13 @@ var AGENT_MESSAGE_COLUMNS = {
|
|
|
17645
17796
|
content: communityMessage.content,
|
|
17646
17797
|
createdAt: communityMessage.createdAt,
|
|
17647
17798
|
channelId: communityMessage.channelId,
|
|
17648
|
-
|
|
17649
|
-
|
|
17799
|
+
seq: communityMessage.seq,
|
|
17800
|
+
replyToId: communityMessage.replyToId
|
|
17650
17801
|
};
|
|
17802
|
+
var channelJoinBaselineGuard = sql`${communityMessage.createdAt} > COALESCE(${communityChannelMember.addedAt}, ${communityServerMember.joinedAt}, '')`;
|
|
17803
|
+
|
|
17804
|
+
// ../shared/src/db/queries/community/mention.ts
|
|
17805
|
+
var MENTION_INSERT_MAX_ROWS = maxRowsPerInsert(5);
|
|
17651
17806
|
// ../shared/src/community/bot-activity-presets.ts
|
|
17652
17807
|
var BOT_ACTIVITY_PRESETS = {
|
|
17653
17808
|
idle: { emoji: "\uD83D\uDCA4", text: "Idle" },
|
|
@@ -17662,9 +17817,467 @@ var RUNNING_PRESETS = [
|
|
|
17662
17817
|
{ emoji: "\uD83D\uDE80", text: "On it" },
|
|
17663
17818
|
{ emoji: "\uD83D\uDD25", text: "In the zone" }
|
|
17664
17819
|
];
|
|
17665
|
-
|
|
17666
|
-
|
|
17667
|
-
|
|
17820
|
+
var BOT_ACTIVITY_STATUS_PAIRS = [
|
|
17821
|
+
BOT_ACTIVITY_PRESETS.idle,
|
|
17822
|
+
BOT_ACTIVITY_PRESETS.starting,
|
|
17823
|
+
BOT_ACTIVITY_PRESETS.stopping,
|
|
17824
|
+
...RUNNING_PRESETS
|
|
17825
|
+
];
|
|
17826
|
+
// ../shared/src/community-ws-events.ts
|
|
17827
|
+
var string4 = exports_external.string();
|
|
17828
|
+
var nullableString = string4.nullable();
|
|
17829
|
+
var channelTypeSchema = exports_external.enum(["text", "forum"]);
|
|
17830
|
+
var mentionTypeSchema = exports_external.literal("everyone");
|
|
17831
|
+
var friendApprovalProfileSchema = exports_external.strictObject({
|
|
17832
|
+
id: string4,
|
|
17833
|
+
name: string4,
|
|
17834
|
+
discriminator: string4,
|
|
17835
|
+
image: nullableString
|
|
17836
|
+
});
|
|
17837
|
+
var FriendApprovalPayloadSchema = exports_external.strictObject({
|
|
17838
|
+
friendshipId: string4,
|
|
17839
|
+
status: exports_external.enum(["pending", "approved", "denied", "superseded", "cancelled"]),
|
|
17840
|
+
waitingOn: exports_external.enum(["you", "other-owner", "addressee"]).nullable(),
|
|
17841
|
+
otherProfile: friendApprovalProfileSchema,
|
|
17842
|
+
botProfile: friendApprovalProfileSchema,
|
|
17843
|
+
waitingOnProfile: friendApprovalProfileSchema.nullable().optional()
|
|
17844
|
+
});
|
|
17845
|
+
var messageAttachmentSchema = exports_external.strictObject({
|
|
17846
|
+
id: string4,
|
|
17847
|
+
filename: string4,
|
|
17848
|
+
url: string4,
|
|
17849
|
+
contentType: string4.optional(),
|
|
17850
|
+
size: exports_external.number().optional(),
|
|
17851
|
+
width: exports_external.number().nullable().optional(),
|
|
17852
|
+
height: exports_external.number().nullable().optional()
|
|
17853
|
+
});
|
|
17854
|
+
var messageSchema = exports_external.strictObject({
|
|
17855
|
+
id: string4,
|
|
17856
|
+
seq: exports_external.number(),
|
|
17857
|
+
authorId: string4,
|
|
17858
|
+
authorName: string4,
|
|
17859
|
+
authorAvatar: string4.optional(),
|
|
17860
|
+
content: string4,
|
|
17861
|
+
type: exports_external.enum(["chat", "system"]),
|
|
17862
|
+
systemKind: exports_external.literal("thread").optional(),
|
|
17863
|
+
mentionType: mentionTypeSchema.nullable().optional(),
|
|
17864
|
+
replyToId: nullableString.optional(),
|
|
17865
|
+
replyTo: exports_external.strictObject({
|
|
17866
|
+
id: string4,
|
|
17867
|
+
authorName: string4,
|
|
17868
|
+
text: string4,
|
|
17869
|
+
deleted: exports_external.boolean().optional()
|
|
17870
|
+
}).optional(),
|
|
17871
|
+
embeds: exports_external.array(exports_external.unknown()).optional(),
|
|
17872
|
+
attachments: exports_external.array(messageAttachmentSchema).optional(),
|
|
17873
|
+
createdAt: string4,
|
|
17874
|
+
clientNonce: string4.optional(),
|
|
17875
|
+
approval: FriendApprovalPayloadSchema.optional()
|
|
17876
|
+
});
|
|
17877
|
+
var communityMessageCreateSchema = exports_external.strictObject({
|
|
17878
|
+
type: exports_external.literal("community:message.create"),
|
|
17879
|
+
channelId: string4,
|
|
17880
|
+
serverId: string4.optional(),
|
|
17881
|
+
parentChannelId: string4.optional(),
|
|
17882
|
+
message: messageSchema
|
|
17883
|
+
});
|
|
17884
|
+
var communityMessageUpdatedSchema = exports_external.strictObject({
|
|
17885
|
+
type: exports_external.literal("community:message.updated"),
|
|
17886
|
+
channelId: string4,
|
|
17887
|
+
messageId: string4,
|
|
17888
|
+
approval: FriendApprovalPayloadSchema
|
|
17889
|
+
});
|
|
17890
|
+
var communityMessageEditedSchema = exports_external.strictObject({
|
|
17891
|
+
type: exports_external.literal("community:message.edited"),
|
|
17892
|
+
channelId: string4,
|
|
17893
|
+
messageId: string4,
|
|
17894
|
+
content: string4,
|
|
17895
|
+
parentChannelId: string4.optional(),
|
|
17896
|
+
serverId: string4.optional()
|
|
17897
|
+
}).refine((event) => event.parentChannelId === undefined || event.serverId !== undefined);
|
|
17898
|
+
var communityReactionAddSchema = exports_external.strictObject({
|
|
17899
|
+
type: exports_external.literal("community:reaction.add"),
|
|
17900
|
+
channelId: string4,
|
|
17901
|
+
messageId: string4,
|
|
17902
|
+
userId: string4,
|
|
17903
|
+
emoji: string4
|
|
17904
|
+
});
|
|
17905
|
+
var communityReactionRemoveSchema = exports_external.strictObject({
|
|
17906
|
+
type: exports_external.literal("community:reaction.remove"),
|
|
17907
|
+
channelId: string4,
|
|
17908
|
+
messageId: string4,
|
|
17909
|
+
userId: string4,
|
|
17910
|
+
emoji: string4
|
|
17911
|
+
});
|
|
17912
|
+
var communityPinAddSchema = exports_external.strictObject({
|
|
17913
|
+
type: exports_external.literal("community:pin.add"),
|
|
17914
|
+
channelId: string4,
|
|
17915
|
+
messageId: string4
|
|
17916
|
+
});
|
|
17917
|
+
var communityPinRemoveSchema = exports_external.strictObject({
|
|
17918
|
+
type: exports_external.literal("community:pin.remove"),
|
|
17919
|
+
channelId: string4,
|
|
17920
|
+
messageId: string4
|
|
17921
|
+
});
|
|
17922
|
+
var typingFields = {
|
|
17923
|
+
channelId: string4,
|
|
17924
|
+
userId: string4,
|
|
17925
|
+
name: string4.optional(),
|
|
17926
|
+
discriminator: string4.optional()
|
|
17927
|
+
};
|
|
17928
|
+
var communityTypingStartSchema = exports_external.strictObject({
|
|
17929
|
+
type: exports_external.literal("community:typing.start"),
|
|
17930
|
+
...typingFields
|
|
17931
|
+
});
|
|
17932
|
+
var communityTypingStopSchema = exports_external.strictObject({
|
|
17933
|
+
type: exports_external.literal("community:typing.stop"),
|
|
17934
|
+
...typingFields
|
|
17935
|
+
});
|
|
17936
|
+
var communityChildChannelCreateSchema = exports_external.strictObject({
|
|
17937
|
+
type: exports_external.literal("community:channel.child_create"),
|
|
17938
|
+
parentChannelId: string4,
|
|
17939
|
+
channel: exports_external.strictObject({
|
|
17940
|
+
id: string4,
|
|
17941
|
+
name: string4,
|
|
17942
|
+
type: exports_external.literal("thread"),
|
|
17943
|
+
creatorId: string4.optional(),
|
|
17944
|
+
createdAt: string4
|
|
17945
|
+
}),
|
|
17946
|
+
parentMessageId: string4.optional()
|
|
17947
|
+
});
|
|
17948
|
+
var communityChildChannelUpdateSchema = exports_external.strictObject({
|
|
17949
|
+
type: exports_external.literal("community:channel.child_update"),
|
|
17950
|
+
parentChannelId: string4,
|
|
17951
|
+
channelId: string4,
|
|
17952
|
+
changes: exports_external.strictObject({
|
|
17953
|
+
name: string4.optional(),
|
|
17954
|
+
archived: exports_external.boolean().optional(),
|
|
17955
|
+
tags: exports_external.array(string4).nullable().optional(),
|
|
17956
|
+
lastMessageAt: string4.optional(),
|
|
17957
|
+
messageCount: exports_external.number().optional()
|
|
17958
|
+
})
|
|
17959
|
+
});
|
|
17960
|
+
var communityServerUpdateSchema = exports_external.strictObject({
|
|
17961
|
+
type: exports_external.literal("community:server.update"),
|
|
17962
|
+
serverId: string4,
|
|
17963
|
+
changes: exports_external.strictObject({
|
|
17964
|
+
name: string4.optional(),
|
|
17965
|
+
description: string4.optional(),
|
|
17966
|
+
icon: nullableString.optional()
|
|
17967
|
+
})
|
|
17968
|
+
});
|
|
17969
|
+
var communityServerDeleteSchema = exports_external.strictObject({
|
|
17970
|
+
type: exports_external.literal("community:server.delete"),
|
|
17971
|
+
serverId: string4
|
|
17972
|
+
});
|
|
17973
|
+
var communityChannelCreateSchema = exports_external.strictObject({
|
|
17974
|
+
type: exports_external.literal("community:channel.create"),
|
|
17975
|
+
serverId: string4,
|
|
17976
|
+
channel: exports_external.strictObject({
|
|
17977
|
+
id: string4,
|
|
17978
|
+
name: string4,
|
|
17979
|
+
type: channelTypeSchema,
|
|
17980
|
+
categoryId: nullableString.optional(),
|
|
17981
|
+
topic: string4.optional(),
|
|
17982
|
+
position: exports_external.number(),
|
|
17983
|
+
createdAt: string4
|
|
17984
|
+
})
|
|
17985
|
+
});
|
|
17986
|
+
var communityChannelUpdateSchema = exports_external.strictObject({
|
|
17987
|
+
type: exports_external.literal("community:channel.update"),
|
|
17988
|
+
serverId: string4,
|
|
17989
|
+
channelId: string4,
|
|
17990
|
+
changes: exports_external.strictObject({
|
|
17991
|
+
name: string4.optional(),
|
|
17992
|
+
topic: string4.optional(),
|
|
17993
|
+
categoryId: nullableString.optional(),
|
|
17994
|
+
type: channelTypeSchema.optional()
|
|
17995
|
+
})
|
|
17996
|
+
});
|
|
17997
|
+
var communityChannelDeleteSchema = exports_external.strictObject({
|
|
17998
|
+
type: exports_external.literal("community:channel.delete"),
|
|
17999
|
+
serverId: string4,
|
|
18000
|
+
channelId: string4,
|
|
18001
|
+
parentChannelId: nullableString.optional()
|
|
18002
|
+
});
|
|
18003
|
+
var positionedIdSchema = exports_external.strictObject({ id: string4, position: exports_external.number() });
|
|
18004
|
+
var communityChannelReorderSchema = exports_external.strictObject({
|
|
18005
|
+
type: exports_external.literal("community:channel.reorder"),
|
|
18006
|
+
serverId: string4,
|
|
18007
|
+
channels: exports_external.array(positionedIdSchema)
|
|
18008
|
+
});
|
|
18009
|
+
var communityChannelMemberAddSchema = exports_external.strictObject({
|
|
18010
|
+
type: exports_external.literal("community:channel.member_add"),
|
|
18011
|
+
serverId: string4,
|
|
18012
|
+
channelId: string4,
|
|
18013
|
+
userId: string4
|
|
18014
|
+
});
|
|
18015
|
+
var communityChannelMemberRemoveSchema = exports_external.strictObject({
|
|
18016
|
+
type: exports_external.literal("community:channel.member_remove"),
|
|
18017
|
+
serverId: string4,
|
|
18018
|
+
channelId: string4,
|
|
18019
|
+
userId: string4
|
|
18020
|
+
});
|
|
18021
|
+
var communityCategoryCreateSchema = exports_external.strictObject({
|
|
18022
|
+
type: exports_external.literal("community:category.create"),
|
|
18023
|
+
serverId: string4,
|
|
18024
|
+
category: exports_external.strictObject({
|
|
18025
|
+
id: string4,
|
|
18026
|
+
name: string4,
|
|
18027
|
+
position: exports_external.number(),
|
|
18028
|
+
private: exports_external.boolean()
|
|
18029
|
+
})
|
|
18030
|
+
});
|
|
18031
|
+
var communityCategoryUpdateSchema = exports_external.strictObject({
|
|
18032
|
+
type: exports_external.literal("community:category.update"),
|
|
18033
|
+
serverId: string4,
|
|
18034
|
+
categoryId: string4,
|
|
18035
|
+
changes: exports_external.strictObject({
|
|
18036
|
+
name: string4.optional(),
|
|
18037
|
+
position: exports_external.number().optional(),
|
|
18038
|
+
private: exports_external.boolean().optional()
|
|
18039
|
+
})
|
|
18040
|
+
});
|
|
18041
|
+
var communityCategoryDeleteSchema = exports_external.strictObject({
|
|
18042
|
+
type: exports_external.literal("community:category.delete"),
|
|
18043
|
+
serverId: string4,
|
|
18044
|
+
categoryId: string4
|
|
18045
|
+
});
|
|
18046
|
+
var communityCategoryReorderSchema = exports_external.strictObject({
|
|
18047
|
+
type: exports_external.literal("community:category.reorder"),
|
|
18048
|
+
serverId: string4,
|
|
18049
|
+
categories: exports_external.array(positionedIdSchema)
|
|
18050
|
+
});
|
|
18051
|
+
var communityMemberJoinSchema = exports_external.strictObject({
|
|
18052
|
+
type: exports_external.literal("community:member.join"),
|
|
18053
|
+
serverId: string4,
|
|
18054
|
+
member: exports_external.strictObject({
|
|
18055
|
+
id: string4,
|
|
18056
|
+
userId: string4,
|
|
18057
|
+
name: string4,
|
|
18058
|
+
discriminator: string4,
|
|
18059
|
+
avatar: string4.optional(),
|
|
18060
|
+
role: string4,
|
|
18061
|
+
joinedAt: string4
|
|
18062
|
+
})
|
|
18063
|
+
});
|
|
18064
|
+
var communityMemberLeaveSchema = exports_external.strictObject({
|
|
18065
|
+
type: exports_external.literal("community:member.leave"),
|
|
18066
|
+
serverId: string4,
|
|
18067
|
+
userId: string4
|
|
18068
|
+
});
|
|
18069
|
+
var communityMemberUpdateSchema = exports_external.strictObject({
|
|
18070
|
+
type: exports_external.literal("community:member.update"),
|
|
18071
|
+
serverId: string4,
|
|
18072
|
+
memberId: string4,
|
|
18073
|
+
userId: string4.optional(),
|
|
18074
|
+
changes: exports_external.strictObject({
|
|
18075
|
+
role: string4.optional(),
|
|
18076
|
+
nickname: nullableString.optional()
|
|
18077
|
+
})
|
|
18078
|
+
});
|
|
18079
|
+
var communityFriendRequestSchema = exports_external.strictObject({
|
|
18080
|
+
type: exports_external.literal("community:friend.request"),
|
|
18081
|
+
friendship: exports_external.strictObject({
|
|
18082
|
+
id: string4,
|
|
18083
|
+
requesterId: string4,
|
|
18084
|
+
addresseeId: string4,
|
|
18085
|
+
status: exports_external.literal("pending"),
|
|
18086
|
+
createdAt: string4
|
|
18087
|
+
})
|
|
18088
|
+
});
|
|
18089
|
+
var friendshipIdFields = { friendshipId: string4 };
|
|
18090
|
+
var communityFriendAcceptSchema = exports_external.strictObject({
|
|
18091
|
+
type: exports_external.literal("community:friend.accept"),
|
|
18092
|
+
...friendshipIdFields
|
|
18093
|
+
});
|
|
18094
|
+
var communityFriendRejectSchema = exports_external.strictObject({
|
|
18095
|
+
type: exports_external.literal("community:friend.reject"),
|
|
18096
|
+
...friendshipIdFields
|
|
18097
|
+
});
|
|
18098
|
+
var communityFriendRemoveSchema = exports_external.strictObject({
|
|
18099
|
+
type: exports_external.literal("community:friend.remove"),
|
|
18100
|
+
...friendshipIdFields
|
|
18101
|
+
});
|
|
18102
|
+
var communityFriendBlockSchema = exports_external.strictObject({
|
|
18103
|
+
type: exports_external.literal("community:friend.block"),
|
|
18104
|
+
userId: string4
|
|
18105
|
+
});
|
|
18106
|
+
var communityInviteCreateSchema = exports_external.strictObject({
|
|
18107
|
+
type: exports_external.literal("community:invite.create"),
|
|
18108
|
+
serverId: string4,
|
|
18109
|
+
invite: exports_external.strictObject({
|
|
18110
|
+
id: string4,
|
|
18111
|
+
token: string4,
|
|
18112
|
+
maxUses: exports_external.number().nullable().optional(),
|
|
18113
|
+
uses: exports_external.number().nullable().optional(),
|
|
18114
|
+
expiresAt: nullableString.optional(),
|
|
18115
|
+
createdAt: string4
|
|
18116
|
+
})
|
|
18117
|
+
});
|
|
18118
|
+
var communityMentionCreateSchema = exports_external.strictObject({
|
|
18119
|
+
type: exports_external.literal("community:mention.create"),
|
|
18120
|
+
userId: string4,
|
|
18121
|
+
messageId: string4,
|
|
18122
|
+
channelId: string4.optional(),
|
|
18123
|
+
authorName: string4
|
|
18124
|
+
});
|
|
18125
|
+
var communityUnreadBumpSchema = exports_external.strictObject({
|
|
18126
|
+
type: exports_external.literal("community:unread.bump"),
|
|
18127
|
+
userId: string4,
|
|
18128
|
+
channelId: string4,
|
|
18129
|
+
serverId: string4.optional(),
|
|
18130
|
+
railChannelId: string4.optional(),
|
|
18131
|
+
isMention: exports_external.boolean().optional()
|
|
18132
|
+
});
|
|
18133
|
+
var communityPresenceUpdateSchema = exports_external.strictObject({
|
|
18134
|
+
type: exports_external.literal("community:presence.update"),
|
|
18135
|
+
userId: string4,
|
|
18136
|
+
online: exports_external.boolean()
|
|
18137
|
+
});
|
|
18138
|
+
var communityStatusUpdateSchema = exports_external.strictObject({
|
|
18139
|
+
type: exports_external.literal("community:status.update"),
|
|
18140
|
+
userId: string4,
|
|
18141
|
+
statusEmoji: nullableString,
|
|
18142
|
+
statusText: nullableString
|
|
18143
|
+
});
|
|
18144
|
+
var machineRuntimeSchema = CommunityMachineRuntimeSchema.strict();
|
|
18145
|
+
var CommunityMachineSummarySchema2 = exports_external.strictObject({
|
|
18146
|
+
id: string4,
|
|
18147
|
+
hostname: string4,
|
|
18148
|
+
displayName: string4,
|
|
18149
|
+
platform: string4,
|
|
18150
|
+
arch: string4,
|
|
18151
|
+
osRelease: string4,
|
|
18152
|
+
daemonVersion: string4,
|
|
18153
|
+
lastSeenAt: nullableString,
|
|
18154
|
+
status: exports_external.enum(["online", "offline"]),
|
|
18155
|
+
availableRuntimes: exports_external.array(machineRuntimeSchema),
|
|
18156
|
+
lastRuntimeError: exports_external.strictObject({
|
|
18157
|
+
requested: string4,
|
|
18158
|
+
available: exports_external.array(string4),
|
|
18159
|
+
at: string4
|
|
18160
|
+
}).optional(),
|
|
18161
|
+
createdAt: string4,
|
|
18162
|
+
updatedAt: string4
|
|
18163
|
+
});
|
|
18164
|
+
var communityMachineCreatedSchema = exports_external.strictObject({
|
|
18165
|
+
type: exports_external.literal("community:machine.created"),
|
|
18166
|
+
machine: CommunityMachineSummarySchema2,
|
|
18167
|
+
tokenId: string4
|
|
18168
|
+
});
|
|
18169
|
+
var communityMachineStatusSchema = exports_external.strictObject({
|
|
18170
|
+
type: exports_external.literal("community:machine.status"),
|
|
18171
|
+
machineId: string4,
|
|
18172
|
+
status: exports_external.enum(["online", "offline"]),
|
|
18173
|
+
lastSeenAt: string4
|
|
18174
|
+
});
|
|
18175
|
+
var communityMachineUpdatedSchema = exports_external.strictObject({
|
|
18176
|
+
type: exports_external.literal("community:machine.updated"),
|
|
18177
|
+
machine: CommunityMachineSummarySchema2
|
|
18178
|
+
});
|
|
18179
|
+
var communityMachineRemovedSchema = exports_external.strictObject({
|
|
18180
|
+
type: exports_external.literal("community:machine.removed"),
|
|
18181
|
+
machineId: string4
|
|
18182
|
+
});
|
|
18183
|
+
var communityBotAuditEventSchema = exports_external.strictObject({
|
|
18184
|
+
type: exports_external.literal("community:bot.audit_event"),
|
|
18185
|
+
botId: string4,
|
|
18186
|
+
id: string4,
|
|
18187
|
+
kind: exports_external.enum(["cli_invocation", "tool_call", "thinking", "wake_trigger", "session_reset", "nap", "model_changed", "provider_changed", "error"]),
|
|
18188
|
+
payload: exports_external.unknown(),
|
|
18189
|
+
sessionId: nullableString.optional(),
|
|
18190
|
+
launchId: nullableString.optional(),
|
|
18191
|
+
createdAt: string4
|
|
18192
|
+
}).refine((event) => Object.prototype.hasOwnProperty.call(event, "payload"));
|
|
18193
|
+
var CommunityWsEventDiscriminatedSchema = exports_external.discriminatedUnion("type", [
|
|
18194
|
+
communityMessageCreateSchema,
|
|
18195
|
+
communityMessageUpdatedSchema,
|
|
18196
|
+
communityMessageEditedSchema,
|
|
18197
|
+
communityReactionAddSchema,
|
|
18198
|
+
communityReactionRemoveSchema,
|
|
18199
|
+
communityPinAddSchema,
|
|
18200
|
+
communityPinRemoveSchema,
|
|
18201
|
+
communityTypingStartSchema,
|
|
18202
|
+
communityTypingStopSchema,
|
|
18203
|
+
communityChildChannelCreateSchema,
|
|
18204
|
+
communityChildChannelUpdateSchema,
|
|
18205
|
+
communityServerUpdateSchema,
|
|
18206
|
+
communityServerDeleteSchema,
|
|
18207
|
+
communityChannelCreateSchema,
|
|
18208
|
+
communityChannelUpdateSchema,
|
|
18209
|
+
communityChannelDeleteSchema,
|
|
18210
|
+
communityChannelReorderSchema,
|
|
18211
|
+
communityChannelMemberAddSchema,
|
|
18212
|
+
communityChannelMemberRemoveSchema,
|
|
18213
|
+
communityCategoryCreateSchema,
|
|
18214
|
+
communityCategoryUpdateSchema,
|
|
18215
|
+
communityCategoryDeleteSchema,
|
|
18216
|
+
communityCategoryReorderSchema,
|
|
18217
|
+
communityMemberJoinSchema,
|
|
18218
|
+
communityMemberLeaveSchema,
|
|
18219
|
+
communityMemberUpdateSchema,
|
|
18220
|
+
communityFriendRequestSchema,
|
|
18221
|
+
communityFriendAcceptSchema,
|
|
18222
|
+
communityFriendRejectSchema,
|
|
18223
|
+
communityFriendRemoveSchema,
|
|
18224
|
+
communityFriendBlockSchema,
|
|
18225
|
+
communityInviteCreateSchema,
|
|
18226
|
+
communityMentionCreateSchema,
|
|
18227
|
+
communityUnreadBumpSchema,
|
|
18228
|
+
communityPresenceUpdateSchema,
|
|
18229
|
+
communityStatusUpdateSchema,
|
|
18230
|
+
communityMachineCreatedSchema,
|
|
18231
|
+
communityMachineStatusSchema,
|
|
18232
|
+
communityMachineUpdatedSchema,
|
|
18233
|
+
communityMachineRemovedSchema,
|
|
18234
|
+
communityBotAuditEventSchema
|
|
18235
|
+
]);
|
|
18236
|
+
var CommunityWsEventSchema = CommunityWsEventDiscriminatedSchema.transform((event) => event);
|
|
18237
|
+
var WS_EVENTS = {
|
|
18238
|
+
MESSAGE_CREATE: "community:message.create",
|
|
18239
|
+
MESSAGE_UPDATED: "community:message.updated",
|
|
18240
|
+
MESSAGE_EDITED: "community:message.edited",
|
|
18241
|
+
REACTION_ADD: "community:reaction.add",
|
|
18242
|
+
REACTION_REMOVE: "community:reaction.remove",
|
|
18243
|
+
PIN_ADD: "community:pin.add",
|
|
18244
|
+
PIN_REMOVE: "community:pin.remove",
|
|
18245
|
+
TYPING_START: "community:typing.start",
|
|
18246
|
+
TYPING_STOP: "community:typing.stop",
|
|
18247
|
+
CHILD_CHANNEL_CREATE: "community:channel.child_create",
|
|
18248
|
+
CHILD_CHANNEL_UPDATE: "community:channel.child_update",
|
|
18249
|
+
SERVER_UPDATE: "community:server.update",
|
|
18250
|
+
SERVER_DELETE: "community:server.delete",
|
|
18251
|
+
CHANNEL_CREATE: "community:channel.create",
|
|
18252
|
+
CHANNEL_UPDATE: "community:channel.update",
|
|
18253
|
+
CHANNEL_DELETE: "community:channel.delete",
|
|
18254
|
+
CHANNEL_REORDER: "community:channel.reorder",
|
|
18255
|
+
CHANNEL_MEMBER_ADD: "community:channel.member_add",
|
|
18256
|
+
CHANNEL_MEMBER_REMOVE: "community:channel.member_remove",
|
|
18257
|
+
CATEGORY_CREATE: "community:category.create",
|
|
18258
|
+
CATEGORY_UPDATE: "community:category.update",
|
|
18259
|
+
CATEGORY_DELETE: "community:category.delete",
|
|
18260
|
+
CATEGORY_REORDER: "community:category.reorder",
|
|
18261
|
+
MEMBER_JOIN: "community:member.join",
|
|
18262
|
+
MEMBER_LEAVE: "community:member.leave",
|
|
18263
|
+
MEMBER_UPDATE: "community:member.update",
|
|
18264
|
+
FRIEND_REQUEST: "community:friend.request",
|
|
18265
|
+
FRIEND_ACCEPT: "community:friend.accept",
|
|
18266
|
+
FRIEND_REJECT: "community:friend.reject",
|
|
18267
|
+
FRIEND_REMOVE: "community:friend.remove",
|
|
18268
|
+
FRIEND_BLOCK: "community:friend.block",
|
|
18269
|
+
INVITE_CREATE: "community:invite.create",
|
|
18270
|
+
MENTION_CREATE: "community:mention.create",
|
|
18271
|
+
UNREAD_BUMP: "community:unread.bump",
|
|
18272
|
+
PRESENCE_UPDATE: "community:presence.update",
|
|
18273
|
+
STATUS_UPDATE: "community:status.update",
|
|
18274
|
+
MACHINE_CREATED: "community:machine.created",
|
|
18275
|
+
MACHINE_STATUS: "community:machine.status",
|
|
18276
|
+
MACHINE_UPDATED: "community:machine.updated",
|
|
18277
|
+
MACHINE_REMOVED: "community:machine.removed",
|
|
18278
|
+
BOT_AUDIT_EVENT: "community:bot.audit_event"
|
|
18279
|
+
};
|
|
18280
|
+
var COMMUNITY_EVENT_TYPES = new Set(Object.values(WS_EVENTS));
|
|
17668
18281
|
// ../shared/src/db/index.ts
|
|
17669
18282
|
var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema };
|
|
17670
18283
|
// ../shared/src/db/queries/task.ts
|
|
@@ -17694,13 +18307,8 @@ function toAlookAddress(h) {
|
|
|
17694
18307
|
}
|
|
17695
18308
|
// ../shared/src/db/queries/community/search.ts
|
|
17696
18309
|
var FTS_KEYWORDS = new Set(["and", "or", "not", "near"]);
|
|
17697
|
-
// ../shared/src/db/queries/community/
|
|
17698
|
-
var
|
|
17699
|
-
BOT_ACTIVITY_PRESETS.idle,
|
|
17700
|
-
BOT_ACTIVITY_PRESETS.starting,
|
|
17701
|
-
BOT_ACTIVITY_PRESETS.stopping,
|
|
17702
|
-
...RUNNING_PRESETS
|
|
17703
|
-
];
|
|
18310
|
+
// ../shared/src/db/queries/community/server-folder.ts
|
|
18311
|
+
var FOLDER_ITEM_INSERT_MAX_ROWS = maxRowsPerInsert(3);
|
|
17704
18312
|
// ../shared/src/mode.ts
|
|
17705
18313
|
function isLocalUrl(url2) {
|
|
17706
18314
|
try {
|
|
@@ -17997,10 +18605,10 @@ class Logger2 {
|
|
|
17997
18605
|
function createLogger2(opts) {
|
|
17998
18606
|
return new Logger2(opts);
|
|
17999
18607
|
}
|
|
18000
|
-
var
|
|
18608
|
+
var log2 = createLogger2();
|
|
18001
18609
|
|
|
18002
18610
|
// daemon/kill-tree.ts
|
|
18003
|
-
var
|
|
18611
|
+
var log3 = createLogger2({ module: "kill-tree" });
|
|
18004
18612
|
function killGraceMs() {
|
|
18005
18613
|
return Number(process.env.ALOOK_KILL_GRACE_MS) || 2000;
|
|
18006
18614
|
}
|
|
@@ -18046,7 +18654,7 @@ async function killProcessTree(pid, opts) {
|
|
|
18046
18654
|
await new Promise((r) => setTimeout(r, POLL_MS));
|
|
18047
18655
|
}
|
|
18048
18656
|
if (isAlive(pid)) {
|
|
18049
|
-
|
|
18657
|
+
log3.warn(`pid=${pid} survived SIGTERM after ${graceMs}ms — escalating to SIGKILL`);
|
|
18050
18658
|
signalTree(pid, "SIGKILL");
|
|
18051
18659
|
}
|
|
18052
18660
|
}
|
|
@@ -18301,8 +18909,8 @@ class ClaudeBackend {
|
|
|
18301
18909
|
};
|
|
18302
18910
|
const resultPromise = new Promise((resolve) => {
|
|
18303
18911
|
const stderrChunks = [];
|
|
18304
|
-
proc.stderr?.on("data", (
|
|
18305
|
-
stderrChunks.push(
|
|
18912
|
+
proc.stderr?.on("data", (chunk2) => {
|
|
18913
|
+
stderrChunks.push(chunk2.toString());
|
|
18306
18914
|
});
|
|
18307
18915
|
const rl = createInterface({ input: proc.stdout });
|
|
18308
18916
|
if (useStdinPrompt) {
|
|
@@ -19112,8 +19720,8 @@ class CodexBackend {
|
|
|
19112
19720
|
};
|
|
19113
19721
|
const resultPromise = new Promise((resolve) => {
|
|
19114
19722
|
const stderrChunks = [];
|
|
19115
|
-
proc.stderr?.on("data", (
|
|
19116
|
-
stderrChunks.push(
|
|
19723
|
+
proc.stderr?.on("data", (chunk2) => {
|
|
19724
|
+
stderrChunks.push(chunk2.toString());
|
|
19117
19725
|
});
|
|
19118
19726
|
const rl = createInterface2({ input: proc.stdout });
|
|
19119
19727
|
rl.on("line", (line) => {
|
|
@@ -19509,8 +20117,8 @@ class OpenCodeBackend {
|
|
|
19509
20117
|
};
|
|
19510
20118
|
const resultPromise = new Promise((resolve) => {
|
|
19511
20119
|
const stderrChunks = [];
|
|
19512
|
-
proc.stderr?.on("data", (
|
|
19513
|
-
stderrChunks.push(
|
|
20120
|
+
proc.stderr?.on("data", (chunk2) => {
|
|
20121
|
+
stderrChunks.push(chunk2.toString());
|
|
19514
20122
|
});
|
|
19515
20123
|
const rl = createInterface3({ input: proc.stdout });
|
|
19516
20124
|
rl.on("line", (line) => {
|
|
@@ -20210,7 +20818,7 @@ function releaseLock(lockPath) {
|
|
|
20210
20818
|
}
|
|
20211
20819
|
|
|
20212
20820
|
// daemon/execenv/timeline.ts
|
|
20213
|
-
var
|
|
20821
|
+
var log4 = createLogger2({ module: "timeline" });
|
|
20214
20822
|
function readJsonl(filePath) {
|
|
20215
20823
|
let content;
|
|
20216
20824
|
try {
|
|
@@ -20279,7 +20887,7 @@ async function initEntryAsync(timelineDir, entry) {
|
|
|
20279
20887
|
acquired = acquireLock(lockPath);
|
|
20280
20888
|
}
|
|
20281
20889
|
if (!acquired) {
|
|
20282
|
-
|
|
20890
|
+
log4.debug(`Timeline initEntry: could not acquire lock for ${filename}`);
|
|
20283
20891
|
return;
|
|
20284
20892
|
}
|
|
20285
20893
|
try {
|
|
@@ -20289,7 +20897,7 @@ async function initEntryAsync(timelineDir, entry) {
|
|
|
20289
20897
|
releaseLock(lockPath);
|
|
20290
20898
|
}
|
|
20291
20899
|
} catch (err) {
|
|
20292
|
-
|
|
20900
|
+
log4.debug("Timeline initEntry failed", err);
|
|
20293
20901
|
}
|
|
20294
20902
|
}
|
|
20295
20903
|
function updateEntry(timelineDir, taskId, updater) {
|
|
@@ -20299,7 +20907,7 @@ function updateEntry(timelineDir, taskId, updater) {
|
|
|
20299
20907
|
try {
|
|
20300
20908
|
const acquired = acquireLock(lockPath);
|
|
20301
20909
|
if (!acquired) {
|
|
20302
|
-
|
|
20910
|
+
log4.debug(`Timeline updateEntry: lock held for ${filename}, skipping`);
|
|
20303
20911
|
continue;
|
|
20304
20912
|
}
|
|
20305
20913
|
try {
|
|
@@ -20332,10 +20940,10 @@ function updateEntry(timelineDir, taskId, updater) {
|
|
|
20332
20940
|
releaseLock(lockPath);
|
|
20333
20941
|
}
|
|
20334
20942
|
} catch (err) {
|
|
20335
|
-
|
|
20943
|
+
log4.debug(`Timeline updateEntry failed for ${filename}`, err);
|
|
20336
20944
|
}
|
|
20337
20945
|
}
|
|
20338
|
-
|
|
20946
|
+
log4.debug(`Timeline updateEntry: task_id ${taskId} not found in last 7 days`);
|
|
20339
20947
|
}
|
|
20340
20948
|
function createTimelineEntry(taskId, prompt, type, sessionId, pid, provider, contextKey, detailedLog) {
|
|
20341
20949
|
return {
|
|
@@ -20370,7 +20978,7 @@ function findResumableSessionByContextKey(timelineDir, contextKey, provider) {
|
|
|
20370
20978
|
// daemon/execenv/steering.ts
|
|
20371
20979
|
import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync3, readFileSync as readFileSync3, unlinkSync as unlinkSync2, readdirSync, statSync as statSync2 } from "fs";
|
|
20372
20980
|
import { join as join5 } from "path";
|
|
20373
|
-
var
|
|
20981
|
+
var log5 = createLogger2({ module: "steering" });
|
|
20374
20982
|
var INTENT_DIR_NAME = ".kill_intents";
|
|
20375
20983
|
var INTENT_STALE_MS = 10 * 60 * 1000;
|
|
20376
20984
|
function intentFilePath(baseDir, taskId) {
|
|
@@ -20395,7 +21003,7 @@ function clearKillIntent(baseDir, taskId) {
|
|
|
20395
21003
|
// daemon/steering/mailbox.ts
|
|
20396
21004
|
import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync4, readFileSync as readFileSync4, renameSync as renameSync2, readdirSync as readdirSync2, unlinkSync as unlinkSync3, rmSync, existsSync as existsSync2, watch } from "fs";
|
|
20397
21005
|
import { join as join6 } from "path";
|
|
20398
|
-
var
|
|
21006
|
+
var log6 = createLogger2({ module: "mailbox" });
|
|
20399
21007
|
function inboxDir(baseDir, contextKey) {
|
|
20400
21008
|
const safeKey = contextKey.replace(/[^a-zA-Z0-9_:-]/g, "_");
|
|
20401
21009
|
return join6(baseDir, ".steering", safeKey, "inbox");
|
|
@@ -20477,7 +21085,7 @@ function watchInbox(baseDir, contextKey, onMessage) {
|
|
|
20477
21085
|
scan();
|
|
20478
21086
|
});
|
|
20479
21087
|
} catch {
|
|
20480
|
-
|
|
21088
|
+
log6.debug("fs.watch failed, relying on polling only");
|
|
20481
21089
|
}
|
|
20482
21090
|
const pollTimer = setInterval(scan, 200);
|
|
20483
21091
|
return {
|
|
@@ -21117,7 +21725,7 @@ function buildPrompt(task, attachments) {
|
|
|
21117
21725
|
}
|
|
21118
21726
|
|
|
21119
21727
|
// daemon/session-runner.ts
|
|
21120
|
-
var
|
|
21728
|
+
var log7 = createLogger2({ module: "session-runner" });
|
|
21121
21729
|
var ATTACHMENTS_BASE = tempDir("alook-attachments");
|
|
21122
21730
|
async function writeMarkerFile(workspacesRoot, marker) {
|
|
21123
21731
|
const dir = path.join(workspacesRoot, ".pending_completions");
|
|
@@ -21165,20 +21773,20 @@ async function reportToServer(fn, markerData, workspacesRoot) {
|
|
|
21165
21773
|
} catch (e) {
|
|
21166
21774
|
lastErr = e;
|
|
21167
21775
|
if (isClientError(e)) {
|
|
21168
|
-
|
|
21776
|
+
log7.info(`server report for task ${markerData.taskId}: task already in terminal state (${e})`);
|
|
21169
21777
|
return;
|
|
21170
21778
|
}
|
|
21171
21779
|
if (attempt < RETRY_DELAYS.length && isRetryableError(e)) {
|
|
21172
|
-
|
|
21780
|
+
log7.debug(`server report attempt ${attempt + 1} failed for task ${markerData.taskId}, retrying in ${RETRY_DELAYS[attempt]}ms`);
|
|
21173
21781
|
await new Promise((r) => setTimeout(r, RETRY_DELAYS[attempt]));
|
|
21174
21782
|
}
|
|
21175
21783
|
}
|
|
21176
21784
|
}
|
|
21177
|
-
|
|
21785
|
+
log7.warn(`server report failed for task ${markerData.taskId} after retries, writing marker: ${lastErr}`);
|
|
21178
21786
|
try {
|
|
21179
21787
|
await writeMarkerFile(workspacesRoot, markerData);
|
|
21180
21788
|
} catch (writeErr) {
|
|
21181
|
-
|
|
21789
|
+
log7.error(`marker write also failed for task ${markerData.taskId}: ${writeErr}`);
|
|
21182
21790
|
}
|
|
21183
21791
|
}
|
|
21184
21792
|
function sanitizeFilename(name) {
|
|
@@ -21209,7 +21817,7 @@ async function downloadAttachments(client, token, workspaceId, taskId, attachmen
|
|
|
21209
21817
|
}
|
|
21210
21818
|
async function runSession(input) {
|
|
21211
21819
|
const { task, provider, cliPath, model, serverURL, token, workspacesRoot, agentTimeout, messageInactivityTimeout } = input;
|
|
21212
|
-
|
|
21820
|
+
log7.info(`starting (task=${task.id}, type=${task.type}, agent=${task.agentId}, provider=${provider}, model=${model || "default"})`);
|
|
21213
21821
|
const client = new DaemonClient(serverURL);
|
|
21214
21822
|
const backend = createBackend(provider, cliPath);
|
|
21215
21823
|
const agentBaseDir = path.join(workspacesRoot, task.workspaceId, task.agentId, "workdir");
|
|
@@ -21232,7 +21840,7 @@ async function runSession(input) {
|
|
|
21232
21840
|
try {
|
|
21233
21841
|
await client.reportMessages(token, task.id, batch);
|
|
21234
21842
|
} catch (e) {
|
|
21235
|
-
|
|
21843
|
+
log7.debug("message report failed", e);
|
|
21236
21844
|
}
|
|
21237
21845
|
};
|
|
21238
21846
|
let mailboxWatcher = null;
|
|
@@ -21241,13 +21849,13 @@ async function runSession(input) {
|
|
|
21241
21849
|
if (killed)
|
|
21242
21850
|
return;
|
|
21243
21851
|
killed = true;
|
|
21244
|
-
|
|
21852
|
+
log7.info(`killed by signal (messages=${seq}, tools=${toolCount})`);
|
|
21245
21853
|
if (mailboxWatcher)
|
|
21246
21854
|
mailboxWatcher.stop();
|
|
21247
21855
|
if (stalledRecoveryTimer)
|
|
21248
21856
|
clearInterval(stalledRecoveryTimer);
|
|
21249
21857
|
if (agentPid !== undefined) {
|
|
21250
|
-
|
|
21858
|
+
log7.info(`killing inner agent group (pid=${agentPid})`);
|
|
21251
21859
|
await killProcessTree(agentPid);
|
|
21252
21860
|
}
|
|
21253
21861
|
if (flushTimer)
|
|
@@ -21290,14 +21898,14 @@ async function runSession(input) {
|
|
|
21290
21898
|
const attachmentIds = task.context?.attachment_ids ?? [];
|
|
21291
21899
|
let attachments;
|
|
21292
21900
|
if (attachmentIds.length > 0) {
|
|
21293
|
-
|
|
21901
|
+
log7.info(`downloading ${attachmentIds.length} attachment(s)`);
|
|
21294
21902
|
try {
|
|
21295
21903
|
attachments = await downloadAttachments(client, token, task.workspaceId, task.id, attachmentIds);
|
|
21296
|
-
|
|
21904
|
+
log7.info(`attachments ready (${attachments.length} file(s))`);
|
|
21297
21905
|
} catch (e) {
|
|
21298
21906
|
await cleanupAttachments(task.id);
|
|
21299
21907
|
const errMsg = `failed to download attachments: ${e}`;
|
|
21300
|
-
|
|
21908
|
+
log7.error(errMsg);
|
|
21301
21909
|
updateEntry(timelineDir, task.id, (entry) => {
|
|
21302
21910
|
entry.pid = null;
|
|
21303
21911
|
entry.status = "failed";
|
|
@@ -21314,7 +21922,7 @@ async function runSession(input) {
|
|
|
21314
21922
|
const prompt = input.promptOverride ?? buildPrompt(task, attachments);
|
|
21315
21923
|
const resumeSessionId = task.contextKey ? findResumableSessionByContextKey(timelineDir, task.contextKey, provider) ?? undefined : undefined;
|
|
21316
21924
|
if (resumeSessionId) {
|
|
21317
|
-
|
|
21925
|
+
log7.info(`resuming session ${resumeSessionId} (context_key: ${task.contextKey})`);
|
|
21318
21926
|
}
|
|
21319
21927
|
const session2 = backend.execute(prompt, {
|
|
21320
21928
|
cwd: workDir,
|
|
@@ -21327,14 +21935,14 @@ async function runSession(input) {
|
|
|
21327
21935
|
agentPid = session2.pid;
|
|
21328
21936
|
if (killed) {
|
|
21329
21937
|
if (agentPid !== undefined) {
|
|
21330
|
-
|
|
21938
|
+
log7.info(`kill landed during spawn — reaping inner agent group (pid=${agentPid})`);
|
|
21331
21939
|
await killProcessTree(agentPid);
|
|
21332
21940
|
}
|
|
21333
21941
|
process.exit(1);
|
|
21334
21942
|
}
|
|
21335
21943
|
const earlySessionId = await session2.sessionId;
|
|
21336
|
-
|
|
21337
|
-
|
|
21944
|
+
log7.info(`agent started (pid=${agentPid ?? "unknown"}, session=${earlySessionId})`);
|
|
21945
|
+
log7.info(JSON.stringify({ role: "user", type: "text", content: prompt }));
|
|
21338
21946
|
updateEntry(timelineDir, task.id, (entry) => {
|
|
21339
21947
|
entry.session_id = earlySessionId || null;
|
|
21340
21948
|
if (earlySessionId)
|
|
@@ -21366,7 +21974,7 @@ async function runSession(input) {
|
|
|
21366
21974
|
apmState = recentResult.nextState;
|
|
21367
21975
|
if (event.kind === "error") {
|
|
21368
21976
|
const classified = classifyRuntimeError(event.message);
|
|
21369
|
-
|
|
21977
|
+
log7.info(`steering: error classified as ${classified.errorClass}: ${scrubDiagnosticText(event.message)}`);
|
|
21370
21978
|
const errResult = reduceApmGatedError(apmState, { disableToolBoundaryFlush: true });
|
|
21371
21979
|
apmState = errResult.nextState;
|
|
21372
21980
|
}
|
|
@@ -21474,7 +22082,7 @@ async function runSession(input) {
|
|
|
21474
22082
|
for (const msg of apmState.pendingMessages) {
|
|
21475
22083
|
const sendResult = session2.send(msg, eff.stdinMode);
|
|
21476
22084
|
if (!sendResult.ok) {
|
|
21477
|
-
|
|
22085
|
+
log7.warn("steering: send failed during turn_end flush", { reason: sendResult.reason });
|
|
21478
22086
|
allSent = false;
|
|
21479
22087
|
break;
|
|
21480
22088
|
}
|
|
@@ -21495,7 +22103,7 @@ async function runSession(input) {
|
|
|
21495
22103
|
if (flushedOk || apmState.pendingMessages.length === 0) {
|
|
21496
22104
|
for (const steeredId of pendingSteeredTasks) {
|
|
21497
22105
|
client.completeTask(token, steeredId, { output: "" }).catch((e) => {
|
|
21498
|
-
|
|
22106
|
+
log7.debug(`steering: failed to complete steered task ${steeredId}`, e);
|
|
21499
22107
|
});
|
|
21500
22108
|
}
|
|
21501
22109
|
pendingSteeredTasks.clear();
|
|
@@ -21506,11 +22114,11 @@ async function runSession(input) {
|
|
|
21506
22114
|
}
|
|
21507
22115
|
}
|
|
21508
22116
|
} catch (err) {
|
|
21509
|
-
|
|
22117
|
+
log7.warn("steering: consumeParsedEvents error", { err: err instanceof Error ? err.message : String(err) });
|
|
21510
22118
|
}
|
|
21511
22119
|
};
|
|
21512
22120
|
consumeParsedEvents().catch((err) => {
|
|
21513
|
-
|
|
22121
|
+
log7.error("steering: consumeParsedEvents unhandled error", { err: err instanceof Error ? err.message : String(err) });
|
|
21514
22122
|
});
|
|
21515
22123
|
}
|
|
21516
22124
|
stalledRecoveryTimer = setInterval(() => {
|
|
@@ -21522,7 +22130,7 @@ async function runSession(input) {
|
|
|
21522
22130
|
});
|
|
21523
22131
|
apmState = startupResult.nextState;
|
|
21524
22132
|
if (startupResult.shouldTerminate) {
|
|
21525
|
-
|
|
22133
|
+
log7.warn("steering: startup timeout — no progress events received, killing agent");
|
|
21526
22134
|
if (agentPid !== undefined)
|
|
21527
22135
|
killProcessTree(agentPid);
|
|
21528
22136
|
return;
|
|
@@ -21543,7 +22151,7 @@ async function runSession(input) {
|
|
|
21543
22151
|
});
|
|
21544
22152
|
apmState = stalledResult.nextState;
|
|
21545
22153
|
if (stalledResult.shouldTerminate) {
|
|
21546
|
-
|
|
22154
|
+
log7.warn(`steering: stalled recovery — agent stale for ${(staleForMs / 1000).toFixed(1)}s with ${apmState.pendingMessages.length} pending messages, killing`);
|
|
21547
22155
|
if (agentPid !== undefined)
|
|
21548
22156
|
killProcessTree(agentPid);
|
|
21549
22157
|
}
|
|
@@ -21603,7 +22211,7 @@ async function runSession(input) {
|
|
|
21603
22211
|
if (delivered && message2.taskId) {
|
|
21604
22212
|
pendingSteeredTasks.add(message2.taskId);
|
|
21605
22213
|
client.startTask(token, message2.taskId).catch((e) => {
|
|
21606
|
-
|
|
22214
|
+
log7.debug(`steering: failed to start steered task ${message2.taskId}`, e);
|
|
21607
22215
|
});
|
|
21608
22216
|
}
|
|
21609
22217
|
cleanupInboxFile(agentBaseDir, task.contextKey, seq2);
|
|
@@ -21624,7 +22232,7 @@ async function runSession(input) {
|
|
|
21624
22232
|
]) : next);
|
|
21625
22233
|
if (raceResult === "timeout") {
|
|
21626
22234
|
inactivityTimedOut = true;
|
|
21627
|
-
|
|
22235
|
+
log7.warn(`message inactivity timeout (${INACTIVITY_TIMEOUT_MS / 1000}s) — killing agent`);
|
|
21628
22236
|
if (session2.pid !== undefined) {
|
|
21629
22237
|
await killProcessTree(session2.pid);
|
|
21630
22238
|
}
|
|
@@ -21639,9 +22247,9 @@ async function runSession(input) {
|
|
|
21639
22247
|
if (msg.type === "tool-use")
|
|
21640
22248
|
toolCount++;
|
|
21641
22249
|
if (msg.type === "tool-result" && msg.output && msg.output.length > 500) {
|
|
21642
|
-
|
|
22250
|
+
log7.info(JSON.stringify({ role: "assistant", ...msg, output: msg.output.slice(0, 500) + `... (${msg.output.length} chars)` }));
|
|
21643
22251
|
} else {
|
|
21644
|
-
|
|
22252
|
+
log7.info(JSON.stringify({ role: "assistant", ...msg }));
|
|
21645
22253
|
}
|
|
21646
22254
|
if (msg.type === "status" || msg.type === "log")
|
|
21647
22255
|
continue;
|
|
@@ -21709,18 +22317,18 @@ async function runSession(input) {
|
|
|
21709
22317
|
body.session_id = result.sessionId;
|
|
21710
22318
|
await reportToServer(() => client.completeTask(token, task.id, body), { taskId: task.id, type: "complete", payload: body, token, serverURL, createdAt: new Date().toISOString() }, workspacesRoot);
|
|
21711
22319
|
const dur = (result.durationMs / 1000).toFixed(1);
|
|
21712
|
-
|
|
22320
|
+
log7.info(`completed (duration=${dur}s, messages=${seq}, tools=${toolCount})`);
|
|
21713
22321
|
} else {
|
|
21714
22322
|
const errorMsg = result.error || "agent exited unexpectedly";
|
|
21715
22323
|
await reportToServer(() => client.failTask(token, task.id, errorMsg), { taskId: task.id, type: "fail", payload: { error: errorMsg }, token, serverURL, createdAt: new Date().toISOString() }, workspacesRoot);
|
|
21716
22324
|
const dur = (result.durationMs / 1000).toFixed(1);
|
|
21717
|
-
|
|
22325
|
+
log7.info(`failed (duration=${dur}s, messages=${seq}, tools=${toolCount}) — ${result.error}`);
|
|
21718
22326
|
}
|
|
21719
22327
|
}
|
|
21720
22328
|
async function main() {
|
|
21721
22329
|
const encoded = process.argv[2];
|
|
21722
22330
|
if (!encoded) {
|
|
21723
|
-
|
|
22331
|
+
log7.error("session-runner: missing base64-encoded input argument");
|
|
21724
22332
|
process.exit(1);
|
|
21725
22333
|
}
|
|
21726
22334
|
let input;
|
|
@@ -21728,14 +22336,14 @@ async function main() {
|
|
|
21728
22336
|
const json2 = Buffer.from(encoded, "base64").toString("utf-8");
|
|
21729
22337
|
input = JSON.parse(json2);
|
|
21730
22338
|
} catch (e) {
|
|
21731
|
-
|
|
22339
|
+
log7.error("session-runner: failed to parse input", e);
|
|
21732
22340
|
process.exit(1);
|
|
21733
22341
|
}
|
|
21734
22342
|
const client = new DaemonClient(input.serverURL);
|
|
21735
22343
|
try {
|
|
21736
22344
|
await runSession(input);
|
|
21737
22345
|
} catch (e) {
|
|
21738
|
-
|
|
22346
|
+
log7.error(`session-runner: unhandled error for task ${input.task.id}`, e);
|
|
21739
22347
|
await cleanupAttachments(input.task.id);
|
|
21740
22348
|
const timelineDir = path.join(input.workspacesRoot, input.task.workspaceId, input.task.agentId, "workdir", ".context_timeline").replace(/\\/g, "/");
|
|
21741
22349
|
updateEntry(timelineDir, input.task.id, (entry) => {
|