@revoengine/cli 1.0.23 → 1.0.25

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/README.md CHANGED
@@ -94,7 +94,7 @@ revo terminal disconnect --workspace "$HOME/projects/my-project" --name "Work Ma
94
94
 
95
95
  Stop the foreground runner before installing its service. The service starts at login, reconnects automatically, and pins the selected terminal UUID and project profile at installation. Multiple terminals can share one machine and workspace when they have distinct names; pass the same `--name` to `connect`, `service install|uninstall`, and `disconnect`. Without `--name`, the CLI uses the machine hostname. If two registrations have the same name, the CLI refuses an ambiguous choice; use `revo terminal status` to find the UUID and pass `--terminal-id <uuid>`. A legacy workspace service must be uninstalled before installing a terminal-specific service. Uninstall stops the selected service but keeps its grant and local registration. `disconnect` stops/removes the selected terminal-specific service, revokes its grant and removes its local credential. Uninstall a legacy workspace service first so it cannot affect a different terminal. 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.
96
96
 
97
- The runner retries temporary API startup failures and WebSocket outages without a retry-count limit, using exponential backoff capped at 30 seconds with jitter. Startup reads have a 30-second request deadline; pairing and other writes are not automatically repeated. Ctrl+C or SIGTERM interrupts both a pending API request and a reconnect wait. Realtime restarts and Cloud Run connection timeouts renew transport without revoking the device. A newly supported ACL-change renewal immediately stops work under the old connection and reconnects against the current approved grant; it never extends the old command permission. Older runners stop on that change and need restarting. Actual grant/account/API-key revocation, expiration or invalid frames stop the runner; background services do not restart these deliberate security cutoffs. Availability has no fixed 30-day runner expiry, but depends on the machine, network, valid credentials and supervisor remaining available. An outage longer than the three-minute recovery window stops existing processes and Browser sessions; the runner continues reconnecting afterward.
97
+ The runner retries temporary API startup failures and WebSocket outages without a retry-count limit, using exponential backoff capped at 30 seconds with jitter. Startup reads have a 30-second request deadline; pairing and other writes are not automatically repeated. Ctrl+C or SIGTERM interrupts both a pending API request and a reconnect wait. Realtime restarts and Cloud Run connection timeouts renew transport without revoking the device. A newly supported ACL-change renewal immediately stops work under the old connection and reconnects against the current approved grant; it never extends the old command permission. Older runners stop on that change and need restarting. Actual grant/account/API-key revocation, expiration or invalid frames stop the runner; background services do not restart these deliberate security cutoffs. Availability has no fixed 30-day runner expiry, but depends on the machine, network, valid credentials and supervisor remaining available. An outage longer than the two-minute (120-second) recovery window stops existing processes and Browser sessions; the runner continues reconnecting afterward.
98
98
 
99
99
  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.
100
100
 
@@ -104,7 +104,7 @@ The Agent terminal has independent command and network grants. Grants are ceilin
104
104
 
105
105
  Browser actions use Playwright's Chromium headless shell. The CLI's npm install downloads that browser into Playwright's per-user cache without requiring Python 3; 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`.
106
106
 
107
- On macOS, workspace commands may use Unix-domain sockets only inside their own private temporary directory. This lets build tools exchange worker messages without enabling IP networking or access to workspace, other-command or host-service sockets. Local development servers still need Local network access and must bind to localhost. Ordinary process deadlines cover the whole lifetime, not startup. The runner advertises `background_shell_v1`: `terminal.start` with `background=true` and `timeout_ms=null` keeps a dev server or watcher on the existing execution ID without the ordinary lifetime timer. Status, output, stdin, PTY and cancel remain available; hiding the terminal view does not stop the process. Scope expiry, revocation, runner stop and the three-minute disconnect grace still apply. Reuse a healthy project server or check fresh HTTP readiness after starting it.
107
+ On macOS, workspace commands may use Unix-domain sockets only inside their own private temporary directory. This lets build tools exchange worker messages without enabling IP networking or access to workspace, other-command or host-service sockets. Local development servers still need Local network access and must bind to localhost. Ordinary process deadlines cover the whole lifetime, not startup. The runner advertises `background_shell_v1`: `terminal.start` with `background=true` and `timeout_ms=null` keeps a dev server or watcher on the existing execution ID without the ordinary lifetime timer. Status, output, stdin, PTY and cancel remain available; hiding the terminal view does not stop the process. Scope expiry, revocation, runner stop and the two-minute (120-second) disconnect grace still apply. Reuse a healthy project server or check fresh HTTP readiness after starting it.
108
108
 
109
109
  The terminal approval UI supports Allow once, Allow for 15 minutes, Allow for 1 hour, Allow for 8 hours, Allow for 24 hours and Allow for this thread. Whole-thread access requires this runner's `terminal_thread_scope_v1` capability. It covers only the requested Commands and Network levels, survives later messages and short reconnects, and carries no hourly deadline. Disconnect, thread deletion and a device grant revision change revoke it. Realtime rechecks the consent on heartbeat, including idle Browser contexts; scope revocation closes only the affected context. Process `background` mode and the one-hour Browser idle retention are independent of this approval duration.
110
110
 
