@revoengine/cli 1.0.12 → 1.0.14

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.
Files changed (31) hide show
  1. package/README.md +16 -2
  2. package/dist/src/cli.js +4 -0
  3. package/dist/src/client.d.ts +5 -0
  4. package/dist/src/client.js +41 -42
  5. package/dist/src/commands/component.js +26 -25
  6. package/dist/src/commands/migrate.js +10 -0
  7. package/dist/src/commands/terminal-browser.d.ts +40 -6
  8. package/dist/src/commands/terminal-browser.js +480 -19
  9. package/dist/src/commands/terminal-image.js +59 -1
  10. package/dist/src/commands/terminal-operational-log.d.ts +18 -0
  11. package/dist/src/commands/terminal-operational-log.js +119 -0
  12. package/dist/src/commands/terminal-policy.d.ts +23 -0
  13. package/dist/src/commands/terminal-policy.js +48 -0
  14. package/dist/src/commands/terminal-pty.d.ts +4 -0
  15. package/dist/src/commands/terminal-pty.js +39 -0
  16. package/dist/src/commands/terminal-reconnect-grace.d.ts +11 -0
  17. package/dist/src/commands/terminal-reconnect-grace.js +29 -0
  18. package/dist/src/commands/terminal-sandbox.d.ts +5 -1
  19. package/dist/src/commands/terminal-sandbox.js +19 -5
  20. package/dist/src/commands/terminal-secure-browser.d.ts +25 -0
  21. package/dist/src/commands/terminal-secure-browser.js +58 -0
  22. package/dist/src/commands/terminal.d.ts +5 -2
  23. package/dist/src/commands/terminal.js +259 -44
  24. package/dist/src/migration.js +10 -10
  25. package/dist/src/request-queue.d.ts +20 -0
  26. package/dist/src/request-queue.js +80 -0
  27. package/dist/src/resource-inventory.js +9 -10
  28. package/dist/src/resource-syncs/endpoint-sync.js +12 -46
  29. package/dist/src/types.d.ts +2 -0
  30. package/package.json +4 -3
  31. package/scripts/ensure-pty-helper.mjs +9 -0
package/README.md CHANGED
@@ -84,10 +84,22 @@ revo terminal disconnect --workspace "$HOME/projects/my-project"
84
84
 
85
85
  The service starts at login, reconnects automatically, and pins the selected project profile at installation (or an explicit `--project <name>`). Install one service per workspace/profile; pass the same `--project` to uninstall after switching projects. Uninstall stops the service but keeps the terminal grant and local registration. `revo terminal disconnect --workspace <path>` revokes the grant and removes its local credential; uninstall the service first. On macOS, service logs are in `~/Library/Logs/RevoEngine/`. On Linux, inspect them with `journalctl --user -u <unit-name>`; `install` prints the unit name. Linux user services normally stop after logout unless an administrator enables user lingering.
86
86
 
87
- The Agent terminal runs ordinary commands in a local workspace sandbox: writes are limited to the registered workspace and a private temporary directory, network access is blocked, and commands receive a private `HOME`. A reviewed `workspace-network` request enables network access while retaining workspace write boundaries. `unrestricted` removes the sandbox for a specific approved command. macOS uses Seatbelt; Linux requires `bwrap` (bubblewrap) installed for sandboxed execution. Missing sandbox support fails closed. Workspace patches and stdin for a running process are supported. The terminal's Sandbox/Full access grant is a separate ceiling from Composer's approval policy. A personal API key is required.
87
+ Runner credentials are stored in `runner.json` beside the CLI configuration. Each executed shell command writes raw output to a private `runner-logs/<executionId>.log` there, capped at 10 MB per file. Logs older than 24 hours are removed when the next command starts; a runner left idle does not perform timed cleanup. Optional CLI HTTP tracing writes sanitized request metadata under the project `.revoengine/logs/http-trace/`. These are separate from the Assistant's server-side tool history and do not form a complete local transcript. Treat runner logs as sensitive because command output may contain secrets.
88
+
89
+ Terminal connection and execution metadata is also written under the CLI configuration at `logs/terminal/<agentTerminalId>/debug.log`. Each line has `[ISO UTC timestamp][severity][assistantThreadId][assistantMessageId] event` followed by allowlisted metadata such as the execution ID, operation, sandbox, exit code, and reconnect delay. Commands, browser URLs, input, output, and credentials are excluded. On the first write after UTC midnight or after a restart, the completed day moves to `YYYY-MM-DD-debug.log.gz`; archives older than 30 days are removed. The log directory is private (`0700`) and files are `0600`. Runner/service stderr remains available for startup failures that occur before this operational log is ready.
90
+
91
+ The Agent terminal has independent command and network grants. Grants are ceilings; each execution frame carries the requested sandbox and `networkAccess=none|local|full`, so a Full grant does not silently widen a workspace or local-only call. Workspace commands keep writes inside the registered workspace and a private temporary directory; a workspace shell with external networking uses `workspace-network`. An explicit `unrestricted` command requests host file access without adding network access. A localhost development server must request Local network access to bind its port. macOS uses Seatbelt for workspace isolation and host plus local-only network; Linux uses `bwrap` and fails closed for shell Local access because enforceable localhost-only isolation is unavailable there. Missing isolation support fails closed. The runner requires a complete `terminal_policy_v2` execution frame from Realtime, including requested command/network modes, grant revision and optional expiry. Temporary scope expiry stops affected work and closes Browser sessions using that scope. Workspace patches and stdin for a running process are supported. A personal API key is required.
88
92
 
