@company-semantics/contracts 13.4.0 → 13.6.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": "13.4.0",
3
+ "version": "13.6.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED — do not edit. Run pnpm generate:spec-hash to regenerate.
2
- export const SPEC_HASH = '5961c9041966' as const;
3
- export const SPEC_HASH_FULL = '5961c9041966a739d90bd6f60228167aeccf4c1f28d37a28a924499eb452acd0' as const;
2
+ export const SPEC_HASH = '3740712c6cee' as const;
3
+ export const SPEC_HASH_FULL = '3740712c6cee7d3684fb174624951f59bc1c3bb5f48dabf43ebf6c2a535c654e' as const;
@@ -1165,6 +1165,23 @@ export interface paths {
1165
1165
  patch?: never;
1166
1166
  trace?: never;
1167
1167
  };
1168
+ "/api/executions/{executionId}/result": {
1169
+ parameters: {
1170
+ query?: never;
1171
+ header?: never;
1172
+ path?: never;
1173
+ cookie?: never;
1174
+ };
1175
+ /** Get the full execution result for a finished execution */
1176
+ get: operations["getExecutionResult"];
1177
+ put?: never;
1178
+ post?: never;
1179
+ delete?: never;
1180
+ options?: never;
1181
+ head?: never;
1182
+ patch?: never;
1183
+ trace?: never;
1184
+ };
1168
1185
  "/api/executions/{executionId}/undo": {
1169
1186
  parameters: {
1170
1187
  query?: never;
@@ -1250,6 +1267,26 @@ export interface paths {
1250
1267
  patch?: never;
1251
1268
  trace?: never;
1252
1269
  };
1270
+ "/api/executions/{executionId}/stream": {
1271
+ parameters: {
1272
+ query?: never;
1273
+ header?: never;
1274
+ path?: never;
1275
+ cookie?: never;
1276
+ };
1277
+ /**
1278
+ * Stream execution lifecycle events via SSE
1279
+ * @description Server-Sent Events stream of execution lifecycle events. x-streaming: true. Event payloads conform to ExecutionSseEvent; resume via Last-Event-ID (= event_sequence). See ADR-BE-269.
1280
+ */
1281
+ get: operations["streamExecutionLifecycle"];
1282
+ put?: never;
1283
+ post?: never;
1284
+ delete?: never;
1285
+ options?: never;
1286
+ head?: never;
1287
+ patch?: never;
1288
+ trace?: never;
1289
+ };
1253
1290
  "/api/capabilities": {
1254
1291
  parameters: {
1255
1292
  query?: never;
@@ -2058,6 +2095,26 @@ export interface paths {
2058
2095
  patch?: never;
2059
2096
  trace?: never;
2060
2097
  };
2098
+ "/api/ingestion/operations/{id}": {
2099
+ parameters: {
2100
+ query?: never;
2101
+ header?: never;
2102
+ path?: never;
2103
+ cookie?: never;
2104
+ };
2105
+ /**
2106
+ * Poll a generic ingestion operation by id (single shape for all consumers)
2107
+ * @description Returns the rolled-up status of an ingestion operation plus its consumerKind and dryRun flag. The validated candidate preview and a failure reason are surfaced when present. Org-scoped: an operation belonging to another org returns 404.
2108
+ */
2109
+ get: operations["getIngestionOperation"];
2110
+ put?: never;
2111
+ post?: never;
2112
+ delete?: never;
2113
+ options?: never;
2114
+ head?: never;
2115
+ patch?: never;
2116
+ trace?: never;
2117
+ };
2061
2118
  "/api/users/{userId}/avatar": {
2062
2119
  parameters: {
2063
2120
  query?: never;
@@ -2396,7 +2453,7 @@ export interface paths {
2396
2453
  path?: never;
2397
2454
  cookie?: never;
2398
2455
  };
2399
- /** Get a work item by id (owner-only) */
2456
+ /** Get a work item by id (binding gate; meta-tier admins see metadata only) */
2400
2457
  get: operations["getWorkItemById"];
2401
2458
  put?: never;
2402
2459
  post?: never;
@@ -3785,6 +3842,16 @@ export interface components {
3785
3842
  /** @constant */
3786
3843
  status: "cancelled";
3787
3844
  };
3845
+ ExecutionSseEvent: {
3846
+ eventSequence: number;
3847
+ /** @enum {string} */
3848
+ eventType: "execution_created" | "execution_started" | "confirmation_approved" | "confirmation_rejected" | "confirmation_expired" | "approval_requested" | "execution_completed" | "execution_failed" | "undo_completed" | "cancelled";
3849
+ /** @enum {string} */
3850
+ stateAfter: "pending_confirmation" | "blocked_pending_approval" | "ready" | "executing" | "completed" | "completed_with_rollbacks" | "failed_retryable" | "failed_exhausted" | "failed_terminal" | "failed_with_partial_execution" | "cancelled" | "expired" | "undone";
3851
+ actorType: string;
3852
+ /** Format: date-time */
3853
+ createdAt: string;
3854
+ };
3788
3855
  CapabilitiesResponse: {
3789
3856
  profile?: {
3790
3857
  fullName: {
@@ -4465,6 +4532,31 @@ export interface components {
4465
4532
  relationshipType: "solid" | "dotted";
4466
4533
  }[];
4467
4534
  };
4535
+ /** @description Polling snapshot of a generic ingestion operation. */
4536
+ IngestionOperationPollResponse: {
4537
+ /** Format: uuid */
4538
+ id: string;
4539
+ /** @enum {string} */
4540
+ status: "pending" | "normalizing" | "extracting" | "validating" | "validated" | "persisting" | "applying" | "applied" | "complete" | "failed";
4541
+ consumerKind: string;
4542
+ dryRun: boolean;
4543
+ /** @description A validated, not-yet-persisted extraction artifact (PRD-00756 F5). */
4544
+ candidate?: {
4545
+ data: unknown;
4546
+ model: string;
4547
+ fallbackUsed?: boolean;
4548
+ tokenUsage?: {
4549
+ input: number;
4550
+ output: number;
4551
+ };
4552
+ /** @enum {string} */
4553
+ confidence?: "low" | "medium" | "high";
4554
+ flags: string[];
4555
+ extractionMethod: string;
4556
+ extractionEmpty?: boolean;
4557
+ };
4558
+ error?: string;
4559
+ };
4468
4560
  DriveFileListResponse: {
4469
4561
  files: {
4470
4562
  id: string;
@@ -4604,6 +4696,19 @@ export interface components {
4604
4696
  /** @constant */
4605
4697
  ok: true;
4606
4698
  };
4699
+ WorkItemDetailResponse: {
4700
+ id: string;
4701
+ /** @enum {string} */
4702
+ kind: "meeting" | "comm" | "doc";
4703
+ title: string;
4704
+ content: string;
4705
+ contentRedacted?: boolean;
4706
+ metadata: {
4707
+ [key: string]: unknown;
4708
+ };
4709
+ createdAt: string;
4710
+ updatedAt: string;
4711
+ };
4607
4712
  UpdateWorkItemResponse: {
4608
4713
  updatedAt: string;
4609
4714
  };
@@ -4726,58 +4831,32 @@ export interface components {
4726
4831
  checksum: string;
4727
4832
  cancelled?: boolean;
4728
4833
  };
4729
- /** @description Synchronous markdown/JSON content, or a queued PDF job id. */
4834
+ /** @description Synchronous markdown/JSON export, or a queued PDF job id. */
4730
4835
  ExportMeetingRecordingResponse: {
4731
- /** @constant */
4732
- format: "markdown";
4836
+ /** @description ULID; unified trace key for the recording (INV-MTG-7). */
4837
+ recordingId: string;
4838
+ /**
4839
+ * @description Rendered export format for a finalized meeting transcript.
4840
+ * @enum {string}
4841
+ */
4842
+ format: "markdown" | "text" | "vtt" | "srt" | "json";
4733
4843
  content: string;
4734
- } | {
4735
- /** @constant */
4736
- format: "json";
4737
- /** @description Finalized read projection for a recording (excludes drafts). */
4738
- metadata: {
4844
+ contentRedacted?: boolean;
4845
+ segments: {
4739
4846
  /** @description ULID; unified trace key for the recording (INV-MTG-7). */
4740
4847
  recordingId: string;
4741
- /** Format: uuid */
4742
- ownerUserId: string;
4743
- /** Format: uuid */
4744
- orgId: string;
4745
- title: string | null;
4746
4848
  /**
4747
- * @description Auto-detected meeting app that owns the system audio stream.
4849
+ * @description Capture stream identity. Mic = channel 0, system audio = channel 1.
4748
4850
  * @enum {string}
4749
4851
  */
4750
- detectedApp: "zoom" | "teams" | "meet-browser" | "slack-huddle" | "manual";
4751
- /**
4752
- * @description Visibility band for the finalized meeting projection. Default `meeting_only`.
4753
- * @enum {string}
4754
- */
4755
- visibility: "meeting_only" | "shared" | "org" | "finalized_private";
4756
- /**
4757
- * @description Coarse lifecycle state for a recording entity.
4758
- * @enum {string}
4759
- */
4760
- status: "draft" | "recording" | "processing" | "finalized" | "failed" | "partial-transcript-network" | "cancelled";
4761
- /**
4762
- * @description Capture-runtime quality signal. `degraded` triggers a UI hint.
4763
- * @enum {string}
4764
- */
4765
- quality: "clean" | "degraded";
4766
- /** Format: date-time */
4767
- startedAt: string;
4768
- endedAt: string | null;
4769
- durationMs: number;
4770
- participantUserIds: string[];
4771
- transcriptAvailable: boolean;
4772
- };
4773
- segments: {
4774
- startMs: number;
4775
- endMs: number;
4776
- /** @enum {string} */
4777
- source: "mic" | "remote" | "unknown";
4778
- speakerLabel: string | null;
4779
- text: string;
4780
- confidence: number | null;
4852
+ source: "mic" | "system";
4853
+ sequence: number;
4854
+ startedAtMs: number;
4855
+ endedAtMs: number | null;
4856
+ /** @constant */
4857
+ sampleRateHz: 16000;
4858
+ /** @constant */
4859
+ channels: 1;
4781
4860
  }[];
4782
4861
  } | {
4783
4862
  /** @constant */
@@ -6881,6 +6960,26 @@ export interface operations {
6881
6960
  };
6882
6961
  };
6883
6962
  };
6963
+ getExecutionResult: {
6964
+ parameters: {
6965
+ query?: never;
6966
+ header?: never;
6967
+ path: {
6968
+ executionId: string;
6969
+ };
6970
+ cookie?: never;
6971
+ };
6972
+ requestBody?: never;
6973
+ responses: {
6974
+ /** @description Execution result */
6975
+ 200: {
6976
+ headers: {
6977
+ [name: string]: unknown;
6978
+ };
6979
+ content?: never;
6980
+ };
6981
+ };
6982
+ };
6884
6983
  undoExecution: {
6885
6984
  parameters: {
6886
6985
  query?: never;
@@ -6988,6 +7087,28 @@ export interface operations {
6988
7087
  };
6989
7088
  };
6990
7089
  };
7090
+ streamExecutionLifecycle: {
7091
+ parameters: {
7092
+ query?: never;
7093
+ header?: never;
7094
+ path: {
7095
+ executionId: string;
7096
+ };
7097
+ cookie?: never;
7098
+ };
7099
+ requestBody?: never;
7100
+ responses: {
7101
+ /** @description SSE event stream (text/event-stream). Event payload: ExecutionSseEvent. */
7102
+ 200: {
7103
+ headers: {
7104
+ [name: string]: unknown;
7105
+ };
7106
+ content: {
7107
+ "text/event-stream": components["schemas"]["ExecutionSseEvent"];
7108
+ };
7109
+ };
7110
+ };
7111
+ };
6991
7112
  getMutationCapabilities: {
6992
7113
  parameters: {
6993
7114
  query?: never;
@@ -8374,6 +8495,35 @@ export interface operations {
8374
8495
  };
8375
8496
  };
8376
8497
  };
8498
+ getIngestionOperation: {
8499
+ parameters: {
8500
+ query?: never;
8501
+ header?: never;
8502
+ path: {
8503
+ id: string;
8504
+ };
8505
+ cookie?: never;
8506
+ };
8507
+ requestBody?: never;
8508
+ responses: {
8509
+ /** @description Operation polling snapshot */
8510
+ 200: {
8511
+ headers: {
8512
+ [name: string]: unknown;
8513
+ };
8514
+ content: {
8515
+ "application/json": components["schemas"]["IngestionOperationPollResponse"];
8516
+ };
8517
+ };
8518
+ /** @description Operation not found (or belongs to another org) */
8519
+ 404: {
8520
+ headers: {
8521
+ [name: string]: unknown;
8522
+ };
8523
+ content?: never;
8524
+ };
8525
+ };
8526
+ };
8377
8527
  uploadUserAvatar: {
8378
8528
  parameters: {
8379
8529
  query?: never;
@@ -8871,12 +9021,14 @@ export interface operations {
8871
9021
  };
8872
9022
  requestBody?: never;
8873
9023
  responses: {
8874
- /** @description Full work item including markdown content */
9024
+ /** @description Full work item including markdown content; content is redacted (contentRedacted:true) for a meta-tier viewer */
8875
9025
  200: {
8876
9026
  headers: {
8877
9027
  [name: string]: unknown;
8878
9028
  };
8879
- content?: never;
9029
+ content: {
9030
+ "application/json": components["schemas"]["WorkItemDetailResponse"];
9031
+ };
8880
9032
  };
8881
9033
  /** @description Not found or not visible to this viewer */
8882
9034
  404: {
@@ -9109,13 +9261,20 @@ export interface operations {
9109
9261
  "application/json": components["schemas"]["ExportMeetingRecordingResponse"];
9110
9262
  };
9111
9263
  };
9112
- /** @description Recording not found or not owned by this user */
9264
+ /** @description Recording not found, or the actor may not view it (no existence leak) */
9113
9265
  404: {
9114
9266
  headers: {
9115
9267
  [name: string]: unknown;
9116
9268
  };
9117
9269
  content?: never;
9118
9270
  };
9271
+ /** @description PDF export refused for a metadata-only (redacted) viewer */
9272
+ 422: {
9273
+ headers: {
9274
+ [name: string]: unknown;
9275
+ };
9276
+ content?: never;
9277
+ };
9119
9278
  };
9120
9279
  };
9121
9280
  downloadMeetingRecordingExport: {
@@ -7,19 +7,9 @@
7
7
  * Forward-compatible: execution_completed, execution_failed, undo_completed, cancelled.
8
8
  * These are defined here for type exhaustiveness but not yet emitted by backend.
9
9
  */
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";
10
+ import { z } from "zod";
21
11
 
22
- export const EXECUTION_EVENT_TYPES: readonly ExecutionEventType[] = [
12
+ export const EXECUTION_EVENT_TYPES = [
23
13
  "execution_created",
24
14
  "execution_started",
25
15
  "confirmation_approved",
@@ -32,6 +22,11 @@ export const EXECUTION_EVENT_TYPES: readonly ExecutionEventType[] = [
32
22
  "cancelled",
33
23
  ] as const;
34
24
 
25
+ export type ExecutionEventType = (typeof EXECUTION_EVENT_TYPES)[number];
26
+
27
+ /** Runtime-validatable form of {@link ExecutionEventType}, derived from the single source. */
28
+ export const ExecutionEventTypeSchema = z.enum(EXECUTION_EVENT_TYPES);
29
+
35
30
  export function isExecutionEventType(
36
31
  value: string,
37
32
  ): value is ExecutionEventType {
@@ -13,7 +13,18 @@
13
13
 
14
14
  export type { ExecutionEventType } from "./events";
15
15
 
16
- export { EXECUTION_EVENT_TYPES, isExecutionEventType } from "./events";
16
+ export {
17
+ EXECUTION_EVENT_TYPES,
18
+ ExecutionEventTypeSchema,
19
+ isExecutionEventType,
20
+ } from "./events";
21
+
22
+ // =============================================================================
23
+ // SSE Stream Event (wire contract)
24
+ // =============================================================================
25
+
26
+ export { ExecutionSseEventSchema } from "./sse";
27
+ export type { ExecutionSseEvent } from "./sse";
17
28
 
18
29
  // =============================================================================
19
30
  // Event Metadata Schemas
@@ -67,6 +78,8 @@ export type { ExecutionKind } from "./kinds";
67
78
  export type { ExecutionState } from "./status";
68
79
 
69
80
  export {
81
+ EXECUTION_STATES,
82
+ ExecutionStateSchema,
70
83
  VALID_TRANSITIONS,
71
84
  TERMINAL_STATES,
72
85
  EFFECTIVE_TERMINAL_STATES,
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Execution lifecycle SSE event — wire contract.
3
+ *
4
+ * The payload of one `text/event-stream` message emitted by
5
+ * `GET /api/executions/{executionId}/stream` (ADR-BE-269). Each SSE frame
6
+ * carries one execution_events row, PROJECTED to this least-exposure shape —
7
+ * the raw row's hash-chain fields (`event_hash`, `previous_hash`), `actor_id`,
8
+ * and free-form `metadata` are deliberately NOT on the wire. The stream never
9
+ * emits raw rows.
10
+ *
11
+ * `eventSequence` is the monotonic per-execution cursor (also the SSE `id:`
12
+ * field), so a client resumes after a disconnect via `Last-Event-ID`.
13
+ *
14
+ * @see ADR-CONT-029 for execution-contract design rationale.
15
+ */
16
+
17
+ import { z } from "zod";
18
+ import { ExecutionEventTypeSchema } from "./events";
19
+ import { ExecutionStateSchema } from "./status";
20
+
21
+ export const ExecutionSseEventSchema = z.object({
22
+ /** Monotonic per-execution sequence; doubles as the SSE `id:` for resume. */
23
+ eventSequence: z.number().int().nonnegative(),
24
+ eventType: ExecutionEventTypeSchema,
25
+ /** Execution lifecycle state AFTER this event. */
26
+ stateAfter: ExecutionStateSchema,
27
+ /** Coarse actor class that produced the event (e.g. `user`, `system`). */
28
+ actorType: z.string(),
29
+ /** DB insert time of the event, ISO-8601 with offset. */
30
+ createdAt: z.string().datetime({ offset: true }),
31
+ });
32
+
33
+ export type ExecutionSseEvent = z.infer<typeof ExecutionSseEventSchema>;
@@ -54,20 +54,28 @@
54
54
  * - **INV-EXEC-5**: failed_retryable -> ready loop bounded by executor retry budget.
55
55
  * Retry events must include retryAttempt in metadata.
56
56
  */
57
- export type ExecutionState =
58
- | "pending_confirmation"
59
- | "blocked_pending_approval"
60
- | "ready"
61
- | "executing"
62
- | "completed"
63
- | "completed_with_rollbacks"
64
- | "failed_retryable"
65
- | "failed_exhausted"
66
- | "failed_terminal"
67
- | "failed_with_partial_execution"
68
- | "cancelled"
69
- | "expired"
70
- | "undone";
57
+ import { z } from "zod";
58
+
59
+ export const EXECUTION_STATES = [
60
+ "pending_confirmation",
61
+ "blocked_pending_approval",
62
+ "ready",
63
+ "executing",
64
+ "completed",
65
+ "completed_with_rollbacks",
66
+ "failed_retryable",
67
+ "failed_exhausted",
68
+ "failed_terminal",
69
+ "failed_with_partial_execution",
70
+ "cancelled",
71
+ "expired",
72
+ "undone",
73
+ ] as const;
74
+
75
+ export type ExecutionState = (typeof EXECUTION_STATES)[number];
76
+
77
+ /** Runtime-validatable form of {@link ExecutionState}, derived from the single source. */
78
+ export const ExecutionStateSchema = z.enum(EXECUTION_STATES);
71
79
 
72
80
  export const VALID_TRANSITIONS: Record<
73
81
  ExecutionState,
@@ -47,11 +47,13 @@ export const openApiRoutes = {
47
47
  '/api/executions/{executionId}/confirm': ['POST'],
48
48
  '/api/executions/{executionId}/explanation': ['GET'],
49
49
  '/api/executions/{executionId}/reject': ['POST'],
50
+ '/api/executions/{executionId}/stream': ['GET'],
50
51
  '/api/executions/{executionId}/summary': ['GET'],
51
52
  '/api/executions/{executionId}/timeline': ['GET'],
52
53
  '/api/executions/{executionId}/undo': ['POST'],
53
54
  '/api/factory/floor': ['GET'],
54
55
  '/api/factory/snapshot': ['GET'],
56
+ '/api/ingestion/operations/{id}': ['GET'],
55
57
  '/api/internal-admin/impersonate/end': ['POST'],
56
58
  '/api/internal-admin/impersonate/session': ['GET'],
57
59
  '/api/internal-admin/impersonate/start': ['POST'],