create-principles-disciple 1.147.5 → 1.147.7

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.
Files changed (184) hide show
  1. package/_release/product-identity.json +1 -1
  2. package/codex-adapter/package.json +1 -1
  3. package/console/dist/server/models/HealthCheckModel.d.ts +0 -1
  4. package/console/dist/server/models/HealthCheckModel.js +0 -54
  5. package/console/dist/server/types/index.d.ts +1 -9
  6. package/console/dist/web/assets/app.js +18 -18
  7. package/core/dist/index.d.ts +1 -1
  8. package/core/dist/index.d.ts.map +1 -1
  9. package/core/dist/index.js +1 -1
  10. package/core/dist/index.js.map +1 -1
  11. package/core/dist/prompt-builder/index.d.ts +0 -1
  12. package/core/dist/prompt-builder/index.d.ts.map +1 -1
  13. package/core/dist/prompt-builder/index.js +0 -1
  14. package/core/dist/prompt-builder/index.js.map +1 -1
  15. package/core/dist/runtime-v2/adapter/output-schema-registry.js +2 -2
  16. package/core/dist/runtime-v2/control-plane-triage.d.ts +1 -1
  17. package/core/dist/runtime-v2/control-plane-triage.d.ts.map +1 -1
  18. package/core/dist/runtime-v2/control-plane-triage.js +0 -15
  19. package/core/dist/runtime-v2/control-plane-triage.js.map +1 -1
  20. package/core/dist/runtime-v2/evidence-triage/observation-resolver.d.ts +3 -6
  21. package/core/dist/runtime-v2/evidence-triage/observation-resolver.d.ts.map +1 -1
  22. package/core/dist/runtime-v2/evidence-triage/observation-resolver.js +5 -10
  23. package/core/dist/runtime-v2/evidence-triage/observation-resolver.js.map +1 -1
  24. package/core/dist/runtime-v2/evidence-triage/source-descriptors.d.ts +2 -1
  25. package/core/dist/runtime-v2/evidence-triage/source-descriptors.d.ts.map +1 -1
  26. package/core/dist/runtime-v2/evidence-triage/source-descriptors.js +3 -8
  27. package/core/dist/runtime-v2/evidence-triage/source-descriptors.js.map +1 -1
  28. package/core/dist/runtime-v2/evidence-triage/types.d.ts +1 -1
  29. package/core/dist/runtime-v2/evidence-triage/types.d.ts.map +1 -1
  30. package/core/dist/runtime-v2/evidence-triage/types.js +0 -1
  31. package/core/dist/runtime-v2/evidence-triage/types.js.map +1 -1
  32. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
  33. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js +4 -1
  34. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
  35. package/core/dist/runtime-v2/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
  36. package/core/dist/runtime-v2/feature-flags/feature-flag-lifecycle.js +3 -8
  37. package/core/dist/runtime-v2/feature-flags/feature-flag-lifecycle.js.map +1 -1
  38. package/core/dist/runtime-v2/golden-trace.d.ts.map +1 -1
  39. package/core/dist/runtime-v2/golden-trace.js +0 -1
  40. package/core/dist/runtime-v2/golden-trace.js.map +1 -1
  41. package/core/dist/runtime-v2/index.d.ts +5 -9
  42. package/core/dist/runtime-v2/index.d.ts.map +1 -1
  43. package/core/dist/runtime-v2/index.js +4 -8
  44. package/core/dist/runtime-v2/index.js.map +1 -1
  45. package/core/dist/runtime-v2/internalization/artificer-run-correlation.d.ts +1 -1
  46. package/core/dist/runtime-v2/internalization/artificer-run-correlation.js +1 -1
  47. package/core/dist/runtime-v2/internalization/consumer-evidence-preflight.d.ts +1 -1
  48. package/core/dist/runtime-v2/internalization/evidence-readiness.js +1 -1
  49. package/core/dist/runtime-v2/internalization/owner-evidence-recovery.d.ts +1 -1
  50. package/core/dist/runtime-v2/internalization/rule-host-contracts.d.ts +0 -1
  51. package/core/dist/runtime-v2/internalization/rule-host-contracts.d.ts.map +1 -1
  52. package/core/dist/runtime-v2/operator-health-read-model.d.ts +0 -2
  53. package/core/dist/runtime-v2/operator-health-read-model.d.ts.map +1 -1
  54. package/core/dist/runtime-v2/operator-health-read-model.js +1 -55
  55. package/core/dist/runtime-v2/operator-health-read-model.js.map +1 -1
  56. package/core/dist/runtime-v2/principle-reuse/reuse-domain.d.ts +1 -1
  57. package/core/dist/runtime-v2/principle-reuse/reuse-domain.js +1 -1
  58. package/core/dist/runtime-v2/principle-reuse/reuse-proposal.d.ts +1 -1
  59. package/core/dist/runtime-v2/principle-reuse/reuse-proposal.js +1 -1
  60. package/core/dist/runtime-v2/principle-reuse/reuse-retrieval.d.ts +1 -1
  61. package/core/dist/runtime-v2/principle-reuse/reuse-retrieval.js +1 -1
  62. package/core/dist/runtime-v2/signal-collector/confidence-gate.d.ts +1 -5
  63. package/core/dist/runtime-v2/signal-collector/confidence-gate.d.ts.map +1 -1
  64. package/core/dist/runtime-v2/signal-collector/confidence-gate.js +0 -9
  65. package/core/dist/runtime-v2/signal-collector/confidence-gate.js.map +1 -1
  66. package/core/dist/runtime-v2/signal-collector/keyword-stage.d.ts +2 -2
  67. package/core/dist/runtime-v2/signal-collector/keyword-stage.d.ts.map +1 -1
  68. package/core/dist/runtime-v2/signal-collector/keyword-stage.js +6 -10
  69. package/core/dist/runtime-v2/signal-collector/keyword-stage.js.map +1 -1
  70. package/core/dist/runtime-v2/signal-collector/llm-stage.d.ts +1 -1
  71. package/core/dist/runtime-v2/signal-collector/llm-stage.d.ts.map +1 -1
  72. package/core/dist/runtime-v2/signal-collector/llm-stage.js +3 -4
  73. package/core/dist/runtime-v2/signal-collector/llm-stage.js.map +1 -1
  74. package/core/dist/runtime-v2/signal-collector/signal-collector.js +4 -4
  75. package/core/dist/runtime-v2/signal-collector/signal-collector.js.map +1 -1
  76. package/core/dist/runtime-v2/signal-collector/types.d.ts +6 -8
  77. package/core/dist/runtime-v2/signal-collector/types.d.ts.map +1 -1
  78. package/core/dist/runtime-v2/signal-collector/types.js +6 -6
  79. package/core/dist/runtime-v2/signal-collector/types.js.map +1 -1
  80. package/core/dist/runtime-v2/trajectory-schema.d.ts +25 -5
  81. package/core/dist/runtime-v2/trajectory-schema.d.ts.map +1 -1
  82. package/core/dist/runtime-v2/trajectory-schema.js +58 -2
  83. package/core/dist/runtime-v2/trajectory-schema.js.map +1 -1
  84. package/core/dist/runtime-v2/types/event-types.d.ts +0 -35
  85. package/core/dist/runtime-v2/types/event-types.d.ts.map +1 -1
  86. package/core/dist/runtime-v2/types/event-types.js +0 -19
  87. package/core/dist/runtime-v2/types/event-types.js.map +1 -1
  88. package/core/dist/runtime-v2/types/index.d.ts +2 -2
  89. package/core/dist/runtime-v2/types/index.d.ts.map +1 -1
  90. package/core/dist/runtime-v2/types/index.js +1 -1
  91. package/core/dist/runtime-v2/types/index.js.map +1 -1
  92. package/core/dist/trajectory-types.d.ts +0 -2
  93. package/core/dist/trajectory-types.d.ts.map +1 -1
  94. package/core/package.json +1 -1
  95. package/dist/installer.d.ts +0 -7
  96. package/dist/installer.d.ts.map +1 -1
  97. package/dist/installer.js +112 -28
  98. package/dist/installer.js.map +1 -1
  99. package/dist/mvp-config.d.ts +2 -2
  100. package/dist/mvp-config.d.ts.map +1 -1
  101. package/dist/mvp-config.js +4 -2
  102. package/dist/mvp-config.js.map +1 -1
  103. package/host-runtime/dist/governance-signal-admission.d.ts +0 -2
  104. package/host-runtime/dist/governance-signal-admission.js +14 -15
  105. package/host-runtime/dist/production-pain-evidence.d.ts +1 -1
  106. package/host-runtime/dist/production-pain-evidence.js +42 -7
  107. package/host-runtime/dist/production-rulehost-gate.d.ts +0 -1
  108. package/host-runtime/dist/production-rulehost-gate.js +3 -4
  109. package/host-runtime/dist/signal-classifier.d.ts +8 -0
  110. package/host-runtime/dist/signal-classifier.js +10 -2
  111. package/host-runtime/package.json +1 -1
  112. package/package.json +3 -3
  113. package/pd-cli/dist/commands/pain-evidence.d.ts +2 -4
  114. package/pd-cli/dist/commands/pain-evidence.d.ts.map +1 -1
  115. package/pd-cli/dist/commands/pain-evidence.js +2 -4
  116. package/pd-cli/dist/commands/pain-evidence.js.map +1 -1
  117. package/pd-cli/dist/commands/runtime-canary.d.ts.map +1 -1
  118. package/pd-cli/dist/commands/runtime-canary.js +2 -68
  119. package/pd-cli/dist/commands/runtime-canary.js.map +1 -1
  120. package/pd-cli/dist/commands/runtime-diagnostics-export.d.ts.map +1 -1
  121. package/pd-cli/dist/commands/runtime-diagnostics-export.js +1 -25
  122. package/pd-cli/dist/commands/runtime-diagnostics-export.js.map +1 -1
  123. package/pd-cli/dist/commands/runtime-health-snapshot.d.ts.map +1 -1
  124. package/pd-cli/dist/commands/runtime-health-snapshot.js +0 -9
  125. package/pd-cli/dist/commands/runtime-health-snapshot.js.map +1 -1
  126. package/pd-cli/dist/index.js +0 -9
  127. package/pd-cli/dist/index.js.map +1 -1
  128. package/pd-cli/package.json +1 -1
  129. package/pd-mcp-server/dist/version.d.ts +1 -1
  130. package/pd-mcp-server/dist/version.js +1 -1
  131. package/pd-mcp-server/package.json +1 -1
  132. package/plugin/dist/bundle.js +492 -481
  133. package/plugin/dist/config/defaults/runtime.d.ts +0 -4
  134. package/plugin/dist/core/config.d.ts +0 -35
  135. package/plugin/dist/core/pain.d.ts +0 -1
  136. package/plugin/dist/core/session-tracker.d.ts +3 -51
  137. package/plugin/dist/core/signal-collector-host.d.ts +5 -13
  138. package/plugin/dist/core/signal-keyword-store.d.ts +2 -2
  139. package/plugin/dist/core/trajectory.d.ts +0 -2
  140. package/plugin/dist/governance-audit.js +2 -2
  141. package/plugin/dist/hooks/after-tool-call-helpers.d.ts +5 -12
  142. package/plugin/dist/hooks/after-tool-call-types.d.ts +0 -2
  143. package/plugin/dist/hooks/gate-block-helper.d.ts +1 -1
  144. package/plugin/dist/hooks/gate.d.ts +3 -4
  145. package/plugin/dist/hooks/pain.d.ts +4 -4
  146. package/plugin/dist/openclaw.plugin.json +1 -1
  147. package/plugin/dist/rulehost-evidence.js +45 -45
  148. package/plugin/dist/templates/pain_settings.json +0 -46
  149. package/plugin/dist/types/event-types.d.ts +1 -1
  150. package/plugin/openclaw.plugin.json +1 -1
  151. package/plugin/package.json +1 -1
  152. package/plugin/templates/pain_settings.json +0 -46
  153. package/release-manager/dist/installer.js +112 -28
  154. package/release-manager/dist/mvp-config.js +4 -2
  155. package/release-manager/package.json +1 -1
  156. package/workbuddy-adapter/package.json +1 -1
  157. package/core/dist/prompt-builder/attitude-directive.d.ts +0 -7
  158. package/core/dist/prompt-builder/attitude-directive.d.ts.map +0 -1
  159. package/core/dist/prompt-builder/attitude-directive.js +0 -39
  160. package/core/dist/prompt-builder/attitude-directive.js.map +0 -1
  161. package/core/dist/runtime-v2/gfi/gfi-kernel.d.ts +0 -12
  162. package/core/dist/runtime-v2/gfi/gfi-kernel.d.ts.map +0 -1
  163. package/core/dist/runtime-v2/gfi/gfi-kernel.js +0 -148
  164. package/core/dist/runtime-v2/gfi/gfi-kernel.js.map +0 -1
  165. package/core/dist/runtime-v2/gfi/gfi-policy.d.ts +0 -3
  166. package/core/dist/runtime-v2/gfi/gfi-policy.d.ts.map +0 -1
  167. package/core/dist/runtime-v2/gfi/gfi-policy.js +0 -23
  168. package/core/dist/runtime-v2/gfi/gfi-policy.js.map +0 -1
  169. package/core/dist/runtime-v2/gfi/gfi-read-model.d.ts +0 -78
  170. package/core/dist/runtime-v2/gfi/gfi-read-model.d.ts.map +0 -1
  171. package/core/dist/runtime-v2/gfi/gfi-read-model.js +0 -129
  172. package/core/dist/runtime-v2/gfi/gfi-read-model.js.map +0 -1
  173. package/core/dist/runtime-v2/gfi/gfi-types.d.ts +0 -70
  174. package/core/dist/runtime-v2/gfi/gfi-types.d.ts.map +0 -1
  175. package/core/dist/runtime-v2/gfi/gfi-types.js +0 -2
  176. package/core/dist/runtime-v2/gfi/gfi-types.js.map +0 -1
  177. package/core/dist/runtime-v2/gfi/index.d.ts +0 -6
  178. package/core/dist/runtime-v2/gfi/index.d.ts.map +0 -1
  179. package/core/dist/runtime-v2/gfi/index.js +0 -4
  180. package/core/dist/runtime-v2/gfi/index.js.map +0 -1
  181. package/pd-cli/dist/commands/runtime-gfi-snapshot.d.ts +0 -7
  182. package/pd-cli/dist/commands/runtime-gfi-snapshot.d.ts.map +0 -1
  183. package/pd-cli/dist/commands/runtime-gfi-snapshot.js +0 -101
  184. package/pd-cli/dist/commands/runtime-gfi-snapshot.js.map +0 -1
