@cortexkit/pi-magic-context 0.21.2 → 0.21.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +54 -7
- package/dist/subagent-entry.js +0 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -146297,6 +146297,43 @@ function normalizeProjectRelativePath(projectPath, filePath) {
|
|
|
146297
146297
|
return null;
|
|
146298
146298
|
return rel;
|
|
146299
146299
|
}
|
|
146300
|
+
function isDocumentationOrMetaFile(rel) {
|
|
146301
|
+
const lower = rel.toLowerCase();
|
|
146302
|
+
if (lower.endsWith(".md") || lower.endsWith(".mdx") || lower.endsWith(".rst"))
|
|
146303
|
+
return true;
|
|
146304
|
+
if (lower.endsWith(".txt"))
|
|
146305
|
+
return true;
|
|
146306
|
+
const base = lower.split("/").pop() ?? "";
|
|
146307
|
+
const baseNoExt = base.replace(/\.[^.]+$/, "");
|
|
146308
|
+
const META_BASENAMES = new Set([
|
|
146309
|
+
"license",
|
|
146310
|
+
"licence",
|
|
146311
|
+
"notice",
|
|
146312
|
+
"copying",
|
|
146313
|
+
"authors",
|
|
146314
|
+
"contributors",
|
|
146315
|
+
"changelog",
|
|
146316
|
+
"changes",
|
|
146317
|
+
"history",
|
|
146318
|
+
"readme",
|
|
146319
|
+
"contributing",
|
|
146320
|
+
"code_of_conduct",
|
|
146321
|
+
"security",
|
|
146322
|
+
"support",
|
|
146323
|
+
"maintainers",
|
|
146324
|
+
"governance",
|
|
146325
|
+
"package-lock",
|
|
146326
|
+
"bun.lock",
|
|
146327
|
+
"bun.lockb",
|
|
146328
|
+
"yarn.lock",
|
|
146329
|
+
"pnpm-lock",
|
|
146330
|
+
"cargo.lock",
|
|
146331
|
+
"uv.lock",
|
|
146332
|
+
"poetry.lock",
|
|
146333
|
+
"gemfile.lock"
|
|
146334
|
+
]);
|
|
146335
|
+
return META_BASENAMES.has(base) || META_BASENAMES.has(baseNoExt);
|
|
146336
|
+
}
|
|
146300
146337
|
function primarySessionIds(db) {
|
|
146301
146338
|
try {
|
|
146302
146339
|
const rows = db.prepare("SELECT session_id AS sessionId FROM session_meta WHERE is_subagent = 0").all();
|
|
@@ -146328,6 +146365,8 @@ function collectKeyFileCandidates(args) {
|
|
|
146328
146365
|
const rel = normalizeProjectRelativePath(args.projectPath, row.file_path);
|
|
146329
146366
|
if (!rel)
|
|
146330
146367
|
continue;
|
|
146368
|
+
if (isDocumentationOrMetaFile(rel))
|
|
146369
|
+
continue;
|
|
146331
146370
|
const timestamp = toMs(row.time_created);
|
|
146332
146371
|
const candidate = byPath.get(rel) ?? {
|
|
146333
146372
|
path: rel,
|
|
@@ -146464,7 +146503,8 @@ Rules:
|
|
|
146464
146503
|
- Total approx_token_estimate must be < ${args.config.token_budget}.
|
|
146465
146504
|
- path must be relative, no .., no absolute paths, no symlinks escaping project root.
|
|
146466
146505
|
- path must be unique case-sensitively and case-insensitively.
|
|
146467
|
-
- content must be plain text; no XML tags inside
|
|
146506
|
+
- content must be plain text; no XML tags inside.
|
|
146507
|
+
- DO NOT pick prose documentation (README.md, CONTRIBUTING.md, CHANGELOG, LICENSE, *.md/*.mdx/*.rst/*.txt) or lockfiles. Key files are project SOURCE the agent needs repeated orientation context on, not reference docs. Project docs are surfaced through a separate injection path.`;
|
|
146468
146508
|
}
|
|
146469
146509
|
function validateLlmOutput(raw, config, projectPath) {
|
|
146470
146510
|
let obj;
|
|
@@ -148269,6 +148309,13 @@ async function evaluateSmartNotes(args) {
|
|
|
148269
148309
|
For each note below, determine whether its surface condition has been met.
|
|
148270
148310
|
You have access to tools like GitHub CLI (gh), web search, and the local codebase to verify conditions.
|
|
148271
148311
|
|
|
148312
|
+
You DO NOT have access to:
|
|
148313
|
+
- Any conversation between the user and the original agent that wrote the note
|
|
148314
|
+
- The state of any active session, including whether messages have been sent
|
|
148315
|
+
- The current task, mood, or intent of the human user
|
|
148316
|
+
|
|
148317
|
+
If a condition references conversation context the user is having ("When the user mentions X", "When they ask to do Y", "When we revisit Z", "When relevant to current discussion", etc.), it is UNEVALUATABLE — skip it (do not include in results) so the note stays pending. These are misuse cases that should never have been written as smart notes; leaving them pending is the correct outcome, the dreamer's archive-stale task will eventually retire them.
|
|
148318
|
+
|
|
148272
148319
|
## Pending Smart Notes
|
|
148273
148320
|
|
|
148274
148321
|
${noteDescriptions}
|
|
@@ -148277,7 +148324,8 @@ ${noteDescriptions}
|
|
|
148277
148324
|
|
|
148278
148325
|
1. Check each condition using the tools available to you.
|
|
148279
148326
|
2. Be conservative — only mark a condition as met when you have clear evidence.
|
|
148280
|
-
3.
|
|
148327
|
+
3. Skip conditions that depend on session/conversation context you cannot observe — do not invent a "false" verdict for them, just omit them from your response.
|
|
148328
|
+
4. Respond with a JSON array of results:
|
|
148281
148329
|
|
|
148282
148330
|
\`\`\`json
|
|
148283
148331
|
[
|
|
@@ -148285,7 +148333,7 @@ ${noteDescriptions}
|
|
|
148285
148333
|
]
|
|
148286
148334
|
\`\`\`
|
|
148287
148335
|
|
|
148288
|
-
Only include notes whose conditions you could definitively evaluate. Skip notes where you cannot determine the status (they will be re-evaluated next run).`;
|
|
148336
|
+
Only include notes whose conditions you could definitively evaluate against external signals. Skip notes where you cannot determine the status (they will be re-evaluated next run, or eventually archived as stale).`;
|
|
148289
148337
|
const taskStartedAt = Date.now();
|
|
148290
148338
|
let agentSessionId = null;
|
|
148291
148339
|
const abortController = new AbortController;
|
|
@@ -163039,7 +163087,6 @@ var MagicContextConfigSchema = exports_external.object({
|
|
|
163039
163087
|
enabled: exports_external.boolean().default(true),
|
|
163040
163088
|
min_clusters: exports_external.number().min(1).default(3)
|
|
163041
163089
|
}).default({ enabled: true, min_clusters: 3 }),
|
|
163042
|
-
compaction_markers: exports_external.boolean().default(true),
|
|
163043
163090
|
system_prompt_injection: exports_external.object({
|
|
163044
163091
|
enabled: exports_external.boolean().default(true),
|
|
163045
163092
|
skip_signatures: exports_external.array(exports_external.string()).default(["<!-- magic-context: skip -->"])
|
|
@@ -173501,7 +173548,7 @@ async function executePartialRecompInternal(deps, range) {
|
|
|
173501
173548
|
}
|
|
173502
173549
|
deps.onCompartmentStatePublished?.(sessionId);
|
|
173503
173550
|
const lastEnd = merged[merged.length - 1]?.endMessage ?? snapEnd;
|
|
173504
|
-
if (
|
|
173551
|
+
if (lastEnd > 0) {
|
|
173505
173552
|
updateCompactionMarkerAfterPublication(db, sessionId, lastEnd, deps.directory);
|
|
173506
173553
|
const stalePending = getPendingCompactionMarkerState(db, sessionId);
|
|
173507
173554
|
if (stalePending) {
|
|
@@ -173760,7 +173807,7 @@ Found ${existingStaging.compartments.length} staged compartment(s) from ${existi
|
|
|
173760
173807
|
if (lastCompartmentEnd2 > 0) {
|
|
173761
173808
|
queueDropsForCompartmentalizedMessages(db, sessionId, lastCompartmentEnd2);
|
|
173762
173809
|
}
|
|
173763
|
-
if (
|
|
173810
|
+
if (lastCompartmentEnd2 > 0) {
|
|
173764
173811
|
updateCompactionMarkerAfterPublication(db, sessionId, lastCompartmentEnd2, deps.directory);
|
|
173765
173812
|
const stalePending = getPendingCompactionMarkerState(db, sessionId);
|
|
173766
173813
|
if (stalePending) {
|
|
@@ -174477,7 +174524,7 @@ import {
|
|
|
174477
174524
|
// package.json
|
|
174478
174525
|
var package_default = {
|
|
174479
174526
|
name: "@cortexkit/pi-magic-context",
|
|
174480
|
-
version: "0.21.
|
|
174527
|
+
version: "0.21.4",
|
|
174481
174528
|
type: "module",
|
|
174482
174529
|
description: "Pi coding agent extension for Magic Context — cross-session memory and context management",
|
|
174483
174530
|
main: "dist/index.js",
|
package/dist/subagent-entry.js
CHANGED
|
@@ -156796,7 +156796,6 @@ var MagicContextConfigSchema = exports_external.object({
|
|
|
156796
156796
|
enabled: exports_external.boolean().default(true),
|
|
156797
156797
|
min_clusters: exports_external.number().min(1).default(3)
|
|
156798
156798
|
}).default({ enabled: true, min_clusters: 3 }),
|
|
156799
|
-
compaction_markers: exports_external.boolean().default(true),
|
|
156800
156799
|
system_prompt_injection: exports_external.object({
|
|
156801
156800
|
enabled: exports_external.boolean().default(true),
|
|
156802
156801
|
skip_signatures: exports_external.array(exports_external.string()).default(["<!-- magic-context: skip -->"])
|
package/package.json
CHANGED