@company-semantics/contracts 13.5.0 → 13.7.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.5.0",
3
+ "version": "13.7.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 = 'c6a71ea0cfa4' as const;
3
- export const SPEC_HASH_FULL = 'c6a71ea0cfa4937f7069dbdbec771f42ab895123073e57995cdcff4805b0ee9b' 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;
@@ -3805,6 +3842,16 @@ export interface components {
3805
3842
  /** @constant */
3806
3843
  status: "cancelled";
3807
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
+ };
3808
3855
  CapabilitiesResponse: {
3809
3856
  profile?: {
3810
3857
  fullName: {
@@ -6913,6 +6960,26 @@ export interface operations {
6913
6960
  };
6914
6961
  };
6915
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
+ };
6916
6983
  undoExecution: {
6917
6984
  parameters: {
6918
6985
  query?: never;
@@ -7020,6 +7087,28 @@ export interface operations {
7020
7087
  };
7021
7088
  };
7022
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
+ };
7023
7112
  getMutationCapabilities: {
7024
7113
  parameters: {
7025
7114
  query?: never;
@@ -162,6 +162,10 @@ export {
162
162
  ConfirmExecutionResponseSchema,
163
163
  RejectExecutionResponseSchema,
164
164
  StartExecutionResponseSchema,
165
+ ExecutionResultDataSchema,
166
+ ExecutionResultResponseSchema,
167
+ ExecutionSummaryProjectionSchema,
168
+ GetExecutionSummaryResponseSchema,
165
169
  } from "./schemas";
166
170
 
167
171
  export type {
@@ -172,4 +176,6 @@ export type {
172
176
  ConfirmExecutionResponse,
173
177
  RejectExecutionResponse,
174
178
  StartExecutionResponse,
179
+ ExecutionResultResponse,
180
+ GetExecutionSummaryResponse,
175
181
  } from "./schemas";
@@ -9,6 +9,11 @@
9
9
 
10
10
  import { z } from "zod";
11
11
 
12
+ import type { ExecutionResultData } from "../message-parts/execution";
13
+ import type { ExecutionKind } from "./kinds";
14
+ import type { ExecutionSummary } from "./summary";
15
+ import { EXECUTION_KINDS } from "./registry";
16
+
12
17
  // =============================================================================
13
18
  // Execution Summary
14
19
  // =============================================================================
@@ -108,3 +113,103 @@ export const StartExecutionResponseSchema = z.object({
108
113
  export type StartExecutionResponse = z.infer<
109
114
  typeof StartExecutionResponseSchema
110
115
  >;
116
+
117
+ // =============================================================================
118
+ // Execution Result (GET /api/executions/{executionId}/result)
119
+ // =============================================================================
120
+
121
+ /**
122
+ * Zod mirror of the canonical ExecutionResultData contract
123
+ * (message-parts/execution.ts), authored so GET /result can declare a typed
124
+ * 200 body instead of forcing the client to cast. The
125
+ * `satisfies z.ZodType<ExecutionResultData>` guard fails compilation if the
126
+ * schema drifts from the interface (a wrong/missing field or a loosened enum).
127
+ *
128
+ * @see ADR-CONT-067 for the response-typing decision
129
+ */
130
+ export const ExecutionResultDataSchema = z.object({
131
+ actionId: z.string(),
132
+ executionId: z.string(),
133
+ state: z.enum(["completed", "failed"]),
134
+ artifacts: z.array(
135
+ z.object({
136
+ // Mirrors PreviewArtifactKind (message-parts/preview.ts).
137
+ kind: z.enum([
138
+ "message",
139
+ "api_call",
140
+ "diff",
141
+ "notification",
142
+ "task",
143
+ "calendar",
144
+ "integration",
145
+ ]),
146
+ label: z.string(),
147
+ status: z.enum(["success", "failed", "skipped"]),
148
+ error: z.string().optional(),
149
+ resultLabel: z.string().optional(),
150
+ }),
151
+ ),
152
+ summary: z.object({
153
+ title: z.string(),
154
+ description: z.string().optional(),
155
+ }),
156
+ undo: z
157
+ .object({
158
+ availableUntil: z.string(),
159
+ kind: z.string(),
160
+ })
161
+ .optional(),
162
+ }) satisfies z.ZodType<ExecutionResultData>;
163
+
164
+ export const ExecutionResultResponseSchema = z.object({
165
+ result: ExecutionResultDataSchema,
166
+ });
167
+
168
+ export type ExecutionResultResponse = z.infer<
169
+ typeof ExecutionResultResponseSchema
170
+ >;
171
+
172
+ // =============================================================================
173
+ // Execution Summary Projection (GET /api/executions/{executionId}/summary)
174
+ // =============================================================================
175
+
176
+ /**
177
+ * Full ExecutionSummary projection (summary.ts). DISTINCT from the narrow
178
+ * ExecutionSummarySchema above, which the list endpoint uses and which omits
179
+ * initiatedBy / visibility / explanationAvailable. GET /summary returns the
180
+ * full projection at runtime, so it gets its own schema. ExecutionKind is
181
+ * derived from the EXECUTION_KINDS registry so the enum can never drift.
182
+ *
183
+ * @see ADR-CONT-067
184
+ */
185
+ const EXECUTION_KIND_VALUES = Object.keys(EXECUTION_KINDS) as [
186
+ ExecutionKind,
187
+ ...ExecutionKind[],
188
+ ];
189
+
190
+ export const ExecutionSummaryProjectionSchema = z.object({
191
+ executionId: z.string(),
192
+ kind: z.enum(EXECUTION_KIND_VALUES),
193
+ target: z.object({
194
+ type: z.literal("slack"),
195
+ workspaceId: z.string().optional(),
196
+ }),
197
+ status: z.enum(["pending", "succeeded", "failed"]),
198
+ initiatedBy: z.object({
199
+ actorType: z.enum(["user", "system"]),
200
+ actorId: z.string(),
201
+ displayName: z.string(),
202
+ }),
203
+ decidedAt: z.string(),
204
+ completedAt: z.string().optional(),
205
+ visibility: z.enum(["admin", "user"]),
206
+ explanationAvailable: z.boolean(),
207
+ }) satisfies z.ZodType<ExecutionSummary>;
208
+
209
+ export const GetExecutionSummaryResponseSchema = z.object({
210
+ summary: ExecutionSummaryProjectionSchema,
211
+ });
212
+
213
+ export type GetExecutionSummaryResponse = z.infer<
214
+ typeof GetExecutionSummaryResponseSchema
215
+ >;
@@ -47,11 +47,14 @@ 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}/result': ['GET'],
51
+ '/api/executions/{executionId}/stream': ['GET'],
50
52
  '/api/executions/{executionId}/summary': ['GET'],
51
53
  '/api/executions/{executionId}/timeline': ['GET'],
52
54
  '/api/executions/{executionId}/undo': ['POST'],
53
55
  '/api/factory/floor': ['GET'],
54
56
  '/api/factory/snapshot': ['GET'],
57
+ '/api/ingestion/operations/{id}': ['GET'],
55
58
  '/api/internal-admin/impersonate/end': ['POST'],
56
59
  '/api/internal-admin/impersonate/session': ['GET'],
57
60
  '/api/internal-admin/impersonate/start': ['POST'],