@company-semantics/contracts 13.3.1 → 13.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-semantics/contracts",
3
- "version": "13.3.1",
3
+ "version": "13.5.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 = 'c6a71ea0cfa4' as const;
3
+ export const SPEC_HASH_FULL = 'c6a71ea0cfa4937f7069dbdbec771f42ab895123073e57995cdcff4805b0ee9b' as const;
@@ -2058,6 +2058,26 @@ export interface paths {
2058
2058
  patch?: never;
2059
2059
  trace?: never;
2060
2060
  };
2061
+ "/api/ingestion/operations/{id}": {
2062
+ parameters: {
2063
+ query?: never;
2064
+ header?: never;
2065
+ path?: never;
2066
+ cookie?: never;
2067
+ };
2068
+ /**
2069
+ * Poll a generic ingestion operation by id (single shape for all consumers)
2070
+ * @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.
2071
+ */
2072
+ get: operations["getIngestionOperation"];
2073
+ put?: never;
2074
+ post?: never;
2075
+ delete?: never;
2076
+ options?: never;
2077
+ head?: never;
2078
+ patch?: never;
2079
+ trace?: never;
2080
+ };
2061
2081
  "/api/users/{userId}/avatar": {
2062
2082
  parameters: {
2063
2083
  query?: never;
@@ -2396,7 +2416,7 @@ export interface paths {
2396
2416
  path?: never;
2397
2417
  cookie?: never;
2398
2418
  };
2399
- /** Get a work item by id (owner-only) */
2419
+ /** Get a work item by id (binding gate; meta-tier admins see metadata only) */
2400
2420
  get: operations["getWorkItemById"];
2401
2421
  put?: never;
2402
2422
  post?: never;
@@ -4465,6 +4485,31 @@ export interface components {
4465
4485
  relationshipType: "solid" | "dotted";
4466
4486
  }[];
4467
4487
  };
4488
+ /** @description Polling snapshot of a generic ingestion operation. */
4489
+ IngestionOperationPollResponse: {
4490
+ /** Format: uuid */
4491
+ id: string;
4492
+ /** @enum {string} */
4493
+ status: "pending" | "normalizing" | "extracting" | "validating" | "validated" | "persisting" | "applying" | "applied" | "complete" | "failed";
4494
+ consumerKind: string;
4495
+ dryRun: boolean;
4496
+ /** @description A validated, not-yet-persisted extraction artifact (PRD-00756 F5). */
4497
+ candidate?: {
4498
+ data: unknown;
4499
+ model: string;
4500
+ fallbackUsed?: boolean;
4501
+ tokenUsage?: {
4502
+ input: number;
4503
+ output: number;
4504
+ };
4505
+ /** @enum {string} */
4506
+ confidence?: "low" | "medium" | "high";
4507
+ flags: string[];
4508
+ extractionMethod: string;
4509
+ extractionEmpty?: boolean;
4510
+ };
4511
+ error?: string;
4512
+ };
4468
4513
  DriveFileListResponse: {
4469
4514
  files: {
4470
4515
  id: string;
@@ -4604,6 +4649,19 @@ export interface components {
4604
4649
  /** @constant */
4605
4650
  ok: true;
4606
4651
  };
4652
+ WorkItemDetailResponse: {
4653
+ id: string;
4654
+ /** @enum {string} */
4655
+ kind: "meeting" | "comm" | "doc";
4656
+ title: string;
4657
+ content: string;
4658
+ contentRedacted?: boolean;
4659
+ metadata: {
4660
+ [key: string]: unknown;
4661
+ };
4662
+ createdAt: string;
4663
+ updatedAt: string;
4664
+ };
4607
4665
  UpdateWorkItemResponse: {
4608
4666
  updatedAt: string;
4609
4667
  };
@@ -4726,58 +4784,32 @@ export interface components {
4726
4784
  checksum: string;
4727
4785
  cancelled?: boolean;
4728
4786
  };
4729
- /** @description Synchronous markdown/JSON content, or a queued PDF job id. */
4787
+ /** @description Synchronous markdown/JSON export, or a queued PDF job id. */
4730
4788
  ExportMeetingRecordingResponse: {
4731
- /** @constant */
4732
- format: "markdown";
4789
+ /** @description ULID; unified trace key for the recording (INV-MTG-7). */
4790
+ recordingId: string;
4791
+ /**
4792
+ * @description Rendered export format for a finalized meeting transcript.
4793
+ * @enum {string}
4794
+ */
4795
+ format: "markdown" | "text" | "vtt" | "srt" | "json";
4733
4796
  content: string;
4734
- } | {
4735
- /** @constant */
4736
- format: "json";
4737
- /** @description Finalized read projection for a recording (excludes drafts). */
4738
- metadata: {
4797
+ contentRedacted?: boolean;
4798
+ segments: {
4739
4799
  /** @description ULID; unified trace key for the recording (INV-MTG-7). */
4740
4800
  recordingId: string;
4741
- /** Format: uuid */
4742
- ownerUserId: string;
4743
- /** Format: uuid */
4744
- orgId: string;
4745
- title: string | null;
4746
4801
  /**
4747
- * @description Auto-detected meeting app that owns the system audio stream.
4802
+ * @description Capture stream identity. Mic = channel 0, system audio = channel 1.
4748
4803
  * @enum {string}
4749
4804
  */
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;
4805
+ source: "mic" | "system";
4806
+ sequence: number;
4807
+ startedAtMs: number;
4808
+ endedAtMs: number | null;
4809
+ /** @constant */
4810
+ sampleRateHz: 16000;
4811
+ /** @constant */
4812
+ channels: 1;
4781
4813
  }[];
4782
4814
  } | {
4783
4815
  /** @constant */
@@ -8374,6 +8406,35 @@ export interface operations {
8374
8406
  };
8375
8407
  };
8376
8408
  };
8409
+ getIngestionOperation: {
8410
+ parameters: {
8411
+ query?: never;
8412
+ header?: never;
8413
+ path: {
8414
+ id: string;
8415
+ };
8416
+ cookie?: never;
8417
+ };
8418
+ requestBody?: never;
8419
+ responses: {
8420
+ /** @description Operation polling snapshot */
8421
+ 200: {
8422
+ headers: {
8423
+ [name: string]: unknown;
8424
+ };
8425
+ content: {
8426
+ "application/json": components["schemas"]["IngestionOperationPollResponse"];
8427
+ };
8428
+ };
8429
+ /** @description Operation not found (or belongs to another org) */
8430
+ 404: {
8431
+ headers: {
8432
+ [name: string]: unknown;
8433
+ };
8434
+ content?: never;
8435
+ };
8436
+ };
8437
+ };
8377
8438
  uploadUserAvatar: {
8378
8439
  parameters: {
8379
8440
  query?: never;
@@ -8871,12 +8932,14 @@ export interface operations {
8871
8932
  };
8872
8933
  requestBody?: never;
8873
8934
  responses: {
8874
- /** @description Full work item including markdown content */
8935
+ /** @description Full work item including markdown content; content is redacted (contentRedacted:true) for a meta-tier viewer */
8875
8936
  200: {
8876
8937
  headers: {
8877
8938
  [name: string]: unknown;
8878
8939
  };
8879
- content?: never;
8940
+ content: {
8941
+ "application/json": components["schemas"]["WorkItemDetailResponse"];
8942
+ };
8880
8943
  };
8881
8944
  /** @description Not found or not visible to this viewer */
8882
8945
  404: {
@@ -9109,13 +9172,20 @@ export interface operations {
9109
9172
  "application/json": components["schemas"]["ExportMeetingRecordingResponse"];
9110
9173
  };
9111
9174
  };
9112
- /** @description Recording not found or not owned by this user */
9175
+ /** @description Recording not found, or the actor may not view it (no existence leak) */
9113
9176
  404: {
9114
9177
  headers: {
9115
9178
  [name: string]: unknown;
9116
9179
  };
9117
9180
  content?: never;
9118
9181
  };
9182
+ /** @description PDF export refused for a metadata-only (redacted) viewer */
9183
+ 422: {
9184
+ headers: {
9185
+ [name: string]: unknown;
9186
+ };
9187
+ content?: never;
9188
+ };
9119
9189
  };
9120
9190
  };
9121
9191
  downloadMeetingRecordingExport: {
@@ -19,6 +19,10 @@ export type {
19
19
  CompanyMdContextBankResponse,
20
20
  } from "./schemas";
21
21
 
22
+ // Work item response schema (PRD-00763)
23
+ export { WorkItemDetailResponseSchema } from "./schemas";
24
+ export type { WorkItemDetailResponse } from "./schemas";
25
+
22
26
  // Drive response schemas (PRD-00448)
23
27
  export {
24
28
  DriveFileListResponseSchema,
@@ -102,6 +102,35 @@ export const CompanyMdDocResponseSchema = z.object({
102
102
  updatedAt: z.string(),
103
103
  });
104
104
 
105
+ // ---------------------------------------------------------------------------
106
+ // Work Item HTTP Response Schema
107
+ // ---------------------------------------------------------------------------
108
+
109
+ /**
110
+ * Response for GET /api/work-items/:id
111
+ *
112
+ * Models the work-item detail shape the backend returns (id, kind, title,
113
+ * markdown body, free-form metadata, timestamps). Hand-written and independent
114
+ * of the generated OpenAPI surface; the backend adapts to this schema
115
+ * (PRD-00760).
116
+ */
117
+ export const WorkItemDetailResponseSchema = z.object({
118
+ id: z.string(),
119
+ kind: z.enum(["meeting", "comm", "doc"]),
120
+ title: z.string(),
121
+ content: z.string(),
122
+ /**
123
+ * When `true`, `content` is the redacted empty body (`''`) returned to a
124
+ * metadata-only (meta-tier) viewer who administers the work item but may not
125
+ * read its body (ADR-BE-245). Omitted/`false` on the normal full-content
126
+ * path. Keeping it optional preserves back-compat for full-content readers.
127
+ */
128
+ contentRedacted: z.boolean().optional(),
129
+ metadata: z.record(z.string(), z.unknown()),
130
+ createdAt: z.string(),
131
+ updatedAt: z.string(),
132
+ });
133
+
105
134
  // ---------------------------------------------------------------------------
106
135
  // Company.md Sharing Sub-schemas
107
136
  // ---------------------------------------------------------------------------
@@ -207,6 +236,9 @@ export type CompanyMdShareResponse = z.infer<
207
236
  export type CompanyMdContextBankResponse = z.infer<
208
237
  typeof CompanyMdContextBankResponseSchema
209
238
  >;
239
+ export type WorkItemDetailResponse = z.infer<
240
+ typeof WorkItemDetailResponseSchema
241
+ >;
210
242
  export type DriveFileListResponse = z.infer<typeof DriveFileListResponseSchema>;
211
243
  export type DriveFileContentResponse = z.infer<
212
244
  typeof DriveFileContentResponseSchema
@@ -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,
@@ -16,6 +16,8 @@ export {
16
16
  RecordingEventSchema,
17
17
  TranscriptionSessionGrantSchema,
18
18
  MeetingMetadataProjectionSchema,
19
+ MeetingExportFormatSchema,
20
+ MeetingExportResponseSchema,
19
21
  } from "./schemas";
20
22
 
21
23
  export type {
@@ -31,4 +33,6 @@ export type {
31
33
  RecordingEvent,
32
34
  TranscriptionSessionGrant,
33
35
  MeetingMetadataProjection,
36
+ MeetingExportFormat,
37
+ MeetingExportResponse,
34
38
  } from "./schemas";
@@ -291,3 +291,50 @@ export const MeetingMetadataProjectionSchema = z
291
291
  export type MeetingMetadataProjection = z.infer<
292
292
  typeof MeetingMetadataProjectionSchema
293
293
  >;
294
+
295
+ // =============================================================================
296
+ // Meeting export response (HTTP read model)
297
+ // =============================================================================
298
+
299
+ /**
300
+ * Export format the backend renders a finalized meeting transcript into.
301
+ * `markdown`/`text` are prose bodies; `vtt`/`srt` are timed-caption formats;
302
+ * `json` is the structured segment payload.
303
+ */
304
+ export const MeetingExportFormatSchema = z
305
+ .enum(["markdown", "text", "vtt", "srt", "json"])
306
+ .meta({
307
+ description: "Rendered export format for a finalized meeting transcript.",
308
+ });
309
+ export type MeetingExportFormat = z.infer<typeof MeetingExportFormatSchema>;
310
+
311
+ /**
312
+ * Response for the meeting-export endpoint. Models the rendered export the
313
+ * backend returns for a finalized recording: the chosen `format`, the rendered
314
+ * `content` body, and the `segments` the export was assembled from. Hand-written
315
+ * and independent of the generated OpenAPI surface; the backend adapts to this
316
+ * schema (PRD-00763).
317
+ *
318
+ * Mirrors the meta-tier redaction contract of `WorkItemDetailResponseSchema`
319
+ * and `CompanyMdDocResponseSchema`.
320
+ */
321
+ export const MeetingExportResponseSchema = z
322
+ .object({
323
+ recordingId: RecordingIdSchema,
324
+ format: MeetingExportFormatSchema,
325
+ content: z.string(),
326
+ /**
327
+ * When `true`, `content` is the redacted empty body (`''`) returned to a
328
+ * metadata-only (meta-tier) viewer who administers the meeting but may not
329
+ * read its transcript body (ADR-BE-245). Omitted/`false` on the normal
330
+ * full-content path. Keeping it optional preserves back-compat for
331
+ * full-content readers.
332
+ */
333
+ contentRedacted: z.boolean().optional(),
334
+ segments: z.array(SourceSegmentSchema),
335
+ })
336
+ .meta({
337
+ description:
338
+ "Rendered meeting-transcript export (format, content, segments) with optional meta-tier redaction flag.",
339
+ });
340
+ export type MeetingExportResponse = z.infer<typeof MeetingExportResponseSchema>;