@alook/cli 0.0.159 → 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 +928 -269
- package/dist/session-runner.js +815 -153
- package/package.json +4 -4
package/dist/session-runner.js
CHANGED
|
@@ -37,6 +37,50 @@ function fillPool(bytes) {
|
|
|
37
37
|
}
|
|
38
38
|
poolOffset += bytes;
|
|
39
39
|
}
|
|
40
|
+
function random(bytes) {
|
|
41
|
+
fillPool(bytes |= 0);
|
|
42
|
+
return pool.subarray(poolOffset - bytes, poolOffset);
|
|
43
|
+
}
|
|
44
|
+
function customRandom(alphabet, defaultSize, getRandom) {
|
|
45
|
+
let safeByteCutoff = 256 - 256 % alphabet.length;
|
|
46
|
+
if (safeByteCutoff === 256) {
|
|
47
|
+
let mask = alphabet.length - 1;
|
|
48
|
+
return (size = defaultSize) => {
|
|
49
|
+
if (!size)
|
|
50
|
+
return "";
|
|
51
|
+
let id = "";
|
|
52
|
+
while (true) {
|
|
53
|
+
let bytes = getRandom(size);
|
|
54
|
+
let i = size;
|
|
55
|
+
while (i--) {
|
|
56
|
+
id += alphabet[bytes[i] & mask];
|
|
57
|
+
if (id.length >= size)
|
|
58
|
+
return id;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
let step = Math.ceil(1.6 * 256 * defaultSize / safeByteCutoff);
|
|
64
|
+
return (size = defaultSize) => {
|
|
65
|
+
if (!size)
|
|
66
|
+
return "";
|
|
67
|
+
let id = "";
|
|
68
|
+
while (true) {
|
|
69
|
+
let bytes = getRandom(step);
|
|
70
|
+
let i = step;
|
|
71
|
+
while (i--) {
|
|
72
|
+
if (bytes[i] < safeByteCutoff) {
|
|
73
|
+
id += alphabet[bytes[i] % alphabet.length];
|
|
74
|
+
if (id.length >= size)
|
|
75
|
+
return id;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function customAlphabet(alphabet, size = 21) {
|
|
82
|
+
return customRandom(alphabet, size, random);
|
|
83
|
+
}
|
|
40
84
|
function nanoid3(size = 21) {
|
|
41
85
|
fillPool(size |= 0);
|
|
42
86
|
let id = "";
|
|
@@ -11599,7 +11643,7 @@ function finalize(ctx, schema) {
|
|
|
11599
11643
|
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
11600
11644
|
} else if (ctx.target === "draft-04") {
|
|
11601
11645
|
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
11602
|
-
} else if (ctx.target === "openapi-3.0") {}
|
|
11646
|
+
} else if (ctx.target === "openapi-3.0") {} else {}
|
|
11603
11647
|
if (ctx.external?.uri) {
|
|
11604
11648
|
const id = ctx.external.registry.get(schema)?.id;
|
|
11605
11649
|
if (!id)
|
|
@@ -11843,7 +11887,7 @@ var literalProcessor = (schema, ctx, json, _params) => {
|
|
|
11843
11887
|
if (val === undefined) {
|
|
11844
11888
|
if (ctx.unrepresentable === "throw") {
|
|
11845
11889
|
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
11846
|
-
}
|
|
11890
|
+
} else {}
|
|
11847
11891
|
} else if (typeof val === "bigint") {
|
|
11848
11892
|
if (ctx.unrepresentable === "throw") {
|
|
11849
11893
|
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
@@ -14411,6 +14455,13 @@ function date4(params) {
|
|
|
14411
14455
|
|
|
14412
14456
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
14413
14457
|
config(en_default());
|
|
14458
|
+
// ../shared/src/utils/slug.ts
|
|
14459
|
+
init_nanoid();
|
|
14460
|
+
var slugId = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz");
|
|
14461
|
+
function sanitizeSlug(input) {
|
|
14462
|
+
return input.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60).replace(/-+$/g, "");
|
|
14463
|
+
}
|
|
14464
|
+
|
|
14414
14465
|
// ../shared/src/lib/community-name.ts
|
|
14415
14466
|
var FORBIDDEN_NAME_CHARS = /[#@\x00-\x1f\x7f-\x9f]/;
|
|
14416
14467
|
function validateCommunityName(name) {
|
|
@@ -14838,11 +14889,11 @@ var UpdateMemberRequestSchema = exports_external.object({
|
|
|
14838
14889
|
});
|
|
14839
14890
|
var CreateWorkspaceRequestSchema = exports_external.object({
|
|
14840
14891
|
name: exports_external.string().min(1, "name is required"),
|
|
14841
|
-
slug: exports_external.string().optional().default("")
|
|
14892
|
+
slug: exports_external.string().optional().default("").transform(sanitizeSlug)
|
|
14842
14893
|
});
|
|
14843
14894
|
var UpdateWorkspaceRequestSchema = exports_external.object({
|
|
14844
14895
|
name: exports_external.string().min(1, "name is required").max(100).trim().optional(),
|
|
14845
|
-
slug: exports_external.string().min(1, "slug is required").
|
|
14896
|
+
slug: exports_external.string().min(1, "slug is required").trim().toLowerCase().transform(sanitizeSlug).optional()
|
|
14846
14897
|
});
|
|
14847
14898
|
var DeleteWorkspaceRequestSchema = exports_external.object({
|
|
14848
14899
|
confirm_name: exports_external.string().min(1, "confirm_name is required")
|
|
@@ -14978,6 +15029,7 @@ var SessionErrorFrameSchema = exports_external.object({
|
|
|
14978
15029
|
type: exports_external.literal("session.error"),
|
|
14979
15030
|
code: exports_external.enum(["runtime_not_available"]),
|
|
14980
15031
|
agentId: exports_external.string().optional(),
|
|
15032
|
+
launchId: exports_external.string().optional(),
|
|
14981
15033
|
payload: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
|
|
14982
15034
|
});
|
|
14983
15035
|
var AgentActivityMessageSchema = exports_external.object({
|
|
@@ -14988,12 +15040,25 @@ var AgentActivityMessageSchema = exports_external.object({
|
|
|
14988
15040
|
var AgentTypingMessageSchema = exports_external.object({
|
|
14989
15041
|
type: exports_external.literal("agent_typing"),
|
|
14990
15042
|
agentId: exports_external.string(),
|
|
14991
|
-
|
|
15043
|
+
channelId: exports_external.string().min(1)
|
|
14992
15044
|
});
|
|
14993
15045
|
var AgentTypingStopMessageSchema = exports_external.object({
|
|
14994
15046
|
type: exports_external.literal("agent_typing_stop"),
|
|
14995
15047
|
agentId: exports_external.string(),
|
|
14996
|
-
|
|
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()
|
|
14997
15062
|
});
|
|
14998
15063
|
var CommunityPairTokenResponseSchema = exports_external.object({
|
|
14999
15064
|
tokenId: exports_external.string(),
|
|
@@ -15030,13 +15095,16 @@ var CommunityBotCreateRequestSchema = exports_external.object({
|
|
|
15030
15095
|
description: exports_external.string().max(COMMUNITY_BOT_DESCRIPTION_MAX).optional(),
|
|
15031
15096
|
machineId: exports_external.string().min(1),
|
|
15032
15097
|
runtime: exports_external.string().min(1),
|
|
15033
|
-
image: BotImageUrlSchema.optional()
|
|
15098
|
+
image: BotImageUrlSchema.optional(),
|
|
15099
|
+
model: exports_external.string().trim().min(1).max(100).nullable().optional()
|
|
15034
15100
|
});
|
|
15035
15101
|
var CommunityBotPatchRequestSchema = exports_external.object({
|
|
15036
15102
|
name: exports_external.string().trim().min(COMMUNITY_BOT_NAME_MIN).max(COMMUNITY_BOT_NAME_MAX).refine(isMentionSafeName, { message: MENTION_SAFE_NAME_MSG }).optional(),
|
|
15037
15103
|
description: exports_external.string().max(COMMUNITY_BOT_DESCRIPTION_MAX).optional(),
|
|
15038
|
-
image: BotImageUrlSchema.nullable().optional()
|
|
15039
|
-
|
|
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), {
|
|
15040
15108
|
message: "at least one field must be provided"
|
|
15041
15109
|
});
|
|
15042
15110
|
var CommunityBotAddToServerRequestSchema = exports_external.object({
|
|
@@ -15053,7 +15121,9 @@ var CommunityAgentSendRequestSchema = exports_external.object({
|
|
|
15053
15121
|
channel: exports_external.string().min(1),
|
|
15054
15122
|
content: CommunityAgentMessageContentSchema,
|
|
15055
15123
|
attachments: exports_external.array(exports_external.string().min(1)).max(MAX_ATTACHMENTS_PER_MESSAGE).default([]),
|
|
15056
|
-
seenUpToSeq: CommunityAgentSeqSchema.optional()
|
|
15124
|
+
seenUpToSeq: CommunityAgentSeqSchema.optional(),
|
|
15125
|
+
replyToSeq: CommunityAgentPositiveSeqSchema.optional(),
|
|
15126
|
+
nonce: exports_external.string().min(1).max(128).optional()
|
|
15057
15127
|
}).refine((d) => d.content.text.trim().length > 0 || d.attachments.length > 0, { message: "message must have text or attachments" });
|
|
15058
15128
|
var CommunityAgentAttachmentUploadResponseSchema = exports_external.object({
|
|
15059
15129
|
id: exports_external.string(),
|
|
@@ -15084,8 +15154,17 @@ var CommunityAgentResolveRequestSchema = exports_external.object({
|
|
|
15084
15154
|
var CommunityAgentListChannelsRequestSchema = exports_external.object({
|
|
15085
15155
|
server: exports_external.string().min(1).optional()
|
|
15086
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" });
|
|
15087
15164
|
var CommunityAgentListMembersRequestSchema = exports_external.object({
|
|
15088
|
-
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()
|
|
15089
15168
|
});
|
|
15090
15169
|
var CommunityAgentChannelMemberRequestSchema = exports_external.object({
|
|
15091
15170
|
channel: exports_external.string().min(1),
|
|
@@ -15094,11 +15173,18 @@ var CommunityAgentChannelMemberRequestSchema = exports_external.object({
|
|
|
15094
15173
|
var CommunityAgentJoinServerRequestSchema = exports_external.object({
|
|
15095
15174
|
invite: exports_external.string().min(1)
|
|
15096
15175
|
});
|
|
15176
|
+
var CommunityAgentNapRequestSchema = exports_external.object({
|
|
15177
|
+
handoff: exports_external.string().trim().min(1)
|
|
15178
|
+
});
|
|
15097
15179
|
var CommunityAgentReactAddRequestSchema = exports_external.object({
|
|
15098
15180
|
channel: exports_external.string().min(1),
|
|
15099
15181
|
seq: CommunityAgentPositiveSeqSchema,
|
|
15100
15182
|
emoji: exports_external.string().min(1)
|
|
15101
15183
|
});
|
|
15184
|
+
var CommunityAgentFriendRequestSchema = exports_external.object({
|
|
15185
|
+
username: exports_external.string().min(1)
|
|
15186
|
+
});
|
|
15187
|
+
var CommunityAgentListFriendsSchema = exports_external.object({});
|
|
15102
15188
|
var AuditLogCliInvocationPayloadSchema = exports_external.object({
|
|
15103
15189
|
subcommand: exports_external.string().min(1)
|
|
15104
15190
|
});
|
|
@@ -15119,20 +15205,47 @@ var AuditLogWakeTriggerPayloadSchema = exports_external.object({
|
|
|
15119
15205
|
senderHandle: exports_external.string().min(1),
|
|
15120
15206
|
reason: exports_external.enum(["unread", "mention"])
|
|
15121
15207
|
});
|
|
15122
|
-
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
|
+
});
|
|
15123
15228
|
var BotAuditEventSchema = exports_external.discriminatedUnion("kind", [
|
|
15124
15229
|
exports_external.object({ kind: exports_external.literal("cli_invocation"), payload: AuditLogCliInvocationPayloadSchema }),
|
|
15125
15230
|
exports_external.object({ kind: exports_external.literal("tool_call"), payload: AuditLogToolCallPayloadSchema }),
|
|
15126
15231
|
exports_external.object({ kind: exports_external.literal("thinking"), payload: AuditLogThinkingPayloadSchema }),
|
|
15127
15232
|
exports_external.object({ kind: exports_external.literal("wake_trigger"), payload: AuditLogWakeTriggerPayloadSchema }),
|
|
15128
|
-
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 })
|
|
15129
15238
|
]);
|
|
15130
15239
|
var BotAuditEventKindSchema = exports_external.enum([
|
|
15131
15240
|
"cli_invocation",
|
|
15132
15241
|
"tool_call",
|
|
15133
15242
|
"thinking",
|
|
15134
15243
|
"wake_trigger",
|
|
15135
|
-
"session_reset"
|
|
15244
|
+
"session_reset",
|
|
15245
|
+
"nap",
|
|
15246
|
+
"model_changed",
|
|
15247
|
+
"provider_changed",
|
|
15248
|
+
"error"
|
|
15136
15249
|
]);
|
|
15137
15250
|
var HostBotAuditEventFrameSchema = exports_external.object({
|
|
15138
15251
|
type: exports_external.literal("bot_audit_event"),
|
|
@@ -15141,7 +15254,71 @@ var HostBotAuditEventFrameSchema = exports_external.object({
|
|
|
15141
15254
|
launchId: exports_external.string().nullable().optional(),
|
|
15142
15255
|
event: BotAuditEventSchema
|
|
15143
15256
|
});
|
|
15144
|
-
//
|
|
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
|
|
15145
15322
|
var entityKind = Symbol.for("drizzle:entityKind");
|
|
15146
15323
|
var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
|
|
15147
15324
|
function is(value, type) {
|
|
@@ -15166,7 +15343,7 @@ function is(value, type) {
|
|
|
15166
15343
|
return false;
|
|
15167
15344
|
}
|
|
15168
15345
|
|
|
15169
|
-
// ../../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
|
|
15170
15347
|
class Column {
|
|
15171
15348
|
constructor(table, config2) {
|
|
15172
15349
|
this.table = table;
|
|
@@ -15216,7 +15393,7 @@ class Column {
|
|
|
15216
15393
|
}
|
|
15217
15394
|
}
|
|
15218
15395
|
|
|
15219
|
-
// ../../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
|
|
15220
15397
|
class ColumnBuilder {
|
|
15221
15398
|
static [entityKind] = "ColumnBuilder";
|
|
15222
15399
|
config;
|
|
@@ -15272,20 +15449,20 @@ class ColumnBuilder {
|
|
|
15272
15449
|
}
|
|
15273
15450
|
}
|
|
15274
15451
|
|
|
15275
|
-
// ../../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
|
|
15276
15453
|
var TableName = Symbol.for("drizzle:Name");
|
|
15277
15454
|
|
|
15278
|
-
// ../../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
|
|
15279
15456
|
function iife(fn, ...args) {
|
|
15280
15457
|
return fn(...args);
|
|
15281
15458
|
}
|
|
15282
15459
|
|
|
15283
|
-
// ../../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
|
|
15284
15461
|
function uniqueKeyName(table, columns) {
|
|
15285
15462
|
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
15286
15463
|
}
|
|
15287
15464
|
|
|
15288
|
-
// ../../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
|
|
15289
15466
|
class PgColumn extends Column {
|
|
15290
15467
|
constructor(table, config2) {
|
|
15291
15468
|
if (!config2.uniqueName) {
|
|
@@ -15334,7 +15511,7 @@ class ExtraConfigColumn extends PgColumn {
|
|
|
15334
15511
|
}
|
|
15335
15512
|
}
|
|
15336
15513
|
|
|
15337
|
-
// ../../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
|
|
15338
15515
|
class PgEnumObjectColumn extends PgColumn {
|
|
15339
15516
|
static [entityKind] = "PgEnumObjectColumn";
|
|
15340
15517
|
enum;
|
|
@@ -15364,7 +15541,7 @@ class PgEnumColumn extends PgColumn {
|
|
|
15364
15541
|
}
|
|
15365
15542
|
}
|
|
15366
15543
|
|
|
15367
|
-
// ../../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
|
|
15368
15545
|
class Subquery {
|
|
15369
15546
|
static [entityKind] = "Subquery";
|
|
15370
15547
|
constructor(sql, fields, alias, isWith = false, usedTables = []) {
|
|
@@ -15379,10 +15556,10 @@ class Subquery {
|
|
|
15379
15556
|
}
|
|
15380
15557
|
}
|
|
15381
15558
|
|
|
15382
|
-
// ../../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
|
|
15383
15560
|
var version2 = "0.45.2";
|
|
15384
15561
|
|
|
15385
|
-
// ../../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
|
|
15386
15563
|
var otel;
|
|
15387
15564
|
var rawTracer;
|
|
15388
15565
|
var tracer = {
|
|
@@ -15409,10 +15586,10 @@ var tracer = {
|
|
|
15409
15586
|
}
|
|
15410
15587
|
};
|
|
15411
15588
|
|
|
15412
|
-
// ../../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
|
|
15413
15590
|
var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
|
|
15414
15591
|
|
|
15415
|
-
// ../../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
|
|
15416
15593
|
var Schema = Symbol.for("drizzle:Schema");
|
|
15417
15594
|
var Columns = Symbol.for("drizzle:Columns");
|
|
15418
15595
|
var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
|
|
@@ -15450,7 +15627,7 @@ class Table {
|
|
|
15450
15627
|
}
|
|
15451
15628
|
}
|
|
15452
15629
|
|
|
15453
|
-
// ../../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
|
|
15454
15631
|
function isSQLWrapper(value) {
|
|
15455
15632
|
return value !== null && value !== undefined && typeof value.getSQL === "function";
|
|
15456
15633
|
}
|
|
@@ -15810,7 +15987,7 @@ Subquery.prototype.getSQL = function() {
|
|
|
15810
15987
|
return new SQL([this]);
|
|
15811
15988
|
};
|
|
15812
15989
|
|
|
15813
|
-
// ../../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
|
|
15814
15991
|
function getColumnNameAndConfig(a, b) {
|
|
15815
15992
|
return {
|
|
15816
15993
|
name: typeof a === "string" && a.length > 0 ? a : "",
|
|
@@ -15823,7 +16000,6 @@ var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder;
|
|
|
15823
16000
|
var exports_community_schema = {};
|
|
15824
16001
|
__export(exports_community_schema, {
|
|
15825
16002
|
communityUserProfile: () => communityUserProfile,
|
|
15826
|
-
communityThreadParticipant: () => communityThreadParticipant,
|
|
15827
16003
|
communityServerMember: () => communityServerMember,
|
|
15828
16004
|
communityServerInvite: () => communityServerInvite,
|
|
15829
16005
|
communityServerFolderItem: () => communityServerFolderItem,
|
|
@@ -15833,21 +16009,23 @@ __export(exports_community_schema, {
|
|
|
15833
16009
|
communityReaction: () => communityReaction,
|
|
15834
16010
|
communityPin: () => communityPin,
|
|
15835
16011
|
communityNotificationSetting: () => communityNotificationSetting,
|
|
16012
|
+
communityMessageTag: () => communityMessageTag,
|
|
15836
16013
|
communityMessageSeq: () => communityMessageSeq,
|
|
16014
|
+
communityMessageMark: () => communityMessageMark,
|
|
15837
16015
|
communityMessage: () => communityMessage,
|
|
15838
16016
|
communityMention: () => communityMention,
|
|
15839
16017
|
communityFriendship: () => communityFriendship,
|
|
15840
|
-
communityDmConversation: () => communityDmConversation,
|
|
15841
16018
|
communityChannelMember: () => communityChannelMember,
|
|
15842
16019
|
communityChannel: () => communityChannel,
|
|
15843
16020
|
communityCategory: () => communityCategory,
|
|
16021
|
+
communityBotDailyActivity: () => communityBotDailyActivity,
|
|
15844
16022
|
communityBotApprovalRequest: () => communityBotApprovalRequest,
|
|
15845
16023
|
communityBotActivityEvent: () => communityBotActivityEvent,
|
|
15846
16024
|
communityAuditLog: () => communityAuditLog,
|
|
15847
16025
|
communityAttachment: () => communityAttachment
|
|
15848
16026
|
});
|
|
15849
16027
|
|
|
15850
|
-
// ../../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
|
|
15851
16029
|
class ForeignKeyBuilder {
|
|
15852
16030
|
static [entityKind] = "SQLiteForeignKeyBuilder";
|
|
15853
16031
|
reference;
|
|
@@ -15915,7 +16093,7 @@ function foreignKey(config2) {
|
|
|
15915
16093
|
return new ForeignKeyBuilder(mappedConfig);
|
|
15916
16094
|
}
|
|
15917
16095
|
|
|
15918
|
-
// ../../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
|
|
15919
16097
|
function uniqueKeyName2(table, columns) {
|
|
15920
16098
|
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
15921
16099
|
}
|
|
@@ -15960,7 +16138,7 @@ class UniqueConstraint {
|
|
|
15960
16138
|
}
|
|
15961
16139
|
}
|
|
15962
16140
|
|
|
15963
|
-
// ../../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
|
|
15964
16142
|
class SQLiteColumnBuilder extends ColumnBuilder {
|
|
15965
16143
|
static [entityKind] = "SQLiteColumnBuilder";
|
|
15966
16144
|
foreignKeyConfigs = [];
|
|
@@ -16011,7 +16189,7 @@ class SQLiteColumn extends Column {
|
|
|
16011
16189
|
static [entityKind] = "SQLiteColumn";
|
|
16012
16190
|
}
|
|
16013
16191
|
|
|
16014
|
-
// ../../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
|
|
16015
16193
|
class SQLiteBigIntBuilder extends SQLiteColumnBuilder {
|
|
16016
16194
|
static [entityKind] = "SQLiteBigIntBuilder";
|
|
16017
16195
|
constructor(name) {
|
|
@@ -16099,7 +16277,7 @@ function blob(a, b) {
|
|
|
16099
16277
|
return new SQLiteBlobBufferBuilder(name);
|
|
16100
16278
|
}
|
|
16101
16279
|
|
|
16102
|
-
// ../../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
|
|
16103
16281
|
class SQLiteCustomColumnBuilder extends SQLiteColumnBuilder {
|
|
16104
16282
|
static [entityKind] = "SQLiteCustomColumnBuilder";
|
|
16105
16283
|
constructor(name, fieldConfig, customTypeParams) {
|
|
@@ -16140,7 +16318,7 @@ function customType(customTypeParams) {
|
|
|
16140
16318
|
};
|
|
16141
16319
|
}
|
|
16142
16320
|
|
|
16143
|
-
// ../../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
|
|
16144
16322
|
class SQLiteBaseIntegerBuilder extends SQLiteColumnBuilder {
|
|
16145
16323
|
static [entityKind] = "SQLiteBaseIntegerBuilder";
|
|
16146
16324
|
constructor(name, dataType, columnType) {
|
|
@@ -16242,7 +16420,7 @@ function integer2(a, b) {
|
|
|
16242
16420
|
return new SQLiteIntegerBuilder(name);
|
|
16243
16421
|
}
|
|
16244
16422
|
|
|
16245
|
-
// ../../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
|
|
16246
16424
|
class SQLiteNumericBuilder extends SQLiteColumnBuilder {
|
|
16247
16425
|
static [entityKind] = "SQLiteNumericBuilder";
|
|
16248
16426
|
constructor(name) {
|
|
@@ -16312,7 +16490,7 @@ function numeric(a, b) {
|
|
|
16312
16490
|
return mode === "number" ? new SQLiteNumericNumberBuilder(name) : mode === "bigint" ? new SQLiteNumericBigIntBuilder(name) : new SQLiteNumericBuilder(name);
|
|
16313
16491
|
}
|
|
16314
16492
|
|
|
16315
|
-
// ../../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
|
|
16316
16494
|
class SQLiteRealBuilder extends SQLiteColumnBuilder {
|
|
16317
16495
|
static [entityKind] = "SQLiteRealBuilder";
|
|
16318
16496
|
constructor(name) {
|
|
@@ -16333,7 +16511,7 @@ function real(name) {
|
|
|
16333
16511
|
return new SQLiteRealBuilder(name ?? "");
|
|
16334
16512
|
}
|
|
16335
16513
|
|
|
16336
|
-
// ../../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
|
|
16337
16515
|
class SQLiteTextBuilder extends SQLiteColumnBuilder {
|
|
16338
16516
|
static [entityKind] = "SQLiteTextBuilder";
|
|
16339
16517
|
constructor(name, config2) {
|
|
@@ -16388,7 +16566,7 @@ function text(a, b = {}) {
|
|
|
16388
16566
|
return new SQLiteTextBuilder(name, config2);
|
|
16389
16567
|
}
|
|
16390
16568
|
|
|
16391
|
-
// ../../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
|
|
16392
16570
|
function getSQLiteColumnBuilders() {
|
|
16393
16571
|
return {
|
|
16394
16572
|
blob,
|
|
@@ -16400,7 +16578,7 @@ function getSQLiteColumnBuilders() {
|
|
|
16400
16578
|
};
|
|
16401
16579
|
}
|
|
16402
16580
|
|
|
16403
|
-
// ../../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
|
|
16404
16582
|
var InlineForeignKeys = Symbol.for("drizzle:SQLiteInlineForeignKeys");
|
|
16405
16583
|
|
|
16406
16584
|
class SQLiteTable extends Table {
|
|
@@ -16434,7 +16612,7 @@ var sqliteTable = (name, columns, extraConfig) => {
|
|
|
16434
16612
|
return sqliteTableBase(name, columns, extraConfig);
|
|
16435
16613
|
};
|
|
16436
16614
|
|
|
16437
|
-
// ../../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
|
|
16438
16616
|
class IndexBuilderOn {
|
|
16439
16617
|
constructor(name, unique2) {
|
|
16440
16618
|
this.name = name;
|
|
@@ -16480,7 +16658,7 @@ function uniqueIndex(name) {
|
|
|
16480
16658
|
return new IndexBuilderOn(name, true);
|
|
16481
16659
|
}
|
|
16482
16660
|
|
|
16483
|
-
// ../../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
|
|
16484
16662
|
function primaryKey(...config2) {
|
|
16485
16663
|
if (config2[0].columns) {
|
|
16486
16664
|
return new PrimaryKeyBuilder(config2[0].columns, config2[0].name);
|
|
@@ -16568,7 +16746,8 @@ var user = sqliteTable("user", {
|
|
|
16568
16746
|
isBot: integer2("isBot", { mode: "boolean" }).notNull().default(false),
|
|
16569
16747
|
ownerUserId: text("ownerUserId").references(() => user.id, { onDelete: "no action" }),
|
|
16570
16748
|
deletedAt: text("deletedAt"),
|
|
16571
|
-
discriminator: text("discriminator").notNull().default("0000")
|
|
16749
|
+
discriminator: text("discriminator").notNull().default("0000"),
|
|
16750
|
+
lastRefreshContextAt: text("lastRefreshContextAt")
|
|
16572
16751
|
}, (t) => [index("idx_user_ownerUserId_isBot").on(t.ownerUserId, t.isBot)]);
|
|
16573
16752
|
var session = sqliteTable("session", {
|
|
16574
16753
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
@@ -17110,11 +17289,14 @@ var inboxUnread = sqliteTable("inbox_unread", {
|
|
|
17110
17289
|
var communityServer = sqliteTable("community_server", {
|
|
17111
17290
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17112
17291
|
name: text("name").notNull(),
|
|
17292
|
+
discriminator: text("discriminator").notNull().default("0000"),
|
|
17113
17293
|
description: text("description").default(""),
|
|
17114
17294
|
icon: text("icon"),
|
|
17115
17295
|
ownerId: text("owner_id").notNull().references(() => user.id, { onDelete: "restrict" }),
|
|
17116
17296
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17117
|
-
})
|
|
17297
|
+
}, (t) => [
|
|
17298
|
+
uniqueIndex("idx_community_server_name_discriminator").on(t.name, t.discriminator)
|
|
17299
|
+
]);
|
|
17118
17300
|
var communityCategory = sqliteTable("community_category", {
|
|
17119
17301
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17120
17302
|
serverId: text("server_id").notNull().references(() => communityServer.id, { onDelete: "cascade" }),
|
|
@@ -17125,15 +17307,16 @@ var communityCategory = sqliteTable("community_category", {
|
|
|
17125
17307
|
}, (t) => [unique("uq_category_server_name").on(t.serverId, t.name)]);
|
|
17126
17308
|
var communityChannel = sqliteTable("community_channel", {
|
|
17127
17309
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17128
|
-
serverId: text("server_id").
|
|
17310
|
+
serverId: text("server_id").references(() => communityServer.id, {
|
|
17311
|
+
onDelete: "cascade"
|
|
17312
|
+
}),
|
|
17129
17313
|
categoryId: text("category_id").references(() => communityCategory.id, {
|
|
17130
17314
|
onDelete: "set null"
|
|
17131
17315
|
}),
|
|
17132
|
-
name: text("name")
|
|
17316
|
+
name: text("name"),
|
|
17133
17317
|
type: text("type").notNull().default("text"),
|
|
17134
17318
|
topic: text("topic").default(""),
|
|
17135
17319
|
position: integer2("position").default(0),
|
|
17136
|
-
forumTags: text("forum_tags"),
|
|
17137
17320
|
parentChannelId: text("parent_channel_id").references(() => communityChannel.id, {
|
|
17138
17321
|
onDelete: "cascade"
|
|
17139
17322
|
}),
|
|
@@ -17146,39 +17329,21 @@ var communityChannel = sqliteTable("community_channel", {
|
|
|
17146
17329
|
}, (t) => [
|
|
17147
17330
|
index("idx_channel_server_position").on(t.serverId, t.position),
|
|
17148
17331
|
index("idx_channel_server_last_message").on(t.serverId, t.lastMessageAt),
|
|
17149
|
-
index("idx_channel_parent").on(t.parentChannelId)
|
|
17332
|
+
index("idx_channel_parent").on(t.parentChannelId),
|
|
17333
|
+
uniqueIndex("idx_channel_server_name").on(t.serverId, t.name).where(sql`parent_channel_id IS NULL`)
|
|
17150
17334
|
]);
|
|
17151
17335
|
var communityChannelMember = sqliteTable("community_channel_member", {
|
|
17152
17336
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17153
17337
|
channelId: text("channel_id").notNull().references(() => communityChannel.id, { onDelete: "cascade" }),
|
|
17154
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"),
|
|
17155
17341
|
addedBy: text("added_by").references(() => user.id, { onDelete: "set null" }),
|
|
17156
17342
|
addedAt: text("added_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17157
17343
|
}, (t) => [
|
|
17158
|
-
unique("uq_channel_member").on(t.channelId, t.userId),
|
|
17344
|
+
unique("uq_channel_member").on(t.channelId, t.userId, t.relation),
|
|
17159
17345
|
index("idx_channel_member_user").on(t.userId)
|
|
17160
17346
|
]);
|
|
17161
|
-
var communityThreadParticipant = sqliteTable("community_thread_participant", {
|
|
17162
|
-
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17163
|
-
threadChannelId: text("thread_channel_id").notNull().references(() => communityChannel.id, { onDelete: "cascade" }),
|
|
17164
|
-
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17165
|
-
source: text("source").notNull().default("mention"),
|
|
17166
|
-
addedAt: text("added_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17167
|
-
}, (t) => [
|
|
17168
|
-
unique("uq_thread_participant").on(t.threadChannelId, t.userId),
|
|
17169
|
-
index("idx_thread_participant_user").on(t.userId)
|
|
17170
|
-
]);
|
|
17171
|
-
var communityDmConversation = sqliteTable("community_dm_conversation", {
|
|
17172
|
-
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17173
|
-
user1Id: text("user1_id").references(() => user.id, { onDelete: "set null" }),
|
|
17174
|
-
user2Id: text("user2_id").references(() => user.id, { onDelete: "set null" }),
|
|
17175
|
-
lastMessageAt: text("last_message_at"),
|
|
17176
|
-
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17177
|
-
}, (t) => [
|
|
17178
|
-
unique("uq_dm_conversation_users").on(t.user1Id, t.user2Id),
|
|
17179
|
-
index("idx_dm_conversation_user1_last_message").on(t.user1Id, t.lastMessageAt),
|
|
17180
|
-
index("idx_dm_conversation_user2_last_message").on(t.user2Id, t.lastMessageAt)
|
|
17181
|
-
]);
|
|
17182
17347
|
var communityMessage = sqliteTable("community_message", {
|
|
17183
17348
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17184
17349
|
authorId: text("author_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
@@ -17187,20 +17352,19 @@ var communityMessage = sqliteTable("community_message", {
|
|
|
17187
17352
|
mentionType: text("mention_type"),
|
|
17188
17353
|
replyToId: text("reply_to_id"),
|
|
17189
17354
|
embeds: text("embeds"),
|
|
17190
|
-
flags: integer2("flags").default(0),
|
|
17191
17355
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),
|
|
17192
|
-
channelId: text("channel_id").references(() => communityChannel.id, {
|
|
17356
|
+
channelId: text("channel_id").notNull().references(() => communityChannel.id, {
|
|
17193
17357
|
onDelete: "cascade"
|
|
17194
17358
|
}),
|
|
17195
|
-
|
|
17196
|
-
|
|
17359
|
+
seq: integer2("seq").notNull().default(0),
|
|
17360
|
+
friendshipId: text("friendship_id").references(() => communityFriendship.id, { onDelete: "set null" }),
|
|
17361
|
+
clientNonce: text("client_nonce")
|
|
17197
17362
|
}, (t) => [
|
|
17198
17363
|
index("idx_message_channel_created").on(t.channelId, t.createdAt),
|
|
17199
|
-
index("idx_message_channel_mention_created").on(t.channelId, t.mentionType, t.createdAt)
|
|
17200
|
-
index("idx_message_dm_created").on(t.dmConversationId, t.createdAt)
|
|
17364
|
+
index("idx_message_channel_mention_created").on(t.channelId, t.mentionType, t.createdAt)
|
|
17201
17365
|
]);
|
|
17202
17366
|
var communityMessageSeq = sqliteTable("community_message_seq", {
|
|
17203
|
-
|
|
17367
|
+
channelId: text("channel_id").primaryKey().references(() => communityChannel.id, { onDelete: "cascade" }),
|
|
17204
17368
|
nextSeq: integer2("next_seq").notNull()
|
|
17205
17369
|
});
|
|
17206
17370
|
var communityServerMember = sqliteTable("community_server_member", {
|
|
@@ -17208,13 +17372,13 @@ var communityServerMember = sqliteTable("community_server_member", {
|
|
|
17208
17372
|
serverId: text("server_id").notNull().references(() => communityServer.id, { onDelete: "cascade" }),
|
|
17209
17373
|
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17210
17374
|
role: text("role").default("member"),
|
|
17211
|
-
nickname: text("nickname"),
|
|
17212
17375
|
railOrder: integer2("rail_order").default(0),
|
|
17213
17376
|
joinedAt: text("joined_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17214
17377
|
}, (t) => [
|
|
17215
17378
|
unique("uq_server_member_server_user").on(t.serverId, t.userId),
|
|
17216
17379
|
index("idx_server_member_user").on(t.userId),
|
|
17217
|
-
index("idx_server_member_user_rail_order").on(t.userId, t.railOrder)
|
|
17380
|
+
index("idx_server_member_user_rail_order").on(t.userId, t.railOrder),
|
|
17381
|
+
index("idx_server_member_server_joined").on(t.serverId, t.joinedAt)
|
|
17218
17382
|
]);
|
|
17219
17383
|
var communityServerFolder = sqliteTable("community_server_folder", {
|
|
17220
17384
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
@@ -17239,27 +17403,27 @@ var communityServerInvite = sqliteTable("community_server_invite", {
|
|
|
17239
17403
|
uses: integer2("uses").default(0),
|
|
17240
17404
|
expiresAt: text("expires_at"),
|
|
17241
17405
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17242
|
-
});
|
|
17406
|
+
}, (t) => [index("idx_server_invite_server").on(t.serverId)]);
|
|
17243
17407
|
var communityFriendship = sqliteTable("community_friendship", {
|
|
17244
17408
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17245
17409
|
requesterId: text("requester_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17246
17410
|
addresseeId: text("addressee_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17247
17411
|
status: text("status").notNull().default("pending"),
|
|
17412
|
+
needsOwnerApproval: text("needs_owner_approval").references(() => user.id),
|
|
17248
17413
|
blockerId: text("blocker_id"),
|
|
17249
17414
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),
|
|
17250
|
-
updatedAt: text("updated_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17415
|
+
updatedAt: text("updated_at").notNull().$defaultFn(() => new Date().toISOString()),
|
|
17416
|
+
resolvedAt: text("resolved_at")
|
|
17251
17417
|
}, (t) => [
|
|
17252
|
-
unique("uq_friendship_requester_addressee").on(t.requesterId, t.addresseeId),
|
|
17253
17418
|
index("idx_friendship_addressee_status").on(t.addresseeId, t.status),
|
|
17254
17419
|
index("idx_friendship_requester_status").on(t.requesterId, t.status)
|
|
17255
17420
|
]);
|
|
17256
17421
|
var communityReadState = sqliteTable("community_read_state", {
|
|
17257
17422
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17258
17423
|
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17259
|
-
channelId: text("channel_id").references(() => communityChannel.id, {
|
|
17424
|
+
channelId: text("channel_id").notNull().references(() => communityChannel.id, {
|
|
17260
17425
|
onDelete: "cascade"
|
|
17261
17426
|
}),
|
|
17262
|
-
dmConversationId: text("dm_conversation_id").references(() => communityDmConversation.id, { onDelete: "cascade" }),
|
|
17263
17427
|
lastReadAt: text("last_read_at").notNull(),
|
|
17264
17428
|
lastReadMessageId: text("last_read_message_id"),
|
|
17265
17429
|
lastReadSeq: integer2("last_read_seq").notNull().default(0)
|
|
@@ -17280,7 +17444,6 @@ var communityAttachment = sqliteTable("community_attachment", {
|
|
|
17280
17444
|
onDelete: "cascade"
|
|
17281
17445
|
}),
|
|
17282
17446
|
uploaderId: text("uploader_id").notNull(),
|
|
17283
|
-
kind: text("kind").notNull(),
|
|
17284
17447
|
targetId: text("target_id").notNull(),
|
|
17285
17448
|
r2Key: text("r2_key").notNull(),
|
|
17286
17449
|
filename: text("filename").notNull(),
|
|
@@ -17372,6 +17535,30 @@ var communityBotActivityEvent = sqliteTable("community_bot_activity_event", {
|
|
|
17372
17535
|
}, (t) => [
|
|
17373
17536
|
index("idx_bot_activity_event_bot_created").on(t.botId, t.createdAt, t.id)
|
|
17374
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
|
+
]);
|
|
17375
17562
|
|
|
17376
17563
|
// ../shared/src/logger.ts
|
|
17377
17564
|
var LEVELS = {
|
|
@@ -17453,6 +17640,14 @@ function createLogger(opts) {
|
|
|
17453
17640
|
return new Logger(opts);
|
|
17454
17641
|
}
|
|
17455
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
|
+
|
|
17456
17651
|
// ../shared/src/db/queries/community/message.ts
|
|
17457
17652
|
var log = createLogger({ service: "community-queries" });
|
|
17458
17653
|
var listedMessageProjection = {
|
|
@@ -17463,10 +17658,11 @@ var listedMessageProjection = {
|
|
|
17463
17658
|
mentionType: communityMessage.mentionType,
|
|
17464
17659
|
replyToId: communityMessage.replyToId,
|
|
17465
17660
|
embeds: communityMessage.embeds,
|
|
17466
|
-
|
|
17661
|
+
seq: communityMessage.seq,
|
|
17467
17662
|
createdAt: communityMessage.createdAt,
|
|
17468
17663
|
channelId: communityMessage.channelId,
|
|
17469
|
-
|
|
17664
|
+
friendshipId: communityMessage.friendshipId,
|
|
17665
|
+
clientNonce: communityMessage.clientNonce,
|
|
17470
17666
|
authorName: user.name,
|
|
17471
17667
|
authorEmail: user.email,
|
|
17472
17668
|
authorImage: user.image
|
|
@@ -17531,6 +17727,7 @@ var communityBotBinding = sqliteTable("community_bot_binding", {
|
|
|
17531
17727
|
userId: text("user_id").primaryKey().references(() => user.id, { onDelete: "cascade" }),
|
|
17532
17728
|
machineId: text("machine_id").notNull().references(() => communityMachine.id, { onDelete: "restrict" }),
|
|
17533
17729
|
runtime: text("runtime").notNull(),
|
|
17730
|
+
modelName: text("model_name"),
|
|
17534
17731
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17535
17732
|
}, (t) => [index("idx_community_bot_binding_machine").on(t.machineId)]);
|
|
17536
17733
|
var communityAgentRunnerKey = sqliteTable("community_agent_runner_key", {
|
|
@@ -17565,7 +17762,6 @@ var internalUserColumns = {
|
|
|
17565
17762
|
};
|
|
17566
17763
|
|
|
17567
17764
|
// ../shared/src/db/queries/community/channel.ts
|
|
17568
|
-
var log2 = createLogger({ service: "community-queries" });
|
|
17569
17765
|
var CHANNEL_COLUMNS = {
|
|
17570
17766
|
id: communityChannel.id,
|
|
17571
17767
|
serverId: communityChannel.serverId,
|
|
@@ -17574,7 +17770,6 @@ var CHANNEL_COLUMNS = {
|
|
|
17574
17770
|
type: communityChannel.type,
|
|
17575
17771
|
topic: communityChannel.topic,
|
|
17576
17772
|
position: communityChannel.position,
|
|
17577
|
-
forumTags: communityChannel.forumTags,
|
|
17578
17773
|
parentChannelId: communityChannel.parentChannelId,
|
|
17579
17774
|
creatorId: communityChannel.creatorId,
|
|
17580
17775
|
messageCount: communityChannel.messageCount,
|
|
@@ -17584,6 +17779,16 @@ var CHANNEL_COLUMNS = {
|
|
|
17584
17779
|
createdAt: communityChannel.createdAt
|
|
17585
17780
|
};
|
|
17586
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
|
+
|
|
17587
17792
|
// ../shared/src/db/queries/community/agent-inbox.ts
|
|
17588
17793
|
var AGENT_MESSAGE_COLUMNS = {
|
|
17589
17794
|
id: communityMessage.id,
|
|
@@ -17591,9 +17796,13 @@ var AGENT_MESSAGE_COLUMNS = {
|
|
|
17591
17796
|
content: communityMessage.content,
|
|
17592
17797
|
createdAt: communityMessage.createdAt,
|
|
17593
17798
|
channelId: communityMessage.channelId,
|
|
17594
|
-
|
|
17595
|
-
|
|
17799
|
+
seq: communityMessage.seq,
|
|
17800
|
+
replyToId: communityMessage.replyToId
|
|
17596
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);
|
|
17597
17806
|
// ../shared/src/community/bot-activity-presets.ts
|
|
17598
17807
|
var BOT_ACTIVITY_PRESETS = {
|
|
17599
17808
|
idle: { emoji: "\uD83D\uDCA4", text: "Idle" },
|
|
@@ -17608,9 +17817,467 @@ var RUNNING_PRESETS = [
|
|
|
17608
17817
|
{ emoji: "\uD83D\uDE80", text: "On it" },
|
|
17609
17818
|
{ emoji: "\uD83D\uDD25", text: "In the zone" }
|
|
17610
17819
|
];
|
|
17611
|
-
|
|
17612
|
-
|
|
17613
|
-
|
|
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));
|
|
17614
18281
|
// ../shared/src/db/index.ts
|
|
17615
18282
|
var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema };
|
|
17616
18283
|
// ../shared/src/db/queries/task.ts
|
|
@@ -17640,13 +18307,8 @@ function toAlookAddress(h) {
|
|
|
17640
18307
|
}
|
|
17641
18308
|
// ../shared/src/db/queries/community/search.ts
|
|
17642
18309
|
var FTS_KEYWORDS = new Set(["and", "or", "not", "near"]);
|
|
17643
|
-
// ../shared/src/db/queries/community/
|
|
17644
|
-
var
|
|
17645
|
-
BOT_ACTIVITY_PRESETS.idle,
|
|
17646
|
-
BOT_ACTIVITY_PRESETS.starting,
|
|
17647
|
-
BOT_ACTIVITY_PRESETS.stopping,
|
|
17648
|
-
...RUNNING_PRESETS
|
|
17649
|
-
];
|
|
18310
|
+
// ../shared/src/db/queries/community/server-folder.ts
|
|
18311
|
+
var FOLDER_ITEM_INSERT_MAX_ROWS = maxRowsPerInsert(3);
|
|
17650
18312
|
// ../shared/src/mode.ts
|
|
17651
18313
|
function isLocalUrl(url2) {
|
|
17652
18314
|
try {
|
|
@@ -17943,10 +18605,10 @@ class Logger2 {
|
|
|
17943
18605
|
function createLogger2(opts) {
|
|
17944
18606
|
return new Logger2(opts);
|
|
17945
18607
|
}
|
|
17946
|
-
var
|
|
18608
|
+
var log2 = createLogger2();
|
|
17947
18609
|
|
|
17948
18610
|
// daemon/kill-tree.ts
|
|
17949
|
-
var
|
|
18611
|
+
var log3 = createLogger2({ module: "kill-tree" });
|
|
17950
18612
|
function killGraceMs() {
|
|
17951
18613
|
return Number(process.env.ALOOK_KILL_GRACE_MS) || 2000;
|
|
17952
18614
|
}
|
|
@@ -17992,7 +18654,7 @@ async function killProcessTree(pid, opts) {
|
|
|
17992
18654
|
await new Promise((r) => setTimeout(r, POLL_MS));
|
|
17993
18655
|
}
|
|
17994
18656
|
if (isAlive(pid)) {
|
|
17995
|
-
|
|
18657
|
+
log3.warn(`pid=${pid} survived SIGTERM after ${graceMs}ms — escalating to SIGKILL`);
|
|
17996
18658
|
signalTree(pid, "SIGKILL");
|
|
17997
18659
|
}
|
|
17998
18660
|
}
|
|
@@ -18247,8 +18909,8 @@ class ClaudeBackend {
|
|
|
18247
18909
|
};
|
|
18248
18910
|
const resultPromise = new Promise((resolve) => {
|
|
18249
18911
|
const stderrChunks = [];
|
|
18250
|
-
proc.stderr?.on("data", (
|
|
18251
|
-
stderrChunks.push(
|
|
18912
|
+
proc.stderr?.on("data", (chunk2) => {
|
|
18913
|
+
stderrChunks.push(chunk2.toString());
|
|
18252
18914
|
});
|
|
18253
18915
|
const rl = createInterface({ input: proc.stdout });
|
|
18254
18916
|
if (useStdinPrompt) {
|
|
@@ -19058,8 +19720,8 @@ class CodexBackend {
|
|
|
19058
19720
|
};
|
|
19059
19721
|
const resultPromise = new Promise((resolve) => {
|
|
19060
19722
|
const stderrChunks = [];
|
|
19061
|
-
proc.stderr?.on("data", (
|
|
19062
|
-
stderrChunks.push(
|
|
19723
|
+
proc.stderr?.on("data", (chunk2) => {
|
|
19724
|
+
stderrChunks.push(chunk2.toString());
|
|
19063
19725
|
});
|
|
19064
19726
|
const rl = createInterface2({ input: proc.stdout });
|
|
19065
19727
|
rl.on("line", (line) => {
|
|
@@ -19455,8 +20117,8 @@ class OpenCodeBackend {
|
|
|
19455
20117
|
};
|
|
19456
20118
|
const resultPromise = new Promise((resolve) => {
|
|
19457
20119
|
const stderrChunks = [];
|
|
19458
|
-
proc.stderr?.on("data", (
|
|
19459
|
-
stderrChunks.push(
|
|
20120
|
+
proc.stderr?.on("data", (chunk2) => {
|
|
20121
|
+
stderrChunks.push(chunk2.toString());
|
|
19460
20122
|
});
|
|
19461
20123
|
const rl = createInterface3({ input: proc.stdout });
|
|
19462
20124
|
rl.on("line", (line) => {
|
|
@@ -20156,7 +20818,7 @@ function releaseLock(lockPath) {
|
|
|
20156
20818
|
}
|
|
20157
20819
|
|
|
20158
20820
|
// daemon/execenv/timeline.ts
|
|
20159
|
-
var
|
|
20821
|
+
var log4 = createLogger2({ module: "timeline" });
|
|
20160
20822
|
function readJsonl(filePath) {
|
|
20161
20823
|
let content;
|
|
20162
20824
|
try {
|
|
@@ -20225,7 +20887,7 @@ async function initEntryAsync(timelineDir, entry) {
|
|
|
20225
20887
|
acquired = acquireLock(lockPath);
|
|
20226
20888
|
}
|
|
20227
20889
|
if (!acquired) {
|
|
20228
|
-
|
|
20890
|
+
log4.debug(`Timeline initEntry: could not acquire lock for ${filename}`);
|
|
20229
20891
|
return;
|
|
20230
20892
|
}
|
|
20231
20893
|
try {
|
|
@@ -20235,7 +20897,7 @@ async function initEntryAsync(timelineDir, entry) {
|
|
|
20235
20897
|
releaseLock(lockPath);
|
|
20236
20898
|
}
|
|
20237
20899
|
} catch (err) {
|
|
20238
|
-
|
|
20900
|
+
log4.debug("Timeline initEntry failed", err);
|
|
20239
20901
|
}
|
|
20240
20902
|
}
|
|
20241
20903
|
function updateEntry(timelineDir, taskId, updater) {
|
|
@@ -20245,7 +20907,7 @@ function updateEntry(timelineDir, taskId, updater) {
|
|
|
20245
20907
|
try {
|
|
20246
20908
|
const acquired = acquireLock(lockPath);
|
|
20247
20909
|
if (!acquired) {
|
|
20248
|
-
|
|
20910
|
+
log4.debug(`Timeline updateEntry: lock held for ${filename}, skipping`);
|
|
20249
20911
|
continue;
|
|
20250
20912
|
}
|
|
20251
20913
|
try {
|
|
@@ -20278,10 +20940,10 @@ function updateEntry(timelineDir, taskId, updater) {
|
|
|
20278
20940
|
releaseLock(lockPath);
|
|
20279
20941
|
}
|
|
20280
20942
|
} catch (err) {
|
|
20281
|
-
|
|
20943
|
+
log4.debug(`Timeline updateEntry failed for ${filename}`, err);
|
|
20282
20944
|
}
|
|
20283
20945
|
}
|
|
20284
|
-
|
|
20946
|
+
log4.debug(`Timeline updateEntry: task_id ${taskId} not found in last 7 days`);
|
|
20285
20947
|
}
|
|
20286
20948
|
function createTimelineEntry(taskId, prompt, type, sessionId, pid, provider, contextKey, detailedLog) {
|
|
20287
20949
|
return {
|
|
@@ -20316,7 +20978,7 @@ function findResumableSessionByContextKey(timelineDir, contextKey, provider) {
|
|
|
20316
20978
|
// daemon/execenv/steering.ts
|
|
20317
20979
|
import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync3, readFileSync as readFileSync3, unlinkSync as unlinkSync2, readdirSync, statSync as statSync2 } from "fs";
|
|
20318
20980
|
import { join as join5 } from "path";
|
|
20319
|
-
var
|
|
20981
|
+
var log5 = createLogger2({ module: "steering" });
|
|
20320
20982
|
var INTENT_DIR_NAME = ".kill_intents";
|
|
20321
20983
|
var INTENT_STALE_MS = 10 * 60 * 1000;
|
|
20322
20984
|
function intentFilePath(baseDir, taskId) {
|
|
@@ -20341,7 +21003,7 @@ function clearKillIntent(baseDir, taskId) {
|
|
|
20341
21003
|
// daemon/steering/mailbox.ts
|
|
20342
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";
|
|
20343
21005
|
import { join as join6 } from "path";
|
|
20344
|
-
var
|
|
21006
|
+
var log6 = createLogger2({ module: "mailbox" });
|
|
20345
21007
|
function inboxDir(baseDir, contextKey) {
|
|
20346
21008
|
const safeKey = contextKey.replace(/[^a-zA-Z0-9_:-]/g, "_");
|
|
20347
21009
|
return join6(baseDir, ".steering", safeKey, "inbox");
|
|
@@ -20423,7 +21085,7 @@ function watchInbox(baseDir, contextKey, onMessage) {
|
|
|
20423
21085
|
scan();
|
|
20424
21086
|
});
|
|
20425
21087
|
} catch {
|
|
20426
|
-
|
|
21088
|
+
log6.debug("fs.watch failed, relying on polling only");
|
|
20427
21089
|
}
|
|
20428
21090
|
const pollTimer = setInterval(scan, 200);
|
|
20429
21091
|
return {
|
|
@@ -21063,7 +21725,7 @@ function buildPrompt(task, attachments) {
|
|
|
21063
21725
|
}
|
|
21064
21726
|
|
|
21065
21727
|
// daemon/session-runner.ts
|
|
21066
|
-
var
|
|
21728
|
+
var log7 = createLogger2({ module: "session-runner" });
|
|
21067
21729
|
var ATTACHMENTS_BASE = tempDir("alook-attachments");
|
|
21068
21730
|
async function writeMarkerFile(workspacesRoot, marker) {
|
|
21069
21731
|
const dir = path.join(workspacesRoot, ".pending_completions");
|
|
@@ -21111,20 +21773,20 @@ async function reportToServer(fn, markerData, workspacesRoot) {
|
|
|
21111
21773
|
} catch (e) {
|
|
21112
21774
|
lastErr = e;
|
|
21113
21775
|
if (isClientError(e)) {
|
|
21114
|
-
|
|
21776
|
+
log7.info(`server report for task ${markerData.taskId}: task already in terminal state (${e})`);
|
|
21115
21777
|
return;
|
|
21116
21778
|
}
|
|
21117
21779
|
if (attempt < RETRY_DELAYS.length && isRetryableError(e)) {
|
|
21118
|
-
|
|
21780
|
+
log7.debug(`server report attempt ${attempt + 1} failed for task ${markerData.taskId}, retrying in ${RETRY_DELAYS[attempt]}ms`);
|
|
21119
21781
|
await new Promise((r) => setTimeout(r, RETRY_DELAYS[attempt]));
|
|
21120
21782
|
}
|
|
21121
21783
|
}
|
|
21122
21784
|
}
|
|
21123
|
-
|
|
21785
|
+
log7.warn(`server report failed for task ${markerData.taskId} after retries, writing marker: ${lastErr}`);
|
|
21124
21786
|
try {
|
|
21125
21787
|
await writeMarkerFile(workspacesRoot, markerData);
|
|
21126
21788
|
} catch (writeErr) {
|
|
21127
|
-
|
|
21789
|
+
log7.error(`marker write also failed for task ${markerData.taskId}: ${writeErr}`);
|
|
21128
21790
|
}
|
|
21129
21791
|
}
|
|
21130
21792
|
function sanitizeFilename(name) {
|
|
@@ -21155,7 +21817,7 @@ async function downloadAttachments(client, token, workspaceId, taskId, attachmen
|
|
|
21155
21817
|
}
|
|
21156
21818
|
async function runSession(input) {
|
|
21157
21819
|
const { task, provider, cliPath, model, serverURL, token, workspacesRoot, agentTimeout, messageInactivityTimeout } = input;
|
|
21158
|
-
|
|
21820
|
+
log7.info(`starting (task=${task.id}, type=${task.type}, agent=${task.agentId}, provider=${provider}, model=${model || "default"})`);
|
|
21159
21821
|
const client = new DaemonClient(serverURL);
|
|
21160
21822
|
const backend = createBackend(provider, cliPath);
|
|
21161
21823
|
const agentBaseDir = path.join(workspacesRoot, task.workspaceId, task.agentId, "workdir");
|
|
@@ -21178,7 +21840,7 @@ async function runSession(input) {
|
|
|
21178
21840
|
try {
|
|
21179
21841
|
await client.reportMessages(token, task.id, batch);
|
|
21180
21842
|
} catch (e) {
|
|
21181
|
-
|
|
21843
|
+
log7.debug("message report failed", e);
|
|
21182
21844
|
}
|
|
21183
21845
|
};
|
|
21184
21846
|
let mailboxWatcher = null;
|
|
@@ -21187,13 +21849,13 @@ async function runSession(input) {
|
|
|
21187
21849
|
if (killed)
|
|
21188
21850
|
return;
|
|
21189
21851
|
killed = true;
|
|
21190
|
-
|
|
21852
|
+
log7.info(`killed by signal (messages=${seq}, tools=${toolCount})`);
|
|
21191
21853
|
if (mailboxWatcher)
|
|
21192
21854
|
mailboxWatcher.stop();
|
|
21193
21855
|
if (stalledRecoveryTimer)
|
|
21194
21856
|
clearInterval(stalledRecoveryTimer);
|
|
21195
21857
|
if (agentPid !== undefined) {
|
|
21196
|
-
|
|
21858
|
+
log7.info(`killing inner agent group (pid=${agentPid})`);
|
|
21197
21859
|
await killProcessTree(agentPid);
|
|
21198
21860
|
}
|
|
21199
21861
|
if (flushTimer)
|
|
@@ -21236,14 +21898,14 @@ async function runSession(input) {
|
|
|
21236
21898
|
const attachmentIds = task.context?.attachment_ids ?? [];
|
|
21237
21899
|
let attachments;
|
|
21238
21900
|
if (attachmentIds.length > 0) {
|
|
21239
|
-
|
|
21901
|
+
log7.info(`downloading ${attachmentIds.length} attachment(s)`);
|
|
21240
21902
|
try {
|
|
21241
21903
|
attachments = await downloadAttachments(client, token, task.workspaceId, task.id, attachmentIds);
|
|
21242
|
-
|
|
21904
|
+
log7.info(`attachments ready (${attachments.length} file(s))`);
|
|
21243
21905
|
} catch (e) {
|
|
21244
21906
|
await cleanupAttachments(task.id);
|
|
21245
21907
|
const errMsg = `failed to download attachments: ${e}`;
|
|
21246
|
-
|
|
21908
|
+
log7.error(errMsg);
|
|
21247
21909
|
updateEntry(timelineDir, task.id, (entry) => {
|
|
21248
21910
|
entry.pid = null;
|
|
21249
21911
|
entry.status = "failed";
|
|
@@ -21260,7 +21922,7 @@ async function runSession(input) {
|
|
|
21260
21922
|
const prompt = input.promptOverride ?? buildPrompt(task, attachments);
|
|
21261
21923
|
const resumeSessionId = task.contextKey ? findResumableSessionByContextKey(timelineDir, task.contextKey, provider) ?? undefined : undefined;
|
|
21262
21924
|
if (resumeSessionId) {
|
|
21263
|
-
|
|
21925
|
+
log7.info(`resuming session ${resumeSessionId} (context_key: ${task.contextKey})`);
|
|
21264
21926
|
}
|
|
21265
21927
|
const session2 = backend.execute(prompt, {
|
|
21266
21928
|
cwd: workDir,
|
|
@@ -21273,14 +21935,14 @@ async function runSession(input) {
|
|
|
21273
21935
|
agentPid = session2.pid;
|
|
21274
21936
|
if (killed) {
|
|
21275
21937
|
if (agentPid !== undefined) {
|
|
21276
|
-
|
|
21938
|
+
log7.info(`kill landed during spawn — reaping inner agent group (pid=${agentPid})`);
|
|
21277
21939
|
await killProcessTree(agentPid);
|
|
21278
21940
|
}
|
|
21279
21941
|
process.exit(1);
|
|
21280
21942
|
}
|
|
21281
21943
|
const earlySessionId = await session2.sessionId;
|
|
21282
|
-
|
|
21283
|
-
|
|
21944
|
+
log7.info(`agent started (pid=${agentPid ?? "unknown"}, session=${earlySessionId})`);
|
|
21945
|
+
log7.info(JSON.stringify({ role: "user", type: "text", content: prompt }));
|
|
21284
21946
|
updateEntry(timelineDir, task.id, (entry) => {
|
|
21285
21947
|
entry.session_id = earlySessionId || null;
|
|
21286
21948
|
if (earlySessionId)
|
|
@@ -21312,7 +21974,7 @@ async function runSession(input) {
|
|
|
21312
21974
|
apmState = recentResult.nextState;
|
|
21313
21975
|
if (event.kind === "error") {
|
|
21314
21976
|
const classified = classifyRuntimeError(event.message);
|
|
21315
|
-
|
|
21977
|
+
log7.info(`steering: error classified as ${classified.errorClass}: ${scrubDiagnosticText(event.message)}`);
|
|
21316
21978
|
const errResult = reduceApmGatedError(apmState, { disableToolBoundaryFlush: true });
|
|
21317
21979
|
apmState = errResult.nextState;
|
|
21318
21980
|
}
|
|
@@ -21420,7 +22082,7 @@ async function runSession(input) {
|
|
|
21420
22082
|
for (const msg of apmState.pendingMessages) {
|
|
21421
22083
|
const sendResult = session2.send(msg, eff.stdinMode);
|
|
21422
22084
|
if (!sendResult.ok) {
|
|
21423
|
-
|
|
22085
|
+
log7.warn("steering: send failed during turn_end flush", { reason: sendResult.reason });
|
|
21424
22086
|
allSent = false;
|
|
21425
22087
|
break;
|
|
21426
22088
|
}
|
|
@@ -21441,7 +22103,7 @@ async function runSession(input) {
|
|
|
21441
22103
|
if (flushedOk || apmState.pendingMessages.length === 0) {
|
|
21442
22104
|
for (const steeredId of pendingSteeredTasks) {
|
|
21443
22105
|
client.completeTask(token, steeredId, { output: "" }).catch((e) => {
|
|
21444
|
-
|
|
22106
|
+
log7.debug(`steering: failed to complete steered task ${steeredId}`, e);
|
|
21445
22107
|
});
|
|
21446
22108
|
}
|
|
21447
22109
|
pendingSteeredTasks.clear();
|
|
@@ -21452,11 +22114,11 @@ async function runSession(input) {
|
|
|
21452
22114
|
}
|
|
21453
22115
|
}
|
|
21454
22116
|
} catch (err) {
|
|
21455
|
-
|
|
22117
|
+
log7.warn("steering: consumeParsedEvents error", { err: err instanceof Error ? err.message : String(err) });
|
|
21456
22118
|
}
|
|
21457
22119
|
};
|
|
21458
22120
|
consumeParsedEvents().catch((err) => {
|
|
21459
|
-
|
|
22121
|
+
log7.error("steering: consumeParsedEvents unhandled error", { err: err instanceof Error ? err.message : String(err) });
|
|
21460
22122
|
});
|
|
21461
22123
|
}
|
|
21462
22124
|
stalledRecoveryTimer = setInterval(() => {
|
|
@@ -21468,7 +22130,7 @@ async function runSession(input) {
|
|
|
21468
22130
|
});
|
|
21469
22131
|
apmState = startupResult.nextState;
|
|
21470
22132
|
if (startupResult.shouldTerminate) {
|
|
21471
|
-
|
|
22133
|
+
log7.warn("steering: startup timeout — no progress events received, killing agent");
|
|
21472
22134
|
if (agentPid !== undefined)
|
|
21473
22135
|
killProcessTree(agentPid);
|
|
21474
22136
|
return;
|
|
@@ -21489,7 +22151,7 @@ async function runSession(input) {
|
|
|
21489
22151
|
});
|
|
21490
22152
|
apmState = stalledResult.nextState;
|
|
21491
22153
|
if (stalledResult.shouldTerminate) {
|
|
21492
|
-
|
|
22154
|
+
log7.warn(`steering: stalled recovery — agent stale for ${(staleForMs / 1000).toFixed(1)}s with ${apmState.pendingMessages.length} pending messages, killing`);
|
|
21493
22155
|
if (agentPid !== undefined)
|
|
21494
22156
|
killProcessTree(agentPid);
|
|
21495
22157
|
}
|
|
@@ -21549,7 +22211,7 @@ async function runSession(input) {
|
|
|
21549
22211
|
if (delivered && message2.taskId) {
|
|
21550
22212
|
pendingSteeredTasks.add(message2.taskId);
|
|
21551
22213
|
client.startTask(token, message2.taskId).catch((e) => {
|
|
21552
|
-
|
|
22214
|
+
log7.debug(`steering: failed to start steered task ${message2.taskId}`, e);
|
|
21553
22215
|
});
|
|
21554
22216
|
}
|
|
21555
22217
|
cleanupInboxFile(agentBaseDir, task.contextKey, seq2);
|
|
@@ -21570,7 +22232,7 @@ async function runSession(input) {
|
|
|
21570
22232
|
]) : next);
|
|
21571
22233
|
if (raceResult === "timeout") {
|
|
21572
22234
|
inactivityTimedOut = true;
|
|
21573
|
-
|
|
22235
|
+
log7.warn(`message inactivity timeout (${INACTIVITY_TIMEOUT_MS / 1000}s) — killing agent`);
|
|
21574
22236
|
if (session2.pid !== undefined) {
|
|
21575
22237
|
await killProcessTree(session2.pid);
|
|
21576
22238
|
}
|
|
@@ -21585,9 +22247,9 @@ async function runSession(input) {
|
|
|
21585
22247
|
if (msg.type === "tool-use")
|
|
21586
22248
|
toolCount++;
|
|
21587
22249
|
if (msg.type === "tool-result" && msg.output && msg.output.length > 500) {
|
|
21588
|
-
|
|
22250
|
+
log7.info(JSON.stringify({ role: "assistant", ...msg, output: msg.output.slice(0, 500) + `... (${msg.output.length} chars)` }));
|
|
21589
22251
|
} else {
|
|
21590
|
-
|
|
22252
|
+
log7.info(JSON.stringify({ role: "assistant", ...msg }));
|
|
21591
22253
|
}
|
|
21592
22254
|
if (msg.type === "status" || msg.type === "log")
|
|
21593
22255
|
continue;
|
|
@@ -21655,18 +22317,18 @@ async function runSession(input) {
|
|
|
21655
22317
|
body.session_id = result.sessionId;
|
|
21656
22318
|
await reportToServer(() => client.completeTask(token, task.id, body), { taskId: task.id, type: "complete", payload: body, token, serverURL, createdAt: new Date().toISOString() }, workspacesRoot);
|
|
21657
22319
|
const dur = (result.durationMs / 1000).toFixed(1);
|
|
21658
|
-
|
|
22320
|
+
log7.info(`completed (duration=${dur}s, messages=${seq}, tools=${toolCount})`);
|
|
21659
22321
|
} else {
|
|
21660
22322
|
const errorMsg = result.error || "agent exited unexpectedly";
|
|
21661
22323
|
await reportToServer(() => client.failTask(token, task.id, errorMsg), { taskId: task.id, type: "fail", payload: { error: errorMsg }, token, serverURL, createdAt: new Date().toISOString() }, workspacesRoot);
|
|
21662
22324
|
const dur = (result.durationMs / 1000).toFixed(1);
|
|
21663
|
-
|
|
22325
|
+
log7.info(`failed (duration=${dur}s, messages=${seq}, tools=${toolCount}) — ${result.error}`);
|
|
21664
22326
|
}
|
|
21665
22327
|
}
|
|
21666
22328
|
async function main() {
|
|
21667
22329
|
const encoded = process.argv[2];
|
|
21668
22330
|
if (!encoded) {
|
|
21669
|
-
|
|
22331
|
+
log7.error("session-runner: missing base64-encoded input argument");
|
|
21670
22332
|
process.exit(1);
|
|
21671
22333
|
}
|
|
21672
22334
|
let input;
|
|
@@ -21674,14 +22336,14 @@ async function main() {
|
|
|
21674
22336
|
const json2 = Buffer.from(encoded, "base64").toString("utf-8");
|
|
21675
22337
|
input = JSON.parse(json2);
|
|
21676
22338
|
} catch (e) {
|
|
21677
|
-
|
|
22339
|
+
log7.error("session-runner: failed to parse input", e);
|
|
21678
22340
|
process.exit(1);
|
|
21679
22341
|
}
|
|
21680
22342
|
const client = new DaemonClient(input.serverURL);
|
|
21681
22343
|
try {
|
|
21682
22344
|
await runSession(input);
|
|
21683
22345
|
} catch (e) {
|
|
21684
|
-
|
|
22346
|
+
log7.error(`session-runner: unhandled error for task ${input.task.id}`, e);
|
|
21685
22347
|
await cleanupAttachments(input.task.id);
|
|
21686
22348
|
const timelineDir = path.join(input.workspacesRoot, input.task.workspaceId, input.task.agentId, "workdir", ".context_timeline").replace(/\\/g, "/");
|
|
21687
22349
|
updateEntry(timelineDir, input.task.id, (entry) => {
|