@ludeo/cloud-common 1.2.262-ygbeta1 → 1.2.262

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 (42) hide show
  1. package/dist/tsconfig.tsbuildinfo +1 -1
  2. package/dist/v4/contexts/cloud-session-context.d.ts +0 -1
  3. package/dist/v4/contexts/cloud-session-context.js +0 -5
  4. package/dist/v4/contexts/cloud-session-context.js.map +1 -1
  5. package/dist/v4/events/ludeocast-agent/detect-artifacts-ended.d.ts +15 -0
  6. package/dist/v4/events/ludeocast-agent/detect-artifacts-ended.js +63 -0
  7. package/dist/v4/events/ludeocast-agent/detect-artifacts-ended.js.map +1 -0
  8. package/dist/v4/events/ludeocast-agent/index.d.ts +2 -0
  9. package/dist/v4/events/ludeocast-agent/index.js +2 -0
  10. package/dist/v4/events/ludeocast-agent/index.js.map +1 -1
  11. package/dist/v4/events/ludeocast-agent/save-artifacts-ended.d.ts +13 -0
  12. package/dist/v4/events/ludeocast-agent/save-artifacts-ended.js +53 -0
  13. package/dist/v4/events/ludeocast-agent/save-artifacts-ended.js.map +1 -0
  14. package/dist/v4/events/site-controller/detect-artifacts.command.d.ts +13 -0
  15. package/dist/v4/events/site-controller/detect-artifacts.command.js +51 -0
  16. package/dist/v4/events/site-controller/detect-artifacts.command.js.map +1 -0
  17. package/dist/v4/events/site-controller/index.d.ts +2 -0
  18. package/dist/v4/events/site-controller/index.js +2 -0
  19. package/dist/v4/events/site-controller/index.js.map +1 -1
  20. package/dist/v4/events/site-controller/save-artifacts.command.d.ts +14 -0
  21. package/dist/v4/events/site-controller/save-artifacts.command.js +52 -0
  22. package/dist/v4/events/site-controller/save-artifacts.command.js.map +1 -0
  23. package/dist/v4/types/cloud/allocation-data.d.ts +1 -1
  24. package/dist/v4/types/cloud/allocation-data.js +2 -2
  25. package/dist/v4/types/cloud/allocation-data.js.map +1 -1
  26. package/dist/v4/types/site-controller/runtime-artifacts.dto.d.ts +12 -4
  27. package/dist/v4/types/site-controller/runtime-artifacts.dto.js +41 -10
  28. package/dist/v4/types/site-controller/runtime-artifacts.dto.js.map +1 -1
  29. package/dist/v4/types/site-controller/types.d.ts +6 -0
  30. package/dist/v4/types/site-controller/types.js +21 -1
  31. package/dist/v4/types/site-controller/types.js.map +1 -1
  32. package/package.json +1 -1
  33. package/src/v4/contexts/cloud-session-context.ts +0 -4
  34. package/src/v4/events/ludeocast-agent/detect-artifacts-ended.ts +48 -0
  35. package/src/v4/events/ludeocast-agent/index.ts +3 -1
  36. package/src/v4/events/ludeocast-agent/save-artifacts-ended.ts +38 -0
  37. package/src/v4/events/site-controller/detect-artifacts.command.ts +50 -0
  38. package/src/v4/events/site-controller/index.ts +2 -0
  39. package/src/v4/events/site-controller/save-artifacts.command.ts +39 -0
  40. package/src/v4/types/cloud/allocation-data.ts +2 -2
  41. package/src/v4/types/site-controller/runtime-artifacts.dto.ts +47 -8
  42. package/src/v4/types/site-controller/types.ts +20 -0
@@ -99,8 +99,4 @@ export class CloudSessionContext {
99
99
  @IsOptional()
100
100
  @IsString()
101
101
  machineClass?: string;
102
-
103
- @IsOptional()
104
- @IsString()
105
- instanceType: string;
106
102
  }
