@runtypelabs/sdk 1.9.1 → 1.10.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/dist/index.cjs +114 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +114 -47
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3142,11 +3142,16 @@ interface RunTaskStateSlice {
|
|
|
3142
3142
|
bestCandidateVerified?: boolean;
|
|
3143
3143
|
verificationRequired?: boolean;
|
|
3144
3144
|
lastVerificationPassed?: boolean;
|
|
3145
|
+
consecutiveBlockedVerificationSessions?: number;
|
|
3145
3146
|
isCreationTask?: boolean;
|
|
3147
|
+
/** For creation tasks: allowed write root (e.g. "public/"). Writes must stay under this path. */
|
|
3148
|
+
outputRoot?: string;
|
|
3146
3149
|
sessions: Array<{
|
|
3147
3150
|
actionKeys?: string[];
|
|
3148
3151
|
hadTextOutput?: boolean;
|
|
3149
3152
|
wroteFiles?: boolean;
|
|
3153
|
+
verificationAttempted?: boolean;
|
|
3154
|
+
verificationBlocked?: boolean;
|
|
3150
3155
|
}>;
|
|
3151
3156
|
}
|
|
3152
3157
|
interface RunTaskToolTraceSlice {
|
|
@@ -3165,6 +3170,7 @@ interface RunTaskToolTraceSlice {
|
|
|
3165
3170
|
bestCandidateVerified: boolean;
|
|
3166
3171
|
verificationAttempted: boolean;
|
|
3167
3172
|
verificationPassed: boolean;
|
|
3173
|
+
verificationBlocked: boolean;
|
|
3168
3174
|
localToolLoopGuardTriggered: boolean;
|
|
3169
3175
|
forcedTurnEndReason?: string;
|
|
3170
3176
|
bestCandidatePath?: string;
|
|
@@ -4197,6 +4203,8 @@ interface AgentExecuteRequest {
|
|
|
4197
4203
|
debugMode?: boolean;
|
|
4198
4204
|
/** Model ID to use for this session (overrides agent config) */
|
|
4199
4205
|
model?: string;
|
|
4206
|
+
/** Enable reasoning/thinking for models that support it (e.g. Gemini 3, o-series) */
|
|
4207
|
+
reasoning?: boolean;
|
|
4200
4208
|
/** Runtime tools to make available during execution */
|
|
4201
4209
|
tools?: {
|
|
4202
4210
|
runtimeTools?: AgentRuntimeToolDefinition[];
|
|
@@ -4298,6 +4306,8 @@ interface RunTaskSessionSummary {
|
|
|
4298
4306
|
verificationAttempted?: boolean;
|
|
4299
4307
|
/** Whether the latest verification command passed during the session */
|
|
4300
4308
|
verificationPassed?: boolean;
|
|
4309
|
+
/** Whether the verification command was blocked (e.g. unsafe command rejected) */
|
|
4310
|
+
verificationBlocked?: boolean;
|
|
4301
4311
|
/** Best candidate file identified during the session */
|
|
4302
4312
|
bestCandidatePath?: string;
|
|
4303
4313
|
/** Recent action keys used during the session */
|
|
@@ -4373,12 +4383,16 @@ interface RunTaskState {
|
|
|
4373
4383
|
lastVerificationPassed?: boolean;
|
|
4374
4384
|
/** Whether this task is creating something new rather than modifying existing files */
|
|
4375
4385
|
isCreationTask?: boolean;
|
|
4386
|
+
/** For creation tasks: allowed write root (e.g. "public/"). Writes must stay under this path. */
|
|
4387
|
+
outputRoot?: string;
|
|
4376
4388
|
/** Workflow variant string (e.g. 'create', 'modify', or custom) */
|
|
4377
4389
|
workflowVariant?: string;
|
|
4390
|
+
/** Number of consecutive sessions where verification was blocked */
|
|
4391
|
+
consecutiveBlockedVerificationSessions?: number;
|
|
4378
4392
|
/** Arbitrary bag for workflow-specific data */
|
|
4379
4393
|
workflowState?: Record<string, unknown>;
|
|
4380
4394
|
}
|
|
4381
|
-
type RunTaskResumeState = Pick<RunTaskState, 'originalMessage' | 'bootstrapContext' | 'workflowPhase' | 'planPath' | 'planWritten' | 'bestCandidatePath' | 'bestCandidateReason' | 'candidatePaths' | 'recentReadPaths' | 'recentActionKeys' | 'bestCandidateNeedsVerification' | 'bestCandidateVerified' | 'verificationRequired' | 'lastVerificationPassed' | 'isCreationTask' | 'workflowVariant' | 'workflowState'>;
|
|
4395
|
+
type RunTaskResumeState = Pick<RunTaskState, 'originalMessage' | 'bootstrapContext' | 'workflowPhase' | 'planPath' | 'planWritten' | 'bestCandidatePath' | 'bestCandidateReason' | 'candidatePaths' | 'recentReadPaths' | 'recentActionKeys' | 'bestCandidateNeedsVerification' | 'bestCandidateVerified' | 'verificationRequired' | 'lastVerificationPassed' | 'consecutiveBlockedVerificationSessions' | 'isCreationTask' | 'outputRoot' | 'workflowVariant' | 'workflowState'>;
|
|
4382
4396
|
/**
|
|
4383
4397
|
* Callback invoked after each session completes.
|
|
4384
4398
|
* Return `false` to stop the loop early.
|
|
@@ -4455,6 +4469,8 @@ interface RunTaskOptions {
|
|
|
4455
4469
|
localTools?: Record<string, LocalToolDefinition>;
|
|
4456
4470
|
/** Model ID to use (overrides agent's configured model) */
|
|
4457
4471
|
model?: string;
|
|
4472
|
+
/** Enable reasoning/thinking for models that support it (e.g. Gemini 3, o-series) */
|
|
4473
|
+
reasoning?: boolean;
|
|
4458
4474
|
/** Previous messages from a prior run (for continuation/resume) */
|
|
4459
4475
|
previousMessages?: AgentMessage[];
|
|
4460
4476
|
/** New user message for continuation (appended after previous context) */
|
package/dist/index.d.ts
CHANGED
|
@@ -3142,11 +3142,16 @@ interface RunTaskStateSlice {
|
|
|
3142
3142
|
bestCandidateVerified?: boolean;
|
|
3143
3143
|
verificationRequired?: boolean;
|
|
3144
3144
|
lastVerificationPassed?: boolean;
|
|
3145
|
+
consecutiveBlockedVerificationSessions?: number;
|
|
3145
3146
|
isCreationTask?: boolean;
|
|
3147
|
+
/** For creation tasks: allowed write root (e.g. "public/"). Writes must stay under this path. */
|
|
3148
|
+
outputRoot?: string;
|
|
3146
3149
|
sessions: Array<{
|
|
3147
3150
|
actionKeys?: string[];
|
|
3148
3151
|
hadTextOutput?: boolean;
|
|
3149
3152
|
wroteFiles?: boolean;
|
|
3153
|
+
verificationAttempted?: boolean;
|
|
3154
|
+
verificationBlocked?: boolean;
|
|
3150
3155
|
}>;
|
|
3151
3156
|
}
|
|
3152
3157
|
interface RunTaskToolTraceSlice {
|
|
@@ -3165,6 +3170,7 @@ interface RunTaskToolTraceSlice {
|
|
|
3165
3170
|
bestCandidateVerified: boolean;
|
|
3166
3171
|
verificationAttempted: boolean;
|
|
3167
3172
|
verificationPassed: boolean;
|
|
3173
|
+
verificationBlocked: boolean;
|
|
3168
3174
|
localToolLoopGuardTriggered: boolean;
|
|
3169
3175
|
forcedTurnEndReason?: string;
|
|
3170
3176
|
bestCandidatePath?: string;
|
|
@@ -4197,6 +4203,8 @@ interface AgentExecuteRequest {
|
|
|
4197
4203
|
debugMode?: boolean;
|
|
4198
4204
|
/** Model ID to use for this session (overrides agent config) */
|
|
4199
4205
|
model?: string;
|
|
4206
|
+
/** Enable reasoning/thinking for models that support it (e.g. Gemini 3, o-series) */
|
|
4207
|
+
reasoning?: boolean;
|
|
4200
4208
|
/** Runtime tools to make available during execution */
|
|
4201
4209
|
tools?: {
|
|
4202
4210
|
runtimeTools?: AgentRuntimeToolDefinition[];
|
|
@@ -4298,6 +4306,8 @@ interface RunTaskSessionSummary {
|
|
|
4298
4306
|
verificationAttempted?: boolean;
|
|
4299
4307
|
/** Whether the latest verification command passed during the session */
|
|
4300
4308
|
verificationPassed?: boolean;
|
|
4309
|
+
/** Whether the verification command was blocked (e.g. unsafe command rejected) */
|
|
4310
|
+
verificationBlocked?: boolean;
|
|
4301
4311
|
/** Best candidate file identified during the session */
|
|
4302
4312
|
bestCandidatePath?: string;
|
|
4303
4313
|
/** Recent action keys used during the session */
|
|
@@ -4373,12 +4383,16 @@ interface RunTaskState {
|
|
|
4373
4383
|
lastVerificationPassed?: boolean;
|
|
4374
4384
|
/** Whether this task is creating something new rather than modifying existing files */
|
|
4375
4385
|
isCreationTask?: boolean;
|
|
4386
|
+
/** For creation tasks: allowed write root (e.g. "public/"). Writes must stay under this path. */
|
|
4387
|
+
outputRoot?: string;
|
|
4376
4388
|
/** Workflow variant string (e.g. 'create', 'modify', or custom) */
|
|
4377
4389
|
workflowVariant?: string;
|
|
4390
|
+
/** Number of consecutive sessions where verification was blocked */
|
|
4391
|
+
consecutiveBlockedVerificationSessions?: number;
|
|
4378
4392
|
/** Arbitrary bag for workflow-specific data */
|
|
4379
4393
|
workflowState?: Record<string, unknown>;
|
|
4380
4394
|
}
|
|
4381
|
-
type RunTaskResumeState = Pick<RunTaskState, 'originalMessage' | 'bootstrapContext' | 'workflowPhase' | 'planPath' | 'planWritten' | 'bestCandidatePath' | 'bestCandidateReason' | 'candidatePaths' | 'recentReadPaths' | 'recentActionKeys' | 'bestCandidateNeedsVerification' | 'bestCandidateVerified' | 'verificationRequired' | 'lastVerificationPassed' | 'isCreationTask' | 'workflowVariant' | 'workflowState'>;
|
|
4395
|
+
type RunTaskResumeState = Pick<RunTaskState, 'originalMessage' | 'bootstrapContext' | 'workflowPhase' | 'planPath' | 'planWritten' | 'bestCandidatePath' | 'bestCandidateReason' | 'candidatePaths' | 'recentReadPaths' | 'recentActionKeys' | 'bestCandidateNeedsVerification' | 'bestCandidateVerified' | 'verificationRequired' | 'lastVerificationPassed' | 'consecutiveBlockedVerificationSessions' | 'isCreationTask' | 'outputRoot' | 'workflowVariant' | 'workflowState'>;
|
|
4382
4396
|
/**
|
|
4383
4397
|
* Callback invoked after each session completes.
|
|
4384
4398
|
* Return `false` to stop the loop early.
|
|
@@ -4455,6 +4469,8 @@ interface RunTaskOptions {
|
|
|
4455
4469
|
localTools?: Record<string, LocalToolDefinition>;
|
|
4456
4470
|
/** Model ID to use (overrides agent's configured model) */
|
|
4457
4471
|
model?: string;
|
|
4472
|
+
/** Enable reasoning/thinking for models that support it (e.g. Gemini 3, o-series) */
|
|
4473
|
+
reasoning?: boolean;
|
|
4458
4474
|
/** Previous messages from a prior run (for continuation/resume) */
|
|
4459
4475
|
previousMessages?: AgentMessage[];
|
|
4460
4476
|
/** New user message for continuation (appended after previous context) */
|
package/dist/index.js
CHANGED
|
@@ -1896,7 +1896,7 @@ var TOOL_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9_]{1,63}$/;
|
|
|
1896
1896
|
var DEFAULT_MAX_CODE_LENGTH = 12e3;
|
|
1897
1897
|
var DEFAULT_MAX_TIMEOUT_MS = 3e4;
|
|
1898
1898
|
var DEFAULT_BLOCKED_CODE_PATTERNS = [
|
|
1899
|
-
/\b(?:child_process|fs|net|tls|
|
|
1899
|
+
/\b(?:child_process|fs|net|tls|os)\b/i,
|
|
1900
1900
|
/\b(?:process|Deno|Bun)\b/i,
|
|
1901
1901
|
/\b(?:require|import)\s*\(/i,
|
|
1902
1902
|
/\beval\s*\(/i,
|
|
@@ -2715,7 +2715,7 @@ var executionPhase = {
|
|
|
2715
2715
|
`After that, you may update "${normalizedPlanPath}" with progress.`
|
|
2716
2716
|
].join(" ");
|
|
2717
2717
|
}
|
|
2718
|
-
if (normalizedPathArg && normalizedPathArg !== normalizedPlanPath) {
|
|
2718
|
+
if (!ctx.state.isCreationTask && normalizedPathArg && normalizedPathArg !== normalizedPlanPath) {
|
|
2719
2719
|
const allowedWriteTargets = new Set(
|
|
2720
2720
|
[
|
|
2721
2721
|
normalizedPlanPath,
|
|
@@ -2732,6 +2732,23 @@ var executionPhase = {
|
|
|
2732
2732
|
].join(" ");
|
|
2733
2733
|
}
|
|
2734
2734
|
}
|
|
2735
|
+
if (ctx.state.isCreationTask && normalizedPathArg && normalizedPathArg !== normalizedPlanPath) {
|
|
2736
|
+
const outputRoot = ctx.state.outputRoot ? ctx.state.outputRoot.trim().replace(/\\/g, "/").replace(/\/+/g, "/").replace(/\/$/, "") || void 0 : void 0;
|
|
2737
|
+
if (!outputRoot) {
|
|
2738
|
+
return [
|
|
2739
|
+
`Blocked by marathon execution guard: creation tasks require outputRoot. Writes outside the plan are not allowed.`,
|
|
2740
|
+
`Plan path: "${normalizedPlanPath}". Create files only under the configured output root.`
|
|
2741
|
+
].join(" ");
|
|
2742
|
+
}
|
|
2743
|
+
const rootPrefix = outputRoot + "/";
|
|
2744
|
+
const isUnderRoot = normalizedPathArg === outputRoot || normalizedPathArg.startsWith(rootPrefix);
|
|
2745
|
+
if (!isUnderRoot) {
|
|
2746
|
+
return [
|
|
2747
|
+
`Blocked by marathon execution guard: ${toolName} must target the plan or paths under outputRoot "${outputRoot}/".`,
|
|
2748
|
+
`"${normalizedPathArg}" is outside the allowed output root.`
|
|
2749
|
+
].join(" ");
|
|
2750
|
+
}
|
|
2751
|
+
}
|
|
2735
2752
|
}
|
|
2736
2753
|
return void 0;
|
|
2737
2754
|
},
|
|
@@ -2744,6 +2761,17 @@ var executionPhase = {
|
|
|
2744
2761
|
},
|
|
2745
2762
|
buildRecoveryMessage(state) {
|
|
2746
2763
|
const recent = state.sessions.slice(-2);
|
|
2764
|
+
if (recent.length >= 2 && recent.every(
|
|
2765
|
+
(session) => session.verificationAttempted === true && session.wroteFiles !== true
|
|
2766
|
+
)) {
|
|
2767
|
+
return [
|
|
2768
|
+
"Recovery instruction:",
|
|
2769
|
+
"You have attempted verification in multiple sessions but none passed, and no files were written.",
|
|
2770
|
+
"If the project lacks test/lint/build tooling, verification cannot succeed.",
|
|
2771
|
+
"Focus on completing any remaining implementation. Signal TASK_COMPLETE when done.",
|
|
2772
|
+
"Do not retry run_check unless you have a specific command likely to succeed."
|
|
2773
|
+
].join("\n");
|
|
2774
|
+
}
|
|
2747
2775
|
const normalizedPlanPath = typeof state.planPath === "string" && state.planPath.trim() ? normalizeCandidatePath(state.planPath) : void 0;
|
|
2748
2776
|
const recentPlanOnlyLoop = Boolean(normalizedPlanPath) && recent.length === 2 && recent.every((session) => {
|
|
2749
2777
|
const specificActionKeys = (session.actionKeys || []).map((actionKey) => actionKey.replace(/\\/g, "/")).filter((actionKey) => !actionKey.startsWith("server:"));
|
|
@@ -2786,6 +2814,57 @@ var executionPhase = {
|
|
|
2786
2814
|
};
|
|
2787
2815
|
function classifyVariant(message) {
|
|
2788
2816
|
const lower = message.toLowerCase();
|
|
2817
|
+
const modificationVerbs = [
|
|
2818
|
+
"fix",
|
|
2819
|
+
"update",
|
|
2820
|
+
"change",
|
|
2821
|
+
"modify",
|
|
2822
|
+
"edit",
|
|
2823
|
+
"refactor",
|
|
2824
|
+
"improve",
|
|
2825
|
+
"add to",
|
|
2826
|
+
"remove",
|
|
2827
|
+
"delete",
|
|
2828
|
+
"rename",
|
|
2829
|
+
"migrate"
|
|
2830
|
+
];
|
|
2831
|
+
const hasModificationVerb = modificationVerbs.some(
|
|
2832
|
+
(v) => lower.startsWith(v) || new RegExp(`\\b${v}\\b`).test(lower)
|
|
2833
|
+
);
|
|
2834
|
+
const creationPatterns = [
|
|
2835
|
+
/^create\b/,
|
|
2836
|
+
/^build\b/,
|
|
2837
|
+
/^make\b/,
|
|
2838
|
+
/^generate\b/,
|
|
2839
|
+
/^scaffold\b/,
|
|
2840
|
+
/^set up\b/,
|
|
2841
|
+
/^setup\b/,
|
|
2842
|
+
/^bootstrap\b/,
|
|
2843
|
+
/^initialize\b/,
|
|
2844
|
+
/^init\b/,
|
|
2845
|
+
/^write a\b/,
|
|
2846
|
+
/^write an\b/,
|
|
2847
|
+
/^implement a\b/,
|
|
2848
|
+
/^implement an\b/,
|
|
2849
|
+
/^start a\b/,
|
|
2850
|
+
/^start an\b/,
|
|
2851
|
+
/^new\b/
|
|
2852
|
+
];
|
|
2853
|
+
const hasCreationStart = creationPatterns.some((p) => p.test(lower));
|
|
2854
|
+
const creationVerbs = [
|
|
2855
|
+
"build",
|
|
2856
|
+
"create",
|
|
2857
|
+
"make",
|
|
2858
|
+
"generate",
|
|
2859
|
+
"scaffold",
|
|
2860
|
+
"implement"
|
|
2861
|
+
];
|
|
2862
|
+
const hasCreationVerb = creationVerbs.some(
|
|
2863
|
+
(v) => new RegExp(`\\b${v}\\b`).test(lower)
|
|
2864
|
+
);
|
|
2865
|
+
if ((hasCreationStart || hasCreationVerb) && !hasModificationVerb) {
|
|
2866
|
+
return "create";
|
|
2867
|
+
}
|
|
2789
2868
|
const externalVerbs = [
|
|
2790
2869
|
"fetch",
|
|
2791
2870
|
"browse",
|
|
@@ -2825,49 +2904,9 @@ function classifyVariant(message) {
|
|
|
2825
2904
|
];
|
|
2826
2905
|
const hasExternalVerb = externalVerbs.some((v) => lower.includes(v));
|
|
2827
2906
|
const hasExternalTarget = externalTargets.some((t) => lower.includes(t));
|
|
2828
|
-
const modificationVerbs = [
|
|
2829
|
-
"fix",
|
|
2830
|
-
"update",
|
|
2831
|
-
"change",
|
|
2832
|
-
"modify",
|
|
2833
|
-
"edit",
|
|
2834
|
-
"refactor",
|
|
2835
|
-
"improve",
|
|
2836
|
-
"add to",
|
|
2837
|
-
"remove",
|
|
2838
|
-
"delete",
|
|
2839
|
-
"rename",
|
|
2840
|
-
"migrate"
|
|
2841
|
-
];
|
|
2842
|
-
const hasModificationVerb = modificationVerbs.some(
|
|
2843
|
-
(v) => lower.startsWith(v) || new RegExp(`\\b${v}\\b`).test(lower)
|
|
2844
|
-
);
|
|
2845
2907
|
if (hasExternalVerb && hasExternalTarget && !hasModificationVerb) {
|
|
2846
2908
|
return "external";
|
|
2847
2909
|
}
|
|
2848
|
-
const creationPatterns = [
|
|
2849
|
-
/^create\b/,
|
|
2850
|
-
/^build\b/,
|
|
2851
|
-
/^make\b/,
|
|
2852
|
-
/^generate\b/,
|
|
2853
|
-
/^scaffold\b/,
|
|
2854
|
-
/^set up\b/,
|
|
2855
|
-
/^setup\b/,
|
|
2856
|
-
/^bootstrap\b/,
|
|
2857
|
-
/^initialize\b/,
|
|
2858
|
-
/^init\b/,
|
|
2859
|
-
/^write a\b/,
|
|
2860
|
-
/^write an\b/,
|
|
2861
|
-
/^implement a\b/,
|
|
2862
|
-
/^implement an\b/,
|
|
2863
|
-
/^start a\b/,
|
|
2864
|
-
/^start an\b/,
|
|
2865
|
-
/^new\b/
|
|
2866
|
-
];
|
|
2867
|
-
const hasCreationStart = creationPatterns.some((p) => p.test(lower));
|
|
2868
|
-
if (hasCreationStart && !hasModificationVerb) {
|
|
2869
|
-
return "create";
|
|
2870
|
-
}
|
|
2871
2910
|
return "modify";
|
|
2872
2911
|
}
|
|
2873
2912
|
async function generateBootstrapContext(message, localTools, variant) {
|
|
@@ -4705,6 +4744,7 @@ var _AgentsEndpoint = class _AgentsEndpoint {
|
|
|
4705
4744
|
bestCandidateVerified: false,
|
|
4706
4745
|
verificationAttempted: false,
|
|
4707
4746
|
verificationPassed: false,
|
|
4747
|
+
verificationBlocked: false,
|
|
4708
4748
|
localToolLoopGuardTriggered: false
|
|
4709
4749
|
};
|
|
4710
4750
|
}
|
|
@@ -4926,6 +4966,7 @@ var _AgentsEndpoint = class _AgentsEndpoint {
|
|
|
4926
4966
|
if (typeof parsed.success !== "boolean") return void 0;
|
|
4927
4967
|
return {
|
|
4928
4968
|
success: parsed.success,
|
|
4969
|
+
...typeof parsed.blocked === "boolean" ? { blocked: parsed.blocked } : {},
|
|
4929
4970
|
...typeof parsed.command === "string" ? { command: parsed.command } : {},
|
|
4930
4971
|
...typeof parsed.output === "string" ? { output: parsed.output } : {},
|
|
4931
4972
|
...typeof parsed.error === "string" ? { error: parsed.error } : {}
|
|
@@ -5153,9 +5194,11 @@ var _AgentsEndpoint = class _AgentsEndpoint {
|
|
|
5153
5194
|
bestCandidateVerified: Boolean(resumeState.bestCandidateVerified),
|
|
5154
5195
|
...resumeState.verificationRequired !== void 0 ? { verificationRequired: resumeState.verificationRequired } : {},
|
|
5155
5196
|
lastVerificationPassed: Boolean(resumeState.lastVerificationPassed),
|
|
5197
|
+
...resumeState.consecutiveBlockedVerificationSessions !== void 0 ? { consecutiveBlockedVerificationSessions: resumeState.consecutiveBlockedVerificationSessions } : {},
|
|
5156
5198
|
...resumeState.isCreationTask !== void 0 ? { isCreationTask: resumeState.isCreationTask } : {},
|
|
5157
5199
|
...resumeState.workflowVariant !== void 0 ? { workflowVariant: resumeState.workflowVariant } : {},
|
|
5158
|
-
...resumeState.workflowState !== void 0 ? { workflowState: resumeState.workflowState } : {}
|
|
5200
|
+
...resumeState.workflowState !== void 0 ? { workflowState: resumeState.workflowState } : {},
|
|
5201
|
+
...typeof resumeState.outputRoot === "string" && resumeState.outputRoot.trim() ? { outputRoot: resumeState.outputRoot.trim().replace(/\\/g, "/").replace(/\/+/g, "/") } : {}
|
|
5159
5202
|
};
|
|
5160
5203
|
}
|
|
5161
5204
|
buildPhaseInstructions(state, workflow) {
|
|
@@ -5282,6 +5325,10 @@ var _AgentsEndpoint = class _AgentsEndpoint {
|
|
|
5282
5325
|
} else if (state.workflowPhase === "execution") {
|
|
5283
5326
|
trace.executionFileWritten = true;
|
|
5284
5327
|
trace.verificationPassed = false;
|
|
5328
|
+
if (!this.isMarathonArtifactPath(normalizedPathArg)) {
|
|
5329
|
+
trace.bestCandidatePath = normalizedPathArg;
|
|
5330
|
+
trace.bestCandidateReason = "written by agent during execution";
|
|
5331
|
+
}
|
|
5285
5332
|
if (normalizedBestCandidatePath && normalizedPathArg === normalizedBestCandidatePath) {
|
|
5286
5333
|
trace.bestCandidateWritten = true;
|
|
5287
5334
|
}
|
|
@@ -5291,6 +5338,9 @@ var _AgentsEndpoint = class _AgentsEndpoint {
|
|
|
5291
5338
|
if (verificationResult) {
|
|
5292
5339
|
trace.verificationAttempted = true;
|
|
5293
5340
|
trace.verificationPassed = verificationResult.success;
|
|
5341
|
+
if (verificationResult.blocked) {
|
|
5342
|
+
trace.verificationBlocked = true;
|
|
5343
|
+
}
|
|
5294
5344
|
}
|
|
5295
5345
|
const summarizedResult = verificationResult ? [
|
|
5296
5346
|
verificationResult.command || "verification",
|
|
@@ -5613,6 +5663,7 @@ var _AgentsEndpoint = class _AgentsEndpoint {
|
|
|
5613
5663
|
};
|
|
5614
5664
|
state.workflowVariant = classifiedVariant;
|
|
5615
5665
|
state.isCreationTask = seededResumeState?.isCreationTask ?? state.workflowVariant === "create";
|
|
5666
|
+
state.outputRoot = seededResumeState?.outputRoot ?? (state.isCreationTask ? "public/" : void 0);
|
|
5616
5667
|
this.updateWorkflowPhase(state, this.createEmptyToolTrace(), workflow);
|
|
5617
5668
|
let recordId;
|
|
5618
5669
|
const localToolNames = options.localTools ? Object.keys(options.localTools) : void 0;
|
|
@@ -5685,6 +5736,7 @@ var _AgentsEndpoint = class _AgentsEndpoint {
|
|
|
5685
5736
|
messages,
|
|
5686
5737
|
debugMode: options.debugMode,
|
|
5687
5738
|
model: options.model,
|
|
5739
|
+
...options.reasoning !== void 0 ? { reasoning: options.reasoning } : {},
|
|
5688
5740
|
...options.toolIds?.length ? { tools: { toolIds: options.toolIds } } : {},
|
|
5689
5741
|
...requestContextManagement ? { contextManagement: requestContextManagement } : {}
|
|
5690
5742
|
};
|
|
@@ -5783,6 +5835,7 @@ var _AgentsEndpoint = class _AgentsEndpoint {
|
|
|
5783
5835
|
hadTextOutput: Boolean(sessionResult.result.trim()),
|
|
5784
5836
|
verificationAttempted: sessionTrace.verificationAttempted,
|
|
5785
5837
|
verificationPassed: sessionTrace.verificationPassed,
|
|
5838
|
+
verificationBlocked: sessionTrace.verificationBlocked || void 0,
|
|
5786
5839
|
bestCandidatePath: sessionTrace.bestCandidatePath || void 0,
|
|
5787
5840
|
actionKeys: sessionTrace.actionKeys.slice(-5),
|
|
5788
5841
|
completedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -5823,6 +5876,21 @@ var _AgentsEndpoint = class _AgentsEndpoint {
|
|
|
5823
5876
|
}
|
|
5824
5877
|
if (sessionTrace.verificationAttempted) {
|
|
5825
5878
|
state.lastVerificationPassed = sessionTrace.verificationPassed;
|
|
5879
|
+
if (sessionTrace.verificationBlocked && !sessionTrace.verificationPassed) {
|
|
5880
|
+
state.consecutiveBlockedVerificationSessions = (state.consecutiveBlockedVerificationSessions || 0) + 1;
|
|
5881
|
+
} else {
|
|
5882
|
+
state.consecutiveBlockedVerificationSessions = 0;
|
|
5883
|
+
}
|
|
5884
|
+
}
|
|
5885
|
+
if ((state.consecutiveBlockedVerificationSessions || 0) >= 2 && state.verificationRequired) {
|
|
5886
|
+
state.verificationRequired = false;
|
|
5887
|
+
state.lastVerificationPassed = true;
|
|
5888
|
+
if (!state.planWritten) {
|
|
5889
|
+
state.planWritten = true;
|
|
5890
|
+
}
|
|
5891
|
+
if (!state.bestCandidateVerified) {
|
|
5892
|
+
state.bestCandidateVerified = true;
|
|
5893
|
+
}
|
|
5826
5894
|
}
|
|
5827
5895
|
const modelKey = options.model || "default";
|
|
5828
5896
|
if (!state.costByModel) state.costByModel = {};
|
|
@@ -6401,9 +6469,12 @@ Do NOT redo any of the above work.`
|
|
|
6401
6469
|
const replayHistoryMessages = this.sanitizeReplayHistoryMessages(
|
|
6402
6470
|
continuationContext.previousMessages
|
|
6403
6471
|
);
|
|
6472
|
+
const continuationGuardrail = "IMPORTANT: You are continuing a previously completed task. The conversation above shows your prior work. Do NOT redo any of it. Build on what was already accomplished. If there is nothing new to do, respond with TASK_COMPLETE.";
|
|
6404
6473
|
const defaultContinueMessage = "Continue the task. Review your prior work above and proceed with any remaining work. If everything is already complete, respond with TASK_COMPLETE.";
|
|
6405
6474
|
const userMessage = continuationContext.newUserMessage || defaultContinueMessage;
|
|
6406
6475
|
const userContent = [
|
|
6476
|
+
continuationGuardrail,
|
|
6477
|
+
"",
|
|
6407
6478
|
userMessage,
|
|
6408
6479
|
phaseBlock,
|
|
6409
6480
|
toolsBlock,
|
|
@@ -6414,10 +6485,6 @@ Do NOT redo any of the above work.`
|
|
|
6414
6485
|
].join("\n");
|
|
6415
6486
|
const fullHistoryMessages = [
|
|
6416
6487
|
...replayHistoryMessages,
|
|
6417
|
-
{
|
|
6418
|
-
role: "system",
|
|
6419
|
-
content: "IMPORTANT: You are continuing a previously completed task. The conversation above shows your prior work. Do NOT redo any of it. Build on what was already accomplished. If there is nothing new to do, respond with TASK_COMPLETE."
|
|
6420
|
-
},
|
|
6421
6488
|
{
|
|
6422
6489
|
role: "user",
|
|
6423
6490
|
content: userContent
|