@inworld/cli 1.0.0-rc.1 → 1.0.0-rc.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.
Files changed (249) hide show
  1. package/README.md +1 -1
  2. package/dist/cli/inworld-mcp.js +64765 -0
  3. package/dist/index.js +71700 -3570
  4. package/package.json +17 -13
  5. package/dist/package.json +0 -53
  6. package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.d.ts +0 -10
  7. package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.d.ts.map +0 -1
  8. package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.js +0 -15
  9. package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.js.map +0 -1
  10. package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.d.ts +0 -13
  11. package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.d.ts.map +0 -1
  12. package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.js +0 -2
  13. package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.js.map +0 -1
  14. package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.d.ts +0 -7
  15. package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.d.ts.map +0 -1
  16. package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.js +0 -14
  17. package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.js.map +0 -1
  18. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.d.ts +0 -14
  19. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.d.ts.map +0 -1
  20. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.js +0 -6
  21. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.js.map +0 -1
  22. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.d.ts +0 -116
  23. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.d.ts.map +0 -1
  24. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.js +0 -71
  25. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.js.map +0 -1
  26. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.d.ts +0 -14
  27. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.d.ts.map +0 -1
  28. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.js +0 -6
  29. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.js.map +0 -1
  30. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.d.ts +0 -78
  31. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.d.ts.map +0 -1
  32. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.js +0 -39
  33. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.js.map +0 -1
  34. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.d.ts +0 -10
  35. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.d.ts.map +0 -1
  36. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.js +0 -6
  37. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.js.map +0 -1
  38. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.d.ts +0 -7
  39. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.d.ts.map +0 -1
  40. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.js +0 -12
  41. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.js.map +0 -1
  42. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.d.ts +0 -115
  43. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.d.ts.map +0 -1
  44. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.js +0 -85
  45. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.js.map +0 -1
  46. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.d.ts +0 -255
  47. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.d.ts.map +0 -1
  48. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.js +0 -87
  49. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.js.map +0 -1
  50. package/dist/proto/generated/portal/fetch.pb.d.ts +0 -26
  51. package/dist/proto/generated/portal/fetch.pb.d.ts.map +0 -1
  52. package/dist/proto/generated/portal/fetch.pb.js +0 -274
  53. package/dist/proto/generated/portal/fetch.pb.js.map +0 -1
  54. package/dist/src/auth/callback_server.d.ts +0 -41
  55. package/dist/src/auth/callback_server.d.ts.map +0 -1
  56. package/dist/src/auth/callback_server.js +0 -136
  57. package/dist/src/auth/callback_server.js.map +0 -1
  58. package/dist/src/auth/manager.d.ts +0 -97
  59. package/dist/src/auth/manager.d.ts.map +0 -1
  60. package/dist/src/auth/manager.js +0 -338
  61. package/dist/src/auth/manager.js.map +0 -1
  62. package/dist/src/auth/utils.d.ts +0 -45
  63. package/dist/src/auth/utils.d.ts.map +0 -1
  64. package/dist/src/auth/utils.js +0 -183
  65. package/dist/src/auth/utils.js.map +0 -1
  66. package/dist/src/commands/auth/disable_telemetry_command.d.ts +0 -3
  67. package/dist/src/commands/auth/disable_telemetry_command.d.ts.map +0 -1
  68. package/dist/src/commands/auth/disable_telemetry_command.js +0 -21
  69. package/dist/src/commands/auth/disable_telemetry_command.js.map +0 -1
  70. package/dist/src/commands/auth/enable_telemetry_command.d.ts +0 -3
  71. package/dist/src/commands/auth/enable_telemetry_command.d.ts.map +0 -1
  72. package/dist/src/commands/auth/enable_telemetry_command.js +0 -22
  73. package/dist/src/commands/auth/enable_telemetry_command.js.map +0 -1
  74. package/dist/src/commands/auth/login_ci_command.d.ts +0 -3
  75. package/dist/src/commands/auth/login_ci_command.d.ts.map +0 -1
  76. package/dist/src/commands/auth/login_ci_command.js +0 -41
  77. package/dist/src/commands/auth/login_ci_command.js.map +0 -1
  78. package/dist/src/commands/auth/login_command.d.ts +0 -4
  79. package/dist/src/commands/auth/login_command.d.ts.map +0 -1
  80. package/dist/src/commands/auth/login_command.js +0 -134
  81. package/dist/src/commands/auth/login_command.js.map +0 -1
  82. package/dist/src/commands/auth/logout_command.d.ts +0 -4
  83. package/dist/src/commands/auth/logout_command.d.ts.map +0 -1
  84. package/dist/src/commands/auth/logout_command.js +0 -54
  85. package/dist/src/commands/auth/logout_command.js.map +0 -1
  86. package/dist/src/commands/auth/print_access_token_command.d.ts +0 -3
  87. package/dist/src/commands/auth/print_access_token_command.d.ts.map +0 -1
  88. package/dist/src/commands/auth/print_access_token_command.js +0 -21
  89. package/dist/src/commands/auth/print_access_token_command.js.map +0 -1
  90. package/dist/src/commands/auth/print_api_key_command.d.ts +0 -3
  91. package/dist/src/commands/auth/print_api_key_command.d.ts.map +0 -1
  92. package/dist/src/commands/auth/print_api_key_command.js +0 -26
  93. package/dist/src/commands/auth/print_api_key_command.js.map +0 -1
  94. package/dist/src/commands/auth/status_command.d.ts +0 -4
  95. package/dist/src/commands/auth/status_command.d.ts.map +0 -1
  96. package/dist/src/commands/auth/status_command.js +0 -84
  97. package/dist/src/commands/auth/status_command.js.map +0 -1
  98. package/dist/src/commands/auth_command.d.ts +0 -3
  99. package/dist/src/commands/auth_command.d.ts.map +0 -1
  100. package/dist/src/commands/auth_command.js +0 -24
  101. package/dist/src/commands/auth_command.js.map +0 -1
  102. package/dist/src/commands/graph/graph_deploy_command.d.ts +0 -24
  103. package/dist/src/commands/graph/graph_deploy_command.d.ts.map +0 -1
  104. package/dist/src/commands/graph/graph_deploy_command.js +0 -204
  105. package/dist/src/commands/graph/graph_deploy_command.js.map +0 -1
  106. package/dist/src/commands/graph/graph_init_command.d.ts +0 -4
  107. package/dist/src/commands/graph/graph_init_command.d.ts.map +0 -1
  108. package/dist/src/commands/graph/graph_init_command.js +0 -335
  109. package/dist/src/commands/graph/graph_init_command.js.map +0 -1
  110. package/dist/src/commands/graph/graph_run_command.d.ts +0 -24
  111. package/dist/src/commands/graph/graph_run_command.d.ts.map +0 -1
  112. package/dist/src/commands/graph/graph_run_command.js +0 -50
  113. package/dist/src/commands/graph/graph_run_command.js.map +0 -1
  114. package/dist/src/commands/graph/graph_serve_command.d.ts +0 -4
  115. package/dist/src/commands/graph/graph_serve_command.d.ts.map +0 -1
  116. package/dist/src/commands/graph/graph_serve_command.js +0 -40
  117. package/dist/src/commands/graph/graph_serve_command.js.map +0 -1
  118. package/dist/src/commands/graph/graph_variant_command.d.ts +0 -3
  119. package/dist/src/commands/graph/graph_variant_command.d.ts.map +0 -1
  120. package/dist/src/commands/graph/graph_variant_command.js +0 -13
  121. package/dist/src/commands/graph/graph_variant_command.js.map +0 -1
  122. package/dist/src/commands/graph/graph_visualize_command.d.ts +0 -7
  123. package/dist/src/commands/graph/graph_visualize_command.d.ts.map +0 -1
  124. package/dist/src/commands/graph/graph_visualize_command.js +0 -35
  125. package/dist/src/commands/graph/graph_visualize_command.js.map +0 -1
  126. package/dist/src/commands/graph/variant/graph_variant_list_command.d.ts +0 -3
  127. package/dist/src/commands/graph/variant/graph_variant_list_command.d.ts.map +0 -1
  128. package/dist/src/commands/graph/variant/graph_variant_list_command.js +0 -26
  129. package/dist/src/commands/graph/variant/graph_variant_list_command.js.map +0 -1
  130. package/dist/src/commands/graph/variant/graph_variant_print_command.d.ts +0 -7
  131. package/dist/src/commands/graph/variant/graph_variant_print_command.d.ts.map +0 -1
  132. package/dist/src/commands/graph/variant/graph_variant_print_command.js +0 -46
  133. package/dist/src/commands/graph/variant/graph_variant_print_command.js.map +0 -1
  134. package/dist/src/commands/graph/variant/graph_variant_register_command.d.ts +0 -3
  135. package/dist/src/commands/graph/variant/graph_variant_register_command.d.ts.map +0 -1
  136. package/dist/src/commands/graph/variant/graph_variant_register_command.js +0 -46
  137. package/dist/src/commands/graph/variant/graph_variant_register_command.js.map +0 -1
  138. package/dist/src/commands/graph_command.d.ts +0 -3
  139. package/dist/src/commands/graph_command.d.ts.map +0 -1
  140. package/dist/src/commands/graph_command.js +0 -20
  141. package/dist/src/commands/graph_command.js.map +0 -1
  142. package/dist/src/commands/tts/tts_clone_command.d.ts +0 -6
  143. package/dist/src/commands/tts/tts_clone_command.d.ts.map +0 -1
  144. package/dist/src/commands/tts/tts_clone_command.js +0 -80
  145. package/dist/src/commands/tts/tts_clone_command.js.map +0 -1
  146. package/dist/src/commands/tts/tts_design_command.d.ts +0 -6
  147. package/dist/src/commands/tts/tts_design_command.d.ts.map +0 -1
  148. package/dist/src/commands/tts/tts_design_command.js +0 -216
  149. package/dist/src/commands/tts/tts_design_command.js.map +0 -1
  150. package/dist/src/commands/tts/tts_list_voices_command.d.ts +0 -6
  151. package/dist/src/commands/tts/tts_list_voices_command.d.ts.map +0 -1
  152. package/dist/src/commands/tts/tts_list_voices_command.js +0 -108
  153. package/dist/src/commands/tts/tts_list_voices_command.js.map +0 -1
  154. package/dist/src/commands/tts/tts_synthesize_command.d.ts +0 -6
  155. package/dist/src/commands/tts/tts_synthesize_command.d.ts.map +0 -1
  156. package/dist/src/commands/tts/tts_synthesize_command.js +0 -351
  157. package/dist/src/commands/tts/tts_synthesize_command.js.map +0 -1
  158. package/dist/src/commands/tts/tts_utils.d.ts +0 -14
  159. package/dist/src/commands/tts/tts_utils.d.ts.map +0 -1
  160. package/dist/src/commands/tts/tts_utils.js +0 -84
  161. package/dist/src/commands/tts/tts_utils.js.map +0 -1
  162. package/dist/src/commands/tts_commands.d.ts +0 -6
  163. package/dist/src/commands/tts_commands.d.ts.map +0 -1
  164. package/dist/src/commands/tts_commands.js +0 -18
  165. package/dist/src/commands/tts_commands.js.map +0 -1
  166. package/dist/src/commands/workspace_command.d.ts +0 -22
  167. package/dist/src/commands/workspace_command.d.ts.map +0 -1
  168. package/dist/src/commands/workspace_command.js +0 -72
  169. package/dist/src/commands/workspace_command.js.map +0 -1
  170. package/dist/src/constants.d.ts +0 -11
  171. package/dist/src/constants.d.ts.map +0 -1
  172. package/dist/src/constants.js +0 -48
  173. package/dist/src/constants.js.map +0 -1
  174. package/dist/src/grpc/core/InworldError.d.ts +0 -30
  175. package/dist/src/grpc/core/InworldError.d.ts.map +0 -1
  176. package/dist/src/grpc/core/InworldError.js +0 -46
  177. package/dist/src/grpc/core/InworldError.js.map +0 -1
  178. package/dist/src/grpc/core/statusCodes.d.ts +0 -122
  179. package/dist/src/grpc/core/statusCodes.d.ts.map +0 -1
  180. package/dist/src/grpc/core/statusCodes.js +0 -133
  181. package/dist/src/grpc/core/statusCodes.js.map +0 -1
  182. package/dist/src/index.d.ts +0 -2
  183. package/dist/src/index.d.ts.map +0 -1
  184. package/dist/src/index.js +0 -139
  185. package/dist/src/index.js.map +0 -1
  186. package/dist/src/services/analytics.d.ts +0 -45
  187. package/dist/src/services/analytics.d.ts.map +0 -1
  188. package/dist/src/services/analytics.js +0 -139
  189. package/dist/src/services/analytics.js.map +0 -1
  190. package/dist/src/services/deploy_service.d.ts +0 -4
  191. package/dist/src/services/deploy_service.d.ts.map +0 -1
  192. package/dist/src/services/deploy_service.js +0 -128
  193. package/dist/src/services/deploy_service.js.map +0 -1
  194. package/dist/src/services/graph_loader.d.ts +0 -7
  195. package/dist/src/services/graph_loader.d.ts.map +0 -1
  196. package/dist/src/services/graph_loader.js +0 -103
  197. package/dist/src/services/graph_loader.js.map +0 -1
  198. package/dist/src/services/graph_variant_service.d.ts +0 -12
  199. package/dist/src/services/graph_variant_service.d.ts.map +0 -1
  200. package/dist/src/services/graph_variant_service.js +0 -66
  201. package/dist/src/services/graph_variant_service.js.map +0 -1
  202. package/dist/src/services/template_service.d.ts +0 -79
  203. package/dist/src/services/template_service.d.ts.map +0 -1
  204. package/dist/src/services/template_service.js +0 -299
  205. package/dist/src/services/template_service.js.map +0 -1
  206. package/dist/src/services/tts_service.d.ts +0 -340
  207. package/dist/src/services/tts_service.d.ts.map +0 -1
  208. package/dist/src/services/tts_service.js +0 -320
  209. package/dist/src/services/tts_service.js.map +0 -1
  210. package/dist/src/services/update_checker.d.ts +0 -37
  211. package/dist/src/services/update_checker.d.ts.map +0 -1
  212. package/dist/src/services/update_checker.js +0 -134
  213. package/dist/src/services/update_checker.js.map +0 -1
  214. package/dist/src/services/workspace_service.d.ts +0 -53
  215. package/dist/src/services/workspace_service.d.ts.map +0 -1
  216. package/dist/src/services/workspace_service.js +0 -324
  217. package/dist/src/services/workspace_service.js.map +0 -1
  218. package/dist/src/utils/array.d.ts +0 -2
  219. package/dist/src/utils/array.d.ts.map +0 -1
  220. package/dist/src/utils/array.js +0 -4
  221. package/dist/src/utils/array.js.map +0 -1
  222. package/dist/src/utils/audio_player.d.ts +0 -10
  223. package/dist/src/utils/audio_player.d.ts.map +0 -1
  224. package/dist/src/utils/audio_player.js +0 -34
  225. package/dist/src/utils/audio_player.js.map +0 -1
  226. package/dist/src/utils/confirm.d.ts +0 -62
  227. package/dist/src/utils/confirm.d.ts.map +0 -1
  228. package/dist/src/utils/confirm.js +0 -90
  229. package/dist/src/utils/confirm.js.map +0 -1
  230. package/dist/src/utils/long_running_operations.d.ts +0 -38
  231. package/dist/src/utils/long_running_operations.d.ts.map +0 -1
  232. package/dist/src/utils/long_running_operations.js +0 -62
  233. package/dist/src/utils/long_running_operations.js.map +0 -1
  234. package/dist/src/utils/resource_name_helper.d.ts +0 -17
  235. package/dist/src/utils/resource_name_helper.d.ts.map +0 -1
  236. package/dist/src/utils/resource_name_helper.js +0 -38
  237. package/dist/src/utils/resource_name_helper.js.map +0 -1
  238. package/dist/src/utils/selector.d.ts +0 -62
  239. package/dist/src/utils/selector.d.ts.map +0 -1
  240. package/dist/src/utils/selector.js +0 -76
  241. package/dist/src/utils/selector.js.map +0 -1
  242. package/dist/src/utils/spinner.d.ts +0 -75
  243. package/dist/src/utils/spinner.d.ts.map +0 -1
  244. package/dist/src/utils/spinner.js +0 -178
  245. package/dist/src/utils/spinner.js.map +0 -1
  246. package/dist/src/utils/ui.d.ts +0 -27
  247. package/dist/src/utils/ui.d.ts.map +0 -1
  248. package/dist/src/utils/ui.js +0 -89
  249. package/dist/src/utils/ui.js.map +0 -1
