@xemahq/kernel-contracts 0.29.0 → 0.31.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/dist/decision-gate/index.d.ts +3 -0
- package/dist/decision-gate/index.d.ts.map +1 -0
- package/dist/decision-gate/index.js +19 -0
- package/dist/decision-gate/index.js.map +1 -0
- package/dist/decision-gate/lib/decision-gate.d.ts +55 -0
- package/dist/decision-gate/lib/decision-gate.d.ts.map +1 -0
- package/dist/decision-gate/lib/decision-gate.js +56 -0
- package/dist/decision-gate/lib/decision-gate.js.map +1 -0
- package/dist/decision-gate/lib/pinned-subject-artifact.d.ts +9 -0
- package/dist/decision-gate/lib/pinned-subject-artifact.d.ts.map +1 -0
- package/dist/decision-gate/lib/pinned-subject-artifact.js +11 -0
- package/dist/decision-gate/lib/pinned-subject-artifact.js.map +1 -0
- package/dist/document-patch/index.d.ts +4 -0
- package/dist/document-patch/index.d.ts.map +1 -0
- package/dist/document-patch/index.js +20 -0
- package/dist/document-patch/index.js.map +1 -0
- package/dist/document-patch/lib/patch-anchor.d.ts +7 -0
- package/dist/document-patch/lib/patch-anchor.d.ts.map +1 -0
- package/dist/document-patch/lib/patch-anchor.js +14 -0
- package/dist/document-patch/lib/patch-anchor.js.map +1 -0
- package/dist/document-patch/lib/patch-enums.d.ts +11 -0
- package/dist/document-patch/lib/patch-enums.d.ts.map +1 -0
- package/dist/document-patch/lib/patch-enums.js +16 -0
- package/dist/document-patch/lib/patch-enums.js.map +1 -0
- package/dist/document-patch/lib/pending-patch.d.ts +22 -0
- package/dist/document-patch/lib/pending-patch.d.ts.map +1 -0
- package/dist/document-patch/lib/pending-patch.js +3 -0
- package/dist/document-patch/lib/pending-patch.js.map +1 -0
- package/dist/output/index.d.ts +7 -0
- package/dist/output/index.d.ts.map +1 -0
- package/dist/output/index.js +23 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/lib/output-deliverable-expectation.d.ts +9 -0
- package/dist/output/lib/output-deliverable-expectation.d.ts.map +1 -0
- package/dist/output/lib/output-deliverable-expectation.js +3 -0
- package/dist/output/lib/output-deliverable-expectation.js.map +1 -0
- package/dist/output/lib/output-item-dto.d.ts +25 -0
- package/dist/output/lib/output-item-dto.d.ts.map +1 -0
- package/dist/output/lib/output-item-dto.js +3 -0
- package/dist/output/lib/output-item-dto.js.map +1 -0
- package/dist/output/lib/output-kind.d.ts +14 -0
- package/dist/output/lib/output-kind.d.ts.map +1 -0
- package/dist/output/lib/output-kind.js +18 -0
- package/dist/output/lib/output-kind.js.map +1 -0
- package/dist/output/lib/output-render-hint.d.ts +11 -0
- package/dist/output/lib/output-render-hint.d.ts.map +1 -0
- package/dist/output/lib/output-render-hint.js +10 -0
- package/dist/output/lib/output-render-hint.js.map +1 -0
- package/dist/output/lib/output-version-dto.d.ts +10 -0
- package/dist/output/lib/output-version-dto.d.ts.map +1 -0
- package/dist/output/lib/output-version-dto.js +3 -0
- package/dist/output/lib/output-version-dto.js.map +1 -0
- package/dist/output/lib/payload-schemas/code-diff.d.ts +7 -0
- package/dist/output/lib/payload-schemas/code-diff.d.ts.map +1 -0
- package/dist/output/lib/payload-schemas/code-diff.js +11 -0
- package/dist/output/lib/payload-schemas/code-diff.js.map +1 -0
- package/dist/output/lib/payload-schemas/decision-record.d.ts +19 -0
- package/dist/output/lib/payload-schemas/decision-record.d.ts.map +1 -0
- package/dist/output/lib/payload-schemas/decision-record.js +39 -0
- package/dist/output/lib/payload-schemas/decision-record.js.map +1 -0
- package/dist/output/lib/payload-schemas/diagram.d.ts +12 -0
- package/dist/output/lib/payload-schemas/diagram.d.ts.map +1 -0
- package/dist/output/lib/payload-schemas/diagram.js +34 -0
- package/dist/output/lib/payload-schemas/diagram.js.map +1 -0
- package/dist/output/lib/payload-schemas/external-blob.d.ts +9 -0
- package/dist/output/lib/payload-schemas/external-blob.d.ts.map +1 -0
- package/dist/output/lib/payload-schemas/external-blob.js +15 -0
- package/dist/output/lib/payload-schemas/external-blob.js.map +1 -0
- package/dist/output/lib/payload-schemas/index.d.ts +17 -0
- package/dist/output/lib/payload-schemas/index.d.ts.map +1 -0
- package/dist/output/lib/payload-schemas/index.js +94 -0
- package/dist/output/lib/payload-schemas/index.js.map +1 -0
- package/dist/output/lib/payload-schemas/json-payload.d.ts +4 -0
- package/dist/output/lib/payload-schemas/json-payload.d.ts.map +1 -0
- package/dist/output/lib/payload-schemas/json-payload.js +9 -0
- package/dist/output/lib/payload-schemas/json-payload.js.map +1 -0
- package/dist/output/lib/payload-schemas/manifest.d.ts +37 -0
- package/dist/output/lib/payload-schemas/manifest.d.ts.map +1 -0
- package/dist/output/lib/payload-schemas/manifest.js +43 -0
- package/dist/output/lib/payload-schemas/manifest.js.map +1 -0
- package/dist/output/lib/payload-schemas/markdown-doc.d.ts +8 -0
- package/dist/output/lib/payload-schemas/markdown-doc.d.ts.map +1 -0
- package/dist/output/lib/payload-schemas/markdown-doc.js +12 -0
- package/dist/output/lib/payload-schemas/markdown-doc.js.map +1 -0
- package/dist/output/lib/payload-schemas/review-findings.d.ts +30 -0
- package/dist/output/lib/payload-schemas/review-findings.d.ts.map +1 -0
- package/dist/output/lib/payload-schemas/review-findings.js +39 -0
- package/dist/output/lib/payload-schemas/review-findings.js.map +1 -0
- package/dist/output/lib/payload-schemas/schema.d.ts +4 -0
- package/dist/output/lib/payload-schemas/schema.d.ts.map +1 -0
- package/dist/output/lib/payload-schemas/schema.js +10 -0
- package/dist/output/lib/payload-schemas/schema.js.map +1 -0
- package/dist/output/lib/payload-schemas/test-report.d.ts +33 -0
- package/dist/output/lib/payload-schemas/test-report.d.ts.map +1 -0
- package/dist/output/lib/payload-schemas/test-report.js +46 -0
- package/dist/output/lib/payload-schemas/test-report.js.map +1 -0
- package/dist/question/index.d.ts +5 -0
- package/dist/question/index.d.ts.map +1 -0
- package/dist/question/index.js +21 -0
- package/dist/question/index.js.map +1 -0
- package/dist/question/lib/question-action-context.d.ts +7 -0
- package/dist/question/lib/question-action-context.d.ts.map +1 -0
- package/dist/question/lib/question-action-context.js +3 -0
- package/dist/question/lib/question-action-context.js.map +1 -0
- package/dist/question/lib/question-dto.d.ts +54 -0
- package/dist/question/lib/question-dto.d.ts.map +1 -0
- package/dist/question/lib/question-dto.js +3 -0
- package/dist/question/lib/question-dto.js.map +1 -0
- package/dist/question/lib/question-enums.d.ts +20 -0
- package/dist/question/lib/question-enums.d.ts.map +1 -0
- package/dist/question/lib/question-enums.js +32 -0
- package/dist/question/lib/question-enums.js.map +1 -0
- package/dist/question/lib/question-escalation.d.ts +8 -0
- package/dist/question/lib/question-escalation.d.ts.map +1 -0
- package/dist/question/lib/question-escalation.js +3 -0
- package/dist/question/lib/question-escalation.js.map +1 -0
- package/dist/review-inquiry/index.d.ts +3 -0
- package/dist/review-inquiry/index.d.ts.map +1 -0
- package/dist/review-inquiry/index.js +19 -0
- package/dist/review-inquiry/index.js.map +1 -0
- package/dist/review-inquiry/lib/review-inquiry.d.ts +138 -0
- package/dist/review-inquiry/lib/review-inquiry.d.ts.map +1 -0
- package/dist/review-inquiry/lib/review-inquiry.js +20 -0
- package/dist/review-inquiry/lib/review-inquiry.js.map +1 -0
- package/dist/review-inquiry/lib/web-annotation.d.ts +195 -0
- package/dist/review-inquiry/lib/web-annotation.d.ts.map +1 -0
- package/dist/review-inquiry/lib/web-annotation.js +59 -0
- package/dist/review-inquiry/lib/web-annotation.js.map +1 -0
- package/dist/run-detail/index.d.ts +7 -0
- package/dist/run-detail/index.d.ts.map +1 -0
- package/dist/run-detail/index.js +23 -0
- package/dist/run-detail/index.js.map +1 -0
- package/dist/run-detail/lib/run-detail-dto.d.ts +34 -0
- package/dist/run-detail/lib/run-detail-dto.d.ts.map +1 -0
- package/dist/run-detail/lib/run-detail-dto.js +3 -0
- package/dist/run-detail/lib/run-detail-dto.js.map +1 -0
- package/dist/run-detail/lib/run-mode.d.ts +14 -0
- package/dist/run-detail/lib/run-mode.d.ts.map +1 -0
- package/dist/run-detail/lib/run-mode.js +25 -0
- package/dist/run-detail/lib/run-mode.js.map +1 -0
- package/dist/run-detail/lib/run-outcome.d.ts +28 -0
- package/dist/run-detail/lib/run-outcome.d.ts.map +1 -0
- package/dist/run-detail/lib/run-outcome.js +27 -0
- package/dist/run-detail/lib/run-outcome.js.map +1 -0
- package/dist/run-detail/lib/run-phase-rail.d.ts +21 -0
- package/dist/run-detail/lib/run-phase-rail.d.ts.map +1 -0
- package/dist/run-detail/lib/run-phase-rail.js +14 -0
- package/dist/run-detail/lib/run-phase-rail.js.map +1 -0
- package/dist/run-detail/lib/run-revision-state.d.ts +47 -0
- package/dist/run-detail/lib/run-revision-state.d.ts.map +1 -0
- package/dist/run-detail/lib/run-revision-state.js +11 -0
- package/dist/run-detail/lib/run-revision-state.js.map +1 -0
- package/dist/run-detail/lib/wait-windows.d.ts +15 -0
- package/dist/run-detail/lib/wait-windows.d.ts.map +1 -0
- package/dist/run-detail/lib/wait-windows.js +39 -0
- package/dist/run-detail/lib/wait-windows.js.map +1 -0
- package/dist/workspace-image/index.d.ts +5 -0
- package/dist/workspace-image/index.d.ts.map +1 -0
- package/dist/workspace-image/index.js +21 -0
- package/dist/workspace-image/index.js.map +1 -0
- package/dist/workspace-image/lib/enums.d.ts +17 -0
- package/dist/workspace-image/lib/enums.d.ts.map +1 -0
- package/dist/workspace-image/lib/enums.js +22 -0
- package/dist/workspace-image/lib/enums.js.map +1 -0
- package/dist/workspace-image/lib/hash.d.ts +3 -0
- package/dist/workspace-image/lib/hash.d.ts.map +1 -0
- package/dist/workspace-image/lib/hash.js +50 -0
- package/dist/workspace-image/lib/hash.js.map +1 -0
- package/dist/workspace-image/lib/schemas.d.ts +103 -0
- package/dist/workspace-image/lib/schemas.d.ts.map +1 -0
- package/dist/workspace-image/lib/schemas.js +53 -0
- package/dist/workspace-image/lib/schemas.js.map +1 -0
- package/dist/workspace-image/lib/types.d.ts +50 -0
- package/dist/workspace-image/lib/types.d.ts.map +1 -0
- package/dist/workspace-image/lib/types.js +3 -0
- package/dist/workspace-image/lib/types.js.map +1 -0
- package/package.json +1 -1
- package/src/decision-gate/index.ts +13 -0
- package/src/decision-gate/lib/decision-gate.ts +113 -0
- package/src/decision-gate/lib/pinned-subject-artifact.ts +29 -0
- package/src/document-patch/index.ts +25 -0
- package/src/document-patch/lib/patch-anchor.ts +22 -0
- package/src/document-patch/lib/patch-enums.ts +36 -0
- package/src/document-patch/lib/pending-patch.ts +31 -0
- package/src/output/index.ts +20 -0
- package/src/output/lib/output-deliverable-expectation.ts +25 -0
- package/src/output/lib/output-item-dto.ts +54 -0
- package/src/output/lib/output-kind.ts +44 -0
- package/src/output/lib/output-render-hint.ts +28 -0
- package/src/output/lib/output-version-dto.ts +21 -0
- package/src/output/lib/payload-schemas/code-diff.ts +20 -0
- package/src/output/lib/payload-schemas/decision-record.ts +71 -0
- package/src/output/lib/payload-schemas/diagram.ts +54 -0
- package/src/output/lib/payload-schemas/external-blob.ts +36 -0
- package/src/output/lib/payload-schemas/index.ts +133 -0
- package/src/output/lib/payload-schemas/json-payload.ts +19 -0
- package/src/output/lib/payload-schemas/manifest.ts +81 -0
- package/src/output/lib/payload-schemas/markdown-doc.ts +33 -0
- package/src/output/lib/payload-schemas/review-findings.ts +75 -0
- package/src/output/lib/payload-schemas/schema.ts +22 -0
- package/src/output/lib/payload-schemas/test-report.ts +69 -0
- package/src/question/index.ts +24 -0
- package/src/question/lib/question-action-context.ts +26 -0
- package/src/question/lib/question-dto.ts +143 -0
- package/src/question/lib/question-enums.ts +67 -0
- package/src/question/lib/question-escalation.ts +22 -0
- package/src/review-inquiry/index.ts +19 -0
- package/src/review-inquiry/lib/review-inquiry.ts +76 -0
- package/src/review-inquiry/lib/web-annotation.ts +136 -0
- package/src/run-detail/index.ts +22 -0
- package/src/run-detail/lib/run-detail-dto.ts +84 -0
- package/src/run-detail/lib/run-mode.ts +65 -0
- package/src/run-detail/lib/run-outcome.ts +66 -0
- package/src/run-detail/lib/run-phase-rail.ts +43 -0
- package/src/run-detail/lib/run-revision-state.ts +83 -0
- package/src/run-detail/lib/wait-windows.ts +70 -0
- package/src/workspace-image/index.ts +13 -0
- package/src/workspace-image/lib/enums.ts +38 -0
- package/src/workspace-image/lib/hash.ts +95 -0
- package/src/workspace-image/lib/schemas.ts +63 -0
- package/src/workspace-image/lib/types.ts +79 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ImageLayerKind, VariantStatus } from './enums';
|
|
3
|
+
export declare const imageLayerKindSchema: z.ZodEnum<typeof ImageLayerKind>;
|
|
4
|
+
export declare const variantStatusSchema: z.ZodEnum<typeof VariantStatus>;
|
|
5
|
+
export declare const imageLayerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
6
|
+
kind: z.ZodLiteral<ImageLayerKind.Apt>;
|
|
7
|
+
packages: z.ZodArray<z.ZodString>;
|
|
8
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
9
|
+
kind: z.ZodLiteral<ImageLayerKind.Dnf>;
|
|
10
|
+
packages: z.ZodArray<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
12
|
+
kind: z.ZodLiteral<ImageLayerKind.Apk>;
|
|
13
|
+
packages: z.ZodArray<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
15
|
+
kind: z.ZodLiteral<ImageLayerKind.Pip>;
|
|
16
|
+
packages: z.ZodArray<z.ZodString>;
|
|
17
|
+
pythonVersion: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
19
|
+
kind: z.ZodLiteral<ImageLayerKind.NpmGlobal>;
|
|
20
|
+
packages: z.ZodArray<z.ZodString>;
|
|
21
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
22
|
+
kind: z.ZodLiteral<ImageLayerKind.Env>;
|
|
23
|
+
vars: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
24
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
25
|
+
kind: z.ZodLiteral<ImageLayerKind.File>;
|
|
26
|
+
path: z.ZodString;
|
|
27
|
+
contentBase64: z.ZodString;
|
|
28
|
+
mode: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
}, z.core.$strip>], "kind">;
|
|
30
|
+
export declare const workspaceImageManifestSchema: z.ZodObject<{
|
|
31
|
+
layers: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
32
|
+
kind: z.ZodLiteral<ImageLayerKind.Apt>;
|
|
33
|
+
packages: z.ZodArray<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
35
|
+
kind: z.ZodLiteral<ImageLayerKind.Dnf>;
|
|
36
|
+
packages: z.ZodArray<z.ZodString>;
|
|
37
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
38
|
+
kind: z.ZodLiteral<ImageLayerKind.Apk>;
|
|
39
|
+
packages: z.ZodArray<z.ZodString>;
|
|
40
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
41
|
+
kind: z.ZodLiteral<ImageLayerKind.Pip>;
|
|
42
|
+
packages: z.ZodArray<z.ZodString>;
|
|
43
|
+
pythonVersion: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
45
|
+
kind: z.ZodLiteral<ImageLayerKind.NpmGlobal>;
|
|
46
|
+
packages: z.ZodArray<z.ZodString>;
|
|
47
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
48
|
+
kind: z.ZodLiteral<ImageLayerKind.Env>;
|
|
49
|
+
vars: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
50
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
51
|
+
kind: z.ZodLiteral<ImageLayerKind.File>;
|
|
52
|
+
path: z.ZodString;
|
|
53
|
+
contentBase64: z.ZodString;
|
|
54
|
+
mode: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
}, z.core.$strip>], "kind">>;
|
|
56
|
+
workdir: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
export declare const workspaceImageVariantSchema: z.ZodObject<{
|
|
59
|
+
id: z.ZodString;
|
|
60
|
+
orgId: z.ZodString;
|
|
61
|
+
slug: z.ZodString;
|
|
62
|
+
description: z.ZodString;
|
|
63
|
+
runtimeKind: z.ZodEnum<typeof import("../../worker-runtime").WorkerRuntimeKind>;
|
|
64
|
+
baseImage: z.ZodString;
|
|
65
|
+
manifest: z.ZodObject<{
|
|
66
|
+
layers: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
67
|
+
kind: z.ZodLiteral<ImageLayerKind.Apt>;
|
|
68
|
+
packages: z.ZodArray<z.ZodString>;
|
|
69
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
70
|
+
kind: z.ZodLiteral<ImageLayerKind.Dnf>;
|
|
71
|
+
packages: z.ZodArray<z.ZodString>;
|
|
72
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
73
|
+
kind: z.ZodLiteral<ImageLayerKind.Apk>;
|
|
74
|
+
packages: z.ZodArray<z.ZodString>;
|
|
75
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
76
|
+
kind: z.ZodLiteral<ImageLayerKind.Pip>;
|
|
77
|
+
packages: z.ZodArray<z.ZodString>;
|
|
78
|
+
pythonVersion: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
80
|
+
kind: z.ZodLiteral<ImageLayerKind.NpmGlobal>;
|
|
81
|
+
packages: z.ZodArray<z.ZodString>;
|
|
82
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
83
|
+
kind: z.ZodLiteral<ImageLayerKind.Env>;
|
|
84
|
+
vars: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
85
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
86
|
+
kind: z.ZodLiteral<ImageLayerKind.File>;
|
|
87
|
+
path: z.ZodString;
|
|
88
|
+
contentBase64: z.ZodString;
|
|
89
|
+
mode: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
}, z.core.$strip>], "kind">>;
|
|
91
|
+
workdir: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
contentHash: z.ZodString;
|
|
94
|
+
registryRef: z.ZodOptional<z.ZodString>;
|
|
95
|
+
status: z.ZodEnum<typeof VariantStatus>;
|
|
96
|
+
isOrgDefault: z.ZodBoolean;
|
|
97
|
+
autoRebake: z.ZodBoolean;
|
|
98
|
+
regions: z.ZodArray<z.ZodString>;
|
|
99
|
+
buildLog: z.ZodOptional<z.ZodString>;
|
|
100
|
+
builtAt: z.ZodOptional<z.ZodString>;
|
|
101
|
+
createdAt: z.ZodString;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/workspace-image/lib/schemas.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExD,eAAO,MAAM,oBAAoB,kCAA+B,CAAC;AACjE,eAAO,MAAM,mBAAmB,iCAA8B,CAAC;AAI/D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;2BAoB3B,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGvC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiBtC,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.workspaceImageVariantSchema = exports.workspaceImageManifestSchema = exports.imageLayerSchema = exports.variantStatusSchema = exports.imageLayerKindSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const worker_runtime_1 = require("../../worker-runtime");
|
|
6
|
+
const enums_1 = require("./enums");
|
|
7
|
+
exports.imageLayerKindSchema = zod_1.z.nativeEnum(enums_1.ImageLayerKind);
|
|
8
|
+
exports.variantStatusSchema = zod_1.z.nativeEnum(enums_1.VariantStatus);
|
|
9
|
+
const packagesArray = zod_1.z.array(zod_1.z.string().min(1));
|
|
10
|
+
exports.imageLayerSchema = zod_1.z.discriminatedUnion('kind', [
|
|
11
|
+
zod_1.z.object({ kind: zod_1.z.literal(enums_1.ImageLayerKind.Apt), packages: packagesArray }),
|
|
12
|
+
zod_1.z.object({ kind: zod_1.z.literal(enums_1.ImageLayerKind.Dnf), packages: packagesArray }),
|
|
13
|
+
zod_1.z.object({ kind: zod_1.z.literal(enums_1.ImageLayerKind.Apk), packages: packagesArray }),
|
|
14
|
+
zod_1.z.object({
|
|
15
|
+
kind: zod_1.z.literal(enums_1.ImageLayerKind.Pip),
|
|
16
|
+
packages: packagesArray,
|
|
17
|
+
pythonVersion: zod_1.z.string().min(1).optional(),
|
|
18
|
+
}),
|
|
19
|
+
zod_1.z.object({ kind: zod_1.z.literal(enums_1.ImageLayerKind.NpmGlobal), packages: packagesArray }),
|
|
20
|
+
zod_1.z.object({
|
|
21
|
+
kind: zod_1.z.literal(enums_1.ImageLayerKind.Env),
|
|
22
|
+
vars: zod_1.z.record(zod_1.z.string().min(1), zod_1.z.string()),
|
|
23
|
+
}),
|
|
24
|
+
zod_1.z.object({
|
|
25
|
+
kind: zod_1.z.literal(enums_1.ImageLayerKind.File),
|
|
26
|
+
path: zod_1.z.string().min(1),
|
|
27
|
+
contentBase64: zod_1.z.string().min(1),
|
|
28
|
+
mode: zod_1.z.number().int().nonnegative().optional(),
|
|
29
|
+
}),
|
|
30
|
+
]);
|
|
31
|
+
exports.workspaceImageManifestSchema = zod_1.z.object({
|
|
32
|
+
layers: zod_1.z.array(exports.imageLayerSchema),
|
|
33
|
+
workdir: zod_1.z.string().min(1).optional(),
|
|
34
|
+
});
|
|
35
|
+
exports.workspaceImageVariantSchema = zod_1.z.object({
|
|
36
|
+
id: zod_1.z.string().min(1),
|
|
37
|
+
orgId: zod_1.z.string().min(1),
|
|
38
|
+
slug: zod_1.z.string().min(1),
|
|
39
|
+
description: zod_1.z.string(),
|
|
40
|
+
runtimeKind: worker_runtime_1.workerRuntimeKindSchema,
|
|
41
|
+
baseImage: zod_1.z.string().min(1),
|
|
42
|
+
manifest: exports.workspaceImageManifestSchema,
|
|
43
|
+
contentHash: zod_1.z.string().min(1),
|
|
44
|
+
registryRef: zod_1.z.string().min(1).optional(),
|
|
45
|
+
status: exports.variantStatusSchema,
|
|
46
|
+
isOrgDefault: zod_1.z.boolean(),
|
|
47
|
+
autoRebake: zod_1.z.boolean(),
|
|
48
|
+
regions: zod_1.z.array(zod_1.z.string().min(1)),
|
|
49
|
+
buildLog: zod_1.z.string().optional(),
|
|
50
|
+
builtAt: zod_1.z.string().min(1).optional(),
|
|
51
|
+
createdAt: zod_1.z.string().min(1),
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/workspace-image/lib/schemas.ts"],"names":[],"mappings":";;;AAQA,6BAAwB;AACxB,yDAA+D;AAE/D,mCAAwD;AAE3C,QAAA,oBAAoB,GAAG,OAAC,CAAC,UAAU,CAAC,sBAAc,CAAC,CAAC;AACpD,QAAA,mBAAmB,GAAG,OAAC,CAAC,UAAU,CAAC,qBAAa,CAAC,CAAC;AAE/D,MAAM,aAAa,GAAG,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAEpC,QAAA,gBAAgB,GAAG,OAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC3D,OAAC,CAAC,M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EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACrC,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC7B,CAAC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { WorkerRuntimeKind } from '../../worker-runtime';
|
|
2
|
+
import type { ImageLayerKind, VariantStatus } from './enums';
|
|
3
|
+
export type ImageLayer = {
|
|
4
|
+
readonly kind: ImageLayerKind.Apt;
|
|
5
|
+
readonly packages: readonly string[];
|
|
6
|
+
} | {
|
|
7
|
+
readonly kind: ImageLayerKind.Dnf;
|
|
8
|
+
readonly packages: readonly string[];
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: ImageLayerKind.Apk;
|
|
11
|
+
readonly packages: readonly string[];
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: ImageLayerKind.Pip;
|
|
14
|
+
readonly packages: readonly string[];
|
|
15
|
+
readonly pythonVersion?: string;
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: ImageLayerKind.NpmGlobal;
|
|
18
|
+
readonly packages: readonly string[];
|
|
19
|
+
} | {
|
|
20
|
+
readonly kind: ImageLayerKind.Env;
|
|
21
|
+
readonly vars: Readonly<Record<string, string>>;
|
|
22
|
+
} | {
|
|
23
|
+
readonly kind: ImageLayerKind.File;
|
|
24
|
+
readonly path: string;
|
|
25
|
+
readonly contentBase64: string;
|
|
26
|
+
readonly mode?: number;
|
|
27
|
+
};
|
|
28
|
+
export interface WorkspaceImageManifest {
|
|
29
|
+
readonly layers: readonly ImageLayer[];
|
|
30
|
+
readonly workdir?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface WorkspaceImageVariant {
|
|
33
|
+
readonly id: string;
|
|
34
|
+
readonly orgId: string;
|
|
35
|
+
readonly slug: string;
|
|
36
|
+
readonly description: string;
|
|
37
|
+
readonly runtimeKind: WorkerRuntimeKind;
|
|
38
|
+
readonly baseImage: string;
|
|
39
|
+
readonly manifest: WorkspaceImageManifest;
|
|
40
|
+
readonly contentHash: string;
|
|
41
|
+
readonly registryRef?: string;
|
|
42
|
+
readonly status: VariantStatus;
|
|
43
|
+
readonly isOrgDefault: boolean;
|
|
44
|
+
readonly autoRebake: boolean;
|
|
45
|
+
readonly regions: readonly string[];
|
|
46
|
+
readonly buildLog?: string;
|
|
47
|
+
readonly builtAt?: string;
|
|
48
|
+
readonly createdAt: string;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/workspace-image/lib/types.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAU7D,MAAM,MAAM,UAAU,GAClB;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,GAAG,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC3E;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,GAAG,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC3E;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,GAAG,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC3E;IACE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,GAAG,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC;IAAC,QAAQ,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IAE3B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/workspace-image/lib/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xemahq/kernel-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "Consolidated Xema OS kernel wire contracts — pure types + zod schemas for the kernel protocol surfaces. One package, one npm scope, wildcard per-surface subpath exports. No framework/runtime deps.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Neuralchowder Inc. <developer@xema.dev> (https://xema.dev)",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
+
// @xemahq/decision-gate-contracts — Kernel layer
|
|
3
|
+
//
|
|
4
|
+
// Per-kind schemas for the DECISION_GATE InquiryKind: pin one or more
|
|
5
|
+
// artifact versions, ask deciders for a verdict, aggregate per the
|
|
6
|
+
// inquiry's policy, output the approved-version pinned set for downstream
|
|
7
|
+
// consumers (publish-kb etc.) to use unconditionally.
|
|
8
|
+
//
|
|
9
|
+
// Pure types + Zod. Workflow VM imports `import type` only.
|
|
10
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
11
|
+
|
|
12
|
+
export * from './lib/pinned-subject-artifact';
|
|
13
|
+
export * from './lib/decision-gate';
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
import { PinnedSubjectArtifactSchema } from './pinned-subject-artifact';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Verdict a decider returns on a Decision Gate inquiry.
|
|
7
|
+
*
|
|
8
|
+
* `ABSTAIN` is distinct from `REJECT`: a non-vote that the gate's policy
|
|
9
|
+
* may treat as "skip and wait for the rest" or "implicit reject" depending
|
|
10
|
+
* on the policy's `abstainTreatment`. Humans cannot ABSTAIN today (UI
|
|
11
|
+
* exposes only Approve / Reject); agents and endpoints may, e.g. when
|
|
12
|
+
* their structured output fails validation or the underlying activity
|
|
13
|
+
* exhausts retries.
|
|
14
|
+
*/
|
|
15
|
+
export enum DecisionVerdict {
|
|
16
|
+
APPROVE = 'approve',
|
|
17
|
+
REJECT = 'reject',
|
|
18
|
+
ABSTAIN = 'abstain',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Terminal outcome of the gate as a whole. Distinct from per-recipient
|
|
23
|
+
* verdict because it accounts for timeout + policy aggregation.
|
|
24
|
+
*/
|
|
25
|
+
export enum DecisionGateOutcome {
|
|
26
|
+
APPROVED = 'approved',
|
|
27
|
+
REJECTED = 'rejected',
|
|
28
|
+
EXPIRED_APPROVED = 'expired_approved',
|
|
29
|
+
EXPIRED_REJECTED = 'expired_rejected',
|
|
30
|
+
CANCELLED = 'cancelled',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Prompt payload for a DECISION_GATE inquiry. The pinned set is what
|
|
35
|
+
* deciders are deciding on; `description` is human-readable context shown
|
|
36
|
+
* to humans + included in the agent decider's prompt.
|
|
37
|
+
*
|
|
38
|
+
* `passthrough()` keeps unknown keys on the parsed object — used by
|
|
39
|
+
* orchestrators (e.g. `xema/review@v3`) that inject extra context for
|
|
40
|
+
* the FE to render (`reviewIteration`, `reviewerFindings`,
|
|
41
|
+
* `pastIterations`). Decision-gate itself never reads them; the FE
|
|
42
|
+
* gates rendering on field presence and ignores when absent.
|
|
43
|
+
*/
|
|
44
|
+
export const DecisionGatePromptSchema = z
|
|
45
|
+
.object({
|
|
46
|
+
subjectArtifacts: z.array(PinnedSubjectArtifactSchema),
|
|
47
|
+
description: z.string().optional(),
|
|
48
|
+
})
|
|
49
|
+
.passthrough();
|
|
50
|
+
export type DecisionGatePrompt = z.infer<typeof DecisionGatePromptSchema>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Reply payload submitted by one decider (human / agent / endpoint). The
|
|
54
|
+
* shape is identical across recipient kinds — what differs is the
|
|
55
|
+
* `submittedBy` attribution and how the payload was produced (UI form,
|
|
56
|
+
* agent structured output, endpoint verdict mapper).
|
|
57
|
+
*
|
|
58
|
+
* `reason` is REQUIRED when the verdict is REJECT and must be a non-empty
|
|
59
|
+
* trimmed string. The contract enforces this at every entry point (engine
|
|
60
|
+
* controller, agent reply, endpoint verdict-mapper) so a reviewer cannot
|
|
61
|
+
* reject a deliverable without articulating why. APPROVE and ABSTAIN
|
|
62
|
+
* leave `reason` optional — the happy path stays frictionless and an
|
|
63
|
+
* ABSTAIN typically means "validation failed / cannot decide" which has
|
|
64
|
+
* no human-authored justification to capture.
|
|
65
|
+
*/
|
|
66
|
+
export const DecisionGateReplySchema = z
|
|
67
|
+
.object({
|
|
68
|
+
verdict: z.nativeEnum(DecisionVerdict),
|
|
69
|
+
reason: z.string().optional(),
|
|
70
|
+
attachment: z.record(z.string(), z.unknown()).optional(),
|
|
71
|
+
})
|
|
72
|
+
.superRefine((value, ctx) => {
|
|
73
|
+
if (value.verdict !== DecisionVerdict.REJECT) return;
|
|
74
|
+
const trimmed = value.reason?.trim() ?? '';
|
|
75
|
+
if (trimmed.length === 0) {
|
|
76
|
+
ctx.addIssue({
|
|
77
|
+
code: 'custom',
|
|
78
|
+
path: ['reason'],
|
|
79
|
+
message: 'reason is required and must be non-empty when verdict is reject',
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
export type DecisionGateReply = z.infer<typeof DecisionGateReplySchema>;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* One row in the decision trail — used for audit and to render "alice
|
|
87
|
+
* approved 12:34:56, bob rejected 12:35:10, oracle-agent abstained" in
|
|
88
|
+
* the FE focused-page detail view.
|
|
89
|
+
*/
|
|
90
|
+
export const DecisionRecordSchema = z.object({
|
|
91
|
+
recipientId: z.string().min(1),
|
|
92
|
+
verdict: z.nativeEnum(DecisionVerdict),
|
|
93
|
+
reason: z.string().nullable(),
|
|
94
|
+
submittedBy: z.string().min(1),
|
|
95
|
+
submittedAtIso: z.string(),
|
|
96
|
+
});
|
|
97
|
+
export type DecisionRecord = z.infer<typeof DecisionRecordSchema>;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Aggregated verdict the gate workflow returns to its parent. Downstream
|
|
101
|
+
* consumers (`publish-kb`, KB ingest, audit) read `approvedArtifacts` —
|
|
102
|
+
* NOT `Math.max(version)` — for the bytes to publish.
|
|
103
|
+
*
|
|
104
|
+
* `approvedArtifacts` is non-empty iff `outcome` is APPROVED /
|
|
105
|
+
* EXPIRED_APPROVED. On REJECTED / EXPIRED_REJECTED / CANCELLED, the array
|
|
106
|
+
* is empty by construction (consumers must not run).
|
|
107
|
+
*/
|
|
108
|
+
export const DecisionGateVerdictSchema = z.object({
|
|
109
|
+
outcome: z.nativeEnum(DecisionGateOutcome),
|
|
110
|
+
approvedArtifacts: z.array(PinnedSubjectArtifactSchema),
|
|
111
|
+
decisionTrail: z.array(DecisionRecordSchema),
|
|
112
|
+
});
|
|
113
|
+
export type DecisionGateVerdict = z.infer<typeof DecisionGateVerdictSchema>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pinned reference to a single artifact version. Stored on the inquiry's
|
|
5
|
+
* `prompt.subjectArtifacts` for `kind=DECISION_GATE` and propagated through
|
|
6
|
+
* the decision-gate verdict so downstream consumers (e.g. `publish-kb`,
|
|
7
|
+
* KB ingest, audit) resolve "the bytes the deciders approved" — not
|
|
8
|
+
* "whatever happens to be latest at publish time."
|
|
9
|
+
*
|
|
10
|
+
* The four-tuple `(artifactId, versionId, version, hash)` is the result
|
|
11
|
+
* of `flattenSubjectArtifacts` over upstream `deliverables[]` at the
|
|
12
|
+
* moment the gate workflow registers the inquiry. Once written, it is
|
|
13
|
+
* frozen for the lifetime of the inquiry.
|
|
14
|
+
*
|
|
15
|
+
* Canonical home for this type. Predecessor refactors (artifact-identity
|
|
16
|
+
* PR1-PR3) inlined it inside the human-approval workflow file because the
|
|
17
|
+
* workflow VM cannot run Zod; this package keeps the type importable as
|
|
18
|
+
* `import type` from the workflow file while the engine validates it via
|
|
19
|
+
* Zod at the controller boundary.
|
|
20
|
+
*/
|
|
21
|
+
export const PinnedSubjectArtifactSchema = z.object({
|
|
22
|
+
artifactId: z.string().min(1),
|
|
23
|
+
versionId: z.string().min(1),
|
|
24
|
+
version: z.number().int().positive(),
|
|
25
|
+
hash: z.string().min(1),
|
|
26
|
+
});
|
|
27
|
+
export type PinnedSubjectArtifact = z.infer<
|
|
28
|
+
typeof PinnedSubjectArtifactSchema
|
|
29
|
+
>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
+
// @xemahq/document-patch-contracts — Kernel layer
|
|
3
|
+
//
|
|
4
|
+
// Wire contracts for the per-hunk edits to a knowledge-base document page.
|
|
5
|
+
//
|
|
6
|
+
// Pending patches are NOT authored by the agent. They are platform-derived:
|
|
7
|
+
// `document-sync` diffs the agent's working file against the accepted base
|
|
8
|
+
// and re-derives the page's `PendingPatch` rows as contiguous line-range
|
|
9
|
+
// hunks. Used by:
|
|
10
|
+
// - knowledge-base-api's pending-patches endpoints (DTO shapes)
|
|
11
|
+
// - the frontend hunk-decoration UI (type-only)
|
|
12
|
+
//
|
|
13
|
+
// Per-hunk accept/reject is the central UX primitive: the user can take any
|
|
14
|
+
// subset of the agent's changes. To make that safe against concurrent user
|
|
15
|
+
// edits, every hunk carries the base version it was computed against and a
|
|
16
|
+
// line-range `anchor` describing WHERE it applies. The accept endpoint
|
|
17
|
+
// refuses the apply if the surrounding text shifted out from under the
|
|
18
|
+
// anchor (`PendingPatchStatus.STALE`), so silent drift is impossible.
|
|
19
|
+
//
|
|
20
|
+
// Pure types + Zod. Zero runtime adapter knowledge.
|
|
21
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
22
|
+
|
|
23
|
+
export * from './lib/patch-enums';
|
|
24
|
+
export * from './lib/patch-anchor';
|
|
25
|
+
export * from './lib/pending-patch';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Where a pending patch applies in the document: a 1-based inclusive
|
|
5
|
+
* line range in BASE. Pending patches are platform-derived by diffing
|
|
6
|
+
* the agent's working file against the accepted base — every hunk is a
|
|
7
|
+
* contiguous line range, so this is the only anchor shape.
|
|
8
|
+
*
|
|
9
|
+
* `endLine === startLine - 1` is the canonical encoding for a
|
|
10
|
+
* pure-insertion-before-line patch (zero-length range positioned just
|
|
11
|
+
* before `startLine`).
|
|
12
|
+
*/
|
|
13
|
+
export const LineRangeAnchorSchema = z
|
|
14
|
+
.object({
|
|
15
|
+
startLine: z.number().int().min(1),
|
|
16
|
+
endLine: z.number().int().min(0),
|
|
17
|
+
})
|
|
18
|
+
.refine((v) => v.endLine >= v.startLine - 1, {
|
|
19
|
+
message: 'LineRangeAnchor requires endLine >= startLine - 1',
|
|
20
|
+
path: ['endLine'],
|
|
21
|
+
});
|
|
22
|
+
export type LineRangeAnchor = z.infer<typeof LineRangeAnchorSchema>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Closed enums for the patch protocol. Real TS enums (not string-literal
|
|
3
|
+
* unions) so OpenAPI/Orval emit stable enum schemas — see
|
|
4
|
+
* `docs/API_STANDARDS.md` and.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Where this pending patch came from.
|
|
9
|
+
*
|
|
10
|
+
* - AGENT_SESSION — derived from an interactive Document Buddy
|
|
11
|
+
* session's working-file edits (document-sync).
|
|
12
|
+
* - WORKFLOW_REVIEW — a workflow activity proposing edits on the user's
|
|
13
|
+
* behalf.
|
|
14
|
+
*/
|
|
15
|
+
export enum PatchOrigin {
|
|
16
|
+
AGENT_SESSION = 'AGENT_SESSION',
|
|
17
|
+
WORKFLOW_REVIEW = 'WORKFLOW_REVIEW',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Lifecycle status for a single PendingPatch row.
|
|
22
|
+
*
|
|
23
|
+
* - PENDING — awaiting a user decision.
|
|
24
|
+
* - ACCEPTED — applied to the page (terminal).
|
|
25
|
+
* - REJECTED — discarded by the user (terminal).
|
|
26
|
+
* - STALE — the document moved out from under the patch's anchor
|
|
27
|
+
* before a decision was made; the user must re-propose or
|
|
28
|
+
* discard. Set fail-fast by the accept endpoint when the
|
|
29
|
+
* anchor no longer matches current content.
|
|
30
|
+
*/
|
|
31
|
+
export enum PendingPatchStatus {
|
|
32
|
+
PENDING = 'PENDING',
|
|
33
|
+
ACCEPTED = 'ACCEPTED',
|
|
34
|
+
REJECTED = 'REJECTED',
|
|
35
|
+
STALE = 'STALE',
|
|
36
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PatchOrigin, PendingPatchStatus } from './patch-enums';
|
|
2
|
+
|
|
3
|
+
import type { LineRangeAnchor } from './patch-anchor';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Wire shape of a single PendingPatch row as returned by the
|
|
7
|
+
* knowledge-base-api list/get endpoints and broadcast over the KB
|
|
8
|
+
* realtime SSE stream. Pure type — no runtime validation needed because
|
|
9
|
+
* the producer is trusted server code.
|
|
10
|
+
*/
|
|
11
|
+
export interface PendingPatchDto {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly pageId: string;
|
|
14
|
+
readonly proposalId: string;
|
|
15
|
+
readonly sequence: number;
|
|
16
|
+
readonly origin: PatchOrigin;
|
|
17
|
+
readonly sessionId: string | null;
|
|
18
|
+
readonly workflowJobRunId: string | null;
|
|
19
|
+
readonly baseVersion: number;
|
|
20
|
+
readonly anchor: LineRangeAnchor;
|
|
21
|
+
readonly before: string;
|
|
22
|
+
readonly after: string;
|
|
23
|
+
readonly label: string | null;
|
|
24
|
+
readonly rationale: string | null;
|
|
25
|
+
readonly status: PendingPatchStatus;
|
|
26
|
+
readonly decidedBy: string | null;
|
|
27
|
+
/** ISO-8601 timestamp; null until terminal. */
|
|
28
|
+
readonly decidedAt: string | null;
|
|
29
|
+
/** ISO-8601 timestamp. */
|
|
30
|
+
readonly createdAt: string;
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
+
// @xemahq/output-contracts — Layer 1 / Kernel
|
|
3
|
+
//
|
|
4
|
+
// Wire shapes for the run-detail Outputs panel and the per-kind renderer
|
|
5
|
+
// registry. The legacy
|
|
6
|
+
// JSON-dumping ArtifactContentViewer / OutputPreview pair are replaced by
|
|
7
|
+
// a CLOSED-enum renderer registry. ESLint enforces that every OutputKind
|
|
8
|
+
// value has a registered renderer (xema-fe/output-renderer-coverage).
|
|
9
|
+
//
|
|
10
|
+
// The user reviews deliverables on the canvas — they NEVER see raw JSON
|
|
11
|
+
// unless they click "Show raw". Adding a new output kind is a deliberate
|
|
12
|
+
// extension: enum value → contract type → renderer. No heuristic fallback.
|
|
13
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
14
|
+
|
|
15
|
+
export * from './lib/output-kind';
|
|
16
|
+
export * from './lib/output-render-hint';
|
|
17
|
+
export * from './lib/output-deliverable-expectation';
|
|
18
|
+
export * from './lib/output-version-dto';
|
|
19
|
+
export * from './lib/output-item-dto';
|
|
20
|
+
export * from './lib/payload-schemas';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { OutputKind } from './output-kind';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What the workflow EXPECTED to produce at this slot, derived from the
|
|
5
|
+
* deliverable spec. Compared against {@link OutputItemDto} to detect
|
|
6
|
+
* missing or unexpected outputs in the Overview "Latest deliverables"
|
|
7
|
+
* strip.
|
|
8
|
+
*
|
|
9
|
+
* The engine emits one expectation per declared deliverable slot at
|
|
10
|
+
* dispatch time. A run with `produced.length < expectations.length`
|
|
11
|
+
* is incomplete; the FE renders missing slots as placeholder cards
|
|
12
|
+
* with the expectation summary.
|
|
13
|
+
*/
|
|
14
|
+
export interface OutputDeliverableExpectation {
|
|
15
|
+
readonly slug: string;
|
|
16
|
+
readonly displayName: string;
|
|
17
|
+
readonly expectedKind: OutputKind;
|
|
18
|
+
/** Phase that's responsible for producing this slot. */
|
|
19
|
+
readonly stageKey: string;
|
|
20
|
+
/**
|
|
21
|
+
* Whether this deliverable is required for the run to succeed. When
|
|
22
|
+
* `false`, the FE renders a missing slot in muted styling.
|
|
23
|
+
*/
|
|
24
|
+
readonly required: boolean;
|
|
25
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { OutputKind } from './output-kind';
|
|
2
|
+
import { OutputRenderHint } from './output-render-hint';
|
|
3
|
+
import { OutputVersionDto } from './output-version-dto';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* One card in the run-detail Outputs panel.
|
|
7
|
+
*
|
|
8
|
+
* The CARD is the deliverable while reviewing: the user reads the
|
|
9
|
+
* rendered content
|
|
10
|
+
* directly, not a JSON dump. `contentRef` points at the lazy-loaded
|
|
11
|
+
* payload the kind-specific renderer fetches; `summary` is the
|
|
12
|
+
* always-loaded one-line preview shown collapsed.
|
|
13
|
+
*
|
|
14
|
+
* `kbPublishedAt` is set when the artifact-store has linked this
|
|
15
|
+
* output to a `KB_PAGE` link refType. The FE renders an "Open in
|
|
16
|
+
* Knowledge Base" affordance when present.
|
|
17
|
+
*/
|
|
18
|
+
export interface OutputItemDto {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly kind: OutputKind;
|
|
21
|
+
readonly title: string;
|
|
22
|
+
/** One-line collapsed-state preview. Always rendered; never JSON. */
|
|
23
|
+
readonly summary: string;
|
|
24
|
+
/** Phase that produced this output. */
|
|
25
|
+
readonly stageKey: string;
|
|
26
|
+
readonly renderHint: OutputRenderHint;
|
|
27
|
+
/** Versions in descending order; first row is current. */
|
|
28
|
+
readonly versions: readonly OutputVersionDto[];
|
|
29
|
+
/** Lazy-load handle the renderer dereferences. Format is renderer-specific. */
|
|
30
|
+
readonly contentRef: OutputContentRef;
|
|
31
|
+
/** ISO-8601 when the latest version was emitted. */
|
|
32
|
+
readonly latestEmittedAt: string;
|
|
33
|
+
/** ISO-8601 when published to the KB; `null` when not yet (or never to be) published. */
|
|
34
|
+
readonly kbPublishedAt: string | null;
|
|
35
|
+
/** Direct deep-link to the KB page; `null` when not yet published. */
|
|
36
|
+
readonly kbPageUrl: string | null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A renderer-agnostic handle the FE dereferences when the user expands
|
|
41
|
+
* a card. Renderers narrow on `kind` to know which flavor of resolver
|
|
42
|
+
* to invoke — there are exactly two flavors:
|
|
43
|
+
*
|
|
44
|
+
* - INLINE — the payload is small enough to ship in the list response
|
|
45
|
+
* and is already inlined (`payload`). Renderer reads directly.
|
|
46
|
+
* - REMOTE — the payload requires a separate fetch (`url`). Renderer
|
|
47
|
+
* queries `useOutputContent({ url })`.
|
|
48
|
+
*
|
|
49
|
+
* Producers MUST pick one. Renderers MUST handle both (the registry
|
|
50
|
+
* provides this glue once per kind, not per renderer).
|
|
51
|
+
*/
|
|
52
|
+
export type OutputContentRef =
|
|
53
|
+
| { readonly kind: 'inline'; readonly payload: unknown }
|
|
54
|
+
| { readonly kind: 'remote'; readonly url: string; readonly contentType: string };
|