@company-semantics/contracts 9.1.0 → 9.2.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 (141) hide show
  1. package/package.json +4 -1
  2. package/src/__tests__/resource-keys.test.ts +30 -23
  3. package/src/admin/authz-simulate.ts +4 -4
  4. package/src/admin/direct-grants.ts +2 -2
  5. package/src/api/generated-spec-hash.ts +2 -2
  6. package/src/api/generated.ts +97 -0
  7. package/src/api/http/routes/ai-chat.ts +3 -3
  8. package/src/api/http/utils/resource-response.ts +5 -2
  9. package/src/api/index.ts +4 -4
  10. package/src/api/primitives.ts +6 -2
  11. package/src/auth/README.md +1 -0
  12. package/src/auth/index.ts +12 -5
  13. package/src/autotune.ts +5 -1
  14. package/src/billing/index.ts +1 -1
  15. package/src/billing/types.ts +1 -1
  16. package/src/chat/README.md +3 -0
  17. package/src/chat/__tests__/runtime-profile.test.ts +68 -48
  18. package/src/chat/index.ts +10 -4
  19. package/src/chat/runtime-profile.ts +25 -10
  20. package/src/chat/schemas.ts +49 -41
  21. package/src/chat/types.ts +48 -42
  22. package/src/ci-envelope/README.md +2 -0
  23. package/src/ci-envelope/__tests__/transitions.test.ts +56 -56
  24. package/src/ci-envelope/index.ts +2 -2
  25. package/src/ci-envelope/types.ts +20 -20
  26. package/src/ci-results/index.ts +2 -2
  27. package/src/ci-results/repo-ci-result.ts +15 -12
  28. package/src/compatibility.ts +6 -6
  29. package/src/content/index.ts +10 -4
  30. package/src/content/schemas.ts +42 -24
  31. package/src/dispatch/index.ts +18 -15
  32. package/src/email/__tests__/registry.test.ts +81 -77
  33. package/src/email/index.ts +3 -3
  34. package/src/email/registry.ts +25 -25
  35. package/src/email/types.ts +43 -43
  36. package/src/errors/index.ts +8 -8
  37. package/src/execution/__tests__/events.test.ts +42 -42
  38. package/src/execution/__tests__/lifecycle.test.ts +192 -190
  39. package/src/execution/__tests__/registry.test.ts +114 -114
  40. package/src/execution/audit-export.ts +4 -4
  41. package/src/execution/errors.ts +7 -7
  42. package/src/execution/event-metadata.ts +4 -4
  43. package/src/execution/events.ts +23 -21
  44. package/src/execution/expiry.ts +5 -5
  45. package/src/execution/hash-chain.ts +2 -2
  46. package/src/execution/index.ts +19 -28
  47. package/src/execution/kinds.ts +7 -7
  48. package/src/execution/lifecycle.ts +33 -33
  49. package/src/execution/registry.ts +63 -63
  50. package/src/execution/schemas.ts +31 -23
  51. package/src/execution/status.ts +45 -26
  52. package/src/execution/summary.ts +16 -17
  53. package/src/execution/timeline-ui.ts +9 -9
  54. package/src/execution/types.ts +31 -25
  55. package/src/generated/openapi-routes.ts +1 -0
  56. package/src/guards/config.ts +22 -18
  57. package/src/guards/index.ts +4 -4
  58. package/src/guards/types.ts +32 -24
  59. package/src/identity/__tests__/avatar.test.ts +68 -59
  60. package/src/identity/avatar.ts +8 -8
  61. package/src/identity/display-name.ts +3 -3
  62. package/src/identity/index.ts +8 -8
  63. package/src/identity/people-org-chart.ts +8 -4
  64. package/src/identity/schemas.ts +28 -18
  65. package/src/identity/types.ts +5 -5
  66. package/src/impersonation/index.ts +5 -5
  67. package/src/impersonation/schemas.ts +15 -9
  68. package/src/impersonation-events.ts +21 -21
  69. package/src/impersonation.ts +25 -24
  70. package/src/index.ts +118 -90
  71. package/src/interfaces/mcp/tools/help.ts +19 -19
  72. package/src/internal-admin.ts +6 -6
  73. package/src/mcp/README.md +2 -0
  74. package/src/mcp/__tests__/capability-graph.test.ts +290 -290
  75. package/src/mcp/capability-graph.ts +42 -40
  76. package/src/mcp/failure-context.ts +1 -3
  77. package/src/mcp/index.ts +57 -57
  78. package/src/mcp/resources.ts +9 -9
  79. package/src/meetings/index.ts +2 -2
  80. package/src/meetings/schemas.ts +51 -34
  81. package/src/message-parts/README.md +2 -0
  82. package/src/message-parts/__tests__/builder.test.ts +142 -142
  83. package/src/message-parts/__tests__/confirmation.test.ts +100 -86
  84. package/src/message-parts/__tests__/preview.test.ts +63 -63
  85. package/src/message-parts/__tests__/wire.test.ts +130 -124
  86. package/src/message-parts/builder.ts +23 -23
  87. package/src/message-parts/confirmation.ts +17 -14
  88. package/src/message-parts/execution.ts +7 -7
  89. package/src/message-parts/index.ts +10 -10
  90. package/src/message-parts/lifecycle.ts +25 -25
  91. package/src/message-parts/preview.ts +30 -30
  92. package/src/message-parts/types.ts +27 -27
  93. package/src/message-parts/wire.ts +24 -24
  94. package/src/mutations.ts +2 -2
  95. package/src/observability.ts +23 -11
  96. package/src/org/__tests__/org-units.test.ts +131 -96
  97. package/src/org/__tests__/tree-ordering.test.ts +57 -37
  98. package/src/org/__tests__/view-scopes.test.ts +40 -40
  99. package/src/org/domain.ts +9 -9
  100. package/src/org/index.ts +24 -21
  101. package/src/org/org-units.ts +34 -20
  102. package/src/org/schemas.ts +201 -127
  103. package/src/org/sharing.ts +17 -13
  104. package/src/org/tree-ordering.ts +3 -1
  105. package/src/org/types.ts +54 -47
  106. package/src/org/view-scopes.ts +9 -9
  107. package/src/permissions/access-levels.ts +7 -2
  108. package/src/permissions/access-source.ts +6 -6
  109. package/src/permissions/index.ts +5 -5
  110. package/src/permissions/orgchart-roles.ts +7 -7
  111. package/src/permissions/permission-introspection.ts +7 -5
  112. package/src/permissions/share-api.ts +19 -9
  113. package/src/pressure.ts +4 -4
  114. package/src/queryIntent.ts +21 -21
  115. package/src/ralph/__tests__/prd-groups.test.ts +159 -159
  116. package/src/ralph/__tests__/prd.test.ts +30 -30
  117. package/src/ralph/index.ts +3 -8
  118. package/src/ralph/prd.ts +33 -33
  119. package/src/ralph/progress.ts +1 -1
  120. package/src/rate-limit/README.md +4 -4
  121. package/src/rate-limit/index.ts +3 -3
  122. package/src/requests.ts +36 -8
  123. package/src/resource-keys.ts +207 -124
  124. package/src/resource-registry.ts +5 -5
  125. package/src/route-builder.ts +3 -3
  126. package/src/safe-mode.ts +2 -2
  127. package/src/security/index.ts +4 -4
  128. package/src/security/org-secrets.ts +13 -9
  129. package/src/security/secret.ts +3 -3
  130. package/src/sse.ts +3 -1
  131. package/src/system/README.md +3 -0
  132. package/src/system/capabilities.ts +22 -23
  133. package/src/system/diagram.ts +45 -45
  134. package/src/system/index.ts +14 -14
  135. package/src/tiers.ts +1 -1
  136. package/src/timeouts.ts +1 -1
  137. package/src/tracing.ts +30 -30
  138. package/src/types/analytics.ts +2 -2
  139. package/src/usage/README.md +3 -0
  140. package/src/usage/execution-types.ts +69 -69
  141. package/src/usage/types.ts +7 -3
