@company-semantics/contracts 13.6.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
package/src/execution/index.ts
CHANGED
|
@@ -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";
|
package/src/execution/schemas.ts
CHANGED
|
@@ -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'],
|