@harness-engineering/types 0.9.0 → 0.9.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/dist/index.d.mts +645 -646
- package/dist/index.d.ts +645 -646
- package/dist/index.js +13 -11
- package/dist/index.mjs +13 -11
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,814 +1,813 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Result type for consistent error handling across the toolkit.
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
type Result<T, E = Error> = {
|
|
5
|
+
ok: true;
|
|
6
|
+
value: T;
|
|
7
|
+
} | {
|
|
8
|
+
ok: false;
|
|
9
|
+
error: E;
|
|
10
|
+
};
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
-
* Pulled during syncFromExternal.
|
|
12
|
+
* Creates a successful Result.
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
/** External identifier */
|
|
16
|
-
externalId: string;
|
|
17
|
-
/** Ticket title in the external service */
|
|
18
|
-
title: string;
|
|
19
|
-
/** External status (e.g., "open", "closed") */
|
|
20
|
-
status: string;
|
|
21
|
-
/** External labels (used for status disambiguation on GitHub) */
|
|
22
|
-
labels: string[];
|
|
23
|
-
/** Current assignee in the external service, or null */
|
|
24
|
-
assignee: string | null;
|
|
25
|
-
}
|
|
14
|
+
declare function Ok<T>(value: T): Result<T, never>;
|
|
26
15
|
/**
|
|
27
|
-
*
|
|
16
|
+
* Creates a failed Result.
|
|
28
17
|
*/
|
|
29
|
-
|
|
30
|
-
/** Tickets created during this sync */
|
|
31
|
-
created: ExternalTicket[];
|
|
32
|
-
/** External IDs of tickets that were updated */
|
|
33
|
-
updated: string[];
|
|
34
|
-
/** Assignment changes detected during pull */
|
|
35
|
-
assignmentChanges: Array<{
|
|
36
|
-
feature: string;
|
|
37
|
-
from: string | null;
|
|
38
|
-
to: string | null;
|
|
39
|
-
}>;
|
|
40
|
-
/** Per-feature errors (sync never throws) */
|
|
41
|
-
errors: Array<{
|
|
42
|
-
featureOrId: string;
|
|
43
|
-
error: Error;
|
|
44
|
-
}>;
|
|
45
|
-
}
|
|
18
|
+
declare function Err<E>(error: E): Result<never, E>;
|
|
46
19
|
/**
|
|
47
|
-
*
|
|
20
|
+
* Type guard to check if a Result is successful.
|
|
48
21
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
repo?: string;
|
|
54
|
-
/** Labels auto-applied to created tickets for filtering + identification */
|
|
55
|
-
labels?: string[];
|
|
56
|
-
/** Maps roadmap status -> external status string */
|
|
57
|
-
statusMap: Record<FeatureStatus, string>;
|
|
58
|
-
/**
|
|
59
|
-
* Maps external status (+ optional label) -> roadmap status.
|
|
60
|
-
* Compound keys like "open:in-progress" express state + label.
|
|
61
|
-
* Optional — when absent, syncFromExternal preserves current roadmap status.
|
|
62
|
-
*/
|
|
63
|
-
reverseStatusMap?: Record<string, FeatureStatus>;
|
|
64
|
-
}
|
|
65
|
-
|
|
22
|
+
declare function isOk<T, E>(result: Result<T, E>): result is {
|
|
23
|
+
ok: true;
|
|
24
|
+
value: T;
|
|
25
|
+
};
|
|
66
26
|
/**
|
|
67
|
-
*
|
|
27
|
+
* Type guard to check if a Result is failed.
|
|
68
28
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
/** Combined total tokens used */
|
|
75
|
-
totalTokens: number;
|
|
76
|
-
}
|
|
29
|
+
declare function isErr<T, E>(result: Result<T, E>): result is {
|
|
30
|
+
ok: false;
|
|
31
|
+
error: E;
|
|
32
|
+
};
|
|
33
|
+
|
|
77
34
|
/**
|
|
78
|
-
*
|
|
35
|
+
* A single step in a multi-skill workflow.
|
|
79
36
|
*/
|
|
80
|
-
interface
|
|
81
|
-
/**
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
|
|
37
|
+
interface WorkflowStep {
|
|
38
|
+
/** The skill to execute (e.g., "detect-doc-drift") */
|
|
39
|
+
skill: string;
|
|
40
|
+
/** Name of the artifact this step produces */
|
|
41
|
+
produces: string;
|
|
42
|
+
/** Name of the artifact this step expects as input */
|
|
43
|
+
expects?: string;
|
|
44
|
+
/** Whether failure of this step stops the workflow */
|
|
45
|
+
gate?: 'pass-required' | 'advisory';
|
|
87
46
|
}
|
|
88
47
|
/**
|
|
89
|
-
*
|
|
48
|
+
* Definition of a sequence of steps to achieve a goal.
|
|
90
49
|
*/
|
|
91
|
-
interface
|
|
92
|
-
/**
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
|
|
96
|
-
/** Title or headline of the issue */
|
|
97
|
-
title: string;
|
|
98
|
-
/** Detailed description, if available */
|
|
99
|
-
description: string | null;
|
|
100
|
-
/** Numerical priority (lower is typically higher priority) */
|
|
101
|
-
priority: number | null;
|
|
102
|
-
/** Current lifecycle state */
|
|
103
|
-
state: string;
|
|
104
|
-
/** Name of the git branch associated with this issue */
|
|
105
|
-
branchName: string | null;
|
|
106
|
-
/** Direct URL to the issue in the tracker */
|
|
107
|
-
url: string | null;
|
|
108
|
-
/** List of labels or tags */
|
|
109
|
-
labels: string[];
|
|
110
|
-
/** References to issues that block this one */
|
|
111
|
-
blockedBy: BlockerRef[];
|
|
112
|
-
/** ISO timestamp of creation */
|
|
113
|
-
createdAt: string | null;
|
|
114
|
-
/** ISO timestamp of last update */
|
|
115
|
-
updatedAt: string | null;
|
|
50
|
+
interface Workflow {
|
|
51
|
+
/** Descriptive name of the workflow */
|
|
52
|
+
name: string;
|
|
53
|
+
/** Ordered list of steps */
|
|
54
|
+
steps: WorkflowStep[];
|
|
116
55
|
}
|
|
117
56
|
/**
|
|
118
|
-
*
|
|
57
|
+
* Possible outcomes for a single workflow step.
|
|
119
58
|
*/
|
|
120
|
-
type
|
|
59
|
+
type StepOutcome = 'pass' | 'fail' | 'skipped';
|
|
121
60
|
/**
|
|
122
|
-
*
|
|
61
|
+
* Detailed result of a workflow step execution.
|
|
123
62
|
*/
|
|
124
|
-
interface
|
|
125
|
-
/**
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
|
|
63
|
+
interface WorkflowStepResult {
|
|
64
|
+
/** The step that was executed */
|
|
65
|
+
step: WorkflowStep;
|
|
66
|
+
/** The outcome of the execution */
|
|
67
|
+
outcome: StepOutcome;
|
|
68
|
+
/** Path to the produced artifact, if any */
|
|
69
|
+
artifact?: string;
|
|
70
|
+
/** Error message if outcome is 'fail' */
|
|
71
|
+
error?: string;
|
|
72
|
+
/** Execution time in milliseconds */
|
|
73
|
+
durationMs: number;
|
|
131
74
|
}
|
|
132
75
|
/**
|
|
133
|
-
*
|
|
76
|
+
* Final result of a complete workflow execution.
|
|
134
77
|
*/
|
|
135
|
-
interface
|
|
136
|
-
/**
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
|
|
78
|
+
interface WorkflowResult {
|
|
79
|
+
/** The workflow that was executed */
|
|
80
|
+
workflow: Workflow;
|
|
81
|
+
/** Results for each step in the workflow */
|
|
82
|
+
stepResults: WorkflowStepResult[];
|
|
83
|
+
/** Whether the overall workflow passed (all required gates passed) */
|
|
84
|
+
pass: boolean;
|
|
85
|
+
/** Total execution time in milliseconds */
|
|
86
|
+
totalDurationMs: number;
|
|
144
87
|
}
|
|
88
|
+
|
|
145
89
|
/**
|
|
146
|
-
*
|
|
90
|
+
* Predefined cognitive modes for skills.
|
|
147
91
|
*/
|
|
148
|
-
|
|
149
|
-
/** Unique ID for the session */
|
|
150
|
-
sessionId: string;
|
|
151
|
-
/** Workspace associated with this session */
|
|
152
|
-
workspacePath: string;
|
|
153
|
-
/** Name of the backend provider */
|
|
154
|
-
backendName: string;
|
|
155
|
-
/** ISO timestamp when the session started */
|
|
156
|
-
startedAt: string;
|
|
157
|
-
}
|
|
92
|
+
declare const STANDARD_COGNITIVE_MODES: readonly ["adversarial-reviewer", "constructive-architect", "meticulous-implementer", "diagnostic-investigator", "advisory-guide", "meticulous-verifier"];
|
|
158
93
|
/**
|
|
159
|
-
*
|
|
94
|
+
* Cognitive mode of a skill, determining its behavior and persona.
|
|
160
95
|
*/
|
|
161
|
-
|
|
162
|
-
/** ID of the active session */
|
|
163
|
-
sessionId: string;
|
|
164
|
-
/** User or system prompt for this turn */
|
|
165
|
-
prompt: string;
|
|
166
|
-
/** Whether this is a continuation of a previous turn */
|
|
167
|
-
isContinuation: boolean;
|
|
168
|
-
}
|
|
96
|
+
type CognitiveMode = (typeof STANDARD_COGNITIVE_MODES)[number] | (string & {});
|
|
169
97
|
/**
|
|
170
|
-
*
|
|
98
|
+
* Static metadata for a skill.
|
|
171
99
|
*/
|
|
172
|
-
interface
|
|
173
|
-
/**
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
|
|
181
|
-
/** Event payload */
|
|
182
|
-
content?: unknown;
|
|
183
|
-
/** Session ID if not implicit */
|
|
184
|
-
sessionId?: string;
|
|
100
|
+
interface SkillMetadata {
|
|
101
|
+
/** Unique name of the skill */
|
|
102
|
+
name: string;
|
|
103
|
+
/** Semantic version string */
|
|
104
|
+
version: string;
|
|
105
|
+
/** Brief description of what the skill does */
|
|
106
|
+
description: string;
|
|
107
|
+
/** The cognitive mode this skill operates in */
|
|
108
|
+
cognitive_mode?: CognitiveMode;
|
|
185
109
|
}
|
|
186
110
|
/**
|
|
187
|
-
*
|
|
111
|
+
* Contextual information for a skill execution.
|
|
188
112
|
*/
|
|
189
|
-
interface
|
|
190
|
-
/**
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
|
|
113
|
+
interface SkillContext {
|
|
114
|
+
/** Name of the executing skill */
|
|
115
|
+
skillName: string;
|
|
116
|
+
/** Current pipeline phase */
|
|
117
|
+
phase: string;
|
|
118
|
+
/** Files relevant to the current execution */
|
|
119
|
+
files: string[];
|
|
120
|
+
/** Optional token budget — uses a plain record to avoid cross-package deps. */
|
|
121
|
+
tokenBudget?: Record<string, number>;
|
|
122
|
+
/** Additional metadata */
|
|
123
|
+
metadata: Record<string, unknown>;
|
|
198
124
|
}
|
|
199
125
|
/**
|
|
200
|
-
*
|
|
126
|
+
* Context for a single turn in a multi-turn skill interaction.
|
|
201
127
|
*/
|
|
202
|
-
interface
|
|
203
|
-
/**
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
|
|
207
|
-
/** Runs a turn and streams events */
|
|
208
|
-
runTurn(session: AgentSession, params: TurnParams): AsyncGenerator<AgentEvent, TurnResult, void>;
|
|
209
|
-
/** Stops and cleans up a session */
|
|
210
|
-
stopSession(session: AgentSession): Promise<Result<void, AgentError>>;
|
|
211
|
-
/** Verifies connectivity and health */
|
|
212
|
-
healthCheck(): Promise<Result<void, AgentError>>;
|
|
128
|
+
interface TurnContext extends SkillContext {
|
|
129
|
+
/** Current turn number (1-indexed) */
|
|
130
|
+
turnNumber: number;
|
|
131
|
+
/** Results from previous turns in the same session */
|
|
132
|
+
previousResults: unknown[];
|
|
213
133
|
}
|
|
214
134
|
/**
|
|
215
|
-
*
|
|
135
|
+
* Error reported by a skill.
|
|
216
136
|
*/
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
|
|
224
|
-
}
|
|
137
|
+
type SkillError = {
|
|
138
|
+
/** Machine-readable error code */
|
|
139
|
+
code: string;
|
|
140
|
+
/** Human-readable error message */
|
|
141
|
+
message: string;
|
|
142
|
+
/** Phase in which the error occurred */
|
|
143
|
+
phase: string;
|
|
144
|
+
};
|
|
225
145
|
/**
|
|
226
|
-
*
|
|
146
|
+
* Result of a skill execution.
|
|
227
147
|
*/
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
projectSlug?: string;
|
|
237
|
-
/** Local file path for file-based trackers */
|
|
238
|
-
filePath?: string;
|
|
239
|
-
/** States considered "ready for work" */
|
|
240
|
-
activeStates: string[];
|
|
241
|
-
/** States considered "finished" */
|
|
242
|
-
terminalStates: string[];
|
|
243
|
-
}
|
|
148
|
+
type SkillResult = {
|
|
149
|
+
/** Whether the skill achieved its goal */
|
|
150
|
+
success: boolean;
|
|
151
|
+
/** List of artifact paths produced */
|
|
152
|
+
artifacts: string[];
|
|
153
|
+
/** One-line summary of the outcome */
|
|
154
|
+
summary: string;
|
|
155
|
+
};
|
|
244
156
|
/**
|
|
245
|
-
*
|
|
157
|
+
* Lifecycle hooks for skills.
|
|
246
158
|
*/
|
|
247
|
-
interface
|
|
248
|
-
/**
|
|
249
|
-
|
|
159
|
+
interface SkillLifecycleHooks {
|
|
160
|
+
/** Called before the skill starts execution */
|
|
161
|
+
preExecution?: (context: SkillContext) => SkillContext | null;
|
|
162
|
+
/** Called before each turn in a multi-turn interaction */
|
|
163
|
+
perTurn?: (context: TurnContext) => TurnContext | null;
|
|
164
|
+
/** Called after the skill completes execution */
|
|
165
|
+
postExecution?: (context: SkillContext, result: SkillResult) => void;
|
|
250
166
|
}
|
|
167
|
+
|
|
251
168
|
/**
|
|
252
|
-
*
|
|
169
|
+
* Names of standard CI checks.
|
|
253
170
|
*/
|
|
254
|
-
|
|
255
|
-
/** Root directory where agent workspaces are created */
|
|
256
|
-
root: string;
|
|
257
|
-
}
|
|
171
|
+
type CICheckName = 'validate' | 'deps' | 'docs' | 'entropy' | 'security' | 'perf' | 'phase-gate' | 'arch' | 'traceability';
|
|
258
172
|
/**
|
|
259
|
-
*
|
|
173
|
+
* Status of a CI check.
|
|
260
174
|
*/
|
|
261
|
-
|
|
262
|
-
/** Script to run after creating a workspace */
|
|
263
|
-
afterCreate: string | null;
|
|
264
|
-
/** Script to run before starting an agent */
|
|
265
|
-
beforeRun: string | null;
|
|
266
|
-
/** Script to run after an agent completes */
|
|
267
|
-
afterRun: string | null;
|
|
268
|
-
/** Script to run before removing a workspace */
|
|
269
|
-
beforeRemove: string | null;
|
|
270
|
-
/** Maximum time allowed for hook execution */
|
|
271
|
-
timeoutMs: number;
|
|
272
|
-
}
|
|
175
|
+
type CICheckStatus = 'pass' | 'fail' | 'warn' | 'skip';
|
|
273
176
|
/**
|
|
274
|
-
*
|
|
177
|
+
* A specific issue found during a CI check.
|
|
275
178
|
*/
|
|
276
|
-
interface
|
|
277
|
-
/**
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
|
|
285
|
-
/** Global limit on concurrent agents */
|
|
286
|
-
maxConcurrentAgents: number;
|
|
287
|
-
/** Maximum turns allowed per session */
|
|
288
|
-
maxTurns: number;
|
|
289
|
-
/** Maximum backoff for retries */
|
|
290
|
-
maxRetryBackoffMs: number;
|
|
291
|
-
/** Concurrency limits partitioned by issue state */
|
|
292
|
-
maxConcurrentAgentsByState: Record<string, number>;
|
|
293
|
-
/** Policy for approving tool calls */
|
|
294
|
-
approvalPolicy?: string;
|
|
295
|
-
/** Policy for execution environment isolation */
|
|
296
|
-
sandboxPolicy?: string;
|
|
297
|
-
/** Timeout for a single turn */
|
|
298
|
-
turnTimeoutMs: number;
|
|
299
|
-
/** Timeout for reading from the agent */
|
|
300
|
-
readTimeoutMs: number;
|
|
301
|
-
/** Timeout for agent inactivity */
|
|
302
|
-
stallTimeoutMs: number;
|
|
179
|
+
interface CICheckIssue {
|
|
180
|
+
/** Severity level */
|
|
181
|
+
severity: 'error' | 'warning';
|
|
182
|
+
/** Descriptive message */
|
|
183
|
+
message: string;
|
|
184
|
+
/** Path to the affected file */
|
|
185
|
+
file?: string;
|
|
186
|
+
/** Line number in the affected file */
|
|
187
|
+
line?: number;
|
|
303
188
|
}
|
|
304
189
|
/**
|
|
305
|
-
*
|
|
190
|
+
* Result of a single CI check execution.
|
|
306
191
|
*/
|
|
307
|
-
interface
|
|
308
|
-
/**
|
|
309
|
-
|
|
192
|
+
interface CICheckResult {
|
|
193
|
+
/** Name of the check */
|
|
194
|
+
name: CICheckName;
|
|
195
|
+
/** Final status of the check */
|
|
196
|
+
status: CICheckStatus;
|
|
197
|
+
/** List of issues discovered */
|
|
198
|
+
issues: CICheckIssue[];
|
|
199
|
+
/** Execution time in milliseconds */
|
|
200
|
+
durationMs: number;
|
|
310
201
|
}
|
|
311
202
|
/**
|
|
312
|
-
*
|
|
203
|
+
* Summary counts for a set of CI checks.
|
|
313
204
|
*/
|
|
314
|
-
interface
|
|
315
|
-
/**
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
|
|
325
|
-
/** Server settings */
|
|
326
|
-
server: ServerConfig;
|
|
205
|
+
interface CICheckSummary {
|
|
206
|
+
/** Total number of checks run */
|
|
207
|
+
total: number;
|
|
208
|
+
/** Number of passing checks */
|
|
209
|
+
passed: number;
|
|
210
|
+
/** Number of failing checks */
|
|
211
|
+
failed: number;
|
|
212
|
+
/** Number of checks with warnings */
|
|
213
|
+
warnings: number;
|
|
214
|
+
/** Number of skipped checks */
|
|
215
|
+
skipped: number;
|
|
327
216
|
}
|
|
328
217
|
/**
|
|
329
|
-
*
|
|
218
|
+
* Final report for a CI run.
|
|
330
219
|
*/
|
|
331
|
-
interface
|
|
332
|
-
/**
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
|
|
220
|
+
interface CICheckReport {
|
|
221
|
+
/** Schema version */
|
|
222
|
+
version: 1;
|
|
223
|
+
/** Name of the project */
|
|
224
|
+
project: string;
|
|
225
|
+
/** ISO timestamp of the run */
|
|
226
|
+
timestamp: string;
|
|
227
|
+
/** Detailed results for each check */
|
|
228
|
+
checks: CICheckResult[];
|
|
229
|
+
/** Aggregated summary */
|
|
230
|
+
summary: CICheckSummary;
|
|
231
|
+
/** Process exit code suggested for the CI runner */
|
|
232
|
+
exitCode: 0 | 1 | 2;
|
|
336
233
|
}
|
|
337
|
-
|
|
338
234
|
/**
|
|
339
|
-
*
|
|
340
|
-
* Composes TokenUsage — does not extend it.
|
|
235
|
+
* Severity level that should trigger a CI failure.
|
|
341
236
|
*/
|
|
342
|
-
|
|
343
|
-
/** Harness session identifier */
|
|
344
|
-
sessionId: string;
|
|
345
|
-
/** ISO 8601 timestamp of the usage event */
|
|
346
|
-
timestamp: string;
|
|
347
|
-
/** Token counts for this event */
|
|
348
|
-
tokens: TokenUsage;
|
|
349
|
-
/** Tokens used to create prompt cache entries */
|
|
350
|
-
cacheCreationTokens?: number;
|
|
351
|
-
/** Tokens read from prompt cache */
|
|
352
|
-
cacheReadTokens?: number;
|
|
353
|
-
/** Model identifier (e.g., "claude-sonnet-4-20250514") */
|
|
354
|
-
model?: string;
|
|
355
|
-
/** Cost in integer microdollars (USD * 1,000,000), calculated at read time */
|
|
356
|
-
costMicroUSD?: number;
|
|
357
|
-
}
|
|
237
|
+
type CIFailOnSeverity = 'error' | 'warning';
|
|
358
238
|
/**
|
|
359
|
-
*
|
|
239
|
+
* Configuration options for the CI command.
|
|
360
240
|
*/
|
|
361
|
-
interface
|
|
362
|
-
/**
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
|
|
368
|
-
/** Cache write/creation cost per 1M tokens */
|
|
369
|
-
cacheWritePer1M?: number;
|
|
241
|
+
interface CICheckOptions {
|
|
242
|
+
/** Checks to skip */
|
|
243
|
+
skip?: CICheckName[];
|
|
244
|
+
/** Severity level that causes failure */
|
|
245
|
+
failOn?: CIFailOnSeverity;
|
|
246
|
+
/** Custom config file path */
|
|
247
|
+
configPath?: string;
|
|
370
248
|
}
|
|
371
249
|
/**
|
|
372
|
-
*
|
|
250
|
+
* Supported CI platforms.
|
|
373
251
|
*/
|
|
374
|
-
|
|
375
|
-
/** ISO 8601 date string (YYYY-MM-DD) */
|
|
376
|
-
date: string;
|
|
377
|
-
/** Number of distinct sessions that had activity on this day */
|
|
378
|
-
sessionCount: number;
|
|
379
|
-
/** Summed token counts across all sessions */
|
|
380
|
-
tokens: TokenUsage;
|
|
381
|
-
/** Summed cache creation tokens (omitted if no cache data) */
|
|
382
|
-
cacheCreationTokens?: number;
|
|
383
|
-
/** Summed cache read tokens (omitted if no cache data) */
|
|
384
|
-
cacheReadTokens?: number;
|
|
385
|
-
/** Total cost in integer microdollars, null if any session has unknown pricing */
|
|
386
|
-
costMicroUSD: number | null;
|
|
387
|
-
/** Distinct model identifiers seen on this day */
|
|
388
|
-
models: string[];
|
|
389
|
-
}
|
|
252
|
+
type CIPlatform = 'github' | 'gitlab' | 'generic';
|
|
390
253
|
/**
|
|
391
|
-
*
|
|
254
|
+
* Options for initializing CI configuration.
|
|
392
255
|
*/
|
|
393
|
-
interface
|
|
394
|
-
/**
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
|
|
398
|
-
/** ISO 8601 timestamp of the last event in this session */
|
|
399
|
-
lastTimestamp: string;
|
|
400
|
-
/** Summed token counts across all turns */
|
|
401
|
-
tokens: TokenUsage;
|
|
402
|
-
/** Summed cache creation tokens (omitted if no cache data) */
|
|
403
|
-
cacheCreationTokens?: number;
|
|
404
|
-
/** Summed cache read tokens (omitted if no cache data) */
|
|
405
|
-
cacheReadTokens?: number;
|
|
406
|
-
/** Model identifier (may be populated from CC data) */
|
|
407
|
-
model?: string;
|
|
408
|
-
/** Total cost in integer microdollars, null if pricing unavailable */
|
|
409
|
-
costMicroUSD: number | null;
|
|
410
|
-
/** Data source: 'harness', 'claude-code', or 'merged' */
|
|
411
|
-
source: 'harness' | 'claude-code' | 'merged';
|
|
256
|
+
interface CIInitOptions {
|
|
257
|
+
/** Target CI platform */
|
|
258
|
+
platform?: CIPlatform;
|
|
259
|
+
/** Checks to enable */
|
|
260
|
+
checks?: CICheckName[];
|
|
412
261
|
}
|
|
413
262
|
|
|
414
263
|
/**
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
* Session memory allows skills to append to shared sections (terminology,
|
|
418
|
-
* decisions, constraints, risks, openQuestions, evidence) rather than
|
|
419
|
-
* overwriting. Each entry is timestamped and tagged with the authoring skill.
|
|
420
|
-
*
|
|
421
|
-
* @see docs/changes/ai-foundations-integration/proposal.md
|
|
422
|
-
*/
|
|
423
|
-
/**
|
|
424
|
-
* Names of accumulative session sections.
|
|
425
|
-
* Runtime array used for iteration and validation.
|
|
426
|
-
*/
|
|
427
|
-
declare const SESSION_SECTION_NAMES: readonly ["terminology", "decisions", "constraints", "risks", "openQuestions", "evidence"];
|
|
428
|
-
/**
|
|
429
|
-
* Union type of valid session section names.
|
|
264
|
+
* Valid statuses for a roadmap feature.
|
|
430
265
|
*/
|
|
431
|
-
type
|
|
266
|
+
type FeatureStatus = 'backlog' | 'planned' | 'in-progress' | 'done' | 'blocked';
|
|
432
267
|
/**
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
* - `resolved` — addressed or answered (e.g., an open question that was resolved)
|
|
436
|
-
* - `superseded` — replaced by a newer entry
|
|
268
|
+
* Priority override levels for roadmap features.
|
|
269
|
+
* When present, priority replaces positional ordering as the primary sort key.
|
|
437
270
|
*/
|
|
438
|
-
type
|
|
271
|
+
type Priority = 'P0' | 'P1' | 'P2' | 'P3';
|
|
439
272
|
/**
|
|
440
|
-
* A
|
|
441
|
-
* Entries are append-only; skills mark them as `resolved` or `superseded`
|
|
442
|
-
* rather than deleting.
|
|
273
|
+
* A feature entry in the project roadmap.
|
|
443
274
|
*/
|
|
444
|
-
interface
|
|
445
|
-
/**
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
|
|
275
|
+
interface RoadmapFeature {
|
|
276
|
+
/** Feature name (from the H3 heading, without "Feature:" prefix) */
|
|
277
|
+
name: string;
|
|
278
|
+
/** Current status */
|
|
279
|
+
status: FeatureStatus;
|
|
280
|
+
/** Relative path to the spec file, or null if none */
|
|
281
|
+
spec: string | null;
|
|
282
|
+
/** Relative paths to plan files */
|
|
283
|
+
plans: string[];
|
|
284
|
+
/** Names of blocking features (textual references) */
|
|
285
|
+
blockedBy: string[];
|
|
286
|
+
/** One-line summary */
|
|
287
|
+
summary: string;
|
|
288
|
+
/** GitHub username, email, or display name — null if unassigned */
|
|
289
|
+
assignee: string | null;
|
|
290
|
+
/** Optional priority override — null uses positional ordering */
|
|
291
|
+
priority: Priority | null;
|
|
292
|
+
/** External tracker ID (e.g., "github:owner/repo#42") — null if not synced */
|
|
293
|
+
externalId: string | null;
|
|
455
294
|
}
|
|
456
295
|
/**
|
|
457
|
-
*
|
|
458
|
-
*
|
|
296
|
+
* A milestone grouping in the roadmap. The special "Backlog" milestone
|
|
297
|
+
* has `isBacklog: true` and appears as `## Backlog` instead of `## Milestone: <name>`.
|
|
459
298
|
*/
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
299
|
+
interface RoadmapMilestone {
|
|
300
|
+
/** Milestone name (e.g., "MVP Release") or "Backlog" */
|
|
301
|
+
name: string;
|
|
302
|
+
/** True for the special Backlog section */
|
|
303
|
+
isBacklog: boolean;
|
|
304
|
+
/** Features in this milestone, in document order */
|
|
305
|
+
features: RoadmapFeature[];
|
|
306
|
+
}
|
|
464
307
|
/**
|
|
465
|
-
*
|
|
466
|
-
*
|
|
467
|
-
* Core types and interfaces for Harness Engineering toolkit
|
|
308
|
+
* A single record in the assignment history log.
|
|
309
|
+
* Reassignment produces two records: 'unassigned' for previous, 'assigned' for new.
|
|
468
310
|
*/
|
|
311
|
+
interface AssignmentRecord {
|
|
312
|
+
/** Feature name */
|
|
313
|
+
feature: string;
|
|
314
|
+
/** Assignee identifier (username, email, or display name) */
|
|
315
|
+
assignee: string;
|
|
316
|
+
/** What happened */
|
|
317
|
+
action: 'assigned' | 'completed' | 'unassigned';
|
|
318
|
+
/** ISO date string (YYYY-MM-DD) */
|
|
319
|
+
date: string;
|
|
320
|
+
}
|
|
469
321
|
/**
|
|
470
|
-
*
|
|
322
|
+
* YAML frontmatter of the roadmap file.
|
|
471
323
|
*/
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
324
|
+
interface RoadmapFrontmatter {
|
|
325
|
+
/** Project name */
|
|
326
|
+
project: string;
|
|
327
|
+
/** Schema version (currently 1) */
|
|
328
|
+
version: number;
|
|
329
|
+
/** ISO date when roadmap was created */
|
|
330
|
+
created?: string;
|
|
331
|
+
/** ISO date when roadmap was last updated */
|
|
332
|
+
updated?: string;
|
|
333
|
+
/** ISO timestamp of last automated sync */
|
|
334
|
+
lastSynced: string;
|
|
335
|
+
/** ISO timestamp of last manual edit */
|
|
336
|
+
lastManualEdit: string;
|
|
337
|
+
}
|
|
479
338
|
/**
|
|
480
|
-
*
|
|
339
|
+
* Parsed roadmap document.
|
|
481
340
|
*/
|
|
482
|
-
|
|
341
|
+
interface Roadmap {
|
|
342
|
+
/** Parsed frontmatter */
|
|
343
|
+
frontmatter: RoadmapFrontmatter;
|
|
344
|
+
/** Milestones in document order (including Backlog) */
|
|
345
|
+
milestones: RoadmapMilestone[];
|
|
346
|
+
/** Assignment history records, in document order */
|
|
347
|
+
assignmentHistory: AssignmentRecord[];
|
|
348
|
+
}
|
|
349
|
+
|
|
483
350
|
/**
|
|
484
|
-
*
|
|
351
|
+
* Represents a ticket created in an external tracking service.
|
|
485
352
|
*/
|
|
486
|
-
|
|
353
|
+
interface ExternalTicket {
|
|
354
|
+
/** External identifier, e.g., "github:owner/repo#42" */
|
|
355
|
+
externalId: string;
|
|
356
|
+
/** URL to the ticket in the external service */
|
|
357
|
+
url: string;
|
|
358
|
+
}
|
|
487
359
|
/**
|
|
488
|
-
*
|
|
360
|
+
* Current state of a ticket in the external service.
|
|
361
|
+
* Pulled during syncFromExternal.
|
|
489
362
|
*/
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
363
|
+
interface ExternalTicketState {
|
|
364
|
+
/** External identifier */
|
|
365
|
+
externalId: string;
|
|
366
|
+
/** Ticket title in the external service */
|
|
367
|
+
title: string;
|
|
368
|
+
/** External status (e.g., "open", "closed") */
|
|
369
|
+
status: string;
|
|
370
|
+
/** External labels (used for status disambiguation on GitHub) */
|
|
371
|
+
labels: string[];
|
|
372
|
+
/** Current assignee in the external service, or null */
|
|
373
|
+
assignee: string | null;
|
|
374
|
+
}
|
|
494
375
|
/**
|
|
495
|
-
*
|
|
376
|
+
* Result of a sync operation. Collects successes and errors per-feature.
|
|
496
377
|
*/
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
378
|
+
interface SyncResult {
|
|
379
|
+
/** Tickets created during this sync */
|
|
380
|
+
created: ExternalTicket[];
|
|
381
|
+
/** External IDs of tickets that were updated */
|
|
382
|
+
updated: string[];
|
|
383
|
+
/** Assignment changes detected during pull */
|
|
384
|
+
assignmentChanges: Array<{
|
|
385
|
+
feature: string;
|
|
386
|
+
from: string | null;
|
|
387
|
+
to: string | null;
|
|
388
|
+
}>;
|
|
389
|
+
/** Per-feature errors (sync never throws) */
|
|
390
|
+
errors: Array<{
|
|
391
|
+
featureOrId: string;
|
|
392
|
+
error: Error;
|
|
393
|
+
}>;
|
|
394
|
+
}
|
|
501
395
|
/**
|
|
502
|
-
*
|
|
396
|
+
* Configuration for external tracker sync.
|
|
503
397
|
*/
|
|
504
|
-
interface
|
|
505
|
-
/**
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
|
|
398
|
+
interface TrackerSyncConfig {
|
|
399
|
+
/** Adapter kind -- narrowed to GitHub-only for now */
|
|
400
|
+
kind: 'github';
|
|
401
|
+
/** Repository in "owner/repo" format (for GitHub) */
|
|
402
|
+
repo?: string;
|
|
403
|
+
/** Labels auto-applied to created tickets for filtering + identification */
|
|
404
|
+
labels?: string[];
|
|
405
|
+
/** Maps roadmap status -> external status string */
|
|
406
|
+
statusMap: Record<FeatureStatus, string>;
|
|
407
|
+
/**
|
|
408
|
+
* Maps external status (+ optional label) -> roadmap status.
|
|
409
|
+
* Compound keys like "open:in-progress" express state + label.
|
|
410
|
+
* Optional — when absent, syncFromExternal preserves current roadmap status.
|
|
411
|
+
*/
|
|
412
|
+
reverseStatusMap?: Record<string, FeatureStatus>;
|
|
513
413
|
}
|
|
414
|
+
|
|
514
415
|
/**
|
|
515
|
-
*
|
|
416
|
+
* Token usage statistics for an agent turn or session.
|
|
516
417
|
*/
|
|
517
|
-
interface
|
|
518
|
-
/**
|
|
519
|
-
|
|
520
|
-
/**
|
|
521
|
-
|
|
418
|
+
interface TokenUsage {
|
|
419
|
+
/** Number of tokens used in the input (prompt) */
|
|
420
|
+
inputTokens: number;
|
|
421
|
+
/** Number of tokens generated in the output (response) */
|
|
422
|
+
outputTokens: number;
|
|
423
|
+
/** Combined total tokens used */
|
|
424
|
+
totalTokens: number;
|
|
522
425
|
}
|
|
523
426
|
/**
|
|
524
|
-
*
|
|
427
|
+
* Reference to a blocking issue.
|
|
525
428
|
*/
|
|
526
|
-
|
|
429
|
+
interface BlockerRef {
|
|
430
|
+
/** Unique ID of the blocker */
|
|
431
|
+
id: string | null;
|
|
432
|
+
/** Human-readable identifier (e.g., "CORE-123") */
|
|
433
|
+
identifier: string | null;
|
|
434
|
+
/** Current state of the blocker */
|
|
435
|
+
state: string | null;
|
|
436
|
+
}
|
|
527
437
|
/**
|
|
528
|
-
*
|
|
438
|
+
* Representation of a work item (issue/feature) in a tracker.
|
|
529
439
|
*/
|
|
530
|
-
interface
|
|
531
|
-
/**
|
|
532
|
-
|
|
533
|
-
/**
|
|
534
|
-
|
|
535
|
-
/**
|
|
536
|
-
|
|
537
|
-
/**
|
|
538
|
-
|
|
539
|
-
/**
|
|
540
|
-
|
|
440
|
+
interface Issue {
|
|
441
|
+
/** Unique ID in the tracking system */
|
|
442
|
+
id: string;
|
|
443
|
+
/** Human-readable identifier (e.g., "CORE-123") */
|
|
444
|
+
identifier: string;
|
|
445
|
+
/** Title or headline of the issue */
|
|
446
|
+
title: string;
|
|
447
|
+
/** Detailed description, if available */
|
|
448
|
+
description: string | null;
|
|
449
|
+
/** Numerical priority (lower is typically higher priority) */
|
|
450
|
+
priority: number | null;
|
|
451
|
+
/** Current lifecycle state */
|
|
452
|
+
state: string;
|
|
453
|
+
/** Name of the git branch associated with this issue */
|
|
454
|
+
branchName: string | null;
|
|
455
|
+
/** Direct URL to the issue in the tracker */
|
|
456
|
+
url: string | null;
|
|
457
|
+
/** List of labels or tags */
|
|
458
|
+
labels: string[];
|
|
459
|
+
/** References to issues that block this one */
|
|
460
|
+
blockedBy: BlockerRef[];
|
|
461
|
+
/** ISO timestamp of creation */
|
|
462
|
+
createdAt: string | null;
|
|
463
|
+
/** ISO timestamp of last update */
|
|
464
|
+
updatedAt: string | null;
|
|
541
465
|
}
|
|
542
466
|
/**
|
|
543
|
-
*
|
|
467
|
+
* Categories of errors that can occur during agent execution.
|
|
544
468
|
*/
|
|
545
|
-
|
|
546
|
-
/** The workflow that was executed */
|
|
547
|
-
workflow: Workflow;
|
|
548
|
-
/** Results for each step in the workflow */
|
|
549
|
-
stepResults: WorkflowStepResult[];
|
|
550
|
-
/** Whether the overall workflow passed (all required gates passed) */
|
|
551
|
-
pass: boolean;
|
|
552
|
-
/** Total execution time in milliseconds */
|
|
553
|
-
totalDurationMs: number;
|
|
554
|
-
}
|
|
469
|
+
type AgentErrorCategory = 'agent_not_found' | 'invalid_workspace_cwd' | 'response_timeout' | 'turn_timeout' | 'process_exit' | 'response_error' | 'turn_failed' | 'turn_cancelled' | 'turn_input_required';
|
|
555
470
|
/**
|
|
556
|
-
*
|
|
471
|
+
* Error returned by an agent backend.
|
|
557
472
|
*/
|
|
558
|
-
|
|
473
|
+
interface AgentError {
|
|
474
|
+
/** Machine-readable category */
|
|
475
|
+
category: AgentErrorCategory;
|
|
476
|
+
/** Human-readable message */
|
|
477
|
+
message: string;
|
|
478
|
+
/** Optional additional context */
|
|
479
|
+
details?: unknown;
|
|
480
|
+
}
|
|
559
481
|
/**
|
|
560
|
-
*
|
|
482
|
+
* Parameters for starting a new agent session.
|
|
561
483
|
*/
|
|
562
|
-
|
|
484
|
+
interface SessionStartParams {
|
|
485
|
+
/** Absolute path to the workspace directory */
|
|
486
|
+
workspacePath: string;
|
|
487
|
+
/** Permission level for the agent (e.g., "readonly", "full") */
|
|
488
|
+
permissionMode: string;
|
|
489
|
+
/** List of tool names the agent is allowed to use */
|
|
490
|
+
allowedTools?: string[];
|
|
491
|
+
/** Custom system instructions for the agent */
|
|
492
|
+
systemPrompt?: string;
|
|
493
|
+
}
|
|
563
494
|
/**
|
|
564
|
-
*
|
|
495
|
+
* Represents an active session with an agent backend.
|
|
565
496
|
*/
|
|
566
|
-
interface
|
|
567
|
-
/** Unique
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
|
|
571
|
-
/**
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
|
|
497
|
+
interface AgentSession {
|
|
498
|
+
/** Unique ID for the session */
|
|
499
|
+
sessionId: string;
|
|
500
|
+
/** Workspace associated with this session */
|
|
501
|
+
workspacePath: string;
|
|
502
|
+
/** Name of the backend provider */
|
|
503
|
+
backendName: string;
|
|
504
|
+
/** ISO timestamp when the session started */
|
|
505
|
+
startedAt: string;
|
|
575
506
|
}
|
|
576
507
|
/**
|
|
577
|
-
*
|
|
508
|
+
* Parameters for a single interaction (turn) with an agent.
|
|
578
509
|
*/
|
|
579
|
-
interface
|
|
580
|
-
/**
|
|
581
|
-
|
|
582
|
-
/**
|
|
583
|
-
|
|
584
|
-
/**
|
|
585
|
-
|
|
586
|
-
/** Optional token budget — uses a plain record to avoid cross-package deps. */
|
|
587
|
-
tokenBudget?: Record<string, number>;
|
|
588
|
-
/** Additional metadata */
|
|
589
|
-
metadata: Record<string, unknown>;
|
|
510
|
+
interface TurnParams {
|
|
511
|
+
/** ID of the active session */
|
|
512
|
+
sessionId: string;
|
|
513
|
+
/** User or system prompt for this turn */
|
|
514
|
+
prompt: string;
|
|
515
|
+
/** Whether this is a continuation of a previous turn */
|
|
516
|
+
isContinuation: boolean;
|
|
590
517
|
}
|
|
591
518
|
/**
|
|
592
|
-
*
|
|
519
|
+
* Event emitted by an agent during a turn.
|
|
593
520
|
*/
|
|
594
|
-
interface
|
|
595
|
-
/**
|
|
596
|
-
|
|
597
|
-
/**
|
|
598
|
-
|
|
521
|
+
interface AgentEvent {
|
|
522
|
+
/** Event type (e.g., "thought", "tool_call", "output") */
|
|
523
|
+
type: string;
|
|
524
|
+
/** ISO timestamp */
|
|
525
|
+
timestamp: string;
|
|
526
|
+
/** Optional subtype for finer-grained classification */
|
|
527
|
+
subtype?: string;
|
|
528
|
+
/** Token usage snapshot if available */
|
|
529
|
+
usage?: TokenUsage;
|
|
530
|
+
/** Event payload */
|
|
531
|
+
content?: unknown;
|
|
532
|
+
/** Session ID if not implicit */
|
|
533
|
+
sessionId?: string;
|
|
599
534
|
}
|
|
600
535
|
/**
|
|
601
|
-
*
|
|
536
|
+
* Result of a completed agent turn.
|
|
602
537
|
*/
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
|
|
606
|
-
/**
|
|
607
|
-
|
|
608
|
-
/**
|
|
609
|
-
|
|
610
|
-
|
|
538
|
+
interface TurnResult {
|
|
539
|
+
/** Whether the turn completed successfully */
|
|
540
|
+
success: boolean;
|
|
541
|
+
/** ID of the session */
|
|
542
|
+
sessionId: string;
|
|
543
|
+
/** Cumulative usage for this turn */
|
|
544
|
+
usage: TokenUsage;
|
|
545
|
+
/** Error message if success is false */
|
|
546
|
+
error?: string;
|
|
547
|
+
}
|
|
611
548
|
/**
|
|
612
|
-
*
|
|
549
|
+
* Interface for agent backend implementations (Claude, Mock, etc.)
|
|
613
550
|
*/
|
|
614
|
-
|
|
551
|
+
interface AgentBackend {
|
|
552
|
+
/** Unique name of the backend */
|
|
553
|
+
readonly name: string;
|
|
554
|
+
/** Starts a new session */
|
|
555
|
+
startSession(params: SessionStartParams): Promise<Result<AgentSession, AgentError>>;
|
|
556
|
+
/** Runs a turn and streams events */
|
|
557
|
+
runTurn(session: AgentSession, params: TurnParams): AsyncGenerator<AgentEvent, TurnResult, void>;
|
|
558
|
+
/** Stops and cleans up a session */
|
|
559
|
+
stopSession(session: AgentSession): Promise<Result<void, AgentError>>;
|
|
560
|
+
/** Verifies connectivity and health */
|
|
561
|
+
healthCheck(): Promise<Result<void, AgentError>>;
|
|
562
|
+
}
|
|
615
563
|
/**
|
|
616
|
-
*
|
|
564
|
+
* Interface for issue tracking systems (Roadmap, Linear, GitHub, etc.)
|
|
617
565
|
*/
|
|
618
|
-
|
|
566
|
+
interface IssueTrackerClient {
|
|
567
|
+
/** Fetches issues eligible for agent assignment */
|
|
568
|
+
fetchCandidateIssues(): Promise<Result<Issue[], Error>>;
|
|
569
|
+
/** Fetches issues in specific lifecycle states */
|
|
570
|
+
fetchIssuesByStates(stateNames: string[]): Promise<Result<Issue[], Error>>;
|
|
571
|
+
/** Fetches current state for a set of issue IDs */
|
|
572
|
+
fetchIssueStatesByIds(issueIds: string[]): Promise<Result<Map<string, Issue>, Error>>;
|
|
573
|
+
}
|
|
619
574
|
/**
|
|
620
|
-
*
|
|
575
|
+
* Configuration for an issue tracker adapter.
|
|
621
576
|
*/
|
|
622
|
-
interface
|
|
623
|
-
/**
|
|
624
|
-
|
|
625
|
-
/**
|
|
626
|
-
|
|
627
|
-
/**
|
|
628
|
-
|
|
629
|
-
/**
|
|
630
|
-
|
|
577
|
+
interface TrackerConfig {
|
|
578
|
+
/** Adapter kind (e.g., "roadmap", "linear") */
|
|
579
|
+
kind: string;
|
|
580
|
+
/** API endpoint if applicable */
|
|
581
|
+
endpoint?: string;
|
|
582
|
+
/** API key or token */
|
|
583
|
+
apiKey?: string;
|
|
584
|
+
/** Project slug or identifier */
|
|
585
|
+
projectSlug?: string;
|
|
586
|
+
/** Local file path for file-based trackers */
|
|
587
|
+
filePath?: string;
|
|
588
|
+
/** States considered "ready for work" */
|
|
589
|
+
activeStates: string[];
|
|
590
|
+
/** States considered "finished" */
|
|
591
|
+
terminalStates: string[];
|
|
631
592
|
}
|
|
632
593
|
/**
|
|
633
|
-
*
|
|
594
|
+
* Polling interval configuration.
|
|
634
595
|
*/
|
|
635
|
-
interface
|
|
636
|
-
/**
|
|
637
|
-
|
|
638
|
-
/** Final status of the check */
|
|
639
|
-
status: CICheckStatus;
|
|
640
|
-
/** List of issues discovered */
|
|
641
|
-
issues: CICheckIssue[];
|
|
642
|
-
/** Execution time in milliseconds */
|
|
643
|
-
durationMs: number;
|
|
596
|
+
interface PollingConfig {
|
|
597
|
+
/** Interval in milliseconds */
|
|
598
|
+
intervalMs: number;
|
|
644
599
|
}
|
|
645
600
|
/**
|
|
646
|
-
*
|
|
601
|
+
* Workspace management configuration.
|
|
647
602
|
*/
|
|
648
|
-
interface
|
|
649
|
-
/**
|
|
650
|
-
|
|
651
|
-
/** Number of passing checks */
|
|
652
|
-
passed: number;
|
|
653
|
-
/** Number of failing checks */
|
|
654
|
-
failed: number;
|
|
655
|
-
/** Number of checks with warnings */
|
|
656
|
-
warnings: number;
|
|
657
|
-
/** Number of skipped checks */
|
|
658
|
-
skipped: number;
|
|
603
|
+
interface WorkspaceConfig {
|
|
604
|
+
/** Root directory where agent workspaces are created */
|
|
605
|
+
root: string;
|
|
659
606
|
}
|
|
660
607
|
/**
|
|
661
|
-
*
|
|
608
|
+
* Lifecycle hooks configuration.
|
|
662
609
|
*/
|
|
663
|
-
interface
|
|
664
|
-
/**
|
|
665
|
-
|
|
666
|
-
/**
|
|
667
|
-
|
|
668
|
-
/**
|
|
669
|
-
|
|
670
|
-
/**
|
|
671
|
-
|
|
672
|
-
/**
|
|
673
|
-
|
|
674
|
-
/** Process exit code suggested for the CI runner */
|
|
675
|
-
exitCode: 0 | 1 | 2;
|
|
610
|
+
interface HooksConfig {
|
|
611
|
+
/** Script to run after creating a workspace */
|
|
612
|
+
afterCreate: string | null;
|
|
613
|
+
/** Script to run before starting an agent */
|
|
614
|
+
beforeRun: string | null;
|
|
615
|
+
/** Script to run after an agent completes */
|
|
616
|
+
afterRun: string | null;
|
|
617
|
+
/** Script to run before removing a workspace */
|
|
618
|
+
beforeRemove: string | null;
|
|
619
|
+
/** Maximum time allowed for hook execution */
|
|
620
|
+
timeoutMs: number;
|
|
676
621
|
}
|
|
677
622
|
/**
|
|
678
|
-
*
|
|
623
|
+
* Configuration for the agent runner.
|
|
679
624
|
*/
|
|
680
|
-
|
|
625
|
+
interface AgentConfig {
|
|
626
|
+
/** Backend type to use */
|
|
627
|
+
backend: string;
|
|
628
|
+
/** Command to launch the agent if applicable */
|
|
629
|
+
command?: string;
|
|
630
|
+
/** Model name/identifier */
|
|
631
|
+
model?: string;
|
|
632
|
+
/** API key for the agent provider */
|
|
633
|
+
apiKey?: string;
|
|
634
|
+
/** Global limit on concurrent agents */
|
|
635
|
+
maxConcurrentAgents: number;
|
|
636
|
+
/** Maximum turns allowed per session */
|
|
637
|
+
maxTurns: number;
|
|
638
|
+
/** Maximum backoff for retries */
|
|
639
|
+
maxRetryBackoffMs: number;
|
|
640
|
+
/** Concurrency limits partitioned by issue state */
|
|
641
|
+
maxConcurrentAgentsByState: Record<string, number>;
|
|
642
|
+
/** Policy for approving tool calls */
|
|
643
|
+
approvalPolicy?: string;
|
|
644
|
+
/** Policy for execution environment isolation */
|
|
645
|
+
sandboxPolicy?: string;
|
|
646
|
+
/** Timeout for a single turn */
|
|
647
|
+
turnTimeoutMs: number;
|
|
648
|
+
/** Timeout for reading from the agent */
|
|
649
|
+
readTimeoutMs: number;
|
|
650
|
+
/** Timeout for agent inactivity */
|
|
651
|
+
stallTimeoutMs: number;
|
|
652
|
+
}
|
|
681
653
|
/**
|
|
682
|
-
*
|
|
654
|
+
* Internal server configuration.
|
|
683
655
|
*/
|
|
684
|
-
interface
|
|
685
|
-
/**
|
|
686
|
-
|
|
687
|
-
/** Severity level that causes failure */
|
|
688
|
-
failOn?: CIFailOnSeverity;
|
|
689
|
-
/** Custom config file path */
|
|
690
|
-
configPath?: string;
|
|
656
|
+
interface ServerConfig {
|
|
657
|
+
/** Port to listen on (null to disable) */
|
|
658
|
+
port: number | null;
|
|
691
659
|
}
|
|
692
660
|
/**
|
|
693
|
-
*
|
|
661
|
+
* Root workflow configuration object.
|
|
694
662
|
*/
|
|
695
|
-
|
|
663
|
+
interface WorkflowConfig {
|
|
664
|
+
/** Issue tracker settings */
|
|
665
|
+
tracker: TrackerConfig;
|
|
666
|
+
/** Polling loop settings */
|
|
667
|
+
polling: PollingConfig;
|
|
668
|
+
/** Workspace settings */
|
|
669
|
+
workspace: WorkspaceConfig;
|
|
670
|
+
/** Lifecycle hook settings */
|
|
671
|
+
hooks: HooksConfig;
|
|
672
|
+
/** Agent execution settings */
|
|
673
|
+
agent: AgentConfig;
|
|
674
|
+
/** Server settings */
|
|
675
|
+
server: ServerConfig;
|
|
676
|
+
}
|
|
696
677
|
/**
|
|
697
|
-
*
|
|
678
|
+
* Complete workflow definition including config and prompts.
|
|
698
679
|
*/
|
|
699
|
-
interface
|
|
700
|
-
/**
|
|
701
|
-
|
|
702
|
-
/**
|
|
703
|
-
|
|
680
|
+
interface WorkflowDefinition {
|
|
681
|
+
/** Orchestrator configuration */
|
|
682
|
+
config: WorkflowConfig;
|
|
683
|
+
/** Template used to generate agent prompts */
|
|
684
|
+
promptTemplate: string;
|
|
704
685
|
}
|
|
686
|
+
|
|
705
687
|
/**
|
|
706
|
-
*
|
|
688
|
+
* Extended entry for cost tracking storage and display.
|
|
689
|
+
* Composes TokenUsage — does not extend it.
|
|
707
690
|
*/
|
|
708
|
-
|
|
709
|
-
/**
|
|
710
|
-
|
|
711
|
-
/**
|
|
712
|
-
|
|
713
|
-
/**
|
|
714
|
-
|
|
715
|
-
|
|
691
|
+
interface UsageRecord {
|
|
692
|
+
/** Harness session identifier */
|
|
693
|
+
sessionId: string;
|
|
694
|
+
/** ISO 8601 timestamp of the usage event */
|
|
695
|
+
timestamp: string;
|
|
696
|
+
/** Token counts for this event */
|
|
697
|
+
tokens: TokenUsage;
|
|
698
|
+
/** Tokens used to create prompt cache entries */
|
|
699
|
+
cacheCreationTokens?: number;
|
|
700
|
+
/** Tokens read from prompt cache */
|
|
701
|
+
cacheReadTokens?: number;
|
|
702
|
+
/** Model identifier (e.g., "claude-sonnet-4-20250514") */
|
|
703
|
+
model?: string;
|
|
704
|
+
/** Cost in integer microdollars (USD * 1,000,000), calculated at read time */
|
|
705
|
+
costMicroUSD?: number;
|
|
706
|
+
}
|
|
716
707
|
/**
|
|
717
|
-
*
|
|
708
|
+
* Per-model pricing rates, all in USD per 1 million tokens.
|
|
718
709
|
*/
|
|
719
|
-
interface
|
|
720
|
-
/**
|
|
721
|
-
|
|
722
|
-
/**
|
|
723
|
-
|
|
724
|
-
/**
|
|
725
|
-
|
|
710
|
+
interface ModelPricing {
|
|
711
|
+
/** Input token cost per 1M tokens */
|
|
712
|
+
inputPer1M: number;
|
|
713
|
+
/** Output token cost per 1M tokens */
|
|
714
|
+
outputPer1M: number;
|
|
715
|
+
/** Cache read cost per 1M tokens (not all models support caching) */
|
|
716
|
+
cacheReadPer1M?: number;
|
|
717
|
+
/** Cache write/creation cost per 1M tokens */
|
|
718
|
+
cacheWritePer1M?: number;
|
|
726
719
|
}
|
|
727
720
|
/**
|
|
728
|
-
*
|
|
721
|
+
* Aggregated usage for a single calendar day.
|
|
729
722
|
*/
|
|
730
|
-
|
|
723
|
+
interface DailyUsage {
|
|
724
|
+
/** ISO 8601 date string (YYYY-MM-DD) */
|
|
725
|
+
date: string;
|
|
726
|
+
/** Number of distinct sessions that had activity on this day */
|
|
727
|
+
sessionCount: number;
|
|
728
|
+
/** Summed token counts across all sessions */
|
|
729
|
+
tokens: TokenUsage;
|
|
730
|
+
/** Summed cache creation tokens (omitted if no cache data) */
|
|
731
|
+
cacheCreationTokens?: number;
|
|
732
|
+
/** Summed cache read tokens (omitted if no cache data) */
|
|
733
|
+
cacheReadTokens?: number;
|
|
734
|
+
/** Total cost in integer microdollars, null if any session has unknown pricing */
|
|
735
|
+
costMicroUSD: number | null;
|
|
736
|
+
/** Distinct model identifiers seen on this day */
|
|
737
|
+
models: string[];
|
|
738
|
+
}
|
|
731
739
|
/**
|
|
732
|
-
*
|
|
733
|
-
* When present, priority replaces positional ordering as the primary sort key.
|
|
740
|
+
* Aggregated usage for a single session across all its turns.
|
|
734
741
|
*/
|
|
735
|
-
|
|
742
|
+
interface SessionUsage {
|
|
743
|
+
/** Harness session identifier */
|
|
744
|
+
sessionId: string;
|
|
745
|
+
/** ISO 8601 timestamp of the first event in this session */
|
|
746
|
+
firstTimestamp: string;
|
|
747
|
+
/** ISO 8601 timestamp of the last event in this session */
|
|
748
|
+
lastTimestamp: string;
|
|
749
|
+
/** Summed token counts across all turns */
|
|
750
|
+
tokens: TokenUsage;
|
|
751
|
+
/** Summed cache creation tokens (omitted if no cache data) */
|
|
752
|
+
cacheCreationTokens?: number;
|
|
753
|
+
/** Summed cache read tokens (omitted if no cache data) */
|
|
754
|
+
cacheReadTokens?: number;
|
|
755
|
+
/** Model identifier (may be populated from CC data) */
|
|
756
|
+
model?: string;
|
|
757
|
+
/** Total cost in integer microdollars, null if pricing unavailable */
|
|
758
|
+
costMicroUSD: number | null;
|
|
759
|
+
/** Data source: 'harness', 'claude-code', or 'merged' */
|
|
760
|
+
source: 'harness' | 'claude-code' | 'merged';
|
|
761
|
+
}
|
|
762
|
+
|
|
736
763
|
/**
|
|
737
|
-
*
|
|
764
|
+
* Session-scoped accumulative state types.
|
|
765
|
+
*
|
|
766
|
+
* Session memory allows skills to append to shared sections (terminology,
|
|
767
|
+
* decisions, constraints, risks, openQuestions, evidence) rather than
|
|
768
|
+
* overwriting. Each entry is timestamped and tagged with the authoring skill.
|
|
769
|
+
*
|
|
770
|
+
* @see docs/changes/ai-foundations-integration/proposal.md
|
|
738
771
|
*/
|
|
739
|
-
interface RoadmapFeature {
|
|
740
|
-
/** Feature name (from the H3 heading, without "Feature:" prefix) */
|
|
741
|
-
name: string;
|
|
742
|
-
/** Current status */
|
|
743
|
-
status: FeatureStatus;
|
|
744
|
-
/** Relative path to the spec file, or null if none */
|
|
745
|
-
spec: string | null;
|
|
746
|
-
/** Relative paths to plan files */
|
|
747
|
-
plans: string[];
|
|
748
|
-
/** Names of blocking features (textual references) */
|
|
749
|
-
blockedBy: string[];
|
|
750
|
-
/** One-line summary */
|
|
751
|
-
summary: string;
|
|
752
|
-
/** GitHub username, email, or display name — null if unassigned */
|
|
753
|
-
assignee: string | null;
|
|
754
|
-
/** Optional priority override — null uses positional ordering */
|
|
755
|
-
priority: Priority | null;
|
|
756
|
-
/** External tracker ID (e.g., "github:owner/repo#42") — null if not synced */
|
|
757
|
-
externalId: string | null;
|
|
758
|
-
}
|
|
759
772
|
/**
|
|
760
|
-
*
|
|
761
|
-
*
|
|
773
|
+
* Names of accumulative session sections.
|
|
774
|
+
* Runtime array used for iteration and validation.
|
|
762
775
|
*/
|
|
763
|
-
|
|
764
|
-
/** Milestone name (e.g., "MVP Release") or "Backlog" */
|
|
765
|
-
name: string;
|
|
766
|
-
/** True for the special Backlog section */
|
|
767
|
-
isBacklog: boolean;
|
|
768
|
-
/** Features in this milestone, in document order */
|
|
769
|
-
features: RoadmapFeature[];
|
|
770
|
-
}
|
|
776
|
+
declare const SESSION_SECTION_NAMES: readonly ["terminology", "decisions", "constraints", "risks", "openQuestions", "evidence"];
|
|
771
777
|
/**
|
|
772
|
-
*
|
|
773
|
-
* Reassignment produces two records: 'unassigned' for previous, 'assigned' for new.
|
|
778
|
+
* Union type of valid session section names.
|
|
774
779
|
*/
|
|
775
|
-
|
|
776
|
-
/** Feature name */
|
|
777
|
-
feature: string;
|
|
778
|
-
/** Assignee identifier (username, email, or display name) */
|
|
779
|
-
assignee: string;
|
|
780
|
-
/** What happened */
|
|
781
|
-
action: 'assigned' | 'completed' | 'unassigned';
|
|
782
|
-
/** ISO date string (YYYY-MM-DD) */
|
|
783
|
-
date: string;
|
|
784
|
-
}
|
|
780
|
+
type SessionSectionName = (typeof SESSION_SECTION_NAMES)[number];
|
|
785
781
|
/**
|
|
786
|
-
*
|
|
782
|
+
* Lifecycle status of a session entry.
|
|
783
|
+
* - `active` — current and relevant
|
|
784
|
+
* - `resolved` — addressed or answered (e.g., an open question that was resolved)
|
|
785
|
+
* - `superseded` — replaced by a newer entry
|
|
787
786
|
*/
|
|
788
|
-
|
|
789
|
-
/** Project name */
|
|
790
|
-
project: string;
|
|
791
|
-
/** Schema version (currently 1) */
|
|
792
|
-
version: number;
|
|
793
|
-
/** ISO date when roadmap was created */
|
|
794
|
-
created?: string;
|
|
795
|
-
/** ISO date when roadmap was last updated */
|
|
796
|
-
updated?: string;
|
|
797
|
-
/** ISO timestamp of last automated sync */
|
|
798
|
-
lastSynced: string;
|
|
799
|
-
/** ISO timestamp of last manual edit */
|
|
800
|
-
lastManualEdit: string;
|
|
801
|
-
}
|
|
787
|
+
type SessionEntryStatus = 'active' | 'resolved' | 'superseded';
|
|
802
788
|
/**
|
|
803
|
-
*
|
|
789
|
+
* A single entry in a session section.
|
|
790
|
+
* Entries are append-only; skills mark them as `resolved` or `superseded`
|
|
791
|
+
* rather than deleting.
|
|
804
792
|
*/
|
|
805
|
-
interface
|
|
806
|
-
/**
|
|
807
|
-
|
|
808
|
-
/**
|
|
809
|
-
|
|
810
|
-
/**
|
|
811
|
-
|
|
793
|
+
interface SessionEntry {
|
|
794
|
+
/** Auto-generated unique identifier */
|
|
795
|
+
id: string;
|
|
796
|
+
/** ISO 8601 timestamp of when the entry was created */
|
|
797
|
+
timestamp: string;
|
|
798
|
+
/** Name of the skill that authored this entry */
|
|
799
|
+
authorSkill: string;
|
|
800
|
+
/** The entry content (free-form text) */
|
|
801
|
+
content: string;
|
|
802
|
+
/** Lifecycle status of the entry */
|
|
803
|
+
status: SessionEntryStatus;
|
|
812
804
|
}
|
|
805
|
+
/**
|
|
806
|
+
* Container mapping each section name to its array of entries.
|
|
807
|
+
* Used as the shape of session-scoped state in `state.json`.
|
|
808
|
+
*/
|
|
809
|
+
type SessionSections = {
|
|
810
|
+
[K in SessionSectionName]: SessionEntry[];
|
|
811
|
+
};
|
|
813
812
|
|
|
814
813
|
export { type AgentBackend, type AgentConfig, type AgentError, type AgentErrorCategory, type AgentEvent, type AgentSession, type AssignmentRecord, type BlockerRef, type CICheckIssue, type CICheckName, type CICheckOptions, type CICheckReport, type CICheckResult, type CICheckStatus, type CICheckSummary, type CIFailOnSeverity, type CIInitOptions, type CIPlatform, type CognitiveMode, type DailyUsage, Err, type ExternalTicket, type ExternalTicketState, type FeatureStatus, type HooksConfig, type Issue, type IssueTrackerClient, type ModelPricing, Ok, type PollingConfig, type Priority, type Result, type Roadmap, type RoadmapFeature, type RoadmapFrontmatter, type RoadmapMilestone, SESSION_SECTION_NAMES, STANDARD_COGNITIVE_MODES, type ServerConfig, type SessionEntry, type SessionEntryStatus, type SessionSectionName, type SessionSections, type SessionStartParams, type SessionUsage, type SkillContext, type SkillError, type SkillLifecycleHooks, type SkillMetadata, type SkillResult, type StepOutcome, type SyncResult, type TokenUsage, type TrackerConfig, type TrackerSyncConfig, type TurnContext, type TurnParams, type TurnResult, type UsageRecord, type Workflow, type WorkflowConfig, type WorkflowDefinition, type WorkflowResult, type WorkflowStep, type WorkflowStepResult, type WorkspaceConfig, isErr, isOk };
|