@revoengine/cli 1.0.31 → 1.0.34

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 (113) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +152 -24
  3. package/dist/src/argument-contract.d.ts +17 -0
  4. package/dist/src/argument-contract.js +359 -0
  5. package/dist/src/automation-contract.generated.d.ts +56 -22
  6. package/dist/src/automation-contract.generated.js +68 -26
  7. package/dist/src/cli.js +15 -13
  8. package/dist/src/client.d.ts +34 -2
  9. package/dist/src/client.js +76 -13
  10. package/dist/src/commands/agents.js +5 -1
  11. package/dist/src/commands/auth.js +2 -0
  12. package/dist/src/commands/component.js +34 -17
  13. package/dist/src/commands/database-tables.js +15 -4
  14. package/dist/src/commands/database-views.js +5 -1
  15. package/dist/src/commands/endpoints.js +5 -1
  16. package/dist/src/commands/env.js +5 -1
  17. package/dist/src/commands/events.js +5 -1
  18. package/dist/src/commands/groups.js +5 -1
  19. package/dist/src/commands/info.js +2 -0
  20. package/dist/src/commands/job-templates.js +5 -1
  21. package/dist/src/commands/metadata.js +2 -0
  22. package/dist/src/commands/migrate.d.ts +2 -2
  23. package/dist/src/commands/migrate.js +33 -7
  24. package/dist/src/commands/project.js +19 -14
  25. package/dist/src/commands/request.js +2 -0
  26. package/dist/src/commands/role-groups.js +5 -1
  27. package/dist/src/commands/schedules.js +5 -1
  28. package/dist/src/commands/search.js +2 -0
  29. package/dist/src/commands/service-accounts.js +5 -1
  30. package/dist/src/commands/studio.js +2 -0
  31. package/dist/src/commands/terminal-browser-central-profile.d.ts +65 -0
  32. package/dist/src/commands/terminal-browser-central-profile.js +203 -0
  33. package/dist/src/commands/terminal-browser-human-input.d.ts +3 -1
  34. package/dist/src/commands/terminal-browser-human-input.js +3 -1
  35. package/dist/src/commands/terminal-browser-interaction.js +1 -1
  36. package/dist/src/commands/terminal-browser-live-protocol.d.ts +34 -2
  37. package/dist/src/commands/terminal-browser-live-protocol.js +28 -12
  38. package/dist/src/commands/terminal-browser-live-transport.d.ts +1 -0
  39. package/dist/src/commands/terminal-browser-live-transport.js +9 -5
  40. package/dist/src/commands/terminal-browser-live.d.ts +24 -3
  41. package/dist/src/commands/terminal-browser-live.js +199 -30
  42. package/dist/src/commands/terminal-browser-page-input.d.ts +4 -1
  43. package/dist/src/commands/terminal-browser-page-input.js +46 -1
  44. package/dist/src/commands/terminal-browser-profile-crypto.d.ts +30 -0
  45. package/dist/src/commands/terminal-browser-profile-crypto.js +101 -0
  46. package/dist/src/commands/terminal-browser-profile-import-runner.d.ts +31 -0
  47. package/dist/src/commands/terminal-browser-profile-import-runner.js +112 -0
  48. package/dist/src/commands/terminal-browser-profile-import.d.ts +28 -0
  49. package/dist/src/commands/terminal-browser-profile-import.js +125 -0
  50. package/dist/src/commands/terminal-browser-profile-import.protocol.d.ts +50 -0
  51. package/dist/src/commands/terminal-browser-profile-import.protocol.js +52 -0
  52. package/dist/src/commands/terminal-browser-profile-preferences.d.ts +1 -0
  53. package/dist/src/commands/terminal-browser-profile-preferences.js +16 -0
  54. package/dist/src/commands/terminal-browser-profile-sync.d.ts +14 -0
  55. package/dist/src/commands/terminal-browser-profile-sync.js +169 -0
  56. package/dist/src/commands/terminal-browser-profile-sync.protocol.d.ts +50 -0
  57. package/dist/src/commands/terminal-browser-profile-sync.protocol.js +19 -0
  58. package/dist/src/commands/terminal-browser-profile.d.ts +10 -1
  59. package/dist/src/commands/terminal-browser-profile.js +30 -4
  60. package/dist/src/commands/terminal-browser-recording.d.ts +39 -0
  61. package/dist/src/commands/terminal-browser-recording.js +74 -0
  62. package/dist/src/commands/terminal-browser-recording.protocol.d.ts +49 -0
  63. package/dist/src/commands/terminal-browser-recording.protocol.js +16 -0
  64. package/dist/src/commands/terminal-browser.d.ts +14 -1
  65. package/dist/src/commands/terminal-browser.js +98 -33
  66. package/dist/src/commands/terminal-file-descriptor.d.ts +9 -0
  67. package/dist/src/commands/terminal-file-descriptor.js +39 -0
  68. package/dist/src/commands/terminal-file.js +41 -6
  69. package/dist/src/commands/terminal-image.js +3 -31
  70. package/dist/src/commands/terminal-output-buffer.d.ts +18 -1
  71. package/dist/src/commands/terminal-output-buffer.js +95 -8
  72. package/dist/src/commands/terminal-process-group.d.ts +25 -0
  73. package/dist/src/commands/terminal-process-group.js +144 -0
  74. package/dist/src/commands/terminal.d.ts +3 -1
  75. package/dist/src/commands/terminal.js +366 -80
  76. package/dist/src/commands/tests.js +2 -0
  77. package/dist/src/component-lock.d.ts +15 -1
  78. package/dist/src/component-lock.js +96 -10
  79. package/dist/src/env-sync.js +12 -6
  80. package/dist/src/migration.d.ts +7 -0
  81. package/dist/src/migration.js +39 -21
  82. package/dist/src/planning-snapshot.d.ts +3 -0
  83. package/dist/src/planning-snapshot.js +60 -2
  84. package/dist/src/project.d.ts +1 -0
  85. package/dist/src/project.js +7 -8
  86. package/dist/src/resource-syncs/agent-sync.js +76 -24
  87. package/dist/src/resource-syncs/database-table-sync.d.ts +8 -1
  88. package/dist/src/resource-syncs/database-table-sync.js +66 -32
  89. package/dist/src/resource-syncs/database-view-sync.js +41 -28
  90. package/dist/src/resource-syncs/endpoint-sync.js +90 -18
  91. package/dist/src/resource-syncs/event-sync.js +33 -14
  92. package/dist/src/resource-syncs/group-sync.js +21 -11
  93. package/dist/src/resource-syncs/job-template-sync.js +98 -37
  94. package/dist/src/resource-syncs/role-group-sync.js +22 -11
  95. package/dist/src/resource-syncs/schedule-sync.js +26 -11
  96. package/dist/src/resource-syncs/service-account-sync.js +22 -11
  97. package/dist/src/reviewed-plan.js +3 -0
  98. package/dist/src/runtime-view.js +2 -18
  99. package/dist/src/sync-omit-command.d.ts +6 -0
  100. package/dist/src/sync-omit-command.js +49 -0
  101. package/dist/src/sync-omit-write-fence.d.ts +10 -0
  102. package/dist/src/sync-omit-write-fence.js +134 -0
  103. package/dist/src/sync-omit.d.ts +59 -0
  104. package/dist/src/sync-omit.js +469 -0
  105. package/dist/src/sync-output.d.ts +3 -3
  106. package/dist/src/ui.js +11 -5
  107. package/dist/src/update-notifier.d.ts +1 -1
  108. package/dist/src/update-notifier.js +2 -1
  109. package/dist/src/utils.js +46 -17
  110. package/dist/src/workspace-prune.js +11 -3
  111. package/dist/src/workspace-write-lock.d.ts +7 -0
  112. package/dist/src/workspace-write-lock.js +144 -0
  113. package/package.json +6 -5
