@inworld/cli 0.2.15 → 0.2.16

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 (223) hide show
  1. package/dist/index.js +1086 -639
  2. package/dist/index.js.map +4 -4
  3. package/dist/package.json +49 -0
  4. package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.d.ts +10 -0
  5. package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.d.ts.map +1 -0
  6. package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.js +16 -0
  7. package/dist/proto/generated/portal/ai/inworld/language_codes/language_codes.pb.js.map +1 -0
  8. package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.d.ts +13 -0
  9. package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.d.ts.map +1 -0
  10. package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.js +2 -0
  11. package/dist/proto/generated/portal/ai/inworld/studio/v1/errors.pb.js.map +1 -0
  12. package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.d.ts +7 -0
  13. package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.d.ts.map +1 -0
  14. package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.js +15 -0
  15. package/dist/proto/generated/portal/ai/inworld/studio/v1/operations.pb.js.map +1 -0
  16. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.d.ts +14 -0
  17. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.d.ts.map +1 -0
  18. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.js +7 -0
  19. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graph_configuration.pb.js.map +1 -0
  20. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.d.ts +116 -0
  21. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.d.ts.map +1 -0
  22. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.js +71 -0
  23. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/graphs.pb.js.map +1 -0
  24. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.d.ts +14 -0
  25. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.d.ts.map +1 -0
  26. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.js +7 -0
  27. package/dist/proto/generated/portal/ai/inworld/studio/v1/remote/configuration/targeting.pb.js.map +1 -0
  28. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.d.ts +76 -0
  29. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.d.ts.map +1 -0
  30. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.js +40 -0
  31. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/apikeys.pb.js.map +1 -0
  32. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.d.ts +10 -0
  33. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.d.ts.map +1 -0
  34. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.js +7 -0
  35. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/impression_event_data.pb.js.map +1 -0
  36. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.d.ts +7 -0
  37. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.d.ts.map +1 -0
  38. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.js +13 -0
  39. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/language_code.pb.js.map +1 -0
  40. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.d.ts +115 -0
  41. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.d.ts.map +1 -0
  42. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.js +86 -0
  43. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/users.pb.js.map +1 -0
  44. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.d.ts +255 -0
  45. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.d.ts.map +1 -0
  46. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.js +88 -0
  47. package/dist/proto/generated/portal/ai/inworld/studio/v1alpha/workspaces.pb.js.map +1 -0
  48. package/dist/proto/generated/portal/fetch.pb.d.ts +26 -0
  49. package/dist/proto/generated/portal/fetch.pb.d.ts.map +1 -0
  50. package/dist/proto/generated/portal/fetch.pb.js +274 -0
  51. package/dist/proto/generated/portal/fetch.pb.js.map +1 -0
  52. package/dist/src/auth/callback_server.d.ts +41 -0
  53. package/dist/src/auth/callback_server.d.ts.map +1 -0
  54. package/dist/src/auth/callback_server.js +136 -0
  55. package/dist/src/auth/callback_server.js.map +1 -0
  56. package/dist/src/auth/manager.d.ts +97 -0
  57. package/dist/src/auth/manager.d.ts.map +1 -0
  58. package/dist/src/auth/manager.js +340 -0
  59. package/dist/src/auth/manager.js.map +1 -0
  60. package/dist/src/auth/utils.d.ts +45 -0
  61. package/dist/src/auth/utils.d.ts.map +1 -0
  62. package/dist/src/auth/utils.js +183 -0
  63. package/dist/src/auth/utils.js.map +1 -0
  64. package/dist/src/commands/auth/disable_telemetry_command.d.ts +3 -0
  65. package/dist/src/commands/auth/disable_telemetry_command.d.ts.map +1 -0
  66. package/dist/src/commands/auth/enable_telemetry_command.d.ts +3 -0
  67. package/dist/src/commands/auth/enable_telemetry_command.d.ts.map +1 -0
  68. package/dist/src/commands/auth/login_ci_command.d.ts +3 -0
  69. package/dist/src/commands/auth/login_ci_command.d.ts.map +1 -0
  70. package/dist/src/commands/auth/login_ci_command.js +41 -0
  71. package/dist/src/commands/auth/login_ci_command.js.map +1 -0
  72. package/dist/src/commands/auth/login_command.d.ts +4 -0
  73. package/dist/src/commands/auth/login_command.d.ts.map +1 -0
  74. package/dist/src/commands/auth/login_command.js +134 -0
  75. package/dist/src/commands/auth/login_command.js.map +1 -0
  76. package/dist/src/commands/auth/logout_command.d.ts +4 -0
  77. package/dist/src/commands/auth/logout_command.d.ts.map +1 -0
  78. package/dist/src/commands/auth/logout_command.js +54 -0
  79. package/dist/src/commands/auth/logout_command.js.map +1 -0
  80. package/dist/src/commands/auth/print_access_token_command.d.ts +3 -0
  81. package/dist/src/commands/auth/print_access_token_command.d.ts.map +1 -0
  82. package/dist/src/commands/auth/print_access_token_command.js +21 -0
  83. package/dist/src/commands/auth/print_access_token_command.js.map +1 -0
  84. package/dist/src/commands/auth/print_api_key_command.d.ts +3 -0
  85. package/dist/src/commands/auth/print_api_key_command.d.ts.map +1 -0
  86. package/dist/src/commands/auth/print_api_key_command.js +26 -0
  87. package/dist/src/commands/auth/print_api_key_command.js.map +1 -0
  88. package/dist/src/commands/auth/status_command.d.ts +4 -0
  89. package/dist/src/commands/auth/status_command.d.ts.map +1 -0
  90. package/dist/src/commands/auth/status_command.js +84 -0
  91. package/dist/src/commands/auth/status_command.js.map +1 -0
  92. package/dist/src/commands/auth_command.d.ts +3 -0
  93. package/dist/src/commands/auth_command.d.ts.map +1 -0
  94. package/dist/src/commands/auth_command.js +20 -0
  95. package/dist/src/commands/auth_command.js.map +1 -0
  96. package/dist/src/commands/graph/graph_deploy_command.d.ts +24 -0
  97. package/dist/src/commands/graph/graph_deploy_command.d.ts.map +1 -0
  98. package/dist/src/commands/graph/graph_deploy_command.js +191 -0
  99. package/dist/src/commands/graph/graph_deploy_command.js.map +1 -0
  100. package/dist/src/commands/graph/graph_init_command.d.ts +4 -0
  101. package/dist/src/commands/graph/graph_init_command.d.ts.map +1 -0
  102. package/dist/src/commands/graph/graph_init_command.js +376 -0
  103. package/dist/src/commands/graph/graph_init_command.js.map +1 -0
  104. package/dist/src/commands/graph/graph_run_command.d.ts +24 -0
  105. package/dist/src/commands/graph/graph_run_command.d.ts.map +1 -0
  106. package/dist/src/commands/graph/graph_run_command.js +50 -0
  107. package/dist/src/commands/graph/graph_run_command.js.map +1 -0
  108. package/dist/src/commands/graph/graph_serve_command.d.ts +4 -0
  109. package/dist/src/commands/graph/graph_serve_command.d.ts.map +1 -0
  110. package/dist/src/commands/graph/graph_serve_command.js +40 -0
  111. package/dist/src/commands/graph/graph_serve_command.js.map +1 -0
  112. package/dist/src/commands/graph/graph_variant_command.d.ts +3 -0
  113. package/dist/src/commands/graph/graph_variant_command.d.ts.map +1 -0
  114. package/dist/src/commands/graph/graph_variant_command.js +13 -0
  115. package/dist/src/commands/graph/graph_variant_command.js.map +1 -0
  116. package/dist/src/commands/graph/graph_visualize_command.d.ts +7 -0
  117. package/dist/src/commands/graph/graph_visualize_command.d.ts.map +1 -0
  118. package/dist/src/commands/graph/graph_visualize_command.js +35 -0
  119. package/dist/src/commands/graph/graph_visualize_command.js.map +1 -0
  120. package/dist/src/commands/graph/variant/graph_variant_list_command.d.ts +3 -0
  121. package/dist/src/commands/graph/variant/graph_variant_list_command.d.ts.map +1 -0
  122. package/dist/src/commands/graph/variant/graph_variant_list_command.js +25 -0
  123. package/dist/src/commands/graph/variant/graph_variant_list_command.js.map +1 -0
  124. package/dist/src/commands/graph/variant/graph_variant_print_command.d.ts +7 -0
  125. package/dist/src/commands/graph/variant/graph_variant_print_command.d.ts.map +1 -0
  126. package/dist/src/commands/graph/variant/graph_variant_print_command.js +45 -0
  127. package/dist/src/commands/graph/variant/graph_variant_print_command.js.map +1 -0
  128. package/dist/src/commands/graph/variant/graph_variant_register_command.d.ts +3 -0
  129. package/dist/src/commands/graph/variant/graph_variant_register_command.d.ts.map +1 -0
  130. package/dist/src/commands/graph/variant/graph_variant_register_command.js +45 -0
  131. package/dist/src/commands/graph/variant/graph_variant_register_command.js.map +1 -0
  132. package/dist/src/commands/graph_command.d.ts +3 -0
  133. package/dist/src/commands/graph_command.d.ts.map +1 -0
  134. package/dist/src/commands/graph_command.js +20 -0
  135. package/dist/src/commands/graph_command.js.map +1 -0
  136. package/dist/src/commands/tts_commands.d.ts +17 -0
  137. package/dist/src/commands/tts_commands.d.ts.map +1 -0
  138. package/dist/src/commands/tts_commands.js +568 -0
  139. package/dist/src/commands/tts_commands.js.map +1 -0
  140. package/dist/src/commands/workspace_command.d.ts +12 -0
  141. package/dist/src/commands/workspace_command.d.ts.map +1 -0
  142. package/dist/src/commands/workspace_command.js +33 -0
  143. package/dist/src/commands/workspace_command.js.map +1 -0
  144. package/dist/src/constants.d.ts +10 -0
  145. package/dist/src/constants.d.ts.map +1 -0
  146. package/dist/src/constants.js +30 -0
  147. package/dist/src/constants.js.map +1 -0
  148. package/dist/src/grpc/core/InworldError.d.ts +30 -0
  149. package/dist/src/grpc/core/InworldError.d.ts.map +1 -0
  150. package/dist/src/grpc/core/InworldError.js +46 -0
  151. package/dist/src/grpc/core/InworldError.js.map +1 -0
  152. package/dist/src/grpc/core/statusCodes.d.ts +122 -0
  153. package/dist/src/grpc/core/statusCodes.d.ts.map +1 -0
  154. package/dist/src/grpc/core/statusCodes.js +133 -0
  155. package/dist/src/grpc/core/statusCodes.js.map +1 -0
  156. package/dist/src/index.d.ts +2 -0
  157. package/dist/src/index.d.ts.map +1 -0
  158. package/dist/src/services/analytics.d.ts +45 -0
  159. package/dist/src/services/analytics.d.ts.map +1 -0
  160. package/dist/src/services/deploy_service.d.ts +4 -0
  161. package/dist/src/services/deploy_service.d.ts.map +1 -0
  162. package/dist/src/services/deploy_service.js +128 -0
  163. package/dist/src/services/deploy_service.js.map +1 -0
  164. package/dist/src/services/graph_loader.d.ts +7 -0
  165. package/dist/src/services/graph_loader.d.ts.map +1 -0
  166. package/dist/src/services/graph_loader.js +103 -0
  167. package/dist/src/services/graph_loader.js.map +1 -0
  168. package/dist/src/services/graph_variant_service.d.ts +12 -0
  169. package/dist/src/services/graph_variant_service.d.ts.map +1 -0
  170. package/dist/src/services/graph_variant_service.js +66 -0
  171. package/dist/src/services/graph_variant_service.js.map +1 -0
  172. package/dist/src/services/tts_service.d.ts +273 -0
  173. package/dist/src/services/tts_service.d.ts.map +1 -0
  174. package/dist/src/services/tts_service.js +299 -0
  175. package/dist/src/services/tts_service.js.map +1 -0
  176. package/dist/src/services/update_checker.d.ts +37 -0
  177. package/dist/src/services/update_checker.d.ts.map +1 -0
  178. package/dist/src/services/workspace_service.d.ts +47 -0
  179. package/dist/src/services/workspace_service.d.ts.map +1 -0
  180. package/dist/src/services/workspace_service.js +222 -0
  181. package/dist/src/services/workspace_service.js.map +1 -0
  182. package/dist/src/templates/llm_tts/graph.d.ts +2 -0
  183. package/dist/src/templates/llm_tts/graph.d.ts.map +1 -0
  184. package/dist/src/utils/array.d.ts +2 -0
  185. package/dist/src/utils/array.d.ts.map +1 -0
  186. package/dist/src/utils/array.js +4 -0
  187. package/dist/src/utils/array.js.map +1 -0
  188. package/dist/src/utils/confirm.d.ts +62 -0
  189. package/dist/src/utils/confirm.d.ts.map +1 -0
  190. package/dist/src/utils/confirm.js +90 -0
  191. package/dist/src/utils/confirm.js.map +1 -0
  192. package/dist/src/utils/long_running_operations.d.ts +38 -0
  193. package/dist/src/utils/long_running_operations.d.ts.map +1 -0
  194. package/dist/src/utils/long_running_operations.js +62 -0
  195. package/dist/src/utils/long_running_operations.js.map +1 -0
  196. package/dist/src/utils/resource_name_helper.d.ts +12 -0
  197. package/dist/src/utils/resource_name_helper.d.ts.map +1 -0
  198. package/dist/src/utils/resource_name_helper.js +29 -0
  199. package/dist/src/utils/resource_name_helper.js.map +1 -0
  200. package/dist/src/utils/selector.d.ts +62 -0
  201. package/dist/src/utils/selector.d.ts.map +1 -0
  202. package/dist/src/utils/selector.js +77 -0
  203. package/dist/src/utils/selector.js.map +1 -0
  204. package/dist/src/utils/spinner.d.ts +75 -0
  205. package/dist/src/utils/spinner.d.ts.map +1 -0
  206. package/dist/src/utils/spinner.js +178 -0
  207. package/dist/src/utils/spinner.js.map +1 -0
  208. package/dist/src/utils/ui.d.ts +27 -0
  209. package/dist/src/utils/ui.d.ts.map +1 -0
  210. package/dist/src/utils/ui.js +83 -0
  211. package/dist/src/utils/ui.js.map +1 -0
  212. package/dist/templates/llm_tts/graph.ts +2 -1
  213. package/package.json +3 -2
  214. package/src/templates/llm_tts/graph.ts +2 -1
  215. package/dist/src/templates/simple/README.md +0 -106
  216. package/dist/src/templates/simple/graph.ts +0 -32
  217. package/dist/src/templates/simple/metadata.json +0 -26
  218. package/dist/templates/simple/README.md +0 -106
  219. package/dist/templates/simple/graph.ts +0 -32
  220. package/dist/templates/simple/metadata.json +0 -26
  221. package/src/templates/simple/README.md +0 -106
  222. package/src/templates/simple/graph.ts +0 -32
  223. package/src/templates/simple/metadata.json +0 -26
