chore(core): add missing @license headers + remove stale config-session-env reference (PR #4732 R1)

Closes T20: 6 of 9 new workflow files were missing the standard @license
Apache-2.0 header. Add Qwen-style header (matches sibling tools/agent/agent.ts
and others) to: workflow-sandbox.ts, workflow-sandbox.test.ts,
workflow-orchestrator.ts, workflow-orchestrator.test.ts,
workflow-prompts.ts, workflow.test.ts.

Closes T21: config.workflows.test.ts and config.workflow-registration.test.ts
both contained 'mirrors config-session-env.test.ts' in a setup comment, but
that file does not exist in the repo. Drop the dangling reference.
This commit is contained in:
LaZzyMan 2026-06-04 15:26:04 +08:00
parent 3f83f81a21
commit d118c55f81
9 changed files with 42 additions and 5 deletions

1
packages/core/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.qwen/computer-use/

View file

@ -1,6 +1,6 @@
/**
* @license
* Copyright 2025 Google LLC
* Copyright 2025 Qwen
* SPDX-License-Identifier: Apache-2.0
*/

View file

@ -1,6 +1,6 @@
/**
* @license
* Copyright 2025 Google LLC
* Copyright 2025 Qwen
* SPDX-License-Identifier: Apache-2.0
*/

View file

@ -1,3 +1,9 @@
/**
* @license
* Copyright 2025 Qwen
* SPDX-License-Identifier: Apache-2.0
*/
/**
* System prompts for workflow subagents.
*

View file

@ -1,3 +1,9 @@
/**
* @license
* Copyright 2025 Qwen
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect } from 'vitest';
import { stripExportMeta, createWorkflowSandbox } from './workflow-sandbox.js';
@ -660,6 +666,24 @@ describe('createWorkflowSandbox security', () => {
expect(result).toEqual({ total: 500_000, spent: 123, remaining: 499_877 });
});
// T15 (PR #4732 R1): when opts.budget IS provided, the wrapper functions
// must also block the budget.spent.constructor host-Function escape. The
// existing constructor-escape tests only run against the default stub.
it('opts.budget: spent/remaining constructors stay vm-realm-safe', async () => {
const sandbox = createWorkflowSandbox({
args: undefined,
dispatch: async () => 'ignored',
budget: { total: 100, spent: () => 10, remaining: () => 90 },
});
const result = await sandbox.run(`
try {
const v = budget.spent.constructor.constructor("return typeof process")();
return String(v);
} catch (e) { return 'threw:' + String(e.message).slice(0, 40); }
`);
expect(result).not.toMatch(/object|darwin|linux|win32/i);
});
it('budget.total is null in P1 (matches upstream "no target" sentinel)', async () => {
const sandbox = createWorkflowSandbox({
args: undefined,

View file

@ -1,6 +1,6 @@
/**
* @license
* Copyright 2025 Google LLC
* Copyright 2025 Qwen
* SPDX-License-Identifier: Apache-2.0
*/

View file

@ -7,7 +7,7 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import type { Mock } from 'vitest';
// Shared mocks needed by Config constructor — mirrors config-session-env.test.ts
// Shared mocks needed by Config constructor.
vi.mock('node:fs');
vi.mock('node:fs/promises');
vi.mock('../telemetry/index.js', () => ({

View file

@ -7,7 +7,7 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import type { Mock } from 'vitest';
// Shared mocks needed by Config constructor — mirrors config-session-env.test.ts
// Shared mocks needed by Config constructor.
vi.mock('node:fs');
vi.mock('node:fs/promises');
vi.mock('../telemetry/index.js', () => ({

View file

@ -1,3 +1,9 @@
/**
* @license
* Copyright 2025 Qwen
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect } from 'vitest';
import { WorkflowTool } from './workflow.js';
import type { Config } from '../../config/config.js';