@anusornneal/chat-relay 1.3.1 → 1.3.3

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
@@ -4,6 +4,12 @@ Remote MCP relay that lets ChatGPT work with a local Windows or macOS machine th
4
4
 
5
5
  **Dashboard:** https://chat-relay.anusorn-hank.workers.dev/
6
6
 
7
+ **Learn Baseline:** See [scope, writing format, and safe agent environment guidance](docs/learn-baseline.md).
8
+
9
+ **Learn Usage Ranking:** See [receipt semantics, scoring and Cloudflare resource cost](docs/learn-usage-ranking.md).
10
+
11
+ **Shared Learn Groups:** See [group setup, roles, approval flow and resource limits](docs/shared-learn.md).
12
+
7
13
  **Release status:** v1.0 stable for internal use. Windows and macOS local agents are supported; Linux desktop control is not currently implemented. Post-1.0 fixes and operational hardening are shipped as normal patch releases.
8
14
 
9
15
  ## Quick start
@@ -57,6 +63,18 @@ Limit filesystem access to a specific root:
57
63
  npx @anusornneal/chat-relay@latest remote --root "C:\Users\you\Projects"
58
64
  ```
59
65
 
66
+ ## Self-hosting on your own Cloudflare account
67
+
68
+ A Git clone includes source and deployment templates, not Cloudflare resources, accounts, secrets, or existing data. The default `wrangler.jsonc` contains no production URL or Google OAuth client ID.
69
+
70
+ 1. Create your own Cloudflare account and Google OAuth Web application. Register `https://YOUR-WORKER.workers.dev/admin/google/callback` as an authorized redirect URI.
71
+ 2. Copy `wrangler.selfhost.example.jsonc` to `wrangler.selfhost.jsonc`, and update `PUBLIC_BASE_URL`, `GOOGLE_CLIENT_ID` and Worker name.
72
+ 3. Supply Worker secrets using `npx wrangler secret put SECRET_NAME --config wrangler.selfhost.jsonc` for `ADMIN_TOKEN`, `AGENT_TOKEN`, `CALLER_TOKEN`, and `GOOGLE_CLIENT_SECRET`. Never commit values.
73
+ 4. Run `npm run deploy:selfhost`. Missing values or the original hosted production URL are rejected.
74
+ 5. Connect ChatGPT to `https://YOUR-WORKER.workers.dev/mcp`, then connect an agent using `npx @anusornneal/chat-relay@latest remote --relay https://YOUR-WORKER.workers.dev`.
75
+
76
+ The CLI's no-argument mode remains connected to the hosted service for existing users. Setting `--relay` explicitly changes the target (and triggers sign-in if it differs). Administrative scripts require `RELAY_URL` to be explicitly configured. The hosted production deployment uses `wrangler.production.jsonc` and is only enabled through an explicit CI deployment flag.
77
+
60
78
  ## `npx` commands
61
79
 
62
80
  | Command | What it does |
@@ -217,6 +235,7 @@ The MCP surface is:
217
235
  - `learn_get` reads raw memories for selected scopes when targeted inspection is needed.
218
236
  - `learn_put` creates or updates one durable memory when Chat decides a reusable signal is worth keeping.
219
237
  - `learn_delete` removes one memory.
238
+ - `learn_merge_projects` supports direct chat project merging without desktop control. Call `action=preview` with `from` and `to` first; show counts/conflicting keys and obtain explicit user confirmation before `action=commit` with `confirmed=true` and the one-use `confirmationToken`. Previews expire after 10 minutes or when source/target memory metadata changes. Merges use the existing account-scoped transactional backend, preserve IDs and feedback, and permanently alias the source name. The tool never merges based on similar names automatically.
220
239
  - `learn_feedback` records positive or negative feedback on one memory.
221
240
 
222
241
  Memories are partitioned by authenticated account using a dedicated Learning Durable Object selected from the server-side `user.id`. Callers cannot provide or override an account id. Supported scopes are `global`, `project`, and `agent`; project and agent memories require a scope key.
