yaml-flow 5.1.0 → 5.2.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 (105) hide show
  1. package/{examples/example-board/reusable-server-runtime.js → board-livecards-server-runtime.js} +42 -20
  2. package/{examples/example-board/reusable-board-runtime-client.js → browser/board-livecards-runtime-client.js} +6 -2
  3. package/browser/{board-livegraph-runtime.js → board-livegraph-engine.js} +212 -16
  4. package/browser/board-livegraph-engine.js.map +1 -0
  5. package/browser/live-cards.js +362 -38
  6. package/browser/live-cards.schema.json +20 -4
  7. package/dist/board-livegraph-runtime/index.cjs +210 -14
  8. package/dist/board-livegraph-runtime/index.cjs.map +1 -1
  9. package/dist/board-livegraph-runtime/index.d.cts +49 -5
  10. package/dist/board-livegraph-runtime/index.d.ts +49 -5
  11. package/dist/board-livegraph-runtime/index.js +209 -15
  12. package/dist/board-livegraph-runtime/index.js.map +1 -1
  13. package/dist/card-compute/index.cjs +63 -7
  14. package/dist/card-compute/index.cjs.map +1 -1
  15. package/dist/card-compute/index.d.cts +2 -2
  16. package/dist/card-compute/index.d.ts +2 -2
  17. package/dist/card-compute/index.js +63 -7
  18. package/dist/card-compute/index.js.map +1 -1
  19. package/dist/cli/board-live-cards-cli.cjs +664 -75
  20. package/dist/cli/board-live-cards-cli.cjs.map +1 -1
  21. package/dist/cli/board-live-cards-cli.d.cts +33 -5
  22. package/dist/cli/board-live-cards-cli.d.ts +33 -5
  23. package/dist/cli/board-live-cards-cli.js +661 -76
  24. package/dist/cli/board-live-cards-cli.js.map +1 -1
  25. package/dist/{constants-ozjf1Ejw.d.cts → constants-BzZUyYlp.d.cts} +1 -1
  26. package/dist/{constants-DuzE5n03.d.ts → constants-oCEbNpul.d.ts} +1 -1
  27. package/dist/continuous-event-graph/index.cjs +47 -14
  28. package/dist/continuous-event-graph/index.cjs.map +1 -1
  29. package/dist/continuous-event-graph/index.d.cts +9 -9
  30. package/dist/continuous-event-graph/index.d.ts +9 -9
  31. package/dist/continuous-event-graph/index.js +47 -14
  32. package/dist/continuous-event-graph/index.js.map +1 -1
  33. package/dist/event-graph/index.cjs +29 -12
  34. package/dist/event-graph/index.cjs.map +1 -1
  35. package/dist/event-graph/index.d.cts +5 -5
  36. package/dist/event-graph/index.d.ts +5 -5
  37. package/dist/event-graph/index.js +29 -12
  38. package/dist/event-graph/index.js.map +1 -1
  39. package/dist/index.cjs +93 -20
  40. package/dist/index.cjs.map +1 -1
  41. package/dist/index.d.cts +7 -7
  42. package/dist/index.d.ts +7 -7
  43. package/dist/index.js +93 -20
  44. package/dist/index.js.map +1 -1
  45. package/dist/inference/index.cjs +29 -12
  46. package/dist/inference/index.cjs.map +1 -1
  47. package/dist/inference/index.d.cts +2 -2
  48. package/dist/inference/index.d.ts +2 -2
  49. package/dist/inference/index.js +29 -12
  50. package/dist/inference/index.js.map +1 -1
  51. package/dist/{journal-NLYuqege.d.ts → journal-9HEgs7dU.d.ts} +1 -1
  52. package/dist/{journal-DRfJiheM.d.cts → journal-B-JCfQnh.d.cts} +1 -1
  53. package/dist/{live-cards-bridge-Or7fdEJV.d.ts → live-cards-bridge-CeNxiVcm.d.ts} +6 -2
  54. package/dist/{live-cards-bridge-vGJ6tMzN.d.cts → live-cards-bridge-z_rJCSbi.d.cts} +6 -2
  55. package/dist/{schedule-CMcZe5Ny.d.ts → schedule-Cszq9LYY.d.ts} +1 -1
  56. package/dist/{schedule-CiucyCan.d.cts → schedule-qWNL0RQh.d.cts} +1 -1
  57. package/dist/{types-CMFSIjpc.d.cts → types-BBhqYGhE.d.cts} +4 -0
  58. package/dist/{types-CMFSIjpc.d.ts → types-BBhqYGhE.d.ts} +4 -0
  59. package/dist/{types-BzLD8bjb.d.cts → types-CHSdoAAA.d.cts} +1 -1
  60. package/dist/{types-C2eJ7DAV.d.ts → types-CoW0gQl3.d.ts} +1 -1
  61. package/dist/{validate-DJQTQ6bP.d.ts → validate-BAVzUJWa.d.ts} +1 -1
  62. package/dist/{validate-ke92Cleg.d.cts → validate-Dbu7ygys.d.cts} +1 -1
  63. package/examples/browser/boards/portfolio-tracker/cards/portfolio-risk-assessment.json +28 -0
  64. package/examples/browser/boards/portfolio-tracker/cards/rebalancing-strategy.json +28 -0
  65. package/examples/browser/boards/portfolio-tracker/portfolio-tracker-inference-adapter.js +187 -0
  66. package/examples/browser/boards/portfolio-tracker/portfolio-tracker.js +139 -5
  67. package/examples/example-board/agent-instructions-cardlayout.md +28 -0
  68. package/examples/example-board/agent-instructions.md +603 -0
  69. package/examples/example-board/cards/card-concentration.json +42 -0
  70. package/examples/example-board/cards/card-market-prices.json +51 -0
  71. package/examples/example-board/cards/card-portfolio-action.json +19 -0
  72. package/examples/example-board/cards/card-portfolio-risks.json +19 -0
  73. package/examples/example-board/cards/card-portfolio-value.json +62 -0
  74. package/examples/example-board/cards/card-portfolio.json +44 -0
  75. package/examples/example-board/demo-chat-handler.js +373 -33
  76. package/examples/example-board/demo-server-config.json +0 -2
  77. package/examples/example-board/demo-server.js +46 -7
  78. package/examples/example-board/demo-shell-browser.html +75 -207
  79. package/examples/example-board/demo-shell-with-server.html +14 -9
  80. package/examples/example-board/demo-shell.html +1 -1
  81. package/examples/example-board/demo-task-executor.js +259 -41
  82. package/package.json +6 -2
  83. package/schema/live-cards.schema.json +20 -4
  84. package/browser/board-livegraph-runtime.js.map +0 -1
  85. package/examples/example-board/board.yaml +0 -23
  86. package/examples/example-board/bootstrap_payload.json +0 -1
  87. package/examples/example-board/cards/card-chain-region-alert.json +0 -39
  88. package/examples/example-board/cards/card-chain-region-totals.json +0 -26
  89. package/examples/example-board/cards/card-chain-top-region.json +0 -24
  90. package/examples/example-board/cards/card-ex-actions.json +0 -32
  91. package/examples/example-board/cards/card-ex-chart.json +0 -30
  92. package/examples/example-board/cards/card-ex-filter.json +0 -36
  93. package/examples/example-board/cards/card-ex-filtered-by-preference.json +0 -59
  94. package/examples/example-board/cards/card-ex-form.json +0 -91
  95. package/examples/example-board/cards/card-ex-list.json +0 -22
  96. package/examples/example-board/cards/card-ex-markdown.json +0 -17
  97. package/examples/example-board/cards/card-ex-metric.json +0 -19
  98. package/examples/example-board/cards/card-ex-narrative.json +0 -36
  99. package/examples/example-board/cards/card-ex-source-http.json +0 -28
  100. package/examples/example-board/cards/card-ex-source.json +0 -21
  101. package/examples/example-board/cards/card-ex-status.json +0 -35
  102. package/examples/example-board/cards/card-ex-table.json +0 -30
  103. package/examples/example-board/cards/card-ex-todo.json +0 -29
  104. package/examples/example-board/mock.db +0 -15
  105. package/examples/example-board/reusable-runtime-artifacts-adapter.js +0 -233
