@agent-plan/server 0.2.19-next.0 → 0.2.19-next.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.
@@ -1 +1 @@
1
- {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAiHpC,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;AA8tBD,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,CAkFvE"}
package/dist/serve.js CHANGED
@@ -648,39 +648,47 @@ function createApiApp(store, hubRef, apiPrefix = "", uiConfig, isBusy) {
648
648
  return c.json({ error: "ids required" }, 400);
649
649
  const gap = 10;
650
650
  if (kind === "feature") {
651
- await store.updateFeatures((doc) => {
652
- for (const [i, id] of ids.entries()) {
653
- const f = doc.features.find((x) => x.id === id);
654
- if (f)
655
- f.priority = (i + 1) * gap;
656
- }
657
- doc.features.sort((a, b) => a.priority - b.priority || a.number - b.number);
658
- return doc;
651
+ // Priority-only: suspend status rollup so reordering never flips a
652
+ // partially-done feature to in-progress (priority ≠ status).
653
+ await store.runBatch(async () => {
654
+ await store.updateFeatures((doc) => {
655
+ for (const [i, id] of ids.entries()) {
656
+ const f = doc.features.find((x) => x.id === id);
657
+ if (f)
658
+ f.priority = (i + 1) * gap;
659
+ }
660
+ doc.features.sort((a, b) => a.priority - b.priority || a.number - b.number);
661
+ return doc;
662
+ });
659
663
  });
660
664
  hub()?.broadcast({ type: "features-updated", data: { action: "reordered" } });
661
665
  }
662
666
  else if (kind === "phase") {
663
667
  const phases = await store.loadAllPhases();
664
- for (const [i, id] of ids.entries()) {
665
- if (phases.some((x) => x.id === id)) {
666
- await store.updatePhase(id, (entry) => { entry.priority = (i + 1) * gap; return entry; });
668
+ await store.runBatch(async () => {
669
+ for (const [i, id] of ids.entries()) {
670
+ if (phases.some((x) => x.id === id)) {
671
+ await store.updatePhase(id, (entry) => { entry.priority = (i + 1) * gap; return entry; });
672
+ }
667
673
  }
668
- }
674
+ });
669
675
  hub()?.broadcast({ type: "phases-updated", data: { action: "reordered" } });
670
676
  }
671
677
  else if (kind === "task") {
672
678
  const allPhases = await store.loadAllPhases();
673
679
  const host = allPhases.find((p) => p.tasks.some((t) => ids.includes(t.id)));
674
680
  if (host) {
675
- await store.updatePhase(host.id, (phase) => {
676
- for (const [i, id] of ids.entries()) {
677
- const t = phase.tasks.find((x) => x.id === id);
678
- if (t)
679
- t.priority = (i + 1) * gap;
680
- }
681
- phase.tasks.sort((a, b) => a.priority - b.priority || a.number - b.number);
682
- phase.taskIds = phase.tasks.map((t) => t.id);
683
- return phase;
681
+ await store.runBatch(async () => {
682
+ await store.updatePhase(host.id, (phase) => {
683
+ for (const [i, id] of ids.entries()) {
684
+ const t = phase.tasks.find((x) => x.id === id);
685
+ if (t)
686
+ t.priority = (i + 1) * gap;
687
+ }
688
+ phase.tasks.sort((a, b) => a.priority - b.priority || a.number - b.number);
689
+ phase.taskIds = phase.tasks.map((t) => t.id);
690
+ return phase;
691
+ });
684
692
  });
685
693
  hub()?.broadcast({ type: "phases-updated", data: { action: "reordered", phaseId: host.id, featureId: host.featureId } });
686
694
  }
@@ -814,6 +822,11 @@ export async function serve(options) {
814
822
  }
815
823
  // Self-heal stale/legacy persisted statuses before the UI reads them.
816
824
  await store.syncStatuses();
825
+ // Backfill missing shortIds (globally-unique 5-char) + priorities so the
826
+ // Web UI always shows short IDs even before the adapter's first-turn init
827
+ // runs. Idempotent: only assigns MISSING shortIds/priorities, never
828
+ // overwrites existing ones.
829
+ await store.ensureShortIdsAndPriority().catch(() => null);
817
830
  // Shared mutable reference — routes see the hub after it's created
818
831
  const hubRef = { current: null };
819
832
  // 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.0",
3
+ "version": "0.2.19-next.1",
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.0"
44
+ "@agent-plan/core": "0.2.19-next.1"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/ws": "^8.18.0"