agentic-workflow-manager 8.1.5 → 8.1.6
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.
|
@@ -42,7 +42,11 @@ function expandFileInput(command, files) {
|
|
|
42
42
|
if (index < 0 || command.args.lastIndexOf(command.fileInput.placeholder) !== index) {
|
|
43
43
|
throw new Error('changed command requires exactly one standalone {files} argument');
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
// `fileInput` describes the unexpanded registry template. Leaving it on the
|
|
46
|
+
// materialized command makes the execution boundary (correctly) demand a
|
|
47
|
+
// placeholder that has already been replaced with literal argv entries.
|
|
48
|
+
const { fileInput: _templateInput, ...materialized } = command;
|
|
49
|
+
return { ...materialized, args: [...command.args.slice(0, index), ...files, ...command.args.slice(index + 1)] };
|
|
46
50
|
}
|
|
47
51
|
function timeout(project, pack, fast) {
|
|
48
52
|
const resolved = (0, timeout_1.resolveTimeout)({ project, pack, fast });
|
|
@@ -8,6 +8,7 @@ const os_1 = __importDefault(require("os"));
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const exec_1 = require("../../../src/commands/sensors/exec");
|
|
10
10
|
const result_1 = require("../../../src/commands/sensors/result");
|
|
11
|
+
const prepare_1 = require("../../../src/commands/sensors/prepare");
|
|
11
12
|
const sensor = (overrides = {}) => ({
|
|
12
13
|
name: 'lint',
|
|
13
14
|
command: { kind: 'legacy', value: 'node -e "setTimeout(() => {}, 1000)"' },
|
|
@@ -148,6 +149,24 @@ describe('runCommand — spawn failure', () => {
|
|
|
148
149
|
});
|
|
149
150
|
});
|
|
150
151
|
describe('runStructuredCommand — public boundary validation', () => {
|
|
152
|
+
it('dispatches argv materialized from a validated changed-command template without requiring its placeholder again', async () => {
|
|
153
|
+
const dir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'awm-exec-changed-argv-'));
|
|
154
|
+
const received = path_1.default.join(dir, 'received.json');
|
|
155
|
+
try {
|
|
156
|
+
const command = (0, prepare_1.expandFileInput)({
|
|
157
|
+
executable: 'node',
|
|
158
|
+
resolution: 'path',
|
|
159
|
+
args: ['-e', "require('fs').writeFileSync(process.argv[1], JSON.stringify(process.argv.slice(2)))", received, '{files}'],
|
|
160
|
+
fileInput: { placeholder: '{files}', extensions: ['.ts'] },
|
|
161
|
+
}, ['src/a.ts', 'src/with space.ts']);
|
|
162
|
+
const result = await (0, exec_1.runStructuredCommand)(command, { timeout: 5_000, cwd: dir });
|
|
163
|
+
expect(result.code).toBe(0);
|
|
164
|
+
expect(JSON.parse(fs_1.default.readFileSync(received, 'utf8'))).toEqual(['src/a.ts', 'src/with space.ts']);
|
|
165
|
+
}
|
|
166
|
+
finally {
|
|
167
|
+
fs_1.default.rmSync(dir, { recursive: true, force: true });
|
|
168
|
+
}
|
|
169
|
+
});
|
|
151
170
|
it.each(['sh', 'cmd.exe', '/usr/bin/node', 'nested/tool', 'nested\\tool'])('rejects unsafe executable %j before resolution', executable => {
|
|
152
171
|
expect(() => (0, exec_1.runStructuredCommand)({ executable, resolution: 'path', args: ['--version'] }, { timeout: 5000, cwd: process.cwd() }))
|
|
153
172
|
.toThrow(/safe executable name|shell/i);
|
|
@@ -30,7 +30,7 @@ function v2Input(overrides = {}) {
|
|
|
30
30
|
describe('prepareV2Sensor', () => {
|
|
31
31
|
test('v2 uses the live command and project > pack > fallback timeout (R1.1, R3.1)', () => {
|
|
32
32
|
const prepared = (0, prepare_1.prepareV2Sensor)(v2Input());
|
|
33
|
-
expect(prepared.command).toEqual({ kind: 'structured', value: {
|
|
33
|
+
expect(prepared.command).toEqual({ kind: 'structured', value: { executable: 'live-eslint', resolution: 'path', args: ['--format', 'json', 'src/a.ts'] } });
|
|
34
34
|
expect(prepared.timeoutMs).toBe(90_000);
|
|
35
35
|
expect(prepared.timeoutSource).toBe('project');
|
|
36
36
|
expect((0, prepare_1.prepareV2Sensor)(v2Input({ projectTimeout: undefined })).timeoutSource).toBe('pack');
|
|
@@ -42,7 +42,7 @@ describe('prepareV2Sensor', () => {
|
|
|
42
42
|
});
|
|
43
43
|
test('expands changed paths as literal argv entries (R4.1, R10.2)', () => {
|
|
44
44
|
const prepared = (0, prepare_1.prepareV2Sensor)(v2Input({ changed: { files: ['src/a b.ts', 'src/$x.ts'] } }));
|
|
45
|
-
expect(prepared.command).toEqual({ kind: 'structured', value: {
|
|
45
|
+
expect(prepared.command).toEqual({ kind: 'structured', value: { executable: 'live-eslint', resolution: 'path', args: ['--format', 'json', 'src/a b.ts', 'src/$x.ts'] } });
|
|
46
46
|
expect(prepared.effectiveScope).toBe('changed');
|
|
47
47
|
});
|
|
48
48
|
test('falls back full with an explicit reason without changedCommand (R4.2)', () => {
|