@alook/cli 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +116 -49
- package/dist/session-runner.js +136 -64
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -296,7 +296,7 @@ function statusCommand() {
|
|
|
296
296
|
// commands/daemon.ts
|
|
297
297
|
import { Command as Command3 } from "commander";
|
|
298
298
|
import { spawn as spawn2 } from "child_process";
|
|
299
|
-
import { openSync, closeSync, mkdirSync as
|
|
299
|
+
import { openSync as openSync2, closeSync as closeSync2, mkdirSync as mkdirSync4 } from "fs";
|
|
300
300
|
import { dirname as dirname3 } from "path";
|
|
301
301
|
|
|
302
302
|
// ../shared/src/constants.ts
|
|
@@ -13986,6 +13986,12 @@ var UpdateCalendarEventRequestSchema = exports_external.object({
|
|
|
13986
13986
|
message: "occurrence_at must be a valid ISO datetime"
|
|
13987
13987
|
}).optional()
|
|
13988
13988
|
}).refine((v) => v.title !== undefined || v.description !== undefined || v.agent_id !== undefined || v.scheduled_at !== undefined || v.repeat_interval !== undefined || v.repeat_stop_date !== undefined, { message: "at least one field is required" });
|
|
13989
|
+
var DeleteCalendarEventRequestSchema = exports_external.object({
|
|
13990
|
+
scope: exports_external.enum(["this", "following"]).optional(),
|
|
13991
|
+
occurrence_at: exports_external.string().min(1).refine((s) => !Number.isNaN(Date.parse(s)), {
|
|
13992
|
+
message: "occurrence_at must be a valid ISO datetime"
|
|
13993
|
+
}).optional()
|
|
13994
|
+
});
|
|
13989
13995
|
var CalendarEventApiSchema = exports_external.object({
|
|
13990
13996
|
id: exports_external.string(),
|
|
13991
13997
|
agent_id: exports_external.string(),
|
|
@@ -14000,7 +14006,7 @@ var CalendarEventApiSchema = exports_external.object({
|
|
|
14000
14006
|
created_at: exports_external.string(),
|
|
14001
14007
|
updated_at: exports_external.string()
|
|
14002
14008
|
});
|
|
14003
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14009
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/entity.js
|
|
14004
14010
|
var entityKind = Symbol.for("drizzle:entityKind");
|
|
14005
14011
|
var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
|
|
14006
14012
|
function is(value, type) {
|
|
@@ -14025,10 +14031,10 @@ function is(value, type) {
|
|
|
14025
14031
|
return false;
|
|
14026
14032
|
}
|
|
14027
14033
|
|
|
14028
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14034
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/table.utils.js
|
|
14029
14035
|
var TableName = Symbol.for("drizzle:Name");
|
|
14030
14036
|
|
|
14031
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14037
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/table.js
|
|
14032
14038
|
var Schema = Symbol.for("drizzle:Schema");
|
|
14033
14039
|
var Columns = Symbol.for("drizzle:Columns");
|
|
14034
14040
|
var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
|
|
@@ -14066,7 +14072,7 @@ class Table {
|
|
|
14066
14072
|
}
|
|
14067
14073
|
}
|
|
14068
14074
|
|
|
14069
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14075
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/column.js
|
|
14070
14076
|
class Column {
|
|
14071
14077
|
constructor(table, config2) {
|
|
14072
14078
|
this.table = table;
|
|
@@ -14116,7 +14122,7 @@ class Column {
|
|
|
14116
14122
|
}
|
|
14117
14123
|
}
|
|
14118
14124
|
|
|
14119
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14125
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/column-builder.js
|
|
14120
14126
|
class ColumnBuilder {
|
|
14121
14127
|
static [entityKind] = "ColumnBuilder";
|
|
14122
14128
|
config;
|
|
@@ -14172,17 +14178,17 @@ class ColumnBuilder {
|
|
|
14172
14178
|
}
|
|
14173
14179
|
}
|
|
14174
14180
|
|
|
14175
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14181
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/tracing-utils.js
|
|
14176
14182
|
function iife(fn, ...args) {
|
|
14177
14183
|
return fn(...args);
|
|
14178
14184
|
}
|
|
14179
14185
|
|
|
14180
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14186
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/pg-core/unique-constraint.js
|
|
14181
14187
|
function uniqueKeyName(table, columns) {
|
|
14182
14188
|
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
14183
14189
|
}
|
|
14184
14190
|
|
|
14185
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14191
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/pg-core/columns/common.js
|
|
14186
14192
|
class PgColumn extends Column {
|
|
14187
14193
|
constructor(table, config2) {
|
|
14188
14194
|
if (!config2.uniqueName) {
|
|
@@ -14231,7 +14237,7 @@ class ExtraConfigColumn extends PgColumn {
|
|
|
14231
14237
|
}
|
|
14232
14238
|
}
|
|
14233
14239
|
|
|
14234
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14240
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/pg-core/columns/enum.js
|
|
14235
14241
|
class PgEnumObjectColumn extends PgColumn {
|
|
14236
14242
|
static [entityKind] = "PgEnumObjectColumn";
|
|
14237
14243
|
enum;
|
|
@@ -14261,7 +14267,7 @@ class PgEnumColumn extends PgColumn {
|
|
|
14261
14267
|
}
|
|
14262
14268
|
}
|
|
14263
14269
|
|
|
14264
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14270
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/subquery.js
|
|
14265
14271
|
class Subquery {
|
|
14266
14272
|
static [entityKind] = "Subquery";
|
|
14267
14273
|
constructor(sql, fields, alias, isWith = false, usedTables = []) {
|
|
@@ -14276,10 +14282,10 @@ class Subquery {
|
|
|
14276
14282
|
}
|
|
14277
14283
|
}
|
|
14278
14284
|
|
|
14279
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14285
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/version.js
|
|
14280
14286
|
var version2 = "0.45.2";
|
|
14281
14287
|
|
|
14282
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14288
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/tracing.js
|
|
14283
14289
|
var otel;
|
|
14284
14290
|
var rawTracer;
|
|
14285
14291
|
var tracer = {
|
|
@@ -14306,10 +14312,10 @@ var tracer = {
|
|
|
14306
14312
|
}
|
|
14307
14313
|
};
|
|
14308
14314
|
|
|
14309
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14315
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/view-common.js
|
|
14310
14316
|
var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
|
|
14311
14317
|
|
|
14312
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14318
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sql/sql.js
|
|
14313
14319
|
function isSQLWrapper(value) {
|
|
14314
14320
|
return value !== null && value !== undefined && typeof value.getSQL === "function";
|
|
14315
14321
|
}
|
|
@@ -14669,7 +14675,7 @@ Subquery.prototype.getSQL = function() {
|
|
|
14669
14675
|
return new SQL([this]);
|
|
14670
14676
|
};
|
|
14671
14677
|
|
|
14672
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14678
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/utils.js
|
|
14673
14679
|
function getColumnNameAndConfig(a, b) {
|
|
14674
14680
|
return {
|
|
14675
14681
|
name: typeof a === "string" && a.length > 0 ? a : "",
|
|
@@ -14678,7 +14684,7 @@ function getColumnNameAndConfig(a, b) {
|
|
|
14678
14684
|
}
|
|
14679
14685
|
var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder;
|
|
14680
14686
|
|
|
14681
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14687
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/foreign-keys.js
|
|
14682
14688
|
class ForeignKeyBuilder {
|
|
14683
14689
|
static [entityKind] = "SQLiteForeignKeyBuilder";
|
|
14684
14690
|
reference;
|
|
@@ -14746,7 +14752,7 @@ function foreignKey(config2) {
|
|
|
14746
14752
|
return new ForeignKeyBuilder(mappedConfig);
|
|
14747
14753
|
}
|
|
14748
14754
|
|
|
14749
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14755
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/unique-constraint.js
|
|
14750
14756
|
function uniqueKeyName2(table, columns) {
|
|
14751
14757
|
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
14752
14758
|
}
|
|
@@ -14791,7 +14797,7 @@ class UniqueConstraint {
|
|
|
14791
14797
|
}
|
|
14792
14798
|
}
|
|
14793
14799
|
|
|
14794
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14800
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/columns/common.js
|
|
14795
14801
|
class SQLiteColumnBuilder extends ColumnBuilder {
|
|
14796
14802
|
static [entityKind] = "SQLiteColumnBuilder";
|
|
14797
14803
|
foreignKeyConfigs = [];
|
|
@@ -14842,7 +14848,7 @@ class SQLiteColumn extends Column {
|
|
|
14842
14848
|
static [entityKind] = "SQLiteColumn";
|
|
14843
14849
|
}
|
|
14844
14850
|
|
|
14845
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14851
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/columns/blob.js
|
|
14846
14852
|
class SQLiteBigIntBuilder extends SQLiteColumnBuilder {
|
|
14847
14853
|
static [entityKind] = "SQLiteBigIntBuilder";
|
|
14848
14854
|
constructor(name) {
|
|
@@ -14930,7 +14936,7 @@ function blob(a, b) {
|
|
|
14930
14936
|
return new SQLiteBlobBufferBuilder(name);
|
|
14931
14937
|
}
|
|
14932
14938
|
|
|
14933
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14939
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/columns/custom.js
|
|
14934
14940
|
class SQLiteCustomColumnBuilder extends SQLiteColumnBuilder {
|
|
14935
14941
|
static [entityKind] = "SQLiteCustomColumnBuilder";
|
|
14936
14942
|
constructor(name, fieldConfig, customTypeParams) {
|
|
@@ -14971,7 +14977,7 @@ function customType(customTypeParams) {
|
|
|
14971
14977
|
};
|
|
14972
14978
|
}
|
|
14973
14979
|
|
|
14974
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14980
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/columns/integer.js
|
|
14975
14981
|
class SQLiteBaseIntegerBuilder extends SQLiteColumnBuilder {
|
|
14976
14982
|
static [entityKind] = "SQLiteBaseIntegerBuilder";
|
|
14977
14983
|
constructor(name, dataType, columnType) {
|
|
@@ -15073,7 +15079,7 @@ function integer2(a, b) {
|
|
|
15073
15079
|
return new SQLiteIntegerBuilder(name);
|
|
15074
15080
|
}
|
|
15075
15081
|
|
|
15076
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
15082
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/columns/numeric.js
|
|
15077
15083
|
class SQLiteNumericBuilder extends SQLiteColumnBuilder {
|
|
15078
15084
|
static [entityKind] = "SQLiteNumericBuilder";
|
|
15079
15085
|
constructor(name) {
|
|
@@ -15143,7 +15149,7 @@ function numeric(a, b) {
|
|
|
15143
15149
|
return mode === "number" ? new SQLiteNumericNumberBuilder(name) : mode === "bigint" ? new SQLiteNumericBigIntBuilder(name) : new SQLiteNumericBuilder(name);
|
|
15144
15150
|
}
|
|
15145
15151
|
|
|
15146
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
15152
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/columns/real.js
|
|
15147
15153
|
class SQLiteRealBuilder extends SQLiteColumnBuilder {
|
|
15148
15154
|
static [entityKind] = "SQLiteRealBuilder";
|
|
15149
15155
|
constructor(name) {
|
|
@@ -15164,7 +15170,7 @@ function real(name) {
|
|
|
15164
15170
|
return new SQLiteRealBuilder(name ?? "");
|
|
15165
15171
|
}
|
|
15166
15172
|
|
|
15167
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
15173
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/columns/text.js
|
|
15168
15174
|
class SQLiteTextBuilder extends SQLiteColumnBuilder {
|
|
15169
15175
|
static [entityKind] = "SQLiteTextBuilder";
|
|
15170
15176
|
constructor(name, config2) {
|
|
@@ -15219,7 +15225,7 @@ function text(a, b = {}) {
|
|
|
15219
15225
|
return new SQLiteTextBuilder(name, config2);
|
|
15220
15226
|
}
|
|
15221
15227
|
|
|
15222
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
15228
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/columns/all.js
|
|
15223
15229
|
function getSQLiteColumnBuilders() {
|
|
15224
15230
|
return {
|
|
15225
15231
|
blob,
|
|
@@ -15231,7 +15237,7 @@ function getSQLiteColumnBuilders() {
|
|
|
15231
15237
|
};
|
|
15232
15238
|
}
|
|
15233
15239
|
|
|
15234
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
15240
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/table.js
|
|
15235
15241
|
var InlineForeignKeys = Symbol.for("drizzle:SQLiteInlineForeignKeys");
|
|
15236
15242
|
|
|
15237
15243
|
class SQLiteTable extends Table {
|
|
@@ -15265,7 +15271,7 @@ var sqliteTable = (name, columns, extraConfig) => {
|
|
|
15265
15271
|
return sqliteTableBase(name, columns, extraConfig);
|
|
15266
15272
|
};
|
|
15267
15273
|
|
|
15268
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
15274
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/indexes.js
|
|
15269
15275
|
class IndexBuilderOn {
|
|
15270
15276
|
constructor(name, unique2) {
|
|
15271
15277
|
this.name = name;
|
|
@@ -15308,7 +15314,7 @@ function index(name) {
|
|
|
15308
15314
|
return new IndexBuilderOn(name, false);
|
|
15309
15315
|
}
|
|
15310
15316
|
|
|
15311
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
15317
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/primary-keys.js
|
|
15312
15318
|
function primaryKey(...config2) {
|
|
15313
15319
|
if (config2[0].columns) {
|
|
15314
15320
|
return new PrimaryKeyBuilder(config2[0].columns, config2[0].name);
|
|
@@ -15343,13 +15349,13 @@ class PrimaryKey {
|
|
|
15343
15349
|
}
|
|
15344
15350
|
}
|
|
15345
15351
|
|
|
15346
|
-
// ../../node_modules/.pnpm/nanoid@5.1.
|
|
15352
|
+
// ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/index.js
|
|
15347
15353
|
import { webcrypto as crypto } from "node:crypto";
|
|
15348
15354
|
|
|
15349
|
-
// ../../node_modules/.pnpm/nanoid@5.1.
|
|
15355
|
+
// ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/url-alphabet/index.js
|
|
15350
15356
|
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
15351
15357
|
|
|
15352
|
-
// ../../node_modules/.pnpm/nanoid@5.1.
|
|
15358
|
+
// ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/index.js
|
|
15353
15359
|
var POOL_SIZE_MULTIPLIER = 128;
|
|
15354
15360
|
var pool;
|
|
15355
15361
|
var poolOffset;
|
|
@@ -15469,7 +15475,6 @@ var agent = sqliteTable("agent", {
|
|
|
15469
15475
|
tools: text("tools", { mode: "json" }),
|
|
15470
15476
|
triggers: text("triggers", { mode: "json" }),
|
|
15471
15477
|
emailHandle: text("email_handle").unique(),
|
|
15472
|
-
forwardToEmail: text("forward_to_email").default(""),
|
|
15473
15478
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),
|
|
15474
15479
|
updatedAt: text("updated_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
15475
15480
|
}, (t) => [primaryKey({ columns: [t.id, t.workspaceId] })]);
|
|
@@ -15555,6 +15560,9 @@ var emails = sqliteTable("emails", {
|
|
|
15555
15560
|
r2Key: text("r2_key").notNull(),
|
|
15556
15561
|
isWhitelisted: integer2("is_whitelisted", { mode: "boolean" }).notNull().default(false),
|
|
15557
15562
|
forwarded: integer2("forwarded", { mode: "boolean" }).notNull().default(false),
|
|
15563
|
+
messageId: text("message_id").notNull().default(""),
|
|
15564
|
+
inReplyTo: text("in_reply_to").notNull().default(""),
|
|
15565
|
+
references: text("references").notNull().default(""),
|
|
15558
15566
|
htmlBody: text("html_body").notNull().default(""),
|
|
15559
15567
|
attachments: text("attachments").notNull().default("[]"),
|
|
15560
15568
|
status: text("status").notNull().default("unread"),
|
|
@@ -15679,6 +15687,9 @@ function pidFilePath(profile) {
|
|
|
15679
15687
|
function daemonLogDir() {
|
|
15680
15688
|
return join2(configDir(), "daemon", "logs");
|
|
15681
15689
|
}
|
|
15690
|
+
function sessionRunnerLogDir() {
|
|
15691
|
+
return join2(configDir(), "daemon", "session-runners");
|
|
15692
|
+
}
|
|
15682
15693
|
function daemonLogFilePath(date5 = new Date) {
|
|
15683
15694
|
const y = date5.getFullYear();
|
|
15684
15695
|
const m = String(date5.getMonth() + 1).padStart(2, "0");
|
|
@@ -15782,7 +15793,8 @@ var RAW_DETECTION_METHODS = new Set([
|
|
|
15782
15793
|
"turn/completed",
|
|
15783
15794
|
"thread/started",
|
|
15784
15795
|
"item/started",
|
|
15785
|
-
"item/completed"
|
|
15796
|
+
"item/completed",
|
|
15797
|
+
"item/agentMessage/delta"
|
|
15786
15798
|
]);
|
|
15787
15799
|
|
|
15788
15800
|
// daemon/agent/index.ts
|
|
@@ -15807,7 +15819,7 @@ function fromApiTask(api2) {
|
|
|
15807
15819
|
status: api2.status,
|
|
15808
15820
|
priority: api2.priority,
|
|
15809
15821
|
type: api2.type,
|
|
15810
|
-
agent: api2.agent ? { name: api2.agent.name, instructions: api2.agent.instructions, emailHandle: api2.agent.email_handle ?? undefined, userEmail: api2.agent.user_email ?? undefined } : undefined,
|
|
15822
|
+
agent: api2.agent ? { name: api2.agent.name, instructions: api2.agent.instructions, emailHandle: api2.agent.email_handle ?? undefined, userEmail: api2.agent.user_email ?? undefined, runtimeConfig: api2.agent.runtime_config ?? undefined } : undefined,
|
|
15811
15823
|
repos: undefined,
|
|
15812
15824
|
createdAt: api2.created_at
|
|
15813
15825
|
};
|
|
@@ -15952,7 +15964,7 @@ function releaseDaemonPid(profile) {
|
|
|
15952
15964
|
}
|
|
15953
15965
|
|
|
15954
15966
|
// daemon/daemon.ts
|
|
15955
|
-
import { existsSync } from "fs";
|
|
15967
|
+
import { existsSync, mkdirSync as mkdirSync3, openSync, closeSync, renameSync, readdirSync, statSync, unlinkSync as unlinkSync2 } from "fs";
|
|
15956
15968
|
import { execSync as execSync3, spawn } from "child_process";
|
|
15957
15969
|
import { fileURLToPath } from "url";
|
|
15958
15970
|
import { dirname as dirname2, join as join3 } from "path";
|
|
@@ -15966,7 +15978,34 @@ function isCommandAvailable2(cmd) {
|
|
|
15966
15978
|
return false;
|
|
15967
15979
|
}
|
|
15968
15980
|
}
|
|
15981
|
+
var MAX_SESSION_RUNNER_LOGS = 50;
|
|
15982
|
+
function pruneSessionRunnerLogs() {
|
|
15983
|
+
const logDir = sessionRunnerLogDir();
|
|
15984
|
+
let entries;
|
|
15985
|
+
try {
|
|
15986
|
+
entries = readdirSync(logDir).filter((f) => f.endsWith(".log"));
|
|
15987
|
+
} catch {
|
|
15988
|
+
return;
|
|
15989
|
+
}
|
|
15990
|
+
if (entries.length <= MAX_SESSION_RUNNER_LOGS)
|
|
15991
|
+
return;
|
|
15992
|
+
const withMtime = entries.map((name) => {
|
|
15993
|
+
const full = join3(logDir, name);
|
|
15994
|
+
try {
|
|
15995
|
+
return { name, mtime: statSync(full).mtimeMs };
|
|
15996
|
+
} catch {
|
|
15997
|
+
return { name, mtime: 0 };
|
|
15998
|
+
}
|
|
15999
|
+
});
|
|
16000
|
+
withMtime.sort((a, b) => b.mtime - a.mtime);
|
|
16001
|
+
for (const entry of withMtime.slice(MAX_SESSION_RUNNER_LOGS)) {
|
|
16002
|
+
try {
|
|
16003
|
+
unlinkSync2(join3(logDir, entry.name));
|
|
16004
|
+
} catch {}
|
|
16005
|
+
}
|
|
16006
|
+
}
|
|
15969
16007
|
async function startDaemon(profile, serverUrl) {
|
|
16008
|
+
pruneSessionRunnerLogs();
|
|
15970
16009
|
if (!acquireDaemonPid(profile)) {
|
|
15971
16010
|
process.exit(1);
|
|
15972
16011
|
}
|
|
@@ -16131,11 +16170,20 @@ async function startDaemon(profile, serverUrl) {
|
|
|
16131
16170
|
}
|
|
16132
16171
|
function spawnSessionRunner(input) {
|
|
16133
16172
|
const encoded = Buffer.from(JSON.stringify(input)).toString("base64");
|
|
16173
|
+
const logDir = sessionRunnerLogDir();
|
|
16174
|
+
mkdirSync3(logDir, { recursive: true });
|
|
16175
|
+
const tmpLogPath = join3(logDir, `${input.task.id}.log`);
|
|
16176
|
+
const fd = openSync(tmpLogPath, "a");
|
|
16134
16177
|
const child = spawn(process.execPath, [sessionRunnerPath, encoded], {
|
|
16135
16178
|
detached: true,
|
|
16136
|
-
stdio: "ignore"
|
|
16179
|
+
stdio: ["ignore", fd, fd]
|
|
16137
16180
|
});
|
|
16138
16181
|
child.unref();
|
|
16182
|
+
closeSync(fd);
|
|
16183
|
+
if (child.pid) {
|
|
16184
|
+
const pidLogPath = join3(logDir, `${child.pid}.log`);
|
|
16185
|
+
renameSync(tmpLogPath, pidLogPath);
|
|
16186
|
+
}
|
|
16139
16187
|
return child;
|
|
16140
16188
|
}
|
|
16141
16189
|
async function handleTask(client, config2, runtimeIndex, task, token, activeTasks) {
|
|
@@ -16155,7 +16203,9 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
16155
16203
|
}
|
|
16156
16204
|
const provider = runtimeData.provider;
|
|
16157
16205
|
const cliPath = provider === "claude" ? config2.claudePath : provider === "codex" ? config2.codexPath : config2.opencodePath;
|
|
16158
|
-
const
|
|
16206
|
+
const configModel = provider === "claude" ? config2.claudeModel : provider === "codex" ? config2.codexModel : config2.opencodeModel;
|
|
16207
|
+
const agentModel = task.agent?.runtimeConfig?.model;
|
|
16208
|
+
const model = typeof agentModel === "string" && agentModel ? agentModel : configModel;
|
|
16159
16209
|
const input = {
|
|
16160
16210
|
task,
|
|
16161
16211
|
provider,
|
|
@@ -16206,14 +16256,14 @@ async function startInBackground(profile, serverUrl) {
|
|
|
16206
16256
|
return;
|
|
16207
16257
|
}
|
|
16208
16258
|
const logPath = daemonLogFilePath();
|
|
16209
|
-
|
|
16210
|
-
const logFd =
|
|
16259
|
+
mkdirSync4(dirname3(logPath), { recursive: true, mode: 448 });
|
|
16260
|
+
const logFd = openSync2(logPath, "a", 384);
|
|
16211
16261
|
const child = spawn2(process.execPath, buildChildArgs(profile, serverUrl), {
|
|
16212
16262
|
detached: true,
|
|
16213
16263
|
stdio: ["ignore", logFd, logFd]
|
|
16214
16264
|
});
|
|
16215
16265
|
child.unref();
|
|
16216
|
-
|
|
16266
|
+
closeSync2(logFd);
|
|
16217
16267
|
const pid = await waitForPidFile(profile);
|
|
16218
16268
|
if (pid != null) {
|
|
16219
16269
|
console.log(`Daemon started (pid=${pid})`);
|
|
@@ -16316,7 +16366,7 @@ function configCommand() {
|
|
|
16316
16366
|
|
|
16317
16367
|
// commands/email.ts
|
|
16318
16368
|
import { Command as Command5 } from "commander";
|
|
16319
|
-
import { writeFileSync as writeFileSync3, mkdirSync as
|
|
16369
|
+
import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync5, readFileSync as readFileSync3, statSync as statSync2 } from "fs";
|
|
16320
16370
|
import { basename, join as join4 } from "path";
|
|
16321
16371
|
import PostalMime from "postal-mime";
|
|
16322
16372
|
var VALID_STATUSES = ["unread", "read", "archived"];
|
|
@@ -16390,18 +16440,21 @@ function emailCommand() {
|
|
|
16390
16440
|
printJSON(emails2);
|
|
16391
16441
|
return;
|
|
16392
16442
|
}
|
|
16393
|
-
|
|
16443
|
+
mkdirSync5(EMAIL_DIR, { recursive: true });
|
|
16394
16444
|
const downloadedPaths = [];
|
|
16395
16445
|
for (const email3 of emails2) {
|
|
16396
16446
|
const emailDir = join4(EMAIL_DIR, email3.id);
|
|
16397
|
-
|
|
16447
|
+
mkdirSync5(emailDir, { recursive: true });
|
|
16398
16448
|
const metadata = {
|
|
16399
16449
|
id: email3.id,
|
|
16400
16450
|
from: email3.from_email,
|
|
16401
16451
|
to: email3.to_email,
|
|
16402
16452
|
subject: email3.subject,
|
|
16403
16453
|
date: email3.created_at,
|
|
16404
|
-
status: email3.status
|
|
16454
|
+
status: email3.status,
|
|
16455
|
+
message_id: email3.message_id || "",
|
|
16456
|
+
in_reply_to: email3.in_reply_to || "",
|
|
16457
|
+
references: email3.references || ""
|
|
16405
16458
|
};
|
|
16406
16459
|
const metadataPath = join4(emailDir, "metadata.json");
|
|
16407
16460
|
writeFileSync3(metadataPath, JSON.stringify(metadata, null, 2));
|
|
@@ -16430,7 +16483,7 @@ function emailCommand() {
|
|
|
16430
16483
|
}
|
|
16431
16484
|
if (parsed.attachments && parsed.attachments.length > 0) {
|
|
16432
16485
|
const attDir = join4(emailDir, "attachments");
|
|
16433
|
-
|
|
16486
|
+
mkdirSync5(attDir, { recursive: true });
|
|
16434
16487
|
const usedFilenames = new Set;
|
|
16435
16488
|
for (let i = 0;i < parsed.attachments.length; i++) {
|
|
16436
16489
|
const att = parsed.attachments[i];
|
|
@@ -16480,7 +16533,7 @@ function emailCommand() {
|
|
|
16480
16533
|
process.exit(1);
|
|
16481
16534
|
}
|
|
16482
16535
|
});
|
|
16483
|
-
cmd.command("send").description("Send an email from the agent").requiredOption("--agent_id <id>", "Agent ID").requiredOption("--to <addr>", "Recipient email address").requiredOption("--subject <s>", "Subject line").requiredOption("--body-file <path>", "Path to HTML body file").option("--attachment <path>", "Path to a file to attach (repeatable)", collectRepeated, []).option("--workspace <id>", "Workspace ID").action(async (opts, command) => {
|
|
16536
|
+
cmd.command("send").description("Send an email from the agent").requiredOption("--agent_id <id>", "Agent ID").requiredOption("--to <addr>", "Recipient email address").requiredOption("--subject <s>", "Subject line").requiredOption("--body-file <path>", "Path to HTML body file").option("--in-reply-to <emailId>", "Email ID to reply to (sets threading headers)").option("--attachment <path>", "Path to a file to attach (repeatable)", collectRepeated, []).option("--workspace <id>", "Workspace ID").action(async (opts, command) => {
|
|
16484
16537
|
const { serverUrl, token, workspaceId } = resolveClientOpts(command, {
|
|
16485
16538
|
workspace: opts.workspace,
|
|
16486
16539
|
agentId: opts.agent_id
|
|
@@ -16505,7 +16558,7 @@ function emailCommand() {
|
|
|
16505
16558
|
let size;
|
|
16506
16559
|
try {
|
|
16507
16560
|
bytes = readFileSync3(path);
|
|
16508
|
-
size =
|
|
16561
|
+
size = statSync2(path).size;
|
|
16509
16562
|
} catch (err) {
|
|
16510
16563
|
console.error(`Error: cannot read attachment "${path}": ${err instanceof Error ? err.message : err}`);
|
|
16511
16564
|
process.exit(1);
|
|
@@ -16522,12 +16575,26 @@ function emailCommand() {
|
|
|
16522
16575
|
contentType: uploaded.contentType ?? contentType
|
|
16523
16576
|
});
|
|
16524
16577
|
}
|
|
16578
|
+
let inReplyTo;
|
|
16579
|
+
let references;
|
|
16580
|
+
if (opts.inReplyTo) {
|
|
16581
|
+
try {
|
|
16582
|
+
const parentEmail = await client.getJSON(`/api/email/${opts.inReplyTo}`);
|
|
16583
|
+
if (parentEmail.message_id) {
|
|
16584
|
+
inReplyTo = parentEmail.message_id;
|
|
16585
|
+
references = [parentEmail.references, parentEmail.message_id].filter(Boolean).join(" ").trim() || undefined;
|
|
16586
|
+
}
|
|
16587
|
+
} catch {
|
|
16588
|
+
console.warn(`Warning: could not fetch parent email ${opts.inReplyTo}, sending without threading`);
|
|
16589
|
+
}
|
|
16590
|
+
}
|
|
16525
16591
|
const res = await client.postJSON("/api/email/send", {
|
|
16526
16592
|
agentId: opts.agent_id,
|
|
16527
16593
|
to: opts.to,
|
|
16528
16594
|
subject: opts.subject,
|
|
16529
16595
|
htmlBody,
|
|
16530
|
-
attachments
|
|
16596
|
+
attachments,
|
|
16597
|
+
...inReplyTo ? { inReplyTo, references } : {}
|
|
16531
16598
|
});
|
|
16532
16599
|
console.log(`Sent email to ${res.to_email} (id: ${res.id})`);
|
|
16533
16600
|
} catch (err) {
|
package/dist/session-runner.js
CHANGED
|
@@ -13703,6 +13703,12 @@ var UpdateCalendarEventRequestSchema = exports_external.object({
|
|
|
13703
13703
|
message: "occurrence_at must be a valid ISO datetime"
|
|
13704
13704
|
}).optional()
|
|
13705
13705
|
}).refine((v) => v.title !== undefined || v.description !== undefined || v.agent_id !== undefined || v.scheduled_at !== undefined || v.repeat_interval !== undefined || v.repeat_stop_date !== undefined, { message: "at least one field is required" });
|
|
13706
|
+
var DeleteCalendarEventRequestSchema = exports_external.object({
|
|
13707
|
+
scope: exports_external.enum(["this", "following"]).optional(),
|
|
13708
|
+
occurrence_at: exports_external.string().min(1).refine((s) => !Number.isNaN(Date.parse(s)), {
|
|
13709
|
+
message: "occurrence_at must be a valid ISO datetime"
|
|
13710
|
+
}).optional()
|
|
13711
|
+
});
|
|
13706
13712
|
var CalendarEventApiSchema = exports_external.object({
|
|
13707
13713
|
id: exports_external.string(),
|
|
13708
13714
|
agent_id: exports_external.string(),
|
|
@@ -13717,7 +13723,7 @@ var CalendarEventApiSchema = exports_external.object({
|
|
|
13717
13723
|
created_at: exports_external.string(),
|
|
13718
13724
|
updated_at: exports_external.string()
|
|
13719
13725
|
});
|
|
13720
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13726
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/entity.js
|
|
13721
13727
|
var entityKind = Symbol.for("drizzle:entityKind");
|
|
13722
13728
|
var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
|
|
13723
13729
|
function is(value, type) {
|
|
@@ -13742,10 +13748,10 @@ function is(value, type) {
|
|
|
13742
13748
|
return false;
|
|
13743
13749
|
}
|
|
13744
13750
|
|
|
13745
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13751
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/table.utils.js
|
|
13746
13752
|
var TableName = Symbol.for("drizzle:Name");
|
|
13747
13753
|
|
|
13748
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13754
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/table.js
|
|
13749
13755
|
var Schema = Symbol.for("drizzle:Schema");
|
|
13750
13756
|
var Columns = Symbol.for("drizzle:Columns");
|
|
13751
13757
|
var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
|
|
@@ -13783,7 +13789,7 @@ class Table {
|
|
|
13783
13789
|
}
|
|
13784
13790
|
}
|
|
13785
13791
|
|
|
13786
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13792
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/column.js
|
|
13787
13793
|
class Column {
|
|
13788
13794
|
constructor(table, config2) {
|
|
13789
13795
|
this.table = table;
|
|
@@ -13833,7 +13839,7 @@ class Column {
|
|
|
13833
13839
|
}
|
|
13834
13840
|
}
|
|
13835
13841
|
|
|
13836
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13842
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/column-builder.js
|
|
13837
13843
|
class ColumnBuilder {
|
|
13838
13844
|
static [entityKind] = "ColumnBuilder";
|
|
13839
13845
|
config;
|
|
@@ -13889,17 +13895,17 @@ class ColumnBuilder {
|
|
|
13889
13895
|
}
|
|
13890
13896
|
}
|
|
13891
13897
|
|
|
13892
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13898
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/tracing-utils.js
|
|
13893
13899
|
function iife(fn, ...args) {
|
|
13894
13900
|
return fn(...args);
|
|
13895
13901
|
}
|
|
13896
13902
|
|
|
13897
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13903
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/pg-core/unique-constraint.js
|
|
13898
13904
|
function uniqueKeyName(table, columns) {
|
|
13899
13905
|
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
13900
13906
|
}
|
|
13901
13907
|
|
|
13902
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13908
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/pg-core/columns/common.js
|
|
13903
13909
|
class PgColumn extends Column {
|
|
13904
13910
|
constructor(table, config2) {
|
|
13905
13911
|
if (!config2.uniqueName) {
|
|
@@ -13948,7 +13954,7 @@ class ExtraConfigColumn extends PgColumn {
|
|
|
13948
13954
|
}
|
|
13949
13955
|
}
|
|
13950
13956
|
|
|
13951
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13957
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/pg-core/columns/enum.js
|
|
13952
13958
|
class PgEnumObjectColumn extends PgColumn {
|
|
13953
13959
|
static [entityKind] = "PgEnumObjectColumn";
|
|
13954
13960
|
enum;
|
|
@@ -13978,7 +13984,7 @@ class PgEnumColumn extends PgColumn {
|
|
|
13978
13984
|
}
|
|
13979
13985
|
}
|
|
13980
13986
|
|
|
13981
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13987
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/subquery.js
|
|
13982
13988
|
class Subquery {
|
|
13983
13989
|
static [entityKind] = "Subquery";
|
|
13984
13990
|
constructor(sql, fields, alias, isWith = false, usedTables = []) {
|
|
@@ -13993,10 +13999,10 @@ class Subquery {
|
|
|
13993
13999
|
}
|
|
13994
14000
|
}
|
|
13995
14001
|
|
|
13996
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14002
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/version.js
|
|
13997
14003
|
var version2 = "0.45.2";
|
|
13998
14004
|
|
|
13999
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14005
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/tracing.js
|
|
14000
14006
|
var otel;
|
|
14001
14007
|
var rawTracer;
|
|
14002
14008
|
var tracer = {
|
|
@@ -14023,10 +14029,10 @@ var tracer = {
|
|
|
14023
14029
|
}
|
|
14024
14030
|
};
|
|
14025
14031
|
|
|
14026
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14032
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/view-common.js
|
|
14027
14033
|
var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
|
|
14028
14034
|
|
|
14029
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14035
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sql/sql.js
|
|
14030
14036
|
function isSQLWrapper(value) {
|
|
14031
14037
|
return value !== null && value !== undefined && typeof value.getSQL === "function";
|
|
14032
14038
|
}
|
|
@@ -14386,7 +14392,7 @@ Subquery.prototype.getSQL = function() {
|
|
|
14386
14392
|
return new SQL([this]);
|
|
14387
14393
|
};
|
|
14388
14394
|
|
|
14389
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14395
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/utils.js
|
|
14390
14396
|
function getColumnNameAndConfig(a, b) {
|
|
14391
14397
|
return {
|
|
14392
14398
|
name: typeof a === "string" && a.length > 0 ? a : "",
|
|
@@ -14395,7 +14401,7 @@ function getColumnNameAndConfig(a, b) {
|
|
|
14395
14401
|
}
|
|
14396
14402
|
var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder;
|
|
14397
14403
|
|
|
14398
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14404
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/foreign-keys.js
|
|
14399
14405
|
class ForeignKeyBuilder {
|
|
14400
14406
|
static [entityKind] = "SQLiteForeignKeyBuilder";
|
|
14401
14407
|
reference;
|
|
@@ -14463,7 +14469,7 @@ function foreignKey(config2) {
|
|
|
14463
14469
|
return new ForeignKeyBuilder(mappedConfig);
|
|
14464
14470
|
}
|
|
14465
14471
|
|
|
14466
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14472
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/unique-constraint.js
|
|
14467
14473
|
function uniqueKeyName2(table, columns) {
|
|
14468
14474
|
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
14469
14475
|
}
|
|
@@ -14508,7 +14514,7 @@ class UniqueConstraint {
|
|
|
14508
14514
|
}
|
|
14509
14515
|
}
|
|
14510
14516
|
|
|
14511
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14517
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/columns/common.js
|
|
14512
14518
|
class SQLiteColumnBuilder extends ColumnBuilder {
|
|
14513
14519
|
static [entityKind] = "SQLiteColumnBuilder";
|
|
14514
14520
|
foreignKeyConfigs = [];
|
|
@@ -14559,7 +14565,7 @@ class SQLiteColumn extends Column {
|
|
|
14559
14565
|
static [entityKind] = "SQLiteColumn";
|
|
14560
14566
|
}
|
|
14561
14567
|
|
|
14562
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14568
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/columns/blob.js
|
|
14563
14569
|
class SQLiteBigIntBuilder extends SQLiteColumnBuilder {
|
|
14564
14570
|
static [entityKind] = "SQLiteBigIntBuilder";
|
|
14565
14571
|
constructor(name) {
|
|
@@ -14647,7 +14653,7 @@ function blob(a, b) {
|
|
|
14647
14653
|
return new SQLiteBlobBufferBuilder(name);
|
|
14648
14654
|
}
|
|
14649
14655
|
|
|
14650
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14656
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/columns/custom.js
|
|
14651
14657
|
class SQLiteCustomColumnBuilder extends SQLiteColumnBuilder {
|
|
14652
14658
|
static [entityKind] = "SQLiteCustomColumnBuilder";
|
|
14653
14659
|
constructor(name, fieldConfig, customTypeParams) {
|
|
@@ -14688,7 +14694,7 @@ function customType(customTypeParams) {
|
|
|
14688
14694
|
};
|
|
14689
14695
|
}
|
|
14690
14696
|
|
|
14691
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14697
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/columns/integer.js
|
|
14692
14698
|
class SQLiteBaseIntegerBuilder extends SQLiteColumnBuilder {
|
|
14693
14699
|
static [entityKind] = "SQLiteBaseIntegerBuilder";
|
|
14694
14700
|
constructor(name, dataType, columnType) {
|
|
@@ -14790,7 +14796,7 @@ function integer2(a, b) {
|
|
|
14790
14796
|
return new SQLiteIntegerBuilder(name);
|
|
14791
14797
|
}
|
|
14792
14798
|
|
|
14793
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14799
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/columns/numeric.js
|
|
14794
14800
|
class SQLiteNumericBuilder extends SQLiteColumnBuilder {
|
|
14795
14801
|
static [entityKind] = "SQLiteNumericBuilder";
|
|
14796
14802
|
constructor(name) {
|
|
@@ -14860,7 +14866,7 @@ function numeric(a, b) {
|
|
|
14860
14866
|
return mode === "number" ? new SQLiteNumericNumberBuilder(name) : mode === "bigint" ? new SQLiteNumericBigIntBuilder(name) : new SQLiteNumericBuilder(name);
|
|
14861
14867
|
}
|
|
14862
14868
|
|
|
14863
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14869
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/columns/real.js
|
|
14864
14870
|
class SQLiteRealBuilder extends SQLiteColumnBuilder {
|
|
14865
14871
|
static [entityKind] = "SQLiteRealBuilder";
|
|
14866
14872
|
constructor(name) {
|
|
@@ -14881,7 +14887,7 @@ function real(name) {
|
|
|
14881
14887
|
return new SQLiteRealBuilder(name ?? "");
|
|
14882
14888
|
}
|
|
14883
14889
|
|
|
14884
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14890
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/columns/text.js
|
|
14885
14891
|
class SQLiteTextBuilder extends SQLiteColumnBuilder {
|
|
14886
14892
|
static [entityKind] = "SQLiteTextBuilder";
|
|
14887
14893
|
constructor(name, config2) {
|
|
@@ -14936,7 +14942,7 @@ function text(a, b = {}) {
|
|
|
14936
14942
|
return new SQLiteTextBuilder(name, config2);
|
|
14937
14943
|
}
|
|
14938
14944
|
|
|
14939
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14945
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/columns/all.js
|
|
14940
14946
|
function getSQLiteColumnBuilders() {
|
|
14941
14947
|
return {
|
|
14942
14948
|
blob,
|
|
@@ -14948,7 +14954,7 @@ function getSQLiteColumnBuilders() {
|
|
|
14948
14954
|
};
|
|
14949
14955
|
}
|
|
14950
14956
|
|
|
14951
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14957
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/table.js
|
|
14952
14958
|
var InlineForeignKeys = Symbol.for("drizzle:SQLiteInlineForeignKeys");
|
|
14953
14959
|
|
|
14954
14960
|
class SQLiteTable extends Table {
|
|
@@ -14982,7 +14988,7 @@ var sqliteTable = (name, columns, extraConfig) => {
|
|
|
14982
14988
|
return sqliteTableBase(name, columns, extraConfig);
|
|
14983
14989
|
};
|
|
14984
14990
|
|
|
14985
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14991
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/indexes.js
|
|
14986
14992
|
class IndexBuilderOn {
|
|
14987
14993
|
constructor(name, unique2) {
|
|
14988
14994
|
this.name = name;
|
|
@@ -15025,7 +15031,7 @@ function index(name) {
|
|
|
15025
15031
|
return new IndexBuilderOn(name, false);
|
|
15026
15032
|
}
|
|
15027
15033
|
|
|
15028
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
15034
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260418.1_@opentelemetry+api@1.9.1_bun-types@1.3.12_kysely@0.28.16/node_modules/drizzle-orm/sqlite-core/primary-keys.js
|
|
15029
15035
|
function primaryKey(...config2) {
|
|
15030
15036
|
if (config2[0].columns) {
|
|
15031
15037
|
return new PrimaryKeyBuilder(config2[0].columns, config2[0].name);
|
|
@@ -15060,13 +15066,13 @@ class PrimaryKey {
|
|
|
15060
15066
|
}
|
|
15061
15067
|
}
|
|
15062
15068
|
|
|
15063
|
-
// ../../node_modules/.pnpm/nanoid@5.1.
|
|
15069
|
+
// ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/index.js
|
|
15064
15070
|
import { webcrypto as crypto } from "node:crypto";
|
|
15065
15071
|
|
|
15066
|
-
// ../../node_modules/.pnpm/nanoid@5.1.
|
|
15072
|
+
// ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/url-alphabet/index.js
|
|
15067
15073
|
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
15068
15074
|
|
|
15069
|
-
// ../../node_modules/.pnpm/nanoid@5.1.
|
|
15075
|
+
// ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/index.js
|
|
15070
15076
|
var POOL_SIZE_MULTIPLIER = 128;
|
|
15071
15077
|
var pool;
|
|
15072
15078
|
var poolOffset;
|
|
@@ -15186,7 +15192,6 @@ var agent = sqliteTable("agent", {
|
|
|
15186
15192
|
tools: text("tools", { mode: "json" }),
|
|
15187
15193
|
triggers: text("triggers", { mode: "json" }),
|
|
15188
15194
|
emailHandle: text("email_handle").unique(),
|
|
15189
|
-
forwardToEmail: text("forward_to_email").default(""),
|
|
15190
15195
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),
|
|
15191
15196
|
updatedAt: text("updated_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
15192
15197
|
}, (t) => [primaryKey({ columns: [t.id, t.workspaceId] })]);
|
|
@@ -15272,6 +15277,9 @@ var emails = sqliteTable("emails", {
|
|
|
15272
15277
|
r2Key: text("r2_key").notNull(),
|
|
15273
15278
|
isWhitelisted: integer2("is_whitelisted", { mode: "boolean" }).notNull().default(false),
|
|
15274
15279
|
forwarded: integer2("forwarded", { mode: "boolean" }).notNull().default(false),
|
|
15280
|
+
messageId: text("message_id").notNull().default(""),
|
|
15281
|
+
inReplyTo: text("in_reply_to").notNull().default(""),
|
|
15282
|
+
references: text("references").notNull().default(""),
|
|
15275
15283
|
htmlBody: text("html_body").notNull().default(""),
|
|
15276
15284
|
attachments: text("attachments").notNull().default("[]"),
|
|
15277
15285
|
status: text("status").notNull().default("unread"),
|
|
@@ -15632,7 +15640,8 @@ var RAW_DETECTION_METHODS = new Set([
|
|
|
15632
15640
|
"turn/completed",
|
|
15633
15641
|
"thread/started",
|
|
15634
15642
|
"item/started",
|
|
15635
|
-
"item/completed"
|
|
15643
|
+
"item/completed",
|
|
15644
|
+
"item/agentMessage/delta"
|
|
15636
15645
|
]);
|
|
15637
15646
|
function extractThreadID(response) {
|
|
15638
15647
|
if (response && typeof response === "object") {
|
|
@@ -15680,7 +15689,10 @@ class CodexBackend {
|
|
|
15680
15689
|
resolveSessionId = resolve;
|
|
15681
15690
|
});
|
|
15682
15691
|
let notificationProtocol = "unknown";
|
|
15692
|
+
let turnStarted = false;
|
|
15693
|
+
let turnDoneTriggered = false;
|
|
15683
15694
|
let lastCompletedTurnId = "";
|
|
15695
|
+
let turnError = "";
|
|
15684
15696
|
const pendingRequests = new Map;
|
|
15685
15697
|
const messageQueue = [];
|
|
15686
15698
|
let messageResolve = null;
|
|
@@ -15721,12 +15733,21 @@ class CodexBackend {
|
|
|
15721
15733
|
}
|
|
15722
15734
|
pendingRequests.clear();
|
|
15723
15735
|
};
|
|
15736
|
+
const setTurnError = (msg) => {
|
|
15737
|
+
if (msg && !turnError)
|
|
15738
|
+
turnError = msg;
|
|
15739
|
+
};
|
|
15724
15740
|
const triggerTurnDone = (aborted2) => {
|
|
15725
|
-
if (
|
|
15726
|
-
|
|
15727
|
-
|
|
15728
|
-
|
|
15729
|
-
|
|
15741
|
+
if (turnDoneTriggered)
|
|
15742
|
+
return;
|
|
15743
|
+
turnDoneTriggered = true;
|
|
15744
|
+
resultStatus = aborted2 ? "aborted" : "completed";
|
|
15745
|
+
try {
|
|
15746
|
+
proc.stdin?.end();
|
|
15747
|
+
} catch {}
|
|
15748
|
+
try {
|
|
15749
|
+
proc.kill("SIGTERM");
|
|
15750
|
+
} catch {}
|
|
15730
15751
|
};
|
|
15731
15752
|
const handleServerRequest = (msg) => {
|
|
15732
15753
|
const method = msg.method;
|
|
@@ -15758,33 +15779,50 @@ class CodexBackend {
|
|
|
15758
15779
|
return;
|
|
15759
15780
|
notificationProtocol = "raw";
|
|
15760
15781
|
}
|
|
15761
|
-
if (method === "thread/status/changed" && notificationProtocol === "legacy") {
|
|
15782
|
+
if ((method === "thread/status/changed" || method === "error") && notificationProtocol === "legacy") {
|
|
15783
|
+
return;
|
|
15784
|
+
}
|
|
15785
|
+
const notifThreadId = params.threadId;
|
|
15786
|
+
if (sessionId && notifThreadId && notifThreadId !== sessionId) {
|
|
15762
15787
|
return;
|
|
15763
15788
|
}
|
|
15764
15789
|
switch (method) {
|
|
15765
15790
|
case "turn/started": {
|
|
15791
|
+
turnStarted = true;
|
|
15766
15792
|
break;
|
|
15767
15793
|
}
|
|
15768
15794
|
case "turn/completed": {
|
|
15769
|
-
const
|
|
15795
|
+
const turn = params.turn;
|
|
15796
|
+
const turnId = turn?.id || params.turnId || "";
|
|
15770
15797
|
if (turnId && turnId === lastCompletedTurnId)
|
|
15771
15798
|
return;
|
|
15772
15799
|
if (turnId)
|
|
15773
15800
|
lastCompletedTurnId = turnId;
|
|
15774
|
-
const status = params.status;
|
|
15801
|
+
const status = turn?.status || params.status || "";
|
|
15775
15802
|
if (status === "completed" || status === "finished") {
|
|
15776
15803
|
triggerTurnDone(false);
|
|
15777
|
-
} else if (status === "cancelled" || status === "aborted") {
|
|
15804
|
+
} else if (status === "cancelled" || status === "aborted" || status === "interrupted") {
|
|
15778
15805
|
triggerTurnDone(true);
|
|
15779
15806
|
} else if (status === "error" || status === "failed") {
|
|
15780
|
-
|
|
15781
|
-
|
|
15807
|
+
const turnErr = turn?.error;
|
|
15808
|
+
setTurnError(turnErr?.message || "codex turn failed");
|
|
15809
|
+
triggerTurnDone(false);
|
|
15810
|
+
}
|
|
15811
|
+
break;
|
|
15812
|
+
}
|
|
15813
|
+
case "error": {
|
|
15814
|
+
const errObj = params.error;
|
|
15815
|
+
const errMsg = errObj?.message || params.message || "";
|
|
15816
|
+
const willRetry = params.willRetry === true;
|
|
15817
|
+
if (errMsg && !willRetry) {
|
|
15818
|
+
setTurnError(errMsg);
|
|
15782
15819
|
}
|
|
15783
15820
|
break;
|
|
15784
15821
|
}
|
|
15785
15822
|
case "thread/status/changed": {
|
|
15786
|
-
const
|
|
15787
|
-
|
|
15823
|
+
const statusObj = params.status;
|
|
15824
|
+
const statusType = typeof statusObj === "object" && statusObj !== null ? statusObj.type || "" : statusObj || "";
|
|
15825
|
+
if (statusType === "idle" && turnStarted) {
|
|
15788
15826
|
triggerTurnDone(false);
|
|
15789
15827
|
}
|
|
15790
15828
|
break;
|
|
@@ -15830,13 +15868,19 @@ class CodexBackend {
|
|
|
15830
15868
|
output: ""
|
|
15831
15869
|
});
|
|
15832
15870
|
} else if (itemType === "agentMessage") {
|
|
15833
|
-
const
|
|
15834
|
-
if (
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
|
|
15838
|
-
|
|
15839
|
-
|
|
15871
|
+
const flatText = item.text;
|
|
15872
|
+
if (flatText) {
|
|
15873
|
+
pushMessage({ type: "text", content: flatText });
|
|
15874
|
+
lastOutput = flatText;
|
|
15875
|
+
} else {
|
|
15876
|
+
const content = item.content;
|
|
15877
|
+
if (Array.isArray(content)) {
|
|
15878
|
+
for (const block of content) {
|
|
15879
|
+
if (block.type === "output_text" || block.type === "text") {
|
|
15880
|
+
if (block.text) {
|
|
15881
|
+
pushMessage({ type: "text", content: block.text });
|
|
15882
|
+
lastOutput = block.text;
|
|
15883
|
+
}
|
|
15840
15884
|
}
|
|
15841
15885
|
}
|
|
15842
15886
|
}
|
|
@@ -16013,6 +16057,10 @@ class CodexBackend {
|
|
|
16013
16057
|
if (stderr && !lastError) {
|
|
16014
16058
|
lastError = stderr;
|
|
16015
16059
|
}
|
|
16060
|
+
if (turnError) {
|
|
16061
|
+
resultStatus = "failed";
|
|
16062
|
+
lastError = turnError;
|
|
16063
|
+
}
|
|
16016
16064
|
resolveSessionId(sessionId);
|
|
16017
16065
|
messageDone = true;
|
|
16018
16066
|
if (messageResolve) {
|
|
@@ -16091,6 +16139,18 @@ class OpenCodeBackend {
|
|
|
16091
16139
|
const sessionIdPromise = new Promise((resolve) => {
|
|
16092
16140
|
resolveSessionId = resolve;
|
|
16093
16141
|
});
|
|
16142
|
+
let turnDoneTriggered = false;
|
|
16143
|
+
const turnDone = () => {
|
|
16144
|
+
if (turnDoneTriggered)
|
|
16145
|
+
return;
|
|
16146
|
+
turnDoneTriggered = true;
|
|
16147
|
+
try {
|
|
16148
|
+
proc.stdin?.end();
|
|
16149
|
+
} catch {}
|
|
16150
|
+
try {
|
|
16151
|
+
proc.kill("SIGTERM");
|
|
16152
|
+
} catch {}
|
|
16153
|
+
};
|
|
16094
16154
|
const messageQueue = [];
|
|
16095
16155
|
let messageResolve = null;
|
|
16096
16156
|
let messageDone = false;
|
|
@@ -16163,6 +16223,7 @@ class OpenCodeBackend {
|
|
|
16163
16223
|
const content = event.message || event.content || "";
|
|
16164
16224
|
lastError = content;
|
|
16165
16225
|
pushMessage({ type: "error", content });
|
|
16226
|
+
turnDone();
|
|
16166
16227
|
break;
|
|
16167
16228
|
}
|
|
16168
16229
|
case "done":
|
|
@@ -16179,6 +16240,7 @@ class OpenCodeBackend {
|
|
|
16179
16240
|
if (!lastError)
|
|
16180
16241
|
lastError = output || "task failed";
|
|
16181
16242
|
}
|
|
16243
|
+
turnDone();
|
|
16182
16244
|
break;
|
|
16183
16245
|
}
|
|
16184
16246
|
default: {
|
|
@@ -16271,8 +16333,7 @@ import {
|
|
|
16271
16333
|
import { join } from "path";
|
|
16272
16334
|
var CANONICAL_FILE = "AGENTS.md";
|
|
16273
16335
|
var SYMLINK_ALIASES = ["CLAUDE.md"];
|
|
16274
|
-
var
|
|
16275
|
-
## Memory Management
|
|
16336
|
+
var SYSTEM_PROMPT_BODY = `## Memory Management
|
|
16276
16337
|
- Your memory directory is ./, don't write ANY EXTERNAL memory file.
|
|
16277
16338
|
- Write ESSENTIAL yet SHORT memory to ./memory.md
|
|
16278
16339
|
- For SPECIFIC yet LONG rules or pattern, write to experiences/[NAME].md, and add index to ./memory.md for later recall.
|
|
@@ -16318,7 +16379,9 @@ those json are sorted by datetime in asc order.
|
|
|
16318
16379
|
- When user ask you something you don't have in your current context, try to read the timeline jsonl files for answer (today or previous days).
|
|
16319
16380
|
`;
|
|
16320
16381
|
function buildInstructionContent(task) {
|
|
16321
|
-
|
|
16382
|
+
const displayName = task.agent?.name || "Alook Agent";
|
|
16383
|
+
let content = `You're ${displayName} in the Alook Platform.
|
|
16384
|
+
${SYSTEM_PROMPT_BODY}`;
|
|
16322
16385
|
if (task.agent?.instructions) {
|
|
16323
16386
|
content += `## BIG BOSS Instructions
|
|
16324
16387
|
The below instructions(if not empty) come from the big boss, follow them or you will be fired:
|
|
@@ -16339,7 +16402,7 @@ ${task.agent.userEmail ? `Your owner's email address is '${task.agent.userEmail}
|
|
|
16339
16402
|
---
|
|
16340
16403
|
Run 'npx @alook/cli pull --agent_id ${task.agentId} --status unread' to download unread emails to '/tmp/alook-emails/'.
|
|
16341
16404
|
Each email is saved to '/tmp/alook-emails/<emailId>/' with:
|
|
16342
|
-
- 'metadata.json' — sender, recipient, subject, date, status
|
|
16405
|
+
- 'metadata.json' — sender, recipient, subject, date, status, message_id, in_reply_to, references
|
|
16343
16406
|
- 'body.txt' — plain text body
|
|
16344
16407
|
- 'body.html' — HTML body (if available)
|
|
16345
16408
|
- 'attachments/' — extracted attachment files (if any)
|
|
@@ -16348,16 +16411,24 @@ Before starting to process an email, mark it as read:
|
|
|
16348
16411
|
- Run 'npx @alook/cli set --agent_id ${task.agentId} --email_id <EMAIL_ID> --status read'
|
|
16349
16412
|
---
|
|
16350
16413
|
|
|
16351
|
-
#### Sending email
|
|
16414
|
+
#### Sending a new email
|
|
16352
16415
|
Write the HTML body to a file first, then send it. The body is forwarded as-is (HTML).
|
|
16353
16416
|
- Run 'npx @alook/cli email send --agent_id ${task.agentId} --to <ADDRESS> --subject "<SUBJECT>" --body-file <PATH_TO_HTML>'
|
|
16354
16417
|
- Attach files with '--attachment <PATH>' — repeat the flag for multiple attachments. Each file is uploaded before sending.
|
|
16355
16418
|
- Example: 'npx @alook/cli email send --agent_id ${task.agentId} --to foo@bar.com --subject "Weekly report" --body-file /tmp/body.html --attachment /tmp/report.pdf --attachment /tmp/chart.png'
|
|
16419
|
+
|
|
16420
|
+
#### Replying to an email
|
|
16421
|
+
To reply to an email, add '--in-reply-to <EMAIL_ID>' to the send command. This sets the correct email threading headers so the recipient's email client groups the reply into the same conversation thread.
|
|
16422
|
+
- Use 'Re: <original subject>' as the subject.
|
|
16423
|
+
- Quote the original email body in your reply (wrap it in a blockquote).
|
|
16424
|
+
- The <EMAIL_ID> is the Alook email id from metadata.json (not the message_id header).
|
|
16425
|
+
- Example: 'npx @alook/cli email send --agent_id ${task.agentId} --to sender@example.com --subject "Re: Bug report" --body-file /tmp/reply.html --in-reply-to <EMAIL_ID>'
|
|
16356
16426
|
---
|
|
16357
16427
|
`;
|
|
16358
16428
|
}
|
|
16359
16429
|
content += `
|
|
16360
16430
|
### Calendar
|
|
16431
|
+
You have your own calendar to setup daily routines and reminders.
|
|
16361
16432
|
Schedule future tasks for yourself. At the scheduled time, a new task is dispatched to you with the event as the prompt (task type 'calendar_event').
|
|
16362
16433
|
---
|
|
16363
16434
|
Create a one-off event:
|
|
@@ -16703,7 +16774,7 @@ function updateEntry(timelineDir, taskId, updater) {
|
|
|
16703
16774
|
}
|
|
16704
16775
|
log.debug(`Timeline updateEntry: task_id ${taskId} not found in last 7 days`);
|
|
16705
16776
|
}
|
|
16706
|
-
function createTimelineEntry(taskId, prompt, type, sessionId, pid) {
|
|
16777
|
+
function createTimelineEntry(taskId, prompt, type, sessionId, pid, provider) {
|
|
16707
16778
|
return {
|
|
16708
16779
|
task_id: taskId,
|
|
16709
16780
|
session_id: sessionId || null,
|
|
@@ -16713,11 +16784,12 @@ function createTimelineEntry(taskId, prompt, type, sessionId, pid) {
|
|
|
16713
16784
|
type,
|
|
16714
16785
|
prompt,
|
|
16715
16786
|
agent_responses: [],
|
|
16716
|
-
errmsg: null
|
|
16787
|
+
errmsg: null,
|
|
16788
|
+
provider: provider ?? null
|
|
16717
16789
|
};
|
|
16718
16790
|
}
|
|
16719
16791
|
var DEFAULT_RESUME_MAX_AGE_MS = 3 * 60 * 60 * 1000;
|
|
16720
|
-
function findResumableSessionId(timelineDir, type, maxAgeMs = DEFAULT_RESUME_MAX_AGE_MS) {
|
|
16792
|
+
function findResumableSessionId(timelineDir, type, provider, maxAgeMs = DEFAULT_RESUME_MAX_AGE_MS) {
|
|
16721
16793
|
const now = new Date;
|
|
16722
16794
|
const cutoff = new Date(now.getTime() - maxAgeMs);
|
|
16723
16795
|
const daysToScan = Math.ceil(maxAgeMs / 86400000) + 1;
|
|
@@ -16727,7 +16799,7 @@ function findResumableSessionId(timelineDir, type, maxAgeMs = DEFAULT_RESUME_MAX
|
|
|
16727
16799
|
}
|
|
16728
16800
|
entries.sort((a, b) => new Date(b.datetime).getTime() - new Date(a.datetime).getTime());
|
|
16729
16801
|
for (const entry of entries) {
|
|
16730
|
-
if (entry.status === "completed" && entry.type === type && entry.session_id && new Date(entry.datetime) >= cutoff) {
|
|
16802
|
+
if (entry.status === "completed" && entry.type === type && entry.provider === provider && entry.session_id && new Date(entry.datetime) >= cutoff) {
|
|
16731
16803
|
return entry.session_id;
|
|
16732
16804
|
}
|
|
16733
16805
|
}
|
|
@@ -16765,7 +16837,7 @@ async function runSession(input) {
|
|
|
16765
16837
|
const backend = createBackend(provider, cliPath);
|
|
16766
16838
|
const prompt = buildPrompt(task);
|
|
16767
16839
|
const { workDir, logFile, timelineDir, env } = prepare({ workspacesRoot }, task);
|
|
16768
|
-
const resumeSessionId = task.type === TASK_TYPES.USER_DM_MESSAGE ? findResumableSessionId(timelineDir, task.type) ?? undefined : undefined;
|
|
16840
|
+
const resumeSessionId = task.type === TASK_TYPES.USER_DM_MESSAGE ? findResumableSessionId(timelineDir, task.type, provider) ?? undefined : undefined;
|
|
16769
16841
|
if (resumeSessionId) {
|
|
16770
16842
|
log.info(`Task ${task.id} resuming session ${resumeSessionId}`);
|
|
16771
16843
|
}
|
|
@@ -16778,7 +16850,7 @@ async function runSession(input) {
|
|
|
16778
16850
|
});
|
|
16779
16851
|
const agentPid = session2.pid;
|
|
16780
16852
|
const earlySessionId = await session2.sessionId;
|
|
16781
|
-
await initEntryAsync(timelineDir, createTimelineEntry(task.id, task.prompt, task.type, earlySessionId, process.pid));
|
|
16853
|
+
await initEntryAsync(timelineDir, createTimelineEntry(task.id, task.prompt, task.type, earlySessionId, process.pid, provider));
|
|
16782
16854
|
const pendingMessages = [];
|
|
16783
16855
|
let seq = 0;
|
|
16784
16856
|
const BATCH_SIZE = Number(process.env.ALOOK_MESSAGE_BATCH_SIZE) || 20;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alook/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Alook CLI — register and run always-on AI coding agents.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/alookai/alook#readme",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@alook/shared": "workspace:*",
|
|
53
53
|
"@types/bun": "^1.3.12",
|
|
54
|
-
"typescript": "^6.0.
|
|
54
|
+
"typescript": "^6.0.3",
|
|
55
55
|
"vitest": "^4.1.4"
|
|
56
56
|
}
|
|
57
57
|
}
|