@@ -117,7 +117,7 @@ The Browser bridge advertises `browser_timeout_v1`. Agent calls can set `action_
117
117
 
118
118
  The saved `agentTerminalId` identifies the device across terminal restarts. `deviceId` is an alias. Connecting another directory with the same profile and terminal name reuses the saved device secret and registers a pending workspace under that device. Approve its access in AI Agents → Terminals → Workspaces. A running device refreshes its contract; it does not need a second runner. Ambiguous older duplicate registrations require `--terminal-id`. Services remain pinned to the device UUID and original service directory.
119
119
 
120
- Current runners advertise `terminal_workspaces_v1`, `browser_control_v1` and `file_transfer_v1`. Gateway can request socket reconnect without stopping the CLI. Temporary transport/dependency failures retry and resume within three minutes; authentication failures and revocation stop retry. Newly installed services stop on fatal authentication and restart other failed processes. Reinstall existing services to adopt that supervisor behavior. CLI stop does not persist local processes or browser cookies. Changing workspace grant revision conservatively terminates workspace-bound work and contexts.
120
+ Current runners advertise `terminal_workspaces_v1`, `browser_control_v1`, `file_transfer_v1` and `terminal_resume_durable_v1`. When Realtime confirms durable resume support, output is retained until the server acknowledges its PostgreSQL commit; reconnect resumes the same execution from the last committed output sequence. Redis loss alone does not stop the PTY. Older servers remain compatible without advertising durable recovery. This protocol preserves a running CLI process; it does not restore processes after a CLI or machine crash. Gateway can request socket reconnect without stopping the CLI. Temporary transport/dependency failures retry and resume within two minutes (120 seconds); authentication failures and revocation stop retry. Newly installed services stop on fatal authentication and restart other failed processes. Reinstall existing services to adopt that supervisor behavior. CLI stop does not persist local processes or browser cookies. Changing workspace grant revision conservatively terminates workspace-bound work and contexts.
121
121
 
122
122
  Browser inventory exposes its owning chat and workspace. The model can explicitly close permitted same-actor sessions/tabs to free the four-session/sixteen-tab capacity; active sessions are never silently evicted. Inventory/cleanup preserves the existing network lease. Local/full scope changes recreate the browser context and require browser workflow recovery.
123
123
 
@@ -125,7 +125,7 @@ Browser inventory exposes its owning chat and workspace. The model can explicitl
125
125
 
126
126
  Interactive PTY commands use the optional native `node-pty` package. An unavailable native build does not block CLI installation; PTY requests return `pty_unavailable` until the optional package can be installed. To skip native installation when PTY is not needed, install locally with `npm install --omit=optional @revoengine/cli` and run `npx revo`; npm 11.9 may still install the optional dependency during a global installation. On macOS, the runner verifies the spawn helper's executable permission when a PTY starts. Ordinary commands and local development servers run with pipes.
127
127
 
128
- 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 when the current permanent grant does not cover it, including before a queued secure credential fill. A lost WebSocket connection, a controlled Realtime restart, or a temporary dependency outage retains running processes and Browser contexts for one three-minute reconnect period; repeated failures do not renew it. Receiving `ready` alone does not reset that period while executions still await resume confirmation. Handshake, ready and execution resume each have a ten-second transport deadline. Access revocation and malformed runner frames stop the runner and its processes. Grant revision changes reject older execute frames and stop only work outside the remaining permanent or temporary scope. A network upgrade preserves the original temporary lease for a subsequent downgrade.
128
+ 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 when the current permanent grant does not cover it, including before a queued secure credential fill. A lost WebSocket connection, a controlled Realtime restart, or a temporary dependency outage retains running processes and Browser contexts for one two-minute (120-second) reconnect period; repeated failures do not renew it. Receiving `ready` alone does not reset that period while executions still await resume confirmation. Handshake, ready and execution resume each have a ten-second transport deadline. Access revocation and malformed runner frames stop the runner and its processes. Grant revision changes reject older execute frames and stop only work outside the remaining permanent or temporary scope. A network upgrade preserves the original temporary lease for a subsequent downgrade.
129
129
 
130
130
  `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.
131
131
 
@@ -331,9 +331,9 @@ The planner lists exact target IDs, names and Stable Keys in deletion order. Dup
331
331
 
332
332
  All other deletions run after upserts and their readback verification, allowing a retained Job Template or Endpoint to move to a replacement Component. Pruning removes obsolete consumers before dependencies. API errors or failed readback stop further deletes; a failed early delete prevents upserts, and a failed upsert prevents the remaining prune. Early deletions can remain applied if a later write fails, so review both deletion phases before approval. The owning APIs retain their existing permission and reference guards and soft-delete semantics, including the table subtree lifecycle and view automation deactivation. Root deletion is blocked by any retained or unmanaged partition. No arbitrary implicit consumer cleanup is performed.
333
333
 
334
- `plan --out <file>` saves the plan without mutation or lock changes. `deploy --reviewed-plan <file>` requires `--prune` and compares the saved deletion list, timing (`beforeUpserts: true` where required), revisions, authenticated instance and tracked scope with the live plan before any write. Regenerate reviewed plans saved by older CLI versions for replacements that now require early deletion. Each early deletion rechecks the remaining Job Template/Event/Schedule graph. Upserts are followed by another live comparison of the remaining prune plan. Each deletion rechecks identity and definition, verifies disappearance from the active catalog and clears only the selected target baseline; verified partition deletion retains its lock tombstone. Cascading table/view operations additionally recheck the remaining dependency graph. Plans are advisory, not an atomic server-side transaction: concurrent edits can still cause API rejection or partial progress. A fresh plan is required after target drift or a failed partial deployment.
334
+ `plan --out <file>` saves the plan without mutation or lock changes. `deploy --reviewed-plan <file>` requires `--prune` and fences the whole reviewed deployment: desired and target definition hashes for every tracked family (including noops), managed target identities, versions and activation, authenticated instance, policy, tracked scope, and the deletion list with its timing (`beforeUpserts: true` where required). Drift or an older artifact without `reviewedPlanVersion: 1` blocks all writes and requires a fresh reviewed plan. The same comparison runs again after confirmation. Component writes retain the reviewed target identity, hash and version through execution: metadata and element saves obtain API mutation reviews and send their tokens in `x-revo-mutation-review`. A later version change, unavailable review route, or malformed review stops the deployment instead of refreshing the expected version or forcing the write. Regenerate reviewed plans saved by older CLI versions for replacements that now require early deletion. Each early deletion rechecks the remaining Job Template/Event/Schedule graph. Upserts are followed by another live comparison of the remaining prune plan. Each deletion rechecks identity and definition, verifies disappearance from the active catalog and clears only the selected target baseline; verified partition deletion retains its lock tombstone. Cascading table/view operations additionally recheck the remaining dependency graph. Deployment remains a sequence of API operations, not one server-side transaction: concurrent edits can cause a guarded rejection after earlier verified writes. Metadata and elements are separate guarded writes; the elements expect only the version increment made by this deployment. Readback verifies the accepted result but never authorizes overwriting newer target changes. A fresh plan is required after target drift or a failed partial deployment.
335
335
 
336
- `deploy` always shows the plan before interactive confirmation; `--yes` supplies noninteractive approval. Ordinary resource rows, field names, dependency hints and metadata use one line per item. Field/value diffs, list changes and code/SQL diffs retain multiline Git-style formatting. `revo version --json` advertises `workspacePrune` and `reviewedPrunePlan` so CI can reject older releases that ignore unknown flags. Without `--prune`, repository deployment remains upsert-only.
336
+ `deploy` always shows the plan before interactive confirmation; `--yes` supplies noninteractive approval. Ordinary resource rows, field names, dependency hints and metadata use one line per item. Field/value diffs, list changes and code/SQL diffs retain multiline Git-style formatting. `revo version --json` advertises `workspacePrune`, `reviewedPrunePlan`, `reviewedDeploymentPlan` and `componentMutationReview` so CI can reject older releases that ignore unknown flags. Without `--prune`, repository deployment remains upsert-only.
337
337
 
338
338
  Component-only reconciliation remains available through `revo component plan --all --prune` and `revo component push --all --prune --yes`; interactive confirmation is also supported. This matches the configured identity, rechecks local reappearance and live target drift, verifies deletion and clears only the selected environment baseline. `--force` is not required for explicit Component pruning. Named `migrate` and legacy `env apply` retain their existing scope and confirmation rules; `migrate --prune` is rejected.
339
339
 
@@ -548,7 +548,7 @@ Traces retain only known static API route segments, method, status, timing, payl
548
548
 
549
549
  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.
550
550
 
