@alook/cli 0.1.23 → 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 +273 -17
- package/dist/session-runner.js +271 -16
- 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" }),
|
|
@@ -16816,12 +16834,13 @@ var OwnerDiagnosticReportSchema = exports_external.discriminatedUnion("status",
|
|
|
16816
16834
|
}).strict()
|
|
16817
16835
|
]);
|
|
16818
16836
|
// ../shared/src/constants/community.ts
|
|
16837
|
+
var MAX_FOLDER_NAME_LENGTH = 100;
|
|
16819
16838
|
var MAX_PROFILE_NAME_LENGTH = 100;
|
|
16820
16839
|
var MAX_PROFILE_ABOUT_LENGTH = 1000;
|
|
16821
16840
|
var MAX_MESSAGE_CONTENT_LENGTH = 4000;
|
|
16822
16841
|
var MAX_ATTACHMENTS_PER_MESSAGE = 10;
|
|
16823
16842
|
var MAX_ATTACHMENT_SIZE_BYTES = 25 * 1024 * 1024;
|
|
16824
|
-
var MAX_ATTACHMENT_THUMBNAIL_SIZE_BYTES =
|
|
16843
|
+
var MAX_ATTACHMENT_THUMBNAIL_SIZE_BYTES = 512 * 1024;
|
|
16825
16844
|
var MAX_SERVER_ICON_SIZE_BYTES = 5 * 1024 * 1024;
|
|
16826
16845
|
var ALLOWED_ICON_MIME_TYPES = [
|
|
16827
16846
|
"image/png",
|
|
@@ -16830,6 +16849,92 @@ var ALLOWED_ICON_MIME_TYPES = [
|
|
|
16830
16849
|
"image/gif"
|
|
16831
16850
|
];
|
|
16832
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();
|
|
16833
16938
|
// ../shared/src/utils/slug.ts
|
|
16834
16939
|
init_nanoid();
|
|
16835
16940
|
var slugId = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz");
|
|
@@ -16934,6 +17039,7 @@ var TaskApiSchema = TaskApiBaseSchema.extend({
|
|
|
16934
17039
|
var HeartbeatRequestSchema = exports_external.object({
|
|
16935
17040
|
daemon_id: exports_external.string().min(1)
|
|
16936
17041
|
});
|
|
17042
|
+
var MAX_POLL_TASKS = 50;
|
|
16937
17043
|
var PollRequestSchema = exports_external.object({
|
|
16938
17044
|
daemon_id: exports_external.string().min(1),
|
|
16939
17045
|
max_tasks: exports_external.number().int().min(1).default(1),
|
|
@@ -16986,10 +17092,13 @@ var ActivateTokenRuntimeSchema = exports_external.object({
|
|
|
16986
17092
|
type: exports_external.string().min(1),
|
|
16987
17093
|
version: exports_external.string().optional().default("")
|
|
16988
17094
|
});
|
|
17095
|
+
var COMMUNITY_RUNTIME_ID_MAX = 64;
|
|
17096
|
+
var COMMUNITY_RUNTIME_VERSION_MAX = 64;
|
|
17097
|
+
var COMMUNITY_RUNTIME_LIST_MAX = 64;
|
|
16989
17098
|
var ActivateTokenRequestSchema = exports_external.object({
|
|
16990
17099
|
token: exports_external.string().min(1),
|
|
16991
17100
|
hostname: exports_external.string().min(1),
|
|
16992
|
-
runtimes: exports_external.array(ActivateTokenRuntimeSchema).min(1)
|
|
17101
|
+
runtimes: exports_external.array(ActivateTokenRuntimeSchema).min(1).max(COMMUNITY_RUNTIME_LIST_MAX)
|
|
16993
17102
|
});
|
|
16994
17103
|
var RegisterDaemonRequestSchema = exports_external.object({
|
|
16995
17104
|
workspace_id: exports_external.string().min(1).optional(),
|
|
@@ -16997,7 +17106,7 @@ var RegisterDaemonRequestSchema = exports_external.object({
|
|
|
16997
17106
|
device_name: exports_external.string().optional().default(""),
|
|
16998
17107
|
cli_version: exports_external.string().optional().default(""),
|
|
16999
17108
|
workspaces_root: exports_external.string().optional().default(""),
|
|
17000
|
-
runtimes: exports_external.array(DaemonRuntimeItemSchema).min(1)
|
|
17109
|
+
runtimes: exports_external.array(DaemonRuntimeItemSchema).min(1).max(COMMUNITY_RUNTIME_LIST_MAX)
|
|
17001
17110
|
});
|
|
17002
17111
|
var DeregisterRequestSchema = exports_external.object({
|
|
17003
17112
|
daemon_id: exports_external.string().min(1)
|
|
@@ -17340,16 +17449,61 @@ var CreateThreadRequestSchema = exports_external.object({
|
|
|
17340
17449
|
content: exports_external.string().optional().default(""),
|
|
17341
17450
|
attachment_ids: exports_external.array(exports_external.string()).optional()
|
|
17342
17451
|
});
|
|
17343
|
-
var COMMUNITY_RUNTIME_ID_MAX = 64;
|
|
17344
|
-
var COMMUNITY_RUNTIME_VERSION_MAX = 64;
|
|
17345
|
-
var COMMUNITY_RUNTIME_LIST_MAX = 64;
|
|
17346
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
|
+
});
|
|
17347
17500
|
var CommunityMachineRuntimeSchema = exports_external.object({
|
|
17348
17501
|
id: exports_external.string().min(1).max(COMMUNITY_RUNTIME_ID_MAX).regex(RUNTIME_ID_RE, "invalid runtime id charset"),
|
|
17349
17502
|
version: exports_external.string().max(COMMUNITY_RUNTIME_VERSION_MAX).optional(),
|
|
17350
17503
|
status: exports_external.enum(["healthy", "unhealthy"]).catch("healthy").default("healthy"),
|
|
17351
17504
|
lastError: exports_external.string().max(128).optional(),
|
|
17352
|
-
lastErrorAt: exports_external.string().optional()
|
|
17505
|
+
lastErrorAt: exports_external.string().optional(),
|
|
17506
|
+
reasoning: RuntimeReasoningCatalogSchema.optional().catch(undefined)
|
|
17353
17507
|
});
|
|
17354
17508
|
var CommunityMachineRuntimeListSchema = exports_external.array(CommunityMachineRuntimeSchema).max(COMMUNITY_RUNTIME_LIST_MAX).transform((list) => {
|
|
17355
17509
|
const seen = new Set;
|
|
@@ -17362,6 +17516,17 @@ var CommunityMachineRuntimeListSchema = exports_external.array(CommunityMachineR
|
|
|
17362
17516
|
}
|
|
17363
17517
|
return out;
|
|
17364
17518
|
});
|
|
17519
|
+
var CommunityRunningAgentListSchema = exports_external.array(exports_external.string()).transform((list) => {
|
|
17520
|
+
const seen = new Set;
|
|
17521
|
+
const out = [];
|
|
17522
|
+
for (const id of list) {
|
|
17523
|
+
if (seen.has(id))
|
|
17524
|
+
continue;
|
|
17525
|
+
seen.add(id);
|
|
17526
|
+
out.push(id);
|
|
17527
|
+
}
|
|
17528
|
+
return out;
|
|
17529
|
+
});
|
|
17365
17530
|
var CommunityMachineSummarySchema = exports_external.object({
|
|
17366
17531
|
id: exports_external.string(),
|
|
17367
17532
|
hostname: exports_external.string(),
|
|
@@ -17385,16 +17550,17 @@ var HostReadyMessageSchema = exports_external.object({
|
|
|
17385
17550
|
type: exports_external.literal("ready"),
|
|
17386
17551
|
runtimeReport: CommunityMachineRuntimeListSchema,
|
|
17387
17552
|
capabilities: exports_external.array(exports_external.string().min(1).max(64)).max(16).optional().default([]),
|
|
17388
|
-
runningAgents:
|
|
17553
|
+
runningAgents: CommunityRunningAgentListSchema.default([]),
|
|
17389
17554
|
hostname: exports_external.string().optional(),
|
|
17390
17555
|
platform: exports_external.string().optional(),
|
|
17391
17556
|
arch: exports_external.string().optional(),
|
|
17392
17557
|
osRelease: exports_external.string().optional(),
|
|
17393
|
-
daemonVersion: exports_external.string().optional()
|
|
17558
|
+
daemonVersion: exports_external.string().optional(),
|
|
17559
|
+
providerQuotas: exports_external.array(ProviderQuotaSnapshotSchema).max(2).optional().default([])
|
|
17394
17560
|
});
|
|
17395
17561
|
var CommunityDaemonReadySchema = exports_external.object({
|
|
17396
17562
|
runtimeReport: CommunityMachineRuntimeListSchema.optional(),
|
|
17397
|
-
runningAgents:
|
|
17563
|
+
runningAgents: CommunityRunningAgentListSchema.default([]),
|
|
17398
17564
|
hostname: exports_external.string().optional(),
|
|
17399
17565
|
os: exports_external.string().optional(),
|
|
17400
17566
|
arch: exports_external.string().optional(),
|
|
@@ -17411,7 +17577,9 @@ var SessionErrorFrameSchema = exports_external.object({
|
|
|
17411
17577
|
var AgentActivityMessageSchema = exports_external.object({
|
|
17412
17578
|
type: exports_external.literal("agent_activity"),
|
|
17413
17579
|
agentId: exports_external.string(),
|
|
17414
|
-
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()
|
|
17415
17583
|
});
|
|
17416
17584
|
var AgentTypingMessageSchema = exports_external.object({
|
|
17417
17585
|
type: exports_external.literal("agent_typing"),
|
|
@@ -17486,15 +17654,17 @@ var CommunityBotCreateRequestSchema = exports_external.object({
|
|
|
17486
17654
|
machineId: exports_external.string().min(1),
|
|
17487
17655
|
runtime: exports_external.string().min(1),
|
|
17488
17656
|
image: BotImageUrlSchema.optional(),
|
|
17489
|
-
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()
|
|
17490
17659
|
});
|
|
17491
17660
|
var CommunityBotPatchRequestSchema = exports_external.object({
|
|
17492
17661
|
name: exports_external.string().trim().min(COMMUNITY_BOT_NAME_MIN).max(COMMUNITY_BOT_NAME_MAX).refine(isMentionSafeName, { message: MENTION_SAFE_NAME_MSG }).optional(),
|
|
17493
17662
|
description: exports_external.string().max(COMMUNITY_BOT_DESCRIPTION_MAX).optional(),
|
|
17494
17663
|
image: BotImageUrlSchema.nullable().optional(),
|
|
17495
17664
|
model: exports_external.string().trim().min(1).max(100).nullable().optional(),
|
|
17496
|
-
runtime: exports_external.string().trim().min(1).max(COMMUNITY_RUNTIME_ID_MAX).optional()
|
|
17497
|
-
|
|
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), {
|
|
17498
17668
|
message: "at least one field must be provided"
|
|
17499
17669
|
});
|
|
17500
17670
|
var CommunityBotAddToServerRequestSchema = exports_external.object({
|
|
@@ -17710,6 +17880,11 @@ var HostCommandSchema = exports_external.discriminatedUnion("type", [
|
|
|
17710
17880
|
config: exports_external.unknown(),
|
|
17711
17881
|
launchId: exports_external.string().min(1)
|
|
17712
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
|
+
}),
|
|
17713
17888
|
exports_external.object({
|
|
17714
17889
|
type: exports_external.literal("machine:reset_all"),
|
|
17715
17890
|
resets: exports_external.array(exports_external.object({
|
|
@@ -17768,6 +17943,7 @@ __export(exports_community_schema, {
|
|
|
17768
17943
|
communityChannelMember: () => communityChannelMember,
|
|
17769
17944
|
communityChannel: () => communityChannel,
|
|
17770
17945
|
communityCategory: () => communityCategory,
|
|
17946
|
+
communityBotDailyTokenUsage: () => communityBotDailyTokenUsage,
|
|
17771
17947
|
communityBotDailyActivity: () => communityBotDailyActivity,
|
|
17772
17948
|
communityBotApprovalRequest: () => communityBotApprovalRequest,
|
|
17773
17949
|
communityBotActivityEvent: () => communityBotActivityEvent,
|
|
@@ -18020,6 +18196,17 @@ var communityBotDailyActivity = sqliteTable("community_bot_daily_activity", {
|
|
|
18020
18196
|
handledCount: integer2("handled_count").notNull().default(0),
|
|
18021
18197
|
sentCount: integer2("sent_count").notNull().default(0)
|
|
18022
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
|
+
]);
|
|
18023
18210
|
var communityMessageMark = sqliteTable("community_message_mark", {
|
|
18024
18211
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
18025
18212
|
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
@@ -18144,7 +18331,8 @@ var listedMessageProjection = {
|
|
|
18144
18331
|
clientNonce: communityMessage.clientNonce,
|
|
18145
18332
|
authorName: user.name,
|
|
18146
18333
|
authorEmail: user.email,
|
|
18147
|
-
authorImage: user.image
|
|
18334
|
+
authorImage: user.image,
|
|
18335
|
+
authorAvatarVersion: user.avatarVersion
|
|
18148
18336
|
};
|
|
18149
18337
|
|
|
18150
18338
|
// ../shared/src/db/queries/user.ts
|
|
@@ -18154,6 +18342,7 @@ var publicUserColumns = {
|
|
|
18154
18342
|
email: user.email,
|
|
18155
18343
|
emailVerified: user.emailVerified,
|
|
18156
18344
|
image: user.image,
|
|
18345
|
+
avatarVersion: user.avatarVersion,
|
|
18157
18346
|
createdAt: user.createdAt,
|
|
18158
18347
|
updatedAt: user.updatedAt,
|
|
18159
18348
|
discriminator: user.discriminator
|
|
@@ -18164,6 +18353,12 @@ var internalUserColumns = {
|
|
|
18164
18353
|
ownerUserId: user.ownerUserId,
|
|
18165
18354
|
deletedAt: user.deletedAt
|
|
18166
18355
|
};
|
|
18356
|
+
var avatarPublishColumns = {
|
|
18357
|
+
id: user.id,
|
|
18358
|
+
image: user.image,
|
|
18359
|
+
avatarVersion: user.avatarVersion,
|
|
18360
|
+
avatarObjectKey: user.avatarObjectKey
|
|
18361
|
+
};
|
|
18167
18362
|
|
|
18168
18363
|
// ../shared/src/db/queries/community/channel.ts
|
|
18169
18364
|
var CHANNEL_COLUMNS = {
|
|
@@ -18216,7 +18411,8 @@ var friendApprovalProfileSchema = exports_external.strictObject({
|
|
|
18216
18411
|
id: string4,
|
|
18217
18412
|
name: string4,
|
|
18218
18413
|
discriminator: string4,
|
|
18219
|
-
image: nullableString
|
|
18414
|
+
image: nullableString,
|
|
18415
|
+
avatarVersion: exports_external.number().int().nonnegative()
|
|
18220
18416
|
});
|
|
18221
18417
|
var FriendApprovalPayloadSchema = exports_external.strictObject({
|
|
18222
18418
|
friendshipId: string4,
|
|
@@ -18242,6 +18438,7 @@ var messageSchema = exports_external.strictObject({
|
|
|
18242
18438
|
authorId: string4,
|
|
18243
18439
|
authorName: string4,
|
|
18244
18440
|
authorAvatar: string4.optional(),
|
|
18441
|
+
authorAvatarVersion: exports_external.number().int().nonnegative(),
|
|
18245
18442
|
content: string4,
|
|
18246
18443
|
type: exports_external.enum(["chat", "system"]),
|
|
18247
18444
|
systemKind: exports_external.literal("thread").optional(),
|
|
@@ -18249,6 +18446,7 @@ var messageSchema = exports_external.strictObject({
|
|
|
18249
18446
|
replyToId: nullableString.optional(),
|
|
18250
18447
|
replyTo: exports_external.strictObject({
|
|
18251
18448
|
id: string4,
|
|
18449
|
+
authorId: string4.optional(),
|
|
18252
18450
|
authorName: string4,
|
|
18253
18451
|
text: string4,
|
|
18254
18452
|
deleted: exports_external.boolean().optional()
|
|
@@ -18443,6 +18641,7 @@ var communityMemberJoinSchema = exports_external.strictObject({
|
|
|
18443
18641
|
name: string4,
|
|
18444
18642
|
discriminator: string4,
|
|
18445
18643
|
avatar: string4.optional(),
|
|
18644
|
+
avatarVersion: exports_external.number().int().nonnegative(),
|
|
18446
18645
|
role: string4,
|
|
18447
18646
|
joinedAt: string4
|
|
18448
18647
|
})
|
|
@@ -18545,6 +18744,22 @@ var communityStatusUpdateSchema = exports_external.strictObject({
|
|
|
18545
18744
|
statusEmoji: nullableString,
|
|
18546
18745
|
statusText: nullableString
|
|
18547
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
|
+
});
|
|
18548
18763
|
var machineRuntimeSchema = CommunityMachineRuntimeSchema.strict();
|
|
18549
18764
|
var CommunityMachineSummarySchema2 = exports_external.strictObject({
|
|
18550
18765
|
id: string4,
|
|
@@ -18633,6 +18848,8 @@ var CommunityWsEventDiscriminatedSchema = exports_external.discriminatedUnion("t
|
|
|
18633
18848
|
communityInboxChangedSchema,
|
|
18634
18849
|
communityPresenceUpdateSchema,
|
|
18635
18850
|
communityStatusUpdateSchema,
|
|
18851
|
+
communityIdentityUpdateSchema,
|
|
18852
|
+
communityProfileUpdateSchema,
|
|
18636
18853
|
communityMachineCreatedSchema,
|
|
18637
18854
|
communityMachineStatusSchema,
|
|
18638
18855
|
communityMachineUpdatedSchema,
|
|
@@ -18679,6 +18896,8 @@ var WS_EVENTS = {
|
|
|
18679
18896
|
INBOX_CHANGED: "community:inbox.changed",
|
|
18680
18897
|
PRESENCE_UPDATE: "community:presence.update",
|
|
18681
18898
|
STATUS_UPDATE: "community:status.update",
|
|
18899
|
+
IDENTITY_UPDATE: "community:identity.update",
|
|
18900
|
+
PROFILE_UPDATE: "community:profile.update",
|
|
18682
18901
|
MACHINE_CREATED: "community:machine.created",
|
|
18683
18902
|
MACHINE_STATUS: "community:machine.status",
|
|
18684
18903
|
MACHINE_UPDATED: "community:machine.updated",
|
|
@@ -18755,6 +18974,43 @@ var COMMUNITY_BROWSER_EVENT_BATCH_ENVELOPE_BYTES = 1024;
|
|
|
18755
18974
|
var COMMUNITY_BROWSER_EVENT_BATCH_MAX_BYTES = MESSAGE_DELIVERY_MAX_EVENTS_PER_USER * COMMUNITY_BROWSER_EVENT_MAX_BYTES + COMMUNITY_BROWSER_EVENT_BATCH_ENVELOPE_BYTES;
|
|
18756
18975
|
// ../shared/src/db/index.ts
|
|
18757
18976
|
var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema };
|
|
18977
|
+
// ../shared/src/community-server-rail.ts
|
|
18978
|
+
var MAX_SERVER_RAIL_COMMANDS = 3;
|
|
18979
|
+
var idSchema = exports_external.string().trim().min(1);
|
|
18980
|
+
var idsSchema = exports_external.array(idSchema);
|
|
18981
|
+
var reorderServersSchema = exports_external.strictObject({
|
|
18982
|
+
kind: exports_external.literal("reorder-servers"),
|
|
18983
|
+
serverIds: idsSchema
|
|
18984
|
+
});
|
|
18985
|
+
var reorderFoldersSchema = exports_external.strictObject({
|
|
18986
|
+
kind: exports_external.literal("reorder-folders"),
|
|
18987
|
+
folderIds: idsSchema
|
|
18988
|
+
});
|
|
18989
|
+
var replaceFolderItemsSchema = exports_external.strictObject({
|
|
18990
|
+
kind: exports_external.literal("replace-folder-items"),
|
|
18991
|
+
folderId: idSchema,
|
|
18992
|
+
serverIds: idsSchema.min(1)
|
|
18993
|
+
});
|
|
18994
|
+
var deleteFolderSchema = exports_external.strictObject({
|
|
18995
|
+
kind: exports_external.literal("delete-folder"),
|
|
18996
|
+
folderId: idSchema
|
|
18997
|
+
});
|
|
18998
|
+
var createFolderSchema = exports_external.strictObject({
|
|
18999
|
+
kind: exports_external.literal("create-folder"),
|
|
19000
|
+
clientId: idSchema,
|
|
19001
|
+
name: exports_external.string().trim().min(1).max(MAX_FOLDER_NAME_LENGTH),
|
|
19002
|
+
serverIds: idsSchema.min(1)
|
|
19003
|
+
});
|
|
19004
|
+
var serverRailCommandSchema = exports_external.discriminatedUnion("kind", [
|
|
19005
|
+
reorderServersSchema,
|
|
19006
|
+
reorderFoldersSchema,
|
|
19007
|
+
replaceFolderItemsSchema,
|
|
19008
|
+
deleteFolderSchema,
|
|
19009
|
+
createFolderSchema
|
|
19010
|
+
]);
|
|
19011
|
+
var serverRailCommitRequestSchema = exports_external.strictObject({
|
|
19012
|
+
commands: exports_external.array(serverRailCommandSchema).min(1).max(MAX_SERVER_RAIL_COMMANDS)
|
|
19013
|
+
});
|
|
18758
19014
|
// ../shared/src/db/queries/task.ts
|
|
18759
19015
|
var DEFAULT_STALE_SECONDS = Number(process.env.ALOOK_STALE_DISPATCH_TIMEOUT_S) || 20;
|
|
18760
19016
|
var DEFAULT_STALE_RUNNING_SECONDS = Number(process.env.ALOOK_STALE_RUNNING_TIMEOUT_S) || 3600;
|
|
@@ -19071,7 +19327,7 @@ function loadDaemonConfig(profile) {
|
|
|
19071
19327
|
sweepInterval: parseDuration(process.env.ALOOK_DAEMON_SWEEP_INTERVAL || "60s"),
|
|
19072
19328
|
agentTimeout: parseDuration(process.env.ALOOK_AGENT_TIMEOUT || "12h"),
|
|
19073
19329
|
messageInactivityTimeout: parseDuration(process.env.ALOOK_MESSAGE_INACTIVITY_TIMEOUT || "20m"),
|
|
19074
|
-
maxConcurrentTasks: parseInt(process.env.ALOOK_DAEMON_MAX_CONCURRENT_TASKS || "20"),
|
|
19330
|
+
maxConcurrentTasks: Math.min(parseInt(process.env.ALOOK_DAEMON_MAX_CONCURRENT_TASKS || "20"), MAX_POLL_TASKS),
|
|
19075
19331
|
enableSteering: process.env.ALOOK_ENABLE_STEERING === "1",
|
|
19076
19332
|
daemonId,
|
|
19077
19333
|
deviceName: process.env.ALOOK_DAEMON_DEVICE_NAME || h,
|
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" }),
|
|
@@ -16721,12 +16739,13 @@ var OwnerDiagnosticReportSchema = exports_external.discriminatedUnion("status",
|
|
|
16721
16739
|
}).strict()
|
|
16722
16740
|
]);
|
|
16723
16741
|
// ../shared/src/constants/community.ts
|
|
16742
|
+
var MAX_FOLDER_NAME_LENGTH = 100;
|
|
16724
16743
|
var MAX_PROFILE_NAME_LENGTH = 100;
|
|
16725
16744
|
var MAX_PROFILE_ABOUT_LENGTH = 1000;
|
|
16726
16745
|
var MAX_MESSAGE_CONTENT_LENGTH = 4000;
|
|
16727
16746
|
var MAX_ATTACHMENTS_PER_MESSAGE = 10;
|
|
16728
16747
|
var MAX_ATTACHMENT_SIZE_BYTES = 25 * 1024 * 1024;
|
|
16729
|
-
var MAX_ATTACHMENT_THUMBNAIL_SIZE_BYTES =
|
|
16748
|
+
var MAX_ATTACHMENT_THUMBNAIL_SIZE_BYTES = 512 * 1024;
|
|
16730
16749
|
var MAX_SERVER_ICON_SIZE_BYTES = 5 * 1024 * 1024;
|
|
16731
16750
|
var ALLOWED_ICON_MIME_TYPES = [
|
|
16732
16751
|
"image/png",
|
|
@@ -16735,6 +16754,92 @@ var ALLOWED_ICON_MIME_TYPES = [
|
|
|
16735
16754
|
"image/gif"
|
|
16736
16755
|
];
|
|
16737
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();
|
|
16738
16843
|
// ../shared/src/utils/slug.ts
|
|
16739
16844
|
init_nanoid();
|
|
16740
16845
|
var slugId = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz");
|
|
@@ -16891,10 +16996,13 @@ var ActivateTokenRuntimeSchema = exports_external.object({
|
|
|
16891
16996
|
type: exports_external.string().min(1),
|
|
16892
16997
|
version: exports_external.string().optional().default("")
|
|
16893
16998
|
});
|
|
16999
|
+
var COMMUNITY_RUNTIME_ID_MAX = 64;
|
|
17000
|
+
var COMMUNITY_RUNTIME_VERSION_MAX = 64;
|
|
17001
|
+
var COMMUNITY_RUNTIME_LIST_MAX = 64;
|
|
16894
17002
|
var ActivateTokenRequestSchema = exports_external.object({
|
|
16895
17003
|
token: exports_external.string().min(1),
|
|
16896
17004
|
hostname: exports_external.string().min(1),
|
|
16897
|
-
runtimes: exports_external.array(ActivateTokenRuntimeSchema).min(1)
|
|
17005
|
+
runtimes: exports_external.array(ActivateTokenRuntimeSchema).min(1).max(COMMUNITY_RUNTIME_LIST_MAX)
|
|
16898
17006
|
});
|
|
16899
17007
|
var RegisterDaemonRequestSchema = exports_external.object({
|
|
16900
17008
|
workspace_id: exports_external.string().min(1).optional(),
|
|
@@ -16902,7 +17010,7 @@ var RegisterDaemonRequestSchema = exports_external.object({
|
|
|
16902
17010
|
device_name: exports_external.string().optional().default(""),
|
|
16903
17011
|
cli_version: exports_external.string().optional().default(""),
|
|
16904
17012
|
workspaces_root: exports_external.string().optional().default(""),
|
|
16905
|
-
runtimes: exports_external.array(DaemonRuntimeItemSchema).min(1)
|
|
17013
|
+
runtimes: exports_external.array(DaemonRuntimeItemSchema).min(1).max(COMMUNITY_RUNTIME_LIST_MAX)
|
|
16906
17014
|
});
|
|
16907
17015
|
var DeregisterRequestSchema = exports_external.object({
|
|
16908
17016
|
daemon_id: exports_external.string().min(1)
|
|
@@ -17245,16 +17353,61 @@ var CreateThreadRequestSchema = exports_external.object({
|
|
|
17245
17353
|
content: exports_external.string().optional().default(""),
|
|
17246
17354
|
attachment_ids: exports_external.array(exports_external.string()).optional()
|
|
17247
17355
|
});
|
|
17248
|
-
var COMMUNITY_RUNTIME_ID_MAX = 64;
|
|
17249
|
-
var COMMUNITY_RUNTIME_VERSION_MAX = 64;
|
|
17250
|
-
var COMMUNITY_RUNTIME_LIST_MAX = 64;
|
|
17251
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
|
+
});
|
|
17252
17404
|
var CommunityMachineRuntimeSchema = exports_external.object({
|
|
17253
17405
|
id: exports_external.string().min(1).max(COMMUNITY_RUNTIME_ID_MAX).regex(RUNTIME_ID_RE, "invalid runtime id charset"),
|
|
17254
17406
|
version: exports_external.string().max(COMMUNITY_RUNTIME_VERSION_MAX).optional(),
|
|
17255
17407
|
status: exports_external.enum(["healthy", "unhealthy"]).catch("healthy").default("healthy"),
|
|
17256
17408
|
lastError: exports_external.string().max(128).optional(),
|
|
17257
|
-
lastErrorAt: exports_external.string().optional()
|
|
17409
|
+
lastErrorAt: exports_external.string().optional(),
|
|
17410
|
+
reasoning: RuntimeReasoningCatalogSchema.optional().catch(undefined)
|
|
17258
17411
|
});
|
|
17259
17412
|
var CommunityMachineRuntimeListSchema = exports_external.array(CommunityMachineRuntimeSchema).max(COMMUNITY_RUNTIME_LIST_MAX).transform((list) => {
|
|
17260
17413
|
const seen = new Set;
|
|
@@ -17267,6 +17420,17 @@ var CommunityMachineRuntimeListSchema = exports_external.array(CommunityMachineR
|
|
|
17267
17420
|
}
|
|
17268
17421
|
return out;
|
|
17269
17422
|
});
|
|
17423
|
+
var CommunityRunningAgentListSchema = exports_external.array(exports_external.string()).transform((list) => {
|
|
17424
|
+
const seen = new Set;
|
|
17425
|
+
const out = [];
|
|
17426
|
+
for (const id of list) {
|
|
17427
|
+
if (seen.has(id))
|
|
17428
|
+
continue;
|
|
17429
|
+
seen.add(id);
|
|
17430
|
+
out.push(id);
|
|
17431
|
+
}
|
|
17432
|
+
return out;
|
|
17433
|
+
});
|
|
17270
17434
|
var CommunityMachineSummarySchema = exports_external.object({
|
|
17271
17435
|
id: exports_external.string(),
|
|
17272
17436
|
hostname: exports_external.string(),
|
|
@@ -17290,16 +17454,17 @@ var HostReadyMessageSchema = exports_external.object({
|
|
|
17290
17454
|
type: exports_external.literal("ready"),
|
|
17291
17455
|
runtimeReport: CommunityMachineRuntimeListSchema,
|
|
17292
17456
|
capabilities: exports_external.array(exports_external.string().min(1).max(64)).max(16).optional().default([]),
|
|
17293
|
-
runningAgents:
|
|
17457
|
+
runningAgents: CommunityRunningAgentListSchema.default([]),
|
|
17294
17458
|
hostname: exports_external.string().optional(),
|
|
17295
17459
|
platform: exports_external.string().optional(),
|
|
17296
17460
|
arch: exports_external.string().optional(),
|
|
17297
17461
|
osRelease: exports_external.string().optional(),
|
|
17298
|
-
daemonVersion: exports_external.string().optional()
|
|
17462
|
+
daemonVersion: exports_external.string().optional(),
|
|
17463
|
+
providerQuotas: exports_external.array(ProviderQuotaSnapshotSchema).max(2).optional().default([])
|
|
17299
17464
|
});
|
|
17300
17465
|
var CommunityDaemonReadySchema = exports_external.object({
|
|
17301
17466
|
runtimeReport: CommunityMachineRuntimeListSchema.optional(),
|
|
17302
|
-
runningAgents:
|
|
17467
|
+
runningAgents: CommunityRunningAgentListSchema.default([]),
|
|
17303
17468
|
hostname: exports_external.string().optional(),
|
|
17304
17469
|
os: exports_external.string().optional(),
|
|
17305
17470
|
arch: exports_external.string().optional(),
|
|
@@ -17316,7 +17481,9 @@ var SessionErrorFrameSchema = exports_external.object({
|
|
|
17316
17481
|
var AgentActivityMessageSchema = exports_external.object({
|
|
17317
17482
|
type: exports_external.literal("agent_activity"),
|
|
17318
17483
|
agentId: exports_external.string(),
|
|
17319
|
-
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()
|
|
17320
17487
|
});
|
|
17321
17488
|
var AgentTypingMessageSchema = exports_external.object({
|
|
17322
17489
|
type: exports_external.literal("agent_typing"),
|
|
@@ -17391,15 +17558,17 @@ var CommunityBotCreateRequestSchema = exports_external.object({
|
|
|
17391
17558
|
machineId: exports_external.string().min(1),
|
|
17392
17559
|
runtime: exports_external.string().min(1),
|
|
17393
17560
|
image: BotImageUrlSchema.optional(),
|
|
17394
|
-
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()
|
|
17395
17563
|
});
|
|
17396
17564
|
var CommunityBotPatchRequestSchema = exports_external.object({
|
|
17397
17565
|
name: exports_external.string().trim().min(COMMUNITY_BOT_NAME_MIN).max(COMMUNITY_BOT_NAME_MAX).refine(isMentionSafeName, { message: MENTION_SAFE_NAME_MSG }).optional(),
|
|
17398
17566
|
description: exports_external.string().max(COMMUNITY_BOT_DESCRIPTION_MAX).optional(),
|
|
17399
17567
|
image: BotImageUrlSchema.nullable().optional(),
|
|
17400
17568
|
model: exports_external.string().trim().min(1).max(100).nullable().optional(),
|
|
17401
|
-
runtime: exports_external.string().trim().min(1).max(COMMUNITY_RUNTIME_ID_MAX).optional()
|
|
17402
|
-
|
|
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), {
|
|
17403
17572
|
message: "at least one field must be provided"
|
|
17404
17573
|
});
|
|
17405
17574
|
var CommunityBotAddToServerRequestSchema = exports_external.object({
|
|
@@ -17615,6 +17784,11 @@ var HostCommandSchema = exports_external.discriminatedUnion("type", [
|
|
|
17615
17784
|
config: exports_external.unknown(),
|
|
17616
17785
|
launchId: exports_external.string().min(1)
|
|
17617
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
|
+
}),
|
|
17618
17792
|
exports_external.object({
|
|
17619
17793
|
type: exports_external.literal("machine:reset_all"),
|
|
17620
17794
|
resets: exports_external.array(exports_external.object({
|
|
@@ -17673,6 +17847,7 @@ __export(exports_community_schema, {
|
|
|
17673
17847
|
communityChannelMember: () => communityChannelMember,
|
|
17674
17848
|
communityChannel: () => communityChannel,
|
|
17675
17849
|
communityCategory: () => communityCategory,
|
|
17850
|
+
communityBotDailyTokenUsage: () => communityBotDailyTokenUsage,
|
|
17676
17851
|
communityBotDailyActivity: () => communityBotDailyActivity,
|
|
17677
17852
|
communityBotApprovalRequest: () => communityBotApprovalRequest,
|
|
17678
17853
|
communityBotActivityEvent: () => communityBotActivityEvent,
|
|
@@ -17925,6 +18100,17 @@ var communityBotDailyActivity = sqliteTable("community_bot_daily_activity", {
|
|
|
17925
18100
|
handledCount: integer2("handled_count").notNull().default(0),
|
|
17926
18101
|
sentCount: integer2("sent_count").notNull().default(0)
|
|
17927
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
|
+
]);
|
|
17928
18114
|
var communityMessageMark = sqliteTable("community_message_mark", {
|
|
17929
18115
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17930
18116
|
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
@@ -18049,7 +18235,8 @@ var listedMessageProjection = {
|
|
|
18049
18235
|
clientNonce: communityMessage.clientNonce,
|
|
18050
18236
|
authorName: user.name,
|
|
18051
18237
|
authorEmail: user.email,
|
|
18052
|
-
authorImage: user.image
|
|
18238
|
+
authorImage: user.image,
|
|
18239
|
+
authorAvatarVersion: user.avatarVersion
|
|
18053
18240
|
};
|
|
18054
18241
|
|
|
18055
18242
|
// ../shared/src/db/queries/user.ts
|
|
@@ -18059,6 +18246,7 @@ var publicUserColumns = {
|
|
|
18059
18246
|
email: user.email,
|
|
18060
18247
|
emailVerified: user.emailVerified,
|
|
18061
18248
|
image: user.image,
|
|
18249
|
+
avatarVersion: user.avatarVersion,
|
|
18062
18250
|
createdAt: user.createdAt,
|
|
18063
18251
|
updatedAt: user.updatedAt,
|
|
18064
18252
|
discriminator: user.discriminator
|
|
@@ -18069,6 +18257,12 @@ var internalUserColumns = {
|
|
|
18069
18257
|
ownerUserId: user.ownerUserId,
|
|
18070
18258
|
deletedAt: user.deletedAt
|
|
18071
18259
|
};
|
|
18260
|
+
var avatarPublishColumns = {
|
|
18261
|
+
id: user.id,
|
|
18262
|
+
image: user.image,
|
|
18263
|
+
avatarVersion: user.avatarVersion,
|
|
18264
|
+
avatarObjectKey: user.avatarObjectKey
|
|
18265
|
+
};
|
|
18072
18266
|
|
|
18073
18267
|
// ../shared/src/db/queries/community/channel.ts
|
|
18074
18268
|
var CHANNEL_COLUMNS = {
|
|
@@ -18121,7 +18315,8 @@ var friendApprovalProfileSchema = exports_external.strictObject({
|
|
|
18121
18315
|
id: string4,
|
|
18122
18316
|
name: string4,
|
|
18123
18317
|
discriminator: string4,
|
|
18124
|
-
image: nullableString
|
|
18318
|
+
image: nullableString,
|
|
18319
|
+
avatarVersion: exports_external.number().int().nonnegative()
|
|
18125
18320
|
});
|
|
18126
18321
|
var FriendApprovalPayloadSchema = exports_external.strictObject({
|
|
18127
18322
|
friendshipId: string4,
|
|
@@ -18147,6 +18342,7 @@ var messageSchema = exports_external.strictObject({
|
|
|
18147
18342
|
authorId: string4,
|
|
18148
18343
|
authorName: string4,
|
|
18149
18344
|
authorAvatar: string4.optional(),
|
|
18345
|
+
authorAvatarVersion: exports_external.number().int().nonnegative(),
|
|
18150
18346
|
content: string4,
|
|
18151
18347
|
type: exports_external.enum(["chat", "system"]),
|
|
18152
18348
|
systemKind: exports_external.literal("thread").optional(),
|
|
@@ -18154,6 +18350,7 @@ var messageSchema = exports_external.strictObject({
|
|
|
18154
18350
|
replyToId: nullableString.optional(),
|
|
18155
18351
|
replyTo: exports_external.strictObject({
|
|
18156
18352
|
id: string4,
|
|
18353
|
+
authorId: string4.optional(),
|
|
18157
18354
|
authorName: string4,
|
|
18158
18355
|
text: string4,
|
|
18159
18356
|
deleted: exports_external.boolean().optional()
|
|
@@ -18348,6 +18545,7 @@ var communityMemberJoinSchema = exports_external.strictObject({
|
|
|
18348
18545
|
name: string4,
|
|
18349
18546
|
discriminator: string4,
|
|
18350
18547
|
avatar: string4.optional(),
|
|
18548
|
+
avatarVersion: exports_external.number().int().nonnegative(),
|
|
18351
18549
|
role: string4,
|
|
18352
18550
|
joinedAt: string4
|
|
18353
18551
|
})
|
|
@@ -18450,6 +18648,22 @@ var communityStatusUpdateSchema = exports_external.strictObject({
|
|
|
18450
18648
|
statusEmoji: nullableString,
|
|
18451
18649
|
statusText: nullableString
|
|
18452
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
|
+
});
|
|
18453
18667
|
var machineRuntimeSchema = CommunityMachineRuntimeSchema.strict();
|
|
18454
18668
|
var CommunityMachineSummarySchema2 = exports_external.strictObject({
|
|
18455
18669
|
id: string4,
|
|
@@ -18538,6 +18752,8 @@ var CommunityWsEventDiscriminatedSchema = exports_external.discriminatedUnion("t
|
|
|
18538
18752
|
communityInboxChangedSchema,
|
|
18539
18753
|
communityPresenceUpdateSchema,
|
|
18540
18754
|
communityStatusUpdateSchema,
|
|
18755
|
+
communityIdentityUpdateSchema,
|
|
18756
|
+
communityProfileUpdateSchema,
|
|
18541
18757
|
communityMachineCreatedSchema,
|
|
18542
18758
|
communityMachineStatusSchema,
|
|
18543
18759
|
communityMachineUpdatedSchema,
|
|
@@ -18584,6 +18800,8 @@ var WS_EVENTS = {
|
|
|
18584
18800
|
INBOX_CHANGED: "community:inbox.changed",
|
|
18585
18801
|
PRESENCE_UPDATE: "community:presence.update",
|
|
18586
18802
|
STATUS_UPDATE: "community:status.update",
|
|
18803
|
+
IDENTITY_UPDATE: "community:identity.update",
|
|
18804
|
+
PROFILE_UPDATE: "community:profile.update",
|
|
18587
18805
|
MACHINE_CREATED: "community:machine.created",
|
|
18588
18806
|
MACHINE_STATUS: "community:machine.status",
|
|
18589
18807
|
MACHINE_UPDATED: "community:machine.updated",
|
|
@@ -18660,6 +18878,43 @@ var COMMUNITY_BROWSER_EVENT_BATCH_ENVELOPE_BYTES = 1024;
|
|
|
18660
18878
|
var COMMUNITY_BROWSER_EVENT_BATCH_MAX_BYTES = MESSAGE_DELIVERY_MAX_EVENTS_PER_USER * COMMUNITY_BROWSER_EVENT_MAX_BYTES + COMMUNITY_BROWSER_EVENT_BATCH_ENVELOPE_BYTES;
|
|
18661
18879
|
// ../shared/src/db/index.ts
|
|
18662
18880
|
var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema };
|
|
18881
|
+
// ../shared/src/community-server-rail.ts
|
|
18882
|
+
var MAX_SERVER_RAIL_COMMANDS = 3;
|
|
18883
|
+
var idSchema = exports_external.string().trim().min(1);
|
|
18884
|
+
var idsSchema = exports_external.array(idSchema);
|
|
18885
|
+
var reorderServersSchema = exports_external.strictObject({
|
|
18886
|
+
kind: exports_external.literal("reorder-servers"),
|
|
18887
|
+
serverIds: idsSchema
|
|
18888
|
+
});
|
|
18889
|
+
var reorderFoldersSchema = exports_external.strictObject({
|
|
18890
|
+
kind: exports_external.literal("reorder-folders"),
|
|
18891
|
+
folderIds: idsSchema
|
|
18892
|
+
});
|
|
18893
|
+
var replaceFolderItemsSchema = exports_external.strictObject({
|
|
18894
|
+
kind: exports_external.literal("replace-folder-items"),
|
|
18895
|
+
folderId: idSchema,
|
|
18896
|
+
serverIds: idsSchema.min(1)
|
|
18897
|
+
});
|
|
18898
|
+
var deleteFolderSchema = exports_external.strictObject({
|
|
18899
|
+
kind: exports_external.literal("delete-folder"),
|
|
18900
|
+
folderId: idSchema
|
|
18901
|
+
});
|
|
18902
|
+
var createFolderSchema = exports_external.strictObject({
|
|
18903
|
+
kind: exports_external.literal("create-folder"),
|
|
18904
|
+
clientId: idSchema,
|
|
18905
|
+
name: exports_external.string().trim().min(1).max(MAX_FOLDER_NAME_LENGTH),
|
|
18906
|
+
serverIds: idsSchema.min(1)
|
|
18907
|
+
});
|
|
18908
|
+
var serverRailCommandSchema = exports_external.discriminatedUnion("kind", [
|
|
18909
|
+
reorderServersSchema,
|
|
18910
|
+
reorderFoldersSchema,
|
|
18911
|
+
replaceFolderItemsSchema,
|
|
18912
|
+
deleteFolderSchema,
|
|
18913
|
+
createFolderSchema
|
|
18914
|
+
]);
|
|
18915
|
+
var serverRailCommitRequestSchema = exports_external.strictObject({
|
|
18916
|
+
commands: exports_external.array(serverRailCommandSchema).min(1).max(MAX_SERVER_RAIL_COMMANDS)
|
|
18917
|
+
});
|
|
18663
18918
|
// ../shared/src/db/queries/task.ts
|
|
18664
18919
|
var DEFAULT_STALE_SECONDS = Number(process.env.ALOOK_STALE_DISPATCH_TIMEOUT_S) || 20;
|
|
18665
18920
|
var DEFAULT_STALE_RUNNING_SECONDS = Number(process.env.ALOOK_STALE_RUNNING_TIMEOUT_S) || 3600;
|