@ai-matrx/desktop-protocol 0.21.58 → 0.21.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.
@@ -1904,6 +1904,14 @@ declare const OPS: {
1904
1904
  title: z.ZodNullable<z.ZodString>;
1905
1905
  }, z.core.$strict>>;
1906
1906
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1907
+ title_sync: z.ZodOptional<z.ZodObject<{
1908
+ state: z.ZodEnum<{
1909
+ unsupported: "unsupported";
1910
+ synced: "synced";
1911
+ not_synced: "not_synced";
1912
+ }>;
1913
+ note: z.ZodString;
1914
+ }, z.core.$strict>>;
1907
1915
  }, z.core.$strict>>;
1908
1916
  new_window_ms: z.ZodInt;
1909
1917
  updating: z.ZodOptional<z.ZodBoolean>;
@@ -2010,6 +2018,14 @@ declare const OPS: {
2010
2018
  title: z.ZodNullable<z.ZodString>;
2011
2019
  }, z.core.$strict>>;
2012
2020
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
2021
+ title_sync: z.ZodOptional<z.ZodObject<{
2022
+ state: z.ZodEnum<{
2023
+ unsupported: "unsupported";
2024
+ synced: "synced";
2025
+ not_synced: "not_synced";
2026
+ }>;
2027
+ note: z.ZodString;
2028
+ }, z.core.$strict>>;
2013
2029
  }, z.core.$strict>;
2014
2030
  }, z.core.$strict>;
2015
2031
  readonly kind: "unary";
@@ -2097,6 +2113,14 @@ declare const OPS: {
2097
2113
  title: z.ZodNullable<z.ZodString>;
2098
2114
  }, z.core.$strict>>;
2099
2115
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
2116
+ title_sync: z.ZodOptional<z.ZodObject<{
2117
+ state: z.ZodEnum<{
2118
+ unsupported: "unsupported";
2119
+ synced: "synced";
2120
+ not_synced: "not_synced";
2121
+ }>;
2122
+ note: z.ZodString;
2123
+ }, z.core.$strict>>;
2100
2124
  }, z.core.$strict>;
2101
2125
  project: z.ZodObject<{
2102
2126
  id: z.ZodString;
@@ -2195,6 +2219,14 @@ declare const OPS: {
2195
2219
  title: z.ZodNullable<z.ZodString>;
2196
2220
  }, z.core.$strict>>;
2197
2221
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
2222
+ title_sync: z.ZodOptional<z.ZodObject<{
2223
+ state: z.ZodEnum<{
2224
+ unsupported: "unsupported";
2225
+ synced: "synced";
2226
+ not_synced: "not_synced";
2227
+ }>;
2228
+ note: z.ZodString;
2229
+ }, z.core.$strict>>;
2198
2230
  }, z.core.$strict>;
2199
2231
  message: z.ZodString;
2200
2232
  }, z.core.$strict>;
@@ -2283,6 +2315,14 @@ declare const OPS: {
2283
2315
  title: z.ZodNullable<z.ZodString>;
2284
2316
  }, z.core.$strict>>;
2285
2317
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
2318
+ title_sync: z.ZodOptional<z.ZodObject<{
2319
+ state: z.ZodEnum<{
2320
+ unsupported: "unsupported";
2321
+ synced: "synced";
2322
+ not_synced: "not_synced";
2323
+ }>;
2324
+ note: z.ZodString;
2325
+ }, z.core.$strict>>;
2286
2326
  }, z.core.$strict>>;
2287
2327
  project: z.ZodObject<{
2288
2328
  id: z.ZodString;
@@ -2412,6 +2452,14 @@ declare const OPS: {
2412
2452
  title: z.ZodNullable<z.ZodString>;
2413
2453
  }, z.core.$strict>>;
2414
2454
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
2455
+ title_sync: z.ZodOptional<z.ZodObject<{
2456
+ state: z.ZodEnum<{
2457
+ unsupported: "unsupported";
2458
+ synced: "synced";
2459
+ not_synced: "not_synced";
2460
+ }>;
2461
+ note: z.ZodString;
2462
+ }, z.core.$strict>>;
2415
2463
  }, z.core.$strict>;
2416
2464
  }, z.core.$strict>;
2417
2465
  readonly kind: "unary";
@@ -2806,6 +2854,14 @@ declare const OPS: {
2806
2854
  title: z.ZodNullable<z.ZodString>;
2807
2855
  }, z.core.$strict>>;
2808
2856
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
2857
+ title_sync: z.ZodOptional<z.ZodObject<{
2858
+ state: z.ZodEnum<{
2859
+ unsupported: "unsupported";
2860
+ synced: "synced";
2861
+ not_synced: "not_synced";
2862
+ }>;
2863
+ note: z.ZodString;
2864
+ }, z.core.$strict>>;
2809
2865
  }, z.core.$strict>;
2810
2866
  project: z.ZodObject<{
2811
2867
  id: z.ZodString;
@@ -9106,6 +9162,14 @@ declare const NAMED_SCHEMAS: {
9106
9162
  }>;
9107
9163
  title: z.ZodNullable<z.ZodString>;
9108
9164
  }, z.core.$strict>;
9165
+ readonly ChatTitleSync: z.ZodObject<{
9166
+ state: z.ZodEnum<{
9167
+ unsupported: "unsupported";
9168
+ synced: "synced";
9169
+ not_synced: "not_synced";
9170
+ }>;
9171
+ note: z.ZodString;
9172
+ }, z.core.$strict>;
9109
9173
  readonly AppsWindowsSetAccountParams: z.ZodObject<{
9110
9174
  app_key: z.ZodString;
9111
9175
  window: z.ZodString;
@@ -15228,6 +15292,14 @@ declare const NAMED_SCHEMAS: {
15228
15292
  title: z.ZodNullable<z.ZodString>;
15229
15293
  }, z.core.$strict>>;
15230
15294
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
15295
+ title_sync: z.ZodOptional<z.ZodObject<{
15296
+ state: z.ZodEnum<{
15297
+ unsupported: "unsupported";
15298
+ synced: "synced";
15299
+ not_synced: "not_synced";
15300
+ }>;
15301
+ note: z.ZodString;
15302
+ }, z.core.$strict>>;
15231
15303
  }, z.core.$strict>;
15232
15304
  readonly AppsChatsListParams: z.ZodObject<{
15233
15305
  app_key: z.ZodString;
@@ -15320,6 +15392,14 @@ declare const NAMED_SCHEMAS: {
15320
15392
  title: z.ZodNullable<z.ZodString>;
15321
15393
  }, z.core.$strict>>;
15322
15394
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
15395
+ title_sync: z.ZodOptional<z.ZodObject<{
15396
+ state: z.ZodEnum<{
15397
+ unsupported: "unsupported";
15398
+ synced: "synced";
15399
+ not_synced: "not_synced";
15400
+ }>;
15401
+ note: z.ZodString;
15402
+ }, z.core.$strict>>;
15323
15403
  }, z.core.$strict>>;
