@principles/core 1.267.6 → 1.268.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/runtime-v2/__tests__/governance-experience.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/governance-experience.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/governance-experience.test.js +300 -0
- package/dist/runtime-v2/__tests__/governance-experience.test.js.map +1 -0
- package/dist/runtime-v2/config/__tests__/pd-config-workspace.test.js +41 -0
- package/dist/runtime-v2/config/__tests__/pd-config-workspace.test.js.map +1 -1
- package/dist/runtime-v2/config/index.d.ts +2 -2
- package/dist/runtime-v2/config/index.d.ts.map +1 -1
- package/dist/runtime-v2/config/index.js +2 -0
- package/dist/runtime-v2/config/index.js.map +1 -1
- package/dist/runtime-v2/config/pd-config-types.d.ts +8 -0
- package/dist/runtime-v2/config/pd-config-types.d.ts.map +1 -1
- package/dist/runtime-v2/config/pd-config-types.js +2 -0
- package/dist/runtime-v2/config/pd-config-types.js.map +1 -1
- package/dist/runtime-v2/config/pd-config-validate.d.ts.map +1 -1
- package/dist/runtime-v2/config/pd-config-validate.js +23 -3
- package/dist/runtime-v2/config/pd-config-validate.js.map +1 -1
- package/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js +24 -0
- package/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js.map +1 -1
- package/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
- package/dist/runtime-v2/feature-flags/feature-flag-contract.js +7 -0
- package/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
- package/dist/runtime-v2/governance-experience-contract.d.ts +468 -0
- package/dist/runtime-v2/governance-experience-contract.d.ts.map +1 -0
- package/dist/runtime-v2/governance-experience-contract.js +208 -0
- package/dist/runtime-v2/governance-experience-contract.js.map +1 -0
- package/dist/runtime-v2/governance-experience.d.ts +11 -0
- package/dist/runtime-v2/governance-experience.d.ts.map +1 -0
- package/dist/runtime-v2/governance-experience.js +276 -0
- package/dist/runtime-v2/governance-experience.js.map +1 -0
- package/dist/runtime-v2/index.d.ts +3 -0
- package/dist/runtime-v2/index.d.ts.map +1 -1
- package/dist/runtime-v2/index.js +2 -0
- package/dist/runtime-v2/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
import { LineageConfidenceSchema, OwnerGovernanceViewSchema, SourceRefSchema, } from './governance-projection-contract.js';
|
|
3
|
+
// Governance Experience Snapshot v1.5.1 contract (PRI-584).
|
|
4
|
+
//
|
|
5
|
+
// Read-only experience layer OVER the existing governance projection
|
|
6
|
+
// (GovernanceFacts -> deriveOwnerGovernanceView -> OwnerGovernanceView).
|
|
7
|
+
// This layer explains; it never authorizes (ERR-102) and never introduces a
|
|
8
|
+
// second lifecycle model: every activity judgment below is derived from
|
|
9
|
+
// fields the projection already computed.
|
|
10
|
+
const NonEmptyStringSchema = Type.String({ minLength: 1 });
|
|
11
|
+
// Reuses the ISO-8601 UTC format registered by governance-projection-contract.js
|
|
12
|
+
// at import time; Value.Check fails loud if the two registrations ever diverge.
|
|
13
|
+
const TimestampSchema = Type.String({ format: 'governance-iso-utc' });
|
|
14
|
+
export const GovernancePrimaryAttentionSchema = Type.Union([
|
|
15
|
+
Type.Literal('setup_required'),
|
|
16
|
+
Type.Literal('owner_decision_required'),
|
|
17
|
+
Type.Literal('recovery_required'),
|
|
18
|
+
Type.Literal('degraded'),
|
|
19
|
+
Type.Literal('background_processing'),
|
|
20
|
+
Type.Literal('all_clear'),
|
|
21
|
+
]);
|
|
22
|
+
export const GovernanceExperienceReasonCodeSchema = Type.Union([
|
|
23
|
+
Type.Literal('governance.exp.reason.owner_identity_missing'),
|
|
24
|
+
Type.Literal('governance.exp.reason.approval_pending'),
|
|
25
|
+
Type.Literal('governance.exp.reason.rulecode_owner_decision'),
|
|
26
|
+
Type.Literal('governance.exp.reason.no_pending_decision'),
|
|
27
|
+
Type.Literal('governance.exp.reason.owner_decision_available'),
|
|
28
|
+
Type.Literal('governance.exp.reason.break_glass_entry'),
|
|
29
|
+
Type.Literal('governance.exp.reason.recovery_required'),
|
|
30
|
+
Type.Literal('governance.exp.reason.source_unavailable'),
|
|
31
|
+
Type.Literal('governance.exp.reason.config_invalid'),
|
|
32
|
+
Type.Literal('governance.exp.reason.processing'),
|
|
33
|
+
Type.Literal('governance.exp.reason.workspace_clear'),
|
|
34
|
+
Type.Literal('governance.exp.reason.workspace_empty'),
|
|
35
|
+
]);
|
|
36
|
+
export const GovernanceExperienceNextActionCodeSchema = Type.Union([
|
|
37
|
+
Type.Literal('governance.exp.next.configure_owner'),
|
|
38
|
+
Type.Literal('governance.exp.next.review_approvals'),
|
|
39
|
+
Type.Literal('governance.exp.next.inspect_recovery'),
|
|
40
|
+
Type.Literal('governance.exp.next.inspect_sources'),
|
|
41
|
+
Type.Literal('governance.exp.next.fix_config'),
|
|
42
|
+
Type.Literal('governance.exp.next.monitor'),
|
|
43
|
+
Type.Literal('governance.exp.next.none'),
|
|
44
|
+
]);
|
|
45
|
+
// ── Inputs (request-scoped validated envelope, SPEC §5) ─────────────────────
|
|
46
|
+
export const WorkspaceEnvironmentSchema = Type.Union([
|
|
47
|
+
Type.Literal('production'),
|
|
48
|
+
Type.Literal('development'),
|
|
49
|
+
Type.Literal('demo'),
|
|
50
|
+
Type.Literal('test'),
|
|
51
|
+
]);
|
|
52
|
+
export const EnvironmentContextInputSchema = Type.Object({
|
|
53
|
+
environment: Type.Union([WorkspaceEnvironmentSchema, Type.Literal('unknown')]),
|
|
54
|
+
source: Type.Union([Type.Literal('workspace_config'), Type.Literal('missing')]),
|
|
55
|
+
configIssue: Type.Optional(NonEmptyStringSchema),
|
|
56
|
+
}, { additionalProperties: false });
|
|
57
|
+
export const SourceAvailabilityInputSchema = Type.Object({
|
|
58
|
+
sourceId: Type.Union([Type.Literal('state_db'), Type.Literal('principle_ledger')]),
|
|
59
|
+
available: Type.Boolean(),
|
|
60
|
+
reasonCode: Type.Optional(NonEmptyStringSchema),
|
|
61
|
+
}, { additionalProperties: false });
|
|
62
|
+
export const UnlinkedRecordGroupSchema = Type.Object({
|
|
63
|
+
source: Type.Union([
|
|
64
|
+
Type.Literal('approval'),
|
|
65
|
+
Type.Literal('task'),
|
|
66
|
+
Type.Literal('artifact'),
|
|
67
|
+
Type.Literal('principle'),
|
|
68
|
+
Type.Literal('activation'),
|
|
69
|
+
]),
|
|
70
|
+
reasonCode: NonEmptyStringSchema,
|
|
71
|
+
count: Type.Integer({ minimum: 0 }),
|
|
72
|
+
sampleRefs: Type.Array(SourceRefSchema, { maxItems: 10 }),
|
|
73
|
+
}, { additionalProperties: false });
|
|
74
|
+
export const OwnerConfigSnapshotSchema = Type.Object({
|
|
75
|
+
authenticationMode: Type.Union([Type.Literal('authenticated'), Type.Literal('no_auth')]),
|
|
76
|
+
ownerIdentityConfiguration: Type.Union([Type.Literal('configured'), Type.Literal('missing')]),
|
|
77
|
+
}, { additionalProperties: false });
|
|
78
|
+
export const GovernanceViewInputSchema = Type.Object({
|
|
79
|
+
view: OwnerGovernanceViewSchema,
|
|
80
|
+
lineageConfidence: LineageConfidenceSchema,
|
|
81
|
+
}, { additionalProperties: false });
|
|
82
|
+
/**
|
|
83
|
+
* Frontier evidence read directly from the tasks table. Present only when
|
|
84
|
+
* state_db is readable. Used exclusively for the `blocked` classification:
|
|
85
|
+
* blocked requires BOTH current-frontier evidence and a blocking source
|
|
86
|
+
* (SPEC §8.1/§9.1) — orphan rows alone can never produce `blocked`.
|
|
87
|
+
*/
|
|
88
|
+
export const FrontierEvidenceSchema = Type.Object({
|
|
89
|
+
sourceId: Type.Literal('state_db'),
|
|
90
|
+
activeTaskCount: Type.Integer({ minimum: 0 }),
|
|
91
|
+
sampleRefs: Type.Array(SourceRefSchema, { maxItems: 10 }),
|
|
92
|
+
}, { additionalProperties: false });
|
|
93
|
+
export const GovernanceExperienceInputsSchema = Type.Object({
|
|
94
|
+
schemaVersion: Type.Literal('1'),
|
|
95
|
+
asOf: TimestampSchema,
|
|
96
|
+
workspaceHash: NonEmptyStringSchema,
|
|
97
|
+
governanceViews: Type.Array(GovernanceViewInputSchema),
|
|
98
|
+
ownerConfigSnapshot: OwnerConfigSnapshotSchema,
|
|
99
|
+
environmentContext: EnvironmentContextInputSchema,
|
|
100
|
+
sourceAvailability: Type.Array(SourceAvailabilityInputSchema),
|
|
101
|
+
dataQualityInputs: Type.Array(UnlinkedRecordGroupSchema),
|
|
102
|
+
frontierEvidence: Type.Optional(FrontierEvidenceSchema),
|
|
103
|
+
/**
|
|
104
|
+
* RuleCode owner decisions awaiting action (SPEC §8.3 needs_decision source).
|
|
105
|
+
* Counted from non-deactivated shadow activations in the same batched
|
|
106
|
+
* `activations` rows — no extra query. Absent when state_db is unavailable.
|
|
107
|
+
*/
|
|
108
|
+
rulecodeDecisionEvidence: Type.Optional(Type.Object({
|
|
109
|
+
pendingCount: Type.Integer({ minimum: 0 }),
|
|
110
|
+
sampleRefs: Type.Array(SourceRefSchema, { maxItems: 10 }),
|
|
111
|
+
}, { additionalProperties: false })),
|
|
112
|
+
}, { additionalProperties: false });
|
|
113
|
+
// ── Readiness (SPEC §6) ──────────────────────────────────────────────────────
|
|
114
|
+
export const GovernanceActionKindSchema = Type.Union([
|
|
115
|
+
Type.Literal('principle_approval'),
|
|
116
|
+
Type.Literal('rulecode_owner_decision'),
|
|
117
|
+
Type.Literal('emergency_pause'),
|
|
118
|
+
]);
|
|
119
|
+
export const GovernanceObservedAuthoritySchema = Type.Union([
|
|
120
|
+
Type.Literal('operator_legacy'),
|
|
121
|
+
Type.Literal('configured_owner'),
|
|
122
|
+
Type.Literal('break_glass'),
|
|
123
|
+
]);
|
|
124
|
+
export const GovernanceActionReadinessSchema = Type.Object({
|
|
125
|
+
kind: GovernanceActionKindSchema,
|
|
126
|
+
observedAuthority: GovernanceObservedAuthoritySchema,
|
|
127
|
+
status: Type.Union([Type.Literal('entry_conditions_met'), Type.Literal('blocked')]),
|
|
128
|
+
reasonCode: GovernanceExperienceReasonCodeSchema,
|
|
129
|
+
nextActionCode: GovernanceExperienceNextActionCodeSchema,
|
|
130
|
+
}, { additionalProperties: false });
|
|
131
|
+
export const OwnerGovernanceReadinessSchema = Type.Object({
|
|
132
|
+
authenticationMode: OwnerConfigSnapshotSchema.properties.authenticationMode,
|
|
133
|
+
ownerIdentityConfiguration: OwnerConfigSnapshotSchema.properties.ownerIdentityConfiguration,
|
|
134
|
+
governanceActions: Type.Array(GovernanceActionReadinessSchema, { minItems: 3, maxItems: 3 }),
|
|
135
|
+
}, { additionalProperties: false });
|
|
136
|
+
// ── Activity (SPEC §7-§9) ────────────────────────────────────────────────────
|
|
137
|
+
export const GovernanceActivityCategorySchema = Type.Union([
|
|
138
|
+
Type.Literal('blocked'),
|
|
139
|
+
Type.Literal('needs_recovery'),
|
|
140
|
+
Type.Literal('needs_decision'),
|
|
141
|
+
Type.Literal('processing'),
|
|
142
|
+
]);
|
|
143
|
+
export const GovernanceActivityItemSchema = Type.Object({
|
|
144
|
+
principleId: Type.Optional(NonEmptyStringSchema),
|
|
145
|
+
category: GovernanceActivityCategorySchema,
|
|
146
|
+
reasonCode: NonEmptyStringSchema,
|
|
147
|
+
sourceRefs: Type.Array(SourceRefSchema, { maxItems: 10 }),
|
|
148
|
+
}, { additionalProperties: false });
|
|
149
|
+
export const GovernanceActivityCategorySummarySchema = Type.Object({
|
|
150
|
+
category: GovernanceActivityCategorySchema,
|
|
151
|
+
count: Type.Integer({ minimum: 0 }),
|
|
152
|
+
items: Type.Array(GovernanceActivityItemSchema, { maxItems: 10 }),
|
|
153
|
+
hasMore: Type.Boolean(),
|
|
154
|
+
}, { additionalProperties: false });
|
|
155
|
+
export const GovernanceActivitySnapshotSchema = Type.Object({
|
|
156
|
+
primaryAttention: GovernancePrimaryAttentionSchema,
|
|
157
|
+
categories: Type.Array(GovernanceActivityCategorySummarySchema),
|
|
158
|
+
}, { additionalProperties: false });
|
|
159
|
+
// ── Trust & data quality (SPEC §11-§15) ──────────────────────────────────────
|
|
160
|
+
export const GovernanceLineageTransparencySchema = Type.Object({
|
|
161
|
+
confidence: LineageConfidenceSchema,
|
|
162
|
+
strongViewCount: Type.Integer({ minimum: 0 }),
|
|
163
|
+
weakViewCount: Type.Integer({ minimum: 0 }),
|
|
164
|
+
unknownViewCount: Type.Integer({ minimum: 0 }),
|
|
165
|
+
}, { additionalProperties: false });
|
|
166
|
+
export const GovernanceTrustContextSchema = Type.Object({
|
|
167
|
+
environmentContext: EnvironmentContextInputSchema,
|
|
168
|
+
lineageTransparency: GovernanceLineageTransparencySchema,
|
|
169
|
+
}, { additionalProperties: false });
|
|
170
|
+
export const GovernanceDataQualityIssueGroupSchema = Type.Object({
|
|
171
|
+
source: Type.Union([
|
|
172
|
+
Type.Literal('ledger'),
|
|
173
|
+
Type.Literal('artifact'),
|
|
174
|
+
Type.Literal('task'),
|
|
175
|
+
Type.Literal('approval'),
|
|
176
|
+
Type.Literal('activation'),
|
|
177
|
+
Type.Literal('trajectory'),
|
|
178
|
+
Type.Literal('lineage'),
|
|
179
|
+
Type.Literal('workspace'),
|
|
180
|
+
]),
|
|
181
|
+
reasonCode: NonEmptyStringSchema,
|
|
182
|
+
nextActionCode: NonEmptyStringSchema,
|
|
183
|
+
count: Type.Integer({ minimum: 1 }),
|
|
184
|
+
sampleRefs: Type.Array(SourceRefSchema, { maxItems: 3 }),
|
|
185
|
+
}, { additionalProperties: false });
|
|
186
|
+
export const GovernanceDataQualitySchema = Type.Object({
|
|
187
|
+
degraded: Type.Boolean(),
|
|
188
|
+
issueGroups: Type.Array(GovernanceDataQualityIssueGroupSchema, { maxItems: 10 }),
|
|
189
|
+
hasMore: Type.Boolean(),
|
|
190
|
+
}, { additionalProperties: false });
|
|
191
|
+
// ── Snapshot (SPEC §12) ──────────────────────────────────────────────────────
|
|
192
|
+
export const GovernanceExperienceSummarySchema = Type.Object({
|
|
193
|
+
primaryAttention: GovernancePrimaryAttentionSchema,
|
|
194
|
+
headlineCode: NonEmptyStringSchema,
|
|
195
|
+
reasonCode: GovernanceExperienceReasonCodeSchema,
|
|
196
|
+
nextActionCode: GovernanceExperienceNextActionCodeSchema,
|
|
197
|
+
}, { additionalProperties: false });
|
|
198
|
+
export const GovernanceExperienceSnapshotSchema = Type.Object({
|
|
199
|
+
schemaVersion: Type.Literal('1'),
|
|
200
|
+
snapshotId: NonEmptyStringSchema,
|
|
201
|
+
asOf: TimestampSchema,
|
|
202
|
+
summary: GovernanceExperienceSummarySchema,
|
|
203
|
+
readiness: OwnerGovernanceReadinessSchema,
|
|
204
|
+
activity: GovernanceActivitySnapshotSchema,
|
|
205
|
+
trustContext: GovernanceTrustContextSchema,
|
|
206
|
+
dataQuality: GovernanceDataQualitySchema,
|
|
207
|
+
}, { additionalProperties: false });
|
|
208
|
+
//# sourceMappingURL=governance-experience-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"governance-experience-contract.js","sourceRoot":"","sources":["../../src/runtime-v2/governance-experience-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,eAAe,GAChB,MAAM,qCAAqC,CAAC;AAE7C,4DAA4D;AAC5D,EAAE;AACF,qEAAqE;AACrE,yEAAyE;AACzE,4EAA4E;AAC5E,wEAAwE;AACxE,0CAA0C;AAE1C,MAAM,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;AAC3D,iFAAiF;AACjF,gFAAgF;AAChF,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAC;AAEtE,MAAM,CAAC,MAAM,gCAAgC,GAAG,IAAI,CAAC,KAAK,CAAC;IACzD,IAAI,CAAC,OAAO,CAAC,gBAA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EpC,gFAAgF;AAEhF,MAAM,CAAC,MAAM,iCAAiC,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3D,gBAAgB,EAAE,gCAAgC;IAClD,YAAY,EAAE,oBAAoB;IAClC,UAAU,EAAE,oCAAoC;IAChD,cAAc,EAAE,wCAAwC;CACzD,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC;AACpC,MAAM,CAAC,MAAM,kCAAkC,GAAG,IAAI,CAAC,MAAM,CAAC;IAC5D,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;IAChC,UAAU,EAAE,oBAAoB;IAChC,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,iCAAiC;IAC1C,SAAS,EAAE,8BAA8B;IACzC,QAAQ,EAAE,gCAAgC;IAC1C,YAAY,EAAE,4BAA4B;IAC1C,WAAW,EAAE,2BAA2B;CACzC,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GovernanceExperienceSnapshot } from './governance-experience-contract.js';
|
|
2
|
+
/** Bounded list contract (SPEC §15): at most 10 items per category / issue group list. */
|
|
3
|
+
export declare const GOVERNANCE_EXPERIENCE_ITEMS_LIMIT = 10;
|
|
4
|
+
export declare const GOVERNANCE_EXPERIENCE_ISSUE_GROUPS_LIMIT = 10;
|
|
5
|
+
/**
|
|
6
|
+
* Derives the workspace-level governance experience snapshot from validated
|
|
7
|
+
* inputs. Pure: no clock, no I/O, deterministic for identical inputs.
|
|
8
|
+
* Throws `invalid_governance_experience_inputs` / `invalid_governance_experience_snapshot`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function deriveGovernanceExperienceSnapshot(input: unknown): GovernanceExperienceSnapshot;
|
|
11
|
+
//# sourceMappingURL=governance-experience.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"governance-experience.d.ts","sourceRoot":"","sources":["../../src/runtime-v2/governance-experience.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkG,4BAA4B,EAAgL,MAAM,qCAAqC,CAAC;AAOtW,0FAA0F;AAC1F,eAAO,MAAM,iCAAiC,KAAK,CAAC;AACpD,eAAO,MAAM,wCAAwC,KAAK,CAAC;AAkJ3D;;;;GAIG;AACH,wBAAgB,kCAAkC,CAAC,KAAK,EAAE,OAAO,GAAG,4BAA4B,CAuH/F"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { Value } from '@sinclair/typebox/value';
|
|
2
|
+
import { GovernanceExperienceInputsSchema, GovernanceExperienceSnapshotSchema, } from './governance-experience-contract.js';
|
|
3
|
+
/** Bounded list contract (SPEC §15): at most 10 items per category / issue group list. */
|
|
4
|
+
export const GOVERNANCE_EXPERIENCE_ITEMS_LIMIT = 10;
|
|
5
|
+
export const GOVERNANCE_EXPERIENCE_ISSUE_GROUPS_LIMIT = 10;
|
|
6
|
+
/**
|
|
7
|
+
* Active execution evidence (SPEC §8.4): `running` (leased with a live lease or
|
|
8
|
+
* pending completion intent) and `retry_scheduled` (a prior execution exists,
|
|
9
|
+
* retry pending). `queued` (never-started pending frontier) is deliberately
|
|
10
|
+
* EXCLUDED — pending artifact/work is not processing.
|
|
11
|
+
*/
|
|
12
|
+
const PROCESSING_AUTOMATION_STATES = new Set(['running', 'retry_scheduled']);
|
|
13
|
+
/** Category priority (SPEC §7.3): blocked > needs_recovery > needs_decision > processing. */
|
|
14
|
+
const CATEGORY_ORDER = ['blocked', 'needs_recovery', 'needs_decision', 'processing'];
|
|
15
|
+
const UNLINKED_NEXT_ACTION = 'inspect_workspace_data';
|
|
16
|
+
function classifyView(view) {
|
|
17
|
+
// Per-principle category is mutually exclusive with SPEC §7.3 priority:
|
|
18
|
+
// recovery outranks decision (a principle with a failed task AND a pending
|
|
19
|
+
// approval is classified needs_recovery; the workspace-level
|
|
20
|
+
// primaryAttention headline still surfaces the decision first per SPEC
|
|
21
|
+
// Phase 4 UI priority "1. Owner decision 2. Recovery").
|
|
22
|
+
const hasRecovery = view.attention.primary === 'recovery_required'
|
|
23
|
+
|| view.attention.items.some(item => item.kind === 'recovery')
|
|
24
|
+
|| view.automation.state === 'stalled';
|
|
25
|
+
if (hasRecovery)
|
|
26
|
+
return 'needs_recovery';
|
|
27
|
+
if (view.attention.primary === 'owner_required')
|
|
28
|
+
return 'needs_decision';
|
|
29
|
+
if (PROCESSING_AUTOMATION_STATES.has(view.automation.state))
|
|
30
|
+
return 'processing';
|
|
31
|
+
return 'idle';
|
|
32
|
+
}
|
|
33
|
+
function activityItem(category, view) {
|
|
34
|
+
return {
|
|
35
|
+
principleId: view.principleId,
|
|
36
|
+
category,
|
|
37
|
+
reasonCode: view.summary.reasonCode,
|
|
38
|
+
sourceRefs: view.summary.sourceRefs.slice(0, GOVERNANCE_EXPERIENCE_ITEMS_LIMIT),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function buildReadiness(inputs, decisionCount) {
|
|
42
|
+
const ownerConfigured = inputs.ownerConfigSnapshot.ownerIdentityConfiguration === 'configured';
|
|
43
|
+
const principleApprovalReason = decisionCount > 0
|
|
44
|
+
? 'governance.exp.reason.approval_pending'
|
|
45
|
+
: 'governance.exp.reason.no_pending_decision';
|
|
46
|
+
// principle approvals: the live mutation route has no owner-identity gate —
|
|
47
|
+
// the real entry acts with operator authority even when an Owner is
|
|
48
|
+
// configured (SPEC §6.4). rulecode governance decisions require the
|
|
49
|
+
// configured Owner (routes/activations.ts governance actor). emergency
|
|
50
|
+
// pause resolves to the configured Owner when present, otherwise to the
|
|
51
|
+
// always-constructed break-glass actor (server/index.ts authority wiring).
|
|
52
|
+
return {
|
|
53
|
+
authenticationMode: inputs.ownerConfigSnapshot.authenticationMode,
|
|
54
|
+
ownerIdentityConfiguration: inputs.ownerConfigSnapshot.ownerIdentityConfiguration,
|
|
55
|
+
governanceActions: [
|
|
56
|
+
{
|
|
57
|
+
kind: 'principle_approval',
|
|
58
|
+
observedAuthority: 'operator_legacy',
|
|
59
|
+
status: 'entry_conditions_met',
|
|
60
|
+
reasonCode: principleApprovalReason,
|
|
61
|
+
nextActionCode: decisionCount > 0 ? 'governance.exp.next.review_approvals' : 'governance.exp.next.none',
|
|
62
|
+
},
|
|
63
|
+
ownerConfigured
|
|
64
|
+
? {
|
|
65
|
+
kind: 'rulecode_owner_decision',
|
|
66
|
+
observedAuthority: 'configured_owner',
|
|
67
|
+
status: 'entry_conditions_met',
|
|
68
|
+
reasonCode: 'governance.exp.reason.owner_decision_available',
|
|
69
|
+
nextActionCode: 'governance.exp.next.none',
|
|
70
|
+
}
|
|
71
|
+
: {
|
|
72
|
+
kind: 'rulecode_owner_decision',
|
|
73
|
+
observedAuthority: 'configured_owner',
|
|
74
|
+
status: 'blocked',
|
|
75
|
+
reasonCode: 'governance.exp.reason.owner_identity_missing',
|
|
76
|
+
nextActionCode: 'governance.exp.next.configure_owner',
|
|
77
|
+
},
|
|
78
|
+
ownerConfigured
|
|
79
|
+
? {
|
|
80
|
+
kind: 'emergency_pause',
|
|
81
|
+
observedAuthority: 'configured_owner',
|
|
82
|
+
status: 'entry_conditions_met',
|
|
83
|
+
reasonCode: 'governance.exp.reason.owner_decision_available',
|
|
84
|
+
nextActionCode: 'governance.exp.next.none',
|
|
85
|
+
}
|
|
86
|
+
: {
|
|
87
|
+
kind: 'emergency_pause',
|
|
88
|
+
observedAuthority: 'break_glass',
|
|
89
|
+
status: 'entry_conditions_met',
|
|
90
|
+
reasonCode: 'governance.exp.reason.break_glass_entry',
|
|
91
|
+
nextActionCode: 'governance.exp.next.none',
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function pushUniqueRef(refs, ref, max) {
|
|
97
|
+
if (refs.length < max && !refs.some(existing => existing.type === ref.type && existing.id === ref.id))
|
|
98
|
+
refs.push(ref);
|
|
99
|
+
}
|
|
100
|
+
function groupIssues(inputs) {
|
|
101
|
+
const groups = new Map();
|
|
102
|
+
const bump = (issue) => {
|
|
103
|
+
const { source, reasonCode, nextActionCode, sourceRef: ref } = issue;
|
|
104
|
+
const key = `${source}:${reasonCode}`;
|
|
105
|
+
const existing = groups.get(key);
|
|
106
|
+
if (existing === undefined) {
|
|
107
|
+
groups.set(key, { source, reasonCode, nextActionCode, count: 1, refs: ref === undefined ? [] : [ref] });
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
existing.count += 1;
|
|
111
|
+
if (ref !== undefined)
|
|
112
|
+
pushUniqueRef(existing.refs, ref, 3);
|
|
113
|
+
};
|
|
114
|
+
// Unlinked record families map onto the projection's data-quality sources;
|
|
115
|
+
// 'principle' (ledger entries without a principle) surfaces as 'ledger'.
|
|
116
|
+
const unlinkedSource = (source) => source === 'principle' ? 'ledger' : source;
|
|
117
|
+
for (const input of inputs.dataQualityInputs) {
|
|
118
|
+
if (input.count <= 0)
|
|
119
|
+
continue;
|
|
120
|
+
const source = unlinkedSource(input.source);
|
|
121
|
+
const key = `${source}:${input.reasonCode}`;
|
|
122
|
+
const existing = groups.get(key);
|
|
123
|
+
if (existing === undefined) {
|
|
124
|
+
groups.set(key, { source, reasonCode: input.reasonCode, nextActionCode: UNLINKED_NEXT_ACTION, count: input.count, refs: [...input.sampleRefs].slice(0, 3) });
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
existing.count += input.count;
|
|
128
|
+
for (const ref of input.sampleRefs)
|
|
129
|
+
pushUniqueRef(existing.refs, ref, 3);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
for (const viewInput of inputs.governanceViews) {
|
|
133
|
+
for (const issue of viewInput.view.dataQuality.issues) {
|
|
134
|
+
bump({ source: issue.source, reasonCode: issue.reasonCode, nextActionCode: issue.nextActionCode, ...(issue.sourceRef === undefined ? {} : { sourceRef: issue.sourceRef }) });
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (inputs.environmentContext.configIssue !== undefined) {
|
|
138
|
+
bump({ source: 'workspace', reasonCode: 'config_invalid', nextActionCode: 'fix_workspace_config' });
|
|
139
|
+
}
|
|
140
|
+
const sorted = [...groups.values()]
|
|
141
|
+
.map(group => ({ source: group.source, reasonCode: group.reasonCode, nextActionCode: group.nextActionCode, count: group.count, sampleRefs: group.refs.slice(0, 3) }))
|
|
142
|
+
.sort((a, b) => b.count - a.count || a.source.localeCompare(b.source) || a.reasonCode.localeCompare(b.reasonCode));
|
|
143
|
+
return {
|
|
144
|
+
degraded: sorted.length > 0,
|
|
145
|
+
issueGroups: sorted.slice(0, GOVERNANCE_EXPERIENCE_ISSUE_GROUPS_LIMIT),
|
|
146
|
+
hasMore: sorted.length > GOVERNANCE_EXPERIENCE_ISSUE_GROUPS_LIMIT,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Derives the workspace-level governance experience snapshot from validated
|
|
151
|
+
* inputs. Pure: no clock, no I/O, deterministic for identical inputs.
|
|
152
|
+
* Throws `invalid_governance_experience_inputs` / `invalid_governance_experience_snapshot`.
|
|
153
|
+
*/
|
|
154
|
+
export function deriveGovernanceExperienceSnapshot(input) {
|
|
155
|
+
if (!Value.Check(GovernanceExperienceInputsSchema, input))
|
|
156
|
+
throw new Error('invalid_governance_experience_inputs');
|
|
157
|
+
const inputs = input;
|
|
158
|
+
const sortedViews = [...inputs.governanceViews].sort((a, b) => a.view.principleId.localeCompare(b.view.principleId));
|
|
159
|
+
const buckets = new Map([['blocked', []], ['needs_recovery', []], ['needs_decision', []], ['processing', []]]);
|
|
160
|
+
for (const { view } of sortedViews) {
|
|
161
|
+
const category = classifyView(view);
|
|
162
|
+
if (category === 'idle')
|
|
163
|
+
continue;
|
|
164
|
+
buckets.get(category)?.push(activityItem(category, view));
|
|
165
|
+
}
|
|
166
|
+
// RuleCode owner decisions are a workspace-level needs_decision marker (SPEC
|
|
167
|
+
// §8.3) — listed first so bounded lists surface it before principle items.
|
|
168
|
+
if (inputs.rulecodeDecisionEvidence !== undefined && inputs.rulecodeDecisionEvidence.pendingCount > 0) {
|
|
169
|
+
buckets.get('needs_decision')?.unshift({
|
|
170
|
+
category: 'needs_decision',
|
|
171
|
+
reasonCode: 'governance.exp.reason.rulecode_owner_decision',
|
|
172
|
+
sourceRefs: inputs.rulecodeDecisionEvidence.sampleRefs.slice(0, GOVERNANCE_EXPERIENCE_ITEMS_LIMIT),
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
const unavailableSources = inputs.sourceAvailability.filter(source => !source.available);
|
|
176
|
+
// blocked needs current-frontier evidence AND blocking evidence together
|
|
177
|
+
// (SPEC §8.1). With state_db itself down there is no frontier evidence and
|
|
178
|
+
// the snapshot reports `degraded` instead of guessing. "Progress cannot be
|
|
179
|
+
// established" is inherent to the condition: an unavailable required source
|
|
180
|
+
// is exactly what prevents views/progress from being built — the marker
|
|
181
|
+
// carries the frontier evidence refs, never a bare count.
|
|
182
|
+
const frontierActive = inputs.frontierEvidence !== undefined && inputs.frontierEvidence.activeTaskCount > 0;
|
|
183
|
+
const blocked = unavailableSources.length > 0 && frontierActive;
|
|
184
|
+
if (blocked && inputs.frontierEvidence !== undefined) {
|
|
185
|
+
buckets.set('blocked', [{
|
|
186
|
+
category: 'blocked',
|
|
187
|
+
reasonCode: 'governance.exp.reason.source_unavailable',
|
|
188
|
+
sourceRefs: inputs.frontierEvidence.sampleRefs.slice(0, GOVERNANCE_EXPERIENCE_ITEMS_LIMIT),
|
|
189
|
+
}]);
|
|
190
|
+
}
|
|
191
|
+
const categories = [];
|
|
192
|
+
for (const category of CATEGORY_ORDER) {
|
|
193
|
+
const items = buckets.get(category) ?? [];
|
|
194
|
+
if (items.length === 0)
|
|
195
|
+
continue;
|
|
196
|
+
categories.push({
|
|
197
|
+
category,
|
|
198
|
+
count: items.length,
|
|
199
|
+
items: items.slice(0, GOVERNANCE_EXPERIENCE_ITEMS_LIMIT),
|
|
200
|
+
hasMore: items.length > GOVERNANCE_EXPERIENCE_ITEMS_LIMIT,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
const decisionCount = buckets.get('needs_decision')?.length ?? 0;
|
|
204
|
+
const approvalDecisionCount = buckets.get('needs_decision')?.filter(item => item.principleId !== undefined).length ?? 0;
|
|
205
|
+
const recoveryCount = buckets.get('needs_recovery')?.length ?? 0;
|
|
206
|
+
const processingCount = buckets.get('processing')?.length ?? 0;
|
|
207
|
+
const dataQuality = groupIssues(inputs);
|
|
208
|
+
const configInvalid = inputs.environmentContext.configIssue !== undefined;
|
|
209
|
+
let primaryAttention;
|
|
210
|
+
if (decisionCount > 0)
|
|
211
|
+
primaryAttention = 'owner_decision_required';
|
|
212
|
+
else if (recoveryCount > 0 || blocked)
|
|
213
|
+
primaryAttention = 'recovery_required';
|
|
214
|
+
else if (unavailableSources.length > 0 || dataQuality.degraded)
|
|
215
|
+
primaryAttention = 'degraded';
|
|
216
|
+
else if (inputs.ownerConfigSnapshot.ownerIdentityConfiguration === 'missing')
|
|
217
|
+
primaryAttention = 'setup_required';
|
|
218
|
+
else if (processingCount > 0)
|
|
219
|
+
primaryAttention = 'background_processing';
|
|
220
|
+
else
|
|
221
|
+
primaryAttention = 'all_clear';
|
|
222
|
+
let reasonCode;
|
|
223
|
+
let nextActionCode;
|
|
224
|
+
switch (primaryAttention) {
|
|
225
|
+
case 'owner_decision_required':
|
|
226
|
+
reasonCode = approvalDecisionCount > 0 ? 'governance.exp.reason.approval_pending' : 'governance.exp.reason.rulecode_owner_decision';
|
|
227
|
+
nextActionCode = 'governance.exp.next.review_approvals';
|
|
228
|
+
break;
|
|
229
|
+
case 'recovery_required':
|
|
230
|
+
reasonCode = blocked ? 'governance.exp.reason.source_unavailable' : 'governance.exp.reason.recovery_required';
|
|
231
|
+
nextActionCode = blocked ? 'governance.exp.next.inspect_sources' : 'governance.exp.next.inspect_recovery';
|
|
232
|
+
break;
|
|
233
|
+
case 'degraded':
|
|
234
|
+
reasonCode = configInvalid && unavailableSources.length === 0 ? 'governance.exp.reason.config_invalid' : 'governance.exp.reason.source_unavailable';
|
|
235
|
+
nextActionCode = configInvalid && unavailableSources.length === 0 ? 'governance.exp.next.fix_config' : 'governance.exp.next.inspect_sources';
|
|
236
|
+
break;
|
|
237
|
+
case 'setup_required':
|
|
238
|
+
reasonCode = 'governance.exp.reason.owner_identity_missing';
|
|
239
|
+
nextActionCode = 'governance.exp.next.configure_owner';
|
|
240
|
+
break;
|
|
241
|
+
case 'background_processing':
|
|
242
|
+
reasonCode = 'governance.exp.reason.processing';
|
|
243
|
+
nextActionCode = 'governance.exp.next.monitor';
|
|
244
|
+
break;
|
|
245
|
+
default:
|
|
246
|
+
reasonCode = sortedViews.length === 0 ? 'governance.exp.reason.workspace_empty' : 'governance.exp.reason.workspace_clear';
|
|
247
|
+
nextActionCode = 'governance.exp.next.none';
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
const strongViewCount = sortedViews.filter(item => item.lineageConfidence === 'strong').length;
|
|
251
|
+
const weakViewCount = sortedViews.filter(item => item.lineageConfidence === 'weak').length;
|
|
252
|
+
const unknownViewCount = sortedViews.filter(item => item.lineageConfidence === 'unknown').length;
|
|
253
|
+
const lineageConfidence = sortedViews.length === 0 || unknownViewCount > 0 ? 'unknown' : weakViewCount > 0 ? 'weak' : 'strong';
|
|
254
|
+
const snapshot = {
|
|
255
|
+
schemaVersion: '1',
|
|
256
|
+
snapshotId: `gov-exp:${inputs.workspaceHash}:${inputs.asOf}`,
|
|
257
|
+
asOf: inputs.asOf,
|
|
258
|
+
summary: {
|
|
259
|
+
primaryAttention,
|
|
260
|
+
headlineCode: `govexp.headline.${primaryAttention}`,
|
|
261
|
+
reasonCode,
|
|
262
|
+
nextActionCode,
|
|
263
|
+
},
|
|
264
|
+
readiness: buildReadiness(inputs, approvalDecisionCount),
|
|
265
|
+
activity: { primaryAttention, categories },
|
|
266
|
+
trustContext: {
|
|
267
|
+
environmentContext: inputs.environmentContext,
|
|
268
|
+
lineageTransparency: { confidence: lineageConfidence, strongViewCount, weakViewCount, unknownViewCount },
|
|
269
|
+
},
|
|
270
|
+
dataQuality,
|
|
271
|
+
};
|
|
272
|
+
if (!Value.Check(GovernanceExperienceSnapshotSchema, snapshot))
|
|
273
|
+
throw new Error('invalid_governance_experience_snapshot');
|
|
274
|
+
return snapshot;
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=governance-experience.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"governance-experience.js","sourceRoot":"","sources":["../../src/runtime-v2/governance-experience.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EACL,gCAAgC,EAChC,kCAAkC,GACnC,MAAM,qCAAqC,CAAC;AAG7C,0FAA0F;AAC1F,MAAM,CAAC,MAAM,iCAAiC,GAAG,EAAE,CAAC;AACpD,MAAM,CAAC,MAAM,wCAAwC,GAAG,EAAE,CAAC;AAC3D;;;;;GAKG;AACH,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAC7E,6FAA6F;AAC7F,MAAM,cAAc,GAA0C,CAAC,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;AAC5H,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAEtD,SAAS,YAAY,CAAC,IAAyB;IAC7C,wEAAwE;IACxE,2EAA2E;IAC3E,6DAA6D;IAC7D,uEAAuE;IACvE,wDAAwD;IACxD,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,KAAK,mBAAmB;WAC7D,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC;WAC3D,IAAI,CAAC,UAAU,CAAC,KAAK,KAAK,SAAS,CAAC;IACzC,IAAI,WAAW;QAAE,OAAO,gBAAgB,CAAC;IACzC,IAAI,IAAI,CA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EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE;SACzG;QACD,WAAW;KACZ,CAAC;IACF,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,kCAAkC,EAAE,QAAQ,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC1H,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -19,6 +19,9 @@ export { PDErrorCategorySchema } from './error-categories.js';
|
|
|
19
19
|
export { GovernanceChannelSchema, LineageConfidenceSchema, SourceRefSchema, RevisionIdentitySchema, PrincipleFactSchema, TaskFactSchema, RunnerVerdictFactSchema, ApprovalFactSchema, ActivationFactSchema, DerivedRelationFactSchema, TimelineEventSchema, DataQualityIssueSchema, LineageContextSchema, GovernanceFactsSchema, PrincipleStateSchema, ProcessViewSchema, AutomationViewSchema, AttentionItemSchema, AttentionViewSchema, ActivationSummarySchema, OwnerGovernanceSummarySchema, DataQualitySchema, OwnerGovernanceViewSchema } from './governance-projection-contract.js';
|
|
20
20
|
export type { GovernanceChannel, LineageConfidence, SourceRef, RevisionIdentity, PrincipleFact, TaskFact, RunnerVerdictFact, ApprovalFact, ActivationFact, DerivedRelationFact, TimelineEvent, DataQualityIssue, LineageContext, GovernanceFacts, PrincipleState, ProcessView, AutomationView, AttentionItem, AttentionView, ActivationSummary, OwnerGovernanceSummary, DataQuality, OwnerGovernanceView } from './governance-projection-contract.js';
|
|
21
21
|
export { GOVERNANCE_HEADLINE_CODES, deriveOwnerGovernanceView } from './governance-projection.js';
|
|
22
|
+
export { GovernancePrimaryAttentionSchema, GovernanceExperienceReasonCodeSchema, GovernanceExperienceNextActionCodeSchema, WorkspaceEnvironmentSchema, EnvironmentContextInputSchema, SourceAvailabilityInputSchema, UnlinkedRecordGroupSchema, OwnerConfigSnapshotSchema, GovernanceViewInputSchema, FrontierEvidenceSchema, GovernanceExperienceInputsSchema, GovernanceActionKindSchema, GovernanceObservedAuthoritySchema, GovernanceActionReadinessSchema, OwnerGovernanceReadinessSchema, GovernanceActivityCategorySchema, GovernanceActivityItemSchema, GovernanceActivityCategorySummarySchema, GovernanceActivitySnapshotSchema, GovernanceLineageTransparencySchema, GovernanceTrustContextSchema, GovernanceDataQualityIssueGroupSchema, GovernanceDataQualitySchema, GovernanceExperienceSummarySchema, GovernanceExperienceSnapshotSchema, } from './governance-experience-contract.js';
|
|
23
|
+
export type { WorkspaceEnvironment, EnvironmentContextInput, SourceAvailabilityInput, UnlinkedRecordGroup, OwnerConfigSnapshot, GovernanceViewInput, FrontierEvidence, GovernanceExperienceInputs, GovernanceActionKind, GovernanceObservedAuthority, GovernanceActionReadiness, OwnerGovernanceReadiness, GovernancePrimaryAttention, GovernanceActivityCategory, GovernanceActivityItem, GovernanceActivityCategorySummary, GovernanceActivitySnapshot, GovernanceLineageTransparency, GovernanceTrustContext, GovernanceDataQualityIssueGroup, GovernanceDataQuality, GovernanceExperienceReasonCode, GovernanceExperienceNextActionCode, GovernanceExperienceSummary, GovernanceExperienceSnapshot, } from './governance-experience-contract.js';
|
|
24
|
+
export { GOVERNANCE_EXPERIENCE_ITEMS_LIMIT, GOVERNANCE_EXPERIENCE_ISSUE_GROUPS_LIMIT, deriveGovernanceExperienceSnapshot } from './governance-experience.js';
|
|
22
25
|
export { AgentCapabilityRequirementsSchema, AgentTimeoutPolicySchema, AgentRetryPolicySchema, AgentSpecSchema } from './agent-spec.js';
|
|
23
26
|
export { SchemaVersionRefSchema, RuntimeV2SchemaVersionSchema } from './schema-version.js';
|
|
24
27
|
export { RuntimeKindSchema, RuntimeCapabilitiesSchema, RuntimeHealthSchema, RunHandleSchema, RunExecutionStatusSchema, RunStatusSchema, ContextItemSchema, AgentSpecRefSchema, WorkflowRefSchema, TaskRefSchema, StartRunInputSchema, StructuredRunOutputSchema, RuntimeArtifactRefSchema } from './runtime-protocol.js';
|