89
93
  Browser actions use Playwright's Chromium headless shell. The CLI's npm install downloads only that browser into Playwright's per-user cache; a separate Chrome installation is not required. If npm scripts were disabled or the download was interrupted, reinstall the CLI with scripts enabled before using Browser. Linux hosts still need Playwright's system libraries; an administrator can install them with `npx playwright install-deps chromium`.
90
94
 
95
+ The runner keeps a separate browser context for each connected assistant chat, so navigation, DOM inspection, clicks, form controls, waiting, scrolling, and screenshots share that chat's cookies and page state. It follows an SSO popup opened by a click or key press and returns to its opener when the popup closes. Browser sessions expire after 10 minutes idle (up to four per runner), on a Local or Full network lease expiry, or when the runner stops or its access is revoked. A one-time Browser network approval closes its context immediately after that action finishes. DOM results include bounded selector hints for interactive elements without their field values. The Browser action supports `fill`, `check`, `select`, `press`, `scroll`, and `wait_for` as well as navigation, DOM, and click. Ordinary `fill` rejects password and secret-like controls; the Assistant may request a one-time secure credential dialog, which encrypts the value to this runner and fills it in memory without sending it in model tool arguments. Screenshots can capture the viewport (default), the full page, one selected element, or a bounded viewport crop. For viewport capture, an optional selector limits only the returned DOM text; the image still covers the viewport. Element capture requires a selector. Full-page and crop capture reject selectors. A screenshot is uploaded and attached automatically; calling `save_image` on its local path uploads a second copy. For custom Playwright E2E scripts, run them as ordinary terminal commands in the project, using the requested sandbox and network grant; the Browser action does not execute arbitrary JavaScript.
96
+
97
+ Interactive PTY commands on macOS use the executable `node-pty` spawn helper. The CLI install and runner verify its executable permission. Ordinary commands and local development servers can run with pipes; request a PTY only when the program needs terminal interaction.
98
+
99
+ Local Browser mode filters HTTP and WebSocket requests and disables WebRTC, WebTransport, Worker and SharedWorker before page scripts. Worker-dependent pages may not work in this mode; Chromium is not enclosed in an OS network sandbox. A temporary Local or Full network lease closes the Browser context at expiry, including before a queued secure credential fill. A lost WebSocket connection retains running processes and Browser contexts for one two-minute reconnect period; repeated failures do not renew it. Grant revision changes stop active work and reject older execute frames.
100
+
101
+ `save_image` validates the canonical path of the opened file descriptor and reads the image from that same descriptor (up to 30 MiB). It rejects the upload if the descriptor path cannot be verified, including when `lsof` is unavailable on macOS or `/proc/self/fd` cannot be resolved on Linux.
102
+
91
103
  ### Environment variables
92
104
 
93
105
  Environment variables are the recommended authentication method for CI/CD:
@@ -222,6 +234,8 @@ revo pull \
222
234
 
223
235
  `pull` requires either `--all` or `--resources`. It writes resources in dependency order and records the source baseline under the authenticated instance ID. Add `--skip-groups` to omit Group and Role Group resources from the selected scope.
224
236
 
237
+ Repository pull, plan, and deployment use Stable Keys for Component identity, including projects with a legacy UUID lock or no explicit `componentIdentity` setting. Pull reports resources without a Stable Key as unmanaged WIP and skips them while continuing with managed resources; `--force` does not assign missing keys or include WIP resources.
238
+
225
239
  A normal pull protects locally changed files and does not remove source-deleted manifests. After review, `pull --force` replaces managed resource directories and prunes managed manifests that no longer exist on the source. Keep hand-written files outside generated resource directories.
226
240
 
227
241
  ### Review and deploy the repository
