@revoengine/cli 1.0.28 → 1.0.30

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 (75) hide show
  1. package/README.md +160 -3
  2. package/dist/src/automation-contract.generated.d.ts +742 -0
  3. package/dist/src/automation-contract.generated.js +1021 -0
  4. package/dist/src/cli.js +9 -1
  5. package/dist/src/client.d.ts +28 -4
  6. package/dist/src/client.js +60 -0
  7. package/dist/src/commands/component.js +52 -22
  8. package/dist/src/commands/env.js +1 -1
  9. package/dist/src/commands/index.d.ts +2 -0
  10. package/dist/src/commands/index.js +2 -0
  11. package/dist/src/commands/studio.d.ts +3 -0
  12. package/dist/src/commands/studio.js +114 -0
  13. package/dist/src/commands/terminal-browser-human-input.d.ts +11 -0
  14. package/dist/src/commands/terminal-browser-human-input.js +44 -0
  15. package/dist/src/commands/terminal-browser-interaction.d.ts +25 -0
  16. package/dist/src/commands/terminal-browser-interaction.js +56 -0
  17. package/dist/src/commands/terminal-browser-live-protocol.d.ts +151 -0
  18. package/dist/src/commands/terminal-browser-live-protocol.js +177 -0
  19. package/dist/src/commands/terminal-browser-live-transport.d.ts +41 -0
  20. package/dist/src/commands/terminal-browser-live-transport.js +206 -0
  21. package/dist/src/commands/terminal-browser-live.d.ts +114 -0
  22. package/dist/src/commands/terminal-browser-live.js +455 -0
  23. package/dist/src/commands/terminal-browser-observation.d.ts +10 -0
  24. package/dist/src/commands/terminal-browser-observation.js +27 -0
  25. package/dist/src/commands/terminal-browser-page-input.d.ts +8 -0
  26. package/dist/src/commands/terminal-browser-page-input.js +94 -0
  27. package/dist/src/commands/terminal-browser-profile-preferences.d.ts +37 -0
  28. package/dist/src/commands/terminal-browser-profile-preferences.js +136 -0
  29. package/dist/src/commands/terminal-browser-profile.d.ts +52 -0
  30. package/dist/src/commands/terminal-browser-profile.js +447 -0
  31. package/dist/src/commands/terminal-browser.d.ts +28 -1
  32. package/dist/src/commands/terminal-browser.js +401 -55
  33. package/dist/src/commands/terminal-policy.js +2 -0
  34. package/dist/src/commands/terminal-public-web-proxy.d.ts +14 -0
  35. package/dist/src/commands/terminal-public-web-proxy.js +141 -0
  36. package/dist/src/commands/terminal-public-web.d.ts +11 -0
  37. package/dist/src/commands/terminal-public-web.js +99 -0
  38. package/dist/src/commands/terminal.d.ts +1 -0
  39. package/dist/src/commands/terminal.js +92 -9
  40. package/dist/src/commands/tests.d.ts +3 -0
  41. package/dist/src/commands/tests.js +236 -0
  42. package/dist/src/component-element-validation.d.ts +8 -0
  43. package/dist/src/component-element-validation.js +79 -0
  44. package/dist/src/component-lifecycle.d.ts +3 -0
  45. package/dist/src/component-lifecycle.js +17 -0
  46. package/dist/src/component-lock.d.ts +17 -12
  47. package/dist/src/component-lock.js +51 -6
  48. package/dist/src/component-manifests.js +3 -0
  49. package/dist/src/component-source-validation.d.ts +5 -0
  50. package/dist/src/component-source-validation.js +27 -0
  51. package/dist/src/env-sync.js +64 -9
  52. package/dist/src/native-tests.d.ts +61 -0
  53. package/dist/src/native-tests.js +20 -0
  54. package/dist/src/request-contract.d.ts +39 -0
  55. package/dist/src/request-contract.js +138 -0
  56. package/dist/src/resource-syncs/agent-sync.js +47 -7
  57. package/dist/src/resource-syncs/automation-input.d.ts +7 -0
  58. package/dist/src/resource-syncs/automation-input.js +38 -0
  59. package/dist/src/resource-syncs/database-table-sync.js +8 -8
  60. package/dist/src/resource-syncs/endpoint-sync.js +20 -14
  61. package/dist/src/resource-syncs/event-sync.d.ts +2 -1
  62. package/dist/src/resource-syncs/event-sync.js +49 -21
  63. package/dist/src/resource-syncs/group-sync.js +8 -3
  64. package/dist/src/resource-syncs/job-template-sync.js +75 -28
  65. package/dist/src/resource-syncs/role-group-sync.js +8 -0
  66. package/dist/src/resource-syncs/runtime-definition-validation.d.ts +14 -0
  67. package/dist/src/resource-syncs/runtime-definition-validation.js +153 -0
  68. package/dist/src/resource-syncs/schedule-sync.d.ts +2 -1
  69. package/dist/src/resource-syncs/schedule-sync.js +17 -4
  70. package/dist/src/test-workspace.d.ts +33 -0
  71. package/dist/src/test-workspace.js +156 -0
  72. package/dist/src/types.d.ts +8 -2
  73. package/dist/src/ui.js +12 -0
  74. package/dist/src/update-notifier.d.ts +1 -1
  75. package/package.json +5 -3
