markform 0.1.26 → 0.1.27
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/ai-sdk.mjs +1 -1
- package/dist/bin.mjs +1 -1
- package/dist/{cli-BMQ9k9z7.mjs → cli-yBrJefDI.mjs} +3 -3
- package/dist/{cli-BMQ9k9z7.mjs.map → cli-yBrJefDI.mjs.map} +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/{fillRecord-V3vlyobd.d.mts → fillRecord-CncFQ23t.d.mts} +76 -1
- package/dist/index.d.mts +30 -6
- package/dist/index.mjs +2 -2
- package/dist/{prompts-4jZmkGKW.mjs → prompts-CwEV0X5z.mjs} +14 -14
- package/dist/prompts-CwEV0X5z.mjs.map +1 -0
- package/dist/render.d.mts +1 -1
- package/dist/{src-Dy3cDjDS.mjs → src-DMIq0BFC.mjs} +212 -14
- package/dist/src-DMIq0BFC.mjs.map +1 -0
- package/docs/markform-apis.md +72 -4
- package/docs/markform-reference.md +4 -6
- package/docs/markform-spec.md +39 -24
- package/examples/markform-demo-playbook.md +17 -15
- package/examples/simple/simple-mock-filled.report.md +4 -4
- package/examples/simple/simple-skipped-filled.report.md +8 -8
- package/examples/simple/simple.raw.md +9 -9
- package/package.json +1 -1
- package/dist/prompts-4jZmkGKW.mjs.map +0 -1
- package/dist/src-Dy3cDjDS.mjs.map +0 -1
package/dist/render.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { A as MarkformSectionInputSchema, B as ProgressCountsSchema, R as PatchSchema, ht as StructureSummarySchema, z as PatchWarningSchema } from "./coreTypes-DIv9Aabl.mjs";
|
|
3
|
-
import { $ as DEFAULT_RESEARCH_MAX_PATCHES_PER_TURN, A as tryParseSentinelResponse, B as isTagNode, D as detectSyntaxStyle, F as getBooleanAttr, G as DEFAULT_MAX_PARALLEL_AGENTS, H as AGENT_ROLE, I as getNumberAttr, J as DEFAULT_MAX_STEPS_PER_TURN, K as DEFAULT_MAX_PATCHES_PER_TURN, L as getStringArrayAttr, M as extractFenceValue, N as extractOptionItems, O as preprocessCommentSyntax, P as extractTableContent, Pt as wrapApiError, Q as DEFAULT_RESEARCH_MAX_ISSUES_PER_TURN, R as getStringAttr, S as computeStructureSummary, St as MarkformParseError, V as parseOptionText, W as DEFAULT_MAX_ISSUES_PER_TURN, Y as DEFAULT_MAX_TURNS, Z as DEFAULT_PRIORITY, _ as inspect, a as WEB_SEARCH_INSTRUCTIONS, c as filterIssuesByOrder, d as coerceInputContext, dt as transformHarnessConfigToTs, et as DEFAULT_ROLES, g as getFieldsForRoles, ht as getWebSearchConfig, i as SECTION_HEADERS, j as CHECKBOX_MARKERS, l as filterIssuesByScope, m as applyPatches, n as GENERAL_INSTRUCTIONS, o as getIssuesIntro, q as DEFAULT_MAX_RETRIES, r as ISSUES_HEADER, s as getPatchFormatHint, t as DEFAULT_SYSTEM_PROMPT, tt as DEFAULT_ROLE_INSTRUCTIONS, w as serializeForm, x as computeProgressSummary, yt as MarkformConfigError, z as getValidateAttr } from "./prompts-
|
|
3
|
+
import { $ as DEFAULT_RESEARCH_MAX_PATCHES_PER_TURN, A as tryParseSentinelResponse, B as isTagNode, D as detectSyntaxStyle, F as getBooleanAttr, G as DEFAULT_MAX_PARALLEL_AGENTS, H as AGENT_ROLE, I as getNumberAttr, J as DEFAULT_MAX_STEPS_PER_TURN, K as DEFAULT_MAX_PATCHES_PER_TURN, L as getStringArrayAttr, M as extractFenceValue, N as extractOptionItems, O as preprocessCommentSyntax, P as extractTableContent, Pt as wrapApiError, Q as DEFAULT_RESEARCH_MAX_ISSUES_PER_TURN, R as getStringAttr, S as computeStructureSummary, St as MarkformParseError, V as parseOptionText, W as DEFAULT_MAX_ISSUES_PER_TURN, Y as DEFAULT_MAX_TURNS, Z as DEFAULT_PRIORITY, _ as inspect, a as WEB_SEARCH_INSTRUCTIONS, c as filterIssuesByOrder, d as coerceInputContext, dt as transformHarnessConfigToTs, et as DEFAULT_ROLES, g as getFieldsForRoles, ht as getWebSearchConfig, i as SECTION_HEADERS, j as CHECKBOX_MARKERS, l as filterIssuesByScope, m as applyPatches, n as GENERAL_INSTRUCTIONS, o as getIssuesIntro, q as DEFAULT_MAX_RETRIES, r as ISSUES_HEADER, s as getPatchFormatHint, t as DEFAULT_SYSTEM_PROMPT, tt as DEFAULT_ROLE_INSTRUCTIONS, w as serializeForm, x as computeProgressSummary, yt as MarkformConfigError, z as getValidateAttr } from "./prompts-CwEV0X5z.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import Markdoc from "@markdoc/markdoc";
|
|
6
6
|
import YAML from "yaml";
|
|
@@ -2717,6 +2717,18 @@ function generateSessionId() {
|
|
|
2717
2717
|
//#endregion
|
|
2718
2718
|
//#region src/harness/fillRecordCollector.ts
|
|
2719
2719
|
/**
|
|
2720
|
+
* Attempt to produce a JSON-safe clone of a value.
|
|
2721
|
+
* Falls back to a string representation if serialization fails
|
|
2722
|
+
* (e.g., BigInt, circular references, class instances).
|
|
2723
|
+
*/
|
|
2724
|
+
function safeJsonValue(value) {
|
|
2725
|
+
try {
|
|
2726
|
+
return JSON.parse(JSON.stringify(value));
|
|
2727
|
+
} catch {
|
|
2728
|
+
return String(value);
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
/**
|
|
2720
2732
|
* Collector for FillRecord data from async form fill operations.
|
|
2721
2733
|
*
|
|
2722
2734
|
* Uses an append-only event log pattern that safely handles interleaved
|
|
@@ -2735,6 +2747,8 @@ var FillRecordCollector = class {
|
|
|
2735
2747
|
events = [];
|
|
2736
2748
|
explicitStatus;
|
|
2737
2749
|
explicitStatusDetail;
|
|
2750
|
+
explicitErrorType;
|
|
2751
|
+
explicitErrorCode;
|
|
2738
2752
|
pendingToolCalls = /* @__PURE__ */ new Map();
|
|
2739
2753
|
pendingLlmCalls = /* @__PURE__ */ new Map();
|
|
2740
2754
|
constructor(options) {
|
|
@@ -2787,7 +2801,11 @@ var FillRecordCollector = class {
|
|
|
2787
2801
|
model: call.model,
|
|
2788
2802
|
inputTokens: call.inputTokens,
|
|
2789
2803
|
outputTokens: call.outputTokens,
|
|
2790
|
-
executionId: call.executionId
|
|
2804
|
+
executionId: call.executionId,
|
|
2805
|
+
durationMs: call.durationMs,
|
|
2806
|
+
responseId: call.responseId,
|
|
2807
|
+
requestId: call.requestId,
|
|
2808
|
+
error: call.error
|
|
2791
2809
|
});
|
|
2792
2810
|
this.pendingLlmCalls.delete(call.executionId);
|
|
2793
2811
|
}
|
|
@@ -2835,9 +2853,11 @@ var FillRecordCollector = class {
|
|
|
2835
2853
|
/**
|
|
2836
2854
|
* Set explicit status (overrides auto-detection from progress).
|
|
2837
2855
|
*/
|
|
2838
|
-
setStatus(status, detail) {
|
|
2856
|
+
setStatus(status, detail, errorInfo) {
|
|
2839
2857
|
this.explicitStatus = status;
|
|
2840
2858
|
this.explicitStatusDetail = detail;
|
|
2859
|
+
this.explicitErrorType = errorInfo?.errorType;
|
|
2860
|
+
this.explicitErrorCode = errorInfo?.errorCode;
|
|
2841
2861
|
}
|
|
2842
2862
|
/**
|
|
2843
2863
|
* Assemble the complete FillRecord from collected events.
|
|
@@ -2859,6 +2879,8 @@ var FillRecordCollector = class {
|
|
|
2859
2879
|
form: this.form,
|
|
2860
2880
|
status,
|
|
2861
2881
|
statusDetail: this.explicitStatusDetail,
|
|
2882
|
+
errorType: this.explicitErrorType,
|
|
2883
|
+
errorCode: this.explicitErrorCode,
|
|
2862
2884
|
formProgress,
|
|
2863
2885
|
llm: {
|
|
2864
2886
|
provider: this.provider,
|
|
@@ -2871,7 +2893,8 @@ var FillRecordCollector = class {
|
|
|
2871
2893
|
timingBreakdown,
|
|
2872
2894
|
timeline,
|
|
2873
2895
|
execution,
|
|
2874
|
-
customData: Object.keys(this.customData).length > 0 ? this.customData : void 0
|
|
2896
|
+
customData: Object.keys(this.customData).length > 0 ? this.customData : void 0,
|
|
2897
|
+
eventLog: this.sanitizeEventLog()
|
|
2875
2898
|
};
|
|
2876
2899
|
}
|
|
2877
2900
|
buildTimeline() {
|
|
@@ -2881,6 +2904,10 @@ var FillRecordCollector = class {
|
|
|
2881
2904
|
const turnStartEvents = /* @__PURE__ */ new Map();
|
|
2882
2905
|
const turnToolCalls = /* @__PURE__ */ new Map();
|
|
2883
2906
|
const turnTokens = /* @__PURE__ */ new Map();
|
|
2907
|
+
const turnLlmDurationMs = /* @__PURE__ */ new Map();
|
|
2908
|
+
const turnLlmCallCount = /* @__PURE__ */ new Map();
|
|
2909
|
+
const turnResponseIds = /* @__PURE__ */ new Map();
|
|
2910
|
+
const turnRequestIds = /* @__PURE__ */ new Map();
|
|
2884
2911
|
for (const event of this.events) if (event.type === "turn_start") {
|
|
2885
2912
|
const key = turnKey(event.executionId, event.turnNumber);
|
|
2886
2913
|
turnStartEvents.set(key, event);
|
|
@@ -2941,6 +2968,18 @@ var FillRecordCollector = class {
|
|
|
2941
2968
|
tokens.input += event.inputTokens;
|
|
2942
2969
|
tokens.output += event.outputTokens;
|
|
2943
2970
|
}
|
|
2971
|
+
turnLlmCallCount.set(tk, (turnLlmCallCount.get(tk) ?? 0) + 1);
|
|
2972
|
+
if (event.durationMs !== void 0) turnLlmDurationMs.set(tk, (turnLlmDurationMs.get(tk) ?? 0) + event.durationMs);
|
|
2973
|
+
if (event.responseId) {
|
|
2974
|
+
const ids = turnResponseIds.get(tk) ?? [];
|
|
2975
|
+
ids.push(event.responseId);
|
|
2976
|
+
turnResponseIds.set(tk, ids);
|
|
2977
|
+
}
|
|
2978
|
+
if (event.requestId) {
|
|
2979
|
+
const ids = turnRequestIds.get(tk) ?? [];
|
|
2980
|
+
ids.push(event.requestId);
|
|
2981
|
+
turnRequestIds.set(tk, ids);
|
|
2982
|
+
}
|
|
2944
2983
|
}
|
|
2945
2984
|
}
|
|
2946
2985
|
const turnCompleteByKey = /* @__PURE__ */ new Map();
|
|
@@ -2974,6 +3013,10 @@ var FillRecordCollector = class {
|
|
|
2974
3013
|
patchesApplied: completeEvent.patchesApplied,
|
|
2975
3014
|
patchesRejected: completeEvent.patchesRejected,
|
|
2976
3015
|
tokens,
|
|
3016
|
+
llmCallDurationMs: turnLlmDurationMs.get(key),
|
|
3017
|
+
llmCallCount: turnLlmCallCount.get(key),
|
|
3018
|
+
responseIds: turnResponseIds.get(key)?.length ? turnResponseIds.get(key) : void 0,
|
|
3019
|
+
requestIds: turnRequestIds.get(key)?.length ? turnRequestIds.get(key) : void 0,
|
|
2977
3020
|
toolCalls,
|
|
2978
3021
|
...completeEvent.coercionWarnings && completeEvent.coercionWarnings.length > 0 && { coercionWarnings: completeEvent.coercionWarnings }
|
|
2979
3022
|
};
|
|
@@ -3003,6 +3046,25 @@ var FillRecordCollector = class {
|
|
|
3003
3046
|
if (typeof obj.resultCount === "number") return { resultCount: obj.resultCount };
|
|
3004
3047
|
}
|
|
3005
3048
|
}
|
|
3049
|
+
/**
|
|
3050
|
+
* Sanitize event log for JSON serialization.
|
|
3051
|
+
* Tool input/output values are typed as `unknown` and may contain
|
|
3052
|
+
* non-JSON-safe values (BigInt, circular objects, class instances)
|
|
3053
|
+
* from custom tools. Sanitize these before exposing in the fill record.
|
|
3054
|
+
*/
|
|
3055
|
+
sanitizeEventLog() {
|
|
3056
|
+
return this.events.map((event) => {
|
|
3057
|
+
if (event.type === "tool_start") return {
|
|
3058
|
+
...event,
|
|
3059
|
+
input: safeJsonValue(event.input)
|
|
3060
|
+
};
|
|
3061
|
+
if (event.type === "tool_end") return {
|
|
3062
|
+
...event,
|
|
3063
|
+
output: safeJsonValue(event.output)
|
|
3064
|
+
};
|
|
3065
|
+
return event;
|
|
3066
|
+
});
|
|
3067
|
+
}
|
|
3006
3068
|
calculateLlmTotals() {
|
|
3007
3069
|
let totalCalls = 0;
|
|
3008
3070
|
let inputTokens = 0;
|
|
@@ -8409,6 +8471,7 @@ var LiveAgent = class {
|
|
|
8409
8471
|
executionId;
|
|
8410
8472
|
toolChoice;
|
|
8411
8473
|
maxRetries;
|
|
8474
|
+
signal;
|
|
8412
8475
|
constructor(config) {
|
|
8413
8476
|
this.model = config.model;
|
|
8414
8477
|
this.maxStepsPerTurn = config.maxStepsPerTurn ?? DEFAULT_MAX_STEPS_PER_TURN;
|
|
@@ -8420,6 +8483,7 @@ var LiveAgent = class {
|
|
|
8420
8483
|
this.callbacks = config.callbacks;
|
|
8421
8484
|
this.executionId = config.executionId ?? "0-serial";
|
|
8422
8485
|
this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
8486
|
+
this.signal = config.signal;
|
|
8423
8487
|
this.toolChoice = config.toolChoice ?? "required";
|
|
8424
8488
|
if (this.enableWebSearch) {
|
|
8425
8489
|
if (config.providerTools) this.webSearchTools = config.providerTools;
|
|
@@ -8472,6 +8536,7 @@ var LiveAgent = class {
|
|
|
8472
8536
|
});
|
|
8473
8537
|
} catch {}
|
|
8474
8538
|
let result;
|
|
8539
|
+
const llmCallStartMs = Date.now();
|
|
8475
8540
|
try {
|
|
8476
8541
|
result = await generateText({
|
|
8477
8542
|
model: this.model,
|
|
@@ -8480,17 +8545,34 @@ var LiveAgent = class {
|
|
|
8480
8545
|
tools,
|
|
8481
8546
|
toolChoice: this.toolChoice,
|
|
8482
8547
|
maxRetries: this.maxRetries,
|
|
8483
|
-
stopWhen: stepCountIs(this.maxStepsPerTurn)
|
|
8548
|
+
stopWhen: stepCountIs(this.maxStepsPerTurn),
|
|
8549
|
+
abortSignal: this.signal
|
|
8484
8550
|
});
|
|
8485
8551
|
} catch (error) {
|
|
8552
|
+
const llmCallDurationMs = Date.now() - llmCallStartMs;
|
|
8553
|
+
if (this.callbacks?.onLlmCallEnd) try {
|
|
8554
|
+
this.callbacks.onLlmCallEnd({
|
|
8555
|
+
model: modelId,
|
|
8556
|
+
inputTokens: 0,
|
|
8557
|
+
outputTokens: 0,
|
|
8558
|
+
executionId: this.executionId,
|
|
8559
|
+
durationMs: llmCallDurationMs,
|
|
8560
|
+
error: error instanceof Error ? error.message : String(error)
|
|
8561
|
+
});
|
|
8562
|
+
} catch {}
|
|
8563
|
+
if (error instanceof Error && error.name === "AbortError") throw error;
|
|
8486
8564
|
throw wrapApiError(error, this.provider ?? "unknown", modelId);
|
|
8487
8565
|
}
|
|
8566
|
+
const llmCallDurationMs = Date.now() - llmCallStartMs;
|
|
8488
8567
|
if (this.callbacks?.onLlmCallEnd) try {
|
|
8489
8568
|
this.callbacks.onLlmCallEnd({
|
|
8490
8569
|
model: modelId,
|
|
8491
8570
|
inputTokens: result.usage?.inputTokens ?? 0,
|
|
8492
8571
|
outputTokens: result.usage?.outputTokens ?? 0,
|
|
8493
|
-
executionId: this.executionId
|
|
8572
|
+
executionId: this.executionId,
|
|
8573
|
+
durationMs: llmCallDurationMs,
|
|
8574
|
+
responseId: result.response?.id,
|
|
8575
|
+
requestId: result.response?.headers?.["x-request-id"]
|
|
8494
8576
|
});
|
|
8495
8577
|
} catch {}
|
|
8496
8578
|
const patches = [];
|
|
@@ -9677,7 +9759,8 @@ async function fillForm(options) {
|
|
|
9677
9759
|
additionalTools: options.additionalTools,
|
|
9678
9760
|
callbacks: mergedCallbacks,
|
|
9679
9761
|
maxStepsPerTurn: options.maxStepsPerTurn,
|
|
9680
|
-
toolChoice: options.toolChoice
|
|
9762
|
+
toolChoice: options.toolChoice,
|
|
9763
|
+
signal: options.signal
|
|
9681
9764
|
});
|
|
9682
9765
|
let turnCount = startingTurnNumber;
|
|
9683
9766
|
let turnsThisCall = 0;
|
|
@@ -9726,11 +9809,27 @@ async function fillForm(options) {
|
|
|
9726
9809
|
try {
|
|
9727
9810
|
response = await agent.fillFormTool(turnIssues, form, maxPatchesPerTurn, previousRejections);
|
|
9728
9811
|
} catch (error) {
|
|
9812
|
+
if (options.signal?.aborted) {
|
|
9813
|
+
let record;
|
|
9814
|
+
if (collector) {
|
|
9815
|
+
collector.setStatus("cancelled");
|
|
9816
|
+
record = collector.getRecord(getProgressCounts(form, targetRoles));
|
|
9817
|
+
}
|
|
9818
|
+
return buildResult(form, turnCount, totalPatches, {
|
|
9819
|
+
ok: false,
|
|
9820
|
+
reason: "cancelled"
|
|
9821
|
+
}, inputContextWarnings, turnIssues, record);
|
|
9822
|
+
}
|
|
9729
9823
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
9730
9824
|
const errorObj = error instanceof Error ? error : void 0;
|
|
9825
|
+
const errorType = error instanceof Error ? error.name : void 0;
|
|
9826
|
+
const errorCode = error?.statusCode?.toString() ?? error?.code ?? void 0;
|
|
9731
9827
|
let record;
|
|
9732
9828
|
if (collector) {
|
|
9733
|
-
collector.setStatus("failed", errorMessage
|
|
9829
|
+
collector.setStatus("failed", errorMessage, {
|
|
9830
|
+
errorType,
|
|
9831
|
+
errorCode
|
|
9832
|
+
});
|
|
9734
9833
|
record = collector.getRecord(getProgressCounts(form, targetRoles));
|
|
9735
9834
|
}
|
|
9736
9835
|
if (errorObj && mergedCallbacks?.onError) try {
|
|
@@ -9742,7 +9841,9 @@ async function fillForm(options) {
|
|
|
9742
9841
|
ok: false,
|
|
9743
9842
|
reason: "error",
|
|
9744
9843
|
message: errorMessage,
|
|
9745
|
-
error: errorObj
|
|
9844
|
+
error: errorObj,
|
|
9845
|
+
errorType,
|
|
9846
|
+
errorCode
|
|
9746
9847
|
}, inputContextWarnings, turnIssues, record);
|
|
9747
9848
|
}
|
|
9748
9849
|
const { patches, stats } = response;
|
|
@@ -9850,7 +9951,8 @@ async function fillFormParallel(form, model, provider, providerTools, options, i
|
|
|
9850
9951
|
callbacks: mergedCallbacks,
|
|
9851
9952
|
maxStepsPerTurn: options.maxStepsPerTurn,
|
|
9852
9953
|
executionId,
|
|
9853
|
-
toolChoice: options.toolChoice
|
|
9954
|
+
toolChoice: options.toolChoice,
|
|
9955
|
+
signal: options.signal
|
|
9854
9956
|
});
|
|
9855
9957
|
};
|
|
9856
9958
|
for (const order of plan.orderLevels) {
|
|
@@ -10014,8 +10116,19 @@ async function runMultiTurnForItems(form, agent, items, targetRoles, maxPatchesP
|
|
|
10014
10116
|
try {
|
|
10015
10117
|
response = await agent.fillFormTool(scopedIssues, form, maxPatchesPerTurn, previousRejections);
|
|
10016
10118
|
} catch (error) {
|
|
10119
|
+
if (options.signal?.aborted) return {
|
|
10120
|
+
patchesApplied,
|
|
10121
|
+
turnsUsed,
|
|
10122
|
+
aborted: true,
|
|
10123
|
+
status: {
|
|
10124
|
+
ok: false,
|
|
10125
|
+
reason: "cancelled"
|
|
10126
|
+
}
|
|
10127
|
+
};
|
|
10017
10128
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
10018
10129
|
const errorObj = error instanceof Error ? error : void 0;
|
|
10130
|
+
const errorType = error instanceof Error ? error.name : void 0;
|
|
10131
|
+
const errorCode = error?.statusCode?.toString() ?? error?.code ?? void 0;
|
|
10019
10132
|
if (errorObj && mergedCallbacks?.onError) try {
|
|
10020
10133
|
mergedCallbacks.onError(errorObj, { turnNumber: startTurn + turnsUsed + 1 });
|
|
10021
10134
|
} catch (cbError) {
|
|
@@ -10029,7 +10142,9 @@ async function runMultiTurnForItems(form, agent, items, targetRoles, maxPatchesP
|
|
|
10029
10142
|
ok: false,
|
|
10030
10143
|
reason: "error",
|
|
10031
10144
|
message: errorMessage,
|
|
10032
|
-
error: errorObj
|
|
10145
|
+
error: errorObj,
|
|
10146
|
+
errorType,
|
|
10147
|
+
errorCode
|
|
10033
10148
|
}
|
|
10034
10149
|
};
|
|
10035
10150
|
}
|
|
@@ -10273,6 +10388,10 @@ const TimelineEntrySchema = z.object({
|
|
|
10273
10388
|
input: z.number().int().nonnegative(),
|
|
10274
10389
|
output: z.number().int().nonnegative()
|
|
10275
10390
|
}),
|
|
10391
|
+
llmCallDurationMs: z.number().int().nonnegative().optional(),
|
|
10392
|
+
llmCallCount: z.number().int().nonnegative().optional(),
|
|
10393
|
+
responseIds: z.array(z.string()).optional(),
|
|
10394
|
+
requestIds: z.array(z.string()).optional(),
|
|
10276
10395
|
toolCalls: z.array(ToolCallRecordSchema),
|
|
10277
10396
|
coercionWarnings: z.array(PatchWarningSchema).optional()
|
|
10278
10397
|
});
|
|
@@ -10323,6 +10442,80 @@ const ExecutionMetadataSchema = z.object({
|
|
|
10323
10442
|
executionThreads: z.array(z.string())
|
|
10324
10443
|
});
|
|
10325
10444
|
/**
|
|
10445
|
+
* Zod schemas for the raw event log captured during fill execution.
|
|
10446
|
+
* Mirror the CollectorEvent interfaces in fillRecordCollector.ts.
|
|
10447
|
+
*/
|
|
10448
|
+
const EventTurnStartSchema = z.object({
|
|
10449
|
+
type: z.literal("turn_start"),
|
|
10450
|
+
timestamp: z.string().datetime(),
|
|
10451
|
+
turnNumber: z.number().int().positive(),
|
|
10452
|
+
issuesCount: z.number().int().nonnegative(),
|
|
10453
|
+
order: z.number().int().nonnegative(),
|
|
10454
|
+
executionId: z.string()
|
|
10455
|
+
});
|
|
10456
|
+
const EventTurnCompleteSchema = z.object({
|
|
10457
|
+
type: z.literal("turn_complete"),
|
|
10458
|
+
timestamp: z.string().datetime(),
|
|
10459
|
+
turnNumber: z.number().int().positive(),
|
|
10460
|
+
patchesApplied: z.number().int().nonnegative(),
|
|
10461
|
+
patchesRejected: z.number().int().nonnegative(),
|
|
10462
|
+
issuesAddressed: z.number().int().nonnegative(),
|
|
10463
|
+
coercionWarnings: z.array(PatchWarningSchema).optional(),
|
|
10464
|
+
executionId: z.string().optional()
|
|
10465
|
+
});
|
|
10466
|
+
const EventLlmCallStartSchema = z.object({
|
|
10467
|
+
type: z.literal("llm_call_start"),
|
|
10468
|
+
timestamp: z.string().datetime(),
|
|
10469
|
+
model: z.string(),
|
|
10470
|
+
executionId: z.string()
|
|
10471
|
+
});
|
|
10472
|
+
const EventLlmCallEndSchema = z.object({
|
|
10473
|
+
type: z.literal("llm_call_end"),
|
|
10474
|
+
timestamp: z.string().datetime(),
|
|
10475
|
+
model: z.string(),
|
|
10476
|
+
inputTokens: z.number().int().nonnegative(),
|
|
10477
|
+
outputTokens: z.number().int().nonnegative(),
|
|
10478
|
+
executionId: z.string(),
|
|
10479
|
+
durationMs: z.number().int().nonnegative().optional(),
|
|
10480
|
+
responseId: z.string().optional(),
|
|
10481
|
+
requestId: z.string().optional(),
|
|
10482
|
+
error: z.string().optional()
|
|
10483
|
+
});
|
|
10484
|
+
const EventToolStartSchema = z.object({
|
|
10485
|
+
type: z.literal("tool_start"),
|
|
10486
|
+
timestamp: z.string().datetime(),
|
|
10487
|
+
name: z.string(),
|
|
10488
|
+
input: z.unknown(),
|
|
10489
|
+
executionId: z.string()
|
|
10490
|
+
});
|
|
10491
|
+
const EventToolEndSchema = z.object({
|
|
10492
|
+
type: z.literal("tool_end"),
|
|
10493
|
+
timestamp: z.string().datetime(),
|
|
10494
|
+
name: z.string(),
|
|
10495
|
+
output: z.unknown(),
|
|
10496
|
+
durationMs: z.number().int().nonnegative(),
|
|
10497
|
+
error: z.string().optional(),
|
|
10498
|
+
executionId: z.string()
|
|
10499
|
+
});
|
|
10500
|
+
const EventWebSearchSchema = z.object({
|
|
10501
|
+
type: z.literal("web_search"),
|
|
10502
|
+
timestamp: z.string().datetime(),
|
|
10503
|
+
query: z.string(),
|
|
10504
|
+
resultCount: z.number().int().nonnegative(),
|
|
10505
|
+
provider: z.string(),
|
|
10506
|
+
executionId: z.string()
|
|
10507
|
+
});
|
|
10508
|
+
/** Schema for the discriminated union of all collector event types. */
|
|
10509
|
+
const CollectorEventSchema = z.discriminatedUnion("type", [
|
|
10510
|
+
EventTurnStartSchema,
|
|
10511
|
+
EventTurnCompleteSchema,
|
|
10512
|
+
EventLlmCallStartSchema,
|
|
10513
|
+
EventLlmCallEndSchema,
|
|
10514
|
+
EventToolStartSchema,
|
|
10515
|
+
EventToolEndSchema,
|
|
10516
|
+
EventWebSearchSchema
|
|
10517
|
+
]);
|
|
10518
|
+
/**
|
|
10326
10519
|
* Fill status enum.
|
|
10327
10520
|
*/
|
|
10328
10521
|
const FillRecordStatusSchema = z.enum([
|
|
@@ -10353,6 +10546,8 @@ const FillRecordSchema = z.object({
|
|
|
10353
10546
|
}),
|
|
10354
10547
|
status: FillRecordStatusSchema,
|
|
10355
10548
|
statusDetail: z.string().optional(),
|
|
10549
|
+
errorType: z.string().optional(),
|
|
10550
|
+
errorCode: z.string().optional(),
|
|
10356
10551
|
formProgress: ProgressCountsSchema,
|
|
10357
10552
|
llm: z.object({
|
|
10358
10553
|
provider: z.string(),
|
|
@@ -10365,7 +10560,8 @@ const FillRecordSchema = z.object({
|
|
|
10365
10560
|
timingBreakdown: TimingBreakdownSchema,
|
|
10366
10561
|
timeline: z.array(TimelineEntrySchema),
|
|
10367
10562
|
execution: ExecutionMetadataSchema,
|
|
10368
|
-
customData: z.record(z.string(), z.unknown()).optional()
|
|
10563
|
+
customData: z.record(z.string(), z.unknown()).optional(),
|
|
10564
|
+
eventLog: z.array(CollectorEventSchema).optional()
|
|
10369
10565
|
});
|
|
10370
10566
|
/**
|
|
10371
10567
|
* Strip unstable fields from FillRecord for golden test comparisons.
|
|
@@ -10402,6 +10598,8 @@ function stripUnstableFillRecordFields(record) {
|
|
|
10402
10598
|
form: record.form,
|
|
10403
10599
|
status: record.status,
|
|
10404
10600
|
statusDetail: record.statusDetail,
|
|
10601
|
+
errorType: record.errorType,
|
|
10602
|
+
errorCode: record.errorCode,
|
|
10405
10603
|
formProgress: record.formProgress,
|
|
10406
10604
|
llm: record.llm,
|
|
10407
10605
|
toolSummary: stableToolSummary,
|
|
@@ -10529,8 +10727,8 @@ function validateResearchForm(form) {
|
|
|
10529
10727
|
//#endregion
|
|
10530
10728
|
//#region src/index.ts
|
|
10531
10729
|
/** Markform version (injected at build time). */
|
|
10532
|
-
const VERSION = "0.1.
|
|
10730
|
+
const VERSION = "0.1.27";
|
|
10533
10731
|
|
|
10534
10732
|
//#endregion
|
|
10535
10733
|
export { MockAgent as A, fieldToJsonSchema as B, getProviderInfo as C, createLiveAgent as D, buildMockWireFormat as E, isCellRef as F, injectHeaderIds as G, parseForm as H, isFieldRef as I, parseCellValue as J, findAllHeadings as K, isQualifiedRef as L, FormHarness as M, createHarness as N, FillRecordCollector as O, getFieldId as P, parseScopeRef as R, BUILT_IN_PROVIDERS as S, resolveModel as T, findAllCheckboxes as U, formToJsonSchema as V, injectCheckboxIds as W, parseRawTable as X, parseMarkdownTable as Y, resolveHarnessConfig as _, ExecutionMetadataSchema as a, createParallelHarness as b, TimelineEntrySchema as c, ToolCallRecordSchema as d, ToolStatsSchema as f, formatFillRecordSummary as g, stripUnstableFillRecordFields as h, runResearch as i, createMockAgent as j, computeExecutionPlan as k, TimingBreakdownItemSchema as l, isEmptyFillRecord as m, isResearchForm as n, FillRecordSchema as o, ToolSummarySchema as p, findEnclosingHeadings as q, validateResearchForm as r, FillRecordStatusSchema as s, VERSION as t, TimingBreakdownSchema as u, fillForm as v, getProviderNames as w, scopeIssuesForItem as x, ParallelHarness as y, serializeScopeRef as z };
|
|
10536
|
-
//# sourceMappingURL=src-
|
|
10734
|
+
//# sourceMappingURL=src-DMIq0BFC.mjs.map
|