15324
15404
  new_window_ms: z.ZodInt;
15325
15405
  updating: z.ZodOptional<z.ZodBoolean>;
@@ -15422,6 +15502,14 @@ declare const NAMED_SCHEMAS: {
15422
15502
  title: z.ZodNullable<z.ZodString>;
15423
15503
  }, z.core.$strict>>;
15424
15504
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
15505
+ title_sync: z.ZodOptional<z.ZodObject<{
15506
+ state: z.ZodEnum<{
15507
+ unsupported: "unsupported";
15508
+ synced: "synced";
15509
+ not_synced: "not_synced";
15510
+ }>;
15511
+ note: z.ZodString;
15512
+ }, z.core.$strict>>;
15425
15513
  }, z.core.$strict>;
15426
15514
  }, z.core.$strict>;
15427
15515
  readonly AppsProjectsFileParams: z.ZodObject<{
@@ -15504,6 +15592,14 @@ declare const NAMED_SCHEMAS: {
15504
15592
  title: z.ZodNullable<z.ZodString>;
15505
15593
  }, z.core.$strict>>;
15506
15594
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
15595
+ title_sync: z.ZodOptional<z.ZodObject<{
15596
+ state: z.ZodEnum<{
15597
+ unsupported: "unsupported";
15598
+ synced: "synced";
15599
+ not_synced: "not_synced";
15600
+ }>;
15601
+ note: z.ZodString;
15602
+ }, z.core.$strict>>;
15507
15603
  }, z.core.$strict>;
15508
15604
  project: z.ZodObject<{
15509
15605
  id: z.ZodString;
@@ -15591,6 +15687,14 @@ declare const NAMED_SCHEMAS: {
15591
15687
  title: z.ZodNullable<z.ZodString>;
15592
15688
  }, z.core.$strict>>;
15593
15689
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
15690
+ title_sync: z.ZodOptional<z.ZodObject<{
15691
+ state: z.ZodEnum<{
15692
+ unsupported: "unsupported";
15693
+ synced: "synced";
15694
+ not_synced: "not_synced";
15695
+ }>;
15696
+ note: z.ZodString;
15697
+ }, z.core.$strict>>;
15594
15698
  }, z.core.$strict>;
15595
15699
  }, z.core.$strict>;
15596
15700
  readonly AppsChatsWatchStateEvent: z.ZodObject<{
@@ -15684,6 +15788,14 @@ declare const NAMED_SCHEMAS: {
15684
15788
  title: z.ZodNullable<z.ZodString>;
15685
15789
  }, z.core.$strict>>;
15686
15790
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
15791
+ title_sync: z.ZodOptional<z.ZodObject<{
15792
+ state: z.ZodEnum<{
15793
+ unsupported: "unsupported";
15794
+ synced: "synced";
15795
+ not_synced: "not_synced";
15796
+ }>;
15797
+ note: z.ZodString;
15798
+ }, z.core.$strict>>;
15687
15799
  }, z.core.$strict>;
15688
15800
  message: z.ZodString;
15689
15801
  }, z.core.$strict>;
@@ -15767,6 +15879,14 @@ declare const NAMED_SCHEMAS: {
15767
15879
  title: z.ZodNullable<z.ZodString>;
15768
15880
  }, z.core.$strict>>;
15769
15881
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
15882
+ title_sync: z.ZodOptional<z.ZodObject<{
15883
+ state: z.ZodEnum<{
15884
+ unsupported: "unsupported";
15885
+ synced: "synced";
15886
+ not_synced: "not_synced";
15887
+ }>;
15888
+ note: z.ZodString;
15889
+ }, z.core.$strict>>;
15770
15890
  }, z.core.$strict>>;
15771
15891
  project: z.ZodObject<{
15772
15892
  id: z.ZodString;
@@ -16227,6 +16347,14 @@ declare const NAMED_SCHEMAS: {
16227
16347
  title: z.ZodNullable<z.ZodString>;
16228
16348
  }, z.core.$strict>>;
16229
16349
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
16350
+ title_sync: z.ZodOptional<z.ZodObject<{
16351
+ state: z.ZodEnum<{
16352
+ unsupported: "unsupported";
16353
+ synced: "synced";
16354
+ not_synced: "not_synced";
16355
+ }>;
16356
+ note: z.ZodString;
16357
+ }, z.core.$strict>>;
16230
16358
  }, z.core.$strict>;