package/dist/index.d.cts CHANGED
@@ -1,18 +1,18 @@
1
1
  export { StepMachine as FlowEngine, StepMachine, applyStepResult, checkCircuitBreaker, computeStepInput, createStepMachine as createEngine, createInitialState, createStepMachine, extractReturnData, loadStepFlow, validateFlowSchema, validateStepFlowConfig } from './step-machine/index.cjs';
2
2
  export { C as CircuitBreakerConfig, R as RetryConfig, S as StepConfig, a as StepContext, b as StepEvent, c as StepEventListener, d as StepEventType, e as StepFlowConfig, f as StepFlowSettings, g as StepHandler, h as StepInput, i as StepMachineOptions, j as StepMachineResult, k as StepMachineState, l as StepMachineStore, m as StepReducerResult, n as StepResult, T as TerminalStateConfig } from './types-ycun84cq.cjs';
3
- export { C as COMPLETION_STRATEGIES, a as CONFLICT_STRATEGIES, b as CompletionResult, D as DEFAULTS, E as EXECUTION_MODES, c as EXECUTION_STATUS, d as ExecutionPlan, e as ExportOptions, M as MermaidOptions, T as TASK_STATUS, f as addDynamicTask, g as apply, h as applyAll, i as computeAvailableOutputs, j as createDefaultGraphEngineStore, k as createInitialExecutionState, l as detectStuckState, m as exportGraphConfig, n as exportGraphConfigToFile, o as flowToMermaid, p as getAllTasks, q as getCandidateTasks, r as getMaxExecutions, s as getProvides, t as getRefreshStrategy, u as getRequires, v as getTask, w as graphToMermaid, x as hasTask, y as isExecutionComplete, z as isNonActiveTask, A as isRerunnable, B as isTaskCompleted, F as isTaskRunning, G as loadGraphConfig, H as next, I as planExecution, J as validateGraphConfig, K as validateGraphSchema } from './constants-ozjf1Ejw.cjs';
4
- export { G as GraphIssue, a as GraphValidationResult, I as IssueSeverity, v as validateGraph } from './validate-ke92Cleg.cjs';
5
- export { A as AgentActionEvent, C as CompletionStrategy, a as ConflictStrategy, E as ExecutionConfig, b as ExecutionMode, c as ExecutionState, d as ExecutionStatus, G as GraphConfig, e as GraphEngineStore, f as GraphEvent, g as GraphSettings, T as GraphTaskConfig, I as InjectTokensEvent, R as RefreshStrategy, S as SchedulerResult, h as StuckDetection, i as TaskCompletedEvent, j as TaskFailedEvent, k as TaskStartedEvent, l as TaskStatus } from './types-CMFSIjpc.cjs';
3
+ export { C as COMPLETION_STRATEGIES, a as CONFLICT_STRATEGIES, b as CompletionResult, D as DEFAULTS, E as EXECUTION_MODES, c as EXECUTION_STATUS, d as ExecutionPlan, e as ExportOptions, M as MermaidOptions, T as TASK_STATUS, f as addDynamicTask, g as apply, h as applyAll, i as computeAvailableOutputs, j as createDefaultGraphEngineStore, k as createInitialExecutionState, l as detectStuckState, m as exportGraphConfig, n as exportGraphConfigToFile, o as flowToMermaid, p as getAllTasks, q as getCandidateTasks, r as getMaxExecutions, s as getProvides, t as getRefreshStrategy, u as getRequires, v as getTask, w as graphToMermaid, x as hasTask, y as isExecutionComplete, z as isNonActiveTask, A as isRerunnable, B as isTaskCompleted, F as isTaskRunning, G as loadGraphConfig, H as next, I as planExecution, J as validateGraphConfig, K as validateGraphSchema } from './constants-BzZUyYlp.cjs';
4
+ export { G as GraphIssue, a as GraphValidationResult, I as IssueSeverity, v as validateGraph } from './validate-Dbu7ygys.cjs';
5
+ export { A as AgentActionEvent, C as CompletionStrategy, a as ConflictStrategy, E as ExecutionConfig, b as ExecutionMode, c as ExecutionState, d as ExecutionStatus, G as GraphConfig, e as GraphEngineStore, f as GraphEvent, g as GraphSettings, T as GraphTaskConfig, I as InjectTokensEvent, R as RefreshStrategy, S as SchedulerResult, h as StuckDetection, i as TaskCompletedEvent, j as TaskFailedEvent, k as TaskStartedEvent, l as TaskStatus } from './types-BBhqYGhE.cjs';
6
6
  export { MemoryStore } from './stores/memory.cjs';
