@danypops/pi-packed 0.6.0 → 0.6.1

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.
@@ -5,17 +5,17 @@
5
5
  * `Bun`. All registry reads, SQLite access, and package mutations therefore
6
6
  * stay inside the supervised Bun daemon. A restarted daemon binds a new
7
7
  * port/token, which would otherwise leave a stale cached client behind for
8
- * the rest of the Pi session -- daemon-kit's createRetryingClient detects
8
+ * the rest of the Pi session -- vehicle-client's createRetryingClient detects
9
9
  * that on the failing call itself and reconnects, so the happy path reuses
10
10
  * one connected client instead of reconnecting on every single operation.
11
11
  */
12
- import { createRetryingClient } from "@danypops/daemon-kit/pi-client";
12
+ import { createRetryingClient } from "@danypops/vehicle-client/daemon-client";
13
13
  import { ensurePackedClient, InstallServiceError, type PackedExtensionClient } from "@danypops/packed/client";
14
- import type { InstalledPackage, PackageInfo, PackageResources, PackageSummary, ResourceField, SecuritySettings, ServiceSpecSummary, SetupApplyResult, SetupPlan, UpdateEntry, UpdateOutcome } from "@danypops/packed/protocol";
14
+ import { PI_COMMAND_NAME, type InstalledPackage, type PackageInfo, type PackageResources, type PackageSummary, type PiStatus, type ResourceField, type SecuritySettings, type ServiceSpecSummary, type SetupApplyResult, type SetupPlan, type UpdateEntry, type UpdateOutcome } from "@danypops/packed/protocol";
15
15
 
16
- export { InstallServiceError };
16
+ export { InstallServiceError, PI_COMMAND_NAME };
17
17
 
18
- export type { PackageInfo, PackageResources, ResourceField, UpdateEntry, UpdateOutcome };
18
+ export type { PackageInfo, PackageResources, PiStatus, ResourceField, UpdateEntry, UpdateOutcome };
19
19
  export type InstalledPkg = InstalledPackage;
20
20
  export type PackageDaemonPort = PackedExtensionClient;
21
21
  type MutationApproval = SecuritySettings["mutationApproval"];
@@ -43,6 +43,7 @@ export interface Natives {
43
43
  setupApply(manifestPath: string, approved?: boolean, prune?: boolean): Promise<SetupApplyResult>;
44
44
  listResources(projectRoot?: string): Promise<{ global: PackageResources[]; project: PackageResources[] }>;
45
45
  toggleResource(source: string, field: ResourceField, path: string, enabled: boolean, projectRoot?: string, approved?: boolean): Promise<string>;
46
+ piStatus(): Promise<PiStatus>;
46
47
  }
47
48
 
48
49
  export type PackageDaemonConnector = () => Promise<PackageDaemonPort>;
@@ -70,5 +71,6 @@ export async function createNatives(connect: PackageDaemonConnector = connectDef
70
71
  setupApply: (manifestPath, approved, prune) => client.call((daemon) => daemon.setupApply(manifestPath, approved, prune)),
71
72
  listResources: (projectRoot) => client.call((daemon) => daemon.listResources(projectRoot)),
72
73
  toggleResource: (source, field, path, enabled, projectRoot, approved) => client.call((daemon) => daemon.toggleResource(source, field, path, enabled, projectRoot, approved)),
74
+ piStatus: () => client.call((daemon) => daemon.piStatus()),
73
75
  };
74
76
  }
@@ -2,7 +2,7 @@
2
2
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
3
3
  import { Type } from "typebox";
4
4
  import { packagePermissionDecision, type PackageOperation } from "./permission.js";
5
- import { InstallServiceError, type Natives } from "./packed.js";
5
+ import { InstallServiceError, PI_COMMAND_NAME, type Natives } from "./packed.js";
6
6
  import { reloadWarning } from "./reload.js";
7
7
  import {
8
8
  createInfoDetails,
@@ -142,7 +142,7 @@ export function registerTools(pi: ExtensionAPI, natives: Natives): void {
142
142
  pi.registerTool({
143
143
  name: "pkg_info",
144
144
  label: "Pi Package Info",
145
- description: "Show bounded metadata and declared Pi resources for one package.",
145
+ description: `Show bounded metadata and declared Pi resources for one package. Special case: querying ${PI_COMMAND_NAME} (Pi itself) also reports the locally running version against the latest published release -- a different question from, and in addition to, the generic npm registry metadata every other package gets.`,
146
146
  parameters: Type.Object({ name: Type.String({ description: "npm package name" }) }),
147
147
  renderCall(args, theme) { return renderPackageToolCall("Package info", args, theme); },
148
148
  renderResult(result, options, theme, context) { return renderPackageToolResult(result, options, theme, context); },
@@ -158,6 +158,21 @@ export function registerTools(pi: ExtensionAPI, natives: Natives): void {
158
158
  info.unpackedSize ? `size: ${(info.unpackedSize / 1024).toFixed(0)} KB` : "",
159
159
  info.modified ? `modified: ${info.modified}` : "",
160
160
  ].filter(Boolean);
161
+ // Special-cased by package identity, not by any change in risk
162
+ // profile -- still a pure read, just answering a second, genuinely
163
+ // different question (what's actually running here, not what npm
164
+ // last published) that the generic registry lookup above cannot.
165
+ if (params.name === PI_COMMAND_NAME) {
166
+ const status = await natives.piStatus().catch(() => undefined);
167
+ if (status?.current) {
168
+ const comparison = status.latest === undefined
169
+ ? "latest release unknown"
170
+ : status.upToDate === false
171
+ ? `behind -- latest is ${status.latest}, run pi update --self`
172
+ : `up to date with the latest ${status.latest}`;
173
+ lines.push(`--- Pi runtime (not npm registry data) ---`, `currently running: ${status.current}`, comparison);
174
+ }
175
+ }
161
176
  return text(lines.join("\n"), createInfoDetails(info));
162
177
  } catch (error) {
163
178
  throw new Error(`pkg_info failed: ${error instanceof Error ? error.message : error}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danypops/pi-packed",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Pi package tools, commands, profiles, and TUI for the Packed daemon",
5
5
  "type": "module",
6
6
  "keywords": ["pi-package"],
@@ -12,8 +12,9 @@
12
12
  "typecheck": "bunx tsc --noEmit"
13
13
  },
14
14
  "dependencies": {
15
- "@danypops/packed": "^0.1.0",
16
- "@danypops/daemon-kit": "^0.12.0"
15
+ "@danypops/packed": "^0.2.0",
16
+ "@danypops/vehicle-client": "^0.1.1",
17
+ "@danypops/vehicle-client-pi": "^0.1.5"
17
18
  },
18
19
  "peerDependencies": {
19
20
  "@earendil-works/pi-coding-agent": "*",
@@ -22,7 +23,7 @@
22
23
  },
23
24
  "repository": {
24
25
  "type": "git",
25
- "url": "git+https://github.com/DanyPops/pi-packed.git",
26
+ "url": "git+https://github.com/DanyPops/packed.git",
26
27
  "directory": "packages/pi-packed"
27
28
  },
28
29
  "files": ["extension", "setup", "README.md"]