@geenius/ai-workflow 0.4.0 → 0.5.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.
@@ -458,6 +458,12 @@ interface WorkflowBuilderState {
458
458
  *
459
459
  * The engine stays framework-agnostic by requiring callers to provide LLM,
460
460
  * webhook, approval, and custom-step integrations explicitly.
461
+ *
462
+ * @property callLLM Optional callback used to execute `llm-call` steps.
463
+ * @property callWebhook Optional callback used to execute `webhook` steps.
464
+ * @property onApprovalRequired Optional callback used for `human-approval` steps.
465
+ * @property onStepComplete Optional callback invoked after each step result is captured.
466
+ * @property customHandlers Optional registry of named handlers for `custom` steps.
461
467
  */
462
468
  interface WorkflowEngineOptions {
463
469
  /** LLM call function for llm-call steps */
@@ -1217,12 +1223,17 @@ declare function evaluateExpression(expression: string, context: Record<string,
1217
1223
  */
1218
1224
  /**
1219
1225
  * Minimal graph node shape accepted by DAG helpers.
1226
+ *
1227
+ * @property id Stable node identifier used in graph traversal.
1220
1228
  */
1221
1229
  interface DAGNode {
1222
1230
  id: string;
1223
1231
  }
1224
1232
  /**
1225
1233
  * Minimal graph edge shape accepted by DAG helpers.
1234
+ *
1235
+ * @property from Source node identifier.
1236
+ * @property to Destination node identifier.
1226
1237
  */
1227
1238
  interface DAGEdge {
1228
1239
  from: string;
@@ -1291,78 +1302,4 @@ declare function calculateRunCost(results: StepResult[]): {
1291
1302
  /** Format cost as a human-readable string */
1292
1303
  declare function formatCost(usd: number): string;
1293
1304
 
1294
- /**
1295
- * @module WorkflowConvexSchemaFields
1296
- * @package @geenius/ai-workflow-shared
1297
- * @description Typed Convex-style schema manifests for the workflow package.
1298
- * These structured objects preserve field shape so consumers can persist and
1299
- * query workflow payloads without losing typed storage metadata.
1300
- */
1301
- type LiteralField<T extends string | number | boolean> = {
1302
- type: 'literal';
1303
- value: T;
1304
- optional?: true;
1305
- };
1306
- type StringField = {
1307
- type: 'string';
1308
- optional?: true;
1309
- };
1310
- type NumberField = {
1311
- type: 'number';
1312
- optional?: true;
1313
- };
1314
- type BooleanField = {
1315
- type: 'boolean';
1316
- optional?: true;
1317
- };
1318
- type UnknownField = {
1319
- type: 'any';
1320
- optional?: true;
1321
- };
1322
- type ArrayField = {
1323
- type: 'array';
1324
- items: SchemaField;
1325
- optional?: true;
1326
- };
1327
- type RecordField = {
1328
- type: 'record';
1329
- key: SchemaField;
1330
- value: SchemaField;
1331
- optional?: true;
1332
- };
1333
- type ObjectField = {
1334
- type: 'object';
1335
- fields: Record<string, SchemaField>;
1336
- optional?: true;
1337
- };
1338
- type UnionField = {
1339
- type: 'union';
1340
- values: SchemaField[];
1341
- optional?: true;
1342
- };
1343
- /**
1344
- * Typed schema field descriptor used to describe Convex document shapes.
1345
- */
1346
- type SchemaField = LiteralField<string | number | boolean> | StringField | NumberField | BooleanField | UnknownField | ArrayField | RecordField | ObjectField | UnionField;
1347
- /**
1348
- * Manifest describing persisted workflow definition documents.
1349
- */
1350
- declare const workflowsTable: ObjectField;
1351
- /**
1352
- * Manifest describing persisted workflow execution run documents.
1353
- */
1354
- declare const workflowRunsTable: ObjectField;
1355
- /**
1356
- * Manifest describing persisted per-step execution result documents.
1357
- */
1358
- declare const workflowStepResultsTable: ObjectField;
1359
- /**
1360
- * Named collection of all workflow table manifests for consumer schema merges.
1361
- */
1362
- declare const workflowTables: {
1363
- workflows: ObjectField;
1364
- workflowRuns: ObjectField;
1365
- workflowStepResults: ObjectField;
1366
- };
1367
-
1368
- export { type ConditionConfig, type ConfigureWorkflowOptions, type CustomStepConfig, type DAGEdge, type DAGNode, type DelayConfig, type HumanApprovalConfig, type LLMCallConfig, type LoopConfig, MODEL_RATES, type ParallelConfig, type RunStatus, type StepConfig, type StepConnection, type StepResult, type StepStatus, type StepType, type SubWorkflowConfig, type TransformConfig, WORKFLOW_TEMPLATES, type WebhookConfig, type WorkflowBuilderState, WorkflowConfigurationError, type WorkflowDefinition, WorkflowEngine, type WorkflowEngineOptions, WorkflowError, type WorkflowErrorContext, WorkflowExecutionError, WorkflowExpressionError, WorkflowGraphError, type WorkflowRun, type WorkflowStatus, type WorkflowStepDef, type WorkflowTemplate, type WorkflowVariable, approvalStep, calculateRunCost, conditionStep, configureWorkflow, connect, defaultWorkflowConfig, delayStep, detectCycle, estimateStepCost, estimateStepTokens, estimateTokens, estimateWorkflowCost, evaluateExpression, extractVariables, findEntryNodes, findExitNodes, findMissingVariables, findPaths, formatCost, getTemplate, getTemplatesByCategory, interpolate, linearWorkflow, llmStep, normalizeWorkflowError, stepConfigSchema, stepConnectionSchema, stepResultSchema, topoSort, transformStep, validateConnectionIntegrity, validateRun, validateWorkflow, webhookStep, workflowDefinitionSchema, workflowRunSchema, workflowRunsTable, workflowStepDefSchema, workflowStepResultsTable, workflowTables, workflowVariableSchema, workflowsTable };
1305
+ export { type ConditionConfig, type ConfigureWorkflowOptions, type CustomStepConfig, type DAGEdge, type DAGNode, type DelayConfig, type HumanApprovalConfig, type LLMCallConfig, type LoopConfig, MODEL_RATES, type ParallelConfig, type RunStatus, type StepConfig, type StepConnection, type StepResult, type StepStatus, type StepType, type SubWorkflowConfig, type TransformConfig, WORKFLOW_TEMPLATES, type WebhookConfig, type WorkflowBuilderState, WorkflowConfigurationError, type WorkflowDefinition, WorkflowEngine, type WorkflowEngineOptions, WorkflowError, type WorkflowErrorContext, WorkflowExecutionError, WorkflowExpressionError, WorkflowGraphError, type WorkflowRun, type WorkflowStatus, type WorkflowStepDef, type WorkflowTemplate, type WorkflowVariable, approvalStep, calculateRunCost, conditionStep, configureWorkflow, connect, defaultWorkflowConfig, delayStep, detectCycle, estimateStepCost, estimateStepTokens, estimateTokens, estimateWorkflowCost, evaluateExpression, extractVariables, findEntryNodes, findExitNodes, findMissingVariables, findPaths, formatCost, getTemplate, getTemplatesByCategory, interpolate, linearWorkflow, llmStep, normalizeWorkflowError, stepConfigSchema, stepConnectionSchema, stepResultSchema, topoSort, transformStep, validateConnectionIntegrity, validateRun, validateWorkflow, webhookStep, workflowDefinitionSchema, workflowRunSchema, workflowStepDefSchema, workflowVariableSchema };
@@ -1589,93 +1589,6 @@ function getTemplatesByCategory(category) {
1589
1589
  return WORKFLOW_TEMPLATES.filter((t) => t.category === category);
1590
1590
  }
1591
1591
 
1592
- // src/convex/schemas.ts
1593
- var stringField = (optional = false) => ({ type: "string", ...optional ? { optional: true } : {} });
1594
- var numberField = (optional = false) => ({ type: "number", ...optional ? { optional: true } : {} });
1595
- var unknownField = (optional = false) => ({ type: "any", ...optional ? { optional: true } : {} });
1596
- var literalField = (value, optional = false) => ({ type: "literal", value, ...optional ? { optional: true } : {} });
1597
- var arrayField = (items, optional = false) => ({ type: "array", items, ...optional ? { optional: true } : {} });
1598
- var recordField = (key, value, optional = false) => ({ type: "record", key, value, ...optional ? { optional: true } : {} });
1599
- var objectField = (fields, optional = false) => ({ type: "object", fields, ...optional ? { optional: true } : {} });
1600
- var unionField = (values, optional = false) => ({ type: "union", values, ...optional ? { optional: true } : {} });
1601
- var workflowsTable = objectField({
1602
- name: stringField(),
1603
- description: stringField(true),
1604
- version: numberField(),
1605
- status: unionField([
1606
- literalField("draft"),
1607
- literalField("active"),
1608
- literalField("archived"),
1609
- literalField("error")
1610
- ]),
1611
- definition: objectField({
1612
- id: stringField(),
1613
- name: stringField(),
1614
- description: stringField(true),
1615
- version: numberField(),
1616
- status: stringField(),
1617
- steps: arrayField(unknownField()),
1618
- connections: arrayField(unknownField()),
1619
- inputSchema: arrayField(unknownField(), true),
1620
- variables: recordField(stringField(), unknownField(), true),
1621
- tags: arrayField(stringField(), true),
1622
- createdBy: stringField(),
1623
- createdAt: numberField(),
1624
- updatedAt: numberField()
1625
- }),
1626
- createdBy: stringField(),
1627
- tags: arrayField(stringField(), true),
1628
- createdAt: numberField(),
1629
- updatedAt: numberField()
1630
- });
1631
- var workflowRunsTable = objectField({
1632
- workflowId: stringField(),
1633
- workflowVersion: numberField(),
1634
- status: unionField([
1635
- literalField("pending"),
1636
- literalField("running"),
1637
- literalField("paused"),
1638
- literalField("completed"),
1639
- literalField("failed"),
1640
- literalField("cancelled")
1641
- ]),
1642
- input: recordField(stringField(), unknownField(), true),
1643
- variables: recordField(stringField(), unknownField(), true),
1644
- currentStepIndex: numberField(),
1645
- stepResults: arrayField(unknownField(), true),
1646
- error: stringField(true),
1647
- triggeredBy: stringField(),
1648
- startedAt: numberField(),
1649
- completedAt: numberField(true)
1650
- });
1651
- var workflowStepResultsTable = objectField({
1652
- runId: stringField(),
1653
- stepId: stringField(),
1654
- stepName: stringField(),
1655
- type: stringField(),
1656
- status: unionField([
1657
- literalField("pending"),
1658
- literalField("running"),
1659
- literalField("completed"),
1660
- literalField("failed"),
1661
- literalField("skipped"),
1662
- literalField("waiting-approval")
1663
- ]),
1664
- input: recordField(stringField(), unknownField(), true),
1665
- output: unknownField(true),
1666
- error: stringField(true),
1667
- durationMs: numberField(),
1668
- tokens: numberField(true),
1669
- costUsd: numberField(true),
1670
- startedAt: numberField(),
1671
- completedAt: numberField(true)
1672
- });
1673
- var workflowTables = {
1674
- workflows: workflowsTable,
1675
- workflowRuns: workflowRunsTable,
1676
- workflowStepResults: workflowStepResultsTable
1677
- };
1678
-
1679
- export { MODEL_RATES, WORKFLOW_TEMPLATES, WorkflowConfigurationError, WorkflowEngine, WorkflowError, WorkflowExecutionError, WorkflowExpressionError, WorkflowGraphError, approvalStep, calculateRunCost, conditionStep, configureWorkflow, connect, defaultWorkflowConfig, delayStep, detectCycle, estimateStepCost, estimateStepTokens, estimateTokens, estimateWorkflowCost, evaluateExpression, extractVariables, findEntryNodes, findExitNodes, findMissingVariables, findPaths, formatCost, getTemplate, getTemplatesByCategory, interpolate, linearWorkflow, llmStep, normalizeWorkflowError, stepConfigSchema, stepConnectionSchema, stepResultSchema, topoSort, transformStep, validateConnectionIntegrity, validateRun, validateWorkflow, webhookStep, workflowDefinitionSchema, workflowRunSchema, workflowRunsTable, workflowStepDefSchema, workflowStepResultsTable, workflowTables, workflowVariableSchema, workflowsTable };
1592
+ export { MODEL_RATES, WORKFLOW_TEMPLATES, WorkflowConfigurationError, WorkflowEngine, WorkflowError, WorkflowExecutionError, WorkflowExpressionError, WorkflowGraphError, approvalStep, calculateRunCost, conditionStep, configureWorkflow, connect, defaultWorkflowConfig, delayStep, detectCycle, estimateStepCost, estimateStepTokens, estimateTokens, estimateWorkflowCost, evaluateExpression, extractVariables, findEntryNodes, findExitNodes, findMissingVariables, findPaths, formatCost, getTemplate, getTemplatesByCategory, interpolate, linearWorkflow, llmStep, normalizeWorkflowError, stepConfigSchema, stepConnectionSchema, stepResultSchema, topoSort, transformStep, validateConnectionIntegrity, validateRun, validateWorkflow, webhookStep, workflowDefinitionSchema, workflowRunSchema, workflowStepDefSchema, workflowVariableSchema };
1680
1593
  //# sourceMappingURL=index.js.map
1681
1594
  //# sourceMappingURL=index.js.map