7
7
  export { LocalStorageStore } from './stores/localStorage.cjs';
8
8
  export { FileStore } from './stores/file.cjs';
9
9
  export { BatchItemResult, BatchOptions, BatchProgress, BatchResult, batch } from './batch/index.cjs';
10
10
  export { ConfigTemplates, Variables, resolveConfigTemplates, resolveVariables } from './config/index.cjs';
11
11
  export { GraphMutation, ReactiveGraphValidationInput, ResolveCallbackFn, ScriptHandlerOptions, ShellHandlerOptions, WebhookHandlerOptions, addNode, addProvides, addRequires, applyEvent, applyEvents, createCallbackHandler, createFireAndForgetHandler, createLiveGraph, createNoopHandler, createScriptHandler, createShellHandler, createWebhookHandler, disableNode, drainTokens, enableNode, getDownstream, getNode, getUnreachableNodes, getUnreachableTokens, getUpstream, injectTokens, inspect, mutateGraph, removeNode, removeProvides, removeRequires, resetNode, restore, snapshot, validateLiveGraph, validateReactiveGraph } from './continuous-event-graph/index.cjs';
12
- export { s as schedule } from './schedule-CiucyCan.cjs';
13
- export { L as LiveBoard, a as LiveCard, b as LiveCardsToReactiveOptions, c as LiveCardsToReactiveResult, R as ReactiveGraph, d as ReactiveGraphOptions, T as TaskHandlerFn, e as TaskHandlerInput, f as TaskHandlerReturn, g as createReactiveGraph, l as liveCardsToReactiveGraph } from './live-cards-bridge-vGJ6tMzN.cjs';
14
- export { J as Journal, M as MemoryJournal } from './journal-DRfJiheM.cjs';
15
- export { B as BlockedTask, D as DownstreamResult, L as LiveGraph, a as LiveGraphHealth, b as LiveGraphSnapshot, N as NodeInfo, P as PendingTask, S as ScheduleResult, U as UnreachableNodesResult, c as UnreachableTokensResult, d as UnresolvedDependency, e as UpstreamResult } from './types-BzLD8bjb.cjs';
12
+ export { s as schedule } from './schedule-qWNL0RQh.cjs';
13
+ export { L as LiveBoard, a as LiveCard, b as LiveCardsToReactiveOptions, c as LiveCardsToReactiveResult, R as ReactiveGraph, d as ReactiveGraphOptions, T as TaskHandlerFn, e as TaskHandlerInput, f as TaskHandlerReturn, g as createReactiveGraph, l as liveCardsToReactiveGraph } from './live-cards-bridge-z_rJCSbi.cjs';
14
+ export { J as Journal, M as MemoryJournal } from './journal-B-JCfQnh.cjs';
15
+ export { B as BlockedTask, D as DownstreamResult, L as LiveGraph, a as LiveGraphHealth, b as LiveGraphSnapshot, N as NodeInfo, P as PendingTask, S as ScheduleResult, U as UnreachableNodesResult, c as UnreachableTokensResult, d as UnresolvedDependency, e as UpstreamResult } from './types-CHSdoAAA.cjs';
16
16
  export { BoardLiveGraphRuntime, BoardLiveGraphRuntimeOptions, BoardLiveGraphRuntimeUpdate, BoardRuntimeView, BoardTaskExecutor, BoardTaskExecutorContext, BrowserSourceAdapter, BrowserSourceAdapterContext, LiveCardRuntimeModel, createBoardLiveGraphRuntime } from './board-livegraph-runtime/index.cjs';
