Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,53 @@ interface EvaMemoryConfig {
retrievalMode: string;
recencyFilterMinutes: number;
injectCornerstones: boolean;
enableInjectionScreening: boolean;
injectionHardFloor: number;
injectionCriticalThreshold: number;
injectionTechnicalThreshold: number;
injectionPersonalThreshold: number;
}
interface RetrievedItem {
source: string;
item_id: string;
content: string;
score: number;
source_session_id?: string;
created_at?: string;
item_type?: string;
metadata?: {
memory_class?: string;
salience?: string;
status?: string;
category?: string;
explicitness?: string;
stability?: string;
is_deleted?: number;
};
provenance?: string;
}
declare function parseConfig(raw: unknown): EvaMemoryConfig;
/** Session risk mode for dynamic threshold selection. */
type InjectionMode = "critical" | "technical" | "personal";
/**
* Classify the current turn into an injection mode.
* critical > technical > personal (first match wins).
*/
export declare function detectInjectionMode(promptText: string): InjectionMode;
/**
* Two-layer injection screening (R-417 + R-418).
*
* Layer 1 — hard rules (deterministic drops)
* 1.1 Stale run-state: memory claims a bench run is active but current prompt says it’s dead
* 1.2 Category lane: suppress personal/episodic < 0.70 in technical mode
* 1.3 Hard floor: drop anything below injectionHardFloor regardless
*
* Layer 2 — dynamic confidence threshold per session mode
* critical ≥ 0.75, technical ≥ 0.60, personal ≥ 0.45
*
* Bonus — contradiction suppression: memory says active, prompt says dead
*/
export declare function screenInjectionCandidates(items: RetrievedItem[], promptText: string, cfg: Pick<EvaMemoryConfig, "injectionHardFloor" | "injectionCriticalThreshold" | "injectionTechnicalThreshold" | "injectionPersonalThreshold">, log?: (msg: string) => void): RetrievedItem[];
declare const cortexPlugin: {
id: string;
name: string;
Expand Down Expand Up @@ -92,6 +137,26 @@ declare const cortexPlugin: {
type: string;
description: string;
};
enableInjectionScreening: {
type: string;
description: string;
};
injectionHardFloor: {
type: string;
description: string;
};
injectionCriticalThreshold: {
type: string;
description: string;
};
injectionTechnicalThreshold: {
type: string;
description: string;
};
injectionPersonalThreshold: {
type: string;
description: string;
};
};
required: never[];
};
Expand Down
2 changes: 1 addition & 1 deletion dist/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

179 changes: 169 additions & 10 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions scripts/check-deploy-parity.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
# Check plugin repo vs local deployed
set -euo pipefail

REPO_DIST="dist/index.js"
LOCAL_DIST="$HOME/.openclaw/extensions/cortex/dist/index.js"

if ! diff -q "$REPO_DIST" "$LOCAL_DIST" >/dev/null 2>&1; then
echo "DRIFT: repo dist differs from local deployed"
echo "Run: cd ~/repos/evaos-cortex-plugin && npm run build && cp -r dist/* ~/.openclaw/extensions/cortex/dist/"
Comment on lines +5 to +10
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Make the parity check location-independent.

REPO_DIST="dist/index.js" and the hardcoded cd ~/repos/evaos-cortex-plugin assume the script is always run from one specific checkout. Invoking it from any other working directory will report false drift.

Suggested fix
-REPO_DIST="dist/index.js"
-LOCAL_DIST="$HOME/.openclaw/extensions/cortex/dist/index.js"
+SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
+REPO_ROOT="$(cd -- "${SCRIPT_DIR}/.." && pwd)"
+REPO_DIST="${REPO_ROOT}/dist/index.js"
+LOCAL_DIST="${HOME}/.openclaw/extensions/cortex/dist/index.js"
+
+[[ -f "$REPO_DIST" ]] || { echo "Missing repo artifact: $REPO_DIST"; exit 1; }
+[[ -f "$LOCAL_DIST" ]] || { echo "Missing deployed artifact: $LOCAL_DIST"; exit 1; }
 
 if ! diff -q "$REPO_DIST" "$LOCAL_DIST" >/dev/null 2>&1; then
   echo "DRIFT: repo dist differs from local deployed"
-  echo "Run: cd ~/repos/evaos-cortex-plugin && npm run build && cp -r dist/* ~/.openclaw/extensions/cortex/dist/"
+  echo "Run: cd \"${REPO_ROOT}\" && npm run build && cp -r dist/* \"${HOME}/.openclaw/extensions/cortex/dist/\""
   exit 1
 fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
REPO_DIST="dist/index.js"
LOCAL_DIST="$HOME/.openclaw/extensions/cortex/dist/index.js"
if ! diff -q "$REPO_DIST" "$LOCAL_DIST" >/dev/null 2>&1; then
echo "DRIFT: repo dist differs from local deployed"
echo "Run: cd ~/repos/evaos-cortex-plugin && npm run build && cp -r dist/* ~/.openclaw/extensions/cortex/dist/"
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd -- "${SCRIPT_DIR}/.." && pwd)"
REPO_DIST="${REPO_ROOT}/dist/index.js"
LOCAL_DIST="${HOME}/.openclaw/extensions/cortex/dist/index.js"
[[ -f "$REPO_DIST" ]] || { echo "Missing repo artifact: $REPO_DIST"; exit 1; }
[[ -f "$LOCAL_DIST" ]] || { echo "Missing deployed artifact: $LOCAL_DIST"; exit 1; }
if ! diff -q "$REPO_DIST" "$LOCAL_DIST" >/dev/null 2>&1; then
echo "DRIFT: repo dist differs from local deployed"
echo "Run: cd \"${REPO_ROOT}\" && npm run build && cp -r dist/* \"${HOME}/.openclaw/extensions/cortex/dist/\""
exit 1
fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/check-deploy-parity.sh` around lines 5 - 10, The script uses fixed
paths (REPO_DIST="dist/index.js" and a hardcoded cd) which break when run
outside that checkout; make the script location-independent by resolving the
repository root relative to the script (e.g., use git rev-parse --show-toplevel
or $(dirname "$0") to compute REPO_DIR) and then set
REPO_DIST="$REPO_DIR/dist/index.js" and update the suggested fix command to
reference that same REPO_DIR instead of cd ~/repos/.... Also ensure LOCAL_DIST
remains quoted and allow overriding via env vars if desired so diff compares the
correct absolute paths when invoked from any CWD.

exit 1
fi

echo "PLUGIN PARITY OK"
Loading