@stage-labs/metro 0.1.0-beta.239 → 0.1.0-beta.240

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stage-labs/metro",
3
- "version": "0.1.0-beta.239",
3
+ "version": "0.1.0-beta.240",
4
4
  "description": "The metro command line: run your agent on this machine, relaying its chat channels and connectors to Claude Code.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metro",
3
- "version": "0.1.0-beta.239",
3
+ "version": "0.1.0-beta.240",
4
4
  "description": "Metro for Claude Code, installed by the metro daemon on this machine: every connector the agent holds as its own MCP server relayed through the daemon, the orchestrator-only guard on the main thread, and the standing rules loaded at each session start. No vendor credential ever sits in a config file.",
5
5
  "author": {
6
6
  "name": "Bonustrack",
@@ -5,7 +5,8 @@ import { respond } from '@metro-labs/core/stations/station-runtime';
5
5
  import { accounts, lineOf, type Account } from './accounts.js';
6
6
  import { isCallSignal } from './codecs.js';
7
7
 
8
- const CALL_WINDOW_MS = 2 * 60 * 60_000;
8
+ const RECENT_MS = 24 * 60 * 60_000;
9
+ const STAGE_HISTORY = 100;
9
10
 
10
11
  interface Leftover {
11
12
  line: string;
@@ -32,15 +33,15 @@ function openJoins(acct: Account, line: string, messages: DecodedMessage[]): Lef
32
33
  async function leftoversOf(acct: Account, sinceNs: bigint): Promise<Leftover[]> {
33
34
  const found: Leftover[] = [];
34
35
  for (const conv of await acct.client.conversations.list()) {
35
- const messages = await conv.messages({ sentAfterNs: sinceNs, direction: 0 });
36
- found.push(...openJoins(acct, lineOf(acct.cfg.id, conv.id), messages));
36
+ const newestFirst = await conv.messages({ sentAfterNs: sinceNs, direction: 1, limit: STAGE_HISTORY });
37
+ found.push(...openJoins(acct, lineOf(acct.cfg.id, conv.id), newestFirst.reverse()));
37
38
  }
38
39
  return found;
39
40
  }
40
41
 
41
42
  export async function callLeftovers(id: string): Promise<void> {
42
43
  if (accounts.size === 0) throw new TrainError('UNAVAILABLE', 'no XMTP account is ready yet');
43
- const sinceNs = BigInt(Date.now() - CALL_WINDOW_MS) * 1_000_000n;
44
+ const sinceNs = BigInt(Date.now() - RECENT_MS) * 1_000_000n;
44
45
  const calls: Leftover[] = [];
45
46
  for (const acct of accounts.values()) calls.push(...(await leftoversOf(acct, sinceNs)));
46
47
  respond(id, { result: { calls } });
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "0.1.0-beta.239"
2
+ "version": "0.1.0-beta.240"
3
3
  }