@harness-engineering/types 0.9.1 → 0.9.2

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.mts CHANGED
@@ -86,6 +86,24 @@ interface WorkflowResult {
86
86
  totalDurationMs: number;
87
87
  }
88
88
 
89
+ /**
90
+ * Stability classification for prompt caching.
91
+ *
92
+ * - `static` -- changes only on deploy/update (skills index, tool definitions, SKILL.md)
93
+ * - `session` -- stable within a session, varies between sessions (graph context, project state)
94
+ * - `ephemeral` -- changes per call (tool responses, diff content, file reads)
95
+ */
96
+ type StabilityTier = 'static' | 'session' | 'ephemeral';
97
+ /**
98
+ * Metadata describing a content block's caching stability.
99
+ */
100
+ interface StabilityMetadata {
101
+ /** The stability classification of this content */
102
+ stability: StabilityTier;
103
+ /** Advisory TTL hint (e.g., '1h', '5m') -- provider adapters decide actual TTL */
104
+ ttlHint?: string;
105
+ }
106
+
89
107
  /**
90
108
  * Predefined cognitive modes for skills.
91
109
  */
@@ -106,6 +124,8 @@ interface SkillMetadata {
106
124
  description: string;
107
125
  /** The cognitive mode this skill operates in */
108
126
  cognitive_mode?: CognitiveMode;
127
+ /** Caching stability tier -- defaults to inferred from content type if omitted */
128
+ stability?: StabilityTier;
109
129
  }
110
130
  /**
111
131
  * Contextual information for a skill execution.
@@ -422,6 +442,10 @@ interface TokenUsage {
422
442
  outputTokens: number;
423
443
  /** Combined total tokens used */
424
444
  totalTokens: number;
445
+ /** Tokens used to create a new cache entry (provider-specific) */
446
+ cacheCreationTokens?: number;
447
+ /** Tokens read from an existing cache entry (provider-specific) */
448
+ cacheReadTokens?: number;
425
449
  }
