yaml-flow 5.3.0 → 5.4.0

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.
@@ -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
  }
@@ -1617,9 +1566,9 @@ export function createExampleBoardServerRuntime(options = {}) {
1617
1566
  parseUrl,
1618
1567
  json,
1619
1568
  runCli,
1620
- demoPrepSetup,
1621
- ensureDemoSetup,
1622
- isDemoSetupDone,
1569
+ cardsDir,
1570
+ gandalfCardsDir,
1571
+ tmpGandalfCardsDir,
1623
1572
  buildPublishedRuntimePayload,
1624
1573
  handleRuntimeApi,
1625
1574
  clearChatRecords,