16231
16359
  project: z.ZodObject<{
16232
16360
  id: z.ZodString;
@@ -19887,7 +20015,7 @@ declare const DownloadKind: z.ZodEnum<{
19887
20015
  type DownloadKind = z.output<typeof DownloadKind>;
19888
20016
  declare const ModelsDownloadsListParams: z.ZodObject<{}, z.core.$strict>;
19889
20017
  type ModelsDownloadsListParams = z.output<typeof ModelsDownloadsListParams>;
19890
- /** Cancel one running download (every caller waiting on it gets CANCELLED); its half-done file stays for Resume. */
20018
+ /** Cancel one running download (every caller waiting on it gets CANCELED); its half-done file stays for Resume. */
19891
20019
  declare const ModelsDownloadsCancelParams: z.ZodObject<{
19892
20020
  key: z.ZodString;
19893
20021
  }, z.core.$strict>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/react.ts","../src/client/wake.ts","../src/error.ts"],"sourcesContent":["/**\n * `@ai-matrx/desktop-protocol/react` — hooks over the client: provider, connection state, typed\n * one-shot requests, events. The client owns every hard part (reconnect, reattach, credits); these\n * hooks only bind it to React's lifecycle.\n */\nimport { createContext, createElement, useCallback, useContext, useEffect, useRef, useState, useSyncExternalStore } from \"react\";\nimport type { Context, ReactNode } from \"react\";\nimport type { DesktopClient, DesktopClientState, EventHandler, EventName, RequestOptions } from \"./client/types\";\nimport { bindDesktopWake } from \"./client/wake\";\nimport { DesktopProtocolError } from \"./error\";\nimport type { OpName, OpParams, OpResult } from \"./schema/registry\";\n\n// The context lives on globalThis: an ESM and a CJS copy of this entry in one app (Next.js\n// does this) would otherwise create two contexts and a provider the hooks cannot see.\nconst CONTEXT_SLOT = Symbol.for(\"ai-matrx.desktop-protocol.client-context\");\nfunction clientContext(): Context<DesktopClient | null> {\n const slot = globalThis as { [CONTEXT_SLOT]?: Context<DesktopClient | null> };\n return (slot[CONTEXT_SLOT] ??= createContext<DesktopClient | null>(null));\n}\n\nexport function DesktopClientProvider(props: { client: DesktopClient; children?: ReactNode }): ReactNode {\n return createElement(clientContext().Provider, { value: props.client }, props.children);\n}\n\n/** The client from the nearest provider (or the one passed in). Throws when there is neither. */\nexport function useDesktopClient(client?: DesktopClient): DesktopClient {\n const fromContext = useContext(clientContext());\n const resolved = client ?? fromContext;\n if (!resolved) throw new Error(\"useDesktopClient: wrap the tree in <DesktopClientProvider client={…}> or pass a client\");\n return resolved;\n}\n\n/** Live connection state (status, welcome, attempts, retryInMs, lastError). Connects on mount when idle. */\nexport function useDesktopConnection(client?: DesktopClient): DesktopClientState {\n const c = useDesktopClient(client);\n const state = useSyncExternalStore(c.subscribe, c.getState, c.getState);\n useEffect(() => {\n if (c.getState().status === \"idle\") c.connect();\n }, [c]);\n return state;\n}\n\nexport interface DesktopRequestState<N extends OpName> {\n data: OpResult<N> | undefined;\n error: DesktopProtocolError | undefined;\n loading: boolean;\n /** Re-run now; resolves with the fresh result. */\n refetch: () => Promise<OpResult<N> | undefined>;\n}\n\nexport interface UseDesktopRequestOptions extends Omit<RequestOptions, \"signal\"> {\n /** Default true. False = do not run until refetch() or enabled flips true. */\n enabled?: boolean;\n /** Re-run every `refreshMs` while the page is visible, and at once when it becomes visible\n * again or its window comes to the front. A hidden window never polls. Default: no refresh. */\n refreshMs?: number;\n client?: DesktopClient;\n}\n\n/**\n * Run a unary op and keep its latest result. Re-runs when `op` or the params' JSON changes, and\n * after a reconnect if the last attempt failed with a retryable error. Aborts on unmount.\n */\n/** A window focused again within this long of the last catch-up is not read again. */\nconst FOCUS_CATCH_UP_MS = 5_000;\n\nexport function useDesktopRequest<N extends OpName>(op: N, params: OpParams<N>, options: UseDesktopRequestOptions = {}): DesktopRequestState<N> {\n const c = useDesktopClient(options.client);\n const enabled = options.enabled ?? true;\n const key = JSON.stringify(params);\n const [data, setData] = useState<OpResult<N> | undefined>(undefined);\n const [error, setError] = useState<DesktopProtocolError | undefined>(undefined);\n const [loading, setLoading] = useState<boolean>(enabled);\n const paramsRef = useRef(params);\n paramsRef.current = params;\n const runRef = useRef(0);\n const abortRef = useRef<AbortController | null>(null);\n const timeoutMs = options.timeoutMs;\n\n const run = useCallback(async (): Promise<OpResult<N> | undefined> => {\n const runId = ++runRef.current;\n abortRef.current?.abort();\n const abort = new AbortController();\n abortRef.current = abort;\n setLoading(true);\n try {\n const result = await c.request(op, paramsRef.current, timeoutMs === undefined ? { signal: abort.signal } : { signal: abort.signal, timeoutMs });\n if (runId === runRef.current) {\n setData(result);\n setError(undefined);\n }\n return result;\n } catch (caught) {\n const err = DesktopProtocolError.from(caught);\n if (runId === runRef.current && err.code !== \"CANCELLED\") setError(err);\n return undefined;\n } finally {\n if (runId === runRef.current) setLoading(false);\n }\n // `key` stands for the params' content: a new object with equal JSON is not a new request.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [c, op, key, timeoutMs]);\n\n useEffect(() => {\n if (!enabled) {\n setLoading(false);\n return;\n }\n void run();\n return () => {\n abortRef.current?.abort();\n };\n }, [enabled, run]);\n\n // Live data: poll while visible, catch up the moment the window is visible again.\n const refreshMs = options.refreshMs;\n useEffect(() => {\n if (!enabled || !refreshMs || typeof document === \"undefined\") return;\n let timer: ReturnType<typeof setInterval> | null = null;\n const start = () => {\n if (timer === null) timer = setInterval(() => void run(), refreshMs);\n };\n const stop = () => {\n if (timer !== null) clearInterval(timer);\n timer = null;\n };\n const onVisibility = () => {\n if (document.visibilityState === \"visible\") {\n void run();\n start();\n } else stop();\n };\n // The window coming to the front again (a desktop app switched back to): catch up at once,\n // at most once every few seconds (a quick switch away and back is not two reads).\n let lastFocus = 0;\n const onFocus = () => {\n if (Date.now() - lastFocus < FOCUS_CATCH_UP_MS) return;\n lastFocus = Date.now();\n void run();\n };\n if (document.visibilityState === \"visible\") start();\n document.addEventListener(\"visibilitychange\", onVisibility);\n window.addEventListener(\"focus\", onFocus);\n return () => {\n stop();\n document.removeEventListener(\"visibilitychange\", onVisibility);\n window.removeEventListener(\"focus\", onFocus);\n };\n }, [enabled, refreshMs, run]);\n\n // A retryable failure (device offline, connection lost) re-runs once the client is open again.\n const status = useSyncExternalStore(c.subscribe, () => c.getState().status, () => c.getState().status);\n useEffect(() => {\n if (enabled && status === \"open\" && error?.retryable) void run();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [status]);\n\n return { data, error, loading, refetch: run };\n}\n\nexport interface DesktopActionState {\n /** Run one or more ops as one action; resolves true when it finished without an error. */\n run: (work: (client: DesktopClient) => Promise<unknown>) => Promise<boolean>;\n /** An action is in flight (disable its controls). */\n busy: boolean;\n /** The last action's error, until the next action or `clearError()`. */\n error: DesktopProtocolError | undefined;\n clearError: () => void;\n}\n\n/**\n * Actions (create, save, remove, open): one busy flag and one error for a screen's writes, with the\n * same error type as reads. `onDone` runs after every successful action (refetch what it changed).\n */\nexport function useDesktopAction(options: { client?: DesktopClient; onDone?: () => unknown } = {}): DesktopActionState {\n const c = useDesktopClient(options.client);\n const [busy, setBusy] = useState(false);\n const [error, setError] = useState<DesktopProtocolError | undefined>(undefined);\n const onDoneRef = useRef(options.onDone);\n onDoneRef.current = options.onDone;\n const run = useCallback(\n async (work: (client: DesktopClient) => Promise<unknown>): Promise<boolean> => {\n setBusy(true);\n setError(undefined);\n try {\n await work(c);\n await onDoneRef.current?.();\n return true;\n } catch (caught) {\n const err = DesktopProtocolError.from(caught);\n // A cancelled action (the person pressed Stop) is not a failure to show.\n if (err.code !== \"CANCELLED\") setError(err);\n return false;\n } finally {\n setBusy(false);\n }\n },\n [c],\n );\n const clearError = useCallback(() => setError(undefined), []);\n return { run, busy, error, clearError };\n}\n\n/** Subscribe to one protocol event (fs.changed, exec.exited, relay.device_status, …) for the component's life. */\nexport function useDesktopEvent<E extends EventName>(name: E, handler: EventHandler<E>, options: { client?: DesktopClient } = {}): void {\n const c = useDesktopClient(options.client);\n const handlerRef = useRef(handler);\n handlerRef.current = handler;\n useEffect(() => c.on(name, ((payload, resourceId) => handlerRef.current(payload, resourceId)) as EventHandler<E>), [c, name]);\n}\n\n/**\n * Reconnect the moment the person is back: page visible again, a bfcache restore, the network\n * returning, window focus. Each calls `client.wake()` — dial now if reconnecting, probe if open.\n */\nexport function useDesktopWake(client?: DesktopClient, options: { probeMs?: number } = {}): void {\n const c = useDesktopClient(client);\n const probeMs = options.probeMs;\n useEffect(() => bindDesktopWake(c, probeMs === undefined ? {} : { probeMs }), [c, probeMs]);\n}\n","/**\n * Wire a client's wake() to the browser events that mean \"the person is back\": the page becomes\n * visible again (iOS Safari suspends a background tab's sockets), a back/forward-cache restore\n * (`pageshow` with persisted), and the network returning (`online`). Framework-free; the React\n * binding is `useDesktopWake` in `./react`.\n */\nimport type { DesktopClient, WakeOptions } from \"./types\";\n\n/** The subset of window/document the binding listens on — injectable for tests and non-DOM hosts. */\nexport interface WakeTargets {\n window: Pick<Window, \"addEventListener\" | \"removeEventListener\">;\n document: Pick<Document, \"addEventListener\" | \"removeEventListener\" | \"visibilityState\">;\n}\n\nexport function bindDesktopWake(client: Pick<DesktopClient, \"wake\">, options: WakeOptions & { targets?: WakeTargets } = {}): () => void {\n const targets: WakeTargets | null =\n options.targets ?? (typeof window !== \"undefined\" && typeof document !== \"undefined\" ? { window, document } : null);\n if (!targets) return () => undefined;\n const wakeOptions: WakeOptions = options.probeMs === undefined ? {} : { probeMs: options.probeMs };\n const onVisibility = () => {\n if (targets.document.visibilityState === \"visible\") client.wake(wakeOptions);\n };\n const onWake = () => client.wake(wakeOptions);\n targets.document.addEventListener(\"visibilitychange\", onVisibility);\n targets.window.addEventListener(\"pageshow\", onWake);\n targets.window.addEventListener(\"online\", onWake);\n targets.window.addEventListener(\"focus\", onWake);\n return () => {\n targets.document.removeEventListener(\"visibilitychange\", onVisibility);\n targets.window.removeEventListener(\"pageshow\", onWake);\n targets.window.removeEventListener(\"online\", onWake);\n targets.window.removeEventListener(\"focus\", onWake);\n };\n}\n","/**\n * The one error type every package entry throws. It carries the wire ErrorCode (SPEC §5), so a\n * caller branches on `code`/`retryable`/`data.reason` and never parses a message. Zod-free on\n * purpose: `./frame` (the relay hot path) throws it without pulling the schema graph.\n */\nimport type { ErrorCodeName, ErrorData } from \"./types\";\n\nexport class DesktopProtocolError extends Error {\n readonly code: ErrorCodeName;\n readonly retryable: boolean;\n readonly data: ErrorData | undefined;\n\n constructor(code: ErrorCodeName, message: string, options: { retryable?: boolean; data?: ErrorData; cause?: unknown } = {}) {\n super(message, options.cause === undefined ? undefined : { cause: options.cause });\n this.name = \"DesktopProtocolError\";\n this.code = code;\n this.retryable = options.retryable ?? false;\n this.data = options.data;\n }\n\n /**\n * Any thrown value as a DesktopProtocolError, keeping its code, message and data. Each built entry\n * (`.`, `./client`, `./react`) carries its own copy of this class, so `instanceof` alone misses an\n * error thrown by a sibling entry and reports a real NOT_FOUND as INTERNAL; this checks the shape.\n */\n static from(caught: unknown): DesktopProtocolError {\n if (caught instanceof DesktopProtocolError) return caught;\n const e = caught as { name?: unknown; code?: unknown; message?: unknown; retryable?: unknown; data?: unknown } | null;\n if (e && typeof e === \"object\" && e.name === \"DesktopProtocolError\" && typeof e.code === \"string\") {\n return new DesktopProtocolError(e.code as ErrorCodeName, typeof e.message === \"string\" ? e.message : String(e.code), {\n retryable: e.retryable === true,\n ...(e.data && typeof e.data === \"object\" ? { data: e.data as ErrorData } : {}),\n cause: caught,\n });\n }\n return new DesktopProtocolError(\"INTERNAL\", caught instanceof Error ? caught.message : String(caught), { cause: caught });\n }\n\n /** The wire body (ProtocolErrorBody) — what a core or relay sends for this error. */\n toBody(): { code: ErrorCodeName; message: string; retryable: boolean; data?: ErrorData } {\n return this.data === undefined\n ? { code: this.code, message: this.message, retryable: this.retryable }\n : { code: this.code, message: this.message, retryable: this.retryable, data: this.data };\n }\n}\n\nexport function isDesktopProtocolError(value: unknown): value is DesktopProtocolError {\n return value instanceof DesktopProtocolError || (value instanceof Error && value.name === \"DesktopProtocolError\" && \"code\" in value);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,mBAAyH;;;ACSlH,SAAS,gBAAgB,QAAqC,UAAmD,CAAC,GAAe;AACtI,QAA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":["/**\n * `@ai-matrx/desktop-protocol/react` — hooks over the client: provider, connection state, typed\n * one-shot requests, events. The client owns every hard part (reconnect, reattach, credits); these\n * hooks only bind it to React's lifecycle.\n */\nimport { createContext, createElement, useCallback, useContext, useEffect, useRef, useState, useSyncExternalStore } from \"react\";\nimport type { Context, ReactNode } from \"react\";\nimport type { DesktopClient, DesktopClientState, EventHandler, EventName, RequestOptions } from \"./client/types\";\nimport { bindDesktopWake } from \"./client/wake\";\nimport { DesktopProtocolError } from \"./error\";\nimport type { OpName, OpParams, OpResult } from \"./schema/registry\";\n\n// The context lives on globalThis: an ESM and a CJS copy of this entry in one app (Next.js\n// does this) would otherwise create two contexts and a provider the hooks cannot see.\nconst CONTEXT_SLOT = Symbol.for(\"ai-matrx.desktop-protocol.client-context\");\nfunction clientContext(): Context<DesktopClient | null> {\n const slot = globalThis as { [CONTEXT_SLOT]?: Context<DesktopClient | null> };\n return (slot[CONTEXT_SLOT] ??= createContext<DesktopClient | null>(null));\n}\n\nexport function DesktopClientProvider(props: { client: DesktopClient; children?: ReactNode }): ReactNode {\n return createElement(clientContext().Provider, { value: props.client }, props.children);\n}\n\n/** The client from the nearest provider (or the one passed in). Throws when there is neither. */\nexport function useDesktopClient(client?: DesktopClient): DesktopClient {\n const fromContext = useContext(clientContext());\n const resolved = client ?? fromContext;\n if (!resolved) throw new Error(\"useDesktopClient: wrap the tree in <DesktopClientProvider client={…}> or pass a client\");\n return resolved;\n}\n\n/** Live connection state (status, welcome, attempts, retryInMs, lastError). Connects on mount when idle. */\nexport function useDesktopConnection(client?: DesktopClient): DesktopClientState {\n const c = useDesktopClient(client);\n const state = useSyncExternalStore(c.subscribe, c.getState, c.getState);\n useEffect(() => {\n if (c.getState().status === \"idle\") c.connect();\n }, [c]);\n return state;\n}\n\nexport interface DesktopRequestState<N extends OpName> {\n data: OpResult<N> | undefined;\n error: DesktopProtocolError | undefined;\n loading: boolean;\n /** Re-run now; resolves with the fresh result. */\n refetch: () => Promise<OpResult<N> | undefined>;\n}\n\nexport interface UseDesktopRequestOptions extends Omit<RequestOptions, \"signal\"> {\n /** Default true. False = do not run until refetch() or enabled flips true. */\n enabled?: boolean;\n /** Re-run every `refreshMs` while the page is visible, and at once when it becomes visible\n * again or its window comes to the front. A hidden window never polls. Default: no refresh. */\n refreshMs?: number;\n client?: DesktopClient;\n}\n\n/**\n * Run a unary op and keep its latest result. Re-runs when `op` or the params' JSON changes, and\n * after a reconnect if the last attempt failed with a retryable error. Aborts on unmount.\n */\n/** A window focused again within this long of the last catch-up is not read again. */\nconst FOCUS_CATCH_UP_MS = 5_000;\n\nexport function useDesktopRequest<N extends OpName>(op: N, params: OpParams<N>, options: UseDesktopRequestOptions = {}): DesktopRequestState<N> {\n const c = useDesktopClient(options.client);\n const enabled = options.enabled ?? true;\n const key = JSON.stringify(params);\n const [data, setData] = useState<OpResult<N> | undefined>(undefined);\n const [error, setError] = useState<DesktopProtocolError | undefined>(undefined);\n const [loading, setLoading] = useState<boolean>(enabled);\n const paramsRef = useRef(params);\n paramsRef.current = params;\n const runRef = useRef(0);\n const abortRef = useRef<AbortController | null>(null);\n const timeoutMs = options.timeoutMs;\n\n const run = useCallback(async (): Promise<OpResult<N> | undefined> => {\n const runId = ++runRef.current;\n abortRef.current?.abort();\n const abort = new AbortController();\n abortRef.current = abort;\n setLoading(true);\n try {\n const result = await c.request(op, paramsRef.current, timeoutMs === undefined ? { signal: abort.signal } : { signal: abort.signal, timeoutMs });\n if (runId === runRef.current) {\n setData(result);\n setError(undefined);\n }\n return result;\n } catch (caught) {\n const err = DesktopProtocolError.from(caught);\n if (runId === runRef.current && err.code !== \"CANCELLED\") setError(err);\n return undefined;\n } finally {\n if (runId === runRef.current) setLoading(false);\n }\n // `key` stands for the params' content: a new object with equal JSON is not a new request.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [c, op, key, timeoutMs]);\n\n useEffect(() => {\n if (!enabled) {\n setLoading(false);\n return;\n }\n void run();\n return () => {\n abortRef.current?.abort();\n };\n }, [enabled, run]);\n\n // Live data: poll while visible, catch up the moment the window is visible again.\n const refreshMs = options.refreshMs;\n useEffect(() => {\n if (!enabled || !refreshMs || typeof document === \"undefined\") return;\n let timer: ReturnType<typeof setInterval> | null = null;\n const start = () => {\n if (timer === null) timer = setInterval(() => void run(), refreshMs);\n };\n const stop = () => {\n if (timer !== null) clearInterval(timer);\n timer = null;\n };\n const onVisibility = () => {\n if (document.visibilityState === \"visible\") {\n void run();\n start();\n } else stop();\n };\n // The window coming to the front again (a desktop app switched back to): catch up at once,\n // at most once every few seconds (a quick switch away and back is not two reads).\n let lastFocus = 0;\n const onFocus = () => {\n if (Date.now() - lastFocus < FOCUS_CATCH_UP_MS) return;\n lastFocus = Date.now();\n void run();\n };\n if (document.visibilityState === \"visible\") start();\n document.addEventListener(\"visibilitychange\", onVisibility);\n window.addEventListener(\"focus\", onFocus);\n return () => {\n stop();\n document.removeEventListener(\"visibilitychange\", onVisibility);\n window.removeEventListener(\"focus\", onFocus);\n };\n }, [enabled, refreshMs, run]);\n\n // A retryable failure (device offline, connection lost) re-runs once the client is open again.\n const status = useSyncExternalStore(c.subscribe, () => c.getState().status, () => c.getState().status);\n useEffect(() => {\n if (enabled && status === \"open\" && error?.retryable) void run();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [status]);\n\n return { data, error, loading, refetch: run };\n}\n\nexport interface DesktopActionState {\n /** Run one or more ops as one action; resolves true when it finished without an error. */\n run: (work: (client: DesktopClient) => Promise<unknown>) => Promise<boolean>;\n /** An action is in flight (disable its controls). */\n busy: boolean;\n /** The last action's error, until the next action or `clearError()`. */\n error: DesktopProtocolError | undefined;\n clearError: () => void;\n}\n\n/**\n * Actions (create, save, remove, open): one busy flag and one error for a screen's writes, with the\n * same error type as reads. `onDone` runs after every successful action (refetch what it changed).\n */\nexport function useDesktopAction(options: { client?: DesktopClient; onDone?: () => unknown } = {}): DesktopActionState {\n const c = useDesktopClient(options.client);\n const [busy, setBusy] = useState(false);\n const [error, setError] = useState<DesktopProtocolError | undefined>(undefined);\n const onDoneRef = useRef(options.onDone);\n onDoneRef.current = options.onDone;\n const run = useCallback(\n async (work: (client: DesktopClient) => Promise<unknown>): Promise<boolean> => {\n setBusy(true);\n setError(undefined);\n try {\n await work(c);\n await onDoneRef.current?.();\n return true;\n } catch (caught) {\n const err = DesktopProtocolError.from(caught);\n // A canceled action (the person pressed Stop) is not a failure to show.\n if (err.code !== \"CANCELLED\") setError(err);\n return false;\n } finally {\n setBusy(false);\n }\n },\n [c],\n );\n const clearError = useCallback(() => setError(undefined), []);\n return { run, busy, error, clearError };\n}\n\n/** Subscribe to one protocol event (fs.changed, exec.exited, relay.device_status, …) for the component's life. */\nexport function useDesktopEvent<E extends EventName>(name: E, handler: EventHandler<E>, options: { client?: DesktopClient } = {}): void {\n const c = useDesktopClient(options.client);\n const handlerRef = useRef(handler);\n handlerRef.current = handler;\n useEffect(() => c.on(name, ((payload, resourceId) => handlerRef.current(payload, resourceId)) as EventHandler<E>), [c, name]);\n}\n\n/**\n * Reconnect the moment the person is back: page visible again, a bfcache restore, the network\n * returning, window focus. Each calls `client.wake()` — dial now if reconnecting, probe if open.\n */\nexport function useDesktopWake(client?: DesktopClient, options: { probeMs?: number } = {}): void {\n const c = useDesktopClient(client);\n const probeMs = options.probeMs;\n useEffect(() => bindDesktopWake(c, probeMs === undefined ? {} : { probeMs }), [c, probeMs]);\n}\n","/**\n * Wire a client's wake() to the browser events that mean \"the person is back\": the page becomes\n * visible again (iOS Safari suspends a background tab's sockets), a back/forward-cache restore\n * (`pageshow` with persisted), and the network returning (`online`). Framework-free; the React\n * binding is `useDesktopWake` in `./react`.\n */\nimport type { DesktopClient, WakeOptions } from \"./types\";\n\n/** The subset of window/document the binding listens on — injectable for tests and non-DOM hosts. */\nexport interface WakeTargets {\n window: Pick<Window, \"addEventListener\" | \"removeEventListener\">;\n document: Pick<Document, \"addEventListener\" | \"removeEventListener\" | \"visibilityState\">;\n}\n\nexport function bindDesktopWake(client: Pick<DesktopClient, \"wake\">, options: WakeOptions & { targets?: WakeTargets } = {}): () => void {\n const targets: WakeTargets | null =\n options.targets ?? (typeof window !== \"undefined\" && typeof document !== \"undefined\" ? { window, document } : null);\n if (!targets) return () => undefined;\n const wakeOptions: WakeOptions = options.probeMs === undefined ? {} : { probeMs: options.probeMs };\n const onVisibility = () => {\n if (targets.document.visibilityState === \"visible\") client.wake(wakeOptions);\n };\n const onWake = () => client.wake(wakeOptions);\n targets.document.addEventListener(\"visibilitychange\", onVisibility);\n targets.window.addEventListener(\"pageshow\", onWake);\n targets.window.addEventListener(\"online\", onWake);\n targets.window.addEventListener(\"focus\", onWake);\n return () => {\n targets.document.removeEventListener(\"visibilitychange\", onVisibility);\n targets.window.removeEventListener(\"pageshow\", onWake);\n targets.window.removeEventListener(\"online\", onWake);\n targets.window.removeEventListener(\"focus\", onWake);\n };\n}\n","/**\n * The one error type every package entry throws. It carries the wire ErrorCode (SPEC §5), so a\n * caller branches on `code`/`retryable`/`data.reason` and never parses a message. Zod-free on\n * purpose: `./frame` (the relay hot path) throws it without pulling the schema graph.\n */\nimport type { ErrorCodeName, ErrorData } from \"./types\";\n\nexport class DesktopProtocolError extends Error {\n readonly code: ErrorCodeName;\n readonly retryable: boolean;\n readonly data: ErrorData | undefined;\n\n constructor(code: ErrorCodeName, message: string, options: { retryable?: boolean; data?: ErrorData; cause?: unknown } = {}) {\n super(message, options.cause === undefined ? undefined : { cause: options.cause });\n this.name = \"DesktopProtocolError\";\n this.code = code;\n this.retryable = options.retryable ?? false;\n this.data = options.data;\n }\n\n /**\n * Any thrown value as a DesktopProtocolError, keeping its code, message and data. Each built entry\n * (`.`, `./client`, `./react`) carries its own copy of this class, so `instanceof` alone misses an\n * error thrown by a sibling entry and reports a real NOT_FOUND as INTERNAL; this checks the shape.\n */\n static from(caught: unknown): DesktopProtocolError {\n if (caught instanceof DesktopProtocolError) return caught;\n const e = caught as { name?: unknown; code?: unknown; message?: unknown; retryable?: unknown; data?: unknown } | null;\n if (e && typeof e === \"object\" && e.name === \"DesktopProtocolError\" && typeof e.code === \"string\") {\n return new DesktopProtocolError(e.code as ErrorCodeName, typeof e.message === \"string\" ? e.message : String(e.code), {\n retryable: e.retryable === true,\n ...(e.data && typeof e.data === \"object\" ? { data: e.data as ErrorData } : {}),\n cause: caught,\n });\n }\n return new DesktopProtocolError(\"INTERNAL\", caught instanceof Error ? caught.message : String(caught), { cause: caught });\n }\n\n /** The wire body (ProtocolErrorBody) — what a core or relay sends for this error. */\n toBody(): { code: ErrorCodeName; message: string; retryable: boolean; data?: ErrorData } {\n return this.data === undefined\n ? { code: this.code, message: this.message, retryable: this.retryable }\n : { code: this.code, message: this.message, retryable: this.retryable, data: this.data };\n }\n}\n\nexport function isDesktopProtocolError(value: unknown): value is DesktopProtocolError {\n return value instanceof DesktopProtocolError || (value instanceof Error && value.name === \"DesktopProtocolError\" && \"code\" in value);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,mBAAyH;;;ACSlH,SAAS,gBAAgB,QAAqC,UAAmD,CAAC,GAAe;AACtI,QAAM,UACJ,QAAQ,YAAY,OAAO,WAAW,eAAe,OAAO,aAAa,cAAc,EAAE,QAAQ,SAAS,IAAI;AAChH,MAAI,CAAC,QAAS,QAAO,MAAM;AAC3B,QAAM,cAA2B,QAAQ,YAAY,SAAY,CAAC,IAAI,EAAE,SAAS,QAAQ,QAAQ;AACjG,QAAM,eAAe,MAAM;AACzB,QAAI,QAAQ,SAAS,oBAAoB,UAAW,QAAO,KAAK,WAAW;AAAA,EAC7E;AACA,QAAM,SAAS,MAAM,OAAO,KAAK,WAAW;AAC5C,UAAQ,SAAS,iBAAiB,oBAAoB,YAAY;AAClE,UAAQ,OAAO,iBAAiB,YAAY,MAAM;AAClD,UAAQ,OAAO,iBAAiB,UAAU,MAAM;AAChD,UAAQ,OAAO,iBAAiB,SAAS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E;AACA,gBAAQ,KAAK;AAAA,MACf;AAAA,IACF;AAAA,IACA,CAAC,CAAC;AAAA,EACJ;AACA,QAAM,iBAAa,0BAAY,MAAM,SAAS,MAAS,GAAG,CAAC,CAAC;AAC5D,SAAO,EAAE,KAAK,MAAM,OAAO,WAAW;AACxC;AAGO,SAAS,gBAAqC,MAAS,SAA0B,UAAsC,CAAC,GAAS;AACtI,QAAM,IAAI,iBAAiB,QAAQ,MAAM;AACzC,QAAM,iBAAa,qBAAO,OAAO;AACjC,aAAW,UAAU;AACrB,8BAAU,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,eAAe,WAAW,QAAQ,SAAS,UAAU,EAAqB,GAAG,CAAC,GAAG,IAAI,CAAC;AAC9H;AAMO,SAAS,eAAe,QAAwB,UAAgC,CAAC,GAAS;AAC/F,QAAM,IAAI,iBAAiB,MAAM;AACjC,QAAM,UAAU,QAAQ;AACxB,8BAAU,MAAM,gBAAgB,GAAG,YAAY,SAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;AAC5F;","names":[]}
package/dist/react.d.cts CHANGED
@@ -1340,6 +1340,14 @@ declare const OPS: {
1340
1340
  title: z.ZodNullable<z.ZodString>;
1341
1341
  }, z.core.$strict>>;
1342
1342
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1343
+ title_sync: z.ZodOptional<z.ZodObject<{
1344
+ state: z.ZodEnum<{
1345
+ unsupported: "unsupported";
1346
+ synced: "synced";
1347
+ not_synced: "not_synced";
1348
+ }>;
1349
+ note: z.ZodString;
1350
+ }, z.core.$strict>>;
1343
1351
  }, z.core.$strict>>;
1344
1352
  new_window_ms: z.ZodInt;
1345
1353
  updating: z.ZodOptional<z.ZodBoolean>;
@@ -1446,6 +1454,14 @@ declare const OPS: {
1446
1454
  title: z.ZodNullable<z.ZodString>;
1447
1455
  }, z.core.$strict>>;
1448
1456
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1457
+ title_sync: z.ZodOptional<z.ZodObject<{
1458
+ state: z.ZodEnum<{
1459
+ unsupported: "unsupported";
1460
+ synced: "synced";
1461
+ not_synced: "not_synced";
1462
+ }>;
1463
+ note: z.ZodString;
1464
+ }, z.core.$strict>>;
1449
1465
  }, z.core.$strict>;
