castle-web-cli 0.4.183 → 0.4.184
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/agent-failures.d.ts +1 -0
- package/dist/agent-failures.js +31 -4
- package/dist/agent-prompts.d.ts +0 -3
- package/dist/agent-prompts.js +14 -28
- package/dist/agent.d.ts +1 -13
- package/dist/agent.js +187 -938
- package/dist/byo-accounts.d.ts +4 -4
- package/dist/byo-accounts.js +17 -38
- package/dist/byo-auth.d.ts +2 -5
- package/dist/byo-auth.js +4 -52
- package/dist/byo-login.d.ts +4 -5
- package/dist/byo-login.js +28 -56
- package/dist/mcpPlaytest.js +1 -2
- package/dist/metering.d.ts +31 -23
- package/dist/metering.js +45 -52
- package/dist/openrouter-catalog.d.ts +0 -1
- package/dist/openrouter-catalog.js +0 -11
- package/dist/platformDoc.d.ts +1 -1
- package/dist/platformDoc.js +9 -12
- package/dist/serve.js +3 -5
- package/dist/shell/assets/{index-DnNy-Z5u.js → index-g4l7hWIQ.js} +85 -83
- package/dist/shell/assets/index-y7CK6t3j.css +1 -0
- package/dist/shell/index.html +2 -2
- package/kits/physics-2d/CLAUDE.md +5 -1
- package/kits/physics-2d/castle.json +1 -1
- package/kits/physics-2d/editors/SceneEditor.jsx +2 -1
- package/kits/physics-2d/engine/autoInspector.jsx +32 -3
- package/kits/physics-2d/engine/fields/fields.jsx +305 -5
- package/kits/physics-2d/engine/fields/fields.module.css +76 -0
- package/kits/physics-2d/engine/paletteField.jsx +8 -3
- package/kits/physics-2d/engine/spriteField.jsx +3 -3
- package/kits/physics-2d/engine/ui.jsx +5 -277
- package/kits/physics-2d/engine/ui.module.css +0 -69
- package/package.json +1 -1
- package/dist/shell/assets/index-cdsH2lna.css +0 -1
package/dist/platformDoc.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare const PLATFORM_DOC_REL: string;
|
|
|
3
3
|
export declare function everyDeckBullets(deckDir: string): string[];
|
|
4
4
|
export declare const PLATFORM_SECTION_HEADING = "### from the Castle platform (every deck)";
|
|
5
5
|
export declare function platformSection(deckDir: string): string;
|
|
6
|
-
export declare function quickReferenceFor(deckDir: string, quickReference: string
|
|
6
|
+
export declare function quickReferenceFor(deckDir: string, quickReference: string): string;
|
|
7
7
|
export declare function platformGuide(deckDir: string): string;
|
|
8
8
|
export declare function writePlatformDocs(deckDir: string): void;
|
|
9
9
|
export declare const CLAUDE_MD_IMPORT_LINE: string;
|
package/dist/platformDoc.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as crypto from 'crypto';
|
|
2
2
|
import * as fs from 'fs';
|
|
3
3
|
import * as path from 'path';
|
|
4
|
-
import { NO_DECK_DOCS } from './agent-prompts.js';
|
|
5
4
|
import { resolveFileTypes } from './editorConfig.js';
|
|
6
5
|
// The platform's own guidance to agents -- the rules identical in a bare deck
|
|
7
6
|
// and a kit deck: the card, touch, assets and formats, imports, reloading,
|
|
@@ -9,7 +8,7 @@ import { resolveFileTypes } from './editorConfig.js';
|
|
|
9
8
|
// at every start (runtime state: not saved, not versioned, never edited), the
|
|
10
9
|
// deck's root CLAUDE.md `@`-imports the compact copy so any agent that
|
|
11
10
|
// auto-loads CLAUDE.md gets it for free, and backends that read no CLAUDE.md
|
|
12
|
-
//
|
|
11
|
+
// get the same bullets in their composed prompt. Kits
|
|
13
12
|
// state only what is theirs; nothing below is restated in a kit's guide.
|
|
14
13
|
//
|
|
15
14
|
// The text is what was always in context before it had one home: the four
|
|
@@ -53,9 +52,10 @@ export function everyDeckBullets(deckDir) {
|
|
|
53
52
|
"- Do not reload the deck after an edit. Nothing auto-reloads: the person applies your changes when they are ready, from the Play panel's restart button or a panel's own reload control. `npm run restart` reloads every open panel at once and breaks their flow — only when asked.",
|
|
54
53
|
"- The deck can define its own editors: declare a file type in `castle.json` (`editor.fileTypes`: ext, label, icon, and an `editors/` module) and the Files panel opens that type in it — whole recipe under `## Editors` in the deck's guide (its kit's `CLAUDE.md` under `imports/`). Editors under `imports/` are read-only; add or fork, don't edit.",
|
|
55
54
|
'- An editor is for content FILES the creator keeps coming back to (catalogs, dialogue, level tables) that nothing already opens. One-off or generated data stays code.',
|
|
56
|
-
"- **Put the values someone would tune while playtesting in a `PARAMS` object**: `export const PARAMS = { jumpHeight: 4.2, coyoteTime: 0.08 };` near the top of the file that uses them. The Parameters panel lists every file in the deck that has one and renders their values as fields -- a number scrubs, a boolean toggles, a `'#rrggbb'` string opens a color picker -- and writes the edit back into the file. It edits every file's params in one place, so nobody has to remember which file a setting lives in, and a file that has params says so above its code with a way in. That is how a creator tunes a game on a phone without putting a cursor inside an expression. Nested one level deep (`player: { speed: 5 }`) renders as a group
|
|
55
|
+
"- **Put the values someone would tune while playtesting in a `PARAMS` object**: `export const PARAMS = { jumpHeight: 4.2, coyoteTime: 0.08 };` near the top of the file that uses them. The Parameters panel lists every file in the deck that has one and renders their values as fields -- a number scrubs, a boolean toggles, a `'#rrggbb'` string opens a color picker -- and writes the edit back into the file. It edits every file's params in one place, so nobody has to remember which file a setting lives in, and a file that has params says so above its code with a way in. That is how a creator tunes a game on a phone without putting a cursor inside an expression. Nested one level deep (`player: { speed: 5 }`) renders as a group. **Write each value as a plain number, not as arithmetic** (`0.333`, not `1 / 3`): the panel folds arithmetic over plain numbers into a field and replaces it with the tuned literal on the first edit, so the expression you wrote does not survive the first tune. A value that NAMES something (`speed: BASE * 2`) shows read-only, as a link onto its own line in the code.",
|
|
57
56
|
'- **This is for the handful of numbers someone would actually reach for between playtests, not every constant in the file.** A `PARAMS` with sixty keys is a wall nobody can scan, which is how a creator stops opening the pane at all. A magic number that only ever has one right value is not a param.',
|
|
58
57
|
"- **Read them through the object where they are used** -- `PARAMS.jumpHeight`, not `const { jumpHeight } = PARAMS` at module load. A destructured copy is taken once when the module loads and can never track a later change, so keeping the read at the use site is what leaves a tuned value able to reach the running deck.",
|
|
58
|
+
"- **A `PARAMS_META` object beside it, keyed the same way, says how to render a value**: `export const PARAMS_META = { jumpHeight: { min: 0, max: 10, step: 0.5, hint: 'Peak height in tiles.' }, mode: { options: ['easy', 'hard'] } };`. `min` and `max` together make a slider and cap what can be typed, so only set a `max` where going past it is meaningless; `step` sets the granularity, `unit` suffixes the value (`'s'`, `'px/s'`), `options` makes a select, `file` (`'image' | 'audio' | 'video' | 'any'`) a file picker, and `hint` a line of explanation under the field. Every key and every field is optional, a group's meta nests like the group does, and every value has to be a literal -- the panel PARSES the file, it never runs it.",
|
|
59
59
|
MODE_BULLET,
|
|
60
60
|
];
|
|
61
61
|
}
|
|
@@ -117,19 +117,16 @@ function withEveryDeckBullets(deckDir, quickReference) {
|
|
|
117
117
|
const bullets = everyDeckBullets(deckDir).join('\n');
|
|
118
118
|
return own ? `${own}\n\n${bullets}` : bullets;
|
|
119
119
|
}
|
|
120
|
-
// A deck's quick reference as
|
|
121
|
-
//
|
|
122
|
-
// root CLAUDE.md -- but only a deck whose file carries the @import line has the
|
|
120
|
+
// A deck's quick reference as the agent sees it. claude auto-loads the root
|
|
121
|
+
// CLAUDE.md -- but only a deck whose file carries the @import line has the
|
|
123
122
|
// guide that way. A deck the migration has not reached (gated off) or refused
|
|
124
123
|
// ('kept' -- someone edited its sections) still has the four legacy sections
|
|
125
124
|
// inline and is missing just the every-deck bullets, which left the kits'
|
|
126
125
|
// quick reference in the same change that added the guide.
|
|
127
|
-
export function quickReferenceFor(deckDir, quickReference
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const own = quickReference.trim();
|
|
132
|
-
return `${platformSection(deckDir)}\n\n${own || NO_DECK_DOCS}`;
|
|
126
|
+
export function quickReferenceFor(deckDir, quickReference) {
|
|
127
|
+
return deckLoadsGuide(deckDir)
|
|
128
|
+
? quickReference
|
|
129
|
+
: withEveryDeckBullets(deckDir, quickReference);
|
|
133
130
|
}
|
|
134
131
|
// The four sections `init` appended to every deck's CLAUDE.md until 2026-08-25
|
|
135
132
|
// (COMMON_INSTRUCTIONS), verbatim; only the "(every deck)" heading suffix is
|
package/dist/serve.js
CHANGED
|
@@ -817,11 +817,9 @@ export async function serve(dir, options = {}) {
|
|
|
817
817
|
: undefined,
|
|
818
818
|
// Same effect as the WS server's own 'restart' branch below (invalidate
|
|
819
819
|
// then tell every connected tab to reload), called directly in-process
|
|
820
|
-
// instead of round-tripping through a WebSocket message
|
|
821
|
-
//
|
|
822
|
-
//
|
|
823
|
-
// its own WS client) just to send one message to a serve it's already
|
|
824
|
-
// running inside of.
|
|
820
|
+
// instead of round-tripping through a WebSocket message. Built for the
|
|
821
|
+
// native loop's `restart` tool (native/tools.ts), which nothing spawns
|
|
822
|
+
// today; it stays because it is the serve's capability to offer.
|
|
825
823
|
restart: () => {
|
|
826
824
|
invalidateModuleCaches(viteHolder.vite);
|
|
827
825
|
broadcast({ type: 'restart' });
|