witnora 0.20.8 → 0.20.9
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/onboard.js +24 -8
- package/package.json +1 -1
package/dist/onboard.js
CHANGED
|
@@ -125,6 +125,7 @@ export async function runOnboard(options) {
|
|
|
125
125
|
let assuranceHarnessChanged = false;
|
|
126
126
|
let httpActionSetup;
|
|
127
127
|
let continuousService;
|
|
128
|
+
let localOutputTaskConfirmed = false;
|
|
128
129
|
const prepareRuntime = async (operation) => {
|
|
129
130
|
const delays = [250, 500, 1_000, 2_000, 4_000, 8_000];
|
|
130
131
|
let lastError;
|
|
@@ -334,11 +335,19 @@ export async function runOnboard(options) {
|
|
|
334
335
|
? `Open a second terminal in this repository and run the Agent safely once:\n${agentRunCommand}\n`
|
|
335
336
|
: "Run the Agent normally in its sandbox. If it has no work now, you may enter the workspace and finish Action verification after its first real run.\n");
|
|
336
337
|
output(`Keep this command open for up to ${Math.max(1, Math.ceil((options.waitForActionPathMs ?? 0) / 60_000))} minutes. It will finish automatically after you confirm the Business Task in the browser; no second onboard command is required. Press Ctrl+C to pause safely.\n`);
|
|
337
|
-
const
|
|
338
|
+
const resolution = await waitForOnboardingResolution({
|
|
338
339
|
repository: repositoryPath, server, projectId: token.projectId, apiKey: token.apiKey,
|
|
339
340
|
env: options.env, fetch: requestFetch, sleep: options.sleep, timeoutMs: options.waitForActionPathMs ?? 0,
|
|
340
341
|
});
|
|
341
|
-
if (
|
|
342
|
+
if (resolution?.kind === "LOCAL_OUTPUT") {
|
|
343
|
+
localOutputTaskConfirmed = true;
|
|
344
|
+
actionTransportTest = undefined;
|
|
345
|
+
if (assuranceHarnessReadiness.state === "WAITING_FOR_CUSTOMER_HARNESS") {
|
|
346
|
+
assuranceHarnessReadiness = { state: "NOT_REQUIRED_FOR_LOCAL_OUTPUT" };
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
else if (resolution?.kind === "REAL_PATH") {
|
|
350
|
+
const lateActivation = resolution.activation;
|
|
342
351
|
realPathActivation = lateActivation;
|
|
343
352
|
generatedFiles.push(...lateActivation.generatedFiles);
|
|
344
353
|
const harness = await activateManagedWorkflowHarness({ repository: repositoryPath, realPathActivations: lateActivation.activations, previousGeneratedModuleSha256: lateActivation.previousGeneratedModuleSha256 });
|
|
@@ -383,7 +392,9 @@ export async function runOnboard(options) {
|
|
|
383
392
|
: `Runtime: RECORDED_ONLY. ${runtimeReadiness.limitations[0]}\n`);
|
|
384
393
|
output(assuranceHarnessReadiness.state === "ACTIVE"
|
|
385
394
|
? `Assurance Harness: ACTIVE. Nora can dispatch authority-ready Replay and no-write Shadow evaluations without manual Workflow IDs, evaluator origins, credentials, or contract digests.${realPathActivation.activations.length ? ` ${realPathActivation.activations.length} exact sandbox real-path binding(s) passed read-only preflight.` : ""}\n`
|
|
386
|
-
:
|
|
395
|
+
: assuranceHarnessReadiness.state === "NOT_REQUIRED_FOR_LOCAL_OUTPUT"
|
|
396
|
+
? "Assurance Harness: NOT_REQUIRED_FOR_LOCAL_OUTPUT. The approved read-only local-output task is confirmed; no external Action transport is required.\n"
|
|
397
|
+
: `Assurance Harness: WAITING_FOR_CUSTOMER_HARNESS. ${assuranceHarnessReadiness.limitation}\n`);
|
|
387
398
|
if (httpActionSetup?.state === "READY" && httpActionSetup.action) {
|
|
388
399
|
output(`HTTP Action: READY. POST ${managedGateway.baseUrl}${httpActionSetup.action.path}; copy the action-scoped token and request example from .witnora/gateway/HTTP_ACTION.md.\n`);
|
|
389
400
|
}
|
|
@@ -393,9 +404,11 @@ export async function runOnboard(options) {
|
|
|
393
404
|
else if (actionTransportTest) {
|
|
394
405
|
output(`Action transport: ${actionTransportTest.transport.toUpperCase()} is waiting for one exact sandbox Task/action path. ${actionTransportTest.limitation}\n`);
|
|
395
406
|
}
|
|
396
|
-
output(
|
|
397
|
-
?
|
|
398
|
-
:
|
|
407
|
+
output(localOutputTaskConfirmed
|
|
408
|
+
? "Connected. Nora is monitoring this Agent. The approved read-only local-output task is confirmed; no external Action transport is required.\n"
|
|
409
|
+
: actionTransportTest?.state === "WAITING_FOR_ACTION_PATH"
|
|
410
|
+
? `Base Gateway connected, but ${actionTransportTest.transport.toUpperCase()} Action is not verified yet. Run the Agent once and confirm its Business Task in the browser. Recovery only: rerun this command if the original waiting process was closed.\n`
|
|
411
|
+
: "Connected. Nora is monitoring this Agent. Run it normally whenever it is ready; the first source-signed activity will appear automatically without blocking setup.\n");
|
|
399
412
|
output(localWorkflowCommand
|
|
400
413
|
? `Local sandbox command: ${agentRunCommand}\n`
|
|
401
414
|
: `For a local sandbox workflow, use npx --yes witnora@${cliVersion} gateway exec -- <your normal sandbox command> so the Gateway token stays out of shell history.\n`);
|
|
@@ -458,14 +471,17 @@ async function loadMatchingOnboardConnection(options) {
|
|
|
458
471
|
return undefined;
|
|
459
472
|
}
|
|
460
473
|
}
|
|
461
|
-
async function
|
|
474
|
+
async function waitForOnboardingResolution(options) {
|
|
462
475
|
const sleep = options.sleep ?? ((milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds)));
|
|
463
476
|
let waited = 0;
|
|
464
477
|
let delay = 2_000;
|
|
465
478
|
while (waited < options.timeoutMs) {
|
|
466
479
|
const activation = await activateRealPathIntegrations(options);
|
|
467
480
|
if (activation.activations.length)
|
|
468
|
-
return activation;
|
|
481
|
+
return { kind: "REAL_PATH", activation };
|
|
482
|
+
const onboarding = await jsonRequest(options.fetch, `${options.server}/v1/projects/${encodeURIComponent(options.projectId)}/onboarding`, { method: "GET", headers: { authorization: `Bearer ${options.apiKey}` } });
|
|
483
|
+
if (onboarding.localOutputTaskConfirmed)
|
|
484
|
+
return { kind: "LOCAL_OUTPUT" };
|
|
469
485
|
const interval = Math.min(delay, options.timeoutMs - waited);
|
|
470
486
|
await sleep(interval);
|
|
471
487
|
waited += interval;
|