pi-harness-runtime 1.1.508 → 1.1.510
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/CHANGELOG.md +175 -0
- package/harness/auto-resume-marker.ts +55 -13
- package/harness/local-refusal-marker.ts +104 -0
- package/harness/scope-expansion-runtime.ts +142 -15
- package/harness/scope-expansion.ts +150 -35
- package/index.ts +229 -43
- 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.map +1 -1
- package/packages/jev-judge/dist/auto-continue.js +11 -1
- package/packages/jev-judge/dist/auto-continue.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 +17 -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 +13 -1
- package/packages/jev-judge/src/question-risk.ts +19 -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/notification-center.d.ts +8 -4
- package/packages/notification/dist/notification-center.d.ts.map +1 -1
- package/packages/notification/dist/notification-center.js +18 -9
- package/packages/notification/dist/notification-center.js.map +1 -1
- package/packages/notification/dist/notification-policy.d.ts.map +1 -1
- package/packages/notification/dist/notification-policy.js +3 -0
- package/packages/notification/dist/notification-policy.js.map +1 -1
- package/packages/notification/dist/pending-question.d.ts +89 -1
- package/packages/notification/dist/pending-question.d.ts.map +1 -1
- package/packages/notification/dist/pending-question.js +220 -4
- package/packages/notification/dist/pending-question.js.map +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/notification/src/notification-center.ts +18 -9
- package/packages/notification/src/notification-policy.ts +3 -0
- package/packages/notification/src/pending-question.ts +287 -3
- 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
|
@@ -101,7 +101,12 @@ import {
|
|
|
101
101
|
findAutoResumeIndex,
|
|
102
102
|
isAutoResumeMessage,
|
|
103
103
|
neutralizeAutoResume,
|
|
104
|
+
NEUTRALIZED_STALE_RESUME_TEXT,
|
|
104
105
|
} from "./harness/auto-resume-marker.ts";
|
|
106
|
+
import {
|
|
107
|
+
buildLocalRefusalMessage,
|
|
108
|
+
LOCAL_REFUSAL_ANSWER,
|
|
109
|
+
} from "./harness/local-refusal-marker.ts";
|
|
105
110
|
import {
|
|
106
111
|
ScopeExpansionRuntime,
|
|
107
112
|
type HumanScopeOutcome,
|
|
@@ -675,6 +680,14 @@ const sharedState = {
|
|
|
675
680
|
// The runtime of the scope expansion: the backlog that could follow a
|
|
676
681
|
// finished request is proposed, and only the approved issues start.
|
|
677
682
|
scopeRuntime: null as ScopeExpansionRuntime | null,
|
|
683
|
+
/**
|
|
684
|
+
* The request the backlog was proposed for.
|
|
685
|
+
*
|
|
686
|
+
* The proposal of a request happens once: the generation of the request
|
|
687
|
+
* is its identity, and a second proposal of the same request would ask
|
|
688
|
+
* the human twice about the same backlog.
|
|
689
|
+
*/
|
|
690
|
+
scopeProposedFor: null as number | null,
|
|
678
691
|
};
|
|
679
692
|
|
|
680
693
|
/**
|
|
@@ -818,7 +831,16 @@ function deliveryOf(results: unknown): { delivered: boolean; failures: string[]
|
|
|
818
831
|
const reached = rows.filter((row) => row.success && !row.skipped);
|
|
819
832
|
const failures = rows
|
|
820
833
|
.filter((row) => !row.success || row.skipped)
|
|
821
|
-
.map((row) =>
|
|
834
|
+
.map((row) =>
|
|
835
|
+
row.skipped
|
|
836
|
+
? `${row.channel ?? "channel"}: skipped`
|
|
837
|
+
: `${row.channel ?? "channel"}: ${row.error ?? "not delivered"}`,
|
|
838
|
+
);
|
|
839
|
+
if (reached.length === 0 && failures.length === 0) {
|
|
840
|
+
// No channel was reached and no channel reported why: the result
|
|
841
|
+
// names no channel, and the log has to say so.
|
|
842
|
+
failures.push("no channel was reached");
|
|
843
|
+
}
|
|
822
844
|
return { delivered: reached.length > 0, failures };
|
|
823
845
|
}
|
|
824
846
|
|
|
@@ -835,13 +857,16 @@ async function proposeScopeExpansion(): Promise<void> {
|
|
|
835
857
|
// One proposal waits for an answer: a second one would ask the same
|
|
836
858
|
// human twice about the same backlog.
|
|
837
859
|
if (runtime.open.length > 0) return;
|
|
860
|
+
const generation = requestScopeTracker.generation;
|
|
861
|
+
// The proposal of a request happens once. The generation of the request
|
|
862
|
+
// is its identity: a request that finished twice does not ask twice.
|
|
863
|
+
if (sharedState.scopeProposedFor === generation) return;
|
|
838
864
|
const context = await getTaskContext().catch(() => null);
|
|
839
865
|
if (!context || context.issues.length === 0) return;
|
|
840
866
|
const candidates: ScopeCandidate[] = context.issues
|
|
841
867
|
.slice(0, MAX_SCOPE_CANDIDATES)
|
|
842
868
|
.map((issue) => ({ id: issue.id, title: issue.title }));
|
|
843
|
-
const
|
|
844
|
-
await runtime.propose({
|
|
869
|
+
const proposal = await runtime.propose({
|
|
845
870
|
requestId: `request-${generation}`,
|
|
846
871
|
workspace: _piSessionCwd || process.cwd(),
|
|
847
872
|
generation,
|
|
@@ -851,6 +876,9 @@ async function proposeScopeExpansion(): Promise<void> {
|
|
|
851
876
|
risks: ["the work was not asked for"],
|
|
852
877
|
choices: ["run the named issues", "keep the backlog closed"],
|
|
853
878
|
});
|
|
879
|
+
if (proposal) {
|
|
880
|
+
sharedState.scopeProposedFor = generation;
|
|
881
|
+
}
|
|
854
882
|
}
|
|
855
883
|
|
|
856
884
|
/**
|
|
@@ -872,24 +900,28 @@ function applyChannelApproval(
|
|
|
872
900
|
return false;
|
|
873
901
|
}
|
|
874
902
|
|
|
875
|
-
const result = controller.applyApproval(action, requestId, channel);
|
|
876
|
-
if (!result?.applied) {
|
|
877
|
-
logToFile(
|
|
878
|
-
"[Approval]",
|
|
879
|
-
`Stale or duplicate ${channel} click for ${requestId}: ${result?.reason ?? "ignored"}`,
|
|
880
|
-
);
|
|
881
|
-
return false;
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
logToFile("[Approval]", `${channel} decision '${action}' applied to ${requestId}`);
|
|
885
|
-
logQuestionTransition(requestId, "answered", `${channel}:${action}`);
|
|
886
|
-
|
|
887
903
|
// A question of a scope proposal is not a question of the work of the
|
|
888
904
|
// request: it asks whether the backlog may follow. The answer decides
|
|
889
905
|
// the proposal, and the work of the request stays what it was.
|
|
906
|
+
//
|
|
907
|
+
// The proposal is recognized before the shared question is resolved: an
|
|
908
|
+
// answer of a proposal must not clear the wait of the request and must
|
|
909
|
+
// not steer an answer into the conversation.
|
|
890
910
|
const scopeProposal = sharedState.scopeRuntime?.proposalForQuestion(requestId);
|
|
891
911
|
if (scopeProposal) {
|
|
892
|
-
const outcome: HumanScopeOutcome =
|
|
912
|
+
const outcome: HumanScopeOutcome = action === "approve" ? "approve" : "reject";
|
|
913
|
+
const scopeResult = controller.applyApproval(action, requestId, channel, {
|
|
914
|
+
notifyUser: false,
|
|
915
|
+
});
|
|
916
|
+
if (!scopeResult?.applied) {
|
|
917
|
+
logToFile(
|
|
918
|
+
"[Approval]",
|
|
919
|
+
`Stale or duplicate ${channel} click for ${requestId}: ${scopeResult?.reason ?? "ignored"}`,
|
|
920
|
+
);
|
|
921
|
+
return false;
|
|
922
|
+
}
|
|
923
|
+
logToFile("[Approval]", `${channel} decision '${action}' applied to ${requestId}`);
|
|
924
|
+
logQuestionTransition(requestId, "answered", `${channel}:${action}`);
|
|
893
925
|
void sharedState.scopeRuntime
|
|
894
926
|
?.answerByQuestion(requestId, outcome, `${channel}:${action}`)
|
|
895
927
|
.then((executed) => {
|
|
@@ -904,6 +936,18 @@ function applyChannelApproval(
|
|
|
904
936
|
return true;
|
|
905
937
|
}
|
|
906
938
|
|
|
939
|
+
const result = controller.applyApproval(action, requestId, channel);
|
|
940
|
+
if (!result?.applied) {
|
|
941
|
+
logToFile(
|
|
942
|
+
"[Approval]",
|
|
943
|
+
`Stale or duplicate ${channel} click for ${requestId}: ${result?.reason ?? "ignored"}`,
|
|
944
|
+
);
|
|
945
|
+
return false;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
logToFile("[Approval]", `${channel} decision '${action}' applied to ${requestId}`);
|
|
949
|
+
logQuestionTransition(requestId, "answered", `${channel}:${action}`);
|
|
950
|
+
|
|
907
951
|
// The question is answered, so the wait is over. The wait state is only
|
|
908
952
|
// cleared after a successful resolution.
|
|
909
953
|
// The controller owns the wait: the answer ends it, and an evaluation
|
|
@@ -1468,7 +1512,7 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
1468
1512
|
const jevProviders = resolveJevProviders({ keysDir });
|
|
1469
1513
|
|
|
1470
1514
|
// Create pending question controller - works independently of Jev
|
|
1471
|
-
const { createPendingQuestionController } = await import("./packages/notification/dist/index.js");
|
|
1515
|
+
const { createPendingQuestionController, classifyTemporaryDeletionRequest } = await import("./packages/notification/dist/index.js");
|
|
1472
1516
|
const pqController = createPendingQuestionController();
|
|
1473
1517
|
sharedState.pqController = pqController;
|
|
1474
1518
|
|
|
@@ -2171,6 +2215,84 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
2171
2215
|
pi.sendUserMessage(message, { deliverAs: "steer" });
|
|
2172
2216
|
});
|
|
2173
2217
|
|
|
2218
|
+
/**
|
|
2219
|
+
* Refuse a narrowly scoped deletion of a temporary path.
|
|
2220
|
+
*
|
|
2221
|
+
* The refusal is a local decision of the harness: the question is
|
|
2222
|
+
* closed with the answer "No", the judge is never asked, and no
|
|
2223
|
+
* human is interrupted. The agent is told the answer with a marked
|
|
2224
|
+
* message of the harness, so the transcript shows a decision of the
|
|
2225
|
+
* harness and not an answer of the human.
|
|
2226
|
+
*
|
|
2227
|
+
* A refusal is not a continuation: the unfinished work waits for an
|
|
2228
|
+
* explicit resume of the human, exactly like the refusal of a
|
|
2229
|
+
* human that answered "not yet".
|
|
2230
|
+
*/
|
|
2231
|
+
function refuseTemporaryDeletion(
|
|
2232
|
+
result: {
|
|
2233
|
+
questionText?: string;
|
|
2234
|
+
askType?:
|
|
2235
|
+
| "approval"
|
|
2236
|
+
| "choice"
|
|
2237
|
+
| "clarification"
|
|
2238
|
+
| "explicit_authorization"
|
|
2239
|
+
| "routine";
|
|
2240
|
+
alternatives?: string[];
|
|
2241
|
+
contextText?: string;
|
|
2242
|
+
},
|
|
2243
|
+
questionKind:
|
|
2244
|
+
| "routine"
|
|
2245
|
+
| "approval"
|
|
2246
|
+
| "choice"
|
|
2247
|
+
| "clarification"
|
|
2248
|
+
| "explicit",
|
|
2249
|
+
): void {
|
|
2250
|
+
const controller = sharedState.pqController;
|
|
2251
|
+
const question = controller?.createQuestion?.({
|
|
2252
|
+
text: result.questionText ?? "",
|
|
2253
|
+
sessionId: _sessionId,
|
|
2254
|
+
workspacePath: _piSessionCwd || "/",
|
|
2255
|
+
kind: questionKind,
|
|
2256
|
+
askType: result.askType,
|
|
2257
|
+
alternatives: result.alternatives,
|
|
2258
|
+
contextText: result.contextText,
|
|
2259
|
+
relevance: "temporary-path-deletion",
|
|
2260
|
+
});
|
|
2261
|
+
if (!question) {
|
|
2262
|
+
logToFile("[PendingQuestion]", "The local refusal has no question to close");
|
|
2263
|
+
return;
|
|
2264
|
+
}
|
|
2265
|
+
const closed = controller?.resolveLocally?.(
|
|
2266
|
+
question.requestId,
|
|
2267
|
+
"no",
|
|
2268
|
+
"temporary-path-deletion-refusal",
|
|
2269
|
+
);
|
|
2270
|
+
if (!closed) {
|
|
2271
|
+
logToFile(
|
|
2272
|
+
"[PendingQuestion]",
|
|
2273
|
+
"The local refusal did not close the question",
|
|
2274
|
+
);
|
|
2275
|
+
return;
|
|
2276
|
+
}
|
|
2277
|
+
// The question is answered, so the wait is over before it began.
|
|
2278
|
+
_lastNotifiedQuestion = result.questionText ?? "";
|
|
2279
|
+
logQuestionTransition(question.requestId, "refused", "temporary-path-deletion");
|
|
2280
|
+
clearWait();
|
|
2281
|
+
updateAutoContinueStatus("IDLE");
|
|
2282
|
+
sharedState.pendingCountdown?.stop();
|
|
2283
|
+
// A refusal never continues the work on its own.
|
|
2284
|
+
(sharedState.todoContinuationController as any)?.explicitPause?.();
|
|
2285
|
+
// The agent is told the answer: it must not delete anything.
|
|
2286
|
+
pi.sendMessage(
|
|
2287
|
+
buildLocalRefusalMessage({
|
|
2288
|
+
content: LOCAL_REFUSAL_ANSWER,
|
|
2289
|
+
reason: "temporary-path-deletion",
|
|
2290
|
+
rule: "temporary-path-deletion-refusal",
|
|
2291
|
+
}),
|
|
2292
|
+
{ deliverAs: "steer", triggerTurn: true },
|
|
2293
|
+
);
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2174
2296
|
// Detect when agent asks for continuation
|
|
2175
2297
|
pi.on("message_end", async (event) => {
|
|
2176
2298
|
const msg = event.message as { role?: string; content?: string | Array<{ type?: string; text?: string }> } | undefined;
|
|
@@ -2205,6 +2327,22 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
2205
2327
|
|
|
2206
2328
|
// Create question in controller
|
|
2207
2329
|
const questionKind = result.kind || "approval";
|
|
2330
|
+
// A narrowly scoped deletion of a temporary path is refused
|
|
2331
|
+
// by the harness itself: the answer is always "No", so
|
|
2332
|
+
// neither the judge nor the human is asked. The deletion of
|
|
2333
|
+
// a temporary file is a chore of the human, not a decision
|
|
2334
|
+
// of the session.
|
|
2335
|
+
const temporaryDeletion = classifyTemporaryDeletionRequest(
|
|
2336
|
+
result.questionText,
|
|
2337
|
+
);
|
|
2338
|
+
if (temporaryDeletion.applies) {
|
|
2339
|
+
logToFile(
|
|
2340
|
+
"[PendingQuestion]",
|
|
2341
|
+
"The question asks for the deletion of a temporary path: it is refused locally",
|
|
2342
|
+
);
|
|
2343
|
+
refuseTemporaryDeletion(result, questionKind);
|
|
2344
|
+
return;
|
|
2345
|
+
}
|
|
2208
2346
|
// The risk is about the action that is proposed, not about the
|
|
2209
2347
|
// whole message: a message that talks about many things
|
|
2210
2348
|
// carries words that have nothing to do with the action that
|
|
@@ -3029,14 +3167,17 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
3029
3167
|
* reaches nobody leaves the work stopped.
|
|
3030
3168
|
*/
|
|
3031
3169
|
function createScopeExpansionRuntime(): ScopeExpansionRuntime {
|
|
3032
|
-
|
|
3170
|
+
// The runtime owns its proposals: a decision that is in flight
|
|
3171
|
+
// when the session ends must not start work in another session.
|
|
3172
|
+
let runtime: ScopeExpansionRuntime | undefined;
|
|
3173
|
+
runtime = new ScopeExpansionRuntime({
|
|
3033
3174
|
now: () => Date.now(),
|
|
3034
3175
|
deliver: async (text, meta) => {
|
|
3035
3176
|
const center = _nc?.center as NcCenter | undefined;
|
|
3036
3177
|
if (!center) {
|
|
3037
3178
|
return { delivered: false, failures: ["no notification center"] };
|
|
3038
3179
|
}
|
|
3039
|
-
const proposal =
|
|
3180
|
+
const proposal = runtime?.get(meta.id);
|
|
3040
3181
|
try {
|
|
3041
3182
|
if (meta.kind === "proposal") {
|
|
3042
3183
|
const results = await center.notifyWithApproval(
|
|
@@ -3121,6 +3262,16 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
3121
3262
|
};
|
|
3122
3263
|
},
|
|
3123
3264
|
dispatch: (proposal, ids) => {
|
|
3265
|
+
// The session owns the decision: a decision that is still
|
|
3266
|
+
// in flight when the session ends must not start the
|
|
3267
|
+
// work of the backlog in another session.
|
|
3268
|
+
if (sharedState.scopeRuntime !== runtime) {
|
|
3269
|
+
logToFile(
|
|
3270
|
+
"[scope-expansion]",
|
|
3271
|
+
`The proposal ${proposal.id} is not dispatched: the session changed.`,
|
|
3272
|
+
);
|
|
3273
|
+
return;
|
|
3274
|
+
}
|
|
3124
3275
|
// The approval starts new work: it begins a new scope, so
|
|
3125
3276
|
// the todos of the finished request stay its history.
|
|
3126
3277
|
beginHumanRequest();
|
|
@@ -3185,6 +3336,7 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
3185
3336
|
},
|
|
3186
3337
|
log: (message) => logToFile("[scope-expansion]", message),
|
|
3187
3338
|
});
|
|
3339
|
+
return runtime;
|
|
3188
3340
|
}
|
|
3189
3341
|
|
|
3190
3342
|
pi.on("session_start", async (_event, ctx) => {
|
|
@@ -3562,31 +3714,35 @@ async function initAutoContinue(pi: ExtensionAPI): Promise<void> {
|
|
|
3562
3714
|
// Deduplication: only notify once per work generation
|
|
3563
3715
|
// Use a static flag for this session's settled cycle
|
|
3564
3716
|
const completionKey = `done-${reason}`;
|
|
3565
|
-
|
|
3717
|
+
const alreadyNotified = _completedNotifiedFor === completionKey;
|
|
3718
|
+
if (alreadyNotified) {
|
|
3566
3719
|
logToFile("[auto-continue]", "Completion already notified for:", reason);
|
|
3567
|
-
|
|
3720
|
+
} else {
|
|
3721
|
+
_completedNotifiedFor = completionKey;
|
|
3722
|
+
|
|
3723
|
+
// Get full todo list for notification
|
|
3724
|
+
const todoList = snapshot.items
|
|
3725
|
+
.map((item) => {
|
|
3726
|
+
const status = item.status === "completed" ? "[DONE]" : "[PENDING]";
|
|
3727
|
+
const subject = item.subject.length > 50 ? item.subject.slice(0, 47) + "..." : item.subject;
|
|
3728
|
+
return `${status} ${subject}`;
|
|
3729
|
+
})
|
|
3730
|
+
.join("\n");
|
|
3731
|
+
const message = todoList || "All tasks completed";
|
|
3732
|
+
// Notify user that all work is complete with todo list
|
|
3733
|
+
_nc?.notify("ReadyForClient", {
|
|
3734
|
+
jobId: `done-${reason.replace(/\s+/g, "-")}`,
|
|
3735
|
+
requirement: message,
|
|
3736
|
+
}).catch((e) => logToFile("[Notification]", "ReadyForClient failed:", String(e)));
|
|
3568
3737
|
}
|
|
3569
|
-
_completedNotifiedFor = completionKey;
|
|
3570
|
-
|
|
3571
|
-
// Get full todo list for notification
|
|
3572
|
-
const todoList = snapshot.items
|
|
3573
|
-
.map((item) => {
|
|
3574
|
-
const status = item.status === "completed" ? "[DONE]" : "[PENDING]";
|
|
3575
|
-
const subject = item.subject.length > 50 ? item.subject.slice(0, 47) + "..." : item.subject;
|
|
3576
|
-
return `${status} ${subject}`;
|
|
3577
|
-
})
|
|
3578
|
-
.join("\n");
|
|
3579
|
-
const message = todoList || "All tasks completed";
|
|
3580
|
-
// Notify user that all work is complete with todo list
|
|
3581
|
-
_nc?.notify("ReadyForClient", {
|
|
3582
|
-
jobId: `done-${reason.replace(/\s+/g, "-")}`,
|
|
3583
|
-
requirement: message,
|
|
3584
|
-
}).catch((e) => logToFile("[Notification]", "ReadyForClient failed:", String(e)));
|
|
3585
3738
|
|
|
3586
3739
|
// The request of the human is done. The backlog of the
|
|
3587
3740
|
// session is not work of it: the exact issues that
|
|
3588
3741
|
// could follow are proposed, and only the approved
|
|
3589
|
-
// ids start.
|
|
3742
|
+
// ids start. The proposal does not ride on the
|
|
3743
|
+
// notification of the completion: a request that
|
|
3744
|
+
// finished again is a new request, and it proposes
|
|
3745
|
+
// its own backlog.
|
|
3590
3746
|
await proposeScopeExpansion();
|
|
3591
3747
|
}
|
|
3592
3748
|
}
|
|
@@ -7372,10 +7528,31 @@ issue is not authorized work of the current request).
|
|
|
7372
7528
|
const details =
|
|
7373
7529
|
index === -1 ? undefined : autoResumeDetails(event.messages[index]);
|
|
7374
7530
|
// A resume of a cut turn continues a turn that was cut off: it is
|
|
7375
|
-
// unfinished by definition and the guard does not apply.
|
|
7376
|
-
|
|
7531
|
+
// unfinished by definition and the guard does not apply. A resume
|
|
7532
|
+
// whose scope cannot be read is not known to be a resume of the
|
|
7533
|
+
// request, and the guard does not apply either.
|
|
7534
|
+
if (index === -1 || details?.scope !== "request") {
|
|
7377
7535
|
return { messages: event.messages };
|
|
7378
7536
|
}
|
|
7537
|
+
// The resume belongs to a request. When the human replaced that
|
|
7538
|
+
// request, the resume is stale: it must not continue the old work
|
|
7539
|
+
// inside the new request.
|
|
7540
|
+
const generation = requestScopeTracker.generation;
|
|
7541
|
+
if (
|
|
7542
|
+
details?.requestGeneration !== undefined &&
|
|
7543
|
+
details.requestGeneration !== generation
|
|
7544
|
+
) {
|
|
7545
|
+
const report = `The automatic resume of the request ${details.requestGeneration} was replaced by a newer request.`;
|
|
7546
|
+
logToFile("[resume-scope]", report);
|
|
7547
|
+
reportSuppressedResume(report);
|
|
7548
|
+
return {
|
|
7549
|
+
messages: neutralizeAutoResume(
|
|
7550
|
+
event.messages,
|
|
7551
|
+
index,
|
|
7552
|
+
NEUTRALIZED_STALE_RESUME_TEXT,
|
|
7553
|
+
) as typeof event.messages,
|
|
7554
|
+
};
|
|
7555
|
+
}
|
|
7379
7556
|
const decision = decideResumeScope({
|
|
7380
7557
|
work: await currentRequestWorkState(),
|
|
7381
7558
|
reason: details?.reason ?? "auto-resume",
|
|
@@ -7383,7 +7560,11 @@ issue is not authorized work of the current request).
|
|
|
7383
7560
|
if (decision.action !== "suppress") {
|
|
7384
7561
|
return { messages: event.messages };
|
|
7385
7562
|
}
|
|
7386
|
-
logToFile(
|
|
7563
|
+
logToFile(
|
|
7564
|
+
"[resume-scope]",
|
|
7565
|
+
`Resume neutralized: ${decision.reason} (${details?.nonce || "no nonce"})`,
|
|
7566
|
+
);
|
|
7567
|
+
reportSuppressedResume(decision.report);
|
|
7387
7568
|
return {
|
|
7388
7569
|
messages: neutralizeAutoResume(event.messages, index) as typeof event.messages,
|
|
7389
7570
|
};
|
|
@@ -9167,15 +9348,20 @@ issue is not authorized work of the current request).
|
|
|
9167
9348
|
}
|
|
9168
9349
|
// The resume is a message of the harness, not a message of the
|
|
9169
9350
|
// human: it carries a marker, so the guard can recognize it when
|
|
9170
|
-
// it is consumed after the request finished.
|
|
9351
|
+
// it is consumed after the request finished. The marker names the
|
|
9352
|
+
// request the resume belongs to.
|
|
9171
9353
|
pi.sendMessage(
|
|
9172
9354
|
buildAutoResumeMessage({
|
|
9173
9355
|
content,
|
|
9174
9356
|
reason,
|
|
9175
9357
|
scope: options.scope ?? "request",
|
|
9176
9358
|
nonce: nextResumeNonce(),
|
|
9359
|
+
requestGeneration: requestScopeTracker.generation,
|
|
9177
9360
|
}),
|
|
9178
|
-
|
|
9361
|
+
// The resume continues the work on its own: without a turn of
|
|
9362
|
+
// its own the message would wait for the next prompt of the
|
|
9363
|
+
// human, and the recovery would never happen.
|
|
9364
|
+
{ deliverAs, triggerTurn: true },
|
|
9179
9365
|
);
|
|
9180
9366
|
await nc("ResumeScheduled", {
|
|
9181
9367
|
requirement: "Session auto-resume",
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-continue.d.ts","sourceRoot":"","sources":["../src/auto-continue.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;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;CA8BzB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,GACrB,OAAO,CAET;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsFhF;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,cAAc,EAAE,MAAM,EAAE,EACxB,cAAc,EAAE,MAAM,EAAE,EACxB,gBAAgB,CAAC,EAAE,IAAI,EACvB,gBAAgB,CAAC,EAAE,IAAI,EACvB,OAAO,CAAC,EAAE,eAAe,EACzB,OAAO,CAAC,EAAE,gBAAgB,GACzB,SAAS,CAkBX;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,IAAI,CAAC;IACvB,qCAAqC;IACrC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { JevJudge } from "./index.js";
|
|
11
11
|
import { logError } from "./file-logger.js";
|
|
12
12
|
import { buildChoiceDecisionContext, describeChoiceOption, renderChoiceExcerpt, MAX_CHOICE_OPTIONS, } from "./decision-context.js";
|
|
13
|
-
import { classifyQuestionRisk } from "./question-risk.js";
|
|
13
|
+
import { classifyQuestionRisk, isPermissionRequest } from "./question-risk.js";
|
|
14
14
|
/** How many task titles reach the evaluation. */
|
|
15
15
|
export const MAX_LISTED_TASKS = 10;
|
|
16
16
|
/** How much of the question text reaches the evaluation. */
|
|
@@ -97,6 +97,16 @@ export function applyDecisionPolicy(proposed, context, options) {
|
|
|
97
97
|
reason: "A clarification asks which option is meant. Guessing it would decide for the user.",
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
+
// A permission request ("May I …?") asks the human for a permission.
|
|
101
|
+
// The harness never grants a permission on its own: the decision waits
|
|
102
|
+
// for the human, exactly like a clarification.
|
|
103
|
+
if (question && isPermissionRequest(question.text)) {
|
|
104
|
+
return {
|
|
105
|
+
outcome: "wait",
|
|
106
|
+
appliedRule: "permission-request-never-approved",
|
|
107
|
+
reason: "A permission request waits for the human: the harness never grants a permission on its own.",
|
|
108
|
+
};
|
|
109
|
+
}
|
|
100
110
|
// A choice is decidable, but only with a concrete answer: the decision
|
|
101
111
|
// has to name the option it picked, otherwise the agent would receive
|
|
102
112
|
// a "continue" that says nothing about the question it asked.
|