@kontextmind/kxm 0.7.35 → 0.7.36

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.
@@ -11,7 +11,7 @@
11
11
  "name": "kxm",
12
12
  "source": "./plugins/kxm",
13
13
  "description": "Durable workflows, peer agents, and kxm tui",
14
- "version": "0.7.35",
14
+ "version": "0.7.36",
15
15
  "category": "development",
16
16
  "tags": ["kxm", "multi-agent", "workflows", "mcp"]
17
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontextmind/kxm",
3
- "version": "0.7.35",
3
+ "version": "0.7.36",
4
4
  "description": "KXM local-first multi-agent orchestration and operator dashboard",
5
5
  "type": "module",
6
6
  "author": "KontextMind",
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
3
3
  "name": "kxm",
4
4
  "displayName": "KXM",
5
- "version": "0.7.35",
5
+ "version": "0.7.36",
6
6
  "description": "Headless multi-agent orchestration, durable workflows, and a live operator dashboard for Pi and Claude Code",
7
7
  "author": {
8
8
  "name": "KontextMind",
@@ -17121,7 +17121,7 @@ async function deliverInboxNotification(messageId, delivered, notify) {
17121
17121
  }
17122
17122
 
17123
17123
  // plugins/kxm/src/mcp-server.ts
17124
- var VERSION = "0.7.35";
17124
+ var VERSION = "0.7.36";
17125
17125
  var inbox = /* @__PURE__ */ new Map();
17126
17126
  var notifiedInbox = /* @__PURE__ */ new Set();
17127
17127
  var meshClient;
@@ -22503,6 +22503,15 @@ function rebuildVnextRunProjection(context, runId) {
22503
22503
  const last = events[events.length - 1];
22504
22504
  return persistProjection(context, stored, state, last.occurredAt);
22505
22505
  }
22506
+ function projectVnextRunReadOnly(context, runId) {
22507
+ const stored = context.eventStore.run(runId);
22508
+ if (!stored) throw runtimeError("run_unknown", runId, "run does not exist in this event store");
22509
+ const state = foldStoredVnextRun(context, stored);
22510
+ const events = context.eventStore.events(runId, 0, 1e6);
22511
+ if (events.length === 0) throw runtimeError("run_events_corrupt", runId, "run has no events");
22512
+ const last = events[events.length - 1];
22513
+ return { ...stored, status: state.status, updatedAt: last.occurredAt };
22514
+ }
22506
22515
  function persistVnextRunState(context, runId, state, lastSequence) {
22507
22516
  const stored = context.eventStore.runState(runId);
22508
22517
  if (stored) {
@@ -27310,7 +27319,7 @@ async function startVnextRuntimeSupervisorInner(paths, requestedPortOption, now)
27310
27319
  const context = contextFor(projectRoot);
27311
27320
  const bundle = loadVnextProject(projectRoot, {});
27312
27321
  if (request.method === "GET" && !sub) {
27313
- const projected = rebuildVnextRunProjection(context, runId);
27322
+ const projected = projectVnextRunReadOnly(context, runId);
27314
27323
  const folded = foldStoredVnextRun(context, projected);
27315
27324
  const drive = vnextDrivePollProjection(context, runId, folded);
27316
27325
  sendJson(response, 200, { ok: true, run: projected, ...drive !== void 0 ? { drive } : {} });
@@ -30027,6 +30036,7 @@ export {
30027
30036
  probeHarnessesForModel,
30028
30037
  probeHarnessesForModelAsync,
30029
30038
  projectRuntimeKey,
30039
+ projectVnextRunReadOnly,
30030
30040
  pruneSocketDir,
30031
30041
  readVnextRunStatus,
30032
30042
  readVnextSupervisorToken,
@@ -22031,31 +22031,14 @@ function assertStoredProjection(context, run) {
22031
22031
  throw runtimeError("run_projection_divergent", run.runId, "stored run_state does not match the folded projection");
22032
22032
  }
22033
22033
  }
22034
- function persistProjection(context, run, state, now) {
22035
- const canonical = vnextCanonicalJson(state);
22036
- const stored = context.eventStore.runState(run.runId);
22037
- if (stored && stored.state !== canonical) {
22038
- throw runtimeError("run_projection_divergent", run.runId, "stored run_state does not match the folded projection");
22039
- }
22040
- if (!stored) {
22041
- context.eventStore.upsertRunState({
22042
- runId: run.runId,
22043
- lastSequence: context.eventStore.nextSequence(run.runId) - 1,
22044
- state: canonical
22045
- });
22046
- }
22047
- const updated = { ...run, status: state.status, updatedAt: now };
22048
- if (run.status !== state.status) context.eventStore.updateRunStatus(run.runId, state.status, now);
22049
- return updated;
22050
- }
22051
- function rebuildVnextRunProjection(context, runId) {
22034
+ function projectVnextRunReadOnly(context, runId) {
22052
22035
  const stored = context.eventStore.run(runId);
22053
22036
  if (!stored) throw runtimeError("run_unknown", runId, "run does not exist in this event store");
22054
22037
  const state = foldStoredVnextRun(context, stored);
22055
22038
  const events = context.eventStore.events(runId, 0, 1e6);
22056
22039
  if (events.length === 0) throw runtimeError("run_events_corrupt", runId, "run has no events");
22057
22040
  const last = events[events.length - 1];
22058
- return persistProjection(context, stored, state, last.occurredAt);
22041
+ return { ...stored, status: state.status, updatedAt: last.occurredAt };
22059
22042
  }
22060
22043
  function persistVnextRunState(context, runId, state, lastSequence) {
22061
22044
  const stored = context.eventStore.runState(runId);
@@ -26824,7 +26807,7 @@ async function startVnextRuntimeSupervisorInner(paths, requestedPortOption, now)
26824
26807
  const context = contextFor(projectRoot);
26825
26808
  const bundle = loadVnextProject(projectRoot, {});
26826
26809
  if (request.method === "GET" && !sub) {
26827
- const projected = rebuildVnextRunProjection(context, runId);
26810
+ const projected = projectVnextRunReadOnly(context, runId);
26828
26811
  const folded = foldStoredVnextRun(context, projected);
26829
26812
  const drive = vnextDrivePollProjection(context, runId, folded);
26830
26813
  sendJson(response, 200, { ok: true, run: projected, ...drive !== void 0 ? { drive } : {} });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kxm-claude-plugin",
3
- "version": "0.7.35",
3
+ "version": "0.7.36",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "engines": {
@@ -8,7 +8,7 @@ import { AGENT_COMMANDS_MAP, enforceToolPolicy, getMcpTools, reconcileInbox } fr
8
8
  import { deliverInboxNotification } from "./inbox.ts";
9
9
  import type { HubEvent, MessageRecord } from "./protocol.ts";
10
10
 
11
- const VERSION = "0.7.35";
11
+ const VERSION = "0.7.36";
12
12
  const inbox = new Map<string, MessageRecord>();
13
13
  const notifiedInbox = new Set<string>();
14
14
  let meshClient: HubClient | undefined;
@@ -19,7 +19,7 @@ import {
19
19
  closeVnextRuntimeContext,
20
20
  foldStoredVnextRun,
21
21
  openVnextRuntimeContext,
22
- rebuildVnextRunProjection,
22
+ projectVnextRunReadOnly,
23
23
  type VnextRuntimeContext,
24
24
  } from "./vnext-runtime.ts";
25
25
  import { createVnextOneShotProducer } from "./vnext-oneshot-producer.ts";
@@ -456,7 +456,7 @@ async function startVnextRuntimeSupervisorInner(
456
456
  const context = contextFor(projectRoot);
457
457
  const bundle = loadVnextProject(projectRoot, {});
458
458
  if (request.method === "GET" && !sub) {
459
- const projected = rebuildVnextRunProjection(context, runId);
459
+ const projected = projectVnextRunReadOnly(context, runId);
460
460
  const folded = foldStoredVnextRun(context, projected);
461
461
  const drive = vnextDrivePollProjection(context, runId, folded);
462
462
  sendJson(response, 200, { ok: true, run: projected, ...(drive !== undefined ? { drive } : {}) });
@@ -524,6 +524,20 @@ export function rebuildVnextRunProjection(context: VnextRuntimeContext, runId: s
524
524
  return persistProjection(context, stored, state, last.occurredAt);
525
525
  }
526
526
 
527
+ /** Read-only projection: folds the event log over the stored record without
528
+ * persisting. GET paths must not write (no run_state upsert, no status
529
+ * update, no run_projection_divergent throw) — the event log stays the sole
530
+ * source of truth and the folded status is returned as-is. */
531
+ export function projectVnextRunReadOnly(context: VnextRuntimeContext, runId: string): VnextRunRecord {
532
+ const stored = context.eventStore.run(runId);
533
+ if (!stored) throw runtimeError("run_unknown", runId, "run does not exist in this event store");
534
+ const state = foldStoredVnextRun(context, stored);
535
+ const events = context.eventStore.events(runId, 0, 1_000_000);
536
+ if (events.length === 0) throw runtimeError("run_events_corrupt", runId, "run has no events");
537
+ const last = events[events.length - 1]!;
538
+ return { ...stored, status: state.status, updatedAt: last.occurredAt };
539
+ }
540
+
527
541
  export function persistVnextRunState(context: VnextRuntimeContext, runId: string, state: VnextRunState, lastSequence: number): void {
528
542
  const stored = context.eventStore.runState(runId);
529
543
  if (stored) {