@blinkhost/cli 2.7.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +514 -2
- package/dist/api.d.ts +2 -2
- package/dist/api.js +57 -8
- package/dist/assistant.js +6 -1
- package/dist/cli.js +157 -9
- package/dist/guidance.d.ts +1 -1
- package/dist/guidance.js +43 -11
- package/dist/javascript-runtime/resource-limits.js +3 -0
- package/dist/javascript-runtime/resource-profiles.js +2 -0
- package/dist/local-dev.d.ts +3 -0
- package/dist/local-dev.js +145 -0
- package/dist/local-development/README.md +410 -0
- package/dist/local-development/artifact-watch.mjs +36 -0
- package/dist/local-development/blinkhost.local.example.json +15 -0
- package/dist/local-development/frontend-proxy.mjs +189 -0
- package/dist/local-development/hello.rs +24 -0
- package/dist/local-development/local-stack.mjs +511 -0
- package/dist/local-development/native-database.mjs +37 -0
- package/dist/local-development/provider-fixtures.example.json +36 -0
- package/dist/local-development/provider-fixtures.mjs +203 -0
- package/dist/local-development/provider-grants.mjs +36 -0
- package/dist/local-development/test-provider-example.mjs +74 -0
- package/dist/local-source-build.d.ts +39 -0
- package/dist/local-source-build.js +225 -0
- package/dist/local-source-watch.d.ts +24 -0
- package/dist/local-source-watch.js +87 -0
- package/dist/local-test-command.d.ts +49 -0
- package/dist/local-test-command.js +128 -0
- package/dist/local-test-config.d.ts +37 -0
- package/dist/local-test-config.js +174 -0
- package/dist/local-test-gates.d.ts +71 -0
- package/dist/local-test-gates.js +247 -0
- package/dist/local-test-go-runner.d.ts +27 -0
- package/dist/local-test-go-runner.js +209 -0
- package/dist/local-test-node-arguments.d.ts +2 -0
- package/dist/local-test-node-arguments.js +14 -0
- package/dist/local-test-node-reporter.d.ts +7 -0
- package/dist/local-test-node-reporter.js +159 -0
- package/dist/local-test-results.d.ts +65 -0
- package/dist/local-test-results.js +163 -0
- package/dist/local-test-rust-runner.d.ts +18 -0
- package/dist/local-test-rust-runner.js +252 -0
- package/dist/local-test-starters.d.ts +3 -0
- package/dist/local-test-starters.js +157 -0
- package/dist/logs.d.ts +43 -0
- package/dist/logs.js +417 -0
- package/dist/module-build-diagnostics.d.ts +10 -0
- package/dist/module-build-diagnostics.js +208 -0
- package/dist/module-build.js +4 -0
- package/dist/release-preparation-diagnostics.d.ts +38 -0
- package/dist/release-preparation-diagnostics.js +204 -0
- package/dist/remote.js +14 -0
- package/dist/templates.d.ts +1 -0
- package/dist/templates.js +4 -1
- package/dist/test-credentials.d.ts +7 -0
- package/dist/test-credentials.js +236 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/workflows.d.ts +39 -2
- package/dist/workflows.js +241 -14
- package/package.json +4 -3
- package/test-runners/python-unittest.py +266 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/** Deterministic customer-owned loopback fixtures. No forwarding or provider credentials. */
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { createServer } from 'node:http';
|
|
4
|
+
|
|
5
|
+
const BODY_BYTES = 65_536, FIXTURE_BYTES = 1_048_576, EVENT_LIMIT = 256;
|
|
6
|
+
const fail = code => { throw new Error(code); };
|
|
7
|
+
const object = value => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
8
|
+
function keys(value, required, optional = []) {
|
|
9
|
+
if (!object(value) || required.some(key => !Object.hasOwn(value, key))
|
|
10
|
+
|| Object.keys(value).some(key => ![...required, ...optional].includes(key))) fail('invalid_local_provider_fixture');
|
|
11
|
+
}
|
|
12
|
+
function integer(value, min, max) {
|
|
13
|
+
if (!Number.isSafeInteger(value) || value < min || value > max) fail('invalid_local_provider_fixture_limit');
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
const controls = /[\x00-\x1f\x7f]/;
|
|
17
|
+
|
|
18
|
+
export function providerFixtures(value = {}) {
|
|
19
|
+
if (!object(value) || Object.keys(value).length > 8) fail('invalid_local_provider_fixtures');
|
|
20
|
+
const result = {};
|
|
21
|
+
let configuredBytes = 2;
|
|
22
|
+
// Count each copied JSON component before retaining it. Escape-heavy bodies
|
|
23
|
+
// must obey the serialized limit too, without first building the whole tree.
|
|
24
|
+
const account = item => {
|
|
25
|
+
configuredBytes += Buffer.byteLength(JSON.stringify(item)) + 2;
|
|
26
|
+
if (configuredBytes > FIXTURE_BYTES) fail('invalid_local_provider_fixture_limit');
|
|
27
|
+
};
|
|
28
|
+
for (const [name, provider] of Object.entries(value)) {
|
|
29
|
+
if (!/^[a-z][a-z0-9-]{0,47}$/.test(name)) fail('invalid_local_provider_fixture_name');
|
|
30
|
+
account(name); account({ routes: [] });
|
|
31
|
+
keys(provider, ['routes']);
|
|
32
|
+
if (!Array.isArray(provider.routes) || !provider.routes.length || provider.routes.length > 32) fail('invalid_local_provider_fixture_routes');
|
|
33
|
+
const routes = provider.routes.map(route => {
|
|
34
|
+
keys(route, ['method', 'path', 'responses'], ['request_sha256', 'repeat_last']);
|
|
35
|
+
if (!['GET', 'POST', 'PUT', 'PATCH', 'DELETE'].includes(route.method)
|
|
36
|
+
|| typeof route.path !== 'string' || !route.path.startsWith('/') || route.path.startsWith('//')
|
|
37
|
+
|| route.path.length > 2048 || /[?#\\]/.test(route.path) || controls.test(route.path)
|
|
38
|
+
|| route.path.split('/').some(part => part === '.' || part === '..')) fail('invalid_local_provider_fixture_route');
|
|
39
|
+
if (route.request_sha256 !== undefined && (typeof route.request_sha256 !== 'string'
|
|
40
|
+
|| !/^[a-f0-9]{64}$/.test(route.request_sha256))) fail('invalid_local_provider_fixture_request_digest');
|
|
41
|
+
if (route.repeat_last !== undefined && typeof route.repeat_last !== 'boolean') fail('invalid_local_provider_fixture_repeat');
|
|
42
|
+
if (!Array.isArray(route.responses) || !route.responses.length || route.responses.length > 32) fail('invalid_local_provider_fixture_responses');
|
|
43
|
+
account({ method: route.method, path: route.path, responses: [], request_sha256: route.request_sha256,
|
|
44
|
+
repeat_last: route.repeat_last ?? false });
|
|
45
|
+
const responses = route.responses.map(response => {
|
|
46
|
+
keys(response, ['status'], ['headers', 'body', 'chunks', 'delay_ms']);
|
|
47
|
+
integer(response.status, 200, 599);
|
|
48
|
+
if (response.status >= 300 && response.status < 400) fail('local_provider_fixture_redirect_forbidden');
|
|
49
|
+
if (response.body !== undefined && response.chunks !== undefined) fail('invalid_local_provider_fixture_response');
|
|
50
|
+
const headers = response.headers ?? {};
|
|
51
|
+
keys(headers, [], ['content-type', 'retry-after']);
|
|
52
|
+
for (const [key, item] of Object.entries(headers)) {
|
|
53
|
+
if (typeof item !== 'string' || !item || item.length > 256 || controls.test(item)
|
|
54
|
+
|| (key === 'retry-after' && !/^[0-9]{1,5}$/.test(item))) fail('invalid_local_provider_fixture_header');
|
|
55
|
+
}
|
|
56
|
+
const delay = integer(response.delay_ms ?? 0, 0, 30_000);
|
|
57
|
+
account({ status: response.status, headers, chunks: [], delay_ms: delay });
|
|
58
|
+
let bodyBytes = 0, elapsed = delay;
|
|
59
|
+
const copyChunk = (body, milliseconds) => {
|
|
60
|
+
if (typeof body !== 'string') fail('invalid_local_provider_fixture_body');
|
|
61
|
+
bodyBytes += Buffer.byteLength(body); elapsed += milliseconds;
|
|
62
|
+
if (bodyBytes > BODY_BYTES || elapsed > 30_000) fail('invalid_local_provider_fixture_limit');
|
|
63
|
+
const chunk = { body, delay_ms: milliseconds };
|
|
64
|
+
account(chunk); return chunk;
|
|
65
|
+
};
|
|
66
|
+
let chunks;
|
|
67
|
+
if (response.chunks !== undefined) {
|
|
68
|
+
if (!Array.isArray(response.chunks) || !response.chunks.length || response.chunks.length > 64) fail('invalid_local_provider_fixture_chunks');
|
|
69
|
+
chunks = response.chunks.map(chunk => {
|
|
70
|
+
keys(chunk, ['body'], ['delay_ms']);
|
|
71
|
+
return copyChunk(chunk.body, integer(chunk.delay_ms ?? 0, 0, 30_000));
|
|
72
|
+
});
|
|
73
|
+
} else {
|
|
74
|
+
if (response.body !== undefined && typeof response.body !== 'string') fail('invalid_local_provider_fixture_body');
|
|
75
|
+
chunks = [copyChunk(response.body ?? '', 0)];
|
|
76
|
+
}
|
|
77
|
+
if ([204, 205, 304].includes(response.status) && chunks.some(chunk => chunk.body)) fail('invalid_local_provider_fixture_response');
|
|
78
|
+
return { status: response.status, headers: { ...headers }, chunks, delay_ms: delay };
|
|
79
|
+
});
|
|
80
|
+
return { method: route.method, path: route.path, responses, request_sha256: route.request_sha256,
|
|
81
|
+
repeat_last: route.repeat_last ?? false };
|
|
82
|
+
});
|
|
83
|
+
if (new Set(routes.map(route => route.method + ' ' + route.path)).size !== routes.length) fail('duplicate_local_provider_fixture_route');
|
|
84
|
+
result[name] = { routes };
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const delay = (milliseconds, signal) => new Promise((resolve, reject) => {
|
|
90
|
+
if (signal.aborted) { reject(new Error('local_provider_fixture_cancelled')); return; }
|
|
91
|
+
const abort = () => { clearTimeout(timer); reject(new Error('local_provider_fixture_cancelled')); };
|
|
92
|
+
const timer = setTimeout(() => { signal.removeEventListener('abort', abort); resolve(); }, milliseconds);
|
|
93
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export async function startProviderFixture(name, definition) {
|
|
97
|
+
const fixture = providerFixtures({ [name]: definition })[name];
|
|
98
|
+
// Validation above copies the customer definition before any listener starts.
|
|
99
|
+
const routes = fixture.routes.map(route => ({ ...route, consumed: 0, attempts: 0 }));
|
|
100
|
+
let active = 0, stopped = false, stopping, dropped = 0, completed = 0, aborted = 0, rejected = 0;
|
|
101
|
+
const events = [], sockets = new Set(), closingResponses = new Set();
|
|
102
|
+
const record = event => { if (events.length < EVENT_LIMIT) events.push(event); else dropped += 1; };
|
|
103
|
+
const server = createServer({ maxHeaderSize: 8192, requestTimeout: 5000,
|
|
104
|
+
headersTimeout: 5000, connectionsCheckingInterval: 250 }, async (request, response) => {
|
|
105
|
+
const address = server.address(), host = `127.0.0.1:${address.port}`;
|
|
106
|
+
response.setHeader('cache-control', 'no-store'); response.setHeader('x-content-type-options', 'nosniff');
|
|
107
|
+
const reply = (status, body) => {
|
|
108
|
+
if (response.destroyed || response.writableEnded) return;
|
|
109
|
+
response.writeHead(status, { 'content-type': 'text/plain; charset=utf-8', connection: 'close' }); response.end(body);
|
|
110
|
+
};
|
|
111
|
+
const count = name => request.rawHeaders.filter((_, index) => index % 2 === 0).filter(key => key.toLowerCase() === name).length;
|
|
112
|
+
if (request.socket.remoteAddress !== '127.0.0.1' || count('host') !== 1 || count('origin') > 1
|
|
113
|
+
|| request.headers.host !== host || (request.headers.origin !== undefined && request.headers.origin !== `http://${host}`)) {
|
|
114
|
+
reply(403, 'local fixture origin rejected'); return;
|
|
115
|
+
}
|
|
116
|
+
if (stopped || active >= 16) { reply(503, 'local fixture capacity unavailable'); return; }
|
|
117
|
+
const route = routes.find(route => route.method === request.method && route.path === request.url);
|
|
118
|
+
if (!route) { reply(404, 'local fixture route unavailable'); return; }
|
|
119
|
+
active += 1;
|
|
120
|
+
let resolveClosed;
|
|
121
|
+
const closed = new Promise(resolve => { resolveClosed = resolve; });
|
|
122
|
+
closingResponses.add(closed);
|
|
123
|
+
const controller = new AbortController(); let terminal = false, bodyTimer;
|
|
124
|
+
const event = { route: route.method + ' ' + route.path, response_index: null, request_bytes: 0,
|
|
125
|
+
request_sha256: null, status: null, outcome: 'aborted' };
|
|
126
|
+
response.once('finish', () => {
|
|
127
|
+
terminal = true;
|
|
128
|
+
if (event.outcome === 'completed') completed += 1; else rejected += 1;
|
|
129
|
+
});
|
|
130
|
+
response.once('close', () => {
|
|
131
|
+
clearTimeout(bodyTimer); controller.abort(); active -= 1;
|
|
132
|
+
if (!terminal) aborted += 1;
|
|
133
|
+
record({ ...event });
|
|
134
|
+
closingResponses.delete(closed); resolveClosed();
|
|
135
|
+
});
|
|
136
|
+
request.once('aborted', () => controller.abort());
|
|
137
|
+
bodyTimer = setTimeout(() => { event.status = 408; event.outcome = 'body_timeout'; reply(408, 'local fixture body timed out'); }, 5000);
|
|
138
|
+
try {
|
|
139
|
+
const hash = createHash('sha256');
|
|
140
|
+
for await (const chunk of request) {
|
|
141
|
+
event.request_bytes += chunk.length;
|
|
142
|
+
if (event.request_bytes > BODY_BYTES) { event.status = 413; event.outcome = 'body_limit'; reply(413, 'local fixture body limit exceeded'); return; }
|
|
143
|
+
hash.update(chunk);
|
|
144
|
+
}
|
|
145
|
+
clearTimeout(bodyTimer);
|
|
146
|
+
controller.signal.throwIfAborted();
|
|
147
|
+
event.request_sha256 = hash.digest('hex');
|
|
148
|
+
route.attempts += 1;
|
|
149
|
+
if (route.request_sha256 && event.request_sha256 !== route.request_sha256) {
|
|
150
|
+
event.status = 422; event.outcome = 'request_mismatch'; reply(422, 'local fixture request mismatch'); return;
|
|
151
|
+
}
|
|
152
|
+
const index = route.consumed;
|
|
153
|
+
if (index >= route.responses.length && !route.repeat_last) {
|
|
154
|
+
event.status = 409; event.outcome = 'sequence_exhausted'; reply(409, 'local fixture sequence exhausted'); return;
|
|
155
|
+
}
|
|
156
|
+
// Admission consumes the step even when a client leaves after sending it.
|
|
157
|
+
// A retry does not invent an exactly-once provider side effect.
|
|
158
|
+
route.consumed += 1;
|
|
159
|
+
event.response_index = Math.min(index, route.responses.length - 1);
|
|
160
|
+
const selected = route.responses[event.response_index];
|
|
161
|
+
await delay(selected.delay_ms, controller.signal);
|
|
162
|
+
event.status = selected.status;
|
|
163
|
+
response.writeHead(selected.status, { 'content-type': 'application/json', ...selected.headers });
|
|
164
|
+
for (const chunk of selected.chunks) {
|
|
165
|
+
await delay(chunk.delay_ms, controller.signal);
|
|
166
|
+
if (response.destroyed) return;
|
|
167
|
+
if (!response.write(chunk.body)) {
|
|
168
|
+
await new Promise((resolve, reject) => {
|
|
169
|
+
const abort = () => { response.off('drain', drain); reject(new Error('local_provider_fixture_cancelled')); };
|
|
170
|
+
const drain = () => { controller.signal.removeEventListener('abort', abort); resolve(); };
|
|
171
|
+
controller.signal.addEventListener('abort', abort, { once: true }); response.once('drain', drain);
|
|
172
|
+
if (controller.signal.aborted) abort();
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
event.outcome = 'completed'; response.end();
|
|
177
|
+
} catch {
|
|
178
|
+
if (!controller.signal.aborted) { event.status = 400; event.outcome = 'request_failed'; reply(400, 'local fixture request unavailable'); }
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
server.requestTimeout = 5000; server.headersTimeout = 5000; server.keepAliveTimeout = 1000;
|
|
182
|
+
server.on('connection', socket => {
|
|
183
|
+
if (stopped || sockets.size >= 32) { socket.destroy(); return; }
|
|
184
|
+
sockets.add(socket); socket.once('close', () => sockets.delete(socket));
|
|
185
|
+
});
|
|
186
|
+
await new Promise((resolve, reject) => { server.once('error', reject); server.listen(0, '127.0.0.1', resolve); });
|
|
187
|
+
const origin = `http://127.0.0.1:${server.address().port}`;
|
|
188
|
+
const snapshot = () => ({ schema: 'blinkhost.local-provider-fixture/v1', name, origin, active, completed, aborted, rejected,
|
|
189
|
+
dropped_events: dropped, events: events.map(event => ({ ...event })),
|
|
190
|
+
routes: routes.map(route => ({ method: route.method, path: route.path, attempts: route.attempts, consumed: route.consumed })),
|
|
191
|
+
outbound_connections: false, production_authority: false });
|
|
192
|
+
return { origin, snapshot,
|
|
193
|
+
stop: () => {
|
|
194
|
+
if (!stopping) {
|
|
195
|
+
stopped = true;
|
|
196
|
+
const responsesClosed = [...closingResponses];
|
|
197
|
+
const listenerClosed = new Promise(resolve => { server.close(resolve); });
|
|
198
|
+
for (const socket of sockets) socket.destroy();
|
|
199
|
+
stopping = Promise.all([listenerClosed, ...responsesClosed]).then(snapshot);
|
|
200
|
+
}
|
|
201
|
+
return stopping;
|
|
202
|
+
} };
|
|
203
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Explicit grants to fixtures created by this local stack, never caller URLs. */
|
|
2
|
+
function fail(code) { throw new Error(code); }
|
|
3
|
+
|
|
4
|
+
export function providerPermissions(value, providers) {
|
|
5
|
+
if (value === undefined) return null;
|
|
6
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)
|
|
7
|
+
|| Object.keys(value).length !== 2 || value.module !== 'customer-local'
|
|
8
|
+
|| !Array.isArray(value.fixtures) || !value.fixtures.length || value.fixtures.length > 8
|
|
9
|
+
|| new Set(value.fixtures).size !== value.fixtures.length
|
|
10
|
+
|| value.fixtures.some(name => typeof name !== 'string' || !Object.hasOwn(providers, name))) {
|
|
11
|
+
fail('invalid_local_provider_permissions');
|
|
12
|
+
}
|
|
13
|
+
for (const name of value.fixtures) {
|
|
14
|
+
if (!/^[a-z][a-z0-9-]{0,46}[a-z0-9]$|^[a-z]$/.test(name)) fail('invalid_local_provider_permissions');
|
|
15
|
+
for (const route of providers[name].routes) {
|
|
16
|
+
if (route.path.length > 2048 || /[%\\?#\s\u0080-\uffff]/.test(route.path)
|
|
17
|
+
|| route.path.startsWith('//') || new URL('http://127.0.0.1:1' + route.path).pathname !== route.path) {
|
|
18
|
+
fail('invalid_local_provider_permissions');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return { module: value.module, fixtures: [...value.fixtures] };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function localProviderGrant(permissions, artifactSha256, definitions, started) {
|
|
26
|
+
if (!permissions) return null;
|
|
27
|
+
return { artifact_sha256: artifactSha256, module: permissions.module,
|
|
28
|
+
fixtures: permissions.fixtures.map(name => {
|
|
29
|
+
const owned = started.find(provider => provider.name === name);
|
|
30
|
+
if (!owned || !/^http:\/\/127\.0\.0\.1:[1-9][0-9]{0,4}$/.test(owned.fixture.origin)) {
|
|
31
|
+
fail('local_provider_owned_fixture_missing');
|
|
32
|
+
}
|
|
33
|
+
return { name, origin: owned.fixture.origin,
|
|
34
|
+
routes: definitions[name].routes.map(({ method, path }) => ({ method, path })) };
|
|
35
|
+
}) };
|
|
36
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/** Adaptable native customer test. Only explicit, harness-owned loopback fixtures. */
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { writeFile } from 'node:fs/promises';
|
|
4
|
+
|
|
5
|
+
const env = process.env;
|
|
6
|
+
assert.ok(env.BLINKHOST_LOCAL_PROVIDER_FIXTURES && Buffer.byteLength(env.BLINKHOST_LOCAL_PROVIDER_FIXTURES) <= 4096,
|
|
7
|
+
'supply the three owned provider fixture origins');
|
|
8
|
+
const origins = JSON.parse(env.BLINKHOST_LOCAL_PROVIDER_FIXTURES);
|
|
9
|
+
assert.ok(origins && typeof origins === 'object' && !Array.isArray(origins));
|
|
10
|
+
assert.deepEqual(Object.keys(origins).sort(), ['ai', 'email', 'payment']);
|
|
11
|
+
for (const origin of Object.values(origins)) {
|
|
12
|
+
assert.ok(typeof origin === 'string' && /^http:\/\/127\.0\.0\.1:[1-9][0-9]{0,4}$/.test(origin), 'fixture origins must be explicit loopback URLs');
|
|
13
|
+
assert.equal(new URL(origin).origin, origin, 'fixture origins must be canonical');
|
|
14
|
+
}
|
|
15
|
+
assert.equal(new Set(Object.values(origins)).size, 3, 'provider fixtures must be distinct');
|
|
16
|
+
const contextKeys = ['BLINKHOST_TEST_RESULT_PATH', 'BLINKHOST_TEST_RUN_ID', 'BLINKHOST_TEST_CHECK_ID', 'BLINKHOST_TEST_PROFILE'];
|
|
17
|
+
const reporting = contextKeys.some(key => env[key] !== undefined);
|
|
18
|
+
if (reporting) {
|
|
19
|
+
assert.ok(contextKeys.every(key => env[key]), 'structured results require a complete test context');
|
|
20
|
+
assert.equal(env.BLINKHOST_TEST_PROFILE, 'native', 'direct fixture HTTP tests use the native profile');
|
|
21
|
+
}
|
|
22
|
+
const tests = [];
|
|
23
|
+
async function check(id, action) {
|
|
24
|
+
const started = performance.now(); let status = 'passed';
|
|
25
|
+
try { await action(); }
|
|
26
|
+
catch (error) { status = 'failed'; throw error; }
|
|
27
|
+
finally { tests.push({ id, name: id, status, duration_ms: Math.round(performance.now() - started),
|
|
28
|
+
...(status === 'failed' ? { message: 'The customer provider fixture assertion failed.' } : {}) }); }
|
|
29
|
+
}
|
|
30
|
+
async function call(provider, path, body, headers = {}) {
|
|
31
|
+
const response = await fetch(origins[provider] + path, { method: 'POST', body, headers,
|
|
32
|
+
redirect: 'error', signal: AbortSignal.timeout(3000) });
|
|
33
|
+
let bytes = 0; const chunks = [];
|
|
34
|
+
for await (const chunk of response.body) {
|
|
35
|
+
bytes += chunk.length; assert.ok(bytes <= 65_536, 'provider fixture response exceeds the test bound');
|
|
36
|
+
chunks.push(chunk);
|
|
37
|
+
}
|
|
38
|
+
return { status: response.status, headers: response.headers, body: Buffer.concat(chunks).toString('utf8') };
|
|
39
|
+
}
|
|
40
|
+
let failure;
|
|
41
|
+
try {
|
|
42
|
+
await check('email-body-mismatch', async () => assert.equal((await call('email', '/send', 'wrong')).status, 422));
|
|
43
|
+
await check('email-rate-limit', async () => {
|
|
44
|
+
const response = await call('email', '/send', 'customer-email');
|
|
45
|
+
assert.equal(response.status, 429); assert.equal(response.headers.get('retry-after'), '1');
|
|
46
|
+
assert.deepEqual(JSON.parse(response.body), { error: 'limited' });
|
|
47
|
+
});
|
|
48
|
+
await check('email-retry-success', async () => {
|
|
49
|
+
const response = await call('email', '/send', 'customer-email');
|
|
50
|
+
assert.equal(response.status, 202); assert.deepEqual(JSON.parse(response.body), { id: 'local-send' });
|
|
51
|
+
});
|
|
52
|
+
await check('email-sequence-exhausted', async () => assert.equal((await call('email', '/send', 'customer-email')).status, 409));
|
|
53
|
+
await check('payment-declined', async () => {
|
|
54
|
+
const response = await call('payment', '/charge', 'customer-payment');
|
|
55
|
+
assert.equal(response.status, 402); assert.deepEqual(JSON.parse(response.body), { error: 'declined' });
|
|
56
|
+
});
|
|
57
|
+
await check('ai-stream-complete', async () => {
|
|
58
|
+
const response = await call('ai', '/chat', 'customer-prompt');
|
|
59
|
+
assert.equal(response.status, 200); assert.equal(response.headers.get('content-type'), 'text/event-stream');
|
|
60
|
+
assert.equal(response.body, 'data: {"token":"hello"}\n\ndata: [DONE]\n\n');
|
|
61
|
+
});
|
|
62
|
+
await check('unexpected-route', async () => assert.equal((await call('ai', '/unconfigured', 'input')).status, 404));
|
|
63
|
+
await check('remote-browser-origin-denied', async () =>
|
|
64
|
+
assert.equal((await call('ai', '/chat', 'input', { origin: 'https://remote.example' })).status, 403));
|
|
65
|
+
} catch (error) { failure = error; }
|
|
66
|
+
if (reporting) {
|
|
67
|
+
await writeFile(env.BLINKHOST_TEST_RESULT_PATH, JSON.stringify({ schema: 'blinkhost.local-test-results/v1',
|
|
68
|
+
run_id: env.BLINKHOST_TEST_RUN_ID, check_id: env.BLINKHOST_TEST_CHECK_ID,
|
|
69
|
+
runner: 'Customer-owned provider fixture example', profile: 'native', tests,
|
|
70
|
+
coverage: { status: 'not_collected' } }) + '\n', { flag: 'wx', mode: 0o600 });
|
|
71
|
+
}
|
|
72
|
+
console.log(JSON.stringify({ schema: 'blinkhost.local-provider-test/v1', passed: !failure,
|
|
73
|
+
tests, production_authority: false, guest_provider_integration: false, coverage: 'not_collected' }));
|
|
74
|
+
if (failure) { console.error('customer_provider_fixture_assertion_failed'); process.exitCode = 1; }
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type LocalTestCommandResult } from './local-test-command.js';
|
|
2
|
+
export declare const LOCAL_SOURCE_LIMITS: {
|
|
3
|
+
readonly configBytes: 65536;
|
|
4
|
+
readonly files: 1024;
|
|
5
|
+
readonly sourceBytes: number;
|
|
6
|
+
readonly executableBytes: number;
|
|
7
|
+
readonly artifactBytes: 20000000;
|
|
8
|
+
readonly timeoutMs: 300000;
|
|
9
|
+
readonly maxTimeoutMs: 900000;
|
|
10
|
+
readonly outputBytes: 1048576;
|
|
11
|
+
};
|
|
12
|
+
export interface LocalSourceBuildReceipt {
|
|
13
|
+
schema: 'blinkhost.local-source-build-result/v1';
|
|
14
|
+
status: 'compiled' | 'rejected';
|
|
15
|
+
config_sha256: string;
|
|
16
|
+
command_sha256: string;
|
|
17
|
+
source_sha256: Record<string, string>;
|
|
18
|
+
artifact: {
|
|
19
|
+
path: string;
|
|
20
|
+
sha256: string;
|
|
21
|
+
bytes: number;
|
|
22
|
+
} | null;
|
|
23
|
+
execution: LocalTestCommandResult | null;
|
|
24
|
+
error?: string;
|
|
25
|
+
validation: 'portable_header_only';
|
|
26
|
+
sandbox: 'customer_command_no_sandbox';
|
|
27
|
+
production_authority: false;
|
|
28
|
+
}
|
|
29
|
+
export declare function readSourceStackConfiguration(filename: string): Promise<{
|
|
30
|
+
value: Record<string, unknown>;
|
|
31
|
+
sha256: string;
|
|
32
|
+
}>;
|
|
33
|
+
/** Compile one explicit, immutable source snapshot. Commands are trusted customer code. */
|
|
34
|
+
export declare function buildLocalSource(root: string, filename: string, directory: string, { signal }?: {
|
|
35
|
+
signal?: AbortSignal;
|
|
36
|
+
}): Promise<LocalSourceBuildReceipt>;
|
|
37
|
+
/** Watch only the initial explicit input list; build configuration changes require a new run. */
|
|
38
|
+
export declare function fingerprintLocalSource(root: string, filename: string, baseline: LocalSourceBuildReceipt, signal?: AbortSignal): Promise<string>;
|
|
39
|
+
export declare function localSourceFingerprint(hashes: Record<string, string>): string;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { constants } from 'node:fs';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { lstat, mkdir, open, realpath, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
5
|
+
import { CliError, EXIT } from './errors.js';
|
|
6
|
+
import { localCheckDirectory } from './local-test-config.js';
|
|
7
|
+
import { runLocalTestCommand } from './local-test-command.js';
|
|
8
|
+
export const LOCAL_SOURCE_LIMITS = {
|
|
9
|
+
configBytes: 65_536, files: 1024, sourceBytes: 64 * 1024 * 1024,
|
|
10
|
+
executableBytes: 256 * 1024 * 1024, artifactBytes: 20_000_000,
|
|
11
|
+
timeoutMs: 300_000, maxTimeoutMs: 900_000, outputBytes: 1_048_576,
|
|
12
|
+
};
|
|
13
|
+
function fail(code) {
|
|
14
|
+
throw new CliError('Local source compilation failed. Inspect the retained build result and check your explicit compiler configuration.', EXIT.validation, code);
|
|
15
|
+
}
|
|
16
|
+
const hash = (bytes) => createHash('sha256').update(bytes).digest('hex');
|
|
17
|
+
function object(value, required, optional = []) {
|
|
18
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
19
|
+
fail('invalid_local_source_build_config');
|
|
20
|
+
const row = value;
|
|
21
|
+
if (required.some(key => !Object.hasOwn(row, key)) || Object.keys(row).some(key => ![...required, ...optional].includes(key))) {
|
|
22
|
+
fail('invalid_local_source_build_config');
|
|
23
|
+
}
|
|
24
|
+
return row;
|
|
25
|
+
}
|
|
26
|
+
function projectFile(value) {
|
|
27
|
+
if (typeof value !== 'string' || value.length > 1024 || !value || isAbsolute(value)
|
|
28
|
+
|| /[\u0000-\u001f\u007f\\]/.test(value)
|
|
29
|
+
|| value.split('/').some(part => !part || part === '.' || part === '..'))
|
|
30
|
+
fail('invalid_local_source_build_path');
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
/** Regular, bounded files only; nonblocking open also refuses FIFO races. */
|
|
34
|
+
async function readBounded(filename, maximum, collect = true) {
|
|
35
|
+
const info = await lstat(filename);
|
|
36
|
+
if (!info.isFile() || info.isSymbolicLink() || info.size > maximum)
|
|
37
|
+
fail('invalid_local_source_build_file');
|
|
38
|
+
const file = await open(filename, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
39
|
+
try {
|
|
40
|
+
const before = await file.stat();
|
|
41
|
+
if (!before.isFile() || before.size > maximum || before.ino !== info.ino || before.dev !== info.dev)
|
|
42
|
+
fail('local_source_build_file_raced');
|
|
43
|
+
const digest = createHash('sha256'), chunks = [];
|
|
44
|
+
const buffer = Buffer.alloc(131_072);
|
|
45
|
+
let size = 0;
|
|
46
|
+
for (;;) {
|
|
47
|
+
const { bytesRead } = await file.read(buffer, 0, Math.min(buffer.length, maximum - size + 1), size);
|
|
48
|
+
if (!bytesRead)
|
|
49
|
+
break;
|
|
50
|
+
size += bytesRead;
|
|
51
|
+
if (size > maximum)
|
|
52
|
+
fail('invalid_local_source_build_file');
|
|
53
|
+
const bytes = buffer.subarray(0, bytesRead);
|
|
54
|
+
digest.update(bytes);
|
|
55
|
+
if (collect)
|
|
56
|
+
chunks.push(Buffer.from(bytes));
|
|
57
|
+
}
|
|
58
|
+
const after = await file.stat();
|
|
59
|
+
if (size !== before.size || before.size !== after.size || before.mtimeMs !== after.mtimeMs
|
|
60
|
+
|| before.ctimeMs !== after.ctimeMs)
|
|
61
|
+
fail('local_source_build_file_raced');
|
|
62
|
+
return { bytes: Buffer.concat(chunks), sha256: digest.digest('hex'), size };
|
|
63
|
+
}
|
|
64
|
+
finally {
|
|
65
|
+
await file.close();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async function sourceFile(root, name) {
|
|
69
|
+
const safe = projectFile(name);
|
|
70
|
+
await localCheckDirectory(root, dirname(safe));
|
|
71
|
+
return join(root, safe);
|
|
72
|
+
}
|
|
73
|
+
export async function readSourceStackConfiguration(filename) {
|
|
74
|
+
const input = await readBounded(filename, LOCAL_SOURCE_LIMITS.configBytes);
|
|
75
|
+
let value;
|
|
76
|
+
try {
|
|
77
|
+
value = JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(input.bytes));
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
fail('invalid_local_stack_configuration');
|
|
81
|
+
}
|
|
82
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
83
|
+
fail('invalid_local_stack_configuration');
|
|
84
|
+
return { value: value, sha256: input.sha256 };
|
|
85
|
+
}
|
|
86
|
+
/** Compile one explicit, immutable source snapshot. Commands are trusted customer code. */
|
|
87
|
+
export async function buildLocalSource(root, filename, directory, { signal } = {}) {
|
|
88
|
+
if (process.platform !== 'linux')
|
|
89
|
+
fail('local_source_build_platform_unsupported');
|
|
90
|
+
root = await realpath(root);
|
|
91
|
+
const configPath = await sourceFile(root, relative(root, resolve(root, filename)));
|
|
92
|
+
const configInput = await readBounded(configPath, LOCAL_SOURCE_LIMITS.configBytes);
|
|
93
|
+
let value;
|
|
94
|
+
try {
|
|
95
|
+
value = JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(configInput.bytes));
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
fail('invalid_local_source_build_config');
|
|
99
|
+
}
|
|
100
|
+
const row = object(value, ['schema', 'source_root', 'files', 'command', 'args', 'artifact'], ['timeout_ms']);
|
|
101
|
+
if (row.schema !== 'blinkhost.local-source-build/v1')
|
|
102
|
+
fail('unsupported_local_source_build_schema');
|
|
103
|
+
await localCheckDirectory(root, row.source_root);
|
|
104
|
+
if (!Array.isArray(row.files) || !row.files.length || row.files.length > LOCAL_SOURCE_LIMITS.files
|
|
105
|
+
|| new Set(row.files).size !== row.files.length)
|
|
106
|
+
fail('invalid_local_source_build_files');
|
|
107
|
+
row.files.forEach(projectFile);
|
|
108
|
+
const command = object(row.command, ['path', 'sha256']);
|
|
109
|
+
if (typeof command.path !== 'string' || !command.path || command.path.length > 4096 || /[\u0000-\u001f\u007f]/.test(command.path)
|
|
110
|
+
|| typeof command.sha256 !== 'string' || !/^[a-f0-9]{64}$/.test(command.sha256))
|
|
111
|
+
fail('invalid_local_source_build_command');
|
|
112
|
+
if (!Array.isArray(row.args) || row.args.length > 64 || row.args.some(arg => typeof arg !== 'string'
|
|
113
|
+
|| arg.length > 4096 || /[\u0000-\u001f\u007f]/.test(arg))
|
|
114
|
+
|| row.args.reduce((sum, arg) => sum + Buffer.byteLength(arg), 0) > 32_768)
|
|
115
|
+
fail('invalid_local_source_build_args');
|
|
116
|
+
if (typeof row.artifact !== 'string' || !/^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,127}\.wasm$/.test(row.artifact))
|
|
117
|
+
fail('invalid_local_source_build_artifact');
|
|
118
|
+
const timeout = row.timeout_ms ?? LOCAL_SOURCE_LIMITS.timeoutMs;
|
|
119
|
+
if (!Number.isSafeInteger(timeout) || Number(timeout) < 1 || Number(timeout) > LOCAL_SOURCE_LIMITS.maxTimeoutMs)
|
|
120
|
+
fail('invalid_local_source_build_timeout');
|
|
121
|
+
const config = row;
|
|
122
|
+
const executable = resolve(root, config.command.path);
|
|
123
|
+
if ((await readBounded(executable, LOCAL_SOURCE_LIMITS.executableBytes, false)).sha256 !== config.command.sha256)
|
|
124
|
+
fail('local_source_build_command_digest_mismatch');
|
|
125
|
+
const sourceRoot = resolve(root, config.source_root);
|
|
126
|
+
const inputs = [];
|
|
127
|
+
let sourceBytes = 0;
|
|
128
|
+
for (const name of [...config.files].sort()) {
|
|
129
|
+
if (signal?.aborted)
|
|
130
|
+
fail('local_source_build_cancelled');
|
|
131
|
+
const path = await sourceFile(sourceRoot, name);
|
|
132
|
+
const input = await readBounded(path, LOCAL_SOURCE_LIMITS.sourceBytes - sourceBytes);
|
|
133
|
+
sourceBytes += input.bytes.length;
|
|
134
|
+
inputs.push({ name, path, ...input });
|
|
135
|
+
}
|
|
136
|
+
directory = resolve(directory);
|
|
137
|
+
// Refuse to put retained build state inside the application's source tree.
|
|
138
|
+
const offset = relative(sourceRoot, directory);
|
|
139
|
+
if (!offset || (!isAbsolute(offset) && offset !== '..' && !offset.startsWith('../')))
|
|
140
|
+
fail('local_source_build_state_in_source');
|
|
141
|
+
await mkdir(directory, { mode: 0o700 });
|
|
142
|
+
directory = await realpath(directory);
|
|
143
|
+
const source = join(directory, 'source'), output = join(directory, 'output'), temp = join(directory, 'tmp');
|
|
144
|
+
await mkdir(source, { mode: 0o755 });
|
|
145
|
+
await mkdir(output, { mode: 0o755 });
|
|
146
|
+
await mkdir(temp, { mode: 0o755 });
|
|
147
|
+
const receipt = {
|
|
148
|
+
schema: 'blinkhost.local-source-build-result/v1', status: 'rejected', config_sha256: configInput.sha256,
|
|
149
|
+
command_sha256: config.command.sha256, source_sha256: Object.fromEntries(inputs.map(item => [item.name, item.sha256])),
|
|
150
|
+
artifact: null, execution: null, validation: 'portable_header_only', sandbox: 'customer_command_no_sandbox', production_authority: false,
|
|
151
|
+
};
|
|
152
|
+
try {
|
|
153
|
+
for (const input of inputs) {
|
|
154
|
+
await mkdir(dirname(join(source, input.name)), { recursive: true, mode: 0o755 });
|
|
155
|
+
await writeFile(join(source, input.name), input.bytes, { flag: 'wx', mode: 0o644 });
|
|
156
|
+
}
|
|
157
|
+
receipt.execution = await runLocalTestCommand(executable, config.args, {
|
|
158
|
+
cwd: source, timeoutMs: Number(timeout), maxOutputBytes: LOCAL_SOURCE_LIMITS.outputBytes, ...(signal ? { signal } : {}),
|
|
159
|
+
env: { PATH: dirname(executable) + ':/usr/bin:/bin', LC_ALL: 'C.UTF-8', TZ: 'UTC', TMPDIR: temp,
|
|
160
|
+
BLINKHOST_LOCAL_BUILD_SOURCE: source, BLINKHOST_LOCAL_BUILD_OUTPUT: output,
|
|
161
|
+
BLINKHOST_LOCAL_BUILD_ARTIFACT: join(output, config.artifact) },
|
|
162
|
+
});
|
|
163
|
+
if (receipt.execution.status !== 'succeeded')
|
|
164
|
+
fail('local_source_build_' + receipt.execution.status);
|
|
165
|
+
if (signal?.aborted)
|
|
166
|
+
fail('local_source_build_cancelled');
|
|
167
|
+
for (const owned of [directory, source, output, temp]) {
|
|
168
|
+
const info = await lstat(owned);
|
|
169
|
+
if (!info.isDirectory() || info.isSymbolicLink())
|
|
170
|
+
fail('local_source_build_directory_changed');
|
|
171
|
+
}
|
|
172
|
+
if ((await readBounded(configPath, LOCAL_SOURCE_LIMITS.configBytes)).sha256 !== configInput.sha256)
|
|
173
|
+
fail('local_source_build_configuration_changed');
|
|
174
|
+
if ((await readBounded(executable, LOCAL_SOURCE_LIMITS.executableBytes, false)).sha256 !== config.command.sha256)
|
|
175
|
+
fail('local_source_build_command_changed');
|
|
176
|
+
for (const input of inputs) {
|
|
177
|
+
if ((await readBounded(input.path, LOCAL_SOURCE_LIMITS.sourceBytes)).sha256 !== input.sha256
|
|
178
|
+
|| (await readBounded(await sourceFile(source, input.name), LOCAL_SOURCE_LIMITS.sourceBytes)).sha256 !== input.sha256)
|
|
179
|
+
fail('local_source_build_source_changed');
|
|
180
|
+
}
|
|
181
|
+
const artifact = await readBounded(join(output, config.artifact), LOCAL_SOURCE_LIMITS.artifactBytes);
|
|
182
|
+
if (!artifact.bytes.subarray(0, 8).equals(Buffer.from([0, 97, 115, 109, 1, 0, 0, 0])))
|
|
183
|
+
fail('local_source_build_invalid_portable_header');
|
|
184
|
+
const accepted = join(directory, 'compiled.wasm');
|
|
185
|
+
await writeFile(accepted, artifact.bytes, { flag: 'wx', mode: 0o600 });
|
|
186
|
+
receipt.status = 'compiled';
|
|
187
|
+
receipt.artifact = { path: accepted, sha256: hash(artifact.bytes), bytes: artifact.bytes.length };
|
|
188
|
+
return receipt;
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
receipt.error = error instanceof CliError ? error.code : 'local_source_build_failed';
|
|
192
|
+
throw error;
|
|
193
|
+
}
|
|
194
|
+
finally {
|
|
195
|
+
const info = await lstat(directory);
|
|
196
|
+
if (!info.isDirectory() || info.isSymbolicLink() || await realpath(directory) !== directory)
|
|
197
|
+
fail('local_source_build_directory_changed');
|
|
198
|
+
await writeFile(join(directory, 'build-result.json'), JSON.stringify(receipt, null, 2) + '\n', { flag: 'wx', mode: 0o600 });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/** Watch only the initial explicit input list; build configuration changes require a new run. */
|
|
202
|
+
export async function fingerprintLocalSource(root, filename, baseline, signal) {
|
|
203
|
+
root = await realpath(root);
|
|
204
|
+
const configPath = await sourceFile(root, relative(root, resolve(root, filename)));
|
|
205
|
+
const input = await readBounded(configPath, LOCAL_SOURCE_LIMITS.configBytes);
|
|
206
|
+
if (input.sha256 !== baseline.config_sha256)
|
|
207
|
+
fail('local_source_build_configuration_changed');
|
|
208
|
+
const config = JSON.parse(input.bytes.toString('utf8'));
|
|
209
|
+
await localCheckDirectory(root, config.source_root);
|
|
210
|
+
const sourceRoot = resolve(root, config.source_root);
|
|
211
|
+
const hashes = {};
|
|
212
|
+
let bytes = 0;
|
|
213
|
+
for (const name of Object.keys(baseline.source_sha256).sort()) {
|
|
214
|
+
if (signal?.aborted)
|
|
215
|
+
fail('local_source_build_cancelled');
|
|
216
|
+
const value = await readBounded(await sourceFile(sourceRoot, name), LOCAL_SOURCE_LIMITS.sourceBytes - bytes, false);
|
|
217
|
+
bytes += value.size;
|
|
218
|
+
hashes[name] = value.sha256;
|
|
219
|
+
}
|
|
220
|
+
return localSourceFingerprint(hashes);
|
|
221
|
+
}
|
|
222
|
+
export function localSourceFingerprint(hashes) {
|
|
223
|
+
return hash(Buffer.from(JSON.stringify(Object.fromEntries(Object.keys(hashes).sort().map(name => [name, hashes[name]])))));
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=local-source-build.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type LocalSourceBuildReceipt } from './local-source-build.js';
|
|
2
|
+
export interface LocalSourceRebuildEvent {
|
|
3
|
+
schema: 'blinkhost.local-source-rebuild/v1';
|
|
4
|
+
status: 'reloaded' | 'unchanged' | 'rejected';
|
|
5
|
+
attempt: number;
|
|
6
|
+
error?: string;
|
|
7
|
+
build?: LocalSourceBuildReceipt;
|
|
8
|
+
reload?: unknown;
|
|
9
|
+
previous_runtime_retained: boolean;
|
|
10
|
+
watching_stopped?: boolean;
|
|
11
|
+
production_authority: false;
|
|
12
|
+
}
|
|
13
|
+
export interface LocalSourcePublication {
|
|
14
|
+
status: 'reloaded' | 'unchanged' | 'rejected';
|
|
15
|
+
error?: string;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** Serial, bounded rebuilds. No overlapping compilers or inferred source/configuration discovery. */
|
|
19
|
+
export declare function watchLocalSource(root: string, filename: string, directory: string, initial: LocalSourceBuildReceipt, publish: (build: LocalSourceBuildReceipt, verifyCandidate: () => Promise<void>) => Promise<LocalSourcePublication>, runtimeAvailable: () => boolean, onEvent: (event: LocalSourceRebuildEvent) => Promise<void>, { signal, pollMs, maxBuilds, maxEvents }: {
|
|
20
|
+
signal: AbortSignal;
|
|
21
|
+
pollMs?: number;
|
|
22
|
+
maxBuilds?: number;
|
|
23
|
+
maxEvents?: number;
|
|
24
|
+
}): Promise<void>;
|