@playcraft/cli 0.1.54 → 0.1.55-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/README.md +83 -15
- package/SKILLS_REGISTRY.md +149 -0
- package/dist/agent/local-backend.js +1 -1
- package/dist/assets/client.js +157 -0
- package/dist/assets/messages.js +48 -0
- package/dist/auth/account-activation.js +157 -0
- package/dist/auth/messages.js +30 -0
- package/dist/cli-root-help.js +4 -0
- package/dist/commands/assets.js +123 -0
- package/dist/commands/build-all.js +5 -19
- package/dist/commands/build-temp.js +26 -0
- package/dist/commands/build.js +15 -28
- package/dist/commands/create.js +26 -33
- package/dist/commands/image-layer-messages.js +37 -0
- package/dist/commands/image-layer-tools.js +185 -0
- package/dist/commands/image.js +2 -73
- package/dist/commands/library-messages.js +46 -0
- package/dist/commands/library.js +130 -0
- package/dist/commands/login.js +84 -42
- package/dist/commands/platform-skills.generated.js +19 -0
- package/dist/commands/playable.js +53 -0
- package/dist/commands/preview-runtime.js +21 -0
- package/dist/commands/skills.js +4 -0
- package/dist/commands/tools-3d.js +11 -0
- package/dist/commands/tools-batch.js +113 -0
- package/dist/commands/tools-generation.js +6 -0
- package/dist/commands/tools.js +2 -0
- package/dist/commands/video.js +122 -0
- package/dist/commands/workspace-runtime.js +54 -0
- package/dist/commands/workspace.js +40 -0
- package/dist/config.js +59 -4
- package/dist/index.js +47 -3
- package/dist/preview-runtime/distribution.js +77 -0
- package/dist/project-skills/builtin-import.js +225 -0
- package/dist/project-skills/commands.js +77 -0
- package/dist/project-skills/lifecycle.js +28 -0
- package/dist/project-skills/local-run.js +112 -0
- package/dist/project-skills/local-store.js +221 -0
- package/dist/project-skills/messages.js +80 -0
- package/dist/project-skills/reconcile.js +62 -0
- package/dist/project-skills/remote-cache.js +51 -0
- package/dist/project-skills/validation.js +19 -0
- package/dist/recording/messages.js +40 -0
- package/dist/recording/project-digest.js +85 -0
- package/dist/recording/recorder.js +293 -0
- package/dist/recording/scenario.js +50 -0
- package/dist/remix/clone.js +2 -0
- package/dist/remix/init-template.js +2 -0
- package/dist/remix/pull.js +2 -0
- package/dist/remix/push.js +21 -1
- package/dist/skill-registry/client.js +345 -0
- package/dist/skill-registry/commands.js +180 -0
- package/dist/skill-registry/evaluation-client.js +156 -0
- package/dist/skill-registry/evaluation-commands.js +174 -0
- package/dist/skill-registry/messages.js +177 -0
- package/dist/skill-registry/package.js +275 -0
- package/dist/skill-registry/platform-package.js +100 -0
- package/dist/utils/agent-api-client.js +245 -30
- package/dist/utils/environment-endpoints.js +17 -0
- package/dist/utils/error-diagnostics.js +20 -0
- package/dist/utils/playcraft-http-client.js +6 -4
- package/dist/utils/tool-operation-journal.js +124 -0
- package/dist/utils/video-evidence-git.js +81 -0
- package/dist/video-replication/client.js +234 -0
- package/dist/video-replication/comparison-evidence.js +149 -0
- package/dist/video-replication/comparison-files.js +57 -0
- package/dist/video-replication/comparison-log.js +72 -0
- package/dist/video-replication/comparison-messages.js +104 -0
- package/dist/video-replication/comparison-output.js +63 -0
- package/dist/video-replication/comparison-preflight.js +66 -0
- package/dist/video-replication/comparison.js +230 -0
- package/dist/video-replication/diagnostics.js +41 -0
- package/dist/video-replication/evidence.js +165 -0
- package/dist/video-replication/media.js +112 -0
- package/dist/video-replication/messages.js +97 -0
- package/dist/workspace/messages.js +67 -0
- package/dist/workspace/transfer-client.js +237 -0
- package/dist/workspace/transfer-errors.js +48 -0
- package/dist/workspace-runtime/batch/content-changes.js +30 -0
- package/dist/workspace-runtime/batch/control.js +86 -0
- package/dist/workspace-runtime/batch/deliver.js +173 -0
- package/dist/workspace-runtime/batch/freeze.js +101 -0
- package/dist/workspace-runtime/batch/generate.js +249 -0
- package/dist/workspace-runtime/batch/git.js +40 -0
- package/dist/workspace-runtime/batch/occupancy.js +8 -0
- package/dist/workspace-runtime/batch/policy.js +70 -0
- package/dist/workspace-runtime/batch/prepare.js +317 -0
- package/dist/workspace-runtime/batch/processes.js +72 -0
- package/dist/workspace-runtime/batch/records.js +113 -0
- package/dist/workspace-runtime/batch/routes.js +61 -0
- package/dist/workspace-runtime/batch/source-candidate.js +86 -0
- package/dist/workspace-runtime/batch/source-capture.js +146 -0
- package/dist/workspace-runtime/batch/source-failure.js +43 -0
- package/dist/workspace-runtime/batch/source-publish.js +130 -0
- package/dist/workspace-runtime/codex/app-server.js +1065 -0
- package/dist/workspace-runtime/codex/compact.js +46 -0
- package/dist/workspace-runtime/codex/config-toml.js +107 -0
- package/dist/workspace-runtime/codex/delivery-tools.js +144 -0
- package/dist/workspace-runtime/codex/jsonrpc-stdio.js +145 -0
- package/dist/workspace-runtime/codex/launcher-client.js +177 -0
- package/dist/workspace-runtime/codex/loopback.js +146 -0
- package/dist/workspace-runtime/codex/mcp-config.js +39 -0
- package/dist/workspace-runtime/codex/model-broker.js +263 -0
- package/dist/workspace-runtime/codex/native-adapter.js +9 -0
- package/dist/workspace-runtime/codex/permissions.js +79 -0
- package/dist/workspace-runtime/codex/thread-image.js +38 -0
- package/dist/workspace-runtime/codex/tool-response.js +10 -0
- package/dist/workspace-runtime/codex/ui-instructions.js +4 -0
- package/dist/workspace-runtime/codex/ui-tools.js +203 -0
- package/dist/workspace-runtime/codex/work-mode.js +15 -0
- package/dist/workspace-runtime/main.js +10 -0
- package/dist/workspace-runtime/persistence/journal.js +365 -0
- package/dist/workspace-runtime/persistence/native-subagents.js +162 -0
- package/dist/workspace-runtime/persistence/sqlite-client.js +77 -0
- package/dist/workspace-runtime/persistence/sqlite-worker.js +1161 -0
- package/dist/workspace-runtime/persistence/stopped-execution.js +77 -0
- package/dist/workspace-runtime/previews/diagnostics.js +44 -0
- package/dist/workspace-runtime/previews/output.js +36 -0
- package/dist/workspace-runtime/previews/publish.js +283 -0
- package/dist/workspace-runtime/previews/runtime-preview.js +251 -0
- package/dist/workspace-runtime/previews/single-file.js +43 -0
- package/dist/workspace-runtime/processes/managed-writes.js +69 -0
- package/dist/workspace-runtime/serve.js +441 -0
- package/dist/workspace-runtime/server/accept-operation.js +61 -0
- package/dist/workspace-runtime/server/asset-transfers.js +63 -0
- package/dist/workspace-runtime/server/auth.js +21 -0
- package/dist/workspace-runtime/server/connectivity.js +211 -0
- package/dist/workspace-runtime/server/desktop-host.js +429 -0
- package/dist/workspace-runtime/server/desktop-preview-config.js +81 -0
- package/dist/workspace-runtime/server/desktop-preview-service.js +157 -0
- package/dist/workspace-runtime/server/desktop-preview-static.js +53 -0
- package/dist/workspace-runtime/server/desktop-preview.js +189 -0
- package/dist/workspace-runtime/server/dispatch.js +1655 -0
- package/dist/workspace-runtime/server/endpoints.js +21 -0
- package/dist/workspace-runtime/server/execution-group.js +90 -0
- package/dist/workspace-runtime/server/http.js +1363 -0
- package/dist/workspace-runtime/server/lock.js +53 -0
- package/dist/workspace-runtime/server/operation-record.js +33 -0
- package/dist/workspace-runtime/server/rfb-watch-gate.js +168 -0
- package/dist/workspace-runtime/server/session-restore.js +84 -0
- package/dist/workspace-runtime/server/source-uploader.js +138 -0
- package/dist/workspace-runtime/server/submit-operation.js +41 -0
- package/dist/workspace-runtime/server/terminal-host.js +366 -0
- package/dist/workspace-runtime/server/types.js +1 -0
- package/dist/workspace-runtime/server/workspace-transfer.js +168 -0
- package/dist/workspace-runtime/verify-artifact.js +59 -0
- package/dist/workspace-runtime/workspaces/append-only-log.js +62 -0
- package/dist/workspace-runtime/workspaces/archive.js +207 -0
- package/dist/workspace-runtime/workspaces/artifact-events.js +55 -0
- package/dist/workspace-runtime/workspaces/artifact-files.js +199 -0
- package/dist/workspace-runtime/workspaces/artifact-receipts.js +89 -0
- package/dist/workspace-runtime/workspaces/artifacts.js +282 -0
- package/dist/workspace-runtime/workspaces/asset-library-import.js +387 -0
- package/dist/workspace-runtime/workspaces/asset-publication-access.js +25 -0
- package/dist/workspace-runtime/workspaces/asset-transfer-dependencies.js +81 -0
- package/dist/workspace-runtime/workspaces/asset-transfer-publish.js +438 -0
- package/dist/workspace-runtime/workspaces/asset-transfer-storage.js +389 -0
- package/dist/workspace-runtime/workspaces/attachment-content.js +73 -0
- package/dist/workspace-runtime/workspaces/attachments.js +185 -0
- package/dist/workspace-runtime/workspaces/batch-commit.js +142 -0
- package/dist/workspace-runtime/workspaces/binary-content.js +65 -0
- package/dist/workspace-runtime/workspaces/binary-write.js +117 -0
- package/dist/workspace-runtime/workspaces/cli-context.js +23 -0
- package/dist/workspace-runtime/workspaces/cli-credentials.js +115 -0
- package/dist/workspace-runtime/workspaces/composer-context.js +147 -0
- package/dist/workspace-runtime/workspaces/context-error.js +2 -0
- package/dist/workspace-runtime/workspaces/delivery-build.js +331 -0
- package/dist/workspace-runtime/workspaces/delivery-store.js +168 -0
- package/dist/workspace-runtime/workspaces/delivery.js +64 -0
- package/dist/workspace-runtime/workspaces/dependencies.js +279 -0
- package/dist/workspace-runtime/workspaces/developer-command.js +98 -0
- package/dist/workspace-runtime/workspaces/directories.js +135 -0
- package/dist/workspace-runtime/workspaces/directory-access.js +37 -0
- package/dist/workspace-runtime/workspaces/directory-attachments.js +245 -0
- package/dist/workspace-runtime/workspaces/directory-create.js +57 -0
- package/dist/workspace-runtime/workspaces/directory-maintenance.js +111 -0
- package/dist/workspace-runtime/workspaces/directory-mutations.js +238 -0
- package/dist/workspace-runtime/workspaces/directory-revisions.js +56 -0
- package/dist/workspace-runtime/workspaces/directory-stats.js +49 -0
- package/dist/workspace-runtime/workspaces/disk-snapshot.js +31 -0
- package/dist/workspace-runtime/workspaces/empty-template.js +43 -0
- package/dist/workspace-runtime/workspaces/file-content.js +48 -0
- package/dist/workspace-runtime/workspaces/files-search.js +116 -0
- package/dist/workspace-runtime/workspaces/files.js +150 -0
- package/dist/workspace-runtime/workspaces/git-credential-broker.js +312 -0
- package/dist/workspace-runtime/workspaces/git-credential-helper.js +68 -0
- package/dist/workspace-runtime/workspaces/git-direct-store.js +155 -0
- package/dist/workspace-runtime/workspaces/git.js +670 -0
- package/dist/workspace-runtime/workspaces/instructions.js +56 -0
- package/dist/workspace-runtime/workspaces/json5-edit.js +313 -0
- package/dist/workspace-runtime/workspaces/library-attachments.js +268 -0
- package/dist/workspace-runtime/workspaces/operation-log.js +23 -0
- package/dist/workspace-runtime/workspaces/optional-platform-skills.js +14 -0
- package/dist/workspace-runtime/workspaces/parameter-agent-inputs.js +97 -0
- package/dist/workspace-runtime/workspaces/parameter-agent-protocol.js +40 -0
- package/dist/workspace-runtime/workspaces/parameter-agent-store.js +58 -0
- package/dist/workspace-runtime/workspaces/parameter-agent.js +284 -0
- package/dist/workspace-runtime/workspaces/parameter-assets.js +189 -0
- package/dist/workspace-runtime/workspaces/parameters.js +329 -0
- package/dist/workspace-runtime/workspaces/prepare.js +284 -0
- package/dist/workspace-runtime/workspaces/registry.js +251 -0
- package/dist/workspace-runtime/workspaces/remix-references.js +301 -0
- package/dist/workspace-runtime/workspaces/revisions.js +31 -0
- package/dist/workspace-runtime/workspaces/session-image.js +104 -0
- package/dist/workspace-runtime/workspaces/shared-git.js +40 -0
- package/dist/workspace-runtime/workspaces/skill-artifact-loader.js +95 -0
- package/dist/workspace-runtime/workspaces/skills.js +191 -0
- package/dist/workspace-runtime/workspaces/theme-asset-index.js +157 -0
- package/dist/workspace-runtime/workspaces/transfer-quota.js +69 -0
- package/dist/workspace-runtime/workspaces/transfer.js +471 -0
- package/dist/workspace-runtime/workspaces/turn-changes.js +75 -0
- package/dist/workspace-runtime/workspaces/video-attachments.js +49 -0
- package/dist/workspace-runtime/workspaces/worktree-attachments.js +74 -0
- package/dist/workspace-runtime/workspaces/worktree-checkout.js +67 -0
- package/dist/workspace-runtime/workspaces/worktrees.js +73 -0
- package/package.json +16 -5
- package/project-template/.claude/skills/playcraft-audio-generation/SKILL.md +31 -4
- package/project-template/.claude/skills/playcraft-image-generation/SKILL.md +36 -5
- package/project-template/.claude/skills/playcraft-image-generation/reference/build-sprite-sheet.template.mjs +1 -1
- package/project-template/.claude/skills/playcraft-image-generation/reference/compare-style.template.mjs +1 -1
- package/project-template/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +1 -1
- package/project-template/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +1 -1
- package/project-template/.claude/skills/playcraft-image-generation/reference/gen-edit-variants.template.mjs +1 -1
- package/project-template/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +1 -1
- package/project-template/.claude/skills/playcraft-image-generation/reference/ta-image-generation-detail.md +300 -0
- package/project-template/.claude/skills/playcraft-image-generation/reference/validate-sprite-sheet.template.mjs +1 -1
- package/project-template/.claude/skills/playcraft-image-processing/SKILL.md +50 -25
- package/project-template/.claude/skills/playcraft-replica-validation/SKILL.md +25 -0
- package/project-template/.claude/skills/playcraft-replica-validation/references/contracts.md +79 -0
- package/project-template/.claude/skills/playcraft-video-understanding/SKILL.md +29 -0
- package/project-template/.claude/skills/playcraft-video-understanding/references/contracts.md +37 -0
- package/project-template/.claude/skills/playcraft-workspace-assets/SKILL.md +53 -0
- package/project-template/.claude/skills/playcraft-workspace-assets/references/requests.json +32 -0
- package/project-template-v2/.claude/agents/artist.md +82 -0
- package/project-template-v2/.claude/agents/developer.md +153 -0
- package/project-template-v2/.claude/agents/game-designer.md +264 -0
- package/project-template-v2/.claude/agents/refs/artist-art-style-catalog.md +533 -0
- package/project-template-v2/.claude/agents/refs/artist-color-audio-recipes.md +153 -0
- package/project-template-v2/.claude/agents/refs/artist-dimension-axis.md +27 -0
- package/project-template-v2/.claude/agents/refs/artist-master-composite-recipes.md +208 -0
- package/project-template-v2/.claude/agents/refs/atom-skill-library.md +81 -0
- package/project-template-v2/.claude/agents/refs/developer-impl-cookbook.md +432 -0
- package/project-template-v2/.claude/agents/refs/framework-5-component-filter.md +252 -0
- package/project-template-v2/.claude/agents/refs/framework-game-feel-juice.md +266 -0
- package/project-template-v2/.claude/agents/refs/framework-mda.md +147 -0
- package/project-template-v2/.claude/agents/refs/game-designer-gameplay-sufficiency.md +123 -0
- package/project-template-v2/.claude/agents/refs/ta-3d-flip-recipe.md +88 -0
- package/project-template-v2/.claude/agents/refs/ta-atlas-deliverable-standard.md +67 -0
- package/project-template-v2/.claude/agents/refs/ta-batch-pipeline-recipes.md +120 -0
- package/project-template-v2/.claude/agents/refs/ta-image-generation-detail.md +300 -0
- package/project-template-v2/.claude/agents/refs/ta-image-ops-reference.md +495 -0
- package/project-template-v2/.claude/agents/refs/ta-pipeline-cookbook.md +1141 -0
- package/project-template-v2/.claude/agents/refs/ta-tools-reference.md +111 -0
- package/project-template-v2/.claude/agents/refs/ta-vfx-preset-catalog.md +365 -0
- package/project-template-v2/.claude/agents/refs/threejs-cannon-pitfalls.md +412 -0
- package/project-template-v2/.claude/agents/reviewer.md +75 -0
- package/project-template-v2/.claude/agents/technical-artist.md +86 -0
- package/project-template-v2/.claude/hooks/snapshot-milestone.mjs +243 -0
- package/project-template-v2/.claude/hooks/user-prompt.mjs +133 -0
- package/project-template-v2/.claude/settings.json +33 -0
- package/project-template-v2/.claude/skills/brainstorming/SKILL.md +161 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/frame-template.html +270 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/helper.js +177 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/server.cjs +354 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/start-server.sh +148 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/stop-server.sh +56 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/wait-for-selection.sh +62 -0
- package/project-template-v2/.claude/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/project-template-v2/.claude/skills/brainstorming/visual-companion.md +309 -0
- package/project-template-v2/.claude/skills/playcraft-ad-psychology/SKILL.md +182 -0
- package/project-template-v2/.claude/skills/playcraft-art-style-guide/SKILL.md +123 -0
- package/project-template-v2/.claude/skills/playcraft-asset-state-sheet/SKILL.md +205 -0
- package/project-template-v2/.claude/skills/playcraft-audio-generation/SKILL.md +307 -0
- package/project-template-v2/.claude/skills/playcraft-batch-pipeline/SKILL.md +184 -0
- package/project-template-v2/.claude/skills/playcraft-build-optimizer/SKILL.md +306 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/SKILL.md +401 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/build-sprite-sheet.template.mjs +123 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/compare-style.template.mjs +254 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +333 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +95 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-edit-variants.template.mjs +118 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +136 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +397 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/ta-image-generation-detail.md +300 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/validate-sprite-sheet.template.mjs +296 -0
- package/project-template-v2/.claude/skills/playcraft-image-ops/SKILL.md +122 -0
- package/project-template-v2/.claude/skills/playcraft-image-processing/SKILL.md +244 -0
- package/project-template-v2/.claude/skills/playcraft-masking/SKILL.md +373 -0
- package/project-template-v2/.claude/skills/playcraft-playable-optimization/SKILL.md +161 -0
- package/project-template-v2/.claude/skills/playcraft-research/SKILL.md +215 -0
- package/project-template-v2/.claude/skills/playcraft-skill-recommender/SKILL.md +382 -0
- package/project-template-v2/.claude/skills/playcraft-sprite-generation/SKILL.md +423 -0
- package/project-template-v2/.claude/skills/playcraft-sprite-remix/SKILL.md +158 -0
- package/project-template-v2/.claude/skills/playcraft-sprite-sheet/SKILL.md +100 -0
- package/project-template-v2/.claude/skills/playcraft-storyboard/SKILL.md +167 -0
- package/project-template-v2/.claude/skills/playcraft-style-qa/SKILL.md +270 -0
- package/project-template-v2/.claude/skills/playcraft-text-rendering/SKILL.md +236 -0
- package/project-template-v2/.claude/skills/playcraft-vfx-animation/SKILL.md +130 -0
- package/project-template-v2/.claude/skills/playcraft-workspace-assets/SKILL.md +53 -0
- package/project-template-v2/.claude/skills/playcraft-workspace-assets/references/requests.json +32 -0
- package/project-template-v2/.claude/skills/playwright-cli/SKILL.md +390 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/element-attributes.md +23 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/request-mocking.md +87 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/running-code.md +240 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/session-management.md +226 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/spec-driven-testing.md +308 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/storage-state.md +275 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/test-generation.md +134 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/tracing.md +142 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/video-recording.md +153 -0
- package/project-template-v2/.claude/skills/session-analyzer/SKILL.md +386 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/execution-breakdown.mjs +182 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/find-turns.mjs +72 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/heavy-output.mjs +121 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/resolve-session.mjs +102 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/subagent-stats.mjs +127 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/subagent-tool-timeline.mjs +106 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/time-gaps.mjs +128 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/turn-timeline.mjs +67 -0
- package/project-template-v2/.claude/snapshot.mjs +263 -0
- package/project-template-v2/.playcraft/skills.lock.json +152 -0
- package/project-template-v2/CLAUDE.md +146 -0
- package/project-template-v2/assets/audio/bgm/.gitkeep +0 -0
- package/project-template-v2/assets/audio/sfx/.gitkeep +0 -0
- package/project-template-v2/assets/bundles/.gitkeep +0 -0
- package/project-template-v2/assets/images/bg/.gitkeep +0 -0
- package/project-template-v2/assets/images/reference/.gitkeep +0 -0
- package/project-template-v2/assets/images/storyboard/.gitkeep +0 -0
- package/project-template-v2/assets/images/tiles/.gitkeep +0 -0
- package/project-template-v2/assets/images/ui/.gitkeep +0 -0
- package/project-template-v2/assets/images/vfx/.gitkeep +0 -0
- package/project-template-v2/assets/models/.gitkeep +0 -0
- package/project-template-v2/docs/harness/iteration-1/context-flow.md +254 -0
- package/project-template-v2/docs/harness/iteration-1/generate-flow.md +91 -0
- package/project-template-v2/docs/harness/iteration-1/ideate-flow.md +214 -0
- package/project-template-v2/docs/harness/iteration-1/optimize-flow.md +75 -0
- package/project-template-v2/docs/harness/iteration-1/wrapup-flow.md +63 -0
- package/project-template-v2/docs/harness/iteration-2/context-flow.md +223 -0
- package/project-template-v2/docs/harness/iteration-2/generate-flow.md +129 -0
- package/project-template-v2/docs/harness/iteration-2/ideate-flow.md +267 -0
- package/project-template-v2/docs/harness/iteration-2/optimize-flow.md +164 -0
- package/project-template-v2/docs/harness/iteration-2/wrapup-flow.md +115 -0
- package/project-template-v2/docs/harness/orchestrator-flow.md +364 -0
- package/project-template-v2/docs/project-state.json +60 -0
- package/project-template-v2/docs/project-state.md +72 -0
- package/project-template-v2/docs/standards/README.md +225 -0
- package/project-template-v2/docs/standards/agent-behavior-standards.md +174 -0
- package/project-template-v2/docs/standards/artifacts/design-brief.md +19 -0
- package/project-template-v2/docs/standards/artifacts/design.md +22 -0
- package/project-template-v2/docs/standards/artifacts/game-code.md +41 -0
- package/project-template-v2/docs/standards/artifacts/todo-list.md +41 -0
- package/project-template-v2/docs/standards/iter1-agent-behavior-standards.md +343 -0
- package/project-template-v2/game/index.ts +18 -0
- package/project-template-v2/globals.d.ts +51 -0
- package/project-template-v2/index.css +34 -0
- package/project-template-v2/index.html +18 -0
- package/project-template-v2/main.ts +9 -0
- package/project-template-v2/package.json +46 -0
- package/project-template-v2/skills/_shared/scripts/dispatch-clear.mjs +31 -0
- package/project-template-v2/skills/_shared/scripts/dispatch-set.mjs +86 -0
- package/project-template-v2/skills/_shared/scripts/dod-check.mjs +153 -0
- package/project-template-v2/skills/_shared/scripts/handoff-append.mjs +70 -0
- package/project-template-v2/skills/_shared/scripts/lib/validator-artifacts.mjs +91 -0
- package/project-template-v2/skills/_shared/scripts/pipeline/dod-config.mjs +131 -0
- package/project-template-v2/skills/_shared/scripts/pipeline/index.mjs +80 -0
- package/project-template-v2/skills/_shared/scripts/pipeline/iteration-1-core.mjs +90 -0
- package/project-template-v2/skills/_shared/scripts/pipeline/iteration-2-wrap.mjs +93 -0
- package/project-template-v2/skills/_shared/scripts/pipeline/iteration-3-visual.mjs +23 -0
- package/project-template-v2/skills/_shared/scripts/render-project-state.mjs +230 -0
- package/project-template-v2/skills/_shared/scripts/state-advance-stage.mjs +58 -0
- package/project-template-v2/skills/_shared/scripts/state-get.mjs +339 -0
- package/project-template-v2/skills/_shared/scripts/state-handoff.mjs +39 -0
- package/project-template-v2/skills/_shared/scripts/state-set.mjs +94 -0
- package/project-template-v2/skills/_shared/scripts/state-store.mjs +783 -0
- package/project-template-v2/skills/_shared/scripts/todo-add.mjs +88 -0
- package/project-template-v2/skills/_shared/scripts/todo-get.mjs +130 -0
- package/project-template-v2/skills/_shared/scripts/todo-remove.mjs +33 -0
- package/project-template-v2/skills/_shared/scripts/todo-set.mjs +47 -0
- package/project-template-v2/skills/_shared/scripts/verify-asset-code-sync.mjs +268 -0
- package/project-template-v2/skills/_shared/scripts/verify-env.mjs +285 -0
- package/project-template-v2/skills/_shared/scripts/verify-placeholders.mjs +161 -0
- package/project-template-v2/skills/playable-autoplay/SKILL.md +176 -0
- package/project-template-v2/skills/playable-autoplay/agents/openai.yaml +4 -0
- package/project-template-v2/skills/playable-debug/SKILL.md +116 -0
- package/project-template-v2/skills/playable-debug/agents/openai.yaml +4 -0
- package/project-template-v2/skills/playable-debug/references/debug-config.md +40 -0
- package/project-template-v2/skills/playable-record/SKILL.md +140 -0
- package/project-template-v2/skills/playable-record/scripts/lib/dev-server.mjs +104 -0
- package/project-template-v2/skills/playable-record/scripts/lib/record-audio-bridge.js +141 -0
- package/project-template-v2/skills/playable-record/scripts/record-playable.mjs +425 -0
- package/project-template-v2/skills/playable-record/scripts/verify-contract.mjs +261 -0
- package/project-template-v2/skills/playable-record/scripts/verify-firstwin.mjs +398 -0
- package/project-template-v2/skills/playable-record/scripts/verify-fusion.mjs +322 -0
- package/project-template-v2/skills/playable-record/scripts/verify-lifecycle.mjs +105 -0
- package/project-template-v2/skills/playable-record/scripts/verify-vlm-video.mjs +230 -0
- package/project-template-v2/skills/playable-validate/SKILL.md +61 -0
- package/project-template-v2/skills/playable-validate/validation-rules.md +14 -0
- package/project-template-v2/skills/playable-verify-ui/SKILL.md +63 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/__init__.py +1 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/config_expr.js +218 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/node_utils.js +51 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/profile_loader.py +59 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/report.py +106 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/runtime_contract.js +116 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/verify_fetch_antipatterns.py +59 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/verify_hardcoded_layout.js +64 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/verify_runtime_contract.js +58 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/verify_text_overlap.py +333 -0
- package/project-template-v2/ta-workspace/scripts/.gitkeep +0 -0
- package/project-template-v2/tsconfig.json +20 -0
- package/project-template-v2/vite.config.ts +27 -0
- package/project-templates/batch-locks/phaser.yaml +922 -0
- package/project-templates/batch-locks/threejs.yaml +978 -0
- package/project-templates/empty/AGENTS.md +53 -0
- package/project-templates/empty/gitignore +33 -0
- package/project-templates/phaser/.claude/skills/playcraft-audio-generation/SKILL.md +31 -4
- package/project-templates/phaser/.claude/skills/playcraft-image-generation/SKILL.md +36 -5
- package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/build-sprite-sheet.template.mjs +1 -1
- package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/compare-style.template.mjs +1 -1
- package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +1 -1
- package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +1 -1
- package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/gen-edit-variants.template.mjs +1 -1
- package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +1 -1
- package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/ta-image-generation-detail.md +300 -0
- package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/validate-sprite-sheet.template.mjs +1 -1
- package/project-templates/phaser/.claude/skills/playcraft-image-processing/SKILL.md +50 -25
- package/project-templates/phaser/.claude/skills/playcraft-workspace-assets/SKILL.md +53 -0
- package/project-templates/phaser/.claude/skills/playcraft-workspace-assets/references/requests.json +32 -0
- package/project-templates/threejs/.claude/skills/playcraft-audio-generation/SKILL.md +31 -4
- package/project-templates/threejs/.claude/skills/playcraft-image-generation/SKILL.md +36 -5
- package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/build-sprite-sheet.template.mjs +1 -1
- package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/compare-style.template.mjs +1 -1
- package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +1 -1
- package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +1 -1
- package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/gen-edit-variants.template.mjs +1 -1
- package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +1 -1
- package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/ta-image-generation-detail.md +300 -0
- package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/validate-sprite-sheet.template.mjs +1 -1
- package/project-templates/threejs/.claude/skills/playcraft-image-processing/SKILL.md +50 -25
- package/project-templates/threejs/.claude/skills/playcraft-workspace-assets/SKILL.md +53 -0
- package/project-templates/threejs/.claude/skills/playcraft-workspace-assets/references/requests.json +32 -0
- package/templates/preview-runtime/v1/README.md +71 -0
- package/templates/preview-runtime/v1/build-preview.mjs +1324 -0
- package/templates/preview-runtime/v1/manifest.json +17 -0
- package/templates/preview-runtime/v1/release-guard.mjs +87 -0
- package/templates/preview-runtime/v1/runtime.d.mts +3 -0
- package/templates/preview-runtime/v1/runtime.d.ts +3 -0
- package/templates/preview-runtime/v1/runtime.mjs +1121 -0
- package/templates/preview-runtime/v1/types/adapters.d.ts +26 -0
- package/templates/preview-runtime/v1/types/preview.d.ts +23 -0
- package/templates/preview-runtime/v1/types/protocol.d.ts +94 -0
- package/templates/preview-runtime/v1/types/runtime.d.ts +14 -0
package/README.md
CHANGED
|
@@ -7,14 +7,38 @@
|
|
|
7
7
|
|
|
8
8
|
PlayCraft CLI(Command-Line Interface,命令行工具)支持本地代码与云端编辑器实时同步,以及将 PlayCanvas/PlayCraft 项目打包为多平台 Playable Ads。
|
|
9
9
|
|
|
10
|
-
## 云端工作台 Runtime
|
|
10
|
+
## 云端工作台 Runtime
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
`playcraft workspace-runtime serve --config <json>` 已注册。它前台常驻、跳过升级检查,读取 Runtime Server 下发的引导配置,只绑定回环并校验 control token。`runtime.ensure` 会执行到终态;设置 `PLAYCRAFT_NATIVE_ADAPTER=loopback` 或测试注入 loopback 适配器后,可跑会话 create/turn/interrupt/审批,以及本地 journal 检查点/恢复/销毁。工作空间相对路径的 `file.write` 与文件检查点不依赖 loopback。相同幂等键上的 `uncertain` 操作不会新开 turn。这不是 Codex App Server。现有 `playcraft start` 仍用于单项目本地开发,二者不要混用。
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
实现与模块边界见 [Sandbox Agent Server](./src/workspace-runtime/README.md);契约见 [云端工作台后端架构方案](../../docs/architecture/backend/cloud-workspace/backend-architecture.md#cli-runtime)。
|
|
15
|
+
|
|
16
|
+
## 下载云工作区并推送本地修改
|
|
17
|
+
|
|
18
|
+
文件面板的下载弹窗可复制下列命令。需要发布包含 `workspace` 命令的新版 `@playcraft/cli`,并部署对应的工作区传输端点;旧版 Remix 命令保持兼容。
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx @playcraft/cli@latest login --url 'https://playcraft.example.com/__env/test-a'
|
|
22
|
+
npx @playcraft/cli@latest workspace clone --workspace-id '<workspace-id>' --directory root --url 'https://playcraft.example.com/__env/test-a' --dir './my-workspace'
|
|
23
|
+
cd './my-workspace'
|
|
24
|
+
# 完成本地编辑后提交,再同步回原工作区
|
|
25
|
+
git add -A
|
|
26
|
+
git commit -m 'Update workspace'
|
|
27
|
+
npx @playcraft/cli@latest workspace push
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`--directory root` 下载整个工作区的工程目录;也可指定 `basic` 或已有工程目录。独立工作区无需关联平台项目。下载包含当前未提交文件、二进制素材和 `dist/` 产物,使用只有当前快照的新 Git 历史;排除 `.git`、`node_modules`、凭据文件和运行时路由信息。本地 `.playcraft-workspace.json` 保存目标工作区、目录、完整环境基址和快照摘要,不含访问令牌,默认不进入提交。服务基址的环境路径前缀会完整保留。
|
|
31
|
+
|
|
32
|
+
`workspace push` 要求本地修改已经提交,按上次确认的文件树生成增量包,只传输变化的文件内容,并将新增、修改和删除同步回同一个云工作区。旧克隆保留的 `.playcraft-workspace.json` 中已有文件树摘要,可继续使用新版命令推送。大文件随增量包传输,无需 Git LFS(Large File Storage,大文件存储),也无需为本地克隆配置真实远程 Git 仓库。
|
|
33
|
+
|
|
34
|
+
工作区传输容量按管理员配置的工作区存储额度和沙箱剩余磁盘空间判断。管理员可通过 `PLAYCRAFT_WORKSPACE_STORAGE_QUOTA_BYTES` 设置每个工作区的存储总量上限,值为正整数字节数;额度覆盖整个工作区的实际文件,包括依赖和 Git 元数据。该设置在新沙箱创建时下发,修改环境变量不会自动更新已有沙箱。未设置时,仍检查沙箱可用磁盘空间,并保留总容量的 10% 作为运行余量。传输包与临时快照也需要磁盘空间;容量不足时,应清理不再需要的文件或由管理员调整额度。弹窗中的直接下载用于导出文件,不能代替推送本地修改。
|
|
35
|
+
|
|
36
|
+
云端文件变化或有正在运行的任务时,推送会拒绝覆盖,需重新克隆并合并后再推送。云端现有 Git 仓库和分支元数据会保留,保存到远端项目仍使用工作区原有保存流程;针对项目分支的操作可继续使用 `remix clone` / `remix push`。命令支持 `--token`、`--dir` 与 `--json`。
|
|
15
37
|
|
|
16
38
|
## ✨ 特性
|
|
17
39
|
|
|
40
|
+
远程技能的上传、更新、发布、审核、查询与下载见 [技能注册表命令](./SKILLS_REGISTRY.md)。入口为 `playcraft skills registry`,复用已有登录;本地技能发现与项目技能命令保持原有语义。
|
|
41
|
+
|
|
18
42
|
- 🚀 **本地开发隧道** - 在本地 IDE 编写代码,云端编辑器实时预览与热更新
|
|
19
43
|
- 📦 **Playable Ads 打包** - 支持 10 个主流广告平台的一键打包
|
|
20
44
|
- 🎬 **智能场景选择** - 交互式场景选择,可减小 30-60% 文件大小(**新功能**)
|
|
@@ -141,6 +165,17 @@ playcraft login --url https://your-playcraft.example.com
|
|
|
141
165
|
|
|
142
166
|
登录成功后,`tools`、`recommend`、`fix-ids` 等所有需要后端 API 的命令均无需额外配置,直接使用。
|
|
143
167
|
|
|
168
|
+
账号提示待激活时,使用同一目标环境及已保存的个人访问令牌主动激活:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
playcraft login --activate
|
|
172
|
+
playcraft login --activate --url https://your-playcraft.example.com
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
也可通过 `PLAYCRAFT_TOKEN` 提供个人访问令牌。激活只发送一次请求,成功后重新执行原业务命令;该动作不会打开浏览器或续签令牌。目标服务须已接入身份服务的激活入口;封禁、停用账号及沙箱执行令牌不能用于激活。
|
|
176
|
+
|
|
177
|
+
若本地、全局或环境变量配置冲突,激活会要求明确指定 `--url`、所需的 `PLAYCRAFT_ENV` 和对应的个人访问令牌。
|
|
178
|
+
|
|
144
179
|
### 沙箱环境(CI / Agent)
|
|
145
180
|
|
|
146
181
|
在沙箱或 CI 中可通过 `.playcraft.json` 或环境变量配置:
|
|
@@ -175,18 +210,51 @@ echo '{"token":"<sandbox-jwt>","apiUrl":"https://..."}' > .playcraft.json
|
|
|
175
210
|
|
|
176
211
|
> 运行 `playcraft login` 后所有子命令均可直接使用。
|
|
177
212
|
|
|
178
|
-
| 命令
|
|
179
|
-
|
|
|
180
|
-
| `tools generate-image`
|
|
181
|
-
| `tools generate-sfx`
|
|
182
|
-
| `tools generate-bgm`
|
|
183
|
-
| `tools list-image-models`
|
|
184
|
-
| `
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
187
|
-
| `
|
|
188
|
-
| `
|
|
189
|
-
| `
|
|
213
|
+
| 命令 | 说明 | 示例 |
|
|
214
|
+
| ------------------------------------------------------- | ------------------------------ | ----------------------------------------------------------------------------- |
|
|
215
|
+
| `tools generate-image` | AI 生成图片 | `playcraft tools generate-image --prompt "pixel art sky"` |
|
|
216
|
+
| `tools generate-sfx` | AI 生成音效 | `playcraft tools generate-sfx --prompt "UI click"` |
|
|
217
|
+
| `tools generate-bgm` | AI 生成 BGM | `playcraft tools generate-bgm --prompt "casual game music"` |
|
|
218
|
+
| `tools list-image-models` | 列出可用生图模型 | `playcraft tools list-image-models` |
|
|
219
|
+
| `library search` | 检索有权访问的素材库 | `playcraft library search "角色" --type texture --json` |
|
|
220
|
+
| `library download` | 下载单文件或完整素材包 | `playcraft library download <assetId> --output ./assets/character` |
|
|
221
|
+
| `image decompose-layers` | 与云工作区一致的图层分离 | `playcraft image decompose-layers --input scene.png --output-dir dist/layers` |
|
|
222
|
+
| `image analyze-nine-patch` | 分析九宫格拉伸边距 | `playcraft image analyze-nine-patch --input panel.png --output panel.json` |
|
|
223
|
+
| `assets generate` | 创建可恢复的工作区素材生成任务 | `playcraft assets generate --request request.json --client-request-id <uuid>` |
|
|
224
|
+
| `assets tasks` / `get` / `wait` / `cancel` / `download` | 管理工作区生成任务和结果 | `playcraft assets download <taskId> --output ./assets/result` |
|
|
225
|
+
| `tools list-remixes` | 查看 Remix 项目列表 | `playcraft tools list-remixes` |
|
|
226
|
+
| `tools save-to-git` | 同步沙箱内容到 Git | `playcraft tools save-to-git --project-id <id> --message "feat: ..."` |
|
|
227
|
+
| `tools build-project` | 在沙箱中执行构建 | `playcraft tools build-project --project-id <id>` |
|
|
228
|
+
|
|
229
|
+
| `recommend similar` | 相似 Creative 推荐 | `playcraft recommend similar --channel Applovin` |
|
|
230
|
+
| `recommend improvements` | Tag 改进建议 | `playcraft recommend improvements --channel Facebook` |
|
|
231
|
+
| `recommend random` | 随机 Tag 组合推荐 | `playcraft recommend random --channel Google` |
|
|
232
|
+
|
|
233
|
+
云工作区工具与命令行的完整对应、权限规则和请求示例见[工具覆盖说明](../../docs/cli/cloud-workspace-tool-parity.md)。
|
|
234
|
+
|
|
235
|
+
### 业务工具请求恢复
|
|
236
|
+
|
|
237
|
+
业务工具写请求要求服务支持持久操作协议。命令行先保存请求编号、路径和输入摘要到 `~/.playcraft/tool-requests/`,再发送请求;记录不包含凭证或请求正文。可用绝对路径环境变量 `PLAYCRAFT_TOOL_REQUEST_DIR` 指定可持久保留的目录。
|
|
238
|
+
|
|
239
|
+
原样重跑同一条命令(路径与参数都相同)时,命令行按上一次的结果决定是否沿用原请求编号:
|
|
240
|
+
|
|
241
|
+
| 上一次的结果 | 原样重跑时 |
|
|
242
|
+
| -------------------------------------------------------------------- | -------------------------------------------------------- |
|
|
243
|
+
| 成功(2xx) | 新操作 |
|
|
244
|
+
| 请求被拒绝(4xx,下列 409 除外):请求没有被执行 | 新操作 |
|
|
245
|
+
| 服务端错误(5xx)、超时或连接中断:结果未知 | 沿用原编号,不会另起一次操作;服务端按下文的恢复方式处理 |
|
|
246
|
+
| 409 `business_operation_in_progress`:原操作仍在执行 | 沿用原编号,稍后重跑取得结果 |
|
|
247
|
+
| 409 `business_operation_requires_reconciliation`:结果未知,需要核对 | 沿用原编号,不会再执行 |
|
|
248
|
+
|
|
249
|
+
沿用原编号时,服务端按原操作的状态处理:已完成则返回原结果;仍在执行则返回 409 `business_operation_in_progress`;没有拿到结果就结束时,按该工具声明的恢复方式决定,可以安全重做的工具(生图、构建、发布到 COS 等)用原编号再执行一次,其余返回 409 `business_operation_requires_reconciliation`。原调用的执行租约有效期间(执行中每 20 秒续期,60 秒未续即过期),同一编号不会被再次执行;续期因服务或数据库故障中断超过 60 秒时,重做可能与仍在运行的原调用重叠。
|
|
250
|
+
|
|
251
|
+
需要核对的操作,只有确认它没有生效后,才可设置 `PLAYCRAFT_TOOL_NEW_REQUEST=1` 强制发起新操作;不要删除记录来绕过。也可以显式指定编号,只查询原操作的确定结果(不会重新执行;声明了恢复方式的工具若上次报错,返回那次的错误)。只查询时即使是可以安全重做的工具,没有结果也返回需要核对;去掉 `PLAYCRAFT_TOOL_REQUEST_ID` 原样重跑即可续做:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
PLAYCRAFT_TOOL_REQUEST_ID=<错误中显示的请求编号> playcraft tools build-project --project-id <原项目编号>
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
能力检查失败时命令会明确说明尚未发送操作。服务不兼容时命令会在发送业务请求前停止;沙箱命令行与 Business 须排空旧调用后同步升级。
|
|
190
258
|
|
|
191
259
|
### 构建相关
|
|
192
260
|
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# 远程技能管理
|
|
2
|
+
|
|
3
|
+
`playcraft skills registry` 管理已部署注册表中的技能、不可变版本和发行审核。它与现有离线 `skills list/match/read`、项目 `skills project` 命令并存。服务端需要提供 `/api/agent/skill-registry/managed` 路由。
|
|
4
|
+
|
|
5
|
+
网页管理复用现有技能控制台的“发布与更新”页签:系统管理入口为 `/admin/system?tab=agentSkills`,技能工作台入口为 `/agent/skills?view=management`。不新增 Skills 一级导航,旧 `/skills` 仅保留兼容重定向。
|
|
6
|
+
|
|
7
|
+
2026-10-15 已在当前开发配置指定的目标数据库执行并验证 0186 和 [0187_add_skill_scope_governance.sql](../backend-business-server/drizzle/migrations/0187_add_skill_scope_governance.sql)。其他环境启用前仍须应用对应迁移,并部署配套服务与客户端。本次目标数据库升级不代表生产已上线或命令包已发行。
|
|
8
|
+
|
|
9
|
+
## 登录与目标环境
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
playcraft login --url 'https://playcraft.example.com/__env/test-a'
|
|
13
|
+
playcraft skills registry list --scope private --json
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
命令复用登录保存的 PAT (Personal Access Token, 个人访问令牌)。所有命令支持 `--url`、`--token`、`--json`、`--scope private|team|platform` 和 `--team <teamId>`。环境地址顺序为 `--url`、`PLAYCRAFT_API_URL`、`PLAYCRAFT_URL`、已保存地址、默认云端。令牌优先使用 `--token` 或 `PLAYCRAFT_TOKEN`,否则仅使用该环境保存的凭据。环境路径前缀完整保留,向其他环境不会自动发送原环境令牌。
|
|
17
|
+
|
|
18
|
+
`private` 是默认范围;`team` 必须明确传入 `--team`,其他范围不能携带 `--team`。`--json` 成功时只输出一个结果对象,运行错误时只输出一个 `error` 对象并以非零状态退出。未知参数或缺少必填参数由命令解析器报告到标准错误。
|
|
19
|
+
|
|
20
|
+
## 查询与下载
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
playcraft skills registry list --scope private --query video --limit 20 --json
|
|
24
|
+
playcraft skills registry list --scope team --team '<teamId>' --cursor '<nextCursor>' --json
|
|
25
|
+
playcraft skills registry list --scope platform --json
|
|
26
|
+
playcraft skills registry info author/video-helper@1.2.0 --files --json
|
|
27
|
+
playcraft skills registry info author/video-helper --versions --json
|
|
28
|
+
playcraft skills registry pull author/video-helper@1.2.0 --out ./downloaded-skill --json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`list` 支持关键词、1–100 条分页和返回的 `nextCursor`;不会自动取完所有页面。`info` 默认省略正文与文件清单,`--files` 返回文件清单,`--versions` 返回可访问版本。查询与下载可省略版本,此时先解析所选发行范围的当前版本,再按其精确版本标识下载。
|
|
32
|
+
|
|
33
|
+
`pull` 同时验证元数据、响应头和压缩包的 SHA-256 (Secure Hash Algorithm 256-bit, 256 位安全散列算法) 摘要。包内已声明的 `skillRef/version` 必须匹配;历史制品可缺少声明,仍按服务端精确版本与摘要校验,不重写原制品。内容先写入临时目录,校验完成后原子落地;目标须不存在或为空,路径不能包含符号链接。拉取不会执行资源中的脚本,不修改项目声明、锁或运行时绑定。`.playcraft-skill.json` 保存环境、身份、版本和摘要,不含凭据;再次打包时自动排除。
|
|
34
|
+
|
|
35
|
+
## 上传与发布
|
|
36
|
+
|
|
37
|
+
技能目录必须包含非空 `SKILL.md`,可包含 `manifest.json`、`references/`、`scripts/`、`assets/` 等完整资源。`manifest.json` 可直接声明 `skillRef/version`;否则通过参数明确提供。标识必须是小写 `namespace/slug`,以字母或数字开头,允许连字符和下划线,slug 还允许点号。版本目前支持无前导零的精确 `x.y.z`,最多 32 字符;不支持预发行、构建后缀、`latest` 或版本范围。
|
|
38
|
+
|
|
39
|
+
首期上传接受 Markdown 技能包(`bundleType: "markdown"`),Atom 技能的查询与下载可用,上传管理尚未开放。正式发行还要求有效名称和描述,建议在 `SKILL.md` 的 frontmatter 中声明 `name` 与 `description`,或在清单中声明。平台发行还要求上传时通过 `--changelog` 提供变更说明,并完成平台评估与管理员审核。
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# 只登记草稿,不发布
|
|
43
|
+
playcraft skills registry push ./my-skill --ref author/video-helper --version 1.2.0 --json
|
|
44
|
+
|
|
45
|
+
# 上传后发布到本人范围;本人发布与更新免管理员审核
|
|
46
|
+
playcraft skills registry publish ./my-skill --ref author/video-helper --version 1.2.0 --scope private --json
|
|
47
|
+
|
|
48
|
+
# 上传新版本,明确旧版本;先同步修改清单中的 version(若已声明)
|
|
49
|
+
playcraft skills registry update author/video-helper --from ./my-skill --version 1.3.0 --base-version 1.2.0 --changelog 'Improve examples' --json
|
|
50
|
+
playcraft skills registry publish author/video-helper@1.3.0 --scope private --json
|
|
51
|
+
|
|
52
|
+
# 同一精确版本推广到团队或平台,不重新分配身份
|
|
53
|
+
playcraft skills registry publish author/video-helper@1.3.0 --scope team --team '<teamId>' --json
|
|
54
|
+
playcraft skills registry publish author/video-helper@1.3.0 --scope platform --json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
目录打包仅在内存中补充缺失的清单字段,不改动源目录。显式参数与现有清单身份或版本冲突时拒绝上传。`publish <ref>@<version>` 只发布已上传版本,不能同时传入目录上传参数 `--ref`、`--version`、`--base-version` 或 `--changelog`。排除根目录 `.git`、`node_modules` 和拉取回执;其他文件按目录完整收录,发布前应确保目录只包含需要分享的技能资源。拒绝符号链接、硬链接、不安全路径及大小超限:最多 512 个文件,单文件 16 MiB (Mebibyte, 二进制兆字节),内容总量与压缩包各 64 MiB。清单中的文件引用和显式摘要必须匹配实际文件。
|
|
58
|
+
|
|
59
|
+
全平台同一 `skillRef@version` 唯一;同内容重传复用版本,改内容必须增加版本号。已有命名空间占用或所有权冲突不会转换为更新他人技能。平台保留标识和新建平台归属技能由服务端管理员权限控制,普通作者可先上传本人技能,再向平台发行提审。
|
|
60
|
+
|
|
61
|
+
`push/update` 返回 `published: false`。`publish` 先检查当前发行指针,再携带该指针提交;并发发行变更由服务端拒绝。本人发行免审核;团队发行须目标团队管理员批准;平台发行须平台管理员批准。没有有效批准时,发布返回 `status: "review_pending"`、`published: false` 和审核标识。以返回字段为准,命令成功不代表已经发行。
|
|
62
|
+
|
|
63
|
+
## 审核、历史与回滚
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
playcraft skills registry publish-check author/video-helper@1.3.0 --scope team --team '<teamId>' --json
|
|
67
|
+
playcraft skills registry review submit author/video-helper@1.3.0 --scope team --team '<teamId>' --json
|
|
68
|
+
playcraft skills registry review list --scope team --team '<teamId>' --json
|
|
69
|
+
playcraft skills registry review approve '<reviewId>' --json
|
|
70
|
+
playcraft skills registry review reject '<reviewId>' --reason 'Add usage examples' --json
|
|
71
|
+
|
|
72
|
+
# 审核后显式发布相同版本、相同目标范围
|
|
73
|
+
playcraft skills registry publish author/video-helper@1.3.0 --scope team --team '<teamId>' --json
|
|
74
|
+
playcraft skills registry history author/video-helper --scope team --team '<teamId>' --json
|
|
75
|
+
playcraft skills registry rollback author/video-helper@1.2.0 --scope team --team '<teamId>' --reason 'Regression in 1.3.0' --json
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
审核决定只批准或拒绝指定申请,不自动执行发布。审核授权与申请目标范围由服务端校验。`publish-check` 显示硬性问题、评估问题、审核要求和当前发行指针;检查通过仍可能因发布时权限或指针改变而失败。回滚只移动选定范围的发行指针,复用已有精确版本,仍受该范围授权、审核和并发检查约束,不重写旧项目锁。
|
|
79
|
+
|
|
80
|
+
## 中断与恢复
|
|
81
|
+
|
|
82
|
+
修改请求不自动重试。命令在发出请求前将请求键及 `pending` 状态写入 `~/.playcraft/registry-requests/`,收到明确结果后记录 `completed/rejected`;回执不保存令牌或技能内容。发布与回滚同时保存操作目标、精确版本、摘要和首次检查得到的发行指针。超时、断线或响应无法确认目标时保留 `pending`;相同环境、凭据和操作的重试复用原请求键及原发行指针,不重新检查后覆盖其他人后来发布的版本。已明确完成或拒绝后,再次执行属于新的操作,会重新检查并分配请求键。服务端精确版本、内容摘要及发行指针是最终事实来源。上传后发布中断时,也可运行 `info <ref>@<version>`、`publish-check` 和 `history` 核对,再继续精确版本发布。
|
|
83
|
+
|
|
84
|
+
## 原生平台视频技能首次登记
|
|
85
|
+
|
|
86
|
+
云工作区默认使用的两个引用是 `remix/playcraft-video-understanding` 和 `remix/playcraft-replica-validation`。它们必须通过 `platform push` 登记,服务端会创建 `kind=platform`、`source=platform` 的原生身份。普通 `push --scope platform` 创建的是托管工作区技能,不能替代这一入口。
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
playcraft skills registry platform push ./playcraft-video-understanding-1.0.1.tar.gz --changelog '更新视频理解指引与评估用例' --json
|
|
90
|
+
playcraft skills registry platform push ./playcraft-replica-validation-1.0.1.tar.gz --changelog '更新复刻验收指引与评估用例' --json
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`platform push <source>` 接受完整目录或已准备的压缩包。目录必须已含原生 `manifest.json`;命令保留其文件内容,不补充托管技能默认字段。已有压缩包原样发送,不重打包。可选的 `--ref`、`--version` 必须与清单一致;可用 `--evaluation-template <templateId>` 指定初始评估模板。原生入口当前仅接受上述两个引用,要求平台类型、单一 `sandbox-agent` surface、对齐的名称与版本、无 imports/relationships;服务端执行完整校验与摘要归一化,并返回最终 `artifactHash`。登记不会自动评估、审核或发布。
|
|
94
|
+
|
|
95
|
+
此入口要求具有平台管理权限的真实账号凭据;命令复用目标环境登录,不发送本地身份模拟请求头。服务端需已部署允许真实管理员个人访问令牌访问原生登记和评估接口的版本。
|
|
96
|
+
|
|
97
|
+
## 真实评估
|
|
98
|
+
|
|
99
|
+
评估会使用指定工作区的模型和配置,在服务端评估执行器中实际运行用例。命令不构造通过记录,也不调用内部执行步骤接口。评估队列、执行器、模型和证据存储均须可用。先明确目标环境、工作区以及精确 `ref@version`,再选择模板和模型:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
playcraft skills registry evaluation templates list --json
|
|
103
|
+
playcraft skills registry evaluation models --workspace '<workspaceId>' --json
|
|
104
|
+
playcraft skills registry evaluation config get remix/playcraft-video-understanding@1.0.1 --scope platform --json
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
没有可用模板时,管理员可创建并启用模板:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
playcraft skills registry evaluation templates create --input ./evaluation-template.json --json
|
|
111
|
+
playcraft skills registry evaluation templates enable '<templateId>' --json
|
|
112
|
+
# 停用模板会使相关发布检查不再接受该模板
|
|
113
|
+
playcraft skills registry evaluation templates disable '<templateId>' --json
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
模板输入文件只接受 `{ "key": "...", "name": "...", "spec": { ... } }`。`spec` 使用现有评估模板字段:`executor`、`dockerImage`、`cloudTemplateId`、`nodeVersion`、`opencodeVersion`、`modelConfigId`、`graderVersion`、`caseTimeoutSeconds`、`runTimeoutSeconds`、`globalConcurrency`。填写实际运行镜像与工具版本;使用本地 Docker 时不要填写虚构的云模板标识。运行平台如何选择执行器由部署配置决定,命令不会自动切换。模板创建会分配新修订,**不保证请求键幂等**;若响应丢失,先用 `templates list` 核对,再决定是否重试。
|
|
117
|
+
|
|
118
|
+
配置输入文件只接受 `{ "templateId": "...", "expectedRevision": 0, "spec": { ... } }`。`expectedRevision` 使用 `config get` 返回的修订号;`spec` 包含 `modelConfigId`、`caseTimeoutSeconds`、`cases`。用例结构及断言种类见 [共享评估类型](../common/src/skill-evaluation.ts)。填写有意义的真实提示词、输入文件、断言和必要的模型评审要求;服务端校验完整性、运行证据与发布条件。
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
playcraft skills registry evaluation config set remix/playcraft-video-understanding@1.0.1 --scope platform --input ./video-evaluation-config.json --json
|
|
122
|
+
playcraft skills registry evaluation run remix/playcraft-video-understanding@1.0.1 --scope platform --workspace '<workspaceId>' --config '<configId>' --request-key 'video-1-0-1-run-001' --wait --timeout 1800 --interval 3 --json
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`--config` 必须是保存返回的精确配置标识;工作区标识不要求是通用唯一标识符。请求键允许 8–128 位字母、数字、下划线或连字符;重新执行一次评估需新键,断线恢复同一次评估需复用原键及全部原参数。`--compare` 可同时评估当前稳定版作为基线。省略 `--wait` 时返回已创建评估;带 `--wait` 时只有 `phase=completed` 且 `verdict=passed` 才成功退出,失败或取消会返回包含评估记录的结构化错误并非零退出。
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
playcraft skills registry evaluation status '<runId>' --json
|
|
129
|
+
playcraft skills registry evaluation runs remix/playcraft-video-understanding@1.0.1 --scope platform --workspace '<workspaceId>' --json
|
|
130
|
+
playcraft skills registry evaluation wait '<runId>' --timeout 1800 --interval 3 --json
|
|
131
|
+
playcraft skills registry evaluation evidence '<runId>' --case '<caseResultId>' --json
|
|
132
|
+
playcraft skills registry evaluation cancel '<runId>' --json
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
`--case` 使用状态结果中的 `results[].id`,不是逻辑用例名 `normal/boundary/regression`。状态含用例结果和检查项;`evidence` 读取对应归档证据。轮询默认最多 600 秒、间隔 3 秒;超时只停止等待,不取消后台评估,也不自动重新发起。修改请求不自动重试;配置写入使用预期修订号,断线后先读取配置确认实际结果。
|
|
136
|
+
|
|
137
|
+
## 同一原生版本的正式发布
|
|
138
|
+
|
|
139
|
+
应用治理迁移后,原生平台身份也使用托管注册表的审核、检查和发布命令;不要调用旧发布接口。评估配置变化会使旧配置的审核和证据失效。完成真实评估后,对同一精确版本提交审核、查看证据并由有权限的管理员批准,然后发布:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
playcraft skills registry review submit remix/playcraft-video-understanding@1.0.1 --scope platform --json
|
|
143
|
+
playcraft skills registry review approve '<reviewId>' --json
|
|
144
|
+
playcraft skills registry publish-check remix/playcraft-video-understanding@1.0.1 --scope platform --json
|
|
145
|
+
playcraft skills registry publish remix/playcraft-video-understanding@1.0.1 --scope platform --json
|
|
146
|
+
playcraft skills registry history remix/playcraft-video-understanding --scope platform --json
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
对 `remix/playcraft-replica-validation@1.0.1` 独立完成同样流程。检查必须没有硬性或评估问题;最终核对 `published: true`、返回的精确版本与摘要,以及发行历史。命令没有例外发布选项,不跳过真实评估或审核。这里描述的是操作流程,新增命令的自动测试通过不代表任一环境已完成真实评估或正式发布。工作区预览绑定仍不属于本命令组。
|
|
@@ -2,7 +2,7 @@ import express from 'express';
|
|
|
2
2
|
import crypto from 'node:crypto';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import fs from 'node:fs/promises';
|
|
5
|
-
import { eq, inArray } from '
|
|
5
|
+
import { eq, inArray } from '@playcraft/common/database/operators';
|
|
6
6
|
import pc from 'picocolors';
|
|
7
7
|
import { createSqliteAdapter } from '@playcraft/common/database';
|
|
8
8
|
import { AssetModel, ProjectModel, SceneModel } from '@playcraft/common/models';
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { constants } from 'node:fs';
|
|
3
|
+
import { link, lstat, mkdir, mkdtemp, open, readFile, rm } from 'node:fs/promises';
|
|
4
|
+
import { basename, dirname, join, relative, resolve, sep } from 'node:path';
|
|
5
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
6
|
+
import { assetGenerationTaskSchema, assetGenerationTaskListSchema, animationEditorStateSchema, workspaceSessionScopeSchema, ASSET_GENERATION_REQUEST_MAX_BYTES, } from '@playcraft/common/cloud-workspace/runtime';
|
|
7
|
+
import { resolveVideoWorkspace } from '../video-replication/client.js';
|
|
8
|
+
import { resolveSandboxPath } from '../utils/sandbox-path.js';
|
|
9
|
+
import { assetMessage as t } from './messages.js';
|
|
10
|
+
export async function readAssetRequest(path) {
|
|
11
|
+
const handle = await open(resolve(resolveSandboxPath(path)), constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
12
|
+
try {
|
|
13
|
+
const stat = await handle.stat();
|
|
14
|
+
if (!stat.isFile() || stat.size > ASSET_GENERATION_REQUEST_MAX_BYTES)
|
|
15
|
+
throw new Error(t('requestTooLarge'));
|
|
16
|
+
return JSON.parse(await handle.readFile('utf8'));
|
|
17
|
+
}
|
|
18
|
+
finally {
|
|
19
|
+
await handle.close();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export async function resolveAssetScope(options, cwd = process.cwd()) {
|
|
23
|
+
const workspaceId = await resolveVideoWorkspace(options.workspace, cwd);
|
|
24
|
+
let inferred;
|
|
25
|
+
for (let cursor = resolve(cwd);; cursor = dirname(cursor)) {
|
|
26
|
+
try {
|
|
27
|
+
const value = JSON.parse(await readFile(join(cursor, '.playcraft/workspace-context.json'), 'utf8'));
|
|
28
|
+
if (value.workspaceId === workspaceId) {
|
|
29
|
+
// Cloud project roots are <workspaceRoot>/<workspaceId>/<engineeringDirectory>.
|
|
30
|
+
if (basename(dirname(cursor)) === workspaceId && workspaceSessionScopeSchema.safeParse(basename(cursor)).success)
|
|
31
|
+
inferred = basename(cursor);
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
if (error.code !== 'ENOENT')
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
if (dirname(cursor) === cursor)
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
const parsed = workspaceSessionScopeSchema.safeParse(options.directory ?? inferred ?? 'basic');
|
|
43
|
+
if (!parsed.success || inferred && options.directory && inferred !== options.directory)
|
|
44
|
+
throw new Error(t('scopeMismatch'));
|
|
45
|
+
return { workspaceId, directoryName: parsed.data };
|
|
46
|
+
}
|
|
47
|
+
export function assetContentRoute(input) {
|
|
48
|
+
const query = new URLSearchParams(Object.entries(input).filter(([, value]) => value !== undefined));
|
|
49
|
+
return `/workspace-assets/content?${query}`;
|
|
50
|
+
}
|
|
51
|
+
export function scopedAssetTask(scope, value) {
|
|
52
|
+
const task = assetGenerationTaskSchema.parse(value);
|
|
53
|
+
if (task.workspaceId !== scope.workspaceId || task.directoryName !== scope.directoryName)
|
|
54
|
+
throw new Error(t('scopeMismatch'));
|
|
55
|
+
return task;
|
|
56
|
+
}
|
|
57
|
+
export async function readAssetTasks(client, scope) {
|
|
58
|
+
const value = assetGenerationTaskListSchema.parse(await client.get('/workspace-assets', { ...scope, action: 'list' }));
|
|
59
|
+
return { tasks: value.tasks.map(task => scopedAssetTask(scope, task)) };
|
|
60
|
+
}
|
|
61
|
+
export async function readAssetTask(client, scope, taskId) {
|
|
62
|
+
const task = scopedAssetTask(scope, await client.get('/workspace-assets', { ...scope, action: 'get', taskId }));
|
|
63
|
+
if (task.taskId !== taskId)
|
|
64
|
+
throw new Error(t('scopeMismatch'));
|
|
65
|
+
return task;
|
|
66
|
+
}
|
|
67
|
+
export async function waitForAssetTask(client, scope, taskId, timeoutSeconds = 1800, intervalSeconds = 3) {
|
|
68
|
+
validateAssetWait(timeoutSeconds, intervalSeconds);
|
|
69
|
+
const deadline = Date.now() + timeoutSeconds * 1000;
|
|
70
|
+
for (;;) {
|
|
71
|
+
const task = await readAssetTask(client, scope, taskId);
|
|
72
|
+
if (!['queued', 'running', 'cancel_requested'].includes(task.status))
|
|
73
|
+
return task;
|
|
74
|
+
if (Date.now() >= deadline)
|
|
75
|
+
throw new Error(t('timeoutReached'));
|
|
76
|
+
await delay(Math.min(intervalSeconds * 1000, deadline - Date.now()));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export function validateAssetWait(timeoutSeconds, intervalSeconds) {
|
|
80
|
+
if (!Number.isFinite(timeoutSeconds) || timeoutSeconds <= 0 || timeoutSeconds > 86400 || !Number.isFinite(intervalSeconds)
|
|
81
|
+
|| intervalSeconds < 0.1 || intervalSeconds > 60)
|
|
82
|
+
throw new Error(t('invalidRequest'));
|
|
83
|
+
}
|
|
84
|
+
async function verifyFile(path, file) {
|
|
85
|
+
const handle = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
86
|
+
try {
|
|
87
|
+
if ((await handle.stat()).size !== file.size)
|
|
88
|
+
throw new Error(t('invalidContent'));
|
|
89
|
+
const hash = createHash('sha256');
|
|
90
|
+
for await (const chunk of handle.createReadStream({ autoClose: false }))
|
|
91
|
+
hash.update(chunk);
|
|
92
|
+
if (hash.digest('hex') !== file.contentHash)
|
|
93
|
+
throw new Error(t('invalidContent'));
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
await handle.close();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/** Stage and verify every member before publishing the new local output. */
|
|
100
|
+
export async function downloadAssetTask(client, scope, taskId, output, versionId) {
|
|
101
|
+
const task = await readAssetTask(client, scope, taskId);
|
|
102
|
+
if (!['awaiting_adoption', 'saved'].includes(task.status) || !task.output)
|
|
103
|
+
throw new Error(t('outputUnavailable'));
|
|
104
|
+
let bundle = task.bundle, entry = task.output;
|
|
105
|
+
if (versionId) {
|
|
106
|
+
const editor = animationEditorStateSchema.parse(await client.get('/workspace-assets', { ...scope, action: 'animation', taskId }));
|
|
107
|
+
if (editor.taskId !== taskId)
|
|
108
|
+
throw new Error(t('scopeMismatch'));
|
|
109
|
+
const version = editor.versions.find(version => version.versionId === versionId);
|
|
110
|
+
if (!version)
|
|
111
|
+
throw new Error(t('outputUnavailable'));
|
|
112
|
+
bundle = version.bundle;
|
|
113
|
+
entry = version.output;
|
|
114
|
+
}
|
|
115
|
+
const destination = resolve(resolveSandboxPath(output));
|
|
116
|
+
if (await lstat(destination).then(() => true, error => { if (error.code === 'ENOENT')
|
|
117
|
+
return false; throw error; }))
|
|
118
|
+
throw new Error(t('outputExists'));
|
|
119
|
+
await mkdir(dirname(destination), { recursive: true });
|
|
120
|
+
const staging = await mkdtemp(join(dirname(destination), '.playcraft-asset-'));
|
|
121
|
+
let createdDestination = false;
|
|
122
|
+
try {
|
|
123
|
+
const files = bundle?.files ?? [{ ...entry, path: 'output', fileId: undefined }];
|
|
124
|
+
const paths = [];
|
|
125
|
+
for (const file of files) {
|
|
126
|
+
const temporary = resolve(staging, file.path);
|
|
127
|
+
const inside = relative(staging, temporary);
|
|
128
|
+
if (!inside || inside === '..' || inside.startsWith(`..${sep}`))
|
|
129
|
+
throw new Error(t('invalidContent'));
|
|
130
|
+
await mkdir(dirname(temporary), { recursive: true });
|
|
131
|
+
await client.download(assetContentRoute({ ...scope, taskId, ...(bundle ? { fileId: file.fileId } : {}), ...(versionId ? { versionId } : {}) }), temporary);
|
|
132
|
+
await verifyFile(temporary, file);
|
|
133
|
+
paths.push(bundle ? join(destination, file.path) : destination);
|
|
134
|
+
}
|
|
135
|
+
if (bundle) {
|
|
136
|
+
// mkdir is exclusive; an existing directory or symbolic link cannot be replaced.
|
|
137
|
+
await mkdir(destination);
|
|
138
|
+
createdDestination = true;
|
|
139
|
+
for (const file of files) {
|
|
140
|
+
const path = join(destination, file.path);
|
|
141
|
+
await mkdir(dirname(path), { recursive: true });
|
|
142
|
+
await link(join(staging, file.path), path);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else
|
|
146
|
+
await link(join(staging, 'output'), destination);
|
|
147
|
+
return { task, paths };
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
if (createdDestination)
|
|
151
|
+
await rm(destination, { recursive: true, force: true });
|
|
152
|
+
throw error;
|
|
153
|
+
}
|
|
154
|
+
finally {
|
|
155
|
+
await rm(staging, { recursive: true, force: true });
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const messages = {
|
|
2
|
+
en: {
|
|
3
|
+
topic: 'Generate workspace assets and manage the same tasks shown in the workspace',
|
|
4
|
+
estimate: 'Estimate generation cost without creating a task', generate: 'Create a durable generation task',
|
|
5
|
+
tasks: 'List generation tasks', get: 'Read a generation task', cancel: 'Request task cancellation',
|
|
6
|
+
wait: 'Wait for an existing task; never submit another generation', download: 'Download a verified result, preserving all bundle files',
|
|
7
|
+
saved: 'Confirm workspace adoption using an existing platform write receipt',
|
|
8
|
+
libraryTargets: 'List authorized destination teams', librarySave: 'Copy a generated result into the asset library',
|
|
9
|
+
librarySaves: 'List library copy jobs', libraryRetry: 'Resume a library copy job using its existing identity',
|
|
10
|
+
animation: 'Inspect and edit generated frame animations', animationGet: 'Read the animation draft and versions',
|
|
11
|
+
animationDraft: 'Update a draft using its expected revision', animationFrame: 'Upload a replacement frame',
|
|
12
|
+
animationVersion: 'Export an immutable animation version', animationSaved: 'Confirm adoption of an animation version',
|
|
13
|
+
workspace: 'Workspace identifier; inferred from the current project when omitted', directory: 'Engineering directory; inferred inside the cloud workspace, otherwise basic',
|
|
14
|
+
request: 'Path to the request document', receipt: 'Path to a platform write receipt with operationId and path',
|
|
15
|
+
clientRequest: 'Stable request identity; reuse it after an uncertain submission',
|
|
16
|
+
output: 'Destination file, or new directory for a complete sprite or animation bundle',
|
|
17
|
+
waitOption: 'Wait for generation to finish', timeout: 'Maximum wait in seconds', interval: 'Polling interval in seconds',
|
|
18
|
+
version: 'Animation version identifier', saveId: 'Existing library copy job identifier', release: 'Start this library copy without waiting for workspace adoption',
|
|
19
|
+
json: 'Print structured results', invalidRequest: 'The request document or command arguments are invalid.',
|
|
20
|
+
scopeMismatch: 'The returned result belongs to another workspace or engineering directory.',
|
|
21
|
+
outputUnavailable: 'The task has no completed output to download.', outputExists: 'The output already exists. Choose a new destination.',
|
|
22
|
+
invalidContent: 'Downloaded content does not match the task size or content digest.', failed: 'Asset operation failed',
|
|
23
|
+
timeoutReached: 'Waiting timed out. Use assets get or assets wait with the same task identifier; generation was not cancelled.',
|
|
24
|
+
requestTooLarge: 'The request document exceeds the permitted size.',
|
|
25
|
+
},
|
|
26
|
+
zh: {
|
|
27
|
+
topic: '生成工作区素材,管理工作区面板中同一批任务', estimate: '估算生成费用,不创建任务', generate: '创建可恢复的素材生成任务',
|
|
28
|
+
tasks: '列出素材生成任务', get: '读取生成任务', cancel: '请求取消任务', wait: '等待已有任务,不会重新生成',
|
|
29
|
+
download: '校验并下载结果,保留素材包全部文件', saved: '用已有平台写入回执确认素材已采纳',
|
|
30
|
+
libraryTargets: '列出允许写入的团队素材库', librarySave: '将生成结果保存到素材库', librarySaves: '列出素材库保存任务',
|
|
31
|
+
libraryRetry: '沿用已有标识恢复素材库保存任务', animation: '查看、编辑生成的帧动画', animationGet: '读取动画草稿和版本',
|
|
32
|
+
animationDraft: '按预期修订号更新动画草稿', animationFrame: '上传替换帧', animationVersion: '导出不可变的动画版本',
|
|
33
|
+
animationSaved: '确认动画版本已采纳', workspace: '工作区标识;省略时从当前工程推断', directory: '工程目录;云工作区内自动推断,其余情况默认 basic',
|
|
34
|
+
request: '请求文档路径', receipt: '平台写入回执路径,需包含 operationId 和 path',
|
|
35
|
+
clientRequest: '稳定请求标识;提交结果不确定时复用同一标识', output: '目标文件路径;精灵图或动画素材包使用新目录',
|
|
36
|
+
waitOption: '等待生成完成', timeout: '最长等待秒数', interval: '查询间隔秒数', version: '动画版本标识',
|
|
37
|
+
saveId: '已有素材库保存任务标识', release: '立即执行此素材库保存任务,不再等待工作区采纳', json: '输出结构化结果',
|
|
38
|
+
invalidRequest: '请求文档或命令参数无效。', scopeMismatch: '返回结果不属于所选工作区或工程目录。',
|
|
39
|
+
outputUnavailable: '任务尚无可供下载的完整结果。', outputExists: '目标已存在,请选择新的保存位置。',
|
|
40
|
+
invalidContent: '下载内容与任务记录的大小或内容摘要不一致。', failed: '素材操作失败',
|
|
41
|
+
timeoutReached: '等待已超时。请使用同一任务标识运行 assets get 或 assets wait,生成任务未取消。',
|
|
42
|
+
requestTooLarge: '请求文档超过允许大小。',
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
export function assetMessage(key) {
|
|
46
|
+
const language = process.env.PLAYCRAFT_LANGUAGE || process.env.LANG || 'en';
|
|
47
|
+
return messages[language.startsWith('zh') ? 'zh' : 'en'][key];
|
|
48
|
+
}
|