17
17
  export { CliAdapterOptions, HttpAdapterOptions, InferAndApplyResult, InferenceAdapter, InferenceHints, InferenceOptions, InferenceResult, InferredCompletion, applyInferences, buildInferencePrompt, createCliAdapter, createHttpAdapter, inferAndApply, inferCompletions } from './inference/index.cjs';
18
18
  export { CardCompute, ComputeNode, ComputeStep, ValidationResult, validateLiveCard, validateLiveCardDefinition, validateLiveCardRuntimeExpressions, validateLiveCardSchema } from './card-compute/index.cjs';
package/dist/index.d.ts CHANGED
@@ -1,18 +1,18 @@
1
1
  export { StepMachine as FlowEngine, StepMachine, applyStepResult, checkCircuitBreaker, computeStepInput, createStepMachine as createEngine, createInitialState, createStepMachine, extractReturnData, loadStepFlow, validateFlowSchema, validateStepFlowConfig } from './step-machine/index.js';
2
2
  export { C as CircuitBreakerConfig, R as RetryConfig, S as StepConfig, a as StepContext, b as StepEvent, c as StepEventListener, d as StepEventType, e as StepFlowConfig, f as StepFlowSettings, g as StepHandler, h as StepInput, i as StepMachineOptions, j as StepMachineResult, k as StepMachineState, l as StepMachineStore, m as StepReducerResult, n as StepResult, T as TerminalStateConfig } from './types-ycun84cq.js';