@@ -1,324 +0,0 @@
1
- import chalk from 'chalk';
2
- import { authManager } from '@/auth/manager';
3
- import { authenticatedInworldRequest } from '@/auth/utils';
4
- import { WORKSPACES_LIST_SIZE } from '@/constants';
5
- import { ApiKeyAuthorizationType, ApiKeys, } from '@/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb';
6
- import { Workspaces } from '@/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb';
7
- import { confirm } from '@/utils/confirm';
8
- import { ensureWorkspaceResourceName, parseWorkspaceResourceName, } from '@/utils/resource_name_helper';
9
- import { selectItemOrExit } from '@/utils/selector';
10
- import * as ui from '@/utils/ui';
11
- /**
12
- * Formats raw API key scopes into human-readable permission labels.
13
- * Only shows design-time scopes (voices, router). Legacy scopes (api.rt, api.ml, api.ops) are hidden.
14
- * e.g. "api.dsgnt.voices::rw(ws=foo)" → "voices:read/write"
15
- * "api.dsgnt.router::r(ws=foo)" → "router:read"
16
- */
17
- function formatApiKeyScopes(scopes) {
18
- if (!scopes?.length)
19
- return '';
20
- const scopeMap = {
21
- 'api.dsgnt.voices': 'voices',
22
- 'api.dsgnt.router': 'router',
23
- };
24
- const accessMap = {
25
- r: 'read',
26
- w: 'write',
27
- rw: 'read/write',
28
- };
29
- const labels = [];
30
- let hasVoices = false;
31
- let hasRouter = false;
32
- for (const scope of scopes) {
33
- const match = scope.match(/^([^:]+)::(\w+)/);
34
- if (!match)
35
- continue;
36
- const [, prefix, access] = match;
37
- const name = scopeMap[prefix];
38
- if (!name)
39
- continue; // skip legacy scopes (api.rt, api.ml, api.ops)
40
- if (name === 'voices')
41
- hasVoices = true;
42
- if (name === 'router')
43
- hasRouter = true;
44
- const accessLabel = accessMap[access] || access;
45
- labels.push(`${name}:${accessLabel}`);
46
- }
47
- // Show read-only fallback for missing scopes
48
- if (!hasVoices)
49
- labels.push('voices:read');
50
- if (!hasRouter)
51
- labels.push('router:read');
52
- return `[${labels.join(', ')}]`;
53
- }
54
- /**
55
- * Service for managing Inworld workspaces and API keys.
56
- * Provides functionality to list, select, and activate workspaces with their associated API keys.
57
- *
58
- * @remarks
59
- * This service handles the authentication flow for workspace activation,
60
- * including API key selection and generation when needed.
61
- */
62
- export class WorkspaceService {
63
- /**
64
- * Prompts user to select a workspace from available workspaces
65
- * @param forceFirst If true, automatically selects the first workspace
66
- * @returns The resource name of the selected workspace
67
- */
68
- static async pickWorkspace(forceFirst = false) {
69
- const listWorkspacesResponse = await authenticatedInworldRequest(Workspaces.ListWorkspaces, {
70
- pageSize: forceFirst ? 1 : WORKSPACES_LIST_SIZE,
71
- });
72
- const workspaces = listWorkspacesResponse?.workspaces || [];
73
- const selectedWorkspace = await selectItemOrExit({
74
- items: workspaces,
75
- getDisplayName: (ws) => ws.displayName || ws.name?.split('/').pop() || 'unknown',
76
- getIdentifier: (ws) => ws.name?.split('/').pop() || 'unknown',
77
- prompt: 'Enter the number or resource name of the workspace to activate:',
78
- title: 'Available workspaces:',
79
- forceFirst,
80
- noItemsMessage: 'No workspaces found.',
81
- invalidSelectionMessage: 'Invalid selection. Please enter a valid number or workspace resource name.',
82
- });
83
- return selectedWorkspace.name;
84
- }
85
- /**
86
- * Prompts user to select an API key from available API keys
87
- * @param apiKeys List of API keys to select from
88
- * @param forceFirst If true, automatically selects the first API key
89
- * @returns The selected API key or null if no selection was made
90
- */
91
- static async pickApiKey(apiKeys, forceFirst = false) {
92
- return selectItemOrExit({
93
- items: apiKeys,
94
- getDisplayName: (apiKey) => {
95
- const displayName = apiKey.displayName;
96
- const label = displayName || ui.trimBase64Key(apiKey.key || 'unknown');
97
- const createdAt = apiKey.createTime
98
- ? new Date(apiKey.createTime).toLocaleDateString()
99
- : 'unknown date';
100
- const permissions = formatApiKeyScopes(apiKey.scopes);
101
- return `${label} (created: ${createdAt})${permissions ? ` ${permissions}` : ''}`;
102
- },
103
- getIdentifier: (apiKey) => apiKey.name?.split('/').pop() || 'unknown',
104
- prompt: 'Enter the number of the API key to use:',
105
- title: 'Available API keys:',
106
- forceFirst,
107
- noItemsMessage: 'No API keys found.',
108
- invalidSelectionMessage: 'Invalid selection. Please enter a valid number.',
109
- });
110
- }
111
- static returnBase64 = (key, secret) => {
112
- const encodedKeySecret = new TextEncoder().encode(`${key}:${secret}`);
113
- return btoa(String.fromCharCode.apply(null, Array.from(encodedKeySecret)));
114
- };
115
- /**
116
- * Activates a workspace by selecting it and its associated API key.
117
- * If no API key exists, prompts the user to generate one.
118
- *
119
- * @param options Configuration options
120
- * @param options.forceFirst If true, automatically selects the first workspace and API key
121
- */
122
- static async activateWorkspace({ forceFirst, } = {}) {
123
- const workspaceResourceName = await this.pickWorkspace(forceFirst);
124
- const workspaceId = parseWorkspaceResourceName(workspaceResourceName).workspaceId;
125
- ui.print(`\nSelecting workspace: ${chalk.whiteBright(workspaceId)}`);
126
- ui.print(`Selected workspace link: ${ui.workspaceLink(workspaceId)}`);
127
- let apiKey = null;
128
- const response = await authenticatedInworldRequest(ApiKeys.ListApiKeys, {
129
- parent: workspaceResourceName,
130
- pageSize: forceFirst ? 1 : WORKSPACES_LIST_SIZE,
131
- });
132
- if (response?.apiKeys?.length) {
133
- // If there's only one API key or forceFirst is true, use it directly
134
- if (response.apiKeys.length === 1 || forceFirst) {
135
- apiKey = response.apiKeys[0];
136
- }
137
- else {
138
- // Multiple API keys found, let user select
139
- ui.print(`Found ${response.apiKeys.length} API keys in the workspace.`);
140
- apiKey = await this.pickApiKey(response.apiKeys, false);
141
- }
142
- }
143
- else {
144
- const shouldGenerate = await confirm({
145
- message: 'No API keys found for this workspace. Would you like to generate one? (y/N): ',
146
- defaultValue: false,
147
- });
148
- if (shouldGenerate) {
149
- ui.print('Generating API key...');
150
- const generateApiKeyResponse = await authenticatedInworldRequest(ApiKeys.GenerateApiKey, {
151
- parent: workspaceResourceName,
152
- });
153
- if (!generateApiKeyResponse) {
154
- ui.printError('Failed to generate API key.');
155
- process.exit(1);
156
- }
157
- apiKey = generateApiKeyResponse;
158
- ui.success('API key generated successfully.');
159
- }
160
- else {
161
- ui.print('No API key will be generated.');
162
- }
163
- }
164
- const base64Key = this.returnBase64(apiKey?.key, apiKey?.secret);
165
- ui.print(`\nSelecting API key: ${chalk.whiteBright(ui.trimBase64Key(base64Key))}`);
166
- await authManager.updateWorkspaceAndApiKey(workspaceId, base64Key);
167
- ui.success('\nWorkspace and API key selected.');
168
- }
169
- /**
170
- * Lists all API keys for the currently active workspace
171
- */
172
- static async listApiKeys() {
173
- const credentials = await authManager.getCredentials();
174
- if (!credentials?.workspace) {
175
- ui.printError('No workspace activated. Please run "inworld workspace activate" first.');
176
- return;
177
- }
178
- const parent = ensureWorkspaceResourceName(credentials.workspace);
179
- const response = await authenticatedInworldRequest(ApiKeys.ListApiKeys, {
180
- parent,
181
- pageSize: WORKSPACES_LIST_SIZE,
182
- });
183
- const apiKeys = response?.apiKeys || [];
184
- if (apiKeys.length === 0) {
185
- ui.printError('No API keys found in the active workspace.');
186
- return;
187
- }
188
- console.log();
189
- ui.printHeader(`API keys in workspace ${credentials.workspace}:`);
190
- apiKeys.forEach((apiKey, idx) => {
191
- const displayName = apiKey.displayName;
192
- const label = displayName || ui.trimBase64Key(apiKey.key || 'unknown');
193
- const createdAt = apiKey.createTime
194
- ? new Date(apiKey.createTime).toLocaleDateString()
195
- : 'unknown date';
196
- const state = apiKey.state || 'unknown';
197
- const permissions = formatApiKeyScopes(apiKey.scopes);
198
- ui.printListItem(`${idx + 1}. ${label} (created: ${createdAt}, state: ${state})${permissions ? ` ${permissions}` : ''}`);
199
- });
200
- }
201
- /**
202
- * Allows user to select and activate a different API key from the current workspace
203
- */
204
- static async selectApiKey() {
205
- const credentials = await authManager.getCredentials();
206
- if (!credentials?.workspace) {
207
- ui.printError('No workspace activated. Please run "inworld workspace activate" first.');
208
- return;
209
- }
210
- // credentials.workspace may be just the ID ("ted") or full resource name
211
- const parent = ensureWorkspaceResourceName(credentials.workspace);
212
- const response = await authenticatedInworldRequest(ApiKeys.ListApiKeys, {
213
- parent,
214
- pageSize: WORKSPACES_LIST_SIZE,
215
- });
216
- const apiKeys = response?.apiKeys || [];
217
- if (apiKeys.length === 0) {
218
- ui.printError('No API keys found in the active workspace.');
219
- const shouldGenerate = await confirm({
220
- message: 'Would you like to generate a new API key? (y/N): ',
221
- defaultValue: false,
222
- });
223
- if (shouldGenerate) {
224
- await this.generateApiKey();
225
- }
226
- return;
227
- }
228
- if (apiKeys.length === 1) {
229
- ui.print('Only one API key found in the workspace.');
230
- const apiKey = apiKeys[0];
231
- const base64Key = this.returnBase64(apiKey?.key, apiKey?.secret);
232
- await authManager.updateWorkspaceAndApiKey(credentials.workspace, base64Key);
233
- ui.success('API key activated successfully.');
234
- return;
235
- }
236
- const selectedApiKey = await this.pickApiKey(apiKeys, false);
237
- if (selectedApiKey) {
238
- const base64Key = this.returnBase64(selectedApiKey.key, selectedApiKey.secret);
239
- await authManager.updateWorkspaceAndApiKey(credentials.workspace, base64Key);
240
- ui.success('API key activated successfully.');
241
- }
242
- }
243
- /**
244
- * Generates a new API key for the currently active workspace
245
- */
246
- static async generateApiKey() {
247
- const credentials = await authManager.getCredentials();
248
- if (!credentials?.workspace) {
249
- ui.printError('No workspace activated. Please run "inworld workspace activate" first.');
250
- return;
251
- }
252
- ui.print('Generating new API key...');
253
- const parent = ensureWorkspaceResourceName(credentials.workspace);
254
- const generateApiKeyResponse = await authenticatedInworldRequest(ApiKeys.GenerateApiKey, {
255
- parent,
256
- });
257
- if (!generateApiKeyResponse) {
258
- ui.printError('Failed to generate API key.');
259
- return;
260
- }
261
- const base64Key = this.returnBase64(generateApiKeyResponse.key, generateApiKeyResponse.secret);
262
- await authManager.updateWorkspaceAndApiKey(credentials.workspace, base64Key);
263
- ui.success('API key activated successfully.');
264
- ui.success('API key generated and activated successfully.');
265
- console.log();
266
- ui.printHeader('API Key details:');
267
- ui.printListItem(`Name: ${generateApiKeyResponse.name?.split('/').pop() || 'unknown'}`);
268
- ui.printListItem(`Key: ${generateApiKeyResponse.key}`);
269
- ui.printListItem(`Base64: ${base64Key}`);
270
- }
271
- /**
272
- * Creates a new API key with predefined scope preset and activates it.
273
- * @param mode 'read' for read-only, 'write' for read/write voices & router
274
- * @param displayName Optional display name for the key
275
- */
276
- static async createApiKey(mode, displayName) {
277
- const credentials = await authManager.getCredentials();
278
- if (!credentials?.workspace) {
279
- ui.printError('No workspace activated. Please run "inworld workspace activate" first.');
280
- return;
281
- }
282
- const parent = ensureWorkspaceResourceName(credentials.workspace);
283
- const workspaceId = credentials.workspace.replace('workspaces/', '');
284
- const baseScopes = ['api.rt::x', 'api.ml::x', 'api.ops::x'];
285
- const scopes = mode === 'write'
286
- ? [
287
- ...baseScopes,
288
- `api.dsgnt.voices::rw(ws=${workspaceId})`,
289
- `api.dsgnt.router::rw(ws=${workspaceId})`,
290
- ]
291
- : [
292
- ...baseScopes,
293
- `api.dsgnt.voices::r(ws=${workspaceId})`,
294
- `api.dsgnt.router::r(ws=${workspaceId})`,
295
- ];
296
- const label = mode === 'write' ? 'read/write' : 'read-only';
297
- ui.print(`Creating ${label} API key...`);
298
- const generateApiKeyResponse = await authenticatedInworldRequest(ApiKeys.GenerateApiKey, {
299
- parent,
300
- scopes,
301
- displayName,
302
- authTypes: [
303
- ApiKeyAuthorizationType.API_KEY_AUTHORIZATION_TYPE_BASIC,
304
- ApiKeyAuthorizationType.API_KEY_AUTHORIZATION_TYPE_JWT,
305
- ],
306
- });
307
- if (!generateApiKeyResponse) {
308
- ui.printError('Failed to generate API key.');
309
- return;
310
- }
311
- const base64Key = this.returnBase64(generateApiKeyResponse.key, generateApiKeyResponse.secret);
312
- await authManager.updateWorkspaceAndApiKey(credentials.workspace, base64Key);
313
- const permissions = formatApiKeyScopes(generateApiKeyResponse.scopes);
314
- ui.success('\nAPI key created and activated.');
315
- console.log();
316
- ui.printHeader('API Key details:');
317
- if (displayName) {
318
- ui.printListItem(`Display Name: ${displayName}`);
319
- }
320
- ui.printListItem(`Permissions: ${permissions || label}`);
321
- ui.printListItem(`Key: ${ui.trimBase64Key(base64Key)}`);
322
- }
323
- }
324
- //# sourceMappingURL=workspace_service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workspace_service.js","sourceRoot":"","sources":["../../../src/services/workspace_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAEL,uBAAuB,EACvB,OAAO,GACR,MAAM,+DAA+D,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,kEAAkE,CAAC;AAC9F,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,MAAiB;IAC3C,IAAI,CAAC,MAAM,EAAE,MAAM;QAAE,OAAO,EAAE,CAAC;IAE/B,MAAM,QAAQ,GAA2B;QACvC,kBAAkB,EAAE,QAAQ;QAC5B,kBAAkB,EAAE,QAAQ;KAC7B,CAAC;IAEF,MAAM,SAAS,GAA2B;QACxC,CAAC,EAAE,MAAM;QACT,CAAC,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C,GAAG,EAAE,CAAC;QACd,EAAE,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;QACnC,IAAI,WAAW,EAAE,CAAC;YAChB,EAAE,CAAC,aAAa,CAAC,iBAAiB,WAAW,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,EAAE,CAAC,aAAa,CAAC,gBAAgB,WAAW,IAAI,KAAK,EAAE,CAAC,CAAC;QACzD,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function isArrayOfType<T>(arr: T[] | undefined, typeGuard: (obj: unknown) => obj is T): arr is T[];
2
- //# sourceMappingURL=array.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src/utils/array.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,CAAC,EAC7B,GAAG,EAAE,CAAC,EAAE,GAAG,SAAS,EACpB,SAAS,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,GAAG,IAAI,CAAC,GACpC,GAAG,IAAI,CAAC,EAAE,CAIZ"}
@@ -1,4 +0,0 @@
1
- export function isArrayOfType(arr, typeGuard) {
2
- return (typeof arr !== 'undefined' && Array.isArray(arr) && arr.every(typeGuard));
3
- }
4
- //# sourceMappingURL=array.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/utils/array.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAC3B,GAAoB,EACpB,SAAqC;IAErC,OAAO,CACL,OAAO,GAAG,KAAK,WAAW,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CACzE,CAAC;AACJ,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Plays an audio file through the system audio player.
3
- * Returns true if playback succeeded, false otherwise.
4
- */
5
- export declare function playFile(filePath: string): Promise<boolean>;
6
- /**
7
- * Removes a temp file, ignoring errors if it doesn't exist
8
- */
9
- export declare function cleanupTempFile(filepath: string): Promise<void>;
10
- //# sourceMappingURL=audio_player.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"audio_player.d.ts","sourceRoot":"","sources":["../../../src/utils/audio_player.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAajE;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMrE"}
@@ -1,34 +0,0 @@
1
- import { unlink } from 'fs/promises';
2
- /**
3
- * Plays an audio file through the system audio player.
4
- * Returns true if playback succeeded, false otherwise.
5
- */
6
- export async function playFile(filePath) {
7
- try {
8
- const player = (await import('play-sound')).default();
9
- await new Promise((resolve, reject) => {
10
- player.play(filePath, (err) => {
11
- if (err)
12
- reject(err);
13
- else
14
- resolve();
15
- });
16
- });
17
- return true;
18
- }
19
- catch {
20
- return false;
21
- }
22
- }
23
- /**
24
- * Removes a temp file, ignoring errors if it doesn't exist
25
- */
26
- export async function cleanupTempFile(filepath) {
27
- try {
28
- await unlink(filepath);
29
- }
30
- catch {
31
- // ignore
32
- }
33
- }
34
- //# sourceMappingURL=audio_player.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"audio_player.js","sourceRoot":"","sources":["../../../src/utils/audio_player.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,QAAgB;IAC7C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QACtD,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC1C,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAiB,EAAE,EAAE;gBAC1C,IAAI,GAAG;oBAAE,MAAM,CAAC,GAAG,CAAC,CAAC;;oBAChB,OAAO,EAAE,CAAC;YACjB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,QAAgB;IACpD,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,SAAS;IACX,CAAC;AACH,CAAC"}
@@ -1,62 +0,0 @@
1
- /**
2
- * Sets the global auto-confirm flag
3
- * @param value If true, all confirmations will be auto-accepted
4
- */
5
- export declare function setGlobalForceYes(value: boolean): void;
6
- /**
7
- * Gets the current global auto-confirm flag value
8
- */
9
- export declare function getGlobalForceYes(): boolean;
10
- /**
11
- * Options for confirmation prompts
12
- */
13
- export interface ConfirmOptions {
14
- /**
15
- * The prompt message to show the user
16
- */
17
- message: string;
18
- /**
19
- * If true, automatically confirm without prompting
20
- * Overrides global forceYes setting
21
- */
22
- forceYes?: boolean;
23
- /**
24
- * The default value if user just presses enter (defaults to false)
25
- */
26
- defaultValue?: boolean;
27
- }
28
- /**
29
- * Prompts the user for a yes/no confirmation
30
- * Supports auto-confirm via forceYes parameter or global setting
31
- *
32
- * @param options Confirmation options
33
- * @returns Promise that resolves to true if user confirmed, false otherwise
34
- *
35
- * @example
36
- * ```typescript
37
- * const shouldProceed = await confirm({
38
- * message: 'Do you want to continue?',
39
- * defaultValue: false
40
- * });
41
- * if (shouldProceed) {
42
- * // proceed with action
43
- * }
44
- * ```
45
- */
46
- export declare function confirm(options: ConfirmOptions): Promise<boolean>;
47
- /**
48
- * Prompts the user for confirmation and exits the process if declined
49
- *
50
- * @param options Confirmation options
51
- * @param exitCode Exit code to use if user declines (defaults to 1)
52
- *
53
- * @example
54
- * ```typescript
55
- * await confirmOrExit({
56
- * message: 'This will delete all data. Continue? (y/N): '
57
- * });
58
- * // Code only reaches here if user confirmed
59
- * ```
60
- */
61
- export declare function confirmOrExit(options: ConfirmOptions, exitCode?: number): Promise<void>;
62
- //# sourceMappingURL=confirm.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"confirm.d.ts","sourceRoot":"","sources":["../../../src/utils/confirm.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAEtD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAwCvE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,cAAc,EACvB,QAAQ,GAAE,MAAU,GACnB,OAAO,CAAC,IAAI,CAAC,CAKf"}
@@ -1,90 +0,0 @@
1
- import * as readline from 'readline';
2
- /**
3
- * Global context for confirmation prompts
4
- */
5
- let globalForceYes = false;
6
- /**
7
- * Sets the global auto-confirm flag
8
- * @param value If true, all confirmations will be auto-accepted
9
- */
10
- export function setGlobalForceYes(value) {
11
- globalForceYes = value;
12
- }
13
- /**
14
- * Gets the current global auto-confirm flag value
15
- */
16
- export function getGlobalForceYes() {
17
- return globalForceYes;
18
- }
19
- /**
20
- * Prompts the user for a yes/no confirmation
21
- * Supports auto-confirm via forceYes parameter or global setting
22
- *
23
- * @param options Confirmation options
24
- * @returns Promise that resolves to true if user confirmed, false otherwise
25
- *
26
- * @example
27
- * ```typescript
28
- * const shouldProceed = await confirm({
29
- * message: 'Do you want to continue?',
30
- * defaultValue: false
31
- * });
32
- * if (shouldProceed) {
33
- * // proceed with action
34
- * }
35
- * ```
36
- */
37
- export async function confirm(options) {
38
- const { message, forceYes, defaultValue = false } = options;
39
- // Check if we should auto-confirm (local override or global setting)
40
- if (forceYes !== undefined ? forceYes : globalForceYes) {
41
- return true;
42
- }
43
- const rl = readline.createInterface({
44
- input: process.stdin,
45
- output: process.stdout,
46
- });
47
- return new Promise((resolve) => {
48
- rl.question(message, (answer) => {
49
- rl.close();
50
- const trimmedAnswer = answer.trim().toLowerCase();
51
- // Handle explicit yes/no
52
- if (trimmedAnswer === 'y' || trimmedAnswer === 'yes') {
53
- resolve(true);
54
- return;
55
- }
56
- if (trimmedAnswer === 'n' || trimmedAnswer === 'no') {
57
- resolve(false);
58
- return;
59
- }
60
- // Empty answer uses default
61
- if (trimmedAnswer === '') {
62
- resolve(defaultValue);
63
- return;
64
- }
65
- // Invalid input defaults to false for safety
66
- resolve(false);
67
- });
68
- });
69
- }
70
- /**
71
- * Prompts the user for confirmation and exits the process if declined
72
- *
73
- * @param options Confirmation options
74
- * @param exitCode Exit code to use if user declines (defaults to 1)
75
- *
76
- * @example
77
- * ```typescript
78
- * await confirmOrExit({
79
- * message: 'This will delete all data. Continue? (y/N): '
80
- * });
81
- * // Code only reaches here if user confirmed
82
- * ```
83
- */
84
- export async function confirmOrExit(options, exitCode = 1) {
85
- const confirmed = await confirm(options);
86
- if (!confirmed) {
87
- process.exit(exitCode);
88
- }
89
- }
90
- //# sourceMappingURL=confirm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"confirm.js","sourceRoot":"","sources":["../../../src/utils/confirm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,UA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BACzB,OAAO,CAAC,YAAY,CAAC,CAAC;gBACtB,OAAO;YACT,CAAC;YAED,6CAA6C;YAC7C,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAuB,EACvB,WAAmB,CAAC;IAEpB,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;AACH,CAAC"}
@@ -1,38 +0,0 @@
1
- import { ErrorStatus } from '@/grpc/core/InworldError';
2
- export type LongRunningOperationResponse = {
3
- name: string;
4
- metadata?: any;
5
- done: boolean;
6
- error?: ErrorStatus;
7
- response?: any;
8
- };
9
- export declare const isLongRunningOperationResponse: (obj: any) => obj is LongRunningOperationResponse;
10
- export declare const CHECK_LIMIT = 60;
11
- export declare const CHECK_TIMEOUT = 2000;
12
- export type LROPollOptions<T> = {
13
- currentIteration?: number;
14
- skipCheck?: boolean;
15
- isRunning?: boolean;
16
- operationName?: string;
17
- startCallback?: (operationName: string) => void;
18
- iterationCallback?: (operationName: string, checkResponse: {
19
- done?: boolean | undefined;
20
- response?: T | undefined;
21
- error?: string | undefined;
22
- } | undefined, checkData: {
23
- checkIteration: number;
24
- checkLimit: number;
25
- checkTimeout: number;
26
- }) => void;
27
- doneCallback?: (operationName: string, response: T | undefined) => void;
28
- errorCallback?: (operationName: string, error: string) => void;
29
- };
30
- export declare const checkLRO: <T>({ operationName, signal, checkLimit, checkTimeout, pollOptions, returnWithMetadata, }: {
31
- operationName: string;
32
- signal?: AbortSignal;
33
- checkLimit?: number;
34
- checkTimeout?: number;
35
- pollOptions?: LROPollOptions<T>;
36
- returnWithMetadata?: boolean;
37
- }) => Promise<T>;
38
- //# sourceMappingURL=long_running_operations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"long_running_operations.d.ts","sourceRoot":"","sources":["../../../src/utils/long_running_operations.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIvD,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,CAAC;AASF,eAAO,MAAM,8BAA8B,GACzC,KAAK,GAAG,KACP,GAAG,IAAI,4BAK6C,CAAC;AAExD,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,aAAa,OAAO,CAAC;AAElC,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,iBAAiB,CAAC,EAAE,CAClB,aAAa,EAAE,MAAM,EACrB,aAAa,EACT;QACE,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAC3B,QAAQ,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;QACzB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC5B,GACD,SAAS,EACb,SAAS,EAAE;QACT,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;KACtB,KACE,IAAI,CAAC;IACV,YAAY,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,SAAS,K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