@alook/cli 0.0.5 → 0.0.7
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 +150 -53
- package/dist/session-runner.js +139 -66
- 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
|
|
@@ -13903,7 +13903,8 @@ var PollRequestSchema = exports_external.object({
|
|
|
13903
13903
|
max_tasks: exports_external.number().int().min(1).default(1)
|
|
13904
13904
|
});
|
|
13905
13905
|
var PollResponseSchema = exports_external.object({
|
|
13906
|
-
tasks: exports_external.array(TaskApiSchema)
|
|
13906
|
+
tasks: exports_external.array(TaskApiSchema),
|
|
13907
|
+
evicted: exports_external.boolean().optional()
|
|
13907
13908
|
});
|
|
13908
13909
|
var RegisterResponseSchema = exports_external.object({
|
|
13909
13910
|
runtimes: exports_external.array(exports_external.object({ id: exports_external.string() }))
|
|
@@ -13986,6 +13987,12 @@ var UpdateCalendarEventRequestSchema = exports_external.object({
|
|
|
13986
13987
|
message: "occurrence_at must be a valid ISO datetime"
|
|
13987
13988
|
}).optional()
|
|
13988
13989
|
}).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" });
|
|
13990
|
+
var DeleteCalendarEventRequestSchema = exports_external.object({
|
|
13991
|
+
scope: exports_external.enum(["this", "following"]).optional(),
|
|
13992
|
+
occurrence_at: exports_external.string().min(1).refine((s) => !Number.isNaN(Date.parse(s)), {
|
|
13993
|
+
message: "occurrence_at must be a valid ISO datetime"
|
|
13994
|
+
}).optional()
|
|
13995
|
+
});
|
|
13989
13996
|
var CalendarEventApiSchema = exports_external.object({
|
|
13990
13997
|
id: exports_external.string(),
|
|
13991
13998
|
agent_id: exports_external.string(),
|
|
@@ -14000,7 +14007,7 @@ var CalendarEventApiSchema = exports_external.object({
|
|
|
14000
14007
|
created_at: exports_external.string(),
|
|
14001
14008
|
updated_at: exports_external.string()
|
|
14002
14009
|
});
|
|
14003
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14010
|
+
// ../../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
14011
|
var entityKind = Symbol.for("drizzle:entityKind");
|
|
14005
14012
|
var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
|
|
14006
14013
|
function is(value, type) {
|
|
@@ -14025,10 +14032,10 @@ function is(value, type) {
|
|
|
14025
14032
|
return false;
|
|
14026
14033
|
}
|
|
14027
14034
|
|
|
14028
|
-
// ../../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/table.utils.js
|
|
14029
14036
|
var TableName = Symbol.for("drizzle:Name");
|
|
14030
14037
|
|
|
14031
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14038
|
+
// ../../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
14039
|
var Schema = Symbol.for("drizzle:Schema");
|
|
14033
14040
|
var Columns = Symbol.for("drizzle:Columns");
|
|
14034
14041
|
var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
|
|
@@ -14066,7 +14073,7 @@ class Table {
|
|
|
14066
14073
|
}
|
|
14067
14074
|
}
|
|
14068
14075
|
|
|
14069
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14076
|
+
// ../../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
14077
|
class Column {
|
|
14071
14078
|
constructor(table, config2) {
|
|
14072
14079
|
this.table = table;
|
|
@@ -14116,7 +14123,7 @@ class Column {
|
|
|
14116
14123
|
}
|
|
14117
14124
|
}
|
|
14118
14125
|
|
|
14119
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14126
|
+
// ../../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
14127
|
class ColumnBuilder {
|
|
14121
14128
|
static [entityKind] = "ColumnBuilder";
|
|
14122
14129
|
config;
|
|
@@ -14172,17 +14179,17 @@ class ColumnBuilder {
|
|
|
14172
14179
|
}
|
|
14173
14180
|
}
|
|
14174
14181
|
|
|
14175
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14182
|
+
// ../../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
14183
|
function iife(fn, ...args) {
|
|
14177
14184
|
return fn(...args);
|
|
14178
14185
|
}
|
|
14179
14186
|
|
|
14180
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14187
|
+
// ../../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
14188
|
function uniqueKeyName(table, columns) {
|
|
14182
14189
|
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
14183
14190
|
}
|
|
14184
14191
|
|
|
14185
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14192
|
+
// ../../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
14193
|
class PgColumn extends Column {
|
|
14187
14194
|
constructor(table, config2) {
|
|
14188
14195
|
if (!config2.uniqueName) {
|
|
@@ -14231,7 +14238,7 @@ class ExtraConfigColumn extends PgColumn {
|
|
|
14231
14238
|
}
|
|
14232
14239
|
}
|
|
14233
14240
|
|
|
14234
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14241
|
+
// ../../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
14242
|
class PgEnumObjectColumn extends PgColumn {
|
|
14236
14243
|
static [entityKind] = "PgEnumObjectColumn";
|
|
14237
14244
|
enum;
|
|
@@ -14261,7 +14268,7 @@ class PgEnumColumn extends PgColumn {
|
|
|
14261
14268
|
}
|
|
14262
14269
|
}
|
|
14263
14270
|
|
|
14264
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14271
|
+
// ../../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
14272
|
class Subquery {
|
|
14266
14273
|
static [entityKind] = "Subquery";
|
|
14267
14274
|
constructor(sql, fields, alias, isWith = false, usedTables = []) {
|
|
@@ -14276,10 +14283,10 @@ class Subquery {
|
|
|
14276
14283
|
}
|
|
14277
14284
|
}
|
|
14278
14285
|
|
|
14279
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14286
|
+
// ../../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
14287
|
var version2 = "0.45.2";
|
|
14281
14288
|
|
|
14282
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14289
|
+
// ../../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
14290
|
var otel;
|
|
14284
14291
|
var rawTracer;
|
|
14285
14292
|
var tracer = {
|
|
@@ -14306,10 +14313,10 @@ var tracer = {
|
|
|
14306
14313
|
}
|
|
14307
14314
|
};
|
|
14308
14315
|
|
|
14309
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14316
|
+
// ../../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
14317
|
var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
|
|
14311
14318
|
|
|
14312
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14319
|
+
// ../../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
14320
|
function isSQLWrapper(value) {
|
|
14314
14321
|
return value !== null && value !== undefined && typeof value.getSQL === "function";
|
|
14315
14322
|
}
|
|
@@ -14669,7 +14676,7 @@ Subquery.prototype.getSQL = function() {
|
|
|
14669
14676
|
return new SQL([this]);
|
|
14670
14677
|
};
|
|
14671
14678
|
|
|
14672
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14679
|
+
// ../../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
14680
|
function getColumnNameAndConfig(a, b) {
|
|
14674
14681
|
return {
|
|
14675
14682
|
name: typeof a === "string" && a.length > 0 ? a : "",
|
|
@@ -14678,7 +14685,7 @@ function getColumnNameAndConfig(a, b) {
|
|
|
14678
14685
|
}
|
|
14679
14686
|
var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder;
|
|
14680
14687
|
|
|
14681
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14688
|
+
// ../../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
14689
|
class ForeignKeyBuilder {
|
|
14683
14690
|
static [entityKind] = "SQLiteForeignKeyBuilder";
|
|
14684
14691
|
reference;
|
|
@@ -14746,7 +14753,7 @@ function foreignKey(config2) {
|
|
|
14746
14753
|
return new ForeignKeyBuilder(mappedConfig);
|
|
14747
14754
|
}
|
|
14748
14755
|
|
|
14749
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14756
|
+
// ../../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
14757
|
function uniqueKeyName2(table, columns) {
|
|
14751
14758
|
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
14752
14759
|
}
|
|
@@ -14791,7 +14798,7 @@ class UniqueConstraint {
|
|
|
14791
14798
|
}
|
|
14792
14799
|
}
|
|
14793
14800
|
|
|
14794
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14801
|
+
// ../../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
14802
|
class SQLiteColumnBuilder extends ColumnBuilder {
|
|
14796
14803
|
static [entityKind] = "SQLiteColumnBuilder";
|
|
14797
14804
|
foreignKeyConfigs = [];
|
|
@@ -14842,7 +14849,7 @@ class SQLiteColumn extends Column {
|
|
|
14842
14849
|
static [entityKind] = "SQLiteColumn";
|
|
14843
14850
|
}
|
|
14844
14851
|
|
|
14845
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14852
|
+
// ../../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
14853
|
class SQLiteBigIntBuilder extends SQLiteColumnBuilder {
|
|
14847
14854
|
static [entityKind] = "SQLiteBigIntBuilder";
|
|
14848
14855
|
constructor(name) {
|
|
@@ -14930,7 +14937,7 @@ function blob(a, b) {
|
|
|
14930
14937
|
return new SQLiteBlobBufferBuilder(name);
|
|
14931
14938
|
}
|
|
14932
14939
|
|
|
14933
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14940
|
+
// ../../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
14941
|
class SQLiteCustomColumnBuilder extends SQLiteColumnBuilder {
|
|
14935
14942
|
static [entityKind] = "SQLiteCustomColumnBuilder";
|
|
14936
14943
|
constructor(name, fieldConfig, customTypeParams) {
|
|
@@ -14971,7 +14978,7 @@ function customType(customTypeParams) {
|
|
|
14971
14978
|
};
|
|
14972
14979
|
}
|
|
14973
14980
|
|
|
14974
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14981
|
+
// ../../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
14982
|
class SQLiteBaseIntegerBuilder extends SQLiteColumnBuilder {
|
|
14976
14983
|
static [entityKind] = "SQLiteBaseIntegerBuilder";
|
|
14977
14984
|
constructor(name, dataType, columnType) {
|
|
@@ -15073,7 +15080,7 @@ function integer2(a, b) {
|
|
|
15073
15080
|
return new SQLiteIntegerBuilder(name);
|
|
15074
15081
|
}
|
|
15075
15082
|
|
|
15076
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
15083
|
+
// ../../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
15084
|
class SQLiteNumericBuilder extends SQLiteColumnBuilder {
|
|
15078
15085
|
static [entityKind] = "SQLiteNumericBuilder";
|
|
15079
15086
|
constructor(name) {
|
|
@@ -15143,7 +15150,7 @@ function numeric(a, b) {
|
|
|
15143
15150
|
return mode === "number" ? new SQLiteNumericNumberBuilder(name) : mode === "bigint" ? new SQLiteNumericBigIntBuilder(name) : new SQLiteNumericBuilder(name);
|
|
15144
15151
|
}
|
|
15145
15152
|
|
|
15146
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
15153
|
+
// ../../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
15154
|
class SQLiteRealBuilder extends SQLiteColumnBuilder {
|
|
15148
15155
|
static [entityKind] = "SQLiteRealBuilder";
|
|
15149
15156
|
constructor(name) {
|
|
@@ -15164,7 +15171,7 @@ function real(name) {
|
|
|
15164
15171
|
return new SQLiteRealBuilder(name ?? "");
|
|
15165
15172
|
}
|
|
15166
15173
|
|
|
15167
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
15174
|
+
// ../../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
15175
|
class SQLiteTextBuilder extends SQLiteColumnBuilder {
|
|
15169
15176
|
static [entityKind] = "SQLiteTextBuilder";
|
|
15170
15177
|
constructor(name, config2) {
|
|
@@ -15219,7 +15226,7 @@ function text(a, b = {}) {
|
|
|
15219
15226
|
return new SQLiteTextBuilder(name, config2);
|
|
15220
15227
|
}
|
|
15221
15228
|
|
|
15222
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
15229
|
+
// ../../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
15230
|
function getSQLiteColumnBuilders() {
|
|
15224
15231
|
return {
|
|
15225
15232
|
blob,
|
|
@@ -15231,7 +15238,7 @@ function getSQLiteColumnBuilders() {
|
|
|
15231
15238
|
};
|
|
15232
15239
|
}
|
|
15233
15240
|
|
|
15234
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
15241
|
+
// ../../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
15242
|
var InlineForeignKeys = Symbol.for("drizzle:SQLiteInlineForeignKeys");
|
|
15236
15243
|
|
|
15237
15244
|
class SQLiteTable extends Table {
|
|
@@ -15265,7 +15272,7 @@ var sqliteTable = (name, columns, extraConfig) => {
|
|
|
15265
15272
|
return sqliteTableBase(name, columns, extraConfig);
|
|
15266
15273
|
};
|
|
15267
15274
|
|
|
15268
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
15275
|
+
// ../../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
15276
|
class IndexBuilderOn {
|
|
15270
15277
|
constructor(name, unique2) {
|
|
15271
15278
|
this.name = name;
|
|
@@ -15308,7 +15315,7 @@ function index(name) {
|
|
|
15308
15315
|
return new IndexBuilderOn(name, false);
|
|
15309
15316
|
}
|
|
15310
15317
|
|
|
15311
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
15318
|
+
// ../../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
15319
|
function primaryKey(...config2) {
|
|
15313
15320
|
if (config2[0].columns) {
|
|
15314
15321
|
return new PrimaryKeyBuilder(config2[0].columns, config2[0].name);
|
|
@@ -15343,13 +15350,13 @@ class PrimaryKey {
|
|
|
15343
15350
|
}
|
|
15344
15351
|
}
|
|
15345
15352
|
|
|
15346
|
-
// ../../node_modules/.pnpm/nanoid@5.1.
|
|
15353
|
+
// ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/index.js
|
|
15347
15354
|
import { webcrypto as crypto } from "node:crypto";
|
|
15348
15355
|
|
|
15349
|
-
// ../../node_modules/.pnpm/nanoid@5.1.
|
|
15356
|
+
// ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/url-alphabet/index.js
|
|
15350
15357
|
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
15351
15358
|
|
|
15352
|
-
// ../../node_modules/.pnpm/nanoid@5.1.
|
|
15359
|
+
// ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/index.js
|
|
15353
15360
|
var POOL_SIZE_MULTIPLIER = 128;
|
|
15354
15361
|
var pool;
|
|
15355
15362
|
var poolOffset;
|
|
@@ -15469,7 +15476,6 @@ var agent = sqliteTable("agent", {
|
|
|
15469
15476
|
tools: text("tools", { mode: "json" }),
|
|
15470
15477
|
triggers: text("triggers", { mode: "json" }),
|
|
15471
15478
|
emailHandle: text("email_handle").unique(),
|
|
15472
|
-
forwardToEmail: text("forward_to_email").default(""),
|
|
15473
15479
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),
|
|
15474
15480
|
updatedAt: text("updated_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
15475
15481
|
}, (t) => [primaryKey({ columns: [t.id, t.workspaceId] })]);
|
|
@@ -15555,6 +15561,9 @@ var emails = sqliteTable("emails", {
|
|
|
15555
15561
|
r2Key: text("r2_key").notNull(),
|
|
15556
15562
|
isWhitelisted: integer2("is_whitelisted", { mode: "boolean" }).notNull().default(false),
|
|
15557
15563
|
forwarded: integer2("forwarded", { mode: "boolean" }).notNull().default(false),
|
|
15564
|
+
messageId: text("message_id").notNull().default(""),
|
|
15565
|
+
inReplyTo: text("in_reply_to").notNull().default(""),
|
|
15566
|
+
references: text("references").notNull().default(""),
|
|
15558
15567
|
htmlBody: text("html_body").notNull().default(""),
|
|
15559
15568
|
attachments: text("attachments").notNull().default("[]"),
|
|
15560
15569
|
status: text("status").notNull().default("unread"),
|
|
@@ -15651,7 +15660,7 @@ class DaemonClient {
|
|
|
15651
15660
|
async poll(token, daemonId, maxTasks) {
|
|
15652
15661
|
const raw = await this.request("POST", "/api/daemon/tasks/poll", token, { daemon_id: daemonId, max_tasks: maxTasks });
|
|
15653
15662
|
const resp = PollResponseSchema.parse(raw);
|
|
15654
|
-
return resp.tasks;
|
|
15663
|
+
return { tasks: resp.tasks, evicted: resp.evicted ?? false };
|
|
15655
15664
|
}
|
|
15656
15665
|
startTask(token, taskId) {
|
|
15657
15666
|
return this.request("POST", `/api/daemon/tasks/${taskId}/start`, token);
|
|
@@ -15679,6 +15688,9 @@ function pidFilePath(profile) {
|
|
|
15679
15688
|
function daemonLogDir() {
|
|
15680
15689
|
return join2(configDir(), "daemon", "logs");
|
|
15681
15690
|
}
|
|
15691
|
+
function sessionRunnerLogDir() {
|
|
15692
|
+
return join2(configDir(), "daemon", "session-runners");
|
|
15693
|
+
}
|
|
15682
15694
|
function daemonLogFilePath(date5 = new Date) {
|
|
15683
15695
|
const y = date5.getFullYear();
|
|
15684
15696
|
const m = String(date5.getMonth() + 1).padStart(2, "0");
|
|
@@ -15782,7 +15794,8 @@ var RAW_DETECTION_METHODS = new Set([
|
|
|
15782
15794
|
"turn/completed",
|
|
15783
15795
|
"thread/started",
|
|
15784
15796
|
"item/started",
|
|
15785
|
-
"item/completed"
|
|
15797
|
+
"item/completed",
|
|
15798
|
+
"item/agentMessage/delta"
|
|
15786
15799
|
]);
|
|
15787
15800
|
|
|
15788
15801
|
// daemon/agent/index.ts
|
|
@@ -15807,7 +15820,7 @@ function fromApiTask(api2) {
|
|
|
15807
15820
|
status: api2.status,
|
|
15808
15821
|
priority: api2.priority,
|
|
15809
15822
|
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,
|
|
15823
|
+
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
15824
|
repos: undefined,
|
|
15812
15825
|
createdAt: api2.created_at
|
|
15813
15826
|
};
|
|
@@ -15952,7 +15965,7 @@ function releaseDaemonPid(profile) {
|
|
|
15952
15965
|
}
|
|
15953
15966
|
|
|
15954
15967
|
// daemon/daemon.ts
|
|
15955
|
-
import { existsSync } from "fs";
|
|
15968
|
+
import { existsSync, mkdirSync as mkdirSync3, openSync, closeSync, renameSync, readdirSync, statSync, unlinkSync as unlinkSync2 } from "fs";
|
|
15956
15969
|
import { execSync as execSync3, spawn } from "child_process";
|
|
15957
15970
|
import { fileURLToPath } from "url";
|
|
15958
15971
|
import { dirname as dirname2, join as join3 } from "path";
|
|
@@ -15966,7 +15979,34 @@ function isCommandAvailable2(cmd) {
|
|
|
15966
15979
|
return false;
|
|
15967
15980
|
}
|
|
15968
15981
|
}
|
|
15982
|
+
var MAX_SESSION_RUNNER_LOGS = 50;
|
|
15983
|
+
function pruneSessionRunnerLogs() {
|
|
15984
|
+
const logDir = sessionRunnerLogDir();
|
|
15985
|
+
let entries;
|
|
15986
|
+
try {
|
|
15987
|
+
entries = readdirSync(logDir).filter((f) => f.endsWith(".log"));
|
|
15988
|
+
} catch {
|
|
15989
|
+
return;
|
|
15990
|
+
}
|
|
15991
|
+
if (entries.length <= MAX_SESSION_RUNNER_LOGS)
|
|
15992
|
+
return;
|
|
15993
|
+
const withMtime = entries.map((name) => {
|
|
15994
|
+
const full = join3(logDir, name);
|
|
15995
|
+
try {
|
|
15996
|
+
return { name, mtime: statSync(full).mtimeMs };
|
|
15997
|
+
} catch {
|
|
15998
|
+
return { name, mtime: 0 };
|
|
15999
|
+
}
|
|
16000
|
+
});
|
|
16001
|
+
withMtime.sort((a, b) => b.mtime - a.mtime);
|
|
16002
|
+
for (const entry of withMtime.slice(MAX_SESSION_RUNNER_LOGS)) {
|
|
16003
|
+
try {
|
|
16004
|
+
unlinkSync2(join3(logDir, entry.name));
|
|
16005
|
+
} catch {}
|
|
16006
|
+
}
|
|
16007
|
+
}
|
|
15969
16008
|
async function startDaemon(profile, serverUrl) {
|
|
16009
|
+
pruneSessionRunnerLogs();
|
|
15970
16010
|
if (!acquireDaemonPid(profile)) {
|
|
15971
16011
|
process.exit(1);
|
|
15972
16012
|
}
|
|
@@ -16075,12 +16115,30 @@ async function startDaemon(profile, serverUrl) {
|
|
|
16075
16115
|
}
|
|
16076
16116
|
} catch {}
|
|
16077
16117
|
}
|
|
16118
|
+
function evictWorkspace(workspaceId) {
|
|
16119
|
+
const idx = workspaceStates.findIndex((ws2) => ws2.workspaceId === workspaceId);
|
|
16120
|
+
if (idx === -1)
|
|
16121
|
+
return;
|
|
16122
|
+
const ws = workspaceStates[idx];
|
|
16123
|
+
for (const rid of ws.runtimeIds) {
|
|
16124
|
+
runtimeIndex.delete(rid);
|
|
16125
|
+
}
|
|
16126
|
+
workspaceStates.splice(idx, 1);
|
|
16127
|
+
health.setRuntimeCount(workspaceStates.reduce((sum, w) => sum + w.runtimeIds.length, 0));
|
|
16128
|
+
try {
|
|
16129
|
+
const cfg = loadCLIConfigForProfile(profile);
|
|
16130
|
+
cfg.watched_workspaces = (cfg.watched_workspaces || []).filter((w) => w.id !== workspaceId);
|
|
16131
|
+
saveCLIConfigForProfile(profile, cfg);
|
|
16132
|
+
} catch {}
|
|
16133
|
+
log.info(`Workspace ${workspaceId} evicted — runtimes removed server-side`);
|
|
16134
|
+
}
|
|
16078
16135
|
const pollCycle = async () => {
|
|
16079
16136
|
let remaining = config2.maxConcurrentTasks - activeTasks.size;
|
|
16080
16137
|
if (remaining <= 0)
|
|
16081
16138
|
return;
|
|
16082
16139
|
const N = workspaceStates.length;
|
|
16083
16140
|
const staggerMs = N > 1 ? Math.floor(config2.pollInterval / N) : 0;
|
|
16141
|
+
const evictedIds = [];
|
|
16084
16142
|
for (let i = 0;i < N; i++) {
|
|
16085
16143
|
if (remaining <= 0)
|
|
16086
16144
|
break;
|
|
@@ -16089,8 +16147,12 @@ async function startDaemon(profile, serverUrl) {
|
|
|
16089
16147
|
await new Promise((r) => setTimeout(r, staggerMs));
|
|
16090
16148
|
}
|
|
16091
16149
|
try {
|
|
16092
|
-
const tasks = await client.poll(ws.token, config2.daemonId, remaining);
|
|
16093
|
-
|
|
16150
|
+
const { tasks: apiTasks, evicted } = await client.poll(ws.token, config2.daemonId, remaining);
|
|
16151
|
+
if (evicted) {
|
|
16152
|
+
evictedIds.push(ws.workspaceId);
|
|
16153
|
+
continue;
|
|
16154
|
+
}
|
|
16155
|
+
for (const apiTask of apiTasks) {
|
|
16094
16156
|
const task = fromApiTask(apiTask);
|
|
16095
16157
|
syncAgentId(task.agentId, ws.workspaceId);
|
|
16096
16158
|
activeTasks.add(task.id);
|
|
@@ -16104,6 +16166,13 @@ async function startDaemon(profile, serverUrl) {
|
|
|
16104
16166
|
log.debug("Poll error", e);
|
|
16105
16167
|
}
|
|
16106
16168
|
}
|
|
16169
|
+
for (const id of evictedIds) {
|
|
16170
|
+
evictWorkspace(id);
|
|
16171
|
+
}
|
|
16172
|
+
if (workspaceStates.length === 0) {
|
|
16173
|
+
log.info("All workspaces evicted — shutting down");
|
|
16174
|
+
shutdown();
|
|
16175
|
+
}
|
|
16107
16176
|
};
|
|
16108
16177
|
const pollTimer = setInterval(pollCycle, config2.pollInterval);
|
|
16109
16178
|
let shuttingDown = false;
|
|
@@ -16131,11 +16200,20 @@ async function startDaemon(profile, serverUrl) {
|
|
|
16131
16200
|
}
|
|
16132
16201
|
function spawnSessionRunner(input) {
|
|
16133
16202
|
const encoded = Buffer.from(JSON.stringify(input)).toString("base64");
|
|
16203
|
+
const logDir = sessionRunnerLogDir();
|
|
16204
|
+
mkdirSync3(logDir, { recursive: true });
|
|
16205
|
+
const tmpLogPath = join3(logDir, `${input.task.id}.log`);
|
|
16206
|
+
const fd = openSync(tmpLogPath, "a");
|
|
16134
16207
|
const child = spawn(process.execPath, [sessionRunnerPath, encoded], {
|
|
16135
16208
|
detached: true,
|
|
16136
|
-
stdio: "ignore"
|
|
16209
|
+
stdio: ["ignore", fd, fd]
|
|
16137
16210
|
});
|
|
16138
16211
|
child.unref();
|
|
16212
|
+
closeSync(fd);
|
|
16213
|
+
if (child.pid) {
|
|
16214
|
+
const pidLogPath = join3(logDir, `${child.pid}.log`);
|
|
16215
|
+
renameSync(tmpLogPath, pidLogPath);
|
|
16216
|
+
}
|
|
16139
16217
|
return child;
|
|
16140
16218
|
}
|
|
16141
16219
|
async function handleTask(client, config2, runtimeIndex, task, token, activeTasks) {
|
|
@@ -16155,7 +16233,9 @@ async function handleTask(client, config2, runtimeIndex, task, token, activeTask
|
|
|
16155
16233
|
}
|
|
16156
16234
|
const provider = runtimeData.provider;
|
|
16157
16235
|
const cliPath = provider === "claude" ? config2.claudePath : provider === "codex" ? config2.codexPath : config2.opencodePath;
|
|
16158
|
-
const
|
|
16236
|
+
const configModel = provider === "claude" ? config2.claudeModel : provider === "codex" ? config2.codexModel : config2.opencodeModel;
|
|
16237
|
+
const agentModel = task.agent?.runtimeConfig?.model;
|
|
16238
|
+
const model = typeof agentModel === "string" && agentModel ? agentModel : configModel;
|
|
16159
16239
|
const input = {
|
|
16160
16240
|
task,
|
|
16161
16241
|
provider,
|
|
@@ -16206,14 +16286,14 @@ async function startInBackground(profile, serverUrl) {
|
|
|
16206
16286
|
return;
|
|
16207
16287
|
}
|
|
16208
16288
|
const logPath = daemonLogFilePath();
|
|
16209
|
-
|
|
16210
|
-
const logFd =
|
|
16289
|
+
mkdirSync4(dirname3(logPath), { recursive: true, mode: 448 });
|
|
16290
|
+
const logFd = openSync2(logPath, "a", 384);
|
|
16211
16291
|
const child = spawn2(process.execPath, buildChildArgs(profile, serverUrl), {
|
|
16212
16292
|
detached: true,
|
|
16213
16293
|
stdio: ["ignore", logFd, logFd]
|
|
16214
16294
|
});
|
|
16215
16295
|
child.unref();
|
|
16216
|
-
|
|
16296
|
+
closeSync2(logFd);
|
|
16217
16297
|
const pid = await waitForPidFile(profile);
|
|
16218
16298
|
if (pid != null) {
|
|
16219
16299
|
console.log(`Daemon started (pid=${pid})`);
|
|
@@ -16316,7 +16396,7 @@ function configCommand() {
|
|
|
16316
16396
|
|
|
16317
16397
|
// commands/email.ts
|
|
16318
16398
|
import { Command as Command5 } from "commander";
|
|
16319
|
-
import { writeFileSync as writeFileSync3, mkdirSync as
|
|
16399
|
+
import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync5, readFileSync as readFileSync3, statSync as statSync2 } from "fs";
|
|
16320
16400
|
import { basename, join as join4 } from "path";
|
|
16321
16401
|
import PostalMime from "postal-mime";
|
|
16322
16402
|
var VALID_STATUSES = ["unread", "read", "archived"];
|
|
@@ -16390,18 +16470,21 @@ function emailCommand() {
|
|
|
16390
16470
|
printJSON(emails2);
|
|
16391
16471
|
return;
|
|
16392
16472
|
}
|
|
16393
|
-
|
|
16473
|
+
mkdirSync5(EMAIL_DIR, { recursive: true });
|
|
16394
16474
|
const downloadedPaths = [];
|
|
16395
16475
|
for (const email3 of emails2) {
|
|
16396
16476
|
const emailDir = join4(EMAIL_DIR, email3.id);
|
|
16397
|
-
|
|
16477
|
+
mkdirSync5(emailDir, { recursive: true });
|
|
16398
16478
|
const metadata = {
|
|
16399
16479
|
id: email3.id,
|
|
16400
16480
|
from: email3.from_email,
|
|
16401
16481
|
to: email3.to_email,
|
|
16402
16482
|
subject: email3.subject,
|
|
16403
16483
|
date: email3.created_at,
|
|
16404
|
-
status: email3.status
|
|
16484
|
+
status: email3.status,
|
|
16485
|
+
message_id: email3.message_id || "",
|
|
16486
|
+
in_reply_to: email3.in_reply_to || "",
|
|
16487
|
+
references: email3.references || ""
|
|
16405
16488
|
};
|
|
16406
16489
|
const metadataPath = join4(emailDir, "metadata.json");
|
|
16407
16490
|
writeFileSync3(metadataPath, JSON.stringify(metadata, null, 2));
|
|
@@ -16430,7 +16513,7 @@ function emailCommand() {
|
|
|
16430
16513
|
}
|
|
16431
16514
|
if (parsed.attachments && parsed.attachments.length > 0) {
|
|
16432
16515
|
const attDir = join4(emailDir, "attachments");
|
|
16433
|
-
|
|
16516
|
+
mkdirSync5(attDir, { recursive: true });
|
|
16434
16517
|
const usedFilenames = new Set;
|
|
16435
16518
|
for (let i = 0;i < parsed.attachments.length; i++) {
|
|
16436
16519
|
const att = parsed.attachments[i];
|
|
@@ -16480,7 +16563,7 @@ function emailCommand() {
|
|
|
16480
16563
|
process.exit(1);
|
|
16481
16564
|
}
|
|
16482
16565
|
});
|
|
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) => {
|
|
16566
|
+
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
16567
|
const { serverUrl, token, workspaceId } = resolveClientOpts(command, {
|
|
16485
16568
|
workspace: opts.workspace,
|
|
16486
16569
|
agentId: opts.agent_id
|
|
@@ -16505,7 +16588,7 @@ function emailCommand() {
|
|
|
16505
16588
|
let size;
|
|
16506
16589
|
try {
|
|
16507
16590
|
bytes = readFileSync3(path);
|
|
16508
|
-
size =
|
|
16591
|
+
size = statSync2(path).size;
|
|
16509
16592
|
} catch (err) {
|
|
16510
16593
|
console.error(`Error: cannot read attachment "${path}": ${err instanceof Error ? err.message : err}`);
|
|
16511
16594
|
process.exit(1);
|
|
@@ -16522,12 +16605,26 @@ function emailCommand() {
|
|
|
16522
16605
|
contentType: uploaded.contentType ?? contentType
|
|
16523
16606
|
});
|
|
16524
16607
|
}
|
|
16608
|
+
let inReplyTo;
|
|
16609
|
+
let references;
|
|
16610
|
+
if (opts.inReplyTo) {
|
|
16611
|
+
try {
|
|
16612
|
+
const parentEmail = await client.getJSON(`/api/email/${opts.inReplyTo}`);
|
|
16613
|
+
if (parentEmail.message_id) {
|
|
16614
|
+
inReplyTo = parentEmail.message_id;
|
|
16615
|
+
references = [parentEmail.references, parentEmail.message_id].filter(Boolean).join(" ").trim() || undefined;
|
|
16616
|
+
}
|
|
16617
|
+
} catch {
|
|
16618
|
+
console.warn(`Warning: could not fetch parent email ${opts.inReplyTo}, sending without threading`);
|
|
16619
|
+
}
|
|
16620
|
+
}
|
|
16525
16621
|
const res = await client.postJSON("/api/email/send", {
|
|
16526
16622
|
agentId: opts.agent_id,
|
|
16527
16623
|
to: opts.to,
|
|
16528
16624
|
subject: opts.subject,
|
|
16529
16625
|
htmlBody,
|
|
16530
|
-
attachments
|
|
16626
|
+
attachments,
|
|
16627
|
+
...inReplyTo ? { inReplyTo, references } : {}
|
|
16531
16628
|
});
|
|
16532
16629
|
console.log(`Sent email to ${res.to_email} (id: ${res.id})`);
|
|
16533
16630
|
} catch (err) {
|
package/dist/session-runner.js
CHANGED
|
@@ -13620,7 +13620,8 @@ var PollRequestSchema = exports_external.object({
|
|
|
13620
13620
|
max_tasks: exports_external.number().int().min(1).default(1)
|
|
13621
13621
|
});
|
|
13622
13622
|
var PollResponseSchema = exports_external.object({
|
|
13623
|
-
tasks: exports_external.array(TaskApiSchema)
|
|
13623
|
+
tasks: exports_external.array(TaskApiSchema),
|
|
13624
|
+
evicted: exports_external.boolean().optional()
|
|
13624
13625
|
});
|
|
13625
13626
|
var RegisterResponseSchema = exports_external.object({
|
|
13626
13627
|
runtimes: exports_external.array(exports_external.object({ id: exports_external.string() }))
|
|
@@ -13703,6 +13704,12 @@ var UpdateCalendarEventRequestSchema = exports_external.object({
|
|
|
13703
13704
|
message: "occurrence_at must be a valid ISO datetime"
|
|
13704
13705
|
}).optional()
|
|
13705
13706
|
}).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" });
|
|
13707
|
+
var DeleteCalendarEventRequestSchema = exports_external.object({
|
|
13708
|
+
scope: exports_external.enum(["this", "following"]).optional(),
|
|
13709
|
+
occurrence_at: exports_external.string().min(1).refine((s) => !Number.isNaN(Date.parse(s)), {
|
|
13710
|
+
message: "occurrence_at must be a valid ISO datetime"
|
|
13711
|
+
}).optional()
|
|
13712
|
+
});
|
|
13706
13713
|
var CalendarEventApiSchema = exports_external.object({
|
|
13707
13714
|
id: exports_external.string(),
|
|
13708
13715
|
agent_id: exports_external.string(),
|
|
@@ -13717,7 +13724,7 @@ var CalendarEventApiSchema = exports_external.object({
|
|
|
13717
13724
|
created_at: exports_external.string(),
|
|
13718
13725
|
updated_at: exports_external.string()
|
|
13719
13726
|
});
|
|
13720
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13727
|
+
// ../../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
13728
|
var entityKind = Symbol.for("drizzle:entityKind");
|
|
13722
13729
|
var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
|
|
13723
13730
|
function is(value, type) {
|
|
@@ -13742,10 +13749,10 @@ function is(value, type) {
|
|
|
13742
13749
|
return false;
|
|
13743
13750
|
}
|
|
13744
13751
|
|
|
13745
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13752
|
+
// ../../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
13753
|
var TableName = Symbol.for("drizzle:Name");
|
|
13747
13754
|
|
|
13748
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13755
|
+
// ../../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
13756
|
var Schema = Symbol.for("drizzle:Schema");
|
|
13750
13757
|
var Columns = Symbol.for("drizzle:Columns");
|
|
13751
13758
|
var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
|
|
@@ -13783,7 +13790,7 @@ class Table {
|
|
|
13783
13790
|
}
|
|
13784
13791
|
}
|
|
13785
13792
|
|
|
13786
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13793
|
+
// ../../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
13794
|
class Column {
|
|
13788
13795
|
constructor(table, config2) {
|
|
13789
13796
|
this.table = table;
|
|
@@ -13833,7 +13840,7 @@ class Column {
|
|
|
13833
13840
|
}
|
|
13834
13841
|
}
|
|
13835
13842
|
|
|
13836
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13843
|
+
// ../../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
13844
|
class ColumnBuilder {
|
|
13838
13845
|
static [entityKind] = "ColumnBuilder";
|
|
13839
13846
|
config;
|
|
@@ -13889,17 +13896,17 @@ class ColumnBuilder {
|
|
|
13889
13896
|
}
|
|
13890
13897
|
}
|
|
13891
13898
|
|
|
13892
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13899
|
+
// ../../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
13900
|
function iife(fn, ...args) {
|
|
13894
13901
|
return fn(...args);
|
|
13895
13902
|
}
|
|
13896
13903
|
|
|
13897
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13904
|
+
// ../../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
13905
|
function uniqueKeyName(table, columns) {
|
|
13899
13906
|
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
13900
13907
|
}
|
|
13901
13908
|
|
|
13902
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13909
|
+
// ../../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
13910
|
class PgColumn extends Column {
|
|
13904
13911
|
constructor(table, config2) {
|
|
13905
13912
|
if (!config2.uniqueName) {
|
|
@@ -13948,7 +13955,7 @@ class ExtraConfigColumn extends PgColumn {
|
|
|
13948
13955
|
}
|
|
13949
13956
|
}
|
|
13950
13957
|
|
|
13951
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13958
|
+
// ../../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
13959
|
class PgEnumObjectColumn extends PgColumn {
|
|
13953
13960
|
static [entityKind] = "PgEnumObjectColumn";
|
|
13954
13961
|
enum;
|
|
@@ -13978,7 +13985,7 @@ class PgEnumColumn extends PgColumn {
|
|
|
13978
13985
|
}
|
|
13979
13986
|
}
|
|
13980
13987
|
|
|
13981
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
13988
|
+
// ../../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
13989
|
class Subquery {
|
|
13983
13990
|
static [entityKind] = "Subquery";
|
|
13984
13991
|
constructor(sql, fields, alias, isWith = false, usedTables = []) {
|
|
@@ -13993,10 +14000,10 @@ class Subquery {
|
|
|
13993
14000
|
}
|
|
13994
14001
|
}
|
|
13995
14002
|
|
|
13996
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14003
|
+
// ../../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
14004
|
var version2 = "0.45.2";
|
|
13998
14005
|
|
|
13999
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14006
|
+
// ../../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
14007
|
var otel;
|
|
14001
14008
|
var rawTracer;
|
|
14002
14009
|
var tracer = {
|
|
@@ -14023,10 +14030,10 @@ var tracer = {
|
|
|
14023
14030
|
}
|
|
14024
14031
|
};
|
|
14025
14032
|
|
|
14026
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14033
|
+
// ../../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
14034
|
var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
|
|
14028
14035
|
|
|
14029
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14036
|
+
// ../../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
14037
|
function isSQLWrapper(value) {
|
|
14031
14038
|
return value !== null && value !== undefined && typeof value.getSQL === "function";
|
|
14032
14039
|
}
|
|
@@ -14386,7 +14393,7 @@ Subquery.prototype.getSQL = function() {
|
|
|
14386
14393
|
return new SQL([this]);
|
|
14387
14394
|
};
|
|
14388
14395
|
|
|
14389
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14396
|
+
// ../../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
14397
|
function getColumnNameAndConfig(a, b) {
|
|
14391
14398
|
return {
|
|
14392
14399
|
name: typeof a === "string" && a.length > 0 ? a : "",
|
|
@@ -14395,7 +14402,7 @@ function getColumnNameAndConfig(a, b) {
|
|
|
14395
14402
|
}
|
|
14396
14403
|
var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder;
|
|
14397
14404
|
|
|
14398
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14405
|
+
// ../../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
14406
|
class ForeignKeyBuilder {
|
|
14400
14407
|
static [entityKind] = "SQLiteForeignKeyBuilder";
|
|
14401
14408
|
reference;
|
|
@@ -14463,7 +14470,7 @@ function foreignKey(config2) {
|
|
|
14463
14470
|
return new ForeignKeyBuilder(mappedConfig);
|
|
14464
14471
|
}
|
|
14465
14472
|
|
|
14466
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14473
|
+
// ../../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
14474
|
function uniqueKeyName2(table, columns) {
|
|
14468
14475
|
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
14469
14476
|
}
|
|
@@ -14508,7 +14515,7 @@ class UniqueConstraint {
|
|
|
14508
14515
|
}
|
|
14509
14516
|
}
|
|
14510
14517
|
|
|
14511
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14518
|
+
// ../../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
14519
|
class SQLiteColumnBuilder extends ColumnBuilder {
|
|
14513
14520
|
static [entityKind] = "SQLiteColumnBuilder";
|
|
14514
14521
|
foreignKeyConfigs = [];
|
|
@@ -14559,7 +14566,7 @@ class SQLiteColumn extends Column {
|
|
|
14559
14566
|
static [entityKind] = "SQLiteColumn";
|
|
14560
14567
|
}
|
|
14561
14568
|
|
|
14562
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14569
|
+
// ../../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
14570
|
class SQLiteBigIntBuilder extends SQLiteColumnBuilder {
|
|
14564
14571
|
static [entityKind] = "SQLiteBigIntBuilder";
|
|
14565
14572
|
constructor(name) {
|
|
@@ -14647,7 +14654,7 @@ function blob(a, b) {
|
|
|
14647
14654
|
return new SQLiteBlobBufferBuilder(name);
|
|
14648
14655
|
}
|
|
14649
14656
|
|
|
14650
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14657
|
+
// ../../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
14658
|
class SQLiteCustomColumnBuilder extends SQLiteColumnBuilder {
|
|
14652
14659
|
static [entityKind] = "SQLiteCustomColumnBuilder";
|
|
14653
14660
|
constructor(name, fieldConfig, customTypeParams) {
|
|
@@ -14688,7 +14695,7 @@ function customType(customTypeParams) {
|
|
|
14688
14695
|
};
|
|
14689
14696
|
}
|
|
14690
14697
|
|
|
14691
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14698
|
+
// ../../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
14699
|
class SQLiteBaseIntegerBuilder extends SQLiteColumnBuilder {
|
|
14693
14700
|
static [entityKind] = "SQLiteBaseIntegerBuilder";
|
|
14694
14701
|
constructor(name, dataType, columnType) {
|
|
@@ -14790,7 +14797,7 @@ function integer2(a, b) {
|
|
|
14790
14797
|
return new SQLiteIntegerBuilder(name);
|
|
14791
14798
|
}
|
|
14792
14799
|
|
|
14793
|
-
// ../../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/numeric.js
|
|
14794
14801
|
class SQLiteNumericBuilder extends SQLiteColumnBuilder {
|
|
14795
14802
|
static [entityKind] = "SQLiteNumericBuilder";
|
|
14796
14803
|
constructor(name) {
|
|
@@ -14860,7 +14867,7 @@ function numeric(a, b) {
|
|
|
14860
14867
|
return mode === "number" ? new SQLiteNumericNumberBuilder(name) : mode === "bigint" ? new SQLiteNumericBigIntBuilder(name) : new SQLiteNumericBuilder(name);
|
|
14861
14868
|
}
|
|
14862
14869
|
|
|
14863
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14870
|
+
// ../../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
14871
|
class SQLiteRealBuilder extends SQLiteColumnBuilder {
|
|
14865
14872
|
static [entityKind] = "SQLiteRealBuilder";
|
|
14866
14873
|
constructor(name) {
|
|
@@ -14881,7 +14888,7 @@ function real(name) {
|
|
|
14881
14888
|
return new SQLiteRealBuilder(name ?? "");
|
|
14882
14889
|
}
|
|
14883
14890
|
|
|
14884
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14891
|
+
// ../../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
14892
|
class SQLiteTextBuilder extends SQLiteColumnBuilder {
|
|
14886
14893
|
static [entityKind] = "SQLiteTextBuilder";
|
|
14887
14894
|
constructor(name, config2) {
|
|
@@ -14936,7 +14943,7 @@ function text(a, b = {}) {
|
|
|
14936
14943
|
return new SQLiteTextBuilder(name, config2);
|
|
14937
14944
|
}
|
|
14938
14945
|
|
|
14939
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14946
|
+
// ../../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
14947
|
function getSQLiteColumnBuilders() {
|
|
14941
14948
|
return {
|
|
14942
14949
|
blob,
|
|
@@ -14948,7 +14955,7 @@ function getSQLiteColumnBuilders() {
|
|
|
14948
14955
|
};
|
|
14949
14956
|
}
|
|
14950
14957
|
|
|
14951
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14958
|
+
// ../../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
14959
|
var InlineForeignKeys = Symbol.for("drizzle:SQLiteInlineForeignKeys");
|
|
14953
14960
|
|
|
14954
14961
|
class SQLiteTable extends Table {
|
|
@@ -14982,7 +14989,7 @@ var sqliteTable = (name, columns, extraConfig) => {
|
|
|
14982
14989
|
return sqliteTableBase(name, columns, extraConfig);
|
|
14983
14990
|
};
|
|
14984
14991
|
|
|
14985
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
14992
|
+
// ../../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
14993
|
class IndexBuilderOn {
|
|
14987
14994
|
constructor(name, unique2) {
|
|
14988
14995
|
this.name = name;
|
|
@@ -15025,7 +15032,7 @@ function index(name) {
|
|
|
15025
15032
|
return new IndexBuilderOn(name, false);
|
|
15026
15033
|
}
|
|
15027
15034
|
|
|
15028
|
-
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.
|
|
15035
|
+
// ../../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
15036
|
function primaryKey(...config2) {
|
|
15030
15037
|
if (config2[0].columns) {
|
|
15031
15038
|
return new PrimaryKeyBuilder(config2[0].columns, config2[0].name);
|
|
@@ -15060,13 +15067,13 @@ class PrimaryKey {
|
|
|
15060
15067
|
}
|
|
15061
15068
|
}
|
|
15062
15069
|
|
|
15063
|
-
// ../../node_modules/.pnpm/nanoid@5.1.
|
|
15070
|
+
// ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/index.js
|
|
15064
15071
|
import { webcrypto as crypto } from "node:crypto";
|
|
15065
15072
|
|
|
15066
|
-
// ../../node_modules/.pnpm/nanoid@5.1.
|
|
15073
|
+
// ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/url-alphabet/index.js
|
|
15067
15074
|
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
15068
15075
|
|
|
15069
|
-
// ../../node_modules/.pnpm/nanoid@5.1.
|
|
15076
|
+
// ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/index.js
|
|
15070
15077
|
var POOL_SIZE_MULTIPLIER = 128;
|
|
15071
15078
|
var pool;
|
|
15072
15079
|
var poolOffset;
|
|
@@ -15186,7 +15193,6 @@ var agent = sqliteTable("agent", {
|
|
|
15186
15193
|
tools: text("tools", { mode: "json" }),
|
|
15187
15194
|
triggers: text("triggers", { mode: "json" }),
|
|
15188
15195
|
emailHandle: text("email_handle").unique(),
|
|
15189
|
-
forwardToEmail: text("forward_to_email").default(""),
|
|
15190
15196
|
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),
|
|
15191
15197
|
updatedAt: text("updated_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
15192
15198
|
}, (t) => [primaryKey({ columns: [t.id, t.workspaceId] })]);
|
|
@@ -15272,6 +15278,9 @@ var emails = sqliteTable("emails", {
|
|
|
15272
15278
|
r2Key: text("r2_key").notNull(),
|
|
15273
15279
|
isWhitelisted: integer2("is_whitelisted", { mode: "boolean" }).notNull().default(false),
|
|
15274
15280
|
forwarded: integer2("forwarded", { mode: "boolean" }).notNull().default(false),
|
|
15281
|
+
messageId: text("message_id").notNull().default(""),
|
|
15282
|
+
inReplyTo: text("in_reply_to").notNull().default(""),
|
|
15283
|
+
references: text("references").notNull().default(""),
|
|
15275
15284
|
htmlBody: text("html_body").notNull().default(""),
|
|
15276
15285
|
attachments: text("attachments").notNull().default("[]"),
|
|
15277
15286
|
status: text("status").notNull().default("unread"),
|
|
@@ -15371,7 +15380,7 @@ class DaemonClient {
|
|
|
15371
15380
|
async poll(token, daemonId, maxTasks) {
|
|
15372
15381
|
const raw = await this.request("POST", "/api/daemon/tasks/poll", token, { daemon_id: daemonId, max_tasks: maxTasks });
|
|
15373
15382
|
const resp = PollResponseSchema.parse(raw);
|
|
15374
|
-
return resp.tasks;
|
|
15383
|
+
return { tasks: resp.tasks, evicted: resp.evicted ?? false };
|
|
15375
15384
|
}
|
|
15376
15385
|
startTask(token, taskId) {
|
|
15377
15386
|
return this.request("POST", `/api/daemon/tasks/${taskId}/start`, token);
|
|
@@ -15632,7 +15641,8 @@ var RAW_DETECTION_METHODS = new Set([
|
|
|
15632
15641
|
"turn/completed",
|
|
15633
15642
|
"thread/started",
|
|
15634
15643
|
"item/started",
|
|
15635
|
-
"item/completed"
|
|
15644
|
+
"item/completed",
|
|
15645
|
+
"item/agentMessage/delta"
|
|
15636
15646
|
]);
|
|
15637
15647
|
function extractThreadID(response) {
|
|
15638
15648
|
if (response && typeof response === "object") {
|
|
@@ -15680,7 +15690,10 @@ class CodexBackend {
|
|
|
15680
15690
|
resolveSessionId = resolve;
|
|
15681
15691
|
});
|
|
15682
15692
|
let notificationProtocol = "unknown";
|
|
15693
|
+
let turnStarted = false;
|
|
15694
|
+
let turnDoneTriggered = false;
|
|
15683
15695
|
let lastCompletedTurnId = "";
|
|
15696
|
+
let turnError = "";
|
|
15684
15697
|
const pendingRequests = new Map;
|
|
15685
15698
|
const messageQueue = [];
|
|
15686
15699
|
let messageResolve = null;
|
|
@@ -15721,12 +15734,21 @@ class CodexBackend {
|
|
|
15721
15734
|
}
|
|
15722
15735
|
pendingRequests.clear();
|
|
15723
15736
|
};
|
|
15737
|
+
const setTurnError = (msg) => {
|
|
15738
|
+
if (msg && !turnError)
|
|
15739
|
+
turnError = msg;
|
|
15740
|
+
};
|
|
15724
15741
|
const triggerTurnDone = (aborted2) => {
|
|
15725
|
-
if (
|
|
15726
|
-
|
|
15727
|
-
|
|
15728
|
-
|
|
15729
|
-
|
|
15742
|
+
if (turnDoneTriggered)
|
|
15743
|
+
return;
|
|
15744
|
+
turnDoneTriggered = true;
|
|
15745
|
+
resultStatus = aborted2 ? "aborted" : "completed";
|
|
15746
|
+
try {
|
|
15747
|
+
proc.stdin?.end();
|
|
15748
|
+
} catch {}
|
|
15749
|
+
try {
|
|
15750
|
+
proc.kill("SIGTERM");
|
|
15751
|
+
} catch {}
|
|
15730
15752
|
};
|
|
15731
15753
|
const handleServerRequest = (msg) => {
|
|
15732
15754
|
const method = msg.method;
|
|
@@ -15758,33 +15780,50 @@ class CodexBackend {
|
|
|
15758
15780
|
return;
|
|
15759
15781
|
notificationProtocol = "raw";
|
|
15760
15782
|
}
|
|
15761
|
-
if (method === "thread/status/changed" && notificationProtocol === "legacy") {
|
|
15783
|
+
if ((method === "thread/status/changed" || method === "error") && notificationProtocol === "legacy") {
|
|
15784
|
+
return;
|
|
15785
|
+
}
|
|
15786
|
+
const notifThreadId = params.threadId;
|
|
15787
|
+
if (sessionId && notifThreadId && notifThreadId !== sessionId) {
|
|
15762
15788
|
return;
|
|
15763
15789
|
}
|
|
15764
15790
|
switch (method) {
|
|
15765
15791
|
case "turn/started": {
|
|
15792
|
+
turnStarted = true;
|
|
15766
15793
|
break;
|
|
15767
15794
|
}
|
|
15768
15795
|
case "turn/completed": {
|
|
15769
|
-
const
|
|
15796
|
+
const turn = params.turn;
|
|
15797
|
+
const turnId = turn?.id || params.turnId || "";
|
|
15770
15798
|
if (turnId && turnId === lastCompletedTurnId)
|
|
15771
15799
|
return;
|
|
15772
15800
|
if (turnId)
|
|
15773
15801
|
lastCompletedTurnId = turnId;
|
|
15774
|
-
const status = params.status;
|
|
15802
|
+
const status = turn?.status || params.status || "";
|
|
15775
15803
|
if (status === "completed" || status === "finished") {
|
|
15776
15804
|
triggerTurnDone(false);
|
|
15777
|
-
} else if (status === "cancelled" || status === "aborted") {
|
|
15805
|
+
} else if (status === "cancelled" || status === "aborted" || status === "interrupted") {
|
|
15778
15806
|
triggerTurnDone(true);
|
|
15779
15807
|
} else if (status === "error" || status === "failed") {
|
|
15780
|
-
|
|
15781
|
-
|
|
15808
|
+
const turnErr = turn?.error;
|
|
15809
|
+
setTurnError(turnErr?.message || "codex turn failed");
|
|
15810
|
+
triggerTurnDone(false);
|
|
15811
|
+
}
|
|
15812
|
+
break;
|
|
15813
|
+
}
|
|
15814
|
+
case "error": {
|
|
15815
|
+
const errObj = params.error;
|
|
15816
|
+
const errMsg = errObj?.message || params.message || "";
|
|
15817
|
+
const willRetry = params.willRetry === true;
|
|
15818
|
+
if (errMsg && !willRetry) {
|
|
15819
|
+
setTurnError(errMsg);
|
|
15782
15820
|
}
|
|
15783
15821
|
break;
|
|
15784
15822
|
}
|
|
15785
15823
|
case "thread/status/changed": {
|
|
15786
|
-
const
|
|
15787
|
-
|
|
15824
|
+
const statusObj = params.status;
|
|
15825
|
+
const statusType = typeof statusObj === "object" && statusObj !== null ? statusObj.type || "" : statusObj || "";
|
|
15826
|
+
if (statusType === "idle" && turnStarted) {
|
|
15788
15827
|
triggerTurnDone(false);
|
|
15789
15828
|
}
|
|
15790
15829
|
break;
|
|
@@ -15830,13 +15869,19 @@ class CodexBackend {
|
|
|
15830
15869
|
output: ""
|
|
15831
15870
|
});
|
|
15832
15871
|
} else if (itemType === "agentMessage") {
|
|
15833
|
-
const
|
|
15834
|
-
if (
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
|
|
15838
|
-
|
|
15839
|
-
|
|
15872
|
+
const flatText = item.text;
|
|
15873
|
+
if (flatText) {
|
|
15874
|
+
pushMessage({ type: "text", content: flatText });
|
|
15875
|
+
lastOutput = flatText;
|
|
15876
|
+
} else {
|
|
15877
|
+
const content = item.content;
|
|
15878
|
+
if (Array.isArray(content)) {
|
|
15879
|
+
for (const block of content) {
|
|
15880
|
+
if (block.type === "output_text" || block.type === "text") {
|
|
15881
|
+
if (block.text) {
|
|
15882
|
+
pushMessage({ type: "text", content: block.text });
|
|
15883
|
+
lastOutput = block.text;
|
|
15884
|
+
}
|
|
15840
15885
|
}
|
|
15841
15886
|
}
|
|
15842
15887
|
}
|
|
@@ -16013,6 +16058,10 @@ class CodexBackend {
|
|
|
16013
16058
|
if (stderr && !lastError) {
|
|
16014
16059
|
lastError = stderr;
|
|
16015
16060
|
}
|
|
16061
|
+
if (turnError) {
|
|
16062
|
+
resultStatus = "failed";
|
|
16063
|
+
lastError = turnError;
|
|
16064
|
+
}
|
|
16016
16065
|
resolveSessionId(sessionId);
|
|
16017
16066
|
messageDone = true;
|
|
16018
16067
|
if (messageResolve) {
|
|
@@ -16091,6 +16140,18 @@ class OpenCodeBackend {
|
|
|
16091
16140
|
const sessionIdPromise = new Promise((resolve) => {
|
|
16092
16141
|
resolveSessionId = resolve;
|
|
16093
16142
|
});
|
|
16143
|
+
let turnDoneTriggered = false;
|
|
16144
|
+
const turnDone = () => {
|
|
16145
|
+
if (turnDoneTriggered)
|
|
16146
|
+
return;
|
|
16147
|
+
turnDoneTriggered = true;
|
|
16148
|
+
try {
|
|
16149
|
+
proc.stdin?.end();
|
|
16150
|
+
} catch {}
|
|
16151
|
+
try {
|
|
16152
|
+
proc.kill("SIGTERM");
|
|
16153
|
+
} catch {}
|
|
16154
|
+
};
|
|
16094
16155
|
const messageQueue = [];
|
|
16095
16156
|
let messageResolve = null;
|
|
16096
16157
|
let messageDone = false;
|
|
@@ -16163,6 +16224,7 @@ class OpenCodeBackend {
|
|
|
16163
16224
|
const content = event.message || event.content || "";
|
|
16164
16225
|
lastError = content;
|
|
16165
16226
|
pushMessage({ type: "error", content });
|
|
16227
|
+
turnDone();
|
|
16166
16228
|
break;
|
|
16167
16229
|
}
|
|
16168
16230
|
case "done":
|
|
@@ -16179,6 +16241,7 @@ class OpenCodeBackend {
|
|
|
16179
16241
|
if (!lastError)
|
|
16180
16242
|
lastError = output || "task failed";
|
|
16181
16243
|
}
|
|
16244
|
+
turnDone();
|
|
16182
16245
|
break;
|
|
16183
16246
|
}
|
|
16184
16247
|
default: {
|
|
@@ -16271,8 +16334,7 @@ import {
|
|
|
16271
16334
|
import { join } from "path";
|
|
16272
16335
|
var CANONICAL_FILE = "AGENTS.md";
|
|
16273
16336
|
var SYMLINK_ALIASES = ["CLAUDE.md"];
|
|
16274
|
-
var
|
|
16275
|
-
## Memory Management
|
|
16337
|
+
var SYSTEM_PROMPT_BODY = `## Memory Management
|
|
16276
16338
|
- Your memory directory is ./, don't write ANY EXTERNAL memory file.
|
|
16277
16339
|
- Write ESSENTIAL yet SHORT memory to ./memory.md
|
|
16278
16340
|
- For SPECIFIC yet LONG rules or pattern, write to experiences/[NAME].md, and add index to ./memory.md for later recall.
|
|
@@ -16318,7 +16380,9 @@ those json are sorted by datetime in asc order.
|
|
|
16318
16380
|
- 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
16381
|
`;
|
|
16320
16382
|
function buildInstructionContent(task) {
|
|
16321
|
-
|
|
16383
|
+
const displayName = task.agent?.name || "Alook Agent";
|
|
16384
|
+
let content = `You're ${displayName} in the Alook Platform.
|
|
16385
|
+
${SYSTEM_PROMPT_BODY}`;
|
|
16322
16386
|
if (task.agent?.instructions) {
|
|
16323
16387
|
content += `## BIG BOSS Instructions
|
|
16324
16388
|
The below instructions(if not empty) come from the big boss, follow them or you will be fired:
|
|
@@ -16339,7 +16403,7 @@ ${task.agent.userEmail ? `Your owner's email address is '${task.agent.userEmail}
|
|
|
16339
16403
|
---
|
|
16340
16404
|
Run 'npx @alook/cli pull --agent_id ${task.agentId} --status unread' to download unread emails to '/tmp/alook-emails/'.
|
|
16341
16405
|
Each email is saved to '/tmp/alook-emails/<emailId>/' with:
|
|
16342
|
-
- 'metadata.json' — sender, recipient, subject, date, status
|
|
16406
|
+
- 'metadata.json' — sender, recipient, subject, date, status, message_id, in_reply_to, references
|
|
16343
16407
|
- 'body.txt' — plain text body
|
|
16344
16408
|
- 'body.html' — HTML body (if available)
|
|
16345
16409
|
- 'attachments/' — extracted attachment files (if any)
|
|
@@ -16348,16 +16412,24 @@ Before starting to process an email, mark it as read:
|
|
|
16348
16412
|
- Run 'npx @alook/cli set --agent_id ${task.agentId} --email_id <EMAIL_ID> --status read'
|
|
16349
16413
|
---
|
|
16350
16414
|
|
|
16351
|
-
#### Sending email
|
|
16415
|
+
#### Sending a new email
|
|
16352
16416
|
Write the HTML body to a file first, then send it. The body is forwarded as-is (HTML).
|
|
16353
16417
|
- Run 'npx @alook/cli email send --agent_id ${task.agentId} --to <ADDRESS> --subject "<SUBJECT>" --body-file <PATH_TO_HTML>'
|
|
16354
16418
|
- Attach files with '--attachment <PATH>' — repeat the flag for multiple attachments. Each file is uploaded before sending.
|
|
16355
16419
|
- 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'
|
|
16420
|
+
|
|
16421
|
+
#### Replying to an email
|
|
16422
|
+
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.
|
|
16423
|
+
- Use 'Re: <original subject>' as the subject.
|
|
16424
|
+
- Quote the original email body in your reply (wrap it in a blockquote).
|
|
16425
|
+
- The <EMAIL_ID> is the Alook email id from metadata.json (not the message_id header).
|
|
16426
|
+
- 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
16427
|
---
|
|
16357
16428
|
`;
|
|
16358
16429
|
}
|
|
16359
16430
|
content += `
|
|
16360
16431
|
### Calendar
|
|
16432
|
+
You have your own calendar to setup daily routines and reminders.
|
|
16361
16433
|
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
16434
|
---
|
|
16363
16435
|
Create a one-off event:
|
|
@@ -16703,7 +16775,7 @@ function updateEntry(timelineDir, taskId, updater) {
|
|
|
16703
16775
|
}
|
|
16704
16776
|
log.debug(`Timeline updateEntry: task_id ${taskId} not found in last 7 days`);
|
|
16705
16777
|
}
|
|
16706
|
-
function createTimelineEntry(taskId, prompt, type, sessionId, pid) {
|
|
16778
|
+
function createTimelineEntry(taskId, prompt, type, sessionId, pid, provider) {
|
|
16707
16779
|
return {
|
|
16708
16780
|
task_id: taskId,
|
|
16709
16781
|
session_id: sessionId || null,
|
|
@@ -16713,11 +16785,12 @@ function createTimelineEntry(taskId, prompt, type, sessionId, pid) {
|
|
|
16713
16785
|
type,
|
|
16714
16786
|
prompt,
|
|
16715
16787
|
agent_responses: [],
|
|
16716
|
-
errmsg: null
|
|
16788
|
+
errmsg: null,
|
|
16789
|
+
provider: provider ?? null
|
|
16717
16790
|
};
|
|
16718
16791
|
}
|
|
16719
16792
|
var DEFAULT_RESUME_MAX_AGE_MS = 3 * 60 * 60 * 1000;
|
|
16720
|
-
function findResumableSessionId(timelineDir, type, maxAgeMs = DEFAULT_RESUME_MAX_AGE_MS) {
|
|
16793
|
+
function findResumableSessionId(timelineDir, type, provider, maxAgeMs = DEFAULT_RESUME_MAX_AGE_MS) {
|
|
16721
16794
|
const now = new Date;
|
|
16722
16795
|
const cutoff = new Date(now.getTime() - maxAgeMs);
|
|
16723
16796
|
const daysToScan = Math.ceil(maxAgeMs / 86400000) + 1;
|
|
@@ -16727,7 +16800,7 @@ function findResumableSessionId(timelineDir, type, maxAgeMs = DEFAULT_RESUME_MAX
|
|
|
16727
16800
|
}
|
|
16728
16801
|
entries.sort((a, b) => new Date(b.datetime).getTime() - new Date(a.datetime).getTime());
|
|
16729
16802
|
for (const entry of entries) {
|
|
16730
|
-
if (entry.status === "completed" && entry.type === type && entry.session_id && new Date(entry.datetime) >= cutoff) {
|
|
16803
|
+
if (entry.status === "completed" && entry.type === type && entry.provider === provider && entry.session_id && new Date(entry.datetime) >= cutoff) {
|
|
16731
16804
|
return entry.session_id;
|
|
16732
16805
|
}
|
|
16733
16806
|
}
|
|
@@ -16765,7 +16838,7 @@ async function runSession(input) {
|
|
|
16765
16838
|
const backend = createBackend(provider, cliPath);
|
|
16766
16839
|
const prompt = buildPrompt(task);
|
|
16767
16840
|
const { workDir, logFile, timelineDir, env } = prepare({ workspacesRoot }, task);
|
|
16768
|
-
const resumeSessionId = task.type === TASK_TYPES.USER_DM_MESSAGE ? findResumableSessionId(timelineDir, task.type) ?? undefined : undefined;
|
|
16841
|
+
const resumeSessionId = task.type === TASK_TYPES.USER_DM_MESSAGE ? findResumableSessionId(timelineDir, task.type, provider) ?? undefined : undefined;
|
|
16769
16842
|
if (resumeSessionId) {
|
|
16770
16843
|
log.info(`Task ${task.id} resuming session ${resumeSessionId}`);
|
|
16771
16844
|
}
|
|
@@ -16778,7 +16851,7 @@ async function runSession(input) {
|
|
|
16778
16851
|
});
|
|
16779
16852
|
const agentPid = session2.pid;
|
|
16780
16853
|
const earlySessionId = await session2.sessionId;
|
|
16781
|
-
await initEntryAsync(timelineDir, createTimelineEntry(task.id, task.prompt, task.type, earlySessionId, process.pid));
|
|
16854
|
+
await initEntryAsync(timelineDir, createTimelineEntry(task.id, task.prompt, task.type, earlySessionId, process.pid, provider));
|
|
16782
16855
|
const pendingMessages = [];
|
|
16783
16856
|
let seq = 0;
|
|
16784
16857
|
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.7",
|
|
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
|
}
|