@@ -1,5 +1,6 @@
1
1
  import { createHash, randomUUID } from 'node:crypto';
2
2
  import { setTimeout as wait } from 'node:timers/promises';
3
+ import { validateCommandArguments } from "../argument-contract.js";
3
4
  import { nativeTestCollection, nativeTestRunPassed, nativeTestRunPending } from "../native-tests.js";
4
5
  import { readNativeTestWorkspace } from "../test-workspace.js";
5
6
  import { readBoolFlag, readFlag, readValues } from "../utils.js";
@@ -114,6 +115,7 @@ function batchOperationId(operationId, index) {
114
115
  }
115
116
  /** Native execution captures portable source; it never saves Components or creates an approval. */
116
117
  export async function handleTestsCommand(context) {
118
+ validateCommandArguments(context.args);
117
119
  for (const name of ['workspace', 'search', 'operation-id', 'suite']) {
118
120
  if (context.args[name] !== undefined && !readFlag(context.args, [name]))
119
121
  throw new Error(`--${name} requires a value.`);
@@ -1,7 +1,9 @@
1
1
  import { type ComponentIdentityConfig, type ComponentIdentityMode } from './resource-metadata.ts';
2
2
  import type { ComponentRecord } from './types.ts';
3
+ import { type SyncOmitBaseline } from './sync-omit.ts';
3
4
  export declare const REVO_LOCK_FILE: string;
4
5
  export type ComponentLockEntry = {
6
+ omitBaseline?: SyncOmitBaseline;
5
7
  identityMode: ComponentIdentityMode;
6
8
  metadataProperty?: string;
7
9
  stableKey?: string;
@@ -13,11 +15,13 @@ export type ComponentLockEntry = {
13
15
  remoteVersion: number | null;
14
16
  remoteHash: string;
15
17
  sourceHash: string;
18
+ sourceBaseline?: SyncOmitBaseline;
16
19
  pulledAt: string;
17
20
  defaultRemoved?: boolean;
18
21
  environments?: Record<string, ComponentEnvironmentBaseline>;
19
22
  };
20
23
  export type ComponentEnvironmentBaseline = {
24
+ omitBaseline?: SyncOmitBaseline;
21
25
  remoteComponentId: string;
22
26
  remoteVersion: number | null;
23
27
  remoteHash: string;
@@ -25,6 +29,7 @@ export type ComponentEnvironmentBaseline = {
25
29
  };
26
30
  export type ComponentLockEntryInput = Omit<ComponentLockEntry, 'identityMode' | 'remoteComponentId' | 'defaultRemoved'> & Partial<Pick<ComponentLockEntry, 'identityMode' | 'remoteComponentId'>>;
27
31
  export type EnvironmentBaseline = {
32
+ omitBaseline?: SyncOmitBaseline;
28
33
  remoteHash: string;
29
34
  syncedAt: string;
30
35
  };
@@ -32,12 +37,14 @@ export type RoleGroupLockEntry = {
32
37
  stableKey: string;
33
38
  path: string;
34
39
  sourceHash: string;
40
+ sourceBaseline?: SyncOmitBaseline;
35
41
  environments: Record<string, EnvironmentBaseline>;
36
42
  };
37
43
  export type GroupLockEntry = {
38
44
  stableKey: string;
39
45
  path: string;
40
46
  sourceHash: string;
47
+ sourceBaseline?: SyncOmitBaseline;
41
48
  owner?: GroupOwnerPolicy;
42
49
  environments: Record<string, EnvironmentBaseline>;
43
50
  };
@@ -60,6 +67,7 @@ export type JobTemplateLockEntry = {
60
67
  stableKey: string;
61
68
  path: string;
62
69
  sourceHash: string;
70
+ sourceBaseline?: SyncOmitBaseline;
63
71
  environments: Record<string, EnvironmentBaseline>;
64
72
  migration?: {
65
73
  componentBinding?: 'pinned-unsupported';
@@ -70,27 +78,32 @@ export type ScheduleLockEntry = {
70
78
  stableKey: string;
71
79
  path: string;
72
80
  sourceHash: string;
81
+ sourceBaseline?: SyncOmitBaseline;
73
82
  environments: Record<string, EnvironmentBaseline>;
74
83
  };
75
84
  export type EventLockEntry = {
76
85
  stableKey: string;
77
86
  path: string;
78
87
  sourceHash: string;
88
+ sourceBaseline?: SyncOmitBaseline;
79
89
  environments: Record<string, EnvironmentBaseline>;
80
90
  };
81
91
  export type EndpointLockEntry = {
82
92
  stableKey: string;
83
93
  path: string;
84
94
  sourceHash: string;
95
+ sourceBaseline?: SyncOmitBaseline;
85
96
  environments: Record<string, EnvironmentBaseline>;
86
97
  };
87
98
  export type DatabaseSchemaLockEntry = {
88
99
  stableKey: string;
89
100
  path: string;
90
101
  sourceHash: string;
102
+ sourceBaseline?: SyncOmitBaseline;
91
103
  sourceRestricted?: boolean;
92
104
  parentStableKey?: string;
93
105
  environments: Record<string, {
106
+ omitBaseline?: SyncOmitBaseline;
94
107
  remoteHash: string;
95
108
  tombstone?: {
96
109
  deletedAt: string;
@@ -102,6 +115,7 @@ export type DatabaseViewLockEntry = {
102
115
  stableKey: string;
103
116
  path: string;
104
117
  sourceHash: string;
118
+ sourceBaseline?: SyncOmitBaseline;
105
119
  environments: Record<string, EnvironmentBaseline & {
106
120
  dependencyHash?: string;
107
121
  }>;
@@ -177,7 +191,7 @@ export type PortableComponentConfigField = (typeof PORTABLE_COMPONENT_CONFIG_FIE
177
191
  export declare function componentActivationValidationError(source: ComponentRecord): "Component active must be a boolean." | null;
178
192
  export declare function componentTypeTransitionReason(desired: string, current: string): string | null;
179
193
  export declare function diffPortableComponentSource(source: ComponentRecord, target: ComponentRecord): {
180
- configurationFields: ("name" | "type" | "metadata" | "desc" | "category" | "active" | "testConfig")[];
194
+ configurationFields: ("name" | "metadata" | "type" | "active" | "category" | "desc" | "testConfig")[];
181
195
  elementsChanged: boolean;
182
196
  changedFields: string[];
183
197
  };
@@ -3,10 +3,19 @@ import fs from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import { REVO_PROJECT_DIR } from "./project.js";
5
5
  import { COMPONENT_IDENTITY_BY_ID, normalizeComponentIdentityConfig, readComponentIdentityValue, sameComponentIdentityConfig, sanitizeUserMetadata, } from "./resource-metadata.js";
6
- import { readJsonFile, writeJsonFile } from "./utils.js";
6
+ import { writeJsonFile } from "./utils.js";
7
7
  import { requestContracts, validateRequestContract } from "./request-contract.js";
8
8
  import { componentSourceConfigurationErrors } from "./component-source-validation.js";
9
+ import { hashSyncDefinition, preserveOmittedProperties, syncBaselineData } from "./sync-omit.js";
10
+ import { withWorkspaceWriteLockAtRoot } from "./workspace-write-lock.js";
9
11
  export const REVO_LOCK_FILE = path.join(REVO_PROJECT_DIR, 'revo.lock.json');
12
+ const lockRevision = Symbol('revo-lock-revision');
13
+ function revisionHash(contents) { return crypto.createHash('sha256').update(contents).digest('hex'); }
14
+ function markLockRevision(lock, filePath, hash) {
15
+ // Enumerable symbols survive object spreads while JSON serialization ignores them.
16
+ Object.defineProperty(lock, lockRevision, { value: { path: path.resolve(filePath), hash }, enumerable: true, configurable: true });
17
+ return lock;
18
+ }
10
19
  const VOLATILE_COMPONENT_FIELDS = new Set([
11
20
  'version',
12
21
  'revision',
@@ -102,7 +111,7 @@ export function normalizeComponentSource(component) {
102
111
  };
103
112
  }
104
113
  export function hashComponentSource(component) {
105
- return hashStable(normalizeComponentSource(component));
114
+ return hashSyncDefinition('component', normalizeComponentSource(component));
106
115
  }
107
116
  // componentId is instance-local, so comparing components across two RevoEngine
108
117
  // environments must project it away; element componentElementIds are already
@@ -112,7 +121,7 @@ export function normalizePortableComponentSource(component) {
112
121
  return portable;
113
122
  }
114
123
  export function hashPortableComponentSource(component) {
115
- return hashStable(normalizePortableComponentSource(component));
124
+ return hashSyncDefinition('component', normalizePortableComponentSource(component));
116
125
  }
117
126
  export const PORTABLE_COMPONENT_CONFIG_FIELDS = [
118
127
  'name',
@@ -134,7 +143,7 @@ export function componentTypeTransitionReason(desired, current) {
134
143
  : `The target API cannot change Component type from ${currentType} to ${desiredType}; resolve this transition manually before syncing.`;
135
144
  }
136
145
  export function diffPortableComponentSource(source, target) {
137
- const sourcePortable = normalizePortableComponentSource(source);
146
+ const sourcePortable = normalizePortableComponentSource(preserveOmittedProperties('component', source, target));
138
147
  const targetPortable = normalizePortableComponentSource(target);
139
148
  const configurationFields = PORTABLE_COMPONENT_CONFIG_FIELDS.filter((field) => hashStable(sourcePortable[field] ?? null) !== hashStable(targetPortable[field] ?? null));
140
149
  const elementsChanged = hashStable(sourcePortable.elements) !== hashStable(targetPortable.elements);
@@ -154,7 +163,7 @@ export function buildPortableComponentUpdatePayload(source, target, changedField
154
163
  const configurationErrors = componentSourceConfigurationErrors(source);
155
164
  if (configurationErrors.length)
156
165
  throw new Error(configurationErrors.join('; '));
157
- const sourcePortable = normalizePortableComponentSource(source);
166
+ const sourcePortable = normalizePortableComponentSource(preserveOmittedProperties('component', source, target));
158
167
  const activationError = componentActivationValidationError(source);
159
168
  if (activationError)
160
169
  throw new Error(activationError);
@@ -202,7 +211,7 @@ export function getLockPath(projectRoot) {
202
211
  export function readComponentLock(projectRoot) {
203
212
  const lockPath = getLockPath(projectRoot);
204
213
  if (!fs.existsSync(lockPath)) {
205
- return {
214
+ return markLockRevision({
206
215
  schemaVersion: 2,
207
216
  componentIdentity: COMPONENT_IDENTITY_BY_ID,
208
217
  components: {},
@@ -217,9 +226,11 @@ export function readComponentLock(projectRoot) {
217
226
  endpoints: {},
218
227
  databaseSchemas: {},
219
228
  databaseViews: {},
220
- };
229
+ }, lockPath, null);
221
230
  }
222
- const raw = readJsonFile(lockPath);
231
+ const contents = fs.readFileSync(lockPath, 'utf8');
232
+ const revision = revisionHash(contents);
233
+ const raw = (contents.trim() ? JSON.parse(contents) : {});
223
234
  const componentIdentity = normalizeComponentIdentityConfig(raw.componentIdentity, COMPONENT_IDENTITY_BY_ID);
224
235
  const diagnostics = normalizeDiagnostics(raw.diagnostics);
225
236
  const components = Object.fromEntries(Object.entries(raw.components && typeof raw.components === 'object' ? raw.components : {})
@@ -248,12 +259,13 @@ export function readComponentLock(projectRoot) {
248
259
  remoteVersion: typeof baseline.remoteVersion === 'number' ? baseline.remoteVersion : null,
249
260
  remoteHash: String(baseline.remoteHash),
250
261
  syncedAt: String(baseline.syncedAt),
262
+ ...(baseline.omitBaseline ? { omitBaseline: baseline.omitBaseline } : {}),
251
263
  }])),
252
264
  }
253
265
  : {}),
254
266
  }];
255
267
  }));
256
- return {
268
+ return markLockRevision({
257
269
  schemaVersion: 2,
258
270
  ...(raw.workspaceDigests ? { workspaceDigests: raw.workspaceDigests } : {}),
259
271
  ...(diagnostics ? { diagnostics } : {}),
@@ -269,6 +281,7 @@ export function readComponentLock(projectRoot) {
269
281
  stableKey: String(entry.stableKey),
270
282
  path: String(entry.path),
271
283
  sourceHash: String(entry.sourceHash),
284
+ ...(entry.sourceBaseline ? { sourceBaseline: entry.sourceBaseline } : {}),
272
285
  ...((isRecord(entry.owner) && (entry.owner.type === 'group' || entry.owner.type === 'service-account') && typeof entry.owner.stableKey === 'string')
273
286
  ? { owner: { type: entry.owner.type, stableKey: entry.owner.stableKey } }
274
287
  : (isRecord(entry.owner) && entry.owner.type === 'system')
@@ -283,6 +296,7 @@ export function readComponentLock(projectRoot) {
283
296
  .map(([envName, baseline]) => [envName, {
284
297
  remoteHash: String(baseline.remoteHash),
285
298
  syncedAt: String(baseline.syncedAt),
299
+ ...(baseline.omitBaseline ? { omitBaseline: baseline.omitBaseline } : {}),
286
300
  }])),
287
301
  }])),
288
302
  agents: Object.fromEntries(Object.entries(raw.agents && typeof raw.agents === 'object' ? raw.agents : {})
@@ -295,11 +309,13 @@ export function readComponentLock(projectRoot) {
295
309
  stableKey: String(entry.stableKey),
296
310
  path: String(entry.path),
297
311
  sourceHash: String(entry.sourceHash),
312
+ ...(entry.sourceBaseline ? { sourceBaseline: entry.sourceBaseline } : {}),
298
313
  environments: Object.fromEntries(Object.entries(entry.environments)
299
314
  .filter(([, baseline]) => typeof baseline.remoteHash === 'string' && typeof baseline.syncedAt === 'string')
300
315
  .map(([envName, baseline]) => [envName, {
301
316
  remoteHash: String(baseline.remoteHash),
302
317
  syncedAt: String(baseline.syncedAt),
318
+ ...(baseline.omitBaseline ? { omitBaseline: baseline.omitBaseline } : {}),
303
319
  }])),
304
320
  }])),
305
321
  agentPlugins: Object.fromEntries(Object.entries(raw.agentPlugins && typeof raw.agentPlugins === 'object' ? raw.agentPlugins : {})
@@ -312,11 +328,13 @@ export function readComponentLock(projectRoot) {
312
328
  stableKey: String(entry.stableKey),
313
329
  path: String(entry.path),
314
330
  sourceHash: String(entry.sourceHash),
331
+ ...(entry.sourceBaseline ? { sourceBaseline: entry.sourceBaseline } : {}),
315
332
  environments: Object.fromEntries(Object.entries(entry.environments)
316
333
  .filter(([, baseline]) => typeof baseline.remoteHash === 'string' && typeof baseline.syncedAt === 'string')
317
334
  .map(([envName, baseline]) => [envName, {
318
335
  remoteHash: String(baseline.remoteHash),
319
336
  syncedAt: String(baseline.syncedAt),
337
+ ...(baseline.omitBaseline ? { omitBaseline: baseline.omitBaseline } : {}),
320
338
  }])),
321
339
  }])),
322
340
  serviceAccounts: Object.fromEntries(Object.entries(raw.serviceAccounts && typeof raw.serviceAccounts === 'object' ? raw.serviceAccounts : {})
@@ -329,11 +347,13 @@ export function readComponentLock(projectRoot) {
329
347
  stableKey: String(entry.stableKey),
330
348
  path: String(entry.path),
331
349
  sourceHash: String(entry.sourceHash),
350
+ ...(entry.sourceBaseline ? { sourceBaseline: entry.sourceBaseline } : {}),
332
351
  environments: Object.fromEntries(Object.entries(entry.environments)
333
352
  .filter(([, baseline]) => typeof baseline.remoteHash === 'string' && typeof baseline.syncedAt === 'string')
334
353
  .map(([envName, baseline]) => [envName, {
335
354
  remoteHash: String(baseline.remoteHash),
336
355
  syncedAt: String(baseline.syncedAt),
356
+ ...(baseline.omitBaseline ? { omitBaseline: baseline.omitBaseline } : {}),
337
357
  }])),
338
358
  }])),
339
359
  roleGroups: Object.fromEntries(Object.entries(raw.roleGroups && typeof raw.roleGroups === 'object' ? raw.roleGroups : {})
@@ -346,11 +366,13 @@ export function readComponentLock(projectRoot) {
346
366
  stableKey: String(entry.stableKey),
347
367
  path: String(entry.path),
348
368
  sourceHash: String(entry.sourceHash),
369
+ ...(entry.sourceBaseline ? { sourceBaseline: entry.sourceBaseline } : {}),
349
370
  environments: Object.fromEntries(Object.entries(entry.environments)
350
371
  .filter(([, baseline]) => typeof baseline.remoteHash === 'string' && typeof baseline.syncedAt === 'string')
351
372
  .map(([envName, baseline]) => [envName, {
352
373
  remoteHash: String(baseline.remoteHash),
353
374
  syncedAt: String(baseline.syncedAt),
375
+ ...(baseline.omitBaseline ? { omitBaseline: baseline.omitBaseline } : {}),
354
376
  }])),
355
377
  }])),
356
378
  jobTemplates: Object.fromEntries(Object.entries(raw.jobTemplates && typeof raw.jobTemplates === 'object' ? raw.jobTemplates : {})
@@ -363,6 +385,7 @@ export function readComponentLock(projectRoot) {
363
385
  stableKey: String(entry.stableKey),
364
386
  path: String(entry.path),
365
387
  sourceHash: String(entry.sourceHash),
388
+ ...(entry.sourceBaseline ? { sourceBaseline: entry.sourceBaseline } : {}),
366
389
  ...((isRecord(entry.migration) && (entry.migration.componentBinding === 'pinned-unsupported'
367
390
  || entry.migration.executionPrincipal === 'excluded')) ? {
368
391
  migration: {
@@ -375,6 +398,7 @@ export function readComponentLock(projectRoot) {
375
398
  .map(([envName, baseline]) => [envName, {
376
399
  remoteHash: String(baseline.remoteHash),
377
400
  syncedAt: String(baseline.syncedAt),
401
+ ...(baseline.omitBaseline ? { omitBaseline: baseline.omitBaseline } : {}),
378
402
  }])),
379
403
  }])),
380
404
  schedules: Object.fromEntries(Object.entries(raw.schedules && typeof raw.schedules === 'object' ? raw.schedules : {})
@@ -387,11 +411,13 @@ export function readComponentLock(projectRoot) {
387
411
  stableKey: String(entry.stableKey),
388
412
  path: String(entry.path),
389
413
  sourceHash: String(entry.sourceHash),
414
+ ...(entry.sourceBaseline ? { sourceBaseline: entry.sourceBaseline } : {}),
390
415
  environments: Object.fromEntries(Object.entries(entry.environments)
391
416
  .filter(([, baseline]) => typeof baseline.remoteHash === 'string' && typeof baseline.syncedAt === 'string')
392
417
  .map(([envName, baseline]) => [envName, {
393
418
  remoteHash: String(baseline.remoteHash),
394
419
  syncedAt: String(baseline.syncedAt),
420
+ ...(baseline.omitBaseline ? { omitBaseline: baseline.omitBaseline } : {}),
395
421
  }])),
396
422
  }])),
397
423
  events: Object.fromEntries(Object.entries(raw.events && typeof raw.events === 'object' ? raw.events : {})
@@ -404,11 +430,13 @@ export function readComponentLock(projectRoot) {
404
430
  stableKey: String(entry.stableKey),
405
431
  path: String(entry.path),
406
432
  sourceHash: String(entry.sourceHash),
433
+ ...(entry.sourceBaseline ? { sourceBaseline: entry.sourceBaseline } : {}),
407
434
  environments: Object.fromEntries(Object.entries(entry.environments)
408
435
  .filter(([, baseline]) => typeof baseline.remoteHash === 'string' && typeof baseline.syncedAt === 'string')
409
436
  .map(([envName, baseline]) => [envName, {
410
437
  remoteHash: String(baseline.remoteHash),
411
438
  syncedAt: String(baseline.syncedAt),
439
+ ...(baseline.omitBaseline ? { omitBaseline: baseline.omitBaseline } : {}),
412
440
  }])),
413
441
  }])),
