@farmslot/recipe-runner 0.23.0
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/CHANGELOG.md +255 -0
- package/LICENSE +21 -0
- package/README.md +274 -0
- package/bin/farmslot-visual-review.mjs +152 -0
- package/dist/adapters/app-lifecycle.d.ts +41 -0
- package/dist/adapters/app-lifecycle.d.ts.map +1 -0
- package/dist/adapters/app-lifecycle.js +224 -0
- package/dist/adapters/app-lifecycle.js.map +1 -0
- package/dist/adapters/core.d.ts +5 -0
- package/dist/adapters/core.d.ts.map +1 -0
- package/dist/adapters/core.js +433 -0
- package/dist/adapters/core.js.map +1 -0
- package/dist/adapters/gesture.d.ts +12 -0
- package/dist/adapters/gesture.d.ts.map +1 -0
- package/dist/adapters/gesture.js +76 -0
- package/dist/adapters/gesture.js.map +1 -0
- package/dist/adapters/ui.d.ts +33 -0
- package/dist/adapters/ui.d.ts.map +1 -0
- package/dist/adapters/ui.js +130 -0
- package/dist/adapters/ui.js.map +1 -0
- package/dist/cli/error-output.d.ts +6 -0
- package/dist/cli/error-output.d.ts.map +1 -0
- package/dist/cli/error-output.js +19 -0
- package/dist/cli/error-output.js.map +1 -0
- package/dist/cli/index.d.ts +12 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +29 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/run-command.d.ts +8 -0
- package/dist/cli/run-command.d.ts.map +1 -0
- package/dist/cli/run-command.js +253 -0
- package/dist/cli/run-command.js.map +1 -0
- package/dist/cli/support.d.ts +31 -0
- package/dist/cli/support.d.ts.map +1 -0
- package/dist/cli/support.js +297 -0
- package/dist/cli/support.js.map +1 -0
- package/dist/cli/validate-command.d.ts +4 -0
- package/dist/cli/validate-command.d.ts.map +1 -0
- package/dist/cli/validate-command.js +52 -0
- package/dist/cli/validate-command.js.map +1 -0
- package/dist/core/compose.d.ts +23 -0
- package/dist/core/compose.d.ts.map +1 -0
- package/dist/core/compose.js +104 -0
- package/dist/core/compose.js.map +1 -0
- package/dist/core/execution.d.ts +44 -0
- package/dist/core/execution.d.ts.map +1 -0
- package/dist/core/execution.js +304 -0
- package/dist/core/execution.js.map +1 -0
- package/dist/core/failure.d.ts +23 -0
- package/dist/core/failure.d.ts.map +1 -0
- package/dist/core/failure.js +43 -0
- package/dist/core/failure.js.map +1 -0
- package/dist/core/graph.d.ts +12 -0
- package/dist/core/graph.d.ts.map +1 -0
- package/dist/core/graph.js +65 -0
- package/dist/core/graph.js.map +1 -0
- package/dist/core/hud.d.ts +11 -0
- package/dist/core/hud.d.ts.map +1 -0
- package/dist/core/hud.js +120 -0
- package/dist/core/hud.js.map +1 -0
- package/dist/core/invocation.d.ts +13 -0
- package/dist/core/invocation.d.ts.map +1 -0
- package/dist/core/invocation.js +68 -0
- package/dist/core/invocation.js.map +1 -0
- package/dist/core/json.d.ts +9 -0
- package/dist/core/json.d.ts.map +1 -0
- package/dist/core/json.js +74 -0
- package/dist/core/json.js.map +1 -0
- package/dist/core/library-manifest.d.ts +53 -0
- package/dist/core/library-manifest.d.ts.map +1 -0
- package/dist/core/library-manifest.js +263 -0
- package/dist/core/library-manifest.js.map +1 -0
- package/dist/core/library.d.ts +80 -0
- package/dist/core/library.d.ts.map +1 -0
- package/dist/core/library.js +321 -0
- package/dist/core/library.js.map +1 -0
- package/dist/core/parameters.d.ts +5 -0
- package/dist/core/parameters.d.ts.map +1 -0
- package/dist/core/parameters.js +57 -0
- package/dist/core/parameters.js.map +1 -0
- package/dist/core/passive-observations.d.ts +25 -0
- package/dist/core/passive-observations.d.ts.map +1 -0
- package/dist/core/passive-observations.js +62 -0
- package/dist/core/passive-observations.js.map +1 -0
- package/dist/core/path.d.ts +7 -0
- package/dist/core/path.d.ts.map +1 -0
- package/dist/core/path.js +147 -0
- package/dist/core/path.js.map +1 -0
- package/dist/core/recording-cleanup.d.ts +10 -0
- package/dist/core/recording-cleanup.d.ts.map +1 -0
- package/dist/core/recording-cleanup.js +32 -0
- package/dist/core/recording-cleanup.js.map +1 -0
- package/dist/core/resolution-error.d.ts +7 -0
- package/dist/core/resolution-error.d.ts.map +1 -0
- package/dist/core/resolution-error.js +9 -0
- package/dist/core/resolution-error.js.map +1 -0
- package/dist/core/runner.d.ts +4 -0
- package/dist/core/runner.d.ts.map +1 -0
- package/dist/core/runner.js +738 -0
- package/dist/core/runner.js.map +1 -0
- package/dist/core/scroll-to.d.ts +111 -0
- package/dist/core/scroll-to.d.ts.map +1 -0
- package/dist/core/scroll-to.js +353 -0
- package/dist/core/scroll-to.js.map +1 -0
- package/dist/core/suite.d.ts +25 -0
- package/dist/core/suite.d.ts.map +1 -0
- package/dist/core/suite.js +76 -0
- package/dist/core/suite.js.map +1 -0
- package/dist/core/trace.d.ts +5 -0
- package/dist/core/trace.d.ts.map +1 -0
- package/dist/core/trace.js +25 -0
- package/dist/core/trace.js.map +1 -0
- package/dist/core/trust-error.d.ts +9 -0
- package/dist/core/trust-error.d.ts.map +1 -0
- package/dist/core/trust-error.js +18 -0
- package/dist/core/trust-error.js.map +1 -0
- package/dist/core/trust-input.d.ts +20 -0
- package/dist/core/trust-input.d.ts.map +1 -0
- package/dist/core/trust-input.js +68 -0
- package/dist/core/trust-input.js.map +1 -0
- package/dist/core/trust.d.ts +28 -0
- package/dist/core/trust.d.ts.map +1 -0
- package/dist/core/trust.js +284 -0
- package/dist/core/trust.js.map +1 -0
- package/dist/core/types.d.ts +319 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/validation.d.ts +4 -0
- package/dist/core/validation.d.ts.map +1 -0
- package/dist/core/validation.js +18 -0
- package/dist/core/validation.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/node/writers.d.ts +27 -0
- package/dist/node/writers.d.ts.map +1 -0
- package/dist/node/writers.js +99 -0
- package/dist/node/writers.js.map +1 -0
- package/dist/recording/android-mirror.d.ts +10 -0
- package/dist/recording/android-mirror.d.ts.map +1 -0
- package/dist/recording/android-mirror.js +180 -0
- package/dist/recording/android-mirror.js.map +1 -0
- package/dist/recording/capture-helper-timing.d.ts +4 -0
- package/dist/recording/capture-helper-timing.d.ts.map +1 -0
- package/dist/recording/capture-helper-timing.js +47 -0
- package/dist/recording/capture-helper-timing.js.map +1 -0
- package/dist/recording/capture-helper.d.ts +10 -0
- package/dist/recording/capture-helper.d.ts.map +1 -0
- package/dist/recording/capture-helper.js +335 -0
- package/dist/recording/capture-helper.js.map +1 -0
- package/dist/recording/cdp-video-recorder.d.ts +9 -0
- package/dist/recording/cdp-video-recorder.d.ts.map +1 -0
- package/dist/recording/cdp-video-recorder.js +319 -0
- package/dist/recording/cdp-video-recorder.js.map +1 -0
- package/dist/recording/frame-sampler.d.ts +19 -0
- package/dist/recording/frame-sampler.d.ts.map +1 -0
- package/dist/recording/frame-sampler.js +29 -0
- package/dist/recording/frame-sampler.js.map +1 -0
- package/dist/recording/timeline.d.ts +15 -0
- package/dist/recording/timeline.d.ts.map +1 -0
- package/dist/recording/timeline.js +88 -0
- package/dist/recording/timeline.js.map +1 -0
- package/dist/runtime/browser-extension.d.ts +17 -0
- package/dist/runtime/browser-extension.d.ts.map +1 -0
- package/dist/runtime/browser-extension.js +42 -0
- package/dist/runtime/browser-extension.js.map +1 -0
- package/dist/runtime/cdp.d.ts +138 -0
- package/dist/runtime/cdp.d.ts.map +1 -0
- package/dist/runtime/cdp.js +1429 -0
- package/dist/runtime/cdp.js.map +1 -0
- package/dist/runtime/decision-types.d.ts +23 -0
- package/dist/runtime/decision-types.d.ts.map +1 -0
- package/dist/runtime/decision-types.js +2 -0
- package/dist/runtime/decision-types.js.map +1 -0
- package/dist/runtime/deps-readiness.d.ts +21 -0
- package/dist/runtime/deps-readiness.d.ts.map +1 -0
- package/dist/runtime/deps-readiness.js +141 -0
- package/dist/runtime/deps-readiness.js.map +1 -0
- package/dist/runtime/log-analysis.d.ts +48 -0
- package/dist/runtime/log-analysis.d.ts.map +1 -0
- package/dist/runtime/log-analysis.js +128 -0
- package/dist/runtime/log-analysis.js.map +1 -0
- package/dist/runtime/metro-probe.d.ts +5 -0
- package/dist/runtime/metro-probe.d.ts.map +1 -0
- package/dist/runtime/metro-probe.js +24 -0
- package/dist/runtime/metro-probe.js.map +1 -0
- package/dist/runtime/operation.d.ts +32 -0
- package/dist/runtime/operation.d.ts.map +1 -0
- package/dist/runtime/operation.js +184 -0
- package/dist/runtime/operation.js.map +1 -0
- package/dist/runtime/orchestrate-up.d.ts +22 -0
- package/dist/runtime/orchestrate-up.d.ts.map +1 -0
- package/dist/runtime/orchestrate-up.js +35 -0
- package/dist/runtime/orchestrate-up.js.map +1 -0
- package/dist/runtime/react-native-bridge.d.ts +17 -0
- package/dist/runtime/react-native-bridge.d.ts.map +1 -0
- package/dist/runtime/react-native-bridge.js +57 -0
- package/dist/runtime/react-native-bridge.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +8 -0
- package/dist/version.js.map +1 -0
- package/package.json +163 -0
- package/test/fixtures/scroll-to-visible/README.md +39 -0
- package/visual-review/feedback-draft.mjs +82 -0
- package/visual-review/index.d.mts +41 -0
- package/visual-review/index.mjs +4 -0
- package/visual-review/recipe-board.mjs +142 -0
- package/visual-review/review-board.mjs +981 -0
- package/visual-review/server.mjs +69 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { RecipeExecutionError } from '../core/failure.js';
|
|
2
|
+
import { isRecord } from '../core/json.js';
|
|
3
|
+
import { parseUiScrollToRequest, runUiScrollTo, UiScrollToError, uiScrollToRequestSummary, } from '../core/scroll-to.js';
|
|
4
|
+
export const STANDARD_UI_ACTIONS = [
|
|
5
|
+
'ui.navigate',
|
|
6
|
+
'ui.press',
|
|
7
|
+
'ui.key_press',
|
|
8
|
+
'ui.set_input',
|
|
9
|
+
'ui.scroll',
|
|
10
|
+
'ui.scroll_to',
|
|
11
|
+
'ui.swipe',
|
|
12
|
+
'ui.pan',
|
|
13
|
+
'ui.drag',
|
|
14
|
+
'ui.long_press',
|
|
15
|
+
'ui.wait_for',
|
|
16
|
+
'ui.screenshot',
|
|
17
|
+
'ui.capture_surface',
|
|
18
|
+
'app.status',
|
|
19
|
+
'app.lifecycle',
|
|
20
|
+
'app.hud',
|
|
21
|
+
'app.trace',
|
|
22
|
+
];
|
|
23
|
+
export function createStandardUiAdapters(options) {
|
|
24
|
+
const requestedActions = options.actions ? new Set(options.actions) : null;
|
|
25
|
+
return STANDARD_UI_ACTIONS.filter((action) => !requestedActions || requestedActions.has(action)).map((action) => ({
|
|
26
|
+
action,
|
|
27
|
+
source: {
|
|
28
|
+
kind: 'bundled',
|
|
29
|
+
trust: 'trusted',
|
|
30
|
+
name: '@farmslot/recipe-runner',
|
|
31
|
+
},
|
|
32
|
+
async execute(node, context) {
|
|
33
|
+
if (action === 'ui.screenshot' &&
|
|
34
|
+
node.fullPage !== true &&
|
|
35
|
+
context.captureRecordingSnapshot) {
|
|
36
|
+
const file = typeof node.path === 'string'
|
|
37
|
+
? node.path
|
|
38
|
+
: `screenshots/${context.nodeId.replaceAll('/', '-')}.png`;
|
|
39
|
+
const capture = await context.captureRecordingSnapshot(file);
|
|
40
|
+
const artifact = {
|
|
41
|
+
path: file,
|
|
42
|
+
type: 'screenshot',
|
|
43
|
+
mimeType: 'image/png',
|
|
44
|
+
nodeId: context.nodeId,
|
|
45
|
+
label: typeof node.label === 'string' ? node.label : context.nodeId,
|
|
46
|
+
category: typeof node.category === 'string' ? node.category : 'evidence',
|
|
47
|
+
...(Array.isArray(node.covers) ? { covers: node.covers } : {}),
|
|
48
|
+
...(typeof node.proofTarget === 'string' ? { proofTarget: node.proofTarget } : {}),
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
output: { ...capture, captured: true, path: file, artifact },
|
|
52
|
+
artifacts: [artifact],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (action === 'ui.scroll_to')
|
|
56
|
+
return executeScrollTo(options.transport, node, context);
|
|
57
|
+
if (action === 'ui.scroll')
|
|
58
|
+
assertScrollMovement(node);
|
|
59
|
+
return normalizeUiTransportResult(await options.transport.execute(action, node, context));
|
|
60
|
+
},
|
|
61
|
+
async observe(refs, node, context) {
|
|
62
|
+
if (!options.transport.observe) {
|
|
63
|
+
return {
|
|
64
|
+
warnings: refs.map((ref) => ({
|
|
65
|
+
ref,
|
|
66
|
+
message: `UI transport does not implement passive observer ${ref}.`,
|
|
67
|
+
})),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return options.transport.observe(refs, node, context);
|
|
71
|
+
},
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
async function executeScrollTo(transport, node, context) {
|
|
75
|
+
const request = parseUiScrollToRequest(node);
|
|
76
|
+
if (!transport.withScrollSession) {
|
|
77
|
+
throw new UiScrollToError('SCROLL_UNSUPPORTED', 'this UI transport does not implement withScrollSession.', uiScrollToRequestSummary(request));
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
return {
|
|
81
|
+
output: await transport.withScrollSession(request, node, context, (session) => runUiScrollTo(request, session)),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
// Provider errors raised before a session exists (for example a held device lock) carry
|
|
86
|
+
// only backend details; attach the request so the trace names the node's proof target.
|
|
87
|
+
if (error instanceof UiScrollToError) {
|
|
88
|
+
throw new UiScrollToError(error.code, error.reason, {
|
|
89
|
+
...uiScrollToRequestSummary(request),
|
|
90
|
+
...(isRecord(error.details) ? error.details : {}),
|
|
91
|
+
}, { cause: error });
|
|
92
|
+
}
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/** ui.scroll is raw movement only: offset_* sets an absolute position, delta_* moves relative to it. */
|
|
97
|
+
function assertScrollMovement(node) {
|
|
98
|
+
const absolute = node.offset_x !== undefined || node.offset_y !== undefined;
|
|
99
|
+
const relative = node.delta_x !== undefined || node.delta_y !== undefined;
|
|
100
|
+
if (absolute && relative) {
|
|
101
|
+
throw new RecipeExecutionError('harness', 'ui.scroll accepts offset_x/offset_y (absolute) or delta_x/delta_y (relative), not both.');
|
|
102
|
+
}
|
|
103
|
+
if ((absolute || relative) && (node.scroll_into_view === true || node.into_view === true)) {
|
|
104
|
+
throw new RecipeExecutionError('harness', 'ui.scroll cannot combine scroll_into_view with raw movement; use ui.scroll_to to reveal a target.');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export function normalizeUiTransportResult(result) {
|
|
108
|
+
if (isUiTransportResult(result)) {
|
|
109
|
+
const output = result.settlementWarning === undefined
|
|
110
|
+
? result.output
|
|
111
|
+
: typeof result.output === 'object' &&
|
|
112
|
+
result.output !== null &&
|
|
113
|
+
!Array.isArray(result.output)
|
|
114
|
+
? { ...result.output, settlementWarning: result.settlementWarning }
|
|
115
|
+
: { result: result.output, settlementWarning: result.settlementWarning };
|
|
116
|
+
return {
|
|
117
|
+
case: result.control?.case,
|
|
118
|
+
artifacts: result.control?.artifacts,
|
|
119
|
+
output,
|
|
120
|
+
phases: result.phases,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return { output: result ?? { ok: true } };
|
|
124
|
+
}
|
|
125
|
+
function isUiTransportResult(value) {
|
|
126
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
127
|
+
return false;
|
|
128
|
+
return value.kind === 'ui-transport-result';
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/adapters/ui.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,sB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iB,EAAE,CAAC;QAC/E,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI;YAC1B,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,SAAS;YACpC,MAAM;YACN,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC;AAC5C,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAc;IACzC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9E,OAAQ,KAA4B,CAAC,IAAI,KAAK,qBAAqB,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RecipeResolutionError } from '../core/resolution-error.js';
|
|
2
|
+
import { RecipeTrustError } from '../core/trust-error.js';
|
|
3
|
+
export type RecipeCliError = RecipeResolutionError | RecipeTrustError;
|
|
4
|
+
export declare function isRecipeCliError(error: unknown): error is RecipeCliError;
|
|
5
|
+
export declare function reportRecipeCliError(error: RecipeCliError, json: boolean): void;
|
|
6
|
+
//# sourceMappingURL=error-output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-output.d.ts","sourceRoot":"","sources":["../../src/cli/error-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,MAAM,cAAc,GAAG,qBAAqB,GAAG,gBAAgB,CAAC;AAEtE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAiB/E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RecipeResolutionError } from '../core/resolution-error.js';
|
|
2
|
+
import { RecipeTrustError } from '../core/trust-error.js';
|
|
3
|
+
export function isRecipeCliError(error) {
|
|
4
|
+
return error instanceof RecipeResolutionError || error instanceof RecipeTrustError;
|
|
5
|
+
}
|
|
6
|
+
export function reportRecipeCliError(error, json) {
|
|
7
|
+
if (json) {
|
|
8
|
+
console.log(JSON.stringify(error instanceof RecipeTrustError
|
|
9
|
+
? error.failure
|
|
10
|
+
: { code: error.code, message: error.message, userAction: error.userAction }, null, 2));
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
console.error(`Error [${error.code}]: ${error.message}`);
|
|
14
|
+
console.error(`Next: ${error.userAction}`);
|
|
15
|
+
}
|
|
16
|
+
// A malformed --library or RECIPE_LIBRARY_PATH entry is a usage error, as in discovery.
|
|
17
|
+
process.exitCode = error.code === 'RECIPE_LIBRARY_PATH_INVALID' ? 2 : 1;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=error-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-output.js","sourceRoot":"","sources":["../../src/cli/error-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,KAAK,YAAY,qBAAqB,IAAI,KAAK,YAAY,gBAAgB,CAAC;AACrF,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAqB,EAAE,IAAa;IACvE,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,SAAS,CACZ,KAAK,YAAY,gBAAgB;YAC/B,CAAC,CAAC,KAAK,CAAC,OAAO;YACf,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,EAC9E,IAAI,EACJ,CAAC,CACF,CACF,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACzD,OAAO,CAAC,KAAK,CAAC,SAAS,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;IAC7C,CAAC;IACD,wFAAwF;IACxF,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC,IAAI,KAAK,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
export interface RecipeRunnerCliOptions {
|
|
3
|
+
commandName?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
/** Version printed by --version; a host CLI reports its own. */
|
|
6
|
+
version?: string;
|
|
7
|
+
/** Package versions the host provides, checked against each library's `requires`. */
|
|
8
|
+
packageVersions?: Readonly<Record<string, string>>;
|
|
9
|
+
}
|
|
10
|
+
export declare function createRecipeRunnerProgram(options?: RecipeRunnerCliOptions): Command;
|
|
11
|
+
export declare function runRecipeRunnerCli(argv: string[], options?: RecipeRunnerCliOptions): Promise<void>;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,MAAM,WAAW,sBAAsB;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qFAAqF;IACrF,eAAe,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACpD;AAED,wBAAgB,yBAAyB,CAAC,OAAO,GAAE,sBAA2B,GAAG,OAAO,CAWvF;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,IAAI,CAAC,CAEf"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { pathToFileURL } from 'node:url';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { RECIPE_RUNNER_VERSION } from '../version.js';
|
|
4
|
+
import { registerRunCommand } from './run-command.js';
|
|
5
|
+
import { registerValidateCommand } from './validate-command.js';
|
|
6
|
+
export function createRecipeRunnerProgram(options = {}) {
|
|
7
|
+
const program = new Command();
|
|
8
|
+
program
|
|
9
|
+
.name(options.commandName ?? 'farmslot-recipe')
|
|
10
|
+
.description(options.description ?? 'Farmslot v1 recipe runner CLI')
|
|
11
|
+
.version(options.version ?? RECIPE_RUNNER_VERSION);
|
|
12
|
+
const context = options.packageVersions ? { packageVersions: options.packageVersions } : {};
|
|
13
|
+
registerValidateCommand(program, context);
|
|
14
|
+
registerRunCommand(program, context);
|
|
15
|
+
return program;
|
|
16
|
+
}
|
|
17
|
+
export async function runRecipeRunnerCli(argv, options = {}) {
|
|
18
|
+
await createRecipeRunnerProgram(options).parseAsync(argv, { from: 'user' });
|
|
19
|
+
}
|
|
20
|
+
// No top-level await: this module is a library entry too, and a CommonJS consumer can only
|
|
21
|
+
// require() an ES module that loads synchronously.
|
|
22
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
23
|
+
runRecipeRunnerCli(process.argv.slice(2)).catch((error) => {
|
|
24
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
25
|
+
console.error(message);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
});
|
|
28
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,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/E,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACjE,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Command } from 'commander';
|
|
2
|
+
import { type RecipePackageVersions } from '../core/library-manifest.js';
|
|
3
|
+
export interface RecipeCliCommandContext {
|
|
4
|
+
/** Package versions the host CLI provides for checking each library's `requires`. */
|
|
5
|
+
packageVersions?: RecipePackageVersions;
|
|
6
|
+
}
|
|
7
|
+
export declare function registerRunCommand(program: Command, context?: RecipeCliCommandContext): void;
|
|
8
|
+
//# sourceMappingURL=run-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-command.d.ts","sourceRoot":"","sources":["../../src/cli/run-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBzC,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,6BAA6B,CAAC;AAsCrC,MAAM,WAAW,uBAAuB;IACtC,qFAAqF;IACrF,eAAe,CAAC,EAAE,qBAAqB,CAAC;CACzC;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,uBAA4B,GAAG,IAAI,CA8JhG"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { getRecipeActionManifestActionNames, isRecord, } from '@farmslot/protocol';
|
|
2
|
+
import { createStandardCoreAdapters } from '../adapters/core.js';
|
|
3
|
+
import { applyTaskLocalInvocationTrust, findLibraryRecipe, loadRecipeLibraries, resolveRecipeLibrarySources, } from '../core/library.js';
|
|
4
|
+
import { digestRecipeLibrary, readRecipeLibraryManifest, } from '../core/library-manifest.js';
|
|
5
|
+
import { createRecipeRunner } from '../core/runner.js';
|
|
6
|
+
import { resolveRecipeTrustInput } from '../core/trust-input.js';
|
|
7
|
+
import { isRecipeCliError, reportRecipeCliError } from './error-output.js';
|
|
8
|
+
import { parsePositiveInteger, parseRecipeParamAssignments, parseRecordingTarget, readRecipeCliJsonFile, resolveRecipeCliPath, } from './support.js';
|
|
9
|
+
export function registerRunCommand(program, context = {}) {
|
|
10
|
+
program
|
|
11
|
+
.command('run')
|
|
12
|
+
.description('Run a recipe and write a v1 artifact package')
|
|
13
|
+
.argument('[recipe]', 'Recipe ref, platform alias or <library>.<ref> id from the active libraries, or a recipe.json path')
|
|
14
|
+
.argument('[params...]', 'Recipe parameters as key=value')
|
|
15
|
+
.option('--artifacts-dir <dir>', 'Directory where artifacts are written')
|
|
16
|
+
.option('--action-manifest <manifest>', 'Runner action manifest JSON')
|
|
17
|
+
.option('--project-root <dir>', 'Project root used by command/artifact adapters')
|
|
18
|
+
.option('--library <entry>', 'Recipe library source as name=path or path (repeatable; earlier wins). Entries go before RECIPE_LIBRARY_PATH and replace its entry with the same name; the personal library is used only when neither is set.', collectRepeatable, [])
|
|
19
|
+
.option('--record-video [mode]', 'Record one whole-recipe MP4 when visual motion proof helps')
|
|
20
|
+
.option('--record-max-fps <fps>', 'Maximum video frame rate')
|
|
21
|
+
.option('--record-max-size <px>', 'Maximum recorded video dimension')
|
|
22
|
+
.option('--record-app-name <name>', 'macOS app name for recording target')
|
|
23
|
+
.option('--record-window-name <substring>', 'macOS window title substring for recording target')
|
|
24
|
+
.option('--record-window-id <id>', 'macOS window id from `capture-helper list --json`')
|
|
25
|
+
.option('--record-pid <pid>', 'macOS process id for recording target')
|
|
26
|
+
.option('--source-trust <trust>', 'Recipe source trust: trusted, untrusted, or unknown')
|
|
27
|
+
.option('--source-kind <kind>', 'Recipe source kind supplied by the caller')
|
|
28
|
+
.option('--source-name <name>', 'Human-readable recipe source name')
|
|
29
|
+
.option('--source-digest <digest>', 'Caller-computed source digest')
|
|
30
|
+
.option('--approve-plan <digest>', 'Approve exactly one resolved execution-plan digest')
|
|
31
|
+
.option('--adapter <name>', 'Select adapter-specific recipe variants')
|
|
32
|
+
.option('--list', 'List runnable recipes from the active libraries')
|
|
33
|
+
.option('--describe', 'Describe the selected recipe and its parameters without running it')
|
|
34
|
+
.option('--stop-after-node <node-id>', 'Run the graph through this node, then run the declared teardown (partial proof of one node)')
|
|
35
|
+
.option('--json', 'Print run result as JSON')
|
|
36
|
+
.action(async (recipeInput, params, options) => {
|
|
37
|
+
try {
|
|
38
|
+
const loadOptions = {
|
|
39
|
+
...(options.adapter ? { adapter: options.adapter } : {}),
|
|
40
|
+
...(context.packageVersions ? { packageVersions: context.packageVersions } : {}),
|
|
41
|
+
};
|
|
42
|
+
let librarySources = await resolveRecipeLibrarySources({
|
|
43
|
+
cliEntries: options.library,
|
|
44
|
+
});
|
|
45
|
+
let library = await loadRecipeLibraries(librarySources, loadOptions);
|
|
46
|
+
let match = recipeInput
|
|
47
|
+
? await findLibraryRecipe(recipeInput, librarySources, library, loadOptions)
|
|
48
|
+
: undefined;
|
|
49
|
+
if (recipeInput && !match) {
|
|
50
|
+
librarySources = await resolveRecipeLibrarySources({
|
|
51
|
+
cliEntries: options.library,
|
|
52
|
+
recipePath: resolveRecipeCliPath(recipeInput),
|
|
53
|
+
});
|
|
54
|
+
library = await loadRecipeLibraries(librarySources, loadOptions);
|
|
55
|
+
match = await findLibraryRecipe(recipeInput, librarySources, library, loadOptions);
|
|
56
|
+
}
|
|
57
|
+
librarySources = await Promise.all(librarySources.map(async (source) => ({
|
|
58
|
+
...source,
|
|
59
|
+
provenance: {
|
|
60
|
+
...(source.provenance ?? {
|
|
61
|
+
kind: 'library',
|
|
62
|
+
trust: 'unknown',
|
|
63
|
+
name: source.name,
|
|
64
|
+
path: source.root,
|
|
65
|
+
}),
|
|
66
|
+
digest: await digestRecipeLibrary(source.root, await readRecipeLibraryManifest(source.root)),
|
|
67
|
+
},
|
|
68
|
+
})));
|
|
69
|
+
if (options.list) {
|
|
70
|
+
printRecipeList(library.recipes, options.json === true);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (!recipeInput)
|
|
74
|
+
throw new Error('Missing recipe. Use --list to discover recipes.');
|
|
75
|
+
const selected = match?.recipe;
|
|
76
|
+
if (options.describe) {
|
|
77
|
+
const document = selected
|
|
78
|
+
? selected.document
|
|
79
|
+
: await readRecipeCliJsonFile(recipeInput);
|
|
80
|
+
printRecipeDescription(recipeInput, document, selected, options.json === true);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (!options.artifactsDir)
|
|
84
|
+
throw new Error('Missing --artifacts-dir.');
|
|
85
|
+
if (!options.actionManifest)
|
|
86
|
+
throw new Error('Missing --action-manifest.');
|
|
87
|
+
const manifest = await readRecipeCliJsonFile(options.actionManifest);
|
|
88
|
+
const runner = createRecipeRunner({
|
|
89
|
+
actionManifest: manifest,
|
|
90
|
+
adapters: createStandardCoreAdapters({
|
|
91
|
+
actions: getRecipeActionManifestActionNames(manifest),
|
|
92
|
+
}),
|
|
93
|
+
defaultSource: {
|
|
94
|
+
kind: 'operator',
|
|
95
|
+
trust: 'trusted',
|
|
96
|
+
name: '@farmslot/recipe-runner CLI',
|
|
97
|
+
},
|
|
98
|
+
logger: console,
|
|
99
|
+
});
|
|
100
|
+
const trust = resolveRecipeTrustInput({
|
|
101
|
+
sourceTrust: options.sourceTrust,
|
|
102
|
+
sourceKind: options.sourceKind,
|
|
103
|
+
sourceName: options.sourceName,
|
|
104
|
+
sourceDigest: options.sourceDigest,
|
|
105
|
+
approvalDigest: options.approvePlan,
|
|
106
|
+
});
|
|
107
|
+
const invocationTrust = trust.source?.trust ?? 'trusted';
|
|
108
|
+
const executionLibrarySources = applyTaskLocalInvocationTrust(librarySources, invocationTrust);
|
|
109
|
+
const result = await runner.run({
|
|
110
|
+
recipePath: selected ? selected.path : resolveRecipeCliPath(recipeInput),
|
|
111
|
+
artifactsDir: resolveRecipeCliPath(options.artifactsDir),
|
|
112
|
+
projectRoot: options.projectRoot
|
|
113
|
+
? resolveRecipeCliPath(options.projectRoot)
|
|
114
|
+
: resolveRecipeCliPath('.'),
|
|
115
|
+
recordVideo: parseRecordVideoOptions(options),
|
|
116
|
+
params: parseRecipeParamAssignments(params),
|
|
117
|
+
...(options.adapter ? { adapter: options.adapter } : {}),
|
|
118
|
+
...(options.stopAfterNode ? { stopAfterNode: options.stopAfterNode } : {}),
|
|
119
|
+
...(context.packageVersions ? { packageVersions: context.packageVersions } : {}),
|
|
120
|
+
...(match
|
|
121
|
+
? {
|
|
122
|
+
selection: {
|
|
123
|
+
name: recipeInput,
|
|
124
|
+
resolvedBy: match.resolvedBy,
|
|
125
|
+
source: match.recipe.source,
|
|
126
|
+
file: match.recipe.file,
|
|
127
|
+
path: match.recipe.path,
|
|
128
|
+
},
|
|
129
|
+
}
|
|
130
|
+
: {}),
|
|
131
|
+
...trust,
|
|
132
|
+
...(!trust.source && selected ? { source: selected.provenance } : {}),
|
|
133
|
+
...(executionLibrarySources.length > 0
|
|
134
|
+
? { librarySources: executionLibrarySources }
|
|
135
|
+
: {}),
|
|
136
|
+
});
|
|
137
|
+
if (options.json) {
|
|
138
|
+
console.log(JSON.stringify(result, null, 2));
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
console.log(`Recipe run: ${result.status}`);
|
|
142
|
+
console.log(`Artifacts: ${result.artifactManifestPath}`);
|
|
143
|
+
}
|
|
144
|
+
if (result.status !== 'pass')
|
|
145
|
+
process.exitCode = 1;
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
if (!isRecipeCliError(error))
|
|
149
|
+
throw error;
|
|
150
|
+
reportRecipeCliError(error, options.json === true);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function recipeParameters(document) {
|
|
155
|
+
if (!isRecord(document) || !isRecord(document.paramsSchema))
|
|
156
|
+
return [];
|
|
157
|
+
const schema = document.paramsSchema;
|
|
158
|
+
const required = new Set(Array.isArray(schema.required)
|
|
159
|
+
? schema.required.filter((entry) => typeof entry === 'string')
|
|
160
|
+
: []);
|
|
161
|
+
if (!isRecord(schema.properties))
|
|
162
|
+
return [];
|
|
163
|
+
return Object.entries(schema.properties).map(([name, value]) => {
|
|
164
|
+
const property = isRecord(value) ? value : {};
|
|
165
|
+
return {
|
|
166
|
+
name,
|
|
167
|
+
...(typeof property.type === 'string' ? { type: property.type } : {}),
|
|
168
|
+
required: required.has(name),
|
|
169
|
+
...(Object.hasOwn(property, 'default') ? { default: property.default } : {}),
|
|
170
|
+
...(typeof property.description === 'string' ? { description: property.description } : {}),
|
|
171
|
+
};
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function recipeSummary(ref, document, selected) {
|
|
175
|
+
const record = isRecord(document) ? document : {};
|
|
176
|
+
return {
|
|
177
|
+
ref,
|
|
178
|
+
...(typeof record.title === 'string' ? { title: record.title } : {}),
|
|
179
|
+
...(typeof record.description === 'string' ? { description: record.description } : {}),
|
|
180
|
+
parameters: recipeParameters(document),
|
|
181
|
+
...(selected
|
|
182
|
+
? {
|
|
183
|
+
source: selected.source,
|
|
184
|
+
file: selected.file,
|
|
185
|
+
adapter: selected.adapter ?? null,
|
|
186
|
+
shadows: selected.shadows,
|
|
187
|
+
}
|
|
188
|
+
: {}),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function printRecipeList(recipes, json) {
|
|
192
|
+
const entries = [...recipes.values()]
|
|
193
|
+
.filter((recipe) => !recipe.aliasFor)
|
|
194
|
+
.sort((left, right) => left.ref.localeCompare(right.ref))
|
|
195
|
+
.map((entry) => recipeSummary(entry.ref, entry.document, entry));
|
|
196
|
+
if (json) {
|
|
197
|
+
console.log(JSON.stringify(entries, null, 2));
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
console.log(`Runnable recipes (${entries.length})`);
|
|
201
|
+
for (const entry of entries) {
|
|
202
|
+
const shadows = entry.shadows?.length ? ` (shadows: ${entry.shadows.join(', ')})` : '';
|
|
203
|
+
console.log(` ${entry.ref}${entry.description ? ` — ${entry.description}` : ''}${shadows}`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function printRecipeDescription(ref, document, selected, json) {
|
|
207
|
+
const entry = recipeSummary(ref, document, selected);
|
|
208
|
+
if (json) {
|
|
209
|
+
console.log(JSON.stringify(entry, null, 2));
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
console.log(entry.title ? `${entry.ref} — ${entry.title}` : entry.ref);
|
|
213
|
+
if (entry.description)
|
|
214
|
+
console.log(entry.description);
|
|
215
|
+
if (entry.shadows?.length)
|
|
216
|
+
console.log(`Shadows: ${entry.shadows.join(', ')}`);
|
|
217
|
+
if (entry.parameters.length === 0) {
|
|
218
|
+
console.log('Parameters: none');
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
console.log('Parameters:');
|
|
222
|
+
for (const parameter of entry.parameters) {
|
|
223
|
+
const defaultValue = Object.hasOwn(parameter, 'default')
|
|
224
|
+
? ` default=${JSON.stringify(parameter.default)}`
|
|
225
|
+
: '';
|
|
226
|
+
const requirement = parameter.required ? ' required' : '';
|
|
227
|
+
console.log(` ${parameter.name}${parameter.type ? ` (${parameter.type})` : ''}${requirement}${defaultValue}${parameter.description ? ` — ${parameter.description}` : ''}`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function collectRepeatable(value, previous) {
|
|
231
|
+
return [...previous, value];
|
|
232
|
+
}
|
|
233
|
+
function parseRecordVideoOptions(options) {
|
|
234
|
+
if (!options.recordVideo)
|
|
235
|
+
return false;
|
|
236
|
+
const mode = typeof options.recordVideo === 'string' && options.recordVideo !== 'true'
|
|
237
|
+
? options.recordVideo
|
|
238
|
+
: 'full-run';
|
|
239
|
+
if (mode === 'proof-window' || mode === 'proof_window') {
|
|
240
|
+
throw new Error('--record-video=proof-window is reserved for future focused clips; use --record-video=full-run for phase 1.');
|
|
241
|
+
}
|
|
242
|
+
if (mode !== 'full-run' && mode !== 'off') {
|
|
243
|
+
throw new Error('--record-video must be full-run or off.');
|
|
244
|
+
}
|
|
245
|
+
const target = parseRecordingTarget(options);
|
|
246
|
+
return {
|
|
247
|
+
mode,
|
|
248
|
+
...(options.recordMaxFps ? { maxFps: parsePositiveInteger(options.recordMaxFps) } : {}),
|
|
249
|
+
...(options.recordMaxSize ? { maxSize: parsePositiveInteger(options.recordMaxSize) } : {}),
|
|
250
|
+
...(target ? { target } : {}),
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=run-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-command.js","sourceRoot":"","sources":["../../src/cli/run-command.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kCAAkC,EAClC,QAAQ,GAET,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EACL,6BAA6B,EAC7B,iBAAiB,EACjB,mBAAmB,EAEnB,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,yBAAyB,GAE1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAGjE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EACL,oBAAoB,EACpB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,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type RecipeValidationResult } from '@farmslot/protocol';
|
|
2
|
+
import type { RecipeLibrarySource, RecordingTarget } from '../core/types.js';
|
|
3
|
+
interface RecipeValidationInputOptions {
|
|
4
|
+
recipePath: string;
|
|
5
|
+
actionManifestPath?: string;
|
|
6
|
+
adapter?: string;
|
|
7
|
+
artifactManifestPath?: string;
|
|
8
|
+
artifactDir?: string;
|
|
9
|
+
baseDir?: string;
|
|
10
|
+
/** Library sources whose recipe refs count as resolvable, mirroring run resolution. */
|
|
11
|
+
librarySources?: RecipeLibrarySource[];
|
|
12
|
+
params?: Record<string, unknown>;
|
|
13
|
+
/** Package versions the host provides for checking each library's `requires`. */
|
|
14
|
+
packageVersions?: Readonly<Record<string, string>>;
|
|
15
|
+
}
|
|
16
|
+
interface RecipeCliRecordingTargetOptions {
|
|
17
|
+
recordAppName?: string;
|
|
18
|
+
recordWindowName?: string;
|
|
19
|
+
recordWindowId?: string;
|
|
20
|
+
recordPid?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function recipeCliBaseDir(): string;
|
|
23
|
+
export declare function resolveRecipeCliPath(filePath: string, baseDir?: string): string;
|
|
24
|
+
export declare function parsePositiveInteger(value: string): number;
|
|
25
|
+
export declare function parseRecipeParamAssignments(values: readonly string[]): Record<string, unknown>;
|
|
26
|
+
export declare function parseRecordingTarget(options: RecipeCliRecordingTargetOptions): RecordingTarget | undefined;
|
|
27
|
+
export declare function readRecipeCliJsonFile(filePath: string, baseDir?: string): Promise<unknown>;
|
|
28
|
+
export declare function readRecipeCliJsonFileWithinRoot(root: string, relativePath: string): Promise<unknown>;
|
|
29
|
+
export declare function validateRecipeCliInput({ recipePath, actionManifestPath, adapter, artifactManifestPath, artifactDir, baseDir, librarySources, params, packageVersions, }: RecipeValidationInputOptions): Promise<RecipeValidationResult>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=support.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"support.d.ts","sourceRoot":"","sources":["../../src/cli/support.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,KAAK,sBAAsB,EAO5B,MAAM,oBAAoB,CAAC;AAW5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE7E,UAAU,4BAA4B;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uFAAuF;IACvF,cAAc,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,iFAAiF;IACjF,eAAe,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACpD;AAED,UAAU,+BAA+B;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,SAAqB,GAAG,MAAM,CAE3F;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM1D;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,C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