tandem-editor 0.11.2 → 0.12.0

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.
@@ -0,0 +1 @@
1
+ import{g as y,P as l,a as _,S as w,b,W as g}from"./window-DePn7tLG.js";import{listen as v,once as d,emit as f,emitTo as m,TauriEvent as r}from"./event-CNdo2oXa.js";import{invoke as s}from"./core-DhEqZVGG.js";function D(){return new p(y(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function c(){return s("plugin:webview|get_all_webviews").then(u=>u.map(e=>new p(new g(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}const o=["tauri://created","tauri://error"];class p{constructor(e,i,t){this.window=e,this.label=i,this.listeners=Object.create(null),t!=null&&t.skip||s("plugin:webview|create_webview",{windowLabel:e.label,options:{...t,label:i}}).then(async()=>this.emit("tauri://created")).catch(async a=>this.emit("tauri://error",a))}static async getByLabel(e){var i;return(i=(await c()).find(t=>t.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return D()}static async getAll(){return c()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const t=this.listeners[e];t.splice(t.indexOf(i),1)}:v(e,i,{target:{kind:"Webview",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const t=this.listeners[e];t.splice(t.indexOf(i),1)}:d(e,i,{target:{kind:"Webview",label:this.label}})}async emit(e,i){if(o.includes(e)){for(const t of this.listeners[e]||[])t({event:e,id:-1,payload:i});return}return f(e,i)}async emitTo(e,i,t){if(o.includes(i)){for(const a of this.listeners[i]||[])a({event:i,id:-1,payload:t});return}return m(e,i,t)}_handleTauriEvent(e,i){return o.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async position(){return s("plugin:webview|webview_position",{label:this.label}).then(e=>new l(e))}async size(){return s("plugin:webview|webview_size",{label:this.label}).then(e=>new _(e))}async close(){return s("plugin:webview|webview_close",{label:this.label})}async setSize(e){return s("plugin:webview|set_webview_size",{label:this.label,value:e instanceof w?e:new w(e)})}async setPosition(e){return s("plugin:webview|set_webview_position",{label:this.label,value:e instanceof b?e:new b(e)})}async setFocus(){return s("plugin:webview|set_webview_focus",{label:this.label})}async setAutoResize(e){return s("plugin:webview|set_webview_auto_resize",{label:this.label,value:e})}async hide(){return s("plugin:webview|webview_hide",{label:this.label})}async show(){return s("plugin:webview|webview_show",{label:this.label})}async setZoom(e){return s("plugin:webview|set_webview_zoom",{label:this.label,value:e})}async reparent(e){return s("plugin:webview|reparent",{label:this.label,window:typeof e=="string"?e:e.label})}async clearAllBrowsingData(){return s("plugin:webview|clear_all_browsing_data")}async setBackgroundColor(e){return s("plugin:webview|set_webview_background_color",{color:e})}async onDragDropEvent(e){const i=await this.listen(r.DRAG_ENTER,n=>{e({...n,payload:{type:"enter",paths:n.payload.paths,position:new l(n.payload.position)}})}),t=await this.listen(r.DRAG_OVER,n=>{e({...n,payload:{type:"over",position:new l(n.payload.position)}})}),a=await this.listen(r.DRAG_DROP,n=>{e({...n,payload:{type:"drop",paths:n.payload.paths,position:new l(n.payload.position)}})}),h=await this.listen(r.DRAG_LEAVE,n=>{e({...n,payload:{type:"leave"}})});return()=>{i(),a(),t(),h()}}}export{p as Webview,c as getAllWebviews,D as getCurrentWebview};
@@ -0,0 +1 @@
1
+ import{SERIALIZE_TO_IPC_FN as r,Resource as k,invoke as i}from"./core-DhEqZVGG.js";import{listen as L,once as A,emit as T,emitTo as I,TauriEvent as u}from"./event-CNdo2oXa.js";class z{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.width=e[0].Logical.width,this.height=e[0].Logical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toPhysical(e){return new h(this.width*e,this.height*e)}[r](){return{width:this.width,height:this.height}}toJSON(){return this[r]()}}class h{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.width=e[0].Physical.width,this.height=e[0].Physical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toLogical(e){return new z(this.width/e,this.height/e)}[r](){return{width:this.width,height:this.height}}toJSON(){return this[r]()}}class c{constructor(e){this.size=e}toLogical(e){return this.size instanceof z?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof h?this.size:this.size.toPhysical(e)}[r](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[r]()}}class x{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.x=e[0].Logical.x,this.y=e[0].Logical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toPhysical(e){return new a(this.x*e,this.y*e)}[r](){return{x:this.x,y:this.y}}toJSON(){return this[r]()}}class a{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.x=e[0].Physical.x,this.y=e[0].Physical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toLogical(e){return new x(this.x/e,this.y/e)}[r](){return{x:this.x,y:this.y}}toJSON(){return this[r]()}}class d{constructor(e){this.position=e}toLogical(e){return this.position instanceof x?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof a?this.position:this.position.toPhysical(e)}[r](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[r]()}}class w extends k{constructor(e){super(e)}static async new(e,n,l){return i("plugin:image|new",{rgba:y(e),width:n,height:l}).then(o=>new w(o))}static async fromBytes(e){return i("plugin:image|from_bytes",{bytes:y(e)}).then(n=>new w(n))}static async fromPath(e){return i("plugin:image|from_path",{path:e}).then(n=>new w(n))}async rgba(){return i("plugin:image|rgba",{rid:this.rid}).then(e=>new Uint8Array(e))}async size(){return i("plugin:image|size",{rid:this.rid})}}function y(t){return t==null?null:typeof t=="string"?t:t instanceof w?t.rid:t}var p;(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(p||(p={}));class W{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var m;(function(t){t.None="none",t.Normal="normal",t.Indeterminate="indeterminate",t.Paused="paused",t.Error="error"})(m||(m={}));function O(){return new D(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function b(){return i("plugin:window|get_all_windows").then(t=>t.map(e=>new D(e,{skip:!0})))}const _=["tauri://created","tauri://error"];class D{constructor(e,n={}){var l;this.label=e,this.listeners=Object.create(null),n!=null&&n.skip||i("plugin:window|create",{options:{...n,parent:typeof n.parent=="string"?n.parent:(l=n.parent)===null||l===void 0?void 0:l.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async o=>this.emit("tauri://error",o))}static async getByLabel(e){var n;return(n=(await b()).find(l=>l.label===e))!==null&&n!==void 0?n:null}static getCurrent(){return O()}static async getAll(){return b()}static async getFocusedWindow(){for(const e of await b())if(await e.isFocused())return e;return null}async listen(e,n){return this._handleTauriEvent(e,n)?()=>{const l=this.listeners[e];l.splice(l.indexOf(n),1)}:L(e,n,{target:{kind:"Window",label:this.label}})}async once(e,n){return this._handleTauriEvent(e,n)?()=>{const l=this.listeners[e];l.splice(l.indexOf(n),1)}:A(e,n,{target:{kind:"Window",label:this.label}})}async emit(e,n){if(_.includes(e)){for(const l of this.listeners[e]||[])l({event:e,id:-1,payload:n});return}return T(e,n)}async emitTo(e,n,l){if(_.includes(n)){for(const o of this.listeners[n]||[])o({event:n,id:-1,payload:l});return}return I(e,n,l)}_handleTauriEvent(e,n){return _.includes(e)?(e in this.listeners?this.listeners[e].push(n):this.listeners[e]=[n],!0):!1}async scaleFactor(){return i("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return i("plugin:window|inner_position",{label:this.label}).then(e=>new a(e))}async outerPosition(){return i("plugin:window|outer_position",{label:this.label}).then(e=>new a(e))}async innerSize(){return i("plugin:window|inner_size",{label:this.label}).then(e=>new h(e))}async outerSize(){return i("plugin:window|outer_size",{label:this.label}).then(e=>new h(e))}async isFullscreen(){return i("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return i("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return i("plugin:window|is_maximized",{label:this.label})}async isFocused(){return i("plugin:window|is_focused",{label:this.label})}async isDecorated(){return i("plugin:window|is_decorated",{label:this.label})}async isResizable(){return i("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return i("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return i("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return i("plugin:window|is_closable",{label:this.label})}async isVisible(){return i("plugin:window|is_visible",{label:this.label})}async title(){return i("plugin:window|title",{label:this.label})}async theme(){return i("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return i("plugin:window|is_always_on_top",{label:this.label})}async activityName(){return i("plugin:window|activity_name",{label:this.label})}async sceneIdentifier(){return i("plugin:window|scene_identifier",{label:this.label})}async center(){return i("plugin:window|center",{label:this.label})}async requestUserAttention(e){let n=null;return e&&(e===p.Critical?n={type:"Critical"}:n={type:"Informational"}),i("plugin:window|request_user_attention",{label:this.label,value:n})}async setResizable(e){return i("plugin:window|set_resizable",{label:this.label,value:e})}async setEnabled(e){return i("plugin:window|set_enabled",{label:this.label,value:e})}async isEnabled(){return i("plugin:window|is_enabled",{label:this.label})}async setMaximizable(e){return i("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return i("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return i("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return i("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return i("plugin:window|maximize",{label:this.label})}async unmaximize(){return i("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return i("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return i("plugin:window|minimize",{label:this.label})}async unminimize(){return i("plugin:window|unminimize",{label:this.label})}async show(){return i("plugin:window|show",{label:this.label})}async hide(){return i("plugin:window|hide",{label:this.label})}async close(){return i("plugin:window|close",{label:this.label})}async destroy(){return i("plugin:window|destroy",{label:this.label})}async setDecorations(e){return i("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return i("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return i("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return i("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return i("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return i("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return i("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){return i("plugin:window|set_size",{label:this.label,value:e instanceof c?e:new c(e)})}async setMinSize(e){return i("plugin:window|set_min_size",{label:this.label,value:e instanceof c?e:e?new c(e):null})}async setMaxSize(e){return i("plugin:window|set_max_size",{label:this.label,value:e instanceof c?e:e?new c(e):null})}async setSizeConstraints(e){function n(l){return l?{Logical:l}:null}return i("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:n(e==null?void 0:e.minWidth),minHeight:n(e==null?void 0:e.minHeight),maxWidth:n(e==null?void 0:e.maxWidth),maxHeight:n(e==null?void 0:e.maxHeight)}})}async setPosition(e){return i("plugin:window|set_position",{label:this.label,value:e instanceof d?e:new d(e)})}async setFullscreen(e){return i("plugin:window|set_fullscreen",{label:this.label,value:e})}async setSimpleFullscreen(e){return i("plugin:window|set_simple_fullscreen",{label:this.label,value:e})}async setFocus(){return i("plugin:window|set_focus",{label:this.label})}async setFocusable(e){return i("plugin:window|set_focusable",{label:this.label,value:e})}async setIcon(e){return i("plugin:window|set_icon",{label:this.label,value:y(e)})}async setSkipTaskbar(e){return i("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return i("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return i("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return i("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setBackgroundColor(e){return i("plugin:window|set_background_color",{color:e})}async setCursorPosition(e){return i("plugin:window|set_cursor_position",{label:this.label,value:e instanceof d?e:new d(e)})}async setIgnoreCursorEvents(e){return i("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return i("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return i("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setBadgeCount(e){return i("plugin:window|set_badge_count",{label:this.label,value:e})}async setBadgeLabel(e){return i("plugin:window|set_badge_label",{label:this.label,value:e})}async setOverlayIcon(e){return i("plugin:window|set_overlay_icon",{label:this.label,value:e?y(e):void 0})}async setProgressBar(e){return i("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return i("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async setTitleBarStyle(e){return i("plugin:window|set_title_bar_style",{label:this.label,value:e})}async setTheme(e){return i("plugin:window|set_theme",{label:this.label,value:e})}async onResized(e){return this.listen(u.WINDOW_RESIZED,n=>{n.payload=new h(n.payload),e(n)})}async onMoved(e){return this.listen(u.WINDOW_MOVED,n=>{n.payload=new a(n.payload),e(n)})}async onCloseRequested(e){return this.listen(u.WINDOW_CLOSE_REQUESTED,async n=>{const l=new W(n);await e(l),l.isPreventDefault()||await this.destroy()})}async onDragDropEvent(e){const n=await this.listen(u.DRAG_ENTER,s=>{e({...s,payload:{type:"enter",paths:s.payload.paths,position:new a(s.payload.position)}})}),l=await this.listen(u.DRAG_OVER,s=>{e({...s,payload:{type:"over",position:new a(s.payload.position)}})}),o=await this.listen(u.DRAG_DROP,s=>{e({...s,payload:{type:"drop",paths:s.payload.paths,position:new a(s.payload.position)}})}),C=await this.listen(u.DRAG_LEAVE,s=>{e({...s,payload:{type:"leave"}})});return()=>{n(),o(),l(),C()}}async onFocusChanged(e){const n=await this.listen(u.WINDOW_FOCUS,o=>{e({...o,payload:!0})}),l=await this.listen(u.WINDOW_BLUR,o=>{e({...o,payload:!1})});return()=>{n(),l()}}async onScaleChanged(e){return this.listen(u.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(u.WINDOW_THEME_CHANGED,e)}}var S;(function(t){t.Disabled="disabled",t.Throttle="throttle",t.Suspend="suspend"})(S||(S={}));var P;(function(t){t.Default="default",t.FluentOverlay="fluentOverlay"})(P||(P={}));var v;(function(t){t.AppearanceBased="appearanceBased",t.Light="light",t.Dark="dark",t.MediumLight="mediumLight",t.UltraDark="ultraDark",t.Titlebar="titlebar",t.Selection="selection",t.Menu="menu",t.Popover="popover",t.Sidebar="sidebar",t.HeaderView="headerView",t.Sheet="sheet",t.WindowBackground="windowBackground",t.HudWindow="hudWindow",t.FullScreenUI="fullScreenUI",t.Tooltip="tooltip",t.ContentBackground="contentBackground",t.UnderWindowBackground="underWindowBackground",t.UnderPageBackground="underPageBackground",t.Mica="mica",t.Blur="blur",t.Acrylic="acrylic",t.Tabbed="tabbed",t.TabbedDark="tabbedDark",t.TabbedLight="tabbedLight"})(v||(v={}));var f;(function(t){t.FollowsWindowActiveState="followsWindowActiveState",t.Active="active",t.Inactive="inactive"})(f||(f={}));function g(t){return t===null?null:{name:t.name,scaleFactor:t.scaleFactor,position:new a(t.position),size:new h(t.size),workArea:{position:new a(t.workArea.position),size:new h(t.workArea.size)}}}async function N(){return i("plugin:window|current_monitor").then(g)}async function R(){return i("plugin:window|primary_monitor").then(g)}async function M(t,e){return i("plugin:window|monitor_from_point",{x:t,y:e}).then(g)}async function B(){return i("plugin:window|available_monitors").then(t=>t.map(g))}async function F(){return i("plugin:window|cursor_position").then(t=>new a(t))}const H=Object.freeze(Object.defineProperty({__proto__:null,CloseRequestedEvent:W,get Effect(){return v},get EffectState(){return f},LogicalPosition:x,LogicalSize:z,PhysicalPosition:a,PhysicalSize:h,get ProgressBarStatus(){return m},get UserAttentionType(){return p},Window:D,availableMonitors:B,currentMonitor:N,cursorPosition:F,getAllWindows:b,getCurrentWindow:O,monitorFromPoint:M,primaryMonitor:R},Symbol.toStringTag,{value:"Module"}));export{a as P,c as S,D as W,h as a,d as b,O as g,H as w};
@@ -91,6 +91,7 @@
91
91
  --tandem-suggestion-bg: color-mix(in srgb, var(--tandem-suggestion) 10%, var(--tandem-surface));
92
92
  --tandem-suggestion-border: color-mix(in srgb, var(--tandem-suggestion) 40%, var(--tandem-border));
93
93
  --tandem-accent-border: oklch(0.84 0.10 var(--tandem-accent-h));
94
+ --tandem-selection-blurred-bg: color-mix(in srgb, var(--tandem-accent) 22%, transparent);
94
95
  --tandem-editor-font-family: var(--tandem-font-serif);
95
96
  --tandem-editor-font-size: 17px;
96
97
  --tandem-scrollbar-track: oklch(0.96 0.006 80);
@@ -187,6 +188,7 @@
187
188
  --tandem-suggestion-bg: #2e1065;
188
189
  --tandem-suggestion-border: #4c1d95;
189
190
  --tandem-accent-border: oklch(0.45 0.14 var(--tandem-accent-h));
191
+ --tandem-selection-blurred-bg: color-mix(in srgb, var(--tandem-accent) 32%, transparent);
190
192
  --tandem-scrollbar-track: oklch(0.16 0.012 270);
191
193
  --tandem-scrollbar-thumb: oklch(0.38 0.014 270);
192
194
  --tandem-highlight-yellow: rgba(255, 220, 0, 0.38);
@@ -289,8 +291,8 @@
289
291
  scrollbar-color: var(--tandem-scrollbar-thumb) var(--tandem-scrollbar-track);
290
292
  }
291
293
  </style>
292
- <script type="module" crossorigin src="/assets/index-CfT503n4.js"></script>
293
- <link rel="stylesheet" crossorigin href="/assets/index-DeJe09pn.css">
294
+ <script type="module" crossorigin src="/assets/index-n-vFW5By.js"></script>
295
+ <link rel="stylesheet" crossorigin href="/assets/index-Dn5JwXA3.css">
294
296
  </head>
295
297
  <body>
296
298
  <div id="root"></div>
@@ -9,13 +9,17 @@ var __export = (target, all) => {
9
9
  import { resolve as resolvePath } from "path";
10
10
  import { fileURLToPath } from "url";
11
11
 
12
+ // src/shared/api-paths.ts
13
+ var API_EVENTS = "/api/events";
14
+ var API_CHANNEL_AWARENESS = "/api/channel-awareness";
15
+ var API_CHANNEL_ERROR = "/api/channel-error";
16
+ var API_MODE = "/api/mode";
17
+
12
18
  // src/shared/constants.ts
13
19
  var DEFAULT_MCP_PORT = 3479;
14
20
  var TANDEM_REPO_URL = "https://github.com/bloknayrb/tandem";
15
21
  var TANDEM_ISSUES_NEW_URL = `${TANDEM_REPO_URL}/issues/new`;
16
22
  var MAX_FILE_SIZE = 50 * 1024 * 1024;
17
- var MAX_WS_PAYLOAD = 10 * 1024 * 1024;
18
- var IDLE_TIMEOUT = 30 * 60 * 1e3;
19
23
  var SESSION_MAX_AGE = 30 * 24 * 60 * 60 * 1e3;
20
24
  var TANDEM_MODE_DEFAULT = "tandem";
21
25
  var CHANNEL_MAX_RETRIES = 5;
@@ -34,7 +38,7 @@ function resolveTandemUrlCandidate(override) {
34
38
  for (const url of candidates) {
35
39
  if (url !== void 0 && url.trim() !== "") return url.trim();
36
40
  }
37
- return `http://localhost:${DEFAULT_MCP_PORT}`;
41
+ return `http://127.0.0.1:${DEFAULT_MCP_PORT}`;
38
42
  }
39
43
  function resolveAuthTokenCandidate(override) {
40
44
  const candidates = [
@@ -4211,9 +4215,14 @@ var ToolErrorCodeSchema = external_exports.enum([
4211
4215
  "FILE_NOT_FOUND",
4212
4216
  "NO_DOCUMENT",
4213
4217
  "INVALID_RANGE",
4218
+ "INVALID_ARGUMENT",
4219
+ "NOT_FOUND",
4220
+ "ANNOTATION_RESOLVED",
4214
4221
  "FORMAT_ERROR",
4215
4222
  "PERMISSION_DENIED"
4216
4223
  ]);
4224
+ var ChannelErrorCodeSchema = external_exports.enum(["CHANNEL_CONNECT_FAILED", "MONITOR_CONNECT_FAILED"]);
4225
+ var MONITOR_CONNECT_FAILED = "MONITOR_CONNECT_FAILED";
4217
4226
 
4218
4227
  // src/monitor/index.ts
4219
4228
  var IS_VITEST = process.env.VITEST === "true";
@@ -4263,12 +4272,12 @@ async function main() {
4263
4272
  console.error("[Monitor] SSE connection exhausted, exiting");
4264
4273
  try {
4265
4274
  await fetchWithTimeout(
4266
- `${TANDEM_URL}/api/channel-error`,
4275
+ `${TANDEM_URL}${API_CHANNEL_ERROR}`,
4267
4276
  {
4268
4277
  method: "POST",
4269
4278
  headers: { "Content-Type": "application/json" },
4270
4279
  body: JSON.stringify({
4271
- error: "MONITOR_CONNECT_FAILED",
4280
+ error: MONITOR_CONNECT_FAILED,
4272
4281
  message: `Monitor lost connection after ${CHANNEL_MAX_RETRIES} retries.`
4273
4282
  })
4274
4283
  },
@@ -4311,7 +4320,7 @@ async function connectAndStream(lastEventId, onEventId, onStable = () => {
4311
4320
  );
4312
4321
  let res;
4313
4322
  try {
4314
- res = await authFetch(`${TANDEM_URL}/api/events`, { headers, signal: connectCtrl.signal });
4323
+ res = await authFetch(`${TANDEM_URL}${API_EVENTS}`, { headers, signal: connectCtrl.signal });
4315
4324
  } finally {
4316
4325
  clearTimeout(connectTimer);
4317
4326
  }
@@ -4333,7 +4342,7 @@ async function connectAndStream(lastEventId, onEventId, onStable = () => {
4333
4342
  let pendingAwareness = null;
4334
4343
  function clearAwareness(documentId) {
4335
4344
  const p = fetchWithTimeout(
4336
- `${TANDEM_URL}/api/channel-awareness`,
4345
+ `${TANDEM_URL}${API_CHANNEL_AWARENESS}`,
4337
4346
  {
4338
4347
  method: "POST",
4339
4348
  headers: { "Content-Type": "application/json" },
@@ -4347,7 +4356,7 @@ async function connectAndStream(lastEventId, onEventId, onStable = () => {
4347
4356
  ).catch((err) => {
4348
4357
  console.error(
4349
4358
  "[Monitor] Awareness clear failed:",
4350
- describeFetchError(err, "/api/channel-awareness clear", AWARENESS_FETCH_TIMEOUT_MS)
4359
+ describeFetchError(err, `${API_CHANNEL_AWARENESS} clear`, AWARENESS_FETCH_TIMEOUT_MS)
4351
4360
  );
4352
4361
  });
4353
4362
  trackAwareness(p);
@@ -4358,7 +4367,7 @@ async function connectAndStream(lastEventId, onEventId, onStable = () => {
4358
4367
  pendingAwareness = null;
4359
4368
  if (event.documentId) shutdownTimers.lastDocumentId = event.documentId;
4360
4369
  const p = fetchWithTimeout(
4361
- `${TANDEM_URL}/api/channel-awareness`,
4370
+ `${TANDEM_URL}${API_CHANNEL_AWARENESS}`,
4362
4371
  {
4363
4372
  method: "POST",
4364
4373
  headers: { "Content-Type": "application/json" },
@@ -4372,7 +4381,7 @@ async function connectAndStream(lastEventId, onEventId, onStable = () => {
4372
4381
  ).catch((err) => {
4373
4382
  console.error(
4374
4383
  "[Monitor] Awareness update failed:",
4375
- describeFetchError(err, "/api/channel-awareness update", AWARENESS_FETCH_TIMEOUT_MS)
4384
+ describeFetchError(err, `${API_CHANNEL_AWARENESS} update`, AWARENESS_FETCH_TIMEOUT_MS)
4376
4385
  );
4377
4386
  });
4378
4387
  trackAwareness(p);
@@ -4470,7 +4479,7 @@ async function finalClearAwareness() {
4470
4479
  if (shutdownTimers.lastDocumentId === null) return true;
4471
4480
  try {
4472
4481
  const res = await fetchWithTimeout(
4473
- `${TANDEM_URL}/api/channel-awareness`,
4482
+ `${TANDEM_URL}${API_CHANNEL_AWARENESS}`,
4474
4483
  {
4475
4484
  method: "POST",
4476
4485
  headers: { "Content-Type": "application/json" },
@@ -4490,7 +4499,7 @@ async function finalClearAwareness() {
4490
4499
  } catch (err) {
4491
4500
  console.error(
4492
4501
  "[Monitor] Shutdown awareness clear failed:",
4493
- describeFetchError(err, "/api/channel-awareness shutdown", AWARENESS_FETCH_TIMEOUT_MS)
4502
+ describeFetchError(err, `${API_CHANNEL_AWARENESS} shutdown`, AWARENESS_FETCH_TIMEOUT_MS)
4494
4503
  );
4495
4504
  return false;
4496
4505
  }
@@ -4500,7 +4509,6 @@ async function shutdownMonitor(signal) {
4500
4509
  const ok = await finalClearAwareness();
4501
4510
  process.exit(ok ? 0 : 1);
4502
4511
  }
4503
- var shutdownForTests = shutdownMonitor;
4504
4512
  function _setLastDocumentIdForTests(id) {
4505
4513
  shutdownTimers.lastDocumentId = id;
4506
4514
  }
@@ -4534,14 +4542,14 @@ var cachedModeAt = 0;
4534
4542
  var cachedModeFailedAt = 0;
4535
4543
  async function fetchMode() {
4536
4544
  try {
4537
- const res = await fetchWithTimeout(`${TANDEM_URL}/api/mode`, {}, MODE_FETCH_TIMEOUT_MS);
4545
+ const res = await fetchWithTimeout(`${TANDEM_URL}${API_MODE}`, {}, MODE_FETCH_TIMEOUT_MS);
4538
4546
  if (!res.ok) return { ok: false, reason: `status ${res.status}` };
4539
4547
  const body = await res.json();
4540
4548
  const parsed = TandemModeSchema.safeParse(body.mode);
4541
4549
  if (!parsed.success) return { ok: false, reason: `invalid mode ${JSON.stringify(body.mode)}` };
4542
4550
  return { ok: true, mode: parsed.data };
4543
4551
  } catch (err) {
4544
- return { ok: false, reason: describeFetchError(err, "/api/mode", MODE_FETCH_TIMEOUT_MS) };
4552
+ return { ok: false, reason: describeFetchError(err, API_MODE, MODE_FETCH_TIMEOUT_MS) };
4545
4553
  }
4546
4554
  }
4547
4555
  async function getCachedMode() {
@@ -4623,7 +4631,6 @@ export {
4623
4631
  getCachedMode,
4624
4632
  getModeSync,
4625
4633
  main,
4626
- shutdownForTests,
4627
4634
  shutdownMonitor
4628
4635
  };
4629
4636
  //# sourceMappingURL=index.js.map