create-principles-disciple 1.144.26 → 1.144.27
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/_release/product-identity.json +2 -2
- package/codex-adapter/dist/codex-evidence-recorder.js +8 -2
- package/codex-adapter/package.json +1 -1
- package/core/dist/runtime-v2/internalization/adversarial-feedback.d.ts +3 -1
- package/core/dist/runtime-v2/internalization/adversarial-feedback.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/adversarial-feedback.js +10 -1
- package/core/dist/runtime-v2/internalization/adversarial-feedback.js.map +1 -1
- package/core/package.json +1 -1
- package/package.json +1 -1
- package/plugin/dist/bundle.js +1 -1
- package/plugin/dist/openclaw.plugin.json +1 -1
- package/release-manager/package.json +1 -1
|
@@ -112,7 +112,11 @@ export function recordCodexPromptDeliveryEvidence(input) {
|
|
|
112
112
|
principleId: entry.principleId,
|
|
113
113
|
...(activationRef.artifactId ? { artifactId: activationRef.artifactId } : {}),
|
|
114
114
|
...(contentRef ? { payloadDigest: contentRef.payloadDigest } : {}),
|
|
115
|
-
|
|
115
|
+
// A stored contentRef is an OBJECT — its truthiness must not upgrade
|
|
116
|
+
// resolution: 'resolved' without a payloadDigest is rejected by the
|
|
117
|
+
// normalizer before the store's idempotent dedup branch can no-op the
|
|
118
|
+
// replay. Only a digest-carrying reference counts as resolved.
|
|
119
|
+
resolution: contentRef?.payloadDigest !== undefined ? 'resolved' : 'revision_reference_unresolved',
|
|
116
120
|
},
|
|
117
121
|
activationRef,
|
|
118
122
|
payload: { targetKind: 'agent_context', confirmation: 'submitted', outcome: 'attempted' },
|
|
@@ -162,7 +166,9 @@ export function recordCodexDenyEvidence(input) {
|
|
|
162
166
|
principleId: input.principleId,
|
|
163
167
|
...(activationRef.artifactId ? { artifactId: activationRef.artifactId } : {}),
|
|
164
168
|
...(content ? { payloadDigest: content.payloadDigest } : {}),
|
|
165
|
-
|
|
169
|
+
// Same constraint as the prompt-delivery path above: a stored object's
|
|
170
|
+
// truthiness must not mint a digest-less 'resolved' reference.
|
|
171
|
+
resolution: content?.payloadDigest !== undefined ? 'resolved' : 'revision_reference_unresolved',
|
|
166
172
|
};
|
|
167
173
|
const observations = [
|
|
168
174
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principles/codex-adapter",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Codex CLI host adapter for Principles Disciple — implements HostAdapter interface for OpenAI Codex CLI's stdin/stdout JSON hook model (ADR-0020).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
* Design:
|
|
9
9
|
* - Pure function, no I/O, no timestamps/random (deterministic).
|
|
10
10
|
* - Each failed case becomes one line: caseId | attackType | expected vs
|
|
11
|
-
* actual | rationale
|
|
11
|
+
* actual | rationale, plus an indented `caseInput:` continuation line
|
|
12
|
+
* when the producer supplied the failed case's input (absent on legacy
|
|
13
|
+
* artifacts).
|
|
12
14
|
* - Empty input still yields a usable, non-empty string (the gate may
|
|
13
15
|
* reject on a runtime error with no per-case detail).
|
|
14
16
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adversarial-feedback.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/adversarial-feedback.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"adversarial-feedback.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/adversarial-feedback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAInE;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,SAAS,qBAAqB,EAAE,GAAG,MAAM,CA4B/F"}
|
|
@@ -19,7 +19,16 @@ export function formatAdversarialFeedback(failedCases) {
|
|
|
19
19
|
const actual = fc.actualDecision !== undefined
|
|
20
20
|
? `got ${fc.actualDecision}`
|
|
21
21
|
: `error ${fc.errorType ?? 'unknown'}`;
|
|
22
|
-
|
|
22
|
+
const head = `- ${fc.caseId} [${fc.attackType}]: expected ${fc.expectedDecision}, ${actual} — ${rationale}`;
|
|
23
|
+
// Phase 1 final acceptance review (2026-10-11): this formatter is the
|
|
24
|
+
// ONLY feedback channel into loop-created repair rounds (the repairPayload
|
|
25
|
+
// channel does not apply to them), so a verdict-only line leaves the
|
|
26
|
+
// round-2 artificer without the input that failed. caseInput is already
|
|
27
|
+
// bounded by the producer's shared budget; absent on legacy artifacts.
|
|
28
|
+
if (typeof fc.caseInput === 'string' && fc.caseInput.trim() !== '') {
|
|
29
|
+
return `${head}\n caseInput: ${fc.caseInput}`;
|
|
30
|
+
}
|
|
31
|
+
return head;
|
|
23
32
|
});
|
|
24
33
|
return `${HEADER}\n${lines.join('\n')}`;
|
|
25
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adversarial-feedback.js","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/adversarial-feedback.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"adversarial-feedback.js","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/adversarial-feedback.ts"],"names":[],"mappings":"AAkBA,MAAM,MAAM,GAAG,gFAAgF,CAAC;AAEhG;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,WAA6C;IACrF,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,GAAG,MAAM,wJAAwJ,CAAC;IAC3K,CAAC;IAED,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;QACnC,MAAM,SAAS,GAAG,OAAO,EAAE,CAAC,SAAS,KAAK,QAAQ,IAAI,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE;YAC9E,CAAC,CAAC,EAAE,CAAC,SAAS;YACd,CAAC,CAAC,yBAAyB,CAAC;QAC9B,wEAAwE;QACxE,oEAAoE;QACpE,4DAA4D;QAC5D,MAAM,MAAM,GAAG,EAAE,CAAC,cAAc,KAAK,SAAS;YAC5C,CAAC,CAAC,OAAO,EAAE,CAAC,cAAc,EAAE;YAC5B,CAAC,CAAC,SAAS,EAAE,CAAC,SAAS,IAAI,SAAS,EAAE,CAAC;QACzC,MAAM,IAAI,GAAG,KAAK,EAAE,CAAC,MAAM,KAAK,EAAE,CAAC,UAAU,eAAe,EAAE,CAAC,gBAAgB,KAAK,MAAM,MAAM,SAAS,EAAE,CAAC;QAC5G,sEAAsE;QACtE,2EAA2E;QAC3E,qEAAqE;QACrE,wEAAwE;QACxE,uEAAuE;QACvE,IAAI,OAAO,EAAE,CAAC,SAAS,KAAK,QAAQ,IAAI,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACnE,OAAO,GAAG,IAAI,kBAAkB,EAAE,CAAC,SAAS,EAAE,CAAC;QACjD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,MAAM,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1C,CAAC"}
|
package/core/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principles/core",
|
|
3
|
-
"version": "1.291.
|
|
3
|
+
"version": "1.291.4",
|
|
4
4
|
"description": "Pure-logic core of Principles Disciple, an AI Agent Governance System - pain signal capture and principle proposal (no I/O)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
package/package.json
CHANGED
package/plugin/dist/bundle.js
CHANGED
|
@@ -2580,7 +2580,7 @@ Blockers:
|
|
|
2580
2580
|
SELECT decided_by FROM approvals
|
|
2581
2581
|
WHERE artifact_id = ? AND channel = ? AND status = 'approved'
|
|
2582
2582
|
ORDER BY decided_at DESC LIMIT 1
|
|
2583
|
-
`).get(n,r);if(o!==null&&typeof o=="object"&&Object.hasOwn(o,"decided_by")){let s=o.decided_by;return{authority:"owner",approvedBy:typeof s=="string"&&s.length>0?s:void 0}}return{authority:"system_policy"}}catch{return this.deps.logger?.warn?.(`[PD:RuntimeV2] authority derivation failed for artifactId=${n}; rendering without authority attribute`),{}}}loadFeatureFlags(){let e=si(this.workspaceDir),n=Ri(e.effective);if(!e.ok)for(let r of e.errors)this.deps.logger?.warn?.(`[PD:RuntimeV2] Config error at ${r.path}: ${r.reason}`);return n}};import*as GDt from"node:path";var AC="openclaw-plugin@2";function rTe(t,e){try{return ai(t,"principle_receipt_ledger",e).enabled}catch{return!1}}function ysr(){return[{hostKind:"openclaw",capability:"agent_context_delivery",status:"supported",adapterVersion:AC,channel:"prompt",maxConfirmation:"submitted",note:"prompt hook returns the rendered principle block to the host; host consumption is not confirmable"},{hostKind:"openclaw",capability:"enforcement_delivery",status:"supported",adapterVersion:AC,channel:"code_tool_hook",maxConfirmation:"runtime_loaded",note:"RuleHost evaluates live activations from state.db artifacts inside the gate path"},{hostKind:"openclaw",capability:"application_runtime_verified",status:"supported",adapterVersion:AC,channel:"code_tool_hook",note:"gate returns block:true to the host (pd_gate_block_returned_to_host boundary)"},{hostKind:"openclaw",capability:"application_self_report",status:"supported",adapterVersion:AC,channel:"prompt",note:"marker parse from llm_output, membership-verified against the session injection set (principle_receipt_self_report flag)"},{hostKind:"openclaw",capability:"behavior_observation",status:"supported",adapterVersion:AC,channel:"code_tool_hook",note:"tool request + gate outcome episodes on live-rule interventions"},{hostKind:"openclaw",capability:"outcome_observation",status:"unknown",adapterVersion:AC,channel:"console",note:"task_outcomes keeps its original meaning; Phase 1 outcomes enter via Owner console input only"}]}function iTe(t,e,n,r="openclaw_plugin_event_log"){if(e.length===0)return;let i=bq(),o={evidenceScopeId:i.evidenceScopeIdFor(t),sourceKind:r,adapterVersion:AC,recordedAt:new Date().toISOString(),observations:e,capabilityDeclarations:ysr()},s=i.appendObservationBatch({workspaceDir:t,batch:o});s.ok||n?.warn?.(`[PD:Evidence] append degraded: ${s.reason??"unknown"}; next: ${s.nextAction??"replay from durable source"}`)}function UDt(t){if(!rTe(t.workspaceDir,t.logger))return;let e=bq(),n=[];for(let r of t.injected){let i=`openclaw|delivery|agent_context|${t.sessionId??"-"}|${t.runId??"-"}|${r.activationId}`,o=`openclaw-plugin-event-log:${t.sessionId??"no-session"}`,s=e.existingObservationRefs(t.workspaceDir,{sourceKind:"openclaw_plugin_event_log",sourceLocator:o,observationKey:i,principleId:r.principleId,activationId:r.activationId,...r.artifactId?{artifactId:r.artifactId}:{}}),a=s?.activationRef??e.resolveActivationOccurrenceRef(t.workspaceDir,r.activationId);if(!a){t.logger?.warn?.(`[PD:Evidence] prompt delivery skipped for activation ${r.activationId}: occurrence snapshot unresolvable`);continue}if(r.artifactId!==void 0&&a.artifactId!==r.artifactId){t.logger?.warn?.(`[PD:Evidence] prompt delivery skipped for activation ${r.activationId}: source artifact does not match occurrence`);continue}let c=s?.contentRef??e.resolveInterventionContentRef(t.workspaceDir,a,r.principleId);n.push({observationKey:i,sourceLocator:o,kind:"delivery",nativeRefs:{hostKind:"openclaw",...t.sessionId?{sessionId:t.sessionId}:{},...t.runId?{runId:t.runId}:{}},principleId:r.principleId,contentRef:{principleId:r.principleId,...a.artifactId?{artifactId:a.artifactId}:{},...c?{payloadDigest:c.payloadDigest}:{},resolution:c?"resolved":"revision_reference_unresolved"},activationRef:a,payload:{targetKind:"agent_context",confirmation:"submitted",outcome:"attempted"}})}iTe(t.workspaceDir,n,t.logger)}function Nte(t){if(!t.activationId||!t.principleId){t.logger?.info?.("[PD:Evidence] gate enforcement skipped: decision carries no activation/principle attribution");return}if(!t.toolCallId&&!t.runId){t.logger?.warn?.("[PD:Evidence] gate enforcement skipped: no toolCallId/runId \u2014 episode identity would lack a native event key");return}if(!rTe(t.workspaceDir,t.logger))return;let e=bq(),n=t.toolCallId??t.runId,r=t.sessionId??"-",i=`openclaw|delivery|enforcement|${r}|${n}|${t.activationId}`,o=`openclaw-plugin-event-log:${r}`,s=e.existingObservationRefs(t.workspaceDir,{sourceKind:"openclaw_plugin_event_log",sourceLocator:o,observationKey:i,principleId:t.principleId,activationId:t.activationId}),a=s?.activationRef??e.resolveActivationOccurrenceRef(t.workspaceDir,t.activationId);if(!a){t.logger?.warn?.(`[PD:Evidence] gate enforcement skipped for activation ${t.activationId}: occurrence snapshot unresolvable`);return}let c=`openclaw|episode|${r}|${n}`,u=t.filePath??"(no-path)",l=s?.contentRef??e.resolveInterventionContentRef(t.workspaceDir,a,t.principleId),p={principleId:t.principleId,...a.artifactId?{artifactId:a.artifactId}:{},...l?{payloadDigest:l.payloadDigest}:{},resolution:l?"resolved":"revision_reference_unresolved"},f=[{observationKey:i,sourceLocator:o,kind:"delivery",nativeRefs:{hostKind:"openclaw",...t.sessionId?{sessionId:t.sessionId}:{},...t.runId?{runId:t.runId}:{},...t.toolCallId?{toolCallId:t.toolCallId}:{},toolName:t.toolName},principleId:t.principleId,contentRef:p,activationRef:a,payload:{targetKind:"runtime_enforcement",confirmation:"runtime_loaded",outcome:"delivered"}},{observationKey:`openclaw|application|runtime_verified|${r}|${n}|${t.activationId}`,sourceLocator:`openclaw-plugin-event-log:${r}`,kind:"application",nativeRefs:{hostKind:"openclaw",...t.sessionId?{sessionId:t.sessionId}:{},...t.runId?{runId:t.runId}:{},...t.toolCallId?{toolCallId:t.toolCallId}:{},toolName:t.toolName},principleId:t.principleId,activationRef:a,episodeKey:c,payload:t.decision==="block"?{proofMethod:"runtime_verified",action:"tool_blocked",enforcementBoundary:"pd_gate_block_returned_to_host"}:{proofMethod:"runtime_verified",action:"auto_correct_applied",enforcementBoundary:"pd_gate_params_returned_to_host"}},{observationKey:c,sourceLocator:`openclaw-plugin-event-log:${r}`,kind:"behavior_episode",nativeRefs:{hostKind:"openclaw",...t.sessionId?{sessionId:t.sessionId}:{},...t.runId?{runId:t.runId}:{},...t.toolCallId?{toolCallId:t.toolCallId}:{},toolName:t.toolName},payload:{status:"closed",actionSummary:`${t.toolName} on ${u}`,resultSummary:t.decision==="block"?`blocked by rule ${t.ruleId??"unknown"}`:`params corrected by rule ${t.ruleId??"unknown"}`}},{observationKey:`openclaw|effect|${r}|${n}|${t.activationId}`,sourceLocator:`openclaw-plugin-event-log:${r}`,kind:"effect",nativeRefs:{hostKind:"openclaw",...t.sessionId?{sessionId:t.sessionId}:{},...t.toolCallId?{toolCallId:t.toolCallId}:{},toolName:t.toolName},principleId:t.principleId,episodeKey:c,contentRef:p,activationRef:a,payload:{status:"observed",observationSummary:t.decision==="block"?`rule ${t.ruleId??"unknown"} blocked ${t.toolName} on ${u}`:`rule ${t.ruleId??"unknown"} corrected ${t.toolName} params on ${u}`}}];iTe(t.workspaceDir,f,t.logger)}function $Dt(t){if(!rTe(t.workspaceDir,t.logger))return;let e=bq(),n=t.activationId?e.resolveActivationOccurrenceRef(t.workspaceDir,t.activationId):null,r={observationKey:`openclaw|application|agent_claimed|${t.sessionId??"-"}|${t.principleId}`,sourceLocator:`openclaw-application-ledger:${t.sessionId??"no-session"}`,kind:"application",nativeRefs:{hostKind:"openclaw",...t.sessionId?{sessionId:t.sessionId}:{}},principleId:t.principleId,...t.occurredAt?{occurredAt:t.occurredAt}:{},...t.activationId&&!n?{activationId:t.activationId}:{},...n?{activationRef:n}:{},payload:{proofMethod:"agent_claimed",action:"self_reported",claimText:t.claimText.slice(0,200)}};iTe(t.workspaceDir,[r],t.logger,"openclaw_application_ledger")}var Isr=90,_sr=3600*1e3,QDt=new Map,WDt=0;function sTe(t){let e=QDt.get(t);return e||(e=new sr(t),QDt.set(t,e)),e}function aTe(t){let e=Date.now();if(e-WDt<_sr)return;WDt=e;let n=new Date(e-Isr*24*60*60*1e3).toISOString();try{t.prepare("DELETE FROM principle_applications WHERE created_at < ?").run(n)}catch{}}function Lte(t,e){try{let n=sTe(t).getDb();return aTe(n),n.prepare(`
|
|
2583
|
+
`).get(n,r);if(o!==null&&typeof o=="object"&&Object.hasOwn(o,"decided_by")){let s=o.decided_by;return{authority:"owner",approvedBy:typeof s=="string"&&s.length>0?s:void 0}}return{authority:"system_policy"}}catch{return this.deps.logger?.warn?.(`[PD:RuntimeV2] authority derivation failed for artifactId=${n}; rendering without authority attribute`),{}}}loadFeatureFlags(){let e=si(this.workspaceDir),n=Ri(e.effective);if(!e.ok)for(let r of e.errors)this.deps.logger?.warn?.(`[PD:RuntimeV2] Config error at ${r.path}: ${r.reason}`);return n}};import*as GDt from"node:path";var AC="openclaw-plugin@2";function rTe(t,e){try{return ai(t,"principle_receipt_ledger",e).enabled}catch{return!1}}function ysr(){return[{hostKind:"openclaw",capability:"agent_context_delivery",status:"supported",adapterVersion:AC,channel:"prompt",maxConfirmation:"submitted",note:"prompt hook returns the rendered principle block to the host; host consumption is not confirmable"},{hostKind:"openclaw",capability:"enforcement_delivery",status:"supported",adapterVersion:AC,channel:"code_tool_hook",maxConfirmation:"runtime_loaded",note:"RuleHost evaluates live activations from state.db artifacts inside the gate path"},{hostKind:"openclaw",capability:"application_runtime_verified",status:"supported",adapterVersion:AC,channel:"code_tool_hook",note:"gate returns block:true to the host (pd_gate_block_returned_to_host boundary)"},{hostKind:"openclaw",capability:"application_self_report",status:"supported",adapterVersion:AC,channel:"prompt",note:"marker parse from llm_output, membership-verified against the session injection set (principle_receipt_self_report flag)"},{hostKind:"openclaw",capability:"behavior_observation",status:"supported",adapterVersion:AC,channel:"code_tool_hook",note:"tool request + gate outcome episodes on live-rule interventions"},{hostKind:"openclaw",capability:"outcome_observation",status:"unknown",adapterVersion:AC,channel:"console",note:"task_outcomes keeps its original meaning; Phase 1 outcomes enter via Owner console input only"}]}function iTe(t,e,n,r="openclaw_plugin_event_log"){if(e.length===0)return;let i=bq(),o={evidenceScopeId:i.evidenceScopeIdFor(t),sourceKind:r,adapterVersion:AC,recordedAt:new Date().toISOString(),observations:e,capabilityDeclarations:ysr()},s=i.appendObservationBatch({workspaceDir:t,batch:o});s.ok||n?.warn?.(`[PD:Evidence] append degraded: ${s.reason??"unknown"}; next: ${s.nextAction??"replay from durable source"}`)}function UDt(t){if(!rTe(t.workspaceDir,t.logger))return;let e=bq(),n=[];for(let r of t.injected){let i=`openclaw|delivery|agent_context|${t.sessionId??"-"}|${t.runId??"-"}|${r.activationId}`,o=`openclaw-plugin-event-log:${t.sessionId??"no-session"}`,s=e.existingObservationRefs(t.workspaceDir,{sourceKind:"openclaw_plugin_event_log",sourceLocator:o,observationKey:i,principleId:r.principleId,activationId:r.activationId,...r.artifactId?{artifactId:r.artifactId}:{}}),a=s?.activationRef??e.resolveActivationOccurrenceRef(t.workspaceDir,r.activationId);if(!a){t.logger?.warn?.(`[PD:Evidence] prompt delivery skipped for activation ${r.activationId}: occurrence snapshot unresolvable`);continue}if(r.artifactId!==void 0&&a.artifactId!==r.artifactId){t.logger?.warn?.(`[PD:Evidence] prompt delivery skipped for activation ${r.activationId}: source artifact does not match occurrence`);continue}let c=s?.contentRef??e.resolveInterventionContentRef(t.workspaceDir,a,r.principleId);n.push({observationKey:i,sourceLocator:o,kind:"delivery",nativeRefs:{hostKind:"openclaw",...t.sessionId?{sessionId:t.sessionId}:{},...t.runId?{runId:t.runId}:{}},principleId:r.principleId,contentRef:{principleId:r.principleId,...a.artifactId?{artifactId:a.artifactId}:{},...c?{payloadDigest:c.payloadDigest}:{},resolution:c?.payloadDigest!==void 0?"resolved":"revision_reference_unresolved"},activationRef:a,payload:{targetKind:"agent_context",confirmation:"submitted",outcome:"attempted"}})}iTe(t.workspaceDir,n,t.logger)}function Nte(t){if(!t.activationId||!t.principleId){t.logger?.info?.("[PD:Evidence] gate enforcement skipped: decision carries no activation/principle attribution");return}if(!t.toolCallId&&!t.runId){t.logger?.warn?.("[PD:Evidence] gate enforcement skipped: no toolCallId/runId \u2014 episode identity would lack a native event key");return}if(!rTe(t.workspaceDir,t.logger))return;let e=bq(),n=t.toolCallId??t.runId,r=t.sessionId??"-",i=`openclaw|delivery|enforcement|${r}|${n}|${t.activationId}`,o=`openclaw-plugin-event-log:${r}`,s=e.existingObservationRefs(t.workspaceDir,{sourceKind:"openclaw_plugin_event_log",sourceLocator:o,observationKey:i,principleId:t.principleId,activationId:t.activationId}),a=s?.activationRef??e.resolveActivationOccurrenceRef(t.workspaceDir,t.activationId);if(!a){t.logger?.warn?.(`[PD:Evidence] gate enforcement skipped for activation ${t.activationId}: occurrence snapshot unresolvable`);return}let c=`openclaw|episode|${r}|${n}`,u=t.filePath??"(no-path)",l=s?.contentRef??e.resolveInterventionContentRef(t.workspaceDir,a,t.principleId),p={principleId:t.principleId,...a.artifactId?{artifactId:a.artifactId}:{},...l?{payloadDigest:l.payloadDigest}:{},resolution:l?.payloadDigest!==void 0?"resolved":"revision_reference_unresolved"},f=[{observationKey:i,sourceLocator:o,kind:"delivery",nativeRefs:{hostKind:"openclaw",...t.sessionId?{sessionId:t.sessionId}:{},...t.runId?{runId:t.runId}:{},...t.toolCallId?{toolCallId:t.toolCallId}:{},toolName:t.toolName},principleId:t.principleId,contentRef:p,activationRef:a,payload:{targetKind:"runtime_enforcement",confirmation:"runtime_loaded",outcome:"delivered"}},{observationKey:`openclaw|application|runtime_verified|${r}|${n}|${t.activationId}`,sourceLocator:`openclaw-plugin-event-log:${r}`,kind:"application",nativeRefs:{hostKind:"openclaw",...t.sessionId?{sessionId:t.sessionId}:{},...t.runId?{runId:t.runId}:{},...t.toolCallId?{toolCallId:t.toolCallId}:{},toolName:t.toolName},principleId:t.principleId,activationRef:a,episodeKey:c,payload:t.decision==="block"?{proofMethod:"runtime_verified",action:"tool_blocked",enforcementBoundary:"pd_gate_block_returned_to_host"}:{proofMethod:"runtime_verified",action:"auto_correct_applied",enforcementBoundary:"pd_gate_params_returned_to_host"}},{observationKey:c,sourceLocator:`openclaw-plugin-event-log:${r}`,kind:"behavior_episode",nativeRefs:{hostKind:"openclaw",...t.sessionId?{sessionId:t.sessionId}:{},...t.runId?{runId:t.runId}:{},...t.toolCallId?{toolCallId:t.toolCallId}:{},toolName:t.toolName},payload:{status:"closed",actionSummary:`${t.toolName} on ${u}`,resultSummary:t.decision==="block"?`blocked by rule ${t.ruleId??"unknown"}`:`params corrected by rule ${t.ruleId??"unknown"}`}},{observationKey:`openclaw|effect|${r}|${n}|${t.activationId}`,sourceLocator:`openclaw-plugin-event-log:${r}`,kind:"effect",nativeRefs:{hostKind:"openclaw",...t.sessionId?{sessionId:t.sessionId}:{},...t.toolCallId?{toolCallId:t.toolCallId}:{},toolName:t.toolName},principleId:t.principleId,episodeKey:c,contentRef:p,activationRef:a,payload:{status:"observed",observationSummary:t.decision==="block"?`rule ${t.ruleId??"unknown"} blocked ${t.toolName} on ${u}`:`rule ${t.ruleId??"unknown"} corrected ${t.toolName} params on ${u}`}}];iTe(t.workspaceDir,f,t.logger)}function $Dt(t){if(!rTe(t.workspaceDir,t.logger))return;let e=bq(),n=t.activationId?e.resolveActivationOccurrenceRef(t.workspaceDir,t.activationId):null,r={observationKey:`openclaw|application|agent_claimed|${t.sessionId??"-"}|${t.principleId}`,sourceLocator:`openclaw-application-ledger:${t.sessionId??"no-session"}`,kind:"application",nativeRefs:{hostKind:"openclaw",...t.sessionId?{sessionId:t.sessionId}:{}},principleId:t.principleId,...t.occurredAt?{occurredAt:t.occurredAt}:{},...t.activationId&&!n?{activationId:t.activationId}:{},...n?{activationRef:n}:{},payload:{proofMethod:"agent_claimed",action:"self_reported",claimText:t.claimText.slice(0,200)}};iTe(t.workspaceDir,[r],t.logger,"openclaw_application_ledger")}var Isr=90,_sr=3600*1e3,QDt=new Map,WDt=0;function sTe(t){let e=QDt.get(t);return e||(e=new sr(t),QDt.set(t,e)),e}function aTe(t){let e=Date.now();if(e-WDt<_sr)return;WDt=e;let n=new Date(e-Isr*24*60*60*1e3).toISOString();try{t.prepare("DELETE FROM principle_applications WHERE created_at < ?").run(n)}catch{}}function Lte(t,e){try{let n=sTe(t).getDb();return aTe(n),n.prepare(`
|
|
2584
2584
|
INSERT OR IGNORE INTO principle_applications
|
|
2585
2585
|
(principle_id, activation_id, rule_id, channel, level, kind,
|
|
2586
2586
|
session_id, tool_name, file_path, digest, created_at)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "principles-disciple",
|
|
3
3
|
"name": "Principles Disciple",
|
|
4
4
|
"description": "Principles Disciple is an AI Agent Governance System. Stop correcting the same AI behavior across sessions. Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles.",
|
|
5
|
-
"version": "2.1.
|
|
5
|
+
"version": "2.1.1",
|
|
6
6
|
"activation": {
|
|
7
7
|
"onStartup": true,
|
|
8
8
|
"onCapabilities": [
|