hyntx 4.0.0 → 4.1.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.
package/dist/index.d.ts CHANGED
@@ -259,6 +259,23 @@ type Metrics = {
259
259
  readonly byHour: readonly number[];
260
260
  /** Typed prompts per weekday, index 0 = Sunday. */
261
261
  readonly byWeekday: readonly number[];
262
+ /**
263
+ * Typed prompts that have a typed prompt from another session within
264
+ * `PARALLEL_WINDOW_MINUTES`. Descriptive only, never an insight.
265
+ */
266
+ readonly parallelSessions: {
267
+ readonly overlappingPrompts: number;
268
+ readonly sessionsInvolved: number;
269
+ /** overlappingPrompts / typed prompts; 0 without prompts. */
270
+ readonly share: number;
271
+ };
272
+ /**
273
+ * Seconds between the end of one turn and the next typed prompt of the same
274
+ * session, keeping only gaps of 2 s to 1 h.
275
+ */
276
+ readonly responseTime: Distribution & {
277
+ readonly samples: number;
278
+ };
262
279
  };
263
280
  };
264
281
  /** Compact per-day record; persisted under ~/.hyntx so trends outlive logs. */
@@ -383,6 +400,8 @@ type InsightAction = {
383
400
  readonly file: string;
384
401
  /** Exact line(s) to append. */
385
402
  readonly text: string;
403
+ /** Existing heading the line fits under; absent when none matches. */
404
+ readonly section?: string;
386
405
  } | {
387
406
  readonly kind: 'permission-allow';
388
407
  readonly patterns: readonly string[];
@@ -434,13 +453,27 @@ type DataQuality = {
434
453
  readonly filesFailed?: number;
435
454
  /** Sessions with no prompt, tool call or reply that were left out. */
436
455
  readonly emptySessionsSkipped?: number;
456
+ /** Headless sessions (SDK entrypoints): counted in totals, left out of episodes. */
457
+ readonly automatedSessions?: number;
458
+ /** Quick one-off sessions: counted in totals, left out of per-session distributions. */
459
+ readonly trivialSessions?: number;
437
460
  /** False when there is too little data for trustworthy findings. */
438
461
  readonly enoughData: boolean;
439
462
  /** Human-readable caveats; engines append theirs. */
440
463
  readonly notes: readonly string[];
441
464
  };
442
465
  type InterpretationVerdict = 'confirmed' | 'rejected' | 'unclear';
443
- type InsightState = 'confirmed' | 'dismissed' | 'unverified';
466
+ /** Why a confirmed correction happened; engines pick one, anything else becomes `other`. */
467
+ declare const CorrectionCause: {
468
+ readonly MISUNDERSTOOD_REQUEST: "misunderstood-request";
469
+ readonly WRONG_APPROACH: "wrong-approach";
470
+ readonly BUGGY_CODE: "buggy-code";
471
+ readonly EXCESSIVE_CHANGES: "excessive-changes";
472
+ readonly WRONG_LOCATION: "wrong-location";
473
+ readonly OTHER: "other";
474
+ };
475
+ type CorrectionCause = (typeof CorrectionCause)[keyof typeof CorrectionCause];
476
+ type InsightState = 'confirmed' | 'dismissed' | 'unverified' | 'not-needed';
444
477
  /**
445
478
  * What the interpretation step did with one insight. Renderers and the plugin
446
479
  * digest all read this, so they agree on what is shown and what is hidden.
@@ -457,6 +490,8 @@ type InsightReview = {
457
490
  readonly confirmed: number;
458
491
  readonly rejected: number;
459
492
  readonly unclear: number;
493
+ /** Causes of the confirmed corrections, only when an engine gave any. */
494
+ readonly causes?: Readonly<Partial<Record<CorrectionCause, number>>>;
460
495
  };
461
496
  /** Filled by the LLM interpretation step (phase 2). */
