yaml-flow 5.4.0 → 6.0.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.
Files changed (200) hide show
  1. package/board-live-cards-cli.js +2 -2
  2. package/board-livecards-server-runtime.js +488 -551
  3. package/browser/asset-integrity.json +10 -0
  4. package/browser/board-livecards-runtime-client.js +0 -6
  5. package/browser/board-livegraph-engine.js +2 -1676
  6. package/browser/board-livegraph-engine.js.map +1 -1
  7. package/browser/live-cards.js +347 -26
  8. package/browser/live-cards.schema.json +418 -132
  9. package/card-store.js +37 -0
  10. package/dist/batch/index.cjs +1 -108
  11. package/dist/batch/index.cjs.map +1 -1
  12. package/dist/batch/index.js +1 -106
  13. package/dist/batch/index.js.map +1 -1
  14. package/dist/board-live-cards-lib-Bg6EvCo5.d.cts +136 -0
  15. package/dist/board-live-cards-lib-jM2uYG1v.d.ts +136 -0
  16. package/dist/board-live-cards-public-CltXYgaY.d.cts +314 -0
  17. package/dist/board-live-cards-public-f-E-FAyp.d.ts +314 -0
  18. package/dist/board-livegraph-runtime/index.cjs +2 -1671
  19. package/dist/board-livegraph-runtime/index.cjs.map +1 -1
  20. package/dist/board-livegraph-runtime/index.d.cts +1 -2
  21. package/dist/board-livegraph-runtime/index.d.ts +1 -2
  22. package/dist/board-livegraph-runtime/index.js +2 -1662
  23. package/dist/board-livegraph-runtime/index.js.map +1 -1
  24. package/dist/board-livegraph-runtime/jsonata-sync.cjs +7587 -0
  25. package/dist/card-compute/index.cjs +9 -7159
  26. package/dist/card-compute/index.cjs.map +1 -1
  27. package/dist/card-compute/index.d.cts +22 -0
  28. package/dist/card-compute/index.d.ts +22 -0
  29. package/dist/card-compute/index.js +9 -7145
  30. package/dist/card-compute/index.js.map +1 -1
  31. package/dist/card-compute/jsonata-sync.cjs +7587 -0
  32. package/dist/cli/browser-api/board-live-cards-browser-adapter.cjs +2 -0
  33. package/dist/cli/browser-api/board-live-cards-browser-adapter.cjs.map +1 -0
  34. package/dist/cli/browser-api/board-live-cards-browser-adapter.d.cts +24 -0
  35. package/dist/cli/browser-api/board-live-cards-browser-adapter.d.ts +24 -0
  36. package/dist/cli/browser-api/board-live-cards-browser-adapter.js +2 -0
  37. package/dist/cli/browser-api/board-live-cards-browser-adapter.js.map +1 -0
  38. package/dist/cli/browser-api/card-store-browser-api.cjs +2 -0
  39. package/dist/cli/browser-api/card-store-browser-api.cjs.map +1 -0
  40. package/dist/cli/browser-api/card-store-browser-api.d.cts +26 -0
  41. package/dist/cli/browser-api/card-store-browser-api.d.ts +26 -0
  42. package/dist/cli/browser-api/card-store-browser-api.js +2 -0
  43. package/dist/cli/browser-api/card-store-browser-api.js.map +1 -0
  44. package/dist/cli/browser-api/jsonata-sync.cjs +7587 -0
  45. package/dist/cli/node/artifacts-store-cli.cjs +11 -0
  46. package/dist/cli/node/artifacts-store-cli.cjs.map +1 -0
  47. package/dist/cli/node/artifacts-store-cli.d.cts +8 -0
  48. package/dist/cli/node/artifacts-store-cli.d.ts +8 -0
  49. package/dist/cli/node/artifacts-store-cli.js +11 -0
  50. package/dist/cli/node/artifacts-store-cli.js.map +1 -0
  51. package/dist/cli/node/board-live-cards-cli.cjs +15 -0
  52. package/dist/cli/node/board-live-cards-cli.cjs.map +1 -0
  53. package/dist/cli/node/board-live-cards-cli.d.cts +20 -0
  54. package/dist/cli/node/board-live-cards-cli.d.ts +20 -0
  55. package/dist/cli/node/board-live-cards-cli.js +15 -0
  56. package/dist/cli/node/board-live-cards-cli.js.map +1 -0
  57. package/dist/cli/node/card-store-cli.cjs +8 -0
  58. package/dist/cli/node/card-store-cli.cjs.map +1 -0
  59. package/dist/cli/node/card-store-cli.d.cts +15 -0
  60. package/dist/cli/node/card-store-cli.d.ts +15 -0
  61. package/dist/cli/node/card-store-cli.js +8 -0
  62. package/dist/cli/node/card-store-cli.js.map +1 -0
  63. package/dist/cli/node/fs-board-adapter.cjs +14 -0
  64. package/dist/cli/node/fs-board-adapter.cjs.map +1 -0
  65. package/dist/cli/node/fs-board-adapter.d.cts +204 -0
  66. package/dist/cli/node/fs-board-adapter.d.ts +204 -0
  67. package/dist/cli/node/fs-board-adapter.js +14 -0
  68. package/dist/cli/node/fs-board-adapter.js.map +1 -0
  69. package/dist/cli/node/jsonata-sync.cjs +7587 -0
  70. package/dist/cli/node/source-cli-task-executor.cjs +11 -0
  71. package/dist/cli/node/source-cli-task-executor.cjs.map +1 -0
  72. package/dist/cli/node/source-cli-task-executor.d.cts +1 -0
  73. package/dist/cli/node/source-cli-task-executor.d.ts +1 -0
  74. package/dist/cli/node/source-cli-task-executor.js +11 -0
  75. package/dist/cli/node/source-cli-task-executor.js.map +1 -0
  76. package/dist/config/index.cjs +1 -79
  77. package/dist/config/index.cjs.map +1 -1
  78. package/dist/config/index.js +1 -76
  79. package/dist/config/index.js.map +1 -1
  80. package/dist/continuous-event-graph/index.cjs +2 -2129
  81. package/dist/continuous-event-graph/index.cjs.map +1 -1
  82. package/dist/continuous-event-graph/index.d.cts +81 -5
  83. package/dist/continuous-event-graph/index.d.ts +81 -5
  84. package/dist/continuous-event-graph/index.js +2 -2088
  85. package/dist/continuous-event-graph/index.js.map +1 -1
  86. package/dist/continuous-event-graph/jsonata-sync.cjs +7587 -0
  87. package/dist/event-graph/index.cjs +22 -8292
  88. package/dist/event-graph/index.cjs.map +1 -1
  89. package/dist/event-graph/index.js +22 -8237
  90. package/dist/event-graph/index.js.map +1 -1
  91. package/dist/execution-refs.cjs +2 -0
  92. package/dist/execution-refs.cjs.map +1 -0
  93. package/dist/execution-refs.d.cts +222 -0
  94. package/dist/execution-refs.d.ts +222 -0
  95. package/dist/execution-refs.js +2 -0
  96. package/dist/execution-refs.js.map +1 -0
  97. package/dist/index.cjs +29 -13221
  98. package/dist/index.cjs.map +1 -1
  99. package/dist/index.d.cts +2 -4
  100. package/dist/index.d.ts +2 -4
  101. package/dist/index.js +29 -13112
  102. package/dist/index.js.map +1 -1
  103. package/dist/inference/index.cjs +5 -617
  104. package/dist/inference/index.cjs.map +1 -1
  105. package/dist/inference/index.js +5 -610
  106. package/dist/inference/index.js.map +1 -1
  107. package/dist/jsonata-sync.cjs +7587 -0
  108. package/dist/{live-cards-bridge-x5XREkXm.d.cts → live-cards-bridge-BXbVTsna.d.cts} +27 -4
  109. package/dist/{live-cards-bridge-EQjytzI_.d.ts → live-cards-bridge-Ds28XR15.d.ts} +27 -4
  110. package/dist/pycli/quickjs-board-runtime.global.js +9 -0
  111. package/dist/pycli/quickjs-board-runtime.global.js.map +1 -0
  112. package/dist/pycli/quickjs-step-machine-runtime.global.js +5 -0
  113. package/dist/pycli/quickjs-step-machine-runtime.global.js.map +1 -0
  114. package/dist/step-machine/index.cjs +11 -7129
  115. package/dist/step-machine/index.cjs.map +1 -1
  116. package/dist/step-machine/index.js +11 -7113
  117. package/dist/step-machine/index.js.map +1 -1
  118. package/dist/storage-refs.cjs +10 -0
  119. package/dist/storage-refs.cjs.map +1 -0
  120. package/dist/storage-refs.d.cts +92 -0
  121. package/dist/storage-refs.d.ts +92 -0
  122. package/dist/storage-refs.js +10 -0
  123. package/dist/storage-refs.js.map +1 -0
  124. package/dist/stores/file.cjs +1 -114
  125. package/dist/stores/file.cjs.map +1 -1
  126. package/dist/stores/file.js +1 -112
  127. package/dist/stores/file.js.map +1 -1
  128. package/dist/stores/index.cjs +1 -231
  129. package/dist/stores/index.cjs.map +1 -1
  130. package/dist/stores/index.js +1 -227
  131. package/dist/stores/index.js.map +1 -1
  132. package/dist/stores/localStorage.cjs +1 -76
  133. package/dist/stores/localStorage.cjs.map +1 -1
  134. package/dist/stores/localStorage.js +1 -74
  135. package/dist/stores/localStorage.js.map +1 -1
  136. package/dist/stores/memory.cjs +1 -47
  137. package/dist/stores/memory.cjs.map +1 -1
  138. package/dist/stores/memory.js +1 -45
  139. package/dist/stores/memory.js.map +1 -1
  140. package/examples/browser/boards/portfolio-tracker/portfolio-t4.js +292 -0
  141. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-fetch-prices.js +218 -0
  142. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-fetch-prices.py +201 -0
  143. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-inference-adapter.js +25 -16
  144. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-public.js +553 -0
  145. package/examples/browser/boards/portfolio-tracker/portfolio-tracker.py +365 -0
  146. package/examples/cli/step-machine-cli/portfolio-tracker/--base-ref/.runtime-out +1 -0
  147. package/examples/cli/step-machine-cli/portfolio-tracker/--base-ref/board-graph.json +32 -0
  148. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/_board-cli.js +53 -1
  149. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/add-cards-cli.js +15 -6
  150. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/init-board-cli.js +6 -1
  151. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/poll-status-cli.js +57 -0
  152. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/retrigger-cli.js +1 -1
  153. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/status-cli.js +1 -1
  154. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +7 -2
  155. package/examples/cli/step-machine-cli/portfolio-tracker/handlers/wait-completed-cli.js +6 -2
  156. package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/_board_pycli.py +97 -0
  157. package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/add-cards.py +50 -0
  158. package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/init-board.py +44 -0
  159. package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/poll-status.py +70 -0
  160. package/examples/cli/step-machine-cli/portfolio-tracker/handlers-py/reset-board-dir.py +36 -0
  161. package/examples/cli/step-machine-cli/portfolio-tracker/inline-python-demo.flow.yaml +26 -0
  162. package/examples/cli/step-machine-cli/portfolio-tracker/inline-python-handlers.py +39 -0
  163. package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker-pycli.flow.yaml +80 -0
  164. package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.flow.yaml +25 -172
  165. package/examples/cli/step-machine-cli/portfolio-tracker/portfolio-tracker.input.json +40 -34
  166. package/examples/cli/step-machine-cli/portfolio-tracker/run-inline-python-demo-pycli.py +46 -0
  167. package/examples/cli/step-machine-cli/portfolio-tracker/run-portfolio-tracker-pycli.py +77 -0
  168. package/examples/cli/step-machine-cli/portfolio-tracker/run-portfolio-tracker.bat +1 -2
  169. package/examples/example-board/agent-instructions.md +11 -5
  170. package/examples/example-board/demo-chat-handler.js +14 -4
  171. package/examples/example-board/demo-server-config.json +1 -0
  172. package/examples/example-board/demo-server.js +19 -34
  173. package/examples/example-board/demo-shell-browser.html +5 -4
  174. package/examples/example-board/demo-shell-with-server.html +10 -6
  175. package/examples/example-board/demo-task-executor.js +81 -35
  176. package/examples/index.html +0 -14
  177. package/examples/step-machine-cli/portfolio-tracker/handlers/_board-cli.js +0 -1
  178. package/examples/step-machine-cli/portfolio-tracker/run-portfolio-tracker.bat +1 -2
  179. package/package.json +39 -3
  180. package/schema/live-cards.schema.json +418 -132
  181. package/dist/cli/board-live-cards-cli.cjs +0 -10644
  182. package/dist/cli/board-live-cards-cli.cjs.map +0 -1
  183. package/dist/cli/board-live-cards-cli.d.cts +0 -179
  184. package/dist/cli/board-live-cards-cli.d.ts +0 -179
  185. package/dist/cli/board-live-cards-cli.js +0 -10592
  186. package/dist/cli/board-live-cards-cli.js.map +0 -1
  187. package/dist/journal-9HEgs7dU.d.ts +0 -28
  188. package/dist/journal-B-JCfQnh.d.cts +0 -28
  189. package/dist/schedule-Cszq9LYY.d.ts +0 -21
  190. package/dist/schedule-qWNL0RQh.d.cts +0 -21
  191. package/examples/browser/boards/portfolio-tracker/cards/holdings-table.json +0 -22
  192. package/examples/browser/boards/portfolio-tracker/cards/portfolio-form.json +0 -16
  193. package/examples/browser/boards/portfolio-tracker/cards/portfolio-risk-assessment.json +0 -28
  194. package/examples/browser/boards/portfolio-tracker/cards/portfolio-value.json +0 -15
  195. package/examples/browser/boards/portfolio-tracker/cards/price-fetch.json +0 -15
  196. package/examples/browser/boards/portfolio-tracker/cards/rebalancing-strategy.json +0 -28
  197. package/examples/browser/boards/portfolio-tracker/fetch-prices.js +0 -43
  198. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-task-executor.cjs +0 -96
  199. package/examples/browser/boards/portfolio-tracker/portfolio-tracker.bat +0 -7
  200. package/examples/browser/boards/portfolio-tracker/portfolio-tracker.js +0 -351
