pi-harness-runtime 1.1.32 → 1.1.34
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/harness/langchain/checkpointer.test.ts +11 -37
- package/harness/langchain/checkpointer.ts +14 -24
- package/harness/langchain/daemon.test.ts +5 -1
- package/harness/langchain/daemon.ts +3 -2
- package/harness/langchain/graph.ts +1 -1
- package/harness/langchain/surge.ts +1 -1
- package/package.json +1 -1
- package/packages/a2a-adapter/package.json +1 -1
- package/packages/architecture-generator/package.json +1 -1
- package/packages/auth/package.json +1 -1
- package/packages/autonomous-refactor/package.json +1 -1
- package/packages/autonomous-runtime/package.json +1 -1
- package/packages/cache-strategy/package.json +1 -1
- package/packages/capability-registry/package.json +1 -1
- package/packages/checkpoint/package.json +1 -1
- package/packages/cli-plugin-sdk/package.json +1 -1
- package/packages/clipboard/package.json +1 -1
- package/packages/clipboard-plugin/package.json +1 -1
- package/packages/code-generation/package.json +1 -1
- package/packages/code-review/package.json +1 -1
- package/packages/codex-adapter/package.json +1 -1
- package/packages/config-capture/package.json +1 -1
- package/packages/context-compiler/package.json +1 -1
- package/packages/context-discovery/package.json +1 -1
- package/packages/context-manager/package.json +1 -1
- package/packages/cookie-sanitizer/package.json +1 -1
- package/packages/cost-optimizer/package.json +1 -1
- package/packages/dependency-analyzer/package.json +1 -1
- package/packages/django-plugin/package.json +1 -1
- package/packages/doc-generator/package.json +1 -1
- package/packages/evaluation-engine/package.json +1 -1
- package/packages/evaluation-runner/package.json +1 -1
- package/packages/event-bus/package.json +1 -1
- package/packages/event-store/package.json +1 -1
- package/packages/experience-replay/package.json +1 -1
- package/packages/feedback-collector/package.json +1 -1
- package/packages/file-copy-helper/package.json +1 -1
- package/packages/framework-detector/package.json +1 -1
- package/packages/framework-plugin-sdk/package.json +1 -1
- package/packages/frappe-plugin/package.json +1 -1
- package/packages/generic-web-plugin/package.json +1 -1
- package/packages/health-monitor/package.json +1 -1
- package/packages/intent-analyzer/package.json +1 -1
- package/packages/knowledge-graph/package.json +1 -1
- package/packages/knowledge-retrieval/package.json +1 -1
- package/packages/laravel-plugin/package.json +1 -1
- package/packages/learning-engine/package.json +1 -1
- package/packages/mcp-adapter/package.json +1 -1
- package/packages/memory-engine/package.json +1 -1
- package/packages/milestone-manager/package.json +1 -1
- package/packages/model-registry/package.json +1 -1
- package/packages/nextjs-plugin/package.json +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/observability/package.json +1 -1
- package/packages/okf-indexer/package.json +1 -1
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/privilege-broker/package.json +1 -1
- package/packages/project-analyzer/package.json +1 -1
- package/packages/project-bootstrap/package.json +1 -1
- package/packages/projection-engine/package.json +1 -1
- package/packages/prompt-compiler/package.json +1 -1
- package/packages/prompt-versioning/package.json +1 -1
- package/packages/provider-adapter-sdk/package.json +1 -1
- package/packages/provider-router/package.json +1 -1
- package/packages/provider-selector/package.json +1 -1
- package/packages/providers/dist/glm-usage.d.ts.map +1 -1
- package/packages/providers/dist/glm-usage.js +15 -2
- package/packages/providers/dist/glm-usage.js.map +1 -1
- package/packages/providers/package.json +1 -1
- package/packages/providers/src/glm-usage.ts +17 -6
- package/packages/quota-manager/package.json +1 -1
- package/packages/rate-limiter/package.json +1 -1
- package/packages/react-vite-plugin/package.json +1 -1
- package/packages/release-manager/package.json +1 -1
- package/packages/requirement-compiler/package.json +1 -1
- package/packages/runtime/package.json +1 -1
- package/packages/scheduler/package.json +1 -1
- package/packages/scheduler-adapter/package.json +1 -1
- package/packages/session/package.json +1 -1
- package/packages/session-api/package.json +1 -1
- package/packages/session-export/package.json +1 -1
- package/packages/shared-context/package.json +1 -1
- package/packages/skill-mcp-client/package.json +1 -1
- package/packages/skill-registry/package.json +1 -1
- package/packages/sprint-planner/package.json +1 -1
- package/packages/subscription-engine/package.json +1 -1
- package/packages/task-compiler/package.json +1 -1
- package/packages/tencentdb-memory/package.json +1 -1
- package/packages/tencentdb-sync/package.json +1 -1
- package/packages/test-data-generator/package.json +1 -1
- package/packages/test-generator/package.json +1 -1
- package/packages/todo-bd-sync/package.json +1 -1
- package/packages/token-estimation/package.json +1 -1
- package/packages/token-optimizer/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/packages/workflow-events/package.json +1 -1
- package/packages/workspace-scanner/package.json +1 -1
- package/packages/worktree/package.json +1 -1
- package/packages/write-review/package.json +1 -1
|
@@ -11,10 +11,7 @@ import { existsSync, mkdirSync, rmSync } from "node:fs";
|
|
|
11
11
|
import { join } from "node:path";
|
|
12
12
|
import { randomUUID } from "node:crypto";
|
|
13
13
|
|
|
14
|
-
import {
|
|
15
|
-
FileCheckpointSaver,
|
|
16
|
-
createLoopCheckpointer,
|
|
17
|
-
} from "./checkpointer.js";
|
|
14
|
+
import { FileCheckpointSaver, createLoopCheckpointer } from "./checkpointer.js";
|
|
18
15
|
|
|
19
16
|
// ─── Fixtures ────────────────────────────────────────────────────────────────
|
|
20
17
|
|
|
@@ -53,10 +50,7 @@ describe("T9 — put and get basic checkpoint", () => {
|
|
|
53
50
|
};
|
|
54
51
|
|
|
55
52
|
const updatedConfig = await saver.put(CONFIG, checkpoint, metadata, {});
|
|
56
|
-
assert.equal(
|
|
57
|
-
updatedConfig.configurable?.checkpoint_id,
|
|
58
|
-
"cp-001",
|
|
59
|
-
);
|
|
53
|
+
assert.equal(updatedConfig.configurable?.checkpoint_id, "cp-001");
|
|
60
54
|
|
|
61
55
|
// Retrieve it
|
|
62
56
|
const tuple = await saver.getTuple(CONFIG_WITH_CPID);
|
|
@@ -111,12 +105,7 @@ describe("T10 — parent chain", () => {
|
|
|
111
105
|
versions_seen: {},
|
|
112
106
|
};
|
|
113
107
|
|
|
114
|
-
await saver.put(
|
|
115
|
-
CONFIG,
|
|
116
|
-
root,
|
|
117
|
-
{ source: "input", step: -1, parents: {} },
|
|
118
|
-
{},
|
|
119
|
-
);
|
|
108
|
+
await saver.put(CONFIG, root, { source: "input", step: -1, parents: {} }, {});
|
|
120
109
|
await saver.put(
|
|
121
110
|
CONFIG,
|
|
122
111
|
child,
|
|
@@ -130,10 +119,7 @@ describe("T10 — parent chain", () => {
|
|
|
130
119
|
});
|
|
131
120
|
assert.ok(tuple);
|
|
132
121
|
assert.ok(tuple?.parentConfig);
|
|
133
|
-
assert.equal(
|
|
134
|
-
tuple?.parentConfig?.configurable?.checkpoint_id,
|
|
135
|
-
"root",
|
|
136
|
-
);
|
|
122
|
+
assert.equal(tuple?.parentConfig?.configurable?.checkpoint_id, "root");
|
|
137
123
|
|
|
138
124
|
// getTuple without checkpoint_id returns the latest
|
|
139
125
|
const latest = await saver.getTuple(CONFIG);
|
|
@@ -157,12 +143,7 @@ describe("T11 — list and deleteThread", () => {
|
|
|
157
143
|
channel_versions: {},
|
|
158
144
|
versions_seen: {},
|
|
159
145
|
};
|
|
160
|
-
await saver.put(
|
|
161
|
-
CONFIG,
|
|
162
|
-
cp,
|
|
163
|
-
{ source: "loop", step: i, parents: {} },
|
|
164
|
-
{},
|
|
165
|
-
);
|
|
146
|
+
await saver.put(CONFIG, cp, { source: "loop", step: i, parents: {} }, {});
|
|
166
147
|
}
|
|
167
148
|
|
|
168
149
|
const all: string[] = [];
|
|
@@ -186,12 +167,7 @@ describe("T11 — list and deleteThread", () => {
|
|
|
186
167
|
channel_versions: {},
|
|
187
168
|
versions_seen: {},
|
|
188
169
|
};
|
|
189
|
-
await saver.put(
|
|
190
|
-
CONFIG,
|
|
191
|
-
cp,
|
|
192
|
-
{ source: "loop", step: i, parents: {} },
|
|
193
|
-
{},
|
|
194
|
-
);
|
|
170
|
+
await saver.put(CONFIG, cp, { source: "loop", step: i, parents: {} }, {});
|
|
195
171
|
}
|
|
196
172
|
|
|
197
173
|
const limited: string[] = [];
|
|
@@ -212,12 +188,7 @@ describe("T11 — list and deleteThread", () => {
|
|
|
212
188
|
channel_versions: {},
|
|
213
189
|
versions_seen: {},
|
|
214
190
|
};
|
|
215
|
-
await saver.put(
|
|
216
|
-
CONFIG,
|
|
217
|
-
cp,
|
|
218
|
-
{ source: "input", step: -1, parents: {} },
|
|
219
|
-
{},
|
|
220
|
-
);
|
|
191
|
+
await saver.put(CONFIG, cp, { source: "input", step: -1, parents: {} }, {});
|
|
221
192
|
|
|
222
193
|
assert.ok(await saver.getTuple(CONFIG), "checkpoint should exist");
|
|
223
194
|
|
|
@@ -255,7 +226,10 @@ describe("T11 — list and deleteThread", () => {
|
|
|
255
226
|
);
|
|
256
227
|
|
|
257
228
|
const threads = saver.listThreads();
|
|
258
|
-
assert.ok(
|
|
229
|
+
assert.ok(
|
|
230
|
+
threads.includes(tid),
|
|
231
|
+
`Expected ${tid} in ${JSON.stringify(threads)}`,
|
|
232
|
+
);
|
|
259
233
|
});
|
|
260
234
|
});
|
|
261
235
|
|
|
@@ -41,10 +41,7 @@ const jsonSerializer = {
|
|
|
41
41
|
async dumpsTyped(data: unknown): Promise<[string, Uint8Array]> {
|
|
42
42
|
return ["application/json", new TextEncoder().encode(JSON.stringify(data))];
|
|
43
43
|
},
|
|
44
|
-
async loadsTyped(
|
|
45
|
-
_type: string,
|
|
46
|
-
data: Uint8Array | string,
|
|
47
|
-
): Promise<unknown> {
|
|
44
|
+
async loadsTyped(_type: string, data: Uint8Array | string): Promise<unknown> {
|
|
48
45
|
try {
|
|
49
46
|
const bytes: Uint8Array =
|
|
50
47
|
typeof data === "string" ? new TextEncoder().encode(data) : data;
|
|
@@ -126,12 +123,12 @@ function atomicWrite(path: string, content: string): void {
|
|
|
126
123
|
* On daemon restart, pass the same root — checkpoints persist across restarts.
|
|
127
124
|
*/
|
|
128
125
|
export class FileCheckpointSaver extends BaseCheckpointSaver {
|
|
129
|
-
private readonly root: string;
|
|
126
|
+
private readonly root: string;
|
|
130
127
|
|
|
131
|
-
constructor(opts: { root: string }) {
|
|
132
|
-
super(jsonSerializer);
|
|
133
|
-
this.root = opts.root;
|
|
134
|
-
}
|
|
128
|
+
constructor(opts: { root: string }) {
|
|
129
|
+
super(jsonSerializer);
|
|
130
|
+
this.root = opts.root;
|
|
131
|
+
}
|
|
135
132
|
|
|
136
133
|
// ─── BaseCheckpointSaver ─────────────────────────────────────────────
|
|
137
134
|
|
|
@@ -140,9 +137,7 @@ this.root = opts.root;
|
|
|
140
137
|
return tuple?.checkpoint;
|
|
141
138
|
}
|
|
142
139
|
|
|
143
|
-
async getTuple(
|
|
144
|
-
config: RunnableConfig,
|
|
145
|
-
): Promise<CheckpointTuple | undefined> {
|
|
140
|
+
async getTuple(config: RunnableConfig): Promise<CheckpointTuple | undefined> {
|
|
146
141
|
const threadId = String(config.configurable?.thread_id ?? "");
|
|
147
142
|
if (!threadId) return undefined;
|
|
148
143
|
|
|
@@ -169,9 +164,7 @@ this.root = opts.root;
|
|
|
169
164
|
|
|
170
165
|
try {
|
|
171
166
|
const raw = readFileSync(path);
|
|
172
|
-
const data = JSON.parse(
|
|
173
|
-
new TextDecoder().decode(raw),
|
|
174
|
-
) as {
|
|
167
|
+
const data = JSON.parse(new TextDecoder().decode(raw)) as {
|
|
175
168
|
checkpoint: Checkpoint;
|
|
176
169
|
metadata: CheckpointMetadata;
|
|
177
170
|
parentConfig?: RunnableConfig;
|
|
@@ -182,10 +175,7 @@ this.root = opts.root;
|
|
|
182
175
|
const parentId = entry?.parentId;
|
|
183
176
|
|
|
184
177
|
let parentConfig: RunnableConfig | undefined;
|
|
185
|
-
if (
|
|
186
|
-
parentId &&
|
|
187
|
-
existsSync(checkpointPath(dir, parentId))
|
|
188
|
-
) {
|
|
178
|
+
if (parentId && existsSync(checkpointPath(dir, parentId))) {
|
|
189
179
|
parentConfig = {
|
|
190
180
|
configurable: {
|
|
191
181
|
thread_id: config.configurable?.thread_id,
|
|
@@ -201,7 +191,7 @@ this.root = opts.root;
|
|
|
201
191
|
parentConfig: parentConfig ?? data.parentConfig,
|
|
202
192
|
};
|
|
203
193
|
} catch {
|
|
204
|
-
|
|
194
|
+
return undefined;
|
|
205
195
|
}
|
|
206
196
|
}
|
|
207
197
|
|
|
@@ -215,9 +205,7 @@ this.root = opts.root;
|
|
|
215
205
|
const dir = threadDir(this.root, threadId);
|
|
216
206
|
if (!existsSync(dir)) return;
|
|
217
207
|
|
|
218
|
-
const index = [...readIndex(dir)].sort((a, b) =>
|
|
219
|
-
b.ts.localeCompare(a.ts),
|
|
220
|
-
);
|
|
208
|
+
const index = [...readIndex(dir)].sort((a, b) => b.ts.localeCompare(a.ts));
|
|
221
209
|
|
|
222
210
|
const limit = options?.limit ?? 100;
|
|
223
211
|
let count = 0;
|
|
@@ -240,7 +228,9 @@ this.root = opts.root;
|
|
|
240
228
|
if (!threadId) throw new Error("thread_id is required for checkpointing");
|
|
241
229
|
|
|
242
230
|
const dir = ensureThreadDir(this.root, threadId);
|
|
243
|
-
const parentId = (metadata.parents as Record<string, string | undefined>)?.[
|
|
231
|
+
const parentId = (metadata.parents as Record<string, string | undefined>)?.[
|
|
232
|
+
""
|
|
233
|
+
];
|
|
244
234
|
|
|
245
235
|
const path = checkpointPath(dir, checkpoint.id);
|
|
246
236
|
atomicWrite(
|
|
@@ -364,7 +364,11 @@ describe("T13 — persistent checkpointer (M5)", () => {
|
|
|
364
364
|
daemon1.start();
|
|
365
365
|
|
|
366
366
|
const filename = `test-T13-${randomUUID().slice(0, 6)}.md`;
|
|
367
|
-
writeFileSync(
|
|
367
|
+
writeFileSync(
|
|
368
|
+
join(WORKSPACE, filename),
|
|
369
|
+
"Persistent checkpoint test",
|
|
370
|
+
"utf8",
|
|
371
|
+
);
|
|
368
372
|
|
|
369
373
|
// Let the loop run for one iteration
|
|
370
374
|
await new Promise((r) => setTimeout(r, 500));
|
|
@@ -725,11 +725,12 @@ export class LoopDaemon {
|
|
|
725
725
|
const checkpointer =
|
|
726
726
|
this.config.checkpointer === false
|
|
727
727
|
? false
|
|
728
|
-
: this.config.checkpointer === true ||
|
|
728
|
+
: this.config.checkpointer === true ||
|
|
729
|
+
typeof this.config.checkpointer === "string"
|
|
729
730
|
? createLoopCheckpointer(
|
|
730
731
|
this.config.checkpointer === true
|
|
731
732
|
? this.bus.getWorkspace()
|
|
732
|
-
: this.config.checkpointer as string,
|
|
733
|
+
: (this.config.checkpointer as string),
|
|
733
734
|
)
|
|
734
735
|
: undefined; // default MemorySaver
|
|
735
736
|
const loop: WriteReviewLoop = buildWriteReviewLoop(deps, { checkpointer });
|
|
@@ -160,7 +160,7 @@ export function buildWriteReviewLoop(
|
|
|
160
160
|
? undefined
|
|
161
161
|
: cp != null && cp !== true
|
|
162
162
|
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
163
|
-
|
|
163
|
+
(cp as any)
|
|
164
164
|
: new MemorySaver();
|
|
165
165
|
return builder.compile({ checkpointer: checkpointerToUse });
|
|
166
166
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-harness/capability-registry",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.34",
|
|
4
4
|
"description": "Capability Registry for pi-harness-runtime — tracks model capabilities and enables capability-based routing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|