principles-disciple 1.204.1 → 1.206.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.
@@ -0,0 +1,41 @@
1
+ export type PrincipleApplicationLevel = 'effect' | 'presence';
2
+ export type PrincipleApplicationKind = 'rule_blocked' | 'auto_correct_applied' | 'self_reported' | 'prompt_injected';
3
+ export interface PrincipleApplicationInput {
4
+ principleId: string;
5
+ activationId?: string;
6
+ ruleId?: string;
7
+ channel: 'code_tool_hook' | 'prompt';
8
+ level: PrincipleApplicationLevel;
9
+ kind: PrincipleApplicationKind;
10
+ sessionId?: string;
11
+ toolName?: string;
12
+ filePath?: string;
13
+ digest?: string;
14
+ }
15
+ /**
16
+ * Record one application event. Returns true when a row was written (or
17
+ * deduped), false on failure — callers must surface the reason (rc-9).
18
+ */
19
+ export declare function recordPrincipleApplication(workspaceDir: string, input: PrincipleApplicationInput): boolean;
20
+ /**
21
+ * Align activation ids with the actually-injected principle subset (PRI-531
22
+ * review fix). Budget truncation can drop principles from the tail of the
23
+ * full list — pairing by raw index would attach the wrong activation_id to a
24
+ * presence row (rc-6-adjacent data pairing).
25
+ */
26
+ export declare function alignActivationIds(principles: ReadonlyArray<{
27
+ principleId: string;
28
+ activationId?: string;
29
+ }>, injectedIds: ReadonlySet<string>): string[];
30
+ /**
31
+ * Presence rows for a prompt injection event — one per principle, deduped per
32
+ * session×principle by the partial unique index (restarts included).
33
+ * Returns the number of NEW rows written (0 when all were already present).
34
+ * Failures are warned via the optional logger (rc-9) — never thrown.
35
+ */
36
+ export declare function recordInjectionPresence(workspaceDir: string, principleIds: readonly string[], sessionId: string | undefined, activationIds?: readonly string[], logger?: {
37
+ warn?: (message: string) => void;
38
+ info?: (message: string) => void;
39
+ }): number;
40
+ /** Test hook: close cached connections and reset the retention sweep clock. */
41
+ export declare function clearPrincipleApplicationLedgerCache(): void;
@@ -0,0 +1,15 @@
1
+ export interface PrincipleReceiptMetadata {
2
+ /** Resolved display title (fallback chain result; never empty). */
3
+ title: string;
4
+ /** Owner approval date (ISO string) — approvals.decided_at, fallback activations.activated_at. */
5
+ approvedAt?: string;
6
+ /** Source correction summary — only present when the artifact carries painReasonSummary. */
7
+ sourceSummary?: string;
8
+ }
9
+ /**
10
+ * Resolve receipt metadata for a blocked rule. Returns undefined when nothing
11
+ * useful can be resolved (caller degrades to the generic copy).
12
+ */
13
+ export declare function loadPrincipleReceiptMetadata(workspaceDir: string, ruleId: string | undefined, principleId: string | undefined): PrincipleReceiptMetadata | undefined;
14
+ /** Test hook: clear caches between tests. */
15
+ export declare function clearPrincipleReceiptMetadataCache(): void;
@@ -21,6 +21,10 @@ export interface BlockContext {
21
21
  sessionId?: string;
22
22
  /** Source module that triggered the block (for audit trail) */
23
23
  blockSource?: string;
24
+ /** RuleHost rule id — enables PRI-530 receipt copy attribution */
25
+ ruleId?: string;
26
+ /** Principle id from the rule result — enables PRI-530 receipt copy attribution */
27
+ principleId?: string;
24
28
  }
25
29
  /**
26
30
  * Single authoritative block helper.
@@ -2,7 +2,7 @@
2
2
  "id": "principles-disciple",
3
3
  "name": "Principles Disciple",
4
4
  "description": "Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles. Stop correcting the same AI behavior across sessions.",
5
- "version": "1.204.1",
5
+ "version": "1.206.0",
6
6
  "activation": {
7
7
  "onCapabilities": [
8
8
  "hook"
@@ -2,7 +2,7 @@
2
2
  "id": "principles-disciple",
3
3
  "name": "Principles Disciple",
4
4
  "description": "Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles. Stop correcting the same AI behavior across sessions.",
5
- "version": "1.204.1",
5
+ "version": "1.206.0",
6
6
  "activation": {
7
7
  "onCapabilities": [
8
8
  "hook"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "principles-disciple",
3
- "version": "1.204.1",
3
+ "version": "1.206.0",
4
4
  "description": "Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles. Stop correcting the same AI behavior across sessions.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",