nodal-agents 0.6.8 → 0.7.0
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/cli.js +24 -0
- package/migrations/0051_memory_search_fts.sql +2 -0
- package/migrations/0052_entities_memory_curation.sql +1 -0
- package/migrations/0053_memory_importance_locked.sql +1 -0
- package/migrations/meta/_journal.json +21 -0
- package/package.json +1 -1
- package/runner.js +157 -39
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/app-path-routes-manifest.json +2 -2
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +3 -3
- package/web/.next/server/app/(dashboard)/agents/[id]/edit/page.js +2 -2
- package/web/.next/server/app/(dashboard)/agents/[id]/edit/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/agents/[id]/telegram/page.js +2 -2
- package/web/.next/server/app/(dashboard)/agents/[id]/telegram/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/agents/[id]/telegram/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/agents/page.js +2 -2
- package/web/.next/server/app/(dashboard)/agents/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/agents/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/approvals/page.js +2 -2
- package/web/.next/server/app/(dashboard)/approvals/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/approvals/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/automations/page.js +2 -2
- package/web/.next/server/app/(dashboard)/automations/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/automations/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/chat/page.js +2 -2
- package/web/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/connectors/page.js +2 -2
- package/web/.next/server/app/(dashboard)/connectors/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/connectors/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/credentials/page.js +1 -1
- package/web/.next/server/app/(dashboard)/credentials/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/credentials/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/jobs/[id]/page.js +2 -2
- package/web/.next/server/app/(dashboard)/jobs/[id]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/jobs/[id]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/jobs/page.js +2 -2
- package/web/.next/server/app/(dashboard)/jobs/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/jobs/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/learned-skills/page.js +2 -2
- package/web/.next/server/app/(dashboard)/learned-skills/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/llm-providers/page.js +2 -2
- package/web/.next/server/app/(dashboard)/llm-providers/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/llm-providers/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/logs/page.js +1 -1
- package/web/.next/server/app/(dashboard)/logs/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/logs/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/mcp/page.js +1 -1
- package/web/.next/server/app/(dashboard)/mcp/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/memories/page.js +2 -2
- package/web/.next/server/app/(dashboard)/memories/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/memories/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/page.js +3 -3
- package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/settings/page.js +2 -2
- package/web/.next/server/app/(dashboard)/settings/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/settings/root-context/page.js +2 -2
- package/web/.next/server/app/(dashboard)/settings/root-context/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/settings/root-context/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/skills/[id]/edit/page.js +2 -2
- package/web/.next/server/app/(dashboard)/skills/[id]/edit/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/skills/[id]/edit/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/skills/new/page.js +2 -2
- package/web/.next/server/app/(dashboard)/skills/new/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/skills/new/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/skills/page.js +2 -2
- package/web/.next/server/app/(dashboard)/skills/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_global-error.html +1 -1
- package/web/.next/server/app/_global-error.rsc +2 -2
- package/web/.next/server/app/_global-error.segments/_full.segment.rsc +2 -2
- package/web/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_index.segment.rsc +2 -2
- package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_not-found.html +1 -1
- package/web/.next/server/app/_not-found.rsc +3 -3
- package/web/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/web/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/web/.next/server/app/api/oauth/[provider]/callback/route.js +1 -1
- package/web/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/onboarding/page.js +66 -62
- package/web/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app-paths-manifest.json +2 -2
- package/web/.next/server/chunks/2713.js +17 -13
- package/web/.next/server/chunks/3223.js +1 -1
- package/web/.next/server/chunks/4574.js +1 -1
- package/web/.next/server/chunks/4626.js +1 -0
- package/web/.next/server/chunks/8971.js +1 -0
- package/web/.next/server/chunks/9043.js +1 -0
- package/web/.next/server/middleware-build-manifest.js +1 -1
- package/web/.next/server/pages/404.html +1 -1
- package/web/.next/server/pages/500.html +1 -1
- package/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/server/server-reference-manifest.json +1 -1
- package/web/.next/static/chunks/4964-08171c654e41b0a4.js +1 -0
- package/web/.next/static/chunks/{9836-6a7e70d2572d9671.js → 9836-6830cb9d49ad261f.js} +1 -1
- package/web/.next/static/chunks/app/(dashboard)/agents/[id]/edit/page-fa5717f0d0450659.js +6 -0
- package/web/.next/static/chunks/app/(dashboard)/agents/[id]/telegram/{page-a858be2a0b9d5d42.js → page-73012222871598aa.js} +1 -1
- package/web/.next/static/chunks/app/(dashboard)/agents/page-7e9616b28c098e9e.js +1 -0
- package/web/.next/static/chunks/app/(dashboard)/approvals/{page-6435e07096efe1ef.js → page-9a01cb723a6ccff0.js} +1 -1
- package/web/.next/static/chunks/app/(dashboard)/automations/page-85c985cd687406ed.js +1 -0
- package/web/.next/static/chunks/app/(dashboard)/chat/page-a6cc7a58986c0340.js +1 -0
- package/web/.next/static/chunks/app/(dashboard)/connectors/page-21d6c042800c8cd3.js +1 -0
- package/web/.next/static/chunks/app/(dashboard)/jobs/[id]/page-f6b993a88c70a2fe.js +1 -0
- package/web/.next/static/chunks/app/(dashboard)/jobs/page-d0d6b9db1b68451f.js +1 -0
- package/web/.next/static/chunks/app/(dashboard)/layout-d2ac2646967496bb.js +1 -0
- package/web/.next/static/chunks/app/(dashboard)/learned-skills/page-ec6312f6dfd7ee23.js +1 -0
- package/web/.next/static/chunks/app/(dashboard)/llm-providers/page-1fb26463eddf509c.js +1 -0
- package/web/.next/static/chunks/app/(dashboard)/logs/{page-f9efb4dd80bf104a.js → page-0bca733315e8a208.js} +1 -1
- package/web/.next/static/chunks/app/(dashboard)/mcp/page-ff56ecf2f65f5466.js +1 -0
- package/web/.next/static/chunks/app/(dashboard)/memories/page-fe4d9438c93750d6.js +1 -0
- package/web/.next/static/chunks/app/(dashboard)/page-9402fe2931216f4b.js +1 -0
- package/web/.next/static/chunks/app/(dashboard)/settings/page-995662f10ebff365.js +1 -0
- package/web/.next/static/chunks/app/(dashboard)/settings/root-context/page-785b6ce3e4c5890b.js +1 -0
- package/web/.next/static/chunks/app/(dashboard)/skills/[id]/edit/page-2106201c4df8b5a4.js +1 -0
- package/web/.next/static/chunks/app/(dashboard)/skills/new/page-0135bcb86ab60dc2.js +1 -0
- package/web/.next/static/chunks/app/(dashboard)/skills/{page-af8d329facf31c8f.js → page-54e939d40c8b5b6d.js} +1 -1
- package/web/.next/static/chunks/app/onboarding/page-a4116e2f430eaff8.js +26 -0
- package/web/.next/static/css/eff119dd24f92093.css +3 -0
- package/web/.next/server/chunks/2053.js +0 -1
- package/web/.next/server/chunks/5290.js +0 -1
- package/web/.next/server/chunks/9282.js +0 -1
- package/web/.next/static/chunks/4964-09a4dc14acc324f3.js +0 -1
- package/web/.next/static/chunks/app/(dashboard)/agents/[id]/edit/page-1172f97f44c6b953.js +0 -6
- package/web/.next/static/chunks/app/(dashboard)/agents/page-637555c8b299e4d7.js +0 -1
- package/web/.next/static/chunks/app/(dashboard)/automations/page-416f63bbd11d1a93.js +0 -1
- package/web/.next/static/chunks/app/(dashboard)/chat/page-53507d81c2ceee4c.js +0 -1
- package/web/.next/static/chunks/app/(dashboard)/connectors/page-f6a4d52ef7ea8c7f.js +0 -1
- package/web/.next/static/chunks/app/(dashboard)/jobs/[id]/page-acb7d1383384f27b.js +0 -1
- package/web/.next/static/chunks/app/(dashboard)/jobs/page-b82e456c240416ad.js +0 -1
- package/web/.next/static/chunks/app/(dashboard)/layout-d0662737b23eaebb.js +0 -1
- package/web/.next/static/chunks/app/(dashboard)/learned-skills/page-3c67b5a3869a9224.js +0 -1
- package/web/.next/static/chunks/app/(dashboard)/llm-providers/page-294135b03955dd45.js +0 -1
- package/web/.next/static/chunks/app/(dashboard)/mcp/page-482dc02cf953c197.js +0 -1
- package/web/.next/static/chunks/app/(dashboard)/memories/page-ce432008a8a4c118.js +0 -1
- package/web/.next/static/chunks/app/(dashboard)/page-d76a7350bf5bea10.js +0 -1
- package/web/.next/static/chunks/app/(dashboard)/settings/page-80cb948b3c0cef7d.js +0 -1
- package/web/.next/static/chunks/app/(dashboard)/settings/root-context/page-8e7dabbb399e369d.js +0 -1
- package/web/.next/static/chunks/app/(dashboard)/skills/[id]/edit/page-d20237d23a440118.js +0 -1
- package/web/.next/static/chunks/app/(dashboard)/skills/new/page-8454b37bed789c4e.js +0 -1
- package/web/.next/static/chunks/app/onboarding/page-3543225eab5f4029.js +0 -26
- package/web/.next/static/css/b06a60c5d9b30bc8.css +0 -3
- /package/web/.next/static/{RORb5LJdSgtd7i6KVr0zl → KFac7DQ7gdp9XPQ2bnb-2}/_buildManifest.js +0 -0
- /package/web/.next/static/{RORb5LJdSgtd7i6KVr0zl → KFac7DQ7gdp9XPQ2bnb-2}/_ssgManifest.js +0 -0
package/cli.js
CHANGED
|
@@ -11511,6 +11511,10 @@ var init_memory = __esm({
|
|
|
11511
11511
|
valid_to: z13.string().datetime().nullable(),
|
|
11512
11512
|
fact_hash: z13.string().nullable(),
|
|
11513
11513
|
archived: z13.boolean(),
|
|
11514
|
+
// User override lock (migration 0053) — when true, the curator refuses to
|
|
11515
|
+
// re-score importance for this fact. Defaulted so rows/objects predating
|
|
11516
|
+
// the column still parse.
|
|
11517
|
+
importance_locked: z13.boolean().default(false),
|
|
11514
11518
|
last_accessed_at: z13.string().datetime().nullable(),
|
|
11515
11519
|
access_count: z13.number().int().min(0),
|
|
11516
11520
|
created_at: z13.string().datetime(),
|
|
@@ -11522,6 +11526,7 @@ var init_memory = __esm({
|
|
|
11522
11526
|
updated_at: true,
|
|
11523
11527
|
fact_hash: true,
|
|
11524
11528
|
archived: true,
|
|
11529
|
+
importance_locked: true,
|
|
11525
11530
|
last_accessed_at: true,
|
|
11526
11531
|
access_count: true,
|
|
11527
11532
|
valid_from: true,
|
|
@@ -12330,6 +12335,10 @@ var init_entities = __esm({
|
|
|
12330
12335
|
updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow(),
|
|
12331
12336
|
lastCuratorRunAt: timestamp("last_curator_run_at", { withTimezone: true }),
|
|
12332
12337
|
reflectionEnabled: boolean("reflection_enabled").notNull().default(false),
|
|
12338
|
+
// Decoupled from reflection_enabled (which gates the skill-learning loop,
|
|
12339
|
+
// opt-in). Gates the memory curator (Phase 2 LLM pass) — ON by default so
|
|
12340
|
+
// memory curation runs even for entities that never opted into reflection.
|
|
12341
|
+
memoryCurationEnabled: boolean("memory_curation_enabled").notNull().default(true),
|
|
12333
12342
|
// Controls whether agent-authored skills are auto-assigned to the authoring
|
|
12334
12343
|
// agent ('auto') or queued for the entity owner to approve ('approval').
|
|
12335
12344
|
skillAssignmentMode: text("skill_assignment_mode").notNull().default("approval").$type(),
|
|
@@ -12886,6 +12895,15 @@ var init_memory2 = __esm({
|
|
|
12886
12895
|
id: uuid("id").primaryKey().defaultRandom(),
|
|
12887
12896
|
entityId: uuid("entity_id").references(() => entities.id, { onDelete: "cascade" }),
|
|
12888
12897
|
agentId: uuid("agent_id").references(() => agents.id, { onDelete: "cascade" }),
|
|
12898
|
+
/**
|
|
12899
|
+
* Full-text source. A generated `search_tsv tsvector` column + GIN index
|
|
12900
|
+
* (raw SQL, migration 0051 — not expressible in the Drizzle schema builder,
|
|
12901
|
+
* same pattern as agent_jobs.search_tsv / migration 0050) makes this fact
|
|
12902
|
+
* rankable by relevance. Powers memory injection (selectMemoriesForInjection)
|
|
12903
|
+
* and the `query_memory` builtin (keywordSearchMemories) via ts_rank.
|
|
12904
|
+
* Config is `'english'` (stemming — "tokens" matches a "token" query),
|
|
12905
|
+
* unlike agent_jobs.search_tsv which stays `'simple'`.
|
|
12906
|
+
*/
|
|
12889
12907
|
fact: text("fact").notNull(),
|
|
12890
12908
|
category: text("category").default("context"),
|
|
12891
12909
|
importance: integer("importance").default(3),
|
|
@@ -12897,6 +12915,12 @@ var init_memory2 = __esm({
|
|
|
12897
12915
|
validTo: timestamp("valid_to", { withTimezone: true }),
|
|
12898
12916
|
factHash: text("fact_hash"),
|
|
12899
12917
|
archived: boolean("archived").default(false),
|
|
12918
|
+
/**
|
|
12919
|
+
* User override lock (migration 0053). When true, the curator's
|
|
12920
|
+
* usage-driven re-scoring MUST refuse to touch importance — a user-pinned
|
|
12921
|
+
* value wins over the agent's guess and the curator's correction.
|
|
12922
|
+
*/
|
|
12923
|
+
importanceLocked: boolean("importance_locked").notNull().default(false),
|
|
12900
12924
|
lastAccessedAt: timestamp("last_accessed_at", { withTimezone: true }).defaultNow(),
|
|
12901
12925
|
accessCount: integer("access_count").default(0),
|
|
12902
12926
|
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "entities" ADD COLUMN "memory_curation_enabled" boolean NOT NULL DEFAULT true;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "agent_memory" ADD COLUMN "importance_locked" boolean NOT NULL DEFAULT false;
|
|
@@ -351,6 +351,27 @@
|
|
|
351
351
|
"when": 1783000000000,
|
|
352
352
|
"tag": "0050_jobs_search_fts",
|
|
353
353
|
"breakpoints": true
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"idx": 51,
|
|
357
|
+
"version": "7",
|
|
358
|
+
"when": 1783100000000,
|
|
359
|
+
"tag": "0051_memory_search_fts",
|
|
360
|
+
"breakpoints": true
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"idx": 52,
|
|
364
|
+
"version": "7",
|
|
365
|
+
"when": 1783200000000,
|
|
366
|
+
"tag": "0052_entities_memory_curation",
|
|
367
|
+
"breakpoints": true
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"idx": 53,
|
|
371
|
+
"version": "7",
|
|
372
|
+
"when": 1783300000000,
|
|
373
|
+
"tag": "0053_memory_importance_locked",
|
|
374
|
+
"breakpoints": true
|
|
354
375
|
}
|
|
355
376
|
]
|
|
356
377
|
}
|
package/package.json
CHANGED
package/runner.js
CHANGED
|
@@ -574,6 +574,10 @@ var init_memory = __esm({
|
|
|
574
574
|
valid_to: z13.string().datetime().nullable(),
|
|
575
575
|
fact_hash: z13.string().nullable(),
|
|
576
576
|
archived: z13.boolean(),
|
|
577
|
+
// User override lock (migration 0053) — when true, the curator refuses to
|
|
578
|
+
// re-score importance for this fact. Defaulted so rows/objects predating
|
|
579
|
+
// the column still parse.
|
|
580
|
+
importance_locked: z13.boolean().default(false),
|
|
577
581
|
last_accessed_at: z13.string().datetime().nullable(),
|
|
578
582
|
access_count: z13.number().int().min(0),
|
|
579
583
|
created_at: z13.string().datetime(),
|
|
@@ -585,6 +589,7 @@ var init_memory = __esm({
|
|
|
585
589
|
updated_at: true,
|
|
586
590
|
fact_hash: true,
|
|
587
591
|
archived: true,
|
|
592
|
+
importance_locked: true,
|
|
588
593
|
last_accessed_at: true,
|
|
589
594
|
access_count: true,
|
|
590
595
|
valid_from: true,
|
|
@@ -1593,6 +1598,10 @@ var init_entities = __esm({
|
|
|
1593
1598
|
updatedAt: timestamp2("updated_at", { withTimezone: true }).defaultNow(),
|
|
1594
1599
|
lastCuratorRunAt: timestamp2("last_curator_run_at", { withTimezone: true }),
|
|
1595
1600
|
reflectionEnabled: boolean2("reflection_enabled").notNull().default(false),
|
|
1601
|
+
// Decoupled from reflection_enabled (which gates the skill-learning loop,
|
|
1602
|
+
// opt-in). Gates the memory curator (Phase 2 LLM pass) — ON by default so
|
|
1603
|
+
// memory curation runs even for entities that never opted into reflection.
|
|
1604
|
+
memoryCurationEnabled: boolean2("memory_curation_enabled").notNull().default(true),
|
|
1596
1605
|
// Controls whether agent-authored skills are auto-assigned to the authoring
|
|
1597
1606
|
// agent ('auto') or queued for the entity owner to approve ('approval').
|
|
1598
1607
|
skillAssignmentMode: text2("skill_assignment_mode").notNull().default("approval").$type(),
|
|
@@ -2190,6 +2199,15 @@ var init_memory2 = __esm({
|
|
|
2190
2199
|
id: uuid11("id").primaryKey().defaultRandom(),
|
|
2191
2200
|
entityId: uuid11("entity_id").references(() => entities.id, { onDelete: "cascade" }),
|
|
2192
2201
|
agentId: uuid11("agent_id").references(() => agents.id, { onDelete: "cascade" }),
|
|
2202
|
+
/**
|
|
2203
|
+
* Full-text source. A generated `search_tsv tsvector` column + GIN index
|
|
2204
|
+
* (raw SQL, migration 0051 — not expressible in the Drizzle schema builder,
|
|
2205
|
+
* same pattern as agent_jobs.search_tsv / migration 0050) makes this fact
|
|
2206
|
+
* rankable by relevance. Powers memory injection (selectMemoriesForInjection)
|
|
2207
|
+
* and the `query_memory` builtin (keywordSearchMemories) via ts_rank.
|
|
2208
|
+
* Config is `'english'` (stemming — "tokens" matches a "token" query),
|
|
2209
|
+
* unlike agent_jobs.search_tsv which stays `'simple'`.
|
|
2210
|
+
*/
|
|
2193
2211
|
fact: text11("fact").notNull(),
|
|
2194
2212
|
category: text11("category").default("context"),
|
|
2195
2213
|
importance: integer5("importance").default(3),
|
|
@@ -2201,6 +2219,12 @@ var init_memory2 = __esm({
|
|
|
2201
2219
|
validTo: timestamp11("valid_to", { withTimezone: true }),
|
|
2202
2220
|
factHash: text11("fact_hash"),
|
|
2203
2221
|
archived: boolean6("archived").default(false),
|
|
2222
|
+
/**
|
|
2223
|
+
* User override lock (migration 0053). When true, the curator's
|
|
2224
|
+
* usage-driven re-scoring MUST refuse to touch importance — a user-pinned
|
|
2225
|
+
* value wins over the agent's guess and the curator's correction.
|
|
2226
|
+
*/
|
|
2227
|
+
importanceLocked: boolean6("importance_locked").notNull().default(false),
|
|
2204
2228
|
lastAccessedAt: timestamp11("last_accessed_at", { withTimezone: true }).defaultNow(),
|
|
2205
2229
|
accessCount: integer5("access_count").default(0),
|
|
2206
2230
|
createdAt: timestamp11("created_at", { withTimezone: true }).defaultNow(),
|
|
@@ -17705,6 +17729,17 @@ var envSchema = z.object({
|
|
|
17705
17729
|
CURATOR_MEMORY_STALE_DAYS: z.coerce.number().default(60),
|
|
17706
17730
|
CURATOR_MEMORY_IMPORTANCE_MAX: z.coerce.number().default(2),
|
|
17707
17731
|
CURATOR_MEMORY_MIN: z.coerce.number().default(8),
|
|
17732
|
+
// Kill-switch semantics mirror REFLECTION_ENABLED but gate the MEMORY curator
|
|
17733
|
+
// (Phase 2 LLM pass) specifically — decoupled from the skill-learning loop:
|
|
17734
|
+
// MEMORY_CURATION_ENABLED='false' → global kill: disables memory curation
|
|
17735
|
+
// for every entity.
|
|
17736
|
+
// MEMORY_CURATION_ENABLED='' → per-entity decides (production default
|
|
17737
|
+
// (unset) when the var is absent). Since
|
|
17738
|
+
// entities.memory_curation_enabled
|
|
17739
|
+
// defaults TRUE, memory curation runs
|
|
17740
|
+
// out of the box — unlike reflection.
|
|
17741
|
+
// MEMORY_CURATION_ENABLED='true' → per-entity decides (same as unset).
|
|
17742
|
+
MEMORY_CURATION_ENABLED: z.string().default(""),
|
|
17708
17743
|
// Optional. When set, the reflection + curator passes use THIS model id instead of
|
|
17709
17744
|
// the agent's model — resolved against the agent's existing LLM key (ideal for an
|
|
17710
17745
|
// OpenRouter key where one key serves many models; point the cheap/reliable
|
|
@@ -20026,6 +20061,7 @@ function rowToMemory(row) {
|
|
|
20026
20061
|
valid_to: row.validTo?.toISOString() ?? null,
|
|
20027
20062
|
fact_hash: row.factHash ?? null,
|
|
20028
20063
|
archived: row.archived ?? false,
|
|
20064
|
+
importance_locked: row.importanceLocked ?? false,
|
|
20029
20065
|
last_accessed_at: row.lastAccessedAt?.toISOString() ?? null,
|
|
20030
20066
|
access_count: row.accessCount ?? 0,
|
|
20031
20067
|
created_at: row.createdAt?.toISOString() ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -20051,19 +20087,29 @@ function keywordOrderBy(sort) {
|
|
|
20051
20087
|
}
|
|
20052
20088
|
async function keywordSearch(db, query, filters, sort = "importance") {
|
|
20053
20089
|
const { entityId, agentId, skillTags, category, limit } = filters;
|
|
20054
|
-
const
|
|
20090
|
+
const orTerms = query.replace(/[^\w\s]/g, " ").split(/\s+/).filter((w) => w.length > 2).slice(0, 8).map((w) => w.replace(/[^a-zA-Z0-9]/g, "")).filter((w) => w.length > 0);
|
|
20055
20091
|
const conditions = buildWhereConditions({ entityId, agentId, skillTags, category });
|
|
20056
20092
|
const orderBy = keywordOrderBy(sort);
|
|
20057
|
-
if (
|
|
20058
|
-
const
|
|
20059
|
-
const
|
|
20093
|
+
if (orTerms.length > 0) {
|
|
20094
|
+
const tsv = sql18`"agent_memory"."search_tsv"`;
|
|
20095
|
+
const tsq = sql18`to_tsquery('english', ${orTerms.join(" | ")})`;
|
|
20096
|
+
const rows2 = await db.select().from(agentMemory).where(and3(...conditions, sql18`${tsv} @@ ${tsq}`)).orderBy(sql18`ts_rank(${tsv}, ${tsq}) DESC`, ...orderBy).limit(limit);
|
|
20060
20097
|
return rows2;
|
|
20061
20098
|
}
|
|
20062
20099
|
const rows = await db.select().from(agentMemory).where(and3(...conditions)).orderBy(...orderBy).limit(limit);
|
|
20063
20100
|
return rows;
|
|
20064
20101
|
}
|
|
20065
20102
|
async function keywordSearchMemories(db, opts) {
|
|
20066
|
-
const {
|
|
20103
|
+
const {
|
|
20104
|
+
query,
|
|
20105
|
+
entityId,
|
|
20106
|
+
agentId,
|
|
20107
|
+
skillTags,
|
|
20108
|
+
category,
|
|
20109
|
+
limit = 10,
|
|
20110
|
+
sort = "importance",
|
|
20111
|
+
touch = true
|
|
20112
|
+
} = opts;
|
|
20067
20113
|
const rows = await keywordSearch(
|
|
20068
20114
|
db,
|
|
20069
20115
|
query,
|
|
@@ -20071,7 +20117,7 @@ async function keywordSearchMemories(db, opts) {
|
|
|
20071
20117
|
sort
|
|
20072
20118
|
);
|
|
20073
20119
|
const memories = rows.map((r) => rowToMemory(r));
|
|
20074
|
-
if (memories.length > 0) {
|
|
20120
|
+
if (touch && memories.length > 0) {
|
|
20075
20121
|
await touchMemories(
|
|
20076
20122
|
db,
|
|
20077
20123
|
memories.map((m) => m.id),
|
|
@@ -20143,6 +20189,10 @@ async function loadSource(db, entityId, memoryId) {
|
|
|
20143
20189
|
const [row] = await db.select({ source: agentMemory.source }).from(agentMemory).where(and3(eq5(agentMemory.id, memoryId), eq5(agentMemory.entityId, entityId))).limit(1);
|
|
20144
20190
|
return row ? row.source : void 0;
|
|
20145
20191
|
}
|
|
20192
|
+
async function loadSourceAndLock(db, entityId, memoryId) {
|
|
20193
|
+
const [row] = await db.select({ source: agentMemory.source, importanceLocked: agentMemory.importanceLocked }).from(agentMemory).where(and3(eq5(agentMemory.id, memoryId), eq5(agentMemory.entityId, entityId))).limit(1);
|
|
20194
|
+
return row ? { source: row.source, importanceLocked: row.importanceLocked } : void 0;
|
|
20195
|
+
}
|
|
20146
20196
|
async function archiveAgentMemory(db, entityId, memoryId) {
|
|
20147
20197
|
const source = await loadSource(db, entityId, memoryId);
|
|
20148
20198
|
if (source === void 0) return { error: "not_found" };
|
|
@@ -20158,6 +20208,17 @@ async function updateAgentMemoryFact(db, entityId, memoryId, fact) {
|
|
|
20158
20208
|
await db.update(agentMemory).set({ fact: trimmed, factHash: computeFactHash(trimmed), updatedAt: /* @__PURE__ */ new Date() }).where(and3(eq5(agentMemory.id, memoryId), eq5(agentMemory.entityId, entityId)));
|
|
20159
20209
|
return { ok: true };
|
|
20160
20210
|
}
|
|
20211
|
+
async function updateAgentMemoryImportance(db, entityId, memoryId, importance) {
|
|
20212
|
+
if (!Number.isInteger(importance) || importance < 1 || importance > 5) {
|
|
20213
|
+
return { error: "invalid_importance" };
|
|
20214
|
+
}
|
|
20215
|
+
const row = await loadSourceAndLock(db, entityId, memoryId);
|
|
20216
|
+
if (row === void 0) return { error: "not_found" };
|
|
20217
|
+
if (row.source === "manual") return { error: "not_agent_memory" };
|
|
20218
|
+
if (row.importanceLocked) return { error: "importance_locked" };
|
|
20219
|
+
await db.update(agentMemory).set({ importance, updatedAt: /* @__PURE__ */ new Date() }).where(and3(eq5(agentMemory.id, memoryId), eq5(agentMemory.entityId, entityId)));
|
|
20220
|
+
return { ok: true };
|
|
20221
|
+
}
|
|
20161
20222
|
|
|
20162
20223
|
// ../../packages/memory/src/inject.ts
|
|
20163
20224
|
var RENDER_OVERHEAD_PER_ENTRY = 20;
|
|
@@ -20303,9 +20364,13 @@ function selectMemoriesUnderBudget(memories, maxChars, query) {
|
|
|
20303
20364
|
if (aTouched !== bTouched) return bTouched.localeCompare(aTouched);
|
|
20304
20365
|
return a.id.localeCompare(b.id);
|
|
20305
20366
|
});
|
|
20367
|
+
return packUnderBudget(sorted, maxChars);
|
|
20368
|
+
}
|
|
20369
|
+
function packUnderBudget(memories, maxChars) {
|
|
20370
|
+
if (maxChars <= 0) return [];
|
|
20306
20371
|
const picked = [];
|
|
20307
20372
|
let used = 0;
|
|
20308
|
-
for (const m of
|
|
20373
|
+
for (const m of memories) {
|
|
20309
20374
|
const cost = m.fact.length + RENDER_OVERHEAD_PER_ENTRY;
|
|
20310
20375
|
if (used + cost > maxChars) continue;
|
|
20311
20376
|
picked.push(m);
|
|
@@ -20316,13 +20381,25 @@ function selectMemoriesUnderBudget(memories, maxChars, query) {
|
|
|
20316
20381
|
var MAX_CANDIDATES = 200;
|
|
20317
20382
|
async function selectMemoriesForInjection(db, opts) {
|
|
20318
20383
|
if (opts.maxChars <= 0) return [];
|
|
20319
|
-
const
|
|
20320
|
-
|
|
20321
|
-
|
|
20322
|
-
|
|
20323
|
-
|
|
20324
|
-
|
|
20325
|
-
|
|
20384
|
+
const baseConditions = and3(
|
|
20385
|
+
eq5(agentMemory.entityId, opts.entityId),
|
|
20386
|
+
eq5(agentMemory.archived, false),
|
|
20387
|
+
sql18`(${agentMemory.validTo} IS NULL OR ${agentMemory.validTo} > now())`
|
|
20388
|
+
);
|
|
20389
|
+
const rawQuery = opts.query ?? "";
|
|
20390
|
+
const tokens = tokenizeQuery(rawQuery);
|
|
20391
|
+
if (tokens.length > 0) {
|
|
20392
|
+
const tsv = sql18`"agent_memory"."search_tsv"`;
|
|
20393
|
+
const tsq = sql18`plainto_tsquery('english', ${rawQuery})`;
|
|
20394
|
+
const candidates2 = await db.select().from(agentMemory).where(baseConditions).orderBy(
|
|
20395
|
+
sql18`ts_rank(${tsv}, ${tsq}) DESC`,
|
|
20396
|
+
desc(agentMemory.importance),
|
|
20397
|
+
desc(agentMemory.lastAccessedAt)
|
|
20398
|
+
).limit(MAX_CANDIDATES);
|
|
20399
|
+
const memories2 = candidates2.map((row) => rowToMemory(row));
|
|
20400
|
+
return packUnderBudget(memories2, opts.maxChars);
|
|
20401
|
+
}
|
|
20402
|
+
const candidates = await db.select().from(agentMemory).where(baseConditions).orderBy(desc(agentMemory.importance), desc(agentMemory.lastAccessedAt)).limit(MAX_CANDIDATES);
|
|
20326
20403
|
const memories = candidates.map((row) => rowToMemory(row));
|
|
20327
20404
|
return selectMemoriesUnderBudget(memories, opts.maxChars, opts.query);
|
|
20328
20405
|
}
|
|
@@ -44595,10 +44672,15 @@ var EditMemoryArgs = z113.object({
|
|
|
44595
44672
|
var ArchiveMemoryArgs = z113.object({
|
|
44596
44673
|
memoryId: z113.string().uuid("memoryId must be a valid UUID.")
|
|
44597
44674
|
});
|
|
44675
|
+
var SetImportanceArgs = z113.object({
|
|
44676
|
+
memoryId: z113.string().uuid("memoryId must be a valid UUID."),
|
|
44677
|
+
importance: z113.number().int().min(1).max(5),
|
|
44678
|
+
reason: z113.string().min(1).max(200)
|
|
44679
|
+
});
|
|
44598
44680
|
function buildSystemPrompt2(candidateList) {
|
|
44599
44681
|
return `You are the MEMORY CURATOR for this entity. Your job is to keep the durable-fact memory SMALL, DENSE, and NON-REDUNDANT, so the limited injection budget is spent on signal.
|
|
44600
44682
|
|
|
44601
|
-
CANDIDATE FACTS (id, source, importance, length, text):
|
|
44683
|
+
CANDIDATE FACTS (id, source, importance, access_count, length, text):
|
|
44602
44684
|
${candidateList}
|
|
44603
44685
|
|
|
44604
44686
|
WHAT A GOOD FACT IS: ONE short, durable statement (a preference, an ID, a convention, a learned rule) \u2014 typically under ${HEALTHY_FACT_CHARS} characters. NOT a document, a raw dump, or a session log.
|
|
@@ -44607,12 +44689,14 @@ ACTIONS:
|
|
|
44607
44689
|
1. DISTILL oversized facts \u2014 if a fact is a big blob (a pasted workflow/JSON, a long log, a transcript), call edit_memory to replace it with just the key statement + a pointer to where the artifact actually lives (e.g. "... saved in workspace file workflows/X.json"). Keep the SIGNAL, drop the bulk.
|
|
44608
44690
|
2. MERGE near-duplicates \u2014 when several facts say the same thing, edit_memory ONE of them to the best consolidated wording, then archive_memory the others.
|
|
44609
44691
|
3. ARCHIVE the clearly obsolete or contradictory.
|
|
44692
|
+
4. RE-SCORE importance \u2014 a fact's initial importance is just the authoring agent's one-shot estimate. access_count is PROVEN usage, and it is more reliable than that estimate. Call set_importance to RAISE the importance of a durable fact that is accessed often (it clearly matters), and to LOWER the importance of a fact that has never been used despite being around a while (it probably doesn't). Give a short reason.
|
|
44610
44693
|
|
|
44611
44694
|
HARD RULES:
|
|
44612
|
-
- You may ONLY edit/archive AGENT-authored facts. The tools REFUSE source='manual' (user-entered) \u2014 do NOT attempt them, and do not retry a refused call.
|
|
44695
|
+
- You may ONLY edit/archive/re-score AGENT-authored facts. The tools REFUSE source='manual' (user-entered) \u2014 do NOT attempt them, and do not retry a refused call.
|
|
44613
44696
|
- Archiving is the maximum action \u2014 it is reversible; never invent or fabricate facts.
|
|
44614
44697
|
- When a fact is already a clean short statement, LEAVE IT. A no-op pass is correct and common on a tidy pool.
|
|
44615
|
-
- Do NOT merge facts that are merely related but distinct \u2014 only true duplicates
|
|
44698
|
+
- Do NOT merge facts that are merely related but distinct \u2014 only true duplicates.
|
|
44699
|
+
- Do NOT re-score every fact out of habit \u2014 only when access_count clearly disagrees with the current importance.`;
|
|
44616
44700
|
}
|
|
44617
44701
|
function renderCandidates(facts) {
|
|
44618
44702
|
if (facts.length === 0) return "(none)";
|
|
@@ -44620,7 +44704,7 @@ function renderCandidates(facts) {
|
|
|
44620
44704
|
const len = f.fact.length;
|
|
44621
44705
|
const oversized = len > HEALTHY_FACT_CHARS ? " OVERSIZED" : "";
|
|
44622
44706
|
const text22 = len > 200 ? `${f.fact.slice(0, 200)}\u2026` : f.fact;
|
|
44623
|
-
return `- id=${f.id} source=${f.source ?? "agent"} importance=${f.importance ?? 3} len=${len}${oversized}
|
|
44707
|
+
return `- id=${f.id} source=${f.source ?? "agent"} importance=${f.importance ?? 3} access_count=${f.accessCount ?? 0} len=${len}${oversized}
|
|
44624
44708
|
${text22.replace(/\s+/g, " ")}`;
|
|
44625
44709
|
}).join("\n");
|
|
44626
44710
|
}
|
|
@@ -44629,9 +44713,10 @@ async function runMemoryCuration(db, entityId, maxTurns, reflectionModel) {
|
|
|
44629
44713
|
id: agentMemory.id,
|
|
44630
44714
|
fact: agentMemory.fact,
|
|
44631
44715
|
source: agentMemory.source,
|
|
44632
|
-
importance: agentMemory.importance
|
|
44716
|
+
importance: agentMemory.importance,
|
|
44717
|
+
accessCount: agentMemory.accessCount
|
|
44633
44718
|
}).from(agentMemory).where(and3(eq5(agentMemory.entityId, entityId), eq5(agentMemory.archived, false))).limit(MAX_CANDIDATES2);
|
|
44634
|
-
if (candidates.length === 0) return { edited: 0, archived: 0, turns: 0 };
|
|
44719
|
+
if (candidates.length === 0) return { edited: 0, archived: 0, rescored: 0, turns: 0 };
|
|
44635
44720
|
const agentRows = await db.select({
|
|
44636
44721
|
llmKeyId: agents.llmKeyId,
|
|
44637
44722
|
fallbackChain: agents.fallbackChain,
|
|
@@ -44654,7 +44739,7 @@ async function runMemoryCuration(db, entityId, maxTurns, reflectionModel) {
|
|
|
44654
44739
|
}
|
|
44655
44740
|
if (!resolved?.ok) {
|
|
44656
44741
|
console.warn(`${TRACE} no LLM client for entity ${entityId}, skipping`);
|
|
44657
|
-
return { edited: 0, archived: 0, turns: 0 };
|
|
44742
|
+
return { edited: 0, archived: 0, rescored: 0, turns: 0 };
|
|
44658
44743
|
}
|
|
44659
44744
|
const llmClient = resolved.client;
|
|
44660
44745
|
const systemPrompt = buildSystemPrompt2(renderCandidates(candidates));
|
|
@@ -44672,10 +44757,15 @@ async function runMemoryCuration(db, entityId, maxTurns, reflectionModel) {
|
|
|
44672
44757
|
archive_memory: {
|
|
44673
44758
|
description: "Soft-archive a redundant/obsolete agent-authored fact (reversible). Provide the memory UUID. Refuses user-entered (manual) facts.",
|
|
44674
44759
|
inputSchema: ArchiveMemoryArgs
|
|
44760
|
+
},
|
|
44761
|
+
set_importance: {
|
|
44762
|
+
description: "Re-score a fact's importance (1-5) from REAL usage (access_count) + relevance. Raise for frequently-accessed durable facts; lower for never-used ones. Refuses user-entered (manual) facts.",
|
|
44763
|
+
inputSchema: SetImportanceArgs
|
|
44675
44764
|
}
|
|
44676
44765
|
};
|
|
44677
44766
|
let edited = 0;
|
|
44678
44767
|
let archived = 0;
|
|
44768
|
+
let rescored = 0;
|
|
44679
44769
|
let turns = 0;
|
|
44680
44770
|
console.warn(`${TRACE} start`, { entityId, candidateCount: candidates.length });
|
|
44681
44771
|
for (let turn = 0; turn < maxTurns; turn += 1) {
|
|
@@ -44733,6 +44823,24 @@ async function runMemoryCuration(db, entityId, maxTurns, reflectionModel) {
|
|
|
44733
44823
|
outcome = `archived memory ${parsed.data.memoryId}`;
|
|
44734
44824
|
}
|
|
44735
44825
|
}
|
|
44826
|
+
} else if (tc.toolName === "set_importance") {
|
|
44827
|
+
const parsed = SetImportanceArgs.safeParse(tc.input);
|
|
44828
|
+
if (!parsed.success) {
|
|
44829
|
+
outcome = `error: invalid_input: ${parsed.error.message}`;
|
|
44830
|
+
} else {
|
|
44831
|
+
const res = await updateAgentMemoryImportance(
|
|
44832
|
+
db,
|
|
44833
|
+
entityId,
|
|
44834
|
+
parsed.data.memoryId,
|
|
44835
|
+
parsed.data.importance
|
|
44836
|
+
);
|
|
44837
|
+
if ("error" in res) {
|
|
44838
|
+
outcome = res.error === "not_agent_memory" ? `error: memory ${parsed.data.memoryId} is user-entered and cannot be re-scored by the curator.` : res.error === "invalid_importance" ? `error: importance must be an integer 1-5.` : res.error === "importance_locked" ? `error: memory ${parsed.data.memoryId} importance is user-locked and cannot be re-scored.` : `error: memory ${parsed.data.memoryId} not found in this entity.`;
|
|
44839
|
+
} else {
|
|
44840
|
+
rescored += 1;
|
|
44841
|
+
outcome = `set importance of memory ${parsed.data.memoryId} to ${parsed.data.importance} (${parsed.data.reason})`;
|
|
44842
|
+
}
|
|
44843
|
+
}
|
|
44736
44844
|
} else {
|
|
44737
44845
|
outcome = `error: unknown tool ${tc.toolName}`;
|
|
44738
44846
|
}
|
|
@@ -44745,8 +44853,8 @@ async function runMemoryCuration(db, entityId, maxTurns, reflectionModel) {
|
|
|
44745
44853
|
}
|
|
44746
44854
|
messages.push({ role: "tool", content: resultParts });
|
|
44747
44855
|
}
|
|
44748
|
-
console.warn(`${TRACE} done`, { entityId, edited, archived, turns });
|
|
44749
|
-
return { edited, archived, turns };
|
|
44856
|
+
console.warn(`${TRACE} done`, { entityId, edited, archived, rescored, turns });
|
|
44857
|
+
return { edited, archived, rescored, turns };
|
|
44750
44858
|
}
|
|
44751
44859
|
|
|
44752
44860
|
// src/cron/run-curator.ts
|
|
@@ -44761,6 +44869,11 @@ var SAFE_LIFECYCLE_DEFAULTS = {
|
|
|
44761
44869
|
CURATOR_MEMORY_IMPORTANCE_MAX: 2,
|
|
44762
44870
|
CURATOR_MEMORY_MIN: 8,
|
|
44763
44871
|
REFLECTION_ENABLED: "false",
|
|
44872
|
+
// Conservative fallback for environments without DATABASE_URL (test envs) —
|
|
44873
|
+
// mirrors REFLECTION_ENABLED's safe default. The REAL production default
|
|
44874
|
+
// (per-entity decides, ON since entities.memory_curation_enabled defaults
|
|
44875
|
+
// true) comes from the zod schema in env.ts, not from this fallback.
|
|
44876
|
+
MEMORY_CURATION_ENABLED: "false",
|
|
44764
44877
|
REFLECTION_MODEL: void 0
|
|
44765
44878
|
};
|
|
44766
44879
|
function resolveCuratorEnv(runnerEnv) {
|
|
@@ -44777,6 +44890,7 @@ function resolveCuratorEnv(runnerEnv) {
|
|
|
44777
44890
|
CURATOR_MEMORY_IMPORTANCE_MAX: env.CURATOR_MEMORY_IMPORTANCE_MAX,
|
|
44778
44891
|
CURATOR_MEMORY_MIN: env.CURATOR_MEMORY_MIN,
|
|
44779
44892
|
REFLECTION_ENABLED: env.REFLECTION_ENABLED,
|
|
44893
|
+
MEMORY_CURATION_ENABLED: env.MEMORY_CURATION_ENABLED,
|
|
44780
44894
|
REFLECTION_MODEL: env.REFLECTION_MODEL
|
|
44781
44895
|
};
|
|
44782
44896
|
} catch {
|
|
@@ -44793,7 +44907,26 @@ async function runCuratorTick(db, _deps, runnerEnv) {
|
|
|
44793
44907
|
staleDays: e.CURATOR_MEMORY_STALE_DAYS,
|
|
44794
44908
|
importanceMax: e.CURATOR_MEMORY_IMPORTANCE_MAX
|
|
44795
44909
|
});
|
|
44796
|
-
|
|
44910
|
+
const intervalMs = e.CURATOR_INTERVAL_DAYS * 24 * 60 * 60 * 1e3;
|
|
44911
|
+
const intervalCutoff = new Date(Date.now() - intervalMs);
|
|
44912
|
+
const now = /* @__PURE__ */ new Date();
|
|
44913
|
+
const skillSet = /* @__PURE__ */ new Set();
|
|
44914
|
+
if (e.REFLECTION_ENABLED !== "false") {
|
|
44915
|
+
const skillCandidates = await db.select({ entityId: agentSkills.entityId }).from(agentSkills).innerJoin(entities, eq5(entities.id, agentSkills.entityId)).where(
|
|
44916
|
+
and3(
|
|
44917
|
+
eq5(agentSkills.createdBy, "agent"),
|
|
44918
|
+
eq5(agentSkills.state, "active"),
|
|
44919
|
+
eq5(entities.reflectionEnabled, true)
|
|
44920
|
+
)
|
|
44921
|
+
).groupBy(agentSkills.entityId).having(sql18`count(${agentSkills.id}) >= ${e.CURATOR_MIN_SKILLS}`);
|
|
44922
|
+
for (const c of skillCandidates) if (c.entityId) skillSet.add(c.entityId);
|
|
44923
|
+
}
|
|
44924
|
+
const memorySet = /* @__PURE__ */ new Set();
|
|
44925
|
+
if (e.MEMORY_CURATION_ENABLED !== "false") {
|
|
44926
|
+
const memoryCandidates = await db.select({ entityId: agentMemory.entityId }).from(agentMemory).innerJoin(entities, eq5(entities.id, agentMemory.entityId)).where(and3(eq5(agentMemory.archived, false), eq5(entities.memoryCurationEnabled, true))).groupBy(agentMemory.entityId).having(sql18`count(${agentMemory.id}) >= ${e.CURATOR_MEMORY_MIN}`);
|
|
44927
|
+
for (const c of memoryCandidates) if (c.entityId) memorySet.add(c.entityId);
|
|
44928
|
+
}
|
|
44929
|
+
if (skillSet.size === 0 && memorySet.size === 0) {
|
|
44797
44930
|
return {
|
|
44798
44931
|
staled: lifecycle.staled,
|
|
44799
44932
|
archived: lifecycle.archived,
|
|
@@ -44804,21 +44937,6 @@ async function runCuratorTick(db, _deps, runnerEnv) {
|
|
|
44804
44937
|
memoryCurationRan: 0
|
|
44805
44938
|
};
|
|
44806
44939
|
}
|
|
44807
|
-
const intervalMs = e.CURATOR_INTERVAL_DAYS * 24 * 60 * 60 * 1e3;
|
|
44808
|
-
const intervalCutoff = new Date(Date.now() - intervalMs);
|
|
44809
|
-
const now = /* @__PURE__ */ new Date();
|
|
44810
|
-
const skillCandidates = await db.select({ entityId: agentSkills.entityId }).from(agentSkills).innerJoin(entities, eq5(entities.id, agentSkills.entityId)).where(
|
|
44811
|
-
and3(
|
|
44812
|
-
eq5(agentSkills.createdBy, "agent"),
|
|
44813
|
-
eq5(agentSkills.state, "active"),
|
|
44814
|
-
eq5(entities.reflectionEnabled, true)
|
|
44815
|
-
)
|
|
44816
|
-
).groupBy(agentSkills.entityId).having(sql18`count(${agentSkills.id}) >= ${e.CURATOR_MIN_SKILLS}`);
|
|
44817
|
-
const memoryCandidates = await db.select({ entityId: agentMemory.entityId }).from(agentMemory).innerJoin(entities, eq5(entities.id, agentMemory.entityId)).where(and3(eq5(agentMemory.archived, false), eq5(entities.reflectionEnabled, true))).groupBy(agentMemory.entityId).having(sql18`count(${agentMemory.id}) >= ${e.CURATOR_MEMORY_MIN}`);
|
|
44818
|
-
const skillSet = /* @__PURE__ */ new Set();
|
|
44819
|
-
for (const c of skillCandidates) if (c.entityId) skillSet.add(c.entityId);
|
|
44820
|
-
const memorySet = /* @__PURE__ */ new Set();
|
|
44821
|
-
for (const c of memoryCandidates) if (c.entityId) memorySet.add(c.entityId);
|
|
44822
44940
|
let consolidationDeferred = 0;
|
|
44823
44941
|
let consolidationRan = 0;
|
|
44824
44942
|
let memoryCurationRan = 0;
|
package/web/.next/BUILD_ID
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
KFac7DQ7gdp9XPQ2bnb-2
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"/(dashboard)/agents/[id]/edit/page": "/agents/[id]/edit",
|
|
13
13
|
"/(dashboard)/agents/[id]/telegram/page": "/agents/[id]/telegram",
|
|
14
14
|
"/(dashboard)/agents/page": "/agents",
|
|
15
|
-
"/(dashboard)/approvals/page": "/approvals",
|
|
16
15
|
"/(dashboard)/automations/page": "/automations",
|
|
16
|
+
"/(dashboard)/approvals/page": "/approvals",
|
|
17
17
|
"/(dashboard)/chat/page": "/chat",
|
|
18
18
|
"/(dashboard)/connectors/page": "/connectors",
|
|
19
19
|
"/(dashboard)/credentials/page": "/credentials",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"/(dashboard)/mcp/page": "/mcp",
|
|
26
26
|
"/(dashboard)/memories/page": "/memories",
|
|
27
27
|
"/(dashboard)/settings/page": "/settings",
|
|
28
|
-
"/(dashboard)/page": "/",
|
|
29
28
|
"/(dashboard)/settings/root-context/page": "/settings/root-context",
|
|
29
|
+
"/(dashboard)/page": "/",
|
|
30
30
|
"/(dashboard)/skills/[id]/edit/page": "/skills/[id]/edit",
|
|
31
31
|
"/(dashboard)/skills/page": "/skills"
|
|
32
32
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
],
|
|
5
5
|
"devFiles": [],
|
|
6
6
|
"lowPriorityFiles": [
|
|
7
|
-
"static/
|
|
8
|
-
"static/
|
|
7
|
+
"static/KFac7DQ7gdp9XPQ2bnb-2/_buildManifest.js",
|
|
8
|
+
"static/KFac7DQ7gdp9XPQ2bnb-2/_ssgManifest.js"
|
|
9
9
|
],
|
|
10
10
|
"rootMainFiles": [
|
|
11
11
|
"static/chunks/webpack-3741bf0a7636d65e.js",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"dynamicRoutes": {},
|
|
55
55
|
"notFoundRoutes": [],
|
|
56
56
|
"preview": {
|
|
57
|
-
"previewModeId": "
|
|
58
|
-
"previewModeSigningKey": "
|
|
59
|
-
"previewModeEncryptionKey": "
|
|
57
|
+
"previewModeId": "9ca9c6c94be2ac6b133cc8186cc3e575",
|
|
58
|
+
"previewModeSigningKey": "e0be6b0a50047a39c91cb1f3c0c956afeeca98f59c75c182395022d820c862a6",
|
|
59
|
+
"previewModeEncryptionKey": "8eb9a91dc33886853caf249132d193b1db18b4ad8b66413c2343f5f4a4c31d37"
|
|
60
60
|
}
|
|
61
61
|
}
|