@alook/cli 0.0.150 → 0.0.152
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 +365 -209
- package/dist/session-runner.js +356 -203
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -189,6 +189,8 @@ var TERMINAL_ISSUE_STATUSES = [
|
|
|
189
189
|
];
|
|
190
190
|
var POLL_INTERVAL_MS = Number(process.env.POLL_INTERVAL_MS) || 3000;
|
|
191
191
|
var OFFLINE_THRESHOLD_MS = Number(process.env.OFFLINE_THRESHOLD_MS) || 30000;
|
|
192
|
+
var COMMUNITY_MACHINE_HEARTBEAT_MS = 30000;
|
|
193
|
+
var COMMUNITY_MACHINE_OFFLINE_THRESHOLD_MS = 3 * COMMUNITY_MACHINE_HEARTBEAT_MS;
|
|
192
194
|
var COMMUNITY_MACHINE_PAIR_TOKEN_TTL_MS = 15 * 60000;
|
|
193
195
|
var EVENT_POLL_INTERVAL_MS = Number(process.env.EVENT_POLL_INTERVAL_MS) || 2000;
|
|
194
196
|
var MeetingStatus = {
|
|
@@ -207,12 +209,25 @@ var COMMUNITY_BOT_NAME_MIN = 1;
|
|
|
207
209
|
var COMMUNITY_BOT_NAME_MAX = 32;
|
|
208
210
|
var COMMUNITY_BOT_DESCRIPTION_MAX = 1024;
|
|
209
211
|
var COMMUNITY_BOT_IMAGE_URL_MAX = 2048;
|
|
210
|
-
var
|
|
211
|
-
|
|
212
|
-
|
|
212
|
+
var DEV_PORTS = {
|
|
213
|
+
web: 3000,
|
|
214
|
+
emailWorker: 8787,
|
|
215
|
+
wsDo: 8789,
|
|
216
|
+
wakeWorker: 8790
|
|
217
|
+
};
|
|
218
|
+
var DEV_WEB_URL = process.env.ALOOK_SERVER_URL || `http://localhost:${DEV_PORTS.web}`;
|
|
219
|
+
var DEV_WS_DO_URL = process.env.DEV_WS_DO_URL || `http://localhost:${DEV_PORTS.wsDo}`;
|
|
220
|
+
var DEV_EMAIL_WORKER_URL = process.env.DEV_EMAIL_WORKER_URL || `http://localhost:${DEV_PORTS.emailWorker}`;
|
|
221
|
+
var DEV_WAKE_WORKER_URL = process.env.DEV_WAKE_WORKER_URL || `http://localhost:${DEV_PORTS.wakeWorker}`;
|
|
222
|
+
function devWsDoPort() {
|
|
223
|
+
const port = Number(new URL(DEV_WS_DO_URL).port);
|
|
224
|
+
return port || DEV_PORTS.wsDo;
|
|
225
|
+
}
|
|
213
226
|
// ../shared/src/constants/community.ts
|
|
227
|
+
var MAX_MESSAGE_CONTENT_LENGTH = 4000;
|
|
214
228
|
var MAX_ATTACHMENT_SIZE_BYTES = 25 * 1024 * 1024;
|
|
215
229
|
var MAX_SERVER_ICON_SIZE_BYTES = 5 * 1024 * 1024;
|
|
230
|
+
var MAX_ICON_SOURCE_FILE_SIZE_BYTES = 15 * 1024 * 1024;
|
|
216
231
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
217
232
|
var exports_external = {};
|
|
218
233
|
__export(exports_external, {
|
|
@@ -15043,6 +15058,11 @@ var SessionErrorFrameSchema = exports_external.object({
|
|
|
15043
15058
|
agentId: exports_external.string().optional(),
|
|
15044
15059
|
payload: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
|
|
15045
15060
|
});
|
|
15061
|
+
var AgentActivityMessageSchema = exports_external.object({
|
|
15062
|
+
type: exports_external.literal("agent_activity"),
|
|
15063
|
+
agentId: exports_external.string(),
|
|
15064
|
+
state: exports_external.enum(["idle", "starting", "running", "stopping"])
|
|
15065
|
+
});
|
|
15046
15066
|
var CommunityPairTokenResponseSchema = exports_external.object({
|
|
15047
15067
|
tokenId: exports_external.string(),
|
|
15048
15068
|
expiresAt: exports_external.string()
|
|
@@ -15067,8 +15087,9 @@ var CommunityDaemonEnrollAgentResponseSchema = exports_external.object({
|
|
|
15067
15087
|
runnerKey: exports_external.string(),
|
|
15068
15088
|
expiresAt: exports_external.string().nullable()
|
|
15069
15089
|
});
|
|
15070
|
-
var
|
|
15071
|
-
|
|
15090
|
+
var BOT_AVATAR_ROUTE_PATTERN = /^\/api\/community\/bots\/[A-Za-z0-9_-]+\/avatar$/;
|
|
15091
|
+
var BotImageUrlSchema = exports_external.string().max(COMMUNITY_BOT_IMAGE_URL_MAX).refine((v) => v.startsWith("https://") || v.startsWith("avatar:") || BOT_AVATAR_ROUTE_PATTERN.test(v), {
|
|
15092
|
+
message: "image must be an https URL, the bot avatar route, or an avatar: config"
|
|
15072
15093
|
});
|
|
15073
15094
|
var CommunityBotCreateRequestSchema = exports_external.object({
|
|
15074
15095
|
name: exports_external.string().trim().min(COMMUNITY_BOT_NAME_MIN).max(COMMUNITY_BOT_NAME_MAX),
|
|
@@ -15087,14 +15108,71 @@ var CommunityBotPatchRequestSchema = exports_external.object({
|
|
|
15087
15108
|
var CommunityBotAddToServerRequestSchema = exports_external.object({
|
|
15088
15109
|
botId: exports_external.string().min(1)
|
|
15089
15110
|
});
|
|
15090
|
-
var
|
|
15091
|
-
|
|
15092
|
-
|
|
15093
|
-
|
|
15094
|
-
|
|
15095
|
-
|
|
15096
|
-
|
|
15097
|
-
|
|
15111
|
+
var CommunityAgentMessageContentSchema = exports_external.object({ text: exports_external.string().min(1).max(MAX_MESSAGE_CONTENT_LENGTH) }).catchall(exports_external.unknown());
|
|
15112
|
+
var CommunityAgentSeqSchema = exports_external.number().int().min(0);
|
|
15113
|
+
var CommunityAgentPositiveSeqSchema = exports_external.number().int().min(1);
|
|
15114
|
+
var CommunityAgentCursorSchema = exports_external.object({
|
|
15115
|
+
channel: exports_external.string().min(1),
|
|
15116
|
+
seq: CommunityAgentPositiveSeqSchema
|
|
15117
|
+
});
|
|
15118
|
+
var CommunityAgentSendRequestSchema = exports_external.object({
|
|
15119
|
+
channel: exports_external.string().min(1),
|
|
15120
|
+
content: CommunityAgentMessageContentSchema,
|
|
15121
|
+
seenUpToSeq: CommunityAgentSeqSchema.optional()
|
|
15122
|
+
});
|
|
15123
|
+
var CommunityAgentInboxPullRequestSchema = exports_external.object({
|
|
15124
|
+
max: exports_external.number().int().min(1).max(200).optional()
|
|
15125
|
+
});
|
|
15126
|
+
var CommunityAgentAckRequestSchema = exports_external.object({
|
|
15127
|
+
cursors: exports_external.array(CommunityAgentCursorSchema).min(1)
|
|
15128
|
+
});
|
|
15129
|
+
var CommunityAgentReadRequestSchema = exports_external.object({
|
|
15130
|
+
channel: exports_external.string().min(1),
|
|
15131
|
+
before: CommunityAgentSeqSchema.optional(),
|
|
15132
|
+
after: CommunityAgentSeqSchema.optional(),
|
|
15133
|
+
around: CommunityAgentSeqSchema.optional(),
|
|
15134
|
+
limit: exports_external.number().int().min(1).max(200).optional()
|
|
15135
|
+
}).refine((v) => [v.before, v.after, v.around].filter((x) => x !== undefined).length <= 1, { message: "at most one of before/after/around may be supplied" });
|
|
15136
|
+
var CommunityAgentResolveRequestSchema = exports_external.object({
|
|
15137
|
+
channel: exports_external.string().min(1),
|
|
15138
|
+
seq: CommunityAgentSeqSchema
|
|
15139
|
+
});
|
|
15140
|
+
var CommunityAgentListChannelsRequestSchema = exports_external.object({
|
|
15141
|
+
server: exports_external.string().min(1).optional()
|
|
15142
|
+
});
|
|
15143
|
+
var CommunityAgentListMembersRequestSchema = exports_external.object({
|
|
15144
|
+
server: exports_external.string().min(1)
|
|
15145
|
+
});
|
|
15146
|
+
var CommunityAgentJoinServerRequestSchema = exports_external.object({
|
|
15147
|
+
invite: exports_external.string().min(1)
|
|
15148
|
+
});
|
|
15149
|
+
var AuditLogCliInvocationPayloadSchema = exports_external.object({
|
|
15150
|
+
subcommand: exports_external.string().min(1)
|
|
15151
|
+
});
|
|
15152
|
+
var AuditLogToolCallPayloadSchema = exports_external.object({
|
|
15153
|
+
name: exports_external.string().min(1)
|
|
15154
|
+
});
|
|
15155
|
+
var AuditLogThinkingPayloadSchema = exports_external.object({
|
|
15156
|
+
text: exports_external.string(),
|
|
15157
|
+
truncated: exports_external.boolean(),
|
|
15158
|
+
chars: exports_external.number().int().nonnegative()
|
|
15159
|
+
});
|
|
15160
|
+
var BotAuditEventSchema = exports_external.discriminatedUnion("kind", [
|
|
15161
|
+
exports_external.object({ kind: exports_external.literal("cli_invocation"), payload: AuditLogCliInvocationPayloadSchema }),
|
|
15162
|
+
exports_external.object({ kind: exports_external.literal("tool_call"), payload: AuditLogToolCallPayloadSchema }),
|
|
15163
|
+
exports_external.object({ kind: exports_external.literal("thinking"), payload: AuditLogThinkingPayloadSchema })
|
|
15164
|
+
]);
|
|
15165
|
+
var BotAuditEventKindSchema = exports_external.enum([
|
|
15166
|
+
"cli_invocation",
|
|
15167
|
+
"tool_call",
|
|
15168
|
+
"thinking"
|
|
15169
|
+
]);
|
|
15170
|
+
var HostBotAuditEventFrameSchema = exports_external.object({
|
|
15171
|
+
type: exports_external.literal("bot_audit_event"),
|
|
15172
|
+
agentId: exports_external.string().min(1),
|
|
15173
|
+
sessionId: exports_external.string().nullable().optional(),
|
|
15174
|
+
launchId: exports_external.string().nullable().optional(),
|
|
15175
|
+
event: BotAuditEventSchema
|
|
15098
15176
|
});
|
|
15099
15177
|
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/entity.js
|
|
15100
15178
|
var entityKind = Symbol.for("drizzle:entityKind");
|
|
@@ -15121,47 +15199,6 @@ function is(value, type) {
|
|
|
15121
15199
|
return false;
|
|
15122
15200
|
}
|
|
15123
15201
|
|
|
15124
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/table.utils.js
|
|
15125
|
-
var TableName = Symbol.for("drizzle:Name");
|
|
15126
|
-
|
|
15127
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/table.js
|
|
15128
|
-
var Schema = Symbol.for("drizzle:Schema");
|
|
15129
|
-
var Columns = Symbol.for("drizzle:Columns");
|
|
15130
|
-
var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
|
|
15131
|
-
var OriginalName = Symbol.for("drizzle:OriginalName");
|
|
15132
|
-
var BaseName = Symbol.for("drizzle:BaseName");
|
|
15133
|
-
var IsAlias = Symbol.for("drizzle:IsAlias");
|
|
15134
|
-
var ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
|
|
15135
|
-
var IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
|
|
15136
|
-
|
|
15137
|
-
class Table {
|
|
15138
|
-
static [entityKind] = "Table";
|
|
15139
|
-
static Symbol = {
|
|
15140
|
-
Name: TableName,
|
|
15141
|
-
Schema,
|
|
15142
|
-
OriginalName,
|
|
15143
|
-
Columns,
|
|
15144
|
-
ExtraConfigColumns,
|
|
15145
|
-
BaseName,
|
|
15146
|
-
IsAlias,
|
|
15147
|
-
ExtraConfigBuilder
|
|
15148
|
-
};
|
|
15149
|
-
[TableName];
|
|
15150
|
-
[OriginalName];
|
|
15151
|
-
[Schema];
|
|
15152
|
-
[Columns];
|
|
15153
|
-
[ExtraConfigColumns];
|
|
15154
|
-
[BaseName];
|
|
15155
|
-
[IsAlias] = false;
|
|
15156
|
-
[IsDrizzleTable] = true;
|
|
15157
|
-
[ExtraConfigBuilder] = undefined;
|
|
15158
|
-
constructor(name, schema, baseName) {
|
|
15159
|
-
this[TableName] = this[OriginalName] = name;
|
|
15160
|
-
this[Schema] = schema;
|
|
15161
|
-
this[BaseName] = baseName;
|
|
15162
|
-
}
|
|
15163
|
-
}
|
|
15164
|
-
|
|
15165
15202
|
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/column.js
|
|
15166
15203
|
class Column {
|
|
15167
15204
|
constructor(table, config2) {
|
|
@@ -15268,6 +15305,9 @@ class ColumnBuilder {
|
|
|
15268
15305
|
}
|
|
15269
15306
|
}
|
|
15270
15307
|
|
|
15308
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/table.utils.js
|
|
15309
|
+
var TableName = Symbol.for("drizzle:Name");
|
|
15310
|
+
|
|
15271
15311
|
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/tracing-utils.js
|
|
15272
15312
|
function iife(fn, ...args) {
|
|
15273
15313
|
return fn(...args);
|
|
@@ -15405,6 +15445,44 @@ var tracer = {
|
|
|
15405
15445
|
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/view-common.js
|
|
15406
15446
|
var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
|
|
15407
15447
|
|
|
15448
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/table.js
|
|
15449
|
+
var Schema = Symbol.for("drizzle:Schema");
|
|
15450
|
+
var Columns = Symbol.for("drizzle:Columns");
|
|
15451
|
+
var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
|
|
15452
|
+
var OriginalName = Symbol.for("drizzle:OriginalName");
|
|
15453
|
+
var BaseName = Symbol.for("drizzle:BaseName");
|
|
15454
|
+
var IsAlias = Symbol.for("drizzle:IsAlias");
|
|
15455
|
+
var ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
|
|
15456
|
+
var IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
|
|
15457
|
+
|
|
15458
|
+
class Table {
|
|
15459
|
+
static [entityKind] = "Table";
|
|
15460
|
+
static Symbol = {
|
|
15461
|
+
Name: TableName,
|
|
15462
|
+
Schema,
|
|
15463
|
+
OriginalName,
|
|
15464
|
+
Columns,
|
|
15465
|
+
ExtraConfigColumns,
|
|
15466
|
+
BaseName,
|
|
15467
|
+
IsAlias,
|
|
15468
|
+
ExtraConfigBuilder
|
|
15469
|
+
};
|
|
15470
|
+
[TableName];
|
|
15471
|
+
[OriginalName];
|
|
15472
|
+
[Schema];
|
|
15473
|
+
[Columns];
|
|
15474
|
+
[ExtraConfigColumns];
|
|
15475
|
+
[BaseName];
|
|
15476
|
+
[IsAlias] = false;
|
|
15477
|
+
[IsDrizzleTable] = true;
|
|
15478
|
+
[ExtraConfigBuilder] = undefined;
|
|
15479
|
+
constructor(name, schema, baseName) {
|
|
15480
|
+
this[TableName] = this[OriginalName] = name;
|
|
15481
|
+
this[Schema] = schema;
|
|
15482
|
+
this[BaseName] = baseName;
|
|
15483
|
+
}
|
|
15484
|
+
}
|
|
15485
|
+
|
|
15408
15486
|
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/sql/sql.js
|
|
15409
15487
|
function isSQLWrapper(value) {
|
|
15410
15488
|
return value !== null && value !== undefined && typeof value.getSQL === "function";
|
|
@@ -15774,6 +15852,34 @@ function getColumnNameAndConfig(a, b) {
|
|
|
15774
15852
|
}
|
|
15775
15853
|
var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder;
|
|
15776
15854
|
|
|
15855
|
+
// ../shared/src/db/community-schema.ts
|
|
15856
|
+
var exports_community_schema = {};
|
|
15857
|
+
__export(exports_community_schema, {
|
|
15858
|
+
communityUserProfile: () => communityUserProfile,
|
|
15859
|
+
communityThreadParticipant: () => communityThreadParticipant,
|
|
15860
|
+
communityServerMember: () => communityServerMember,
|
|
15861
|
+
communityServerInvite: () => communityServerInvite,
|
|
15862
|
+
communityServerFolderItem: () => communityServerFolderItem,
|
|
15863
|
+
communityServerFolder: () => communityServerFolder,
|
|
15864
|
+
communityServer: () => communityServer,
|
|
15865
|
+
communityReadState: () => communityReadState,
|
|
15866
|
+
communityReaction: () => communityReaction,
|
|
15867
|
+
communityPin: () => communityPin,
|
|
15868
|
+
communityNotificationSetting: () => communityNotificationSetting,
|
|
15869
|
+
communityMessageSeq: () => communityMessageSeq,
|
|
15870
|
+
communityMessage: () => communityMessage,
|
|
15871
|
+
communityMention: () => communityMention,
|
|
15872
|
+
communityFriendship: () => communityFriendship,
|
|
15873
|
+
communityDmConversation: () => communityDmConversation,
|
|
15874
|
+
communityChannelMember: () => communityChannelMember,
|
|
15875
|
+
communityChannel: () => communityChannel,
|
|
15876
|
+
communityCategory: () => communityCategory,
|
|
15877
|
+
communityBotApprovalRequest: () => communityBotApprovalRequest,
|
|
15878
|
+
communityBotActivityEvent: () => communityBotActivityEvent,
|
|
15879
|
+
communityAuditLog: () => communityAuditLog,
|
|
15880
|
+
communityAttachment: () => communityAttachment
|
|
15881
|
+
});
|
|
15882
|
+
|
|
15777
15883
|
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_9f1a3370d3c5742dfd96aef86d667915/node_modules/drizzle-orm/sqlite-core/foreign-keys.js
|
|
15778
15884
|
class ForeignKeyBuilder {
|
|
15779
15885
|
static [entityKind] = "SQLiteForeignKeyBuilder";
|
|
@@ -16442,6 +16548,9 @@ class PrimaryKey {
|
|
|
16442
16548
|
}
|
|
16443
16549
|
}
|
|
16444
16550
|
|
|
16551
|
+
// ../shared/src/db/community-schema.ts
|
|
16552
|
+
init_nanoid();
|
|
16553
|
+
|
|
16445
16554
|
// ../shared/src/db/schema.ts
|
|
16446
16555
|
var exports_schema = {};
|
|
16447
16556
|
__export(exports_schema, {
|
|
@@ -16490,7 +16599,7 @@ var user = sqliteTable("user", {
|
|
|
16490
16599
|
createdAt: text("createdAt").notNull().$defaultFn(() => new Date().toISOString()),
|
|
16491
16600
|
updatedAt: text("updatedAt").notNull().$defaultFn(() => new Date().toISOString()),
|
|
16492
16601
|
isBot: integer2("isBot", { mode: "boolean" }).notNull().default(false),
|
|
16493
|
-
ownerUserId: text("ownerUserId"),
|
|
16602
|
+
ownerUserId: text("ownerUserId").references(() => user.id, { onDelete: "no action" }),
|
|
16494
16603
|
deletedAt: text("deletedAt"),
|
|
16495
16604
|
discriminator: text("discriminator").notNull().default("0000")
|
|
16496
16605
|
}, (t) => [index("idx_user_ownerUserId_isBot").on(t.ownerUserId, t.isBot)]);
|
|
@@ -17031,30 +17140,6 @@ var inboxUnread = sqliteTable("inbox_unread", {
|
|
|
17031
17140
|
]);
|
|
17032
17141
|
|
|
17033
17142
|
// ../shared/src/db/community-schema.ts
|
|
17034
|
-
var exports_community_schema = {};
|
|
17035
|
-
__export(exports_community_schema, {
|
|
17036
|
-
communityUserProfile: () => communityUserProfile,
|
|
17037
|
-
communityServerMember: () => communityServerMember,
|
|
17038
|
-
communityServerInvite: () => communityServerInvite,
|
|
17039
|
-
communityServerFolderItem: () => communityServerFolderItem,
|
|
17040
|
-
communityServerFolder: () => communityServerFolder,
|
|
17041
|
-
communityServer: () => communityServer,
|
|
17042
|
-
communityReadState: () => communityReadState,
|
|
17043
|
-
communityReaction: () => communityReaction,
|
|
17044
|
-
communityPin: () => communityPin,
|
|
17045
|
-
communityNotificationSetting: () => communityNotificationSetting,
|
|
17046
|
-
communityMessage: () => communityMessage,
|
|
17047
|
-
communityMention: () => communityMention,
|
|
17048
|
-
communityInboxDismissal: () => communityInboxDismissal,
|
|
17049
|
-
communityFriendship: () => communityFriendship,
|
|
17050
|
-
communityDmConversation: () => communityDmConversation,
|
|
17051
|
-
communityChannel: () => communityChannel,
|
|
17052
|
-
communityCategory: () => communityCategory,
|
|
17053
|
-
communityBotApprovalRequest: () => communityBotApprovalRequest,
|
|
17054
|
-
communityAuditLog: () => communityAuditLog,
|
|
17055
|
-
communityAttachment: () => communityAttachment
|
|
17056
|
-
});
|
|
17057
|
-
init_nanoid();
|
|
17058
17143
|
var communityServer = sqliteTable("community_server", {
|
|
17059
17144
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17060
17145
|
name: text("name").notNull(),
|
|
@@ -17096,6 +17181,26 @@ var communityChannel = sqliteTable("community_channel", {
|
|
|
17096
17181
|
index("idx_channel_server_last_message").on(t.serverId, t.lastMessageAt),
|
|
17097
17182
|
index("idx_channel_parent").on(t.parentChannelId)
|
|
17098
17183
|
]);
|
|
17184
|
+
var communityChannelMember = sqliteTable("community_channel_member", {
|
|
17185
|
+
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17186
|
+
channelId: text("channel_id").notNull().references(() => communityChannel.id, { onDelete: "cascade" }),
|
|
17187
|
+
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17188
|
+
addedBy: text("added_by").references(() => user.id, { onDelete: "set null" }),
|
|
17189
|
+
addedAt: text("added_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17190
|
+
}, (t) => [
|
|
17191
|
+
unique("uq_channel_member").on(t.channelId, t.userId),
|
|
17192
|
+
index("idx_channel_member_user").on(t.userId)
|
|
17193
|
+
]);
|
|
17194
|
+
var communityThreadParticipant = sqliteTable("community_thread_participant", {
|
|
17195
|
+
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17196
|
+
threadChannelId: text("thread_channel_id").notNull().references(() => communityChannel.id, { onDelete: "cascade" }),
|
|
17197
|
+
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17198
|
+
source: text("source").notNull().default("mention"),
|
|
17199
|
+
addedAt: text("added_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17200
|
+
}, (t) => [
|
|
17201
|
+
unique("uq_thread_participant").on(t.threadChannelId, t.userId),
|
|
17202
|
+
index("idx_thread_participant_user").on(t.userId)
|
|
17203
|
+
]);
|
|
17099
17204
|
var communityDmConversation = sqliteTable("community_dm_conversation", {
|
|
17100
17205
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17101
17206
|
user1Id: text("user1_id").references(() => user.id, { onDelete: "set null" }),
|
|
@@ -17120,12 +17225,17 @@ var communityMessage = sqliteTable("community_message", {
|
|
|
17120
17225
|
channelId: text("channel_id").references(() => communityChannel.id, {
|
|
17121
17226
|
onDelete: "cascade"
|
|
17122
17227
|
}),
|
|
17123
|
-
dmConversationId: text("dm_conversation_id").references(() => communityDmConversation.id, { onDelete: "cascade" })
|
|
17228
|
+
dmConversationId: text("dm_conversation_id").references(() => communityDmConversation.id, { onDelete: "cascade" }),
|
|
17229
|
+
seq: integer2("seq").notNull().default(0)
|
|
17124
17230
|
}, (t) => [
|
|
17125
17231
|
index("idx_message_channel_created").on(t.channelId, t.createdAt),
|
|
17126
17232
|
index("idx_message_channel_mention_created").on(t.channelId, t.mentionType, t.createdAt),
|
|
17127
17233
|
index("idx_message_dm_created").on(t.dmConversationId, t.createdAt)
|
|
17128
17234
|
]);
|
|
17235
|
+
var communityMessageSeq = sqliteTable("community_message_seq", {
|
|
17236
|
+
scopeKey: text("scope_key").primaryKey(),
|
|
17237
|
+
nextSeq: integer2("next_seq").notNull()
|
|
17238
|
+
});
|
|
17129
17239
|
var communityServerMember = sqliteTable("community_server_member", {
|
|
17130
17240
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17131
17241
|
serverId: text("server_id").notNull().references(() => communityServer.id, { onDelete: "cascade" }),
|
|
@@ -17184,7 +17294,8 @@ var communityReadState = sqliteTable("community_read_state", {
|
|
|
17184
17294
|
}),
|
|
17185
17295
|
dmConversationId: text("dm_conversation_id").references(() => communityDmConversation.id, { onDelete: "cascade" }),
|
|
17186
17296
|
lastReadAt: text("last_read_at").notNull(),
|
|
17187
|
-
lastReadMessageId: text("last_read_message_id")
|
|
17297
|
+
lastReadMessageId: text("last_read_message_id"),
|
|
17298
|
+
lastReadSeq: integer2("last_read_seq").notNull().default(0)
|
|
17188
17299
|
}, (t) => [index("idx_read_state_user").on(t.userId)]);
|
|
17189
17300
|
var communityReaction = sqliteTable("community_reaction", {
|
|
17190
17301
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
@@ -17230,7 +17341,9 @@ var communityMention = sqliteTable("community_mention", {
|
|
|
17230
17341
|
var communityUserProfile = sqliteTable("community_user_profile", {
|
|
17231
17342
|
userId: text("user_id").primaryKey().references(() => user.id, { onDelete: "cascade" }),
|
|
17232
17343
|
aboutMe: text("about_me").default(""),
|
|
17233
|
-
bannerColor: text("banner_color")
|
|
17344
|
+
bannerColor: text("banner_color"),
|
|
17345
|
+
statusEmoji: text("status_emoji"),
|
|
17346
|
+
statusText: text("status_text").default("")
|
|
17234
17347
|
});
|
|
17235
17348
|
var communityNotificationSetting = sqliteTable("community_notification_setting", {
|
|
17236
17349
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
@@ -17273,16 +17386,117 @@ var communityBotApprovalRequest = sqliteTable("community_bot_approval_request",
|
|
|
17273
17386
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),
|
|
17274
17387
|
resolvedAt: text("resolved_at")
|
|
17275
17388
|
}, (t) => [index("idx_community_bot_approval_bot").on(t.botId, t.status)]);
|
|
17276
|
-
var
|
|
17277
|
-
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17278
|
-
|
|
17279
|
-
|
|
17280
|
-
|
|
17389
|
+
var communityBotActivityEvent = sqliteTable("community_bot_activity_event", {
|
|
17390
|
+
id: text("id").primaryKey().$defaultFn(() => "bae_" + nanoid3()),
|
|
17391
|
+
botId: text("bot_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
17392
|
+
sessionId: text("session_id"),
|
|
17393
|
+
launchId: text("launch_id"),
|
|
17394
|
+
kind: text("kind").notNull(),
|
|
17395
|
+
payload: text("payload").notNull(),
|
|
17396
|
+
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17281
17397
|
}, (t) => [
|
|
17282
|
-
|
|
17283
|
-
index("idx_inbox_dismissal_user").on(t.userId)
|
|
17398
|
+
index("idx_bot_activity_event_bot_created").on(t.botId, t.createdAt, t.id)
|
|
17284
17399
|
]);
|
|
17285
17400
|
|
|
17401
|
+
// ../shared/src/logger.ts
|
|
17402
|
+
var LEVELS = {
|
|
17403
|
+
debug: 0,
|
|
17404
|
+
info: 1,
|
|
17405
|
+
warn: 2,
|
|
17406
|
+
error: 3,
|
|
17407
|
+
silent: 4
|
|
17408
|
+
};
|
|
17409
|
+
|
|
17410
|
+
class Logger {
|
|
17411
|
+
service;
|
|
17412
|
+
level;
|
|
17413
|
+
pretty;
|
|
17414
|
+
fields;
|
|
17415
|
+
constructor(opts, fields) {
|
|
17416
|
+
this.service = opts.service;
|
|
17417
|
+
this.level = LEVELS[opts.level ?? "info"];
|
|
17418
|
+
this.pretty = opts.pretty ?? false;
|
|
17419
|
+
this.fields = fields ?? {};
|
|
17420
|
+
}
|
|
17421
|
+
debug(msg, ctx) {
|
|
17422
|
+
this.write("debug", msg, ctx);
|
|
17423
|
+
}
|
|
17424
|
+
info(msg, ctx) {
|
|
17425
|
+
this.write("info", msg, ctx);
|
|
17426
|
+
}
|
|
17427
|
+
warn(msg, ctx) {
|
|
17428
|
+
this.write("warn", msg, ctx);
|
|
17429
|
+
}
|
|
17430
|
+
error(msg, ctx) {
|
|
17431
|
+
this.write("error", msg, ctx);
|
|
17432
|
+
}
|
|
17433
|
+
child(fields) {
|
|
17434
|
+
const merged = { ...this.fields, ...fields };
|
|
17435
|
+
const child = new Logger({ service: this.service, level: this.levelName(), pretty: this.pretty }, merged);
|
|
17436
|
+
return child;
|
|
17437
|
+
}
|
|
17438
|
+
levelName() {
|
|
17439
|
+
for (const [name, num] of Object.entries(LEVELS)) {
|
|
17440
|
+
if (num === this.level)
|
|
17441
|
+
return name;
|
|
17442
|
+
}
|
|
17443
|
+
return "info";
|
|
17444
|
+
}
|
|
17445
|
+
write(level, msg, ctx) {
|
|
17446
|
+
if (LEVELS[level] < this.level)
|
|
17447
|
+
return;
|
|
17448
|
+
const entry = {
|
|
17449
|
+
level,
|
|
17450
|
+
msg,
|
|
17451
|
+
service: this.service,
|
|
17452
|
+
...this.fields,
|
|
17453
|
+
...ctx,
|
|
17454
|
+
ts: new Date().toISOString()
|
|
17455
|
+
};
|
|
17456
|
+
for (const [k, v] of Object.entries(entry)) {
|
|
17457
|
+
if (v instanceof Error) {
|
|
17458
|
+
entry[k] = { message: v.message, stack: v.stack };
|
|
17459
|
+
}
|
|
17460
|
+
}
|
|
17461
|
+
let line;
|
|
17462
|
+
if (this.pretty) {
|
|
17463
|
+
const ts = entry.ts.replace("T", " ").replace("Z", "");
|
|
17464
|
+
const lvl = entry.level.toUpperCase().padEnd(5);
|
|
17465
|
+
const pairs = Object.entries(entry).filter(([k]) => k !== "level" && k !== "msg" && k !== "service" && k !== "ts").map(([k, v]) => `${k}=${typeof v === "object" ? JSON.stringify(v) : v}`).join(" ");
|
|
17466
|
+
line = `${ts} ${lvl} [${entry.service}] ${entry.msg}${pairs ? " " + pairs : ""}`;
|
|
17467
|
+
} else {
|
|
17468
|
+
line = JSON.stringify(entry);
|
|
17469
|
+
}
|
|
17470
|
+
if (level === "error") {
|
|
17471
|
+
console.error(line);
|
|
17472
|
+
} else {
|
|
17473
|
+
console.log(line);
|
|
17474
|
+
}
|
|
17475
|
+
}
|
|
17476
|
+
}
|
|
17477
|
+
function createLogger(opts) {
|
|
17478
|
+
return new Logger(opts);
|
|
17479
|
+
}
|
|
17480
|
+
|
|
17481
|
+
// ../shared/src/db/queries/community/message.ts
|
|
17482
|
+
var log = createLogger({ service: "community-queries" });
|
|
17483
|
+
var listedMessageProjection = {
|
|
17484
|
+
id: communityMessage.id,
|
|
17485
|
+
authorId: communityMessage.authorId,
|
|
17486
|
+
content: communityMessage.content,
|
|
17487
|
+
type: communityMessage.type,
|
|
17488
|
+
mentionType: communityMessage.mentionType,
|
|
17489
|
+
replyToId: communityMessage.replyToId,
|
|
17490
|
+
embeds: communityMessage.embeds,
|
|
17491
|
+
flags: communityMessage.flags,
|
|
17492
|
+
createdAt: communityMessage.createdAt,
|
|
17493
|
+
channelId: communityMessage.channelId,
|
|
17494
|
+
dmConversationId: communityMessage.dmConversationId,
|
|
17495
|
+
authorName: user.name,
|
|
17496
|
+
authorEmail: user.email,
|
|
17497
|
+
authorImage: user.image
|
|
17498
|
+
};
|
|
17499
|
+
|
|
17286
17500
|
// ../shared/src/db/community-machine-schema.ts
|
|
17287
17501
|
var exports_community_machine_schema = {};
|
|
17288
17502
|
__export(exports_community_machine_schema, {
|
|
@@ -17357,8 +17571,6 @@ var communityAgentRunnerKey = sqliteTable("community_agent_runner_key", {
|
|
|
17357
17571
|
index("idx_community_agent_runner_key_machine_agent").on(t.machineId, t.agentId)
|
|
17358
17572
|
]);
|
|
17359
17573
|
|
|
17360
|
-
// ../shared/src/db/index.ts
|
|
17361
|
-
var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema };
|
|
17362
17574
|
// ../shared/src/db/queries/user.ts
|
|
17363
17575
|
var publicUserColumns = {
|
|
17364
17576
|
id: user.id,
|
|
@@ -17376,6 +17588,53 @@ var internalUserColumns = {
|
|
|
17376
17588
|
ownerUserId: user.ownerUserId,
|
|
17377
17589
|
deletedAt: user.deletedAt
|
|
17378
17590
|
};
|
|
17591
|
+
|
|
17592
|
+
// ../shared/src/db/queries/community/channel.ts
|
|
17593
|
+
var log2 = createLogger({ service: "community-queries" });
|
|
17594
|
+
var CHANNEL_COLUMNS = {
|
|
17595
|
+
id: communityChannel.id,
|
|
17596
|
+
serverId: communityChannel.serverId,
|
|
17597
|
+
categoryId: communityChannel.categoryId,
|
|
17598
|
+
name: communityChannel.name,
|
|
17599
|
+
type: communityChannel.type,
|
|
17600
|
+
topic: communityChannel.topic,
|
|
17601
|
+
position: communityChannel.position,
|
|
17602
|
+
forumTags: communityChannel.forumTags,
|
|
17603
|
+
parentChannelId: communityChannel.parentChannelId,
|
|
17604
|
+
creatorId: communityChannel.creatorId,
|
|
17605
|
+
messageCount: communityChannel.messageCount,
|
|
17606
|
+
archived: communityChannel.archived,
|
|
17607
|
+
parentMessageId: communityChannel.parentMessageId,
|
|
17608
|
+
lastMessageAt: communityChannel.lastMessageAt,
|
|
17609
|
+
createdAt: communityChannel.createdAt
|
|
17610
|
+
};
|
|
17611
|
+
|
|
17612
|
+
// ../shared/src/db/queries/community/agent-inbox.ts
|
|
17613
|
+
var AGENT_MESSAGE_COLUMNS = {
|
|
17614
|
+
id: communityMessage.id,
|
|
17615
|
+
authorId: communityMessage.authorId,
|
|
17616
|
+
content: communityMessage.content,
|
|
17617
|
+
createdAt: communityMessage.createdAt,
|
|
17618
|
+
channelId: communityMessage.channelId,
|
|
17619
|
+
dmConversationId: communityMessage.dmConversationId,
|
|
17620
|
+
seq: communityMessage.seq
|
|
17621
|
+
};
|
|
17622
|
+
// ../shared/src/community/bot-activity-presets.ts
|
|
17623
|
+
var BOT_ACTIVITY_PRESETS = {
|
|
17624
|
+
idle: { emoji: "\uD83D\uDCA4", text: "Idle" },
|
|
17625
|
+
starting: { emoji: "\uD83C\uDF00", text: "Waking up" },
|
|
17626
|
+
stopping: { emoji: "\uD83C\uDF19", text: "Wrapping up" }
|
|
17627
|
+
};
|
|
17628
|
+
var RUNNING_PRESETS = [
|
|
17629
|
+
{ emoji: "⚡", text: "Working on it" },
|
|
17630
|
+
{ emoji: "\uD83D\uDEE0️", text: "Cooking" },
|
|
17631
|
+
{ emoji: "\uD83E\uDDE0", text: "Thinking hard" },
|
|
17632
|
+
{ emoji: "\uD83D\uDD27", text: "Tinkering" },
|
|
17633
|
+
{ emoji: "\uD83D\uDE80", text: "On it" },
|
|
17634
|
+
{ emoji: "\uD83D\uDD25", text: "In the zone" }
|
|
17635
|
+
];
|
|
17636
|
+
// ../shared/src/db/index.ts
|
|
17637
|
+
var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema };
|
|
17379
17638
|
// ../shared/src/db/queries/task.ts
|
|
17380
17639
|
var DEFAULT_STALE_SECONDS = Number(process.env.ALOOK_STALE_DISPATCH_TIMEOUT_S) || 20;
|
|
17381
17640
|
var DEFAULT_STALE_RUNNING_SECONDS = Number(process.env.ALOOK_STALE_RUNNING_TIMEOUT_S) || 3600;
|
|
@@ -17401,109 +17660,15 @@ var RESERVED_HANDLES = new Set([
|
|
|
17401
17660
|
function toAlookAddress(h) {
|
|
17402
17661
|
return `${h}${DOMAIN}`;
|
|
17403
17662
|
}
|
|
17404
|
-
// ../shared/src/logger.ts
|
|
17405
|
-
var LEVELS = {
|
|
17406
|
-
debug: 0,
|
|
17407
|
-
info: 1,
|
|
17408
|
-
warn: 2,
|
|
17409
|
-
error: 3,
|
|
17410
|
-
silent: 4
|
|
17411
|
-
};
|
|
17412
|
-
|
|
17413
|
-
class Logger {
|
|
17414
|
-
service;
|
|
17415
|
-
level;
|
|
17416
|
-
pretty;
|
|
17417
|
-
fields;
|
|
17418
|
-
constructor(opts, fields) {
|
|
17419
|
-
this.service = opts.service;
|
|
17420
|
-
this.level = LEVELS[opts.level ?? "info"];
|
|
17421
|
-
this.pretty = opts.pretty ?? false;
|
|
17422
|
-
this.fields = fields ?? {};
|
|
17423
|
-
}
|
|
17424
|
-
debug(msg, ctx) {
|
|
17425
|
-
this.write("debug", msg, ctx);
|
|
17426
|
-
}
|
|
17427
|
-
info(msg, ctx) {
|
|
17428
|
-
this.write("info", msg, ctx);
|
|
17429
|
-
}
|
|
17430
|
-
warn(msg, ctx) {
|
|
17431
|
-
this.write("warn", msg, ctx);
|
|
17432
|
-
}
|
|
17433
|
-
error(msg, ctx) {
|
|
17434
|
-
this.write("error", msg, ctx);
|
|
17435
|
-
}
|
|
17436
|
-
child(fields) {
|
|
17437
|
-
const merged = { ...this.fields, ...fields };
|
|
17438
|
-
const child = new Logger({ service: this.service, level: this.levelName(), pretty: this.pretty }, merged);
|
|
17439
|
-
return child;
|
|
17440
|
-
}
|
|
17441
|
-
levelName() {
|
|
17442
|
-
for (const [name, num] of Object.entries(LEVELS)) {
|
|
17443
|
-
if (num === this.level)
|
|
17444
|
-
return name;
|
|
17445
|
-
}
|
|
17446
|
-
return "info";
|
|
17447
|
-
}
|
|
17448
|
-
write(level, msg, ctx) {
|
|
17449
|
-
if (LEVELS[level] < this.level)
|
|
17450
|
-
return;
|
|
17451
|
-
const entry = {
|
|
17452
|
-
level,
|
|
17453
|
-
msg,
|
|
17454
|
-
service: this.service,
|
|
17455
|
-
...this.fields,
|
|
17456
|
-
...ctx,
|
|
17457
|
-
ts: new Date().toISOString()
|
|
17458
|
-
};
|
|
17459
|
-
for (const [k, v] of Object.entries(entry)) {
|
|
17460
|
-
if (v instanceof Error) {
|
|
17461
|
-
entry[k] = { message: v.message, stack: v.stack };
|
|
17462
|
-
}
|
|
17463
|
-
}
|
|
17464
|
-
let line;
|
|
17465
|
-
if (this.pretty) {
|
|
17466
|
-
const ts = entry.ts.replace("T", " ").replace("Z", "");
|
|
17467
|
-
const lvl = entry.level.toUpperCase().padEnd(5);
|
|
17468
|
-
const pairs = Object.entries(entry).filter(([k]) => k !== "level" && k !== "msg" && k !== "service" && k !== "ts").map(([k, v]) => `${k}=${typeof v === "object" ? JSON.stringify(v) : v}`).join(" ");
|
|
17469
|
-
line = `${ts} ${lvl} [${entry.service}] ${entry.msg}${pairs ? " " + pairs : ""}`;
|
|
17470
|
-
} else {
|
|
17471
|
-
line = JSON.stringify(entry);
|
|
17472
|
-
}
|
|
17473
|
-
if (level === "error") {
|
|
17474
|
-
console.error(line);
|
|
17475
|
-
} else {
|
|
17476
|
-
console.log(line);
|
|
17477
|
-
}
|
|
17478
|
-
}
|
|
17479
|
-
}
|
|
17480
|
-
function createLogger(opts) {
|
|
17481
|
-
return new Logger(opts);
|
|
17482
|
-
}
|
|
17483
|
-
|
|
17484
|
-
// ../shared/src/db/queries/community/channel.ts
|
|
17485
|
-
var log = createLogger({ service: "community-queries" });
|
|
17486
|
-
var CHANNEL_COLUMNS = {
|
|
17487
|
-
id: communityChannel.id,
|
|
17488
|
-
serverId: communityChannel.serverId,
|
|
17489
|
-
categoryId: communityChannel.categoryId,
|
|
17490
|
-
name: communityChannel.name,
|
|
17491
|
-
type: communityChannel.type,
|
|
17492
|
-
topic: communityChannel.topic,
|
|
17493
|
-
position: communityChannel.position,
|
|
17494
|
-
forumTags: communityChannel.forumTags,
|
|
17495
|
-
parentChannelId: communityChannel.parentChannelId,
|
|
17496
|
-
creatorId: communityChannel.creatorId,
|
|
17497
|
-
messageCount: communityChannel.messageCount,
|
|
17498
|
-
archived: communityChannel.archived,
|
|
17499
|
-
parentMessageId: communityChannel.parentMessageId,
|
|
17500
|
-
lastMessageAt: communityChannel.lastMessageAt,
|
|
17501
|
-
createdAt: communityChannel.createdAt
|
|
17502
|
-
};
|
|
17503
|
-
// ../shared/src/db/queries/community/message.ts
|
|
17504
|
-
var log2 = createLogger({ service: "community-queries" });
|
|
17505
17663
|
// ../shared/src/db/queries/community/search.ts
|
|
17506
17664
|
var FTS_KEYWORDS = new Set(["and", "or", "not", "near"]);
|
|
17665
|
+
// ../shared/src/db/queries/community/machine.ts
|
|
17666
|
+
var BOT_ACTIVITY_STATUS_PAIRS = [
|
|
17667
|
+
BOT_ACTIVITY_PRESETS.idle,
|
|
17668
|
+
BOT_ACTIVITY_PRESETS.starting,
|
|
17669
|
+
BOT_ACTIVITY_PRESETS.stopping,
|
|
17670
|
+
...RUNNING_PRESETS
|
|
17671
|
+
];
|
|
17507
17672
|
// ../shared/src/semver.ts
|
|
17508
17673
|
function semverGte(a, b) {
|
|
17509
17674
|
const pa = a.split(".").map(Number);
|
|
@@ -17568,14 +17733,13 @@ function cliCommand(mode) {
|
|
|
17568
17733
|
}
|
|
17569
17734
|
}
|
|
17570
17735
|
var DEFAULT_BASE_URL = "https://alook.ai";
|
|
17571
|
-
var DEV_BASE_URL = "http://localhost:3000";
|
|
17572
17736
|
function getBaseUrl(signals) {
|
|
17573
17737
|
if (signals.serverUrl)
|
|
17574
17738
|
return signals.serverUrl;
|
|
17575
17739
|
if (signals.appUrl)
|
|
17576
17740
|
return signals.appUrl;
|
|
17577
17741
|
if (signals.nodeEnv === "development")
|
|
17578
|
-
return
|
|
17742
|
+
return DEV_WEB_URL;
|
|
17579
17743
|
return DEFAULT_BASE_URL;
|
|
17580
17744
|
}
|
|
17581
17745
|
// lib/env.ts
|
|
@@ -18107,23 +18271,15 @@ function isAlive(pid) {
|
|
|
18107
18271
|
}
|
|
18108
18272
|
}
|
|
18109
18273
|
function signalTree(pid, signal) {
|
|
18110
|
-
if (isPosix) {
|
|
18111
|
-
try {
|
|
18112
|
-
process.kill(-pid, signal);
|
|
18113
|
-
return;
|
|
18114
|
-
} catch (e) {
|
|
18115
|
-
const code = e?.code;
|
|
18116
|
-
if (code === "ESRCH")
|
|
18117
|
-
return;
|
|
18118
|
-
}
|
|
18119
|
-
}
|
|
18120
18274
|
if (!isPosix) {
|
|
18121
18275
|
try {
|
|
18122
18276
|
execSync(`taskkill /PID ${pid} /T /F`, { stdio: "ignore" });
|
|
18123
|
-
return;
|
|
18124
18277
|
} catch {}
|
|
18125
18278
|
return;
|
|
18126
18279
|
}
|
|
18280
|
+
try {
|
|
18281
|
+
process.kill(-pid, signal);
|
|
18282
|
+
} catch {}
|
|
18127
18283
|
try {
|
|
18128
18284
|
process.kill(pid, signal);
|
|
18129
18285
|
} catch {}
|
|
@@ -22005,7 +22161,7 @@ var WS_RECONNECT_INIT = 1000;
|
|
|
22005
22161
|
var WS_RECONNECT_MAX = 30000;
|
|
22006
22162
|
var WS_PING_INTERVAL = 25000;
|
|
22007
22163
|
var WS_LIVENESS_TIMEOUT = 50000;
|
|
22008
|
-
var WS_DO_DEV_PORT = Number(process.env.ALOOK_WS_DO_PORT) ||
|
|
22164
|
+
var WS_DO_DEV_PORT = Number(process.env.ALOOK_WS_DO_PORT) || devWsDoPort();
|
|
22009
22165
|
|
|
22010
22166
|
class DaemonWsClient {
|
|
22011
22167
|
opts;
|
|
@@ -25501,7 +25657,7 @@ function syncCommand() {
|
|
|
25501
25657
|
// commands/workspace.ts
|
|
25502
25658
|
import { Command as Command13 } from "commander";
|
|
25503
25659
|
import { readFileSync as readFileSync15 } from "fs";
|
|
25504
|
-
function
|
|
25660
|
+
function slugify3(name) {
|
|
25505
25661
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 60);
|
|
25506
25662
|
}
|
|
25507
25663
|
function sleep4(ms) {
|
|
@@ -25525,7 +25681,7 @@ async function resolveWorkspaceId(client, configName) {
|
|
|
25525
25681
|
}
|
|
25526
25682
|
const wsName = configName || "Personal";
|
|
25527
25683
|
try {
|
|
25528
|
-
const newWs = await client.postJSON("/api/workspaces", { name: wsName, slug:
|
|
25684
|
+
const newWs = await client.postJSON("/api/workspaces", { name: wsName, slug: slugify3(wsName) });
|
|
25529
25685
|
console.log(`Created workspace: ${newWs.name} (${newWs.id})`);
|
|
25530
25686
|
return { workspaceId: newWs.id, created: true };
|
|
25531
25687
|
} catch (err) {
|
|
@@ -25651,7 +25807,7 @@ Workspace initialized: ${res.studio.name || res.workspace.name}`);
|
|
|
25651
25807
|
if (agents.length > 0) {
|
|
25652
25808
|
console.log("Current workspace has existing agents. Creating a new workspace...");
|
|
25653
25809
|
const wsName = opts.name || config2.name || "New Workspace";
|
|
25654
|
-
const newWs = await targetClient.postJSON("/api/workspaces", { name: wsName, slug:
|
|
25810
|
+
const newWs = await targetClient.postJSON("/api/workspaces", { name: wsName, slug: slugify3(wsName) });
|
|
25655
25811
|
targetWorkspaceId = newWs.id;
|
|
25656
25812
|
targetClient = new APIClient(serverUrl, token, targetWorkspaceId);
|
|
25657
25813
|
console.log(`Created workspace: ${newWs.name} (${newWs.id})`);
|