1450
1466
  }, z.core.$strict>;
1451
1467
  readonly kind: "unary";
@@ -1533,6 +1549,14 @@ declare const OPS: {
1533
1549
  title: z.ZodNullable<z.ZodString>;
1534
1550
  }, z.core.$strict>>;
1535
1551
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1552
+ title_sync: z.ZodOptional<z.ZodObject<{
1553
+ state: z.ZodEnum<{
1554
+ unsupported: "unsupported";
1555
+ synced: "synced";
1556
+ not_synced: "not_synced";
1557
+ }>;
1558
+ note: z.ZodString;
1559
+ }, z.core.$strict>>;
1536
1560
  }, z.core.$strict>;
1537
1561
  project: z.ZodObject<{
1538
1562
  id: z.ZodString;
@@ -1631,6 +1655,14 @@ declare const OPS: {
1631
1655
  title: z.ZodNullable<z.ZodString>;
1632
1656
  }, z.core.$strict>>;
1633
1657
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1658
+ title_sync: z.ZodOptional<z.ZodObject<{
1659
+ state: z.ZodEnum<{
1660
+ unsupported: "unsupported";
1661
+ synced: "synced";
1662
+ not_synced: "not_synced";
1663
+ }>;
1664
+ note: z.ZodString;
1665
+ }, z.core.$strict>>;
1634
1666
  }, z.core.$strict>;
