@playcraft/cli 0.1.59-beta → 0.1.61-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.
- package/dist/cli-root-help.js +1 -0
- package/dist/commands/references.js +55 -0
- package/dist/index.js +21 -3
- package/dist/project-skills/builtin-import.js +2 -2
- package/dist/references/client.js +69 -0
- package/dist/references/messages.js +57 -0
- package/dist/references/protocol.js +32 -0
- package/dist/skill-registry/messages.js +2 -2
- package/dist/skill-registry/platform-package.js +2 -4
- package/dist/workspace-runtime/batch/control.js +3 -3
- package/dist/workspace-runtime/batch/deliver.js +4 -3
- package/dist/workspace-runtime/batch/generate.js +3 -2
- package/dist/workspace-runtime/batch/install-log.js +49 -0
- package/dist/workspace-runtime/batch/prepare.js +29 -13
- package/dist/workspace-runtime/batch/processes.js +86 -14
- package/dist/workspace-runtime/batch/writer-proof.js +2 -2
- package/dist/workspace-runtime/codex/app-server.js +52 -2
- package/dist/workspace-runtime/codex/config-toml.js +9 -5
- package/dist/workspace-runtime/codex/delivery-tools.js +3 -10
- package/dist/workspace-runtime/codex/launcher-client.js +46 -24
- package/dist/workspace-runtime/codex/model-broker.js +42 -5
- package/dist/workspace-runtime/codex/production-skill-tools.js +95 -0
- package/dist/workspace-runtime/codex/remix-references-broker.js +184 -0
- package/dist/workspace-runtime/codex/scheduled-task-tools.js +80 -0
- package/dist/workspace-runtime/processes/skill-command.js +130 -0
- package/dist/workspace-runtime/serve.js +9 -1
- package/dist/workspace-runtime/server/accept-operation.js +10 -1
- package/dist/workspace-runtime/server/directory-access.js +10 -3
- package/dist/workspace-runtime/server/dispatch.js +40 -1
- package/dist/workspace-runtime/server/http.js +39 -4
- package/dist/workspace-runtime/server/operation-record.js +4 -1
- package/dist/workspace-runtime/workspaces/dependencies.js +35 -10
- package/dist/workspace-runtime/workspaces/developer-command.js +65 -64
- package/dist/workspace-runtime/workspaces/directories.js +4 -1
- package/dist/workspace-runtime/workspaces/empty-template.js +5 -1
- package/dist/workspace-runtime/workspaces/platform-export.js +3 -3
- package/dist/workspace-runtime/workspaces/procedural-3d/candidate.js +129 -0
- package/dist/workspace-runtime/workspaces/procedural-3d/contracts.js +34 -0
- package/dist/workspace-runtime/workspaces/procedural-3d/files.js +83 -0
- package/dist/workspace-runtime/workspaces/procedural-3d/host.js +595 -0
- package/dist/workspace-runtime/workspaces/procedural-3d/render-worker.js +159 -0
- package/dist/workspace-runtime/workspaces/procedural-3d/review-contracts.js +257 -0
- package/dist/workspace-runtime/workspaces/procedural-3d/review-page.js +26 -0
- package/dist/workspace-runtime/workspaces/remix-reference-skill.js +126 -0
- package/dist/workspace-runtime/workspaces/scheduled-task-proposals.js +27 -0
- package/dist/workspace-runtime/workspaces/skill-execution-context.js +69 -0
- package/dist/workspace-runtime/workspaces/skills.js +18 -6
- package/package.json +3 -3
- package/project-template/.claude/skills/playcraft-remix-references/SKILL.md +45 -0
- package/project-template/.claude/skills/playcraft-runtime-parameters/SKILL.md +0 -2
- package/project-template-v2/.claude/skills/playcraft-remix-references/SKILL.md +45 -0
- package/project-template-v2/.playcraft/skills.lock.json +14 -0
- package/project-templates/empty/AGENTS.md +19 -0
- package/project-templates/phaser/.claude/skills/playcraft-remix-references/SKILL.md +45 -0
- package/project-templates/threejs/.claude/skills/playcraft-remix-references/SKILL.md +45 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const requestSchema = z
|
|
3
|
+
.object({
|
|
4
|
+
action: z.enum([
|
|
5
|
+
'describe',
|
|
6
|
+
'preflight',
|
|
7
|
+
'prepare',
|
|
8
|
+
'status',
|
|
9
|
+
'recover',
|
|
10
|
+
'next',
|
|
11
|
+
'run-step',
|
|
12
|
+
'request-correction',
|
|
13
|
+
'capture',
|
|
14
|
+
'review',
|
|
15
|
+
'adopt',
|
|
16
|
+
]),
|
|
17
|
+
runId: z.string().uuid().optional(),
|
|
18
|
+
expectedRevision: z.number().int().nonnegative().optional(),
|
|
19
|
+
input: z.record(z.unknown()).default({}),
|
|
20
|
+
})
|
|
21
|
+
.strict();
|
|
22
|
+
export const captureSchema = z
|
|
23
|
+
.object({
|
|
24
|
+
pagePath: z.string(),
|
|
25
|
+
files: z.array(z.string()).min(2).max(256),
|
|
26
|
+
sourcePaths: z.array(z.string()).min(1).max(128),
|
|
27
|
+
views: z
|
|
28
|
+
.array(z.enum(['front', 'right', 'back', 'left', 'hero']))
|
|
29
|
+
.min(3)
|
|
30
|
+
.max(5)
|
|
31
|
+
.default(['front', 'right', 'hero']),
|
|
32
|
+
})
|
|
33
|
+
.strict()
|
|
34
|
+
.refine((input) => new Set(input.views).size === input.views.length && input.views.includes('hero'));
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import { lstat, mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { dirname, join, resolve } from 'node:path';
|
|
4
|
+
import { ensureSharedDirectory, writeSharedFile } from '../shared-write.js';
|
|
5
|
+
export const digest = (data) => createHash('sha256').update(data).digest('hex');
|
|
6
|
+
export function relativeFile(value) {
|
|
7
|
+
if (!value ||
|
|
8
|
+
value.length > 512 ||
|
|
9
|
+
value.includes('\\') ||
|
|
10
|
+
value.includes('\0') ||
|
|
11
|
+
value.split('/').some((part) => !part || part === '.' || part === '..') ||
|
|
12
|
+
value.startsWith('/'))
|
|
13
|
+
throw new Error('procedural_skill_invalid_path');
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
export async function checkedFile(root, path, max = 16 * 1024 * 1024) {
|
|
17
|
+
const segments = relativeFile(path).split('/');
|
|
18
|
+
let current = resolve(root);
|
|
19
|
+
const base = await lstat(current);
|
|
20
|
+
if (!base.isDirectory() || base.isSymbolicLink())
|
|
21
|
+
throw new Error('procedural_skill_invalid_path');
|
|
22
|
+
for (let index = 0; index < segments.length; index++) {
|
|
23
|
+
current = join(current, segments[index]);
|
|
24
|
+
const stat = await lstat(current);
|
|
25
|
+
if (stat.isSymbolicLink() ||
|
|
26
|
+
(index < segments.length - 1
|
|
27
|
+
? !stat.isDirectory()
|
|
28
|
+
: !stat.isFile() || stat.nlink !== 1 || stat.size > max))
|
|
29
|
+
throw new Error('procedural_skill_invalid_file');
|
|
30
|
+
}
|
|
31
|
+
return readFile(current);
|
|
32
|
+
}
|
|
33
|
+
export async function snapshotFiles(root, paths) {
|
|
34
|
+
if (!paths.length || paths.length > 256 || new Set(paths).size !== paths.length)
|
|
35
|
+
throw new Error('procedural_skill_invalid_files');
|
|
36
|
+
const files = [];
|
|
37
|
+
let size = 0;
|
|
38
|
+
for (const path of [...paths].sort()) {
|
|
39
|
+
const bytes = await checkedFile(root, path);
|
|
40
|
+
size += bytes.length;
|
|
41
|
+
if (size > 64 * 1024 * 1024)
|
|
42
|
+
throw new Error('procedural_skill_size_limit');
|
|
43
|
+
files.push({ path, bytes, hash: digest(bytes) });
|
|
44
|
+
}
|
|
45
|
+
return files;
|
|
46
|
+
}
|
|
47
|
+
export async function verifyFiles(root, files) {
|
|
48
|
+
for (const file of files)
|
|
49
|
+
if (digest(await checkedFile(root, file.path)) !== file.hash)
|
|
50
|
+
throw new Error('procedural_skill_candidate_changed');
|
|
51
|
+
}
|
|
52
|
+
export async function dependencyHash(root) {
|
|
53
|
+
const parts = [];
|
|
54
|
+
for (const name of ['package.json', 'pnpm-lock.yaml', 'package-lock.json', 'yarn.lock']) {
|
|
55
|
+
try {
|
|
56
|
+
parts.push(`${name}:${digest(await checkedFile(root, name, 16 * 1024 * 1024))}`);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
if (error.code !== 'ENOENT')
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (!parts.some((part) => part.startsWith('package.json:')))
|
|
64
|
+
throw new Error('procedural_skill_project_dependencies_missing');
|
|
65
|
+
return digest(parts.join('\n'));
|
|
66
|
+
}
|
|
67
|
+
/** Control-owned provenance is separate from the agent-writable job workspace. */
|
|
68
|
+
export async function writeControlJson(path, value) {
|
|
69
|
+
await mkdir(dirname(path), { recursive: true, mode: 0o700 }); // private
|
|
70
|
+
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
71
|
+
try {
|
|
72
|
+
await writeFile(temporary, JSON.stringify(value), { flag: 'wx', mode: 0o600 }); // private
|
|
73
|
+
await rename(temporary, path);
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
await rm(temporary, { force: true });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export async function copySnapshot(root, target, files) {
|
|
80
|
+
await ensureSharedDirectory(root, target);
|
|
81
|
+
for (const file of files)
|
|
82
|
+
await writeSharedFile(root, join(target, relativeFile(file.path)), file.bytes);
|
|
83
|
+
}
|