@alook/daemon 0.1.61 → 0.1.63

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 CHANGED
@@ -11727,7 +11727,7 @@ var require_JSXTransformer = __commonJS((exports) => {
11727
11727
  }
11728
11728
  exports.startsWithLowerCase = startsWithLowerCase;
11729
11729
  function formatJSXTextLiteral(text3) {
11730
- let result = "";
11730
+ let result2 = "";
11731
11731
  let whitespace = "";
11732
11732
  let isInInitialLineWhitespace = false;
11733
11733
  let seenNonWhitespace = false;
@@ -11743,25 +11743,25 @@ var require_JSXTransformer = __commonJS((exports) => {
11743
11743
  isInInitialLineWhitespace = true;
11744
11744
  } else {
11745
11745
  if (seenNonWhitespace && isInInitialLineWhitespace) {
11746
- result += " ";
11746
+ result2 += " ";
11747
11747
  }
11748
- result += whitespace;
11748
+ result2 += whitespace;
11749
11749
  whitespace = "";
11750
11750
  if (c === "&") {
11751
11751
  const { entity, newI } = processEntity(text3, i + 1);
11752
11752
  i = newI - 1;
11753
- result += entity;
11753
+ result2 += entity;
11754
11754
  } else {
11755
- result += c;
11755
+ result2 += c;
11756
11756
  }
11757
11757
  seenNonWhitespace = true;
11758
11758
  isInInitialLineWhitespace = false;
11759
11759
  }
11760
11760
  }
11761
11761
  if (!isInInitialLineWhitespace) {
11762
- result += whitespace;
11762
+ result2 += whitespace;
11763
11763
  }
11764
- return JSON.stringify(result);
11764
+ return JSON.stringify(result2);
11765
11765
  }
11766
11766
  function formatJSXTextReplacement(text3) {
11767
11767
  let numNewlines = 0;
@@ -11779,29 +11779,29 @@ var require_JSXTransformer = __commonJS((exports) => {
11779
11779
  `.repeat(numNewlines) + " ".repeat(numSpaces);
11780
11780
  }
11781
11781
  function formatJSXStringValueLiteral(text3) {
11782
- let result = "";
11782
+ let result2 = "";
11783
11783
  for (let i = 0;i < text3.length; i++) {
11784
11784
  const c = text3[i];
11785
11785
  if (c === `
11786
11786
  `) {
11787
11787
  if (/\s/.test(text3[i + 1])) {
11788
- result += " ";
11788
+ result2 += " ";
11789
11789
  while (i < text3.length && /\s/.test(text3[i + 1])) {
11790
11790
  i++;
11791
11791
  }
11792
11792
  } else {
11793
- result += `
11793
+ result2 += `
11794
11794
  `;
11795
11795
  }
11796
11796
  } else if (c === "&") {
11797
11797
  const { entity, newI } = processEntity(text3, i + 1);
11798
- result += entity;
11798
+ result2 += entity;
11799
11799
  i = newI - 1;
11800
11800
  } else {
11801
- result += c;
11801
+ result2 += c;
11802
11802
  }
11803
11803
  }
11804
- return JSON.stringify(result);
11804
+ return JSON.stringify(result2);
11805
11805
  }
