camstack 1.2.152 → 1.2.154
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js
CHANGED
|
@@ -38,7 +38,7 @@ async function runServe(args) {
|
|
|
38
38
|
...typeof values.data === "string" ? { data: values.data } : {}
|
|
39
39
|
};
|
|
40
40
|
Object.assign(process.env, buildServeEnv(opts));
|
|
41
|
-
await import("./launcher-
|
|
41
|
+
await import("./launcher-ZQZHWQ6F.js");
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// src/commands/agent.ts
|
|
@@ -83,7 +83,7 @@ async function runAgent(args) {
|
|
|
83
83
|
...typeof values.port === "string" ? { port: values.port } : {}
|
|
84
84
|
};
|
|
85
85
|
Object.assign(process.env, buildAgentEnv(opts));
|
|
86
|
-
await import("./launcher-
|
|
86
|
+
await import("./launcher-ZQZHWQ6F.js");
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// src/commands/setup.ts
|
|
@@ -66719,6 +66719,75 @@ var require_device_manager_addon = __commonJS({
|
|
|
66719
66719
|
}
|
|
66720
66720
|
}
|
|
66721
66721
|
};
|
|
66722
|
+
var CONTRIBUTION_BUDGET_MS = 1500;
|
|
66723
|
+
var ContributionCache = class {
|
|
66724
|
+
maxEntries;
|
|
66725
|
+
entries = /* @__PURE__ */ new Map();
|
|
66726
|
+
constructor(maxEntries = 512) {
|
|
66727
|
+
this.maxEntries = maxEntries;
|
|
66728
|
+
}
|
|
66729
|
+
/**
|
|
66730
|
+
* Resolve one provider's contribution within `budgetMs`.
|
|
66731
|
+
*
|
|
66732
|
+
* The call is never cancelled: it keeps running and its answer refreshes the
|
|
66733
|
+
* cache, so the provider that overran this page pays for the next one.
|
|
66734
|
+
*/
|
|
66735
|
+
async resolve(key, call, budgetMs = CONTRIBUTION_BUDGET_MS) {
|
|
66736
|
+
const existing = this.entries.get(key);
|
|
66737
|
+
if (existing?.inFlight) return existing.value !== null ? {
|
|
66738
|
+
kind: "stale",
|
|
66739
|
+
value: existing.value
|
|
66740
|
+
} : {
|
|
66741
|
+
kind: "absent",
|
|
66742
|
+
reason: "slow"
|
|
66743
|
+
};
|
|
66744
|
+
const entry = existing ?? {
|
|
66745
|
+
value: null,
|
|
66746
|
+
inFlight: null
|
|
66747
|
+
};
|
|
66748
|
+
if (!existing) this.remember(key, entry);
|
|
66749
|
+
let settled = false;
|
|
66750
|
+
let answer = null;
|
|
66751
|
+
let failed = false;
|
|
66752
|
+
const refresh = call().then((value) => {
|
|
66753
|
+
answer = value;
|
|
66754
|
+
settled = true;
|
|
66755
|
+
entry.value = value;
|
|
66756
|
+
entry.inFlight = null;
|
|
66757
|
+
}, () => {
|
|
66758
|
+
failed = true;
|
|
66759
|
+
settled = true;
|
|
66760
|
+
entry.inFlight = null;
|
|
66761
|
+
});
|
|
66762
|
+
entry.inFlight = refresh;
|
|
66763
|
+
await Promise.race([refresh, sleep(budgetMs)]);
|
|
66764
|
+
if (settled && !failed) return {
|
|
66765
|
+
kind: "fresh",
|
|
66766
|
+
value: answer
|
|
66767
|
+
};
|
|
66768
|
+
if (entry.value !== null) return {
|
|
66769
|
+
kind: "stale",
|
|
66770
|
+
value: entry.value
|
|
66771
|
+
};
|
|
66772
|
+
return {
|
|
66773
|
+
kind: "absent",
|
|
66774
|
+
reason: failed ? "failed" : "slow"
|
|
66775
|
+
};
|
|
66776
|
+
}
|
|
66777
|
+
remember(key, entry) {
|
|
66778
|
+
this.entries.set(key, entry);
|
|
66779
|
+
while (this.entries.size > this.maxEntries) {
|
|
66780
|
+
const oldest = this.entries.keys().next();
|
|
66781
|
+
if (oldest.done === true) break;
|
|
66782
|
+
this.entries.delete(oldest.value);
|
|
66783
|
+
}
|
|
66784
|
+
}
|
|
66785
|
+
};
|
|
66786
|
+
function sleep(ms) {
|
|
66787
|
+
return new Promise((resolve) => {
|
|
66788
|
+
setTimeout(resolve, ms).unref?.();
|
|
66789
|
+
});
|
|
66790
|
+
}
|
|
66722
66791
|
function tagContribution(contribution, capName, addonId, kind) {
|
|
66723
66792
|
const source = kind === "settings" ? "settings" : "live";
|
|
66724
66793
|
return {
|
|
@@ -68310,6 +68379,39 @@ var require_device_manager_addon = __commonJS({
|
|
|
68310
68379
|
driverPatch
|
|
68311
68380
|
};
|
|
68312
68381
|
}
|
|
68382
|
+
var contributionCache = new ContributionCache();
|
|
68383
|
+
async function resolveContribution(deps, input) {
|
|
68384
|
+
const { deviceId, kind, capName, addonId } = input;
|
|
68385
|
+
const outcome = await contributionCache.resolve(`${String(deviceId)}:${kind}:${capName}:${addonId}`, input.call);
|
|
68386
|
+
if (outcome.kind === "fresh") return outcome.value === null ? null : tagContribution(outcome.value, capName, addonId, kind);
|
|
68387
|
+
if (outcome.kind === "stale") {
|
|
68388
|
+
deps.ctx.logger.info("device contribution served from the last answer \u2014 the provider is slow", {
|
|
68389
|
+
tags: {
|
|
68390
|
+
deviceId,
|
|
68391
|
+
addonId
|
|
68392
|
+
},
|
|
68393
|
+
meta: {
|
|
68394
|
+
capName,
|
|
68395
|
+
method: kind,
|
|
68396
|
+
budgetMs: CONTRIBUTION_BUDGET_MS
|
|
68397
|
+
}
|
|
68398
|
+
});
|
|
68399
|
+
return tagContribution(outcome.value, capName, addonId, kind);
|
|
68400
|
+
}
|
|
68401
|
+
deps.ctx.logger.warn("device contribution unavailable \u2014 the panel is missing this section", {
|
|
68402
|
+
tags: {
|
|
68403
|
+
deviceId,
|
|
68404
|
+
addonId
|
|
68405
|
+
},
|
|
68406
|
+
meta: {
|
|
68407
|
+
capName,
|
|
68408
|
+
method: kind,
|
|
68409
|
+
reason: outcome.reason,
|
|
68410
|
+
budgetMs: CONTRIBUTION_BUDGET_MS
|
|
68411
|
+
}
|
|
68412
|
+
});
|
|
68413
|
+
return null;
|
|
68414
|
+
}
|
|
68313
68415
|
async function getDeviceAggregate(deps, deviceId, kind) {
|
|
68314
68416
|
const registry = deps.capabilityRegistry;
|
|
68315
68417
|
if (!registry) {
|
|
@@ -68325,25 +68427,16 @@ var require_device_manager_addon = __commonJS({
|
|
|
68325
68427
|
if (!def?.exposesDeviceSettings) return null;
|
|
68326
68428
|
const provider = registry.getProviderByAddon(entry.capName, entry.providerAddonId);
|
|
68327
68429
|
if (!provider) return null;
|
|
68328
|
-
|
|
68329
|
-
|
|
68330
|
-
|
|
68331
|
-
|
|
68332
|
-
|
|
68333
|
-
|
|
68334
|
-
|
|
68335
|
-
|
|
68336
|
-
|
|
68337
|
-
|
|
68338
|
-
},
|
|
68339
|
-
meta: {
|
|
68340
|
-
capName: entry.capName,
|
|
68341
|
-
method,
|
|
68342
|
-
error: msg
|
|
68343
|
-
}
|
|
68344
|
-
});
|
|
68345
|
-
return null;
|
|
68346
|
-
}
|
|
68430
|
+
return await resolveContribution(deps, {
|
|
68431
|
+
deviceId,
|
|
68432
|
+
kind,
|
|
68433
|
+
capName: entry.capName,
|
|
68434
|
+
addonId: entry.providerAddonId,
|
|
68435
|
+
call: async () => {
|
|
68436
|
+
const contribution = await provider[method]({ deviceId });
|
|
68437
|
+
return contribution ? toWireShape(contribution) : null;
|
|
68438
|
+
}
|
|
68439
|
+
});
|
|
68347
68440
|
}));
|
|
68348
68441
|
const base = kind === "settings" ? await buildBaseDeviceSection(deps, deviceId) : null;
|
|
68349
68442
|
const systemResults = await collectSystemDeviceContributions(deps, deviceId, kind, seenCaps);
|
|
@@ -68368,24 +68461,16 @@ var require_device_manager_addon = __commonJS({
|
|
|
68368
68461
|
for (const addonId of addonIds) tasks.push((async () => {
|
|
68369
68462
|
const provider = registry.getProviderByAddon(info.name, addonId);
|
|
68370
68463
|
if (!provider) return null;
|
|
68371
|
-
|
|
68372
|
-
|
|
68373
|
-
|
|
68374
|
-
|
|
68375
|
-
|
|
68376
|
-
|
|
68377
|
-
|
|
68378
|
-
|
|
68379
|
-
|
|
68380
|
-
|
|
68381
|
-
meta: {
|
|
68382
|
-
capName: info.name,
|
|
68383
|
-
method,
|
|
68384
|
-
error: err instanceof Error ? err.message : String(err)
|
|
68385
|
-
}
|
|
68386
|
-
});
|
|
68387
|
-
return null;
|
|
68388
|
-
}
|
|
68464
|
+
return await resolveContribution(deps, {
|
|
68465
|
+
deviceId,
|
|
68466
|
+
kind,
|
|
68467
|
+
capName: info.name,
|
|
68468
|
+
addonId,
|
|
68469
|
+
call: async () => {
|
|
68470
|
+
const contribution = await provider[method]({ deviceId });
|
|
68471
|
+
return contribution ? toWireShape(contribution) : null;
|
|
68472
|
+
}
|
|
68473
|
+
});
|
|
68389
68474
|
})());
|
|
68390
68475
|
}
|
|
68391
68476
|
return (await Promise.all(tasks)).filter((r) => r !== null);
|