trantor 0.18.137 → 0.18.138

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.
@@ -6,14 +6,14 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Trantor — the hub-world for AI agent crews: live message bus, presence, project Kanban/flow board + context-handoff for independent AI coding agents (Claude, Codex, Gemini, …)",
9
- "version": "0.18.137"
9
+ "version": "0.18.138"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "trantor",
14
14
  "source": "./",
15
15
  "description": "The hub-world for AI agent crews. Say \"fire up the crew\" and Claude becomes the architect: a plan-aware Advisor routes the work (solo / cheap inline calls / live crew of Codex, GLM, Kimi & DeepSeek in their own terminal windows), a Kanban/flow command center with a testing gate tracks it, and an economics brain (Scrooge) keeps the receipts. Includes the relay MCP, a SessionStart auto-discovery hook, and a PreCompact context-handoff so a fresh session can take over a full window instead of compacting.",
16
- "version": "0.18.137",
16
+ "version": "0.18.138",
17
17
  "author": {
18
18
  "name": "Sasha Bogojevic"
19
19
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trantor",
3
- "version": "0.18.137",
3
+ "version": "0.18.138",
4
4
  "description": "Trantor — the hub-world for AI agent crews: live message bus, presence, project Kanban/flow board + crew orchestration for independent AI coding agents (Claude, Codex, Gemini, Kimi, DeepSeek)",
5
5
  "mcpServers": {
6
6
  "relay": {
@@ -31,7 +31,7 @@ import {
31
31
  cardRefs, servedContractCard, carriesWork, parseTurnTokens, parseResetAt, reasonWithBalances, quotaResetAt, queuedWording, turnDelivered, budgetPause, PARKING_REASONS,
32
32
  senderProjectOf, isLinkedProject, stateSkipReason, isMessageCardTitle, OPEN_CARD_STATUSES,
33
33
  ownCardForInstance, contractedCardIds,
34
- shouldAlignForContract, hasContractText,
34
+ shouldAlignForContract, hasContractText, completedCardIds, owesReadContract,
35
35
  CUT_CHAIN_PARK_MIN, cutChainEvidence, isBoundedPark, askDuringTurn, askedVerdict,
36
36
  } from "../lib/turn-policy.mjs";
37
37
  import { snapshotBeforeCut } from "./cut-snapshot.mjs";
@@ -417,10 +417,8 @@ async function janitorStop(why, card) {
417
417
  log(text);
418
418
  await api("/send", { from: SESSION, to: "all", text, project: PROJ, kind: "status" }).catch(() => {});
419
419
  }
420
- // #7778: message ids this seat already consumed through its OWN inbox path (relay_inbox, the
421
- // PostToolUse hook) — reconciled from the hub's deliveredUpTo ledger at each clean turn boundary
422
- // and persisted in the pending file, so a message the session read mid-turn is never re-woken by
423
- // the poll, across turn AND process boundaries.
420
+ // Inbox reads dedupe context across turn boundaries; #14520 contracts still need a matching outcome.
421
+ // Persist that turn's completed cards with its read ids so later outcomes cannot consume old work.
424
422
  let seenLedger = [];
425
423
  // A cap, so a long outage cannot grow the queue without bound. Overflow drops the OLDEST and says
426
424
  // so on the bus — a silent drop is the exact failure this whole mechanism exists to end.
@@ -474,7 +472,7 @@ function loadPending() {
474
472
  wake: Array.isArray(j.wake) ? j.wake : [],
475
473
  bcast: Array.isArray(j.bcast) ? j.bcast : [],
476
474
  seen: Array.isArray(j.seen)
477
- ? j.seen.filter(e => e && Number.isFinite(Number(e.id))).map(e => ({ id: Number(e.id), ts: Number(e.ts) || 0 }))
475
+ ? j.seen.filter(e => e && Number.isFinite(Number(e.id))).map(e => ({ id: Number(e.id), ts: Number(e.ts) || 0, completedCards: e.completedCards || [] }))
478
476
  : [],
479
477
  ask: Number(j.ask) || 0, askTo: String(j.askTo || ""),
480
478
  };
@@ -1780,7 +1778,10 @@ async function resolveWakeCard(messages, { session }) {
1780
1778
  // not the shared ledger, so the second reader stands down here and the cursor adopts the consumed
1781
1779
  // ids. Filtering BEFORE the wake/bcast split keeps a dupe out of #7766's demoted-sender notice.
1782
1780
  if (seenLedger.length) {
1783
- const seenIds = new Set(seenLedger.map(e => e.id));
1781
+ const seenIds = new Set(msgs.filter(m => {
1782
+ const entry = seenLedger.find(e => e.id === m.id);
1783
+ return entry && !owesReadContract(m, SESSION, entry.completedCards);
1784
+ }).map(m => m.id));
1784
1785
  const dupes = msgs.filter(m => seenIds.has(m.id));
1785
1786
  if (dupes.length) {
1786
1787
  log(`duplicate delivery suppressed — ${dupes.map(m => `#${m.id}`).join(", ")} already consumed by the session's own inbox read`);
@@ -1886,12 +1887,13 @@ async function resolveWakeCard(messages, { session }) {
1886
1887
  // A delta wider than one turn could plausibly carry is a corrupt or rewound ledger: mark
1887
1888
  // nothing. Non-marking only risks the duplicate this fixes, never a lost message.
1888
1889
  if (!(readUpTo > upToCursor) || readUpTo - upToCursor > 10000) return 0;
1889
- for (let id = upToCursor + 1; id <= readUpTo; id++) seenLedger.push({ id, ts: Date.now() });
1890
+ const turnCompletedCards = completedCardIds(lastErrText);
1891
+ for (let id = upToCursor + 1; id <= readUpTo; id++) seenLedger.push({ id, ts: Date.now(), completedCards: turnCompletedCards });
1890
1892
  seenLedger = seenLedger.filter(e => e.id > upToCursor).slice(-500);
1891
1893
  // persist HERE, at every caller: a runner killed seconds after the boundary is exactly the
1892
1894
  // restart the restored seen-set exists for.
1893
1895
  savePending(pendingWake, pendingBcast);
1894
- log(`dedupe: message id(s) ${upToCursor + 1}..${readUpTo} were consumed by the session's own inbox read — the poll will not wake on them again`);
1896
+ log(`dedupe: message id(s) ${upToCursor + 1}..${readUpTo} were read by the session — context dedupes; contracts require a matching done/testing outcome`);
1895
1897
  return readUpTo - upToCursor;
1896
1898
  } catch { return 0; }
1897
1899
  }
package/kimi.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trantor",
3
- "version": "0.18.137",
3
+ "version": "0.18.138",
4
4
  "description": "Trantor — the hub-world for AI agent crews: live message bus, presence, project Kanban/flow board + crew orchestration for independent AI coding agents (Claude, Codex, Gemini, Kimi, DeepSeek). This manifest makes Kimi Code CLI a first-class ORCHESTRATOR, mirroring .claude-plugin/plugin.json. Hooks are the CANONICAL hooks/** executed through the kimi dialect bridge (kimi/bridge.mjs) — docs/KIMI-BRIDGE-CONTRACT.md.",
5
5
  "interface": {
6
6
  "displayName": "Trantor",
@@ -388,3 +388,18 @@ export function askedVerdict(ask) {
388
388
  export function hasContractText(text) {
389
389
  return /\bcontract(?:\s*:|\s+(?:for\s+)?#\d+\b)/i.test(String(text || ""));
390
390
  }
391
+
392
+ // #14520: reading a contract during another turn is not delivery of that contract.
393
+ export function owesReadContract(message, session, completedCards = []) {
394
+ if (message.to !== session || message.wake === false) return false;
395
+ if (message.kind !== "contract" && !hasContractText(message.text)) return false;
396
+ const cards = cardRefs(message.text);
397
+ if (Number(message.card) > 0) cards.push(Number(message.card));
398
+ return !cards.length || cards.some(id => !completedCards.includes(id));
399
+ }
400
+
401
+ // Accept explicit card outcomes, not a bare mention or a promise to finish later.
402
+ export function completedCardIds(text) {
403
+ return [...String(text || "").matchAll(/^[ \t]*(?:[-*][ \t]+)?(?:card[ \t]+)?#(\d{1,7})\b[ \t]*(?::|—|-)?[ \t]*(?:(?:is|was|moved to|moved|in|→)[ \t]+)?(done|testing)\b/gim)]
404
+ .map(match => Number(match[1]));
405
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trantor",
3
- "version": "0.18.137",
3
+ "version": "0.18.138",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "trantor": "bin/cli.mjs"