@@ -0,0 +1,153 @@
1
+ import { requestContractDefaults, validateRequestContract } from "../request-contract.js";
2
+ import { isRecord } from "./util.js";
3
+ /** Matches the Endpoint DTO transform, so accepted normalized routes also verify on readback. */
4
+ export function normalizeEndpointPath(value) {
5
+ const normalized = value.replace(/\/{2,}/g, '/');
6
+ return normalized.length > 1 && normalized.endsWith('/') ? normalized.slice(0, -1) : normalized;
7
+ }
8
+ /** Endpoint create and update normalize nullable/zero memory and result references. */
9
+ export function canonicalEndpointOptionDefaults(value) {
10
+ if (value === undefined)
11
+ return undefined;
12
+ const normalized = { ...value };
13
+ if (normalized.input === null)
14
+ normalized.input = {};
15
+ if (normalized.memory === null || normalized.memory === 0)
16
+ normalized.memory = requestContractDefaults.endpoint.optionDefaults.memory;
17
+ if (typeof normalized.popResult === 'string')
18
+ normalized.popResult = `${normalized.popResult.charAt(0).toUpperCase()}${normalized.popResult.slice(1)}`;
19
+ for (const [key, defaultValue] of Object.entries(requestContractDefaults.endpoint.optionDefaults)) {
20
+ if (JSON.stringify(normalized[key]) === JSON.stringify(defaultValue))
21
+ delete normalized[key];
22
+ }
23
+ return Object.keys(normalized).length > 0 ? normalized : undefined;
24
+ }
25
+ /** Job create/update materialize nullable concurrency fields and the complete retry policy. */
26
+ export function canonicalJobRuntimeOptionDefaults(value) {
27
+ const normalized = { ...value };
28
+ if (normalized.input === null)
29
+ normalized.input = {};
30
+ for (const [key, defaultValue] of Object.entries(requestContractDefaults.job.optionDefaults)) {
31
+ // Input/legacy-input precedence is handled by the owning portable hash.
32
+ // Missing memory falls back to runtime inputs (then 128), while every explicit
33
+ // value overrides those inputs. Even 256 is not a portable default.
34
+ if (key === 'memory')
35
+ continue;
36
+ if (!['input', 'concurrency'].includes(key) && normalized[key] === defaultValue)
37
+ delete normalized[key];
38
+ }
39
+ if (normalized.concurrency === null)
40
+ delete normalized.concurrency;
41
+ if (isRecord(normalized.concurrency)) {
42
+ const concurrency = { ...normalized.concurrency };
43
+ for (const key of ['key', 'limit', 'ttl'])
44
+ if (concurrency[key] === null || concurrency[key] === '')
45
+ delete concurrency[key];
46
+ if (Object.keys(concurrency).length === 0)
47
+ delete normalized.concurrency;
48
+ else
49
+ normalized.concurrency = concurrency;
50
+ }
51
+ if (normalized.retry === null)
52
+ delete normalized.retry;
53
+ if (isRecord(normalized.retry)) {
54
+ const retry = { ...normalized.retry };
55
+ if (retry.enabled === null)
56
+ retry.enabled = false;
57
+ if (retry.bypassConcurrencyOnRetry === null)
58
+ retry.bypassConcurrencyOnRetry = false;
59
+ if (retry.maxDoublings === null)
60
+ retry.maxDoublings = 0;
61
+ for (const [key, defaultValue] of Object.entries(requestContractDefaults.retry))
62
+ if (retry[key] === defaultValue)
63
+ delete retry[key];
64
+ if (Object.keys(retry).length === 0)
65
+ delete normalized.retry;
66
+ else
67
+ normalized.retry = retry;
68
+ }
69
+ return normalized;
70
+ }
71
+ function requestFields(manifest) {
72
+ return Object.fromEntries(['name', 'category', 'metadata', 'timeout', 'options', 'inputs']
73
+ .filter(field => manifest[field] !== undefined).map(field => [field, manifest[field]]));
74
+ }
75
+ /** Request DTO constraints plus the API's local static guard and schema-binding policy. */
76
+ export function endpointDefinitionErrors(manifest) {
77
+ const route = isRecord(manifest.route) ? manifest.route : {};
78
+ const body = { ...requestFields(manifest),
79
+ ...(manifest.description === undefined ? {} : { desc: manifest.description }),
80
+ method: route.method, path: typeof route.path === 'string' ? normalizeEndpointPath(route.path) : route.path };
81
+ const errors = validateRequestContract('EndpointRequestDto', body, { partial: true, path: 'Endpoint' });
82
+ if (typeof body.path === 'string' && body.path.split('/').filter(Boolean).length > requestContractDefaults.endpoint.maxPathSegments) {
83
+ errors.push(`Endpoint.path must contain at most ${requestContractDefaults.endpoint.maxPathSegments} segments`);
84
+ }
85
+ if (isRecord(manifest.schema) && manifest.schema.element !== undefined) {
86
+ errors.push(...validateRequestContract('EndpointOptionsDto', { componentSchemaElement: manifest.schema.element }, { path: 'Endpoint.options' }));
87
+ }
88
+ const options = isRecord(manifest.options) ? manifest.options : {};
89
+ if (options.guard && manifest.schema)
90
+ errors.push('Endpoint static guard and schema component cannot be configured together');
91
+ // Full schema compilation remains owned by Sandbox; these are the API's root envelope semantics.
92
+ if (isRecord(options.guard)) {
93
+ const schema = isRecord(options.guard.schema) ? options.guard.schema : undefined;
94
+ if (schema?.type !== 'object' || !Array.isArray(schema.objectSchema))
95
+ errors.push('Endpoint.options.guard.schema must be an object with objectSchema entries');
96
+ else {
97
+ if (schema.objectSchema.length > requestContractDefaults.guard.maxNodes)
98
+ errors.push('Endpoint.options.guard.schema exceeds its structural budget');
99
+ const seen = new Set();
100
+ const rootTypes = { query: 'object', headers: 'object', parameters: 'object', body: null };
101
+ for (const entry of schema.objectSchema) {
102
+ if (!isRecord(entry) || typeof entry.property !== 'string') {
103
+ errors.push('Endpoint.options.guard root entries must declare a string property');
104
+ continue;
105
+ }
106
+ if (!Object.hasOwn(rootTypes, entry.property))
107
+ errors.push(`Endpoint.options.guard property "${entry.property}" must be query, headers, parameters or body`);
108
+ else if (rootTypes[entry.property] && (!isRecord(entry.schema) || ![rootTypes[entry.property], 'any'].includes(String(entry.schema.type))))
109
+ errors.push(`Endpoint.options.guard property "${entry.property}" must use type object or any`);
110
+ if (seen.has(entry.property))
111
+ errors.push(`Endpoint.options.guard property "${entry.property}" is duplicated`);
112
+ seen.add(entry.property);
113
+ }
114
+ const pending = [{ value: schema, depth: 0 }];
115
+ let visited = 0;
116
+ while (pending.length) {
117
+ const item = pending.pop();
118
+ if (++visited > requestContractDefaults.guard.maxNodes || item.depth > requestContractDefaults.guard.maxDepth) {
119
+ errors.push('Endpoint.options.guard.schema exceeds its structural budget');
120
+ break;
121
+ }
122
+ if (item.value.regex !== undefined && typeof item.value.regex !== 'string')
123
+ errors.push('Endpoint.options.guard.schema regex must be a string');
124
+ if (Array.isArray(item.value.objectSchema))
125
+ for (const entry of item.value.objectSchema) {
126
+ if (isRecord(entry) && isRecord(entry.schema))
127
+ pending.push({ value: entry.schema, depth: item.depth + 1 });
128
+ }
129
+ if (isRecord(item.value.arraySchema))
130
+ pending.push({ value: item.value.arraySchema, depth: item.depth + 1 });
131
+ }
132
+ }
133
+ }
134
+ return errors;
135
+ }
136
+ /** The runtime normalizes nullable option containers, then validates effective retry backoff. */
137
+ export function jobTemplateDefinitionErrors(manifest) {
138
+ const body = { ...requestFields(manifest), ...(manifest.description === undefined ? {} : { desc: manifest.description }) };
139
+ const errors = validateRequestContract('JobTemplateRequestDto', body, { partial: true, path: 'JobTemplate' });
140
+ const options = isRecord(manifest.options) ? manifest.options : {};
141
+ if (isRecord(options.retry)) {
142
+ const effective = { ...requestContractDefaults.retry, ...options.retry };
143
+ // The runtime uses Number(null)=0 for these fields: null is not an omitted/default backoff.
144
+ if (effective.minBackoffSeconds === null)
145
+ errors.push('JobTemplate.options.retry.minBackoffSeconds must be at least 1');
146
+ if (effective.maxBackoffSeconds === null)
147
+ errors.push('JobTemplate.options.retry.maxBackoffSeconds must be at least 60');
148
+ if (typeof effective.minBackoffSeconds === 'number' && typeof effective.maxBackoffSeconds === 'number'
149
+ && effective.minBackoffSeconds > effective.maxBackoffSeconds)
150
+ errors.push('JobTemplate.options.retry.minBackoffSeconds must be less than or equal to maxBackoffSeconds');
151
+ }
152
+ return errors;
153
+ }
@@ -1,5 +1,6 @@
1
1
  import { type FieldChange } from '../diff-details.ts';