414
442
  endpoints: Object.fromEntries(Object.entries(raw.endpoints && typeof raw.endpoints === 'object' ? raw.endpoints : {})
@@ -421,11 +449,13 @@ export function readComponentLock(projectRoot) {
421
449
  stableKey: String(entry.stableKey),
422
450
  path: String(entry.path),
423
451
  sourceHash: String(entry.sourceHash),
452
+ ...(entry.sourceBaseline ? { sourceBaseline: entry.sourceBaseline } : {}),
424
453
  environments: Object.fromEntries(Object.entries(entry.environments)
425
454
  .filter(([, baseline]) => typeof baseline.remoteHash === 'string' && typeof baseline.syncedAt === 'string')
426
455
  .map(([envName, baseline]) => [envName, {
427
456
  remoteHash: String(baseline.remoteHash),
428
457
  syncedAt: String(baseline.syncedAt),
458
+ ...(baseline.omitBaseline ? { omitBaseline: baseline.omitBaseline } : {}),
429
459
  }])),
430
460
  }])),
431
461
  databaseSchemas: Object.fromEntries(Object.entries(raw.databaseSchemas && typeof raw.databaseSchemas === 'object' ? raw.databaseSchemas : {})
@@ -438,6 +468,7 @@ export function readComponentLock(projectRoot) {
438
468
  stableKey: String(entry.stableKey),
439
469
  path: String(entry.path),
440
470
  sourceHash: String(entry.sourceHash),
471
+ ...(entry.sourceBaseline ? { sourceBaseline: entry.sourceBaseline } : {}),
441
472
  ...(typeof entry.sourceRestricted === 'boolean' ? { sourceRestricted: entry.sourceRestricted } : {}),
442
473
  ...(typeof entry.parentStableKey === 'string' ? { parentStableKey: entry.parentStableKey } : {}),
443
474
  environments: Object.fromEntries(Object.entries(entry.environments)
@@ -450,6 +481,7 @@ export function readComponentLock(projectRoot) {
450
481
  parentStableKey: baseline.tombstone.parentStableKey,
451
482
  } }
452
483
  : {}),
484
+ ...(baseline.omitBaseline ? { omitBaseline: baseline.omitBaseline } : {}),
453
485
  }])),