551
- 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.
551
+ Safe HTTP reads (`GET`, `HEAD`, `OPTIONS`), including plan/deploy inventory reads, default to two retries, for up to three attempts. Transport or response-read errors and HTTP 429, 500, 502, 503 and 504 can be retried; validation, permission and version-conflict responses are not. Mutations default to no transport retries, so an uncertain write is not automatically replayed. Explicit client/request retry budgets, including zero, take precedence; there is no global retry flag. Aborted requests are not retried. Backoff starts at 100 ms with jitter, respects a bounded numeric `Retry-After`, releases the transport queue slot while waiting, and shares one request timeout across attempts. Existing mutation-specific opt-ins and fresh live validation remain responsible for their own recovery.
552
552
 
553
553
  ## Update notifications
554
554
 
package/dist/src/cli.js CHANGED
@@ -198,7 +198,7 @@ async function runMain(args, argv) {
198
198
  const command = args._[0];
199
199
  const noPositionals = args._.length === 0;
200
200
  if (command === 'version' || ((args.version !== undefined || args.V !== undefined) && noPositionals)) {
201
- print(args.json ? { version: packageVersion, capabilities: { workspacePrune: true, reviewedPrunePlan: true } } : packageVersion);
201
+ print(args.json ? { version: packageVersion, capabilities: { workspacePrune: true, reviewedPrunePlan: true, reviewedDeploymentPlan: true, componentMutationReview: true } } : packageVersion);
202
202
  return;
203
203
  }
204
204
  if (command === 'info' || ((args.i === true || args.info === true) && noPositionals)) {
@@ -365,7 +365,7 @@ export declare class RevoClient {
365
365
  environmentName: string;
366
366
  fetchImpl: typeof fetch | undefined;
367
367
  private trustedServiceOrigins;
368
- private maxRetries;
368
+ private readonly maxRetries;
369
369
  private retryDelayMs;
370
370
  private requestQueue;
371
371
  constructor(options?: ClientOptions);
@@ -445,7 +445,8 @@ export declare class RevoClient {
445
445
  }>;
446
446
  getComponent(componentId: string, options?: Pick<RequestOptions, 'timeoutMs'>): Promise<unknown>;
447
447
  createComponent(body: unknown): Promise<unknown>;
448
- updateComponent(componentId: string, body: unknown): Promise<unknown>;
448
+ reviewComponent(componentId: string, body: unknown): Promise<unknown>;
449
+ updateComponent(componentId: string, body: unknown, expectedToken?: string): Promise<unknown>;
449
450
  deleteComponent(componentId: string): Promise<ApiResponse<unknown>>;
450
451
  deleteWorkspaceResource(resource: TrackableResourceType, id: string): Promise<unknown>;
451
452
  private accountForSync;
@@ -522,7 +523,8 @@ export declare class RevoClient {
522
523
  deleteRoleGroup(roleGroupId: string): Promise<ApiResponse<unknown>>;
523
524
  listSystemRoles(): Promise<unknown>;
524
525
  listAllSystemRoles(): Promise<SystemRoleRecord[]>;
525
- saveComponentElements(componentId: string, body: unknown): Promise<ApiResponse<unknown>>;
526
+ reviewComponentElements(componentId: string, body: unknown): Promise<unknown>;
527
+ saveComponentElements(componentId: string, body: unknown, expectedToken?: string): Promise<ApiResponse<unknown>>;
526
528
  }
527
529
  export { COMPONENT_LIST_PAGE_SIZE };
528
530
  export { buildUrl, normalizeToken };
@@ -419,7 +419,7 @@ export class RevoClient {
419
419
  this.environmentName = options.environmentName || options.envName || '';
420
420
  this.fetchImpl = options.fetch || globalThis.fetch;
421
421
  this.trustedServiceOrigins = resolveTrustedServiceOrigins(options.trustedServiceOrigins);
422
- this.maxRetries = options.maxRetries ?? 0;
422
+ this.maxRetries = options.maxRetries;
423
423
  this.retryDelayMs = options.retryDelayMs ?? 100;
424
424
  this.requestQueue = options.requestQueue || currentRequestQueue() || new RequestQueue();
425
425
  }
@@ -524,9 +524,10 @@ export class RevoClient {
524
524
  body: options.sensitiveAccountPayload ? '[account payload omitted]' : body,
525
525
  context: this.environmentName ? { environment: this.environmentName } : undefined,
526
526
  });
527
- const maxRetries = options.maxRetries ?? this.maxRetries;
528
- const baseRetryDelay = options.retryDelayMs ?? this.retryDelayMs;
529
527
  const normalizedMethod = method.toUpperCase();
528
+ const safeRead = ['GET', 'HEAD', 'OPTIONS'].includes(normalizedMethod);
529
+ const maxRetries = options.maxRetries ?? this.maxRetries ?? (safeRead ? 2 : 0);
530
+ const baseRetryDelay = options.retryDelayMs ?? this.retryDelayMs;
530
531
  spinner.start();
531
532
  try {
532
533
  let lastError;
@@ -1175,9 +1176,13 @@ export class RevoClient {
1175
1176
  spinnerLabel: 'Creating component',
1176
1177
  });
1177
1178
  }
1178
- async updateComponent(componentId, body) {
1179
+ async reviewComponent(componentId, body) {
1180
+ return this.requestData('POST', `/api/v1/component/${componentId}/review`, { body });
1181
+ }
1182
+ async updateComponent(componentId, body, expectedToken) {
1179
1183
  return this.requestData('PUT', `/api/v1/component/${componentId}`, {
1180
1184
  body,
1185
+ ...(expectedToken ? { headers: { 'x-revo-mutation-review': expectedToken } } : {}),
1181
1186
  spinnerLabel: 'Updating component',
1182
1187
  });
1183
1188
  }
@@ -1654,8 +1659,14 @@ export class RevoClient {
1654
1659
  async listAllSystemRoles() {
1655
1660
  return unwrapList(await this.listSystemRoles()).filter(isRecord);
1656
1661
  }
1657
- async saveComponentElements(componentId, body) {
1658
- return this.request('POST', `/api/v1/component/${componentId}/save`, { body });
1662
+ async reviewComponentElements(componentId, body) {
1663
+ return this.requestData('POST', `/api/v1/component/${componentId}/save/review`, { body });
1664
+ }
1665
+ async saveComponentElements(componentId, body, expectedToken) {
1666
+ return this.request('POST', `/api/v1/component/${componentId}/save`, {
1667
+ body,
1668
+ ...(expectedToken ? { headers: { 'x-revo-mutation-review': expectedToken } } : {}),
1669
+ });
1659
1670
  }
1660
1671
  }
1661
1672
  export { COMPONENT_LIST_PAGE_SIZE };
@@ -438,6 +438,16 @@ function componentSourceHash(component, identity) {
438
438
  ? hashPortableComponentSource(component)
439
439
  : hashComponentSource(component);
440
440
  }
441
+ function componentReviewToken(response, componentId, expectedVersion, targetPath) {
442
+ const review = isRecord(response) && isRecord(response.data) ? response.data : response;
443
+ if (!isRecord(review) || review.kind !== 'mutation_review' || review.schemaVersion !== 1
444
+ || !isRecord(review.target) || review.target.refId !== componentId || review.target.refType !== 'COMPONENTS'
445
+ || !Number.isSafeInteger(expectedVersion) || review.baseVersion !== expectedVersion
446
+ || typeof review.token !== 'string' || !review.token) {
447
+ throw new Error(`Cannot push ${targetPath}: target changed since the reviewed version or the API lacks mutation review support; run plan again.`);
448
+ }
449
+ return review.token;
450
+ }
441
451
  function writeComponentPushVerificationLog(input) {
442
452
  const outputDir = path.join(input.cwd, '.revoengine', 'logs', 'component-push');
443
453
  const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
@@ -1165,6 +1175,15 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
1165
1175
  }
1166
1176
  try {
1167
1177
  const remote = await resolveRemoteComponentForLocal(context, component, identity, resolvedRemoteCatalog);
1178
+ if (context.componentReview) {
1179
+ const reviewed = context.componentReview.get(identityKey);
1180
+ if (!reviewed || componentSourceHash(component, identity) !== reviewed.localHash
1181
+ || (remote ? componentSourceHash(remote, identity) : null) !== reviewed.remoteHash
1182
+ || (remote ? componentIdOf(remote) : undefined) !== reviewed.remoteComponentId
1183
+ || (remote ? componentVersion(remote) : null) !== reviewed.remoteVersion) {
1184
+ throw new Error(`Cannot push ${targetPath}: component changed after the deployment plan was reviewed; run plan again.`);
1185
+ }
1186
+ }
1168
1187
  if (!remote) {
1169
1188
  if (identity.mode === 'stableKey') {
1170
1189
  const created = unwrapComponent(await client.createComponent(buildComponentCreatePayload(component, identity)));
@@ -1294,12 +1313,22 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
1294
1313
  return result;
1295
1314
  }
1296
1315
  let configurationChanged = false;
1316
+ let expectedSaveVersion = componentVersion(remote);
1297
1317
  const operations = {};
1298
1318
  let errorOperationId;
1299
1319
  if (portableDiff.configurationFields.length > 0) {
1300
1320
  try {
1301
- await client.updateComponent(remoteComponentId, buildPortableComponentUpdatePayload(component, remote, portableDiff.configurationFields));
1321
+ const body = buildPortableComponentUpdatePayload(component, remote, portableDiff.configurationFields);
1322
+ if (context.componentReview) {
1323
+ const token = componentReviewToken(await client.reviewComponent(remoteComponentId, body), remoteComponentId, expectedSaveVersion, targetPath);
1324
+ await client.updateComponent(remoteComponentId, body, token);
1325
+ }
1326
+ else {
1327
+ await client.updateComponent(remoteComponentId, body);
1328
+ }
1302
1329
  configurationChanged = true;
1330
+ if (expectedSaveVersion !== null)
1331
+ expectedSaveVersion += 1;
1303
1332
  operations.configurationUpdate = { outcome: 'accepted' };
1304
1333
  }
1305
1334
  catch (error) {
@@ -1326,7 +1355,13 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
1326
1355
  if (portableDiff.elementsChanged) {
1327
1356
  try {
1328
1357
  const elements = buildPushElements(component, remote, identity);
1329
- const response = await client.saveComponentElements(remoteComponentId, elements);
1358
+ let expectedToken;
1359
+ if (context.componentReview) {
1360
+ expectedToken = componentReviewToken(await client.reviewComponentElements(remoteComponentId, elements), remoteComponentId, expectedSaveVersion, targetPath);
1361
+ }
1362
+ const response = expectedToken
1363
+ ? await client.saveComponentElements(remoteComponentId, elements, expectedToken)
1364
+ : await client.saveComponentElements(remoteComponentId, elements);
1330
1365
  elementsChanged = response.status !== 304;
1331
1366
  const operationId = readRevoOperationId(response.headers);
1332
1367
  errorOperationId = operationId || errorOperationId;
@@ -2,6 +2,7 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { normalizeStableKeyValue } from "../resource-metadata.js";
4
4
  import { samePrunePlan } from "../workspace-prune.js";
5
+ import { sameReviewedPlan } from "../reviewed-plan.js";
5
6
  import { schemaItemAction, viewItemAction, componentItemAction, jobTemplateItemAction, endpointItemAction, scheduleItemAction, eventItemAction, groupItemAction, roleGroupItemAction, } from "../migration-actions.js";
6
7
  import { DEFAULT_ENV_NAME } from "../config.js";
7
8
  import { buildMigrationPlan, pullResourcesToWorkspace, runMigration, } from "../migration.js";
@@ -568,6 +569,9 @@ export async function handleDeployCommand(context) {
568
569
  || !samePrunePlan(reviewed.prune, preview.prune)) {
569
570
  throw new Error('Reviewed deletion plan does not match this instance, resource scope or live target; run plan again.');
570
571
  }
572
+ if (!sameReviewedPlan(reviewed, preview)) {
573
+ throw new Error('Reviewed deployment plan does not match the workspace or live target; run plan again and review it before deploying.');
574
+ }
571
575
  }
572
576
  // Interactive confirmation must always expose the plan, including JSON mode.
573
577
  if (!readBoolFlag(context.args, ['json']))
@@ -578,7 +582,7 @@ export async function handleDeployCommand(context) {
578
582
  throw new Error(`Deployment plan is blocked by ${preview.blockers.length} issue(s).`);
579
583
  await confirmDeploy(context);
580
584
  const startedAt = Date.now();
581
- const result = await runMigration({ ...input, reviewedPrune: preview.prune });
585
+ const result = await runMigration({ ...input, reviewedPrune: preview.prune, reviewedPlan: preview });
582
586
  if (readBoolFlag(context.args, ['json'])) {
583
587
  context.print({ ...result, command: 'deploy' });
584
588
  }
@@ -0,0 +1,16 @@
1
+ export type TerminalOutputChunk = {
2
+ sequence: number;
3
+ stream: 'stdout' | 'stderr';
4
+ text: string;
5
+ };
6
+ /** Only a committed server ACK removes output. Sequence identity survives buffer pruning. */
7
+ export declare class TerminalOutputBuffer {
8
+ private readonly chunks;
9
+ private sequence;
10
+ private acknowledged;
11
+ get lastSequence(): number;
12
+ get lastAcknowledged(): number;
13
+ append(stream: TerminalOutputChunk['stream'], text: string): TerminalOutputChunk;
14
+ acknowledge(sequence: unknown): boolean;
15
+ pending(): readonly TerminalOutputChunk[];
16
+ }
@@ -0,0 +1,24 @@
1
+ /** Only a committed server ACK removes output. Sequence identity survives buffer pruning. */
2
+ export class TerminalOutputBuffer {
3
+ chunks = [];
4
+ sequence = 0;
5
+ acknowledged = 0;
6
+ get lastSequence() { return this.sequence; }
7
+ get lastAcknowledged() { return this.acknowledged; }
8
+ append(stream, text) {
9
+ const chunk = { sequence: ++this.sequence, stream, text };
10
+ this.chunks.push(chunk);
11
+ return chunk;
12
+ }
13
+ acknowledge(sequence) {
14
+ if (!Number.isSafeInteger(sequence) || sequence < 0 || sequence > this.sequence)
15
+ return false;
16
+ if (sequence <= this.acknowledged)
17
+ return true;
18
+ this.acknowledged = sequence;
19
+ while (this.chunks.length && this.chunks[0].sequence <= this.acknowledged)
20
+ this.chunks.shift();
21
+ return true;
22
+ }
23
+ pending() { return this.chunks; }
24
+ }
@@ -5,7 +5,7 @@ export class TerminalReconnectGrace {
5
5
  delayMs;
6
6
  scheduleTimer;
7
7
  clearTimer;
8
- constructor(onExpire, delayMs = 180_000, scheduleTimer = setTimeout, clearTimer = clearTimeout) {
8
+ constructor(onExpire, delayMs = 120_000, scheduleTimer = setTimeout, clearTimer = clearTimeout) {
9
9
  this.onExpire = onExpire;
10
10
  this.delayMs = delayMs;
11
11
  this.scheduleTimer = scheduleTimer;
@@ -15,6 +15,7 @@ import { transferWorkspaceFile, validateFileTransfer } from "./terminal-file.js"
15
15
  import { uploadWorkspaceImages } from "./terminal-image.js";
16
16
  import { ensurePtyHelperExecutable, normalizePtyStartError } from "./terminal-pty.js";
17
17
  import { TerminalReconnectGrace, TerminalTransportRecovery, isRunnerTransportHeartbeat } from "./terminal-reconnect-grace.js";
18
+ import { TerminalOutputBuffer } from "./terminal-output-buffer.js";
18
19
  import { TerminalOperationalLog } from "./terminal-operational-log.js";
19
20
  import { createSecureBrowserIdentity, decryptSecureBrowserInput } from "./terminal-secure-browser.js";
20
21
  class TerminalRunnerFatalError extends Error {
@@ -370,7 +371,7 @@ export function boundResultFrame(frame) {
370
371
  return bounded;
371
372
  }
372
373
  function sendResult(socket, frame) {
373
- send(socket, boundResultFrame(frame));
374
+ send(socket, boundResultFrame({ lastOutputSequence: 0, ...frame }));
374
375
  }
375
376
  export async function runCommand(input, onDone, onChunk) {
376
377
  const workdir = resolveWorkspaceDirectory(input.workspace, input.workdir);
@@ -656,11 +657,14 @@ async function connect(profile, device) {
656
657
  let stopping = false;
657
658
  let activeSocket;
658
659
  let activeConnectionId = '';
660
+ let durableOutput = false;
659
661
  const activeChildren = new Set();
660
662
  const children = new Map();
661
663
  const activePolicies = new Map();
662
664
  const cancelledExecutions = new Set();
663
665
  const outputByExecution = new Map();
666
+ const retiredExecutions = new Map();
667
+ let nextRetiredSweep = 0;
664
668
  const completed = new Map();
665
669
  const traces = new Map();
666
670
  const secureRequests = new Map();
@@ -697,13 +701,14 @@ async function connect(profile, device) {
697
701
  const sendCurrent = (frame) => {
698
702
  if (activeConnectionId && activeSocket?.readyState === WebSocket.OPEN)
699
703
  send(activeSocket, frame.type === 'result'
700
- ? boundResultFrame({ ...frame, connectionId: activeConnectionId })
704
+ ? boundResultFrame({ ...frame, connectionId: activeConnectionId,
705
+ ...(durableOutput ? { lastOutputSequence: outputByExecution.get(String(frame.executionId))?.lastSequence ?? 0 } : {}) })
701
706
  : { ...frame, connectionId: activeConnectionId });
702
707
  };
703
708
  const flushExecution = (executionId) => {
704
709
  if (!resumed.has(executionId))
705
710
  return;
706
- for (const chunk of outputByExecution.get(executionId) || [])
711
+ for (const chunk of outputByExecution.get(executionId)?.pending() || [])
707
712
  sendCurrent({ type: 'output', executionId, ...chunk });
708
713
  const result = completed.get(executionId);
709
714
  if (result)
@@ -745,7 +750,7 @@ async function connect(profile, device) {
745
750
  reconnectGrace.clear();
746
751
  });
747
752
  socket.on('open', () => send(socket, { type: 'hello', protocol: 1, agentTerminalId: device.agentTerminalId,
748
- secret: device.secret, capabilities: ['grant_refresh_v1', 'workspace_sandbox_v1', 'workspace_network_v1', 'network_policy_v1',
753
+ secret: device.secret, capabilities: ['terminal_resume_durable_v1', 'grant_refresh_v1', 'workspace_sandbox_v1', 'workspace_network_v1', 'network_policy_v1',
749
754
  'terminal_policy_v2', 'terminal_policy_selective_v1', 'background_shell_v1', 'terminal_thread_scope_v1',
750
755
  'apply_patch_v1', 'stdin_v1', 'pty_v1', 'browser_v1', 'browser_session_v1', 'browser_forms_v1',
751
756
  'browser_local_v1', 'browser_once_v1', 'browser_secure_input_v1', 'browser_tabs_v1', 'save_image_v1',
@@ -778,6 +783,7 @@ async function connect(profile, device) {
778
783
  securePolicyEpoch++;
779
784
  connectionId = frame.connectionId;
780
785
  activeConnectionId = connectionId;
786
+ durableOutput = Array.isArray(frame.capabilities) && frame.capabilities.includes('terminal_resume_durable_v1');
781
787
  defaultWorkspace = frame.workspace || device.workspace;
782
788
  if (Number.isSafeInteger(frame.policyGrantRevision) && frame.policyGrantRevision >= 0) {
783
789
  minimumPolicyGrantRevision = Math.max(minimumPolicyGrantRevision, frame.policyGrantRevision);
@@ -893,7 +899,16 @@ async function connect(profile, device) {
893
899
  }
894
900
  if (frame.connectionId !== connectionId || !frame.executionId)
895
901
  return;
902
+ if (frame.type === 'output_ack') {
903
+ if (durableOutput && !outputByExecution.get(frame.executionId)?.acknowledge(frame.lastOutputSequence))
904
+ socket.terminate();
905
+ return;
906
+ }
896
907
  if (frame.type === 'resumed') {
908
+ if (durableOutput && !outputByExecution.get(frame.executionId)?.acknowledge(frame.lastOutputSequence)) {
909
+ socket.terminate();
910
+ return;
911
+ }
897
912
  recovery.accepted(frame.executionId);
898
913
  resumed.add(frame.executionId);
899
914
  flushExecution(frame.executionId);
@@ -906,6 +921,14 @@ async function connect(profile, device) {
906
921
  children.get(frame.executionId)?.terminate();
907
922
  }
908
923
  completed.delete(frame.executionId);
924
+ const now = Date.now();
925
+ retiredExecutions.set(frame.executionId, now + 65 * 60_000);
926
+ if (now >= nextRetiredSweep) {
927
+ for (const [id, expiresAt] of retiredExecutions)
928
+ if (expiresAt <= now)
929
+ retiredExecutions.delete(id);
930
+ nextRetiredSweep = now + 60_000;
931
+ }
909
932
  outputByExecution.delete(frame.executionId);
910
933
  resumed.delete(frame.executionId);
911
934
  traces.delete(frame.executionId);
@@ -943,6 +966,11 @@ async function connect(profile, device) {
943
966
  }
944
967
  if (frame.type !== 'execute')
945
968
  return;
969
+ if ((retiredExecutions.get(frame.executionId) || 0) > Date.now()) {
970
+ sendResult(socket, { type: 'result', connectionId, executionId: frame.executionId,
971
+ executed: false, stdout: '', stderr: 'execution_already_retired', exitCode: null });
972
+ return;
973
+ }
946
974
  if (policyRevisionUnavailable || !Number.isSafeInteger(frame.policyGrantRevision)
947
975
  || frame.policyGrantRevision < minimumPolicyGrantRevision) {
948
976
  sendResult(socket, { type: 'result', connectionId, executionId: frame.executionId,
@@ -1010,7 +1038,7 @@ async function connect(profile, device) {
1010
1038
  traces.set(frame.executionId, trace);
1011
1039
  operationalLog.write('INFO', trace, 'execution.started', { operation, sandbox: frame.sandbox });
1012
1040
  resumed.add(frame.executionId);
1013
- outputByExecution.set(frame.executionId, []);
1041
+ outputByExecution.set(frame.executionId, new TerminalOutputBuffer());
1014
1042
  if (operation === 'save_image' || operation === 'upload_file' || operation === 'download_file') {
1015
1043
  const controller = new AbortController();
1016
1044
  const policyDeadline = executionPolicyDeadline(frame);
@@ -1178,10 +1206,10 @@ async function connect(profile, device) {
1178
1206
  sendCurrent({ type: 'result', executionId: frame.executionId,
1179
1207
  ...completed.get(frame.executionId) });
1180
1208
  }, (stream, text) => {
1181
- const chunks = outputByExecution.get(frame.executionId) || [];
1182
- const chunk = { sequence: chunks.length + 1, stream, text };
1183
- chunks.push(chunk);
1184
- outputByExecution.set(frame.executionId, chunks);
1209
+ const buffer = outputByExecution.get(frame.executionId);
1210
+ if (!buffer)
1211
+ return;
1212
+ const chunk = buffer.append(stream, text);
1185
1213
  if (resumed.has(frame.executionId))
1186
1214
  sendCurrent({ type: 'output', executionId: frame.executionId, ...chunk });
1187
1215
  });
@@ -41,6 +41,7 @@ export type MigrationSourcePullSummary = {
41
41
  };
42
42
  export type MigrationPlan = {
43
43
  schemaVersion: 2;
44
+ reviewedPlanVersion?: 1;
44
45
  command: 'plan';
45
46
  from: string;
46
47
  to: string;
@@ -114,6 +115,7 @@ type MigrationInputBase = {
114
115
  detailedDiff?: boolean;
115
116
  prune?: boolean;
116
117
  reviewedPrune?: WorkspacePrunePlan;
118
+ reviewedPlan?: MigrationPlan;
117
119
  };
118
120
  export type MigrationInput = MigrationInputBase & ({
119
121
  sourceMode: 'workspace';
@@ -1,6 +1,7 @@
1
1
  import { AGENT_LAYOUT, buildAgentsPlan, pullAgentsToWorkspace, pushAgents } from "./resource-syncs/agent-sync.js";
2
2
  import { projectRepositoryItems, migrationItemOperation, BLOCKING_SCHEMA_STATUSES, schemaItemAction, viewItemIsBlocked, viewItemAction, componentItemAction, jobTemplateItemAction, endpointItemAction, scheduleItemAction, eventItemAction, groupItemAction, roleGroupItemAction, serviceAccountItemAction, } from "./migration-actions.js";
3
3
  import fs from 'node:fs';
4
+ import { sameReviewedPlan } from "./reviewed-plan.js";
4
5
  import { applyWorkspacePrune, buildWorkspacePrunePlan, samePrunePlan } from "./workspace-prune.js";
5
6
  import { planIdentityMigration } from "./resource-syncs/identity-migration.js";
6
7
  import { SERVICE_ACCOUNTS_DIRECTORY, buildServiceAccountsPlan, pullServiceAccountsToWorkspace, pushServiceAccounts } from "./resource-syncs/service-account-sync.js";
@@ -821,6 +822,9 @@ function componentCommandContext(input) {
821
822
  client: input.client,
822
823
  componentEnvironment: input.envName,
823
824
  componentIdentity: migrationComponentIdentity(input.cwd),
825
+ ...(input.reviewedComponents ? { componentReview: new Map(input.reviewedComponents.map(item => [item.identityKey || item.stableKey || item.componentId, { ...item,
826
+ remoteComponentId: item.remoteHash === null ? undefined : item.remoteComponentId,
827
+ remoteVersion: item.remoteHash === null ? null : item.remoteVersion }])) } : {}),
824
828
  cwd: input.cwd,
825
829
  packageVersion: 'migration',
826
830
  print: () => undefined,
@@ -1082,7 +1086,7 @@ async function planWorkspace(input) {
1082
1086
  const identities = await planIdentityMigration({ client, cwd: input.cwd, stableKeyName, resources });
1083
1087
  if (input.prune && input.sourceMode !== 'workspace')
1084
1088
  throw new Error('Prune requires repository plan/deploy; named migration remains upsert-only.');
1085
- const prune = input.prune ? await buildWorkspacePrunePlan({ cwd: input.cwd, client, resources }) : undefined;
1089
+ const prune = input.prune ? await buildWorkspacePrunePlan({ cwd: input.cwd, client, resources, captureTargets: true }) : undefined;
1086
1090
  const serviceAccounts = resources.includes('service-account')
1087
1091
  ? await runMigrationStage('target plan', 'service-account', environmentLabel, () => buildServiceAccountsPlan({ client, cwd: input.cwd, envName: environmentKey, stableKeyName,
1088
1092
  projectedIdentities: identities?.projection })) : undefined;
@@ -1182,6 +1186,7 @@ async function planWorkspace(input) {
1182
1186
  agentPlugins,
1183
1187
  agents,
1184
1188
  });
1189
+ combined.reviewedPlanVersion = 1;
1185
1190
  if (identities) {
1186
1191
  combined.identityOrder = identities.ordered.map(({ resource, stableKey }) => ({ resource, stableKey }));
1187
1192
  }
@@ -1273,6 +1278,11 @@ export async function runMigration(input) {
1273
1278
  initialPlan.readyToMigrate = false;
1274
1279
  initialPlan.verdict = 'blocked';
1275
1280
  }
1281
+ if (input.reviewedPlan && !sameReviewedPlan(input.reviewedPlan, initialPlan)) {
1282
+ initialPlan.blockers.push('Deployment state changed after confirmation; run plan again before deploying.');
1283
+ initialPlan.readyToMigrate = false;
1284
+ initialPlan.verdict = 'blocked';
1285
+ }
1276
1286
  const base = {
1277
1287
  schemaVersion: 2,
1278
1288
  command: 'run',
@@ -1393,6 +1403,7 @@ export async function runMigration(input) {
1393
1403
  envName: componentTargetEnvironment(input),
1394
1404
  client: targetClient,
1395
1405
  operation: 'push',
1406
+ ...(input.reviewedPlan ? { reviewedComponents: initialPlan.components?.items } : {}),
1396
1407
  }), { force: true, yes: true });
1397
1408
  phaseResults.component = componentResults;
1398
1409
  results.push(...componentResults);
@@ -0,0 +1,2 @@
1
+ import type { MigrationPlan } from './migration.ts';
2
+ export declare function sameReviewedPlan(reviewed: MigrationPlan, live: MigrationPlan): boolean;
@@ -0,0 +1,25 @@
1
+ import { hashStable } from "./component-lock.js";
2
+ const families = ['databaseSchemas', 'databaseViews', 'components', 'jobTemplates', 'endpoints',
3
+ 'schedules', 'events', 'groups', 'roleGroups', 'serviceAccounts', 'agentPlugins', 'agents'];
4
+ // Compare authoring state and intended writes, independent of paths, timestamps,
5
+ // presentation diffs and lock adoption bookkeeping in separate CI checkouts.
6
+ function reviewState(plan) {
7
+ return {
8
+ target: plan.pruneTargetKey,
9
+ resources: plan.resources,
10
+ policy: plan.policy,
11
+ identityOrder: plan.identityOrder,
12
+ targets: plan.prune?.targetState,
13
+ families: families.map(family => ({ family, items: (plan[family]?.items || []).map(item => {
14
+ const value = item;
15
+ return Object.fromEntries(['stableKey', 'identityKey', 'componentId', 'remoteComponentId', 'remoteVersion',
16
+ 'desiredHash', 'localHash', 'currentHash', 'remoteHash', 'operation', 'desiredActive', 'currentActive',
17
+ 'targetRevisionHash', 'componentDesiredHash'].filter(key => value[key] !== undefined).map(key => [key, value[key]]));
18
+ }).sort((left, right) => hashStable(left).localeCompare(hashStable(right))) })),
19
+ };
20
+ }
21
+ export function sameReviewedPlan(reviewed, live) {
22
+ return reviewed.reviewedPlanVersion === 1 && live.reviewedPlanVersion === 1
23
+ && reviewed.readyToMigrate && live.readyToMigrate
24
+ && hashStable(reviewState(reviewed)) === hashStable(reviewState(live));
25
+ }
@@ -9,6 +9,12 @@ export type CommandContext = {
9
9
  client: RevoClient;
10
10
  componentEnvironment?: string;
11
11
  componentIdentity?: ComponentIdentityConfig;
12
+ componentReview?: Map<string, {
13
+ localHash: string | null;
14
+ remoteHash: string | null;
15
+ remoteComponentId?: string;
16
+ remoteVersion: number | null;
17
+ }>;
12
18
  cwd: string;
13
19
  packageVersion: string;
14
20
  print: (value: unknown) => void;
@@ -14,6 +14,13 @@ export type WorkspacePruneItem = {
14
14
  export type WorkspacePrunePlan = {
15
15
  items: WorkspacePruneItem[];
16
16
  blockers: string[];
17
+ targetState?: Array<{
18
+ resource: TrackableResourceType;
19
+ stableKey: string;
20
+ targetId: string;
21
+ version: number | null;
22
+ active: unknown;
23
+ }>;
17
24
  };
18
25
  type Inventory = Partial<Record<TrackableResourceType, ResourceRecord[]>>;
19
26
  type LocalManifests = Partial<Record<TrackableResourceType, Map<string, Record<string, unknown>>>>;
@@ -29,6 +36,7 @@ export declare function buildWorkspacePrunePlan(input: {
29
36
  cwd: string;
30
37
  client: RevoClient;
31
38
  resources: readonly TrackableResourceType[];
39
+ captureTargets?: boolean;
32
40
  }): Promise<WorkspacePrunePlan>;
33
41
  export declare function samePrunePlan(left: WorkspacePrunePlan, right: WorkspacePrunePlan): boolean;
34
42
  export declare function applyWorkspacePrune(input: {
@@ -390,10 +390,20 @@ export async function buildWorkspacePrunePlan(input) {
390
390
  const profile = isRecord(me) && isRecord(me.data) ? me.data : me;
391
391
  const actorId = isRecord(profile) && isRecord(profile.user) ? String(profile.user.userId || '')
392
392
  : isRecord(profile) ? String(profile.userId || '') : undefined;
393
- return planWorkspacePrune({ resources: input.resources, local, inventory, stableKeyName: readProjectStableKeyName(input.cwd), actorId });
393
+ const stableKeyName = readProjectStableKeyName(input.cwd);
394
+ const plan = planWorkspacePrune({ resources: input.resources, local, inventory, stableKeyName, actorId });
395
+ if (input.captureTargets) {
396
+ plan.targetState = input.resources.flatMap(resource => (inventory[resource] || []).filter(active).flatMap(record => {
397
+ const stableKey = readConfiguredResourceMetadataStableKey(record, stableKeyName);
398
+ return stableKey ? [{ resource, stableKey: normalizeStableKeyValue(stableKey), targetId: resourceIdOf(record),
399
+ version: typeof record.version === 'number' ? record.version : null, active: record.active ?? null }] : [];
400
+ })).sort((left, right) => key(left.resource, left.stableKey).localeCompare(key(right.resource, right.stableKey))
401
+ || left.targetId.localeCompare(right.targetId));
402
+ }
403
+ return plan;
394
404
  }
395
405
  export function samePrunePlan(left, right) {
396
- return hashStable(left) === hashStable(right);
406
+ return hashStable({ items: left.items, blockers: left.blockers }) === hashStable({ items: right.items, blockers: right.blockers });
397
407
  }
398
408
  function clearPruneBaseline(cwd, envName, item) {
399
409
  const { projectRoot } = requireProjectLayout(cwd, 'Workspace prune');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revoengine/cli",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "CLI package for the RevoEngine Platform API",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -11,7 +11,7 @@
11
11
  "scripts": {
12
12
  "build": "npm run clean && tsc -p tsconfig.build.json",
13
13
  "clean": "node --input-type=module -e \"import fs from 'node:fs'; fs.rmSync('dist', { recursive: true, force: true });\"",
14
- "check": "node --input-type=module -e \"await import('./src/config.ts'); await import('./src/legacy.ts'); await import('./src/http-trace.ts'); await import('./src/request-queue.ts'); await import('./src/client.ts'); await import('./src/component-lock.ts'); await import('./src/component-contract.ts'); await import('./src/database-indexes.ts'); await import('./src/diff-details.ts'); await import('./src/resource-metadata.ts'); await import('./src/tracked-resources.ts'); await import('./src/resource-inventory.ts'); await import('./src/metadata-backfill.ts'); await import('./src/workspace-component.ts'); await import('./src/workspace-resource.ts'); await import('./src/database-table-artifacts.ts'); await import('./src/project.ts'); await import('./src/prompt.ts'); await import('./src/runtime-view.ts'); await import('./src/spinner.ts'); await import('./src/types.ts'); await import('./src/utils.ts'); await import('./src/resource-syncs/util.ts'); await import('./src/resource-syncs/agent-sync.ts'); await import('./src/resource-syncs/database-table-sync.ts'); await import('./src/resource-syncs/database-view-sync.ts'); await import('./src/resource-syncs/endpoint-sync.ts'); await import('./src/resource-syncs/group-sync.ts'); await import('./src/resource-syncs/role-group-sync.ts'); await import('./src/resource-syncs/job-template-sync.ts'); await import('./src/resource-syncs/schedule-sync.ts'); await import('./src/resource-syncs/event-sync.ts'); await import('./src/resource-syncs/account-principal.ts'); await import('./src/resource-syncs/identity-migration.ts'); await import('./src/resource-syncs/service-account-sync.ts'); await import('./src/commands/service-accounts.ts'); await import('./src/commands/agents.ts'); await import('./src/migration-actions.ts'); await import('./src/migration.ts'); await import('./src/workspace-diff.ts'); await import('./src/workspace-prune.ts'); await import('./src/sync-output.ts'); await import('./src/ui.ts'); await import('./src/update-notifier.ts'); await import('./src/env-sync.ts'); await import('./src/commands/auth.ts'); await import('./src/commands/component.ts'); await import('./src/commands/database-tables.ts'); await import('./src/commands/database-views.ts'); await import('./src/commands/endpoints.ts'); await import('./src/commands/env.ts'); await import('./src/commands/events.ts'); await import('./src/commands/groups.ts'); await import('./src/commands/info.ts'); await import('./src/commands/job-templates.ts'); await import('./src/commands/metadata.ts'); await import('./src/commands/migrate.ts'); await import('./src/commands/request.ts'); await import('./src/commands/role-groups.ts'); await import('./src/commands/search.ts'); await import('./src/commands/schedules.ts'); await import('./src/commands/terminal-service.ts'); await import('./src/commands/terminal-browser.ts'); await import('./src/commands/terminal-image.ts'); await import('./src/commands/terminal-sandbox.ts'); await import('./src/commands/terminal-patch.ts'); await import('./src/commands/terminal-patch-worker.ts'); await import('./src/commands/terminal.ts'); await import('./src/cli.ts'); await import('./src/index.ts'); await import('./bin/revo.ts'); await import('./scripts/dev.ts')\"",
14
+ "check": "node --input-type=module -e \"await import('./src/config.ts'); await import('./src/legacy.ts'); await import('./src/http-trace.ts'); await import('./src/request-queue.ts'); await import('./src/client.ts'); await import('./src/component-lock.ts'); await import('./src/component-contract.ts'); await import('./src/database-indexes.ts'); await import('./src/diff-details.ts'); await import('./src/resource-metadata.ts'); await import('./src/tracked-resources.ts'); await import('./src/resource-inventory.ts'); await import('./src/metadata-backfill.ts'); await import('./src/workspace-component.ts'); await import('./src/workspace-resource.ts'); await import('./src/database-table-artifacts.ts'); await import('./src/project.ts'); await import('./src/prompt.ts'); await import('./src/runtime-view.ts'); await import('./src/spinner.ts'); await import('./src/types.ts'); await import('./src/utils.ts'); await import('./src/resource-syncs/util.ts'); await import('./src/resource-syncs/agent-sync.ts'); await import('./src/resource-syncs/database-table-sync.ts'); await import('./src/resource-syncs/database-view-sync.ts'); await import('./src/resource-syncs/endpoint-sync.ts'); await import('./src/resource-syncs/group-sync.ts'); await import('./src/resource-syncs/role-group-sync.ts'); await import('./src/resource-syncs/job-template-sync.ts'); await import('./src/resource-syncs/schedule-sync.ts'); await import('./src/resource-syncs/event-sync.ts'); await import('./src/resource-syncs/account-principal.ts'); await import('./src/resource-syncs/identity-migration.ts'); await import('./src/resource-syncs/service-account-sync.ts'); await import('./src/commands/service-accounts.ts'); await import('./src/commands/agents.ts'); await import('./src/migration-actions.ts'); await import('./src/reviewed-plan.ts'); await import('./src/migration.ts'); await import('./src/workspace-diff.ts'); await import('./src/workspace-prune.ts'); await import('./src/sync-output.ts'); await import('./src/ui.ts'); await import('./src/update-notifier.ts'); await import('./src/env-sync.ts'); await import('./src/commands/auth.ts'); await import('./src/commands/component.ts'); await import('./src/commands/database-tables.ts'); await import('./src/commands/database-views.ts'); await import('./src/commands/endpoints.ts'); await import('./src/commands/env.ts'); await import('./src/commands/events.ts'); await import('./src/commands/groups.ts'); await import('./src/commands/info.ts'); await import('./src/commands/job-templates.ts'); await import('./src/commands/metadata.ts'); await import('./src/commands/migrate.ts'); await import('./src/commands/request.ts'); await import('./src/commands/role-groups.ts'); await import('./src/commands/search.ts'); await import('./src/commands/schedules.ts'); await import('./src/commands/terminal-service.ts'); await import('./src/commands/terminal-browser.ts'); await import('./src/commands/terminal-image.ts'); await import('./src/commands/terminal-sandbox.ts'); await import('./src/commands/terminal-patch.ts'); await import('./src/commands/terminal-patch-worker.ts'); await import('./src/commands/terminal.ts'); await import('./src/cli.ts'); await import('./src/index.ts'); await import('./bin/revo.ts'); await import('./scripts/dev.ts')\"",
15
15
  "dev": "node ./scripts/dev.ts",
16
16
  "prepack": "npm run build",
17
17
  "test": "node --test ./test/*.test.ts",