@astrosheep/square 0.3.82 → 0.3.83

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.
@@ -23,7 +23,30 @@ function requireSuccess(result, action) {
23
23
  return;
24
24
  throw new Error(`Pi ${action} failed: ${result.stderr.trim() || result.stdout.trim() || `exit ${result.status}`}`);
25
25
  }
26
+ function localSquareRoot(homeDir) {
27
+ const agentDir = path.join(homeDir, '.pi', 'agent');
28
+ const settingsPath = path.join(agentDir, 'settings.json');
29
+ if (!fs.existsSync(settingsPath))
30
+ return undefined;
31
+ const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
32
+ for (const entry of settings.packages ?? []) {
33
+ const source = typeof entry === 'string' ? entry : entry.source;
34
+ if (/^(?:npm:|git:|https?:\/\/)/.test(source))
35
+ continue;
36
+ const root = source.startsWith('~/') ? path.resolve(homeDir, source.slice(2)) : path.resolve(agentDir, source);
37
+ const manifestPath = path.join(root, 'package.json');
38
+ if (!fs.existsSync(manifestPath))
39
+ continue;
40
+ if (JSON.parse(fs.readFileSync(manifestPath, 'utf8')).name === SQUARE_IDENTITY.packageName)
41
+ return root;
42
+ }
43
+ return undefined;
44
+ }
26
45
  export function installPiPackage(homeDir, run = runPi) {
46
+ // Pi treats local paths and npm names as distinct sources, even for the same package.
47
+ const local = localSquareRoot(homeDir);
48
+ if (local !== undefined)
49
+ return [local];
27
50
  requireSuccess(run(homeDir, ['install', piPackageSource()]), 'package install');
28
51
  return [piPackageRoot(homeDir)];
29
52
  }
@@ -33,7 +56,8 @@ export function uninstallPiPackage(homeDir, run = runPi) {
33
56
  }
34
57
  export function doctorPiPackage(homeDir, run = runPi) {
35
58
  const listed = run(homeDir, ['list']);
36
- const root = piPackageRoot(homeDir);
59
+ const local = localSquareRoot(homeDir);
60
+ const root = local ?? piPackageRoot(homeDir);
37
61
  const manifestPath = path.join(root, 'package.json');
38
62
  let manifest;
39
63
  try {
@@ -44,7 +68,7 @@ export function doctorPiPackage(homeDir, run = runPi) {
44
68
  }
45
69
  const extensions = manifest?.pi?.extensions;
46
70
  return [
47
- listed.status === 0 && listed.stdout.includes(SQUARE_IDENTITY.packageName)
71
+ local !== undefined || listed.status === 0 && listed.stdout.includes(SQUARE_IDENTITY.packageName)
48
72
  ? `✓ Pi package ${SQUARE_IDENTITY.packageName} configured`
49
73
  : `○ Pi package ${SQUARE_IDENTITY.packageName} not configured`,
50
74
  manifest?.version === SQUARE_IDENTITY.packageVersion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrosheep/square",
3
- "version": "0.3.82",
3
+ "version": "0.3.83",
4
4
  "description": "A shared public square where agents join, catch activity, express, and step out when done.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "square",
3
- "version": "0.3.82",
3
+ "version": "0.3.83",
4
4
  "description": "Native Claude Code inbox delivery for Square participants",
5
5
  "types": "./types.d.ts",
6
6
  "author": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "square",
3
- "version": "0.3.82",
3
+ "version": "0.3.83",
4
4
  "description": "Shared Square activity with reliable participant attention at Codex boundaries.",
5
5
  "author": {
6
6
  "name": "Square"