@agent-plan/server 0.2.19-next.24 → 0.2.19-next.25

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 +1 @@
1
- {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAuIpC,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED,MAAM,WAAW,QAAQ;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC;IACzF,MAAM,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;CACrC;AAq0BD,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAChC,MAAM,CAAC,EAAE,CAAC,MAAM,OAAO,CA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AAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAChC,MAAM,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS,CAAC;CACtC;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,KAAK,CAAC;IACX,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CA6EvE"}
package/dist/serve.js CHANGED
@@ -6,7 +6,7 @@ import { fileURLToPath } from "node:url";
6
6
  import { createAdaptorServer } from "@hono/node-server";
7
7
  import { Hono } from "hono";
8
8
  import { cors } from "hono/cors";
9
- import { ExportService, PlanStore, PlanStoreError, createFeatureId, createPhaseId, createChecklistItemId, createShortId, createTaskId, findPhaseByRef, normalizeSlug, withFeatureLock, needsMotivation } from "@agent-plan/core";
9
+ import { ExportService, PlanStore, PlanStoreError, createFeatureId, createPhaseId, createChecklistItemId, createTaskId, findPhaseByRef, normalizeSlug, withFeatureLock, needsMotivation } from "@agent-plan/core";
10
10
  import { WsHub } from "./ws-hub.js";
11
11
  // ─── Watcher ────────────────────────────────────────────────────────────
12
12
  let watcherAbort = null;
@@ -240,14 +240,14 @@ function createApiApp(store, hubRef, apiPrefix = "", uiConfig, isBusy) {
240
240
  if (!name)
241
241
  return c.json({ error: "name required" }, 400);
242
242
  const features = await store.loadFeatures();
243
- const number = features.features.length + 1;
244
- const shortId = createShortId(await store.assignedShortIds());
243
+ const id = createFeatureId();
244
+ const identity = await store.allocateEntityIdentity("feature", id);
245
245
  const priority = await store.nextPriority("feature");
246
246
  const now = nowISO();
247
247
  const feature = {
248
- id: createFeatureId(),
249
- number,
250
- shortId,
248
+ id,
249
+ number: identity.number,
250
+ shortId: identity.shortId,
251
251
  priority,
252
252
  name,
253
253
  description: body.description ?? "",
@@ -349,16 +349,16 @@ function createApiApp(store, hubRef, apiPrefix = "", uiConfig, isBusy) {
349
349
  let phase;
350
350
  await withFeatureLock(featureId, async () => {
351
351
  const allPhases = await store.loadAllPhases();
352
- const number = allPhases.filter((p) => p.featureId === featureId).length + 1;
353
352
  const slug = normalizeSlug(title);
354
- const shortId = createShortId(await store.assignedShortIds());
353
+ const id = createPhaseId();
354
+ const identity = await store.allocateEntityIdentity("phase", id);
355
355
  const priority = await store.nextPriority("phase", featureId);
356
356
  const now = nowISO();
357
357
  phase = {
358
- id: createPhaseId(),
358
+ id,
359
359
  featureId,
360
- number,
361
- shortId,
360
+ number: identity.number,
361
+ shortId: identity.shortId,
362
362
  priority,
363
363
  slug,
364
364
  title,
@@ -482,19 +482,18 @@ function createApiApp(store, hubRef, apiPrefix = "", uiConfig, isBusy) {
482
482
  }
483
483
  }
484
484
  const now = nowISO();
485
- const taskNumber = nextTaskNumber(phase);
486
485
  const shortName = normalizeSlug(title).trim() || `task-${Date.now().toString(36)}`;
487
486
  const initialStatus = body.status ?? "planned";
488
- const shortId = createShortId(await store.assignedShortIds());
489
- const priority = await store.nextPriority("task", phase.id);
490
487
  const taskId = createTaskId();
488
+ const identity = await store.allocateEntityIdentity("task", taskId);
489
+ const priority = await store.nextPriority("task", phase.id);
491
490
  const checklistItems = (body.checklist ?? []).map((s) => s.trim()).filter((s) => s.length > 0)
492
491
  .map((item, index) => ({ id: createChecklistItemId(taskId, index + 1, item), number: index + 1, title: item, checked: false }));
493
492
  const task = {
494
493
  id: taskId,
495
494
  phaseId: phase.id,
496
- number: taskNumber,
497
- shortId,
495
+ number: identity.number,
496
+ shortId: identity.shortId,
498
497
  priority,
499
498
  shortName,
500
499
  title,
@@ -938,13 +937,8 @@ export async function serve(options) {
938
937
  if (!(await store.exists())) {
939
938
  throw new Error(`.planner/ not found at: ${planRoot}. Run plan-init first.`);
940
939
  }
941
- // Self-heal stale/legacy persisted statuses before the UI reads them.
942
- await store.syncStatuses();
943
- // Backfill missing shortIds (globally-unique 5-char) + priorities so the
944
- // Web UI always shows short IDs even before the adapter's first-turn init
945
- // runs. Idempotent: only assigns MISSING shortIds/priorities, never
946
- // overwrites existing ones.
947
- await store.ensureShortIdsAndPriority().catch(() => null);
940
+ // Startup is deliberately read-only: automatic migration/backfill would
941
+ // rewrite canonical entities outside the feature currently being worked on.
948
942
  // Shared mutable reference — routes see the hub after it's created
949
943
  const hubRef = { current: null };
950
944
  // Default to the bundled web UI when the caller doesn't pass staticDir. Pass
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-plan/server",
3
- "version": "0.2.19-next.24",
3
+ "version": "0.2.19-next.25",
4
4
  "private": false,
5
5
  "description": "Local HTTP/WebSocket server for Agent Plan dashboards and planner APIs.",
6
6
  "license": "MIT",
@@ -41,7 +41,7 @@
41
41
  "@hono/node-server": "^1.14.0",
42
42
  "hono": "^4.7.0",
43
43
  "ws": "^8.18.0",
44
- "@agent-plan/core": "0.2.19-next.24"
44
+ "@agent-plan/core": "0.2.19-next.25"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/ws": "^8.18.0"