@cleocode/core 2026.4.15 → 2026.4.16
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/crypto/credentials.d.ts.map +1 -1
- package/dist/index.js +61 -31
- package/dist/index.js.map +2 -2
- package/dist/memory/brain-retrieval.d.ts +4 -0
- package/dist/memory/brain-retrieval.d.ts.map +1 -1
- package/dist/memory/engine-compat.d.ts +4 -0
- package/dist/memory/engine-compat.d.ts.map +1 -1
- package/dist/memory/mental-model-injection.d.ts +52 -0
- package/dist/memory/mental-model-injection.d.ts.map +1 -0
- package/dist/memory/mental-model-queue.d.ts +75 -0
- package/dist/memory/mental-model-queue.d.ts.map +1 -0
- package/dist/orchestration/index.d.ts +2 -0
- package/dist/orchestration/index.d.ts.map +1 -1
- package/dist/paths.d.ts +65 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/store/brain-accessor.d.ts +2 -0
- package/dist/store/brain-accessor.d.ts.map +1 -1
- package/dist/store/brain-schema.d.ts +16 -0
- package/dist/store/brain-schema.d.ts.map +1 -1
- package/migrations/drizzle-brain/20260408000001_t417-agent-field/migration.sql +13 -0
- package/migrations/drizzle-brain/20260408000001_t417-agent-field/snapshot.json +28 -0
- package/package.json +13 -13
- package/src/__tests__/ct-master-tac-install.test.ts +168 -0
- package/src/crypto/credentials.ts +28 -0
- package/src/memory/__tests__/mental-model-wave-8.test.ts +355 -0
- package/src/memory/brain-retrieval.ts +55 -29
- package/src/memory/engine-compat.ts +24 -2
- package/src/memory/mental-model-injection.ts +87 -0
- package/src/memory/mental-model-queue.ts +291 -0
- package/src/orchestration/index.ts +2 -0
- package/src/paths.ts +79 -0
- package/src/store/brain-accessor.ts +5 -0
- package/src/store/brain-schema.ts +4 -0
- package/src/validation/protocols/cant/architecture-decision.cant +12 -2
- package/src/validation/protocols/cant/artifact-publish.cant +11 -1
- package/src/validation/protocols/cant/consensus.cant +12 -1
- package/src/validation/protocols/cant/contribution.cant +11 -1
- package/src/validation/protocols/cant/decomposition.cant +11 -1
- package/src/validation/protocols/cant/implementation.cant +11 -1
- package/src/validation/protocols/cant/provenance.cant +13 -1
- package/src/validation/protocols/cant/release.cant +12 -1
- package/src/validation/protocols/cant/research.cant +12 -1
- package/src/validation/protocols/cant/specification.cant +11 -1
- package/src/validation/protocols/cant/testing.cant +12 -1
- package/src/validation/protocols/cant/validation.cant +11 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/crypto/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/crypto/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA2JH;;;;;;;;;;;;GAYG;AACH,wBAAsB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAYrF;AAED;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkCtF"}
|
package/dist/index.js
CHANGED
|
@@ -9180,6 +9180,9 @@ var init_brain_schema = __esm({
|
|
|
9180
9180
|
sourceSessionId: text("source_session_id"),
|
|
9181
9181
|
// soft FK to sessions
|
|
9182
9182
|
sourceType: text("source_type", { enum: BRAIN_OBSERVATION_SOURCE_TYPES }).notNull().default("agent"),
|
|
9183
|
+
/** T383/T417: agent provenance — identifies the spawned agent that produced this observation. Null for legacy entries. */
|
|
9184
|
+
agent: text("agent"),
|
|
9185
|
+
// nullable — null for legacy observations
|
|
9183
9186
|
contentHash: text("content_hash"),
|
|
9184
9187
|
// SHA-256 prefix for dedup
|
|
9185
9188
|
discoveryTokens: integer("discovery_tokens"),
|
|
@@ -9196,7 +9199,9 @@ var init_brain_schema = __esm({
|
|
|
9196
9199
|
// T033: composite replaces single-col content_hash; see brain migration
|
|
9197
9200
|
index("idx_brain_observations_content_hash_created_at").on(table.contentHash, table.createdAt),
|
|
9198
9201
|
// T033: type + project compound filter optimization
|
|
9199
|
-
index("idx_brain_observations_type_project").on(table.type, table.project)
|
|
9202
|
+
index("idx_brain_observations_type_project").on(table.type, table.project),
|
|
9203
|
+
// T417: agent provenance index for memory.find --agent filter
|
|
9204
|
+
index("idx_brain_observations_agent").on(table.agent)
|
|
9200
9205
|
]
|
|
9201
9206
|
);
|
|
9202
9207
|
brainStickyNotes = sqliteTable(
|
|
@@ -10770,6 +10775,7 @@ var init_platform_paths = __esm({
|
|
|
10770
10775
|
});
|
|
10771
10776
|
|
|
10772
10777
|
// packages/core/src/paths.ts
|
|
10778
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
10773
10779
|
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "node:fs";
|
|
10774
10780
|
import { homedir } from "node:os";
|
|
10775
10781
|
import { dirname as dirname2, join as join4, resolve as resolve2 } from "node:path";
|
|
@@ -10801,6 +10807,10 @@ function getCleoDirAbsolute(cwd) {
|
|
|
10801
10807
|
return resolve2(cwd ?? process.cwd(), cleoDir);
|
|
10802
10808
|
}
|
|
10803
10809
|
function getProjectRoot(cwd) {
|
|
10810
|
+
const scope = worktreeScope.getStore();
|
|
10811
|
+
if (scope !== void 0) {
|
|
10812
|
+
return scope.worktreeRoot;
|
|
10813
|
+
}
|
|
10804
10814
|
if (process.env["CLEO_ROOT"]) {
|
|
10805
10815
|
return process.env["CLEO_ROOT"];
|
|
10806
10816
|
}
|
|
@@ -10960,13 +10970,14 @@ function getClaudeAgentsDir() {
|
|
|
10960
10970
|
const claudeDir = process.env["CLAUDE_HOME"] ?? join4(homedir(), ".claude");
|
|
10961
10971
|
return join4(claudeDir, "agents");
|
|
10962
10972
|
}
|
|
10963
|
-
var DEFAULT_AGENT_OUTPUTS_DIR;
|
|
10973
|
+
var worktreeScope, DEFAULT_AGENT_OUTPUTS_DIR;
|
|
10964
10974
|
var init_paths = __esm({
|
|
10965
10975
|
"packages/core/src/paths.ts"() {
|
|
10966
10976
|
"use strict";
|
|
10967
10977
|
init_src();
|
|
10968
10978
|
init_errors3();
|
|
10969
10979
|
init_platform_paths();
|
|
10980
|
+
worktreeScope = new AsyncLocalStorage();
|
|
10970
10981
|
DEFAULT_AGENT_OUTPUTS_DIR = ".cleo/agent-outputs";
|
|
10971
10982
|
}
|
|
10972
10983
|
});
|
|
@@ -15597,6 +15608,9 @@ var init_brain_accessor = __esm({
|
|
|
15597
15608
|
if (params.sourceSessionId) {
|
|
15598
15609
|
conditions.push(eq7(brainObservations.sourceSessionId, params.sourceSessionId));
|
|
15599
15610
|
}
|
|
15611
|
+
if (params.agent) {
|
|
15612
|
+
conditions.push(eq7(brainObservations.agent, params.agent));
|
|
15613
|
+
}
|
|
15600
15614
|
let query = this.db.select().from(brainObservations).orderBy(desc2(brainObservations.createdAt));
|
|
15601
15615
|
if (conditions.length > 0) {
|
|
15602
15616
|
query = query.where(and5(...conditions));
|
|
@@ -21800,44 +21814,51 @@ __export(brain_retrieval_exports, {
|
|
|
21800
21814
|
});
|
|
21801
21815
|
import { createHash as createHash2 } from "node:crypto";
|
|
21802
21816
|
async function searchBrainCompact(projectRoot, params) {
|
|
21803
|
-
const { query, limit, tables, dateStart, dateEnd } = params;
|
|
21817
|
+
const { query, limit, tables, dateStart, dateEnd, agent } = params;
|
|
21804
21818
|
if (!query || !query.trim()) {
|
|
21805
21819
|
return { results: [], total: 0, tokensEstimated: 0 };
|
|
21806
21820
|
}
|
|
21821
|
+
const effectiveTables = agent !== void 0 && agent !== null ? ["observations"] : tables;
|
|
21807
21822
|
const searchResult = await searchBrain(projectRoot, query, {
|
|
21808
21823
|
limit: limit ?? 10,
|
|
21809
|
-
tables
|
|
21824
|
+
tables: effectiveTables
|
|
21810
21825
|
});
|
|
21811
21826
|
let results = [];
|
|
21812
|
-
|
|
21813
|
-
const
|
|
21814
|
-
|
|
21815
|
-
|
|
21816
|
-
|
|
21817
|
-
|
|
21818
|
-
|
|
21819
|
-
|
|
21820
|
-
|
|
21821
|
-
|
|
21822
|
-
const
|
|
21823
|
-
|
|
21824
|
-
|
|
21825
|
-
|
|
21826
|
-
|
|
21827
|
-
|
|
21828
|
-
|
|
21829
|
-
|
|
21830
|
-
|
|
21831
|
-
const
|
|
21832
|
-
|
|
21833
|
-
|
|
21834
|
-
|
|
21835
|
-
|
|
21836
|
-
|
|
21837
|
-
|
|
21827
|
+
if (!agent) {
|
|
21828
|
+
for (const d of searchResult.decisions) {
|
|
21829
|
+
const raw = d;
|
|
21830
|
+
results.push({
|
|
21831
|
+
id: d.id,
|
|
21832
|
+
type: "decision",
|
|
21833
|
+
title: d.decision.slice(0, 80),
|
|
21834
|
+
date: (d.createdAt ?? raw["created_at"]) || ""
|
|
21835
|
+
});
|
|
21836
|
+
}
|
|
21837
|
+
for (const p of searchResult.patterns) {
|
|
21838
|
+
const raw = p;
|
|
21839
|
+
results.push({
|
|
21840
|
+
id: p.id,
|
|
21841
|
+
type: "pattern",
|
|
21842
|
+
title: p.pattern.slice(0, 80),
|
|
21843
|
+
date: (p.extractedAt ?? raw["extracted_at"]) || ""
|
|
21844
|
+
});
|
|
21845
|
+
}
|
|
21846
|
+
for (const l of searchResult.learnings) {
|
|
21847
|
+
const raw = l;
|
|
21848
|
+
results.push({
|
|
21849
|
+
id: l.id,
|
|
21850
|
+
type: "learning",
|
|
21851
|
+
title: l.insight.slice(0, 80),
|
|
21852
|
+
date: (l.createdAt ?? raw["created_at"]) || ""
|
|
21853
|
+
});
|
|
21854
|
+
}
|
|
21838
21855
|
}
|
|
21839
21856
|
for (const o of searchResult.observations) {
|
|
21840
21857
|
const raw = o;
|
|
21858
|
+
if (agent) {
|
|
21859
|
+
const rowAgent = o.agent ?? raw["agent"] ?? null;
|
|
21860
|
+
if (rowAgent !== agent) continue;
|
|
21861
|
+
}
|
|
21841
21862
|
results.push({
|
|
21842
21863
|
id: o.id,
|
|
21843
21864
|
type: "observation",
|
|
@@ -22051,7 +22072,15 @@ function classifyObservationType(text3) {
|
|
|
22051
22072
|
return "discovery";
|
|
22052
22073
|
}
|
|
22053
22074
|
async function observeBrain(projectRoot, params) {
|
|
22054
|
-
const {
|
|
22075
|
+
const {
|
|
22076
|
+
text: text3,
|
|
22077
|
+
title: titleParam,
|
|
22078
|
+
type: typeParam,
|
|
22079
|
+
project,
|
|
22080
|
+
sourceSessionId,
|
|
22081
|
+
sourceType,
|
|
22082
|
+
agent
|
|
22083
|
+
} = params;
|
|
22055
22084
|
if (!text3 || !text3.trim()) {
|
|
22056
22085
|
throw new Error("Observation text is required");
|
|
22057
22086
|
}
|
|
@@ -22100,6 +22129,7 @@ async function observeBrain(projectRoot, params) {
|
|
|
22100
22129
|
project: project ?? null,
|
|
22101
22130
|
sourceSessionId: validSessionId,
|
|
22102
22131
|
sourceType: sourceType ?? "agent",
|
|
22132
|
+
agent: agent ?? null,
|
|
22103
22133
|
createdAt: now
|
|
22104
22134
|
});
|
|
22105
22135
|
if (isEmbeddingAvailable()) {
|