@capabilityhostprotocol/types 0.2.1 → 0.5.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.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * CHP v0.1 protocol types.
2
+ * CHP v0.2 protocol types.
3
3
  *
4
4
  * These interfaces mirror the JSON Schemas in the repository root `schemas/`
5
5
  * directory. They are intentionally transport-neutral and do not depend on the
@@ -19,6 +19,7 @@ type InvariantEnforcement = "declarative" | "host" | "runtime";
19
19
  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
+ declare const CHP_AGENTIC_EVIDENCE_TYPES: readonly ["tool_use", "tool_use_requested", "session_completed", "session_spawn"];
22
23
  interface AssuranceMetadata {
23
24
  level: AssuranceLevel;
24
25
  evidence_policy?: string;
@@ -32,6 +33,45 @@ interface InvariantDescriptor {
32
33
  failure_behavior?: InvariantFailureBehavior;
33
34
  parameters?: JsonObject;
34
35
  }
36
+ interface CostHint {
37
+ token_estimate?: number | null;
38
+ latency_ms_p50?: number | null;
39
+ idempotent?: boolean;
40
+ }
41
+ type BlastRadius = "local" | "session" | "user" | "system";
42
+ interface SafetyHint {
43
+ reversible?: boolean;
44
+ destructive?: boolean;
45
+ requires_human_review?: boolean;
46
+ blast_radius?: BlastRadius;
47
+ }
48
+ type StateMachineStatus = "queued" | "running" | "blocked" | "done" | "failed" | "cancelled";
49
+ interface StateMachineDefinition {
50
+ states: string[];
51
+ transitions: Record<string, string[]>;
52
+ initial_state: string;
53
+ terminal_states: string[];
54
+ }
55
+ interface StateMachineRecord {
56
+ machine_id: string;
57
+ name: string;
58
+ definition: StateMachineDefinition;
59
+ current_state: string;
60
+ status: StateMachineStatus;
61
+ context: JsonObject;
62
+ created_at: string;
63
+ updated_at: string;
64
+ history: JsonObject[];
65
+ }
66
+ interface StateMachineTransitionResult {
67
+ machine_id: string;
68
+ from_state: string;
69
+ to_state: string;
70
+ event: string;
71
+ allowed: boolean;
72
+ reason?: string | null;
73
+ updated_at: string;
74
+ }
35
75
  interface CapabilityDescriptor {
36
76
  id: string;
37
77
  version: string;
@@ -47,6 +87,9 @@ interface CapabilityDescriptor {
47
87
  risk?: CapabilityRisk;
48
88
  assurance?: AssuranceMetadata;
49
89
  metadata?: JsonObject;
90
+ depends_on?: string[] | null;
91
+ cost_hint?: CostHint | null;
92
+ safety_hint?: SafetyHint | null;
50
93
  }
51
94
  interface HostDescriptor {
52
95
  id: string;
@@ -117,6 +160,41 @@ interface ExecutionEvidence {
117
160
  denial?: DenialReason | null;
118
161
  assurance: AssuranceMetadata;
119
162
  }
163
+ interface ToolUseEvidence extends ExecutionEvidence {
164
+ event_type: "tool_use";
165
+ payload: {
166
+ tool_name: string;
167
+ cwd?: string;
168
+ tool_input?: JsonObject;
169
+ tool_output_preview?: string;
170
+ exit_code?: number | null;
171
+ };
172
+ }
173
+ interface PreToolEvidence extends ExecutionEvidence {
174
+ event_type: "tool_use_requested";
175
+ payload: {
176
+ tool_name: string;
177
+ cwd?: string;
178
+ tool_input?: JsonObject;
179
+ blocked: boolean;
180
+ block_reason?: string | null;
181
+ };
182
+ }
183
+ interface SessionEvidence extends ExecutionEvidence {
184
+ event_type: "session_completed";
185
+ payload: {
186
+ tool_count: number;
187
+ transcript_path?: string;
188
+ };
189
+ }
190
+ interface SessionSpawnEvidence extends ExecutionEvidence {
191
+ event_type: "session_spawn";
192
+ payload: {
193
+ parent_session_id: string;
194
+ child_session_id: string;
195
+ tool_name: string;
196
+ };
197
+ }
120
198
  interface ReplayQuery {
121
199
  correlation_id: string;
122
200
  limit?: number | null;
@@ -144,7 +222,7 @@ declare function isChpV01Outcome(value: string): value is ChpV01ExecutionOutcome
144
222
  * @packageDocumentation
145
223
  */
146
224
 
147
- declare const CHP_VERSION = "0.1";
148
- declare const VERSION = "0.1.0";
225
+ declare const CHP_VERSION = "0.2";
226
+ declare const VERSION = "0.2.2";
149
227
 
150
- export { type AssuranceLevel, type AssuranceMetadata, 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 ReplayQuery, type ReplayResult, VERSION, capabilityUri, isChpV01Outcome };
228
+ export { type AssuranceLevel, type AssuranceMetadata, type BlastRadius, 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 CostHint, 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 SafetyHint, type SessionEvidence, type SessionSpawnEvidence, type StateMachineDefinition, type StateMachineRecord, type StateMachineStatus, type StateMachineTransitionResult, type ToolUseEvidence, VERSION, capabilityUri, isChpV01Outcome };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * CHP v0.1 protocol types.
2
+ * CHP v0.2 protocol types.
3
3
  *
4
4
  * These interfaces mirror the JSON Schemas in the repository root `schemas/`
5
5
  * directory. They are intentionally transport-neutral and do not depend on the
@@ -19,6 +19,7 @@ type InvariantEnforcement = "declarative" | "host" | "runtime";
19
19
  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
+ declare const CHP_AGENTIC_EVIDENCE_TYPES: readonly ["tool_use", "tool_use_requested", "session_completed", "session_spawn"];
22
23
  interface AssuranceMetadata {
23
24
  level: AssuranceLevel;
24
25
  evidence_policy?: string;
@@ -32,6 +33,45 @@ interface InvariantDescriptor {
32
33
  failure_behavior?: InvariantFailureBehavior;
33
34
  parameters?: JsonObject;
34
35
  }
36
+ interface CostHint {
37
+ token_estimate?: number | null;
38
+ latency_ms_p50?: number | null;
39
+ idempotent?: boolean;
40
+ }
41
+ type BlastRadius = "local" | "session" | "user" | "system";
42
+ interface SafetyHint {
43
+ reversible?: boolean;
44
+ destructive?: boolean;
45
+ requires_human_review?: boolean;
46
+ blast_radius?: BlastRadius;
47
+ }
48
+ type StateMachineStatus = "queued" | "running" | "blocked" | "done" | "failed" | "cancelled";
49
+ interface StateMachineDefinition {
50
+ states: string[];
51
+ transitions: Record<string, string[]>;
52
+ initial_state: string;
53
+ terminal_states: string[];
54
+ }
55
+ interface StateMachineRecord {
56
+ machine_id: string;
57
+ name: string;
58
+ definition: StateMachineDefinition;
59
+ current_state: string;
60
+ status: StateMachineStatus;
61
+ context: JsonObject;
62
+ created_at: string;
63
+ updated_at: string;
64
+ history: JsonObject[];
65
+ }
66
+ interface StateMachineTransitionResult {
67
+ machine_id: string;
68
+ from_state: string;
69
+ to_state: string;
70
+ event: string;
71
+ allowed: boolean;
72
+ reason?: string | null;
73
+ updated_at: string;
74
+ }
35
75
  interface CapabilityDescriptor {
36
76
  id: string;
37
77
  version: string;
@@ -47,6 +87,9 @@ interface CapabilityDescriptor {
47
87
  risk?: CapabilityRisk;
48
88
  assurance?: AssuranceMetadata;
49
89
  metadata?: JsonObject;
90
+ depends_on?: string[] | null;
91
+ cost_hint?: CostHint | null;
92
+ safety_hint?: SafetyHint | null;
50
93
  }
51
94
  interface HostDescriptor {
52
95
  id: string;
@@ -117,6 +160,41 @@ interface ExecutionEvidence {
117
160
  denial?: DenialReason | null;
118
161
  assurance: AssuranceMetadata;
119
162
  }
163
+ interface ToolUseEvidence extends ExecutionEvidence {
164
+ event_type: "tool_use";
165
+ payload: {
166
+ tool_name: string;
167
+ cwd?: string;
168
+ tool_input?: JsonObject;
169
+ tool_output_preview?: string;
170
+ exit_code?: number | null;
171
+ };
172
+ }
173
+ interface PreToolEvidence extends ExecutionEvidence {
174
+ event_type: "tool_use_requested";
175
+ payload: {
176
+ tool_name: string;
177
+ cwd?: string;
178
+ tool_input?: JsonObject;
179
+ blocked: boolean;
180
+ block_reason?: string | null;
181
+ };
182
+ }
183
+ interface SessionEvidence extends ExecutionEvidence {
184
+ event_type: "session_completed";
185
+ payload: {
186
+ tool_count: number;
187
+ transcript_path?: string;
188
+ };
189
+ }
190
+ interface SessionSpawnEvidence extends ExecutionEvidence {
191
+ event_type: "session_spawn";
192
+ payload: {
193
+ parent_session_id: string;
194
+ child_session_id: string;
195
+ tool_name: string;
196
+ };
197
+ }
120
198
  interface ReplayQuery {
121
199
  correlation_id: string;
122
200
  limit?: number | null;
@@ -144,7 +222,7 @@ declare function isChpV01Outcome(value: string): value is ChpV01ExecutionOutcome
144
222
  * @packageDocumentation
145
223
  */
146
224
 
147
- declare const CHP_VERSION = "0.1";
148
- declare const VERSION = "0.1.0";
225
+ declare const CHP_VERSION = "0.2";
226
+ declare const VERSION = "0.2.2";
149
227
 
150
- export { type AssuranceLevel, type AssuranceMetadata, 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 ReplayQuery, type ReplayResult, VERSION, capabilityUri, isChpV01Outcome };
228
+ export { type AssuranceLevel, type AssuranceMetadata, type BlastRadius, 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 CostHint, 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 SafetyHint, type SessionEvidence, type SessionSpawnEvidence, type StateMachineDefinition, type StateMachineRecord, type StateMachineStatus, type StateMachineTransitionResult, type ToolUseEvidence, VERSION, capabilityUri, isChpV01Outcome };
package/dist/index.js CHANGED
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/index.ts
20
20
  var index_exports = {};
21
21
  __export(index_exports, {
22
+ CHP_AGENTIC_EVIDENCE_TYPES: () => CHP_AGENTIC_EVIDENCE_TYPES,
22
23
  CHP_V0_1_CORE_EVIDENCE_TYPES: () => CHP_V0_1_CORE_EVIDENCE_TYPES,
23
24
  CHP_V0_1_OUTCOMES: () => CHP_V0_1_OUTCOMES,
24
25
  CHP_V0_1_VERSION: () => CHP_V0_1_VERSION,
@@ -44,6 +45,12 @@ var CHP_V0_1_CORE_EVIDENCE_TYPES = [
44
45
  "execution_denied",
45
46
  "execution_skipped"
46
47
  ];
48
+ var CHP_AGENTIC_EVIDENCE_TYPES = [
49
+ "tool_use",
50
+ "tool_use_requested",
51
+ "session_completed",
52
+ "session_spawn"
53
+ ];
47
54
  function capabilityUri(descriptor) {
48
55
  return `${descriptor.id}:${descriptor.version}`;
49
56
  }
@@ -52,10 +59,11 @@ function isChpV01Outcome(value) {
52
59
  }
53
60
 
54
61
  // src/index.ts
55
- var CHP_VERSION = "0.1";
56
- var VERSION = "0.1.0";
62
+ var CHP_VERSION = "0.2";
63
+ var VERSION = "0.2.2";
57
64
  // Annotate the CommonJS export names for ESM import in node:
58
65
  0 && (module.exports = {
66
+ CHP_AGENTIC_EVIDENCE_TYPES,
59
67
  CHP_V0_1_CORE_EVIDENCE_TYPES,
60
68
  CHP_V0_1_OUTCOMES,
61
69
  CHP_V0_1_VERSION,
package/dist/index.mjs CHANGED
@@ -13,6 +13,12 @@ var CHP_V0_1_CORE_EVIDENCE_TYPES = [
13
13
  "execution_denied",
14
14
  "execution_skipped"
15
15
  ];
16
+ var CHP_AGENTIC_EVIDENCE_TYPES = [
17
+ "tool_use",
18
+ "tool_use_requested",
19
+ "session_completed",
20
+ "session_spawn"
21
+ ];
16
22
  function capabilityUri(descriptor) {
17
23
  return `${descriptor.id}:${descriptor.version}`;
18
24
  }
@@ -21,9 +27,10 @@ function isChpV01Outcome(value) {
21
27
  }
22
28
 
23
29
  // src/index.ts
24
- var CHP_VERSION = "0.1";
25
- var VERSION = "0.1.0";
30
+ var CHP_VERSION = "0.2";
31
+ var VERSION = "0.2.2";
26
32
  export {
33
+ CHP_AGENTIC_EVIDENCE_TYPES,
27
34
  CHP_V0_1_CORE_EVIDENCE_TYPES,
28
35
  CHP_V0_1_OUTCOMES,
29
36
  CHP_V0_1_VERSION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capabilityhostprotocol/types",
3
- "version": "0.2.1",
3
+ "version": "0.5.0",
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/index.ts CHANGED
@@ -12,5 +12,5 @@
12
12
 
13
13
  export * from "./v0_1.js";
14
14
 
15
- export const CHP_VERSION = "0.1";
16
- export const VERSION = "0.1.0";
15
+ export const CHP_VERSION = "0.2";
16
+ export const VERSION = "0.2.2";
package/src/v0_1.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * CHP v0.1 protocol types.
2
+ * CHP v0.2 protocol types.
3
3
  *
4
4
  * These interfaces mirror the JSON Schemas in the repository root `schemas/`
5
5
  * directory. They are intentionally transport-neutral and do not depend on the
@@ -36,6 +36,13 @@ export const CHP_V0_1_CORE_EVIDENCE_TYPES = [
36
36
  "execution_skipped",
37
37
  ] as const;
38
38
 
39
+ export const CHP_AGENTIC_EVIDENCE_TYPES = [
40
+ "tool_use",
41
+ "tool_use_requested",
42
+ "session_completed",
43
+ "session_spawn",
44
+ ] as const;
45
+
39
46
  export interface AssuranceMetadata {
40
47
  level: AssuranceLevel;
41
48
  evidence_policy?: string;
@@ -51,6 +58,52 @@ export interface InvariantDescriptor {
51
58
  parameters?: JsonObject;
52
59
  }
53
60
 
61
+ export interface CostHint {
62
+ token_estimate?: number | null;
63
+ latency_ms_p50?: number | null;
64
+ idempotent?: boolean;
65
+ }
66
+
67
+ export type BlastRadius = "local" | "session" | "user" | "system";
68
+
69
+ export interface SafetyHint {
70
+ reversible?: boolean;
71
+ destructive?: boolean;
72
+ requires_human_review?: boolean;
73
+ blast_radius?: BlastRadius;
74
+ }
75
+
76
+ export type StateMachineStatus = "queued" | "running" | "blocked" | "done" | "failed" | "cancelled";
77
+
78
+ export interface StateMachineDefinition {
79
+ states: string[];
80
+ transitions: Record<string, string[]>;
81
+ initial_state: string;
82
+ terminal_states: string[];
83
+ }
84
+
85
+ export interface StateMachineRecord {
86
+ machine_id: string;
87
+ name: string;
88
+ definition: StateMachineDefinition;
89
+ current_state: string;
90
+ status: StateMachineStatus;
91
+ context: JsonObject;
92
+ created_at: string;
93
+ updated_at: string;
94
+ history: JsonObject[];
95
+ }
96
+
97
+ export interface StateMachineTransitionResult {
98
+ machine_id: string;
99
+ from_state: string;
100
+ to_state: string;
101
+ event: string;
102
+ allowed: boolean;
103
+ reason?: string | null;
104
+ updated_at: string;
105
+ }
106
+
54
107
  export interface CapabilityDescriptor {
55
108
  id: string;
56
109
  version: string;
@@ -66,6 +119,9 @@ export interface CapabilityDescriptor {
66
119
  risk?: CapabilityRisk;
67
120
  assurance?: AssuranceMetadata;
68
121
  metadata?: JsonObject;
122
+ depends_on?: string[] | null;
123
+ cost_hint?: CostHint | null;
124
+ safety_hint?: SafetyHint | null;
69
125
  }
70
126
 
71
127
  export interface HostDescriptor {
@@ -143,6 +199,45 @@ export interface ExecutionEvidence {
143
199
  assurance: AssuranceMetadata;
144
200
  }
145
201
 
202
+ export interface ToolUseEvidence extends ExecutionEvidence {
203
+ event_type: "tool_use";
204
+ payload: {
205
+ tool_name: string;
206
+ cwd?: string;
207
+ tool_input?: JsonObject;
208
+ tool_output_preview?: string;
209
+ exit_code?: number | null;
210
+ };
211
+ }
212
+
213
+ export interface PreToolEvidence extends ExecutionEvidence {
214
+ event_type: "tool_use_requested";
215
+ payload: {
216
+ tool_name: string;
217
+ cwd?: string;
218
+ tool_input?: JsonObject;
219
+ blocked: boolean;
220
+ block_reason?: string | null;
221
+ };
222
+ }
223
+
224
+ export interface SessionEvidence extends ExecutionEvidence {
225
+ event_type: "session_completed";
226
+ payload: {
227
+ tool_count: number;
228
+ transcript_path?: string;
229
+ };
230
+ }
231
+
232
+ export interface SessionSpawnEvidence extends ExecutionEvidence {
233
+ event_type: "session_spawn";
234
+ payload: {
235
+ parent_session_id: string;
236
+ child_session_id: string;
237
+ tool_name: string;
238
+ };
239
+ }
240
+
146
241
  export interface ReplayQuery {
147
242
  correlation_id: string;
148
243
  limit?: number | null;