yaml-flow 5.3.0 → 5.4.2

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.
@@ -342,7 +342,7 @@ export function createExampleBoardServerRuntime(options = {}) {
342
342
  const tmpSurfaceDir = path.resolve(
343
343
  options.tmpSurfaceDir || process.env.DEMO_SURFACE_DIR || path.join(os.tmpdir(), 'board-live-cards-demo-surface')
344
344
  );
345
- const tmpCardsDir = path.join(tmpSurfaceDir, 'tmp-cards');
345
+ const tmpCardsDir = cardsDir;
346
346
  const runtimeOutDir = path.resolve(
347
347
  options.runtimeOutDir || process.env.DEMO_RUNTIME_OUT_DIR || path.join(os.tmpdir(), 'board-live-cards-demo-runtime-out')
348
348
  );
@@ -385,7 +385,7 @@ export function createExampleBoardServerRuntime(options = {}) {
385
385
  const gandalfCardsDir = options.gandalfCardsDir ? path.resolve(options.gandalfCardsDir) : null;
386
386
  const gandalfRuntimeDir = path.resolve(options.gandalfRuntimeDir || path.join(path.dirname(boardDir), 'gandalf-runtime'));
387
387
  const gandalfRuntimeOutDir = path.resolve(options.gandalfRuntimeOutDir || path.join(path.dirname(boardDir), 'gandalf-runtime-out'));
388
- const tmpGandalfCardsDir = path.join(tmpSurfaceDir, 'tmp-gandalf-cards');
388
+ const tmpGandalfCardsDir = gandalfCardsDir;
389
389
  const gandalfInventoryFile = path.join(gandalfRuntimeDir, 'cards-inventory.jsonl');
390
390
  const gandalfBoardFile = path.join(gandalfRuntimeDir, 'board-graph.json');
391
391
  const gandalfStatusSnapshotFile = path.join(gandalfRuntimeOutDir, 'board-livegraph-status.json');
@@ -424,8 +424,6 @@ export function createExampleBoardServerRuntime(options = {}) {
424
424
  }
425
425
  function isGandalfCard(cardId) { return _gandalfCardIds.has(cardId); }
426
426
 
427
- let didDemoSetup = false;
428
-
429
427
  function resolveCliJsPath() {
430
428
  if (configuredBoardLiveCardsCliJs && fs.existsSync(configuredBoardLiveCardsCliJs)) return configuredBoardLiveCardsCliJs;
431
429
 
@@ -729,57 +727,6 @@ export function createExampleBoardServerRuntime(options = {}) {
729
727
  };
730
728
  }
731
729
 
732
- function demoPrepSetup() {
733
- fs.mkdirSync(tmpSurfaceDir, { recursive: true });
734
- fs.rmSync(tmpCardsDir, { recursive: true, force: true });
735
- fs.mkdirSync(tmpCardsDir, { recursive: true });
736
-
737
- const entries = fs.readdirSync(cardsDir, { withFileTypes: true });
738
- for (const entry of entries) {
739
- if (!entry.isFile()) continue;
740
- if (!entry.name.toLowerCase().endsWith('.json')) continue;
741
- const src = path.join(cardsDir, entry.name);
742
- const dst = path.join(tmpCardsDir, entry.name);
743
- fs.copyFileSync(src, dst);
744
- }
745
-
746
- // Copy gandalf-card templates if gandalfCardsDir is configured.
747
- if (gandalfCardsDir && fs.existsSync(gandalfCardsDir)) {
748
- fs.rmSync(tmpGandalfCardsDir, { recursive: true, force: true });
749
- fs.mkdirSync(tmpGandalfCardsDir, { recursive: true });
750
- for (const entry of fs.readdirSync(gandalfCardsDir, { withFileTypes: true })) {
751
- if (!entry.isFile() || !entry.name.toLowerCase().endsWith('.json')) continue;
752
- fs.copyFileSync(path.join(gandalfCardsDir, entry.name), path.join(tmpGandalfCardsDir, entry.name));
753
- }
754
- }
755
-
756
- // Concatenate agent-instructions*.md files into copilot-instructions.md at boardSetupRoot
757
- const boardSetupRoot = path.dirname(boardDir);
758
- const agentInstructionFiles = ['agent-instructions.md', 'agent-instructions-cardlayout.md'];
759
- const srcDir = path.dirname(cardsDir); // board source dir where agent-instructions*.md live
760
- const parts = [];
761
- for (const fname of agentInstructionFiles) {
762
- const fpath = path.join(srcDir, fname);
763
- if (fs.existsSync(fpath)) {
764
- parts.push(fs.readFileSync(fpath, 'utf-8').trimEnd());
765
- }
766
- }
767
- if (parts.length > 0) {
768
- fs.writeFileSync(path.join(boardSetupRoot, 'copilot-instructions.md'), parts.join('\n\n') + '\n', 'utf-8');
769
- }
770
-
771
- didDemoSetup = true;
772
- }
773
-
774
- function isDemoSetupDone() {
775
- return didDemoSetup && fs.existsSync(tmpCardsDir);
776
- }
777
-
778
- function ensureDemoSetup() {
779
- if (isDemoSetupDone()) return;
780
- demoPrepSetup();
781
- }
782
-
783
730
  function resolveTaskExecutorPath(taskExecutorPathParam) {
784
731
  const raw = typeof taskExecutorPathParam === 'string' ? taskExecutorPathParam.trim() : '';
785
732
  const resolved = raw
@@ -931,8 +878,6 @@ export function createExampleBoardServerRuntime(options = {}) {
931
878
  }
932
879
 
933
880
  function initBoardAndSetup(taskExecutorPathParam, chatHandlerPathParam, inferenceAdapterPathParam) {
934
- ensureDemoSetup();
935
-
936
881
  if (!fs.existsSync(boardFile)) {
937
882
  initBoard(taskExecutorPathParam, chatHandlerPathParam, inferenceAdapterPathParam);
938
883
  }
@@ -958,6 +903,8 @@ export function createExampleBoardServerRuntime(options = {}) {
958
903
  runtimeStatusDir: path.relative(path.dirname(boardDir), runtimeOutDir),
959
904
  cardsDir: path.relative(path.dirname(boardDir), tmpCardsDir),
960
905
  ...(serverUrl ? { serverUrl } : {}),
906
+ ...(configuredBoardLiveCardsCliJs ? { boardLiveCardsCliJs: configuredBoardLiveCardsCliJs } : {}),
907
+ ...(configuredStepMachineCliPath ? { stepMachineCliPath: configuredStepMachineCliPath } : {}),
961
908
  });
962
909
 
963
910
  // Board-cards runtime: init if configured but not yet initialized.
@@ -976,7 +923,6 @@ export function createExampleBoardServerRuntime(options = {}) {
976
923
  }
977
924
 
978
925
  function bootstrapCards() {
979
- ensureDemoSetup();
980
926
  runCli(['upsert-card', '--rg', boardDir, '--card-glob', path.join(tmpCardsDir, '*.json')]);
981
927
  }
982
928
 
@@ -1212,12 +1158,14 @@ export function createExampleBoardServerRuntime(options = {}) {
1212
1158
  // The handler file lives in the appropriate runtime dir (.chat-handler).
1213
1159
  // Called with: --boardId <id> --cardId <id> --extraEncJson <base64json>
1214
1160
  // extraEncJson decodes to:
1215
- // boardSetupRoot — absolute path to board root (parent of runtime/, surface/, runtime-out/)
1216
- // boardRuntimeDir — relative: 'runtime' (or 'gandalf-runtime' for gandalf cards)
1217
- // runtimeStatusDir— relative: 'runtime-out'
1218
- // cardsDir — relative: 'surface/tmp-cards' (or 'surface/tmp-gandalf-cards')
1219
- // chatDir — relative (from cardsDir): e.g. 'card-portfolio/chats'
1220
- // lastChatFile — filename of the just-written user message, e.g. '001_user.txt'
1161
+ // boardSetupRoot — absolute path to board root (parent of runtime/, surface/, runtime-out/)
1162
+ // boardRuntimeDir — relative: 'runtime' (or 'gandalf-runtime' for gandalf cards)
1163
+ // runtimeStatusDir — relative: 'runtime-out'
1164
+ // cardsDir — relative: 'surface/tmp-cards' (or 'surface/tmp-gandalf-cards')
1165
+ // chatDir — relative (from cardsDir): e.g. 'card-portfolio/chats'
1166
+ // lastChatFile — filename of the just-written user message, e.g. '001_user.txt'
1167
+ // boardLiveCardsCliJs — absolute path to board-live-cards-cli.js (if configured)
1168
+ // stepMachineCliPath — absolute path to step-machine-cli.js (if configured)
1221
1169
  // Handler failures are logged and silently ignored — chat-send response is never affected.
1222
1170
  function invokeChatHandler(cardId, chatsDir, lastChatFile) {
1223
1171
  const isGandalf = isGandalfCard(cardId);
@@ -1237,6 +1185,8 @@ export function createExampleBoardServerRuntime(options = {}) {
1237
1185
  chatDir: chatsDir,
1238
1186
  lastChatFile,
1239
1187
  ...(serverUrl ? { serverUrl } : {}),
1188
+ ...(configuredBoardLiveCardsCliJs ? { boardLiveCardsCliJs: configuredBoardLiveCardsCliJs } : {}),
1189
+ ...(configuredStepMachineCliPath ? { stepMachineCliPath: configuredStepMachineCliPath } : {}),
1240
1190
  })).toString('base64');
1241
1191
  try {
1242
1192
  const proc = spawn(handlerCmd, [
@@ -1461,7 +1411,6 @@ export function createExampleBoardServerRuntime(options = {}) {
1461
1411
  }
1462
1412
 
1463
1413
  if (method === 'GET' && p === `${apiBasePath}/board-status`) {
1464
- ensureDemoSetup();
1465
1414
  json(res, 200, buildPublishedRuntimePayload());
1466
1415
  return true;
1467
1416
  }
@@ -1612,14 +1561,12 @@ export function createExampleBoardServerRuntime(options = {}) {
1612
1561
  corsHeaders,
1613
1562
  boardDir,
1614
1563
  tmpSurfaceDir,
1615
- tmpCardsDir,
1616
1564
  runtimeOutDir,
1617
1565
  parseUrl,
1618
1566
  json,
1619
1567
  runCli,
1620
- demoPrepSetup,
1621
- ensureDemoSetup,
1622
- isDemoSetupDone,
1568
+ cardsDir,
1569
+ gandalfCardsDir,
1623
1570
  buildPublishedRuntimePayload,
1624
1571
  handleRuntimeApi,
1625
1572
  clearChatRecords,
@@ -124,18 +124,12 @@
124
124
  const p = params && typeof params === 'object' ? params : {};
125
125
  const boardId = String(p.boardId || 'default');
126
126
  const taskExecutorPath = typeof p.taskExecutorPath === 'string' ? p.taskExecutorPath.trim() : '';
127
- const runDemoSetup = p.runDemoSetup !== false;
128
127
  const mode = String(p.mode || currentMode || 'board');
129
128
  const rootEl = p.rootElement;
130
129
  if (!rootEl) throw new Error('bootstrapBoard requires params.rootElement');
131
130
 
132
131
  const paths = boardPaths(boardId);
133
132
 
134
- if (runDemoSetup) {
135
- const setup = await fetchServer(paths.demoSetup);
136
- if (!setup.ok) throw new Error(`Server demo-setup failed (${setup.status}).`);
137
- }
138
-
139
133
  const initBoardPath = taskExecutorPath
140
134
  ? `${paths.initBoard}?taskExecutorPath=${encodeURIComponent(taskExecutorPath)}`
141
135
  : paths.initBoard;