@@ -1,2 +1,2 @@
1
- export type { EventType, EventCategory, EventLogEntry, ToolCallEventData, PainSignalEventData, RulePromotionEventData, GovernanceActionEventData, HookExecutionEventData, GateBlockEventData, GateBypassEventData, EvolutionTaskEventData, EmpathyRollbackEventData, HeartbeatDiagnosisEventData, DiagnosisTaskEventData, DiagnosticianReportEventData, PrincipleCandidateEventData, RuleEnforcedEventData, RuleHostEvaluatedEventData, RuleHostBlockedEventData, RuleHostRequireApprovalEventData, RuleHostAutoCorrectProposedEventData, RuleHostAutoCorrectAppliedEventData, RuntimeV2PromptActivationsInjectedEventData, RuleHostUnhealthyEventData, RuleHostSkippedEventData, TrajectoryObservabilityFailureEventData, ToolCallStats, ErrorStats, EmpathyEventStats, GfiStats, HookStats, DailyStats, } from '@principles/core/runtime-v2';
1
+ export type { EventType, EventCategory, EventLogEntry, ToolCallEventData, PainSignalEventData, RulePromotionEventData, GovernanceActionEventData, HookExecutionEventData, GateBlockEventData, GateBypassEventData, EvolutionTaskEventData, EmpathyRollbackEventData, HeartbeatDiagnosisEventData, DiagnosisTaskEventData, DiagnosticianReportEventData, PrincipleCandidateEventData, RuleEnforcedEventData, RuleHostEvaluatedEventData, RuleHostBlockedEventData, RuleHostRequireApprovalEventData, RuleHostAutoCorrectProposedEventData, RuleHostAutoCorrectAppliedEventData, RuntimeV2PromptActivationsInjectedEventData, RuleHostUnhealthyEventData, RuleHostSkippedEventData, TrajectoryObservabilityFailureEventData, ToolCallStats, ErrorStats, EmpathyEventStats, HookStats, DailyStats, } from '@principles/core/runtime-v2';
2
2
  export { createEmptyDailyStats, } from '@principles/core/runtime-v2/types/event-types';