@@ -0,0 +1,48 @@
1
+ import { IsBoolean, IsEnum, IsObject, IsOptional, IsString, IsUUID } from 'class-validator';
2
+ import { ValidateNestedType } from '../../../decorators';
3
+ import { ArtifactKeyParts } from '../../types/site-controller/types';
4
+ import { BaseCommandPayload } from '../base/base';
5
+ import { AGENT_STRING, WILDCARD_MQTT_STRING } from '../base/constants';
6
+ import { SiteOperationStatus } from '../../types/site-controller';
7
+
8
+ const DETECT_ARTIFACTS_ENDED = 'detect-artifacts-ended';
9
+
10
+ /** Agent → site-controller: scan finished after `detect-artifacts` (machine-scoped topic; game-scoped correlation). */
11
+ export class DetectArtifactsEndedPayload extends BaseCommandPayload {
12
+ @IsUUID()
13
+ gameResourceId: string;
14
+
15
+ @IsEnum(SiteOperationStatus)
16
+ status: SiteOperationStatus;
17
+
18
+ @IsOptional()
19
+ @IsString()
20
+ reason?: string;
21
+
22
+ /** Parent prefix under cache root (echo of `detect-artifacts` command). */
23
+ @IsString()
24
+ artifactPrefix: string;
25
+
26
+ /** Bundle version scanned (echo of `detect-artifacts` command `latestVersion`). */
27
+ @IsString()
28
+ latestVersion: string;
29
+
30
+ /** Echo of `detect-artifacts` `forceReport`. Auto-upload only when true. */
31
+ @IsOptional()
32
+ @IsBoolean()
33
+ forceReport?: boolean;
34
+
35
+ /** Echo of `detect-artifacts.artifactKeyParts`. */
36
+ @ValidateNestedType(() => ArtifactKeyParts)
37
+ artifactKeyParts: ArtifactKeyParts;
38
+
39
+ @IsOptional()
40
+ @IsObject()
41
+ artifacts?: Record<string, number>;
42
+ }
43
+
44
+ export function getDetectArtifactsEndedTopic(machineResourceId: string): string {
45
+ return `${AGENT_STRING}/${DETECT_ARTIFACTS_ENDED}/${machineResourceId}`;
46
+ }
47
+
48
+ export const DETECT_ARTIFACTS_ENDED_SUBSCRIBE_PATTERN = `$share/site-controller-group/${AGENT_STRING}/${DETECT_ARTIFACTS_ENDED}/${WILDCARD_MQTT_STRING}`;
@@ -1,2 +1,4 @@
1
1
  export * from './resource-update';
