@camstack/server 1.2.146 → 1.2.148
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,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ADAPTIVE_PROBE_BYTES = void 0;
|
|
4
|
+
exports.registerAdaptiveProbeRoute = registerAdaptiveProbeRoute;
|
|
5
|
+
exports.ADAPTIVE_PROBE_BYTES = 128 * 1024;
|
|
6
|
+
const BODY = Buffer.alloc(exports.ADAPTIVE_PROBE_BYTES, 0x61);
|
|
7
|
+
function registerAdaptiveProbeRoute(fastify) {
|
|
8
|
+
fastify.get('/adaptive-probe', async (_req, reply) => {
|
|
9
|
+
reply.header('cache-control', 'no-store');
|
|
10
|
+
reply.header('content-type', 'application/octet-stream');
|
|
11
|
+
return reply.send(BODY);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -4338,6 +4338,22 @@ function createCapRouter_localNetwork(getProvider, createRemoteProxy) {
|
|
|
4338
4338
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
4339
4339
|
return p.setNotificationEndpoint(methodInput);
|
|
4340
4340
|
}),
|
|
4341
|
+
getViewerEndpoints: trpc_middleware_js_1.protectedProcedure
|
|
4342
|
+
.input(zod_1.z.object({ nodeId: zod_1.z.string().optional() }).optional())
|
|
4343
|
+
.output(types_57.localNetworkCapability.methods.getViewerEndpoints.output)
|
|
4344
|
+
.query(async ({ input, ctx }) => {
|
|
4345
|
+
const p = resolveProvider('local-network', input?.nodeId, () => getProvider(ctx), createRemoteProxy);
|
|
4346
|
+
return p.getViewerEndpoints();
|
|
4347
|
+
}),
|
|
4348
|
+
setViewerEndpoints: trpc_middleware_js_1.protectedProcedure
|
|
4349
|
+
.input(types_57.localNetworkCapability.methods.setViewerEndpoints.input.loose())
|
|
4350
|
+
.output(types_57.localNetworkCapability.methods.setViewerEndpoints.output)
|
|
4351
|
+
.mutation(async ({ input, ctx }) => {
|
|
4352
|
+
const { nodeId, ...methodInput } = input;
|
|
4353
|
+
const p = resolveProvider('local-network', nodeId, () => getProvider(ctx), createRemoteProxy);
|
|
4354
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
4355
|
+
return p.setViewerEndpoints(methodInput);
|
|
4356
|
+
}),
|
|
4341
4357
|
getAllowedAddresses: trpc_middleware_js_1.protectedProcedure
|
|
4342
4358
|
.input(zod_1.z.object({ nodeId: zod_1.z.string().optional() }).optional())
|
|
4343
4359
|
.output(types_57.localNetworkCapability.methods.getAllowedAddresses.output)
|
|
@@ -5725,6 +5741,24 @@ function createCapRouter_pipelineAnalytics(getProvider, createRemoteProxy) {
|
|
|
5725
5741
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
5726
5742
|
return p.listRecentTracks(methodInput);
|
|
5727
5743
|
}),
|
|
5744
|
+
listGroups: trpc_middleware_js_1.protectedProcedure
|
|
5745
|
+
.input(types_82.pipelineAnalyticsCapability.methods.listGroups.input.loose())
|
|
5746
|
+
.output(types_82.pipelineAnalyticsCapability.methods.listGroups.output)
|
|
5747
|
+
.query(async ({ input, ctx }) => {
|
|
5748
|
+
const { nodeId, ...methodInput } = input;
|
|
5749
|
+
const p = resolveProvider('pipeline-analytics', nodeId, () => getProvider(ctx), createRemoteProxy);
|
|
5750
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
5751
|
+
return p.listGroups(methodInput);
|
|
5752
|
+
}),
|
|
5753
|
+
getGroup: trpc_middleware_js_1.protectedProcedure
|
|
5754
|
+
.input(types_82.pipelineAnalyticsCapability.methods.getGroup.input.loose())
|
|
5755
|
+
.output(types_82.pipelineAnalyticsCapability.methods.getGroup.output)
|
|
5756
|
+
.query(async ({ input, ctx }) => {
|
|
5757
|
+
const { nodeId, ...methodInput } = input;
|
|
5758
|
+
const p = resolveProvider('pipeline-analytics', nodeId, () => getProvider(ctx), createRemoteProxy);
|
|
5759
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
5760
|
+
return p.getGroup(methodInput);
|
|
5761
|
+
}),
|
|
5728
5762
|
clearTracks: trpc_middleware_js_1.adminProcedure
|
|
5729
5763
|
.input(types_82.pipelineAnalyticsCapability.methods.clearTracks.input.loose())
|
|
5730
5764
|
.output(types_82.pipelineAnalyticsCapability.methods.clearTracks.output)
|
|
@@ -88,50 +88,15 @@ function enrichInputWithRelayClass(input, clientClass) {
|
|
|
88
88
|
return { ...input, relayOnly };
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* on the smallest tier; the broker's `AdaptiveController` upgrades from there
|
|
98
|
-
* once the link proves healthy. `lan` and `vpn` (Tailscale, direct overlay)
|
|
99
|
-
* keep the full-quality default and are never biased.
|
|
100
|
-
*/
|
|
101
|
-
const REMOTE_INITIAL_ADAPTIVE_TIER = 'low';
|
|
102
|
-
/**
|
|
103
|
-
* Bias the INITIAL adaptive-tier selection for a genuinely-remote viewer by
|
|
104
|
-
* injecting a `prefersTier` hint the broker's `selectBestBroker` already
|
|
105
|
-
* honours. The hub is the only layer that knows the client's network class
|
|
106
|
-
* (the forked broker cannot see the HTTP request), so — exactly like
|
|
107
|
-
* `relayOnly` and the User-Agent — the class is read here and threaded down
|
|
108
|
-
* through the EXISTING `hints` cap field (no cap/schema change: `prefersTier`
|
|
109
|
-
* is already part of `webrtcClientHintsSchema`).
|
|
110
|
-
*
|
|
111
|
-
* Applied ONLY when:
|
|
112
|
-
* - the client class is `remote` (lan/vpn keep the full-quality default), and
|
|
113
|
-
* - the target is adaptive (`handleOffer` defaults an absent target to
|
|
114
|
-
* adaptive; a pinned profile/cam-stream is the operator's explicit choice
|
|
115
|
-
* and passes through untouched), and
|
|
116
|
-
* - the caller did not already set `prefersTier` (no client does today, but
|
|
117
|
-
* keep the trusted-injection rule symmetric with relayOnly/userAgent).
|
|
118
|
-
*
|
|
119
|
-
* Immutable — builds a NEW input (and a new `hints`), never mutates the
|
|
120
|
-
* caller's. On a downgrade re-offer the broker's controller-chosen tier intent
|
|
121
|
-
* overrides this hint, so a healthy remote session can still climb above `low`.
|
|
91
|
+
* Bias used to live here (`prefersTier: 'low'` for `remote`). That pinned
|
|
92
|
+
* every phone-sized session — including LAN IPv6 GUA misclassified as remote
|
|
93
|
+
* — onto the sub stream. Initial tier is now `pickAdaptiveTier` (default
|
|
94
|
+
* low, downlink limiter including mid, viewport ceiling for tiny tiles). This function
|
|
95
|
+
* stays as the documented seam so a future probe can still thread class
|
|
96
|
+
* without a cap change; today it is a no-op.
|
|
122
97
|
*/
|
|
123
|
-
function enrichHintsWithClientClass(input,
|
|
124
|
-
|
|
125
|
-
return input;
|
|
126
|
-
const isAdaptive = input.target === undefined || input.target.kind === 'adaptive';
|
|
127
|
-
if (!isAdaptive)
|
|
128
|
-
return input;
|
|
129
|
-
if (input.hints?.prefersTier !== undefined)
|
|
130
|
-
return input;
|
|
131
|
-
return {
|
|
132
|
-
...input,
|
|
133
|
-
hints: { ...input.hints, prefersTier: REMOTE_INITIAL_ADAPTIVE_TIER },
|
|
134
|
-
};
|
|
98
|
+
function enrichHintsWithClientClass(input, _clientClass) {
|
|
99
|
+
return input;
|
|
135
100
|
}
|
|
136
101
|
/**
|
|
137
102
|
* Per-request wrapper around the resolved `webrtc-session` broker singleton.
|
package/dist/main.js
CHANGED
|
@@ -59,6 +59,7 @@ const ws_2 = require("ws");
|
|
|
59
59
|
const addon_upload_1 = require("./api/addon-upload");
|
|
60
60
|
const auth_whoami_1 = require("./api/auth-whoami");
|
|
61
61
|
const health_routes_1 = require("./api/health/health.routes");
|
|
62
|
+
const adaptive_probe_routes_1 = require("./api/health/adaptive-probe.routes");
|
|
62
63
|
const model_distributor_js_1 = require("./api/model-distributor.js");
|
|
63
64
|
const oauth2_routes_js_1 = require("./api/oauth2/oauth2-routes.js");
|
|
64
65
|
const server_upload_1 = require("./api/server-upload");
|
|
@@ -459,6 +460,7 @@ async function bootstrap() {
|
|
|
459
460
|
verifyToken: (token) => app.get(auth_service_1.AuthService).verifyToken(token),
|
|
460
461
|
});
|
|
461
462
|
console.log(`[bootstrap] Health routes registered (hub v${hubVersion})`);
|
|
463
|
+
(0, adaptive_probe_routes_1.registerAdaptiveProbeRoute)(fastify);
|
|
462
464
|
}
|
|
463
465
|
catch (err) {
|
|
464
466
|
console.warn('[bootstrap] Failed to register health routes:', err);
|
|
@@ -1182,6 +1184,7 @@ async function bootstrap() {
|
|
|
1182
1184
|
url.startsWith('/api/') ||
|
|
1183
1185
|
url.startsWith('/agent') ||
|
|
1184
1186
|
url.startsWith('/health') ||
|
|
1187
|
+
url.startsWith('/adaptive-probe') ||
|
|
1185
1188
|
url.startsWith('/viewer')) {
|
|
1186
1189
|
return reply.callNotFound();
|
|
1187
1190
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.148",
|
|
4
4
|
"private": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -33,18 +33,18 @@
|
|
|
33
33
|
]
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@camstack/addon-admin-ui": "1.2.
|
|
37
|
-
"@camstack/addon-agent-ui": "1.2.
|
|
38
|
-
"@camstack/addon-auth": "1.2.
|
|
39
|
-
"@camstack/addon-decoder-nodeav": "1.2.
|
|
40
|
-
"@camstack/addon-notifiers": "1.2.
|
|
41
|
-
"@camstack/addon-pipeline": "1.2.
|
|
42
|
-
"@camstack/addon-pipeline-orchestrator": "1.2.
|
|
43
|
-
"@camstack/addon-post-analysis": "1.2.
|
|
44
|
-
"@camstack/sdk": "1.2.
|
|
45
|
-
"@camstack/system": "1.2.
|
|
46
|
-
"@camstack/types": "1.2.
|
|
47
|
-
"@camstack/ui-library": "1.2.
|
|
36
|
+
"@camstack/addon-admin-ui": "1.2.95",
|
|
37
|
+
"@camstack/addon-agent-ui": "1.2.28",
|
|
38
|
+
"@camstack/addon-auth": "1.2.30",
|
|
39
|
+
"@camstack/addon-decoder-nodeav": "1.2.26",
|
|
40
|
+
"@camstack/addon-notifiers": "1.2.31",
|
|
41
|
+
"@camstack/addon-pipeline": "1.2.119",
|
|
42
|
+
"@camstack/addon-pipeline-orchestrator": "1.2.103",
|
|
43
|
+
"@camstack/addon-post-analysis": "1.2.117",
|
|
44
|
+
"@camstack/sdk": "1.2.30",
|
|
45
|
+
"@camstack/system": "1.2.118",
|
|
46
|
+
"@camstack/types": "1.2.101",
|
|
47
|
+
"@camstack/ui-library": "1.2.69",
|
|
48
48
|
"@fastify/compress": "^9.0.0",
|
|
49
49
|
"@fastify/cookie": "^11.0.2",
|
|
50
50
|
"@fastify/cors": "^11.2.0",
|