426
450
  /**
427
451
  * Reference to a blocking issue.
@@ -760,6 +784,62 @@ interface SessionUsage {
760
784
  source: 'harness' | 'claude-code' | 'merged';
761
785
  }
762
786
 
787
+ /**
788
+ * A single skill invocation record stored in adoption.jsonl.
789
+ * One line per invocation, appended by the adoption-tracker hook.
790
+ */
791
+ interface SkillInvocationRecord {
792
+ /** Skill name (e.g., "harness-brainstorming") */
793
+ skill: string;
794
+ /** Session identifier */
795
+ session: string;
796
+ /** ISO 8601 timestamp when the skill started */
797
+ startedAt: string;
798
+ /** Duration in milliseconds */
799
+ duration: number;
800
+ /** Invocation outcome */
801
+ outcome: 'completed' | 'failed' | 'abandoned';
802
+ /** Phase names reached during the invocation */
803
+ phasesReached: string[];
804
+ /** Skill tier (1, 2, or 3). Absent when not derivable from events. */
805
+ tier?: number;
806
+ /** How the skill was triggered. Absent when not derivable from events. */
807
+ trigger?: string;
808
+ }
809
+ /**
810
+ * Aggregated summary for a single skill across multiple invocations.
811
+ */
812
+ interface SkillAdoptionSummary {
813
+ /** Skill name */
814
+ skill: string;
815
+ /** Total invocation count */
816
+ invocations: number;
817
+ /** Fraction of invocations with outcome 'completed' (0-1) */
818
+ successRate: number;
819
+ /** Mean duration in milliseconds */
820
+ avgDuration: number;
821
+ /** ISO 8601 timestamp of the most recent invocation */
822
+ lastUsed: string;
823
+ /** Skill tier (absent when unknown) */
824
+ tier?: number;
825
+ }
826
+ /**
827
+ * Point-in-time snapshot of adoption metrics.
828
+ * Used by CLI commands and dashboard API.
829
+ */
830
+ interface AdoptionSnapshot {
831
+ /** Time period: "daily", "weekly", or "all-time" */
832
+ period: string;
833
+ /** Total invocations in the period */
834
+ totalInvocations: number;
835
+ /** Count of distinct skills invoked */
836
+ uniqueSkills: number;
837
+ /** Top skills by invocation count */
838
+ topSkills: SkillAdoptionSummary[];
839
+ /** ISO 8601 timestamp when this snapshot was generated */
840
+ generatedAt: string;
841
+ }
842
+
763
843
  /**
764
844
  * Session-scoped accumulative state types.
765
845
  *
@@ -810,4 +890,56 @@ type SessionSections = {
810
890
  [K in SessionSectionName]: SessionEntry[];
811
891
  };
812
892
 
813
- export { type AgentBackend, type AgentConfig, type AgentError, type AgentErrorCategory, type AgentEvent, type AgentSession, type AssignmentRecord, type BlockerRef, type CICheckIssue, type CICheckName, type CICheckOptions, type CICheckReport, type CICheckResult, type CICheckStatus, type CICheckSummary, type CIFailOnSeverity, type CIInitOptions, type CIPlatform, type CognitiveMode, type DailyUsage, Err, type ExternalTicket, type ExternalTicketState, type FeatureStatus, type HooksConfig, type Issue, type IssueTrackerClient, type ModelPricing, Ok, type PollingConfig, type Priority, type Result, type Roadmap, type RoadmapFeature, type RoadmapFrontmatter, type RoadmapMilestone, SESSION_SECTION_NAMES, STANDARD_COGNITIVE_MODES, type ServerConfig, type SessionEntry, type SessionEntryStatus, type SessionSectionName, type SessionSections, type SessionStartParams, type SessionUsage, type SkillContext, type SkillError, type SkillLifecycleHooks, type SkillMetadata, type SkillResult, type StepOutcome, type SyncResult, type TokenUsage, type TrackerConfig, type TrackerSyncConfig, type TurnContext, type TurnParams, type TurnResult, type UsageRecord, type Workflow, type WorkflowConfig, type WorkflowDefinition, type WorkflowResult, type WorkflowStep, type WorkflowStepResult, type WorkspaceConfig, isErr, isOk };
893
+ /**
894
+ * Project-level telemetry configuration stored in harness.config.json.
895
+ * Only the on/off toggle lives here -- identity is in .harness/telemetry.json.
896
+ */
897
+ interface TelemetryConfig {
898
+ /** Whether telemetry collection is enabled. Default: true. */
899
+ enabled: boolean;
900
+ }
901
+ /**
902
+ * Optional identity fields stored in .harness/telemetry.json (gitignored).
903
+ * Each field is independently opt-in.
904
+ */
905
+ interface TelemetryIdentity {
906
+ project?: string;
907
+ team?: string;
908
+ alias?: string;
909
+ }
910
+ /**
911
+ * Resolved consent state after merging env vars, config, and identity file.
912
+ * Discriminated union: when allowed is false, no identity or installId fields exist.
913
+ */
914
+ type ConsentState = {
915
+ allowed: true;
916
+ identity: TelemetryIdentity;
917
+ installId: string;
918
+ } | {
919
+ allowed: false;
920
+ };
921
+ /**
922
+ * A single telemetry event payload for PostHog HTTP batch API.
923
+ */
924
+ interface TelemetryEvent {
925
+ /** Event name, e.g. "skill_invocation", "session_end" */
926
+ event: string;
927
+ /** installId (anonymous) or alias (identified) */
928
+ distinctId: string;
929
+ properties: {
930
+ installId: string;
931
+ os: string;
932
+ nodeVersion: string;
933
+ harnessVersion: string;
934
+ skillName?: string;
935
+ duration?: number;
936
+ outcome?: 'success' | 'failure';
937
+ phasesReached?: string[];
938
+ project?: string;
939
+ team?: string;
940
+ };
941
+ /** ISO 8601 timestamp */
942
+ timestamp: string;
943
+ }
944
+
945
+ export { type AdoptionSnapshot, type AgentBackend, type AgentConfig, type AgentError, type AgentErrorCategory, type AgentEvent, type AgentSession, type AssignmentRecord, type BlockerRef, type CICheckIssue, type CICheckName, type CICheckOptions, type CICheckReport, type CICheckResult, type CICheckStatus, type CICheckSummary, type CIFailOnSeverity, type CIInitOptions, type CIPlatform, type CognitiveMode, type ConsentState, type DailyUsage, Err, type ExternalTicket, type ExternalTicketState, type FeatureStatus, type HooksConfig, type Issue, type IssueTrackerClient, type ModelPricing, Ok, type PollingConfig, type Priority, type Result, type Roadmap, type RoadmapFeature, type RoadmapFrontmatter, type RoadmapMilestone, SESSION_SECTION_NAMES, STANDARD_COGNITIVE_MODES, type ServerConfig, type SessionEntry, type SessionEntryStatus, type SessionSectionName, type SessionSections, type SessionStartParams, type SessionUsage, type SkillAdoptionSummary, type SkillContext, type SkillError, type SkillInvocationRecord, type SkillLifecycleHooks, type SkillMetadata, type SkillResult, type StabilityMetadata, type StabilityTier, type StepOutcome, type SyncResult, type TelemetryConfig, type TelemetryEvent, type TelemetryIdentity, type TokenUsage, type TrackerConfig, type TrackerSyncConfig, type TurnContext, type TurnParams, type TurnResult, type UsageRecord, type Workflow, type WorkflowConfig, type WorkflowDefinition, type WorkflowResult, type WorkflowStep, type WorkflowStepResult, type WorkspaceConfig, isErr, isOk };
package/dist/index.d.ts CHANGED
@@ -86,6 +86,24 @@ interface WorkflowResult {
86
86
  totalDurationMs: number;
87
87
  }
