create-principles-disciple 1.77.0 → 1.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/console/dist/server/config/feature-flags.d.ts +25 -0
  2. package/console/dist/server/config/feature-flags.js +101 -0
  3. package/console/dist/server/index.js +16 -0
  4. package/console/dist/server/models/FeedbackReportConsoleModel.d.ts +49 -0
  5. package/console/dist/server/models/FeedbackReportConsoleModel.js +242 -0
  6. package/console/dist/server/routes/feedback-reports.d.ts +18 -0
  7. package/console/dist/server/routes/feedback-reports.js +165 -0
  8. package/console/dist/ui/App.js +2 -1
  9. package/console/dist/ui/api.d.ts +26 -2
  10. package/console/dist/ui/api.js +18 -1
  11. package/console/dist/ui/components/app-sidebar.js +2 -1
  12. package/console/dist/ui/components/error-boundary.js +9 -2
  13. package/console/dist/ui/i18n/en.json +67 -1
  14. package/console/dist/ui/i18n/zh-CN.json +67 -1
  15. package/console/dist/ui/pages/ReportProblemPage.d.ts +1 -0
  16. package/console/dist/ui/pages/ReportProblemPage.js +186 -0
  17. package/console/dist/ui/pages/ReportProblemValidators.d.ts +51 -0
  18. package/console/dist/ui/pages/ReportProblemValidators.js +114 -0
  19. package/console/dist/web/assets/app.css +18 -0
  20. package/console/dist/web/assets/app.js +1047 -125
  21. package/console/package.json +1 -0
  22. package/core/dist/runtime-v2/__tests__/architecture-regression.test.js +23 -1
  23. package/core/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
  24. package/core/dist/runtime-v2/__tests__/feedback/create-report.test.d.ts +2 -0
  25. package/core/dist/runtime-v2/__tests__/feedback/create-report.test.d.ts.map +1 -0
  26. package/core/dist/runtime-v2/__tests__/feedback/create-report.test.js +402 -0
  27. package/core/dist/runtime-v2/__tests__/feedback/create-report.test.js.map +1 -0
  28. package/core/dist/runtime-v2/__tests__/feedback/privacy-preview.test.d.ts +2 -0
  29. package/core/dist/runtime-v2/__tests__/feedback/privacy-preview.test.d.ts.map +1 -0
  30. package/core/dist/runtime-v2/__tests__/feedback/privacy-preview.test.js +128 -0
  31. package/core/dist/runtime-v2/__tests__/feedback/privacy-preview.test.js.map +1 -0
  32. package/core/dist/runtime-v2/__tests__/feedback/redact-sensitive.test.d.ts +2 -0
  33. package/core/dist/runtime-v2/__tests__/feedback/redact-sensitive.test.d.ts.map +1 -0
  34. package/core/dist/runtime-v2/__tests__/feedback/redact-sensitive.test.js +231 -0
  35. package/core/dist/runtime-v2/__tests__/feedback/redact-sensitive.test.js.map +1 -0
  36. package/core/dist/runtime-v2/__tests__/feedback/render-github-url.test.d.ts +2 -0
  37. package/core/dist/runtime-v2/__tests__/feedback/render-github-url.test.d.ts.map +1 -0
  38. package/core/dist/runtime-v2/__tests__/feedback/render-github-url.test.js +102 -0
  39. package/core/dist/runtime-v2/__tests__/feedback/render-github-url.test.js.map +1 -0
  40. package/core/dist/runtime-v2/__tests__/feedback/render-markdown.test.d.ts +2 -0
  41. package/core/dist/runtime-v2/__tests__/feedback/render-markdown.test.d.ts.map +1 -0
  42. package/core/dist/runtime-v2/__tests__/feedback/render-markdown.test.js +130 -0
  43. package/core/dist/runtime-v2/__tests__/feedback/render-markdown.test.js.map +1 -0
  44. package/core/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.d.ts +2 -0
  45. package/core/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.d.ts.map +1 -0
  46. package/core/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.js +343 -0
  47. package/core/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.js.map +1 -0
  48. package/core/dist/runtime-v2/activation/index.d.ts +2 -0
  49. package/core/dist/runtime-v2/activation/index.d.ts.map +1 -1
  50. package/core/dist/runtime-v2/activation/index.js +1 -0
  51. package/core/dist/runtime-v2/activation/index.js.map +1 -1
  52. package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.d.ts +34 -0
  53. package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.d.ts.map +1 -0
  54. package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.js +109 -0
  55. package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.js.map +1 -0
  56. package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js +13 -0
  57. package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js.map +1 -1
  58. package/core/dist/runtime-v2/feature-flags/__tests__/plugin-surface-registry.test.d.ts +2 -0
  59. package/core/dist/runtime-v2/feature-flags/__tests__/plugin-surface-registry.test.d.ts.map +1 -0
  60. package/core/dist/runtime-v2/feature-flags/__tests__/plugin-surface-registry.test.js +141 -0
  61. package/core/dist/runtime-v2/feature-flags/__tests__/plugin-surface-registry.test.js.map +1 -0
  62. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
  63. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js +4 -1
  64. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
  65. package/core/dist/runtime-v2/feature-flags/index.d.ts +2 -0
  66. package/core/dist/runtime-v2/feature-flags/index.d.ts.map +1 -1
  67. package/core/dist/runtime-v2/feature-flags/index.js +1 -0
  68. package/core/dist/runtime-v2/feature-flags/index.js.map +1 -1
  69. package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.d.ts +25 -0
  70. package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.d.ts.map +1 -0
  71. package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.js +233 -0
  72. package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.js.map +1 -0
  73. package/core/dist/runtime-v2/feedback/create-report.d.ts +14 -0
  74. package/core/dist/runtime-v2/feedback/create-report.d.ts.map +1 -0
  75. package/core/dist/runtime-v2/feedback/create-report.js +257 -0
  76. package/core/dist/runtime-v2/feedback/create-report.js.map +1 -0
  77. package/core/dist/runtime-v2/feedback/feedback-types.d.ts +120 -0
  78. package/core/dist/runtime-v2/feedback/feedback-types.d.ts.map +1 -0
  79. package/core/dist/runtime-v2/feedback/feedback-types.js +243 -0
  80. package/core/dist/runtime-v2/feedback/feedback-types.js.map +1 -0
  81. package/core/dist/runtime-v2/feedback/index.d.ts +9 -0
  82. package/core/dist/runtime-v2/feedback/index.d.ts.map +1 -0
  83. package/core/dist/runtime-v2/feedback/index.js +11 -0
  84. package/core/dist/runtime-v2/feedback/index.js.map +1 -0
  85. package/core/dist/runtime-v2/feedback/internal-guards.d.ts +2 -0
  86. package/core/dist/runtime-v2/feedback/internal-guards.d.ts.map +1 -0
  87. package/core/dist/runtime-v2/feedback/internal-guards.js +6 -0
  88. package/core/dist/runtime-v2/feedback/internal-guards.js.map +1 -0
  89. package/core/dist/runtime-v2/feedback/privacy-preview.d.ts +14 -0
  90. package/core/dist/runtime-v2/feedback/privacy-preview.d.ts.map +1 -0
  91. package/core/dist/runtime-v2/feedback/privacy-preview.js +128 -0
  92. package/core/dist/runtime-v2/feedback/privacy-preview.js.map +1 -0
  93. package/core/dist/runtime-v2/feedback/redact-sensitive.d.ts +37 -0
  94. package/core/dist/runtime-v2/feedback/redact-sensitive.d.ts.map +1 -0
  95. package/core/dist/runtime-v2/feedback/redact-sensitive.js +272 -0
  96. package/core/dist/runtime-v2/feedback/redact-sensitive.js.map +1 -0
  97. package/core/dist/runtime-v2/feedback/render-github-url.d.ts +21 -0
  98. package/core/dist/runtime-v2/feedback/render-github-url.d.ts.map +1 -0
  99. package/core/dist/runtime-v2/feedback/render-github-url.js +57 -0
  100. package/core/dist/runtime-v2/feedback/render-github-url.js.map +1 -0
  101. package/core/dist/runtime-v2/feedback/render-markdown.d.ts +12 -0
  102. package/core/dist/runtime-v2/feedback/render-markdown.d.ts.map +1 -0
  103. package/core/dist/runtime-v2/feedback/render-markdown.js +166 -0
  104. package/core/dist/runtime-v2/feedback/render-markdown.js.map +1 -0
  105. package/core/dist/runtime-v2/feedback/safe-stringify.d.ts +6 -0
  106. package/core/dist/runtime-v2/feedback/safe-stringify.d.ts.map +1 -0
  107. package/core/dist/runtime-v2/feedback/safe-stringify.js +115 -0
  108. package/core/dist/runtime-v2/feedback/safe-stringify.js.map +1 -0
  109. package/core/dist/runtime-v2/index.d.ts +6 -1
  110. package/core/dist/runtime-v2/index.d.ts.map +1 -1
  111. package/core/dist/runtime-v2/index.js +10 -1
  112. package/core/dist/runtime-v2/index.js.map +1 -1
  113. package/core/package.json +4 -0
  114. package/package.json +1 -1
  115. package/plugin/dist/commands/context.js +5 -5
  116. package/plugin/dist/commands/strategy.d.ts +0 -1
  117. package/plugin/dist/commands/strategy.js +0 -14
  118. package/plugin/dist/core/runtime-v2-prompt-activation-reader.d.ts +4 -13
  119. package/plugin/dist/core/runtime-v2-prompt-activation-reader.js +36 -74
  120. package/plugin/dist/core/surface-guard.d.ts +27 -0
  121. package/plugin/dist/core/surface-guard.js +82 -0
  122. package/plugin/dist/hooks/prompt.js +20 -143
  123. package/plugin/dist/i18n/commands.js +2 -14
  124. package/plugin/dist/index.d.ts +27 -0
  125. package/plugin/dist/index.js +174 -55
  126. package/plugin/dist/service/correction-observer-service.d.ts +11 -0
  127. package/plugin/dist/service/correction-observer-service.js +172 -0
  128. package/plugin/dist/service/evolution-worker.js +1 -110
  129. package/plugin/dist/types.d.ts +2 -2
  130. package/plugin/dist/types.js +3 -3
  131. package/plugin/templates/langs/en/core/BOOTSTRAP.md +4 -18
  132. package/plugin/templates/langs/en/skills/bootstrap-tools/SKILL.md +1 -1
  133. package/plugin/templates/langs/en/skills/init-strategy/SKILL.md +1 -1
  134. package/plugin/templates/langs/en/skills/pd-mentor/SKILL.md +8 -23
  135. package/plugin/templates/langs/zh/core/BOOTSTRAP.md +2 -15
  136. package/plugin/templates/langs/zh/skills/bootstrap-tools/SKILL.md +1 -1
  137. package/plugin/templates/langs/zh/skills/init-strategy/SKILL.md +1 -1
  138. package/plugin/templates/langs/zh/skills/pd-mentor/SKILL.md +7 -22
  139. package/plugin/templates/langs/en/skills/ai-sprint-orchestration/EXAMPLES.md +0 -63
  140. package/plugin/templates/langs/en/skills/ai-sprint-orchestration/REFERENCE.md +0 -136
  141. package/plugin/templates/langs/en/skills/ai-sprint-orchestration/SKILL.md +0 -67
  142. package/plugin/templates/langs/en/skills/ai-sprint-orchestration/references/agent-registry.json +0 -143
  143. package/plugin/templates/langs/en/skills/ai-sprint-orchestration/references/specs/bugfix-complex-template.json +0 -107
  144. package/plugin/templates/langs/en/skills/ai-sprint-orchestration/references/specs/feature-complex-template.json +0 -107
  145. package/plugin/templates/langs/en/skills/ai-sprint-orchestration/references/specs/workflow-validation-minimal-verify.json +0 -95
  146. package/plugin/templates/langs/en/skills/ai-sprint-orchestration/references/specs/workflow-validation-minimal.json +0 -98
  147. package/plugin/templates/langs/en/skills/ai-sprint-orchestration/references/workflow-v1-acceptance-checklist.md +0 -58
  148. package/plugin/templates/langs/en/skills/ai-sprint-orchestration/references/workflow-v1.4-work-unit-handoff.md +0 -190
  149. package/plugin/templates/langs/en/skills/ai-sprint-orchestration/scripts/lib/archive.mjs +0 -310
  150. package/plugin/templates/langs/en/skills/ai-sprint-orchestration/scripts/lib/contract-enforcement.mjs +0 -683
  151. package/plugin/templates/langs/en/skills/ai-sprint-orchestration/scripts/lib/decision.mjs +0 -604
  152. package/plugin/templates/langs/en/skills/ai-sprint-orchestration/scripts/lib/state-store.mjs +0 -32
  153. package/plugin/templates/langs/en/skills/ai-sprint-orchestration/scripts/lib/task-specs.mjs +0 -707
  154. package/plugin/templates/langs/en/skills/ai-sprint-orchestration/scripts/run.mjs +0 -3455
  155. package/plugin/templates/langs/en/skills/evolve-system/SKILL.md +0 -46
  156. package/plugin/templates/langs/en/skills/manage-okr/SKILL.md +0 -96
  157. package/plugin/templates/langs/en/skills/pd-daily/SKILL.md +0 -199
  158. package/plugin/templates/langs/en/skills/pd-grooming/SKILL.md +0 -46
  159. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/EXAMPLES.md +0 -63
  160. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/REFERENCE.md +0 -136
  161. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/SKILL.md +0 -67
  162. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/references/agent-registry.json +0 -143
  163. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/references/specs/bugfix-complex-template.json +0 -107
  164. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/references/specs/feature-complex-template.json +0 -107
  165. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/references/specs/nocturnal-trinity-quality-enhancement.json +0 -111
  166. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/references/specs/workflow-validation-minimal-verify.json +0 -95
  167. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/references/specs/workflow-validation-minimal.json +0 -98
  168. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/references/workflow-v1-acceptance-checklist.md +0 -58
  169. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/references/workflow-v1.4-work-unit-handoff.md +0 -190
  170. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/runtime/.gitignore +0 -2
  171. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/scripts/lib/archive.mjs +0 -310
  172. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/scripts/lib/contract-enforcement.mjs +0 -683
  173. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/scripts/lib/decision.mjs +0 -604
  174. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/scripts/lib/state-store.mjs +0 -32
  175. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/scripts/lib/task-specs.mjs +0 -707
  176. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/scripts/run.mjs +0 -3455
  177. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/test/archive.test.mjs +0 -230
  178. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/test/contract-enforcement.test.mjs +0 -672
  179. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/test/decision.test.mjs +0 -1321
  180. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/test/run.test.mjs +0 -1435
  181. package/plugin/templates/langs/zh/skills/evolve-system/SKILL.md +0 -46
  182. package/plugin/templates/langs/zh/skills/manage-okr/SKILL.md +0 -109
  183. package/plugin/templates/langs/zh/skills/pd-daily/SKILL.md +0 -283
  184. package/plugin/templates/langs/zh/skills/pd-grooming/SKILL.md +0 -46
