@company-semantics/contracts 0.89.0 → 0.91.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-semantics/contracts",
3
- "version": "0.89.0",
3
+ "version": "0.91.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/src/chat/index.ts CHANGED
@@ -38,12 +38,6 @@ export type {
38
38
  ChatInvalidationEvent,
39
39
  // SSE event unions
40
40
  ChatSseEvent,
41
- ChatUpdateEvent,
42
- // Legacy types (deprecated, for migration)
43
- LegacyChatCreatedEvent,
44
- LegacyChatInvalidatedEvent,
45
- LegacyChatListInvalidatedEvent,
46
- LegacyChatSseEvent,
47
41
  } from './types'
48
42
 
49
43
  // Runtime profile types and constants
package/src/chat/types.ts CHANGED
@@ -304,51 +304,3 @@ export type ChatInvalidationEvent = InvalidateChatEvent | InvalidateChatListEven
304
304
  */
305
305
  export type ChatSseEvent = ChatDomainEvent | ChatInvalidationEvent
306
306
 
307
- /**
308
- * Convenience alias for backwards compat.
309
- */
310
- export type ChatUpdateEvent = ChatSseEvent
311
-
312
- // =============================================================================
313
- // Legacy Event Types (deprecated, for migration period only)
314
- // =============================================================================
315
-
316
- /**
317
- * @deprecated Use ChatCreatedEvent with v:1 instead.
318
- * Legacy event shape without v field or data wrapper.
319
- */
320
- export interface LegacyChatCreatedEvent {
321
- type: 'chat.created'
322
- chatId: string
323
- interactionId?: string
324
- title?: string
325
- timestamp: string
326
- }
327
-
328
- /**
329
- * @deprecated Use InvalidateChatEvent instead.
330
- * Legacy invalidation event without v field.
331
- */
332
- export interface LegacyChatInvalidatedEvent {
333
- type: 'chat.invalidated'
334
- chatId: string
335
- timestamp: string
336
- }
337
-
338
- /**
339
- * @deprecated Use InvalidateChatListEvent instead.
340
- * Legacy list invalidation event without v field.
341
- */
342
- export interface LegacyChatListInvalidatedEvent {
343
- type: 'chat.list.invalidated'
344
- timestamp: string
345
- }
346
-
347
- /**
348
- * @deprecated Use ChatSseEvent instead.
349
- * Legacy SSE event union for migration period.
350
- */
351
- export type LegacyChatSseEvent =
352
- | LegacyChatInvalidatedEvent
353
- | LegacyChatListInvalidatedEvent
354
- | LegacyChatCreatedEvent
@@ -107,6 +107,20 @@ describe('decision table key consistency', () => {
107
107
  const decisionKeys = Object.keys(LIFECYCLE_DECISIONS.confirm).sort()
108
108
  expect(decisionKeys).toEqual(transitionKeys)
109
109
  })
110
+
111
+ it('LIFECYCLE_DECISIONS.reject keys match VALID_TRANSITIONS keys', () => {
112
+ const transitionKeys = Object.keys(VALID_TRANSITIONS).sort()
113
+ const decisionKeys = Object.keys(LIFECYCLE_DECISIONS.reject).sort()
114
+ expect(decisionKeys).toEqual(transitionKeys)
115
+ })
116
+
117
+ it('all intent rows have the same set of state keys', () => {
118
+ const intents = Object.keys(LIFECYCLE_DECISIONS) as Array<keyof typeof LIFECYCLE_DECISIONS>
119
+ const referenceKeys = Object.keys(LIFECYCLE_DECISIONS[intents[0]]).sort()
120
+ for (const intent of intents) {
121
+ expect(Object.keys(LIFECYCLE_DECISIONS[intent]).sort()).toEqual(referenceKeys)
122
+ }
123
+ })
110
124
  })
111
125
 
112
126
  // ---------------------------------------------------------------------------