88
88
 
89
+ /**
90
+ * Stability classification for prompt caching.
91
+ *
92
+ * - `static` -- changes only on deploy/update (skills index, tool definitions, SKILL.md)
93
+ * - `session` -- stable within a session, varies between sessions (graph context, project state)
94
+ * - `ephemeral` -- changes per call (tool responses, diff content, file reads)
95
+ */
96
+ type StabilityTier = 'static' | 'session' | 'ephemeral';
97
+ /**
98
+ * Metadata describing a content block's caching stability.
99
+ */
100
+ interface StabilityMetadata {
101
+ /** The stability classification of this content */
102
+ stability: StabilityTier;
103
+ /** Advisory TTL hint (e.g., '1h', '5m') -- provider adapters decide actual TTL */
104
+ ttlHint?: string;
105
+ }
106
+
89
107
  /**
90
108
  * Predefined cognitive modes for skills.
91
109
  */
@@ -106,6 +124,8 @@ interface SkillMetadata {
106
124
  description: string;
107
125
  /** The cognitive mode this skill operates in */
108
126
  cognitive_mode?: CognitiveMode;
127
+ /** Caching stability tier -- defaults to inferred from content type if omitted */
128
+ stability?: StabilityTier;
109
129
  }
110
130
  /**
111
131
  * Contextual information for a skill execution.
@@ -422,6 +442,10 @@ interface TokenUsage {
422
442
  outputTokens: number;
423
443
  /** Combined total tokens used */
424
444
  totalTokens: number;
445
+ /** Tokens used to create a new cache entry (provider-specific) */
446
+ cacheCreationTokens?: number;
447
+ /** Tokens read from an existing cache entry (provider-specific) */
448
+ cacheReadTokens?: number;
425
449
  }
