@oyasmi/pipiclaw 0.9.3-beta.5 → 0.9.3-beta.6
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/README.en.md +1 -1
- package/README.md +1 -1
- package/dist/agent/channel-runner.d.ts +4 -8
- package/dist/agent/channel-runner.js +14 -34
- package/dist/agent/job-manager.d.ts +12 -0
- package/dist/agent/job-manager.js +42 -1
- package/dist/agent/prompt/sections.js +2 -2
- package/dist/agent/runner-factory.d.ts +2 -2
- package/dist/agent/types.d.ts +11 -7
- package/dist/channel/project-scope-store.d.ts +20 -0
- package/dist/channel/project-scope-store.js +22 -7
- package/dist/commands/catalog.js +6 -12
- package/dist/events/event-commands.js +2 -2
- package/dist/events/events.d.ts +51 -30
- package/dist/events/events.js +70 -98
- package/dist/memory/journal.d.ts +2 -3
- package/dist/memory/journal.js +2 -3
- package/dist/memory/maintenance-tuning.d.ts +0 -1
- package/dist/memory/maintenance-tuning.js +0 -1
- package/dist/memory/scheduler.js +8 -16
- package/dist/memory/search.js +2 -3
- package/dist/memory/session-search.js +3 -9
- package/dist/memory/store.d.ts +1 -1
- package/dist/memory/store.js +9 -1
- package/dist/memory/task-digest.js +10 -11
- package/dist/memory/tombstones.js +2 -4
- package/dist/models/provider-login.d.ts +1 -1
- package/dist/models/provider-login.js +1 -1
- package/dist/playbooks/agent-delegation.md +6 -6
- package/dist/playbooks/background-jobs.md +1 -1
- package/dist/playbooks/event-scheduling.md +22 -13
- package/dist/playbooks/memory-and-learning.md +2 -2
- package/dist/playbooks/outbound-media.md +1 -1
- package/dist/playbooks/runtime-orientation.md +3 -3
- package/dist/playbooks/task-lead.md +82 -0
- package/dist/runtime/bootstrap.js +95 -187
- package/dist/runtime/durable-dispatch.js +30 -3
- package/dist/runtime/report-commands.d.ts +30 -0
- package/dist/runtime/report-commands.js +71 -0
- package/dist/runtime/subagent-commands.js +1 -1
- package/dist/runtime/task-commands.d.ts +0 -8
- package/dist/runtime/task-commands.js +48 -85
- package/dist/runtime/task-driver.d.ts +13 -9
- package/dist/runtime/task-driver.js +34 -39
- package/dist/runtime/task-migration.d.ts +18 -29
- package/dist/runtime/task-migration.js +195 -183
- package/dist/runtime/task-spawn.d.ts +24 -0
- package/dist/runtime/task-spawn.js +49 -0
- package/dist/runtime/task-wake.d.ts +33 -46
- package/dist/runtime/task-wake.js +15 -90
- package/dist/security/network.js +44 -9
- package/dist/settings.d.ts +1 -8
- package/dist/settings.js +1 -8
- package/dist/subagents/discovery.js +3 -15
- package/dist/subagents/external/run.d.ts +3 -1
- package/dist/subagents/external/run.js +2 -20
- package/dist/subagents/external/settlement.d.ts +4 -16
- package/dist/subagents/external/settlement.js +16 -67
- package/dist/subagents/runs.d.ts +15 -29
- package/dist/subagents/runs.js +70 -158
- package/dist/subagents/tool.d.ts +20 -4
- package/dist/subagents/tool.js +63 -87
- package/dist/subagents/verification-outcome.d.ts +13 -19
- package/dist/subagents/verification-outcome.js +8 -22
- package/dist/subagents/workspace-summary.d.ts +8 -0
- package/dist/subagents/workspace-summary.js +29 -0
- package/dist/tasks/board.d.ts +43 -0
- package/dist/tasks/board.js +134 -0
- package/dist/tasks/brief.d.ts +10 -5
- package/dist/tasks/brief.js +78 -26
- package/dist/tasks/budget.d.ts +13 -14
- package/dist/tasks/budget.js +21 -40
- package/dist/tasks/contract-input.d.ts +19 -0
- package/dist/tasks/contract-input.js +55 -0
- package/dist/tasks/create.d.ts +17 -0
- package/dist/tasks/create.js +36 -0
- package/dist/tasks/frontmatter.d.ts +20 -27
- package/dist/tasks/frontmatter.js +18 -31
- package/dist/tasks/ledger.d.ts +61 -117
- package/dist/tasks/ledger.js +78 -223
- package/dist/tasks/log.d.ts +62 -35
- package/dist/tasks/log.js +51 -29
- package/dist/tasks/session-path.d.ts +3 -3
- package/dist/tasks/session-path.js +4 -5
- package/dist/tasks/store.d.ts +11 -29
- package/dist/tasks/store.js +39 -83
- package/dist/tasks/ticket.d.ts +33 -66
- package/dist/tasks/ticket.js +31 -120
- package/dist/tasks/work-log.d.ts +20 -0
- package/dist/tasks/work-log.js +42 -0
- package/dist/tools/bash.d.ts +1 -1
- package/dist/tools/bash.js +1 -1
- package/dist/tools/event-manage.d.ts +16 -2
- package/dist/tools/event-manage.js +30 -12
- package/dist/tools/index.d.ts +5 -3
- package/dist/tools/index.js +5 -5
- package/dist/tools/registry.d.ts +6 -4
- package/dist/tools/registry.js +1 -4
- package/dist/tools/subagent-manage.js +4 -2
- package/dist/tools/task-manage/create.js +11 -27
- package/dist/tools/task-manage/lifecycle.d.ts +6 -7
- package/dist/tools/task-manage/lifecycle.js +23 -106
- package/dist/tools/task-manage/log-view.d.ts +3 -2
- package/dist/tools/task-manage/log-view.js +6 -6
- package/dist/tools/task-manage/schema.d.ts +10 -30
- package/dist/tools/task-manage/schema.js +33 -49
- package/dist/tools/task-manage/shared.d.ts +35 -42
- package/dist/tools/task-manage/shared.js +53 -192
- package/dist/tools/task-manage/step-end.d.ts +6 -6
- package/dist/tools/task-manage/step-end.js +61 -98
- package/dist/tools/task-manage/types.d.ts +8 -9
- package/dist/tools/task-manage.js +5 -5
- package/dist/tui/app.js +11 -38
- package/dist/tui/commands.d.ts +18 -8
- package/dist/tui/commands.js +2 -9
- package/dist/tui/turn-controller.d.ts +2 -14
- package/dist/tui/turn-controller.js +1 -17
- package/dist/web/client.js +9 -1
- package/examples/sub-agents/README.md +7 -4
- package/examples/sub-agents/agents/codex-flash.md +2 -2
- package/examples/sub-agents/agents/codex-high.md +1 -1
- package/examples/sub-agents/agents/codex-main.md +1 -1
- package/examples/sub-agents/agents/codex-review.md +23 -0
- package/examples/sub-agents/roles/verifier.md +1 -1
- package/package.json +1 -1
- package/dist/memory/maintenance-migration.d.ts +0 -5
- package/dist/memory/maintenance-migration.js +0 -91
- package/dist/memory/migrate.d.ts +0 -15
- package/dist/memory/migrate.js +0 -364
- package/dist/playbooks/task-loop.md +0 -90
- package/dist/tasks/artifact-subject.d.ts +0 -40
- package/dist/tasks/artifact-subject.js +0 -334
- package/dist/tasks/cycle.d.ts +0 -48
- package/dist/tasks/cycle.js +0 -94
- package/dist/tasks/rounds.d.ts +0 -41
- package/dist/tasks/rounds.js +0 -53
- package/dist/tasks/task-events.d.ts +0 -6
- package/dist/tasks/task-events.js +0 -14
- package/dist/tasks/task-schedule.d.ts +0 -18
- package/dist/tasks/task-schedule.js +0 -50
- package/dist/tasks/verification.d.ts +0 -114
- package/dist/tasks/verification.js +0 -226
|
@@ -1,107 +1,32 @@
|
|
|
1
1
|
import { getChannelDir } from "../channel/channel-paths.js";
|
|
2
|
-
import {
|
|
3
|
-
/**
|
|
4
|
-
* True when `taskId` is already `open` and not paused — i.e. the driver already owns advancing
|
|
5
|
-
* it. A completion wake that could not redeem a ticket (because the task was not parked on one)
|
|
6
|
-
* is safe to drop without spending an agent turn only in this case: some other wake in the same
|
|
7
|
-
* fan-out already reopened it, and the driver will pick up the result. Every other case — done,
|
|
8
|
-
* archived, paused, or the task missing entirely — has nobody left to look at the wake's result
|
|
9
|
-
* if it is dropped here, so the caller must still route it to a normal turn.
|
|
10
|
-
*/
|
|
2
|
+
import { readStoredTask, redeemTicket } from "../tasks/store.js";
|
|
11
3
|
async function isTaskActivelyDriven(channelDir, taskId) {
|
|
12
4
|
const document = await readStoredTask(channelDir, taskId).catch(() => undefined);
|
|
13
5
|
return document !== undefined && document.fields.state === "open" && !document.fields.paused;
|
|
14
6
|
}
|
|
15
7
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
export function isVerifiedJobWake(jobs, jobId, taskId) {
|
|
24
|
-
const job = jobs.find((candidate) => candidate.id === jobId);
|
|
25
|
-
return job !== undefined && job.status !== "running" && job.taskId === taskId;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Same check as `isVerifiedJobWake`, for a `[SUBAGENT:<runId>] ... belongs to task <taskId>.`
|
|
29
|
-
* delegation wake. `settledAt` (rather than `status !== "running"`) is the terminal marker here
|
|
30
|
-
* because it is published with the terminal record before usage/archive/wake side effects — the
|
|
31
|
-
* same idempotency guard the manager itself relies on. A pending settlement intent leaves it unset.
|
|
8
|
+
* Claim a producer-created completion wake and redeem the task's ticket for it. Returns
|
|
9
|
+
* `undefined` for an event with no (or an unverifiable) `internalWake`.
|
|
10
|
+
*
|
|
11
|
+
* Only a `work` ticket may be redeemed by a settling run or job (any bound run or job settling
|
|
12
|
+
* wakes the leader, spec 052, D3): a task parked on a clock or a question to the user is not
|
|
13
|
+
* waiting for it, and reopening it here would be exactly the unverified resumption path spec 051
|
|
14
|
+
* exists to remove.
|
|
32
15
|
*/
|
|
33
|
-
export function
|
|
34
|
-
return record !== undefined && record.settledAt !== undefined && record.taskId === taskId;
|
|
35
|
-
}
|
|
36
|
-
/** Plain wake text is untrusted. Only an event carrying the producer-created structured envelope
|
|
37
|
-
* and its exact durable dispatch id may enter task activation; normal DingTalk inbound events do
|
|
38
|
-
* not populate `internalWake`, so copying a real wake's text is insufficient. */
|
|
39
|
-
export function isTrustedInternalWake(event, kind, resourceId, taskId) {
|
|
40
|
-
const wake = event.internalWake;
|
|
41
|
-
return (wake?.kind === kind &&
|
|
42
|
-
wake.resourceId === resourceId &&
|
|
43
|
-
wake.taskId === taskId &&
|
|
44
|
-
typeof event.dispatchId === "string" &&
|
|
45
|
-
wake.dispatchId === event.dispatchId);
|
|
46
|
-
}
|
|
47
|
-
/** Claim and activate a producer-created delegation wake without consuming it yet. Keeping the
|
|
48
|
-
* final marker separate lets transports such as TUI mark it consumed only after they have accepted
|
|
49
|
-
* the corresponding turn; a rejected submit remains replayable in the same or next process. */
|
|
50
|
-
export async function claimVerifiedDelegationWake(event, workspaceDir, runManager, hooks) {
|
|
51
|
-
const wake = event.internalWake;
|
|
52
|
-
if (wake?.kind !== "subagent")
|
|
53
|
-
return undefined;
|
|
54
|
-
const record = runManager.get(wake.resourceId);
|
|
55
|
-
if (!isTrustedInternalWake(event, "subagent", wake.resourceId, wake.taskId) ||
|
|
56
|
-
!isVerifiedDelegationWake(record, wake.taskId) ||
|
|
57
|
-
!(await runManager.beginWakeConsumption(wake.resourceId, wake.taskId, event.dispatchId))) {
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
const channelDir = getChannelDir(workspaceDir, event.channelId);
|
|
61
|
-
hooks?.beforeActivation?.();
|
|
62
|
-
// Only a `run` ticket naming this very run may be redeemed: a task parked on something else
|
|
63
|
-
// (a job, a question to the user) is not waiting for this delegation, and reopening it here
|
|
64
|
-
// would be exactly the unverified resumption path spec 051 D2 exists to remove.
|
|
65
|
-
const redeemed = await redeemTicket(channelDir, wake.taskId, (ticket) => ticket.kind === "run" && ticket.id === wake.resourceId);
|
|
66
|
-
const taskStillDriven = redeemed !== undefined || (await isTaskActivelyDriven(channelDir, wake.taskId));
|
|
67
|
-
return {
|
|
68
|
-
taskId: wake.taskId,
|
|
69
|
-
activated: redeemed !== undefined,
|
|
70
|
-
taskStillDriven,
|
|
71
|
-
finish: async () => {
|
|
72
|
-
await runManager.finishWakeConsumption(wake.resourceId, event.dispatchId);
|
|
73
|
-
},
|
|
74
|
-
// Re-park on the same ticket when the transport could not accept the turn, so a rejected
|
|
75
|
-
// submit leaves the task exactly as it was rather than silently `open` with no step queued.
|
|
76
|
-
rollback: async () => {
|
|
77
|
-
if (redeemed)
|
|
78
|
-
await parkTask(channelDir, wake.taskId, redeemed.ticket);
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
/** Same shape as `claimVerifiedDelegationWake`, for a `[JOB:<jobId>] ... belongs to task
|
|
83
|
-
* <taskId>.` completion wake. A background job has no rollback bookkeeping — its wake
|
|
84
|
-
* activation is a single unconditional step — so `ClaimedJobWake` omits `rollback`. */
|
|
85
|
-
export async function claimVerifiedJobWake(event, workspaceDir, jobManager, hooks) {
|
|
16
|
+
export async function claimVerifiedWake(event, workspaceDir, owner, hooks) {
|
|
86
17
|
const wake = event.internalWake;
|
|
87
|
-
if (wake
|
|
18
|
+
if (!wake || typeof event.dispatchId !== "string")
|
|
88
19
|
return undefined;
|
|
89
|
-
|
|
90
|
-
if (!isTrustedInternalWake(event, "job", wake.resourceId, wake.taskId) ||
|
|
91
|
-
!isVerifiedJobWake(jobs, wake.resourceId, wake.taskId) ||
|
|
92
|
-
!(await jobManager.beginWakeConsumption(wake.resourceId, wake.taskId, event.dispatchId))) {
|
|
20
|
+
if (!(await owner.beginWakeConsumption(wake.resourceId, wake.taskId, event.dispatchId)))
|
|
93
21
|
return undefined;
|
|
94
|
-
|
|
22
|
+
const dispatchId = event.dispatchId;
|
|
95
23
|
const channelDir = getChannelDir(workspaceDir, event.channelId);
|
|
96
24
|
hooks?.beforeActivation?.();
|
|
97
|
-
const redeemed = await redeemTicket(channelDir, wake.taskId, (ticket) => ticket.kind === "
|
|
98
|
-
const taskStillDriven = redeemed !== undefined || (await isTaskActivelyDriven(channelDir, wake.taskId));
|
|
25
|
+
const redeemed = await redeemTicket(channelDir, wake.taskId, (ticket) => ticket.kind === "work");
|
|
99
26
|
return {
|
|
100
27
|
taskId: wake.taskId,
|
|
101
28
|
activated: redeemed !== undefined,
|
|
102
|
-
taskStillDriven,
|
|
103
|
-
finish:
|
|
104
|
-
await jobManager.finishWakeConsumption(wake.resourceId, event.dispatchId);
|
|
105
|
-
},
|
|
29
|
+
taskStillDriven: redeemed !== undefined || (await isTaskActivelyDriven(channelDir, wake.taskId)),
|
|
30
|
+
finish: () => owner.finishWakeConsumption(wake.resourceId, dispatchId),
|
|
106
31
|
};
|
|
107
32
|
}
|
package/dist/security/network.js
CHANGED
|
@@ -129,22 +129,57 @@ function matchesAllowedHost(hostname, allowedHosts) {
|
|
|
129
129
|
const normalized = normalizeHost(hostname);
|
|
130
130
|
return allowedHosts.some((candidate) => normalizeHost(candidate) === normalized);
|
|
131
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* An IPv4-mapped IPv6 address (`::ffff:a.b.c.d`, the `::ffff:0:0/96` range) is the same host as
|
|
134
|
+
* the embedded IPv4 address — a dual-stack socket connecting to `::ffff:127.0.0.1` reaches
|
|
135
|
+
* loopback exactly as `127.0.0.1` would. `isPrivateAddress`/`matchesAllowedCidr` used to check
|
|
136
|
+
* such an address only against the IPv6 private ranges, which do not cover this mapped range, so
|
|
137
|
+
* a mapped private/loopback address (R4) sailed through as "not private". Returns the dotted-quad
|
|
138
|
+
* form when `address` is a mapped IPv4 address, else `null`.
|
|
139
|
+
*/
|
|
140
|
+
function ipv4MappedEmbeddedAddress(address) {
|
|
141
|
+
if (isIP(address) !== 6) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
const value = parseIpv6(address);
|
|
145
|
+
if (value === null) {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
if (value >> 32n !== 0xffffn) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
const low32 = value & 0xffffffffn;
|
|
152
|
+
return [24n, 16n, 8n, 0n].map((shift) => Number((low32 >> shift) & 0xffn)).join(".");
|
|
153
|
+
}
|
|
154
|
+
/** Every address form a guard check must consider for `address`: itself, plus (when it is an
|
|
155
|
+
* IPv4-mapped IPv6 address) the IPv4 address it actually maps to. */
|
|
156
|
+
function expandForGuardCheck(address) {
|
|
157
|
+
const version = isIP(address);
|
|
158
|
+
if (version === 4) {
|
|
159
|
+
return [{ address, version: 4 }];
|
|
160
|
+
}
|
|
161
|
+
if (version === 6) {
|
|
162
|
+
const mapped = ipv4MappedEmbeddedAddress(address);
|
|
163
|
+
return mapped
|
|
164
|
+
? [
|
|
165
|
+
{ address, version: 6 },
|
|
166
|
+
{ address: mapped, version: 4 },
|
|
167
|
+
]
|
|
168
|
+
: [{ address, version: 6 }];
|
|
169
|
+
}
|
|
170
|
+
return [];
|
|
171
|
+
}
|
|
132
172
|
function matchesAllowedCidr(address, allowedCidrs) {
|
|
133
|
-
return allowedCidrs.some((cidr) => ipInCidr(
|
|
173
|
+
return expandForGuardCheck(address).some(({ address: candidate }) => allowedCidrs.some((cidr) => ipInCidr(candidate, cidr.trim())));
|
|
134
174
|
}
|
|
135
175
|
function isBlockedHost(hostname) {
|
|
136
176
|
const normalized = normalizeHost(hostname);
|
|
137
177
|
return normalized.endsWith(".localhost") || BLOCKED_HOSTS.has(normalized);
|
|
138
178
|
}
|
|
139
179
|
function isPrivateAddress(address) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
if (version === 6) {
|
|
145
|
-
return PRIVATE_IPV6_CIDRS.some((cidr) => ipInCidr(address, cidr));
|
|
146
|
-
}
|
|
147
|
-
return false;
|
|
180
|
+
return expandForGuardCheck(address).some(({ address: candidate, version }) => version === 4
|
|
181
|
+
? PRIVATE_IPV4_CIDRS.some((cidr) => ipInCidr(candidate, cidr))
|
|
182
|
+
: PRIVATE_IPV6_CIDRS.some((cidr) => ipInCidr(candidate, cidr)));
|
|
148
183
|
}
|
|
149
184
|
async function validateUrlTarget(rawUrl, context, stage) {
|
|
150
185
|
const url = (() => {
|
package/dist/settings.d.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Settings management for pipiclaw.
|
|
3
|
-
*
|
|
4
|
-
* `log.jsonl` and `context.jsonl` are treated as raw cold storage.
|
|
5
|
-
* They are not proactively scanned or loaded as part of the memory model.
|
|
6
|
-
*
|
|
7
|
-
* This module currently provides only PipiclawSettingsManager.
|
|
8
|
-
*/
|
|
1
|
+
/** Settings management for pipiclaw: `settings.json` (product intent only) and the code constants that replaced the retired knobs. */
|
|
9
2
|
import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
|
|
10
3
|
import { type MemoryMaintenanceTuning } from "./memory/maintenance-tuning.js";
|
|
11
4
|
import type { ResponseMode } from "./runtime/dingtalk.js";
|
package/dist/settings.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Settings management for pipiclaw.
|
|
3
|
-
*
|
|
4
|
-
* `log.jsonl` and `context.jsonl` are treated as raw cold storage.
|
|
5
|
-
* They are not proactively scanned or loaded as part of the memory model.
|
|
6
|
-
*
|
|
7
|
-
* This module currently provides only PipiclawSettingsManager.
|
|
8
|
-
*/
|
|
1
|
+
/** Settings management for pipiclaw: `settings.json` (product intent only) and the code constants that replaced the retired knobs. */
|
|
9
2
|
import { existsSync, mkdirSync, readFileSync } from "fs";
|
|
10
3
|
import { dirname, join } from "path";
|
|
11
4
|
import * as log from "./log.js";
|
|
@@ -22,8 +22,6 @@ const MAX_SUB_AGENT_TASK_CHARS = 12000;
|
|
|
22
22
|
const MAX_SUB_AGENT_SYSTEM_PROMPT_CHARS = 16000;
|
|
23
23
|
const ALLOWED_CONTEXT_MODES = ["isolated", "contextual"];
|
|
24
24
|
const ALLOWED_MEMORY_MODES = ["none", "index"];
|
|
25
|
-
/** Spec 050, D12: `session`/`relevant` are retired — both collapse to `index`. */
|
|
26
|
-
const LEGACY_MEMORY_MODE_ALIASES = { session: "index", relevant: "index" };
|
|
27
25
|
// "max" is a real SDK ThinkingLevel; pipiclaw's own whitelist previously omitted it (spec 040, D4).
|
|
28
26
|
const ALLOWED_THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
29
27
|
const ALLOWED_RUNTIMES = ["internal", "external"];
|
|
@@ -195,8 +193,7 @@ function parseContextChoice(raw) {
|
|
|
195
193
|
}
|
|
196
194
|
/**
|
|
197
195
|
* `defaultValue` is computed per call site rather than derived from `contextMode` inside this
|
|
198
|
-
* function (spec 042 D4): internal keeps following `contextMode` (`contextual` → `
|
|
199
|
-
* but an external role's default is always `none` regardless of `contextMode` — a role that
|
|
196
|
+
* function (spec 042 D4): internal keeps following `contextMode` (`contextual` → `index`), but an external role's default is always `none` regardless of `contextMode` — a role that
|
|
200
197
|
* merely wants `paths` injected (via `contextMode: contextual`) should not also silently start
|
|
201
198
|
* sending session/memory content to a third-party process.
|
|
202
199
|
*/
|
|
@@ -208,13 +205,6 @@ function parseMemoryMode(raw, defaultValue) {
|
|
|
208
205
|
if (ALLOWED_MEMORY_MODES.includes(normalized)) {
|
|
209
206
|
return { value: normalized };
|
|
210
207
|
}
|
|
211
|
-
// Frontmatter lives in the user's workspace, not under this codebase's control, so a role
|
|
212
|
-
// written against the retired `session`/`relevant` values keeps loading — with a warning —
|
|
213
|
-
// instead of being dropped (spec 050, D12).
|
|
214
|
-
const legacy = LEGACY_MEMORY_MODE_ALIASES[normalized];
|
|
215
|
-
if (legacy) {
|
|
216
|
-
return { value: legacy, warning: `memory: "${normalized}" is retired; treating it as "${legacy}"` };
|
|
217
|
-
}
|
|
218
208
|
return {
|
|
219
209
|
value: defaultValue,
|
|
220
210
|
error: `Unknown memory "${normalized}". Allowed values: ${ALLOWED_MEMORY_MODES.join(", ")}`,
|
|
@@ -404,9 +394,7 @@ function parseInternalAgent(entryName, filePath, frontmatter, body, name, descri
|
|
|
404
394
|
const bashWithoutMutatesWarning = toolParse.tools.includes("bash") && mutates.value === undefined
|
|
405
395
|
? 'tools include bash but "mutates" is not declared; if this role writes to the workspace, declare mutates: write so it participates in the workspace write lease'
|
|
406
396
|
: undefined;
|
|
407
|
-
const combinedWarningBody = [numericWarning,
|
|
408
|
-
.filter(Boolean)
|
|
409
|
-
.join("; ");
|
|
397
|
+
const combinedWarningBody = [numericWarning, bashWithoutMutatesWarning].filter(Boolean).join("; ");
|
|
410
398
|
return {
|
|
411
399
|
warning: combinedWarningBody ? `${entryName}: ${combinedWarningBody}` : undefined,
|
|
412
400
|
agent: {
|
|
@@ -511,7 +499,7 @@ function parseExternalAgent(entryName, filePath, frontmatter, body, name, descri
|
|
|
511
499
|
: undefined;
|
|
512
500
|
// All non-fatal (the role still loads); joined rather than picking one so an unlucky
|
|
513
501
|
// combination never silently loses one of them.
|
|
514
|
-
const combinedWarning = [
|
|
502
|
+
const combinedWarning = [memoryDisclosureWarning, modelPlaceholderWarning].filter(Boolean).join("; ") || undefined;
|
|
515
503
|
return {
|
|
516
504
|
warning: combinedWarning,
|
|
517
505
|
agent: {
|
|
@@ -18,7 +18,7 @@ export interface LaunchExternalRunInput {
|
|
|
18
18
|
runManager: SubAgentRunManager;
|
|
19
19
|
runId: string;
|
|
20
20
|
channelId: string;
|
|
21
|
-
/**
|
|
21
|
+
/** Where a task-bound run logs its dispatch and settlement (spec 052, D4). */
|
|
22
22
|
channelDir?: string;
|
|
23
23
|
label: string;
|
|
24
24
|
agent: string;
|
|
@@ -38,6 +38,8 @@ export interface LaunchExternalRunInput {
|
|
|
38
38
|
artifactDir: string;
|
|
39
39
|
purpose: "work" | "verify";
|
|
40
40
|
taskId?: string;
|
|
41
|
+
/** The Work Items id this run was dispatched for (spec 052, D4). */
|
|
42
|
+
item?: string;
|
|
41
43
|
leaseKey?: string;
|
|
42
44
|
resumeSessionId?: string;
|
|
43
45
|
/** The role's own `mutates` declaration, carried through to the dispatch audit event (D8.1). */
|
|
@@ -8,7 +8,6 @@ import { killProcessGroup, probeCliVersion, readProcessStartTime, reapProcessGro
|
|
|
8
8
|
import { splitShellWords } from "../../shared/shell-words.js";
|
|
9
9
|
import { errorMessage } from "../../shared/text-utils.js";
|
|
10
10
|
import { createEmptyUsageTotals } from "../../shared/types.js";
|
|
11
|
-
import { workspaceSubjectSnapshot } from "../../tasks/artifact-subject.js";
|
|
12
11
|
import { getExternalHarness } from "./registry.js";
|
|
13
12
|
import { finalizeExternalRun } from "./settlement.js";
|
|
14
13
|
/**
|
|
@@ -133,14 +132,6 @@ export async function launchExternalRun(input) {
|
|
|
133
132
|
await writeFile(promptFile, `${input.task.trim()}\n`, "utf-8");
|
|
134
133
|
if (systemPromptFile)
|
|
135
134
|
await writeFile(systemPromptFile, `${trimmedSystemPrompt}\n`, "utf-8");
|
|
136
|
-
// D9: an external verifier's advisory attestation needs a before/after subject snapshot the
|
|
137
|
-
// same way the internal path does — taken here, before the process starts, since this is the
|
|
138
|
-
// earliest point at which the run is committed to running against this workingDirectory. The
|
|
139
|
-
// fixed base and initial untracked manifest survive a later normal Git commit.
|
|
140
|
-
const verifySubjectSnapshot = input.purpose === "verify" ? await workspaceSubjectSnapshot(input.workingDirectory) : undefined;
|
|
141
|
-
const verifySubjectBefore = verifySubjectSnapshot?.hash;
|
|
142
|
-
const verifyBaseCommit = verifySubjectSnapshot?.baseCommit;
|
|
143
|
-
const verifyBaselineUntrackedPaths = verifySubjectSnapshot?.baselineUntrackedPaths;
|
|
144
135
|
const argv = input.shell ? [] : splitShellWords(input.command);
|
|
145
136
|
const invocation = input.shell
|
|
146
137
|
? { executable: "/bin/sh", args: ["-lc", input.command], resumable: false }
|
|
@@ -172,6 +163,7 @@ export async function launchExternalRun(input) {
|
|
|
172
163
|
model: input.externalModelRef,
|
|
173
164
|
purpose: input.purpose,
|
|
174
165
|
taskId: input.taskId,
|
|
166
|
+
item: input.item,
|
|
175
167
|
workingDirectory: input.workingDirectory,
|
|
176
168
|
artifactDir: input.artifactDir,
|
|
177
169
|
channelDir: input.channelDir,
|
|
@@ -295,10 +287,7 @@ export async function launchExternalRun(input) {
|
|
|
295
287
|
sessionId: invocation.presetSessionId,
|
|
296
288
|
// Spec 042 D1: persisted so a restart reconciliation has the same inputs the live watcher
|
|
297
289
|
// below would — without these, a run that finishes after the daemon disappears would settle
|
|
298
|
-
// with an inaccurate timeout message
|
|
299
|
-
verifySubjectBefore,
|
|
300
|
-
verifyBaseCommit,
|
|
301
|
-
verifyBaselineUntrackedPaths,
|
|
290
|
+
// with an inaccurate timeout message and an unestimatable duration.
|
|
302
291
|
maxWallTimeSec: input.maxWallTimeSec,
|
|
303
292
|
processStartedAt,
|
|
304
293
|
channelDir: input.channelDir,
|
|
@@ -386,21 +375,14 @@ export async function launchExternalRun(input) {
|
|
|
386
375
|
// id — `finalizeExternalRun` keeps all of that; only `status` and `failureReason` get overridden
|
|
387
376
|
// by `terminationReason` (P1-1).
|
|
388
377
|
await finalizeExternalRun({
|
|
389
|
-
runId: input.runId,
|
|
390
|
-
channelId: input.channelId,
|
|
391
|
-
channelDir: input.channelDir,
|
|
392
378
|
harnessId: harness.id,
|
|
393
379
|
purpose: input.purpose,
|
|
394
|
-
taskId: input.taskId,
|
|
395
380
|
workingDirectory: input.workingDirectory,
|
|
396
381
|
artifactDir: input.artifactDir,
|
|
397
382
|
exitCode,
|
|
398
383
|
durationMs,
|
|
399
384
|
terminationReason,
|
|
400
385
|
maxWallTimeSec: input.maxWallTimeSec,
|
|
401
|
-
verifySubjectBefore,
|
|
402
|
-
verifyBaseCommit,
|
|
403
|
-
verifyBaselineUntrackedPaths,
|
|
404
386
|
mutates: input.mutates,
|
|
405
387
|
}, (settleInput, options) => runManager.settle(input.runId, settleInput, options), { announce: terminationReason !== "cancelled" }).catch((error) => {
|
|
406
388
|
log.logWarning(`Failed to settle external run ${input.runId}`, errorMessage(error));
|
|
@@ -16,14 +16,8 @@ export interface BuildExternalSettleInputInput {
|
|
|
16
16
|
*/
|
|
17
17
|
export declare function buildExternalSettleInput(input: BuildExternalSettleInputInput): SettleInput;
|
|
18
18
|
export interface FinalizeExternalRunInput {
|
|
19
|
-
runId: string;
|
|
20
|
-
channelId: string;
|
|
21
|
-
/** Needed only for `purpose=verify`: where the attestation gets written. Absent on an older
|
|
22
|
-
* record (predating spec 042) — verify processing degrades to "skip" rather than guessing. */
|
|
23
|
-
channelDir?: string;
|
|
24
19
|
harnessId: RunHarness;
|
|
25
20
|
purpose: "work" | "verify";
|
|
26
|
-
taskId?: string;
|
|
27
21
|
workingDirectory: string;
|
|
28
22
|
artifactDir: string;
|
|
29
23
|
/** `undefined` when the process was killed by a signal, or when this is a restart
|
|
@@ -33,21 +27,15 @@ export interface FinalizeExternalRunInput {
|
|
|
33
27
|
durationEstimated?: boolean;
|
|
34
28
|
terminationReason?: "timeout" | "cancelled";
|
|
35
29
|
maxWallTimeSec?: number;
|
|
36
|
-
/** The workspace subject hash taken just before this run started (D9's before/after pair for
|
|
37
|
-
* external verify) — persisted at launch so restart reconciliation has it too. */
|
|
38
|
-
verifySubjectBefore?: string;
|
|
39
|
-
/** Fixed verification base and initial untracked manifest, persisted for restart reconciliation. */
|
|
40
|
-
verifyBaseCommit?: string;
|
|
41
|
-
verifyBaselineUntrackedPaths?: string[];
|
|
42
30
|
/** P2-2: only a `write` run's completion pays for a `git status` summary — a `read` run cannot
|
|
43
31
|
* have changed anything, and this must never become a hidden cost on the common read-only path. */
|
|
44
32
|
mutates?: RunMutates;
|
|
45
33
|
}
|
|
46
34
|
/**
|
|
47
|
-
* Read this run's artifact files, parse them through its harness, decide its verdict (
|
|
48
|
-
* verify
|
|
49
|
-
*
|
|
50
|
-
*
|
|
35
|
+
* Read this run's artifact files, parse them through its harness, decide its verdict (for a
|
|
36
|
+
* `purpose=verify` run), and hand the result to `settle`. Both the live post-exit path and
|
|
37
|
+
* restart reconciliation call this and only this — there is no second implementation to drift out
|
|
38
|
+
* of sync with the first (spec 042 F1).
|
|
51
39
|
*/
|
|
52
40
|
export declare function finalizeExternalRun(input: FinalizeExternalRunInput, settle: (settleInput: SettleInput, options: {
|
|
53
41
|
announce: boolean;
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { errorMessage } from "../../shared/text-utils.js";
|
|
6
|
-
import { changedPathsSummary, workspaceSubjectHash } from "../../tasks/artifact-subject.js";
|
|
7
|
-
import { writeVerificationAttestation } from "../../tasks/verification.js";
|
|
8
|
-
import { resolveVerificationOutcome } from "../verification-outcome.js";
|
|
3
|
+
import { resolveVerificationVerdict } from "../verification-outcome.js";
|
|
4
|
+
import { changedPathsSummary } from "../workspace-summary.js";
|
|
9
5
|
import { classifyExternalOutcome } from "./harness.js";
|
|
10
6
|
import { getExternalHarness } from "./registry.js";
|
|
11
7
|
/**
|
|
12
8
|
* Spec 042 D1: the one place an external run's parsed outcome becomes a `SettleInput`, and the
|
|
13
|
-
* one place its verify verdict gets decided
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* inputs it would have needed (`verifySubjectBefore`, `channelDir`) were never persisted. Both
|
|
18
|
-
* defects are closed by making this the only path either caller can take.
|
|
9
|
+
* one place its verify verdict gets decided. Before this module existed, that logic was written
|
|
10
|
+
* three times — the live post-exit path (`external/run.ts`), and restart reconciliation
|
|
11
|
+
* (`runs.ts`) — and the third copy was the thinnest: it never read `events.jsonl` at all on a
|
|
12
|
+
* cancelled/timed-out run. Making this the only path either caller can take closes that defect.
|
|
19
13
|
*/
|
|
20
14
|
const STDERR_TAIL_CHARS = 2_000;
|
|
21
15
|
/**
|
|
@@ -56,10 +50,10 @@ export function buildExternalSettleInput(input) {
|
|
|
56
50
|
};
|
|
57
51
|
}
|
|
58
52
|
/**
|
|
59
|
-
* Read this run's artifact files, parse them through its harness, decide its verdict (
|
|
60
|
-
* verify
|
|
61
|
-
*
|
|
62
|
-
*
|
|
53
|
+
* Read this run's artifact files, parse them through its harness, decide its verdict (for a
|
|
54
|
+
* `purpose=verify` run), and hand the result to `settle`. Both the live post-exit path and
|
|
55
|
+
* restart reconciliation call this and only this — there is no second implementation to drift out
|
|
56
|
+
* of sync with the first (spec 042 F1).
|
|
63
57
|
*/
|
|
64
58
|
export async function finalizeExternalRun(input, settle, options) {
|
|
65
59
|
const harness = getExternalHarness(input.harnessId);
|
|
@@ -93,57 +87,12 @@ export async function finalizeExternalRun(input, settle, options) {
|
|
|
93
87
|
if (workspaceSummary)
|
|
94
88
|
settleInput = { ...settleInput, workspaceSummary };
|
|
95
89
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
await settle(settleInput, options);
|
|
90
|
+
if (input.purpose === "verify" && settleInput.status === "completed") {
|
|
91
|
+
// A verifier that did not finish cleanly gets no verdict at all; one that did is judged on
|
|
92
|
+
// what it printed, so `runFailed` is false by construction here.
|
|
93
|
+
const verificationVerdict = resolveVerificationVerdict({ finalText: outcome.finalText, runFailed: false });
|
|
94
|
+
await settle({ ...settleInput, verificationVerdict }, options);
|
|
102
95
|
return;
|
|
103
96
|
}
|
|
104
|
-
|
|
105
|
-
// hash is the only after-the-fact check available. The base and untracked baseline came from the
|
|
106
|
-
// launch-time snapshot (persisted so restart reconciliation has it too).
|
|
107
|
-
const baseSubjectAvailable = input.verifyBaseCommit !== undefined && input.verifyBaselineUntrackedPaths !== undefined;
|
|
108
|
-
const partialBaseSubject = input.verifyBaseCommit !== undefined && input.verifyBaselineUntrackedPaths === undefined;
|
|
109
|
-
const subjectAfter = partialBaseSubject
|
|
110
|
-
? undefined
|
|
111
|
-
: await workspaceSubjectHash(input.workingDirectory, baseSubjectAvailable
|
|
112
|
-
? {
|
|
113
|
-
baseCommit: input.verifyBaseCommit,
|
|
114
|
-
baselineUntrackedPaths: input.verifyBaselineUntrackedPaths,
|
|
115
|
-
}
|
|
116
|
-
: {});
|
|
117
|
-
const verification = resolveVerificationOutcome({
|
|
118
|
-
subjectBefore: input.verifySubjectBefore,
|
|
119
|
-
subjectAfter,
|
|
120
|
-
finalText: outcome.finalText,
|
|
121
|
-
runFailed: false, // shouldVerify already gates on settleInput.status === "completed".
|
|
122
|
-
});
|
|
123
|
-
// `verifySubjectBefore` and `verifyBaseCommit` are always set together at launch (both come
|
|
124
|
-
// from the one all-or-nothing `workspaceSubjectSnapshot()` call in `external/run.ts`), so a
|
|
125
|
-
// freshly launched run can never carry a subject hash without a base commit — there is no
|
|
126
|
-
// live path left that produces a "legacy-head" attestation. `verification.ts` still reads and
|
|
127
|
-
// compares `legacy-head` attestations written before base-relative subjects existed; this is
|
|
128
|
-
// only the write side, for a run happening now.
|
|
129
|
-
const subjectAvailable = !verification.workspaceChanged && subjectAfter !== undefined && baseSubjectAvailable;
|
|
130
|
-
await writeVerificationAttestation(input.channelDir, {
|
|
131
|
-
runId: input.runId,
|
|
132
|
-
taskId: input.taskId,
|
|
133
|
-
verdict: verification.verdict,
|
|
134
|
-
checkedAt: formatLocalTime(),
|
|
135
|
-
evidence: verification.evidence,
|
|
136
|
-
workspaceChanged: verification.workspaceChanged,
|
|
137
|
-
subjectHash: subjectAvailable ? subjectAfter : undefined,
|
|
138
|
-
subjectDir: subjectAvailable ? input.workingDirectory : undefined,
|
|
139
|
-
subjectMode: subjectAvailable ? "base-relative" : undefined,
|
|
140
|
-
subjectBaseCommit: subjectAvailable ? input.verifyBaseCommit : undefined,
|
|
141
|
-
subjectBaselineUntrackedPaths: subjectAvailable ? input.verifyBaselineUntrackedPaths : undefined,
|
|
142
|
-
// External verifiers cannot have their tools structurally removed the way an internal
|
|
143
|
-
// verifier's are — advisory, not enforced (D9).
|
|
144
|
-
verificationStrength: "advisory",
|
|
145
|
-
}).catch((error) => {
|
|
146
|
-
log.logWarning(`Failed to write verification attestation for run ${input.runId}`, errorMessage(error));
|
|
147
|
-
});
|
|
148
|
-
await settle({ ...settleInput, verificationVerdict: verification.verdict, verificationStrength: "advisory" }, options);
|
|
97
|
+
await settle(settleInput, options);
|
|
149
98
|
}
|
package/dist/subagents/runs.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { UsageLedger } from "../usage/ledger.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* The run: one abstraction level for delegation, whether it executes as an in-process sub-agent
|
|
7
7
|
* or (from spec 040 phase 2 onward) a short-lived external CLI process. See
|
|
8
|
-
* `docs/specs/040-async-delegation-and-external-agents/design.md`, D1.
|
|
8
|
+
* `docs/archive/specs/040-async-delegation-and-external-agents/design.md`, D1.
|
|
9
9
|
*
|
|
10
10
|
* State machine vocabulary is borrowed from `job-manager.ts`'s `JobStatus` rather than inventing
|
|
11
11
|
* a second one. Only three facts are persisted as idempotent markers (D1/P5) because only three
|
|
@@ -71,6 +71,8 @@ export interface RunRecord extends RunUsage {
|
|
|
71
71
|
model?: string;
|
|
72
72
|
purpose: "work" | "verify";
|
|
73
73
|
taskId?: string;
|
|
74
|
+
/** The task's Work Items id this run was dispatched for (spec 052, D4). */
|
|
75
|
+
item?: string;
|
|
74
76
|
workingDirectory: string;
|
|
75
77
|
artifactDir: string;
|
|
76
78
|
status: RunStatus;
|
|
@@ -80,9 +82,8 @@ export interface RunRecord extends RunUsage {
|
|
|
80
82
|
failureReason?: string;
|
|
81
83
|
turns?: number;
|
|
82
84
|
toolCalls?: number;
|
|
85
|
+
/** The checker's declared `VERDICT:` for a `purpose=verify` run (spec 052, D6): information for the leader, not a gate. */
|
|
83
86
|
verificationVerdict?: "pass" | "fail";
|
|
84
|
-
/** `enforced` only for a structurally read-only verifier; write-capable/external runs are advisory. */
|
|
85
|
-
verificationStrength?: "enforced" | "advisory";
|
|
86
87
|
/** P2-2: `git status --porcelain` taken right after a `mutates: "write"` run finished, so the
|
|
87
88
|
* wake's reader does not have to spend its own first tool call finding out what changed. */
|
|
88
89
|
workspaceSummary?: string;
|
|
@@ -96,8 +97,8 @@ export interface RunRecord extends RunUsage {
|
|
|
96
97
|
settlementPending?: PendingSettlement;
|
|
97
98
|
/** Set once this run's usage has been written to the ledger; guards against double billing. */
|
|
98
99
|
usageRecorded?: boolean;
|
|
99
|
-
/** Set once this run's cost
|
|
100
|
-
*
|
|
100
|
+
/** Set once this run's cost has been credited to its task. Separate from `usageRecorded` so a
|
|
101
|
+
* replayed settlement can never credit it twice. */
|
|
101
102
|
taskAccounted?: boolean;
|
|
102
103
|
/** Set once the completion wake has been hallmarked for delivery; guards against a duplicate wake. */
|
|
103
104
|
wakeEnqueued?: boolean;
|
|
@@ -119,19 +120,14 @@ export interface RunRecord extends RunUsage {
|
|
|
119
120
|
sessionId?: string;
|
|
120
121
|
leaseKey?: string;
|
|
121
122
|
mutates?: RunMutates;
|
|
122
|
-
/** Persisted at launch so restart reconciliation has the same inputs as a live verifier. */
|
|
123
|
-
verifySubjectBefore?: string;
|
|
124
|
-
/** Fixed commit and initial untracked manifest for the base-relative verification subject. */
|
|
125
|
-
verifyBaseCommit?: string;
|
|
126
|
-
verifyBaselineUntrackedPaths?: string[];
|
|
127
123
|
/** Spec 042 D1: the role's wall-time budget, persisted so restart reconciliation can report an
|
|
128
124
|
* accurate "budget exceeded (Ns)" reason instead of reverse-engineering it from `deadlineAt`. */
|
|
129
125
|
maxWallTimeSec?: number;
|
|
130
126
|
/** Spec 042 D1: the real process start time (`setLaunched` time), as opposed to `startedAt`
|
|
131
127
|
* (registration time) — restart reconciliation's duration estimate is measured from here. */
|
|
132
128
|
processStartedAt?: number;
|
|
133
|
-
/**
|
|
134
|
-
*
|
|
129
|
+
/** This run's channel directory, so settlement (including restart reconciliation) can reach the
|
|
130
|
+
* owning task's log (spec 052, D4). */
|
|
135
131
|
channelDir?: string;
|
|
136
132
|
/** True when `durationMs` is a restart-reconciliation estimate rather than a measured process
|
|
137
133
|
* lifetime (spec 042 D1) — display surfaces prefix it with "≈". */
|
|
@@ -163,11 +159,12 @@ export interface RegisterRunInput {
|
|
|
163
159
|
model?: string;
|
|
164
160
|
purpose: "work" | "verify";
|
|
165
161
|
taskId?: string;
|
|
162
|
+
item?: string;
|
|
166
163
|
workingDirectory: string;
|
|
167
164
|
artifactDir: string;
|
|
168
|
-
/** This run's channel directory — where its owning task lives
|
|
169
|
-
*
|
|
170
|
-
*
|
|
165
|
+
/** This run's channel directory — where its owning task lives. Set at registration for every
|
|
166
|
+
* runtime, so settlement can credit the task whether the run was internal or external; the
|
|
167
|
+
* external launch path re-persists it with the rest of its info. */
|
|
171
168
|
channelDir?: string;
|
|
172
169
|
/** Set only when the caller already holds a workspace write lease for this run (D10.1). */
|
|
173
170
|
leaseKey?: string;
|
|
@@ -184,7 +181,6 @@ interface PendingSettlement {
|
|
|
184
181
|
durationMs: number;
|
|
185
182
|
durationEstimated?: boolean;
|
|
186
183
|
verificationVerdict?: "pass" | "fail";
|
|
187
|
-
verificationStrength?: "enforced" | "advisory";
|
|
188
184
|
workspaceSummary?: string;
|
|
189
185
|
sessionId?: string;
|
|
190
186
|
finishedAt: number;
|
|
@@ -205,7 +201,6 @@ export interface SettleInput {
|
|
|
205
201
|
/** Full reply text. Settlement saves it to `output.md`; only its tail goes in the wake. */
|
|
206
202
|
outputText: string;
|
|
207
203
|
verificationVerdict?: "pass" | "fail";
|
|
208
|
-
verificationStrength?: "enforced" | "advisory";
|
|
209
204
|
/** P2-2: see `RunRecord.workspaceSummary`. */
|
|
210
205
|
workspaceSummary?: string;
|
|
211
206
|
/** The harness's own session/thread id, captured even on failure so a later resume can still use it. */
|
|
@@ -323,9 +318,6 @@ export declare class SubAgentRunManager {
|
|
|
323
318
|
/** Spec 042 D1: everything a restart reconciliation might need if this daemon disappears
|
|
324
319
|
* before the process exits — restore/deadline recovery must have the same inputs a live watcher
|
|
325
320
|
* would, not a thinner subset. */
|
|
326
|
-
verifySubjectBefore?: string;
|
|
327
|
-
verifyBaseCommit?: string;
|
|
328
|
-
verifyBaselineUntrackedPaths?: string[];
|
|
329
321
|
maxWallTimeSec?: number;
|
|
330
322
|
processStartedAt?: number;
|
|
331
323
|
channelDir?: string;
|
|
@@ -367,17 +359,11 @@ export declare class SubAgentRunManager {
|
|
|
367
359
|
announce: boolean;
|
|
368
360
|
}): Promise<void>;
|
|
369
361
|
/**
|
|
370
|
-
* Credit one settled run to the task that owns it: cost onto
|
|
371
|
-
*
|
|
372
|
-
*
|
|
362
|
+
* Credit one settled run to the task that owns it: cost onto its usage, outcome onto its log.
|
|
363
|
+
* Best-effort by design: a task whose file has since been archived or hand-deleted must not
|
|
364
|
+
* block the completion wake.
|
|
373
365
|
*/
|
|
374
366
|
private creditOwningTask;
|
|
375
|
-
/**
|
|
376
|
-
* The `purpose=work` run this verdict most plausibly judged: the same task's latest work run
|
|
377
|
-
* started before the verifier. Left `undefined` rather than guessed when there is none — an
|
|
378
|
-
* unattributed round is honest, a wrong attribution is not.
|
|
379
|
-
*/
|
|
380
|
-
private latestWorkRunFor;
|
|
381
367
|
/**
|
|
382
368
|
* Dispatch the completion wake. Durable-dispatch persists its own pending record before this
|
|
383
369
|
* call can be interrupted (`DurableDispatchService.dispatch`), and `dispatch()` is idempotent on
|