@agent-plan/core 0.2.21 → 0.2.22

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/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from "./recap.js";
6
6
  export * from "./display-status.js";
7
7
  export * from "./task-context.js";
8
8
  export * from "./task-selection.js";
9
+ export * from "./package-version.js";
9
10
  export { PlanStore, PlanStoreError, setWriteBusyHook, setWriteNotifyHook, migrateToUuids, migrateToGlobalSequence, withFeatureLock, type PhaseHandoffSummary, type OrphanPhaseSummary } from "./plan-store.js";
10
11
  export { PlanRenderer } from "./renderer.js";
11
12
  export { ExportService } from "./export-service.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,uBAAuB,EAAE,eAAe,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC/M,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,uBAAuB,EAAE,eAAe,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC/M,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ export * from "./recap.js";
6
6
  export * from "./display-status.js";
7
7
  export * from "./task-context.js";
8
8
  export * from "./task-selection.js";
9
+ export * from "./package-version.js";
9
10
  export { PlanStore, PlanStoreError, setWriteBusyHook, setWriteNotifyHook, migrateToUuids, migrateToGlobalSequence, withFeatureLock } from "./plan-store.js";
10
11
  export { PlanRenderer } from "./renderer.js";
11
12
  export { ExportService } from "./export-service.js";
@@ -0,0 +1,9 @@
1
+ export interface RuntimePackageVersion {
2
+ name: string;
3
+ version: string;
4
+ }
5
+ /** Find the nearest matching package manifest above a loaded module. */
6
+ export declare function packageVersionFromModule(moduleUrlOrPath: string, expectedName: string): RuntimePackageVersion;
7
+ /** Resolve a dependency exactly as the caller loaded it, then read its manifest. */
8
+ export declare function resolvedPackageVersion(packageName: string, fromModuleUrl: string): RuntimePackageVersion;
9
+ //# sourceMappingURL=package-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-version.d.ts","sourceRoot":"","sources":["../src/package-version.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAaD,wEAAwE;AACxE,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,GACnB,qBAAqB,CAqBvB;AAED,oFAAoF;AACpF,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,GACpB,qBAAqB,CAGvB"}
@@ -0,0 +1,35 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ function modulePath(moduleUrlOrPath) {
6
+ return moduleUrlOrPath.startsWith("file:")
7
+ ? fileURLToPath(moduleUrlOrPath)
8
+ : moduleUrlOrPath;
9
+ }
10
+ /** Find the nearest matching package manifest above a loaded module. */
11
+ export function packageVersionFromModule(moduleUrlOrPath, expectedName) {
12
+ let current = dirname(modulePath(moduleUrlOrPath));
13
+ while (true) {
14
+ const manifestPath = join(current, "package.json");
15
+ if (existsSync(manifestPath)) {
16
+ const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
17
+ if (manifest.name === expectedName) {
18
+ if (typeof manifest.version !== "string" || !manifest.version.trim()) {
19
+ throw new Error(`Package ${expectedName} has no valid version in ${manifestPath}.`);
20
+ }
21
+ return { name: expectedName, version: manifest.version };
22
+ }
23
+ }
24
+ const parent = dirname(current);
25
+ if (parent === current)
26
+ break;
27
+ current = parent;
28
+ }
29
+ throw new Error(`Could not locate package.json for ${expectedName} from ${moduleUrlOrPath}.`);
30
+ }
31
+ /** Resolve a dependency exactly as the caller loaded it, then read its manifest. */
32
+ export function resolvedPackageVersion(packageName, fromModuleUrl) {
33
+ const entryPath = createRequire(fromModuleUrl).resolve(packageName);
34
+ return packageVersionFromModule(entryPath, packageName);
35
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-plan/core",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "private": false,
5
5
  "description": "Harness-agnostic core for Agent Plan: schemas, persistence, ordering, status rollups, and markdown rendering.",
6
6
  "license": "MIT",