@oyasmi/pipiclaw 0.8.9 → 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/agent/channel-runner.d.ts +1 -0
- package/dist/agent/channel-runner.js +6 -10
- package/dist/agent/maintenance-context.d.ts +0 -1
- package/dist/agent/maintenance-context.js +0 -7
- package/dist/agent/session-events.d.ts +1 -0
- package/dist/agent/session-events.js +10 -0
- package/dist/agent/types.d.ts +7 -0
- package/dist/agent/types.js +2 -0
- package/dist/index.d.ts +16 -34
- package/dist/index.js +14 -32
- package/dist/memory/consolidation.js +0 -1
- package/dist/memory/extraction.d.ts +1 -7
- package/dist/memory/extraction.js +2 -46
- package/dist/memory/lifecycle.js +3 -3
- package/dist/memory/maintenance-gates.d.ts +4 -16
- package/dist/memory/maintenance-gates.js +11 -51
- package/dist/memory/maintenance-jobs.d.ts +3 -14
- package/dist/memory/maintenance-jobs.js +12 -103
- package/dist/memory/maintenance-state.d.ts +2 -6
- package/dist/memory/maintenance-state.js +14 -10
- package/dist/memory/maintenance-tuning.d.ts +37 -0
- package/dist/memory/maintenance-tuning.js +46 -0
- package/dist/memory/promotion.d.ts +0 -22
- package/dist/memory/promotion.js +1 -8
- package/dist/memory/review-log.d.ts +1 -1
- package/dist/memory/scheduler.d.ts +1 -9
- package/dist/memory/scheduler.js +3 -15
- package/dist/memory/source-window.d.ts +2 -2
- package/dist/memory/task-digest.js +2 -5
- package/dist/models/utils.d.ts +5 -0
- package/dist/models/utils.js +10 -0
- package/dist/paths.d.ts +0 -1
- package/dist/paths.js +0 -1
- package/dist/playbooks/task-closeout.md +2 -0
- package/dist/playbooks/task-delegation.md +8 -14
- package/dist/playbooks/task-driving.md +3 -4
- package/dist/playbooks/task-planning.md +8 -9
- package/dist/runtime/bootstrap.d.ts +14 -0
- package/dist/runtime/bootstrap.js +9 -4
- package/dist/runtime/task-commands.js +46 -73
- package/dist/runtime/task-driver.js +6 -23
- package/dist/settings.d.ts +39 -40
- package/dist/settings.js +87 -107
- package/dist/shared/task-ledger.d.ts +19 -2
- package/dist/shared/task-ledger.js +194 -5
- package/dist/subagents/discovery.d.ts +41 -7
- package/dist/subagents/discovery.js +74 -24
- package/dist/subagents/tool.d.ts +3 -12
- package/dist/subagents/tool.js +11 -115
- package/dist/tasks/control.d.ts +57 -27
- package/dist/tasks/control.js +94 -93
- package/dist/tasks/store.d.ts +1 -4
- package/dist/tasks/store.js +1 -39
- package/dist/tasks/transitions.d.ts +1 -1
- package/dist/tasks/transitions.js +1 -0
- 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/task-manage/create.js +1 -2
- package/dist/tools/task-manage/lifecycle.d.ts +7 -0
- package/dist/tools/task-manage/lifecycle.js +52 -32
- package/dist/tools/task-manage/schema.d.ts +2 -9
- package/dist/tools/task-manage/schema.js +9 -19
- package/dist/tools/task-manage/shared.d.ts +0 -2
- package/dist/tools/task-manage/shared.js +8 -69
- package/dist/tools/task-manage/types.d.ts +1 -1
- package/dist/tools/task-manage/verification.js +5 -6
- package/dist/tools/task-manage.js +4 -2
- package/examples/sub-agents/README.md +1 -1
- package/package.json +3 -1
- package/dist/memory/post-turn-review.d.ts +0 -43
- package/dist/memory/post-turn-review.js +0 -136
- package/dist/memory/promotion-signals.d.ts +0 -5
- package/dist/memory/promotion-signals.js +0 -33
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,34 +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
|
|
88
|
-
postTurnReviewEnabled: boolean;
|
|
89
|
-
autoWriteChannelMemory: boolean;
|
|
90
|
-
autoWriteWorkspaceSkills: boolean;
|
|
91
|
-
minSkillAutoWriteConfidence: number;
|
|
92
|
-
minMemoryAutoWriteConfidence: number;
|
|
93
|
-
idleWritesHistory: boolean;
|
|
94
|
-
minTurnsBetweenReview: number;
|
|
95
|
-
minToolCallsBetweenReview: number;
|
|
96
|
-
}
|
|
97
|
-
export interface PipiclawMemoryMaintenanceSettings {
|
|
87
|
+
export type PipiclawMemoryMaintenanceSettings = MemoryMaintenanceTuning & {
|
|
98
88
|
enabled: boolean;
|
|
99
|
-
|
|
100
|
-
sessionRefreshIntervalMinutes: number;
|
|
101
|
-
durableConsolidationIntervalMinutes: number;
|
|
102
|
-
growthReviewIntervalMinutes: number;
|
|
103
|
-
structuralMaintenanceIntervalHours: number;
|
|
104
|
-
maxConcurrentChannels: number;
|
|
105
|
-
failureBackoffMinutes: number;
|
|
106
|
-
/** Reject a MEMORY.md cleanup whose result shrinks below this ratio of the original. */
|
|
107
|
-
cleanupShrinkGuardMinRatio: number;
|
|
108
|
-
/** Only apply the shrink guard when the original exceeds this length (chars). */
|
|
109
|
-
cleanupShrinkGuardMinChars: number;
|
|
110
|
-
}
|
|
89
|
+
};
|
|
111
90
|
export interface PipiclawLoggingSettings {
|
|
112
91
|
level: "debug" | "info" | "warn" | "error";
|
|
113
92
|
file: {
|
|
@@ -117,13 +96,21 @@ export interface PipiclawLoggingSettings {
|
|
|
117
96
|
};
|
|
118
97
|
}
|
|
119
98
|
export interface PipiclawSessionSearchSettings {
|
|
120
|
-
enabled: boolean;
|
|
121
99
|
maxFiles: number;
|
|
122
100
|
maxChunks: number;
|
|
123
101
|
maxCharsPerChunk: number;
|
|
124
102
|
summarizeWithModel: boolean;
|
|
125
103
|
timeoutMs: number;
|
|
126
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
|
+
*/
|
|
127
114
|
export interface PipiclawSettings {
|
|
128
115
|
defaultProvider?: string;
|
|
129
116
|
defaultModel?: string;
|
|
@@ -136,17 +123,32 @@ export interface PipiclawSettings {
|
|
|
136
123
|
* frontmatter `model`; falls back to the parent's current model when unset.
|
|
137
124
|
*/
|
|
138
125
|
subagentModel?: string | null;
|
|
139
|
-
compaction?:
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
+
};
|
|
150
152
|
};
|
|
151
153
|
tui?: Partial<PipiclawTuiSettings>;
|
|
152
154
|
}
|
|
@@ -168,6 +170,7 @@ export declare class PipiclawSettingsManager {
|
|
|
168
170
|
private settingsPath;
|
|
169
171
|
private settings;
|
|
170
172
|
private loadErrors;
|
|
173
|
+
private retiredKeys;
|
|
171
174
|
constructor(baseDir: string);
|
|
172
175
|
private load;
|
|
173
176
|
private save;
|
|
@@ -182,7 +185,6 @@ export declare class PipiclawSettingsManager {
|
|
|
182
185
|
getTaskDigestSettings(): PipiclawTaskDigestSettings;
|
|
183
186
|
getTaskDriverSettings(): PipiclawTaskDriverSettings;
|
|
184
187
|
getSessionMemorySettings(): PipiclawSessionMemorySettings;
|
|
185
|
-
getMemoryGrowthSettings(): PipiclawMemoryGrowthSettings;
|
|
186
188
|
getMemoryMaintenanceSettings(): PipiclawMemoryMaintenanceSettings;
|
|
187
189
|
getSessionSearchSettings(): PipiclawSessionSearchSettings;
|
|
188
190
|
getLoggingSettings(): PipiclawLoggingSettings;
|
|
@@ -216,8 +218,6 @@ export declare class PipiclawSettingsManager {
|
|
|
216
218
|
setBlockImages(_blocked: boolean): void;
|
|
217
219
|
getShowImages(): boolean;
|
|
218
220
|
setShowImages(_show: boolean): void;
|
|
219
|
-
getCompactionReserveTokens(): number;
|
|
220
|
-
getCompactionKeepRecentTokens(): number;
|
|
221
221
|
getBranchSummarySettings(): {
|
|
222
222
|
reserveTokens: number;
|
|
223
223
|
};
|
|
@@ -280,7 +280,6 @@ export declare class PipiclawSettingsManager {
|
|
|
280
280
|
getProjectSettings(): Settings;
|
|
281
281
|
isProjectTrusted(): boolean;
|
|
282
282
|
setProjectTrusted(_trusted: boolean): void;
|
|
283
|
-
applyOverrides(overrides: Partial<Settings>): void;
|
|
284
283
|
flush(): Promise<void>;
|
|
285
284
|
}
|
|
286
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,41 +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
|
-
const DEFAULT_MEMORY_GROWTH = {
|
|
57
|
-
postTurnReviewEnabled: true,
|
|
58
|
-
autoWriteChannelMemory: true,
|
|
59
|
-
autoWriteWorkspaceSkills: false,
|
|
60
|
-
minSkillAutoWriteConfidence: 0.9,
|
|
61
|
-
minMemoryAutoWriteConfidence: 0.85,
|
|
62
|
-
idleWritesHistory: false,
|
|
63
|
-
minTurnsBetweenReview: 12,
|
|
64
|
-
minToolCallsBetweenReview: 24,
|
|
65
|
-
};
|
|
66
|
-
const MIN_SKILL_AUTO_WRITE_CONFIDENCE = 0.9;
|
|
67
56
|
const DEFAULT_SESSION_SEARCH = {
|
|
68
|
-
enabled: true,
|
|
69
57
|
maxFiles: 12,
|
|
70
58
|
maxChunks: 80,
|
|
71
59
|
maxCharsPerChunk: 1200,
|
|
72
60
|
summarizeWithModel: false,
|
|
73
61
|
timeoutMs: 12_000,
|
|
74
62
|
};
|
|
75
|
-
const
|
|
76
|
-
enabled: true,
|
|
77
|
-
minIdleMinutesBeforeLlmWork: 10,
|
|
78
|
-
sessionRefreshIntervalMinutes: 10,
|
|
79
|
-
durableConsolidationIntervalMinutes: 20,
|
|
80
|
-
growthReviewIntervalMinutes: 60,
|
|
81
|
-
structuralMaintenanceIntervalHours: 6,
|
|
82
|
-
maxConcurrentChannels: 1,
|
|
83
|
-
failureBackoffMinutes: 30,
|
|
84
|
-
cleanupShrinkGuardMinRatio: 0.4,
|
|
85
|
-
cleanupShrinkGuardMinChars: 2_000,
|
|
86
|
-
};
|
|
63
|
+
const DEFAULT_MEMORY_MAINTENANCE_ENABLED = true;
|
|
87
64
|
// `file.enabled` defaults to true: for a long-lived daemon, persisting logs is
|
|
88
65
|
// worth more than the surprise of a new file under state/logs/. See docs.
|
|
89
66
|
const DEFAULT_LOGGING = {
|
|
@@ -94,6 +71,65 @@ const DEFAULT_LOGGING = {
|
|
|
94
71
|
maxFiles: 3,
|
|
95
72
|
},
|
|
96
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
|
+
}
|
|
97
133
|
/**
|
|
98
134
|
* Settings manager for pipiclaw.
|
|
99
135
|
* Stores global settings in the pipiclaw root directory.
|
|
@@ -101,11 +137,13 @@ const DEFAULT_LOGGING = {
|
|
|
101
137
|
export class PipiclawSettingsManager {
|
|
102
138
|
constructor(baseDir) {
|
|
103
139
|
this.loadErrors = [];
|
|
140
|
+
this.retiredKeys = [];
|
|
104
141
|
this.settingsPath = join(baseDir, "settings.json");
|
|
105
142
|
this.settings = this.load();
|
|
106
143
|
}
|
|
107
144
|
load() {
|
|
108
145
|
this.loadErrors = [];
|
|
146
|
+
this.retiredKeys = [];
|
|
109
147
|
if (!existsSync(this.settingsPath)) {
|
|
110
148
|
return {};
|
|
111
149
|
}
|
|
@@ -119,6 +157,7 @@ export class PipiclawSettingsManager {
|
|
|
119
157
|
});
|
|
120
158
|
return {};
|
|
121
159
|
}
|
|
160
|
+
this.retiredKeys = findRetiredSettingsKeys(parsed);
|
|
122
161
|
return parsed;
|
|
123
162
|
}
|
|
124
163
|
catch (error) {
|
|
@@ -150,17 +189,26 @@ export class PipiclawSettingsManager {
|
|
|
150
189
|
return errors;
|
|
151
190
|
}
|
|
152
191
|
getDiagnostics() {
|
|
153
|
-
|
|
192
|
+
const diagnostics = this.loadErrors.map(({ error }) => ({
|
|
154
193
|
source: "settings",
|
|
155
194
|
path: this.settingsPath,
|
|
156
195
|
severity: "error",
|
|
157
196
|
message: error.message,
|
|
158
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;
|
|
159
207
|
}
|
|
160
208
|
getCompactionSettings() {
|
|
161
209
|
return {
|
|
162
210
|
...DEFAULT_COMPACTION,
|
|
163
|
-
|
|
211
|
+
enabled: this.settings.compaction?.enabled ?? DEFAULT_COMPACTION.enabled,
|
|
164
212
|
};
|
|
165
213
|
}
|
|
166
214
|
getCompactionEnabled() {
|
|
@@ -173,83 +221,48 @@ export class PipiclawSettingsManager {
|
|
|
173
221
|
getRetrySettings() {
|
|
174
222
|
return {
|
|
175
223
|
...DEFAULT_RETRY,
|
|
176
|
-
|
|
224
|
+
enabled: this.settings.retry?.enabled ?? DEFAULT_RETRY.enabled,
|
|
177
225
|
};
|
|
178
226
|
}
|
|
179
227
|
getMemoryRecallSettings() {
|
|
180
228
|
return {
|
|
181
229
|
...DEFAULT_MEMORY_RECALL,
|
|
182
|
-
|
|
230
|
+
enabled: this.settings.memoryRecall?.enabled ?? DEFAULT_MEMORY_RECALL.enabled,
|
|
231
|
+
rerankWithModel: this.settings.memoryRecall?.rerankWithModel ?? DEFAULT_MEMORY_RECALL.rerankWithModel,
|
|
183
232
|
};
|
|
184
233
|
}
|
|
185
234
|
getTaskDigestSettings() {
|
|
186
|
-
return {
|
|
187
|
-
...DEFAULT_TASK_DIGEST,
|
|
188
|
-
...this.settings.taskDigest,
|
|
189
|
-
};
|
|
235
|
+
return { ...DEFAULT_TASK_DIGEST };
|
|
190
236
|
}
|
|
191
237
|
getTaskDriverSettings() {
|
|
192
|
-
|
|
193
|
-
...DEFAULT_TASK_DRIVER,
|
|
194
|
-
...this.settings.taskDriver,
|
|
195
|
-
};
|
|
196
|
-
const continuationDelayMinutes = Number.isFinite(configured.continuationDelayMinutes)
|
|
197
|
-
? Math.min(60, Math.max(1, Math.floor(configured.continuationDelayMinutes)))
|
|
198
|
-
: DEFAULT_TASK_DRIVER.continuationDelayMinutes;
|
|
199
|
-
const stalledRetryMinutes = Number.isFinite(configured.stalledRetryMinutes)
|
|
200
|
-
? Math.min(24 * 60, Math.max(continuationDelayMinutes, Math.floor(configured.stalledRetryMinutes)))
|
|
201
|
-
: DEFAULT_TASK_DRIVER.stalledRetryMinutes;
|
|
202
|
-
const maxDispatchesPerTick = Number.isFinite(configured.maxDispatchesPerTick)
|
|
203
|
-
? Math.min(20, Math.max(1, Math.floor(configured.maxDispatchesPerTick)))
|
|
204
|
-
: DEFAULT_TASK_DRIVER.maxDispatchesPerTick;
|
|
205
|
-
const maxSleepMinutes = Number.isFinite(configured.maxSleepMinutes)
|
|
206
|
-
? Math.min(60, Math.max(1, Math.floor(configured.maxSleepMinutes)))
|
|
207
|
-
: DEFAULT_TASK_DRIVER.maxSleepMinutes;
|
|
208
|
-
return {
|
|
209
|
-
continuationDelayMinutes,
|
|
210
|
-
stalledRetryMinutes,
|
|
211
|
-
maxDispatchesPerTick,
|
|
212
|
-
maxSleepMinutes,
|
|
213
|
-
};
|
|
238
|
+
return { ...DEFAULT_TASK_DRIVER };
|
|
214
239
|
}
|
|
215
240
|
getSessionMemorySettings() {
|
|
216
241
|
return {
|
|
217
242
|
...DEFAULT_SESSION_MEMORY,
|
|
218
|
-
...
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
getMemoryGrowthSettings() {
|
|
222
|
-
const settings = {
|
|
223
|
-
...DEFAULT_MEMORY_GROWTH,
|
|
224
|
-
...this.settings.memoryGrowth,
|
|
225
|
-
};
|
|
226
|
-
const configured = settings.minSkillAutoWriteConfidence;
|
|
227
|
-
return {
|
|
228
|
-
...settings,
|
|
229
|
-
minSkillAutoWriteConfidence: Number.isFinite(configured)
|
|
230
|
-
? Math.min(1, Math.max(MIN_SKILL_AUTO_WRITE_CONFIDENCE, configured))
|
|
231
|
-
: MIN_SKILL_AUTO_WRITE_CONFIDENCE,
|
|
243
|
+
...getSessionRefreshCadence(),
|
|
244
|
+
enabled: this.settings.sessionMemory?.enabled ?? DEFAULT_SESSION_MEMORY.enabled,
|
|
232
245
|
};
|
|
233
246
|
}
|
|
234
247
|
getMemoryMaintenanceSettings() {
|
|
235
248
|
return {
|
|
236
|
-
...
|
|
237
|
-
|
|
249
|
+
...getMemoryMaintenanceTuning(),
|
|
250
|
+
enabled: this.settings.memoryMaintenance?.enabled ?? DEFAULT_MEMORY_MAINTENANCE_ENABLED,
|
|
238
251
|
};
|
|
239
252
|
}
|
|
240
253
|
getSessionSearchSettings() {
|
|
241
254
|
return {
|
|
242
255
|
...DEFAULT_SESSION_SEARCH,
|
|
243
|
-
|
|
256
|
+
summarizeWithModel: this.settings.sessionSearch?.summarizeWithModel ?? DEFAULT_SESSION_SEARCH.summarizeWithModel,
|
|
244
257
|
};
|
|
245
258
|
}
|
|
246
259
|
getLoggingSettings() {
|
|
247
260
|
return {
|
|
248
261
|
...DEFAULT_LOGGING,
|
|
249
|
-
|
|
262
|
+
level: this.settings.logging?.level ?? DEFAULT_LOGGING.level,
|
|
250
263
|
file: {
|
|
251
264
|
...DEFAULT_LOGGING.file,
|
|
252
|
-
|
|
265
|
+
enabled: this.settings.logging?.file?.enabled ?? DEFAULT_LOGGING.file.enabled,
|
|
253
266
|
},
|
|
254
267
|
};
|
|
255
268
|
}
|
|
@@ -343,13 +356,6 @@ export class PipiclawSettingsManager {
|
|
|
343
356
|
setShowImages(_show) {
|
|
344
357
|
// No-op
|
|
345
358
|
}
|
|
346
|
-
// Compaction details
|
|
347
|
-
getCompactionReserveTokens() {
|
|
348
|
-
return this.getCompactionSettings().reserveTokens;
|
|
349
|
-
}
|
|
350
|
-
getCompactionKeepRecentTokens() {
|
|
351
|
-
return this.getCompactionSettings().keepRecentTokens;
|
|
352
|
-
}
|
|
353
359
|
getBranchSummarySettings() {
|
|
354
360
|
return { reserveTokens: this.getCompactionSettings().reserveTokens };
|
|
355
361
|
}
|
|
@@ -533,32 +539,6 @@ export class PipiclawSettingsManager {
|
|
|
533
539
|
setProjectTrusted(_trusted) {
|
|
534
540
|
// Pipiclaw handles workspace authorization at the DingTalk/runtime boundary.
|
|
535
541
|
}
|
|
536
|
-
applyOverrides(overrides) {
|
|
537
|
-
if (overrides.defaultProvider !== undefined)
|
|
538
|
-
this.settings.defaultProvider = overrides.defaultProvider;
|
|
539
|
-
if (overrides.defaultModel !== undefined)
|
|
540
|
-
this.settings.defaultModel = overrides.defaultModel;
|
|
541
|
-
if (overrides.defaultThinkingLevel !== undefined) {
|
|
542
|
-
this.settings.defaultThinkingLevel = overrides.defaultThinkingLevel;
|
|
543
|
-
}
|
|
544
|
-
if (overrides.compaction !== undefined) {
|
|
545
|
-
this.settings.compaction = {
|
|
546
|
-
...this.settings.compaction,
|
|
547
|
-
enabled: overrides.compaction.enabled ?? this.settings.compaction?.enabled,
|
|
548
|
-
reserveTokens: overrides.compaction.reserveTokens ?? this.settings.compaction?.reserveTokens,
|
|
549
|
-
keepRecentTokens: overrides.compaction.keepRecentTokens ?? this.settings.compaction?.keepRecentTokens,
|
|
550
|
-
};
|
|
551
|
-
}
|
|
552
|
-
if (overrides.retry !== undefined) {
|
|
553
|
-
this.settings.retry = {
|
|
554
|
-
...this.settings.retry,
|
|
555
|
-
enabled: overrides.retry.enabled ?? this.settings.retry?.enabled,
|
|
556
|
-
maxRetries: overrides.retry.maxRetries ?? this.settings.retry?.maxRetries,
|
|
557
|
-
baseDelayMs: overrides.retry.baseDelayMs ?? this.settings.retry?.baseDelayMs,
|
|
558
|
-
};
|
|
559
|
-
}
|
|
560
|
-
this.save();
|
|
561
|
-
}
|
|
562
542
|
flush() {
|
|
563
543
|
return Promise.resolve();
|
|
564
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 [{
|
|
@@ -64,6 +70,9 @@ export declare const STANDARD_TASK_SECTIONS: readonly [{
|
|
|
64
70
|
readonly label: "History";
|
|
65
71
|
readonly names: readonly ["History", "历史"];
|
|
66
72
|
}];
|
|
73
|
+
/** Recurring task files are working context, not an unbounded audit log. */
|
|
74
|
+
export declare const MAX_INLINE_TASK_HISTORY_ENTRIES = 8;
|
|
75
|
+
export declare const MAX_INLINE_TASK_HISTORY_CHARS: number;
|
|
67
76
|
/** Validate/normalize a task id (filename without `.md`), rejecting path traversal. */
|
|
68
77
|
export declare function normalizeTaskId(id: string): string;
|
|
69
78
|
/** The document body after the leading frontmatter block, or the whole content when there is none. */
|
|
@@ -123,6 +132,14 @@ export declare function normalizeTaskFields(fields: TaskDocumentFields): TaskDoc
|
|
|
123
132
|
export declare function renderTaskDocument(fields: TaskDocumentFields, rawBody: string): string;
|
|
124
133
|
/** Append one progress bullet to the standard Current Cycle section. */
|
|
125
134
|
export declare function appendCurrentCycleNote(content: string, note: string): string;
|
|
135
|
+
/**
|
|
136
|
+
* Upsert the completion evidence subsection inside Current Cycle.
|
|
137
|
+
*
|
|
138
|
+
* Evidence is part of the cycle log, not a new top-level section. This makes the next
|
|
139
|
+
* `startTaskCycle` fold it into the matching History entry and prevents repeated `done`
|
|
140
|
+
* attempts from appending duplicate evidence blocks.
|
|
141
|
+
*/
|
|
142
|
+
export declare function upsertCurrentCycleCompletionEvidence(content: string, evidenceLines: readonly string[]): string;
|
|
126
143
|
/**
|
|
127
144
|
* Close the visible current-cycle notes into History and open a fresh cycle.
|
|
128
145
|
* Periodic task cycles deliberately use this small, deterministic transformation
|