1635
1667
  message: z.ZodString;
1636
1668
  }, z.core.$strict>;
@@ -1719,6 +1751,14 @@ declare const OPS: {
1719
1751
  title: z.ZodNullable<z.ZodString>;
1720
1752
  }, z.core.$strict>>;
1721
1753
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1754
+ title_sync: z.ZodOptional<z.ZodObject<{
1755
+ state: z.ZodEnum<{
1756
+ unsupported: "unsupported";
1757
+ synced: "synced";
1758
+ not_synced: "not_synced";
1759
+ }>;
1760
+ note: z.ZodString;
1761
+ }, z.core.$strict>>;
1722
1762
  }, z.core.$strict>>;
1723
1763
  project: z.ZodObject<{
1724
1764
  id: z.ZodString;
@@ -1848,6 +1888,14 @@ declare const OPS: {
1848
1888
  title: z.ZodNullable<z.ZodString>;
1849
1889
  }, z.core.$strict>>;
1850
1890
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1891
+ title_sync: z.ZodOptional<z.ZodObject<{
1892
+ state: z.ZodEnum<{
1893
+ unsupported: "unsupported";
1894
+ synced: "synced";
1895
+ not_synced: "not_synced";
1896
+ }>;
1897
+ note: z.ZodString;
1898
+ }, z.core.$strict>>;
1851
1899
  }, z.core.$strict>;