454
486
  }])),
455
487
  databaseViews: Object.fromEntries(Object.entries(raw.databaseViews && typeof raw.databaseViews === 'object' ? raw.databaseViews : {})
@@ -462,17 +494,68 @@ export function readComponentLock(projectRoot) {
462
494
  stableKey: String(entry.stableKey),
463
495
  path: String(entry.path),
464
496
  sourceHash: String(entry.sourceHash),
497
+ ...(entry.sourceBaseline ? { sourceBaseline: entry.sourceBaseline } : {}),
465
498
  environments: Object.fromEntries(Object.entries(entry.environments)
466
499
  .filter(([, baseline]) => typeof baseline.remoteHash === 'string' && typeof baseline.syncedAt === 'string')
467
500
  .map(([envName, baseline]) => [envName, {
468
501
  remoteHash: String(baseline.remoteHash),
469
502
  syncedAt: String(baseline.syncedAt),
470
503
  ...(typeof baseline.dependencyHash === 'string' ? { dependencyHash: baseline.dependencyHash } : {}),
504
+ ...(baseline.omitBaseline ? { omitBaseline: baseline.omitBaseline } : {}),
471
505
  }])),
472
506
  }])),
473
- };
507
+ }, lockPath, revision);
474
508
  }
475
509
  export function writeComponentLock(projectRoot, lock) {
510
+ return withWorkspaceWriteLockAtRoot(projectRoot, () => writeComponentLockWithRevision(projectRoot, lock));
511
+ }
512
+ function writeComponentLockWithRevision(projectRoot, lock) {
513
+ const lockPath = getLockPath(projectRoot);
514
+ const previousContents = fs.existsSync(lockPath) ? fs.readFileSync(lockPath, 'utf8') : null;
515
+ const expected = lock[lockRevision];
516
+ const currentRevision = previousContents === null ? null : revisionHash(previousContents);
517
+ if (expected && (expected.path !== path.resolve(lockPath) || expected.hash !== currentRevision)
518
+ || !expected && currentRevision !== null) {
519
+ throw new Error('Workspace lock changed after it was read. Read a fresh revo.lock.json and retry; no baseline was overwritten.');
520
+ }
521
+ const previous = (previousContents?.trim() ? JSON.parse(previousContents) : {});
522
+ // Keep field digests beside each verified baseline, never input/secret values.
523
+ const fields = [
524
+ ['component', 'components'], ['database-table', 'databaseSchemas'], ['database-view', 'databaseViews'],
525
+ ['job-template', 'jobTemplates'], ['endpoint', 'endpoints'], ['schedule', 'schedules'], ['event', 'events'],
526
+ ['group', 'groups'], ['role-group', 'roleGroups'], ['service-account', 'serviceAccounts'],
527
+ ['agent', 'agents'], ['agent-plugin', 'agentPlugins'],
528
+ ];
529
+ for (const [family, field] of fields) {
530
+ const entries = lock[field] || {};
531
+ for (const [entryKey, entry] of Object.entries(entries)) {
532
+ const prior = previous[field]?.[entryKey];
533
+ if (entry.sourceHash) {
534
+ const captured = syncBaselineData(family, entry.sourceHash);
535
+ if (captured?.rawHash === entry.sourceHash && captured.paths.length === 0)
536
+ entry.sourceBaseline = captured;
537
+ }
538
+ if (entry.remoteHash && (!prior || entry.remoteHash !== prior.remoteHash || entry.pulledAt !== prior.pulledAt)) {
539
+ const captured = syncBaselineData(family, entry.remoteHash);
540
+ if (captured)
541
+ entry.omitBaseline = captured;
542
+ }
543
+ for (const [environment, baseline] of Object.entries(entry.environments || {})) {
544
+ const old = prior?.environments?.[environment];
545
+ if (old && baseline.remoteHash === old.remoteHash && JSON.stringify(baseline) === JSON.stringify(old))
546
+ continue;
547
+ const captured = syncBaselineData(family, baseline.remoteHash);
548
+ if (captured)
549
+ baseline.omitBaseline = captured;
550
+ }
551
+ if (entry.sourceBaseline) {
552
+ // Readers and writers use the same position for this optional proof, so
553
+ // a no-op roundtrip cannot move it to the end of every resource entry.
554
+ entries[entryKey] = Object.fromEntries(Object.entries(entry).filter(([key]) => key !== 'sourceBaseline')
555
+ .flatMap(([key, value]) => key === 'sourceHash' ? [[key, value], ['sourceBaseline', entry.sourceBaseline]] : [[key, value]]));
556
+ }
557
+ }
558
+ }
476
559
  const sortedComponents = Object.fromEntries(Object.entries(lock.components).sort(([left], [right]) => left.localeCompare(right)));
477
560
  const sortedRoleGroups = Object.fromEntries(Object.entries(lock.roleGroups).sort(([left], [right]) => left.localeCompare(right)));
478
561
  const sortedGroups = Object.fromEntries(Object.entries(lock.groups || {}).sort(([left], [right]) => left.localeCompare(right)));
@@ -500,6 +583,7 @@ export function writeComponentLock(projectRoot, lock) {
500
583
  ...(Object.keys(sortedDatabaseSchemas).length > 0 ? { databaseSchemas: sortedDatabaseSchemas } : {}),
501
584
  ...(Object.keys(sortedDatabaseViews).length > 0 ? { databaseViews: sortedDatabaseViews } : {}),
502
585
  });
