@hasna/mementos 0.14.59 → 0.14.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/storage.d.ts.map +1 -1
- package/dist/cli/commands/system-misc.d.ts.map +1 -1
- package/dist/cli/index.js +173 -12
- package/dist/db/relations.d.ts.map +1 -1
- package/dist/db/session-jobs.d.ts.map +1 -1
- package/dist/db/synthesis.d.ts.map +1 -1
- package/dist/db/webhook_hooks.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/lib/poll.d.ts.map +1 -1
- package/dist/lib/project-detect.d.ts.map +1 -1
- package/dist/lib/synthesis/index.d.ts.map +1 -1
- package/dist/mcp/index.js +82 -8
- package/dist/mcp/tools/memory-search.d.ts.map +1 -1
- package/dist/server/index.js +123 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6NzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAK9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-misc.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/system-misc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"system-misc.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/system-misc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkG3D"}
|
package/dist/cli/index.js
CHANGED
|
@@ -6330,12 +6330,35 @@ __export(exports_poll, {
|
|
|
6330
6330
|
});
|
|
6331
6331
|
function startPolling(opts) {
|
|
6332
6332
|
const interval = opts.interval_ms ?? 500;
|
|
6333
|
-
const
|
|
6333
|
+
const apiMode = !opts.db && isApiMode();
|
|
6334
|
+
const db = apiMode ? null : opts.db ?? getDatabase();
|
|
6334
6335
|
let stopped = false;
|
|
6335
6336
|
let inFlight = false;
|
|
6336
6337
|
let lastSeen = null;
|
|
6338
|
+
const API_POLL_WINDOW = 200;
|
|
6339
|
+
const maxTimestamp = (memories, seed) => {
|
|
6340
|
+
let mx = seed;
|
|
6341
|
+
for (const m of memories) {
|
|
6342
|
+
const ts = m.updated_at > m.created_at ? m.updated_at : m.created_at;
|
|
6343
|
+
if (!mx || ts > mx)
|
|
6344
|
+
mx = ts;
|
|
6345
|
+
}
|
|
6346
|
+
return mx;
|
|
6347
|
+
};
|
|
6348
|
+
const listRecentViaApi = (limit) => listMemories({
|
|
6349
|
+
scope: opts.scope,
|
|
6350
|
+
category: opts.category,
|
|
6351
|
+
agent_id: opts.agent_id,
|
|
6352
|
+
project_id: opts.project_id,
|
|
6353
|
+
status: "active",
|
|
6354
|
+
limit
|
|
6355
|
+
});
|
|
6337
6356
|
const seedLastSeen = () => {
|
|
6338
6357
|
try {
|
|
6358
|
+
if (apiMode) {
|
|
6359
|
+
lastSeen = maxTimestamp(listRecentViaApi(API_POLL_WINDOW), null);
|
|
6360
|
+
return;
|
|
6361
|
+
}
|
|
6339
6362
|
const latest = listMemories({
|
|
6340
6363
|
scope: opts.scope,
|
|
6341
6364
|
category: opts.category,
|
|
@@ -6350,10 +6373,34 @@ function startPolling(opts) {
|
|
|
6350
6373
|
opts.on_error?.(err instanceof Error ? err : new Error(String(err)));
|
|
6351
6374
|
}
|
|
6352
6375
|
};
|
|
6376
|
+
const pollViaApi = () => {
|
|
6377
|
+
try {
|
|
6378
|
+
const recent = listRecentViaApi(API_POLL_WINDOW);
|
|
6379
|
+
const fresh = recent.filter((m) => !lastSeen || m.updated_at > lastSeen || m.created_at > lastSeen).sort((a, b) => a.updated_at < b.updated_at ? -1 : a.updated_at > b.updated_at ? 1 : 0);
|
|
6380
|
+
if (fresh.length > 0) {
|
|
6381
|
+
lastSeen = maxTimestamp(fresh, lastSeen);
|
|
6382
|
+
try {
|
|
6383
|
+
opts.on_memories(fresh);
|
|
6384
|
+
} catch (err) {
|
|
6385
|
+
opts.on_error?.(err instanceof Error ? err : new Error(String(err)));
|
|
6386
|
+
}
|
|
6387
|
+
}
|
|
6388
|
+
} catch (err) {
|
|
6389
|
+
opts.on_error?.(err instanceof Error ? err : new Error(String(err)));
|
|
6390
|
+
}
|
|
6391
|
+
};
|
|
6353
6392
|
const poll = () => {
|
|
6354
6393
|
if (stopped || inFlight)
|
|
6355
6394
|
return;
|
|
6356
6395
|
inFlight = true;
|
|
6396
|
+
if (apiMode) {
|
|
6397
|
+
try {
|
|
6398
|
+
pollViaApi();
|
|
6399
|
+
} finally {
|
|
6400
|
+
inFlight = false;
|
|
6401
|
+
}
|
|
6402
|
+
return;
|
|
6403
|
+
}
|
|
6357
6404
|
try {
|
|
6358
6405
|
const conditions = ["status = 'active'"];
|
|
6359
6406
|
const params = [];
|
|
@@ -6437,6 +6484,7 @@ function parseMemoryRow2(row) {
|
|
|
6437
6484
|
var init_poll = __esm(() => {
|
|
6438
6485
|
init_memories();
|
|
6439
6486
|
init_database();
|
|
6487
|
+
init_api_mode();
|
|
6440
6488
|
});
|
|
6441
6489
|
|
|
6442
6490
|
// src/lib/decay.ts
|
|
@@ -7134,6 +7182,11 @@ function deleteRelation(id, db) {
|
|
|
7134
7182
|
throw new Error(`Relation not found: ${id}`);
|
|
7135
7183
|
}
|
|
7136
7184
|
function getRelatedEntities(entityId, relationType, db) {
|
|
7185
|
+
if (!db && isApiMode()) {
|
|
7186
|
+
const q = toQuery({ type: relationType });
|
|
7187
|
+
const { data } = apiJson("GET", `/entities/${encodeURIComponent(entityId)}/related${q}`);
|
|
7188
|
+
return data?.entities ?? [];
|
|
7189
|
+
}
|
|
7137
7190
|
const d = db || getDatabase();
|
|
7138
7191
|
let sql;
|
|
7139
7192
|
const params = [];
|
|
@@ -8016,6 +8069,18 @@ function parseRow(row) {
|
|
|
8016
8069
|
};
|
|
8017
8070
|
}
|
|
8018
8071
|
function createWebhookHook(input, db) {
|
|
8072
|
+
if (!db && isApiMode()) {
|
|
8073
|
+
const { data } = apiJson("POST", "/webhooks", {
|
|
8074
|
+
type: input.type,
|
|
8075
|
+
handler_url: input.handlerUrl,
|
|
8076
|
+
priority: input.priority,
|
|
8077
|
+
blocking: input.blocking,
|
|
8078
|
+
agent_id: input.agentId,
|
|
8079
|
+
project_id: input.projectId,
|
|
8080
|
+
description: input.description
|
|
8081
|
+
});
|
|
8082
|
+
return data;
|
|
8083
|
+
}
|
|
8019
8084
|
const d = db || getDatabase();
|
|
8020
8085
|
const id = shortUuid();
|
|
8021
8086
|
const timestamp = now2();
|
|
@@ -8035,11 +8100,22 @@ function createWebhookHook(input, db) {
|
|
|
8035
8100
|
return getWebhookHook(id, d);
|
|
8036
8101
|
}
|
|
8037
8102
|
function getWebhookHook(id, db) {
|
|
8103
|
+
if (!db && isApiMode()) {
|
|
8104
|
+
const { status, data } = apiJson("GET", `/webhooks/${encodeURIComponent(id)}`);
|
|
8105
|
+
if (status === 404 || !data)
|
|
8106
|
+
return null;
|
|
8107
|
+
return data;
|
|
8108
|
+
}
|
|
8038
8109
|
const d = db || getDatabase();
|
|
8039
8110
|
const row = d.query("SELECT * FROM webhook_hooks WHERE id = ?").get(id);
|
|
8040
8111
|
return row ? parseRow(row) : null;
|
|
8041
8112
|
}
|
|
8042
8113
|
function listWebhookHooks(filter = {}, db) {
|
|
8114
|
+
if (!db && isApiMode()) {
|
|
8115
|
+
const q = toQuery({ type: filter.type, enabled: filter.enabled });
|
|
8116
|
+
const { data } = apiJson("GET", `/webhooks${q}`);
|
|
8117
|
+
return data ?? [];
|
|
8118
|
+
}
|
|
8043
8119
|
const d = db || getDatabase();
|
|
8044
8120
|
const conditions = [];
|
|
8045
8121
|
const params = [];
|
|
@@ -8056,6 +8132,16 @@ function listWebhookHooks(filter = {}, db) {
|
|
|
8056
8132
|
return rows.map(parseRow);
|
|
8057
8133
|
}
|
|
8058
8134
|
function updateWebhookHook(id, updates, db) {
|
|
8135
|
+
if (!db && isApiMode()) {
|
|
8136
|
+
const { status, data } = apiJson("PATCH", `/webhooks/${encodeURIComponent(id)}`, {
|
|
8137
|
+
enabled: updates.enabled,
|
|
8138
|
+
priority: updates.priority,
|
|
8139
|
+
description: updates.description
|
|
8140
|
+
});
|
|
8141
|
+
if (status === 404 || !data)
|
|
8142
|
+
return null;
|
|
8143
|
+
return data;
|
|
8144
|
+
}
|
|
8059
8145
|
const d = db || getDatabase();
|
|
8060
8146
|
const existing = getWebhookHook(id, d);
|
|
8061
8147
|
if (!existing)
|
|
@@ -8081,11 +8167,18 @@ function updateWebhookHook(id, updates, db) {
|
|
|
8081
8167
|
return getWebhookHook(id, d);
|
|
8082
8168
|
}
|
|
8083
8169
|
function deleteWebhookHook(id, db) {
|
|
8170
|
+
if (!db && isApiMode()) {
|
|
8171
|
+
const { status } = apiJson("DELETE", `/webhooks/${encodeURIComponent(id)}`);
|
|
8172
|
+
return status === 204 || status === 200;
|
|
8173
|
+
}
|
|
8084
8174
|
const d = db || getDatabase();
|
|
8085
8175
|
const result = d.run("DELETE FROM webhook_hooks WHERE id = ?", [id]);
|
|
8086
8176
|
return result.changes > 0;
|
|
8087
8177
|
}
|
|
8088
8178
|
function recordWebhookInvocation(id, success, db) {
|
|
8179
|
+
if (!db && isApiMode()) {
|
|
8180
|
+
return;
|
|
8181
|
+
}
|
|
8089
8182
|
const d = db || getDatabase();
|
|
8090
8183
|
if (success) {
|
|
8091
8184
|
d.run("UPDATE webhook_hooks SET invocation_count = invocation_count + 1 WHERE id = ?", [id]);
|
|
@@ -8095,6 +8188,7 @@ function recordWebhookInvocation(id, success, db) {
|
|
|
8095
8188
|
}
|
|
8096
8189
|
var init_webhook_hooks = __esm(() => {
|
|
8097
8190
|
init_database();
|
|
8191
|
+
init_api_mode();
|
|
8098
8192
|
});
|
|
8099
8193
|
|
|
8100
8194
|
// src/db/synthesis.ts
|
|
@@ -8192,6 +8286,19 @@ function getSynthesisRun(id, db) {
|
|
|
8192
8286
|
return parseRunRow(row);
|
|
8193
8287
|
}
|
|
8194
8288
|
function listSynthesisRuns(filter, db) {
|
|
8289
|
+
if (!db && isApiMode()) {
|
|
8290
|
+
const q = toQuery({
|
|
8291
|
+
project_id: filter.project_id ?? undefined,
|
|
8292
|
+
limit: filter.limit
|
|
8293
|
+
});
|
|
8294
|
+
const { data } = apiJson("GET", `/synthesis/runs${q}`);
|
|
8295
|
+
let runs = data?.runs ?? [];
|
|
8296
|
+
if (filter.status)
|
|
8297
|
+
runs = runs.filter((r) => r.status === filter.status);
|
|
8298
|
+
if (filter.project_id === null)
|
|
8299
|
+
runs = runs.filter((r) => r.project_id === null);
|
|
8300
|
+
return runs;
|
|
8301
|
+
}
|
|
8195
8302
|
const d = db || getDatabase();
|
|
8196
8303
|
const conditions = [];
|
|
8197
8304
|
const params = [];
|
|
@@ -8383,6 +8490,7 @@ function listSynthesisEvents(filter, db) {
|
|
|
8383
8490
|
}
|
|
8384
8491
|
var init_synthesis = __esm(() => {
|
|
8385
8492
|
init_database();
|
|
8493
|
+
init_api_mode();
|
|
8386
8494
|
});
|
|
8387
8495
|
|
|
8388
8496
|
// src/lib/when-to-use-generator.ts
|
|
@@ -9806,6 +9914,11 @@ async function rollbackSynthesis(runId, db) {
|
|
|
9806
9914
|
return result;
|
|
9807
9915
|
}
|
|
9808
9916
|
function getSynthesisStatus(runId, projectId, db) {
|
|
9917
|
+
if (!db && isApiMode()) {
|
|
9918
|
+
const q = toQuery({ run_id: runId, project_id: projectId });
|
|
9919
|
+
const { data } = apiJson("GET", `/synthesis/status${q}`);
|
|
9920
|
+
return data ?? { lastRun: null, recentRuns: [] };
|
|
9921
|
+
}
|
|
9809
9922
|
const d = db || getDatabase();
|
|
9810
9923
|
if (runId) {
|
|
9811
9924
|
const recentRuns2 = listSynthesisRuns({ project_id: projectId ?? null, limit: 10 }, d);
|
|
@@ -9823,6 +9936,7 @@ function getSynthesisStatus(runId, projectId, db) {
|
|
|
9823
9936
|
}
|
|
9824
9937
|
var init_synthesis2 = __esm(() => {
|
|
9825
9938
|
init_database();
|
|
9939
|
+
init_api_mode();
|
|
9826
9940
|
init_synthesis();
|
|
9827
9941
|
init_corpus_builder();
|
|
9828
9942
|
init_llm_analyzer();
|
|
@@ -9879,6 +9993,12 @@ function createSessionJob(input, db) {
|
|
|
9879
9993
|
return getSessionJob(id, d);
|
|
9880
9994
|
}
|
|
9881
9995
|
function getSessionJob(id, db) {
|
|
9996
|
+
if (!db && isApiMode()) {
|
|
9997
|
+
const { status, data } = apiJson("GET", `/sessions/jobs/${encodeURIComponent(id)}`);
|
|
9998
|
+
if (status === 404 || !data)
|
|
9999
|
+
return null;
|
|
10000
|
+
return data;
|
|
10001
|
+
}
|
|
9882
10002
|
const d = db || getDatabase();
|
|
9883
10003
|
const row = d.query("SELECT * FROM session_memory_jobs WHERE id = ?").get(id);
|
|
9884
10004
|
if (!row)
|
|
@@ -9886,6 +10006,16 @@ function getSessionJob(id, db) {
|
|
|
9886
10006
|
return parseJobRow(row);
|
|
9887
10007
|
}
|
|
9888
10008
|
function listSessionJobs(filter, db) {
|
|
10009
|
+
if (!db && isApiMode()) {
|
|
10010
|
+
const q = toQuery({
|
|
10011
|
+
agent_id: filter?.agent_id,
|
|
10012
|
+
project_id: filter?.project_id,
|
|
10013
|
+
status: filter?.status,
|
|
10014
|
+
limit: filter?.limit
|
|
10015
|
+
});
|
|
10016
|
+
const { data } = apiJson("GET", `/sessions/jobs${q}`);
|
|
10017
|
+
return data?.jobs ?? [];
|
|
10018
|
+
}
|
|
9889
10019
|
const d = db || getDatabase();
|
|
9890
10020
|
const conditions = [];
|
|
9891
10021
|
const params = [];
|
|
@@ -9954,6 +10084,7 @@ function getNextPendingJob(db) {
|
|
|
9954
10084
|
}
|
|
9955
10085
|
var init_session_jobs = __esm(() => {
|
|
9956
10086
|
init_database();
|
|
10087
|
+
init_api_mode();
|
|
9957
10088
|
});
|
|
9958
10089
|
|
|
9959
10090
|
// src/db/tool-events.ts
|
|
@@ -11608,6 +11739,34 @@ var init_pg_migrate = __esm(() => {
|
|
|
11608
11739
|
init_pg_migrations();
|
|
11609
11740
|
});
|
|
11610
11741
|
|
|
11742
|
+
// src/db/feedback.ts
|
|
11743
|
+
var exports_feedback = {};
|
|
11744
|
+
__export(exports_feedback, {
|
|
11745
|
+
saveFeedback: () => saveFeedback
|
|
11746
|
+
});
|
|
11747
|
+
function saveFeedback(input, db) {
|
|
11748
|
+
if (!db && isApiMode()) {
|
|
11749
|
+
apiJson("POST", "/feedback", {
|
|
11750
|
+
message: input.message,
|
|
11751
|
+
email: input.email ?? null,
|
|
11752
|
+
category: input.category ?? "general",
|
|
11753
|
+
version: input.version ?? null
|
|
11754
|
+
});
|
|
11755
|
+
return;
|
|
11756
|
+
}
|
|
11757
|
+
const d = db || getDatabase();
|
|
11758
|
+
d.run("INSERT INTO feedback (message, email, category, version) VALUES (?, ?, ?, ?)", [
|
|
11759
|
+
input.message,
|
|
11760
|
+
input.email ?? null,
|
|
11761
|
+
input.category ?? "general",
|
|
11762
|
+
input.version ?? null
|
|
11763
|
+
]);
|
|
11764
|
+
}
|
|
11765
|
+
var init_feedback = __esm(() => {
|
|
11766
|
+
init_database();
|
|
11767
|
+
init_api_mode();
|
|
11768
|
+
});
|
|
11769
|
+
|
|
11611
11770
|
// node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
11612
11771
|
var util, objectUtil, ZodParsedType, getParsedType = (data) => {
|
|
11613
11772
|
const t = typeof data;
|
|
@@ -63228,7 +63387,6 @@ function registerSessionsCommand(program2) {
|
|
|
63228
63387
|
|
|
63229
63388
|
// src/cli/commands/system-misc.ts
|
|
63230
63389
|
init_storage();
|
|
63231
|
-
init_database();
|
|
63232
63390
|
import chalk37 from "chalk";
|
|
63233
63391
|
function registerMiscCommands(program2) {
|
|
63234
63392
|
program2.command("migrate-pg").description("Apply PostgreSQL migrations to the configured RDS instance").option("--connection-string <url>", "PostgreSQL connection string (overrides storage config)").option("--json", "Output as JSON").action(async (opts) => {
|
|
@@ -63284,17 +63442,17 @@ function registerMiscCommands(program2) {
|
|
|
63284
63442
|
});
|
|
63285
63443
|
program2.command("feedback").description("Send feedback about mementos").argument("<message>", "Feedback message").option("--email <email>", "Your email (optional)").option("--category <category>", "Category: bug, feature, general", "general").action(async (message, opts) => {
|
|
63286
63444
|
try {
|
|
63287
|
-
const db = getDatabase();
|
|
63288
63445
|
const { fileURLToPath: _ftu } = await import("url");
|
|
63289
63446
|
const { dirname: _dir, join: _join } = await import("path");
|
|
63290
63447
|
const { readFileSync: _rfs } = await import("fs");
|
|
63291
63448
|
const pkg = JSON.parse(_rfs(_join(_dir(_ftu(import.meta.url)), "../../package.json"), "utf-8"));
|
|
63292
|
-
|
|
63449
|
+
const { saveFeedback: saveFeedback2 } = await Promise.resolve().then(() => (init_feedback(), exports_feedback));
|
|
63450
|
+
saveFeedback2({
|
|
63293
63451
|
message,
|
|
63294
|
-
opts.email || null,
|
|
63295
|
-
opts.category || "general",
|
|
63296
|
-
pkg.version
|
|
63297
|
-
|
|
63452
|
+
email: opts.email || null,
|
|
63453
|
+
category: opts.category || "general",
|
|
63454
|
+
version: pkg.version
|
|
63455
|
+
});
|
|
63298
63456
|
console.log(chalk37.green("Feedback saved. Thank you!"));
|
|
63299
63457
|
} catch (e) {
|
|
63300
63458
|
console.error(chalk37.red(`Failed to save feedback: ${e instanceof Error ? e.message : String(e)}`));
|
|
@@ -64006,7 +64164,6 @@ function getStorageSyncStatus(options = {}) {
|
|
|
64006
64164
|
}
|
|
64007
64165
|
|
|
64008
64166
|
// src/cli/commands/storage.ts
|
|
64009
|
-
init_database();
|
|
64010
64167
|
function parseTables(raw) {
|
|
64011
64168
|
if (!raw) {
|
|
64012
64169
|
return;
|
|
@@ -64152,9 +64309,13 @@ function installStorageSubcommands(storage, program2) {
|
|
|
64152
64309
|
storage.command("feedback").description("Save feedback locally").argument("<message>", "Feedback message").option("--email <email>", "Contact email").option("--category <category>", "Feedback category", "general").option("--json", "Output JSON").action((message, opts) => {
|
|
64153
64310
|
const useJson = Boolean(opts.json || program2.opts().json);
|
|
64154
64311
|
try {
|
|
64155
|
-
const
|
|
64156
|
-
|
|
64157
|
-
|
|
64312
|
+
const { saveFeedback: saveFeedback2 } = (init_feedback(), __toCommonJS(exports_feedback));
|
|
64313
|
+
saveFeedback2({
|
|
64314
|
+
message,
|
|
64315
|
+
email: opts.email || null,
|
|
64316
|
+
category: opts.category || "general",
|
|
64317
|
+
version: "mementos"
|
|
64318
|
+
});
|
|
64158
64319
|
if (useJson) {
|
|
64159
64320
|
outputJson2(true, { saved: true });
|
|
64160
64321
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relations.d.ts","sourceRoot":"","sources":["../../src/db/relations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAI1D,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAO7F,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,QAAQ,CAUvE;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAWnE;AAMD,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAuClF;AA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AAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC9E;AAED,wBAAgB,aAAa,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,UAAU,CAyCvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-jobs.d.ts","sourceRoot":"","sources":["../../src/db/session-jobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"session-jobs.d.ts","sourceRoot":"","sources":["../../src/db/session-jobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAK1D,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,eAAe,CAAC;AACpF,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,QAAQ,CAAC;AAEjF,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED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,EAAE,QAAQ,GACZ,gBAAgB,GAAG,IAAI,CAwCzB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,gBAAgB,GAAG,IAAI,CASxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synthesis.d.ts","sourceRoot":"","sources":["../../src/db/synthesis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"synthesis.d.ts","sourceRoot":"","sources":["../../src/db/synthesis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAS1D,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,CAAC;IAC5D,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,aAAa,CAAC;IACvE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,GAAG,kBAAkB,CAAC;IACjG,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,gBAAgB,EAAE,MAAM,GA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IAAI,CAyBN;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE;IACN,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EACD,EAAE,CAAC,EAAE,QAAQ,GACZ,cAAc,EAAE,CAsBlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook_hooks.d.ts","sourceRoot":"","sources":["../../src/db/webhook_hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"webhook_hooks.d.ts","sourceRoot":"","sources":["../../src/db/webhook_hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAI1D,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AA2B/D,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,sBAAsB,EAC7B,EAAE,CAAC,EAAE,QAAQ,GACZ,WAAW,CAmCb;AAMD,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,IAAI,CAW5E;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,GAAE;IAAE,IAAI,CAAC,EAAE,QAAQ,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,EACnD,EAAE,CAAC,EAAE,QAAQ,GACZ,WAAW,EAAE,CAyBf;AAMD,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,MAAM,EACV,OAAO,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,EACvE,EAAE,CAAC,EAAE,QAAQ,GACZ,WAAW,GAAG,IAAI,CAoCpB;AAMD,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,CAQpE;AAMD,wBAAgB,uBAAuB,CACrC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,EAChB,EAAE,CAAC,EAAE,QAAQ,GACZ,IAAI,CAmBN"}
|
package/dist/index.js
CHANGED
|
@@ -52513,6 +52513,11 @@ function deleteRelation(id, db) {
|
|
|
52513
52513
|
throw new Error(`Relation not found: ${id}`);
|
|
52514
52514
|
}
|
|
52515
52515
|
function getRelatedEntities(entityId, relationType, db) {
|
|
52516
|
+
if (!db && isApiMode()) {
|
|
52517
|
+
const q = toQuery({ type: relationType });
|
|
52518
|
+
const { data } = apiJson("GET", `/entities/${encodeURIComponent(entityId)}/related${q}`);
|
|
52519
|
+
return data?.entities ?? [];
|
|
52520
|
+
}
|
|
52516
52521
|
const d = db || getDatabase();
|
|
52517
52522
|
let sql;
|
|
52518
52523
|
const params = [];
|
package/dist/lib/poll.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poll.d.ts","sourceRoot":"","sources":["../../src/lib/poll.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"poll.d.ts","sourceRoot":"","sources":["../../src/lib/poll.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAS7E,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAClC,EAAE,CAAC,EAAE,QAAQ,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB;AAMD,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,CAsJ1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-detect.d.ts","sourceRoot":"","sources":["../../src/lib/project-detect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"project-detect.d.ts","sourceRoot":"","sources":["../../src/lib/project-detect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAI1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAkBjD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,IAAI,CAgC3D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/synthesis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/synthesis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG7D,OAAO,EAML,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAM9E,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,YAAY,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,YAAY,EAAE,gBAAgB,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACzF,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAMtE,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IACrC,EAAE,CAAC,EAAE,QAAQ,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,YAAY,CAAC;IAClB,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACpC,MAAM,EAAE,OAAO,CAAC;CACjB;AAMD,wBAAsB,YAAY,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAwJ3F;AAMD,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,MAAM,EACb,EAAE,CAAC,EAAE,QAAQ,GACZ,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAUpD;AAMD,wBAAgB,kBAAkB,CAChC,KAAK,CAAC,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,EAClB,EAAE,CAAC,EAAE,QAAQ,GACZ;IAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;IAAC,UAAU,EAAE,YAAY,EAAE,CAAA;CAAE,CAgC9D"}
|
package/dist/mcp/index.js
CHANGED
|
@@ -3373,6 +3373,18 @@ function parseRow(row) {
|
|
|
3373
3373
|
};
|
|
3374
3374
|
}
|
|
3375
3375
|
function createWebhookHook(input, db) {
|
|
3376
|
+
if (!db && isApiMode()) {
|
|
3377
|
+
const { data } = apiJson("POST", "/webhooks", {
|
|
3378
|
+
type: input.type,
|
|
3379
|
+
handler_url: input.handlerUrl,
|
|
3380
|
+
priority: input.priority,
|
|
3381
|
+
blocking: input.blocking,
|
|
3382
|
+
agent_id: input.agentId,
|
|
3383
|
+
project_id: input.projectId,
|
|
3384
|
+
description: input.description
|
|
3385
|
+
});
|
|
3386
|
+
return data;
|
|
3387
|
+
}
|
|
3376
3388
|
const d = db || getDatabase();
|
|
3377
3389
|
const id = shortUuid();
|
|
3378
3390
|
const timestamp = now();
|
|
@@ -3392,11 +3404,22 @@ function createWebhookHook(input, db) {
|
|
|
3392
3404
|
return getWebhookHook(id, d);
|
|
3393
3405
|
}
|
|
3394
3406
|
function getWebhookHook(id, db) {
|
|
3407
|
+
if (!db && isApiMode()) {
|
|
3408
|
+
const { status, data } = apiJson("GET", `/webhooks/${encodeURIComponent(id)}`);
|
|
3409
|
+
if (status === 404 || !data)
|
|
3410
|
+
return null;
|
|
3411
|
+
return data;
|
|
3412
|
+
}
|
|
3395
3413
|
const d = db || getDatabase();
|
|
3396
3414
|
const row = d.query("SELECT * FROM webhook_hooks WHERE id = ?").get(id);
|
|
3397
3415
|
return row ? parseRow(row) : null;
|
|
3398
3416
|
}
|
|
3399
3417
|
function listWebhookHooks(filter = {}, db) {
|
|
3418
|
+
if (!db && isApiMode()) {
|
|
3419
|
+
const q = toQuery({ type: filter.type, enabled: filter.enabled });
|
|
3420
|
+
const { data } = apiJson("GET", `/webhooks${q}`);
|
|
3421
|
+
return data ?? [];
|
|
3422
|
+
}
|
|
3400
3423
|
const d = db || getDatabase();
|
|
3401
3424
|
const conditions = [];
|
|
3402
3425
|
const params = [];
|
|
@@ -3413,6 +3436,16 @@ function listWebhookHooks(filter = {}, db) {
|
|
|
3413
3436
|
return rows.map(parseRow);
|
|
3414
3437
|
}
|
|
3415
3438
|
function updateWebhookHook(id, updates, db) {
|
|
3439
|
+
if (!db && isApiMode()) {
|
|
3440
|
+
const { status, data } = apiJson("PATCH", `/webhooks/${encodeURIComponent(id)}`, {
|
|
3441
|
+
enabled: updates.enabled,
|
|
3442
|
+
priority: updates.priority,
|
|
3443
|
+
description: updates.description
|
|
3444
|
+
});
|
|
3445
|
+
if (status === 404 || !data)
|
|
3446
|
+
return null;
|
|
3447
|
+
return data;
|
|
3448
|
+
}
|
|
3416
3449
|
const d = db || getDatabase();
|
|
3417
3450
|
const existing = getWebhookHook(id, d);
|
|
3418
3451
|
if (!existing)
|
|
@@ -3438,11 +3471,18 @@ function updateWebhookHook(id, updates, db) {
|
|
|
3438
3471
|
return getWebhookHook(id, d);
|
|
3439
3472
|
}
|
|
3440
3473
|
function deleteWebhookHook(id, db) {
|
|
3474
|
+
if (!db && isApiMode()) {
|
|
3475
|
+
const { status } = apiJson("DELETE", `/webhooks/${encodeURIComponent(id)}`);
|
|
3476
|
+
return status === 204 || status === 200;
|
|
3477
|
+
}
|
|
3441
3478
|
const d = db || getDatabase();
|
|
3442
3479
|
const result = d.run("DELETE FROM webhook_hooks WHERE id = ?", [id]);
|
|
3443
3480
|
return result.changes > 0;
|
|
3444
3481
|
}
|
|
3445
3482
|
function recordWebhookInvocation(id, success, db) {
|
|
3483
|
+
if (!db && isApiMode()) {
|
|
3484
|
+
return;
|
|
3485
|
+
}
|
|
3446
3486
|
const d = db || getDatabase();
|
|
3447
3487
|
if (success) {
|
|
3448
3488
|
d.run("UPDATE webhook_hooks SET invocation_count = invocation_count + 1 WHERE id = ?", [id]);
|
|
@@ -3452,6 +3492,7 @@ function recordWebhookInvocation(id, success, db) {
|
|
|
3452
3492
|
}
|
|
3453
3493
|
var init_webhook_hooks = __esm(() => {
|
|
3454
3494
|
init_database();
|
|
3495
|
+
init_api_mode();
|
|
3455
3496
|
});
|
|
3456
3497
|
|
|
3457
3498
|
// src/db/entities.ts
|
|
@@ -5582,6 +5623,19 @@ function getSynthesisRun(id, db) {
|
|
|
5582
5623
|
return parseRunRow(row);
|
|
5583
5624
|
}
|
|
5584
5625
|
function listSynthesisRuns(filter, db) {
|
|
5626
|
+
if (!db && isApiMode()) {
|
|
5627
|
+
const q = toQuery({
|
|
5628
|
+
project_id: filter.project_id ?? undefined,
|
|
5629
|
+
limit: filter.limit
|
|
5630
|
+
});
|
|
5631
|
+
const { data } = apiJson("GET", `/synthesis/runs${q}`);
|
|
5632
|
+
let runs = data?.runs ?? [];
|
|
5633
|
+
if (filter.status)
|
|
5634
|
+
runs = runs.filter((r) => r.status === filter.status);
|
|
5635
|
+
if (filter.project_id === null)
|
|
5636
|
+
runs = runs.filter((r) => r.project_id === null);
|
|
5637
|
+
return runs;
|
|
5638
|
+
}
|
|
5585
5639
|
const d = db || getDatabase();
|
|
5586
5640
|
const conditions = [];
|
|
5587
5641
|
const params = [];
|
|
@@ -5773,6 +5827,7 @@ function listSynthesisEvents(filter, db) {
|
|
|
5773
5827
|
}
|
|
5774
5828
|
var init_synthesis = __esm(() => {
|
|
5775
5829
|
init_database();
|
|
5830
|
+
init_api_mode();
|
|
5776
5831
|
});
|
|
5777
5832
|
|
|
5778
5833
|
// src/lib/when-to-use-generator.ts
|
|
@@ -55384,6 +55439,7 @@ init_machines();
|
|
|
55384
55439
|
|
|
55385
55440
|
// src/lib/project-detect.ts
|
|
55386
55441
|
init_database();
|
|
55442
|
+
init_api_mode();
|
|
55387
55443
|
import { existsSync as existsSync3 } from "fs";
|
|
55388
55444
|
import { basename, dirname as dirname2, join as join4, resolve as resolve2 } from "path";
|
|
55389
55445
|
function findGitRoot2(startDir) {
|
|
@@ -55402,7 +55458,6 @@ var _cachedProject = undefined;
|
|
|
55402
55458
|
function detectProject(db) {
|
|
55403
55459
|
if (_cachedProject !== undefined)
|
|
55404
55460
|
return _cachedProject;
|
|
55405
|
-
const d = db || getDatabase();
|
|
55406
55461
|
const cwd = process.cwd();
|
|
55407
55462
|
const gitRoot = findGitRoot2(cwd);
|
|
55408
55463
|
if (!gitRoot) {
|
|
@@ -55411,6 +55466,7 @@ function detectProject(db) {
|
|
|
55411
55466
|
}
|
|
55412
55467
|
const repoName = basename(gitRoot);
|
|
55413
55468
|
const absPath = resolve2(gitRoot);
|
|
55469
|
+
const d = db ?? (isApiMode() ? undefined : getDatabase());
|
|
55414
55470
|
const existing = getProject(absPath, d);
|
|
55415
55471
|
if (existing) {
|
|
55416
55472
|
_cachedProject = existing;
|
|
@@ -57909,22 +57965,17 @@ function registerMemorySearchTools(server) {
|
|
|
57909
57965
|
try {
|
|
57910
57966
|
const limit = positiveLimit(args.limit, 10);
|
|
57911
57967
|
const offset = args.offset ?? 0;
|
|
57912
|
-
let effectiveProjectId = args.project_id;
|
|
57913
|
-
if (!args.scope && !args.project_id && args.agent_id) {
|
|
57914
|
-
effectiveProjectId = resolveProjectId(args.agent_id, null) ?? undefined;
|
|
57915
|
-
}
|
|
57916
57968
|
const filter = {
|
|
57917
57969
|
scope: args.scope,
|
|
57918
57970
|
category: args.category,
|
|
57919
57971
|
tags: args.tags,
|
|
57920
57972
|
agent_id: args.agent_id,
|
|
57921
|
-
project_id:
|
|
57973
|
+
project_id: args.project_id,
|
|
57922
57974
|
session_id: args.session_id,
|
|
57923
|
-
search: args.query,
|
|
57924
57975
|
limit: limit + 1,
|
|
57925
57976
|
offset
|
|
57926
57977
|
};
|
|
57927
|
-
const memories =
|
|
57978
|
+
const memories = searchMemories(args.query, filter).map((r) => r.memory);
|
|
57928
57979
|
if (memories.length === 0) {
|
|
57929
57980
|
const sugKey = args.query.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
|
|
57930
57981
|
return { content: [{ type: "text", text: `No memories found matching "${args.query}".
|
|
@@ -60881,6 +60932,7 @@ init_zod();
|
|
|
60881
60932
|
|
|
60882
60933
|
// src/lib/synthesis/index.ts
|
|
60883
60934
|
init_database();
|
|
60935
|
+
init_api_mode();
|
|
60884
60936
|
init_synthesis();
|
|
60885
60937
|
|
|
60886
60938
|
// src/lib/synthesis/corpus-builder.ts
|
|
@@ -61765,6 +61817,11 @@ async function rollbackSynthesis(runId, db) {
|
|
|
61765
61817
|
return result;
|
|
61766
61818
|
}
|
|
61767
61819
|
function getSynthesisStatus(runId, projectId, db) {
|
|
61820
|
+
if (!db && isApiMode()) {
|
|
61821
|
+
const q = toQuery({ run_id: runId, project_id: projectId });
|
|
61822
|
+
const { data } = apiJson("GET", `/synthesis/status${q}`);
|
|
61823
|
+
return data ?? { lastRun: null, recentRuns: [] };
|
|
61824
|
+
}
|
|
61768
61825
|
const d = db || getDatabase();
|
|
61769
61826
|
if (runId) {
|
|
61770
61827
|
const recentRuns2 = listSynthesisRuns({ project_id: projectId ?? null, limit: 10 }, d);
|
|
@@ -62105,6 +62162,7 @@ init_zod();
|
|
|
62105
62162
|
|
|
62106
62163
|
// src/db/session-jobs.ts
|
|
62107
62164
|
init_database();
|
|
62165
|
+
init_api_mode();
|
|
62108
62166
|
function parseJobRow(row) {
|
|
62109
62167
|
return {
|
|
62110
62168
|
id: row["id"],
|
|
@@ -62144,6 +62202,12 @@ function createSessionJob(input, db) {
|
|
|
62144
62202
|
return getSessionJob(id, d);
|
|
62145
62203
|
}
|
|
62146
62204
|
function getSessionJob(id, db) {
|
|
62205
|
+
if (!db && isApiMode()) {
|
|
62206
|
+
const { status, data } = apiJson("GET", `/sessions/jobs/${encodeURIComponent(id)}`);
|
|
62207
|
+
if (status === 404 || !data)
|
|
62208
|
+
return null;
|
|
62209
|
+
return data;
|
|
62210
|
+
}
|
|
62147
62211
|
const d = db || getDatabase();
|
|
62148
62212
|
const row = d.query("SELECT * FROM session_memory_jobs WHERE id = ?").get(id);
|
|
62149
62213
|
if (!row)
|
|
@@ -62151,6 +62215,16 @@ function getSessionJob(id, db) {
|
|
|
62151
62215
|
return parseJobRow(row);
|
|
62152
62216
|
}
|
|
62153
62217
|
function listSessionJobs(filter, db) {
|
|
62218
|
+
if (!db && isApiMode()) {
|
|
62219
|
+
const q = toQuery({
|
|
62220
|
+
agent_id: filter?.agent_id,
|
|
62221
|
+
project_id: filter?.project_id,
|
|
62222
|
+
status: filter?.status,
|
|
62223
|
+
limit: filter?.limit
|
|
62224
|
+
});
|
|
62225
|
+
const { data } = apiJson("GET", `/sessions/jobs${q}`);
|
|
62226
|
+
return data?.jobs ?? [];
|
|
62227
|
+
}
|
|
62154
62228
|
const d = db || getDatabase();
|
|
62155
62229
|
const conditions = [];
|
|
62156
62230
|
const params = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-search.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/memory-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAkBpE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"memory-search.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/memory-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAkBpE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA6RjE"}
|
package/dist/server/index.js
CHANGED
|
@@ -4189,6 +4189,38 @@ function deleteRelation(id, db) {
|
|
|
4189
4189
|
if (result.changes === 0)
|
|
4190
4190
|
throw new Error(`Relation not found: ${id}`);
|
|
4191
4191
|
}
|
|
4192
|
+
function getRelatedEntities(entityId, relationType, db) {
|
|
4193
|
+
if (!db && isApiMode()) {
|
|
4194
|
+
const q = toQuery({ type: relationType });
|
|
4195
|
+
const { data } = apiJson("GET", `/entities/${encodeURIComponent(entityId)}/related${q}`);
|
|
4196
|
+
return data?.entities ?? [];
|
|
4197
|
+
}
|
|
4198
|
+
const d = db || getDatabase();
|
|
4199
|
+
let sql;
|
|
4200
|
+
const params = [];
|
|
4201
|
+
if (relationType) {
|
|
4202
|
+
sql = `
|
|
4203
|
+
SELECT DISTINCT e.* FROM entities e
|
|
4204
|
+
JOIN relations r ON (
|
|
4205
|
+
(r.source_entity_id = ? AND r.target_entity_id = e.id)
|
|
4206
|
+
OR (r.target_entity_id = ? AND r.source_entity_id = e.id)
|
|
4207
|
+
)
|
|
4208
|
+
WHERE r.relation_type = ?
|
|
4209
|
+
`;
|
|
4210
|
+
params.push(entityId, entityId, relationType);
|
|
4211
|
+
} else {
|
|
4212
|
+
sql = `
|
|
4213
|
+
SELECT DISTINCT e.* FROM entities e
|
|
4214
|
+
JOIN relations r ON (
|
|
4215
|
+
(r.source_entity_id = ? AND r.target_entity_id = e.id)
|
|
4216
|
+
OR (r.target_entity_id = ? AND r.source_entity_id = e.id)
|
|
4217
|
+
)
|
|
4218
|
+
`;
|
|
4219
|
+
params.push(entityId, entityId);
|
|
4220
|
+
}
|
|
4221
|
+
const rows = d.query(sql).all(...params);
|
|
4222
|
+
return rows.map(parseEntityRow3);
|
|
4223
|
+
}
|
|
4192
4224
|
function getEntityGraph(entityId, depth = 2, db) {
|
|
4193
4225
|
if (!db && isApiMode()) {
|
|
4194
4226
|
const q = toQuery({ depth });
|
|
@@ -5108,6 +5140,19 @@ function getSynthesisRun(id, db) {
|
|
|
5108
5140
|
return parseRunRow(row);
|
|
5109
5141
|
}
|
|
5110
5142
|
function listSynthesisRuns(filter, db) {
|
|
5143
|
+
if (!db && isApiMode()) {
|
|
5144
|
+
const q = toQuery({
|
|
5145
|
+
project_id: filter.project_id ?? undefined,
|
|
5146
|
+
limit: filter.limit
|
|
5147
|
+
});
|
|
5148
|
+
const { data } = apiJson("GET", `/synthesis/runs${q}`);
|
|
5149
|
+
let runs = data?.runs ?? [];
|
|
5150
|
+
if (filter.status)
|
|
5151
|
+
runs = runs.filter((r) => r.status === filter.status);
|
|
5152
|
+
if (filter.project_id === null)
|
|
5153
|
+
runs = runs.filter((r) => r.project_id === null);
|
|
5154
|
+
return runs;
|
|
5155
|
+
}
|
|
5111
5156
|
const d = db || getDatabase();
|
|
5112
5157
|
const conditions = [];
|
|
5113
5158
|
const params = [];
|
|
@@ -5299,6 +5344,7 @@ function listSynthesisEvents(filter, db) {
|
|
|
5299
5344
|
}
|
|
5300
5345
|
var init_synthesis = __esm(() => {
|
|
5301
5346
|
init_database();
|
|
5347
|
+
init_api_mode();
|
|
5302
5348
|
});
|
|
5303
5349
|
|
|
5304
5350
|
// src/lib/when-to-use-generator.ts
|
|
@@ -52518,6 +52564,7 @@ init_hooks();
|
|
|
52518
52564
|
|
|
52519
52565
|
// src/db/webhook_hooks.ts
|
|
52520
52566
|
init_database();
|
|
52567
|
+
init_api_mode();
|
|
52521
52568
|
function parseRow(row) {
|
|
52522
52569
|
return {
|
|
52523
52570
|
id: row["id"],
|
|
@@ -52535,6 +52582,18 @@ function parseRow(row) {
|
|
|
52535
52582
|
};
|
|
52536
52583
|
}
|
|
52537
52584
|
function createWebhookHook(input, db) {
|
|
52585
|
+
if (!db && isApiMode()) {
|
|
52586
|
+
const { data } = apiJson("POST", "/webhooks", {
|
|
52587
|
+
type: input.type,
|
|
52588
|
+
handler_url: input.handlerUrl,
|
|
52589
|
+
priority: input.priority,
|
|
52590
|
+
blocking: input.blocking,
|
|
52591
|
+
agent_id: input.agentId,
|
|
52592
|
+
project_id: input.projectId,
|
|
52593
|
+
description: input.description
|
|
52594
|
+
});
|
|
52595
|
+
return data;
|
|
52596
|
+
}
|
|
52538
52597
|
const d = db || getDatabase();
|
|
52539
52598
|
const id = shortUuid();
|
|
52540
52599
|
const timestamp = now();
|
|
@@ -52554,11 +52613,22 @@ function createWebhookHook(input, db) {
|
|
|
52554
52613
|
return getWebhookHook(id, d);
|
|
52555
52614
|
}
|
|
52556
52615
|
function getWebhookHook(id, db) {
|
|
52616
|
+
if (!db && isApiMode()) {
|
|
52617
|
+
const { status, data } = apiJson("GET", `/webhooks/${encodeURIComponent(id)}`);
|
|
52618
|
+
if (status === 404 || !data)
|
|
52619
|
+
return null;
|
|
52620
|
+
return data;
|
|
52621
|
+
}
|
|
52557
52622
|
const d = db || getDatabase();
|
|
52558
52623
|
const row = d.query("SELECT * FROM webhook_hooks WHERE id = ?").get(id);
|
|
52559
52624
|
return row ? parseRow(row) : null;
|
|
52560
52625
|
}
|
|
52561
52626
|
function listWebhookHooks(filter = {}, db) {
|
|
52627
|
+
if (!db && isApiMode()) {
|
|
52628
|
+
const q = toQuery({ type: filter.type, enabled: filter.enabled });
|
|
52629
|
+
const { data } = apiJson("GET", `/webhooks${q}`);
|
|
52630
|
+
return data ?? [];
|
|
52631
|
+
}
|
|
52562
52632
|
const d = db || getDatabase();
|
|
52563
52633
|
const conditions = [];
|
|
52564
52634
|
const params = [];
|
|
@@ -52575,6 +52645,16 @@ function listWebhookHooks(filter = {}, db) {
|
|
|
52575
52645
|
return rows.map(parseRow);
|
|
52576
52646
|
}
|
|
52577
52647
|
function updateWebhookHook(id, updates, db) {
|
|
52648
|
+
if (!db && isApiMode()) {
|
|
52649
|
+
const { status, data } = apiJson("PATCH", `/webhooks/${encodeURIComponent(id)}`, {
|
|
52650
|
+
enabled: updates.enabled,
|
|
52651
|
+
priority: updates.priority,
|
|
52652
|
+
description: updates.description
|
|
52653
|
+
});
|
|
52654
|
+
if (status === 404 || !data)
|
|
52655
|
+
return null;
|
|
52656
|
+
return data;
|
|
52657
|
+
}
|
|
52578
52658
|
const d = db || getDatabase();
|
|
52579
52659
|
const existing = getWebhookHook(id, d);
|
|
52580
52660
|
if (!existing)
|
|
@@ -52600,11 +52680,18 @@ function updateWebhookHook(id, updates, db) {
|
|
|
52600
52680
|
return getWebhookHook(id, d);
|
|
52601
52681
|
}
|
|
52602
52682
|
function deleteWebhookHook(id, db) {
|
|
52683
|
+
if (!db && isApiMode()) {
|
|
52684
|
+
const { status } = apiJson("DELETE", `/webhooks/${encodeURIComponent(id)}`);
|
|
52685
|
+
return status === 204 || status === 200;
|
|
52686
|
+
}
|
|
52603
52687
|
const d = db || getDatabase();
|
|
52604
52688
|
const result = d.run("DELETE FROM webhook_hooks WHERE id = ?", [id]);
|
|
52605
52689
|
return result.changes > 0;
|
|
52606
52690
|
}
|
|
52607
52691
|
function recordWebhookInvocation(id, success, db) {
|
|
52692
|
+
if (!db && isApiMode()) {
|
|
52693
|
+
return;
|
|
52694
|
+
}
|
|
52608
52695
|
const d = db || getDatabase();
|
|
52609
52696
|
if (success) {
|
|
52610
52697
|
d.run("UPDATE webhook_hooks SET invocation_count = invocation_count + 1 WHERE id = ?", [id]);
|
|
@@ -52825,6 +52912,7 @@ init_database();
|
|
|
52825
52912
|
|
|
52826
52913
|
// src/db/session-jobs.ts
|
|
52827
52914
|
init_database();
|
|
52915
|
+
init_api_mode();
|
|
52828
52916
|
function parseJobRow(row) {
|
|
52829
52917
|
return {
|
|
52830
52918
|
id: row["id"],
|
|
@@ -52864,6 +52952,12 @@ function createSessionJob(input, db) {
|
|
|
52864
52952
|
return getSessionJob(id, d);
|
|
52865
52953
|
}
|
|
52866
52954
|
function getSessionJob(id, db) {
|
|
52955
|
+
if (!db && isApiMode()) {
|
|
52956
|
+
const { status, data } = apiJson("GET", `/sessions/jobs/${encodeURIComponent(id)}`);
|
|
52957
|
+
if (status === 404 || !data)
|
|
52958
|
+
return null;
|
|
52959
|
+
return data;
|
|
52960
|
+
}
|
|
52867
52961
|
const d = db || getDatabase();
|
|
52868
52962
|
const row = d.query("SELECT * FROM session_memory_jobs WHERE id = ?").get(id);
|
|
52869
52963
|
if (!row)
|
|
@@ -52871,6 +52965,16 @@ function getSessionJob(id, db) {
|
|
|
52871
52965
|
return parseJobRow(row);
|
|
52872
52966
|
}
|
|
52873
52967
|
function listSessionJobs(filter, db) {
|
|
52968
|
+
if (!db && isApiMode()) {
|
|
52969
|
+
const q = toQuery({
|
|
52970
|
+
agent_id: filter?.agent_id,
|
|
52971
|
+
project_id: filter?.project_id,
|
|
52972
|
+
status: filter?.status,
|
|
52973
|
+
limit: filter?.limit
|
|
52974
|
+
});
|
|
52975
|
+
const { data } = apiJson("GET", `/sessions/jobs${q}`);
|
|
52976
|
+
return data?.jobs ?? [];
|
|
52977
|
+
}
|
|
52874
52978
|
const d = db || getDatabase();
|
|
52875
52979
|
const conditions = [];
|
|
52876
52980
|
const params = [];
|
|
@@ -56086,6 +56190,19 @@ addRoute("GET", "/api/entities/:id/relations", (_req, url, params) => {
|
|
|
56086
56190
|
throw e;
|
|
56087
56191
|
}
|
|
56088
56192
|
});
|
|
56193
|
+
addRoute("GET", "/api/entities/:id/related", (_req, url, params) => {
|
|
56194
|
+
const q = getSearchParams(url);
|
|
56195
|
+
try {
|
|
56196
|
+
getEntity(params["id"]);
|
|
56197
|
+
const entities = getRelatedEntities(params["id"], q["type"]);
|
|
56198
|
+
return json({ entities, count: entities.length });
|
|
56199
|
+
} catch (e) {
|
|
56200
|
+
if (e instanceof EntityNotFoundError) {
|
|
56201
|
+
return errorResponse(e.message, 404);
|
|
56202
|
+
}
|
|
56203
|
+
throw e;
|
|
56204
|
+
}
|
|
56205
|
+
});
|
|
56089
56206
|
addRoute("DELETE", "/api/entities/:entityId/memories/:memoryId", (_req, _url, params) => {
|
|
56090
56207
|
unlinkEntityFromMemory(params["entityId"], params["memoryId"]);
|
|
56091
56208
|
return json({ deleted: true });
|
|
@@ -56422,6 +56539,7 @@ function registerSystemHookRoutes() {
|
|
|
56422
56539
|
|
|
56423
56540
|
// src/lib/synthesis/index.ts
|
|
56424
56541
|
init_database();
|
|
56542
|
+
init_api_mode();
|
|
56425
56543
|
init_synthesis();
|
|
56426
56544
|
|
|
56427
56545
|
// src/lib/synthesis/corpus-builder.ts
|
|
@@ -57306,6 +57424,11 @@ async function rollbackSynthesis(runId, db) {
|
|
|
57306
57424
|
return result;
|
|
57307
57425
|
}
|
|
57308
57426
|
function getSynthesisStatus(runId, projectId, db) {
|
|
57427
|
+
if (!db && isApiMode()) {
|
|
57428
|
+
const q = toQuery({ run_id: runId, project_id: projectId });
|
|
57429
|
+
const { data } = apiJson("GET", `/synthesis/status${q}`);
|
|
57430
|
+
return data ?? { lastRun: null, recentRuns: [] };
|
|
57431
|
+
}
|
|
57309
57432
|
const d = db || getDatabase();
|
|
57310
57433
|
if (runId) {
|
|
57311
57434
|
const recentRuns2 = listSynthesisRuns({ project_id: projectId ?? null, limit: 10 }, d);
|