@jini-ai/devops 0.6.15-rc.2 → 0.6.16
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 +2 -2
- package/dist/agent-jobs/jobs.js +3 -2
- package/dist/checks/hardwiring-node.js +16 -6
- package/dist/checks/hardwiring.js +38 -16
- package/dist/checks/memory-soak.js +2 -1
- package/dist/checks/node.d.ts +0 -1
- package/dist/checks/node.js +7 -1
- package/dist/checks/published-types/index.js +5 -2
- package/dist/core/deploy-types.d.ts +8 -0
- package/dist/deploy/naming.js +4 -5
- package/dist/deploy/node.js +4 -2
- package/dist/deploy/reachability.js +26 -23
- package/dist/dns/plan.js +2 -1
- package/dist/dns/records.js +7 -3
- package/dist/dns/registry.js +4 -2
- package/dist/local-dev/index.js +7 -3
- package/dist/packaging/electron/entry.d.ts +3 -0
- package/dist/packaging/electron/entry.js +3 -0
- package/dist/packaging/electron/imports.js +5 -3
- package/dist/packaging/electron/node.js +7 -1
- package/dist/packaging/electron/optional-peers.d.ts +22 -0
- package/dist/packaging/electron/optional-peers.js +16 -0
- package/dist/packaging/electron/ports.d.ts +16 -0
- package/dist/packaging/electron/staged-closure-node.d.ts +7 -0
- package/dist/packaging/electron/staged-closure-node.js +17 -0
- package/dist/packaging/electron/staged-closure.d.ts +27 -0
- package/dist/packaging/electron/staged-closure.js +128 -0
- package/dist/packaging/electron/staging.d.ts +28 -4
- package/dist/packaging/electron/staging.js +69 -27
- package/dist/packaging/electron/typescript.d.ts +15 -2
- package/dist/packaging/electron/typescript.js +101 -16
- package/dist/source-control/commit.js +23 -5
- package/dist/source-control/contracts.d.ts +11 -1
- package/dist/source-control/entry.d.ts +1 -0
- package/dist/source-control/entry.js +1 -0
- package/dist/source-control/kit.js +2 -0
- package/dist/source-control/registry.d.ts +5 -0
- package/dist/source-control/registry.js +5 -2
- package/dist/source-control/repository-path.d.ts +28 -0
- package/dist/source-control/repository-path.js +52 -0
- package/dist/source-control/repository-target.js +6 -3
- package/dist/static-export/contracts.d.ts +4 -5
- package/dist/static-export/css-urls.d.ts +16 -0
- package/dist/static-export/css-urls.js +66 -0
- package/dist/static-export/html-url-locations.d.ts +2 -1
- package/dist/static-export/html-url-locations.js +23 -3
- package/dist/static-export/node-adapters.js +8 -3
- package/dist/static-export/runner.js +47 -30
- package/dist/static-export/transforms.js +45 -29
- package/package.json +12 -6
package/README.md
CHANGED
|
@@ -12,8 +12,8 @@ public subpath and permission boundary.
|
|
|
12
12
|
| `./source-control` | Trusted provider catalogs, repository validation, export preview and commit orchestration. |
|
|
13
13
|
| `./static-export` | Manifest/app/writer-driven static export, path transforms and route/asset failure summaries. |
|
|
14
14
|
| `./static-export/node` | Explicit Node loopback app, artifact writer and theme-file inventory adapters. |
|
|
15
|
-
| `./packaging/electron` | Dependency staging, archive byte verification,
|
|
16
|
-
| `./packaging/electron/typescript` | Host-supplied TypeScript AST adapter; TypeScript is
|
|
15
|
+
| `./packaging/electron` | Dependency staging, staged runtime closure checks, optional-peer contracts, archive byte verification, freshness and quiet-tree policies. |
|
|
16
|
+
| `./packaging/electron/typescript` | Host-supplied TypeScript AST adapter; TypeScript is a required peer. |
|
|
17
17
|
| `./agent-jobs` | Bounded CLI jobs with resume, stdin prompts, raw logs and stream-based completion. |
|
|
18
18
|
| `./checks/published-types` | Published type-surface, registry-drift, linked-package and captured-log checks. |
|
|
19
19
|
| `./checks/coverage` | LCOV, floor, diff, disk-inventory and contamination/baseline policies. |
|
package/dist/agent-jobs/jobs.js
CHANGED
|
@@ -64,7 +64,7 @@ export async function runAgentJobs(required, optional = {}) {
|
|
|
64
64
|
ids.add(job.id);
|
|
65
65
|
}
|
|
66
66
|
await fs.mkdir({ path: options.outputDirectory });
|
|
67
|
-
const results =
|
|
67
|
+
const results = Array.from({ length: jobs.length });
|
|
68
68
|
let cursor = 0;
|
|
69
69
|
async function runOne(job) {
|
|
70
70
|
const base = path.join(options.outputDirectory, job.id);
|
|
@@ -101,7 +101,8 @@ export async function runAgentJobs(required, optional = {}) {
|
|
|
101
101
|
}
|
|
102
102
|
async function worker() {
|
|
103
103
|
while (cursor < jobs.length) {
|
|
104
|
-
const index = cursor
|
|
104
|
+
const index = cursor;
|
|
105
|
+
cursor += 1;
|
|
105
106
|
results[index] = await runOne(jobs[index]);
|
|
106
107
|
}
|
|
107
108
|
}
|
|
@@ -5,6 +5,12 @@ import { existsSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
|
|
5
5
|
import { dirname, join, relative, resolve } from 'node:path';
|
|
6
6
|
import { isBuiltin } from 'node:module';
|
|
7
7
|
import { diffHardwiringDebt, HARDWIRING_RULES, syntaxError } from './hardwiring.js';
|
|
8
|
+
const SKIPPED_DIRECTORY_NAMES = new Set(['node_modules', 'dist', 'build', 'coverage', 'release', 'release-verify', 'staging', '__tests__', '__measurements__', 'fixtures', 'vendor', '.git', '.build']);
|
|
9
|
+
/** JS/TS source that is not a test; declaration files only when asked for. */
|
|
10
|
+
function isAuthoredSource({ file, declarations }) {
|
|
11
|
+
const includesDeclarations = declarations || !/\.d\.[cm]?ts$/.test(file);
|
|
12
|
+
return /\.[cm]?[jt]sx?$/.test(file) && !/\.(?:test|spec)\./.test(file) && includesDeclarations;
|
|
13
|
+
}
|
|
8
14
|
/** Authored inventory excludes generated output, fixtures and tests. O(directory entries). */
|
|
9
15
|
export function sourceFiles({ directory, declarations = false }, _options = {}) {
|
|
10
16
|
const found = [];
|
|
@@ -12,12 +18,13 @@ export function sourceFiles({ directory, declarations = false }, _options = {})
|
|
|
12
18
|
if (!existsSync(dir))
|
|
13
19
|
return;
|
|
14
20
|
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
15
|
-
if (
|
|
21
|
+
if (SKIPPED_DIRECTORY_NAMES.has(entry.name))
|
|
16
22
|
continue;
|
|
17
23
|
const file = join(dir, entry.name);
|
|
18
|
-
|
|
24
|
+
const isDirectory = entry.isDirectory();
|
|
25
|
+
if (isDirectory)
|
|
19
26
|
visit(file);
|
|
20
|
-
|
|
27
|
+
if (!isDirectory && isAuthoredSource({ file, declarations }))
|
|
21
28
|
found.push(file);
|
|
22
29
|
}
|
|
23
30
|
}
|
|
@@ -103,14 +110,17 @@ function publicTargets(directory, exports) {
|
|
|
103
110
|
select(record[condition]);
|
|
104
111
|
}
|
|
105
112
|
function select(value) {
|
|
106
|
-
if (typeof value === 'string')
|
|
113
|
+
if (typeof value === 'string') {
|
|
107
114
|
selectPath(value);
|
|
108
|
-
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (Array.isArray(value)) {
|
|
109
118
|
const candidate = value.find(item => item !== null);
|
|
110
119
|
if (candidate !== undefined)
|
|
111
120
|
select(candidate);
|
|
121
|
+
return;
|
|
112
122
|
}
|
|
113
|
-
|
|
123
|
+
if (value && typeof value === 'object')
|
|
114
124
|
selectRecord(value);
|
|
115
125
|
}
|
|
116
126
|
select(exports);
|
|
@@ -11,21 +11,38 @@ export const HARDWIRING_RULES = [
|
|
|
11
11
|
'HW1-env-default', 'HW2-vendor-adapter', 'HW3-module-state', 'HW4-injected-fetch',
|
|
12
12
|
'HW5-jini-export', 'HW6-boot-default', 'HW7-public-react', 'HW8-provider-url', 'HW9-plugin-import',
|
|
13
13
|
];
|
|
14
|
+
/** Vendor SDK packages matched by exact name (or a subpath of it). Scoped vendors are in VENDOR_SCOPES. */
|
|
15
|
+
const VENDOR_PACKAGES = new Set([
|
|
16
|
+
'better-sqlite3', 'pg', 'postgres', 'mysql', 'mysql2', 'sqlite3', '@electric-sql/pglite', 'openai', '@anthropic-ai/sdk',
|
|
17
|
+
'@google/genai', '@google/generative-ai', '@supabase/supabase-js', '@libsql/client', 'composio-core', 'resend', 'stripe',
|
|
18
|
+
'replicate', '@fal-ai/client', 'sharp', 'undici', 'node-pty', 'playwright', 'playwright-core', 'puppeteer', 'puppeteer-core',
|
|
19
|
+
]);
|
|
20
|
+
const VENDOR_SCOPES = /^@(?:aws-sdk|azure|google-cloud|ai-sdk|tavily|composio|e2b)\//;
|
|
21
|
+
/** The package a bare specifier names: its first segment, or first two for a scoped package. */
|
|
22
|
+
function packageName(specifier) {
|
|
23
|
+
return specifier.split('/').slice(0, specifier.startsWith('@') ? 2 : 1).join('/');
|
|
24
|
+
}
|
|
14
25
|
/** Bind the installed compiler, keeping this optional parser out of the runtime dependency graph.
|
|
15
26
|
* Inspection is O(n) AST nodes, plus lexical-scope scans for bare fetch calls; no external I/O.
|
|
16
27
|
* Only the rule-identifying value is hashed for debt identity and never included in diagnostics (it may contain secrets).
|
|
17
28
|
*/
|
|
18
29
|
export function createHardwiringInspector({ compiler: c }, _options = {}) {
|
|
19
30
|
function parse({ file, source }, _options = {}) {
|
|
20
|
-
const tree = c.createSourceFile(file, source, c.ScriptTarget.Latest, true,
|
|
31
|
+
const tree = c.createSourceFile(file, source, c.ScriptTarget.Latest, true, scriptKind(file));
|
|
21
32
|
const failure = syntaxError({ tree, file });
|
|
22
33
|
if (failure)
|
|
23
34
|
throw failure;
|
|
24
35
|
return tree;
|
|
25
36
|
}
|
|
37
|
+
function scriptKind(file) {
|
|
38
|
+
if (/\.[jt]sx$/.test(file))
|
|
39
|
+
return c.ScriptKind.TSX;
|
|
40
|
+
return /\.[cm]?js$/.test(file) ? c.ScriptKind.JS : c.ScriptKind.TS;
|
|
41
|
+
}
|
|
26
42
|
function member(node, name) {
|
|
27
|
-
|
|
28
|
-
|
|
43
|
+
if (c.isPropertyAccessExpression(node))
|
|
44
|
+
return node.name.text === name;
|
|
45
|
+
return c.isElementAccessExpression(node) && c.isStringLiteralLike(node.argumentExpression) && node.argumentExpression.text === name;
|
|
29
46
|
}
|
|
30
47
|
function env(node) {
|
|
31
48
|
return member(node, 'env') && 'expression' in node && c.isIdentifier(node.expression) &&
|
|
@@ -121,15 +138,14 @@ export function createHardwiringInspector({ compiler: c }, _options = {}) {
|
|
|
121
138
|
}
|
|
122
139
|
// `provider-plugins/` holds provider plugin sources: each is a vendor adapter by definition.
|
|
123
140
|
function adapter(file) {
|
|
124
|
-
return /(?:^|\/)(?:adapters?|kernel|providers?|provider-plugins)(
|
|
141
|
+
return /(?:^|\/)(?:adapters?|kernel|providers?|provider-plugins)[/.]/.test(file) || /\.adapter\.[^.]+$/.test(file);
|
|
125
142
|
}
|
|
126
143
|
function urlOwner(file) {
|
|
127
|
-
return adapter(file) || /(?:^|\/)catalogs?
|
|
144
|
+
return adapter(file) || /(?:^|\/)catalogs?[/.]/.test(file);
|
|
128
145
|
}
|
|
129
146
|
function vendor(specifier) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
/^(?:node-pty|playwright(?:-core)?|puppeteer(?:-core)?)(?:$|\/)/.test(specifier) ||
|
|
147
|
+
// A vendor scope matches any of its packages; the named packages match themselves and their subpaths.
|
|
148
|
+
return VENDOR_PACKAGES.has(packageName(specifier)) || VENDOR_SCOPES.test(specifier) ||
|
|
133
149
|
/^(?:@[^/]+\/(?:sdk|[^/]+-sdk)|[^@/]+-sdk)(?:$|\/)/.test(specifier);
|
|
134
150
|
}
|
|
135
151
|
function moduleScope(node) {
|
|
@@ -160,14 +176,17 @@ export function createHardwiringInspector({ compiler: c }, _options = {}) {
|
|
|
160
176
|
return true;
|
|
161
177
|
return false;
|
|
162
178
|
}
|
|
179
|
+
function isGlobalThisFetch(value) {
|
|
180
|
+
if (!value || !member(value, 'fetch') || !('expression' in value))
|
|
181
|
+
return false;
|
|
182
|
+
const target = value.expression;
|
|
183
|
+
return c.isIdentifier(target) && target.text === 'globalThis';
|
|
184
|
+
}
|
|
163
185
|
function statementBindsFetch(statement) {
|
|
164
186
|
if (c.isVariableStatement(statement))
|
|
165
187
|
return statement.declarationList.declarations.some((d) => {
|
|
166
188
|
// Renaming the global to a local `fetch` is still a global call, not an injected port.
|
|
167
|
-
|
|
168
|
-
const nativeAlias = value && member(value, 'fetch') && 'expression' in value &&
|
|
169
|
-
c.isIdentifier(value.expression) && value.expression.text === 'globalThis';
|
|
170
|
-
return bindsFetch(d.name) && !nativeAlias;
|
|
189
|
+
return bindsFetch(d.name) && !isGlobalThisFetch(d.initializer);
|
|
171
190
|
});
|
|
172
191
|
if (c.isFunctionDeclaration(statement))
|
|
173
192
|
return statement.name?.text === 'fetch';
|
|
@@ -183,8 +202,9 @@ export function createHardwiringInspector({ compiler: c }, _options = {}) {
|
|
|
183
202
|
while (c.isParenthesizedExpression(expression.parent))
|
|
184
203
|
expression = expression.parent;
|
|
185
204
|
const parent = expression.parent;
|
|
186
|
-
|
|
187
|
-
|
|
205
|
+
if (c.isBinaryExpression(parent))
|
|
206
|
+
return parent.operatorToken.kind === c.SyntaxKind.QuestionQuestionToken && parent.right === expression;
|
|
207
|
+
return (c.isParameter(parent) || c.isBindingElement(parent)) && parent.initializer === expression;
|
|
188
208
|
}
|
|
189
209
|
/** Binding defaults and initializers are implementation; debt identity is only the declared names.
|
|
190
210
|
* Array holes retain their slots so moving a name changes its positional identity. */
|
|
@@ -196,7 +216,9 @@ export function createHardwiringInspector({ compiler: c }, _options = {}) {
|
|
|
196
216
|
function mutableModuleState(node, tree) {
|
|
197
217
|
if (!c.isVariableDeclaration(node) || !moduleScope(node) || !c.isVariableDeclarationList(node.parent))
|
|
198
218
|
return false;
|
|
199
|
-
|
|
219
|
+
// A flag test, not a boolean `&&`: the Const bit marks `const` (and `await using`) lists.
|
|
220
|
+
const constBinding = (node.parent.flags & c.NodeFlags.Const) !== 0;
|
|
221
|
+
if (!constBinding)
|
|
200
222
|
return true;
|
|
201
223
|
if (!node.initializer || !c.isNewExpression(node.initializer) || !c.isIdentifier(node.initializer.expression))
|
|
202
224
|
return false;
|
|
@@ -256,7 +278,7 @@ export function createHardwiringInspector({ compiler: c }, _options = {}) {
|
|
|
256
278
|
const found = inspectImports(input, tree, refs);
|
|
257
279
|
const report = (node, rule, reason, identity) => found.push(violation(tree, node, rule, reason, identity));
|
|
258
280
|
const jini = input.mode === 'jini';
|
|
259
|
-
const envExempt = /(?:^|\/)(?:bin|cli|testing)
|
|
281
|
+
const envExempt = /(?:^|\/)(?:bin|cli|testing)[/.]/.test(input.file);
|
|
260
282
|
const ownsUrls = urlOwner(input.file);
|
|
261
283
|
if (!jini && !refs.some((ref) => ref.specifier.startsWith('@jini-ai/'))) {
|
|
262
284
|
for (const item of exportedFunctions({ tree }))
|
|
@@ -45,7 +45,8 @@ export function evaluateMemoryFloors({ baselineSamples, checkpoints }, { limit =
|
|
|
45
45
|
if (tailGrowth > limit / 2)
|
|
46
46
|
failures.push('rising tail');
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
// Without a slope check, every checkpoint is held to the limit instead.
|
|
49
|
+
if (!checkSlope && floors.some(floor => (floor - baselineFloor) / baselineFloor > limit))
|
|
49
50
|
failures.push('checkpoint floor');
|
|
50
51
|
return { pass: failures.length === 0, baselineFloor, floors, growth, tailGrowth, failures };
|
|
51
52
|
}
|
package/dist/checks/node.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export type { HardwiringSource, HardwiringViolation } from './hardwiring.js';
|
|
|
7
7
|
export declare function createNodeFilesystem(_args: Record<string, never>): FilesystemPort;
|
|
8
8
|
/** Uses Node's environment precedence: exported variables win over file values. Requires Node 20.12+. */
|
|
9
9
|
export declare function createNodeEnvLoader(_args: Record<string, never>): EnvLoaderPort;
|
|
10
|
-
/** Shell-free runner; captures compiler output and reports signals/spawn failures as null exits. */
|
|
11
10
|
export declare function createNodeProcessRunner(_args: Record<string, never>, { maxBuffer, timeoutMs }?: {
|
|
12
11
|
maxBuffer?: number;
|
|
13
12
|
timeoutMs?: number;
|
package/dist/checks/node.js
CHANGED
|
@@ -29,11 +29,17 @@ export function createNodeEnvLoader(_args) {
|
|
|
29
29
|
return { load: ({ path: file }) => { process.loadEnvFile(file); } };
|
|
30
30
|
}
|
|
31
31
|
/** Shell-free runner; captures compiler output and reports signals/spawn failures as null exits. */
|
|
32
|
+
/** 0 on success, the child's numeric exit status on failure, or null when it never exited normally. */
|
|
33
|
+
function processExitCode(error) {
|
|
34
|
+
if (!error)
|
|
35
|
+
return 0;
|
|
36
|
+
return typeof error.code === 'number' ? error.code : null;
|
|
37
|
+
}
|
|
32
38
|
export function createNodeProcessRunner(_args, { maxBuffer = 32 * 1024 * 1024, timeoutMs = 300_000 } = {}) {
|
|
33
39
|
return {
|
|
34
40
|
run: ({ command, args, cwd }) => new Promise((resolve) => {
|
|
35
41
|
execFile(command, [...args], { cwd, encoding: 'utf8', maxBuffer, timeout: timeoutMs }, (error, stdout, stderr) => {
|
|
36
|
-
const exitCode =
|
|
42
|
+
const exitCode = processExitCode(error);
|
|
37
43
|
resolve({ exitCode, stdout, stderr: stderr || error?.message || '' });
|
|
38
44
|
});
|
|
39
45
|
}),
|
|
@@ -21,12 +21,15 @@ export function parseDiagnosticBlocks({ output }) {
|
|
|
21
21
|
const blocks = [];
|
|
22
22
|
let current = [];
|
|
23
23
|
for (const line of output.replace(/\r\n/g, '\n').split('\n')) {
|
|
24
|
-
|
|
24
|
+
const startsDiagnostic = /^\S.*\(\d+,\d+\): error TS\d+:/.test(line) || /^error TS\d+:/.test(line);
|
|
25
|
+
if (startsDiagnostic) {
|
|
25
26
|
if (current.length)
|
|
26
27
|
blocks.push(current.join('\n').trimEnd());
|
|
27
28
|
current = [line];
|
|
29
|
+
continue;
|
|
28
30
|
}
|
|
29
|
-
|
|
31
|
+
// Continuation lines belong to the open diagnostic; lines before the first one are dropped.
|
|
32
|
+
if (current.length)
|
|
30
33
|
current.push(line);
|
|
31
34
|
}
|
|
32
35
|
if (current.length)
|
|
@@ -79,6 +79,14 @@ export interface DeployPublishResult {
|
|
|
79
79
|
*/
|
|
80
80
|
export interface DeployTarget {
|
|
81
81
|
readonly id: string;
|
|
82
|
+
/** Resolve the destination before rendering public links. May provision the project's identity
|
|
83
|
+
* as part of an authorized publish; must not upload files or guess a deployment hostname.
|
|
84
|
+
* Optional for older adapters; without it, a host can publish a domainless copy with relative
|
|
85
|
+
* links and omit discovery metadata requiring a public URL, rather than use a locally saved domain.
|
|
86
|
+
*/
|
|
87
|
+
resolvePublicUrl?(requiredArgs: {
|
|
88
|
+
projectName: string;
|
|
89
|
+
}, optionalArgs?: Record<string, never>): Promise<string>;
|
|
82
90
|
publish(requiredArgs: DeployPublishInput, optionalArgs?: DeployPublishOptions): Promise<DeployPublishResult>;
|
|
83
91
|
checkReachability(requiredArgs: {
|
|
84
92
|
url: string;
|
package/dist/deploy/naming.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { trimChars, trimCharsEnd } from '@jini-ai/core/primitives';
|
|
1
2
|
/**
|
|
2
3
|
* Shared label-sanitizing helpers deploy targets use to turn a caller-supplied `projectName` into a
|
|
3
4
|
* provider-safe identifier (lowercase, hyphenated, length-capped). Lifted
|
|
@@ -11,14 +12,12 @@
|
|
|
11
12
|
* @overallScore 100/100
|
|
12
13
|
*/
|
|
13
14
|
export function safeProjectLabel({ raw, maxLength }) {
|
|
14
|
-
|
|
15
|
+
const collapsed = String(raw)
|
|
15
16
|
.normalize('NFKD')
|
|
16
17
|
.toLowerCase()
|
|
17
18
|
.replace(/[^a-z0-9-]/g, '-')
|
|
18
|
-
.replace(/-+/g, '-')
|
|
19
|
-
|
|
20
|
-
.slice(0, maxLength)
|
|
21
|
-
.replace(/-+$/g, '');
|
|
19
|
+
.replace(/-+/g, '-');
|
|
20
|
+
return trimCharsEnd({ text: trimChars({ text: collapsed, chars: '-' }).slice(0, maxLength), chars: '-' });
|
|
22
21
|
}
|
|
23
22
|
/** DNS-label-safe variant (63-char cap, the DNS label limit). */
|
|
24
23
|
export function safeDnsLabel({ raw }) {
|
package/dist/deploy/node.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Agent } from 'undici';
|
|
2
2
|
import { assertSafePublicUrl, createValidatingLookup } from '@jini-ai/platform';
|
|
3
3
|
function isLookupAddress(value) {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
if (value === null || typeof value !== 'object')
|
|
5
|
+
return false;
|
|
6
|
+
const hasAddress = 'address' in value && typeof value.address === 'string';
|
|
7
|
+
return hasAddress && 'family' in value && typeof value.family === 'number';
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
8
10
|
* Socket-level lookup for deployment probes: platform's validating lookup (private-address
|
|
@@ -201,6 +201,7 @@ function remainingBudget(ctx) {
|
|
|
201
201
|
*/
|
|
202
202
|
async function sweepCandidates(ctx, { lastMessage }) {
|
|
203
203
|
let protectedResult;
|
|
204
|
+
let message = lastMessage;
|
|
204
205
|
for (const url of ctx.candidates) {
|
|
205
206
|
const remainingMs = remainingBudget(ctx);
|
|
206
207
|
if (remainingMs <= 0)
|
|
@@ -216,27 +217,28 @@ async function sweepCandidates(ctx, { lastMessage }) {
|
|
|
216
217
|
url,
|
|
217
218
|
statusMessage: result.statusMessage || `${ctx.providerLabel} is gating this link behind its own auth wall.`,
|
|
218
219
|
};
|
|
219
|
-
continue;
|
|
220
220
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
221
|
+
else {
|
|
222
|
+
// Real refactor, not a padded test: `result.statusMessage` is
|
|
223
|
+
// unconditionally truthy by this point. `result` comes from
|
|
224
|
+
// `checkDeploymentUrl`, which — for every `reachable: false`,
|
|
225
|
+
// non-`'protected'` shape it can produce (the empty-URL guard, and
|
|
226
|
+
// both `requestDeploymentUrl`-derived returns after the dead-branch
|
|
227
|
+
// refactor just above) — always sets a non-empty `statusMessage`. The
|
|
228
|
+
// `reachable: true` and `status === 'protected'` shapes are both
|
|
229
|
+
// handled by the `return` and the protected branch above, so neither
|
|
230
|
+
// can reach here. `|| lastMessage` (falling back to the *previous*
|
|
231
|
+
// sweep's message) could therefore never actually be selected — see
|
|
232
|
+
// the archived extraction source map's 2026-07-22 addition for the proof.
|
|
233
|
+
// Non-null assertion (not `||`/`??`, which would just reintroduce the
|
|
234
|
+
// same dead branch): the type is `string | undefined` because
|
|
235
|
+
// `DeploymentUrlCheck.statusMessage` is optional in general, but this
|
|
236
|
+
// exact call site's result is always defined per the proof above.
|
|
237
|
+
message = result.statusMessage;
|
|
238
|
+
}
|
|
237
239
|
}
|
|
238
240
|
// A protected candidate is a fallback only after the other candidates had their turn.
|
|
239
|
-
return protectedResult ? { done: protectedResult } : { lastMessage };
|
|
241
|
+
return protectedResult ? { done: protectedResult } : { lastMessage: message };
|
|
240
242
|
}
|
|
241
243
|
/**
|
|
242
244
|
* Polls deployment candidates until one becomes reachable or `timeoutMs` elapses.
|
|
@@ -278,16 +280,17 @@ function uniqueCandidates({ urls }) {
|
|
|
278
280
|
*/
|
|
279
281
|
async function pollCandidates(ctx, { sleep, intervalMs }) {
|
|
280
282
|
let lastMessage = '';
|
|
281
|
-
|
|
283
|
+
let keepPolling = remainingBudget(ctx) > 0;
|
|
284
|
+
while (keepPolling) {
|
|
282
285
|
const sweep = await sweepCandidates(ctx, { lastMessage });
|
|
283
286
|
if ('done' in sweep)
|
|
284
287
|
return sweep.done;
|
|
285
288
|
lastMessage = sweep.lastMessage;
|
|
286
289
|
const remainingMs = remainingBudget(ctx);
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
290
|
+
// Stop when the budget is spent, the sleep is cut short, or the sleep consumed the rest.
|
|
291
|
+
keepPolling = remainingMs > 0 &&
|
|
292
|
+
await sleepWithinBudget({ sleep, ms: Math.min(intervalMs, remainingMs), timeoutMs: remainingMs }) &&
|
|
293
|
+
remainingBudget(ctx) > 0;
|
|
291
294
|
}
|
|
292
295
|
return {
|
|
293
296
|
status: 'link-delayed',
|
package/dist/dns/plan.js
CHANGED
|
@@ -18,7 +18,8 @@ const OP_ORDER = { delete: 0, update: 1, create: 2 };
|
|
|
18
18
|
export { canonicalJson };
|
|
19
19
|
/** sha-256 hex over the canonical plan, excluding any fingerprint it already carries. */
|
|
20
20
|
export function fingerprintPlan(required, _optional = {}) {
|
|
21
|
-
const
|
|
21
|
+
const body = { ...required.plan };
|
|
22
|
+
delete body.fingerprint;
|
|
22
23
|
return createHash('sha256').update(canonicalJson({ value: body })).digest('hex');
|
|
23
24
|
}
|
|
24
25
|
function finalize(plan) {
|
package/dist/dns/records.js
CHANGED
|
@@ -93,10 +93,14 @@ export function parseMxText(required, _optional = {}) {
|
|
|
93
93
|
}
|
|
94
94
|
/** `0 issue "letsencrypt.org"` → CAA value (quotes optional). */
|
|
95
95
|
export function parseCaaText(required, _optional = {}) {
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
// Same as /^(\d+)\s+(issue|issuewild|iodef)\s+"?([^"]*)"?$/i, split so the separator run and the
|
|
97
|
+
// value cannot backtrack against each other.
|
|
98
|
+
const text = required.text.trim();
|
|
99
|
+
const head = /^(\d+)\s+(issue|issuewild|iodef)(?=\s)/i.exec(text);
|
|
100
|
+
const value = head ? /^"?([^"]*)"?$/.exec(text.slice(head[0].length).trimStart()) : null;
|
|
101
|
+
if (!head || !value)
|
|
98
102
|
return undefined;
|
|
99
|
-
return { flags: Number(
|
|
103
|
+
return { flags: Number(head[1]), tag: head[2].toLowerCase(), value: value[1] };
|
|
100
104
|
}
|
|
101
105
|
/** Join quoted character-strings (`"a" "b"` → `ab`); an unquoted value is already logical. */
|
|
102
106
|
export function unquoteTxt(required, _optional = {}) {
|
package/dist/dns/registry.js
CHANGED
|
@@ -18,8 +18,10 @@ function isStringList(value) {
|
|
|
18
18
|
return Array.isArray(value) && value.every(entry => typeof entry === 'string');
|
|
19
19
|
}
|
|
20
20
|
function capabilitiesValid(value) {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
if (!isObject(value))
|
|
22
|
+
return false;
|
|
23
|
+
const flagsValid = typeof value.apexFlattening === 'boolean' && typeof value.proxy === 'boolean';
|
|
24
|
+
return typeof value.automatic === 'boolean' && isStringList(value.recordTypes) && flagsValid;
|
|
23
25
|
}
|
|
24
26
|
function optionalFunction(value) {
|
|
25
27
|
return value === undefined || typeof value === 'function';
|
package/dist/local-dev/index.js
CHANGED
|
@@ -10,9 +10,11 @@ export function parseLsofListeners({ stdout }) {
|
|
|
10
10
|
const found = [];
|
|
11
11
|
let pid;
|
|
12
12
|
for (const line of stdout.replace(/\r\n/g, '\n').split('\n')) {
|
|
13
|
-
if (line.startsWith('p'))
|
|
13
|
+
if (line.startsWith('p')) {
|
|
14
14
|
pid = line.slice(1);
|
|
15
|
-
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
if (line.startsWith('c') && pid) {
|
|
16
18
|
found.push({ pid, command: line.slice(1) });
|
|
17
19
|
pid = undefined;
|
|
18
20
|
}
|
|
@@ -36,7 +38,9 @@ export async function listenersOn({ port, runner, listenerCommand }) {
|
|
|
36
38
|
}
|
|
37
39
|
function validListenRange(required) {
|
|
38
40
|
const { port, attempts } = required;
|
|
39
|
-
|
|
41
|
+
const validAttempts = Number.isInteger(attempts) && attempts >= 1;
|
|
42
|
+
const validPorts = Number.isInteger(port) && port >= 0 && port + attempts - 1 <= 65535;
|
|
43
|
+
return validAttempts && validPorts;
|
|
40
44
|
}
|
|
41
45
|
/** One bind attempt; both one-shot handlers are removed however it ends, including a synchronous throw. */
|
|
42
46
|
function bindOnce(required, optional) {
|
|
@@ -6,4 +6,7 @@ export * from './imports.js';
|
|
|
6
6
|
export * from './stability.js';
|
|
7
7
|
export * from './node.js';
|
|
8
8
|
export * from './asar-adapter.js';
|
|
9
|
+
export * from './optional-peers.js';
|
|
10
|
+
export * from './staged-closure.js';
|
|
11
|
+
export * from './staged-closure-node.js';
|
|
9
12
|
//# sourceMappingURL=entry.d.ts.map
|
|
@@ -6,4 +6,7 @@ export * from './imports.js';
|
|
|
6
6
|
export * from './stability.js';
|
|
7
7
|
export * from './node.js';
|
|
8
8
|
export * from './asar-adapter.js';
|
|
9
|
+
export * from './optional-peers.js';
|
|
10
|
+
export * from './staged-closure.js';
|
|
11
|
+
export * from './staged-closure-node.js';
|
|
9
12
|
//# sourceMappingURL=entry.js.map
|
|
@@ -42,10 +42,12 @@ export function undeclaredDistImports(required) {
|
|
|
42
42
|
const source = Buffer.from(fs.read({ path: file })).toString('utf8');
|
|
43
43
|
for (const specifier of imports.imports({ file, source })) {
|
|
44
44
|
const target = localTarget({ specifier, file, distDir, aliases });
|
|
45
|
-
|
|
46
|
-
if (target !== undefined)
|
|
45
|
+
if (target !== undefined) {
|
|
47
46
|
visit(target, specifier, relative);
|
|
48
|
-
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const name = undeclaredPackage({ specifier, declared });
|
|
50
|
+
if (name !== undefined)
|
|
49
51
|
problems.push(`${name} (${relative})`);
|
|
50
52
|
}
|
|
51
53
|
};
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { existsSync, readFileSync, lstatSync, readdirSync, realpathSync, mkdirSync, cpSync, rmSync, statSync, openSync, readSync, closeSync } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
+
/** lstat kind: symlinks and special files are 'other'. */
|
|
4
|
+
function entryKind(info) {
|
|
5
|
+
if (info.isFile())
|
|
6
|
+
return 'file';
|
|
7
|
+
return info.isDirectory() ? 'directory' : 'other';
|
|
8
|
+
}
|
|
3
9
|
/** Explicit Node filesystem adapter. No effects occur until a port method is called. */
|
|
4
10
|
export function createNodePackagingFilesystem(_required) {
|
|
5
11
|
return {
|
|
@@ -18,7 +24,7 @@ export function createNodePackagingFilesystem(_required) {
|
|
|
18
24
|
closeSync(fd);
|
|
19
25
|
}
|
|
20
26
|
},
|
|
21
|
-
stat: ({ path }) => { const info = lstatSync(path); return { kind:
|
|
27
|
+
stat: ({ path }) => { const info = lstatSync(path); return { kind: entryKind(info), mtimeMs: info.mtimeMs, diskBytes: info.blocks * 512 }; },
|
|
22
28
|
entries: ({ path }) => readdirSync(path), realpath: ({ path }) => realpathSync(path),
|
|
23
29
|
copy: ({ from, to }, optional = {}) => {
|
|
24
30
|
const source = realpathSync(from);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Manifest-owned opt-in contracts shared by source guards and staged-package checks. */
|
|
2
|
+
export interface OptionalPeerManifest {
|
|
3
|
+
name?: string;
|
|
4
|
+
dependencies?: Readonly<Record<string, string>>;
|
|
5
|
+
peerDependencies?: Readonly<Record<string, string>>;
|
|
6
|
+
peerDependenciesMeta?: Readonly<Record<string, {
|
|
7
|
+
optional?: boolean;
|
|
8
|
+
}>>;
|
|
9
|
+
jini?: {
|
|
10
|
+
optionalPeers?: Readonly<Record<string, string>>;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/** Only an explicit feature and actionable message authorize an optional runtime boundary. */
|
|
14
|
+
export declare function optionalPeerClassification({ manifest, name }: {
|
|
15
|
+
manifest: OptionalPeerManifest;
|
|
16
|
+
name: string;
|
|
17
|
+
}, _options?: Record<string, never>): string | undefined;
|
|
18
|
+
/** Classification is mandatory even when an optional peer happens to be installed locally. */
|
|
19
|
+
export declare function optionalPeerContractProblems({ manifest }: {
|
|
20
|
+
manifest: OptionalPeerManifest;
|
|
21
|
+
}, _options?: Record<string, never>): string[];
|
|
22
|
+
//# sourceMappingURL=optional-peers.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function isOptionalPeer({ manifest, name }) {
|
|
2
|
+
return Boolean(manifest.peerDependencies?.[name] && manifest.peerDependenciesMeta?.[name]?.optional === true);
|
|
3
|
+
}
|
|
4
|
+
/** Only an explicit feature and actionable message authorize an optional runtime boundary. */
|
|
5
|
+
export function optionalPeerClassification({ manifest, name }, _options = {}) {
|
|
6
|
+
const value = manifest.jini?.optionalPeers?.[name];
|
|
7
|
+
if (!isOptionalPeer({ manifest, name }))
|
|
8
|
+
return undefined;
|
|
9
|
+
return typeof value === 'string' && /^opt-in: \S.* [—–] \S.+/.test(value) ? value : undefined;
|
|
10
|
+
}
|
|
11
|
+
/** Classification is mandatory even when an optional peer happens to be installed locally. */
|
|
12
|
+
export function optionalPeerContractProblems({ manifest }, _options = {}) {
|
|
13
|
+
return Object.entries(manifest.peerDependenciesMeta ?? {}).filter(([name, meta]) => meta.optional === true && !optionalPeerClassification({ manifest, name }))
|
|
14
|
+
.map(([name]) => `unclassified optional peer ${name}; declare jini.optionalPeers with opt-in feature and user-facing message, or make it required`);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=optional-peers.js.map
|
|
@@ -80,6 +80,22 @@ export interface ImportReaderPort {
|
|
|
80
80
|
file: string;
|
|
81
81
|
source: string;
|
|
82
82
|
}): readonly string[];
|
|
83
|
+
references?(required: {
|
|
84
|
+
file: string;
|
|
85
|
+
source: string;
|
|
86
|
+
}): readonly {
|
|
87
|
+
specifier: string;
|
|
88
|
+
kind: 'import' | 'require';
|
|
89
|
+
line: number;
|
|
90
|
+
deferred: boolean;
|
|
91
|
+
}[];
|
|
92
|
+
}
|
|
93
|
+
export interface RuntimeResolverPort {
|
|
94
|
+
resolve(required: {
|
|
95
|
+
fromFile: string;
|
|
96
|
+
specifier: string;
|
|
97
|
+
kind: 'import' | 'require';
|
|
98
|
+
}): string;
|
|
83
99
|
}
|
|
84
100
|
export interface ImportAliasPort {
|
|
85
101
|
resolve(required: {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RuntimeResolverPort } from './ports.js';
|
|
2
|
+
/** Native Node resolution preserves conditional exports, package imports and nested versions.
|
|
3
|
+
* The explicit flag enables Node's parent URL parameter; omitting it would resolve from this tool.
|
|
4
|
+
* No imported module is evaluated. The caller checks target containment and existence.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createNodeRuntimeResolver(_input: Record<string, never>, _options?: Record<string, never>): RuntimeResolverPort;
|
|
7
|
+
//# sourceMappingURL=staged-closure-node.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
3
|
+
/** Native Node resolution preserves conditional exports, package imports and nested versions.
|
|
4
|
+
* The explicit flag enables Node's parent URL parameter; omitting it would resolve from this tool.
|
|
5
|
+
* No imported module is evaluated. The caller checks target containment and existence.
|
|
6
|
+
*/
|
|
7
|
+
export function createNodeRuntimeResolver(_input, _options = {}) {
|
|
8
|
+
if (!process.execArgv.includes('--experimental-import-meta-resolve'))
|
|
9
|
+
throw new Error('staged closure needs node --experimental-import-meta-resolve to resolve from each staged importer');
|
|
10
|
+
return { resolve({ fromFile, specifier, kind }) {
|
|
11
|
+
if (kind === 'require')
|
|
12
|
+
return createRequire(fromFile).resolve(specifier);
|
|
13
|
+
const resolve = import.meta.resolve;
|
|
14
|
+
return fileURLToPath(resolve(specifier, pathToFileURL(fromFile).href));
|
|
15
|
+
} };
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=staged-closure-node.js.map
|