1852
1900
  }, z.core.$strict>;
1853
1901
  readonly kind: "unary";
@@ -2242,6 +2290,14 @@ declare const OPS: {
2242
2290
  title: z.ZodNullable<z.ZodString>;
2243
2291
  }, z.core.$strict>>;
2244
2292
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
2293
+ title_sync: z.ZodOptional<z.ZodObject<{
2294
+ state: z.ZodEnum<{
2295
+ unsupported: "unsupported";
2296
+ synced: "synced";
2297
+ not_synced: "not_synced";
2298
+ }>;
2299
+ note: z.ZodString;
2300
+ }, z.core.$strict>>;
2245
2301
  }, z.core.$strict>;
2246
2302
  project: z.ZodObject<{
2247
2303
  id: z.ZodString;
@@ -8018,7 +8074,7 @@ interface DesktopStream<N extends StreamOpName> {
8018
8074
  }
8019
8075
  interface DesktopClient {
8020
8076
  connect(): void;
8021
- /** Close for good (no reconnect). Pending work rejects with CANCELLED. */
8077
+ /** Close for good (no reconnect). Pending work rejects with CANCELED. */
8022
8078
  close(): void;
8023
8079
  getState(): DesktopClientState;
8024
8080
  /** useSyncExternalStore-shaped. */
package/dist/react.d.ts CHANGED
@@ -1340,6 +1340,14 @@ declare const OPS: {
1340
1340
  title: z.ZodNullable<z.ZodString>;
1341
1341
  }, z.core.$strict>>;
1342
1342
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1343
+ title_sync: z.ZodOptional<z.ZodObject<{
1344
+ state: z.ZodEnum<{
1345
+ unsupported: "unsupported";
1346
+ synced: "synced";
1347
+ not_synced: "not_synced";
1348
+ }>;
1349
+ note: z.ZodString;
1350
+ }, z.core.$strict>>;
1343
1351
  }, z.core.$strict>>;
1344
1352
  new_window_ms: z.ZodInt;
1345
1353
  updating: z.ZodOptional<z.ZodBoolean>;
@@ -1446,6 +1454,14 @@ declare const OPS: {
1446
1454
  title: z.ZodNullable<z.ZodString>;
1447
1455
  }, z.core.$strict>>;
1448
1456
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1457
+ title_sync: z.ZodOptional<z.ZodObject<{
1458
+ state: z.ZodEnum<{
1459
+ unsupported: "unsupported";
1460
+ synced: "synced";
1461
+ not_synced: "not_synced";
1462
+ }>;
1463
+ note: z.ZodString;
1464
+ }, z.core.$strict>>;
1449
1465
  }, z.core.$strict>;
