feat(runtime): default to passthrough and persist execution permissions

This commit is contained in:
Agent Workbench Dev
2026-11-06 04:58:57 +08:00
parent 67c034f4b6
commit 2fa220735d
113 changed files with 1866 additions and 631 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ export class ArtifactStore {
}
write(session, run, value, { kind = 'tool-result', mediaType = 'application/json' } = {}) {
const bytes = Buffer.isBuffer(value) ? Buffer.from(value) : Buffer.from(typeof value === 'string' ? value : JSON.stringify(value), 'utf8');
if (bytes.length > 8 * 1024 * 1024) throw new Error('单项执行工件超过8MB,请缩小输出范围。');
if (!this.unrestricted?.() && bytes.length > 8 * 1024 * 1024 && !['model-request', 'model-http-response', 'model-stream-response'].includes(kind)) throw new Error('单项执行工件超过8MB,请缩小输出范围。');
const sha256 = createHash('sha256').update(bytes).digest('hex');
const relative = sha256.slice(0, 2) + '/' + sha256 + '.blob';
const file = path.join(this.root, relative);
+4 -3
View File
@@ -5,14 +5,15 @@ import { isId } from '../../shared/contracts/execution.mjs';
import { DEFAULT_MODEL_CAPACITY } from '../../shared/contracts/model-capacity.mjs';
export const DEFAULT_CONFIG = {
mode: 'demo', baseUrl: 'http://127.0.0.1:11434/v1', model: '', ...DEFAULT_MODEL_CAPACITY, capacityMode: 'model', historyPolicy: 'preserve', maxSteps: 12,
maxRunDurationMs: 600000, maxRunTokens: 200000, maxTaskTokens: 1000000, configRevision: 1,
modelResponseTimeoutMs: 300000, modelStreamIdleTimeoutMs: 120000,
mode: 'demo', baseUrl: 'http://127.0.0.1:11434/v1', model: '', ...DEFAULT_MODEL_CAPACITY, approvalMode: 'ask', capacityMode: 'passthrough', historyPolicy: 'preserve', executionMode: 'unrestricted', maxSteps: 0,
maxRunDurationMs: 0, maxRunTokens: 0, maxTaskTokens: 0, configRevision: 1,
modelResponseTimeoutMs: 0, modelStreamIdleTimeoutMs: 0,
};
export function cleanConfig(value = {}) {
const result = { ...DEFAULT_CONFIG };
for (const key of Object.keys(result)) if (Object.hasOwn(value, key)) result[key] = value[key];
if (!Object.hasOwn(value, 'executionMode') && ['contextLimit', 'maxOutputTokens', 'maxSteps', 'maxRunTokens'].some(key => Object.hasOwn(value, key))) result.executionMode = 'restricted';
// Old settings stay manual. Every saved Run keeps its original snapshot.
if (!Object.hasOwn(value, 'capacityMode') && (Object.hasOwn(value, 'contextLimit') || Object.hasOwn(value, 'maxOutputTokens'))) result.capacityMode = 'manual';
if (!Object.hasOwn(value, 'historyPolicy') && (Object.hasOwn(value, 'contextLimit') || Object.hasOwn(value, 'maxOutputTokens'))) result.historyPolicy = 'compact';