426
450
  /**
427
451
  * Reference to a blocking issue.
@@ -760,6 +784,62 @@ interface SessionUsage {
760
784
  source: 'harness' | 'claude-code' | 'merged';
761
785
  }
762
786
 
787
+ /**
788
+ * A single skill invocation record stored in adoption.jsonl.
789
+ * One line per invocation, appended by the adoption-tracker hook.
790
+ */
791
+ interface SkillInvocationRecord {
792
+ /** Skill name (e.g., "harness-brainstorming") */
793
+ skill: string;
794
+ /** Session identifier */
795
+ session: string;
796
+ /** ISO 8601 timestamp when the skill started */
797
+ startedAt: string;
798
+ /** Duration in milliseconds */
799
+ duration: number;
800
+ /** Invocation outcome */
801
+ outcome: 'completed' | 'failed' | 'abandoned';
802
+ /** Phase names reached during the invocation */
803
+ phasesReached: string[];
804
+ /** Skill tier (1, 2, or 3). Absent when not derivable from events. */
805
+ tier?: number;
806
+ /** How the skill was triggered. Absent when not derivable from events. */
807
+ trigger?: string;
808
+ }
809
+ /**
810
+ * Aggregated summary for a single skill across multiple invocations.
811
+ */
812
+ interface SkillAdoptionSummary {
813
+ /** Skill name */
814
+ skill: string;
815
+ /** Total invocation count */
816
+ invocations: number;
817
+ /** Fraction of invocations with outcome 'completed' (0-1) */
818
+ successRate: number;
819
+ /** Mean duration in milliseconds */
820
+ avgDuration: number;
821
+ /** ISO 8601 timestamp of the most recent invocation */
822
+ lastUsed: string;
823
+ /** Skill tier (absent when unknown) */
824
+ tier?: number;
825
+ }
826
+ /**
827
+ * Point-in-time snapshot of adoption metrics.
828
+ * Used by CLI commands and dashboard API.
829
+ */
830
+ interface AdoptionSnapshot {
831
+ /** Time period: "daily", "weekly", or "all-time" */
832
+ period: string;
833
+ /** Total invocations in the period */
834
+ totalInvocations: number;
835
+ /** Count of distinct skills invoked */
836
+ uniqueSkills: number;
837
+ /** Top skills by invocation count */
838
+ topSkills: SkillAdoptionSummary[];
839
+ /** ISO 8601 timestamp when this snapshot was generated */
840
+ generatedAt: string;
841
+ }
842
+
763
843
  /**
764
844
  * Session-scoped accumulative state types.
765
845
  *
@@ -810,4 +890,56 @@ type SessionSections = {
810
890
  [K in SessionSectionName]: SessionEntry[];
811
891
  };
812
892
 
813
- export { type AgentBackend, type AgentConfig, type AgentError, type AgentErrorCategory, type AgentEvent, type AgentSession, type AssignmentRecord, type BlockerRef, type CICheckIssue, type CICheckName, type CICheckOptions, type CICheckReport, type CICheckResult, type CICheckStatus, type CICheckSummary, type CIFailOnSeverity, type CIInitOptions, type CIPlatform, type CognitiveMode, type DailyUsage, Err, type ExternalTicket, type ExternalTicketState, type FeatureStatus, type HooksConfig, type Issue, type IssueTrackerClient, type ModelPricing, Ok, type PollingConfig, type Priority, type Result, type Roadmap, type RoadmapFeature, type RoadmapFrontmatter, type RoadmapMilestone, SESSION_SECTION_NAMES, STANDARD_COGNITIVE_MODES, type ServerConfig, type SessionEntry, type SessionEntryStatus, type SessionSectionName, type SessionSections, type SessionStartParams, type SessionUsage, type SkillContext, type SkillError, type SkillLifecycleHooks, type SkillMetadata, type SkillResult, type StepOutcome, type SyncResult, type TokenUsage, type TrackerConfig, type TrackerSyncConfig, type TurnContext, type TurnParams, type TurnResult, type UsageRecord, type Workflow, type WorkflowConfig, type WorkflowDefinition, type WorkflowResult, type WorkflowStep, type WorkflowStepResult, type WorkspaceConfig, isErr, isOk };
893
+ /**
894
+ * Project-level telemetry configuration stored in harness.config.json.
895
+ * Only the on/off toggle lives here -- identity is in .harness/telemetry.json.
896
+ */
897
+ interface TelemetryConfig {
898
+ /** Whether telemetry collection is enabled. Default: true. */
899
+ enabled: boolean;
900
+ }
901
+ /**
902
+ * Optional identity fields stored in .harness/telemetry.json (gitignored).
903
+ * Each field is independently opt-in.
904
+ */
905
+ interface TelemetryIdentity {
906
+ project?: string;
907
+ team?: string;
908
+ alias?: string;
909
+ }
910
+ /**
911
+ * Resolved consent state after merging env vars, config, and identity file.
912
+ * Discriminated union: when allowed is false, no identity or installId fields exist.
913
+ */
914
+ type ConsentState = {
915
+ allowed: true;
916
+ identity: TelemetryIdentity;
917
+ installId: string;
918
+ } | {
919
+ allowed: false;
920
+ };
921
+ /**
922
+ * A single telemetry event payload for PostHog HTTP batch API.
923
+ */
924
+ interface TelemetryEvent {
925
+ /** Event name, e.g. "skill_invocation", "session_end" */
926
+ event: string;
927
+ /** installId (anonymous) or alias (identified) */
928
+ distinctId: string;
929
+ properties: {
930
+ installId: string;
931
+ os: string;
932
+ nodeVersion: string;
933
+ harnessVersion: string;
934
+ skillName?: string;
935
+ duration?: number;
936
+ outcome?: 'success' | 'failure';
937
+ phasesReached?: string[];
938
+ project?: string;
939
+ team?: string;
940
+ };
941
+ /** ISO 8601 timestamp */
942
+ timestamp: string;
943
+ }
944
+
945
+ export { type AdoptionSnapshot, type AgentBackend, type AgentConfig, type AgentError, type AgentErrorCategory, type AgentEvent, type AgentSession, type AssignmentRecord, type BlockerRef, type CICheckIssue, type CICheckName, type CICheckOptions, type CICheckReport, type CICheckResult, type CICheckStatus, type CICheckSummary, type CIFailOnSeverity, type CIInitOptions, type CIPlatform, type CognitiveMode, type ConsentState, type DailyUsage, Err, type ExternalTicket, type ExternalTicketState, type FeatureStatus, type HooksConfig, type Issue, type IssueTrackerClient, type ModelPricing, Ok, type PollingConfig, type Priority, type Result, type Roadmap, type RoadmapFeature, type RoadmapFrontmatter, type RoadmapMilestone, SESSION_SECTION_NAMES, STANDARD_COGNITIVE_MODES, type ServerConfig, type SessionEntry, type SessionEntryStatus, type SessionSectionName, type SessionSections, type SessionStartParams, type SessionUsage, type SkillAdoptionSummary, type SkillContext, type SkillError, type SkillInvocationRecord, type SkillLifecycleHooks, type SkillMetadata, type SkillResult, type StabilityMetadata, type StabilityTier, type StepOutcome, type SyncResult, type TelemetryConfig, type TelemetryEvent, type TelemetryIdentity, type TokenUsage, type TrackerConfig, type TrackerSyncConfig, type TurnContext, type TurnParams, type TurnResult, type UsageRecord, type Workflow, type WorkflowConfig, type WorkflowDefinition, type WorkflowResult, type WorkflowStep, type WorkflowStepResult, type WorkspaceConfig, isErr, isOk };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harness-engineering/types",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "TypeScript types and interfaces for Harness Engineering",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",