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
2 changes: 2 additions & 0 deletions dist/__tests__/turn-gating.test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=turn-gating.test.d.ts.map
1 change: 1 addition & 0 deletions dist/__tests__/turn-gating.test.d.ts.map

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

82 changes: 82 additions & 0 deletions dist/__tests__/turn-gating.test.js
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚩 Compiled dist/ artifacts included in PR diff

The PR includes changes to dist/__tests__/turn-gating.test.js, dist/__tests__/turn-gating.test.d.ts, dist/index.js, and dist/index.d.ts. Committing compiled output is a deliberate pattern in this repo (the dist/ directory was already tracked), but the compiled test files in dist/__tests__/ may be unintentional — test files are typically not distributed.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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

1 change: 1 addition & 0 deletions dist/__tests__/turn-gating.test.js.map

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

100 changes: 100 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ interface EvaMemoryConfig {
autoRecall: boolean;
autoCapture: boolean;
shadowMode: boolean;
gbrainShadowEnabled: boolean;
gbrainShadowCapture: boolean;
gbrainShadowRecall: boolean;
gbrainShadowLogEnabled: boolean;
gbrainShadowMaxPromptChars: number;
gbrainShadowLogMaxEntries: number;
gbrainShadowProviderBaseUrl: string;
gbrainShadowModel: string;
gbrainShadowApiKey: string;
retrievalBudget: number;
maxInjectionChars: number;
maxInjectedMemories: number;
Expand Down Expand Up @@ -72,7 +81,41 @@ interface ProcessedItem {
conflictWithId?: string;
relationHint?: string;
}
interface GBrainShadowEvent {
schemaVersion: "gbrain-shadow-v1";
ts: string;
phase: "recall" | "capture";
sessionId?: string;
mode: "observe";
provider: {
baseUrl: string;
model: string;
liveCall: boolean;
};
promptPreview?: string;
conversationPreview?: Array<{
role: string;
content: string;
}>;
status: "skipped" | "simulated" | "disabled";
reason?: string;
note: string;
source: "gbrain-shadow-scaffold";
divergenceFromAuthoritative?: string;
}
declare function parseConfig(raw: unknown): EvaMemoryConfig;
export declare function isMemoryRelevant(prompt: string): boolean;
type HookRunKind = "main" | "subagent" | "cron" | "isolated" | "hook" | "unknown";
type HookLaneContext = {
runKind?: HookRunKind;
isHeartbeat?: boolean;
sessionKey?: string;
trigger?: string;
};
export declare function classifyTurnForMemory(prompt: string | undefined, messages: unknown[] | undefined, ctx?: HookLaneContext): {
allow: boolean;
reason: string;
};
/** Session risk mode for dynamic threshold selection. */
type InjectionMode = "critical" | "technical" | "personal";
/** Parse raw plugin config into a validated EvaMemoryConfig object. */
Expand All @@ -98,6 +141,27 @@ export declare function detectInjectionMode(promptText: string): InjectionMode;
export declare function screenInjectionCandidates(items: RetrievedItem[], promptText: string, cfg: Pick<EvaMemoryConfig, "injectionHardFloor" | "injectionCriticalThreshold" | "injectionTechnicalThreshold" | "injectionPersonalThreshold">, log?: (msg: string) => void): RetrievedItem[];
export declare function preprocessClaims(items: RetrievedItem[], options: Pick<EvaMemoryConfig, "showConflicts" | "showRelations" | "dedup">): ProcessedItem[];
export declare function formatMemoryContext(items: RetrievedItem[], maxChars: number, totalCount?: number, maxCount?: number, minScore?: number, options?: Pick<EvaMemoryConfig, "injectionFormat" | "showConflicts" | "showRelations" | "dedup">): string;
export declare function getGBrainShadowLogPath(ownerId: string): string;
export declare function createGBrainShadowEvent(params: {
phase: "recall" | "capture";
sessionId?: string;
providerBaseUrl: string;
model: string;
prompt?: string;
conversation?: Array<{
role: string;
content: string;
}>;
maxPromptChars: number;
status: "skipped" | "simulated" | "disabled";
reason?: string;
note: string;
divergenceFromAuthoritative?: string;
}): GBrainShadowEvent;
export declare function extractMessages(rawMessages: unknown[]): Array<{
role: string;
content: string;
}>;
declare const cortexPlugin: {
id: string;
name: string;
Expand Down Expand Up @@ -128,6 +192,42 @@ declare const cortexPlugin: {
type: string;
description: string;
};
gbrainShadowEnabled: {
type: string;
description: string;
};
gbrainShadowCapture: {
type: string;
description: string;
};
gbrainShadowRecall: {
type: string;
description: string;
};
gbrainShadowLogEnabled: {
type: string;
description: string;
};
gbrainShadowMaxPromptChars: {
type: string;
description: string;
};
gbrainShadowLogMaxEntries: {
type: string;
description: string;
};
gbrainShadowProviderBaseUrl: {
type: string;
description: string;
};
gbrainShadowModel: {
type: string;
description: string;
};
gbrainShadowApiKey: {
type: string;
description: string;
};
retrievalBudget: {
type: string;
};
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.

Loading
Loading