@playcraft/cli 0.1.55-beta → 0.1.57-beta

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 (43) hide show
  1. package/dist/assets/client.js +6 -4
  2. package/dist/commands/build.js +38 -0
  3. package/dist/commands/tools-3d.js +15 -0
  4. package/dist/commands/tools-generation.js +3 -2
  5. package/dist/utils/agent-api-client.js +31 -8
  6. package/dist/utils/agent-generation-provenance.js +45 -0
  7. package/dist/utils/generation-workspace-scope.js +50 -0
  8. package/dist/utils/image-generation-retry.js +7 -0
  9. package/dist/utils/tool-operation-journal.js +34 -4
  10. package/dist/workspace-runtime/batch/prepare.js +9 -52
  11. package/dist/workspace-runtime/codex/delivery-tools.js +7 -5
  12. package/dist/workspace-runtime/codex/generation-provenance-broker.js +80 -0
  13. package/dist/workspace-runtime/codex/launcher-client.js +18 -0
  14. package/dist/workspace-runtime/codex/model-broker.js +23 -4
  15. package/dist/workspace-runtime/previews/finalize.js +64 -0
  16. package/dist/workspace-runtime/previews/publish.js +31 -8
  17. package/dist/workspace-runtime/serve.js +8 -30
  18. package/dist/workspace-runtime/server/http.js +5 -5
  19. package/dist/workspace-runtime/workspaces/artifact-events.js +136 -23
  20. package/dist/workspace-runtime/workspaces/artifact-files.js +3 -1
  21. package/dist/workspace-runtime/workspaces/artifact-receipts.js +27 -4
  22. package/dist/workspace-runtime/workspaces/artifacts.js +115 -17
  23. package/dist/workspace-runtime/workspaces/asset-publication-access.js +5 -1
  24. package/dist/workspace-runtime/workspaces/delivery-build.js +97 -7
  25. package/dist/workspace-runtime/workspaces/dependencies.js +24 -10
  26. package/dist/workspace-runtime/workspaces/directory-access.js +13 -0
  27. package/dist/workspace-runtime/workspaces/git.js +13 -0
  28. package/dist/workspace-runtime/workspaces/parameter-assets.js +38 -15
  29. package/dist/workspace-runtime/workspaces/parameters.js +61 -21
  30. package/dist/workspace-runtime/workspaces/platform-export.js +185 -0
  31. package/dist/workspace-runtime/workspaces/theme-asset-index.js +123 -13
  32. package/package.json +3 -3
  33. package/project-template-v2/.playcraft/skills.lock.json +15 -8
  34. package/project-templates/empty/AGENTS.md +1 -1
  35. package/templates/preview-runtime/v1/README.md +12 -0
  36. package/templates/preview-runtime/v1/manifest.json +8 -8
  37. package/templates/preview-runtime/v1/runtime.d.mts +1 -1
  38. package/templates/preview-runtime/v1/runtime.d.ts +1 -1
  39. package/templates/preview-runtime/v1/runtime.mjs +591 -54
  40. package/templates/preview-runtime/v1/types/adapters.d.ts +6 -1
  41. package/templates/preview-runtime/v1/types/preview.d.ts +2 -0
  42. package/templates/preview-runtime/v1/types/protocol.d.ts +56 -0
  43. package/templates/preview-runtime/v1/types/runtime.d.ts +2 -1