3
- export { C as COMPLETION_STRATEGIES, a as CONFLICT_STRATEGIES, b as CompletionResult, D as DEFAULTS, E as EXECUTION_MODES, c as EXECUTION_STATUS, d as ExecutionPlan, e as ExportOptions, M as MermaidOptions, T as TASK_STATUS, f as addDynamicTask, g as apply, h as applyAll, i as computeAvailableOutputs, j as createDefaultGraphEngineStore, k as createInitialExecutionState, l as detectStuckState, m as exportGraphConfig, n as exportGraphConfigToFile, o as flowToMermaid, p as getAllTasks, q as getCandidateTasks, r as getMaxExecutions, s as getProvides, t as getRefreshStrategy, u as getRequires, v as getTask, w as graphToMermaid, x as hasTask, y as isExecutionComplete, z as isNonActiveTask, A as isRerunnable, B as isTaskCompleted, F as isTaskRunning, G as loadGraphConfig, H as next, I as planExecution, J as validateGraphConfig, K as validateGraphSchema } from './constants-DuzE5n03.js';
4
- export { G as GraphIssue, a as GraphValidationResult, I as IssueSeverity, v as validateGraph } from './validate-DJQTQ6bP.js';
5
- export { A as AgentActionEvent, C as CompletionStrategy, a as ConflictStrategy, E as ExecutionConfig, b as ExecutionMode, c as ExecutionState, d as ExecutionStatus, G as GraphConfig, e as GraphEngineStore, f as GraphEvent, g as GraphSettings, T as GraphTaskConfig, I as InjectTokensEvent, R as RefreshStrategy, S as SchedulerResult, h as StuckDetection, i as TaskCompletedEvent, j as TaskFailedEvent, k as TaskStartedEvent, l as TaskStatus } from './types-CMFSIjpc.js';
3
+ export { C as COMPLETION_STRATEGIES, a as CONFLICT_STRATEGIES, b as CompletionResult, D as DEFAULTS, E as EXECUTION_MODES, c as EXECUTION_STATUS, d as ExecutionPlan, e as ExportOptions, M as MermaidOptions, T as TASK_STATUS, f as addDynamicTask, g as apply, h as applyAll, i as computeAvailableOutputs, j as createDefaultGraphEngineStore, k as createInitialExecutionState, l as detectStuckState, m as exportGraphConfig, n as exportGraphConfigToFile, o as flowToMermaid, p as getAllTasks, q as getCandidateTasks, r as getMaxExecutions, s as getProvides, t as getRefreshStrategy, u as getRequires, v as getTask, w as graphToMermaid, x as hasTask, y as isExecutionComplete, z as isNonActiveTask, A as isRerunnable, B as isTaskCompleted, F as isTaskRunning, G as loadGraphConfig, H as next, I as planExecution, J as validateGraphConfig, K as validateGraphSchema } from './constants-oCEbNpul.js';
4
+ export { G as GraphIssue, a as GraphValidationResult, I as IssueSeverity, v as validateGraph } from './validate-BAVzUJWa.js';
5
+ export { A as AgentActionEvent, C as CompletionStrategy, a as ConflictStrategy, E as ExecutionConfig, b as ExecutionMode, c as ExecutionState, d as ExecutionStatus, G as GraphConfig, e as GraphEngineStore, f as GraphEvent, g as GraphSettings, T as GraphTaskConfig, I as InjectTokensEvent, R as RefreshStrategy, S as SchedulerResult, h as StuckDetection, i as TaskCompletedEvent, j as TaskFailedEvent, k as TaskStartedEvent, l as TaskStatus } from './types-BBhqYGhE.js';
6
6
  export { MemoryStore } from './stores/memory.js';
7
7
  export { LocalStorageStore } from './stores/localStorage.js';
8
8
  export { FileStore } from './stores/file.js';
9
9
  export { BatchItemResult, BatchOptions, BatchProgress, BatchResult, batch } from './batch/index.js';
10
10
  export { ConfigTemplates, Variables, resolveConfigTemplates, resolveVariables } from './config/index.js';
11
11
  export { GraphMutation, ReactiveGraphValidationInput, ResolveCallbackFn, ScriptHandlerOptions, ShellHandlerOptions, WebhookHandlerOptions, addNode, addProvides, addRequires, applyEvent, applyEvents, createCallbackHandler, createFireAndForgetHandler, createLiveGraph, createNoopHandler, createScriptHandler, createShellHandler, createWebhookHandler, disableNode, drainTokens, enableNode, getDownstream, getNode, getUnreachableNodes, getUnreachableTokens, getUpstream, injectTokens, inspect, mutateGraph, removeNode, removeProvides, removeRequires, resetNode, restore, snapshot, validateLiveGraph, validateReactiveGraph } from './continuous-event-graph/index.js';