@@ -0,0 +1,201 @@
1
+ #!/usr/bin/env python3
2
+ """portfolio-tracker-fetch-prices.py
3
+
4
+ Task executor for the portfolio board demo.
5
+ Handles run-source-fetch requests for source_defs with kind: "mock-quotes".
6
+ Generates random prices (2dp, 10.00-999.99) for each projected ticker.
7
+
8
+ Subcommands:
9
+ run-source-fetch --in-ref <::kind::value> --out-ref <::kind::value> --err-ref <::kind::value>
10
+ validate-source-def --in <source.json>
11
+ describe-capabilities
12
+
13
+ Uses the public storage adapter for all storage and callback operations.
14
+ The executor does NOT contain transport-specific callback logic.
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ import argparse
20
+ import json
21
+ import os
22
+ import random
23
+ import sys
24
+ import time
25
+ from typing import Any
26
+
27
+ # Add pycli to path so we can import the public storage adapter.
28
+ _REPO_ROOT = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..'))
29
+ if _REPO_ROOT not in sys.path:
30
+ sys.path.insert(0, _REPO_ROOT)
31
+
32
+ from pycli.sub.public_storage_adapter import ( # noqa: E402
33
+ parse_ref,
34
+ serialize_ref,
35
+ blob_storage_for_ref,
36
+ report_complete,
37
+ report_failed,
38
+ KindValueRef,
39
+ )
40
+
41
+
42
+ def _parse_ref_str(ref: str) -> KindValueRef:
43
+ """Convenience: parse a CLI ref string."""
44
+ return parse_ref(ref)
45
+
46
+
47
+ def validate_source_def(source_def: dict[str, Any]) -> dict[str, Any]:
48
+ errors: list[str] = []
49
+
50
+ if source_def.get("kind") != "mock-quotes":
51
+ errors.append(f"kind must be \"mock-quotes\"; got \"{source_def.get('kind')}\".")
52
+ if not isinstance(source_def.get("bindTo"), str) or not source_def.get("bindTo"):
53
+ errors.append("bindTo is required and must be a string.")
54
+ if not isinstance(source_def.get("outputFile"), str) or not source_def.get("outputFile"):
55
+ errors.append("outputFile is required and must be a string.")
56
+ projections = source_def.get("projections")
57
+ if not isinstance(projections, dict) or not isinstance(projections.get("tickers"), str):
58
+ errors.append("projections.tickers is required and must be a JSONata expression string.")
59
+
60
+ return {"ok": len(errors) == 0, "errors": errors}
61
+
62
+
63
+ def cmd_validate_source_def(args: argparse.Namespace) -> int:
64
+ if not os.path.exists(args.input):
65
+ print(json.dumps({"ok": False, "errors": [f"Input file not found: {args.input}"]}))
66
+ return 1
67
+
68
+ try:
69
+ with open(args.input, "r", encoding="utf-8") as f:
70
+ source_def = json.load(f)
71
+ except Exception as e:
72
+ print(json.dumps({"ok": False, "errors": [f"Cannot parse source file: {e}"]}))
73
+ return 1
74
+
75
+ result = validate_source_def(source_def if isinstance(source_def, dict) else {})
76
+ print(json.dumps(result))
77
+ return 0 if result["ok"] else 1
78
+
79
+
80
+ def cmd_describe_capabilities(_: argparse.Namespace) -> int:
81
+ capabilities = {
82
+ "version": "1.0",
83
+ "executor": "portfolio-tracker-fetch-prices",
84
+ "subcommands": ["run-source-fetch", "validate-source-def", "describe-capabilities"],
85
+ "sourceKinds": {
86
+ "mock-quotes": {
87
+ "description": "Generates random mock market prices (10.00-999.99) for each ticker in _projections.tickers.",
88
+ "inputSchema": {
89
+ "kind": {"type": "string", "required": True, "description": "Must be \"mock-quotes\"."},
90
+ "bindTo": {"type": "string", "required": True, "description": "Token name for the output binding."},
91
+ "outputFile": {"type": "string", "required": True, "description": "Relative path to write prices JSON."},
92
+ "projections": {
93
+ "type": "object",
94
+ "required": True,
95
+ "properties": {
96
+ "tickers": {
97
+ "type": "string",
98
+ "required": True,
99
+ "description": "JSONata expression resolving to a string[] of ticker symbols.",
100
+ }
101
+ },
102
+ },
103
+ },
104
+ "outputShape": "{ [ticker: string]: number }",
105
+ }
106
+ },
107
+ }
108
+ print(json.dumps(capabilities, indent=2, ensure_ascii=True))
109
+ return 0
110
+
111
+
112
+ def cmd_run_source_fetch(args: argparse.Namespace) -> int:
113
+ in_ref = _parse_ref_str(args.in_ref)
114
+ out_ref = _parse_ref_str(args.out_ref)
115
+ err_ref = _parse_ref_str(args.err_ref)
116
+
117
+ in_storage = blob_storage_for_ref(in_ref)
118
+ out_storage = blob_storage_for_ref(out_ref)
119
+ err_storage = blob_storage_for_ref(err_ref)
120
+
121
+ raw_in = in_storage.read(in_ref.value)
122
+ if not raw_in:
123
+ print(f"[portfolio-tracker-fetch-prices] input envelope not found at: {args.in_ref}", file=sys.stderr)
124
+ return 1
125
+
126
+ envelope = json.loads(raw_in)
127
+ callback = envelope.get("callback") if isinstance(envelope, dict) else None
128
+
129
+ def safe_fail(msg: str) -> int:
130
+ try:
131
+ err_storage.write(err_ref.value, msg)
132
+ except Exception:
133
+ pass
134
+ if isinstance(callback, dict):
135
+ try:
136
+ report_failed(callback, msg)
137
+ return 0
138
+ except Exception as e:
139
+ print(f"[portfolio-tracker-fetch-prices] callback fail: {e}", file=sys.stderr)
140
+ return 1
141
+ return 1
142
+
143
+ try:
144
+ source_def = envelope.get("source_def") if isinstance(envelope, dict) else None
145
+ if not isinstance(source_def, dict):
146
+ source_def = envelope if isinstance(envelope, dict) else {}
147
+
148
+ if source_def.get("kind") != "mock-quotes":
149
+ raise ValueError(f"Unsupported source kind: expected \"mock-quotes\", got \"{source_def.get('kind')}\"")
150
+
151
+ projections = source_def.get("_projections")
152
+ tickers = projections.get("tickers") if isinstance(projections, dict) else None
153
+ if not isinstance(tickers, list):
154
+ raise ValueError("sourceDef._projections.tickers is missing or not an array")
155
+
156
+ time.sleep(0.2 + random.random() * 0.1)
157
+
158
+ prices: dict[str, float] = {}
159
+ for ticker in tickers:
160
+ prices[str(ticker)] = round(10 + random.random() * 989.99, 2)
161
+
162
+ out_storage.write(out_ref.value, json.dumps(prices, ensure_ascii=True))
163
+ print(f"[portfolio-tracker-fetch-prices] wrote prices for: {', '.join([str(t) for t in tickers])}")
164
+
165
+ if isinstance(callback, dict):
166
+ report_complete(callback, out_ref)
167
+ return 0
168
+ except Exception as e:
169
+ msg = str(e)
170
+ print(f"[portfolio-tracker-fetch-prices] error: {msg}", file=sys.stderr)
171
+ return safe_fail(msg)
172
+
173
+
174
+ def build_parser() -> argparse.ArgumentParser:
175
+ parser = argparse.ArgumentParser(prog="portfolio-tracker-fetch-prices")
176
+ sub = parser.add_subparsers(dest="command", required=True)
177
+
178
+ run_cmd = sub.add_parser("run-source-fetch")
179
+ run_cmd.add_argument("--in-ref", required=True)
180
+ run_cmd.add_argument("--out-ref", required=True)
181
+ run_cmd.add_argument("--err-ref", required=True)
182
+ run_cmd.set_defaults(handler=cmd_run_source_fetch)
183
+
184
+ val_cmd = sub.add_parser("validate-source-def")
185
+ val_cmd.add_argument("--in", dest="input", required=True)
186
+ val_cmd.set_defaults(handler=cmd_validate_source_def)
187
+
188
+ cap_cmd = sub.add_parser("describe-capabilities")
189
+ cap_cmd.set_defaults(handler=cmd_describe_capabilities)
190
+
191
+ return parser
192
+
193
+
194
+ def main(argv: list[str] | None = None) -> int:
195
+ parser = build_parser()
196
+ args = parser.parse_args(argv)
197
+ return args.handler(args)
198
+
199
+
200
+ if __name__ == "__main__":
201
+ raise SystemExit(main())
@@ -1,20 +1,27 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import * as fs from 'node:fs';
4
3
  import * as path from 'node:path';
4
+ import * as fs from 'node:fs';
5
+ import { parseRef, blobStorageForRef } from 'yaml-flow/storage-refs';
5
6
 
6
7
  function parseArgs(argv) {
7
- const inIdx = argv.indexOf('--in');
8
- const outIdx = argv.indexOf('--out');
9
- const errIdx = argv.indexOf('--err');
10
- const inFile = inIdx !== -1 ? argv[inIdx + 1] : undefined;
11
- const outFile = outIdx !== -1 ? argv[outIdx + 1] : undefined;
12
- const errFile = errIdx !== -1 ? argv[errIdx + 1] : undefined;
13
- if (!inFile || !outFile || !errFile) {
14
- console.error('Usage: <adapter> run-inference --in <input.json> --out <output.json> --err <error.txt>');
8
+ const inIdx = argv.indexOf('--in-ref');
9
+ const outIdx = argv.indexOf('--out-ref');
10
+ const errIdx = argv.indexOf('--err-ref');
11
+ const inRefStr = inIdx !== -1 ? argv[inIdx + 1] : undefined;
12
+ const outRefStr = outIdx !== -1 ? argv[outIdx + 1] : undefined;
13
+ const errRefStr = errIdx !== -1 ? argv[errIdx + 1] : undefined;
14
+ if (!inRefStr || !outRefStr || !errRefStr) {
15
+ console.error('Usage: <adapter> run-inference --in-ref <::kind::value> --out-ref <::kind::value> --err-ref <::kind::value>');
15
16
  process.exit(1);
16
17
  }
17
- return { inFile, outFile, errFile };
18
+ const inRef = parseRef(inRefStr);
19
+ const outRef = parseRef(outRefStr);
20
+ const errRef = parseRef(errRefStr);
21
+ const inStorage = blobStorageForRef(inRef);
22
+ const outStorage = blobStorageForRef(outRef);
23
+ const errStorage = blobStorageForRef(errRef);
24
+ return { inRef, outRef, errRef, inStorage, outStorage, errStorage };
18
25
  }
19
26
 
20
27
  const envBoardDir = (process.env.BOARD_DIR ?? '').trim();
@@ -144,10 +151,12 @@ async function main() {
144
151
  process.exit(1);
145
152
  }
146
153
 
147
- const { inFile, outFile, errFile } = parseArgs(process.argv.slice(3));
154
+ const { inRef, outRef, errRef, inStorage, outStorage, errStorage } = parseArgs(process.argv.slice(3));
148
155
 
149
156
  try {
150
- const payload = JSON.parse(fs.readFileSync(inFile, 'utf-8'));
157
+ const rawIn = inStorage.read(inRef.value);
158
+ if (rawIn === null) throw new Error(`Input not found: ${inRef.value}`);
159
+ const payload = JSON.parse(rawIn);
151
160
  const tmpCandidates = resolveSyncTmpFileCandidates(payload);
152
161
  if (tmpCandidates.length > 0) {
153
162
  await waitForTmpSyncInput(tmpCandidates);
@@ -174,12 +183,12 @@ async function main() {
174
183
  };
175
184
  }
176
185
 
177
- fs.writeFileSync(outFile, JSON.stringify(result), 'utf-8');
178
- fs.writeFileSync(errFile, '', 'utf-8');
186
+ outStorage.write(outRef.value, JSON.stringify(result));
187
+ errStorage.write(errRef.value, '');
179
188
  } catch (err) {
180
189
  const message = err instanceof Error ? err.message : String(err);
181
- fs.writeFileSync(errFile, message, 'utf-8');
182
- fs.writeFileSync(outFile, JSON.stringify({ isTaskCompleted: false, reason: message, evidence: '' }), 'utf-8');
190
+ errStorage.write(errRef.value, message);
191
+ outStorage.write(outRef.value, JSON.stringify({ isTaskCompleted: false, reason: message, evidence: '' }));
183
192
  process.exit(1);
184
193
  }
185
194
  }