@contractspec/example.kb-update-pipeline 1.44.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/.turbo/turbo-build$colon$bundle.log +55 -0
- package/.turbo/turbo-build.log +56 -0
- package/CHANGELOG.md +195 -0
- package/LICENSE +21 -0
- package/README.md +28 -0
- package/dist/docs/index.d.ts +1 -0
- package/dist/docs/index.js +1 -0
- package/dist/docs/kb-update-pipeline.docblock.d.ts +1 -0
- package/dist/docs/kb-update-pipeline.docblock.js +31 -0
- package/dist/docs/kb-update-pipeline.docblock.js.map +1 -0
- package/dist/entities/index.d.ts +2 -0
- package/dist/entities/index.js +3 -0
- package/dist/entities/models.d.ts +61 -0
- package/dist/entities/models.d.ts.map +1 -0
- package/dist/entities/models.js +74 -0
- package/dist/entities/models.js.map +1 -0
- package/dist/events.d.ts +74 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +150 -0
- package/dist/events.js.map +1 -0
- package/dist/example.d.ts +36 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +43 -0
- package/dist/example.js.map +1 -0
- package/dist/feature.d.ts +7 -0
- package/dist/feature.d.ts.map +1 -0
- package/dist/feature.js +80 -0
- package/dist/feature.js.map +1 -0
- package/dist/handlers/index.d.ts +2 -0
- package/dist/handlers/index.js +3 -0
- package/dist/handlers/memory.handlers.d.ts +68 -0
- package/dist/handlers/memory.handlers.d.ts.map +1 -0
- package/dist/handlers/memory.handlers.js +93 -0
- package/dist/handlers/memory.handlers.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +12 -0
- package/dist/kb-update-pipeline.feature.d.ts +7 -0
- package/dist/kb-update-pipeline.feature.d.ts.map +1 -0
- package/dist/kb-update-pipeline.feature.js +140 -0
- package/dist/kb-update-pipeline.feature.js.map +1 -0
- package/dist/operations/index.d.ts +2 -0
- package/dist/operations/index.js +3 -0
- package/dist/operations/pipeline.d.ts +137 -0
- package/dist/operations/pipeline.d.ts.map +1 -0
- package/dist/operations/pipeline.js +183 -0
- package/dist/operations/pipeline.js.map +1 -0
- package/dist/presentations.d.ts +9 -0
- package/dist/presentations.d.ts.map +1 -0
- package/dist/presentations.js +71 -0
- package/dist/presentations.js.map +1 -0
- package/example.ts +1 -0
- package/package.json +79 -0
- package/src/docs/index.ts +1 -0
- package/src/docs/kb-update-pipeline.docblock.ts +30 -0
- package/src/entities/index.ts +1 -0
- package/src/entities/models.ts +53 -0
- package/src/events.ts +134 -0
- package/src/example.ts +27 -0
- package/src/feature.ts +38 -0
- package/src/handlers/index.ts +1 -0
- package/src/handlers/memory.handlers.test.ts +81 -0
- package/src/handlers/memory.handlers.ts +186 -0
- package/src/index.ts +15 -0
- package/src/kb-update-pipeline.feature.ts +59 -0
- package/src/operations/index.ts +1 -0
- package/src/operations/pipeline.ts +159 -0
- package/src/presentations.ts +69 -0
- package/tsconfig.json +19 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/tsdown.config.js +17 -0
package/dist/events.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { StabilityEnum, defineEvent, defineSchemaModel } from "@contractspec/lib.contracts";
|
|
2
|
+
import { ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
3
|
+
|
|
4
|
+
//#region src/events.ts
|
|
5
|
+
const KbChangeDetectedPayload = defineSchemaModel({
|
|
6
|
+
name: "KbChangeDetectedPayload",
|
|
7
|
+
description: "Emitted when a source change is detected.",
|
|
8
|
+
fields: {
|
|
9
|
+
changeCandidateId: {
|
|
10
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
11
|
+
isOptional: false
|
|
12
|
+
},
|
|
13
|
+
sourceDocumentId: {
|
|
14
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
15
|
+
isOptional: false
|
|
16
|
+
},
|
|
17
|
+
riskLevel: {
|
|
18
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
19
|
+
isOptional: false
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const KbChangeDetectedEvent = defineEvent({
|
|
24
|
+
meta: {
|
|
25
|
+
key: "kb.change.detected",
|
|
26
|
+
version: 1,
|
|
27
|
+
description: "KB source change detected.",
|
|
28
|
+
stability: StabilityEnum.Experimental,
|
|
29
|
+
owners: [],
|
|
30
|
+
tags: []
|
|
31
|
+
},
|
|
32
|
+
payload: KbChangeDetectedPayload
|
|
33
|
+
});
|
|
34
|
+
const KbChangeSummarizedPayload = defineSchemaModel({
|
|
35
|
+
name: "KbChangeSummarizedPayload",
|
|
36
|
+
description: "Emitted when a change summary is produced.",
|
|
37
|
+
fields: {
|
|
38
|
+
changeCandidateId: {
|
|
39
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
40
|
+
isOptional: false
|
|
41
|
+
},
|
|
42
|
+
summary: {
|
|
43
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
44
|
+
isOptional: false
|
|
45
|
+
},
|
|
46
|
+
riskLevel: {
|
|
47
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
48
|
+
isOptional: false
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
const KbChangeSummarizedEvent = defineEvent({
|
|
53
|
+
meta: {
|
|
54
|
+
key: "kb.change.summarized",
|
|
55
|
+
version: 1,
|
|
56
|
+
description: "KB change summarized.",
|
|
57
|
+
stability: StabilityEnum.Experimental,
|
|
58
|
+
owners: [],
|
|
59
|
+
tags: []
|
|
60
|
+
},
|
|
61
|
+
payload: KbChangeSummarizedPayload
|
|
62
|
+
});
|
|
63
|
+
const KbPatchProposedPayload = defineSchemaModel({
|
|
64
|
+
name: "KbPatchProposedPayload",
|
|
65
|
+
description: "Emitted when draft rule patches are proposed.",
|
|
66
|
+
fields: {
|
|
67
|
+
changeCandidateId: {
|
|
68
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
69
|
+
isOptional: false
|
|
70
|
+
},
|
|
71
|
+
proposedRuleVersionIds: {
|
|
72
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
73
|
+
isArray: true,
|
|
74
|
+
isOptional: false
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
const KbPatchProposedEvent = defineEvent({
|
|
79
|
+
meta: {
|
|
80
|
+
key: "kb.patch.proposed",
|
|
81
|
+
version: 1,
|
|
82
|
+
description: "KB rule patch proposed (draft versions created).",
|
|
83
|
+
stability: StabilityEnum.Experimental,
|
|
84
|
+
owners: [],
|
|
85
|
+
tags: []
|
|
86
|
+
},
|
|
87
|
+
payload: KbPatchProposedPayload
|
|
88
|
+
});
|
|
89
|
+
const KbReviewRequestedPayload = defineSchemaModel({
|
|
90
|
+
name: "KbReviewRequestedPayload",
|
|
91
|
+
description: "Emitted when a review is requested.",
|
|
92
|
+
fields: {
|
|
93
|
+
reviewTaskId: {
|
|
94
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
95
|
+
isOptional: false
|
|
96
|
+
},
|
|
97
|
+
changeCandidateId: {
|
|
98
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
99
|
+
isOptional: false
|
|
100
|
+
},
|
|
101
|
+
assignedRole: {
|
|
102
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
103
|
+
isOptional: false
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
const KbReviewRequestedEvent = defineEvent({
|
|
108
|
+
meta: {
|
|
109
|
+
key: "kb.review.requested",
|
|
110
|
+
version: 1,
|
|
111
|
+
description: "KB review requested.",
|
|
112
|
+
stability: StabilityEnum.Experimental,
|
|
113
|
+
owners: [],
|
|
114
|
+
tags: []
|
|
115
|
+
},
|
|
116
|
+
payload: KbReviewRequestedPayload
|
|
117
|
+
});
|
|
118
|
+
const KbReviewDecidedPayload = defineSchemaModel({
|
|
119
|
+
name: "KbReviewDecidedPayload",
|
|
120
|
+
description: "Emitted when a review task is decided.",
|
|
121
|
+
fields: {
|
|
122
|
+
reviewTaskId: {
|
|
123
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
124
|
+
isOptional: false
|
|
125
|
+
},
|
|
126
|
+
decision: {
|
|
127
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
128
|
+
isOptional: false
|
|
129
|
+
},
|
|
130
|
+
decidedBy: {
|
|
131
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
132
|
+
isOptional: false
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
const KbReviewDecidedEvent = defineEvent({
|
|
137
|
+
meta: {
|
|
138
|
+
key: "kb.review.decided",
|
|
139
|
+
version: 1,
|
|
140
|
+
description: "KB review decided.",
|
|
141
|
+
stability: StabilityEnum.Experimental,
|
|
142
|
+
owners: [],
|
|
143
|
+
tags: []
|
|
144
|
+
},
|
|
145
|
+
payload: KbReviewDecidedPayload
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
//#endregion
|
|
149
|
+
export { KbChangeDetectedEvent, KbChangeSummarizedEvent, KbPatchProposedEvent, KbReviewDecidedEvent, KbReviewRequestedEvent };
|
|
150
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","names":[],"sources":["../src/events.ts"],"sourcesContent":["import {\n defineEvent,\n defineSchemaModel,\n StabilityEnum,\n} from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum } from '@contractspec/lib.schema';\n\nconst KbChangeDetectedPayload = defineSchemaModel({\n name: 'KbChangeDetectedPayload',\n description: 'Emitted when a source change is detected.',\n fields: {\n changeCandidateId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n sourceDocumentId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n riskLevel: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nexport const KbChangeDetectedEvent = defineEvent({\n meta: {\n key: 'kb.change.detected',\n version: 1,\n description: 'KB source change detected.',\n stability: StabilityEnum.Experimental,\n owners: [],\n tags: [],\n },\n payload: KbChangeDetectedPayload,\n});\n\nconst KbChangeSummarizedPayload = defineSchemaModel({\n name: 'KbChangeSummarizedPayload',\n description: 'Emitted when a change summary is produced.',\n fields: {\n changeCandidateId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n summary: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n riskLevel: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nexport const KbChangeSummarizedEvent = defineEvent({\n meta: {\n key: 'kb.change.summarized',\n version: 1,\n description: 'KB change summarized.',\n stability: StabilityEnum.Experimental,\n owners: [],\n tags: [],\n },\n payload: KbChangeSummarizedPayload,\n});\n\nconst KbPatchProposedPayload = defineSchemaModel({\n name: 'KbPatchProposedPayload',\n description: 'Emitted when draft rule patches are proposed.',\n fields: {\n changeCandidateId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n proposedRuleVersionIds: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: false,\n },\n },\n});\n\nexport const KbPatchProposedEvent = defineEvent({\n meta: {\n key: 'kb.patch.proposed',\n version: 1,\n description: 'KB rule patch proposed (draft versions created).',\n stability: StabilityEnum.Experimental,\n owners: [],\n tags: [],\n },\n payload: KbPatchProposedPayload,\n});\n\nconst KbReviewRequestedPayload = defineSchemaModel({\n name: 'KbReviewRequestedPayload',\n description: 'Emitted when a review is requested.',\n fields: {\n reviewTaskId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n changeCandidateId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n assignedRole: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nexport const KbReviewRequestedEvent = defineEvent({\n meta: {\n key: 'kb.review.requested',\n version: 1,\n description: 'KB review requested.',\n stability: StabilityEnum.Experimental,\n owners: [],\n tags: [],\n },\n payload: KbReviewRequestedPayload,\n});\n\nconst KbReviewDecidedPayload = defineSchemaModel({\n name: 'KbReviewDecidedPayload',\n description: 'Emitted when a review task is decided.',\n fields: {\n reviewTaskId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n decision: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n decidedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nexport const KbReviewDecidedEvent = defineEvent({\n meta: {\n key: 'kb.review.decided',\n version: 1,\n description: 'KB review decided.',\n stability: StabilityEnum.Experimental,\n owners: [],\n tags: [],\n },\n payload: KbReviewDecidedPayload,\n});\n"],"mappings":";;;;AAOA,MAAM,0BAA0B,kBAAkB;CAChD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,mBAAmB;GACjB,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,kBAAkB;GAChB,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACzE;CACF,CAAC;AAEF,MAAa,wBAAwB,YAAY;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW,cAAc;EACzB,QAAQ,EAAE;EACV,MAAM,EAAE;EACT;CACD,SAAS;CACV,CAAC;AAEF,MAAM,4BAA4B,kBAAkB;CAClD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,mBAAmB;GACjB,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACzE;CACF,CAAC;AAEF,MAAa,0BAA0B,YAAY;CACjD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW,cAAc;EACzB,QAAQ,EAAE;EACV,MAAM,EAAE;EACT;CACD,SAAS;CACV,CAAC;AAEF,MAAM,yBAAyB,kBAAkB;CAC/C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,mBAAmB;GACjB,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,wBAAwB;GACtB,MAAM,eAAe,iBAAiB;GACtC,SAAS;GACT,YAAY;GACb;EACF;CACF,CAAC;AAEF,MAAa,uBAAuB,YAAY;CAC9C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW,cAAc;EACzB,QAAQ,EAAE;EACV,MAAM,EAAE;EACT;CACD,SAAS;CACV,CAAC;AAEF,MAAM,2BAA2B,kBAAkB;CACjD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,mBAAmB;GACjB,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC5E;CACF,CAAC;AAEF,MAAa,yBAAyB,YAAY;CAChD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW,cAAc;EACzB,QAAQ,EAAE;EACV,MAAM,EAAE;EACT;CACD,SAAS;CACV,CAAC;AAEF,MAAM,yBAAyB,kBAAkB;CAC/C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACzE;CACF,CAAC;AAEF,MAAa,uBAAuB,YAAY;CAC9C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW,cAAc;EACzB,QAAQ,EAAE;EACV,MAAM,EAAE;EACT;CACD,SAAS;CACV,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/example.d.ts
|
|
2
|
+
declare const example: {
|
|
3
|
+
readonly id: "kb-update-pipeline";
|
|
4
|
+
readonly title: "KB Update Pipeline";
|
|
5
|
+
readonly summary: "Automation proposes KB updates; humans verify; everything audited and notified.";
|
|
6
|
+
readonly tags: readonly ["knowledge", "pipeline", "hitl", "audit"];
|
|
7
|
+
readonly kind: "knowledge";
|
|
8
|
+
readonly visibility: "public";
|
|
9
|
+
readonly docs: {
|
|
10
|
+
readonly rootDocId: "docs.examples.kb-update-pipeline";
|
|
11
|
+
};
|
|
12
|
+
readonly entrypoints: {
|
|
13
|
+
readonly packageName: "@contractspec/example.kb-update-pipeline";
|
|
14
|
+
readonly feature: "./feature";
|
|
15
|
+
readonly contracts: "./contracts";
|
|
16
|
+
readonly handlers: "./handlers";
|
|
17
|
+
readonly docs: "./docs";
|
|
18
|
+
};
|
|
19
|
+
readonly surfaces: {
|
|
20
|
+
readonly templates: true;
|
|
21
|
+
readonly sandbox: {
|
|
22
|
+
readonly enabled: true;
|
|
23
|
+
readonly modes: readonly ["markdown", "specs", "builder"];
|
|
24
|
+
};
|
|
25
|
+
readonly studio: {
|
|
26
|
+
readonly enabled: true;
|
|
27
|
+
readonly installable: true;
|
|
28
|
+
};
|
|
29
|
+
readonly mcp: {
|
|
30
|
+
readonly enabled: true;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { example as default };
|
|
36
|
+
//# sourceMappingURL=example.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";cAAM;EAAA,SAAA,EAwBI,EAAA,oBAAA"}
|
package/dist/example.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region src/example.ts
|
|
2
|
+
const example = {
|
|
3
|
+
id: "kb-update-pipeline",
|
|
4
|
+
title: "KB Update Pipeline",
|
|
5
|
+
summary: "Automation proposes KB updates; humans verify; everything audited and notified.",
|
|
6
|
+
tags: [
|
|
7
|
+
"knowledge",
|
|
8
|
+
"pipeline",
|
|
9
|
+
"hitl",
|
|
10
|
+
"audit"
|
|
11
|
+
],
|
|
12
|
+
kind: "knowledge",
|
|
13
|
+
visibility: "public",
|
|
14
|
+
docs: { rootDocId: "docs.examples.kb-update-pipeline" },
|
|
15
|
+
entrypoints: {
|
|
16
|
+
packageName: "@contractspec/example.kb-update-pipeline",
|
|
17
|
+
feature: "./feature",
|
|
18
|
+
contracts: "./contracts",
|
|
19
|
+
handlers: "./handlers",
|
|
20
|
+
docs: "./docs"
|
|
21
|
+
},
|
|
22
|
+
surfaces: {
|
|
23
|
+
templates: true,
|
|
24
|
+
sandbox: {
|
|
25
|
+
enabled: true,
|
|
26
|
+
modes: [
|
|
27
|
+
"markdown",
|
|
28
|
+
"specs",
|
|
29
|
+
"builder"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
studio: {
|
|
33
|
+
enabled: true,
|
|
34
|
+
installable: true
|
|
35
|
+
},
|
|
36
|
+
mcp: { enabled: true }
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var example_default = example;
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { example_default as default };
|
|
43
|
+
//# sourceMappingURL=example.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["const example = {\n id: 'kb-update-pipeline',\n title: 'KB Update Pipeline',\n summary:\n 'Automation proposes KB updates; humans verify; everything audited and notified.',\n tags: ['knowledge', 'pipeline', 'hitl', 'audit'],\n kind: 'knowledge',\n visibility: 'public',\n docs: {\n rootDocId: 'docs.examples.kb-update-pipeline',\n },\n entrypoints: {\n packageName: '@contractspec/example.kb-update-pipeline',\n feature: './feature',\n contracts: './contracts',\n handlers: './handlers',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: { enabled: true, modes: ['markdown', 'specs', 'builder'] },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n} as const;\n\nexport default example;\n"],"mappings":";AAAA,MAAM,UAAU;CACd,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;EAAC;EAAa;EAAY;EAAQ;EAAQ;CAChD,MAAM;CACN,YAAY;CACZ,MAAM,EACJ,WAAW,oCACZ;CACD,aAAa;EACX,aAAa;EACb,SAAS;EACT,WAAW;EACX,UAAU;EACV,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GAAE,SAAS;GAAM,OAAO;IAAC;IAAY;IAAS;IAAU;GAAE;EACnE,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF;AAED,sBAAe"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.d.ts","names":[],"sources":["../src/feature.ts"],"sourcesContent":[],"mappings":";;;cAEa,yBAAyB"}
|
package/dist/feature.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
//#region src/feature.ts
|
|
2
|
+
const KbUpdatePipelineFeature = {
|
|
3
|
+
meta: {
|
|
4
|
+
key: "kb-update-pipeline",
|
|
5
|
+
version: 1,
|
|
6
|
+
title: "KB Update Pipeline (HITL)",
|
|
7
|
+
description: "Automation proposes KB patches; humans verify; publishing is blocked until approvals are complete.",
|
|
8
|
+
domain: "knowledge",
|
|
9
|
+
owners: ["@examples"],
|
|
10
|
+
tags: [
|
|
11
|
+
"knowledge",
|
|
12
|
+
"pipeline",
|
|
13
|
+
"hitl",
|
|
14
|
+
"audit",
|
|
15
|
+
"notifications"
|
|
16
|
+
],
|
|
17
|
+
stability: "experimental"
|
|
18
|
+
},
|
|
19
|
+
operations: [
|
|
20
|
+
{
|
|
21
|
+
key: "kbPipeline.runWatch",
|
|
22
|
+
version: 1
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
key: "kbPipeline.createReviewTask",
|
|
26
|
+
version: 1
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
key: "kbPipeline.submitDecision",
|
|
30
|
+
version: 1
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
key: "kbPipeline.publishIfReady",
|
|
34
|
+
version: 1
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
events: [
|
|
38
|
+
{
|
|
39
|
+
key: "kb.change.detected",
|
|
40
|
+
version: 1
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
key: "kb.change.summarized",
|
|
44
|
+
version: 1
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
key: "kb.patch.proposed",
|
|
48
|
+
version: 1
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
key: "kb.review.requested",
|
|
52
|
+
version: 1
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
key: "kb.review.decided",
|
|
56
|
+
version: 1
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
presentations: [],
|
|
60
|
+
opToPresentation: [],
|
|
61
|
+
presentationsTargets: [],
|
|
62
|
+
capabilities: { requires: [
|
|
63
|
+
{
|
|
64
|
+
key: "identity",
|
|
65
|
+
version: 1
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
key: "notifications",
|
|
69
|
+
version: 1
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
key: "audit-trail",
|
|
73
|
+
version: 1
|
|
74
|
+
}
|
|
75
|
+
] }
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
export { KbUpdatePipelineFeature };
|
|
80
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.js","names":["KbUpdatePipelineFeature: FeatureModuleSpec"],"sources":["../src/feature.ts"],"sourcesContent":["import type { FeatureModuleSpec } from '@contractspec/lib.contracts';\n\nexport const KbUpdatePipelineFeature: FeatureModuleSpec = {\n meta: {\n key: 'kb-update-pipeline',\n version: 1,\n title: 'KB Update Pipeline (HITL)',\n description:\n 'Automation proposes KB patches; humans verify; publishing is blocked until approvals are complete.',\n domain: 'knowledge',\n owners: ['@examples'],\n tags: ['knowledge', 'pipeline', 'hitl', 'audit', 'notifications'],\n stability: 'experimental',\n },\n operations: [\n { key: 'kbPipeline.runWatch', version: 1 },\n { key: 'kbPipeline.createReviewTask', version: 1 },\n { key: 'kbPipeline.submitDecision', version: 1 },\n { key: 'kbPipeline.publishIfReady', version: 1 },\n ],\n events: [\n { key: 'kb.change.detected', version: 1 },\n { key: 'kb.change.summarized', version: 1 },\n { key: 'kb.patch.proposed', version: 1 },\n { key: 'kb.review.requested', version: 1 },\n { key: 'kb.review.decided', version: 1 },\n ],\n presentations: [],\n opToPresentation: [],\n presentationsTargets: [],\n capabilities: {\n requires: [\n { key: 'identity', version: 1 },\n { key: 'notifications', version: 1 },\n { key: 'audit-trail', version: 1 },\n ],\n },\n};\n"],"mappings":";AAEA,MAAaA,0BAA6C;CACxD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,QAAQ;EACR,QAAQ,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAY;GAAQ;GAAS;GAAgB;EACjE,WAAW;EACZ;CACD,YAAY;EACV;GAAE,KAAK;GAAuB,SAAS;GAAG;EAC1C;GAAE,KAAK;GAA+B,SAAS;GAAG;EAClD;GAAE,KAAK;GAA6B,SAAS;GAAG;EAChD;GAAE,KAAK;GAA6B,SAAS;GAAG;EACjD;CACD,QAAQ;EACN;GAAE,KAAK;GAAsB,SAAS;GAAG;EACzC;GAAE,KAAK;GAAwB,SAAS;GAAG;EAC3C;GAAE,KAAK;GAAqB,SAAS;GAAG;EACxC;GAAE,KAAK;GAAuB,SAAS;GAAG;EAC1C;GAAE,KAAK;GAAqB,SAAS;GAAG;EACzC;CACD,eAAe,EAAE;CACjB,kBAAkB,EAAE;CACpB,sBAAsB,EAAE;CACxB,cAAc,EACZ,UAAU;EACR;GAAE,KAAK;GAAY,SAAS;GAAG;EAC/B;GAAE,KAAK;GAAiB,SAAS;GAAG;EACpC;GAAE,KAAK;GAAe,SAAS;GAAG;EACnC,EACF;CACF"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//#region src/handlers/memory.handlers.d.ts
|
|
2
|
+
interface ChangeCandidate {
|
|
3
|
+
id: string;
|
|
4
|
+
sourceDocumentId: string;
|
|
5
|
+
detectedAt: Date;
|
|
6
|
+
diffSummary: string;
|
|
7
|
+
riskLevel: 'low' | 'medium' | 'high';
|
|
8
|
+
}
|
|
9
|
+
interface ReviewTask {
|
|
10
|
+
id: string;
|
|
11
|
+
changeCandidateId: string;
|
|
12
|
+
status: 'open' | 'decided';
|
|
13
|
+
assignedRole: 'curator' | 'expert';
|
|
14
|
+
decision?: 'approve' | 'reject';
|
|
15
|
+
decidedAt?: Date;
|
|
16
|
+
decidedBy?: string;
|
|
17
|
+
}
|
|
18
|
+
interface PipelineMemoryStore {
|
|
19
|
+
candidates: Map<string, ChangeCandidate>;
|
|
20
|
+
reviewTasks: Map<string, ReviewTask>;
|
|
21
|
+
proposedRuleVersionIdsByCandidate: Map<string, string[]>;
|
|
22
|
+
approvedRuleVersionIds: Set<string>;
|
|
23
|
+
notifications: {
|
|
24
|
+
kind: 'kb.review.requested';
|
|
25
|
+
reviewTaskId: string;
|
|
26
|
+
changeCandidateId: string;
|
|
27
|
+
assignedRole: 'curator' | 'expert';
|
|
28
|
+
createdAt: Date;
|
|
29
|
+
}[];
|
|
30
|
+
}
|
|
31
|
+
declare function createPipelineMemoryStore(): PipelineMemoryStore;
|
|
32
|
+
interface PipelineMemoryHandlers {
|
|
33
|
+
runWatch(input: {
|
|
34
|
+
jurisdiction: string;
|
|
35
|
+
}): Promise<{
|
|
36
|
+
candidates: ChangeCandidate[];
|
|
37
|
+
}>;
|
|
38
|
+
createReviewTask(input: {
|
|
39
|
+
changeCandidateId: string;
|
|
40
|
+
}): Promise<ReviewTask>;
|
|
41
|
+
proposeRulePatch(input: {
|
|
42
|
+
changeCandidateId: string;
|
|
43
|
+
proposedRuleVersionIds: string[];
|
|
44
|
+
}): Promise<{
|
|
45
|
+
proposedRuleVersionIds: string[];
|
|
46
|
+
}>;
|
|
47
|
+
markRuleVersionApproved(input: {
|
|
48
|
+
ruleVersionId: string;
|
|
49
|
+
}): Promise<{
|
|
50
|
+
ruleVersionId: string;
|
|
51
|
+
}>;
|
|
52
|
+
submitDecision(input: {
|
|
53
|
+
reviewTaskId: string;
|
|
54
|
+
decision: 'approve' | 'reject';
|
|
55
|
+
decidedBy: string;
|
|
56
|
+
decidedByRole: 'curator' | 'expert';
|
|
57
|
+
}): Promise<ReviewTask>;
|
|
58
|
+
publishIfReady(input: {
|
|
59
|
+
jurisdiction: string;
|
|
60
|
+
}): Promise<{
|
|
61
|
+
published: boolean;
|
|
62
|
+
reason?: string;
|
|
63
|
+
}>;
|
|
64
|
+
}
|
|
65
|
+
declare function createPipelineMemoryHandlers(store: PipelineMemoryStore): PipelineMemoryHandlers;
|
|
66
|
+
//#endregion
|
|
67
|
+
export { PipelineMemoryHandlers, PipelineMemoryStore, createPipelineMemoryHandlers, createPipelineMemoryStore };
|
|
68
|
+
//# sourceMappingURL=memory.handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.handlers.d.ts","names":[],"sources":["../../src/handlers/memory.handlers.ts"],"sourcesContent":[],"mappings":";UAAU,eAAA;EAAA,EAAA,EAAA,MAAA;EAQA,gBAAU,EAAA,MAAA;EAUH,UAAA,EAfH,IAeG;EACS,WAAA,EAAA,MAAA;EAAZ,SAAA,EAAA,KAAA,GAAA,QAAA,GAAA,MAAA;;UAXJ,UAAA,CAYK;EACsB,EAAA,EAAA,MAAA;EACX,iBAAA,EAAA,MAAA;EAMX,MAAA,EAAA,MAAA,GAAA,SAAA;EAAI,YAAA,EAAA,SAAA,GAAA,QAAA;EAIH,QAAA,CAAA,EAAA,SAAA,GAAA,QAAyB;EAcxB,SAAA,CAAA,EAhCH,IAgCG;EAGW,SAAA,CAAA,EAAA,MAAA;;AACsC,UAhCjD,mBAAA,CAgCiD;EAAR,UAAA,EA/B5C,GA+B4C,CAAA,MAAA,EA/BhC,eA+BgC,CAAA;EAIpD,WAAA,EAlCS,GAkCT,CAAA,MAAA,EAlCqB,UAkCrB,CAAA;EAGA,iCAAA,EApC+B,GAoC/B,CAAA,MAAA,EAAA,MAAA,EAAA,CAAA;EAMQ,sBAAA,EAzCY,GAyCZ,CAAA,MAAA,CAAA;EAAR,aAAA,EAAA;IAGA,IAAA,EAAA,qBAAA;IAAO,YAAA,EAAA,MAAA;IAGG,iBAAA,EAAA,MAAA;;eAzCD;;;iBAIC,yBAAA,CAAA,GAA6B;UAc5B,sBAAA;;;MAGX;gBAAsB;;;;MAC8B,QAAQ;;;;MAI5D;;;;;MAGA;;;;;;;;MAMA,QAAQ;;;MAGR;;;;;iBAGU,4BAAA,QACP,sBACN"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//#region src/handlers/memory.handlers.ts
|
|
2
|
+
function createPipelineMemoryStore() {
|
|
3
|
+
return {
|
|
4
|
+
candidates: /* @__PURE__ */ new Map(),
|
|
5
|
+
reviewTasks: /* @__PURE__ */ new Map(),
|
|
6
|
+
proposedRuleVersionIdsByCandidate: /* @__PURE__ */ new Map(),
|
|
7
|
+
approvedRuleVersionIds: /* @__PURE__ */ new Set(),
|
|
8
|
+
notifications: []
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function stableId(prefix, value) {
|
|
12
|
+
return `${prefix}_${value.replace(/[^a-zA-Z0-9_-]/g, "_")}`;
|
|
13
|
+
}
|
|
14
|
+
function createPipelineMemoryHandlers(store) {
|
|
15
|
+
async function runWatch(input) {
|
|
16
|
+
return { candidates: [...store.candidates.values()].filter((c) => c.sourceDocumentId.startsWith(`${input.jurisdiction}_`) || true) };
|
|
17
|
+
}
|
|
18
|
+
async function createReviewTask(input) {
|
|
19
|
+
const candidate = store.candidates.get(input.changeCandidateId);
|
|
20
|
+
if (!candidate) throw new Error("CHANGE_CANDIDATE_NOT_FOUND");
|
|
21
|
+
const assignedRole = candidate.riskLevel === "high" ? "expert" : "curator";
|
|
22
|
+
const id = stableId("review", input.changeCandidateId);
|
|
23
|
+
const task = {
|
|
24
|
+
id,
|
|
25
|
+
changeCandidateId: input.changeCandidateId,
|
|
26
|
+
status: "open",
|
|
27
|
+
assignedRole,
|
|
28
|
+
decision: void 0,
|
|
29
|
+
decidedAt: void 0,
|
|
30
|
+
decidedBy: void 0
|
|
31
|
+
};
|
|
32
|
+
store.reviewTasks.set(id, task);
|
|
33
|
+
store.notifications.push({
|
|
34
|
+
kind: "kb.review.requested",
|
|
35
|
+
reviewTaskId: id,
|
|
36
|
+
changeCandidateId: input.changeCandidateId,
|
|
37
|
+
assignedRole,
|
|
38
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
39
|
+
});
|
|
40
|
+
return task;
|
|
41
|
+
}
|
|
42
|
+
async function proposeRulePatch(input) {
|
|
43
|
+
if (!store.candidates.has(input.changeCandidateId)) throw new Error("CHANGE_CANDIDATE_NOT_FOUND");
|
|
44
|
+
store.proposedRuleVersionIdsByCandidate.set(input.changeCandidateId, [...input.proposedRuleVersionIds]);
|
|
45
|
+
return { proposedRuleVersionIds: [...input.proposedRuleVersionIds] };
|
|
46
|
+
}
|
|
47
|
+
async function markRuleVersionApproved(input) {
|
|
48
|
+
store.approvedRuleVersionIds.add(input.ruleVersionId);
|
|
49
|
+
return { ruleVersionId: input.ruleVersionId };
|
|
50
|
+
}
|
|
51
|
+
async function submitDecision(input) {
|
|
52
|
+
const task = store.reviewTasks.get(input.reviewTaskId);
|
|
53
|
+
if (!task) throw new Error("REVIEW_TASK_NOT_FOUND");
|
|
54
|
+
const candidate = store.candidates.get(task.changeCandidateId);
|
|
55
|
+
if (!candidate) throw new Error("CHANGE_CANDIDATE_NOT_FOUND");
|
|
56
|
+
if (candidate.riskLevel === "high" && input.decision === "approve") {
|
|
57
|
+
if (input.decidedByRole !== "expert") throw new Error("FORBIDDEN_ROLE");
|
|
58
|
+
}
|
|
59
|
+
const decided = {
|
|
60
|
+
...task,
|
|
61
|
+
status: "decided",
|
|
62
|
+
decision: input.decision,
|
|
63
|
+
decidedAt: /* @__PURE__ */ new Date(),
|
|
64
|
+
decidedBy: input.decidedBy
|
|
65
|
+
};
|
|
66
|
+
store.reviewTasks.set(decided.id, decided);
|
|
67
|
+
return decided;
|
|
68
|
+
}
|
|
69
|
+
async function publishIfReady(_input) {
|
|
70
|
+
if ([...store.reviewTasks.values()].filter((t) => t.status !== "decided").length) throw new Error("NOT_READY");
|
|
71
|
+
if ([...store.reviewTasks.values()].some((t) => t.decision === "reject")) return {
|
|
72
|
+
published: false,
|
|
73
|
+
reason: "REJECTED"
|
|
74
|
+
};
|
|
75
|
+
for (const task of store.reviewTasks.values()) {
|
|
76
|
+
if (task.decision !== "approve") continue;
|
|
77
|
+
if ((store.proposedRuleVersionIdsByCandidate.get(task.changeCandidateId) ?? []).filter((id) => !store.approvedRuleVersionIds.has(id)).length) throw new Error("NOT_READY");
|
|
78
|
+
}
|
|
79
|
+
return { published: true };
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
runWatch,
|
|
83
|
+
createReviewTask,
|
|
84
|
+
proposeRulePatch,
|
|
85
|
+
markRuleVersionApproved,
|
|
86
|
+
submitDecision,
|
|
87
|
+
publishIfReady
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
//#endregion
|
|
92
|
+
export { createPipelineMemoryHandlers, createPipelineMemoryStore };
|
|
93
|
+
//# sourceMappingURL=memory.handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.handlers.js","names":["task: ReviewTask","decided: ReviewTask"],"sources":["../../src/handlers/memory.handlers.ts"],"sourcesContent":["interface ChangeCandidate {\n id: string;\n sourceDocumentId: string;\n detectedAt: Date;\n diffSummary: string;\n riskLevel: 'low' | 'medium' | 'high';\n}\n\ninterface ReviewTask {\n id: string;\n changeCandidateId: string;\n status: 'open' | 'decided';\n assignedRole: 'curator' | 'expert';\n decision?: 'approve' | 'reject';\n decidedAt?: Date;\n decidedBy?: string;\n}\n\nexport interface PipelineMemoryStore {\n candidates: Map<string, ChangeCandidate>;\n reviewTasks: Map<string, ReviewTask>;\n proposedRuleVersionIdsByCandidate: Map<string, string[]>;\n approvedRuleVersionIds: Set<string>;\n notifications: {\n kind: 'kb.review.requested';\n reviewTaskId: string;\n changeCandidateId: string;\n assignedRole: 'curator' | 'expert';\n createdAt: Date;\n }[];\n}\n\nexport function createPipelineMemoryStore(): PipelineMemoryStore {\n return {\n candidates: new Map(),\n reviewTasks: new Map(),\n proposedRuleVersionIdsByCandidate: new Map(),\n approvedRuleVersionIds: new Set(),\n notifications: [],\n };\n}\n\nfunction stableId(prefix: string, value: string): string {\n return `${prefix}_${value.replace(/[^a-zA-Z0-9_-]/g, '_')}`;\n}\n\nexport interface PipelineMemoryHandlers {\n runWatch(input: {\n jurisdiction: string;\n }): Promise<{ candidates: ChangeCandidate[] }>;\n createReviewTask(input: { changeCandidateId: string }): Promise<ReviewTask>;\n proposeRulePatch(input: {\n changeCandidateId: string;\n proposedRuleVersionIds: string[];\n }): Promise<{ proposedRuleVersionIds: string[] }>;\n markRuleVersionApproved(input: {\n ruleVersionId: string;\n }): Promise<{ ruleVersionId: string }>;\n submitDecision(input: {\n reviewTaskId: string;\n decision: 'approve' | 'reject';\n decidedBy: string;\n decidedByRole: 'curator' | 'expert';\n }): Promise<ReviewTask>;\n publishIfReady(input: {\n jurisdiction: string;\n }): Promise<{ published: boolean; reason?: string }>;\n}\n\nexport function createPipelineMemoryHandlers(\n store: PipelineMemoryStore\n): PipelineMemoryHandlers {\n async function runWatch(input: { jurisdiction: string }) {\n // demo: always returns empty unless caller pre-seeds candidates\n const candidates = [...store.candidates.values()].filter(\n (c) => c.sourceDocumentId.startsWith(`${input.jurisdiction}_`) || true\n );\n return { candidates };\n }\n\n async function createReviewTask(input: { changeCandidateId: string }) {\n const candidate = store.candidates.get(input.changeCandidateId);\n if (!candidate) throw new Error('CHANGE_CANDIDATE_NOT_FOUND');\n const assignedRole = candidate.riskLevel === 'high' ? 'expert' : 'curator';\n const id = stableId('review', input.changeCandidateId);\n const task: ReviewTask = {\n id,\n changeCandidateId: input.changeCandidateId,\n status: 'open',\n assignedRole,\n decision: undefined,\n decidedAt: undefined,\n decidedBy: undefined,\n };\n store.reviewTasks.set(id, task);\n store.notifications.push({\n kind: 'kb.review.requested',\n reviewTaskId: id,\n changeCandidateId: input.changeCandidateId,\n assignedRole,\n createdAt: new Date(),\n });\n return task;\n }\n\n async function proposeRulePatch(input: {\n changeCandidateId: string;\n proposedRuleVersionIds: string[];\n }): Promise<{ proposedRuleVersionIds: string[] }> {\n if (!store.candidates.has(input.changeCandidateId)) {\n throw new Error('CHANGE_CANDIDATE_NOT_FOUND');\n }\n store.proposedRuleVersionIdsByCandidate.set(input.changeCandidateId, [\n ...input.proposedRuleVersionIds,\n ]);\n return { proposedRuleVersionIds: [...input.proposedRuleVersionIds] };\n }\n\n async function markRuleVersionApproved(input: {\n ruleVersionId: string;\n }): Promise<{ ruleVersionId: string }> {\n store.approvedRuleVersionIds.add(input.ruleVersionId);\n return { ruleVersionId: input.ruleVersionId };\n }\n\n async function submitDecision(input: {\n reviewTaskId: string;\n decision: 'approve' | 'reject';\n decidedBy: string;\n decidedByRole: 'curator' | 'expert';\n }) {\n const task = store.reviewTasks.get(input.reviewTaskId);\n if (!task) throw new Error('REVIEW_TASK_NOT_FOUND');\n const candidate = store.candidates.get(task.changeCandidateId);\n if (!candidate) throw new Error('CHANGE_CANDIDATE_NOT_FOUND');\n if (candidate.riskLevel === 'high' && input.decision === 'approve') {\n if (input.decidedByRole !== 'expert') throw new Error('FORBIDDEN_ROLE');\n }\n const decided: ReviewTask = {\n ...task,\n status: 'decided',\n decision: input.decision,\n decidedAt: new Date(),\n decidedBy: input.decidedBy,\n };\n store.reviewTasks.set(decided.id, decided);\n return decided;\n }\n\n async function publishIfReady(_input: { jurisdiction: string }) {\n const openTasks = [...store.reviewTasks.values()].filter(\n (t) => t.status !== 'decided'\n );\n if (openTasks.length) {\n throw new Error('NOT_READY');\n }\n const rejected = [...store.reviewTasks.values()].some(\n (t) => t.decision === 'reject'\n );\n if (rejected) return { published: false, reason: 'REJECTED' };\n\n // Ensure every proposed rule version is approved before publishing.\n for (const task of store.reviewTasks.values()) {\n if (task.decision !== 'approve') continue;\n const proposed =\n store.proposedRuleVersionIdsByCandidate.get(task.changeCandidateId) ??\n [];\n const unapproved = proposed.filter(\n (id) => !store.approvedRuleVersionIds.has(id)\n );\n if (unapproved.length) {\n throw new Error('NOT_READY');\n }\n }\n return { published: true };\n }\n\n return {\n runWatch,\n createReviewTask,\n proposeRulePatch,\n markRuleVersionApproved,\n submitDecision,\n publishIfReady,\n };\n}\n"],"mappings":"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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChangeCandidateModel, ChangeRiskLevelEnum, ReviewAssignedRoleEnum, ReviewDecisionEnum, ReviewTaskModel } from "./entities/models.js";
|
|
2
|
+
import "./entities/index.js";
|
|
3
|
+
import { KbChangeDetectedEvent, KbChangeSummarizedEvent, KbPatchProposedEvent, KbReviewDecidedEvent, KbReviewRequestedEvent } from "./events.js";
|
|
4
|
+
import example from "./example.js";
|
|
5
|
+
import { PipelineMemoryHandlers, PipelineMemoryStore, createPipelineMemoryHandlers, createPipelineMemoryStore } from "./handlers/memory.handlers.js";
|
|
6
|
+
import { KbPipelineCreateReviewTaskContract, KbPipelinePublishIfReadyContract, KbPipelineRunWatchContract, KbPipelineSubmitDecisionContract } from "./operations/pipeline.js";
|
|
7
|
+
import "./operations/index.js";
|
|
8
|
+
import { KbUpdatePipelineFeature } from "./kb-update-pipeline.feature.js";
|
|
9
|
+
import { KbDashboardPresentation, KbReviewFormPresentation, KbReviewListPresentation } from "./presentations.js";
|
|
10
|
+
export { ChangeCandidateModel, ChangeRiskLevelEnum, KbChangeDetectedEvent, KbChangeSummarizedEvent, KbDashboardPresentation, KbPatchProposedEvent, KbPipelineCreateReviewTaskContract, KbPipelinePublishIfReadyContract, KbPipelineRunWatchContract, KbPipelineSubmitDecisionContract, KbReviewDecidedEvent, KbReviewFormPresentation, KbReviewListPresentation, KbReviewRequestedEvent, KbUpdatePipelineFeature, PipelineMemoryHandlers, PipelineMemoryStore, ReviewAssignedRoleEnum, ReviewDecisionEnum, ReviewTaskModel, createPipelineMemoryHandlers, createPipelineMemoryStore, example };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { KbChangeDetectedEvent, KbChangeSummarizedEvent, KbPatchProposedEvent, KbReviewDecidedEvent, KbReviewRequestedEvent } from "./events.js";
|
|
2
|
+
import example_default from "./example.js";
|
|
3
|
+
import { ChangeCandidateModel, ChangeRiskLevelEnum, ReviewAssignedRoleEnum, ReviewDecisionEnum, ReviewTaskModel } from "./entities/models.js";
|
|
4
|
+
import "./entities/index.js";
|
|
5
|
+
import { KbPipelineCreateReviewTaskContract, KbPipelinePublishIfReadyContract, KbPipelineRunWatchContract, KbPipelineSubmitDecisionContract } from "./operations/pipeline.js";
|
|
6
|
+
import "./operations/index.js";
|
|
7
|
+
import { createPipelineMemoryHandlers, createPipelineMemoryStore } from "./handlers/memory.handlers.js";
|
|
8
|
+
import { KbUpdatePipelineFeature } from "./kb-update-pipeline.feature.js";
|
|
9
|
+
import { KbDashboardPresentation, KbReviewFormPresentation, KbReviewListPresentation } from "./presentations.js";
|
|
10
|
+
import "./docs/index.js";
|
|
11
|
+
|
|
12
|
+
export { ChangeCandidateModel, ChangeRiskLevelEnum, KbChangeDetectedEvent, KbChangeSummarizedEvent, KbDashboardPresentation, KbPatchProposedEvent, KbPipelineCreateReviewTaskContract, KbPipelinePublishIfReadyContract, KbPipelineRunWatchContract, KbPipelineSubmitDecisionContract, KbReviewDecidedEvent, KbReviewFormPresentation, KbReviewListPresentation, KbReviewRequestedEvent, KbUpdatePipelineFeature, ReviewAssignedRoleEnum, ReviewDecisionEnum, ReviewTaskModel, createPipelineMemoryHandlers, createPipelineMemoryStore, example_default as example };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FeatureModuleSpec } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/kb-update-pipeline.feature.d.ts
|
|
4
|
+
declare const KbUpdatePipelineFeature: FeatureModuleSpec;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { KbUpdatePipelineFeature };
|
|
7
|
+
//# sourceMappingURL=kb-update-pipeline.feature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kb-update-pipeline.feature.d.ts","names":[],"sources":["../src/kb-update-pipeline.feature.ts"],"sourcesContent":[],"mappings":";;;cAEa,yBAAyB"}
|