@@ -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.5.0",
5
+ "version": "2.6.0",
6
6
  "activation": {
7
7
  "onStartup": true,
8
8
  "onCapabilities": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "principles-disciple",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
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
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "language": "zh",
3
3
  "thresholds": {
4
- "pain_trigger": 40,
5
4
  "cognitive_paralysis_input": 4000,
6
5
  "semantic_min_score": 0.7,
7
6
  "promotion_count_threshold": 3,
@@ -10,18 +9,12 @@
10
9
  "scores": {
11
10
  "default_confusion": 30,
12
11
  "default_loop": 40,
13
- "tool_failure_friction": 15,
14
12
  "exit_code_penalty": 50,
15
13
  "spiral_penalty": 30,
16
14
  "missing_test_command_penalty": 20,
17
15
  "subagent_error_penalty": 60,
18
16
  "subagent_timeout_penalty": 50
19
17
  },
20
- "severity_thresholds": {
21
- "high": 70,
22
- "medium": 40,
23
- "low": 20
24
- },
25
18
  "trust": {
26
19
  "stages": {
27
20
  "stage_1_observer": 30,
@@ -52,44 +45,5 @@
52
45
  "stage_2_max_lines": 50,
53
46
  "stage_3_max_lines": 300
54
47
  }
55
- },
56
- "empathy_engine": {
57
- "enabled": true,
58
- "dedupe_window_ms": 60000,
59
- "penalties": {
60
- "mild": 10,
61
- "moderate": 25,
62
- "severe": 40
63
- },
64
- "rate_limit": {
65
- "max_per_turn": 40,
66
- "max_per_hour": 120
67
- },
68
- "model_calibration": {}
69
- },
70
- "gfi_gate": {
71
- "enabled": true,
72
- "thresholds": {
73
- "low_risk_block": 70,
74
- "high_risk_block": 40,
75
- "large_change_block": 50
76
- },
77
- "large_change_lines": 50,
78
- "bash_safe_patterns": [
79
- "^(ls|dir|pwd|which|where|echo|env|cat|type|head|tail|less|more)\\b",
80
- "^git\\s+(status|log|diff|branch|show|remote)\\b",
81
- "^npm\\s+(run|test|build|start)\\b",
82
- "^(make|gradle|mvn)\\b"
83
- ],
84
- "bash_dangerous_patterns": [
85
- "rm\\s+(-[a-z]*r[a-z]*f|-rf)",
86
- "del\\s+/s",
87
- "rmdir\\s+/s",
88
- "git\\s+(push\\s+.*--force|reset\\s+--hard|clean\\s+-fd)",
89
- "npm\\s+publish",
90
- "pip\\s+upload",
91
- "docker\\s+push",
92
- "(curl|wget).*\\|\\s*(ba)?sh"
93
- ]
94
48
  }
95
49
  }
@@ -1553,6 +1553,11 @@ export async function checkBuiltPlugin(pluginDir) {
1553
1553
  }
1554
1554
  }
