create-principles-disciple 1.147.5 → 1.147.6
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 +1 -1
- package/codex-adapter/package.json +1 -1
- package/console/dist/server/models/HealthCheckModel.d.ts +0 -1
- package/console/dist/server/models/HealthCheckModel.js +0 -54
- package/console/dist/server/types/index.d.ts +1 -9
- package/console/dist/web/assets/app.js +18 -18
- package/core/dist/index.d.ts +1 -1
- package/core/dist/index.d.ts.map +1 -1
- package/core/dist/index.js +1 -1
- package/core/dist/index.js.map +1 -1
- package/core/dist/prompt-builder/index.d.ts +0 -1
- package/core/dist/prompt-builder/index.d.ts.map +1 -1
- package/core/dist/prompt-builder/index.js +0 -1
- package/core/dist/prompt-builder/index.js.map +1 -1
- package/core/dist/runtime-v2/adapter/output-schema-registry.js +2 -2
- package/core/dist/runtime-v2/control-plane-triage.d.ts +1 -1
- package/core/dist/runtime-v2/control-plane-triage.d.ts.map +1 -1
- package/core/dist/runtime-v2/control-plane-triage.js +0 -15
- package/core/dist/runtime-v2/control-plane-triage.js.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/observation-resolver.d.ts +3 -6
- package/core/dist/runtime-v2/evidence-triage/observation-resolver.d.ts.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/observation-resolver.js +5 -10
- package/core/dist/runtime-v2/evidence-triage/observation-resolver.js.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/source-descriptors.d.ts +2 -1
- package/core/dist/runtime-v2/evidence-triage/source-descriptors.d.ts.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/source-descriptors.js +3 -8
- package/core/dist/runtime-v2/evidence-triage/source-descriptors.js.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/types.d.ts +1 -1
- package/core/dist/runtime-v2/evidence-triage/types.d.ts.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/types.js +0 -1
- package/core/dist/runtime-v2/evidence-triage/types.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js +4 -1
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
- package/core/dist/runtime-v2/feature-flags/feature-flag-lifecycle.js +3 -8
- package/core/dist/runtime-v2/feature-flags/feature-flag-lifecycle.js.map +1 -1
- package/core/dist/runtime-v2/golden-trace.d.ts.map +1 -1
- package/core/dist/runtime-v2/golden-trace.js +0 -1
- package/core/dist/runtime-v2/golden-trace.js.map +1 -1
- package/core/dist/runtime-v2/index.d.ts +5 -9
- package/core/dist/runtime-v2/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/index.js +4 -8
- package/core/dist/runtime-v2/index.js.map +1 -1
- package/core/dist/runtime-v2/internalization/rule-host-contracts.d.ts +0 -1
- package/core/dist/runtime-v2/internalization/rule-host-contracts.d.ts.map +1 -1
- package/core/dist/runtime-v2/operator-health-read-model.d.ts +0 -2
- package/core/dist/runtime-v2/operator-health-read-model.d.ts.map +1 -1
- package/core/dist/runtime-v2/operator-health-read-model.js +1 -55
- package/core/dist/runtime-v2/operator-health-read-model.js.map +1 -1
- package/core/dist/runtime-v2/signal-collector/confidence-gate.d.ts +1 -5
- package/core/dist/runtime-v2/signal-collector/confidence-gate.d.ts.map +1 -1
- package/core/dist/runtime-v2/signal-collector/confidence-gate.js +0 -9
- package/core/dist/runtime-v2/signal-collector/confidence-gate.js.map +1 -1
- package/core/dist/runtime-v2/signal-collector/keyword-stage.d.ts +2 -2
- package/core/dist/runtime-v2/signal-collector/keyword-stage.d.ts.map +1 -1
- package/core/dist/runtime-v2/signal-collector/keyword-stage.js +6 -10
- package/core/dist/runtime-v2/signal-collector/keyword-stage.js.map +1 -1
- package/core/dist/runtime-v2/signal-collector/llm-stage.d.ts +1 -1
- package/core/dist/runtime-v2/signal-collector/llm-stage.d.ts.map +1 -1
- package/core/dist/runtime-v2/signal-collector/llm-stage.js +3 -4
- package/core/dist/runtime-v2/signal-collector/llm-stage.js.map +1 -1
- package/core/dist/runtime-v2/signal-collector/signal-collector.js +4 -4
- package/core/dist/runtime-v2/signal-collector/signal-collector.js.map +1 -1
- package/core/dist/runtime-v2/signal-collector/types.d.ts +6 -8
- package/core/dist/runtime-v2/signal-collector/types.d.ts.map +1 -1
- package/core/dist/runtime-v2/signal-collector/types.js +6 -6
- package/core/dist/runtime-v2/signal-collector/types.js.map +1 -1
- package/core/dist/runtime-v2/trajectory-schema.d.ts +24 -4
- package/core/dist/runtime-v2/trajectory-schema.d.ts.map +1 -1
- package/core/dist/runtime-v2/trajectory-schema.js +58 -2
- package/core/dist/runtime-v2/trajectory-schema.js.map +1 -1
- package/core/dist/runtime-v2/types/event-types.d.ts +0 -35
- package/core/dist/runtime-v2/types/event-types.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/event-types.js +0 -19
- package/core/dist/runtime-v2/types/event-types.js.map +1 -1
- package/core/dist/runtime-v2/types/index.d.ts +2 -2
- package/core/dist/runtime-v2/types/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/index.js +1 -1
- package/core/dist/runtime-v2/types/index.js.map +1 -1
- package/core/dist/trajectory-types.d.ts +0 -2
- package/core/dist/trajectory-types.d.ts.map +1 -1
- package/core/package.json +1 -1
- package/dist/mvp-config.d.ts +2 -2
- package/dist/mvp-config.d.ts.map +1 -1
- package/dist/mvp-config.js +4 -2
- package/dist/mvp-config.js.map +1 -1
- package/host-runtime/dist/governance-signal-admission.d.ts +0 -2
- package/host-runtime/dist/governance-signal-admission.js +14 -15
- package/host-runtime/dist/production-pain-evidence.d.ts +1 -1
- package/host-runtime/dist/production-pain-evidence.js +42 -7
- package/host-runtime/dist/production-rulehost-gate.d.ts +0 -1
- package/host-runtime/dist/production-rulehost-gate.js +3 -4
- package/host-runtime/dist/signal-classifier.d.ts +8 -0
- package/host-runtime/dist/signal-classifier.js +10 -2
- package/host-runtime/package.json +1 -1
- package/package.json +3 -3
- package/pd-cli/dist/commands/pain-evidence.d.ts +2 -4
- package/pd-cli/dist/commands/pain-evidence.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-evidence.js +2 -4
- package/pd-cli/dist/commands/pain-evidence.js.map +1 -1
- package/pd-cli/dist/commands/runtime-canary.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-canary.js +2 -68
- package/pd-cli/dist/commands/runtime-canary.js.map +1 -1
- package/pd-cli/dist/commands/runtime-diagnostics-export.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-diagnostics-export.js +1 -25
- package/pd-cli/dist/commands/runtime-diagnostics-export.js.map +1 -1
- package/pd-cli/dist/commands/runtime-health-snapshot.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-health-snapshot.js +0 -9
- package/pd-cli/dist/commands/runtime-health-snapshot.js.map +1 -1
- package/pd-cli/dist/index.js +0 -9
- package/pd-cli/dist/index.js.map +1 -1
- package/pd-mcp-server/dist/version.d.ts +1 -1
- package/pd-mcp-server/dist/version.js +1 -1
- package/pd-mcp-server/package.json +1 -1
- package/plugin/dist/bundle.js +492 -481
- package/plugin/dist/config/defaults/runtime.d.ts +0 -4
- package/plugin/dist/core/config.d.ts +0 -35
- package/plugin/dist/core/pain.d.ts +0 -1
- package/plugin/dist/core/session-tracker.d.ts +3 -51
- package/plugin/dist/core/signal-collector-host.d.ts +5 -13
- package/plugin/dist/core/signal-keyword-store.d.ts +2 -2
- package/plugin/dist/core/trajectory.d.ts +0 -2
- package/plugin/dist/governance-audit.js +2 -2
- package/plugin/dist/hooks/after-tool-call-helpers.d.ts +5 -12
- package/plugin/dist/hooks/after-tool-call-types.d.ts +0 -2
- package/plugin/dist/hooks/gate-block-helper.d.ts +1 -1
- package/plugin/dist/hooks/gate.d.ts +3 -4
- package/plugin/dist/hooks/pain.d.ts +4 -4
- package/plugin/dist/openclaw.plugin.json +1 -1
- package/plugin/dist/rulehost-evidence.js +45 -45
- package/plugin/dist/templates/pain_settings.json +0 -46
- package/plugin/dist/types/event-types.d.ts +1 -1
- package/plugin/openclaw.plugin.json +1 -1
- package/plugin/package.json +1 -1
- package/plugin/templates/pain_settings.json +0 -46
- package/release-manager/dist/mvp-config.js +4 -2
- package/release-manager/package.json +1 -1
- package/workbuddy-adapter/package.json +1 -1
- package/core/dist/prompt-builder/attitude-directive.d.ts +0 -7
- package/core/dist/prompt-builder/attitude-directive.d.ts.map +0 -1
- package/core/dist/prompt-builder/attitude-directive.js +0 -39
- package/core/dist/prompt-builder/attitude-directive.js.map +0 -1
- package/core/dist/runtime-v2/gfi/gfi-kernel.d.ts +0 -12
- package/core/dist/runtime-v2/gfi/gfi-kernel.d.ts.map +0 -1
- package/core/dist/runtime-v2/gfi/gfi-kernel.js +0 -148
- package/core/dist/runtime-v2/gfi/gfi-kernel.js.map +0 -1
- package/core/dist/runtime-v2/gfi/gfi-policy.d.ts +0 -3
- package/core/dist/runtime-v2/gfi/gfi-policy.d.ts.map +0 -1
- package/core/dist/runtime-v2/gfi/gfi-policy.js +0 -23
- package/core/dist/runtime-v2/gfi/gfi-policy.js.map +0 -1
- package/core/dist/runtime-v2/gfi/gfi-read-model.d.ts +0 -78
- package/core/dist/runtime-v2/gfi/gfi-read-model.d.ts.map +0 -1
- package/core/dist/runtime-v2/gfi/gfi-read-model.js +0 -129
- package/core/dist/runtime-v2/gfi/gfi-read-model.js.map +0 -1
- package/core/dist/runtime-v2/gfi/gfi-types.d.ts +0 -70
- package/core/dist/runtime-v2/gfi/gfi-types.d.ts.map +0 -1
- package/core/dist/runtime-v2/gfi/gfi-types.js +0 -2
- package/core/dist/runtime-v2/gfi/gfi-types.js.map +0 -1
- package/core/dist/runtime-v2/gfi/index.d.ts +0 -6
- package/core/dist/runtime-v2/gfi/index.d.ts.map +0 -1
- package/core/dist/runtime-v2/gfi/index.js +0 -4
- package/core/dist/runtime-v2/gfi/index.js.map +0 -1
- package/pd-cli/dist/commands/runtime-gfi-snapshot.d.ts +0 -7
- package/pd-cli/dist/commands/runtime-gfi-snapshot.d.ts.map +0 -1
- package/pd-cli/dist/commands/runtime-gfi-snapshot.js +0 -101
- package/pd-cli/dist/commands/runtime-gfi-snapshot.js.map +0 -1
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
export type GfiSource = 'tool_failure' | 'dispatch_error' | 'user_empathy' | 'manual_pain' | 'correction_cue' | 'llm_paralysis' | 'gate_block' | 'unknown';
|
|
2
|
-
export type GfiStage = 'stable' | 'elevated' | 'critical' | 'saturated';
|
|
3
|
-
export interface GfiState {
|
|
4
|
-
currentGfi: number;
|
|
5
|
-
/**
|
|
6
|
-
* Per-source GFI ledger. Invariant: when gfiBySource is non-empty,
|
|
7
|
-
* currentGfi MUST equal the sum of all source values (within rounding).
|
|
8
|
-
*
|
|
9
|
-
* Exception: after session restart or persistence boundary, gfiBySource
|
|
10
|
-
* may be empty while currentGfi > 0 (source ledger not persisted).
|
|
11
|
-
* In this state, applyDecay falls back to direct currentGfi decay
|
|
12
|
-
* using the stage rate until source events repopulate the ledger.
|
|
13
|
-
*/
|
|
14
|
-
gfiBySource: Partial<Record<GfiSource, number>>;
|
|
15
|
-
lastErrorHash?: string;
|
|
16
|
-
lastErrorSource?: string;
|
|
17
|
-
consecutiveErrors: number;
|
|
18
|
-
lastGfiDecayAt?: number;
|
|
19
|
-
dailyGfiPeak?: number;
|
|
20
|
-
}
|
|
21
|
-
export interface GfiPolicy {
|
|
22
|
-
stageThresholds: {
|
|
23
|
-
elevated: number;
|
|
24
|
-
critical: number;
|
|
25
|
-
saturated: number;
|
|
26
|
-
};
|
|
27
|
-
repeatedFailureMultiplier: {
|
|
28
|
-
base: number;
|
|
29
|
-
max: number;
|
|
30
|
-
};
|
|
31
|
-
decayRatesPerMinute: {
|
|
32
|
-
stable: number;
|
|
33
|
-
elevated: number;
|
|
34
|
-
critical: number;
|
|
35
|
-
saturated: number;
|
|
36
|
-
};
|
|
37
|
-
relief: {
|
|
38
|
-
toolSuccessRatio: number;
|
|
39
|
-
minPruneBelow: number;
|
|
40
|
-
};
|
|
41
|
-
sourceWeights: Partial<Record<GfiSource, number>>;
|
|
42
|
-
}
|
|
43
|
-
export interface GfiEvent {
|
|
44
|
-
source: GfiSource;
|
|
45
|
-
baseScore: number;
|
|
46
|
-
hash?: string;
|
|
47
|
-
at?: number;
|
|
48
|
-
detail?: string;
|
|
49
|
-
}
|
|
50
|
-
export interface GfiSnapshot {
|
|
51
|
-
currentGfi: number;
|
|
52
|
-
stage: GfiStage;
|
|
53
|
-
sources: Partial<Record<GfiSource, number>>;
|
|
54
|
-
dominantSource: string | null;
|
|
55
|
-
consecutiveErrors: number;
|
|
56
|
-
lastErrorSource?: string;
|
|
57
|
-
lastDecayAt?: string;
|
|
58
|
-
dailyGfiPeak?: number;
|
|
59
|
-
policy: {
|
|
60
|
-
elevatedThreshold: number;
|
|
61
|
-
criticalThreshold: number;
|
|
62
|
-
saturatedThreshold: number;
|
|
63
|
-
repeatedFailureMultiplierMax: number;
|
|
64
|
-
};
|
|
65
|
-
consumers: {
|
|
66
|
-
attitudeMode: 'efficient' | 'conciliatory' | 'humble_recovery';
|
|
67
|
-
painDiagnosticReason: 'none' | 'high_gfi';
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=gfi-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gfi-types.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/gfi/gfi-types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,cAAc,GACd,gBAAgB,GAChB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,eAAe,GACf,YAAY,GACZ,SAAS,CAAC;AAEd,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,CAAC;AAExE,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;;;OA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AAI,CAAC;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE;QACN,iBAAiB,EAAE,MAAM,CAAC;QAC1B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,4BAA4B,EAAE,MAAM,CAAC;KACtC,CAAC;IACF,SAAS,EAAE;QACT,YAAY,EAAE,WAAW,GAAG,cAAc,GAAG,iBAAiB,CAAC;QAC/D,oBAAoB,EAAE,MAAM,GAAG,UAAU,CAAC;KAC3C,CAAC;CACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gfi-types.js","sourceRoot":"","sources":["../../../src/runtime-v2/gfi/gfi-types.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { DEFAULT_GFI_POLICY } from './gfi-policy.js';
|
|
2
|
-
export { applyFriction, applyDecay, applyRelief, classifyGfiStage, createGfiSnapshot, } from './gfi-kernel.js';
|
|
3
|
-
export { buildGfiWorkspaceSnapshot, classifyGfiWorkspaceHealth } from './gfi-read-model.js';
|
|
4
|
-
export type { GfiState, GfiEvent, GfiPolicy, GfiStage, GfiSource, GfiSnapshot, } from './gfi-types.js';
|
|
5
|
-
export type { GfiReadModelInput, GfiWorkspaceSnapshot, GfiWorkspaceHealthAssessment } from './gfi-read-model.js';
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/gfi/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EACL,aAAa,EACb,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAE5F,YAAY,EACV,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,GACZ,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { DEFAULT_GFI_POLICY } from './gfi-policy.js';
|
|
2
|
-
export { applyFriction, applyDecay, applyRelief, classifyGfiStage, createGfiSnapshot, } from './gfi-kernel.js';
|
|
3
|
-
export { buildGfiWorkspaceSnapshot, classifyGfiWorkspaceHealth } from './gfi-read-model.js';
|
|
4
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime-v2/gfi/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EACL,aAAa,EACb,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-gfi-snapshot.d.ts","sourceRoot":"","sources":["../../src/commands/runtime-gfi-snapshot.ts"],"names":[],"mappings":"AAkBA,UAAU,kBAAkB;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAgGD,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBtF"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* pd runtime gfi snapshot command — GFI workspace snapshot for Runtime V2.
|
|
3
|
-
*
|
|
4
|
-
* Usage:
|
|
5
|
-
* pd runtime gfi snapshot --workspace <path> --json
|
|
6
|
-
* pd runtime health gfi --workspace <path> --json (alias)
|
|
7
|
-
*
|
|
8
|
-
* Shows active vs stale session breakdown for GFI visibility.
|
|
9
|
-
* Stale sessions (>2h inactive) do NOT influence the active snapshot.
|
|
10
|
-
*
|
|
11
|
-
* PRI-78/PRI-82: GFI Observability
|
|
12
|
-
*/
|
|
13
|
-
import * as path from 'path';
|
|
14
|
-
import * as fs from 'fs';
|
|
15
|
-
import { buildGfiWorkspaceSnapshot } from '@principles/core/runtime-v2';
|
|
16
|
-
import { resolveWorkspaceDir } from '../resolve-workspace.js';
|
|
17
|
-
function formatTextOutput(snapshot) {
|
|
18
|
-
const lines = [];
|
|
19
|
-
lines.push('GFI Workspace Snapshot');
|
|
20
|
-
lines.push(`generatedAt: ${snapshot.generatedAt}`);
|
|
21
|
-
lines.push('');
|
|
22
|
-
if (snapshot.active) {
|
|
23
|
-
const a = snapshot.active;
|
|
24
|
-
lines.push('ACTIVE SESSION');
|
|
25
|
-
lines.push(` currentGfi: ${a.currentGfi} stage: ${a.stage}`);
|
|
26
|
-
lines.push(` dominantSource: ${a.dominantSource ?? '(none)'}`);
|
|
27
|
-
lines.push(` consecutiveErrors: ${a.consecutiveErrors}`);
|
|
28
|
-
lines.push(` dailyGfiPeak: ${a.dailyGfiPeak ?? '(none)'}`);
|
|
29
|
-
lines.push(` attitudeMode: ${a.consumers.attitudeMode}`);
|
|
30
|
-
lines.push(` painDiagnosticReason: ${a.consumers.painDiagnosticReason}`);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
lines.push('ACTIVE SESSION: (none)');
|
|
34
|
-
}
|
|
35
|
-
lines.push('');
|
|
36
|
-
if (snapshot.staleSessionCount > 0 && snapshot.staleGfiRange) {
|
|
37
|
-
lines.push(`STALE SESSIONS: ${snapshot.staleSessionCount} session(s)` +
|
|
38
|
-
` (GFI range: ${snapshot.staleGfiRange.min}-${snapshot.staleGfiRange.max})`);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
lines.push('STALE SESSIONS: 0');
|
|
42
|
-
}
|
|
43
|
-
lines.push('');
|
|
44
|
-
lines.push(`TOTAL: ${snapshot.totalSessionCount} session(s) (${snapshot.activeSessionCount} active)`);
|
|
45
|
-
return lines.join('\n');
|
|
46
|
-
}
|
|
47
|
-
function readPersistedSessions(workspaceDir) {
|
|
48
|
-
const sessionDir = path.join(workspaceDir, '.state', 'sessions');
|
|
49
|
-
if (!fs.existsSync(sessionDir)) {
|
|
50
|
-
return [];
|
|
51
|
-
}
|
|
52
|
-
const sessions = [];
|
|
53
|
-
let skippedCount = 0;
|
|
54
|
-
for (const file of fs.readdirSync(sessionDir)) {
|
|
55
|
-
if (!file.endsWith('.json'))
|
|
56
|
-
continue;
|
|
57
|
-
try {
|
|
58
|
-
const raw = fs.readFileSync(path.join(sessionDir, file), 'utf8');
|
|
59
|
-
const parsed = JSON.parse(raw);
|
|
60
|
-
if (parsed?.sessionId) {
|
|
61
|
-
sessions.push({
|
|
62
|
-
sessionId: parsed.sessionId ?? file.replace('.json', ''),
|
|
63
|
-
currentGfi: parsed.currentGfi ?? 0,
|
|
64
|
-
gfiBySource: parsed.gfiBySource,
|
|
65
|
-
lastErrorSource: parsed.lastErrorSource,
|
|
66
|
-
consecutiveErrors: parsed.consecutiveErrors ?? 0,
|
|
67
|
-
lastGfiDecayAt: parsed.lastGfiDecayAt,
|
|
68
|
-
dailyGfiPeak: parsed.dailyGfiPeak,
|
|
69
|
-
lastActivityAt: parsed.lastActivityAt ?? parsed.lastControlActivityAt ?? 0,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
skippedCount++;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
catch {
|
|
77
|
-
skippedCount++;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
if (skippedCount > 0) {
|
|
81
|
-
console.warn(`[runtime-gfi-snapshot] Skipped ${skippedCount} malformed session file(s)`);
|
|
82
|
-
}
|
|
83
|
-
return sessions;
|
|
84
|
-
}
|
|
85
|
-
export async function handleRuntimeGfiSnapshot(opts) {
|
|
86
|
-
const workspaceDir = opts.workspace
|
|
87
|
-
? path.resolve(opts.workspace)
|
|
88
|
-
: resolveWorkspaceDir();
|
|
89
|
-
const sessions = readPersistedSessions(workspaceDir);
|
|
90
|
-
const snapshot = buildGfiWorkspaceSnapshot({
|
|
91
|
-
sessions,
|
|
92
|
-
nowMs: Date.now(),
|
|
93
|
-
});
|
|
94
|
-
if (opts.json) {
|
|
95
|
-
console.log(JSON.stringify(snapshot, null, 2));
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
console.log(formatTextOutput(snapshot));
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
//# sourceMappingURL=runtime-gfi-snapshot.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-gfi-snapshot.js","sourceRoot":"","sources":["../../src/commands/runtime-gfi-snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAO9D,SAAS,gBAAgB,CAAC,QAA8B;IACtD,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IACrC,KAAK,CAAC,IAAI,CAAC,gBAAgB,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;IACnD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,IAAI,QAAQ,CAAC,MA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