witnora 0.20.7 → 0.20.8
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/cli.js +1 -0
- package/dist/onboard.js +65 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -160,6 +160,7 @@ else if (command === "onboard") {
|
|
|
160
160
|
repository: readFlag("--repo") ?? process.cwd(),
|
|
161
161
|
template: readFlag("--template") ? parseAgentTemplate(readFlag("--template")) : undefined,
|
|
162
162
|
actionTransport: readActionTransport(readFlag("--action-transport")),
|
|
163
|
+
waitForActionPathMs: readActionTransport(readFlag("--action-transport")) && !readBoolFlag("--no-wait-for-action-path") ? 10 * 60 * 1_000 : 0,
|
|
163
164
|
openBrowser: readBoolFlag("--no-browser") ? async () => { } : undefined,
|
|
164
165
|
});
|
|
165
166
|
}
|
package/dist/onboard.js
CHANGED
|
@@ -304,7 +304,7 @@ export async function runOnboard(options) {
|
|
|
304
304
|
const runtimeReadiness = doctor.overall === "READY_FOR_RUNTIME" && runtimeBinding
|
|
305
305
|
? { state: "LOCAL_SANDBOX_READY", checkedAt: new Date().toISOString(), limitations: [] }
|
|
306
306
|
: { state: "RECORDED_ONLY", checkedAt: new Date().toISOString(), limitations: [runtimeLimitation ?? "The local sandbox Runtime worker has not established exact adapter, probe, source-key, identity, mandate, and readiness bindings."] };
|
|
307
|
-
|
|
307
|
+
let actionTransportTest = options.actionTransport
|
|
308
308
|
? await runActionTransportTest({
|
|
309
309
|
transport: options.actionTransport,
|
|
310
310
|
repository: repositoryPath,
|
|
@@ -319,12 +319,58 @@ export async function runOnboard(options) {
|
|
|
319
319
|
: undefined;
|
|
320
320
|
const localWorkflowCommand = await detectLocalWorkflowCommand(repositoryPath);
|
|
321
321
|
const cliVersion = await currentCliVersion();
|
|
322
|
+
const agentRunCommand = localWorkflowCommand
|
|
323
|
+
? `npx --yes witnora@${cliVersion} gateway exec -- ${localWorkflowCommand.join(" ")}`
|
|
324
|
+
: undefined;
|
|
322
325
|
await reportInstall(requestFetch, server, token.projectId, token.apiKey, setupPlan.id, {
|
|
323
326
|
status: "verified", attemptId, generatedFiles: relativeGeneratedFiles(repositoryPath, generatedFiles), runtimeReadiness,
|
|
324
327
|
connectedAgent: agentIdentity,
|
|
328
|
+
agentRunCommand,
|
|
325
329
|
...(runtimeBinding ? { runtimeBinding } : {}),
|
|
326
330
|
});
|
|
327
|
-
|
|
331
|
+
if (actionTransportTest?.state === "WAITING_FOR_ACTION_PATH" && (options.waitForActionPathMs ?? 0) > 0) {
|
|
332
|
+
output("\nBase setup is complete. Onboarding is waiting for the Business Task and Action path; it has not claimed completion.\n");
|
|
333
|
+
output(agentRunCommand
|
|
334
|
+
? `Open a second terminal in this repository and run the Agent safely once:\n${agentRunCommand}\n`
|
|
335
|
+
: "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
|
+
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 lateActivation = await waitForRealPathActivation({
|
|
338
|
+
repository: repositoryPath, server, projectId: token.projectId, apiKey: token.apiKey,
|
|
339
|
+
env: options.env, fetch: requestFetch, sleep: options.sleep, timeoutMs: options.waitForActionPathMs ?? 0,
|
|
340
|
+
});
|
|
341
|
+
if (lateActivation) {
|
|
342
|
+
realPathActivation = lateActivation;
|
|
343
|
+
generatedFiles.push(...lateActivation.generatedFiles);
|
|
344
|
+
const harness = await activateManagedWorkflowHarness({ repository: repositoryPath, realPathActivations: lateActivation.activations, previousGeneratedModuleSha256: lateActivation.previousGeneratedModuleSha256 });
|
|
345
|
+
if (harness.created)
|
|
346
|
+
generatedFiles.push(harness.path);
|
|
347
|
+
assuranceHarnessReadiness = { state: "ACTIVE" };
|
|
348
|
+
httpActionSetup = await configureCustomerHttpAction({ repository: repositoryPath, activations: lateActivation.activations });
|
|
349
|
+
generatedFiles.push(...httpActionSetup.generatedFiles);
|
|
350
|
+
if (harness.changed || httpActionSetup.changed) {
|
|
351
|
+
await stopGatewayOwners();
|
|
352
|
+
if (!options.gatewayLifecycle) {
|
|
353
|
+
await installCurrentGatewayService({ repository: repositoryPath, cliEntry: fileURLToPath(new URL("./cli.js", import.meta.url)), configHome: options.configHome });
|
|
354
|
+
managedGateway = await waitForInstalledGatewayService({ repository: repositoryPath, fetch: requestFetch, sleep: options.sleep, timeoutMs: options.timeoutMs });
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
managedGateway = await gatewayLifecycle.start({ repository: repositoryPath, configHome: options.configHome, fetch: requestFetch, output });
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
actionTransportTest = await runActionTransportTest({
|
|
361
|
+
transport: options.actionTransport, repository: repositoryPath, server, projectId: token.projectId, apiKey: token.apiKey,
|
|
362
|
+
repositoryIdentity: repository, httpActionReady: httpActionSetup.state === "READY" && Boolean(httpActionSetup.action),
|
|
363
|
+
fetch: requestFetch, generatedFiles,
|
|
364
|
+
});
|
|
365
|
+
await reportInstall(requestFetch, server, token.projectId, token.apiKey, setupPlan.id, {
|
|
366
|
+
status: "verified", attemptId, generatedFiles: relativeGeneratedFiles(repositoryPath, generatedFiles), runtimeReadiness,
|
|
367
|
+
connectedAgent: agentIdentity, agentRunCommand, ...(runtimeBinding ? { runtimeBinding } : {}),
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
output(actionTransportTest?.state === "WAITING_FOR_ACTION_PATH"
|
|
372
|
+
? `\nWitnora base setup completed for ${repository.name}; Action onboarding is paused and still pending.\n`
|
|
373
|
+
: `\nWitnora Setup Autopilot completed for ${repository.name}.\n`);
|
|
328
374
|
output(`Project: ${token.projectId}\nTemplate: ${repository.template} (${repository.kind})\n`);
|
|
329
375
|
output(`Credentials: ${credentialsPath}\nSelf-test receipt: ${receiptPath}\n`);
|
|
330
376
|
output(`Private discovery: ${discovery.capabilityCount} capability group(s); ${discovery.unknownCapabilityCount} pending confirmation.\n`);
|
|
@@ -348,10 +394,10 @@ export async function runOnboard(options) {
|
|
|
348
394
|
output(`Action transport: ${actionTransportTest.transport.toUpperCase()} is waiting for one exact sandbox Task/action path. ${actionTransportTest.limitation}\n`);
|
|
349
395
|
}
|
|
350
396
|
output(actionTransportTest?.state === "WAITING_FOR_ACTION_PATH"
|
|
351
|
-
? `Base Gateway connected, but ${actionTransportTest.transport.toUpperCase()} Action is not verified yet. Run the Agent
|
|
397
|
+
? `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`
|
|
352
398
|
: "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");
|
|
353
399
|
output(localWorkflowCommand
|
|
354
|
-
? `Local sandbox command:
|
|
400
|
+
? `Local sandbox command: ${agentRunCommand}\n`
|
|
355
401
|
: `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`);
|
|
356
402
|
return { projectId: token.projectId, connectionName: token.connectionName, credentialsPath, template: repository.template,
|
|
357
403
|
repositoryKind: repository.kind, generatedFiles, receiptPath, discovery, setupPlanId: setupPlan.id,
|
|
@@ -412,6 +458,21 @@ async function loadMatchingOnboardConnection(options) {
|
|
|
412
458
|
return undefined;
|
|
413
459
|
}
|
|
414
460
|
}
|
|
461
|
+
async function waitForRealPathActivation(options) {
|
|
462
|
+
const sleep = options.sleep ?? ((milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds)));
|
|
463
|
+
let waited = 0;
|
|
464
|
+
let delay = 2_000;
|
|
465
|
+
while (waited < options.timeoutMs) {
|
|
466
|
+
const activation = await activateRealPathIntegrations(options);
|
|
467
|
+
if (activation.activations.length)
|
|
468
|
+
return activation;
|
|
469
|
+
const interval = Math.min(delay, options.timeoutMs - waited);
|
|
470
|
+
await sleep(interval);
|
|
471
|
+
waited += interval;
|
|
472
|
+
delay = Math.min(15_000, Math.round(delay * 1.5));
|
|
473
|
+
}
|
|
474
|
+
return undefined;
|
|
475
|
+
}
|
|
415
476
|
async function runActionTransportTest(options) {
|
|
416
477
|
if (!options.httpActionReady)
|
|
417
478
|
return {
|