@shogo-ai/voice 2.4.1 → 2.4.3

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.
@@ -1025,6 +1025,15 @@ function checkVoiceOpModel(op, fields) {
1025
1025
  return { ok: true };
1026
1026
  }
1027
1027
 
1028
+ // src/runtime-token.ts
1029
+ var WORKSPACE_RUNTIME_TOKEN_MESSAGE = "RUNTIME_AUTH_SECRET is the workspace runtime token; app code needs its project token (rt_v1_\u2026). Start the app through the preview (server_sync / restart), not from a workspace shell.";
1030
+ function readRuntimeAuthSecret(env = typeof process === "undefined" ? void 0 : process.env) {
1031
+ const token = env?.RUNTIME_AUTH_SECRET;
1032
+ if (!token) return void 0;
1033
+ if (token.startsWith("wrt_v1_")) throw new Error(WORKSPACE_RUNTIME_TOKEN_MESSAGE);
1034
+ return token;
1035
+ }
1036
+
1028
1037
  export {
1029
1038
  DEFAULT_MEMORY_BLOCK,
1030
1039
  stripMemoryBlock,
@@ -1062,6 +1071,8 @@ export {
1062
1071
  parseVoiceOpJsonBody,
1063
1072
  parseVoiceOpForm,
1064
1073
  voiceOpUpstreamBody,
1065
- voiceOpPathParams
1074
+ voiceOpPathParams,
1075
+ WORKSPACE_RUNTIME_TOKEN_MESSAGE,
1076
+ readRuntimeAuthSecret
1066
1077
  };
1067
- //# sourceMappingURL=chunk-XE4LLC7Z.js.map
1078
+ //# sourceMappingURL=chunk-IOFWML5L.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createVoiceHandlers
3
- } from "./chunk-CLF25CZC.js";
3
+ } from "./chunk-U5UC7ZVS.js";
4
4
 
5
5
  // src/route/index.ts