@@ -251,6 +270,6 @@ The decision boundary is deliberate:
251
270
  - **Ordinary tools stay hot-path clean:** `ping_agent`, file tools, terminal tools, desktop tools, and other MCP calls do not automatically read, rank, inject, or write Learn.
252
271
  - Learned hints remain advisory and never override authorization, grants, allowed roots, destructive-tool policy, capability checks, safety, or the current user request.
253
272
 
254
- Routing hints are explicit memories. A global `project_context` memory with key `project-root:<projectKey>` stores the concrete project root. A `preferred-agent` memory may exist in project scope (preferred) or global scope (fallback). `learn_prepare` can also take explicit `projectKey` and `agentId` values when Chat already knows them.
273
+ Project aliases are account-scoped mappings stored in the Learning Durable Object. Use **My Learn → Merge projects** to join workspace names (for example `buddy-android` → `buddy2`) once, while retaining memory IDs, feedback, and timestamps; the source becomes a permanent alias for future Learn reads/writes across machines. Aliases are never inferred from similar names, and project resolution occurs only during Learn requests—not on ordinary tool calls. Merges run transactionally; conflicting keys with distinct content are renamed instead of discarded.\n\nRouting hints are explicit memories. A global `project_context` memory with key `project-root:<projectKey>` stores the concrete project root. A `preferred-agent` memory may exist in project scope (preferred) or global scope (fallback). `learn_prepare` can also take explicit `projectKey` and `agentId` values when Chat already knows them.
255
274
 
256
275
  `learn_prepare` is intentionally one-shot and stateless at the Worker level. There is no warm session cache or durable Learn session state to maintain. This prevents Learn from becoming an implicit per-tool CPU/subrequest tax while still allowing relevance-aware context preparation when it is actually useful.
