pi-harness-runtime 1.1.448 → 1.1.450
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/AGENTS.md +24 -3
- package/CHANGELOG.md +38 -0
- package/README.md +30 -0
- package/harness/key-file-audit.ts +252 -42
- package/harness/startup-report.ts +32 -7
- package/index.ts +142 -22
- package/package.json +1 -1
- package/packages/agent-policy/package.json +1 -1
- package/packages/auth/package.json +1 -1
- package/packages/autonomous-runtime/package.json +1 -1
- package/packages/checkpoint/package.json +1 -1
- package/packages/clipboard/package.json +1 -1
- package/packages/codex-watcher/package.json +1 -1
- package/packages/config-capture/package.json +1 -1
- package/packages/contracts/package.json +1 -1
- package/packages/cookie-sanitizer/package.json +1 -1
- package/packages/evaluation-engine/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/file-copy-helper/package.json +1 -1
- package/packages/intent-analyzer/package.json +1 -1
- package/packages/jev-judge/dist/auto-continue.d.ts +39 -1
- package/packages/jev-judge/dist/auto-continue.d.ts.map +1 -1
- package/packages/jev-judge/dist/auto-continue.js +91 -3
- package/packages/jev-judge/dist/auto-continue.js.map +1 -1
- package/packages/jev-judge/dist/autonomy-instruction.d.ts +52 -0
- package/packages/jev-judge/dist/autonomy-instruction.d.ts.map +1 -0
- package/packages/jev-judge/dist/autonomy-instruction.js +92 -0
- package/packages/jev-judge/dist/autonomy-instruction.js.map +1 -0
- package/packages/jev-judge/dist/index.d.ts +3 -1
- package/packages/jev-judge/dist/index.d.ts.map +1 -1
- package/packages/jev-judge/dist/index.js +2 -0
- package/packages/jev-judge/dist/index.js.map +1 -1
- package/packages/jev-judge/dist/question-risk.d.ts +8 -0
- package/packages/jev-judge/dist/question-risk.d.ts.map +1 -1
- package/packages/jev-judge/dist/question-risk.js +7 -0
- package/packages/jev-judge/dist/question-risk.js.map +1 -1
- package/packages/jev-judge/package.json +1 -1
- package/packages/jev-judge/src/auto-continue.ts +134 -5
- package/packages/jev-judge/src/autonomy-instruction.ts +140 -0
- package/packages/jev-judge/src/index.ts +16 -1
- package/packages/jev-judge/src/question-risk.ts +16 -0
- package/packages/knowledge-retrieval/package.json +1 -1
- package/packages/learning-engine/package.json +1 -1
- package/packages/logging/package.json +1 -1
- package/packages/memory-engine/package.json +1 -1
- package/packages/notification/dist/pending-question.d.ts +114 -3
- package/packages/notification/dist/pending-question.d.ts.map +1 -1
- package/packages/notification/dist/pending-question.js +277 -12
- package/packages/notification/dist/pending-question.js.map +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/notification/src/pending-question.ts +389 -11
- package/packages/paperclip-integration/package.json +1 -1
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/privilege-broker/package.json +1 -1
- package/packages/prompt-compiler/package.json +1 -1
- package/packages/providers/package.json +1 -1
- package/packages/qdrant-skills/package.json +1 -1
- package/packages/quota-manager/package.json +1 -1
- package/packages/relay/package.json +1 -1
- package/packages/skill-mcp-client/package.json +1 -1
- package/packages/skills/package.json +1 -1
- package/packages/todo-bd-sync/package.json +1 -1
- package/packages/token-estimation/package.json +1 -1
- package/packages/tooling-preference/package.json +1 -1
- package/packages/trajectory/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/two-phase-review/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/packages/webmcp-tester/package.json +1 -1
- package/packages/wiki/package.json +1 -1
- package/packages/write-review/package.json +1 -1
package/index.ts
CHANGED
|
@@ -23,8 +23,8 @@ import { HarnessStartupStatus, harnessStatusMarker, type HarnessStatus } from ".
|
|
|
23
23
|
import {
|
|
24
24
|
auditKeyFiles,
|
|
25
25
|
fallbackKeyFileFixes,
|
|
26
|
-
formatExposedKeyFileFixes,
|
|
27
26
|
formatKeyFileFixes,
|
|
27
|
+
formatKeyPermissionFixes,
|
|
28
28
|
selectKeyFileFixes,
|
|
29
29
|
type KeyFileAuditResult,
|
|
30
30
|
} from "./harness/key-file-audit.ts";
|
|
@@ -206,14 +206,19 @@ function getKeyFileAudit(): KeyFileAuditResult | null {
|
|
|
206
206
|
* that the group or the others can read works perfectly - and is published
|
|
207
207
|
* to every account on the machine. No other line notices, so this is the
|
|
208
208
|
* only place where the fact can surface.
|
|
209
|
+
*
|
|
210
|
+
* The line shows ONE command for the whole key tree: one command per file
|
|
211
|
+
* is a list nobody runs. The command is never executed here.
|
|
209
212
|
*/
|
|
210
213
|
function reportExposedKeyFiles(): void {
|
|
211
214
|
const audit = getKeyFileAudit();
|
|
212
215
|
const exposed = audit?.exposed ?? [];
|
|
213
|
-
|
|
216
|
+
const exposedDirectories = audit?.exposedDirectories ?? [];
|
|
217
|
+
if (exposed.length === 0 && exposedDirectories.length === 0) return;
|
|
214
218
|
const report = exposedKeyFilesReport({
|
|
215
219
|
exposed,
|
|
216
|
-
|
|
220
|
+
exposedDirectories,
|
|
221
|
+
fixes: formatKeyPermissionFixes({ keysDir: harnessKeysDir() }),
|
|
217
222
|
});
|
|
218
223
|
if (!report) return;
|
|
219
224
|
addHarnessMessage(report.label, report.text, report.status, report.details);
|
|
@@ -287,6 +292,7 @@ function applyChannelApproval(
|
|
|
287
292
|
}
|
|
288
293
|
|
|
289
294
|
logToFile("[Approval]", `${channel} decision '${action}' applied to ${requestId}`);
|
|
295
|
+
logQuestionTransition(requestId, "answered", `${channel}:${action}`);
|
|
290
296
|
|
|
291
297
|
// The question is answered, so the wait is over. The wait state is only
|
|
292
298
|
// cleared after a successful resolution.
|
|
@@ -317,6 +323,25 @@ function waitBelongsToRequest(requestId: string | undefined): boolean {
|
|
|
317
323
|
return active === requestId;
|
|
318
324
|
}
|
|
319
325
|
|
|
326
|
+
/**
|
|
327
|
+
* Log a state transition of a pending question.
|
|
328
|
+
*
|
|
329
|
+
* The transitions make the decision observable: "no action yet" has to be
|
|
330
|
+
* distinguishable from a stuck timer. Only the request ID and a safe
|
|
331
|
+
* reason code are logged - never the question itself.
|
|
332
|
+
*/
|
|
333
|
+
function logQuestionTransition(
|
|
334
|
+
requestId: string | undefined,
|
|
335
|
+
state: string,
|
|
336
|
+
reason?: string,
|
|
337
|
+
): void {
|
|
338
|
+
if (!requestId) return;
|
|
339
|
+
logToFile(
|
|
340
|
+
"[PendingQuestion]",
|
|
341
|
+
`${requestId} ${state}${reason ? ` (${reason})` : ""}`,
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
|
|
320
345
|
// --- tooling-preference: the Biome proposal ---------------------------------
|
|
321
346
|
//
|
|
322
347
|
// The proposal ("use Biome.js instead of ESLint and Prettier") is a decision
|
|
@@ -695,9 +720,12 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
695
720
|
const keysDir = `${home}/.pi-harness-runtime/keys`;
|
|
696
721
|
const { existsSync, mkdirSync } = await import("fs");
|
|
697
722
|
|
|
698
|
-
// Auto-create directory if doesn't exist
|
|
723
|
+
// Auto-create directory if doesn't exist. The directory holds
|
|
724
|
+
// secrets, so it is created private: the mode of a new directory
|
|
725
|
+
// depends on the umask of the shell, and a world readable key
|
|
726
|
+
// directory publishes the name of every key on the machine.
|
|
699
727
|
if (!existsSync(keysDir)) {
|
|
700
|
-
mkdirSync(keysDir, { recursive: true });
|
|
728
|
+
mkdirSync(keysDir, { recursive: true, mode: 0o700 });
|
|
701
729
|
}
|
|
702
730
|
|
|
703
731
|
// Resolve the provider chain. Every credential stays bound to its own
|
|
@@ -737,6 +765,9 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
737
765
|
// JavaScript, so importing "src/auto-continue.js" would depend on
|
|
738
766
|
// build artifacts that are not part of the package.
|
|
739
767
|
const mod = await import("./packages/jev-judge/dist/auto-continue.js");
|
|
768
|
+
// The instruction of an autonomous decision: it names the selected
|
|
769
|
+
// option, the scope and the reasoning of the decision.
|
|
770
|
+
const autonomy = await import("./packages/jev-judge/dist/autonomy-instruction.js");
|
|
740
771
|
|
|
741
772
|
// Track waiting state
|
|
742
773
|
let waitingForUserSince: Date | null = null;
|
|
@@ -818,6 +849,24 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
818
849
|
}
|
|
819
850
|
_currentAutoContinueState = "";
|
|
820
851
|
|
|
852
|
+
// A restart does not survive in memory: the wait state and the
|
|
853
|
+
// pending question are gone with the process. The question is
|
|
854
|
+
// therefore closed explicitly, so the buttons of that request
|
|
855
|
+
// do not stay open and look like a request that is still
|
|
856
|
+
// waiting.
|
|
857
|
+
const pending = sharedState.pqController?.getCurrentQuestion?.();
|
|
858
|
+
if (pending && pending.state === "pending") {
|
|
859
|
+
const expired = sharedState.pqController?.expireByTimeout?.(
|
|
860
|
+
pending.requestId,
|
|
861
|
+
"session-ended",
|
|
862
|
+
) === true;
|
|
863
|
+
logQuestionTransition(
|
|
864
|
+
pending.requestId,
|
|
865
|
+
expired ? "expired" : "closed",
|
|
866
|
+
"session-ended",
|
|
867
|
+
);
|
|
868
|
+
}
|
|
869
|
+
|
|
821
870
|
// Reset state
|
|
822
871
|
waitingForUserSince = null;
|
|
823
872
|
_lastNotifiedQuestion = "";
|
|
@@ -844,6 +893,7 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
844
893
|
// Set up pending question callback to dispatch answers to Pi
|
|
845
894
|
pqController.onUserAnswer((question, answer) => {
|
|
846
895
|
logToFile("[PendingQuestion]", `User answered: ${answer} for question ${question.requestId}`);
|
|
896
|
+
logQuestionTransition(question.requestId, "answered", answer);
|
|
847
897
|
// The question is answered, so the wait is over. The wait state
|
|
848
898
|
// is cleared here, after a successful resolution: a stale click
|
|
849
899
|
// must never clear a valid pending wait.
|
|
@@ -874,7 +924,10 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
874
924
|
_completedNotifiedFor = null;
|
|
875
925
|
}
|
|
876
926
|
|
|
877
|
-
|
|
927
|
+
// The complete message is the context of the question: the
|
|
928
|
+
// sentence that carries the question often leaves out what the
|
|
929
|
+
// agent is really waiting for ("I need your OK before ...").
|
|
930
|
+
const result = pqController.detectQuestion(content, { contextText: content });
|
|
878
931
|
|
|
879
932
|
// Only trigger if: we found a question AND it's different from last notification
|
|
880
933
|
// Skip routine continuation questions - let Jev/todo controller decide
|
|
@@ -888,17 +941,23 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
888
941
|
// Create question in controller
|
|
889
942
|
const questionKind = result.kind || "approval";
|
|
890
943
|
// The risk facts of the proposed action are derived from the
|
|
891
|
-
//
|
|
892
|
-
//
|
|
944
|
+
// whole message, not from the question sentence alone: the
|
|
945
|
+
// sentence often leaves out what the agent is really waiting
|
|
946
|
+
// for. They are recorded with the request: the autonomous
|
|
947
|
+
// decision is only as safe as these facts.
|
|
893
948
|
const riskFacts = classifyQuestionRisk({
|
|
894
949
|
kind: questionKind,
|
|
895
|
-
|
|
950
|
+
askType: result.askType,
|
|
951
|
+
text: result.contextText || result.questionText,
|
|
896
952
|
});
|
|
897
953
|
const question = pqController.createQuestion({
|
|
898
954
|
text: result.questionText,
|
|
899
955
|
sessionId: _sessionId,
|
|
900
956
|
workspacePath: _piSessionCwd || "/",
|
|
901
957
|
kind: questionKind,
|
|
958
|
+
askType: result.askType,
|
|
959
|
+
alternatives: result.alternatives,
|
|
960
|
+
contextText: result.contextText,
|
|
902
961
|
risk: {
|
|
903
962
|
requiresExplicitAuthorization: riskFacts.requiresExplicitAuthorization,
|
|
904
963
|
destructive: riskFacts.destructive,
|
|
@@ -909,6 +968,7 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
909
968
|
});
|
|
910
969
|
|
|
911
970
|
logToFile("[PendingQuestion]", `Question created: ${question.requestId} - ${result.questionText?.slice(0, 50)}`);
|
|
971
|
+
logQuestionTransition(question.requestId, "detected", result.askType ?? questionKind);
|
|
912
972
|
|
|
913
973
|
_lastNotifiedQuestion = result.questionText;
|
|
914
974
|
waitingForUserSince = new Date();
|
|
@@ -933,15 +993,21 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
933
993
|
// Yes/No actions. The canonical request ID is the correlation
|
|
934
994
|
// key of the callback: a prefixed jobId would never match the
|
|
935
995
|
// pending question and every click would be reported stale.
|
|
996
|
+
// A choice question shows its alternatives: the human has to
|
|
997
|
+
// see what the agent is choosing between.
|
|
998
|
+
const requirement = result.alternatives && result.alternatives.length >= 2
|
|
999
|
+
? `${result.questionText}\n\nOptions:\n${result.alternatives.map((alternative, index) => `${index + 1}. ${alternative}`).join("\n")}`
|
|
1000
|
+
: result.questionText;
|
|
936
1001
|
_nc?.notifyWithApproval("WaitingForUserInput", {
|
|
937
1002
|
jobId: questionJobId,
|
|
938
1003
|
questionId: questionJobId,
|
|
939
1004
|
questionKind: question.kind,
|
|
940
|
-
requirement
|
|
1005
|
+
requirement,
|
|
941
1006
|
}, {
|
|
942
1007
|
approveLabel: "Continue",
|
|
943
1008
|
rejectLabel: "Not yet",
|
|
944
1009
|
}).catch((e) => logToFile("[Notification]", "notifyWithApproval failed:", String(e)));
|
|
1010
|
+
logQuestionTransition(questionJobId, "notified", "waiting-for-user");
|
|
945
1011
|
|
|
946
1012
|
// Also send context info as a follow-up message (not in error field)
|
|
947
1013
|
_nc?.notify("Info", {
|
|
@@ -1176,7 +1242,9 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
1176
1242
|
}
|
|
1177
1243
|
: classifyQuestionRisk({
|
|
1178
1244
|
kind: pendingQuestion.kind,
|
|
1179
|
-
|
|
1245
|
+
askType: pendingQuestion.askType,
|
|
1246
|
+
text:
|
|
1247
|
+
pendingQuestion.contextText ?? pendingQuestion.questionText,
|
|
1180
1248
|
})
|
|
1181
1249
|
: undefined;
|
|
1182
1250
|
const questionContext = pendingQuestion
|
|
@@ -1184,6 +1252,9 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
1184
1252
|
requestId: pendingQuestion.requestId,
|
|
1185
1253
|
text: pendingQuestion.questionText,
|
|
1186
1254
|
kind: pendingQuestion.kind,
|
|
1255
|
+
askType: pendingQuestion.askType,
|
|
1256
|
+
alternatives: pendingQuestion.alternatives,
|
|
1257
|
+
contextText: pendingQuestion.contextText,
|
|
1187
1258
|
requiresExplicitAuthorization: riskFacts?.requiresExplicitAuthorization,
|
|
1188
1259
|
destructive: riskFacts?.destructive,
|
|
1189
1260
|
external: riskFacts?.external,
|
|
@@ -1219,7 +1290,10 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
1219
1290
|
decisionContext,
|
|
1220
1291
|
);
|
|
1221
1292
|
|
|
1293
|
+
logQuestionTransition(questionContext?.requestId, "eligible", `waited ${Math.round(waitMinutes)}m`);
|
|
1294
|
+
|
|
1222
1295
|
const decision = await judge.decide(taskState);
|
|
1296
|
+
logQuestionTransition(questionContext?.requestId, "jev-outcome", decision.outcome ?? decision.action);
|
|
1223
1297
|
|
|
1224
1298
|
// Check session validity and user response before applying
|
|
1225
1299
|
if (checkSessionId !== _sessionId) {
|
|
@@ -1266,9 +1340,37 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
1266
1340
|
"[auto-continue]",
|
|
1267
1341
|
`Jev decided to wait (${Math.round(waitMinutes)}m waited, deadline ${MAX_WAIT_MINUTES}m)`,
|
|
1268
1342
|
);
|
|
1343
|
+
logQuestionTransition(
|
|
1344
|
+
questionContext?.requestId,
|
|
1345
|
+
"wait",
|
|
1346
|
+
decision.policyApplied ?? "retry",
|
|
1347
|
+
);
|
|
1269
1348
|
if (waitMinutes >= MAX_WAIT_MINUTES) {
|
|
1270
1349
|
logToFile("[auto-continue]", "Decision deadline reached - pausing the work");
|
|
1350
|
+
// The deadline is a terminal path: the pending question
|
|
1351
|
+
// is closed, so the notification does not stay open
|
|
1352
|
+
// with nobody waiting for it any more.
|
|
1353
|
+
const expired = questionContext?.requestId
|
|
1354
|
+
? sharedState.pqController?.expireByTimeout?.(
|
|
1355
|
+
questionContext.requestId,
|
|
1356
|
+
"deadline-expired",
|
|
1357
|
+
) === true
|
|
1358
|
+
: false;
|
|
1359
|
+
logQuestionTransition(
|
|
1360
|
+
questionContext?.requestId,
|
|
1361
|
+
expired ? "expired" : "deadline",
|
|
1362
|
+
"deadline-expired",
|
|
1363
|
+
);
|
|
1271
1364
|
(sharedState.todoContinuationController as any)?.explicitPause?.();
|
|
1365
|
+
if (questionContext?.requestId) {
|
|
1366
|
+
_nc?.notify("Info", {
|
|
1367
|
+
jobId: `expired-${questionContext.requestId}`,
|
|
1368
|
+
requirement:
|
|
1369
|
+
"The request expired: no answer was received before the decision deadline. The work is paused until you answer.",
|
|
1370
|
+
}).catch((e) =>
|
|
1371
|
+
logToFile("[Notification]", "Expiry notification failed:", String(e)),
|
|
1372
|
+
);
|
|
1373
|
+
}
|
|
1272
1374
|
// The deadline belongs to the captured question: a newer
|
|
1273
1375
|
// question keeps its own wait state.
|
|
1274
1376
|
if (waitBelongsToRequest(questionContext?.requestId)) {
|
|
@@ -1276,6 +1378,13 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
1276
1378
|
sharedState.waitingForUserSince = null;
|
|
1277
1379
|
updateAutoContinueStatus("IDLE");
|
|
1278
1380
|
}
|
|
1381
|
+
} else {
|
|
1382
|
+
// The request stays open: the next poll asks again
|
|
1383
|
+
// until the deadline closes it.
|
|
1384
|
+
updateAutoContinueStatus(
|
|
1385
|
+
"WAITING",
|
|
1386
|
+
questionContext?.requestId.slice(0, 8),
|
|
1387
|
+
);
|
|
1279
1388
|
}
|
|
1280
1389
|
} else {
|
|
1281
1390
|
// Close the question with the Jev decision. The buttons of
|
|
@@ -1291,6 +1400,11 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
1291
1400
|
questionContext.requestId,
|
|
1292
1401
|
outcome,
|
|
1293
1402
|
decision.reasoning,
|
|
1403
|
+
{
|
|
1404
|
+
selectedOption: decision.selectedOption,
|
|
1405
|
+
scope: decision.scope,
|
|
1406
|
+
reasoning: decision.reasoning,
|
|
1407
|
+
},
|
|
1294
1408
|
) === true
|
|
1295
1409
|
: false;
|
|
1296
1410
|
const application = mod.decideOutcomeApplication(outcome, closed);
|
|
@@ -1339,21 +1453,27 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
1339
1453
|
"[auto-continue]",
|
|
1340
1454
|
`Question ${questionContext?.requestId} closed by Jev (${outcome})`,
|
|
1341
1455
|
);
|
|
1456
|
+
logQuestionTransition(questionContext?.requestId, "applied", outcome);
|
|
1342
1457
|
|
|
1343
1458
|
// Update status to continuing
|
|
1344
1459
|
updateAutoContinueStatus("CONTINUING", questionHash);
|
|
1345
1460
|
|
|
1346
|
-
//
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1461
|
+
// The steer names the selected option, the scope and the
|
|
1462
|
+
// reasoning of the decision. A bare "continue with the
|
|
1463
|
+
// remaining tasks" does not answer the question the
|
|
1464
|
+
// agent asked, and it would pretend that the user
|
|
1465
|
+
// answered.
|
|
1466
|
+
const instruction = autonomy.buildAutonomyInstruction({
|
|
1467
|
+
outcome,
|
|
1468
|
+
questionText: questionContext?.text,
|
|
1469
|
+
selectedOption: decision.selectedOption,
|
|
1470
|
+
scope: decision.scope,
|
|
1471
|
+
reasoning: decision.reasoning,
|
|
1472
|
+
riskLevel: decision.riskLevel,
|
|
1473
|
+
waitedMinutes: Math.round(waitMinutes),
|
|
1474
|
+
deadlineMinutes: MAX_WAIT_MINUTES,
|
|
1475
|
+
});
|
|
1476
|
+
pi.sendUserMessage(instruction, { deliverAs: "steer" });
|
|
1357
1477
|
waitingForUserSince = null;
|
|
1358
1478
|
sharedState.waitingForUserSince = null;
|
|
1359
1479
|
_lastNotifiedQuestion = "";
|
package/package.json
CHANGED
|
@@ -29,6 +29,15 @@ export interface TaskState {
|
|
|
29
29
|
* never reported as a user "yes".
|
|
30
30
|
*/
|
|
31
31
|
export type DecisionOutcome = "approve" | "reject" | "wait" | "proceed_with_caution";
|
|
32
|
+
/**
|
|
33
|
+
* The scope of an autonomous decision.
|
|
34
|
+
*
|
|
35
|
+
* A large or expensive job is not done in one step: the decision may limit
|
|
36
|
+
* itself to a canary that is verified before the work scales up. The type
|
|
37
|
+
* mirrors the one of the notification package - the scope travels from the
|
|
38
|
+
* decision to the pending question.
|
|
39
|
+
*/
|
|
40
|
+
export type DecisionScope = "full_scope" | "canary_first" | "none";
|
|
32
41
|
/**
|
|
33
42
|
* The pending question Jev has to decide about.
|
|
34
43
|
*
|
|
@@ -41,7 +50,13 @@ export interface PendingQuestionContext {
|
|
|
41
50
|
/** The complete question text. */
|
|
42
51
|
text: string;
|
|
43
52
|
/** The detected kind of the question. */
|
|
44
|
-
kind: "routine" | "approval" | "clarification" | "explicit";
|
|
53
|
+
kind: "routine" | "approval" | "choice" | "clarification" | "explicit";
|
|
54
|
+
/** The typed ask of the question. */
|
|
55
|
+
askType?: "approval" | "choice" | "clarification" | "explicit_authorization" | "routine";
|
|
56
|
+
/** The concrete alternatives of a choice question. */
|
|
57
|
+
alternatives?: string[];
|
|
58
|
+
/** The complete assistant message the question was detected in. */
|
|
59
|
+
contextText?: string;
|
|
45
60
|
/** The exact action the agent proposes. */
|
|
46
61
|
proposedAction?: string;
|
|
47
62
|
/** What happens when the question is approved. */
|
|
@@ -108,6 +123,10 @@ export interface DecisionPolicyOptions {
|
|
|
108
123
|
cautionThreshold?: number;
|
|
109
124
|
/** The confidence of the proposed outcome. */
|
|
110
125
|
confidence?: number;
|
|
126
|
+
/** The option the evaluation selected for a choice question. */
|
|
127
|
+
selectedOption?: string;
|
|
128
|
+
/** The scope the evaluation selected. */
|
|
129
|
+
scope?: DecisionScope;
|
|
111
130
|
}
|
|
112
131
|
/** The confidence an autonomous approval needs by default. */
|
|
113
132
|
export declare const DEFAULT_PROCEED_THRESHOLD = 0.7;
|
|
@@ -120,6 +139,21 @@ export declare const DEFAULT_CAUTION_THRESHOLD = 0.5;
|
|
|
120
139
|
* value is ignored instead of being guessed.
|
|
121
140
|
*/
|
|
122
141
|
export declare function isDecisionOutcome(value: unknown): value is DecisionOutcome;
|
|
142
|
+
/**
|
|
143
|
+
* Is the value a known scope?
|
|
144
|
+
*
|
|
145
|
+
* An unknown scope is ignored instead of being guessed: a decision without
|
|
146
|
+
* a scope keeps the default scope of the outcome.
|
|
147
|
+
*/
|
|
148
|
+
export declare function isDecisionScope(value: unknown): value is DecisionScope;
|
|
149
|
+
/**
|
|
150
|
+
* The index of the alternative a criterion name stands for.
|
|
151
|
+
*
|
|
152
|
+
* The criteria of the choice question are named "option_1", "option_2", ...
|
|
153
|
+
* so the picked name maps back to the alternative the agent offered. An
|
|
154
|
+
* unknown name (for example "none_of_these") has no alternative.
|
|
155
|
+
*/
|
|
156
|
+
export declare function optionIndex(name: string): number;
|
|
123
157
|
/**
|
|
124
158
|
* Combine the threshold outcome with the structured outcome of the
|
|
125
159
|
* evaluation.
|
|
@@ -175,6 +209,10 @@ export interface AutoContinueDecision {
|
|
|
175
209
|
waitRecommendation?: number;
|
|
176
210
|
/** The policy rule that changed the outcome, when one did. */
|
|
177
211
|
policyApplied?: string;
|
|
212
|
+
/** The option the evaluation selected for a choice question. */
|
|
213
|
+
selectedOption?: string;
|
|
214
|
+
/** The scope the evaluation selected. */
|
|
215
|
+
scope?: DecisionScope;
|
|
178
216
|
}
|
|
179
217
|
/**
|
|
180
218
|
* Auto-Continue Judge configuration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-continue.d.ts","sourceRoot":"","sources":["../src/auto-continue.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"auto-continue.d.ts","sourceRoot":"","sources":["../src/auto-continue.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAqC,MAAM,YAAY,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