1450
1466
  }, z.core.$strict>;
1451
1467
  readonly kind: "unary";
@@ -1533,6 +1549,14 @@ declare const OPS: {
1533
1549
  title: z.ZodNullable<z.ZodString>;
1534
1550
  }, z.core.$strict>>;
1535
1551
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1552
+ title_sync: z.ZodOptional<z.ZodObject<{
1553
+ state: z.ZodEnum<{
1554
+ unsupported: "unsupported";
1555
+ synced: "synced";
1556
+ not_synced: "not_synced";
1557
+ }>;
1558
+ note: z.ZodString;
1559
+ }, z.core.$strict>>;
1536
1560
  }, z.core.$strict>;
1537
1561
  project: z.ZodObject<{
1538
1562
  id: z.ZodString;
@@ -1631,6 +1655,14 @@ declare const OPS: {
1631
1655
  title: z.ZodNullable<z.ZodString>;
1632
1656
  }, z.core.$strict>>;
1633
1657
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1658
+ title_sync: z.ZodOptional<z.ZodObject<{
1659
+ state: z.ZodEnum<{
1660
+ unsupported: "unsupported";
1661
+ synced: "synced";
1662
+ not_synced: "not_synced";
1663
+ }>;
1664
+ note: z.ZodString;
1665
+ }, z.core.$strict>>;
1634
1666
  }, z.core.$strict>;
