@bluecopa/harness 2.0.1-snapshot.2 → 2.0.1-snapshot.4
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/arc/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { A as AnyTool, T as ToolProvider, a as ToolResult, M as ModelFactory, b as ToolResultArtifact } from '../shared-types-
|
|
2
|
-
export {
|
|
1
|
+
import { A as AnyTool, T as ToolProvider, a as ToolResult, M as ModelFactory, b as ToolResultArtifact, c as ToolProviderCapabilities, B as BashOptions, R as ReadOptions, G as GlobOptions, d as GrepOptions, e as BatchOp, f as BatchResult } from '../shared-types-D89hqST8.js';
|
|
2
|
+
export { g as ActionType, h as TextEditorRequest, i as ThreadStatus, W as WebFetchOptions } from '../shared-types-D89hqST8.js';
|
|
3
3
|
import { HarnessTelemetry } from '../observability/otel.js';
|
|
4
|
+
export { MetricRecord, SpanHandle, SpanRecord } from '../observability/otel.js';
|
|
4
5
|
import 'ai';
|
|
5
6
|
|
|
6
7
|
/** Long-running job orchestration primitives. Generic; no coding-agent assumptions. */
|
|
@@ -1005,6 +1006,64 @@ declare const ABSOLUTE_MAX_WORKER_STEPS = 60;
|
|
|
1005
1006
|
/** Recommended extension size when workers need to keep their current context. */
|
|
1006
1007
|
declare const REQUEST_MORE_STEPS_INCREMENT = 15;
|
|
1007
1008
|
|
|
1009
|
+
interface Episode {
|
|
1010
|
+
id: string;
|
|
1011
|
+
taskId: string;
|
|
1012
|
+
sessionId: string;
|
|
1013
|
+
tupleId?: string;
|
|
1014
|
+
summary: string;
|
|
1015
|
+
createdAt: number;
|
|
1016
|
+
completedAt?: number;
|
|
1017
|
+
/** Arbitrary metadata for routing/display */
|
|
1018
|
+
metadata?: Record<string, unknown>;
|
|
1019
|
+
}
|
|
1020
|
+
interface EpisodeTrace {
|
|
1021
|
+
episodeId: string;
|
|
1022
|
+
messages: Array<{
|
|
1023
|
+
role: string;
|
|
1024
|
+
content: string;
|
|
1025
|
+
[key: string]: unknown;
|
|
1026
|
+
}>;
|
|
1027
|
+
createdAt: number;
|
|
1028
|
+
}
|
|
1029
|
+
interface EpisodeStore {
|
|
1030
|
+
addEpisode(episode: Episode): Promise<void>;
|
|
1031
|
+
addTrace(trace: EpisodeTrace): Promise<void>;
|
|
1032
|
+
getEpisode(id: string): Promise<Episode | null>;
|
|
1033
|
+
getTrace(episodeId: string): Promise<EpisodeTrace | null>;
|
|
1034
|
+
getEpisodesByTask(taskId: string): Promise<Episode[]>;
|
|
1035
|
+
getEpisodesBySession(sessionId: string): Promise<Episode[]>;
|
|
1036
|
+
getRecentEpisodes(limit: number): Promise<Episode[]>;
|
|
1037
|
+
evictTraces(olderThan: number): Promise<number>;
|
|
1038
|
+
}
|
|
1039
|
+
interface SessionMemo {
|
|
1040
|
+
id: string;
|
|
1041
|
+
sessionId: string;
|
|
1042
|
+
content: string;
|
|
1043
|
+
sourceEpisodeIds?: string[];
|
|
1044
|
+
createdAt: number;
|
|
1045
|
+
}
|
|
1046
|
+
interface SessionMemoStore {
|
|
1047
|
+
addMemo(memo: SessionMemo): Promise<void>;
|
|
1048
|
+
getMemo(id: string): Promise<SessionMemo | null>;
|
|
1049
|
+
getMemosBySession(sessionId: string): Promise<SessionMemo[]>;
|
|
1050
|
+
getRecentMemos(limit: number): Promise<SessionMemo[]>;
|
|
1051
|
+
}
|
|
1052
|
+
interface LongTermMemory {
|
|
1053
|
+
id: string;
|
|
1054
|
+
content: string;
|
|
1055
|
+
category: string;
|
|
1056
|
+
createdAt: number;
|
|
1057
|
+
updatedAt: number;
|
|
1058
|
+
}
|
|
1059
|
+
interface LongTermStore {
|
|
1060
|
+
addMemory(memory: LongTermMemory): Promise<void>;
|
|
1061
|
+
getMemory(id: string): Promise<LongTermMemory | null>;
|
|
1062
|
+
getAllMemories(): Promise<LongTermMemory[]>;
|
|
1063
|
+
getMemoriesByCategory(category: string): Promise<LongTermMemory[]>;
|
|
1064
|
+
updateMemory(id: string, updates: Partial<Pick<LongTermMemory, 'content' | 'category' | 'updatedAt'>>): Promise<void>;
|
|
1065
|
+
deleteMemory(id: string): Promise<void>;
|
|
1066
|
+
}
|
|
1008
1067
|
/** In-memory transcript store for testing */
|
|
1009
1068
|
declare class MemoryTranscriptStore implements TranscriptStore {
|
|
1010
1069
|
private transcripts;
|
|
@@ -1047,6 +1106,37 @@ declare class MemorySessionStore implements SessionStore {
|
|
|
1047
1106
|
saveMeta(id: string, meta: SessionMeta): Promise<void>;
|
|
1048
1107
|
list(): Promise<SessionMeta[]>;
|
|
1049
1108
|
}
|
|
1109
|
+
/** In-memory episode store */
|
|
1110
|
+
declare class InMemoryEpisodeStore implements EpisodeStore {
|
|
1111
|
+
private episodes;
|
|
1112
|
+
private traces;
|
|
1113
|
+
addEpisode(episode: Episode): Promise<void>;
|
|
1114
|
+
addTrace(trace: EpisodeTrace): Promise<void>;
|
|
1115
|
+
getEpisode(id: string): Promise<Episode | null>;
|
|
1116
|
+
getTrace(episodeId: string): Promise<EpisodeTrace | null>;
|
|
1117
|
+
getEpisodesByTask(taskId: string): Promise<Episode[]>;
|
|
1118
|
+
getEpisodesBySession(sessionId: string): Promise<Episode[]>;
|
|
1119
|
+
getRecentEpisodes(limit: number): Promise<Episode[]>;
|
|
1120
|
+
evictTraces(_olderThan: number): Promise<number>;
|
|
1121
|
+
}
|
|
1122
|
+
/** In-memory session memo store */
|
|
1123
|
+
declare class InMemorySessionMemoStore implements SessionMemoStore {
|
|
1124
|
+
private memos;
|
|
1125
|
+
addMemo(memo: SessionMemo): Promise<void>;
|
|
1126
|
+
getMemo(id: string): Promise<SessionMemo | null>;
|
|
1127
|
+
getMemosBySession(sessionId: string): Promise<SessionMemo[]>;
|
|
1128
|
+
getRecentMemos(limit: number): Promise<SessionMemo[]>;
|
|
1129
|
+
}
|
|
1130
|
+
/** In-memory long-term store */
|
|
1131
|
+
declare class InMemoryLongTermStore implements LongTermStore {
|
|
1132
|
+
private memories;
|
|
1133
|
+
addMemory(memory: LongTermMemory): Promise<void>;
|
|
1134
|
+
getMemory(id: string): Promise<LongTermMemory | null>;
|
|
1135
|
+
getAllMemories(): Promise<LongTermMemory[]>;
|
|
1136
|
+
getMemoriesByCategory(category: string): Promise<LongTermMemory[]>;
|
|
1137
|
+
updateMemory(id: string, updates: Partial<Pick<LongTermMemory, 'content' | 'category' | 'updatedAt'>>): Promise<void>;
|
|
1138
|
+
deleteMemory(id: string): Promise<void>;
|
|
1139
|
+
}
|
|
1050
1140
|
|
|
1051
1141
|
/**
|
|
1052
1142
|
* File-based transcript store.
|
|
@@ -1079,6 +1169,169 @@ declare class FsArtifactStore implements ArtifactStore {
|
|
|
1079
1169
|
private save;
|
|
1080
1170
|
}
|
|
1081
1171
|
|
|
1172
|
+
/**
|
|
1173
|
+
* CompositeToolProvider delegates to the first provider with matching capabilities.
|
|
1174
|
+
*
|
|
1175
|
+
* Useful when multiple tool providers exist (e.g., a sandbox executor + a local
|
|
1176
|
+
* file-system executor) and you want to route tool calls based on capability.
|
|
1177
|
+
*/
|
|
1178
|
+
declare class CompositeToolProvider implements ToolProvider {
|
|
1179
|
+
private providers;
|
|
1180
|
+
constructor(providers: ToolProvider[]);
|
|
1181
|
+
capabilities(): ToolProviderCapabilities;
|
|
1182
|
+
/** Pick the first provider that supports the requested capability. */
|
|
1183
|
+
private pick;
|
|
1184
|
+
bash(command: string, options?: BashOptions): Promise<ToolResult>;
|
|
1185
|
+
readFile(path: string, options?: ReadOptions): Promise<ToolResult>;
|
|
1186
|
+
writeFile(path: string, content: string): Promise<ToolResult>;
|
|
1187
|
+
editFile(path: string, oldText: string, newText: string): Promise<ToolResult>;
|
|
1188
|
+
glob(pattern: string, options?: GlobOptions): Promise<ToolResult>;
|
|
1189
|
+
grep(pattern: string, path?: string, options?: GrepOptions): Promise<ToolResult>;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
/**
|
|
1193
|
+
* Executor interface for sandboxed code execution (e.g., E2B sandbox).
|
|
1194
|
+
*
|
|
1195
|
+
* Implementations wrap sandbox APIs into a uniform shape that
|
|
1196
|
+
* E2BToolProvider can delegate to.
|
|
1197
|
+
*/
|
|
1198
|
+
interface E2BExecutor {
|
|
1199
|
+
bash(command: string, options?: BashOptions): Promise<ToolResult>;
|
|
1200
|
+
readFile(path: string, options?: ReadOptions): Promise<ToolResult>;
|
|
1201
|
+
writeFile(path: string, content: string): Promise<ToolResult>;
|
|
1202
|
+
editFile(path: string, oldText: string, newText: string): Promise<ToolResult>;
|
|
1203
|
+
glob(pattern: string, options?: GlobOptions): Promise<ToolResult>;
|
|
1204
|
+
grep(pattern: string, path?: string, options?: GrepOptions): Promise<ToolResult>;
|
|
1205
|
+
batch?(ops: BatchOp[]): Promise<BatchResult[]>;
|
|
1206
|
+
destroy(): Promise<void>;
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* E2BToolProvider wraps an E2BExecutor into a ToolProvider interface
|
|
1210
|
+
* suitable for use with the harness agent loop.
|
|
1211
|
+
*/
|
|
1212
|
+
declare class E2BToolProvider {
|
|
1213
|
+
private executor;
|
|
1214
|
+
constructor(executor: E2BExecutor);
|
|
1215
|
+
capabilities(): ToolProviderCapabilities;
|
|
1216
|
+
bash(command: string, options?: BashOptions): Promise<ToolResult>;
|
|
1217
|
+
readFile(path: string, options?: ReadOptions): Promise<ToolResult>;
|
|
1218
|
+
writeFile(path: string, content: string): Promise<ToolResult>;
|
|
1219
|
+
editFile(path: string, oldText: string, newText: string): Promise<ToolResult>;
|
|
1220
|
+
glob(pattern: string, options?: GlobOptions): Promise<ToolResult>;
|
|
1221
|
+
grep(pattern: string, path?: string, options?: GrepOptions): Promise<ToolResult>;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
/** Options for constructing a ControlPlaneE2BExecutor. */
|
|
1225
|
+
interface ControlPlaneE2BExecutorOptions {
|
|
1226
|
+
baseUrl: string;
|
|
1227
|
+
apiKey: string;
|
|
1228
|
+
templateId?: string;
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* Base class for control-plane E2B sandbox executors.
|
|
1232
|
+
*
|
|
1233
|
+
* Provides the configuration surface and stubs that concrete implementations
|
|
1234
|
+
* (e.g., Samyx control-plane API) extend. Subclasses must override the
|
|
1235
|
+
* tool-execution methods with actual sandbox API calls.
|
|
1236
|
+
*/
|
|
1237
|
+
declare class ControlPlaneE2BExecutor implements E2BExecutor {
|
|
1238
|
+
protected baseUrl: string;
|
|
1239
|
+
protected apiKey: string;
|
|
1240
|
+
protected templateId: string;
|
|
1241
|
+
constructor(options: ControlPlaneE2BExecutorOptions);
|
|
1242
|
+
bash(_command: string, _options?: BashOptions): Promise<ToolResult>;
|
|
1243
|
+
readFile(_path: string, _options?: ReadOptions): Promise<ToolResult>;
|
|
1244
|
+
writeFile(_path: string, _content: string): Promise<ToolResult>;
|
|
1245
|
+
editFile(_path: string, _oldText: string, _newText: string): Promise<ToolResult>;
|
|
1246
|
+
glob(_pattern: string, _options?: GlobOptions): Promise<ToolResult>;
|
|
1247
|
+
grep(_pattern: string, _path?: string, _options?: GrepOptions): Promise<ToolResult>;
|
|
1248
|
+
writeFileBytes(_path: string, _data: Uint8Array): Promise<void>;
|
|
1249
|
+
readFileBytes(_path: string): Promise<Uint8Array>;
|
|
1250
|
+
get activeSandboxId(): string | undefined;
|
|
1251
|
+
destroy(): Promise<void>;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* Permission request sent to the resolver for each tool call.
|
|
1256
|
+
*
|
|
1257
|
+
* The `toolName` key is always present. Additional tool arguments
|
|
1258
|
+
* are forwarded as-is for context-sensitive permission decisions.
|
|
1259
|
+
*/
|
|
1260
|
+
interface PermissionRequest {
|
|
1261
|
+
toolName: string;
|
|
1262
|
+
[toolArg: string]: unknown;
|
|
1263
|
+
}
|
|
1264
|
+
/** Resolver function that decides whether a tool call is permitted. */
|
|
1265
|
+
type PermissionResolver = (request: PermissionRequest) => Promise<boolean>;
|
|
1266
|
+
/** Permission mode for the manager. */
|
|
1267
|
+
type PermissionMode = "deny_all" | "allow_all" | "ask";
|
|
1268
|
+
/**
|
|
1269
|
+
* PermissionManager controls whether tool calls are allowed.
|
|
1270
|
+
*
|
|
1271
|
+
* Three modes:
|
|
1272
|
+
* - `deny_all`: reject everything
|
|
1273
|
+
* - `allow_all`: accept everything
|
|
1274
|
+
* - `ask`: delegate to a resolver function
|
|
1275
|
+
*/
|
|
1276
|
+
declare class PermissionManager {
|
|
1277
|
+
private mode;
|
|
1278
|
+
private resolver;
|
|
1279
|
+
constructor(mode: PermissionMode, resolver?: PermissionResolver);
|
|
1280
|
+
/** Check whether a tool call is permitted. */
|
|
1281
|
+
canExecute(request: PermissionRequest): Promise<boolean>;
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
interface ExecutionContext {
|
|
1285
|
+
attempt: number;
|
|
1286
|
+
totalAttempts: number;
|
|
1287
|
+
startTime: number;
|
|
1288
|
+
signal: AbortSignal;
|
|
1289
|
+
}
|
|
1290
|
+
interface PipelineOptions {
|
|
1291
|
+
timeout?: number;
|
|
1292
|
+
retryCount?: number;
|
|
1293
|
+
}
|
|
1294
|
+
declare class ResiliencePipeline {
|
|
1295
|
+
private options;
|
|
1296
|
+
constructor(options?: PipelineOptions);
|
|
1297
|
+
/** Set a timeout in milliseconds for execution. */
|
|
1298
|
+
timeout(ms: number): ResiliencePipeline;
|
|
1299
|
+
/** Set retry count. */
|
|
1300
|
+
retries(count: number): ResiliencePipeline;
|
|
1301
|
+
/** Build the executable pipeline. */
|
|
1302
|
+
build(): {
|
|
1303
|
+
execute: <T>(fn: () => Promise<T>, ctx: ExecutionContext) => Promise<T>;
|
|
1304
|
+
};
|
|
1305
|
+
}
|
|
1306
|
+
/** Create a new resilience pipeline builder. */
|
|
1307
|
+
declare function resilience(): ResiliencePipeline;
|
|
1308
|
+
|
|
1309
|
+
/**
|
|
1310
|
+
* Profile types for ArcLoop thread configuration.
|
|
1311
|
+
*
|
|
1312
|
+
* Profiles control which tools a worker thread can use and which
|
|
1313
|
+
* model tier it runs at.
|
|
1314
|
+
*/
|
|
1315
|
+
/** Declaration of a worker profile — matched by name in process context. */
|
|
1316
|
+
interface ProfileDeclaration {
|
|
1317
|
+
name: string;
|
|
1318
|
+
/** Descriptive signature for the orchestrator (e.g., "question:string -> evidence:string[]") */
|
|
1319
|
+
signature: string;
|
|
1320
|
+
/** Tool names available to workers with this profile */
|
|
1321
|
+
tools: string[];
|
|
1322
|
+
/** Worker model tier */
|
|
1323
|
+
model: "fast" | "medium" | "strong";
|
|
1324
|
+
/** Worker step budget */
|
|
1325
|
+
maxSteps: number;
|
|
1326
|
+
/** Background/injection context for the worker system prompt */
|
|
1327
|
+
background: string;
|
|
1328
|
+
}
|
|
1329
|
+
/** A profile bound to a process, with its declaration. */
|
|
1330
|
+
interface ProcessProfile {
|
|
1331
|
+
name: string;
|
|
1332
|
+
declaration: ProfileDeclaration;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1082
1335
|
/**
|
|
1083
1336
|
* In-memory reference implementation of JobRegistry.
|
|
1084
1337
|
*
|
|
@@ -1104,4 +1357,4 @@ declare class MemoryJobRegistry implements JobRegistry {
|
|
|
1104
1357
|
private emit;
|
|
1105
1358
|
}
|
|
1106
1359
|
|
|
1107
|
-
export { ABSOLUTE_MAX_WORKER_STEPS, AnyTool, type ArcConfig, type ArcEvent, ArcLoop, type ArcRunResult, type ArcTraceEvent, type Artifact, type ArtifactStore, DEFAULT_MAX_STEPS_PER_WORKER, DEFAULT_WORKER_STEP_BUDGETS, type DispatchRecord, type DispatchTier, type ExpectedArtifact, type ExpectedOutputContract, FsArtifactStore, FsTranscriptStore, type JobEvent, type JobKind, type JobRegistry, type JobSpec, type JobStartOptions, type JobState, type JobStatus, type JobTransport, MemoryArtifactStore, MemoryJobRegistry, MemoryMessageStore, MemoryScratchPad, MemorySessionStore, MemorySummaryDAG, MemoryTranscriptStore, MemoryVectorIndex, type MessageStore, ModelFactory, type OodaSnapshot, type OrchestratorContext, type PushResult, REQUEST_MORE_STEPS_INCREMENT, type ReadEpisodeArgs, type ReadEpisodeDetail, type RunWorkerConfig, type ScratchPad, type SessionMeta, type SessionSnapshot, type SessionStore, type StoredAttachment, type StoredMessage, type SummaryDAG, type SummaryNode, type Tool, type ToolExecutionMode, ToolProvider, ToolResult, ToolResultArtifact, type TraceToolCall, type Transcript, type TranscriptStore, type Tuple, type VectorIndex, type WorkerProgressEvent, type WorkerResult, cloneForTrace, formatDispatchForPrompt };
|
|
1360
|
+
export { ABSOLUTE_MAX_WORKER_STEPS, AnyTool, type ArcConfig, type ArcEvent, ArcLoop, type ArcRunResult, type ArcTraceEvent, type Artifact, type ArtifactStore, BashOptions, BatchOp, BatchResult, CompositeToolProvider, ControlPlaneE2BExecutor, type ControlPlaneE2BExecutorOptions, DEFAULT_MAX_STEPS_PER_WORKER, DEFAULT_WORKER_STEP_BUDGETS, type DispatchRecord, type DispatchTier, type E2BExecutor, E2BToolProvider, type Episode, type EpisodeStore, type EpisodeTrace, type ExecutionContext, type ExpectedArtifact, type ExpectedOutputContract, FsArtifactStore, FsTranscriptStore, GlobOptions, GrepOptions, HarnessTelemetry, type HookCallback, type HookContext, type HookDecision, type HookEventName, HookRunner, InMemoryEpisodeStore, InMemoryLongTermStore, InMemorySessionMemoStore, type JobEvent, type JobKind, type JobRegistry, type JobSpec, type JobStartOptions, type JobState, type JobStatus, type JobTransport, type LongTermMemory, type LongTermStore, MemoryArtifactStore, MemoryJobRegistry, MemoryMessageStore, MemoryScratchPad, MemorySessionStore, MemorySummaryDAG, MemoryTranscriptStore, MemoryVectorIndex, type MessageStore, ModelFactory, type OodaSnapshot, type OrchestratorContext, PermissionManager, type PermissionMode, type PermissionRequest, type PermissionResolver, type ProcessProfile, type ProfileDeclaration, type PushResult, REQUEST_MORE_STEPS_INCREMENT, type ReadEpisodeArgs, type ReadEpisodeDetail, ReadOptions, type RunWorkerConfig, type ScratchPad, type SessionMemo, type SessionMemoStore, type SessionMeta, type SessionSnapshot, type SessionStore, type StoredAttachment, type StoredMessage, type SummaryDAG, type SummaryNode, type Tool, type ToolExecutionMode, ToolProvider, ToolProviderCapabilities, ToolResult, ToolResultArtifact, type TraceToolCall, type Transcript, type TranscriptStore, type Tuple, type VectorIndex, type WorkerProgressEvent, type WorkerResult, cloneForTrace, formatDispatchForPrompt, resilience };
|