@@ -29,7 +29,9 @@ export function classifySocketDisconnect(code, reason, socketError = null) {
29
29
  if (code === 4001 || reason === "credential_revoked" || reason === "credential_rejected") return "authorization";
30
30
  if (code === 4002 || reason === "protocol_incompatible") return "protocol";
31
31
  if (reason?.startsWith("unexpected_response_")) return "handshake";
32
- if (["transport_pong_timeout", "heartbeat_ack_timeout"].includes(socketError)) return "timeout";
32
+ if (["transport_pong_timeout", "heartbeat_ack_timeout", "ETIMEDOUT"].includes(socketError)) return "timeout";
33
+ if (socketError === "ENOTFOUND") return "dns";
34
+ if (["ECONNRESET", "ECONNREFUSED", "EPIPE"].includes(socketError)) return "network";
33
35
  if (code === 1006) return "abnormal_transport";
34
36
  if (code === 1012 || reason === "restart_requested" || reason === "upgrade_requested") return "restart";
35
37
  if (code === 1000 || code === 1001) return "normal";
@@ -45,7 +47,7 @@ export function computeReconnectDelay(attempt, options = {}) {
45
47
  const raw = Math.min(maxMs, baseMs * (2 ** exponent));
46
48
  const spread = raw * jitterRatio;
47
49
  const sample = Math.min(Math.max(Number(random()) || 0, 0), 1);
48
- return Math.max(100, Math.round(raw - spread + (spread * 2 * sample)));
50
+ return Math.min(maxMs, Math.max(100, Math.round(raw - spread + (spread * 2 * sample))));
49
51
  }
50
52
 
51
53
  export class AgentConnectionState {
@@ -30,7 +30,9 @@ const ENDED_TTL_MS = 30 * 60 * 1000;
30
30
 
31
31
  const BLOCKED_COMMANDS = [
32
32
  /\b(mkfs|mount|umount|fdisk|dd|parted|diskpart|sudo|su|passwd)\b/i,
33
- /\bformat\b(?!-(?:List|Table)\b)/i,
33
+ // Match disk formatting as a command, not a filename, argument or Git flag.
34
+ /(?:^|[;|&]\s*|\$\(\s*)(?:\s*&\s*)?(?:format(?:\.(?:exe|com))?|Format-Volume)(?=\s|$|[;|&)]|\/)/i,
35
+ /\bcmd(?:\.exe)?\s+\/[ck]\s+(?:\"|')?format(?:\.(?:exe|com))?(?=\s|$)/i,
34
36
  /\b(adduser|useradd|usermod|groupadd|chsh|visudo|shutdown|reboot|halt)\b/i,
35
37
  /\b(poweroff|init|iptables|firewall|netsh|sfc|bcdedit|runas|cipher|takeown)\b/i,
36
38
  /\b(reg|sc)\.exe\b/i,
@@ -9,8 +9,14 @@ import {
9
9
  saveIdentity,
10
10
  } from "./config.mjs";
11
11
 
12
+ // Hosted mode default. Self-hosted deployments must select their own URL with --relay.
12
13
  const DEFAULT_RELAY_URL = "https://chat-relay.anusorn-hank.workers.dev";
13
14
 
15
+ export function needsRelayLogin(config, requestedRelayUrl) {
16
+ if (!requestedRelayUrl) return false;
17
+ return String(config?.relayUrl || "").replace(/\/+$/, "") !== String(requestedRelayUrl).replace(/\/+$/, "");
18
+ }
19
+
14
20
  function sanitizeAgentId(value) {
15
21
  const normalized = value.toLowerCase().trim()
16
22
  .replace(/[^a-z0-9_-]+/g, "-")
@@ -73,7 +79,7 @@ function openBrowser(url) {
73
79
 
74
80
  export async function login(options = {}) {
75
81
  const existing = loadConfig() || {};
76
- const relayUrl = String(options.relayUrl || existing.relayUrl || DEFAULT_RELAY_URL).replace(/\/$/, "");
82
+ const relayUrl = String(options.relayUrl || process.env.RELAY_URL || existing.relayUrl || DEFAULT_RELAY_URL).replace(/\/$/, "");
77
83
  const hostname = os.hostname();
78
84
  const identity = loadIdentity() || {};
79
85
  const requestedAgentId = options.agentId ||
package/cli/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { clearConfig, configPath, loadConfig, saveConfig } from "./config.mjs";
2
- import { login, requestJson } from "./device-login.mjs";
2
+ import { login, needsRelayLogin, requestJson } from "./device-login.mjs";
3
3
  import { protocolCompatibility, remote, validateConfig } from "./remote.mjs";
4
4
  import { launchLatestRemote } from "./self-update.mjs";
5
5
  import { AGENT_UPGRADE_EXIT_CODE } from "../agent/lifecycle.mjs";
@@ -240,7 +240,7 @@ export async function runCli(argv = process.argv.slice(2)) {
240
240
 
241
241
  if (command === "login") {
242
242
  const current = loadConfig();
243
- if (!options.force && await validateConfig(current)) {
243
+ if (!options.force && !needsRelayLogin(current, options.relayUrl) && await validateConfig(current)) {
244
244
  console.log(`Already signed in as ${current.user?.name || current.user?.login || "user"}.`);
245
245
  console.log("Use --force to sign in again.");
246
246
  return 0;
package/cli/remote.mjs CHANGED
@@ -2,7 +2,7 @@ import { execFile, spawn } from "node:child_process";
2
2
  import { fileURLToPath } from "node:url";
3
3
  import path from "node:path";
4
4
  import { loadConfig, saveConfig } from "./config.mjs";
5
- import { login, requestJson } from "./device-login.mjs";
5
+ import { login, needsRelayLogin, requestJson } from "./device-login.mjs";
6
6
  import { acquireRunnerOwnership, RunnerAlreadyActiveError } from "./runner-ownership.mjs";
7
7
  import { getAgentVersion } from "../agent/protocol.mjs";
8
8
  import { AGENT_UPGRADE_EXIT_CODE } from "../agent/lifecycle.mjs";
@@ -94,7 +94,7 @@ function spawnAgent(config, { tui = null, onConnectionState = null } = {}) {
94
94
  export async function remote(options = {}) {
95
95
  stopping = false;
96
96
  let config = loadConfig();
97
- if (!(await validateConfig(config))) {
97
+ if (needsRelayLogin(config, options.relayUrl) || !(await validateConfig(config))) {
98
98
  console.log("No valid Chat Relay login found. Starting sign in...");
99
99
  config = await login(options);
100
100
  }
package/cli/tui.mjs CHANGED
@@ -16,7 +16,6 @@ const LABEL_WIDTH = 12;
16
16
  const GAP = 3;
17
17
  const MIN_FRAME_WIDTH = 60;
18
18
  const MAX_FRAME_WIDTH = 179;
19
- const FRAME_FIXED_ROWS = 12;
20
19
  const FRAME_BOTTOM_MARGIN = 1;
21
20
 
22
21
  function clamp(value, min, max) {
@@ -298,6 +297,68 @@ export function shouldUseColor(stdout = process.stdout, env = process.env) {
298
297
  return true;
299
298
  }
300
299
 
300
+ function cellPad(value, width) {
301
+ const clipped = truncateCells(value, Math.max(0, width));
302
+ return clipped + " ".repeat(Math.max(0, width - terminalCellWidth(clipped)));
303
+ }
304
+
305
+ function compactActivityRows(item, width, color = false) {
306
+ const limit = Math.max(1, width);
307
+ const isRunning = item.status === "running";
308
+ const symbol = isRunning ? "◌" : item.ok === false ? "×" : "✓";
309
+ const tint = isRunning ? STYLE.yellow : item.ok === false ? STYLE.red : STYLE.green;
310
+ const time = clock(item.at);
311
+ const duration = formatDuration(item.durationMs, item.status);
312
+ const text = String(item.summary || item.action || "Tool call").replace(/\s+/g, " ").trim();
313
+ const traffic = [
314
+ Number.isFinite(Number(item.requestBytes)) ? "↑" + formatBytes(item.requestBytes) : null,
315
+ Number.isFinite(Number(item.responseBytes)) ? "↓" + formatBytes(item.responseBytes) : null,
316
+ ].filter(Boolean).join(" ");
317
+ // Small viewports keep the operation visible instead of forcing telemetry columns.
318
+ if (limit < 43) {
319
+ const prefix = limit < 25 ? symbol + " " : time.slice(0, 5) + " " + symbol + " ";
320
+ const row = cellPad(prefix + text, limit);
321
+ return [color ? paint(symbol, tint) + row.slice(1) : row];
322
+ }
323
+ const durationWidth = Math.min(9, Math.max(5, terminalCellWidth(duration)));
324
+ const prefix = time + " " + symbol + " ";
325
+ const suffix = " " + cellPad(duration, durationWidth);
326
+ const trafficText = limit >= 106 && traffic ? " " + traffic : "";
327
+ const bodyWidth = Math.max(1, limit - terminalCellWidth(prefix) - terminalCellWidth(suffix) - terminalCellWidth(trafficText));
328
+ const readable = truncateCells(text, bodyWidth);
329
+ const row = prefix + cellPad(readable, bodyWidth) + trafficText + suffix;
330
+ const first = color
331
+ ? paint(time, STYLE.gray) + " " + paint(symbol, tint) + " " + cellPad(readable, bodyWidth) + paint(trafficText + suffix, STYLE.gray)
332
+ : row;
333
+ return [first];
334
+ }
335
+
336
+ function compactSummary(state, width, rows, color) {
337
+ const online = String(state.status || "").toLowerCase() === "connected" && relayIsOnline(state.relayHealth);
338
+ const stateText = online ? "● ONLINE" : statusText(state.status).replace("WebSocket open", "CONNECTED");
339
+ const c = (text, style = STYLE.gray) => color ? paint(text, style) : text;
340
+ const capabilities = [
341
+ state.terminal ? "✓ Terminal" : "× Terminal",
342
+ state.desktop ? "✓ Desktop" : "× Desktop",
343
+ "Learn " + compactLearnStatus(state.learn),
344
+ ].join(" ");
345
+ const basic = [
346
+ "Agent " + String(state.agent || "-"),
347
+ "Uptime " + formatUptime(state.uptimeMs) + " Reconnects " + (state.reconnects ?? 0),
348
+ "Root " + String(state.root || "-"),
349
+ capabilities,
350
+ ];
351
+ if (rows === 1) return [c(truncateCells(state.agent + " · " + stateText, width), online ? STYLE.green : STYLE.yellow)];
352
+ if (rows === 2) return [c(truncateCells(basic[0] + " · " + basic[1], width), STYLE.bold), c(truncateCells(capabilities, width))];
353
+ if (rows === 3) return [c(truncateCells(basic[0] + " " + basic[1], width), STYLE.bold), c(truncateCells(basic[2], width)), c(truncateCells(capabilities, width))];
354
+ return [
355
+ c(truncateCells(basic[0] + " " + basic[1], width), STYLE.bold),
356
+ c(truncateCells("Account " + state.account + " Relay " + state.relay, width)),
357
+ c(truncateCells(basic[2], width)),
358
+ c(truncateCells(capabilities, width), STYLE.green),
359
+ ];
360
+ }
361
+
301
362
  export class RemoteTui {
302
363
  constructor({
303
364
  config,
@@ -391,15 +452,15 @@ export class RemoteTui {
391
452
  const terminalWidth = Number(this.output.columns) || 110;
392
453
  const width = clamp(terminalWidth - 1, Math.min(MIN_FRAME_WIDTH, Math.max(1, terminalWidth - 1)), MAX_FRAME_WIDTH);
393
454
  const height = Math.max(1, Number(this.output.rows) || 30);
394
- const compact = height < 14;
395
- const headerRows = compact ? Math.max(1, Math.min(2, height - 3)) : 5;
396
- const fixedRows = compact ? 2 + headerRows : FRAME_FIXED_ROWS;
455
+ const compact = height < 12 || width < 48;
456
+ const headerRows = height < 9 ? 1 : compact ? 2 : width < 86 ? 3 : 4;
457
+ const fixedRows = 1 + headerRows + 2 + (height >= 14 ? 1 : 0);
397
458
  const availableRows = Math.max(1, height - fixedRows - FRAME_BOTTOM_MARGIN);
398
459
  return { width, height, availableRows, compact, headerRows };
399
460
  }
400
461
 
401
462
  transactionRows(width) {
402
- return this.transactions.flatMap((item) => formatTransactionRows(item, width, { color: this.colorEnabled }));
463
+ return this.transactions.flatMap((item) => compactActivityRows(item, width, this.colorEnabled));
403
464
  }
404
465
 
405
466
  maxScrollOffset() {
@@ -455,7 +516,7 @@ export class RemoteTui {
455
516
  appendTransaction(item) {
456
517
  if (this.scrollOffset > 0) {
457
518
  const { width } = this.viewportMetrics();
458
- this.scrollOffset += formatTransactionRows(item, width, { color: false }).length;
519
+ this.scrollOffset += compactActivityRows(item, width, false).length;
459
520
  this.unseenTransactions += 1;
460
521
  }
461
522
  this.transactions.push(item);
@@ -583,52 +644,32 @@ export class RemoteTui {
583
644
 
584
645
  render() {
585
646
  if (this.closed) return;
586
- const { width, height, availableRows, compact, headerRows } = this.viewportMetrics();
587
- const separator = "─".repeat(width);
588
- const headerState = {
589
- ...this.state,
590
- uptimeMs: Date.now() - this.startedAt,
591
- };
592
- let headerLines;
593
- if (width < MIN_FRAME_WIDTH) {
594
- const compactHeader = [
595
- truncateCells(`👤 ${headerState.account || "-"} · 💻 ${headerState.agent || "-"}`, width),
596
- truncateCells(`🔗 ${combinedStatusText(headerState.status, headerState.relayHealth)} · 🧠 Learn ${compactLearnStatus(headerState.learn)} · 📁 ${headerState.root || "-"}`, width),
597
- ];
598
- headerLines = compactHeader.map((line) => this.colorEnabled ? paint(line, STYLE.gray) : line);
599
- } else {
600
- headerLines = formatTwoColumnHeader(headerState, width, { color: this.colorEnabled }).split("\n");
601
- }
602
- if (compact) headerLines = headerLines.slice(0, headerRows);
603
-
604
- const allRows = this.transactionRows(width);
605
- const maxOffset = Math.max(0, allRows.length - availableRows);
606
- this.scrollOffset = clamp(this.scrollOffset, 0, maxOffset);
607
- const end = Math.max(0, allRows.length - this.scrollOffset);
647
+ const { width, height, availableRows, headerRows } = this.viewportMetrics();
648
+ const state = { ...this.state, uptimeMs: Date.now() - this.startedAt };
649
+ const online = state.status === "connected" && relayIsOnline(state.relayHealth);
650
+ const health = online ? "● ONLINE" : state.status === "connected" ? "○ OFFLINE" : statusText(state.status);
651
+ const healthWidth = terminalCellWidth(health);
652
+ const label = truncateCells("Chat Relay v" + this.version, Math.max(1, width - healthWidth - 2));
653
+ const topGap = " ".repeat(Math.max(1, width - terminalCellWidth(label) - healthWidth));
654
+ const top = (this.colorEnabled ? paint(label, STYLE.bold, STYLE.cyan) : label) + topGap
655
+ + (this.colorEnabled ? paint(health, online ? STYLE.green : state.status === "connected" ? STYLE.red : STYLE.yellow) : health);
656
+ const summary = compactSummary(state, width, headerRows, this.colorEnabled);
657
+ const divider = this.colorEnabled ? paint("─".repeat(width), STYLE.gray) : "─".repeat(width);
658
+ const mode = this.scrollOffset === 0 ? "● LIVE" : this.unseenTransactions ? "+" + this.unseenTransactions + " NEW" : "HISTORY";
659
+ const sectionLeft = "Activity " + mode;
660
+ const help = "↑↓ scroll · End live";
661
+ const section = truncateCells(sectionLeft + (width > terminalCellWidth(sectionLeft) + terminalCellWidth(help) + 3
662
+ ? " ".repeat(width - terminalCellWidth(sectionLeft) - terminalCellWidth(help)) + help : ""), width);
663
+ const sectionLine = this.colorEnabled ? paint(section, STYLE.cyan) : section;
664
+ const activity = this.transactionRows(width);
665
+ this.scrollOffset = clamp(this.scrollOffset, 0, Math.max(0, activity.length - availableRows));
666
+ const end = Math.max(0, activity.length - this.scrollOffset);
608
667
  const start = Math.max(0, end - availableRows);
609
- const rows = allRows.slice(start, end);
610
- while (rows.length < Math.min(availableRows, 4)) rows.unshift("");
611
-
612
- const titleText = truncateCells(`🚀 Chat Relay v${this.version}`, width);
613
- const title = this.colorEnabled ? paint(titleText, STYLE.bold, STYLE.cyan) : titleText;
614
- const divider = this.colorEnabled ? paint(separator, STYLE.gray) : separator;
615
- const mode = this.scrollOffset === 0
616
- ? "🟢 LIVE"
617
- : this.unseenTransactions > 0
618
- ? `📬 +${this.unseenTransactions} new`
619
- : "📜 HISTORY";
620
- const sectionText = truncateCells(
621
- `📜 Transactions ${mode} · wheel/↑↓ scroll · End = live`,
622
- width,
623
- );
624
- const section = this.colorEnabled ? paint(sectionText, STYLE.bold, STYLE.cyan) : sectionText;
625
-
626
- const screenLines = compact
627
- ? [title, ...headerLines, section, ...rows]
628
- : [title, divider, "", ...headerLines, "", divider, section, "", ...rows];
629
- const maxLines = Math.max(1, height - FRAME_BOTTOM_MARGIN);
630
- const screen = screenLines.slice(0, maxLines).join("\n");
631
-
668
+ const events = activity.slice(start, end);
669
+ const body = events.length ? events : [this.colorEnabled ? paint(" No recent activity", STYLE.gray) : " No recent activity"];
670
+ while (body.length < availableRows) body.unshift("");
671
+ const lines = [top, ...summary, divider, sectionLine, ...(height >= 14 ? [divider] : []), ...body];
672
+ const screen = lines.slice(0, Math.max(1, height - FRAME_BOTTOM_MARGIN)).join("\n");
632
673
  this.output.write(ESC + "2J" + ESC + "H" + screen);
633
674
  }
634
675
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anusornneal/chat-relay",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "Zero-checkout remote MCP agent for ChatGPT with terminal, filesystem, process, multi-user, and multi-agent support.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -26,7 +26,10 @@
26
26
  "status": "node bin/chat-relay.js status",
27
27
  "dev": "wrangler dev",
28
28
  "dev:test": "wrangler dev --local --port 8790 --var AGENT_TOKEN:test-agent --var CALLER_TOKEN:test-caller --var ADMIN_TOKEN:test-admin --var OPENAI_APPS_CHALLENGE:test-openai-apps-challenge",
29
- "deploy": "wrangler deploy",
29
+ "deploy": "node scripts/deploy-worker.mjs selfhost",
30
+ "deploy:selfhost": "node scripts/deploy-worker.mjs selfhost",
31
+ "deploy:production": "node scripts/deploy-worker.mjs production",
32
+ "test:deployment-config": "node --test test/deployment-config.test.mjs",
30
33
  "agent": "node --env-file-if-exists=.dev.vars agent/local-agent.mjs",
31
34
  "admin": "node scripts/admin.mjs",
32
35
  "test:terminal": "node test/mcp-terminal-smoke.mjs",
@@ -39,7 +42,7 @@
39
42
  "prepublishOnly": "npm run verify:publish",
40
43
  "test:oauth": "node test/oauth-smoke.mjs",
41
44
  "test:usage": "node test/usage-smoke.mjs",
42
- "test:usage-storage": "node test/usage-storage.test.mjs",
45
+ "test:usage-storage": "node test/usage-storage.test.mjs && node --test test/usage-batch.test.mjs",
43
46
  "test:no-quota": "node test/no-quota-regression.test.mjs",
44
47
  "test:admin-api": "node test/admin-api-smoke.mjs",
45
48
  "test:admin-auth": "node test/admin-auth-smoke.mjs",
@@ -49,7 +52,7 @@
49
52
  "test:desktop": "node test/mcp-desktop-smoke.mjs",
50
53
  "test:device-management": "node test/device-management-smoke.mjs",
51
54
  "test:submission": "node test/submission-smoke.mjs",
52
- "test:agent-state": "node --experimental-strip-types --test test/agent-state.test.mjs",
55
+ "test:agent-state": "node --experimental-strip-types --test test/agent-state.test.mjs test/reconnect-chaos.test.mjs",
53
56
  "test:tui": "node --test test/cli-tui.test.mjs",
54
57
  "test:config-security": "node --test test/config-security.test.mjs",
55
58
  "test:self-update": "node --test test/self-update.test.mjs test/agent-lifecycle-upgrade.test.mjs",
@@ -58,8 +61,9 @@
58
61
  "test:hardening": "npm run test:tool-guidance && npm run test:tui && npm run test:config-security && npm run test:self-update && npm run test:budget && npm run test:worker-hotpath && node --test test/connection-generation.test.mjs && npm run test:agent-state && node test/heartbeat-ack-watchdog.test.mjs && npm run test:no-quota && npm run test:usage-storage && npm run test:learn && npm run test:learn-bootstrap && npm run test:soak",
59
62
  "test:tool-guidance": "node --test test/tool-error-guidance.test.mjs",
60
63
  "verify:review": "node scripts/verify-review-artifacts.mjs",
61
- "test:learn": "node test/learning-smoke.mjs",
62
- "test:learn-bootstrap": "node test/learning-bootstrap-smoke.mjs",
64
+ "test:learn": "node test/learning-smoke.mjs && node test/project-alias-sqlite.test.mjs && node test/project-merge-mcp.test.mjs && node --test test/shared-learn.test.mjs test/shared-learn-ui.test.mjs && npm run test:learn-usage",
65
+ "test:learn-usage": "node test/learn-usage.test.mjs && node test/learn-usage-integration.test.mjs && node test/learn-usage-mcp.test.mjs",
66
+ "test:learn-bootstrap": "node test/learning-bootstrap-smoke.mjs && node test/learning-thai-fixtures.mjs",
63
67
  "test:worker-hotpath": "node --experimental-strip-types --test test/relay-result.test.mjs"
64
68
  },
65
69
  "dependencies": {