@alook/daemon 0.1.61 → 0.1.62
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/README.md +42 -0
- package/dist/cli/index.js +552 -260
- package/dist/index.js +235 -177
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -41754,6 +41754,125 @@ function bigint3(params) {
|
|
|
41754
41754
|
function date4(params) {
|
|
41755
41755
|
return _coercedDate(ZodDate, params);
|
|
41756
41756
|
}
|
|
41757
|
+
// ../shared/src/constants/community.ts
|
|
41758
|
+
var MAX_SERVER_NAME_LENGTH = 100;
|
|
41759
|
+
var MAX_SERVER_DESCRIPTION_LENGTH = 2000;
|
|
41760
|
+
var MAX_FOLDER_NAME_LENGTH = 100;
|
|
41761
|
+
var MAX_PROFILE_NAME_LENGTH = 100;
|
|
41762
|
+
var MAX_PROFILE_ABOUT_LENGTH = 1000;
|
|
41763
|
+
var MAX_MESSAGE_CONTENT_LENGTH = 4000;
|
|
41764
|
+
var MAX_ATTACHMENTS_PER_MESSAGE = 10;
|
|
41765
|
+
var MAX_ATTACHMENT_SIZE_BYTES = 25 * 1024 * 1024;
|
|
41766
|
+
var MAX_ATTACHMENT_THUMBNAIL_EDGE_PX = 720;
|
|
41767
|
+
var MAX_ATTACHMENT_THUMBNAIL_SIZE_BYTES = 256 * 1024;
|
|
41768
|
+
var MAX_SERVER_ICON_SIZE_BYTES = 5 * 1024 * 1024;
|
|
41769
|
+
var ALLOWED_ICON_MIME_TYPES = [
|
|
41770
|
+
"image/png",
|
|
41771
|
+
"image/jpeg",
|
|
41772
|
+
"image/webp",
|
|
41773
|
+
"image/gif"
|
|
41774
|
+
];
|
|
41775
|
+
var MAX_ICON_SOURCE_FILE_SIZE_BYTES = 15 * 1024 * 1024;
|
|
41776
|
+
var PARTICIPANT_SOURCE = {
|
|
41777
|
+
MENTION: "mention",
|
|
41778
|
+
SPOKE: "spoke",
|
|
41779
|
+
ADDED: "added"
|
|
41780
|
+
};
|
|
41781
|
+
|
|
41782
|
+
// ../shared/src/lib/discriminator.ts
|
|
41783
|
+
function parseNameAndTag(q) {
|
|
41784
|
+
const m = /^(.+)#(\d{4,})$/.exec(q);
|
|
41785
|
+
if (!m)
|
|
41786
|
+
return null;
|
|
41787
|
+
const name = m[1].trim();
|
|
41788
|
+
const discriminator = m[2];
|
|
41789
|
+
if (!name)
|
|
41790
|
+
return null;
|
|
41791
|
+
return { name, discriminator };
|
|
41792
|
+
}
|
|
41793
|
+
function formatHandle(name, discriminator) {
|
|
41794
|
+
return `${name}#${discriminator}`;
|
|
41795
|
+
}
|
|
41796
|
+
|
|
41797
|
+
// ../shared/src/pii-contract.ts
|
|
41798
|
+
var PII_CAPABILITY = "pii-v1";
|
|
41799
|
+
var PII_MAX_PLUGINS = 32;
|
|
41800
|
+
var PII_SOURCE_MAX_BYTES = 16 * 1024;
|
|
41801
|
+
var PII_TEXT_MAX_BYTES = 1024;
|
|
41802
|
+
var PII_REQUEST_MAX_BYTES = 8 * 1024;
|
|
41803
|
+
var PiiPreviewTextSchema = exports_external.string().max(PII_TEXT_MAX_BYTES).refine((text) => new TextEncoder().encode(text).byteLength <= PII_TEXT_MAX_BYTES).refine((text) => text.trim().length > 0);
|
|
41804
|
+
var PiiPluginSchema = exports_external.strictObject({
|
|
41805
|
+
id: exports_external.string().min(1).max(128),
|
|
41806
|
+
name: exports_external.string().trim().min(1).max(80),
|
|
41807
|
+
description: exports_external.string().trim().min(1).max(256),
|
|
41808
|
+
enabled: exports_external.boolean()
|
|
41809
|
+
});
|
|
41810
|
+
var PiiSnapshotSchema = exports_external.strictObject({
|
|
41811
|
+
revision: exports_external.number().int().nonnegative(),
|
|
41812
|
+
plugins: exports_external.array(PiiPluginSchema).max(PII_MAX_PLUGINS)
|
|
41813
|
+
});
|
|
41814
|
+
var pluginId = exports_external.string().min(1).max(128);
|
|
41815
|
+
var expectedRevision = exports_external.number().int().nonnegative();
|
|
41816
|
+
var PiiOperationSchema = exports_external.discriminatedUnion("action", [
|
|
41817
|
+
exports_external.strictObject({ action: exports_external.literal("list") }),
|
|
41818
|
+
exports_external.strictObject({ action: exports_external.literal("setEnabled"), pluginId, enabled: exports_external.boolean(), expectedRevision }),
|
|
41819
|
+
exports_external.strictObject({ action: exports_external.literal("remove"), pluginId, expectedRevision }),
|
|
41820
|
+
exports_external.strictObject({ action: exports_external.literal("preview"), text: PiiPreviewTextSchema, expectedRevision })
|
|
41821
|
+
]);
|
|
41822
|
+
var PiiRequestSchema = exports_external.strictObject({
|
|
41823
|
+
requestId: exports_external.string().min(1).max(128),
|
|
41824
|
+
operation: PiiOperationSchema
|
|
41825
|
+
});
|
|
41826
|
+
var PiiCommandSchema = PiiRequestSchema.extend({
|
|
41827
|
+
type: exports_external.literal("pii:manage"),
|
|
41828
|
+
botId: exports_external.string().min(1).max(128)
|
|
41829
|
+
});
|
|
41830
|
+
var PiiErrorCodeSchema = exports_external.enum([
|
|
41831
|
+
"PII_CONFLICT",
|
|
41832
|
+
"PII_UNAVAILABLE",
|
|
41833
|
+
"PII_PLUGIN_NOT_FOUND",
|
|
41834
|
+
"PII_BOT_NOT_FOUND",
|
|
41835
|
+
"PII_PLUGIN_FAILED",
|
|
41836
|
+
"PII_PLUGIN_TIMEOUT",
|
|
41837
|
+
"PII_INVALID_RESULT",
|
|
41838
|
+
"PII_OUTPUT_TOO_LARGE",
|
|
41839
|
+
"PII_INVALID_SOURCE",
|
|
41840
|
+
"PII_CONFIG_UNAVAILABLE",
|
|
41841
|
+
"PII_SOURCE_TOO_LARGE",
|
|
41842
|
+
"PII_INVALID_REQUEST"
|
|
41843
|
+
]);
|
|
41844
|
+
var PiiResultSchema = exports_external.discriminatedUnion("status", [
|
|
41845
|
+
exports_external.strictObject({ status: exports_external.literal("complete"), snapshot: PiiSnapshotSchema, output: PiiPreviewTextSchema.optional(), triggeredFilters: exports_external.array(PiiPluginSchema.pick({ id: true, name: true })).max(PII_MAX_PLUGINS).optional() }),
|
|
41846
|
+
exports_external.strictObject({
|
|
41847
|
+
status: exports_external.literal("error"),
|
|
41848
|
+
code: PiiErrorCodeSchema,
|
|
41849
|
+
pluginId: pluginId.optional(),
|
|
41850
|
+
snapshot: PiiSnapshotSchema.optional()
|
|
41851
|
+
})
|
|
41852
|
+
]);
|
|
41853
|
+
var PiiResultFrameSchema = exports_external.strictObject({
|
|
41854
|
+
type: exports_external.literal("pii_result"),
|
|
41855
|
+
botId: exports_external.string().min(1).max(128),
|
|
41856
|
+
requestId: exports_external.string().min(1).max(128),
|
|
41857
|
+
result: PiiResultSchema
|
|
41858
|
+
});
|
|
41859
|
+
var PiiLocalRequestSchema = exports_external.discriminatedUnion("action", [
|
|
41860
|
+
exports_external.strictObject({ action: exports_external.literal("list") }),
|
|
41861
|
+
exports_external.strictObject({
|
|
41862
|
+
action: exports_external.literal("add"),
|
|
41863
|
+
name: PiiPluginSchema.shape.name,
|
|
41864
|
+
description: PiiPluginSchema.shape.description,
|
|
41865
|
+
source: exports_external.string().min(1).max(PII_SOURCE_MAX_BYTES)
|
|
41866
|
+
})
|
|
41867
|
+
]);
|
|
41868
|
+
|
|
41869
|
+
// ../shared/src/utils/community-roles.ts
|
|
41870
|
+
var ROLES = {
|
|
41871
|
+
OWNER: "owner",
|
|
41872
|
+
ADMIN: "admin",
|
|
41873
|
+
MEMBER: "member"
|
|
41874
|
+
};
|
|
41875
|
+
|
|
41757
41876
|
// ../shared/src/db/community-machine-schema.ts
|
|
41758
41877
|
var exports_community_machine_schema = {};
|
|
41759
41878
|
__export(exports_community_machine_schema, {
|
|
@@ -44240,63 +44359,6 @@ var OwnerDiagnosticReportSchema = exports_external.discriminatedUnion("status",
|
|
|
44240
44359
|
objectExpired: exports_external.literal(false)
|
|
44241
44360
|
}).strict()
|
|
44242
44361
|
]);
|
|
44243
|
-
// ../shared/src/community-profile-resource.ts
|
|
44244
|
-
var CommunityResourceProfileSchema = exports_external.strictObject({
|
|
44245
|
-
id: exports_external.string().min(1),
|
|
44246
|
-
name: exports_external.string(),
|
|
44247
|
-
discriminator: exports_external.string().min(1),
|
|
44248
|
-
avatar: exports_external.string().nullable(),
|
|
44249
|
-
avatarVersion: exports_external.number().int().nonnegative(),
|
|
44250
|
-
aboutMe: exports_external.string().optional(),
|
|
44251
|
-
bannerColor: exports_external.string().nullable().optional(),
|
|
44252
|
-
kind: exports_external.enum(["human", "bot"]).optional(),
|
|
44253
|
-
ownerUserId: exports_external.string().min(1).nullable().optional(),
|
|
44254
|
-
ownerHandle: exports_external.string().nullable().optional(),
|
|
44255
|
-
mutualServers: exports_external.number().int().nonnegative().optional(),
|
|
44256
|
-
ownedByViewer: exports_external.boolean().optional(),
|
|
44257
|
-
statusEmoji: exports_external.string().nullable().optional(),
|
|
44258
|
-
statusText: exports_external.string().nullable().optional()
|
|
44259
|
-
});
|
|
44260
|
-
// ../shared/src/business-schema-version.ts
|
|
44261
|
-
var BUSINESS_SCHEMA_VERSION = 7;
|
|
44262
|
-
|
|
44263
|
-
// ../shared/src/community-contract.ts
|
|
44264
|
-
var COMMUNITY_RESOURCE_CONTRACT_VERSION = BUSINESS_SCHEMA_VERSION;
|
|
44265
|
-
|
|
44266
|
-
// ../shared/src/community-friend-approval.ts
|
|
44267
|
-
var identity = CommunityResourceProfileSchema.pick({ id: true, name: true, discriminator: true, avatarVersion: true });
|
|
44268
|
-
var profile = identity.extend({ image: CommunityResourceProfileSchema.shape.avatar });
|
|
44269
|
-
var FriendApprovalPayloadSchema = exports_external.strictObject({
|
|
44270
|
-
friendshipId: exports_external.string(),
|
|
44271
|
-
status: exports_external.enum(["pending", "approved", "denied", "superseded", "cancelled"]),
|
|
44272
|
-
waitingOn: exports_external.enum(["you", "other-owner", "addressee"]).nullable(),
|
|
44273
|
-
otherProfile: profile,
|
|
44274
|
-
botProfile: profile,
|
|
44275
|
-
waitingOnProfile: profile.nullable().optional()
|
|
44276
|
-
});
|
|
44277
|
-
|
|
44278
|
-
// ../shared/src/constants/community.ts
|
|
44279
|
-
var MAX_FOLDER_NAME_LENGTH = 100;
|
|
44280
|
-
var MAX_PROFILE_NAME_LENGTH = 100;
|
|
44281
|
-
var MAX_PROFILE_ABOUT_LENGTH = 1000;
|
|
44282
|
-
var MAX_MESSAGE_CONTENT_LENGTH = 4000;
|
|
44283
|
-
var MAX_ATTACHMENTS_PER_MESSAGE = 10;
|
|
44284
|
-
var MAX_ATTACHMENT_SIZE_BYTES = 25 * 1024 * 1024;
|
|
44285
|
-
var MAX_ATTACHMENT_THUMBNAIL_EDGE_PX = 720;
|
|
44286
|
-
var MAX_ATTACHMENT_THUMBNAIL_SIZE_BYTES = 256 * 1024;
|
|
44287
|
-
var MAX_SERVER_ICON_SIZE_BYTES = 5 * 1024 * 1024;
|
|
44288
|
-
var ALLOWED_ICON_MIME_TYPES = [
|
|
44289
|
-
"image/png",
|
|
44290
|
-
"image/jpeg",
|
|
44291
|
-
"image/webp",
|
|
44292
|
-
"image/gif"
|
|
44293
|
-
];
|
|
44294
|
-
var MAX_ICON_SOURCE_FILE_SIZE_BYTES = 15 * 1024 * 1024;
|
|
44295
|
-
var PARTICIPANT_SOURCE = {
|
|
44296
|
-
MENTION: "mention",
|
|
44297
|
-
SPOKE: "spoke",
|
|
44298
|
-
ADDED: "added"
|
|
44299
|
-
};
|
|
44300
44362
|
|
|
44301
44363
|
// ../shared/src/runtime-models-contract.ts
|
|
44302
44364
|
var RUNTIME_MODEL_DISCOVERY_CAPABILITY = "runtime-model-discovery-v1";
|
|
@@ -44313,107 +44375,6 @@ var RuntimeModelDiscoveryErrorSchema = exports_external.strictObject({
|
|
|
44313
44375
|
message: exports_external.string().min(1).max(256)
|
|
44314
44376
|
});
|
|
44315
44377
|
|
|
44316
|
-
// ../shared/src/utils/slug.ts
|
|
44317
|
-
init_nanoid();
|
|
44318
|
-
var slugId = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz");
|
|
44319
|
-
function sanitizeSlug(input2) {
|
|
44320
|
-
return input2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60).replace(/-+$/g, "");
|
|
44321
|
-
}
|
|
44322
|
-
|
|
44323
|
-
// ../shared/src/pii-contract.ts
|
|
44324
|
-
var PII_CAPABILITY = "pii-v1";
|
|
44325
|
-
var PII_MAX_PLUGINS = 32;
|
|
44326
|
-
var PII_SOURCE_MAX_BYTES = 16 * 1024;
|
|
44327
|
-
var PII_TEXT_MAX_BYTES = 1024;
|
|
44328
|
-
var PII_REQUEST_MAX_BYTES = 8 * 1024;
|
|
44329
|
-
var PiiPreviewTextSchema = exports_external.string().max(PII_TEXT_MAX_BYTES).refine((text2) => new TextEncoder().encode(text2).byteLength <= PII_TEXT_MAX_BYTES).refine((text2) => text2.trim().length > 0);
|
|
44330
|
-
var PiiPluginSchema = exports_external.strictObject({
|
|
44331
|
-
id: exports_external.string().min(1).max(128),
|
|
44332
|
-
name: exports_external.string().trim().min(1).max(80),
|
|
44333
|
-
description: exports_external.string().trim().min(1).max(256),
|
|
44334
|
-
enabled: exports_external.boolean()
|
|
44335
|
-
});
|
|
44336
|
-
var PiiSnapshotSchema = exports_external.strictObject({
|
|
44337
|
-
revision: exports_external.number().int().nonnegative(),
|
|
44338
|
-
plugins: exports_external.array(PiiPluginSchema).max(PII_MAX_PLUGINS)
|
|
44339
|
-
});
|
|
44340
|
-
var pluginId = exports_external.string().min(1).max(128);
|
|
44341
|
-
var expectedRevision = exports_external.number().int().nonnegative();
|
|
44342
|
-
var PiiOperationSchema = exports_external.discriminatedUnion("action", [
|
|
44343
|
-
exports_external.strictObject({ action: exports_external.literal("list") }),
|
|
44344
|
-
exports_external.strictObject({ action: exports_external.literal("setEnabled"), pluginId, enabled: exports_external.boolean(), expectedRevision }),
|
|
44345
|
-
exports_external.strictObject({ action: exports_external.literal("remove"), pluginId, expectedRevision }),
|
|
44346
|
-
exports_external.strictObject({ action: exports_external.literal("preview"), text: PiiPreviewTextSchema, expectedRevision })
|
|
44347
|
-
]);
|
|
44348
|
-
var PiiRequestSchema = exports_external.strictObject({
|
|
44349
|
-
requestId: exports_external.string().min(1).max(128),
|
|
44350
|
-
operation: PiiOperationSchema
|
|
44351
|
-
});
|
|
44352
|
-
var PiiCommandSchema = PiiRequestSchema.extend({
|
|
44353
|
-
type: exports_external.literal("pii:manage"),
|
|
44354
|
-
botId: exports_external.string().min(1).max(128)
|
|
44355
|
-
});
|
|
44356
|
-
var PiiErrorCodeSchema = exports_external.enum([
|
|
44357
|
-
"PII_CONFLICT",
|
|
44358
|
-
"PII_UNAVAILABLE",
|
|
44359
|
-
"PII_PLUGIN_NOT_FOUND",
|
|
44360
|
-
"PII_BOT_NOT_FOUND",
|
|
44361
|
-
"PII_PLUGIN_FAILED",
|
|
44362
|
-
"PII_PLUGIN_TIMEOUT",
|
|
44363
|
-
"PII_INVALID_RESULT",
|
|
44364
|
-
"PII_OUTPUT_TOO_LARGE",
|
|
44365
|
-
"PII_INVALID_SOURCE",
|
|
44366
|
-
"PII_CONFIG_UNAVAILABLE",
|
|
44367
|
-
"PII_SOURCE_TOO_LARGE",
|
|
44368
|
-
"PII_INVALID_REQUEST"
|
|
44369
|
-
]);
|
|
44370
|
-
var PiiResultSchema = exports_external.discriminatedUnion("status", [
|
|
44371
|
-
exports_external.strictObject({ status: exports_external.literal("complete"), snapshot: PiiSnapshotSchema, output: PiiPreviewTextSchema.optional(), triggeredFilters: exports_external.array(PiiPluginSchema.pick({ id: true, name: true })).max(PII_MAX_PLUGINS).optional() }),
|
|
44372
|
-
exports_external.strictObject({
|
|
44373
|
-
status: exports_external.literal("error"),
|
|
44374
|
-
code: PiiErrorCodeSchema,
|
|
44375
|
-
pluginId: pluginId.optional(),
|
|
44376
|
-
snapshot: PiiSnapshotSchema.optional()
|
|
44377
|
-
})
|
|
44378
|
-
]);
|
|
44379
|
-
var PiiResultFrameSchema = exports_external.strictObject({
|
|
44380
|
-
type: exports_external.literal("pii_result"),
|
|
44381
|
-
botId: exports_external.string().min(1).max(128),
|
|
44382
|
-
requestId: exports_external.string().min(1).max(128),
|
|
44383
|
-
result: PiiResultSchema
|
|
44384
|
-
});
|
|
44385
|
-
var PiiLocalRequestSchema = exports_external.discriminatedUnion("action", [
|
|
44386
|
-
exports_external.strictObject({ action: exports_external.literal("list") }),
|
|
44387
|
-
exports_external.strictObject({
|
|
44388
|
-
action: exports_external.literal("add"),
|
|
44389
|
-
name: PiiPluginSchema.shape.name,
|
|
44390
|
-
description: PiiPluginSchema.shape.description,
|
|
44391
|
-
source: exports_external.string().min(1).max(PII_SOURCE_MAX_BYTES)
|
|
44392
|
-
})
|
|
44393
|
-
]);
|
|
44394
|
-
|
|
44395
|
-
// ../shared/src/utils/community-roles.ts
|
|
44396
|
-
var ROLES = {
|
|
44397
|
-
OWNER: "owner",
|
|
44398
|
-
ADMIN: "admin",
|
|
44399
|
-
MEMBER: "member"
|
|
44400
|
-
};
|
|
44401
|
-
|
|
44402
|
-
// ../shared/src/lib/discriminator.ts
|
|
44403
|
-
function parseNameAndTag(q) {
|
|
44404
|
-
const m = /^(.+)#(\d{4,})$/.exec(q);
|
|
44405
|
-
if (!m)
|
|
44406
|
-
return null;
|
|
44407
|
-
const name = m[1].trim();
|
|
44408
|
-
const discriminator = m[2];
|
|
44409
|
-
if (!name)
|
|
44410
|
-
return null;
|
|
44411
|
-
return { name, discriminator };
|
|
44412
|
-
}
|
|
44413
|
-
function formatHandle(name, discriminator) {
|
|
44414
|
-
return `${name}#${discriminator}`;
|
|
44415
|
-
}
|
|
44416
|
-
|
|
44417
44378
|
// ../shared/src/community-cli-contract.ts
|
|
44418
44379
|
var AGENT_EVENT_PROMPT_MAX_LENGTH = 32768;
|
|
44419
44380
|
var DM_SERVER = ".dm";
|
|
@@ -44589,6 +44550,91 @@ var HostCommandSchema = exports_external.discriminatedUnion("type", [
|
|
|
44589
44550
|
DiagnosticCollectCommandSchema
|
|
44590
44551
|
]);
|
|
44591
44552
|
|
|
44553
|
+
// ../shared/src/automation.ts
|
|
44554
|
+
var AUTOMATION_WRITE_PERMISSIONS = ["bot.create", "server.create", "server.invite", "message.send"];
|
|
44555
|
+
var AUTOMATION_READ_PERMISSIONS = ["machine.read", "friend.read", "server.read"];
|
|
44556
|
+
var AutomationPermissionSchema = exports_external.enum([...AUTOMATION_WRITE_PERMISSIONS, ...AUTOMATION_READ_PERMISSIONS]);
|
|
44557
|
+
var AutomationExpirySchema = exports_external.enum(["1h", "24h", "7d", "30d", "forever"]);
|
|
44558
|
+
var AutomationPermissionPolicySchema = exports_external.strictObject({
|
|
44559
|
+
permission: AutomationPermissionSchema,
|
|
44560
|
+
limit: exports_external.number().int().positive(),
|
|
44561
|
+
period: exports_external.enum(["hour", "day"])
|
|
44562
|
+
}).refine((value) => value.limit <= (value.period === "hour" ? 64 : 1536), {
|
|
44563
|
+
message: "Limit cannot exceed 64/hour or 1536/day",
|
|
44564
|
+
path: ["limit"]
|
|
44565
|
+
});
|
|
44566
|
+
var permissions = exports_external.array(AutomationPermissionPolicySchema).min(1).max(AutomationPermissionSchema.options.length).refine((values) => new Set(values.map((value) => value.permission)).size === values.length, "Duplicate permission");
|
|
44567
|
+
var AutomationAccessCodeCreateSchema = exports_external.strictObject({
|
|
44568
|
+
name: exports_external.string().trim().min(1).max(100),
|
|
44569
|
+
expiresIn: AutomationExpirySchema.default("24h"),
|
|
44570
|
+
permissions
|
|
44571
|
+
});
|
|
44572
|
+
var AutomationAccessCodeUpdateSchema = exports_external.strictObject({
|
|
44573
|
+
name: exports_external.string().trim().min(1).max(100).optional(),
|
|
44574
|
+
expiresIn: AutomationExpirySchema.optional(),
|
|
44575
|
+
permissions: permissions.optional()
|
|
44576
|
+
}).refine((value) => Object.keys(value).length > 0, "Provide at least one change");
|
|
44577
|
+
var AutomationMessageSendSchema = exports_external.strictObject({
|
|
44578
|
+
target: exports_external.string().min(1).max(1024).refine((value) => {
|
|
44579
|
+
try {
|
|
44580
|
+
parseRef(value);
|
|
44581
|
+
return true;
|
|
44582
|
+
} catch {
|
|
44583
|
+
return false;
|
|
44584
|
+
}
|
|
44585
|
+
}, "Use a channel or DM ref"),
|
|
44586
|
+
as: exports_external.string().max(128).refine((value) => value === "me" || value.startsWith("@") && Boolean(parseNameAndTag(value.slice(1))), "Use me or @name#NNNN"),
|
|
44587
|
+
content: exports_external.string().max(MAX_MESSAGE_CONTENT_LENGTH).refine((value) => value.trim().length > 0, "Message content is required"),
|
|
44588
|
+
nonce: exports_external.string().min(1).max(128)
|
|
44589
|
+
});
|
|
44590
|
+
var AutomationMessageSentSchema = exports_external.object({
|
|
44591
|
+
state: exports_external.literal("sent"),
|
|
44592
|
+
seq: exports_external.string().regex(/^#[1-9]\d*$/),
|
|
44593
|
+
deduped: exports_external.boolean(),
|
|
44594
|
+
threadId: exports_external.string().optional()
|
|
44595
|
+
});
|
|
44596
|
+
// ../shared/src/community-profile-resource.ts
|
|
44597
|
+
var CommunityResourceProfileSchema = exports_external.strictObject({
|
|
44598
|
+
id: exports_external.string().min(1),
|
|
44599
|
+
name: exports_external.string(),
|
|
44600
|
+
discriminator: exports_external.string().min(1),
|
|
44601
|
+
avatar: exports_external.string().nullable(),
|
|
44602
|
+
avatarVersion: exports_external.number().int().nonnegative(),
|
|
44603
|
+
aboutMe: exports_external.string().optional(),
|
|
44604
|
+
bannerColor: exports_external.string().nullable().optional(),
|
|
44605
|
+
kind: exports_external.enum(["human", "bot"]).optional(),
|
|
44606
|
+
ownerUserId: exports_external.string().min(1).nullable().optional(),
|
|
44607
|
+
ownerHandle: exports_external.string().nullable().optional(),
|
|
44608
|
+
mutualServers: exports_external.number().int().nonnegative().optional(),
|
|
44609
|
+
ownedByViewer: exports_external.boolean().optional(),
|
|
44610
|
+
statusEmoji: exports_external.string().nullable().optional(),
|
|
44611
|
+
statusText: exports_external.string().nullable().optional()
|
|
44612
|
+
});
|
|
44613
|
+
// ../shared/src/business-schema-version.ts
|
|
44614
|
+
var BUSINESS_SCHEMA_VERSION = 7;
|
|
44615
|
+
|
|
44616
|
+
// ../shared/src/community-contract.ts
|
|
44617
|
+
var COMMUNITY_RESOURCE_CONTRACT_VERSION = BUSINESS_SCHEMA_VERSION;
|
|
44618
|
+
|
|
44619
|
+
// ../shared/src/community-friend-approval.ts
|
|
44620
|
+
var identity = CommunityResourceProfileSchema.pick({ id: true, name: true, discriminator: true, avatarVersion: true });
|
|
44621
|
+
var profile = identity.extend({ image: CommunityResourceProfileSchema.shape.avatar });
|
|
44622
|
+
var FriendApprovalPayloadSchema = exports_external.strictObject({
|
|
44623
|
+
friendshipId: exports_external.string(),
|
|
44624
|
+
status: exports_external.enum(["pending", "approved", "denied", "superseded", "cancelled"]),
|
|
44625
|
+
waitingOn: exports_external.enum(["you", "other-owner", "addressee"]).nullable(),
|
|
44626
|
+
otherProfile: profile,
|
|
44627
|
+
botProfile: profile,
|
|
44628
|
+
waitingOnProfile: profile.nullable().optional()
|
|
44629
|
+
});
|
|
44630
|
+
|
|
44631
|
+
// ../shared/src/utils/slug.ts
|
|
44632
|
+
init_nanoid();
|
|
44633
|
+
var slugId = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz");
|
|
44634
|
+
function sanitizeSlug(input2) {
|
|
44635
|
+
return input2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60).replace(/-+$/g, "");
|
|
44636
|
+
}
|
|
44637
|
+
|
|
44592
44638
|
// ../shared/src/provider-telemetry.ts
|
|
44593
44639
|
var DAILY_TOKEN_USAGE_WINDOW_DAYS = 30;
|
|
44594
44640
|
var safeToken = exports_external.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
@@ -44802,15 +44848,6 @@ var PollResponseSchema = exports_external.object({
|
|
|
44802
44848
|
file_requests: exports_external.array(FileRequestItemSchema).optional(),
|
|
44803
44849
|
meetings: exports_external.array(PollMeetingItemSchema).optional()
|
|
44804
44850
|
});
|
|
44805
|
-
var DaemonPushMessageSchema = exports_external.discriminatedUnion("type", [
|
|
44806
|
-
exports_external.object({ type: exports_external.literal("daemon.tasks"), tasks: exports_external.array(TaskApiSchema) }),
|
|
44807
|
-
exports_external.object({ type: exports_external.literal("daemon.file_requests"), workspaceId: exports_external.string(), requests: exports_external.array(FileRequestItemSchema) }),
|
|
44808
|
-
exports_external.object({ type: exports_external.literal("daemon.meetings"), meetings: exports_external.array(PollMeetingItemSchema) }),
|
|
44809
|
-
exports_external.object({ type: exports_external.literal("daemon.evict"), workspaceId: exports_external.string() }),
|
|
44810
|
-
exports_external.object({ type: exports_external.literal("daemon.update"), version: exports_external.string() }),
|
|
44811
|
-
exports_external.object({ type: exports_external.literal("daemon.rescan") }),
|
|
44812
|
-
exports_external.object({ type: exports_external.literal("daemon.kill"), workspaceId: exports_external.string(), agentId: exports_external.string().min(1), taskId: exports_external.string(), targetTaskId: exports_external.string() })
|
|
44813
|
-
]);
|
|
44814
44851
|
var RegisterResponseSchema = exports_external.object({
|
|
44815
44852
|
runtimes: exports_external.array(exports_external.object({ id: exports_external.string() }))
|
|
44816
44853
|
});
|
|
@@ -45006,10 +45043,6 @@ var CreateMessageRequestSchema = exports_external.object({
|
|
|
45006
45043
|
content: exports_external.string().min(1, "content is required"),
|
|
45007
45044
|
metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
|
|
45008
45045
|
});
|
|
45009
|
-
var AgentDmRequestSchema = exports_external.object({
|
|
45010
|
-
content: exports_external.string().min(1, "content is required"),
|
|
45011
|
-
task_id: exports_external.string().min(1).optional()
|
|
45012
|
-
});
|
|
45013
45046
|
var EmailAttachmentSchema = exports_external.object({
|
|
45014
45047
|
key: exports_external.string().min(1),
|
|
45015
45048
|
filename: exports_external.string().min(1),
|
|
@@ -47464,12 +47497,36 @@ var communityBotCreationRequest = sqliteTable("community_bot_creation_request",
|
|
|
47464
47497
|
resolvedAt: text("resolved_at")
|
|
47465
47498
|
}, (t) => [index("idx_bot_creation_requester").on(t.requesterId, t.createdAt), index("idx_bot_creation_owner").on(t.ownerId, t.createdAt)]);
|
|
47466
47499
|
|
|
47500
|
+
// ../shared/src/db/automation-schema.ts
|
|
47501
|
+
var exports_automation_schema = {};
|
|
47502
|
+
__export(exports_automation_schema, {
|
|
47503
|
+
automationAccessPermission: () => automationAccessPermission,
|
|
47504
|
+
automationAccessCode: () => automationAccessCode
|
|
47505
|
+
});
|
|
47506
|
+
var automationAccessCode = sqliteTable("automation_access_code", {
|
|
47507
|
+
id: text("id").primaryKey(),
|
|
47508
|
+
ownerId: text("owner_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
47509
|
+
name: text("name").notNull(),
|
|
47510
|
+
secretHash: text("secret_hash").notNull().unique(),
|
|
47511
|
+
expiresAt: text("expires_at"),
|
|
47512
|
+
createdAt: text("created_at").notNull()
|
|
47513
|
+
}, (table) => [index("idx_automation_code_owner").on(table.ownerId)]);
|
|
47514
|
+
var automationAccessPermission = sqliteTable("automation_access_permission", {
|
|
47515
|
+
codeId: text("code_id").notNull().references(() => automationAccessCode.id, { onDelete: "cascade" }),
|
|
47516
|
+
permission: text("permission").$type().notNull(),
|
|
47517
|
+
limit: integer2("request_limit").notNull(),
|
|
47518
|
+
period: text("period", { enum: ["hour", "day"] }).notNull()
|
|
47519
|
+
}, (table) => [primaryKey({ columns: [table.codeId, table.permission] })]);
|
|
47520
|
+
|
|
47467
47521
|
// ../shared/src/db/index.ts
|
|
47468
|
-
var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema, ...exports_product_plan_schema, ...exports_billing_schema, ...exports_community_funnel_analytics_schema, ...exports_bot_creation_schema };
|
|
47522
|
+
var allSchema = { ...exports_schema, ...exports_community_schema, ...exports_community_machine_schema, ...exports_product_plan_schema, ...exports_billing_schema, ...exports_community_funnel_analytics_schema, ...exports_bot_creation_schema, ...exports_automation_schema };
|
|
47469
47523
|
// ../shared/src/db/queries/native-oauth.ts
|
|
47470
47524
|
var ATTEMPT_TTL_MS = 10 * 60 * 1000;
|
|
47471
47525
|
var HANDOFF_TTL_MS = 2 * 60 * 1000;
|
|
47472
47526
|
var RETENTION_MS = 24 * 60 * 60 * 1000;
|
|
47527
|
+
|
|
47528
|
+
// ../shared/src/db/queries/automation.ts
|
|
47529
|
+
var publicFields = { id: automationAccessCode.id, name: automationAccessCode.name, createdAt: automationAccessCode.createdAt, expiresAt: automationAccessCode.expiresAt };
|
|
47473
47530
|
// ../shared/src/db/queries/task.ts
|
|
47474
47531
|
var DEFAULT_STALE_SECONDS = Number(process.env.ALOOK_STALE_DISPATCH_TIMEOUT_S) || 20;
|
|
47475
47532
|
var DEFAULT_STALE_RUNNING_SECONDS = Number(process.env.ALOOK_STALE_RUNNING_TIMEOUT_S) || 3600;
|
|
@@ -47830,7 +47887,7 @@ var CommunityBotsProfileReadSchema = exports_external.object({
|
|
|
47830
47887
|
var failure2 = (message2, code, details) => Object.assign(new Error(message2), { code, platformDetails: details });
|
|
47831
47888
|
function registerPlatformCommands(program, getApi, output2) {
|
|
47832
47889
|
const platform = program.command("platform").description("owner-scoped platform capabilities").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} });
|
|
47833
|
-
const machine2 = platform.command("machine").description("read machines, backends, models and model-specific effort").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).option("--list", "list your owner's machines").option("--backends", "show backends on --id").option("--models", "show models and effort for --id and --backend").option("--id <id>", "owner machine ID").option("--backend <id>", "backend ID from the selected machine").option("--model <id>", "show effort for this full model ID").option("--refresh", "
|
|
47890
|
+
const machine2 = platform.command("machine").description("read machines, backends, models and model-specific effort").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).option("--list", "list your owner's machines").option("--backends", "show backends on --id").option("--models", "show models and effort for --id and --backend").option("--id <id>", "owner machine ID").option("--backend <id>", "backend ID from the selected machine").option("--model <id>", "show effort for this full model ID").option("--refresh", "bypass the five-minute model cache and wait for fresh models");
|
|
47834
47891
|
machine2.action(async () => {
|
|
47835
47892
|
const opts = machine2.opts();
|
|
47836
47893
|
const actions = [opts.list, opts.backends, opts.models].filter(Boolean).length;
|
|
@@ -47851,7 +47908,7 @@ function registerPlatformCommands(program, getApi, output2) {
|
|
|
47851
47908
|
const api2 = getApi();
|
|
47852
47909
|
if (!api2.platformMachine)
|
|
47853
47910
|
throw failure2("Platform machine commands are unavailable", "UPGRADE_REQUIRED");
|
|
47854
|
-
const result = await api2.platformMachine(opts.list ? { action: "list" } : opts.backends ? { action: "backends", machineId: opts.id } : { action: "models", machineId: opts.id, backendId: opts.backend, ...opts.model ? { model: opts.model } : {}, refresh: opts.refresh === true,
|
|
47911
|
+
const result = await api2.platformMachine(opts.list ? { action: "list" } : opts.backends ? { action: "backends", machineId: opts.id } : { action: "models", machineId: opts.id, backendId: opts.backend, ...opts.model ? { model: opts.model } : {}, refresh: opts.refresh === true, requestId: randomUUID() });
|
|
47855
47912
|
output2({ success: result });
|
|
47856
47913
|
});
|
|
47857
47914
|
const bot = platform.command("bot").description("read bots or request owner-approved creation").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).option("--list", "list your owner's bot summaries").option("--create <bot-json>", "request one bot; repeat for one gallery request", (value, previous) => [...previous, value], []);
|
|
@@ -47894,6 +47951,239 @@ function registerPlatformCommands(program, getApi, output2) {
|
|
|
47894
47951
|
});
|
|
47895
47952
|
}
|
|
47896
47953
|
|
|
47954
|
+
// src/cli/use.ts
|
|
47955
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
47956
|
+
import { readFile, stat } from "node:fs/promises";
|
|
47957
|
+
var BotInput = exports_external.strictObject({
|
|
47958
|
+
...CommunityBotCreateRequestSchema.omit({ runtime: true, image: true }).shape,
|
|
47959
|
+
backendId: exports_external.string().min(1).max(64)
|
|
47960
|
+
});
|
|
47961
|
+
var ServerInput = exports_external.strictObject({ name: exports_external.string().trim().min(1).max(MAX_SERVER_NAME_LENGTH), description: exports_external.string().max(MAX_SERVER_DESCRIPTION_LENGTH).optional() });
|
|
47962
|
+
var BackendList = exports_external.array(exports_external.object({
|
|
47963
|
+
id: exports_external.string().min(1),
|
|
47964
|
+
version: exports_external.string().optional(),
|
|
47965
|
+
health: exports_external.enum(["healthy", "unhealthy"]),
|
|
47966
|
+
modelRequired: exports_external.boolean()
|
|
47967
|
+
}));
|
|
47968
|
+
var ServerChannels = exports_external.array(exports_external.object({ name: exports_external.string().min(1), type: exports_external.enum(["text", "forum"]), ref: exports_external.string().min(1) }));
|
|
47969
|
+
var MemberList = exports_external.object({
|
|
47970
|
+
server: exports_external.string().min(1),
|
|
47971
|
+
url: exports_external.url(),
|
|
47972
|
+
members: exports_external.array(exports_external.object({ handle: exports_external.string().min(1), role: exports_external.string().min(1) })),
|
|
47973
|
+
hasMore: exports_external.boolean(),
|
|
47974
|
+
cursor: exports_external.string().min(1).optional()
|
|
47975
|
+
}).refine((value) => !value.hasMore || Boolean(value.cursor));
|
|
47976
|
+
var ModelList = exports_external.object({
|
|
47977
|
+
machineId: exports_external.string().min(1),
|
|
47978
|
+
backendId: exports_external.string().min(1),
|
|
47979
|
+
source: exports_external.enum(["fresh_discovery", "cached_report"]),
|
|
47980
|
+
requestId: exports_external.string().min(1),
|
|
47981
|
+
readAt: exports_external.string(),
|
|
47982
|
+
observedAt: exports_external.iso.datetime(),
|
|
47983
|
+
modelRequired: exports_external.boolean(),
|
|
47984
|
+
defaultModelId: exports_external.string().nullable(),
|
|
47985
|
+
models: exports_external.array(exports_external.object({
|
|
47986
|
+
id: exports_external.string().min(1),
|
|
47987
|
+
displayName: exports_external.string().optional(),
|
|
47988
|
+
reasoningEfforts: exports_external.array(exports_external.object({ value: exports_external.string().min(1), description: exports_external.string().optional() })),
|
|
47989
|
+
defaultReasoningEffort: exports_external.string().nullable()
|
|
47990
|
+
})).nullable()
|
|
47991
|
+
});
|
|
47992
|
+
async function readAccessCode(file2) {
|
|
47993
|
+
let secret = process.env.ALOOK_ACCESS_CODE?.trim();
|
|
47994
|
+
if (file2) {
|
|
47995
|
+
if ((await stat(file2)).size > 1024)
|
|
47996
|
+
throw new Error("Access code file is too large");
|
|
47997
|
+
secret = (await readFile(file2, "utf8")).trim();
|
|
47998
|
+
}
|
|
47999
|
+
if (!secret || !/^aac_[a-f0-9]{64}$/.test(secret))
|
|
48000
|
+
throw new Error("Set ALOOK_ACCESS_CODE or use --access-code-file with an Automation access code");
|
|
48001
|
+
return secret;
|
|
48002
|
+
}
|
|
48003
|
+
function serverOrigin(value) {
|
|
48004
|
+
const url2 = new URL(value);
|
|
48005
|
+
if (url2.username || url2.password || url2.search || url2.hash || url2.pathname !== "/")
|
|
48006
|
+
throw new Error("--server-url must be a server origin");
|
|
48007
|
+
const local = ["localhost", "127.0.0.1", "[::1]"].includes(url2.hostname);
|
|
48008
|
+
if (url2.protocol !== "https:" && !(url2.protocol === "http:" && local))
|
|
48009
|
+
throw new Error("--server-url requires HTTPS, except for local development");
|
|
48010
|
+
return url2.origin;
|
|
48011
|
+
}
|
|
48012
|
+
function parseInput(value, schema) {
|
|
48013
|
+
if (Buffer.byteLength(value, "utf8") > 131072)
|
|
48014
|
+
throw new Error("Automation request is too large");
|
|
48015
|
+
let input2;
|
|
48016
|
+
try {
|
|
48017
|
+
input2 = JSON.parse(value);
|
|
48018
|
+
} catch {
|
|
48019
|
+
throw new Error("Invalid request JSON");
|
|
48020
|
+
}
|
|
48021
|
+
const parsed = schema.safeParse(input2);
|
|
48022
|
+
if (!parsed.success)
|
|
48023
|
+
throw new Error(parsed.error.issues.map((issue3) => `${issue3.path.join(".")}: ${issue3.message}`).join("; "));
|
|
48024
|
+
return parsed.data;
|
|
48025
|
+
}
|
|
48026
|
+
var InviteInput = exports_external.strictObject({
|
|
48027
|
+
server: exports_external.string().max(128).refine((value) => Boolean(parseNameAndTag(value)), "Use a full server handle"),
|
|
48028
|
+
friend: exports_external.string().max(128).refine((value) => Boolean(parseNameAndTag(value)), "Use a full friend handle")
|
|
48029
|
+
});
|
|
48030
|
+
function registerUseCommands(program, output2) {
|
|
48031
|
+
const use = program.command("use").description("user Automation access: read lists, create resources, invite friends and send messages; no daemon connection required").option("--access-code-file <path>", "read the code from a file instead of ALOOK_ACCESS_CODE").option("--server-url <url>", "server origin (or ALOOK_SERVER_URL; defaults to production)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} });
|
|
48032
|
+
const request = async (path, body, timeoutMs = 30000) => {
|
|
48033
|
+
const options = use.opts();
|
|
48034
|
+
const origin = serverOrigin(options.serverUrl || process.env.ALOOK_SERVER_URL || "https://alook.ai");
|
|
48035
|
+
const secret = await readAccessCode(options.accessCodeFile);
|
|
48036
|
+
let response;
|
|
48037
|
+
try {
|
|
48038
|
+
response = await fetch(`${origin}${path}`, {
|
|
48039
|
+
method: body === undefined ? "GET" : "POST",
|
|
48040
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${secret}` },
|
|
48041
|
+
...body === undefined ? {} : { body: JSON.stringify(body) },
|
|
48042
|
+
redirect: "error",
|
|
48043
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
48044
|
+
});
|
|
48045
|
+
} catch {
|
|
48046
|
+
throw new Error(body === undefined ? "Automation request failed" : "Automation request failed; the result may be unknown. Do not retry automatically.");
|
|
48047
|
+
}
|
|
48048
|
+
let raw;
|
|
48049
|
+
try {
|
|
48050
|
+
raw = await response.json();
|
|
48051
|
+
} catch {
|
|
48052
|
+
throw new Error(`Automation returned HTTP ${response.status} without a valid result; do not retry automatically`);
|
|
48053
|
+
}
|
|
48054
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
48055
|
+
throw new Error("Automation returned an invalid result");
|
|
48056
|
+
const result = raw;
|
|
48057
|
+
if (!response.ok) {
|
|
48058
|
+
const message2 = typeof result.error === "string" ? result.error.replaceAll(secret, "[redacted]") : `Automation failed: HTTP ${response.status}`;
|
|
48059
|
+
throw Object.assign(new Error(message2), {
|
|
48060
|
+
...typeof result.code === "string" ? { code: result.code.replaceAll(secret, "[redacted]") } : {},
|
|
48061
|
+
...response.status === 429 ? { hint: `Retry after ${response.headers.get("Retry-After") ?? "the indicated"} seconds` } : {}
|
|
48062
|
+
});
|
|
48063
|
+
}
|
|
48064
|
+
return { result, origin };
|
|
48065
|
+
};
|
|
48066
|
+
use.command("expire").description("expire the supplied access code immediately").action(async () => {
|
|
48067
|
+
const { result } = await request("/api/community/automation/expire", {});
|
|
48068
|
+
if (result.expired !== true)
|
|
48069
|
+
throw new Error("Automation returned an invalid expiration result");
|
|
48070
|
+
output2({ success: { expired: true } });
|
|
48071
|
+
});
|
|
48072
|
+
use.command("message").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).description("send a UTF-8 file as yourself or an owned bot").option("--send", "send one message").requiredOption("--target <ref>", "channel or DM ref").requiredOption("--as <identity>", "me or @name#NNNN of your bot").requiredOption("--file <path>", "UTF-8 message body file").action(async (options) => {
|
|
48073
|
+
if (!options.send)
|
|
48074
|
+
throw new Error("Use message --send");
|
|
48075
|
+
const info = await stat(options.file);
|
|
48076
|
+
if (!info.isFile() || info.size > MAX_MESSAGE_CONTENT_LENGTH * 4)
|
|
48077
|
+
throw new Error("Message file is invalid or too large");
|
|
48078
|
+
const bytes = await readFile(options.file);
|
|
48079
|
+
if (bytes.length > MAX_MESSAGE_CONTENT_LENGTH * 4)
|
|
48080
|
+
throw new Error("Message file is too large");
|
|
48081
|
+
const content = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
|
|
48082
|
+
const body = parseInput(JSON.stringify({ target: options.target, as: options.as, content, nonce: randomUUID2() }), AutomationMessageSendSchema);
|
|
48083
|
+
const { result } = await request("/api/community/automation/messages", body);
|
|
48084
|
+
if (result.state === "blocked")
|
|
48085
|
+
throw Object.assign(new Error("Bot has unread messages; use its normal inbox pull before sending"), { code: "unaligned" });
|
|
48086
|
+
const sent = AutomationMessageSentSchema.safeParse(result);
|
|
48087
|
+
if (!sent.success)
|
|
48088
|
+
throw new Error("Automation returned an invalid message result");
|
|
48089
|
+
output2({ success: sent.data });
|
|
48090
|
+
});
|
|
48091
|
+
for (const kind of ["bot", "server", "machine", "friend"]) {
|
|
48092
|
+
const command = use.command(kind).description(`Automation ${kind} operations`).exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} });
|
|
48093
|
+
if (kind === "bot" || kind === "server")
|
|
48094
|
+
command.option("--create <json>", kind === "bot" ? "bot JSON: name, machineId, backendId, optional description/model/reasoningEffort" : "server JSON: name, optional description");
|
|
48095
|
+
if (kind !== "bot")
|
|
48096
|
+
command.option("--list", `list minimal ${kind} identities`);
|
|
48097
|
+
if (kind === "machine")
|
|
48098
|
+
command.option("--list-models", "fetch fresh backend models and reasoning efforts").option("--refresh", "bypass the five-minute model cache").option("--id <machine-id>", "target machine ID for --list-models").option("--backend <backend-id>", "target backend ID for --list-models");
|
|
48099
|
+
if (kind === "server")
|
|
48100
|
+
command.option("--invite <json>", "invite JSON: server and friend full handles").option("--members <server>", "list joined members by full server handle").option("--cursor <cursor>", "next page cursor for --members");
|
|
48101
|
+
command.action(async () => {
|
|
48102
|
+
const options = command.opts();
|
|
48103
|
+
if ([options.create !== undefined, options.list === true, options.invite !== undefined, options.listModels === true, options.members !== undefined].filter(Boolean).length !== 1)
|
|
48104
|
+
throw new Error("Choose exactly one action: --create, --list, --invite, --list-models, or --members");
|
|
48105
|
+
if (options.cursor !== undefined && options.members === undefined)
|
|
48106
|
+
throw new Error("--cursor requires --members");
|
|
48107
|
+
if (options.members !== undefined) {
|
|
48108
|
+
if (!parseNameAndTag(options.members))
|
|
48109
|
+
throw new Error("Use a full server handle");
|
|
48110
|
+
const query = options.cursor ? `?${new URLSearchParams({ cursor: options.cursor })}` : "";
|
|
48111
|
+
const { result: result2 } = await request(`/api/community/automation/servers/${encodeURIComponent(options.members)}/members${query}`);
|
|
48112
|
+
const parsed = MemberList.safeParse(result2);
|
|
48113
|
+
if (!parsed.success || parsed.data.server !== options.members)
|
|
48114
|
+
throw new Error("Automation returned an invalid member list");
|
|
48115
|
+
output2({ success: parsed.data });
|
|
48116
|
+
return;
|
|
48117
|
+
}
|
|
48118
|
+
if (options.listModels) {
|
|
48119
|
+
if (!options.id?.trim() || !options.backend?.trim())
|
|
48120
|
+
throw new Error("--list-models requires --id and --backend");
|
|
48121
|
+
const requestId = randomUUID2();
|
|
48122
|
+
const { result: result2 } = await request(`/api/community/automation/machines/${encodeURIComponent(options.id)}/discover-models`, { requestId, runtimeId: options.backend, ...options.refresh ? { refresh: true } : {} }, 55000);
|
|
48123
|
+
const parsed = ModelList.safeParse(result2);
|
|
48124
|
+
if (!parsed.success || parsed.data.machineId !== options.id || parsed.data.backendId !== options.backend || parsed.data.requestId !== requestId)
|
|
48125
|
+
throw new Error("Automation returned an invalid model list");
|
|
48126
|
+
output2({ success: parsed.data });
|
|
48127
|
+
return;
|
|
48128
|
+
}
|
|
48129
|
+
if (options.id !== undefined || options.backend !== undefined || options.refresh)
|
|
48130
|
+
throw new Error("--id, --backend and --refresh require --list-models");
|
|
48131
|
+
if (options.list) {
|
|
48132
|
+
const key = `${kind}s`;
|
|
48133
|
+
const { result: result2 } = await request(kind === "friend" ? "/api/community/automation/friends" : `/api/community/automation/${key}`);
|
|
48134
|
+
const rows = result2[key];
|
|
48135
|
+
if (!Array.isArray(rows))
|
|
48136
|
+
throw new Error("Automation returned an invalid list");
|
|
48137
|
+
const list = rows.map((row) => {
|
|
48138
|
+
if (!row || typeof row !== "object" || !("name" in row) || typeof row.name !== "string")
|
|
48139
|
+
throw new Error("Automation returned an invalid identity");
|
|
48140
|
+
if (kind === "machine" && "id" in row && typeof row.id === "string" && "status" in row && (row.status === "online" || row.status === "offline")) {
|
|
48141
|
+
const backends = BackendList.safeParse("backends" in row ? row.backends : undefined);
|
|
48142
|
+
if (!backends.success)
|
|
48143
|
+
throw new Error("Automation returned an invalid backend list");
|
|
48144
|
+
return { id: row.id, name: row.name, status: row.status, backends: backends.data };
|
|
48145
|
+
}
|
|
48146
|
+
if (kind === "friend" && "handle" in row && typeof row.handle === "string" && "is_my_bot" in row && typeof row.is_my_bot === "boolean")
|
|
48147
|
+
return { name: row.name, handle: row.handle, is_my_bot: row.is_my_bot };
|
|
48148
|
+
if (kind === "server" && "handle" in row && typeof row.handle === "string") {
|
|
48149
|
+
const channels = ServerChannels.safeParse("channels" in row ? row.channels : undefined);
|
|
48150
|
+
if (!channels.success)
|
|
48151
|
+
throw new Error("Automation returned an invalid server channel list");
|
|
48152
|
+
return { name: row.name, handle: row.handle, channels: channels.data };
|
|
48153
|
+
}
|
|
48154
|
+
throw new Error("Automation returned an invalid identity");
|
|
48155
|
+
});
|
|
48156
|
+
output2({ success: { [key]: list } });
|
|
48157
|
+
return;
|
|
48158
|
+
}
|
|
48159
|
+
if (options.invite !== undefined) {
|
|
48160
|
+
const input2 = parseInput(options.invite, InviteInput);
|
|
48161
|
+
const { result: result2 } = await request(`/api/community/automation/servers/${encodeURIComponent(input2.server)}/invites`, { friend: input2.friend });
|
|
48162
|
+
const value = result2.invitation;
|
|
48163
|
+
if (!value || typeof value !== "object" || !("sent" in value) || value.sent !== true || !("server" in value) || typeof value.server !== "string" || !("friend" in value) || typeof value.friend !== "string")
|
|
48164
|
+
throw new Error("Automation returned an invalid invitation result; do not retry automatically");
|
|
48165
|
+
output2({ success: { invitation: { server: value.server, friend: value.friend, sent: true } } });
|
|
48166
|
+
return;
|
|
48167
|
+
}
|
|
48168
|
+
let body;
|
|
48169
|
+
if (kind === "bot") {
|
|
48170
|
+
const { backendId, ...bot } = parseInput(options.create, BotInput);
|
|
48171
|
+
body = { ...bot, runtime: backendId };
|
|
48172
|
+
} else
|
|
48173
|
+
body = parseInput(options.create, ServerInput);
|
|
48174
|
+
const { result, origin } = await request(`/api/community/automation/${kind}s`, body);
|
|
48175
|
+
const resource = result[kind];
|
|
48176
|
+
if (!resource || typeof resource !== "object" || !("id" in resource) || !("name" in resource) || !("discriminator" in resource) || typeof resource.id !== "string" || typeof resource.name !== "string" || typeof resource.discriminator !== "string")
|
|
48177
|
+
throw new Error("Automation returned an invalid result; do not retry automatically");
|
|
48178
|
+
output2({ success: { [kind]: {
|
|
48179
|
+
id: resource.id,
|
|
48180
|
+
handle: `${resource.name}#${resource.discriminator}`,
|
|
48181
|
+
...kind === "server" ? { url: `${origin}/c/channels/${encodeURIComponent(resource.id)}` } : {}
|
|
48182
|
+
} } });
|
|
48183
|
+
});
|
|
48184
|
+
}
|
|
48185
|
+
}
|
|
48186
|
+
|
|
47897
48187
|
// src/cli/index.ts
|
|
47898
48188
|
import { Command, CommanderError } from "commander";
|
|
47899
48189
|
|
|
@@ -48271,7 +48561,7 @@ function registerPiiCommands(program, output2) {
|
|
|
48271
48561
|
|
|
48272
48562
|
// src/cli/index.ts
|
|
48273
48563
|
import { realpathSync as realpathSync2 } from "node:fs";
|
|
48274
|
-
import { randomUUID as
|
|
48564
|
+
import { randomUUID as randomUUID15 } from "node:crypto";
|
|
48275
48565
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
48276
48566
|
// src/cli/proxyServerApi.ts
|
|
48277
48567
|
import * as fs from "fs";
|
|
@@ -48686,9 +48976,7 @@ function createProxyServerApi(config2) {
|
|
|
48686
48976
|
const machine2 = `/machines/${encodeURIComponent(req.machineId)}`;
|
|
48687
48977
|
if (req.action === "backends")
|
|
48688
48978
|
return platformCall(machine2);
|
|
48689
|
-
|
|
48690
|
-
return platformCall(`${machine2}/discover-models`, "POST", { requestId: req.requestId ?? crypto.randomUUID(), runtimeId: req.backendId });
|
|
48691
|
-
return platformCall(`${machine2}/models?backend=${encodeURIComponent(req.backendId)}${req.model ? `&model=${encodeURIComponent(req.model)}` : ""}`);
|
|
48979
|
+
return platformCall(`${machine2}/discover-models?wait=1${req.model ? `&model=${encodeURIComponent(req.model)}` : ""}`, "POST", { requestId: req.requestId ?? crypto.randomUUID(), runtimeId: req.backendId, ...req.refresh ? { refresh: true } : {} });
|
|
48692
48980
|
}
|
|
48693
48981
|
async function callPlatformBot(req) {
|
|
48694
48982
|
if (req.action === "list")
|
|
@@ -48736,7 +49024,7 @@ import * as path14 from "path";
|
|
|
48736
49024
|
import * as fs6 from "fs";
|
|
48737
49025
|
import { fileURLToPath } from "url";
|
|
48738
49026
|
// agent-driver/dist/host/default-host.js
|
|
48739
|
-
import { randomUUID as
|
|
49027
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
48740
49028
|
function createDefaultAgentDriverHost(options = {}) {
|
|
48741
49029
|
const environment = { ...options.environment ?? process.env };
|
|
48742
49030
|
return {
|
|
@@ -48759,7 +49047,7 @@ function createDefaultAgentDriverHost(options = {}) {
|
|
|
48759
49047
|
options.onRawOutput?.(event);
|
|
48760
49048
|
},
|
|
48761
49049
|
now: () => Date.now(),
|
|
48762
|
-
createId: () =>
|
|
49050
|
+
createId: () => randomUUID3()
|
|
48763
49051
|
};
|
|
48764
49052
|
}
|
|
48765
49053
|
|
|
@@ -48772,7 +49060,7 @@ import { EventEmitter } from "events";
|
|
|
48772
49060
|
|
|
48773
49061
|
// agent-driver/dist/internal/killTree.js
|
|
48774
49062
|
import { execFileSync as execFileSync2, spawn } from "child_process";
|
|
48775
|
-
import { randomUUID as
|
|
49063
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
48776
49064
|
import { createServer } from "node:net";
|
|
48777
49065
|
import { PassThrough } from "node:stream";
|
|
48778
49066
|
|
|
@@ -49227,7 +49515,7 @@ function spawnAgentProcess(command, args, opts) {
|
|
|
49227
49515
|
if (!isPosix) {
|
|
49228
49516
|
const stdin = opts.stdin ?? "pipe";
|
|
49229
49517
|
const stdinProxy = stdin === "pipe" ? new PassThrough : undefined;
|
|
49230
|
-
const stdinPipe = stdinProxy ? `\\\\.\\pipe\\alook-agent-${process.pid}-${
|
|
49518
|
+
const stdinPipe = stdinProxy ? `\\\\.\\pipe\\alook-agent-${process.pid}-${randomUUID4()}` : undefined;
|
|
49231
49519
|
let stdinSocket;
|
|
49232
49520
|
const stdinServer = stdinProxy ? createServer((socket) => {
|
|
49233
49521
|
stdinSocket = socket;
|
|
@@ -49907,9 +50195,9 @@ async function prepareCliTransport(ctx, extraEnv = {}, cli = DEFAULT_CLI_CONFIG,
|
|
|
49907
50195
|
}
|
|
49908
50196
|
|
|
49909
50197
|
// agent-driver/dist/internal/utils.js
|
|
49910
|
-
import { randomUUID as
|
|
50198
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
49911
50199
|
function jsonRpcRequest(method, params, id3) {
|
|
49912
|
-
return JSON.stringify({ jsonrpc: "2.0", id: id3 ??
|
|
50200
|
+
return JSON.stringify({ jsonrpc: "2.0", id: id3 ?? randomUUID5(), method, params });
|
|
49913
50201
|
}
|
|
49914
50202
|
function tryParseJsonLine(line) {
|
|
49915
50203
|
try {
|
|
@@ -51296,7 +51584,7 @@ class AntigravityAcpLane {
|
|
|
51296
51584
|
}
|
|
51297
51585
|
|
|
51298
51586
|
// agent-driver/dist/adapters/antigravity/probe.js
|
|
51299
|
-
import { createHash as createHash3, randomUUID as
|
|
51587
|
+
import { createHash as createHash3, randomUUID as randomUUID6 } from "node:crypto";
|
|
51300
51588
|
import { mkdirSync as mkdirSync3, readFileSync as readFileSync3, renameSync as renameSync2, writeFileSync as writeFileSync3 } from "node:fs";
|
|
51301
51589
|
import { homedir as homedir5 } from "node:os";
|
|
51302
51590
|
import { join as join6 } from "node:path";
|
|
@@ -51426,7 +51714,7 @@ async function probeAntigravity(command, options = {}) {
|
|
|
51426
51714
|
return fail("antigravity_acp_invalid_session");
|
|
51427
51715
|
if (!loading) {
|
|
51428
51716
|
try {
|
|
51429
|
-
const temporary = `${cacheFile}.${
|
|
51717
|
+
const temporary = `${cacheFile}.${randomUUID6()}.tmp`;
|
|
51430
51718
|
writeFileSync3(temporary, sessionId, { mode: 384 });
|
|
51431
51719
|
renameSync2(temporary, cacheFile);
|
|
51432
51720
|
} catch {
|
|
@@ -51492,7 +51780,7 @@ class AntigravityDriver {
|
|
|
51492
51780
|
}
|
|
51493
51781
|
|
|
51494
51782
|
// agent-driver/dist/adapters/claude/index.js
|
|
51495
|
-
import { randomUUID as
|
|
51783
|
+
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
51496
51784
|
|
|
51497
51785
|
// agent-driver/dist/adapters/claude/providerIsolation.js
|
|
51498
51786
|
import * as fs5 from "fs";
|
|
@@ -51852,7 +52140,7 @@ class ClaudeEventNormalizer {
|
|
|
51852
52140
|
}
|
|
51853
52141
|
|
|
51854
52142
|
// agent-driver/dist/adapters/claude/turnProtocol.js
|
|
51855
|
-
import { randomUUID as
|
|
52143
|
+
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
51856
52144
|
|
|
51857
52145
|
class ClaudeTurnProtocol {
|
|
51858
52146
|
rootUuid = null;
|
|
@@ -51862,7 +52150,7 @@ class ClaudeTurnProtocol {
|
|
|
51862
52150
|
interruptRequested = false;
|
|
51863
52151
|
finalized = false;
|
|
51864
52152
|
beginTurn() {
|
|
51865
|
-
const uuid3 =
|
|
52153
|
+
const uuid3 = randomUUID7();
|
|
51866
52154
|
this.rootUuid = uuid3;
|
|
51867
52155
|
this.segmentOwnerUuid = uuid3;
|
|
51868
52156
|
this.delivered.clear();
|
|
@@ -51878,7 +52166,7 @@ class ClaudeTurnProtocol {
|
|
|
51878
52166
|
return this.rootUuid;
|
|
51879
52167
|
}
|
|
51880
52168
|
steeringInputUuid() {
|
|
51881
|
-
const uuid3 =
|
|
52169
|
+
const uuid3 = randomUUID7();
|
|
51882
52170
|
this.delivered.set(uuid3, { acknowledged: false, followOn: this.awaitingFollowOn });
|
|
51883
52171
|
return uuid3;
|
|
51884
52172
|
}
|
|
@@ -51945,7 +52233,7 @@ import { createInterface } from "node:readline";
|
|
|
51945
52233
|
// agent-driver/dist/internal/recent-context.js
|
|
51946
52234
|
import path6 from "node:path";
|
|
51947
52235
|
import { createReadStream } from "node:fs";
|
|
51948
|
-
import { readdir, stat } from "node:fs/promises";
|
|
52236
|
+
import { readdir, stat as stat2 } from "node:fs/promises";
|
|
51949
52237
|
function normalizeAbsolutePath(value) {
|
|
51950
52238
|
if (typeof value !== "string" || !path6.isAbsolute(value))
|
|
51951
52239
|
return null;
|
|
@@ -51989,7 +52277,7 @@ async function readFirstLine(filePath, maxBytes = 65536) {
|
|
|
51989
52277
|
async function collectJsonlFileCandidates(root, options = {}) {
|
|
51990
52278
|
const candidates = [];
|
|
51991
52279
|
const readDirectory = options.readDirectory ?? ((directory) => readdir(directory, { withFileTypes: true }));
|
|
51992
|
-
const statPath = options.statPath ??
|
|
52280
|
+
const statPath = options.statPath ?? stat2;
|
|
51993
52281
|
const visit2 = async (directory, remainingDepth, includeFiles) => {
|
|
51994
52282
|
let entries;
|
|
51995
52283
|
try {
|
|
@@ -52258,7 +52546,7 @@ class ClaudeDriver {
|
|
|
52258
52546
|
writeInterrupt(input2, process2) {
|
|
52259
52547
|
process2.stdin.write(JSON.stringify({
|
|
52260
52548
|
type: "control_request",
|
|
52261
|
-
request_id: input2.requestId ??
|
|
52549
|
+
request_id: input2.requestId ?? randomUUID8(),
|
|
52262
52550
|
request: { subtype: "interrupt" }
|
|
52263
52551
|
}) + `
|
|
52264
52552
|
`);
|
|
@@ -58295,8 +58583,8 @@ function ensureSymlinks(workDir, canonical = CANONICAL_FILE, aliases = SYMLINK_A
|
|
|
58295
58583
|
continue;
|
|
58296
58584
|
const aliasPath = join11(workDir, alias2);
|
|
58297
58585
|
try {
|
|
58298
|
-
const
|
|
58299
|
-
if (
|
|
58586
|
+
const stat3 = lstatSync(aliasPath);
|
|
58587
|
+
if (stat3.isSymbolicLink()) {
|
|
58300
58588
|
const target2 = readlinkSync(aliasPath);
|
|
58301
58589
|
if (target2 === canonical)
|
|
58302
58590
|
continue;
|
|
@@ -60072,7 +60360,7 @@ import { homedir as homedir14 } from "os";
|
|
|
60072
60360
|
// src/pii/store.ts
|
|
60073
60361
|
import { chmodSync, existsSync as existsSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync7, renameSync as renameSync3, rmSync as rmSync2, statSync as statSync2, writeFileSync as writeFileSync5 } from "node:fs";
|
|
60074
60362
|
import { join as join13 } from "node:path";
|
|
60075
|
-
import { randomUUID as
|
|
60363
|
+
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
60076
60364
|
|
|
60077
60365
|
// src/pii/id-numbers.ts
|
|
60078
60366
|
var ID_NUMBERS_SOURCE = String.raw`export default (text: string) => {
|
|
@@ -61543,7 +61831,7 @@ class PiiStore {
|
|
|
61543
61831
|
}
|
|
61544
61832
|
save(botId, pipeline) {
|
|
61545
61833
|
const directory = this.directoryFor(botId);
|
|
61546
|
-
const temporary = join13(directory, `.${
|
|
61834
|
+
const temporary = join13(directory, `.${randomUUID9()}.tmp`);
|
|
61547
61835
|
try {
|
|
61548
61836
|
mkdirSync6(directory, { recursive: true, mode: 448 });
|
|
61549
61837
|
chmodSync(directory, 448);
|
|
@@ -61574,7 +61862,7 @@ class PiiStore {
|
|
|
61574
61862
|
const pipeline = { ...current, plugins: [...current.plugins] };
|
|
61575
61863
|
if (pipeline.plugins.length >= PII_MAX_PLUGINS)
|
|
61576
61864
|
throw new PiiError("PII_PLUGIN_LIMIT");
|
|
61577
|
-
pipeline.plugins.push({ id:
|
|
61865
|
+
pipeline.plugins.push({ id: randomUUID9(), name: input2.name, description: input2.description, enabled: true, source: input2.source });
|
|
61578
61866
|
pipeline.revision++;
|
|
61579
61867
|
this.save(botId, pipeline);
|
|
61580
61868
|
return this.snapshot(pipeline);
|
|
@@ -61679,8 +61967,8 @@ function createRotatingFileSink(path15, maxBytes, opts = {}) {
|
|
|
61679
61967
|
if (!existsSync8(filePath))
|
|
61680
61968
|
return true;
|
|
61681
61969
|
try {
|
|
61682
|
-
const
|
|
61683
|
-
if (!
|
|
61970
|
+
const stat3 = lstatSync2(filePath);
|
|
61971
|
+
if (!stat3.isFile()) {
|
|
61684
61972
|
if (opts.mode === undefined && !opts.hardMaxBytes)
|
|
61685
61973
|
return true;
|
|
61686
61974
|
report("unsafe_generation", new Error("log generation is not a regular file"));
|
|
@@ -61688,7 +61976,7 @@ function createRotatingFileSink(path15, maxBytes, opts = {}) {
|
|
|
61688
61976
|
}
|
|
61689
61977
|
if (opts.mode !== undefined)
|
|
61690
61978
|
chmodSync2(filePath, opts.mode);
|
|
61691
|
-
if (opts.hardMaxBytes && maxBytes > 0 &&
|
|
61979
|
+
if (opts.hardMaxBytes && maxBytes > 0 && stat3.size > maxBytes) {
|
|
61692
61980
|
try {
|
|
61693
61981
|
unlinkSync3(filePath);
|
|
61694
61982
|
} catch (error62) {
|
|
@@ -61760,10 +62048,10 @@ function createRotatingFileSink(path15, maxBytes, opts = {}) {
|
|
|
61760
62048
|
const noFollow = "O_NOFOLLOW" in constants ? constants.O_NOFOLLOW : 0;
|
|
61761
62049
|
const fd = openSync(candidate, constants.O_RDONLY | noFollow);
|
|
61762
62050
|
try {
|
|
61763
|
-
const
|
|
61764
|
-
if (!
|
|
62051
|
+
const stat3 = fstatSync(fd);
|
|
62052
|
+
if (!stat3.isFile())
|
|
61765
62053
|
throw new Error("snapshot source is not a regular file");
|
|
61766
|
-
files.push({ path: candidate, fd, size:
|
|
62054
|
+
files.push({ path: candidate, fd, size: stat3.size });
|
|
61767
62055
|
} catch (error62) {
|
|
61768
62056
|
closeSync(fd);
|
|
61769
62057
|
throw error62;
|
|
@@ -62863,7 +63151,8 @@ async function startCredentialProxy(broker, options = {}) {
|
|
|
62863
63151
|
}
|
|
62864
63152
|
};
|
|
62865
63153
|
const server = http.createServer(async (req, res) => {
|
|
62866
|
-
const
|
|
63154
|
+
const requestUrl = new URL2(req.url ?? "/", "http://placeholder");
|
|
63155
|
+
const pathname = requestUrl.pathname;
|
|
62867
63156
|
if (pathname === LOCAL_PII_PATH && (req.method === "GET" || req.method === "POST")) {
|
|
62868
63157
|
const localVerdict = broker.check(req.headers["authorization"], req.method === "GET" ? "read" : "send");
|
|
62869
63158
|
if (!localVerdict.ok) {
|
|
@@ -63096,7 +63385,8 @@ async function startCredentialProxy(broker, options = {}) {
|
|
|
63096
63385
|
res.writeHead(502, { "content-type": "application/json" });
|
|
63097
63386
|
res.end(JSON.stringify({ error: `upstream error: ${err.message}`, code: "upstream_error" }));
|
|
63098
63387
|
});
|
|
63099
|
-
const
|
|
63388
|
+
const waitingForModels = req.method === "POST" && /^\/api\/community\/machines\/[^/]+\/discover-models$/.test(pathname) && requestUrl.searchParams.get("wait") === "1";
|
|
63389
|
+
const upstreamTimeoutMs = options.upstreamTimeoutMs ?? (waitingForModels ? 55000 : DEFAULT_UPSTREAM_TIMEOUT_MS);
|
|
63100
63390
|
upstreamReq.setTimeout(upstreamTimeoutMs, () => {
|
|
63101
63391
|
upstreamReq.destroy();
|
|
63102
63392
|
upstreamRes?.destroy();
|
|
@@ -63817,10 +64107,11 @@ var MEMORY_MAINTENANCE_PROMPT = `The daemon is preparing to reset this idle sess
|
|
|
63817
64107
|
2. Facts: Verify claims, especially work progress, against the latest original records. Search the context timeline and task discussions through their latest outcomes. Correct outdated or unsupported claims; keep uncertainty explicit.
|
|
63818
64108
|
3. Learn: Use .context_timeline to find channels and threads you recently participated in. Read the full history of each recent discussion, from the initial request through the work, intermediate corrections, and any final decisions. Understand the sequence of events and why the user corrected the approach before learning first principles. Proactively record the user's guidance on communication, collaboration, and how to do work. Distill it into first principles: the underlying goals, reasons, and constraints that make the guidance reusable. Preserve its scope and source links; distinguish explicit user instructions from your own inferences. Update or remove superseded notes.
|
|
63819
64109
|
4. Durability: Keep only lasting facts, preferences, and reusable lessons or procedures. Remove task status, milestones, temporary plans, and diaries; extract a reusable lesson only when useful. Keep memory.md brief with links; put procedures, scope, and reasons in experiences. Reason from first principles: distill specific events into underlying causes, constraints, and reusable principles. Omit incidental dates and details; retain context only when it changes the principle’s validity or scope.
|
|
64110
|
+
5. Follow up: After completing the memory review and any needed edits, run \`$ALOOK_CLI message mark list\` and check each unfinished item's latest discussion. In the item's original channel, thread, or DM, send the relevant person a brief reminder of the remaining work and the next action needed. Skip items that are already complete or cancelled. Do not wait for replies.
|
|
63820
64111
|
|
|
63821
|
-
Edit only your own memory files. This review is internal maintenance; perform it silently. Do not proactively send the owner, users, or channels progress updates, completion notices, or details about your memory state. Communicate task-relevant results, questions, and blockers normally. If nothing needs a user-facing response, send no message.
|
|
64112
|
+
Edit only your own memory files. This review is internal maintenance; perform it silently. Do not proactively send the owner, users, or channels progress updates, completion notices, or details about your memory state. The task reminders in step 5 are separate from memory-maintenance updates. Communicate task-relevant results, questions, and blockers normally. If nothing needs a user-facing response, send no message.
|
|
63822
64113
|
|
|
63823
|
-
If new work arrives, handle it first and defer nap. Otherwise, after completing the review
|
|
64114
|
+
If new work arrives, handle it first and defer nap. Otherwise, after completing the review, any needed edits, and the task reminders, your final action is to run the following command without --handoff. Do not finish with only a written reply. This instruction authorizes that nap:
|
|
63824
64115
|
|
|
63825
64116
|
$ALOOK_CLI nap`;
|
|
63826
64117
|
// src/runtimeConfig.ts
|
|
@@ -63832,7 +64123,7 @@ function runtimeModelName(config2) {
|
|
|
63832
64123
|
}
|
|
63833
64124
|
// agent-driver/dist/adapters/antigravity/quota.js
|
|
63834
64125
|
import { createHash as createHash5, randomBytes as randomBytes6 } from "node:crypto";
|
|
63835
|
-
import { readFile } from "node:fs/promises";
|
|
64126
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
63836
64127
|
import { homedir as homedir11 } from "node:os";
|
|
63837
64128
|
import { isAbsolute, join as join15 } from "node:path";
|
|
63838
64129
|
var PROD = "https://cloudcode-pa.googleapis.com";
|
|
@@ -63908,7 +64199,7 @@ async function readAntigravityQuota(options = {}) {
|
|
|
63908
64199
|
const home = options.home ?? homedir11();
|
|
63909
64200
|
const configuredHome = env.GEMINI_HOME?.replace(/^~(?=[/\\]|$)/, home);
|
|
63910
64201
|
const root = configuredHome ? isAbsolute(configuredHome) ? configuredHome : join15(process.cwd(), configuredHome) : join15(home, ".gemini");
|
|
63911
|
-
const read = options.readCredentialsFile ?? ((path16) =>
|
|
64202
|
+
const read = options.readCredentialsFile ?? ((path16) => readFile2(path16, "utf8"));
|
|
63912
64203
|
let credentials = null;
|
|
63913
64204
|
let authType;
|
|
63914
64205
|
let storageUnavailable = false;
|
|
@@ -64026,7 +64317,7 @@ async function readAntigravityQuota(options = {}) {
|
|
|
64026
64317
|
|
|
64027
64318
|
// agent-driver/dist/provider-quota.js
|
|
64028
64319
|
import { execFile } from "node:child_process";
|
|
64029
|
-
import { readFile as
|
|
64320
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
64030
64321
|
import { homedir as homedir12 } from "node:os";
|
|
64031
64322
|
import { join as join16 } from "node:path";
|
|
64032
64323
|
import { promisify } from "node:util";
|
|
@@ -64058,7 +64349,7 @@ async function claudeCredentials(options) {
|
|
|
64058
64349
|
const env = options.env ?? process.env;
|
|
64059
64350
|
const root = env.CLAUDE_CONFIG_DIR || join16(options.home ?? homedir12(), ".claude");
|
|
64060
64351
|
try {
|
|
64061
|
-
const value = options.readCredentialsFile ? await options.readCredentialsFile(join16(root, ".credentials.json")) : await
|
|
64352
|
+
const value = options.readCredentialsFile ? await options.readCredentialsFile(join16(root, ".credentials.json")) : await readFile3(join16(root, ".credentials.json"), "utf8");
|
|
64062
64353
|
return parseCredentials(value);
|
|
64063
64354
|
} catch {
|
|
64064
64355
|
return null;
|
|
@@ -64256,7 +64547,7 @@ function cliCommandsSection() {
|
|
|
64256
64547
|
"",
|
|
64257
64548
|
`1. \`${CLI} platform machine --list\` — list your owner's machines.`,
|
|
64258
64549
|
`2. \`${CLI} platform machine --backends --id <machine-id>\` — read the selected online machine's backends.`,
|
|
64259
|
-
`3. \`${CLI} platform machine --models --id <machine-id> --backend <backend-id> [--model <full-model-id>] [--refresh]\` — read
|
|
64550
|
+
`3. \`${CLI} platform machine --models --id <machine-id> --backend <backend-id> [--model <full-model-id>] [--refresh]\` — read models and model-specific effort options using a five-minute server cache. A cache miss or expiry fetches fresh models and waits for the result; \`--refresh\` bypasses the cache. Failures do not return an old list. Do not poll.`,
|
|
64260
64551
|
`4. \`${CLI} platform bot --list\` — list your owner's bots.`,
|
|
64261
64552
|
`5. \`${CLI} platform bot --create '<bot-json>'\` — request new bots for your owner. Each JSON requires \`name\`, \`machineId\`, \`backendId\` and \`reason\`; optional fields are \`description\`, \`model\` and \`reasoningEffort\`. ` + `Use an online machine and its backend. The \`reason\` explains to your owner why the bot is needed and what work it will do; this text appears on the approval card. Repeat \`--create\` for up to 20 bots in one request. ` + `The command submits one approval card to the DM between you and your owner. It creates no bots until your human owner approves the request.`,
|
|
64262
64553
|
"",
|
|
@@ -64590,7 +64881,7 @@ function toLocalISO(iso) {
|
|
|
64590
64881
|
}
|
|
64591
64882
|
|
|
64592
64883
|
// src/manager/managerRuntime.ts
|
|
64593
|
-
import { randomUUID as
|
|
64884
|
+
import { randomUUID as randomUUID10 } from "node:crypto";
|
|
64594
64885
|
var SESSION_STOP_GRACE_MS2 = 2000;
|
|
64595
64886
|
function normalizeTerminationCause(value) {
|
|
64596
64887
|
return value === "runtime_error" || value === "killed_stalled" ? value : "other";
|
|
@@ -64830,7 +65121,7 @@ class AgentProcessManager {
|
|
|
64830
65121
|
shuttingDown = false;
|
|
64831
65122
|
shutdownPromise;
|
|
64832
65123
|
publishedAgentActivity = new Map;
|
|
64833
|
-
traceProcessNonce =
|
|
65124
|
+
traceProcessNonce = randomUUID10();
|
|
64834
65125
|
nextSpawnOrdinal = 1;
|
|
64835
65126
|
nextDaemonTurnOrdinal = 1;
|
|
64836
65127
|
nextDeliveryOrdinal = 1;
|
|
@@ -65139,7 +65430,7 @@ class AgentProcessManager {
|
|
|
65139
65430
|
const session2 = this.sessions.get(agentId);
|
|
65140
65431
|
if (!session2)
|
|
65141
65432
|
return;
|
|
65142
|
-
const result = await session2.interrupt({ requestId:
|
|
65433
|
+
const result = await session2.interrupt({ requestId: randomUUID10(), reason: "owner_request" });
|
|
65143
65434
|
if (result.status !== "accepted")
|
|
65144
65435
|
return;
|
|
65145
65436
|
this.log.info("agent turn interrupt accepted", {
|
|
@@ -65725,7 +66016,7 @@ ${this.opts.wakePromptFooter}` : text3;
|
|
|
65725
66016
|
if (!agent2 || agent2.sessionId !== effect.sessionId || agent2.resetting || agent2.idleSince === null)
|
|
65726
66017
|
break;
|
|
65727
66018
|
this.deliver(effect.agentId, {
|
|
65728
|
-
id: `${effect.agentId}:memory-maintenance:${
|
|
66019
|
+
id: `${effect.agentId}:memory-maintenance:${randomUUID10()}`,
|
|
65729
66020
|
text: MEMORY_MAINTENANCE_PROMPT
|
|
65730
66021
|
});
|
|
65731
66022
|
break;
|
|
@@ -66971,11 +67262,11 @@ function timelineRowHash(line) {
|
|
|
66971
67262
|
}
|
|
66972
67263
|
function timelineFileGeneration(filePath, lines) {
|
|
66973
67264
|
try {
|
|
66974
|
-
const
|
|
66975
|
-
if (!
|
|
67265
|
+
const stat3 = fs9.lstatSync(filePath, { bigint: true });
|
|
67266
|
+
if (!stat3.isFile())
|
|
66976
67267
|
return null;
|
|
66977
67268
|
const digest = createHash6("sha256");
|
|
66978
|
-
digest.update(`${
|
|
67269
|
+
digest.update(`${stat3.dev}:${stat3.ino}:${stat3.size}:${stat3.mtimeNs}:${stat3.ctimeNs}
|
|
66979
67270
|
`);
|
|
66980
67271
|
for (const line of lines)
|
|
66981
67272
|
digest.update(line.text, "utf8").update(`
|
|
@@ -67075,8 +67366,8 @@ function scanTimelineFile(filePath) {
|
|
|
67075
67366
|
let fd = null;
|
|
67076
67367
|
try {
|
|
67077
67368
|
fd = fs9.openSync(filePath, fs9.constants.O_RDONLY | (fs9.constants.O_NOFOLLOW ?? 0));
|
|
67078
|
-
const
|
|
67079
|
-
if (!
|
|
67369
|
+
const stat3 = fs9.fstatSync(fd);
|
|
67370
|
+
if (!stat3.isFile())
|
|
67080
67371
|
return null;
|
|
67081
67372
|
const chunk2 = Buffer.allocUnsafe(TIMELINE_READ_CHUNK_BYTES);
|
|
67082
67373
|
const newest = [];
|
|
@@ -67089,9 +67380,9 @@ function scanTimelineFile(filePath) {
|
|
|
67089
67380
|
let oversized = false;
|
|
67090
67381
|
let stop = false;
|
|
67091
67382
|
let discardIncompleteTail = false;
|
|
67092
|
-
if (
|
|
67383
|
+
if (stat3.size > 0) {
|
|
67093
67384
|
const last = Buffer.allocUnsafe(1);
|
|
67094
|
-
fs9.readSync(fd, last, 0, 1,
|
|
67385
|
+
fs9.readSync(fd, last, 0, 1, stat3.size - 1);
|
|
67095
67386
|
discardIncompleteTail = last[0] !== 10;
|
|
67096
67387
|
}
|
|
67097
67388
|
const resetPhysicalLine = () => {
|
|
@@ -67150,7 +67441,7 @@ function scanTimelineFile(filePath) {
|
|
|
67150
67441
|
}
|
|
67151
67442
|
resetPhysicalLine();
|
|
67152
67443
|
};
|
|
67153
|
-
let position =
|
|
67444
|
+
let position = stat3.size;
|
|
67154
67445
|
while (position > 0 && !stop) {
|
|
67155
67446
|
const start = Math.max(0, position - chunk2.length);
|
|
67156
67447
|
const requested = position - start;
|
|
@@ -67302,11 +67593,11 @@ function readResumeControlState(timelineDir) {
|
|
|
67302
67593
|
let fd = null;
|
|
67303
67594
|
try {
|
|
67304
67595
|
fd = fs9.openSync(filePath, fs9.constants.O_RDONLY | (fs9.constants.O_NOFOLLOW ?? 0));
|
|
67305
|
-
const
|
|
67306
|
-
if (!
|
|
67596
|
+
const stat3 = fs9.fstatSync(fd);
|
|
67597
|
+
if (!stat3.isFile() || stat3.size <= 0 || stat3.size > RESUME_CONTROL_MAX_BYTES) {
|
|
67307
67598
|
return { kind: "invalid" };
|
|
67308
67599
|
}
|
|
67309
|
-
const bounded = Buffer.allocUnsafe(
|
|
67600
|
+
const bounded = Buffer.allocUnsafe(stat3.size + 1);
|
|
67310
67601
|
let bytesRead = 0;
|
|
67311
67602
|
while (bytesRead < bounded.length) {
|
|
67312
67603
|
const count2 = fs9.readSync(fd, bounded, bytesRead, bounded.length - bytesRead, bytesRead);
|
|
@@ -67314,7 +67605,7 @@ function readResumeControlState(timelineDir) {
|
|
|
67314
67605
|
break;
|
|
67315
67606
|
bytesRead += count2;
|
|
67316
67607
|
}
|
|
67317
|
-
if (bytesRead !==
|
|
67608
|
+
if (bytesRead !== stat3.size)
|
|
67318
67609
|
return { kind: "invalid" };
|
|
67319
67610
|
const raw = bounded.subarray(0, bytesRead).toString("utf8");
|
|
67320
67611
|
const value = JSON.parse(raw);
|
|
@@ -68249,7 +68540,7 @@ class MessageReminderScheduler {
|
|
|
68249
68540
|
}
|
|
68250
68541
|
|
|
68251
68542
|
// src/manager/agentDriverHost.ts
|
|
68252
|
-
import { randomUUID as
|
|
68543
|
+
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
68253
68544
|
import { homedir as homedir13 } from "node:os";
|
|
68254
68545
|
import { join as join18 } from "node:path";
|
|
68255
68546
|
|
|
@@ -68405,12 +68696,12 @@ function createDaemonAgentDriverHost(ctx, onRawLine) {
|
|
|
68405
68696
|
onRawLine?.(event.text);
|
|
68406
68697
|
},
|
|
68407
68698
|
now: () => Date.now(),
|
|
68408
|
-
createId: () =>
|
|
68699
|
+
createId: () => randomUUID11()
|
|
68409
68700
|
};
|
|
68410
68701
|
}
|
|
68411
68702
|
|
|
68412
68703
|
// src/daemon/daemonSelfSleep.ts
|
|
68413
|
-
var DAEMON_SELF_SLEEP_TIMEOUT_MS =
|
|
68704
|
+
var DAEMON_SELF_SLEEP_TIMEOUT_MS = 7 * 24 * 60 * 60 * 1000;
|
|
68414
68705
|
var systemClock = {
|
|
68415
68706
|
setTimer: (callback, delayMs) => setTimeout(callback, delayMs),
|
|
68416
68707
|
clearTimer: (timer) => clearTimeout(timer)
|
|
@@ -68482,9 +68773,9 @@ class DaemonSelfSleepScheduler {
|
|
|
68482
68773
|
}
|
|
68483
68774
|
|
|
68484
68775
|
// src/telemetry/dailyTokenUsage.ts
|
|
68485
|
-
import { chmod, mkdir, open as open3, readFile as
|
|
68776
|
+
import { chmod, mkdir, open as open3, readFile as readFile4, rename, rm } from "node:fs/promises";
|
|
68486
68777
|
import { dirname as dirname6, join as join19 } from "node:path";
|
|
68487
|
-
import { randomUUID as
|
|
68778
|
+
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
68488
68779
|
var TOKEN_USAGE_WINDOW_DAYS = 30;
|
|
68489
68780
|
var TOKEN_USAGE_RECOVERY_DAYS = 2;
|
|
68490
68781
|
var TOKEN_USAGE_RETENTION_DAYS = TOKEN_USAGE_WINDOW_DAYS + TOKEN_USAGE_RECOVERY_DAYS;
|
|
@@ -68665,7 +68956,7 @@ class DailyTokenUsageStore {
|
|
|
68665
68956
|
return;
|
|
68666
68957
|
let source;
|
|
68667
68958
|
try {
|
|
68668
|
-
source = await
|
|
68959
|
+
source = await readFile4(this.filePath, "utf8");
|
|
68669
68960
|
} catch (error62) {
|
|
68670
68961
|
if (!error62 || typeof error62 !== "object" || !("code" in error62) || error62.code !== "ENOENT") {
|
|
68671
68962
|
throw error62;
|
|
@@ -68733,7 +69024,7 @@ class DailyTokenUsageStore {
|
|
|
68733
69024
|
async persist() {
|
|
68734
69025
|
const directory = dirname6(this.filePath);
|
|
68735
69026
|
await mkdir(directory, { recursive: true, mode: 448 });
|
|
68736
|
-
const temporary = `${this.filePath}.${
|
|
69027
|
+
const temporary = `${this.filePath}.${randomUUID12()}.tmp`;
|
|
68737
69028
|
try {
|
|
68738
69029
|
const file2 = await open3(temporary, "wx", 384);
|
|
68739
69030
|
try {
|
|
@@ -69790,12 +70081,12 @@ async function readPinnedJsonFile(args) {
|
|
|
69790
70081
|
}
|
|
69791
70082
|
}
|
|
69792
70083
|
fd = openSync3(args.path, constants3.O_RDONLY | noFollow);
|
|
69793
|
-
const
|
|
69794
|
-
if (!
|
|
70084
|
+
const stat3 = fstatSync3(fd);
|
|
70085
|
+
if (!stat3.isFile())
|
|
69795
70086
|
return { value: null, warnings: ["source_unavailable"] };
|
|
69796
|
-
if (
|
|
70087
|
+
if (stat3.size > args.maxBytes)
|
|
69797
70088
|
return { value: null, warnings: ["line_too_long"] };
|
|
69798
|
-
const bytes = readPinnedBytes(fd,
|
|
70089
|
+
const bytes = readPinnedBytes(fd, stat3.size);
|
|
69799
70090
|
try {
|
|
69800
70091
|
return { value: JSON.parse(bytes.toString("utf8")), warnings: [] };
|
|
69801
70092
|
} catch {
|
|
@@ -70518,8 +70809,8 @@ function createDiagnosticReportCoordinator(args) {
|
|
|
70518
70809
|
const sidecarPath = (reportId) => join20(dir, `report-${reportId}.json`);
|
|
70519
70810
|
const ensureDir = () => {
|
|
70520
70811
|
if (existsSync9(dir)) {
|
|
70521
|
-
const
|
|
70522
|
-
if (!
|
|
70812
|
+
const stat3 = lstatSync5(dir);
|
|
70813
|
+
if (!stat3.isDirectory() || stat3.isSymbolicLink())
|
|
70523
70814
|
throw new CoordinatorError("local_artifact_invalid");
|
|
70524
70815
|
if (process.platform !== "win32")
|
|
70525
70816
|
chmodSync3(dir, 448);
|
|
@@ -70534,8 +70825,8 @@ function createDiagnosticReportCoordinator(args) {
|
|
|
70534
70825
|
};
|
|
70535
70826
|
const removeExact = (path16) => {
|
|
70536
70827
|
try {
|
|
70537
|
-
const
|
|
70538
|
-
if (
|
|
70828
|
+
const stat3 = lstatSync5(path16);
|
|
70829
|
+
if (stat3.isFile() && !stat3.isSymbolicLink())
|
|
70539
70830
|
unlinkSync6(path16);
|
|
70540
70831
|
} catch {}
|
|
70541
70832
|
};
|
|
@@ -70576,8 +70867,8 @@ function createDiagnosticReportCoordinator(args) {
|
|
|
70576
70867
|
const committedArchive = (reportId) => {
|
|
70577
70868
|
const path16 = archivePath(reportId);
|
|
70578
70869
|
try {
|
|
70579
|
-
const
|
|
70580
|
-
if (!
|
|
70870
|
+
const stat3 = lstatSync5(path16);
|
|
70871
|
+
if (!stat3.isFile() || stat3.isSymbolicLink())
|
|
70581
70872
|
return null;
|
|
70582
70873
|
const bytes = readFileSync9(path16);
|
|
70583
70874
|
return { sizeBytes: bytes.byteLength, sha256: createHash8("sha256").update(bytes).digest("hex") };
|
|
@@ -70706,8 +70997,8 @@ function createDiagnosticReportCoordinator(args) {
|
|
|
70706
70997
|
const readSidecar = (reportId) => {
|
|
70707
70998
|
const path16 = sidecarPath(reportId);
|
|
70708
70999
|
try {
|
|
70709
|
-
const
|
|
70710
|
-
if (!
|
|
71000
|
+
const stat3 = lstatSync5(path16);
|
|
71001
|
+
if (!stat3.isFile() || stat3.isSymbolicLink())
|
|
70711
71002
|
return null;
|
|
70712
71003
|
return parseSidecar(JSON.parse(readFileSync9(path16, "utf8")));
|
|
70713
71004
|
} catch {
|
|
@@ -70937,8 +71228,8 @@ function tuplesEqual(value, expected) {
|
|
|
70937
71228
|
}
|
|
70938
71229
|
function readIntent(baseDir, machineId) {
|
|
70939
71230
|
const filePath = intentPath(baseDir, machineId);
|
|
70940
|
-
const
|
|
70941
|
-
if (!
|
|
71231
|
+
const stat3 = fs10.lstatSync(filePath);
|
|
71232
|
+
if (!stat3.isFile())
|
|
70942
71233
|
throw new Error("unsafe daemon update intent type");
|
|
70943
71234
|
fs10.chmodSync(filePath, 384);
|
|
70944
71235
|
const value = JSON.parse(fs10.readFileSync(filePath, "utf8"));
|
|
@@ -71035,10 +71326,10 @@ function readTestPackageMap(baseDir, machineId) {
|
|
|
71035
71326
|
const filePath = updatePackageMapPath(baseDir, machineId);
|
|
71036
71327
|
if (!fs10.existsSync(filePath))
|
|
71037
71328
|
return null;
|
|
71038
|
-
const
|
|
71039
|
-
if (!
|
|
71329
|
+
const stat3 = fs10.lstatSync(filePath);
|
|
71330
|
+
if (!stat3.isFile())
|
|
71040
71331
|
throw new Error("unsafe daemon update package map type");
|
|
71041
|
-
if (process.platform !== "win32" && (
|
|
71332
|
+
if (process.platform !== "win32" && (stat3.mode & 63) !== 0) {
|
|
71042
71333
|
throw new Error("daemon update package map must be mode 0600");
|
|
71043
71334
|
}
|
|
71044
71335
|
const parsed = JSON.parse(fs10.readFileSync(filePath, "utf8"));
|
|
@@ -71734,8 +72025,8 @@ function writePrivateJsonAtomic2(filePath, value) {
|
|
|
71734
72025
|
function secureExistingFile(filePath) {
|
|
71735
72026
|
if (!fs12.existsSync(filePath))
|
|
71736
72027
|
return;
|
|
71737
|
-
const
|
|
71738
|
-
if (!
|
|
72028
|
+
const stat3 = fs12.lstatSync(filePath);
|
|
72029
|
+
if (!stat3.isFile())
|
|
71739
72030
|
throw new Error("unsafe daemon ownership file type");
|
|
71740
72031
|
fs12.chmodSync(filePath, 384);
|
|
71741
72032
|
}
|
|
@@ -71803,8 +72094,8 @@ function readReplacementLock(filePath) {
|
|
|
71803
72094
|
if (!fs12.existsSync(filePath))
|
|
71804
72095
|
return null;
|
|
71805
72096
|
try {
|
|
71806
|
-
const
|
|
71807
|
-
if (!
|
|
72097
|
+
const stat3 = fs12.lstatSync(filePath);
|
|
72098
|
+
if (!stat3.isFile())
|
|
71808
72099
|
throw new Error("unsafe daemon replacement lock type");
|
|
71809
72100
|
fs12.chmodSync(filePath, 384);
|
|
71810
72101
|
const content = JSON.parse(fs12.readFileSync(filePath, "utf8"));
|
|
@@ -72108,8 +72399,8 @@ function credentialFilePathByMachineId(baseDir, machineId) {
|
|
|
72108
72399
|
function readCredentialFile(filePath) {
|
|
72109
72400
|
if (!fs12.existsSync(filePath))
|
|
72110
72401
|
return null;
|
|
72111
|
-
const
|
|
72112
|
-
if (!
|
|
72402
|
+
const stat3 = fs12.lstatSync(filePath);
|
|
72403
|
+
if (!stat3.isFile())
|
|
72113
72404
|
throw new Error("unsafe daemon credential file type");
|
|
72114
72405
|
fs12.chmodSync(filePath, 384);
|
|
72115
72406
|
try {
|
|
@@ -72931,7 +73222,7 @@ ${MESSAGE_SEND_STDIN_POLICY}`);
|
|
|
72931
73222
|
}
|
|
72932
73223
|
replyToSeq = n;
|
|
72933
73224
|
}
|
|
72934
|
-
const nonce =
|
|
73225
|
+
const nonce = randomUUID15();
|
|
72935
73226
|
let res;
|
|
72936
73227
|
try {
|
|
72937
73228
|
res = await sendWithRetry(api2, {
|
|
@@ -73324,6 +73615,7 @@ function buildProgram(stdin) {
|
|
|
73324
73615
|
writeErr: () => {}
|
|
73325
73616
|
}).option("--agent <id>", "agent identity (or ALOOK_AGENT_ID env)");
|
|
73326
73617
|
registerPlatformCommands(program, getApi, printEnvelope);
|
|
73618
|
+
registerUseCommands(program, printEnvelope);
|
|
73327
73619
|
registerPiiCommands(program, printEnvelope);
|
|
73328
73620
|
const message2 = program.command("message").description("message operations").exitOverride();
|
|
73329
73621
|
message2.configureOutput({ writeOut: () => {}, writeErr: () => {} });
|