yaver-feedback-react-native 0.7.3 → 0.7.4

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,50 @@
1
+ /**
2
+ * Canonical client-side constants shared between:
3
+ * - Yaver mobile (`mobile/`)
4
+ * - yaver-feedback-react-native (`sdk/feedback/react-native/`)
5
+ * - yaver-feedback-web (`sdk/feedback/web/`)
6
+ * - web dashboard (`web/`)
7
+ *
8
+ * This is THE source of truth. If you need to change one of these
9
+ * values, change it here and re-run `scripts/sync-client-core.sh` so
10
+ * every consumer picks it up. Each consumer ships its own compiled
11
+ * copy so the shared/client-core directory never needs to be published
12
+ * to npm — but the copies MUST remain byte-identical.
13
+ *
14
+ * DO NOT edit the copies under `mobile/src/_core/` or
15
+ * `sdk/feedback/react-native/src/_core/` directly. They will be
16
+ * overwritten by the sync script, and a CI check fails the build if
17
+ * they drift.
18
+ *
19
+ * See ARCHITECTURE_CLIENT_CORE.md for the full plan.
20
+ */
21
+ export declare const CONVEX_SITE_URL = "https://perceptive-minnow-557.eu-west-1.convex.site";
22
+ export declare const WEB_BASE_URL = "https://yaver.io";
23
+ /** Default HTTP port `yaver serve` listens on. */
24
+ export declare const DEFAULT_AGENT_HTTP_PORT = 18080;
25
+ /** UDP port the LAN beacon is broadcast on. */
26
+ export declare const DEFAULT_BEACON_UDP_PORT = 19837;
27
+ /**
28
+ * How old an agent's last heartbeat can be before the device is
29
+ * considered offline. Mirrors `backend/convex/devices.ts` so
30
+ * Convex + every client agree on the same threshold.
31
+ */
32
+ export declare const HEARTBEAT_STALE_MS = 90000;
33
+ /**
34
+ * How long after the last UDP beacon an agent is still considered
35
+ * "locally present". Re-broadcast interval is 3 s, so 10 s covers
36
+ * three missed beats without false offline.
37
+ */
38
+ export declare const BEACON_STALE_MS = 10000;
39
+ /** Timeout for a direct /health probe over LAN. */
40
+ export declare const PROBE_TIMEOUT_MS = 2500;
41
+ /** Timeout for /health probe routed through a relay server. */
42
+ export declare const RELAY_PROBE_TIMEOUT_MS = 6000;
43
+ /**
44
+ * OAuth callback URL used by mobile + SDK deep-link flows. The yaver.io
45
+ * web OAuth endpoints redirect here once the provider returns. Android
46
+ * consumers must register the matching `<intent-filter>` in their
47
+ * manifest; iOS consumers inside an `ASWebAuthenticationSession` don't
48
+ * need to.
49
+ */
50
+ export declare const OAUTH_REDIRECT = "yaver://oauth-callback";
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ // AUTO-SYNCED from shared/client-core/src/constants.ts.
3
+ // DO NOT EDIT IN PLACE. Edit the source and re-run
4
+ // scripts/sync-client-core.sh. CI checks drift via `--check`.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.OAUTH_REDIRECT = exports.RELAY_PROBE_TIMEOUT_MS = exports.PROBE_TIMEOUT_MS = exports.BEACON_STALE_MS = exports.HEARTBEAT_STALE_MS = exports.DEFAULT_BEACON_UDP_PORT = exports.DEFAULT_AGENT_HTTP_PORT = exports.WEB_BASE_URL = exports.CONVEX_SITE_URL = void 0;
7
+ /**
8
+ * Canonical client-side constants shared between:
9
+ * - Yaver mobile (`mobile/`)
10
+ * - yaver-feedback-react-native (`sdk/feedback/react-native/`)
11
+ * - yaver-feedback-web (`sdk/feedback/web/`)
12
+ * - web dashboard (`web/`)
13
+ *
14
+ * This is THE source of truth. If you need to change one of these
15
+ * values, change it here and re-run `scripts/sync-client-core.sh` so
16
+ * every consumer picks it up. Each consumer ships its own compiled
17
+ * copy so the shared/client-core directory never needs to be published
18
+ * to npm — but the copies MUST remain byte-identical.
19
+ *
20
+ * DO NOT edit the copies under `mobile/src/_core/` or
21
+ * `sdk/feedback/react-native/src/_core/` directly. They will be
22
+ * overwritten by the sync script, and a CI check fails the build if
23
+ * they drift.
24
+ *
25
+ * See ARCHITECTURE_CLIENT_CORE.md for the full plan.
26
+ */
27
+ // ── Yaver.io production Convex deployment ────────────────────────────
28
+ //
29
+ // This is the Convex site every yaver.io client signs in against and
30
+ // every Go agent validates tokens against. If yaver.io migrates the
31
+ // deployment (as it did from shocking-echidna-394 → perceptive-minnow-
32
+ // 557 in early 2026), bump this constant and every client — mobile,
33
+ // both Feedback SDKs, web dashboard — picks it up on the next rebuild.
34
+ // No more "invalid token" 403s from clients sitting on a stale URL.
35
+ exports.CONVEX_SITE_URL = 'https://perceptive-minnow-557.eu-west-1.convex.site';
36
+ // Public web origin. Used for OAuth redirect URL building, the account
37
+ // merge approval page, and SDK deep-links. Separate from CONVEX_SITE_URL
38
+ // because the web app and Convex live on different origins.
39
+ exports.WEB_BASE_URL = 'https://yaver.io';
40
+ // ── Transport ─────────────────────────────────────────────────────────
41
+ /** Default HTTP port `yaver serve` listens on. */
42
+ exports.DEFAULT_AGENT_HTTP_PORT = 18080;
43
+ /** UDP port the LAN beacon is broadcast on. */
44
+ exports.DEFAULT_BEACON_UDP_PORT = 19837;
45
+ // ── Freshness windows ─────────────────────────────────────────────────
46
+ //
47
+ // All three of these must match the corresponding constants on the
48
+ // backend (`backend/convex/devices.ts::HEARTBEAT_STALE_MS`) and the
49
+ // desktop agent. Drift between clients and backend produces "green on
50
+ // one, yellow on the other" UX glitches from clock-skew alone.
51
+ /**
52
+ * How old an agent's last heartbeat can be before the device is
53
+ * considered offline. Mirrors `backend/convex/devices.ts` so
54
+ * Convex + every client agree on the same threshold.
55
+ */
56
+ exports.HEARTBEAT_STALE_MS = 90000;
57
+ /**
58
+ * How long after the last UDP beacon an agent is still considered
59
+ * "locally present". Re-broadcast interval is 3 s, so 10 s covers
60
+ * three missed beats without false offline.
61
+ */
62
+ exports.BEACON_STALE_MS = 10000;
63
+ /** Timeout for a direct /health probe over LAN. */
64
+ exports.PROBE_TIMEOUT_MS = 2500;
65
+ /** Timeout for /health probe routed through a relay server. */
66
+ exports.RELAY_PROBE_TIMEOUT_MS = 6000;
67
+ // ── Auth ──────────────────────────────────────────────────────────────
68
+ /**
69
+ * OAuth callback URL used by mobile + SDK deep-link flows. The yaver.io
70
+ * web OAuth endpoints redirect here once the provider returns. Android
71
+ * consumers must register the matching `<intent-filter>` in their
72
+ * manifest; iOS consumers inside an `ASWebAuthenticationSession` don't
73
+ * need to.
74
+ */
75
+ exports.OAUTH_REDIRECT = 'yaver://oauth-callback';
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Endpoint paths for every service the Yaver clients talk to.
3
+ *
4
+ * Kept here so a typo in one consumer doesn't cause a subtle 404 that
5
+ * only shows up in one client. Any new agent endpoint added to
6
+ * `desktop/agent/httpserver.go` should get a matching entry here.
7
+ *
8
+ * Source of truth — see ARCHITECTURE_CLIENT_CORE.md. Copies in
9
+ * `mobile/src/_core/` and `sdk/feedback/react-native/src/_core/`
10
+ * must remain byte-identical; do not edit those directly.
11
+ */
12
+ /** Routes on the user's Go agent (http://<host>:18080). */
13
+ export declare const AGENT_ENDPOINTS: {
14
+ readonly health: "/health";
15
+ readonly info: "/info";
16
+ readonly agentStatus: "/agent/status";
17
+ readonly runners: "/agent/runners";
18
+ readonly feedback: "/feedback";
19
+ readonly feedbackFix: (id: string) => string;
20
+ readonly feedbackStream: "/feedback/stream";
21
+ readonly devReload: "/dev/reload";
22
+ readonly devReloadApp: "/dev/reload-app";
23
+ readonly devStart: "/dev/start";
24
+ readonly devStop: "/dev/stop";
25
+ readonly devStatus: "/dev/status";
26
+ readonly devEvents: "/dev/events";
27
+ readonly devBuildNative: "/dev/build-native";
28
+ readonly builds: "/builds";
29
+ readonly buildArtifact: (id: string) => string;
30
+ readonly tasks: "/tasks";
31
+ readonly taskById: (id: string) => string;
32
+ readonly taskStop: (id: string) => string;
33
+ readonly vibing: "/vibing";
34
+ readonly vibingExecute: "/vibing/execute";
35
+ readonly voiceStatus: "/voice/status";
36
+ readonly voiceTranscribe: "/voice/transcribe";
37
+ readonly blackboxEvents: "/blackbox/events";
38
+ readonly blackboxCommandStream: "/blackbox/command-stream";
39
+ readonly sdkTokenRotate: "/sdk/token/rotate";
40
+ readonly testAppStart: "/test-app/start";
41
+ readonly testAppStop: "/test-app/stop";
42
+ readonly testAppStatus: "/test-app/status";
43
+ };
44
+ /** Routes on the yaver.io Convex deployment. */
45
+ export declare const CONVEX_ENDPOINTS: {
46
+ readonly devicesList: "/devices/list";
47
+ readonly deviceRemove: "/devices/remove";
48
+ readonly authValidate: "/auth/validate";
49
+ readonly authAppleNative: "/auth/apple-native";
50
+ readonly authSignup: "/auth/signup";
51
+ readonly authLogin: "/auth/login";
52
+ readonly userSettings: "/settings";
53
+ readonly platformConfig: "/config";
54
+ readonly guestsList: "/guests/list";
55
+ readonly guestsHosts: "/guests/hosts";
56
+ readonly guestsAllowed: "/guests/allowed";
57
+ readonly guestsInvite: "/guests/invite";
58
+ readonly guestsAccept: "/guests/accept";
59
+ readonly guestsAcceptCode: "/guests/accept-code";
60
+ readonly guestsRevoke: "/guests/revoke";
61
+ };
62
+ /** Routes on a relay server. */
63
+ export declare const RELAY_ENDPOINTS: {
64
+ readonly presence: "/presence";
65
+ readonly forDevice: (deviceId: string) => string;
66
+ };
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ // AUTO-SYNCED from shared/client-core/src/endpoints.ts.
3
+ // DO NOT EDIT IN PLACE. Edit the source and re-run
4
+ // scripts/sync-client-core.sh. CI checks drift via `--check`.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RELAY_ENDPOINTS = exports.CONVEX_ENDPOINTS = exports.AGENT_ENDPOINTS = void 0;
7
+ /**
8
+ * Endpoint paths for every service the Yaver clients talk to.
9
+ *
10
+ * Kept here so a typo in one consumer doesn't cause a subtle 404 that
11
+ * only shows up in one client. Any new agent endpoint added to
12
+ * `desktop/agent/httpserver.go` should get a matching entry here.
13
+ *
14
+ * Source of truth — see ARCHITECTURE_CLIENT_CORE.md. Copies in
15
+ * `mobile/src/_core/` and `sdk/feedback/react-native/src/_core/`
16
+ * must remain byte-identical; do not edit those directly.
17
+ */
18
+ /** Routes on the user's Go agent (http://<host>:18080). */
19
+ exports.AGENT_ENDPOINTS = {
20
+ health: '/health',
21
+ info: '/info',
22
+ agentStatus: '/agent/status',
23
+ runners: '/agent/runners',
24
+ feedback: '/feedback',
25
+ feedbackFix: (id) => `/feedback/${encodeURIComponent(id)}/fix`,
26
+ feedbackStream: '/feedback/stream',
27
+ devReload: '/dev/reload',
28
+ devReloadApp: '/dev/reload-app',
29
+ devStart: '/dev/start',
30
+ devStop: '/dev/stop',
31
+ devStatus: '/dev/status',
32
+ devEvents: '/dev/events',
33
+ devBuildNative: '/dev/build-native',
34
+ builds: '/builds',
35
+ buildArtifact: (id) => `/builds/${encodeURIComponent(id)}/artifact`,
36
+ tasks: '/tasks',
37
+ taskById: (id) => `/tasks/${encodeURIComponent(id)}`,
38
+ taskStop: (id) => `/tasks/${encodeURIComponent(id)}/stop`,
39
+ vibing: '/vibing',
40
+ vibingExecute: '/vibing/execute',
41
+ voiceStatus: '/voice/status',
42
+ voiceTranscribe: '/voice/transcribe',
43
+ blackboxEvents: '/blackbox/events',
44
+ blackboxCommandStream: '/blackbox/command-stream',
45
+ sdkTokenRotate: '/sdk/token/rotate',
46
+ testAppStart: '/test-app/start',
47
+ testAppStop: '/test-app/stop',
48
+ testAppStatus: '/test-app/status',
49
+ };
50
+ /** Routes on the yaver.io Convex deployment. */
51
+ exports.CONVEX_ENDPOINTS = {
52
+ devicesList: '/devices/list',
53
+ deviceRemove: '/devices/remove',
54
+ authValidate: '/auth/validate',
55
+ authAppleNative: '/auth/apple-native',
56
+ authSignup: '/auth/signup',
57
+ authLogin: '/auth/login',
58
+ userSettings: '/settings',
59
+ platformConfig: '/config',
60
+ guestsList: '/guests/list',
61
+ guestsHosts: '/guests/hosts',
62
+ guestsAllowed: '/guests/allowed',
63
+ guestsInvite: '/guests/invite',
64
+ guestsAccept: '/guests/accept',
65
+ guestsAcceptCode: '/guests/accept-code',
66
+ guestsRevoke: '/guests/revoke',
67
+ };
68
+ /** Routes on a relay server. */
69
+ exports.RELAY_ENDPOINTS = {
70
+ presence: '/presence',
71
+ forDevice: (deviceId) => `/d/${encodeURIComponent(deviceId)}`,
72
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @yaver/client-core — shared constants + endpoint paths used by every
3
+ * Yaver client (mobile, feedback SDKs, web dashboard, desktop app).
4
+ *
5
+ * Phase 1 of the extraction documented in ARCHITECTURE_CLIENT_CORE.md.
6
+ * Later phases add dedup helpers, Discovery, OAuth, BlackBox, etc. —
7
+ * see that doc for the full roadmap.
8
+ *
9
+ * Not published to npm. Consumers mirror this directory as `_core/`
10
+ * under their own `src/` and re-export. `scripts/sync-client-core.sh`
11
+ * keeps the mirrors byte-identical; CI verifies it.
12
+ */
13
+ export * from './constants';
14
+ export * from './endpoints';
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ // AUTO-SYNCED from shared/client-core/src/index.ts.
3
+ // DO NOT EDIT IN PLACE. Edit the source and re-run
4
+ // scripts/sync-client-core.sh. CI checks drift via `--check`.
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ /**
21
+ * @yaver/client-core — shared constants + endpoint paths used by every
22
+ * Yaver client (mobile, feedback SDKs, web dashboard, desktop app).
23
+ *
24
+ * Phase 1 of the extraction documented in ARCHITECTURE_CLIENT_CORE.md.
25
+ * Later phases add dedup helpers, Discovery, OAuth, BlackBox, etc. —
26
+ * see that doc for the full roadmap.
27
+ *
28
+ * Not published to npm. Consumers mirror this directory as `_core/`
29
+ * under their own `src/` and re-export. `scripts/sync-client-core.sh`
30
+ * keeps the mirrors byte-identical; CI verifies it.
31
+ */
32
+ __exportStar(require("./constants"), exports);
33
+ __exportStar(require("./endpoints"), exports);
package/dist/auth.js CHANGED
@@ -63,13 +63,15 @@ catch {
63
63
  const TOKEN_KEY = 'yaver_feedback_auth_token';
64
64
  const USER_KEY = 'yaver_feedback_user';
65
65
  const DEVICE_KEY = 'yaver_feedback_selected_device';
66
- // Source of truth: mobile/src/lib/constants.ts CONVEX_SITE_URL.
67
- // The yaver-io Convex deployment was migrated from shocking-echidna-394
68
- // to perceptive-minnow-557; sessions minted against the old deployment
69
- // don't validate on agents that point at the new one, producing a 403
70
- // "invalid token" from the agent's authSDK middleware.
71
- exports.DEFAULT_CONVEX_SITE_URL = 'https://perceptive-minnow-557.eu-west-1.convex.site';
72
- exports.DEFAULT_WEB_BASE_URL = 'https://yaver.io';
66
+ // Source of truth: `shared/client-core/src/constants.ts`, mirrored to
67
+ // `./_core/constants` via `scripts/sync-client-core.sh`. Keeps the
68
+ // SDK, mobile app, and web dashboard on the same Convex deployment
69
+ // string at all times previously this drifted and produced 403
70
+ // "invalid token" from the agent's authSDK middleware. See
71
+ // ARCHITECTURE_CLIENT_CORE.md.
72
+ const constants_1 = require("./_core/constants");
73
+ exports.DEFAULT_CONVEX_SITE_URL = constants_1.CONVEX_SITE_URL;
74
+ exports.DEFAULT_WEB_BASE_URL = constants_1.WEB_BASE_URL;
73
75
  let convexSiteUrl = exports.DEFAULT_CONVEX_SITE_URL;
74
76
  let webBaseUrl = exports.DEFAULT_WEB_BASE_URL;
75
77
  let strictNativeAuth = false;
@@ -266,7 +268,7 @@ async function signInWithApple() {
266
268
  * register the scheme on iOS. On Android, add an `<intent-filter>` for
267
269
  * `yaver://oauth-callback` in the host app's AndroidManifest.xml.
268
270
  */
269
- exports.DEFAULT_OAUTH_REDIRECT = 'yaver://oauth-callback';
271
+ exports.DEFAULT_OAUTH_REDIRECT = constants_1.OAUTH_REDIRECT;
270
272
  /**
271
273
  * Sign in through the in-app browser via yaver.io. Opens
272
274
  * `https://yaver.io/api/auth/oauth/<provider>?client=mobile`, the user picks
@@ -24,10 +24,11 @@ import type { RemoteDevice } from './auth';
24
24
  export declare function collapseRemoteDevices(devices: RemoteDevice[]): RemoteDevice[];
25
25
  /**
26
26
  * Threshold for "online" based on heartbeat age, in milliseconds.
27
- * Matches the mobile app (HEARTBEAT_STALE_MS = 90 s). The SDK used
28
- * 60 s, which flashed yellow on single missed beats.
27
+ * Re-exported from `@yaver/client-core` so mobile + SDK + backend
28
+ * agree on one number at all times.
29
29
  */
30
- export declare const HEARTBEAT_STALE_MS = 90000;
30
+ import { HEARTBEAT_STALE_MS } from './_core/constants';
31
+ export { HEARTBEAT_STALE_MS };
31
32
  /**
32
33
  * Returns a freshness flag consistent with the mobile app. A device is
33
34
  * "fresh" when it was online per Convex AND its heartbeat is within
@@ -141,10 +141,11 @@ function collapseRemoteDevices(devices) {
141
141
  }
142
142
  /**
143
143
  * Threshold for "online" based on heartbeat age, in milliseconds.
144
- * Matches the mobile app (HEARTBEAT_STALE_MS = 90 s). The SDK used
145
- * 60 s, which flashed yellow on single missed beats.
144
+ * Re-exported from `@yaver/client-core` so mobile + SDK + backend
145
+ * agree on one number at all times.
146
146
  */
147
- exports.HEARTBEAT_STALE_MS = 90000;
147
+ const constants_1 = require("./_core/constants");
148
+ Object.defineProperty(exports, "HEARTBEAT_STALE_MS", { enumerable: true, get: function () { return constants_1.HEARTBEAT_STALE_MS; } });
148
149
  /**
149
150
  * Returns a freshness flag consistent with the mobile app. A device is
150
151
  * "fresh" when it was online per Convex AND its heartbeat is within
@@ -155,7 +156,7 @@ function isDeviceFresh(d) {
155
156
  return false;
156
157
  if (!d.lastHeartbeat)
157
158
  return true;
158
- return Date.now() - d.lastHeartbeat < exports.HEARTBEAT_STALE_MS;
159
+ return Date.now() - d.lastHeartbeat < constants_1.HEARTBEAT_STALE_MS;
159
160
  }
160
161
  /**
161
162
  * Pick the best candidate for an auto-connect attempt. Preference:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yaver-feedback-react-native",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "description": "Visual feedback SDK for Yaver — bug reports, screen recording, voice annotations, and local-first developer workflows",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,86 @@
1
+ // AUTO-SYNCED from shared/client-core/src/constants.ts.
2
+ // DO NOT EDIT IN PLACE. Edit the source and re-run
3
+ // scripts/sync-client-core.sh. CI checks drift via `--check`.
4
+
5
+ /**
6
+ * Canonical client-side constants shared between:
7
+ * - Yaver mobile (`mobile/`)
8
+ * - yaver-feedback-react-native (`sdk/feedback/react-native/`)
9
+ * - yaver-feedback-web (`sdk/feedback/web/`)
10
+ * - web dashboard (`web/`)
11
+ *
12
+ * This is THE source of truth. If you need to change one of these
13
+ * values, change it here and re-run `scripts/sync-client-core.sh` so
14
+ * every consumer picks it up. Each consumer ships its own compiled
15
+ * copy so the shared/client-core directory never needs to be published
16
+ * to npm — but the copies MUST remain byte-identical.
17
+ *
18
+ * DO NOT edit the copies under `mobile/src/_core/` or
19
+ * `sdk/feedback/react-native/src/_core/` directly. They will be
20
+ * overwritten by the sync script, and a CI check fails the build if
21
+ * they drift.
22
+ *
23
+ * See ARCHITECTURE_CLIENT_CORE.md for the full plan.
24
+ */
25
+
26
+ // ── Yaver.io production Convex deployment ────────────────────────────
27
+ //
28
+ // This is the Convex site every yaver.io client signs in against and
29
+ // every Go agent validates tokens against. If yaver.io migrates the
30
+ // deployment (as it did from shocking-echidna-394 → perceptive-minnow-
31
+ // 557 in early 2026), bump this constant and every client — mobile,
32
+ // both Feedback SDKs, web dashboard — picks it up on the next rebuild.
33
+ // No more "invalid token" 403s from clients sitting on a stale URL.
34
+ export const CONVEX_SITE_URL =
35
+ 'https://perceptive-minnow-557.eu-west-1.convex.site';
36
+
37
+ // Public web origin. Used for OAuth redirect URL building, the account
38
+ // merge approval page, and SDK deep-links. Separate from CONVEX_SITE_URL
39
+ // because the web app and Convex live on different origins.
40
+ export const WEB_BASE_URL = 'https://yaver.io';
41
+
42
+ // ── Transport ─────────────────────────────────────────────────────────
43
+
44
+ /** Default HTTP port `yaver serve` listens on. */
45
+ export const DEFAULT_AGENT_HTTP_PORT = 18080;
46
+
47
+ /** UDP port the LAN beacon is broadcast on. */
48
+ export const DEFAULT_BEACON_UDP_PORT = 19837;
49
+
50
+ // ── Freshness windows ─────────────────────────────────────────────────
51
+ //
52
+ // All three of these must match the corresponding constants on the
53
+ // backend (`backend/convex/devices.ts::HEARTBEAT_STALE_MS`) and the
54
+ // desktop agent. Drift between clients and backend produces "green on
55
+ // one, yellow on the other" UX glitches from clock-skew alone.
56
+
57
+ /**
58
+ * How old an agent's last heartbeat can be before the device is
59
+ * considered offline. Mirrors `backend/convex/devices.ts` so
60
+ * Convex + every client agree on the same threshold.
61
+ */
62
+ export const HEARTBEAT_STALE_MS = 90_000;
63
+
64
+ /**
65
+ * How long after the last UDP beacon an agent is still considered
66
+ * "locally present". Re-broadcast interval is 3 s, so 10 s covers
67
+ * three missed beats without false offline.
68
+ */
69
+ export const BEACON_STALE_MS = 10_000;
70
+
71
+ /** Timeout for a direct /health probe over LAN. */
72
+ export const PROBE_TIMEOUT_MS = 2_500;
73
+
74
+ /** Timeout for /health probe routed through a relay server. */
75
+ export const RELAY_PROBE_TIMEOUT_MS = 6_000;
76
+
77
+ // ── Auth ──────────────────────────────────────────────────────────────
78
+
79
+ /**
80
+ * OAuth callback URL used by mobile + SDK deep-link flows. The yaver.io
81
+ * web OAuth endpoints redirect here once the provider returns. Android
82
+ * consumers must register the matching `<intent-filter>` in their
83
+ * manifest; iOS consumers inside an `ASWebAuthenticationSession` don't
84
+ * need to.
85
+ */
86
+ export const OAUTH_REDIRECT = 'yaver://oauth-callback';
@@ -0,0 +1,81 @@
1
+ // AUTO-SYNCED from shared/client-core/src/endpoints.ts.
2
+ // DO NOT EDIT IN PLACE. Edit the source and re-run
3
+ // scripts/sync-client-core.sh. CI checks drift via `--check`.
4
+
5
+ /**
6
+ * Endpoint paths for every service the Yaver clients talk to.
7
+ *
8
+ * Kept here so a typo in one consumer doesn't cause a subtle 404 that
9
+ * only shows up in one client. Any new agent endpoint added to
10
+ * `desktop/agent/httpserver.go` should get a matching entry here.
11
+ *
12
+ * Source of truth — see ARCHITECTURE_CLIENT_CORE.md. Copies in
13
+ * `mobile/src/_core/` and `sdk/feedback/react-native/src/_core/`
14
+ * must remain byte-identical; do not edit those directly.
15
+ */
16
+
17
+ /** Routes on the user's Go agent (http://<host>:18080). */
18
+ export const AGENT_ENDPOINTS = {
19
+ health: '/health',
20
+ info: '/info',
21
+ agentStatus: '/agent/status',
22
+ runners: '/agent/runners',
23
+
24
+ feedback: '/feedback',
25
+ feedbackFix: (id: string) => `/feedback/${encodeURIComponent(id)}/fix`,
26
+ feedbackStream: '/feedback/stream',
27
+
28
+ devReload: '/dev/reload',
29
+ devReloadApp: '/dev/reload-app',
30
+ devStart: '/dev/start',
31
+ devStop: '/dev/stop',
32
+ devStatus: '/dev/status',
33
+ devEvents: '/dev/events',
34
+ devBuildNative: '/dev/build-native',
35
+
36
+ builds: '/builds',
37
+ buildArtifact: (id: string) => `/builds/${encodeURIComponent(id)}/artifact`,
38
+
39
+ tasks: '/tasks',
40
+ taskById: (id: string) => `/tasks/${encodeURIComponent(id)}`,
41
+ taskStop: (id: string) => `/tasks/${encodeURIComponent(id)}/stop`,
42
+
43
+ vibing: '/vibing',
44
+ vibingExecute: '/vibing/execute',
45
+
46
+ voiceStatus: '/voice/status',
47
+ voiceTranscribe: '/voice/transcribe',
48
+
49
+ blackboxEvents: '/blackbox/events',
50
+ blackboxCommandStream: '/blackbox/command-stream',
51
+
52
+ sdkTokenRotate: '/sdk/token/rotate',
53
+ testAppStart: '/test-app/start',
54
+ testAppStop: '/test-app/stop',
55
+ testAppStatus: '/test-app/status',
56
+ } as const;
57
+
58
+ /** Routes on the yaver.io Convex deployment. */
59
+ export const CONVEX_ENDPOINTS = {
60
+ devicesList: '/devices/list',
61
+ deviceRemove: '/devices/remove',
62
+ authValidate: '/auth/validate',
63
+ authAppleNative: '/auth/apple-native',
64
+ authSignup: '/auth/signup',
65
+ authLogin: '/auth/login',
66
+ userSettings: '/settings',
67
+ platformConfig: '/config',
68
+ guestsList: '/guests/list',
69
+ guestsHosts: '/guests/hosts',
70
+ guestsAllowed: '/guests/allowed',
71
+ guestsInvite: '/guests/invite',
72
+ guestsAccept: '/guests/accept',
73
+ guestsAcceptCode: '/guests/accept-code',
74
+ guestsRevoke: '/guests/revoke',
75
+ } as const;
76
+
77
+ /** Routes on a relay server. */
78
+ export const RELAY_ENDPOINTS = {
79
+ presence: '/presence',
80
+ forDevice: (deviceId: string) => `/d/${encodeURIComponent(deviceId)}`,
81
+ } as const;
@@ -0,0 +1,19 @@
1
+ // AUTO-SYNCED from shared/client-core/src/index.ts.
2
+ // DO NOT EDIT IN PLACE. Edit the source and re-run
3
+ // scripts/sync-client-core.sh. CI checks drift via `--check`.
4
+
5
+ /**
6
+ * @yaver/client-core — shared constants + endpoint paths used by every
7
+ * Yaver client (mobile, feedback SDKs, web dashboard, desktop app).
8
+ *
9
+ * Phase 1 of the extraction documented in ARCHITECTURE_CLIENT_CORE.md.
10
+ * Later phases add dedup helpers, Discovery, OAuth, BlackBox, etc. —
11
+ * see that doc for the full roadmap.
12
+ *
13
+ * Not published to npm. Consumers mirror this directory as `_core/`
14
+ * under their own `src/` and re-export. `scripts/sync-client-core.sh`
15
+ * keeps the mirrors byte-identical; CI verifies it.
16
+ */
17
+
18
+ export * from './constants';
19
+ export * from './endpoints';
package/src/auth.ts CHANGED
@@ -67,14 +67,15 @@ const TOKEN_KEY = 'yaver_feedback_auth_token';
67
67
  const USER_KEY = 'yaver_feedback_user';
68
68
  const DEVICE_KEY = 'yaver_feedback_selected_device';
69
69
 
70
- // Source of truth: mobile/src/lib/constants.ts CONVEX_SITE_URL.
71
- // The yaver-io Convex deployment was migrated from shocking-echidna-394
72
- // to perceptive-minnow-557; sessions minted against the old deployment
73
- // don't validate on agents that point at the new one, producing a 403
74
- // "invalid token" from the agent's authSDK middleware.
75
- export const DEFAULT_CONVEX_SITE_URL =
76
- 'https://perceptive-minnow-557.eu-west-1.convex.site';
77
- export const DEFAULT_WEB_BASE_URL = 'https://yaver.io';
70
+ // Source of truth: `shared/client-core/src/constants.ts`, mirrored to
71
+ // `./_core/constants` via `scripts/sync-client-core.sh`. Keeps the
72
+ // SDK, mobile app, and web dashboard on the same Convex deployment
73
+ // string at all times previously this drifted and produced 403
74
+ // "invalid token" from the agent's authSDK middleware. See
75
+ // ARCHITECTURE_CLIENT_CORE.md.
76
+ import { CONVEX_SITE_URL, WEB_BASE_URL, OAUTH_REDIRECT } from './_core/constants';
77
+ export const DEFAULT_CONVEX_SITE_URL = CONVEX_SITE_URL;
78
+ export const DEFAULT_WEB_BASE_URL = WEB_BASE_URL;
78
79
 
79
80
  let convexSiteUrl = DEFAULT_CONVEX_SITE_URL;
80
81
  let webBaseUrl = DEFAULT_WEB_BASE_URL;
@@ -294,7 +295,7 @@ export async function signInWithApple(): Promise<{ token: string; userId: string
294
295
  * register the scheme on iOS. On Android, add an `<intent-filter>` for
295
296
  * `yaver://oauth-callback` in the host app's AndroidManifest.xml.
296
297
  */
297
- export const DEFAULT_OAUTH_REDIRECT = 'yaver://oauth-callback';
298
+ export const DEFAULT_OAUTH_REDIRECT = OAUTH_REDIRECT;
298
299
 
299
300
  /**
300
301
  * Sign in through the in-app browser via yaver.io. Opens
@@ -141,10 +141,11 @@ export function collapseRemoteDevices(devices: RemoteDevice[]): RemoteDevice[] {
141
141
 
142
142
  /**
143
143
  * Threshold for "online" based on heartbeat age, in milliseconds.
144
- * Matches the mobile app (HEARTBEAT_STALE_MS = 90 s). The SDK used
145
- * 60 s, which flashed yellow on single missed beats.
144
+ * Re-exported from `@yaver/client-core` so mobile + SDK + backend
145
+ * agree on one number at all times.
146
146
  */
147
- export const HEARTBEAT_STALE_MS = 90_000;
147
+ import { HEARTBEAT_STALE_MS } from './_core/constants';
148
+ export { HEARTBEAT_STALE_MS };
148
149
 
149
150
  /**
150
151
  * Returns a freshness flag consistent with the mobile app. A device is