12
- export { s as schedule } from './schedule-CMcZe5Ny.js';
13
- export { L as LiveBoard, a as LiveCard, b as LiveCardsToReactiveOptions, c as LiveCardsToReactiveResult, R as ReactiveGraph, d as ReactiveGraphOptions, T as TaskHandlerFn, e as TaskHandlerInput, f as TaskHandlerReturn, g as createReactiveGraph, l as liveCardsToReactiveGraph } from './live-cards-bridge-Or7fdEJV.js';
14
- export { J as Journal, M as MemoryJournal } from './journal-NLYuqege.js';
15
- export { B as BlockedTask, D as DownstreamResult, L as LiveGraph, a as LiveGraphHealth, b as LiveGraphSnapshot, N as NodeInfo, P as PendingTask, S as ScheduleResult, U as UnreachableNodesResult, c as UnreachableTokensResult, d as UnresolvedDependency, e as UpstreamResult } from './types-C2eJ7DAV.js';
12
+ export { s as schedule } from './schedule-Cszq9LYY.js';
13
+ export { L as LiveBoard, a as LiveCard, b as LiveCardsToReactiveOptions, c as LiveCardsToReactiveResult, R as ReactiveGraph, d as ReactiveGraphOptions, T as TaskHandlerFn, e as TaskHandlerInput, f as TaskHandlerReturn, g as createReactiveGraph, l as liveCardsToReactiveGraph } from './live-cards-bridge-CeNxiVcm.js';
14
+ export { J as Journal, M as MemoryJournal } from './journal-9HEgs7dU.js';
15
+ export { B as BlockedTask, D as DownstreamResult, L as LiveGraph, a as LiveGraphHealth, b as LiveGraphSnapshot, N as NodeInfo, P as PendingTask, S as ScheduleResult, U as UnreachableNodesResult, c as UnreachableTokensResult, d as UnresolvedDependency, e as UpstreamResult } from './types-CoW0gQl3.js';
16
16
  export { BoardLiveGraphRuntime, BoardLiveGraphRuntimeOptions, BoardLiveGraphRuntimeUpdate, BoardRuntimeView, BoardTaskExecutor, BoardTaskExecutorContext, BrowserSourceAdapter, BrowserSourceAdapterContext, LiveCardRuntimeModel, createBoardLiveGraphRuntime } from './board-livegraph-runtime/index.js';
17
17
  export { CliAdapterOptions, HttpAdapterOptions, InferAndApplyResult, InferenceAdapter, InferenceHints, InferenceOptions, InferenceResult, InferredCompletion, applyInferences, buildInferencePrompt, createCliAdapter, createHttpAdapter, inferAndApply, inferCompletions } from './inference/index.js';
18
18
  export { CardCompute, ComputeNode, ComputeStep, ValidationResult, validateLiveCard, validateLiveCardDefinition, validateLiveCardRuntimeExpressions, validateLiveCardSchema } from './card-compute/index.js';
package/dist/index.js CHANGED
@@ -8583,15 +8583,30 @@ function selectOptimalTasks(candidates, graph, state, conflictStrategy) {
8583
8583
  }
8584
8584
 
8585
8585
  // src/event-graph/task-transitions.ts