2
- export * from './export-logs-ended';
2
+ export * from './export-logs-ended';
3
+ export * from './detect-artifacts-ended';
4
+ export * from './save-artifacts-ended';
@@ -0,0 +1,38 @@
1
+ import { IsEnum, IsOptional, IsString, IsUUID } from 'class-validator';
2
+ import { ValidateNestedType } from '../../../decorators';
3
+ import { ArtifactKeyParts } from '../../types/site-controller/types';
4
+ import { BaseCommandPayload } from '../base/base';
5
+ import { AGENT_STRING, WILDCARD_MQTT_STRING } from '../base/constants';
6
+ import { SiteOperationStatus } from '../../types/site-controller';
7
+
8
+ const SAVE_ARTIFACTS_ENDED = 'save-artifacts-ended';
9
+
10
+ /** Agent → site-controller: result of presigned PUT uploads after `save-artifacts` (machine-scoped topic; game-scoped correlation). */
11
+ export class SaveArtifactsEndedPayload extends BaseCommandPayload {
12
+ @IsUUID()
13
+ gameResourceId: string;
14
+
15
+ @IsEnum(SiteOperationStatus)
16
+ status: SiteOperationStatus;
17
+
18
+ @IsOptional()
19
+ @IsString()
20
+ reason?: string;
21
+
22
+ @IsString()
23
+ artifactPrefix: string;
24
+
25
+ /** Echo of `save-artifacts.targetVersion` — server-minted publish destination the agent uploaded to. */
26
+ @IsString()
27
+ targetVersion: string;
28
+
29
+ /** Echo of `save-artifacts.artifactKeyParts`; site-controller persists registry row with `latestVersion` = `targetVersion` on success. */
30
+ @ValidateNestedType(() => ArtifactKeyParts)
31
+ artifactKeyParts: ArtifactKeyParts;
32
+ }
33
+
34
+ export function getSaveArtifactsEndedTopic(machineResourceId: string): string {
35
+ return `${AGENT_STRING}/${SAVE_ARTIFACTS_ENDED}/${machineResourceId}`;
36
+ }
37
+
38
+ export const SAVE_ARTIFACTS_ENDED_SUBSCRIBE_PATTERN = `$share/site-controller-group/${AGENT_STRING}/${SAVE_ARTIFACTS_ENDED}/${WILDCARD_MQTT_STRING}`;
@@ -0,0 +1,50 @@
1
+ import { IsBoolean, IsOptional, IsString, IsUUID } from 'class-validator';
2
+ import { ValidateNestedType } from '../../../decorators';
3
+ import { ArtifactKeyParts } from '../../types/site-controller/types';
4
+ import { BaseCommand, BaseCommandPayload } from '../base/base';
5
+
6
+ /**
7
+ * MQTT `detect-artifacts` payload. Must include the registry **`artifactKeyParts`** triple (same Redis row as
8
+ * start-game resolution). `gameResourceId` correlates `detect-artifacts-ended`; `machineResourceId` is on
9
+ * {@link BaseCommandPayload}.
10
+ */
11
+ export class DetectArtifactsCommandPayload extends BaseCommandPayload {
12
+ /** Game session this detect pass belongs to (same role as {@link ExportLogsEndedPayload.gameResourceId}). */
13
+ @IsUUID()
14
+ gameResourceId: string;
15
+
16
+ /**
17
+ * Parent prefix under artifact root (excludes `latestVersion`; may include folder segment e.g. `shader-cache/...`
18
+ * — same shape as `{@link RuntimeArtifactsPayload.artifactPrefix}` / adapter responses).
19
+ */
20
+ @IsString()
21
+ artifactPrefix: string;
22
+
23
+ /** Current bundle version segment to list on disk. */
24
+ @IsString()
25
+ latestVersion: string;
26
+
27
+ /**
28
+ * Registry row triple; must match game + machine resources. Echoed on `detect-artifacts-ended` so site-controller
29
+ * can gate auto-save without re-deriving segments.
30
+ */
31
+ @ValidateNestedType(() => ArtifactKeyParts)
32
+ artifactKeyParts: ArtifactKeyParts;
33
+
34
+ /**
35
+ * When true, agent scans `{artifactPrefix}/{latestVersion}` under its artifact cache root and returns keys→sizes on `detect-artifacts-ended`.
36
+ * Use for manual inventory before issuing `save-artifacts`. Default false keeps detect cheap (empty inventory).
37
+ */
38
+ @IsOptional()
39
+ @IsBoolean()
40
+ forceReport?: boolean;
41
+ }
42
+
43
+ export class DetectArtifactsCommand extends BaseCommand<DetectArtifactsCommandPayload> {
44
+ @ValidateNestedType(() => DetectArtifactsCommandPayload)
45
+ payload: DetectArtifactsCommandPayload;
46
+
47
+ constructor(payload: DetectArtifactsCommandPayload) {
48
+ super(payload.machineResourceId, 'detect-artifacts', payload);
49
+ }
50
+ }
@@ -19,3 +19,5 @@ export * from "./terminate-game.command";
19
19
  export * from "./start-game.command";
20
20
  export * from "./shutdown.command";
21
21
  export * from "./export-logs.command";
