@orkestrel/scaffold 0.0.59 → 0.0.61
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/README.md +13 -10
- package/dist/bin/main.js +632 -320
- package/dist/bin/main.js.map +1 -1
- package/dist/host/CLAUDE.md +5 -1
- package/dist/host/agents/orchestration.md +44 -19
- package/dist/host/agents/skills/enterprise-bootstrap/SKILL.md +91 -82
- package/dist/host/agents/skills/enterprise-bootstrap/references/bootstrap-reference.md +5 -5
- package/dist/host/agents/skills/enterprise-bootstrap/references/components.md +15 -15
- package/dist/host/agents/skills/enterprise-bootstrap/references/inputs.md +501 -0
- package/dist/host/agents/skills/enterprise-bootstrap/references/inspection.md +167 -0
- package/dist/host/agents/skills/enterprise-bootstrap/references/utilities.md +2 -2
- package/dist/host/agents/skills/orkestrel-debrief/SKILL.md +2 -2
- package/dist/host/agents/skills/orkestrel-debrief/references/instruction-audit.md +10 -9
- package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +21 -11
- package/dist/host/agents/skills/orkestrel-falsify/references/brief.md +20 -2
- package/dist/host/agents/skills/orkestrel-harden-package/SKILL.md +1 -1
- package/dist/host/agents/skills/orkestrel-harden-package/references/hardening.md +1 -1
- package/dist/host/agents/skills/orkestrel-harden-package/references/research.md +1 -1
- package/dist/host/agents/skills/orkestrel-polish-surface/SKILL.md +4 -1
- package/dist/host/agents/skills/orkestrel-polish-surface/references/capture-harness.md +71 -50
- package/dist/host/agents/skills/orkestrel-prove-journey/SKILL.md +93 -29
- package/dist/host/agents/skills/orkestrel-prove-journey/agents/openai.yaml +1 -1
- package/dist/host/agents/skills/orkestrel-prove-journey/references/captures.md +62 -38
- package/dist/host/agents/skills/orkestrel-prove-journey/references/decide.md +68 -0
- package/dist/host/agents/skills/orkestrel-prove-journey/references/layer.md +107 -79
- package/dist/host/agents/skills/orkestrel-prove-journey/references/statechart.md +84 -0
- package/dist/host/agents/skills/orkestrel-prove-journey/references/styles.md +87 -0
- package/dist/host/agents/templates/brief.md +16 -7
- package/dist/host/agents/transports/claude.md +4 -2
- package/dist/host/agents/transports/codex.md +4 -1
- package/dist/host/claude/agents/analyst.md +3 -1
- package/dist/host/claude/agents/application.md +1 -1
- package/dist/host/claude/agents/builder.md +3 -3
- package/dist/host/claude/agents/checker.md +5 -0
- package/dist/host/claude/agents/grok.md +15 -5
- package/dist/host/claude/agents/implementer.md +1 -1
- package/dist/host/claude/agents/orkestrel.md +12 -11
- package/dist/host/claude/agents/planner.md +10 -0
- package/dist/host/claude/agents/reviewer.md +14 -8
- package/dist/host/claude/agents/sol.md +3 -1
- package/dist/host/claude/agents/verifier.md +2 -4
- package/dist/host/claude/rules/architecture.md +7 -5
- package/dist/host/claude/rules/documentation.md +1 -0
- package/dist/host/claude/rules/names.md +23 -5
- package/dist/host/claude/rules/patterns.md +1 -0
- package/dist/host/claude/rules/quality.md +1 -1
- package/dist/host/claude/rules/tests.md +3 -3
- package/dist/host/claude/rules/typescript.md +4 -1
- package/dist/host/claude/rules/writing.md +2 -2
- package/dist/host/claude/skills/orkestrel-prove-journey/SKILL.md +1 -1
- package/dist/host/codex/agents/builder.toml +6 -6
- package/dist/host/codex/agents/checker.toml +2 -1
- package/dist/host/codex/agents/grok.toml +12 -5
- package/dist/host/codex/agents/implementer.toml +2 -2
- package/dist/host/codex/agents/opus.toml +6 -1
- package/dist/host/codex/agents/planner.toml +11 -6
- package/dist/host/codex/agents/reviewer.toml +8 -6
- package/dist/host/guides/scaffold.md +39 -14
- package/dist/host/manifest.json +81 -51
- package/dist/host/scripts/codex.sh +0 -0
- package/dist/host/scripts/cursor.sh +0 -0
- package/dist/host/scripts/deps.sh +0 -0
- package/dist/host/scripts/ollama.sh +0 -0
- package/dist/src/core/index.cjs +424 -282
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +361 -220
- package/dist/src/core/index.d.ts +361 -220
- package/dist/src/core/index.js +421 -283
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +208 -170
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +276 -152
- package/dist/src/server/index.d.ts +276 -152
- package/dist/src/server/index.js +200 -172
- package/dist/src/server/index.js.map +1 -1
- package/package.json +8 -7
|
@@ -9,7 +9,7 @@ let node_url = require("node:url");
|
|
|
9
9
|
let _orkestrel_emitter = require("@orkestrel/emitter");
|
|
10
10
|
//#region src/server/constants.ts
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Matches the drive prefix a Windows host path may open with.
|
|
13
13
|
*
|
|
14
14
|
* @remarks
|
|
15
15
|
* The one segment allowed to carry a colon. Every other segment is measured by
|
|
@@ -18,7 +18,7 @@ let _orkestrel_emitter = require("@orkestrel/emitter");
|
|
|
18
18
|
*/
|
|
19
19
|
var DRIVE_PATTERN = /^[A-Za-z]:$/;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Matches the visible characters no host path segment may carry.
|
|
22
22
|
*
|
|
23
23
|
* @remarks
|
|
24
24
|
* Narrower than the core path law by exactly one character: a backslash is a
|
|
@@ -27,7 +27,7 @@ var DRIVE_PATTERN = /^[A-Za-z]:$/;
|
|
|
27
27
|
*/
|
|
28
28
|
var INVALID_SEGMENT_CHARACTER_PATTERN = /[<>:"|?*]/;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Matches the Windows device names that stay reserved even when an extension follows.
|
|
31
31
|
*
|
|
32
32
|
* @remarks
|
|
33
33
|
* Refused on every host rather than only on Windows. A generated workspace is
|
|
@@ -36,7 +36,7 @@ var INVALID_SEGMENT_CHARACTER_PATTERN = /[<>:"|?*]/;
|
|
|
36
36
|
*/
|
|
37
37
|
var RESERVED_SEGMENT_PATTERN = /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9]|conin\$|conout\$)(?:\..*)?$/i;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* Matches the exact SHA-256 syntax a digest is stated in: sixty-four lowercase hexadecimal digits.
|
|
40
40
|
*
|
|
41
41
|
* @remarks
|
|
42
42
|
* Fixed length, unlike the core byte encoding, because a digest is one value of
|
|
@@ -45,7 +45,7 @@ var RESERVED_SEGMENT_PATTERN = /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9]|conin\$|co
|
|
|
45
45
|
*/
|
|
46
46
|
var DIGEST_PATTERN = /^[0-9a-f]{64}$/;
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* Matches the Git branch syntax the repository endpoint accepts.
|
|
49
49
|
*
|
|
50
50
|
* @remarks
|
|
51
51
|
* A branch is caller-supplied and reaches a URL path, so it is closed to
|
|
@@ -55,7 +55,7 @@ var DIGEST_PATTERN = /^[0-9a-f]{64}$/;
|
|
|
55
55
|
*/
|
|
56
56
|
var BRANCH_PATTERN = /^(?!.*\.\.)[A-Za-z0-9][A-Za-z0-9._/-]*$/;
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* Caps the UTF-8 bytes one host path segment may encode to.
|
|
59
59
|
*
|
|
60
60
|
* @remarks
|
|
61
61
|
* The limit every supported filesystem shares for a single name. It is a byte
|
|
@@ -64,7 +64,7 @@ var BRANCH_PATTERN = /^(?!.*\.\.)[A-Za-z0-9][A-Za-z0-9._/-]*$/;
|
|
|
64
64
|
*/
|
|
65
65
|
var MAX_PATH_SEGMENT_BYTES = 255;
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* Caps the segments one host path may carry.
|
|
68
68
|
*
|
|
69
69
|
* @remarks
|
|
70
70
|
* Bounds the work a path decision costs before any filesystem call is made. With
|
|
@@ -73,7 +73,7 @@ var MAX_PATH_SEGMENT_BYTES = 255;
|
|
|
73
73
|
*/
|
|
74
74
|
var MAX_PATH_DEPTH = 64;
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
* Caps the paths one target's working-tree inventory may report.
|
|
77
77
|
*
|
|
78
78
|
* @remarks
|
|
79
79
|
* Far above the core collection ceiling, and deliberately so. A tracked or dirty
|
|
@@ -83,24 +83,24 @@ var MAX_PATH_DEPTH = 64;
|
|
|
83
83
|
* verb on it.
|
|
84
84
|
*/
|
|
85
85
|
var MAX_INVENTORY_PATHS = 1e5;
|
|
86
|
-
/**
|
|
86
|
+
/** Caps the characters one caller-supplied upstream endpoint may carry. */
|
|
87
87
|
var MAX_ENDPOINT_LENGTH = 2048;
|
|
88
|
-
/**
|
|
88
|
+
/** Caps the characters one repository branch may carry. */
|
|
89
89
|
var MAX_BRANCH_LENGTH = 255;
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
91
|
+
* Caps the simultaneous upstream requests.
|
|
92
92
|
*
|
|
93
93
|
* @remarks
|
|
94
94
|
* A ceiling rather than a default: the reader picks what it opens by, and this
|
|
95
95
|
* is only what a caller may raise it to.
|
|
96
96
|
*/
|
|
97
97
|
var MAX_UPSTREAM_CONCURRENCY = 64;
|
|
98
|
-
/**
|
|
98
|
+
/** Caps the retries one upstream request may be given after a transport fault. */
|
|
99
99
|
var MAX_UPSTREAM_RETRIES = 5;
|
|
100
|
-
/**
|
|
100
|
+
/** Caps the timeout one upstream request may be given, in milliseconds. */
|
|
101
101
|
var MAX_UPSTREAM_TIMEOUT = 3e5;
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
103
|
+
* Reserves the metadata name a staged vendored host writes at its own root.
|
|
104
104
|
*
|
|
105
105
|
* @remarks
|
|
106
106
|
* The one name a vendored file may never claim, because the staged root holds
|
|
@@ -109,14 +109,65 @@ var MAX_UPSTREAM_TIMEOUT = 3e5;
|
|
|
109
109
|
* than repeating a literal that only agrees by inspection.
|
|
110
110
|
*/
|
|
111
111
|
var MANIFEST_NAME = "manifest.json";
|
|
112
|
+
/** Holds the raw content host a repository read addresses when a caller names none. */
|
|
113
|
+
var DEFAULT_REPOSITORY_BASE = "https://raw.githubusercontent.com";
|
|
114
|
+
/** Holds the registry a version read addresses when a caller names none. */
|
|
115
|
+
var DEFAULT_REGISTRY_BASE = "https://registry.npmjs.org";
|
|
116
|
+
/** Holds the repository branch a raw content read addresses when a caller names none. */
|
|
117
|
+
var DEFAULT_BRANCH = "main";
|
|
118
|
+
/**
|
|
119
|
+
* Sets the timeout one upstream request is given when a caller names none, in milliseconds.
|
|
120
|
+
*
|
|
121
|
+
* @remarks
|
|
122
|
+
* Both endpoints open at this value; a caller raises either one on its own up to
|
|
123
|
+
* {@link MAX_UPSTREAM_TIMEOUT}.
|
|
124
|
+
*/
|
|
125
|
+
var DEFAULT_UPSTREAM_TIMEOUT = 1e4;
|
|
126
|
+
/**
|
|
127
|
+
* Sets the simultaneous upstream requests a reader opens with, under
|
|
128
|
+
* {@link MAX_UPSTREAM_CONCURRENCY}.
|
|
129
|
+
*/
|
|
130
|
+
var DEFAULT_UPSTREAM_CONCURRENCY = 6;
|
|
131
|
+
/**
|
|
132
|
+
* Sets the retries one upstream request is given when a caller names none.
|
|
133
|
+
*
|
|
134
|
+
* @remarks
|
|
135
|
+
* A read is attempted once by default. Retrying is the caller's decision because
|
|
136
|
+
* a repeated request costs the upstream host, not this package.
|
|
137
|
+
*/
|
|
138
|
+
var DEFAULT_UPSTREAM_RETRIES = 0;
|
|
139
|
+
/**
|
|
140
|
+
* Names the npm scope and repository owner the fleet's packages and sources are
|
|
141
|
+
* published under.
|
|
142
|
+
*/
|
|
143
|
+
var ORKESTREL_SCOPE = "orkestrel";
|
|
144
|
+
/**
|
|
145
|
+
* Names the repository this package's own vendored files are served from.
|
|
146
|
+
*
|
|
147
|
+
* @remarks
|
|
148
|
+
* This package's bare name, stated rather than derived, because the reader has no
|
|
149
|
+
* manifest to read it out of and one raw content host serves both the fleet's
|
|
150
|
+
* guides and these files.
|
|
151
|
+
*/
|
|
152
|
+
var SCAFFOLD_REPOSITORY = "scaffold";
|
|
153
|
+
/** Holds the note a release carries when its packument names no readable latest version. */
|
|
154
|
+
var UNREADABLE_VERSION_NOTE = "the answer carries no readable latest version";
|
|
155
|
+
/**
|
|
156
|
+
* Names the media type that selects the registry's abbreviated packument.
|
|
157
|
+
*
|
|
158
|
+
* @remarks
|
|
159
|
+
* Sent on exactly the reads that want a version, so the registry answers with the
|
|
160
|
+
* smaller document instead of the whole packument.
|
|
161
|
+
*/
|
|
162
|
+
var PACKUMENT_MEDIA_TYPE = "application/vnd.npm.install-v1+json";
|
|
112
163
|
//#endregion
|
|
113
164
|
//#region src/server/validators.ts
|
|
114
165
|
/**
|
|
115
|
-
*
|
|
166
|
+
* Narrows a value to a path naming a location on this host.
|
|
116
167
|
*
|
|
117
168
|
* @param value - The candidate host path.
|
|
118
|
-
* @returns
|
|
119
|
-
* portable across the supported filesystems.
|
|
169
|
+
* @returns True if the value is a bounded absolute or relative path whose every segment
|
|
170
|
+
* is portable across the supported filesystems; false otherwise.
|
|
120
171
|
*
|
|
121
172
|
* @remarks
|
|
122
173
|
* The counterpart to the core path law, not a copy of it. A target directory and
|
|
@@ -173,7 +224,7 @@ function isFilesystemPath(value) {
|
|
|
173
224
|
});
|
|
174
225
|
}
|
|
175
226
|
/**
|
|
176
|
-
*
|
|
227
|
+
* Narrows a value to one exact SHA-256 digest.
|
|
177
228
|
*
|
|
178
229
|
* @remarks
|
|
179
230
|
* The identity a vendored host manifest and a write precondition are both stated
|
|
@@ -190,10 +241,11 @@ function isFilesystemPath(value) {
|
|
|
190
241
|
*/
|
|
191
242
|
var isDigest = (0, _orkestrel_contract.stringOf)({ pattern: DIGEST_PATTERN });
|
|
192
243
|
/**
|
|
193
|
-
*
|
|
244
|
+
* Narrows a value to a working-tree inventory within the limit one target may report.
|
|
194
245
|
*
|
|
195
246
|
* @param value - The candidate inventory.
|
|
196
|
-
* @returns
|
|
247
|
+
* @returns True if the value is an array of no more than
|
|
248
|
+
* `MAX_INVENTORY_PATHS` items; false otherwise.
|
|
197
249
|
*
|
|
198
250
|
* @remarks
|
|
199
251
|
* Compose this ahead of an element guard exactly as the core collection guard is
|
|
@@ -215,7 +267,7 @@ function isInventory(value) {
|
|
|
215
267
|
return (0, _orkestrel_contract.holds)(() => (0, _orkestrel_contract.isArray)(value) && value.length <= 1e5);
|
|
216
268
|
}
|
|
217
269
|
/**
|
|
218
|
-
*
|
|
270
|
+
* Narrows a value to a bounded upstream endpoint.
|
|
219
271
|
*
|
|
220
272
|
* @remarks
|
|
221
273
|
* Length only. Which schemes and hosts an endpoint may name is the reader's law,
|
|
@@ -227,7 +279,7 @@ var isEndpoint = (0, _orkestrel_contract.stringOf)({
|
|
|
227
279
|
max: MAX_ENDPOINT_LENGTH
|
|
228
280
|
});
|
|
229
281
|
/**
|
|
230
|
-
*
|
|
282
|
+
* Narrows a value to a Git branch the repository endpoint accepts.
|
|
231
283
|
*
|
|
232
284
|
* @remarks
|
|
233
285
|
* A branch reaches the repository URL's path, so the syntax is closed rather than
|
|
@@ -247,7 +299,7 @@ var isBranch = (0, _orkestrel_contract.stringOf)({
|
|
|
247
299
|
pattern: BRANCH_PATTERN
|
|
248
300
|
});
|
|
249
301
|
/**
|
|
250
|
-
*
|
|
302
|
+
* Narrows a value to a per-request timeout in milliseconds.
|
|
251
303
|
*
|
|
252
304
|
* @remarks
|
|
253
305
|
* A whole number of milliseconds, at least one and no more than
|
|
@@ -256,7 +308,7 @@ var isBranch = (0, _orkestrel_contract.stringOf)({
|
|
|
256
308
|
*/
|
|
257
309
|
var isTimeout = (0, _orkestrel_contract.andOf)(_orkestrel_contract.isInteger, (0, _orkestrel_contract.boundsOf)(1, MAX_UPSTREAM_TIMEOUT));
|
|
258
310
|
/**
|
|
259
|
-
*
|
|
311
|
+
* Narrows a value to a bounded list of `@orkestrel` package names.
|
|
260
312
|
*
|
|
261
313
|
* @remarks
|
|
262
314
|
* Composed from the core collection and dependency-name guards rather than
|
|
@@ -273,7 +325,7 @@ var isTimeout = (0, _orkestrel_contract.andOf)(_orkestrel_contract.isInteger, (0
|
|
|
273
325
|
*/
|
|
274
326
|
var isDependencyNames = (0, _orkestrel_contract.andOf)(_src_core.isCollection, (0, _orkestrel_contract.arrayOf)(_src_core.isDependencyName));
|
|
275
327
|
/**
|
|
276
|
-
*
|
|
328
|
+
* Narrows a value to a bounded list of target-relative paths.
|
|
277
329
|
*
|
|
278
330
|
* @remarks
|
|
279
331
|
* Composed from the core collection and path guards rather than restated, so
|
|
@@ -290,10 +342,10 @@ var isDependencyNames = (0, _orkestrel_contract.andOf)(_src_core.isCollection, (
|
|
|
290
342
|
* ```
|
|
291
343
|
*/
|
|
292
344
|
var isPaths = (0, _orkestrel_contract.andOf)(_src_core.isCollection, (0, _orkestrel_contract.arrayOf)(_src_core.isPath));
|
|
293
|
-
/**
|
|
345
|
+
/** Narrows a value to a bounded list of declared runtime dependencies. */
|
|
294
346
|
var isDependencies = (0, _orkestrel_contract.andOf)(_src_core.isCollection, (0, _orkestrel_contract.arrayOf)(_src_core.isDependency));
|
|
295
347
|
/**
|
|
296
|
-
*
|
|
348
|
+
* Narrows a value to one {@link ManifestRegionSet}.
|
|
297
349
|
*
|
|
298
350
|
* @remarks
|
|
299
351
|
* The whole closed record a manifest-writing method accepts, so a caller
|
|
@@ -315,12 +367,12 @@ var isManifestRegionSet = (0, _orkestrel_contract.recordOf)({
|
|
|
315
367
|
}),
|
|
316
368
|
scripts: (0, _orkestrel_contract.andOf)(_src_core.isCollection, (0, _orkestrel_contract.arrayOf)(_src_core.isManifestScript))
|
|
317
369
|
});
|
|
318
|
-
/**
|
|
370
|
+
/** Narrows a value to a bounded list of fetched guide mirrors. */
|
|
319
371
|
var isMirrors = (0, _orkestrel_contract.andOf)(_src_core.isCollection, (0, _orkestrel_contract.arrayOf)(_src_core.isMirror));
|
|
320
|
-
/**
|
|
372
|
+
/** Narrows a value to a bounded list of fleet catalog rows. */
|
|
321
373
|
var isCatalogEntries = (0, _orkestrel_contract.andOf)(_src_core.isCollection, (0, _orkestrel_contract.arrayOf)(_src_core.isCatalogEntry));
|
|
322
374
|
/**
|
|
323
|
-
*
|
|
375
|
+
* Narrows a value to one {@link ManifestEntry}.
|
|
324
376
|
*
|
|
325
377
|
* @remarks
|
|
326
378
|
* Both paths are measured by the core path law, because a vendored host's
|
|
@@ -347,7 +399,7 @@ var isManifestEntry = (0, _orkestrel_contract.recordOf)({
|
|
|
347
399
|
digest: isDigest
|
|
348
400
|
});
|
|
349
401
|
/**
|
|
350
|
-
*
|
|
402
|
+
* Narrows a value to one {@link HostManifest}.
|
|
351
403
|
*
|
|
352
404
|
* @remarks
|
|
353
405
|
* The manifest is read from a directory a caller named, so it is the least
|
|
@@ -360,7 +412,7 @@ var isHostManifest = (0, _orkestrel_contract.recordOf)({
|
|
|
360
412
|
digest: isDigest
|
|
361
413
|
});
|
|
362
414
|
/**
|
|
363
|
-
*
|
|
415
|
+
* Narrows a value to one {@link Host}.
|
|
364
416
|
*
|
|
365
417
|
* @remarks
|
|
366
418
|
* A whole vendored host handed in as a value is as untrusted as one read from a
|
|
@@ -386,7 +438,7 @@ var isHost = (0, _orkestrel_contract.recordOf)({
|
|
|
386
438
|
bytes: _src_core.isSnapshot
|
|
387
439
|
});
|
|
388
440
|
/**
|
|
389
|
-
*
|
|
441
|
+
* Narrows a value to a {@link Worktree}.
|
|
390
442
|
*
|
|
391
443
|
* @remarks
|
|
392
444
|
* Both path lists are target-relative, so both are measured by the core path
|
|
@@ -407,7 +459,7 @@ var isWorktree = (0, _orkestrel_contract.recordOf)({
|
|
|
407
459
|
dirty: (0, _orkestrel_contract.andOf)(isInventory, (0, _orkestrel_contract.arrayOf)(_src_core.isPath))
|
|
408
460
|
});
|
|
409
461
|
/**
|
|
410
|
-
*
|
|
462
|
+
* Narrows a value to the materializer's initial listener record.
|
|
411
463
|
*
|
|
412
464
|
* @remarks
|
|
413
465
|
* Every event is optional and every declared value is a function. A key outside
|
|
@@ -422,7 +474,7 @@ var isMaterializerHooks = (0, _orkestrel_contract.recordOf)({
|
|
|
422
474
|
destroy: _orkestrel_contract.isFunction
|
|
423
475
|
}, true);
|
|
424
476
|
/**
|
|
425
|
-
*
|
|
477
|
+
* Narrows a value to {@link MaterializerOptions}.
|
|
426
478
|
*
|
|
427
479
|
* @remarks
|
|
428
480
|
* `host` admits both representations of one vendored root: a directory path and
|
|
@@ -444,7 +496,7 @@ var isMaterializerOptions = (0, _orkestrel_contract.recordOf)({
|
|
|
444
496
|
error: _orkestrel_contract.isFunction
|
|
445
497
|
}, true);
|
|
446
498
|
/**
|
|
447
|
-
*
|
|
499
|
+
* Narrows a value to the upstream reader's initial listener record.
|
|
448
500
|
*
|
|
449
501
|
* @remarks
|
|
450
502
|
* Closed to the reader's own events for the same reason the materializer's
|
|
@@ -458,7 +510,7 @@ var isUpstreamHooks = (0, _orkestrel_contract.recordOf)({
|
|
|
458
510
|
destroy: _orkestrel_contract.isFunction
|
|
459
511
|
}, true);
|
|
460
512
|
/**
|
|
461
|
-
*
|
|
513
|
+
* Narrows a value to {@link UpstreamOptions}.
|
|
462
514
|
*
|
|
463
515
|
* @remarks
|
|
464
516
|
* Each grouped endpoint is closed to its own leaves, so a setting written under
|
|
@@ -497,10 +549,10 @@ var isUpstreamOptions = (0, _orkestrel_contract.recordOf)({
|
|
|
497
549
|
//#endregion
|
|
498
550
|
//#region src/server/helpers.ts
|
|
499
551
|
/**
|
|
500
|
-
*
|
|
552
|
+
* Tests whether a caught filesystem error reports an absent path.
|
|
501
553
|
*
|
|
502
554
|
* @param error - The caught value.
|
|
503
|
-
* @returns `
|
|
555
|
+
* @returns True if `error` is an `Error` whose `code` is exactly `ENOENT`; false otherwise.
|
|
504
556
|
*
|
|
505
557
|
* @remarks
|
|
506
558
|
* The one place absence is told apart from failure. Every read here answers
|
|
@@ -520,10 +572,10 @@ function matchesMissingPath(error) {
|
|
|
520
572
|
return (0, _orkestrel_contract.holds)(() => (0, _orkestrel_contract.isError)(error) && Reflect.get(error, "code") === "ENOENT");
|
|
521
573
|
}
|
|
522
574
|
/**
|
|
523
|
-
*
|
|
575
|
+
* Tests whether a path addresses a target's own repository metadata.
|
|
524
576
|
*
|
|
525
577
|
* @param path - The path to classify; either separator is read.
|
|
526
|
-
* @returns
|
|
578
|
+
* @returns True if the path is `.git` or sits beneath it; false otherwise.
|
|
527
579
|
*
|
|
528
580
|
* @remarks
|
|
529
581
|
* The one home of the `.git` membership rule, read in either direction. A target
|
|
@@ -545,10 +597,10 @@ function matchesGitPath(path) {
|
|
|
545
597
|
return /(?:^|\/)\.git(?:\/|$)/i.test(path.replaceAll("\\", "/"));
|
|
546
598
|
}
|
|
547
599
|
/**
|
|
548
|
-
*
|
|
600
|
+
* Tests whether a target-relative path is one no verb may delete.
|
|
549
601
|
*
|
|
550
602
|
* @param path - The target-relative path to classify.
|
|
551
|
-
* @returns
|
|
603
|
+
* @returns True if the path must survive every verb this package runs; false otherwise.
|
|
552
604
|
*
|
|
553
605
|
* @remarks
|
|
554
606
|
* The deletion deny-list, stated as a rule over paths rather than as a list of
|
|
@@ -577,10 +629,10 @@ function matchesProtectedPath(path) {
|
|
|
577
629
|
return normalized.startsWith("src/") || normalized.startsWith("app/");
|
|
578
630
|
}
|
|
579
631
|
/**
|
|
580
|
-
*
|
|
632
|
+
* Tests whether a path names local configuration or a credential.
|
|
581
633
|
*
|
|
582
634
|
* @param path - The path to classify; either separator is read.
|
|
583
|
-
* @returns
|
|
635
|
+
* @returns True if the path must never be copied into a vendored host; false otherwise.
|
|
584
636
|
*
|
|
585
637
|
* @remarks
|
|
586
638
|
* The vendoring deny-list. A host root is staged from a real checkout, so the
|
|
@@ -605,10 +657,10 @@ function matchesSensitivePath(path) {
|
|
|
605
657
|
return /(?:^|\/)(?:(?:\.ssh|\.aws|\.azure|\.docker|\.kube|\.gnupg|\.env(?:\.[^/]*)?)(?:\/|$)|(?:\.npmrc|\.pypirc|\.netrc|\.git-credentials|settings\.local\.json|auth\.json|credentials(?:\.json)?|application_default_credentials\.json|id_rsa|id_ed25519|kubeconfig)$|\.config\/(?:gh|gcloud)(?:\/|$)|\.local\/share\/keyrings(?:\/|$)|[^/]*service-account[^/]*\.json$|[^/]*\.(?:jks|key|p12|pem|pfx|pkcs12)$)/i.test(normalized);
|
|
606
658
|
}
|
|
607
659
|
/**
|
|
608
|
-
*
|
|
660
|
+
* Tests whether a vendored path is one a target receives executable.
|
|
609
661
|
*
|
|
610
662
|
* @param path - The target-relative path to classify; either separator is read.
|
|
611
|
-
* @returns
|
|
663
|
+
* @returns True if the path is declared in {@link EXECUTABLE_PATHS}; false otherwise.
|
|
612
664
|
*
|
|
613
665
|
* @remarks
|
|
614
666
|
* The declaration is the whole answer, and deliberately so. Reading the staging
|
|
@@ -631,7 +683,7 @@ function matchesExecutablePath(path) {
|
|
|
631
683
|
return _src_core.EXECUTABLE_PATHS.includes(path.replaceAll("\\", "/"));
|
|
632
684
|
}
|
|
633
685
|
/**
|
|
634
|
-
*
|
|
686
|
+
* Projects a target-relative path to the storage name a vendored host holds it under.
|
|
635
687
|
*
|
|
636
688
|
* @param path - The target-relative path the file is written to.
|
|
637
689
|
* @returns The storage name beneath the host root.
|
|
@@ -659,7 +711,7 @@ function pathToStorage(path) {
|
|
|
659
711
|
return segments.map((segment) => segment.startsWith(".") ? segment.slice(1) : segment).join("/");
|
|
660
712
|
}
|
|
661
713
|
/**
|
|
662
|
-
*
|
|
714
|
+
* Computes the SHA-256 digest of text.
|
|
663
715
|
*
|
|
664
716
|
* @param content - The text to digest.
|
|
665
717
|
* @returns Sixty-four lowercase hexadecimal digits.
|
|
@@ -702,7 +754,7 @@ function hexToDigest(hex) {
|
|
|
702
754
|
return (0, node_crypto.createHash)("sha256").update(Buffer.from(hex, "hex")).digest("hex");
|
|
703
755
|
}
|
|
704
756
|
/**
|
|
705
|
-
*
|
|
757
|
+
* Computes the digest of a vendored host's declared membership.
|
|
706
758
|
*
|
|
707
759
|
* @param entries - The ordered file membership declarations.
|
|
708
760
|
* @param roots - The ordered directory membership declarations.
|
|
@@ -735,11 +787,11 @@ function computeManifestDigest(entries, roots) {
|
|
|
735
787
|
}));
|
|
736
788
|
}
|
|
737
789
|
/**
|
|
738
|
-
*
|
|
790
|
+
* Tests whether a path is a physical file this package will read or replace.
|
|
739
791
|
*
|
|
740
792
|
* @param path - The resolved host path to inspect, without following links.
|
|
741
|
-
* @returns
|
|
742
|
-
* elsewhere.
|
|
793
|
+
* @returns True if the path is a regular file that is neither a link nor hard-linked
|
|
794
|
+
* elsewhere; false otherwise.
|
|
743
795
|
*
|
|
744
796
|
* @remarks
|
|
745
797
|
* The link tests are the point. A symbolic link is a path pointing somewhere
|
|
@@ -759,11 +811,11 @@ function isPhysicalFile(path) {
|
|
|
759
811
|
return status.success && status.value.isFile() && !status.value.isSymbolicLink() && status.value.nlink === 1;
|
|
760
812
|
}
|
|
761
813
|
/**
|
|
762
|
-
*
|
|
814
|
+
* Tests whether a path is a physical file with exact on-disk casing.
|
|
763
815
|
*
|
|
764
816
|
* @param path - The host path to inspect segment by segment.
|
|
765
|
-
* @returns
|
|
766
|
-
*
|
|
817
|
+
* @returns True if the path is a physical file whose requested segments exactly match
|
|
818
|
+
* the names each parent directory stores; false otherwise.
|
|
767
819
|
*
|
|
768
820
|
* @remarks
|
|
769
821
|
* A direct file lookup follows the host's case-folding rules on Windows and
|
|
@@ -797,10 +849,10 @@ function isExactCaseFile(path) {
|
|
|
797
849
|
return true;
|
|
798
850
|
}
|
|
799
851
|
/**
|
|
800
|
-
*
|
|
852
|
+
* Tests whether a path is a physical directory this package will read or write into.
|
|
801
853
|
*
|
|
802
854
|
* @param path - The resolved host path to inspect, without following links.
|
|
803
|
-
* @returns
|
|
855
|
+
* @returns True if the path is a directory that is not a link; false otherwise.
|
|
804
856
|
*
|
|
805
857
|
* @remarks
|
|
806
858
|
* A junction and a directory symbolic link both report as directories after
|
|
@@ -820,7 +872,7 @@ function isPhysicalDirectory(path) {
|
|
|
820
872
|
return status.success && status.value.isDirectory() && !status.value.isSymbolicLink();
|
|
821
873
|
}
|
|
822
874
|
/**
|
|
823
|
-
*
|
|
875
|
+
* Computes the SHA-256 digest of one file's exact bytes.
|
|
824
876
|
*
|
|
825
877
|
* @param path - The resolved host path to digest.
|
|
826
878
|
* @returns The digest, or `undefined` when the path is not a physical file, is
|
|
@@ -866,7 +918,7 @@ function computeFileDigest(path) {
|
|
|
866
918
|
return read.success ? read.value : void 0;
|
|
867
919
|
}
|
|
868
920
|
/**
|
|
869
|
-
*
|
|
921
|
+
* Resolves a path through the real filesystem, keeping the part that does not exist yet.
|
|
870
922
|
*
|
|
871
923
|
* @param path - The absolute or relative host path to resolve.
|
|
872
924
|
* @returns The lexical resolution of `path`, with its existing prefix then
|
|
@@ -942,7 +994,7 @@ function resolveRealPath(path) {
|
|
|
942
994
|
}
|
|
943
995
|
}
|
|
944
996
|
/**
|
|
945
|
-
*
|
|
997
|
+
* Resolves a root-relative path and refuses one that leaves its root.
|
|
946
998
|
*
|
|
947
999
|
* @param root - The containing host directory.
|
|
948
1000
|
* @param path - The portable root-relative path.
|
|
@@ -990,11 +1042,11 @@ function resolveContainedPath(root, path) {
|
|
|
990
1042
|
return destination;
|
|
991
1043
|
}
|
|
992
1044
|
/**
|
|
993
|
-
*
|
|
1045
|
+
* Tests whether a target is safe to write a fresh workspace into.
|
|
994
1046
|
*
|
|
995
1047
|
* @param target - The candidate target directory.
|
|
996
|
-
* @returns
|
|
997
|
-
*
|
|
1048
|
+
* @returns True if the target is absent, empty, or holds nothing but its own `.git`
|
|
1049
|
+
* directory; false otherwise.
|
|
998
1050
|
*
|
|
999
1051
|
* @remarks
|
|
1000
1052
|
* The green-field law. A checkout of an empty repository is where a new
|
|
@@ -1028,7 +1080,7 @@ function isVacant(target) {
|
|
|
1028
1080
|
return read.success && read.value;
|
|
1029
1081
|
}
|
|
1030
1082
|
/**
|
|
1031
|
-
*
|
|
1083
|
+
* Lists a directory's files as sorted root-relative paths.
|
|
1032
1084
|
*
|
|
1033
1085
|
* @param root - The directory to inventory.
|
|
1034
1086
|
* @returns Every descendant file as a `/`-separated root-relative path, in
|
|
@@ -1120,7 +1172,7 @@ function listFiles(root) {
|
|
|
1120
1172
|
return files.sort();
|
|
1121
1173
|
}
|
|
1122
1174
|
/**
|
|
1123
|
-
*
|
|
1175
|
+
* Lists a directory's descendant directories as sorted root-relative paths.
|
|
1124
1176
|
*
|
|
1125
1177
|
* @param root - The directory to inventory.
|
|
1126
1178
|
* @returns Every descendant directory as a `/`-separated root-relative path, in
|
|
@@ -1302,7 +1354,7 @@ function pruneEmptiedDirectories(target, removed) {
|
|
|
1302
1354
|
return pruned;
|
|
1303
1355
|
}
|
|
1304
1356
|
/**
|
|
1305
|
-
*
|
|
1357
|
+
* Reads one contained file as its exact bytes in lowercase hexadecimal.
|
|
1306
1358
|
*
|
|
1307
1359
|
* @param root - The containing host directory.
|
|
1308
1360
|
* @param path - The portable root-relative file path.
|
|
@@ -1362,7 +1414,7 @@ function readFileHex(root, path, limit = _src_core.MAX_ARTIFACT_BYTES) {
|
|
|
1362
1414
|
return read.success ? read.value : void 0;
|
|
1363
1415
|
}
|
|
1364
1416
|
/**
|
|
1365
|
-
*
|
|
1417
|
+
* Reads one contained file as bounded UTF-8 text.
|
|
1366
1418
|
*
|
|
1367
1419
|
* @param root - The containing host directory.
|
|
1368
1420
|
* @param path - The portable root-relative file path.
|
|
@@ -1392,7 +1444,7 @@ function readFileText(root, path, limit = _src_core.MAX_ARTIFACT_BYTES) {
|
|
|
1392
1444
|
return decoded.success ? decoded.value : void 0;
|
|
1393
1445
|
}
|
|
1394
1446
|
/**
|
|
1395
|
-
*
|
|
1447
|
+
* Reads a target's current bytes at the paths a plan claims.
|
|
1396
1448
|
*
|
|
1397
1449
|
* @param target - The target directory to read.
|
|
1398
1450
|
* @param paths - The plan-relative paths to probe.
|
|
@@ -1407,7 +1459,7 @@ function readFileText(root, path, limit = _src_core.MAX_ARTIFACT_BYTES) {
|
|
|
1407
1459
|
* @remarks
|
|
1408
1460
|
* The one door from a real directory into the vocabulary an audit compares in.
|
|
1409
1461
|
* Absence is omission rather than an empty value, because core reads a missing
|
|
1410
|
-
* key as a missing destination and an empty string as a present directory;
|
|
1462
|
+
* key as a missing destination and an empty string as a present directory;
|
|
1411
1463
|
* they are different verdicts. A path that is there but unreadable throws instead
|
|
1412
1464
|
* of being omitted, because omission would report it as missing and a repair
|
|
1413
1465
|
* would then overwrite whatever is actually sitting there.
|
|
@@ -1459,7 +1511,7 @@ function readSnapshot(target, paths) {
|
|
|
1459
1511
|
return snapshot;
|
|
1460
1512
|
}
|
|
1461
1513
|
/**
|
|
1462
|
-
*
|
|
1514
|
+
* Reads a vendored host's manifest, when it carries one.
|
|
1463
1515
|
*
|
|
1464
1516
|
* @param host - The vendored host root to read.
|
|
1465
1517
|
* @param name - The root-relative manifest path. Default: `manifest.json`.
|
|
@@ -1513,7 +1565,7 @@ function readHostManifest(host, name = MANIFEST_NAME) {
|
|
|
1513
1565
|
* @param root - The vendored host root. Default: the installed package's
|
|
1514
1566
|
* vendored root, resolved from this module's location.
|
|
1515
1567
|
* @returns The verified manifest and the exact bytes of every declared entry.
|
|
1516
|
-
* @throws `ScaffoldError('TARGET',
|
|
1568
|
+
* @throws `ScaffoldError('TARGET', …)` when the root is not a readable physical
|
|
1517
1569
|
* directory, its manifest is absent or unreadable, the manifest does not verify,
|
|
1518
1570
|
* or a declared file is unreadable or misses its digest.
|
|
1519
1571
|
*
|
|
@@ -1557,7 +1609,7 @@ function readHostFloor(root) {
|
|
|
1557
1609
|
};
|
|
1558
1610
|
}
|
|
1559
1611
|
/**
|
|
1560
|
-
*
|
|
1612
|
+
* Derives one vendored-host manifest entry from a file in a checkout.
|
|
1561
1613
|
*
|
|
1562
1614
|
* @param destination - The target-relative path the file is written to.
|
|
1563
1615
|
* @param source - The resolved host path the bytes are read from.
|
|
@@ -1594,7 +1646,7 @@ function readManifestEntry(destination, source) {
|
|
|
1594
1646
|
};
|
|
1595
1647
|
}
|
|
1596
1648
|
/**
|
|
1597
|
-
*
|
|
1649
|
+
* Assembles a whole vendored host from live files and the installed floor.
|
|
1598
1650
|
*
|
|
1599
1651
|
* @param files - The host-owned vendored files read from the repository, one
|
|
1600
1652
|
* row per path.
|
|
@@ -1608,13 +1660,10 @@ function readManifestEntry(destination, source) {
|
|
|
1608
1660
|
* restates it. The host surface contributes one baseline: a fill carries live
|
|
1609
1661
|
* bytes for every path that surface writes, or it is nothing. A row that failed,
|
|
1610
1662
|
* went missing, names an undeclared path, or leaves a host-owned path absent
|
|
1611
|
-
* answers `undefined`.
|
|
1612
|
-
* floor bytes
|
|
1613
|
-
*
|
|
1614
|
-
*
|
|
1615
|
-
* destination keeps its floor bytes here, claimed or not, and a fill that carries
|
|
1616
|
-
* no row for one is complete rather than spoiled. One `Host` can therefore carry
|
|
1617
|
-
* live host bytes beside floor bytes without mixing baselines within a surface.
|
|
1663
|
+
* answers `undefined`. Every {@link isFloorPath} destination keeps the installed
|
|
1664
|
+
* floor's bytes instead, claimed or not, so a fill carrying no row for one is
|
|
1665
|
+
* complete rather than spoiled. One `Host` can therefore carry live host bytes
|
|
1666
|
+
* beside floor bytes without mixing baselines within a surface.
|
|
1618
1667
|
*
|
|
1619
1668
|
* The emitted entries keep the release's own order and its storage and
|
|
1620
1669
|
* executable declarations, and carry digests recomputed over the bytes the fill
|
|
@@ -1639,12 +1688,12 @@ function filesToHost(files, floor) {
|
|
|
1639
1688
|
const held = /* @__PURE__ */ new Map();
|
|
1640
1689
|
for (const file of files) {
|
|
1641
1690
|
if (file.lookup !== "found" || !declared.has(file.path)) return void 0;
|
|
1642
|
-
if (!(0, _src_core.
|
|
1691
|
+
if (!(0, _src_core.isFloorPath)(file.path)) held.set(file.path, file.hex);
|
|
1643
1692
|
}
|
|
1644
1693
|
const entries = [];
|
|
1645
1694
|
const bytes = {};
|
|
1646
1695
|
for (const entry of floor.manifest.entries) {
|
|
1647
|
-
const hex = (0, _src_core.
|
|
1696
|
+
const hex = (0, _src_core.isFloorPath)(entry.destination) ? floor.bytes[entry.destination] : held.get(entry.destination);
|
|
1648
1697
|
if (hex === void 0) return void 0;
|
|
1649
1698
|
entries.push({
|
|
1650
1699
|
storage: entry.storage,
|
|
@@ -1664,7 +1713,7 @@ function filesToHost(files, floor) {
|
|
|
1664
1713
|
};
|
|
1665
1714
|
}
|
|
1666
1715
|
/**
|
|
1667
|
-
*
|
|
1716
|
+
* Stages the named destinations of a value host into a private root.
|
|
1668
1717
|
*
|
|
1669
1718
|
* @param host - The host whose bytes are written, keyed by destination.
|
|
1670
1719
|
* @param root - The private directory to fill; it must already be a directory
|
|
@@ -1736,7 +1785,7 @@ function stageBytes(host, root, destinations) {
|
|
|
1736
1785
|
return staged;
|
|
1737
1786
|
}
|
|
1738
1787
|
/**
|
|
1739
|
-
*
|
|
1788
|
+
* Stages a vendored host root from a real checkout.
|
|
1740
1789
|
*
|
|
1741
1790
|
* @param checkout - The checkout the vendored paths are read from.
|
|
1742
1791
|
* @param host - The vendored host root to fill; it must be absent or empty.
|
|
@@ -1971,7 +2020,7 @@ function stageInventory(checkout, path) {
|
|
|
1971
2020
|
return staged.value;
|
|
1972
2021
|
}
|
|
1973
2022
|
/**
|
|
1974
|
-
*
|
|
2023
|
+
* Captures one directory's physical identity.
|
|
1975
2024
|
*
|
|
1976
2025
|
* @param path - The resolved directory path to capture.
|
|
1977
2026
|
* @returns The anchor, or `undefined` when the path is not a physical directory.
|
|
@@ -1999,11 +2048,11 @@ function readAnchor(path) {
|
|
|
1999
2048
|
};
|
|
2000
2049
|
}
|
|
2001
2050
|
/**
|
|
2002
|
-
*
|
|
2051
|
+
* Tests whether a captured directory is still the same directory.
|
|
2003
2052
|
*
|
|
2004
2053
|
* @param anchor - The identity captured earlier.
|
|
2005
|
-
* @returns
|
|
2006
|
-
*
|
|
2054
|
+
* @returns True if the path still holds a physical directory of that exact device and
|
|
2055
|
+
* inode; false otherwise.
|
|
2007
2056
|
*
|
|
2008
2057
|
* @remarks
|
|
2009
2058
|
* This binds location rather than history. `true` means the path still resolves
|
|
@@ -2027,7 +2076,7 @@ function matchesAnchor(anchor) {
|
|
|
2027
2076
|
return current !== void 0 && current.device === anchor.device && current.inode === anchor.inode;
|
|
2028
2077
|
}
|
|
2029
2078
|
/**
|
|
2030
|
-
*
|
|
2079
|
+
* Captures what one destination holds before a write.
|
|
2031
2080
|
*
|
|
2032
2081
|
* @param path - The resolved destination path to capture.
|
|
2033
2082
|
* @returns The expectation, or `undefined` when the destination is a link or a
|
|
@@ -2076,10 +2125,10 @@ function readExpectation(path) {
|
|
|
2076
2125
|
};
|
|
2077
2126
|
}
|
|
2078
2127
|
/**
|
|
2079
|
-
*
|
|
2128
|
+
* Tests whether a destination still holds what was captured of it.
|
|
2080
2129
|
*
|
|
2081
2130
|
* @param expectation - The state captured earlier.
|
|
2082
|
-
* @returns
|
|
2131
|
+
* @returns True if re-reading the destination produces that same state; false otherwise.
|
|
2083
2132
|
*
|
|
2084
2133
|
* @remarks
|
|
2085
2134
|
* Compared field for field against a fresh {@link readExpectation}, so an
|
|
@@ -2101,11 +2150,11 @@ function matchesExpectation(expectation) {
|
|
|
2101
2150
|
return current.shape === expectation.shape && current.device === expectation.device && current.inode === expectation.inode && current.modified === expectation.modified && current.size === expectation.size && current.digest === expectation.digest;
|
|
2102
2151
|
}
|
|
2103
2152
|
/**
|
|
2104
|
-
*
|
|
2153
|
+
* Tests whether a destination still matches the narrower state a caller observed.
|
|
2105
2154
|
*
|
|
2106
2155
|
* @param precondition - The caller-observed state the write is held to.
|
|
2107
|
-
* @returns
|
|
2108
|
-
*
|
|
2156
|
+
* @returns True if the destination is absent as stated, or holds a physical file whose
|
|
2157
|
+
* bytes digest to the stated value; false otherwise.
|
|
2109
2158
|
*
|
|
2110
2159
|
* @remarks
|
|
2111
2160
|
* Narrower than {@link matchesExpectation} on purpose. A caller observed bytes,
|
|
@@ -2131,7 +2180,7 @@ function matchesPrecondition(precondition) {
|
|
|
2131
2180
|
//#endregion
|
|
2132
2181
|
//#region src/server/WriteTransaction.ts
|
|
2133
2182
|
/**
|
|
2134
|
-
*
|
|
2183
|
+
* Represents one staged, reversible mutation of one target directory.
|
|
2135
2184
|
*
|
|
2136
2185
|
* @remarks
|
|
2137
2186
|
* The transaction owns a private root beside the target — a sibling directory on
|
|
@@ -2207,7 +2256,7 @@ var WriteTransaction = class {
|
|
|
2207
2256
|
#taken = [];
|
|
2208
2257
|
#open = true;
|
|
2209
2258
|
/**
|
|
2210
|
-
*
|
|
2259
|
+
* Opens a transaction over one target directory.
|
|
2211
2260
|
*
|
|
2212
2261
|
* @param target - The directory every path is written beneath.
|
|
2213
2262
|
* @param paths - Every target-relative path this transaction may touch.
|
|
@@ -2281,20 +2330,20 @@ var WriteTransaction = class {
|
|
|
2281
2330
|
});
|
|
2282
2331
|
}
|
|
2283
2332
|
}
|
|
2284
|
-
/**
|
|
2333
|
+
/** Names the resolved directory every path is written beneath. */
|
|
2285
2334
|
get target() {
|
|
2286
2335
|
return this.#target;
|
|
2287
2336
|
}
|
|
2288
|
-
/**
|
|
2337
|
+
/** Reports what each destination held when the transaction opened, in path order. */
|
|
2289
2338
|
get expectations() {
|
|
2290
2339
|
return [...this.#expectations.values()];
|
|
2291
2340
|
}
|
|
2292
|
-
/**
|
|
2341
|
+
/** Reports whether the transaction can still be committed or discarded. */
|
|
2293
2342
|
get open() {
|
|
2294
2343
|
return this.#open;
|
|
2295
2344
|
}
|
|
2296
2345
|
/**
|
|
2297
|
-
*
|
|
2346
|
+
* Stages one text file.
|
|
2298
2347
|
*
|
|
2299
2348
|
* @param path - The target-relative path to write.
|
|
2300
2349
|
* @param content - The exact UTF-8 text the destination must hold.
|
|
@@ -2325,7 +2374,7 @@ var WriteTransaction = class {
|
|
|
2325
2374
|
this.#staged.push(path);
|
|
2326
2375
|
}
|
|
2327
2376
|
/**
|
|
2328
|
-
*
|
|
2377
|
+
* Stages one byte-for-byte copy of a file that already exists on this host.
|
|
2329
2378
|
*
|
|
2330
2379
|
* @param path - The target-relative path to write.
|
|
2331
2380
|
* @param source - The resolved absolute path to copy the bytes from.
|
|
@@ -2364,7 +2413,7 @@ var WriteTransaction = class {
|
|
|
2364
2413
|
this.#staged.push(path);
|
|
2365
2414
|
}
|
|
2366
2415
|
/**
|
|
2367
|
-
*
|
|
2416
|
+
* Establishes one directory inside the target, one segment at a time.
|
|
2368
2417
|
*
|
|
2369
2418
|
* @param path - The target-relative directory to establish.
|
|
2370
2419
|
* @returns The directory's identity and every segment this call created.
|
|
@@ -2392,7 +2441,7 @@ var WriteTransaction = class {
|
|
|
2392
2441
|
return result;
|
|
2393
2442
|
}
|
|
2394
2443
|
/**
|
|
2395
|
-
*
|
|
2444
|
+
* Marks one file for deletion at commit.
|
|
2396
2445
|
*
|
|
2397
2446
|
* @param path - The target-relative file to delete.
|
|
2398
2447
|
* @returns Nothing.
|
|
@@ -2409,7 +2458,7 @@ var WriteTransaction = class {
|
|
|
2409
2458
|
this.#taken.push(path);
|
|
2410
2459
|
}
|
|
2411
2460
|
/**
|
|
2412
|
-
*
|
|
2461
|
+
* Promotes every staged file and takes every marked file, or rolls the whole call back.
|
|
2413
2462
|
*
|
|
2414
2463
|
* @returns Every target-relative path whose destination changed: the files
|
|
2415
2464
|
* promoted, then the directories established, then the files taken.
|
|
@@ -2462,7 +2511,7 @@ var WriteTransaction = class {
|
|
|
2462
2511
|
];
|
|
2463
2512
|
}
|
|
2464
2513
|
/**
|
|
2465
|
-
*
|
|
2514
|
+
* Abandons the transaction and removes everything it created.
|
|
2466
2515
|
*
|
|
2467
2516
|
* @returns Nothing.
|
|
2468
2517
|
* @throws {@link ScaffoldError} coded `WRITE` when residue could not be
|
|
@@ -2639,7 +2688,7 @@ var WriteTransaction = class {
|
|
|
2639
2688
|
//#endregion
|
|
2640
2689
|
//#region src/server/Materializer.ts
|
|
2641
2690
|
/**
|
|
2642
|
-
*
|
|
2691
|
+
* Represents the mutation spine: read the vendored host, re-derive the target, stage, swap.
|
|
2643
2692
|
*
|
|
2644
2693
|
* @remarks
|
|
2645
2694
|
* Every verb runs the same steps. It snapshots each caller-supplied value
|
|
@@ -2683,9 +2732,7 @@ var WriteTransaction = class {
|
|
|
2683
2732
|
* materializer.destroy()
|
|
2684
2733
|
* ```
|
|
2685
2734
|
*/
|
|
2686
|
-
var Materializer = class
|
|
2687
|
-
static #opening = "<!-- orkestrel:catalog -->";
|
|
2688
|
-
static #closing = "<!-- /orkestrel:catalog -->";
|
|
2735
|
+
var Materializer = class {
|
|
2689
2736
|
#emitter;
|
|
2690
2737
|
#root;
|
|
2691
2738
|
#value;
|
|
@@ -2693,7 +2740,7 @@ var Materializer = class Materializer {
|
|
|
2693
2740
|
#entries;
|
|
2694
2741
|
#destroyed = false;
|
|
2695
2742
|
/**
|
|
2696
|
-
*
|
|
2743
|
+
* Constructs a materializer over one vendored host root.
|
|
2697
2744
|
*
|
|
2698
2745
|
* @param options - The vendored host, in either representation, the initial
|
|
2699
2746
|
* listeners, and the listener-error handler.
|
|
@@ -2747,12 +2794,12 @@ var Materializer = class Materializer {
|
|
|
2747
2794
|
if (read.value !== void 0) this.#reconcile(read.value, root);
|
|
2748
2795
|
}
|
|
2749
2796
|
}
|
|
2750
|
-
/**
|
|
2797
|
+
/** Exposes the materializer's observation channel. */
|
|
2751
2798
|
get emitter() {
|
|
2752
2799
|
return this.#emitter;
|
|
2753
2800
|
}
|
|
2754
2801
|
/**
|
|
2755
|
-
*
|
|
2802
|
+
* Compares a plan with a target through the vendored host that will repair it.
|
|
2756
2803
|
*
|
|
2757
2804
|
* @param plan - The compiled plan to compare.
|
|
2758
2805
|
* @param target - The directory to inspect.
|
|
@@ -2783,7 +2830,7 @@ var Materializer = class Materializer {
|
|
|
2783
2830
|
return this.#derive(accepted, directory);
|
|
2784
2831
|
}
|
|
2785
2832
|
/**
|
|
2786
|
-
*
|
|
2833
|
+
* Writes a plan into a vacant target.
|
|
2787
2834
|
*
|
|
2788
2835
|
* @param plan - The compiled plan to write.
|
|
2789
2836
|
* @param target - The directory to write into; it must hold nothing the plan would collide with.
|
|
@@ -2810,7 +2857,7 @@ var Materializer = class Materializer {
|
|
|
2810
2857
|
return this.#apply(directory, hydrated.artifacts, empty, [], []);
|
|
2811
2858
|
}
|
|
2812
2859
|
/**
|
|
2813
|
-
*
|
|
2860
|
+
* Writes a plan into an existing target, guided by an audit of it.
|
|
2814
2861
|
*
|
|
2815
2862
|
* @param plan - The compiled plan to write.
|
|
2816
2863
|
* @param audit - The preview returned by this materializer's `audit` method.
|
|
@@ -2856,7 +2903,7 @@ var Materializer = class Materializer {
|
|
|
2856
2903
|
return this.#apply(directory, writes, [], skipped, preconditions);
|
|
2857
2904
|
}
|
|
2858
2905
|
/**
|
|
2859
|
-
*
|
|
2906
|
+
* Writes fetched dependency guides to their local mirrors.
|
|
2860
2907
|
*
|
|
2861
2908
|
* @param mirrors - The fetched guides; each carries the local bytes its write is held to.
|
|
2862
2909
|
* @param target - The directory to write into.
|
|
@@ -2899,7 +2946,7 @@ var Materializer = class Materializer {
|
|
|
2899
2946
|
return this.#apply(directory, writes, [], skipped, preconditions);
|
|
2900
2947
|
}
|
|
2901
2948
|
/**
|
|
2902
|
-
*
|
|
2949
|
+
* Rewrites the marker-bounded package table in the target's catalog agent file.
|
|
2903
2950
|
*
|
|
2904
2951
|
* @param entries - The published packages the table must list.
|
|
2905
2952
|
* @param target - The directory to write into.
|
|
@@ -2922,7 +2969,7 @@ var Materializer = class Materializer {
|
|
|
2922
2969
|
return this.#rewrite(directory, _src_core.CATALOG_AGENT_PATH, _src_core.MAX_ARTIFACT_BYTES, this.#recatalog(accepted));
|
|
2923
2970
|
}
|
|
2924
2971
|
/**
|
|
2925
|
-
*
|
|
2972
|
+
* Rewrites the manifest regions the caller names in the target's manifest.
|
|
2926
2973
|
*
|
|
2927
2974
|
* @param regions - The dependency ranges and script values the manifest must declare.
|
|
2928
2975
|
* @param target - The directory to write into.
|
|
@@ -2952,7 +2999,7 @@ var Materializer = class Materializer {
|
|
|
2952
2999
|
return this.#rewrite(directory, "package.json", _src_core.MAX_MANIFEST_BYTES, this.#redeclare(accepted));
|
|
2953
3000
|
}
|
|
2954
3001
|
/**
|
|
2955
|
-
* Re-
|
|
3002
|
+
* Re-derives and deletes the tracked files the plan does not own.
|
|
2956
3003
|
*
|
|
2957
3004
|
* @param plan - The compiled plan that decides which paths are foreign.
|
|
2958
3005
|
* @param audit - The preview returned by this materializer's `audit` method; it must agree with the candidate set this call re-derives.
|
|
@@ -3016,7 +3063,7 @@ var Materializer = class Materializer {
|
|
|
3016
3063
|
return this.#purge(directory, removals, skipped, preconditions);
|
|
3017
3064
|
}
|
|
3018
3065
|
/**
|
|
3019
|
-
*
|
|
3066
|
+
* Tears the materializer down. Every later call throws, and teardown is idempotent.
|
|
3020
3067
|
*
|
|
3021
3068
|
* @returns Nothing.
|
|
3022
3069
|
*
|
|
@@ -3062,7 +3109,7 @@ var Materializer = class Materializer {
|
|
|
3062
3109
|
host: root,
|
|
3063
3110
|
error: walked.error
|
|
3064
3111
|
});
|
|
3065
|
-
const declared = [...manifest.entries.map((entry) => entry.storage),
|
|
3112
|
+
const declared = [...manifest.entries.map((entry) => entry.storage), MANIFEST_NAME].sort();
|
|
3066
3113
|
const stored = walked.value;
|
|
3067
3114
|
if (stored.length !== declared.length || stored.some((name, index) => name !== declared[index])) throw this.#error("TARGET", "The vendored host does not store what its manifest declares.", {
|
|
3068
3115
|
host: root,
|
|
@@ -3140,11 +3187,7 @@ var Materializer = class Materializer {
|
|
|
3140
3187
|
let budget = remaining;
|
|
3141
3188
|
for (const entry of matched) {
|
|
3142
3189
|
const path = this.#remap(artifact, entry.destination);
|
|
3143
|
-
if (_src_core.
|
|
3144
|
-
expanded.push(this.#presence(artifact, path, entry.destination));
|
|
3145
|
-
continue;
|
|
3146
|
-
}
|
|
3147
|
-
if ((0, _src_core.isDeferredPath)(path)) {
|
|
3190
|
+
if ((0, _src_core.isRetainedPath)(path)) {
|
|
3148
3191
|
expanded.push(this.#presence(artifact, path, entry.destination));
|
|
3149
3192
|
continue;
|
|
3150
3193
|
}
|
|
@@ -3162,8 +3205,7 @@ var Materializer = class Materializer {
|
|
|
3162
3205
|
source
|
|
3163
3206
|
});
|
|
3164
3207
|
if (isPhysicalFile(full)) {
|
|
3165
|
-
if (_src_core.
|
|
3166
|
-
if ((0, _src_core.isDeferredPath)(artifact.path)) return [this.#presence(artifact, artifact.path, source)];
|
|
3208
|
+
if ((0, _src_core.isRetainedPath)(artifact.path)) return [this.#presence(artifact, artifact.path, source)];
|
|
3167
3209
|
return [this.#hydrated(artifact, artifact.path, source, this.#readRoot(source, remaining))];
|
|
3168
3210
|
}
|
|
3169
3211
|
if (!isPhysicalDirectory(full)) throw this.#error("TARGET", `The host source at ${source} is not a readable file.`, {
|
|
@@ -3175,11 +3217,7 @@ var Materializer = class Materializer {
|
|
|
3175
3217
|
for (const name of listFiles(full)) {
|
|
3176
3218
|
const path = `${artifact.path}/${name}`;
|
|
3177
3219
|
const destination = `${source}/${name}`;
|
|
3178
|
-
if (_src_core.
|
|
3179
|
-
expanded.push(this.#presence(artifact, path, destination));
|
|
3180
|
-
continue;
|
|
3181
|
-
}
|
|
3182
|
-
if ((0, _src_core.isDeferredPath)(path)) {
|
|
3220
|
+
if ((0, _src_core.isRetainedPath)(path)) {
|
|
3183
3221
|
expanded.push(this.#presence(artifact, path, destination));
|
|
3184
3222
|
continue;
|
|
3185
3223
|
}
|
|
@@ -3488,10 +3526,10 @@ var Materializer = class Materializer {
|
|
|
3488
3526
|
...rows
|
|
3489
3527
|
].map((row) => `| ${row.map((cell, column) => cell.padEnd(widths[column] ?? cell.length)).join(" | ")} |`).join("\n");
|
|
3490
3528
|
return (text) => {
|
|
3491
|
-
const opening = text.indexOf(
|
|
3492
|
-
const closing = text.indexOf(
|
|
3529
|
+
const opening = text.indexOf(_src_core.CATALOG_OPENING_MARKER);
|
|
3530
|
+
const closing = text.indexOf(_src_core.CATALOG_CLOSING_MARKER, opening + _src_core.CATALOG_OPENING_MARKER.length);
|
|
3493
3531
|
if (opening < 0 || closing < 0) throw this.#error("TARGET", "The catalog agent file carries no marked region.", { path: _src_core.CATALOG_AGENT_PATH });
|
|
3494
|
-
return `${text.slice(0, opening +
|
|
3532
|
+
return `${text.slice(0, opening + _src_core.CATALOG_OPENING_MARKER.length)}\n\n${table}\n\n${text.slice(closing)}`;
|
|
3495
3533
|
};
|
|
3496
3534
|
}
|
|
3497
3535
|
#cell(note) {
|
|
@@ -3528,7 +3566,7 @@ var Materializer = class Materializer {
|
|
|
3528
3566
|
//#endregion
|
|
3529
3567
|
//#region src/server/Upstream.ts
|
|
3530
3568
|
/**
|
|
3531
|
-
*
|
|
3569
|
+
* Represents the reading spine: one bounded, unauthenticated, redirect-free request per answer.
|
|
3532
3570
|
*
|
|
3533
3571
|
* @remarks
|
|
3534
3572
|
* This is the package's only network reader, and it never writes. Every call
|
|
@@ -3557,7 +3595,7 @@ var Materializer = class Materializer {
|
|
|
3557
3595
|
* flight instead of waiting for it.
|
|
3558
3596
|
*
|
|
3559
3597
|
* The allowance is threaded through the private reads as a mutable
|
|
3560
|
-
*
|
|
3598
|
+
* {@link ReadAllowance} carrier rather than held on the instance, because
|
|
3561
3599
|
* concurrent calls each own their own budget and must not spend each other's.
|
|
3562
3600
|
*
|
|
3563
3601
|
* @example
|
|
@@ -3569,17 +3607,7 @@ var Materializer = class Materializer {
|
|
|
3569
3607
|
* upstream.destroy()
|
|
3570
3608
|
* ```
|
|
3571
3609
|
*/
|
|
3572
|
-
var Upstream = class
|
|
3573
|
-
static #defaultRepository = "https://raw.githubusercontent.com";
|
|
3574
|
-
static #defaultRegistry = "https://registry.npmjs.org";
|
|
3575
|
-
static #defaultBranch = "main";
|
|
3576
|
-
static #defaultTimeout = 1e4;
|
|
3577
|
-
static #defaultConcurrency = 6;
|
|
3578
|
-
static #defaultRetries = 0;
|
|
3579
|
-
static #scope = "orkestrel";
|
|
3580
|
-
static #vendor = "scaffold";
|
|
3581
|
-
static #unreadable = "the answer carries no readable latest version";
|
|
3582
|
-
static #packument = "application/vnd.npm.install-v1+json";
|
|
3610
|
+
var Upstream = class {
|
|
3583
3611
|
#emitter;
|
|
3584
3612
|
#repositoryBase;
|
|
3585
3613
|
#repositoryBranch;
|
|
@@ -3593,7 +3621,7 @@ var Upstream = class Upstream {
|
|
|
3593
3621
|
#controller = new AbortController();
|
|
3594
3622
|
#destroyed = false;
|
|
3595
3623
|
/**
|
|
3596
|
-
*
|
|
3624
|
+
* Constructs a reader over one raw content host and one registry.
|
|
3597
3625
|
*
|
|
3598
3626
|
* @param options - The endpoints, the request bounds, the initial
|
|
3599
3627
|
* listeners, and the listener-error handler.
|
|
@@ -3617,22 +3645,22 @@ var Upstream = class Upstream {
|
|
|
3617
3645
|
...options?.on === void 0 ? {} : { on: options.on },
|
|
3618
3646
|
...options?.error === void 0 ? {} : { error: options.error }
|
|
3619
3647
|
});
|
|
3620
|
-
this.#repositoryBase = this.#endpoint(options?.repository?.base ??
|
|
3621
|
-
this.#repositoryBranch = options?.repository?.branch ??
|
|
3622
|
-
this.#repositoryTimeout = options?.repository?.timeout ??
|
|
3623
|
-
this.#registryBase = this.#endpoint(options?.registry?.base ??
|
|
3624
|
-
this.#registryTimeout = options?.registry?.timeout ??
|
|
3625
|
-
this.#concurrency = options?.concurrency ??
|
|
3626
|
-
this.#retries = options?.retries ??
|
|
3648
|
+
this.#repositoryBase = this.#endpoint(options?.repository?.base ?? "https://raw.githubusercontent.com", "repository");
|
|
3649
|
+
this.#repositoryBranch = options?.repository?.branch ?? "main";
|
|
3650
|
+
this.#repositoryTimeout = options?.repository?.timeout ?? 1e4;
|
|
3651
|
+
this.#registryBase = this.#endpoint(options?.registry?.base ?? "https://registry.npmjs.org", "registry");
|
|
3652
|
+
this.#registryTimeout = options?.registry?.timeout ?? 1e4;
|
|
3653
|
+
this.#concurrency = options?.concurrency ?? 6;
|
|
3654
|
+
this.#retries = options?.retries ?? 0;
|
|
3627
3655
|
this.#limit = options?.limit ?? _src_core.MAX_REGISTRY_BYTES;
|
|
3628
3656
|
this.#budget = options?.budget ?? _src_core.MAX_TOTAL_REGISTRY_BYTES;
|
|
3629
3657
|
}
|
|
3630
|
-
/**
|
|
3658
|
+
/** Exposes the upstream reader's observation channel. */
|
|
3631
3659
|
get emitter() {
|
|
3632
3660
|
return this.#emitter;
|
|
3633
3661
|
}
|
|
3634
3662
|
/**
|
|
3635
|
-
*
|
|
3663
|
+
* Looks up the newest release each declared range admits.
|
|
3636
3664
|
*
|
|
3637
3665
|
* @param dependencies - The declared dependencies to look up.
|
|
3638
3666
|
* @returns One release verdict per dependency, in input order.
|
|
@@ -3663,7 +3691,7 @@ var Upstream = class Upstream {
|
|
|
3663
3691
|
return this.#gather(accepted, (dependency) => this.#release(dependency, allowance));
|
|
3664
3692
|
}
|
|
3665
3693
|
/**
|
|
3666
|
-
*
|
|
3694
|
+
* Fetches each named package's guide, beside the local mirror it answers for.
|
|
3667
3695
|
*
|
|
3668
3696
|
* @param names - The packages to fetch: the target's declared set, or the whole organization.
|
|
3669
3697
|
* @param current - The target's local mirrors as exact bytes, keyed by mirror path.
|
|
@@ -3697,7 +3725,7 @@ var Upstream = class Upstream {
|
|
|
3697
3725
|
return this.#gather(accepted, (name) => this.#mirror(name, observed, allowance));
|
|
3698
3726
|
}
|
|
3699
3727
|
/**
|
|
3700
|
-
*
|
|
3728
|
+
* Reads each named vendored file from the repository, beside the target bytes it answers for.
|
|
3701
3729
|
*
|
|
3702
3730
|
* @param paths - The target-relative vendored paths to read.
|
|
3703
3731
|
* @param current - The target files as exact bytes, keyed by the same paths.
|
|
@@ -3745,7 +3773,7 @@ var Upstream = class Upstream {
|
|
|
3745
3773
|
return this.#gather(accepted, (path) => this.#file(path, inventory, observed, allowance));
|
|
3746
3774
|
}
|
|
3747
3775
|
/**
|
|
3748
|
-
*
|
|
3776
|
+
* Catalogs the published fleet from the registry's organization package list.
|
|
3749
3777
|
*
|
|
3750
3778
|
* @returns One row per published package, sorted by name.
|
|
3751
3779
|
* @throws {@link ScaffoldError} coded `FETCH` when the organization package
|
|
@@ -3778,7 +3806,7 @@ var Upstream = class Upstream {
|
|
|
3778
3806
|
return this.#gather(names, (name) => this.#entry(name, allowance));
|
|
3779
3807
|
}
|
|
3780
3808
|
/**
|
|
3781
|
-
*
|
|
3809
|
+
* Tears the reader down, aborting every request in flight. Teardown is idempotent.
|
|
3782
3810
|
*
|
|
3783
3811
|
* @returns Nothing.
|
|
3784
3812
|
*
|
|
@@ -3821,7 +3849,7 @@ var Upstream = class Upstream {
|
|
|
3821
3849
|
return parsed.href.replace(/\/+$/u, "");
|
|
3822
3850
|
}
|
|
3823
3851
|
async #release(dependency, allowance) {
|
|
3824
|
-
const outcome = await this.#readWithRetries(this.#registryURL(dependency.name), this.#registryTimeout, allowance,
|
|
3852
|
+
const outcome = await this.#readWithRetries(this.#registryURL(dependency.name), this.#registryTimeout, allowance, PACKUMENT_MEDIA_TYPE);
|
|
3825
3853
|
const latest = outcome.lookup === "found" ? this.#releaseVersion(outcome.content, dependency.range) : void 0;
|
|
3826
3854
|
const tagged = outcome.lookup === "found" ? this.#latest(outcome.content) : void 0;
|
|
3827
3855
|
const major = tagged === void 0 ? void 0 : (0, _src_core.extractVersion)(tagged)?.[0];
|
|
@@ -3829,7 +3857,7 @@ var Upstream = class Upstream {
|
|
|
3829
3857
|
name: dependency.name,
|
|
3830
3858
|
range: dependency.range,
|
|
3831
3859
|
lookup: outcome.lookup === "found" ? "unmatched" : outcome.lookup,
|
|
3832
|
-
note: outcome.lookup === "found" ?
|
|
3860
|
+
note: outcome.lookup === "found" ? UNREADABLE_VERSION_NOTE : outcome.note,
|
|
3833
3861
|
...major === void 0 ? {} : { major }
|
|
3834
3862
|
} : {
|
|
3835
3863
|
name: dependency.name,
|
|
@@ -3956,7 +3984,7 @@ var Upstream = class Upstream {
|
|
|
3956
3984
|
};
|
|
3957
3985
|
}
|
|
3958
3986
|
async #entry(name, allowance) {
|
|
3959
|
-
const outcome = await this.#readWithRetries(this.#registryURL(name), this.#registryTimeout, allowance,
|
|
3987
|
+
const outcome = await this.#readWithRetries(this.#registryURL(name), this.#registryTimeout, allowance, PACKUMENT_MEDIA_TYPE);
|
|
3960
3988
|
const version = outcome.lookup === "found" ? this.#latest(outcome.content) : void 0;
|
|
3961
3989
|
if (version !== void 0) return {
|
|
3962
3990
|
name,
|
|
@@ -3967,7 +3995,7 @@ var Upstream = class Upstream {
|
|
|
3967
3995
|
return {
|
|
3968
3996
|
name,
|
|
3969
3997
|
lookup: outcome.lookup === "found" ? "unmatched" : outcome.lookup,
|
|
3970
|
-
note: outcome.lookup === "found" ?
|
|
3998
|
+
note: outcome.lookup === "found" ? UNREADABLE_VERSION_NOTE : outcome.note
|
|
3971
3999
|
};
|
|
3972
4000
|
}
|
|
3973
4001
|
#edges(content, version) {
|
|
@@ -3993,7 +4021,7 @@ var Upstream = class Upstream {
|
|
|
3993
4021
|
return edges;
|
|
3994
4022
|
}
|
|
3995
4023
|
async #packages(allowance) {
|
|
3996
|
-
const url = `${this.#registryBase}/-/org/${
|
|
4024
|
+
const url = `${this.#registryBase}/-/org/${ORKESTREL_SCOPE}/package`;
|
|
3997
4025
|
const outcome = await this.#readWithRetries(url, this.#registryTimeout, allowance);
|
|
3998
4026
|
if (outcome.lookup !== "found") throw this.#error("FETCH", `The organization package list at ${url} produced no answer.`, {
|
|
3999
4027
|
url,
|
|
@@ -4042,11 +4070,11 @@ var Upstream = class Upstream {
|
|
|
4042
4070
|
#guideURL(name) {
|
|
4043
4071
|
const branch = this.#encode(this.#repositoryBranch);
|
|
4044
4072
|
const repository = encodeURIComponent(name.slice(name.lastIndexOf("/") + 1));
|
|
4045
|
-
return `${this.#repositoryBase}/${
|
|
4073
|
+
return `${this.#repositoryBase}/${ORKESTREL_SCOPE}/${repository}/refs/heads/${branch}/${(0, _src_core.nameToGuide)(name)}`;
|
|
4046
4074
|
}
|
|
4047
4075
|
#vendorURL(path) {
|
|
4048
4076
|
const branch = this.#encode(this.#repositoryBranch);
|
|
4049
|
-
return `${this.#repositoryBase}/${
|
|
4077
|
+
return `${this.#repositoryBase}/${ORKESTREL_SCOPE}/${SCAFFOLD_REPOSITORY}/refs/heads/${branch}/${this.#encode(path)}`;
|
|
4050
4078
|
}
|
|
4051
4079
|
#encode(path) {
|
|
4052
4080
|
return path.split("/").map((segment) => encodeURIComponent(segment)).join("/");
|
|
@@ -4264,6 +4292,12 @@ var Upstream = class Upstream {
|
|
|
4264
4292
|
};
|
|
4265
4293
|
//#endregion
|
|
4266
4294
|
exports.BRANCH_PATTERN = BRANCH_PATTERN;
|
|
4295
|
+
exports.DEFAULT_BRANCH = DEFAULT_BRANCH;
|
|
4296
|
+
exports.DEFAULT_REGISTRY_BASE = DEFAULT_REGISTRY_BASE;
|
|
4297
|
+
exports.DEFAULT_REPOSITORY_BASE = DEFAULT_REPOSITORY_BASE;
|
|
4298
|
+
exports.DEFAULT_UPSTREAM_CONCURRENCY = DEFAULT_UPSTREAM_CONCURRENCY;
|
|
4299
|
+
exports.DEFAULT_UPSTREAM_RETRIES = DEFAULT_UPSTREAM_RETRIES;
|
|
4300
|
+
exports.DEFAULT_UPSTREAM_TIMEOUT = DEFAULT_UPSTREAM_TIMEOUT;
|
|
4267
4301
|
exports.DIGEST_PATTERN = DIGEST_PATTERN;
|
|
4268
4302
|
exports.DRIVE_PATTERN = DRIVE_PATTERN;
|
|
4269
4303
|
exports.INVALID_SEGMENT_CHARACTER_PATTERN = INVALID_SEGMENT_CHARACTER_PATTERN;
|
|
@@ -4277,7 +4311,11 @@ exports.MAX_UPSTREAM_CONCURRENCY = MAX_UPSTREAM_CONCURRENCY;
|
|
|
4277
4311
|
exports.MAX_UPSTREAM_RETRIES = MAX_UPSTREAM_RETRIES;
|
|
4278
4312
|
exports.MAX_UPSTREAM_TIMEOUT = MAX_UPSTREAM_TIMEOUT;
|
|
4279
4313
|
exports.Materializer = Materializer;
|
|
4314
|
+
exports.ORKESTREL_SCOPE = ORKESTREL_SCOPE;
|
|
4315
|
+
exports.PACKUMENT_MEDIA_TYPE = PACKUMENT_MEDIA_TYPE;
|
|
4280
4316
|
exports.RESERVED_SEGMENT_PATTERN = RESERVED_SEGMENT_PATTERN;
|
|
4317
|
+
exports.SCAFFOLD_REPOSITORY = SCAFFOLD_REPOSITORY;
|
|
4318
|
+
exports.UNREADABLE_VERSION_NOTE = UNREADABLE_VERSION_NOTE;
|
|
4281
4319
|
exports.Upstream = Upstream;
|
|
4282
4320
|
exports.WriteTransaction = WriteTransaction;
|
|
4283
4321
|
exports.computeDigest = computeDigest;
|