@claxedo/agent-runtime-contract 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +37 -0
- package/dist/availability.d.ts +42 -0
- package/dist/capabilities.d.ts +31 -0
- package/dist/claims.d.ts +31 -0
- package/dist/connections.d.ts +21 -0
- package/dist/content.d.ts +411 -0
- package/dist/credential-broker-errors.d.ts +80 -0
- package/dist/errors.d.ts +43 -0
- package/dist/events.d.ts +460 -0
- package/dist/files.d.ts +52 -0
- package/dist/harness-effort.d.ts +56 -0
- package/dist/harness-table.d.ts +56 -0
- package/dist/harnesses.d.ts +96 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.mjs +815 -0
- package/dist/question-answers.d.ts +13 -0
- package/dist/session-group.d.ts +37 -0
- package/dist/sessions.d.ts +166 -0
- package/dist/tool-names.d.ts +3 -0
- package/dist/usage-windows.d.ts +23 -0
- package/dist/values.d.ts +10 -0
- package/package.json +53 -0
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { AgentExecutionBinding, AgentExecutionBindingExpectation, AgentExecutionBindingField } from "./sessions";
|
|
2
|
+
export declare const AGENT_RUNTIME_ERROR_CODES: readonly ["selection_required", "harness_unavailable", "workspace_offline", "unsupported_operation", "replay_gap", "upstream_error", "invalid_execution_binding"];
|
|
3
|
+
export type AgentRuntimeError = {
|
|
4
|
+
code: "selection_required";
|
|
5
|
+
message: string;
|
|
6
|
+
selection: "harness" | "model";
|
|
7
|
+
} | {
|
|
8
|
+
code: "harness_unavailable";
|
|
9
|
+
message: string;
|
|
10
|
+
connectionId: string;
|
|
11
|
+
} | {
|
|
12
|
+
code: "workspace_offline";
|
|
13
|
+
message: string;
|
|
14
|
+
workspaceId: string;
|
|
15
|
+
} | {
|
|
16
|
+
code: "unsupported_operation";
|
|
17
|
+
message: string;
|
|
18
|
+
operation: string;
|
|
19
|
+
} | {
|
|
20
|
+
code: "replay_gap";
|
|
21
|
+
message: string;
|
|
22
|
+
cursor: string;
|
|
23
|
+
} | {
|
|
24
|
+
code: "upstream_error";
|
|
25
|
+
message: string;
|
|
26
|
+
connectionId?: string;
|
|
27
|
+
} | {
|
|
28
|
+
code: "invalid_execution_binding";
|
|
29
|
+
message: string;
|
|
30
|
+
field: AgentExecutionBindingField;
|
|
31
|
+
};
|
|
32
|
+
export type ClientResult<T> = {
|
|
33
|
+
ok: true;
|
|
34
|
+
value: T;
|
|
35
|
+
} | {
|
|
36
|
+
ok: false;
|
|
37
|
+
error: AgentRuntimeError;
|
|
38
|
+
};
|
|
39
|
+
export declare class AgentRuntimeContractError extends Error {
|
|
40
|
+
readonly detail: AgentRuntimeError;
|
|
41
|
+
constructor(detail: AgentRuntimeError);
|
|
42
|
+
}
|
|
43
|
+
export declare function assertAgentExecutionBinding(binding: Readonly<AgentExecutionBinding>, expected?: AgentExecutionBindingExpectation): AgentExecutionBinding;
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
import type { AgentConfigOption, AgentContentPart, AgentMessageInfo, AgentPermission, AgentQuestion, AgentSnapshotFileDiff, AgentTodo } from "./content";
|
|
2
|
+
import type { AgentRuntimeStatus } from "./availability";
|
|
3
|
+
export type RuntimeTokenUsage = {
|
|
4
|
+
input: number | null;
|
|
5
|
+
output: number | null;
|
|
6
|
+
reasoning: number | null;
|
|
7
|
+
cache: {
|
|
8
|
+
read: number | null;
|
|
9
|
+
write: number | null;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type RuntimeUsageObservation = {
|
|
13
|
+
kind: "cumulative" | "delta";
|
|
14
|
+
tokens: RuntimeTokenUsage;
|
|
15
|
+
sequence?: number;
|
|
16
|
+
providerObservationId?: string;
|
|
17
|
+
nativeSessionId?: string;
|
|
18
|
+
observedAt?: number;
|
|
19
|
+
};
|
|
20
|
+
export type AgentPresentationEvent = {
|
|
21
|
+
id: string;
|
|
22
|
+
type: "message.updated";
|
|
23
|
+
properties: {
|
|
24
|
+
sessionID: string;
|
|
25
|
+
info: AgentMessageInfo & {
|
|
26
|
+
sessionID: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
} | {
|
|
30
|
+
id: string;
|
|
31
|
+
type: "message.removed";
|
|
32
|
+
properties: {
|
|
33
|
+
sessionID: string;
|
|
34
|
+
messageID: string;
|
|
35
|
+
};
|
|
36
|
+
} | {
|
|
37
|
+
id: string;
|
|
38
|
+
type: "message.part.updated";
|
|
39
|
+
properties: {
|
|
40
|
+
sessionID: string;
|
|
41
|
+
part: AgentContentPart;
|
|
42
|
+
time: number;
|
|
43
|
+
};
|
|
44
|
+
} | {
|
|
45
|
+
id: string;
|
|
46
|
+
type: "message.part.removed";
|
|
47
|
+
properties: {
|
|
48
|
+
sessionID: string;
|
|
49
|
+
messageID: string;
|
|
50
|
+
partID: string;
|
|
51
|
+
};
|
|
52
|
+
} | {
|
|
53
|
+
id: string;
|
|
54
|
+
type: "message.part.delta";
|
|
55
|
+
properties: {
|
|
56
|
+
sessionID: string;
|
|
57
|
+
messageID: string;
|
|
58
|
+
partID: string;
|
|
59
|
+
field: string;
|
|
60
|
+
delta: string;
|
|
61
|
+
};
|
|
62
|
+
} | {
|
|
63
|
+
type: "message.completed";
|
|
64
|
+
properties: {
|
|
65
|
+
sessionID: string;
|
|
66
|
+
messageID: string;
|
|
67
|
+
};
|
|
68
|
+
} | {
|
|
69
|
+
id: string;
|
|
70
|
+
type: "permission.asked";
|
|
71
|
+
properties: AgentPermission;
|
|
72
|
+
} | {
|
|
73
|
+
id: string;
|
|
74
|
+
type: "permission.replied";
|
|
75
|
+
properties: {
|
|
76
|
+
sessionID: string;
|
|
77
|
+
requestID: string;
|
|
78
|
+
reply: "once" | "always" | "reject";
|
|
79
|
+
};
|
|
80
|
+
} | {
|
|
81
|
+
id: string;
|
|
82
|
+
type: "question.asked";
|
|
83
|
+
properties: AgentQuestion;
|
|
84
|
+
} | {
|
|
85
|
+
id: string;
|
|
86
|
+
type: "question.replied";
|
|
87
|
+
properties: {
|
|
88
|
+
sessionID: string;
|
|
89
|
+
requestID: string;
|
|
90
|
+
answers: string[][];
|
|
91
|
+
};
|
|
92
|
+
} | {
|
|
93
|
+
id: string;
|
|
94
|
+
type: "question.rejected";
|
|
95
|
+
properties: {
|
|
96
|
+
sessionID: string;
|
|
97
|
+
requestID: string;
|
|
98
|
+
};
|
|
99
|
+
} | {
|
|
100
|
+
id: string;
|
|
101
|
+
type: "todo.updated";
|
|
102
|
+
properties: {
|
|
103
|
+
sessionID: string;
|
|
104
|
+
todos: AgentTodo[];
|
|
105
|
+
};
|
|
106
|
+
} | {
|
|
107
|
+
id: string;
|
|
108
|
+
type: "session.status";
|
|
109
|
+
properties: {
|
|
110
|
+
sessionID: string;
|
|
111
|
+
status: AgentRuntimeStatus;
|
|
112
|
+
};
|
|
113
|
+
} | {
|
|
114
|
+
id: string;
|
|
115
|
+
type: "session.idle";
|
|
116
|
+
properties: {
|
|
117
|
+
sessionID: string;
|
|
118
|
+
};
|
|
119
|
+
} | {
|
|
120
|
+
id: string;
|
|
121
|
+
type: "session.error";
|
|
122
|
+
properties: {
|
|
123
|
+
sessionID?: string;
|
|
124
|
+
error?: {
|
|
125
|
+
name: string;
|
|
126
|
+
data: Record<string, unknown> & {
|
|
127
|
+
message?: string;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
} | {
|
|
132
|
+
id: string;
|
|
133
|
+
type: "session.updated";
|
|
134
|
+
properties: {
|
|
135
|
+
sessionID: string;
|
|
136
|
+
info: import("./sessions").AgentSession;
|
|
137
|
+
};
|
|
138
|
+
} | {
|
|
139
|
+
id: string;
|
|
140
|
+
type: "session.diff";
|
|
141
|
+
properties: {
|
|
142
|
+
sessionID: string;
|
|
143
|
+
diff: AgentSnapshotFileDiff[];
|
|
144
|
+
};
|
|
145
|
+
} | {
|
|
146
|
+
id: string;
|
|
147
|
+
type: "session.compacted";
|
|
148
|
+
properties: {
|
|
149
|
+
sessionID: string;
|
|
150
|
+
};
|
|
151
|
+
} | {
|
|
152
|
+
type: "session.agent";
|
|
153
|
+
properties: {
|
|
154
|
+
sessionID: string;
|
|
155
|
+
agentId: string;
|
|
156
|
+
};
|
|
157
|
+
} | {
|
|
158
|
+
type: "session.config";
|
|
159
|
+
properties: {
|
|
160
|
+
sessionID: string;
|
|
161
|
+
options: AgentConfigOption[];
|
|
162
|
+
};
|
|
163
|
+
} | {
|
|
164
|
+
type: "session.usage";
|
|
165
|
+
properties: {
|
|
166
|
+
sessionID: string;
|
|
167
|
+
messageID?: string;
|
|
168
|
+
contextSize: number;
|
|
169
|
+
contextUsed: number;
|
|
170
|
+
observation?: RuntimeUsageObservation;
|
|
171
|
+
cost?: {
|
|
172
|
+
amount: number;
|
|
173
|
+
currency: string;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
} | {
|
|
177
|
+
id?: string;
|
|
178
|
+
type: "runtime.diagnostic";
|
|
179
|
+
properties: {
|
|
180
|
+
sessionID: string;
|
|
181
|
+
harness?: string;
|
|
182
|
+
threadId?: string;
|
|
183
|
+
projection?: string;
|
|
184
|
+
phase?: "ingest" | "terminalize";
|
|
185
|
+
code: string;
|
|
186
|
+
message: string;
|
|
187
|
+
severity: "debug" | "info" | "warn" | "error";
|
|
188
|
+
eventType?: string;
|
|
189
|
+
issues?: string[];
|
|
190
|
+
details?: unknown;
|
|
191
|
+
auth?: unknown;
|
|
192
|
+
rateLimit?: unknown;
|
|
193
|
+
mcp?: unknown;
|
|
194
|
+
diagnostic?: unknown;
|
|
195
|
+
raw?: unknown;
|
|
196
|
+
};
|
|
197
|
+
} | {
|
|
198
|
+
id: string;
|
|
199
|
+
type: "server.connected";
|
|
200
|
+
properties: Record<string, unknown>;
|
|
201
|
+
} | {
|
|
202
|
+
type: "server.heartbeat";
|
|
203
|
+
properties: Record<string, unknown>;
|
|
204
|
+
};
|
|
205
|
+
export type AgentPresentationEventType = AgentPresentationEvent["type"];
|
|
206
|
+
export declare const AGENT_PRESENTATION_EVENT_TYPE_REGISTRY: {
|
|
207
|
+
"message.updated": true;
|
|
208
|
+
"message.removed": true;
|
|
209
|
+
"message.part.updated": true;
|
|
210
|
+
"message.part.removed": true;
|
|
211
|
+
"message.part.delta": true;
|
|
212
|
+
"message.completed": true;
|
|
213
|
+
"permission.asked": true;
|
|
214
|
+
"permission.replied": true;
|
|
215
|
+
"question.asked": true;
|
|
216
|
+
"question.replied": true;
|
|
217
|
+
"question.rejected": true;
|
|
218
|
+
"todo.updated": true;
|
|
219
|
+
"session.status": true;
|
|
220
|
+
"session.idle": true;
|
|
221
|
+
"session.error": true;
|
|
222
|
+
"session.updated": true;
|
|
223
|
+
"session.diff": true;
|
|
224
|
+
"session.compacted": true;
|
|
225
|
+
"session.agent": true;
|
|
226
|
+
"session.config": true;
|
|
227
|
+
"session.usage": true;
|
|
228
|
+
"runtime.diagnostic": true;
|
|
229
|
+
"server.connected": true;
|
|
230
|
+
"server.heartbeat": true;
|
|
231
|
+
};
|
|
232
|
+
/** Sound because the registry is `satisfies Record<AgentPresentationEventType, true>`: its keys are exactly the union. */
|
|
233
|
+
export declare function isAgentPresentationEventType(value: string): value is AgentPresentationEventType;
|
|
234
|
+
export declare const AGENT_PRESENTATION_EVENT_TYPES: AgentPresentationEventType[];
|
|
235
|
+
export type AgentEventEnvelope<Event extends AgentPresentationEvent = AgentPresentationEvent> = {
|
|
236
|
+
directory: string;
|
|
237
|
+
payload: Event;
|
|
238
|
+
};
|
|
239
|
+
export type RawHarnessEvent = {
|
|
240
|
+
source: string;
|
|
241
|
+
method?: string;
|
|
242
|
+
payload: unknown;
|
|
243
|
+
receivedAt?: number;
|
|
244
|
+
};
|
|
245
|
+
export type RuntimeQuestion = {
|
|
246
|
+
text: string;
|
|
247
|
+
options?: string[];
|
|
248
|
+
optionDescriptions?: Record<string, string>;
|
|
249
|
+
header?: string;
|
|
250
|
+
multiple?: boolean;
|
|
251
|
+
custom?: boolean;
|
|
252
|
+
};
|
|
253
|
+
export type AgentRuntimeEvent = ({
|
|
254
|
+
harness?: string;
|
|
255
|
+
threadId?: string;
|
|
256
|
+
raw?: RawHarnessEvent;
|
|
257
|
+
diagnostics?: Array<{
|
|
258
|
+
code: string;
|
|
259
|
+
message: string;
|
|
260
|
+
severity: "debug" | "info" | "warn" | "error";
|
|
261
|
+
details?: Record<string, unknown>;
|
|
262
|
+
}>;
|
|
263
|
+
}) & ({
|
|
264
|
+
type: "text-delta";
|
|
265
|
+
delta: string;
|
|
266
|
+
} | {
|
|
267
|
+
type: "thinking-delta";
|
|
268
|
+
delta: string;
|
|
269
|
+
} | {
|
|
270
|
+
type: "user-message-delta";
|
|
271
|
+
messageId?: string;
|
|
272
|
+
content: Record<string, unknown> & {
|
|
273
|
+
type: string;
|
|
274
|
+
};
|
|
275
|
+
} | {
|
|
276
|
+
type: "tool-start";
|
|
277
|
+
toolCallId: string;
|
|
278
|
+
toolName: string;
|
|
279
|
+
kind?: string;
|
|
280
|
+
display?: Record<string, unknown>;
|
|
281
|
+
metadata?: Record<string, unknown>;
|
|
282
|
+
} | {
|
|
283
|
+
type: "tool-input";
|
|
284
|
+
toolCallId: string;
|
|
285
|
+
input: unknown;
|
|
286
|
+
display?: Record<string, unknown>;
|
|
287
|
+
metadata?: Record<string, unknown>;
|
|
288
|
+
} | {
|
|
289
|
+
type: "tool-status";
|
|
290
|
+
toolCallId: string;
|
|
291
|
+
status: "pending" | "running" | "completed" | "failed";
|
|
292
|
+
display?: Record<string, unknown>;
|
|
293
|
+
metadata?: Record<string, unknown>;
|
|
294
|
+
} | {
|
|
295
|
+
type: "tool-content";
|
|
296
|
+
toolCallId: string;
|
|
297
|
+
content: Record<string, unknown> & {
|
|
298
|
+
type: string;
|
|
299
|
+
};
|
|
300
|
+
display?: Record<string, unknown>;
|
|
301
|
+
metadata?: Record<string, unknown>;
|
|
302
|
+
} | {
|
|
303
|
+
type: "tool-output";
|
|
304
|
+
toolCallId: string;
|
|
305
|
+
output: unknown;
|
|
306
|
+
display?: Record<string, unknown>;
|
|
307
|
+
metadata?: Record<string, unknown>;
|
|
308
|
+
} | {
|
|
309
|
+
type: "tool-error";
|
|
310
|
+
toolCallId: string;
|
|
311
|
+
error: string;
|
|
312
|
+
display?: Record<string, unknown>;
|
|
313
|
+
metadata?: Record<string, unknown>;
|
|
314
|
+
} | {
|
|
315
|
+
type: "file-diff";
|
|
316
|
+
toolCallId?: string;
|
|
317
|
+
path: string;
|
|
318
|
+
oldText?: string;
|
|
319
|
+
newText: string;
|
|
320
|
+
} | {
|
|
321
|
+
type: "step-start";
|
|
322
|
+
newMessageId: string;
|
|
323
|
+
} | {
|
|
324
|
+
type: "permission-request";
|
|
325
|
+
requestId: string;
|
|
326
|
+
tool: string;
|
|
327
|
+
paths: string[];
|
|
328
|
+
} | {
|
|
329
|
+
type: "question";
|
|
330
|
+
requestId: string;
|
|
331
|
+
questions: RuntimeQuestion[];
|
|
332
|
+
} | {
|
|
333
|
+
type: "question-answered";
|
|
334
|
+
requestId: string;
|
|
335
|
+
answers: Record<string, string | string[]>;
|
|
336
|
+
} | {
|
|
337
|
+
type: "proposed-plan-delta";
|
|
338
|
+
delta: string;
|
|
339
|
+
} | {
|
|
340
|
+
type: "proposed-plan-complete";
|
|
341
|
+
planMarkdown: string;
|
|
342
|
+
} | {
|
|
343
|
+
type: "todo-update";
|
|
344
|
+
todos: Array<{
|
|
345
|
+
id: string;
|
|
346
|
+
description: string;
|
|
347
|
+
status: string;
|
|
348
|
+
priority?: string;
|
|
349
|
+
}>;
|
|
350
|
+
} | {
|
|
351
|
+
type: "session-status";
|
|
352
|
+
status: "busy" | "idle" | "error" | "recovering";
|
|
353
|
+
} | {
|
|
354
|
+
type: "session-compaction";
|
|
355
|
+
phase: "started" | "completed";
|
|
356
|
+
reason?: string;
|
|
357
|
+
summary?: string;
|
|
358
|
+
metadata?: Record<string, unknown>;
|
|
359
|
+
} | {
|
|
360
|
+
type: "harness-notice";
|
|
361
|
+
code: string;
|
|
362
|
+
message: string;
|
|
363
|
+
severity?: "debug" | "info" | "warn" | "error";
|
|
364
|
+
details?: unknown;
|
|
365
|
+
} | {
|
|
366
|
+
type: "auth-status";
|
|
367
|
+
status: "authenticated" | "unauthenticated" | "unknown";
|
|
368
|
+
authMode?: string | null;
|
|
369
|
+
planType?: string | null;
|
|
370
|
+
metadata?: Record<string, unknown>;
|
|
371
|
+
} | {
|
|
372
|
+
type: "rate-limit";
|
|
373
|
+
status: "ok" | "limited";
|
|
374
|
+
usedPercent?: number;
|
|
375
|
+
resetsAt?: number | null;
|
|
376
|
+
windowDurationMins?: number | null;
|
|
377
|
+
limitId?: string | null;
|
|
378
|
+
limitName?: string | null;
|
|
379
|
+
reason?: string | null;
|
|
380
|
+
metadata?: Record<string, unknown>;
|
|
381
|
+
} | {
|
|
382
|
+
type: "mcp-server-status";
|
|
383
|
+
serverName: string;
|
|
384
|
+
status: "starting" | "ready" | "failed" | "cancelled";
|
|
385
|
+
error?: string | null;
|
|
386
|
+
} | {
|
|
387
|
+
type: "subagent-updated";
|
|
388
|
+
subagentKey: string;
|
|
389
|
+
revision: number;
|
|
390
|
+
[key: string]: unknown;
|
|
391
|
+
} | {
|
|
392
|
+
type: "finish";
|
|
393
|
+
sessionId: string;
|
|
394
|
+
} | {
|
|
395
|
+
type: "error";
|
|
396
|
+
error: string;
|
|
397
|
+
} | {
|
|
398
|
+
type: "image-delta" | "audio-delta" | "thinking-audio-delta";
|
|
399
|
+
mimeType: string;
|
|
400
|
+
data: string;
|
|
401
|
+
} | {
|
|
402
|
+
type: "resource-link-delta" | "thinking-resource-link-delta";
|
|
403
|
+
uri: string;
|
|
404
|
+
name: string;
|
|
405
|
+
mimeType?: string;
|
|
406
|
+
title?: string;
|
|
407
|
+
} | {
|
|
408
|
+
type: "resource-delta";
|
|
409
|
+
resource: unknown;
|
|
410
|
+
channel: "assistant" | "thinking";
|
|
411
|
+
} | {
|
|
412
|
+
type: "tool-location";
|
|
413
|
+
toolCallId: string;
|
|
414
|
+
locations: Array<{
|
|
415
|
+
path: string;
|
|
416
|
+
line?: number;
|
|
417
|
+
}>;
|
|
418
|
+
} | {
|
|
419
|
+
type: "tool-terminal";
|
|
420
|
+
toolCallId: string;
|
|
421
|
+
terminalId: string;
|
|
422
|
+
} | {
|
|
423
|
+
type: "available-commands-update";
|
|
424
|
+
commands: Array<{
|
|
425
|
+
name: string;
|
|
426
|
+
description?: string;
|
|
427
|
+
input?: unknown;
|
|
428
|
+
}>;
|
|
429
|
+
} | {
|
|
430
|
+
type: "session-agent";
|
|
431
|
+
agentId: string;
|
|
432
|
+
} | {
|
|
433
|
+
type: "config-update";
|
|
434
|
+
options: AgentConfigOption[];
|
|
435
|
+
} | {
|
|
436
|
+
type: "session-info";
|
|
437
|
+
title?: string | null;
|
|
438
|
+
updatedAt?: string | null;
|
|
439
|
+
parentID?: string;
|
|
440
|
+
} | {
|
|
441
|
+
type: "session-title";
|
|
442
|
+
title: string;
|
|
443
|
+
} | {
|
|
444
|
+
type: "usage";
|
|
445
|
+
contextSize: number;
|
|
446
|
+
contextUsed: number;
|
|
447
|
+
observation?: RuntimeUsageObservation;
|
|
448
|
+
cost?: {
|
|
449
|
+
amount: number;
|
|
450
|
+
currency: string;
|
|
451
|
+
};
|
|
452
|
+
} | {
|
|
453
|
+
type: "diagnostic";
|
|
454
|
+
diagnostic: {
|
|
455
|
+
code: string;
|
|
456
|
+
message: string;
|
|
457
|
+
severity: "debug" | "info" | "warn" | "error";
|
|
458
|
+
details?: unknown;
|
|
459
|
+
};
|
|
460
|
+
});
|
package/dist/files.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export type AgentFileContent = {
|
|
2
|
+
type: "text" | "binary";
|
|
3
|
+
content: string;
|
|
4
|
+
diff?: string;
|
|
5
|
+
patch?: {
|
|
6
|
+
oldFileName: string;
|
|
7
|
+
newFileName: string;
|
|
8
|
+
oldHeader?: string;
|
|
9
|
+
newHeader?: string;
|
|
10
|
+
hunks: Array<{
|
|
11
|
+
oldStart: number;
|
|
12
|
+
oldLines: number;
|
|
13
|
+
newStart: number;
|
|
14
|
+
newLines: number;
|
|
15
|
+
lines: string[];
|
|
16
|
+
}>;
|
|
17
|
+
index?: string;
|
|
18
|
+
};
|
|
19
|
+
encoding?: "base64";
|
|
20
|
+
mimeType?: string;
|
|
21
|
+
};
|
|
22
|
+
export type AgentVcsFileDiff = {
|
|
23
|
+
file: string;
|
|
24
|
+
patch?: string;
|
|
25
|
+
additions: number;
|
|
26
|
+
deletions: number;
|
|
27
|
+
status?: "added" | "deleted" | "modified";
|
|
28
|
+
};
|
|
29
|
+
/** A fully identified diff ready for review presentation. */
|
|
30
|
+
export type AgentReviewFileDiff = {
|
|
31
|
+
file: string;
|
|
32
|
+
patch?: string;
|
|
33
|
+
before?: string;
|
|
34
|
+
after?: string;
|
|
35
|
+
additions: number;
|
|
36
|
+
deletions: number;
|
|
37
|
+
status?: "added" | "deleted" | "modified";
|
|
38
|
+
};
|
|
39
|
+
export type AgentPresentationModel = {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
};
|
|
43
|
+
/** Provider fields consumed by transcript presentation. */
|
|
44
|
+
export type AgentPresentationProvider = {
|
|
45
|
+
id: string;
|
|
46
|
+
name: string;
|
|
47
|
+
models: Record<string, AgentPresentationModel>;
|
|
48
|
+
};
|
|
49
|
+
/** Structural guard: is `value` a well-formed review diff record? */
|
|
50
|
+
export declare function isAgentReviewFileDiff(value: unknown): value is AgentReviewFileDiff;
|
|
51
|
+
/** Coerce an unknown payload (array, single diff, or keyed object) into a diff list. */
|
|
52
|
+
export declare function agentReviewFileDiffList(value: unknown): AgentReviewFileDiff[];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The closed set of effort words a harness may be asked for, mirroring the
|
|
3
|
+
* Claude Agent SDK's `EffortLevel` union. This is the VOCABULARY; which of
|
|
4
|
+
* these words a given model accepts is `HarnessEffortLevels` below.
|
|
5
|
+
*/
|
|
6
|
+
export declare const HARNESS_EFFORT_LEVELS: readonly ["low", "medium", "high", "xhigh", "max"];
|
|
7
|
+
export type HarnessEffortLevel = (typeof HARNESS_EFFORT_LEVELS)[number];
|
|
8
|
+
/** Sound because `HARNESS_EFFORT_LEVELS` is the tuple `HarnessEffortLevel` is derived from. */
|
|
9
|
+
export declare function isHarnessEffortLevel(value: string): value is HarnessEffortLevel;
|
|
10
|
+
/** One model's accepted effort levels, exactly as the harness reported them. */
|
|
11
|
+
export type HarnessModelEffort = {
|
|
12
|
+
modelID: string;
|
|
13
|
+
levels: readonly string[];
|
|
14
|
+
/** The level the harness runs when a turn names none. */
|
|
15
|
+
default?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Which effort words a harness accepts, per model, and how sure it is.
|
|
19
|
+
*
|
|
20
|
+
* `unsupported` — the harness has no effort control, so every level is refused.
|
|
21
|
+
* `unresolved` — it has one, but no model catalog has answered yet, so neither
|
|
22
|
+
* accepting nor refusing a level is grounded in what the harness said.
|
|
23
|
+
* `resolved` — `models` is complete: a model absent from it takes no effort.
|
|
24
|
+
*/
|
|
25
|
+
export type HarnessEffortLevels = {
|
|
26
|
+
status: "unsupported" | "unresolved" | "resolved";
|
|
27
|
+
models: readonly HarnessModelEffort[];
|
|
28
|
+
};
|
|
29
|
+
export declare const NO_HARNESS_EFFORT: HarnessEffortLevels;
|
|
30
|
+
export type HarnessEffortVerdict = "accepted" | "refused" | "unknown";
|
|
31
|
+
/**
|
|
32
|
+
* Whether a harness accepts an effort for a model, read off the same catalog
|
|
33
|
+
* the capability response carries so no caller keeps a second list.
|
|
34
|
+
*
|
|
35
|
+
* `unknown` is distinct from `refused`: an unresolved catalog is an unanswered
|
|
36
|
+
* question, and refusing a turn on it would ground the refusal in nothing.
|
|
37
|
+
*/
|
|
38
|
+
export declare function harnessEffortVerdict(catalog: HarnessEffortLevels | undefined, modelID: string | undefined, effort: string | undefined): HarnessEffortVerdict;
|
|
39
|
+
/** The catalog a capability response carries, or `undefined` when it carries none. */
|
|
40
|
+
export declare function parseHarnessEffortLevels(value: unknown): HarnessEffortLevels | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* The sentence a caller refuses a configuration's effort with, or `undefined`
|
|
43
|
+
* when the effort must be admitted.
|
|
44
|
+
*
|
|
45
|
+
* Only a `resolved` catalog refuses. `unresolved` has not answered yet, and
|
|
46
|
+
* `unsupported` is what every harness whose model rows carry no per-model
|
|
47
|
+
* levels reports even when it honours a level anyway — Pi runs the
|
|
48
|
+
* `set_thinking_level` it never publishes a catalog for — so refusing on
|
|
49
|
+
* either would refuse on silence rather than on what the harness said.
|
|
50
|
+
*/
|
|
51
|
+
export declare function harnessEffortRefusal(input: {
|
|
52
|
+
harness: string;
|
|
53
|
+
catalog: HarnessEffortLevels | undefined;
|
|
54
|
+
modelID: string | undefined;
|
|
55
|
+
effort: string | undefined;
|
|
56
|
+
}): string | undefined;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The harnesses Claxedo runs turns on, and the provider ids each resolves its
|
|
3
|
+
* auth through.
|
|
4
|
+
*
|
|
5
|
+
* Data only, and in the contract package rather than beside any one consumer:
|
|
6
|
+
* the server decides which binding a sign-in is stored against, the machine
|
|
7
|
+
* scan decides which bindings a CLI login drives, and the app draws one row per
|
|
8
|
+
* harness. Held separately those lists drifted — `cursor-sdk` was in one and
|
|
9
|
+
* not another — and a provider id missing from a list loses its login without
|
|
10
|
+
* anything failing.
|
|
11
|
+
*/
|
|
12
|
+
export declare const HARNESS_IDS: readonly ["claude", "codex", "cursor"];
|
|
13
|
+
export type HarnessId = (typeof HARNESS_IDS)[number];
|
|
14
|
+
type HarnessRecord = {
|
|
15
|
+
/** The product's own name, as every surface writes it. */
|
|
16
|
+
label: string;
|
|
17
|
+
vendor: string;
|
|
18
|
+
/**
|
|
19
|
+
* Every registry provider id whose stored row this harness can run on:
|
|
20
|
+
* connect provider first, then the other harness binding, then the vendor
|
|
21
|
+
* fallback.
|
|
22
|
+
*
|
|
23
|
+
* The order is load-bearing at both ends. A connect card stores under
|
|
24
|
+
* `connectProvider`, and `harnessProjection` takes the first of these ids a
|
|
25
|
+
* projection map holds — so a Claude turn binds through `claude-sdk` when one
|
|
26
|
+
* is selected and through a plain `anthropic` key when it is not, and a list
|
|
27
|
+
* that stopped at the aliases would drop that key.
|
|
28
|
+
*/
|
|
29
|
+
providerIds: readonly string[];
|
|
30
|
+
/** The provider id a sign-in for this harness is stored against. */
|
|
31
|
+
connectProvider: string;
|
|
32
|
+
/**
|
|
33
|
+
* The one id in `providerIds` that names the vendor rather than this
|
|
34
|
+
* harness's own binding. `providerIds` minus this is the set of bindings the
|
|
35
|
+
* harness resolves auth through, which is what a reader comparing a login's
|
|
36
|
+
* reach against the harness's own bindings has to compare with.
|
|
37
|
+
*/
|
|
38
|
+
vendorProvider: string;
|
|
39
|
+
/**
|
|
40
|
+
* Those of `providerIds` the CLI's own login drives. `cursor-agent login`
|
|
41
|
+
* signs the CLI in and Cursor ACP runs on it; the Cursor SDK takes its key as
|
|
42
|
+
* an `Agent.create` argument and refuses a turn however signed in the CLI is.
|
|
43
|
+
*/
|
|
44
|
+
machineLoginServes: readonly string[];
|
|
45
|
+
};
|
|
46
|
+
export declare const HARNESS_TABLE: Readonly<Record<HarnessId, HarnessRecord>>;
|
|
47
|
+
export declare function isHarnessId(value: string): value is HarnessId;
|
|
48
|
+
/**
|
|
49
|
+
* The harness a provider id belongs to, where one does. Every other provider id
|
|
50
|
+
* names a vendor an engine can run rather than a harness's own login, and has
|
|
51
|
+
* no harness to be listed under.
|
|
52
|
+
*/
|
|
53
|
+
export declare function harnessForProviderId(id: string): HarnessId | undefined;
|
|
54
|
+
/** The bindings a harness resolves its own auth through: everything but the vendor id. */
|
|
55
|
+
export declare function harnessBindingIds(harness: HarnessId): string[];
|
|
56
|
+
export {};
|