castle-web-cli 0.4.189 → 0.4.190
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-prompts.js +4 -2
- package/dist/agent.js +30 -12
- package/dist/shell/assets/index-Bo8dx2Ps.js +449 -0
- package/dist/shell/assets/index-DrFIFZVh.css +1 -0
- package/dist/shell/index.html +2 -2
- package/kits/physics-2d/castle.json +1 -1
- package/kits/physics-2d/editors/PxArtEditor.jsx +6 -28
- package/kits/physics-2d/editors/SceneEditor.jsx +16 -67
- package/kits/physics-2d/editors/editorHistory.js +27 -0
- package/kits/physics-2d/editors/pixelEditorChrome.jsx +7 -19
- package/kits/physics-2d/engine/icons.js +0 -2
- package/kits/physics-2d/eslint.config.js +1 -1
- package/kits/physics-3d/castle.json +3 -3
- package/kits/physics-3d/engine3d/PxModelEditor.jsx +2 -2
- package/kits/physics-3d/engine3d/Scene3DEditor.jsx +2 -2
- package/kits/physics-3d/engine3d/editorChrome.jsx +23 -51
- package/package.json +1 -1
- package/dist/shell/assets/index-BHS1yecn.js +0 -449
- package/dist/shell/assets/index-BaqrGZkv.css +0 -1
package/dist/agent-prompts.js
CHANGED
|
@@ -72,13 +72,15 @@ comma-separated active-task titles or ids, or \`all\`
|
|
|
72
72
|
- Task agents are capable coding agents working in this same deck directory, but they know nothing about this conversation beyond your prompt.
|
|
73
73
|
- The deck keeps its own version history, and you may READ it: \`castle-web list-versions\` shows the versions newest first, and \`castle-web show-version <id>\` shows what one changed, as diffs of just those files. Use them to answer "what changed" or to ground a claim about recent work. You NEVER run \`save-version\` -- you did not make the changes, so a version of yours would not correspond to a unit of work -- and you NEVER run \`restore-version\`: going back is the user's own decision, not something you do on their behalf.
|
|
74
74
|
|
|
75
|
-
Asking with options (the \`\`\`ask block). When you need the user to settle a few choices at once, emit ONE fenced block tagged \`ask\` containing JSON -- it renders inline in the chat as grouped options they tap and submit together (far better than stacking questions they can only half-answer). Reach for it to pin a direction fast when their ask is vague ("make me a game" -> ask what kind), NOT to interrogate.
|
|
75
|
+
Asking with options (the \`\`\`ask block). When you need the user to settle a few choices at once, emit ONE fenced block tagged \`ask\` containing JSON -- it renders inline in the chat as grouped options they tap and submit together (far better than stacking questions they can only half-answer). Reach for it to pin a direction fast when their ask is vague ("make me a game" -> ask what kind), NOT to interrogate.
|
|
76
76
|
|
|
77
77
|
\`\`\`ask
|
|
78
78
|
{ "questions": [ { "id": "kind", "q": "What kind of game?", "options": ["Arcade", "Puzzle", "Platformer"] }, { "id": "feel", "q": "What should it feel like?", "options": ["Cozy", "Frantic"], "multi": true } ] }
|
|
79
79
|
\`\`\`
|
|
80
80
|
|
|
81
|
-
- Per question: \`q\` (the text, required), \`options\` (
|
|
81
|
+
- Per question: \`q\` (the text, required), \`options\` (named choices, required), \`multi\` (optional -- false/omitted = pick one, true = pick any that apply), \`id\` (optional answer handle). Keep it to a few high-leverage questions.
|
|
82
|
+
- Skip and Other are always on the widget: Skip sits beside the question so they can pass on it, Other is a free-text field at the bottom of the list. Do NOT add "Other" or "Skip" to \`options\` -- they are already there. Named options only.
|
|
83
|
+
- A skipped question comes back as \`skipped\`. Other comes back as whatever they typed. Act on those the same as a named pick.
|
|
82
84
|
- The user's picks come back as their next message, which you then act on (usually by spawning the first build tasks). Don't pair an \`\`\`ask block with task directives in the same reply -- ask first, build once they answer. Don't use one when a single plain question would do, and never re-ask something already settled.
|
|
83
85
|
|
|
84
86
|
Conversation style:
|
package/dist/agent.js
CHANGED
|
@@ -804,16 +804,18 @@ function humanizeAskBlocks(text) {
|
|
|
804
804
|
return null;
|
|
805
805
|
const opts = q.options
|
|
806
806
|
.filter((o) => typeof o === 'string' && o.trim() !== '')
|
|
807
|
+
.filter((o) => {
|
|
808
|
+
const t = o.trim().toLowerCase();
|
|
809
|
+
return t !== 'other' && t !== 'skip';
|
|
810
|
+
})
|
|
807
811
|
.join(' / ');
|
|
808
|
-
if (!opts)
|
|
809
|
-
return null;
|
|
810
812
|
const mode = q.multi === true ? 'pick any' : 'pick one';
|
|
811
|
-
return `- ${q.q} (${mode}): ${opts}`;
|
|
813
|
+
return opts ? `- ${q.q} (${mode}): ${opts}` : `- ${q.q} (${mode})`;
|
|
812
814
|
})
|
|
813
815
|
.filter((l) => l !== null);
|
|
814
816
|
if (lines.length === 0)
|
|
815
817
|
return whole;
|
|
816
|
-
return `[You asked the user to choose:\n${lines.join('\n')}]`;
|
|
818
|
+
return `[You asked the user to choose. Skip and Other are always on the picker -- do not add them to options:\n${lines.join('\n')}]`;
|
|
817
819
|
}
|
|
818
820
|
catch {
|
|
819
821
|
return whole;
|
|
@@ -2684,6 +2686,8 @@ function createMessageLog(messagesPath, broadcast, welcomeMessage, forClient) {
|
|
|
2684
2686
|
function add(message) {
|
|
2685
2687
|
messages.push(message);
|
|
2686
2688
|
persist();
|
|
2689
|
+
if (message.hideFromUi)
|
|
2690
|
+
return;
|
|
2687
2691
|
broadcast({ type: 'message-add', message: forClient(message) });
|
|
2688
2692
|
}
|
|
2689
2693
|
function addLog(text) {
|
|
@@ -3311,6 +3315,7 @@ function loadRecoverableSends(deckDir, pendingPath, committedIds) {
|
|
|
3311
3315
|
// predates @-mentions wrote none at all, which is a send worth
|
|
3312
3316
|
// recovering for its words, not a malformed one.
|
|
3313
3317
|
refs: validMessageRefs(deckDir, refsOrLegacyFiles(item)),
|
|
3318
|
+
...(item.hideFromUi === true ? { hideFromUi: true } : {}),
|
|
3314
3319
|
});
|
|
3315
3320
|
}
|
|
3316
3321
|
}
|
|
@@ -3345,7 +3350,10 @@ function persistPendingSends(ctx) {
|
|
|
3345
3350
|
atomicWriteFileSync(ctx.pendingPath, JSON.stringify(ctx.state.pendingSends, null, 2) + '\n');
|
|
3346
3351
|
}
|
|
3347
3352
|
function computeQueuedSnippets(pendingSends) {
|
|
3348
|
-
return pendingSends
|
|
3353
|
+
return pendingSends
|
|
3354
|
+
.filter((p) => !p.hideFromUi)
|
|
3355
|
+
.map((p) => p.text.trim())
|
|
3356
|
+
.filter(Boolean);
|
|
3349
3357
|
}
|
|
3350
3358
|
function broadcastQueueState(ctx) {
|
|
3351
3359
|
ctx.broadcast({
|
|
@@ -3411,6 +3419,8 @@ function commitDrainedSends(drained, log) {
|
|
|
3411
3419
|
message.attachments = item.attachments;
|
|
3412
3420
|
if (item.refs.length > 0)
|
|
3413
3421
|
message.refs = item.refs;
|
|
3422
|
+
if (item.hideFromUi)
|
|
3423
|
+
message.hideFromUi = true;
|
|
3414
3424
|
log.add(message);
|
|
3415
3425
|
}
|
|
3416
3426
|
if (item.text.trim())
|
|
@@ -3496,7 +3506,7 @@ function safeClientMessageId(clientId) {
|
|
|
3496
3506
|
return null;
|
|
3497
3507
|
return /^[A-Za-z0-9_-]{1,32}$/.test(clientId) ? clientId : null;
|
|
3498
3508
|
}
|
|
3499
|
-
function handleQueueUserMessage(ctx, text, images, refs, clientId) {
|
|
3509
|
+
function handleQueueUserMessage(ctx, text, images, refs, clientId, hideFromUi) {
|
|
3500
3510
|
const { state } = ctx;
|
|
3501
3511
|
// Mid-run: queue (don't interrupt). It shows as a queued row in the
|
|
3502
3512
|
// composer and flushes when the current turn settles. Idle: start now.
|
|
@@ -3524,6 +3534,7 @@ function handleQueueUserMessage(ctx, text, images, refs, clientId) {
|
|
|
3524
3534
|
text,
|
|
3525
3535
|
attachments,
|
|
3526
3536
|
refs: validMessageRefs(ctx.deckDir, refs),
|
|
3537
|
+
...(hideFromUi ? { hideFromUi: true } : {}),
|
|
3527
3538
|
});
|
|
3528
3539
|
persistPendingSends(ctx);
|
|
3529
3540
|
if (state.routerRunning) {
|
|
@@ -3574,9 +3585,13 @@ function interruptRouterQueue(ctx) {
|
|
|
3574
3585
|
}
|
|
3575
3586
|
function cancelQueuedSend(ctx, index) {
|
|
3576
3587
|
const { state } = ctx;
|
|
3577
|
-
|
|
3588
|
+
const visible = state.pendingSends.filter((p) => !p.hideFromUi);
|
|
3589
|
+
if (!Number.isInteger(index) || index < 0 || index >= visible.length)
|
|
3578
3590
|
return;
|
|
3579
|
-
state.pendingSends.
|
|
3591
|
+
const real = state.pendingSends.indexOf(visible[index]);
|
|
3592
|
+
if (real < 0)
|
|
3593
|
+
return;
|
|
3594
|
+
state.pendingSends.splice(real, 1);
|
|
3580
3595
|
persistPendingSends(ctx);
|
|
3581
3596
|
broadcastQueueState(ctx);
|
|
3582
3597
|
}
|
|
@@ -3608,7 +3623,7 @@ function createRouterQueue(deps) {
|
|
|
3608
3623
|
persistPendingSends(ctx);
|
|
3609
3624
|
maybeStartRouterQueueTurn(ctx);
|
|
3610
3625
|
return {
|
|
3611
|
-
handleUserMessage: (text, images, refs, clientId) => handleQueueUserMessage(ctx, text, images, refs, clientId),
|
|
3626
|
+
handleUserMessage: (text, images, refs, clientId, hideFromUi) => handleQueueUserMessage(ctx, text, images, refs, clientId, hideFromUi),
|
|
3612
3627
|
interruptRouter: () => interruptRouterQueue(ctx),
|
|
3613
3628
|
cancelQueued: (index) => cancelQueuedSend(ctx, index),
|
|
3614
3629
|
isRunning: () => ctx.state.routerRunning,
|
|
@@ -3790,8 +3805,9 @@ export function createAgentServer(opts) {
|
|
|
3790
3805
|
log.persist();
|
|
3791
3806
|
broadcast({ type: 'message-picker', id, pickerAnswers: msg.pickerAnswers });
|
|
3792
3807
|
}
|
|
3793
|
-
if (text.trim())
|
|
3794
|
-
routerQueue.handleUserMessage(text.trim(), undefined, undefined);
|
|
3808
|
+
if (text.trim()) {
|
|
3809
|
+
routerQueue.handleUserMessage(text.trim(), undefined, undefined, undefined, true);
|
|
3810
|
+
}
|
|
3795
3811
|
}
|
|
3796
3812
|
function handleTaskAck(id, rejected) {
|
|
3797
3813
|
taskStore.acknowledge(id, rejected);
|
|
@@ -3837,7 +3853,9 @@ export function createAgentServer(opts) {
|
|
|
3837
3853
|
clients.add(socket);
|
|
3838
3854
|
const hello = {
|
|
3839
3855
|
type: 'hello',
|
|
3840
|
-
messages: messages
|
|
3856
|
+
messages: messages
|
|
3857
|
+
.filter((message) => !message.hideFromUi)
|
|
3858
|
+
.map((message) => asClientMessage(message, opts.signPath)),
|
|
3841
3859
|
tasks: taskStore.sorted().map((task) => asClientTask(task, opts.signPath)),
|
|
3842
3860
|
settings,
|
|
3843
3861
|
feeds: Object.fromEntries(taskFeeds.map),
|