@alook/cli 0.0.159 → 0.0.160
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 +61 -10
- package/dist/session-runner.js +59 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -40,6 +40,50 @@ function fillPool(bytes) {
|
|
|
40
40
|
}
|
|
41
41
|
poolOffset += bytes;
|
|
42
42
|
}
|
|
43
|
+
function random(bytes) {
|
|
44
|
+
fillPool(bytes |= 0);
|
|
45
|
+
return pool.subarray(poolOffset - bytes, poolOffset);
|
|
46
|
+
}
|
|
47
|
+
function customRandom(alphabet, defaultSize, getRandom) {
|
|
48
|
+
let safeByteCutoff = 256 - 256 % alphabet.length;
|
|
49
|
+
if (safeByteCutoff === 256) {
|
|
50
|
+
let mask = alphabet.length - 1;
|
|
51
|
+
return (size = defaultSize) => {
|
|
52
|
+
if (!size)
|
|
53
|
+
return "";
|
|
54
|
+
let id = "";
|
|
55
|
+
while (true) {
|
|
56
|
+
let bytes = getRandom(size);
|
|
57
|
+
let i = size;
|
|
58
|
+
while (i--) {
|
|
59
|
+
id += alphabet[bytes[i] & mask];
|
|
60
|
+
if (id.length >= size)
|
|
61
|
+
return id;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
let step = Math.ceil(1.6 * 256 * defaultSize / safeByteCutoff);
|
|
67
|
+
return (size = defaultSize) => {
|
|
68
|
+
if (!size)
|
|
69
|
+
return "";
|
|
70
|
+
let id = "";
|
|
71
|
+
while (true) {
|
|
72
|
+
let bytes = getRandom(step);
|
|
73
|
+
let i = step;
|
|
74
|
+
while (i--) {
|
|
75
|
+
if (bytes[i] < safeByteCutoff) {
|
|
76
|
+
id += alphabet[bytes[i] % alphabet.length];
|
|
77
|
+
if (id.length >= size)
|
|
78
|
+
return id;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function customAlphabet(alphabet, size = 21) {
|
|
85
|
+
return customRandom(alphabet, size, random);
|
|
86
|
+
}
|
|
43
87
|
function nanoid3(size = 21) {
|
|
44
88
|
fillPool(size |= 0);
|
|
45
89
|
let id = "";
|
|
@@ -14506,6 +14550,13 @@ function date4(params) {
|
|
|
14506
14550
|
|
|
14507
14551
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
14508
14552
|
config(en_default());
|
|
14553
|
+
// ../shared/src/utils/slug.ts
|
|
14554
|
+
init_nanoid();
|
|
14555
|
+
var slugId = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz");
|
|
14556
|
+
function sanitizeSlug(input) {
|
|
14557
|
+
return input.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60).replace(/-+$/g, "");
|
|
14558
|
+
}
|
|
14559
|
+
|
|
14509
14560
|
// ../shared/src/lib/community-name.ts
|
|
14510
14561
|
var FORBIDDEN_NAME_CHARS = /[#@\x00-\x1f\x7f-\x9f]/;
|
|
14511
14562
|
function validateCommunityName(name) {
|
|
@@ -14933,11 +14984,11 @@ var UpdateMemberRequestSchema = exports_external.object({
|
|
|
14933
14984
|
});
|
|
14934
14985
|
var CreateWorkspaceRequestSchema = exports_external.object({
|
|
14935
14986
|
name: exports_external.string().min(1, "name is required"),
|
|
14936
|
-
slug: exports_external.string().optional().default("")
|
|
14987
|
+
slug: exports_external.string().optional().default("").transform(sanitizeSlug)
|
|
14937
14988
|
});
|
|
14938
14989
|
var UpdateWorkspaceRequestSchema = exports_external.object({
|
|
14939
14990
|
name: exports_external.string().min(1, "name is required").max(100).trim().optional(),
|
|
14940
|
-
slug: exports_external.string().min(1, "slug is required").
|
|
14991
|
+
slug: exports_external.string().min(1, "slug is required").trim().toLowerCase().transform(sanitizeSlug).optional()
|
|
14941
14992
|
});
|
|
14942
14993
|
var DeleteWorkspaceRequestSchema = exports_external.object({
|
|
14943
14994
|
confirm_name: exports_external.string().min(1, "confirm_name is required")
|
|
@@ -17241,7 +17292,8 @@ var communityChannel = sqliteTable("community_channel", {
|
|
|
17241
17292
|
}, (t) => [
|
|
17242
17293
|
index("idx_channel_server_position").on(t.serverId, t.position),
|
|
17243
17294
|
index("idx_channel_server_last_message").on(t.serverId, t.lastMessageAt),
|
|
17244
|
-
index("idx_channel_parent").on(t.parentChannelId)
|
|
17295
|
+
index("idx_channel_parent").on(t.parentChannelId),
|
|
17296
|
+
uniqueIndex("idx_channel_server_name").on(t.serverId, t.name).where(sql`parent_channel_id IS NULL`)
|
|
17245
17297
|
]);
|
|
17246
17298
|
var communityChannelMember = sqliteTable("community_channel_member", {
|
|
17247
17299
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
@@ -17309,7 +17361,8 @@ var communityServerMember = sqliteTable("community_server_member", {
|
|
|
17309
17361
|
}, (t) => [
|
|
17310
17362
|
unique("uq_server_member_server_user").on(t.serverId, t.userId),
|
|
17311
17363
|
index("idx_server_member_user").on(t.userId),
|
|
17312
|
-
index("idx_server_member_user_rail_order").on(t.userId, t.railOrder)
|
|
17364
|
+
index("idx_server_member_user_rail_order").on(t.userId, t.railOrder),
|
|
17365
|
+
index("idx_server_member_server_joined").on(t.serverId, t.joinedAt)
|
|
17313
17366
|
]);
|
|
17314
17367
|
var communityServerFolder = sqliteTable("community_server_folder", {
|
|
17315
17368
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
@@ -17334,7 +17387,7 @@ var communityServerInvite = sqliteTable("community_server_invite", {
|
|
|
17334
17387
|
uses: integer2("uses").default(0),
|
|
17335
17388
|
expiresAt: text("expires_at"),
|
|
17336
17389
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17337
|
-
});
|
|
17390
|
+
}, (t) => [index("idx_server_invite_server").on(t.serverId)]);
|
|
17338
17391
|
var communityFriendship = sqliteTable("community_friendship", {
|
|
17339
17392
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17340
17393
|
requesterId: text("requester_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
@@ -17559,6 +17612,7 @@ var listedMessageProjection = {
|
|
|
17559
17612
|
replyToId: communityMessage.replyToId,
|
|
17560
17613
|
embeds: communityMessage.embeds,
|
|
17561
17614
|
flags: communityMessage.flags,
|
|
17615
|
+
seq: communityMessage.seq,
|
|
17562
17616
|
createdAt: communityMessage.createdAt,
|
|
17563
17617
|
channelId: communityMessage.channelId,
|
|
17564
17618
|
dmConversationId: communityMessage.dmConversationId,
|
|
@@ -25854,9 +25908,6 @@ function syncCommand() {
|
|
|
25854
25908
|
// commands/workspace.ts
|
|
25855
25909
|
import { Command as Command13 } from "commander";
|
|
25856
25910
|
import { readFileSync as readFileSync15 } from "fs";
|
|
25857
|
-
function slugify3(name) {
|
|
25858
|
-
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 60);
|
|
25859
|
-
}
|
|
25860
25911
|
function sleep4(ms) {
|
|
25861
25912
|
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
25862
25913
|
}
|
|
@@ -25878,7 +25929,7 @@ async function resolveWorkspaceId(client, configName) {
|
|
|
25878
25929
|
}
|
|
25879
25930
|
const wsName = configName || "Personal";
|
|
25880
25931
|
try {
|
|
25881
|
-
const newWs = await client.postJSON("/api/workspaces", { name: wsName, slug:
|
|
25932
|
+
const newWs = await client.postJSON("/api/workspaces", { name: wsName, slug: sanitizeSlug(wsName) });
|
|
25882
25933
|
console.log(`Created workspace: ${newWs.name} (${newWs.id})`);
|
|
25883
25934
|
return { workspaceId: newWs.id, created: true };
|
|
25884
25935
|
} catch (err) {
|
|
@@ -26000,7 +26051,7 @@ Workspace initialized: ${res.studio.name || res.workspace.name}`);
|
|
|
26000
26051
|
if (agents.length > 0) {
|
|
26001
26052
|
console.log("Current workspace has existing agents. Creating a new workspace...");
|
|
26002
26053
|
const wsName = opts.name || config2.name || "New Workspace";
|
|
26003
|
-
const newWs = await targetClient.postJSON("/api/workspaces", { name: wsName, slug:
|
|
26054
|
+
const newWs = await targetClient.postJSON("/api/workspaces", { name: wsName, slug: sanitizeSlug(wsName) });
|
|
26004
26055
|
targetWorkspaceId = newWs.id;
|
|
26005
26056
|
targetClient = new APIClient(serverUrl, token, targetWorkspaceId);
|
|
26006
26057
|
console.log(`Created workspace: ${newWs.name} (${newWs.id})`);
|
package/dist/session-runner.js
CHANGED
|
@@ -37,6 +37,50 @@ function fillPool(bytes) {
|
|
|
37
37
|
}
|
|
38
38
|
poolOffset += bytes;
|
|
39
39
|
}
|
|
40
|
+
function random(bytes) {
|
|
41
|
+
fillPool(bytes |= 0);
|
|
42
|
+
return pool.subarray(poolOffset - bytes, poolOffset);
|
|
43
|
+
}
|
|
44
|
+
function customRandom(alphabet, defaultSize, getRandom) {
|
|
45
|
+
let safeByteCutoff = 256 - 256 % alphabet.length;
|
|
46
|
+
if (safeByteCutoff === 256) {
|
|
47
|
+
let mask = alphabet.length - 1;
|
|
48
|
+
return (size = defaultSize) => {
|
|
49
|
+
if (!size)
|
|
50
|
+
return "";
|
|
51
|
+
let id = "";
|
|
52
|
+
while (true) {
|
|
53
|
+
let bytes = getRandom(size);
|
|
54
|
+
let i = size;
|
|
55
|
+
while (i--) {
|
|
56
|
+
id += alphabet[bytes[i] & mask];
|
|
57
|
+
if (id.length >= size)
|
|
58
|
+
return id;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
let step = Math.ceil(1.6 * 256 * defaultSize / safeByteCutoff);
|
|
64
|
+
return (size = defaultSize) => {
|
|
65
|
+
if (!size)
|
|
66
|
+
return "";
|
|
67
|
+
let id = "";
|
|
68
|
+
while (true) {
|
|
69
|
+
let bytes = getRandom(step);
|
|
70
|
+
let i = step;
|
|
71
|
+
while (i--) {
|
|
72
|
+
if (bytes[i] < safeByteCutoff) {
|
|
73
|
+
id += alphabet[bytes[i] % alphabet.length];
|
|
74
|
+
if (id.length >= size)
|
|
75
|
+
return id;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function customAlphabet(alphabet, size = 21) {
|
|
82
|
+
return customRandom(alphabet, size, random);
|
|
83
|
+
}
|
|
40
84
|
function nanoid3(size = 21) {
|
|
41
85
|
fillPool(size |= 0);
|
|
42
86
|
let id = "";
|
|
@@ -14411,6 +14455,13 @@ function date4(params) {
|
|
|
14411
14455
|
|
|
14412
14456
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
14413
14457
|
config(en_default());
|
|
14458
|
+
// ../shared/src/utils/slug.ts
|
|
14459
|
+
init_nanoid();
|
|
14460
|
+
var slugId = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz");
|
|
14461
|
+
function sanitizeSlug(input) {
|
|
14462
|
+
return input.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60).replace(/-+$/g, "");
|
|
14463
|
+
}
|
|
14464
|
+
|
|
14414
14465
|
// ../shared/src/lib/community-name.ts
|
|
14415
14466
|
var FORBIDDEN_NAME_CHARS = /[#@\x00-\x1f\x7f-\x9f]/;
|
|
14416
14467
|
function validateCommunityName(name) {
|
|
@@ -14838,11 +14889,11 @@ var UpdateMemberRequestSchema = exports_external.object({
|
|
|
14838
14889
|
});
|
|
14839
14890
|
var CreateWorkspaceRequestSchema = exports_external.object({
|
|
14840
14891
|
name: exports_external.string().min(1, "name is required"),
|
|
14841
|
-
slug: exports_external.string().optional().default("")
|
|
14892
|
+
slug: exports_external.string().optional().default("").transform(sanitizeSlug)
|
|
14842
14893
|
});
|
|
14843
14894
|
var UpdateWorkspaceRequestSchema = exports_external.object({
|
|
14844
14895
|
name: exports_external.string().min(1, "name is required").max(100).trim().optional(),
|
|
14845
|
-
slug: exports_external.string().min(1, "slug is required").
|
|
14896
|
+
slug: exports_external.string().min(1, "slug is required").trim().toLowerCase().transform(sanitizeSlug).optional()
|
|
14846
14897
|
});
|
|
14847
14898
|
var DeleteWorkspaceRequestSchema = exports_external.object({
|
|
14848
14899
|
confirm_name: exports_external.string().min(1, "confirm_name is required")
|
|
@@ -17146,7 +17197,8 @@ var communityChannel = sqliteTable("community_channel", {
|
|
|
17146
17197
|
}, (t) => [
|
|
17147
17198
|
index("idx_channel_server_position").on(t.serverId, t.position),
|
|
17148
17199
|
index("idx_channel_server_last_message").on(t.serverId, t.lastMessageAt),
|
|
17149
|
-
index("idx_channel_parent").on(t.parentChannelId)
|
|
17200
|
+
index("idx_channel_parent").on(t.parentChannelId),
|
|
17201
|
+
uniqueIndex("idx_channel_server_name").on(t.serverId, t.name).where(sql`parent_channel_id IS NULL`)
|
|
17150
17202
|
]);
|
|
17151
17203
|
var communityChannelMember = sqliteTable("community_channel_member", {
|
|
17152
17204
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
@@ -17214,7 +17266,8 @@ var communityServerMember = sqliteTable("community_server_member", {
|
|
|
17214
17266
|
}, (t) => [
|
|
17215
17267
|
unique("uq_server_member_server_user").on(t.serverId, t.userId),
|
|
17216
17268
|
index("idx_server_member_user").on(t.userId),
|
|
17217
|
-
index("idx_server_member_user_rail_order").on(t.userId, t.railOrder)
|
|
17269
|
+
index("idx_server_member_user_rail_order").on(t.userId, t.railOrder),
|
|
17270
|
+
index("idx_server_member_server_joined").on(t.serverId, t.joinedAt)
|
|
17218
17271
|
]);
|
|
17219
17272
|
var communityServerFolder = sqliteTable("community_server_folder", {
|
|
17220
17273
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
@@ -17239,7 +17292,7 @@ var communityServerInvite = sqliteTable("community_server_invite", {
|
|
|
17239
17292
|
uses: integer2("uses").default(0),
|
|
17240
17293
|
expiresAt: text("expires_at"),
|
|
17241
17294
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
17242
|
-
});
|
|
17295
|
+
}, (t) => [index("idx_server_invite_server").on(t.serverId)]);
|
|
17243
17296
|
var communityFriendship = sqliteTable("community_friendship", {
|
|
17244
17297
|
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
17245
17298
|
requesterId: text("requester_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
@@ -17464,6 +17517,7 @@ var listedMessageProjection = {
|
|
|
17464
17517
|
replyToId: communityMessage.replyToId,
|
|
17465
17518
|
embeds: communityMessage.embeds,
|
|
17466
17519
|
flags: communityMessage.flags,
|
|
17520
|
+
seq: communityMessage.seq,
|
|
17467
17521
|
createdAt: communityMessage.createdAt,
|
|
17468
17522
|
channelId: communityMessage.channelId,
|
|
17469
17523
|
dmConversationId: communityMessage.dmConversationId,
|