6
6
  function defaultHandlers() {
@@ -29,4 +29,4 @@ export {
29
29
  defaultHandlers,
30
30
  createVoiceRoute
31
31
  };
32
- //# sourceMappingURL=chunk-UH75UVM2.js.map
32
+ //# sourceMappingURL=chunk-RALZRMFL.js.map
@@ -9,13 +9,14 @@ import {
9
9
  getVoiceOp,
10
10
  parseVoiceOpForm,
11
11
  parseVoiceOpJsonBody,
12
+ readRuntimeAuthSecret,
12
13
  resolveConvaiTtsModel,
13
14
  voiceOpForwardPath,
14
15
  voiceOpPathParams,
15
16
  voiceOpReturnsAudio,
16
17
  voiceOpUpstreamBody,
17
18
  voiceOpUpstreamPath
18
- } from "./chunk-XE4LLC7Z.js";
19
+ } from "./chunk-IOFWML5L.js";
19
20
  import {
20
21
  AUDIO_TAGS,
21
22
  AUDIO_TAG_GROUPS,
@@ -90,7 +91,7 @@ function resolveProxyOptions(config) {
90
91
  LOG_WARN_CACHE.apiKeyIgnored(config.logger);
91
92
  }
92
93
  if (typeof process === "undefined" || !process.env) return null;
93
- const runtimeToken = process.env.RUNTIME_AUTH_SECRET;
94
+ const runtimeToken = readRuntimeAuthSecret();
94
95
  const projectId = process.env.PROJECT_ID;
95
96
  if (!runtimeToken || !projectId) return null;
96
97
  return {
@@ -984,4 +985,4 @@ export {
984
985
  createVoiceHandlers,
985
986
  toNodeListener
986
987
  };
987
- //# sourceMappingURL=chunk-CLF25CZC.js.map
988
+ //# sourceMappingURL=chunk-U5UC7ZVS.js.map
package/dist/index.cjs CHANGED
@@ -58,6 +58,7 @@ __export(index_exports, {
58
58
  VOICE_STS_MODEL_IDS: () => VOICE_STS_MODEL_IDS,
59
59
  VOICE_TTS_MODELS: () => VOICE_TTS_MODELS,
60
60
  VOICE_TTS_MODEL_IDS: () => VOICE_TTS_MODEL_IDS,
61
+ WORKSPACE_RUNTIME_TOKEN_MESSAGE: () => WORKSPACE_RUNTIME_TOKEN_MESSAGE,
61
62
  buildPreviewLine: () => buildPreviewLine,
62
63
  composeAgentPrompt: () => composeAgentPrompt,
63
64
  composeExpressivityBlock: () => composeExpressivityBlock,
@@ -74,6 +75,7 @@ __export(index_exports, {
74
75
  parseVoiceOpJsonBody: () => parseVoiceOpJsonBody,
75
76
  readAudioTags: () => readAudioTags,
76
77
  readExpressivity: () => readExpressivity,
78
+ readRuntimeAuthSecret: () => readRuntimeAuthSecret,
77
79
  readVoiceSettings: () => readVoiceSettings,
78
80
  resolveConvaiTtsModel: () => resolveConvaiTtsModel,
79
81
  resolveConvaiTtsModelDetailed: () => resolveConvaiTtsModelDetailed,
@@ -2060,6 +2062,15 @@ var ShogoLiveClient = class {
2060
2062
  return body;
2061
2063
  }
2062
2064
  };
2065
+
2066
+ // src/runtime-token.ts
2067
+ var WORKSPACE_RUNTIME_TOKEN_MESSAGE = "RUNTIME_AUTH_SECRET is the workspace runtime token; app code needs its project token (rt_v1_\u2026). Start the app through the preview (server_sync / restart), not from a workspace shell.";
2068
+ function readRuntimeAuthSecret(env = typeof process === "undefined" ? void 0 : process.env) {
2069
+ const token = env?.RUNTIME_AUTH_SECRET;
2070
+ if (!token) return void 0;
2071
+ if (token.startsWith("wrt_v1_")) throw new Error(WORKSPACE_RUNTIME_TOKEN_MESSAGE);
2072
+ return token;
2073
+ }
2063
2074
  // Annotate the CommonJS export names for ESM import in node:
2064
2075
  0 && (module.exports = {
2065
2076
  AUDIO_TAGS,
@@ -2100,6 +2111,7 @@ var ShogoLiveClient = class {
2100
2111
  VOICE_STS_MODEL_IDS,
2101
2112
  VOICE_TTS_MODELS,
2102
2113
  VOICE_TTS_MODEL_IDS,
2114
+ WORKSPACE_RUNTIME_TOKEN_MESSAGE,
2103
2115
  buildPreviewLine,
2104
2116
  composeAgentPrompt,
2105
2117
  composeExpressivityBlock,
@@ -2116,6 +2128,7 @@ var ShogoLiveClient = class {
2116
2128
  parseVoiceOpJsonBody,
2117
2129
  readAudioTags,
2118
2130
  readExpressivity,
2131
+ readRuntimeAuthSecret,
2119
2132
  readVoiceSettings,
2120
2133
  resolveConvaiTtsModel,
2121
2134
  resolveConvaiTtsModelDetailed,
package/dist/index.d.cts CHANGED
@@ -799,4 +799,27 @@ declare class MockTelephonyClient implements TelephonyClient {
799
799
  */
800
800
  declare function isVoiceMockEnv(): boolean;
801
801
 
802
- export { type AvailableNumber, type ComposeAgentPromptOptions, type CreateTelephonyOptions, DEFAULT_MEMORY_BLOCK, DEFAULT_TWILIO_BASE_URL, DirectTelephonyClient, type DirectTelephonyOptions, Expressivity, HostedRuntimeTokenClient, type HostedRuntimeTokenOptions, HostedTelephonyClient, type HostedTelephonyOptions, type IncomingNumber, MockTelephonyClient, type OutboundCallOptions, type OutboundCallResult, type ProvisionNumberOptions, type ProvisionNumberResult, type ReleaseNumberResult, TelephonyApiError, type TelephonyClient, TelephonyConfigError, TwilioApiError, TwilioClient, type TwilioClientConfig, VOICE_OPS, VOICE_OP_IDS, type VoiceOp, type VoiceOpCost, type VoiceOpCostUnit, type VoiceOpId, type VoiceOpPermission, type VoiceOpTransport, type VoiceUsageRange, type VoiceUsageSummary, composeAgentPrompt, createTelephonyClient, extractBasePrompt, getVoiceOp, isVoiceMockEnv, parseVoiceOpForm, parseVoiceOpJsonBody, stripMemoryBlock, voiceOpCredentialError, voiceOpForwardPath, voiceOpIsMultipart, voiceOpPathParams, voiceOpReturnsAudio, voiceOpUpstreamBody, voiceOpUpstreamPath };
802
+ /**
803
+ * The one reader for `RUNTIME_AUTH_SECRET` in the SDK and `@shogo-ai/voice`.
804
+ *
805
+ * A Shogo-managed pod injects its **project** token (`rt_v1_<projectId>_<hmac>`)
806
+ * there, and every SDK surface (LLM gateway, voice/music, TTS, tools) uses it
807
+ * as the credential for that one project.
808
+ *
809
+ * A **workspace** runtime is different: its own `RUNTIME_AUTH_SECRET` is the
810
+ * workspace token (`wrt_v1_<workspaceId>_<hmac>`), which the API accepts on the
811
+ * Git LFS routes only. Code that inherits it — an app server started from a
812
+ * workspace shell, an MCP server, a build — used to send it and get a bare 401
813
+ * from every SDK call. Say that plainly instead: the fix is to run the app
814
+ * through the preview, which swaps in the project token.
815
+ */
816
+ /** Thrown when app code picks up a workspace runtime token instead of its project's. */
817
+ declare const WORKSPACE_RUNTIME_TOKEN_MESSAGE: string;
818
+ /**
819
+ * `RUNTIME_AUTH_SECRET` from `env`, or undefined when unset. Throws when it is
820
+ * a workspace token: no SDK call can succeed with one, so failing here beats a
821
+ * 401 several layers down.
822
+ */
823
+ declare function readRuntimeAuthSecret(env?: NodeJS.ProcessEnv | undefined): string | undefined;
824
+
825
+ export { type AvailableNumber, type ComposeAgentPromptOptions, type CreateTelephonyOptions, DEFAULT_MEMORY_BLOCK, DEFAULT_TWILIO_BASE_URL, DirectTelephonyClient, type DirectTelephonyOptions, Expressivity, HostedRuntimeTokenClient, type HostedRuntimeTokenOptions, HostedTelephonyClient, type HostedTelephonyOptions, type IncomingNumber, MockTelephonyClient, type OutboundCallOptions, type OutboundCallResult, type ProvisionNumberOptions, type ProvisionNumberResult, type ReleaseNumberResult, TelephonyApiError, type TelephonyClient, TelephonyConfigError, TwilioApiError, TwilioClient, type TwilioClientConfig, VOICE_OPS, VOICE_OP_IDS, type VoiceOp, type VoiceOpCost, type VoiceOpCostUnit, type VoiceOpId, type VoiceOpPermission, type VoiceOpTransport, type VoiceUsageRange, type VoiceUsageSummary, WORKSPACE_RUNTIME_TOKEN_MESSAGE, composeAgentPrompt, createTelephonyClient, extractBasePrompt, getVoiceOp, isVoiceMockEnv, parseVoiceOpForm, parseVoiceOpJsonBody, readRuntimeAuthSecret, stripMemoryBlock, voiceOpCredentialError, voiceOpForwardPath, voiceOpIsMultipart, voiceOpPathParams, voiceOpReturnsAudio, voiceOpUpstreamBody, voiceOpUpstreamPath };
package/dist/index.d.ts CHANGED
@@ -799,4 +799,27 @@ declare class MockTelephonyClient implements TelephonyClient {
799
799
  */
800
800
  declare function isVoiceMockEnv(): boolean;
801
801
 
802
- export { type AvailableNumber, type ComposeAgentPromptOptions, type CreateTelephonyOptions, DEFAULT_MEMORY_BLOCK, DEFAULT_TWILIO_BASE_URL, DirectTelephonyClient, type DirectTelephonyOptions, Expressivity, HostedRuntimeTokenClient, type HostedRuntimeTokenOptions, HostedTelephonyClient, type HostedTelephonyOptions, type IncomingNumber, MockTelephonyClient, type OutboundCallOptions, type OutboundCallResult, type ProvisionNumberOptions, type ProvisionNumberResult, type ReleaseNumberResult, TelephonyApiError, type TelephonyClient, TelephonyConfigError, TwilioApiError, TwilioClient, type TwilioClientConfig, VOICE_OPS, VOICE_OP_IDS, type VoiceOp, type VoiceOpCost, type VoiceOpCostUnit, type VoiceOpId, type VoiceOpPermission, type VoiceOpTransport, type VoiceUsageRange, type VoiceUsageSummary, composeAgentPrompt, createTelephonyClient, extractBasePrompt, getVoiceOp, isVoiceMockEnv, parseVoiceOpForm, parseVoiceOpJsonBody, stripMemoryBlock, voiceOpCredentialError, voiceOpForwardPath, voiceOpIsMultipart, voiceOpPathParams, voiceOpReturnsAudio, voiceOpUpstreamBody, voiceOpUpstreamPath };
802
+ /**
803
+ * The one reader for `RUNTIME_AUTH_SECRET` in the SDK and `@shogo-ai/voice`.
804
+ *
805
+ * A Shogo-managed pod injects its **project** token (`rt_v1_<projectId>_<hmac>`)
806
+ * there, and every SDK surface (LLM gateway, voice/music, TTS, tools) uses it
807
+ * as the credential for that one project.
808
+ *
809
+ * A **workspace** runtime is different: its own `RUNTIME_AUTH_SECRET` is the
810
+ * workspace token (`wrt_v1_<workspaceId>_<hmac>`), which the API accepts on the
811
+ * Git LFS routes only. Code that inherits it — an app server started from a
812
+ * workspace shell, an MCP server, a build — used to send it and get a bare 401
813
+ * from every SDK call. Say that plainly instead: the fix is to run the app
814
+ * through the preview, which swaps in the project token.
815
+ */
816
+ /** Thrown when app code picks up a workspace runtime token instead of its project's. */
817
+ declare const WORKSPACE_RUNTIME_TOKEN_MESSAGE: string;
818
+ /**
819
+ * `RUNTIME_AUTH_SECRET` from `env`, or undefined when unset. Throws when it is
820
+ * a workspace token: no SDK call can succeed with one, so failing here beats a
821
+ * 401 several layers down.
822
+ */
823
+ declare function readRuntimeAuthSecret(env?: NodeJS.ProcessEnv | undefined): string | undefined;
824
+
825
+ export { type AvailableNumber, type ComposeAgentPromptOptions, type CreateTelephonyOptions, DEFAULT_MEMORY_BLOCK, DEFAULT_TWILIO_BASE_URL, DirectTelephonyClient, type DirectTelephonyOptions, Expressivity, HostedRuntimeTokenClient, type HostedRuntimeTokenOptions, HostedTelephonyClient, type HostedTelephonyOptions, type IncomingNumber, MockTelephonyClient, type OutboundCallOptions, type OutboundCallResult, type ProvisionNumberOptions, type ProvisionNumberResult, type ReleaseNumberResult, TelephonyApiError, type TelephonyClient, TelephonyConfigError, TwilioApiError, TwilioClient, type TwilioClientConfig, VOICE_OPS, VOICE_OP_IDS, type VoiceOp, type VoiceOpCost, type VoiceOpCostUnit, type VoiceOpId, type VoiceOpPermission, type VoiceOpTransport, type VoiceUsageRange, type VoiceUsageSummary, WORKSPACE_RUNTIME_TOKEN_MESSAGE, composeAgentPrompt, createTelephonyClient, extractBasePrompt, getVoiceOp, isVoiceMockEnv, parseVoiceOpForm, parseVoiceOpJsonBody, readRuntimeAuthSecret, stripMemoryBlock, voiceOpCredentialError, voiceOpForwardPath, voiceOpIsMultipart, voiceOpPathParams, voiceOpReturnsAudio, voiceOpUpstreamBody, voiceOpUpstreamPath };
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ import {
23
23
  VOICE_STS_MODEL_IDS,
24
24
  VOICE_TTS_MODELS,
25
25
  VOICE_TTS_MODEL_IDS,
26
+ WORKSPACE_RUNTIME_TOKEN_MESSAGE,
26
27
  composeAgentPrompt,
27
28
  extractBasePrompt,
28
29
  getVoiceOp,
@@ -30,6 +31,7 @@ import {
30
31
  isModelRelatedTtsFailure,
31
32
  parseVoiceOpForm,
32
33
  parseVoiceOpJsonBody,
34
+ readRuntimeAuthSecret,
33
35
  resolveConvaiTtsModel,
34
36
  resolveConvaiTtsModelDetailed,
35
37
  stripMemoryBlock,
@@ -40,7 +42,7 @@ import {
40
42
  voiceOpReturnsAudio,
41
43
  voiceOpUpstreamBody,
42
44
  voiceOpUpstreamPath
43
- } from "./chunk-XE4LLC7Z.js";
45
+ } from "./chunk-IOFWML5L.js";
44
46
  import {
45
47
  AUDIO_TAGS,
46
48
  AUDIO_TAG_GROUPS,
@@ -760,6 +762,7 @@ export {
760
762
  VOICE_STS_MODEL_IDS,
761
763
  VOICE_TTS_MODELS,
762
764
  VOICE_TTS_MODEL_IDS,
765
+ WORKSPACE_RUNTIME_TOKEN_MESSAGE,
763
766
  buildPreviewLine,
764
767
  composeAgentPrompt,
765
768
  composeExpressivityBlock,
@@ -776,6 +779,7 @@ export {
776
779
  parseVoiceOpJsonBody,
777
780
  readAudioTags,
778
781
  readExpressivity,
782
+ readRuntimeAuthSecret,
779
783
  readVoiceSettings,
780
784
  resolveConvaiTtsModel,
781
785
  resolveConvaiTtsModelDetailed,
@@ -1173,6 +1173,15 @@ function checkVoiceOpModel(op, fields) {
1173
1173
  return { ok: true };
1174
1174
  }
1175
1175
 
1176
+ // src/runtime-token.ts
1177
+ var WORKSPACE_RUNTIME_TOKEN_MESSAGE = "RUNTIME_AUTH_SECRET is the workspace runtime token; app code needs its project token (rt_v1_\u2026). Start the app through the preview (server_sync / restart), not from a workspace shell.";
1178
+ function readRuntimeAuthSecret(env = typeof process === "undefined" ? void 0 : process.env) {
1179
+ const token = env?.RUNTIME_AUTH_SECRET;
1180
+ if (!token) return void 0;
1181
+ if (token.startsWith("wrt_v1_")) throw new Error(WORKSPACE_RUNTIME_TOKEN_MESSAGE);
1182
+ return token;
1183
+ }
1184
+
1176
1185
  // src/server.ts
1177
1186
  function json(data, status = 200, extraHeaders = {}) {
1178
1187
  return new Response(JSON.stringify(data), {
@@ -1232,7 +1241,7 @@ function resolveProxyOptions(config) {
1232
1241
  LOG_WARN_CACHE.apiKeyIgnored(config.logger);
1233
1242
  }
1234
1243
  if (typeof process === "undefined" || !process.env) return null;
1235
- const runtimeToken = process.env.RUNTIME_AUTH_SECRET;
1244
+ const runtimeToken = readRuntimeAuthSecret();
1236
1245
  const projectId = process.env.PROJECT_ID;
1237
1246
  if (!runtimeToken || !projectId) return null;
1238
1247
  return {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  defaultHandlers
3
- } from "../chunk-UH75UVM2.js";
4
- import "../chunk-CLF25CZC.js";
5
- import "../chunk-XE4LLC7Z.js";
3
+ } from "../chunk-RALZRMFL.js";
4
+ import "../chunk-U5UC7ZVS.js";
5
+ import "../chunk-IOFWML5L.js";
6
6
  import "../chunk-Q3TJAJ54.js";
7
7
 
8
8
  // src/route/agent.ts
@@ -1171,6 +1171,15 @@ function checkVoiceOpModel(op, fields) {
1171
1171
  return { ok: true };
1172
1172
  }
1173
1173
 
1174
+ // src/runtime-token.ts
1175
+ var WORKSPACE_RUNTIME_TOKEN_MESSAGE = "RUNTIME_AUTH_SECRET is the workspace runtime token; app code needs its project token (rt_v1_\u2026). Start the app through the preview (server_sync / restart), not from a workspace shell.";
1176
+ function readRuntimeAuthSecret(env = typeof process === "undefined" ? void 0 : process.env) {
1177
+ const token = env?.RUNTIME_AUTH_SECRET;
1178
+ if (!token) return void 0;
1179
+ if (token.startsWith("wrt_v1_")) throw new Error(WORKSPACE_RUNTIME_TOKEN_MESSAGE);
1180
+ return token;
1181
+ }
1182
+
1174
1183
  // src/server.ts
1175
1184
  function json(data, status = 200, extraHeaders = {}) {
1176
1185
  return new Response(JSON.stringify(data), {
@@ -1230,7 +1239,7 @@ function resolveProxyOptions(config) {
1230
1239
  LOG_WARN_CACHE.apiKeyIgnored(config.logger);
1231
1240
  }
1232
1241
  if (typeof process === "undefined" || !process.env) return null;
1233
- const runtimeToken = process.env.RUNTIME_AUTH_SECRET;
1242
+ const runtimeToken = readRuntimeAuthSecret();
1234
1243
  const projectId = process.env.PROJECT_ID;
1235
1244
  if (!runtimeToken || !projectId) return null;
1236
1245
  return {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  defaultHandlers
3
- } from "../chunk-UH75UVM2.js";
4
- import "../chunk-CLF25CZC.js";
5
- import "../chunk-XE4LLC7Z.js";
3
+ } from "../chunk-RALZRMFL.js";
4
+ import "../chunk-U5UC7ZVS.js";
5
+ import "../chunk-IOFWML5L.js";
6
6
  import "../chunk-Q3TJAJ54.js";
7
7
 
8
8
  // src/route/audio-tags.ts
@@ -1172,6 +1172,15 @@ function checkVoiceOpModel(op, fields) {
1172
1172
  return { ok: true };
1173
1173
  }
1174
1174
 
1175
+ // src/runtime-token.ts
1176
+ var WORKSPACE_RUNTIME_TOKEN_MESSAGE = "RUNTIME_AUTH_SECRET is the workspace runtime token; app code needs its project token (rt_v1_\u2026). Start the app through the preview (server_sync / restart), not from a workspace shell.";
1177
+ function readRuntimeAuthSecret(env = typeof process === "undefined" ? void 0 : process.env) {
1178
+ const token = env?.RUNTIME_AUTH_SECRET;
1179
+ if (!token) return void 0;
1180
+ if (token.startsWith("wrt_v1_")) throw new Error(WORKSPACE_RUNTIME_TOKEN_MESSAGE);
1181
+ return token;
1182
+ }
1183
+
1175
1184
  // src/server.ts
1176
1185
  function json(data, status = 200, extraHeaders = {}) {
1177
1186
  return new Response(JSON.stringify(data), {
@@ -1231,7 +1240,7 @@ function resolveProxyOptions(config) {
1231
1240
  LOG_WARN_CACHE.apiKeyIgnored(config.logger);
1232
1241
  }
1233
1242
  if (typeof process === "undefined" || !process.env) return null;
1234
- const runtimeToken = process.env.RUNTIME_AUTH_SECRET;
1243
+ const runtimeToken = readRuntimeAuthSecret();
1235
1244
  const projectId = process.env.PROJECT_ID;
1236
1245
  if (!runtimeToken || !projectId) return null;
1237
1246
  return {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createVoiceRoute,
3
3
  defaultHandlers
4
- } from "../chunk-UH75UVM2.js";
5
- import "../chunk-CLF25CZC.js";
6
- import "../chunk-XE4LLC7Z.js";
4
+ } from "../chunk-RALZRMFL.js";
5
+ import "../chunk-U5UC7ZVS.js";
6
+ import "../chunk-IOFWML5L.js";
7
7
  import "../chunk-Q3TJAJ54.js";
8
8
  export {
9
9
  createVoiceRoute,
@@ -1171,6 +1171,15 @@ function checkVoiceOpModel(op, fields) {
1171
1171
  return { ok: true };
1172
1172
  }
1173
1173
 
1174
+ // src/runtime-token.ts
1175
+ var WORKSPACE_RUNTIME_TOKEN_MESSAGE = "RUNTIME_AUTH_SECRET is the workspace runtime token; app code needs its project token (rt_v1_\u2026). Start the app through the preview (server_sync / restart), not from a workspace shell.";
1176
+ function readRuntimeAuthSecret(env = typeof process === "undefined" ? void 0 : process.env) {
1177
+ const token = env?.RUNTIME_AUTH_SECRET;
1178
+ if (!token) return void 0;
1179
+ if (token.startsWith("wrt_v1_")) throw new Error(WORKSPACE_RUNTIME_TOKEN_MESSAGE);
1180
+ return token;
1181
+ }
1182
+
1174
1183
  // src/server.ts
1175
1184
  function json(data, status = 200, extraHeaders = {}) {
1176
1185
  return new Response(JSON.stringify(data), {
@@ -1230,7 +1239,7 @@ function resolveProxyOptions(config) {
1230
1239
  LOG_WARN_CACHE.apiKeyIgnored(config.logger);
1231
1240
  }
1232
1241
  if (typeof process === "undefined" || !process.env) return null;
1233
- const runtimeToken = process.env.RUNTIME_AUTH_SECRET;
1242
+ const runtimeToken = readRuntimeAuthSecret();
1234
1243
  const projectId = process.env.PROJECT_ID;
1235
1244
  if (!runtimeToken || !projectId) return null;
1236
1245
  return {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  defaultHandlers
3
- } from "../chunk-UH75UVM2.js";
4
- import "../chunk-CLF25CZC.js";
5
- import "../chunk-XE4LLC7Z.js";
3
+ } from "../chunk-RALZRMFL.js";
4
+ import "../chunk-U5UC7ZVS.js";
5
+ import "../chunk-IOFWML5L.js";
6
6
  import "../chunk-Q3TJAJ54.js";
7
7
 
8
8
  // src/route/music.ts
package/dist/route/op.cjs CHANGED
@@ -1173,6 +1173,15 @@ function checkVoiceOpModel(op, fields) {
1173
1173
  return { ok: true };
1174
1174
  }
1175
1175
 
1176
+ // src/runtime-token.ts
1177
+ var WORKSPACE_RUNTIME_TOKEN_MESSAGE = "RUNTIME_AUTH_SECRET is the workspace runtime token; app code needs its project token (rt_v1_\u2026). Start the app through the preview (server_sync / restart), not from a workspace shell.";
1178
+ function readRuntimeAuthSecret(env = typeof process === "undefined" ? void 0 : process.env) {
1179
+ const token = env?.RUNTIME_AUTH_SECRET;
1180
+ if (!token) return void 0;
1181
+ if (token.startsWith("wrt_v1_")) throw new Error(WORKSPACE_RUNTIME_TOKEN_MESSAGE);
1182
+ return token;
1183
+ }
1184
+
1176
1185
  // src/server.ts
1177
1186
  function json(data, status = 200, extraHeaders = {}) {
1178
1187
  return new Response(JSON.stringify(data), {
@@ -1232,7 +1241,7 @@ function resolveProxyOptions(config) {
1232
1241
  LOG_WARN_CACHE.apiKeyIgnored(config.logger);
1233
1242
  }
1234
1243
  if (typeof process === "undefined" || !process.env) return null;
1235
- const runtimeToken = process.env.RUNTIME_AUTH_SECRET;
1244
+ const runtimeToken = readRuntimeAuthSecret();
1236
1245
  const projectId = process.env.PROJECT_ID;
1237
1246
  if (!runtimeToken || !projectId) return null;
1238
1247
  return {
package/dist/route/op.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  defaultHandlers
3
- } from "../chunk-UH75UVM2.js";
4
- import "../chunk-CLF25CZC.js";
3
+ } from "../chunk-RALZRMFL.js";
4
+ import "../chunk-U5UC7ZVS.js";
5
5
  import {
6
6
  VOICE_OPS
7
- } from "../chunk-XE4LLC7Z.js";
7
+ } from "../chunk-IOFWML5L.js";
8
8
  import "../chunk-Q3TJAJ54.js";
9
9
 
10
10
  // src/route/op.ts
@@ -1171,6 +1171,15 @@ function checkVoiceOpModel(op, fields) {
1171
1171
  return { ok: true };
1172
1172
  }
1173
1173
 
1174
+ // src/runtime-token.ts
1175
+ var WORKSPACE_RUNTIME_TOKEN_MESSAGE = "RUNTIME_AUTH_SECRET is the workspace runtime token; app code needs its project token (rt_v1_\u2026). Start the app through the preview (server_sync / restart), not from a workspace shell.";
1176
+ function readRuntimeAuthSecret(env = typeof process === "undefined" ? void 0 : process.env) {
1177
+ const token = env?.RUNTIME_AUTH_SECRET;
1178
+ if (!token) return void 0;
1179
+ if (token.startsWith("wrt_v1_")) throw new Error(WORKSPACE_RUNTIME_TOKEN_MESSAGE);
1180
+ return token;
1181
+ }
1182
+
1174
1183
  // src/server.ts
1175
1184
  function json(data, status = 200, extraHeaders = {}) {
1176
1185
  return new Response(JSON.stringify(data), {
@@ -1230,7 +1239,7 @@ function resolveProxyOptions(config) {
1230
1239
  LOG_WARN_CACHE.apiKeyIgnored(config.logger);
1231
1240
  }
1232
1241
  if (typeof process === "undefined" || !process.env) return null;
1233
- const runtimeToken = process.env.RUNTIME_AUTH_SECRET;
1242
+ const runtimeToken = readRuntimeAuthSecret();
1234
1243
  const projectId = process.env.PROJECT_ID;
1235
1244
  if (!runtimeToken || !projectId) return null;
1236
1245
  return {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  defaultHandlers
3
- } from "../chunk-UH75UVM2.js";
4
- import "../chunk-CLF25CZC.js";
5
- import "../chunk-XE4LLC7Z.js";
3
+ } from "../chunk-RALZRMFL.js";
4
+ import "../chunk-U5UC7ZVS.js";
5
+ import "../chunk-IOFWML5L.js";
6
6
  import "../chunk-Q3TJAJ54.js";
7
7
 
8
8
  // src/route/signed-url.ts
@@ -1171,6 +1171,15 @@ function checkVoiceOpModel(op, fields) {
1171
1171
  return { ok: true };
1172
1172
  }
1173
1173
 
1174
+ // src/runtime-token.ts
1175
+ var WORKSPACE_RUNTIME_TOKEN_MESSAGE = "RUNTIME_AUTH_SECRET is the workspace runtime token; app code needs its project token (rt_v1_\u2026). Start the app through the preview (server_sync / restart), not from a workspace shell.";
1176
+ function readRuntimeAuthSecret(env = typeof process === "undefined" ? void 0 : process.env) {
1177
+ const token = env?.RUNTIME_AUTH_SECRET;
1178
+ if (!token) return void 0;
1179
+ if (token.startsWith("wrt_v1_")) throw new Error(WORKSPACE_RUNTIME_TOKEN_MESSAGE);
1180
+ return token;
1181
+ }
1182
+
1174
1183
  // src/server.ts
1175
1184
  function json(data, status = 200, extraHeaders = {}) {
1176
1185
  return new Response(JSON.stringify(data), {
@@ -1230,7 +1239,7 @@ function resolveProxyOptions(config) {
1230
1239
  LOG_WARN_CACHE.apiKeyIgnored(config.logger);
1231
1240
  }
1232
1241
  if (typeof process === "undefined" || !process.env) return null;
1233
- const runtimeToken = process.env.RUNTIME_AUTH_SECRET;
1242
+ const runtimeToken = readRuntimeAuthSecret();
1234
1243
  const projectId = process.env.PROJECT_ID;
1235
1244
  if (!runtimeToken || !projectId) return null;
1236
1245
  return {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  defaultHandlers
3
- } from "../chunk-UH75UVM2.js";
4
- import "../chunk-CLF25CZC.js";
5
- import "../chunk-XE4LLC7Z.js";
3
+ } from "../chunk-RALZRMFL.js";
4
+ import "../chunk-U5UC7ZVS.js";
5
+ import "../chunk-IOFWML5L.js";
6
6
  import "../chunk-Q3TJAJ54.js";
7
7
 
8
8
  // src/route/tts-preview.ts
package/dist/server.cjs CHANGED
@@ -1172,6 +1172,15 @@ function checkVoiceOpModel(op, fields) {
1172
1172
  return { ok: true };
1173
1173
  }
1174
1174
 
1175
+ // src/runtime-token.ts
1176
+ var WORKSPACE_RUNTIME_TOKEN_MESSAGE = "RUNTIME_AUTH_SECRET is the workspace runtime token; app code needs its project token (rt_v1_\u2026). Start the app through the preview (server_sync / restart), not from a workspace shell.";
1177
+ function readRuntimeAuthSecret(env = typeof process === "undefined" ? void 0 : process.env) {
1178
+ const token = env?.RUNTIME_AUTH_SECRET;
1179
+ if (!token) return void 0;
1180
+ if (token.startsWith("wrt_v1_")) throw new Error(WORKSPACE_RUNTIME_TOKEN_MESSAGE);
1181
+ return token;
1182
+ }
1183
+
1175
1184
  // src/server.ts
1176
1185
  function json(data, status = 200, extraHeaders = {}) {
1177
1186
  return new Response(JSON.stringify(data), {
@@ -1231,7 +1240,7 @@ function resolveProxyOptions(config) {
1231
1240
  LOG_WARN_CACHE.apiKeyIgnored(config.logger);
1232
1241
  }
1233
1242
  if (typeof process === "undefined" || !process.env) return null;
1234
- const runtimeToken = process.env.RUNTIME_AUTH_SECRET;
1243
+ const runtimeToken = readRuntimeAuthSecret();
1235
1244
  const projectId = process.env.PROJECT_ID;
1236
1245
  if (!runtimeToken || !projectId) return null;
1237
1246
  return {
package/dist/server.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createVoiceHandlers,
3
3
  toNodeListener
4
- } from "./chunk-CLF25CZC.js";
5
- import "./chunk-XE4LLC7Z.js";
4
+ } from "./chunk-U5UC7ZVS.js";
5
+ import "./chunk-IOFWML5L.js";
6
6
  import "./chunk-Q3TJAJ54.js";
7
7
  export {
8
8
  createVoiceHandlers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shogo-ai/voice",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "description": "Shogo Voice — ElevenLabs/Twilio voice agent infrastructure with React + React Native UI primitives.",
5
5
  "license": "MIT",
6
6
  "type": "module",