@alook/daemon 0.1.40 → 0.1.42
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/cli/index.js +337 -277
- package/dist/index.js +164 -113
- package/package.json +3 -3
package/dist/cli/index.js
CHANGED
|
@@ -19499,7 +19499,7 @@ __export(exports_community_machine_schema, {
|
|
|
19499
19499
|
DIAGNOSTIC_REPORT_FAILURE_CODES: () => DIAGNOSTIC_REPORT_FAILURE_CODES
|
|
19500
19500
|
});
|
|
19501
19501
|
|
|
19502
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
19502
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/entity.js
|
|
19503
19503
|
var entityKind = Symbol.for("drizzle:entityKind");
|
|
19504
19504
|
var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
|
|
19505
19505
|
function is(value, type) {
|
|
@@ -19524,7 +19524,7 @@ function is(value, type) {
|
|
|
19524
19524
|
return false;
|
|
19525
19525
|
}
|
|
19526
19526
|
|
|
19527
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
19527
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/column.js
|
|
19528
19528
|
class Column {
|
|
19529
19529
|
constructor(table, config2) {
|
|
19530
19530
|
this.table = table;
|
|
@@ -19574,7 +19574,7 @@ class Column {
|
|
|
19574
19574
|
}
|
|
19575
19575
|
}
|
|
19576
19576
|
|
|
19577
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
19577
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/column-builder.js
|
|
19578
19578
|
class ColumnBuilder {
|
|
19579
19579
|
static [entityKind] = "ColumnBuilder";
|
|
19580
19580
|
config;
|
|
@@ -19630,20 +19630,20 @@ class ColumnBuilder {
|
|
|
19630
19630
|
}
|
|
19631
19631
|
}
|
|
19632
19632
|
|
|
19633
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
19633
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/table.utils.js
|
|
19634
19634
|
var TableName = Symbol.for("drizzle:Name");
|
|
19635
19635
|
|
|
19636
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
19636
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/tracing-utils.js
|
|
19637
19637
|
function iife(fn, ...args) {
|
|
19638
19638
|
return fn(...args);
|
|
19639
19639
|
}
|
|
19640
19640
|
|
|
19641
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
19641
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/pg-core/unique-constraint.js
|
|
19642
19642
|
function uniqueKeyName(table, columns) {
|
|
19643
19643
|
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
19644
19644
|
}
|
|
19645
19645
|
|
|
19646
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
19646
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/pg-core/columns/common.js
|
|
19647
19647
|
class PgColumn extends Column {
|
|
19648
19648
|
constructor(table, config2) {
|
|
19649
19649
|
if (!config2.uniqueName) {
|
|
@@ -19692,7 +19692,7 @@ class ExtraConfigColumn extends PgColumn {
|
|
|
19692
19692
|
}
|
|
19693
19693
|
}
|
|
19694
19694
|
|
|
19695
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
19695
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/pg-core/columns/enum.js
|
|
19696
19696
|
class PgEnumObjectColumn extends PgColumn {
|
|
19697
19697
|
static [entityKind] = "PgEnumObjectColumn";
|
|
19698
19698
|
enum;
|
|
@@ -19722,7 +19722,7 @@ class PgEnumColumn extends PgColumn {
|
|
|
19722
19722
|
}
|
|
19723
19723
|
}
|
|
19724
19724
|
|
|
19725
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
19725
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/subquery.js
|
|
19726
19726
|
class Subquery {
|
|
19727
19727
|
static [entityKind] = "Subquery";
|
|
19728
19728
|
constructor(sql, fields, alias, isWith = false, usedTables = []) {
|
|
@@ -19737,10 +19737,10 @@ class Subquery {
|
|
|
19737
19737
|
}
|
|
19738
19738
|
}
|
|
19739
19739
|
|
|
19740
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
19741
|
-
var version2 = "0.45.
|
|
19740
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/version.js
|
|
19741
|
+
var version2 = "0.45.3";
|
|
19742
19742
|
|
|
19743
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
19743
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/tracing.js
|
|
19744
19744
|
var otel;
|
|
19745
19745
|
var rawTracer;
|
|
19746
19746
|
var tracer = {
|
|
@@ -19767,10 +19767,10 @@ var tracer = {
|
|
|
19767
19767
|
}
|
|
19768
19768
|
};
|
|
19769
19769
|
|
|
19770
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
19770
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/view-common.js
|
|
19771
19771
|
var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
|
|
19772
19772
|
|
|
19773
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
19773
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/table.js
|
|
19774
19774
|
var Schema = Symbol.for("drizzle:Schema");
|
|
19775
19775
|
var Columns = Symbol.for("drizzle:Columns");
|
|
19776
19776
|
var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
|
|
@@ -19808,7 +19808,7 @@ class Table {
|
|
|
19808
19808
|
}
|
|
19809
19809
|
}
|
|
19810
19810
|
|
|
19811
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
19811
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sql/sql.js
|
|
19812
19812
|
function isSQLWrapper(value) {
|
|
19813
19813
|
return value !== null && value !== undefined && typeof value.getSQL === "function";
|
|
19814
19814
|
}
|
|
@@ -20171,7 +20171,7 @@ Subquery.prototype.getSQL = function() {
|
|
|
20171
20171
|
return new SQL([this]);
|
|
20172
20172
|
};
|
|
20173
20173
|
|
|
20174
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20174
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/alias.js
|
|
20175
20175
|
class ColumnAliasProxyHandler {
|
|
20176
20176
|
constructor(table) {
|
|
20177
20177
|
this.table = table;
|
|
@@ -20227,12 +20227,12 @@ class TableAliasProxyHandler {
|
|
|
20227
20227
|
}
|
|
20228
20228
|
}
|
|
20229
20229
|
|
|
20230
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20230
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sqlite-core/alias.js
|
|
20231
20231
|
function alias(table, alias2) {
|
|
20232
20232
|
return new Proxy(table, new TableAliasProxyHandler(alias2, false));
|
|
20233
20233
|
}
|
|
20234
20234
|
|
|
20235
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20235
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sqlite-core/checks.js
|
|
20236
20236
|
class CheckBuilder {
|
|
20237
20237
|
constructor(name, value) {
|
|
20238
20238
|
this.name = name;
|
|
@@ -20259,7 +20259,7 @@ function check2(name, value) {
|
|
|
20259
20259
|
return new CheckBuilder(name, value);
|
|
20260
20260
|
}
|
|
20261
20261
|
|
|
20262
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20262
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/utils.js
|
|
20263
20263
|
function getColumnNameAndConfig(a, b) {
|
|
20264
20264
|
return {
|
|
20265
20265
|
name: typeof a === "string" && a.length > 0 ? a : "",
|
|
@@ -20268,7 +20268,7 @@ function getColumnNameAndConfig(a, b) {
|
|
|
20268
20268
|
}
|
|
20269
20269
|
var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder;
|
|
20270
20270
|
|
|
20271
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20271
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sqlite-core/foreign-keys.js
|
|
20272
20272
|
class ForeignKeyBuilder {
|
|
20273
20273
|
static [entityKind] = "SQLiteForeignKeyBuilder";
|
|
20274
20274
|
reference;
|
|
@@ -20336,7 +20336,7 @@ function foreignKey(config2) {
|
|
|
20336
20336
|
return new ForeignKeyBuilder(mappedConfig);
|
|
20337
20337
|
}
|
|
20338
20338
|
|
|
20339
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20339
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sqlite-core/unique-constraint.js
|
|
20340
20340
|
function uniqueKeyName2(table, columns) {
|
|
20341
20341
|
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
20342
20342
|
}
|
|
@@ -20381,7 +20381,7 @@ class UniqueConstraint {
|
|
|
20381
20381
|
}
|
|
20382
20382
|
}
|
|
20383
20383
|
|
|
20384
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20384
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sqlite-core/columns/common.js
|
|
20385
20385
|
class SQLiteColumnBuilder extends ColumnBuilder {
|
|
20386
20386
|
static [entityKind] = "SQLiteColumnBuilder";
|
|
20387
20387
|
foreignKeyConfigs = [];
|
|
@@ -20432,7 +20432,7 @@ class SQLiteColumn extends Column {
|
|
|
20432
20432
|
static [entityKind] = "SQLiteColumn";
|
|
20433
20433
|
}
|
|
20434
20434
|
|
|
20435
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20435
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sqlite-core/columns/blob.js
|
|
20436
20436
|
class SQLiteBigIntBuilder extends SQLiteColumnBuilder {
|
|
20437
20437
|
static [entityKind] = "SQLiteBigIntBuilder";
|
|
20438
20438
|
constructor(name) {
|
|
@@ -20520,7 +20520,7 @@ function blob(a, b) {
|
|
|
20520
20520
|
return new SQLiteBlobBufferBuilder(name);
|
|
20521
20521
|
}
|
|
20522
20522
|
|
|
20523
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20523
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sqlite-core/columns/custom.js
|
|
20524
20524
|
class SQLiteCustomColumnBuilder extends SQLiteColumnBuilder {
|
|
20525
20525
|
static [entityKind] = "SQLiteCustomColumnBuilder";
|
|
20526
20526
|
constructor(name, fieldConfig, customTypeParams) {
|
|
@@ -20561,7 +20561,7 @@ function customType(customTypeParams) {
|
|
|
20561
20561
|
};
|
|
20562
20562
|
}
|
|
20563
20563
|
|
|
20564
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20564
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sqlite-core/columns/integer.js
|
|
20565
20565
|
class SQLiteBaseIntegerBuilder extends SQLiteColumnBuilder {
|
|
20566
20566
|
static [entityKind] = "SQLiteBaseIntegerBuilder";
|
|
20567
20567
|
constructor(name, dataType, columnType) {
|
|
@@ -20663,7 +20663,7 @@ function integer2(a, b) {
|
|
|
20663
20663
|
return new SQLiteIntegerBuilder(name);
|
|
20664
20664
|
}
|
|
20665
20665
|
|
|
20666
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20666
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sqlite-core/columns/numeric.js
|
|
20667
20667
|
class SQLiteNumericBuilder extends SQLiteColumnBuilder {
|
|
20668
20668
|
static [entityKind] = "SQLiteNumericBuilder";
|
|
20669
20669
|
constructor(name) {
|
|
@@ -20733,7 +20733,7 @@ function numeric(a, b) {
|
|
|
20733
20733
|
return mode === "number" ? new SQLiteNumericNumberBuilder(name) : mode === "bigint" ? new SQLiteNumericBigIntBuilder(name) : new SQLiteNumericBuilder(name);
|
|
20734
20734
|
}
|
|
20735
20735
|
|
|
20736
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20736
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sqlite-core/columns/real.js
|
|
20737
20737
|
class SQLiteRealBuilder extends SQLiteColumnBuilder {
|
|
20738
20738
|
static [entityKind] = "SQLiteRealBuilder";
|
|
20739
20739
|
constructor(name) {
|
|
@@ -20754,7 +20754,7 @@ function real(name) {
|
|
|
20754
20754
|
return new SQLiteRealBuilder(name ?? "");
|
|
20755
20755
|
}
|
|
20756
20756
|
|
|
20757
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20757
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sqlite-core/columns/text.js
|
|
20758
20758
|
class SQLiteTextBuilder extends SQLiteColumnBuilder {
|
|
20759
20759
|
static [entityKind] = "SQLiteTextBuilder";
|
|
20760
20760
|
constructor(name, config2) {
|
|
@@ -20809,7 +20809,7 @@ function text(a, b = {}) {
|
|
|
20809
20809
|
return new SQLiteTextBuilder(name, config2);
|
|
20810
20810
|
}
|
|
20811
20811
|
|
|
20812
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20812
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sqlite-core/columns/all.js
|
|
20813
20813
|
function getSQLiteColumnBuilders() {
|
|
20814
20814
|
return {
|
|
20815
20815
|
blob,
|
|
@@ -20821,7 +20821,7 @@ function getSQLiteColumnBuilders() {
|
|
|
20821
20821
|
};
|
|
20822
20822
|
}
|
|
20823
20823
|
|
|
20824
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20824
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sqlite-core/table.js
|
|
20825
20825
|
var InlineForeignKeys = Symbol.for("drizzle:SQLiteInlineForeignKeys");
|
|
20826
20826
|
|
|
20827
20827
|
class SQLiteTable extends Table {
|
|
@@ -20855,7 +20855,7 @@ var sqliteTable = (name, columns, extraConfig) => {
|
|
|
20855
20855
|
return sqliteTableBase(name, columns, extraConfig);
|
|
20856
20856
|
};
|
|
20857
20857
|
|
|
20858
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20858
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sqlite-core/indexes.js
|
|
20859
20859
|
class IndexBuilderOn {
|
|
20860
20860
|
constructor(name, unique2) {
|
|
20861
20861
|
this.name = name;
|
|
@@ -20901,7 +20901,7 @@ function uniqueIndex(name) {
|
|
|
20901
20901
|
return new IndexBuilderOn(name, true);
|
|
20902
20902
|
}
|
|
20903
20903
|
|
|
20904
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20904
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sqlite-core/primary-keys.js
|
|
20905
20905
|
function primaryKey(...config2) {
|
|
20906
20906
|
if (config2[0].columns) {
|
|
20907
20907
|
return new PrimaryKeyBuilder(config2[0].columns, config2[0].name);
|
|
@@ -20936,7 +20936,7 @@ class PrimaryKey {
|
|
|
20936
20936
|
}
|
|
20937
20937
|
}
|
|
20938
20938
|
|
|
20939
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20939
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sql/expressions/conditions.js
|
|
20940
20940
|
function bindIfParam(value, column) {
|
|
20941
20941
|
if (isDriverValueEncoder(column) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column) && !is(value, Table) && !is(value, View)) {
|
|
20942
20942
|
return new Param(value, column);
|
|
@@ -20964,7 +20964,7 @@ function isNotNull(value) {
|
|
|
20964
20964
|
return sql`${value} is not null`;
|
|
20965
20965
|
}
|
|
20966
20966
|
|
|
20967
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.
|
|
20967
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.3_@cloudflare+workers-types@5.20260924.1_@opentelemetry+api@1.9.1_@typ_49048b3d7117d2a8abc613de6d00d564/node_modules/drizzle-orm/sql/expressions/select.js
|
|
20968
20968
|
function desc(column) {
|
|
20969
20969
|
return sql`${column} desc`;
|
|
20970
20970
|
}
|
|
@@ -22092,7 +22092,7 @@ var HostCommandSchema = exports_external.discriminatedUnion("type", [
|
|
|
22092
22092
|
agentId: exports_external.string().min(1),
|
|
22093
22093
|
config: exports_external.unknown(),
|
|
22094
22094
|
launchId: exports_external.string().min(1),
|
|
22095
|
-
handoff: exports_external.string().
|
|
22095
|
+
handoff: exports_external.string().refine((value) => value.trim().length > 0).optional()
|
|
22096
22096
|
}),
|
|
22097
22097
|
exports_external.object({
|
|
22098
22098
|
type: exports_external.literal("agent:model_switch"),
|
|
@@ -22143,6 +22143,66 @@ var HostCommandSchema = exports_external.discriminatedUnion("type", [
|
|
|
22143
22143
|
// src/cli/proxyServerApi.ts
|
|
22144
22144
|
import * as fs from "fs";
|
|
22145
22145
|
import * as path from "path";
|
|
22146
|
+
// ../shared/src/community-attention.ts
|
|
22147
|
+
var id = exports_external.string().min(1);
|
|
22148
|
+
var AttentionScopeSchema = exports_external.strictObject({
|
|
22149
|
+
scopeId: id,
|
|
22150
|
+
channelId: id,
|
|
22151
|
+
serverId: id.nullable().optional(),
|
|
22152
|
+
parentChannelId: id.nullable().optional(),
|
|
22153
|
+
ordinaryUnread: exports_external.boolean(),
|
|
22154
|
+
lastUnreadSeq: exports_external.number().int().nonnegative(),
|
|
22155
|
+
lastAttentionSeq: exports_external.number().int().nonnegative().nullable().optional(),
|
|
22156
|
+
attentionCount: exports_external.number().int().nonnegative()
|
|
22157
|
+
});
|
|
22158
|
+
var AttentionItemSchema = exports_external.strictObject({
|
|
22159
|
+
id,
|
|
22160
|
+
kind: exports_external.enum(["mention", "reply", "friend_request"]),
|
|
22161
|
+
sourceId: id,
|
|
22162
|
+
scopeId: id.nullable().optional(),
|
|
22163
|
+
messageId: id.nullable().optional(),
|
|
22164
|
+
actorUserId: id,
|
|
22165
|
+
createdAt: exports_external.string()
|
|
22166
|
+
}).superRefine((item, ctx) => {
|
|
22167
|
+
if (item.kind === "friend_request") {
|
|
22168
|
+
if (item.scopeId != null || item.messageId != null) {
|
|
22169
|
+
ctx.addIssue({ code: "custom", message: "friend request cannot reference a scope or message" });
|
|
22170
|
+
}
|
|
22171
|
+
return;
|
|
22172
|
+
}
|
|
22173
|
+
if (!item.scopeId || !item.messageId) {
|
|
22174
|
+
ctx.addIssue({ code: "custom", message: "message attention requires scope and message refs" });
|
|
22175
|
+
}
|
|
22176
|
+
});
|
|
22177
|
+
var AttentionIncludedSchema = exports_external.strictObject({
|
|
22178
|
+
profiles: exports_external.array(exports_external.unknown()).optional(),
|
|
22179
|
+
messages: exports_external.array(exports_external.unknown()).optional()
|
|
22180
|
+
});
|
|
22181
|
+
var AccountAttentionSnapshotSchema = exports_external.strictObject({
|
|
22182
|
+
scopes: exports_external.array(AttentionScopeSchema),
|
|
22183
|
+
items: exports_external.array(AttentionItemSchema),
|
|
22184
|
+
limit: exports_external.number().int().positive(),
|
|
22185
|
+
truncated: exports_external.boolean(),
|
|
22186
|
+
included: AttentionIncludedSchema.optional()
|
|
22187
|
+
}).superRefine((snapshot, ctx) => {
|
|
22188
|
+
const scopeIds = new Set;
|
|
22189
|
+
for (const scope of snapshot.scopes) {
|
|
22190
|
+
if (scopeIds.has(scope.scopeId)) {
|
|
22191
|
+
ctx.addIssue({ code: "custom", message: `duplicate attention scope: ${scope.scopeId}` });
|
|
22192
|
+
}
|
|
22193
|
+
scopeIds.add(scope.scopeId);
|
|
22194
|
+
}
|
|
22195
|
+
const itemIds = new Set;
|
|
22196
|
+
for (const item of snapshot.items) {
|
|
22197
|
+
if (itemIds.has(item.id)) {
|
|
22198
|
+
ctx.addIssue({ code: "custom", message: `duplicate attention item: ${item.id}` });
|
|
22199
|
+
}
|
|
22200
|
+
itemIds.add(item.id);
|
|
22201
|
+
if (item.scopeId && !scopeIds.has(item.scopeId)) {
|
|
22202
|
+
ctx.addIssue({ code: "custom", message: `attention item references missing scope: ${item.scopeId}` });
|
|
22203
|
+
}
|
|
22204
|
+
}
|
|
22205
|
+
});
|
|
22146
22206
|
// ../shared/src/constants/community.ts
|
|
22147
22207
|
var MAX_FOLDER_NAME_LENGTH = 100;
|
|
22148
22208
|
var MAX_PROFILE_NAME_LENGTH = 100;
|
|
@@ -22893,11 +22953,11 @@ var CommunityMachineRuntimeListSchema = exports_external.array(CommunityMachineR
|
|
|
22893
22953
|
var CommunityRunningAgentListSchema = exports_external.array(exports_external.string()).transform((list) => {
|
|
22894
22954
|
const seen = new Set;
|
|
22895
22955
|
const out = [];
|
|
22896
|
-
for (const
|
|
22897
|
-
if (seen.has(
|
|
22956
|
+
for (const id2 of list) {
|
|
22957
|
+
if (seen.has(id2))
|
|
22898
22958
|
continue;
|
|
22899
|
-
seen.add(
|
|
22900
|
-
out.push(
|
|
22959
|
+
seen.add(id2);
|
|
22960
|
+
out.push(id2);
|
|
22901
22961
|
}
|
|
22902
22962
|
return out;
|
|
22903
22963
|
});
|
|
@@ -23074,6 +23134,7 @@ var CommunityAgentSendRequestSchema = exports_external.object({
|
|
|
23074
23134
|
attachments: exports_external.array(exports_external.string().min(1)).max(MAX_ATTACHMENTS_PER_MESSAGE).default([]),
|
|
23075
23135
|
seenUpToSeq: CommunityAgentSeqSchema.optional(),
|
|
23076
23136
|
replyToSeq: CommunityAgentPositiveSeqSchema.optional(),
|
|
23137
|
+
force: exports_external.boolean().optional(),
|
|
23077
23138
|
nonce: exports_external.string().min(1).max(128).optional()
|
|
23078
23139
|
}).refine((d) => d.content.text.trim().length > 0 || d.attachments.length > 0, { message: "message must have text or attachments" });
|
|
23079
23140
|
var CommunityAgentAttachmentUploadResponseSchema = exports_external.object({
|
|
@@ -23130,8 +23191,8 @@ var CommunityAgentJoinServerRequestSchema = exports_external.object({
|
|
|
23130
23191
|
});
|
|
23131
23192
|
var CommunityAgentNapRequestSchema = exports_external.object({
|
|
23132
23193
|
handoff: exports_external.string().refine((value) => value.trim().length > 0, {
|
|
23133
|
-
message: "handoff
|
|
23134
|
-
})
|
|
23194
|
+
message: "handoff must not be blank"
|
|
23195
|
+
}).optional()
|
|
23135
23196
|
});
|
|
23136
23197
|
var CommunityAgentMessagePropertyRequestSchema = exports_external.object({
|
|
23137
23198
|
channel: exports_external.string().min(1),
|
|
@@ -26233,8 +26294,8 @@ class SettledUsageProjector {
|
|
|
26233
26294
|
|
|
26234
26295
|
// agent-driver/dist/internal/utils.js
|
|
26235
26296
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
26236
|
-
function jsonRpcRequest(method, params,
|
|
26237
|
-
return JSON.stringify({ jsonrpc: "2.0", id:
|
|
26297
|
+
function jsonRpcRequest(method, params, id2) {
|
|
26298
|
+
return JSON.stringify({ jsonrpc: "2.0", id: id2 ?? randomUUID3(), method, params });
|
|
26238
26299
|
}
|
|
26239
26300
|
function tryParseJsonLine(line) {
|
|
26240
26301
|
try {
|
|
@@ -26985,8 +27046,8 @@ async function discoverClaudeRecentContext(request, dependencies = {}) {
|
|
|
26985
27046
|
// agent-driver/dist/adapters/claude/index.js
|
|
26986
27047
|
var CLAUDE_MODEL_CATALOG = {
|
|
26987
27048
|
updateMode: "unsupported",
|
|
26988
|
-
models: ["opus", "sonnet", "haiku"].map((
|
|
26989
|
-
id,
|
|
27049
|
+
models: ["opus", "sonnet", "haiku"].map((id2) => ({
|
|
27050
|
+
id: id2,
|
|
26990
27051
|
supportedReasoningEfforts: []
|
|
26991
27052
|
}))
|
|
26992
27053
|
};
|
|
@@ -27707,22 +27768,22 @@ var RUNTIME_MODEL_ID_MAX = 100;
|
|
|
27707
27768
|
function normalizeRuntimeModelId(value) {
|
|
27708
27769
|
if (typeof value !== "string")
|
|
27709
27770
|
return;
|
|
27710
|
-
const
|
|
27711
|
-
if (!
|
|
27771
|
+
const id2 = value.trim();
|
|
27772
|
+
if (!id2 || id2.length > RUNTIME_MODEL_ID_MAX || /\s/.test(id2))
|
|
27712
27773
|
return;
|
|
27713
|
-
return
|
|
27774
|
+
return id2;
|
|
27714
27775
|
}
|
|
27715
27776
|
function catalogFromIds(ids) {
|
|
27716
27777
|
const seen = new Set;
|
|
27717
27778
|
const models = [];
|
|
27718
27779
|
for (const rawId of ids) {
|
|
27719
|
-
const
|
|
27720
|
-
if (!
|
|
27780
|
+
const id2 = normalizeRuntimeModelId(rawId);
|
|
27781
|
+
if (!id2 || seen.has(id2))
|
|
27721
27782
|
continue;
|
|
27722
27783
|
if (models.length >= RUNTIME_MODEL_CATALOG_MAX)
|
|
27723
27784
|
return;
|
|
27724
|
-
seen.add(
|
|
27725
|
-
models.push({ id, supportedReasoningEfforts: [] });
|
|
27785
|
+
seen.add(id2);
|
|
27786
|
+
models.push({ id: id2, supportedReasoningEfforts: [] });
|
|
27726
27787
|
}
|
|
27727
27788
|
if (models.length === 0)
|
|
27728
27789
|
return;
|
|
@@ -27730,8 +27791,8 @@ function catalogFromIds(ids) {
|
|
|
27730
27791
|
}
|
|
27731
27792
|
function parseOpenCodeModelCatalog(output2) {
|
|
27732
27793
|
const ids = output2.split(/\r?\n/).flatMap((line) => {
|
|
27733
|
-
const
|
|
27734
|
-
return
|
|
27794
|
+
const id2 = normalizeRuntimeModelId(line);
|
|
27795
|
+
return id2 && /^[^/]+\/.+$/.test(id2) ? [id2] : [];
|
|
27735
27796
|
});
|
|
27736
27797
|
return catalogFromIds(ids);
|
|
27737
27798
|
}
|
|
@@ -27743,8 +27804,8 @@ function parsePiModelCatalog(values) {
|
|
|
27743
27804
|
return [];
|
|
27744
27805
|
const model = value;
|
|
27745
27806
|
const provider = normalizeRuntimeModelId(model.provider);
|
|
27746
|
-
const
|
|
27747
|
-
return provider &&
|
|
27807
|
+
const id2 = normalizeRuntimeModelId(model.id);
|
|
27808
|
+
return provider && id2 && !provider.includes("/") ? [`${provider}/${id2}`] : [];
|
|
27748
27809
|
});
|
|
27749
27810
|
return catalogFromIds(ids);
|
|
27750
27811
|
}
|
|
@@ -27902,8 +27963,8 @@ class CodexDriver {
|
|
|
27902
27963
|
if (!value || typeof value !== "object")
|
|
27903
27964
|
return;
|
|
27904
27965
|
const model = value;
|
|
27905
|
-
const
|
|
27906
|
-
if (!
|
|
27966
|
+
const id2 = normalizeRuntimeModelId(model.id);
|
|
27967
|
+
if (!id2 || seenModels.has(id2))
|
|
27907
27968
|
return;
|
|
27908
27969
|
if (models.length >= MODEL_LIST_MAX) {
|
|
27909
27970
|
overflow = true;
|
|
@@ -27923,11 +27984,11 @@ class CodexDriver {
|
|
|
27923
27984
|
return [{ value: value2, ...description ? { description } : {} }];
|
|
27924
27985
|
}).slice(0, MODEL_EFFORT_MAX);
|
|
27925
27986
|
const candidateDefault = typeof model.defaultReasoningEffort === "string" ? model.defaultReasoningEffort : undefined;
|
|
27926
|
-
seenModels.add(
|
|
27987
|
+
seenModels.add(id2);
|
|
27927
27988
|
if (model.isDefault === true)
|
|
27928
|
-
defaultModelId =
|
|
27989
|
+
defaultModelId = id2;
|
|
27929
27990
|
models.push({
|
|
27930
|
-
id,
|
|
27991
|
+
id: id2,
|
|
27931
27992
|
supportedReasoningEfforts,
|
|
27932
27993
|
...candidateDefault && supportedReasoningEfforts.some((item) => item.value === candidateDefault) ? { defaultReasoningEffort: candidateDefault } : {}
|
|
27933
27994
|
});
|
|
@@ -28081,10 +28142,10 @@ class CodexDriver {
|
|
|
28081
28142
|
error: this.settingsError("process", "settings_thread_unavailable", "Codex thread is not available for a settings update", true)
|
|
28082
28143
|
});
|
|
28083
28144
|
}
|
|
28084
|
-
const
|
|
28145
|
+
const id2 = this.nextRequestId();
|
|
28085
28146
|
return new Promise((resolve2) => {
|
|
28086
28147
|
const timer = setTimeout(() => {
|
|
28087
|
-
if (!this.pendingSettingsUpdates.delete(
|
|
28148
|
+
if (!this.pendingSettingsUpdates.delete(id2))
|
|
28088
28149
|
return;
|
|
28089
28150
|
resolve2({
|
|
28090
28151
|
status: "failed",
|
|
@@ -28092,13 +28153,13 @@ class CodexDriver {
|
|
|
28092
28153
|
});
|
|
28093
28154
|
}, SETTINGS_UPDATE_TIMEOUT_MS);
|
|
28094
28155
|
timer.unref?.();
|
|
28095
|
-
this.pendingSettingsUpdates.set(
|
|
28156
|
+
this.pendingSettingsUpdates.set(id2, { resolve: resolve2, timer });
|
|
28096
28157
|
try {
|
|
28097
|
-
stdin.write(jsonRpcRequest("thread/settings/update", { threadId, effort: input2.reasoningEffort },
|
|
28158
|
+
stdin.write(jsonRpcRequest("thread/settings/update", { threadId, effort: input2.reasoningEffort }, id2) + `
|
|
28098
28159
|
`);
|
|
28099
28160
|
} catch (error62) {
|
|
28100
28161
|
clearTimeout(timer);
|
|
28101
|
-
this.pendingSettingsUpdates.delete(
|
|
28162
|
+
this.pendingSettingsUpdates.delete(id2);
|
|
28102
28163
|
resolve2({
|
|
28103
28164
|
status: "failed",
|
|
28104
28165
|
error: this.settingsError("process", "settings_update_write_failed", String(error62), true)
|
|
@@ -28147,9 +28208,9 @@ class CodexDriver {
|
|
|
28147
28208
|
return { category, code, message: scrubDriverErrorMessage(message2), retryable };
|
|
28148
28209
|
}
|
|
28149
28210
|
failPendingSettingsUpdates(code, message2) {
|
|
28150
|
-
for (const [
|
|
28211
|
+
for (const [id2, pending] of this.pendingSettingsUpdates) {
|
|
28151
28212
|
clearTimeout(pending.timer);
|
|
28152
|
-
this.pendingSettingsUpdates.delete(
|
|
28213
|
+
this.pendingSettingsUpdates.delete(id2);
|
|
28153
28214
|
pending.resolve({
|
|
28154
28215
|
status: "failed",
|
|
28155
28216
|
error: this.settingsError("process", code, message2, true)
|
|
@@ -28703,7 +28764,7 @@ class CursorAcpLane {
|
|
|
28703
28764
|
return this.request(method, params, this.options.handshakeTimeoutMs ?? HANDSHAKE_TIMEOUT_MS).promise;
|
|
28704
28765
|
}
|
|
28705
28766
|
request(method, params, timeoutMs) {
|
|
28706
|
-
const
|
|
28767
|
+
const id2 = ++this.requestSequence;
|
|
28707
28768
|
let resolve2;
|
|
28708
28769
|
let reject;
|
|
28709
28770
|
const promise2 = new Promise((accept, decline) => {
|
|
@@ -28711,24 +28772,24 @@ class CursorAcpLane {
|
|
|
28711
28772
|
reject = decline;
|
|
28712
28773
|
});
|
|
28713
28774
|
const timer = timeoutMs === undefined ? undefined : setTimeout(() => {
|
|
28714
|
-
const pending = this.pending.get(
|
|
28775
|
+
const pending = this.pending.get(id2);
|
|
28715
28776
|
if (!pending || pending.kind !== "call")
|
|
28716
28777
|
return;
|
|
28717
|
-
this.pending.delete(
|
|
28778
|
+
this.pending.delete(id2);
|
|
28718
28779
|
pending.reject(new Error(`Cursor ACP ${method} timed out`));
|
|
28719
28780
|
}, timeoutMs);
|
|
28720
28781
|
timer?.unref?.();
|
|
28721
|
-
this.pending.set(
|
|
28782
|
+
this.pending.set(id2, { kind: "call", method, resolve: resolve2, reject, ...timer ? { timer } : {} });
|
|
28722
28783
|
try {
|
|
28723
|
-
this.write({ jsonrpc: "2.0", id, method, params });
|
|
28784
|
+
this.write({ jsonrpc: "2.0", id: id2, method, params });
|
|
28724
28785
|
} catch (error62) {
|
|
28725
|
-
const pending = this.pending.get(
|
|
28726
|
-
this.pending.delete(
|
|
28786
|
+
const pending = this.pending.get(id2);
|
|
28787
|
+
this.pending.delete(id2);
|
|
28727
28788
|
if (pending?.kind === "call" && pending.timer)
|
|
28728
28789
|
clearTimeout(pending.timer);
|
|
28729
28790
|
throw error62 instanceof Error ? error62 : new Error(String(error62));
|
|
28730
28791
|
}
|
|
28731
|
-
return { id, promise: promise2 };
|
|
28792
|
+
return { id: id2, promise: promise2 };
|
|
28732
28793
|
}
|
|
28733
28794
|
write(message2) {
|
|
28734
28795
|
const stdin = this.process?.stdin;
|
|
@@ -28834,14 +28895,14 @@ class CursorAcpLane {
|
|
|
28834
28895
|
}
|
|
28835
28896
|
this.protocolFailure("Cursor ACP emitted an unrecognized JSON-RPC message");
|
|
28836
28897
|
}
|
|
28837
|
-
handleResponse(
|
|
28838
|
-
const pending = typeof
|
|
28839
|
-
if (typeof
|
|
28898
|
+
handleResponse(id2, message2) {
|
|
28899
|
+
const pending = typeof id2 === "number" ? this.pending.get(id2) : undefined;
|
|
28900
|
+
if (typeof id2 !== "number" || !pending) {
|
|
28840
28901
|
this.diagnostic("warning", "Cursor ACP emitted a duplicate or unknown response id");
|
|
28841
28902
|
return;
|
|
28842
28903
|
}
|
|
28843
28904
|
if (pending.kind === "prompt") {
|
|
28844
|
-
this.pending.delete(
|
|
28905
|
+
this.pending.delete(id2);
|
|
28845
28906
|
if (message2.error !== undefined) {
|
|
28846
28907
|
const payload = record3(message2.error);
|
|
28847
28908
|
const rpcCode = typeof payload?.code === "number" && Number.isSafeInteger(payload.code) ? payload.code : undefined;
|
|
@@ -28855,20 +28916,20 @@ class CursorAcpLane {
|
|
|
28855
28916
|
}
|
|
28856
28917
|
if (message2.error !== undefined) {
|
|
28857
28918
|
const payload = record3(message2.error);
|
|
28858
|
-
this.settleRequest(
|
|
28919
|
+
this.settleRequest(id2, false, new CursorAcpRpcError(pending.method, typeof payload?.code === "number" ? payload.code : undefined, rpcErrorMessage(message2.error)));
|
|
28859
28920
|
return;
|
|
28860
28921
|
}
|
|
28861
28922
|
if (!("result" in message2)) {
|
|
28862
|
-
this.settleRequest(
|
|
28923
|
+
this.settleRequest(id2, false, new Error("Cursor ACP response omitted result"));
|
|
28863
28924
|
return;
|
|
28864
28925
|
}
|
|
28865
|
-
this.settleRequest(
|
|
28926
|
+
this.settleRequest(id2, true, message2.result);
|
|
28866
28927
|
}
|
|
28867
|
-
settleRequest(
|
|
28868
|
-
const pending = this.pending.get(
|
|
28928
|
+
settleRequest(id2, ok, value) {
|
|
28929
|
+
const pending = this.pending.get(id2);
|
|
28869
28930
|
if (!pending || pending.kind !== "call")
|
|
28870
28931
|
return;
|
|
28871
|
-
this.pending.delete(
|
|
28932
|
+
this.pending.delete(id2);
|
|
28872
28933
|
if (pending.timer)
|
|
28873
28934
|
clearTimeout(pending.timer);
|
|
28874
28935
|
if (ok)
|
|
@@ -28876,11 +28937,11 @@ class CursorAcpLane {
|
|
|
28876
28937
|
else
|
|
28877
28938
|
pending.reject(value instanceof Error ? value : new Error(String(value)));
|
|
28878
28939
|
}
|
|
28879
|
-
handleRequest(
|
|
28940
|
+
handleRequest(id2, method, params) {
|
|
28880
28941
|
if (method !== "session/request_permission") {
|
|
28881
28942
|
this.write({
|
|
28882
28943
|
jsonrpc: "2.0",
|
|
28883
|
-
id,
|
|
28944
|
+
id: id2,
|
|
28884
28945
|
error: { code: -32601, message: "Unsupported Cursor ACP client request" }
|
|
28885
28946
|
});
|
|
28886
28947
|
this.diagnostic("warning", `Unsupported Cursor ACP client request: ${safeLabel(method)}`);
|
|
@@ -28891,13 +28952,13 @@ class CursorAcpLane {
|
|
|
28891
28952
|
const options = Array.isArray(payload?.options) ? payload.options.map(record3).filter(Boolean) : [];
|
|
28892
28953
|
const allowOnce = options.find((option) => option.kind === "allow_once" && typeof option.optionId === "string" && option.optionId.trim().length > 0);
|
|
28893
28954
|
if (!this.ready || this.currentPromptRequestId === null || !sameSession || !allowOnce) {
|
|
28894
|
-
this.write({ jsonrpc: "2.0", id, result: { outcome: { outcome: "cancelled" } } });
|
|
28955
|
+
this.write({ jsonrpc: "2.0", id: id2, result: { outcome: { outcome: "cancelled" } } });
|
|
28895
28956
|
this.diagnostic("error", "Cursor ACP permission request was not allowed for the active prompt");
|
|
28896
28957
|
return;
|
|
28897
28958
|
}
|
|
28898
28959
|
this.write({
|
|
28899
28960
|
jsonrpc: "2.0",
|
|
28900
|
-
id,
|
|
28961
|
+
id: id2,
|
|
28901
28962
|
result: { outcome: { outcome: "selected", optionId: allowOnce.optionId } }
|
|
28902
28963
|
});
|
|
28903
28964
|
}
|
|
@@ -28985,8 +29046,8 @@ class CursorAcpLane {
|
|
|
28985
29046
|
this.stop({ reason: "protocol_error", forceAfterMs: 0 }).catch(() => {});
|
|
28986
29047
|
}
|
|
28987
29048
|
rejectAllPending(error62) {
|
|
28988
|
-
for (const [
|
|
28989
|
-
this.pending.delete(
|
|
29049
|
+
for (const [id2, pending] of [...this.pending]) {
|
|
29050
|
+
this.pending.delete(id2);
|
|
28990
29051
|
if (pending.kind === "call") {
|
|
28991
29052
|
if (pending.timer)
|
|
28992
29053
|
clearTimeout(pending.timer);
|
|
@@ -29294,14 +29355,14 @@ function parseGrokModelCatalog(value) {
|
|
|
29294
29355
|
const models = [];
|
|
29295
29356
|
for (const item of available) {
|
|
29296
29357
|
const model = asRecord(item);
|
|
29297
|
-
const
|
|
29298
|
-
if (!model || !
|
|
29358
|
+
const id2 = normalizeRuntimeModelId(model?.modelId);
|
|
29359
|
+
if (!model || !id2 || seen.has(id2))
|
|
29299
29360
|
continue;
|
|
29300
29361
|
if (models.length >= RUNTIME_MODEL_CATALOG_MAX)
|
|
29301
29362
|
return;
|
|
29302
|
-
seen.add(
|
|
29363
|
+
seen.add(id2);
|
|
29303
29364
|
const displayName = boundedText2(model.name, MODEL_DISPLAY_NAME_MAX2);
|
|
29304
|
-
models.push({ id, ...displayName ? { displayName } : {}, ...reasoningCatalog(model) });
|
|
29365
|
+
models.push({ id: id2, ...displayName ? { displayName } : {}, ...reasoningCatalog(model) });
|
|
29305
29366
|
}
|
|
29306
29367
|
if (models.length === 0)
|
|
29307
29368
|
return;
|
|
@@ -29355,13 +29416,13 @@ async function probeGrokAcpCatalog(command, options = {}) {
|
|
|
29355
29416
|
const cleanup = options.cleanup ?? cleanupProbeProcess2;
|
|
29356
29417
|
Promise.resolve().then(() => cleanup(processHandle)).catch(() => {}).finally(() => resolve2(value));
|
|
29357
29418
|
};
|
|
29358
|
-
const write = (method, params,
|
|
29419
|
+
const write = (method, params, id2) => {
|
|
29359
29420
|
const stdin = processHandle.stdin;
|
|
29360
29421
|
if (!stdin || stdin.destroyed || stdin.writableEnded || stdin.writable === false) {
|
|
29361
29422
|
return finish({ status: "unhealthy", lastError: "grok_acp_transport_unavailable" });
|
|
29362
29423
|
}
|
|
29363
29424
|
try {
|
|
29364
|
-
stdin.write(`${jsonRpcRequest(method, params,
|
|
29425
|
+
stdin.write(`${jsonRpcRequest(method, params, id2)}
|
|
29365
29426
|
`);
|
|
29366
29427
|
} catch {
|
|
29367
29428
|
finish({ status: "unhealthy", lastError: "grok_acp_transport_unavailable" });
|
|
@@ -29395,8 +29456,8 @@ async function probeGrokAcpCatalog(command, options = {}) {
|
|
|
29395
29456
|
const capabilities = asRecord(result.agentCapabilities);
|
|
29396
29457
|
const methods = Array.isArray(result.authMethods) ? result.authMethods : [];
|
|
29397
29458
|
const methodIds = methods.flatMap((method) => {
|
|
29398
|
-
const
|
|
29399
|
-
return typeof
|
|
29459
|
+
const id2 = asRecord(method)?.id;
|
|
29460
|
+
return typeof id2 === "string" ? [id2] : [];
|
|
29400
29461
|
});
|
|
29401
29462
|
if (result.protocolVersion !== ACP_PROTOCOL_VERSION4) {
|
|
29402
29463
|
return finish({ status: "unhealthy", lastError: "grok_acp_protocol_incompatible" });
|
|
@@ -29405,7 +29466,7 @@ async function probeGrokAcpCatalog(command, options = {}) {
|
|
|
29405
29466
|
return finish({ status: "unhealthy", lastError: "grok_acp_load_session_unsupported" });
|
|
29406
29467
|
}
|
|
29407
29468
|
if (!methodIds.includes(AUTH_METHOD_ID4)) {
|
|
29408
|
-
if (methodIds.some((
|
|
29469
|
+
if (methodIds.some((id2) => INTERACTIVE_AUTH_METHOD_IDS.has(id2))) {
|
|
29409
29470
|
return finish({ status: "unhealthy", lastError: "grok_acp_authentication_failed" });
|
|
29410
29471
|
}
|
|
29411
29472
|
return finish({ status: "unhealthy", lastError: "grok_acp_cached_auth_unsupported" });
|
|
@@ -29762,11 +29823,11 @@ class GrokAcpLane {
|
|
|
29762
29823
|
}
|
|
29763
29824
|
const authMethods = Array.isArray(initialize.authMethods) ? initialize.authMethods : [];
|
|
29764
29825
|
const authMethodIds = authMethods.flatMap((method) => {
|
|
29765
|
-
const
|
|
29766
|
-
return typeof
|
|
29826
|
+
const id2 = asRecord(method)?.id;
|
|
29827
|
+
return typeof id2 === "string" ? [id2] : [];
|
|
29767
29828
|
});
|
|
29768
29829
|
if (!authMethodIds.includes(AUTH_METHOD_ID5)) {
|
|
29769
|
-
if (authMethodIds.some((
|
|
29830
|
+
if (authMethodIds.some((id2) => INTERACTIVE_AUTH_METHOD_IDS2.has(id2))) {
|
|
29770
29831
|
throw new GrokAcpAuthenticationError("Grok authentication failed; run `grok login` and retry");
|
|
29771
29832
|
}
|
|
29772
29833
|
throw new GrokAcpIncompatibleError("Installed Grok ACP does not expose cached-token authentication");
|
|
@@ -29932,7 +29993,7 @@ class GrokAcpLane {
|
|
|
29932
29993
|
return this.request(method, params, timeoutMs ?? this.options.handshakeTimeoutMs ?? HANDSHAKE_TIMEOUT_MS2).promise;
|
|
29933
29994
|
}
|
|
29934
29995
|
request(method, params, timeoutMs) {
|
|
29935
|
-
const
|
|
29996
|
+
const id2 = ++this.requestSequence;
|
|
29936
29997
|
let resolve2;
|
|
29937
29998
|
let reject;
|
|
29938
29999
|
const promise2 = new Promise((accept, decline) => {
|
|
@@ -29940,24 +30001,24 @@ class GrokAcpLane {
|
|
|
29940
30001
|
reject = decline;
|
|
29941
30002
|
});
|
|
29942
30003
|
const timer = timeoutMs === undefined ? undefined : setTimeout(() => {
|
|
29943
|
-
const pending = this.pending.get(
|
|
30004
|
+
const pending = this.pending.get(id2);
|
|
29944
30005
|
if (!pending || pending.kind !== "call")
|
|
29945
30006
|
return;
|
|
29946
|
-
this.pending.delete(
|
|
30007
|
+
this.pending.delete(id2);
|
|
29947
30008
|
pending.reject(new Error(`Grok ACP ${method} timed out`));
|
|
29948
30009
|
}, timeoutMs);
|
|
29949
30010
|
timer?.unref?.();
|
|
29950
|
-
this.pending.set(
|
|
30011
|
+
this.pending.set(id2, { kind: "call", method, resolve: resolve2, reject, ...timer ? { timer } : {} });
|
|
29951
30012
|
try {
|
|
29952
|
-
this.write({ jsonrpc: "2.0", id, method, params });
|
|
30013
|
+
this.write({ jsonrpc: "2.0", id: id2, method, params });
|
|
29953
30014
|
} catch (error62) {
|
|
29954
|
-
const pending = this.pending.get(
|
|
29955
|
-
this.pending.delete(
|
|
30015
|
+
const pending = this.pending.get(id2);
|
|
30016
|
+
this.pending.delete(id2);
|
|
29956
30017
|
if (pending?.kind === "call" && pending.timer)
|
|
29957
30018
|
clearTimeout(pending.timer);
|
|
29958
30019
|
throw error62 instanceof Error ? error62 : new Error(String(error62));
|
|
29959
30020
|
}
|
|
29960
|
-
return { id, promise: promise2 };
|
|
30021
|
+
return { id: id2, promise: promise2 };
|
|
29961
30022
|
}
|
|
29962
30023
|
write(message2) {
|
|
29963
30024
|
const stdin = this.process?.stdin;
|
|
@@ -30057,14 +30118,14 @@ class GrokAcpLane {
|
|
|
30057
30118
|
}
|
|
30058
30119
|
this.protocolFailure("Grok ACP emitted an unrecognized JSON-RPC message");
|
|
30059
30120
|
}
|
|
30060
|
-
handleResponse(
|
|
30061
|
-
const pending = typeof
|
|
30062
|
-
if (typeof
|
|
30121
|
+
handleResponse(id2, message2) {
|
|
30122
|
+
const pending = typeof id2 === "number" ? this.pending.get(id2) : undefined;
|
|
30123
|
+
if (typeof id2 !== "number" || !pending) {
|
|
30063
30124
|
this.diagnostic("warning", "Grok ACP emitted a duplicate or unknown response id");
|
|
30064
30125
|
return;
|
|
30065
30126
|
}
|
|
30066
30127
|
if (pending.kind === "prompt") {
|
|
30067
|
-
this.pending.delete(
|
|
30128
|
+
this.pending.delete(id2);
|
|
30068
30129
|
if (message2.error !== undefined) {
|
|
30069
30130
|
const payload = asRecord(message2.error);
|
|
30070
30131
|
const code = typeof payload?.code === "number" && Number.isSafeInteger(payload.code) ? payload.code : undefined;
|
|
@@ -30078,20 +30139,20 @@ class GrokAcpLane {
|
|
|
30078
30139
|
}
|
|
30079
30140
|
if (message2.error !== undefined) {
|
|
30080
30141
|
const payload = asRecord(message2.error);
|
|
30081
|
-
this.settleRequest(
|
|
30142
|
+
this.settleRequest(id2, false, new GrokAcpRpcError(pending.method, typeof payload?.code === "number" && Number.isSafeInteger(payload.code) ? payload.code : undefined, rpcErrorMessage2(message2.error)));
|
|
30082
30143
|
return;
|
|
30083
30144
|
}
|
|
30084
30145
|
if (!("result" in message2)) {
|
|
30085
|
-
this.settleRequest(
|
|
30146
|
+
this.settleRequest(id2, false, new Error("Grok ACP response omitted result"));
|
|
30086
30147
|
return;
|
|
30087
30148
|
}
|
|
30088
|
-
this.settleRequest(
|
|
30149
|
+
this.settleRequest(id2, true, message2.result);
|
|
30089
30150
|
}
|
|
30090
|
-
settleRequest(
|
|
30091
|
-
const pending = this.pending.get(
|
|
30151
|
+
settleRequest(id2, ok, value) {
|
|
30152
|
+
const pending = this.pending.get(id2);
|
|
30092
30153
|
if (!pending || pending.kind !== "call")
|
|
30093
30154
|
return;
|
|
30094
|
-
this.pending.delete(
|
|
30155
|
+
this.pending.delete(id2);
|
|
30095
30156
|
if (pending.timer)
|
|
30096
30157
|
clearTimeout(pending.timer);
|
|
30097
30158
|
if (ok)
|
|
@@ -30099,9 +30160,9 @@ class GrokAcpLane {
|
|
|
30099
30160
|
else
|
|
30100
30161
|
pending.reject(value instanceof Error ? value : new Error(String(value)));
|
|
30101
30162
|
}
|
|
30102
|
-
handleRequest(
|
|
30163
|
+
handleRequest(id2, method, params) {
|
|
30103
30164
|
if (method !== "session/request_permission") {
|
|
30104
|
-
this.write({ jsonrpc: "2.0", id, error: { code: -32601, message: "Unsupported Grok ACP client request" } });
|
|
30165
|
+
this.write({ jsonrpc: "2.0", id: id2, error: { code: -32601, message: "Unsupported Grok ACP client request" } });
|
|
30105
30166
|
this.diagnostic("warning", `Unsupported Grok ACP client request: ${safeLabel2(method)}`);
|
|
30106
30167
|
return;
|
|
30107
30168
|
}
|
|
@@ -30109,13 +30170,13 @@ class GrokAcpLane {
|
|
|
30109
30170
|
const options = Array.isArray(payload?.options) ? payload.options.map(asRecord).filter(Boolean) : [];
|
|
30110
30171
|
const allowOnce = options.find((option) => option.kind === "allow_once" && typeof option.optionId === "string" && option.optionId.trim());
|
|
30111
30172
|
if (!this.ready || this.currentPromptRequestId === null || payload?.sessionId !== this.sessionId || !allowOnce) {
|
|
30112
|
-
this.write({ jsonrpc: "2.0", id, result: { outcome: { outcome: "cancelled" } } });
|
|
30173
|
+
this.write({ jsonrpc: "2.0", id: id2, result: { outcome: { outcome: "cancelled" } } });
|
|
30113
30174
|
this.diagnostic("error", "Grok ACP permission request was not allowed for the active prompt");
|
|
30114
30175
|
return;
|
|
30115
30176
|
}
|
|
30116
30177
|
this.write({
|
|
30117
30178
|
jsonrpc: "2.0",
|
|
30118
|
-
id,
|
|
30179
|
+
id: id2,
|
|
30119
30180
|
result: { outcome: { outcome: "selected", optionId: allowOnce.optionId } }
|
|
30120
30181
|
});
|
|
30121
30182
|
}
|
|
@@ -30277,8 +30338,8 @@ class GrokAcpLane {
|
|
|
30277
30338
|
this.stop({ reason: "protocol_error", forceAfterMs: 0 }).catch(() => {});
|
|
30278
30339
|
}
|
|
30279
30340
|
rejectAllPending(error62) {
|
|
30280
|
-
for (const [
|
|
30281
|
-
this.pending.delete(
|
|
30341
|
+
for (const [id2, pending] of [...this.pending]) {
|
|
30342
|
+
this.pending.delete(id2);
|
|
30282
30343
|
if (pending.kind === "call") {
|
|
30283
30344
|
if (pending.timer)
|
|
30284
30345
|
clearTimeout(pending.timer);
|
|
@@ -32255,10 +32316,10 @@ function createAgentDriverRegistry(registrations) {
|
|
|
32255
32316
|
const backendIds = Object.freeze([...entries.keys()]);
|
|
32256
32317
|
return Object.freeze({
|
|
32257
32318
|
backendIds,
|
|
32258
|
-
get(
|
|
32259
|
-
const registration = entries.get(
|
|
32319
|
+
get(id2) {
|
|
32320
|
+
const registration = entries.get(id2);
|
|
32260
32321
|
if (!registration)
|
|
32261
|
-
throw new Error(`Unknown agent backend: ${
|
|
32322
|
+
throw new Error(`Unknown agent backend: ${id2}`);
|
|
32262
32323
|
return registration;
|
|
32263
32324
|
}
|
|
32264
32325
|
});
|
|
@@ -34130,11 +34191,11 @@ function getDriver(runtimeId) {
|
|
|
34130
34191
|
if (!BUILTIN_BACKEND_IDS.includes(runtimeId)) {
|
|
34131
34192
|
throw new Error(`Unknown runtime: ${runtimeId}. Available: ${BUILTIN_BACKEND_IDS.join(", ")}`);
|
|
34132
34193
|
}
|
|
34133
|
-
const
|
|
34194
|
+
const id2 = runtimeId;
|
|
34134
34195
|
return {
|
|
34135
|
-
id,
|
|
34136
|
-
capabilities: capabilitiesFor(
|
|
34137
|
-
probe: () => createAgentDriverSdk2().probe({ backend:
|
|
34196
|
+
id: id2,
|
|
34197
|
+
capabilities: capabilitiesFor(id2),
|
|
34198
|
+
probe: () => createAgentDriverSdk2().probe({ backend: id2 })
|
|
34138
34199
|
};
|
|
34139
34200
|
}
|
|
34140
34201
|
function listRuntimeIds() {
|
|
@@ -34178,20 +34239,20 @@ async function detectRuntimes() {
|
|
|
34178
34239
|
const ids = listRuntimeIds();
|
|
34179
34240
|
const results = [];
|
|
34180
34241
|
const nowIso = new Date().toISOString();
|
|
34181
|
-
for (const
|
|
34242
|
+
for (const id2 of ids) {
|
|
34182
34243
|
try {
|
|
34183
|
-
const driver = getDriver(
|
|
34244
|
+
const driver = getDriver(id2);
|
|
34184
34245
|
const probe = await driver.probe();
|
|
34185
34246
|
if (probe.status === "healthy") {
|
|
34186
34247
|
results.push({
|
|
34187
|
-
id,
|
|
34248
|
+
id: id2,
|
|
34188
34249
|
status: "healthy",
|
|
34189
34250
|
version: probe.version,
|
|
34190
34251
|
reasoning: probe.reasoning
|
|
34191
34252
|
});
|
|
34192
34253
|
} else {
|
|
34193
34254
|
results.push({
|
|
34194
|
-
id,
|
|
34255
|
+
id: id2,
|
|
34195
34256
|
status: "unhealthy",
|
|
34196
34257
|
lastError: probe.error.code ?? "probe_failed",
|
|
34197
34258
|
lastErrorAt: nowIso
|
|
@@ -34199,7 +34260,7 @@ async function detectRuntimes() {
|
|
|
34199
34260
|
}
|
|
34200
34261
|
} catch (err) {
|
|
34201
34262
|
results.push({
|
|
34202
|
-
id,
|
|
34263
|
+
id: id2,
|
|
34203
34264
|
status: "unhealthy",
|
|
34204
34265
|
lastError: err?.code ?? "probe_threw",
|
|
34205
34266
|
lastErrorAt: nowIso
|
|
@@ -35265,8 +35326,8 @@ var DEFAULT_HEADER_NAMES = {
|
|
|
35265
35326
|
function randomVoucher(prefix) {
|
|
35266
35327
|
return prefix + crypto3.randomBytes(32).toString("base64url");
|
|
35267
35328
|
}
|
|
35268
|
-
function sanitizeIdSegment(
|
|
35269
|
-
return
|
|
35329
|
+
function sanitizeIdSegment(id2) {
|
|
35330
|
+
return id2.replace(/[^A-Za-z0-9._-]/g, "_") || "_";
|
|
35270
35331
|
}
|
|
35271
35332
|
|
|
35272
35333
|
class CredentialBroker {
|
|
@@ -35749,7 +35810,7 @@ var DEFAULT_TURN_SILENCE_POLICY = {
|
|
|
35749
35810
|
normalBudgetMs: 360000
|
|
35750
35811
|
};
|
|
35751
35812
|
var DEFAULT_IDLE_TIMEOUT_MS = 30 * 60 * 1000;
|
|
35752
|
-
var DEFAULT_IDLE_RESET_TIMEOUT_MS =
|
|
35813
|
+
var DEFAULT_IDLE_RESET_TIMEOUT_MS = 3 * 60 * 60 * 1000;
|
|
35753
35814
|
var DEFAULT_RESET_STUCK_THRESHOLD_MS = 120000;
|
|
35754
35815
|
var DEFAULT_STOPPING_STUCK_THRESHOLD_MS = 30000;
|
|
35755
35816
|
function createInitialManagerState(staleThresholdMs = DEFAULT_STALE_THRESHOLD_MS, idleTimeoutMs = DEFAULT_IDLE_TIMEOUT_MS, resetStuckThresholdMs = DEFAULT_RESET_STUCK_THRESHOLD_MS, stoppingStuckThresholdMs = DEFAULT_STOPPING_STUCK_THRESHOLD_MS, idleResetTimeoutMs = DEFAULT_IDLE_RESET_TIMEOUT_MS) {
|
|
@@ -35861,22 +35922,6 @@ function reduceManager(state, event) {
|
|
|
35861
35922
|
a.stalledSessionId = null;
|
|
35862
35923
|
a.idleSince = null;
|
|
35863
35924
|
});
|
|
35864
|
-
case "idle_reset_committed": {
|
|
35865
|
-
const existing = state.agents[event.agentId];
|
|
35866
|
-
if (!existing)
|
|
35867
|
-
return { state, effects: [] };
|
|
35868
|
-
const agent2 = clone2(existing);
|
|
35869
|
-
agent2.sessionId = null;
|
|
35870
|
-
agent2.stalledSessionId = null;
|
|
35871
|
-
agent2.idleSince = null;
|
|
35872
|
-
if (agent2.status !== "running")
|
|
35873
|
-
return commit(state, agent2, []);
|
|
35874
|
-
agent2.status = "stopping";
|
|
35875
|
-
agent2.stoppingSince = event.nowMs;
|
|
35876
|
-
return commit(state, agent2, [
|
|
35877
|
-
{ type: "stop", agentId: event.agentId, reason: "idle_session_reset" }
|
|
35878
|
-
]);
|
|
35879
|
-
}
|
|
35880
35925
|
case "begin_reset":
|
|
35881
35926
|
if (!state.agents[event.agentId])
|
|
35882
35927
|
return { state, effects: [] };
|
|
@@ -36238,14 +36283,14 @@ function onExit(state, agentId) {
|
|
|
36238
36283
|
function onTick(state, nowMs) {
|
|
36239
36284
|
const effects = [];
|
|
36240
36285
|
const agents = { ...state.agents };
|
|
36241
|
-
for (const
|
|
36242
|
-
const a = agents[
|
|
36286
|
+
for (const id2 of Object.keys(agents)) {
|
|
36287
|
+
const a = agents[id2];
|
|
36243
36288
|
const lease = a.execution.lease;
|
|
36244
36289
|
const stalled = a.status === "running" && (lease.state === "active" || lease.state === "suspect_active") && (lease.outstandingToolUses ?? 0) === 0 && nowMs - lease.lastWorkAt >= a.turnSilence.normalBudgetMs && nowMs >= lease.nativeDeadlineAt;
|
|
36245
36290
|
if (stalled) {
|
|
36246
36291
|
const repeatedSessionStall = a.sessionId !== null && a.stalledSessionId === a.sessionId;
|
|
36247
36292
|
const forgetSessionId = repeatedSessionStall ? a.sessionId : undefined;
|
|
36248
|
-
agents[
|
|
36293
|
+
agents[id2] = {
|
|
36249
36294
|
...a,
|
|
36250
36295
|
status: "stopping",
|
|
36251
36296
|
sessionId: repeatedSessionStall ? null : a.sessionId,
|
|
@@ -36253,12 +36298,12 @@ function onTick(state, nowMs) {
|
|
|
36253
36298
|
idleSince: null,
|
|
36254
36299
|
stoppingSince: nowMs
|
|
36255
36300
|
};
|
|
36256
|
-
effects.push(forgetSessionId ? { type: "terminate_stalled", agentId:
|
|
36301
|
+
effects.push(forgetSessionId ? { type: "terminate_stalled", agentId: id2, forgetSessionId } : a.sessionId !== null ? { type: "terminate_stalled", agentId: id2, recordSessionId: a.sessionId } : { type: "terminate_stalled", agentId: id2 });
|
|
36257
36302
|
continue;
|
|
36258
36303
|
}
|
|
36259
36304
|
const expiredAdmission = a.status === "running" && a.pendingAdmissions.filter((entry) => !entry.driverAcknowledged && nowMs - entry.admittedAt >= state.staleThresholdMs);
|
|
36260
36305
|
if (expiredAdmission && expiredAdmission.length > 0 && a.execution.sessionInstanceId !== null) {
|
|
36261
|
-
agents[
|
|
36306
|
+
agents[id2] = {
|
|
36262
36307
|
...a,
|
|
36263
36308
|
pendingAdmissions: a.pendingAdmissions.filter((entry) => !expiredAdmission.includes(entry)),
|
|
36264
36309
|
status: "stopping",
|
|
@@ -36268,7 +36313,7 @@ function onTick(state, nowMs) {
|
|
|
36268
36313
|
effects.push(...recoveryEffects(a, expiredAdmission));
|
|
36269
36314
|
effects.push({
|
|
36270
36315
|
type: "expire_admission",
|
|
36271
|
-
agentId:
|
|
36316
|
+
agentId: id2,
|
|
36272
36317
|
sessionInstanceId: a.execution.sessionInstanceId,
|
|
36273
36318
|
commandIds: expiredAdmission.map((entry) => entry.commandId)
|
|
36274
36319
|
});
|
|
@@ -36276,24 +36321,25 @@ function onTick(state, nowMs) {
|
|
|
36276
36321
|
}
|
|
36277
36322
|
const resetStuck = a.resetting && a.status !== "stopping" && a.resettingSince !== null && nowMs - a.resettingSince >= state.resetStuckThresholdMs;
|
|
36278
36323
|
if (resetStuck) {
|
|
36279
|
-
agents[
|
|
36280
|
-
effects.push({ type: "terminate_stalled", agentId:
|
|
36324
|
+
agents[id2] = { ...a, status: "stopping", idleSince: null, stoppingSince: nowMs };
|
|
36325
|
+
effects.push({ type: "terminate_stalled", agentId: id2 });
|
|
36281
36326
|
continue;
|
|
36282
36327
|
}
|
|
36283
36328
|
const stoppingStuck = a.status === "stopping" && a.stoppingSince !== null && nowMs - a.stoppingSince >= state.stoppingStuckThresholdMs;
|
|
36284
36329
|
if (stoppingStuck) {
|
|
36285
|
-
effects.push({ type: "force_exit", agentId:
|
|
36330
|
+
effects.push({ type: "force_exit", agentId: id2, reason: "stopping_stuck" });
|
|
36286
36331
|
continue;
|
|
36287
36332
|
}
|
|
36288
36333
|
const idleResetEligible = a.idleSince !== null && a.sessionId !== null && a.inbox.length === 0 && a.pendingAdmissions.length === 0 && !a.resetting && state.idleResetTimeoutMs > 0 && Number.isFinite(state.idleResetTimeoutMs) && (a.status === "idle" && lease.state === "detached" || a.status === "running" && lease.state === "none" && lease.lastTerminal !== null);
|
|
36289
36334
|
if (idleResetEligible && nowMs - a.idleSince >= state.idleResetTimeoutMs) {
|
|
36290
|
-
|
|
36335
|
+
agents[id2] = { ...a, idleSince: nowMs };
|
|
36336
|
+
effects.push({ type: "maintain_idle_memory", agentId: id2, sessionId: a.sessionId });
|
|
36291
36337
|
continue;
|
|
36292
36338
|
}
|
|
36293
36339
|
const idleEligible = a.status === "running" && lease.state === "none" && a.pendingAdmissions.length === 0 && lease.lastTerminal !== null && a.inbox.length === 0 && state.idleTimeoutMs > 0 && Number.isFinite(state.idleTimeoutMs);
|
|
36294
36340
|
if (idleEligible && a.idleSince !== null && nowMs - a.idleSince >= state.idleTimeoutMs) {
|
|
36295
|
-
agents[
|
|
36296
|
-
effects.push({ type: "stop", agentId:
|
|
36341
|
+
agents[id2] = { ...a, status: "stopping", stoppingSince: nowMs };
|
|
36342
|
+
effects.push({ type: "stop", agentId: id2, reason: "idle_timeout" });
|
|
36297
36343
|
}
|
|
36298
36344
|
}
|
|
36299
36345
|
return { state: { ...state, agents }, effects };
|
|
@@ -36400,6 +36446,18 @@ function withAgent(state, agentId, make, effects) {
|
|
|
36400
36446
|
const agent2 = make(state.agents[agentId]);
|
|
36401
36447
|
return { state: { ...state, agents: { ...state.agents, [agentId]: agent2 } }, effects };
|
|
36402
36448
|
}
|
|
36449
|
+
// src/manager/memoryMaintenancePrompt.ts
|
|
36450
|
+
var MEMORY_MAINTENANCE_PROMPT = `The daemon is preparing to reset this idle session. First, clean up your memory so the next session does not inherit incorrect or outdated notes.
|
|
36451
|
+
|
|
36452
|
+
1. Consistency: Read memory.md and experiences. Merge duplicates and resolve conflicting notes against original decisions. Check links.
|
|
36453
|
+
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.
|
|
36454
|
+
3. 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.
|
|
36455
|
+
|
|
36456
|
+
Edit only your own memory files.
|
|
36457
|
+
|
|
36458
|
+
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:
|
|
36459
|
+
|
|
36460
|
+
$ALOOK_CLI nap`;
|
|
36403
36461
|
// src/runtimeConfig.ts
|
|
36404
36462
|
function toAgentBackendSelection(config2) {
|
|
36405
36463
|
return toBuiltinBackendSelection(config2);
|
|
@@ -36635,7 +36693,7 @@ function cliCommandsSection() {
|
|
|
36635
36693
|
"",
|
|
36636
36694
|
"### Context Lifecycle",
|
|
36637
36695
|
"",
|
|
36638
|
-
`1. \`${CLI} nap --handoff <file
|
|
36696
|
+
`1. \`${CLI} nap [--handoff <file>]\` — reset the current session; optionally wake a fresh session with a handoff file.`,
|
|
36639
36697
|
"",
|
|
36640
36698
|
"### Output format",
|
|
36641
36699
|
"",
|
|
@@ -36856,7 +36914,7 @@ function workspaceMemorySection(config2) {
|
|
|
36856
36914
|
"",
|
|
36857
36915
|
"### Napping",
|
|
36858
36916
|
"",
|
|
36859
|
-
`\`${CLI} nap\` resets your current session
|
|
36917
|
+
`\`${CLI} nap\` resets your current session. With optional --handoff <file>, it starts a fresh one ` + "with your note injected; without it, the next real message starts fresh. Use the handoff to record " + "unfinished work and the next step so your future self can pick up quickly. " + "Never nap on your own; only do it when someone explicitly asks.",
|
|
36860
36918
|
"",
|
|
36861
36919
|
"### memory.md",
|
|
36862
36920
|
"",
|
|
@@ -37397,8 +37455,15 @@ class AgentProcessManager {
|
|
|
37397
37455
|
this.opts.timeline?.fenceSession(agentId);
|
|
37398
37456
|
this.abortCurrentTurn(agentId, opts.abortCause);
|
|
37399
37457
|
this.markResetting(agentId);
|
|
37458
|
+
const previousOwner = this.activeSpawnState.get(agentId);
|
|
37459
|
+
if (opts.forgetSession && previousOwner)
|
|
37460
|
+
previousOwner.discardEvents = true;
|
|
37400
37461
|
const status = this.state.agents[agentId]?.status;
|
|
37401
37462
|
if (status === "idle") {
|
|
37463
|
+
if (opts.rewakePrompt === undefined) {
|
|
37464
|
+
this.dispatch({ type: "exit", agentId });
|
|
37465
|
+
return;
|
|
37466
|
+
}
|
|
37402
37467
|
try {
|
|
37403
37468
|
this.deliver(agentId, {
|
|
37404
37469
|
id: `${opts.launchId}:${opts.abortCause}:rewake`,
|
|
@@ -37414,11 +37479,16 @@ class AgentProcessManager {
|
|
|
37414
37479
|
}
|
|
37415
37480
|
return;
|
|
37416
37481
|
}
|
|
37417
|
-
|
|
37418
|
-
|
|
37419
|
-
|
|
37420
|
-
|
|
37482
|
+
if (opts.rewakePrompt !== undefined) {
|
|
37483
|
+
this.enqueueRewake(agentId, {
|
|
37484
|
+
id: `${opts.launchId}:${opts.abortCause}:rewake`,
|
|
37485
|
+
text: opts.rewakePrompt
|
|
37486
|
+
});
|
|
37487
|
+
}
|
|
37488
|
+
const previousSession = previousOwner?.session ?? this.sessions.get(agentId);
|
|
37421
37489
|
await this.stop(agentId);
|
|
37490
|
+
if (opts.rewakePrompt === undefined && previousSession)
|
|
37491
|
+
await previousSession.closed;
|
|
37422
37492
|
}
|
|
37423
37493
|
async switchModel(agentId, opts) {
|
|
37424
37494
|
await this.restartAgent(agentId, {
|
|
@@ -37667,8 +37737,8 @@ class AgentProcessManager {
|
|
|
37667
37737
|
if (eventAgentId) {
|
|
37668
37738
|
emit(eventAgentId);
|
|
37669
37739
|
} else if (event.type === "tick") {
|
|
37670
|
-
for (const
|
|
37671
|
-
emit(
|
|
37740
|
+
for (const id2 of Object.keys(this.state.agents))
|
|
37741
|
+
emit(id2);
|
|
37672
37742
|
}
|
|
37673
37743
|
}
|
|
37674
37744
|
if (closingOwner && closingSpan) {
|
|
@@ -37960,44 +38030,13 @@ ${this.opts.wakePromptFooter}` : text2;
|
|
|
37960
38030
|
mode: effect.mode
|
|
37961
38031
|
});
|
|
37962
38032
|
break;
|
|
37963
|
-
case "
|
|
37964
|
-
const
|
|
37965
|
-
|
|
37966
|
-
eventId: `bae_${randomUUID6()}`,
|
|
37967
|
-
occurredAt: new Date(this.now()).toISOString()
|
|
37968
|
-
};
|
|
37969
|
-
const persisted = this.forgetSession(effect.agentId, "reset_session", effect.sessionId, completion);
|
|
37970
|
-
if (!persisted) {
|
|
37971
|
-
this.log.error("idle session reset barrier was not persisted; reset deferred", {
|
|
37972
|
-
agentId: effect.agentId,
|
|
37973
|
-
sessionId: effect.sessionId
|
|
37974
|
-
});
|
|
37975
|
-
this.emitErrorAudit(effect.agentId, "reset", "resume_control_update_failed", "Idle session reset deferred because resume control could not be persisted");
|
|
38033
|
+
case "maintain_idle_memory": {
|
|
38034
|
+
const agent2 = this.state.agents[effect.agentId];
|
|
38035
|
+
if (!agent2 || agent2.sessionId !== effect.sessionId || agent2.resetting || agent2.idleSince === null)
|
|
37976
38036
|
break;
|
|
37977
|
-
|
|
37978
|
-
|
|
37979
|
-
|
|
37980
|
-
this.dispatch({ type: "idle_reset_committed", agentId: effect.agentId, nowMs: this.now() });
|
|
37981
|
-
if (this.opts.onBotAuditEvent) {
|
|
37982
|
-
try {
|
|
37983
|
-
this.opts.onBotAuditEvent(effect.agentId, {
|
|
37984
|
-
kind: "session_reset",
|
|
37985
|
-
payload: { trigger: "idle_timeout" }
|
|
37986
|
-
}, {
|
|
37987
|
-
sessionId: null,
|
|
37988
|
-
launchId: null,
|
|
37989
|
-
...completion
|
|
37990
|
-
});
|
|
37991
|
-
} catch (err) {
|
|
37992
|
-
this.log.debug("audit emit failed (idle session reset)", {
|
|
37993
|
-
agentId: effect.agentId,
|
|
37994
|
-
err: String(err)
|
|
37995
|
-
});
|
|
37996
|
-
}
|
|
37997
|
-
}
|
|
37998
|
-
this.log.info("idle agent session reset", {
|
|
37999
|
-
agentId: effect.agentId,
|
|
38000
|
-
sessionId: effect.sessionId
|
|
38037
|
+
this.deliver(effect.agentId, {
|
|
38038
|
+
id: `${effect.agentId}:memory-maintenance:${randomUUID6()}`,
|
|
38039
|
+
text: MEMORY_MAINTENANCE_PROMPT
|
|
38001
38040
|
});
|
|
38002
38041
|
break;
|
|
38003
38042
|
}
|
|
@@ -38653,7 +38692,15 @@ class UnknownRuntimeError extends Error {
|
|
|
38653
38692
|
function defaultFormatUnreadNoticeText() {
|
|
38654
38693
|
return "You have unread messages.";
|
|
38655
38694
|
}
|
|
38656
|
-
var REWAKE_PROMPT =
|
|
38695
|
+
var REWAKE_PROMPT = `Your session was reset by your owner. Prior conversation context is gone. Read @memory.md and your .context_timeline for durable context, then pull your inbox. If it reports marked messages, run \`$ALOOK_CLI message mark list\` to identify outstanding work. Before continuing work, review memory.md and experiences:
|
|
38696
|
+
|
|
38697
|
+
1. Consistency: Read memory.md and experiences. Merge duplicates and resolve conflicting notes against original decisions. Check links.
|
|
38698
|
+
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.
|
|
38699
|
+
3. 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.
|
|
38700
|
+
|
|
38701
|
+
Edit only your own memory files.
|
|
38702
|
+
|
|
38703
|
+
After completing the review and any needed edits, resume outstanding work and handle your inbox messages.`;
|
|
38657
38704
|
var MODEL_SWITCH_REWAKE_PROMPT = "You were just switched to a different model. Continue any unfinished work.";
|
|
38658
38705
|
function buildNapRewakePrompt(handoff2) {
|
|
38659
38706
|
return "You took a nap: you reset your own session, so prior conversation context " + `is gone. Before sleeping you left yourself this handoff —
|
|
@@ -38719,32 +38766,32 @@ class AgentRouter {
|
|
|
38719
38766
|
}
|
|
38720
38767
|
return out;
|
|
38721
38768
|
}
|
|
38722
|
-
isRuntimeHealthy(
|
|
38723
|
-
return this.runtimes.get(
|
|
38769
|
+
isRuntimeHealthy(id2) {
|
|
38770
|
+
return this.runtimes.get(id2)?.status === "healthy";
|
|
38724
38771
|
}
|
|
38725
|
-
recordRuntimeSpawnFailure(
|
|
38772
|
+
recordRuntimeSpawnFailure(id2, reason) {
|
|
38726
38773
|
if (!DEFINITIVE_EXECUTABLE_FAILURES.has(reason))
|
|
38727
38774
|
return;
|
|
38728
|
-
this.markRuntimeUnhealthy(
|
|
38775
|
+
this.markRuntimeUnhealthy(id2, reason);
|
|
38729
38776
|
}
|
|
38730
|
-
markRuntimeUnhealthy(
|
|
38731
|
-
const existing = this.runtimes.get(
|
|
38777
|
+
markRuntimeUnhealthy(id2, reason) {
|
|
38778
|
+
const existing = this.runtimes.get(id2);
|
|
38732
38779
|
if (!existing)
|
|
38733
38780
|
return;
|
|
38734
38781
|
const nowIso = new Date().toISOString();
|
|
38735
38782
|
if (existing.status === "unhealthy" && existing.lastError === reason)
|
|
38736
38783
|
return;
|
|
38737
|
-
this.runtimes.set(
|
|
38784
|
+
this.runtimes.set(id2, {
|
|
38738
38785
|
...existing,
|
|
38739
38786
|
status: "unhealthy",
|
|
38740
38787
|
lastError: reason,
|
|
38741
38788
|
lastErrorAt: nowIso
|
|
38742
38789
|
});
|
|
38743
|
-
this.log.warn("runtime marked unhealthy", { runtimeId:
|
|
38790
|
+
this.log.warn("runtime marked unhealthy", { runtimeId: id2, reason });
|
|
38744
38791
|
this.scheduleReadyFrameResend();
|
|
38745
38792
|
}
|
|
38746
|
-
markRuntimeHealthy(
|
|
38747
|
-
const existing = this.runtimes.get(
|
|
38793
|
+
markRuntimeHealthy(id2) {
|
|
38794
|
+
const existing = this.runtimes.get(id2);
|
|
38748
38795
|
if (!existing)
|
|
38749
38796
|
return;
|
|
38750
38797
|
if (existing.status === "healthy" && !existing.lastError && !existing.lastErrorAt)
|
|
@@ -38752,8 +38799,8 @@ class AgentRouter {
|
|
|
38752
38799
|
const healthy = { ...existing, status: "healthy" };
|
|
38753
38800
|
delete healthy.lastError;
|
|
38754
38801
|
delete healthy.lastErrorAt;
|
|
38755
|
-
this.runtimes.set(
|
|
38756
|
-
this.log.info("runtime marked healthy again", { runtimeId:
|
|
38802
|
+
this.runtimes.set(id2, healthy);
|
|
38803
|
+
this.log.info("runtime marked healthy again", { runtimeId: id2 });
|
|
38757
38804
|
this.scheduleReadyFrameResend();
|
|
38758
38805
|
}
|
|
38759
38806
|
markLocallyStopped(agentId) {
|
|
@@ -38773,13 +38820,17 @@ class AgentRouter {
|
|
|
38773
38820
|
} catch {}
|
|
38774
38821
|
});
|
|
38775
38822
|
}
|
|
38776
|
-
async runRestartCommand(agentId, launchId, opName, run) {
|
|
38823
|
+
async runRestartCommand(agentId, launchId, opName, run, rewake = true) {
|
|
38777
38824
|
this.log.info(`${opName} received`, { agentId, launchId });
|
|
38778
38825
|
try {
|
|
38779
38826
|
await this.opts.onBeforeAgent?.(agentId);
|
|
38780
38827
|
await run();
|
|
38781
|
-
|
|
38782
|
-
|
|
38828
|
+
if (rewake) {
|
|
38829
|
+
this.running.add(agentId);
|
|
38830
|
+
this.scheduleReadyFrameResend();
|
|
38831
|
+
} else {
|
|
38832
|
+
await this.opts.channel.reportStoppedAck?.({ agentId, launchId, status: "ok" });
|
|
38833
|
+
}
|
|
38783
38834
|
this.log.info(`${opName} ok`, { agentId });
|
|
38784
38835
|
} catch (err) {
|
|
38785
38836
|
if (err instanceof UnknownRuntimeError) {
|
|
@@ -38957,9 +39008,9 @@ class AgentRouter {
|
|
|
38957
39008
|
await this.runRestartCommand(cmd.agentId, cmd.launchId, "agent:nap", () => this.opts.manager.resetSession(cmd.agentId, {
|
|
38958
39009
|
runtimeConfig: cmd.config,
|
|
38959
39010
|
launchId: cmd.launchId,
|
|
38960
|
-
rewakePrompt: buildNapRewakePrompt(cmd.handoff),
|
|
39011
|
+
rewakePrompt: cmd.handoff === undefined ? undefined : buildNapRewakePrompt(cmd.handoff),
|
|
38961
39012
|
barrierType: "nap"
|
|
38962
|
-
}));
|
|
39013
|
+
}), cmd.handoff !== undefined);
|
|
38963
39014
|
break;
|
|
38964
39015
|
case "agent:model_switch":
|
|
38965
39016
|
await this.runRestartCommand(cmd.agentId, cmd.launchId, "agent:model_switch", () => this.opts.manager.switchModel(cmd.agentId, {
|
|
@@ -43604,27 +43655,27 @@ var log2 = createLogger2({ header: "@alook/daemon" });
|
|
|
43604
43655
|
function daemonsDir(baseDir) {
|
|
43605
43656
|
return path17.join(baseDir, "daemons");
|
|
43606
43657
|
}
|
|
43607
|
-
function daemonDirById(baseDir,
|
|
43608
|
-
return path17.join(daemonsDir(baseDir), validateDaemonId(
|
|
43658
|
+
function daemonDirById(baseDir, id2) {
|
|
43659
|
+
return path17.join(daemonsDir(baseDir), validateDaemonId(id2));
|
|
43609
43660
|
}
|
|
43610
43661
|
function validateMachineId(machineId) {
|
|
43611
43662
|
if (!MACHINE_ID_PATTERN.test(machineId))
|
|
43612
43663
|
throw new Error("invalid machine identity returned by server");
|
|
43613
43664
|
return machineId;
|
|
43614
43665
|
}
|
|
43615
|
-
function isDaemonId(
|
|
43616
|
-
return MACHINE_ID_PATTERN.test(
|
|
43666
|
+
function isDaemonId(id2) {
|
|
43667
|
+
return MACHINE_ID_PATTERN.test(id2) || LEGACY_DAEMON_ID_PATTERN.test(id2);
|
|
43617
43668
|
}
|
|
43618
|
-
function validateDaemonId(
|
|
43619
|
-
if (!isDaemonId(
|
|
43669
|
+
function validateDaemonId(id2) {
|
|
43670
|
+
if (!isDaemonId(id2))
|
|
43620
43671
|
throw new Error("invalid daemon id");
|
|
43621
|
-
return
|
|
43672
|
+
return id2;
|
|
43622
43673
|
}
|
|
43623
|
-
function pidfilePathById(baseDir,
|
|
43624
|
-
return path17.join(daemonDirById(baseDir,
|
|
43674
|
+
function pidfilePathById(baseDir, id2) {
|
|
43675
|
+
return path17.join(daemonDirById(baseDir, id2), "daemon.pid");
|
|
43625
43676
|
}
|
|
43626
|
-
function statusFilePathById(baseDir,
|
|
43627
|
-
return path17.join(daemonDirById(baseDir,
|
|
43677
|
+
function statusFilePathById(baseDir, id2) {
|
|
43678
|
+
return path17.join(daemonDirById(baseDir, id2), "status.json");
|
|
43628
43679
|
}
|
|
43629
43680
|
function isProcessAlive(pid) {
|
|
43630
43681
|
try {
|
|
@@ -43960,7 +44011,7 @@ function daemonList(opts) {
|
|
|
43960
44011
|
return [];
|
|
43961
44012
|
const results = [];
|
|
43962
44013
|
const now = Date.now();
|
|
43963
|
-
const pushRow = (
|
|
44014
|
+
const pushRow = (id2, pidfile, statusPath) => {
|
|
43964
44015
|
const data = readPidFile(pidfile);
|
|
43965
44016
|
if (!data)
|
|
43966
44017
|
return;
|
|
@@ -43984,12 +44035,12 @@ function daemonList(opts) {
|
|
|
43984
44035
|
lastActiveMs = daemonLastActiveMs(s, now);
|
|
43985
44036
|
}
|
|
43986
44037
|
}
|
|
43987
|
-
results.push({ id, pid: data.pid, alive, agents, running, lastActiveMs });
|
|
44038
|
+
results.push({ id: id2, pid: data.pid, alive, agents, running, lastActiveMs });
|
|
43988
44039
|
};
|
|
43989
44040
|
for (const entry of fs12.readdirSync(dir, { withFileTypes: true })) {
|
|
43990
44041
|
if (entry.isDirectory() && isDaemonId(entry.name)) {
|
|
43991
|
-
const
|
|
43992
|
-
pushRow(
|
|
44042
|
+
const id2 = entry.name;
|
|
44043
|
+
pushRow(id2, path17.join(dir, id2, "daemon.pid"), path17.join(dir, id2, "status.json"));
|
|
43993
44044
|
}
|
|
43994
44045
|
}
|
|
43995
44046
|
return results;
|
|
@@ -44769,10 +44820,10 @@ function getApi() {
|
|
|
44769
44820
|
throw new CliError("no ServerApi available — ALOOK_PROXY_URL + ALOOK_PROXY_TOKEN_FILE must be set");
|
|
44770
44821
|
}
|
|
44771
44822
|
function agentId(opts) {
|
|
44772
|
-
const
|
|
44773
|
-
if (!
|
|
44823
|
+
const id2 = opts.agent || process.env.ALOOK_AGENT_ID || process.env.ALOOK_ID;
|
|
44824
|
+
if (!id2)
|
|
44774
44825
|
throw new CliError("agent identity required — pass --agent <id> or set ALOOK_AGENT_ID");
|
|
44775
|
-
return
|
|
44826
|
+
return id2;
|
|
44776
44827
|
}
|
|
44777
44828
|
var TEXT_ESCAPE_MAP = { n: `
|
|
44778
44829
|
`, t: "\t", r: "\r", "\\": "\\" };
|
|
@@ -44912,14 +44963,23 @@ ${MESSAGE_SEND_STDIN_POLICY}`);
|
|
|
44912
44963
|
replyToSeq = n;
|
|
44913
44964
|
}
|
|
44914
44965
|
const nonce = randomUUID11();
|
|
44915
|
-
|
|
44916
|
-
|
|
44917
|
-
|
|
44918
|
-
|
|
44919
|
-
|
|
44920
|
-
|
|
44921
|
-
|
|
44922
|
-
|
|
44966
|
+
let res;
|
|
44967
|
+
try {
|
|
44968
|
+
res = await sendWithRetry(api2, {
|
|
44969
|
+
agentId: agent2,
|
|
44970
|
+
channel: channel2,
|
|
44971
|
+
content: { text: text2 ?? "" },
|
|
44972
|
+
attachments: attachmentIds.length > 0 ? attachmentIds : undefined,
|
|
44973
|
+
replyToSeq,
|
|
44974
|
+
nonce,
|
|
44975
|
+
...opts.force === true ? { force: true } : {}
|
|
44976
|
+
});
|
|
44977
|
+
} catch (err) {
|
|
44978
|
+
if (err instanceof Error && "code" in err && err.code === "duplicate_message") {
|
|
44979
|
+
err.hint = "If this message really needs to be sent, retry with --force. This only bypasses duplicate detection; channel alignment is still required.";
|
|
44980
|
+
}
|
|
44981
|
+
throw err;
|
|
44982
|
+
}
|
|
44923
44983
|
if (res.state === "blocked") {
|
|
44924
44984
|
throw new CliError(`channel not aligned: ${res.unreadCount} unread message(s) in ${channel2} (latest #${res.latestSeq}). Run \`alook inbox pull\` and READ the new messages before deciding whether to resend, adjust, or skip your message.`);
|
|
44925
44985
|
}
|
|
@@ -45052,14 +45112,14 @@ async function cmdAttachmentUpload(opts) {
|
|
|
45052
45112
|
async function cmdAttachmentDownload(opts) {
|
|
45053
45113
|
const api2 = getApi();
|
|
45054
45114
|
const agent2 = agentId(opts);
|
|
45055
|
-
const
|
|
45056
|
-
if (!
|
|
45115
|
+
const id2 = opts.id;
|
|
45116
|
+
if (!id2)
|
|
45057
45117
|
throw new CliError("message attachment download: --id <id> is required");
|
|
45058
45118
|
const outFlag = opts.out;
|
|
45059
45119
|
const os4 = await import("os");
|
|
45060
45120
|
const pathMod = await import("path");
|
|
45061
|
-
const destPath = outFlag ?? pathMod.join(os4.tmpdir(), "alook-attachments", agent2,
|
|
45062
|
-
const result = await api2.attachmentDownload({ agentId: agent2, id, destPath });
|
|
45121
|
+
const destPath = outFlag ?? pathMod.join(os4.tmpdir(), "alook-attachments", agent2, id2, "file");
|
|
45122
|
+
const result = await api2.attachmentDownload({ agentId: agent2, id: id2, destPath });
|
|
45063
45123
|
if (!outFlag) {
|
|
45064
45124
|
const fs13 = await import("fs/promises");
|
|
45065
45125
|
const destDir = pathMod.dirname(destPath);
|
|
@@ -45285,10 +45345,10 @@ async function cmdNap(opts) {
|
|
|
45285
45345
|
filePath: fileFlag,
|
|
45286
45346
|
fileOption: "--handoff <file>"
|
|
45287
45347
|
});
|
|
45288
|
-
if (handoff2
|
|
45289
|
-
throw new CliError("nap:
|
|
45348
|
+
if (handoff2 !== undefined && handoff2.trim().length === 0) {
|
|
45349
|
+
throw new CliError("nap: handoff file must not be blank");
|
|
45290
45350
|
}
|
|
45291
|
-
return await api2.nap({ handoff: handoff2 });
|
|
45351
|
+
return await api2.nap(handoff2 === undefined ? {} : { handoff: handoff2 });
|
|
45292
45352
|
}
|
|
45293
45353
|
function buildProgram(stdin) {
|
|
45294
45354
|
const program = new Command("alook").description("agent CLI").exitOverride().configureOutput({
|
|
@@ -45297,7 +45357,7 @@ function buildProgram(stdin) {
|
|
|
45297
45357
|
}).option("--agent <id>", "agent identity (or ALOOK_AGENT_ID env)");
|
|
45298
45358
|
const message2 = program.command("message").description("message operations").exitOverride();
|
|
45299
45359
|
message2.configureOutput({ writeOut: () => {}, writeErr: () => {} });
|
|
45300
|
-
message2.command("send").description("send a message to a channel, DM, or thread").option("--target <ref>", "destination (path-style ref, e.g. /demo-workspace#1234/general)").requiredOption("--stdin", "read the required UTF-8 message body from non-TTY stdin (max 1 KiB)").option("-a, --attachment <id>", "attach an uploaded file by id (repeatable — order = message order)", (v, prev = []) => [...prev, v], []).option("--reply <seq>", 'reply to a message by its seq in --target (e.g. "#37" or 37)').requiredOption("--remind-after <0|Nm|Nh>", "required idle follow-up: 0 disables; 1m..24h arms/resets one same-scope timer; a newer message or daemon restart cancels it").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
45360
|
+
message2.command("send").description("send a message to a channel, DM, or thread").option("--target <ref>", "destination (path-style ref, e.g. /demo-workspace#1234/general)").requiredOption("--stdin", "read the required UTF-8 message body from non-TTY stdin (max 1 KiB)").option("-a, --attachment <id>", "attach an uploaded file by id (repeatable — order = message order)", (v, prev = []) => [...prev, v], []).option("--force", "bypass duplicate detection only; channel alignment and other send checks still apply").option("--reply <seq>", 'reply to a message by its seq in --target (e.g. "#37" or 37)').requiredOption("--remind-after <0|Nm|Nh>", "required idle follow-up: 0 disables; 1m..24h arms/resets one same-scope timer; a newer message or daemon restart cancels it").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
45301
45361
|
const localOpts = this.opts();
|
|
45302
45362
|
const globalOpts = program.opts();
|
|
45303
45363
|
const result = await cmdMessageSend({ ...globalOpts, ...localOpts }, stdin);
|
|
@@ -45417,7 +45477,7 @@ function buildProgram(stdin) {
|
|
|
45417
45477
|
const result = await cmdSettingProfile({ ...program.opts(), ...this.opts() });
|
|
45418
45478
|
printEnvelope({ success: result });
|
|
45419
45479
|
});
|
|
45420
|
-
program.command("nap").description("
|
|
45480
|
+
program.command("nap").description("reset your session; optionally wake a fresh session with a handoff (read the nap rule first)").option("--handoff <file>", "path to your handoff note (your note to your reborn self)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
45421
45481
|
const localOpts = this.opts();
|
|
45422
45482
|
const globalOpts = program.opts();
|
|
45423
45483
|
const result = await cmdNap({ ...globalOpts, ...localOpts });
|
|
@@ -45428,13 +45488,13 @@ function buildProgram(stdin) {
|
|
|
45428
45488
|
daemon.command("start").description("start the daemon (connects to server, manages agent lifecycles)").option("--machine-key <key>", "machine key for first-time pairing").option("--id <machineId>", "restart a previously paired machine by id").option("--server-url <url>", "server HTTP URL (or ALOOK_SERVER_URL; defaults to production)").option("--ws-url <url>", "server WebSocket URL (or ALOOK_SERVER_WS_URL; defaults to production)").option("--base-dir <path>", "data directory for agent workspaces and pidfile (or ALOOK_DATA_DIR env)").option("--foreground", "run in the current process and tee daemon logs to the terminal").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
45429
45489
|
const localOpts = this.opts();
|
|
45430
45490
|
const machineKey = localOpts.machineKey;
|
|
45431
|
-
const
|
|
45432
|
-
if (!machineKey && !
|
|
45491
|
+
const id2 = localOpts.id;
|
|
45492
|
+
if (!machineKey && !id2 || machineKey && id2) {
|
|
45433
45493
|
throw new CliError("daemon start requires exactly one of --machine-key <key> or --id <machineId>");
|
|
45434
45494
|
}
|
|
45435
|
-
if (
|
|
45495
|
+
if (id2) {
|
|
45436
45496
|
await daemonStartById({
|
|
45437
|
-
id,
|
|
45497
|
+
id: id2,
|
|
45438
45498
|
baseDir: localOpts.baseDir,
|
|
45439
45499
|
foreground: localOpts.foreground === true
|
|
45440
45500
|
});
|
|
@@ -45477,10 +45537,10 @@ function buildProgram(stdin) {
|
|
|
45477
45537
|
requestId: localOpts.requestId
|
|
45478
45538
|
});
|
|
45479
45539
|
});
|
|
45480
|
-
daemon.command("stop").argument("<id>", "daemon id from `alook daemon list` (the ID column)").description("stop a daemon by its id (from `alook daemon list`)").option("--base-dir <path>", "data directory (or ALOOK_DATA_DIR env)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function(
|
|
45540
|
+
daemon.command("stop").argument("<id>", "daemon id from `alook daemon list` (the ID column)").description("stop a daemon by its id (from `alook daemon list`)").option("--base-dir <path>", "data directory (or ALOOK_DATA_DIR env)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function(id2) {
|
|
45481
45541
|
const localOpts = this.opts();
|
|
45482
45542
|
await daemonStop({
|
|
45483
|
-
id,
|
|
45543
|
+
id: id2,
|
|
45484
45544
|
baseDir: localOpts.baseDir
|
|
45485
45545
|
});
|
|
45486
45546
|
});
|
|
@@ -45494,9 +45554,9 @@ function buildProgram(stdin) {
|
|
|
45494
45554
|
process.stdout.write(renderDaemonList(daemons) + `
|
|
45495
45555
|
`);
|
|
45496
45556
|
});
|
|
45497
|
-
daemon.command("status").argument("[id]", "daemon id from `alook daemon list` (omit if only one daemon)").description("dump each agent's current FSM state from a daemon's status snapshot").option("--base-dir <path>", "data directory (or ALOOK_DATA_DIR env)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(function(
|
|
45557
|
+
daemon.command("status").argument("[id]", "daemon id from `alook daemon list` (omit if only one daemon)").description("dump each agent's current FSM state from a daemon's status snapshot").option("--base-dir <path>", "data directory (or ALOOK_DATA_DIR env)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(function(id2) {
|
|
45498
45558
|
const localOpts = this.opts();
|
|
45499
|
-
const status = daemonStatus({ id, baseDir: localOpts.baseDir });
|
|
45559
|
+
const status = daemonStatus({ id: id2, baseDir: localOpts.baseDir });
|
|
45500
45560
|
if (status.ambiguous) {
|
|
45501
45561
|
printEnvelope({
|
|
45502
45562
|
error: "multiple daemons on this machine — pass an id: `alook daemon status <id>`",
|