2
2
  import type { RevoClient } from '../client.ts';
3
+ import type { AutomationRuntimeInputFields } from '../types.ts';
3
4
  export declare const SCHEDULES_DIRECTORY = "Schedules";
4
5
  export declare const SCHEDULE_MANIFEST_FILE = "schedule.json";
5
6
  export type JobTemplateScheduleTarget = {
@@ -12,7 +13,7 @@ export type MaterializedViewScheduleTarget = {
12
13
  refreshMode: 'CONCURRENT' | 'BLOCKING';
13
14
  };
14
15
  export type ScheduleTarget = JobTemplateScheduleTarget | MaterializedViewScheduleTarget;
15
- export type ScheduleManifest = {
16
+ export type ScheduleManifest = AutomationRuntimeInputFields & {
16
17
  kind: 'schedule';
17
18
  stableKey: string;
18
19
  name: string;
@@ -3,6 +3,7 @@ import { describeFieldChanges } from "../diff-details.js";
3
3
  import { hashStable, readComponentLock, writeComponentLock } from "../component-lock.js";
4
4
  import { NULL_CATEGORY_KEY, normalizeStableKeyValue, readConfiguredResourceMetadataStableKey, sanitizeUserMetadata } from "../resource-metadata.js";
5
5
  import { isValidNormalizedCron, normalizeCron, readJsonFile, sanitizeSegment } from "../utils.js";
6
+ import { automationInputError, automationInputHashFields, readAutomationInput } from "./automation-input.js";
6
7
  import { findManifestFiles, isRecord, localTargetPath, mapWithConcurrency, removeRelocatedManifest, requireProjectLayout, stableKeySuffix, toPortableRelativePath, unwrapData, writePulledManifest, } from "./util.js";
7
8
  export const SCHEDULES_DIRECTORY = 'Schedules';
8
9
  export const SCHEDULE_MANIFEST_FILE = 'schedule.json';
@@ -97,7 +98,7 @@ function isValidNormalizedIanaTimezone(value) {
97
98
  }
98
99
  function validManifest(manifest, stableKeyName, { validateDiagnostics = true } = {}) {
99
100
  if (!isRecord(manifest) || !hasOnlyKeys(manifest, new Set([
100
- 'kind', 'stableKey', 'name', 'category', 'description', 'metadata', 'cron', 'timezone', 'target', 'sourceTargetConfig', 'activationCandidate',
101
+ 'kind', 'stableKey', 'name', 'category', 'description', 'metadata', 'cron', 'timezone', 'input', 'inputMode', 'target', 'sourceTargetConfig', 'activationCandidate',
101
102
  ]))) {
102
103
  return false;
103
104
  }
@@ -130,6 +131,9 @@ function validManifest(manifest, stableKeyName, { validateDiagnostics = true } =
130
131
  if (!validJobTemplateTarget && !validMaterializedViewTarget) {
131
132
  return false;
132
133
  }
134
+ if (automationInputError(manifest)) {
135
+ return false;
136
+ }
133
137
  if (!validateDiagnostics) {
134
138
  return readConfiguredResourceMetadataStableKey(manifest, stableKeyName) === manifest.stableKey;
135
139
  }
@@ -152,6 +156,7 @@ function manifestFromRecord(input) {
152
156
  metadata: canonicalMetadata(record, stableKeyName, stableKey),
153
157
  cron: normalizeCron(String(record.cron || '')),
154
158
  timezone: normalizeTimezone(String(record.timezone || '')),
159
+ ...readAutomationInput(record),
155
160
  target,
156
161
  ...(target.type === 'JOB_TEMPLATE' && record.targetConfig !== undefined
157
162
  ? { sourceTargetConfig: canonicalValue(record.targetConfig) }
@@ -171,6 +176,7 @@ export function hashPortableSchedule(manifest) {
171
176
  cron: manifest.cron,
172
177
  timezone: manifest.timezone,
173
178
  target: canonicalValue(manifest.target),
179
+ ...automationInputHashFields(manifest),
174
180
  });
175
181
  }
176
182
  /** Local baseline shape. It deliberately includes editable/source-only pull data. */
@@ -303,6 +309,8 @@ function scheduleHint(value) {
303
309
  return normalizeStableKeyValue(`${category}/${String(value.name || '')}`);
304
310
  }
305
311
  function diffSchedules(desired, target) {
312
+ const desiredInput = readAutomationInput(desired);
313
+ const targetInput = readAutomationInput(target);
306
314
  const fields = [
307
315
  ['name', desired.name, target.name],
308
316
  ['category', desired.category ?? null, target.category ?? null],
@@ -310,6 +318,8 @@ function diffSchedules(desired, target) {
310
318
  ['metadata', canonicalValue(desired.metadata), canonicalValue(target.metadata)],
311
319
  ['cron', desired.cron, target.cron],
312
320
  ['timezone', desired.timezone, target.timezone],
321
+ ['input', desiredInput.input, targetInput.input],
322
+ ['inputMode', desiredInput.inputMode, targetInput.inputMode],
313
323
  ['target', canonicalValue(desired.target), canonicalValue(target.target)],
314
324
  ];
315
325
  return fields
@@ -404,13 +414,14 @@ export async function buildSchedulesPlan(input) {
404
414
  for (const entry of localEntries) {
405
415
  const rawManifest = entry.manifest;
406
416
  if (!validManifest(rawManifest, input.stableKeyName, { validateDiagnostics: false })) {
407
- blockers.push(`Invalid Schedule manifest ${path.relative(projectRoot, entry.manifestPath)}.`);
417
+ const reason = isRecord(rawManifest) ? automationInputError(rawManifest) : undefined;
418
+ blockers.push(`Invalid Schedule manifest ${path.relative(projectRoot, entry.manifestPath)}${reason ? `: ${reason}` : ''}.`);
408
419
  items.push({
409
420
  status: 'conflict',
410
421
  name: isRecord(rawManifest) && isNonEmptyString(rawManifest.name)
411
422
  ? rawManifest.name
412
423
  : path.basename(path.dirname(entry.manifestPath)),
413
- reason: 'invalid Schedule manifest',
424
+ reason: reason || 'invalid Schedule manifest',
414
425
  blocked: true,
415
426
  });
416
427
  continue;
@@ -713,7 +724,7 @@ export async function buildSchedulesPlan(input) {
713
724
  const desiredActive = desired.activationCandidate;
714
725
  const currentActive = target.record.active === true;
715
726
  const activationDiffers = typeof desiredActive === 'boolean' && desiredActive !== currentActive;
716
- const fieldChanges = describeFieldChanges(desired, target.manifest, changedFields);
727
+ const fieldChanges = describeFieldChanges({ ...desired, ...readAutomationInput(desired) }, target.manifest, changedFields);
717
728
  if (activationDiffers) {
718
729
  changedFields.push('active');
719
730
  fieldChanges.push(...describeFieldChanges({ active: desiredActive }, { active: currentActive }, ['active']));
@@ -1007,6 +1018,7 @@ function buildScheduleCreatePayload(manifest, targetId) {
1007
1018
  targetConfig: { kind: 'refresh_materialized_view', refreshMode: manifest.target.refreshMode },
1008
1019
  };
1009
1020
  return {
1021
+ ...readAutomationInput(manifest),
1010
1022
  name: manifest.name,
1011
1023
  ...(manifest.category === undefined || manifest.category === null ? {} : { category: manifest.category }),
1012
1024
  active: false,
@@ -1026,6 +1038,7 @@ function buildScheduleUpdatePayload(manifest, targetId, version) {
1026
1038
  targetConfig: { kind: 'refresh_materialized_view', refreshMode: manifest.target.refreshMode },
1027
1039
  };
1028
1040
  return {
1041
+ ...readAutomationInput(manifest),
1029
1042
  name: manifest.name,
1030
1043
  category: manifest.category ?? null,
1031
1044
  desc: manifest.description ?? '',
@@ -0,0 +1,33 @@
1
+ export type NativeTestSource = {
2
+ name: string;
3
+ type: string;
4
+ active: boolean;
5
+ category?: string | null;
6
+ desc?: string | null;
7
+ metadata?: Record<string, unknown>;
8
+ testConfig?: Record<string, unknown> | null;
9
+ elements: Array<{
10
+ key: string;
11
+ details: string;
12
+ order: number;
13
+ desc?: string | null;
14
+ hidden?: boolean;
15
+ metadata?: Record<string, unknown>;
16
+ }>;
17
+ };
18
+ export type WorkspaceNativeTest = {
19
+ name: string;
20
+ type: string;
21
+ mode: 'fixture' | 'integration';
22
+ targets: string[];
23
+ category: string | null;
24
+ path: string;
25
+ };
26
+ /** Reads the pulled worktree without writing locks, resolving instance IDs or publishing source. */
27
+ export declare function readNativeTestWorkspace(cwd: string, selectedWorkspace?: string, options?: {
28
+ includeSource?: boolean;
29
+ }): Promise<{
30
+ workspaceRoot: string;
31
+ tests: WorkspaceNativeTest[];
32
+ components: NativeTestSource[];
33
+ }>;
@@ -0,0 +1,156 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { resolveProjectWorkspace } from "./project.js";
4
+ import { sanitizeUserMetadata } from "./resource-metadata.js";
5
+ import { normalizeCustomNodeElementPath } from "./automation-contract.generated.js";
6
+ const CODE_TYPES = new Set([
7
+ 'CODE_JS', 'CODE_TS', 'CODE_JS_LIB', 'CODE_TS_LIB',
8
+ 'CODE_JS_TEST', 'CODE_TS_TEST', 'JSON_VALIDATOR', 'CUSTOM_NODEJS',
9
+ ]);
10
+ const EXCLUDED_DIRECTORIES = new Set(['node_modules', '.git', '.idea', 'dist', 'build']);
11
+ const MAX_WORKSPACE_BYTES = 8 * 1024 * 1024;
12
+ function isRecord(value) {
13
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
14
+ }
15
+ function assertInside(root, target) {
16
+ const relative = path.relative(root, target);
17
+ if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
18
+ throw new Error('Native test source files must stay inside the selected workspace.');
19
+ }
20
+ }
21
+ async function readSourceFile(root, target) {
22
+ const resolved = await fs.realpath(target);
23
+ assertInside(root, resolved);
24
+ const stat = await fs.stat(resolved);
25
+ if (!stat.isFile() || stat.size > MAX_WORKSPACE_BYTES) {
26
+ throw new Error('Native test source must be a file of at most 8 MiB.');
27
+ }
28
+ return fs.readFile(resolved, 'utf8');
29
+ }
30
+ async function manifestPaths(directory) {
31
+ const entries = await fs.readdir(directory, { withFileTypes: true });
32
+ const paths = [];
33
+ for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
34
+ const fullPath = path.join(directory, entry.name);
35
+ if (entry.isDirectory() && !EXCLUDED_DIRECTORIES.has(entry.name)) {
36
+ paths.push(...await manifestPaths(fullPath));
37
+ }
38
+ else if (entry.isFile() && entry.name === 'component.json') {
39
+ paths.push(fullPath);
40
+ }
41
+ }
42
+ return paths;
43
+ }
44
+ async function elementDetails(root, directory, key, order, type, inline) {
45
+ const extension = type.includes('_TS') ? 'ts' : type === 'JSON_VALIDATOR' ? 'json' : 'js';
46
+ const prefix = `${order}_${key}.`;
47
+ if (type === 'CUSTOM_NODEJS' && !normalizeCustomNodeElementPath(key)) {
48
+ throw new Error('Component element has an unsafe Custom Node file path.');
49
+ }
50
+ if (type !== 'CUSTOM_NODEJS' && (key.includes('/') || key.includes('\\') || key.includes('\0'))) {
51
+ throw new Error('Component element keys cannot contain path separators.');
52
+ }
53
+ for (const folder of ['elements', 'details']) {
54
+ const target = path.join(directory, folder, path.dirname(prefix));
55
+ let entries;
56
+ try {
57
+ entries = await fs.readdir(target, { withFileTypes: true });
58
+ }
59
+ catch (error) {
60
+ if (error.code === 'ENOENT')
61
+ continue;
62
+ throw error;
63
+ }
64
+ const filePrefix = path.basename(prefix);
65
+ const preferred = `${filePrefix}${extension}`;
66
+ const matched = entries.find(entry => entry.name === preferred)
67
+ || entries.sort((left, right) => left.name.localeCompare(right.name)).find(entry => entry.name.startsWith(filePrefix));
68
+ if (matched)
69
+ return readSourceFile(root, path.join(target, matched.name));
70
+ }
71
+ return typeof inline === 'string' ? inline : '';
72
+ }
73
+ function names(value, field) {
74
+ if (value === undefined)
75
+ return [];
76
+ if (!Array.isArray(value) || value.some(name => typeof name !== 'string' || !name.trim())) {
77
+ throw new Error(`Native test ${field} must contain non-empty names.`);
78
+ }
79
+ return [...new Set(value)];
80
+ }
81
+ /** Reads the pulled worktree without writing locks, resolving instance IDs or publishing source. */
82
+ export async function readNativeTestWorkspace(cwd, selectedWorkspace, options = {}) {
83
+ const workspaceRoot = await fs.realpath(path.resolve(cwd, selectedWorkspace || resolveProjectWorkspace(cwd) || '.'));
84
+ const directory = path.join(workspaceRoot, 'Components');
85
+ let manifests;
86
+ try {
87
+ assertInside(workspaceRoot, await fs.realpath(directory));
88
+ manifests = await manifestPaths(directory);
89
+ }
90
+ catch (error) {
91
+ if (error.code === 'ENOENT')
92
+ return { workspaceRoot, tests: [], components: [] };
93
+ throw error;
94
+ }
95
+ const components = [];
96
+ const tests = [];
97
+ const seenNames = new Map();
98
+ let sourceBytes = 0;
99
+ for (const manifestPath of manifests) {
100
+ const manifest = JSON.parse(await readSourceFile(workspaceRoot, manifestPath));
101
+ if (!isRecord(manifest))
102
+ throw new Error(`Invalid component manifest: ${path.relative(workspaceRoot, manifestPath)}.`);
103
+ const type = typeof manifest.type === 'string' ? manifest.type : '';
104
+ if (!CODE_TYPES.has(type))
105
+ continue;
106
+ if (typeof manifest.name !== 'string' || !manifest.name.trim())
107
+ throw new Error('Native test workspace components require a name.');
108
+ const duplicate = seenNames.get(manifest.name);
109
+ if (duplicate)
110
+ throw new Error(`Duplicate Component name "${manifest.name}" in ${duplicate} and ${path.relative(workspaceRoot, manifestPath)}. Native source names must be unique.`);
111
+ seenNames.set(manifest.name, path.relative(workspaceRoot, manifestPath));
112
+ if (!Array.isArray(manifest.elements))
113
+ throw new Error(`Component ${manifest.name} requires elements.`);
114
+ const elements = [];
115
+ for (const element of manifest.elements) {
116
+ if (!isRecord(element) || typeof element.key !== 'string' || !Number.isSafeInteger(element.order)) {
117
+ throw new Error(`Component ${manifest.name} has an invalid element.`);
118
+ }
119
+ elements.push({
120
+ key: element.key,
121
+ order: element.order,
122
+ details: options.includeSource === false ? '' : await elementDetails(workspaceRoot, path.dirname(manifestPath), element.key, element.order, type, element.details),
123
+ ...(typeof element.desc === 'string' || element.desc === null ? { desc: element.desc } : {}),
124
+ ...(typeof element.hidden === 'boolean' ? { hidden: element.hidden } : {}),
125
+ ...(isRecord(element.metadata) ? { metadata: sanitizeUserMetadata(element.metadata) } : {}),
126
+ });
127
+ }
128
+ const testConfig = manifest.testConfig === null || isRecord(manifest.testConfig) ? manifest.testConfig : undefined;
129
+ if (type.endsWith('_TEST') && !isRecord(testConfig))
130
+ throw new Error(`Test ${manifest.name} requires testConfig.`);
131
+ const source = {
132
+ name: manifest.name,
133
+ type,
134
+ active: typeof manifest.active === 'boolean' ? manifest.active : true,
135
+ elements,
136
+ ...(typeof manifest.category === 'string' || manifest.category === null ? { category: manifest.category } : {}),
137
+ ...(typeof manifest.desc === 'string' || manifest.desc === null ? { desc: manifest.desc } : {}),
138
+ ...(isRecord(manifest.metadata) ? { metadata: sanitizeUserMetadata(manifest.metadata) } : {}),
139
+ ...(testConfig !== undefined ? { testConfig } : {}),
140
+ };
141
+ if (options.includeSource !== false) {
142
+ sourceBytes += Buffer.byteLength(JSON.stringify(source));
143
+ if (sourceBytes > MAX_WORKSPACE_BYTES)
144
+ throw new Error('Native test workspace source exceeds 8 MiB.');
145
+ components.push(source);
146
+ if (components.length > 100)
147
+ throw new Error('A native test source overlay supports at most 100 Components.');
148
+ }
149
+ if (type.endsWith('_TEST') && isRecord(testConfig)) {
150
+ if (testConfig.mode !== 'fixture' && testConfig.mode !== 'integration')
151
+ throw new Error(`Test ${manifest.name} has an invalid mode.`);
152
+ tests.push({ name: manifest.name, type, mode: testConfig.mode, targets: names(testConfig.targets, 'targets'), category: source.category || null, path: path.relative(workspaceRoot, path.dirname(manifestPath)) });
153
+ }
154
+ }
155
+ return { workspaceRoot, tests, components };
156
+ }
@@ -57,6 +57,7 @@ export type ComponentRecord = {
57
57
  metadata?: Record<string, unknown>;
58
58
  metaData?: Record<string, unknown>;
59
59
  resourceMetadata?: Record<string, unknown>;
60
+ testConfig?: Record<string, unknown> | null;
60
61
  elements?: ComponentElementRecord[];
61
62
  [key: string]: unknown;
62
63
  };
@@ -279,7 +280,12 @@ export type JobTemplateRecord = {
279
280
  deletedAt?: string | null;
280
281
  [key: string]: unknown;
281
282
  };
282
- export type ScheduleRecord = {
283
+ export type AutomationInputMode = 'override' | 'deep_override' | 'replace';
284
+ export type AutomationRuntimeInputFields = {
285
+ input?: Record<string, unknown>;
286
+ inputMode?: AutomationInputMode;
287
+ };
288
+ export type ScheduleRecord = AutomationRuntimeInputFields & {
283
289
  scheduleId?: string;
284
290
  id?: string;
285
291
  name?: string;
@@ -302,7 +308,7 @@ export type ScheduleRecord = {
302
308
  deletedBy?: string | null;
303
309
  [key: string]: unknown;
304
310
  };
305
- export type EventRecord = {
311
+ export type EventRecord = AutomationRuntimeInputFields & {
306
312
  jobEventId?: string;
307
313
  eventId?: string;
308
314
  id?: string;
package/dist/src/ui.js CHANGED
@@ -119,6 +119,8 @@ function renderCommandCatalog() {
119
119
  '',
120
120
  paintHeader('Terminal'),
121
121
  commandRow('revo terminal connect --workspace <path> --name <name>', 'Pair and run a local terminal'),
122
+ commandRow('revo terminal connect --browser-profile <name> --workspace <path>', 'Opt in to encrypted browser auth reuse (macOS foreground)'),
123
+ commandRow('revo terminal browser-profile forget --browser-profile <name> --terminal-id <uuid> --workspace <path>', 'Forget a selected local browser auth profile'),
122
124
  commandRow('revo terminal service install --workspace <path>', 'Run an approved terminal in the background on macOS or Linux'),
123
125
  commandRow('revo terminal service uninstall --workspace <path>', 'Stop and remove the background service'),
124
126
  commandRow('revo terminal status', 'Show terminal grants'),
@@ -132,6 +134,15 @@ function renderCommandCatalog() {
132
134
  commandRow('revo component push --all [--project <name>] [--yes] [--force] [--prune] [--changed --base <ref>]', 'Push local components with lock checks'),
133
135
  commandRow('revo component debug <componentId> [BODY] [--read-only=true|false] [--stream]', 'Run one local component in sandbox'),
134
136
  '',
137
+ paintHeader('Native tests'),
138
+ commandRow('revo tests list [--workspace <path>] [--search <name>] [--json]', 'Discover native test suites in the local worktree'),
139
+ commandRow('revo tests list --remote [--search <name>] [--json]', 'Load stored native test Components asynchronously'),
140
+ commandRow('revo tests run <suite names...>|--all [--workspace <path>] [--timeout <seconds>] [--json]', 'Test local source through the host fixture runner without publishing it'),
141
+ commandRow('revo tests run <suite names...>|--all --remote [--json]', 'Run stored fixture suites without a Studio session'),
142
+ commandRow('revo tests run <suite names...> [--no-wait] [--operation-id <uuid>] [--wait-timeout <seconds>]', 'Create a retry-safe run or wait for durable results'),
143
+ commandRow('revo tests resume <runId> [--json]', 'Continue queued execution or retrieve a durable test result'),
144
+ commandRow('revo tests cancel <runId> [--json]', 'Cancel remaining work and collect the host cancellation result'),
145
+ '',
135
146
  paintHeader('Databases'),
136
147
  commandRow('revo database-tables pull --all [--project <name>] [--force] [--strict]', 'Pull portable Database Tables and partitions'),
137
148
  commandRow('revo database-tables plan --all [--project <name>] [--with-stats] [--json] [--strict] [--hints]', 'Preview schema drift, DDL risks, partitions, and performance hints'),
@@ -185,6 +196,7 @@ function renderCommandCatalog() {
185
196
  commandRow('revo migrate plan --from <env> --to <env> [--resources <list>] [--skip-groups] [--force] [--json] [--hints]', 'Preview twelve resource families and identity dependencies'),
186
197
  commandRow('revo migrate run --from <env> --to <env> [--resources <list>] [--skip-groups] --yes [--force] [--json]', 'Pull, plan, migrate, and verify resources in dependency order'),
187
198
  commandRow('revo migrate verify --from <env> --to <env> [--resources <list>] [--json]', 'Verify target resources against a fresh temporary source pull'),
199
+ commandRow('revo studio <action> [sessionId] [--body-file file]', 'Stage, test, review, commit and activate shared Studio sessions'),
188
200
  commandRow('revo search <CODE|SIMPLE> <term>', 'Search code references or all platform content'),
189
201
  commandRow('revo request <METHOD> <PATH> [BODY]', 'Make a raw API request with optional JSON body'),
190
202
  ].join('\n');
@@ -6,7 +6,7 @@ type UpdateNotifierOptions = {
6
6
  now?: number;
7
7
  stream?: NodeJS.WriteStream;
8
8
  };
9
- export declare function compareSemver(left: string, right: string): 0 | 1 | -1;
9
+ export declare function compareSemver(left: string, right: string): 1 | 0 | -1;
10
10
  export declare function renderUpdateNotice(input: {
11
11
  currentVersion: string;
12
12
  latestVersion: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revoengine/cli",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "CLI package for the RevoEngine Platform API",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -11,11 +11,13 @@
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/component-manifests.ts'); await import('./src/planning-snapshot.ts'); await import('./src/workspace-digests.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')\"",
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-lifecycle.ts'); await import('./src/component-element-validation.ts'); await import('./src/component-source-validation.ts'); await import('./src/request-contract.ts'); await import('./src/component-contract.ts'); await import('./src/component-manifests.ts'); await import('./src/planning-snapshot.ts'); await import('./src/workspace-digests.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/studio.ts'); await import('./src/commands/tests.ts'); await import('./src/native-tests.ts'); await import('./src/test-workspace.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",
18
- "postinstall": "playwright-core install --only-shell chromium"
18
+ "postinstall": "playwright-core install --only-shell chromium",
19
+ "generate:automation-contract": "node scripts/generate-automation-contract.ts --write",
20
+ "check:automation-contract": "node scripts/generate-automation-contract.ts"
19
21
  },
20
22
  "files": [
21
23
  "dist/",