@bluecopa/harness 0.1.0-snapshot.110 → 0.1.0-snapshot.111
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/app-adapter.d.ts +1 -1
- package/dist/arc/create-arc-agent.d.ts +1 -1
- package/dist/arc/create-arc-agent.js +56 -0
- package/dist/arc/create-arc-agent.js.map +1 -1
- package/dist/arc/profile-builder.d.ts +1 -1
- package/dist/loop/vercel-agent-loop.d.ts +1 -1
- package/dist/{types-BoHiz2hZ.d.ts → types-B3ZRNs0w.d.ts} +6 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ArcLoopConfig, b as AgentMessage, A as ArcEvent, c as ArcRunResult, T as TraceEvent } from '../types-
|
|
1
|
+
import { a as ArcLoopConfig, b as AgentMessage, A as ArcEvent, c as ArcRunResult, T as TraceEvent } from '../types-B3ZRNs0w.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import 'ai';
|
|
4
4
|
|
|
@@ -2433,6 +2433,13 @@ function buildRepairPrompt(request, completion) {
|
|
|
2433
2433
|
].join("\n")
|
|
2434
2434
|
};
|
|
2435
2435
|
}
|
|
2436
|
+
function pushTraceMarker(markers, type, detail) {
|
|
2437
|
+
markers.push({
|
|
2438
|
+
type,
|
|
2439
|
+
ts: Date.now(),
|
|
2440
|
+
...detail ? { detail } : {}
|
|
2441
|
+
});
|
|
2442
|
+
}
|
|
2436
2443
|
function createProcess(request, config) {
|
|
2437
2444
|
const id = randomUUID();
|
|
2438
2445
|
const model = resolveModel(request.model, config.modelMap, config.defaultModel);
|
|
@@ -2463,13 +2470,16 @@ function createProcess(request, config) {
|
|
|
2463
2470
|
const seedPromise = buildSeedMessages(request.contextEpisodeIds ?? [], config.episodeStore);
|
|
2464
2471
|
const startTime = Date.now();
|
|
2465
2472
|
void (async () => {
|
|
2473
|
+
const traceMarkers = [];
|
|
2466
2474
|
try {
|
|
2475
|
+
pushTraceMarker(traceMarkers, "process_started");
|
|
2467
2476
|
process2.status = "running";
|
|
2468
2477
|
let seed = [
|
|
2469
2478
|
...config.demoMessages ?? [],
|
|
2470
2479
|
...await seedPromise,
|
|
2471
2480
|
...normalizeSeedContext(config.processSeedContext)
|
|
2472
2481
|
];
|
|
2482
|
+
pushTraceMarker(traceMarkers, "seed_ready", `messages=${seed.length}`);
|
|
2473
2483
|
let systemPrompt = config.processSystemPrompt ?? PROCESS_SYSTEM_PROMPT;
|
|
2474
2484
|
const skillRef = config.skillRefPromise ? await config.skillRefPromise : null;
|
|
2475
2485
|
if (skillRef) {
|
|
@@ -2493,12 +2503,16 @@ ${subGuideBlocks}
|
|
|
2493
2503
|
systemPrompt += "\n\n<skill_instructions>\nIMPORTANT: Follow the skill instructions below precisely. They contain tested, working patterns.\n\n" + skillInstructions + "\n</skill_instructions>";
|
|
2494
2504
|
}
|
|
2495
2505
|
}
|
|
2506
|
+
pushTraceMarker(traceMarkers, "system_prompt_ready");
|
|
2496
2507
|
const { result, completion } = await Promise.race([
|
|
2497
2508
|
(async () => {
|
|
2498
2509
|
let prompt = request.action;
|
|
2499
2510
|
let stepOffset = 0;
|
|
2500
2511
|
let completion2;
|
|
2512
|
+
let firstStepSeen = false;
|
|
2513
|
+
let firstOutputSeen = false;
|
|
2501
2514
|
const runAttempt = async (attemptPrompt, attemptSeed) => {
|
|
2515
|
+
pushTraceMarker(traceMarkers, "attempt_started", `attempt=${traceMarkers.filter((marker) => marker.type === "attempt_started").length + 1}`);
|
|
2502
2516
|
const stream = runner.stream({
|
|
2503
2517
|
model,
|
|
2504
2518
|
prompt: attemptPrompt,
|
|
@@ -2529,6 +2543,7 @@ ${subGuideBlocks}
|
|
|
2529
2543
|
"maxContextTokens"
|
|
2530
2544
|
])
|
|
2531
2545
|
});
|
|
2546
|
+
pushTraceMarker(traceMarkers, "runner_stream_created");
|
|
2532
2547
|
while (true) {
|
|
2533
2548
|
const next = await stream.next();
|
|
2534
2549
|
if (next.done) {
|
|
@@ -2536,10 +2551,18 @@ ${subGuideBlocks}
|
|
|
2536
2551
|
}
|
|
2537
2552
|
const event = next.value;
|
|
2538
2553
|
if (event.type === "text_delta") {
|
|
2554
|
+
if (!firstOutputSeen) {
|
|
2555
|
+
firstOutputSeen = true;
|
|
2556
|
+
pushTraceMarker(traceMarkers, "first_output_seen", "text_delta");
|
|
2557
|
+
}
|
|
2539
2558
|
outbox.push({ type: "text_delta", text: event.text });
|
|
2540
2559
|
continue;
|
|
2541
2560
|
}
|
|
2542
2561
|
if (event.type === "step_start") {
|
|
2562
|
+
if (!firstStepSeen) {
|
|
2563
|
+
firstStepSeen = true;
|
|
2564
|
+
pushTraceMarker(traceMarkers, "first_step_started", `step=${event.step}`);
|
|
2565
|
+
}
|
|
2543
2566
|
outbox.push({ type: "step_start", step: event.step + stepOffset });
|
|
2544
2567
|
continue;
|
|
2545
2568
|
}
|
|
@@ -2552,6 +2575,10 @@ ${subGuideBlocks}
|
|
|
2552
2575
|
continue;
|
|
2553
2576
|
}
|
|
2554
2577
|
if (event.type === "tool_start") {
|
|
2578
|
+
if (!firstOutputSeen) {
|
|
2579
|
+
firstOutputSeen = true;
|
|
2580
|
+
pushTraceMarker(traceMarkers, "first_output_seen", `tool_start:${event.name}`);
|
|
2581
|
+
}
|
|
2555
2582
|
outbox.push({
|
|
2556
2583
|
type: "activity",
|
|
2557
2584
|
activity: {
|
|
@@ -2564,6 +2591,10 @@ ${subGuideBlocks}
|
|
|
2564
2591
|
continue;
|
|
2565
2592
|
}
|
|
2566
2593
|
if (event.type === "tool_end") {
|
|
2594
|
+
if (!firstOutputSeen) {
|
|
2595
|
+
firstOutputSeen = true;
|
|
2596
|
+
pushTraceMarker(traceMarkers, "first_output_seen", `tool_end:${event.name}`);
|
|
2597
|
+
}
|
|
2567
2598
|
outbox.push({
|
|
2568
2599
|
type: "activity",
|
|
2569
2600
|
activity: {
|
|
@@ -2648,6 +2679,10 @@ ${subGuideBlocks}
|
|
|
2648
2679
|
success: true
|
|
2649
2680
|
};
|
|
2650
2681
|
const { episode, trace, artifacts } = compressor.compress(compressInput);
|
|
2682
|
+
trace.markers = [...traceMarkers, {
|
|
2683
|
+
type: "process_completed",
|
|
2684
|
+
ts: Date.now()
|
|
2685
|
+
}];
|
|
2651
2686
|
if (result.structuredOutput) {
|
|
2652
2687
|
episode.structuredOutput = result.structuredOutput;
|
|
2653
2688
|
}
|
|
@@ -2683,6 +2718,11 @@ ${subGuideBlocks}
|
|
|
2683
2718
|
} catch (error) {
|
|
2684
2719
|
const durationMs = Date.now() - startTime;
|
|
2685
2720
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
2721
|
+
pushTraceMarker(
|
|
2722
|
+
traceMarkers,
|
|
2723
|
+
errorMessage.includes("timed out") ? "process_timeout" : "process_failed",
|
|
2724
|
+
errorMessage
|
|
2725
|
+
);
|
|
2686
2726
|
if (ac.signal.aborted) {
|
|
2687
2727
|
process2.status = "cancelled";
|
|
2688
2728
|
outbox.push({ type: "failed", error: "cancelled" });
|
|
@@ -2703,6 +2743,7 @@ ${subGuideBlocks}
|
|
|
2703
2743
|
parentEpisodeIds: request.contextEpisodeIds ?? [],
|
|
2704
2744
|
success: false
|
|
2705
2745
|
});
|
|
2746
|
+
trace.markers = traceMarkers;
|
|
2706
2747
|
await config.episodeStore.addEpisode(episode).catch(() => {
|
|
2707
2748
|
});
|
|
2708
2749
|
await config.episodeStore.addTrace(trace).catch(() => {
|
|
@@ -2838,6 +2879,14 @@ ${results}`;
|
|
|
2838
2879
|
${textContent}`;
|
|
2839
2880
|
}).join("\n\n");
|
|
2840
2881
|
}
|
|
2882
|
+
function renderMarkerText(markers) {
|
|
2883
|
+
if (!markers || markers.length === 0) return "";
|
|
2884
|
+
return markers.map((marker) => {
|
|
2885
|
+
const parts = [marker.type, new Date(marker.ts).toISOString()];
|
|
2886
|
+
if (marker.detail) parts.push(marker.detail);
|
|
2887
|
+
return `- ${parts.join(" | ")}`;
|
|
2888
|
+
}).join("\n");
|
|
2889
|
+
}
|
|
2841
2890
|
function formatSummaryBlock(episode) {
|
|
2842
2891
|
const lines = [
|
|
2843
2892
|
`Action: ${episode.threadAction}`,
|
|
@@ -2898,6 +2947,13 @@ ${formatArtifactsBlock(liveArtifacts, artifactKey)}`;
|
|
|
2898
2947
|
if (!trace) {
|
|
2899
2948
|
resultText += "\n\nTrace not found.";
|
|
2900
2949
|
} else {
|
|
2950
|
+
const markerText = renderMarkerText(trace.markers);
|
|
2951
|
+
if (markerText) {
|
|
2952
|
+
resultText += `
|
|
2953
|
+
|
|
2954
|
+
--- Markers ---
|
|
2955
|
+
${markerText}`;
|
|
2956
|
+
}
|
|
2901
2957
|
resultText += `
|
|
2902
2958
|
|
|
2903
2959
|
--- Trace ---
|