@@ -470,7 +484,7 @@ Each enabled invocation writes `.revoengine/logs/http-trace/<timestamp>.json` an
470
484
 
471
485
  Traces retain only known static API route segments, method, status, timing, payload byte counts, and diagnostic stage or resource labels. They omit URL origins and query strings, dynamic IDs and names, Stable Keys, profile names, headers, correlation values, bodies, error messages, and command arguments. An error contributes its class name only. This keeps credentials and instance-specific identifiers out of trace reports.
472
486
 
473
- Inventory reads bound concurrent detail requests to roughly 10 per helper call; this is not a global per-host rate limit. Most resource readers use bounded batches or the shared order-preserving worker pool. Database View inventory deduplicates active list IDs, fetches complete details, excludes deleted readbacks, and sorts by ID. Failed detail reads fail the inventory instead of silently producing a partial snapshot.
487
+ Each CLI invocation shares one queue of up to six active API requests across resource clients. An available slot starts the next waiting request, with queued POST, PUT, PATCH, and DELETE requests taking priority over reads. Waiting requests can be cancelled and expire after five minutes; the HTTP timeout starts when the first network attempt begins. Retry backoff releases the slot before the next attempt is queued. Endpoint and general resource inventories use order-preserving workers that refill free slots without batch barriers. Database View inventory deduplicates active list IDs, fetches complete details, excludes deleted readbacks, and sorts by ID. Failed detail reads fail the inventory instead of silently producing a partial snapshot. Streaming debug and terminal connections use separate transport paths.
474
488
 
475
489
  Client requests default to no transport retries and there is no global retry flag. Database View detail reads opt into two retries, for up to three attempts. Opted-in requests can retry transport or response-read errors and HTTP 429, 502, 503, or 504; HTTP 500 is retried only for GET, HEAD, and OPTIONS. Aborted requests are not retried. Backoff starts at 100 ms with jitter, respects a bounded numeric `Retry-After`, and shares one request timeout across attempts. This opt-in behavior can also apply to mutations, so resource-specific write recovery still performs its own fresh live validation before retrying.
476
490
 
package/dist/src/cli.js CHANGED
@@ -6,6 +6,7 @@ import { getActiveEnvironmentName } from "./config.js";
6
6
  import { handleAuthCommand, handleComponentCommand, handleDatabaseTablesCommand, handleDatabaseViewsCommand, handleDeployCommand, handleDiffCommand, handleEndpointsCommand, handleEnvCommand, handleEventsCommand, handleGroupsCommand, handleInfoCommand, handleJobTemplatesCommand, handleMetadataCommand, handleMigrateCommand, handlePlanCommand, handlePullCommand, handleProjectCommand, handleRequestCommand, handleRoleGroupsCommand, handleSearchCommand, handleSchedulesCommand, handleTerminalCommand, } from "./commands/index.js";
7
7
  import { createHttpTraceSession, finalizeHttpTraceSession, withHttpTraceSession, } from "./http-trace.js";
8
8
  import { resolveProjectRoot } from "./project.js";
9
+ import { withRequestQueue } from "./request-queue.js";
9
10
  import { buildRuntimeViewModel } from "./runtime-view.js";
10
11
  import { renderHelp, renderOverview } from "./ui.js";
11
12
  import { maybeNotifyUpdateAvailable } from "./update-notifier.js";
@@ -307,6 +308,9 @@ async function runMain(args, argv) {
307
308
  throw new Error(`Unknown command: ${command}`);
308
309
  }