@@ -1,25 +1,25 @@
1
- import { describe, it, expect } from 'vitest'
1
+ import { describe, it, expect } from "vitest";
2
2
  import {
3
3
  EXECUTION_KINDS,
4
4
  getExecutionKindDefinition,
5
5
  isValidExecutionKind,
6
- } from '../registry.js'
6
+ } from "../registry.js";
7
7
 
8
- describe('EXECUTION_KINDS golden snapshot', () => {
9
- it('exact values are frozen', () => {
8
+ describe("EXECUTION_KINDS golden snapshot", () => {
9
+ it("exact values are frozen", () => {
10
10
  expect(EXECUTION_KINDS).toStrictEqual({
11
- 'integration.connect': {
12
- kind: 'integration.connect',
13
- domain: 'integration',
11
+ "integration.connect": {
12
+ kind: "integration.connect",
13
+ domain: "integration",
14
14
  display: {
15
- label: 'Connect Slack',
16
- pastTenseLabel: 'Slack connected',
17
- icon: 'plug',
15
+ label: "Connect Slack",
16
+ pastTenseLabel: "Slack connected",
17
+ icon: "plug",
18
18
  },
19
19
  governance: {
20
- visibility: 'admin',
20
+ visibility: "admin",
21
21
  requiresAdmin: true,
22
- reversibleBy: 'integration.disconnect',
22
+ reversibleBy: "integration.disconnect",
23
23
  },
24
24
  ui: {
25
25
  showInAdmin: true,
@@ -27,19 +27,19 @@ describe('EXECUTION_KINDS golden snapshot', () => {
27
27
  confirmBeforeRun: false,
28
28
  },
29
29
  explanation: {
30
- templateId: 'integration.connect',
30
+ templateId: "integration.connect",
31
31
  },
32
32
  },
33
- 'integration.disconnect': {
34
- kind: 'integration.disconnect',
35
- domain: 'integration',
33
+ "integration.disconnect": {
34
+ kind: "integration.disconnect",
35
+ domain: "integration",
36
36
  display: {
37
- label: 'Disconnect Slack',
38
- pastTenseLabel: 'Slack disconnected',
39
- icon: 'unlink',
37
+ label: "Disconnect Slack",
38
+ pastTenseLabel: "Slack disconnected",
39
+ icon: "unlink",
40
40
  },
41
41
  governance: {
42
- visibility: 'admin',
42
+ visibility: "admin",
43
43
  requiresAdmin: true,
44
44
  },
45
45
  ui: {
@@ -48,19 +48,19 @@ describe('EXECUTION_KINDS golden snapshot', () => {
48
48
  confirmBeforeRun: true,
49
49
  },
50
50
  explanation: {
51
- templateId: 'integration.disconnect',
51
+ templateId: "integration.disconnect",
52
52
  },
53
53
  },
54
- 'profile.update': {
55
- kind: 'profile.update',
56
- domain: 'profile',
54
+ "profile.update": {
55
+ kind: "profile.update",
56
+ domain: "profile",
57
57
  display: {
58
- label: 'Update Profile',
59
- pastTenseLabel: 'Profile updated',
60
- icon: 'pencil',
58
+ label: "Update Profile",
59
+ pastTenseLabel: "Profile updated",
60
+ icon: "pencil",
61
61
  },
62
62
  governance: {
63
- visibility: 'user',
63
+ visibility: "user",
64
64
  requiresAdmin: false,
65
65
  },
66
66
  ui: {
@@ -69,19 +69,19 @@ describe('EXECUTION_KINDS golden snapshot', () => {
69
69
  confirmBeforeRun: true,
70
70
  },
71
71
  explanation: {
72
- templateId: 'profile.update',
72
+ templateId: "profile.update",
73
73
  },
74
74
  },
75
- 'slack.send': {
76
- kind: 'slack.send',
77
- domain: 'communication',
75
+ "slack.send": {
76
+ kind: "slack.send",
77
+ domain: "communication",
78
78
  display: {
79
- label: 'Send Slack Message',
80
- pastTenseLabel: 'Slack message sent',
81
- icon: 'send',
79
+ label: "Send Slack Message",
80
+ pastTenseLabel: "Slack message sent",
81
+ icon: "send",
82
82
  },
83
83
  governance: {
84
- visibility: 'user',
84
+ visibility: "user",
85
85
  requiresAdmin: false,
86
86
  },
87
87
  ui: {
@@ -90,19 +90,19 @@ describe('EXECUTION_KINDS golden snapshot', () => {
90
90
  confirmBeforeRun: true,
91
91
  },
92
92
  explanation: {
93
- templateId: 'slack.send',
93
+ templateId: "slack.send",
94
94
  },
95
95
  },
96
- 'data.ingest': {
97
- kind: 'data.ingest',
98
- domain: 'data',
96
+ "data.ingest": {
97
+ kind: "data.ingest",
98
+ domain: "data",
99
99
  display: {
100
- label: 'Import Channel',
101
- pastTenseLabel: 'Channel imported',
102
- icon: 'send',
100
+ label: "Import Channel",
101
+ pastTenseLabel: "Channel imported",
102
+ icon: "send",
103
103
  },
104
104
  governance: {
105
- visibility: 'user',
105
+ visibility: "user",
106
106
  requiresAdmin: false,
107
107
  },
108
108
  ui: {
@@ -111,19 +111,19 @@ describe('EXECUTION_KINDS golden snapshot', () => {
111
111
  confirmBeforeRun: true,
112
112
  },
113
113
  explanation: {
114
- templateId: 'data-ingest',
114
+ templateId: "data-ingest",
115
115
  },
116
116
  },
117
- 'data.scope': {
118
- kind: 'data.scope',
119
- domain: 'data',
117
+ "data.scope": {
118
+ kind: "data.scope",
119
+ domain: "data",
120
120
  display: {
121
- label: 'Update Channel Scope',
122
- pastTenseLabel: 'Channel scope updated',
123
- icon: 'pencil',
121
+ label: "Update Channel Scope",
122
+ pastTenseLabel: "Channel scope updated",
123
+ icon: "pencil",
124
124
  },
125
125
  governance: {
126
- visibility: 'admin',
126
+ visibility: "admin",
127
127
  requiresAdmin: true,
128
128
  },
129
129
  ui: {
@@ -132,19 +132,19 @@ describe('EXECUTION_KINDS golden snapshot', () => {
132
132
  confirmBeforeRun: true,
133
133
  },
134
134
  explanation: {
135
- templateId: 'data-scope',
135
+ templateId: "data-scope",
136
136
  },
137
137
  },
138
- 'system.cleanup': {
139
- kind: 'system.cleanup',
140
- domain: 'system',
138
+ "system.cleanup": {
139
+ kind: "system.cleanup",
140
+ domain: "system",
141
141
  display: {
142
- label: 'Cleanup Connections',
143
- pastTenseLabel: 'Connections cleaned up',
144
- icon: 'unlink',
142
+ label: "Cleanup Connections",
143
+ pastTenseLabel: "Connections cleaned up",
144
+ icon: "unlink",
145
145
  },
146
146
  governance: {
147
- visibility: 'admin',
147
+ visibility: "admin",
148
148
  requiresAdmin: true,
149
149
  },
150
150
  ui: {
@@ -153,92 +153,92 @@ describe('EXECUTION_KINDS golden snapshot', () => {
153
153
  confirmBeforeRun: true,
154
154
  },
155
155
  explanation: {
156
- templateId: 'system-cleanup',
156
+ templateId: "system-cleanup",
157
157
  },
158
158
  },
159
- })
160
- })
161
- })
159
+ });
160
+ });
161
+ });
162
162
 
163
- describe('registry structural invariants', () => {
164
- it('every registry key matches its definition.kind field', () => {
163
+ describe("registry structural invariants", () => {
164
+ it("every registry key matches its definition.kind field", () => {
165
165
  for (const [key, def] of Object.entries(EXECUTION_KINDS)) {
166
- expect(def.kind).toBe(key)
166
+ expect(def.kind).toBe(key);
167
167
  }
168
- })
168
+ });
169
169
 
170
- it('all entries have required display fields as non-empty strings', () => {
170
+ it("all entries have required display fields as non-empty strings", () => {
171
171
  for (const [, def] of Object.entries(EXECUTION_KINDS)) {
172
- expect(typeof def.display.label).toBe('string')
173
- expect(def.display.label.length).toBeGreaterThan(0)
174
- expect(typeof def.display.pastTenseLabel).toBe('string')
175
- expect(def.display.pastTenseLabel.length).toBeGreaterThan(0)
176
- expect(typeof def.display.icon).toBe('string')
177
- expect(def.display.icon.length).toBeGreaterThan(0)
172
+ expect(typeof def.display.label).toBe("string");
173
+ expect(def.display.label.length).toBeGreaterThan(0);
174
+ expect(typeof def.display.pastTenseLabel).toBe("string");
175
+ expect(def.display.pastTenseLabel.length).toBeGreaterThan(0);
176
+ expect(typeof def.display.icon).toBe("string");
177
+ expect(def.display.icon.length).toBeGreaterThan(0);
178
178
  }
179
- })
179
+ });
180
180
 
181
- it('all entries have required governance fields', () => {
181
+ it("all entries have required governance fields", () => {
182
182
  for (const [, def] of Object.entries(EXECUTION_KINDS)) {
183
- expect(typeof def.governance.visibility).toBe('string')
184
- expect(typeof def.governance.requiresAdmin).toBe('boolean')
183
+ expect(typeof def.governance.visibility).toBe("string");
184
+ expect(typeof def.governance.requiresAdmin).toBe("boolean");
185
185
  }
186
- })
186
+ });
187
187
 
188
- it('all entries have required ui fields as booleans', () => {
188
+ it("all entries have required ui fields as booleans", () => {
189
189
  for (const [, def] of Object.entries(EXECUTION_KINDS)) {
190
- expect(typeof def.ui.showInAdmin).toBe('boolean')
191
- expect(typeof def.ui.showInTimeline).toBe('boolean')
192
- expect(typeof def.ui.confirmBeforeRun).toBe('boolean')
190
+ expect(typeof def.ui.showInAdmin).toBe("boolean");
191
+ expect(typeof def.ui.showInTimeline).toBe("boolean");
192
+ expect(typeof def.ui.confirmBeforeRun).toBe("boolean");
193
193
  }
194
- })
194
+ });
195
195
 
196
- it('admin-required kinds have visibility=admin', () => {
196
+ it("admin-required kinds have visibility=admin", () => {
197
197
  for (const [, def] of Object.entries(EXECUTION_KINDS)) {
198
198
  if (def.governance.requiresAdmin) {
199
- expect(def.governance.visibility).toBe('admin')
199
+ expect(def.governance.visibility).toBe("admin");
200
200
  }
201
201
  }
202
- })
203
- })
202
+ });
203
+ });
204
204
 
205
- describe('getExecutionKindDefinition', () => {
206
- it('returns correct definition for each of the 7 kinds', () => {
205
+ describe("getExecutionKindDefinition", () => {
206
+ it("returns correct definition for each of the 7 kinds", () => {
207
207
  const kinds = Object.keys(EXECUTION_KINDS) as Array<
208
208
  keyof typeof EXECUTION_KINDS
209
- >
209
+ >;
210
210
  for (const kind of kinds) {
211
- const def = getExecutionKindDefinition(kind)
212
- expect(def.kind).toBe(kind)
211
+ const def = getExecutionKindDefinition(kind);
212
+ expect(def.kind).toBe(kind);
213
213
  }
214
- })
214
+ });
215
215
 
216
- it('return value matches registry entry (same reference)', () => {
216
+ it("return value matches registry entry (same reference)", () => {
217
217
  const kinds = Object.keys(EXECUTION_KINDS) as Array<
218
218
  keyof typeof EXECUTION_KINDS
219
- >
219
+ >;
220
220
  for (const kind of kinds) {
221
- expect(getExecutionKindDefinition(kind)).toBe(EXECUTION_KINDS[kind])
221
+ expect(getExecutionKindDefinition(kind)).toBe(EXECUTION_KINDS[kind]);
222
222
  }
223
- })
224
- })
223
+ });
224
+ });
225
225
 
226
- describe('isValidExecutionKind', () => {
227
- it('returns true for all 7 valid execution kinds', () => {
226
+ describe("isValidExecutionKind", () => {
227
+ it("returns true for all 7 valid execution kinds", () => {
228
228
  for (const kind of Object.keys(EXECUTION_KINDS)) {
229
- expect(isValidExecutionKind(kind)).toBe(true)
229
+ expect(isValidExecutionKind(kind)).toBe(true);
230
230
  }
231
- })
231
+ });
232
232
 
233
- it('returns false for unknown string', () => {
234
- expect(isValidExecutionKind('unknown.action')).toBe(false)
235
- })
233
+ it("returns false for unknown string", () => {
234
+ expect(isValidExecutionKind("unknown.action")).toBe(false);
235
+ });
236
236
 
237
- it('returns false for empty string', () => {
238
- expect(isValidExecutionKind('')).toBe(false)
239
- })
237
+ it("returns false for empty string", () => {
238
+ expect(isValidExecutionKind("")).toBe(false);
239
+ });
240
240
 
241
- it('returns false for partial match', () => {
242
- expect(isValidExecutionKind('integration')).toBe(false)
243
- })
244
- })
241
+ it("returns false for partial match", () => {
242
+ expect(isValidExecutionKind("integration")).toBe(false);
243
+ });
244
+ });
@@ -1,6 +1,6 @@
1
- import type { ExecutionEventType } from './events';
2
- import type { ExecutionIntent } from './types';
3
- import type { HashChainVerificationResult } from './hash-chain';
1
+ import type { ExecutionEventType } from "./events";
2
+ import type { ExecutionIntent } from "./types";
3
+ import type { HashChainVerificationResult } from "./hash-chain";
4
4
 
5
5
  /**
6
6
  * Immutable governance snapshot captured at execution creation time.
@@ -45,7 +45,7 @@ export interface AuditExportEvent {
45
45
  */
46
46
  export interface AuditExportBundle {
47
47
  /** Schema version for forward compatibility */
48
- version: '1.0';
48
+ version: "1.0";
49
49
  /** ISO 8601 timestamp of export generation */
50
50
  exportedAt: string;
51
51
  /** Execution ID */
@@ -1,13 +1,13 @@
1
1
  export type ExecutionErrorCode =
2
- | 'execution_expired'
3
- | 'execution_already_confirmed'
4
- | 'execution_awaiting_approval'
5
- | 'execution_not_found'
6
- | 'execution_forbidden'
7
- | 'execution_invalid_transition';
2
+ | "execution_expired"
3
+ | "execution_already_confirmed"
4
+ | "execution_awaiting_approval"
5
+ | "execution_not_found"
6
+ | "execution_forbidden"
7
+ | "execution_invalid_transition";
8
8
 
9
9
  export interface ExecutionError {
10
- readonly name: 'ExecutionError';
10
+ readonly name: "ExecutionError";
11
11
  readonly code: ExecutionErrorCode;
12
12
  readonly message: string;
13
13
  }
@@ -1,5 +1,5 @@
1
- import type { ExecutionEventType } from './events';
2
- import type { ExecutionIntent } from './types';
1
+ import type { ExecutionEventType } from "./events";
2
+ import type { ExecutionIntent } from "./types";
3
3
 
4
4
  /** Metadata for execution_created event. Frozen governance snapshot. */
5
5
  export interface ExecutionCreatedMetadata {
@@ -31,7 +31,7 @@ export interface ConfirmationRejectedMetadata {
31
31
  /** Metadata for confirmation_expired event. */
32
32
  export interface ConfirmationExpiredMetadata {
33
33
  /** What triggered the expiration */
34
- trigger: 'job' | 'confirm_attempt';
34
+ trigger: "job" | "confirm_attempt";
35
35
  /** ISO 8601 timestamp when expiration was recorded */
36
36
  expiredAt: string;
37
37
  /** ISO 8601 original confirmation deadline */
@@ -59,7 +59,7 @@ export interface ExecutionFailedMetadata {
59
59
  /** Machine-readable error code */
60
60
  errorCode?: string;
61
61
  /** Error classification for retry decisions */
62
- errorClass?: 'retryable' | 'terminal';
62
+ errorClass?: "retryable" | "terminal";
63
63
  /** Human-readable error message */
64
64
  message?: string;
65
65
  }
@@ -8,30 +8,32 @@
8
8
  * These are defined here for type exhaustiveness but not yet emitted by backend.
9
9
  */
10
10
  export type ExecutionEventType =
11
- | 'execution_created'
12
- | 'execution_started'
13
- | 'confirmation_approved'
14
- | 'confirmation_rejected'
15
- | 'confirmation_expired'
16
- | 'approval_requested'
17
- | 'execution_completed'
18
- | 'execution_failed'
19
- | 'undo_completed'
20
- | 'cancelled';
11
+ | "execution_created"
12
+ | "execution_started"
13
+ | "confirmation_approved"
14
+ | "confirmation_rejected"
15
+ | "confirmation_expired"
16
+ | "approval_requested"
17
+ | "execution_completed"
18
+ | "execution_failed"
19
+ | "undo_completed"
20
+ | "cancelled";
21
21
 
22
22
  export const EXECUTION_EVENT_TYPES: readonly ExecutionEventType[] = [
23
- 'execution_created',
24
- 'execution_started',
25
- 'confirmation_approved',
26
- 'confirmation_rejected',
27
- 'confirmation_expired',
28
- 'approval_requested',
29
- 'execution_completed',
30
- 'execution_failed',
31
- 'undo_completed',
32
- 'cancelled',
23
+ "execution_created",
24
+ "execution_started",
25
+ "confirmation_approved",
26
+ "confirmation_rejected",
27
+ "confirmation_expired",
28
+ "approval_requested",
29
+ "execution_completed",
30
+ "execution_failed",
31
+ "undo_completed",
32
+ "cancelled",
33
33
  ] as const;
34
34
 
35
- export function isExecutionEventType(value: string): value is ExecutionEventType {
35
+ export function isExecutionEventType(
36
+ value: string,
37
+ ): value is ExecutionEventType {
36
38
  return (EXECUTION_EVENT_TYPES as readonly string[]).includes(value);
37
39
  }
@@ -16,9 +16,9 @@
16
16
  export function parseExpiresAt(
17
17
  expiresAt: string | undefined,
18
18
  ): number | undefined {
19
- if (expiresAt === undefined) return undefined
20
- const ms = new Date(expiresAt).getTime()
21
- return Number.isFinite(ms) ? ms : undefined
19
+ if (expiresAt === undefined) return undefined;
20
+ const ms = new Date(expiresAt).getTime();
21
+ return Number.isFinite(ms) ? ms : undefined;
22
22
  }
23
23
 
24
24
  /**
@@ -29,6 +29,6 @@ export function isConfirmationExpired(
29
29
  expiresAtMs: number | undefined,
30
30
  now?: number,
31
31
  ): boolean {
32
- if (expiresAtMs === undefined) return false
33
- return (now ?? Date.now()) >= expiresAtMs
32
+ if (expiresAtMs === undefined) return false;
33
+ return (now ?? Date.now()) >= expiresAtMs;
34
34
  }
@@ -34,7 +34,7 @@ export interface HashChainVerificationResult {
34
34
  }
35
35
 
36
36
  /** Hash algorithm used for event chain integrity */
37
- export const HASH_ALGORITHM = 'sha256' as const;
37
+ export const HASH_ALGORITHM = "sha256" as const;
38
38
 
39
39
  /** Encoding for hash output */
40
- export const HASH_ENCODING = 'hex' as const;
40
+ export const HASH_ENCODING = "hex" as const;
@@ -11,12 +11,9 @@
11
11
  // Event Types
12
12
  // =============================================================================
13
13
 
14
- export type { ExecutionEventType } from './events'
14
+ export type { ExecutionEventType } from "./events";
15
15
 
16
- export {
17
- EXECUTION_EVENT_TYPES,
18
- isExecutionEventType,
19
- } from './events'
16
+ export { EXECUTION_EVENT_TYPES, isExecutionEventType } from "./events";
20
17
 
21
18
  // =============================================================================
22
19
  // Event Metadata Schemas
@@ -34,7 +31,7 @@ export type {
34
31
  UndoCompletedMetadata,
35
32
  CancelledMetadata,
36
33
  ExecutionEventMetadataMap,
37
- } from './event-metadata'
34
+ } from "./event-metadata";
38
35
 
39
36
  // =============================================================================
40
37
  // Hash Chain Types
@@ -43,12 +40,9 @@ export type {
43
40
  export type {
44
41
  EventHashFields,
45
42
  HashChainVerificationResult,
46
- } from './hash-chain'
43
+ } from "./hash-chain";
47
44
 
48
- export {
49
- HASH_ALGORITHM,
50
- HASH_ENCODING,
51
- } from './hash-chain'
45
+ export { HASH_ALGORITHM, HASH_ENCODING } from "./hash-chain";
52
46
 
53
47
  // =============================================================================
54
48
  // Audit Export Types
@@ -58,26 +52,26 @@ export type {
58
52
  FrozenExecutionIntent,
59
53
  AuditExportEvent,
60
54
  AuditExportBundle,
61
- } from './audit-export'
55
+ } from "./audit-export";
62
56
 
63
57
  // =============================================================================
64
58
  // Kind Types
65
59
  // =============================================================================
66
60
 
67
- export type { ExecutionKind } from './kinds'
61
+ export type { ExecutionKind } from "./kinds";
68
62
 
69
63
  // =============================================================================
70
64
  // Lifecycle State
71
65
  // =============================================================================
72
66
 
73
- export type { ExecutionState } from './status'
67
+ export type { ExecutionState } from "./status";
74
68
 
75
69
  export {
76
70
  VALID_TRANSITIONS,
77
71
  TERMINAL_STATES,
78
72
  EFFECTIVE_TERMINAL_STATES,
79
73
  assertValidTransition,
80
- } from './status'
74
+ } from "./status";
81
75
 
82
76
  // =============================================================================
83
77
  // Lifecycle Decision Engine
@@ -86,24 +80,21 @@ export {
86
80
  export type {
87
81
  ExecutionIntent as LifecycleIntent,
88
82
  LifecycleDecision,
89
- } from './lifecycle'
83
+ } from "./lifecycle";
90
84
 
91
- export {
92
- LIFECYCLE_DECISIONS,
93
- applyIntent,
94
- } from './lifecycle'
85
+ export { LIFECYCLE_DECISIONS, applyIntent } from "./lifecycle";
95
86
 
96
87
  // =============================================================================
97
88
  // Expiry Helpers
98
89
  // =============================================================================
99
90
 
100
- export { parseExpiresAt, isConfirmationExpired } from './expiry'
91
+ export { parseExpiresAt, isConfirmationExpired } from "./expiry";
101
92
 
102
93
  // =============================================================================
103
94
  // Error Types
104
95
  // =============================================================================
105
96
 
106
- export type { ExecutionErrorCode, ExecutionError } from './errors'
97
+ export type { ExecutionErrorCode, ExecutionError } from "./errors";
107
98
 
108
99
  // =============================================================================
109
100
  // Definition Types
@@ -115,7 +106,7 @@ export type {
115
106
  ExecutionDomain,
116
107
  ExecutionKindDefinition,
117
108
  ExecutionIntent,
118
- } from './types'
109
+ } from "./types";
119
110
 
120
111
  // =============================================================================
121
112
  // Registry
@@ -125,7 +116,7 @@ export {
125
116
  EXECUTION_KINDS,
126
117
  getExecutionKindDefinition,
127
118
  isValidExecutionKind,
128
- } from './registry'
119
+ } from "./registry";
129
120
 
130
121
  // =============================================================================
131
122
  // Projection Contracts
@@ -137,14 +128,14 @@ export type {
137
128
  ExecutionInitiator,
138
129
  ExecutionStatus,
139
130
  ExecutionSummary,
140
- } from './summary'
131
+ } from "./summary";
141
132
 
142
133
  // TimelineUIEvent (user-facing projection)
143
134
  export type {
144
135
  TimelineStatus,
145
136
  TimelineIcon,
146
137
  TimelineUIEvent,
147
- } from './timeline-ui'
138
+ } from "./timeline-ui";
148
139
 
149
140
  // =============================================================================
150
141
  // HTTP Response Schemas (Zod)
@@ -158,7 +149,7 @@ export {
158
149
  ConfirmExecutionResponseSchema,
159
150
  RejectExecutionResponseSchema,
160
151
  StartExecutionResponseSchema,
161
- } from './schemas'
152
+ } from "./schemas";
162
153
 
163
154
  export type {
164
155
  ExecutionSummaryResponse,
@@ -168,4 +159,4 @@ export type {
168
159
  ConfirmExecutionResponse,
169
160
  RejectExecutionResponse,
170
161
  StartExecutionResponse,
171
- } from './schemas'
162
+ } from "./schemas";