oh-my-knowledge 0.48.0 → 0.49.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 (243) hide show
  1. package/README.md +50 -18
  2. package/README.zh.md +55 -23
  3. package/dist/analysis/coverage-analyzer.d.ts +1 -0
  4. package/dist/analysis/coverage-analyzer.js +125 -62
  5. package/dist/analysis/failure-clusterer.js +2 -1
  6. package/dist/analysis/gap-analyzer.d.ts +2 -2
  7. package/dist/analysis/gap-analyzer.js +13 -3
  8. package/dist/analysis/hedging-classifier.d.ts +2 -2
  9. package/dist/analysis/hedging-classifier.js +3 -4
  10. package/dist/analysis/report-diagnostics.js +9 -7
  11. package/dist/analysis/sample-diagnostics.js +6 -6
  12. package/dist/artifact-graph/doctor.js +15 -7
  13. package/dist/assets/agent-skills/omk/SKILL.md +27 -7
  14. package/dist/assets/agent-skills/omk/references/commands.md +18 -17
  15. package/dist/authoring/evolver.d.ts +10 -6
  16. package/dist/authoring/evolver.js +496 -83
  17. package/dist/authoring/generator.d.ts +3 -3
  18. package/dist/authoring/generator.js +5 -10
  19. package/dist/authoring/sample-fixer.d.ts +8 -6
  20. package/dist/authoring/sample-fixer.js +76 -5
  21. package/dist/cli/commands/doctor.js +31 -14
  22. package/dist/cli/commands/eval/index.d.ts +3 -0
  23. package/dist/cli/commands/eval/index.js +163 -17
  24. package/dist/cli/commands/evolve.d.ts +4 -4
  25. package/dist/cli/commands/evolve.js +27 -13
  26. package/dist/cli/commands/init.js +16 -3
  27. package/dist/cli/commands/observe/inbox.js +28 -21
  28. package/dist/cli/commands/observe/index.js +20 -11
  29. package/dist/cli/commands/observe/ingest.d.ts +3 -0
  30. package/dist/cli/commands/observe/ingest.js +30 -2
  31. package/dist/cli/commands/sample.d.ts +6 -3
  32. package/dist/cli/commands/sample.js +72 -68
  33. package/dist/cli/lib/codex-model-hint.d.ts +9 -0
  34. package/dist/cli/lib/codex-model-hint.js +45 -0
  35. package/dist/cli/lib/generation-failure-hint.d.ts +2 -0
  36. package/dist/cli/lib/generation-failure-hint.js +61 -0
  37. package/dist/cli/lib/i18n-dict/common.d.ts +1 -1
  38. package/dist/cli/lib/i18n-dict/common.js +4 -0
  39. package/dist/cli/lib/i18n-dict/gen.d.ts +1 -1
  40. package/dist/cli/lib/i18n-dict/gen.js +38 -6
  41. package/dist/cli/lib/i18n-dict/help.js +6 -6
  42. package/dist/cli/lib/i18n-dict/init.d.ts +1 -1
  43. package/dist/cli/lib/i18n-dict/init.js +13 -9
  44. package/dist/cli/lib/i18n-dict/run.d.ts +1 -1
  45. package/dist/cli/lib/i18n-dict/run.js +34 -2
  46. package/dist/cli/lib/llm-failure-classifier.d.ts +2 -0
  47. package/dist/cli/lib/llm-failure-classifier.js +8 -0
  48. package/dist/cli/lib/parse-run-config.d.ts +6 -5
  49. package/dist/cli/lib/parse-run-config.js +16 -9
  50. package/dist/cli/lib/runtime-defaults.d.ts +21 -0
  51. package/dist/cli/lib/runtime-defaults.js +79 -0
  52. package/dist/diagnosis/observe-mapper.js +14 -15
  53. package/dist/diagnosis/observe-producer.js +3 -1
  54. package/dist/diagnosis/studio-projection.js +14 -7
  55. package/dist/diagnosis/types.d.ts +2 -0
  56. package/dist/diagnosis/types.js +12 -0
  57. package/dist/doctor/endpoint-rule.js +2 -1
  58. package/dist/eval-core/artifact-file-names.js +18 -1
  59. package/dist/eval-core/artifact-index.d.ts +7 -11
  60. package/dist/eval-core/artifact-index.js +139 -80
  61. package/dist/eval-core/cache.d.ts +12 -3
  62. package/dist/eval-core/cache.js +89 -29
  63. package/dist/eval-core/comparability.js +10 -6
  64. package/dist/eval-core/evaluation-execution.d.ts +2 -1
  65. package/dist/eval-core/evaluation-execution.js +122 -37
  66. package/dist/eval-core/evaluation-job.d.ts +4 -1
  67. package/dist/eval-core/evaluation-job.js +4 -1
  68. package/dist/eval-core/evaluation-reporting.d.ts +15 -13
  69. package/dist/eval-core/evaluation-reporting.js +54 -52
  70. package/dist/eval-core/execution-strategy.d.ts +2 -0
  71. package/dist/eval-core/execution-strategy.js +11 -9
  72. package/dist/eval-core/fact-checker.js +15 -7
  73. package/dist/eval-core/holdout.js +3 -2
  74. package/dist/eval-core/judge-independence.d.ts +2 -2
  75. package/dist/eval-core/mock-hook.cjs +23 -6
  76. package/dist/eval-core/mocks-runtime.js +30 -8
  77. package/dist/eval-core/report-document.d.ts +12 -0
  78. package/dist/eval-core/report-document.js +1151 -0
  79. package/dist/eval-core/report-extensions.d.ts +4 -0
  80. package/dist/eval-core/report-extensions.js +500 -0
  81. package/dist/eval-core/report-file-migration.js +7 -2
  82. package/dist/eval-core/resume-compatibility.d.ts +31 -0
  83. package/dist/eval-core/resume-compatibility.js +141 -0
  84. package/dist/eval-core/sample-fingerprint.d.ts +12 -0
  85. package/dist/eval-core/sample-fingerprint.js +193 -0
  86. package/dist/eval-core/schema.js +86 -31
  87. package/dist/eval-core/verdict.d.ts +8 -4
  88. package/dist/eval-core/verdict.js +24 -10
  89. package/dist/eval-workflows/batch-evaluation-workflow.d.ts +2 -1
  90. package/dist/eval-workflows/batch-evaluation-workflow.js +25 -12
  91. package/dist/eval-workflows/evaluation-pipeline/preflight-warnings.d.ts +10 -5
  92. package/dist/eval-workflows/evaluation-pipeline/preflight-warnings.js +58 -21
  93. package/dist/eval-workflows/evaluation-pipeline/report-finalize.js +3 -1
  94. package/dist/eval-workflows/evaluation-pipeline/run-state.d.ts +4 -1
  95. package/dist/eval-workflows/evaluation-pipeline/run-state.js +4 -1
  96. package/dist/eval-workflows/evaluation-pipeline/test-set-hash.d.ts +6 -5
  97. package/dist/eval-workflows/evaluation-pipeline/test-set-hash.js +17 -10
  98. package/dist/eval-workflows/evaluation-pipeline.js +12 -7
  99. package/dist/eval-workflows/run-evaluation.d.ts +9 -7
  100. package/dist/eval-workflows/run-evaluation.js +79 -51
  101. package/dist/executors/anthropic-api.js +65 -9
  102. package/dist/executors/claude-cli.js +16 -79
  103. package/dist/executors/claude-protocol.d.ts +28 -0
  104. package/dist/executors/claude-protocol.js +180 -0
  105. package/dist/executors/claude-sdk-trace.js +56 -28
  106. package/dist/executors/claude-sdk.d.ts +1 -0
  107. package/dist/executors/claude-sdk.js +39 -93
  108. package/dist/executors/codex-cli-trace.js +166 -31
  109. package/dist/executors/codex-cli.d.ts +6 -8
  110. package/dist/executors/codex-cli.js +49 -151
  111. package/dist/executors/codex-protocol.d.ts +24 -0
  112. package/dist/executors/codex-protocol.js +234 -0
  113. package/dist/executors/codex-sdk.js +68 -120
  114. package/dist/executors/gemini.js +88 -13
  115. package/dist/executors/index.d.ts +2 -3
  116. package/dist/executors/index.js +5 -3
  117. package/dist/executors/openai-api.js +70 -9
  118. package/dist/executors/runtime-fingerprint.js +88 -11
  119. package/dist/executors/script-command.d.ts +8 -0
  120. package/dist/executors/script-command.js +87 -0
  121. package/dist/executors/script.js +202 -29
  122. package/dist/executors/shared.d.ts +35 -3
  123. package/dist/executors/shared.js +113 -15
  124. package/dist/grading/assertions.d.ts +1 -1
  125. package/dist/grading/assertions.js +19 -9
  126. package/dist/grading/diagnostic.d.ts +9 -2
  127. package/dist/grading/diagnostic.js +25 -2
  128. package/dist/grading/index.js +10 -4
  129. package/dist/grading/judge.js +19 -6
  130. package/dist/grading/layered-scores.d.ts +2 -3
  131. package/dist/grading/layered-scores.js +2 -3
  132. package/dist/inputs/load-samples.d.ts +1 -2
  133. package/dist/inputs/load-samples.js +23 -1
  134. package/dist/inputs/mcp-resolver.js +6 -3
  135. package/dist/inputs/sample-document.d.ts +11 -0
  136. package/dist/inputs/sample-document.js +96 -0
  137. package/dist/managed/evidence.d.ts +1 -0
  138. package/dist/managed/evidence.js +1 -1
  139. package/dist/managed/store.js +200 -91
  140. package/dist/observability/codex-trace-adapter.d.ts +5 -0
  141. package/dist/observability/codex-trace-adapter.js +850 -0
  142. package/dist/observability/experience.d.ts +32 -6
  143. package/dist/observability/experience.js +2695 -459
  144. package/dist/observability/feedback-matchers.js +16 -1
  145. package/dist/observability/inbox-view-model.d.ts +1 -1
  146. package/dist/observability/inbox-view-model.js +19 -14
  147. package/dist/observability/inbox.d.ts +7 -1
  148. package/dist/observability/inbox.js +632 -124
  149. package/dist/observability/problem-patterns.js +2 -0
  150. package/dist/observability/review-state.d.ts +6 -0
  151. package/dist/observability/review-state.js +235 -63
  152. package/dist/observability/skill-chain-advisories.js +1 -1
  153. package/dist/observability/skill-chain.js +17 -4
  154. package/dist/observability/skill-health-analyzer.d.ts +32 -7
  155. package/dist/observability/skill-health-analyzer.js +194 -121
  156. package/dist/observability/skill-health-report.d.ts +10 -0
  157. package/dist/observability/skill-health-report.js +620 -0
  158. package/dist/observability/soft-standards/constants.d.ts +0 -1
  159. package/dist/observability/soft-standards/constants.js +0 -1
  160. package/dist/observability/soft-standards/index.d.ts +1 -1
  161. package/dist/observability/soft-standards/index.js +1 -1
  162. package/dist/observability/soft-standards/llm-extractor.js +8 -10
  163. package/dist/observability/soft-standards/skill-standards-store.d.ts +2 -1
  164. package/dist/observability/soft-standards/skill-standards-store.js +59 -18
  165. package/dist/observability/soft-standards/types.d.ts +2 -2
  166. package/dist/observability/trace-adapter.d.ts +12 -7
  167. package/dist/observability/trace-adapter.js +11 -9
  168. package/dist/observability/trace-attribution.d.ts +13 -5
  169. package/dist/observability/trace-attribution.js +315 -21
  170. package/dist/observability/trace-ingestion.d.ts +9 -0
  171. package/dist/observability/trace-ingestion.js +80 -0
  172. package/dist/observability/trace-ir.d.ts +113 -0
  173. package/dist/observability/trace-ir.js +87 -0
  174. package/dist/observability/trace-segmenter.d.ts +19 -6
  175. package/dist/observability/trace-segmenter.js +377 -196
  176. package/dist/observability/trace-session-index.d.ts +19 -0
  177. package/dist/observability/trace-session-index.js +68 -0
  178. package/dist/observability/trace-source.d.ts +12 -4
  179. package/dist/observability/trace-source.js +939 -215
  180. package/dist/renderer/html-renderer.js +37 -6
  181. package/dist/renderer/icons.js +3 -0
  182. package/dist/renderer/observation-inbox-renderer.js +208 -90
  183. package/dist/renderer/skill-detail-renderer.js +452 -109
  184. package/dist/renderer/skill-health-renderer.js +69 -12
  185. package/dist/renderer/summary.js +28 -7
  186. package/dist/renderer/table.js +21 -4
  187. package/dist/renderer/test-view.d.ts +1 -0
  188. package/dist/renderer/test-view.js +44 -9
  189. package/dist/server/indexed-report-store.js +14 -18
  190. package/dist/server/job-store.js +64 -26
  191. package/dist/server/report-server.js +190 -78
  192. package/dist/server/report-store.js +57 -80
  193. package/dist/server/skill-index.js +143 -49
  194. package/dist/server/skill-insights.js +44 -5
  195. package/dist/shared/artifact-graph.d.ts +3 -0
  196. package/dist/shared/artifact-graph.js +224 -0
  197. package/dist/shared/assertion-types.d.ts +8 -0
  198. package/dist/shared/assertion-types.js +46 -0
  199. package/dist/shared/atomic-json.d.ts +8 -0
  200. package/dist/shared/atomic-json.js +33 -0
  201. package/dist/shared/diagnosis-schema.d.ts +9 -0
  202. package/dist/shared/diagnosis-schema.js +181 -0
  203. package/dist/shared/doctor-report.d.ts +3 -0
  204. package/dist/shared/doctor-report.js +103 -0
  205. package/dist/shared/evaluation-job.d.ts +6 -0
  206. package/dist/shared/evaluation-job.js +217 -0
  207. package/dist/shared/executor-result.d.ts +17 -0
  208. package/dist/shared/executor-result.js +221 -0
  209. package/dist/shared/file-lock.d.ts +12 -0
  210. package/dist/shared/file-lock.js +129 -0
  211. package/dist/shared/json-value.d.ts +5 -0
  212. package/dist/shared/json-value.js +36 -0
  213. package/dist/shared/keyed-mutex.d.ts +7 -0
  214. package/dist/shared/keyed-mutex.js +24 -0
  215. package/dist/shared/record-count.d.ts +8 -0
  216. package/dist/shared/record-count.js +43 -0
  217. package/dist/shared/sample-contract.d.ts +3 -0
  218. package/dist/shared/sample-contract.js +332 -0
  219. package/dist/shared/timestamp.d.ts +6 -0
  220. package/dist/shared/timestamp.js +64 -0
  221. package/dist/shared/token-usage.d.ts +19 -0
  222. package/dist/shared/token-usage.js +50 -0
  223. package/dist/shared/tool-call-status.d.ts +8 -0
  224. package/dist/shared/tool-call-status.js +28 -0
  225. package/dist/shared/tool-identity.d.ts +21 -0
  226. package/dist/shared/tool-identity.js +84 -0
  227. package/dist/shared/tool-search.js +73 -16
  228. package/dist/shared/trace-projection.d.ts +5 -0
  229. package/dist/shared/trace-projection.js +20 -0
  230. package/dist/shared/trace-source-kind.d.ts +3 -0
  231. package/dist/shared/trace-source-kind.js +12 -0
  232. package/dist/types/diagnosis.d.ts +2 -0
  233. package/dist/types/eval.d.ts +4 -0
  234. package/dist/types/executor.d.ts +32 -5
  235. package/dist/types/index.d.ts +1 -0
  236. package/dist/types/index.js +1 -0
  237. package/dist/types/judge.d.ts +2 -0
  238. package/dist/types/observability.d.ts +116 -9
  239. package/dist/types/report.d.ts +58 -6
  240. package/dist/types/skill-index.d.ts +7 -0
  241. package/dist/types/trace.d.ts +2 -0
  242. package/dist/types/trace.js +1 -0
  243. package/package.json +9 -5