@@ -1,4 +1,4 @@
1
- import type { FieldCapability, RawDocuments } from './protocol.js';
1
+ import type { FieldCapability, ImageResourceRequest, RawDocuments } from './protocol.js';
2
2
  export interface ApplyContext<C> {
3
3
  beforeConfig: C;
4
4
  config: C;
@@ -6,6 +6,7 @@ export interface ApplyContext<C> {
6
6
  fields: FieldCapability[];
7
7
  signal: AbortSignal;
8
8
  assertCurrent(): void;
9
+ loadImage(field: FieldCapability, value: string): Promise<HTMLImageElement>;
9
10
  }
10
11
  /** All callbacks must check cancellation before late asynchronous side effects. */
11
12
  export interface GameAdapter<C> {
@@ -23,4 +24,8 @@ export interface RuntimeOptions<C> {
23
24
  install(config: C): unknown;
24
25
  };
25
26
  createGame(context: ApplyContext<C>): Promise<GameAdapter<C>>;
27
+ loadImage?(request: ImageResourceRequest, signal: AbortSignal): Promise<HTMLImageElement | {
28
+ image: HTMLImageElement;
29
+ contentHash?: string;
30
+ }>;
26
31
  }
@@ -1,5 +1,6 @@
1
1
  import type { RuntimeOptions } from './adapters.js';
2
2
  import type { SessionBinding } from './protocol.js';
3
+ export { ResourceLoadError } from './protocol.js';
3
4
  /** Reads only the platform's explicit context; a game receives no platform credentials. */
4
5
  export declare function readWorkspacePreviewContext(expectedContractVersion: string): {
5
6
  binding: SessionBinding;
@@ -12,6 +13,7 @@ export declare function connectPreviewRuntime<C>(options: RuntimeOptions<C> & {
12
13
  hello(value: unknown): import("./protocol.js").Capabilities;
13
14
  snapshot(value: unknown): import("./protocol.js").Receipt;
14
15
  patch(value: unknown): import("./protocol.js").Receipt;
16
+ refreshImages(value: unknown): import("./protocol.js").ImageRefreshReceipt;
15
17
  restart(value: unknown): import("./protocol.js").Receipt;
16
18
  status(value: unknown): import("./protocol.js").ApplicationResult;
17
19
  subscribe(fn: (result: import("./protocol.js").ApplicationResult) => void): () => boolean;
@@ -30,11 +30,14 @@ export interface FieldCapability {
30
30
  effectivePath: string[];
31
31
  groupId: string;
32
32
  mode: ApplyMode;
33
+ resource?: 'image';
33
34
  }
34
35
  export interface Capabilities extends Identity {
35
36
  stage: 'bootstrap-ready' | 'game-ready';
36
37
  canAcceptSnapshot: boolean;
37
38
  fields: FieldCapability[];
39
+ canRefreshImages?: true;
40
+ canReportMissingImages?: true;
38
41
  }
39
42
  export type Operation = {
40
43
  op: 'set';
@@ -60,6 +63,20 @@ export interface Receipt {
60
63
  accepted: true;
61
64
  receivedRevision: number;
62
65
  }
66
+ export type ImageRefreshTarget = {
67
+ documentId: string;
68
+ path: string[];
69
+ /** Null reports a confirmed missing file; it does not clear the configured image. */
70
+ contentHash: string | null;
71
+ };
72
+ export interface ImageRefreshRequest extends Identity {
73
+ draftRevision: number;
74
+ resourceSequence: number;
75
+ images: ImageRefreshTarget[];
76
+ }
77
+ export interface ImageRefreshReceipt extends Receipt {
78
+ resourceSequence: number;
79
+ }
63
80
  export interface GroupResult {
64
81
  groupId: string;
65
82
  appliedRevision: number;
@@ -73,6 +90,42 @@ export interface ApplicationResult extends Identity {
73
90
  status: 'idle' | 'applying' | 'applied' | 'pending-commit' | 'requires-reload' | 'error';
74
91
  groups: GroupResult[];
75
92
  error?: string;
93
+ recoverable?: true;
94
+ resourceErrors?: Array<{
95
+ documentId: string;
96
+ path: string[];
97
+ error: string;
98
+ }>;
99
+ }
100
+ export interface ImageResourceRequest extends Identity {
101
+ draftRevision: number;
102
+ documentId: string;
103
+ path: string[];
104
+ value: string;
105
+ resourceSequence?: number;
106
+ expectedContentHash?: string;
107
+ }
108
+ export type ImageResourceData = {
109
+ mimeType: string;
110
+ dataUrl: string;
111
+ contentHash?: string;
112
+ };
113
+ export type ImageResourceResponse = ImageResourceRequest & (({
114
+ status: 'ready';
115
+ } & ImageResourceData) | {
116
+ status: 'failed';
117
+ error: string;
118
+ } | {
119
+ status: 'stale';
120
+ });
121
+ export declare const MAX_IMAGE_RESOURCE_BYTES: number;
122
+ /** Loading failures retain the last rendered image and allow another parameter patch. */
123
+ export declare class ResourceLoadError extends Error {
124
+ constructor(message: string);
125
+ }
126
+ /** A newer value replaced this resource while it was being prepared. */
127
+ export declare class SupersededResourceError extends Error {
128
+ constructor();
76
129
  }
77
130
  export declare class ProtocolError extends Error {
78
131
  readonly code: string;
@@ -88,6 +141,9 @@ export declare function assertIdentity(value: unknown): asserts value is Identit
88
141
  export declare function sameIdentity(a: Identity, b: unknown): b is Identity;
89
142
  export declare function assertBinding(expected: SessionBinding, actual: Hello): void;
90
143
  export declare function assertDocuments(value: unknown): asserts value is RawDocuments;
144
+ export declare function assertImageResourceRequest(value: unknown): asserts value is ImageResourceRequest;
145
+ export declare function assertImageRefresh(value: unknown): asserts value is ImageRefreshRequest;
146
+ export declare function assertImageResourceData(value: unknown): asserts value is ImageResourceData;
91
147
  export declare function assertSnapshot(value: unknown): asserts value is SnapshotRequest;
92
148
  export declare function assertPatch(value: unknown): asserts value is PatchRequest;
93
149
  export declare function applyOperations(documents: RawDocuments, operations: Operation[]): RawDocuments;
@@ -1,9 +1,10 @@
1
1
  import type { RuntimeOptions } from './adapters.js';
2
- import type { ApplicationResult, Capabilities, Receipt } from './protocol.js';
2
+ import type { ApplicationResult, Capabilities, ImageRefreshReceipt, Receipt } from './protocol.js';
3
3
  export declare function createParameterRuntime<C>(options: RuntimeOptions<C>): {
4
4
  hello(value: unknown): Capabilities;
5
5
  snapshot(value: unknown): Receipt;
6
6
  patch(value: unknown): Receipt;
7
+ refreshImages(value: unknown): ImageRefreshReceipt;
7
8
  restart(value: unknown): Receipt;
8
9
  status(value: unknown): ApplicationResult;
9
10
  subscribe(fn: (result: ApplicationResult) => void): () => boolean;