castle-web-cli 0.4.126 → 0.4.127

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.js CHANGED
@@ -22,6 +22,7 @@ import * as path from 'path';
22
22
  import { nanoid } from 'nanoid';
23
23
  import { WebSocketServer } from 'ws';
24
24
  import { rawDataToString } from './ide.js';
25
+ import { PLAN_FILE } from './localPaths.js';
25
26
  import { applyPlanOps, buildRouterPrompt, buildTaskPrompt, parsePlanOps, planOpenQuestionLines, truncateToBytes, userTurnInstruction, CLAUDE_TASK_SYSTEM_REMINDER, } from './agent-prompts.js';
26
27
  import { readCastleJson } from './castleJson.js';
27
28
  import { checkOpenrouterKey, checkOpenrouterModel, openrouterCatalogEntry, primeOpenrouterCatalog, } from './openrouter-catalog.js';
@@ -518,15 +519,9 @@ const TASK_SPAWN_STAGGER_MS = Number(process.env.CASTLE_TASK_SPAWN_STAGGER_MS) |
518
519
  const TASK_POLL_MS = 1_000;
519
520
  const FENCE_HOLDBACK = '```castle-';
520
521
  const RESULT_SUMMARY_CHARS = 600;
521
- // The deck's plan file: the ops in the router's ```castle-plan fences are
522
- // applied to it, the user edits it like any other deck file, and it is rendered
523
- // into every router turn and task prompt. Exactly two hands write it -- the
524
- // router and the user -- so the runtime never joins machine state (task status,
525
- // what exists) into it; that rides in the rendered digest instead.
526
- const PLAN_FILE = 'plan.md';
527
- // Byte ceiling on the plan.md injected into those prompts. Nothing bounds the
528
- // file itself -- ops touch one line each and the user pastes what they like --
529
- // meanwhile the whole prompt rides inside one argv entry (see
522
+ // Byte ceiling on the plan.md injected into router turns and task prompts.
523
+ // Nothing bounds the file itself -- ops touch one line each and the user pastes
524
+ // what they like -- meanwhile the whole prompt rides inside one argv entry (see
530
525
  // TRANSCRIPT_BYTE_BUDGET in agent-prompts.ts), so this term needs its own bound.
531
526
  const PLAN_BYTE_BUDGET = 8 * 1024;
532
527
  const MAX_ATTACHMENTS = 6;
package/dist/ide.js CHANGED
@@ -21,7 +21,7 @@ import { readEditorConfig, resolveFileTypes, } from './editorConfig.js';
21
21
  import { UNSUPPORTED_MEDIA } from './unsupportedMedia.js';
22
22
  import { IMPORT_API_PREFIX, handleImportApi } from './importBrowse.js';
23
23
  import { readRequestBody, sendJson } from './httpJson.js';
24
- import { COVER_FILE } from './localPaths.js';
24
+ import { COVER_FILE, PLAN_FILE } from './localPaths.js';
25
25
  import { applyVersionRestore, createVersion, NotOnThisLine, pendingChanges, UnsavedChanges, versionSummaries, } from './versions.js';
26
26
  import { envForUserShell, installCliShims } from './byo-auth.js';
27
27
  const HeadlessTerminal = headlessPkg.Terminal;
@@ -301,6 +301,15 @@ function filterDeckFiles(files, config) {
301
301
  }
302
302
  return result;
303
303
  }
304
+ // The deck's own files, curated. The plan is exempt: it is the platform's file,
305
+ // not one a kit's visiblePaths were written to name, so a curated deck would
306
+ // hide it by omission -- it shows whenever it exists.
307
+ function filterOwnFiles(files, config) {
308
+ const result = filterDeckFiles(files, config);
309
+ if (files.includes(PLAN_FILE) && !result.includes(PLAN_FILE))
310
+ result.push(PLAN_FILE);
311
+ return result;
312
+ }
304
313
  // Filter each import by the editor config of the deck it came from: strip the
305
314
  // `imports/<alias>/` prefix so the dependency's own visible/hidden globs match
306
315
  // the paths they were written against, then put it back.
@@ -760,7 +769,7 @@ function handleFilesApi(deckDir, req, res, reqPath) {
760
769
  // is the deck that knows which of its files are worth showing.
761
770
  const own = listed.filter((f) => !isImportPath(f));
762
771
  files = [
763
- ...filterDeckFiles(own, readEditorConfig(deckDir)),
772
+ ...filterOwnFiles(own, readEditorConfig(deckDir)),
764
773
  ...filterImportedFiles(deckDir, listed.filter(isImportPath)),
765
774
  ].sort((a, b) => a.localeCompare(b));
766
775
  }
@@ -4,4 +4,5 @@ export declare function getCliEntryPath(): string;
4
4
  export declare function getSdkPackagePath(): string;
5
5
  export declare function getKitsDir(): string;
6
6
  export declare const COVER_FILE = "preview.png";
7
+ export declare const PLAN_FILE = "plan.md";
7
8
  export declare function toPosixPath(filepath: string): string;
@@ -33,6 +33,14 @@ export function getKitsDir() {
33
33
  // `ide.ts` already imports that -- naming it here keeps the two from importing
34
34
  // each other.
35
35
  export const COVER_FILE = 'preview.png';
36
+ // The deck's plan file, deck-relative: the ops in the router's ```castle-plan
37
+ // fences are applied to it, the user edits it like any other deck file, and it
38
+ // is rendered into every router turn and task prompt. Exactly two hands write
39
+ // it -- the router and the user -- so the runtime never joins machine state
40
+ // (task status, what exists) into it; that rides in the rendered digest
41
+ // instead. Named here because the serve's file listing has to know it too, to
42
+ // keep it out of a deck's path curation.
43
+ export const PLAN_FILE = 'plan.md';
36
44
  export function toPosixPath(filepath) {
37
45
  return filepath.split(path.sep).join('/');
38
46
  }