@@ -14,17 +14,3 @@ export function handleInitStrategy(ctx) {
14
14
  `Then update \`${userContextPath}\` with key user preferences discovered.`,
15
15
  };
16
16
  }
17
- export function handleManageOkr(ctx) {
18
- const workspaceDir = resolvePluginCommandWorkspaceDir(ctx, 'strategy:manageOkr');
19
- const wctx = WorkspaceContext.fromHookContext({ workspaceDir, ...ctx.config });
20
- const focusPath = wctx.resolve('CURRENT_FOCUS').replace(workspaceDir, '').replace(/^\/+/, '');
21
- const weekStatePath = wctx.resolve('WEEK_STATE').replace(workspaceDir, '').replace(/^\/+/, '');
22
- return {
23
- text: `📊 **OKR Management**\n\n` +
24
- `The Agent will analyze recent work and align sub-agent objectives.\n\n` +
25
- `**Instructions for Agent:** Read \`${focusPath}\` and \`${weekStatePath}\`. ` +
26
- `Compare them against recent session history. ` +
27
- `Update OKRs as needed and output a brief alignment report. ` +
28
- `If OKRs are stale (>7 days), prompt the user for a re-alignment conversation.`,
29
- };
30
- }
@@ -1,15 +1,6 @@
1
- export declare const RUNTIME_V2_PRINCIPLE_BUDGET = 2000;
2
- export interface ActivatedPrinciple {
3
- principleId: string;
4
- text: string;
5
- artifactId: string;
6
- activationId: string;
7
- }
8
- export interface PromptActivationReaderResult {
9
- principles: ActivatedPrinciple[];
10
- warnings: string[];
11
- source: 'runtime_v2';
12
- }
1
+ import type { ActivatedPrinciple, PromptActivationReaderResult } from '@principles/core/runtime-v2';
2
+ export { RUNTIME_V2_PRINCIPLE_BUDGET } from '@principles/core/runtime-v2';
3
+ export type { ActivatedPrinciple, PromptActivationReaderResult };
13
4
  export interface PromptActivationReaderDeps {
14
5
  logger?: {
15
6
  warn?: (msg: string) => void;
@@ -22,6 +13,6 @@ export declare class PromptActivationReader {
22
13
  private readonly deps;
23
14
  constructor(workspaceDir: string, deps?: PromptActivationReaderDeps);
24
15
  readActivatedPrinciples(): Promise<PromptActivationReaderResult>;
16
+ private queryArtifactRow;
25
17
  private loadFeatureFlags;
26
- private resolvePrincipleFromActivation;
27
18
  }
@@ -1,8 +1,8 @@
1
1
  import * as path from 'path';
2
2
  import * as fs from 'fs';
3
3
  import * as yaml from 'js-yaml';
4
- import { SqliteConnection, SqliteActivationStateStore, computeEffectiveFlags, DEFAULT_FEATURE_FLAGS } from '@principles/core/runtime-v2';
5
- export const RUNTIME_V2_PRINCIPLE_BUDGET = 2000;
4
+ import { SqliteConnection, SqliteActivationStateStore, computeEffectiveFlags, DEFAULT_FEATURE_FLAGS, filterPromptActivations, resolvePrincipleFromArtifact } from '@principles/core/runtime-v2';
5
+ export { RUNTIME_V2_PRINCIPLE_BUDGET } from '@principles/core/runtime-v2';
6
6
  const DANGEROUS_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
7
7
  function isRecord(value) {
8
8
  return value !== null && typeof value === 'object' && !Array.isArray(value);
@@ -27,12 +27,27 @@ export class PromptActivationReader {
27
27
  try {
28
28
  sqliteConn = new SqliteConnection(this.workspaceDir);
29
29
  const store = new SqliteActivationStateStore(sqliteConn);
30
- const activations = await store.listPromptActivations();
31
- for (const activation of activations) {
32
- if (activation.channel !== 'prompt' || activation.action !== 'prompt_activate') {
30
+ const allActivations = await store.listPromptActivations();
31
+ const promptActivations = filterPromptActivations(allActivations);
32
+ for (const activation of promptActivations) {
33
+ let artifactRow;
34
+ try {
35
+ artifactRow = this.queryArtifactRow(sqliteConn, activation.artifactId);
36
+ }
37
+ catch (e) {
38
+ const msg = e instanceof Error ? e.message : String(e);
39
+ const warning = `artifact_query_failed: artifactId=${activation.artifactId} reason=${msg}; nextAction=check_pi_artifacts_table`;
40
+ warnings.push(warning);
41
+ this.deps.logger?.warn?.(`[PD:RuntimeV2] ${warning}`);
42
+ continue;
43
+ }
44
+ if (artifactRow === null) {
45
+ const warning = `artifact_not_found: artifactId=${activation.artifactId}; nextAction=check_pi_artifacts_table`;
46
+ warnings.push(warning);
47
+ this.deps.logger?.warn?.(`[PD:RuntimeV2] ${warning}`);
33
48
  continue;
34
49
  }
35
- const result = this.resolvePrincipleFromActivation(sqliteConn, activation);
50
+ const result = resolvePrincipleFromArtifact(artifactRow, activation);
36
51
  if (result.ok) {
37
52
  principles.push(result.principle);
38
53
  }
@@ -58,6 +73,21 @@ export class PromptActivationReader {
58
73
  }
59
74
  return { principles, warnings, source: 'runtime_v2' };
60
75
  }
76
+ queryArtifactRow(sqliteConn, artifactId) {
77
+ try {
78
+ const db = sqliteConn.getDb();
79
+ const row = db.prepare(`
80
+ SELECT artifact_id, artifact_kind, content_json, validation_status
81
+ FROM pi_artifacts
82
+ WHERE artifact_id = ?
83
+ `).get(artifactId);
84
+ return row ?? null;
85
+ }
86
+ catch (e) {
87
+ const msg = e instanceof Error ? e.message : String(e);
88
+ throw new Error(`artifact_query_failed: artifactId=${artifactId} reason=${msg}; nextAction=check_pi_artifacts_table`);
89
+ }
90
+ }
61
91
  loadFeatureFlags() {
62
92
  const configPath = path.join(this.workspaceDir, '.pd', 'feature-flags.yaml');
63
93
  if (!fs.existsSync(configPath)) {
@@ -110,72 +140,4 @@ export class PromptActivationReader {
110
140
  }
111
141
  return result;
112
142
  }
113
- resolvePrincipleFromActivation(sqliteConn, activation) {
114
- const db = sqliteConn.getDb();
115
- let contentJson;
116
- try {
117
- const row = db.prepare(`
118
- SELECT artifact_id, artifact_kind, content_json, validation_status
119
- FROM pi_artifacts
120
- WHERE artifact_id = ?
121
- `).get(activation.artifactId);
122
- if (!isRecord(row)) {
123
- return { ok: false, warning: `artifact_query_unexpected: artifactId=${activation.artifactId}; nextAction=check_pi_artifacts_table` };
124
- }
125
- const artifact_id = Object.hasOwn(row, 'artifact_id') && typeof row.artifact_id === 'string' && row.artifact_id.length > 0 ? row.artifact_id : null;
126
- const artifact_kind = Object.hasOwn(row, 'artifact_kind') && typeof row.artifact_kind === 'string' ? row.artifact_kind : null;
127
- const raw_content_json = Object.hasOwn(row, 'content_json') && typeof row.content_json === 'string' ? row.content_json : null;
128
- const validation_status = Object.hasOwn(row, 'validation_status') && typeof row.validation_status === 'string' ? row.validation_status : null;
129
- if (!artifact_id) {
130
- return { ok: false, warning: `artifact_not_found: artifactId=${activation.artifactId} activationId=${activation.activationId}; nextAction=verify_artifact_exists_or_remove_stale_activation` };
131
- }
132
- if (artifact_kind !== 'principle') {
133
- return { ok: false, warning: `artifact_not_principle: artifactId=${artifact_id} kind=${artifact_kind ?? 'missing'}; nextAction=skip_non_principle_activations` };
134
- }
135
- if (validation_status !== 'validated') {
136
- return { ok: false, warning: `artifact_not_validated: artifactId=${artifact_id} status=${validation_status ?? 'missing'}; nextAction=skip_unvalidated_artifacts` };
137
- }
138
- if (raw_content_json === null) {
139
- return { ok: false, warning: `artifact_missing_content_json: artifactId=${artifact_id}; nextAction=ensure_artifact_has_content_json` };
140
- }
141
- contentJson = raw_content_json;
142
- }
143
- catch (e) {
144
- const msg = e instanceof Error ? e.message : String(e);
145
- return { ok: false, warning: `artifact_query_failed: artifactId=${activation.artifactId} reason=${msg}; nextAction=check_pi_artifacts_table` };
146
- }
147
- let parsed;
148
- try {
149
- parsed = JSON.parse(contentJson);
150
- }
151
- catch (e) {
152
- const msg = e instanceof Error ? e.message : String(e);
153
- return { ok: false, warning: `artifact_content_json_parse_error: artifactId=${activation.artifactId} reason=${msg}; nextAction=fix_artifact_content_json` };
154
- }
155
- if (!isRecord(parsed)) {
156
- return { ok: false, warning: `artifact_content_malformed: artifactId=${activation.artifactId} reason=parsed_to_non_object; nextAction=fix_artifact_content_json` };
157
- }
158
- const principleId = Object.hasOwn(parsed, 'principleId') && typeof parsed.principleId === 'string' ? parsed.principleId : undefined;
159
- const text = Object.hasOwn(parsed, 'text') && typeof parsed.text === 'string' ? parsed.text : undefined;
160
- const draftObj = Object.hasOwn(parsed, 'principleDraft') && isRecord(parsed.principleDraft) ? parsed.principleDraft : null;
161
- const draftTitle = draftObj && Object.hasOwn(draftObj, 'title') && typeof draftObj.title === 'string' ? draftObj.title : undefined;
162
- const draftStatement = draftObj && Object.hasOwn(draftObj, 'statement') && typeof draftObj.statement === 'string' ? draftObj.statement : undefined;
163
- const resolvedPrincipleId = principleId && principleId.length > 0 ? principleId : draftTitle;
164
- const resolvedText = text && text.length > 0 ? text : draftStatement;
165
- if (!resolvedPrincipleId || resolvedPrincipleId.length === 0) {
166
- return { ok: false, warning: `artifact_missing_principle_id: artifactId=${activation.artifactId}; nextAction=ensure_artifact_has_principleId_or_principleDraft_title` };
167
- }
168
- if (!resolvedText || resolvedText.length === 0) {
169
- return { ok: false, warning: `artifact_missing_text: artifactId=${activation.artifactId} principleId=${resolvedPrincipleId}; nextAction=ensure_artifact_has_text_or_principleDraft_statement` };
170
- }
171
- return {
172
- ok: true,
173
- principle: {
174
- principleId: resolvedPrincipleId,
175
- text: resolvedText,
176
- artifactId: activation.artifactId,
177
- activationId: activation.activationId,
178
- },
179
- };
180
- }
181
143
  }
@@ -0,0 +1,27 @@
1
+ import { PLUGIN_SURFACE_REGISTRY, validateSurfaceRegistry, getSurfacesByCategory, type PluginSurfaceEntry, type MvpCategory } from '@principles/core/runtime-v2';
2
+ import type { OpenClawPluginService } from '../openclaw-sdk.js';
3
+ export interface SurfaceGuardResult {
4
+ passed: boolean;
5
+ enabledCoreSurfaces: string[];
6
+ disabledNonCoreSurfaces: string[];
7
+ violations: string[];
8
+ warnings: string[];
9
+ }
10
+ export declare function checkSurfaceGuard(): SurfaceGuardResult;
11
+ export declare function getSurfaceIdForHook(hookEvent: string, label?: string): string;
12
+ export declare function getSurfaceIdForService(serviceName: string): string;
13
+ export declare function isSurfaceEnabled(surfaceId: string, overrides?: Record<string, boolean>): {
14
+ enabled: boolean;
15
+ reason?: string;
16
+ };
17
+ export type HookHandler<E, C, R> = (event: E, ctx: C) => R | Promise<R>;
18
+ export declare function guardHook<E, C, R>(surfaceId: string, logger: {
19
+ info?: (msg: string) => void;
20
+ debug?: (msg: string) => void;
21
+ } | undefined, handler: HookHandler<E, C, R>): HookHandler<E, C, R>;
22
+ export declare function guardService<T extends OpenClawPluginService>(surfaceId: string, service: T, logger?: {
23
+ info?: (msg: string) => void;
24
+ debug?: (msg: string) => void;
25
+ }): T | null;
26
+ export { PLUGIN_SURFACE_REGISTRY, validateSurfaceRegistry, getSurfacesByCategory };
27
+ export type { PluginSurfaceEntry, MvpCategory };
@@ -0,0 +1,82 @@
1
+ import { PLUGIN_SURFACE_REGISTRY, validateSurfaceRegistry, getSurfacesByCategory, } from '@principles/core/runtime-v2';
2
+ export function checkSurfaceGuard() {
3
+ const validation = validateSurfaceRegistry(PLUGIN_SURFACE_REGISTRY);
4
+ const violations = [];
5
+ const warnings = [...validation.warnings];
6
+ const coreSurfaces = getSurfacesByCategory(PLUGIN_SURFACE_REGISTRY, 'core');
7
+ const enabledCore = coreSurfaces.filter(s => s.enabledByDefault);
8
+ const nonCoreEnabled = PLUGIN_SURFACE_REGISTRY.filter(s => s.category !== 'core' && s.enabledByDefault);
9
+ if (nonCoreEnabled.length > 0) {
10
+ for (const surface of nonCoreEnabled) {
11
+ violations.push(`non-core surface '${surface.id}' (${surface.category}) is enabledByDefault=true — must be false per ADR-0014`);
12
+ }
13
+ }
14
+ if (!validation.valid) {
15
+ violations.push(...validation.errors);
16
+ }
17
+ return {
18
+ passed: violations.length === 0,
19
+ enabledCoreSurfaces: enabledCore.map(s => s.id),
20
+ disabledNonCoreSurfaces: PLUGIN_SURFACE_REGISTRY
21
+ .filter(s => s.category !== 'core' && !s.enabledByDefault)
22
+ .map(s => s.id),
23
+ violations,
24
+ warnings,
25
+ };
26
+ }
27
+ export function getSurfaceIdForHook(hookEvent, label) {
28
+ if (label) {
29
+ return `hook:${hookEvent}.${label}`;
30
+ }
31
+ return `hook:${hookEvent}`;
32
+ }
33
+ export function getSurfaceIdForService(serviceName) {
34
+ return `service:${serviceName}`;
35
+ }
36
+ export function isSurfaceEnabled(surfaceId, overrides = {}) {
37
+ const entry = PLUGIN_SURFACE_REGISTRY.find(s => s.id === surfaceId);
38
+ if (!entry) {
39
+ return {
40
+ enabled: false,
41
+ reason: `surface '${surfaceId}' not found in registry — classify before enabling (PRI-289)`,
42
+ };
43
+ }
44
+ if (Object.hasOwn(overrides, surfaceId)) {
45
+ const override = overrides[surfaceId];
46
+ if (typeof override !== 'boolean') {
47
+ return { enabled: entry.enabledByDefault, reason: `override for '${surfaceId}' is not boolean, using default` };
48
+ }
49
+ if (entry.category === 'gone') {
50
+ return { enabled: false, reason: `surface '${surfaceId}' is gone and cannot be re-enabled` };
51
+ }
52
+ if (entry.category === 'core' && !override) {
53
+ return { enabled: true, reason: `surface '${surfaceId}' is core and cannot be disabled` };
54
+ }
55
+ return { enabled: override };
56
+ }
57
+ if (!entry.enabledByDefault && entry.disabledReason) {
58
+ return { enabled: false, reason: entry.disabledReason };
59
+ }
60
+ return { enabled: entry.enabledByDefault };
61
+ }
62
+ export function guardHook(surfaceId, logger, handler) {
63
+ const check = isSurfaceEnabled(surfaceId);
64
+ if (check.enabled) {
65
+ return handler;
66
+ }
67
+ const reason = check.reason ?? 'surface not enabled';
68
+ return (_event, _ctx) => {
69
+ logger?.info?.(`[PD:surface-guard] SKIP ${surfaceId}: ${reason}`);
70
+ return undefined;
71
+ };
72
+ }
73
+ export function guardService(surfaceId, service, logger) {
74
+ const check = isSurfaceEnabled(surfaceId);
75
+ if (check.enabled) {
76
+ return service;
77
+ }
78
+ const reason = check.reason ?? 'surface not enabled';
79
+ logger?.info?.(`[PD:surface-guard] SKIP service ${surfaceId}: ${reason}`);
80
+ return null;
81
+ }
82
+ export { PLUGIN_SURFACE_REGISTRY, validateSurfaceRegistry, getSurfacesByCategory };
@@ -3,19 +3,20 @@ import * as path from 'path';
3
3
  import { clearInjectedProbationIds, getSession, resetFriction, setInjectedProbationIds, trackFriction, decayGfi, getGfiDecayElapsed } from '../core/session-tracker.js';
4
4
  import { WorkspaceContext } from '../core/workspace-context.js';
5
5
  import { defaultContextConfig } from '../types.js';
6
- import { classifyTask } from '../core/local-worker-routing.js';
6
+ // local-worker-routing: removed from prompt injection per PRI-291 (MVP-Quiet)
7
+ // classifyTask is still available for non-prompt consumers
7
8
  import { extractSummary, getHistoryVersions, parseWorkingMemorySection, workingMemoryToInjection, autoCompressFocus, safeReadCurrentFocus } from '../core/focus-history.js';
8
9
  import { PathResolver } from '../core/path-resolver.js';
9
10
  import { selectPrinciplesForInjection, DEFAULT_PRINCIPLE_BUDGET } from '../core/principle-injection.js';
10
- import { getCachedMaskedPrincipleSet, WorkflowFunnelLoader, PiAiRuntimeAdapter, EmpathyObserver, AgentScheduler } from '@principles/core/runtime-v2';
11
+ import { getCachedMaskedPrincipleSet, WorkflowFunnelLoader, PiAiRuntimeAdapter, EmpathyObserver, AgentScheduler, RUNTIME_V2_PRINCIPLE_BUDGET, trimToBudget, renderPrinciplesToDirectives } from '@principles/core/runtime-v2';
11
12
  import { truncateInjectionToBudget } from '@principles/core/prompt-builder';
12
- import { PromptActivationReader, RUNTIME_V2_PRINCIPLE_BUDGET } from '../core/runtime-v2-prompt-activation-reader.js';
13
+ import { PromptActivationReader } from '../core/runtime-v2-prompt-activation-reader.js';
13
14
  import { matchEmpathyKeywords, loadKeywordStore, saveKeywordStore, getKeywordStoreSummary, } from '../core/empathy-keyword-matcher.js';
14
15
  import { severityToPenalty, DEFAULT_EMPATHY_KEYWORD_CONFIG } from '../core/empathy-types.js';
15
16
  import { evaluatePainDiagnosticGate } from '../core/pain-diagnostic-gate.js';
16
17
  import { emitPainDetectedEvent, buildTrajectoryEvidence } from './pain.js';
17
18
  import { CorrectionCueLearner } from '../core/correction-cue-learner.js';
18
- import { buildAttitudeDirective, detectCorrectionCue as coreDetectCorrectionCue, extractMessageContent, isMinimalTrigger, } from '@principles/core/prompt-builder';
19
+ import { detectCorrectionCue as coreDetectCorrectionCue, extractMessageContent, isMinimalTrigger, } from '@principles/core/prompt-builder';
19
20
  // ---------------------------------------------------------------------------
20
21
  // Static file cache — avoids re-reading rarely-changing files every message
21
22
  // ---------------------------------------------------------------------------
@@ -576,9 +577,9 @@ ${heartbeatChecklist}
576
577
  }
577
578
  }
578
579
  }
579
- // ──── 6. Dynamic Attitude Matrix (based on GFI) ────
580
- const currentGfi = session?.currentGfi || 0;
581
- const attitudeDirective = buildAttitudeDirective(currentGfi);
580
+ // ──── 6. GFI score (for empathy/evidence path only — NOT for attitude/personality prompt)
581
+ // Attitude/personality prompt injection removed per PRI-291 (MVP diet).
582
+ // GFI scoring, trackFriction, and empathy pain emission remain active.
582
583
  // ──── 7. appendSystemContext: Principles + Thinking OS + reflection_log + project_context ────
583
584
  // NOTE: Principles is ALWAYS injected (not configurable)
584
585
  // Thinking OS, reflection_log, project_context are configurable
@@ -750,19 +751,12 @@ ${heartbeatChecklist}
750
751
  }
751
752
  dedupedV2 = v2Result.principles.filter((p) => !legacyActiveIds.has(p.principleId));
752
753
  if (dedupedV2.length > 0) {
753
- let remaining = RUNTIME_V2_PRINCIPLE_BUDGET;
754
- const lines = [];
755
- lines.push('Runtime V2 activated principles (owner-approved):');
756
- remaining -= 'Runtime V2 activated principles (owner-approved):'.length;
757
- for (const p of dedupedV2) {
758
- const entry = `- [${escapeXml(p.principleId)}] ${escapeXml(p.text)}`;
759
- if (remaining < entry.length + 1) {
760
- logger?.info?.(`[PD:RuntimeV2] Principle budget reached (${RUNTIME_V2_PRINCIPLE_BUDGET}c) — truncating after ${lines.length - 1} principles`);
761
- break;
762
- }
763
- lines.push(entry);
764
- remaining -= entry.length + 1;
765
- runtimeV2PrincipleIds.add(p.principleId);
754
+ const { lines, injectedIds, truncated } = trimToBudget(dedupedV2, RUNTIME_V2_PRINCIPLE_BUDGET, escapeXml);
755
+ if (truncated) {
756
+ logger?.info?.(`[PD:RuntimeV2] Principle budget reached (${RUNTIME_V2_PRINCIPLE_BUDGET}c) — truncating after ${injectedIds.size} principles`);
757
+ }
758
+ for (const id of injectedIds) {
759
+ runtimeV2PrincipleIds.add(id);
766
760
  }
767
761
  runtimeV2PrinciplesContent = lines.join('\n');
768
762
  }
@@ -829,122 +823,12 @@ ${empathySilenceConstraint}
829
823
  // PLACED IN prependSystemContext (before gateway system prompt) for highest LLM attention.
830
824
  // These are owner-reviewed, validated behavior constraints — not background context.
831
825
  if (runtimeV2PrincipleIds.size > 0) {
832
- const directiveLines = [];
833
- directiveLines.push('');
834
- directiveLines.push('## 【OWNER-APPROVED BEHAVIOR DIRECTIVES】');
835
- directiveLines.push('');
836
- directiveLines.push('Owner-approved behavior directives are active operating constraints learned from prior owner corrections.');
837
- directiveLines.push('These directives are mandatory for this session unless they conflict with safety, security, or higher-priority system policy.');
838
- directiveLines.push('For ambiguous coding or file-changing tasks, follow these directives before using mutating tools.');
839
- directiveLines.push('');
840
- for (const p of dedupedV2) {
841
- if (!runtimeV2PrincipleIds.has(p.principleId))
842
- continue;
843
- directiveLines.push(`<directive id="${escapeXml(p.principleId)}" source="runtime_v2_activation">`);
844
- directiveLines.push(`MANDATORY: ${escapeXml(p.text)}`);
845
- directiveLines.push('Apply this as an active behavior constraint. Do not treat this as background context.');
846
- directiveLines.push('</directive>');
847
- directiveLines.push('');
848
- }
849
- directiveLines.push('Note: These directives do not override safety, security, or core system policy.');
850
- prependSystemContext += directiveLines.join('\n');
851
- }
852
- // Routing Guidance (section 5 — injected between evolution principles and core principles)
853
- // Inject delegation guidance when task is bounded + deployment allowed + not high-entropy.
854
- // This is a non-authoritative suggestion — the main agent decides whether to follow.
855
- // Shadow evidence comes from real runtime hooks (subagent_spawning/subagent_ended).
856
- if (!isMinimalMode && sessionId) {
857
- try {
858
- // Use the already extracted and cleaned user message
859
- const latestUserText = latestUserMessage || '';
860
- if (latestUserText && latestUserText.trim().length > 0) {
861
- // Infer requestedTools and requestedFiles from message content
862
- const toolPatterns = [
863
- { pattern: /\b(edit|replace|write|modify|update|fix|patch|add|remove|delete|insert)\b/gi, tool: 'edit' },
864
- { pattern: /\b(read|cat|view|show|get|find|search|grep|look|inspect|examine|list|head|tail|diff)\b/gi, tool: 'read' },
865
- { pattern: /\b(run|execute|exec|bash|shell|command)\b/gi, tool: 'bash' },
866
- ];
867
- const filePattern = /\b([a-zA-Z]:\\?[^\s,]+\.[a-z]{2,10}|[./][^\s,]+\.[a-z]{2,10})\b/gi;
868
- const toolMatches = toolPatterns.flatMap(({ pattern, tool }) => {
869
- const matches = [];
870
- const r = new RegExp(pattern.source, pattern.flags);
871
- while (r.exec(latestUserText) !== null)
872
- matches.push(tool);
873
- return matches;
874
- });
875
- const fileMatches = latestUserText.match(filePattern) ?? [];
876
- const routingInput = {
877
- taskIntent: toolMatches[0] ?? undefined,
878
- taskDescription: latestUserText.trim(),
879
- requestedFiles: fileMatches.length > 0 ? fileMatches : undefined,
880
- };
881
- const decision = classifyTask(routingInput, wctx.stateDir);
882
- // Inject guidance only when: route_local + deployable checkpoint + not high-entropy
883
- const isDeployableState = decision.activeCheckpointState === 'shadow_ready' ||
884
- decision.activeCheckpointState === 'promotable';
885
- if (decision.decision === 'route_local' &&
886
- decision.targetProfile !== null &&
887
- isDeployableState) {
888
- const profile = decision.targetProfile;
889
- if (profile === 'local-reader') {
890
- appendParts.push(`<routing_guidance>
891
- DELEGATION SUGGESTION: This task appears suitable for the local-reader subagent.
892
-
893
- **Task Fit**: ${decision.reason}
894
-
895
- **Suggested Action**: Consider routing to \`local-reader\` (pd-explorer skill) for focused reading, inspection, and information retrieval.
896
-
897
- **Why This Works**:
898
- - Task keywords indicate read-only or inspect operations
899
- - Bounded scope — no multi-file coordination needed
900
- - Shadow observation in progress — real runtime evidence being collected
901
-
902
- **Note**: This is a non-authoritative suggestion. The main agent decides whether to route based on full context. Shadow evidence from runtime hooks will inform future promotion decisions.
903
- </routing_guidance>`);
904
- }
905
- else if (profile === 'local-editor') {
906
- appendParts.push(`<routing_guidance>
907
- DELEGATION SUGGESTION: This task appears suitable for the local-editor subagent.
908
-
909
- **Task Fit**: ${decision.reason}
910
-
911
- **Suggested Action**: Consider routing to \`local-editor\` (pd-repair skill) for bounded editing, modification, and repair tasks.
912
-
913
- **Why This Works**:
914
- - Task keywords indicate bounded modification operations
915
- - Target files appear limited in scope (1-3 files)
916
- - Shadow observation in progress — real runtime evidence being collected
917
-
918
- **Note**: This is a non-authoritative suggestion. The main agent decides whether to route based on full context. Shadow evidence from runtime hooks will inform future promotion decisions.
919
- </routing_guidance>`);
920
- }
921
- }
922
- else if (decision.decision === 'stay_main' &&
923
- decision.classification !== 'reader_eligible' &&
924
- decision.classification !== 'editor_eligible') {
925
- // Only show stay_main guidance when the task is genuinely high-entropy/risk/ambiguous
926
- appendParts.push(`<routing_guidance>
927
- ROUTING GUIDANCE: Task should remain on the main agent.
928
-
929
- **Reason**: ${decision.reason}
930
-
931
- **Blockers**: ${decision.blockers.length > 0 ? decision.blockers.join('; ') : 'none'}
932
-
933
- **Why Stay Main**:
934
- - Task contains high-entropy signals (open-ended, multi-step, or ambiguous)
935
- - Or: task involves risk signals requiring main-agent supervision
936
- - Or: deployment not available for the natural target profile
937
-
938
- **Note**: This is a non-authoritative suggestion backed by policy classification. The main agent has full discretion.
939
- </routing_guidance>`);
940
- }
941
- }
942
- }
943
- catch (e) {
944
- // Routing guidance is best-effort — never fail the hook
945
- logger?.warn?.(`[PD:Prompt] Routing guidance injection failed: ${String(e)}`);
946
- }
826
+ const directiveText = renderPrinciplesToDirectives(dedupedV2, runtimeV2PrincipleIds, escapeXml);
827
+ prependSystemContext += directiveText;
947
828
  }
829
+ // Routing guidance removed per PRI-291 (MVP diet).
830
+ // Local worker routing is MVP-Quiet per ADR-0014 §2.5.
831
+ // The classifyTask helper and local-worker-routing module are preserved for non-prompt consumers.
948
832
  // 6. Principles (always on, highest priority, goes last for recency effect)
949
833
  if (principlesContent) {
950
834
  appendParts.push(`<core_principles>\n${principlesContent}\n</core_principles>`);
@@ -964,15 +848,8 @@ The sections below are ordered by priority. When conflicts arise, **later sectio
964
848
  **【EXECUTION RULES】** (Priority: Low → High):
965
849
  - \`<behavioral_constraints>\` - Output format restrictions (hide diagnostic JSON)
966
850
  - \`<project_context>\` - Current priorities (can be overridden)
967
- - \`<reflection_log>\` - Past lessons (inform your approach)
968
- - \`<thinking_os>\` - Thinking models (guide your reasoning)
969
- - \`<evolution_principles>\` - Newly learned principles (active + probation)
970
- - \`<routing_guidance>\` - Delegation suggestions (non-authoritative, best-effort)
851
+ - \`<evolution_principles>\` - Learned principles (active + probation)
971
852
  - \`<core_principles>\` - Core rules (NON-NEGOTIABLE, highest priority)
972
-
973
- **Remember**: You are the Spicy Evolver. You despise entropy. You evolve through pain.
974
-
975
- ${attitudeDirective}
976
853
  `;
977
854
  }
978
855
  // ──── 8. SIZE GUARD ────
@@ -18,10 +18,6 @@ export const commandDescriptions = {
18
18
  zh: '初始化工作区(生成 PRINCIPLES.md、THINKING_OS.md 等)',
19
19
  en: 'Initialize workspace (generate PRINCIPLES.md, THINKING_OS.md, etc.)'
20
20
  },
21
- 'pd-okr': {
22
- zh: '管理 OKR 目标与关键结果',
23
- en: 'Manage OKR goals and key results'
24
- },
25
21
  'pd-bootstrap': {
26
22
  zh: '扫描环境工具并建议升级',
27
23
  en: 'Scan environment tools and suggest upgrades'
@@ -31,16 +27,8 @@ export const commandDescriptions = {
31
27
  en: 'Research tool upgrade solutions'
32
28
  },
33
29
  'pd-thinking': {
34
- zh: '管理思维模型 [status|propose|audit]',
35
- en: 'Manage Thinking OS [status|propose|audit]'
36
- },
37
- 'pd-daily': {
38
- zh: '配置并发送进化日报',
39
- en: 'Configure and send daily evolution report'
40
- },
41
- 'pd-grooming': {
42
- zh: '工作区清理与大扫除',
43
- en: 'Workspace cleanup and grooming'
30
+ zh: '管理思维模型 [status|propose|audit](默认关闭,/pd-context thinking on 开启)',
31
+ en: 'Manage Thinking OS [status|propose|audit] (off by default, enable via /pd-context thinking on)'
44
32
  },
45
33
  'pd-help': {
46
34
  zh: '显示所有命令和使用指南',
@@ -1,8 +1,35 @@
1
1
  import type { OpenClawPluginApi } from './openclaw-sdk.js';
2
+ declare function isRecord(value: unknown): value is Record<string, unknown>;
3
+ declare function loadFeatureFlagFromWorkspace(workspaceDir: string, flagId: string, logger?: {
4
+ warn?: (msg: string) => void;
5
+ info?: (msg: string) => void;
6
+ }): {
7
+ enabled: boolean;
8
+ source: string;
9
+ };
10
+ export interface EvolutionWorkerGateResult {
11
+ shouldStart: boolean;
12
+ flagSource: string;
13
+ disabledInfo: string | null;
14
+ }
15
+ export declare function shouldStartEvolutionWorker(workspaceDir: string, logger: {
16
+ info?: (msg: string) => void;
17
+ warn?: (msg: string) => void;
18
+ }): EvolutionWorkerGateResult;
19
+ export interface CorrectionObserverGateResult {
20
+ shouldStart: boolean;
21
+ flagSource: string;
22
+ disabledInfo: string | null;
23
+ }
24
+ export declare function shouldStartCorrectionObserver(workspaceDir: string, logger: {
25
+ info?: (msg: string) => void;
26
+ warn?: (msg: string) => void;
27
+ }): CorrectionObserverGateResult;
2
28
  declare const plugin: {
3
29
  name: string;
4
30
  description: string;
5
31
  register(api: OpenClawPluginApi): void;
6
32
  };
7
33
  export { PrincipleTreeLedgerAdapter } from './core/principle-tree-ledger-adapter.js';
34
+ export { loadFeatureFlagFromWorkspace, isRecord };
8
35
  export default plugin;