@alook/cli 0.1.24 → 0.1.25
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 +215 -9
- package/dist/session-runner.js +215 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14469,6 +14469,7 @@ var exports_community_machine_schema = {};
|
|
|
14469
14469
|
__export(exports_community_machine_schema, {
|
|
14470
14470
|
communityMachineToken: () => communityMachineToken,
|
|
14471
14471
|
communityMachineCredential: () => communityMachineCredential,
|
|
14472
|
+
communityMachineBackendQuota: () => communityMachineBackendQuota,
|
|
14472
14473
|
communityMachine: () => communityMachine,
|
|
14473
14474
|
communityDiagnosticReport: () => communityDiagnosticReport,
|
|
14474
14475
|
communityBotBinding: () => communityBotBinding,
|
|
@@ -16076,6 +16077,8 @@ var user = sqliteTable("user", {
|
|
|
16076
16077
|
email: text("email").unique().notNull(),
|
|
16077
16078
|
emailVerified: integer2("emailVerified", { mode: "boolean" }),
|
|
16078
16079
|
image: text("image"),
|
|
16080
|
+
avatarVersion: integer2("avatarVersion").notNull().default(0),
|
|
16081
|
+
avatarObjectKey: text("avatarObjectKey"),
|
|
16079
16082
|
createdAt: text("createdAt").notNull().$defaultFn(() => new Date().toISOString()),
|
|
16080
16083
|
updatedAt: text("updatedAt").notNull().$defaultFn(() => new Date().toISOString()),
|
|
16081
16084
|
isBot: integer2("isBot", { mode: "boolean" }).notNull().default(false),
|
|
@@ -16749,8 +16752,23 @@ var communityBotBinding = sqliteTable("community_bot_binding", {
|
|
|
16749
16752
|
runtime: text("runtime").notNull(),
|
|
16750
16753
|
instruction: text("instruction").notNull().default(""),
|
|
16751
16754
|
modelName: text("model_name"),
|
|
16755
|
+
reasoningEffort: text("reasoning_effort"),
|
|
16756
|
+
runtimeConfigRevision: integer2("runtime_config_revision").notNull().default(0),
|
|
16752
16757
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
16753
16758
|
}, (t) => [index("idx_community_bot_binding_machine").on(t.machineId)]);
|
|
16759
|
+
var communityMachineBackendQuota = sqliteTable("community_machine_backend_quota", {
|
|
16760
|
+
machineId: text("machine_id").notNull().references(() => communityMachine.id, { onDelete: "cascade" }),
|
|
16761
|
+
agentBackendId: text("agent_backend_id").$type().notNull(),
|
|
16762
|
+
sourceEpoch: text("source_epoch").notNull(),
|
|
16763
|
+
status: text("status").$type().notNull(),
|
|
16764
|
+
planName: text("plan_name"),
|
|
16765
|
+
freshForSeconds: integer2("fresh_for_seconds"),
|
|
16766
|
+
limits: text("limits", { mode: "json" }).$type(),
|
|
16767
|
+
errorCode: text("error_code"),
|
|
16768
|
+
retryable: integer2("retryable", { mode: "boolean" }),
|
|
16769
|
+
observedAt: text("observed_at").notNull(),
|
|
16770
|
+
updatedAt: text("updated_at").notNull()
|
|
16771
|
+
}, (t) => [primaryKey({ columns: [t.machineId, t.agentBackendId] })]);
|
|
16754
16772
|
var communityAgentRunnerKey = sqliteTable("community_agent_runner_key", {
|
|
16755
16773
|
id: text("id").primaryKey().$defaultFn(() => "crkid_" + nanoid3()),
|
|
16756
16774
|
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
@@ -16822,7 +16840,7 @@ var MAX_PROFILE_ABOUT_LENGTH = 1000;
|
|
|
16822
16840
|
var MAX_MESSAGE_CONTENT_LENGTH = 4000;
|
|
16823
16841
|
var MAX_ATTACHMENTS_PER_MESSAGE = 10;
|
|
16824
16842
|
var MAX_ATTACHMENT_SIZE_BYTES = 25 * 1024 * 1024;
|
|
16825
|
-
var MAX_ATTACHMENT_THUMBNAIL_SIZE_BYTES =
|
|
16843
|
+
var MAX_ATTACHMENT_THUMBNAIL_SIZE_BYTES = 512 * 1024;
|
|
16826
16844
|
var MAX_SERVER_ICON_SIZE_BYTES = 5 * 1024 * 1024;
|
|
16827
16845
|
var ALLOWED_ICON_MIME_TYPES = [
|
|
16828
16846
|
"image/png",
|
|
@@ -16831,6 +16849,92 @@ var ALLOWED_ICON_MIME_TYPES = [
|
|
|
16831
16849
|
"image/gif"
|
|
16832
16850
|
];
|
|
16833
16851
|
var MAX_ICON_SOURCE_FILE_SIZE_BYTES = 15 * 1024 * 1024;
|
|
16852
|
+
// ../shared/src/provider-telemetry.ts
|
|
16853
|
+
var safeToken = exports_external.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
16854
|
+
var boundedText = exports_external.string().min(1).refine((value) => new TextEncoder().encode(value).length <= 64, { message: "must be at most 64 UTF-8 bytes" });
|
|
16855
|
+
var DailyUsageMetricSchema = safeToken.nullable();
|
|
16856
|
+
var DailyUsageSnapshotSchema = exports_external.object({
|
|
16857
|
+
botId: exports_external.string().min(1),
|
|
16858
|
+
day: exports_external.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
16859
|
+
metrics: exports_external.object({
|
|
16860
|
+
input: DailyUsageMetricSchema,
|
|
16861
|
+
output: DailyUsageMetricSchema,
|
|
16862
|
+
cache: DailyUsageMetricSchema
|
|
16863
|
+
}).strict()
|
|
16864
|
+
}).strict();
|
|
16865
|
+
var QuotaProductIdentitySchema = exports_external.discriminatedUnion("kind", [
|
|
16866
|
+
exports_external.object({ kind: exports_external.literal("reported"), id: boundedText, displayName: boundedText }).strict(),
|
|
16867
|
+
exports_external.object({ kind: exports_external.literal("unknown"), displayName: boundedText }).strict()
|
|
16868
|
+
]);
|
|
16869
|
+
var QuotaModelIdentitySchema = exports_external.discriminatedUnion("kind", [
|
|
16870
|
+
exports_external.object({ kind: exports_external.literal("reported"), id: boundedText }).strict(),
|
|
16871
|
+
exports_external.object({ kind: exports_external.literal("not_applicable") }).strict(),
|
|
16872
|
+
exports_external.object({ kind: exports_external.literal("unknown") }).strict()
|
|
16873
|
+
]);
|
|
16874
|
+
var QuotaWindowIdentitySchema = exports_external.discriminatedUnion("kind", [
|
|
16875
|
+
exports_external.object({
|
|
16876
|
+
kind: exports_external.literal("rolling"),
|
|
16877
|
+
durationSeconds: exports_external.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
16878
|
+
displayName: boundedText
|
|
16879
|
+
}).strict(),
|
|
16880
|
+
exports_external.object({
|
|
16881
|
+
kind: exports_external.literal("calendar"),
|
|
16882
|
+
period: exports_external.enum(["day", "week", "month"]),
|
|
16883
|
+
displayName: boundedText
|
|
16884
|
+
}).strict(),
|
|
16885
|
+
exports_external.object({
|
|
16886
|
+
kind: exports_external.literal("provider_defined"),
|
|
16887
|
+
id: boundedText,
|
|
16888
|
+
durationSeconds: exports_external.number().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),
|
|
16889
|
+
displayName: boundedText
|
|
16890
|
+
}).strict()
|
|
16891
|
+
]);
|
|
16892
|
+
var QuotaLimitSchema = exports_external.object({
|
|
16893
|
+
bucket: exports_external.object({
|
|
16894
|
+
limitId: boundedText,
|
|
16895
|
+
product: QuotaProductIdentitySchema,
|
|
16896
|
+
model: QuotaModelIdentitySchema,
|
|
16897
|
+
window: QuotaWindowIdentitySchema
|
|
16898
|
+
}).strict(),
|
|
16899
|
+
usedPercent: exports_external.number().finite().min(0).max(100),
|
|
16900
|
+
resetsAt: exports_external.string().datetime({ offset: true }).optional()
|
|
16901
|
+
}).strict();
|
|
16902
|
+
function quotaIdentity(limit) {
|
|
16903
|
+
const { product, model, window: window2, limitId } = limit.bucket;
|
|
16904
|
+
const productKey = product.kind === "reported" ? `reported:${product.id}` : "unknown";
|
|
16905
|
+
const modelKey = model.kind === "reported" ? `reported:${model.id}` : model.kind;
|
|
16906
|
+
const windowKey = window2.kind === "rolling" ? `rolling:${window2.durationSeconds}` : window2.kind === "calendar" ? `calendar:${window2.period}` : `provider_defined:${window2.id}:${window2.durationSeconds === undefined ? "absent" : window2.durationSeconds}`;
|
|
16907
|
+
return `${productKey}\x00${modelKey}\x00${windowKey}\x00${limitId}`;
|
|
16908
|
+
}
|
|
16909
|
+
var AvailableQuotaObservationSchema = exports_external.object({
|
|
16910
|
+
status: exports_external.literal("available"),
|
|
16911
|
+
sourceEpoch: exports_external.string().regex(/^[A-Za-z0-9_-]{22}$/),
|
|
16912
|
+
planName: boundedText.optional(),
|
|
16913
|
+
freshForSeconds: exports_external.number().int().positive().max(86400),
|
|
16914
|
+
limits: exports_external.array(QuotaLimitSchema).min(1).max(8)
|
|
16915
|
+
}).strict().superRefine((value, ctx) => {
|
|
16916
|
+
const identities = new Set;
|
|
16917
|
+
for (const [index2, limit] of value.limits.entries()) {
|
|
16918
|
+
const identity = quotaIdentity(limit);
|
|
16919
|
+
if (identities.has(identity)) {
|
|
16920
|
+
ctx.addIssue({ code: "custom", message: "duplicate quota bucket identity", path: ["limits", index2] });
|
|
16921
|
+
}
|
|
16922
|
+
identities.add(identity);
|
|
16923
|
+
}
|
|
16924
|
+
});
|
|
16925
|
+
var ProviderQuotaObservationSchema = exports_external.union([
|
|
16926
|
+
AvailableQuotaObservationSchema,
|
|
16927
|
+
exports_external.object({
|
|
16928
|
+
status: exports_external.literal("error"),
|
|
16929
|
+
sourceEpoch: exports_external.string().regex(/^[A-Za-z0-9_-]{22}$/),
|
|
16930
|
+
code: exports_external.enum(["unavailable", "unauthorized", "network", "provider_error", "invalid_response"]),
|
|
16931
|
+
retryable: exports_external.boolean()
|
|
16932
|
+
}).strict()
|
|
16933
|
+
]);
|
|
16934
|
+
var ProviderQuotaSnapshotSchema = exports_external.object({
|
|
16935
|
+
agentBackendId: exports_external.enum(["claude", "codex"]),
|
|
16936
|
+
observation: ProviderQuotaObservationSchema
|
|
16937
|
+
}).strict();
|
|
16834
16938
|
// ../shared/src/utils/slug.ts
|
|
16835
16939
|
init_nanoid();
|
|
16836
16940
|
var slugId = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz");
|
|
@@ -17346,12 +17450,60 @@ var CreateThreadRequestSchema = exports_external.object({
|
|
|
17346
17450
|
attachment_ids: exports_external.array(exports_external.string()).optional()
|
|
17347
17451
|
});
|
|
17348
17452
|
var RUNTIME_ID_RE = /^[A-Za-z0-9._@/-]+$/;
|
|
17453
|
+
var REASONING_EFFORT_RE = /^[A-Za-z0-9._-]+$/;
|
|
17454
|
+
var COMMUNITY_REASONING_EFFORT_MAX = 32;
|
|
17455
|
+
var COMMUNITY_REASONING_DESCRIPTION_MAX = 256;
|
|
17456
|
+
var COMMUNITY_REASONING_OPTIONS_MAX = 16;
|
|
17457
|
+
var COMMUNITY_REASONING_MODELS_MAX = 64;
|
|
17458
|
+
var ReasoningEffortSchema = exports_external.string().min(1).max(COMMUNITY_REASONING_EFFORT_MAX).regex(REASONING_EFFORT_RE, "invalid reasoning effort charset");
|
|
17459
|
+
var RuntimeReasoningOptionSchema = exports_external.object({
|
|
17460
|
+
value: ReasoningEffortSchema,
|
|
17461
|
+
description: exports_external.string().max(COMMUNITY_REASONING_DESCRIPTION_MAX).optional()
|
|
17462
|
+
});
|
|
17463
|
+
var RuntimeReasoningModelSchema = exports_external.object({
|
|
17464
|
+
id: exports_external.string().min(1).max(100),
|
|
17465
|
+
supportedReasoningEfforts: exports_external.array(exports_external.unknown()).max(COMMUNITY_REASONING_OPTIONS_MAX).transform((options) => {
|
|
17466
|
+
const seen = new Set;
|
|
17467
|
+
return options.flatMap((candidate) => {
|
|
17468
|
+
const parsed = RuntimeReasoningOptionSchema.safeParse(candidate);
|
|
17469
|
+
if (!parsed.success)
|
|
17470
|
+
return [];
|
|
17471
|
+
const option = parsed.data;
|
|
17472
|
+
if (seen.has(option.value))
|
|
17473
|
+
return [];
|
|
17474
|
+
seen.add(option.value);
|
|
17475
|
+
return [option];
|
|
17476
|
+
});
|
|
17477
|
+
}),
|
|
17478
|
+
defaultReasoningEffort: ReasoningEffortSchema.optional().catch(undefined)
|
|
17479
|
+
}).transform((model) => {
|
|
17480
|
+
const { defaultReasoningEffort, ...rest } = model;
|
|
17481
|
+
return defaultReasoningEffort !== undefined && model.supportedReasoningEfforts.some((option) => option.value === defaultReasoningEffort) ? { ...rest, defaultReasoningEffort } : rest;
|
|
17482
|
+
});
|
|
17483
|
+
var RuntimeReasoningCatalogSchema = exports_external.object({
|
|
17484
|
+
updateMode: exports_external.enum(["live_next_turn", "context_preserving_restart", "unsupported"]),
|
|
17485
|
+
defaultModelId: exports_external.string().min(1).max(100).optional().catch(undefined),
|
|
17486
|
+
models: exports_external.array(exports_external.unknown()).max(COMMUNITY_REASONING_MODELS_MAX).transform((models) => {
|
|
17487
|
+
const seen = new Set;
|
|
17488
|
+
return models.flatMap((candidate) => {
|
|
17489
|
+
const parsed = RuntimeReasoningModelSchema.safeParse(candidate);
|
|
17490
|
+
if (!parsed.success)
|
|
17491
|
+
return [];
|
|
17492
|
+
const model = parsed.data;
|
|
17493
|
+
if (seen.has(model.id))
|
|
17494
|
+
return [];
|
|
17495
|
+
seen.add(model.id);
|
|
17496
|
+
return [model];
|
|
17497
|
+
});
|
|
17498
|
+
})
|
|
17499
|
+
});
|
|
17349
17500
|
var CommunityMachineRuntimeSchema = exports_external.object({
|
|
17350
17501
|
id: exports_external.string().min(1).max(COMMUNITY_RUNTIME_ID_MAX).regex(RUNTIME_ID_RE, "invalid runtime id charset"),
|
|
17351
17502
|
version: exports_external.string().max(COMMUNITY_RUNTIME_VERSION_MAX).optional(),
|
|
17352
17503
|
status: exports_external.enum(["healthy", "unhealthy"]).catch("healthy").default("healthy"),
|
|
17353
17504
|
lastError: exports_external.string().max(128).optional(),
|
|
17354
|
-
lastErrorAt: exports_external.string().optional()
|
|
17505
|
+
lastErrorAt: exports_external.string().optional(),
|
|
17506
|
+
reasoning: RuntimeReasoningCatalogSchema.optional().catch(undefined)
|
|
17355
17507
|
});
|
|
17356
17508
|
var CommunityMachineRuntimeListSchema = exports_external.array(CommunityMachineRuntimeSchema).max(COMMUNITY_RUNTIME_LIST_MAX).transform((list) => {
|
|
17357
17509
|
const seen = new Set;
|
|
@@ -17403,7 +17555,8 @@ var HostReadyMessageSchema = exports_external.object({
|
|
|
17403
17555
|
platform: exports_external.string().optional(),
|
|
17404
17556
|
arch: exports_external.string().optional(),
|
|
17405
17557
|
osRelease: exports_external.string().optional(),
|
|
17406
|
-
daemonVersion: exports_external.string().optional()
|
|
17558
|
+
daemonVersion: exports_external.string().optional(),
|
|
17559
|
+
providerQuotas: exports_external.array(ProviderQuotaSnapshotSchema).max(2).optional().default([])
|
|
17407
17560
|
});
|
|
17408
17561
|
var CommunityDaemonReadySchema = exports_external.object({
|
|
17409
17562
|
runtimeReport: CommunityMachineRuntimeListSchema.optional(),
|
|
@@ -17424,7 +17577,9 @@ var SessionErrorFrameSchema = exports_external.object({
|
|
|
17424
17577
|
var AgentActivityMessageSchema = exports_external.object({
|
|
17425
17578
|
type: exports_external.literal("agent_activity"),
|
|
17426
17579
|
agentId: exports_external.string(),
|
|
17427
|
-
state: exports_external.enum(["idle", "starting", "running", "stopping"])
|
|
17580
|
+
state: exports_external.enum(["idle", "starting", "running", "stopping"]),
|
|
17581
|
+
dailyUsage: exports_external.array(DailyUsageSnapshotSchema).max(7).optional(),
|
|
17582
|
+
quota: ProviderQuotaSnapshotSchema.optional()
|
|
17428
17583
|
});
|
|
17429
17584
|
var AgentTypingMessageSchema = exports_external.object({
|
|
17430
17585
|
type: exports_external.literal("agent_typing"),
|
|
@@ -17499,15 +17654,17 @@ var CommunityBotCreateRequestSchema = exports_external.object({
|
|
|
17499
17654
|
machineId: exports_external.string().min(1),
|
|
17500
17655
|
runtime: exports_external.string().min(1),
|
|
17501
17656
|
image: BotImageUrlSchema.optional(),
|
|
17502
|
-
model: exports_external.string().trim().min(1).max(100).nullable().optional()
|
|
17657
|
+
model: exports_external.string().trim().min(1).max(100).nullable().optional(),
|
|
17658
|
+
reasoningEffort: ReasoningEffortSchema.nullable().optional()
|
|
17503
17659
|
});
|
|
17504
17660
|
var CommunityBotPatchRequestSchema = exports_external.object({
|
|
17505
17661
|
name: exports_external.string().trim().min(COMMUNITY_BOT_NAME_MIN).max(COMMUNITY_BOT_NAME_MAX).refine(isMentionSafeName, { message: MENTION_SAFE_NAME_MSG }).optional(),
|
|
17506
17662
|
description: exports_external.string().max(COMMUNITY_BOT_DESCRIPTION_MAX).optional(),
|
|
17507
17663
|
image: BotImageUrlSchema.nullable().optional(),
|
|
17508
17664
|
model: exports_external.string().trim().min(1).max(100).nullable().optional(),
|
|
17509
|
-
runtime: exports_external.string().trim().min(1).max(COMMUNITY_RUNTIME_ID_MAX).optional()
|
|
17510
|
-
|
|
17665
|
+
runtime: exports_external.string().trim().min(1).max(COMMUNITY_RUNTIME_ID_MAX).optional(),
|
|
17666
|
+
reasoningEffort: ReasoningEffortSchema.nullable().optional()
|
|
17667
|
+
}).refine((v) => v.name !== undefined || v.description !== undefined || v.image !== undefined || v.runtime !== undefined || ("reasoningEffort" in v) || ("model" in v), {
|
|
17511
17668
|
message: "at least one field must be provided"
|
|
17512
17669
|
});
|
|
17513
17670
|
var CommunityBotAddToServerRequestSchema = exports_external.object({
|
|
@@ -17723,6 +17880,11 @@ var HostCommandSchema = exports_external.discriminatedUnion("type", [
|
|
|
17723
17880
|
config: exports_external.unknown(),
|
|
17724
17881
|
launchId: exports_external.string().min(1)
|
|
17725
17882
|
}),
|
|
17883
|
+
exports_external.object({
|
|
17884
|
+
type: exports_external.literal("agent:runtime_config_update"),
|
|
17885
|
+
agentId: exports_external.string().min(1),
|
|
17886
|
+
config: exports_external.unknown()
|
|
17887
|
+
}),
|
|
17726
17888
|
exports_external.object({
|
|
17727
17889
|
type: exports_external.literal("machine:reset_all"),
|
|
17728
17890
|
resets: exports_external.array(exports_external.object({
|
|
@@ -17781,6 +17943,7 @@ __export(exports_community_schema, {
|
|
|
17781
17943
|
communityChannelMember: () => communityChannelMember,
|
|
17782
17944
|
communityChannel: () => communityChannel,
|
|
17783
17945
|
communityCategory: () => communityCategory,
|
|
17946
|
+
communityBotDailyTokenUsage: () => communityBotDailyTokenUsage,
|
|
17784
17947
|
communityBotDailyActivity: () => communityBotDailyActivity,
|
|
17785
17948
|
communityBotApprovalRequest: () => communityBotApprovalRequest,
|
|
17786
17949
|
communityBotActivityEvent: () => communityBotActivityEvent,
|
|
@@ -18033,6 +18196,17 @@ var communityBotDailyActivity = sqliteTable("community_bot_daily_activity", {
|
|
|
18033
18196
|
handledCount: integer2("handled_count").notNull().default(0),
|
|
18034
18197
|
sentCount: integer2("sent_count").notNull().default(0)
|
|
18035
18198
|
}, (t) => [primaryKey({ columns: [t.botId, t.day] })]);
|
|
18199
|
+
var communityBotDailyTokenUsage = sqliteTable("community_bot_daily_token_usage", {
|
|
18200
|
+
botId: text("bot_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
18201
|
+
day: text("day").notNull(),
|
|
18202
|
+
inputTokens: integer2("input_tokens"),
|
|
18203
|
+
outputTokens: integer2("output_tokens"),
|
|
18204
|
+
cacheTokens: integer2("cache_tokens"),
|
|
18205
|
+
updatedAt: text("updated_at").notNull()
|
|
18206
|
+
}, (t) => [
|
|
18207
|
+
primaryKey({ columns: [t.botId, t.day] }),
|
|
18208
|
+
index("idx_community_bot_daily_token_usage_day").on(t.day)
|
|
18209
|
+
]);
|
|
18036
18210
|
var communityMessageMark = sqliteTable("community_message_mark", {
|
|
18037
18211
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
18038
18212
|
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
@@ -18157,7 +18331,8 @@ var listedMessageProjection = {
|
|
|
18157
18331
|
clientNonce: communityMessage.clientNonce,
|
|
18158
18332
|
authorName: user.name,
|
|
18159
18333
|
authorEmail: user.email,
|
|
18160
|
-
authorImage: user.image
|
|
18334
|
+
authorImage: user.image,
|
|
18335
|
+
authorAvatarVersion: user.avatarVersion
|
|
18161
18336
|
};
|
|
18162
18337
|
|
|
18163
18338
|
// ../shared/src/db/queries/user.ts
|
|
@@ -18167,6 +18342,7 @@ var publicUserColumns = {
|
|
|
18167
18342
|
email: user.email,
|
|
18168
18343
|
emailVerified: user.emailVerified,
|
|
18169
18344
|
image: user.image,
|
|
18345
|
+
avatarVersion: user.avatarVersion,
|
|
18170
18346
|
createdAt: user.createdAt,
|
|
18171
18347
|
updatedAt: user.updatedAt,
|
|
18172
18348
|
discriminator: user.discriminator
|
|
@@ -18177,6 +18353,12 @@ var internalUserColumns = {
|
|
|
18177
18353
|
ownerUserId: user.ownerUserId,
|
|
18178
18354
|
deletedAt: user.deletedAt
|
|
18179
18355
|
};
|
|
18356
|
+
var avatarPublishColumns = {
|
|
18357
|
+
id: user.id,
|
|
18358
|
+
image: user.image,
|
|
18359
|
+
avatarVersion: user.avatarVersion,
|
|
18360
|
+
avatarObjectKey: user.avatarObjectKey
|
|
18361
|
+
};
|
|
18180
18362
|
|
|
18181
18363
|
// ../shared/src/db/queries/community/channel.ts
|
|
18182
18364
|
var CHANNEL_COLUMNS = {
|
|
@@ -18229,7 +18411,8 @@ var friendApprovalProfileSchema = exports_external.strictObject({
|
|
|
18229
18411
|
id: string4,
|
|
18230
18412
|
name: string4,
|
|
18231
18413
|
discriminator: string4,
|
|
18232
|
-
image: nullableString
|
|
18414
|
+
image: nullableString,
|
|
18415
|
+
avatarVersion: exports_external.number().int().nonnegative()
|
|
18233
18416
|
});
|
|
18234
18417
|
var FriendApprovalPayloadSchema = exports_external.strictObject({
|
|
18235
18418
|
friendshipId: string4,
|
|
@@ -18255,6 +18438,7 @@ var messageSchema = exports_external.strictObject({
|
|
|
18255
18438
|
authorId: string4,
|
|
18256
18439
|
authorName: string4,
|
|
18257
18440
|
authorAvatar: string4.optional(),
|
|
18441
|
+
authorAvatarVersion: exports_external.number().int().nonnegative(),
|
|
18258
18442
|
content: string4,
|
|
18259
18443
|
type: exports_external.enum(["chat", "system"]),
|
|
18260
18444
|
systemKind: exports_external.literal("thread").optional(),
|
|
@@ -18262,6 +18446,7 @@ var messageSchema = exports_external.strictObject({
|
|
|
18262
18446
|
replyToId: nullableString.optional(),
|
|
18263
18447
|
replyTo: exports_external.strictObject({
|
|
18264
18448
|
id: string4,
|
|
18449
|
+
authorId: string4.optional(),
|
|
18265
18450
|
authorName: string4,
|
|
18266
18451
|
text: string4,
|
|
18267
18452
|
deleted: exports_external.boolean().optional()
|
|
@@ -18456,6 +18641,7 @@ var communityMemberJoinSchema = exports_external.strictObject({
|
|
|
18456
18641
|
name: string4,
|
|
18457
18642
|
discriminator: string4,
|
|
18458
18643
|
avatar: string4.optional(),
|
|
18644
|
+
avatarVersion: exports_external.number().int().nonnegative(),
|
|
18459
18645
|
role: string4,
|
|
18460
18646
|
joinedAt: string4
|
|
18461
18647
|
})
|
|
@@ -18558,6 +18744,22 @@ var communityStatusUpdateSchema = exports_external.strictObject({
|
|
|
18558
18744
|
statusEmoji: nullableString,
|
|
18559
18745
|
statusText: nullableString
|
|
18560
18746
|
});
|
|
18747
|
+
var communityIdentityUpdateSchema = exports_external.strictObject({
|
|
18748
|
+
type: exports_external.literal("community:identity.update"),
|
|
18749
|
+
userId: string4,
|
|
18750
|
+
avatar: string4,
|
|
18751
|
+
avatarVersion: exports_external.number().int().positive()
|
|
18752
|
+
});
|
|
18753
|
+
var communityProfileUpdateSchema = exports_external.strictObject({
|
|
18754
|
+
type: exports_external.literal("community:profile.update"),
|
|
18755
|
+
userId: string4,
|
|
18756
|
+
name: string4,
|
|
18757
|
+
discriminator: string4,
|
|
18758
|
+
aboutMe: string4,
|
|
18759
|
+
bannerColor: nullableString,
|
|
18760
|
+
kind: exports_external.enum(["human", "bot"]),
|
|
18761
|
+
ownerUserId: nullableString
|
|
18762
|
+
});
|
|
18561
18763
|
var machineRuntimeSchema = CommunityMachineRuntimeSchema.strict();
|
|
18562
18764
|
var CommunityMachineSummarySchema2 = exports_external.strictObject({
|
|
18563
18765
|
id: string4,
|
|
@@ -18646,6 +18848,8 @@ var CommunityWsEventDiscriminatedSchema = exports_external.discriminatedUnion("t
|
|
|
18646
18848
|
communityInboxChangedSchema,
|
|
18647
18849
|
communityPresenceUpdateSchema,
|
|
18648
18850
|
communityStatusUpdateSchema,
|
|
18851
|
+
communityIdentityUpdateSchema,
|
|
18852
|
+
communityProfileUpdateSchema,
|
|
18649
18853
|
communityMachineCreatedSchema,
|
|
18650
18854
|
communityMachineStatusSchema,
|
|
18651
18855
|
communityMachineUpdatedSchema,
|
|
@@ -18692,6 +18896,8 @@ var WS_EVENTS = {
|
|
|
18692
18896
|
INBOX_CHANGED: "community:inbox.changed",
|
|
18693
18897
|
PRESENCE_UPDATE: "community:presence.update",
|
|
18694
18898
|
STATUS_UPDATE: "community:status.update",
|
|
18899
|
+
IDENTITY_UPDATE: "community:identity.update",
|
|
18900
|
+
PROFILE_UPDATE: "community:profile.update",
|
|
18695
18901
|
MACHINE_CREATED: "community:machine.created",
|
|
18696
18902
|
MACHINE_STATUS: "community:machine.status",
|
|
18697
18903
|
MACHINE_UPDATED: "community:machine.updated",
|
package/dist/session-runner.js
CHANGED
|
@@ -14378,6 +14378,7 @@ var exports_community_machine_schema = {};
|
|
|
14378
14378
|
__export(exports_community_machine_schema, {
|
|
14379
14379
|
communityMachineToken: () => communityMachineToken,
|
|
14380
14380
|
communityMachineCredential: () => communityMachineCredential,
|
|
14381
|
+
communityMachineBackendQuota: () => communityMachineBackendQuota,
|
|
14381
14382
|
communityMachine: () => communityMachine,
|
|
14382
14383
|
communityDiagnosticReport: () => communityDiagnosticReport,
|
|
14383
14384
|
communityBotBinding: () => communityBotBinding,
|
|
@@ -15981,6 +15982,8 @@ var user = sqliteTable("user", {
|
|
|
15981
15982
|
email: text("email").unique().notNull(),
|
|
15982
15983
|
emailVerified: integer2("emailVerified", { mode: "boolean" }),
|
|
15983
15984
|
image: text("image"),
|
|
15985
|
+
avatarVersion: integer2("avatarVersion").notNull().default(0),
|
|
15986
|
+
avatarObjectKey: text("avatarObjectKey"),
|
|
15984
15987
|
createdAt: text("createdAt").notNull().$defaultFn(() => new Date().toISOString()),
|
|
15985
15988
|
updatedAt: text("updatedAt").notNull().$defaultFn(() => new Date().toISOString()),
|
|
15986
15989
|
isBot: integer2("isBot", { mode: "boolean" }).notNull().default(false),
|
|
@@ -16654,8 +16657,23 @@ var communityBotBinding = sqliteTable("community_bot_binding", {
|
|
|
16654
16657
|
runtime: text("runtime").notNull(),
|
|
16655
16658
|
instruction: text("instruction").notNull().default(""),
|
|
16656
16659
|
modelName: text("model_name"),
|
|
16660
|
+
reasoningEffort: text("reasoning_effort"),
|
|
16661
|
+
runtimeConfigRevision: integer2("runtime_config_revision").notNull().default(0),
|
|
16657
16662
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
16658
16663
|
}, (t) => [index("idx_community_bot_binding_machine").on(t.machineId)]);
|
|
16664
|
+
var communityMachineBackendQuota = sqliteTable("community_machine_backend_quota", {
|
|
16665
|
+
machineId: text("machine_id").notNull().references(() => communityMachine.id, { onDelete: "cascade" }),
|
|
16666
|
+
agentBackendId: text("agent_backend_id").$type().notNull(),
|
|
16667
|
+
sourceEpoch: text("source_epoch").notNull(),
|
|
16668
|
+
status: text("status").$type().notNull(),
|
|
16669
|
+
planName: text("plan_name"),
|
|
16670
|
+
freshForSeconds: integer2("fresh_for_seconds"),
|
|
16671
|
+
limits: text("limits", { mode: "json" }).$type(),
|
|
16672
|
+
errorCode: text("error_code"),
|
|
16673
|
+
retryable: integer2("retryable", { mode: "boolean" }),
|
|
16674
|
+
observedAt: text("observed_at").notNull(),
|
|
16675
|
+
updatedAt: text("updated_at").notNull()
|
|
16676
|
+
}, (t) => [primaryKey({ columns: [t.machineId, t.agentBackendId] })]);
|
|
16659
16677
|
var communityAgentRunnerKey = sqliteTable("community_agent_runner_key", {
|
|
16660
16678
|
id: text("id").primaryKey().$defaultFn(() => "crkid_" + nanoid3()),
|
|
16661
16679
|
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
@@ -16727,7 +16745,7 @@ var MAX_PROFILE_ABOUT_LENGTH = 1000;
|
|
|
16727
16745
|
var MAX_MESSAGE_CONTENT_LENGTH = 4000;
|
|
16728
16746
|
var MAX_ATTACHMENTS_PER_MESSAGE = 10;
|
|
16729
16747
|
var MAX_ATTACHMENT_SIZE_BYTES = 25 * 1024 * 1024;
|
|
16730
|
-
var MAX_ATTACHMENT_THUMBNAIL_SIZE_BYTES =
|
|
16748
|
+
var MAX_ATTACHMENT_THUMBNAIL_SIZE_BYTES = 512 * 1024;
|
|
16731
16749
|
var MAX_SERVER_ICON_SIZE_BYTES = 5 * 1024 * 1024;
|
|
16732
16750
|
var ALLOWED_ICON_MIME_TYPES = [
|
|
16733
16751
|
"image/png",
|
|
@@ -16736,6 +16754,92 @@ var ALLOWED_ICON_MIME_TYPES = [
|
|
|
16736
16754
|
"image/gif"
|
|
16737
16755
|
];
|
|
16738
16756
|
var MAX_ICON_SOURCE_FILE_SIZE_BYTES = 15 * 1024 * 1024;
|
|
16757
|
+
// ../shared/src/provider-telemetry.ts
|
|
16758
|
+
var safeToken = exports_external.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
16759
|
+
var boundedText = exports_external.string().min(1).refine((value) => new TextEncoder().encode(value).length <= 64, { message: "must be at most 64 UTF-8 bytes" });
|
|
16760
|
+
var DailyUsageMetricSchema = safeToken.nullable();
|
|
16761
|
+
var DailyUsageSnapshotSchema = exports_external.object({
|
|
16762
|
+
botId: exports_external.string().min(1),
|
|
16763
|
+
day: exports_external.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
16764
|
+
metrics: exports_external.object({
|
|
16765
|
+
input: DailyUsageMetricSchema,
|
|
16766
|
+
output: DailyUsageMetricSchema,
|
|
16767
|
+
cache: DailyUsageMetricSchema
|
|
16768
|
+
}).strict()
|
|
16769
|
+
}).strict();
|
|
16770
|
+
var QuotaProductIdentitySchema = exports_external.discriminatedUnion("kind", [
|
|
16771
|
+
exports_external.object({ kind: exports_external.literal("reported"), id: boundedText, displayName: boundedText }).strict(),
|
|
16772
|
+
exports_external.object({ kind: exports_external.literal("unknown"), displayName: boundedText }).strict()
|
|
16773
|
+
]);
|
|
16774
|
+
var QuotaModelIdentitySchema = exports_external.discriminatedUnion("kind", [
|
|
16775
|
+
exports_external.object({ kind: exports_external.literal("reported"), id: boundedText }).strict(),
|
|
16776
|
+
exports_external.object({ kind: exports_external.literal("not_applicable") }).strict(),
|
|
16777
|
+
exports_external.object({ kind: exports_external.literal("unknown") }).strict()
|
|
16778
|
+
]);
|
|
16779
|
+
var QuotaWindowIdentitySchema = exports_external.discriminatedUnion("kind", [
|
|
16780
|
+
exports_external.object({
|
|
16781
|
+
kind: exports_external.literal("rolling"),
|
|
16782
|
+
durationSeconds: exports_external.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
16783
|
+
displayName: boundedText
|
|
16784
|
+
}).strict(),
|
|
16785
|
+
exports_external.object({
|
|
16786
|
+
kind: exports_external.literal("calendar"),
|
|
16787
|
+
period: exports_external.enum(["day", "week", "month"]),
|
|
16788
|
+
displayName: boundedText
|
|
16789
|
+
}).strict(),
|
|
16790
|
+
exports_external.object({
|
|
16791
|
+
kind: exports_external.literal("provider_defined"),
|
|
16792
|
+
id: boundedText,
|
|
16793
|
+
durationSeconds: exports_external.number().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),
|
|
16794
|
+
displayName: boundedText
|
|
16795
|
+
}).strict()
|
|
16796
|
+
]);
|
|
16797
|
+
var QuotaLimitSchema = exports_external.object({
|
|
16798
|
+
bucket: exports_external.object({
|
|
16799
|
+
limitId: boundedText,
|
|
16800
|
+
product: QuotaProductIdentitySchema,
|
|
16801
|
+
model: QuotaModelIdentitySchema,
|
|
16802
|
+
window: QuotaWindowIdentitySchema
|
|
16803
|
+
}).strict(),
|
|
16804
|
+
usedPercent: exports_external.number().finite().min(0).max(100),
|
|
16805
|
+
resetsAt: exports_external.string().datetime({ offset: true }).optional()
|
|
16806
|
+
}).strict();
|
|
16807
|
+
function quotaIdentity(limit) {
|
|
16808
|
+
const { product, model, window: window2, limitId } = limit.bucket;
|
|
16809
|
+
const productKey = product.kind === "reported" ? `reported:${product.id}` : "unknown";
|
|
16810
|
+
const modelKey = model.kind === "reported" ? `reported:${model.id}` : model.kind;
|
|
16811
|
+
const windowKey = window2.kind === "rolling" ? `rolling:${window2.durationSeconds}` : window2.kind === "calendar" ? `calendar:${window2.period}` : `provider_defined:${window2.id}:${window2.durationSeconds === undefined ? "absent" : window2.durationSeconds}`;
|
|
16812
|
+
return `${productKey}\x00${modelKey}\x00${windowKey}\x00${limitId}`;
|
|
16813
|
+
}
|
|
16814
|
+
var AvailableQuotaObservationSchema = exports_external.object({
|
|
16815
|
+
status: exports_external.literal("available"),
|
|
16816
|
+
sourceEpoch: exports_external.string().regex(/^[A-Za-z0-9_-]{22}$/),
|
|
16817
|
+
planName: boundedText.optional(),
|
|
16818
|
+
freshForSeconds: exports_external.number().int().positive().max(86400),
|
|
16819
|
+
limits: exports_external.array(QuotaLimitSchema).min(1).max(8)
|
|
16820
|
+
}).strict().superRefine((value, ctx) => {
|
|
16821
|
+
const identities = new Set;
|
|
16822
|
+
for (const [index2, limit] of value.limits.entries()) {
|
|
16823
|
+
const identity = quotaIdentity(limit);
|
|
16824
|
+
if (identities.has(identity)) {
|
|
16825
|
+
ctx.addIssue({ code: "custom", message: "duplicate quota bucket identity", path: ["limits", index2] });
|
|
16826
|
+
}
|
|
16827
|
+
identities.add(identity);
|
|
16828
|
+
}
|
|
16829
|
+
});
|
|
16830
|
+
var ProviderQuotaObservationSchema = exports_external.union([
|
|
16831
|
+
AvailableQuotaObservationSchema,
|
|
16832
|
+
exports_external.object({
|
|
16833
|
+
status: exports_external.literal("error"),
|
|
16834
|
+
sourceEpoch: exports_external.string().regex(/^[A-Za-z0-9_-]{22}$/),
|
|
16835
|
+
code: exports_external.enum(["unavailable", "unauthorized", "network", "provider_error", "invalid_response"]),
|
|
16836
|
+
retryable: exports_external.boolean()
|
|
16837
|
+
}).strict()
|
|
16838
|
+
]);
|
|
16839
|
+
var ProviderQuotaSnapshotSchema = exports_external.object({
|
|
16840
|
+
agentBackendId: exports_external.enum(["claude", "codex"]),
|
|
16841
|
+
observation: ProviderQuotaObservationSchema
|
|
16842
|
+
}).strict();
|
|
16739
16843
|
// ../shared/src/utils/slug.ts
|
|
16740
16844
|
init_nanoid();
|
|
16741
16845
|
var slugId = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz");
|
|
@@ -17250,12 +17354,60 @@ var CreateThreadRequestSchema = exports_external.object({
|
|
|
17250
17354
|
attachment_ids: exports_external.array(exports_external.string()).optional()
|
|
17251
17355
|
});
|
|
17252
17356
|
var RUNTIME_ID_RE = /^[A-Za-z0-9._@/-]+$/;
|
|
17357
|
+
var REASONING_EFFORT_RE = /^[A-Za-z0-9._-]+$/;
|
|
17358
|
+
var COMMUNITY_REASONING_EFFORT_MAX = 32;
|
|
17359
|
+
var COMMUNITY_REASONING_DESCRIPTION_MAX = 256;
|
|
17360
|
+
var COMMUNITY_REASONING_OPTIONS_MAX = 16;
|
|
17361
|
+
var COMMUNITY_REASONING_MODELS_MAX = 64;
|
|
17362
|
+
var ReasoningEffortSchema = exports_external.string().min(1).max(COMMUNITY_REASONING_EFFORT_MAX).regex(REASONING_EFFORT_RE, "invalid reasoning effort charset");
|
|
17363
|
+
var RuntimeReasoningOptionSchema = exports_external.object({
|
|
17364
|
+
value: ReasoningEffortSchema,
|
|
17365
|
+
description: exports_external.string().max(COMMUNITY_REASONING_DESCRIPTION_MAX).optional()
|
|
17366
|
+
});
|
|
17367
|
+
var RuntimeReasoningModelSchema = exports_external.object({
|
|
17368
|
+
id: exports_external.string().min(1).max(100),
|
|
17369
|
+
supportedReasoningEfforts: exports_external.array(exports_external.unknown()).max(COMMUNITY_REASONING_OPTIONS_MAX).transform((options) => {
|
|
17370
|
+
const seen = new Set;
|
|
17371
|
+
return options.flatMap((candidate) => {
|
|
17372
|
+
const parsed = RuntimeReasoningOptionSchema.safeParse(candidate);
|
|
17373
|
+
if (!parsed.success)
|
|
17374
|
+
return [];
|
|
17375
|
+
const option = parsed.data;
|
|
17376
|
+
if (seen.has(option.value))
|
|
17377
|
+
return [];
|
|
17378
|
+
seen.add(option.value);
|
|
17379
|
+
return [option];
|
|
17380
|
+
});
|
|
17381
|
+
}),
|
|
17382
|
+
defaultReasoningEffort: ReasoningEffortSchema.optional().catch(undefined)
|
|
17383
|
+
}).transform((model) => {
|
|
17384
|
+
const { defaultReasoningEffort, ...rest } = model;
|
|
17385
|
+
return defaultReasoningEffort !== undefined && model.supportedReasoningEfforts.some((option) => option.value === defaultReasoningEffort) ? { ...rest, defaultReasoningEffort } : rest;
|
|
17386
|
+
});
|
|
17387
|
+
var RuntimeReasoningCatalogSchema = exports_external.object({
|
|
17388
|
+
updateMode: exports_external.enum(["live_next_turn", "context_preserving_restart", "unsupported"]),
|
|
17389
|
+
defaultModelId: exports_external.string().min(1).max(100).optional().catch(undefined),
|
|
17390
|
+
models: exports_external.array(exports_external.unknown()).max(COMMUNITY_REASONING_MODELS_MAX).transform((models) => {
|
|
17391
|
+
const seen = new Set;
|
|
17392
|
+
return models.flatMap((candidate) => {
|
|
17393
|
+
const parsed = RuntimeReasoningModelSchema.safeParse(candidate);
|
|
17394
|
+
if (!parsed.success)
|
|
17395
|
+
return [];
|
|
17396
|
+
const model = parsed.data;
|
|
17397
|
+
if (seen.has(model.id))
|
|
17398
|
+
return [];
|
|
17399
|
+
seen.add(model.id);
|
|
17400
|
+
return [model];
|
|
17401
|
+
});
|
|
17402
|
+
})
|
|
17403
|
+
});
|
|
17253
17404
|
var CommunityMachineRuntimeSchema = exports_external.object({
|
|
17254
17405
|
id: exports_external.string().min(1).max(COMMUNITY_RUNTIME_ID_MAX).regex(RUNTIME_ID_RE, "invalid runtime id charset"),
|
|
17255
17406
|
version: exports_external.string().max(COMMUNITY_RUNTIME_VERSION_MAX).optional(),
|
|
17256
17407
|
status: exports_external.enum(["healthy", "unhealthy"]).catch("healthy").default("healthy"),
|
|
17257
17408
|
lastError: exports_external.string().max(128).optional(),
|
|
17258
|
-
lastErrorAt: exports_external.string().optional()
|
|
17409
|
+
lastErrorAt: exports_external.string().optional(),
|
|
17410
|
+
reasoning: RuntimeReasoningCatalogSchema.optional().catch(undefined)
|
|
17259
17411
|
});
|
|
17260
17412
|
var CommunityMachineRuntimeListSchema = exports_external.array(CommunityMachineRuntimeSchema).max(COMMUNITY_RUNTIME_LIST_MAX).transform((list) => {
|
|
17261
17413
|
const seen = new Set;
|
|
@@ -17307,7 +17459,8 @@ var HostReadyMessageSchema = exports_external.object({
|
|
|
17307
17459
|
platform: exports_external.string().optional(),
|
|
17308
17460
|
arch: exports_external.string().optional(),
|
|
17309
17461
|
osRelease: exports_external.string().optional(),
|
|
17310
|
-
daemonVersion: exports_external.string().optional()
|
|
17462
|
+
daemonVersion: exports_external.string().optional(),
|
|
17463
|
+
providerQuotas: exports_external.array(ProviderQuotaSnapshotSchema).max(2).optional().default([])
|
|
17311
17464
|
});
|
|
17312
17465
|
var CommunityDaemonReadySchema = exports_external.object({
|
|
17313
17466
|
runtimeReport: CommunityMachineRuntimeListSchema.optional(),
|
|
@@ -17328,7 +17481,9 @@ var SessionErrorFrameSchema = exports_external.object({
|
|
|
17328
17481
|
var AgentActivityMessageSchema = exports_external.object({
|
|
17329
17482
|
type: exports_external.literal("agent_activity"),
|
|
17330
17483
|
agentId: exports_external.string(),
|
|
17331
|
-
state: exports_external.enum(["idle", "starting", "running", "stopping"])
|
|
17484
|
+
state: exports_external.enum(["idle", "starting", "running", "stopping"]),
|
|
17485
|
+
dailyUsage: exports_external.array(DailyUsageSnapshotSchema).max(7).optional(),
|
|
17486
|
+
quota: ProviderQuotaSnapshotSchema.optional()
|
|
17332
17487
|
});
|
|
17333
17488
|
var AgentTypingMessageSchema = exports_external.object({
|
|
17334
17489
|
type: exports_external.literal("agent_typing"),
|
|
@@ -17403,15 +17558,17 @@ var CommunityBotCreateRequestSchema = exports_external.object({
|
|
|
17403
17558
|
machineId: exports_external.string().min(1),
|
|
17404
17559
|
runtime: exports_external.string().min(1),
|
|
17405
17560
|
image: BotImageUrlSchema.optional(),
|
|
17406
|
-
model: exports_external.string().trim().min(1).max(100).nullable().optional()
|
|
17561
|
+
model: exports_external.string().trim().min(1).max(100).nullable().optional(),
|
|
17562
|
+
reasoningEffort: ReasoningEffortSchema.nullable().optional()
|
|
17407
17563
|
});
|
|
17408
17564
|
var CommunityBotPatchRequestSchema = exports_external.object({
|
|
17409
17565
|
name: exports_external.string().trim().min(COMMUNITY_BOT_NAME_MIN).max(COMMUNITY_BOT_NAME_MAX).refine(isMentionSafeName, { message: MENTION_SAFE_NAME_MSG }).optional(),
|
|
17410
17566
|
description: exports_external.string().max(COMMUNITY_BOT_DESCRIPTION_MAX).optional(),
|
|
17411
17567
|
image: BotImageUrlSchema.nullable().optional(),
|
|
17412
17568
|
model: exports_external.string().trim().min(1).max(100).nullable().optional(),
|
|
17413
|
-
runtime: exports_external.string().trim().min(1).max(COMMUNITY_RUNTIME_ID_MAX).optional()
|
|
17414
|
-
|
|
17569
|
+
runtime: exports_external.string().trim().min(1).max(COMMUNITY_RUNTIME_ID_MAX).optional(),
|
|
17570
|
+
reasoningEffort: ReasoningEffortSchema.nullable().optional()
|
|
17571
|
+
}).refine((v) => v.name !== undefined || v.description !== undefined || v.image !== undefined || v.runtime !== undefined || ("reasoningEffort" in v) || ("model" in v), {
|
|
17415
17572
|
message: "at least one field must be provided"
|
|
17416
17573
|
});
|
|
17417
17574
|
var CommunityBotAddToServerRequestSchema = exports_external.object({
|
|
@@ -17627,6 +17784,11 @@ var HostCommandSchema = exports_external.discriminatedUnion("type", [
|
|
|
17627
17784
|
config: exports_external.unknown(),
|
|
17628
17785
|
launchId: exports_external.string().min(1)
|
|
17629
17786
|
}),
|
|
17787
|
+
exports_external.object({
|
|
17788
|
+
type: exports_external.literal("agent:runtime_config_update"),
|
|
17789
|
+
agentId: exports_external.string().min(1),
|
|
17790
|
+
config: exports_external.unknown()
|
|
17791
|
+
}),
|
|
17630
17792
|
exports_external.object({
|
|
17631
17793
|
type: exports_external.literal("machine:reset_all"),
|
|
17632
17794
|
resets: exports_external.array(exports_external.object({
|
|
@@ -17685,6 +17847,7 @@ __export(exports_community_schema, {
|
|
|
17685
17847
|
communityChannelMember: () => communityChannelMember,
|
|
17686
17848
|
communityChannel: () => communityChannel,
|
|
17687
17849
|
communityCategory: () => communityCategory,
|
|
17850
|
+
communityBotDailyTokenUsage: () => communityBotDailyTokenUsage,
|
|
17688
17851
|
communityBotDailyActivity: () => communityBotDailyActivity,
|
|
17689
17852
|
communityBotApprovalRequest: () => communityBotApprovalRequest,
|
|
17690
17853
|
communityBotActivityEvent: () => communityBotActivityEvent,
|
|
@@ -17937,6 +18100,17 @@ var communityBotDailyActivity = sqliteTable("community_bot_daily_activity", {
|
|
|
17937
18100
|
handledCount: integer2("handled_count").notNull().default(0),
|
|
17938
18101
|
sentCount: integer2("sent_count").notNull().default(0)
|
|
17939
18102
|
}, (t) => [primaryKey({ columns: [t.botId, t.day] })]);
|
|
18103
|
+
var communityBotDailyTokenUsage = sqliteTable("community_bot_daily_token_usage", {
|
|
18104
|
+
botId: text("bot_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
18105
|
+
day: text("day").notNull(),
|
|
18106
|
+
inputTokens: integer2("input_tokens"),
|
|
18107
|
+
outputTokens: integer2("output_tokens"),
|
|
18108
|
+
cacheTokens: integer2("cache_tokens"),
|
|
18109
|
+
updatedAt: text("updated_at").notNull()
|
|
18110
|
+
}, (t) => [
|
|
18111
|
+
primaryKey({ columns: [t.botId, t.day] }),
|
|
18112
|
+
index("idx_community_bot_daily_token_usage_day").on(t.day)
|
|
18113
|
+
]);
|
|
17940
18114
|
var communityMessageMark = sqliteTable("community_message_mark", {
|
|
17941
18115
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17942
18116
|
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
@@ -18061,7 +18235,8 @@ var listedMessageProjection = {
|
|
|
18061
18235
|
clientNonce: communityMessage.clientNonce,
|
|
18062
18236
|
authorName: user.name,
|
|
18063
18237
|
authorEmail: user.email,
|
|
18064
|
-
authorImage: user.image
|
|
18238
|
+
authorImage: user.image,
|
|
18239
|
+
authorAvatarVersion: user.avatarVersion
|
|
18065
18240
|
};
|
|
18066
18241
|
|
|
18067
18242
|
// ../shared/src/db/queries/user.ts
|
|
@@ -18071,6 +18246,7 @@ var publicUserColumns = {
|
|
|
18071
18246
|
email: user.email,
|
|
18072
18247
|
emailVerified: user.emailVerified,
|
|
18073
18248
|
image: user.image,
|
|
18249
|
+
avatarVersion: user.avatarVersion,
|
|
18074
18250
|
createdAt: user.createdAt,
|
|
18075
18251
|
updatedAt: user.updatedAt,
|
|
18076
18252
|
discriminator: user.discriminator
|
|
@@ -18081,6 +18257,12 @@ var internalUserColumns = {
|
|
|
18081
18257
|
ownerUserId: user.ownerUserId,
|
|
18082
18258
|
deletedAt: user.deletedAt
|
|
18083
18259
|
};
|
|
18260
|
+
var avatarPublishColumns = {
|
|
18261
|
+
id: user.id,
|
|
18262
|
+
image: user.image,
|
|
18263
|
+
avatarVersion: user.avatarVersion,
|
|
18264
|
+
avatarObjectKey: user.avatarObjectKey
|
|
18265
|
+
};
|
|
18084
18266
|
|
|
18085
18267
|
// ../shared/src/db/queries/community/channel.ts
|
|
18086
18268
|
var CHANNEL_COLUMNS = {
|
|
@@ -18133,7 +18315,8 @@ var friendApprovalProfileSchema = exports_external.strictObject({
|
|
|
18133
18315
|
id: string4,
|
|
18134
18316
|
name: string4,
|
|
18135
18317
|
discriminator: string4,
|
|
18136
|
-
image: nullableString
|
|
18318
|
+
image: nullableString,
|
|
18319
|
+
avatarVersion: exports_external.number().int().nonnegative()
|
|
18137
18320
|
});
|
|
18138
18321
|
var FriendApprovalPayloadSchema = exports_external.strictObject({
|
|
18139
18322
|
friendshipId: string4,
|
|
@@ -18159,6 +18342,7 @@ var messageSchema = exports_external.strictObject({
|
|
|
18159
18342
|
authorId: string4,
|
|
18160
18343
|
authorName: string4,
|
|
18161
18344
|
authorAvatar: string4.optional(),
|
|
18345
|
+
authorAvatarVersion: exports_external.number().int().nonnegative(),
|
|
18162
18346
|
content: string4,
|
|
18163
18347
|
type: exports_external.enum(["chat", "system"]),
|
|
18164
18348
|
systemKind: exports_external.literal("thread").optional(),
|
|
@@ -18166,6 +18350,7 @@ var messageSchema = exports_external.strictObject({
|
|
|
18166
18350
|
replyToId: nullableString.optional(),
|
|
18167
18351
|
replyTo: exports_external.strictObject({
|
|
18168
18352
|
id: string4,
|
|
18353
|
+
authorId: string4.optional(),
|
|
18169
18354
|
authorName: string4,
|
|
18170
18355
|
text: string4,
|
|
18171
18356
|
deleted: exports_external.boolean().optional()
|
|
@@ -18360,6 +18545,7 @@ var communityMemberJoinSchema = exports_external.strictObject({
|
|
|
18360
18545
|
name: string4,
|
|
18361
18546
|
discriminator: string4,
|
|
18362
18547
|
avatar: string4.optional(),
|
|
18548
|
+
avatarVersion: exports_external.number().int().nonnegative(),
|
|
18363
18549
|
role: string4,
|
|
18364
18550
|
joinedAt: string4
|
|
18365
18551
|
})
|
|
@@ -18462,6 +18648,22 @@ var communityStatusUpdateSchema = exports_external.strictObject({
|
|
|
18462
18648
|
statusEmoji: nullableString,
|
|
18463
18649
|
statusText: nullableString
|
|
18464
18650
|
});
|
|
18651
|
+
var communityIdentityUpdateSchema = exports_external.strictObject({
|
|
18652
|
+
type: exports_external.literal("community:identity.update"),
|
|
18653
|
+
userId: string4,
|
|
18654
|
+
avatar: string4,
|
|
18655
|
+
avatarVersion: exports_external.number().int().positive()
|
|
18656
|
+
});
|
|
18657
|
+
var communityProfileUpdateSchema = exports_external.strictObject({
|
|
18658
|
+
type: exports_external.literal("community:profile.update"),
|
|
18659
|
+
userId: string4,
|
|
18660
|
+
name: string4,
|
|
18661
|
+
discriminator: string4,
|
|
18662
|
+
aboutMe: string4,
|
|
18663
|
+
bannerColor: nullableString,
|
|
18664
|
+
kind: exports_external.enum(["human", "bot"]),
|
|
18665
|
+
ownerUserId: nullableString
|
|
18666
|
+
});
|
|
18465
18667
|
var machineRuntimeSchema = CommunityMachineRuntimeSchema.strict();
|
|
18466
18668
|
var CommunityMachineSummarySchema2 = exports_external.strictObject({
|
|
18467
18669
|
id: string4,
|
|
@@ -18550,6 +18752,8 @@ var CommunityWsEventDiscriminatedSchema = exports_external.discriminatedUnion("t
|
|
|
18550
18752
|
communityInboxChangedSchema,
|
|
18551
18753
|
communityPresenceUpdateSchema,
|
|
18552
18754
|
communityStatusUpdateSchema,
|
|
18755
|
+
communityIdentityUpdateSchema,
|
|
18756
|
+
communityProfileUpdateSchema,
|
|
18553
18757
|
communityMachineCreatedSchema,
|
|
18554
18758
|
communityMachineStatusSchema,
|
|
18555
18759
|
communityMachineUpdatedSchema,
|
|
@@ -18596,6 +18800,8 @@ var WS_EVENTS = {
|
|
|
18596
18800
|
INBOX_CHANGED: "community:inbox.changed",
|
|
18597
18801
|
PRESENCE_UPDATE: "community:presence.update",
|
|
18598
18802
|
STATUS_UPDATE: "community:status.update",
|
|
18803
|
+
IDENTITY_UPDATE: "community:identity.update",
|
|
18804
|
+
PROFILE_UPDATE: "community:profile.update",
|
|
18599
18805
|
MACHINE_CREATED: "community:machine.created",
|
|
18600
18806
|
MACHINE_STATUS: "community:machine.status",
|
|
18601
18807
|
MACHINE_UPDATED: "community:machine.updated",
|