@capabilityhostprotocol/types 0.4.7 → 0.5.1

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
@@ -20,6 +20,48 @@ type InvariantFailureBehavior = "deny" | "warn" | "degrade";
20
20
  declare const CHP_V0_1_OUTCOMES: readonly ["success", "failure", "denied", "skipped"];
21
21
  declare const CHP_V0_1_CORE_EVIDENCE_TYPES: readonly ["execution_started", "execution_completed", "execution_failed", "execution_denied", "execution_skipped"];
22
22
  declare const CHP_AGENTIC_EVIDENCE_TYPES: readonly ["tool_use", "tool_use_requested", "session_completed", "session_spawn"];
23
+ declare const CHP_SAFETY_EVIDENCE_TYPES: readonly ["safety_assessment_started", "safety_assessment_completed", "safety_guardrail_triggered", "safety_action_blocked", "safety_action_approved"];
24
+ declare const CHP_COMPLIANCE_EVIDENCE_TYPES: readonly ["retention_policy_applied", "evidence_purged", "evidence_redacted", "compliance_report_generated"];
25
+ type RiskLevel = "low" | "medium" | "high" | "critical";
26
+ type SafetyRecommendation = "allow" | "warn" | "require_approval" | "block";
27
+ interface RiskAssessment {
28
+ level: RiskLevel;
29
+ score: number;
30
+ factors: string[];
31
+ recommendation: SafetyRecommendation;
32
+ assessed_at: string;
33
+ }
34
+ interface GuardrailDefinition {
35
+ id: string;
36
+ capability_id_pattern: string;
37
+ max_risk_level: RiskLevel;
38
+ requires_human_for: string[];
39
+ }
40
+ interface SafetyReport {
41
+ report_id: string;
42
+ capability_id: string;
43
+ payload_hash: string;
44
+ assessment: RiskAssessment;
45
+ guardrails_evaluated: string[];
46
+ approved: boolean;
47
+ block_reason?: string | null;
48
+ generated_at: string;
49
+ }
50
+ interface RetentionPolicy {
51
+ policy_id: string;
52
+ retain_days: number;
53
+ applies_to: string[];
54
+ redact_payload_after_days?: number | null;
55
+ }
56
+ interface ComplianceReport {
57
+ report_id: string;
58
+ policy_ids: string[];
59
+ store_path: string;
60
+ events_inspected: number;
61
+ events_purged: number;
62
+ events_redacted: number;
63
+ generated_at: string;
64
+ }
23
65
  interface AssuranceMetadata {
24
66
  level: AssuranceLevel;
25
67
  evidence_policy?: string;
@@ -33,6 +75,45 @@ interface InvariantDescriptor {
33
75
  failure_behavior?: InvariantFailureBehavior;
34
76
  parameters?: JsonObject;
35
77
  }
78
+ interface CostHint {
79
+ token_estimate?: number | null;
80
+ latency_ms_p50?: number | null;
81
+ idempotent?: boolean;
82
+ }
83
+ type BlastRadius = "local" | "session" | "user" | "system";
84
+ interface SafetyHint {
85
+ reversible?: boolean;
86
+ destructive?: boolean;
87
+ requires_human_review?: boolean;
88
+ blast_radius?: BlastRadius;
89
+ }
90
+ type StateMachineStatus = "queued" | "running" | "blocked" | "done" | "failed" | "cancelled";
91
+ interface StateMachineDefinition {
92
+ states: string[];
93
+ transitions: Record<string, string[]>;
94
+ initial_state: string;
95
+ terminal_states: string[];
96
+ }
97
+ interface StateMachineRecord {
98
+ machine_id: string;
99
+ name: string;
100
+ definition: StateMachineDefinition;
101
+ current_state: string;
102
+ status: StateMachineStatus;
103
+ context: JsonObject;
104
+ created_at: string;
105
+ updated_at: string;
106
+ history: JsonObject[];
107
+ }
108
+ interface StateMachineTransitionResult {
109
+ machine_id: string;
110
+ from_state: string;
111
+ to_state: string;
112
+ event: string;
113
+ allowed: boolean;
114
+ reason?: string | null;
115
+ updated_at: string;
116
+ }
36
117
  interface CapabilityDescriptor {
37
118
  id: string;
38
119
  version: string;
@@ -48,6 +129,9 @@ interface CapabilityDescriptor {
48
129
  risk?: CapabilityRisk;
49
130
  assurance?: AssuranceMetadata;
50
131
  metadata?: JsonObject;
132
+ depends_on?: string[] | null;
133
+ cost_hint?: CostHint | null;
134
+ safety_hint?: SafetyHint | null;
51
135
  }
52
136
  interface HostDescriptor {
53
137
  id: string;
@@ -183,4 +267,4 @@ declare function isChpV01Outcome(value: string): value is ChpV01ExecutionOutcome
183
267
  declare const CHP_VERSION = "0.2";
184
268
  declare const VERSION = "0.2.2";
185
269
 
186
- export { type AssuranceLevel, type AssuranceMetadata, CHP_AGENTIC_EVIDENCE_TYPES, CHP_V0_1_CORE_EVIDENCE_TYPES, CHP_V0_1_OUTCOMES, CHP_V0_1_VERSION, CHP_VERSION, type CapabilityDescriptor, type CapabilityRisk, type ChpV01ExecutionOutcome, type ChpV01InvocationMode, type CorrelationContext, type DenialReason, type ExecutionEvidence, type HostDescriptor, type InvariantDescriptor, type InvariantEnforcement, type InvariantFailureBehavior, type InvocationEnvelope, type InvocationResult, type JsonObject, type JsonPrimitive, type JsonValue, type PreToolEvidence, type ReplayQuery, type ReplayResult, type SessionEvidence, type SessionSpawnEvidence, type ToolUseEvidence, VERSION, capabilityUri, isChpV01Outcome };
270
+ export { type AssuranceLevel, type AssuranceMetadata, type BlastRadius, CHP_AGENTIC_EVIDENCE_TYPES, CHP_COMPLIANCE_EVIDENCE_TYPES, CHP_SAFETY_EVIDENCE_TYPES, CHP_V0_1_CORE_EVIDENCE_TYPES, CHP_V0_1_OUTCOMES, CHP_V0_1_VERSION, CHP_VERSION, type CapabilityDescriptor, type CapabilityRisk, type ChpV01ExecutionOutcome, type ChpV01InvocationMode, type ComplianceReport, type CorrelationContext, type CostHint, type DenialReason, type ExecutionEvidence, type GuardrailDefinition, type HostDescriptor, type InvariantDescriptor, type InvariantEnforcement, type InvariantFailureBehavior, type InvocationEnvelope, type InvocationResult, type JsonObject, type JsonPrimitive, type JsonValue, type PreToolEvidence, type ReplayQuery, type ReplayResult, type RetentionPolicy, type RiskAssessment, type RiskLevel, type SafetyHint, type SafetyRecommendation, type SafetyReport, type SessionEvidence, type SessionSpawnEvidence, type StateMachineDefinition, type StateMachineRecord, type StateMachineStatus, type StateMachineTransitionResult, type ToolUseEvidence, VERSION, capabilityUri, isChpV01Outcome };
package/dist/index.d.ts CHANGED
@@ -20,6 +20,48 @@ type InvariantFailureBehavior = "deny" | "warn" | "degrade";
20
20
  declare const CHP_V0_1_OUTCOMES: readonly ["success", "failure", "denied", "skipped"];
21
21
  declare const CHP_V0_1_CORE_EVIDENCE_TYPES: readonly ["execution_started", "execution_completed", "execution_failed", "execution_denied", "execution_skipped"];
22
22
  declare const CHP_AGENTIC_EVIDENCE_TYPES: readonly ["tool_use", "tool_use_requested", "session_completed", "session_spawn"];
23
+ declare const CHP_SAFETY_EVIDENCE_TYPES: readonly ["safety_assessment_started", "safety_assessment_completed", "safety_guardrail_triggered", "safety_action_blocked", "safety_action_approved"];
24
+ declare const CHP_COMPLIANCE_EVIDENCE_TYPES: readonly ["retention_policy_applied", "evidence_purged", "evidence_redacted", "compliance_report_generated"];
25
+ type RiskLevel = "low" | "medium" | "high" | "critical";
26
+ type SafetyRecommendation = "allow" | "warn" | "require_approval" | "block";
27
+ interface RiskAssessment {
28
+ level: RiskLevel;
29
+ score: number;
30
+ factors: string[];
31
+ recommendation: SafetyRecommendation;
32
+ assessed_at: string;
33
+ }
34
+ interface GuardrailDefinition {
35
+ id: string;
36
+ capability_id_pattern: string;
37
+ max_risk_level: RiskLevel;
38
+ requires_human_for: string[];
39
+ }
40
+ interface SafetyReport {
41
+ report_id: string;
42
+ capability_id: string;
43
+ payload_hash: string;
44
+ assessment: RiskAssessment;
45
+ guardrails_evaluated: string[];
46
+ approved: boolean;
47
+ block_reason?: string | null;
48
+ generated_at: string;
49
+ }
50
+ interface RetentionPolicy {
51
+ policy_id: string;
52
+ retain_days: number;
53
+ applies_to: string[];
54
+ redact_payload_after_days?: number | null;
55
+ }
56
+ interface ComplianceReport {
57
+ report_id: string;
58
+ policy_ids: string[];
59
+ store_path: string;
60
+ events_inspected: number;
61
+ events_purged: number;
62
+ events_redacted: number;
63
+ generated_at: string;
64
+ }
23
65
  interface AssuranceMetadata {
24
66
  level: AssuranceLevel;
25
67
  evidence_policy?: string;
@@ -33,6 +75,45 @@ interface InvariantDescriptor {
33
75
  failure_behavior?: InvariantFailureBehavior;
34
76
  parameters?: JsonObject;
35
77
  }
78
+ interface CostHint {
79
+ token_estimate?: number | null;
80
+ latency_ms_p50?: number | null;
81
+ idempotent?: boolean;
82
+ }
83
+ type BlastRadius = "local" | "session" | "user" | "system";
84
+ interface SafetyHint {
85
+ reversible?: boolean;
86
+ destructive?: boolean;
87
+ requires_human_review?: boolean;
88
+ blast_radius?: BlastRadius;
89
+ }
90
+ type StateMachineStatus = "queued" | "running" | "blocked" | "done" | "failed" | "cancelled";
91
+ interface StateMachineDefinition {
92
+ states: string[];
93
+ transitions: Record<string, string[]>;
94
+ initial_state: string;
95
+ terminal_states: string[];
96
+ }
97
+ interface StateMachineRecord {
98
+ machine_id: string;
99
+ name: string;
100
+ definition: StateMachineDefinition;
101
+ current_state: string;
102
+ status: StateMachineStatus;
103
+ context: JsonObject;
104
+ created_at: string;
105
+ updated_at: string;
106
+ history: JsonObject[];
107
+ }
108
+ interface StateMachineTransitionResult {
109
+ machine_id: string;
110
+ from_state: string;
111
+ to_state: string;
112
+ event: string;
113
+ allowed: boolean;
114
+ reason?: string | null;
115
+ updated_at: string;
116
+ }
36
117
  interface CapabilityDescriptor {
37
118
  id: string;
38
119
  version: string;
@@ -48,6 +129,9 @@ interface CapabilityDescriptor {
48
129
  risk?: CapabilityRisk;
49
130
  assurance?: AssuranceMetadata;
50
131
  metadata?: JsonObject;
132
+ depends_on?: string[] | null;
133
+ cost_hint?: CostHint | null;
134
+ safety_hint?: SafetyHint | null;
51
135
  }
52
136
  interface HostDescriptor {
53
137
  id: string;
@@ -183,4 +267,4 @@ declare function isChpV01Outcome(value: string): value is ChpV01ExecutionOutcome
183
267
  declare const CHP_VERSION = "0.2";
184
268
  declare const VERSION = "0.2.2";
185
269
 
186
- export { type AssuranceLevel, type AssuranceMetadata, CHP_AGENTIC_EVIDENCE_TYPES, CHP_V0_1_CORE_EVIDENCE_TYPES, CHP_V0_1_OUTCOMES, CHP_V0_1_VERSION, CHP_VERSION, type CapabilityDescriptor, type CapabilityRisk, type ChpV01ExecutionOutcome, type ChpV01InvocationMode, type CorrelationContext, type DenialReason, type ExecutionEvidence, type HostDescriptor, type InvariantDescriptor, type InvariantEnforcement, type InvariantFailureBehavior, type InvocationEnvelope, type InvocationResult, type JsonObject, type JsonPrimitive, type JsonValue, type PreToolEvidence, type ReplayQuery, type ReplayResult, type SessionEvidence, type SessionSpawnEvidence, type ToolUseEvidence, VERSION, capabilityUri, isChpV01Outcome };
270
+ export { type AssuranceLevel, type AssuranceMetadata, type BlastRadius, CHP_AGENTIC_EVIDENCE_TYPES, CHP_COMPLIANCE_EVIDENCE_TYPES, CHP_SAFETY_EVIDENCE_TYPES, CHP_V0_1_CORE_EVIDENCE_TYPES, CHP_V0_1_OUTCOMES, CHP_V0_1_VERSION, CHP_VERSION, type CapabilityDescriptor, type CapabilityRisk, type ChpV01ExecutionOutcome, type ChpV01InvocationMode, type ComplianceReport, type CorrelationContext, type CostHint, type DenialReason, type ExecutionEvidence, type GuardrailDefinition, type HostDescriptor, type InvariantDescriptor, type InvariantEnforcement, type InvariantFailureBehavior, type InvocationEnvelope, type InvocationResult, type JsonObject, type JsonPrimitive, type JsonValue, type PreToolEvidence, type ReplayQuery, type ReplayResult, type RetentionPolicy, type RiskAssessment, type RiskLevel, type SafetyHint, type SafetyRecommendation, type SafetyReport, type SessionEvidence, type SessionSpawnEvidence, type StateMachineDefinition, type StateMachineRecord, type StateMachineStatus, type StateMachineTransitionResult, type ToolUseEvidence, VERSION, capabilityUri, isChpV01Outcome };
package/dist/index.js CHANGED
@@ -20,6 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  var index_exports = {};
21
21
  __export(index_exports, {
22
22
  CHP_AGENTIC_EVIDENCE_TYPES: () => CHP_AGENTIC_EVIDENCE_TYPES,
23
+ CHP_COMPLIANCE_EVIDENCE_TYPES: () => CHP_COMPLIANCE_EVIDENCE_TYPES,
24
+ CHP_SAFETY_EVIDENCE_TYPES: () => CHP_SAFETY_EVIDENCE_TYPES,
23
25
  CHP_V0_1_CORE_EVIDENCE_TYPES: () => CHP_V0_1_CORE_EVIDENCE_TYPES,
24
26
  CHP_V0_1_OUTCOMES: () => CHP_V0_1_OUTCOMES,
25
27
  CHP_V0_1_VERSION: () => CHP_V0_1_VERSION,
@@ -51,6 +53,19 @@ var CHP_AGENTIC_EVIDENCE_TYPES = [
51
53
  "session_completed",
52
54
  "session_spawn"
53
55
  ];
56
+ var CHP_SAFETY_EVIDENCE_TYPES = [
57
+ "safety_assessment_started",
58
+ "safety_assessment_completed",
59
+ "safety_guardrail_triggered",
60
+ "safety_action_blocked",
61
+ "safety_action_approved"
62
+ ];
63
+ var CHP_COMPLIANCE_EVIDENCE_TYPES = [
64
+ "retention_policy_applied",
65
+ "evidence_purged",
66
+ "evidence_redacted",
67
+ "compliance_report_generated"
68
+ ];
54
69
  function capabilityUri(descriptor) {
55
70
  return `${descriptor.id}:${descriptor.version}`;
56
71
  }
@@ -64,6 +79,8 @@ var VERSION = "0.2.2";
64
79
  // Annotate the CommonJS export names for ESM import in node:
65
80
  0 && (module.exports = {
66
81
  CHP_AGENTIC_EVIDENCE_TYPES,
82
+ CHP_COMPLIANCE_EVIDENCE_TYPES,
83
+ CHP_SAFETY_EVIDENCE_TYPES,
67
84
  CHP_V0_1_CORE_EVIDENCE_TYPES,
68
85
  CHP_V0_1_OUTCOMES,
69
86
  CHP_V0_1_VERSION,
package/dist/index.mjs CHANGED
@@ -19,6 +19,19 @@ var CHP_AGENTIC_EVIDENCE_TYPES = [
19
19
  "session_completed",
20
20
  "session_spawn"
21
21
  ];
22
+ var CHP_SAFETY_EVIDENCE_TYPES = [
23
+ "safety_assessment_started",
24
+ "safety_assessment_completed",
25
+ "safety_guardrail_triggered",
26
+ "safety_action_blocked",
27
+ "safety_action_approved"
28
+ ];
29
+ var CHP_COMPLIANCE_EVIDENCE_TYPES = [
30
+ "retention_policy_applied",
31
+ "evidence_purged",
32
+ "evidence_redacted",
33
+ "compliance_report_generated"
34
+ ];
22
35
  function capabilityUri(descriptor) {
23
36
  return `${descriptor.id}:${descriptor.version}`;
24
37
  }
@@ -31,6 +44,8 @@ var CHP_VERSION = "0.2";
31
44
  var VERSION = "0.2.2";
32
45
  export {
33
46
  CHP_AGENTIC_EVIDENCE_TYPES,
47
+ CHP_COMPLIANCE_EVIDENCE_TYPES,
48
+ CHP_SAFETY_EVIDENCE_TYPES,
34
49
  CHP_V0_1_CORE_EVIDENCE_TYPES,
35
50
  CHP_V0_1_OUTCOMES,
36
51
  CHP_V0_1_VERSION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capabilityhostprotocol/types",
3
- "version": "0.4.7",
3
+ "version": "0.5.1",
4
4
  "description": "TypeScript types for the Capability Host Protocol (CHP).",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
package/src/v0_1.ts CHANGED
@@ -43,6 +43,67 @@ export const CHP_AGENTIC_EVIDENCE_TYPES = [
43
43
  "session_spawn",
44
44
  ] as const;
45
45
 
46
+ export const CHP_SAFETY_EVIDENCE_TYPES = [
47
+ "safety_assessment_started",
48
+ "safety_assessment_completed",
49
+ "safety_guardrail_triggered",
50
+ "safety_action_blocked",
51
+ "safety_action_approved",
52
+ ] as const;
53
+
54
+ export const CHP_COMPLIANCE_EVIDENCE_TYPES = [
55
+ "retention_policy_applied",
56
+ "evidence_purged",
57
+ "evidence_redacted",
58
+ "compliance_report_generated",
59
+ ] as const;
60
+
61
+ export type RiskLevel = "low" | "medium" | "high" | "critical";
62
+ export type SafetyRecommendation = "allow" | "warn" | "require_approval" | "block";
63
+
64
+ export interface RiskAssessment {
65
+ level: RiskLevel;
66
+ score: number;
67
+ factors: string[];
68
+ recommendation: SafetyRecommendation;
69
+ assessed_at: string;
70
+ }
71
+
72
+ export interface GuardrailDefinition {
73
+ id: string;
74
+ capability_id_pattern: string;
75
+ max_risk_level: RiskLevel;
76
+ requires_human_for: string[];
77
+ }
78
+
79
+ export interface SafetyReport {
80
+ report_id: string;
81
+ capability_id: string;
82
+ payload_hash: string;
83
+ assessment: RiskAssessment;
84
+ guardrails_evaluated: string[];
85
+ approved: boolean;
86
+ block_reason?: string | null;
87
+ generated_at: string;
88
+ }
89
+
90
+ export interface RetentionPolicy {
91
+ policy_id: string;
92
+ retain_days: number;
93
+ applies_to: string[];
94
+ redact_payload_after_days?: number | null;
95
+ }
96
+
97
+ export interface ComplianceReport {
98
+ report_id: string;
99
+ policy_ids: string[];
100
+ store_path: string;
101
+ events_inspected: number;
102
+ events_purged: number;
103
+ events_redacted: number;
104
+ generated_at: string;
105
+ }
106
+
46
107
  export interface AssuranceMetadata {
47
108
  level: AssuranceLevel;
48
109
  evidence_policy?: string;
@@ -58,6 +119,52 @@ export interface InvariantDescriptor {
58
119
  parameters?: JsonObject;
59
120
  }
60
121
 
122
+ export interface CostHint {
123
+ token_estimate?: number | null;
124
+ latency_ms_p50?: number | null;
125
+ idempotent?: boolean;
126
+ }
127
+
128
+ export type BlastRadius = "local" | "session" | "user" | "system";
129
+
130
+ export interface SafetyHint {
131
+ reversible?: boolean;
132
+ destructive?: boolean;
133
+ requires_human_review?: boolean;
134
+ blast_radius?: BlastRadius;
135
+ }
136
+
137
+ export type StateMachineStatus = "queued" | "running" | "blocked" | "done" | "failed" | "cancelled";
138
+
139
+ export interface StateMachineDefinition {
140
+ states: string[];
141
+ transitions: Record<string, string[]>;
142
+ initial_state: string;
143
+ terminal_states: string[];
144
+ }
145
+
146
+ export interface StateMachineRecord {
147
+ machine_id: string;
148
+ name: string;
149
+ definition: StateMachineDefinition;
150
+ current_state: string;
151
+ status: StateMachineStatus;
152
+ context: JsonObject;
153
+ created_at: string;
154
+ updated_at: string;
155
+ history: JsonObject[];
156
+ }
157
+
158
+ export interface StateMachineTransitionResult {
159
+ machine_id: string;
160
+ from_state: string;
161
+ to_state: string;
162
+ event: string;
163
+ allowed: boolean;
164
+ reason?: string | null;
165
+ updated_at: string;
166
+ }
167
+
61
168
  export interface CapabilityDescriptor {
62
169
  id: string;
63
170
  version: string;
@@ -73,6 +180,9 @@ export interface CapabilityDescriptor {
73
180
  risk?: CapabilityRisk;
74
181
  assurance?: AssuranceMetadata;
75
182
  metadata?: JsonObject;
183
+ depends_on?: string[] | null;
184
+ cost_hint?: CostHint | null;
185
+ safety_hint?: SafetyHint | null;
76
186
  }
77
187
 
78
188
  export interface HostDescriptor {