8586
- function applyTaskStart(state, taskName) {
8586
+ function applyTaskStart(state, taskName, graph) {
8587
8587
  const existingTask = state.tasks[taskName] ?? createDefaultGraphEngineStore2();
8588
+ const startConsumedHashes = {};
8589
+ if (graph) {
8590
+ const taskConfig = graph.tasks[taskName];
8591
+ const requires = getRequires(taskConfig);
8592
+ for (const token of requires) {
8593
+ for (const [otherName, otherConfig] of Object.entries(graph.tasks)) {
8594
+ if (getProvides(otherConfig).includes(token)) {
8595
+ const otherState = state.tasks[otherName];
8596
+ if (otherState?.lastDataHash) startConsumedHashes[token] = otherState.lastDataHash;
8597
+ break;
8598
+ }
8599
+ }
8600
+ }
8601
+ }
8588
8602
  const updatedTask = {
8589
8603
  ...existingTask,
8590
8604
  status: "running",
8591
8605
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
8592
8606
  lastUpdated: (/* @__PURE__ */ new Date()).toISOString(),
8593
8607
  progress: 0,
8594
- error: void 0
8608
+ error: void 0,
8609
+ startConsumedHashes
8595
8610
  };
8596
8611
  return {
8597
8612
  ...state,
@@ -8611,16 +8626,18 @@ function applyTaskCompletion(state, graph, taskName, result, dataHash, data) {
8611
8626
  } else {
8612
8627
  outputTokens = getProvides(taskConfig);
8613
8628
  }
8614
- const lastConsumedHashes = { ...existingTask.lastConsumedHashes };
8615
- const requires = taskConfig.requires ?? [];
8616
- for (const token of requires) {
8617
- for (const [otherName, otherConfig] of Object.entries(graph.tasks)) {
8618
- if (getProvides(otherConfig).includes(token)) {
8619
- const otherState = state.tasks[otherName];
8620
- if (otherState?.lastDataHash) {
8621
- lastConsumedHashes[token] = otherState.lastDataHash;
8629
+ const lastConsumedHashes = existingTask.startConsumedHashes ? { ...existingTask.startConsumedHashes } : { ...existingTask.lastConsumedHashes };
8630
+ if (!existingTask.startConsumedHashes) {
8631
+ const requires = taskConfig.requires ?? [];
8632
+ for (const token of requires) {
8633
+ for (const [otherName, otherConfig] of Object.entries(graph.tasks)) {
8634
+ if (getProvides(otherConfig).includes(token)) {
8635
+ const otherState = state.tasks[otherName];
8636
+ if (otherState?.lastDataHash) {
8637
+ lastConsumedHashes[token] = otherState.lastDataHash;
8638
+ }
8639
+ break;
8622
8640
  }
8623
- break;
8624
8641
  }
8625
8642
  }
8626
8643
  }
@@ -8742,7 +8759,7 @@ function apply(state, event, graph) {
8742
8759
  }
8743
8760
  switch (event.type) {
8744
8761
  case "task-started":
8745
- return applyTaskStart(state, event.taskName);
8762
+ return applyTaskStart(state, event.taskName, graph);
8746
8763
  case "task-completed":
8747
8764
  return applyTaskCompletion(state, graph, event.taskName, event.result, event.dataHash, event.data);
8748
8765
  case "task-failed":
@@ -10096,7 +10113,7 @@ function applyEvent(live, event) {
10096
10113
  switch (event.type) {
10097
10114
  // --- Execution state transitions ---
10098
10115
  case "task-started":
10099
- return { config, state: applyTaskStart(state, event.taskName) };
10116
+ return { config, state: applyTaskStart(state, event.taskName, config) };
10100
10117
  case "task-completed":
10101
10118
  return { config, state: applyTaskCompletion(state, config, event.taskName, event.result, event.dataHash, event.data) };
10102
10119
  case "task-failed":
@@ -11664,9 +11681,9 @@ var live_cards_schema_default = {
11664
11681
  }
11665
11682
  },
11666
11683
  source_def: {
11667
- description: "One source entry. The engine only cares about 'bindTo' (compute namespace key) and 'outputFile' (delivery signal). Every other property is yours \u2014 add whatever your task-executor needs: kind, url, headers, mailbox, channel, model, query, etc. The full object is passed verbatim as the --in JSON to the executor.",
11684
+ description: "One source entry. The engine requires 'bindTo' (compute namespace key) and 'outputFile' (delivery signal path). bindTo and outputFile must be unique across all sources in a card. Every other property is yours \u2014 add whatever your task-executor needs: kind, url, headers, mailbox, channel, model, query, etc. The full object is passed verbatim as the --in JSON to the executor.",
11668
11685
  type: "object",
11669
- required: ["bindTo"],
11686
+ required: ["bindTo", "outputFile"],
11670
11687
  additionalProperties: true,
11671
11688
  properties: {
11672
11689
  bindTo: { type: "string", description: "Key under fetched_sources.* available in compute expressions" },
@@ -11685,6 +11702,7 @@ var live_cards_schema_default = {
11685
11702
  enum: [
11686
11703
  "metric",
11687
11704
  "table",
11705
+ "editable-table",
11688
11706
  "chart",
11689
11707
  "form",
11690
11708
  "filter",
@@ -11802,7 +11820,7 @@ var live_cards_schema_default = {
11802
11820
  view: { $ref: "#/definitions/view" },
11803
11821
  card_data: {
11804
11822
  type: "object",
11805
- description: "Authored card data supplied in the card definition",
11823
+ description: "Authored card data and runtime metadata. Includes uploaded-file metadata maintained by host handlers and inference evaluation results.",
11806
11824
  properties: {
11807
11825
  files: {
11808
11826
  type: "array",
@@ -11830,6 +11848,18 @@ var live_cards_schema_default = {
11830
11848
  },
11831
11849
  additionalProperties: false
11832
11850
  }
11851
+ },
11852
+ llm_task_completion_inference: {
11853
+ type: "object",
11854
+ description: "Runtime state written by the inference adapter (advanced/undocumented). Prefer the standard sources \u2192 compute \u2192 provides pattern for LLM-based signals.",
11855
+ properties: {
11856
+ inferenceRequested: { type: "string", format: "date-time", description: "Timestamp when the latest inference request was initiated" },
11857
+ inferenceCompletedAt: { type: "string", format: "date-time", description: "Timestamp when the latest inference request completed" },
11858
+ isTaskCompleted: { type: "boolean", description: "Whether the task is considered complete by the adapter" },
11859
+ reasoning: { type: "string", description: "Explanation of completion decision" },
11860
+ evidence: { type: "array", description: "Supporting evidence from sources/compute" }
11861
+ },
11862
+ additionalProperties: true
11833
11863
  }
11834
11864
  },
11835
11865
  additionalProperties: true
@@ -11843,6 +11873,10 @@ var live_cards_schema_default = {
11843
11873
  type: "array",
11844
11874
  description: "Ordered array of compute steps. Each reads card_data.*/requires.*/fetched_sources.*/computed_values.* and writes to ephemeral computed_values[bindTo].",
11845
11875
  items: { $ref: "#/definitions/compute_step" }
11876
+ },
11877
+ when_is_task_completed: {
11878
+ type: "string",
11879
+ description: "Advanced/undocumented: invokes a registered inference adapter instead of the default source-delivery completion gate. Prefer the standard pattern: use an LLM-backed source, compute a verdict token, and publish it via provides."
11846
11880
  }
11847
11881
  }
11848
11882
  };
@@ -11911,12 +11945,35 @@ function getValidator3() {
11911
11945
  function validateLiveCardSchema(node) {
11912
11946
  const validate = getValidator3();
11913
11947
  const valid = validate(node);
11914
- if (valid) return { ok: true, errors: [] };
11915
11948
  const errors = (validate.errors ?? []).map((e) => {
11916
11949
  const path = e.instancePath || "/";
11917
11950
  return `${path}: ${e.message ?? "unknown error"}`;
11918
11951
  });
11919
- return { ok: false, errors };
11952
+ if (node && typeof node === "object" && !Array.isArray(node)) {
11953
+ const sources = node.sources;
11954
+ if (Array.isArray(sources)) {
11955
+ const bindTos = /* @__PURE__ */ new Set();
11956
+ const outputFiles = /* @__PURE__ */ new Set();
11957
+ sources.forEach((src, i) => {
11958
+ if (!src || typeof src !== "object" || Array.isArray(src)) return;
11959
+ const s = src;
11960
+ if (typeof s.bindTo === "string" && s.bindTo) {
11961
+ if (bindTos.has(s.bindTo)) {
11962
+ errors.push(`/sources/${i}/bindTo: bindTo "${s.bindTo}" must be unique across all sources`);
11963
+ }
11964
+ bindTos.add(s.bindTo);
11965
+ }
11966
+ if (typeof s.outputFile === "string" && s.outputFile) {
11967
+ if (outputFiles.has(s.outputFile)) {
11968
+ errors.push(`/sources/${i}/outputFile: outputFile "${s.outputFile}" must be unique across all sources`);
11969
+ }
11970
+ outputFiles.add(s.outputFile);
11971
+ }
11972
+ });
11973
+ }
11974
+ }
11975
+ if (!valid || errors.length > 0) return { ok: false, errors };
11976
+ return { ok: true, errors: [] };
11920
11977
  }
11921
11978
  function validateLiveCardRuntimeExpressions(node) {
11922
11979
  const errors = [];
@@ -12086,13 +12143,29 @@ function validateNode(node) {
12086
12143
  if (!Array.isArray(n.sources)) {
12087
12144
  errors.push("sources: must be an array");
12088
12145
  } else {
12146
+ const bindTos = /* @__PURE__ */ new Set();
12147
+ const outputFiles = /* @__PURE__ */ new Set();
12089
12148
  n.sources.forEach((src, i) => {
12090
12149
  if (!src || typeof src !== "object" || Array.isArray(src)) {
12091
12150
  errors.push(`sources[${i}]: must be an object`);
12092
12151
  } else {
12093
12152
  const s = src;
12094
- if (typeof s.bindTo !== "string" || !s.bindTo) errors.push(`sources[${i}]: missing required "bindTo" property`);
12095
- if (s.outputFile != null && typeof s.outputFile !== "string") errors.push(`sources[${i}]: outputFile must be a string`);
12153
+ if (typeof s.bindTo !== "string" || !s.bindTo) {
12154
+ errors.push(`sources[${i}]: missing required "bindTo" property`);
12155
+ } else {
12156
+ if (bindTos.has(s.bindTo)) {
12157
+ errors.push(`sources[${i}]: bindTo "${s.bindTo}" is not unique across sources`);
12158
+ }
12159
+ bindTos.add(s.bindTo);
12160
+ }
12161
+ if (typeof s.outputFile !== "string" || !s.outputFile) {
12162
+ errors.push(`sources[${i}]: missing required "outputFile" property`);
12163
+ } else {
12164
+ if (outputFiles.has(s.outputFile)) {
12165
+ errors.push(`sources[${i}]: outputFile "${s.outputFile}" is not unique across sources`);
12166
+ }
12167
+ outputFiles.add(s.outputFile);
12168
+ }
12096
12169
  if (s.optionalForCompletionGating != null && typeof s.optionalForCompletionGating !== "boolean") {
12097
12170
  errors.push(`sources[${i}]: optionalForCompletionGating must be a boolean`);
12098
12171
  }