1555
1555
  }
1556
+ function filesystemErrorCode(error) {
1557
+ if (typeof error !== 'object' || error === null || !Object.hasOwn(error, 'code'))
1558
+ return undefined;
1559
+ return error.code;
1560
+ }
1556
1561
  /**
1557
1562
  * PRI-1102: a target that exists as a DANGLING link (an interrupted install
1558
1563
  * left a reparse point whose target is gone) is not a directory the installer
@@ -1574,14 +1579,23 @@ export async function preparePluginInstallTarget(targetDir) {
1574
1579
  throw new Error(`Cannot inspect plugin install target ${targetDir}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
1575
1580
  }
1576
1581
  if (stats !== undefined && stats.isSymbolicLink()) {
1577
- let resolves = true;
1582
+ let targetAbsent = false;
1578
1583
  try {
1579
1584
  realpathSync(targetDir);
1580
1585
  }
1581
- catch {
1582
- resolves = false;
1586
+ catch (error) {
1587
+ const code = filesystemErrorCode(error);
1588
+ if (code !== 'ENOENT' && code !== 'ENOTDIR') {
1589
+ // EACCES/EPERM/... means the link target may still be a live install
1590
+ // this process cannot read. Removing the link would destroy it, so
1591
+ // fail closed and let the caller report the refusal.
1592
+ throw new Error(`Cannot resolve plugin install target ${targetDir}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
1593
+ }
1594
+ // Confirmed absent target (ENOENT/ENOTDIR) — the link itself is the
1595
+ // residue of an interrupted install.
1596
+ targetAbsent = true;
1583
1597
  }
1584
- if (!resolves) {
1598
+ if (targetAbsent) {
1585
1599
  // fs-extra's remove unlinks the reparse point instead of traversing it.
1586
1600
  await fse.remove(targetDir);
1587
1601
  logger.warn(`Removed dangling link at ${targetDir} (target missing) — rebuilding the plugin install directory.`);
@@ -1589,35 +1603,105 @@ export async function preparePluginInstallTarget(targetDir) {
1589
1603
  }
1590
1604
  await fse.ensureDir(targetDir);
1591
1605
  }
1592
- /**
1593
- * PRI-1102: a rollback is only as good as the state it returns to. The
1594
- * pre-run state can itself be incomplete (a component directory the previous
1595
- * run never finished, a link whose target is gone), so "restored" must not be
1596
- * reported as a healthy install without checking what the restored paths
1597
- * actually resolve to.
1598
- */
1599
- export function describeRestoredStateGaps() {
1600
- const gaps = [];
1601
- for (const dir of [getPluginExtDir(), getPdRuntimeDir()]) {
1602
- let stats;
1606
+ function restoredTreeRequirements() {
1607
+ return [
1608
+ // The runtime root itself (type + link resolution only).
1609
+ { dir: getPdRuntimeDir(), entries: [], openClawOnly: false },
1610
+ {
1611
+ dir: getInstalledConsoleDir(),
1612
+ entries: [path.join('dist', 'server.js'), path.join('dist', 'web', 'index.html')],
1613
+ openClawOnly: false,
1614
+ },
1615
+ { dir: getInstalledPdCliDir(), entries: [path.join('dist', 'index.js')], openClawOnly: false },
1616
+ { dir: getInstalledPluginDir(), entries: [path.join('dist', 'bundle.js'), 'openclaw.plugin.json'], openClawOnly: false },
1617
+ {
1618
+ dir: getPluginExtDir(),
1619
+ entries: [path.join('dist', 'bundle.js'), 'openclaw.plugin.json', 'package.json'],
1620
+ openClawOnly: true,
1621
+ },
1622
+ ];
1623
+ }
1624
+ function describeRestoredDirGap(dir, gaps) {
1625
+ let stats;
1626
+ try {
1627
+ stats = lstatSync(dir, { throwIfNoEntry: false });
1628
+ }
1629
+ catch (error) {
1630
+ gaps.push(`${dir} (unreadable: ${error instanceof Error ? error.message : String(error)})`);
1631
+ return false;
1632
+ }
1633
+ if (stats === undefined) {
1634
+ gaps.push(`${dir} (missing)`);
1635
+ return false;
1636
+ }
1637
+ if (stats.isSymbolicLink()) {
1603
1638
  try {
1604
- stats = lstatSync(dir, { throwIfNoEntry: false });
1639
+ realpathSync(dir);
1605
1640
  }
1606
1641
  catch (error) {
1607
- gaps.push(`${dir} (unreadable: ${error instanceof Error ? error.message : String(error)})`);
1608
- continue;
1642
+ const code = filesystemErrorCode(error);
1643
+ gaps.push(`${dir} (${code === 'ENOENT' || code === 'ENOTDIR' ? 'dangling link' : 'unresolvable link'})`);
1644
+ return false;
1609
1645
  }
1610
- if (stats === undefined) {
1611
- gaps.push(`${dir} (missing)`);
1612
- continue;
1646
+ }
1647
+ else if (!stats.isDirectory()) {
1648
+ gaps.push(`${dir} (not a directory)`);
1649
+ return false;
1650
+ }
1651
+ return true;
1652
+ }
1653
+ function describeRestoredEntryGap(entry, gaps) {
1654
+ let stats;
1655
+ try {
1656
+ stats = lstatSync(entry, { throwIfNoEntry: false });
1657
+ }
1658
+ catch (error) {
1659
+ gaps.push(`${entry} (unreadable: ${error instanceof Error ? error.message : String(error)})`);
1660
+ return;
1661
+ }
1662
+ if (stats === undefined) {
1663
+ gaps.push(`${entry} (missing)`);
1664
+ return;
1665
+ }
1666
+ if (stats.isSymbolicLink()) {
1667
+ try {
1668
+ realpathSync(entry);
1613
1669
  }
1614
- if (stats.isSymbolicLink()) {
1615
- try {
1616
- realpathSync(dir);
1617
- }
1618
- catch {
1619
- gaps.push(`${dir} (dangling link)`);
1620
- }
1670
+ catch (error) {
1671
+ const code = filesystemErrorCode(error);
1672
+ gaps.push(`${entry} (${code === 'ENOENT' || code === 'ENOTDIR' ? 'dangling link' : 'unresolvable link'})`);
1673
+ return;
1674
+ }
1675
+ // realpath only proves the target EXISTS. The entry is consumed as a file
1676
+ // at runtime, so a link to a directory is just as unusable as a missing
1677
+ // file path. stat follows the link and reports the target type.
1678
+ let targetStats;
1679
+ try {
1680
+ targetStats = statSync(entry);
1681
+ }
1682
+ catch (error) {
1683
+ const code = filesystemErrorCode(error);
1684
+ gaps.push(`${entry} (${code === 'ENOENT' || code === 'ENOTDIR' ? 'dangling link' : 'unresolvable link'})`);
1685
+ return;
1686
+ }
1687
+ if (!targetStats.isFile()) {
1688
+ gaps.push(`${entry} (not a file)`);
1689
+ }
1690
+ return;
1691
+ }
1692
+ if (!stats.isFile()) {
1693
+ gaps.push(`${entry} (not a file)`);
1694
+ }
1695
+ }
1696
+ export function describeRestoredStateGaps() {
1697
+ const gaps = [];
1698
+ for (const requirement of restoredTreeRequirements()) {
1699
+ if (requirement.openClawOnly && !installsOpenClaw(activeHostTarget))
1700
+ continue;
1701
+ if (!describeRestoredDirGap(requirement.dir, gaps))
1702
+ continue;
1703
+ for (const entry of requirement.entries) {
1704
+ describeRestoredEntryGap(path.join(requirement.dir, entry), gaps);
1621
1705
  }
1622
1706
  }
1623
1707
  return gaps;
@@ -5,8 +5,10 @@ import { existsSync, readFileSync } from 'fs';
5
5
  import { execSync } from 'child_process';
6
6
  import { errnoCode } from './utils/config-file-io.js';
7
7
  export const MVP_CHANNELS = ['prompt', 'code_tool_hook', 'defer_archive'];
8
- export const MVP_QUIET_FLAGS = ['gfi'];
9
- export const MVP_GONE_FLAGS = ['nocturnal', 'idle_trigger'];
8
+ // GFI retired 2026-11-04 (GFI-COMPLETE-REMOVAL-001): its flag became a `gone`
9
+ // tombstone, so no quiet flag remains.
10
+ export const MVP_QUIET_FLAGS = [];
11
+ export const MVP_GONE_FLAGS = ['gfi', 'nocturnal', 'idle_trigger'];
10
12
  /**
11
13
  * Product-level feedback defaults (PRI-543). The PD 控制台的"意见反馈"收集的是
12
14
  * 使用者对 PD 产品的功能建议 / Bug,接收者是 PD 项目所有者,而非使用者自己。
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-principles-disciple",
3
- "version": "1.147.5",
3
+ "version": "1.147.7",
4
4
  "description": "Interactive CLI installer for Principles Disciple OpenClaw plugin",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principles/workbuddy-adapter",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "WorkBuddy host adapter for Principles Disciple — implements the HostAdapter interface for WorkBuddy's Git Bash command-hook model (ADR-0020 third host, SPEC workbuddy-host-adapter v0.3.0).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,7 +0,0 @@
1
- /**
2
- * Dynamic Attitude Matrix based on Global Friction Index (GFI).
3
- *
4
- * Phase: PRI-75 Prompt Injection SDK Migration Phase 1
5
- */
6
- export declare function buildAttitudeDirective(gfi: number): string;
7
- //# sourceMappingURL=attitude-directive.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attitude-directive.d.ts","sourceRoot":"","sources":["../../src/prompt-builder/attitude-directive.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA8B1D"}
@@ -1,39 +0,0 @@
1
- /**
2
- * Dynamic Attitude Matrix based on Global Friction Index (GFI).
3
- *
4
- * Phase: PRI-75 Prompt Injection SDK Migration Phase 1
5
- */
6
- export function buildAttitudeDirective(gfi) {
7
- if (gfi >= 70) {
8
- return `
9
- ### 【SYSTEM_MODE: HUMBLE_RECOVERY】
10
- **CURRENT STATUS**: Severe system friction / User frustration detected (GFI: ${gfi.toFixed(0)}).
11
- **BEHAVIORAL OVERRIDE**:
12
- - You have failed to meet expectations. Humility is your primary directive.
13
- - **STOP** aggressive file modifications.
14
- - **START** every response with a sincere, non-defensive apology.
15
- - **ACTION**: Explain why you failed, and propose a highly cautious recovery plan.
16
- `;
17
- }
18
- else if (gfi >= 40) {
19
- return `
20
- ### 【SYSTEM_MODE: CONCILIATORY】
21
- **CURRENT STATUS**: Moderate friction detected (GFI: ${gfi.toFixed(0)}).
22
- **BEHAVIORAL OVERRIDE**:
23
- - User is frustrated. Be more explanatory and cautious.
24
- - Before executing any tool, clearly state what you intend to do and **WAIT** for implicit or explicit user consent.
25
- - Avoid technical jargon; focus on the business/project value of your changes.
26
- `;
27
- }
28
- else {
29
- return `
30
- ### 【SYSTEM_MODE: EFFICIENT】
31
- **CURRENT STATUS**: System healthy (GFI: ${gfi.toFixed(0)}).
32
- **BEHAVIORAL OVERRIDE**:
33
- - Maintain peak efficiency.
34
- - Be concise. Prefer action over long explanations.
35
- - Follow the "Principles > Directives" rule strictly.
36
- `;
37
- }
38
- }
39
- //# sourceMappingURL=attitude-directive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attitude-directive.js","sourceRoot":"","sources":["../../src/prompt-builder/attitude-directive.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,UAAU,sBAAsB,CAAC,GAAW;IAChD,IAAI,GAAG,IAAI,EAAE,EAAE,CAAC;QACd,OAAO;;+EAEoE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;;;;;;CAM5F,CAAC;IACA,CAAC;SAAM,IAAI,GAAG,IAAI,EAAE,EAAE,CAAC;QACrB,OAAO;;uDAE4C,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;;;;;CAKpE,CAAC;IACA,CAAC;SAAM,CAAC;QACN,OAAO;;2CAEgC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;;;;;CAKxD,CAAC;IACA,CAAC;AACH,CAAC"}
@@ -1,12 +0,0 @@
1
- import type { GfiState, GfiEvent, GfiPolicy, GfiStage, GfiSnapshot } from './gfi-types.js';
2
- import { DEFAULT_GFI_POLICY } from './gfi-policy.js';
3
- export { DEFAULT_GFI_POLICY };
4
- export declare function applyFriction(state: GfiState, event: GfiEvent, policy: GfiPolicy): GfiState;
5
- export declare function applyDecay(state: GfiState, elapsedMinutes: number, policy: GfiPolicy, stage: GfiStage, nowMs: number): GfiState;
6
- export declare function applyRelief(state: GfiState, opts: {
7
- source: string;
8
- amount?: number;
9
- }, nowMs: number, policy?: GfiPolicy): GfiState;
10
- export declare function classifyGfiStage(gfi: number, policy: GfiPolicy): GfiStage;
11
- export declare function createGfiSnapshot(state: GfiState, policy: GfiPolicy): GfiSnapshot;
12
- //# sourceMappingURL=gfi-kernel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gfi-kernel.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/gfi/gfi-kernel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAa,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACtG,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,wBAAgB,aAAa,CAC3B,KAAK,EAAE,QAAQ,EACf,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,SAAS,GAChB,QAAQ,CA4BV;AAGD,wBAAgB,UAAU,CACxB,KAAK,EAAE,QAAQ,EACf,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,QAAQ,EACf,KAAK,EAAE,MAAM,GACZ,QAAQ,CA+BV;AAGD,wBAAgB,WAAW,CACzB,KAAK,EAAE,QAAQ,EACf,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EACzC,KAAK,EAAE,MAAM,EACb,MAAM,GAAE,SAA8B,GACrC,QAAQ,CAoDV;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,QAAQ,CAKzE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,GAAG,WAAW,CA0CjF"}
@@ -1,148 +0,0 @@
1
- import { DEFAULT_GFI_POLICY } from './gfi-policy.js';
2
- export { DEFAULT_GFI_POLICY };
3
- export function applyFriction(state, event, policy) {
4
- const isRepeated = state.lastErrorHash !== undefined && state.lastErrorHash === event.hash;
5
- const consecutiveErrors = isRepeated
6
- ? state.consecutiveErrors + 1
7
- : 1;
8
- const exponent = Math.max(0, consecutiveErrors - 1);
9
- const multiplier = Math.min(Math.pow(policy.repeatedFailureMultiplier.base, exponent), policy.repeatedFailureMultiplier.max);
10
- const score = event.baseScore * multiplier;
11
- const newCurrentGfi = state.currentGfi + score;
12
- const newGfiBySource = { ...state.gfiBySource };
13
- newGfiBySource[event.source] = (newGfiBySource[event.source] ?? 0) + score;
14
- return {
15
- ...state,
16
- currentGfi: newCurrentGfi,
17
- gfiBySource: newGfiBySource,
18
- consecutiveErrors,
19
- lastErrorHash: event.hash,
20
- lastErrorSource: event.source,
21
- dailyGfiPeak: Math.max(state.dailyGfiPeak ?? 0, newCurrentGfi),
22
- };
23
- }
24
- // eslint-disable-next-line @typescript-eslint/max-params
25
- export function applyDecay(state, elapsedMinutes, policy, stage, nowMs) {
26
- const rate = policy.decayRatesPerMinute[stage];
27
- // Decay each source slice individually, then prune those below minPruneBelow.
28
- // currentGfi is derived from the sum of remaining source slices when sources exist.
29
- // When no source ledger entries exist, decay currentGfi directly (e.g. session restart).
30
- const nextSources = {};
31
- for (const [src, value] of Object.entries(state.gfiBySource)) {
32
- const sourceDecayed = value - rate * elapsedMinutes;
33
- const sourceAfterDecay = Math.max(0, Math.round(sourceDecayed * 10) / 10);
34
- if (sourceAfterDecay >= policy.relief.minPruneBelow) {
35
- nextSources[src] = sourceAfterDecay;
36
- }
37
- }
38
- // Compute nextGfi:
39
- // - Has remaining sources: currentGfi = sum of remaining source slices (invariant)
40
- // - No remaining sources but had sources: currentGfi = 0 (all pruned → invariant)
41
- // - Had no source ledger at all: decay currentGfi directly (e.g. fresh session restart)
42
- const nextGfi = Object.keys(nextSources).length > 0
43
- ? Math.max(0, Math.round(Object.values(nextSources).reduce((a, b) => a + b, 0) * 10) / 10)
44
- : Object.keys(state.gfiBySource).length > 0
45
- ? 0
46
- : Math.max(0, Math.round((state.currentGfi - rate * elapsedMinutes) * 10) / 10);
47
- return {
48
- ...state,
49
- currentGfi: nextGfi,
50
- gfiBySource: nextSources,
51
- lastGfiDecayAt: nowMs,
52
- };
53
- }
54
- // eslint-disable-next-line @typescript-eslint/max-params
55
- export function applyRelief(state, opts, nowMs, policy = DEFAULT_GFI_POLICY) {
56
- const { source, amount = 0 } = opts;
57
- if (source === 'all' && amount >= 100) {
58
- return {
59
- currentGfi: 0,
60
- gfiBySource: {},
61
- consecutiveErrors: 0,
62
- lastErrorHash: undefined,
63
- lastErrorSource: undefined,
64
- lastGfiDecayAt: nowMs,
65
- dailyGfiPeak: state.dailyGfiPeak,
66
- };
67
- }
68
- const newSources = { ...state.gfiBySource };
69
- if (amount > 0) {
70
- // source-specific partial relief
71
- const key = source;
72
- if (newSources[key] !== undefined) {
73
- newSources[key] = Math.max(0, (newSources[key] ?? 0) - amount);
74
- if (newSources[key] === 0) {
75
- delete newSources[key];
76
- }
77
- }
78
- }
79
- else {
80
- // ratio-based relief (toolSuccessRatio)
81
- const ratio = policy.relief.toolSuccessRatio;
82
- for (const src of Object.keys(newSources)) {
83
- const key = src;
84
- newSources[key] = Math.max(0, Math.round(((newSources[key] ?? 0) * (1 - ratio)) * 10) / 10);
85
- if (newSources[key] === 0) {
86
- delete newSources[key];
87
- }
88
- }
89
- }
90
- const totalSources = Object.values(newSources).reduce((a, b) => a + b, 0);
91
- const isLastErrorSource = source === state.lastErrorSource && source !== 'all';
92
- const newConsecutiveErrors = isLastErrorSource ? 0 : state.consecutiveErrors;
93
- return {
94
- ...state,
95
- currentGfi: totalSources,
96
- gfiBySource: newSources,
97
- consecutiveErrors: newConsecutiveErrors,
98
- lastErrorHash: newConsecutiveErrors === 0 ? undefined : state.lastErrorHash,
99
- lastErrorSource: newConsecutiveErrors === 0 ? undefined : state.lastErrorSource,
100
- lastGfiDecayAt: nowMs,
101
- };
102
- }
103
- export function classifyGfiStage(gfi, policy) {
104
- if (gfi >= policy.stageThresholds.saturated)
105
- return 'saturated';
106
- if (gfi >= policy.stageThresholds.critical)
107
- return 'critical';
108
- if (gfi >= policy.stageThresholds.elevated)
109
- return 'elevated';
110
- return 'stable';
111
- }
112
- export function createGfiSnapshot(state, policy) {
113
- const stage = classifyGfiStage(state.currentGfi, policy);
114
- const sources = { ...state.gfiBySource };
115
- let dominantSource = null;
116
- let maxSourceValue = 0;
117
- for (const [src, val] of Object.entries(state.gfiBySource)) {
118
- if (val > maxSourceValue) {
119
- maxSourceValue = val;
120
- dominantSource = src;
121
- }
122
- }
123
- const attitudeMode = state.currentGfi < policy.stageThresholds.elevated
124
- ? 'efficient'
125
- : state.currentGfi < policy.stageThresholds.critical
126
- ? 'conciliatory'
127
- : 'humble_recovery';
128
- const painDiagnosticReason = state.currentGfi >= policy.stageThresholds.elevated ? 'high_gfi' : 'none';
129
- const consumers = { attitudeMode, painDiagnosticReason };
130
- return {
131
- currentGfi: state.currentGfi,
132
- stage,
133
- sources,
134
- dominantSource,
135
- consecutiveErrors: state.consecutiveErrors,
136
- lastErrorSource: state.lastErrorSource,
137
- lastDecayAt: state.lastGfiDecayAt ? new Date(state.lastGfiDecayAt).toISOString() : undefined,
138
- dailyGfiPeak: state.dailyGfiPeak,
139
- policy: {
140
- elevatedThreshold: policy.stageThresholds.elevated,
141
- criticalThreshold: policy.stageThresholds.critical,
142
- saturatedThreshold: policy.stageThresholds.saturated,
143
- repeatedFailureMultiplierMax: policy.repeatedFailureMultiplier.max,
144
- },
145
- consumers,
146
- };
147
- }
148
- //# sourceMappingURL=gfi-kernel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gfi-kernel.js","sourceRoot":"","sources":["../../../src/runtime-v2/gfi/gfi-kernel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,MAAM,UAAU,aAAa,CAC3B,KAAe,EACf,KAAe,EACf,MAAiB;IAEjB,MAAM,UAAU,GAAG,KAAK,CAAC,aAAa,KAAK,SAAS,IAAI,KAAK,CAAC,a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,iBAAiB;QAC1C,eAAe,EAAE,KAAK,CAAC,eAAe;QACtC,WAAW,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS;QAC5F,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,MAAM,EAAE;YACN,iBAAiB,EAAE,MAAM,CAAC,eAAe,CAAC,QAAQ;YAClD,iBAAiB,EAAE,MAAM,CAAC,eAAe,CAAC,QAAQ;YAClD,kBAAkB,EAAE,MAAM,CAAC,eAAe,CAAC,SAAS;YACpD,4BAA4B,EAAE,MAAM,CAAC,yBAAyB,CAAC,GAAG;SACnE;QACD,SAAS;KACV,CAAC;AACJ,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { GfiPolicy } from './gfi-types.js';
2
- export declare const DEFAULT_GFI_POLICY: GfiPolicy;
3
- //# sourceMappingURL=gfi-policy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gfi-policy.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/gfi/gfi-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,eAAO,MAAM,kBAAkB,EAAE,SAqBhC,CAAC"}
@@ -1,23 +0,0 @@
1
- export const DEFAULT_GFI_POLICY = {
2
- stageThresholds: {
3
- elevated: 40,
4
- critical: 70,
5
- saturated: 100,
6
- },
7
- repeatedFailureMultiplier: {
8
- base: 1.5,
9
- max: 3.0,
10
- },
11
- decayRatesPerMinute: {
12
- stable: 0.5,
13
- elevated: 1.0,
14
- critical: 2.0,
15
- saturated: 4.0,
16
- },
17
- relief: {
18
- toolSuccessRatio: 0.25,
19
- minPruneBelow: 8,
20
- },
21
- sourceWeights: {},
22
- };
23
- //# sourceMappingURL=gfi-policy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gfi-policy.js","sourceRoot":"","sources":["../../../src/runtime-v2/gfi/gfi-policy.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,kBAAkB,GAAc;IAC3C,eAAe,EAAE;QACf,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,GAAG;KACf;IACD,yBAAyB,EAAE;QACzB,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,GAAG;KACT;IACD,mBAAmB,EAAE;QACnB,MAAM,EAAE,GAAG;QACX,QAAQ,EAAE,GAAG;QACb,QAAQ,EAAE,GAAG;QACb,SAAS,EAAE,GAAG;KACf;IACD,MAAM,EAAE;QACN,gBAAgB,EAAE,IAAI;QACtB,aAAa,EAAE,CAAC;KACjB;IACD,aAAa,EAAE,EAAE;CAClB,CAAC"}
@@ -1,78 +0,0 @@
1
- /**
2
- * GFI Observability Read Model
3
- *
4
- * Pure domain model for building workspace-level GFI snapshots.
5
- * Partitions sessions into active vs stale and produces an authoritative snapshot
6
- * for operator visibility.
7
- *
8
- * PRI-78: GFI Observability
9
- */
10
- import type { GfiPolicy, GfiSource, GfiSnapshot } from './gfi-types.js';
11
- export interface GfiReadModelInput {
12
- sessions: {
13
- sessionId: string;
14
- /** Defaults to 0 if omitted */
15
- currentGfi?: number;
16
- gfiBySource?: Partial<Record<GfiSource, number>>;
17
- lastErrorSource?: string;
18
- /** Defaults to 0 if omitted */
19
- consecutiveErrors?: number;
20
- lastGfiDecayAt?: number;
21
- dailyGfiPeak?: number;
22
- /** Defaults to 0 if omitted — session older than cutoff is classified stale */
23
- lastActivityAt?: number;
24
- }[];
25
- nowMs: number;
26
- /** Sessions with lastActivityAt < nowMs - staleCutoffMs are classified stale. Default: 2 hours */
27
- staleCutoffMs?: number;
28
- policy?: GfiPolicy;
29
- }
30
- /**
31
- * Workspace-level GFI snapshot — partitions sessions into active vs stale.
32
- *
33
- * Invariant: `active === null` iff `activeSessionCount === 0` (no active sessions exist).
34
- * Invariant: `staleGfiRange === null` iff `staleSessionCount === 0` (not an error state).
35
- */
36
- export interface GfiWorkspaceSnapshot {
37
- /**
38
- * Snapshot for the highest-GFI active session.
39
- * Null when there are no active sessions (all stale, or no sessions exist).
40
- */
41
- active: GfiSnapshot | null;
42
- staleSessionCount: number;
43
- /**
44
- * Min/max GFI across all stale sessions.
45
- * Null when staleSessionCount === 0 (no stale sessions — not an error state).
46
- */
47
- staleGfiRange: {
48
- min: number;
49
- max: number;
50
- } | null;
51
- totalSessionCount: number;
52
- activeSessionCount: number;
53
- generatedAt: string;
54
- }
55
- export interface GfiWorkspaceHealthAssessment {
56
- status: 'healthy' | 'degraded';
57
- reason: string;
58
- staleGfiDegradedThreshold: number;
59
- }
60
- export declare function classifyGfiWorkspaceHealth(snapshot: GfiWorkspaceSnapshot, options?: {
61
- staleGfiDegradedThreshold?: number;
62
- }): GfiWorkspaceHealthAssessment;
63
- /**
64
- * Build a workspace-level GFI snapshot from session data.
65
- *
66
- * Algorithm:
67
- * 1. Default stale cutoff to 2 hours if not provided
68
- * 2. Partition sessions into active (lastActivityAt >= nowMs - staleCutoffMs) and stale
69
- * 3. Select active session with highest currentGfi (tie-break: most recent lastActivityAt)
70
- * 4. Build GfiSnapshot for selected active session using createGfiSnapshot
71
- * 5. Compute staleGfiRange from stale sessions' currentGfi values
72
- * 6. Return GfiWorkspaceSnapshot
73
- *
74
- * Key invariant: stale sessions do NOT influence the active snapshot.
75
- * This prevents old UAT sessions with GFI=197.8 from making current health look critical.
76
- */
77
- export declare function buildGfiWorkspaceSnapshot(input: GfiReadModelInput): GfiWorkspaceSnapshot;
78
- //# sourceMappingURL=gfi-read-model.d.ts.map