586
+ markLockRevision(lock, lockPath, revisionHash(fs.readFileSync(lockPath, 'utf8')));
503
587
  }
504
588
  export function componentLockKey(identity, component) {
505
589
  return readComponentIdentityValue(component, identity);
@@ -528,6 +612,7 @@ export function getComponentLockEntry(lock, identity, component, environmentName
528
612
  remoteComponentId: baseline.remoteComponentId,
529
613
  remoteVersion: baseline.remoteVersion,
530
614
  remoteHash: baseline.remoteHash,
615
+ omitBaseline: baseline.omitBaseline,
531
616
  pulledAt: baseline.syncedAt,
532
617
  };
533
618
  }
@@ -548,6 +633,7 @@ export function getComponentLockEntries(lock, identity, environmentName) {
548
633
  remoteComponentId: baseline.remoteComponentId,
549
634
  remoteVersion: baseline.remoteVersion,
550
635
  remoteHash: baseline.remoteHash,
636
+ omitBaseline: baseline.omitBaseline,
551
637
  pulledAt: baseline.syncedAt,
552
638
  }]];
553
639
  }));
@@ -1,3 +1,4 @@
1
+ import { preserveOmittedProperties, assertOmittedPropertiesPreserved, withoutSyncOmit } from "./sync-omit.js";
1
2
  import { verifyComponentRuntime } from "./component-contract.js";
