create-principles-disciple 1.147.10 → 1.147.12
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/core/dist/runtime-v2/adapter/output-schema-registry.d.ts +3 -1
- package/core/dist/runtime-v2/adapter/output-schema-registry.d.ts.map +1 -1
- package/core/dist/runtime-v2/adapter/output-schema-registry.js +46 -2
- package/core/dist/runtime-v2/adapter/output-schema-registry.js.map +1 -1
- package/core/dist/runtime-v2/pain-signal-observability.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-signal-observability.js +5 -3
- package/core/dist/runtime-v2/pain-signal-observability.js.map +1 -1
- package/core/dist/runtime-v2/trajectory-schema.d.ts +34 -4
- package/core/dist/runtime-v2/trajectory-schema.d.ts.map +1 -1
- package/core/dist/runtime-v2/trajectory-schema.js +30 -2
- package/core/dist/runtime-v2/trajectory-schema.js.map +1 -1
- package/core/package.json +1 -1
- package/host-runtime/dist/adaptive-behavior-linkage.d.ts +223 -0
- package/host-runtime/dist/adaptive-behavior-linkage.js +1014 -0
- package/host-runtime/dist/adaptive-journal-reconciliation.d.ts +10 -0
- package/host-runtime/dist/adaptive-journal-reconciliation.js +16 -0
- package/host-runtime/dist/index.d.ts +1 -0
- package/host-runtime/dist/index.js +2 -0
- package/host-runtime/dist/production-pain-evidence.js +6 -6
- package/host-runtime/dist/prompt-injection-budget-observation.js +31 -2
- package/host-runtime/package.json +1 -1
- package/package.json +3 -3
- package/pd-cli/dist/commands/runtime-activation.d.ts +19 -0
- package/pd-cli/dist/commands/runtime-activation.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-activation.js +75 -2
- package/pd-cli/dist/commands/runtime-activation.js.map +1 -1
- package/pd-cli/dist/index.js +3 -1
- package/pd-cli/dist/index.js.map +1 -1
- package/pd-cli/package.json +1 -1
- package/plugin/dist/bundle.js +380 -380
- package/plugin/dist/openclaw.plugin.json +1 -1
- package/plugin/dist/rulehost-evidence.js +13 -13
- package/plugin/openclaw.plugin.json +1 -1
- package/plugin/package.json +1 -1
- package/release-manager/package.json +1 -1
|
@@ -76,6 +76,12 @@ export interface AdaptiveJournalTotals {
|
|
|
76
76
|
rejectedRecords: number | null;
|
|
77
77
|
countsAreLowerBounds: boolean;
|
|
78
78
|
}
|
|
79
|
+
export interface AdaptiveJournalConfigIdentity {
|
|
80
|
+
hostVersion: string | null;
|
|
81
|
+
pluginVersion: string | null;
|
|
82
|
+
effectiveHookSetFingerprint: string | null;
|
|
83
|
+
evidenceCoverage: string | null;
|
|
84
|
+
}
|
|
79
85
|
export interface AdaptiveJournalRecordProjection {
|
|
80
86
|
ts: string;
|
|
81
87
|
receiptState: 'open' | 'closed' | 'reconciled';
|
|
@@ -88,6 +94,10 @@ export interface AdaptiveJournalRecordProjection {
|
|
|
88
94
|
artifactId: string | null;
|
|
89
95
|
activationId: string | null;
|
|
90
96
|
requestId: string | null;
|
|
97
|
+
/** PRI-1114: recorded target body hash; never re-computed by this reader. */
|
|
98
|
+
targetBodySha256: string | null;
|
|
99
|
+
/** PRI-1114: recorded call-configuration identity (PRI-1109 §3.3 contract). */
|
|
100
|
+
configIdentity: AdaptiveJournalConfigIdentity | null;
|
|
91
101
|
evidenceReferencePresent: boolean;
|
|
92
102
|
/** Transcribed as recorded; never re-verified by this reader. */
|
|
93
103
|
evidenceIndependentlyVerifiedAsRecorded: boolean | null;
|
|
@@ -407,6 +407,20 @@ function countDistinctIdentities(records) {
|
|
|
407
407
|
function buildProjection(data, fallbackTs) {
|
|
408
408
|
const receiptState = data.receiptState === 'closed' || data.receiptState === 'reconciled' ? data.receiptState : 'open';
|
|
409
409
|
const evidence = isRecord(data.evidence) ? data.evidence : null;
|
|
410
|
+
const configIdentity = (() => {
|
|
411
|
+
const identity = {
|
|
412
|
+
hostVersion: optionalString(data.hostVersion),
|
|
413
|
+
pluginVersion: optionalString(data.pluginVersion),
|
|
414
|
+
effectiveHookSetFingerprint: optionalString(data.effectiveHookSetFingerprint),
|
|
415
|
+
evidenceCoverage: optionalString(data.evidenceCoverage),
|
|
416
|
+
};
|
|
417
|
+
return identity.hostVersion === null
|
|
418
|
+
&& identity.pluginVersion === null
|
|
419
|
+
&& identity.effectiveHookSetFingerprint === null
|
|
420
|
+
&& identity.evidenceCoverage === null
|
|
421
|
+
? null
|
|
422
|
+
: identity;
|
|
423
|
+
})();
|
|
410
424
|
return {
|
|
411
425
|
ts: fallbackTs,
|
|
412
426
|
receiptState,
|
|
@@ -419,6 +433,8 @@ function buildProjection(data, fallbackTs) {
|
|
|
419
433
|
artifactId: optionalString(data.artifactId) ?? optionalString(data.principleArtifactId),
|
|
420
434
|
activationId: optionalString(data.activationId) ?? optionalString(data.activationRunId),
|
|
421
435
|
requestId: optionalString(data.requestId),
|
|
436
|
+
targetBodySha256: optionalString(data.targetBodySha256),
|
|
437
|
+
configIdentity,
|
|
422
438
|
evidenceReferencePresent: evidence !== null && optionalString(evidence.reference) !== null,
|
|
423
439
|
evidenceIndependentlyVerifiedAsRecorded: evidence === null ? null : optionalBoolean(evidence.independentlyVerified),
|
|
424
440
|
hostKillConfirmedAsRecorded: evidence === null ? null : optionalBoolean(evidence.hostKillConfirmed),
|
|
@@ -113,3 +113,4 @@ export { readDesignGateSpecSnapshot, describeCodexRuleContextFact } from './desi
|
|
|
113
113
|
export { createCodexArtificerTrustedFactsPort } from './codex-artificer-trusted-facts.js';
|
|
114
114
|
export { revalidateAdaptivePrinciple, createAdaptivePrincipleRevalidator, type AdaptivePrincipleReader } from './adaptive-principle-revalidation.js';
|
|
115
115
|
export * from './adaptive-journal-reconciliation.js';
|
|
116
|
+
export * from './adaptive-behavior-linkage.js';
|
|
@@ -361,3 +361,5 @@ export { readDesignGateSpecSnapshot, describeCodexRuleContextFact } from './desi
|
|
|
361
361
|
export { createCodexArtificerTrustedFactsPort } from './codex-artificer-trusted-facts.js';
|
|
362
362
|
export { revalidateAdaptivePrinciple, createAdaptivePrincipleRevalidator } from './adaptive-principle-revalidation.js';
|
|
363
363
|
export * from './adaptive-journal-reconciliation.js';
|
|
364
|
+
// PRI-1114: read-only behavior evidence linkage (no writes, no model runs).
|
|
365
|
+
export * from './adaptive-behavior-linkage.js';
|
|
@@ -3,6 +3,9 @@ import fs from 'node:fs';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import Database from 'better-sqlite3';
|
|
5
5
|
import { applyTrajectorySchemaBase, migrateLegacyGfiSchema, sanitizeToolParams, sanitizeValue, } from '@principles/core/runtime-v2';
|
|
6
|
+
// PRI-1135: the canonical column declaration lives with the DDL owner. Import
|
|
7
|
+
// the subpath directly so the public runtime-v2 barrel surface stays unchanged.
|
|
8
|
+
import { TRAJECTORY_REQUIRED_COLUMNS } from '@principles/core/runtime-v2/trajectory-schema';
|
|
6
9
|
const MAX_PREVIEW = 500;
|
|
7
10
|
function isRecord(value) {
|
|
8
11
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
@@ -152,11 +155,8 @@ export function deriveProductionCorrectionPainIdentity(fields) {
|
|
|
152
155
|
const digest = createHash('sha256').update(canonical).digest('hex');
|
|
153
156
|
return { eventId: `host_${digest}`, painId: `pain_host_${digest}` };
|
|
154
157
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
tool_calls: { session_id: 'TEXT', tool_name: 'TEXT', outcome: 'TEXT', duration_ms: 'INTEGER', exit_code: 'INTEGER', error_type: 'TEXT', error_message: 'TEXT', params_json: 'TEXT', result_preview: 'TEXT', created_at: 'TEXT', project_dir: 'TEXT' },
|
|
158
|
-
pain_events: { session_id: 'TEXT', source: 'TEXT', score: 'REAL', reason: 'TEXT', severity: 'TEXT', origin: 'TEXT', confidence: 'REAL', text: 'TEXT', canonical_pain_id: 'TEXT', runtime_task_id: 'TEXT', host_kind: 'TEXT', created_at: 'TEXT' },
|
|
159
|
-
};
|
|
158
|
+
// PRI-1135: the canonical required-column declaration now lives in core
|
|
159
|
+
// (TRAJECTORY_REQUIRED_COLUMNS); this module keeps no second copy.
|
|
160
160
|
function pragmaField(row, key) {
|
|
161
161
|
return isRecord(row) && Object.hasOwn(row, key) ? Object.getOwnPropertyDescriptor(row, key)?.value : undefined;
|
|
162
162
|
}
|
|
@@ -176,7 +176,7 @@ function hasCanonicalIndexPredicate(db) {
|
|
|
176
176
|
return whereIndex >= 0 && normalized.slice(whereIndex + 7) === 'CANONICAL_PAIN_ID IS NOT NULL';
|
|
177
177
|
}
|
|
178
178
|
function hasCanonicalSchema(db) {
|
|
179
|
-
for (const [table, required] of Object.entries(
|
|
179
|
+
for (const [table, required] of Object.entries(TRAJECTORY_REQUIRED_COLUMNS)) {
|
|
180
180
|
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
181
181
|
const actual = new Map();
|
|
182
182
|
for (const row of rows) {
|
|
@@ -2,6 +2,35 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { PROMPT_BUDGET_POLICY_VERSION, RUNTIME_V2_PRINCIPLE_BUDGET, isValidContextWindowTokens, promptBudgetCharsForContextWindow, resolvePromptBudget, operatorDeclaredContextWindow, } from '@principles/core/runtime-v2';
|
|
4
4
|
import { isPromptInjectionTargetHost, } from './prompt-injection-projection.js';
|
|
5
|
+
/**
|
|
6
|
+
* PRI-1104 Stage 0 (expand): accepted budget policy provenance versions.
|
|
7
|
+
*
|
|
8
|
+
* Injection events written to the JSONL event log carry `budgetPolicyVersion`
|
|
9
|
+
* as a durable wire literal. PR-6 renames the CURRENT policy id from
|
|
10
|
+
* `model_aware_v2` to a version-neutral `model_aware`; without this read-side
|
|
11
|
+
* allowance, every historical event would suddenly be classified as
|
|
12
|
+
* "computed under a different policy" and silently skipped (and a revert of
|
|
13
|
+
* PR-6 would strand events written with the new id).
|
|
14
|
+
*
|
|
15
|
+
* These are FROZEN WIRE LITERALS, not a second policy definition: they exist
|
|
16
|
+
* only so events remain readable across the PR-6 rename AND its revert. The
|
|
17
|
+
* PR-6 target id `model_aware` is listed up front (PR #2367 CodeRabbit #2):
|
|
18
|
+
* if PR-6 is reverted after it wrote `model_aware` events, a reader accepting
|
|
19
|
+
* only `model_aware_v2` would silently skip those observations and the console
|
|
20
|
+
* would fall back to a stale budget.
|
|
21
|
+
*
|
|
22
|
+
* Today the writer emits only `model_aware_v2`, so listing the future and
|
|
23
|
+
* historical literals does not change any current read result.
|
|
24
|
+
*/
|
|
25
|
+
const ACCEPTED_BUDGET_POLICY_VERSIONS = new Set([
|
|
26
|
+
PROMPT_BUDGET_POLICY_VERSION,
|
|
27
|
+
'model_aware_v2',
|
|
28
|
+
'model_aware',
|
|
29
|
+
]);
|
|
30
|
+
/** Narrow an untrusted event field to an accepted policy provenance id. */
|
|
31
|
+
function isAcceptedBudgetPolicyVersion(value) {
|
|
32
|
+
return typeof value === 'string' && ACCEPTED_BUDGET_POLICY_VERSIONS.has(value);
|
|
33
|
+
}
|
|
5
34
|
/**
|
|
6
35
|
* PRI-1017: runtime budget OBSERVATION read model over the EXISTING
|
|
7
36
|
* injection-event JSONL (`<workspaceDir>/{.pd,.state}/logs/events_<date>.jsonl`,
|
|
@@ -162,7 +191,7 @@ function narrowObservation(parsed, workspaceDir, nowMs) {
|
|
|
162
191
|
// A budget computed under another policy version is not evidence about the
|
|
163
192
|
// CURRENT formula. Absent provenance is pre-policy, not "current by
|
|
164
193
|
// default": both are skipped, never reinterpreted.
|
|
165
|
-
if (data.budgetPolicyVersion
|
|
194
|
+
if (!isAcceptedBudgetPolicyVersion(data.budgetPolicyVersion))
|
|
166
195
|
return null;
|
|
167
196
|
const rawSource = data.budgetCapacitySource;
|
|
168
197
|
const rawStatus = data.budgetCapacityStatus;
|
|
@@ -335,7 +364,7 @@ export function readRuntimePromptBudgetObservations(input) {
|
|
|
335
364
|
if (isRecord(parsed) && parsed.type === 'runtime_v2_prompt_activations_injected' && isRecord(parsed.data)) {
|
|
336
365
|
const { data } = parsed;
|
|
337
366
|
const rawPolicyVersion = data.budgetPolicyVersion;
|
|
338
|
-
if (rawPolicyVersion !== undefined && rawPolicyVersion
|
|
367
|
+
if (rawPolicyVersion !== undefined && !isAcceptedBudgetPolicyVersion(rawPolicyVersion)) {
|
|
339
368
|
// A budget computed under a DIFFERENT policy version is not
|
|
340
369
|
// evidence about the current formula — counted, not reinterpreted.
|
|
341
370
|
foreignPolicyEventsSkipped.count += 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-principles-disciple",
|
|
3
|
-
"version": "1.147.
|
|
3
|
+
"version": "1.147.12",
|
|
4
4
|
"description": "Interactive CLI installer for Principles Disciple OpenClaw plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"directory": "packages/create-principles-disciple"
|
|
100
100
|
},
|
|
101
101
|
"pd": {
|
|
102
|
-
"bundledPluginVersion": "2.6.
|
|
102
|
+
"bundledPluginVersion": "2.6.4"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "3c04ff93abbde31dcca25c8ad0809d00807b5015"
|
|
105
105
|
}
|
|
@@ -168,5 +168,24 @@ export interface RuntimeActivationJournalOptions {
|
|
|
168
168
|
*/
|
|
169
169
|
export declare function handleRuntimeActivationJournal(opts: RuntimeActivationJournalOptions): Promise<void>;
|
|
170
170
|
export declare function registerRuntimeActivationJournalCommand(parent: Command): Command;
|
|
171
|
+
export interface RuntimeActivationLinkOptions {
|
|
172
|
+
workspace?: string;
|
|
173
|
+
since?: string;
|
|
174
|
+
until?: string;
|
|
175
|
+
host?: string;
|
|
176
|
+
json?: boolean;
|
|
177
|
+
maxInvocations?: string;
|
|
178
|
+
maxDateFiles?: string;
|
|
179
|
+
maxFileBytes?: string;
|
|
180
|
+
maxEventLines?: string;
|
|
181
|
+
maxTrajectoryRows?: string;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* PRI-1114: thin CLI wrapper over the read-only behavior linkage in
|
|
185
|
+
* @principles/host-runtime. All association semantics live in the library.
|
|
186
|
+
* stdout carries exactly one JSON document; diagnostics go to stderr.
|
|
187
|
+
*/
|
|
188
|
+
export declare function handleRuntimeActivationLink(opts: RuntimeActivationLinkOptions): Promise<void>;
|
|
189
|
+
export declare function registerRuntimeActivationLinkCommand(parent: Command): Command;
|
|
171
190
|
export {};
|
|
172
191
|
//# sourceMappingURL=runtime-activation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-activation.d.ts","sourceRoot":"","sources":["../../src/commands/runtime-activation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime-activation.d.ts","sourceRoot":"","sources":["../../src/commands/runtime-activation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2EzC,OAAO,KAAK,EAA4C,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAwBvH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iCAAiC,EAAE,SAAS,MAAM,EAAwC,CAAC;AAExG,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,mEAAmE;IACnE,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,MAAM,GAAG,6BAA6B,CA0B/F;AAED,oFAAoF;AACpF,wBAAgB,8BAA8B,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,yBAAyB,CAAC,eAAe,CAAC,CAO9J;AAED,UAAU,yBAAyB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CA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F;AAED,MAAM,WAAW,+BAA+B;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAsB,8BAA8B,CAAC,IAAI,EAAE,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC,CAgDzG;AAED,wBAAgB,uCAAuC,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAwBhF;AAED,MAAM,WAAW,4BAA4B;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAsB,2BAA2B,CAAC,IAAI,EAAE,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CnG;AAED,wBAAgB,oCAAoC,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CA4B7E"}
|
|
@@ -2,7 +2,7 @@ import * as path from 'path';
|
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import { createHash, randomUUID } from 'node:crypto';
|
|
4
4
|
import { RuntimeStateManager, ActivationDispatcher, PromptWriter, DeferArchiveWriter, RuleHostWriter, createProductionGateDeps, SqliteActivationStateStore, SqliteApprovalQueueStore, SqlitePIArtifactStore, PrincipleTreeLedgerAdapter, ApprovalQueue, ApprovalCompletionService, isArtifactRevisionOf, extractEvidenceRefs, extractPrincipleId, isFeatureEnabled, RuleCodeOwnerDecisionService, PromotionReadinessReader, SqliteActivationSafetyStore, collectOpenClawPromotionChecks, summarizeRuleCodeShadowEvents, buildPromotionEvidenceSnapshot, detectPromptReplacementTarget, } from '@principles/core/runtime-v2';
|
|
5
|
-
import { checkPromptArtifactDeliverabilityById, RUNTIME_V2_EVENT_LOG_CANDIDATE_DIRS, reconcileAdaptiveJournal, } from '@principles/host-runtime';
|
|
5
|
+
import { checkPromptArtifactDeliverabilityById, linkAdaptiveBehaviorEvidence, RUNTIME_V2_EVENT_LOG_CANDIDATE_DIRS, reconcileAdaptiveJournal, } from '@principles/host-runtime';
|
|
6
6
|
/**
|
|
7
7
|
* I3 upgrade (Owner review of PR #1856, P1): ledger-aware identity deps for
|
|
8
8
|
* the dispatcher. Membership is verified against the ledger SSOT at
|
|
@@ -1742,7 +1742,7 @@ export function registerRuntimeActivationJournalCommand(parent) {
|
|
|
1742
1742
|
.option('--until <iso>', 'Explicit window end (ISO timestamp; default: now)')
|
|
1743
1743
|
.option('--host <host>', 'Host identity to reconcile', 'openclaw')
|
|
1744
1744
|
.option('--max-invocations <n>', 'Maximum invocations emitted (default: 1000)')
|
|
1745
|
-
.option('--max-date-files <n>', 'Maximum date files read per log directory (default:
|
|
1745
|
+
.option('--max-date-files <n>', 'Maximum date files read per log directory (default: 9)')
|
|
1746
1746
|
.option('--max-file-bytes <n>', 'Maximum bytes read per file (default: 4194304)')
|
|
1747
1747
|
.option('--max-terminal-variants <n>', 'Maximum terminal variants per invocation (default: 5)')
|
|
1748
1748
|
.action(async (opts) => {
|
|
@@ -1758,4 +1758,77 @@ export function registerRuntimeActivationJournalCommand(parent) {
|
|
|
1758
1758
|
});
|
|
1759
1759
|
});
|
|
1760
1760
|
}
|
|
1761
|
+
/**
|
|
1762
|
+
* PRI-1114: thin CLI wrapper over the read-only behavior linkage in
|
|
1763
|
+
* @principles/host-runtime. All association semantics live in the library.
|
|
1764
|
+
* stdout carries exactly one JSON document; diagnostics go to stderr.
|
|
1765
|
+
*/
|
|
1766
|
+
export async function handleRuntimeActivationLink(opts) {
|
|
1767
|
+
const workspaceDir = opts.workspace ? path.resolve(opts.workspace) : resolveWorkspaceDir();
|
|
1768
|
+
const limits = {};
|
|
1769
|
+
if (opts.maxInvocations !== undefined)
|
|
1770
|
+
limits.maxInvocations = Number(opts.maxInvocations);
|
|
1771
|
+
if (opts.maxDateFiles !== undefined)
|
|
1772
|
+
limits.maxDateFilesPerDir = Number(opts.maxDateFiles);
|
|
1773
|
+
if (opts.maxFileBytes !== undefined)
|
|
1774
|
+
limits.maxFileBytes = Number(opts.maxFileBytes);
|
|
1775
|
+
if (opts.maxEventLines !== undefined)
|
|
1776
|
+
limits.maxEventLogLines = Number(opts.maxEventLines);
|
|
1777
|
+
if (opts.maxTrajectoryRows !== undefined)
|
|
1778
|
+
limits.maxTrajectoryRows = Number(opts.maxTrajectoryRows);
|
|
1779
|
+
const result = linkAdaptiveBehaviorEvidence({
|
|
1780
|
+
workspaceDir,
|
|
1781
|
+
...(opts.since !== undefined ? { since: opts.since } : {}),
|
|
1782
|
+
...(opts.until !== undefined ? { until: opts.until } : {}),
|
|
1783
|
+
...(opts.host !== undefined ? { host: opts.host } : {}),
|
|
1784
|
+
limits,
|
|
1785
|
+
});
|
|
1786
|
+
if (!result.ok) {
|
|
1787
|
+
console.log(JSON.stringify(result, null, 2));
|
|
1788
|
+
console.error(`[activation link] ${result.error.code}: ${result.error.message}`);
|
|
1789
|
+
console.error(`[activation link] nextAction: ${result.error.nextAction}`);
|
|
1790
|
+
process.exitCode = 2;
|
|
1791
|
+
return;
|
|
1792
|
+
}
|
|
1793
|
+
const { report } = result;
|
|
1794
|
+
console.log(JSON.stringify(report, null, 2));
|
|
1795
|
+
console.error(`[activation link] window: ${report.request.window.start} ~ ${report.request.window.end}`
|
|
1796
|
+
+ ` invocations=${report.totals.invocations} strong_run=${report.totals.byAssociation.strong_run}`);
|
|
1797
|
+
console.error(`[activation link] coverage complete=${report.coverage.complete}`
|
|
1798
|
+
+ ` journal=${report.coverage.journal.status}`
|
|
1799
|
+
+ ` trajectory=${report.coverage.trajectory.status}`);
|
|
1800
|
+
if (report.coverage.journal.status === 'unavailable') {
|
|
1801
|
+
console.error('[activation link] no readable journal directory: association is unknown, not absent');
|
|
1802
|
+
process.exitCode = 3;
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
export function registerRuntimeActivationLinkCommand(parent) {
|
|
1806
|
+
return parent
|
|
1807
|
+
.command('link')
|
|
1808
|
+
.description('Read-only linkage of interventions to run-level actions, corrections and task outcomes (never writes, never runs a model)')
|
|
1809
|
+
.option('-w, --workspace <path>', 'Workspace directory')
|
|
1810
|
+
.option('--since <iso>', 'Explicit window start (ISO timestamp; default: 7 days before the window end)')
|
|
1811
|
+
.option('--until <iso>', 'Explicit window end (ISO timestamp; default: now)')
|
|
1812
|
+
.option('--host <host>', 'Host identity to link', 'openclaw')
|
|
1813
|
+
.option('--max-invocations <n>', 'Maximum invocations emitted (default: 1000)')
|
|
1814
|
+
.option('--max-date-files <n>', 'Maximum date files read per log directory (default: 9)')
|
|
1815
|
+
.option('--max-file-bytes <n>', 'Maximum bytes read per file (default: 4194304)')
|
|
1816
|
+
.option('--max-event-lines <n>', 'Maximum EventLog lines parsed (default: 20000)')
|
|
1817
|
+
.option('--max-trajectory-rows <n>', 'Maximum trajectory rows read (default: 5000)')
|
|
1818
|
+
.option('--json', 'Output the JSON document (this read-only command always emits JSON)')
|
|
1819
|
+
.action(async (opts) => {
|
|
1820
|
+
await handleRuntimeActivationLink({
|
|
1821
|
+
workspace: opts.workspace,
|
|
1822
|
+
since: opts.since,
|
|
1823
|
+
until: opts.until,
|
|
1824
|
+
host: opts.host,
|
|
1825
|
+
json: opts.json,
|
|
1826
|
+
maxInvocations: opts.maxInvocations,
|
|
1827
|
+
maxDateFiles: opts.maxDateFiles,
|
|
1828
|
+
maxFileBytes: opts.maxFileBytes,
|
|
1829
|
+
maxEventLines: opts.maxEventLines,
|
|
1830
|
+
maxTrajectoryRows: opts.maxTrajectoryRows,
|
|
1831
|
+
});
|
|
1832
|
+
});
|
|
1833
|
+
}
|
|
1761
1834
|
//# sourceMappingURL=runtime-activation.js.map
|