462
497
  type Interpretation = {
@@ -468,6 +503,8 @@ type Interpretation = {
468
503
  readonly episodeId: string;
469
504
  readonly verdict: InterpretationVerdict;
470
505
  readonly note: string;
506
+ /** Only on a confirmed `correction` episode. */
507
+ readonly cause?: CorrectionCause;
471
508
  }[];
472
509
  readonly recommendations: readonly {
473
510
  readonly title: string;
@@ -499,7 +536,7 @@ type Report = {
499
536
  readonly episodes: readonly Episode[];
500
537
  readonly promptTraits: readonly PromptTraitFinding[];
501
538
  readonly insights: readonly Insight[];
502
- /** One entry per insight; all `unverified` without an interpretation. */
539
+ /** One entry per insight; `unverified`, or `not-needed` for counted facts, without an interpretation. */
503
540
  readonly insightReviews: readonly InsightReview[];
504
541
  readonly interpretation: Interpretation | null;
505
542
  };
@@ -572,6 +609,18 @@ declare function mergeDaily(stored: readonly DailyPoint[], fresh: readonly Daily
572
609
  */
573
610
  declare function saveDailyHistory(days: readonly DailyPoint[], filePath?: string): Promise<void>;
574
611
 
612
+ /**
613
+ * Reads the headings of existing CLAUDE.md files (read-only) so a suggested
614
+ * rule can say which section it belongs under. Nothing is ever written.
615
+ */
616
+
617
+ type ClaudeMdHeadings = {
618
+ /** Headings of `~/.claude/CLAUDE.md`. */
619
+ readonly user: readonly string[];
620
+ /** Headings of each project's own `CLAUDE.md`, by project name. */
621
+ readonly byProject: Readonly<Record<string, readonly string[]>>;
622
+ };
623
+
575
624
  /**
576
625
  * Reads existing Claude Code permission rules (read-only) so the tool never
577
626
  * suggests a rule that is already allowed, or that a deny/ask rule overrides.
@@ -603,6 +652,8 @@ type InsightInput = {
603
652
  readonly episodes: readonly Episode[];
604
653
  /** Existing permission rules, so allowlist suggestions skip allowed ones. */
605
654
  readonly allowedRules?: AllowedRules;
655
+ /** Existing CLAUDE.md headings, so a rule can name the section it fits. */
656
+ readonly claudeMdHeadings?: ClaudeMdHeadings;
606
657
  };
607
658
  declare function generateInsights(input: InsightInput): readonly Insight[];
608
659
 
@@ -621,6 +672,7 @@ type BuildReportOptions = {
621
672
  /** The stored history file existed but could not be used. */
622
673
  readonly historyUnreadable?: boolean;
623
674
  readonly allowedRules?: AllowedRules;
675
+ readonly claudeMdHeadings?: ClaudeMdHeadings;
624
676
  readonly version: string;
625
677
  readonly now?: Date;
626
678
  };
@@ -693,4 +745,4 @@ type TerminalOptions = {
693
745
  };
694
746
  declare function renderTerminal(report: Report, options?: TerminalOptions): string;
695
747
 
696
- export { type AggregateMetrics, type Compaction, type DailyPoint, type DataQuality, DenialKind, type Distribution, type Episode, type EpisodeContext, type EpisodeRef, EpisodeType, type EvidenceExample, type Insight, type InsightAction, type InsightEvidence, InsightKind, type InsightReview, type InsightState, type InterpretOptions, type Interpretation, InterpretationEngine, type InterpretationVerdict, type Interruption, type Metrics, type ModelMix, type ModelUsage, OutputFormat, type Prompt, PromptSource, type PromptTraitFinding, REPORT_SCHEMA_VERSION, type ReadSessionsOptions, type ReadSessionsResult, type ReadStats, type Report, type ReportPeriod, type Session, type SessionMetrics, Severity, type SlashCommandUse, type SubagentActivity, type TokenTotals, type TokenUsage, type ToolCall, type ToolResult, type ToolStat, type Turn, TurnKind, buildReport, computeMetrics, detectFriction, generateInsights, interpretReport, loadDailyHistory, mergeDaily, readSessions, renderHtml, renderMarkdown, renderTerminal, sanitize, sanitizeReport, saveDailyHistory };
748
+ export { type AggregateMetrics, type Compaction, CorrectionCause, type DailyPoint, type DataQuality, DenialKind, type Distribution, type Episode, type EpisodeContext, type EpisodeRef, EpisodeType, type EvidenceExample, type Insight, type InsightAction, type InsightEvidence, InsightKind, type InsightReview, type InsightState, type InterpretOptions, type Interpretation, InterpretationEngine, type InterpretationVerdict, type Interruption, type Metrics, type ModelMix, type ModelUsage, OutputFormat, type Prompt, PromptSource, type PromptTraitFinding, REPORT_SCHEMA_VERSION, type ReadSessionsOptions, type ReadSessionsResult, type ReadStats, type Report, type ReportPeriod, type Session, type SessionMetrics, Severity, type SlashCommandUse, type SubagentActivity, type TokenTotals, type TokenUsage, type ToolCall, type ToolResult, type ToolStat, type Turn, TurnKind, buildReport, computeMetrics, detectFriction, generateInsights, interpretReport, loadDailyHistory, mergeDaily, readSessions, renderHtml, renderMarkdown, renderTerminal, sanitize, sanitizeReport, saveDailyHistory };