2
3
  import { changeComponentActivation } from "./component-lifecycle.js";
3
4
  import { componentElementValidationErrors } from "./component-element-validation.js";
@@ -267,10 +268,14 @@ function buildCreatePayload(component) {
267
268
  elements: buildPortableElementPayload(component),
268
269
  };
269
270
  }
270
- async function verifyAppliedComponent(targetClient, componentId, expectedHash) {
271
+ async function verifyAppliedComponent(targetClient, componentId, expectedHash, previous, fullSource) {
271
272
  const component = unwrapComponent(await targetClient.getComponent(componentId));
273
+ if (fullSource && !withoutSyncOmit(() => hashPortableComponentSource(component) === hashPortableComponentSource(fullSource)))
274
+ return false;
272
275
  if (hashPortableComponentSource(component) !== expectedHash)
273
276
  return false;
277
+ if (previous)
278
+ assertOmittedPropertiesPreserved('component', normalizePortableComponentSource(previous), normalizePortableComponentSource(component));
274
279
  await verifyComponentRuntime(targetClient, component, 120_000);
275
280
  return true;
276
281
  }
@@ -318,7 +323,7 @@ async function applyPlanItem(targetClient, item, source, target, stableKeyName =
318
323
  // elements guards against create endpoints that ignore inline elements.
319
324
  if (sourceEntry.component.elements?.length)
320
325
  await targetClient.saveComponentElements(newComponentId, buildPortableElementPayload(sourceEntry.component));
321
- const verified = await verifyAppliedComponent(targetClient, newComponentId, sourceEntry.portableHash);
326
+ const verified = await verifyAppliedComponent(targetClient, newComponentId, sourceEntry.portableHash, undefined, sourceEntry.component);
322
327
  return { stableKey: item.stableKey, action: item.action, status: 'applied', verified };
323
328
  }
324
329
  if (item.action === 'update') {
@@ -340,14 +345,15 @@ async function applyPlanItem(targetClient, item, source, target, stableKeyName =
340
345
  if (transition)
341
346
  throw new Error(transition);
342
347
  let expectedVersion = Number.isSafeInteger(targetEntry.component.version) ? targetEntry.component.version : null;
343
- const activationChanged = sourceEntry.portable.active !== targetEntry.portable.active;
348
+ const effectivePortable = preserveOmittedProperties('component', sourceEntry.portable, targetEntry.portable);
349
+ const activationChanged = effectivePortable.active !== targetEntry.portable.active;
344
350
  const updateFields = (item.changedFields || []).filter(field => field !== 'active' && field !== 'type');
345
351
  const updatePayload = updateFields.length || activationChanged
346
352
  ? buildPortableComponentUpdatePayload(sourceEntry.component, targetEntry.component, updateFields) : undefined;
347
353
  const hasElementChanges = Boolean(item.addedElementKeys?.length || item.removedElementKeys?.length || item.changedElementKeys?.length);
348
354
  const targetElementsByKey = new Map((targetEntry.component.elements || []).map(element => [element.key, element]));
349
355
  const elementPayload = hasElementChanges ? buildPortableElementPayload(sourceEntry.component, targetElementsByKey) : undefined;
350
- if (activationChanged && !sourceEntry.portable.active) {
356
+ if (activationChanged && !effectivePortable.active) {
351
357
  expectedVersion = await changeComponentActivation(targetClient, targetEntry.componentId, false, expectedVersion);
352
358
  }
353
359
  if (updateFields.length > 0) {
@@ -360,14 +366,14 @@ async function applyPlanItem(targetClient, item, source, target, stableKeyName =
360
366
  if (result.status !== 304 && expectedVersion !== null)
361
367
  expectedVersion += 1;
362
368
  }
363
- if (activationChanged && sourceEntry.portable.active) {
369
+ if (activationChanged && effectivePortable.active) {
364
370
  const beforeActivation = unwrapComponent(await targetClient.getComponent(targetEntry.componentId));
365
371
  if (hashPortableComponentSource(beforeActivation) !== hashPortableComponentSource({ ...sourceEntry.component, active: false })) {
366
372
  throw new Error('component source did not verify before activation');
367
373
  }
368
374
  await changeComponentActivation(targetClient, targetEntry.componentId, true, expectedVersion);
369
375
  }
370
- const verified = await verifyAppliedComponent(targetClient, targetEntry.componentId, sourceEntry.portableHash);
376
+ const verified = await verifyAppliedComponent(targetClient, targetEntry.componentId, sourceEntry.portableHash, targetEntry.component);
371
377
  return { stableKey: item.stableKey, action: item.action, status: 'applied', verified };
372
378
  }
373
379
  if (item.action === 'delete') {
@@ -1,3 +1,5 @@
1
+ import { type SyncOmitTargetVersions } from './sync-omit-write-fence.ts';
2
+ import { type SyncOmitPolicy } from './sync-omit.ts';
1
3
  import { type AgentSyncPlan, type AgentSyncPull, type AgentSyncResult } from './resource-syncs/agent-sync.ts';
2
4
  import { type MigrationResourcePlan } from './migration-actions.ts';
3
5
  import { type WorkspacePrunePlan } from './workspace-prune.ts';
@@ -42,6 +44,9 @@ export type MigrationSourcePullSummary = {
42
44
  export type MigrationPlan = {
43
45
  schemaVersion: 2;
44
46
  reviewedPlanVersion?: 1;
47
+ omitTargetRevisionHash?: string;
48
+ omitSourceRevisionHash?: string;
49
+ omitTargetVersions?: SyncOmitTargetVersions;
45
50
  command: 'plan';
46
51
  from: string;
47
52
  to: string;
@@ -51,6 +56,7 @@ export type MigrationPlan = {
51
56
  policy: DatabaseSchemaMigrationPolicy & {
52
57
  mode: 'upsert' | 'reconcile';
53
58
  activateAutomations?: boolean;
59
+ omit?: SyncOmitPolicy;
54
60
  };
55
61
  needsChanges: boolean;
56
62
  readyToMigrate: boolean;
@@ -86,6 +92,7 @@ export type MigrationRun = {
86
92
  policy: DatabaseSchemaMigrationPolicy & {
87
93
  mode: 'upsert' | 'reconcile';
88
94
  activateAutomations?: boolean;
95
+ omit?: SyncOmitPolicy;
89
96
  };
90
97
  verdict: 'succeeded' | 'blocked' | 'failed';
91
98
  sourcePull: {