# Hypercho Games agent publishing

Canonical guide: https://game.hypercho.com/agent
Publisher endpoint: https://play.hypercho.games/api/games
Human sign-in: https://hypercho.com/auth/Login?callbackUrl=https%3A%2F%2Fgame.hypercho.com%2Fagent

Publish a complete AI-native browser game only after authentication, local validation, a dry run, and explicit creator confirmation.

## Required order

### 0. Authenticate before uploading

1. Check whether the environment already contains `HYPERCHO_PUBLISHER_TOKEN`.
2. If the token is missing, open the Human sign-in URL above for the creator.
3. Never request, read, log, transmit, or store the creator's password.
4. Pause until the creator finishes sign-in and a scoped publisher token is available to the MCP process.
5. Reference the credential by environment-variable name; never place its value in tool arguments, source files, chat, or the manifest.

Authentication is not required for local validation or a dry run. It is required for a confirmed production upload.

## Information to collect

- Title, unique slug, semantic version, tagline, and full description
- Publisher name and contact URL
- One to three categories and searchable tags
- AI models, player-facing AI features, and data disclosure
- Content rating, browser compatibility, and runtime network origins
- Browser entrypoint, 16:9 banner, at least two screenshots, and optional trailer

The public title may repeat, but the slug must be unique. If a slug belongs to another publisher, choose a new slug; never overwrite or impersonate the existing owner.

## Choose the operation

### Upload a new game — supported

1. Choose a unique slug and version — normally `1.0.0`.
2. Prepare the complete manifest and browser bundle.
3. Follow the validation, dry-run, confirmation, and upload sequence below.
4. Save the returned immutable `gameId`, owned `slug`, version, URLs, and hashes.

### Edit an existing game — supported as a new release

1. Authenticate with the publisher credential that owns the slug.
2. Fetch `https://play.hypercho.games/api/games/<slug>` with that credential and verify the returned `gameId` and current version.
3. Keep the slug unchanged and increment the semantic version. Never reuse an existing version for different contents.
4. Edit any listing fields, AI disclosure, media, or browser files in the package.
5. Run `validate_game_bundle`, then a `publish_game` dry run.
6. Show a clear before/after summary and ask for explicit approval of the exact new version.
7. Publish with `dryRun: false` and `confirmPublish: true` and verify that the receipt keeps the same `gameId`.

An edit creates an immutable release; it does not rewrite release history. A slug cannot be transferred by changing publisher information in the manifest.

### Delete or unpublish — guarded stop

The current Hypercho Games publisher MCP does not expose `delete_game` or `unpublish_game`. An agent must not invent either tool or call an undocumented HTTP method.

For a removal request:

1. Authenticate and fetch the owned game by slug.
2. Verify the immutable `gameId`, owner credential, current public version, and listing URL.
3. Explain that deletion is not available through this MCP release and ask the creator whether they want the request escalated to the platform operator.
4. Preserve the last receipt and hashes so the target can be audited.
5. Stop without changing state and report `DELETE_UNSUPPORTED`.

Publishing a newer `draft` or `unlisted` release does **not** remove an earlier public release. Never describe that as deletion.

## Package contract

Create this shape:

```text
game-package/
├── game-manifest.json
└── game/
    ├── index.html
    ├── assets/
    └── media/
```

Use the schema at `tools/publisher/schema/game-manifest.schema.json`. The browser bundle must be self-contained, use safe relative paths, and include every file referenced by the manifest.

## MCP sequence

1. `validate_game_bundle({ manifestPath, bundlePath })`
2. `publish_game({ manifestPath, bundlePath, tokenEnv: "HYPERCHO_PUBLISHER_TOKEN", dryRun: true })`
3. Show the complete dry-run result and ask the creator to confirm the exact release.
4. `publish_game({ manifestPath, bundlePath, tokenEnv: "HYPERCHO_PUBLISHER_TOKEN", dryRun: false, confirmPublish: true })`

Do not combine steps 2 and 4. Do not infer confirmation from an earlier request to prepare, validate, or preview the game.

## Successful result

Report:

- immutable `gameId`
- owned `slug` and published `version`
- canonical `listingUrl`
- isolated `playUrl`
- manifest and bundle SHA-256 hashes
- visibility and publication timestamp

The listing will resolve at `https://game.hypercho.com/game/<slug>`. Untrusted game code remains isolated on the play domain.

## Failure behavior

- Authentication missing: stop before upload and direct the creator to sign in.
- Slug conflict: keep the title if desired, choose a distinct slug, validate again, and reconfirm.
- Validation failure: fix the package locally; do not upload a partial release.
- Network or server failure: preserve the package and idempotency key, report the error, and do not claim success.
- Receipt mismatch: treat the publish as unverified and report it immediately.
- Delete or unpublish request: verify the target, preserve its receipt, report `DELETE_UNSUPPORTED`, and escalate; never improvise a destructive call.
