@openspecui/core 6.2.1 → 7.0.1
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/active-root-config-DxRGkvOp.d.mts +668 -0
- package/dist/active-root-config-L5QaMb3A.mjs +333 -0
- package/dist/active-root-config.d.mts +6 -0
- package/dist/active-root-config.mjs +3 -0
- package/dist/app-daemon-control.d.mts +59 -59
- package/dist/{cli-projection-Cus0QYkY.d.mts → cli-projection-BeBPIxhK.d.mts} +17 -17
- package/dist/{cli-projection-BHfqvlpA.mjs → cli-projection-CKRwTvwf.mjs} +1 -1
- package/dist/cli-projection.d.mts +5 -5
- package/dist/cli-projection.mjs +2 -2
- package/dist/{common-BpgNUOOT.mjs → common-BRL_34xt.mjs} +2 -1
- package/dist/{dashboard-summary-transport-ByWMiUWn.d.mts → dashboard-summary-transport-CXGjAcQZ.d.mts} +2904 -2112
- package/dist/{dashboard-summary-transport-BMtZ0q12.mjs → dashboard-summary-transport-ILCfZD_I.mjs} +2 -2
- package/dist/dashboard-summary-transport.d.mts +26 -25
- package/dist/dashboard-summary-transport.mjs +4 -4
- package/dist/{document-translation-CUkkxnYV.mjs → document-translation-B3xaP0dJ.mjs} +1 -1
- package/dist/document-translation.d.mts +1 -1
- package/dist/document-translation.mjs +2 -2
- package/dist/{hosted-app-C3gBSvov.mjs → hosted-app-B_T_tTvO.mjs} +7 -2
- package/dist/hosted-app.d.mts +27 -26
- package/dist/hosted-app.mjs +7 -7
- package/dist/{hosted-contract-CaN2aw54.mjs → hosted-contract-BxUx6ksP.mjs} +5 -5
- package/dist/hosted-contract.d.mts +26 -25
- package/dist/hosted-contract.mjs +6 -6
- package/dist/{command-result-BkUqqa0m.d.mts → index-CkwSp1WZ.d.mts} +8143 -8002
- package/dist/index.d.mts +27 -26
- package/dist/index.mjs +904 -332
- package/dist/{local-download-profiles-Detliqbu.d.mts → local-download-profiles-DYeaRK_E.d.mts} +1 -1
- package/dist/local-download-profiles.d.mts +2 -2
- package/dist/local-download-profiles.mjs +1 -1
- package/dist/markdown-facts.d.mts +1 -1
- package/dist/markdown-facts.mjs +1 -1
- package/dist/{markdown-reading-w686Obnl.d.mts → markdown-reading--Sr6JAl5.d.mts} +1 -1
- package/dist/{markdown-reading-0L-mVBJp.mjs → markdown-reading-LtgFpB8E.mjs} +1 -1
- package/dist/markdown-reading.d.mts +2 -2
- package/dist/markdown-reading.mjs +2 -2
- package/dist/{notifications-COeXWb2h.d.mts → notifications-B43aFxw9.d.mts} +5 -5
- package/dist/{notifications-E6_WBjQO.mjs → notifications-Cy74GVN7.mjs} +2 -2
- package/dist/notifications.d.mts +2 -2
- package/dist/notifications.mjs +3 -3
- package/dist/{openspec-annotations-DiHje5HD.mjs → openspec-annotations-BJ1BlVyo.mjs} +2 -2
- package/dist/{openspec-annotations-BXAqKLXc.d.mts → openspec-annotations-BylPW5rz.d.mts} +2 -2
- package/dist/openspec-annotations.d.mts +3 -3
- package/dist/openspec-annotations.mjs +3 -3
- package/dist/openspec-compat.d.mts +14 -14
- package/dist/openspec-compat.mjs +18 -32
- package/dist/{openspec-projection-DvJnsxLZ.mjs → openspec-projection-Cno7FlwE.mjs} +2 -2
- package/dist/{openspec-projection-BwPchxIq.d.mts → openspec-projection-NGJSLiSk.d.mts} +3 -3
- package/dist/openspec-projection.d.mts +5 -5
- package/dist/openspec-projection.mjs +4 -4
- package/dist/opsx-display-path.d.mts +1 -1
- package/dist/opsx-display-path.mjs +1 -1
- package/dist/{opsx-entity-D3aLGfC7.d.mts → opsx-entity-5ATD3peX.d.mts} +2 -2
- package/dist/opsx-entity.d.mts +7 -7
- package/dist/opsx-entity.mjs +1 -1
- package/dist/{opsx-schema-detail-DJ9QKFSH.d.mts → opsx-schema-detail-Cu7mIrGm.d.mts} +2 -2
- package/dist/opsx-schema-detail.d.mts +8 -8
- package/dist/opsx-schema-detail.mjs +1 -1
- package/dist/{opsx-types-BJTT7C4w.d.mts → opsx-types-DJzyK1W7.d.mts} +402 -153
- package/dist/opsx-workflows.d.mts +1 -1
- package/dist/opsx-workflows.mjs +1 -1
- package/dist/{planning-cli-projection-DrkT18EI.mjs → planning-cli-projection-BreqsrYA.mjs} +51 -11
- package/dist/planning-cli-projection.d.mts +26 -25
- package/dist/planning-cli-projection.mjs +7 -7
- package/dist/{schemas-DKF6kaQ3.d.mts → schemas-kuds0tNv.d.mts} +96 -96
- package/dist/{sounds-CsPiQKxX.d.mts → sounds-vwRCMSzL.d.mts} +4 -4
- package/dist/sounds.d.mts +1 -1
- package/dist/sounds.mjs +1 -1
- package/dist/{spec-catalog-Dv2qolxy.mjs → spec-catalog-DEk_oHAx.mjs} +99 -18
- package/dist/spec-catalog.d.mts +27 -26
- package/dist/spec-catalog.mjs +5 -5
- package/dist/{store-content-projection-CiMcGZnG.mjs → store-content-projection-Bpdb7_d9.mjs} +1 -1
- package/dist/store-content-projection.d.mts +1 -1
- package/dist/store-content-projection.mjs +2 -2
- package/dist/{store-mutation-protocol-CLtYUSwC.mjs → store-mutation-protocol-CJGUWWI6.mjs} +1 -1
- package/dist/{store-mutation-protocol-ZUGSy1a0.d.mts → store-mutation-protocol-D9IK_wrr.d.mts} +36 -36
- package/dist/store-mutation-protocol.d.mts +1 -1
- package/dist/store-mutation-protocol.mjs +2 -2
- package/dist/{store-types-B42Br9lz.d.mts → store-types-DxvwR0sj.d.mts} +1 -1
- package/dist/store-types.d.mts +5 -5
- package/dist/store-types.mjs +1 -1
- package/dist/{task-progress-DpZak5xA.mjs → task-progress-Bvid_Ws8.mjs} +1 -1
- package/dist/task-progress.d.mts +6 -6
- package/dist/task-progress.mjs +2 -2
- package/dist/{terminal-audio-BXa1vpkF.d.mts → terminal-audio-BcjP_os4.d.mts} +1 -1
- package/dist/{terminal-audio-punFQHXI.mjs → terminal-audio-DeubAfFC.mjs} +1 -1
- package/dist/terminal-audio.d.mts +2 -2
- package/dist/terminal-audio.mjs +2 -2
- package/dist/terminal-control.d.mts +2 -2
- package/dist/terminal-control.mjs +1 -1
- package/dist/{terminal-invocation-Bkic6avG.d.mts → terminal-invocation-BW357tO1.d.mts} +70 -70
- package/dist/terminal-invocation.d.mts +1 -1
- package/dist/terminal-invocation.mjs +1 -1
- package/dist/terminal-theme.d.mts +1 -1
- package/dist/terminal-theme.mjs +1 -1
- package/dist/translation-language-pair.d.mts +1 -1
- package/dist/translation-language-pair.mjs +1 -1
- package/dist/{translator-D_V2ZFPP.d.mts → translator-YggUX3F7.d.mts} +200 -200
- package/dist/translator.d.mts +1 -1
- package/dist/translator.mjs +1 -1
- package/package.json +15 -5
- /package/dist/{document-translation-J_NddeDy.d.mts → document-translation-BNbM3fEj.d.mts} +0 -0
- /package/dist/{local-download-profiles-DK4g6FRe.mjs → local-download-profiles-h9lUTXr-.mjs} +0 -0
- /package/dist/{markdown-facts-Dve6IAJP.mjs → markdown-facts-BIx47NNY.mjs} +0 -0
- /package/dist/{markdown-facts-C9yWB2I9.d.mts → markdown-facts-DLclHfpE.d.mts} +0 -0
- /package/dist/{opsx-display-path-eWJ4ve-O.d.mts → opsx-display-path-BD34M8QV.d.mts} +0 -0
- /package/dist/{opsx-display-path-DuPEvPV0.mjs → opsx-display-path-ocbNzMZj.mjs} +0 -0
- /package/dist/{opsx-entity-Br5S5N0o.mjs → opsx-entity-BnO3k48r.mjs} +0 -0
- /package/dist/{opsx-schema-detail-CckZIEVr.mjs → opsx-schema-detail-zk8ePaKK.mjs} +0 -0
- /package/dist/{opsx-workflows-Bhh_bI-e.d.mts → opsx-workflows-DX1r6e5j.d.mts} +0 -0
- /package/dist/{opsx-workflows-GPZSe1C_.mjs → opsx-workflows-byPfLlo8.mjs} +0 -0
- /package/dist/{schemas-BrS9qSB3.mjs → schemas-CMThmKx1.mjs} +0 -0
- /package/dist/{sounds-na4c8j0c.mjs → sounds-6prQvKXl.mjs} +0 -0
- /package/dist/{store-content-projection-BPDCma8v.d.mts → store-content-projection-R74MV_sD.d.mts} +0 -0
- /package/dist/{store-types-Cs40yohL.mjs → store-types-CvpEVNoE.mjs} +0 -0
- /package/dist/{terminal-control-BvoxwQ6m.mjs → terminal-control-c6oS-lFb.mjs} +0 -0
- /package/dist/{terminal-invocation-BexVY5E2.mjs → terminal-invocation-DIpoFYDo.mjs} +0 -0
- /package/dist/{terminal-theme-DIhzj5Si.mjs → terminal-theme-Byzxmnjm.mjs} +0 -0
- /package/dist/{terminal-theme-BzARb2Do.d.mts → terminal-theme-DX08Gci8.d.mts} +0 -0
- /package/dist/{translation-language-pair-DeAiww3_.d.mts → translation-language-pair-BR5uxGm-.d.mts} +0 -0
- /package/dist/{translation-language-pair-BV2cGjfv.mjs → translation-language-pair-DG9mOuFD.mjs} +0 -0
- /package/dist/{translator-DCCZeHt1.mjs → translator-CEGdRmKw.mjs} +0 -0
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { isMap, isNode, isScalar, isSeq, parseDocument } from "yaml";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/active-root-config-contract.ts
|
|
5
|
+
/**
|
|
6
|
+
* Orthogonal intents (updated 2026-08-02 Asia/Shanghai):
|
|
7
|
+
* 1. Define OpenSpec 1.7 Active Root official-field and diagnostic contracts.
|
|
8
|
+
* 2. Define exact owner/file/revision mutation admission and typed recovery results.
|
|
9
|
+
*
|
|
10
|
+
* Original request (2026-08-01): structured fields align with official OpenSpec while raw YAML accepts team extensions.
|
|
11
|
+
* Derived checkpoint (2026-08-02): stale Active Root saves return the latest physical source instead of overwriting it.
|
|
12
|
+
*/
|
|
13
|
+
/** OpenSpec 1.7 hard limit for project context encoded as UTF-8. */
|
|
14
|
+
const MAX_ACTIVE_ROOT_CONTEXT_BYTES = 50 * 1024;
|
|
15
|
+
const NonEmptyStringSchema = z.string().min(1);
|
|
16
|
+
const NonEmptyStringListSchema = z.array(NonEmptyStringSchema);
|
|
17
|
+
const ActiveRootRulesSchema = z.record(NonEmptyStringSchema, NonEmptyStringListSchema);
|
|
18
|
+
const ActiveRootOperationSchema = z.object({ guidance: NonEmptyStringListSchema }).strict();
|
|
19
|
+
const ActiveRootOperationsSchema = z.object({
|
|
20
|
+
apply: ActiveRootOperationSchema.optional(),
|
|
21
|
+
archive: ActiveRootOperationSchema.optional()
|
|
22
|
+
}).strict();
|
|
23
|
+
function withinContextByteLimit(value) {
|
|
24
|
+
return new TextEncoder().encode(value).byteLength <= MAX_ACTIVE_ROOT_CONTEXT_BYTES;
|
|
25
|
+
}
|
|
26
|
+
const ActiveRootContextSchema = z.string().refine(withinContextByteLimit, `Context must not exceed ${MAX_ACTIVE_ROOT_CONTEXT_BYTES} UTF-8 bytes.`);
|
|
27
|
+
/** Runtime schema for the resilient official-field projection. */
|
|
28
|
+
const ActiveRootOfficialConfigSchema = z.object({
|
|
29
|
+
schema: NonEmptyStringSchema.nullable(),
|
|
30
|
+
context: ActiveRootContextSchema.nullable(),
|
|
31
|
+
rules: ActiveRootRulesSchema.nullable(),
|
|
32
|
+
operations: ActiveRootOperationsSchema.nullable()
|
|
33
|
+
}).strict();
|
|
34
|
+
/** Runtime schema for one complete Structured-mode update. */
|
|
35
|
+
const ActiveRootStructuredUpdateSchema = z.object({
|
|
36
|
+
schema: NonEmptyStringSchema,
|
|
37
|
+
context: ActiveRootContextSchema.nullable(),
|
|
38
|
+
rules: ActiveRootRulesSchema.nullable(),
|
|
39
|
+
operations: z.object({
|
|
40
|
+
apply: ActiveRootOperationSchema.nullable(),
|
|
41
|
+
archive: ActiveRootOperationSchema.nullable()
|
|
42
|
+
}).strict().nullable()
|
|
43
|
+
}).strict();
|
|
44
|
+
/** Opaque digest proving the exact Active Root owner, file, presence, and source bytes read by an editor. */
|
|
45
|
+
const ActiveRootRevisionSchema = z.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
46
|
+
const ActiveRootMutationLocatorShape = {
|
|
47
|
+
ownerPath: z.string().min(1),
|
|
48
|
+
filePath: z.string().min(1),
|
|
49
|
+
revision: ActiveRootRevisionSchema
|
|
50
|
+
};
|
|
51
|
+
/** Runtime schema for Structured or Raw mutation admission at one exact physical revision. */
|
|
52
|
+
const ActiveRootMutationSchema = z.discriminatedUnion("mode", [z.object({
|
|
53
|
+
...ActiveRootMutationLocatorShape,
|
|
54
|
+
mode: z.literal("structured"),
|
|
55
|
+
update: ActiveRootStructuredUpdateSchema
|
|
56
|
+
}).strict(), z.object({
|
|
57
|
+
...ActiveRootMutationLocatorShape,
|
|
58
|
+
mode: z.literal("raw"),
|
|
59
|
+
content: z.string()
|
|
60
|
+
}).strict()]);
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/active-root-config-yaml.ts
|
|
64
|
+
/**
|
|
65
|
+
* Orthogonal intents (updated 2026-08-02 Asia/Shanghai):
|
|
66
|
+
* 1. Inspect OpenSpec 1.7 official fields resiliently while ignoring team-key ownership.
|
|
67
|
+
* 2. Validate Raw YAML syntax without imposing the official key set.
|
|
68
|
+
* 3. Patch only Structured-owned YAML nodes while retaining representable presentation and extensions.
|
|
69
|
+
*
|
|
70
|
+
* Original request (2026-08-01): preserve complete raw YAML because teams may define their own configuration keys.
|
|
71
|
+
* Derived checkpoint (2026-08-02): Structured mode owns schema, context, rules, and apply/archive guidance only.
|
|
72
|
+
*/
|
|
73
|
+
const EMPTY_OFFICIAL_CONFIG = {
|
|
74
|
+
schema: null,
|
|
75
|
+
context: null,
|
|
76
|
+
rules: null,
|
|
77
|
+
operations: null
|
|
78
|
+
};
|
|
79
|
+
function isRecord(value) {
|
|
80
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
81
|
+
}
|
|
82
|
+
function contextByteLength(value) {
|
|
83
|
+
return new TextEncoder().encode(value).byteLength;
|
|
84
|
+
}
|
|
85
|
+
function yamlErrors(content) {
|
|
86
|
+
const document = parseDocument(content);
|
|
87
|
+
if (document.errors.length === 0) return [];
|
|
88
|
+
return [{
|
|
89
|
+
code: "config-unparseable",
|
|
90
|
+
severity: "error",
|
|
91
|
+
path: "$",
|
|
92
|
+
message: document.errors.map((error) => error.message).join("\n")
|
|
93
|
+
}];
|
|
94
|
+
}
|
|
95
|
+
function inspectRules(value, diagnostics) {
|
|
96
|
+
if (value === void 0) return null;
|
|
97
|
+
if (!isRecord(value)) {
|
|
98
|
+
diagnostics.push({
|
|
99
|
+
code: "rules-invalid",
|
|
100
|
+
severity: "error",
|
|
101
|
+
path: "rules",
|
|
102
|
+
message: "The rules field must be a mapping of artifact ids to string arrays."
|
|
103
|
+
});
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const rules = {};
|
|
107
|
+
for (const [artifactId, candidate] of Object.entries(value)) {
|
|
108
|
+
if (!Array.isArray(candidate) || candidate.some((entry) => typeof entry !== "string")) {
|
|
109
|
+
diagnostics.push({
|
|
110
|
+
code: "rules-entry-invalid",
|
|
111
|
+
severity: "error",
|
|
112
|
+
path: `rules.${artifactId}`,
|
|
113
|
+
message: `Rules for '${artifactId}' must be an array of strings.`
|
|
114
|
+
});
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
const entries = candidate.filter((entry) => entry.length > 0);
|
|
118
|
+
if (entries.length < candidate.length) diagnostics.push({
|
|
119
|
+
code: "rules-entry-empty",
|
|
120
|
+
severity: "warning",
|
|
121
|
+
path: `rules.${artifactId}`,
|
|
122
|
+
message: `Empty rules for '${artifactId}' are ignored by OpenSpec.`
|
|
123
|
+
});
|
|
124
|
+
if (entries.length > 0) rules[artifactId] = entries;
|
|
125
|
+
}
|
|
126
|
+
return Object.keys(rules).length > 0 ? rules : null;
|
|
127
|
+
}
|
|
128
|
+
function inspectOperations(value, diagnostics) {
|
|
129
|
+
if (value === void 0) return null;
|
|
130
|
+
if (!isRecord(value)) {
|
|
131
|
+
diagnostics.push({
|
|
132
|
+
code: "operations-invalid",
|
|
133
|
+
severity: "error",
|
|
134
|
+
path: "operations",
|
|
135
|
+
message: "The operations field must be a mapping."
|
|
136
|
+
});
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
const operations = {};
|
|
140
|
+
for (const operationId of ["apply", "archive"]) {
|
|
141
|
+
const candidate = value[operationId];
|
|
142
|
+
if (candidate === void 0) continue;
|
|
143
|
+
if (!isRecord(candidate)) {
|
|
144
|
+
diagnostics.push({
|
|
145
|
+
code: "operation-invalid",
|
|
146
|
+
severity: "error",
|
|
147
|
+
path: `operations.${operationId}`,
|
|
148
|
+
message: `Operation '${operationId}' must be a mapping.`
|
|
149
|
+
});
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (candidate.guidance === void 0) continue;
|
|
153
|
+
if (!Array.isArray(candidate.guidance) || candidate.guidance.some((entry) => typeof entry !== "string")) {
|
|
154
|
+
diagnostics.push({
|
|
155
|
+
code: "operation-guidance-invalid",
|
|
156
|
+
severity: "error",
|
|
157
|
+
path: `operations.${operationId}.guidance`,
|
|
158
|
+
message: `Guidance for '${operationId}' must be an array of strings.`
|
|
159
|
+
});
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
const guidance = candidate.guidance.filter((entry) => entry.length > 0);
|
|
163
|
+
if (guidance.length < candidate.guidance.length) diagnostics.push({
|
|
164
|
+
code: "operation-guidance-empty",
|
|
165
|
+
severity: "warning",
|
|
166
|
+
path: `operations.${operationId}.guidance`,
|
|
167
|
+
message: `Empty '${operationId}' guidance entries are ignored by OpenSpec.`
|
|
168
|
+
});
|
|
169
|
+
if (guidance.length > 0) operations[operationId] = { guidance };
|
|
170
|
+
}
|
|
171
|
+
return Object.keys(operations).length > 0 ? operations : null;
|
|
172
|
+
}
|
|
173
|
+
/** Inspect official OpenSpec 1.7 Active Root fields independently and retain recoverable diagnostics. */
|
|
174
|
+
function inspectActiveRootOfficialConfig(content) {
|
|
175
|
+
if (content === null || content.trim().length === 0) return {
|
|
176
|
+
official: { ...EMPTY_OFFICIAL_CONFIG },
|
|
177
|
+
diagnostics: [{
|
|
178
|
+
code: "schema-missing",
|
|
179
|
+
severity: "error",
|
|
180
|
+
path: "schema",
|
|
181
|
+
message: "The active OpenSpec config does not declare a schema."
|
|
182
|
+
}]
|
|
183
|
+
};
|
|
184
|
+
const document = parseDocument(content);
|
|
185
|
+
if (document.errors.length > 0) return {
|
|
186
|
+
official: { ...EMPTY_OFFICIAL_CONFIG },
|
|
187
|
+
diagnostics: yamlErrors(content)
|
|
188
|
+
};
|
|
189
|
+
const raw = document.toJS();
|
|
190
|
+
if (!isRecord(raw)) return {
|
|
191
|
+
official: { ...EMPTY_OFFICIAL_CONFIG },
|
|
192
|
+
diagnostics: [{
|
|
193
|
+
code: "config-not-mapping",
|
|
194
|
+
severity: "error",
|
|
195
|
+
path: "$",
|
|
196
|
+
message: "OpenSpec config must be a YAML mapping for Structured mode."
|
|
197
|
+
}]
|
|
198
|
+
};
|
|
199
|
+
const diagnostics = [];
|
|
200
|
+
let schema = null;
|
|
201
|
+
if (raw.schema === void 0) diagnostics.push({
|
|
202
|
+
code: "schema-missing",
|
|
203
|
+
severity: "error",
|
|
204
|
+
path: "schema",
|
|
205
|
+
message: "The active OpenSpec config does not declare a schema."
|
|
206
|
+
});
|
|
207
|
+
else if (typeof raw.schema !== "string" || raw.schema.length === 0) diagnostics.push({
|
|
208
|
+
code: "schema-invalid",
|
|
209
|
+
severity: "error",
|
|
210
|
+
path: "schema",
|
|
211
|
+
message: "The schema field must be a non-empty string."
|
|
212
|
+
});
|
|
213
|
+
else schema = raw.schema;
|
|
214
|
+
let context = null;
|
|
215
|
+
if (raw.context !== void 0) if (typeof raw.context !== "string") diagnostics.push({
|
|
216
|
+
code: "context-invalid",
|
|
217
|
+
severity: "error",
|
|
218
|
+
path: "context",
|
|
219
|
+
message: "The context field must be a string."
|
|
220
|
+
});
|
|
221
|
+
else if (contextByteLength(raw.context) > MAX_ACTIVE_ROOT_CONTEXT_BYTES) diagnostics.push({
|
|
222
|
+
code: "context-too-large",
|
|
223
|
+
severity: "error",
|
|
224
|
+
path: "context",
|
|
225
|
+
message: `The context field exceeds ${MAX_ACTIVE_ROOT_CONTEXT_BYTES} UTF-8 bytes.`
|
|
226
|
+
});
|
|
227
|
+
else context = raw.context;
|
|
228
|
+
return {
|
|
229
|
+
official: {
|
|
230
|
+
schema,
|
|
231
|
+
context,
|
|
232
|
+
rules: inspectRules(raw.rules, diagnostics),
|
|
233
|
+
operations: inspectOperations(raw.operations, diagnostics)
|
|
234
|
+
},
|
|
235
|
+
diagnostics
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
/** Validate Raw-mode YAML syntax while allowing any syntactically valid document shape and custom keys. */
|
|
239
|
+
function validateActiveRootRawYaml(content) {
|
|
240
|
+
const diagnostics = yamlErrors(content);
|
|
241
|
+
return {
|
|
242
|
+
valid: diagnostics.length === 0,
|
|
243
|
+
diagnostics
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function editableDocument(content) {
|
|
247
|
+
const document = parseDocument(content ?? "");
|
|
248
|
+
if (document.errors.length > 0) throw new Error(`Active Root cannot be edited in Structured mode: ${document.errors.map((error) => error.message).join("\n")}`);
|
|
249
|
+
if (document.contents !== null && !isMap(document.contents)) throw new Error("Active Root cannot be edited in Structured mode: config is not a YAML mapping.");
|
|
250
|
+
return document;
|
|
251
|
+
}
|
|
252
|
+
function copyPresentation(source, target) {
|
|
253
|
+
if (!isNode(source) || !isNode(target)) return;
|
|
254
|
+
target.comment = source.comment;
|
|
255
|
+
target.commentBefore = source.commentBefore;
|
|
256
|
+
target.spaceBefore = source.spaceBefore;
|
|
257
|
+
if (isScalar(source) && isScalar(target) && typeof target.value === "string") target.type = source.type;
|
|
258
|
+
if (isMap(source) && isMap(target) || isSeq(source) && isSeq(target)) target.flow = source.flow;
|
|
259
|
+
if (isSeq(source) && isSeq(target)) for (let index = 0; index < Math.min(source.items.length, target.items.length); index += 1) copyPresentation(source.items[index], target.items[index]);
|
|
260
|
+
}
|
|
261
|
+
function replaceNode(document, path, value) {
|
|
262
|
+
const previous = document.getIn(path, true);
|
|
263
|
+
const replacement = document.createNode(value);
|
|
264
|
+
copyPresentation(previous, replacement);
|
|
265
|
+
document.setIn(path, replacement);
|
|
266
|
+
}
|
|
267
|
+
function ensureMap(document, path) {
|
|
268
|
+
const current = document.getIn(path, true);
|
|
269
|
+
if (isMap(current)) return current;
|
|
270
|
+
replaceNode(document, path, {});
|
|
271
|
+
const replacement = document.getIn(path, true);
|
|
272
|
+
if (!isMap(replacement)) throw new Error(`Unable to create YAML mapping at ${path.join(".")}.`);
|
|
273
|
+
return replacement;
|
|
274
|
+
}
|
|
275
|
+
function mappingStringKeys(mapping) {
|
|
276
|
+
const keys = [];
|
|
277
|
+
for (const pair of mapping.items) if (isScalar(pair.key) && typeof pair.key.value === "string") keys.push(pair.key.value);
|
|
278
|
+
return keys;
|
|
279
|
+
}
|
|
280
|
+
function patchRules(document, rules) {
|
|
281
|
+
if (rules === null) {
|
|
282
|
+
document.delete("rules");
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
const mapping = ensureMap(document, ["rules"]);
|
|
286
|
+
for (const artifactId of mappingStringKeys(mapping)) if (!Object.hasOwn(rules, artifactId)) mapping.delete(artifactId);
|
|
287
|
+
for (const [artifactId, entries] of Object.entries(rules)) replaceNode(document, ["rules", artifactId], entries);
|
|
288
|
+
}
|
|
289
|
+
function removeOperationGuidance(document, operationId) {
|
|
290
|
+
const operations = document.getIn(["operations"], true);
|
|
291
|
+
if (!isMap(operations)) return;
|
|
292
|
+
const operation = document.getIn(["operations", operationId], true);
|
|
293
|
+
if (isMap(operation)) {
|
|
294
|
+
operation.delete("guidance");
|
|
295
|
+
if (operation.items.length === 0) operations.delete(operationId);
|
|
296
|
+
} else if (operation !== void 0) operations.delete(operationId);
|
|
297
|
+
if (operations.items.length === 0) document.delete("operations");
|
|
298
|
+
}
|
|
299
|
+
function patchOperations(document, operations) {
|
|
300
|
+
if (operations === null) {
|
|
301
|
+
removeOperationGuidance(document, "apply");
|
|
302
|
+
removeOperationGuidance(document, "archive");
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
ensureMap(document, ["operations"]);
|
|
306
|
+
for (const operationId of ["apply", "archive"]) {
|
|
307
|
+
const operation = operations[operationId];
|
|
308
|
+
if (operation === null) {
|
|
309
|
+
removeOperationGuidance(document, operationId);
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
ensureMap(document, ["operations", operationId]);
|
|
313
|
+
replaceNode(document, [
|
|
314
|
+
"operations",
|
|
315
|
+
operationId,
|
|
316
|
+
"guidance"
|
|
317
|
+
], operation.guidance);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
/** Patch only Structured-owned official nodes and retain all representable unowned YAML evidence. */
|
|
321
|
+
function patchActiveRootOfficialFields(content, update) {
|
|
322
|
+
const validated = ActiveRootStructuredUpdateSchema.parse(update);
|
|
323
|
+
const document = editableDocument(content);
|
|
324
|
+
replaceNode(document, ["schema"], validated.schema);
|
|
325
|
+
if (validated.context === null) document.delete("context");
|
|
326
|
+
else replaceNode(document, ["context"], validated.context);
|
|
327
|
+
patchRules(document, validated.rules);
|
|
328
|
+
patchOperations(document, validated.operations);
|
|
329
|
+
return document.toString({ lineWidth: 0 });
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
//#endregion
|
|
333
|
+
export { ActiveRootOfficialConfigSchema as a, MAX_ACTIVE_ROOT_CONTEXT_BYTES as c, ActiveRootMutationSchema as i, patchActiveRootOfficialFields as n, ActiveRootRevisionSchema as o, validateActiveRootRawYaml as r, ActiveRootStructuredUpdateSchema as s, inspectActiveRootOfficialConfig as t };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "./document-translation-BNbM3fEj.mjs";
|
|
2
|
+
import "./sounds-vwRCMSzL.mjs";
|
|
3
|
+
import "./notifications-B43aFxw9.mjs";
|
|
4
|
+
import "./index-CkwSp1WZ.mjs";
|
|
5
|
+
import { _ as ActiveRootStructuredUpdateSchema, a as ActiveRootConfigDiagnostic, c as ActiveRootMutation, d as ActiveRootOfficialConfig, f as ActiveRootOfficialConfigSchema, g as ActiveRootStructuredUpdate, h as ActiveRootRevisionSchema, i as ActiveRootConfig, l as ActiveRootMutationResult, m as ActiveRootRevision, n as patchActiveRootOfficialFields, o as ActiveRootConfigFile, p as ActiveRootRawValidation, r as validateActiveRootRawYaml, s as ActiveRootConfigInspection, t as inspectActiveRootOfficialConfig, u as ActiveRootMutationSchema, v as MAX_ACTIVE_ROOT_CONTEXT_BYTES } from "./active-root-config-DxRGkvOp.mjs";
|
|
6
|
+
export { ActiveRootConfig, ActiveRootConfigDiagnostic, ActiveRootConfigFile, ActiveRootConfigInspection, ActiveRootMutation, ActiveRootMutationResult, ActiveRootMutationSchema, ActiveRootOfficialConfig, ActiveRootOfficialConfigSchema, ActiveRootRawValidation, ActiveRootRevision, ActiveRootRevisionSchema, ActiveRootStructuredUpdate, ActiveRootStructuredUpdateSchema, MAX_ACTIVE_ROOT_CONTEXT_BYTES, inspectActiveRootOfficialConfig, patchActiveRootOfficialFields, validateActiveRootRawYaml };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as ActiveRootOfficialConfigSchema, c as MAX_ACTIVE_ROOT_CONTEXT_BYTES, i as ActiveRootMutationSchema, n as patchActiveRootOfficialFields, o as ActiveRootRevisionSchema, r as validateActiveRootRawYaml, s as ActiveRootStructuredUpdateSchema, t as inspectActiveRootOfficialConfig } from "./active-root-config-L5QaMb3A.mjs";
|
|
2
|
+
|
|
3
|
+
export { ActiveRootMutationSchema, ActiveRootOfficialConfigSchema, ActiveRootRevisionSchema, ActiveRootStructuredUpdateSchema, MAX_ACTIVE_ROOT_CONTEXT_BYTES, inspectActiveRootOfficialConfig, patchActiveRootOfficialFields, validateActiveRootRawYaml };
|
|
@@ -27,32 +27,32 @@ declare const AppDaemonWorkspaceBindingSchema: z.ZodObject<{
|
|
|
27
27
|
}>>;
|
|
28
28
|
}, "strip", z.ZodTypeAny, {
|
|
29
29
|
id: string;
|
|
30
|
-
git: {
|
|
31
|
-
remoteUrl: string | null;
|
|
32
|
-
branch: string | null;
|
|
33
|
-
githubSlug: string | null;
|
|
34
|
-
} | null;
|
|
35
|
-
credential: string | null;
|
|
36
30
|
backendUrl: string;
|
|
31
|
+
credential: string | null;
|
|
37
32
|
projectDir: string;
|
|
38
33
|
ownership: "daemon-managed" | "external";
|
|
39
34
|
registeredAt: number;
|
|
40
35
|
managedGeneration: number | null;
|
|
41
36
|
shutdown: "managed" | "external-owner" | "close-only";
|
|
42
|
-
}, {
|
|
43
|
-
id: string;
|
|
44
37
|
git: {
|
|
45
38
|
remoteUrl: string | null;
|
|
46
39
|
branch: string | null;
|
|
47
40
|
githubSlug: string | null;
|
|
48
41
|
} | null;
|
|
49
|
-
|
|
42
|
+
}, {
|
|
43
|
+
id: string;
|
|
50
44
|
backendUrl: string;
|
|
45
|
+
credential: string | null;
|
|
51
46
|
projectDir: string;
|
|
52
47
|
ownership: "daemon-managed" | "external";
|
|
53
48
|
registeredAt: number;
|
|
54
49
|
managedGeneration: number | null;
|
|
55
50
|
shutdown: "managed" | "external-owner" | "close-only";
|
|
51
|
+
git: {
|
|
52
|
+
remoteUrl: string | null;
|
|
53
|
+
branch: string | null;
|
|
54
|
+
githubSlug: string | null;
|
|
55
|
+
} | null;
|
|
56
56
|
}>;
|
|
57
57
|
type AppDaemonWorkspaceBinding = z.infer<typeof AppDaemonWorkspaceBindingSchema>;
|
|
58
58
|
/** Complete current daemon ledger; clients replace by revision instead of applying event deltas. */
|
|
@@ -82,66 +82,66 @@ declare const AppDaemonWorkspaceSnapshotSchema: z.ZodObject<{
|
|
|
82
82
|
}>>;
|
|
83
83
|
}, "strip", z.ZodTypeAny, {
|
|
84
84
|
id: string;
|
|
85
|
-
git: {
|
|
86
|
-
remoteUrl: string | null;
|
|
87
|
-
branch: string | null;
|
|
88
|
-
githubSlug: string | null;
|
|
89
|
-
} | null;
|
|
90
|
-
credential: string | null;
|
|
91
85
|
backendUrl: string;
|
|
86
|
+
credential: string | null;
|
|
92
87
|
projectDir: string;
|
|
93
88
|
ownership: "daemon-managed" | "external";
|
|
94
89
|
registeredAt: number;
|
|
95
90
|
managedGeneration: number | null;
|
|
96
91
|
shutdown: "managed" | "external-owner" | "close-only";
|
|
97
|
-
}, {
|
|
98
|
-
id: string;
|
|
99
92
|
git: {
|
|
100
93
|
remoteUrl: string | null;
|
|
101
94
|
branch: string | null;
|
|
102
95
|
githubSlug: string | null;
|
|
103
96
|
} | null;
|
|
104
|
-
|
|
97
|
+
}, {
|
|
98
|
+
id: string;
|
|
105
99
|
backendUrl: string;
|
|
100
|
+
credential: string | null;
|
|
106
101
|
projectDir: string;
|
|
107
102
|
ownership: "daemon-managed" | "external";
|
|
108
103
|
registeredAt: number;
|
|
109
104
|
managedGeneration: number | null;
|
|
110
105
|
shutdown: "managed" | "external-owner" | "close-only";
|
|
111
|
-
}>, "many">;
|
|
112
|
-
}, "strip", z.ZodTypeAny, {
|
|
113
|
-
revision: number;
|
|
114
|
-
workspaces: {
|
|
115
|
-
id: string;
|
|
116
106
|
git: {
|
|
117
107
|
remoteUrl: string | null;
|
|
118
108
|
branch: string | null;
|
|
119
109
|
githubSlug: string | null;
|
|
120
110
|
} | null;
|
|
121
|
-
|
|
111
|
+
}>, "many">;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
revision: number;
|
|
114
|
+
workspaces: {
|
|
115
|
+
id: string;
|
|
122
116
|
backendUrl: string;
|
|
117
|
+
credential: string | null;
|
|
123
118
|
projectDir: string;
|
|
124
119
|
ownership: "daemon-managed" | "external";
|
|
125
120
|
registeredAt: number;
|
|
126
121
|
managedGeneration: number | null;
|
|
127
122
|
shutdown: "managed" | "external-owner" | "close-only";
|
|
128
|
-
}[];
|
|
129
|
-
}, {
|
|
130
|
-
revision: number;
|
|
131
|
-
workspaces: {
|
|
132
|
-
id: string;
|
|
133
123
|
git: {
|
|
134
124
|
remoteUrl: string | null;
|
|
135
125
|
branch: string | null;
|
|
136
126
|
githubSlug: string | null;
|
|
137
127
|
} | null;
|
|
138
|
-
|
|
128
|
+
}[];
|
|
129
|
+
}, {
|
|
130
|
+
revision: number;
|
|
131
|
+
workspaces: {
|
|
132
|
+
id: string;
|
|
139
133
|
backendUrl: string;
|
|
134
|
+
credential: string | null;
|
|
140
135
|
projectDir: string;
|
|
141
136
|
ownership: "daemon-managed" | "external";
|
|
142
137
|
registeredAt: number;
|
|
143
138
|
managedGeneration: number | null;
|
|
144
139
|
shutdown: "managed" | "external-owner" | "close-only";
|
|
140
|
+
git: {
|
|
141
|
+
remoteUrl: string | null;
|
|
142
|
+
branch: string | null;
|
|
143
|
+
githubSlug: string | null;
|
|
144
|
+
} | null;
|
|
145
145
|
}[];
|
|
146
146
|
}>;
|
|
147
147
|
type AppDaemonWorkspaceSnapshot = z.infer<typeof AppDaemonWorkspaceSnapshotSchema>;
|
|
@@ -232,68 +232,68 @@ declare const AppDaemonStartManagedProjectResponseSchema: z.ZodDiscriminatedUnio
|
|
|
232
232
|
}>>;
|
|
233
233
|
}, "strip", z.ZodTypeAny, {
|
|
234
234
|
id: string;
|
|
235
|
-
git: {
|
|
236
|
-
remoteUrl: string | null;
|
|
237
|
-
branch: string | null;
|
|
238
|
-
githubSlug: string | null;
|
|
239
|
-
} | null;
|
|
240
|
-
credential: string | null;
|
|
241
235
|
backendUrl: string;
|
|
236
|
+
credential: string | null;
|
|
242
237
|
projectDir: string;
|
|
243
238
|
ownership: "daemon-managed" | "external";
|
|
244
239
|
registeredAt: number;
|
|
245
240
|
managedGeneration: number | null;
|
|
246
241
|
shutdown: "managed" | "external-owner" | "close-only";
|
|
247
|
-
}, {
|
|
248
|
-
id: string;
|
|
249
242
|
git: {
|
|
250
243
|
remoteUrl: string | null;
|
|
251
244
|
branch: string | null;
|
|
252
245
|
githubSlug: string | null;
|
|
253
246
|
} | null;
|
|
254
|
-
|
|
247
|
+
}, {
|
|
248
|
+
id: string;
|
|
255
249
|
backendUrl: string;
|
|
250
|
+
credential: string | null;
|
|
256
251
|
projectDir: string;
|
|
257
252
|
ownership: "daemon-managed" | "external";
|
|
258
253
|
registeredAt: number;
|
|
259
254
|
managedGeneration: number | null;
|
|
260
255
|
shutdown: "managed" | "external-owner" | "close-only";
|
|
256
|
+
git: {
|
|
257
|
+
remoteUrl: string | null;
|
|
258
|
+
branch: string | null;
|
|
259
|
+
githubSlug: string | null;
|
|
260
|
+
} | null;
|
|
261
261
|
}>;
|
|
262
262
|
alreadyRunning: z.ZodBoolean;
|
|
263
263
|
}, "strip", z.ZodTypeAny, {
|
|
264
264
|
ok: true;
|
|
265
265
|
workspace: {
|
|
266
266
|
id: string;
|
|
267
|
-
git: {
|
|
268
|
-
remoteUrl: string | null;
|
|
269
|
-
branch: string | null;
|
|
270
|
-
githubSlug: string | null;
|
|
271
|
-
} | null;
|
|
272
|
-
credential: string | null;
|
|
273
267
|
backendUrl: string;
|
|
268
|
+
credential: string | null;
|
|
274
269
|
projectDir: string;
|
|
275
270
|
ownership: "daemon-managed" | "external";
|
|
276
271
|
registeredAt: number;
|
|
277
272
|
managedGeneration: number | null;
|
|
278
273
|
shutdown: "managed" | "external-owner" | "close-only";
|
|
274
|
+
git: {
|
|
275
|
+
remoteUrl: string | null;
|
|
276
|
+
branch: string | null;
|
|
277
|
+
githubSlug: string | null;
|
|
278
|
+
} | null;
|
|
279
279
|
};
|
|
280
280
|
alreadyRunning: boolean;
|
|
281
281
|
}, {
|
|
282
282
|
ok: true;
|
|
283
283
|
workspace: {
|
|
284
284
|
id: string;
|
|
285
|
-
git: {
|
|
286
|
-
remoteUrl: string | null;
|
|
287
|
-
branch: string | null;
|
|
288
|
-
githubSlug: string | null;
|
|
289
|
-
} | null;
|
|
290
|
-
credential: string | null;
|
|
291
285
|
backendUrl: string;
|
|
286
|
+
credential: string | null;
|
|
292
287
|
projectDir: string;
|
|
293
288
|
ownership: "daemon-managed" | "external";
|
|
294
289
|
registeredAt: number;
|
|
295
290
|
managedGeneration: number | null;
|
|
296
291
|
shutdown: "managed" | "external-owner" | "close-only";
|
|
292
|
+
git: {
|
|
293
|
+
remoteUrl: string | null;
|
|
294
|
+
branch: string | null;
|
|
295
|
+
githubSlug: string | null;
|
|
296
|
+
} | null;
|
|
297
297
|
};
|
|
298
298
|
alreadyRunning: boolean;
|
|
299
299
|
}>, z.ZodObject<{
|
|
@@ -302,21 +302,21 @@ declare const AppDaemonStartManagedProjectResponseSchema: z.ZodDiscriminatedUnio
|
|
|
302
302
|
code: z.ZodEnum<["UNSUPPORTED", "INVALID_DIRECTORY", "SPAWN_FAILED", "GENERATION_MISMATCH", "INVALID_REQUEST"]>;
|
|
303
303
|
message: z.ZodString;
|
|
304
304
|
}, "strip", z.ZodTypeAny, {
|
|
305
|
-
code: "
|
|
305
|
+
code: "UNSUPPORTED" | "INVALID_DIRECTORY" | "SPAWN_FAILED" | "GENERATION_MISMATCH" | "INVALID_REQUEST";
|
|
306
306
|
message: string;
|
|
307
307
|
}, {
|
|
308
|
-
code: "
|
|
308
|
+
code: "UNSUPPORTED" | "INVALID_DIRECTORY" | "SPAWN_FAILED" | "GENERATION_MISMATCH" | "INVALID_REQUEST";
|
|
309
309
|
message: string;
|
|
310
310
|
}>;
|
|
311
311
|
}, "strip", z.ZodTypeAny, {
|
|
312
312
|
error: {
|
|
313
|
-
code: "
|
|
313
|
+
code: "UNSUPPORTED" | "INVALID_DIRECTORY" | "SPAWN_FAILED" | "GENERATION_MISMATCH" | "INVALID_REQUEST";
|
|
314
314
|
message: string;
|
|
315
315
|
};
|
|
316
316
|
ok: false;
|
|
317
317
|
}, {
|
|
318
318
|
error: {
|
|
319
|
-
code: "
|
|
319
|
+
code: "UNSUPPORTED" | "INVALID_DIRECTORY" | "SPAWN_FAILED" | "GENERATION_MISMATCH" | "INVALID_REQUEST";
|
|
320
320
|
message: string;
|
|
321
321
|
};
|
|
322
322
|
ok: false;
|
|
@@ -338,21 +338,21 @@ declare const AppDaemonStopManagedProjectResponseSchema: z.ZodDiscriminatedUnion
|
|
|
338
338
|
code: z.ZodEnum<["UNSUPPORTED", "INVALID_DIRECTORY", "SPAWN_FAILED", "GENERATION_MISMATCH", "INVALID_REQUEST"]>;
|
|
339
339
|
message: z.ZodString;
|
|
340
340
|
}, "strip", z.ZodTypeAny, {
|
|
341
|
-
code: "
|
|
341
|
+
code: "UNSUPPORTED" | "INVALID_DIRECTORY" | "SPAWN_FAILED" | "GENERATION_MISMATCH" | "INVALID_REQUEST";
|
|
342
342
|
message: string;
|
|
343
343
|
}, {
|
|
344
|
-
code: "
|
|
344
|
+
code: "UNSUPPORTED" | "INVALID_DIRECTORY" | "SPAWN_FAILED" | "GENERATION_MISMATCH" | "INVALID_REQUEST";
|
|
345
345
|
message: string;
|
|
346
346
|
}>;
|
|
347
347
|
}, "strip", z.ZodTypeAny, {
|
|
348
348
|
error: {
|
|
349
|
-
code: "
|
|
349
|
+
code: "UNSUPPORTED" | "INVALID_DIRECTORY" | "SPAWN_FAILED" | "GENERATION_MISMATCH" | "INVALID_REQUEST";
|
|
350
350
|
message: string;
|
|
351
351
|
};
|
|
352
352
|
ok: false;
|
|
353
353
|
}, {
|
|
354
354
|
error: {
|
|
355
|
-
code: "
|
|
355
|
+
code: "UNSUPPORTED" | "INVALID_DIRECTORY" | "SPAWN_FAILED" | "GENERATION_MISMATCH" | "INVALID_REQUEST";
|
|
356
356
|
message: string;
|
|
357
357
|
};
|
|
358
358
|
ok: false;
|