22
+ export * from "./detect-artifacts.command";
23
+ export * from "./save-artifacts.command";
@@ -0,0 +1,39 @@
1
+ import { IsArray, IsString, IsUUID } from 'class-validator';
2
+ import { ValidateNestedType } from '../../../decorators';
3
+ import { BaseCommand, BaseCommandPayload } from '../base/base';
4
+ import { RuntimeArtifactPresignedUploadDto } from '../../types/site-controller/runtime-artifacts.dto';
5
+ import { ArtifactKeyParts } from '../../types/site-controller/types';
6
+
7
+ /** Machine-scoped PUT pass: `artifactPrefix` + **`targetVersion`** + presigned **`uploads`** per object key. */
8
+ export class SaveArtifactsCommandPayload extends BaseCommandPayload {
9
+ /** Game session this upload pass belongs to (parity with `{@link DetectArtifactsCommandPayload.gameResourceId}`). */
10
+ @IsUUID()
11
+ gameResourceId: string;
12
+
13
+ @IsString()
14
+ artifactPrefix: string;
15
+
16
+ /**
17
+ * Server-minted publish target (semver bump destination). Distinct from on-disk **`latestVersion`** in
18
+ * `detect-artifacts`. Agent must echo this in `save-artifacts-ended.targetVersion`.
19
+ */
20
+ @IsString()
21
+ targetVersion: string;
22
+
23
+ /** Registry triple this publish belongs to. Agent echoes back so site-controller can persist on success. */
24
+ @ValidateNestedType(() => ArtifactKeyParts)
25
+ artifactKeyParts: ArtifactKeyParts;
26
+
27
+ @IsArray()
28
+ @ValidateNestedType(() => RuntimeArtifactPresignedUploadDto)
29
+ uploads: RuntimeArtifactPresignedUploadDto[];
30
+ }
31
+
32
+ export class SaveArtifactsCommand extends BaseCommand<SaveArtifactsCommandPayload> {
33
+ @ValidateNestedType(() => SaveArtifactsCommandPayload)
34
+ payload: SaveArtifactsCommandPayload;
35
+
36
+ constructor(payload: SaveArtifactsCommandPayload) {
37
+ super(payload.machineResourceId, 'save-artifacts', payload);
38
+ }
39
+ }
@@ -10,7 +10,7 @@ export type CloudProviderAllocationData =
10
10
  | MockAllocationData
11
11
  | LudeoCastAllocationData
12
12
  | LudeoCastV2AllocationData;
