@oyasmi/pipiclaw 0.8.10-beta.1 → 0.8.10-beta.2
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.md +3 -3
- package/dist/index.d.ts +16 -34
- package/dist/index.js +14 -32
- package/dist/memory/maintenance-tuning.d.ts +37 -0
- package/dist/memory/maintenance-tuning.js +46 -0
- package/dist/memory/task-digest.js +2 -3
- package/dist/paths.d.ts +0 -1
- package/dist/paths.js +0 -1
- package/dist/playbooks/task-delegation.md +7 -13
- package/dist/playbooks/task-driving.md +0 -1
- package/dist/playbooks/task-planning.md +3 -5
- package/dist/runtime/bootstrap.d.ts +14 -0
- package/dist/runtime/bootstrap.js +8 -0
- package/dist/runtime/task-commands.js +34 -80
- package/dist/runtime/task-driver.js +3 -22
- package/dist/settings.d.ts +39 -30
- package/dist/settings.js +87 -83
- package/dist/shared/task-ledger.d.ts +8 -2
- package/dist/shared/task-ledger.js +9 -2
- package/dist/subagents/tool.d.ts +1 -5
- package/dist/subagents/tool.js +5 -107
- package/dist/tasks/control.d.ts +42 -23
- package/dist/tasks/control.js +61 -83
- package/dist/tasks/store.d.ts +0 -4
- package/dist/tasks/store.js +0 -46
- package/dist/tasks/verification.d.ts +10 -6
- package/dist/tasks/verification.js +0 -6
- package/dist/tools/memory-manage.js +46 -24
- package/dist/tools/registry.js +0 -2
- package/dist/tools/task-manage/create.js +1 -3
- package/dist/tools/task-manage/lifecycle.js +13 -34
- package/dist/tools/task-manage/schema.d.ts +0 -5
- package/dist/tools/task-manage/schema.js +1 -9
- package/dist/tools/task-manage/shared.d.ts +0 -3
- package/dist/tools/task-manage/shared.js +6 -68
- package/dist/tools/task-manage/types.d.ts +0 -2
- package/dist/tools/task-manage/verification.js +4 -4
- package/package.json +3 -1
|
@@ -6,7 +6,7 @@ import { PLAYBOOKS_DIR } from "../paths.js";
|
|
|
6
6
|
import { normalizeTaskFields, readActiveTasks } from "../shared/task-ledger.js";
|
|
7
7
|
import { errorMessage } from "../shared/text-utils.js";
|
|
8
8
|
import { taskBudgetViolation } from "../tasks/control.js";
|
|
9
|
-
import { claimTaskAttempt,
|
|
9
|
+
import { claimTaskAttempt, escalateTask, openRecurringTaskCycle, releaseTaskAttemptClaim, updateStoredTask, } from "../tasks/store.js";
|
|
10
10
|
import { TERMINAL_TASK_STATUSES } from "../tasks/transitions.js";
|
|
11
11
|
/** Short debounce so a burst of nudges collapses into a single rescan. */
|
|
12
12
|
const NUDGE_DEBOUNCE_MS = 50;
|
|
@@ -150,14 +150,6 @@ function taskEscalationEvent(channelId, entry, reason, nowMs) {
|
|
|
150
150
|
dispatchId: `task:${channelId}:${entry.id}:escalation:${createHash("sha256").update(reason).digest("hex").slice(0, 12)}`,
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
-
function terminalDependencyReason(reason) {
|
|
154
|
-
return reason?.includes(" is missing") ||
|
|
155
|
-
reason?.includes(" is cancelled") ||
|
|
156
|
-
reason?.includes(" is paused by the governor") ||
|
|
157
|
-
reason?.includes("dependency cycle")
|
|
158
|
-
? reason
|
|
159
|
-
: undefined;
|
|
160
|
-
}
|
|
161
153
|
/**
|
|
162
154
|
* Native, token-gated driver for the persistent task ledger.
|
|
163
155
|
*
|
|
@@ -319,8 +311,7 @@ export class TaskDriver {
|
|
|
319
311
|
const control = candidate.frontmatter.control;
|
|
320
312
|
if (!control || TERMINAL_STATUSES.has(status ?? ""))
|
|
321
313
|
continue;
|
|
322
|
-
const
|
|
323
|
-
const escalationReason = taskBudgetViolation(control, nowMs) ?? terminalDependencyReason(dependencies.reason);
|
|
314
|
+
const escalationReason = taskBudgetViolation(control, nowMs);
|
|
324
315
|
if (!escalationReason)
|
|
325
316
|
continue;
|
|
326
317
|
governanceHandled = true;
|
|
@@ -347,17 +338,7 @@ export class TaskDriver {
|
|
|
347
338
|
const rotatedCandidates = lastIndex >= 0
|
|
348
339
|
? [...candidates.slice(lastIndex + 1), ...candidates.slice(0, lastIndex + 1)]
|
|
349
340
|
: candidates;
|
|
350
|
-
let entry;
|
|
351
|
-
for (const candidate of rotatedCandidates) {
|
|
352
|
-
const control = candidate.frontmatter.control;
|
|
353
|
-
if (control) {
|
|
354
|
-
const dependencies = await dependencyState(channelDir, control.dependsOn, candidate.id);
|
|
355
|
-
if (!dependencies.ready)
|
|
356
|
-
continue;
|
|
357
|
-
}
|
|
358
|
-
entry = candidate;
|
|
359
|
-
break;
|
|
360
|
-
}
|
|
341
|
+
let entry = rotatedCandidates[0];
|
|
361
342
|
if (!entry || dispatched >= settings.maxDispatchesPerTick)
|
|
362
343
|
continue;
|
|
363
344
|
// A cycle-start-ready recurring task is reopened in-process before dispatch: fold the
|
package/dist/settings.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
|
|
10
10
|
import type { Transport } from "@earendil-works/pi-ai";
|
|
11
|
+
import { type MemoryMaintenanceTuning } from "./memory/maintenance-tuning.js";
|
|
11
12
|
import type { ResponseMode } from "./runtime/dingtalk.js";
|
|
12
13
|
import type { ConfigDiagnostic } from "./shared/config-diagnostics.js";
|
|
13
14
|
type PackageSource = string | {
|
|
@@ -80,26 +81,12 @@ export interface PipiclawSessionMemorySettings {
|
|
|
80
81
|
minTurnsBetweenUpdate: number;
|
|
81
82
|
minToolCallsBetweenUpdate: number;
|
|
82
83
|
timeoutMs: number;
|
|
83
|
-
failureBackoffTurns: number;
|
|
84
84
|
forceRefreshBeforeCompact: boolean;
|
|
85
85
|
forceRefreshBeforeNewSession: boolean;
|
|
86
86
|
}
|
|
87
|
-
export
|
|
87
|
+
export type PipiclawMemoryMaintenanceSettings = MemoryMaintenanceTuning & {
|
|
88
88
|
enabled: boolean;
|
|
89
|
-
|
|
90
|
-
sessionRefreshIntervalMinutes: number;
|
|
91
|
-
/** Idle cadence of the merged memory checkpoint (durable extraction) job. */
|
|
92
|
-
checkpointIntervalMinutes: number;
|
|
93
|
-
/** Confidence bar a candidate must clear before it is written to MEMORY.md. */
|
|
94
|
-
minMemoryAutoWriteConfidence: number;
|
|
95
|
-
structuralMaintenanceIntervalHours: number;
|
|
96
|
-
maxConcurrentChannels: number;
|
|
97
|
-
failureBackoffMinutes: number;
|
|
98
|
-
/** Reject a MEMORY.md cleanup whose result shrinks below this ratio of the original. */
|
|
99
|
-
cleanupShrinkGuardMinRatio: number;
|
|
100
|
-
/** Only apply the shrink guard when the original exceeds this length (chars). */
|
|
101
|
-
cleanupShrinkGuardMinChars: number;
|
|
102
|
-
}
|
|
89
|
+
};
|
|
103
90
|
export interface PipiclawLoggingSettings {
|
|
104
91
|
level: "debug" | "info" | "warn" | "error";
|
|
105
92
|
file: {
|
|
@@ -109,13 +96,21 @@ export interface PipiclawLoggingSettings {
|
|
|
109
96
|
};
|
|
110
97
|
}
|
|
111
98
|
export interface PipiclawSessionSearchSettings {
|
|
112
|
-
enabled: boolean;
|
|
113
99
|
maxFiles: number;
|
|
114
100
|
maxChunks: number;
|
|
115
101
|
maxCharsPerChunk: number;
|
|
116
102
|
summarizeWithModel: boolean;
|
|
117
103
|
timeoutMs: number;
|
|
118
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Everything `settings.json` may contain (spec 035 D1).
|
|
107
|
+
*
|
|
108
|
+
* The rule: a key earns a place here only if it expresses product intent —
|
|
109
|
+
* which model to use, whether a subsystem runs, whether an optional LLM call is
|
|
110
|
+
* worth its tokens, what the output looks like. Every numeric threshold is an
|
|
111
|
+
* algorithm parameter and lives in code. Keys retired by that rule are listed
|
|
112
|
+
* in `RETIRED_SETTINGS_KEYS` and reported as warnings on load.
|
|
113
|
+
*/
|
|
119
114
|
export interface PipiclawSettings {
|
|
120
115
|
defaultProvider?: string;
|
|
121
116
|
defaultModel?: string;
|
|
@@ -128,16 +123,32 @@ export interface PipiclawSettings {
|
|
|
128
123
|
* frontmatter `model`; falls back to the parent's current model when unset.
|
|
129
124
|
*/
|
|
130
125
|
subagentModel?: string | null;
|
|
131
|
-
compaction?:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
126
|
+
compaction?: {
|
|
127
|
+
enabled?: boolean;
|
|
128
|
+
};
|
|
129
|
+
retry?: {
|
|
130
|
+
enabled?: boolean;
|
|
131
|
+
};
|
|
132
|
+
memoryRecall?: {
|
|
133
|
+
enabled?: boolean;
|
|
134
|
+
/** Costs an extra LLM call, so it stays a user decision rather than a constant. */
|
|
135
|
+
rerankWithModel?: boolean | "auto";
|
|
136
|
+
};
|
|
137
|
+
sessionMemory?: {
|
|
138
|
+
enabled?: boolean;
|
|
139
|
+
};
|
|
140
|
+
memoryMaintenance?: {
|
|
141
|
+
enabled?: boolean;
|
|
142
|
+
};
|
|
143
|
+
sessionSearch?: {
|
|
144
|
+
/** Costs an extra LLM call per search hit; same reasoning as `rerankWithModel`. */
|
|
145
|
+
summarizeWithModel?: boolean;
|
|
146
|
+
};
|
|
147
|
+
logging?: {
|
|
148
|
+
level?: PipiclawLoggingSettings["level"];
|
|
149
|
+
file?: {
|
|
150
|
+
enabled?: boolean;
|
|
151
|
+
};
|
|
141
152
|
};
|
|
142
153
|
tui?: Partial<PipiclawTuiSettings>;
|
|
143
154
|
}
|
|
@@ -159,6 +170,7 @@ export declare class PipiclawSettingsManager {
|
|
|
159
170
|
private settingsPath;
|
|
160
171
|
private settings;
|
|
161
172
|
private loadErrors;
|
|
173
|
+
private retiredKeys;
|
|
162
174
|
constructor(baseDir: string);
|
|
163
175
|
private load;
|
|
164
176
|
private save;
|
|
@@ -206,8 +218,6 @@ export declare class PipiclawSettingsManager {
|
|
|
206
218
|
setBlockImages(_blocked: boolean): void;
|
|
207
219
|
getShowImages(): boolean;
|
|
208
220
|
setShowImages(_show: boolean): void;
|
|
209
|
-
getCompactionReserveTokens(): number;
|
|
210
|
-
getCompactionKeepRecentTokens(): number;
|
|
211
221
|
getBranchSummarySettings(): {
|
|
212
222
|
reserveTokens: number;
|
|
213
223
|
};
|
|
@@ -270,7 +280,6 @@ export declare class PipiclawSettingsManager {
|
|
|
270
280
|
getProjectSettings(): Settings;
|
|
271
281
|
isProjectTrusted(): boolean;
|
|
272
282
|
setProjectTrusted(_trusted: boolean): void;
|
|
273
|
-
applyOverrides(overrides: Partial<Settings>): void;
|
|
274
283
|
flush(): Promise<void>;
|
|
275
284
|
}
|
|
276
285
|
export {};
|
package/dist/settings.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
10
10
|
import { dirname, join } from "path";
|
|
11
11
|
import * as log from "./log.js";
|
|
12
|
+
import { getMemoryMaintenanceTuning, getSessionRefreshCadence, } from "./memory/maintenance-tuning.js";
|
|
12
13
|
const DEFAULT_TUI = {
|
|
13
14
|
responseMode: "full_progress_then_plain_final",
|
|
14
15
|
};
|
|
@@ -49,30 +50,17 @@ const DEFAULT_SESSION_MEMORY = {
|
|
|
49
50
|
minTurnsBetweenUpdate: 2,
|
|
50
51
|
minToolCallsBetweenUpdate: 4,
|
|
51
52
|
timeoutMs: 30_000,
|
|
52
|
-
failureBackoffTurns: 3,
|
|
53
53
|
forceRefreshBeforeCompact: true,
|
|
54
54
|
forceRefreshBeforeNewSession: true,
|
|
55
55
|
};
|
|
56
56
|
const DEFAULT_SESSION_SEARCH = {
|
|
57
|
-
enabled: true,
|
|
58
57
|
maxFiles: 12,
|
|
59
58
|
maxChunks: 80,
|
|
60
59
|
maxCharsPerChunk: 1200,
|
|
61
60
|
summarizeWithModel: false,
|
|
62
61
|
timeoutMs: 12_000,
|
|
63
62
|
};
|
|
64
|
-
const
|
|
65
|
-
enabled: true,
|
|
66
|
-
minIdleMinutesBeforeLlmWork: 10,
|
|
67
|
-
sessionRefreshIntervalMinutes: 10,
|
|
68
|
-
checkpointIntervalMinutes: 20,
|
|
69
|
-
minMemoryAutoWriteConfidence: 0.85,
|
|
70
|
-
structuralMaintenanceIntervalHours: 6,
|
|
71
|
-
maxConcurrentChannels: 1,
|
|
72
|
-
failureBackoffMinutes: 30,
|
|
73
|
-
cleanupShrinkGuardMinRatio: 0.4,
|
|
74
|
-
cleanupShrinkGuardMinChars: 2_000,
|
|
75
|
-
};
|
|
63
|
+
const DEFAULT_MEMORY_MAINTENANCE_ENABLED = true;
|
|
76
64
|
// `file.enabled` defaults to true: for a long-lived daemon, persisting logs is
|
|
77
65
|
// worth more than the surprise of a new file under state/logs/. See docs.
|
|
78
66
|
const DEFAULT_LOGGING = {
|
|
@@ -83,6 +71,65 @@ const DEFAULT_LOGGING = {
|
|
|
83
71
|
maxFiles: 3,
|
|
84
72
|
},
|
|
85
73
|
};
|
|
74
|
+
/**
|
|
75
|
+
* Keys that used to be configurable and are now constants (spec 035 D3).
|
|
76
|
+
*
|
|
77
|
+
* Leaving them in `settings.json` is harmless — the runtime uses the constant —
|
|
78
|
+
* but silently ignoring a value someone deliberately tuned is worse than saying
|
|
79
|
+
* so once at startup. Matched exactly; no general unknown-key sweep, because
|
|
80
|
+
* `settings.json` also carries upstream pi-mono fields that we must not flag.
|
|
81
|
+
*/
|
|
82
|
+
const RETIRED_SETTINGS_KEYS = [
|
|
83
|
+
"compaction.reserveTokens",
|
|
84
|
+
"compaction.keepRecentTokens",
|
|
85
|
+
"retry.maxRetries",
|
|
86
|
+
"retry.baseDelayMs",
|
|
87
|
+
"memoryRecall.maxCandidates",
|
|
88
|
+
"memoryRecall.maxInjected",
|
|
89
|
+
"memoryRecall.maxChars",
|
|
90
|
+
"sessionMemory.minTurnsBetweenUpdate",
|
|
91
|
+
"sessionMemory.minToolCallsBetweenUpdate",
|
|
92
|
+
"sessionMemory.timeoutMs",
|
|
93
|
+
"sessionMemory.failureBackoffTurns",
|
|
94
|
+
"sessionMemory.forceRefreshBeforeCompact",
|
|
95
|
+
"sessionMemory.forceRefreshBeforeNewSession",
|
|
96
|
+
"memoryMaintenance.minIdleMinutesBeforeLlmWork",
|
|
97
|
+
"memoryMaintenance.sessionRefreshIntervalMinutes",
|
|
98
|
+
"memoryMaintenance.checkpointIntervalMinutes",
|
|
99
|
+
"memoryMaintenance.minMemoryAutoWriteConfidence",
|
|
100
|
+
"memoryMaintenance.structuralMaintenanceIntervalHours",
|
|
101
|
+
"memoryMaintenance.maxConcurrentChannels",
|
|
102
|
+
"memoryMaintenance.failureBackoffMinutes",
|
|
103
|
+
"memoryMaintenance.cleanupShrinkGuardMinRatio",
|
|
104
|
+
"memoryMaintenance.cleanupShrinkGuardMinChars",
|
|
105
|
+
"sessionSearch.enabled",
|
|
106
|
+
"sessionSearch.maxFiles",
|
|
107
|
+
"sessionSearch.maxChunks",
|
|
108
|
+
"sessionSearch.maxCharsPerChunk",
|
|
109
|
+
"sessionSearch.timeoutMs",
|
|
110
|
+
"logging.file.maxSizeBytes",
|
|
111
|
+
"logging.file.maxFiles",
|
|
112
|
+
"taskDigest.maxTasks",
|
|
113
|
+
"taskDigest.maxChars",
|
|
114
|
+
"taskDriver.continuationDelayMinutes",
|
|
115
|
+
"taskDriver.stalledRetryMinutes",
|
|
116
|
+
"taskDriver.maxDispatchesPerTick",
|
|
117
|
+
"taskDriver.maxSleepMinutes",
|
|
118
|
+
];
|
|
119
|
+
function hasNestedKey(root, dottedPath) {
|
|
120
|
+
let node = root;
|
|
121
|
+
for (const segment of dottedPath.split(".")) {
|
|
122
|
+
if (!node || typeof node !== "object" || Array.isArray(node))
|
|
123
|
+
return false;
|
|
124
|
+
if (!Object.hasOwn(node, segment))
|
|
125
|
+
return false;
|
|
126
|
+
node = node[segment];
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
function findRetiredSettingsKeys(parsed) {
|
|
131
|
+
return RETIRED_SETTINGS_KEYS.filter((key) => hasNestedKey(parsed, key));
|
|
132
|
+
}
|
|
86
133
|
/**
|
|
87
134
|
* Settings manager for pipiclaw.
|
|
88
135
|
* Stores global settings in the pipiclaw root directory.
|
|
@@ -90,11 +137,13 @@ const DEFAULT_LOGGING = {
|
|
|
90
137
|
export class PipiclawSettingsManager {
|
|
91
138
|
constructor(baseDir) {
|
|
92
139
|
this.loadErrors = [];
|
|
140
|
+
this.retiredKeys = [];
|
|
93
141
|
this.settingsPath = join(baseDir, "settings.json");
|
|
94
142
|
this.settings = this.load();
|
|
95
143
|
}
|
|
96
144
|
load() {
|
|
97
145
|
this.loadErrors = [];
|
|
146
|
+
this.retiredKeys = [];
|
|
98
147
|
if (!existsSync(this.settingsPath)) {
|
|
99
148
|
return {};
|
|
100
149
|
}
|
|
@@ -108,6 +157,7 @@ export class PipiclawSettingsManager {
|
|
|
108
157
|
});
|
|
109
158
|
return {};
|
|
110
159
|
}
|
|
160
|
+
this.retiredKeys = findRetiredSettingsKeys(parsed);
|
|
111
161
|
return parsed;
|
|
112
162
|
}
|
|
113
163
|
catch (error) {
|
|
@@ -139,17 +189,26 @@ export class PipiclawSettingsManager {
|
|
|
139
189
|
return errors;
|
|
140
190
|
}
|
|
141
191
|
getDiagnostics() {
|
|
142
|
-
|
|
192
|
+
const diagnostics = this.loadErrors.map(({ error }) => ({
|
|
143
193
|
source: "settings",
|
|
144
194
|
path: this.settingsPath,
|
|
145
195
|
severity: "error",
|
|
146
196
|
message: error.message,
|
|
147
197
|
}));
|
|
198
|
+
if (this.retiredKeys.length > 0) {
|
|
199
|
+
diagnostics.push({
|
|
200
|
+
source: "settings",
|
|
201
|
+
path: this.settingsPath,
|
|
202
|
+
severity: "warning",
|
|
203
|
+
message: `${this.retiredKeys.join(", ")}: no longer configurable; these are now built-in constants and the values here are ignored. Remove them from settings.json.`,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
return diagnostics;
|
|
148
207
|
}
|
|
149
208
|
getCompactionSettings() {
|
|
150
209
|
return {
|
|
151
210
|
...DEFAULT_COMPACTION,
|
|
152
|
-
|
|
211
|
+
enabled: this.settings.compaction?.enabled ?? DEFAULT_COMPACTION.enabled,
|
|
153
212
|
};
|
|
154
213
|
}
|
|
155
214
|
getCompactionEnabled() {
|
|
@@ -162,70 +221,48 @@ export class PipiclawSettingsManager {
|
|
|
162
221
|
getRetrySettings() {
|
|
163
222
|
return {
|
|
164
223
|
...DEFAULT_RETRY,
|
|
165
|
-
|
|
224
|
+
enabled: this.settings.retry?.enabled ?? DEFAULT_RETRY.enabled,
|
|
166
225
|
};
|
|
167
226
|
}
|
|
168
227
|
getMemoryRecallSettings() {
|
|
169
228
|
return {
|
|
170
229
|
...DEFAULT_MEMORY_RECALL,
|
|
171
|
-
|
|
230
|
+
enabled: this.settings.memoryRecall?.enabled ?? DEFAULT_MEMORY_RECALL.enabled,
|
|
231
|
+
rerankWithModel: this.settings.memoryRecall?.rerankWithModel ?? DEFAULT_MEMORY_RECALL.rerankWithModel,
|
|
172
232
|
};
|
|
173
233
|
}
|
|
174
234
|
getTaskDigestSettings() {
|
|
175
|
-
return {
|
|
176
|
-
...DEFAULT_TASK_DIGEST,
|
|
177
|
-
...this.settings.taskDigest,
|
|
178
|
-
};
|
|
235
|
+
return { ...DEFAULT_TASK_DIGEST };
|
|
179
236
|
}
|
|
180
237
|
getTaskDriverSettings() {
|
|
181
|
-
|
|
182
|
-
...DEFAULT_TASK_DRIVER,
|
|
183
|
-
...this.settings.taskDriver,
|
|
184
|
-
};
|
|
185
|
-
const continuationDelayMinutes = Number.isFinite(configured.continuationDelayMinutes)
|
|
186
|
-
? Math.min(60, Math.max(1, Math.floor(configured.continuationDelayMinutes)))
|
|
187
|
-
: DEFAULT_TASK_DRIVER.continuationDelayMinutes;
|
|
188
|
-
const stalledRetryMinutes = Number.isFinite(configured.stalledRetryMinutes)
|
|
189
|
-
? Math.min(24 * 60, Math.max(continuationDelayMinutes, Math.floor(configured.stalledRetryMinutes)))
|
|
190
|
-
: DEFAULT_TASK_DRIVER.stalledRetryMinutes;
|
|
191
|
-
const maxDispatchesPerTick = Number.isFinite(configured.maxDispatchesPerTick)
|
|
192
|
-
? Math.min(20, Math.max(1, Math.floor(configured.maxDispatchesPerTick)))
|
|
193
|
-
: DEFAULT_TASK_DRIVER.maxDispatchesPerTick;
|
|
194
|
-
const maxSleepMinutes = Number.isFinite(configured.maxSleepMinutes)
|
|
195
|
-
? Math.min(60, Math.max(1, Math.floor(configured.maxSleepMinutes)))
|
|
196
|
-
: DEFAULT_TASK_DRIVER.maxSleepMinutes;
|
|
197
|
-
return {
|
|
198
|
-
continuationDelayMinutes,
|
|
199
|
-
stalledRetryMinutes,
|
|
200
|
-
maxDispatchesPerTick,
|
|
201
|
-
maxSleepMinutes,
|
|
202
|
-
};
|
|
238
|
+
return { ...DEFAULT_TASK_DRIVER };
|
|
203
239
|
}
|
|
204
240
|
getSessionMemorySettings() {
|
|
205
241
|
return {
|
|
206
242
|
...DEFAULT_SESSION_MEMORY,
|
|
207
|
-
...
|
|
243
|
+
...getSessionRefreshCadence(),
|
|
244
|
+
enabled: this.settings.sessionMemory?.enabled ?? DEFAULT_SESSION_MEMORY.enabled,
|
|
208
245
|
};
|
|
209
246
|
}
|
|
210
247
|
getMemoryMaintenanceSettings() {
|
|
211
248
|
return {
|
|
212
|
-
...
|
|
213
|
-
|
|
249
|
+
...getMemoryMaintenanceTuning(),
|
|
250
|
+
enabled: this.settings.memoryMaintenance?.enabled ?? DEFAULT_MEMORY_MAINTENANCE_ENABLED,
|
|
214
251
|
};
|
|
215
252
|
}
|
|
216
253
|
getSessionSearchSettings() {
|
|
217
254
|
return {
|
|
218
255
|
...DEFAULT_SESSION_SEARCH,
|
|
219
|
-
|
|
256
|
+
summarizeWithModel: this.settings.sessionSearch?.summarizeWithModel ?? DEFAULT_SESSION_SEARCH.summarizeWithModel,
|
|
220
257
|
};
|
|
221
258
|
}
|
|
222
259
|
getLoggingSettings() {
|
|
223
260
|
return {
|
|
224
261
|
...DEFAULT_LOGGING,
|
|
225
|
-
|
|
262
|
+
level: this.settings.logging?.level ?? DEFAULT_LOGGING.level,
|
|
226
263
|
file: {
|
|
227
264
|
...DEFAULT_LOGGING.file,
|
|
228
|
-
|
|
265
|
+
enabled: this.settings.logging?.file?.enabled ?? DEFAULT_LOGGING.file.enabled,
|
|
229
266
|
},
|
|
230
267
|
};
|
|
231
268
|
}
|
|
@@ -319,13 +356,6 @@ export class PipiclawSettingsManager {
|
|
|
319
356
|
setShowImages(_show) {
|
|
320
357
|
// No-op
|
|
321
358
|
}
|
|
322
|
-
// Compaction details
|
|
323
|
-
getCompactionReserveTokens() {
|
|
324
|
-
return this.getCompactionSettings().reserveTokens;
|
|
325
|
-
}
|
|
326
|
-
getCompactionKeepRecentTokens() {
|
|
327
|
-
return this.getCompactionSettings().keepRecentTokens;
|
|
328
|
-
}
|
|
329
359
|
getBranchSummarySettings() {
|
|
330
360
|
return { reserveTokens: this.getCompactionSettings().reserveTokens };
|
|
331
361
|
}
|
|
@@ -509,32 +539,6 @@ export class PipiclawSettingsManager {
|
|
|
509
539
|
setProjectTrusted(_trusted) {
|
|
510
540
|
// Pipiclaw handles workspace authorization at the DingTalk/runtime boundary.
|
|
511
541
|
}
|
|
512
|
-
applyOverrides(overrides) {
|
|
513
|
-
if (overrides.defaultProvider !== undefined)
|
|
514
|
-
this.settings.defaultProvider = overrides.defaultProvider;
|
|
515
|
-
if (overrides.defaultModel !== undefined)
|
|
516
|
-
this.settings.defaultModel = overrides.defaultModel;
|
|
517
|
-
if (overrides.defaultThinkingLevel !== undefined) {
|
|
518
|
-
this.settings.defaultThinkingLevel = overrides.defaultThinkingLevel;
|
|
519
|
-
}
|
|
520
|
-
if (overrides.compaction !== undefined) {
|
|
521
|
-
this.settings.compaction = {
|
|
522
|
-
...this.settings.compaction,
|
|
523
|
-
enabled: overrides.compaction.enabled ?? this.settings.compaction?.enabled,
|
|
524
|
-
reserveTokens: overrides.compaction.reserveTokens ?? this.settings.compaction?.reserveTokens,
|
|
525
|
-
keepRecentTokens: overrides.compaction.keepRecentTokens ?? this.settings.compaction?.keepRecentTokens,
|
|
526
|
-
};
|
|
527
|
-
}
|
|
528
|
-
if (overrides.retry !== undefined) {
|
|
529
|
-
this.settings.retry = {
|
|
530
|
-
...this.settings.retry,
|
|
531
|
-
enabled: overrides.retry.enabled ?? this.settings.retry?.enabled,
|
|
532
|
-
maxRetries: overrides.retry.maxRetries ?? this.settings.retry?.maxRetries,
|
|
533
|
-
baseDelayMs: overrides.retry.baseDelayMs ?? this.settings.retry?.baseDelayMs,
|
|
534
|
-
};
|
|
535
|
-
}
|
|
536
|
-
this.save();
|
|
537
|
-
}
|
|
538
542
|
flush() {
|
|
539
543
|
return Promise.resolve();
|
|
540
544
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TaskControl
|
|
1
|
+
import { type TaskControl } from "../tasks/control.js";
|
|
2
2
|
/**
|
|
3
3
|
* Shared reader for the task ledger (`workspace/<channelId>/tasks/*.md`).
|
|
4
4
|
*
|
|
@@ -22,6 +22,12 @@ export interface TaskFrontmatter {
|
|
|
22
22
|
control?: TaskControl;
|
|
23
23
|
/** false only when a control field exists but cannot be parsed/validated. */
|
|
24
24
|
controlReadable?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The control block exactly as stored, before `parseTaskControl` drops retired keys.
|
|
27
|
+
* `/tasks doctor` needs this to report what an older build wrote (spec 036, D8) — the
|
|
28
|
+
* parsed `control` above cannot show a key whose whole point is that it is now ignored.
|
|
29
|
+
*/
|
|
30
|
+
rawControl?: unknown;
|
|
25
31
|
}
|
|
26
32
|
export interface TaskLedgerEntry {
|
|
27
33
|
/** Filename without `.md`; the task id. */
|
|
@@ -42,7 +48,7 @@ export interface TaskSkeletonInput {
|
|
|
42
48
|
dod: string;
|
|
43
49
|
manual?: string;
|
|
44
50
|
verificationPlan?: string;
|
|
45
|
-
|
|
51
|
+
verificationRequired?: boolean;
|
|
46
52
|
}
|
|
47
53
|
export declare const DEFAULT_TASK_MANUAL = "- Follow the DoD, keep the current cycle log updated, and schedule check-ins when waiting.";
|
|
48
54
|
export declare const STANDARD_TASK_SECTIONS: readonly [{
|
|
@@ -79,6 +79,12 @@ export function parseTaskFrontmatter(content) {
|
|
|
79
79
|
frontmatter.controlReadable = false;
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
|
+
try {
|
|
83
|
+
frontmatter.rawControl = JSON.parse(value);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
// Leave rawControl unset; the parse below reports the real problem.
|
|
87
|
+
}
|
|
82
88
|
try {
|
|
83
89
|
frontmatter.control = parseTaskControl(value);
|
|
84
90
|
frontmatter.controlReadable = true;
|
|
@@ -204,7 +210,6 @@ export function renderStandardTaskBody(input) {
|
|
|
204
210
|
const manual = input.manual?.trim() || DEFAULT_TASK_MANUAL;
|
|
205
211
|
const verificationPlan = input.verificationPlan?.trim() ||
|
|
206
212
|
"- Check every DoD item against concrete evidence.\n- Run the relevant deterministic checks before declaring PASS.";
|
|
207
|
-
const verificationMode = input.verificationMode ?? "independent";
|
|
208
213
|
return [
|
|
209
214
|
`# ${input.title}`,
|
|
210
215
|
"",
|
|
@@ -218,7 +223,9 @@ export function renderStandardTaskBody(input) {
|
|
|
218
223
|
manual,
|
|
219
224
|
"",
|
|
220
225
|
"## Verification",
|
|
221
|
-
|
|
226
|
+
// Only stated when it constrains closing the task; an unverified task says nothing
|
|
227
|
+
// rather than advertising a second, weaker mode (spec 036, D5).
|
|
228
|
+
...(input.verificationRequired ? ["Independent verification: required"] : []),
|
|
222
229
|
verificationPlan,
|
|
223
230
|
"",
|
|
224
231
|
"## Current Cycle",
|
package/dist/subagents/tool.d.ts
CHANGED
|
@@ -21,7 +21,6 @@ declare const subagentSchema: Type.TObject<{
|
|
|
21
21
|
paths: Type.TOptional<Type.TArray<Type.TString>>;
|
|
22
22
|
purpose: Type.TOptional<Type.TUnion<[Type.TLiteral<"work">, Type.TLiteral<"verify">]>>;
|
|
23
23
|
taskId: Type.TOptional<Type.TString>;
|
|
24
|
-
isolation: Type.TOptional<Type.TUnion<[Type.TLiteral<"shared">, Type.TLiteral<"worktree">]>>;
|
|
25
24
|
returns: Type.TOptional<Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"artifact">]>>;
|
|
26
25
|
thinkingLevel: Type.TOptional<Type.TUnion<[Type.TLiteral<"off">, Type.TLiteral<"minimal">, Type.TLiteral<"low">, Type.TLiteral<"medium">, Type.TLiteral<"high">, Type.TLiteral<"xhigh">]>>;
|
|
27
26
|
}>;
|
|
@@ -40,9 +39,6 @@ export interface SubAgentToolDetails {
|
|
|
40
39
|
runId: string;
|
|
41
40
|
purpose: "work" | "verify";
|
|
42
41
|
taskId?: string;
|
|
43
|
-
isolation: "shared" | "worktree";
|
|
44
|
-
worktreePath?: string;
|
|
45
|
-
worktreeBranch?: string;
|
|
46
42
|
verificationVerdict?: "pass" | "fail";
|
|
47
43
|
/** Always populated (spec 032 D4): the full output is saved to `${artifactDir}/output.md` regardless of `returns`. */
|
|
48
44
|
artifactDir: string;
|
|
@@ -53,7 +49,7 @@ export interface SubAgentToolDetails {
|
|
|
53
49
|
}
|
|
54
50
|
export interface SubAgentToolOptions {
|
|
55
51
|
executor: Executor;
|
|
56
|
-
/** Host checkout used as the
|
|
52
|
+
/** Host checkout used as the sub-agent's cwd. Defaults to process.cwd(). */
|
|
57
53
|
workingDirectory?: string;
|
|
58
54
|
getCurrentModel: () => Model<Api>;
|
|
59
55
|
getAvailableModels: () => Model<Api>[];
|