@oh-my-matrix/autopilot 2.1.1
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/LICENSE +21 -0
- package/README.md +36 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1034 -0
- package/dist/index.js.map +1 -0
- package/dist/src/audit-persister.d.ts +25 -0
- package/dist/src/audit-persister.d.ts.map +1 -0
- package/dist/src/audit-persister.js +162 -0
- package/dist/src/audit-persister.js.map +1 -0
- package/dist/src/autopilot-state.d.ts +35 -0
- package/dist/src/autopilot-state.d.ts.map +1 -0
- package/dist/src/autopilot-state.js +121 -0
- package/dist/src/autopilot-state.js.map +1 -0
- package/dist/src/command-runner.d.ts +13 -0
- package/dist/src/command-runner.d.ts.map +1 -0
- package/dist/src/command-runner.js +148 -0
- package/dist/src/command-runner.js.map +1 -0
- package/dist/src/completion-detector.d.ts +21 -0
- package/dist/src/completion-detector.d.ts.map +1 -0
- package/dist/src/completion-detector.js +104 -0
- package/dist/src/completion-detector.js.map +1 -0
- package/dist/src/continuation-engine.d.ts +9 -0
- package/dist/src/continuation-engine.d.ts.map +1 -0
- package/dist/src/continuation-engine.js +76 -0
- package/dist/src/continuation-engine.js.map +1 -0
- package/dist/src/effort-injection.d.ts +9 -0
- package/dist/src/effort-injection.d.ts.map +1 -0
- package/dist/src/effort-injection.js +17 -0
- package/dist/src/effort-injection.js.map +1 -0
- package/dist/src/evidence-gate.d.ts +24 -0
- package/dist/src/evidence-gate.d.ts.map +1 -0
- package/dist/src/evidence-gate.js +86 -0
- package/dist/src/evidence-gate.js.map +1 -0
- package/dist/src/goal-manager.d.ts +5 -0
- package/dist/src/goal-manager.d.ts.map +1 -0
- package/dist/src/goal-manager.js +22 -0
- package/dist/src/goal-manager.js.map +1 -0
- package/dist/src/logger.d.ts +27 -0
- package/dist/src/logger.d.ts.map +1 -0
- package/dist/src/logger.js +90 -0
- package/dist/src/logger.js.map +1 -0
- package/dist/src/orchestrator.d.ts +16 -0
- package/dist/src/orchestrator.d.ts.map +1 -0
- package/dist/src/orchestrator.js +252 -0
- package/dist/src/orchestrator.js.map +1 -0
- package/dist/src/permission-policy.d.ts +36 -0
- package/dist/src/permission-policy.d.ts.map +1 -0
- package/dist/src/permission-policy.js +265 -0
- package/dist/src/permission-policy.js.map +1 -0
- package/dist/src/project-detector.d.ts +8 -0
- package/dist/src/project-detector.d.ts.map +1 -0
- package/dist/src/project-detector.js +130 -0
- package/dist/src/project-detector.js.map +1 -0
- package/dist/src/projection.d.ts +47 -0
- package/dist/src/projection.d.ts.map +1 -0
- package/dist/src/projection.js +58 -0
- package/dist/src/projection.js.map +1 -0
- package/dist/src/retry-queue.d.ts +25 -0
- package/dist/src/retry-queue.d.ts.map +1 -0
- package/dist/src/retry-queue.js +77 -0
- package/dist/src/retry-queue.js.map +1 -0
- package/dist/src/stall-detector.d.ts +22 -0
- package/dist/src/stall-detector.d.ts.map +1 -0
- package/dist/src/stall-detector.js +26 -0
- package/dist/src/stall-detector.js.map +1 -0
- package/dist/src/tool-error-tracker.d.ts +4 -0
- package/dist/src/tool-error-tracker.d.ts.map +1 -0
- package/dist/src/tool-error-tracker.js +18 -0
- package/dist/src/tool-error-tracker.js.map +1 -0
- package/dist/src/types.d.ts +223 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +55 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/workflow-config.d.ts +13 -0
- package/dist/src/workflow-config.d.ts.map +1 -0
- package/dist/src/workflow-config.js +422 -0
- package/dist/src/workflow-config.js.map +1 -0
- package/openclaw.plugin.json +62 -0
- package/package.json +56 -0
|
@@ -0,0 +1,223 @@
|
|
|
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';
|
|
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';
|
|
5
|
+
/** Canonical set of all valid BlockedReason values — used by isValidBlockedReason type guard */
|
|
6
|
+
export declare const VALID_BLOCKED_REASONS: ReadonlySet<BlockedReason>;
|
|
7
|
+
/** H-2: Type guard — validates that an arbitrary string is a BlockedReason.
|
|
8
|
+
* Returns `'validation_failed'` fallback when the string is not a valid reason. */
|
|
9
|
+
export declare function isValidBlockedReason(value: string): value is BlockedReason;
|
|
10
|
+
/** H-2: Safe BlockedReason coercion — returns the value if valid, otherwise falls back. */
|
|
11
|
+
export declare function toBlockedReason(value: string, fallback?: BlockedReason): BlockedReason;
|
|
12
|
+
export type EvidenceStatus = 'not_started' | 'running' | 'passed' | 'failed' | 'skipped';
|
|
13
|
+
import type { CommandClass, PermissionAuditEntry } from '@oh-my-matrix/permission-policy';
|
|
14
|
+
export type { CommandClass, PermissionAuditEntry };
|
|
15
|
+
export interface WorkspaceRecord {
|
|
16
|
+
root: string;
|
|
17
|
+
path: string;
|
|
18
|
+
workspaceKey: string;
|
|
19
|
+
branchName: string;
|
|
20
|
+
baseBranch: string;
|
|
21
|
+
createdNow: boolean;
|
|
22
|
+
reusable: boolean;
|
|
23
|
+
lastVerifiedAt?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface RetryEntry {
|
|
26
|
+
attempt: number;
|
|
27
|
+
nextRetryAt: number;
|
|
28
|
+
lastError: string;
|
|
29
|
+
recoverable: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface EvidenceCommandResult {
|
|
32
|
+
id: string;
|
|
33
|
+
command: string;
|
|
34
|
+
status: 'passed' | 'failed' | 'timeout' | 'skipped';
|
|
35
|
+
exitCode?: number;
|
|
36
|
+
durationMs: number;
|
|
37
|
+
summary: string;
|
|
38
|
+
}
|
|
39
|
+
export interface EvidenceSummary {
|
|
40
|
+
status: EvidenceStatus;
|
|
41
|
+
diffSummary?: string;
|
|
42
|
+
commands: EvidenceCommandResult[];
|
|
43
|
+
completedAt?: number;
|
|
44
|
+
failureReason?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ValidationCommand {
|
|
47
|
+
id: string;
|
|
48
|
+
command: string;
|
|
49
|
+
timeoutMs: number;
|
|
50
|
+
required: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface WorkflowConfig {
|
|
53
|
+
version: 1;
|
|
54
|
+
source: 'workflow_md' | 'default' | 'last_valid';
|
|
55
|
+
maxConcurrent: number;
|
|
56
|
+
maxRetries: number;
|
|
57
|
+
stallTimeoutMs: number;
|
|
58
|
+
maxRetryBackoffMs: number;
|
|
59
|
+
workspace: {
|
|
60
|
+
root: string;
|
|
61
|
+
cleanup: 'manual' | 'delete_on_done';
|
|
62
|
+
branchPrefix: string;
|
|
63
|
+
baseRef?: string;
|
|
64
|
+
allowDirtyBase: boolean;
|
|
65
|
+
};
|
|
66
|
+
validation: {
|
|
67
|
+
commands: ValidationCommand[];
|
|
68
|
+
failOnOptional: boolean;
|
|
69
|
+
};
|
|
70
|
+
destructiveGit: {
|
|
71
|
+
allow: boolean;
|
|
72
|
+
};
|
|
73
|
+
warnings: string[];
|
|
74
|
+
}
|
|
75
|
+
export type OrchestratorEvent = {
|
|
76
|
+
type: 'activate_requested';
|
|
77
|
+
sessionKey: string;
|
|
78
|
+
goal?: string;
|
|
79
|
+
now: number;
|
|
80
|
+
} | {
|
|
81
|
+
type: 'workspace_ready';
|
|
82
|
+
runId: string;
|
|
83
|
+
workspace: WorkspaceRecord;
|
|
84
|
+
now: number;
|
|
85
|
+
} | {
|
|
86
|
+
type: 'workspace_failed';
|
|
87
|
+
runId: string;
|
|
88
|
+
error: string;
|
|
89
|
+
now: number;
|
|
90
|
+
} | {
|
|
91
|
+
type: 'agent_turn_started';
|
|
92
|
+
runId: string;
|
|
93
|
+
now: number;
|
|
94
|
+
} | {
|
|
95
|
+
type: 'agent_activity';
|
|
96
|
+
runId: string;
|
|
97
|
+
activity: 'llm_output' | 'tool_call' | 'tool_result';
|
|
98
|
+
now: number;
|
|
99
|
+
tokens?: {
|
|
100
|
+
input?: number;
|
|
101
|
+
output?: number;
|
|
102
|
+
total?: number;
|
|
103
|
+
};
|
|
104
|
+
} | {
|
|
105
|
+
type: 'agent_turn_finished';
|
|
106
|
+
runId: string;
|
|
107
|
+
success: boolean;
|
|
108
|
+
error?: string;
|
|
109
|
+
now: number;
|
|
110
|
+
} | {
|
|
111
|
+
type: 'retry_due';
|
|
112
|
+
runId: string;
|
|
113
|
+
now: number;
|
|
114
|
+
} | {
|
|
115
|
+
type: 'stall_timeout';
|
|
116
|
+
runId: string;
|
|
117
|
+
now: number;
|
|
118
|
+
} | {
|
|
119
|
+
type: 'evidence_started';
|
|
120
|
+
runId: string;
|
|
121
|
+
now: number;
|
|
122
|
+
} | {
|
|
123
|
+
type: 'evidence_finished';
|
|
124
|
+
runId: string;
|
|
125
|
+
evidence: EvidenceSummary;
|
|
126
|
+
now: number;
|
|
127
|
+
} | {
|
|
128
|
+
type: 'permission_denied';
|
|
129
|
+
runId: string;
|
|
130
|
+
toolName: string;
|
|
131
|
+
now: number;
|
|
132
|
+
} | {
|
|
133
|
+
type: 'stop_requested';
|
|
134
|
+
runId: string;
|
|
135
|
+
now: number;
|
|
136
|
+
} | {
|
|
137
|
+
type: 'resume_requested';
|
|
138
|
+
runId: string;
|
|
139
|
+
now: number;
|
|
140
|
+
};
|
|
141
|
+
export interface ToolErrorEntry {
|
|
142
|
+
tool: string;
|
|
143
|
+
args: string;
|
|
144
|
+
error: string;
|
|
145
|
+
}
|
|
146
|
+
export interface AutopilotState {
|
|
147
|
+
status: AutopilotStatus;
|
|
148
|
+
sessionKey: string;
|
|
149
|
+
runId: string;
|
|
150
|
+
goal?: string;
|
|
151
|
+
goalSnapshot?: string;
|
|
152
|
+
progress?: string;
|
|
153
|
+
progressSnapshot?: string;
|
|
154
|
+
turnAttempts: number;
|
|
155
|
+
totalContinuations: number;
|
|
156
|
+
maxAttemptsPerTurn: number;
|
|
157
|
+
maxTotalContinuations: number;
|
|
158
|
+
maxConcurrentAutopilot: number;
|
|
159
|
+
lastToolError?: ToolErrorEntry;
|
|
160
|
+
toolErrorCount: number;
|
|
161
|
+
toolErrorThreshold: number;
|
|
162
|
+
pauseReason?: PauseReason;
|
|
163
|
+
needsCrossTurnResume: boolean;
|
|
164
|
+
enabled: boolean;
|
|
165
|
+
totalTokensUsed: number;
|
|
166
|
+
tokenBudget?: number;
|
|
167
|
+
degraded: boolean;
|
|
168
|
+
orchestrationState?: OrchestrationState;
|
|
169
|
+
workspace?: WorkspaceRecord;
|
|
170
|
+
retry?: RetryEntry;
|
|
171
|
+
blockedReason?: BlockedReason;
|
|
172
|
+
startedAt?: number;
|
|
173
|
+
lastActivityAt?: number;
|
|
174
|
+
evidence?: EvidenceSummary;
|
|
175
|
+
workflow?: WorkflowConfig;
|
|
176
|
+
workflowConfigError?: string;
|
|
177
|
+
permissionAudit?: PermissionAuditEntry[];
|
|
178
|
+
inputTokensUsed?: number;
|
|
179
|
+
outputTokensUsed?: number;
|
|
180
|
+
}
|
|
181
|
+
export interface ContinuationDecision {
|
|
182
|
+
action: 'revise' | 'finalize' | 'cross_turn' | 'pause' | 'complete';
|
|
183
|
+
pauseReason?: PauseReason;
|
|
184
|
+
retryInstruction?: string;
|
|
185
|
+
}
|
|
186
|
+
export interface AutopilotConfig {
|
|
187
|
+
maxAttemptsPerTurn: number;
|
|
188
|
+
maxTotalContinuations: number;
|
|
189
|
+
toolErrorThreshold: number;
|
|
190
|
+
excludedAgents?: string[];
|
|
191
|
+
highRiskTools?: string[];
|
|
192
|
+
tokenBudget?: number;
|
|
193
|
+
maxConcurrentAutopilot?: number;
|
|
194
|
+
}
|
|
195
|
+
export declare const DEFAULT_CONFIG: AutopilotConfig;
|
|
196
|
+
export declare function createInitialState(sessionKey: string, runId: string, config?: AutopilotConfig): AutopilotState;
|
|
197
|
+
/** Context for hook event handlers (e.g., ctx.sessionKey, ctx.agentId) */
|
|
198
|
+
export interface HookContext {
|
|
199
|
+
sessionKey?: string;
|
|
200
|
+
sessionId?: string;
|
|
201
|
+
agentId?: string;
|
|
202
|
+
workspacePath?: string;
|
|
203
|
+
[key: string]: unknown;
|
|
204
|
+
}
|
|
205
|
+
/** Gateway respond callback passed to every registerGatewayMethod handler */
|
|
206
|
+
export type GatewayRespond = (ok: boolean, data?: unknown, err?: {
|
|
207
|
+
code: string;
|
|
208
|
+
message: string;
|
|
209
|
+
}) => void;
|
|
210
|
+
/** Destructured context shape received by each registerGatewayMethod handler */
|
|
211
|
+
export type GatewayCtx = {
|
|
212
|
+
params: Record<string, unknown>;
|
|
213
|
+
respond: GatewayRespond;
|
|
214
|
+
};
|
|
215
|
+
/** Result of enqueueNextTurnInjection */
|
|
216
|
+
export interface InjectionResult {
|
|
217
|
+
enqueued: boolean;
|
|
218
|
+
reason?: string;
|
|
219
|
+
}
|
|
220
|
+
/** Hook registration function signature */
|
|
221
|
+
export type HookHandler = (...args: unknown[]) => unknown;
|
|
222
|
+
export type RegisterHookFn = (hookName: string, handler: HookHandler) => void;
|
|
223
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +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;AAI5B,M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,MAAM,GAAE,eAAgC,GACvC,cAAc,CAkBhB;AAID,0EAA0E;AAC1E,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,6EAA6E;AAC7E,MAAM,MAAM,cAAc,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,KAAK,IAAI,CAAC;AAE5G,gFAAgF;AAChF,MAAM,MAAM,UAAU,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,OAAO,EAAE,cAAc,CAAA;CAAE,CAAC;AAEtF,yCAAyC;AACzC,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,2CAA2C;AAC3C,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;AAC1D,MAAM,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_CONFIG = exports.VALID_BLOCKED_REASONS = void 0;
|
|
4
|
+
exports.isValidBlockedReason = isValidBlockedReason;
|
|
5
|
+
exports.toBlockedReason = toBlockedReason;
|
|
6
|
+
exports.createInitialState = createInitialState;
|
|
7
|
+
/** Canonical set of all valid BlockedReason values — used by isValidBlockedReason type guard */
|
|
8
|
+
exports.VALID_BLOCKED_REASONS = new Set([
|
|
9
|
+
'permission_denied',
|
|
10
|
+
'workspace_containment_failed',
|
|
11
|
+
'workspace_create_failed',
|
|
12
|
+
'validation_failed',
|
|
13
|
+
'evidence_missing',
|
|
14
|
+
'stalled',
|
|
15
|
+
'token_budget_exceeded',
|
|
16
|
+
'user_stopped',
|
|
17
|
+
'config_invalid',
|
|
18
|
+
'max_retries_reached',
|
|
19
|
+
]);
|
|
20
|
+
/** H-2: Type guard — validates that an arbitrary string is a BlockedReason.
|
|
21
|
+
* Returns `'validation_failed'` fallback when the string is not a valid reason. */
|
|
22
|
+
function isValidBlockedReason(value) {
|
|
23
|
+
return exports.VALID_BLOCKED_REASONS.has(value);
|
|
24
|
+
}
|
|
25
|
+
/** H-2: Safe BlockedReason coercion — returns the value if valid, otherwise falls back. */
|
|
26
|
+
function toBlockedReason(value, fallback = 'validation_failed') {
|
|
27
|
+
return isValidBlockedReason(value) ? value : fallback;
|
|
28
|
+
}
|
|
29
|
+
exports.DEFAULT_CONFIG = {
|
|
30
|
+
maxAttemptsPerTurn: 5,
|
|
31
|
+
maxTotalContinuations: 50,
|
|
32
|
+
toolErrorThreshold: 3,
|
|
33
|
+
excludedAgents: [],
|
|
34
|
+
maxConcurrentAutopilot: 5,
|
|
35
|
+
};
|
|
36
|
+
function createInitialState(sessionKey, runId, config = exports.DEFAULT_CONFIG) {
|
|
37
|
+
return {
|
|
38
|
+
status: 'idle',
|
|
39
|
+
sessionKey,
|
|
40
|
+
runId,
|
|
41
|
+
turnAttempts: 0,
|
|
42
|
+
totalContinuations: 0,
|
|
43
|
+
maxAttemptsPerTurn: config.maxAttemptsPerTurn,
|
|
44
|
+
maxTotalContinuations: config.maxTotalContinuations,
|
|
45
|
+
maxConcurrentAutopilot: config.maxConcurrentAutopilot ?? 5,
|
|
46
|
+
toolErrorCount: 0,
|
|
47
|
+
toolErrorThreshold: config.toolErrorThreshold,
|
|
48
|
+
needsCrossTurnResume: false,
|
|
49
|
+
enabled: false,
|
|
50
|
+
totalTokensUsed: 0,
|
|
51
|
+
tokenBudget: config.tokenBudget,
|
|
52
|
+
degraded: false,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAoDA,oDAEC;AAGD,0CAEC;AAkKD,gDAsBC;AA/MD,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;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;AA0JY,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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { WorkflowConfig } from './types';
|
|
2
|
+
export declare const DEFAULT_WORKFLOW_CONFIG: WorkflowConfig;
|
|
3
|
+
interface LoadResult {
|
|
4
|
+
config: WorkflowConfig;
|
|
5
|
+
warnings: string[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Load workflow config from WORKFLOW.md in the given repo path.
|
|
9
|
+
* Returns default config if no WORKFLOW.md exists or if parsing fails.
|
|
10
|
+
*/
|
|
11
|
+
export declare function loadWorkflowConfig(baseRepoPath: string, workspacePath?: string): LoadResult;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=workflow-config.d.ts.map
|
|
@@ -0,0 +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;AAEjE,eAAO,MAAM,uBAAuB,EAAE,cAqBrC,CAAC;AAEF,UAAU,UAAU;IAClB,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AA0SD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,UAAU,CAkD3F"}
|