@alook/cli 0.1.24 → 0.1.26
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 +216 -9
- package/dist/session-runner.js +216 -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,61 @@ 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 = 512;
|
|
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
|
+
displayName: exports_external.string().min(1).max(COMMUNITY_REASONING_DESCRIPTION_MAX).optional().catch(undefined),
|
|
17466
|
+
supportedReasoningEfforts: exports_external.array(exports_external.unknown()).max(COMMUNITY_REASONING_OPTIONS_MAX).transform((options) => {
|
|
17467
|
+
const seen = new Set;
|
|
17468
|
+
return options.flatMap((candidate) => {
|
|
17469
|
+
const parsed = RuntimeReasoningOptionSchema.safeParse(candidate);
|
|
17470
|
+
if (!parsed.success)
|
|
17471
|
+
return [];
|
|
17472
|
+
const option = parsed.data;
|
|
17473
|
+
if (seen.has(option.value))
|
|
17474
|
+
return [];
|
|
17475
|
+
seen.add(option.value);
|
|
17476
|
+
return [option];
|
|
17477
|
+
});
|
|
17478
|
+
}),
|
|
17479
|
+
defaultReasoningEffort: ReasoningEffortSchema.optional().catch(undefined)
|
|
17480
|
+
}).transform((model) => {
|
|
17481
|
+
const { defaultReasoningEffort, ...rest } = model;
|
|
17482
|
+
return defaultReasoningEffort !== undefined && model.supportedReasoningEfforts.some((option) => option.value === defaultReasoningEffort) ? { ...rest, defaultReasoningEffort } : rest;
|
|
17483
|
+
});
|
|
17484
|
+
var RuntimeReasoningCatalogSchema = exports_external.object({
|
|
17485
|
+
updateMode: exports_external.enum(["live_next_turn", "context_preserving_restart", "unsupported"]),
|
|
17486
|
+
defaultModelId: exports_external.string().min(1).max(100).optional().catch(undefined),
|
|
17487
|
+
models: exports_external.array(exports_external.unknown()).max(COMMUNITY_REASONING_MODELS_MAX).transform((models) => {
|
|
17488
|
+
const seen = new Set;
|
|
17489
|
+
return models.flatMap((candidate) => {
|
|
17490
|
+
const parsed = RuntimeReasoningModelSchema.safeParse(candidate);
|
|
17491
|
+
if (!parsed.success)
|
|
17492
|
+
return [];
|
|
17493
|
+
const model = parsed.data;
|
|
17494
|
+
if (seen.has(model.id))
|
|
17495
|
+
return [];
|
|
17496
|
+
seen.add(model.id);
|
|
17497
|
+
return [model];
|
|
17498
|
+
});
|
|
17499
|
+
})
|
|
17500
|
+
});
|
|
17349
17501
|
var CommunityMachineRuntimeSchema = exports_external.object({
|
|
17350
17502
|
id: exports_external.string().min(1).max(COMMUNITY_RUNTIME_ID_MAX).regex(RUNTIME_ID_RE, "invalid runtime id charset"),
|
|
17351
17503
|
version: exports_external.string().max(COMMUNITY_RUNTIME_VERSION_MAX).optional(),
|
|
17352
17504
|
status: exports_external.enum(["healthy", "unhealthy"]).catch("healthy").default("healthy"),
|
|
17353
17505
|
lastError: exports_external.string().max(128).optional(),
|
|
17354
|
-
lastErrorAt: exports_external.string().optional()
|
|
17506
|
+
lastErrorAt: exports_external.string().optional(),
|
|
17507
|
+
reasoning: RuntimeReasoningCatalogSchema.optional().catch(undefined)
|
|
17355
17508
|
});
|
|
17356
17509
|
var CommunityMachineRuntimeListSchema = exports_external.array(CommunityMachineRuntimeSchema).max(COMMUNITY_RUNTIME_LIST_MAX).transform((list) => {
|
|
17357
17510
|
const seen = new Set;
|
|
@@ -17403,7 +17556,8 @@ var HostReadyMessageSchema = exports_external.object({
|
|
|
17403
17556
|
platform: exports_external.string().optional(),
|
|
17404
17557
|
arch: exports_external.string().optional(),
|
|
17405
17558
|
osRelease: exports_external.string().optional(),
|
|
17406
|
-
daemonVersion: exports_external.string().optional()
|
|
17559
|
+
daemonVersion: exports_external.string().optional(),
|
|
17560
|
+
providerQuotas: exports_external.array(ProviderQuotaSnapshotSchema).max(2).optional().default([])
|
|
17407
17561
|
});
|
|
17408
17562
|
var CommunityDaemonReadySchema = exports_external.object({
|
|
17409
17563
|
runtimeReport: CommunityMachineRuntimeListSchema.optional(),
|
|
@@ -17424,7 +17578,9 @@ var SessionErrorFrameSchema = exports_external.object({
|
|
|
17424
17578
|
var AgentActivityMessageSchema = exports_external.object({
|
|
17425
17579
|
type: exports_external.literal("agent_activity"),
|
|
17426
17580
|
agentId: exports_external.string(),
|
|
17427
|
-
state: exports_external.enum(["idle", "starting", "running", "stopping"])
|
|
17581
|
+
state: exports_external.enum(["idle", "starting", "running", "stopping"]),
|
|
17582
|
+
dailyUsage: exports_external.array(DailyUsageSnapshotSchema).max(7).optional(),
|
|
17583
|
+
quota: ProviderQuotaSnapshotSchema.optional()
|
|
17428
17584
|
});
|
|
17429
17585
|
var AgentTypingMessageSchema = exports_external.object({
|
|
17430
17586
|
type: exports_external.literal("agent_typing"),
|
|
@@ -17499,15 +17655,17 @@ var CommunityBotCreateRequestSchema = exports_external.object({
|
|
|
17499
17655
|
machineId: exports_external.string().min(1),
|
|
17500
17656
|
runtime: exports_external.string().min(1),
|
|
17501
17657
|
image: BotImageUrlSchema.optional(),
|
|
17502
|
-
model: exports_external.string().trim().min(1).max(100).nullable().optional()
|
|
17658
|
+
model: exports_external.string().trim().min(1).max(100).nullable().optional(),
|
|
17659
|
+
reasoningEffort: ReasoningEffortSchema.nullable().optional()
|
|
17503
17660
|
});
|
|
17504
17661
|
var CommunityBotPatchRequestSchema = exports_external.object({
|
|
17505
17662
|
name: exports_external.string().trim().min(COMMUNITY_BOT_NAME_MIN).max(COMMUNITY_BOT_NAME_MAX).refine(isMentionSafeName, { message: MENTION_SAFE_NAME_MSG }).optional(),
|
|
17506
17663
|
description: exports_external.string().max(COMMUNITY_BOT_DESCRIPTION_MAX).optional(),
|
|
17507
17664
|
image: BotImageUrlSchema.nullable().optional(),
|
|
17508
17665
|
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
|
-
|
|
17666
|
+
runtime: exports_external.string().trim().min(1).max(COMMUNITY_RUNTIME_ID_MAX).optional(),
|
|
17667
|
+
reasoningEffort: ReasoningEffortSchema.nullable().optional()
|
|
17668
|
+
}).refine((v) => v.name !== undefined || v.description !== undefined || v.image !== undefined || v.runtime !== undefined || ("reasoningEffort" in v) || ("model" in v), {
|
|
17511
17669
|
message: "at least one field must be provided"
|
|
17512
17670
|
});
|
|
17513
17671
|
var CommunityBotAddToServerRequestSchema = exports_external.object({
|
|
@@ -17723,6 +17881,11 @@ var HostCommandSchema = exports_external.discriminatedUnion("type", [
|
|
|
17723
17881
|
config: exports_external.unknown(),
|
|
17724
17882
|
launchId: exports_external.string().min(1)
|
|
17725
17883
|
}),
|
|
17884
|
+
exports_external.object({
|
|
17885
|
+
type: exports_external.literal("agent:runtime_config_update"),
|
|
17886
|
+
agentId: exports_external.string().min(1),
|
|
17887
|
+
config: exports_external.unknown()
|
|
17888
|
+
}),
|
|
17726
17889
|
exports_external.object({
|
|
17727
17890
|
type: exports_external.literal("machine:reset_all"),
|
|
17728
17891
|
resets: exports_external.array(exports_external.object({
|
|
@@ -17781,6 +17944,7 @@ __export(exports_community_schema, {
|
|
|
17781
17944
|
communityChannelMember: () => communityChannelMember,
|
|
17782
17945
|
communityChannel: () => communityChannel,
|
|
17783
17946
|
communityCategory: () => communityCategory,
|
|
17947
|
+
communityBotDailyTokenUsage: () => communityBotDailyTokenUsage,
|
|
17784
17948
|
communityBotDailyActivity: () => communityBotDailyActivity,
|
|
17785
17949
|
communityBotApprovalRequest: () => communityBotApprovalRequest,
|
|
17786
17950
|
communityBotActivityEvent: () => communityBotActivityEvent,
|
|
@@ -18033,6 +18197,17 @@ var communityBotDailyActivity = sqliteTable("community_bot_daily_activity", {
|
|
|
18033
18197
|
handledCount: integer2("handled_count").notNull().default(0),
|
|
18034
18198
|
sentCount: integer2("sent_count").notNull().default(0)
|
|
18035
18199
|
}, (t) => [primaryKey({ columns: [t.botId, t.day] })]);
|
|
18200
|
+
var communityBotDailyTokenUsage = sqliteTable("community_bot_daily_token_usage", {
|
|
18201
|
+
botId: text("bot_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
18202
|
+
day: text("day").notNull(),
|
|
18203
|
+
inputTokens: integer2("input_tokens"),
|
|
18204
|
+
outputTokens: integer2("output_tokens"),
|
|
18205
|
+
cacheTokens: integer2("cache_tokens"),
|
|
18206
|
+
updatedAt: text("updated_at").notNull()
|
|
18207
|
+
}, (t) => [
|
|
18208
|
+
primaryKey({ columns: [t.botId, t.day] }),
|
|
18209
|
+
index("idx_community_bot_daily_token_usage_day").on(t.day)
|
|
18210
|
+
]);
|
|
18036
18211
|
var communityMessageMark = sqliteTable("community_message_mark", {
|
|
18037
18212
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
18038
18213
|
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
@@ -18157,7 +18332,8 @@ var listedMessageProjection = {
|
|
|
18157
18332
|
clientNonce: communityMessage.clientNonce,
|
|
18158
18333
|
authorName: user.name,
|
|
18159
18334
|
authorEmail: user.email,
|
|
18160
|
-
authorImage: user.image
|
|
18335
|
+
authorImage: user.image,
|
|
18336
|
+
authorAvatarVersion: user.avatarVersion
|
|
18161
18337
|
};
|
|
18162
18338
|
|
|
18163
18339
|
// ../shared/src/db/queries/user.ts
|
|
@@ -18167,6 +18343,7 @@ var publicUserColumns = {
|
|
|
18167
18343
|
email: user.email,
|
|
18168
18344
|
emailVerified: user.emailVerified,
|
|
18169
18345
|
image: user.image,
|
|
18346
|
+
avatarVersion: user.avatarVersion,
|
|
18170
18347
|
createdAt: user.createdAt,
|
|
18171
18348
|
updatedAt: user.updatedAt,
|
|
18172
18349
|
discriminator: user.discriminator
|
|
@@ -18177,6 +18354,12 @@ var internalUserColumns = {
|
|
|
18177
18354
|
ownerUserId: user.ownerUserId,
|
|
18178
18355
|
deletedAt: user.deletedAt
|
|
18179
18356
|
};
|
|
18357
|
+
var avatarPublishColumns = {
|
|
18358
|
+
id: user.id,
|
|
18359
|
+
image: user.image,
|
|
18360
|
+
avatarVersion: user.avatarVersion,
|
|
18361
|
+
avatarObjectKey: user.avatarObjectKey
|
|
18362
|
+
};
|
|
18180
18363
|
|
|
18181
18364
|
// ../shared/src/db/queries/community/channel.ts
|
|
18182
18365
|
var CHANNEL_COLUMNS = {
|
|
@@ -18229,7 +18412,8 @@ var friendApprovalProfileSchema = exports_external.strictObject({
|
|
|
18229
18412
|
id: string4,
|
|
18230
18413
|
name: string4,
|
|
18231
18414
|
discriminator: string4,
|
|
18232
|
-
image: nullableString
|
|
18415
|
+
image: nullableString,
|
|
18416
|
+
avatarVersion: exports_external.number().int().nonnegative()
|
|
18233
18417
|
});
|
|
18234
18418
|
var FriendApprovalPayloadSchema = exports_external.strictObject({
|
|
18235
18419
|
friendshipId: string4,
|
|
@@ -18255,6 +18439,7 @@ var messageSchema = exports_external.strictObject({
|
|
|
18255
18439
|
authorId: string4,
|
|
18256
18440
|
authorName: string4,
|
|
18257
18441
|
authorAvatar: string4.optional(),
|
|
18442
|
+
authorAvatarVersion: exports_external.number().int().nonnegative(),
|
|
18258
18443
|
content: string4,
|
|
18259
18444
|
type: exports_external.enum(["chat", "system"]),
|
|
18260
18445
|
systemKind: exports_external.literal("thread").optional(),
|
|
@@ -18262,6 +18447,7 @@ var messageSchema = exports_external.strictObject({
|
|
|
18262
18447
|
replyToId: nullableString.optional(),
|
|
18263
18448
|
replyTo: exports_external.strictObject({
|
|
18264
18449
|
id: string4,
|
|
18450
|
+
authorId: string4.optional(),
|
|
18265
18451
|
authorName: string4,
|
|
18266
18452
|
text: string4,
|
|
18267
18453
|
deleted: exports_external.boolean().optional()
|
|
@@ -18456,6 +18642,7 @@ var communityMemberJoinSchema = exports_external.strictObject({
|
|
|
18456
18642
|
name: string4,
|
|
18457
18643
|
discriminator: string4,
|
|
18458
18644
|
avatar: string4.optional(),
|
|
18645
|
+
avatarVersion: exports_external.number().int().nonnegative(),
|
|
18459
18646
|
role: string4,
|
|
18460
18647
|
joinedAt: string4
|
|
18461
18648
|
})
|
|
@@ -18558,6 +18745,22 @@ var communityStatusUpdateSchema = exports_external.strictObject({
|
|
|
18558
18745
|
statusEmoji: nullableString,
|
|
18559
18746
|
statusText: nullableString
|
|
18560
18747
|
});
|
|
18748
|
+
var communityIdentityUpdateSchema = exports_external.strictObject({
|
|
18749
|
+
type: exports_external.literal("community:identity.update"),
|
|
18750
|
+
userId: string4,
|
|
18751
|
+
avatar: string4,
|
|
18752
|
+
avatarVersion: exports_external.number().int().positive()
|
|
18753
|
+
});
|
|
18754
|
+
var communityProfileUpdateSchema = exports_external.strictObject({
|
|
18755
|
+
type: exports_external.literal("community:profile.update"),
|
|
18756
|
+
userId: string4,
|
|
18757
|
+
name: string4,
|
|
18758
|
+
discriminator: string4,
|
|
18759
|
+
aboutMe: string4,
|
|
18760
|
+
bannerColor: nullableString,
|
|
18761
|
+
kind: exports_external.enum(["human", "bot"]),
|
|
18762
|
+
ownerUserId: nullableString
|
|
18763
|
+
});
|
|
18561
18764
|
var machineRuntimeSchema = CommunityMachineRuntimeSchema.strict();
|
|
18562
18765
|
var CommunityMachineSummarySchema2 = exports_external.strictObject({
|
|
18563
18766
|
id: string4,
|
|
@@ -18646,6 +18849,8 @@ var CommunityWsEventDiscriminatedSchema = exports_external.discriminatedUnion("t
|
|
|
18646
18849
|
communityInboxChangedSchema,
|
|
18647
18850
|
communityPresenceUpdateSchema,
|
|
18648
18851
|
communityStatusUpdateSchema,
|
|
18852
|
+
communityIdentityUpdateSchema,
|
|
18853
|
+
communityProfileUpdateSchema,
|
|
18649
18854
|
communityMachineCreatedSchema,
|
|
18650
18855
|
communityMachineStatusSchema,
|
|
18651
18856
|
communityMachineUpdatedSchema,
|
|
@@ -18692,6 +18897,8 @@ var WS_EVENTS = {
|
|
|
18692
18897
|
INBOX_CHANGED: "community:inbox.changed",
|
|
18693
18898
|
PRESENCE_UPDATE: "community:presence.update",
|
|
18694
18899
|
STATUS_UPDATE: "community:status.update",
|
|
18900
|
+
IDENTITY_UPDATE: "community:identity.update",
|
|
18901
|
+
PROFILE_UPDATE: "community:profile.update",
|
|
18695
18902
|
MACHINE_CREATED: "community:machine.created",
|
|
18696
18903
|
MACHINE_STATUS: "community:machine.status",
|
|
18697
18904
|
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,61 @@ 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 = 512;
|
|
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
|
+
displayName: exports_external.string().min(1).max(COMMUNITY_REASONING_DESCRIPTION_MAX).optional().catch(undefined),
|
|
17370
|
+
supportedReasoningEfforts: exports_external.array(exports_external.unknown()).max(COMMUNITY_REASONING_OPTIONS_MAX).transform((options) => {
|
|
17371
|
+
const seen = new Set;
|
|
17372
|
+
return options.flatMap((candidate) => {
|
|
17373
|
+
const parsed = RuntimeReasoningOptionSchema.safeParse(candidate);
|
|
17374
|
+
if (!parsed.success)
|
|
17375
|
+
return [];
|
|
17376
|
+
const option = parsed.data;
|
|
17377
|
+
if (seen.has(option.value))
|
|
17378
|
+
return [];
|
|
17379
|
+
seen.add(option.value);
|
|
17380
|
+
return [option];
|
|
17381
|
+
});
|
|
17382
|
+
}),
|
|
17383
|
+
defaultReasoningEffort: ReasoningEffortSchema.optional().catch(undefined)
|
|
17384
|
+
}).transform((model) => {
|
|
17385
|
+
const { defaultReasoningEffort, ...rest } = model;
|
|
17386
|
+
return defaultReasoningEffort !== undefined && model.supportedReasoningEfforts.some((option) => option.value === defaultReasoningEffort) ? { ...rest, defaultReasoningEffort } : rest;
|
|
17387
|
+
});
|
|
17388
|
+
var RuntimeReasoningCatalogSchema = exports_external.object({
|
|
17389
|
+
updateMode: exports_external.enum(["live_next_turn", "context_preserving_restart", "unsupported"]),
|
|
17390
|
+
defaultModelId: exports_external.string().min(1).max(100).optional().catch(undefined),
|
|
17391
|
+
models: exports_external.array(exports_external.unknown()).max(COMMUNITY_REASONING_MODELS_MAX).transform((models) => {
|
|
17392
|
+
const seen = new Set;
|
|
17393
|
+
return models.flatMap((candidate) => {
|
|
17394
|
+
const parsed = RuntimeReasoningModelSchema.safeParse(candidate);
|
|
17395
|
+
if (!parsed.success)
|
|
17396
|
+
return [];
|
|
17397
|
+
const model = parsed.data;
|
|
17398
|
+
if (seen.has(model.id))
|
|
17399
|
+
return [];
|
|
17400
|
+
seen.add(model.id);
|
|
17401
|
+
return [model];
|
|
17402
|
+
});
|
|
17403
|
+
})
|
|
17404
|
+
});
|
|
17253
17405
|
var CommunityMachineRuntimeSchema = exports_external.object({
|
|
17254
17406
|
id: exports_external.string().min(1).max(COMMUNITY_RUNTIME_ID_MAX).regex(RUNTIME_ID_RE, "invalid runtime id charset"),
|
|
17255
17407
|
version: exports_external.string().max(COMMUNITY_RUNTIME_VERSION_MAX).optional(),
|
|
17256
17408
|
status: exports_external.enum(["healthy", "unhealthy"]).catch("healthy").default("healthy"),
|
|
17257
17409
|
lastError: exports_external.string().max(128).optional(),
|
|
17258
|
-
lastErrorAt: exports_external.string().optional()
|
|
17410
|
+
lastErrorAt: exports_external.string().optional(),
|
|
17411
|
+
reasoning: RuntimeReasoningCatalogSchema.optional().catch(undefined)
|
|
17259
17412
|
});
|
|
17260
17413
|
var CommunityMachineRuntimeListSchema = exports_external.array(CommunityMachineRuntimeSchema).max(COMMUNITY_RUNTIME_LIST_MAX).transform((list) => {
|
|
17261
17414
|
const seen = new Set;
|
|
@@ -17307,7 +17460,8 @@ var HostReadyMessageSchema = exports_external.object({
|
|
|
17307
17460
|
platform: exports_external.string().optional(),
|
|
17308
17461
|
arch: exports_external.string().optional(),
|
|
17309
17462
|
osRelease: exports_external.string().optional(),
|
|
17310
|
-
daemonVersion: exports_external.string().optional()
|
|
17463
|
+
daemonVersion: exports_external.string().optional(),
|
|
17464
|
+
providerQuotas: exports_external.array(ProviderQuotaSnapshotSchema).max(2).optional().default([])
|
|
17311
17465
|
});
|
|
17312
17466
|
var CommunityDaemonReadySchema = exports_external.object({
|
|
17313
17467
|
runtimeReport: CommunityMachineRuntimeListSchema.optional(),
|
|
@@ -17328,7 +17482,9 @@ var SessionErrorFrameSchema = exports_external.object({
|
|
|
17328
17482
|
var AgentActivityMessageSchema = exports_external.object({
|
|
17329
17483
|
type: exports_external.literal("agent_activity"),
|
|
17330
17484
|
agentId: exports_external.string(),
|
|
17331
|
-
state: exports_external.enum(["idle", "starting", "running", "stopping"])
|
|
17485
|
+
state: exports_external.enum(["idle", "starting", "running", "stopping"]),
|
|
17486
|
+
dailyUsage: exports_external.array(DailyUsageSnapshotSchema).max(7).optional(),
|
|
17487
|
+
quota: ProviderQuotaSnapshotSchema.optional()
|
|
17332
17488
|
});
|
|
17333
17489
|
var AgentTypingMessageSchema = exports_external.object({
|
|
17334
17490
|
type: exports_external.literal("agent_typing"),
|
|
@@ -17403,15 +17559,17 @@ var CommunityBotCreateRequestSchema = exports_external.object({
|
|
|
17403
17559
|
machineId: exports_external.string().min(1),
|
|
17404
17560
|
runtime: exports_external.string().min(1),
|
|
17405
17561
|
image: BotImageUrlSchema.optional(),
|
|
17406
|
-
model: exports_external.string().trim().min(1).max(100).nullable().optional()
|
|
17562
|
+
model: exports_external.string().trim().min(1).max(100).nullable().optional(),
|
|
17563
|
+
reasoningEffort: ReasoningEffortSchema.nullable().optional()
|
|
17407
17564
|
});
|
|
17408
17565
|
var CommunityBotPatchRequestSchema = exports_external.object({
|
|
17409
17566
|
name: exports_external.string().trim().min(COMMUNITY_BOT_NAME_MIN).max(COMMUNITY_BOT_NAME_MAX).refine(isMentionSafeName, { message: MENTION_SAFE_NAME_MSG }).optional(),
|
|
17410
17567
|
description: exports_external.string().max(COMMUNITY_BOT_DESCRIPTION_MAX).optional(),
|
|
17411
17568
|
image: BotImageUrlSchema.nullable().optional(),
|
|
17412
17569
|
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
|
-
|
|
17570
|
+
runtime: exports_external.string().trim().min(1).max(COMMUNITY_RUNTIME_ID_MAX).optional(),
|
|
17571
|
+
reasoningEffort: ReasoningEffortSchema.nullable().optional()
|
|
17572
|
+
}).refine((v) => v.name !== undefined || v.description !== undefined || v.image !== undefined || v.runtime !== undefined || ("reasoningEffort" in v) || ("model" in v), {
|
|
17415
17573
|
message: "at least one field must be provided"
|
|
17416
17574
|
});
|
|
17417
17575
|
var CommunityBotAddToServerRequestSchema = exports_external.object({
|
|
@@ -17627,6 +17785,11 @@ var HostCommandSchema = exports_external.discriminatedUnion("type", [
|
|
|
17627
17785
|
config: exports_external.unknown(),
|
|
17628
17786
|
launchId: exports_external.string().min(1)
|
|
17629
17787
|
}),
|
|
17788
|
+
exports_external.object({
|
|
17789
|
+
type: exports_external.literal("agent:runtime_config_update"),
|
|
17790
|
+
agentId: exports_external.string().min(1),
|
|
17791
|
+
config: exports_external.unknown()
|
|
17792
|
+
}),
|
|
17630
17793
|
exports_external.object({
|
|
17631
17794
|
type: exports_external.literal("machine:reset_all"),
|
|
17632
17795
|
resets: exports_external.array(exports_external.object({
|
|
@@ -17685,6 +17848,7 @@ __export(exports_community_schema, {
|
|
|
17685
17848
|
communityChannelMember: () => communityChannelMember,
|
|
17686
17849
|
communityChannel: () => communityChannel,
|
|
17687
17850
|
communityCategory: () => communityCategory,
|
|
17851
|
+
communityBotDailyTokenUsage: () => communityBotDailyTokenUsage,
|
|
17688
17852
|
communityBotDailyActivity: () => communityBotDailyActivity,
|
|
17689
17853
|
communityBotApprovalRequest: () => communityBotApprovalRequest,
|
|
17690
17854
|
communityBotActivityEvent: () => communityBotActivityEvent,
|
|
@@ -17937,6 +18101,17 @@ var communityBotDailyActivity = sqliteTable("community_bot_daily_activity", {
|
|
|
17937
18101
|
handledCount: integer2("handled_count").notNull().default(0),
|
|
17938
18102
|
sentCount: integer2("sent_count").notNull().default(0)
|
|
17939
18103
|
}, (t) => [primaryKey({ columns: [t.botId, t.day] })]);
|
|
18104
|
+
var communityBotDailyTokenUsage = sqliteTable("community_bot_daily_token_usage", {
|
|
18105
|
+
botId: text("bot_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
18106
|
+
day: text("day").notNull(),
|
|
18107
|
+
inputTokens: integer2("input_tokens"),
|
|
18108
|
+
outputTokens: integer2("output_tokens"),
|
|
18109
|
+
cacheTokens: integer2("cache_tokens"),
|
|
18110
|
+
updatedAt: text("updated_at").notNull()
|
|
18111
|
+
}, (t) => [
|
|
18112
|
+
primaryKey({ columns: [t.botId, t.day] }),
|
|
18113
|
+
index("idx_community_bot_daily_token_usage_day").on(t.day)
|
|
18114
|
+
]);
|
|
17940
18115
|
var communityMessageMark = sqliteTable("community_message_mark", {
|
|
17941
18116
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17942
18117
|
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
@@ -18061,7 +18236,8 @@ var listedMessageProjection = {
|
|
|
18061
18236
|
clientNonce: communityMessage.clientNonce,
|
|
18062
18237
|
authorName: user.name,
|
|
18063
18238
|
authorEmail: user.email,
|
|
18064
|
-
authorImage: user.image
|
|
18239
|
+
authorImage: user.image,
|
|
18240
|
+
authorAvatarVersion: user.avatarVersion
|
|
18065
18241
|
};
|
|
18066
18242
|
|
|
18067
18243
|
// ../shared/src/db/queries/user.ts
|
|
@@ -18071,6 +18247,7 @@ var publicUserColumns = {
|
|
|
18071
18247
|
email: user.email,
|
|
18072
18248
|
emailVerified: user.emailVerified,
|
|
18073
18249
|
image: user.image,
|
|
18250
|
+
avatarVersion: user.avatarVersion,
|
|
18074
18251
|
createdAt: user.createdAt,
|
|
18075
18252
|
updatedAt: user.updatedAt,
|
|
18076
18253
|
discriminator: user.discriminator
|
|
@@ -18081,6 +18258,12 @@ var internalUserColumns = {
|
|
|
18081
18258
|
ownerUserId: user.ownerUserId,
|
|
18082
18259
|
deletedAt: user.deletedAt
|
|
18083
18260
|
};
|
|
18261
|
+
var avatarPublishColumns = {
|
|
18262
|
+
id: user.id,
|
|
18263
|
+
image: user.image,
|
|
18264
|
+
avatarVersion: user.avatarVersion,
|
|
18265
|
+
avatarObjectKey: user.avatarObjectKey
|
|
18266
|
+
};
|
|
18084
18267
|
|
|
18085
18268
|
// ../shared/src/db/queries/community/channel.ts
|
|
18086
18269
|
var CHANNEL_COLUMNS = {
|
|
@@ -18133,7 +18316,8 @@ var friendApprovalProfileSchema = exports_external.strictObject({
|
|
|
18133
18316
|
id: string4,
|
|
18134
18317
|
name: string4,
|
|
18135
18318
|
discriminator: string4,
|
|
18136
|
-
image: nullableString
|
|
18319
|
+
image: nullableString,
|
|
18320
|
+
avatarVersion: exports_external.number().int().nonnegative()
|
|
18137
18321
|
});
|
|
18138
18322
|
var FriendApprovalPayloadSchema = exports_external.strictObject({
|
|
18139
18323
|
friendshipId: string4,
|
|
@@ -18159,6 +18343,7 @@ var messageSchema = exports_external.strictObject({
|
|
|
18159
18343
|
authorId: string4,
|
|
18160
18344
|
authorName: string4,
|
|
18161
18345
|
authorAvatar: string4.optional(),
|
|
18346
|
+
authorAvatarVersion: exports_external.number().int().nonnegative(),
|
|
18162
18347
|
content: string4,
|
|
18163
18348
|
type: exports_external.enum(["chat", "system"]),
|
|
18164
18349
|
systemKind: exports_external.literal("thread").optional(),
|
|
@@ -18166,6 +18351,7 @@ var messageSchema = exports_external.strictObject({
|
|
|
18166
18351
|
replyToId: nullableString.optional(),
|
|
18167
18352
|
replyTo: exports_external.strictObject({
|
|
18168
18353
|
id: string4,
|
|
18354
|
+
authorId: string4.optional(),
|
|
18169
18355
|
authorName: string4,
|
|
18170
18356
|
text: string4,
|
|
18171
18357
|
deleted: exports_external.boolean().optional()
|
|
@@ -18360,6 +18546,7 @@ var communityMemberJoinSchema = exports_external.strictObject({
|
|
|
18360
18546
|
name: string4,
|
|
18361
18547
|
discriminator: string4,
|
|
18362
18548
|
avatar: string4.optional(),
|
|
18549
|
+
avatarVersion: exports_external.number().int().nonnegative(),
|
|
18363
18550
|
role: string4,
|
|
18364
18551
|
joinedAt: string4
|
|
18365
18552
|
})
|
|
@@ -18462,6 +18649,22 @@ var communityStatusUpdateSchema = exports_external.strictObject({
|
|
|
18462
18649
|
statusEmoji: nullableString,
|
|
18463
18650
|
statusText: nullableString
|
|
18464
18651
|
});
|
|
18652
|
+
var communityIdentityUpdateSchema = exports_external.strictObject({
|
|
18653
|
+
type: exports_external.literal("community:identity.update"),
|
|
18654
|
+
userId: string4,
|
|
18655
|
+
avatar: string4,
|
|
18656
|
+
avatarVersion: exports_external.number().int().positive()
|
|
18657
|
+
});
|
|
18658
|
+
var communityProfileUpdateSchema = exports_external.strictObject({
|
|
18659
|
+
type: exports_external.literal("community:profile.update"),
|
|
18660
|
+
userId: string4,
|
|
18661
|
+
name: string4,
|
|
18662
|
+
discriminator: string4,
|
|
18663
|
+
aboutMe: string4,
|
|
18664
|
+
bannerColor: nullableString,
|
|
18665
|
+
kind: exports_external.enum(["human", "bot"]),
|
|
18666
|
+
ownerUserId: nullableString
|
|
18667
|
+
});
|
|
18465
18668
|
var machineRuntimeSchema = CommunityMachineRuntimeSchema.strict();
|
|
18466
18669
|
var CommunityMachineSummarySchema2 = exports_external.strictObject({
|
|
18467
18670
|
id: string4,
|
|
@@ -18550,6 +18753,8 @@ var CommunityWsEventDiscriminatedSchema = exports_external.discriminatedUnion("t
|
|
|
18550
18753
|
communityInboxChangedSchema,
|
|
18551
18754
|
communityPresenceUpdateSchema,
|
|
18552
18755
|
communityStatusUpdateSchema,
|
|
18756
|
+
communityIdentityUpdateSchema,
|
|
18757
|
+
communityProfileUpdateSchema,
|
|
18553
18758
|
communityMachineCreatedSchema,
|
|
18554
18759
|
communityMachineStatusSchema,
|
|
18555
18760
|
communityMachineUpdatedSchema,
|
|
@@ -18596,6 +18801,8 @@ var WS_EVENTS = {
|
|
|
18596
18801
|
INBOX_CHANGED: "community:inbox.changed",
|
|
18597
18802
|
PRESENCE_UPDATE: "community:presence.update",
|
|
18598
18803
|
STATUS_UPDATE: "community:status.update",
|
|
18804
|
+
IDENTITY_UPDATE: "community:identity.update",
|
|
18805
|
+
PROFILE_UPDATE: "community:profile.update",
|
|
18599
18806
|
MACHINE_CREATED: "community:machine.created",
|
|
18600
18807
|
MACHINE_STATUS: "community:machine.status",
|
|
18601
18808
|
MACHINE_UPDATED: "community:machine.updated",
|