11806
11806
  function processEntity(text3, indexAfterAmpersand) {
11807
11807
  let str = "";
@@ -12047,9 +12047,9 @@ var require_CJSImportProcessor = __commonJS((exports) => {
12047
12047
  index2++;
12048
12048
  }
12049
12049
  if (this.tokens.matches1AtIndex(index2, _types.TokenType.braceL)) {
12050
- const result = this.getNamedImports(index2 + 1);
12051
- index2 = result.newIndex;
12052
- for (const namedImport of result.namedImports) {
12050
+ const result2 = this.getNamedImports(index2 + 1);
12051
+ index2 = result2.newIndex;
12052
+ for (const namedImport of result2.namedImports) {
12053
12053
  if (namedImport.importedName === "default") {
12054
12054
  defaultNames.push(namedImport.localName);
12055
12055
  } else {
@@ -12203,9 +12203,9 @@ var require_CJSImportProcessor = __commonJS((exports) => {
12203
12203
  this.exportBindingsByLocalName.get(localName).push(exportedName);
12204
12204
  }
12205
12205
  claimImportCode(importPath) {
12206
- const result = this.importsToReplace.get(importPath);
12206
+ const result2 = this.importsToReplace.get(importPath);
12207
12207
  this.importsToReplace.set(importPath, "");
12208
- return result || "";
12208
+ return result2 || "";
12209
12209
  }
12210
12210
  getIdentifierReplacement(identifierName) {
12211
12211
  return this.identifierReplacements.get(identifierName) || null;
@@ -13404,12 +13404,12 @@ var require_trace_mapping_umd = __commonJS((exports, module) => {
13404
13404
  if (!found)
13405
13405
  min = lowerBound(segments, matchedColumn, min);
13406
13406
  const max = upperBound(segments, matchedColumn, min);
13407
- const result = [];
13407
+ const result2 = [];
13408
13408
  for (;min <= max; min++) {
13409
13409
  const segment = segments[min];
13410
- result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]));
13410
+ result2.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]));
13411
13411
  }
13412
- return result;
13412
+ return result2;
13413
13413
  }
13414
13414
  function generatedPosition(map2, source, line, column, bias, all) {
13415
13415
  var _a3, _b;
@@ -14654,10 +14654,10 @@ var require_types2 = __commonJS((exports) => {
14654
14654
  exports.func = func;
14655
14655
  var TFunc = function(_super) {
14656
14656
  __extends(TFunc2, _super);
14657
- function TFunc2(paramList, result) {
14657
+ function TFunc2(paramList, result2) {
14658
14658
  var _this = _super.call(this) || this;
14659
14659
  _this.paramList = paramList;
14660
- _this.result = result;
14660
+ _this.result = result2;
14661
14661
  return _this;
14662
14662
  }
14663
14663
  TFunc2.prototype.getChecker = function(suite, strict) {
@@ -19393,11 +19393,11 @@ var require_parser = __commonJS((exports) => {
19393
19393
  throw new Error("Cannot combine flow and typescript plugins.");
19394
19394
  }
19395
19395
  _base.initParser.call(undefined, input2, isJSXEnabled, isTypeScriptEnabled, isFlowEnabled);
19396
- const result = _index.parseFile.call(undefined);
19396
+ const result2 = _index.parseFile.call(undefined);
19397
19397
  if (_base.state.error) {
19398
19398
  throw _base.augmentError.call(undefined, _base.state.error);
19399
19399
  }
19400
- return result;
19400
+ return result2;
19401
19401
  }
19402
19402
  exports.parse = parse6;
19403
19403
  });
@@ -19471,9 +19471,9 @@ var require_TokenProcessor = __commonJS((exports) => {
19471
19471
  this.tokenIndex = snapshot.tokenIndex;
19472
19472
  }
19473
19473
  dangerouslyGetAndRemoveCodeSinceSnapshot(snapshot) {
19474
- const result = this.resultCode.slice(snapshot.resultCode.length);
19474
+ const result2 = this.resultCode.slice(snapshot.resultCode.length);
19475
19475
  this.resultCode = snapshot.resultCode;
19476
- return result;
19476
+ return result2;
19477
19477
  }
19478
19478
  reset() {
19479
19479
  this.resultCode = "";
@@ -21818,8 +21818,8 @@ var require_RootTransformer = __commonJS((exports) => {
21818
21818
  for (const transformer of this.transformers) {
21819
21819
  suffix += transformer.getSuffixCode();
21820
21820
  }
21821
- const result = this.tokens.finish();
21822
- let { code } = result;
21821
+ const result2 = this.tokens.finish();
21822
+ let { code } = result2;
21823
21823
  if (code.startsWith("#!")) {
21824
21824
  let newlineIndex = code.indexOf(`
21825
21825
  `);
@@ -21830,12 +21830,12 @@ var require_RootTransformer = __commonJS((exports) => {
21830
21830
  }
21831
21831
  return {
21832
21832
  code: code.slice(0, newlineIndex + 1) + prefix + code.slice(newlineIndex + 1) + suffix,
21833
- mappings: this.shiftMappings(result.mappings, prefix.length)
21833
+ mappings: this.shiftMappings(result2.mappings, prefix.length)
21834
21834
  };
21835
21835
  } else {
21836
21836
  return {
21837
21837
  code: prefix + code + suffix,
21838
- mappings: this.shiftMappings(result.mappings, prefix.length)
21838
+ mappings: this.shiftMappings(result2.mappings, prefix.length)
21839
21839
  };
21840
21840
  }
21841
21841
  }
@@ -22278,17 +22278,17 @@ var require_dist2 = __commonJS((exports) => {
22278
22278
  const sucraseContext = getSucraseContext(code, options);
22279
22279
  const transformer = new (0, _RootTransformer2.default)(sucraseContext, options.transforms, Boolean(options.enableLegacyBabel5ModuleInterop), options);
22280
22280
  const transformerResult = transformer.transform();
22281
- let result = { code: transformerResult.code };
22281
+ let result2 = { code: transformerResult.code };
22282
22282
  if (options.sourceMapOptions) {
22283
22283
  if (!options.filePath) {
22284
22284
  throw new Error("filePath must be specified when generating a source map.");
22285
22285
  }
22286
- result = {
22287
- ...result,
22286
+ result2 = {
22287
+ ...result2,
22288
22288
  sourceMap: _computeSourceMap2.default.call(undefined, transformerResult, options.filePath, options.sourceMapOptions, code, sucraseContext.tokenProcessor.tokens)
22289
22289
  };
22290
22290
  }
22291
- return result;
22291
+ return result2;
22292
22292
  } catch (e) {
22293
22293
  if (options.filePath) {
22294
22294
  e.message = `Error transforming ${options.filePath}: ${e.message}`;
@@ -54704,6 +54704,122 @@ function bigint3(params) {
54704
54704
  function date4(params) {
54705
54705
  return _coercedDate(ZodDate, params);
54706
54706
  }
54707
+ // ../shared/src/constants/community.ts
54708
+ var MAX_FOLDER_NAME_LENGTH = 100;
54709
+ var MAX_PROFILE_NAME_LENGTH = 100;
54710
+ var MAX_PROFILE_ABOUT_LENGTH = 1000;
54711
+ var MAX_MESSAGE_CONTENT_LENGTH = 4000;
54712
+ var MAX_ATTACHMENTS_PER_MESSAGE = 10;
54713
+ var MAX_ATTACHMENT_SIZE_BYTES = 25 * 1024 * 1024;
54714
+ var MAX_ATTACHMENT_THUMBNAIL_SIZE_BYTES = 256 * 1024;
54715
+ var MAX_SERVER_ICON_SIZE_BYTES = 5 * 1024 * 1024;
54716
+ var ALLOWED_ICON_MIME_TYPES = [
54717
+ "image/png",
54718
+ "image/jpeg",
54719
+ "image/webp",
54720
+ "image/gif"
54721
+ ];
54722
+ var MAX_ICON_SOURCE_FILE_SIZE_BYTES = 15 * 1024 * 1024;
54723
+ var PARTICIPANT_SOURCE = {
54724
+ MENTION: "mention",
54725
+ SPOKE: "spoke",
54726
+ ADDED: "added"
54727
+ };
54728
+
54729
+ // ../shared/src/lib/discriminator.ts
54730
+ function parseNameAndTag(q) {
54731
+ const m = /^(.+)#(\d{4,})$/.exec(q);
54732
+ if (!m)
54733
+ return null;
54734
+ const name = m[1].trim();
54735
+ const discriminator = m[2];
54736
+ if (!name)
54737
+ return null;
54738
+ return { name, discriminator };
54739
+ }
54740
+ function formatHandle(name, discriminator) {
54741
+ return `${name}#${discriminator}`;
54742
+ }
54743
+
54744
+ // ../shared/src/pii-contract.ts
54745
+ var PII_CAPABILITY = "pii-v1";
54746
+ var PII_MAX_PLUGINS = 32;
54747
+ var PII_SOURCE_MAX_BYTES = 16 * 1024;
54748
+ var PII_TEXT_MAX_BYTES = 1024;
54749
+ var PII_REQUEST_MAX_BYTES = 8 * 1024;
54750
+ 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);
54751
+ var PiiPluginSchema = exports_external.strictObject({
54752
+ id: exports_external.string().min(1).max(128),
54753
+ name: exports_external.string().trim().min(1).max(80),
54754
+ description: exports_external.string().trim().min(1).max(256),
54755
+ enabled: exports_external.boolean()
54756
+ });
54757
+ var PiiSnapshotSchema = exports_external.strictObject({
54758
+ revision: exports_external.number().int().nonnegative(),
54759
+ plugins: exports_external.array(PiiPluginSchema).max(PII_MAX_PLUGINS)
54760
+ });
54761
+ var pluginId = exports_external.string().min(1).max(128);
54762
+ var expectedRevision = exports_external.number().int().nonnegative();
54763
+ var PiiOperationSchema = exports_external.discriminatedUnion("action", [
54764
+ exports_external.strictObject({ action: exports_external.literal("list") }),
54765
+ exports_external.strictObject({ action: exports_external.literal("setEnabled"), pluginId, enabled: exports_external.boolean(), expectedRevision }),
54766
+ exports_external.strictObject({ action: exports_external.literal("remove"), pluginId, expectedRevision }),
54767
+ exports_external.strictObject({ action: exports_external.literal("preview"), text: PiiPreviewTextSchema, expectedRevision })
54768
+ ]);
54769
+ var PiiRequestSchema = exports_external.strictObject({
54770
+ requestId: exports_external.string().min(1).max(128),
54771
+ operation: PiiOperationSchema
54772
+ });
54773
+ var PiiCommandSchema = PiiRequestSchema.extend({
54774
+ type: exports_external.literal("pii:manage"),
54775
+ botId: exports_external.string().min(1).max(128)
54776
+ });
54777
+ var PiiErrorCodeSchema = exports_external.enum([
54778
+ "PII_CONFLICT",
54779
+ "PII_UNAVAILABLE",
54780
+ "PII_PLUGIN_NOT_FOUND",
54781
+ "PII_BOT_NOT_FOUND",
54782
+ "PII_PLUGIN_FAILED",
54783
+ "PII_PLUGIN_TIMEOUT",
54784
+ "PII_INVALID_RESULT",
54785
+ "PII_OUTPUT_TOO_LARGE",
54786
+ "PII_INVALID_SOURCE",
54787
+ "PII_CONFIG_UNAVAILABLE",
54788
+ "PII_SOURCE_TOO_LARGE",
54789
+ "PII_INVALID_REQUEST"
54790
+ ]);
54791
+ var PiiResultSchema = exports_external.discriminatedUnion("status", [
54792
+ 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() }),
54793
+ exports_external.strictObject({
54794
+ status: exports_external.literal("error"),
54795
+ code: PiiErrorCodeSchema,
54796
+ pluginId: pluginId.optional(),
54797
+ snapshot: PiiSnapshotSchema.optional()
54798
+ })
54799
+ ]);
54800
+ var PiiResultFrameSchema = exports_external.strictObject({
54801
+ type: exports_external.literal("pii_result"),
54802
+ botId: exports_external.string().min(1).max(128),
54803
+ requestId: exports_external.string().min(1).max(128),
54804
+ result: PiiResultSchema
54805
+ });
54806
+ var PiiLocalRequestSchema = exports_external.discriminatedUnion("action", [
54807
+ exports_external.strictObject({ action: exports_external.literal("list") }),
54808
+ exports_external.strictObject({
54809
+ action: exports_external.literal("add"),
54810
+ name: PiiPluginSchema.shape.name,
54811
+ description: PiiPluginSchema.shape.description,
54812
+ source: exports_external.string().min(1).max(PII_SOURCE_MAX_BYTES)
54813
+ })
54814
+ ]);
54815
+
54816
+ // ../shared/src/utils/community-roles.ts
54817
+ var ROLES = {
54818
+ OWNER: "owner",
54819
+ ADMIN: "admin",
54820
+ MEMBER: "member"
54821
+ };
54822
+
54707
54823
  // ../shared/src/db/community-machine-schema.ts
54708
54824
  var exports_community_machine_schema = {};
54709
54825
  __export(exports_community_machine_schema, {
@@ -57190,62 +57306,6 @@ var OwnerDiagnosticReportSchema = exports_external.discriminatedUnion("status",
57190
57306
  objectExpired: exports_external.literal(false)
57191
57307
  }).strict()
57192
57308
  ]);
57193
- // ../shared/src/community-profile-resource.ts
57194
- var CommunityResourceProfileSchema = exports_external.strictObject({
57195
- id: exports_external.string().min(1),
57196
- name: exports_external.string(),
57197
- discriminator: exports_external.string().min(1),
57198
- avatar: exports_external.string().nullable(),
57199
- avatarVersion: exports_external.number().int().nonnegative(),
57200
- aboutMe: exports_external.string().optional(),
57201
- bannerColor: exports_external.string().nullable().optional(),
57202
- kind: exports_external.enum(["human", "bot"]).optional(),
57203
- ownerUserId: exports_external.string().min(1).nullable().optional(),
57204
- ownerHandle: exports_external.string().nullable().optional(),
57205
- mutualServers: exports_external.number().int().nonnegative().optional(),
57206
- ownedByViewer: exports_external.boolean().optional(),
57207
- statusEmoji: exports_external.string().nullable().optional(),
57208
- statusText: exports_external.string().nullable().optional()
57209
- });
57210
- // ../shared/src/business-schema-version.ts
57211
- var BUSINESS_SCHEMA_VERSION = 7;
57212
-
57213
- // ../shared/src/community-contract.ts
57214
- var COMMUNITY_RESOURCE_CONTRACT_VERSION = BUSINESS_SCHEMA_VERSION;
57215
-
57216
- // ../shared/src/community-friend-approval.ts
57217
- var identity = CommunityResourceProfileSchema.pick({ id: true, name: true, discriminator: true, avatarVersion: true });
57218
- var profile = identity.extend({ image: CommunityResourceProfileSchema.shape.avatar });
57219
- var FriendApprovalPayloadSchema = exports_external.strictObject({
57220
- friendshipId: exports_external.string(),
57221
- status: exports_external.enum(["pending", "approved", "denied", "superseded", "cancelled"]),
57222
- waitingOn: exports_external.enum(["you", "other-owner", "addressee"]).nullable(),
57223
- otherProfile: profile,
57224
- botProfile: profile,
57225
- waitingOnProfile: profile.nullable().optional()
57226
- });
57227
-
57228
- // ../shared/src/constants/community.ts
57229
- var MAX_FOLDER_NAME_LENGTH = 100;
57230
- var MAX_PROFILE_NAME_LENGTH = 100;
57231
- var MAX_PROFILE_ABOUT_LENGTH = 1000;
57232
- var MAX_MESSAGE_CONTENT_LENGTH = 4000;
57233
- var MAX_ATTACHMENTS_PER_MESSAGE = 10;
57234
- var MAX_ATTACHMENT_SIZE_BYTES = 25 * 1024 * 1024;
57235
- var MAX_ATTACHMENT_THUMBNAIL_SIZE_BYTES = 256 * 1024;
57236
- var MAX_SERVER_ICON_SIZE_BYTES = 5 * 1024 * 1024;
57237
- var ALLOWED_ICON_MIME_TYPES = [
57238
- "image/png",
57239
- "image/jpeg",
57240
- "image/webp",
57241
- "image/gif"
57242
- ];
57243
- var MAX_ICON_SOURCE_FILE_SIZE_BYTES = 15 * 1024 * 1024;
57244
- var PARTICIPANT_SOURCE = {
57245
- MENTION: "mention",
57246
- SPOKE: "spoke",
57247
- ADDED: "added"
57248
- };
57249
57309
 
57250
57310
  // ../shared/src/runtime-models-contract.ts
57251
57311
  var RUNTIME_MODEL_DISCOVERY_CAPABILITY = "runtime-model-discovery-v1";
@@ -57262,107 +57322,6 @@ var RuntimeModelDiscoveryErrorSchema = exports_external.strictObject({
57262
57322
  message: exports_external.string().min(1).max(256)
57263
57323
  });
57264
57324
 
57265
- // ../shared/src/utils/slug.ts
57266
- init_nanoid();
57267
- var slugId = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz");
57268
- function sanitizeSlug(input2) {
57269
- return input2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60).replace(/-+$/g, "");
57270
- }
57271
-
57272
- // ../shared/src/pii-contract.ts
57273
- var PII_CAPABILITY = "pii-v1";
57274
- var PII_MAX_PLUGINS = 32;
57275
- var PII_SOURCE_MAX_BYTES = 16 * 1024;
57276
- var PII_TEXT_MAX_BYTES = 1024;
57277
- var PII_REQUEST_MAX_BYTES = 8 * 1024;
57278
- var PiiPreviewTextSchema = exports_external.string().max(PII_TEXT_MAX_BYTES).refine((text3) => new TextEncoder().encode(text3).byteLength <= PII_TEXT_MAX_BYTES).refine((text3) => text3.trim().length > 0);
57279
- var PiiPluginSchema = exports_external.strictObject({
57280
- id: exports_external.string().min(1).max(128),
57281
- name: exports_external.string().trim().min(1).max(80),
57282
- description: exports_external.string().trim().min(1).max(256),
57283
- enabled: exports_external.boolean()
57284
- });
57285
- var PiiSnapshotSchema = exports_external.strictObject({
57286
- revision: exports_external.number().int().nonnegative(),
57287
- plugins: exports_external.array(PiiPluginSchema).max(PII_MAX_PLUGINS)
57288
- });
57289
- var pluginId = exports_external.string().min(1).max(128);
57290
- var expectedRevision = exports_external.number().int().nonnegative();
57291
- var PiiOperationSchema = exports_external.discriminatedUnion("action", [
57292
- exports_external.strictObject({ action: exports_external.literal("list") }),
57293
- exports_external.strictObject({ action: exports_external.literal("setEnabled"), pluginId, enabled: exports_external.boolean(), expectedRevision }),
57294
- exports_external.strictObject({ action: exports_external.literal("remove"), pluginId, expectedRevision }),
57295
- exports_external.strictObject({ action: exports_external.literal("preview"), text: PiiPreviewTextSchema, expectedRevision })
57296
- ]);
57297
- var PiiRequestSchema = exports_external.strictObject({
57298
- requestId: exports_external.string().min(1).max(128),
57299
- operation: PiiOperationSchema
57300
- });
57301
- var PiiCommandSchema = PiiRequestSchema.extend({
57302
- type: exports_external.literal("pii:manage"),
57303
- botId: exports_external.string().min(1).max(128)
57304
- });
57305
- var PiiErrorCodeSchema = exports_external.enum([
57306
- "PII_CONFLICT",
57307
- "PII_UNAVAILABLE",
57308
- "PII_PLUGIN_NOT_FOUND",
57309
- "PII_BOT_NOT_FOUND",
57310
- "PII_PLUGIN_FAILED",
57311
- "PII_PLUGIN_TIMEOUT",
57312
- "PII_INVALID_RESULT",
57313
- "PII_OUTPUT_TOO_LARGE",
57314
- "PII_INVALID_SOURCE",
57315
- "PII_CONFIG_UNAVAILABLE",
57316
- "PII_SOURCE_TOO_LARGE",
57317
- "PII_INVALID_REQUEST"
57318
- ]);
57319
- var PiiResultSchema = exports_external.discriminatedUnion("status", [
57320
- 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() }),
57321
- exports_external.strictObject({
57322
- status: exports_external.literal("error"),
57323
- code: PiiErrorCodeSchema,
57324
- pluginId: pluginId.optional(),
57325
- snapshot: PiiSnapshotSchema.optional()
57326
- })
57327
- ]);
57328
- var PiiResultFrameSchema = exports_external.strictObject({
57329
- type: exports_external.literal("pii_result"),
57330
- botId: exports_external.string().min(1).max(128),
57331
- requestId: exports_external.string().min(1).max(128),
57332
- result: PiiResultSchema
57333
- });
57334
- var PiiLocalRequestSchema = exports_external.discriminatedUnion("action", [
57335
- exports_external.strictObject({ action: exports_external.literal("list") }),
57336
- exports_external.strictObject({
57337
- action: exports_external.literal("add"),
57338
- name: PiiPluginSchema.shape.name,
57339
- description: PiiPluginSchema.shape.description,
57340
- source: exports_external.string().min(1).max(PII_SOURCE_MAX_BYTES)
57341
- })
57342
- ]);
57343
-
57344
- // ../shared/src/utils/community-roles.ts
57345
- var ROLES = {
57346
- OWNER: "owner",
57347
- ADMIN: "admin",
57348
- MEMBER: "member"
57349
- };
57350
-
57351
- // ../shared/src/lib/discriminator.ts
57352
- function parseNameAndTag(q) {
57353
- const m = /^(.+)#(\d{4,})$/.exec(q);
57354
- if (!m)
57355
- return null;
57356
- const name = m[1].trim();
57357
- const discriminator = m[2];
57358
- if (!name)
57359
- return null;
57360
- return { name, discriminator };
57361
- }
57362
- function formatHandle(name, discriminator) {
57363
- return `${name}#${discriminator}`;
57364
- }
57365
-
57366
57325
  // ../shared/src/community-cli-contract.ts
57367
57326
  var AGENT_EVENT_PROMPT_MAX_LENGTH = 32768;
57368
57327
  var DM_SERVER = ".dm";
@@ -57538,6 +57497,91 @@ var HostCommandSchema = exports_external.discriminatedUnion("type", [
57538
57497
  DiagnosticCollectCommandSchema
57539
57498
  ]);
57540
57499
 
57500
+ // ../shared/src/automation.ts
57501
+ var AUTOMATION_WRITE_PERMISSIONS = ["bot.create", "server.create", "server.invite", "message.send"];
57502
+ var AUTOMATION_READ_PERMISSIONS = ["machine.read", "friend.read", "server.read"];
57503
+ var AutomationPermissionSchema = exports_external.enum([...AUTOMATION_WRITE_PERMISSIONS, ...AUTOMATION_READ_PERMISSIONS]);
57504
+ var AutomationExpirySchema = exports_external.enum(["1h", "24h", "7d", "30d", "forever"]);
57505
+ var AutomationPermissionPolicySchema = exports_external.strictObject({
57506
+ permission: AutomationPermissionSchema,
57507
+ limit: exports_external.number().int().positive(),
57508
+ period: exports_external.enum(["hour", "day"])
57509
+ }).refine((value) => value.limit <= (value.period === "hour" ? 64 : 1536), {
57510
+ message: "Limit cannot exceed 64/hour or 1536/day",
57511
+ path: ["limit"]
57512
+ });
57513
+ 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");
57514
+ var AutomationAccessCodeCreateSchema = exports_external.strictObject({
57515
+ name: exports_external.string().trim().min(1).max(100),
57516
+ expiresIn: AutomationExpirySchema.default("24h"),
57517
+ permissions
57518
+ });
57519
+ var AutomationAccessCodeUpdateSchema = exports_external.strictObject({
57520
+ name: exports_external.string().trim().min(1).max(100).optional(),
57521
+ expiresIn: AutomationExpirySchema.optional(),
57522
+ permissions: permissions.optional()
57523
+ }).refine((value) => Object.keys(value).length > 0, "Provide at least one change");
57524
+ var AutomationMessageSendSchema = exports_external.strictObject({
57525
+ target: exports_external.string().min(1).max(1024).refine((value) => {
57526
+ try {
57527
+ parseRef(value);
57528
+ return true;
57529
+ } catch {
57530
+ return false;
57531
+ }
57532
+ }, "Use a channel or DM ref"),
57533
+ as: exports_external.string().max(128).refine((value) => value === "me" || value.startsWith("@") && Boolean(parseNameAndTag(value.slice(1))), "Use me or @name#NNNN"),
57534
+ content: exports_external.string().max(MAX_MESSAGE_CONTENT_LENGTH).refine((value) => value.trim().length > 0, "Message content is required"),
57535
+ nonce: exports_external.string().min(1).max(128)
57536
+ });
57537
+ var AutomationMessageSentSchema = exports_external.object({
57538
+ state: exports_external.literal("sent"),
57539
+ seq: exports_external.string().regex(/^#[1-9]\d*$/),
57540
+ deduped: exports_external.boolean(),
57541
+ threadId: exports_external.string().optional()
57542
+ });
57543
+ // ../shared/src/community-profile-resource.ts
57544
+ var CommunityResourceProfileSchema = exports_external.strictObject({
57545
+ id: exports_external.string().min(1),
57546
+ name: exports_external.string(),
57547
+ discriminator: exports_external.string().min(1),
57548
+ avatar: exports_external.string().nullable(),
57549
+ avatarVersion: exports_external.number().int().nonnegative(),
57550
+ aboutMe: exports_external.string().optional(),
57551
+ bannerColor: exports_external.string().nullable().optional(),
57552
+ kind: exports_external.enum(["human", "bot"]).optional(),
57553
+ ownerUserId: exports_external.string().min(1).nullable().optional(),
57554
+ ownerHandle: exports_external.string().nullable().optional(),
57555
+ mutualServers: exports_external.number().int().nonnegative().optional(),
57556
+ ownedByViewer: exports_external.boolean().optional(),
57557
+ statusEmoji: exports_external.string().nullable().optional(),
57558
+ statusText: exports_external.string().nullable().optional()
57559
+ });
57560
+ // ../shared/src/business-schema-version.ts
57561
+ var BUSINESS_SCHEMA_VERSION = 8;
57562
+
57563
+ // ../shared/src/community-contract.ts
57564
+ var COMMUNITY_RESOURCE_CONTRACT_VERSION = BUSINESS_SCHEMA_VERSION;
57565
+
57566
+ // ../shared/src/community-friend-approval.ts
57567
+ var identity = CommunityResourceProfileSchema.pick({ id: true, name: true, discriminator: true, avatarVersion: true });
57568
+ var profile = identity.extend({ image: CommunityResourceProfileSchema.shape.avatar });
57569
+ var FriendApprovalPayloadSchema = exports_external.strictObject({
57570
+ friendshipId: exports_external.string(),
57571
+ status: exports_external.enum(["pending", "approved", "denied", "superseded", "cancelled"]),
57572
+ waitingOn: exports_external.enum(["you", "other-owner", "addressee"]).nullable(),
57573
+ otherProfile: profile,
57574
+ botProfile: profile,
57575
+ waitingOnProfile: profile.nullable().optional()
57576
+ });
57577
+
57578
+ // ../shared/src/utils/slug.ts
57579
+ init_nanoid();
57580
+ var slugId = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz");
57581
+ function sanitizeSlug(input2) {
57582
+ return input2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60).replace(/-+$/g, "");
57583
+ }
57584
+
57541
57585
  // ../shared/src/provider-telemetry.ts
57542
57586
  var DAILY_TOKEN_USAGE_WINDOW_DAYS = 30;
57543
57587
  var safeToken = exports_external.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
@@ -57751,15 +57795,6 @@ var PollResponseSchema = exports_external.object({
57751
57795
  file_requests: exports_external.array(FileRequestItemSchema).optional(),
57752
57796
  meetings: exports_external.array(PollMeetingItemSchema).optional()
57753
57797
  });
57754
- var DaemonPushMessageSchema = exports_external.discriminatedUnion("type", [
57755
- exports_external.object({ type: exports_external.literal("daemon.tasks"), tasks: exports_external.array(TaskApiSchema) }),
57756
- exports_external.object({ type: exports_external.literal("daemon.file_requests"), workspaceId: exports_external.string(), requests: exports_external.array(FileRequestItemSchema) }),
57757
- exports_external.object({ type: exports_external.literal("daemon.meetings"), meetings: exports_external.array(PollMeetingItemSchema) }),
57758
- exports_external.object({ type: exports_external.literal("daemon.evict"), workspaceId: exports_external.string() }),
57759
- exports_external.object({ type: exports_external.literal("daemon.update"), version: exports_external.string() }),
57760
- exports_external.object({ type: exports_external.literal("daemon.rescan") }),
57761
- 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() })
57762
- ]);
57763
57798
  var RegisterResponseSchema = exports_external.object({
57764
57799
  runtimes: exports_external.array(exports_external.object({ id: exports_external.string() }))
57765
57800
  });
@@ -57955,10 +57990,6 @@ var CreateMessageRequestSchema = exports_external.object({
57955
57990
  content: exports_external.string().min(1, "content is required"),
57956
57991
  metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
57957
57992
  });
57958
- var AgentDmRequestSchema = exports_external.object({
57959
- content: exports_external.string().min(1, "content is required"),
57960
- task_id: exports_external.string().min(1).optional()
57961
- });
57962
57993
  var EmailAttachmentSchema = exports_external.object({
57963
57994
  key: exports_external.string().min(1),
57964
57995
  filename: exports_external.string().min(1),
@@ -59805,6 +59836,7 @@ var serverMembershipSchema = CommunityServerMembershipResourceSchema.extend({
59805
59836
  viewer: exports_external.boolean()
59806
59837
  });
59807
59838
  var channelMembershipSchema = CommunityChannelMembershipResourceSchema.extend({ id: exports_external.string().min(1) });
59839
+ var profileSchema = CommunityResourceProfileSchema.extend({ presence: exports_external.enum(["online", "offline"]).optional() });
59808
59840
  var readStateSchema = CommunityReadStateResourceSchema.extend({ observedRevision: exports_external.number().int().nonnegative().optional() });
59809
59841
  var friendshipSchema = exports_external.strictObject({
59810
59842
  id: exports_external.string().min(1),
@@ -60412,12 +60444,36 @@ var communityBotCreationRequest = sqliteTable("community_bot_creation_request",
60412
60444
  resolvedAt: text2("resolved_at")
60413
60445
  }, (t) => [index("idx_bot_creation_requester").on(t.requesterId, t.createdAt), index("idx_bot_creation_owner").on(t.ownerId, t.createdAt)]);
60414
60446
 
60447
+ // ../shared/src/db/automation-schema.ts
60448
+ var exports_automation_schema = {};
60449
+ __export(exports_automation_schema, {
60450
+ automationAccessPermission: () => automationAccessPermission,
60451
+ automationAccessCode: () => automationAccessCode
60452
+ });
60453
+ var automationAccessCode = sqliteTable("automation_access_code", {
60454
+ id: text2("id").primaryKey(),
60455
+ ownerId: text2("owner_id").notNull().references(() => user.id, { onDelete: "cascade" }),
60456
+ name: text2("name").notNull(),
60457
+ secretHash: text2("secret_hash").notNull().unique(),
60458
+ expiresAt: text2("expires_at"),
60459
+ createdAt: text2("created_at").notNull()
60460
+ }, (table) => [index("idx_automation_code_owner").on(table.ownerId)]);
60461
+ var automationAccessPermission = sqliteTable("automation_access_permission", {
60462
+ codeId: text2("code_id").notNull().references(() => automationAccessCode.id, { onDelete: "cascade" }),
60463
+ permission: text2("permission").$type().notNull(),
60464
+ limit: integer2("request_limit").notNull(),
60465
+ period: text2("period", { enum: ["hour", "day"] }).notNull()
60466
+ }, (table) => [primaryKey({ columns: [table.codeId, table.permission] })]);
60467
+
60415
60468
  // ../shared/src/db/index.ts
60416
- 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 };
60469
+ 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 };
60417
60470
  // ../shared/src/db/queries/native-oauth.ts
60418
60471
  var ATTEMPT_TTL_MS = 10 * 60 * 1000;
60419
60472
  var HANDOFF_TTL_MS = 2 * 60 * 1000;
60420
60473
  var RETENTION_MS = 24 * 60 * 60 * 1000;
60474
+
60475
+ // ../shared/src/db/queries/automation.ts
60476
+ var publicFields = { id: automationAccessCode.id, name: automationAccessCode.name, createdAt: automationAccessCode.createdAt, expiresAt: automationAccessCode.expiresAt };
60421
60477
  // ../shared/src/db/queries/task.ts
60422
60478
  var DEFAULT_STALE_SECONDS = Number(process.env.ALOOK_STALE_DISPATCH_TIMEOUT_S) || 20;
60423
60479
  var DEFAULT_STALE_RUNNING_SECONDS = Number(process.env.ALOOK_STALE_RUNNING_TIMEOUT_S) || 3600;
@@ -60555,6 +60611,15 @@ var TaskMemberInstructionCacheSchema = exports_external.strictObject({
60555
60611
  globalInstruction: exports_external.string()
60556
60612
  }).nullable();
60557
60613
  var TaskUserIdentityCacheSchema = CommunityResourceProfileSchema.pick({ id: true, name: true }).extend({ email: exports_external.string() }).nullable();
60614
+ // ../shared/src/community-presence.ts
60615
+ var result = exports_external.strictObject({ online: exports_external.array(exports_external.string().min(1)), offline: exports_external.array(exports_external.string().min(1)) });
60616
+ var disjoint = (value) => !value.offline.some((id3) => value.online.includes(id3));
60617
+ var CommunityPresenceResultSchema = result.refine(disjoint, "Conflicting user presence");
60618
+ var CommunityPresenceReadSchema = result.extend({
60619
+ truncated: exports_external.boolean().optional(),
60620
+ limit: exports_external.number().int().positive().optional(),
60621
+ stale: exports_external.literal(true).optional()
60622
+ }).refine(disjoint, "Conflicting user presence");
60558
60623
  // ../shared/src/community-forum-sidebar.ts
60559
60624
  var timestamp = exports_external.string().refine((value) => Number.isFinite(Date.parse(value)));
60560
60625
  var CommunityForumSidebarChannelSummarySchema = CommunityChannelResourceSchema.pick({
@@ -60743,10 +60808,11 @@ var MEMORY_MAINTENANCE_PROMPT = `The daemon is preparing to reset this idle sess
60743
60808
  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.
60744
60809
  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.
60745
60810
  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.
60811
+ 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.
60746
60812
 
60747
- 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.
60813
+ 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.
60748
60814
 
60749
- If new work arrives, handle it first and defer nap. Otherwise, after completing the review and any needed edits, your final action is to run the following command without --handoff. Do not finish with only a written reply. This instruction authorizes that nap:
60815
+ 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:
60750
60816
 
60751
60817
  $ALOOK_CLI nap`;
60752
60818
  // src/runtimeConfig.ts
@@ -60846,7 +60912,7 @@ function cliCommandsSection() {
60846
60912
  "",
60847
60913
  `1. \`${CLI} platform machine --list\` — list your owner's machines.`,
60848
60914
  `2. \`${CLI} platform machine --backends --id <machine-id>\` — read the selected online machine's backends.`,
60849
- `3. \`${CLI} platform machine --models --id <machine-id> --backend <backend-id> [--model <full-model-id>] [--refresh]\` — read reported models and model-specific effort options. \`--refresh\` only dispatches an asynchronous refresh; read once later without \`--refresh\` for the stored report. Do not poll.`,
60915
+ `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.`,
60850
60916
  `4. \`${CLI} platform bot --list\` — list your owner's bots.`,
60851
60917
  `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.`,
60852
60918
  "",
@@ -61601,10 +61667,10 @@ class AgentProcessManager {
61601
61667
  return desiredRevision === appliedRevision ? "idempotent" : "stale";
61602
61668
  }
61603
61669
  const canApplyNatively = applied && this.runtimeLaunchTuple(applied) === this.runtimeLaunchTuple(desired) && typeof session2.updateSettings === "function";
61604
- let result = { status: "unsupported" };
61670
+ let result2 = { status: "unsupported" };
61605
61671
  if (canApplyNatively) {
61606
61672
  try {
61607
- result = await session2.updateSettings({
61673
+ result2 = await session2.updateSettings({
61608
61674
  reasoningEffort: desired.reasoningEffort ?? null
61609
61675
  });
61610
61676
  } catch (error62) {
@@ -61618,12 +61684,12 @@ class AgentProcessManager {
61618
61684
  return "saved_for_start";
61619
61685
  }
61620
61686
  }
61621
- if (result.status !== "applied") {
61687
+ if (result2.status !== "applied") {
61622
61688
  this.log.warn("runtime config live apply unavailable; restarting at safe boundary", {
61623
61689
  agentId,
61624
61690
  revision: desiredRevision,
61625
- status: result.status,
61626
- code: result.error?.code
61691
+ status: result2.status,
61692
+ code: result2.error?.code
61627
61693
  });
61628
61694
  if (restartOnFailure)
61629
61695
  await this.restartForRuntimeConfig(agentId, session2);
@@ -61793,13 +61859,13 @@ class AgentProcessManager {
61793
61859
  const session2 = this.sessions.get(agentId);
61794
61860
  if (!session2)
61795
61861
  return;
61796
- const result = await session2.interrupt({ requestId: randomUUID7(), reason: "owner_request" });
61797
- if (result.status !== "accepted")
61862
+ const result2 = await session2.interrupt({ requestId: randomUUID7(), reason: "owner_request" });
61863
+ if (result2.status !== "accepted")
61798
61864
  return;
61799
61865
  this.log.info("agent turn interrupt accepted", {
61800
61866
  agentId,
61801
61867
  sessionInstanceId: session2.sessionInstanceId,
61802
- turnId: result.turnId
61868
+ turnId: result2.turnId
61803
61869
  });
61804
61870
  try {
61805
61871
  this.opts.onBotAuditEvent?.(agentId, { kind: "turn_interrupt", payload: { status: "accepted" } }, this.auditContext(agentId));
@@ -61830,7 +61896,7 @@ class AgentProcessManager {
61830
61896
  ]));
61831
61897
  this.sessions.clear();
61832
61898
  this.sessionLifecycles.clear();
61833
- failures.push(...[...factories, ...completed].filter((result) => result.status === "rejected").map((result) => result.reason));
61899
+ failures.push(...[...factories, ...completed].filter((result2) => result2.status === "rejected").map((result2) => result2.reason));
61834
61900
  if (failures.length)
61835
61901
  throw new AggregateError(failures, "Agent shutdown did not complete cleanly");
61836
61902
  });
@@ -62520,7 +62586,7 @@ ${this.opts.wakePromptFooter}` : text3;
62520
62586
  this.opts.onRuntimeSpawnFailed?.(driver.id, reason);
62521
62587
  this.emitErrorAudit(agentId, options?.scope ?? "spawn", reason, options?.message ?? `Launch failed (${reason})`);
62522
62588
  };
62523
- const teardown = (result) => {
62589
+ const teardown = (result2) => {
62524
62590
  clearHandshakeTimer();
62525
62591
  if (state.torndown)
62526
62592
  return;
@@ -62531,18 +62597,18 @@ ${this.opts.wakePromptFooter}` : text3;
62531
62597
  this.closeTurn(state, state.activeSpan, { event: "turn_abort", abortCause: "physical_exit" });
62532
62598
  return;
62533
62599
  }
62534
- const failedStart = result.outcome === "failed_to_start";
62600
+ const failedStart = result2.outcome === "failed_to_start";
62535
62601
  if (failedStart)
62536
- reportSpawnFailure(result.error.code || "failed_to_start");
62602
+ reportSpawnFailure(result2.error.code || "failed_to_start");
62537
62603
  if (!state.hasEstablished && !failedStart)
62538
62604
  reportSpawnFailure("pre_handshake_exit");
62539
62605
  this.closeTurn(state, state.activeSpan, {
62540
62606
  event: "turn_abort",
62541
62607
  abortCause: failedStart ? "spawn_failure" : "physical_exit"
62542
62608
  });
62543
- const exitCode = "exitCode" in result ? result.exitCode ?? null : null;
62544
- const exitSignal = "signal" in result ? result.signal ?? null : null;
62545
- const requested = "requested" in result && result.requested === true;
62609
+ const exitCode = "exitCode" in result2 ? result2.exitCode ?? null : null;
62610
+ const exitSignal = "signal" in result2 ? result2.signal ?? null : null;
62611
+ const requested = "requested" in result2 && result2.requested === true;
62546
62612
  const abnormal = !requested && (exitSignal !== null || exitCode !== null && exitCode !== 0);
62547
62613
  if (state.hasEstablished && !state.suppressExitLog) {
62548
62614
  this.logSessionEnded(agentId, "exit");
@@ -62627,7 +62693,7 @@ ${this.opts.wakePromptFooter}` : text3;
62627
62693
  const done = Promise.allSettled([closed, eventsDone]).then(([closedResult, eventsResult]) => {
62628
62694
  if (closedResult.status === "fulfilled")
62629
62695
  teardown(closedResult.value);
62630
- const failures = [closedResult, eventsResult].filter((result) => result.status === "rejected").map((result) => result.reason);
62696
+ const failures = [closedResult, eventsResult].filter((result2) => result2.status === "rejected").map((result2) => result2.reason);
62631
62697
  if (closedResult.status === "fulfilled" && (closedResult.value.cleanup.status === "failed" || closedResult.value.cleanup.status === "timed_out")) {
62632
62698
  failures.push(closedResult.value.cleanup.error);
62633
62699
  }
@@ -62987,11 +63053,11 @@ ${this.opts.wakePromptFooter}` : text3;
62987
63053
  turnId: event.turnId
62988
63054
  };
62989
63055
  if (this.pendingRuntimeConfigUpdates.has(agentId) && this.sessions.get(agentId) === owner.session) {
62990
- this.convergeRuntimeConfig(agentId, false).then((result) => {
62991
- if (result === "saved_for_start" && owner.session)
63056
+ this.convergeRuntimeConfig(agentId, false).then((result2) => {
63057
+ if (result2 === "saved_for_start" && owner.session)
62992
63058
  this.markResetting(agentId);
62993
63059
  this.dispatch(completionEvent, owner);
62994
- if (result === "saved_for_start" && owner.session) {
63060
+ if (result2 === "saved_for_start" && owner.session) {
62995
63061
  this.restartForRuntimeConfig(agentId, owner.session);
62996
63062
  }
62997
63063
  }).catch((error62) => {
@@ -63432,11 +63498,11 @@ class AgentRouter {
63432
63498
  revision: cmd.config.runtimeConfigRevision ?? 0
63433
63499
  });
63434
63500
  try {
63435
- const result = await this.opts.manager.updateRuntimeConfig(cmd.agentId, cmd.config);
63501
+ const result2 = await this.opts.manager.updateRuntimeConfig(cmd.agentId, cmd.config);
63436
63502
  this.log.info("agent:runtime_config_update accepted", {
63437
63503
  agentId: cmd.agentId,
63438
63504
  revision: cmd.config.runtimeConfigRevision ?? 0,
63439
- result
63505
+ result: result2
63440
63506
  });
63441
63507
  } catch (err) {
63442
63508
  this.log.warn("agent:runtime_config_update rejected", {
@@ -63601,7 +63667,7 @@ class PiiRunner {
63601
63667
  sequence = 0;
63602
63668
  tail = Promise.resolve();
63603
63669
  evaluate(plugins, text3) {
63604
- return this.evaluateWithResult(plugins, text3).then((result) => result.text);
63670
+ return this.evaluateWithResult(plugins, text3).then((result2) => result2.text);
63605
63671
  }
63606
63672
  evaluateWithResult(plugins, text3) {
63607
63673
  if (this.closed || this.pending >= 32)
@@ -64109,7 +64175,8 @@ async function startCredentialProxy(broker, options = {}) {
64109
64175
  }
64110
64176
  };
64111
64177
  const server = http.createServer(async (req, res) => {
64112
- const pathname = new URL2(req.url ?? "/", "http://placeholder").pathname;
64178
+ const requestUrl = new URL2(req.url ?? "/", "http://placeholder");
64179
+ const pathname = requestUrl.pathname;
64113
64180
  if (pathname === LOCAL_PII_PATH && (req.method === "GET" || req.method === "POST")) {
64114
64181
  const localVerdict = broker.check(req.headers["authorization"], req.method === "GET" ? "read" : "send");
64115
64182
  if (!localVerdict.ok) {
@@ -64342,7 +64409,8 @@ async function startCredentialProxy(broker, options = {}) {
64342
64409
  res.writeHead(502, { "content-type": "application/json" });
64343
64410
  res.end(JSON.stringify({ error: `upstream error: ${err.message}`, code: "upstream_error" }));
64344
64411
  });
64345
- const upstreamTimeoutMs = options.upstreamTimeoutMs ?? DEFAULT_UPSTREAM_TIMEOUT_MS;
64412
+ const waitingForModels = req.method === "POST" && /^\/api\/community\/machines\/[^/]+\/discover-models$/.test(pathname) && requestUrl.searchParams.get("wait") === "1";
64413
+ const upstreamTimeoutMs = options.upstreamTimeoutMs ?? (waitingForModels ? 55000 : DEFAULT_UPSTREAM_TIMEOUT_MS);
64346
64414
  upstreamReq.setTimeout(upstreamTimeoutMs, () => {
64347
64415
  upstreamReq.destroy();
64348
64416
  upstreamRes?.destroy();
@@ -65947,14 +66015,14 @@ class PiiStore {
65947
66015
  return this.filterPipelineWithResult(pipeline, text3);
65948
66016
  }
65949
66017
  async filterPipelineWithResult(pipeline, text3) {
65950
- const result = await this.runWithResult(pipeline, text3);
65951
- return { text: result.text, triggeredFilters: result.triggers.filter((trigger) => trigger.triggered).map((trigger) => {
66018
+ const result2 = await this.runWithResult(pipeline, text3);
66019
+ return { text: result2.text, triggeredFilters: result2.triggers.filter((trigger) => trigger.triggered).map((trigger) => {
65952
66020
  const plugin = pipeline.plugins.find((plugin2) => plugin2.id === trigger.pluginId);
65953
66021
  return { id: plugin.id, name: plugin.name };
65954
66022
  }) };
65955
66023
  }
65956
66024
  run(pipeline, text3) {
65957
- return this.runWithResult(pipeline, text3).then((result) => result.text);
66025
+ return this.runWithResult(pipeline, text3).then((result2) => result2.text);
65958
66026
  }
65959
66027
  runWithResult(pipeline, text3) {
65960
66028
  let plugins = this.compiled.get(pipeline);
@@ -66781,10 +66849,10 @@ class WsControlChannel {
66781
66849
  const pending = [];
66782
66850
  for (const cb of this.commandCbs) {
66783
66851
  try {
66784
- const result = cb(cmd);
66785
- if (result === WS_CONTROL_COMMAND_CONSUMED)
66852
+ const result2 = cb(cmd);
66853
+ if (result2 === WS_CONTROL_COMMAND_CONSUMED)
66786
66854
  break;
66787
- pending.push(Promise.resolve(result).catch((err) => {
66855
+ pending.push(Promise.resolve(result2).catch((err) => {
66788
66856
  this.log.warn("command listener threw", { type: cmd.type, err: describeErr(err) });
66789
66857
  }));
66790
66858
  } catch (err) {
@@ -66804,7 +66872,7 @@ class WsControlChannel {
66804
66872
  return;
66805
66873
  }
66806
66874
  if (cmd.type === "agent:wake") {
66807
- const result = await this.wakeCoordinator.run(cmd, (accepted) => this.dispatchListeners(accepted), (advanced) => {
66875
+ const result2 = await this.wakeCoordinator.run(cmd, (accepted) => this.dispatchListeners(accepted), (advanced) => {
66808
66876
  for (const cb of this.wakeDesiredCbs) {
66809
66877
  try {
66810
66878
  cb(advanced);
@@ -66813,7 +66881,7 @@ class WsControlChannel {
66813
66881
  }
66814
66882
  }
66815
66883
  });
66816
- if (result.state === "suppressed") {
66884
+ if (result2.state === "suppressed") {
66817
66885
  await this.reportWakeAck({
66818
66886
  agentId: cmd.agentId,
66819
66887
  launchId: cmd.launchId,
@@ -66823,7 +66891,7 @@ class WsControlChannel {
66823
66891
  agentId: cmd.agentId,
66824
66892
  channel: cmd.unreadNotice.channel,
66825
66893
  latestSeq: cmd.unreadNotice.latestSeq,
66826
- coveredSeq: result.coveredSeq
66894
+ coveredSeq: result2.coveredSeq
66827
66895
  });
66828
66896
  }
66829
66897
  return;
@@ -67822,20 +67890,20 @@ function createTimelineRecorder(opts) {
67822
67890
  }
67823
67891
  }
67824
67892
  };
67825
- const handleTrackedResult = (agentId, state, result) => {
67826
- if (result.status === "written") {
67827
- applyRewrite(agentId, result.rewrite);
67828
- if (state && result.handle) {
67829
- state.handle = result.handle;
67893
+ const handleTrackedResult = (agentId, state, result2) => {
67894
+ if (result2.status === "written") {
67895
+ applyRewrite(agentId, result2.rewrite);
67896
+ if (state && result2.handle) {
67897
+ state.handle = result2.handle;
67830
67898
  state.rowFenced = false;
67831
67899
  }
67832
67900
  return "written";
67833
67901
  }
67834
- if (result.reason === "lock" || result.reason === "write")
67902
+ if (result2.reason === "lock" || result2.reason === "write")
67835
67903
  return "retryable";
67836
- if (state && result.reason !== "oversized")
67904
+ if (state && result2.reason !== "oversized")
67837
67905
  state.rowFenced = true;
67838
- diagnostic(agentId, "timeline_exact_write_rejected", result.reason);
67906
+ diagnostic(agentId, "timeline_exact_write_rejected", result2.reason);
67839
67907
  return "terminal";
67840
67908
  };
67841
67909
  const tryCommit = (agentId, state) => {
@@ -67847,11 +67915,11 @@ function createTimelineRecorder(opts) {
67847
67915
  return "terminal";
67848
67916
  }
67849
67917
  if (state.handle) {
67850
- const result2 = updateTrackedEntry(dir, state.handle, (entry2) => {
67918
+ const result3 = updateTrackedEntry(dir, state.handle, (entry2) => {
67851
67919
  const fitted2 = fitResponsesToRow(entry2, state.responses);
67852
67920
  return { ...entry2, agent_responses: fitted2 ?? [...entry2.agent_responses, ...state.responses] };
67853
67921
  });
67854
- return handleTrackedResult(agentId, state, result2);
67922
+ return handleTrackedResult(agentId, state, result3);
67855
67923
  }
67856
67924
  if (state.rowFenced || state.pendingMode === "handle")
67857
67925
  return "terminal";
@@ -67868,8 +67936,8 @@ function createTimelineRecorder(opts) {
67868
67936
  return "terminal";
67869
67937
  }
67870
67938
  entry.agent_responses = fitted;
67871
- const result = appendTrackedEntry(dir, entry, now());
67872
- return handleTrackedResult(agentId, state, result);
67939
+ const result2 = appendTrackedEntry(dir, entry, now());
67940
+ return handleTrackedResult(agentId, state, result2);
67873
67941
  };
67874
67942
  const deleteState = (agentId, key) => {
67875
67943
  const states = statesFor(agentId);
@@ -67896,13 +67964,13 @@ function createTimelineRecorder(opts) {
67896
67964
  deleteState(agentId, key);
67897
67965
  continue;
67898
67966
  }
67899
- const result = tryCommit(agentId, state);
67900
- if (result === "written") {
67967
+ const result2 = tryCommit(agentId, state);
67968
+ if (result2 === "written") {
67901
67969
  state.responses = [];
67902
67970
  state.pendingSinceMs = undefined;
67903
67971
  state.pendingMode = undefined;
67904
67972
  state.completedAtMs = nowMs;
67905
- } else if (result === "terminal") {
67973
+ } else if (result2 === "terminal") {
67906
67974
  deleteState(agentId, key);
67907
67975
  }
67908
67976
  }
@@ -67930,12 +67998,12 @@ function createTimelineRecorder(opts) {
67930
67998
  const dir = dirFor(agentId);
67931
67999
  if (!prepareTimelineDirectory(dir))
67932
68000
  return;
67933
- const result = appendTrackedEntry(dir, createTimelineEntry({
68001
+ const result2 = appendTrackedEntry(dir, createTimelineEntry({
67934
68002
  messages,
67935
68003
  sessionId: sessionByAgent.get(agentId) ?? null,
67936
68004
  provider: opts.providerFor?.(agentId) ?? null
67937
68005
  }), now());
67938
- handleTrackedResult(agentId, null, result);
68006
+ handleTrackedResult(agentId, null, result2);
67939
68007
  };
67940
68008
  return {
67941
68009
  barrierGeneration(agentId) {
@@ -67979,16 +68047,16 @@ function createTimelineRecorder(opts) {
67979
68047
  if (!prepareTimelineDirectory(dir))
67980
68048
  return;
67981
68049
  const stamp = now();
67982
- let result;
68050
+ let result2;
67983
68051
  if (state.handle && (state.handle.filename === filenameForDate(stamp) || state.owner.barrierGeneration !== currentBarrier(agentId))) {
67984
- result = updateTrackedEntry(dir, state.handle, (entry) => ({
68052
+ result2 = updateTrackedEntry(dir, state.handle, (entry) => ({
67985
68053
  ...entry,
67986
68054
  messages: [...entry.messages, ...messages],
67987
68055
  session_id: state.backendSessionId,
67988
68056
  provider: state.provider
67989
68057
  }));
67990
68058
  } else if (state.owner.barrierGeneration === currentBarrier(agentId)) {
67991
- result = appendTrackedEntry(dir, createTimelineEntry({
68059
+ result2 = appendTrackedEntry(dir, createTimelineEntry({
67992
68060
  messages,
67993
68061
  sessionId: state.backendSessionId,
67994
68062
  provider: state.provider
@@ -67997,7 +68065,7 @@ function createTimelineRecorder(opts) {
67997
68065
  appendOwnerless(agentId, messages);
67998
68066
  return;
67999
68067
  }
68000
- handleTrackedResult(agentId, state, result);
68068
+ handleTrackedResult(agentId, state, result2);
68001
68069
  },
68002
68070
  recordAssistantMessage(agentId, owner, text3, truncated = false) {
68003
68071
  retryPending(agentId);
@@ -68030,11 +68098,11 @@ function createTimelineRecorder(opts) {
68030
68098
  deleteState(agentId, key);
68031
68099
  return;
68032
68100
  }
68033
- const result = tryCommit(agentId, state);
68034
- if (result === "written") {
68101
+ const result2 = tryCommit(agentId, state);
68102
+ if (result2 === "written") {
68035
68103
  state.responses = [];
68036
68104
  state.completedAtMs = now().getTime();
68037
- } else if (result === "terminal") {
68105
+ } else if (result2 === "terminal") {
68038
68106
  deleteState(agentId, key);
68039
68107
  } else {
68040
68108
  retainPending(agentId, key, state);
@@ -68130,8 +68198,8 @@ function createTimelineRecorder(opts) {
68130
68198
  }
68131
68199
  }
68132
68200
  }
68133
- const result = appendTrackedEntry(dir, createSystemEntry(barrierType, stamp.toISOString(), forgottenSessionId), stamp);
68134
- handleTrackedResult(agentId, null, result);
68201
+ const result2 = appendTrackedEntry(dir, createSystemEntry(barrierType, stamp.toISOString(), forgottenSessionId), stamp);
68202
+ handleTrackedResult(agentId, null, result2);
68135
68203
  return true;
68136
68204
  },
68137
68205
  pendingIdleResetEvents(agentId) {
@@ -68161,8 +68229,8 @@ function createTimelineRecorder(opts) {
68161
68229
  }));
68162
68230
  if (!persisted)
68163
68231
  return false;
68164
- const result = appendTrackedEntry(dir, createSystemEntry(type, stamp.toISOString(), sessionId), stamp);
68165
- handleTrackedResult(agentId, null, result);
68232
+ const result2 = appendTrackedEntry(dir, createSystemEntry(type, stamp.toISOString(), sessionId), stamp);
68233
+ handleTrackedResult(agentId, null, result2);
68166
68234
  return true;
68167
68235
  }
68168
68236
  }
@@ -68556,7 +68624,7 @@ function createDaemonAgentDriverHost(ctx, onRawLine) {
68556
68624
  }
68557
68625
 
68558
68626
  // src/daemon/daemonSelfSleep.ts
68559
- var DAEMON_SELF_SLEEP_TIMEOUT_MS = 15 * 24 * 60 * 60 * 1000;
68627
+ var DAEMON_SELF_SLEEP_TIMEOUT_MS = 7 * 24 * 60 * 60 * 1000;
68560
68628
  var systemClock = {
68561
68629
  setTimer: (callback, delayMs) => setTimeout(callback, delayMs),
68562
68630
  clearTimer: (timer) => clearTimeout(timer)
@@ -68777,7 +68845,7 @@ class DailyTokenUsageStore {
68777
68845
  return this.usageWindow(botId).then((window2) => window2.snapshots);
68778
68846
  }
68779
68847
  usageWindow(botId) {
68780
- let result = [];
68848
+ let result2 = [];
68781
68849
  let usageDay = "";
68782
68850
  let usageTimeZone = "";
68783
68851
  return this.enqueue(async () => {
@@ -68790,21 +68858,21 @@ class DailyTokenUsageStore {
68790
68858
  if (this.prune(at, timeZone))
68791
68859
  await this.persist();
68792
68860
  const oldestDay = oldestVisibleDay(usageDay);
68793
- result = (this.data.bots[botId] ?? []).filter((snapshot) => snapshot.day >= oldestDay && snapshot.day <= usageDay).map((snapshot) => structuredClone(snapshot));
68861
+ result2 = (this.data.bots[botId] ?? []).filter((snapshot) => snapshot.day >= oldestDay && snapshot.day <= usageDay).map((snapshot) => structuredClone(snapshot));
68794
68862
  }).then(() => ({
68795
68863
  usageDay,
68796
68864
  usageTimeZone,
68797
- snapshots: result
68865
+ snapshots: result2
68798
68866
  }));
68799
68867
  }
68800
68868
  enqueue(operation) {
68801
- const result = this.tail.then(operation, operation);
68802
- this.tail = result.then(() => {
68869
+ const result2 = this.tail.then(operation, operation);
68870
+ this.tail = result2.then(() => {
68803
68871
  return;
68804
68872
  }, () => {
68805
68873
  return;
68806
68874
  });
68807
- return result;
68875
+ return result2;
68808
68876
  }
68809
68877
  async load() {
68810
68878
  if (this.loaded)
@@ -68909,33 +68977,33 @@ var RECENT_CONTEXT_HEADING = "## Recent local context";
68909
68977
  function code(value) {
68910
68978
  return `\`${value.replaceAll("`", "\\`")}\``;
68911
68979
  }
68912
- function appendRecentContextToPrompt(prompt, result) {
68980
+ function appendRecentContextToPrompt(prompt, result2) {
68913
68981
  const lines = [
68914
68982
  prompt,
68915
68983
  "",
68916
68984
  RECENT_CONTEXT_HEADING,
68917
68985
  ""
68918
68986
  ];
68919
- if (!result.ok) {
68987
+ if (!result2.ok) {
68920
68988
  lines.push("Recent sessions and projects could not be discovered on this machine. " + "Continue onboarding without inventing context; ask the owner what they want to start with.");
68921
68989
  return lines.join(`
68922
68990
  `);
68923
68991
  }
68924
68992
  lines.push("Use these local pointers to understand what the owner has actually been working on before suggesting next actions. " + "Inspect only what is relevant, and do not paste private file paths or unrelated content into Alook.", "Do not read every session in full. For a session you inspect, read the beginning to understand what the user wanted, " + "then read the end to see the result. Read the middle selectively only when it helps resolve a relevant question.", "", "### Recent sessions", "");
68925
- if (result.sessionFiles.capability === "unavailable") {
68993
+ if (result2.sessionFiles.capability === "unavailable") {
68926
68994
  lines.push("This runtime does not expose discoverable session files.");
68927
- } else if (result.sessionFiles.items.length === 0) {
68995
+ } else if (result2.sessionFiles.items.length === 0) {
68928
68996
  lines.push("No recent session files were found.");
68929
68997
  } else {
68930
- for (const item of result.sessionFiles.items) {
68998
+ for (const item of result2.sessionFiles.items) {
68931
68999
  lines.push(`- ${code(item.sessionFilePath)} — project ${code(item.projectPath)}; updated ${item.modifiedAt}`);
68932
69000
  }
68933
69001
  }
68934
69002
  lines.push("", "### Recent projects", "");
68935
- if (result.recentProjects.length === 0) {
69003
+ if (result2.recentProjects.length === 0) {
68936
69004
  lines.push("No recent projects were found.");
68937
69005
  } else {
68938
- for (const item of result.recentProjects) {
69006
+ for (const item of result2.recentProjects) {
68939
69007
  lines.push(`- ${code(item.projectPath)} — updated ${item.modifiedAt}`);
68940
69008
  }
68941
69009
  }
@@ -68946,16 +69014,16 @@ function createRecentContextPromptAppender(discover, recentSessionFilesTopK = 20
68946
69014
  return async (prompt, runtimeConfig) => {
68947
69015
  const selected = toAgentBackendSelection(runtimeConfig);
68948
69016
  const command = selected.config.command;
68949
- let result;
69017
+ let result2;
68950
69018
  try {
68951
- result = await discover({
69019
+ result2 = await discover({
68952
69020
  backend: selected.backend,
68953
69021
  recentSessionFilesTopK,
68954
69022
  recentProjectsTopK,
68955
69023
  ...command ? { command } : {}
68956
69024
  });
68957
69025
  } catch {
68958
- result = {
69026
+ result2 = {
68959
69027
  ok: false,
68960
69028
  error: {
68961
69029
  category: "runtime_unavailable",
@@ -68965,7 +69033,7 @@ function createRecentContextPromptAppender(discover, recentSessionFilesTopK = 20
68965
69033
  }
68966
69034
  };
68967
69035
  }
68968
- return appendRecentContextToPrompt(prompt, result);
69036
+ return appendRecentContextToPrompt(prompt, result2);
68969
69037
  };
68970
69038
  }
68971
69039
 
@@ -69632,10 +69700,10 @@ async function createDaemon(opts) {
69632
69700
  return Promise.resolve([]);
69633
69701
  return trackTelemetry((async () => {
69634
69702
  const results = await Promise.allSettled(manager.liveAgentActivities().map((info) => activityPayload(info)));
69635
- const failed = results.find((result) => result.status === "rejected");
69703
+ const failed = results.find((result2) => result2.status === "rejected");
69636
69704
  if (failed)
69637
69705
  throw failed.reason;
69638
- const activities = results.map((result) => result.value);
69706
+ const activities = results.map((result2) => result2.value);
69639
69707
  return stopping ? [] : activities.filter((activity) => manager.agentActivity(activity.agentId) === activity.state);
69640
69708
  })());
69641
69709
  },