pi-blackhole 0.4.2 → 0.4.3
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 +15 -0
- package/dist/index.js +11660 -0
- package/dist/index.js.map +1 -0
- package/example-config.json +1 -1
- package/index.ts +37 -63
- package/package.json +21 -9
- package/src/commands/cleanup.ts +279 -240
- package/src/commands/memory.ts +236 -184
- package/src/commands/pi-vcc.ts +202 -152
- package/src/commands/vcc-recall.ts +126 -95
- package/src/core/brief.ts +167 -33
- package/src/core/build-sections.ts +8 -2
- package/src/core/config-env.ts +117 -0
- package/src/core/content.ts +31 -7
- package/src/core/drill-down.ts +41 -11
- package/src/core/filter-noise.ts +9 -3
- package/src/core/format-recall.ts +15 -6
- package/src/core/format.ts +14 -4
- package/src/core/lineage.ts +9 -3
- package/src/core/load-messages.ts +24 -5
- package/src/core/normalize.ts +38 -14
- package/src/core/recall-scope.ts +11 -3
- package/src/core/render-entries.ts +22 -6
- package/src/core/sanitize.ts +5 -1
- package/src/core/search-entries.ts +111 -19
- package/src/core/settings.ts +1 -3
- package/src/core/summarize.ts +42 -21
- package/src/core/unified-config.ts +549 -411
- package/src/extract/commits.ts +4 -2
- package/src/extract/files.ts +10 -5
- package/src/extract/goals.ts +7 -2
- package/src/hooks/before-compact.ts +210 -88
- package/src/om/agents/dropper/agent.ts +380 -265
- package/src/om/agents/dropper/coverage.ts +102 -82
- package/src/om/agents/observer/agent.ts +242 -206
- package/src/om/agents/reflector/agent.ts +212 -153
- package/src/om/cleanup.ts +239 -218
- package/src/om/clipboard.ts +59 -51
- package/src/om/compaction-trigger.ts +448 -333
- package/src/om/config.ts +13 -6
- package/src/om/configure-overlay.ts +518 -355
- package/src/om/consolidation.ts +1460 -953
- package/src/om/cooldown.ts +75 -65
- package/src/om/debug-log.ts +86 -68
- package/src/om/ids.ts +1 -1
- package/src/om/ledger/fold.ts +89 -78
- package/src/om/ledger/progress.ts +181 -153
- package/src/om/ledger/projection.ts +248 -185
- package/src/om/ledger/recall.ts +247 -196
- package/src/om/ledger/render-summary.ts +79 -50
- package/src/om/ledger/types.ts +146 -117
- package/src/om/model-budget.ts +23 -13
- package/src/om/pending.ts +243 -179
- package/src/om/provider-stream.ts +52 -7
- package/src/om/retryable-error.ts +12 -16
- package/src/om/reverse-recall.ts +97 -91
- package/src/om/runtime.ts +474 -375
- package/src/om/serialize.ts +190 -166
- package/src/om/status-overlay.ts +246 -195
- package/src/om/tokens.ts +28 -21
- package/src/pi-base/blackhole-settings.ts +437 -0
- package/src/pi-base/config-manager.ts +440 -0
- package/src/pi-base/config.ts +469 -0
- package/src/pi-base/env.ts +43 -0
- package/src/pi-base/paths.ts +47 -0
- package/src/pi-base/settings/body.ts +1648 -0
- package/src/pi-base/settings/fields/action.ts +43 -0
- package/src/pi-base/settings/fields/boolean.ts +47 -0
- package/src/pi-base/settings/fields/custom.ts +72 -0
- package/src/pi-base/settings/fields/enum.ts +310 -0
- package/src/pi-base/settings/fields/index.ts +46 -0
- package/src/pi-base/settings/fields/model.ts +452 -0
- package/src/pi-base/settings/fields/string.ts +527 -0
- package/src/pi-base/settings/fields/text.ts +115 -0
- package/src/pi-base/settings/frame.ts +197 -0
- package/src/pi-base/settings/index.ts +77 -0
- package/src/pi-base/settings/inline-edit.ts +313 -0
- package/src/pi-base/settings/modal.ts +152 -0
- package/src/pi-base/settings/types.ts +500 -0
- package/src/pi-base/settings/validate-field.ts +113 -0
- package/src/pi-base/shell.ts +117 -0
- package/src/pi-base/types.ts +6 -0
- package/src/pi-base/ui.ts +32 -0
- package/src/tools/recall.ts +347 -225
- package/src/types.ts +20 -3
- package/tsup.config.ts +23 -0
- package/vitest.config.ts +15 -15
package/src/om/clipboard.ts
CHANGED
|
@@ -1,63 +1,71 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
|
|
3
3
|
export interface ClipboardCommand {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
command: string;
|
|
5
|
+
args: string[];
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export type ClipboardCommandRunner = (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
export type ClipboardCommandRunner = (
|
|
9
|
+
command: ClipboardCommand,
|
|
10
|
+
text: string,
|
|
11
|
+
) => Promise<boolean>;
|
|
12
|
+
|
|
13
|
+
export function getClipboardCommands(
|
|
14
|
+
platform: NodeJS.Platform = process.platform,
|
|
15
|
+
): ClipboardCommand[] {
|
|
16
|
+
switch (platform) {
|
|
17
|
+
case "darwin":
|
|
18
|
+
return [{ command: "pbcopy", args: [] }];
|
|
19
|
+
case "win32":
|
|
20
|
+
return [{ command: "clip", args: [] }];
|
|
21
|
+
default:
|
|
22
|
+
return [
|
|
23
|
+
{ command: "wl-copy", args: [] },
|
|
24
|
+
{ command: "xclip", args: ["-selection", "clipboard"] },
|
|
25
|
+
{ command: "xsel", args: ["--clipboard", "--input"] },
|
|
26
|
+
{ command: "termux-clipboard-set", args: [] },
|
|
27
|
+
];
|
|
28
|
+
}
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
export async function copyTextToClipboard(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
text: string,
|
|
33
|
+
runner: ClipboardCommandRunner = runClipboardCommand,
|
|
34
|
+
commands: ClipboardCommand[] = getClipboardCommands(),
|
|
30
35
|
): Promise<boolean> {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
for (const command of commands) {
|
|
37
|
+
if (await runner(command, text)) return true;
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
35
40
|
}
|
|
36
41
|
|
|
37
|
-
export function runClipboardCommand(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
42
|
+
export function runClipboardCommand(
|
|
43
|
+
command: ClipboardCommand,
|
|
44
|
+
text: string,
|
|
45
|
+
): Promise<boolean> {
|
|
46
|
+
return new Promise((resolve) => {
|
|
47
|
+
let settled = false;
|
|
48
|
+
let timeout: ReturnType<typeof setTimeout> | undefined;
|
|
49
|
+
|
|
50
|
+
const finish = (ok: boolean) => {
|
|
51
|
+
if (settled) return;
|
|
52
|
+
settled = true;
|
|
53
|
+
if (timeout) clearTimeout(timeout);
|
|
54
|
+
resolve(ok);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const child = spawn(command.command, command.args, {
|
|
58
|
+
stdio: ["pipe", "ignore", "ignore"],
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
timeout = setTimeout(() => {
|
|
62
|
+
child.kill();
|
|
63
|
+
finish(false);
|
|
64
|
+
}, 2_000);
|
|
65
|
+
|
|
66
|
+
child.on("error", () => finish(false));
|
|
67
|
+
child.on("close", (code) => finish(code === 0));
|
|
68
|
+
child.stdin.on("error", () => undefined);
|
|
69
|
+
child.stdin.end(text, "utf8");
|
|
70
|
+
});
|
|
63
71
|
}
|