@alook/daemon 0.1.41 → 0.1.43
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 +435 -208
- package/dist/index.js +264 -46
- 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,199 @@ 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", "forum_post"]),
|
|
22161
|
+
sourceId: id,
|
|
22162
|
+
scopeId: id.nullable().optional(),
|
|
22163
|
+
messageId: id.nullable().optional(),
|
|
22164
|
+
actorUserId: id.nullable().optional(),
|
|
22165
|
+
createdAt: exports_external.string(),
|
|
22166
|
+
childChannelId: id.optional(),
|
|
22167
|
+
openerSeq: exports_external.number().int().nonnegative().optional(),
|
|
22168
|
+
readTarget: exports_external.strictObject({
|
|
22169
|
+
channelId: id,
|
|
22170
|
+
seq: exports_external.number().int().nonnegative()
|
|
22171
|
+
}).optional()
|
|
22172
|
+
}).superRefine((item, ctx) => {
|
|
22173
|
+
if (item.kind === "friend_request") {
|
|
22174
|
+
if (!item.actorUserId || item.scopeId != null || item.messageId != null) {
|
|
22175
|
+
ctx.addIssue({ code: "custom", message: "friend request cannot reference a scope or message" });
|
|
22176
|
+
}
|
|
22177
|
+
if (item.childChannelId || item.openerSeq !== undefined || item.readTarget) {
|
|
22178
|
+
ctx.addIssue({ code: "custom", message: "friend request cannot carry forum presentation refs" });
|
|
22179
|
+
}
|
|
22180
|
+
return;
|
|
22181
|
+
}
|
|
22182
|
+
if (!item.scopeId || !item.messageId) {
|
|
22183
|
+
ctx.addIssue({ code: "custom", message: "message attention requires scope and message refs" });
|
|
22184
|
+
}
|
|
22185
|
+
if (item.kind === "forum_post") {
|
|
22186
|
+
if (item.actorUserId != null || !item.childChannelId || item.openerSeq === undefined || !item.readTarget || item.sourceId !== item.childChannelId || item.readTarget.seq !== item.openerSeq) {
|
|
22187
|
+
ctx.addIssue({ code: "custom", message: "forum post requires exact child, opener, and read-target refs" });
|
|
22188
|
+
}
|
|
22189
|
+
return;
|
|
22190
|
+
}
|
|
22191
|
+
if (!item.actorUserId) {
|
|
22192
|
+
ctx.addIssue({ code: "custom", message: "message attention requires an actor" });
|
|
22193
|
+
}
|
|
22194
|
+
if (item.childChannelId || item.openerSeq !== undefined || item.readTarget) {
|
|
22195
|
+
ctx.addIssue({ code: "custom", message: "mention or reply cannot carry forum presentation refs" });
|
|
22196
|
+
}
|
|
22197
|
+
});
|
|
22198
|
+
var AttentionIncludedServerSchema = exports_external.strictObject({
|
|
22199
|
+
id,
|
|
22200
|
+
name: exports_external.string(),
|
|
22201
|
+
discriminator: exports_external.string()
|
|
22202
|
+
});
|
|
22203
|
+
var AttentionIncludedChannelSchema = exports_external.strictObject({
|
|
22204
|
+
id,
|
|
22205
|
+
serverId: id,
|
|
22206
|
+
name: exports_external.string(),
|
|
22207
|
+
type: exports_external.enum(["text", "forum", "thread"]),
|
|
22208
|
+
parentChannelId: id.nullable(),
|
|
22209
|
+
parentMessageId: id.nullable(),
|
|
22210
|
+
creatorId: id.nullable(),
|
|
22211
|
+
archived: exports_external.boolean(),
|
|
22212
|
+
lastMessageAt: exports_external.string().nullable(),
|
|
22213
|
+
openerSeq: exports_external.number().int().nonnegative().optional(),
|
|
22214
|
+
openerUnread: exports_external.boolean().optional()
|
|
22215
|
+
});
|
|
22216
|
+
var AttentionIncludedDmSchema = exports_external.strictObject({
|
|
22217
|
+
id,
|
|
22218
|
+
userId: id,
|
|
22219
|
+
name: exports_external.string(),
|
|
22220
|
+
discriminator: exports_external.string(),
|
|
22221
|
+
avatar: exports_external.string(),
|
|
22222
|
+
avatarVersion: exports_external.number().int().nonnegative(),
|
|
22223
|
+
lastMessageAt: exports_external.string(),
|
|
22224
|
+
lastUnreadSeq: exports_external.number().int().nonnegative()
|
|
22225
|
+
});
|
|
22226
|
+
var AttentionIncludedProfileSchema = exports_external.strictObject({
|
|
22227
|
+
userId: id,
|
|
22228
|
+
name: exports_external.string(),
|
|
22229
|
+
discriminator: exports_external.string(),
|
|
22230
|
+
avatar: exports_external.string(),
|
|
22231
|
+
avatarVersion: exports_external.number().int().nonnegative()
|
|
22232
|
+
});
|
|
22233
|
+
var AttentionIncludedMessageSchema = exports_external.strictObject({
|
|
22234
|
+
id,
|
|
22235
|
+
channelId: id,
|
|
22236
|
+
type: exports_external.enum(["chat", "system"]),
|
|
22237
|
+
authorId: id.optional(),
|
|
22238
|
+
authorName: exports_external.string().optional(),
|
|
22239
|
+
seq: exports_external.number().int().nonnegative(),
|
|
22240
|
+
createdAt: exports_external.string(),
|
|
22241
|
+
content: exports_external.string()
|
|
22242
|
+
});
|
|
22243
|
+
var AttentionIncludedSchema = exports_external.strictObject({
|
|
22244
|
+
servers: exports_external.array(AttentionIncludedServerSchema),
|
|
22245
|
+
channels: exports_external.array(AttentionIncludedChannelSchema),
|
|
22246
|
+
dms: exports_external.array(AttentionIncludedDmSchema),
|
|
22247
|
+
profiles: exports_external.array(AttentionIncludedProfileSchema),
|
|
22248
|
+
messages: exports_external.array(AttentionIncludedMessageSchema)
|
|
22249
|
+
});
|
|
22250
|
+
var AccountAttentionSnapshotSchema = exports_external.strictObject({
|
|
22251
|
+
scopes: exports_external.array(AttentionScopeSchema),
|
|
22252
|
+
items: exports_external.array(AttentionItemSchema),
|
|
22253
|
+
limit: exports_external.number().int().positive(),
|
|
22254
|
+
truncated: exports_external.boolean(),
|
|
22255
|
+
included: AttentionIncludedSchema
|
|
22256
|
+
}).superRefine((snapshot, ctx) => {
|
|
22257
|
+
const scopeIds = new Set;
|
|
22258
|
+
for (const scope of snapshot.scopes) {
|
|
22259
|
+
if (scopeIds.has(scope.scopeId)) {
|
|
22260
|
+
ctx.addIssue({ code: "custom", message: `duplicate attention scope: ${scope.scopeId}` });
|
|
22261
|
+
}
|
|
22262
|
+
scopeIds.add(scope.scopeId);
|
|
22263
|
+
}
|
|
22264
|
+
const itemIds = new Set;
|
|
22265
|
+
const serverById = new Map(snapshot.included.servers.map((server) => [server.id, server]));
|
|
22266
|
+
const channelById = new Map(snapshot.included.channels.map((channel2) => [channel2.id, channel2]));
|
|
22267
|
+
const dmById = new Map(snapshot.included.dms.map((dm) => [dm.id, dm]));
|
|
22268
|
+
const profileById = new Map(snapshot.included.profiles.map((profile) => [profile.userId, profile]));
|
|
22269
|
+
const messageById = new Map(snapshot.included.messages.map((message2) => [message2.id, message2]));
|
|
22270
|
+
const rejectDuplicates = (values, kind) => {
|
|
22271
|
+
const seen = new Set;
|
|
22272
|
+
for (const value of values) {
|
|
22273
|
+
if (seen.has(value))
|
|
22274
|
+
ctx.addIssue({ code: "custom", message: `duplicate included ${kind}: ${value}` });
|
|
22275
|
+
seen.add(value);
|
|
22276
|
+
}
|
|
22277
|
+
};
|
|
22278
|
+
rejectDuplicates(snapshot.included.servers.map((server) => server.id), "server");
|
|
22279
|
+
rejectDuplicates(snapshot.included.channels.map((channel2) => channel2.id), "channel");
|
|
22280
|
+
rejectDuplicates(snapshot.included.dms.map((dm) => dm.id), "dm");
|
|
22281
|
+
rejectDuplicates(snapshot.included.profiles.map((profile) => profile.userId), "profile");
|
|
22282
|
+
rejectDuplicates(snapshot.included.messages.map((message2) => message2.id), "message");
|
|
22283
|
+
for (const scope of snapshot.scopes) {
|
|
22284
|
+
if (scope.serverId) {
|
|
22285
|
+
const channel2 = channelById.get(scope.channelId);
|
|
22286
|
+
if (!serverById.has(scope.serverId) || !channel2 || channel2.serverId !== scope.serverId) {
|
|
22287
|
+
ctx.addIssue({ code: "custom", message: `attention scope references missing owner: ${scope.scopeId}` });
|
|
22288
|
+
continue;
|
|
22289
|
+
}
|
|
22290
|
+
if (scope.parentChannelId) {
|
|
22291
|
+
const parent = channelById.get(scope.parentChannelId);
|
|
22292
|
+
const opener = channel2.parentMessageId ? messageById.get(channel2.parentMessageId) : undefined;
|
|
22293
|
+
if (channel2.parentChannelId !== scope.parentChannelId || !parent || parent.serverId !== scope.serverId || !opener || opener.channelId !== parent.id || channel2.openerSeq !== opener.seq || channel2.openerUnread === undefined) {
|
|
22294
|
+
ctx.addIssue({ code: "custom", message: `attention scope references missing parent: ${scope.scopeId}` });
|
|
22295
|
+
}
|
|
22296
|
+
} else if (channel2.parentChannelId !== null) {
|
|
22297
|
+
ctx.addIssue({ code: "custom", message: `attention scope parent mismatch: ${scope.scopeId}` });
|
|
22298
|
+
}
|
|
22299
|
+
} else {
|
|
22300
|
+
const dm = dmById.get(scope.channelId);
|
|
22301
|
+
if (!dm || !profileById.has(dm.userId)) {
|
|
22302
|
+
ctx.addIssue({ code: "custom", message: `attention scope references missing DM owner: ${scope.scopeId}` });
|
|
22303
|
+
}
|
|
22304
|
+
}
|
|
22305
|
+
}
|
|
22306
|
+
for (const item of snapshot.items) {
|
|
22307
|
+
if (itemIds.has(item.id)) {
|
|
22308
|
+
ctx.addIssue({ code: "custom", message: `duplicate attention item: ${item.id}` });
|
|
22309
|
+
}
|
|
22310
|
+
itemIds.add(item.id);
|
|
22311
|
+
if (item.scopeId && !scopeIds.has(item.scopeId)) {
|
|
22312
|
+
ctx.addIssue({ code: "custom", message: `attention item references missing scope: ${item.scopeId}` });
|
|
22313
|
+
}
|
|
22314
|
+
if (item.kind === "friend_request") {
|
|
22315
|
+
if (!item.actorUserId || !profileById.has(item.actorUserId)) {
|
|
22316
|
+
ctx.addIssue({ code: "custom", message: `friend request references missing profile: ${item.id}` });
|
|
22317
|
+
}
|
|
22318
|
+
continue;
|
|
22319
|
+
}
|
|
22320
|
+
const scope = item.scopeId ? snapshot.scopes.find((candidate) => candidate.scopeId === item.scopeId) : undefined;
|
|
22321
|
+
const message2 = item.messageId ? messageById.get(item.messageId) : undefined;
|
|
22322
|
+
if (!scope || !message2) {
|
|
22323
|
+
ctx.addIssue({ code: "custom", message: `attention item references missing message: ${item.id}` });
|
|
22324
|
+
continue;
|
|
22325
|
+
}
|
|
22326
|
+
if (item.kind === "forum_post") {
|
|
22327
|
+
const parent = channelById.get(scope.channelId);
|
|
22328
|
+
const child = item.childChannelId ? channelById.get(item.childChannelId) : undefined;
|
|
22329
|
+
if (!scope.serverId || parent?.type !== "forum" || child?.type !== "thread" || child.parentChannelId !== parent.id || child.parentMessageId !== message2.id || message2.channelId !== parent.id || message2.seq !== item.openerSeq || item.readTarget?.channelId !== parent.id) {
|
|
22330
|
+
ctx.addIssue({ code: "custom", message: `forum post references incomplete presentation owners: ${item.id}` });
|
|
22331
|
+
}
|
|
22332
|
+
continue;
|
|
22333
|
+
}
|
|
22334
|
+
if (message2.channelId !== scope.channelId || !item.actorUserId || !profileById.has(item.actorUserId)) {
|
|
22335
|
+
ctx.addIssue({ code: "custom", message: `message attention references incomplete owners: ${item.id}` });
|
|
22336
|
+
}
|
|
22337
|
+
}
|
|
22338
|
+
});
|
|
22146
22339
|
// ../shared/src/constants/community.ts
|
|
22147
22340
|
var MAX_FOLDER_NAME_LENGTH = 100;
|
|
22148
22341
|
var MAX_PROFILE_NAME_LENGTH = 100;
|
|
@@ -22893,11 +23086,11 @@ var CommunityMachineRuntimeListSchema = exports_external.array(CommunityMachineR
|
|
|
22893
23086
|
var CommunityRunningAgentListSchema = exports_external.array(exports_external.string()).transform((list) => {
|
|
22894
23087
|
const seen = new Set;
|
|
22895
23088
|
const out = [];
|
|
22896
|
-
for (const
|
|
22897
|
-
if (seen.has(
|
|
23089
|
+
for (const id2 of list) {
|
|
23090
|
+
if (seen.has(id2))
|
|
22898
23091
|
continue;
|
|
22899
|
-
seen.add(
|
|
22900
|
-
out.push(
|
|
23092
|
+
seen.add(id2);
|
|
23093
|
+
out.push(id2);
|
|
22901
23094
|
}
|
|
22902
23095
|
return out;
|
|
22903
23096
|
});
|
|
@@ -23074,6 +23267,7 @@ var CommunityAgentSendRequestSchema = exports_external.object({
|
|
|
23074
23267
|
attachments: exports_external.array(exports_external.string().min(1)).max(MAX_ATTACHMENTS_PER_MESSAGE).default([]),
|
|
23075
23268
|
seenUpToSeq: CommunityAgentSeqSchema.optional(),
|
|
23076
23269
|
replyToSeq: CommunityAgentPositiveSeqSchema.optional(),
|
|
23270
|
+
force: exports_external.boolean().optional(),
|
|
23077
23271
|
nonce: exports_external.string().min(1).max(128).optional()
|
|
23078
23272
|
}).refine((d) => d.content.text.trim().length > 0 || d.attachments.length > 0, { message: "message must have text or attachments" });
|
|
23079
23273
|
var CommunityAgentAttachmentUploadResponseSchema = exports_external.object({
|
|
@@ -24415,7 +24609,9 @@ var COMMUNITY_BROWSER_EVENT_BATCH_MAX_BYTES = MESSAGE_DELIVERY_MAX_EVENTS_PER_US
|
|
|
24415
24609
|
var exports_billing_schema = {};
|
|
24416
24610
|
__export(exports_billing_schema, {
|
|
24417
24611
|
userBilling: () => userBilling,
|
|
24418
|
-
|
|
24612
|
+
billingPurchaseDelivery: () => billingPurchaseDelivery,
|
|
24613
|
+
billingPrice: () => billingPrice,
|
|
24614
|
+
billingAnalyticsConsent: () => billingAnalyticsConsent
|
|
24419
24615
|
});
|
|
24420
24616
|
var billingPrice = sqliteTable("billing_price", {
|
|
24421
24617
|
priceId: text("price_id").primaryKey(),
|
|
@@ -24436,6 +24632,28 @@ var userBilling = sqliteTable("user_billing", {
|
|
|
24436
24632
|
uniqueIndex("uq_user_billing_customer").on(t.customerId),
|
|
24437
24633
|
uniqueIndex("uq_user_billing_subscription").on(t.subscriptionId)
|
|
24438
24634
|
]);
|
|
24635
|
+
var billingAnalyticsConsent = sqliteTable("billing_analytics_consent", {
|
|
24636
|
+
userId: text("user_id").primaryKey().references(() => user.id, { onDelete: "cascade" }),
|
|
24637
|
+
decision: text("decision").$type().notNull(),
|
|
24638
|
+
sourceVersion: integer2("source_version").notNull(),
|
|
24639
|
+
revision: integer2("revision").notNull().default(1),
|
|
24640
|
+
updatedAt: text("updated_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
24641
|
+
});
|
|
24642
|
+
var billingPurchaseDelivery = sqliteTable("billing_purchase_delivery", {
|
|
24643
|
+
invoiceId: text("invoice_id").primaryKey(),
|
|
24644
|
+
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
24645
|
+
status: text("status").$type().notNull(),
|
|
24646
|
+
reason: text("reason").notNull(),
|
|
24647
|
+
purchaseType: text("purchase_type").$type(),
|
|
24648
|
+
currency: text("currency"),
|
|
24649
|
+
valueMinor: integer2("value_minor"),
|
|
24650
|
+
planId: text("plan_id"),
|
|
24651
|
+
validationJson: text("validation_json"),
|
|
24652
|
+
claimedAt: text("claimed_at").notNull().$defaultFn(() => new Date().toISOString()),
|
|
24653
|
+
finalizedAt: text("finalized_at")
|
|
24654
|
+
}, (t) => [
|
|
24655
|
+
index("idx_billing_purchase_delivery_user_claimed").on(t.userId, t.claimedAt)
|
|
24656
|
+
]);
|
|
24439
24657
|
|
|
24440
24658
|
// ../shared/src/db/community-funnel-analytics-schema.ts
|
|
24441
24659
|
var exports_community_funnel_analytics_schema = {};
|
|
@@ -26233,8 +26451,8 @@ class SettledUsageProjector {
|
|
|
26233
26451
|
|
|
26234
26452
|
// agent-driver/dist/internal/utils.js
|
|
26235
26453
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
26236
|
-
function jsonRpcRequest(method, params,
|
|
26237
|
-
return JSON.stringify({ jsonrpc: "2.0", id:
|
|
26454
|
+
function jsonRpcRequest(method, params, id2) {
|
|
26455
|
+
return JSON.stringify({ jsonrpc: "2.0", id: id2 ?? randomUUID3(), method, params });
|
|
26238
26456
|
}
|
|
26239
26457
|
function tryParseJsonLine(line) {
|
|
26240
26458
|
try {
|
|
@@ -26985,8 +27203,8 @@ async function discoverClaudeRecentContext(request, dependencies = {}) {
|
|
|
26985
27203
|
// agent-driver/dist/adapters/claude/index.js
|
|
26986
27204
|
var CLAUDE_MODEL_CATALOG = {
|
|
26987
27205
|
updateMode: "unsupported",
|
|
26988
|
-
models: ["opus", "sonnet", "haiku"].map((
|
|
26989
|
-
id,
|
|
27206
|
+
models: ["opus", "sonnet", "haiku"].map((id2) => ({
|
|
27207
|
+
id: id2,
|
|
26990
27208
|
supportedReasoningEfforts: []
|
|
26991
27209
|
}))
|
|
26992
27210
|
};
|
|
@@ -27707,22 +27925,22 @@ var RUNTIME_MODEL_ID_MAX = 100;
|
|
|
27707
27925
|
function normalizeRuntimeModelId(value) {
|
|
27708
27926
|
if (typeof value !== "string")
|
|
27709
27927
|
return;
|
|
27710
|
-
const
|
|
27711
|
-
if (!
|
|
27928
|
+
const id2 = value.trim();
|
|
27929
|
+
if (!id2 || id2.length > RUNTIME_MODEL_ID_MAX || /\s/.test(id2))
|
|
27712
27930
|
return;
|
|
27713
|
-
return
|
|
27931
|
+
return id2;
|
|
27714
27932
|
}
|
|
27715
27933
|
function catalogFromIds(ids) {
|
|
27716
27934
|
const seen = new Set;
|
|
27717
27935
|
const models = [];
|
|
27718
27936
|
for (const rawId of ids) {
|
|
27719
|
-
const
|
|
27720
|
-
if (!
|
|
27937
|
+
const id2 = normalizeRuntimeModelId(rawId);
|
|
27938
|
+
if (!id2 || seen.has(id2))
|
|
27721
27939
|
continue;
|
|
27722
27940
|
if (models.length >= RUNTIME_MODEL_CATALOG_MAX)
|
|
27723
27941
|
return;
|
|
27724
|
-
seen.add(
|
|
27725
|
-
models.push({ id, supportedReasoningEfforts: [] });
|
|
27942
|
+
seen.add(id2);
|
|
27943
|
+
models.push({ id: id2, supportedReasoningEfforts: [] });
|
|
27726
27944
|
}
|
|
27727
27945
|
if (models.length === 0)
|
|
27728
27946
|
return;
|
|
@@ -27730,8 +27948,8 @@ function catalogFromIds(ids) {
|
|
|
27730
27948
|
}
|
|
27731
27949
|
function parseOpenCodeModelCatalog(output2) {
|
|
27732
27950
|
const ids = output2.split(/\r?\n/).flatMap((line) => {
|
|
27733
|
-
const
|
|
27734
|
-
return
|
|
27951
|
+
const id2 = normalizeRuntimeModelId(line);
|
|
27952
|
+
return id2 && /^[^/]+\/.+$/.test(id2) ? [id2] : [];
|
|
27735
27953
|
});
|
|
27736
27954
|
return catalogFromIds(ids);
|
|
27737
27955
|
}
|
|
@@ -27743,8 +27961,8 @@ function parsePiModelCatalog(values) {
|
|
|
27743
27961
|
return [];
|
|
27744
27962
|
const model = value;
|
|
27745
27963
|
const provider = normalizeRuntimeModelId(model.provider);
|
|
27746
|
-
const
|
|
27747
|
-
return provider &&
|
|
27964
|
+
const id2 = normalizeRuntimeModelId(model.id);
|
|
27965
|
+
return provider && id2 && !provider.includes("/") ? [`${provider}/${id2}`] : [];
|
|
27748
27966
|
});
|
|
27749
27967
|
return catalogFromIds(ids);
|
|
27750
27968
|
}
|
|
@@ -27902,8 +28120,8 @@ class CodexDriver {
|
|
|
27902
28120
|
if (!value || typeof value !== "object")
|
|
27903
28121
|
return;
|
|
27904
28122
|
const model = value;
|
|
27905
|
-
const
|
|
27906
|
-
if (!
|
|
28123
|
+
const id2 = normalizeRuntimeModelId(model.id);
|
|
28124
|
+
if (!id2 || seenModels.has(id2))
|
|
27907
28125
|
return;
|
|
27908
28126
|
if (models.length >= MODEL_LIST_MAX) {
|
|
27909
28127
|
overflow = true;
|
|
@@ -27923,11 +28141,11 @@ class CodexDriver {
|
|
|
27923
28141
|
return [{ value: value2, ...description ? { description } : {} }];
|
|
27924
28142
|
}).slice(0, MODEL_EFFORT_MAX);
|
|
27925
28143
|
const candidateDefault = typeof model.defaultReasoningEffort === "string" ? model.defaultReasoningEffort : undefined;
|
|
27926
|
-
seenModels.add(
|
|
28144
|
+
seenModels.add(id2);
|
|
27927
28145
|
if (model.isDefault === true)
|
|
27928
|
-
defaultModelId =
|
|
28146
|
+
defaultModelId = id2;
|
|
27929
28147
|
models.push({
|
|
27930
|
-
id,
|
|
28148
|
+
id: id2,
|
|
27931
28149
|
supportedReasoningEfforts,
|
|
27932
28150
|
...candidateDefault && supportedReasoningEfforts.some((item) => item.value === candidateDefault) ? { defaultReasoningEffort: candidateDefault } : {}
|
|
27933
28151
|
});
|
|
@@ -28081,10 +28299,10 @@ class CodexDriver {
|
|
|
28081
28299
|
error: this.settingsError("process", "settings_thread_unavailable", "Codex thread is not available for a settings update", true)
|
|
28082
28300
|
});
|
|
28083
28301
|
}
|
|
28084
|
-
const
|
|
28302
|
+
const id2 = this.nextRequestId();
|
|
28085
28303
|
return new Promise((resolve2) => {
|
|
28086
28304
|
const timer = setTimeout(() => {
|
|
28087
|
-
if (!this.pendingSettingsUpdates.delete(
|
|
28305
|
+
if (!this.pendingSettingsUpdates.delete(id2))
|
|
28088
28306
|
return;
|
|
28089
28307
|
resolve2({
|
|
28090
28308
|
status: "failed",
|
|
@@ -28092,13 +28310,13 @@ class CodexDriver {
|
|
|
28092
28310
|
});
|
|
28093
28311
|
}, SETTINGS_UPDATE_TIMEOUT_MS);
|
|
28094
28312
|
timer.unref?.();
|
|
28095
|
-
this.pendingSettingsUpdates.set(
|
|
28313
|
+
this.pendingSettingsUpdates.set(id2, { resolve: resolve2, timer });
|
|
28096
28314
|
try {
|
|
28097
|
-
stdin.write(jsonRpcRequest("thread/settings/update", { threadId, effort: input2.reasoningEffort },
|
|
28315
|
+
stdin.write(jsonRpcRequest("thread/settings/update", { threadId, effort: input2.reasoningEffort }, id2) + `
|
|
28098
28316
|
`);
|
|
28099
28317
|
} catch (error62) {
|
|
28100
28318
|
clearTimeout(timer);
|
|
28101
|
-
this.pendingSettingsUpdates.delete(
|
|
28319
|
+
this.pendingSettingsUpdates.delete(id2);
|
|
28102
28320
|
resolve2({
|
|
28103
28321
|
status: "failed",
|
|
28104
28322
|
error: this.settingsError("process", "settings_update_write_failed", String(error62), true)
|
|
@@ -28147,9 +28365,9 @@ class CodexDriver {
|
|
|
28147
28365
|
return { category, code, message: scrubDriverErrorMessage(message2), retryable };
|
|
28148
28366
|
}
|
|
28149
28367
|
failPendingSettingsUpdates(code, message2) {
|
|
28150
|
-
for (const [
|
|
28368
|
+
for (const [id2, pending] of this.pendingSettingsUpdates) {
|
|
28151
28369
|
clearTimeout(pending.timer);
|
|
28152
|
-
this.pendingSettingsUpdates.delete(
|
|
28370
|
+
this.pendingSettingsUpdates.delete(id2);
|
|
28153
28371
|
pending.resolve({
|
|
28154
28372
|
status: "failed",
|
|
28155
28373
|
error: this.settingsError("process", code, message2, true)
|
|
@@ -28703,7 +28921,7 @@ class CursorAcpLane {
|
|
|
28703
28921
|
return this.request(method, params, this.options.handshakeTimeoutMs ?? HANDSHAKE_TIMEOUT_MS).promise;
|
|
28704
28922
|
}
|
|
28705
28923
|
request(method, params, timeoutMs) {
|
|
28706
|
-
const
|
|
28924
|
+
const id2 = ++this.requestSequence;
|
|
28707
28925
|
let resolve2;
|
|
28708
28926
|
let reject;
|
|
28709
28927
|
const promise2 = new Promise((accept, decline) => {
|
|
@@ -28711,24 +28929,24 @@ class CursorAcpLane {
|
|
|
28711
28929
|
reject = decline;
|
|
28712
28930
|
});
|
|
28713
28931
|
const timer = timeoutMs === undefined ? undefined : setTimeout(() => {
|
|
28714
|
-
const pending = this.pending.get(
|
|
28932
|
+
const pending = this.pending.get(id2);
|
|
28715
28933
|
if (!pending || pending.kind !== "call")
|
|
28716
28934
|
return;
|
|
28717
|
-
this.pending.delete(
|
|
28935
|
+
this.pending.delete(id2);
|
|
28718
28936
|
pending.reject(new Error(`Cursor ACP ${method} timed out`));
|
|
28719
28937
|
}, timeoutMs);
|
|
28720
28938
|
timer?.unref?.();
|
|
28721
|
-
this.pending.set(
|
|
28939
|
+
this.pending.set(id2, { kind: "call", method, resolve: resolve2, reject, ...timer ? { timer } : {} });
|
|
28722
28940
|
try {
|
|
28723
|
-
this.write({ jsonrpc: "2.0", id, method, params });
|
|
28941
|
+
this.write({ jsonrpc: "2.0", id: id2, method, params });
|
|
28724
28942
|
} catch (error62) {
|
|
28725
|
-
const pending = this.pending.get(
|
|
28726
|
-
this.pending.delete(
|
|
28943
|
+
const pending = this.pending.get(id2);
|
|
28944
|
+
this.pending.delete(id2);
|
|
28727
28945
|
if (pending?.kind === "call" && pending.timer)
|
|
28728
28946
|
clearTimeout(pending.timer);
|
|
28729
28947
|
throw error62 instanceof Error ? error62 : new Error(String(error62));
|
|
28730
28948
|
}
|
|
28731
|
-
return { id, promise: promise2 };
|
|
28949
|
+
return { id: id2, promise: promise2 };
|
|
28732
28950
|
}
|
|
28733
28951
|
write(message2) {
|
|
28734
28952
|
const stdin = this.process?.stdin;
|
|
@@ -28834,14 +29052,14 @@ class CursorAcpLane {
|
|
|
28834
29052
|
}
|
|
28835
29053
|
this.protocolFailure("Cursor ACP emitted an unrecognized JSON-RPC message");
|
|
28836
29054
|
}
|
|
28837
|
-
handleResponse(
|
|
28838
|
-
const pending = typeof
|
|
28839
|
-
if (typeof
|
|
29055
|
+
handleResponse(id2, message2) {
|
|
29056
|
+
const pending = typeof id2 === "number" ? this.pending.get(id2) : undefined;
|
|
29057
|
+
if (typeof id2 !== "number" || !pending) {
|
|
28840
29058
|
this.diagnostic("warning", "Cursor ACP emitted a duplicate or unknown response id");
|
|
28841
29059
|
return;
|
|
28842
29060
|
}
|
|
28843
29061
|
if (pending.kind === "prompt") {
|
|
28844
|
-
this.pending.delete(
|
|
29062
|
+
this.pending.delete(id2);
|
|
28845
29063
|
if (message2.error !== undefined) {
|
|
28846
29064
|
const payload = record3(message2.error);
|
|
28847
29065
|
const rpcCode = typeof payload?.code === "number" && Number.isSafeInteger(payload.code) ? payload.code : undefined;
|
|
@@ -28855,20 +29073,20 @@ class CursorAcpLane {
|
|
|
28855
29073
|
}
|
|
28856
29074
|
if (message2.error !== undefined) {
|
|
28857
29075
|
const payload = record3(message2.error);
|
|
28858
|
-
this.settleRequest(
|
|
29076
|
+
this.settleRequest(id2, false, new CursorAcpRpcError(pending.method, typeof payload?.code === "number" ? payload.code : undefined, rpcErrorMessage(message2.error)));
|
|
28859
29077
|
return;
|
|
28860
29078
|
}
|
|
28861
29079
|
if (!("result" in message2)) {
|
|
28862
|
-
this.settleRequest(
|
|
29080
|
+
this.settleRequest(id2, false, new Error("Cursor ACP response omitted result"));
|
|
28863
29081
|
return;
|
|
28864
29082
|
}
|
|
28865
|
-
this.settleRequest(
|
|
29083
|
+
this.settleRequest(id2, true, message2.result);
|
|
28866
29084
|
}
|
|
28867
|
-
settleRequest(
|
|
28868
|
-
const pending = this.pending.get(
|
|
29085
|
+
settleRequest(id2, ok, value) {
|
|
29086
|
+
const pending = this.pending.get(id2);
|
|
28869
29087
|
if (!pending || pending.kind !== "call")
|
|
28870
29088
|
return;
|
|
28871
|
-
this.pending.delete(
|
|
29089
|
+
this.pending.delete(id2);
|
|
28872
29090
|
if (pending.timer)
|
|
28873
29091
|
clearTimeout(pending.timer);
|
|
28874
29092
|
if (ok)
|
|
@@ -28876,11 +29094,11 @@ class CursorAcpLane {
|
|
|
28876
29094
|
else
|
|
28877
29095
|
pending.reject(value instanceof Error ? value : new Error(String(value)));
|
|
28878
29096
|
}
|
|
28879
|
-
handleRequest(
|
|
29097
|
+
handleRequest(id2, method, params) {
|
|
28880
29098
|
if (method !== "session/request_permission") {
|
|
28881
29099
|
this.write({
|
|
28882
29100
|
jsonrpc: "2.0",
|
|
28883
|
-
id,
|
|
29101
|
+
id: id2,
|
|
28884
29102
|
error: { code: -32601, message: "Unsupported Cursor ACP client request" }
|
|
28885
29103
|
});
|
|
28886
29104
|
this.diagnostic("warning", `Unsupported Cursor ACP client request: ${safeLabel(method)}`);
|
|
@@ -28891,13 +29109,13 @@ class CursorAcpLane {
|
|
|
28891
29109
|
const options = Array.isArray(payload?.options) ? payload.options.map(record3).filter(Boolean) : [];
|
|
28892
29110
|
const allowOnce = options.find((option) => option.kind === "allow_once" && typeof option.optionId === "string" && option.optionId.trim().length > 0);
|
|
28893
29111
|
if (!this.ready || this.currentPromptRequestId === null || !sameSession || !allowOnce) {
|
|
28894
|
-
this.write({ jsonrpc: "2.0", id, result: { outcome: { outcome: "cancelled" } } });
|
|
29112
|
+
this.write({ jsonrpc: "2.0", id: id2, result: { outcome: { outcome: "cancelled" } } });
|
|
28895
29113
|
this.diagnostic("error", "Cursor ACP permission request was not allowed for the active prompt");
|
|
28896
29114
|
return;
|
|
28897
29115
|
}
|
|
28898
29116
|
this.write({
|
|
28899
29117
|
jsonrpc: "2.0",
|
|
28900
|
-
id,
|
|
29118
|
+
id: id2,
|
|
28901
29119
|
result: { outcome: { outcome: "selected", optionId: allowOnce.optionId } }
|
|
28902
29120
|
});
|
|
28903
29121
|
}
|
|
@@ -28985,8 +29203,8 @@ class CursorAcpLane {
|
|
|
28985
29203
|
this.stop({ reason: "protocol_error", forceAfterMs: 0 }).catch(() => {});
|
|
28986
29204
|
}
|
|
28987
29205
|
rejectAllPending(error62) {
|
|
28988
|
-
for (const [
|
|
28989
|
-
this.pending.delete(
|
|
29206
|
+
for (const [id2, pending] of [...this.pending]) {
|
|
29207
|
+
this.pending.delete(id2);
|
|
28990
29208
|
if (pending.kind === "call") {
|
|
28991
29209
|
if (pending.timer)
|
|
28992
29210
|
clearTimeout(pending.timer);
|
|
@@ -29294,14 +29512,14 @@ function parseGrokModelCatalog(value) {
|
|
|
29294
29512
|
const models = [];
|
|
29295
29513
|
for (const item of available) {
|
|
29296
29514
|
const model = asRecord(item);
|
|
29297
|
-
const
|
|
29298
|
-
if (!model || !
|
|
29515
|
+
const id2 = normalizeRuntimeModelId(model?.modelId);
|
|
29516
|
+
if (!model || !id2 || seen.has(id2))
|
|
29299
29517
|
continue;
|
|
29300
29518
|
if (models.length >= RUNTIME_MODEL_CATALOG_MAX)
|
|
29301
29519
|
return;
|
|
29302
|
-
seen.add(
|
|
29520
|
+
seen.add(id2);
|
|
29303
29521
|
const displayName = boundedText2(model.name, MODEL_DISPLAY_NAME_MAX2);
|
|
29304
|
-
models.push({ id, ...displayName ? { displayName } : {}, ...reasoningCatalog(model) });
|
|
29522
|
+
models.push({ id: id2, ...displayName ? { displayName } : {}, ...reasoningCatalog(model) });
|
|
29305
29523
|
}
|
|
29306
29524
|
if (models.length === 0)
|
|
29307
29525
|
return;
|
|
@@ -29355,13 +29573,13 @@ async function probeGrokAcpCatalog(command, options = {}) {
|
|
|
29355
29573
|
const cleanup = options.cleanup ?? cleanupProbeProcess2;
|
|
29356
29574
|
Promise.resolve().then(() => cleanup(processHandle)).catch(() => {}).finally(() => resolve2(value));
|
|
29357
29575
|
};
|
|
29358
|
-
const write = (method, params,
|
|
29576
|
+
const write = (method, params, id2) => {
|
|
29359
29577
|
const stdin = processHandle.stdin;
|
|
29360
29578
|
if (!stdin || stdin.destroyed || stdin.writableEnded || stdin.writable === false) {
|
|
29361
29579
|
return finish({ status: "unhealthy", lastError: "grok_acp_transport_unavailable" });
|
|
29362
29580
|
}
|
|
29363
29581
|
try {
|
|
29364
|
-
stdin.write(`${jsonRpcRequest(method, params,
|
|
29582
|
+
stdin.write(`${jsonRpcRequest(method, params, id2)}
|
|
29365
29583
|
`);
|
|
29366
29584
|
} catch {
|
|
29367
29585
|
finish({ status: "unhealthy", lastError: "grok_acp_transport_unavailable" });
|
|
@@ -29395,8 +29613,8 @@ async function probeGrokAcpCatalog(command, options = {}) {
|
|
|
29395
29613
|
const capabilities = asRecord(result.agentCapabilities);
|
|
29396
29614
|
const methods = Array.isArray(result.authMethods) ? result.authMethods : [];
|
|
29397
29615
|
const methodIds = methods.flatMap((method) => {
|
|
29398
|
-
const
|
|
29399
|
-
return typeof
|
|
29616
|
+
const id2 = asRecord(method)?.id;
|
|
29617
|
+
return typeof id2 === "string" ? [id2] : [];
|
|
29400
29618
|
});
|
|
29401
29619
|
if (result.protocolVersion !== ACP_PROTOCOL_VERSION4) {
|
|
29402
29620
|
return finish({ status: "unhealthy", lastError: "grok_acp_protocol_incompatible" });
|
|
@@ -29405,7 +29623,7 @@ async function probeGrokAcpCatalog(command, options = {}) {
|
|
|
29405
29623
|
return finish({ status: "unhealthy", lastError: "grok_acp_load_session_unsupported" });
|
|
29406
29624
|
}
|
|
29407
29625
|
if (!methodIds.includes(AUTH_METHOD_ID4)) {
|
|
29408
|
-
if (methodIds.some((
|
|
29626
|
+
if (methodIds.some((id2) => INTERACTIVE_AUTH_METHOD_IDS.has(id2))) {
|
|
29409
29627
|
return finish({ status: "unhealthy", lastError: "grok_acp_authentication_failed" });
|
|
29410
29628
|
}
|
|
29411
29629
|
return finish({ status: "unhealthy", lastError: "grok_acp_cached_auth_unsupported" });
|
|
@@ -29762,11 +29980,11 @@ class GrokAcpLane {
|
|
|
29762
29980
|
}
|
|
29763
29981
|
const authMethods = Array.isArray(initialize.authMethods) ? initialize.authMethods : [];
|
|
29764
29982
|
const authMethodIds = authMethods.flatMap((method) => {
|
|
29765
|
-
const
|
|
29766
|
-
return typeof
|
|
29983
|
+
const id2 = asRecord(method)?.id;
|
|
29984
|
+
return typeof id2 === "string" ? [id2] : [];
|
|
29767
29985
|
});
|
|
29768
29986
|
if (!authMethodIds.includes(AUTH_METHOD_ID5)) {
|
|
29769
|
-
if (authMethodIds.some((
|
|
29987
|
+
if (authMethodIds.some((id2) => INTERACTIVE_AUTH_METHOD_IDS2.has(id2))) {
|
|
29770
29988
|
throw new GrokAcpAuthenticationError("Grok authentication failed; run `grok login` and retry");
|
|
29771
29989
|
}
|
|
29772
29990
|
throw new GrokAcpIncompatibleError("Installed Grok ACP does not expose cached-token authentication");
|
|
@@ -29932,7 +30150,7 @@ class GrokAcpLane {
|
|
|
29932
30150
|
return this.request(method, params, timeoutMs ?? this.options.handshakeTimeoutMs ?? HANDSHAKE_TIMEOUT_MS2).promise;
|
|
29933
30151
|
}
|
|
29934
30152
|
request(method, params, timeoutMs) {
|
|
29935
|
-
const
|
|
30153
|
+
const id2 = ++this.requestSequence;
|
|
29936
30154
|
let resolve2;
|
|
29937
30155
|
let reject;
|
|
29938
30156
|
const promise2 = new Promise((accept, decline) => {
|
|
@@ -29940,24 +30158,24 @@ class GrokAcpLane {
|
|
|
29940
30158
|
reject = decline;
|
|
29941
30159
|
});
|
|
29942
30160
|
const timer = timeoutMs === undefined ? undefined : setTimeout(() => {
|
|
29943
|
-
const pending = this.pending.get(
|
|
30161
|
+
const pending = this.pending.get(id2);
|
|
29944
30162
|
if (!pending || pending.kind !== "call")
|
|
29945
30163
|
return;
|
|
29946
|
-
this.pending.delete(
|
|
30164
|
+
this.pending.delete(id2);
|
|
29947
30165
|
pending.reject(new Error(`Grok ACP ${method} timed out`));
|
|
29948
30166
|
}, timeoutMs);
|
|
29949
30167
|
timer?.unref?.();
|
|
29950
|
-
this.pending.set(
|
|
30168
|
+
this.pending.set(id2, { kind: "call", method, resolve: resolve2, reject, ...timer ? { timer } : {} });
|
|
29951
30169
|
try {
|
|
29952
|
-
this.write({ jsonrpc: "2.0", id, method, params });
|
|
30170
|
+
this.write({ jsonrpc: "2.0", id: id2, method, params });
|
|
29953
30171
|
} catch (error62) {
|
|
29954
|
-
const pending = this.pending.get(
|
|
29955
|
-
this.pending.delete(
|
|
30172
|
+
const pending = this.pending.get(id2);
|
|
30173
|
+
this.pending.delete(id2);
|
|
29956
30174
|
if (pending?.kind === "call" && pending.timer)
|
|
29957
30175
|
clearTimeout(pending.timer);
|
|
29958
30176
|
throw error62 instanceof Error ? error62 : new Error(String(error62));
|
|
29959
30177
|
}
|
|
29960
|
-
return { id, promise: promise2 };
|
|
30178
|
+
return { id: id2, promise: promise2 };
|
|
29961
30179
|
}
|
|
29962
30180
|
write(message2) {
|
|
29963
30181
|
const stdin = this.process?.stdin;
|
|
@@ -30057,14 +30275,14 @@ class GrokAcpLane {
|
|
|
30057
30275
|
}
|
|
30058
30276
|
this.protocolFailure("Grok ACP emitted an unrecognized JSON-RPC message");
|
|
30059
30277
|
}
|
|
30060
|
-
handleResponse(
|
|
30061
|
-
const pending = typeof
|
|
30062
|
-
if (typeof
|
|
30278
|
+
handleResponse(id2, message2) {
|
|
30279
|
+
const pending = typeof id2 === "number" ? this.pending.get(id2) : undefined;
|
|
30280
|
+
if (typeof id2 !== "number" || !pending) {
|
|
30063
30281
|
this.diagnostic("warning", "Grok ACP emitted a duplicate or unknown response id");
|
|
30064
30282
|
return;
|
|
30065
30283
|
}
|
|
30066
30284
|
if (pending.kind === "prompt") {
|
|
30067
|
-
this.pending.delete(
|
|
30285
|
+
this.pending.delete(id2);
|
|
30068
30286
|
if (message2.error !== undefined) {
|
|
30069
30287
|
const payload = asRecord(message2.error);
|
|
30070
30288
|
const code = typeof payload?.code === "number" && Number.isSafeInteger(payload.code) ? payload.code : undefined;
|
|
@@ -30078,20 +30296,20 @@ class GrokAcpLane {
|
|
|
30078
30296
|
}
|
|
30079
30297
|
if (message2.error !== undefined) {
|
|
30080
30298
|
const payload = asRecord(message2.error);
|
|
30081
|
-
this.settleRequest(
|
|
30299
|
+
this.settleRequest(id2, false, new GrokAcpRpcError(pending.method, typeof payload?.code === "number" && Number.isSafeInteger(payload.code) ? payload.code : undefined, rpcErrorMessage2(message2.error)));
|
|
30082
30300
|
return;
|
|
30083
30301
|
}
|
|
30084
30302
|
if (!("result" in message2)) {
|
|
30085
|
-
this.settleRequest(
|
|
30303
|
+
this.settleRequest(id2, false, new Error("Grok ACP response omitted result"));
|
|
30086
30304
|
return;
|
|
30087
30305
|
}
|
|
30088
|
-
this.settleRequest(
|
|
30306
|
+
this.settleRequest(id2, true, message2.result);
|
|
30089
30307
|
}
|
|
30090
|
-
settleRequest(
|
|
30091
|
-
const pending = this.pending.get(
|
|
30308
|
+
settleRequest(id2, ok, value) {
|
|
30309
|
+
const pending = this.pending.get(id2);
|
|
30092
30310
|
if (!pending || pending.kind !== "call")
|
|
30093
30311
|
return;
|
|
30094
|
-
this.pending.delete(
|
|
30312
|
+
this.pending.delete(id2);
|
|
30095
30313
|
if (pending.timer)
|
|
30096
30314
|
clearTimeout(pending.timer);
|
|
30097
30315
|
if (ok)
|
|
@@ -30099,9 +30317,9 @@ class GrokAcpLane {
|
|
|
30099
30317
|
else
|
|
30100
30318
|
pending.reject(value instanceof Error ? value : new Error(String(value)));
|
|
30101
30319
|
}
|
|
30102
|
-
handleRequest(
|
|
30320
|
+
handleRequest(id2, method, params) {
|
|
30103
30321
|
if (method !== "session/request_permission") {
|
|
30104
|
-
this.write({ jsonrpc: "2.0", id, error: { code: -32601, message: "Unsupported Grok ACP client request" } });
|
|
30322
|
+
this.write({ jsonrpc: "2.0", id: id2, error: { code: -32601, message: "Unsupported Grok ACP client request" } });
|
|
30105
30323
|
this.diagnostic("warning", `Unsupported Grok ACP client request: ${safeLabel2(method)}`);
|
|
30106
30324
|
return;
|
|
30107
30325
|
}
|
|
@@ -30109,13 +30327,13 @@ class GrokAcpLane {
|
|
|
30109
30327
|
const options = Array.isArray(payload?.options) ? payload.options.map(asRecord).filter(Boolean) : [];
|
|
30110
30328
|
const allowOnce = options.find((option) => option.kind === "allow_once" && typeof option.optionId === "string" && option.optionId.trim());
|
|
30111
30329
|
if (!this.ready || this.currentPromptRequestId === null || payload?.sessionId !== this.sessionId || !allowOnce) {
|
|
30112
|
-
this.write({ jsonrpc: "2.0", id, result: { outcome: { outcome: "cancelled" } } });
|
|
30330
|
+
this.write({ jsonrpc: "2.0", id: id2, result: { outcome: { outcome: "cancelled" } } });
|
|
30113
30331
|
this.diagnostic("error", "Grok ACP permission request was not allowed for the active prompt");
|
|
30114
30332
|
return;
|
|
30115
30333
|
}
|
|
30116
30334
|
this.write({
|
|
30117
30335
|
jsonrpc: "2.0",
|
|
30118
|
-
id,
|
|
30336
|
+
id: id2,
|
|
30119
30337
|
result: { outcome: { outcome: "selected", optionId: allowOnce.optionId } }
|
|
30120
30338
|
});
|
|
30121
30339
|
}
|
|
@@ -30277,8 +30495,8 @@ class GrokAcpLane {
|
|
|
30277
30495
|
this.stop({ reason: "protocol_error", forceAfterMs: 0 }).catch(() => {});
|
|
30278
30496
|
}
|
|
30279
30497
|
rejectAllPending(error62) {
|
|
30280
|
-
for (const [
|
|
30281
|
-
this.pending.delete(
|
|
30498
|
+
for (const [id2, pending] of [...this.pending]) {
|
|
30499
|
+
this.pending.delete(id2);
|
|
30282
30500
|
if (pending.kind === "call") {
|
|
30283
30501
|
if (pending.timer)
|
|
30284
30502
|
clearTimeout(pending.timer);
|
|
@@ -32255,10 +32473,10 @@ function createAgentDriverRegistry(registrations) {
|
|
|
32255
32473
|
const backendIds = Object.freeze([...entries.keys()]);
|
|
32256
32474
|
return Object.freeze({
|
|
32257
32475
|
backendIds,
|
|
32258
|
-
get(
|
|
32259
|
-
const registration = entries.get(
|
|
32476
|
+
get(id2) {
|
|
32477
|
+
const registration = entries.get(id2);
|
|
32260
32478
|
if (!registration)
|
|
32261
|
-
throw new Error(`Unknown agent backend: ${
|
|
32479
|
+
throw new Error(`Unknown agent backend: ${id2}`);
|
|
32262
32480
|
return registration;
|
|
32263
32481
|
}
|
|
32264
32482
|
});
|
|
@@ -34130,11 +34348,11 @@ function getDriver(runtimeId) {
|
|
|
34130
34348
|
if (!BUILTIN_BACKEND_IDS.includes(runtimeId)) {
|
|
34131
34349
|
throw new Error(`Unknown runtime: ${runtimeId}. Available: ${BUILTIN_BACKEND_IDS.join(", ")}`);
|
|
34132
34350
|
}
|
|
34133
|
-
const
|
|
34351
|
+
const id2 = runtimeId;
|
|
34134
34352
|
return {
|
|
34135
|
-
id,
|
|
34136
|
-
capabilities: capabilitiesFor(
|
|
34137
|
-
probe: () => createAgentDriverSdk2().probe({ backend:
|
|
34353
|
+
id: id2,
|
|
34354
|
+
capabilities: capabilitiesFor(id2),
|
|
34355
|
+
probe: () => createAgentDriverSdk2().probe({ backend: id2 })
|
|
34138
34356
|
};
|
|
34139
34357
|
}
|
|
34140
34358
|
function listRuntimeIds() {
|
|
@@ -34178,20 +34396,20 @@ async function detectRuntimes() {
|
|
|
34178
34396
|
const ids = listRuntimeIds();
|
|
34179
34397
|
const results = [];
|
|
34180
34398
|
const nowIso = new Date().toISOString();
|
|
34181
|
-
for (const
|
|
34399
|
+
for (const id2 of ids) {
|
|
34182
34400
|
try {
|
|
34183
|
-
const driver = getDriver(
|
|
34401
|
+
const driver = getDriver(id2);
|
|
34184
34402
|
const probe = await driver.probe();
|
|
34185
34403
|
if (probe.status === "healthy") {
|
|
34186
34404
|
results.push({
|
|
34187
|
-
id,
|
|
34405
|
+
id: id2,
|
|
34188
34406
|
status: "healthy",
|
|
34189
34407
|
version: probe.version,
|
|
34190
34408
|
reasoning: probe.reasoning
|
|
34191
34409
|
});
|
|
34192
34410
|
} else {
|
|
34193
34411
|
results.push({
|
|
34194
|
-
id,
|
|
34412
|
+
id: id2,
|
|
34195
34413
|
status: "unhealthy",
|
|
34196
34414
|
lastError: probe.error.code ?? "probe_failed",
|
|
34197
34415
|
lastErrorAt: nowIso
|
|
@@ -34199,7 +34417,7 @@ async function detectRuntimes() {
|
|
|
34199
34417
|
}
|
|
34200
34418
|
} catch (err) {
|
|
34201
34419
|
results.push({
|
|
34202
|
-
id,
|
|
34420
|
+
id: id2,
|
|
34203
34421
|
status: "unhealthy",
|
|
34204
34422
|
lastError: err?.code ?? "probe_threw",
|
|
34205
34423
|
lastErrorAt: nowIso
|
|
@@ -35265,8 +35483,8 @@ var DEFAULT_HEADER_NAMES = {
|
|
|
35265
35483
|
function randomVoucher(prefix) {
|
|
35266
35484
|
return prefix + crypto3.randomBytes(32).toString("base64url");
|
|
35267
35485
|
}
|
|
35268
|
-
function sanitizeIdSegment(
|
|
35269
|
-
return
|
|
35486
|
+
function sanitizeIdSegment(id2) {
|
|
35487
|
+
return id2.replace(/[^A-Za-z0-9._-]/g, "_") || "_";
|
|
35270
35488
|
}
|
|
35271
35489
|
|
|
35272
35490
|
class CredentialBroker {
|
|
@@ -36222,14 +36440,14 @@ function onExit(state, agentId) {
|
|
|
36222
36440
|
function onTick(state, nowMs) {
|
|
36223
36441
|
const effects = [];
|
|
36224
36442
|
const agents = { ...state.agents };
|
|
36225
|
-
for (const
|
|
36226
|
-
const a = agents[
|
|
36443
|
+
for (const id2 of Object.keys(agents)) {
|
|
36444
|
+
const a = agents[id2];
|
|
36227
36445
|
const lease = a.execution.lease;
|
|
36228
36446
|
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
36447
|
if (stalled) {
|
|
36230
36448
|
const repeatedSessionStall = a.sessionId !== null && a.stalledSessionId === a.sessionId;
|
|
36231
36449
|
const forgetSessionId = repeatedSessionStall ? a.sessionId : undefined;
|
|
36232
|
-
agents[
|
|
36450
|
+
agents[id2] = {
|
|
36233
36451
|
...a,
|
|
36234
36452
|
status: "stopping",
|
|
36235
36453
|
sessionId: repeatedSessionStall ? null : a.sessionId,
|
|
@@ -36237,12 +36455,12 @@ function onTick(state, nowMs) {
|
|
|
36237
36455
|
idleSince: null,
|
|
36238
36456
|
stoppingSince: nowMs
|
|
36239
36457
|
};
|
|
36240
|
-
effects.push(forgetSessionId ? { type: "terminate_stalled", agentId:
|
|
36458
|
+
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
36459
|
continue;
|
|
36242
36460
|
}
|
|
36243
36461
|
const expiredAdmission = a.status === "running" && a.pendingAdmissions.filter((entry) => !entry.driverAcknowledged && nowMs - entry.admittedAt >= state.staleThresholdMs);
|
|
36244
36462
|
if (expiredAdmission && expiredAdmission.length > 0 && a.execution.sessionInstanceId !== null) {
|
|
36245
|
-
agents[
|
|
36463
|
+
agents[id2] = {
|
|
36246
36464
|
...a,
|
|
36247
36465
|
pendingAdmissions: a.pendingAdmissions.filter((entry) => !expiredAdmission.includes(entry)),
|
|
36248
36466
|
status: "stopping",
|
|
@@ -36252,7 +36470,7 @@ function onTick(state, nowMs) {
|
|
|
36252
36470
|
effects.push(...recoveryEffects(a, expiredAdmission));
|
|
36253
36471
|
effects.push({
|
|
36254
36472
|
type: "expire_admission",
|
|
36255
|
-
agentId:
|
|
36473
|
+
agentId: id2,
|
|
36256
36474
|
sessionInstanceId: a.execution.sessionInstanceId,
|
|
36257
36475
|
commandIds: expiredAdmission.map((entry) => entry.commandId)
|
|
36258
36476
|
});
|
|
@@ -36260,25 +36478,25 @@ function onTick(state, nowMs) {
|
|
|
36260
36478
|
}
|
|
36261
36479
|
const resetStuck = a.resetting && a.status !== "stopping" && a.resettingSince !== null && nowMs - a.resettingSince >= state.resetStuckThresholdMs;
|
|
36262
36480
|
if (resetStuck) {
|
|
36263
|
-
agents[
|
|
36264
|
-
effects.push({ type: "terminate_stalled", agentId:
|
|
36481
|
+
agents[id2] = { ...a, status: "stopping", idleSince: null, stoppingSince: nowMs };
|
|
36482
|
+
effects.push({ type: "terminate_stalled", agentId: id2 });
|
|
36265
36483
|
continue;
|
|
36266
36484
|
}
|
|
36267
36485
|
const stoppingStuck = a.status === "stopping" && a.stoppingSince !== null && nowMs - a.stoppingSince >= state.stoppingStuckThresholdMs;
|
|
36268
36486
|
if (stoppingStuck) {
|
|
36269
|
-
effects.push({ type: "force_exit", agentId:
|
|
36487
|
+
effects.push({ type: "force_exit", agentId: id2, reason: "stopping_stuck" });
|
|
36270
36488
|
continue;
|
|
36271
36489
|
}
|
|
36272
36490
|
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
36491
|
if (idleResetEligible && nowMs - a.idleSince >= state.idleResetTimeoutMs) {
|
|
36274
|
-
agents[
|
|
36275
|
-
effects.push({ type: "maintain_idle_memory", agentId:
|
|
36492
|
+
agents[id2] = { ...a, idleSince: nowMs };
|
|
36493
|
+
effects.push({ type: "maintain_idle_memory", agentId: id2, sessionId: a.sessionId });
|
|
36276
36494
|
continue;
|
|
36277
36495
|
}
|
|
36278
36496
|
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
36497
|
if (idleEligible && a.idleSince !== null && nowMs - a.idleSince >= state.idleTimeoutMs) {
|
|
36280
|
-
agents[
|
|
36281
|
-
effects.push({ type: "stop", agentId:
|
|
36498
|
+
agents[id2] = { ...a, status: "stopping", stoppingSince: nowMs };
|
|
36499
|
+
effects.push({ type: "stop", agentId: id2, reason: "idle_timeout" });
|
|
36282
36500
|
}
|
|
36283
36501
|
}
|
|
36284
36502
|
return { state: { ...state, agents }, effects };
|
|
@@ -36392,7 +36610,7 @@ var MEMORY_MAINTENANCE_PROMPT = `The daemon is preparing to reset this idle sess
|
|
|
36392
36610
|
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.
|
|
36393
36611
|
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.
|
|
36394
36612
|
|
|
36395
|
-
Edit only your own memory files.
|
|
36613
|
+
Edit only your own memory files. This review is internal maintenance; perform it silently. Do not proactively send the owner, users, or channels progress updates, completion notices, or details about your memory state. Communicate task-relevant results, questions, and blockers normally. If nothing needs a user-facing response, send no message.
|
|
36396
36614
|
|
|
36397
36615
|
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:
|
|
36398
36616
|
|
|
@@ -37676,8 +37894,8 @@ class AgentProcessManager {
|
|
|
37676
37894
|
if (eventAgentId) {
|
|
37677
37895
|
emit(eventAgentId);
|
|
37678
37896
|
} else if (event.type === "tick") {
|
|
37679
|
-
for (const
|
|
37680
|
-
emit(
|
|
37897
|
+
for (const id2 of Object.keys(this.state.agents))
|
|
37898
|
+
emit(id2);
|
|
37681
37899
|
}
|
|
37682
37900
|
}
|
|
37683
37901
|
if (closingOwner && closingSpan) {
|
|
@@ -38637,7 +38855,7 @@ var REWAKE_PROMPT = `Your session was reset by your owner. Prior conversation co
|
|
|
38637
38855
|
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.
|
|
38638
38856
|
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.
|
|
38639
38857
|
|
|
38640
|
-
Edit only your own memory files.
|
|
38858
|
+
Edit only your own memory files. This review is internal maintenance; perform it silently. Do not proactively send the owner, users, or channels progress updates, completion notices, or details about your memory state. Communicate task-relevant results, questions, and blockers normally. If nothing needs a user-facing response, send no message.
|
|
38641
38859
|
|
|
38642
38860
|
After completing the review and any needed edits, resume outstanding work and handle your inbox messages.`;
|
|
38643
38861
|
var MODEL_SWITCH_REWAKE_PROMPT = "You were just switched to a different model. Continue any unfinished work.";
|
|
@@ -38705,32 +38923,32 @@ class AgentRouter {
|
|
|
38705
38923
|
}
|
|
38706
38924
|
return out;
|
|
38707
38925
|
}
|
|
38708
|
-
isRuntimeHealthy(
|
|
38709
|
-
return this.runtimes.get(
|
|
38926
|
+
isRuntimeHealthy(id2) {
|
|
38927
|
+
return this.runtimes.get(id2)?.status === "healthy";
|
|
38710
38928
|
}
|
|
38711
|
-
recordRuntimeSpawnFailure(
|
|
38929
|
+
recordRuntimeSpawnFailure(id2, reason) {
|
|
38712
38930
|
if (!DEFINITIVE_EXECUTABLE_FAILURES.has(reason))
|
|
38713
38931
|
return;
|
|
38714
|
-
this.markRuntimeUnhealthy(
|
|
38932
|
+
this.markRuntimeUnhealthy(id2, reason);
|
|
38715
38933
|
}
|
|
38716
|
-
markRuntimeUnhealthy(
|
|
38717
|
-
const existing = this.runtimes.get(
|
|
38934
|
+
markRuntimeUnhealthy(id2, reason) {
|
|
38935
|
+
const existing = this.runtimes.get(id2);
|
|
38718
38936
|
if (!existing)
|
|
38719
38937
|
return;
|
|
38720
38938
|
const nowIso = new Date().toISOString();
|
|
38721
38939
|
if (existing.status === "unhealthy" && existing.lastError === reason)
|
|
38722
38940
|
return;
|
|
38723
|
-
this.runtimes.set(
|
|
38941
|
+
this.runtimes.set(id2, {
|
|
38724
38942
|
...existing,
|
|
38725
38943
|
status: "unhealthy",
|
|
38726
38944
|
lastError: reason,
|
|
38727
38945
|
lastErrorAt: nowIso
|
|
38728
38946
|
});
|
|
38729
|
-
this.log.warn("runtime marked unhealthy", { runtimeId:
|
|
38947
|
+
this.log.warn("runtime marked unhealthy", { runtimeId: id2, reason });
|
|
38730
38948
|
this.scheduleReadyFrameResend();
|
|
38731
38949
|
}
|
|
38732
|
-
markRuntimeHealthy(
|
|
38733
|
-
const existing = this.runtimes.get(
|
|
38950
|
+
markRuntimeHealthy(id2) {
|
|
38951
|
+
const existing = this.runtimes.get(id2);
|
|
38734
38952
|
if (!existing)
|
|
38735
38953
|
return;
|
|
38736
38954
|
if (existing.status === "healthy" && !existing.lastError && !existing.lastErrorAt)
|
|
@@ -38738,8 +38956,8 @@ class AgentRouter {
|
|
|
38738
38956
|
const healthy = { ...existing, status: "healthy" };
|
|
38739
38957
|
delete healthy.lastError;
|
|
38740
38958
|
delete healthy.lastErrorAt;
|
|
38741
|
-
this.runtimes.set(
|
|
38742
|
-
this.log.info("runtime marked healthy again", { runtimeId:
|
|
38959
|
+
this.runtimes.set(id2, healthy);
|
|
38960
|
+
this.log.info("runtime marked healthy again", { runtimeId: id2 });
|
|
38743
38961
|
this.scheduleReadyFrameResend();
|
|
38744
38962
|
}
|
|
38745
38963
|
markLocallyStopped(agentId) {
|
|
@@ -43594,27 +43812,27 @@ var log2 = createLogger2({ header: "@alook/daemon" });
|
|
|
43594
43812
|
function daemonsDir(baseDir) {
|
|
43595
43813
|
return path17.join(baseDir, "daemons");
|
|
43596
43814
|
}
|
|
43597
|
-
function daemonDirById(baseDir,
|
|
43598
|
-
return path17.join(daemonsDir(baseDir), validateDaemonId(
|
|
43815
|
+
function daemonDirById(baseDir, id2) {
|
|
43816
|
+
return path17.join(daemonsDir(baseDir), validateDaemonId(id2));
|
|
43599
43817
|
}
|
|
43600
43818
|
function validateMachineId(machineId) {
|
|
43601
43819
|
if (!MACHINE_ID_PATTERN.test(machineId))
|
|
43602
43820
|
throw new Error("invalid machine identity returned by server");
|
|
43603
43821
|
return machineId;
|
|
43604
43822
|
}
|
|
43605
|
-
function isDaemonId(
|
|
43606
|
-
return MACHINE_ID_PATTERN.test(
|
|
43823
|
+
function isDaemonId(id2) {
|
|
43824
|
+
return MACHINE_ID_PATTERN.test(id2) || LEGACY_DAEMON_ID_PATTERN.test(id2);
|
|
43607
43825
|
}
|
|
43608
|
-
function validateDaemonId(
|
|
43609
|
-
if (!isDaemonId(
|
|
43826
|
+
function validateDaemonId(id2) {
|
|
43827
|
+
if (!isDaemonId(id2))
|
|
43610
43828
|
throw new Error("invalid daemon id");
|
|
43611
|
-
return
|
|
43829
|
+
return id2;
|
|
43612
43830
|
}
|
|
43613
|
-
function pidfilePathById(baseDir,
|
|
43614
|
-
return path17.join(daemonDirById(baseDir,
|
|
43831
|
+
function pidfilePathById(baseDir, id2) {
|
|
43832
|
+
return path17.join(daemonDirById(baseDir, id2), "daemon.pid");
|
|
43615
43833
|
}
|
|
43616
|
-
function statusFilePathById(baseDir,
|
|
43617
|
-
return path17.join(daemonDirById(baseDir,
|
|
43834
|
+
function statusFilePathById(baseDir, id2) {
|
|
43835
|
+
return path17.join(daemonDirById(baseDir, id2), "status.json");
|
|
43618
43836
|
}
|
|
43619
43837
|
function isProcessAlive(pid) {
|
|
43620
43838
|
try {
|
|
@@ -43950,7 +44168,7 @@ function daemonList(opts) {
|
|
|
43950
44168
|
return [];
|
|
43951
44169
|
const results = [];
|
|
43952
44170
|
const now = Date.now();
|
|
43953
|
-
const pushRow = (
|
|
44171
|
+
const pushRow = (id2, pidfile, statusPath) => {
|
|
43954
44172
|
const data = readPidFile(pidfile);
|
|
43955
44173
|
if (!data)
|
|
43956
44174
|
return;
|
|
@@ -43974,12 +44192,12 @@ function daemonList(opts) {
|
|
|
43974
44192
|
lastActiveMs = daemonLastActiveMs(s, now);
|
|
43975
44193
|
}
|
|
43976
44194
|
}
|
|
43977
|
-
results.push({ id, pid: data.pid, alive, agents, running, lastActiveMs });
|
|
44195
|
+
results.push({ id: id2, pid: data.pid, alive, agents, running, lastActiveMs });
|
|
43978
44196
|
};
|
|
43979
44197
|
for (const entry of fs12.readdirSync(dir, { withFileTypes: true })) {
|
|
43980
44198
|
if (entry.isDirectory() && isDaemonId(entry.name)) {
|
|
43981
|
-
const
|
|
43982
|
-
pushRow(
|
|
44199
|
+
const id2 = entry.name;
|
|
44200
|
+
pushRow(id2, path17.join(dir, id2, "daemon.pid"), path17.join(dir, id2, "status.json"));
|
|
43983
44201
|
}
|
|
43984
44202
|
}
|
|
43985
44203
|
return results;
|
|
@@ -44759,10 +44977,10 @@ function getApi() {
|
|
|
44759
44977
|
throw new CliError("no ServerApi available — ALOOK_PROXY_URL + ALOOK_PROXY_TOKEN_FILE must be set");
|
|
44760
44978
|
}
|
|
44761
44979
|
function agentId(opts) {
|
|
44762
|
-
const
|
|
44763
|
-
if (!
|
|
44980
|
+
const id2 = opts.agent || process.env.ALOOK_AGENT_ID || process.env.ALOOK_ID;
|
|
44981
|
+
if (!id2)
|
|
44764
44982
|
throw new CliError("agent identity required — pass --agent <id> or set ALOOK_AGENT_ID");
|
|
44765
|
-
return
|
|
44983
|
+
return id2;
|
|
44766
44984
|
}
|
|
44767
44985
|
var TEXT_ESCAPE_MAP = { n: `
|
|
44768
44986
|
`, t: "\t", r: "\r", "\\": "\\" };
|
|
@@ -44902,14 +45120,23 @@ ${MESSAGE_SEND_STDIN_POLICY}`);
|
|
|
44902
45120
|
replyToSeq = n;
|
|
44903
45121
|
}
|
|
44904
45122
|
const nonce = randomUUID11();
|
|
44905
|
-
|
|
44906
|
-
|
|
44907
|
-
|
|
44908
|
-
|
|
44909
|
-
|
|
44910
|
-
|
|
44911
|
-
|
|
44912
|
-
|
|
45123
|
+
let res;
|
|
45124
|
+
try {
|
|
45125
|
+
res = await sendWithRetry(api2, {
|
|
45126
|
+
agentId: agent2,
|
|
45127
|
+
channel: channel2,
|
|
45128
|
+
content: { text: text2 ?? "" },
|
|
45129
|
+
attachments: attachmentIds.length > 0 ? attachmentIds : undefined,
|
|
45130
|
+
replyToSeq,
|
|
45131
|
+
nonce,
|
|
45132
|
+
...opts.force === true ? { force: true } : {}
|
|
45133
|
+
});
|
|
45134
|
+
} catch (err) {
|
|
45135
|
+
if (err instanceof Error && "code" in err && err.code === "duplicate_message") {
|
|
45136
|
+
err.hint = "If this message really needs to be sent, retry with --force. This only bypasses duplicate detection; channel alignment is still required.";
|
|
45137
|
+
}
|
|
45138
|
+
throw err;
|
|
45139
|
+
}
|
|
44913
45140
|
if (res.state === "blocked") {
|
|
44914
45141
|
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
45142
|
}
|
|
@@ -45042,14 +45269,14 @@ async function cmdAttachmentUpload(opts) {
|
|
|
45042
45269
|
async function cmdAttachmentDownload(opts) {
|
|
45043
45270
|
const api2 = getApi();
|
|
45044
45271
|
const agent2 = agentId(opts);
|
|
45045
|
-
const
|
|
45046
|
-
if (!
|
|
45272
|
+
const id2 = opts.id;
|
|
45273
|
+
if (!id2)
|
|
45047
45274
|
throw new CliError("message attachment download: --id <id> is required");
|
|
45048
45275
|
const outFlag = opts.out;
|
|
45049
45276
|
const os4 = await import("os");
|
|
45050
45277
|
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 });
|
|
45278
|
+
const destPath = outFlag ?? pathMod.join(os4.tmpdir(), "alook-attachments", agent2, id2, "file");
|
|
45279
|
+
const result = await api2.attachmentDownload({ agentId: agent2, id: id2, destPath });
|
|
45053
45280
|
if (!outFlag) {
|
|
45054
45281
|
const fs13 = await import("fs/promises");
|
|
45055
45282
|
const destDir = pathMod.dirname(destPath);
|
|
@@ -45287,7 +45514,7 @@ function buildProgram(stdin) {
|
|
|
45287
45514
|
}).option("--agent <id>", "agent identity (or ALOOK_AGENT_ID env)");
|
|
45288
45515
|
const message2 = program.command("message").description("message operations").exitOverride();
|
|
45289
45516
|
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() {
|
|
45517
|
+
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
45518
|
const localOpts = this.opts();
|
|
45292
45519
|
const globalOpts = program.opts();
|
|
45293
45520
|
const result = await cmdMessageSend({ ...globalOpts, ...localOpts }, stdin);
|
|
@@ -45418,13 +45645,13 @@ function buildProgram(stdin) {
|
|
|
45418
45645
|
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
45646
|
const localOpts = this.opts();
|
|
45420
45647
|
const machineKey = localOpts.machineKey;
|
|
45421
|
-
const
|
|
45422
|
-
if (!machineKey && !
|
|
45648
|
+
const id2 = localOpts.id;
|
|
45649
|
+
if (!machineKey && !id2 || machineKey && id2) {
|
|
45423
45650
|
throw new CliError("daemon start requires exactly one of --machine-key <key> or --id <machineId>");
|
|
45424
45651
|
}
|
|
45425
|
-
if (
|
|
45652
|
+
if (id2) {
|
|
45426
45653
|
await daemonStartById({
|
|
45427
|
-
id,
|
|
45654
|
+
id: id2,
|
|
45428
45655
|
baseDir: localOpts.baseDir,
|
|
45429
45656
|
foreground: localOpts.foreground === true
|
|
45430
45657
|
});
|
|
@@ -45467,10 +45694,10 @@ function buildProgram(stdin) {
|
|
|
45467
45694
|
requestId: localOpts.requestId
|
|
45468
45695
|
});
|
|
45469
45696
|
});
|
|
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(
|
|
45697
|
+
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
45698
|
const localOpts = this.opts();
|
|
45472
45699
|
await daemonStop({
|
|
45473
|
-
id,
|
|
45700
|
+
id: id2,
|
|
45474
45701
|
baseDir: localOpts.baseDir
|
|
45475
45702
|
});
|
|
45476
45703
|
});
|
|
@@ -45484,9 +45711,9 @@ function buildProgram(stdin) {
|
|
|
45484
45711
|
process.stdout.write(renderDaemonList(daemons) + `
|
|
45485
45712
|
`);
|
|
45486
45713
|
});
|
|
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(
|
|
45714
|
+
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
45715
|
const localOpts = this.opts();
|
|
45489
|
-
const status = daemonStatus({ id, baseDir: localOpts.baseDir });
|
|
45716
|
+
const status = daemonStatus({ id: id2, baseDir: localOpts.baseDir });
|
|
45490
45717
|
if (status.ambiguous) {
|
|
45491
45718
|
printEnvelope({
|
|
45492
45719
|
error: "multiple daemons on this machine — pass an id: `alook daemon status <id>`",
|