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