@hasna/assistants 1.1.81 → 1.1.84
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 +1081 -490
- package/dist/index.js.map +8 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -109980,7 +109980,7 @@ Not a git repository or git not available.
|
|
|
109980
109980
|
context.setProjectContext(projectContext);
|
|
109981
109981
|
}
|
|
109982
109982
|
}
|
|
109983
|
-
var VERSION2 = "1.1.
|
|
109983
|
+
var VERSION2 = "1.1.84";
|
|
109984
109984
|
var init_builtin = __esm(async () => {
|
|
109985
109985
|
init_src2();
|
|
109986
109986
|
init_context3();
|
|
@@ -206003,61 +206003,748 @@ var init_types11 = __esm(() => {
|
|
|
206003
206003
|
};
|
|
206004
206004
|
});
|
|
206005
206005
|
|
|
206006
|
-
//
|
|
206006
|
+
// node_modules/.pnpm/@hasna+mementos@0.3.9_@types+react@19.2.14/node_modules/@hasna/mementos/dist/index.js
|
|
206007
|
+
import { Database as Database3 } from "bun:sqlite";
|
|
206008
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync14 } from "fs";
|
|
206009
|
+
import { dirname as dirname15, join as join40, resolve as resolve10 } from "path";
|
|
206010
|
+
import { existsSync as existsSync28, mkdirSync as mkdirSync24, readFileSync as readFileSync13 } from "fs";
|
|
206011
|
+
import { homedir as homedir23 } from "os";
|
|
206012
|
+
import { dirname as dirname22, join as join212, resolve as resolve22 } from "path";
|
|
206013
|
+
function isInMemoryDb2(path5) {
|
|
206014
|
+
return path5 === ":memory:" || path5.startsWith("file::memory:");
|
|
206015
|
+
}
|
|
206016
|
+
function findNearestMementosDb(startDir) {
|
|
206017
|
+
let dir = resolve10(startDir);
|
|
206018
|
+
while (true) {
|
|
206019
|
+
const candidate = join40(dir, ".mementos", "mementos.db");
|
|
206020
|
+
if (existsSync27(candidate))
|
|
206021
|
+
return candidate;
|
|
206022
|
+
const parent = dirname15(dir);
|
|
206023
|
+
if (parent === dir)
|
|
206024
|
+
break;
|
|
206025
|
+
dir = parent;
|
|
206026
|
+
}
|
|
206027
|
+
return null;
|
|
206028
|
+
}
|
|
206029
|
+
function findGitRoot2(startDir) {
|
|
206030
|
+
let dir = resolve10(startDir);
|
|
206031
|
+
while (true) {
|
|
206032
|
+
if (existsSync27(join40(dir, ".git")))
|
|
206033
|
+
return dir;
|
|
206034
|
+
const parent = dirname15(dir);
|
|
206035
|
+
if (parent === dir)
|
|
206036
|
+
break;
|
|
206037
|
+
dir = parent;
|
|
206038
|
+
}
|
|
206039
|
+
return null;
|
|
206040
|
+
}
|
|
206041
|
+
function getDbPath2() {
|
|
206042
|
+
if (process.env["MEMENTOS_DB_PATH"]) {
|
|
206043
|
+
return process.env["MEMENTOS_DB_PATH"];
|
|
206044
|
+
}
|
|
206045
|
+
const cwd2 = process.cwd();
|
|
206046
|
+
const nearest = findNearestMementosDb(cwd2);
|
|
206047
|
+
if (nearest)
|
|
206048
|
+
return nearest;
|
|
206049
|
+
if (process.env["MEMENTOS_DB_SCOPE"] === "project") {
|
|
206050
|
+
const gitRoot = findGitRoot2(cwd2);
|
|
206051
|
+
if (gitRoot) {
|
|
206052
|
+
return join40(gitRoot, ".mementos", "mementos.db");
|
|
206053
|
+
}
|
|
206054
|
+
}
|
|
206055
|
+
const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
206056
|
+
return join40(home, ".mementos", "mementos.db");
|
|
206057
|
+
}
|
|
206058
|
+
function ensureDir2(filePath) {
|
|
206059
|
+
if (isInMemoryDb2(filePath))
|
|
206060
|
+
return;
|
|
206061
|
+
const dir = dirname15(resolve10(filePath));
|
|
206062
|
+
if (!existsSync27(dir)) {
|
|
206063
|
+
mkdirSync14(dir, { recursive: true });
|
|
206064
|
+
}
|
|
206065
|
+
}
|
|
206066
|
+
function getDatabase3(dbPath) {
|
|
206067
|
+
if (_db2)
|
|
206068
|
+
return _db2;
|
|
206069
|
+
const path5 = dbPath || getDbPath2();
|
|
206070
|
+
ensureDir2(path5);
|
|
206071
|
+
_db2 = new Database3(path5, { create: true });
|
|
206072
|
+
_db2.run("PRAGMA journal_mode = WAL");
|
|
206073
|
+
_db2.run("PRAGMA busy_timeout = 5000");
|
|
206074
|
+
_db2.run("PRAGMA foreign_keys = ON");
|
|
206075
|
+
runMigrations2(_db2);
|
|
206076
|
+
return _db2;
|
|
206077
|
+
}
|
|
206078
|
+
function runMigrations2(db) {
|
|
206079
|
+
try {
|
|
206080
|
+
const result = db.query("SELECT MAX(id) as max_id FROM _migrations").get();
|
|
206081
|
+
const currentLevel = result?.max_id ?? 0;
|
|
206082
|
+
for (let i6 = currentLevel;i6 < MIGRATIONS2.length; i6++) {
|
|
206083
|
+
try {
|
|
206084
|
+
db.exec(MIGRATIONS2[i6]);
|
|
206085
|
+
} catch {}
|
|
206086
|
+
}
|
|
206087
|
+
} catch {
|
|
206088
|
+
for (const migration of MIGRATIONS2) {
|
|
206089
|
+
try {
|
|
206090
|
+
db.exec(migration);
|
|
206091
|
+
} catch {}
|
|
206092
|
+
}
|
|
206093
|
+
}
|
|
206094
|
+
}
|
|
206095
|
+
function now3() {
|
|
206096
|
+
return new Date().toISOString();
|
|
206097
|
+
}
|
|
206098
|
+
function uuid5() {
|
|
206099
|
+
return crypto.randomUUID();
|
|
206100
|
+
}
|
|
206101
|
+
function redactSecrets(text5) {
|
|
206102
|
+
let result = text5;
|
|
206103
|
+
for (const { pattern } of SECRET_PATTERNS) {
|
|
206104
|
+
pattern.lastIndex = 0;
|
|
206105
|
+
result = result.replace(pattern, REDACTED);
|
|
206106
|
+
}
|
|
206107
|
+
return result;
|
|
206108
|
+
}
|
|
206109
|
+
function parseMemoryRow(row) {
|
|
206110
|
+
return {
|
|
206111
|
+
id: row["id"],
|
|
206112
|
+
key: row["key"],
|
|
206113
|
+
value: row["value"],
|
|
206114
|
+
category: row["category"],
|
|
206115
|
+
scope: row["scope"],
|
|
206116
|
+
summary: row["summary"] || null,
|
|
206117
|
+
tags: JSON.parse(row["tags"] || "[]"),
|
|
206118
|
+
importance: row["importance"],
|
|
206119
|
+
source: row["source"],
|
|
206120
|
+
status: row["status"],
|
|
206121
|
+
pinned: !!row["pinned"],
|
|
206122
|
+
agent_id: row["agent_id"] || null,
|
|
206123
|
+
project_id: row["project_id"] || null,
|
|
206124
|
+
session_id: row["session_id"] || null,
|
|
206125
|
+
metadata: JSON.parse(row["metadata"] || "{}"),
|
|
206126
|
+
access_count: row["access_count"],
|
|
206127
|
+
version: row["version"],
|
|
206128
|
+
expires_at: row["expires_at"] || null,
|
|
206129
|
+
created_at: row["created_at"],
|
|
206130
|
+
updated_at: row["updated_at"],
|
|
206131
|
+
accessed_at: row["accessed_at"] || null
|
|
206132
|
+
};
|
|
206133
|
+
}
|
|
206134
|
+
function createMemory(input, dedupeMode = "merge", db) {
|
|
206135
|
+
const d5 = db || getDatabase3();
|
|
206136
|
+
const timestamp = now3();
|
|
206137
|
+
let expiresAt = input.expires_at || null;
|
|
206138
|
+
if (input.ttl_ms && !expiresAt) {
|
|
206139
|
+
expiresAt = new Date(Date.now() + input.ttl_ms).toISOString();
|
|
206140
|
+
}
|
|
206141
|
+
const id = uuid5();
|
|
206142
|
+
const tags = input.tags || [];
|
|
206143
|
+
const tagsJson = JSON.stringify(tags);
|
|
206144
|
+
const metadataJson = JSON.stringify(input.metadata || {});
|
|
206145
|
+
const safeValue = redactSecrets(input.value);
|
|
206146
|
+
const safeSummary = input.summary ? redactSecrets(input.summary) : null;
|
|
206147
|
+
if (dedupeMode === "merge") {
|
|
206148
|
+
const existing = d5.query(`SELECT id, version FROM memories
|
|
206149
|
+
WHERE key = ? AND scope = ?
|
|
206150
|
+
AND COALESCE(agent_id, '') = ?
|
|
206151
|
+
AND COALESCE(project_id, '') = ?
|
|
206152
|
+
AND COALESCE(session_id, '') = ?`).get(input.key, input.scope || "private", input.agent_id || "", input.project_id || "", input.session_id || "");
|
|
206153
|
+
if (existing) {
|
|
206154
|
+
d5.run(`UPDATE memories SET
|
|
206155
|
+
value = ?, category = ?, summary = ?, tags = ?,
|
|
206156
|
+
importance = ?, metadata = ?, expires_at = ?,
|
|
206157
|
+
pinned = COALESCE(pinned, 0),
|
|
206158
|
+
version = version + 1, updated_at = ?
|
|
206159
|
+
WHERE id = ?`, [
|
|
206160
|
+
safeValue,
|
|
206161
|
+
input.category || "knowledge",
|
|
206162
|
+
safeSummary,
|
|
206163
|
+
tagsJson,
|
|
206164
|
+
input.importance ?? 5,
|
|
206165
|
+
metadataJson,
|
|
206166
|
+
expiresAt,
|
|
206167
|
+
timestamp,
|
|
206168
|
+
existing.id
|
|
206169
|
+
]);
|
|
206170
|
+
d5.run("DELETE FROM memory_tags WHERE memory_id = ?", [existing.id]);
|
|
206171
|
+
const insertTag2 = d5.prepare("INSERT OR IGNORE INTO memory_tags (memory_id, tag) VALUES (?, ?)");
|
|
206172
|
+
for (const tag of tags) {
|
|
206173
|
+
insertTag2.run(existing.id, tag);
|
|
206174
|
+
}
|
|
206175
|
+
return getMemory(existing.id, d5);
|
|
206176
|
+
}
|
|
206177
|
+
}
|
|
206178
|
+
d5.run(`INSERT INTO memories (id, key, value, category, scope, summary, tags, importance, source, status, pinned, agent_id, project_id, session_id, metadata, access_count, version, expires_at, created_at, updated_at)
|
|
206179
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 'active', 0, ?, ?, ?, ?, 0, 1, ?, ?, ?)`, [
|
|
206180
|
+
id,
|
|
206181
|
+
input.key,
|
|
206182
|
+
input.value,
|
|
206183
|
+
input.category || "knowledge",
|
|
206184
|
+
input.scope || "private",
|
|
206185
|
+
input.summary || null,
|
|
206186
|
+
tagsJson,
|
|
206187
|
+
input.importance ?? 5,
|
|
206188
|
+
input.source || "agent",
|
|
206189
|
+
input.agent_id || null,
|
|
206190
|
+
input.project_id || null,
|
|
206191
|
+
input.session_id || null,
|
|
206192
|
+
metadataJson,
|
|
206193
|
+
expiresAt,
|
|
206194
|
+
timestamp,
|
|
206195
|
+
timestamp
|
|
206196
|
+
]);
|
|
206197
|
+
const insertTag = d5.prepare("INSERT OR IGNORE INTO memory_tags (memory_id, tag) VALUES (?, ?)");
|
|
206198
|
+
for (const tag of tags) {
|
|
206199
|
+
insertTag.run(id, tag);
|
|
206200
|
+
}
|
|
206201
|
+
return getMemory(id, d5);
|
|
206202
|
+
}
|
|
206203
|
+
function getMemory(id, db) {
|
|
206204
|
+
const d5 = db || getDatabase3();
|
|
206205
|
+
const row = d5.query("SELECT * FROM memories WHERE id = ?").get(id);
|
|
206206
|
+
if (!row)
|
|
206207
|
+
return null;
|
|
206208
|
+
return parseMemoryRow(row);
|
|
206209
|
+
}
|
|
206210
|
+
function getMemoryByKey(key, scope, agentId, projectId, sessionId, db) {
|
|
206211
|
+
const d5 = db || getDatabase3();
|
|
206212
|
+
let sql = "SELECT * FROM memories WHERE key = ?";
|
|
206213
|
+
const params = [key];
|
|
206214
|
+
if (scope) {
|
|
206215
|
+
sql += " AND scope = ?";
|
|
206216
|
+
params.push(scope);
|
|
206217
|
+
}
|
|
206218
|
+
if (agentId) {
|
|
206219
|
+
sql += " AND agent_id = ?";
|
|
206220
|
+
params.push(agentId);
|
|
206221
|
+
}
|
|
206222
|
+
if (projectId) {
|
|
206223
|
+
sql += " AND project_id = ?";
|
|
206224
|
+
params.push(projectId);
|
|
206225
|
+
}
|
|
206226
|
+
if (sessionId) {
|
|
206227
|
+
sql += " AND session_id = ?";
|
|
206228
|
+
params.push(sessionId);
|
|
206229
|
+
}
|
|
206230
|
+
sql += " AND status = 'active' ORDER BY importance DESC LIMIT 1";
|
|
206231
|
+
const row = d5.query(sql).get(...params);
|
|
206232
|
+
if (!row)
|
|
206233
|
+
return null;
|
|
206234
|
+
return parseMemoryRow(row);
|
|
206235
|
+
}
|
|
206236
|
+
function listMemories(filter, db) {
|
|
206237
|
+
const d5 = db || getDatabase3();
|
|
206238
|
+
const conditions = [];
|
|
206239
|
+
const params = [];
|
|
206240
|
+
if (filter) {
|
|
206241
|
+
if (filter.scope) {
|
|
206242
|
+
if (Array.isArray(filter.scope)) {
|
|
206243
|
+
conditions.push(`scope IN (${filter.scope.map(() => "?").join(",")})`);
|
|
206244
|
+
params.push(...filter.scope);
|
|
206245
|
+
} else {
|
|
206246
|
+
conditions.push("scope = ?");
|
|
206247
|
+
params.push(filter.scope);
|
|
206248
|
+
}
|
|
206249
|
+
}
|
|
206250
|
+
if (filter.category) {
|
|
206251
|
+
if (Array.isArray(filter.category)) {
|
|
206252
|
+
conditions.push(`category IN (${filter.category.map(() => "?").join(",")})`);
|
|
206253
|
+
params.push(...filter.category);
|
|
206254
|
+
} else {
|
|
206255
|
+
conditions.push("category = ?");
|
|
206256
|
+
params.push(filter.category);
|
|
206257
|
+
}
|
|
206258
|
+
}
|
|
206259
|
+
if (filter.source) {
|
|
206260
|
+
if (Array.isArray(filter.source)) {
|
|
206261
|
+
conditions.push(`source IN (${filter.source.map(() => "?").join(",")})`);
|
|
206262
|
+
params.push(...filter.source);
|
|
206263
|
+
} else {
|
|
206264
|
+
conditions.push("source = ?");
|
|
206265
|
+
params.push(filter.source);
|
|
206266
|
+
}
|
|
206267
|
+
}
|
|
206268
|
+
if (filter.status) {
|
|
206269
|
+
if (Array.isArray(filter.status)) {
|
|
206270
|
+
conditions.push(`status IN (${filter.status.map(() => "?").join(",")})`);
|
|
206271
|
+
params.push(...filter.status);
|
|
206272
|
+
} else {
|
|
206273
|
+
conditions.push("status = ?");
|
|
206274
|
+
params.push(filter.status);
|
|
206275
|
+
}
|
|
206276
|
+
} else {
|
|
206277
|
+
conditions.push("status = 'active'");
|
|
206278
|
+
}
|
|
206279
|
+
if (filter.project_id) {
|
|
206280
|
+
conditions.push("project_id = ?");
|
|
206281
|
+
params.push(filter.project_id);
|
|
206282
|
+
}
|
|
206283
|
+
if (filter.agent_id) {
|
|
206284
|
+
conditions.push("agent_id = ?");
|
|
206285
|
+
params.push(filter.agent_id);
|
|
206286
|
+
}
|
|
206287
|
+
if (filter.session_id) {
|
|
206288
|
+
conditions.push("session_id = ?");
|
|
206289
|
+
params.push(filter.session_id);
|
|
206290
|
+
}
|
|
206291
|
+
if (filter.min_importance) {
|
|
206292
|
+
conditions.push("importance >= ?");
|
|
206293
|
+
params.push(filter.min_importance);
|
|
206294
|
+
}
|
|
206295
|
+
if (filter.pinned !== undefined) {
|
|
206296
|
+
conditions.push("pinned = ?");
|
|
206297
|
+
params.push(filter.pinned ? 1 : 0);
|
|
206298
|
+
}
|
|
206299
|
+
if (filter.tags && filter.tags.length > 0) {
|
|
206300
|
+
for (const tag of filter.tags) {
|
|
206301
|
+
conditions.push("id IN (SELECT memory_id FROM memory_tags WHERE tag = ?)");
|
|
206302
|
+
params.push(tag);
|
|
206303
|
+
}
|
|
206304
|
+
}
|
|
206305
|
+
if (filter.search) {
|
|
206306
|
+
conditions.push("(key LIKE ? OR value LIKE ? OR summary LIKE ?)");
|
|
206307
|
+
const term = `%${filter.search}%`;
|
|
206308
|
+
params.push(term, term, term);
|
|
206309
|
+
}
|
|
206310
|
+
} else {
|
|
206311
|
+
conditions.push("status = 'active'");
|
|
206312
|
+
}
|
|
206313
|
+
let sql = "SELECT * FROM memories";
|
|
206314
|
+
if (conditions.length > 0) {
|
|
206315
|
+
sql += ` WHERE ${conditions.join(" AND ")}`;
|
|
206316
|
+
}
|
|
206317
|
+
sql += " ORDER BY importance DESC, created_at DESC";
|
|
206318
|
+
if (filter?.limit) {
|
|
206319
|
+
sql += " LIMIT ?";
|
|
206320
|
+
params.push(filter.limit);
|
|
206321
|
+
}
|
|
206322
|
+
if (filter?.offset) {
|
|
206323
|
+
sql += " OFFSET ?";
|
|
206324
|
+
params.push(filter.offset);
|
|
206325
|
+
}
|
|
206326
|
+
const rows = d5.query(sql).all(...params);
|
|
206327
|
+
return rows.map(parseMemoryRow);
|
|
206328
|
+
}
|
|
206329
|
+
function deleteMemory(id, db) {
|
|
206330
|
+
const d5 = db || getDatabase3();
|
|
206331
|
+
const result = d5.run("DELETE FROM memories WHERE id = ?", [id]);
|
|
206332
|
+
return result.changes > 0;
|
|
206333
|
+
}
|
|
206334
|
+
function touchMemory(id, db) {
|
|
206335
|
+
const d5 = db || getDatabase3();
|
|
206336
|
+
d5.run("UPDATE memories SET access_count = access_count + 1, accessed_at = ? WHERE id = ?", [now3(), id]);
|
|
206337
|
+
}
|
|
206338
|
+
function cleanExpiredMemories(db) {
|
|
206339
|
+
const d5 = db || getDatabase3();
|
|
206340
|
+
const timestamp = now3();
|
|
206341
|
+
const result = d5.run("DELETE FROM memories WHERE expires_at IS NOT NULL AND expires_at < ?", [timestamp]);
|
|
206342
|
+
return result.changes;
|
|
206343
|
+
}
|
|
206344
|
+
function deepMerge2(target, source) {
|
|
206345
|
+
const result = { ...target };
|
|
206346
|
+
for (const key of Object.keys(source)) {
|
|
206347
|
+
const sourceVal = source[key];
|
|
206348
|
+
const targetVal = result[key];
|
|
206349
|
+
if (sourceVal !== null && typeof sourceVal === "object" && !Array.isArray(sourceVal) && targetVal !== null && typeof targetVal === "object" && !Array.isArray(targetVal)) {
|
|
206350
|
+
result[key] = deepMerge2(targetVal, sourceVal);
|
|
206351
|
+
} else {
|
|
206352
|
+
result[key] = sourceVal;
|
|
206353
|
+
}
|
|
206354
|
+
}
|
|
206355
|
+
return result;
|
|
206356
|
+
}
|
|
206357
|
+
function isValidScope(value2) {
|
|
206358
|
+
return VALID_SCOPES2.includes(value2);
|
|
206359
|
+
}
|
|
206360
|
+
function isValidCategory(value2) {
|
|
206361
|
+
return VALID_CATEGORIES2.includes(value2);
|
|
206362
|
+
}
|
|
206363
|
+
function loadConfig5() {
|
|
206364
|
+
const configPath = join212(homedir23(), ".mementos", "config.json");
|
|
206365
|
+
let fileConfig = {};
|
|
206366
|
+
if (existsSync28(configPath)) {
|
|
206367
|
+
try {
|
|
206368
|
+
const raw = readFileSync13(configPath, "utf-8");
|
|
206369
|
+
fileConfig = JSON.parse(raw);
|
|
206370
|
+
} catch {}
|
|
206371
|
+
}
|
|
206372
|
+
const merged = deepMerge2(DEFAULT_CONFIG2, fileConfig);
|
|
206373
|
+
const envScope = process.env["MEMENTOS_DEFAULT_SCOPE"];
|
|
206374
|
+
if (envScope && isValidScope(envScope)) {
|
|
206375
|
+
merged.default_scope = envScope;
|
|
206376
|
+
}
|
|
206377
|
+
const envCategory = process.env["MEMENTOS_DEFAULT_CATEGORY"];
|
|
206378
|
+
if (envCategory && isValidCategory(envCategory)) {
|
|
206379
|
+
merged.default_category = envCategory;
|
|
206380
|
+
}
|
|
206381
|
+
const envImportance = process.env["MEMENTOS_DEFAULT_IMPORTANCE"];
|
|
206382
|
+
if (envImportance) {
|
|
206383
|
+
const parsed = parseInt(envImportance, 10);
|
|
206384
|
+
if (!Number.isNaN(parsed) && parsed >= 1 && parsed <= 10) {
|
|
206385
|
+
merged.default_importance = parsed;
|
|
206386
|
+
}
|
|
206387
|
+
}
|
|
206388
|
+
return merged;
|
|
206389
|
+
}
|
|
206390
|
+
|
|
206391
|
+
class MemoryInjector {
|
|
206392
|
+
config;
|
|
206393
|
+
injectedIds = new Set;
|
|
206394
|
+
constructor(config2) {
|
|
206395
|
+
this.config = config2 || loadConfig5();
|
|
206396
|
+
}
|
|
206397
|
+
getInjectionContext(options2 = {}) {
|
|
206398
|
+
const maxTokens = options2.max_tokens || this.config.injection.max_tokens;
|
|
206399
|
+
const minImportance = options2.min_importance || this.config.injection.min_importance;
|
|
206400
|
+
const categories = options2.categories || this.config.injection.categories;
|
|
206401
|
+
const db = options2.db;
|
|
206402
|
+
const allMemories = [];
|
|
206403
|
+
const globalMems = listMemories({
|
|
206404
|
+
scope: "global",
|
|
206405
|
+
category: categories,
|
|
206406
|
+
min_importance: minImportance,
|
|
206407
|
+
status: "active",
|
|
206408
|
+
limit: 100
|
|
206409
|
+
}, db);
|
|
206410
|
+
allMemories.push(...globalMems);
|
|
206411
|
+
if (options2.project_id) {
|
|
206412
|
+
const sharedMems = listMemories({
|
|
206413
|
+
scope: "shared",
|
|
206414
|
+
category: categories,
|
|
206415
|
+
min_importance: minImportance,
|
|
206416
|
+
status: "active",
|
|
206417
|
+
project_id: options2.project_id,
|
|
206418
|
+
limit: 100
|
|
206419
|
+
}, db);
|
|
206420
|
+
allMemories.push(...sharedMems);
|
|
206421
|
+
}
|
|
206422
|
+
if (options2.agent_id) {
|
|
206423
|
+
const privateMems = listMemories({
|
|
206424
|
+
scope: "private",
|
|
206425
|
+
category: categories,
|
|
206426
|
+
min_importance: minImportance,
|
|
206427
|
+
status: "active",
|
|
206428
|
+
agent_id: options2.agent_id,
|
|
206429
|
+
limit: 100
|
|
206430
|
+
}, db);
|
|
206431
|
+
allMemories.push(...privateMems);
|
|
206432
|
+
}
|
|
206433
|
+
const seen = new Set;
|
|
206434
|
+
const unique = allMemories.filter((m5) => {
|
|
206435
|
+
if (seen.has(m5.id))
|
|
206436
|
+
return false;
|
|
206437
|
+
seen.add(m5.id);
|
|
206438
|
+
return true;
|
|
206439
|
+
});
|
|
206440
|
+
if (unique.length === 0) {
|
|
206441
|
+
return "";
|
|
206442
|
+
}
|
|
206443
|
+
const totalCharBudget = maxTokens * 4;
|
|
206444
|
+
const footer = "Tip: Use memory_search for deeper lookup on specific topics.";
|
|
206445
|
+
const footerChars = footer.length;
|
|
206446
|
+
const keyBudget = Math.floor((totalCharBudget - footerChars) * 0.67);
|
|
206447
|
+
const recentBudget = Math.floor((totalCharBudget - footerChars) * 0.33);
|
|
206448
|
+
const keyRanked = [...unique].sort((a5, b5) => {
|
|
206449
|
+
if (a5.pinned !== b5.pinned)
|
|
206450
|
+
return a5.pinned ? -1 : 1;
|
|
206451
|
+
if (b5.importance !== a5.importance)
|
|
206452
|
+
return b5.importance - a5.importance;
|
|
206453
|
+
return new Date(b5.updated_at).getTime() - new Date(a5.updated_at).getTime();
|
|
206454
|
+
});
|
|
206455
|
+
const keyLines = [];
|
|
206456
|
+
const keyIds = new Set;
|
|
206457
|
+
let keyChars = 0;
|
|
206458
|
+
for (const m5 of keyRanked) {
|
|
206459
|
+
if (this.injectedIds.has(m5.id))
|
|
206460
|
+
continue;
|
|
206461
|
+
const line = `- [${m5.scope}/${m5.category}] ${m5.key}: ${m5.value}`;
|
|
206462
|
+
if (keyChars + line.length > keyBudget)
|
|
206463
|
+
break;
|
|
206464
|
+
keyLines.push(line);
|
|
206465
|
+
keyIds.add(m5.id);
|
|
206466
|
+
keyChars += line.length;
|
|
206467
|
+
}
|
|
206468
|
+
const recentRanked = [...unique].sort((a5, b5) => {
|
|
206469
|
+
const aTime = a5.accessed_at ? new Date(a5.accessed_at).getTime() : 0;
|
|
206470
|
+
const bTime = b5.accessed_at ? new Date(b5.accessed_at).getTime() : 0;
|
|
206471
|
+
return bTime - aTime;
|
|
206472
|
+
});
|
|
206473
|
+
const recentLines = [];
|
|
206474
|
+
let recentChars = 0;
|
|
206475
|
+
const maxRecent = 5;
|
|
206476
|
+
for (const m5 of recentRanked) {
|
|
206477
|
+
if (recentLines.length >= maxRecent)
|
|
206478
|
+
break;
|
|
206479
|
+
if (keyIds.has(m5.id))
|
|
206480
|
+
continue;
|
|
206481
|
+
if (this.injectedIds.has(m5.id))
|
|
206482
|
+
continue;
|
|
206483
|
+
const line = `- [${m5.scope}/${m5.category}] ${m5.key}: ${m5.value}`;
|
|
206484
|
+
if (recentChars + line.length > recentBudget)
|
|
206485
|
+
break;
|
|
206486
|
+
recentLines.push(line);
|
|
206487
|
+
recentChars += line.length;
|
|
206488
|
+
}
|
|
206489
|
+
if (keyLines.length === 0 && recentLines.length === 0) {
|
|
206490
|
+
return "";
|
|
206491
|
+
}
|
|
206492
|
+
const allInjectedMemoryIds = [
|
|
206493
|
+
...keyIds,
|
|
206494
|
+
...recentLines.map((_, i6) => {
|
|
206495
|
+
let idx = 0;
|
|
206496
|
+
for (const m5 of recentRanked) {
|
|
206497
|
+
if (keyIds.has(m5.id) || this.injectedIds.has(m5.id))
|
|
206498
|
+
continue;
|
|
206499
|
+
if (idx === i6)
|
|
206500
|
+
return m5.id;
|
|
206501
|
+
idx++;
|
|
206502
|
+
}
|
|
206503
|
+
return "";
|
|
206504
|
+
})
|
|
206505
|
+
].filter(Boolean);
|
|
206506
|
+
for (const id of allInjectedMemoryIds) {
|
|
206507
|
+
this.injectedIds.add(id);
|
|
206508
|
+
touchMemory(id, db);
|
|
206509
|
+
}
|
|
206510
|
+
const sections = [];
|
|
206511
|
+
if (keyLines.length > 0) {
|
|
206512
|
+
sections.push(`## Key Memories
|
|
206513
|
+
${keyLines.join(`
|
|
206514
|
+
`)}`);
|
|
206515
|
+
}
|
|
206516
|
+
if (recentLines.length > 0) {
|
|
206517
|
+
sections.push(`## Recent Context
|
|
206518
|
+
${recentLines.join(`
|
|
206519
|
+
`)}`);
|
|
206520
|
+
}
|
|
206521
|
+
sections.push(footer);
|
|
206522
|
+
return `<agent-memories>
|
|
206523
|
+
${sections.join(`
|
|
206524
|
+
|
|
206525
|
+
`)}
|
|
206526
|
+
</agent-memories>`;
|
|
206527
|
+
}
|
|
206528
|
+
resetDedup() {
|
|
206529
|
+
this.injectedIds.clear();
|
|
206530
|
+
}
|
|
206531
|
+
getInjectedCount() {
|
|
206532
|
+
return this.injectedIds.size;
|
|
206533
|
+
}
|
|
206534
|
+
}
|
|
206535
|
+
var MIGRATIONS2, _db2 = null, REDACTED = "[REDACTED]", SECRET_PATTERNS, DEFAULT_CONFIG2, VALID_SCOPES2, VALID_CATEGORIES2;
|
|
206536
|
+
var init_dist5 = __esm(() => {
|
|
206537
|
+
MIGRATIONS2 = [
|
|
206538
|
+
`
|
|
206539
|
+
CREATE TABLE IF NOT EXISTS projects (
|
|
206540
|
+
id TEXT PRIMARY KEY,
|
|
206541
|
+
name TEXT NOT NULL,
|
|
206542
|
+
path TEXT UNIQUE NOT NULL,
|
|
206543
|
+
description TEXT,
|
|
206544
|
+
memory_prefix TEXT,
|
|
206545
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
206546
|
+
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
206547
|
+
);
|
|
206548
|
+
|
|
206549
|
+
CREATE TABLE IF NOT EXISTS agents (
|
|
206550
|
+
id TEXT PRIMARY KEY,
|
|
206551
|
+
name TEXT NOT NULL UNIQUE,
|
|
206552
|
+
description TEXT,
|
|
206553
|
+
role TEXT DEFAULT 'agent',
|
|
206554
|
+
metadata TEXT DEFAULT '{}',
|
|
206555
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
206556
|
+
last_seen_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
206557
|
+
);
|
|
206558
|
+
|
|
206559
|
+
CREATE TABLE IF NOT EXISTS memories (
|
|
206560
|
+
id TEXT PRIMARY KEY,
|
|
206561
|
+
key TEXT NOT NULL,
|
|
206562
|
+
value TEXT NOT NULL,
|
|
206563
|
+
category TEXT NOT NULL DEFAULT 'knowledge' CHECK(category IN ('preference', 'fact', 'knowledge', 'history')),
|
|
206564
|
+
scope TEXT NOT NULL DEFAULT 'private' CHECK(scope IN ('global', 'shared', 'private')),
|
|
206565
|
+
summary TEXT,
|
|
206566
|
+
tags TEXT DEFAULT '[]',
|
|
206567
|
+
importance INTEGER NOT NULL DEFAULT 5 CHECK(importance >= 1 AND importance <= 10),
|
|
206568
|
+
source TEXT NOT NULL DEFAULT 'agent' CHECK(source IN ('user', 'agent', 'system', 'auto', 'imported')),
|
|
206569
|
+
status TEXT NOT NULL DEFAULT 'active' CHECK(status IN ('active', 'archived', 'expired')),
|
|
206570
|
+
pinned INTEGER NOT NULL DEFAULT 0,
|
|
206571
|
+
agent_id TEXT REFERENCES agents(id) ON DELETE SET NULL,
|
|
206572
|
+
project_id TEXT REFERENCES projects(id) ON DELETE SET NULL,
|
|
206573
|
+
session_id TEXT,
|
|
206574
|
+
metadata TEXT DEFAULT '{}',
|
|
206575
|
+
access_count INTEGER NOT NULL DEFAULT 0,
|
|
206576
|
+
version INTEGER NOT NULL DEFAULT 1,
|
|
206577
|
+
expires_at TEXT,
|
|
206578
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
206579
|
+
updated_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
206580
|
+
accessed_at TEXT
|
|
206581
|
+
);
|
|
206582
|
+
|
|
206583
|
+
CREATE TABLE IF NOT EXISTS memory_tags (
|
|
206584
|
+
memory_id TEXT NOT NULL REFERENCES memories(id) ON DELETE CASCADE,
|
|
206585
|
+
tag TEXT NOT NULL,
|
|
206586
|
+
PRIMARY KEY (memory_id, tag)
|
|
206587
|
+
);
|
|
206588
|
+
|
|
206589
|
+
CREATE TABLE IF NOT EXISTS sessions (
|
|
206590
|
+
id TEXT PRIMARY KEY,
|
|
206591
|
+
agent_id TEXT REFERENCES agents(id) ON DELETE SET NULL,
|
|
206592
|
+
project_id TEXT REFERENCES projects(id) ON DELETE SET NULL,
|
|
206593
|
+
started_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
206594
|
+
last_activity TEXT NOT NULL DEFAULT (datetime('now')),
|
|
206595
|
+
metadata TEXT DEFAULT '{}'
|
|
206596
|
+
);
|
|
206597
|
+
|
|
206598
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_memories_unique_key
|
|
206599
|
+
ON memories(key, scope, COALESCE(agent_id, ''), COALESCE(project_id, ''), COALESCE(session_id, ''));
|
|
206600
|
+
|
|
206601
|
+
CREATE INDEX IF NOT EXISTS idx_memories_key ON memories(key);
|
|
206602
|
+
CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope);
|
|
206603
|
+
CREATE INDEX IF NOT EXISTS idx_memories_category ON memories(category);
|
|
206604
|
+
CREATE INDEX IF NOT EXISTS idx_memories_status ON memories(status);
|
|
206605
|
+
CREATE INDEX IF NOT EXISTS idx_memories_importance ON memories(importance);
|
|
206606
|
+
CREATE INDEX IF NOT EXISTS idx_memories_agent ON memories(agent_id);
|
|
206607
|
+
CREATE INDEX IF NOT EXISTS idx_memories_project ON memories(project_id);
|
|
206608
|
+
CREATE INDEX IF NOT EXISTS idx_memories_session ON memories(session_id);
|
|
206609
|
+
CREATE INDEX IF NOT EXISTS idx_memories_pinned ON memories(pinned);
|
|
206610
|
+
CREATE INDEX IF NOT EXISTS idx_memories_expires ON memories(expires_at);
|
|
206611
|
+
CREATE INDEX IF NOT EXISTS idx_memories_created ON memories(created_at);
|
|
206612
|
+
CREATE INDEX IF NOT EXISTS idx_memory_tags_tag ON memory_tags(tag);
|
|
206613
|
+
CREATE INDEX IF NOT EXISTS idx_memory_tags_memory ON memory_tags(memory_id);
|
|
206614
|
+
CREATE INDEX IF NOT EXISTS idx_agents_name ON agents(name);
|
|
206615
|
+
CREATE INDEX IF NOT EXISTS idx_sessions_agent ON sessions(agent_id);
|
|
206616
|
+
CREATE INDEX IF NOT EXISTS idx_sessions_project ON sessions(project_id);
|
|
206617
|
+
|
|
206618
|
+
CREATE TABLE IF NOT EXISTS _migrations (
|
|
206619
|
+
id INTEGER PRIMARY KEY,
|
|
206620
|
+
applied_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
206621
|
+
);
|
|
206622
|
+
|
|
206623
|
+
INSERT OR IGNORE INTO _migrations (id) VALUES (1);
|
|
206624
|
+
`
|
|
206625
|
+
];
|
|
206626
|
+
SECRET_PATTERNS = [
|
|
206627
|
+
{ name: "openai_key", pattern: /sk-[a-zA-Z0-9_-]{20,}/g },
|
|
206628
|
+
{ name: "anthropic_key", pattern: /sk-ant-[a-zA-Z0-9_-]{20,}/g },
|
|
206629
|
+
{ name: "generic_key", pattern: /(?:pk|tok|key|token|api[_-]?key)[_-][a-zA-Z0-9_-]{16,}/gi },
|
|
206630
|
+
{ name: "aws_key", pattern: /AKIA[A-Z0-9]{16}/g },
|
|
206631
|
+
{ name: "aws_secret", pattern: /(?<=AWS_SECRET_ACCESS_KEY\s*=\s*)[A-Za-z0-9/+=]{40}/g },
|
|
206632
|
+
{ name: "github_token", pattern: /gh[ps]_[a-zA-Z0-9]{36,}/g },
|
|
206633
|
+
{ name: "github_oauth", pattern: /gho_[a-zA-Z0-9]{36,}/g },
|
|
206634
|
+
{ name: "npm_token", pattern: /npm_[a-zA-Z0-9]{36,}/g },
|
|
206635
|
+
{ name: "bearer", pattern: /Bearer\s+[a-zA-Z0-9_\-.]{20,}/g },
|
|
206636
|
+
{ name: "conn_string", pattern: /(?:postgres|postgresql|mysql|mongodb|redis|amqp|mqtt):\/\/[^\s"'`]+@[^\s"'`]+/gi },
|
|
206637
|
+
{ name: "env_secret", pattern: /(?:SECRET|TOKEN|PASSWORD|PASSPHRASE|API_KEY|PRIVATE_KEY|AUTH|CREDENTIAL)[_A-Z]*\s*=\s*["']?[^\s"'\n]{8,}["']?/gi },
|
|
206638
|
+
{ name: "stripe_key", pattern: /(?:sk|pk|rk)_(?:test|live)_[a-zA-Z0-9]{20,}/g },
|
|
206639
|
+
{ name: "slack_token", pattern: /xox[bpras]-[a-zA-Z0-9-]{20,}/g },
|
|
206640
|
+
{ name: "jwt", pattern: /eyJ[a-zA-Z0-9_-]{10,}\.eyJ[a-zA-Z0-9_-]{10,}\.[a-zA-Z0-9_-]{10,}/g },
|
|
206641
|
+
{ name: "hex_secret", pattern: /(?<=(?:key|token|secret|password|hash)\s*[:=]\s*["']?)[0-9a-f]{32,}(?=["']?)/gi }
|
|
206642
|
+
];
|
|
206643
|
+
DEFAULT_CONFIG2 = {
|
|
206644
|
+
default_scope: "private",
|
|
206645
|
+
default_category: "knowledge",
|
|
206646
|
+
default_importance: 5,
|
|
206647
|
+
max_entries: 1000,
|
|
206648
|
+
max_entries_per_scope: {
|
|
206649
|
+
global: 500,
|
|
206650
|
+
shared: 300,
|
|
206651
|
+
private: 200
|
|
206652
|
+
},
|
|
206653
|
+
injection: {
|
|
206654
|
+
max_tokens: 500,
|
|
206655
|
+
min_importance: 5,
|
|
206656
|
+
categories: ["preference", "fact"],
|
|
206657
|
+
refresh_interval: 5
|
|
206658
|
+
},
|
|
206659
|
+
sync_agents: ["claude", "codex", "gemini"],
|
|
206660
|
+
auto_cleanup: {
|
|
206661
|
+
enabled: true,
|
|
206662
|
+
expired_check_interval: 3600,
|
|
206663
|
+
unused_archive_days: 7,
|
|
206664
|
+
stale_deprioritize_days: 14
|
|
206665
|
+
}
|
|
206666
|
+
};
|
|
206667
|
+
VALID_SCOPES2 = ["global", "shared", "private"];
|
|
206668
|
+
VALID_CATEGORIES2 = [
|
|
206669
|
+
"preference",
|
|
206670
|
+
"fact",
|
|
206671
|
+
"knowledge",
|
|
206672
|
+
"history"
|
|
206673
|
+
];
|
|
206674
|
+
});
|
|
206675
|
+
|
|
206676
|
+
// packages/core/src/memory/mementos-adapter.ts
|
|
206007
206677
|
class MemoryStore {
|
|
206008
|
-
|
|
206009
|
-
|
|
206010
|
-
|
|
206011
|
-
|
|
206012
|
-
this.
|
|
206678
|
+
agentId;
|
|
206679
|
+
projectId;
|
|
206680
|
+
scope;
|
|
206681
|
+
constructor(_db3, assistantId, options2) {
|
|
206682
|
+
this.agentId = assistantId || null;
|
|
206683
|
+
this.projectId = options2?.projectId || null;
|
|
206684
|
+
this.scope = options2?.scope || "shared";
|
|
206685
|
+
getDatabase3();
|
|
206013
206686
|
}
|
|
206014
206687
|
set(key, value2, ttlMs) {
|
|
206015
|
-
const
|
|
206016
|
-
|
|
206017
|
-
|
|
206018
|
-
|
|
206019
|
-
|
|
206020
|
-
|
|
206021
|
-
this.
|
|
206022
|
-
|
|
206023
|
-
}
|
|
206688
|
+
const input = {
|
|
206689
|
+
key,
|
|
206690
|
+
value: typeof value2 === "string" ? value2 : JSON.stringify(value2),
|
|
206691
|
+
scope: this.scope,
|
|
206692
|
+
category: "knowledge",
|
|
206693
|
+
source: "agent",
|
|
206694
|
+
...this.agentId ? { agent_id: this.agentId } : {},
|
|
206695
|
+
...this.projectId ? { project_id: this.projectId } : {}
|
|
206696
|
+
};
|
|
206697
|
+
if (typeof ttlMs === "number" && ttlMs > 0) {
|
|
206698
|
+
input.ttl_ms = ttlMs;
|
|
206699
|
+
}
|
|
206700
|
+
createMemory(input, "merge");
|
|
206024
206701
|
}
|
|
206025
206702
|
get(key) {
|
|
206026
|
-
const
|
|
206027
|
-
if (!
|
|
206703
|
+
const memory = getMemoryByKey(key, this.scope, this.agentId || undefined, this.projectId || undefined);
|
|
206704
|
+
if (!memory)
|
|
206028
206705
|
return null;
|
|
206029
|
-
if (
|
|
206030
|
-
|
|
206706
|
+
if (memory.expires_at && new Date(memory.expires_at) < new Date) {
|
|
206707
|
+
deleteMemory(memory.id);
|
|
206031
206708
|
return null;
|
|
206032
206709
|
}
|
|
206033
206710
|
try {
|
|
206034
|
-
return JSON.parse(
|
|
206711
|
+
return JSON.parse(memory.value);
|
|
206035
206712
|
} catch {
|
|
206036
|
-
return
|
|
206713
|
+
return memory.value;
|
|
206037
206714
|
}
|
|
206038
206715
|
}
|
|
206039
206716
|
delete(key) {
|
|
206040
|
-
|
|
206717
|
+
const memory = getMemoryByKey(key, this.scope, this.agentId || undefined, this.projectId || undefined);
|
|
206718
|
+
if (memory) {
|
|
206719
|
+
deleteMemory(memory.id);
|
|
206720
|
+
}
|
|
206041
206721
|
}
|
|
206042
206722
|
has(key) {
|
|
206043
206723
|
return this.get(key) !== null;
|
|
206044
206724
|
}
|
|
206045
206725
|
keys(pattern) {
|
|
206726
|
+
const filter = {
|
|
206727
|
+
scope: this.scope,
|
|
206728
|
+
...this.agentId ? { agent_id: this.agentId } : {},
|
|
206729
|
+
...this.projectId ? { project_id: this.projectId } : {}
|
|
206730
|
+
};
|
|
206046
206731
|
if (pattern) {
|
|
206047
|
-
|
|
206048
|
-
return rows2.map((r5) => r5.key);
|
|
206732
|
+
filter.search = pattern.replace(/\*/g, "");
|
|
206049
206733
|
}
|
|
206050
|
-
const
|
|
206051
|
-
|
|
206734
|
+
const memories = listMemories(filter);
|
|
206735
|
+
if (pattern) {
|
|
206736
|
+
const regex = new RegExp("^" + pattern.replace(/\*/g, ".*").replace(/\?/g, ".") + "$");
|
|
206737
|
+
return memories.filter((m5) => regex.test(m5.key)).map((m5) => m5.key);
|
|
206738
|
+
}
|
|
206739
|
+
return memories.map((m5) => m5.key);
|
|
206052
206740
|
}
|
|
206053
206741
|
clearExpired() {
|
|
206054
|
-
|
|
206055
|
-
return result.changes;
|
|
206742
|
+
return cleanExpiredMemories();
|
|
206056
206743
|
}
|
|
206057
206744
|
close() {}
|
|
206058
206745
|
}
|
|
206059
|
-
var
|
|
206060
|
-
|
|
206746
|
+
var init_mementos_adapter = __esm(() => {
|
|
206747
|
+
init_dist5();
|
|
206061
206748
|
});
|
|
206062
206749
|
|
|
206063
206750
|
// packages/core/src/memory/global-memory.ts
|
|
@@ -206134,7 +206821,7 @@ class GlobalMemoryManager {
|
|
|
206134
206821
|
if (options2.summary && options2.summary.length > MAX_SUMMARY_LENGTH2) {
|
|
206135
206822
|
throw new Error(`Memory summary exceeds maximum length of ${MAX_SUMMARY_LENGTH2} characters`);
|
|
206136
206823
|
}
|
|
206137
|
-
const
|
|
206824
|
+
const now4 = new Date().toISOString();
|
|
206138
206825
|
const scope = options2.scope || this.defaultScope;
|
|
206139
206826
|
if (!this.isScopeEnabled(scope)) {
|
|
206140
206827
|
throw new Error(`Memory scope '${scope}' is disabled in configuration`);
|
|
@@ -206186,8 +206873,8 @@ class GlobalMemoryManager {
|
|
|
206186
206873
|
importance: options2.importance ?? 5,
|
|
206187
206874
|
tags: options2.tags || [],
|
|
206188
206875
|
source: options2.source || "assistant",
|
|
206189
|
-
createdAt:
|
|
206190
|
-
updatedAt:
|
|
206876
|
+
createdAt: now4,
|
|
206877
|
+
updatedAt: now4,
|
|
206191
206878
|
accessCount: 0,
|
|
206192
206879
|
expiresAt
|
|
206193
206880
|
};
|
|
@@ -206227,11 +206914,11 @@ class GlobalMemoryManager {
|
|
|
206227
206914
|
if (!existing) {
|
|
206228
206915
|
throw new Error(`Memory not found: ${id}`);
|
|
206229
206916
|
}
|
|
206230
|
-
const
|
|
206917
|
+
const now4 = new Date().toISOString();
|
|
206231
206918
|
const updated = {
|
|
206232
206919
|
...existing,
|
|
206233
206920
|
...updates,
|
|
206234
|
-
updatedAt:
|
|
206921
|
+
updatedAt: now4
|
|
206235
206922
|
};
|
|
206236
206923
|
this.db.prepare(`
|
|
206237
206924
|
UPDATE memories SET
|
|
@@ -206610,10 +207297,10 @@ class GlobalMemoryManager {
|
|
|
206610
207297
|
}
|
|
206611
207298
|
}
|
|
206612
207299
|
recordAccess(id) {
|
|
206613
|
-
const
|
|
207300
|
+
const now4 = new Date().toISOString();
|
|
206614
207301
|
this.db.prepare(`
|
|
206615
207302
|
UPDATE memories SET accessed_at = ?, access_count = access_count + 1 WHERE id = ?
|
|
206616
|
-
`).run(
|
|
207303
|
+
`).run(now4, id);
|
|
206617
207304
|
}
|
|
206618
207305
|
logAccess(memoryId, action) {
|
|
206619
207306
|
this.db.prepare(`
|
|
@@ -206633,7 +207320,7 @@ var init_global_memory = __esm(async () => {
|
|
|
206633
207320
|
});
|
|
206634
207321
|
|
|
206635
207322
|
// packages/core/src/memory/injector.ts
|
|
206636
|
-
class
|
|
207323
|
+
class MemoryInjector2 {
|
|
206637
207324
|
memoryManager;
|
|
206638
207325
|
config;
|
|
206639
207326
|
lastInjectedIds = new Set;
|
|
@@ -206826,11 +207513,9 @@ var init_injector = __esm(() => {
|
|
|
206826
207513
|
|
|
206827
207514
|
// packages/core/src/memory/index.ts
|
|
206828
207515
|
var init_memory3 = __esm(async () => {
|
|
207516
|
+
init_mementos_adapter();
|
|
206829
207517
|
init_injector();
|
|
206830
|
-
await
|
|
206831
|
-
init_store13(),
|
|
206832
|
-
init_global_memory()
|
|
206833
|
-
]);
|
|
207518
|
+
await init_global_memory();
|
|
206834
207519
|
init_types11();
|
|
206835
207520
|
});
|
|
206836
207521
|
|
|
@@ -207086,11 +207771,11 @@ ${hookResult.additionalContext}` : hookResult.additionalContext
|
|
|
207086
207771
|
return Array.from(this.asyncJobs.values());
|
|
207087
207772
|
}
|
|
207088
207773
|
cleanupJobs(maxAgeMs = 3600000) {
|
|
207089
|
-
const
|
|
207774
|
+
const now4 = Date.now();
|
|
207090
207775
|
let cleaned = 0;
|
|
207091
207776
|
for (const [id, job] of this.asyncJobs) {
|
|
207092
207777
|
if (job.status !== "running" && job.completedAt) {
|
|
207093
|
-
if (
|
|
207778
|
+
if (now4 - job.completedAt > maxAgeMs) {
|
|
207094
207779
|
this.asyncJobs.delete(id);
|
|
207095
207780
|
cleaned++;
|
|
207096
207781
|
}
|
|
@@ -207159,12 +207844,12 @@ ${hookResult.additionalContext}` : hookResult.additionalContext
|
|
|
207159
207844
|
return resultWithId;
|
|
207160
207845
|
}
|
|
207161
207846
|
createTimeout(ms, runner, subassistantId) {
|
|
207162
|
-
return new Promise((
|
|
207847
|
+
return new Promise((resolve11) => {
|
|
207163
207848
|
const timerId = setTimeout(() => {
|
|
207164
207849
|
this.activeTimeouts.delete(subassistantId);
|
|
207165
207850
|
this.activeRunners.delete(subassistantId);
|
|
207166
207851
|
runner.stop();
|
|
207167
|
-
|
|
207852
|
+
resolve11({
|
|
207168
207853
|
success: false,
|
|
207169
207854
|
error: `Subassistant timed out after ${Math.round(ms / 1000)} seconds`,
|
|
207170
207855
|
turns: 0,
|
|
@@ -207183,7 +207868,7 @@ ${hookResult.additionalContext}` : hookResult.additionalContext
|
|
|
207183
207868
|
}
|
|
207184
207869
|
}
|
|
207185
207870
|
sleep(ms) {
|
|
207186
|
-
return new Promise((
|
|
207871
|
+
return new Promise((resolve11) => setTimeout(resolve11, ms));
|
|
207187
207872
|
}
|
|
207188
207873
|
}
|
|
207189
207874
|
var DEFAULT_MAX_DEPTH = 3, DEFAULT_MAX_CONCURRENT = 5, DEFAULT_MAX_TURNS = 10, MAX_ALLOWED_TURNS = 25, DEFAULT_TIMEOUT_MS3 = 120000, DEFAULT_SUBASSISTANT_TOOLS, FORBIDDEN_SUBASSISTANT_TOOLS;
|
|
@@ -208004,12 +208689,12 @@ __export(exports_dist2, {
|
|
|
208004
208689
|
CATEGORIES: () => CATEGORIES,
|
|
208005
208690
|
AGENT_TARGETS: () => AGENT_TARGETS
|
|
208006
208691
|
});
|
|
208007
|
-
import { existsSync as
|
|
208008
|
-
import { join as
|
|
208009
|
-
import { homedir as
|
|
208692
|
+
import { existsSync as existsSync29, cpSync, mkdirSync as mkdirSync15, writeFileSync as writeFileSync10, rmSync as rmSync3, readdirSync as readdirSync12, statSync as statSync7, readFileSync as readFileSync14 } from "fs";
|
|
208693
|
+
import { join as join41, dirname as dirname16 } from "path";
|
|
208694
|
+
import { homedir as homedir24 } from "os";
|
|
208010
208695
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
208011
|
-
import { existsSync as
|
|
208012
|
-
import { join as
|
|
208696
|
+
import { existsSync as existsSync210, readFileSync as readFileSync22, readdirSync as readdirSync22 } from "fs";
|
|
208697
|
+
import { join as join213 } from "path";
|
|
208013
208698
|
function getSkillsByCategory(category) {
|
|
208014
208699
|
return SKILLS.filter((s5) => s5.category === category);
|
|
208015
208700
|
}
|
|
@@ -208114,35 +208799,35 @@ function normalizeSkillName(name) {
|
|
|
208114
208799
|
function findSkillsDir() {
|
|
208115
208800
|
let dir = __dirname2;
|
|
208116
208801
|
for (let i6 = 0;i6 < 5; i6++) {
|
|
208117
|
-
const candidate =
|
|
208118
|
-
if (
|
|
208802
|
+
const candidate = join41(dir, "skills");
|
|
208803
|
+
if (existsSync29(candidate)) {
|
|
208119
208804
|
return candidate;
|
|
208120
208805
|
}
|
|
208121
|
-
dir =
|
|
208806
|
+
dir = dirname16(dir);
|
|
208122
208807
|
}
|
|
208123
|
-
return
|
|
208808
|
+
return join41(__dirname2, "..", "skills");
|
|
208124
208809
|
}
|
|
208125
208810
|
function getSkillPath(name) {
|
|
208126
208811
|
const skillName = normalizeSkillName(name);
|
|
208127
|
-
return
|
|
208812
|
+
return join41(SKILLS_DIR, skillName);
|
|
208128
208813
|
}
|
|
208129
208814
|
function skillExists(name) {
|
|
208130
|
-
return
|
|
208815
|
+
return existsSync29(getSkillPath(name));
|
|
208131
208816
|
}
|
|
208132
208817
|
function installSkill(name, options2 = {}) {
|
|
208133
208818
|
const { targetDir = process.cwd(), overwrite = false } = options2;
|
|
208134
208819
|
const skillName = normalizeSkillName(name);
|
|
208135
208820
|
const sourcePath = getSkillPath(name);
|
|
208136
|
-
const destDir =
|
|
208137
|
-
const destPath =
|
|
208138
|
-
if (!
|
|
208821
|
+
const destDir = join41(targetDir, ".skills");
|
|
208822
|
+
const destPath = join41(destDir, skillName);
|
|
208823
|
+
if (!existsSync29(sourcePath)) {
|
|
208139
208824
|
return {
|
|
208140
208825
|
skill: name,
|
|
208141
208826
|
success: false,
|
|
208142
208827
|
error: `Skill '${name}' not found`
|
|
208143
208828
|
};
|
|
208144
208829
|
}
|
|
208145
|
-
if (
|
|
208830
|
+
if (existsSync29(destPath) && !overwrite) {
|
|
208146
208831
|
return {
|
|
208147
208832
|
skill: name,
|
|
208148
208833
|
success: false,
|
|
@@ -208151,10 +208836,10 @@ function installSkill(name, options2 = {}) {
|
|
|
208151
208836
|
};
|
|
208152
208837
|
}
|
|
208153
208838
|
try {
|
|
208154
|
-
if (!
|
|
208155
|
-
|
|
208839
|
+
if (!existsSync29(destDir)) {
|
|
208840
|
+
mkdirSync15(destDir, { recursive: true });
|
|
208156
208841
|
}
|
|
208157
|
-
if (
|
|
208842
|
+
if (existsSync29(destPath) && overwrite) {
|
|
208158
208843
|
rmSync3(destPath, { recursive: true, force: true });
|
|
208159
208844
|
}
|
|
208160
208845
|
cpSync(sourcePath, destPath, {
|
|
@@ -208192,7 +208877,7 @@ function installSkills(names, options2 = {}) {
|
|
|
208192
208877
|
return names.map((name) => installSkill(name, options2));
|
|
208193
208878
|
}
|
|
208194
208879
|
function updateSkillsIndex(skillsDir) {
|
|
208195
|
-
const indexPath =
|
|
208880
|
+
const indexPath = join41(skillsDir, "index.ts");
|
|
208196
208881
|
const skills = readdirSync12(skillsDir).filter((f5) => f5.startsWith("skill-") && !f5.includes("."));
|
|
208197
208882
|
const exports = skills.map((s5) => {
|
|
208198
208883
|
const name = s5.replace("skill-", "").replace(/-/g, "_");
|
|
@@ -208209,20 +208894,20 @@ ${exports}
|
|
|
208209
208894
|
writeFileSync10(indexPath, content3);
|
|
208210
208895
|
}
|
|
208211
208896
|
function getInstalledSkills(targetDir = process.cwd()) {
|
|
208212
|
-
const skillsDir =
|
|
208213
|
-
if (!
|
|
208897
|
+
const skillsDir = join41(targetDir, ".skills");
|
|
208898
|
+
if (!existsSync29(skillsDir)) {
|
|
208214
208899
|
return [];
|
|
208215
208900
|
}
|
|
208216
208901
|
return readdirSync12(skillsDir).filter((f5) => {
|
|
208217
|
-
const fullPath =
|
|
208902
|
+
const fullPath = join41(skillsDir, f5);
|
|
208218
208903
|
return f5.startsWith("skill-") && statSync7(fullPath).isDirectory();
|
|
208219
208904
|
}).map((f5) => f5.replace("skill-", ""));
|
|
208220
208905
|
}
|
|
208221
208906
|
function removeSkill(name, targetDir = process.cwd()) {
|
|
208222
208907
|
const skillName = normalizeSkillName(name);
|
|
208223
|
-
const skillsDir =
|
|
208224
|
-
const skillPath =
|
|
208225
|
-
if (!
|
|
208908
|
+
const skillsDir = join41(targetDir, ".skills");
|
|
208909
|
+
const skillPath = join41(skillsDir, skillName);
|
|
208910
|
+
if (!existsSync29(skillPath)) {
|
|
208226
208911
|
return false;
|
|
208227
208912
|
}
|
|
208228
208913
|
rmSync3(skillPath, { recursive: true, force: true });
|
|
@@ -208232,25 +208917,25 @@ function removeSkill(name, targetDir = process.cwd()) {
|
|
|
208232
208917
|
function getAgentSkillsDir(agent, scope = "global", projectDir) {
|
|
208233
208918
|
const agentDir = `.${agent}`;
|
|
208234
208919
|
if (scope === "project") {
|
|
208235
|
-
return
|
|
208920
|
+
return join41(projectDir || process.cwd(), agentDir, "skills");
|
|
208236
208921
|
}
|
|
208237
|
-
return
|
|
208922
|
+
return join41(homedir24(), agentDir, "skills");
|
|
208238
208923
|
}
|
|
208239
208924
|
function getAgentSkillPath(name, agent, scope = "global", projectDir) {
|
|
208240
208925
|
const skillName = normalizeSkillName(name);
|
|
208241
|
-
return
|
|
208926
|
+
return join41(getAgentSkillsDir(agent, scope, projectDir), skillName);
|
|
208242
208927
|
}
|
|
208243
208928
|
function installSkillForAgent(name, options2, generateSkillMd) {
|
|
208244
208929
|
const { agent, scope = "global", projectDir } = options2;
|
|
208245
208930
|
const skillName = normalizeSkillName(name);
|
|
208246
208931
|
const sourcePath = getSkillPath(name);
|
|
208247
|
-
if (!
|
|
208932
|
+
if (!existsSync29(sourcePath)) {
|
|
208248
208933
|
return { skill: name, success: false, error: `Skill '${name}' not found` };
|
|
208249
208934
|
}
|
|
208250
208935
|
let skillMdContent = null;
|
|
208251
|
-
const skillMdPath =
|
|
208252
|
-
if (
|
|
208253
|
-
skillMdContent =
|
|
208936
|
+
const skillMdPath = join41(sourcePath, "SKILL.md");
|
|
208937
|
+
if (existsSync29(skillMdPath)) {
|
|
208938
|
+
skillMdContent = readFileSync14(skillMdPath, "utf-8");
|
|
208254
208939
|
} else if (generateSkillMd) {
|
|
208255
208940
|
skillMdContent = generateSkillMd(name);
|
|
208256
208941
|
}
|
|
@@ -208259,8 +208944,8 @@ function installSkillForAgent(name, options2, generateSkillMd) {
|
|
|
208259
208944
|
}
|
|
208260
208945
|
const destDir = getAgentSkillPath(name, agent, scope, projectDir);
|
|
208261
208946
|
try {
|
|
208262
|
-
|
|
208263
|
-
writeFileSync10(
|
|
208947
|
+
mkdirSync15(destDir, { recursive: true });
|
|
208948
|
+
writeFileSync10(join41(destDir, "SKILL.md"), skillMdContent);
|
|
208264
208949
|
return { skill: name, success: true, path: destDir };
|
|
208265
208950
|
} catch (error4) {
|
|
208266
208951
|
return {
|
|
@@ -208273,7 +208958,7 @@ function installSkillForAgent(name, options2, generateSkillMd) {
|
|
|
208273
208958
|
function removeSkillForAgent(name, options2) {
|
|
208274
208959
|
const { agent, scope = "global", projectDir } = options2;
|
|
208275
208960
|
const destDir = getAgentSkillPath(name, agent, scope, projectDir);
|
|
208276
|
-
if (!
|
|
208961
|
+
if (!existsSync29(destDir)) {
|
|
208277
208962
|
return false;
|
|
208278
208963
|
}
|
|
208279
208964
|
rmSync3(destDir, { recursive: true, force: true });
|
|
@@ -208281,12 +208966,12 @@ function removeSkillForAgent(name, options2) {
|
|
|
208281
208966
|
}
|
|
208282
208967
|
function getSkillDocs(name) {
|
|
208283
208968
|
const skillPath = getSkillPath(name);
|
|
208284
|
-
if (!
|
|
208969
|
+
if (!existsSync210(skillPath))
|
|
208285
208970
|
return null;
|
|
208286
208971
|
return {
|
|
208287
|
-
skillMd: readIfExists(
|
|
208288
|
-
readme: readIfExists(
|
|
208289
|
-
claudeMd: readIfExists(
|
|
208972
|
+
skillMd: readIfExists(join213(skillPath, "SKILL.md")),
|
|
208973
|
+
readme: readIfExists(join213(skillPath, "README.md")),
|
|
208974
|
+
claudeMd: readIfExists(join213(skillPath, "CLAUDE.md"))
|
|
208290
208975
|
};
|
|
208291
208976
|
}
|
|
208292
208977
|
function getSkillBestDoc(name) {
|
|
@@ -208297,11 +208982,11 @@ function getSkillBestDoc(name) {
|
|
|
208297
208982
|
}
|
|
208298
208983
|
function getSkillRequirements(name) {
|
|
208299
208984
|
const skillPath = getSkillPath(name);
|
|
208300
|
-
if (!
|
|
208985
|
+
if (!existsSync210(skillPath))
|
|
208301
208986
|
return null;
|
|
208302
208987
|
const texts = [];
|
|
208303
208988
|
for (const file of ["SKILL.md", "README.md", "CLAUDE.md", ".env.example", ".env.local.example"]) {
|
|
208304
|
-
const content3 = readIfExists(
|
|
208989
|
+
const content3 = readIfExists(join213(skillPath, file));
|
|
208305
208990
|
if (content3)
|
|
208306
208991
|
texts.push(content3);
|
|
208307
208992
|
}
|
|
@@ -208328,8 +209013,8 @@ function getSkillRequirements(name) {
|
|
|
208328
209013
|
}
|
|
208329
209014
|
let cliCommand = null;
|
|
208330
209015
|
let dependencies = {};
|
|
208331
|
-
const pkgPath =
|
|
208332
|
-
if (
|
|
209016
|
+
const pkgPath = join213(skillPath, "package.json");
|
|
209017
|
+
if (existsSync210(pkgPath)) {
|
|
208333
209018
|
try {
|
|
208334
209019
|
const pkg = JSON.parse(readFileSync22(pkgPath, "utf-8"));
|
|
208335
209020
|
if (pkg.bin) {
|
|
@@ -208351,20 +209036,20 @@ async function runSkill(name, args, options2 = {}) {
|
|
|
208351
209036
|
const skillName = normalizeSkillName(name);
|
|
208352
209037
|
let skillPath;
|
|
208353
209038
|
if (options2.installed) {
|
|
208354
|
-
skillPath =
|
|
209039
|
+
skillPath = join213(process.cwd(), ".skills", skillName);
|
|
208355
209040
|
} else {
|
|
208356
|
-
const installedPath =
|
|
208357
|
-
if (
|
|
209041
|
+
const installedPath = join213(process.cwd(), ".skills", skillName);
|
|
209042
|
+
if (existsSync210(installedPath)) {
|
|
208358
209043
|
skillPath = installedPath;
|
|
208359
209044
|
} else {
|
|
208360
209045
|
skillPath = getSkillPath(name);
|
|
208361
209046
|
}
|
|
208362
209047
|
}
|
|
208363
|
-
if (!
|
|
209048
|
+
if (!existsSync210(skillPath)) {
|
|
208364
209049
|
return { exitCode: 1, error: `Skill '${name}' not found` };
|
|
208365
209050
|
}
|
|
208366
|
-
const pkgPath =
|
|
208367
|
-
if (!
|
|
209051
|
+
const pkgPath = join213(skillPath, "package.json");
|
|
209052
|
+
if (!existsSync210(pkgPath)) {
|
|
208368
209053
|
return { exitCode: 1, error: `No package.json in skill '${name}'` };
|
|
208369
209054
|
}
|
|
208370
209055
|
let entryPoint;
|
|
@@ -208383,12 +209068,12 @@ async function runSkill(name, args, options2 = {}) {
|
|
|
208383
209068
|
} catch {
|
|
208384
209069
|
return { exitCode: 1, error: `Failed to parse package.json for skill '${name}'` };
|
|
208385
209070
|
}
|
|
208386
|
-
const entryPath =
|
|
208387
|
-
if (!
|
|
209071
|
+
const entryPath = join213(skillPath, entryPoint);
|
|
209072
|
+
if (!existsSync210(entryPath)) {
|
|
208388
209073
|
return { exitCode: 1, error: `Entry point '${entryPoint}' not found in skill '${name}'` };
|
|
208389
209074
|
}
|
|
208390
|
-
const nodeModules =
|
|
208391
|
-
if (!
|
|
209075
|
+
const nodeModules = join213(skillPath, "node_modules");
|
|
209076
|
+
if (!existsSync210(nodeModules)) {
|
|
208392
209077
|
const install2 = Bun.spawn(["bun", "install", "--no-save"], {
|
|
208393
209078
|
cwd: skillPath,
|
|
208394
209079
|
stdout: "pipe",
|
|
@@ -208406,17 +209091,17 @@ async function runSkill(name, args, options2 = {}) {
|
|
|
208406
209091
|
return { exitCode };
|
|
208407
209092
|
}
|
|
208408
209093
|
function generateEnvExample(targetDir = process.cwd()) {
|
|
208409
|
-
const skillsDir =
|
|
208410
|
-
if (!
|
|
209094
|
+
const skillsDir = join213(targetDir, ".skills");
|
|
209095
|
+
if (!existsSync210(skillsDir))
|
|
208411
209096
|
return "";
|
|
208412
|
-
const dirs = readdirSync22(skillsDir).filter((f5) => f5.startsWith("skill-") &&
|
|
209097
|
+
const dirs = readdirSync22(skillsDir).filter((f5) => f5.startsWith("skill-") && existsSync210(join213(skillsDir, f5, "package.json")));
|
|
208413
209098
|
const envMap = new Map;
|
|
208414
209099
|
for (const dir of dirs) {
|
|
208415
209100
|
const skillName = dir.replace("skill-", "");
|
|
208416
|
-
const skillPath =
|
|
209101
|
+
const skillPath = join213(skillsDir, dir);
|
|
208417
209102
|
const texts = [];
|
|
208418
209103
|
for (const file of ["SKILL.md", "README.md", "CLAUDE.md", ".env.example"]) {
|
|
208419
|
-
const content3 = readIfExists(
|
|
209104
|
+
const content3 = readIfExists(join213(skillPath, file));
|
|
208420
209105
|
if (content3)
|
|
208421
209106
|
texts.push(content3);
|
|
208422
209107
|
}
|
|
@@ -208461,7 +209146,7 @@ function generateSkillMd(name) {
|
|
|
208461
209146
|
if (!meta)
|
|
208462
209147
|
return null;
|
|
208463
209148
|
const skillPath = getSkillPath(name);
|
|
208464
|
-
if (!
|
|
209149
|
+
if (!existsSync210(skillPath))
|
|
208465
209150
|
return null;
|
|
208466
209151
|
const frontmatter2 = [
|
|
208467
209152
|
"---",
|
|
@@ -208470,11 +209155,11 @@ function generateSkillMd(name) {
|
|
|
208470
209155
|
"---"
|
|
208471
209156
|
].join(`
|
|
208472
209157
|
`);
|
|
208473
|
-
const readme = readIfExists(
|
|
208474
|
-
const claudeMd = readIfExists(
|
|
209158
|
+
const readme = readIfExists(join213(skillPath, "README.md"));
|
|
209159
|
+
const claudeMd = readIfExists(join213(skillPath, "CLAUDE.md"));
|
|
208475
209160
|
let cliCommand = null;
|
|
208476
|
-
const pkgPath =
|
|
208477
|
-
if (
|
|
209161
|
+
const pkgPath = join213(skillPath, "package.json");
|
|
209162
|
+
if (existsSync210(pkgPath)) {
|
|
208478
209163
|
try {
|
|
208479
209164
|
const pkg = JSON.parse(readFileSync22(pkgPath, "utf-8"));
|
|
208480
209165
|
if (pkg.bin) {
|
|
@@ -208549,14 +209234,14 @@ function extractEnvVars(text5) {
|
|
|
208549
209234
|
}
|
|
208550
209235
|
function readIfExists(path5) {
|
|
208551
209236
|
try {
|
|
208552
|
-
if (
|
|
209237
|
+
if (existsSync210(path5)) {
|
|
208553
209238
|
return readFileSync22(path5, "utf-8");
|
|
208554
209239
|
}
|
|
208555
209240
|
} catch {}
|
|
208556
209241
|
return null;
|
|
208557
209242
|
}
|
|
208558
209243
|
var CATEGORIES, SKILLS, __dirname2, SKILLS_DIR, AGENT_TARGETS, ENV_VAR_PATTERN, GENERIC_ENV_PATTERN;
|
|
208559
|
-
var
|
|
209244
|
+
var init_dist6 = __esm(() => {
|
|
208560
209245
|
CATEGORIES = [
|
|
208561
209246
|
"Development Tools",
|
|
208562
209247
|
"Business & Marketing",
|
|
@@ -209993,7 +210678,7 @@ var init_dist5 = __esm(() => {
|
|
|
209993
210678
|
tags: ["seating", "chart", "events", "venues"]
|
|
209994
210679
|
}
|
|
209995
210680
|
];
|
|
209996
|
-
__dirname2 =
|
|
210681
|
+
__dirname2 = dirname16(fileURLToPath6(import.meta.url));
|
|
209997
210682
|
SKILLS_DIR = findSkillsDir();
|
|
209998
210683
|
AGENT_TARGETS = ["claude", "codex", "gemini"];
|
|
209999
210684
|
ENV_VAR_PATTERN = /\b([A-Z][A-Z0-9_]{2,}(?:_API_KEY|_KEY|_TOKEN|_SECRET|_URL|_ID|_PASSWORD|_ENDPOINT|_REGION|_BUCKET))\b/g;
|
|
@@ -210003,7 +210688,7 @@ var init_dist5 = __esm(() => {
|
|
|
210003
210688
|
// packages/core/src/skills/registry-adapter.ts
|
|
210004
210689
|
async function getSkillsLib() {
|
|
210005
210690
|
if (!_skillsLib) {
|
|
210006
|
-
_skillsLib = await Promise.resolve().then(() => (
|
|
210691
|
+
_skillsLib = await Promise.resolve().then(() => (init_dist6(), exports_dist2));
|
|
210007
210692
|
}
|
|
210008
210693
|
return _skillsLib;
|
|
210009
210694
|
}
|
|
@@ -210165,11 +210850,11 @@ __export(exports_dist3, {
|
|
|
210165
210850
|
CONNECTORS: () => CONNECTORS,
|
|
210166
210851
|
CATEGORIES: () => CATEGORIES2
|
|
210167
210852
|
});
|
|
210168
|
-
import { existsSync as
|
|
210169
|
-
import { join as
|
|
210853
|
+
import { existsSync as existsSync31, readFileSync as readFileSync15 } from "fs";
|
|
210854
|
+
import { join as join43, dirname as dirname17 } from "path";
|
|
210170
210855
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
210171
|
-
import { existsSync as
|
|
210172
|
-
import { join as
|
|
210856
|
+
import { existsSync as existsSync211, cpSync as cpSync2, mkdirSync as mkdirSync16, readFileSync as readFileSync23, writeFileSync as writeFileSync11, readdirSync as readdirSync13, statSync as statSync8, rmSync as rmSync4 } from "fs";
|
|
210857
|
+
import { join as join214, dirname as dirname23 } from "path";
|
|
210173
210858
|
import { fileURLToPath as fileURLToPath22 } from "url";
|
|
210174
210859
|
function getConnectorsByCategory(category) {
|
|
210175
210860
|
return CONNECTORS.filter((c5) => c5.category === category);
|
|
@@ -210185,39 +210870,39 @@ function loadConnectorVersions() {
|
|
|
210185
210870
|
if (versionsLoaded)
|
|
210186
210871
|
return;
|
|
210187
210872
|
versionsLoaded = true;
|
|
210188
|
-
const thisDir =
|
|
210873
|
+
const thisDir = dirname17(fileURLToPath7(import.meta.url));
|
|
210189
210874
|
const candidates = [
|
|
210190
|
-
|
|
210191
|
-
|
|
210875
|
+
join43(thisDir, "..", "connectors"),
|
|
210876
|
+
join43(thisDir, "..", "..", "connectors")
|
|
210192
210877
|
];
|
|
210193
|
-
const connectorsDir = candidates.find((d5) =>
|
|
210878
|
+
const connectorsDir = candidates.find((d5) => existsSync31(d5));
|
|
210194
210879
|
if (!connectorsDir)
|
|
210195
210880
|
return;
|
|
210196
210881
|
for (const connector of CONNECTORS) {
|
|
210197
210882
|
try {
|
|
210198
|
-
const pkgPath =
|
|
210199
|
-
if (
|
|
210200
|
-
const pkg = JSON.parse(
|
|
210883
|
+
const pkgPath = join43(connectorsDir, `connect-${connector.name}`, "package.json");
|
|
210884
|
+
if (existsSync31(pkgPath)) {
|
|
210885
|
+
const pkg = JSON.parse(readFileSync15(pkgPath, "utf-8"));
|
|
210201
210886
|
connector.version = pkg.version || "0.0.0";
|
|
210202
210887
|
}
|
|
210203
210888
|
} catch {}
|
|
210204
210889
|
}
|
|
210205
210890
|
}
|
|
210206
210891
|
function resolveConnectorsDir() {
|
|
210207
|
-
const fromBin =
|
|
210208
|
-
if (
|
|
210892
|
+
const fromBin = join214(__dirname22, "..", "connectors");
|
|
210893
|
+
if (existsSync211(fromBin))
|
|
210209
210894
|
return fromBin;
|
|
210210
|
-
const fromSrc =
|
|
210211
|
-
if (
|
|
210895
|
+
const fromSrc = join214(__dirname22, "..", "..", "connectors");
|
|
210896
|
+
if (existsSync211(fromSrc))
|
|
210212
210897
|
return fromSrc;
|
|
210213
210898
|
return fromBin;
|
|
210214
210899
|
}
|
|
210215
210900
|
function getConnectorPath(name) {
|
|
210216
210901
|
const connectorName = name.startsWith("connect-") ? name : `connect-${name}`;
|
|
210217
|
-
return
|
|
210902
|
+
return join214(CONNECTORS_DIR, connectorName);
|
|
210218
210903
|
}
|
|
210219
210904
|
function connectorExists(name) {
|
|
210220
|
-
return
|
|
210905
|
+
return existsSync211(getConnectorPath(name));
|
|
210221
210906
|
}
|
|
210222
210907
|
function installConnector(name, options2 = {}) {
|
|
210223
210908
|
const { targetDir = process.cwd(), overwrite = false } = options2;
|
|
@@ -210230,16 +210915,16 @@ function installConnector(name, options2 = {}) {
|
|
|
210230
210915
|
}
|
|
210231
210916
|
const connectorName = name.startsWith("connect-") ? name : `connect-${name}`;
|
|
210232
210917
|
const sourcePath = getConnectorPath(name);
|
|
210233
|
-
const destDir =
|
|
210234
|
-
const destPath =
|
|
210235
|
-
if (!
|
|
210918
|
+
const destDir = join214(targetDir, ".connectors");
|
|
210919
|
+
const destPath = join214(destDir, connectorName);
|
|
210920
|
+
if (!existsSync211(sourcePath)) {
|
|
210236
210921
|
return {
|
|
210237
210922
|
connector: name,
|
|
210238
210923
|
success: false,
|
|
210239
210924
|
error: `Connector '${name}' not found`
|
|
210240
210925
|
};
|
|
210241
210926
|
}
|
|
210242
|
-
if (
|
|
210927
|
+
if (existsSync211(destPath) && !overwrite) {
|
|
210243
210928
|
return {
|
|
210244
210929
|
connector: name,
|
|
210245
210930
|
success: false,
|
|
@@ -210248,8 +210933,8 @@ function installConnector(name, options2 = {}) {
|
|
|
210248
210933
|
};
|
|
210249
210934
|
}
|
|
210250
210935
|
try {
|
|
210251
|
-
if (!
|
|
210252
|
-
|
|
210936
|
+
if (!existsSync211(destDir)) {
|
|
210937
|
+
mkdirSync16(destDir, { recursive: true });
|
|
210253
210938
|
}
|
|
210254
210939
|
cpSync2(sourcePath, destPath, { recursive: true });
|
|
210255
210940
|
updateConnectorsIndex(destDir);
|
|
@@ -210270,7 +210955,7 @@ function installConnectors(names, options2 = {}) {
|
|
|
210270
210955
|
return names.map((name) => installConnector(name, options2));
|
|
210271
210956
|
}
|
|
210272
210957
|
function updateConnectorsIndex(connectorsDir) {
|
|
210273
|
-
const indexPath =
|
|
210958
|
+
const indexPath = join214(connectorsDir, "index.ts");
|
|
210274
210959
|
const connectors = readdirSync13(connectorsDir).filter((f5) => f5.startsWith("connect-") && !f5.includes("."));
|
|
210275
210960
|
const exports = connectors.map((c5) => {
|
|
210276
210961
|
const name = c5.replace("connect-", "");
|
|
@@ -210287,19 +210972,19 @@ ${exports}
|
|
|
210287
210972
|
writeFileSync11(indexPath, content3);
|
|
210288
210973
|
}
|
|
210289
210974
|
function getInstalledConnectors(targetDir = process.cwd()) {
|
|
210290
|
-
const connectorsDir =
|
|
210291
|
-
if (!
|
|
210975
|
+
const connectorsDir = join214(targetDir, ".connectors");
|
|
210976
|
+
if (!existsSync211(connectorsDir)) {
|
|
210292
210977
|
return [];
|
|
210293
210978
|
}
|
|
210294
210979
|
return readdirSync13(connectorsDir).filter((f5) => {
|
|
210295
|
-
const fullPath =
|
|
210980
|
+
const fullPath = join214(connectorsDir, f5);
|
|
210296
210981
|
return f5.startsWith("connect-") && statSync8(fullPath).isDirectory();
|
|
210297
210982
|
}).map((f5) => f5.replace("connect-", ""));
|
|
210298
210983
|
}
|
|
210299
210984
|
function getConnectorDocs(name) {
|
|
210300
210985
|
const connectorPath = getConnectorPath(name);
|
|
210301
|
-
const claudeMdPath =
|
|
210302
|
-
if (!
|
|
210986
|
+
const claudeMdPath = join214(connectorPath, "CLAUDE.md");
|
|
210987
|
+
if (!existsSync211(claudeMdPath))
|
|
210303
210988
|
return null;
|
|
210304
210989
|
const raw = readFileSync23(claudeMdPath, "utf-8");
|
|
210305
210990
|
return {
|
|
@@ -210340,9 +211025,9 @@ function parseEnvVarsTable(section) {
|
|
|
210340
211025
|
}
|
|
210341
211026
|
function removeConnector(name, targetDir = process.cwd()) {
|
|
210342
211027
|
const connectorName = name.startsWith("connect-") ? name : `connect-${name}`;
|
|
210343
|
-
const connectorsDir =
|
|
210344
|
-
const connectorPath =
|
|
210345
|
-
if (!
|
|
211028
|
+
const connectorsDir = join214(targetDir, ".connectors");
|
|
211029
|
+
const connectorPath = join214(connectorsDir, connectorName);
|
|
211030
|
+
if (!existsSync211(connectorPath)) {
|
|
210346
211031
|
return false;
|
|
210347
211032
|
}
|
|
210348
211033
|
rmSync4(connectorPath, { recursive: true });
|
|
@@ -210350,7 +211035,7 @@ function removeConnector(name, targetDir = process.cwd()) {
|
|
|
210350
211035
|
return true;
|
|
210351
211036
|
}
|
|
210352
211037
|
var CATEGORIES2, CONNECTORS, versionsLoaded = false, __dirname22, CONNECTORS_DIR;
|
|
210353
|
-
var
|
|
211038
|
+
var init_dist7 = __esm(() => {
|
|
210354
211039
|
CATEGORIES2 = [
|
|
210355
211040
|
"AI & ML",
|
|
210356
211041
|
"Developer Tools",
|
|
@@ -210800,14 +211485,14 @@ var init_dist6 = __esm(() => {
|
|
|
210800
211485
|
tags: ["ads", "twitter"]
|
|
210801
211486
|
}
|
|
210802
211487
|
];
|
|
210803
|
-
__dirname22 =
|
|
211488
|
+
__dirname22 = dirname23(fileURLToPath22(import.meta.url));
|
|
210804
211489
|
CONNECTORS_DIR = resolveConnectorsDir();
|
|
210805
211490
|
});
|
|
210806
211491
|
|
|
210807
211492
|
// packages/core/src/connectors/registry-adapter.ts
|
|
210808
211493
|
async function getConnectorsLib() {
|
|
210809
211494
|
if (!_connectorsLib) {
|
|
210810
|
-
_connectorsLib = await Promise.resolve().then(() => (
|
|
211495
|
+
_connectorsLib = await Promise.resolve().then(() => (init_dist7(), exports_dist3));
|
|
210811
211496
|
}
|
|
210812
211497
|
return _connectorsLib;
|
|
210813
211498
|
}
|
|
@@ -211456,7 +212141,7 @@ var init_loop = __esm(async () => {
|
|
|
211456
212141
|
}
|
|
211457
212142
|
}
|
|
211458
212143
|
});
|
|
211459
|
-
this.memoryInjector = new
|
|
212144
|
+
this.memoryInjector = new MemoryInjector2(this.memoryManager, {
|
|
211460
212145
|
enabled: memoryConfig?.injection?.enabled ?? true,
|
|
211461
212146
|
maxTokens: memoryConfig?.injection?.maxTokens ?? 500,
|
|
211462
212147
|
minImportance: memoryConfig?.injection?.minImportance ?? 5,
|
|
@@ -211930,8 +212615,8 @@ You are running in **autonomous mode**. You manage your own wakeup schedule.
|
|
|
211930
212615
|
this.emit({ type: "text", content: `
|
|
211931
212616
|
[Agent paused - budget exceeded. Use /budgets resume to continue.]
|
|
211932
212617
|
` });
|
|
211933
|
-
await new Promise((
|
|
211934
|
-
this.pauseResolve =
|
|
212618
|
+
await new Promise((resolve11) => {
|
|
212619
|
+
this.pauseResolve = resolve11;
|
|
211935
212620
|
});
|
|
211936
212621
|
this.pauseResolve = null;
|
|
211937
212622
|
if (this.shouldStop)
|
|
@@ -213485,8 +214170,8 @@ ${content3.trim()}`);
|
|
|
213485
214170
|
if (this.config?.scheduler?.enabled === false)
|
|
213486
214171
|
return;
|
|
213487
214172
|
try {
|
|
213488
|
-
const
|
|
213489
|
-
const due = await getDueSchedules(this.cwd,
|
|
214173
|
+
const now4 = Date.now();
|
|
214174
|
+
const due = await getDueSchedules(this.cwd, now4);
|
|
213490
214175
|
for (const schedule of due) {
|
|
213491
214176
|
if (schedule.sessionId && schedule.sessionId !== this.sessionId) {
|
|
213492
214177
|
continue;
|
|
@@ -213538,12 +214223,12 @@ ${content3.trim()}`);
|
|
|
213538
214223
|
try {
|
|
213539
214224
|
const contentToRun = current.actionType === "message" ? current.message || current.command : current.command;
|
|
213540
214225
|
const result = await this.runMessage(contentToRun, "schedule");
|
|
213541
|
-
const
|
|
214226
|
+
const now4 = Date.now();
|
|
213542
214227
|
await updateSchedule(this.cwd, schedule.id, (live) => {
|
|
213543
214228
|
const updated = {
|
|
213544
214229
|
...live,
|
|
213545
|
-
updatedAt:
|
|
213546
|
-
lastRunAt:
|
|
214230
|
+
updatedAt: now4,
|
|
214231
|
+
lastRunAt: now4,
|
|
213547
214232
|
lastResult: {
|
|
213548
214233
|
ok: result.ok,
|
|
213549
214234
|
summary: result.summary,
|
|
@@ -213555,7 +214240,7 @@ ${content3.trim()}`);
|
|
|
213555
214240
|
updated.nextRunAt = undefined;
|
|
213556
214241
|
} else {
|
|
213557
214242
|
updated.status = live.status === "paused" ? "paused" : "active";
|
|
213558
|
-
updated.nextRunAt = computeNextRun2(updated,
|
|
214243
|
+
updated.nextRunAt = computeNextRun2(updated, now4);
|
|
213559
214244
|
}
|
|
213560
214245
|
return updated;
|
|
213561
214246
|
}, { ownerId: this.sessionId });
|
|
@@ -214102,9 +214787,9 @@ class StatsTracker {
|
|
|
214102
214787
|
}
|
|
214103
214788
|
|
|
214104
214789
|
// packages/core/src/tools/connector-index.ts
|
|
214105
|
-
import { join as
|
|
214106
|
-
import { homedir as
|
|
214107
|
-
import { existsSync as
|
|
214790
|
+
import { join as join45, dirname as dirname18 } from "path";
|
|
214791
|
+
import { homedir as homedir25 } from "os";
|
|
214792
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync17, writeFileSync as writeFileSync12, readFileSync as readFileSync16 } from "fs";
|
|
214108
214793
|
var TAG_KEYWORDS, INDEX_VERSION = 1, INDEX_TTL_MS, ConnectorIndex;
|
|
214109
214794
|
var init_connector_index = __esm(() => {
|
|
214110
214795
|
TAG_KEYWORDS = {
|
|
@@ -214138,18 +214823,18 @@ var init_connector_index = __esm(() => {
|
|
|
214138
214823
|
}
|
|
214139
214824
|
getHomeDir() {
|
|
214140
214825
|
const envHome = process.env.HOME || process.env.USERPROFILE;
|
|
214141
|
-
return envHome && envHome.trim().length > 0 ? envHome :
|
|
214826
|
+
return envHome && envHome.trim().length > 0 ? envHome : homedir25();
|
|
214142
214827
|
}
|
|
214143
214828
|
getCachePath() {
|
|
214144
|
-
return
|
|
214829
|
+
return join45(this.getHomeDir(), ".assistants", "cache", "connector-index.json");
|
|
214145
214830
|
}
|
|
214146
214831
|
loadDiskCache() {
|
|
214147
214832
|
ConnectorIndex.indexLoaded = true;
|
|
214148
214833
|
try {
|
|
214149
214834
|
const cachePath = this.getCachePath();
|
|
214150
|
-
if (!
|
|
214835
|
+
if (!existsSync33(cachePath))
|
|
214151
214836
|
return;
|
|
214152
|
-
const data = JSON.parse(
|
|
214837
|
+
const data = JSON.parse(readFileSync16(cachePath, "utf-8"));
|
|
214153
214838
|
if (data.version !== INDEX_VERSION)
|
|
214154
214839
|
return;
|
|
214155
214840
|
if (Date.now() - data.timestamp > INDEX_TTL_MS)
|
|
@@ -214163,9 +214848,9 @@ var init_connector_index = __esm(() => {
|
|
|
214163
214848
|
saveDiskCache() {
|
|
214164
214849
|
try {
|
|
214165
214850
|
const cachePath = this.getCachePath();
|
|
214166
|
-
const cacheDir =
|
|
214167
|
-
if (!
|
|
214168
|
-
|
|
214851
|
+
const cacheDir = dirname18(cachePath);
|
|
214852
|
+
if (!existsSync33(cacheDir)) {
|
|
214853
|
+
mkdirSync17(cacheDir, { recursive: true });
|
|
214169
214854
|
}
|
|
214170
214855
|
const data = {
|
|
214171
214856
|
version: INDEX_VERSION,
|
|
@@ -214666,7 +215351,7 @@ class InterviewStore {
|
|
|
214666
215351
|
this.db = db || getDatabase();
|
|
214667
215352
|
}
|
|
214668
215353
|
create(record2) {
|
|
214669
|
-
const
|
|
215354
|
+
const now4 = Date.now();
|
|
214670
215355
|
const entry = {
|
|
214671
215356
|
id: record2.id,
|
|
214672
215357
|
sessionId: record2.sessionId,
|
|
@@ -214675,7 +215360,7 @@ class InterviewStore {
|
|
|
214675
215360
|
questions: record2.questions,
|
|
214676
215361
|
answers: record2.answers || {},
|
|
214677
215362
|
status: "pending",
|
|
214678
|
-
createdAt:
|
|
215363
|
+
createdAt: now4
|
|
214679
215364
|
};
|
|
214680
215365
|
this.db.prepare(`INSERT INTO interviews (id, session_id, assistant_id, title, questions, answers, status, created_at)
|
|
214681
215366
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`).run(entry.id, entry.sessionId, entry.assistantId || null, entry.title || null, JSON.stringify(entry.questions), JSON.stringify(entry.answers), entry.status, entry.createdAt);
|
|
@@ -214685,12 +215370,12 @@ class InterviewStore {
|
|
|
214685
215370
|
this.db.prepare(`UPDATE interviews SET answers = ? WHERE id = ?`).run(JSON.stringify(answers), id);
|
|
214686
215371
|
}
|
|
214687
215372
|
complete(id, answers) {
|
|
214688
|
-
const
|
|
214689
|
-
this.db.prepare(`UPDATE interviews SET answers = ?, status = 'completed', completed_at = ? WHERE id = ?`).run(JSON.stringify(answers),
|
|
215373
|
+
const now4 = Date.now();
|
|
215374
|
+
this.db.prepare(`UPDATE interviews SET answers = ?, status = 'completed', completed_at = ? WHERE id = ?`).run(JSON.stringify(answers), now4, id);
|
|
214690
215375
|
}
|
|
214691
215376
|
cancel(id) {
|
|
214692
|
-
const
|
|
214693
|
-
this.db.prepare(`UPDATE interviews SET status = 'cancelled', completed_at = ? WHERE id = ?`).run(
|
|
215377
|
+
const now4 = Date.now();
|
|
215378
|
+
this.db.prepare(`UPDATE interviews SET status = 'cancelled', completed_at = ? WHERE id = ?`).run(now4, id);
|
|
214694
215379
|
}
|
|
214695
215380
|
get(id) {
|
|
214696
215381
|
const row = this.db.prepare(`SELECT * FROM interviews WHERE id = ?`).get(id);
|
|
@@ -214734,27 +215419,27 @@ class InterviewStore {
|
|
|
214734
215419
|
};
|
|
214735
215420
|
}
|
|
214736
215421
|
}
|
|
214737
|
-
var
|
|
215422
|
+
var init_store13 = __esm(async () => {
|
|
214738
215423
|
await init_database();
|
|
214739
215424
|
});
|
|
214740
215425
|
|
|
214741
215426
|
// packages/core/src/interviews/index.ts
|
|
214742
215427
|
var init_interviews = __esm(async () => {
|
|
214743
|
-
await
|
|
215428
|
+
await init_store13();
|
|
214744
215429
|
});
|
|
214745
215430
|
|
|
214746
215431
|
// packages/core/src/memory/sessions.ts
|
|
214747
|
-
import { join as
|
|
214748
|
-
import { existsSync as
|
|
215432
|
+
import { join as join46, dirname as dirname19 } from "path";
|
|
215433
|
+
import { existsSync as existsSync35, mkdirSync as mkdirSync18 } from "fs";
|
|
214749
215434
|
|
|
214750
215435
|
class SessionManager {
|
|
214751
215436
|
db;
|
|
214752
215437
|
constructor(dbPath, assistantId) {
|
|
214753
215438
|
const baseDir = getConfigDir();
|
|
214754
|
-
const path5 = dbPath || (assistantId ?
|
|
214755
|
-
const dir =
|
|
214756
|
-
if (!
|
|
214757
|
-
|
|
215439
|
+
const path5 = dbPath || (assistantId ? join46(baseDir, "assistants", assistantId, "memory.db") : join46(baseDir, "memory.db"));
|
|
215440
|
+
const dir = dirname19(path5);
|
|
215441
|
+
if (!existsSync35(dir)) {
|
|
215442
|
+
mkdirSync18(dir, { recursive: true });
|
|
214758
215443
|
}
|
|
214759
215444
|
const runtime = getRuntime();
|
|
214760
215445
|
this.db = runtime.openDatabase(path5);
|
|
@@ -215061,9 +215746,9 @@ class PreferenceLearner {
|
|
|
215061
215746
|
}
|
|
215062
215747
|
}
|
|
215063
215748
|
// packages/core/src/migration/validators.ts
|
|
215064
|
-
import { existsSync as
|
|
215749
|
+
import { existsSync as existsSync36 } from "fs";
|
|
215065
215750
|
function assertNoExistingTarget(targetPath) {
|
|
215066
|
-
if (
|
|
215751
|
+
if (existsSync36(targetPath)) {
|
|
215067
215752
|
throw new Error(`Target already exists at ${targetPath}`);
|
|
215068
215753
|
}
|
|
215069
215754
|
}
|
|
@@ -215253,9 +215938,9 @@ async function saveHistory(history) {
|
|
|
215253
215938
|
conn.transaction(() => {
|
|
215254
215939
|
conn.exec("DELETE FROM command_history");
|
|
215255
215940
|
const insert = conn.prepare("INSERT INTO command_history (command, created_at) VALUES (?, ?)");
|
|
215256
|
-
const
|
|
215941
|
+
const now4 = Date.now();
|
|
215257
215942
|
for (let i6 = 0;i6 < trimmed.length; i6++) {
|
|
215258
|
-
insert.run(trimmed[i6],
|
|
215943
|
+
insert.run(trimmed[i6], now4 + i6);
|
|
215259
215944
|
}
|
|
215260
215945
|
});
|
|
215261
215946
|
} catch {}
|
|
@@ -215983,7 +216668,7 @@ __export(exports_src3, {
|
|
|
215983
216668
|
NativeHookRegistry: () => NativeHookRegistry,
|
|
215984
216669
|
MessagesManager: () => MessagesManager,
|
|
215985
216670
|
MemoryStore: () => MemoryStore,
|
|
215986
|
-
MemoryInjector: () =>
|
|
216671
|
+
MemoryInjector: () => MemoryInjector2,
|
|
215987
216672
|
MODELS: () => MODELS,
|
|
215988
216673
|
MIN_SLEEP_MS: () => MIN_SLEEP_MS,
|
|
215989
216674
|
Logger: () => Logger,
|
|
@@ -216106,6 +216791,7 @@ var init_src3 = __esm(async () => {
|
|
|
216106
216791
|
init_loader();
|
|
216107
216792
|
init_native();
|
|
216108
216793
|
init_scope_context();
|
|
216794
|
+
init_mementos_adapter();
|
|
216109
216795
|
init_injector();
|
|
216110
216796
|
init_project_memory();
|
|
216111
216797
|
init_types11();
|
|
@@ -216153,7 +216839,6 @@ var init_src3 = __esm(async () => {
|
|
|
216153
216839
|
init_logger3(),
|
|
216154
216840
|
init_verification(),
|
|
216155
216841
|
init_interviews(),
|
|
216156
|
-
init_store13(),
|
|
216157
216842
|
init_sessions4(),
|
|
216158
216843
|
init_global_memory(),
|
|
216159
216844
|
init_budget(),
|
|
@@ -216554,14 +217239,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
216554
217239
|
prevActScopeDepth !== actScopeDepth - 1 && console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
|
|
216555
217240
|
actScopeDepth = prevActScopeDepth;
|
|
216556
217241
|
}
|
|
216557
|
-
function recursivelyFlushAsyncActWork(returnValue,
|
|
217242
|
+
function recursivelyFlushAsyncActWork(returnValue, resolve11, reject) {
|
|
216558
217243
|
var queue = ReactSharedInternals.actQueue;
|
|
216559
217244
|
if (queue !== null)
|
|
216560
217245
|
if (queue.length !== 0)
|
|
216561
217246
|
try {
|
|
216562
217247
|
flushActQueue(queue);
|
|
216563
217248
|
enqueueTask(function() {
|
|
216564
|
-
return recursivelyFlushAsyncActWork(returnValue,
|
|
217249
|
+
return recursivelyFlushAsyncActWork(returnValue, resolve11, reject);
|
|
216565
217250
|
});
|
|
216566
217251
|
return;
|
|
216567
217252
|
} catch (error4) {
|
|
@@ -216569,7 +217254,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
216569
217254
|
}
|
|
216570
217255
|
else
|
|
216571
217256
|
ReactSharedInternals.actQueue = null;
|
|
216572
|
-
0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) :
|
|
217257
|
+
0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve11(returnValue);
|
|
216573
217258
|
}
|
|
216574
217259
|
function flushActQueue(queue) {
|
|
216575
217260
|
if (!isFlushing) {
|
|
@@ -216745,14 +217430,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
216745
217430
|
didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"));
|
|
216746
217431
|
});
|
|
216747
217432
|
return {
|
|
216748
|
-
then: function(
|
|
217433
|
+
then: function(resolve11, reject) {
|
|
216749
217434
|
didAwaitActCall = true;
|
|
216750
217435
|
thenable.then(function(returnValue) {
|
|
216751
217436
|
popActScope(prevActQueue, prevActScopeDepth);
|
|
216752
217437
|
if (prevActScopeDepth === 0) {
|
|
216753
217438
|
try {
|
|
216754
217439
|
flushActQueue(queue), enqueueTask(function() {
|
|
216755
|
-
return recursivelyFlushAsyncActWork(returnValue,
|
|
217440
|
+
return recursivelyFlushAsyncActWork(returnValue, resolve11, reject);
|
|
216756
217441
|
});
|
|
216757
217442
|
} catch (error$0) {
|
|
216758
217443
|
ReactSharedInternals.thrownErrors.push(error$0);
|
|
@@ -216763,7 +217448,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
216763
217448
|
reject(_thrownError);
|
|
216764
217449
|
}
|
|
216765
217450
|
} else
|
|
216766
|
-
|
|
217451
|
+
resolve11(returnValue);
|
|
216767
217452
|
}, function(error4) {
|
|
216768
217453
|
popActScope(prevActQueue, prevActScopeDepth);
|
|
216769
217454
|
0 < ReactSharedInternals.thrownErrors.length ? (error4 = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(error4)) : reject(error4);
|
|
@@ -216779,11 +217464,11 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
216779
217464
|
if (0 < ReactSharedInternals.thrownErrors.length)
|
|
216780
217465
|
throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
|
|
216781
217466
|
return {
|
|
216782
|
-
then: function(
|
|
217467
|
+
then: function(resolve11, reject) {
|
|
216783
217468
|
didAwaitActCall = true;
|
|
216784
217469
|
prevActScopeDepth === 0 ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
|
|
216785
|
-
return recursivelyFlushAsyncActWork(returnValue$jscomp$0,
|
|
216786
|
-
})) :
|
|
217470
|
+
return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve11, reject);
|
|
217471
|
+
})) : resolve11(returnValue$jscomp$0);
|
|
216787
217472
|
}
|
|
216788
217473
|
};
|
|
216789
217474
|
};
|
|
@@ -217585,7 +218270,7 @@ var consoleMethods, originalMethods, patchConsole = (callback) => {
|
|
|
217585
218270
|
originalMethods = {};
|
|
217586
218271
|
};
|
|
217587
218272
|
}, dist_default;
|
|
217588
|
-
var
|
|
218273
|
+
var init_dist8 = __esm(() => {
|
|
217589
218274
|
consoleMethods = [
|
|
217590
218275
|
"assert",
|
|
217591
218276
|
"count",
|
|
@@ -221940,8 +222625,8 @@ It can also happen if the client has a browser extension installed which messes
|
|
|
221940
222625
|
}
|
|
221941
222626
|
function startUpdateTimerByLane(lane, method, fiber) {
|
|
221942
222627
|
if ((lane & 127) !== 0)
|
|
221943
|
-
0 > blockingUpdateTime && (blockingUpdateTime =
|
|
221944
|
-
else if ((lane & 4194048) !== 0 && 0 > transitionUpdateTime && (transitionUpdateTime =
|
|
222628
|
+
0 > blockingUpdateTime && (blockingUpdateTime = now4(), blockingUpdateTask = createTask2(method), blockingUpdateMethodName = method, fiber != null && (blockingUpdateComponentName = getComponentNameFromFiber(fiber)), isAlreadyRendering() && (componentEffectSpawnedUpdate = true, blockingUpdateType = 1), lane = resolveEventTimeStamp(), method = resolveEventType(), lane !== blockingEventRepeatTime || method !== blockingEventType ? blockingEventRepeatTime = -1.1 : method !== null && (blockingUpdateType = 1), blockingEventTime = lane, blockingEventType = method);
|
|
222629
|
+
else if ((lane & 4194048) !== 0 && 0 > transitionUpdateTime && (transitionUpdateTime = now4(), transitionUpdateTask = createTask2(method), transitionUpdateMethodName = method, fiber != null && (transitionUpdateComponentName = getComponentNameFromFiber(fiber)), 0 > transitionStartTime)) {
|
|
221945
222630
|
lane = resolveEventTimeStamp();
|
|
221946
222631
|
method = resolveEventType();
|
|
221947
222632
|
if (lane !== transitionEventRepeatTime || method !== transitionEventType)
|
|
@@ -221952,7 +222637,7 @@ It can also happen if the client has a browser extension installed which messes
|
|
|
221952
222637
|
}
|
|
221953
222638
|
function startHostActionTimer(fiber) {
|
|
221954
222639
|
if (0 > blockingUpdateTime) {
|
|
221955
|
-
blockingUpdateTime =
|
|
222640
|
+
blockingUpdateTime = now4();
|
|
221956
222641
|
blockingUpdateTask = fiber._debugTask != null ? fiber._debugTask : null;
|
|
221957
222642
|
isAlreadyRendering() && (blockingUpdateType = 1);
|
|
221958
222643
|
var newEventTime = resolveEventTimeStamp(), newEventType = resolveEventType();
|
|
@@ -221960,7 +222645,7 @@ It can also happen if the client has a browser extension installed which messes
|
|
|
221960
222645
|
blockingEventTime = newEventTime;
|
|
221961
222646
|
blockingEventType = newEventType;
|
|
221962
222647
|
}
|
|
221963
|
-
if (0 > transitionUpdateTime && (transitionUpdateTime =
|
|
222648
|
+
if (0 > transitionUpdateTime && (transitionUpdateTime = now4(), transitionUpdateTask = fiber._debugTask != null ? fiber._debugTask : null, 0 > transitionStartTime)) {
|
|
221964
222649
|
fiber = resolveEventTimeStamp();
|
|
221965
222650
|
newEventTime = resolveEventType();
|
|
221966
222651
|
if (fiber !== transitionEventRepeatTime || newEventTime !== transitionEventType)
|
|
@@ -222014,12 +222699,12 @@ It can also happen if the client has a browser extension installed which messes
|
|
|
222014
222699
|
return prev;
|
|
222015
222700
|
}
|
|
222016
222701
|
function startProfilerTimer(fiber) {
|
|
222017
|
-
profilerStartTime =
|
|
222702
|
+
profilerStartTime = now4();
|
|
222018
222703
|
0 > fiber.actualStartTime && (fiber.actualStartTime = profilerStartTime);
|
|
222019
222704
|
}
|
|
222020
222705
|
function stopProfilerTimerIfRunningAndRecordDuration(fiber) {
|
|
222021
222706
|
if (0 <= profilerStartTime) {
|
|
222022
|
-
var elapsedTime =
|
|
222707
|
+
var elapsedTime = now4() - profilerStartTime;
|
|
222023
222708
|
fiber.actualDuration += elapsedTime;
|
|
222024
222709
|
fiber.selfBaseDuration = elapsedTime;
|
|
222025
222710
|
profilerStartTime = -1;
|
|
@@ -222027,14 +222712,14 @@ It can also happen if the client has a browser extension installed which messes
|
|
|
222027
222712
|
}
|
|
222028
222713
|
function stopProfilerTimerIfRunningAndRecordIncompleteDuration(fiber) {
|
|
222029
222714
|
if (0 <= profilerStartTime) {
|
|
222030
|
-
var elapsedTime =
|
|
222715
|
+
var elapsedTime = now4() - profilerStartTime;
|
|
222031
222716
|
fiber.actualDuration += elapsedTime;
|
|
222032
222717
|
profilerStartTime = -1;
|
|
222033
222718
|
}
|
|
222034
222719
|
}
|
|
222035
222720
|
function recordEffectDuration() {
|
|
222036
222721
|
if (0 <= profilerStartTime) {
|
|
222037
|
-
var endTime =
|
|
222722
|
+
var endTime = now4(), elapsedTime = endTime - profilerStartTime;
|
|
222038
222723
|
profilerStartTime = -1;
|
|
222039
222724
|
profilerEffectDuration += elapsedTime;
|
|
222040
222725
|
componentEffectDuration += elapsedTime;
|
|
@@ -222048,7 +222733,7 @@ It can also happen if the client has a browser extension installed which messes
|
|
|
222048
222733
|
commitErrors.push(errorInfo);
|
|
222049
222734
|
}
|
|
222050
222735
|
function startEffectTimer() {
|
|
222051
|
-
profilerStartTime =
|
|
222736
|
+
profilerStartTime = now4();
|
|
222052
222737
|
0 > componentEffectStartTime && (componentEffectStartTime = profilerStartTime);
|
|
222053
222738
|
}
|
|
222054
222739
|
function transferActualDuration(fiber) {
|
|
@@ -222205,8 +222890,8 @@ It can also happen if the client has a browser extension installed which messes
|
|
|
222205
222890
|
currentEntangledActionThenable = {
|
|
222206
222891
|
status: "pending",
|
|
222207
222892
|
value: undefined,
|
|
222208
|
-
then: function(
|
|
222209
|
-
entangledListeners.push(
|
|
222893
|
+
then: function(resolve11) {
|
|
222894
|
+
entangledListeners.push(resolve11);
|
|
222210
222895
|
}
|
|
222211
222896
|
};
|
|
222212
222897
|
}
|
|
@@ -222230,8 +222915,8 @@ It can also happen if the client has a browser extension installed which messes
|
|
|
222230
222915
|
status: "pending",
|
|
222231
222916
|
value: null,
|
|
222232
222917
|
reason: null,
|
|
222233
|
-
then: function(
|
|
222234
|
-
listeners.push(
|
|
222918
|
+
then: function(resolve11) {
|
|
222919
|
+
listeners.push(resolve11);
|
|
222235
222920
|
}
|
|
222236
222921
|
};
|
|
222237
222922
|
thenable.then(function() {
|
|
@@ -227304,7 +227989,7 @@ Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fet
|
|
|
227304
227989
|
if (startTime === RootInProgress) {
|
|
227305
227990
|
workInProgressRootIsPrerendering && !forceSync && markRootSuspended(root3, lanes, 0, false);
|
|
227306
227991
|
lanes = workInProgressSuspendedReason;
|
|
227307
|
-
yieldStartTime =
|
|
227992
|
+
yieldStartTime = now4();
|
|
227308
227993
|
yieldReason = lanes;
|
|
227309
227994
|
break;
|
|
227310
227995
|
} else {
|
|
@@ -227493,7 +228178,7 @@ Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fet
|
|
|
227493
228178
|
function prepareFreshStack(root3, lanes) {
|
|
227494
228179
|
supportsUserTiming && (console.timeStamp("Blocking Track", 0.003, 0.003, "Blocking", "Scheduler \u269B", "primary-light"), console.timeStamp("Transition Track", 0.003, 0.003, "Transition", "Scheduler \u269B", "primary-light"), console.timeStamp("Suspense Track", 0.003, 0.003, "Suspense", "Scheduler \u269B", "primary-light"), console.timeStamp("Idle Track", 0.003, 0.003, "Idle", "Scheduler \u269B", "primary-light"));
|
|
227495
228180
|
var previousRenderStartTime = renderStartTime;
|
|
227496
|
-
renderStartTime =
|
|
228181
|
+
renderStartTime = now4();
|
|
227497
228182
|
if (workInProgressRootRenderLanes !== 0 && 0 < previousRenderStartTime) {
|
|
227498
228183
|
setCurrentTrackFromLanes(workInProgressRootRenderLanes);
|
|
227499
228184
|
if (workInProgressRootExitStatus === RootSuspended || workInProgressRootExitStatus === RootSuspendedWithDelay)
|
|
@@ -227548,7 +228233,7 @@ Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fet
|
|
|
227548
228233
|
blockingSuspendedTime = -1.1;
|
|
227549
228234
|
blockingEventRepeatTime = blockingEventTime;
|
|
227550
228235
|
blockingEventTime = -1.1;
|
|
227551
|
-
blockingClampTime =
|
|
228236
|
+
blockingClampTime = now4();
|
|
227552
228237
|
}
|
|
227553
228238
|
(lanes & 4194048) !== 0 && (workInProgressUpdateTask = transitionUpdateTask, debugTask = 0 <= transitionStartTime && transitionStartTime < transitionClampTime ? transitionClampTime : transitionStartTime, previousRenderStartTime = 0 <= transitionUpdateTime && transitionUpdateTime < transitionClampTime ? transitionClampTime : transitionUpdateTime, endTime = 0 <= transitionEventTime && transitionEventTime < transitionClampTime ? transitionClampTime : transitionEventTime, color2 = 0 <= endTime ? endTime : 0 <= previousRenderStartTime ? previousRenderStartTime : renderStartTime, 0 <= transitionSuspendedTime && (setCurrentTrackFromLanes(256), logSuspendedWithDelayPhase(transitionSuspendedTime, color2, lanes, workInProgressUpdateTask)), isPingedUpdate = endTime, eventTime = transitionEventType, eventType = 0 < transitionEventRepeatTime, eventIsRepeat = transitionUpdateType === 2, color2 = renderStartTime, endTime = transitionUpdateTask, label = transitionUpdateMethodName, isSpawnedUpdate = transitionUpdateComponentName, supportsUserTiming && (currentTrack = "Transition", 0 < previousRenderStartTime ? previousRenderStartTime > color2 && (previousRenderStartTime = color2) : previousRenderStartTime = color2, 0 < debugTask ? debugTask > previousRenderStartTime && (debugTask = previousRenderStartTime) : debugTask = previousRenderStartTime, 0 < isPingedUpdate ? isPingedUpdate > debugTask && (isPingedUpdate = debugTask) : isPingedUpdate = debugTask, debugTask > isPingedUpdate && eventTime !== null && (color$jscomp$0 = eventType ? "secondary-light" : "warning", endTime ? endTime.run(console.timeStamp.bind(console, eventType ? "Consecutive" : "Event: " + eventTime, isPingedUpdate, debugTask, currentTrack, "Scheduler \u269B", color$jscomp$0)) : console.timeStamp(eventType ? "Consecutive" : "Event: " + eventTime, isPingedUpdate, debugTask, currentTrack, "Scheduler \u269B", color$jscomp$0)), previousRenderStartTime > debugTask && (endTime ? endTime.run(console.timeStamp.bind(console, "Action", debugTask, previousRenderStartTime, currentTrack, "Scheduler \u269B", "primary-dark")) : console.timeStamp("Action", debugTask, previousRenderStartTime, currentTrack, "Scheduler \u269B", "primary-dark")), color2 > previousRenderStartTime && (debugTask = eventIsRepeat ? "Promise Resolved" : 5 < color2 - previousRenderStartTime ? "Update Blocked" : "Update", isPingedUpdate = [], isSpawnedUpdate != null && isPingedUpdate.push(["Component name", isSpawnedUpdate]), label != null && isPingedUpdate.push(["Method name", label]), previousRenderStartTime = {
|
|
227554
228239
|
start: previousRenderStartTime,
|
|
@@ -227561,7 +228246,7 @@ Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fet
|
|
|
227561
228246
|
color: "primary-light"
|
|
227562
228247
|
}
|
|
227563
228248
|
}
|
|
227564
|
-
}, endTime ? endTime.run(performance.measure.bind(performance, debugTask, previousRenderStartTime)) : performance.measure(debugTask, previousRenderStartTime))), transitionUpdateTime = transitionStartTime = -1.1, transitionUpdateType = 0, transitionSuspendedTime = -1.1, transitionEventRepeatTime = transitionEventTime, transitionEventTime = -1.1, transitionClampTime =
|
|
228249
|
+
}, endTime ? endTime.run(performance.measure.bind(performance, debugTask, previousRenderStartTime)) : performance.measure(debugTask, previousRenderStartTime))), transitionUpdateTime = transitionStartTime = -1.1, transitionUpdateType = 0, transitionSuspendedTime = -1.1, transitionEventRepeatTime = transitionEventTime, transitionEventTime = -1.1, transitionClampTime = now4());
|
|
227565
228250
|
previousRenderStartTime = root3.timeoutHandle;
|
|
227566
228251
|
previousRenderStartTime !== noTimeout && (root3.timeoutHandle = noTimeout, cancelTimeout(previousRenderStartTime));
|
|
227567
228252
|
previousRenderStartTime = root3.cancelPendingCommit;
|
|
@@ -227946,7 +228631,7 @@ Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fet
|
|
|
227946
228631
|
return null;
|
|
227947
228632
|
})) : (root3.callbackNode = null, root3.callbackPriority = 0);
|
|
227948
228633
|
commitErrors = null;
|
|
227949
|
-
commitStartTime =
|
|
228634
|
+
commitStartTime = now4();
|
|
227950
228635
|
suspendedCommitReason !== null && logSuspendedCommitPhase(completedRenderEndTime, commitStartTime, suspendedCommitReason, workInProgressUpdateTask);
|
|
227951
228636
|
recoverableErrors = (finishedWork.flags & 13878) !== 0;
|
|
227952
228637
|
if ((finishedWork.subtreeFlags & 13878) !== 0 || recoverableErrors) {
|
|
@@ -227994,7 +228679,7 @@ Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fet
|
|
|
227994
228679
|
pendingEffectsStatus = NO_PENDING_EFFECTS;
|
|
227995
228680
|
var suspendedViewTransitionReason = pendingSuspendedViewTransitionReason;
|
|
227996
228681
|
if (suspendedViewTransitionReason !== null) {
|
|
227997
|
-
commitStartTime =
|
|
228682
|
+
commitStartTime = now4();
|
|
227998
228683
|
var startTime = commitEndTime, endTime = commitStartTime;
|
|
227999
228684
|
!supportsUserTiming || endTime <= startTime || (animatingTask ? animatingTask.run(console.timeStamp.bind(console, suspendedViewTransitionReason, startTime, endTime, currentTrack, "Scheduler \u269B", "secondary-light")) : console.timeStamp(suspendedViewTransitionReason, startTime, endTime, currentTrack, "Scheduler \u269B", "secondary-light"));
|
|
228000
228685
|
}
|
|
@@ -228017,7 +228702,7 @@ Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fet
|
|
|
228017
228702
|
}
|
|
228018
228703
|
suspendedViewTransitionReason = pendingEffectsRenderEndTime;
|
|
228019
228704
|
startTime = pendingSuspendedCommitReason;
|
|
228020
|
-
commitEndTime =
|
|
228705
|
+
commitEndTime = now4();
|
|
228021
228706
|
suspendedViewTransitionReason = startTime === null ? suspendedViewTransitionReason : commitStartTime;
|
|
228022
228707
|
startTime = commitEndTime;
|
|
228023
228708
|
endTime = pendingDelayedCommitReason === ABORTED_VIEW_TRANSITION_COMMIT;
|
|
@@ -228030,7 +228715,7 @@ Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fet
|
|
|
228030
228715
|
if (pendingEffectsStatus === PENDING_SPAWNED_WORK || pendingEffectsStatus === PENDING_AFTER_MUTATION_PHASE) {
|
|
228031
228716
|
if (pendingEffectsStatus === PENDING_SPAWNED_WORK) {
|
|
228032
228717
|
var startViewTransitionStartTime = commitEndTime;
|
|
228033
|
-
commitEndTime =
|
|
228718
|
+
commitEndTime = now4();
|
|
228034
228719
|
var endTime = commitEndTime, abortedViewTransition = pendingDelayedCommitReason === ABORTED_VIEW_TRANSITION_COMMIT;
|
|
228035
228720
|
!supportsUserTiming || endTime <= startViewTransitionStartTime || (animatingTask ? animatingTask.run(console.timeStamp.bind(console, abortedViewTransition ? "Interrupted View Transition" : "Starting Animation", startViewTransitionStartTime, endTime, currentTrack, "Scheduler \u269B", abortedViewTransition ? "error" : "secondary-light")) : console.timeStamp(abortedViewTransition ? "Interrupted View Transition" : "Starting Animation", startViewTransitionStartTime, endTime, currentTrack, "Scheduler \u269B", abortedViewTransition ? " error" : "secondary-light"));
|
|
228036
228721
|
pendingDelayedCommitReason !== ABORTED_VIEW_TRANSITION_COMMIT && (pendingDelayedCommitReason = ANIMATION_STARTED_COMMIT);
|
|
@@ -228235,7 +228920,7 @@ Error message:
|
|
|
228235
228920
|
pingCache !== null && pingCache.delete(wakeable);
|
|
228236
228921
|
root3.pingedLanes |= root3.suspendedLanes & pingedLanes;
|
|
228237
228922
|
root3.warmLanes &= ~pingedLanes;
|
|
228238
|
-
(pingedLanes & 127) !== 0 ? 0 > blockingUpdateTime && (blockingClampTime = blockingUpdateTime =
|
|
228923
|
+
(pingedLanes & 127) !== 0 ? 0 > blockingUpdateTime && (blockingClampTime = blockingUpdateTime = now4(), blockingUpdateTask = createTask2("Promise Resolved"), blockingUpdateType = 2) : (pingedLanes & 4194048) !== 0 && 0 > transitionUpdateTime && (transitionClampTime = transitionUpdateTime = now4(), transitionUpdateTask = createTask2("Promise Resolved"), transitionUpdateType = 2);
|
|
228239
228924
|
isConcurrentActEnvironment() && ReactSharedInternals.actQueue === null && console.error(`A suspended resource finished loading inside a test, but the event was not wrapped in act(...).
|
|
228240
228925
|
|
|
228241
228926
|
When testing, code that resolves suspended data should be wrapped into act(...):
|
|
@@ -228788,14 +229473,14 @@ Check the render method of %s.`, getComponentNameFromFiber(current) || "Unknown"
|
|
|
228788
229473
|
_threadCount: 0,
|
|
228789
229474
|
_currentRenderer: null,
|
|
228790
229475
|
_currentRenderer2: null
|
|
228791
|
-
},
|
|
229476
|
+
}, now4 = Scheduler.unstable_now, createTask2 = console.createTask ? console.createTask : function() {
|
|
228792
229477
|
return null;
|
|
228793
229478
|
}, renderStartTime = -0, commitStartTime = -0, commitEndTime = -0, commitErrors = null, profilerStartTime = -1.1, profilerEffectDuration = -0, componentEffectDuration = -0, componentEffectStartTime = -1.1, componentEffectEndTime = -1.1, componentEffectErrors = null, componentEffectSpawnedUpdate = false, blockingClampTime = -0, blockingUpdateTime = -1.1, blockingUpdateTask = null, blockingUpdateType = 0, blockingUpdateMethodName = null, blockingUpdateComponentName = null, blockingEventTime = -1.1, blockingEventType = null, blockingEventRepeatTime = -1.1, blockingSuspendedTime = -1.1, transitionClampTime = -0, transitionStartTime = -1.1, transitionUpdateTime = -1.1, transitionUpdateType = 0, transitionUpdateTask = null, transitionUpdateMethodName = null, transitionUpdateComponentName = null, transitionEventTime = -1.1, transitionEventType = null, transitionEventRepeatTime = -1.1, transitionSuspendedTime = -1.1, animatingTask = null, yieldReason = 0, yieldStartTime = -1.1, currentUpdateIsNested = false, nestedUpdateScheduled = false, firstScheduledRoot = null, lastScheduledRoot = null, didScheduleMicrotask = false, didScheduleMicrotask_act = false, mightHavePendingSyncWork = false, isFlushingWork = false, currentEventTransitionLane = 0, fakeActCallbackNode$1 = {}, currentEntangledListeners = null, currentEntangledPendingCount = 0, currentEntangledLane = 0, currentEntangledActionThenable = null, prevOnStartTransitionFinish = ReactSharedInternals.S;
|
|
228794
229479
|
ReactSharedInternals.S = function(transition, returnValue) {
|
|
228795
229480
|
globalMostRecentTransitionTime = now$1();
|
|
228796
229481
|
if (typeof returnValue === "object" && returnValue !== null && typeof returnValue.then === "function") {
|
|
228797
229482
|
if (0 > transitionStartTime && 0 > transitionUpdateTime) {
|
|
228798
|
-
transitionStartTime =
|
|
229483
|
+
transitionStartTime = now4();
|
|
228799
229484
|
var newEventTime = resolveEventTimeStamp(), newEventType = resolveEventType();
|
|
228800
229485
|
if (newEventTime !== transitionEventRepeatTime || newEventType !== transitionEventType)
|
|
228801
229486
|
transitionEventRepeatTime = -1.1;
|
|
@@ -233650,7 +234335,7 @@ var require_stack_utils = __commonJS((exports, module) => {
|
|
|
233650
234335
|
var convertToSpaces = (input, spaces = 2) => {
|
|
233651
234336
|
return input.replace(/^\t+/gm, ($1) => " ".repeat($1.length * spaces));
|
|
233652
234337
|
}, dist_default2;
|
|
233653
|
-
var
|
|
234338
|
+
var init_dist9 = __esm(() => {
|
|
233654
234339
|
dist_default2 = convertToSpaces;
|
|
233655
234340
|
});
|
|
233656
234341
|
|
|
@@ -233677,8 +234362,8 @@ var generateLineNumbers = (line, around) => {
|
|
|
233677
234362
|
}
|
|
233678
234363
|
return generateLineNumbers(line, (_a4 = options2.around) !== null && _a4 !== undefined ? _a4 : 3).filter((line2) => lines[line2 - 1] !== undefined).map((line2) => ({ line: line2, value: lines[line2 - 1] }));
|
|
233679
234364
|
}, dist_default3;
|
|
233680
|
-
var
|
|
233681
|
-
|
|
234365
|
+
var init_dist10 = __esm(() => {
|
|
234366
|
+
init_dist9();
|
|
233682
234367
|
dist_default3 = codeExcerpt;
|
|
233683
234368
|
});
|
|
233684
234369
|
|
|
@@ -233814,7 +234499,7 @@ var import_react12, import_stack_utils, cleanupPath = (path5) => {
|
|
|
233814
234499
|
return path5?.replace(`file://${cwd2()}/`, "");
|
|
233815
234500
|
}, stackUtils;
|
|
233816
234501
|
var init_ErrorOverview = __esm(() => {
|
|
233817
|
-
|
|
234502
|
+
init_dist10();
|
|
233818
234503
|
init_Box();
|
|
233819
234504
|
init_Text();
|
|
233820
234505
|
import_react12 = __toESM(require_react(), 1);
|
|
@@ -234516,8 +235201,8 @@ class Ink {
|
|
|
234516
235201
|
}
|
|
234517
235202
|
}
|
|
234518
235203
|
async waitUntilExit() {
|
|
234519
|
-
this.exitPromise ||= new Promise((
|
|
234520
|
-
this.resolveExitPromise =
|
|
235204
|
+
this.exitPromise ||= new Promise((resolve11, reject) => {
|
|
235205
|
+
this.resolveExitPromise = resolve11;
|
|
234521
235206
|
this.rejectExitPromise = reject;
|
|
234522
235207
|
});
|
|
234523
235208
|
if (!this.beforeExitHandler) {
|
|
@@ -234609,7 +235294,7 @@ var init_ink = __esm(async () => {
|
|
|
234609
235294
|
init_compat();
|
|
234610
235295
|
init_ansi_escapes();
|
|
234611
235296
|
init_is_in_ci();
|
|
234612
|
-
|
|
235297
|
+
init_dist8();
|
|
234613
235298
|
init_wrap_ansi();
|
|
234614
235299
|
init_terminal_size();
|
|
234615
235300
|
init_log_update();
|
|
@@ -234681,25 +235366,6 @@ var init_render = __esm(async () => {
|
|
|
234681
235366
|
});
|
|
234682
235367
|
|
|
234683
235368
|
// node_modules/.pnpm/ink@6.7.0_@types+react@19.2.14_react-devtools-core@7.0.1_react@19.2.4/node_modules/ink/build/components/Static.js
|
|
234684
|
-
function Static(props) {
|
|
234685
|
-
const { items, children: render3, style: customStyle } = props;
|
|
234686
|
-
const [index2, setIndex] = import_react16.useState(0);
|
|
234687
|
-
const itemsToRender = import_react16.useMemo(() => {
|
|
234688
|
-
return items.slice(index2);
|
|
234689
|
-
}, [items, index2]);
|
|
234690
|
-
import_react16.useLayoutEffect(() => {
|
|
234691
|
-
setIndex(items.length);
|
|
234692
|
-
}, [items.length]);
|
|
234693
|
-
const children2 = itemsToRender.map((item, itemIndex) => {
|
|
234694
|
-
return render3(item, index2 + itemIndex);
|
|
234695
|
-
});
|
|
234696
|
-
const style = import_react16.useMemo(() => ({
|
|
234697
|
-
position: "absolute",
|
|
234698
|
-
flexDirection: "column",
|
|
234699
|
-
...customStyle
|
|
234700
|
-
}), [customStyle]);
|
|
234701
|
-
return import_react16.default.createElement("ink-box", { internal_static: true, style }, children2);
|
|
234702
|
-
}
|
|
234703
235369
|
var import_react16;
|
|
234704
235370
|
var init_Static = __esm(() => {
|
|
234705
235371
|
import_react16 = __toESM(require_react(), 1);
|
|
@@ -235628,21 +236294,21 @@ var require_filesystem = __commonJS((exports, module) => {
|
|
|
235628
236294
|
var LDD_PATH = "/usr/bin/ldd";
|
|
235629
236295
|
var SELF_PATH = "/proc/self/exe";
|
|
235630
236296
|
var MAX_LENGTH = 2048;
|
|
235631
|
-
var
|
|
236297
|
+
var readFileSync18 = (path5) => {
|
|
235632
236298
|
const fd = fs7.openSync(path5, "r");
|
|
235633
236299
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
235634
236300
|
const bytesRead = fs7.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
235635
236301
|
fs7.close(fd, () => {});
|
|
235636
236302
|
return buffer.subarray(0, bytesRead);
|
|
235637
236303
|
};
|
|
235638
|
-
var readFile10 = (path5) => new Promise((
|
|
236304
|
+
var readFile10 = (path5) => new Promise((resolve11, reject) => {
|
|
235639
236305
|
fs7.open(path5, "r", (err, fd) => {
|
|
235640
236306
|
if (err) {
|
|
235641
236307
|
reject(err);
|
|
235642
236308
|
} else {
|
|
235643
236309
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
235644
236310
|
fs7.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
|
|
235645
|
-
|
|
236311
|
+
resolve11(buffer.subarray(0, bytesRead));
|
|
235646
236312
|
fs7.close(fd, () => {});
|
|
235647
236313
|
});
|
|
235648
236314
|
}
|
|
@@ -235651,7 +236317,7 @@ var require_filesystem = __commonJS((exports, module) => {
|
|
|
235651
236317
|
module.exports = {
|
|
235652
236318
|
LDD_PATH,
|
|
235653
236319
|
SELF_PATH,
|
|
235654
|
-
readFileSync:
|
|
236320
|
+
readFileSync: readFileSync18,
|
|
235655
236321
|
readFile: readFile10
|
|
235656
236322
|
};
|
|
235657
236323
|
});
|
|
@@ -235694,7 +236360,7 @@ var require_elf = __commonJS((exports, module) => {
|
|
|
235694
236360
|
var require_detect_libc = __commonJS((exports, module) => {
|
|
235695
236361
|
var childProcess = __require("child_process");
|
|
235696
236362
|
var { isLinux: isLinux2, getReport } = require_process();
|
|
235697
|
-
var { LDD_PATH, SELF_PATH, readFile: readFile10, readFileSync:
|
|
236363
|
+
var { LDD_PATH, SELF_PATH, readFile: readFile10, readFileSync: readFileSync18 } = require_filesystem();
|
|
235698
236364
|
var { interpreterPath } = require_elf();
|
|
235699
236365
|
var cachedFamilyInterpreter;
|
|
235700
236366
|
var cachedFamilyFilesystem;
|
|
@@ -235703,10 +236369,10 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
235703
236369
|
var commandOut = "";
|
|
235704
236370
|
var safeCommand = () => {
|
|
235705
236371
|
if (!commandOut) {
|
|
235706
|
-
return new Promise((
|
|
236372
|
+
return new Promise((resolve11) => {
|
|
235707
236373
|
childProcess.exec(command, (err, out) => {
|
|
235708
236374
|
commandOut = err ? " " : out;
|
|
235709
|
-
|
|
236375
|
+
resolve11(commandOut);
|
|
235710
236376
|
});
|
|
235711
236377
|
});
|
|
235712
236378
|
}
|
|
@@ -235785,7 +236451,7 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
235785
236451
|
}
|
|
235786
236452
|
cachedFamilyFilesystem = null;
|
|
235787
236453
|
try {
|
|
235788
|
-
const lddContent =
|
|
236454
|
+
const lddContent = readFileSync18(LDD_PATH);
|
|
235789
236455
|
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
|
|
235790
236456
|
} catch (e5) {}
|
|
235791
236457
|
return cachedFamilyFilesystem;
|
|
@@ -235808,7 +236474,7 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
235808
236474
|
}
|
|
235809
236475
|
cachedFamilyInterpreter = null;
|
|
235810
236476
|
try {
|
|
235811
|
-
const selfContent =
|
|
236477
|
+
const selfContent = readFileSync18(SELF_PATH);
|
|
235812
236478
|
const path5 = interpreterPath(selfContent);
|
|
235813
236479
|
cachedFamilyInterpreter = familyFromInterpreterPath(path5);
|
|
235814
236480
|
} catch (e5) {}
|
|
@@ -235870,7 +236536,7 @@ var require_detect_libc = __commonJS((exports, module) => {
|
|
|
235870
236536
|
}
|
|
235871
236537
|
cachedVersionFilesystem = null;
|
|
235872
236538
|
try {
|
|
235873
|
-
const lddContent =
|
|
236539
|
+
const lddContent = readFileSync18(LDD_PATH);
|
|
235874
236540
|
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
|
|
235875
236541
|
if (versionMatch) {
|
|
235876
236542
|
cachedVersionFilesystem = versionMatch[1];
|
|
@@ -238263,14 +238929,14 @@ var require_input = __commonJS((exports, module) => {
|
|
|
238263
238929
|
return this;
|
|
238264
238930
|
} else {
|
|
238265
238931
|
if (this._isStreamInput()) {
|
|
238266
|
-
return new Promise((
|
|
238932
|
+
return new Promise((resolve11, reject) => {
|
|
238267
238933
|
const finished = () => {
|
|
238268
238934
|
this._flattenBufferIn();
|
|
238269
238935
|
sharp.metadata(this.options, (err, metadata2) => {
|
|
238270
238936
|
if (err) {
|
|
238271
238937
|
reject(is2.nativeError(err, stack));
|
|
238272
238938
|
} else {
|
|
238273
|
-
|
|
238939
|
+
resolve11(metadata2);
|
|
238274
238940
|
}
|
|
238275
238941
|
});
|
|
238276
238942
|
};
|
|
@@ -238281,12 +238947,12 @@ var require_input = __commonJS((exports, module) => {
|
|
|
238281
238947
|
}
|
|
238282
238948
|
});
|
|
238283
238949
|
} else {
|
|
238284
|
-
return new Promise((
|
|
238950
|
+
return new Promise((resolve11, reject) => {
|
|
238285
238951
|
sharp.metadata(this.options, (err, metadata2) => {
|
|
238286
238952
|
if (err) {
|
|
238287
238953
|
reject(is2.nativeError(err, stack));
|
|
238288
238954
|
} else {
|
|
238289
|
-
|
|
238955
|
+
resolve11(metadata2);
|
|
238290
238956
|
}
|
|
238291
238957
|
});
|
|
238292
238958
|
});
|
|
@@ -238319,25 +238985,25 @@ var require_input = __commonJS((exports, module) => {
|
|
|
238319
238985
|
return this;
|
|
238320
238986
|
} else {
|
|
238321
238987
|
if (this._isStreamInput()) {
|
|
238322
|
-
return new Promise((
|
|
238988
|
+
return new Promise((resolve11, reject) => {
|
|
238323
238989
|
this.on("finish", function() {
|
|
238324
238990
|
this._flattenBufferIn();
|
|
238325
238991
|
sharp.stats(this.options, (err, stats2) => {
|
|
238326
238992
|
if (err) {
|
|
238327
238993
|
reject(is2.nativeError(err, stack));
|
|
238328
238994
|
} else {
|
|
238329
|
-
|
|
238995
|
+
resolve11(stats2);
|
|
238330
238996
|
}
|
|
238331
238997
|
});
|
|
238332
238998
|
});
|
|
238333
238999
|
});
|
|
238334
239000
|
} else {
|
|
238335
|
-
return new Promise((
|
|
239001
|
+
return new Promise((resolve11, reject) => {
|
|
238336
239002
|
sharp.stats(this.options, (err, stats2) => {
|
|
238337
239003
|
if (err) {
|
|
238338
239004
|
reject(is2.nativeError(err, stack));
|
|
238339
239005
|
} else {
|
|
238340
|
-
|
|
239006
|
+
resolve11(stats2);
|
|
238341
239007
|
}
|
|
238342
239008
|
});
|
|
238343
239009
|
});
|
|
@@ -241736,7 +242402,7 @@ var require_output = __commonJS((exports, module) => {
|
|
|
241736
242402
|
return this;
|
|
241737
242403
|
} else {
|
|
241738
242404
|
if (this._isStreamInput()) {
|
|
241739
|
-
return new Promise((
|
|
242405
|
+
return new Promise((resolve11, reject) => {
|
|
241740
242406
|
this.once("finish", () => {
|
|
241741
242407
|
this._flattenBufferIn();
|
|
241742
242408
|
sharp.pipeline(this.options, (err, data, info) => {
|
|
@@ -241744,24 +242410,24 @@ var require_output = __commonJS((exports, module) => {
|
|
|
241744
242410
|
reject(is2.nativeError(err, stack));
|
|
241745
242411
|
} else {
|
|
241746
242412
|
if (this.options.resolveWithObject) {
|
|
241747
|
-
|
|
242413
|
+
resolve11({ data, info });
|
|
241748
242414
|
} else {
|
|
241749
|
-
|
|
242415
|
+
resolve11(data);
|
|
241750
242416
|
}
|
|
241751
242417
|
}
|
|
241752
242418
|
});
|
|
241753
242419
|
});
|
|
241754
242420
|
});
|
|
241755
242421
|
} else {
|
|
241756
|
-
return new Promise((
|
|
242422
|
+
return new Promise((resolve11, reject) => {
|
|
241757
242423
|
sharp.pipeline(this.options, (err, data, info) => {
|
|
241758
242424
|
if (err) {
|
|
241759
242425
|
reject(is2.nativeError(err, stack));
|
|
241760
242426
|
} else {
|
|
241761
242427
|
if (this.options.resolveWithObject) {
|
|
241762
|
-
|
|
242428
|
+
resolve11({ data, info });
|
|
241763
242429
|
} else {
|
|
241764
|
-
|
|
242430
|
+
resolve11(data);
|
|
241765
242431
|
}
|
|
241766
242432
|
}
|
|
241767
242433
|
});
|
|
@@ -241997,7 +242663,7 @@ var init_image3 = __esm(() => {
|
|
|
241997
242663
|
|
|
241998
242664
|
// node_modules/.pnpm/ink-picture@1.3.3_ink@6.7.0_@types+react@19.2.14_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-picture/build/utils/queryEscapeSequence.js
|
|
241999
242665
|
function queryEscapeSequence(message, stdin, stdout, setRawMode) {
|
|
242000
|
-
return new Promise((
|
|
242666
|
+
return new Promise((resolve11) => {
|
|
242001
242667
|
const responseTimeout = 100;
|
|
242002
242668
|
let responseTimeoutId = undefined;
|
|
242003
242669
|
const timeoutBetweenReplies = 50;
|
|
@@ -242025,18 +242691,18 @@ function queryEscapeSequence(message, stdin, stdout, setRawMode) {
|
|
|
242025
242691
|
runningReply += data;
|
|
242026
242692
|
timeoutBetweenRepliesId = setTimeout(() => {
|
|
242027
242693
|
restoreState();
|
|
242028
|
-
|
|
242694
|
+
resolve11(runningReply.length > 0 ? runningReply : undefined);
|
|
242029
242695
|
}, timeoutBetweenReplies);
|
|
242030
242696
|
};
|
|
242031
242697
|
const onClose = () => {
|
|
242032
242698
|
restoreState();
|
|
242033
|
-
|
|
242699
|
+
resolve11(runningReply.length > 0 ? runningReply : undefined);
|
|
242034
242700
|
};
|
|
242035
242701
|
stdin.on("data", onData);
|
|
242036
242702
|
stdin.on("close", onClose);
|
|
242037
242703
|
responseTimeoutId = setTimeout(() => {
|
|
242038
242704
|
restoreState();
|
|
242039
|
-
|
|
242705
|
+
resolve11(undefined);
|
|
242040
242706
|
}, responseTimeout);
|
|
242041
242707
|
stdout.write(message);
|
|
242042
242708
|
});
|
|
@@ -242147,12 +242813,12 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
242147
242813
|
if (typeof Promise !== "function") {
|
|
242148
242814
|
throw new TypeError("callback not provided");
|
|
242149
242815
|
}
|
|
242150
|
-
return new Promise(function(
|
|
242816
|
+
return new Promise(function(resolve11, reject) {
|
|
242151
242817
|
isexe(path5, options2 || {}, function(er, is2) {
|
|
242152
242818
|
if (er) {
|
|
242153
242819
|
reject(er);
|
|
242154
242820
|
} else {
|
|
242155
|
-
|
|
242821
|
+
resolve11(is2);
|
|
242156
242822
|
}
|
|
242157
242823
|
});
|
|
242158
242824
|
});
|
|
@@ -242214,27 +242880,27 @@ var require_which = __commonJS((exports, module) => {
|
|
|
242214
242880
|
opt = {};
|
|
242215
242881
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
242216
242882
|
const found = [];
|
|
242217
|
-
const step = (i6) => new Promise((
|
|
242883
|
+
const step = (i6) => new Promise((resolve11, reject) => {
|
|
242218
242884
|
if (i6 === pathEnv.length)
|
|
242219
|
-
return opt.all && found.length ?
|
|
242885
|
+
return opt.all && found.length ? resolve11(found) : reject(getNotFoundError(cmd));
|
|
242220
242886
|
const ppRaw = pathEnv[i6];
|
|
242221
242887
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
242222
242888
|
const pCmd = path5.join(pathPart, cmd);
|
|
242223
242889
|
const p5 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
242224
|
-
|
|
242890
|
+
resolve11(subStep(p5, i6, 0));
|
|
242225
242891
|
});
|
|
242226
|
-
const subStep = (p5, i6, ii) => new Promise((
|
|
242892
|
+
const subStep = (p5, i6, ii) => new Promise((resolve11, reject) => {
|
|
242227
242893
|
if (ii === pathExt.length)
|
|
242228
|
-
return
|
|
242894
|
+
return resolve11(step(i6 + 1));
|
|
242229
242895
|
const ext = pathExt[ii];
|
|
242230
242896
|
isexe(p5 + ext, { pathExt: pathExtExe }, (er, is2) => {
|
|
242231
242897
|
if (!er && is2) {
|
|
242232
242898
|
if (opt.all)
|
|
242233
242899
|
found.push(p5 + ext);
|
|
242234
242900
|
else
|
|
242235
|
-
return
|
|
242901
|
+
return resolve11(p5 + ext);
|
|
242236
242902
|
}
|
|
242237
|
-
return
|
|
242903
|
+
return resolve11(subStep(p5, i6, ii + 1));
|
|
242238
242904
|
});
|
|
242239
242905
|
});
|
|
242240
242906
|
return cb2 ? step(0).then((res) => cb2(null, res), cb2) : step(0);
|
|
@@ -243121,7 +243787,7 @@ var require_kill = __commonJS((exports, module) => {
|
|
|
243121
243787
|
return spawnedPromise;
|
|
243122
243788
|
}
|
|
243123
243789
|
let timeoutId;
|
|
243124
|
-
const timeoutPromise = new Promise((
|
|
243790
|
+
const timeoutPromise = new Promise((resolve11, reject) => {
|
|
243125
243791
|
timeoutId = setTimeout(() => {
|
|
243126
243792
|
timeoutKill(spawned, killSignal, reject);
|
|
243127
243793
|
}, timeout);
|
|
@@ -243232,7 +243898,7 @@ var require_get_stream = __commonJS((exports, module) => {
|
|
|
243232
243898
|
};
|
|
243233
243899
|
const { maxBuffer } = options2;
|
|
243234
243900
|
const stream2 = bufferStream(options2);
|
|
243235
|
-
await new Promise((
|
|
243901
|
+
await new Promise((resolve11, reject) => {
|
|
243236
243902
|
const rejectPromise = (error4) => {
|
|
243237
243903
|
if (error4 && stream2.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
243238
243904
|
error4.bufferedData = stream2.getBufferedValue();
|
|
@@ -243242,7 +243908,7 @@ var require_get_stream = __commonJS((exports, module) => {
|
|
|
243242
243908
|
(async () => {
|
|
243243
243909
|
try {
|
|
243244
243910
|
await streamPipelinePromisified(inputStream, stream2);
|
|
243245
|
-
|
|
243911
|
+
resolve11();
|
|
243246
243912
|
} catch (error4) {
|
|
243247
243913
|
rejectPromise(error4);
|
|
243248
243914
|
}
|
|
@@ -243389,9 +244055,9 @@ var require_promise = __commonJS((exports, module) => {
|
|
|
243389
244055
|
return spawned;
|
|
243390
244056
|
};
|
|
243391
244057
|
var getSpawnedPromise = (spawned) => {
|
|
243392
|
-
return new Promise((
|
|
244058
|
+
return new Promise((resolve11, reject) => {
|
|
243393
244059
|
spawned.on("exit", (exitCode, signal) => {
|
|
243394
|
-
|
|
244060
|
+
resolve11({ exitCode, signal });
|
|
243395
244061
|
});
|
|
243396
244062
|
spawned.on("error", (error4) => {
|
|
243397
244063
|
reject(error4);
|
|
@@ -243683,13 +244349,13 @@ async function appPath(appName) {
|
|
|
243683
244349
|
throw new TypeError("Please supply an app name or bundle identifier");
|
|
243684
244350
|
}
|
|
243685
244351
|
try {
|
|
243686
|
-
const { stdout } = await import_execa.default("./main", [appName], { cwd:
|
|
244352
|
+
const { stdout } = await import_execa.default("./main", [appName], { cwd: dirname20 });
|
|
243687
244353
|
return stdout;
|
|
243688
244354
|
} catch (error4) {
|
|
243689
244355
|
throw improveError(error4);
|
|
243690
244356
|
}
|
|
243691
244357
|
}
|
|
243692
|
-
var import_execa,
|
|
244358
|
+
var import_execa, dirname20, improveError = (error4) => {
|
|
243693
244359
|
if (error4.exitCode === 2) {
|
|
243694
244360
|
error4.message = "Couldn't find the app";
|
|
243695
244361
|
}
|
|
@@ -243697,7 +244363,7 @@ var import_execa, dirname19, improveError = (error4) => {
|
|
|
243697
244363
|
};
|
|
243698
244364
|
var init_app_path = __esm(() => {
|
|
243699
244365
|
import_execa = __toESM(require_execa(), 1);
|
|
243700
|
-
|
|
244366
|
+
dirname20 = path5.dirname(fileURLToPath8(import.meta.url));
|
|
243701
244367
|
appPath.sync = (appName) => {
|
|
243702
244368
|
if (process.platform !== "darwin") {
|
|
243703
244369
|
throw new Error("macOS only");
|
|
@@ -243706,7 +244372,7 @@ var init_app_path = __esm(() => {
|
|
|
243706
244372
|
throw new TypeError("Please supply an app name or bundle identifier");
|
|
243707
244373
|
}
|
|
243708
244374
|
try {
|
|
243709
|
-
return import_execa.default.sync("./main", [appName], { cwd:
|
|
244375
|
+
return import_execa.default.sync("./main", [appName], { cwd: dirname20 }).stdout;
|
|
243710
244376
|
} catch (error4) {
|
|
243711
244377
|
throw improveError(error4);
|
|
243712
244378
|
}
|
|
@@ -257025,8 +257691,8 @@ await __promiseAll([
|
|
|
257025
257691
|
]);
|
|
257026
257692
|
var import_react86 = __toESM(require_react(), 1);
|
|
257027
257693
|
import { spawn as spawn6 } from "child_process";
|
|
257028
|
-
import { join as
|
|
257029
|
-
import { homedir as
|
|
257694
|
+
import { join as join48 } from "path";
|
|
257695
|
+
import { homedir as homedir26 } from "os";
|
|
257030
257696
|
|
|
257031
257697
|
// packages/terminal/src/components/Input.tsx
|
|
257032
257698
|
await init_build2();
|
|
@@ -259656,7 +260322,7 @@ function Messages5({
|
|
|
259656
260322
|
queuedMessageIds,
|
|
259657
260323
|
verboseTools = false
|
|
259658
260324
|
}) {
|
|
259659
|
-
const [
|
|
260325
|
+
const [now4, setNow] = import_react41.useState(Date.now());
|
|
259660
260326
|
const messageGroups = import_react41.useMemo(() => groupConsecutiveToolMessages(messages2), [messages2]);
|
|
259661
260327
|
const messageItems = import_react41.useMemo(() => {
|
|
259662
260328
|
return messageGroups.map((group) => group.type === "single" ? { kind: "message", message: group.message } : { kind: "grouped", messages: group.messages });
|
|
@@ -259733,7 +260399,7 @@ function Messages5({
|
|
|
259733
260399
|
}, entry.id, true, undefined, this)),
|
|
259734
260400
|
visibleActivity.some((entry) => entry.type === "tool_call") && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ActiveToolsPanel, {
|
|
259735
260401
|
activityLog: visibleActivity,
|
|
259736
|
-
now:
|
|
260402
|
+
now: now4,
|
|
259737
260403
|
verboseTools
|
|
259738
260404
|
}, undefined, false, undefined, this),
|
|
259739
260405
|
visibleStreaming.map((message) => /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(MessageBubble, {
|
|
@@ -259896,7 +260562,7 @@ function MessageBubble({ message, queuedMessageIds, verboseTools }) {
|
|
|
259896
260562
|
]
|
|
259897
260563
|
}, undefined, true, undefined, this);
|
|
259898
260564
|
}
|
|
259899
|
-
function ActiveToolsPanel({ activityLog, now:
|
|
260565
|
+
function ActiveToolsPanel({ activityLog, now: now4, verboseTools }) {
|
|
259900
260566
|
const toolCalls = import_react41.useMemo(() => {
|
|
259901
260567
|
const calls = [];
|
|
259902
260568
|
const resultMap = new Map;
|
|
@@ -259908,7 +260574,7 @@ function ActiveToolsPanel({ activityLog, now: now3, verboseTools }) {
|
|
|
259908
260574
|
});
|
|
259909
260575
|
}
|
|
259910
260576
|
}
|
|
259911
|
-
const
|
|
260577
|
+
const now5 = Date.now();
|
|
259912
260578
|
for (const entry of activityLog) {
|
|
259913
260579
|
if (entry.type === "tool_call" && entry.toolCall) {
|
|
259914
260580
|
const resultInfo = resultMap.get(entry.toolCall.id);
|
|
@@ -259916,7 +260582,7 @@ function ActiveToolsPanel({ activityLog, now: now3, verboseTools }) {
|
|
|
259916
260582
|
if (resultInfo) {
|
|
259917
260583
|
status = resultInfo.result.isError ? "failed" : "succeeded";
|
|
259918
260584
|
} else {
|
|
259919
|
-
const elapsed =
|
|
260585
|
+
const elapsed = now5 - entry.timestamp;
|
|
259920
260586
|
status = elapsed > 60000 ? "failed" : "running";
|
|
259921
260587
|
}
|
|
259922
260588
|
calls.push({
|
|
@@ -259970,7 +260636,7 @@ function ActiveToolsPanel({ activityLog, now: now3, verboseTools }) {
|
|
|
259970
260636
|
children: toolCalls.map((call) => {
|
|
259971
260637
|
const icon = call.status === "running" ? "\u25CB" : call.status === "failed" ? "\u2717" : "\u25CF";
|
|
259972
260638
|
const iconColor = call.status === "running" ? "gray" : call.status === "failed" ? "red" : "green";
|
|
259973
|
-
const elapsedMs = (call.endTime ??
|
|
260639
|
+
const elapsedMs = (call.endTime ?? now4) - call.startTime;
|
|
259974
260640
|
const elapsedText = formatDuration3(elapsedMs);
|
|
259975
260641
|
const title = getToolCallTitle(call.toolCall);
|
|
259976
260642
|
const prefix = call.status === "running" ? "Calling " : "";
|
|
@@ -260854,7 +261520,7 @@ function Status({
|
|
|
260854
261520
|
if (recentTools.length === 0)
|
|
260855
261521
|
return "";
|
|
260856
261522
|
const counts = new Map;
|
|
260857
|
-
const
|
|
261523
|
+
const now4 = Date.now();
|
|
260858
261524
|
for (const tool2 of recentTools) {
|
|
260859
261525
|
const existing = counts.get(tool2.name) || { count: 0, failed: 0, running: 0, maxElapsed: 0 };
|
|
260860
261526
|
existing.count++;
|
|
@@ -260863,7 +261529,7 @@ function Status({
|
|
|
260863
261529
|
if (tool2.status === "running") {
|
|
260864
261530
|
existing.running++;
|
|
260865
261531
|
if (tool2.startedAt) {
|
|
260866
|
-
const elapsedSec = Math.floor((
|
|
261532
|
+
const elapsedSec = Math.floor((now4 - tool2.startedAt) / 1000);
|
|
260867
261533
|
existing.maxElapsed = Math.max(existing.maxElapsed, elapsedSec);
|
|
260868
261534
|
}
|
|
260869
261535
|
}
|
|
@@ -260928,7 +261594,7 @@ function Status({
|
|
|
260928
261594
|
// packages/terminal/src/components/Spinner.tsx
|
|
260929
261595
|
await init_build2();
|
|
260930
261596
|
|
|
260931
|
-
// node_modules/.pnpm/ink-spinner@5.0.0_ink@6.7.0_@types+react@19.2.14_react@19.2.4__react@19.2.4/node_modules/ink-spinner/build/index.js
|
|
261597
|
+
// node_modules/.pnpm/ink-spinner@5.0.0_ink@6.7.0_@types+react@19.2.14_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-spinner/build/index.js
|
|
260932
261598
|
await init_build2();
|
|
260933
261599
|
var import_react43 = __toESM(require_react(), 1);
|
|
260934
261600
|
var import_cli_spinners = __toESM(require_cli_spinners(), 1);
|
|
@@ -261132,8 +261798,8 @@ var import_react45 = __toESM(require_react(), 1);
|
|
|
261132
261798
|
var jsx_dev_runtime9 = __toESM(require_jsx_dev_runtime(), 1);
|
|
261133
261799
|
function formatSessionTime(timestamp) {
|
|
261134
261800
|
const date3 = new Date(timestamp);
|
|
261135
|
-
const
|
|
261136
|
-
const isToday = date3.toDateString() ===
|
|
261801
|
+
const now4 = new Date;
|
|
261802
|
+
const isToday = date3.toDateString() === now4.toDateString();
|
|
261137
261803
|
if (isToday) {
|
|
261138
261804
|
return date3.toLocaleTimeString("en-US", {
|
|
261139
261805
|
hour: "numeric",
|
|
@@ -262258,7 +262924,7 @@ function RecoveryPanel({ sessions, onRecover, onStartFresh }) {
|
|
|
262258
262924
|
await init_build2();
|
|
262259
262925
|
var import_react49 = __toESM(require_react(), 1);
|
|
262260
262926
|
|
|
262261
|
-
// node_modules/.pnpm/ink-text-input@6.0.0_ink@6.7.0_@types+react@19.2.14_react@19.2.4__react@19.2.4/node_modules/ink-text-input/build/index.js
|
|
262927
|
+
// node_modules/.pnpm/ink-text-input@6.0.0_ink@6.7.0_@types+react@19.2.14_react-devtools-core@7.0.1_react@19.2.4__react@19.2.4/node_modules/ink-text-input/build/index.js
|
|
262262
262928
|
init_source();
|
|
262263
262929
|
await init_build2();
|
|
262264
262930
|
var import_react48 = __toESM(require_react(), 1);
|
|
@@ -263322,8 +263988,8 @@ var PRIORITY_COLORS = {
|
|
|
263322
263988
|
};
|
|
263323
263989
|
function formatTaskTime(timestamp) {
|
|
263324
263990
|
const date3 = new Date(timestamp);
|
|
263325
|
-
const
|
|
263326
|
-
const isToday = date3.toDateString() ===
|
|
263991
|
+
const now4 = new Date;
|
|
263992
|
+
const isToday = date3.toDateString() === now4.toDateString();
|
|
263327
263993
|
if (isToday) {
|
|
263328
263994
|
return date3.toLocaleTimeString("en-US", {
|
|
263329
263995
|
hour: "numeric",
|
|
@@ -264172,8 +264838,8 @@ init_src2();
|
|
|
264172
264838
|
var jsx_dev_runtime17 = __toESM(require_jsx_dev_runtime(), 1);
|
|
264173
264839
|
function formatTime(timestamp) {
|
|
264174
264840
|
const date3 = new Date(timestamp);
|
|
264175
|
-
const
|
|
264176
|
-
const isToday = date3.toDateString() ===
|
|
264841
|
+
const now4 = new Date;
|
|
264842
|
+
const isToday = date3.toDateString() === now4.toDateString();
|
|
264177
264843
|
if (isToday) {
|
|
264178
264844
|
return date3.toLocaleTimeString("en-US", {
|
|
264179
264845
|
hour: "numeric",
|
|
@@ -269302,8 +269968,8 @@ function getVisibleRange3(selectedIndex, totalItems, maxVisible = MAX_VISIBLE_IT
|
|
|
269302
269968
|
}
|
|
269303
269969
|
function formatRelativeTime2(isoDate) {
|
|
269304
269970
|
const date3 = new Date(isoDate);
|
|
269305
|
-
const
|
|
269306
|
-
const diffMs =
|
|
269971
|
+
const now4 = new Date;
|
|
269972
|
+
const diffMs = now4.getTime() - date3.getTime();
|
|
269307
269973
|
const diffMin = Math.floor(diffMs / 60000);
|
|
269308
269974
|
const diffHours = Math.floor(diffMin / 60);
|
|
269309
269975
|
const diffDays = Math.floor(diffHours / 24);
|
|
@@ -269938,8 +270604,8 @@ function getVisibleRange4(selectedIndex, totalItems, maxVisible = MAX_VISIBLE_IT
|
|
|
269938
270604
|
}
|
|
269939
270605
|
function formatRelativeTime3(isoDate) {
|
|
269940
270606
|
const date3 = new Date(isoDate);
|
|
269941
|
-
const
|
|
269942
|
-
const diffMs =
|
|
270607
|
+
const now4 = new Date;
|
|
270608
|
+
const diffMs = now4.getTime() - date3.getTime();
|
|
269943
270609
|
const diffMin = Math.floor(diffMs / 60000);
|
|
269944
270610
|
const diffHours = Math.floor(diffMin / 60);
|
|
269945
270611
|
const diffDays = Math.floor(diffHours / 24);
|
|
@@ -271720,10 +272386,10 @@ function ChannelsPanel({ manager, onClose, activePersonId, activePersonName, act
|
|
|
271720
272386
|
onChange: handleChatInputChange,
|
|
271721
272387
|
onSubmit: () => {
|
|
271722
272388
|
if (chatInput.trim()) {
|
|
271723
|
-
const
|
|
271724
|
-
if (
|
|
272389
|
+
const now4 = Date.now();
|
|
272390
|
+
if (now4 - lastSubmitTimeRef.current < 500)
|
|
271725
272391
|
return;
|
|
271726
|
-
lastSubmitTimeRef.current =
|
|
272392
|
+
lastSubmitTimeRef.current = now4;
|
|
271727
272393
|
const msg = chatInput.trim();
|
|
271728
272394
|
const result = activePersonId && activePersonName ? manager.sendAs(selectedChannel.id, msg, activePersonId, activePersonName) : manager.send(selectedChannel.id, msg);
|
|
271729
272395
|
if (result.success) {
|
|
@@ -279622,7 +280288,7 @@ function cloneConfig(config2) {
|
|
|
279622
280288
|
return JSON.parse(JSON.stringify(config2 || {}));
|
|
279623
280289
|
}
|
|
279624
280290
|
function createEmptyUsage2() {
|
|
279625
|
-
const
|
|
280291
|
+
const now4 = new Date().toISOString();
|
|
279626
280292
|
return {
|
|
279627
280293
|
inputTokens: 0,
|
|
279628
280294
|
outputTokens: 0,
|
|
@@ -279630,8 +280296,8 @@ function createEmptyUsage2() {
|
|
|
279630
280296
|
llmCalls: 0,
|
|
279631
280297
|
toolCalls: 0,
|
|
279632
280298
|
durationMs: 0,
|
|
279633
|
-
periodStartedAt:
|
|
279634
|
-
lastUpdatedAt:
|
|
280299
|
+
periodStartedAt: now4,
|
|
280300
|
+
lastUpdatedAt: now4
|
|
279635
280301
|
};
|
|
279636
280302
|
}
|
|
279637
280303
|
function createDraftStatus(scope, limits2) {
|
|
@@ -280449,8 +281115,8 @@ function formatUptime(seconds) {
|
|
|
280449
281115
|
}
|
|
280450
281116
|
function formatTimestamp(iso) {
|
|
280451
281117
|
const date3 = new Date(iso);
|
|
280452
|
-
const
|
|
280453
|
-
const diff2 =
|
|
281118
|
+
const now4 = new Date;
|
|
281119
|
+
const diff2 = now4.getTime() - date3.getTime();
|
|
280454
281120
|
if (diff2 < 60000)
|
|
280455
281121
|
return "just now";
|
|
280456
281122
|
if (diff2 < 3600000)
|
|
@@ -281310,8 +281976,8 @@ function getActionDisplay(schedule) {
|
|
|
281310
281976
|
function formatRelativeTime9(timestamp) {
|
|
281311
281977
|
if (!timestamp)
|
|
281312
281978
|
return "n/a";
|
|
281313
|
-
const
|
|
281314
|
-
const diff2 = timestamp -
|
|
281979
|
+
const now4 = Date.now();
|
|
281980
|
+
const diff2 = timestamp - now4;
|
|
281315
281981
|
const absDiff = Math.abs(diff2);
|
|
281316
281982
|
const isPast = diff2 < 0;
|
|
281317
281983
|
const seconds = Math.floor(absDiff / 1000);
|
|
@@ -283798,8 +284464,8 @@ var import_react77 = __toESM(require_react(), 1);
|
|
|
283798
284464
|
var jsx_dev_runtime41 = __toESM(require_jsx_dev_runtime(), 1);
|
|
283799
284465
|
function formatProjectTime(timestamp) {
|
|
283800
284466
|
const date3 = new Date(timestamp);
|
|
283801
|
-
const
|
|
283802
|
-
const isToday = date3.toDateString() ===
|
|
284467
|
+
const now4 = new Date;
|
|
284468
|
+
const isToday = date3.toDateString() === now4.toDateString();
|
|
283803
284469
|
if (isToday) {
|
|
283804
284470
|
return date3.toLocaleTimeString("en-US", {
|
|
283805
284471
|
hour: "numeric",
|
|
@@ -284202,8 +284868,8 @@ function getNextStatus(current) {
|
|
|
284202
284868
|
}
|
|
284203
284869
|
function formatPlanTime(timestamp) {
|
|
284204
284870
|
const date3 = new Date(timestamp);
|
|
284205
|
-
const
|
|
284206
|
-
const isToday = date3.toDateString() ===
|
|
284871
|
+
const now4 = new Date;
|
|
284872
|
+
const isToday = date3.toDateString() === now4.toDateString();
|
|
284207
284873
|
if (isToday) {
|
|
284208
284874
|
return date3.toLocaleTimeString("en-US", {
|
|
284209
284875
|
hour: "numeric",
|
|
@@ -287465,9 +288131,9 @@ var EVENT_TYPE_LABELS = {
|
|
|
287465
288131
|
validation_failure: "Validation Failure"
|
|
287466
288132
|
};
|
|
287467
288133
|
function formatRelativeTime11(isoTimestamp) {
|
|
287468
|
-
const
|
|
288134
|
+
const now4 = Date.now();
|
|
287469
288135
|
const ts = new Date(isoTimestamp).getTime();
|
|
287470
|
-
const diff2 =
|
|
288136
|
+
const diff2 = now4 - ts;
|
|
287471
288137
|
const seconds = Math.floor(diff2 / 1000);
|
|
287472
288138
|
const minutes = Math.floor(seconds / 60);
|
|
287473
288139
|
const hours = Math.floor(minutes / 60);
|
|
@@ -287834,9 +288500,9 @@ var jsx_dev_runtime49 = __toESM(require_jsx_dev_runtime(), 1);
|
|
|
287834
288500
|
function formatRelativeTime12(iso) {
|
|
287835
288501
|
if (!iso)
|
|
287836
288502
|
return "n/a";
|
|
287837
|
-
const
|
|
288503
|
+
const now4 = Date.now();
|
|
287838
288504
|
const ts = new Date(iso).getTime();
|
|
287839
|
-
const diff2 =
|
|
288505
|
+
const diff2 = now4 - ts;
|
|
287840
288506
|
const seconds = Math.floor(diff2 / 1000);
|
|
287841
288507
|
const minutes = Math.floor(seconds / 60);
|
|
287842
288508
|
const hours = Math.floor(minutes / 60);
|
|
@@ -288478,7 +289144,7 @@ await init_src3();
|
|
|
288478
289144
|
// packages/terminal/src/lib/budgets.ts
|
|
288479
289145
|
init_src2();
|
|
288480
289146
|
await init_src3();
|
|
288481
|
-
import { join as
|
|
289147
|
+
import { join as join47 } from "path";
|
|
288482
289148
|
import { mkdir as mkdir9, readFile as readFile10, writeFile as writeFile9 } from "fs/promises";
|
|
288483
289149
|
var PROFILES_FILE = "budgets.json";
|
|
288484
289150
|
var SESSION_MAP_FILE = "budget-sessions.json";
|
|
@@ -288486,7 +289152,7 @@ var DEFAULT_PROFILE_ID = "default";
|
|
|
288486
289152
|
function cloneConfig2(config2) {
|
|
288487
289153
|
return JSON.parse(JSON.stringify(config2 || DEFAULT_BUDGET_CONFIG));
|
|
288488
289154
|
}
|
|
288489
|
-
async function
|
|
289155
|
+
async function ensureDir3(baseDir) {
|
|
288490
289156
|
await mkdir9(baseDir, { recursive: true });
|
|
288491
289157
|
}
|
|
288492
289158
|
async function readJsonFile2(path7) {
|
|
@@ -288501,19 +289167,19 @@ async function writeJsonFile(path7, data) {
|
|
|
288501
289167
|
await writeFile9(path7, JSON.stringify(data, null, 2), "utf-8");
|
|
288502
289168
|
}
|
|
288503
289169
|
async function loadBudgetProfiles(baseDir, seedConfig) {
|
|
288504
|
-
await
|
|
288505
|
-
const path7 =
|
|
289170
|
+
await ensureDir3(baseDir);
|
|
289171
|
+
const path7 = join47(baseDir, PROFILES_FILE);
|
|
288506
289172
|
const data = await readJsonFile2(path7);
|
|
288507
289173
|
const profiles = Array.isArray(data?.profiles) ? data.profiles : [];
|
|
288508
289174
|
if (profiles.length === 0) {
|
|
288509
|
-
const
|
|
289175
|
+
const now4 = Date.now();
|
|
288510
289176
|
const defaultProfile = {
|
|
288511
289177
|
id: DEFAULT_PROFILE_ID,
|
|
288512
289178
|
name: "Default",
|
|
288513
289179
|
description: "Default budget profile",
|
|
288514
289180
|
config: cloneConfig2(seedConfig),
|
|
288515
|
-
createdAt:
|
|
288516
|
-
updatedAt:
|
|
289181
|
+
createdAt: now4,
|
|
289182
|
+
updatedAt: now4
|
|
288517
289183
|
};
|
|
288518
289184
|
await writeJsonFile(path7, { profiles: [defaultProfile] });
|
|
288519
289185
|
return [defaultProfile];
|
|
@@ -288521,20 +289187,20 @@ async function loadBudgetProfiles(baseDir, seedConfig) {
|
|
|
288521
289187
|
return profiles;
|
|
288522
289188
|
}
|
|
288523
289189
|
async function saveBudgetProfiles(baseDir, profiles) {
|
|
288524
|
-
await
|
|
288525
|
-
const path7 =
|
|
289190
|
+
await ensureDir3(baseDir);
|
|
289191
|
+
const path7 = join47(baseDir, PROFILES_FILE);
|
|
288526
289192
|
await writeJsonFile(path7, { profiles });
|
|
288527
289193
|
}
|
|
288528
289194
|
async function createBudgetProfile(baseDir, name, config2, description) {
|
|
288529
289195
|
const profiles = await loadBudgetProfiles(baseDir, config2);
|
|
288530
|
-
const
|
|
289196
|
+
const now4 = Date.now();
|
|
288531
289197
|
const profile = {
|
|
288532
289198
|
id: `budget_${generateId().slice(0, 8)}`,
|
|
288533
289199
|
name: name.trim(),
|
|
288534
289200
|
description: description?.trim() || undefined,
|
|
288535
289201
|
config: cloneConfig2(config2),
|
|
288536
|
-
createdAt:
|
|
288537
|
-
updatedAt:
|
|
289202
|
+
createdAt: now4,
|
|
289203
|
+
updatedAt: now4
|
|
288538
289204
|
};
|
|
288539
289205
|
profiles.push(profile);
|
|
288540
289206
|
await saveBudgetProfiles(baseDir, profiles);
|
|
@@ -288559,14 +289225,14 @@ async function deleteBudgetProfile(baseDir, id) {
|
|
|
288559
289225
|
return true;
|
|
288560
289226
|
}
|
|
288561
289227
|
async function loadSessionBudgetMap(baseDir) {
|
|
288562
|
-
await
|
|
288563
|
-
const path7 =
|
|
289228
|
+
await ensureDir3(baseDir);
|
|
289229
|
+
const path7 = join47(baseDir, SESSION_MAP_FILE);
|
|
288564
289230
|
const data = await readJsonFile2(path7);
|
|
288565
289231
|
return data || {};
|
|
288566
289232
|
}
|
|
288567
289233
|
async function saveSessionBudgetMap(baseDir, map3) {
|
|
288568
|
-
await
|
|
288569
|
-
const path7 =
|
|
289234
|
+
await ensureDir3(baseDir);
|
|
289235
|
+
const path7 = join47(baseDir, SESSION_MAP_FILE);
|
|
288570
289236
|
await writeJsonFile(path7, map3);
|
|
288571
289237
|
}
|
|
288572
289238
|
|
|
@@ -288592,7 +289258,7 @@ var HOOK_TYPE_SET = new Set(["command", "prompt", "assistant"]);
|
|
|
288592
289258
|
var HOOK_LOCATION_SET = new Set(["project", "user", "local"]);
|
|
288593
289259
|
var HOOK_EVENT_MAP = new Map(Array.from(HOOK_EVENT_SET).map((ev) => [ev.toLowerCase(), ev]));
|
|
288594
289260
|
async function runShellCommand(command, cwd3) {
|
|
288595
|
-
return new Promise((
|
|
289261
|
+
return new Promise((resolve11, reject) => {
|
|
288596
289262
|
const child = spawn6(command, { cwd: cwd3, shell: true, env: process.env });
|
|
288597
289263
|
const stdoutChunks = [];
|
|
288598
289264
|
const stderrChunks = [];
|
|
@@ -288621,7 +289287,7 @@ async function runShellCommand(command, cwd3) {
|
|
|
288621
289287
|
}
|
|
288622
289288
|
child.on("error", (error4) => reject(error4));
|
|
288623
289289
|
child.on("close", (code3) => {
|
|
288624
|
-
|
|
289290
|
+
resolve11({
|
|
288625
289291
|
stdout: Buffer.concat(stdoutChunks).toString("utf8").trimEnd(),
|
|
288626
289292
|
stderr: Buffer.concat(stderrChunks).toString("utf8").trimEnd(),
|
|
288627
289293
|
exitCode: code3,
|
|
@@ -288690,13 +289356,13 @@ function formatElapsedDuration(ms) {
|
|
|
288690
289356
|
const secs = totalSeconds % 60;
|
|
288691
289357
|
return `${mins}m ${secs}s`;
|
|
288692
289358
|
}
|
|
288693
|
-
function
|
|
289359
|
+
function deepMerge3(target, source) {
|
|
288694
289360
|
const output = { ...target };
|
|
288695
289361
|
for (const key of Object.keys(source)) {
|
|
288696
289362
|
const sourceValue = source[key];
|
|
288697
289363
|
const targetValue = target[key];
|
|
288698
289364
|
if (sourceValue && typeof sourceValue === "object" && !Array.isArray(sourceValue) && targetValue && typeof targetValue === "object" && !Array.isArray(targetValue)) {
|
|
288699
|
-
output[key] =
|
|
289365
|
+
output[key] = deepMerge3(targetValue, sourceValue);
|
|
288700
289366
|
} else if (sourceValue !== undefined) {
|
|
288701
289367
|
output[key] = sourceValue;
|
|
288702
289368
|
}
|
|
@@ -288868,8 +289534,8 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
288868
289534
|
const fileListCacheRef = import_react86.useRef({ files: [], timestamp: 0 });
|
|
288869
289535
|
const searchFiles = import_react86.useCallback((query2) => {
|
|
288870
289536
|
const cache7 = fileListCacheRef.current;
|
|
288871
|
-
const
|
|
288872
|
-
if (
|
|
289537
|
+
const now4 = Date.now();
|
|
289538
|
+
if (now4 - cache7.timestamp > 30000 || cache7.files.length === 0) {
|
|
288873
289539
|
try {
|
|
288874
289540
|
const { execSync } = __require("child_process");
|
|
288875
289541
|
let output;
|
|
@@ -288890,7 +289556,7 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
288890
289556
|
}
|
|
288891
289557
|
cache7.files = output.trim().split(`
|
|
288892
289558
|
`).filter(Boolean).slice(0, 2000);
|
|
288893
|
-
cache7.timestamp =
|
|
289559
|
+
cache7.timestamp = now4;
|
|
288894
289560
|
} catch {
|
|
288895
289561
|
return [];
|
|
288896
289562
|
}
|
|
@@ -288938,7 +289604,7 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
288938
289604
|
setInlinePending((prev) => prev.filter((msg) => msg.id !== id));
|
|
288939
289605
|
}, []);
|
|
288940
289606
|
const beginAskUser = import_react86.useCallback((sessionId, request2) => {
|
|
288941
|
-
return new Promise((
|
|
289607
|
+
return new Promise((resolve11, reject) => {
|
|
288942
289608
|
if (askUserStateRef.current.has(sessionId)) {
|
|
288943
289609
|
reject(new Error("Another interview is already in progress for this session."));
|
|
288944
289610
|
return;
|
|
@@ -288948,7 +289614,7 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
288948
289614
|
request: request2,
|
|
288949
289615
|
index: 0,
|
|
288950
289616
|
answers: {},
|
|
288951
|
-
resolve:
|
|
289617
|
+
resolve: resolve11,
|
|
288952
289618
|
reject
|
|
288953
289619
|
};
|
|
288954
289620
|
askUserStateRef.current.set(sessionId, state);
|
|
@@ -289019,7 +289685,7 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
289019
289685
|
}
|
|
289020
289686
|
}, [activeSessionId]);
|
|
289021
289687
|
const beginInterview = import_react86.useCallback((sessionId, request2) => {
|
|
289022
|
-
return new Promise((
|
|
289688
|
+
return new Promise((resolve11, reject) => {
|
|
289023
289689
|
if (interviewStateRef.current.has(sessionId)) {
|
|
289024
289690
|
reject(new Error("Another interview is already in progress for this session."));
|
|
289025
289691
|
return;
|
|
@@ -289036,7 +289702,7 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
289036
289702
|
sessionId,
|
|
289037
289703
|
interviewId,
|
|
289038
289704
|
request: request2,
|
|
289039
|
-
resolve:
|
|
289705
|
+
resolve: resolve11,
|
|
289040
289706
|
reject
|
|
289041
289707
|
};
|
|
289042
289708
|
interviewStateRef.current.set(sessionId, state);
|
|
@@ -289086,9 +289752,9 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
289086
289752
|
}, [processingStartTime]);
|
|
289087
289753
|
import_react86.useEffect(() => {
|
|
289088
289754
|
if (isProcessing && !processingStartTime) {
|
|
289089
|
-
const
|
|
289090
|
-
setProcessingStartTime(
|
|
289091
|
-
processingStartTimeRef.current =
|
|
289755
|
+
const now4 = Date.now();
|
|
289756
|
+
setProcessingStartTime(now4);
|
|
289757
|
+
processingStartTimeRef.current = now4;
|
|
289092
289758
|
}
|
|
289093
289759
|
}, [isProcessing, processingStartTime]);
|
|
289094
289760
|
import_react86.useEffect(() => {
|
|
@@ -290373,13 +291039,13 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
290373
291039
|
});
|
|
290374
291040
|
}, [recoverableSessions, createSessionFromRecovery, workspaceBaseDir]);
|
|
290375
291041
|
const handleOnboardingComplete = import_react86.useCallback(async (result) => {
|
|
290376
|
-
const { existsSync: existsSync30, mkdirSync:
|
|
290377
|
-
const secretsPath =
|
|
291042
|
+
const { existsSync: existsSync30, mkdirSync: mkdirSync19, readFileSync: readFileSync18, writeFileSync: writeFileSync13, appendFileSync: appendFileSync5 } = await import("fs");
|
|
291043
|
+
const secretsPath = join48(homedir26(), ".secrets");
|
|
290378
291044
|
const providerInfo = getProviderInfo(result.provider);
|
|
290379
291045
|
const envName = providerInfo?.apiKeyEnv || "ANTHROPIC_API_KEY";
|
|
290380
291046
|
const keyExport = `export ${envName}="${result.apiKey}"`;
|
|
290381
291047
|
if (existsSync30(secretsPath)) {
|
|
290382
|
-
const content3 =
|
|
291048
|
+
const content3 = readFileSync18(secretsPath, "utf-8");
|
|
290383
291049
|
if (content3.includes(envName)) {
|
|
290384
291050
|
const updated = content3.replace(new RegExp(`^export ${envName}=.*$`, "m"), keyExport);
|
|
290385
291051
|
writeFileSync13(secretsPath, updated, "utf-8");
|
|
@@ -290395,7 +291061,7 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
290395
291061
|
for (const [name, key] of Object.entries(result.connectorKeys)) {
|
|
290396
291062
|
const envName2 = `${name.toUpperCase()}_API_KEY`;
|
|
290397
291063
|
const connKeyExport = `export ${envName2}="${key}"`;
|
|
290398
|
-
const content3 =
|
|
291064
|
+
const content3 = readFileSync18(secretsPath, "utf-8");
|
|
290399
291065
|
if (content3.includes(envName2)) {
|
|
290400
291066
|
const updated = content3.replace(new RegExp(`^export ${envName2}=.*$`, "m"), connKeyExport);
|
|
290401
291067
|
writeFileSync13(secretsPath, updated, "utf-8");
|
|
@@ -290406,13 +291072,13 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
290406
291072
|
}
|
|
290407
291073
|
const configDir = workspaceBaseDir || getConfigDir();
|
|
290408
291074
|
if (!existsSync30(configDir)) {
|
|
290409
|
-
|
|
291075
|
+
mkdirSync19(configDir, { recursive: true });
|
|
290410
291076
|
}
|
|
290411
|
-
const configPath =
|
|
291077
|
+
const configPath = join48(configDir, "config.json");
|
|
290412
291078
|
let existingConfig = {};
|
|
290413
291079
|
if (existsSync30(configPath)) {
|
|
290414
291080
|
try {
|
|
290415
|
-
existingConfig = JSON.parse(
|
|
291081
|
+
existingConfig = JSON.parse(readFileSync18(configPath, "utf-8"));
|
|
290416
291082
|
} catch {}
|
|
290417
291083
|
}
|
|
290418
291084
|
const newConfig = {
|
|
@@ -290464,13 +291130,13 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
290464
291130
|
if (isOnboardingCompleted()) {
|
|
290465
291131
|
needsOnboarding = false;
|
|
290466
291132
|
} else {
|
|
290467
|
-
const configPath =
|
|
290468
|
-
const { existsSync: existsSync30, readFileSync:
|
|
291133
|
+
const configPath = join48(workspaceBaseDir || getConfigDir(), "config.json");
|
|
291134
|
+
const { existsSync: existsSync30, readFileSync: readFileSync18 } = await import("fs");
|
|
290469
291135
|
if (!existsSync30(configPath)) {
|
|
290470
291136
|
needsOnboarding = true;
|
|
290471
291137
|
} else {
|
|
290472
291138
|
try {
|
|
290473
|
-
const raw =
|
|
291139
|
+
const raw = readFileSync18(configPath, "utf-8");
|
|
290474
291140
|
const parsed = JSON.parse(raw);
|
|
290475
291141
|
if (!parsed.onboardingCompleted) {
|
|
290476
291142
|
needsOnboarding = true;
|
|
@@ -290674,41 +291340,6 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
290674
291340
|
}
|
|
290675
291341
|
return result;
|
|
290676
291342
|
}, [messages2, wrapChars, renderWidth]);
|
|
290677
|
-
const [lastResponseMessages, setLastResponseMessages] = import_react86.useState([]);
|
|
290678
|
-
import_react86.useEffect(() => {
|
|
290679
|
-
if (displayMessages.length === 0)
|
|
290680
|
-
return;
|
|
290681
|
-
let lastUserIdx = -1;
|
|
290682
|
-
for (let i6 = displayMessages.length - 1;i6 >= 0; i6--) {
|
|
290683
|
-
if (displayMessages[i6].role === "user") {
|
|
290684
|
-
lastUserIdx = i6;
|
|
290685
|
-
break;
|
|
290686
|
-
}
|
|
290687
|
-
}
|
|
290688
|
-
const dynamicIds = new Set;
|
|
290689
|
-
const dynamicMsgs = [];
|
|
290690
|
-
if (lastUserIdx >= 0) {
|
|
290691
|
-
for (let i6 = lastUserIdx + 1;i6 < displayMessages.length; i6++) {
|
|
290692
|
-
if (displayMessages[i6].role === "assistant") {
|
|
290693
|
-
dynamicIds.add(displayMessages[i6].id);
|
|
290694
|
-
dynamicMsgs.push(displayMessages[i6]);
|
|
290695
|
-
}
|
|
290696
|
-
}
|
|
290697
|
-
}
|
|
290698
|
-
const next = [];
|
|
290699
|
-
for (const message of displayMessages) {
|
|
290700
|
-
if (staticMessageIdsRef.current.has(message.id))
|
|
290701
|
-
continue;
|
|
290702
|
-
if (dynamicIds.has(message.id))
|
|
290703
|
-
continue;
|
|
290704
|
-
staticMessageIdsRef.current.add(message.id);
|
|
290705
|
-
next.push(message);
|
|
290706
|
-
}
|
|
290707
|
-
if (next.length > 0) {
|
|
290708
|
-
setStaticMessages((prev) => [...prev, ...next]);
|
|
290709
|
-
}
|
|
290710
|
-
setLastResponseMessages(dynamicMsgs);
|
|
290711
|
-
}, [displayMessages]);
|
|
290712
291343
|
const reservedLines = 12;
|
|
290713
291344
|
const dynamicBudget = Math.max(6, rows - reservedLines);
|
|
290714
291345
|
const streamingTrim = import_react86.useMemo(() => {
|
|
@@ -290731,13 +291362,6 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
290731
291362
|
const activityBudget = Math.max(4, dynamicBudget - streamingLineCount);
|
|
290732
291363
|
return trimActivityLogByLines(activityLog, wrapChars, renderWidth, activityBudget);
|
|
290733
291364
|
}, [activityLog, wrapChars, renderWidth, dynamicBudget, streamingLineCount]);
|
|
290734
|
-
const lastResponseTrim = import_react86.useMemo(() => {
|
|
290735
|
-
if (lastResponseMessages.length === 0 || isProcessing)
|
|
290736
|
-
return { messages: lastResponseMessages, trimmed: false };
|
|
290737
|
-
return trimDisplayMessagesByLines(lastResponseMessages, dynamicBudget, renderWidth);
|
|
290738
|
-
}, [lastResponseMessages, isProcessing, dynamicBudget, renderWidth]);
|
|
290739
|
-
const combinedStreamingMessages = streamingMessages.length > 0 ? streamingMessages : lastResponseTrim.messages;
|
|
290740
|
-
const showDynamicPanel = isProcessing || activityTrim.entries.length > 0 || lastResponseMessages.length > 0;
|
|
290741
291365
|
import_react86.useEffect(() => {
|
|
290742
291366
|
if (!isBusy && activeQueue.length > 0 && activeInline.length === 0) {
|
|
290743
291367
|
processQueue();
|
|
@@ -290815,15 +291439,15 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
290815
291439
|
if (hasAsk || hasInterview) {
|
|
290816
291440
|
return;
|
|
290817
291441
|
}
|
|
290818
|
-
const
|
|
290819
|
-
const timeSinceLastCtrlC =
|
|
291442
|
+
const now4 = Date.now();
|
|
291443
|
+
const timeSinceLastCtrlC = now4 - lastCtrlCRef.current;
|
|
290820
291444
|
if (timeSinceLastCtrlC < 1500 && lastCtrlCRef.current > 0) {
|
|
290821
291445
|
gatherAndSetExitStats();
|
|
290822
291446
|
registry3.closeAll();
|
|
290823
291447
|
exit3();
|
|
290824
291448
|
return;
|
|
290825
291449
|
}
|
|
290826
|
-
lastCtrlCRef.current =
|
|
291450
|
+
lastCtrlCRef.current = now4;
|
|
290827
291451
|
setShowExitHint(true);
|
|
290828
291452
|
setTimeout(() => {
|
|
290829
291453
|
setShowExitHint(false);
|
|
@@ -291809,18 +292433,18 @@ When done, report the result.`);
|
|
|
291809
292433
|
};
|
|
291810
292434
|
const handleScheduleCreate = async (schedule) => {
|
|
291811
292435
|
try {
|
|
291812
|
-
const
|
|
292436
|
+
const now4 = Date.now();
|
|
291813
292437
|
const fullSchedule = {
|
|
291814
292438
|
...schedule,
|
|
291815
292439
|
id: generateId(),
|
|
291816
|
-
createdAt:
|
|
291817
|
-
updatedAt:
|
|
292440
|
+
createdAt: now4,
|
|
292441
|
+
updatedAt: now4
|
|
291818
292442
|
};
|
|
291819
|
-
fullSchedule.nextRunAt = computeNextRun2(fullSchedule,
|
|
292443
|
+
fullSchedule.nextRunAt = computeNextRun2(fullSchedule, now4);
|
|
291820
292444
|
if (!fullSchedule.nextRunAt) {
|
|
291821
292445
|
throw new Error("Unable to compute next run time. Check your schedule configuration.");
|
|
291822
292446
|
}
|
|
291823
|
-
if (fullSchedule.schedule.kind === "once" && fullSchedule.nextRunAt <=
|
|
292447
|
+
if (fullSchedule.schedule.kind === "once" && fullSchedule.nextRunAt <= now4) {
|
|
291824
292448
|
throw new Error("Scheduled time must be in the future.");
|
|
291825
292449
|
}
|
|
291826
292450
|
await saveSchedule(cwd3, fullSchedule);
|
|
@@ -292465,58 +293089,58 @@ When done, report the result.`);
|
|
|
292465
293089
|
}
|
|
292466
293090
|
if (showPlansPanel && plansProject) {
|
|
292467
293091
|
const handleCreatePlan = async (title) => {
|
|
292468
|
-
const
|
|
293092
|
+
const now4 = Date.now();
|
|
292469
293093
|
const plan = {
|
|
292470
|
-
id: `plan-${
|
|
293094
|
+
id: `plan-${now4}`,
|
|
292471
293095
|
title,
|
|
292472
|
-
createdAt:
|
|
292473
|
-
updatedAt:
|
|
293096
|
+
createdAt: now4,
|
|
293097
|
+
updatedAt: now4,
|
|
292474
293098
|
steps: []
|
|
292475
293099
|
};
|
|
292476
293100
|
const updated = await updateProject(cwd3, plansProject.id, (current) => ({
|
|
292477
293101
|
...current,
|
|
292478
293102
|
plans: [...current.plans, plan],
|
|
292479
|
-
updatedAt:
|
|
293103
|
+
updatedAt: now4
|
|
292480
293104
|
}));
|
|
292481
293105
|
if (updated)
|
|
292482
293106
|
setPlansProject(updated);
|
|
292483
293107
|
};
|
|
292484
293108
|
const handleDeletePlan = async (planId) => {
|
|
292485
|
-
const
|
|
293109
|
+
const now4 = Date.now();
|
|
292486
293110
|
const updated = await updateProject(cwd3, plansProject.id, (current) => ({
|
|
292487
293111
|
...current,
|
|
292488
293112
|
plans: current.plans.filter((p5) => p5.id !== planId),
|
|
292489
|
-
updatedAt:
|
|
293113
|
+
updatedAt: now4
|
|
292490
293114
|
}));
|
|
292491
293115
|
if (updated)
|
|
292492
293116
|
setPlansProject(updated);
|
|
292493
293117
|
};
|
|
292494
293118
|
const handleAddStep = async (planId, text5) => {
|
|
292495
|
-
const
|
|
293119
|
+
const now4 = Date.now();
|
|
292496
293120
|
const updated = await updateProject(cwd3, plansProject.id, (current) => ({
|
|
292497
293121
|
...current,
|
|
292498
|
-
plans: current.plans.map((p5) => p5.id === planId ? { ...p5, steps: [...p5.steps, { id: `step-${
|
|
292499
|
-
updatedAt:
|
|
293122
|
+
plans: current.plans.map((p5) => p5.id === planId ? { ...p5, steps: [...p5.steps, { id: `step-${now4}`, text: text5, status: "todo", createdAt: now4, updatedAt: now4 }], updatedAt: now4 } : p5),
|
|
293123
|
+
updatedAt: now4
|
|
292500
293124
|
}));
|
|
292501
293125
|
if (updated)
|
|
292502
293126
|
setPlansProject(updated);
|
|
292503
293127
|
};
|
|
292504
293128
|
const handleUpdateStep = async (planId, stepId, status) => {
|
|
292505
|
-
const
|
|
293129
|
+
const now4 = Date.now();
|
|
292506
293130
|
const updated = await updateProject(cwd3, plansProject.id, (current) => ({
|
|
292507
293131
|
...current,
|
|
292508
|
-
plans: current.plans.map((p5) => p5.id === planId ? { ...p5, steps: p5.steps.map((s5) => s5.id === stepId ? { ...s5, status, updatedAt:
|
|
292509
|
-
updatedAt:
|
|
293132
|
+
plans: current.plans.map((p5) => p5.id === planId ? { ...p5, steps: p5.steps.map((s5) => s5.id === stepId ? { ...s5, status, updatedAt: now4 } : s5), updatedAt: now4 } : p5),
|
|
293133
|
+
updatedAt: now4
|
|
292510
293134
|
}));
|
|
292511
293135
|
if (updated)
|
|
292512
293136
|
setPlansProject(updated);
|
|
292513
293137
|
};
|
|
292514
293138
|
const handleRemoveStep = async (planId, stepId) => {
|
|
292515
|
-
const
|
|
293139
|
+
const now4 = Date.now();
|
|
292516
293140
|
const updated = await updateProject(cwd3, plansProject.id, (current) => ({
|
|
292517
293141
|
...current,
|
|
292518
|
-
plans: current.plans.map((p5) => p5.id === planId ? { ...p5, steps: p5.steps.filter((s5) => s5.id !== stepId), updatedAt:
|
|
292519
|
-
updatedAt:
|
|
293142
|
+
plans: current.plans.map((p5) => p5.id === planId ? { ...p5, steps: p5.steps.filter((s5) => s5.id !== stepId), updatedAt: now4 } : p5),
|
|
293143
|
+
updatedAt: now4
|
|
292520
293144
|
}));
|
|
292521
293145
|
if (updated)
|
|
292522
293146
|
setPlansProject(updated);
|
|
@@ -292779,7 +293403,7 @@ When done, report the result.`);
|
|
|
292779
293403
|
if (showConfigPanel && currentConfig) {
|
|
292780
293404
|
const handleConfigSave = async (location, updates) => {
|
|
292781
293405
|
const { writeFile: writeFile10, mkdir: mkdir10 } = await import("fs/promises");
|
|
292782
|
-
const { dirname:
|
|
293406
|
+
const { dirname: dirname21 } = await import("path");
|
|
292783
293407
|
let configPath;
|
|
292784
293408
|
let existingConfig;
|
|
292785
293409
|
switch (location) {
|
|
@@ -292796,8 +293420,8 @@ When done, report the result.`);
|
|
|
292796
293420
|
existingConfig = localConfig;
|
|
292797
293421
|
break;
|
|
292798
293422
|
}
|
|
292799
|
-
const newConfig =
|
|
292800
|
-
await mkdir10(
|
|
293423
|
+
const newConfig = deepMerge3(existingConfig || {}, updates);
|
|
293424
|
+
await mkdir10(dirname21(configPath), { recursive: true });
|
|
292801
293425
|
await writeFile10(configPath, JSON.stringify(newConfig, null, 2));
|
|
292802
293426
|
await loadConfigFiles();
|
|
292803
293427
|
};
|
|
@@ -293157,50 +293781,17 @@ ${msg.body || msg.preview}`);
|
|
|
293157
293781
|
/* @__PURE__ */ jsx_dev_runtime51.jsxDEV(Box_default, {
|
|
293158
293782
|
flexDirection: "column",
|
|
293159
293783
|
flexGrow: 1,
|
|
293160
|
-
children:
|
|
293161
|
-
|
|
293162
|
-
|
|
293163
|
-
|
|
293164
|
-
|
|
293165
|
-
|
|
293166
|
-
|
|
293167
|
-
|
|
293168
|
-
|
|
293169
|
-
|
|
293170
|
-
|
|
293171
|
-
verboseTools
|
|
293172
|
-
}, message.id, false, undefined, this)
|
|
293173
|
-
}, staticResetKey, false, undefined, this),
|
|
293174
|
-
showDynamicPanel && /* @__PURE__ */ jsx_dev_runtime51.jsxDEV(jsx_dev_runtime51.Fragment, {
|
|
293175
|
-
children: [
|
|
293176
|
-
isProcessing && streamingTrimmed && /* @__PURE__ */ jsx_dev_runtime51.jsxDEV(Box_default, {
|
|
293177
|
-
marginBottom: 1,
|
|
293178
|
-
children: /* @__PURE__ */ jsx_dev_runtime51.jsxDEV(Text, {
|
|
293179
|
-
dimColor: true,
|
|
293180
|
-
children: "\u22EF showing latest output"
|
|
293181
|
-
}, undefined, false, undefined, this)
|
|
293182
|
-
}, undefined, false, undefined, this),
|
|
293183
|
-
isProcessing && activityTrim.trimmed && /* @__PURE__ */ jsx_dev_runtime51.jsxDEV(Box_default, {
|
|
293184
|
-
marginBottom: 1,
|
|
293185
|
-
children: /* @__PURE__ */ jsx_dev_runtime51.jsxDEV(Text, {
|
|
293186
|
-
dimColor: true,
|
|
293187
|
-
children: "\u22EF showing latest activity"
|
|
293188
|
-
}, undefined, false, undefined, this)
|
|
293189
|
-
}, undefined, false, undefined, this),
|
|
293190
|
-
/* @__PURE__ */ jsx_dev_runtime51.jsxDEV(Messages5, {
|
|
293191
|
-
messages: [],
|
|
293192
|
-
currentResponse: undefined,
|
|
293193
|
-
streamingMessages: combinedStreamingMessages,
|
|
293194
|
-
currentToolCall: undefined,
|
|
293195
|
-
lastToolResult: undefined,
|
|
293196
|
-
activityLog: isProcessing ? activityTrim.entries : [],
|
|
293197
|
-
queuedMessageIds,
|
|
293198
|
-
verboseTools
|
|
293199
|
-
}, "streaming", false, undefined, this)
|
|
293200
|
-
]
|
|
293201
|
-
}, undefined, true, undefined, this)
|
|
293202
|
-
]
|
|
293203
|
-
}, undefined, true, undefined, this),
|
|
293784
|
+
children: /* @__PURE__ */ jsx_dev_runtime51.jsxDEV(Messages5, {
|
|
293785
|
+
messages: displayMessages,
|
|
293786
|
+
currentResponse: undefined,
|
|
293787
|
+
streamingMessages: isProcessing ? streamingMessages : [],
|
|
293788
|
+
currentToolCall: undefined,
|
|
293789
|
+
lastToolResult: undefined,
|
|
293790
|
+
activityLog: isProcessing ? activityTrim.entries : [],
|
|
293791
|
+
queuedMessageIds,
|
|
293792
|
+
verboseTools
|
|
293793
|
+
}, "all-messages", false, undefined, this)
|
|
293794
|
+
}, undefined, false, undefined, this),
|
|
293204
293795
|
askUserState && activeAskQuestion && !interviewState && /* @__PURE__ */ jsx_dev_runtime51.jsxDEV(AskUserPanel, {
|
|
293205
293796
|
sessionId: askUserState.sessionId,
|
|
293206
293797
|
request: askUserState.request,
|
|
@@ -293771,7 +294362,7 @@ process.on("unhandledRejection", (reason) => {
|
|
|
293771
294362
|
cleanup();
|
|
293772
294363
|
process.exit(1);
|
|
293773
294364
|
});
|
|
293774
|
-
var VERSION4 = "1.1.
|
|
294365
|
+
var VERSION4 = "1.1.84";
|
|
293775
294366
|
var SYNC_START = "\x1B[?2026h";
|
|
293776
294367
|
var SYNC_END = "\x1B[?2026l";
|
|
293777
294368
|
function enableSynchronizedOutput() {
|
|
@@ -293916,4 +294507,4 @@ export {
|
|
|
293916
294507
|
main
|
|
293917
294508
|
};
|
|
293918
294509
|
|
|
293919
|
-
//# debugId=
|
|
294510
|
+
//# debugId=53F8BF2E2143AECA64756E2164756E21
|