gsd-pi 2.28.0-dev.a3afd44 → 2.28.0-dev.b28e67a

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.
@@ -1,5 +1,4 @@
1
1
  import { DefaultResourceLoader } from '@gsd/pi-coding-agent';
2
- import { createHash } from 'node:crypto';
3
2
  import { homedir } from 'node:os';
4
3
  import { chmodSync, copyFileSync, cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs';
5
4
  import { dirname, join, relative, resolve } from 'node:path';
@@ -42,11 +41,7 @@ function getBundledGsdVersion() {
42
41
  }
43
42
  }
44
43
  function writeManagedResourceManifest(agentDir) {
45
- const manifest = {
46
- gsdVersion: getBundledGsdVersion(),
47
- syncedAt: Date.now(),
48
- contentHash: computeResourceFingerprint(),
49
- };
44
+ const manifest = { gsdVersion: getBundledGsdVersion(), syncedAt: Date.now() };
50
45
  writeFileSync(getManagedResourceManifestPath(agentDir), JSON.stringify(manifest));
51
46
  }
52
47
  export function readManagedResourceVersion(agentDir) {
@@ -58,44 +53,6 @@ export function readManagedResourceVersion(agentDir) {
58
53
  return null;
59
54
  }
60
55
  }
61
- function readManagedResourceManifest(agentDir) {
62
- try {
63
- return JSON.parse(readFileSync(getManagedResourceManifestPath(agentDir), 'utf-8'));
64
- }
65
- catch {
66
- return null;
67
- }
68
- }
69
- /**
70
- * Computes a lightweight content fingerprint of the bundled resources directory.
71
- *
72
- * Walks all files under resourcesDir and hashes their relative paths + sizes.
73
- * This catches same-version content changes (npm link dev workflow, hotfixes
74
- * within a release) without the cost of reading every file's contents.
75
- *
76
- * ~1ms for a typical resources tree (~100 files) — just stat calls, no reads.
77
- */
78
- function computeResourceFingerprint() {
79
- const entries = [];
80
- collectFileEntries(resourcesDir, resourcesDir, entries);
81
- entries.sort();
82
- return createHash('sha256').update(entries.join('\n')).digest('hex').slice(0, 16);
83
- }
84
- function collectFileEntries(dir, root, out) {
85
- if (!existsSync(dir))
86
- return;
87
- for (const entry of readdirSync(dir, { withFileTypes: true })) {
88
- const fullPath = join(dir, entry.name);
89
- if (entry.isDirectory()) {
90
- collectFileEntries(fullPath, root, out);
91
- }
92
- else {
93
- const rel = relative(root, fullPath);
94
- const size = statSync(fullPath).size;
95
- out.push(`${rel}:${size}`);
96
- }
97
- }
98
- }
99
56
  export function getNewerManagedResourceVersion(agentDir, currentVersion) {
100
57
  const managedVersion = readManagedResourceVersion(agentDir);
101
58
  if (!managedVersion) {
@@ -199,17 +156,12 @@ function copyDirRecursive(src, dest) {
199
156
  */
200
157
  export function initResources(agentDir) {
201
158
  mkdirSync(agentDir, { recursive: true });
202
- // Skip the full copy when both version AND content fingerprint match.
203
- // Version-only checks miss same-version content changes (npm link dev workflow,
204
- // hotfixes within a release). The content hash catches those at ~1ms cost.
159
+ // Skip the full copy when the synced version already matches the running version.
160
+ // This avoids ~800ms of synchronous rmSync + cpSync on every startup.
205
161
  const currentVersion = getBundledGsdVersion();
206
- const manifest = readManagedResourceManifest(agentDir);
207
- if (manifest && manifest.gsdVersion === currentVersion) {
208
- // Version matches — check content fingerprint for same-version staleness.
209
- const currentHash = computeResourceFingerprint();
210
- if (manifest.contentHash && manifest.contentHash === currentHash) {
211
- return;
212
- }
162
+ const managedVersion = readManagedResourceVersion(agentDir);
163
+ if (managedVersion && managedVersion === currentVersion) {
164
+ return;
213
165
  }
214
166
  syncResourceDir(bundledExtensionsDir, join(agentDir, 'extensions'));
215
167
  syncResourceDir(join(resourcesDir, 'agents'), join(agentDir, 'agents'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gsd-pi",
3
- "version": "2.28.0-dev.a3afd44",
3
+ "version": "2.28.0-dev.b28e67a",
4
4
  "description": "GSD — Get Shit Done coding agent",
5
5
  "license": "MIT",
6
6
  "repository": {