@lincoln504/pi-research 1.0.5 → 1.0.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/dist/cli.mjs
CHANGED
|
@@ -20428,11 +20428,11 @@ init_constants();
|
|
|
20428
20428
|
// src/orchestration/headless-observer.ts
|
|
20429
20429
|
init_logger();
|
|
20430
20430
|
function makeSafeObserver(observer) {
|
|
20431
|
-
return new Proxy(
|
|
20432
|
-
get(
|
|
20431
|
+
return new Proxy({}, {
|
|
20432
|
+
get(_target, prop) {
|
|
20433
20433
|
let value;
|
|
20434
20434
|
try {
|
|
20435
|
-
value = Reflect.get(
|
|
20435
|
+
value = Reflect.get(observer, prop, observer);
|
|
20436
20436
|
} catch (err) {
|
|
20437
20437
|
logger.warn(`[observer] Ignored error reading observer.${String(prop)}:`, err);
|
|
20438
20438
|
return void 0;
|
|
@@ -20440,7 +20440,7 @@ function makeSafeObserver(observer) {
|
|
|
20440
20440
|
if (typeof value !== "function") return value;
|
|
20441
20441
|
return (...args) => {
|
|
20442
20442
|
try {
|
|
20443
|
-
const out = value.apply(
|
|
20443
|
+
const out = value.apply(observer, args);
|
|
20444
20444
|
if (out && typeof out.then === "function") {
|
|
20445
20445
|
return out.catch((err) => {
|
|
20446
20446
|
logger.warn(`[observer] Ignored rejection from observer.${String(prop)}:`, err);
|
|
@@ -20452,6 +20452,17 @@ function makeSafeObserver(observer) {
|
|
|
20452
20452
|
return void 0;
|
|
20453
20453
|
}
|
|
20454
20454
|
};
|
|
20455
|
+
},
|
|
20456
|
+
has(_target, prop) {
|
|
20457
|
+
try {
|
|
20458
|
+
return Reflect.has(observer, prop);
|
|
20459
|
+
} catch {
|
|
20460
|
+
return false;
|
|
20461
|
+
}
|
|
20462
|
+
},
|
|
20463
|
+
// Keep `instanceof` transparent (legal on an extensible target).
|
|
20464
|
+
getPrototypeOf() {
|
|
20465
|
+
return Reflect.getPrototypeOf(observer);
|
|
20455
20466
|
}
|
|
20456
20467
|
});
|
|
20457
20468
|
}
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -25,8 +25,8 @@ pi CLI
|
|
|
25
25
|
in-session, the calling agent picks the depth (1–3) from the user's wording and the
|
|
26
26
|
task's complexity, guided by the tool's usage prompt (`src/prompts/research-tool-usage.md`).
|
|
27
27
|
CLI and SDK callers pass the depth explicitly.
|
|
28
|
-
2. Depth 0 takes the quick path; depth 1–3 takes the deep path (below). The
|
|
29
|
-
|
|
28
|
+
2. Depth 0 takes the quick path; depth 1–3 takes the deep path (below). The pi extension's
|
|
29
|
+
tool and the TUI are restricted to levels 1–3; the CLI, SDK, and agent skill can pass 0.
|
|
30
30
|
3. On the deep path the coordinator plans the research tracks and runs one initial
|
|
31
31
|
search burst, then hands each researcher a set of result URLs to start from.
|
|
32
32
|
4. Researchers scrape and read those pages through the scrape tooling and return cited
|
|
@@ -154,7 +154,8 @@ WriterQueue (async, non-blocking)
|
|
|
154
154
|
Key files: `src/knowledge/store.ts` (LanceDB operations), `embedder.ts` (model load +
|
|
155
155
|
batched inference), `writer-queue.ts` (async writes + content-hash dedup), `chunker.ts`
|
|
156
156
|
(chunking), `webgpu-viability.ts` (out-of-process GPU probe + cached verdict),
|
|
157
|
-
`migration.ts` (
|
|
157
|
+
`migration.ts` (migration strategy types — the drop / backup / re-embed logic
|
|
158
|
+
itself lives in `store.ts`).
|
|
158
159
|
|
|
159
160
|
The store needs native ONNX-runtime and LanceDB bindings. On platforms with no prebuilt
|
|
160
161
|
binary — notably Intel macOS (`darwin-x64`) — it is absent: the health check reports it
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: pi-research
|
|
3
3
|
description: "Multi-agent web research for any coding agent. Use for anything requiring current information from the internet — news, trends, product/service/company facts, statistics, people, places, events, APIs, library behavior, or 'what is X / how does X work' questions. Also use to search a local knowledge store of previously researched findings before doing live research. Powered by the pi-research engine (search, stealth scraping, security databases, Stack Exchange). Not for reading local files, running project commands, or analyzing this repository's own source."
|
|
4
4
|
license: MIT
|
|
5
|
-
metadata: { "author": "Lincoln Deen", "version": "1.0.
|
|
5
|
+
metadata: { "author": "Lincoln Deen", "version": "1.0.6", "package": "@lincoln504/pi-research", "engine": "pi-research-sdk", "openclaw": { "requires": { "bins": ["node"] } } }
|
|
6
6
|
allowed-tools: Bash(node:*)
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -24,16 +24,23 @@ export type { HeadlessObserverOptions };
|
|
|
24
24
|
* rejections never become unhandled.
|
|
25
25
|
*/
|
|
26
26
|
export function makeSafeObserver<T extends object>(observer: T): T {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
// Proxy a FRESH empty object and close over the real observer instead of
|
|
28
|
+
// proxying the observer directly: a `get` trap on the observer itself may
|
|
29
|
+
// not substitute a wrapper for a non-writable non-configurable own data
|
|
30
|
+
// property (Proxy invariant), so a frozen observer — a common defensive
|
|
31
|
+
// pattern for SDK callback bags — would make the engine throw TypeError at
|
|
32
|
+
// the property ACCESS, outside every try/catch. An empty target has no own
|
|
33
|
+
// properties, so no invariant can ever bind the trap.
|
|
34
|
+
return new Proxy({} as T, {
|
|
35
|
+
get(_target, prop) {
|
|
36
|
+
// Guard the ACCESS too, and resolve getters against the observer (not
|
|
37
|
+
// the proxy): an observer exposing a method via an accessor that touches
|
|
38
|
+
// a private field would otherwise throw at `observer?.onX?.(...)`
|
|
39
|
+
// property access — outside the call-site try/catch below — which is
|
|
40
|
+
// exactly the failure this wrapper exists to absorb.
|
|
34
41
|
let value: unknown;
|
|
35
42
|
try {
|
|
36
|
-
value = Reflect.get(
|
|
43
|
+
value = Reflect.get(observer, prop, observer);
|
|
37
44
|
} catch (err) {
|
|
38
45
|
logger.warn(`[observer] Ignored error reading observer.${String(prop)}:`, err);
|
|
39
46
|
return undefined;
|
|
@@ -41,7 +48,7 @@ export function makeSafeObserver<T extends object>(observer: T): T {
|
|
|
41
48
|
if (typeof value !== 'function') return value;
|
|
42
49
|
return (...args: unknown[]) => {
|
|
43
50
|
try {
|
|
44
|
-
const out = value.apply(
|
|
51
|
+
const out = value.apply(observer, args);
|
|
45
52
|
if (out && typeof (out as Promise<unknown>).then === 'function') {
|
|
46
53
|
return (out as Promise<unknown>).catch((err: unknown) => {
|
|
47
54
|
logger.warn(`[observer] Ignored rejection from observer.${String(prop)}:`, err);
|
|
@@ -54,6 +61,17 @@ export function makeSafeObserver<T extends object>(observer: T): T {
|
|
|
54
61
|
}
|
|
55
62
|
};
|
|
56
63
|
},
|
|
64
|
+
has(_target, prop) {
|
|
65
|
+
try {
|
|
66
|
+
return Reflect.has(observer, prop);
|
|
67
|
+
} catch {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
// Keep `instanceof` transparent (legal on an extensible target).
|
|
72
|
+
getPrototypeOf() {
|
|
73
|
+
return Reflect.getPrototypeOf(observer);
|
|
74
|
+
},
|
|
57
75
|
}) as T;
|
|
58
76
|
}
|
|
59
77
|
|