@questionbase/deskfree 0.6.3 → 0.6.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.
- package/dist/bin.js +13 -9
- package/dist/bin.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -390,7 +390,7 @@ interface RuntimeConfig extends LocalConfig {
|
|
|
390
390
|
* Load local config from environment variables.
|
|
391
391
|
*
|
|
392
392
|
* Requires `BOT=BFRH3VXHQR7` (or `DESKFREE_BOT_ID`).
|
|
393
|
-
* API URL is derived from STAGE
|
|
393
|
+
* API URL is derived from STAGE.
|
|
394
394
|
*/
|
|
395
395
|
declare function loadConfig(): LocalConfig;
|
|
396
396
|
/**
|
package/dist/index.js
CHANGED
|
@@ -12607,17 +12607,21 @@ var DEFAULTS = {
|
|
|
12607
12607
|
logLevel: "info",
|
|
12608
12608
|
healthPort: 3100
|
|
12609
12609
|
};
|
|
12610
|
-
function
|
|
12610
|
+
function getBaseDomain(stage) {
|
|
12611
|
+
return stage === "my" ? "deskfree.ai" : "dev.deskfree.ai";
|
|
12612
|
+
}
|
|
12613
|
+
function getStageHost(stage) {
|
|
12614
|
+
const domain = getBaseDomain(stage);
|
|
12611
12615
|
if (domain.startsWith(`${stage}.`)) return domain;
|
|
12612
12616
|
return `${stage}.${domain}`;
|
|
12613
12617
|
}
|
|
12614
12618
|
function deriveApiUrl() {
|
|
12615
|
-
const
|
|
12616
|
-
|
|
12617
|
-
return `https://${getStageDomain(stage, domain)}/v1/bot`;
|
|
12619
|
+
const stage = process.env["STAGE"] ?? "my";
|
|
12620
|
+
return `https://${getStageHost(stage)}/v1/bot`;
|
|
12618
12621
|
}
|
|
12619
12622
|
function deriveWsUrl() {
|
|
12620
|
-
const
|
|
12623
|
+
const stage = process.env["STAGE"] ?? "my";
|
|
12624
|
+
const domain = getBaseDomain(stage);
|
|
12621
12625
|
return `wss://ws.${domain}`;
|
|
12622
12626
|
}
|
|
12623
12627
|
function loadConfig() {
|
|
@@ -12631,7 +12635,7 @@ function loadConfig() {
|
|
|
12631
12635
|
if (idError !== null) {
|
|
12632
12636
|
throw new Error(`Invalid bot ID: ${idError}`);
|
|
12633
12637
|
}
|
|
12634
|
-
const apiUrl =
|
|
12638
|
+
const apiUrl = deriveApiUrl();
|
|
12635
12639
|
const apiUrlError = validateApiUrl(apiUrl);
|
|
12636
12640
|
if (apiUrlError !== null) {
|
|
12637
12641
|
throw new Error(`Invalid API URL: ${apiUrlError}`);
|
|
@@ -12646,8 +12650,8 @@ function loadConfig() {
|
|
|
12646
12650
|
if (isNaN(healthPort) || healthPort < 1 || healthPort > 65535) {
|
|
12647
12651
|
throw new Error(`Invalid HEALTH_PORT: ${healthPortRaw}`);
|
|
12648
12652
|
}
|
|
12649
|
-
const stage = process.env["STAGE"] ?? "
|
|
12650
|
-
const wsUrl =
|
|
12653
|
+
const stage = process.env["STAGE"] ?? "my";
|
|
12654
|
+
const wsUrl = deriveWsUrl();
|
|
12651
12655
|
return {
|
|
12652
12656
|
botId,
|
|
12653
12657
|
apiUrl,
|
|
@@ -12675,7 +12679,7 @@ function mergeWithRemoteConfig(local, remote) {
|
|
|
12675
12679
|
return {
|
|
12676
12680
|
...local,
|
|
12677
12681
|
claudeCodePath,
|
|
12678
|
-
wsUrl:
|
|
12682
|
+
wsUrl: remote.wsUrl ?? local.wsUrl,
|
|
12679
12683
|
model: process.env["DESKFREE_MODEL"] ?? remote.model,
|
|
12680
12684
|
awsRegion: process.env["AWS_REGION"] ?? remote.awsRegion,
|
|
12681
12685
|
heartbeatIntervalMs: process.env["DESKFREE_HEARTBEAT_INTERVAL_MS"] ? parseInt(process.env["DESKFREE_HEARTBEAT_INTERVAL_MS"], 10) : remote.heartbeatIntervalMs,
|