@north-light/api 0.3.733 → 0.3.734
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api/contract.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The contract level this build serves and requires. Written by `scripts/contract.mjs release`; never edit by hand. */
|
|
2
|
-
export declare const CONTRACT_LEVEL = "1.
|
|
2
|
+
export declare const CONTRACT_LEVEL = "1.73";
|
|
3
3
|
/** Request header naming the one contract level the caller needs, e.g. `1.3`. Optional: absent means no check. */
|
|
4
4
|
export declare const REQUIRED_CONTRACT_HEADER = "Crouter-Required-Contract";
|
|
5
5
|
/** Response header listing the contract levels the server serves, comma-separated, one per major, e.g. `1.3`. */
|
package/dist/api/contract.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
//
|
|
13
13
|
// PURITY (spec §3.1): Node built-ins + `src/api/*` only.
|
|
14
14
|
/** The contract level this build serves and requires. Written by `scripts/contract.mjs release`; never edit by hand. */
|
|
15
|
-
export const CONTRACT_LEVEL = '1.
|
|
15
|
+
export const CONTRACT_LEVEL = '1.73';
|
|
16
16
|
/** Request header naming the one contract level the caller needs, e.g. `1.3`. Optional: absent means no check. */
|
|
17
17
|
export const REQUIRED_CONTRACT_HEADER = 'Crouter-Required-Contract';
|
|
18
18
|
/** Response header listing the contract levels the server serves, comma-separated, one per major, e.g. `1.3`. */
|
|
@@ -13,18 +13,18 @@ const rotate = defineLeaf({
|
|
|
13
13
|
output: [{ name: 'environment_id', type: 'string', required: true, constraint: 'The machine environment the new credential belongs to.' }],
|
|
14
14
|
outputKind: 'object',
|
|
15
15
|
effects: [
|
|
16
|
-
'Calls `POST /v1/
|
|
16
|
+
'Calls `POST /v1/machines?rotate=1` naming the machine environment in `runtime/machine.json`, which replaces the stored hash for this machine environment, then writes the new secret to `runtime/secrets/machine-credential` (mode 0600). Authenticates with the person\'s sign-in (`crtr sys signin`; `not_signed_in` without one). Fails when `runtime/machine.json` is missing: this install was not imported as a machine.',
|
|
17
17
|
'The old credential stops opening links as soon as the control plane has replaced it, and the link it already holds is closed within 15 seconds; the Mac reconnects with the new credential.',
|
|
18
18
|
],
|
|
19
19
|
},
|
|
20
20
|
run: async () => {
|
|
21
21
|
const config = readMachineConfig();
|
|
22
22
|
if (config === undefined)
|
|
23
|
-
throw usage('this
|
|
23
|
+
throw usage('this computer is not a Northlight machine: runtime/machine.json is missing');
|
|
24
24
|
// The sign-in stored by `crtr sys signin` (or by the import): the same person who imported this Mac.
|
|
25
25
|
const token = await personBearer(config.directoryUrl);
|
|
26
|
-
const url = new URL(
|
|
27
|
-
const response = await fetch(url, { method: 'POST', headers: { authorization: `Bearer ${token}
|
|
26
|
+
const url = new URL('/v1/machines?rotate=1', config.apiUrl);
|
|
27
|
+
const response = await fetch(url, { method: 'POST', headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' }, body: JSON.stringify({ environment_id: config.environmentId }), signal: AbortSignal.timeout(30_000) });
|
|
28
28
|
const text = await response.text();
|
|
29
29
|
if (!response.ok)
|
|
30
30
|
throw general(`the control plane answered ${response.status}: ${text.slice(0, 300)}`);
|
|
@@ -204,6 +204,7 @@ export const OPERATIONS = [
|
|
|
204
204
|
{ name: 'import.load', method: 'POST', path: '/v1/imports/:run_id/load', classes: ['person', 'import'], resource: 'none' },
|
|
205
205
|
{ name: 'import.get', method: 'GET', path: '/v1/imports/:run_id', classes: ['person', 'import'], resource: 'none' },
|
|
206
206
|
{ name: 'import.rollback', method: 'POST', path: '/v1/imports/:run_id/rollback', classes: ['person'], resource: 'none' },
|
|
207
|
+
{ name: 'machine.register', method: 'POST', path: '/v1/machines', classes: ['person'], resource: 'none' },
|
|
207
208
|
{ name: 'import.machine-credential', method: 'POST', path: '/v1/imports/:run_id/machine-credential', classes: ['person'], resource: 'none' },
|
|
208
209
|
{ name: 'execution.import-unpacked', method: 'POST', path: '/v1/executions/:execution_id/import-unpacked', classes: ['broker'], resource: 'none' },
|
|
209
210
|
{ name: 'execution.start', method: 'GET', path: '/v1/executions/:execution_id/start', classes: ['broker'], resource: 'none' },
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { liveExecutionForNode, endExecution, recordExecutionAwake, endLaunchingExecution, requestExecutionStop } from '../../../core/canvas/executions.js';
|
|
5
5
|
import { openDb } from '../../../core/canvas/db.js';
|
|
6
6
|
import { isCloudRole } from '../../../core/canvas/person-state.js';
|
|
7
|
-
import { getRow } from '../../../core/canvas/index.js';
|
|
7
|
+
import { getRow, recordRespawnAttempt } from '../../../core/canvas/index.js';
|
|
8
8
|
import { fullName } from '../../../core/canvas/labels.js';
|
|
9
9
|
import { publishNotice } from '../../../core/runtime/close.js';
|
|
10
10
|
import { emitEvent } from '../../../core/events/emit.js';
|
|
@@ -145,6 +145,8 @@ export async function recoverLaunching(nodeId, now) {
|
|
|
145
145
|
}
|
|
146
146
|
else {
|
|
147
147
|
const wake = `Child crashed — ${fullName(row)} (${nodeId}) failed ${attempt.failures} consecutive sandbox launches (${message}) and is now dead. It stays dead until you revive it — \`crtr node lifecycle revive ${nodeId}\`.`;
|
|
148
|
+
// The count stays as the record; the backoff is cleared so a later revive cannot be read as still mid-sequence.
|
|
149
|
+
await recordRespawnAttempt(nodeId, { failures: attempt.failures, notBefore: null });
|
|
148
150
|
emitEvent({ level: 'error', event: 'broker.respawn.exhausted', node_id: nodeId });
|
|
149
151
|
await transition(nodeId, 'crash', { reason: 'crash_looped', outcome: { detail: { schema: 'crtr.node-outcome-detail/v1', message: wake, respawn_failures: attempt.failures } } });
|
|
150
152
|
await publishNotice(nodeId, 'notice.crash', wake, { reason: 'child-crashed', child: nodeId });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.734",
|
|
4
4
|
"description": "Typed crtrd /v1 API contract — DTOs, route builders, the error contract, the CrtrClient, and the command-plugin manifest format. Zero runtime dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/api/index.js",
|