pi-archimedes 0.7.0 → 0.8.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-archimedes",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -11,11 +11,11 @@
11
11
  ],
12
12
  "main": "./src/index.ts",
13
13
  "dependencies": {
14
- "@pi-archimedes/core": "0.7.0",
15
- "@pi-archimedes/footer": "0.7.0",
16
- "@pi-archimedes/diff": "0.7.0",
17
- "@pi-archimedes/subagent": "0.7.0",
18
- "@pi-archimedes/image-paste": "0.7.0"
14
+ "@pi-archimedes/core": "0.8.0",
15
+ "@pi-archimedes/footer": "0.8.0",
16
+ "@pi-archimedes/image-paste": "0.8.0",
17
+ "@pi-archimedes/subagent": "0.8.0",
18
+ "@pi-archimedes/diff": "0.8.0"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "@earendil-works/pi-coding-agent": ">=0.1.0",
package/src/config.ts CHANGED
@@ -1,7 +1,3 @@
1
- import { readFileSync, writeFileSync, existsSync } from "node:fs";
2
- import { join } from "node:path";
3
- import { getAgentDir } from "@earendil-works/pi-coding-agent";
4
-
5
1
  // ── Re-export core config ──────────────────────────────────────────────
6
2
 
7
3
  import {
@@ -37,6 +33,7 @@ export {
37
33
  // ── Diff config ────────────────────────────────────────────────────────
38
34
 
39
35
  import type { DiffConfig } from "@pi-archimedes/diff";
36
+ import { loadConfig, saveConfig } from "@pi-archimedes/core/settings-io";
40
37
  export type { DiffConfig } from "@pi-archimedes/diff";
41
38
 
42
39
  export const DEFAULT_DIFF_CONFIG: DiffConfig = {
@@ -45,31 +42,14 @@ export const DEFAULT_DIFF_CONFIG: DiffConfig = {
45
42
  diffSplitMinCodeWidth: 60,
46
43
  };
47
44
 
48
- const SETTINGS_PATH = join(getAgentDir(), "settings.json");
45
+ const NAMESPACE = "archimedes.diff";
49
46
 
50
47
  export function loadDiffConfig(): DiffConfig {
51
- if (existsSync(SETTINGS_PATH)) {
52
- try {
53
- const full = JSON.parse(readFileSync(SETTINGS_PATH, "utf-8"));
54
- return { ...DEFAULT_DIFF_CONFIG, ...(full["archimedes.diff"] ?? {}) };
55
- } catch {
56
- /* ignore corrupt file */
57
- }
58
- }
59
- return DEFAULT_DIFF_CONFIG;
48
+ return loadConfig(NAMESPACE, DEFAULT_DIFF_CONFIG);
60
49
  }
61
50
 
62
51
  export function saveDiffConfig(config: DiffConfig): void {
63
- let full: Record<string, unknown> = {};
64
- if (existsSync(SETTINGS_PATH)) {
65
- try {
66
- full = JSON.parse(readFileSync(SETTINGS_PATH, "utf-8"));
67
- } catch {
68
- /* ignore corrupt file */
69
- }
70
- }
71
- full["archimedes.diff"] = config;
72
- writeFileSync(SETTINGS_PATH, JSON.stringify(full, null, 2), "utf-8");
52
+ saveConfig(NAMESPACE, config);
73
53
  }
74
54
 
75
55
  // ── Composed config loader ─────────────────────────────────────────────
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { ExtensionAPI, ExtensionContext, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
2
2
 
3
- import { registerCore } from "@pi-archimedes/core";
3
+ import { registerCore, unpatchConsoleLog } from "@pi-archimedes/core";
4
4
  import { registerFooter } from "@pi-archimedes/footer";
5
5
  import { registerDiffTools } from "@pi-archimedes/diff";
6
6
  import { registerImagePaste, initImagePasteSession, shutdownImagePaste } from "@pi-archimedes/image-paste";
@@ -22,6 +22,7 @@ export default function (pi: ExtensionAPI): void {
22
22
  // session_shutdown handler (top-level to prevent accumulation on /reload)
23
23
  pi.on("session_shutdown", (_event, _ctx) => {
24
24
  shutdownImagePaste();
25
+ unpatchConsoleLog();
25
26
  });
26
27
 
27
28
  pi.on("session_start", (_event, ctx: ExtensionContext) => {