13
-
13
+
14
14
  export const getAllocationDataType = ({
15
15
  object,
16
16
  property,
@@ -21,7 +21,7 @@ export const getAllocationDataType = ({
21
21
  }
22
22
 
23
23
  if ("signalingURI" in allocationData) {
24
- return LudeoCastV2AllocationData;
24
+ return LudeoCastAllocationData;
25
25
  }
26
26
 
27
27
  return MockAllocationData;
@@ -1,16 +1,26 @@
1
- import { IsArray, IsOptional, IsString } from 'class-validator';
1
+ import { IsArray, IsObject, IsOptional, IsString } from 'class-validator';
2
2
  import { ValidateNestedType } from '../../../decorators/validate-nested-type.decorator';
3
3
 
4
- export class RuntimeArtifactUploadObjectDto {
4
+ /**
5
+ * Single object the client wants PUT URLs for (site-controller → site-adapter HTTP).
6
+ * No URL yet — only key + headers the signer may bind into the signature.
7
+ */
8
+ export class RuntimeArtifactUploadPresignSpecDto {
5
9
  @IsString()
6
10
  key: string;
7
11
 
12
+ /** If set, adapters typically bind this into the presigned PUT; client must repeat on upload. Agent can infer (e.g. `mime`/extension). */
8
13
  @IsOptional()
9
14
  @IsString()
10
15
  contentType?: string;
16
+
17
+ /** Optional custom metadata echoed back when adapters sign with it (S3 / GCS). */
18
+ @IsOptional()
19
+ @IsObject()
20
+ metadata?: Record<string, string>;
11
21
  }
12
22
 
13
- /** Full bucket object key paired with a presigned URL (adapter responses and MQTT `runtimeArtifacts.downloads`). */
23
+ /** Full bucket object key paired with a presigned GET URL (`runtimeArtifacts.downloads`). */
14
24
  export class ObjectKeyUrlPair {
15
25
  @IsString()
16
26
  key: string;
@@ -19,6 +29,35 @@ export class ObjectKeyUrlPair {
19
29
  url: string;
20
30
  }
21
31
 
32
+ /**
33
+ * Presigned PUT target (adapter reply, MQTT `save-artifacts.uploads`): full key, URL, echoed header binding.
34
+ *
35
+ * `key` is the **destination** object key (bound into the signed PUT URL). When `sourceKey` is set, the
36
+ * agent reads the file body from that cache-root-relative path instead of `key` — used by site-controller
37
+ * when destination version (`{prefix}/{targetVersion}/...`) differs from the agent's on-disk version.
38
+ */
39
+ export class RuntimeArtifactPresignedUploadDto {
40
+ @IsString()
41
+ key: string;
42
+
43
+ @IsString()
44
+ url: string;
45
+
46
+ /** Optional cache-root-relative read path for the agent (defaults to `key` when omitted). */
47
+ @IsOptional()
48
+ @IsString()
49
+ sourceKey?: string;
50
+
51
+ /** Echo of spec / signer — agent MUST send matching `Content-Type` on PUT when present. */
52
+ @IsOptional()
53
+ @IsString()
54
+ contentType?: string;
55
+
56
+ @IsOptional()
57
+ @IsObject()
58
+ metadata?: Record<string, string>;
59
+ }
60
+
22
61
  export class RuntimeArtifactsDownloadUrlsRequestDto {
23
62
  /** Client-relative parent path inside the artifact root (no trailing `latestVersion`; no artifact-folder prefix — adapters add RUNTIME_ARTIFACTS_FOLDER). */
24
63
  @IsString()
@@ -30,8 +69,8 @@ export class RuntimeArtifactsDownloadUrlsRequestDto {
30
69
 
31
70
  export class RuntimeArtifactsUploadUrlsRequestDto {
32
71
  @IsArray()
33
- @ValidateNestedType(() => RuntimeArtifactUploadObjectDto)
34
- objects: RuntimeArtifactUploadObjectDto[];
72
+ @ValidateNestedType(() => RuntimeArtifactUploadPresignSpecDto)
73
+ objects: RuntimeArtifactUploadPresignSpecDto[];
35
74
  }
36
75
 
37
76
  export class RuntimeArtifactsDownloadUrlsResponseDto {
@@ -44,8 +83,8 @@ export class RuntimeArtifactsDownloadUrlsResponseDto {
44
83
  artifactPrefix: string;
45
84
  }
46
85
 
47
- export class RuntimeArtifactsUploadUrlsResponseDto {
86
+ export class RuntimeArtifactsUploadsResponseDto {
48
87
  @IsArray()
49
- @ValidateNestedType(() => ObjectKeyUrlPair)
50
- urls: ObjectKeyUrlPair[];
88
+ @ValidateNestedType(() => RuntimeArtifactPresignedUploadDto)
89
+ uploads: RuntimeArtifactPresignedUploadDto[];
51
90
  }
@@ -11,6 +11,18 @@ export enum MachineMode {
11
11
  PROTON_V2 = "proton-v2",
12
12
  }
13
13
 
14
+ /** Segments for Redis / storage artifact row: `{gameVersionId}#{gpuType}#{driverVersion}`. */
15
+ export class ArtifactKeyParts {
16
+ @IsString()
17
+ gameVersionId: string;
18
+
19
+ @IsString()
20
+ gpuType: string;
21
+
22
+ @IsString()
23
+ driverVersion: string;
24
+ }
25
+
14
26
  /** Shader / runtime artifact bundle (site-controller may fill when ENABLE_RUNTIME_ARTIFACTS is true). */
15
27
  export class RuntimeArtifactsPayload {
16
28
  @IsString()
@@ -26,6 +38,14 @@ export class RuntimeArtifactsPayload {
26
38
  */
27
39
  @IsString()
28
40
  artifactPrefix: string;
41
+
42
+ /**
43
+ * Registry row key (`ArtifactKeyParts`). Site-controller sets this when resolving artifacts for start-game
44
+ * so the agent can echo it on `detect-artifacts-ended` without recomputing segments.
45
+ */
46
+ @IsOptional()
47
+ @ValidateNestedType(() => ArtifactKeyParts)
48
+ artifactKeyParts?: ArtifactKeyParts;
29
49
  }
30
50
 
31
51
  export class ProtonGameCreationPayload {