opensteer 0.8.10 → 0.8.12
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/{chunk-F3X6UOEN.js → chunk-AXTKKAPW.js} +325 -142
- package/dist/chunk-AXTKKAPW.js.map +1 -0
- package/dist/cli/bin.cjs +550 -187
- package/dist/cli/bin.cjs.map +1 -1
- package/dist/cli/bin.js +222 -42
- package/dist/cli/bin.js.map +1 -1
- package/dist/index.cjs +64 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +63 -16
- package/dist/index.d.ts +63 -16
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/skills/recorder/SKILL.md +54 -24
- package/dist/chunk-F3X6UOEN.js.map +0 -1
package/dist/cli/bin.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { assertProviderSupportsEngine, createOpensteerSemanticRuntime, OpensteerBrowserManager, dispatchSemanticOperation, loadEnvironment, normalizeOpensteerProviderMode, discoverLocalCdpBrowsers, inspectCdpEndpoint, resolveOpensteerRuntimeConfig, resolveOpensteerEngineName, resolveOpensteerProvider, resolveFilesystemWorkspacePath, FlowRecorderCollector, generateReplayScript, pathExists, readPersistedLocalBrowserSessionRecord, readPersistedCloudSessionRecord, OpensteerCloudClient, isProcessRunning } from '../chunk-
|
|
3
|
-
import
|
|
2
|
+
import { assertProviderSupportsEngine, createOpensteerSemanticRuntime, OpensteerBrowserManager, dispatchSemanticOperation, loadEnvironment, normalizeOpensteerProviderMode, discoverLocalCdpBrowsers, inspectCdpEndpoint, resolveOpensteerRuntimeConfig, resolveOpensteerEngineName, resolveOpensteerProvider, resolveFilesystemWorkspacePath, requireCloudAppBaseUrl, CloudSessionProxy, FlowRecorderCollector, generateReplayScript, pathExists, readPersistedLocalBrowserSessionRecord, readPersistedCloudSessionRecord, OpensteerCloudClient, isProcessRunning } from '../chunk-AXTKKAPW.js';
|
|
3
|
+
import process3 from 'process';
|
|
4
4
|
import { spawn } from 'child_process';
|
|
5
5
|
import { existsSync } from 'fs';
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import { createRequire } from 'module';
|
|
8
8
|
import { fileURLToPath } from 'url';
|
|
9
9
|
import { mkdir, writeFile } from 'fs/promises';
|
|
10
|
+
import os from 'os';
|
|
10
11
|
|
|
11
12
|
// package.json
|
|
12
13
|
var package_default = {
|
|
13
|
-
version: "0.8.
|
|
14
|
+
version: "0.8.10"};
|
|
14
15
|
|
|
15
16
|
// src/cli/env-loader.ts
|
|
16
17
|
async function loadCliEnvironment(cwd) {
|
|
17
18
|
loadEnvironment(cwd);
|
|
18
19
|
}
|
|
20
|
+
var OPENSTEER_GITHUB_SOURCE = "steerlabs/opensteer";
|
|
19
21
|
function createOpensteerSkillsInvocation(input) {
|
|
20
22
|
const cliArgs = ["add", input.skillSourcePath];
|
|
21
23
|
if (input.options.all === true) {
|
|
@@ -56,7 +58,7 @@ function resolveOpensteerSkillsCliPath() {
|
|
|
56
58
|
}
|
|
57
59
|
return cliPath;
|
|
58
60
|
}
|
|
59
|
-
function
|
|
61
|
+
function resolveOpensteerLocalSkillSourcePath() {
|
|
60
62
|
let ancestor = path.dirname(fileURLToPath(import.meta.url));
|
|
61
63
|
for (let index = 0; index < 6; index += 1) {
|
|
62
64
|
const candidate = path.join(ancestor, "skills");
|
|
@@ -68,17 +70,32 @@ function resolveOpensteerSkillSourcePath() {
|
|
|
68
70
|
}
|
|
69
71
|
throw new Error("Unable to find the packaged Opensteer skill source directory.");
|
|
70
72
|
}
|
|
73
|
+
async function checkOpensteerGitHubReachable() {
|
|
74
|
+
try {
|
|
75
|
+
const response = await fetch(`https://github.com/${OPENSTEER_GITHUB_SOURCE}`, {
|
|
76
|
+
method: "HEAD",
|
|
77
|
+
signal: AbortSignal.timeout(3e3),
|
|
78
|
+
redirect: "manual"
|
|
79
|
+
});
|
|
80
|
+
return response.status < 500;
|
|
81
|
+
} catch {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
71
85
|
async function runOpensteerSkillsInstaller(options = {}, overrideDeps = {}) {
|
|
72
86
|
const deps = {
|
|
73
87
|
resolveSkillsCliPath: resolveOpensteerSkillsCliPath,
|
|
74
|
-
|
|
88
|
+
resolveLocalSkillSourcePath: resolveOpensteerLocalSkillSourcePath,
|
|
89
|
+
checkGitHubReachable: checkOpensteerGitHubReachable,
|
|
75
90
|
spawnInvocation: spawnOpensteerSkillsInvocation,
|
|
76
91
|
...overrideDeps
|
|
77
92
|
};
|
|
93
|
+
const useGitHub = await deps.checkGitHubReachable();
|
|
94
|
+
const skillSourcePath = useGitHub ? OPENSTEER_GITHUB_SOURCE : deps.resolveLocalSkillSourcePath();
|
|
78
95
|
const invocation = createOpensteerSkillsInvocation({
|
|
79
96
|
options,
|
|
80
97
|
skillsCliPath: deps.resolveSkillsCliPath(),
|
|
81
|
-
skillSourcePath
|
|
98
|
+
skillSourcePath
|
|
82
99
|
});
|
|
83
100
|
return deps.spawnInvocation(invocation);
|
|
84
101
|
}
|
|
@@ -263,6 +280,43 @@ function formatLaneRow(input) {
|
|
|
263
280
|
const summary = input.summary.padEnd(16, " ");
|
|
264
281
|
return `${input.marker} ${provider} ${status} ${summary}${input.detail ?? ""}`.trimEnd();
|
|
265
282
|
}
|
|
283
|
+
async function openBrowserUrl(url) {
|
|
284
|
+
const command = resolveOpenBrowserCommand(url);
|
|
285
|
+
await new Promise((resolve, reject) => {
|
|
286
|
+
const child = spawn(command.executable, command.args, {
|
|
287
|
+
detached: process3.platform !== "win32",
|
|
288
|
+
stdio: "ignore"
|
|
289
|
+
});
|
|
290
|
+
child.once("error", reject);
|
|
291
|
+
child.once("spawn", () => {
|
|
292
|
+
child.unref();
|
|
293
|
+
resolve();
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
function resolveOpenBrowserCommand(url) {
|
|
298
|
+
if (process3.platform === "darwin") {
|
|
299
|
+
return {
|
|
300
|
+
executable: "open",
|
|
301
|
+
args: [url]
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
if (process3.platform === "win32" || isWsl()) {
|
|
305
|
+
return {
|
|
306
|
+
executable: process3.platform === "win32" ? "cmd" : "cmd.exe",
|
|
307
|
+
args: ["/c", "start", "", url]
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
return {
|
|
311
|
+
executable: "xdg-open",
|
|
312
|
+
args: [url]
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
function isWsl() {
|
|
316
|
+
return process3.platform === "linux" && (process3.env.WSL_DISTRO_NAME !== void 0 || os.release().toLowerCase().includes("microsoft"));
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// src/cli/record.ts
|
|
266
320
|
async function runOpensteerRecordCommand(input) {
|
|
267
321
|
const stdout = input.stdout ?? process.stdout;
|
|
268
322
|
const stderr = input.stderr ?? process.stderr;
|
|
@@ -313,6 +367,72 @@ async function runOpensteerRecordCommand(input) {
|
|
|
313
367
|
}
|
|
314
368
|
}
|
|
315
369
|
}
|
|
370
|
+
async function runOpensteerCloudRecordCommand(input) {
|
|
371
|
+
const stdout = input.stdout ?? process.stdout;
|
|
372
|
+
const stderr = input.stderr ?? process.stderr;
|
|
373
|
+
const cloudAppBaseUrl = requireCloudAppBaseUrl(input.cloudConfig);
|
|
374
|
+
const outputPath = resolveRecordOutputPath({
|
|
375
|
+
rootDir: input.rootDir,
|
|
376
|
+
workspace: input.workspace,
|
|
377
|
+
...input.outputPath === void 0 ? {} : { outputPath: input.outputPath }
|
|
378
|
+
});
|
|
379
|
+
let cloud;
|
|
380
|
+
const resolveCloud = () => {
|
|
381
|
+
cloud ??= new OpensteerCloudClient(input.cloudConfig);
|
|
382
|
+
return cloud;
|
|
383
|
+
};
|
|
384
|
+
const runtime = input.runtime ?? new CloudSessionProxy(resolveCloud(), {
|
|
385
|
+
rootDir: input.rootDir,
|
|
386
|
+
workspace: input.workspace
|
|
387
|
+
});
|
|
388
|
+
const client = input.client ?? resolveCloud();
|
|
389
|
+
const sleep = input.sleep ?? delay;
|
|
390
|
+
const openUrl = input.openUrl ?? openBrowserUrl;
|
|
391
|
+
let closed = false;
|
|
392
|
+
try {
|
|
393
|
+
await runtime.open({
|
|
394
|
+
url: input.url,
|
|
395
|
+
...input.browser === void 0 ? {} : { browser: input.browser },
|
|
396
|
+
...input.launch === void 0 ? {} : { launch: input.launch },
|
|
397
|
+
...input.context === void 0 ? {} : { context: input.context }
|
|
398
|
+
});
|
|
399
|
+
const sessionId = await resolveCloudRecordingSessionId(runtime);
|
|
400
|
+
const sessionUrl = buildCloudRecordingSessionUrl(cloudAppBaseUrl, sessionId);
|
|
401
|
+
await client.startSessionRecording(sessionId);
|
|
402
|
+
await tryOpenCloudRecordingSessionUrl({
|
|
403
|
+
sessionUrl,
|
|
404
|
+
stderr,
|
|
405
|
+
openUrl
|
|
406
|
+
});
|
|
407
|
+
stderr.write(
|
|
408
|
+
`Recording browser actions for workspace "${input.workspace}". Open ${sessionUrl} and click "Stop recording" in the browser session toolbar when you're done.
|
|
409
|
+
`
|
|
410
|
+
);
|
|
411
|
+
const completed = await waitForCloudRecordingCompletion({
|
|
412
|
+
client,
|
|
413
|
+
sessionId,
|
|
414
|
+
...input.pollIntervalMs === void 0 ? {} : { pollIntervalMs: input.pollIntervalMs },
|
|
415
|
+
sleep
|
|
416
|
+
});
|
|
417
|
+
if (completed.result === void 0) {
|
|
418
|
+
throw new Error("Cloud recording completed without a replay script.");
|
|
419
|
+
}
|
|
420
|
+
await mkdir(path.dirname(outputPath), { recursive: true });
|
|
421
|
+
await writeFile(outputPath, completed.result.script, "utf8");
|
|
422
|
+
await runtime.close();
|
|
423
|
+
closed = true;
|
|
424
|
+
stdout.write(`${outputPath}
|
|
425
|
+
`);
|
|
426
|
+
stderr.write(`Cloud browser session: ${sessionUrl}
|
|
427
|
+
`);
|
|
428
|
+
stderr.write(`Wrote replay script to ${outputPath}
|
|
429
|
+
`);
|
|
430
|
+
} finally {
|
|
431
|
+
if (!closed) {
|
|
432
|
+
await runtime.close().catch(() => void 0);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
316
436
|
function resolveRecordOutputPath(input) {
|
|
317
437
|
if (input.outputPath !== void 0) {
|
|
318
438
|
return path.resolve(input.rootDir, input.outputPath);
|
|
@@ -347,6 +467,39 @@ function createRecorderRuntimeAdapter(runtime) {
|
|
|
347
467
|
}
|
|
348
468
|
};
|
|
349
469
|
}
|
|
470
|
+
function buildCloudRecordingSessionUrl(appBaseUrl, sessionId) {
|
|
471
|
+
return `${appBaseUrl}/browsers/${encodeURIComponent(sessionId)}`;
|
|
472
|
+
}
|
|
473
|
+
async function tryOpenCloudRecordingSessionUrl(input) {
|
|
474
|
+
try {
|
|
475
|
+
await input.openUrl(input.sessionUrl);
|
|
476
|
+
} catch {
|
|
477
|
+
input.stderr.write(
|
|
478
|
+
`Could not automatically open the cloud browser session. Open it manually: ${input.sessionUrl}
|
|
479
|
+
`
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
async function resolveCloudRecordingSessionId(runtime) {
|
|
484
|
+
const info = await runtime.info();
|
|
485
|
+
if (typeof info.sessionId !== "string" || info.sessionId.length === 0) {
|
|
486
|
+
throw new Error("Cloud recording could not resolve the created session id.");
|
|
487
|
+
}
|
|
488
|
+
return info.sessionId;
|
|
489
|
+
}
|
|
490
|
+
async function waitForCloudRecordingCompletion(input) {
|
|
491
|
+
const pollIntervalMs = input.pollIntervalMs ?? 1e3;
|
|
492
|
+
for (; ; ) {
|
|
493
|
+
const state = await input.client.getSessionRecording(input.sessionId);
|
|
494
|
+
if (state.status === "completed") {
|
|
495
|
+
return state;
|
|
496
|
+
}
|
|
497
|
+
if (state.status === "failed") {
|
|
498
|
+
throw new Error(state.error ?? "Cloud recording failed.");
|
|
499
|
+
}
|
|
500
|
+
await input.sleep(pollIntervalMs);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
350
503
|
function formatRecordedAction(action) {
|
|
351
504
|
const time = new Date(action.timestamp).toISOString().slice(11, 19);
|
|
352
505
|
switch (action.kind) {
|
|
@@ -378,6 +531,11 @@ function formatRecordedAction(action) {
|
|
|
378
531
|
return `[${time}] reload ${action.pageId}`;
|
|
379
532
|
}
|
|
380
533
|
}
|
|
534
|
+
function delay(ms) {
|
|
535
|
+
return new Promise((resolve) => {
|
|
536
|
+
setTimeout(resolve, ms);
|
|
537
|
+
});
|
|
538
|
+
}
|
|
381
539
|
|
|
382
540
|
// src/cli/bin.ts
|
|
383
541
|
var OPERATION_ALIASES = /* @__PURE__ */ new Map([
|
|
@@ -434,7 +592,7 @@ var OPERATION_ALIASES = /* @__PURE__ */ new Map([
|
|
|
434
592
|
["close", "session.close"]
|
|
435
593
|
]);
|
|
436
594
|
async function main() {
|
|
437
|
-
const argv =
|
|
595
|
+
const argv = process3.argv.slice(2);
|
|
438
596
|
const bootstrapAction = resolveCliBootstrapAction(argv);
|
|
439
597
|
if (bootstrapAction === "version") {
|
|
440
598
|
printVersion();
|
|
@@ -444,7 +602,7 @@ async function main() {
|
|
|
444
602
|
printHelp();
|
|
445
603
|
return;
|
|
446
604
|
}
|
|
447
|
-
await loadCliEnvironment(
|
|
605
|
+
await loadCliEnvironment(process3.cwd());
|
|
448
606
|
const parsed = parseCommandLine(argv);
|
|
449
607
|
if (parsed.command[0] === "browser") {
|
|
450
608
|
await handleBrowserCommand(parsed);
|
|
@@ -461,7 +619,7 @@ async function main() {
|
|
|
461
619
|
list: parsed.options.list === true
|
|
462
620
|
});
|
|
463
621
|
if (exitCode !== 0) {
|
|
464
|
-
|
|
622
|
+
process3.exitCode = exitCode;
|
|
465
623
|
}
|
|
466
624
|
return;
|
|
467
625
|
}
|
|
@@ -492,19 +650,19 @@ async function main() {
|
|
|
492
650
|
engine: engineName,
|
|
493
651
|
runtimeOptions: {
|
|
494
652
|
workspace: parsed.options.workspace,
|
|
495
|
-
rootDir:
|
|
653
|
+
rootDir: process3.cwd(),
|
|
496
654
|
browser: "persistent",
|
|
497
655
|
...parsed.options.launch === void 0 ? {} : { launch: parsed.options.launch },
|
|
498
656
|
...parsed.options.context === void 0 ? {} : { context: parsed.options.context }
|
|
499
657
|
}
|
|
500
658
|
});
|
|
501
659
|
const result2 = await runtime2.close();
|
|
502
|
-
|
|
660
|
+
process3.stdout.write(`${JSON.stringify(result2, null, 2)}
|
|
503
661
|
`);
|
|
504
662
|
return;
|
|
505
663
|
}
|
|
506
664
|
const manager = new OpensteerBrowserManager({
|
|
507
|
-
rootDir:
|
|
665
|
+
rootDir: process3.cwd(),
|
|
508
666
|
workspace: parsed.options.workspace,
|
|
509
667
|
engineName,
|
|
510
668
|
browser: "persistent",
|
|
@@ -512,7 +670,7 @@ async function main() {
|
|
|
512
670
|
...parsed.options.context === void 0 ? {} : { context: parsed.options.context }
|
|
513
671
|
});
|
|
514
672
|
await manager.close();
|
|
515
|
-
|
|
673
|
+
process3.stdout.write(`${JSON.stringify({ closed: true }, null, 2)}
|
|
516
674
|
`);
|
|
517
675
|
return;
|
|
518
676
|
}
|
|
@@ -521,7 +679,7 @@ async function main() {
|
|
|
521
679
|
engine: engineName,
|
|
522
680
|
runtimeOptions: {
|
|
523
681
|
workspace: parsed.options.workspace,
|
|
524
|
-
rootDir:
|
|
682
|
+
rootDir: process3.cwd(),
|
|
525
683
|
...parsed.options.browser === void 0 ? {} : { browser: parsed.options.browser },
|
|
526
684
|
...parsed.options.launch === void 0 ? {} : { launch: parsed.options.launch },
|
|
527
685
|
...parsed.options.context === void 0 ? {} : { context: parsed.options.context }
|
|
@@ -540,7 +698,7 @@ async function main() {
|
|
|
540
698
|
} finally {
|
|
541
699
|
await runtime.disconnect().catch(() => void 0);
|
|
542
700
|
}
|
|
543
|
-
|
|
701
|
+
process3.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
544
702
|
`);
|
|
545
703
|
}
|
|
546
704
|
async function handleBrowserCommand(parsed) {
|
|
@@ -549,7 +707,7 @@ async function handleBrowserCommand(parsed) {
|
|
|
549
707
|
const result = await discoverLocalCdpBrowsers({
|
|
550
708
|
...parsed.options.launch?.timeoutMs === void 0 ? {} : { timeoutMs: parsed.options.launch.timeoutMs }
|
|
551
709
|
});
|
|
552
|
-
|
|
710
|
+
process3.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
553
711
|
`);
|
|
554
712
|
return;
|
|
555
713
|
}
|
|
@@ -565,7 +723,7 @@ async function handleBrowserCommand(parsed) {
|
|
|
565
723
|
...parsed.options.attachHeaders === void 0 ? {} : { headers: parsed.options.attachHeaders },
|
|
566
724
|
...parsed.options.launch?.timeoutMs === void 0 ? {} : { timeoutMs: parsed.options.launch.timeoutMs }
|
|
567
725
|
});
|
|
568
|
-
|
|
726
|
+
process3.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
569
727
|
`);
|
|
570
728
|
return;
|
|
571
729
|
}
|
|
@@ -574,7 +732,7 @@ async function handleBrowserCommand(parsed) {
|
|
|
574
732
|
}
|
|
575
733
|
const engineName = resolveCliEngineName(parsed);
|
|
576
734
|
const manager = new OpensteerBrowserManager({
|
|
577
|
-
rootDir:
|
|
735
|
+
rootDir: process3.cwd(),
|
|
578
736
|
workspace: parsed.options.workspace,
|
|
579
737
|
engineName,
|
|
580
738
|
browser: "persistent",
|
|
@@ -584,7 +742,7 @@ async function handleBrowserCommand(parsed) {
|
|
|
584
742
|
switch (subcommand) {
|
|
585
743
|
case "status": {
|
|
586
744
|
const result = await manager.status();
|
|
587
|
-
|
|
745
|
+
process3.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
588
746
|
`);
|
|
589
747
|
return;
|
|
590
748
|
}
|
|
@@ -597,19 +755,19 @@ async function handleBrowserCommand(parsed) {
|
|
|
597
755
|
sourceUserDataDir,
|
|
598
756
|
...parsed.options.sourceProfileDirectory === void 0 ? {} : { sourceProfileDirectory: parsed.options.sourceProfileDirectory }
|
|
599
757
|
});
|
|
600
|
-
|
|
758
|
+
process3.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
601
759
|
`);
|
|
602
760
|
return;
|
|
603
761
|
}
|
|
604
762
|
case "reset": {
|
|
605
763
|
await manager.reset();
|
|
606
|
-
|
|
764
|
+
process3.stdout.write(`${JSON.stringify({ reset: true }, null, 2)}
|
|
607
765
|
`);
|
|
608
766
|
return;
|
|
609
767
|
}
|
|
610
768
|
case "delete": {
|
|
611
769
|
await manager.delete();
|
|
612
|
-
|
|
770
|
+
process3.stdout.write(`${JSON.stringify({ deleted: true }, null, 2)}
|
|
613
771
|
`);
|
|
614
772
|
return;
|
|
615
773
|
}
|
|
@@ -627,22 +785,39 @@ async function handleRecordCommandEntry(parsed) {
|
|
|
627
785
|
}
|
|
628
786
|
const provider = resolveCliProvider(parsed);
|
|
629
787
|
assertCloudCliOptionsMatchProvider(parsed, provider.mode);
|
|
630
|
-
if (provider.mode !== "local") {
|
|
631
|
-
throw new Error(
|
|
632
|
-
'record requires provider=local. Set "--provider local" or clear OPENSTEER_PROVIDER.'
|
|
633
|
-
);
|
|
634
|
-
}
|
|
635
788
|
const engineName = resolveCliEngineName(parsed);
|
|
636
789
|
if (engineName !== "playwright") {
|
|
637
790
|
throw new Error("record requires engine=playwright.");
|
|
638
791
|
}
|
|
639
|
-
|
|
640
|
-
|
|
792
|
+
const rootDir = process3.cwd();
|
|
793
|
+
const recordBrowser = parsed.options.browser;
|
|
794
|
+
if (provider.mode === "cloud") {
|
|
795
|
+
if (typeof recordBrowser === "object") {
|
|
796
|
+
throw new Error('record does not support browser.mode="attach".');
|
|
797
|
+
}
|
|
798
|
+
const runtimeProvider = buildCliRuntimeProvider(parsed, provider.mode);
|
|
799
|
+
const runtimeConfig = resolveOpensteerRuntimeConfig({
|
|
800
|
+
...runtimeProvider === void 0 ? {} : { provider: runtimeProvider },
|
|
801
|
+
environment: process3.env
|
|
802
|
+
});
|
|
803
|
+
await runOpensteerCloudRecordCommand({
|
|
804
|
+
cloudConfig: runtimeConfig.cloud,
|
|
805
|
+
workspace: parsed.options.workspace,
|
|
806
|
+
url,
|
|
807
|
+
rootDir,
|
|
808
|
+
...recordBrowser === void 0 ? {} : { browser: recordBrowser },
|
|
809
|
+
...parsed.options.launch === void 0 ? {} : { launch: parsed.options.launch },
|
|
810
|
+
...parsed.options.context === void 0 ? {} : { context: parsed.options.context },
|
|
811
|
+
...parsed.options.output === void 0 ? {} : { outputPath: parsed.options.output }
|
|
812
|
+
});
|
|
813
|
+
return;
|
|
641
814
|
}
|
|
642
815
|
if (parsed.options.launch?.headless === true) {
|
|
643
816
|
throw new Error('record requires a headed browser. Remove "--headless true".');
|
|
644
817
|
}
|
|
645
|
-
|
|
818
|
+
if (recordBrowser !== void 0 && recordBrowser !== "persistent") {
|
|
819
|
+
throw new Error('record only supports "--browser persistent".');
|
|
820
|
+
}
|
|
646
821
|
const launch = {
|
|
647
822
|
...parsed.options.launch ?? {},
|
|
648
823
|
headless: false
|
|
@@ -782,6 +957,7 @@ var CLI_OPTION_SPECS = {
|
|
|
782
957
|
provider: { kind: "value" },
|
|
783
958
|
"cloud-base-url": { kind: "value" },
|
|
784
959
|
"cloud-api-key": { kind: "value" },
|
|
960
|
+
"cloud-app-base-url": { kind: "value" },
|
|
785
961
|
"cloud-profile-id": { kind: "value" },
|
|
786
962
|
"cloud-profile-reuse-if-active": { kind: "boolean" },
|
|
787
963
|
json: { kind: "boolean" },
|
|
@@ -911,6 +1087,7 @@ function parseCommandLine(argv) {
|
|
|
911
1087
|
const provider = providerValue === void 0 ? void 0 : normalizeOpensteerProviderMode(providerValue, "--provider");
|
|
912
1088
|
const cloudBaseUrl = readSingle(rawOptions, "cloud-base-url");
|
|
913
1089
|
const cloudApiKey = readSingle(rawOptions, "cloud-api-key");
|
|
1090
|
+
const cloudAppBaseUrl = readSingle(rawOptions, "cloud-app-base-url");
|
|
914
1091
|
const cloudProfileId = readSingle(rawOptions, "cloud-profile-id");
|
|
915
1092
|
const cloudProfileReuseIfActive = readOptionalBoolean(
|
|
916
1093
|
rawOptions,
|
|
@@ -932,6 +1109,7 @@ function parseCommandLine(argv) {
|
|
|
932
1109
|
...provider === void 0 ? {} : { provider },
|
|
933
1110
|
...cloudBaseUrl === void 0 ? {} : { cloudBaseUrl },
|
|
934
1111
|
...cloudApiKey === void 0 ? {} : { cloudApiKey },
|
|
1112
|
+
...cloudAppBaseUrl === void 0 ? {} : { cloudAppBaseUrl },
|
|
935
1113
|
...cloudProfileId === void 0 ? {} : { cloudProfileId },
|
|
936
1114
|
...cloudProfileReuseIfActive === void 0 ? {} : { cloudProfileReuseIfActive },
|
|
937
1115
|
...json === void 0 ? {} : { json },
|
|
@@ -1000,14 +1178,14 @@ function buildCliExplicitProvider(parsed) {
|
|
|
1000
1178
|
function resolveCliEngineName(parsed) {
|
|
1001
1179
|
return resolveOpensteerEngineName({
|
|
1002
1180
|
...parsed.options.requestedEngineName === void 0 ? {} : { requested: parsed.options.requestedEngineName },
|
|
1003
|
-
...
|
|
1181
|
+
...process3.env.OPENSTEER_ENGINE === void 0 ? {} : { environment: process3.env.OPENSTEER_ENGINE }
|
|
1004
1182
|
});
|
|
1005
1183
|
}
|
|
1006
1184
|
function resolveCliProvider(parsed) {
|
|
1007
1185
|
const explicitProvider = buildCliExplicitProvider(parsed);
|
|
1008
1186
|
return resolveOpensteerProvider({
|
|
1009
1187
|
...explicitProvider === void 0 ? {} : { provider: explicitProvider },
|
|
1010
|
-
...
|
|
1188
|
+
...process3.env.OPENSTEER_PROVIDER === void 0 ? {} : { environmentProvider: process3.env.OPENSTEER_PROVIDER }
|
|
1011
1189
|
});
|
|
1012
1190
|
}
|
|
1013
1191
|
function buildCliRuntimeProvider(parsed, providerMode) {
|
|
@@ -1016,7 +1194,7 @@ function buildCliRuntimeProvider(parsed, providerMode) {
|
|
|
1016
1194
|
return explicitProvider?.mode === "local" ? explicitProvider : void 0;
|
|
1017
1195
|
}
|
|
1018
1196
|
const browserProfile = buildCliBrowserProfile(parsed);
|
|
1019
|
-
const hasCloudOverrides = parsed.options.cloudBaseUrl !== void 0 || parsed.options.cloudApiKey !== void 0 || browserProfile !== void 0;
|
|
1197
|
+
const hasCloudOverrides = parsed.options.cloudBaseUrl !== void 0 || parsed.options.cloudApiKey !== void 0 || parsed.options.cloudAppBaseUrl !== void 0 || browserProfile !== void 0;
|
|
1020
1198
|
if (!hasCloudOverrides && explicitProvider?.mode !== "cloud") {
|
|
1021
1199
|
return void 0;
|
|
1022
1200
|
}
|
|
@@ -1024,11 +1202,12 @@ function buildCliRuntimeProvider(parsed, providerMode) {
|
|
|
1024
1202
|
mode: "cloud",
|
|
1025
1203
|
...parsed.options.cloudBaseUrl === void 0 ? {} : { baseUrl: parsed.options.cloudBaseUrl },
|
|
1026
1204
|
...parsed.options.cloudApiKey === void 0 ? {} : { apiKey: parsed.options.cloudApiKey },
|
|
1205
|
+
...parsed.options.cloudAppBaseUrl === void 0 ? {} : { appBaseUrl: parsed.options.cloudAppBaseUrl },
|
|
1027
1206
|
...browserProfile === void 0 ? {} : { browserProfile }
|
|
1028
1207
|
};
|
|
1029
1208
|
}
|
|
1030
1209
|
function assertCloudCliOptionsMatchProvider(parsed, providerMode) {
|
|
1031
|
-
if (providerMode !== "cloud" && (parsed.options.cloudBaseUrl !== void 0 || parsed.options.cloudApiKey !== void 0 || parsed.options.cloudProfileId !== void 0 || parsed.options.cloudProfileReuseIfActive === true)) {
|
|
1210
|
+
if (providerMode !== "cloud" && (parsed.options.cloudBaseUrl !== void 0 || parsed.options.cloudApiKey !== void 0 || parsed.options.cloudAppBaseUrl !== void 0 || parsed.options.cloudProfileId !== void 0 || parsed.options.cloudProfileReuseIfActive === true)) {
|
|
1032
1211
|
throw new Error(
|
|
1033
1212
|
'Cloud-specific options require provider=cloud. Set "--provider cloud" or OPENSTEER_PROVIDER=cloud.'
|
|
1034
1213
|
);
|
|
@@ -1040,20 +1219,20 @@ async function handleStatusCommand(parsed) {
|
|
|
1040
1219
|
const runtimeProvider = buildCliRuntimeProvider(parsed, provider.mode);
|
|
1041
1220
|
const runtimeConfig = resolveOpensteerRuntimeConfig({
|
|
1042
1221
|
...runtimeProvider === void 0 ? {} : { provider: runtimeProvider },
|
|
1043
|
-
environment:
|
|
1222
|
+
environment: process3.env
|
|
1044
1223
|
});
|
|
1045
1224
|
const status = await collectOpensteerStatus({
|
|
1046
|
-
rootDir:
|
|
1225
|
+
rootDir: process3.cwd(),
|
|
1047
1226
|
...parsed.options.workspace === void 0 ? {} : { workspace: parsed.options.workspace },
|
|
1048
1227
|
provider,
|
|
1049
1228
|
...runtimeConfig.cloud === void 0 ? {} : { cloudConfig: runtimeConfig.cloud }
|
|
1050
1229
|
});
|
|
1051
1230
|
if (parsed.options.json === true) {
|
|
1052
|
-
|
|
1231
|
+
process3.stdout.write(`${JSON.stringify(status, null, 2)}
|
|
1053
1232
|
`);
|
|
1054
1233
|
return;
|
|
1055
1234
|
}
|
|
1056
|
-
|
|
1235
|
+
process3.stdout.write(renderOpensteerStatus(status));
|
|
1057
1236
|
}
|
|
1058
1237
|
function parseKeyValueList(values) {
|
|
1059
1238
|
if (values === void 0 || values.length === 0) {
|
|
@@ -1138,7 +1317,7 @@ function resolveCommandLength(tokens) {
|
|
|
1138
1317
|
return Math.min(tokens.length, 1);
|
|
1139
1318
|
}
|
|
1140
1319
|
function printHelp() {
|
|
1141
|
-
|
|
1320
|
+
process3.stdout.write(`Opensteer v2 CLI
|
|
1142
1321
|
|
|
1143
1322
|
Usage:
|
|
1144
1323
|
opensteer open <url> --workspace <id> [--browser persistent|temporary|attach]
|
|
@@ -1170,6 +1349,7 @@ Common options:
|
|
|
1170
1349
|
--provider local|cloud
|
|
1171
1350
|
--cloud-base-url <url>
|
|
1172
1351
|
--cloud-api-key <key>
|
|
1352
|
+
--cloud-app-base-url <url>
|
|
1173
1353
|
--cloud-profile-id <id>
|
|
1174
1354
|
--cloud-profile-reuse-if-active <true|false>
|
|
1175
1355
|
--json <true|false>
|
|
@@ -1188,7 +1368,7 @@ Common options:
|
|
|
1188
1368
|
`);
|
|
1189
1369
|
}
|
|
1190
1370
|
function printVersion() {
|
|
1191
|
-
|
|
1371
|
+
process3.stdout.write(`${package_default.version}
|
|
1192
1372
|
`);
|
|
1193
1373
|
}
|
|
1194
1374
|
main().catch((error) => {
|
|
@@ -1203,9 +1383,9 @@ main().catch((error) => {
|
|
|
1203
1383
|
message: String(error)
|
|
1204
1384
|
}
|
|
1205
1385
|
};
|
|
1206
|
-
|
|
1386
|
+
process3.stderr.write(`${JSON.stringify(payload)}
|
|
1207
1387
|
`);
|
|
1208
|
-
|
|
1388
|
+
process3.exitCode = 1;
|
|
1209
1389
|
});
|
|
1210
1390
|
//# sourceMappingURL=bin.js.map
|
|
1211
1391
|
//# sourceMappingURL=bin.js.map
|