mtech-ai-local-runner 0.1.59 → 0.1.60

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/README.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.1.60: answers go back to the session that asked
2
+
3
+ An answer to a colleague ask now goes first to the session that made the ask, when the asking AI passed its client
4
+ session id (Work Item e1c08b33). Among the sessions an answer names, the runner takes the one listed first, as long
5
+ as a person typed in it in the last 30 minutes.
6
+
1
7
  ## 0.1.59: completed publication acknowledgement
2
8
 
3
9
  Runner 0.1.59 corrects post-publication completion acknowledgement. The Gateway binding primary key is independent of the client session UUID. Recovery uses the saved binding/Job/generation mapping and exact server completion receipt; it does not renew an expired lease or replay a completed publication. Unverified PRs retain `unverified` / `CI not_run` status.
@@ -62,14 +62,18 @@ export function preferredApp(state) {
62
62
  /**
63
63
  * Spec section 5: a live session the delivery names, else the live session with the most recent human prompt. A named
64
64
  * session counts only with a human prompt in the last 30 minutes: named sessions stay live until closed, and an older
65
- * one would otherwise keep the delivery from the session the person is using (2026-10-26 Test B).
65
+ * one would otherwise keep the delivery from the session the person is using (2026-10-26 Test B). Among named sessions
66
+ * the one listed first wins: the Gateway lists the session that made the ask first (2026-10-26 test C).
66
67
  */
67
68
  export function chooseSession(item, state, now) {
68
69
  const live = Object.entries(state.sessions).filter(([, session]) => isLive(session, now));
69
- const targets = new Set(item.targetSessionHashes);
70
- const named = live.filter(([, session]) => targets.has(hashSessionId(session.sessionId)) && humanPromptWithin(session, now));
70
+ const order = new Map(item.targetSessionHashes.map((hash, index) => [hash, index]));
71
+ const rank = (session) => order.get(hashSessionId(session.sessionId)) ?? order.size;
72
+ const named = live.filter(([, session]) => rank(session) < order.size && humanPromptWithin(session, now));
71
73
  const pool = named.length > 0 ? named : live;
72
- pool.sort(([keyA, a], [keyB, b]) => (b.lastPromptAt ?? -1) - (a.lastPromptAt ?? -1) || b.lastEventAt - a.lastEventAt || keyA.localeCompare(keyB));
74
+ const byOrder = named.length > 0 ? rank : () => 0;
75
+ pool.sort(([keyA, a], [keyB, b]) => byOrder(a) - byOrder(b) || (b.lastPromptAt ?? -1) - (a.lastPromptAt ?? -1)
76
+ || b.lastEventAt - a.lastEventAt || keyA.localeCompare(keyB));
73
77
  return pool[0]?.[0] ?? null;
74
78
  }
75
79
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mtech-ai-local-runner",
3
- "version": "0.1.59",
3
+ "version": "0.1.60",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "bin": {