@@ -59,11 +59,13 @@ const USER_GOAL_SHIFT_TERMS = [
59
59
  '新启动一个',
60
60
  '另开一个',
61
61
  '再开一个',
62
- '参考apply-cc的能力新开',
63
62
  '拉下最新',
64
63
  '拉取最新',
65
64
  '切到最新',
66
65
  ];
66
+ const USER_GOAL_SHIFT_PATTERNS = [
67
+ /参考.{0,40}(?:能力|skill).{0,20}(?:新开|另开|启动)/gi,
68
+ ];
67
69
  const NEGATIVE_FEEDBACK_TERMS = [
68
70
  '没有用',
69
71
  '没用',
@@ -168,6 +170,9 @@ export function findUserGoalShiftMatches(value) {
168
170
  for (const term of USER_GOAL_SHIFT_TERMS) {
169
171
  pushTermMatches(value, term, ranges, false);
170
172
  }
173
+ for (const pattern of USER_GOAL_SHIFT_PATTERNS) {
174
+ pushPatternMatches(value, pattern, ranges);
175
+ }
171
176
  return ranges.sort((a, b) => a.start - b.start);
172
177
  }
173
178
  export function hasUserGoalShiftSignal(value) {
@@ -224,6 +229,16 @@ function pushTermMatches(value, term, ranges, requireBoundary, caseInsensitive =
224
229
  index = haystack.indexOf(needle, index + needle.length);
225
230
  }
226
231
  }
232
+ function pushPatternMatches(value, pattern, ranges) {
233
+ pattern.lastIndex = 0;
234
+ for (const match of value.matchAll(pattern)) {
235
+ const start = match.index;
236
+ const end = start + match[0].length;
237
+ if (!ranges.some((range) => start < range.end && end > range.start)) {
238
+ ranges.push({ start, end });
239
+ }
240
+ }
241
+ }
227
242
  function isTextBoundary(value) {
228
243
  if (value === undefined)
229
244
  return true;
@@ -31,7 +31,7 @@ export interface ObservationInboxViewModelOptions {
31
31
  }
32
32
  export declare function buildObservationInboxViewModel(observationsDir: string, options?: ObservationInboxViewModelOptions): ObservationInboxViewModel;
33
33
  export { severityReasonFor } from './inbox.js';
34
- export { observationMetricAnnotationTargetId } from './review-state.js';
34
+ export { observationMetricAnnotationEntry, observationMetricAnnotationTargetId, } from './review-state.js';
35
35
  export { resolveObservationReviewSession } from './resolved-review.js';
36
36
  export { getSkillChainAdvisory, resolveAdvisoryCommand } from './skill-chain-advisories.js';
37
37
  export { ASSISTANT_DELIVERABLE_ARTIFACT_RE, hasAssistantDeliverableArtifactText, hasAssistantDeliverySignalText, hasUserHardRuleText, HARD_RULE_TEXT_RE, isAssistantProgressUpdateText, isScheduledTaskPromptText, isSyntheticUserMessageText, isUserInteractionMetricText, } from './text-signals.js';
@@ -4,6 +4,7 @@ import { resolveObservationReviewSession, } from './resolved-review.js';
4
4
  import { buildObservationSkillChains } from './skill-chain.js';
5
5
  import { loadSkillDerivedStandards, resolveSkillStandards, } from './soft-standards/index.js';
6
6
  import { durationMsBetween } from '../shared/time.js';
7
+ import { incrementRecordCount, ownRecordValue, setOwnRecordValue, } from '../shared/record-count.js';
7
8
  export function buildObservationInboxViewModel(observationsDir, options = {}) {
8
9
  const activeSkill = options.skill?.trim() || undefined;
9
10
  const allItems = filterItemsBySkill(queryObservationInbox(observationsDir), activeSkill);
@@ -12,30 +13,31 @@ export function buildObservationInboxViewModel(observationsDir, options = {}) {
12
13
  const experienceReports = reports.flatMap((report) => report.experience ? [report.experience] : []);
13
14
  const skillInvocationCounts = reports.reduce((acc, report) => {
14
15
  for (const [skill, count] of Object.entries(report.meta.skillInvocationCounts ?? {})) {
15
- acc[skill] = (acc[skill] ?? 0) + count;
16
+ incrementRecordCount(acc, skill, count);
16
17
  }
17
18
  return acc;
18
19
  }, {});
19
20
  const skillSessionCounts = reports.reduce((acc, report) => {
20
21
  for (const [skill, count] of Object.entries(report.meta.skillSessionCounts ?? {})) {
21
- acc[skill] = (acc[skill] ?? 0) + count;
22
+ incrementRecordCount(acc, skill, count);
22
23
  }
23
24
  return acc;
24
25
  }, {});
25
26
  const skillInvocationLastSeen = reports.reduce((acc, report) => {
26
27
  for (const [skill, timestamp] of Object.entries(report.meta.skillInvocationLastSeen ?? {})) {
27
- if (!acc[skill] || timestamp > acc[skill])
28
- acc[skill] = timestamp;
28
+ const previous = ownRecordValue(acc, skill);
29
+ if (!previous || timestamp > previous)
30
+ setOwnRecordValue(acc, skill, timestamp);
29
31
  }
30
32
  return acc;
31
33
  }, {});
32
34
  const skillToolCallCounts = reports.reduce((acc, report) => {
33
35
  for (const [skill, counts] of Object.entries(report.meta.skillToolCallCounts ?? {})) {
34
- const target = acc[skill] ?? {};
36
+ const target = ownRecordValue(acc, skill) ?? {};
35
37
  for (const [tool, count] of Object.entries(counts)) {
36
- target[tool] = (target[tool] ?? 0) + count;
38
+ incrementRecordCount(target, tool, count);
37
39
  }
38
- acc[skill] = target;
40
+ setOwnRecordValue(acc, skill, target);
39
41
  }
40
42
  return acc;
41
43
  }, {});
@@ -54,25 +56,28 @@ export function buildObservationInboxViewModel(observationsDir, options = {}) {
54
56
  ...experienceReports.flatMap((report) => report.skills.map((skill) => skill.skillName)),
55
57
  ]));
56
58
  const skillChains = buildObservationSkillChains(skillNames, process.cwd(), experienceReports);
57
- const skillDerivedStandards = loadSkillDerivedStandards(observationsDir);
59
+ const reviewState = loadObservationReviewState(observationsDir);
60
+ const skillDerivedStandards = loadSkillDerivedStandards(observationsDir, reviewState);
58
61
  const skillResolvedStandards = Object.fromEntries(skillNames.map((skillName) => [skillName, resolveSkillStandards(skillName, {
59
62
  observationsDir,
60
63
  skillChain: skillChains[skillName],
61
64
  derivedStandards: skillDerivedStandards,
62
65
  })]));
63
- const latestSeen = allItems.reduce((latest, item) => item.lastSeen > latest ? item.lastSeen : latest, '');
66
+ const latestSeen = allItems
67
+ .filter((item) => (item.timestampedOccurrences
68
+ ?? (item.firstSeen === '1970-01-01T00:00:00.000Z' ? 0 : item.occurrences)) > 0)
69
+ .reduce((latest, item) => item.lastSeen > latest ? item.lastSeen : latest, '');
64
70
  const reportCount = reports.length;
65
71
  const latestSeenLabel = latestSeen ? latestSeen.slice(0, 19).replace('T', ' ') : '—';
66
- const reviewState = loadObservationReviewState(observationsDir);
67
72
  const resolvedReviewSessions = {};
68
73
  for (const experience of experienceReports) {
69
74
  for (const session of experience.sessions) {
70
- const enhancedReview = skillDerivedStandards[session.skillName]?.enhancedReview;
71
- resolvedReviewSessions[session.id] = resolveObservationReviewSession({
75
+ const enhancedReview = ownRecordValue(skillDerivedStandards, session.skillName)?.enhancedReview;
76
+ setOwnRecordValue(resolvedReviewSessions, session.id, resolveObservationReviewSession({
72
77
  session,
73
78
  enhancedReview,
74
79
  reviewState,
75
- });
80
+ }));
76
81
  }
77
82
  }
78
83
  return {
@@ -174,7 +179,7 @@ function buildReportSessionTimeRange(ranges = []) {
174
179
  // 继续直接 import observability 内部 —— 它们不是「视图」,不在 facade 收敛范围。
175
180
  // ============================================================================
176
181
  export { severityReasonFor } from './inbox.js';
177
- export { observationMetricAnnotationTargetId } from './review-state.js';
182
+ export { observationMetricAnnotationEntry, observationMetricAnnotationTargetId, } from './review-state.js';
178
183
  export { resolveObservationReviewSession } from './resolved-review.js';
179
184
  export { getSkillChainAdvisory, resolveAdvisoryCommand } from './skill-chain-advisories.js';
180
185
  export { ASSISTANT_DELIVERABLE_ARTIFACT_RE, hasAssistantDeliverableArtifactText, hasAssistantDeliverySignalText, hasUserHardRuleText, HARD_RULE_TEXT_RE, isAssistantProgressUpdateText, isScheduledTaskPromptText, isSyntheticUserMessageText, isUserInteractionMetricText, } from './text-signals.js';
@@ -1,9 +1,14 @@
1
1
  import type { BuildObservationInboxReportOptions, ObservationEvidence, ObservationInboxItem, ObservationInboxReport, ObservationMessageRef, ObservationMessageWindow, ObservationSessionTimeRange, ObservationSeverityReasonCode, ObservationSignalSubtype, ObservationSignalType, ObservationSkillRollup, ObservationSourceKind } from '../types/index.js';
2
+ import { type PersistedObservationExperienceReport } from './experience.js';
2
3
  export type { BuildObservationInboxReportOptions, ObservationEvidence, ObservationInboxItem, ObservationInboxReport, ObservationMessageRef, ObservationMessageWindow, ObservationSessionTimeRange, ObservationSeverityReasonCode, ObservationSignalSubtype, ObservationSignalType, ObservationSkillRollup, ObservationSourceKind, };
4
+ export type PersistedObservationInboxReport = Omit<ObservationInboxReport, 'experience'> & {
5
+ experience?: PersistedObservationExperienceReport;
6
+ };
3
7
  export declare const DEFAULT_PROJECT_OBSERVATIONS_DIR: string;
4
8
  export declare const DEFAULT_GLOBAL_OBSERVATIONS_DIR: string;
5
9
  export declare const DEFAULT_OBSERVATIONS_DIR: string;
6
10
  export declare function normalizeObservationKeyInput(value: unknown): string;
11
+ /** Legacy migration only. New reports take sourceKind from Trace IR. */
7
12
  export declare function inferObservationSourceKind(sourceTrace: string): ObservationSourceKind;
8
13
  export declare function severityReasonFor(item: Pick<ObservationInboxItem, 'signalType' | 'signalSubtype' | 'severity' | 'confidence' | 'evidence' | 'severityReasonCode'>, lang?: 'zh' | 'en'): string;
9
14
  export declare function legacySeverityReasonFor(item: Pick<ObservationInboxItem, 'signalType' | 'signalSubtype' | 'severity' | 'confidence' | 'evidence'>): string;
@@ -16,12 +21,13 @@ export declare function severityReasonCodeFor(item: Pick<ObservationInboxItem, '
16
21
  export declare function buildObservationInboxReport(tracePath: string, options?: BuildObservationInboxReportOptions): ObservationInboxReport;
17
22
  export declare function aggregateInboxItems(items: ObservationInboxItem[]): ObservationInboxItem[];
18
23
  export declare function saveObservationInboxReport(report: ObservationInboxReport, outDir?: string): string;
24
+ export declare function compactObservationInboxReport(report: ObservationInboxReport): PersistedObservationInboxReport;
19
25
  export declare function loadObservationInboxReports(dir?: string): ObservationInboxReport[];
20
26
  export declare function loadLatestObservationInboxReport(dir?: string): ObservationInboxReport | null;
21
27
  export declare function loadLatestObservationInboxReports(dir?: string): ObservationInboxReport[];
22
28
  export declare function queryObservationInbox(dir?: string): ObservationInboxItem[];
23
29
  export declare function summarizeObservationInboxBySkill(items: ObservationInboxItem[], reports?: ObservationInboxReport[]): ObservationSkillRollup[];
24
30
  export declare function findObservationInboxItem(id: string, dir?: string): ObservationInboxItem | null;
25
- export declare function buildObservationMessageWindow(item: Pick<ObservationInboxItem, 'sourceTrace' | 'signalType' | 'evidence'>, radius?: number): ObservationMessageWindow | undefined;
31
+ export declare function buildObservationMessageWindow(item: Pick<ObservationInboxItem, 'sourceTrace' | 'signalType' | 'evidence'>, radius?: number, preloadedMessages?: ObservationMessageRef[]): ObservationMessageWindow | undefined;
26
32
  export declare function formatObservationShow(item: ObservationInboxItem): string;
27
33
  export declare function selectExploreInboxItems(items: ObservationInboxItem[], limit: number, includeNoise?: boolean, random?: () => number): ObservationInboxItem[];