@company-semantics/contracts 13.6.0 → 13.8.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.6.0",
3
+ "version": "13.8.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 = '3740712c6cee' as const;
3
- export const SPEC_HASH_FULL = '3740712c6cee7d3684fb174624951f59bc1c3bb5f48dabf43ebf6c2a535c654e' as const;
2
+ export const SPEC_HASH = '82b9493c89c4' as const;
3
+ export const SPEC_HASH_FULL = '82b9493c89c442f25165f969fc23716d2ed0ba12f563534d9d00eae3aed8f671' as const;
@@ -3832,6 +3832,56 @@ export interface components {
3832
3832
  visibilityLevel: "system" | "oversight" | "org_admin" | "user";
3833
3833
  }[];
3834
3834
  };
3835
+ ExecutionSummaryResponse: {
3836
+ summary: {
3837
+ executionId: string;
3838
+ /** @enum {string} */
3839
+ kind: "integration.connect" | "integration.disconnect" | "profile.update" | "slack.send" | "data.ingest" | "data.scope" | "system.cleanup";
3840
+ target: {
3841
+ /** @constant */
3842
+ type: "slack";
3843
+ workspaceId?: string;
3844
+ };
3845
+ /** @enum {string} */
3846
+ status: "pending" | "succeeded" | "failed";
3847
+ initiatedBy: {
3848
+ /** @enum {string} */
3849
+ actorType: "user" | "system";
3850
+ actorId: string;
3851
+ displayName: string;
3852
+ };
3853
+ decidedAt: string;
3854
+ completedAt?: string;
3855
+ /** @enum {string} */
3856
+ visibility: "admin" | "user";
3857
+ explanationAvailable: boolean;
3858
+ };
3859
+ };
3860
+ ExecutionResultResponse: {
3861
+ result: {
3862
+ actionId: string;
3863
+ executionId: string;
3864
+ /** @enum {string} */
3865
+ state: "completed" | "failed";
3866
+ artifacts: {
3867
+ /** @enum {string} */
3868
+ kind: "message" | "api_call" | "diff" | "notification" | "task" | "calendar" | "integration";
3869
+ label: string;
3870
+ /** @enum {string} */
3871
+ status: "success" | "failed" | "skipped";
3872
+ error?: string;
3873
+ resultLabel?: string;
3874
+ }[];
3875
+ summary: {
3876
+ title: string;
3877
+ description?: string;
3878
+ };
3879
+ undo?: {
3880
+ availableUntil: string;
3881
+ kind: string;
3882
+ };
3883
+ };
3884
+ };
3835
3885
  ConfirmExecutionResponse: {
3836
3886
  /** @enum {string} */
3837
3887
  status: "executing" | "blocked_pending_approval" | "already_confirmed" | "awaiting_approval";
@@ -6956,7 +7006,9 @@ export interface operations {
6956
7006
  headers: {
6957
7007
  [name: string]: unknown;
6958
7008
  };
6959
- content?: never;
7009
+ content: {
7010
+ "application/json": components["schemas"]["ExecutionSummaryResponse"];
7011
+ };
6960
7012
  };
6961
7013
  };
6962
7014
  };
@@ -6976,7 +7028,9 @@ export interface operations {
6976
7028
  headers: {
6977
7029
  [name: string]: unknown;
6978
7030
  };
6979
- content?: never;
7031
+ content: {
7032
+ "application/json": components["schemas"]["ExecutionResultResponse"];
7033
+ };
6980
7034
  };
6981
7035
  };
6982
7036
  };
@@ -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,6 +47,7 @@ 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'],
50
51
  '/api/executions/{executionId}/stream': ['GET'],
51
52
  '/api/executions/{executionId}/summary': ['GET'],
52
53
  '/api/executions/{executionId}/timeline': ['GET'],