yaml-flow 7.1.0 → 8.0.1
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/browser/asset-integrity.json +8 -4
- package/browser/board-livecards-client.js +1 -1
- package/browser/board-livecards-localstorage.js +4 -4
- package/browser/live-cards.js +19 -3309
- package/cli/board-live-cards-lib-tjYsPt5U.d.ts +321 -0
- package/{dist/cli → cli}/browser-api/board-live-cards-browser-adapter.d.ts +3 -5
- package/{dist/cli → cli}/browser-api/card-store-browser-api.d.ts +1 -2
- package/{dist/cli → cli}/browser-api/card-store-browser-api.js +1 -1
- package/cli/execution-interface-ftO1W7Po.d.ts +286 -0
- package/{dist/cli → cli}/node/artifacts-store-cli.js +2 -2
- package/cli/node/batch-runner-cli.js +3 -0
- package/cli/node/board-live-cards-cli.js +15 -0
- package/{dist/cli → cli}/node/card-store-cli.js +1 -1
- package/{dist/cli → cli}/node/execution-adapter.d.ts +49 -4
- package/cli/node/execution-adapter.js +3 -0
- package/{dist/cli → cli}/node/fs-board-adapter.d.ts +24 -11
- package/cli/node/fs-board-adapter.js +14 -0
- package/cli/node/step-machine-cli.d.ts +7 -0
- package/cli/node/step-machine-cli.js +5 -0
- package/{dist/board-live-cards-public-5n1-syA3.d.cts → cli/types-C2YQXFwo.d.ts} +68 -5
- package/examples/board/.demo-setup/run-1778665078572-3466-a8ay4k/board-default/gandalf-runtime/.config/card-store-ref.json +1 -0
- package/examples/board/.demo-setup/run-1778665078572-3466-a8ay4k/board-default/gandalf-runtime/.config/chat-handler.json +1 -0
- package/examples/board/.demo-setup/run-1778665078572-3466-a8ay4k/board-default/gandalf-runtime/.config/outputs-store-ref.json +1 -0
- package/examples/board/.demo-setup/run-1778665078572-3466-a8ay4k/board-default/gandalf-runtime/.config/task-executor.json +1 -0
- package/examples/board/.demo-setup/run-1778665078572-3466-a8ay4k/board-default/gandalf-runtime/.state-snapshot/board/graph.json +29 -0
- package/examples/board/.demo-setup/run-1778665078572-3466-a8ay4k/board-default/gandalf-runtime/.state-snapshot/board/lastJournalProcessedId.json +1 -0
- package/examples/board/.demo-setup/run-1778665078572-3466-a8ay4k/board-default/gandalf-runtime-out/.outputs/status.json +25 -0
- package/examples/board/.demo-setup/run-1778665078572-3466-a8ay4k/board-default/runtime-out/.outputs/cards/card-market-prices/computed_values.json +67 -0
- package/examples/board/.demo-setup/run-1778665078572-3466-a8ay4k/board-default/runtime-out/.outputs/cards/card-portfolio/computed_values.json +1 -0
- package/examples/board/.demo-setup/run-1778665078572-3466-a8ay4k/board-default/runtime-out/.outputs/cards/card-portfolio-value/computed_values.json +52 -0
- package/examples/board/.demo-setup/run-1778665078572-3466-a8ay4k/board-default/runtime-out/.outputs/data-objects/holdings.json +22 -0
- package/examples/board/.demo-setup/run-1778665078572-3466-a8ay4k/board-default/runtime-out/.outputs/data-objects/positions.json +46 -0
- package/examples/board/.demo-setup/run-1778665078572-3466-a8ay4k/board-default/runtime-out/.outputs/data-objects/quotes.json +35 -0
- package/examples/board/.demo-setup/run-1778665078572-3466-a8ay4k/board-default/runtime-out/.outputs/status.json +113 -0
- package/examples/{example-board → board}/demo-server-config.json +0 -1
- package/examples/{example-board → board}/demo-server.js +23 -48
- package/examples/{example-board → board}/demo-shell-with-server.html +3 -3
- package/examples/{example-board → board}/demo-task-executor.js +71 -24
- package/examples/board/gandalf-cards/card-source-kinds.json +36 -0
- package/examples/board/gandalf-cards/cards/_index.json +7 -0
- package/examples/board/gandalf-cards/cards/card-source-kinds.json +64 -0
- package/examples/board/source-def-flows/copilot.flow.json +33 -0
- package/examples/board/source-def-flows/mock.flow.json +35 -0
- package/examples/board/source-def-flows/url-list.flow.json +33 -0
- package/examples/board/source-def-flows/url.flow.json +33 -0
- package/examples/board/source-def-flows/workiq.flow.json +34 -0
- package/examples/board/source-def-handlers/copilot-source-handler.js +141 -0
- package/examples/board/source-def-handlers/http-source-handler.js +145 -0
- package/examples/board/source_def_flows.json +249 -0
- package/examples/board/test/demo-http-test.js +317 -0
- package/examples/{example-board → board-local}/demo-shell-localstorage.html +4 -4
- package/examples/{browser/boards/portfolio-tracker → portfolio-tracker/handlers}/portfolio-tracker-fetch-prices.js +1 -1
- package/examples/{browser/boards/portfolio-tracker/portfolio-tracker-public.js → portfolio-tracker/portfolio-tracker.js} +11 -14
- package/examples/{browser/boards/portfolio-tracker → portfolio-tracker/test}/portfolio-t4.js +32 -50
- package/lib/artifacts-store-lib-public-BABrgFkV.d.ts +119 -0
- package/lib/artifacts-store-lib-public-DGa8BpJT.d.cts +119 -0
- package/lib/artifacts-store-public.cjs +2 -0
- package/lib/artifacts-store-public.d.cts +5 -0
- package/lib/artifacts-store-public.d.ts +5 -0
- package/lib/artifacts-store-public.js +2 -0
- package/lib/board-live-cards-node.cjs +14 -0
- package/lib/board-live-cards-node.d.cts +178 -0
- package/lib/board-live-cards-node.d.ts +178 -0
- package/lib/board-live-cards-node.js +14 -0
- package/lib/board-live-cards-public-BnmRAbQV.d.cts +383 -0
- package/{dist/board-live-cards-public-CK_J8uv0.d.ts → lib/board-live-cards-public-CsmYrvpd.d.ts} +142 -76
- package/lib/board-live-cards-public.cjs +3 -0
- package/lib/board-live-cards-public.d.cts +4 -0
- package/lib/board-live-cards-public.d.ts +4 -0
- package/lib/board-live-cards-public.js +3 -0
- package/lib/board-live-cards-server-runtime.cjs +9 -0
- package/lib/board-live-cards-server-runtime.d.cts +6 -0
- package/lib/board-live-cards-server-runtime.d.ts +6 -0
- package/lib/board-live-cards-server-runtime.js +9 -0
- package/lib/board-livegraph-runtime/index.cjs +3 -0
- package/{dist → lib}/board-livegraph-runtime/index.d.cts +1 -2
- package/{dist → lib}/board-livegraph-runtime/index.d.ts +1 -2
- package/lib/board-livegraph-runtime/index.js +3 -0
- package/{dist/storage-refs.cjs → lib/board-worker-adapter.cjs} +2 -2
- package/{dist/storage-refs.d.cts → lib/board-worker-adapter.d.cts} +4 -3
- package/{dist/storage-refs.d.ts → lib/board-worker-adapter.d.ts} +4 -3
- package/{dist/storage-refs.js → lib/board-worker-adapter.js} +2 -2
- package/{dist → lib}/card-compute/index.cjs +1 -1
- package/{dist → lib}/card-compute/index.js +1 -1
- package/lib/card-store-public.cjs +2 -0
- package/lib/card-store-public.d.cts +61 -0
- package/lib/card-store-public.d.ts +61 -0
- package/lib/card-store-public.js +2 -0
- package/lib/card-validation.cjs +10 -0
- package/lib/card-validation.d.cts +35 -0
- package/lib/card-validation.d.ts +35 -0
- package/lib/card-validation.js +10 -0
- package/{dist/constants-oCEbNpul.d.ts → lib/constants-BPVLb3Es.d.ts} +1 -1
- package/{dist/constants-BzZUyYlp.d.cts → lib/constants-DXxsRN9y.d.cts} +1 -1
- package/{dist → lib}/continuous-event-graph/index.cjs +2 -2
- package/{dist → lib}/continuous-event-graph/index.d.cts +3 -5
- package/{dist → lib}/continuous-event-graph/index.d.ts +3 -5
- package/{dist → lib}/continuous-event-graph/index.js +2 -2
- package/{dist → lib}/event-graph/index.d.cts +2 -2
- package/{dist → lib}/event-graph/index.d.ts +2 -2
- package/lib/execution-refs.cjs +3 -0
- package/{dist → lib}/execution-refs.d.cts +33 -12
- package/{dist → lib}/execution-refs.d.ts +33 -12
- package/lib/execution-refs.js +3 -0
- package/lib/index.cjs +25 -0
- package/{dist → lib}/index.d.cts +7 -8
- package/{dist → lib}/index.d.ts +7 -8
- package/lib/index.js +25 -0
- package/{dist/live-cards-bridge-BXbVTsna.d.cts → lib/live-cards-bridge-DC_ZU0eS.d.ts} +134 -3
- package/{dist/live-cards-bridge-Ds28XR15.d.ts → lib/live-cards-bridge-b25aAVvE.d.cts} +134 -3
- package/lib/loader-CuuLjxVA.d.cts +42 -0
- package/lib/loader-Zborm2pq.d.ts +42 -0
- package/lib/server-runtime/index.cjs +9 -0
- package/{dist → lib}/server-runtime/index.d.cts +4 -4
- package/{dist → lib}/server-runtime/index.d.ts +4 -4
- package/lib/server-runtime/index.js +9 -0
- package/lib/step-machine/index.d.cts +64 -0
- package/lib/step-machine/index.d.ts +64 -0
- package/lib/step-machine-public/index.cjs +5 -0
- package/{dist → lib}/step-machine-public/index.d.cts +14 -1
- package/{dist → lib}/step-machine-public/index.d.ts +14 -1
- package/lib/step-machine-public/index.js +5 -0
- package/lib/storage-interface-BhAON-gW.d.cts +84 -0
- package/lib/storage-interface-BhAON-gW.d.ts +84 -0
- package/lib/stores/index.cjs +3 -0
- package/lib/stores/index.d.cts +4 -0
- package/lib/stores/index.d.ts +4 -0
- package/lib/stores/index.js +3 -0
- package/lib/stores/kv.cjs +3 -0
- package/lib/stores/kv.d.cts +32 -0
- package/lib/stores/kv.d.ts +32 -0
- package/lib/stores/kv.js +3 -0
- package/{dist → lib}/stores/memory.d.cts +1 -1
- package/{dist → lib}/stores/memory.d.ts +1 -1
- package/{dist/types-HGDTWIun.d.ts → lib/types-CBxkYuLY.d.ts} +2 -1
- package/{dist/types-ycun84cq.d.cts → lib/types-DQ1bKuB1.d.cts} +11 -0
- package/{dist/types-ycun84cq.d.ts → lib/types-DQ1bKuB1.d.ts} +11 -0
- package/{dist/types-CU3DjTKL.d.cts → lib/types-DkFvgxwq.d.cts} +2 -1
- package/package.json +79 -119
- package/board-live-cards-cli.js +0 -37
- package/browser/board-livecards-client.js.map +0 -1
- package/browser/board-livecards-localstorage.js.map +0 -1
- package/browser/board-livegraph-engine.js +0 -3
- package/browser/board-livegraph-engine.js.map +0 -1
- package/browser/card-compute.js +0 -266
- package/browser/compute-jsonata.js.map +0 -1
- package/card-store.js +0 -37
- package/dist/batch/index.cjs.map +0 -1
- package/dist/batch/index.js.map +0 -1
- package/dist/board-live-cards-lib-Bg6EvCo5.d.cts +0 -136
- package/dist/board-live-cards-lib-jM2uYG1v.d.ts +0 -136
- package/dist/board-livegraph-runtime/index.cjs +0 -3
- package/dist/board-livegraph-runtime/index.cjs.map +0 -1
- package/dist/board-livegraph-runtime/index.js +0 -3
- package/dist/board-livegraph-runtime/index.js.map +0 -1
- package/dist/card-compute/index.cjs.map +0 -1
- package/dist/card-compute/index.js.map +0 -1
- package/dist/cli/browser-api/board-live-cards-browser-adapter.cjs +0 -3
- package/dist/cli/browser-api/board-live-cards-browser-adapter.cjs.map +0 -1
- package/dist/cli/browser-api/board-live-cards-browser-adapter.d.cts +0 -37
- package/dist/cli/browser-api/board-live-cards-browser-adapter.js.map +0 -1
- package/dist/cli/browser-api/card-store-browser-api.cjs +0 -2
- package/dist/cli/browser-api/card-store-browser-api.cjs.map +0 -1
- package/dist/cli/browser-api/card-store-browser-api.d.cts +0 -26
- package/dist/cli/browser-api/card-store-browser-api.js.map +0 -1
- package/dist/cli/node/artifacts-store-cli.cjs +0 -11
- package/dist/cli/node/artifacts-store-cli.cjs.map +0 -1
- package/dist/cli/node/artifacts-store-cli.d.cts +0 -8
- package/dist/cli/node/artifacts-store-cli.js.map +0 -1
- package/dist/cli/node/board-live-cards-cli.cjs +0 -15
- package/dist/cli/node/board-live-cards-cli.cjs.map +0 -1
- package/dist/cli/node/board-live-cards-cli.d.cts +0 -20
- package/dist/cli/node/board-live-cards-cli.js +0 -15
- package/dist/cli/node/board-live-cards-cli.js.map +0 -1
- package/dist/cli/node/card-store-cli.cjs +0 -8
- package/dist/cli/node/card-store-cli.cjs.map +0 -1
- package/dist/cli/node/card-store-cli.d.cts +0 -15
- package/dist/cli/node/card-store-cli.js.map +0 -1
- package/dist/cli/node/execution-adapter.cjs +0 -3
- package/dist/cli/node/execution-adapter.cjs.map +0 -1
- package/dist/cli/node/execution-adapter.d.cts +0 -174
- package/dist/cli/node/execution-adapter.js +0 -3
- package/dist/cli/node/execution-adapter.js.map +0 -1
- package/dist/cli/node/fs-board-adapter.cjs +0 -14
- package/dist/cli/node/fs-board-adapter.cjs.map +0 -1
- package/dist/cli/node/fs-board-adapter.d.cts +0 -204
- package/dist/cli/node/fs-board-adapter.js +0 -14
- package/dist/cli/node/fs-board-adapter.js.map +0 -1
- package/dist/cli/node/source-cli-task-executor.cjs +0 -11
- package/dist/cli/node/source-cli-task-executor.cjs.map +0 -1
- package/dist/cli/node/source-cli-task-executor.js.map +0 -1
- package/dist/config/index.cjs.map +0 -1
- package/dist/config/index.js.map +0 -1
- package/dist/continuous-event-graph/index.cjs.map +0 -1
- package/dist/continuous-event-graph/index.js.map +0 -1
- package/dist/event-graph/index.cjs.map +0 -1
- package/dist/event-graph/index.js.map +0 -1
- package/dist/execution-refs.cjs +0 -3
- package/dist/execution-refs.cjs.map +0 -1
- package/dist/execution-refs.js +0 -3
- package/dist/execution-refs.js.map +0 -1
- package/dist/index.cjs +0 -30
- package/dist/index.cjs.map +0 -1
- package/dist/index.js +0 -30
- package/dist/index.js.map +0 -1
- package/dist/inference/index.cjs +0 -7
- package/dist/inference/index.cjs.map +0 -1
- package/dist/inference/index.d.cts +0 -229
- package/dist/inference/index.d.ts +0 -229
- package/dist/inference/index.js +0 -7
- package/dist/inference/index.js.map +0 -1
- package/dist/server-runtime/index.cjs +0 -9
- package/dist/server-runtime/index.cjs.map +0 -1
- package/dist/server-runtime/index.js +0 -9
- package/dist/server-runtime/index.js.map +0 -1
- package/dist/step-machine/index.cjs.map +0 -1
- package/dist/step-machine/index.d.cts +0 -102
- package/dist/step-machine/index.d.ts +0 -102
- package/dist/step-machine/index.js.map +0 -1
- package/dist/step-machine-public/index.cjs +0 -3
- package/dist/step-machine-public/index.cjs.map +0 -1
- package/dist/step-machine-public/index.js +0 -3
- package/dist/step-machine-public/index.js.map +0 -1
- package/dist/storage-refs.cjs.map +0 -1
- package/dist/storage-refs.js.map +0 -1
- package/dist/stores/file.cjs +0 -2
- package/dist/stores/file.cjs.map +0 -1
- package/dist/stores/file.d.cts +0 -36
- package/dist/stores/file.d.ts +0 -36
- package/dist/stores/file.js +0 -2
- package/dist/stores/file.js.map +0 -1
- package/dist/stores/index.cjs +0 -2
- package/dist/stores/index.cjs.map +0 -1
- package/dist/stores/index.d.cts +0 -4
- package/dist/stores/index.d.ts +0 -4
- package/dist/stores/index.js +0 -2
- package/dist/stores/index.js.map +0 -1
- package/dist/stores/localStorage.cjs +0 -2
- package/dist/stores/localStorage.cjs.map +0 -1
- package/dist/stores/localStorage.d.cts +0 -34
- package/dist/stores/localStorage.d.ts +0 -34
- package/dist/stores/localStorage.js +0 -2
- package/dist/stores/localStorage.js.map +0 -1
- package/dist/stores/memory.cjs.map +0 -1
- package/dist/stores/memory.js.map +0 -1
- package/dist/types-CHSdoAAA.d.cts +0 -135
- package/dist/types-CoW0gQl3.d.ts +0 -135
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker-fetch-prices.py +0 -201
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker-http-test.js +0 -370
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker-http-test.py +0 -398
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker-inference-adapter.js +0 -196
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker-server.js +0 -300
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker-server.py +0 -617
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker.py +0 -366
- package/examples/browser/livecards-browser/index.html +0 -41
- package/examples/browser/step-machine-browser/index.html +0 -367
- package/examples/cli/step-machine-cli/portfolio-tracker/--base-ref/.runtime-out +0 -1
- package/examples/cli/step-machine-cli/portfolio-tracker/--base-ref/board-graph.json +0 -32
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/holdings-table.json +0 -22
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +0 -43
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +0 -15
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/price-fetch.json +0 -15
- package/examples/cli/step-machine-cli/portfolio-tracker/fetch-prices.js +0 -48
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/_board-cli.js +0 -125
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +0 -32
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/init-board-cli.js +0 -26
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/poll-status-cli.js +0 -49
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/reset-board-dir-cli.js +0 -25
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/retrigger-cli.js +0 -23
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/status-cli.js +0 -21
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +0 -38
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/wait-completed-cli.js +0 -48
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/write-prices-cli.js +0 -31
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/_board_pycli.py +0 -107
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/add-cards.py +0 -51
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/init-board.py +0 -45
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/poll-status.py +0 -71
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/reset-board-dir.py +0 -36
- package/examples/cli/step-machine-cli/portfolio-tracker/inline-python-demo.flow.yaml +0 -26
- package/examples/cli/step-machine-cli/portfolio-tracker/inline-python-handlers.py +0 -39
- package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker-pycli.flow.yaml +0 -80
- package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +0 -76
- package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.input.json +0 -44
- package/examples/cli/step-machine-cli/portfolio-tracker/run-inline-python-demo-pycli.py +0 -43
- package/examples/cli/step-machine-cli/portfolio-tracker/run-portfolio-tracker-pycli.py +0 -77
- package/examples/cli/step-machine-cli/portfolio-tracker/run-portfolio-tracker.bat +0 -28
- package/examples/cli/step-machine-demo/jsonata-init-board-cli.js +0 -31
- package/examples/cli/step-machine-demo/jsonata-init-board.flow.yaml +0 -54
- package/examples/cli/step-machine-demo/one-step-cli-only.flow.yaml +0 -21
- package/examples/cli/step-machine-demo/step-cli-echo-y.js +0 -15
- package/examples/cli/step-machine-demo/step2-double-cli.js +0 -33
- package/examples/cli/step-machine-demo/two-step-math.flow.yaml +0 -93
- package/examples/cli/step-machine-demo/two-step-mixed.flow.yaml +0 -43
- package/examples/example-board/agent-instructions-cardlayout.md +0 -56
- package/examples/example-board/agent-instructions.md +0 -834
- package/examples/example-board/demo-shell.html +0 -63
- package/examples/index.html +0 -785
- package/examples/npm-libs/batch/batch-step-machine.ts +0 -121
- package/examples/npm-libs/continuous-event-graph/live-cards-board.ts +0 -215
- package/examples/npm-libs/continuous-event-graph/live-portfolio-dashboard.ts +0 -555
- package/examples/npm-libs/continuous-event-graph/portfolio-tracker.ts +0 -287
- package/examples/npm-libs/continuous-event-graph/reactive-monitoring.ts +0 -265
- package/examples/npm-libs/continuous-event-graph/reactive-pipeline.ts +0 -168
- package/examples/npm-libs/continuous-event-graph/soc-incident-board.ts +0 -287
- package/examples/npm-libs/continuous-event-graph/stock-dashboard.ts +0 -229
- package/examples/npm-libs/event-graph/ci-cd-pipeline.ts +0 -243
- package/examples/npm-libs/event-graph/executor-diamond.ts +0 -165
- package/examples/npm-libs/event-graph/executor-pipeline.ts +0 -161
- package/examples/npm-libs/event-graph/research-pipeline.ts +0 -137
- package/examples/npm-libs/flows/ai-conversation.yaml +0 -116
- package/examples/npm-libs/flows/order-processing.yaml +0 -143
- package/examples/npm-libs/flows/simple-greeting.yaml +0 -54
- package/examples/npm-libs/graph-of-graphs/multi-stage-etl.ts +0 -307
- package/examples/npm-libs/graph-of-graphs/url-processing-pipeline.ts +0 -254
- package/examples/npm-libs/inference/azure-deployment.ts +0 -149
- package/examples/npm-libs/inference/copilot-cli.ts +0 -138
- package/examples/npm-libs/inference/data-pipeline.ts +0 -145
- package/examples/npm-libs/inference/pluggable-adapters.ts +0 -254
- package/examples/npm-libs/node/ai-conversation.ts +0 -195
- package/examples/npm-libs/node/simple-greeting.ts +0 -101
- package/examples/step-machine-cli/portfolio-tracker/cards/holdings-table.json +0 -22
- package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +0 -43
- package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +0 -15
- package/examples/step-machine-cli/portfolio-tracker/cards/price-fetch.json +0 -15
- package/examples/step-machine-cli/portfolio-tracker/fetch-prices.js +0 -48
- package/examples/step-machine-cli/portfolio-tracker/handlers/_board-cli.js +0 -57
- package/examples/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +0 -27
- package/examples/step-machine-cli/portfolio-tracker/handlers/init-board-cli.js +0 -25
- package/examples/step-machine-cli/portfolio-tracker/handlers/reset-board-dir-cli.js +0 -29
- package/examples/step-machine-cli/portfolio-tracker/handlers/retrigger-cli.js +0 -27
- package/examples/step-machine-cli/portfolio-tracker/handlers/status-cli.js +0 -25
- package/examples/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +0 -37
- package/examples/step-machine-cli/portfolio-tracker/handlers/wait-completed-cli.js +0 -53
- package/examples/step-machine-cli/portfolio-tracker/handlers/write-prices-cli.js +0 -35
- package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker-task-executor.cjs +0 -96
- package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +0 -227
- package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker.input.json +0 -38
- package/examples/step-machine-cli/portfolio-tracker/run-portfolio-tracker.bat +0 -28
- package/step-machine-cli.js +0 -407
- /package/{dist/cli → cli}/browser-api/board-live-cards-browser-adapter.js +0 -0
- /package/{dist/board-livegraph-runtime → cli/browser-api}/jsonata-sync.cjs +0 -0
- /package/{dist/cli → cli}/node/artifacts-store-cli.d.ts +0 -0
- /package/{dist/cli/node/source-cli-task-executor.d.cts → cli/node/batch-runner-cli.d.ts} +0 -0
- /package/{dist/cli → cli}/node/board-live-cards-cli.d.ts +0 -0
- /package/{dist/cli → cli}/node/card-store-cli.d.ts +0 -0
- /package/{dist/card-compute → cli/node}/jsonata-sync.cjs +0 -0
- /package/{dist/cli → cli}/node/source-cli-task-executor.d.ts +0 -0
- /package/{dist/cli → cli}/node/source-cli-task-executor.js +0 -0
- /package/examples/{example-board → board}/cards/card-concentration.json +0 -0
- /package/examples/{example-board → board}/cards/card-my-identity.json +0 -0
- /package/examples/{example-board → board}/cards/card-portfolio-action.json +0 -0
- /package/examples/{example-board → board}/cards/card-portfolio-intelligence.json +0 -0
- /package/examples/{example-board → board}/cards/card-portfolio-risks.json +0 -0
- /package/examples/{example-board → board}/cards/card-rebalance-impact.json +0 -0
- /package/examples/{example-board → board}/cards/card-rebalance-sim.json +0 -0
- /package/examples/{example-board → board}/cards/cardT-market-prices.json +0 -0
- /package/examples/{example-board → board}/cards/cardT-portfolio-value.json +0 -0
- /package/examples/{example-board → board}/cards/cardT-portfolio.json +0 -0
- /package/examples/{example-board → board}/demo-chat-handler.js +0 -0
- /package/examples/{example-board → board}/scripts/copilot_wrapper.bat +0 -0
- /package/examples/{example-board → board}/scripts/copilot_wrapper_helper.ps1 +0 -0
- /package/examples/{example-board → board}/scripts/workiq_wrapper.mjs +0 -0
- /package/examples/{browser/boards/portfolio-tracker → board/test}/portfolio-tracker-sse-worker.js +0 -0
- /package/{dist → lib}/batch/index.cjs +0 -0
- /package/{dist → lib}/batch/index.d.cts +0 -0
- /package/{dist → lib}/batch/index.d.ts +0 -0
- /package/{dist → lib}/batch/index.js +0 -0
- /package/{dist/cli/browser-api → lib/board-livegraph-runtime}/jsonata-sync.cjs +0 -0
- /package/{dist → lib}/card-compute/index.d.cts +0 -0
- /package/{dist → lib}/card-compute/index.d.ts +0 -0
- /package/{dist/cli/node → lib/card-compute}/jsonata-sync.cjs +0 -0
- /package/{dist → lib}/config/index.cjs +0 -0
- /package/{dist → lib}/config/index.d.cts +0 -0
- /package/{dist → lib}/config/index.d.ts +0 -0
- /package/{dist → lib}/config/index.js +0 -0
- /package/{dist → lib}/continuous-event-graph/jsonata-sync.cjs +0 -0
- /package/{dist → lib}/event-graph/index.cjs +0 -0
- /package/{dist → lib}/event-graph/index.js +0 -0
- /package/{dist → lib}/jsonata-sync.cjs +0 -0
- /package/{dist → lib}/server-runtime/jsonata-sync.cjs +0 -0
- /package/{dist → lib}/step-machine/index.cjs +0 -0
- /package/{dist → lib}/step-machine/index.js +0 -0
- /package/{dist → lib}/step-machine-public/jsonata-sync.cjs +0 -0
- /package/{dist → lib}/stores/memory.cjs +0 -0
- /package/{dist → lib}/stores/memory.js +0 -0
- /package/{dist → lib}/types-BBhqYGhE.d.cts +0 -0
- /package/{dist → lib}/types-BBhqYGhE.d.ts +0 -0
- /package/{dist → lib}/validate-BAVzUJWa.d.ts +0 -0
- /package/{dist → lib}/validate-Dbu7ygys.d.cts +0 -0
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Inference Example: Pluggable LLM Adapters
|
|
3
|
-
*
|
|
4
|
-
* Shows how to create adapters for different LLM providers.
|
|
5
|
-
* Each adapter implements InferenceAdapter.analyze(prompt) → string.
|
|
6
|
-
*
|
|
7
|
-
* Run with: npx tsx examples/npm-libs/inference/pluggable-adapters.ts
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
createLiveGraph,
|
|
12
|
-
schedule,
|
|
13
|
-
} from '../../src/continuous-event-graph/index.js';
|
|
14
|
-
import {
|
|
15
|
-
inferCompletions,
|
|
16
|
-
applyInferences,
|
|
17
|
-
buildInferencePrompt,
|
|
18
|
-
createCliAdapter,
|
|
19
|
-
createHttpAdapter,
|
|
20
|
-
} from '../../src/inference/index.js';
|
|
21
|
-
import type { InferenceAdapter } from '../../src/inference/index.js';
|
|
22
|
-
import type { GraphConfig } from '../../src/continuous-event-graph/types.js';
|
|
23
|
-
|
|
24
|
-
// ============================================================================
|
|
25
|
-
// 1. Adapter Examples (uncomment the one for your LLM provider)
|
|
26
|
-
// ============================================================================
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* OpenAI Adapter
|
|
30
|
-
* npm install openai
|
|
31
|
-
*/
|
|
32
|
-
function createOpenAIAdapter(apiKey: string, model = 'gpt-4o'): InferenceAdapter {
|
|
33
|
-
return {
|
|
34
|
-
analyze: async (prompt: string) => {
|
|
35
|
-
// import OpenAI from 'openai';
|
|
36
|
-
// const client = new OpenAI({ apiKey });
|
|
37
|
-
// const response = await client.chat.completions.create({
|
|
38
|
-
// model,
|
|
39
|
-
// messages: [{ role: 'user', content: prompt }],
|
|
40
|
-
// temperature: 0.1, // low temperature for deterministic analysis
|
|
41
|
-
// });
|
|
42
|
-
// return response.choices[0].message.content ?? '[]';
|
|
43
|
-
|
|
44
|
-
// Mock for demo
|
|
45
|
-
return '[]';
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Azure OpenAI Adapter
|
|
52
|
-
* npm install openai
|
|
53
|
-
*/
|
|
54
|
-
function createAzureOpenAIAdapter(
|
|
55
|
-
endpoint: string,
|
|
56
|
-
apiKey: string,
|
|
57
|
-
deployment: string,
|
|
58
|
-
): InferenceAdapter {
|
|
59
|
-
return {
|
|
60
|
-
analyze: async (prompt: string) => {
|
|
61
|
-
// import OpenAI from 'openai';
|
|
62
|
-
// const client = new OpenAI({
|
|
63
|
-
// apiKey,
|
|
64
|
-
// baseURL: `${endpoint}/openai/deployments/${deployment}`,
|
|
65
|
-
// defaultQuery: { 'api-version': '2024-02-15-preview' },
|
|
66
|
-
// defaultHeaders: { 'api-key': apiKey },
|
|
67
|
-
// });
|
|
68
|
-
// const response = await client.chat.completions.create({
|
|
69
|
-
// model: deployment,
|
|
70
|
-
// messages: [{ role: 'user', content: prompt }],
|
|
71
|
-
// temperature: 0.1,
|
|
72
|
-
// });
|
|
73
|
-
// return response.choices[0].message.content ?? '[]';
|
|
74
|
-
|
|
75
|
-
return '[]';
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Anthropic (Claude) Adapter
|
|
82
|
-
* npm install @anthropic-ai/sdk
|
|
83
|
-
*/
|
|
84
|
-
function createAnthropicAdapter(apiKey: string, model = 'claude-sonnet-4-20250514'): InferenceAdapter {
|
|
85
|
-
return {
|
|
86
|
-
analyze: async (prompt: string) => {
|
|
87
|
-
// import Anthropic from '@anthropic-ai/sdk';
|
|
88
|
-
// const client = new Anthropic({ apiKey });
|
|
89
|
-
// const response = await client.messages.create({
|
|
90
|
-
// model,
|
|
91
|
-
// max_tokens: 1024,
|
|
92
|
-
// messages: [{ role: 'user', content: prompt }],
|
|
93
|
-
// });
|
|
94
|
-
// return response.content[0].type === 'text' ? response.content[0].text : '[]';
|
|
95
|
-
|
|
96
|
-
return '[]';
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Local/Custom Adapter — call any HTTP endpoint
|
|
103
|
-
*/
|
|
104
|
-
function createCustomAdapter(url: string, headers: Record<string, string> = {}): InferenceAdapter {
|
|
105
|
-
return {
|
|
106
|
-
analyze: async (prompt: string) => {
|
|
107
|
-
const response = await fetch(url, {
|
|
108
|
-
method: 'POST',
|
|
109
|
-
headers: { 'Content-Type': 'application/json', ...headers },
|
|
110
|
-
body: JSON.stringify({ prompt }),
|
|
111
|
-
});
|
|
112
|
-
const data = await response.json() as { response?: string };
|
|
113
|
-
return data.response ?? '[]';
|
|
114
|
-
},
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// ============================================================================
|
|
119
|
-
// 1b. Built-in Adapter Factories (no boilerplate needed)
|
|
120
|
-
// ============================================================================
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Ollama via CLI — runs models locally
|
|
124
|
-
* Install: https://ollama.com
|
|
125
|
-
*/
|
|
126
|
-
const ollamaCliAdapter = createCliAdapter({
|
|
127
|
-
command: 'ollama',
|
|
128
|
-
args: (prompt) => ['run', 'llama3', prompt],
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Ollama via HTTP — same model, HTTP interface
|
|
133
|
-
* Start with: ollama serve
|
|
134
|
-
*/
|
|
135
|
-
const ollamaHttpAdapter = createHttpAdapter({
|
|
136
|
-
url: 'http://localhost:11434/api/generate',
|
|
137
|
-
buildBody: (prompt) => ({ model: 'llama3', prompt, stream: false }),
|
|
138
|
-
extractResponse: (json) => json.response as string,
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* llm CLI — Simon Willison's LLM tool
|
|
143
|
-
* Install: pip install llm
|
|
144
|
-
*/
|
|
145
|
-
const llmCliAdapter = createCliAdapter({
|
|
146
|
-
command: 'llm',
|
|
147
|
-
args: () => ['--no-stream'],
|
|
148
|
-
stdin: true, // pipe prompt via stdin (better for long prompts)
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* GitHub Copilot CLI — use gh copilot for inference
|
|
153
|
-
* Install: gh extension install github/gh-copilot
|
|
154
|
-
*/
|
|
155
|
-
const ghCopilotAdapter = createCliAdapter({
|
|
156
|
-
command: 'gh',
|
|
157
|
-
args: (prompt) => ['copilot', 'suggest', '-t', 'shell', prompt],
|
|
158
|
-
timeout: 30_000,
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Custom script adapter — run your own wrapper script
|
|
163
|
-
* The script receives the prompt as argument (or stdin) and prints JSON to stdout
|
|
164
|
-
*/
|
|
165
|
-
const customScriptAdapter = createCliAdapter({
|
|
166
|
-
command: 'python',
|
|
167
|
-
args: (prompt) => ['scripts/infer.py', '--json', prompt],
|
|
168
|
-
cwd: '/path/to/project',
|
|
169
|
-
env: { MODEL: 'gpt-4o', TEMPERATURE: '0.1' },
|
|
170
|
-
timeout: 60_000,
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
// ============================================================================
|
|
174
|
-
// 2. Demo: Use the prompt builder standalone
|
|
175
|
-
// ============================================================================
|
|
176
|
-
|
|
177
|
-
const config: GraphConfig = {
|
|
178
|
-
settings: { completion: 'all-tasks' },
|
|
179
|
-
tasks: {
|
|
180
|
-
'code-reviewed': {
|
|
181
|
-
provides: ['review-done'],
|
|
182
|
-
description: 'Code review completed by team lead',
|
|
183
|
-
inference: {
|
|
184
|
-
criteria: 'PR approved with at least 2 approvals and no open comments',
|
|
185
|
-
keywords: ['pull-request', 'code-review', 'approval'],
|
|
186
|
-
suggestedChecks: ['check PR status for "approved"', 'verify no open comments'],
|
|
187
|
-
autoDetectable: true,
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
'tests-passed': {
|
|
191
|
-
requires: ['review-done'],
|
|
192
|
-
provides: ['tests-green'],
|
|
193
|
-
description: 'CI pipeline tests all passing',
|
|
194
|
-
inference: {
|
|
195
|
-
criteria: 'All CI checks green, code coverage above 80%',
|
|
196
|
-
keywords: ['ci', 'tests', 'coverage', 'pipeline'],
|
|
197
|
-
suggestedChecks: ['check CI status', 'verify coverage report'],
|
|
198
|
-
autoDetectable: true,
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
'deployed-staging': {
|
|
202
|
-
requires: ['tests-green'],
|
|
203
|
-
provides: ['staging-live'],
|
|
204
|
-
description: 'Deployed to staging environment',
|
|
205
|
-
inference: {
|
|
206
|
-
criteria: 'Staging URL returns HTTP 200 with correct version',
|
|
207
|
-
keywords: ['staging', 'deployment', 'version'],
|
|
208
|
-
autoDetectable: true,
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
async function main() {
|
|
215
|
-
const live = createLiveGraph(config);
|
|
216
|
-
|
|
217
|
-
// Just build the prompt — useful for debugging or using with your own LLM code
|
|
218
|
-
const prompt = buildInferencePrompt(live, {
|
|
219
|
-
context: 'PR #142: 3 approvals, 0 open comments. CI: all 47 tests pass, coverage 84%.',
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
console.log('=== Generated LLM Prompt ===');
|
|
223
|
-
console.log(prompt);
|
|
224
|
-
console.log('\n=== End Prompt ===');
|
|
225
|
-
console.log(`\nPrompt length: ${prompt.length} characters`);
|
|
226
|
-
console.log('This prompt can be sent to any LLM provider.');
|
|
227
|
-
|
|
228
|
-
// Demo: use a mock adapter to show the full flow
|
|
229
|
-
const mockAdapter: InferenceAdapter = {
|
|
230
|
-
analyze: async () => JSON.stringify([
|
|
231
|
-
{ taskName: 'code-reviewed', confidence: 0.97, reasoning: '3 approvals, 0 open comments — PR is clearly approved.' },
|
|
232
|
-
{ taskName: 'tests-passed', confidence: 0.92, reasoning: '47/47 tests pass, coverage 84% exceeds 80% threshold.' },
|
|
233
|
-
]),
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
const result = await inferCompletions(live, mockAdapter, {
|
|
237
|
-
context: 'PR #142: 3 approvals, 0 open comments. CI: all 47 tests pass, coverage 84%.',
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
console.log('\n=== Inference Results ===');
|
|
241
|
-
for (const s of result.suggestions) {
|
|
242
|
-
console.log(` ${s.taskName}: ${(s.confidence * 100).toFixed(0)}% — ${s.reasoning}`);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// Apply above threshold
|
|
246
|
-
const updated = applyInferences(live, result, 0.9);
|
|
247
|
-
console.log('\n=== After Applying (threshold 90%) ===');
|
|
248
|
-
for (const [name, state] of Object.entries(updated.state.tasks)) {
|
|
249
|
-
console.log(` ${name}: ${state.status}`);
|
|
250
|
-
}
|
|
251
|
-
console.log(' Eligible:', schedule(updated).eligible);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
main().catch(console.error);
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Node.js Example: AI Conversation with External API
|
|
3
|
-
*
|
|
4
|
-
* Demonstrates a more complex flow with:
|
|
5
|
-
* - Component injection (AI client)
|
|
6
|
-
* - Retry logic
|
|
7
|
-
* - Circuit breakers
|
|
8
|
-
* - Event handling
|
|
9
|
-
*
|
|
10
|
-
* Run with: npx ts-node examples/npm-libs/node/ai-conversation.ts
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { createEngine, loadFlow, MemoryStore } from '../../src/index.js';
|
|
14
|
-
import type { StepInput, StepContext, StepResult } from '../../src/index.js';
|
|
15
|
-
import { fileURLToPath } from 'url';
|
|
16
|
-
import { dirname, join } from 'path';
|
|
17
|
-
|
|
18
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
19
|
-
const __dirname = dirname(__filename);
|
|
20
|
-
|
|
21
|
-
// Simulated AI client (replace with actual OpenAI/Anthropic client)
|
|
22
|
-
const mockAIClient = {
|
|
23
|
-
async generateResponse(prompt: string, history: string[]): Promise<{ text: string; confidence: number }> {
|
|
24
|
-
// Simulate API latency
|
|
25
|
-
await new Promise(resolve => setTimeout(resolve, 100));
|
|
26
|
-
|
|
27
|
-
// Simulate occasional low confidence
|
|
28
|
-
const confidence = Math.random() > 0.3 ? 0.85 : 0.4;
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
text: `AI Response to: "${prompt}" (simulated)`,
|
|
32
|
-
confidence,
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// Define step handlers
|
|
38
|
-
const handlers = {
|
|
39
|
-
async generate_response(input: StepInput, ctx: StepContext): Promise<StepResult> {
|
|
40
|
-
const userMessage = input.user_message as string;
|
|
41
|
-
const history = (input.conversation_history as string[]) || [];
|
|
42
|
-
|
|
43
|
-
// Access injected AI client from components
|
|
44
|
-
const ai = ctx.components.aiClient as typeof mockAIClient;
|
|
45
|
-
|
|
46
|
-
console.log(`[generate] Processing: "${userMessage}"`);
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
const response = await ai.generateResponse(userMessage, history);
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
result: 'success',
|
|
53
|
-
data: {
|
|
54
|
-
ai_response: response.text,
|
|
55
|
-
confidence_score: response.confidence,
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
} catch (error) {
|
|
59
|
-
console.log('[generate] API call failed, will retry...');
|
|
60
|
-
return { result: 'failure' };
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
async validate_response(input: StepInput, ctx: StepContext): Promise<StepResult> {
|
|
65
|
-
const response = input.ai_response as string;
|
|
66
|
-
const confidence = input.confidence_score as number;
|
|
67
|
-
|
|
68
|
-
console.log(`[validate] Confidence: ${(confidence * 100).toFixed(1)}%`);
|
|
69
|
-
|
|
70
|
-
// Check quality criteria
|
|
71
|
-
if (confidence >= 0.7 && response.length > 10) {
|
|
72
|
-
return {
|
|
73
|
-
result: 'valid',
|
|
74
|
-
data: {
|
|
75
|
-
validation_result: 'passed',
|
|
76
|
-
validation_feedback: null,
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return {
|
|
82
|
-
result: 'needs_refinement',
|
|
83
|
-
data: {
|
|
84
|
-
validation_result: 'needs_improvement',
|
|
85
|
-
validation_feedback: confidence < 0.7
|
|
86
|
-
? 'Low confidence - regenerate with more context'
|
|
87
|
-
: 'Response too short',
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
async refine_response(input: StepInput, ctx: StepContext): Promise<StepResult> {
|
|
93
|
-
const feedback = input.validation_feedback as string;
|
|
94
|
-
const userMessage = input.user_message as string;
|
|
95
|
-
|
|
96
|
-
console.log(`[refine] Refining based on: ${feedback}`);
|
|
97
|
-
|
|
98
|
-
const ai = ctx.components.aiClient as typeof mockAIClient;
|
|
99
|
-
|
|
100
|
-
// Enhanced prompt with feedback
|
|
101
|
-
const enhancedPrompt = `${userMessage} (Note: ${feedback})`;
|
|
102
|
-
const response = await ai.generateResponse(enhancedPrompt, []);
|
|
103
|
-
|
|
104
|
-
return {
|
|
105
|
-
result: 'success',
|
|
106
|
-
data: {
|
|
107
|
-
ai_response: response.text + ' [refined]',
|
|
108
|
-
confidence_score: Math.min(response.confidence + 0.2, 0.95), // Boost confidence
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
async check_approval(input: StepInput, ctx: StepContext): Promise<StepResult> {
|
|
114
|
-
const response = input.ai_response as string;
|
|
115
|
-
|
|
116
|
-
console.log(`[approval] Response ready: "${response}"`);
|
|
117
|
-
|
|
118
|
-
// Simulate user approval (in real app, this would wait for user input)
|
|
119
|
-
const userApproves = Math.random() > 0.3;
|
|
120
|
-
|
|
121
|
-
if (userApproves) {
|
|
122
|
-
console.log('[approval] User approved!');
|
|
123
|
-
return {
|
|
124
|
-
result: 'approved',
|
|
125
|
-
data: {
|
|
126
|
-
user_approved: true,
|
|
127
|
-
user_feedback: null,
|
|
128
|
-
},
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
console.log('[approval] User rejected, requesting changes');
|
|
133
|
-
return {
|
|
134
|
-
result: 'rejected',
|
|
135
|
-
data: {
|
|
136
|
-
user_approved: false,
|
|
137
|
-
user_feedback: 'Please make it more concise',
|
|
138
|
-
},
|
|
139
|
-
};
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
async incorporate_feedback(input: StepInput, ctx: StepContext): Promise<StepResult> {
|
|
143
|
-
const response = input.ai_response as string;
|
|
144
|
-
const feedback = input.user_feedback as string;
|
|
145
|
-
|
|
146
|
-
console.log(`[feedback] Incorporating: "${feedback}"`);
|
|
147
|
-
|
|
148
|
-
return {
|
|
149
|
-
result: 'success',
|
|
150
|
-
data: {
|
|
151
|
-
ai_response: response.replace(' [refined]', '') + ' [user-adjusted]',
|
|
152
|
-
confidence_score: 0.9,
|
|
153
|
-
},
|
|
154
|
-
};
|
|
155
|
-
},
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
async function main() {
|
|
159
|
-
// Load the AI conversation flow
|
|
160
|
-
const flowPath = join(__dirname, '../flows/ai-conversation.yaml');
|
|
161
|
-
const flow = await loadFlow(flowPath);
|
|
162
|
-
|
|
163
|
-
console.log('=== AI Conversation Flow Demo ===\n');
|
|
164
|
-
|
|
165
|
-
// Create engine with AI client component
|
|
166
|
-
const engine = createEngine(flow, handlers, {
|
|
167
|
-
store: new MemoryStore(),
|
|
168
|
-
components: {
|
|
169
|
-
aiClient: mockAIClient,
|
|
170
|
-
},
|
|
171
|
-
onTransition: (from, to) => {
|
|
172
|
-
console.log(` >> ${from} -> ${to}`);
|
|
173
|
-
},
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
// Subscribe to events
|
|
177
|
-
engine.on('step:error', (event) => {
|
|
178
|
-
console.log(` !! Error in step: ${event.data.step}`);
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
// Run the flow
|
|
182
|
-
const result = await engine.run({
|
|
183
|
-
user_message: 'Explain quantum computing in simple terms',
|
|
184
|
-
conversation_history: [],
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
console.log('\n=== Flow Complete ===');
|
|
188
|
-
console.log('Status:', result.status);
|
|
189
|
-
console.log('Intent:', result.intent);
|
|
190
|
-
console.log('Final Response:', result.data.ai_response);
|
|
191
|
-
console.log('Steps taken:', result.stepHistory.length);
|
|
192
|
-
console.log('Duration:', result.durationMs, 'ms');
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
main().catch(console.error);
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Node.js Example: Simple Greeting Flow
|
|
3
|
-
*
|
|
4
|
-
* Demonstrates basic usage with file-based persistence.
|
|
5
|
-
*
|
|
6
|
-
* Run with: npx ts-node examples/npm-libs/node/simple-greeting.ts
|
|
7
|
-
* Or after build: node examples/npm-libs/node/simple-greeting.js
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { createEngine, loadFlow, FileStore } from '../../src/index.js';
|
|
11
|
-
import type { StepInput, StepContext, StepResult } from '../../src/index.js';
|
|
12
|
-
import { fileURLToPath } from 'url';
|
|
13
|
-
import { dirname, join } from 'path';
|
|
14
|
-
|
|
15
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
-
const __dirname = dirname(__filename);
|
|
17
|
-
|
|
18
|
-
// Define step handlers as pure functions
|
|
19
|
-
const handlers = {
|
|
20
|
-
async greet(input: StepInput, ctx: StepContext): Promise<StepResult> {
|
|
21
|
-
const userName = (input.initial_name as string) || 'World';
|
|
22
|
-
|
|
23
|
-
console.log(`[${ctx.stepName}] Generating greeting for: ${userName}`);
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
result: 'success',
|
|
27
|
-
data: {
|
|
28
|
-
greeting: 'Hello',
|
|
29
|
-
user_name: userName,
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
async validate(input: StepInput, ctx: StepContext): Promise<StepResult> {
|
|
35
|
-
const { greeting, user_name } = input;
|
|
36
|
-
|
|
37
|
-
console.log(`[${ctx.stepName}] Validating: ${greeting} ${user_name}`);
|
|
38
|
-
|
|
39
|
-
const isValid = typeof greeting === 'string' &&
|
|
40
|
-
greeting.length > 0 &&
|
|
41
|
-
typeof user_name === 'string';
|
|
42
|
-
|
|
43
|
-
if (!isValid) {
|
|
44
|
-
return { result: 'invalid', data: { is_valid: false } };
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
result: 'success',
|
|
49
|
-
data: { is_valid: true },
|
|
50
|
-
};
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
async personalize(input: StepInput, ctx: StepContext): Promise<StepResult> {
|
|
54
|
-
const { greeting, user_name } = input;
|
|
55
|
-
|
|
56
|
-
const finalMessage = `${greeting}, ${user_name}! Welcome to yaml-flow.`;
|
|
57
|
-
|
|
58
|
-
console.log(`[${ctx.stepName}] Created message: ${finalMessage}`);
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
result: 'success',
|
|
62
|
-
data: { final_message: finalMessage },
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
async function main() {
|
|
68
|
-
// Load flow from YAML file
|
|
69
|
-
const flowPath = join(__dirname, '../flows/simple-greeting.yaml');
|
|
70
|
-
const flow = await loadFlow(flowPath);
|
|
71
|
-
|
|
72
|
-
console.log('Loaded flow:', flow.id ?? 'simple-greeting');
|
|
73
|
-
console.log('Steps:', Object.keys(flow.steps).join(', '));
|
|
74
|
-
console.log('---');
|
|
75
|
-
|
|
76
|
-
// Create engine with file-based persistence
|
|
77
|
-
const engine = createEngine(flow, handlers, {
|
|
78
|
-
store: new FileStore({ directory: './flow-data' }),
|
|
79
|
-
onStep: (step, result) => {
|
|
80
|
-
console.log(`Step completed: ${step} -> ${result.result}`);
|
|
81
|
-
},
|
|
82
|
-
onTransition: (from, to) => {
|
|
83
|
-
console.log(`Transition: ${from} -> ${to}`);
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
// Run the flow
|
|
88
|
-
const result = await engine.run({
|
|
89
|
-
initial_name: 'Developer',
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
console.log('---');
|
|
93
|
-
console.log('Flow Result:');
|
|
94
|
-
console.log(' Status:', result.status);
|
|
95
|
-
console.log(' Intent:', result.intent);
|
|
96
|
-
console.log(' Data:', result.data);
|
|
97
|
-
console.log(' Steps:', result.stepHistory.join(' -> '));
|
|
98
|
-
console.log(' Duration:', result.durationMs, 'ms');
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
main().catch(console.error);
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "holdings-table",
|
|
3
|
-
"meta": { "title": "Holdings Table" },
|
|
4
|
-
"requires": ["holdings", "prices"],
|
|
5
|
-
"provides": [{ "bindTo": "table", "ref": "computed_values.table" }],
|
|
6
|
-
"card_data": {},
|
|
7
|
-
"compute": [
|
|
8
|
-
{
|
|
9
|
-
"bindTo": "table",
|
|
10
|
-
"expr": "{ \"rows\": $map(requires.holdings, function($h) { { \"symbol\": $h.symbol, \"qty\": $h.qty, \"price\": $lookup(requires.prices, $h.symbol), \"value\": $h.qty * $lookup(requires.prices, $h.symbol) } }) }"
|
|
11
|
-
}
|
|
12
|
-
],
|
|
13
|
-
"view": {
|
|
14
|
-
"elements": [
|
|
15
|
-
{
|
|
16
|
-
"kind": "table",
|
|
17
|
-
"label": "Portfolio Positions",
|
|
18
|
-
"data": { "bind": "computed_values.table.rows", "columns": ["symbol", "qty", "price", "value"] }
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "portfolio-form",
|
|
3
|
-
"meta": {
|
|
4
|
-
"title": "Portfolio Holdings Form"
|
|
5
|
-
},
|
|
6
|
-
"provides": [
|
|
7
|
-
{
|
|
8
|
-
"bindTo": "holdings",
|
|
9
|
-
"ref": "card_data.holdings"
|
|
10
|
-
}
|
|
11
|
-
],
|
|
12
|
-
"card_data": {
|
|
13
|
-
"holdings": [
|
|
14
|
-
{
|
|
15
|
-
"symbol": "AAPL",
|
|
16
|
-
"qty": 50
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"symbol": "MSFT",
|
|
20
|
-
"qty": 30
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"symbol": "GOOG",
|
|
24
|
-
"qty": 100
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
"view": {
|
|
29
|
-
"elements": [
|
|
30
|
-
{
|
|
31
|
-
"kind": "table",
|
|
32
|
-
"label": "Holdings",
|
|
33
|
-
"data": {
|
|
34
|
-
"bind": "card_data.holdings",
|
|
35
|
-
"columns": [
|
|
36
|
-
"symbol",
|
|
37
|
-
"qty"
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "portfolio-value",
|
|
3
|
-
"meta": { "title": "Portfolio Total Value" },
|
|
4
|
-
"requires": ["table"],
|
|
5
|
-
"provides": [{ "bindTo": "totalValue", "ref": "computed_values.totalValue" }],
|
|
6
|
-
"card_data": {},
|
|
7
|
-
"compute": [
|
|
8
|
-
{ "bindTo": "totalValue", "expr": "$sum(requires.table.rows.value)" }
|
|
9
|
-
],
|
|
10
|
-
"view": {
|
|
11
|
-
"elements": [
|
|
12
|
-
{ "kind": "metric", "label": "Total Portfolio Value", "data": { "bind": "computed_values.totalValue" } }
|
|
13
|
-
]
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "price-fetch",
|
|
3
|
-
"meta": { "title": "Fetch Market Prices" },
|
|
4
|
-
"requires": ["holdings"],
|
|
5
|
-
"provides": [{ "bindTo": "prices", "ref": "fetched_sources.prices" }],
|
|
6
|
-
"card_data": {},
|
|
7
|
-
"source_defs": [
|
|
8
|
-
{ "cli": "node ../fetch-prices.js --tmp-file-name tmp_file1", "bindTo": "prices", "outputFile": "prices.json" }
|
|
9
|
-
],
|
|
10
|
-
"view": {
|
|
11
|
-
"elements": [
|
|
12
|
-
{ "kind": "table", "label": "Market Prices", "data": { "bind": "fetched_sources.prices" } }
|
|
13
|
-
]
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* fetch-prices.js
|
|
3
|
-
* Polls for tmp_file1 payload and outputs JSON to stdout once available.
|
|
4
|
-
*/
|
|
5
|
-
import * as fs from 'node:fs';
|
|
6
|
-
import * as path from 'node:path';
|
|
7
|
-
|
|
8
|
-
function getArgValue(flagName) {
|
|
9
|
-
const idx = process.argv.indexOf(flagName);
|
|
10
|
-
if (idx < 0) return undefined;
|
|
11
|
-
return process.argv[idx + 1];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const envBoardDir = (process.env.BOARD_DIR ?? '').trim();
|
|
15
|
-
const tmpFileName = String(getArgValue('--tmp-file-name') ?? process.env.TMP_FILE_NAME ?? 'tmp_file1').trim();
|
|
16
|
-
const tmpFilePath = envBoardDir ? path.join(envBoardDir, tmpFileName) : '';
|
|
17
|
-
|
|
18
|
-
if (!tmpFilePath) {
|
|
19
|
-
console.error('BOARD_DIR environment variable is required for fetch-prices.js');
|
|
20
|
-
process.exit(1);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function getReadableTmpFile() {
|
|
24
|
-
if (!fs.existsSync(tmpFilePath)) return undefined;
|
|
25
|
-
const content = fs.readFileSync(tmpFilePath, 'utf-8').trim();
|
|
26
|
-
if (!content) return undefined;
|
|
27
|
-
return { tmpFile: tmpFilePath, content };
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function waitForFile(timeoutMs = 120000) {
|
|
31
|
-
const started = Date.now();
|
|
32
|
-
const interval = setInterval(() => {
|
|
33
|
-
if (Date.now() - started > timeoutMs) {
|
|
34
|
-
clearInterval(interval);
|
|
35
|
-
console.error('Timed out waiting for tmp_file1 market prices input.');
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const ready = getReadableTmpFile();
|
|
40
|
-
if (!ready) return;
|
|
41
|
-
|
|
42
|
-
clearInterval(interval);
|
|
43
|
-
fs.writeFileSync(ready.tmpFile, '', 'utf-8');
|
|
44
|
-
process.stdout.write(`${ready.content}\n`);
|
|
45
|
-
}, 250);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
waitForFile();
|