309
310
  export async function main(argv = process.argv.slice(2)) {
311
+ return withRequestQueue(() => runCommandWithTrace(argv));
312
+ }
313
+ async function runCommandWithTrace(argv) {
310
314
  const args = parseArgs(argv);
311
315
  const trace = configuredHttpTrace(args);
312
316
  if (!trace) {
@@ -1,3 +1,4 @@
1
+ import { RequestQueue } from './request-queue.ts';
1
2
  import type { ComponentRecord, DatabaseSchemaRecord, DatabaseViewRecord, EndpointRecord, EventRecord, GroupRecord, JobTemplateRecord, RoleGroupRecord, ScheduleRecord } from './types.ts';
2
3
  export type RequestOptions = {
3
4
  query?: Record<string, unknown>;
@@ -7,6 +8,8 @@ export type RequestOptions = {
7
8
  spinnerLabel?: string;
8
9
  productionWrite?: boolean;
9
10
  timeoutMs?: number;
11
+ queueTimeoutMs?: number;
12
+ signal?: AbortSignal;
10
13
  /** Explicitly trusted service endpoint, such as the sandbox URL returned by /me. */
11
14
  allowExternalOrigin?: boolean;
12
15
  maxRetries?: number;
@@ -286,6 +289,7 @@ export type ClientOptions = {
286
289
  trustedServiceOrigins?: string[];
287
290
  maxRetries?: number;
288
291
  retryDelayMs?: number;
292
+ requestQueue?: RequestQueue;
289
293
  };
290
294
  export type ApiResponse<T = unknown> = {
291
295
  status: number;
@@ -327,6 +331,7 @@ export declare class RevoClient {
327
331
  private trustedServiceOrigins;
328
332
  private maxRetries;
329
333
  private retryDelayMs;
334
+ private requestQueue;
330
335
  constructor(options?: ClientOptions);
331
336
  get authHeader(): string;
332
337
  get authValidationKey(): string;
@@ -2,6 +2,7 @@ import { setTimeout as waitForDelay } from 'node:timers/promises';
2
2
  import { AUTH_VALIDATION_TTL_MS, buildAuthValidationKey, DEFAULT_BASE_URL, readAuthValidationState, resolveRuntimeConfig, saveAuthValidationState, } from "./config.js";
3
3
  import { beginHttpTraceRequest, completeHttpTraceRequest, responseSize, } from "./http-trace.js";
4
4
  import { isInteractiveTerminal, promptConfirm } from "./prompt.js";
5
+ import { currentRequestQueue, RequestQueue } from "./request-queue.js";
5
6
  import { createSpinner } from "./spinner.js";
6
7
  import { mapWithConcurrency } from "./utils.js";
7
8
  export class ApiError extends Error {
@@ -419,6 +420,7 @@ export class RevoClient {
419
420
  trustedServiceOrigins;
420
421
  maxRetries;
421
422
  retryDelayMs;
423
+ requestQueue;
422
424
  constructor(options = {}) {
423
425
  const config = resolveRuntimeConfig(options);
424
426
  this.baseUrl = config.baseUrl;
@@ -431,6 +433,7 @@ export class RevoClient {
431
433
  this.trustedServiceOrigins = resolveTrustedServiceOrigins(options.trustedServiceOrigins);
432
434
  this.maxRetries = options.maxRetries ?? 0;
433
435
  this.retryDelayMs = options.retryDelayMs ?? 100;
436
+ this.requestQueue = options.requestQueue || currentRequestQueue() || new RequestQueue();
434
437
  }
435
438
  get authHeader() {
436
439
  return normalizeToken(this.token);
@@ -526,9 +529,10 @@ export class RevoClient {
526
529
  text: options.spinnerLabel || defaultSpinnerLabel(method, path),
527
530
  });
528
531
  const abortController = options.timeoutMs === undefined ? undefined : new AbortController();
529
- const timeout = abortController
530
- ? setTimeout(() => abortController.abort(), options.timeoutMs)
531
- : undefined;
532
+ const signal = abortController && options.signal
533
+ ? AbortSignal.any([abortController.signal, options.signal])
534
+ : abortController?.signal || options.signal;
535
+ let timeout;
532
536
  const traceRequest = beginHttpTraceRequest({
533
537
  method,
534
538
  url,
@@ -544,59 +548,54 @@ export class RevoClient {
544
548
  for (let attempt = 0; attempt <= maxRetries; attempt++) {
545
549
  if (attempt > 0) {
546
550
  const backoff = baseRetryDelay * Math.pow(2, attempt - 1) + Math.floor(Math.random() * 25);
547
- await delay(backoff, abortController?.signal);
551
+ await delay(backoff, signal);
548
552
  }
549
- await delay(REQUEST_DELAY_MS, abortController?.signal);
553
+ await delay(REQUEST_DELAY_MS, signal);
554
+ const stage = { value: 'queue' };
555
+ let failedResponse;
550
556
  let response;
551
- try {
552
- response = await this.fetchImpl(url, {
553
- method: normalizedMethod,
554
- headers,
555
- body: body,
556
- redirect: 'manual',
557
- ...(abortController ? { signal: abortController.signal } : {}),
558
- });
559
- }
560
- catch (error) {
561
- lastError = error;
562
- if (attempt < maxRetries && !abortController?.signal.aborted) {
563
- continue;
564
- }
565
- completeHttpTraceRequest(traceRequest, { ok: false, error });
566
- throw error;
567
- }
568
- try {
569
- assertNoAuthenticatedRedirect(response);
570
- }
571
- catch (error) {
572
- completeHttpTraceRequest(traceRequest, {
573
- status: response.status,
574
- ok: false,
575
- responseHeaders: response.headers,
576
- error,
577
- });
578
- throw error;
579
- }
580
557
  let data;
581
558
  try {
582
- data = await readResponseData(response);
559
+ ({ response, data } = await this.requestQueue.run(async () => {
560
+ if (abortController && !timeout) {
561
+ timeout = setTimeout(() => abortController.abort(), options.timeoutMs);
562
+ }
563
+ stage.value = 'fetch';
564
+ const fetched = await this.fetchImpl(url, {
565
+ method: normalizedMethod,
566
+ headers,
567
+ body: body,
568
+ redirect: 'manual',
569
+ ...(signal ? { signal } : {}),
570
+ });
571
+ failedResponse = fetched;
572
+ stage.value = 'redirect';
573
+ assertNoAuthenticatedRedirect(fetched);
574
+ stage.value = 'body';
575
+ return { response: fetched, data: await readResponseData(fetched) };
576
+ }, {
577
+ signal,
578
+ timeoutMs: options.queueTimeoutMs,
579
+ priority: ['POST', 'PUT', 'PATCH', 'DELETE'].includes(normalizedMethod) ? 'mutation' : 'read',
580
+ }));
583
581
  }
584
582
  catch (error) {
585
- lastError = error;
586
- if (attempt < maxRetries && !abortController?.signal.aborted) {
587
- continue;
583
+ if (stage.value === 'fetch' || stage.value === 'body') {
584
+ lastError = error;
585
+ if (attempt < maxRetries && !signal?.aborted) {
586
+ continue;
587
+ }
588
588
  }
589
589
  completeHttpTraceRequest(traceRequest, {
590
- status: response.status,
590
+ ...(failedResponse ? { status: failedResponse.status, responseHeaders: failedResponse.headers } : {}),
591
591
  ok: false,
592
- responseHeaders: response.headers,
593
592
  error,
594
593
  });
595
594
  throw error;
596
595
  }
597
596
  const isRetryableStatus = [429, 502, 503, 504].includes(response.status)
598
597
  || (response.status === 500 && ['GET', 'HEAD', 'OPTIONS'].includes(normalizedMethod));
599
- if (!response.ok && response.status !== 304 && isRetryableStatus && attempt < maxRetries && !abortController?.signal.aborted) {
598
+ if (!response.ok && response.status !== 304 && isRetryableStatus && attempt < maxRetries && !signal?.aborted) {
600
599
  let retryAfterMs = 0;
601
600
  const retryAfterHeader = response.headers.get('retry-after');
602
601
  if (retryAfterHeader) {
@@ -606,7 +605,7 @@ export class RevoClient {
606
605
  }
607
606
  }
608
607
  if (retryAfterMs > 0) {
609
- await delay(Math.min(5000, retryAfterMs), abortController?.signal);
608
+ await delay(Math.min(5000, retryAfterMs), signal);
610
609
  }
611
610
  continue;
612
611
  }
@@ -200,7 +200,11 @@ function getProjectRoot(cwd) {
200
200
  currentDir = path.dirname(currentDir);
201
201
  }
202
202
  }
203
- function resolveComponentIdentity(cwd) {
203
+ function resolveComponentIdentity(context) {
204
+ if (context.componentIdentity) {
205
+ return context.componentIdentity;
206
+ }
207
+ const { cwd } = context;
204
208
  const metadata = readProjectMetadata(cwd);
205
209
  if (metadata) {
206
210
  return readProjectComponentIdentity(cwd);
@@ -279,7 +283,7 @@ function findComponentManifestsById(cwd, componentId) {
279
283
  });
280
284
  }
281
285
  function findComponentManifestsByTarget(cwd, target) {
282
- const identity = resolveComponentIdentity(cwd);
286
+ const identity = resolveComponentIdentity({ cwd });
283
287
  const matches = findComponentManifestsById(cwd, target);
284
288
  if (identity.mode !== 'stableKey') {
285
289
  return matches;
@@ -648,8 +652,9 @@ function findLocalEntryForRemote(remote, localCatalog) {
648
652
  }
649
653
  return idMatch;
650
654
  }
651
- function upsertLockFromRemote(cwd, remote, targetPath, local, environmentName) {
652
- const identity = resolveComponentIdentity(cwd);
655
+ function upsertLockFromRemote(context, remote, targetPath, local, environmentName) {
656
+ const { cwd } = context;
657
+ const identity = resolveComponentIdentity(context);
653
658
  const remoteComponentId = componentIdOf(remote);
654
659
  const localComponentId = componentIdOf(local || remote);
655
660
  const identityKey = readComponentIdentityValue(remote, identity);
@@ -676,7 +681,7 @@ function upsertLockFromRemote(cwd, remote, targetPath, local, environmentName) {
676
681
  pulledAt: new Date().toISOString(),
677
682
  }, identity, environmentName);
678
683
  }
679
- function buildPullDecision(cwd, remote, localCatalog = buildLocalComponentCatalog(cwd, resolveComponentIdentity(cwd)), environmentName) {
684
+ function buildPullDecision(cwd, remote, localCatalog = buildLocalComponentCatalog(cwd, resolveComponentIdentity({ cwd })), environmentName) {
680
685
  const identity = localCatalog.identity;
681
686
  const remoteTargetPath = componentTargetPath(cwd, remote);
682
687
  const identityKey = readComponentIdentityValue(remote, identity);
@@ -684,7 +689,7 @@ function buildPullDecision(cwd, remote, localCatalog = buildLocalComponentCatalo
684
689
  return {
685
690
  kind: 'skip',
686
691
  targetPath: remoteTargetPath,
687
- reason: `missing ${identityDescription(identity)}; unmanaged`,
692
+ reason: `missing ${identityDescription(identity)}; unmanaged WIP`,
688
693
  };
689
694
  }
690
695
  const local = findLocalEntryForRemote(remote, localCatalog);
@@ -854,7 +859,7 @@ async function resolveRemoteComponentForTarget(context, target, identity, remote
854
859
  }
855
860
  async function pullResolvedComponent(context, component, mode, localCatalog) {
856
861
  const { cwd, println } = context;
857
- const identity = resolveComponentIdentity(cwd);
862
+ const identity = resolveComponentIdentity(context);
858
863
  const componentId = componentIdOf(component);
859
864
  const decision = buildPullDecision(cwd, component, localCatalog || buildLocalComponentCatalog(cwd, identity), context.componentEnvironment);
860
865
  if (decision.kind === 'skip' && decision.reason.includes('; unmanaged')) {
@@ -918,7 +923,7 @@ async function pullResolvedComponent(context, component, mode, localCatalog) {
918
923
  const localComponent = decision.manifestPath
919
924
  ? readWorkspaceComponentSafe(decision.manifestPath) || decision.localComponent
920
925
  : decision.localComponent;
921
- upsertLockFromRemote(cwd, component, decision.targetPath, localComponent, context.componentEnvironment);
926
+ upsertLockFromRemote(context, component, decision.targetPath, localComponent, context.componentEnvironment);
922
927
  }
923
928
  const result = {
924
929
  status: metadataUpdated ? 'pulled' : 'skipped',
@@ -958,7 +963,7 @@ async function pullResolvedComponent(context, component, mode, localCatalog) {
958
963
  }
959
964
  const manifestPath = path.join(folder, 'component.json');
960
965
  const localComponent = readWorkspaceComponentSafe(manifestPath) || decision.localComponent;
961
- upsertLockFromRemote(cwd, component, targetPath, localComponent, context.componentEnvironment);
966
+ upsertLockFromRemote(context, component, targetPath, localComponent, context.componentEnvironment);
962
967
  const result = {
963
968
  status: 'pulled',
964
969
  targetPath,
@@ -975,7 +980,7 @@ async function pullResolvedComponent(context, component, mode, localCatalog) {
975
980
  return result;
976
981
  }
977
982
  async function pullSingleComponent(context, target, mode = { force: false, stale: false }) {
978
- const identity = resolveComponentIdentity(context.cwd);
983
+ const identity = resolveComponentIdentity(context);
979
984
  let remoteCatalog;
980
985
  let localCatalog;
981
986
  if (identity.mode === 'stableKey'
@@ -1015,13 +1020,9 @@ export async function pullAllComponents(context, options) {
1015
1020
  context.println('No components found.');
1016
1021
  return [];
1017
1022
  }
1018
- const identity = resolveComponentIdentity(context.cwd);
1023
+ const identity = resolveComponentIdentity(context);
1019
1024
  const remoteCatalog = await buildRemoteComponentCatalog(context, identity, components);
1020
1025
  const managedCount = remoteCatalog.byIdentity.size;
1021
- if (managedCount === 0 && options.pruneOrphans !== true) {
1022
- context.println(`No components managed by ${identityDescription(identity)} were found.`);
1023
- return [];
1024
- }
1025
1026
  await confirmBulkAction(context, 'pull', identity.mode === 'componentId'
1026
1027
  ? discoveredTotal ?? (components.length >= COMPONENT_LIST_PAGE_SIZE ? `at least ${components.length} components` : components.length)
1027
1028
  : managedCount, options.force || options.yes);
@@ -1130,7 +1131,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
1130
1131
  const component = readWorkspaceComponent(manifestPath);
1131
1132
  const localComponentId = componentIdOf(component);
1132
1133
  const targetPath = componentWorkspacePath(context.cwd, manifestPath);
1133
- const identity = resolveComponentIdentity(context.cwd);
1134
+ const identity = resolveComponentIdentity(context);
1134
1135
  const identityKey = readComponentIdentityValue(component, identity);
1135
1136
  if (!localComponentId) {
1136
1137
  throw new Error(`Missing componentId in ${manifestPath}.`);
@@ -1180,7 +1181,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
1180
1181
  });
1181
1182
  throw new Error(`Cannot push ${targetPath}: created component did not verify against local source. Diagnostic: ${logPath}`);
1182
1183
  }
1183
- upsertLockFromRemote(context.cwd, refreshedRemote, targetPath, component, context.componentEnvironment);
1184
+ upsertLockFromRemote(context, refreshedRemote, targetPath, component, context.componentEnvironment);
1184
1185
  const result = { status: 'deployed', targetPath };
1185
1186
  printSyncStatus(println, { status: 'Deployed', direction: 'push', targetPath });
1186
1187
  return result;
@@ -1212,7 +1213,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
1212
1213
  const remoteHash = componentSourceHash(remote, identity);
1213
1214
  const localHash = componentSourceHash(component, identity);
1214
1215
  if (context.componentEnvironment && localHash === remoteHash) {
1215
- upsertLockFromRemote(context.cwd, remote, targetPath, component, context.componentEnvironment);
1216
+ upsertLockFromRemote(context, remote, targetPath, component, context.componentEnvironment);
1216
1217
  const result = {
1217
1218
  status: 'skipped',
1218
1219
  targetPath,
@@ -1235,7 +1236,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
1235
1236
  const localHash = componentSourceHash(component, identity);
1236
1237
  if (remoteHash !== lockEntry.remoteHash) {
1237
1238
  if (localHash === remoteHash) {
1238
- upsertLockFromRemote(context.cwd, remote, targetPath, component, context.componentEnvironment);
1239
+ upsertLockFromRemote(context, remote, targetPath, component, context.componentEnvironment);
1239
1240
  const result = {
1240
1241
  status: 'skipped',
1241
1242
  targetPath,
@@ -1276,7 +1277,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
1276
1277
  targetPath,
1277
1278
  reason: 'no changes',
1278
1279
  };
1279
- upsertLockFromRemote(context.cwd, remote, targetPath, component, context.componentEnvironment);
1280
+ upsertLockFromRemote(context, remote, targetPath, component, context.componentEnvironment);
1280
1281
  printSyncStatus(println, {
1281
1282
  status: 'Skipped',
1282
1283
  direction: 'push',
@@ -1361,7 +1362,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
1361
1362
  });
1362
1363
  throw new Error(`Cannot push ${targetPath}: updated component did not verify against local source. Diagnostic: ${logPath}`);
1363
1364
  }
1364
- upsertLockFromRemote(context.cwd, refreshedRemote, targetPath, component, context.componentEnvironment);
1365
+ upsertLockFromRemote(context, refreshedRemote, targetPath, component, context.componentEnvironment);
1365
1366
  if (!configurationChanged && !elementsChanged) {
1366
1367
  const result = {
1367
1368
  status: 'skipped',
@@ -1425,7 +1426,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
1425
1426
  export async function pushAllComponents(context, options) {
1426
1427
  const { cwd, println } = context;
1427
1428
  const root = getWorkspaceRoot(cwd);
1428
- const identity = resolveComponentIdentity(cwd);
1429
+ const identity = resolveComponentIdentity(context);
1429
1430
  const prunePlan = options.prune ? await buildComponentPlan(context, undefined, false, true) : null;
1430
1431
  const pruneCandidates = prunePlan?.items.filter((item) => item.status === 'delete') || [];
1431
1432
  const pruneBlockers = prunePlan?.items.filter((item) => item.blocked && item.localHash === null) || [];
@@ -1560,7 +1561,7 @@ export async function buildComponentPlan(context, scope = { enabled: false, base
1560
1561
  const projectRoot = getProjectRoot(context.cwd);
1561
1562
  const lock = readComponentLock(projectRoot);
1562
1563
  const root = getWorkspaceRoot(context.cwd);
1563
- const identity = resolveComponentIdentity(context.cwd);
1564
+ const identity = resolveComponentIdentity(context);
1564
1565
  const localCatalog = buildLocalComponentCatalog(context.cwd, identity, prune);
1565
1566
  const { components } = await fetchAllComponentSummaries(context);
1566
1567
  const remoteCatalog = await buildRemoteComponentCatalog(context, identity, components);
@@ -2049,7 +2050,7 @@ export async function handleComponentCommand(context) {
2049
2050
  throw new Error('Component push --prune requires --yes --force.');
2050
2051
  }
2051
2052
  if (context.componentEnvironment && ['pull', 'plan', 'push'].includes(subcommand)) {
2052
- const identity = resolveComponentIdentity(context.cwd);
2053
+ const identity = resolveComponentIdentity(context);
2053
2054
  if (identity.mode !== 'stableKey') {
2054
2055
  throw new Error('Component sync with a named project requires componentIdentity.mode "stableKey". Configure it in .revoengine/revo.json before pulling from a named project.');
2055
2056
  }
@@ -2133,7 +2134,7 @@ export async function handleComponentCommand(context) {
2133
2134
  if (manifests.length === 0) {
2134
2135
  throw new Error(`Unable to find local component for ${targets.join(', ')}.`);
2135
2136
  }
2136
- const identity = resolveComponentIdentity(context.cwd);
2137
+ const identity = resolveComponentIdentity(context);
2137
2138
  const hasManagedManifest = manifests.some((manifestPath) => (Boolean(readComponentIdentityValue(readWorkspaceComponent(manifestPath), identity))));
2138
2139
  const remoteCatalog = identity.mode === 'stableKey' && hasManagedManifest
2139
2140
  ? await buildRemoteComponentCatalog(context, identity)
@@ -584,6 +584,16 @@ export async function handlePullCommand(context) {
584
584
  continue;
585
585
  }
586
586
  context.println(`${resource}: pulled ${summary.pulled}, pruned ${summary.pruned}, skipped ${summary.skipped}.`);
587
+ if (resource === 'component') {
588
+ for (const skipped of result.results.components || []) {
589
+ if (skipped.status !== 'skipped') {
590
+ continue;
591
+ }
592
+ printSyncStatus(context.println, {
593
+ status: 'Skipped', direction: 'pull', targetPath: skipped.targetPath, reason: skipped.reason,
594
+ });
595
+ }
596
+ }
587
597
  if (resource === 'job-template') {
588
598
  for (const skipped of result.results.jobTemplates?.skipped || []) {
589
599
  printSyncStatus(context.println, {
@@ -1,16 +1,50 @@
1
- export type BrowserAction = 'navigate' | 'dom' | 'screenshot';
2
- export declare function browserUrl(value: string): string;
3
- export declare function localBrowserUrl(value: string): string;
4
- export declare function runBrowserAction(input: {
1
+ export type BrowserAction = 'navigate' | 'dom' | 'click' | 'fill' | 'check' | 'select' | 'press' | 'scroll' | 'wait_for' | 'screenshot';
2
+ export type BrowserCapture = 'viewport' | 'full_page' | 'element' | 'crop';
3
+ export type BrowserClip = {
4
+ x: number;
5
+ y: number;
6
+ width: number;
7
+ height: number;
8
+ };
9
+ export type BrowserActionInput = {
5
10
  url: string;
6
11
  action: BrowserAction;
7
12
  workspace: string;
13
+ browserSessionId: string;
8
14
  selector?: string | null;
9
15
  width?: number;
10
16
  height?: number;
17
+ value?: string;
18
+ checked?: boolean;
19
+ key?: string;
20
+ deltaY?: number;
21
+ state?: 'visible' | 'hidden';
22
+ waitTimeoutMs?: number;
23
+ capture?: BrowserCapture;
24
+ clip?: BrowserClip;
11
25
  localOnly?: boolean;
26
+ networkAccessExpiresAt?: number | null;
27
+ networkAccessOnce?: boolean;
12
28
  signal?: AbortSignal;
13
- }): Promise<{
29
+ onActionAttempt?: () => void;
30
+ };
31
+ export type BrowserActionResult = {
14
32
  dom: string;
33
+ pageUrl: string;
15
34
  screenshotPath?: string;
16
- }>;
35
+ };
36
+ export declare function browserUrl(value: string): string;
37
+ export declare function localBrowserUrl(value: string): string;
38
+ export declare function validateBrowserActionInput(input: BrowserActionInput): void;
39
+ export declare function closeBrowserSessions(): Promise<void>;
40
+ export declare function hasBrowserSessions(): boolean;
41
+ export declare function writePrivateScreenshot(file: string, bytes: Buffer): void;
42
+ export declare function runBrowserAction(input: BrowserActionInput): Promise<BrowserActionResult>;
43
+ export declare function fillBrowserSecret(input: {
44
+ browserSessionId: string;
45
+ origin: string;
46
+ selector: string;
47
+ value: string;
48
+ expiresAt: number;
49
+ isAuthorized?: () => boolean;
50
+ }): Promise<void>;