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