pi-harness-runtime 1.1.77 → 1.1.78
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/package.json +1 -1
- package/packages/a2a-adapter/package.json +1 -1
- package/packages/architecture-generator/package.json +1 -1
- package/packages/auth/package.json +1 -1
- package/packages/autonomous-refactor/package.json +1 -1
- package/packages/autonomous-runtime/package.json +1 -1
- package/packages/cache-strategy/package.json +1 -1
- package/packages/capability-registry/package.json +1 -1
- package/packages/checkpoint/package.json +1 -1
- package/packages/cli-plugin-sdk/package.json +1 -1
- package/packages/clipboard/package.json +1 -1
- package/packages/clipboard-plugin/package.json +1 -1
- package/packages/code-generation/package.json +1 -1
- package/packages/code-review/package.json +1 -1
- package/packages/codex-adapter/package.json +1 -1
- package/packages/config-capture/package.json +1 -1
- package/packages/context-compiler/package.json +1 -1
- package/packages/context-discovery/package.json +1 -1
- package/packages/context-manager/package.json +1 -1
- package/packages/cookie-sanitizer/package.json +1 -1
- package/packages/cost-optimizer/package.json +1 -1
- package/packages/dependency-analyzer/package.json +1 -1
- package/packages/django-plugin/package.json +1 -1
- package/packages/doc-generator/package.json +1 -1
- package/packages/evaluation-engine/package.json +1 -1
- package/packages/evaluation-runner/package.json +1 -1
- package/packages/event-bus/package.json +1 -1
- package/packages/event-store/package.json +1 -1
- package/packages/experience-replay/package.json +1 -1
- package/packages/feedback-collector/package.json +1 -1
- package/packages/file-copy-helper/package.json +1 -1
- package/packages/framework-detector/package.json +1 -1
- package/packages/framework-plugin-sdk/package.json +1 -1
- package/packages/frappe-plugin/package.json +1 -1
- package/packages/generic-web-plugin/package.json +1 -1
- package/packages/health-monitor/package.json +1 -1
- package/packages/intent-analyzer/package.json +1 -1
- package/packages/jev-judge/README.md +61 -0
- package/packages/jev-judge/dist/auto-continue.d.ts +92 -0
- package/packages/jev-judge/dist/auto-continue.d.ts.map +1 -0
- package/packages/jev-judge/dist/auto-continue.js +230 -0
- package/packages/jev-judge/dist/auto-continue.js.map +1 -0
- package/packages/jev-judge/dist/index.d.ts +22 -1
- package/packages/jev-judge/dist/index.d.ts.map +1 -1
- package/packages/jev-judge/dist/index.js +34 -26
- package/packages/jev-judge/dist/index.js.map +1 -1
- package/packages/jev-judge/package.json +1 -1
- package/packages/jev-judge/src/auto-continue.ts +317 -0
- package/packages/jev-judge/src/index.ts +43 -28
- package/packages/knowledge-graph/package.json +1 -1
- package/packages/knowledge-retrieval/package.json +1 -1
- package/packages/laravel-plugin/package.json +1 -1
- package/packages/learning-engine/package.json +1 -1
- package/packages/mcp-adapter/package.json +1 -1
- package/packages/memory-engine/package.json +1 -1
- package/packages/milestone-manager/package.json +1 -1
- package/packages/model-registry/package.json +1 -1
- package/packages/nextjs-plugin/package.json +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/observability/package.json +1 -1
- package/packages/okf-indexer/package.json +1 -1
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/privilege-broker/package.json +1 -1
- package/packages/project-analyzer/package.json +1 -1
- package/packages/project-bootstrap/package.json +1 -1
- package/packages/projection-engine/package.json +1 -1
- package/packages/prompt-compiler/package.json +1 -1
- package/packages/prompt-versioning/package.json +1 -1
- package/packages/provider-adapter-sdk/package.json +1 -1
- package/packages/provider-router/package.json +1 -1
- package/packages/provider-selector/package.json +1 -1
- package/packages/providers/package.json +1 -1
- package/packages/quota-manager/package.json +1 -1
- package/packages/rate-limiter/package.json +1 -1
- package/packages/react-vite-plugin/package.json +1 -1
- package/packages/release-manager/package.json +1 -1
- package/packages/requirement-compiler/package.json +1 -1
- package/packages/runtime/package.json +1 -1
- package/packages/scheduler/package.json +1 -1
- package/packages/scheduler-adapter/package.json +1 -1
- package/packages/session/package.json +1 -1
- package/packages/session-api/package.json +1 -1
- package/packages/session-export/package.json +1 -1
- package/packages/shared-context/package.json +1 -1
- package/packages/skill-mcp-client/package.json +1 -1
- package/packages/skill-registry/package.json +1 -1
- package/packages/sprint-planner/package.json +1 -1
- package/packages/subscription-engine/package.json +1 -1
- package/packages/task-compiler/package.json +1 -1
- package/packages/tencentdb-memory/package.json +1 -1
- package/packages/tencentdb-sync/package.json +1 -1
- package/packages/test-data-generator/package.json +1 -1
- package/packages/test-generator/package.json +1 -1
- package/packages/todo-bd-sync/package.json +1 -1
- package/packages/token-estimation/package.json +1 -1
- package/packages/token-optimizer/package.json +1 -1
- package/packages/trajectory/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/packages/workflow-events/package.json +1 -1
- package/packages/workspace-scanner/package.json +1 -1
- package/packages/worktree/package.json +1 -1
- package/packages/write-review/package.json +1 -1
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-Continue Judge - Agent decision making when user is unavailable
|
|
3
|
+
*
|
|
4
|
+
* Uses Jev to decide whether an agent should continue autonomously
|
|
5
|
+
* when waiting for user input that may not come.
|
|
6
|
+
*
|
|
7
|
+
* Scenario: Agent completes 2/5 tasks, asks "Continue?" User asleep.
|
|
8
|
+
* Jev decides: proceed, wait, or proceed with caution.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { JevJudge } from "./index.js";
|
|
12
|
+
import type { JevJudgeConfig, JevEvaluationResult } from "./types.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Task tracking state
|
|
16
|
+
*/
|
|
17
|
+
export interface TaskState {
|
|
18
|
+
completedTasks: string[];
|
|
19
|
+
remainingTasks: string[];
|
|
20
|
+
totalTasks: number;
|
|
21
|
+
waitTimeMinutes: number;
|
|
22
|
+
userResponded: boolean;
|
|
23
|
+
lastUserActivity?: Date;
|
|
24
|
+
sessionStartTime: Date;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Auto-continue decision
|
|
29
|
+
*/
|
|
30
|
+
export interface AutoContinueDecision {
|
|
31
|
+
action: "proceed" | "wait" | "proceed_with_caution";
|
|
32
|
+
probability: number; // 0-1 confidence to proceed
|
|
33
|
+
riskLevel: "minimal" | "low" | "medium" | "high" | "critical";
|
|
34
|
+
reasoning: string;
|
|
35
|
+
urgency: "critical" | "high" | "normal" | "low";
|
|
36
|
+
estimatedImpact: "minimal" | "moderate" | "significant" | "major";
|
|
37
|
+
confidence: "high" | "medium" | "low";
|
|
38
|
+
waitRecommendation?: number; // minutes to wait if action is "wait"
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Auto-Continue Judge configuration
|
|
43
|
+
*/
|
|
44
|
+
export interface AutoContinueConfig extends JevJudgeConfig {
|
|
45
|
+
/** Minimum probability to auto-proceed (default: 0.7) */
|
|
46
|
+
proceedThreshold?: number;
|
|
47
|
+
/** Minimum probability to proceed with caution (default: 0.5) */
|
|
48
|
+
cautionThreshold?: number;
|
|
49
|
+
/** Maximum wait time before force decision (default: 30 minutes) */
|
|
50
|
+
maxWaitMinutes?: number;
|
|
51
|
+
/** Default action if Jev fails (default: "wait") */
|
|
52
|
+
fallbackAction?: "proceed" | "wait" | "proceed_with_caution";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Default configuration
|
|
57
|
+
*/
|
|
58
|
+
const DEFAULT_CONFIG = {
|
|
59
|
+
proceedThreshold: 0.7,
|
|
60
|
+
cautionThreshold: 0.5,
|
|
61
|
+
maxWaitMinutes: 30,
|
|
62
|
+
fallbackAction: "wait" as const,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Auto-Continue Judge
|
|
67
|
+
*
|
|
68
|
+
* Judges whether an agent should continue autonomously when user is unavailable.
|
|
69
|
+
* Integrates with pi-coding-agent hooks for automatic decision making.
|
|
70
|
+
*/
|
|
71
|
+
export class AutoContinueJudge {
|
|
72
|
+
private jev: JevJudge;
|
|
73
|
+
private config: Required<AutoContinueConfig>;
|
|
74
|
+
|
|
75
|
+
constructor(config: AutoContinueConfig) {
|
|
76
|
+
this.config = {
|
|
77
|
+
...DEFAULT_CONFIG,
|
|
78
|
+
...config,
|
|
79
|
+
} as Required<AutoContinueConfig>;
|
|
80
|
+
|
|
81
|
+
this.jev = new JevJudge(config);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Judge whether to continue or wait
|
|
86
|
+
*/
|
|
87
|
+
async decide(
|
|
88
|
+
taskState: TaskState
|
|
89
|
+
): Promise<AutoContinueDecision> {
|
|
90
|
+
const state = this.buildState(taskState);
|
|
91
|
+
|
|
92
|
+
try {
|
|
93
|
+
const result = await this.jev.evaluate(state, {
|
|
94
|
+
shouldProceed: {
|
|
95
|
+
type: "noul",
|
|
96
|
+
instructions:
|
|
97
|
+
"The agent should continue with remaining tasks without waiting for user confirmation. Consider: task completion %, risk of wrong action, time sensitivity, user unavailability.",
|
|
98
|
+
},
|
|
99
|
+
riskLevel: {
|
|
100
|
+
type: "score",
|
|
101
|
+
instructions: "Risk level if agent proceeds without user confirmation",
|
|
102
|
+
min: 1,
|
|
103
|
+
max: 5,
|
|
104
|
+
},
|
|
105
|
+
urgency: {
|
|
106
|
+
type: "choice",
|
|
107
|
+
instructions: "How urgent are the remaining tasks?",
|
|
108
|
+
options: ["critical", "high", "normal", "low"],
|
|
109
|
+
},
|
|
110
|
+
estimatedImpact: {
|
|
111
|
+
type: "choice",
|
|
112
|
+
instructions: "Impact if the agent makes wrong decision by proceeding",
|
|
113
|
+
options: ["minimal", "moderate", "significant", "major"],
|
|
114
|
+
},
|
|
115
|
+
waitBenefit: {
|
|
116
|
+
type: "noul",
|
|
117
|
+
instructions:
|
|
118
|
+
"Would waiting for user confirmation significantly improve the outcome or prevent a serious mistake?",
|
|
119
|
+
},
|
|
120
|
+
taskComplexity: {
|
|
121
|
+
type: "score",
|
|
122
|
+
instructions:
|
|
123
|
+
"How complex are the remaining tasks compared to completed ones?",
|
|
124
|
+
min: 1,
|
|
125
|
+
max: 5,
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
return this.buildDecision(result, taskState);
|
|
130
|
+
} catch (error) {
|
|
131
|
+
console.error("[AutoContinueJudge] Jev call failed:", error);
|
|
132
|
+
return this.fallbackDecision(taskState);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Quick decision - simple yes/no to proceed
|
|
138
|
+
*/
|
|
139
|
+
async shouldContinue(
|
|
140
|
+
taskState: TaskState
|
|
141
|
+
): Promise<{ shouldContinue: boolean; probability: number; confidence: string }> {
|
|
142
|
+
const result = await this.decide(taskState);
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
shouldContinue: result.action !== "wait",
|
|
146
|
+
probability: result.probability,
|
|
147
|
+
confidence: result.confidence,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Build state for Jev
|
|
153
|
+
*/
|
|
154
|
+
private buildState(taskState: TaskState): string {
|
|
155
|
+
const completionPercent = Math.round(
|
|
156
|
+
(taskState.completedTasks.length / taskState.totalTasks) * 100
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
const state = {
|
|
160
|
+
task_summary: {
|
|
161
|
+
completed: taskState.completedTasks.length,
|
|
162
|
+
remaining: taskState.remainingTasks.length,
|
|
163
|
+
total: taskState.totalTasks,
|
|
164
|
+
completion_percent: completionPercent,
|
|
165
|
+
completed_list: taskState.completedTasks,
|
|
166
|
+
remaining_list: taskState.remainingTasks,
|
|
167
|
+
},
|
|
168
|
+
user_status: {
|
|
169
|
+
responded: taskState.userResponded,
|
|
170
|
+
wait_time_minutes: taskState.waitTimeMinutes,
|
|
171
|
+
last_activity: taskState.lastUserActivity?.toISOString() ?? "unknown",
|
|
172
|
+
session_duration_minutes: Math.round(
|
|
173
|
+
(Date.now() - taskState.sessionStartTime.getTime()) / 60000
|
|
174
|
+
),
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
return JSON.stringify(state, null, 2);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Build decision from Jev result
|
|
183
|
+
*/
|
|
184
|
+
private buildDecision(
|
|
185
|
+
result: JevEvaluationResult,
|
|
186
|
+
_taskState: TaskState
|
|
187
|
+
): AutoContinueDecision {
|
|
188
|
+
const shouldProceed = result.decisions.shouldProceed;
|
|
189
|
+
const probability = shouldProceed.probability ?? 0.5;
|
|
190
|
+
|
|
191
|
+
const riskDecision = result.decisions.riskLevel;
|
|
192
|
+
const riskScore = (riskDecision?.response as { score: number })?.score ?? 3;
|
|
193
|
+
const riskLevel = this.scoreToRiskLevel(riskScore);
|
|
194
|
+
|
|
195
|
+
const urgencyDecision = result.decisions.urgency as {
|
|
196
|
+
response: { choice: string };
|
|
197
|
+
};
|
|
198
|
+
const urgency = (urgencyDecision?.response?.choice as AutoContinueDecision["urgency"]) ?? "normal";
|
|
199
|
+
|
|
200
|
+
const impactDecision = result.decisions.estimatedImpact as {
|
|
201
|
+
response: { choice: string };
|
|
202
|
+
};
|
|
203
|
+
const estimatedImpact = (impactDecision?.response?.choice as AutoContinueDecision["estimatedImpact"]) ?? "moderate";
|
|
204
|
+
|
|
205
|
+
const waitBenefit = (result.decisions.waitBenefit?.response as { noul: number })?.noul ?? 0.5;
|
|
206
|
+
|
|
207
|
+
// Determine action based on thresholds
|
|
208
|
+
let action: AutoContinueDecision["action"];
|
|
209
|
+
let confidence: AutoContinueDecision["confidence"];
|
|
210
|
+
let reasoning: string;
|
|
211
|
+
|
|
212
|
+
if (probability >= this.config.proceedThreshold) {
|
|
213
|
+
action = "proceed";
|
|
214
|
+
confidence = probability > 0.85 ? "high" : "medium";
|
|
215
|
+
reasoning = `High confidence to proceed (${(probability * 100).toFixed(0)}%)`;
|
|
216
|
+
} else if (probability >= this.config.cautionThreshold && riskScore <= 3) {
|
|
217
|
+
action = "proceed_with_caution";
|
|
218
|
+
confidence = "medium";
|
|
219
|
+
reasoning = `Proceed with caution (${(probability * 100).toFixed(0)}%), risk level ${riskScore}/5`;
|
|
220
|
+
} else if (waitBenefit < 0.3 && riskScore <= 2) {
|
|
221
|
+
action = "proceed_with_caution";
|
|
222
|
+
confidence = "low";
|
|
223
|
+
reasoning = `Low wait benefit, proceeding despite lower confidence`;
|
|
224
|
+
} else {
|
|
225
|
+
action = "wait";
|
|
226
|
+
confidence = "high";
|
|
227
|
+
reasoning = `Waiting recommended (${((1 - probability) * 100).toFixed(0)}% confidence to wait)`;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Calculate recommended wait time
|
|
231
|
+
let waitRecommendation: number | undefined;
|
|
232
|
+
if (action === "wait") {
|
|
233
|
+
waitRecommendation = Math.min(
|
|
234
|
+
this.config.maxWaitMinutes,
|
|
235
|
+
Math.round(this.config.maxWaitMinutes * (1 - probability))
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return {
|
|
240
|
+
action,
|
|
241
|
+
probability,
|
|
242
|
+
riskLevel,
|
|
243
|
+
reasoning,
|
|
244
|
+
urgency,
|
|
245
|
+
estimatedImpact,
|
|
246
|
+
confidence,
|
|
247
|
+
waitRecommendation,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Convert score to risk level
|
|
253
|
+
*/
|
|
254
|
+
private scoreToRiskLevel(score: number): AutoContinueDecision["riskLevel"] {
|
|
255
|
+
if (score <= 1.5) return "minimal";
|
|
256
|
+
if (score <= 2.5) return "low";
|
|
257
|
+
if (score <= 3.5) return "medium";
|
|
258
|
+
if (score <= 4.5) return "high";
|
|
259
|
+
return "critical";
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Fallback decision when Jev fails
|
|
264
|
+
*/
|
|
265
|
+
private fallbackDecision(taskState: TaskState): AutoContinueDecision {
|
|
266
|
+
const completionPercent = taskState.completedTasks.length / taskState.totalTasks;
|
|
267
|
+
|
|
268
|
+
// If >80% done and waited >15 min, proceed with caution
|
|
269
|
+
if (completionPercent >= 0.8 && taskState.waitTimeMinutes >= 15) {
|
|
270
|
+
return {
|
|
271
|
+
action: "proceed_with_caution",
|
|
272
|
+
probability: 0.6,
|
|
273
|
+
riskLevel: "medium",
|
|
274
|
+
reasoning: "Fallback: high completion, waited long time",
|
|
275
|
+
urgency: "normal",
|
|
276
|
+
estimatedImpact: "moderate",
|
|
277
|
+
confidence: "low",
|
|
278
|
+
waitRecommendation: 10,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return {
|
|
283
|
+
action: this.config.fallbackAction,
|
|
284
|
+
probability: 0.5,
|
|
285
|
+
riskLevel: "medium",
|
|
286
|
+
reasoning: "Fallback: Jev unavailable, using default behavior",
|
|
287
|
+
urgency: "normal",
|
|
288
|
+
estimatedImpact: "moderate",
|
|
289
|
+
confidence: "low",
|
|
290
|
+
waitRecommendation: this.config.maxWaitMinutes,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Helper: Create task state from todo list
|
|
297
|
+
*/
|
|
298
|
+
export function createTaskState(
|
|
299
|
+
completedTasks: string[],
|
|
300
|
+
remainingTasks: string[],
|
|
301
|
+
lastUserActivity?: Date,
|
|
302
|
+
sessionStartTime?: Date
|
|
303
|
+
): TaskState {
|
|
304
|
+
const totalTasks = completedTasks.length + remainingTasks.length;
|
|
305
|
+
|
|
306
|
+
return {
|
|
307
|
+
completedTasks,
|
|
308
|
+
remainingTasks,
|
|
309
|
+
totalTasks,
|
|
310
|
+
waitTimeMinutes: lastUserActivity
|
|
311
|
+
? Math.round((Date.now() - lastUserActivity.getTime()) / 60000)
|
|
312
|
+
: 0,
|
|
313
|
+
userResponded: false,
|
|
314
|
+
lastUserActivity,
|
|
315
|
+
sessionStartTime: sessionStartTime ?? new Date(),
|
|
316
|
+
};
|
|
317
|
+
}
|
|
@@ -44,6 +44,45 @@ import type {
|
|
|
44
44
|
// @ts-ignore - openai is installed at workspace root
|
|
45
45
|
import OpenAI from "openai";
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Environment variable keys for API keys
|
|
49
|
+
*/
|
|
50
|
+
export const ENV_KEYS = {
|
|
51
|
+
TYPESAFE_API_KEY: "TYPESAFE_API_KEY",
|
|
52
|
+
OPENROUTER_API_KEY: "OPENROUTER_API_KEY",
|
|
53
|
+
} as const;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Get API key from environment
|
|
57
|
+
* Priority: TYPESAFE_API_KEY > OPENROUTER_API_KEY
|
|
58
|
+
*/
|
|
59
|
+
export function getApiKeyFromEnv(): string | undefined {
|
|
60
|
+
return (
|
|
61
|
+
process.env[ENV_KEYS.TYPESAFE_API_KEY] ||
|
|
62
|
+
process.env[ENV_KEYS.OPENROUTER_API_KEY]
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Check if Jev API key is available
|
|
68
|
+
*/
|
|
69
|
+
export function hasJevApiKey(): boolean {
|
|
70
|
+
return !!getApiKeyFromEnv();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Create JevJudge with auto-detected API key from environment
|
|
75
|
+
*/
|
|
76
|
+
export function createJevJudge(config?: Partial<JevJudgeConfig>): JevJudge {
|
|
77
|
+
const apiKey = getApiKeyFromEnv();
|
|
78
|
+
if (!apiKey) {
|
|
79
|
+
throw new Error(
|
|
80
|
+
`Jev API key not found. Set ${ENV_KEYS.TYPESAFE_API_KEY} or ${ENV_KEYS.OPENROUTER_API_KEY} in environment.`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
return new JevJudge({ apiKey, ...config });
|
|
84
|
+
}
|
|
85
|
+
|
|
47
86
|
/**
|
|
48
87
|
* Default configuration
|
|
49
88
|
*/
|
|
@@ -131,7 +170,6 @@ Respond with a JSON object mapping each question ID to its answer.`,
|
|
|
131
170
|
],
|
|
132
171
|
response_format: {
|
|
133
172
|
type: "json_object",
|
|
134
|
-
schema: this.buildResponseSchema(questions),
|
|
135
173
|
},
|
|
136
174
|
temperature: 0.1, // Low temperature for consistent decisions
|
|
137
175
|
});
|
|
@@ -263,33 +301,8 @@ Respond with a JSON object mapping each question ID to its answer.`,
|
|
|
263
301
|
|
|
264
302
|
// Private helpers
|
|
265
303
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
for (const [id, question] of Object.entries(questions)) {
|
|
270
|
-
switch ((question as JevQuestion).type) {
|
|
271
|
-
case "noul":
|
|
272
|
-
schema[id] = { type: "object", properties: {
|
|
273
|
-
noul: { type: "number", minimum: 0, maximum: 1 }
|
|
274
|
-
}, required: ["noul"] };
|
|
275
|
-
break;
|
|
276
|
-
case "choice":
|
|
277
|
-
schema[id] = { type: "object", properties: {
|
|
278
|
-
choice: { type: "string", enum: (question as { options: string[] }).options },
|
|
279
|
-
confidence: { type: "number", minimum: 0, maximum: 1 }
|
|
280
|
-
}, required: ["choice"] };
|
|
281
|
-
break;
|
|
282
|
-
case "score":
|
|
283
|
-
schema[id] = { type: "object", properties: {
|
|
284
|
-
score: { type: "number" },
|
|
285
|
-
confidence: { type: "number", minimum: 0, maximum: 1 }
|
|
286
|
-
}, required: ["score"] };
|
|
287
|
-
break;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
return { type: "object", properties: schema, additionalProperties: false };
|
|
292
|
-
}
|
|
304
|
+
// Note: Response schema removed - using json_object mode without strict schema
|
|
305
|
+
// This allows Jev to return flexible responses
|
|
293
306
|
|
|
294
307
|
private buildDecision<T extends string>(
|
|
295
308
|
questionId: T,
|
|
@@ -343,3 +356,5 @@ export * from "./types.js";
|
|
|
343
356
|
export { E2EJudge } from "./e2e-judge.js";
|
|
344
357
|
export { FlakyDetector } from "./flaky-detector.js";
|
|
345
358
|
export { DecisionEngine } from "./decision-engine.js";
|
|
359
|
+
export { AutoContinueJudge, createTaskState } from "./auto-continue.js";
|
|
360
|
+
export type { TaskState, AutoContinueDecision, AutoContinueConfig } from "./auto-continue.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-harness/provider-router",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.78",
|
|
4
4
|
"description": "Enhanced Provider Router for pi-harness-runtime — intelligent routing with capabilities, costs, and quotas",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/provider-router.js",
|