@alook/cli 0.1.11 → 0.1.13
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 +135 -42
- package/dist/session-runner.js +124 -31
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15017,6 +15017,9 @@ class Name {
|
|
|
15017
15017
|
return new SQL([this]);
|
|
15018
15018
|
}
|
|
15019
15019
|
}
|
|
15020
|
+
function isDriverValueEncoder(value) {
|
|
15021
|
+
return typeof value === "object" && value !== null && "mapToDriverValue" in value && typeof value.mapToDriverValue === "function";
|
|
15022
|
+
}
|
|
15020
15023
|
var noopDecoder = {
|
|
15021
15024
|
mapFromDriverValue: (value) => value
|
|
15022
15025
|
};
|
|
@@ -15910,6 +15913,39 @@ class PrimaryKey {
|
|
|
15910
15913
|
}
|
|
15911
15914
|
}
|
|
15912
15915
|
|
|
15916
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sql/expressions/conditions.js
|
|
15917
|
+
function bindIfParam(value, column) {
|
|
15918
|
+
if (isDriverValueEncoder(column) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column) && !is(value, Table) && !is(value, View)) {
|
|
15919
|
+
return new Param(value, column);
|
|
15920
|
+
}
|
|
15921
|
+
return value;
|
|
15922
|
+
}
|
|
15923
|
+
var eq = (left, right) => {
|
|
15924
|
+
return sql`${left} = ${bindIfParam(right, left)}`;
|
|
15925
|
+
};
|
|
15926
|
+
function and(...unfilteredConditions) {
|
|
15927
|
+
const conditions = unfilteredConditions.filter((c) => c !== undefined);
|
|
15928
|
+
if (conditions.length === 0) {
|
|
15929
|
+
return;
|
|
15930
|
+
}
|
|
15931
|
+
if (conditions.length === 1) {
|
|
15932
|
+
return new SQL(conditions);
|
|
15933
|
+
}
|
|
15934
|
+
return new SQL([
|
|
15935
|
+
new StringChunk("("),
|
|
15936
|
+
sql.join(conditions, new StringChunk(" and ")),
|
|
15937
|
+
new StringChunk(")")
|
|
15938
|
+
]);
|
|
15939
|
+
}
|
|
15940
|
+
function isNotNull(value) {
|
|
15941
|
+
return sql`${value} is not null`;
|
|
15942
|
+
}
|
|
15943
|
+
|
|
15944
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sql/expressions/select.js
|
|
15945
|
+
function desc(column) {
|
|
15946
|
+
return sql`${column} desc`;
|
|
15947
|
+
}
|
|
15948
|
+
|
|
15913
15949
|
// ../shared/src/db/community-machine-schema.ts
|
|
15914
15950
|
init_nanoid();
|
|
15915
15951
|
|
|
@@ -17348,6 +17384,7 @@ var CommunityMachineSummarySchema = exports_external.object({
|
|
|
17348
17384
|
var HostReadyMessageSchema = exports_external.object({
|
|
17349
17385
|
type: exports_external.literal("ready"),
|
|
17350
17386
|
runtimeReport: CommunityMachineRuntimeListSchema,
|
|
17387
|
+
capabilities: exports_external.array(exports_external.string().min(1).max(64)).max(16).optional().default([]),
|
|
17351
17388
|
runningAgents: exports_external.array(exports_external.string()).default([]),
|
|
17352
17389
|
hostname: exports_external.string().optional(),
|
|
17353
17390
|
platform: exports_external.string().optional(),
|
|
@@ -17399,6 +17436,14 @@ var AgentWakeAckMessageSchema = exports_external.object({
|
|
|
17399
17436
|
status: exports_external.enum(["ok", "error"]),
|
|
17400
17437
|
error: exports_external.object({ code: exports_external.string().optional(), message: exports_external.string().optional() }).optional()
|
|
17401
17438
|
});
|
|
17439
|
+
var MachineHeartbeatAckMessageSchema = exports_external.strictObject({
|
|
17440
|
+
type: exports_external.literal("machine_heartbeat_ack"),
|
|
17441
|
+
nonce: exports_external.string().min(1).max(128)
|
|
17442
|
+
});
|
|
17443
|
+
var DiagnosticCommandAckMessageSchema = exports_external.strictObject({
|
|
17444
|
+
type: exports_external.literal("diagnostics_ack"),
|
|
17445
|
+
reportId: DiagnosticReportIdSchema
|
|
17446
|
+
});
|
|
17402
17447
|
var CommunityPairTokenResponseSchema = exports_external.object({
|
|
17403
17448
|
tokenId: exports_external.string(),
|
|
17404
17449
|
expiresAt: exports_external.string()
|
|
@@ -17407,6 +17452,7 @@ var CommunityDaemonActivateRequestSchema = exports_external.object({
|
|
|
17407
17452
|
hostname: exports_external.string(),
|
|
17408
17453
|
platform: exports_external.string(),
|
|
17409
17454
|
arch: exports_external.string(),
|
|
17455
|
+
expectedMachineId: exports_external.string().min(1).optional(),
|
|
17410
17456
|
osRelease: exports_external.string().optional(),
|
|
17411
17457
|
daemonVersion: exports_external.string().optional(),
|
|
17412
17458
|
runtimeReport: CommunityMachineRuntimeListSchema.optional()
|
|
@@ -17414,7 +17460,12 @@ var CommunityDaemonActivateRequestSchema = exports_external.object({
|
|
|
17414
17460
|
var CommunityDaemonActivateResponseSchema = exports_external.object({
|
|
17415
17461
|
credential: exports_external.string(),
|
|
17416
17462
|
machineId: exports_external.string(),
|
|
17417
|
-
expiresAt: exports_external.string().nullable()
|
|
17463
|
+
expiresAt: exports_external.string().nullable(),
|
|
17464
|
+
sessionOutcome: exports_external.literal("committed")
|
|
17465
|
+
});
|
|
17466
|
+
var CommunityDaemonActivateErrorResponseSchema = exports_external.object({
|
|
17467
|
+
error: exports_external.string(),
|
|
17468
|
+
sessionOutcome: exports_external.enum(["not_committed", "unknown"])
|
|
17418
17469
|
});
|
|
17419
17470
|
var CommunityDaemonEnrollAgentRequestSchema = exports_external.object({
|
|
17420
17471
|
agentId: exports_external.string().min(1).max(128)
|
|
@@ -17504,13 +17555,6 @@ var CommunityAgentResolveRequestSchema = exports_external.object({
|
|
|
17504
17555
|
var CommunityAgentListChannelsRequestSchema = exports_external.object({
|
|
17505
17556
|
server: exports_external.string().min(1).optional()
|
|
17506
17557
|
});
|
|
17507
|
-
var CommunityAgentCreatePostRequestSchema = exports_external.object({
|
|
17508
|
-
forum: exports_external.string().min(1),
|
|
17509
|
-
title: exports_external.string().min(1),
|
|
17510
|
-
content: CommunityAgentMessageContentSchema,
|
|
17511
|
-
attachments: exports_external.array(exports_external.string().min(1)).max(MAX_ATTACHMENTS_PER_MESSAGE).default([]),
|
|
17512
|
-
nonce: exports_external.string().min(1).max(128).optional()
|
|
17513
|
-
}).refine((d) => d.content.text.trim().length > 0 || d.attachments.length > 0, { message: "post must have text or attachments" });
|
|
17514
17558
|
var CommunityAgentListMembersRequestSchema = exports_external.object({
|
|
17515
17559
|
server: exports_external.string().min(1),
|
|
17516
17560
|
limit: exports_external.number().int().positive().optional(),
|
|
@@ -17524,7 +17568,9 @@ var CommunityAgentJoinServerRequestSchema = exports_external.object({
|
|
|
17524
17568
|
invite: exports_external.string().min(1)
|
|
17525
17569
|
});
|
|
17526
17570
|
var CommunityAgentNapRequestSchema = exports_external.object({
|
|
17527
|
-
handoff: exports_external.string().
|
|
17571
|
+
handoff: exports_external.string().refine((value) => value.trim().length > 0, {
|
|
17572
|
+
message: "handoff is required"
|
|
17573
|
+
})
|
|
17528
17574
|
});
|
|
17529
17575
|
var CommunityAgentReactAddRequestSchema = exports_external.object({
|
|
17530
17576
|
channel: exports_external.string().min(1),
|
|
@@ -17606,6 +17652,10 @@ var HostBotAuditEventFrameSchema = exports_external.object({
|
|
|
17606
17652
|
});
|
|
17607
17653
|
// ../shared/src/community-cli-contract.ts
|
|
17608
17654
|
var HostCommandSchema = exports_external.discriminatedUnion("type", [
|
|
17655
|
+
exports_external.strictObject({
|
|
17656
|
+
type: exports_external.literal("machine:heartbeat"),
|
|
17657
|
+
nonce: exports_external.string().min(1).max(128)
|
|
17658
|
+
}),
|
|
17609
17659
|
exports_external.object({
|
|
17610
17660
|
type: exports_external.literal("agent:wake"),
|
|
17611
17661
|
agentId: exports_external.string().min(1),
|
|
@@ -17744,6 +17794,7 @@ var communityChannel = sqliteTable("community_channel", {
|
|
|
17744
17794
|
index("idx_channel_server_position").on(t.serverId, t.position),
|
|
17745
17795
|
index("idx_channel_server_last_message").on(t.serverId, t.lastMessageAt),
|
|
17746
17796
|
index("idx_channel_parent").on(t.parentChannelId),
|
|
17797
|
+
index("idx_channel_forum_created").on(t.parentChannelId, desc(t.createdAt), desc(t.id)).where(and(eq(t.type, "thread"), eq(t.archived, 0), isNotNull(t.parentMessageId))),
|
|
17747
17798
|
uniqueIndex("idx_channel_server_name").on(t.serverId, t.name).where(sql`parent_channel_id IS NULL`)
|
|
17748
17799
|
]);
|
|
17749
17800
|
var communityChannelMember = sqliteTable("community_channel_member", {
|
|
@@ -18126,26 +18177,6 @@ var channelJoinBaselineGuard = sql`${communityMessage.createdAt} > COALESCE(${co
|
|
|
18126
18177
|
|
|
18127
18178
|
// ../shared/src/db/queries/community/mention.ts
|
|
18128
18179
|
var MENTION_INSERT_MAX_ROWS = maxRowsPerInsert(5);
|
|
18129
|
-
// ../shared/src/community/bot-activity-presets.ts
|
|
18130
|
-
var BOT_ACTIVITY_PRESETS = {
|
|
18131
|
-
idle: { emoji: "\uD83D\uDCA4", text: "Idle" },
|
|
18132
|
-
starting: { emoji: "\uD83C\uDF00", text: "Waking up" },
|
|
18133
|
-
stopping: { emoji: "\uD83C\uDF19", text: "Wrapping up" }
|
|
18134
|
-
};
|
|
18135
|
-
var RUNNING_PRESETS = [
|
|
18136
|
-
{ emoji: "⚡", text: "Working on it" },
|
|
18137
|
-
{ emoji: "\uD83D\uDEE0️", text: "Cooking" },
|
|
18138
|
-
{ emoji: "\uD83E\uDDE0", text: "Thinking hard" },
|
|
18139
|
-
{ emoji: "\uD83D\uDD27", text: "Tinkering" },
|
|
18140
|
-
{ emoji: "\uD83D\uDE80", text: "On it" },
|
|
18141
|
-
{ emoji: "\uD83D\uDD25", text: "In the zone" }
|
|
18142
|
-
];
|
|
18143
|
-
var BOT_ACTIVITY_STATUS_PAIRS = [
|
|
18144
|
-
BOT_ACTIVITY_PRESETS.idle,
|
|
18145
|
-
BOT_ACTIVITY_PRESETS.starting,
|
|
18146
|
-
BOT_ACTIVITY_PRESETS.stopping,
|
|
18147
|
-
...RUNNING_PRESETS
|
|
18148
|
-
];
|
|
18149
18180
|
// ../shared/src/community-ws-events.ts
|
|
18150
18181
|
var string4 = exports_external.string();
|
|
18151
18182
|
var nullableString = string4.nullable();
|
|
@@ -18602,6 +18633,68 @@ var WS_EVENTS = {
|
|
|
18602
18633
|
BOT_AUDIT_EVENT: "community:bot.audit_event"
|
|
18603
18634
|
};
|
|
18604
18635
|
var COMMUNITY_EVENT_TYPES = new Set(Object.values(WS_EVENTS));
|
|
18636
|
+
var COMMUNITY_USER_TARGET_MAX_BYTES = 128;
|
|
18637
|
+
function utf8ByteLength(value) {
|
|
18638
|
+
return new TextEncoder().encode(value).byteLength;
|
|
18639
|
+
}
|
|
18640
|
+
function isWellFormedUnicode(value) {
|
|
18641
|
+
for (let index2 = 0;index2 < value.length; index2 += 1) {
|
|
18642
|
+
const codeUnit = value.charCodeAt(index2);
|
|
18643
|
+
if (codeUnit >= 55296 && codeUnit <= 56319) {
|
|
18644
|
+
const next = value.charCodeAt(index2 + 1);
|
|
18645
|
+
if (!Number.isInteger(next) || next < 56320 || next > 57343)
|
|
18646
|
+
return false;
|
|
18647
|
+
index2 += 1;
|
|
18648
|
+
} else if (codeUnit >= 56320 && codeUnit <= 57343) {
|
|
18649
|
+
return false;
|
|
18650
|
+
}
|
|
18651
|
+
}
|
|
18652
|
+
return true;
|
|
18653
|
+
}
|
|
18654
|
+
function isValidCommunityUserTarget(value) {
|
|
18655
|
+
return typeof value === "string" && value.length > 0 && isWellFormedUnicode(value) && utf8ByteLength(value) <= COMMUNITY_USER_TARGET_MAX_BYTES;
|
|
18656
|
+
}
|
|
18657
|
+
|
|
18658
|
+
// ../shared/src/community-message-delivery.ts
|
|
18659
|
+
var MESSAGE_DELIVERY_MAX_USERS = 1000;
|
|
18660
|
+
var target = exports_external.string().refine(isValidCommunityUserTarget);
|
|
18661
|
+
var targetList = exports_external.array(target).max(MESSAGE_DELIVERY_MAX_USERS);
|
|
18662
|
+
var memberAddedSchema = exports_external.strictObject({
|
|
18663
|
+
userId: target,
|
|
18664
|
+
serverId: exports_external.string().min(1),
|
|
18665
|
+
channelId: exports_external.string().min(1)
|
|
18666
|
+
});
|
|
18667
|
+
var batchShape = exports_external.strictObject({
|
|
18668
|
+
messageId: exports_external.string().min(1),
|
|
18669
|
+
messageEvent: exports_external.unknown(),
|
|
18670
|
+
contentUserIds: targetList,
|
|
18671
|
+
unreadPlainUserIds: targetList,
|
|
18672
|
+
unreadMentionUserIds: targetList,
|
|
18673
|
+
mentionUserIds: targetList,
|
|
18674
|
+
memberAdded: memberAddedSchema.optional(),
|
|
18675
|
+
parentProjection: exports_external.unknown().optional(),
|
|
18676
|
+
parentProjectionUserIds: targetList.optional()
|
|
18677
|
+
});
|
|
18678
|
+
// ../shared/src/community/bot-activity-presets.ts
|
|
18679
|
+
var BOT_ACTIVITY_PRESETS = {
|
|
18680
|
+
idle: { emoji: "\uD83D\uDCA4", text: "Idle" },
|
|
18681
|
+
starting: { emoji: "\uD83C\uDF00", text: "Waking up" },
|
|
18682
|
+
stopping: { emoji: "\uD83C\uDF19", text: "Wrapping up" }
|
|
18683
|
+
};
|
|
18684
|
+
var RUNNING_PRESETS = [
|
|
18685
|
+
{ emoji: "⚡", text: "Working on it" },
|
|
18686
|
+
{ emoji: "\uD83D\uDEE0️", text: "Cooking" },
|
|
18687
|
+
{ emoji: "\uD83E\uDDE0", text: "Thinking hard" },
|
|
18688
|
+
{ emoji: "\uD83D\uDD27", text: "Tinkering" },
|
|
18689
|
+
{ emoji: "\uD83D\uDE80", text: "On it" },
|
|
18690
|
+
{ emoji: "\uD83D\uDD25", text: "In the zone" }
|
|
18691
|
+
];
|
|
18692
|
+
var BOT_ACTIVITY_STATUS_PAIRS = [
|
|
18693
|
+
BOT_ACTIVITY_PRESETS.idle,
|
|
18694
|
+
BOT_ACTIVITY_PRESETS.starting,
|
|
18695
|
+
BOT_ACTIVITY_PRESETS.stopping,
|
|
18696
|
+
...RUNNING_PRESETS
|
|
18697
|
+
];
|
|
18605
18698
|
// ../shared/src/db/index.ts
|
|
18606
18699
|
var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema };
|
|
18607
18700
|
// ../shared/src/db/queries/task.ts
|
|
@@ -21409,8 +21502,8 @@ function ensureSymlinks(workDir) {
|
|
|
21409
21502
|
try {
|
|
21410
21503
|
const stat = lstatSync(aliasPath);
|
|
21411
21504
|
if (stat.isSymbolicLink()) {
|
|
21412
|
-
const
|
|
21413
|
-
if (
|
|
21505
|
+
const target2 = readlinkSync(aliasPath);
|
|
21506
|
+
if (target2 === CANONICAL_FILE)
|
|
21414
21507
|
continue;
|
|
21415
21508
|
unlinkSync2(aliasPath);
|
|
21416
21509
|
} else {
|
|
@@ -23857,32 +23950,32 @@ function runScan() {
|
|
|
23857
23950
|
}
|
|
23858
23951
|
}
|
|
23859
23952
|
const targets = discoverTargets();
|
|
23860
|
-
for (const
|
|
23861
|
-
if (!
|
|
23953
|
+
for (const target2 of targets) {
|
|
23954
|
+
if (!target2.workdir)
|
|
23862
23955
|
continue;
|
|
23863
23956
|
try {
|
|
23864
|
-
const skills = getAgentScanner(
|
|
23957
|
+
const skills = getAgentScanner(target2.runtime)(target2.workdir);
|
|
23865
23958
|
const hash2 = computeHash(skills);
|
|
23866
|
-
const prevHash = readCacheHash(agentCachePath(
|
|
23959
|
+
const prevHash = readCacheHash(agentCachePath(target2.agentId, target2.runtime));
|
|
23867
23960
|
if (prevHash !== hash2) {
|
|
23868
23961
|
const skillItems = skills.map((s) => ({ name: s.name, description: s.description }));
|
|
23869
|
-
log11.debug(`Syncing ${
|
|
23870
|
-
clientRef.syncSkills(
|
|
23962
|
+
log11.debug(`Syncing ${target2.agentId}:${target2.runtime} — ${skills.length} agent skills`);
|
|
23963
|
+
clientRef.syncSkills(target2.token, {
|
|
23871
23964
|
scope: "agent",
|
|
23872
|
-
agent_id:
|
|
23873
|
-
runtime:
|
|
23965
|
+
agent_id: target2.agentId,
|
|
23966
|
+
runtime: target2.runtime,
|
|
23874
23967
|
skills: skillItems
|
|
23875
23968
|
}).then(() => {
|
|
23876
|
-
writeCacheFile(agentCachePath(
|
|
23969
|
+
writeCacheFile(agentCachePath(target2.agentId, target2.runtime), hash2, skills);
|
|
23877
23970
|
}).catch((e) => {
|
|
23878
23971
|
if (isClientError2(e)) {
|
|
23879
|
-
writeCacheFile(agentCachePath(
|
|
23972
|
+
writeCacheFile(agentCachePath(target2.agentId, target2.runtime), hash2, skills);
|
|
23880
23973
|
}
|
|
23881
23974
|
log11.debug("Agent skill sync failed", e);
|
|
23882
23975
|
});
|
|
23883
23976
|
}
|
|
23884
23977
|
} catch (e) {
|
|
23885
|
-
log11.debug(`Agent scan error for ${
|
|
23978
|
+
log11.debug(`Agent scan error for ${target2.agentId}:${target2.runtime}`, e);
|
|
23886
23979
|
}
|
|
23887
23980
|
}
|
|
23888
23981
|
}
|
package/dist/session-runner.js
CHANGED
|
@@ -14926,6 +14926,9 @@ class Name {
|
|
|
14926
14926
|
return new SQL([this]);
|
|
14927
14927
|
}
|
|
14928
14928
|
}
|
|
14929
|
+
function isDriverValueEncoder(value) {
|
|
14930
|
+
return typeof value === "object" && value !== null && "mapToDriverValue" in value && typeof value.mapToDriverValue === "function";
|
|
14931
|
+
}
|
|
14929
14932
|
var noopDecoder = {
|
|
14930
14933
|
mapFromDriverValue: (value) => value
|
|
14931
14934
|
};
|
|
@@ -15819,6 +15822,39 @@ class PrimaryKey {
|
|
|
15819
15822
|
}
|
|
15820
15823
|
}
|
|
15821
15824
|
|
|
15825
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sql/expressions/conditions.js
|
|
15826
|
+
function bindIfParam(value, column) {
|
|
15827
|
+
if (isDriverValueEncoder(column) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column) && !is(value, Table) && !is(value, View)) {
|
|
15828
|
+
return new Param(value, column);
|
|
15829
|
+
}
|
|
15830
|
+
return value;
|
|
15831
|
+
}
|
|
15832
|
+
var eq = (left, right) => {
|
|
15833
|
+
return sql`${left} = ${bindIfParam(right, left)}`;
|
|
15834
|
+
};
|
|
15835
|
+
function and(...unfilteredConditions) {
|
|
15836
|
+
const conditions = unfilteredConditions.filter((c) => c !== undefined);
|
|
15837
|
+
if (conditions.length === 0) {
|
|
15838
|
+
return;
|
|
15839
|
+
}
|
|
15840
|
+
if (conditions.length === 1) {
|
|
15841
|
+
return new SQL(conditions);
|
|
15842
|
+
}
|
|
15843
|
+
return new SQL([
|
|
15844
|
+
new StringChunk("("),
|
|
15845
|
+
sql.join(conditions, new StringChunk(" and ")),
|
|
15846
|
+
new StringChunk(")")
|
|
15847
|
+
]);
|
|
15848
|
+
}
|
|
15849
|
+
function isNotNull(value) {
|
|
15850
|
+
return sql`${value} is not null`;
|
|
15851
|
+
}
|
|
15852
|
+
|
|
15853
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260702.1_@opentelemetry+api@1.9.1_@typ_5aa9492b131e5fac58fa98e88e5c0ad3/node_modules/drizzle-orm/sql/expressions/select.js
|
|
15854
|
+
function desc(column) {
|
|
15855
|
+
return sql`${column} desc`;
|
|
15856
|
+
}
|
|
15857
|
+
|
|
15822
15858
|
// ../shared/src/db/community-machine-schema.ts
|
|
15823
15859
|
init_nanoid();
|
|
15824
15860
|
|
|
@@ -17253,6 +17289,7 @@ var CommunityMachineSummarySchema = exports_external.object({
|
|
|
17253
17289
|
var HostReadyMessageSchema = exports_external.object({
|
|
17254
17290
|
type: exports_external.literal("ready"),
|
|
17255
17291
|
runtimeReport: CommunityMachineRuntimeListSchema,
|
|
17292
|
+
capabilities: exports_external.array(exports_external.string().min(1).max(64)).max(16).optional().default([]),
|
|
17256
17293
|
runningAgents: exports_external.array(exports_external.string()).default([]),
|
|
17257
17294
|
hostname: exports_external.string().optional(),
|
|
17258
17295
|
platform: exports_external.string().optional(),
|
|
@@ -17304,6 +17341,14 @@ var AgentWakeAckMessageSchema = exports_external.object({
|
|
|
17304
17341
|
status: exports_external.enum(["ok", "error"]),
|
|
17305
17342
|
error: exports_external.object({ code: exports_external.string().optional(), message: exports_external.string().optional() }).optional()
|
|
17306
17343
|
});
|
|
17344
|
+
var MachineHeartbeatAckMessageSchema = exports_external.strictObject({
|
|
17345
|
+
type: exports_external.literal("machine_heartbeat_ack"),
|
|
17346
|
+
nonce: exports_external.string().min(1).max(128)
|
|
17347
|
+
});
|
|
17348
|
+
var DiagnosticCommandAckMessageSchema = exports_external.strictObject({
|
|
17349
|
+
type: exports_external.literal("diagnostics_ack"),
|
|
17350
|
+
reportId: DiagnosticReportIdSchema
|
|
17351
|
+
});
|
|
17307
17352
|
var CommunityPairTokenResponseSchema = exports_external.object({
|
|
17308
17353
|
tokenId: exports_external.string(),
|
|
17309
17354
|
expiresAt: exports_external.string()
|
|
@@ -17312,6 +17357,7 @@ var CommunityDaemonActivateRequestSchema = exports_external.object({
|
|
|
17312
17357
|
hostname: exports_external.string(),
|
|
17313
17358
|
platform: exports_external.string(),
|
|
17314
17359
|
arch: exports_external.string(),
|
|
17360
|
+
expectedMachineId: exports_external.string().min(1).optional(),
|
|
17315
17361
|
osRelease: exports_external.string().optional(),
|
|
17316
17362
|
daemonVersion: exports_external.string().optional(),
|
|
17317
17363
|
runtimeReport: CommunityMachineRuntimeListSchema.optional()
|
|
@@ -17319,7 +17365,12 @@ var CommunityDaemonActivateRequestSchema = exports_external.object({
|
|
|
17319
17365
|
var CommunityDaemonActivateResponseSchema = exports_external.object({
|
|
17320
17366
|
credential: exports_external.string(),
|
|
17321
17367
|
machineId: exports_external.string(),
|
|
17322
|
-
expiresAt: exports_external.string().nullable()
|
|
17368
|
+
expiresAt: exports_external.string().nullable(),
|
|
17369
|
+
sessionOutcome: exports_external.literal("committed")
|
|
17370
|
+
});
|
|
17371
|
+
var CommunityDaemonActivateErrorResponseSchema = exports_external.object({
|
|
17372
|
+
error: exports_external.string(),
|
|
17373
|
+
sessionOutcome: exports_external.enum(["not_committed", "unknown"])
|
|
17323
17374
|
});
|
|
17324
17375
|
var CommunityDaemonEnrollAgentRequestSchema = exports_external.object({
|
|
17325
17376
|
agentId: exports_external.string().min(1).max(128)
|
|
@@ -17409,13 +17460,6 @@ var CommunityAgentResolveRequestSchema = exports_external.object({
|
|
|
17409
17460
|
var CommunityAgentListChannelsRequestSchema = exports_external.object({
|
|
17410
17461
|
server: exports_external.string().min(1).optional()
|
|
17411
17462
|
});
|
|
17412
|
-
var CommunityAgentCreatePostRequestSchema = exports_external.object({
|
|
17413
|
-
forum: exports_external.string().min(1),
|
|
17414
|
-
title: exports_external.string().min(1),
|
|
17415
|
-
content: CommunityAgentMessageContentSchema,
|
|
17416
|
-
attachments: exports_external.array(exports_external.string().min(1)).max(MAX_ATTACHMENTS_PER_MESSAGE).default([]),
|
|
17417
|
-
nonce: exports_external.string().min(1).max(128).optional()
|
|
17418
|
-
}).refine((d) => d.content.text.trim().length > 0 || d.attachments.length > 0, { message: "post must have text or attachments" });
|
|
17419
17463
|
var CommunityAgentListMembersRequestSchema = exports_external.object({
|
|
17420
17464
|
server: exports_external.string().min(1),
|
|
17421
17465
|
limit: exports_external.number().int().positive().optional(),
|
|
@@ -17429,7 +17473,9 @@ var CommunityAgentJoinServerRequestSchema = exports_external.object({
|
|
|
17429
17473
|
invite: exports_external.string().min(1)
|
|
17430
17474
|
});
|
|
17431
17475
|
var CommunityAgentNapRequestSchema = exports_external.object({
|
|
17432
|
-
handoff: exports_external.string().
|
|
17476
|
+
handoff: exports_external.string().refine((value) => value.trim().length > 0, {
|
|
17477
|
+
message: "handoff is required"
|
|
17478
|
+
})
|
|
17433
17479
|
});
|
|
17434
17480
|
var CommunityAgentReactAddRequestSchema = exports_external.object({
|
|
17435
17481
|
channel: exports_external.string().min(1),
|
|
@@ -17511,6 +17557,10 @@ var HostBotAuditEventFrameSchema = exports_external.object({
|
|
|
17511
17557
|
});
|
|
17512
17558
|
// ../shared/src/community-cli-contract.ts
|
|
17513
17559
|
var HostCommandSchema = exports_external.discriminatedUnion("type", [
|
|
17560
|
+
exports_external.strictObject({
|
|
17561
|
+
type: exports_external.literal("machine:heartbeat"),
|
|
17562
|
+
nonce: exports_external.string().min(1).max(128)
|
|
17563
|
+
}),
|
|
17514
17564
|
exports_external.object({
|
|
17515
17565
|
type: exports_external.literal("agent:wake"),
|
|
17516
17566
|
agentId: exports_external.string().min(1),
|
|
@@ -17649,6 +17699,7 @@ var communityChannel = sqliteTable("community_channel", {
|
|
|
17649
17699
|
index("idx_channel_server_position").on(t.serverId, t.position),
|
|
17650
17700
|
index("idx_channel_server_last_message").on(t.serverId, t.lastMessageAt),
|
|
17651
17701
|
index("idx_channel_parent").on(t.parentChannelId),
|
|
17702
|
+
index("idx_channel_forum_created").on(t.parentChannelId, desc(t.createdAt), desc(t.id)).where(and(eq(t.type, "thread"), eq(t.archived, 0), isNotNull(t.parentMessageId))),
|
|
17652
17703
|
uniqueIndex("idx_channel_server_name").on(t.serverId, t.name).where(sql`parent_channel_id IS NULL`)
|
|
17653
17704
|
]);
|
|
17654
17705
|
var communityChannelMember = sqliteTable("community_channel_member", {
|
|
@@ -18031,26 +18082,6 @@ var channelJoinBaselineGuard = sql`${communityMessage.createdAt} > COALESCE(${co
|
|
|
18031
18082
|
|
|
18032
18083
|
// ../shared/src/db/queries/community/mention.ts
|
|
18033
18084
|
var MENTION_INSERT_MAX_ROWS = maxRowsPerInsert(5);
|
|
18034
|
-
// ../shared/src/community/bot-activity-presets.ts
|
|
18035
|
-
var BOT_ACTIVITY_PRESETS = {
|
|
18036
|
-
idle: { emoji: "\uD83D\uDCA4", text: "Idle" },
|
|
18037
|
-
starting: { emoji: "\uD83C\uDF00", text: "Waking up" },
|
|
18038
|
-
stopping: { emoji: "\uD83C\uDF19", text: "Wrapping up" }
|
|
18039
|
-
};
|
|
18040
|
-
var RUNNING_PRESETS = [
|
|
18041
|
-
{ emoji: "⚡", text: "Working on it" },
|
|
18042
|
-
{ emoji: "\uD83D\uDEE0️", text: "Cooking" },
|
|
18043
|
-
{ emoji: "\uD83E\uDDE0", text: "Thinking hard" },
|
|
18044
|
-
{ emoji: "\uD83D\uDD27", text: "Tinkering" },
|
|
18045
|
-
{ emoji: "\uD83D\uDE80", text: "On it" },
|
|
18046
|
-
{ emoji: "\uD83D\uDD25", text: "In the zone" }
|
|
18047
|
-
];
|
|
18048
|
-
var BOT_ACTIVITY_STATUS_PAIRS = [
|
|
18049
|
-
BOT_ACTIVITY_PRESETS.idle,
|
|
18050
|
-
BOT_ACTIVITY_PRESETS.starting,
|
|
18051
|
-
BOT_ACTIVITY_PRESETS.stopping,
|
|
18052
|
-
...RUNNING_PRESETS
|
|
18053
|
-
];
|
|
18054
18085
|
// ../shared/src/community-ws-events.ts
|
|
18055
18086
|
var string4 = exports_external.string();
|
|
18056
18087
|
var nullableString = string4.nullable();
|
|
@@ -18507,6 +18538,68 @@ var WS_EVENTS = {
|
|
|
18507
18538
|
BOT_AUDIT_EVENT: "community:bot.audit_event"
|
|
18508
18539
|
};
|
|
18509
18540
|
var COMMUNITY_EVENT_TYPES = new Set(Object.values(WS_EVENTS));
|
|
18541
|
+
var COMMUNITY_USER_TARGET_MAX_BYTES = 128;
|
|
18542
|
+
function utf8ByteLength(value) {
|
|
18543
|
+
return new TextEncoder().encode(value).byteLength;
|
|
18544
|
+
}
|
|
18545
|
+
function isWellFormedUnicode(value) {
|
|
18546
|
+
for (let index2 = 0;index2 < value.length; index2 += 1) {
|
|
18547
|
+
const codeUnit = value.charCodeAt(index2);
|
|
18548
|
+
if (codeUnit >= 55296 && codeUnit <= 56319) {
|
|
18549
|
+
const next = value.charCodeAt(index2 + 1);
|
|
18550
|
+
if (!Number.isInteger(next) || next < 56320 || next > 57343)
|
|
18551
|
+
return false;
|
|
18552
|
+
index2 += 1;
|
|
18553
|
+
} else if (codeUnit >= 56320 && codeUnit <= 57343) {
|
|
18554
|
+
return false;
|
|
18555
|
+
}
|
|
18556
|
+
}
|
|
18557
|
+
return true;
|
|
18558
|
+
}
|
|
18559
|
+
function isValidCommunityUserTarget(value) {
|
|
18560
|
+
return typeof value === "string" && value.length > 0 && isWellFormedUnicode(value) && utf8ByteLength(value) <= COMMUNITY_USER_TARGET_MAX_BYTES;
|
|
18561
|
+
}
|
|
18562
|
+
|
|
18563
|
+
// ../shared/src/community-message-delivery.ts
|
|
18564
|
+
var MESSAGE_DELIVERY_MAX_USERS = 1000;
|
|
18565
|
+
var target = exports_external.string().refine(isValidCommunityUserTarget);
|
|
18566
|
+
var targetList = exports_external.array(target).max(MESSAGE_DELIVERY_MAX_USERS);
|
|
18567
|
+
var memberAddedSchema = exports_external.strictObject({
|
|
18568
|
+
userId: target,
|
|
18569
|
+
serverId: exports_external.string().min(1),
|
|
18570
|
+
channelId: exports_external.string().min(1)
|
|
18571
|
+
});
|
|
18572
|
+
var batchShape = exports_external.strictObject({
|
|
18573
|
+
messageId: exports_external.string().min(1),
|
|
18574
|
+
messageEvent: exports_external.unknown(),
|
|
18575
|
+
contentUserIds: targetList,
|
|
18576
|
+
unreadPlainUserIds: targetList,
|
|
18577
|
+
unreadMentionUserIds: targetList,
|
|
18578
|
+
mentionUserIds: targetList,
|
|
18579
|
+
memberAdded: memberAddedSchema.optional(),
|
|
18580
|
+
parentProjection: exports_external.unknown().optional(),
|
|
18581
|
+
parentProjectionUserIds: targetList.optional()
|
|
18582
|
+
});
|
|
18583
|
+
// ../shared/src/community/bot-activity-presets.ts
|
|
18584
|
+
var BOT_ACTIVITY_PRESETS = {
|
|
18585
|
+
idle: { emoji: "\uD83D\uDCA4", text: "Idle" },
|
|
18586
|
+
starting: { emoji: "\uD83C\uDF00", text: "Waking up" },
|
|
18587
|
+
stopping: { emoji: "\uD83C\uDF19", text: "Wrapping up" }
|
|
18588
|
+
};
|
|
18589
|
+
var RUNNING_PRESETS = [
|
|
18590
|
+
{ emoji: "⚡", text: "Working on it" },
|
|
18591
|
+
{ emoji: "\uD83D\uDEE0️", text: "Cooking" },
|
|
18592
|
+
{ emoji: "\uD83E\uDDE0", text: "Thinking hard" },
|
|
18593
|
+
{ emoji: "\uD83D\uDD27", text: "Tinkering" },
|
|
18594
|
+
{ emoji: "\uD83D\uDE80", text: "On it" },
|
|
18595
|
+
{ emoji: "\uD83D\uDD25", text: "In the zone" }
|
|
18596
|
+
];
|
|
18597
|
+
var BOT_ACTIVITY_STATUS_PAIRS = [
|
|
18598
|
+
BOT_ACTIVITY_PRESETS.idle,
|
|
18599
|
+
BOT_ACTIVITY_PRESETS.starting,
|
|
18600
|
+
BOT_ACTIVITY_PRESETS.stopping,
|
|
18601
|
+
...RUNNING_PRESETS
|
|
18602
|
+
];
|
|
18510
18603
|
// ../shared/src/db/index.ts
|
|
18511
18604
|
var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema };
|
|
18512
18605
|
// ../shared/src/db/queries/task.ts
|
|
@@ -20950,8 +21043,8 @@ function ensureSymlinks(workDir) {
|
|
|
20950
21043
|
try {
|
|
20951
21044
|
const stat = lstatSync(aliasPath);
|
|
20952
21045
|
if (stat.isSymbolicLink()) {
|
|
20953
|
-
const
|
|
20954
|
-
if (
|
|
21046
|
+
const target2 = readlinkSync(aliasPath);
|
|
21047
|
+
if (target2 === CANONICAL_FILE)
|
|
20955
21048
|
continue;
|
|
20956
21049
|
unlinkSync(aliasPath);
|
|
20957
21050
|
} else {
|