@dcl/sdk-commands 7.31.1-40962203448.commit-c68a75f → 7.31.1-41472004640.commit-3147448

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 (97) hide show
  1. package/README.md +15 -0
  2. package/dist/commands/scene-insights/actions.d.ts +63 -0
  3. package/dist/commands/scene-insights/actions.js +106 -0
  4. package/dist/commands/scene-insights/actions.js.map +1 -0
  5. package/dist/commands/scene-insights/client.d.ts +51 -0
  6. package/dist/commands/scene-insights/client.js +294 -0
  7. package/dist/commands/scene-insights/client.js.map +1 -0
  8. package/dist/commands/scene-insights/format.d.ts +23 -0
  9. package/dist/commands/scene-insights/format.js +143 -0
  10. package/dist/commands/scene-insights/format.js.map +1 -0
  11. package/dist/commands/scene-insights/index.d.ts +51 -0
  12. package/dist/commands/scene-insights/index.js +312 -0
  13. package/dist/commands/scene-insights/index.js.map +1 -0
  14. package/dist/commands/scene-insights/inputs.d.ts +49 -0
  15. package/dist/commands/scene-insights/inputs.js +166 -0
  16. package/dist/commands/scene-insights/inputs.js.map +1 -0
  17. package/dist/commands/scene-insights/session-store.d.ts +42 -0
  18. package/dist/commands/scene-insights/session-store.js +131 -0
  19. package/dist/commands/scene-insights/session-store.js.map +1 -0
  20. package/dist/commands/scene-insights/session.d.ts +42 -0
  21. package/dist/commands/scene-insights/session.js +97 -0
  22. package/dist/commands/scene-insights/session.js.map +1 -0
  23. package/dist/commands/scene-insights/sign-in.d.ts +48 -0
  24. package/dist/commands/scene-insights/sign-in.js +116 -0
  25. package/dist/commands/scene-insights/sign-in.js.map +1 -0
  26. package/dist/commands/scene-insights/types.d.ts +61 -0
  27. package/dist/commands/scene-insights/types.js +4 -0
  28. package/dist/commands/scene-insights/types.js.map +1 -0
  29. package/dist/commands/sdk-server-logs/index.d.ts +24 -0
  30. package/dist/commands/sdk-server-logs/index.js +313 -0
  31. package/dist/commands/sdk-server-logs/index.js.map +1 -0
  32. package/dist/commands/start/dcl-env.d.ts +16 -0
  33. package/dist/commands/start/dcl-env.js +51 -0
  34. package/dist/commands/start/dcl-env.js.map +1 -0
  35. package/dist/commands/start/index.d.ts +1 -0
  36. package/dist/commands/start/index.js +24 -6
  37. package/dist/commands/start/index.js.map +1 -1
  38. package/dist/commands/start/multiplayer-server.d.ts +35 -0
  39. package/dist/commands/start/multiplayer-server.js +244 -0
  40. package/dist/commands/start/multiplayer-server.js.map +1 -0
  41. package/dist/commands/start/server/routes.d.ts +1 -1
  42. package/dist/commands/start/server/routes.js +6 -2
  43. package/dist/commands/start/server/routes.js.map +1 -1
  44. package/dist/commands/start/server/runtime-env.d.ts +84 -0
  45. package/dist/commands/start/server/runtime-env.js +415 -0
  46. package/dist/commands/start/server/runtime-env.js.map +1 -0
  47. package/dist/commands/start/server/storage-service.d.ts +8 -0
  48. package/dist/commands/start/server/storage-service.js +243 -0
  49. package/dist/commands/start/server/storage-service.js.map +1 -0
  50. package/dist/commands/start/utils.d.ts +32 -0
  51. package/dist/commands/start/utils.js +72 -0
  52. package/dist/commands/start/utils.js.map +1 -1
  53. package/dist/commands/storage/env.d.ts +5 -0
  54. package/dist/commands/storage/env.js +86 -0
  55. package/dist/commands/storage/env.js.map +1 -0
  56. package/dist/commands/storage/index.d.ts +26 -0
  57. package/dist/commands/storage/index.js +142 -0
  58. package/dist/commands/storage/index.js.map +1 -0
  59. package/dist/commands/storage/player.d.ts +5 -0
  60. package/dist/commands/storage/player.js +143 -0
  61. package/dist/commands/storage/player.js.map +1 -0
  62. package/dist/commands/storage/scene.d.ts +5 -0
  63. package/dist/commands/storage/scene.js +105 -0
  64. package/dist/commands/storage/scene.js.map +1 -0
  65. package/dist/commands/storage/shared.d.ts +62 -0
  66. package/dist/commands/storage/shared.js +260 -0
  67. package/dist/commands/storage/shared.js.map +1 -0
  68. package/dist/commands/storage/types.d.ts +56 -0
  69. package/dist/commands/storage/types.js +23 -0
  70. package/dist/commands/storage/types.js.map +1 -0
  71. package/dist/components/analytics.d.ts +75 -1
  72. package/dist/components/analytics.js +3 -2
  73. package/dist/components/analytics.js.map +1 -1
  74. package/dist/logic/auth-chain-headers.d.ts +11 -0
  75. package/dist/logic/auth-chain-headers.js +25 -0
  76. package/dist/logic/auth-chain-headers.js.map +1 -0
  77. package/dist/logic/bundle.js +31 -0
  78. package/dist/logic/bundle.js.map +1 -1
  79. package/dist/logic/config.d.ts +1 -0
  80. package/dist/logic/config.js +7 -0
  81. package/dist/logic/config.js.map +1 -1
  82. package/dist/logic/error.d.ts +1 -1
  83. package/dist/logic/error.js.map +1 -1
  84. package/dist/logic/exec.d.ts +1 -0
  85. package/dist/logic/exec.js +2 -2
  86. package/dist/logic/exec.js.map +1 -1
  87. package/dist/logic/lang.js +1 -1
  88. package/dist/logic/lsd-realm.d.ts +5 -0
  89. package/dist/logic/lsd-realm.js +28 -0
  90. package/dist/logic/lsd-realm.js.map +1 -0
  91. package/dist/logic/project-files.js +2 -0
  92. package/dist/logic/project-files.js.map +1 -1
  93. package/dist/logic/scene-validations.d.ts +8 -1
  94. package/dist/logic/scene-validations.js.map +1 -1
  95. package/dist/run-command.js +3 -2
  96. package/dist/run-command.js.map +1 -1
  97. package/package.json +5 -5
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getSession = getSession;
7
+ exports.isLinkerOrigin = isLinkerOrigin;
8
+ exports.setSignInRoutes = setSignInRoutes;
9
+ const fp_future_1 = __importDefault(require("fp-future"));
10
+ const crypto_1 = require("@dcl/crypto");
11
+ const error_1 = require("../../logic/error");
12
+ const routes_1 = require("../../linker-dapp/routes");
13
+ const run_dapp_1 = require("../../run-dapp");
14
+ const session_1 = require("./session");
15
+ const session_store_1 = require("./session-store");
16
+ /**
17
+ * Gets a session to sign requests with, in order:
18
+ * 1. `DCL_PRIVATE_KEY`, signed locally and never saved;
19
+ * 2. the saved session, while it is valid (unless `forceNew`);
20
+ * 3. a new browser signature through the linker dApp, which is then saved.
21
+ *
22
+ * @throws CliError `SCENE_INSIGHTS_SESSION_REQUIRED` when it would have to open the browser but
23
+ * nobody is there to sign (an agent or script): `scene-insights login` has to be run first.
24
+ * @throws CliError `SCENE_INSIGHTS_UNSAFE_SESSION_FILE` when git tracks the session file, before
25
+ * asking for a signature.
26
+ */
27
+ async function getSession(components, label, options) {
28
+ if (process.env.DCL_PRIVATE_KEY) {
29
+ return { session: (0, session_1.createSessionFromPrivateKey)(process.env.DCL_PRIVATE_KEY), source: 'private-key' };
30
+ }
31
+ if (!options.forceNew) {
32
+ const saved = await (0, session_store_1.loadSession)(components, options.file);
33
+ if (saved)
34
+ return { session: saved.session, source: 'saved' };
35
+ if (!options.interactive) {
36
+ throw new error_1.CliError('SCENE_INSIGHTS_SESSION_REQUIRED', 'No signed-in session. Ask the user to run "sdk-commands scene-insights login" (it opens the browser to sign once, for 12 hours), or set DCL_PRIVATE_KEY');
37
+ }
38
+ }
39
+ // before the browser opens: nobody should sign a session that can't be saved
40
+ await (0, session_store_1.assertSessionFileIsNotTracked)(options.file);
41
+ const ephemeralIdentity = (0, session_1.createEphemeralIdentity)();
42
+ const expiration = new Date(Date.now() + session_1.SESSION_MINUTES * 60 * 1000);
43
+ const message = (0, session_1.getInsightsSessionMessage)(ephemeralIdentity.address, expiration);
44
+ const signed = (0, fp_future_1.default)();
45
+ const { router: commonRouter } = (0, routes_1.setRoutes)(components, {
46
+ rootCID: message,
47
+ baseParcel: label.parcel ?? '0,0',
48
+ parcels: [label.parcel ?? '0,0'],
49
+ skipValidations: true,
50
+ debug: !!process.env.DEBUG,
51
+ isWorld: !!label.world,
52
+ world: label.label,
53
+ targetUrl: options.targetUrl,
54
+ action: 'view-logs'
55
+ });
56
+ const router = setSignInRoutes(commonRouter, ephemeralIdentity.address, message, (chain) => signed.resolve(chain));
57
+ components.logger.info(`Sign read-only access to logs, metrics and executions for the next ${session_1.SESSION_MINUTES / 60} hours`);
58
+ components.logger.info('This credential works across Insights environments sharing the insights service identifier, including .org and .zone.');
59
+ const { program } = await (0, run_dapp_1.runDapp)(components, router, { ...options.linkOptions, uri: '/' });
60
+ let authChain;
61
+ try {
62
+ authChain = await signed;
63
+ }
64
+ finally {
65
+ void program.stop();
66
+ }
67
+ const validated = await crypto_1.Authenticator.validateSignature(ephemeralIdentity.address.toLowerCase(), authChain, null, Date.now(), { service: session_1.INSIGHTS_SERVICE });
68
+ if (!validated.ok || !validated.scope) {
69
+ throw new error_1.CliError('SCENE_INSIGHTS_INVALID_SIGNATURE', 'The wallet did not return a valid scoped insights login');
70
+ }
71
+ expiration.setTime(Math.min(expiration.getTime(), validated.scope.expiration));
72
+ await (0, session_store_1.saveSession)(components, options.file, ephemeralIdentity, expiration, authChain);
73
+ return { session: (0, session_1.createSessionFromChain)(ephemeralIdentity, expiration, authChain), source: 'signed' };
74
+ }
75
+ const LOOPBACK_HOSTNAMES = ['localhost', '127.0.0.1', '[::1]'];
76
+ /**
77
+ * Whether a request comes from the linker dApp's own page. The browser sets Origin and Host, so
78
+ * another page open in it (or a rebinding domain) can't pass for the dApp.
79
+ */
80
+ function isLinkerOrigin(origin, host) {
81
+ if (!origin || !host)
82
+ return false;
83
+ try {
84
+ const url = new URL(origin);
85
+ return url.host === host && LOOPBACK_HOSTNAMES.includes(url.hostname);
86
+ }
87
+ catch {
88
+ return false;
89
+ }
90
+ }
91
+ /**
92
+ * The linker dApp posts `view-logs` signatures to `/api/logs`. Only its own page is accepted: any
93
+ * other page could sign the message with its own wallet and sign the CLI in as that address.
94
+ */
95
+ function setSignInRoutes(router, ephemeralAddress, message, onSigned) {
96
+ router.post('/api/logs', async (ctx) => {
97
+ if (!isLinkerOrigin(ctx.request.headers.get('origin'), ctx.request.headers.get('host'))) {
98
+ return { status: 403, body: { success: false, error: 'Sign from the page the CLI opened on localhost' } };
99
+ }
100
+ const value = (await ctx.request.json());
101
+ try {
102
+ if (!value.address || !Array.isArray(value.authChain)) {
103
+ throw new error_1.CliError('SCENE_INSIGHTS_INVALID_SIGNATURE', 'The wallet did not sign the insights session');
104
+ }
105
+ const delegation = await (0, session_1.delegationFromLinkerChain)(value.authChain, ephemeralAddress, message);
106
+ // answer the dApp before its server is stopped
107
+ setTimeout(() => onSigned(delegation), 100);
108
+ return { body: { success: true } };
109
+ }
110
+ catch (e) {
111
+ return { status: 400, body: { success: false, error: e.message } };
112
+ }
113
+ });
114
+ return router;
115
+ }
116
+ //# sourceMappingURL=sign-in.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign-in.js","sourceRoot":"","sources":["../../../src/commands/scene-insights/sign-in.ts"],"names":[],"mappings":";;;;;AAoDA,gCAsEC;AAQD,wCAQC;AAMD,0CAwBC;AAxKD,0DAA8B;AAC9B,wCAAsD;AAItD,6CAA4C;AAC5C,qDAAoE;AACpE,6CAAqD;AACrD,uCASkB;AAClB,mDAAyF;AAuBzF;;;;;;;;;;GAUG;AACI,KAAK,UAAU,UAAU,CAC9B,UAAqE,EACrE,KAAkB,EAClB,OAAuB;IAEvB,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC;QAChC,OAAO,EAAE,OAAO,EAAE,IAAA,qCAA2B,EAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,CAAA;IACrG,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACtB,MAAM,KAAK,GAAG,MAAM,IAAA,2BAAW,EAAC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;QACzD,IAAI,KAAK;YAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;QAE7D,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YACzB,MAAM,IAAI,gBAAQ,CAChB,iCAAiC,EACjC,yJAAyJ,CAC1J,CAA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EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAA;QACpC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAG,CAAW,CAAC,OAAO,EAAE,EAAE,CAAA;QAC/E,CAAC;IACH,CAAC,CAAC,CAAA;IACF,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -0,0 +1,61 @@
1
+ export interface LogEntry {
2
+ id: string;
3
+ timestamp: string;
4
+ level: 'debug' | 'info' | 'warn' | 'error';
5
+ source: 'scene' | 'engine' | 'stderr' | 'unknown';
6
+ executionId: string;
7
+ entityId: string;
8
+ message: string;
9
+ truncated: boolean;
10
+ }
11
+ export interface LogSearchResult {
12
+ sceneKey: string;
13
+ logs: LogEntry[];
14
+ nextCursor: string | null;
15
+ retentionStart: string;
16
+ }
17
+ export interface Execution {
18
+ executionId: string;
19
+ entityId: string;
20
+ firstSeen: string;
21
+ lastSeen: string;
22
+ instanceId: string;
23
+ logLines: number;
24
+ }
25
+ export interface ExecutionsResult {
26
+ sceneKey: string;
27
+ executions: Execution[];
28
+ retentionStart: string;
29
+ }
30
+ export interface MetricName {
31
+ name: string;
32
+ type: 'gauge' | 'sum';
33
+ unit: string;
34
+ }
35
+ export interface MetricNamesResult {
36
+ sceneKey: string;
37
+ from: string;
38
+ to: string;
39
+ metrics: MetricName[];
40
+ }
41
+ export interface GaugePoint {
42
+ t: string;
43
+ avg: number | null;
44
+ max: number | null;
45
+ }
46
+ export interface SumPoint {
47
+ t: string;
48
+ sum: number | null;
49
+ rate: number | null;
50
+ }
51
+ export interface MetricSeries {
52
+ sceneKey: string;
53
+ metric: string;
54
+ type: 'gauge' | 'sum' | null;
55
+ unit: string;
56
+ rateUnit?: string;
57
+ stepSeconds: number;
58
+ from: string;
59
+ to: string;
60
+ points: Array<GaugePoint | SumPoint>;
61
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // Response shapes of multiplayer-scenes-insights-service (its docs/openapi.yaml).
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/commands/scene-insights/types.ts"],"names":[],"mappings":";AAAA,kFAAkF"}
@@ -0,0 +1,24 @@
1
+ import { Result } from 'arg';
2
+ import { CliComponents } from '../../components';
3
+ interface Options {
4
+ args: Result<typeof args>;
5
+ components: CliComponents;
6
+ }
7
+ export declare const args: {
8
+ '--help': BooleanConstructor;
9
+ '-h': string;
10
+ '--dir': StringConstructor;
11
+ '--world': StringConstructor;
12
+ '-w': string;
13
+ '--position': StringConstructor;
14
+ '--target': StringConstructor;
15
+ '-t': string;
16
+ '--port': NumberConstructor;
17
+ '-p': string;
18
+ '--https': BooleanConstructor;
19
+ '--no-browser': BooleanConstructor;
20
+ '-b': string;
21
+ };
22
+ export declare function help(options: Options): void;
23
+ export declare function main(options: Options): Promise<void>;
24
+ export {};
@@ -0,0 +1,313 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.args = void 0;
7
+ exports.help = help;
8
+ exports.main = main;
9
+ const path_1 = require("path");
10
+ const fp_future_1 = __importDefault(require("fp-future"));
11
+ const crypto_1 = require("@dcl/crypto");
12
+ const crypto_2 = require("@dcl/crypto/dist/crypto");
13
+ const eth_connect_1 = require("eth-connect");
14
+ const args_1 = require("../../logic/args");
15
+ const error_1 = require("../../logic/error");
16
+ const beautiful_logs_1 = require("../../logic/beautiful-logs");
17
+ const account_1 = require("../../logic/account");
18
+ const auth_chain_headers_1 = require("../../logic/auth-chain-headers");
19
+ const routes_1 = require("../../linker-dapp/routes");
20
+ const run_dapp_1 = require("../../run-dapp");
21
+ const workspace_validations_1 = require("../../logic/workspace-validations");
22
+ const scene_validations_1 = require("../../logic/scene-validations");
23
+ exports.args = (0, args_1.declareArgs)({
24
+ '--help': Boolean,
25
+ '-h': '--help',
26
+ '--dir': String,
27
+ '--world': String,
28
+ '-w': '--world',
29
+ '--position': String,
30
+ '--target': String,
31
+ '-t': '--target',
32
+ '--port': Number,
33
+ '-p': '--port',
34
+ '--https': Boolean,
35
+ '--no-browser': Boolean,
36
+ '-b': '--no-browser'
37
+ });
38
+ const DEFAULT_SERVER = 'https://multiplayer-server.decentraland.org';
39
+ function help(options) {
40
+ options.components.logger.log(`
41
+ Usage: 'sdk-commands sdk-server-logs [options]'
42
+ Streams real-time logs from the multiplayer server.
43
+ Runs from any directory when --world and/or --position are provided.
44
+ Falls back to scene.json (worldConfiguration.name) when neither is passed.
45
+
46
+ Options:
47
+ -h, --help Displays complete help
48
+ -w, --world [name] World name. When omitted, --position targets Genesis City.
49
+ --position [x,y] Parcel coordinates. Optional for worlds (selects a scene
50
+ in a multi-scene world). Required for Genesis City.
51
+ -t, --target [URL] Target multiplayer server URL (default: ${DEFAULT_SERVER})
52
+ --dir [path] Path to the project directory (used with scene.json fallback)
53
+ -p, --port [port] Select a custom port for the linker dApp
54
+ -b, --no-browser Do not open a new browser window
55
+ --https Use HTTPS for the linker dApp
56
+
57
+ Examples:
58
+ - View logs using the world in the current scene.json:
59
+ $ sdk-commands sdk-server-logs
60
+
61
+ - View logs for a world from any directory:
62
+ $ sdk-commands sdk-server-logs --world myworld.dcl.eth
63
+
64
+ - View logs for a specific scene in a multi-scene world:
65
+ $ sdk-commands sdk-server-logs --world myworld.dcl.eth --position 10,10
66
+
67
+ - View logs for a Genesis City scene (use =value form for negative coords):
68
+ $ sdk-commands sdk-server-logs --position=-125,-96
69
+
70
+ - Connect to a custom server:
71
+ $ sdk-commands sdk-server-logs --world myworld --target https://multiplayer-server.decentraland.zone
72
+
73
+ - Use private key for authentication (no browser):
74
+ $ DCL_PRIVATE_KEY=0x... sdk-commands sdk-server-logs --world myworld
75
+ `);
76
+ }
77
+ function setServerLogsRoutes(router, components, awaitResponse, signCallback) {
78
+ const { logger } = components;
79
+ const resolveLinkerPromise = () => setTimeout(() => awaitResponse.resolve(), 100);
80
+ const rejectLinkerPromise = (e) => setTimeout(() => awaitResponse.reject(e), 100);
81
+ router.post('/api/logs', async (ctx) => {
82
+ const value = (await ctx.request.json());
83
+ if (!value.address || !value.authChain) {
84
+ const errorMessage = `Invalid payload: ${Object.keys(value).join(' - ')}`;
85
+ logger.error(errorMessage);
86
+ resolveLinkerPromise();
87
+ return { status: 400, body: { success: false, error: errorMessage } };
88
+ }
89
+ try {
90
+ await signCallback(value);
91
+ resolveLinkerPromise();
92
+ return { body: { success: true } };
93
+ }
94
+ catch (e) {
95
+ rejectLinkerPromise(e);
96
+ return { status: 400, body: { success: false, error: e.message } };
97
+ }
98
+ });
99
+ return router;
100
+ }
101
+ async function getAddressAndSignature(components, awaitResponse, payload, displayLabel, targetUrl, linkOptions, signCallback) {
102
+ // If DCL_PRIVATE_KEY is set, sign directly without the linker dapp
103
+ if (process.env.DCL_PRIVATE_KEY) {
104
+ const wallet = (0, account_1.createWallet)(process.env.DCL_PRIVATE_KEY);
105
+ const authChain = crypto_1.Authenticator.createSimpleAuthChain(payload, wallet.address, (0, crypto_2.ethSign)((0, eth_connect_1.hexToBytes)(wallet.privateKey), payload));
106
+ const linkerResponse = { authChain, address: wallet.address };
107
+ await signCallback(linkerResponse);
108
+ awaitResponse.resolve();
109
+ return {};
110
+ }
111
+ // Use linker dapp for signing - pass the payload as the rootCID
112
+ const { router: commonRouter } = (0, routes_1.setRoutes)(components, {
113
+ rootCID: payload,
114
+ baseParcel: '0,0',
115
+ parcels: ['0,0'],
116
+ skipValidations: true,
117
+ debug: !!process.env.DEBUG,
118
+ isWorld: true,
119
+ world: displayLabel,
120
+ targetUrl,
121
+ action: 'view-logs'
122
+ });
123
+ const router = setServerLogsRoutes(commonRouter, components, awaitResponse, signCallback);
124
+ components.logger.info('You need to sign to access server logs');
125
+ const { program } = await (0, run_dapp_1.runDapp)(components, router, { ...linkOptions, uri: `/` });
126
+ return { program };
127
+ }
128
+ async function streamLogs(components, logsUrl, authHeaders) {
129
+ const { logger, fetch: fetchComponent } = components;
130
+ logger.info('\nConnecting to server logs...');
131
+ try {
132
+ const response = await fetchComponent.fetch(logsUrl, {
133
+ method: 'GET',
134
+ headers: {
135
+ ...authHeaders,
136
+ Accept: 'text/event-stream'
137
+ }
138
+ });
139
+ if (!response.ok) {
140
+ const errorText = await response.text();
141
+ throw new Error(`Server returned ${response.status}: ${errorText}`);
142
+ }
143
+ const contentType = response.headers.get('content-type') || '';
144
+ if (!contentType.includes('text/event-stream') && !contentType.includes('application/stream')) {
145
+ throw new Error('Server does not support SSE streaming');
146
+ }
147
+ logger.info('Streaming logs in real-time (press CTRL+C to stop)');
148
+ if (response.body) {
149
+ const decoder = new TextDecoder();
150
+ let buffer = '';
151
+ for await (const chunk of response.body) {
152
+ buffer += decoder.decode(chunk, { stream: true });
153
+ const lines = buffer.split('\n');
154
+ buffer = lines.pop() || '';
155
+ for (const line of lines) {
156
+ if (line.trim()) {
157
+ formatAndPrintLog(logger, line);
158
+ }
159
+ }
160
+ }
161
+ }
162
+ logger.info('\n======================= End Scene Logs =======================');
163
+ }
164
+ catch (e) {
165
+ (0, beautiful_logs_1.printError)(logger, 'Failed to stream logs:', e);
166
+ process.exit(1);
167
+ }
168
+ }
169
+ function formatAndPrintLog(logger, log) {
170
+ // If log is a string, try to parse as JSON
171
+ let logObj = log;
172
+ if (typeof log === 'string') {
173
+ try {
174
+ logObj = JSON.parse(log);
175
+ }
176
+ catch {
177
+ // If not JSON, just print the string
178
+ logger.log(log);
179
+ return;
180
+ }
181
+ }
182
+ // Extract common log fields
183
+ const timestamp = logObj.timestamp || logObj.time || new Date().toISOString();
184
+ const level = (logObj.level || logObj.severity || 'INFO').toUpperCase();
185
+ const message = logObj.message || logObj.msg || JSON.stringify(logObj);
186
+ // Format timestamp
187
+ const date = new Date(timestamp);
188
+ const formattedTime = date.toISOString().replace('T', ' ').substring(0, 19);
189
+ // Format the log message with timestamp
190
+ const formattedMessage = `[${formattedTime}] [${level}] ${message}`;
191
+ // Map log levels to logger methods
192
+ const normalizedLevel = level.toLowerCase();
193
+ switch (normalizedLevel) {
194
+ case 'error':
195
+ logger.error(formattedMessage);
196
+ break;
197
+ case 'warn':
198
+ case 'warning':
199
+ logger.warn(formattedMessage);
200
+ break;
201
+ case 'debug':
202
+ logger.debug(formattedMessage);
203
+ break;
204
+ case 'info':
205
+ case 'trace':
206
+ default:
207
+ logger.info(formattedMessage);
208
+ break;
209
+ }
210
+ // If there are additional fields, print them
211
+ const additionalFields = Object.keys(logObj).filter((key) => !['timestamp', 'time', 'level', 'severity', 'message', 'msg'].includes(key));
212
+ if (additionalFields.length > 0) {
213
+ const additional = {};
214
+ additionalFields.forEach((key) => {
215
+ additional[key] = logObj[key];
216
+ });
217
+ logger.log(` ${JSON.stringify(additional)}`);
218
+ }
219
+ }
220
+ function normalizePosition(raw) {
221
+ const match = raw.trim().match(/^(-?\d+)\s*,\s*(-?\d+)$/);
222
+ if (!match) {
223
+ throw new error_1.CliError('SERVER_LOGS_INVALID_POSITION', `Invalid --position "${raw}"; expected "x,y" with integer coordinates`);
224
+ }
225
+ return `${parseInt(match[1], 10)},${parseInt(match[2], 10)}`;
226
+ }
227
+ /**
228
+ * Build the HTTP request shape for the multiplayer-server `/logs` endpoint.
229
+ *
230
+ * Every call targets the same `/logs` route; the server picks the scene from
231
+ * the signed metadata:
232
+ * - worlds → `sceneId: "<world>.dcl.eth"` (+ `parcel` for multi-scene worlds)
233
+ * - Genesis → `parcel: "x,y"` only
234
+ *
235
+ * `parcel` and `realmName` are always set. `realmName` defaults to `"main"` for
236
+ * Genesis, matching the convention used by other signed-fetch emitters
237
+ * (hammurabi worker, unity explorer, kernel).
238
+ */
239
+ function buildLogsRequest(baseURL, world, position) {
240
+ const metadata = JSON.stringify({
241
+ parcel: position ?? '0,0',
242
+ realmName: world ? `${world}.dcl.eth` : 'main',
243
+ ...(world && { sceneId: `${world}.dcl.eth` })
244
+ });
245
+ return {
246
+ logsUrl: `${baseURL}/logs`,
247
+ pathname: '/logs',
248
+ metadata
249
+ };
250
+ }
251
+ async function main(options) {
252
+ const { logger } = options.components;
253
+ const projectRoot = (0, path_1.resolve)(process.cwd(), options.args['--dir'] || '.');
254
+ const positionArg = options.args['--position'];
255
+ const worldArg = options.args['--world'];
256
+ const position = positionArg ? normalizePosition(positionArg) : undefined;
257
+ let world;
258
+ if (worldArg) {
259
+ world = worldArg.replace(/\.dcl\.eth$/i, '');
260
+ }
261
+ else if (!position) {
262
+ // no --world nor --position: fall back to scene.json in the current directory
263
+ await (0, workspace_validations_1.getValidWorkspace)(options.components, projectRoot);
264
+ const sceneJson = await (0, scene_validations_1.getValidSceneJson)(options.components, projectRoot);
265
+ const worldName = sceneJson.worldConfiguration?.name;
266
+ if (!worldName) {
267
+ throw new error_1.CliError('SERVER_LOGS_MISSING_WORLD', 'Provide --world (with optional --position) for worlds, or --position alone for Genesis City scenes. ' +
268
+ 'Alternatively, run from a project whose scene.json defines worldConfiguration.name.');
269
+ }
270
+ world = worldName.replace(/\.dcl\.eth$/i, '');
271
+ }
272
+ const displayLabel = world
273
+ ? position
274
+ ? `${world}.dcl.eth ${position}`
275
+ : `${world}.dcl.eth`
276
+ : `Genesis City ${position}`;
277
+ logger.info(`Viewing logs for ${displayLabel}`);
278
+ const baseURL = options.args['--target'] || DEFAULT_SERVER;
279
+ const { logsUrl, pathname, metadata } = buildLogsRequest(baseURL, world, position);
280
+ // Linker dApp options
281
+ const linkerPort = options.args['--port'];
282
+ const openBrowser = !options.args['--no-browser'];
283
+ const isHttps = !!options.args['--https'];
284
+ const linkOptions = { linkerPort, openBrowser, isHttps };
285
+ const awaitResponse = (0, fp_future_1.default)();
286
+ const timestamp = String(Date.now());
287
+ // Build the payload to sign: method:path:timestamp:metadata
288
+ const payload = ['get', pathname, timestamp, metadata].join(':').toLowerCase();
289
+ let authHeaders = {};
290
+ const { program } = await getAddressAndSignature(options.components, awaitResponse, payload, displayLabel, baseURL, linkOptions, async (linkerResponse) => {
291
+ authHeaders = (0, auth_chain_headers_1.createAuthChainHeaders)(linkerResponse.authChain, timestamp, metadata);
292
+ });
293
+ try {
294
+ await awaitResponse;
295
+ logger.info('Authentication successful!');
296
+ // Close the browser window
297
+ if (program) {
298
+ await program.stop();
299
+ }
300
+ // Start streaming logs
301
+ await streamLogs(options.components, logsUrl, authHeaders);
302
+ }
303
+ catch (e) {
304
+ (0, beautiful_logs_1.printError)(logger, 'Failed to authenticate:', e);
305
+ throw e;
306
+ }
307
+ finally {
308
+ if (program) {
309
+ void program.stop();
310
+ }
311
+ }
312
+ }
313
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/sdk-server-logs/index.ts"],"names":[],"mappings":";;;;;;AA2CA,oBAqCC;AA2OD,oBAmFC;AA9YD,+BAA8B;AAE9B,0DAA2C;AAC3C,wCAA2C;AAC3C,oDAAiD;AACjD,6CAAwC;AAIxC,2CAA8C;AAE9C,6CAA4C;AAC5C,+DAAuD;AACvD,iDAAkD;AAClD,uEAAuE;AACvE,qDAAoE;AACpE,6CAAqD;AACrD,6EAAqE;AACrE,qEAAiE;AAOpD,QAAA,IAAI,GAAG,IAAA,kBAAW,EAAC;IAC9B,QAAQ,EAAE,OAAO;IACjB,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,MAAM;IACf,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,SAAS;IACf,YAAY,EAAE,MAAM;IACpB,UAAU,EAAE,MAAM;IAClB,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,OAAO;IAClB,cAAc,EAAE,OAAO;IACvB,IAAI,EAAE,cAAc;CACrB,CAAC,CAAA;AAEF,MAAM,cAAc,GAAG,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AA2B,EAAE,CAAA;IAE5C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,sBAAsB,CAC9C,OAAO,CAAC,UAAU,EAClB,aAAa,EACb,OAAO,EACP,YAAY,EACZ,OAAO,EACP,WAAW,EACX,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,WAAW,GAAG,IAAA,2CAAsB,EAAC,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAA;IACrF,CAAC,CACF,CAAA;IAED,IAAI,CAAC;QACH,MAAM,aAAa,CAAA;QACnB,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAA;QAEzC,2BAA2B;QAC3B,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,OAAO,CAAC,IAAI,EAAE,CAAA;QACtB,CAAC;QAED,uBAAuB;QACvB,MAAM,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,EAAE,WAAW,CAAC,CAAA;IAC5D,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAA,2BAAU,EAAC,MAAM,EAAE,yBAAyB,EAAE,CAAU,CAAC,CAAA;QACzD,MAAM,CAAC,CAAA;IACT,CAAC;YAAS,CAAC;QACT,IAAI,OAAO,EAAE,CAAC;YACZ,KAAK,OAAO,CAAC,IAAI,EAAE,CAAA;QACrB,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare function webExplorerBaseUrl(dclenv: string): string;
2
+ /** Extra query params for the web client under a non-default environment. */
3
+ export declare function webExplorerEnvParams(dclenv: string): string;
4
+ /**
5
+ * Environment args for the locally-spawned engine. `--base-domain` re-points every backend
6
+ * host the engine composes, Pulse included; the gatekeeper pin is the temporary exception.
7
+ */
8
+ export declare function engineEnvArgs(dclenv: string): string[];
9
+ /** Pulse endpoint for deep-linked native clients (ENet); undefined = the client's default. */
10
+ export declare function pulseServerNative(dclenv: string): string | undefined;
11
+ /**
12
+ * Pulse params for the mobile preview deep link: the LSD realm key — stated explicitly so a
13
+ * phone-side explorer can join the partition without re-deriving it — plus the environment's
14
+ * Pulse endpoint when it is not the production default.
15
+ */
16
+ export declare function lsdDeepLinkPulseParams(projectRoot: string, dclenv: string): string;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.webExplorerBaseUrl = webExplorerBaseUrl;
4
+ exports.webExplorerEnvParams = webExplorerEnvParams;
5
+ exports.engineEnvArgs = engineEnvArgs;
6
+ exports.pulseServerNative = pulseServerNative;
7
+ exports.lsdDeepLinkPulseParams = lsdDeepLinkPulseParams;
8
+ // Everything `--dclenv` selects for the preview lives here. The default (org) needs no
9
+ // overrides. Zone runs its OWN Pulse server with identical realm names, so a zone preview
10
+ // must land every party on it: the zone-hosted web client and a --base-domain zone engine
11
+ // derive `pulse-server.decentraland.zone` themselves (bevy-explorer#1224); only parties
12
+ // with no zone base domain — native clients launched by deep link — need it stated.
13
+ const lsd_realm_1 = require("../../logic/lsd-realm");
14
+ function webExplorerBaseUrl(dclenv) {
15
+ // bevy-web is deployed on decentraland.org and decentraland.zone only; the zone page
16
+ // resolves its base domain from its own host, which re-points its Pulse fallback too
17
+ return `https://decentraland.${dclenv === 'zone' ? 'zone' : 'org'}/bevy-web/`;
18
+ }
19
+ // TEMPORARY: the preview gatekeeper has no zone deployment yet, so zone launches pin that
20
+ // one service back to org — server and web client alike — or scene-room minting fails.
21
+ // Drop both pins once comms-gatekeeper-local is deployed on zone.
22
+ const ORG_PREVIEW_GATEKEEPER = 'https://comms-gatekeeper-local.decentraland.org';
23
+ /** Extra query params for the web client under a non-default environment. */
24
+ function webExplorerEnvParams(dclenv) {
25
+ if (dclenv !== 'zone')
26
+ return '';
27
+ return `&previewGatekeeper=${encodeURIComponent(ORG_PREVIEW_GATEKEEPER)}`;
28
+ }
29
+ /**
30
+ * Environment args for the locally-spawned engine. `--base-domain` re-points every backend
31
+ * host the engine composes, Pulse included; the gatekeeper pin is the temporary exception.
32
+ */
33
+ function engineEnvArgs(dclenv) {
34
+ if (dclenv !== 'zone')
35
+ return [];
36
+ return ['--base-domain=decentraland.zone', `--preview-gatekeeper=${ORG_PREVIEW_GATEKEEPER}`];
37
+ }
38
+ /** Pulse endpoint for deep-linked native clients (ENet); undefined = the client's default. */
39
+ function pulseServerNative(dclenv) {
40
+ return dclenv === 'zone' ? 'pulse-server.decentraland.zone:7777' : undefined;
41
+ }
42
+ /**
43
+ * Pulse params for the mobile preview deep link: the LSD realm key — stated explicitly so a
44
+ * phone-side explorer can join the partition without re-deriving it — plus the environment's
45
+ * Pulse endpoint when it is not the production default.
46
+ */
47
+ function lsdDeepLinkPulseParams(projectRoot, dclenv) {
48
+ const server = pulseServerNative(dclenv);
49
+ return `&pulse-realm=${encodeURIComponent((0, lsd_realm_1.lsdRealmKey)(projectRoot))}` + (server ? `&pulse-server=${server}` : '');
50
+ }
51
+ //# sourceMappingURL=dcl-env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dcl-env.js","sourceRoot":"","sources":["../../../src/commands/start/dcl-env.ts"],"names":[],"mappings":";;AAOA,gDAIC;AAQD,oDAGC;AAMD,sCAGC;AAGD,8CAEC;AAOD,wDAGC;AA9CD,uFAAuF;AACvF,0FAA0F;AAC1F,0FAA0F;AAC1F,wFAAwF;AACxF,oFAAoF;AACpF,qDAAmD;AAEnD,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,qFAAqF;IACrF,qFAAqF;IACrF,OAAO,wBAAwB,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,YAAY,CAAA;AAC/E,CAAC;AAED,0FAA0F;AAC1F,uFAAuF;AACvF,kEAAkE;AAClE,MAAM,sBAAsB,GAAG,iDAAiD,CAAA;AAEhF,6EAA6E;AAC7E,SAAgB,oBAAoB,CAAC,MAAc;IACjD,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,EAAE,CAAA;IAChC,OAAO,sBAAsB,kBAAkB,CAAC,sBAAsB,CAAC,EAAE,CAAA;AAC3E,CAAC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAC,MAAc;IAC1C,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,EAAE,CAAA;IAChC,OAAO,CAAC,iCAAiC,EAAE,wBAAwB,sBAAsB,EAAE,CAAC,CAAA;AAC9F,CAAC;AAED,8FAA8F;AAC9F,SAAgB,iBAAiB,CAAC,MAAc;IAC9C,OAAO,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,qCAAqC,CAAC,CAAC,CAAC,SAAS,CAAA;AAC9E,CAAC;AAED;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,WAAmB,EAAE,MAAc;IACxE,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAA;IACxC,OAAO,gBAAgB,kBAAkB,CAAC,IAAA,uBAAW,EAAC,WAAW,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AACnH,CAAC"}
@@ -38,6 +38,7 @@ export declare const args: {
38
38
  '--multi-instance': BooleanConstructor;
39
39
  '--asset-bundles': BooleanConstructor;
40
40
  '--no-client': BooleanConstructor;
41
+ '--no-server': BooleanConstructor;
41
42
  '--mcp': BooleanConstructor;
42
43
  '--mcp-port': NumberConstructor;
43
44
  };