@@ -0,0 +1,191 @@
1
+ import archiver from 'archiver';
2
+ import { Command } from 'commander';
3
+ import fs from 'fs';
4
+ import os from 'os';
5
+ import path from 'path';
6
+ import { requireWorkspace } from '@/auth/utils';
7
+ import { PLATFORM_URL, RUNTIME_VERSION } from '@/constants';
8
+ import { deployGraph, getGraphDeployment } from '@/services/deploy_service';
9
+ import { loadGraph } from '@/services/graph_loader';
10
+ import { getGraphResourceName } from '@/utils/resource_name_helper';
11
+ import * as ui from '@/utils/ui';
12
+ /**
13
+ * Process and enhance the package.json for deployment
14
+ */
15
+ function processPackageJson(originalPackageJson, graphFileName) {
16
+ // Clone the original package.json
17
+ const packageJson = JSON.parse(JSON.stringify(originalPackageJson));
18
+ // Update/add deployment-specific fields
19
+ packageJson.name = packageJson.name || 'inworld-graph-deployment';
20
+ packageJson.version = packageJson.version || '1.0.0';
21
+ packageJson.description =
22
+ packageJson.description || 'Inworld Runtime Graph Deployment Package';
23
+ packageJson.main = graphFileName;
24
+ // Ensure scripts section exists and add deployment scripts
25
+ packageJson.scripts = packageJson.scripts || {};
26
+ packageJson.scripts.start = `npx inworld serve --host 0.0.0.0 ${graphFileName}`;
27
+ packageJson.scripts['run'] = `npx inworld run ${graphFileName}`;
28
+ // Ensure @inworld/runtime is included if not already present
29
+ packageJson.dependencies = packageJson.dependencies || {};
30
+ if (!packageJson.dependencies['@inworld/runtime']) {
31
+ packageJson.dependencies['@inworld/runtime'] = RUNTIME_VERSION;
32
+ }
33
+ // Ensure @inworld/cli is in dependencies
34
+ if (!packageJson.dependencies['@inworld/cli']) {
35
+ packageJson.dependencies['@inworld/cli'] =
36
+ 'https://storage.googleapis.com/assets-inworld-ai/node-packages/inworld-cli-0.2.15.tgz';
37
+ }
38
+ // Ensure dotenv is in dependencies
39
+ if (!packageJson.dependencies['dotenv']) {
40
+ packageJson.dependencies['dotenv'] = '^17.2.1';
41
+ }
42
+ // Remove unnecessary fields for deployment
43
+ delete packageJson.devDependencies; // Remove dev deps to reduce package size
44
+ delete packageJson.scripts.test;
45
+ delete packageJson.scripts.lint;
46
+ delete packageJson.scripts.build;
47
+ delete packageJson.scripts.prepare;
48
+ return packageJson;
49
+ }
50
+ const deployAction = async (file, options) => {
51
+ try {
52
+ const workspaceId = await requireWorkspace();
53
+ const { graph, bundledCode, originalPackageJson, packageJsonPath } = await loadGraph(file);
54
+ const graphResourceName = getGraphResourceName(workspaceId, graph.graphId);
55
+ if (options.info) {
56
+ const deployment = await getGraphDeployment(graphResourceName);
57
+ console.log(deployment);
58
+ ui.success('Inworld Cloud URI:');
59
+ ui.print(`${PLATFORM_URL.replace('platform', 'api')}/cloud/${graphResourceName}/v1/graph:start`);
60
+ process.exit(0);
61
+ }
62
+ const randomId = `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
63
+ const tempBaseDir = path.join(os.tmpdir(), 'inworld', randomId);
64
+ if (!fs.existsSync(tempBaseDir)) {
65
+ fs.mkdirSync(tempBaseDir, { recursive: true });
66
+ }
67
+ const outputPath = path.join(tempBaseDir, 'graph-deployment.zip');
68
+ const output = fs.createWriteStream(outputPath);
69
+ const archive = archiver('zip', {
70
+ zlib: { level: 9 }, // Maximum compression
71
+ });
72
+ const archiveComplete = new Promise((resolve, reject) => {
73
+ output.on('close', () => {
74
+ if (options.packageOnly) {
75
+ let packageName;
76
+ if (options.packageOnly === true) {
77
+ packageName = 'graph-deployment.zip';
78
+ }
79
+ else {
80
+ packageName = options.packageOnly;
81
+ }
82
+ // Determine the destination path (handle both absolute and relative paths)
83
+ const destinationPath = path.isAbsolute(packageName)
84
+ ? packageName
85
+ : path.join(process.cwd(), packageName);
86
+ // Copy from temp location to destination
87
+ fs.copyFileSync(outputPath, destinationPath);
88
+ ui.success(`✅ Graph packaged successfully: ${destinationPath}`);
89
+ process.exit(0);
90
+ }
91
+ ui.success(`✅ Graph packaged successfully: ${outputPath}`);
92
+ ui.print(` Size: ${(archive.pointer() / 1024).toFixed(2)} KB`);
93
+ console.log();
94
+ ui.print('Deployment should take around 5 minutes, please be patient.');
95
+ ui.print('Deploying...');
96
+ console.log();
97
+ resolve();
98
+ });
99
+ archive.on('error', (err) => {
100
+ reject(err);
101
+ });
102
+ output.on('error', (err) => {
103
+ reject(err);
104
+ });
105
+ });
106
+ archive.pipe(output);
107
+ // Add the bundled graph file
108
+ const graphFileName = path.basename(file).replace('.ts', '.js');
109
+ archive.append(bundledCode, { name: graphFileName });
110
+ // Process and add package.json
111
+ const packageJson = processPackageJson(originalPackageJson, graphFileName);
112
+ archive.append(JSON.stringify(packageJson, null, 2), {
113
+ name: 'package.json',
114
+ });
115
+ // Add a README with instructions
116
+ const readme = `# Inworld Graph Deployment
117
+
118
+ This package contains an Inworld Runtime graph ready for deployment.
119
+
120
+ ## Installation
121
+
122
+ \`\`\`bash
123
+ npm install
124
+ \`\`\`
125
+
126
+ ## Running the Graph
127
+
128
+ ### As a server (recommended):
129
+ \`\`\`bash
130
+ inworld serve ${graphFileName}
131
+ \`\`\`
132
+
133
+ ### Direct execution:
134
+ \`\`\`bash
135
+ inworld run ${graphFileName}
136
+ \`\`\`
137
+
138
+ ## Graph File
139
+ - **Bundled File**: ${graphFileName}
140
+ - **Original Source**: ${path.basename(file)}
141
+ - **Package source**: ${path.relative(process.cwd(), packageJsonPath)}
142
+
143
+ ## Notes
144
+ - This graph module has been bundled with all local files (custom nodes, local imports, etc.)
145
+ - NPM packages remain external and will be installed via package.json dependencies
146
+ - The bundle includes all your custom code in a single file for easy deployment
147
+
148
+ ## Requirements
149
+ - Node.js >= 18.0.0
150
+ - @inworld/cli package installed globally or locally
151
+ `;
152
+ archive.append(readme, { name: 'README.md' });
153
+ await archive.finalize();
154
+ await archiveComplete;
155
+ const deployment = await deployGraph(graph.graphId, new Uint8Array(fs.readFileSync(outputPath)));
156
+ if (!deployment) {
157
+ ui.printError('Deployment failed');
158
+ try {
159
+ fs.rmSync(tempBaseDir, { recursive: true, force: true });
160
+ }
161
+ catch { }
162
+ process.exit(1);
163
+ }
164
+ ui.success('Deployment successful!');
165
+ ui.success('Inworld Cloud URI:');
166
+ ui.print(`${PLATFORM_URL.replace('platform', 'api')}/cloud/${graphResourceName}/v1/graph:start`);
167
+ try {
168
+ fs.rmSync(tempBaseDir, { recursive: true, force: true });
169
+ }
170
+ catch (_error) {
171
+ // Silently ignore cleanup errors
172
+ }
173
+ process.exit(0);
174
+ }
175
+ catch (error) {
176
+ ui.printError('Error packaging graph:');
177
+ console.error(error);
178
+ process.exit(1);
179
+ }
180
+ };
181
+ const makeDeployCommand = (description) => {
182
+ return new Command('deploy')
183
+ .description(description)
184
+ .argument('<file>', 'Path to the graph file (e.g., test.ts)')
185
+ .option('-i, --info', 'Shows deployment info if any')
186
+ .option('-p, --package-only [file]', 'Output file path (if not specified, outputs to graph-deployment.zip in current directory)')
187
+ .action(deployAction);
188
+ };
189
+ export const deployCommand = makeDeployCommand('[preview] Packages a graph for deployment to the Inworld Cloud.');
190
+ export const deployCommandAlias = makeDeployCommand(`[preview] Alias for "${ui.bold('inworld graph deploy')}"`);
191
+ //# sourceMappingURL=graph_deploy_command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph_deploy_command.js","sourceRoot":"","sources":["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AkB,GAAG,iBAAiB,CACjD,wBAAwB,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAC3D,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Command } from 'commander';
2
+ export declare const initCommand: Command;
3
+ export declare const initCommandAlias: Command;
4
+ //# sourceMappingURL=graph_init_command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph_init_command.d.ts","sourceRoot":"","sources":["../../../../src/commands/graph/graph_init_command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqfpC,eAAO,MAAM,WAAW,SAEvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,SAE5B,CAAC"}
@@ -0,0 +1,376 @@
1
+ import chalk from 'chalk';
2
+ import { Command } from 'commander';
3
+ import fs from 'fs';
4
+ import path from 'path';
5
+ import * as readline from 'readline';
6
+ import { fileURLToPath } from 'url';
7
+ import { RUNTIME_VERSION } from '@/constants';
8
+ import { confirm } from '@/utils/confirm';
9
+ import { selectItem } from '@/utils/selector';
10
+ import * as ui from '@/utils/ui';
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
13
+ // Resolve template path - check multiple possible locations
14
+ function getTemplatePath() {
15
+ const possiblePaths = [
16
+ // Production: templates are copied to dist/templates (when code is bundled in dist/index.js)
17
+ path.join(__dirname, 'templates'),
18
+ // Development: templates are in src/templates (when running from src/)
19
+ path.join(__dirname, '..', '..', 'templates'),
20
+ // Alternative: if running from nested directory structure
21
+ path.join(__dirname, '..', '..', '..', 'templates'),
22
+ ];
23
+ for (const templatePath of possiblePaths) {
24
+ if (fs.existsSync(templatePath)) {
25
+ return templatePath;
26
+ }
27
+ }
28
+ throw new Error('Template directory not found. Please ensure templates are properly installed.');
29
+ }
30
+ const TEMPLATE_PATH = getTemplatePath();
31
+ /**
32
+ * Load metadata for a template
33
+ */
34
+ function loadTemplateMetadata(templateDir, basePath) {
35
+ const metadataPath = path.join(basePath, templateDir, 'metadata.json');
36
+ if (fs.existsSync(metadataPath)) {
37
+ try {
38
+ return JSON.parse(fs.readFileSync(metadataPath, 'utf-8'));
39
+ }
40
+ catch (err) {
41
+ ui.print(`Failed to parse metadata for ${templateDir}: ${err}`);
42
+ }
43
+ }
44
+ // Return default metadata if file doesn't exist
45
+ return {
46
+ name: templateDir,
47
+ displayName: templateDir
48
+ .replace(/_/g, ' ')
49
+ .replace(/\b\w/g, (c) => c.toUpperCase()),
50
+ description: `${templateDir} template`,
51
+ tags: [],
52
+ defaultProjectName: templateDir,
53
+ };
54
+ }
55
+ /**
56
+ * Get available templates with their metadata
57
+ */
58
+ function getAvailableTemplatesWithMetadata() {
59
+ const templates = [];
60
+ try {
61
+ const entries = fs.readdirSync(TEMPLATE_PATH, { withFileTypes: true });
62
+ const templateDirs = entries
63
+ .filter((entry) => entry.isDirectory())
64
+ .filter((dir) => {
65
+ // Check if the directory contains a graph.ts file
66
+ const graphPath = path.join(TEMPLATE_PATH, dir.name, 'graph.ts');
67
+ return fs.existsSync(graphPath);
68
+ });
69
+ for (const dir of templateDirs) {
70
+ const metadata = loadTemplateMetadata(dir.name, TEMPLATE_PATH);
71
+ if (metadata) {
72
+ templates.push({
73
+ directory: dir.name,
74
+ metadata,
75
+ });
76
+ }
77
+ }
78
+ }
79
+ catch (_err) {
80
+ // Continue to next path if there's an error
81
+ }
82
+ return templates;
83
+ }
84
+ /**
85
+ * Ask user to confirm npm install
86
+ */
87
+ async function promptNpmInstall() {
88
+ return confirm({
89
+ message: '\n📦 Would you like to install dependencies now? (y/n) ',
90
+ defaultValue: false,
91
+ });
92
+ }
93
+ /**
94
+ * Run npm install in a directory
95
+ */
96
+ async function runNpmInstall(directory) {
97
+ const { spawn } = await import('child_process');
98
+ return new Promise((resolve, reject) => {
99
+ console.log();
100
+ ui.print('📦 Installing dependencies...');
101
+ console.log();
102
+ const install = spawn('npm', ['install'], {
103
+ cwd: directory,
104
+ stdio: 'inherit',
105
+ shell: true,
106
+ });
107
+ install.on('close', (code) => {
108
+ if (code === 0) {
109
+ console.log();
110
+ ui.success('✅ Dependencies installed successfully!');
111
+ resolve();
112
+ }
113
+ else {
114
+ console.log();
115
+ ui.printError(`❌ npm install failed with code ${code}`);
116
+ reject(new Error(`npm install failed with code ${code}`));
117
+ }
118
+ });
119
+ install.on('error', (err) => {
120
+ console.log();
121
+ ui.printError(`❌ Failed to run npm install: ${err.message}`);
122
+ reject(err);
123
+ });
124
+ });
125
+ }
126
+ /**
127
+ * Process and enhance the package.json for initialization
128
+ */
129
+ function createPackageJson(graphFileName) {
130
+ const packageJson = {
131
+ name: 'inworld-graph-project',
132
+ version: '1.0.0',
133
+ description: 'Inworld Runtime Graph Project',
134
+ main: graphFileName,
135
+ scripts: {
136
+ start: `npx inworld serve ${graphFileName}`,
137
+ run: `npx inworld run ${graphFileName}`,
138
+ },
139
+ dependencies: {
140
+ '@inworld/runtime': RUNTIME_VERSION,
141
+ },
142
+ keywords: ['inworld', 'ai', 'graph', 'runtime'],
143
+ author: '',
144
+ license: 'MIT',
145
+ };
146
+ return packageJson;
147
+ }
148
+ /**
149
+ * Get the graph template content from the templates folder
150
+ */
151
+ function createGraphTemplate(templateName) {
152
+ const availableTemplates = getAvailableTemplatesWithMetadata();
153
+ if (!availableTemplates.find((template) => template.directory === templateName)) {
154
+ throw new Error(`Unknown template: ${templateName}. Available templates: ${availableTemplates
155
+ .map((template) => template.directory)
156
+ .join(', ')}`);
157
+ }
158
+ const templateFilePath = path.join(TEMPLATE_PATH, templateName, 'graph.ts');
159
+ if (!fs.existsSync(templateFilePath)) {
160
+ throw new Error(`Template file not found: ${templateName}/graph.ts. Please ensure the template files are in the templates folder.`);
161
+ }
162
+ return fs.readFileSync(templateFilePath, 'utf-8');
163
+ }
164
+ /**
165
+ * Get README content for the selected template
166
+ */
167
+ function createReadme(templateName, graphFileName) {
168
+ const readmePath = path.join(TEMPLATE_PATH, templateName, 'README.md');
169
+ if (!fs.existsSync(readmePath)) {
170
+ ui.printError(`README file not found: ${readmePath}`);
171
+ process.exit(1);
172
+ }
173
+ const readmeContent = fs.readFileSync(readmePath, 'utf-8');
174
+ // Replace placeholders in the README
175
+ return readmeContent.replace(/\{\{graphFileName\}\}/g, graphFileName);
176
+ }
177
+ // The actual init action handler
178
+ const initAction = async (options) => {
179
+ try {
180
+ // Handle list templates flag
181
+ if (options.listTemplates) {
182
+ const templates = getAvailableTemplatesWithMetadata();
183
+ console.log();
184
+ ui.printHeader('📚 Available templates:');
185
+ console.log();
186
+ for (const template of templates) {
187
+ ui.printListItem(`${chalk.cyan.bold(template.metadata.name)}`);
188
+ ui.printListItem(` ${template.metadata.description}`);
189
+ if (template.metadata.tags && template.metadata.tags.length > 0) {
190
+ ui.printListItem(` Tags: ${template.metadata.tags.join(', ')}`);
191
+ }
192
+ if (template.metadata.requirements?.apiKeys) {
193
+ ui.printListItem(` Required API Keys: ${template.metadata.requirements.apiKeys.join(', ')}`);
194
+ }
195
+ console.log();
196
+ }
197
+ ui.print(`Use ${chalk.bold('inworld graph init')} to interactively select a template.`);
198
+ console.log();
199
+ return;
200
+ }
201
+ // Get available templates with metadata
202
+ const templates = getAvailableTemplatesWithMetadata();
203
+ if (templates.length === 0) {
204
+ ui.printError('❌ No templates found. Please ensure templates are properly installed.');
205
+ process.exit(1);
206
+ }
207
+ let selectedTemplate = null;
208
+ let projectName;
209
+ // Interactive mode if no template specified
210
+ if (!options.template) {
211
+ console.log();
212
+ ui.printHeader('🚀 Welcome to Inworld Graph Project Initializer!');
213
+ console.log();
214
+ // Select template using the selector
215
+ selectedTemplate = await selectItem({
216
+ items: templates,
217
+ getDisplayName: (item) => `${item.metadata.name} - ${item.metadata.description}`,
218
+ getIdentifier: (item) => item.directory,
219
+ prompt: 'Select a template (enter number or id):',
220
+ title: '📋 Available Templates:',
221
+ noItemsMessage: 'No templates found.',
222
+ invalidSelectionMessage: 'Invalid selection. Please try again.',
223
+ });
224
+ if (!selectedTemplate) {
225
+ console.log();
226
+ ui.print('⚠️ No template selected. Exiting.');
227
+ return;
228
+ }
229
+ }
230
+ else {
231
+ // Find template by directory name if specified
232
+ selectedTemplate =
233
+ templates.find((t) => t.directory === options.template) || null;
234
+ if (!selectedTemplate) {
235
+ ui.printError(`❌ Template not found: ${options.template}`);
236
+ ui.print(`Available templates: ${templates.map((t) => t.directory).join(', ')}`);
237
+ process.exit(1);
238
+ }
239
+ }
240
+ // Determine project name
241
+ projectName =
242
+ options.name ||
243
+ selectedTemplate.metadata.defaultProjectName ||
244
+ selectedTemplate.directory;
245
+ // If in interactive mode and no name specified, ask for project name
246
+ if (!options.template && !options.name) {
247
+ const rl = readline.createInterface({
248
+ input: process.stdin,
249
+ output: process.stdout,
250
+ });
251
+ const askProjectName = () => new Promise((resolve) => {
252
+ rl.question(`\nProject name (${selectedTemplate.metadata.defaultProjectName}): `, (answer) => {
253
+ rl.close();
254
+ resolve(answer.trim() || selectedTemplate.metadata.defaultProjectName);
255
+ });
256
+ });
257
+ projectName = await askProjectName();
258
+ }
259
+ const currentDir = process.cwd();
260
+ const projectDir = path.join(currentDir, projectName);
261
+ // Check if project directory already exists
262
+ if (fs.existsSync(projectDir)) {
263
+ console.log();
264
+ ui.print(`⚠️ Directory '${projectName}' already exists.`);
265
+ // In interactive mode, ask for confirmation
266
+ if (!options.template) {
267
+ const confirmOverwrite = await confirm({
268
+ message: 'Do you want to overwrite it? (y/n) ',
269
+ defaultValue: false,
270
+ });
271
+ if (!confirmOverwrite) {
272
+ ui.print('⚠️ Initialization cancelled.');
273
+ return;
274
+ }
275
+ // Remove existing directory
276
+ fs.rmSync(projectDir, { recursive: true, force: true });
277
+ }
278
+ else {
279
+ ui.print('Overwriting existing directory...');
280
+ fs.rmSync(projectDir, { recursive: true, force: true });
281
+ }
282
+ }
283
+ // Create project directory
284
+ fs.mkdirSync(projectDir, { recursive: true });
285
+ const graphFileName = 'graph.ts';
286
+ const graphFilePath = path.join(projectDir, graphFileName);
287
+ const packageJsonPath = path.join(projectDir, 'package.json');
288
+ const readmePath = path.join(projectDir, 'README.md');
289
+ console.log();
290
+ ui.printHeader(`🚀 Initializing Inworld graph project: ${projectName}`);
291
+ ui.print(`📂 Creating project in: ${projectDir}`);
292
+ ui.print(`📋 Using template: ${selectedTemplate.metadata.displayName}`);
293
+ console.log();
294
+ // Create the graph file using the selected template
295
+ ui.print('📝 Creating graph file...');
296
+ const graphContent = createGraphTemplate(selectedTemplate.directory);
297
+ fs.writeFileSync(graphFilePath, graphContent, 'utf-8');
298
+ // Create package.json if not skipped
299
+ if (!options.skipPackageJson) {
300
+ ui.print('📦 Creating package.json...');
301
+ const packageJson = createPackageJson(graphFileName);
302
+ packageJson.name = projectName; // Update project name
303
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf-8');
304
+ }
305
+ // Create README if not skipped
306
+ if (!options.skipReadme) {
307
+ ui.print('📚 Creating README.md...');
308
+ const readmeContent = createReadme(selectedTemplate.directory, graphFileName);
309
+ fs.writeFileSync(readmePath, readmeContent, 'utf-8');
310
+ }
311
+ // Display template-specific information
312
+ if (selectedTemplate.metadata.requirements?.apiKeys) {
313
+ console.log();
314
+ ui.print('⚠️ This template requires the following API keys:');
315
+ for (const key of selectedTemplate.metadata.requirements.apiKeys) {
316
+ ui.print(` • ${key}`);
317
+ }
318
+ }
319
+ if (selectedTemplate.metadata.examples?.curlCommand) {
320
+ console.log();
321
+ ui.printHeader('📝 Example usage:');
322
+ ui.print(` ${selectedTemplate.metadata.examples.curlCommand}`);
323
+ }
324
+ console.log();
325
+ ui.success('✅ Inworld graph project initialized successfully!');
326
+ // Ask about npm install if not skipped
327
+ if (!options.skipInstall && !options.skipPackageJson) {
328
+ const shouldInstall = await promptNpmInstall();
329
+ if (shouldInstall) {
330
+ try {
331
+ await runNpmInstall(projectDir);
332
+ }
333
+ catch (_err) {
334
+ console.log();
335
+ ui.print('⚠️ You can install dependencies manually by running:');
336
+ ui.print(` cd ${projectName} && npm install`);
337
+ }
338
+ }
339
+ }
340
+ console.log();
341
+ ui.printHeader('📌 Next steps:');
342
+ ui.print(` 1. ${chalk.bold(`cd ${projectName}`)}`);
343
+ if (!options.skipInstall) {
344
+ ui.print(` 2. ${chalk.bold('npm install')} (if not already done)`);
345
+ ui.print(` 3. ${chalk.bold('npm start')} or ${chalk.bold('npx inworld serve graph.ts')}`);
346
+ }
347
+ else {
348
+ ui.print(` 2. ${chalk.bold('npm start')} or ${chalk.bold('npx inworld serve graph.ts')}`);
349
+ }
350
+ if (selectedTemplate.metadata.requirements?.apiKeys) {
351
+ console.log();
352
+ ui.print('💡 Remember to set your API keys before running!');
353
+ }
354
+ }
355
+ catch (error) {
356
+ ui.printError('❌ Error initializing project:');
357
+ console.error(error);
358
+ process.exit(1);
359
+ }
360
+ };
361
+ // Create the init subcommand
362
+ const makeInitCommand = (description) => {
363
+ const availableTemplates = getAvailableTemplatesWithMetadata();
364
+ return new Command('init')
365
+ .description(description)
366
+ .option('-n, --name <name>', 'Name of the project directory')
367
+ .option('-t, --template <template>', `Template to use: ${availableTemplates.map((t) => `"${t.directory}"`).join(' or ')}`)
368
+ .option('-l, --list-templates', 'List all available templates')
369
+ .option('--skip-package-json', 'Skip creating package.json file')
370
+ .option('--skip-readme', 'Skip creating README.md file')
371
+ .option('--skip-install', 'Skip npm install prompt')
372
+ .action(initAction);
373
+ };
374
+ export const initCommand = makeInitCommand('Initialize a new Inworld graph project (interactive if no options provided)');
375
+ export const initCommandAlias = makeInitCommand(`Alias for "${chalk.bold('inworld graph init')}"`);
376
+ //# sourceMappingURL=graph_init_command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph_init_command.js","sourceRoot":"","sources":["../../../../src/commands/graph/graph_init_command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,C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MAAM,gBAAgB,GAAG,eAAe,CAC7C,cAAc,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAClD,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * User context attributes as key-value pairs.
4
+ */
5
+ export interface UserContextAttributes {
6
+ [key: string]: string;
7
+ }
8
+ /**
9
+ * User context configuration.
10
+ */
11
+ export interface UserContextInterface {
12
+ /** User attributes as key-value pairs. */
13
+ attributes: UserContextAttributes;
14
+ /** Targeting key for user identification. */
15
+ targetingKey: string;
16
+ }
17
+ export interface ExecutionContext {
18
+ executionId?: string;
19
+ userContext?: UserContextInterface;
20
+ dataStoreContent?: Record<string, any>;
21
+ }
22
+ export declare const runCommand: Command;
23
+ export declare const runCommandAlias: Command;
24
+ //# sourceMappingURL=graph_run_command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph_run_command.d.ts","sourceRoot":"","sources":["../../../../src/commands/graph/graph_run_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,0CAA0C;IAC1C,UAAU,EAAE,qBAAqB,CAAC;IAClC,6CAA6C;IAC7C,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACxC;AAmDD,eAAO,MAAM,UAAU,SAEtB,CAAC;AAEF,eAAO,MAAM,eAAe,SAE3B,CAAC"}