1635
1667
  message: z.ZodString;
1636
1668
  }, z.core.$strict>;
@@ -1719,6 +1751,14 @@ declare const OPS: {
1719
1751
  title: z.ZodNullable<z.ZodString>;
1720
1752
  }, z.core.$strict>>;
1721
1753
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1754
+ title_sync: z.ZodOptional<z.ZodObject<{
1755
+ state: z.ZodEnum<{
1756
+ unsupported: "unsupported";
1757
+ synced: "synced";
1758
+ not_synced: "not_synced";
1759
+ }>;
1760
+ note: z.ZodString;
1761
+ }, z.core.$strict>>;
1722
1762
  }, z.core.$strict>>;
1723
1763
  project: z.ZodObject<{
1724
1764
  id: z.ZodString;
@@ -1848,6 +1888,14 @@ declare const OPS: {
1848
1888
  title: z.ZodNullable<z.ZodString>;
1849
1889
  }, z.core.$strict>>;
1850
1890
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
1891
+ title_sync: z.ZodOptional<z.ZodObject<{
1892
+ state: z.ZodEnum<{
1893
+ unsupported: "unsupported";
1894
+ synced: "synced";
1895
+ not_synced: "not_synced";
1896
+ }>;
1897
+ note: z.ZodString;
1898
+ }, z.core.$strict>>;
1851
1899
  }, z.core.$strict>;
1852
1900
  }, z.core.$strict>;
1853
1901
  readonly kind: "unary";
@@ -2242,6 +2290,14 @@ declare const OPS: {
2242
2290
  title: z.ZodNullable<z.ZodString>;
2243
2291
  }, z.core.$strict>>;
2244
2292
  prior_sessions: z.ZodOptional<z.ZodArray<z.ZodString>>;
2293
+ title_sync: z.ZodOptional<z.ZodObject<{
2294
+ state: z.ZodEnum<{
2295
+ unsupported: "unsupported";
2296
+ synced: "synced";
2297
+ not_synced: "not_synced";
2298
+ }>;
2299
+ note: z.ZodString;
2300
+ }, z.core.$strict>>;
2245
2301
  }, z.core.$strict>;
2246
2302
  project: z.ZodObject<{
2247
2303
  id: z.ZodString;
@@ -8018,7 +8074,7 @@ interface DesktopStream<N extends StreamOpName> {
8018
8074
  }
8019
8075
  interface DesktopClient {
8020
8076
  connect(): void;
8021
- /** Close for good (no reconnect). Pending work rejects with CANCELLED. */
8077
+ /** Close for good (no reconnect). Pending work rejects with CANCELED. */
8022
8078
  close(): void;
8023
8079
  getState(): DesktopClientState;
8024
8080
  /** useSyncExternalStore-shaped. */