@@ -157,6 +171,30 @@ describe('applyIntent', () => {
157
171
  it('undone + confirm = conflict', () => {
158
172
  expect(applyIntent('undone', 'confirm')).toBe('conflict')
159
173
  })
174
+
175
+ it('pending_confirmation + reject = approve', () => {
176
+ expect(applyIntent('pending_confirmation', 'reject')).toBe('approve')
177
+ })
178
+
179
+ it('expired + reject = expired', () => {
180
+ expect(applyIntent('expired', 'reject')).toBe('expired')
181
+ })
182
+
183
+ it('cancelled + reject = conflict', () => {
184
+ expect(applyIntent('cancelled', 'reject')).toBe('conflict')
185
+ })
186
+
187
+ it('ready + reject = conflict', () => {
188
+ expect(applyIntent('ready', 'reject')).toBe('conflict')
189
+ })
190
+
191
+ it('executing + reject = conflict', () => {
192
+ expect(applyIntent('executing', 'reject')).toBe('conflict')
193
+ })
194
+
195
+ it('completed + reject = conflict', () => {
196
+ expect(applyIntent('completed', 'reject')).toBe('conflict')
197
+ })
160
198
  })
161
199
 
162
200
  // ---------------------------------------------------------------------------
@@ -10,5 +10,4 @@ export interface ExecutionError {
10
10
  readonly name: 'ExecutionError';
11
11
  readonly code: ExecutionErrorCode;
12
12
  readonly message: string;
13
- readonly httpStatus?: number;
14
13
  }
@@ -1,6 +1,6 @@
1
1
  import type { ExecutionState } from './status';
2
2
 
3
- export type ExecutionIntent = 'confirm';
3
+ export type ExecutionIntent = 'confirm' | 'reject';
4
4
 
5
5
  export type LifecycleDecision =
6
6
  | 'approve'
@@ -29,6 +29,20 @@ export const LIFECYCLE_DECISIONS: DecisionTable = {
29
29
  failed_with_partial_execution: 'conflict',
30
30
  undone: 'conflict',
31
31
  },
32
+ reject: {
33
+ pending_confirmation: 'approve',
34
+ expired: 'expired',
35
+ cancelled: 'conflict',
36
+ blocked_pending_approval: 'conflict',
37
+ ready: 'conflict',
38
+ executing: 'conflict',
39
+ completed: 'conflict',
40
+ completed_with_rollbacks: 'conflict',
41
+ failed_retryable: 'conflict',
42
+ failed_terminal: 'conflict',
43
+ failed_with_partial_execution: 'conflict',
44
+ undone: 'conflict',
45
+ },
32
46
  };
33
47
 
34
48
  export function applyIntent(
package/src/index.ts CHANGED
@@ -169,12 +169,6 @@ export type {
169
169
  ChatInvalidationEvent,
170
170
  // SSE event unions
171
171
  ChatSseEvent,
172
- ChatUpdateEvent,
173
- // Legacy types (deprecated, for migration)
174
- LegacyChatCreatedEvent,
175
- LegacyChatInvalidatedEvent,
176
- LegacyChatListInvalidatedEvent,
177
- LegacyChatSseEvent,
178
172
  // Runtime profile types (PRD-00229)
179
173
  ChatRuntimeProfile,
180
174
  ChatRuntimeProfileInfo,
@@ -464,7 +458,6 @@ export type {
464
458
  UsageByModel,
465
459
  UsageByFeature,
466
460
  UsageByUser,
467
- OrgUsageResponse,
468
461
  // Unified usage types (PRD-00276/277)
469
462
  UnifiedUsageSummary,
470
463
  UnifiedDailyUsage,
@@ -4,7 +4,7 @@
4
4
  * See PRD-00166 for design rationale and invariants.
5
5
  */
6
6
 
7
- export type AiFeature = 'chat' | 'chat_title' | 'ingest_summarize' | 'ingest_embedding';
7
+ export type AiFeature = 'chat' | 'chat_title' | 'ingest_summarize' | 'ingest_embedding' | 'strategy_extraction';
8
8
 
9
9
  export interface UsageSummary {
10
10
  totalTokens: number;
@@ -46,16 +46,6 @@ export interface UsageByUser {
46
46
  requestCount: number;
47
47
  }
48
48
 
49
- /**
50
- * @deprecated Use UnifiedUsageResponse instead. Will be removed in v1.0.
51
- */
52
- export interface OrgUsageResponse {
53
- summary: UsageSummary;
54
- daily: DailyUsage[];
55
- byModel: UsageByModel[];
56
- byFeature: UsageByFeature[];
57
- topUsers: UsageByUser[];
58
- }
59
49
 
60
50
  // ---------------------------------------------------------------------------
61
51
  // Unified Usage Response (PRD-00276/277)