@alook/daemon 0.1.41 → 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 +275 -205
- package/dist/index.js +104 -43
- 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
|
}
|
|
@@ -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({
|
|
@@ -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 {
|
|
@@ -36222,14 +36283,14 @@ function onExit(state, agentId) {
|
|
|
36222
36283
|
function onTick(state, nowMs) {
|
|
36223
36284
|
const effects = [];
|
|
36224
36285
|
const agents = { ...state.agents };
|
|
36225
|
-
for (const
|
|
36226
|
-
const a = agents[
|
|
36286
|
+
for (const id2 of Object.keys(agents)) {
|
|
36287
|
+
const a = agents[id2];
|
|
36227
36288
|
const lease = a.execution.lease;
|
|
36228
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;
|
|
36229
36290
|
if (stalled) {
|
|
36230
36291
|
const repeatedSessionStall = a.sessionId !== null && a.stalledSessionId === a.sessionId;
|
|
36231
36292
|
const forgetSessionId = repeatedSessionStall ? a.sessionId : undefined;
|
|
36232
|
-
agents[
|
|
36293
|
+
agents[id2] = {
|
|
36233
36294
|
...a,
|
|
36234
36295
|
status: "stopping",
|
|
36235
36296
|
sessionId: repeatedSessionStall ? null : a.sessionId,
|
|
@@ -36237,12 +36298,12 @@ function onTick(state, nowMs) {
|
|
|
36237
36298
|
idleSince: null,
|
|
36238
36299
|
stoppingSince: nowMs
|
|
36239
36300
|
};
|
|
36240
|
-
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 });
|
|
36241
36302
|
continue;
|
|
36242
36303
|
}
|
|
36243
36304
|
const expiredAdmission = a.status === "running" && a.pendingAdmissions.filter((entry) => !entry.driverAcknowledged && nowMs - entry.admittedAt >= state.staleThresholdMs);
|
|
36244
36305
|
if (expiredAdmission && expiredAdmission.length > 0 && a.execution.sessionInstanceId !== null) {
|
|
36245
|
-
agents[
|
|
36306
|
+
agents[id2] = {
|
|
36246
36307
|
...a,
|
|
36247
36308
|
pendingAdmissions: a.pendingAdmissions.filter((entry) => !expiredAdmission.includes(entry)),
|
|
36248
36309
|
status: "stopping",
|
|
@@ -36252,7 +36313,7 @@ function onTick(state, nowMs) {
|
|
|
36252
36313
|
effects.push(...recoveryEffects(a, expiredAdmission));
|
|
36253
36314
|
effects.push({
|
|
36254
36315
|
type: "expire_admission",
|
|
36255
|
-
agentId:
|
|
36316
|
+
agentId: id2,
|
|
36256
36317
|
sessionInstanceId: a.execution.sessionInstanceId,
|
|
36257
36318
|
commandIds: expiredAdmission.map((entry) => entry.commandId)
|
|
36258
36319
|
});
|
|
@@ -36260,25 +36321,25 @@ function onTick(state, nowMs) {
|
|
|
36260
36321
|
}
|
|
36261
36322
|
const resetStuck = a.resetting && a.status !== "stopping" && a.resettingSince !== null && nowMs - a.resettingSince >= state.resetStuckThresholdMs;
|
|
36262
36323
|
if (resetStuck) {
|
|
36263
|
-
agents[
|
|
36264
|
-
effects.push({ type: "terminate_stalled", agentId:
|
|
36324
|
+
agents[id2] = { ...a, status: "stopping", idleSince: null, stoppingSince: nowMs };
|
|
36325
|
+
effects.push({ type: "terminate_stalled", agentId: id2 });
|
|
36265
36326
|
continue;
|
|
36266
36327
|
}
|
|
36267
36328
|
const stoppingStuck = a.status === "stopping" && a.stoppingSince !== null && nowMs - a.stoppingSince >= state.stoppingStuckThresholdMs;
|
|
36268
36329
|
if (stoppingStuck) {
|
|
36269
|
-
effects.push({ type: "force_exit", agentId:
|
|
36330
|
+
effects.push({ type: "force_exit", agentId: id2, reason: "stopping_stuck" });
|
|
36270
36331
|
continue;
|
|
36271
36332
|
}
|
|
36272
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);
|
|
36273
36334
|
if (idleResetEligible && nowMs - a.idleSince >= state.idleResetTimeoutMs) {
|
|
36274
|
-
agents[
|
|
36275
|
-
effects.push({ type: "maintain_idle_memory", agentId:
|
|
36335
|
+
agents[id2] = { ...a, idleSince: nowMs };
|
|
36336
|
+
effects.push({ type: "maintain_idle_memory", agentId: id2, sessionId: a.sessionId });
|
|
36276
36337
|
continue;
|
|
36277
36338
|
}
|
|
36278
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);
|
|
36279
36340
|
if (idleEligible && a.idleSince !== null && nowMs - a.idleSince >= state.idleTimeoutMs) {
|
|
36280
|
-
agents[
|
|
36281
|
-
effects.push({ type: "stop", agentId:
|
|
36341
|
+
agents[id2] = { ...a, status: "stopping", stoppingSince: nowMs };
|
|
36342
|
+
effects.push({ type: "stop", agentId: id2, reason: "idle_timeout" });
|
|
36282
36343
|
}
|
|
36283
36344
|
}
|
|
36284
36345
|
return { state: { ...state, agents }, effects };
|
|
@@ -37676,8 +37737,8 @@ class AgentProcessManager {
|
|
|
37676
37737
|
if (eventAgentId) {
|
|
37677
37738
|
emit(eventAgentId);
|
|
37678
37739
|
} else if (event.type === "tick") {
|
|
37679
|
-
for (const
|
|
37680
|
-
emit(
|
|
37740
|
+
for (const id2 of Object.keys(this.state.agents))
|
|
37741
|
+
emit(id2);
|
|
37681
37742
|
}
|
|
37682
37743
|
}
|
|
37683
37744
|
if (closingOwner && closingSpan) {
|
|
@@ -38705,32 +38766,32 @@ class AgentRouter {
|
|
|
38705
38766
|
}
|
|
38706
38767
|
return out;
|
|
38707
38768
|
}
|
|
38708
|
-
isRuntimeHealthy(
|
|
38709
|
-
return this.runtimes.get(
|
|
38769
|
+
isRuntimeHealthy(id2) {
|
|
38770
|
+
return this.runtimes.get(id2)?.status === "healthy";
|
|
38710
38771
|
}
|
|
38711
|
-
recordRuntimeSpawnFailure(
|
|
38772
|
+
recordRuntimeSpawnFailure(id2, reason) {
|
|
38712
38773
|
if (!DEFINITIVE_EXECUTABLE_FAILURES.has(reason))
|
|
38713
38774
|
return;
|
|
38714
|
-
this.markRuntimeUnhealthy(
|
|
38775
|
+
this.markRuntimeUnhealthy(id2, reason);
|
|
38715
38776
|
}
|
|
38716
|
-
markRuntimeUnhealthy(
|
|
38717
|
-
const existing = this.runtimes.get(
|
|
38777
|
+
markRuntimeUnhealthy(id2, reason) {
|
|
38778
|
+
const existing = this.runtimes.get(id2);
|
|
38718
38779
|
if (!existing)
|
|
38719
38780
|
return;
|
|
38720
38781
|
const nowIso = new Date().toISOString();
|
|
38721
38782
|
if (existing.status === "unhealthy" && existing.lastError === reason)
|
|
38722
38783
|
return;
|
|
38723
|
-
this.runtimes.set(
|
|
38784
|
+
this.runtimes.set(id2, {
|
|
38724
38785
|
...existing,
|
|
38725
38786
|
status: "unhealthy",
|
|
38726
38787
|
lastError: reason,
|
|
38727
38788
|
lastErrorAt: nowIso
|
|
38728
38789
|
});
|
|
38729
|
-
this.log.warn("runtime marked unhealthy", { runtimeId:
|
|
38790
|
+
this.log.warn("runtime marked unhealthy", { runtimeId: id2, reason });
|
|
38730
38791
|
this.scheduleReadyFrameResend();
|
|
38731
38792
|
}
|
|
38732
|
-
markRuntimeHealthy(
|
|
38733
|
-
const existing = this.runtimes.get(
|
|
38793
|
+
markRuntimeHealthy(id2) {
|
|
38794
|
+
const existing = this.runtimes.get(id2);
|
|
38734
38795
|
if (!existing)
|
|
38735
38796
|
return;
|
|
38736
38797
|
if (existing.status === "healthy" && !existing.lastError && !existing.lastErrorAt)
|
|
@@ -38738,8 +38799,8 @@ class AgentRouter {
|
|
|
38738
38799
|
const healthy = { ...existing, status: "healthy" };
|
|
38739
38800
|
delete healthy.lastError;
|
|
38740
38801
|
delete healthy.lastErrorAt;
|
|
38741
|
-
this.runtimes.set(
|
|
38742
|
-
this.log.info("runtime marked healthy again", { runtimeId:
|
|
38802
|
+
this.runtimes.set(id2, healthy);
|
|
38803
|
+
this.log.info("runtime marked healthy again", { runtimeId: id2 });
|
|
38743
38804
|
this.scheduleReadyFrameResend();
|
|
38744
38805
|
}
|
|
38745
38806
|
markLocallyStopped(agentId) {
|
|
@@ -43594,27 +43655,27 @@ var log2 = createLogger2({ header: "@alook/daemon" });
|
|
|
43594
43655
|
function daemonsDir(baseDir) {
|
|
43595
43656
|
return path17.join(baseDir, "daemons");
|
|
43596
43657
|
}
|
|
43597
|
-
function daemonDirById(baseDir,
|
|
43598
|
-
return path17.join(daemonsDir(baseDir), validateDaemonId(
|
|
43658
|
+
function daemonDirById(baseDir, id2) {
|
|
43659
|
+
return path17.join(daemonsDir(baseDir), validateDaemonId(id2));
|
|
43599
43660
|
}
|
|
43600
43661
|
function validateMachineId(machineId) {
|
|
43601
43662
|
if (!MACHINE_ID_PATTERN.test(machineId))
|
|
43602
43663
|
throw new Error("invalid machine identity returned by server");
|
|
43603
43664
|
return machineId;
|
|
43604
43665
|
}
|
|
43605
|
-
function isDaemonId(
|
|
43606
|
-
return MACHINE_ID_PATTERN.test(
|
|
43666
|
+
function isDaemonId(id2) {
|
|
43667
|
+
return MACHINE_ID_PATTERN.test(id2) || LEGACY_DAEMON_ID_PATTERN.test(id2);
|
|
43607
43668
|
}
|
|
43608
|
-
function validateDaemonId(
|
|
43609
|
-
if (!isDaemonId(
|
|
43669
|
+
function validateDaemonId(id2) {
|
|
43670
|
+
if (!isDaemonId(id2))
|
|
43610
43671
|
throw new Error("invalid daemon id");
|
|
43611
|
-
return
|
|
43672
|
+
return id2;
|
|
43612
43673
|
}
|
|
43613
|
-
function pidfilePathById(baseDir,
|
|
43614
|
-
return path17.join(daemonDirById(baseDir,
|
|
43674
|
+
function pidfilePathById(baseDir, id2) {
|
|
43675
|
+
return path17.join(daemonDirById(baseDir, id2), "daemon.pid");
|
|
43615
43676
|
}
|
|
43616
|
-
function statusFilePathById(baseDir,
|
|
43617
|
-
return path17.join(daemonDirById(baseDir,
|
|
43677
|
+
function statusFilePathById(baseDir, id2) {
|
|
43678
|
+
return path17.join(daemonDirById(baseDir, id2), "status.json");
|
|
43618
43679
|
}
|
|
43619
43680
|
function isProcessAlive(pid) {
|
|
43620
43681
|
try {
|
|
@@ -43950,7 +44011,7 @@ function daemonList(opts) {
|
|
|
43950
44011
|
return [];
|
|
43951
44012
|
const results = [];
|
|
43952
44013
|
const now = Date.now();
|
|
43953
|
-
const pushRow = (
|
|
44014
|
+
const pushRow = (id2, pidfile, statusPath) => {
|
|
43954
44015
|
const data = readPidFile(pidfile);
|
|
43955
44016
|
if (!data)
|
|
43956
44017
|
return;
|
|
@@ -43974,12 +44035,12 @@ function daemonList(opts) {
|
|
|
43974
44035
|
lastActiveMs = daemonLastActiveMs(s, now);
|
|
43975
44036
|
}
|
|
43976
44037
|
}
|
|
43977
|
-
results.push({ id, pid: data.pid, alive, agents, running, lastActiveMs });
|
|
44038
|
+
results.push({ id: id2, pid: data.pid, alive, agents, running, lastActiveMs });
|
|
43978
44039
|
};
|
|
43979
44040
|
for (const entry of fs12.readdirSync(dir, { withFileTypes: true })) {
|
|
43980
44041
|
if (entry.isDirectory() && isDaemonId(entry.name)) {
|
|
43981
|
-
const
|
|
43982
|
-
pushRow(
|
|
44042
|
+
const id2 = entry.name;
|
|
44043
|
+
pushRow(id2, path17.join(dir, id2, "daemon.pid"), path17.join(dir, id2, "status.json"));
|
|
43983
44044
|
}
|
|
43984
44045
|
}
|
|
43985
44046
|
return results;
|
|
@@ -44759,10 +44820,10 @@ function getApi() {
|
|
|
44759
44820
|
throw new CliError("no ServerApi available — ALOOK_PROXY_URL + ALOOK_PROXY_TOKEN_FILE must be set");
|
|
44760
44821
|
}
|
|
44761
44822
|
function agentId(opts) {
|
|
44762
|
-
const
|
|
44763
|
-
if (!
|
|
44823
|
+
const id2 = opts.agent || process.env.ALOOK_AGENT_ID || process.env.ALOOK_ID;
|
|
44824
|
+
if (!id2)
|
|
44764
44825
|
throw new CliError("agent identity required — pass --agent <id> or set ALOOK_AGENT_ID");
|
|
44765
|
-
return
|
|
44826
|
+
return id2;
|
|
44766
44827
|
}
|
|
44767
44828
|
var TEXT_ESCAPE_MAP = { n: `
|
|
44768
44829
|
`, t: "\t", r: "\r", "\\": "\\" };
|
|
@@ -44902,14 +44963,23 @@ ${MESSAGE_SEND_STDIN_POLICY}`);
|
|
|
44902
44963
|
replyToSeq = n;
|
|
44903
44964
|
}
|
|
44904
44965
|
const nonce = randomUUID11();
|
|
44905
|
-
|
|
44906
|
-
|
|
44907
|
-
|
|
44908
|
-
|
|
44909
|
-
|
|
44910
|
-
|
|
44911
|
-
|
|
44912
|
-
|
|
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
|
+
}
|
|
44913
44983
|
if (res.state === "blocked") {
|
|
44914
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.`);
|
|
44915
44985
|
}
|
|
@@ -45042,14 +45112,14 @@ async function cmdAttachmentUpload(opts) {
|
|
|
45042
45112
|
async function cmdAttachmentDownload(opts) {
|
|
45043
45113
|
const api2 = getApi();
|
|
45044
45114
|
const agent2 = agentId(opts);
|
|
45045
|
-
const
|
|
45046
|
-
if (!
|
|
45115
|
+
const id2 = opts.id;
|
|
45116
|
+
if (!id2)
|
|
45047
45117
|
throw new CliError("message attachment download: --id <id> is required");
|
|
45048
45118
|
const outFlag = opts.out;
|
|
45049
45119
|
const os4 = await import("os");
|
|
45050
45120
|
const pathMod = await import("path");
|
|
45051
|
-
const destPath = outFlag ?? pathMod.join(os4.tmpdir(), "alook-attachments", agent2,
|
|
45052
|
-
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 });
|
|
45053
45123
|
if (!outFlag) {
|
|
45054
45124
|
const fs13 = await import("fs/promises");
|
|
45055
45125
|
const destDir = pathMod.dirname(destPath);
|
|
@@ -45287,7 +45357,7 @@ function buildProgram(stdin) {
|
|
|
45287
45357
|
}).option("--agent <id>", "agent identity (or ALOOK_AGENT_ID env)");
|
|
45288
45358
|
const message2 = program.command("message").description("message operations").exitOverride();
|
|
45289
45359
|
message2.configureOutput({ writeOut: () => {}, writeErr: () => {} });
|
|
45290
|
-
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() {
|
|
45291
45361
|
const localOpts = this.opts();
|
|
45292
45362
|
const globalOpts = program.opts();
|
|
45293
45363
|
const result = await cmdMessageSend({ ...globalOpts, ...localOpts }, stdin);
|
|
@@ -45418,13 +45488,13 @@ function buildProgram(stdin) {
|
|
|
45418
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() {
|
|
45419
45489
|
const localOpts = this.opts();
|
|
45420
45490
|
const machineKey = localOpts.machineKey;
|
|
45421
|
-
const
|
|
45422
|
-
if (!machineKey && !
|
|
45491
|
+
const id2 = localOpts.id;
|
|
45492
|
+
if (!machineKey && !id2 || machineKey && id2) {
|
|
45423
45493
|
throw new CliError("daemon start requires exactly one of --machine-key <key> or --id <machineId>");
|
|
45424
45494
|
}
|
|
45425
|
-
if (
|
|
45495
|
+
if (id2) {
|
|
45426
45496
|
await daemonStartById({
|
|
45427
|
-
id,
|
|
45497
|
+
id: id2,
|
|
45428
45498
|
baseDir: localOpts.baseDir,
|
|
45429
45499
|
foreground: localOpts.foreground === true
|
|
45430
45500
|
});
|
|
@@ -45467,10 +45537,10 @@ function buildProgram(stdin) {
|
|
|
45467
45537
|
requestId: localOpts.requestId
|
|
45468
45538
|
});
|
|
45469
45539
|
});
|
|
45470
|
-
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) {
|
|
45471
45541
|
const localOpts = this.opts();
|
|
45472
45542
|
await daemonStop({
|
|
45473
|
-
id,
|
|
45543
|
+
id: id2,
|
|
45474
45544
|
baseDir: localOpts.baseDir
|
|
45475
45545
|
});
|
|
45476
45546
|
});
|
|
@@ -45484,9 +45554,9 @@ function buildProgram(stdin) {
|
|
|
45484
45554
|
process.stdout.write(renderDaemonList(daemons) + `
|
|
45485
45555
|
`);
|
|
45486
45556
|
});
|
|
45487
|
-
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) {
|
|
45488
45558
|
const localOpts = this.opts();
|
|
45489
|
-
const status = daemonStatus({ id, baseDir: localOpts.baseDir });
|
|
45559
|
+
const status = daemonStatus({ id: id2, baseDir: localOpts.baseDir });
|
|
45490
45560
|
if (status.ambiguous) {
|
|
45491
45561
|
printEnvelope({
|
|
45492
45562
|
error: "multiple daemons on this machine — pass an id: `alook daemon status <id>`",
|