sim 2.2.32-preview.314.1 → 2.2.33-preview.316.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.
Files changed (35) hide show
  1. package/README.md +42 -0
  2. package/THIRD_PARTY_LICENSES +31 -0
  3. package/dist/auth/refresh.d.ts +2 -1
  4. package/dist/commands/protocol/files-get.d.ts +3 -0
  5. package/dist/commands/protocol/result.d.ts +7 -1
  6. package/dist/commands/protocol/source-dir.d.ts +263 -0
  7. package/dist/commands/protocol/source-exit-codes.d.ts +8 -0
  8. package/dist/commands/protocol/source-primer.d.ts +14 -0
  9. package/dist/commands/protocol/source-status.d.ts +145 -0
  10. package/dist/commands/protocol/source-tree.d.ts +159 -0
  11. package/dist/commands/protocol/source-ui.d.ts +89 -0
  12. package/dist/commands/protocol/stored-edges.d.ts +44 -0
  13. package/dist/commands/protocol/workflow-source-apply.d.ts +38 -0
  14. package/dist/commands/protocol/workflow-source-check.d.ts +70 -0
  15. package/dist/commands/protocol/workflow-source-get.d.ts +40 -0
  16. package/dist/commands/protocol/workflow-source-params.d.ts +7 -0
  17. package/dist/commands/protocol/workflow-source-status.d.ts +14 -0
  18. package/dist/commands/protocol/workspace-source-apply.d.ts +15 -0
  19. package/dist/commands/protocol/workspace-source-blobs.d.ts +111 -0
  20. package/dist/commands/protocol/workspace-source-check.d.ts +7 -0
  21. package/dist/commands/protocol/workspace-source-dir.d.ts +135 -0
  22. package/dist/commands/protocol/workspace-source-get.d.ts +13 -0
  23. package/dist/commands/protocol/workspace-source-status.d.ts +13 -0
  24. package/dist/embed-context.d.ts +6 -3
  25. package/dist/exit-codes.d.ts +66 -0
  26. package/dist/generated/v2-api.d.ts +1297 -1
  27. package/dist/http/client.d.ts +22 -0
  28. package/dist/index.js +58843 -20211
  29. package/dist/output/io.d.ts +6 -0
  30. package/dist/program.d.ts +1 -1
  31. package/dist/runtime.js +59083 -20451
  32. package/dist/terminal/interrupts.d.ts +23 -0
  33. package/dist/terminal/line-input.d.ts +8 -0
  34. package/dist/terminal.d.ts +1 -0
  35. package/package.json +5 -1
@@ -475,7 +475,7 @@ export type ApplyWorkflowOperationsBody = {
475
475
  }>;
476
476
  };
477
477
  type ApplyWorkflowOperationsResponseRef0 = {
478
- type: 'block_not_found' | 'invalid_block_type' | 'block_not_allowed' | 'model_not_allowed' | 'block_locked' | 'tool_not_allowed' | 'invalid_edge_target' | 'invalid_edge_source' | 'invalid_edge_scope' | 'invalid_source_handle' | 'invalid_target_handle' | 'invalid_subblock_field' | 'missing_required_params' | 'invalid_subflow_parent' | 'nested_subflow_not_allowed' | 'duplicate_block_name' | 'reserved_block_name' | 'retry_not_supported' | 'duplicate_trigger' | 'duplicate_single_instance_block' | 'disabled_ancestor';
478
+ type: 'block_not_found' | 'invalid_block_type' | 'block_not_allowed' | 'model_not_allowed' | 'block_locked' | 'tool_not_allowed' | 'invalid_edge_target' | 'invalid_edge_source' | 'invalid_edge_scope' | 'invalid_source_handle' | 'invalid_target_handle' | 'edge_cycle' | 'invalid_subblock_field' | 'missing_required_params' | 'invalid_subflow_parent' | 'nested_subflow_not_allowed' | 'duplicate_block_name' | 'reserved_block_name' | 'retry_not_supported' | 'duplicate_trigger' | 'duplicate_single_instance_block' | 'disabled_ancestor';
479
479
  operationType: string;
480
480
  blockId: string;
481
481
  reason: string;
@@ -577,6 +577,156 @@ type ApplyWorkflowOperationsResponseRef3 = {
577
577
  export type ApplyWorkflowOperationsResponse = {
578
578
  data: ApplyWorkflowOperationsResponseRef3;
579
579
  };
580
+ /** `POST /api/v2/workflows/[workflowId]/source` */
581
+ export type ApplyWorkflowSourceParams = {
582
+ workflowId: string;
583
+ };
584
+ export type ApplyWorkflowSourceQuery = {
585
+ dryRun?: boolean;
586
+ allowDelete?: boolean;
587
+ };
588
+ export type ApplyWorkflowSourceBody = {
589
+ files: Record<string, string>;
590
+ lock: {
591
+ version: 1;
592
+ blocks: Record<string, {
593
+ id: string;
594
+ parent: string | null;
595
+ branches?: Record<string, string>;
596
+ items?: Record<string, Array<{
597
+ name: string;
598
+ id: string;
599
+ }>>;
600
+ ident: string;
601
+ order: number;
602
+ layout?: {
603
+ x: number;
604
+ y: number;
605
+ w?: number;
606
+ h?: number;
607
+ height?: number;
608
+ horizontalHandles?: boolean;
609
+ [key: string]: unknown;
610
+ };
611
+ codeFile?: string;
612
+ [key: string]: unknown;
613
+ }>;
614
+ variables: Record<string, string>;
615
+ [key: string]: unknown;
616
+ };
617
+ base: {
618
+ version?: 1;
619
+ workflowId: string;
620
+ workspaceId: string;
621
+ fingerprint: string;
622
+ catalogHash: string;
623
+ [key: string]: unknown;
624
+ };
625
+ provenance?: {
626
+ client: 'cli' | 'copilot' | 'canvas' | 'api';
627
+ gitSha?: string;
628
+ repo?: string;
629
+ };
630
+ };
631
+ export type ApplyWorkflowSourceResponse = {
632
+ data: {
633
+ workflowId: string;
634
+ workspaceId: string;
635
+ dryRun: boolean;
636
+ applied: boolean;
637
+ diff: {
638
+ noop: boolean;
639
+ meta?: Array<'name' | 'description'>;
640
+ blocks: {
641
+ added: Array<{
642
+ id: string;
643
+ key: string;
644
+ type: string;
645
+ }>;
646
+ removed: Array<{
647
+ id: string;
648
+ key: string;
649
+ type: string;
650
+ }>;
651
+ renamed: Array<{
652
+ id: string;
653
+ from: string;
654
+ to: string;
655
+ }>;
656
+ modified: Array<{
657
+ id: string;
658
+ key: string;
659
+ fields: Array<string>;
660
+ reparented?: boolean;
661
+ }>;
662
+ };
663
+ edges: {
664
+ added: number;
665
+ removed: number;
666
+ };
667
+ variables: {
668
+ added: Array<string>;
669
+ removed: Array<string>;
670
+ modified: Array<string>;
671
+ };
672
+ };
673
+ diagnostics: Array<{
674
+ code: 'E_SYNTAX' | 'E_SDK_HEADER' | 'E_SDK_MAJOR' | 'E_SDK_MAJOR_OLD' | 'E_UNSUPPORTED_SYNTAX' | 'E_WORKFLOW_EXPORT' | 'E_LIMIT_EXCEEDED' | 'E_INVALID_CHARACTER' | 'E_NUMBER_NOT_FINITE' | 'W_NUMBER_PRECISION' | 'E_TOO_MANY_ERRORS' | 'W_TOO_MANY_WARNINGS' | 'E_DUPLICATE_NAME' | 'E_RESERVED_NAME' | 'E_KEY_OVERRIDE' | 'E_EMPTY_NAME' | 'E_LOOKALIKE_NAME' | 'W_LOOKALIKE_NAME' | 'W_SUSPICIOUS_CHARACTER' | 'E_NAME_NOT_LITERAL' | 'E_UNKNOWN_IDENTIFIER' | 'E_OUT_OF_SCOPE' | 'E_UNKNOWN_VARIABLE' | 'E_DUPLICATE_VARIABLE' | 'E_VARIABLE_NAME_MISMATCH' | 'E_INVALID_ENV_NAME' | 'W_ENV_UNKNOWN' | 'W_CHILD_INPUT_UNKNOWN' | 'W_CHILD_NO_START' | 'E_UNKNOWN_SUBFLOW_PROPERTY' | 'W_FORWARD_REF' | 'W_REF_NOT_NORMALIZED' | 'E_REF_UNREPRESENTABLE' | 'E_EDGE_SCOPE' | 'E_EDGE_NOTE' | 'E_TARGET_TRIGGER' | 'E_NO_DEFAULT_OUTPUT' | 'E_DUPLICATE_EDGE' | 'E_ERROR_PORT_UNSUPPORTED' | 'W_ERROR_PORT_STORED' | 'E_UNKNOWN_BRANCH' | 'E_DUPLICATE_BRANCH_KEY' | 'E_BRANCH_KEY_COLLIDES' | 'E_BRANCH_ELSE_LAST' | 'W_RAW_HANDLE' | 'W_SUBFLOW_HANDLE_SCOPE' | 'E_EDGE_CYCLE' | 'W_EDGE_CYCLE' | 'W_BRANCH_UNWIRED' | 'E_UNKNOWN_BUILDER' | 'E_UNKNOWN_PARAM' | 'E_FIXED_PARAM' | 'W_FIELD_NOT_APPLICABLE' | 'W_REQUIRED_MISSING' | 'W_UNKNOWN_OPTION' | 'E_UNKNOWN_OPERATION' | 'W_UNKNOWN_MODEL' | 'W_LEGACY_BLOCK_TYPE' | 'I_SCHEDULE_UTC' | 'E_STORED_VALUE_MISSING' | 'W_VALUE_KIND' | 'W_OUT_OF_RANGE' | 'W_TABLE_FILTER_SHAPE' | 'W_LITERAL_SECRET' | 'W_SUBFLOW_COUNT' | 'W_UNKNOWN_OUTPUT_PATH' | 'W_JSON_REF_UNTYPED' | 'E_CODE_FILE_MISSING' | 'E_CODE_FILE_PATH' | 'W_CODE_FILE_INLINED' | 'W_UNRESOLVED_REF' | 'W_FORWARD_REF_LITERALIZED' | 'W_COMMENT_MOVED' | 'W_COMMENT_DROPPED' | 'E_LOCK_JSON' | 'E_LOCK_VERSION' | 'E_LOCK_SHAPE' | 'E_LOCK_UNKNOWN_FIELD' | 'E_LOCK_KEY' | 'E_LOCK_IDENT' | 'E_LOCK_DUPLICATE_IDENT' | 'E_LOCK_DUPLICATE_ID' | 'E_LOCK_PARENT' | 'E_LOCK_BRANCH' | 'E_LOCK_CODE_FILE_PATH' | 'E_SOURCE_META_JSON' | 'E_SOURCE_META_VERSION' | 'E_SOURCE_META_SHAPE' | 'E_SOURCE_META_UNKNOWN_FIELD' | 'E_SOURCE_META_IDENT' | 'E_SOURCE_META_DUPLICATE_IDENT' | 'E_SOURCE_META_ANCHOR' | 'E_CANON_LEGACY_NAME_COLLISION' | 'E_CANON_EDGE_SCOPE' | 'W_CANON_RESERVED_NAME' | 'W_CANON_DANGLING_EDGE' | 'W_CANON_DANGLING_PARENT' | 'W_CANON_RAW_HANDLE' | 'W_CANON_UNKNOWN_BLOCK_TYPE' | 'W_CANON_UNRESOLVED_ID' | 'W_CANON_TITLE_OVERRIDE' | 'W_CANON_SUBFLOW_REPAIRED' | 'W_CANON_SUBBLOCK_TYPE_DRIFT' | 'W_CANON_UNDECODABLE_JSON' | 'E_MAT_DUPLICATE_LOCK_ID' | 'E_MAT_UNKNOWN_RESOURCE' | 'E_MAT_UNKNOWN_VARIABLE' | 'W_MAT_DELETED_SINCE_PULL' | 'W_MAT_INFERRED_RENAME' | 'W_MAT_RETYPE_RECREATED' | 'W_MAT_LOCK_ID_CLAIMED' | 'I_MAT_NEEDS_LAYOUT' | 'E_APPLY_STALE' | 'E_APPLY_WORKFLOW_MISMATCH' | 'E_APPLY_LOCKED_BLOCK' | 'E_APPLY_TYPE_NOT_ADDABLE' | 'E_APPLY_INVALID_STATE' | 'E_APPLY_BLOCK_NOT_FOUND' | 'E_APPLY_INVALID_BLOCK_TYPE' | 'E_APPLY_BLOCK_NOT_ALLOWED' | 'E_APPLY_MODEL_NOT_ALLOWED' | 'E_APPLY_TOOL_NOT_ALLOWED' | 'E_APPLY_INVALID_EDGE_SOURCE' | 'E_APPLY_INVALID_EDGE_SCOPE' | 'E_APPLY_INVALID_SOURCE_HANDLE' | 'E_APPLY_INVALID_TARGET_HANDLE' | 'E_APPLY_INVALID_SUBBLOCK_FIELD' | 'E_APPLY_MISSING_REQUIRED_PARAMS' | 'E_APPLY_RETRY_NOT_SUPPORTED' | 'E_APPLY_DUPLICATE_TRIGGER' | 'E_APPLY_DUPLICATE_SINGLE_INSTANCE_BLOCK' | 'E_APPLY_DISABLED_ANCESTOR' | 'E_APPLY_CREDENTIAL_UNREACHABLE' | 'W_APPLY_CREDENTIAL_KEPT' | 'E_APPLY_SANDBOX_PLAN_REQUIRED' | 'W_APPLY_HOSTED_KEY_DROPPED' | 'W_APPLY_VALUE_NORMALIZED' | 'W_APPLY_TYPE_CHANGED' | 'W_APPLY_TRIGGER_REMOVED' | 'W_APPLY_CATALOG_MOVED' | 'W_APPLY_PROBABLE_RENAME' | 'E_APPLY_LINT' | 'W_APPLY_LINT' | 'W_TABLE_UNKNOWN_COLUMN' | 'E_APPLY_INVALID_SCHEDULE' | 'E_APPLY_BLOCK_DELETE' | 'E_NAME_TAKEN' | 'E_WORKFLOW_META_INVALID';
675
+ severity: 'error' | 'warning' | 'info';
676
+ message: string;
677
+ hint?: string;
678
+ blockKey?: string;
679
+ param?: string;
680
+ file?: string;
681
+ line?: number;
682
+ column?: number;
683
+ endLine?: number;
684
+ endColumn?: number;
685
+ frame?: string;
686
+ blockId?: string;
687
+ path?: string;
688
+ }>;
689
+ files: Record<string, string>;
690
+ lock: {
691
+ version: 1;
692
+ blocks: Record<string, {
693
+ id: string;
694
+ parent: string | null;
695
+ branches?: Record<string, string>;
696
+ items?: Record<string, Array<{
697
+ name: string;
698
+ id: string;
699
+ }>>;
700
+ ident: string;
701
+ order: number;
702
+ layout?: {
703
+ x: number;
704
+ y: number;
705
+ w?: number;
706
+ h?: number;
707
+ height?: number;
708
+ horizontalHandles?: boolean;
709
+ [key: string]: unknown;
710
+ };
711
+ codeFile?: string;
712
+ [key: string]: unknown;
713
+ }>;
714
+ variables: Record<string, string>;
715
+ [key: string]: unknown;
716
+ };
717
+ base: {
718
+ version: 1;
719
+ workflowId: string;
720
+ workspaceId: string;
721
+ fingerprint: string;
722
+ catalogHash: string;
723
+ [key: string]: unknown;
724
+ };
725
+ mintedIds: Record<string, string>;
726
+ notes: Array<string>;
727
+ needsRedeployment: boolean;
728
+ };
729
+ };
580
730
  /** `PATCH /api/v2/workflows/[workflowId]/variables` */
581
731
  export type ApplyWorkflowVariablesParams = {
582
732
  workflowId: string;
@@ -606,6 +756,134 @@ type ApplyWorkflowVariablesResponseRef0 = {
606
756
  export type ApplyWorkflowVariablesResponse = {
607
757
  data: ApplyWorkflowVariablesResponseRef0;
608
758
  };
759
+ /** `POST /api/v2/workspaces/[workspaceId]/source` */
760
+ export type ApplyWorkspaceSourceParams = {
761
+ workspaceId: string;
762
+ };
763
+ export type ApplyWorkspaceSourceQuery = {
764
+ dryRun?: boolean;
765
+ };
766
+ export type ApplyWorkspaceSourceBody = {
767
+ files: Record<string, string>;
768
+ blobs?: Array<{
769
+ path: string;
770
+ sha256: string;
771
+ size: number;
772
+ }>;
773
+ base?: {
774
+ version: 1;
775
+ workspaceId: string;
776
+ resources: Record<string, {
777
+ id: string;
778
+ fingerprint?: string;
779
+ columns?: Record<string, {
780
+ id: string;
781
+ options?: Record<string, string>;
782
+ }>;
783
+ blobs?: Record<string, {
784
+ id: string;
785
+ rev: number | string;
786
+ sha256: string;
787
+ }>;
788
+ rows?: {
789
+ fingerprint: string;
790
+ version: number;
791
+ [key: string]: unknown;
792
+ };
793
+ [key: string]: unknown;
794
+ }>;
795
+ [key: string]: unknown;
796
+ };
797
+ kinds: Array<'secret' | 'credential' | 'custom-tool' | 'skill' | 'mcp-server' | 'table' | 'knowledge-base' | 'file' | 'workflow' | 'deployment'>;
798
+ options?: {
799
+ allowDelete?: boolean;
800
+ only?: Array<'secret' | 'credential' | 'custom-tool' | 'skill' | 'mcp-server' | 'table' | 'knowledge-base' | 'file' | 'workflow' | 'deployment'>;
801
+ };
802
+ provenance?: {
803
+ client: 'cli' | 'api';
804
+ gitSha?: string;
805
+ };
806
+ };
807
+ export type ApplyWorkspaceSourceResponse = {
808
+ data: {
809
+ workspaceId: string;
810
+ dryRun: boolean;
811
+ plan: Array<{
812
+ kind: 'secret' | 'credential' | 'custom-tool' | 'skill' | 'mcp-server' | 'table' | 'knowledge-base' | 'file' | 'workflow' | 'deployment';
813
+ key: string;
814
+ action: 'create' | 'update' | 'adopt' | 'delete' | 'noop';
815
+ fields?: Array<string>;
816
+ destructive?: {
817
+ what: string;
818
+ counts: Record<string, number>;
819
+ };
820
+ id?: string;
821
+ held?: true;
822
+ }>;
823
+ applied: Array<{
824
+ kind: 'secret' | 'credential' | 'custom-tool' | 'skill' | 'mcp-server' | 'table' | 'knowledge-base' | 'file' | 'workflow' | 'deployment';
825
+ key: string;
826
+ action: 'create' | 'update' | 'adopt' | 'delete' | 'noop';
827
+ fields?: Array<string>;
828
+ destructive?: {
829
+ what: string;
830
+ counts: Record<string, number>;
831
+ };
832
+ id?: string;
833
+ held?: true;
834
+ }>;
835
+ failed?: {
836
+ kind: 'secret' | 'credential' | 'custom-tool' | 'skill' | 'mcp-server' | 'table' | 'knowledge-base' | 'file' | 'workflow' | 'deployment';
837
+ key: string;
838
+ code: 'E_DECL_SYNTAX' | 'E_DECL_HEADER' | 'E_DECL_IMPORT' | 'E_DECL_EXPORT' | 'E_DECL_UNSUPPORTED' | 'E_DECL_DUPLICATE_KEY' | 'E_DECL_SHAPE' | 'E_DECL_UNKNOWN_FIELD' | 'E_DECL_UNKNOWN_FILE' | 'W_PATH_NOT_SENT' | 'E_BLOB_MANIFEST' | 'E_BLOB_MISSING' | 'E_LIMIT_EXCEEDED' | 'E_KEY_INVALID' | 'W_DECL_SUSPICIOUS_CHARACTER' | 'E_BASE_JSON' | 'E_BASE_VERSION' | 'E_BASE_SHAPE' | 'E_BASE_UNKNOWN_FIELD' | 'E_SECRET_NAME' | 'E_SECRET_MISSING' | 'W_SECRET_MISSING' | 'E_CREDENTIAL_MISSING' | 'E_CREDENTIAL_AMBIGUOUS' | 'W_CREDENTIAL_MISSING' | 'W_CREDENTIAL_AMBIGUOUS' | 'E_TABLE_COLUMN_NAME' | 'E_TABLE_DUPLICATE_COLUMN' | 'E_TABLE_TOO_MANY_COLUMNS' | 'E_TABLE_OPTIONS' | 'E_TABLE_TYPE_CONVERSION' | 'E_TABLE_FOLDER' | 'E_TABLE_ROWS' | 'I_TABLE_SEED_SKIPPED' | 'I_TABLE_ROWS_UNKEYED' | 'W_LIKELY_RENAME' | 'E_TOOL_SCHEMA' | 'E_TOOL_CODE' | 'E_TOOL_STORED_MISSING' | 'W_TOOL_LITERAL_SECRET' | 'E_SKILL_FRONTMATTER' | 'E_MCP_LITERAL_SECRET' | 'E_MCP_STORED_MISSING' | 'E_MCP_TOOL_UNKNOWN' | 'W_MCP_REPLACE' | 'W_MCP_TOOLS_UNCHECKED' | 'E_FILE_PATH' | 'E_FILE_PATH_COLLISION' | 'E_FILE_NAME' | 'E_FILE_TOO_LARGE' | 'E_FILE_CONTENT' | 'E_KB_EMBEDDING_IMMUTABLE' | 'E_KB_EMBEDDING_MODEL' | 'E_KB_DOC_AMBIGUOUS' | 'E_KB_DOC_NAME' | 'E_KB_DOC_EMPTY' | 'E_KB_CHUNKING' | 'E_KB_FOLDER' | 'W_KB_DOC_UNCHECKED' | 'W_KB_DOC_FAILED' | 'I_KB_REEMBED' | 'I_KB_CHUNKING' | 'I_KB_PROCESSING' | 'I_KB_DOCS_UNHASHED' | 'I_KB_UNMANAGED_DOCS' | 'I_KB_REPLACE_UNFINISHED' | 'E_DEPLOY_WORKFLOW' | 'E_DEPLOY_SECRET' | 'E_DEPLOY_CHAT_OUTPUT' | 'E_DEPLOY_CHAT_IDENTIFIER' | 'E_DEPLOY_PINNED_CHAT' | 'W_DEPLOYED_DRAFT_CHANGED' | 'I_DEPLOY_DRAFT_NOT_LIVE' | 'E_APPLY_STALE' | 'E_APPLY_NO_BASE' | 'E_APPLY_FORBIDDEN' | 'E_APPLY_DELETE_NOT_ALLOWED' | 'E_APPLY_LOCKED' | 'E_APPLY_REFUSED' | 'E_APPLY_FAILED' | 'E_PLAN_TOO_LARGE' | 'E_PLAN_REF_DELETED' | 'E_PLAN_REF_HELD' | 'W_RESOURCE_IN_USE' | 'W_TABLE_COLUMN_RENAMED_IN_USE' | 'E_NAME_TAKEN' | 'E_WORKFLOW_FILES_MISSING' | 'E_WORKFLOW_FOLDER_COPIED' | 'W_UNDECLARED' | 'W_BASE_OTHER_WORKSPACE' | 'I_SERVER_CHANGED' | 'I_SERVER_DELETED' | 'I_SERVER_MOVED' | 'I_KEY_REBOUND' | 'E_KEY_RENAMED' | 'I_FINDINGS_TRUNCATED' | 'E_SYNTAX' | 'E_SDK_HEADER' | 'E_SDK_MAJOR' | 'E_SDK_MAJOR_OLD' | 'E_UNSUPPORTED_SYNTAX' | 'E_WORKFLOW_EXPORT' | 'E_INVALID_CHARACTER' | 'E_NUMBER_NOT_FINITE' | 'W_NUMBER_PRECISION' | 'E_TOO_MANY_ERRORS' | 'W_TOO_MANY_WARNINGS' | 'E_DUPLICATE_NAME' | 'E_RESERVED_NAME' | 'E_KEY_OVERRIDE' | 'E_EMPTY_NAME' | 'E_LOOKALIKE_NAME' | 'W_LOOKALIKE_NAME' | 'W_SUSPICIOUS_CHARACTER' | 'E_NAME_NOT_LITERAL' | 'E_UNKNOWN_IDENTIFIER' | 'E_OUT_OF_SCOPE' | 'E_UNKNOWN_VARIABLE' | 'E_DUPLICATE_VARIABLE' | 'E_VARIABLE_NAME_MISMATCH' | 'E_INVALID_ENV_NAME' | 'W_ENV_UNKNOWN' | 'W_CHILD_INPUT_UNKNOWN' | 'W_CHILD_NO_START' | 'E_UNKNOWN_SUBFLOW_PROPERTY' | 'W_FORWARD_REF' | 'W_REF_NOT_NORMALIZED' | 'E_REF_UNREPRESENTABLE' | 'E_EDGE_SCOPE' | 'E_EDGE_NOTE' | 'E_TARGET_TRIGGER' | 'E_NO_DEFAULT_OUTPUT' | 'E_DUPLICATE_EDGE' | 'E_ERROR_PORT_UNSUPPORTED' | 'W_ERROR_PORT_STORED' | 'E_UNKNOWN_BRANCH' | 'E_DUPLICATE_BRANCH_KEY' | 'E_BRANCH_KEY_COLLIDES' | 'E_BRANCH_ELSE_LAST' | 'W_RAW_HANDLE' | 'W_SUBFLOW_HANDLE_SCOPE' | 'E_EDGE_CYCLE' | 'W_EDGE_CYCLE' | 'W_BRANCH_UNWIRED' | 'E_UNKNOWN_BUILDER' | 'E_UNKNOWN_PARAM' | 'E_FIXED_PARAM' | 'W_FIELD_NOT_APPLICABLE' | 'W_REQUIRED_MISSING' | 'W_UNKNOWN_OPTION' | 'E_UNKNOWN_OPERATION' | 'W_UNKNOWN_MODEL' | 'W_LEGACY_BLOCK_TYPE' | 'I_SCHEDULE_UTC' | 'E_STORED_VALUE_MISSING' | 'W_VALUE_KIND' | 'W_OUT_OF_RANGE' | 'W_TABLE_FILTER_SHAPE' | 'W_LITERAL_SECRET' | 'W_SUBFLOW_COUNT' | 'W_UNKNOWN_OUTPUT_PATH' | 'W_JSON_REF_UNTYPED' | 'E_CODE_FILE_MISSING' | 'E_CODE_FILE_PATH' | 'W_CODE_FILE_INLINED' | 'W_UNRESOLVED_REF' | 'W_FORWARD_REF_LITERALIZED' | 'W_COMMENT_MOVED' | 'W_COMMENT_DROPPED' | 'E_LOCK_JSON' | 'E_LOCK_VERSION' | 'E_LOCK_SHAPE' | 'E_LOCK_UNKNOWN_FIELD' | 'E_LOCK_KEY' | 'E_LOCK_IDENT' | 'E_LOCK_DUPLICATE_IDENT' | 'E_LOCK_DUPLICATE_ID' | 'E_LOCK_PARENT' | 'E_LOCK_BRANCH' | 'E_LOCK_CODE_FILE_PATH' | 'E_SOURCE_META_JSON' | 'E_SOURCE_META_VERSION' | 'E_SOURCE_META_SHAPE' | 'E_SOURCE_META_UNKNOWN_FIELD' | 'E_SOURCE_META_IDENT' | 'E_SOURCE_META_DUPLICATE_IDENT' | 'E_SOURCE_META_ANCHOR' | 'E_CANON_LEGACY_NAME_COLLISION' | 'E_CANON_EDGE_SCOPE' | 'W_CANON_RESERVED_NAME' | 'W_CANON_DANGLING_EDGE' | 'W_CANON_DANGLING_PARENT' | 'W_CANON_RAW_HANDLE' | 'W_CANON_UNKNOWN_BLOCK_TYPE' | 'W_CANON_UNRESOLVED_ID' | 'W_CANON_TITLE_OVERRIDE' | 'W_CANON_SUBFLOW_REPAIRED' | 'W_CANON_SUBBLOCK_TYPE_DRIFT' | 'W_CANON_UNDECODABLE_JSON' | 'E_MAT_DUPLICATE_LOCK_ID' | 'E_MAT_UNKNOWN_RESOURCE' | 'E_MAT_UNKNOWN_VARIABLE' | 'W_MAT_DELETED_SINCE_PULL' | 'W_MAT_INFERRED_RENAME' | 'W_MAT_RETYPE_RECREATED' | 'W_MAT_LOCK_ID_CLAIMED' | 'I_MAT_NEEDS_LAYOUT' | 'E_APPLY_WORKFLOW_MISMATCH' | 'E_APPLY_LOCKED_BLOCK' | 'E_APPLY_TYPE_NOT_ADDABLE' | 'E_APPLY_INVALID_STATE' | 'E_APPLY_BLOCK_NOT_FOUND' | 'E_APPLY_INVALID_BLOCK_TYPE' | 'E_APPLY_BLOCK_NOT_ALLOWED' | 'E_APPLY_MODEL_NOT_ALLOWED' | 'E_APPLY_TOOL_NOT_ALLOWED' | 'E_APPLY_INVALID_EDGE_SOURCE' | 'E_APPLY_INVALID_EDGE_SCOPE' | 'E_APPLY_INVALID_SOURCE_HANDLE' | 'E_APPLY_INVALID_TARGET_HANDLE' | 'E_APPLY_INVALID_SUBBLOCK_FIELD' | 'E_APPLY_MISSING_REQUIRED_PARAMS' | 'E_APPLY_RETRY_NOT_SUPPORTED' | 'E_APPLY_DUPLICATE_TRIGGER' | 'E_APPLY_DUPLICATE_SINGLE_INSTANCE_BLOCK' | 'E_APPLY_DISABLED_ANCESTOR' | 'E_APPLY_CREDENTIAL_UNREACHABLE' | 'W_APPLY_CREDENTIAL_KEPT' | 'E_APPLY_SANDBOX_PLAN_REQUIRED' | 'W_APPLY_HOSTED_KEY_DROPPED' | 'W_APPLY_VALUE_NORMALIZED' | 'W_APPLY_TYPE_CHANGED' | 'W_APPLY_TRIGGER_REMOVED' | 'W_APPLY_CATALOG_MOVED' | 'W_APPLY_PROBABLE_RENAME' | 'E_APPLY_LINT' | 'W_APPLY_LINT' | 'W_TABLE_UNKNOWN_COLUMN' | 'E_APPLY_INVALID_SCHEDULE' | 'E_APPLY_BLOCK_DELETE' | 'E_WORKFLOW_META_INVALID';
839
+ message: string;
840
+ };
841
+ needBlobs: Array<string>;
842
+ applyId?: string;
843
+ files: Record<string, string>;
844
+ base: {
845
+ version: 1;
846
+ workspaceId: string;
847
+ resources: Record<string, {
848
+ id: string;
849
+ fingerprint?: string;
850
+ columns?: Record<string, {
851
+ id: string;
852
+ options?: Record<string, string>;
853
+ }>;
854
+ blobs?: Record<string, {
855
+ id: string;
856
+ rev: number | string;
857
+ sha256: string;
858
+ }>;
859
+ rows?: {
860
+ fingerprint: string;
861
+ version: number;
862
+ [key: string]: unknown;
863
+ };
864
+ [key: string]: unknown;
865
+ }>;
866
+ [key: string]: unknown;
867
+ };
868
+ diagnostics: Array<{
869
+ code: 'E_DECL_SYNTAX' | 'E_DECL_HEADER' | 'E_DECL_IMPORT' | 'E_DECL_EXPORT' | 'E_DECL_UNSUPPORTED' | 'E_DECL_DUPLICATE_KEY' | 'E_DECL_SHAPE' | 'E_DECL_UNKNOWN_FIELD' | 'E_DECL_UNKNOWN_FILE' | 'W_PATH_NOT_SENT' | 'E_BLOB_MANIFEST' | 'E_BLOB_MISSING' | 'E_LIMIT_EXCEEDED' | 'E_KEY_INVALID' | 'W_DECL_SUSPICIOUS_CHARACTER' | 'E_BASE_JSON' | 'E_BASE_VERSION' | 'E_BASE_SHAPE' | 'E_BASE_UNKNOWN_FIELD' | 'E_SECRET_NAME' | 'E_SECRET_MISSING' | 'W_SECRET_MISSING' | 'E_CREDENTIAL_MISSING' | 'E_CREDENTIAL_AMBIGUOUS' | 'W_CREDENTIAL_MISSING' | 'W_CREDENTIAL_AMBIGUOUS' | 'E_TABLE_COLUMN_NAME' | 'E_TABLE_DUPLICATE_COLUMN' | 'E_TABLE_TOO_MANY_COLUMNS' | 'E_TABLE_OPTIONS' | 'E_TABLE_TYPE_CONVERSION' | 'E_TABLE_FOLDER' | 'E_TABLE_ROWS' | 'I_TABLE_SEED_SKIPPED' | 'I_TABLE_ROWS_UNKEYED' | 'W_LIKELY_RENAME' | 'E_TOOL_SCHEMA' | 'E_TOOL_CODE' | 'E_TOOL_STORED_MISSING' | 'W_TOOL_LITERAL_SECRET' | 'E_SKILL_FRONTMATTER' | 'E_MCP_LITERAL_SECRET' | 'E_MCP_STORED_MISSING' | 'E_MCP_TOOL_UNKNOWN' | 'W_MCP_REPLACE' | 'W_MCP_TOOLS_UNCHECKED' | 'E_FILE_PATH' | 'E_FILE_PATH_COLLISION' | 'E_FILE_NAME' | 'E_FILE_TOO_LARGE' | 'E_FILE_CONTENT' | 'E_KB_EMBEDDING_IMMUTABLE' | 'E_KB_EMBEDDING_MODEL' | 'E_KB_DOC_AMBIGUOUS' | 'E_KB_DOC_NAME' | 'E_KB_DOC_EMPTY' | 'E_KB_CHUNKING' | 'E_KB_FOLDER' | 'W_KB_DOC_UNCHECKED' | 'W_KB_DOC_FAILED' | 'I_KB_REEMBED' | 'I_KB_CHUNKING' | 'I_KB_PROCESSING' | 'I_KB_DOCS_UNHASHED' | 'I_KB_UNMANAGED_DOCS' | 'I_KB_REPLACE_UNFINISHED' | 'E_DEPLOY_WORKFLOW' | 'E_DEPLOY_SECRET' | 'E_DEPLOY_CHAT_OUTPUT' | 'E_DEPLOY_CHAT_IDENTIFIER' | 'E_DEPLOY_PINNED_CHAT' | 'W_DEPLOYED_DRAFT_CHANGED' | 'I_DEPLOY_DRAFT_NOT_LIVE' | 'E_APPLY_STALE' | 'E_APPLY_NO_BASE' | 'E_APPLY_FORBIDDEN' | 'E_APPLY_DELETE_NOT_ALLOWED' | 'E_APPLY_LOCKED' | 'E_APPLY_REFUSED' | 'E_APPLY_FAILED' | 'E_PLAN_TOO_LARGE' | 'E_PLAN_REF_DELETED' | 'E_PLAN_REF_HELD' | 'W_RESOURCE_IN_USE' | 'W_TABLE_COLUMN_RENAMED_IN_USE' | 'E_NAME_TAKEN' | 'E_WORKFLOW_FILES_MISSING' | 'E_WORKFLOW_FOLDER_COPIED' | 'W_UNDECLARED' | 'W_BASE_OTHER_WORKSPACE' | 'I_SERVER_CHANGED' | 'I_SERVER_DELETED' | 'I_SERVER_MOVED' | 'I_KEY_REBOUND' | 'E_KEY_RENAMED' | 'I_FINDINGS_TRUNCATED' | 'E_SYNTAX' | 'E_SDK_HEADER' | 'E_SDK_MAJOR' | 'E_SDK_MAJOR_OLD' | 'E_UNSUPPORTED_SYNTAX' | 'E_WORKFLOW_EXPORT' | 'E_INVALID_CHARACTER' | 'E_NUMBER_NOT_FINITE' | 'W_NUMBER_PRECISION' | 'E_TOO_MANY_ERRORS' | 'W_TOO_MANY_WARNINGS' | 'E_DUPLICATE_NAME' | 'E_RESERVED_NAME' | 'E_KEY_OVERRIDE' | 'E_EMPTY_NAME' | 'E_LOOKALIKE_NAME' | 'W_LOOKALIKE_NAME' | 'W_SUSPICIOUS_CHARACTER' | 'E_NAME_NOT_LITERAL' | 'E_UNKNOWN_IDENTIFIER' | 'E_OUT_OF_SCOPE' | 'E_UNKNOWN_VARIABLE' | 'E_DUPLICATE_VARIABLE' | 'E_VARIABLE_NAME_MISMATCH' | 'E_INVALID_ENV_NAME' | 'W_ENV_UNKNOWN' | 'W_CHILD_INPUT_UNKNOWN' | 'W_CHILD_NO_START' | 'E_UNKNOWN_SUBFLOW_PROPERTY' | 'W_FORWARD_REF' | 'W_REF_NOT_NORMALIZED' | 'E_REF_UNREPRESENTABLE' | 'E_EDGE_SCOPE' | 'E_EDGE_NOTE' | 'E_TARGET_TRIGGER' | 'E_NO_DEFAULT_OUTPUT' | 'E_DUPLICATE_EDGE' | 'E_ERROR_PORT_UNSUPPORTED' | 'W_ERROR_PORT_STORED' | 'E_UNKNOWN_BRANCH' | 'E_DUPLICATE_BRANCH_KEY' | 'E_BRANCH_KEY_COLLIDES' | 'E_BRANCH_ELSE_LAST' | 'W_RAW_HANDLE' | 'W_SUBFLOW_HANDLE_SCOPE' | 'E_EDGE_CYCLE' | 'W_EDGE_CYCLE' | 'W_BRANCH_UNWIRED' | 'E_UNKNOWN_BUILDER' | 'E_UNKNOWN_PARAM' | 'E_FIXED_PARAM' | 'W_FIELD_NOT_APPLICABLE' | 'W_REQUIRED_MISSING' | 'W_UNKNOWN_OPTION' | 'E_UNKNOWN_OPERATION' | 'W_UNKNOWN_MODEL' | 'W_LEGACY_BLOCK_TYPE' | 'I_SCHEDULE_UTC' | 'E_STORED_VALUE_MISSING' | 'W_VALUE_KIND' | 'W_OUT_OF_RANGE' | 'W_TABLE_FILTER_SHAPE' | 'W_LITERAL_SECRET' | 'W_SUBFLOW_COUNT' | 'W_UNKNOWN_OUTPUT_PATH' | 'W_JSON_REF_UNTYPED' | 'E_CODE_FILE_MISSING' | 'E_CODE_FILE_PATH' | 'W_CODE_FILE_INLINED' | 'W_UNRESOLVED_REF' | 'W_FORWARD_REF_LITERALIZED' | 'W_COMMENT_MOVED' | 'W_COMMENT_DROPPED' | 'E_LOCK_JSON' | 'E_LOCK_VERSION' | 'E_LOCK_SHAPE' | 'E_LOCK_UNKNOWN_FIELD' | 'E_LOCK_KEY' | 'E_LOCK_IDENT' | 'E_LOCK_DUPLICATE_IDENT' | 'E_LOCK_DUPLICATE_ID' | 'E_LOCK_PARENT' | 'E_LOCK_BRANCH' | 'E_LOCK_CODE_FILE_PATH' | 'E_SOURCE_META_JSON' | 'E_SOURCE_META_VERSION' | 'E_SOURCE_META_SHAPE' | 'E_SOURCE_META_UNKNOWN_FIELD' | 'E_SOURCE_META_IDENT' | 'E_SOURCE_META_DUPLICATE_IDENT' | 'E_SOURCE_META_ANCHOR' | 'E_CANON_LEGACY_NAME_COLLISION' | 'E_CANON_EDGE_SCOPE' | 'W_CANON_RESERVED_NAME' | 'W_CANON_DANGLING_EDGE' | 'W_CANON_DANGLING_PARENT' | 'W_CANON_RAW_HANDLE' | 'W_CANON_UNKNOWN_BLOCK_TYPE' | 'W_CANON_UNRESOLVED_ID' | 'W_CANON_TITLE_OVERRIDE' | 'W_CANON_SUBFLOW_REPAIRED' | 'W_CANON_SUBBLOCK_TYPE_DRIFT' | 'W_CANON_UNDECODABLE_JSON' | 'E_MAT_DUPLICATE_LOCK_ID' | 'E_MAT_UNKNOWN_RESOURCE' | 'E_MAT_UNKNOWN_VARIABLE' | 'W_MAT_DELETED_SINCE_PULL' | 'W_MAT_INFERRED_RENAME' | 'W_MAT_RETYPE_RECREATED' | 'W_MAT_LOCK_ID_CLAIMED' | 'I_MAT_NEEDS_LAYOUT' | 'E_APPLY_WORKFLOW_MISMATCH' | 'E_APPLY_LOCKED_BLOCK' | 'E_APPLY_TYPE_NOT_ADDABLE' | 'E_APPLY_INVALID_STATE' | 'E_APPLY_BLOCK_NOT_FOUND' | 'E_APPLY_INVALID_BLOCK_TYPE' | 'E_APPLY_BLOCK_NOT_ALLOWED' | 'E_APPLY_MODEL_NOT_ALLOWED' | 'E_APPLY_TOOL_NOT_ALLOWED' | 'E_APPLY_INVALID_EDGE_SOURCE' | 'E_APPLY_INVALID_EDGE_SCOPE' | 'E_APPLY_INVALID_SOURCE_HANDLE' | 'E_APPLY_INVALID_TARGET_HANDLE' | 'E_APPLY_INVALID_SUBBLOCK_FIELD' | 'E_APPLY_MISSING_REQUIRED_PARAMS' | 'E_APPLY_RETRY_NOT_SUPPORTED' | 'E_APPLY_DUPLICATE_TRIGGER' | 'E_APPLY_DUPLICATE_SINGLE_INSTANCE_BLOCK' | 'E_APPLY_DISABLED_ANCESTOR' | 'E_APPLY_CREDENTIAL_UNREACHABLE' | 'W_APPLY_CREDENTIAL_KEPT' | 'E_APPLY_SANDBOX_PLAN_REQUIRED' | 'W_APPLY_HOSTED_KEY_DROPPED' | 'W_APPLY_VALUE_NORMALIZED' | 'W_APPLY_TYPE_CHANGED' | 'W_APPLY_TRIGGER_REMOVED' | 'W_APPLY_CATALOG_MOVED' | 'W_APPLY_PROBABLE_RENAME' | 'E_APPLY_LINT' | 'W_APPLY_LINT' | 'W_TABLE_UNKNOWN_COLUMN' | 'E_APPLY_INVALID_SCHEDULE' | 'E_APPLY_BLOCK_DELETE' | 'E_WORKFLOW_META_INVALID';
870
+ severity: 'error' | 'warning' | 'info';
871
+ message: string;
872
+ hint?: string;
873
+ file?: string;
874
+ line?: number;
875
+ column?: number;
876
+ endLine?: number;
877
+ endColumn?: number;
878
+ frame?: string;
879
+ path?: string;
880
+ kind?: string;
881
+ key?: string;
882
+ blockKey?: string;
883
+ param?: string;
884
+ }>;
885
+ };
886
+ };
609
887
  /** `POST /api/v2/projects/[projectId]/files/archive` */
610
888
  export type ArchiveProjectFileItemsParams = {
611
889
  projectId: string;
@@ -3043,6 +3321,125 @@ type CreateWorkflowFolderResponseRef0 = {
3043
3321
  export type CreateWorkflowFolderResponse = {
3044
3322
  data: CreateWorkflowFolderResponseRef0;
3045
3323
  };
3324
+ /** `POST /api/v2/workspaces/[workspaceId]/workflows/source` */
3325
+ export type CreateWorkflowFromSourceParams = {
3326
+ workspaceId: string;
3327
+ };
3328
+ export type CreateWorkflowFromSourceQuery = {
3329
+ dryRun?: boolean;
3330
+ allowDelete?: boolean;
3331
+ };
3332
+ type CreateWorkflowFromSourceBodyRef0 = string;
3333
+ export type CreateWorkflowFromSourceBody = {
3334
+ files: Record<string, string>;
3335
+ name?: string;
3336
+ description?: string | null;
3337
+ folderPath?: CreateWorkflowFromSourceBodyRef0;
3338
+ provenance?: {
3339
+ client: 'cli' | 'copilot' | 'canvas' | 'api';
3340
+ gitSha?: string;
3341
+ repo?: string;
3342
+ };
3343
+ };
3344
+ export type CreateWorkflowFromSourceResponse = {
3345
+ data: {
3346
+ workflowId: string;
3347
+ workspaceId: string;
3348
+ dryRun: boolean;
3349
+ applied: boolean;
3350
+ diff: {
3351
+ noop: boolean;
3352
+ meta?: Array<'name' | 'description'>;
3353
+ blocks: {
3354
+ added: Array<{
3355
+ id: string;
3356
+ key: string;
3357
+ type: string;
3358
+ }>;
3359
+ removed: Array<{
3360
+ id: string;
3361
+ key: string;
3362
+ type: string;
3363
+ }>;
3364
+ renamed: Array<{
3365
+ id: string;
3366
+ from: string;
3367
+ to: string;
3368
+ }>;
3369
+ modified: Array<{
3370
+ id: string;
3371
+ key: string;
3372
+ fields: Array<string>;
3373
+ reparented?: boolean;
3374
+ }>;
3375
+ };
3376
+ edges: {
3377
+ added: number;
3378
+ removed: number;
3379
+ };
3380
+ variables: {
3381
+ added: Array<string>;
3382
+ removed: Array<string>;
3383
+ modified: Array<string>;
3384
+ };
3385
+ };
3386
+ diagnostics: Array<{
3387
+ code: 'E_SYNTAX' | 'E_SDK_HEADER' | 'E_SDK_MAJOR' | 'E_SDK_MAJOR_OLD' | 'E_UNSUPPORTED_SYNTAX' | 'E_WORKFLOW_EXPORT' | 'E_LIMIT_EXCEEDED' | 'E_INVALID_CHARACTER' | 'E_NUMBER_NOT_FINITE' | 'W_NUMBER_PRECISION' | 'E_TOO_MANY_ERRORS' | 'W_TOO_MANY_WARNINGS' | 'E_DUPLICATE_NAME' | 'E_RESERVED_NAME' | 'E_KEY_OVERRIDE' | 'E_EMPTY_NAME' | 'E_LOOKALIKE_NAME' | 'W_LOOKALIKE_NAME' | 'W_SUSPICIOUS_CHARACTER' | 'E_NAME_NOT_LITERAL' | 'E_UNKNOWN_IDENTIFIER' | 'E_OUT_OF_SCOPE' | 'E_UNKNOWN_VARIABLE' | 'E_DUPLICATE_VARIABLE' | 'E_VARIABLE_NAME_MISMATCH' | 'E_INVALID_ENV_NAME' | 'W_ENV_UNKNOWN' | 'W_CHILD_INPUT_UNKNOWN' | 'W_CHILD_NO_START' | 'E_UNKNOWN_SUBFLOW_PROPERTY' | 'W_FORWARD_REF' | 'W_REF_NOT_NORMALIZED' | 'E_REF_UNREPRESENTABLE' | 'E_EDGE_SCOPE' | 'E_EDGE_NOTE' | 'E_TARGET_TRIGGER' | 'E_NO_DEFAULT_OUTPUT' | 'E_DUPLICATE_EDGE' | 'E_ERROR_PORT_UNSUPPORTED' | 'W_ERROR_PORT_STORED' | 'E_UNKNOWN_BRANCH' | 'E_DUPLICATE_BRANCH_KEY' | 'E_BRANCH_KEY_COLLIDES' | 'E_BRANCH_ELSE_LAST' | 'W_RAW_HANDLE' | 'W_SUBFLOW_HANDLE_SCOPE' | 'E_EDGE_CYCLE' | 'W_EDGE_CYCLE' | 'W_BRANCH_UNWIRED' | 'E_UNKNOWN_BUILDER' | 'E_UNKNOWN_PARAM' | 'E_FIXED_PARAM' | 'W_FIELD_NOT_APPLICABLE' | 'W_REQUIRED_MISSING' | 'W_UNKNOWN_OPTION' | 'E_UNKNOWN_OPERATION' | 'W_UNKNOWN_MODEL' | 'W_LEGACY_BLOCK_TYPE' | 'I_SCHEDULE_UTC' | 'E_STORED_VALUE_MISSING' | 'W_VALUE_KIND' | 'W_OUT_OF_RANGE' | 'W_TABLE_FILTER_SHAPE' | 'W_LITERAL_SECRET' | 'W_SUBFLOW_COUNT' | 'W_UNKNOWN_OUTPUT_PATH' | 'W_JSON_REF_UNTYPED' | 'E_CODE_FILE_MISSING' | 'E_CODE_FILE_PATH' | 'W_CODE_FILE_INLINED' | 'W_UNRESOLVED_REF' | 'W_FORWARD_REF_LITERALIZED' | 'W_COMMENT_MOVED' | 'W_COMMENT_DROPPED' | 'E_LOCK_JSON' | 'E_LOCK_VERSION' | 'E_LOCK_SHAPE' | 'E_LOCK_UNKNOWN_FIELD' | 'E_LOCK_KEY' | 'E_LOCK_IDENT' | 'E_LOCK_DUPLICATE_IDENT' | 'E_LOCK_DUPLICATE_ID' | 'E_LOCK_PARENT' | 'E_LOCK_BRANCH' | 'E_LOCK_CODE_FILE_PATH' | 'E_SOURCE_META_JSON' | 'E_SOURCE_META_VERSION' | 'E_SOURCE_META_SHAPE' | 'E_SOURCE_META_UNKNOWN_FIELD' | 'E_SOURCE_META_IDENT' | 'E_SOURCE_META_DUPLICATE_IDENT' | 'E_SOURCE_META_ANCHOR' | 'E_CANON_LEGACY_NAME_COLLISION' | 'E_CANON_EDGE_SCOPE' | 'W_CANON_RESERVED_NAME' | 'W_CANON_DANGLING_EDGE' | 'W_CANON_DANGLING_PARENT' | 'W_CANON_RAW_HANDLE' | 'W_CANON_UNKNOWN_BLOCK_TYPE' | 'W_CANON_UNRESOLVED_ID' | 'W_CANON_TITLE_OVERRIDE' | 'W_CANON_SUBFLOW_REPAIRED' | 'W_CANON_SUBBLOCK_TYPE_DRIFT' | 'W_CANON_UNDECODABLE_JSON' | 'E_MAT_DUPLICATE_LOCK_ID' | 'E_MAT_UNKNOWN_RESOURCE' | 'E_MAT_UNKNOWN_VARIABLE' | 'W_MAT_DELETED_SINCE_PULL' | 'W_MAT_INFERRED_RENAME' | 'W_MAT_RETYPE_RECREATED' | 'W_MAT_LOCK_ID_CLAIMED' | 'I_MAT_NEEDS_LAYOUT' | 'E_APPLY_STALE' | 'E_APPLY_WORKFLOW_MISMATCH' | 'E_APPLY_LOCKED_BLOCK' | 'E_APPLY_TYPE_NOT_ADDABLE' | 'E_APPLY_INVALID_STATE' | 'E_APPLY_BLOCK_NOT_FOUND' | 'E_APPLY_INVALID_BLOCK_TYPE' | 'E_APPLY_BLOCK_NOT_ALLOWED' | 'E_APPLY_MODEL_NOT_ALLOWED' | 'E_APPLY_TOOL_NOT_ALLOWED' | 'E_APPLY_INVALID_EDGE_SOURCE' | 'E_APPLY_INVALID_EDGE_SCOPE' | 'E_APPLY_INVALID_SOURCE_HANDLE' | 'E_APPLY_INVALID_TARGET_HANDLE' | 'E_APPLY_INVALID_SUBBLOCK_FIELD' | 'E_APPLY_MISSING_REQUIRED_PARAMS' | 'E_APPLY_RETRY_NOT_SUPPORTED' | 'E_APPLY_DUPLICATE_TRIGGER' | 'E_APPLY_DUPLICATE_SINGLE_INSTANCE_BLOCK' | 'E_APPLY_DISABLED_ANCESTOR' | 'E_APPLY_CREDENTIAL_UNREACHABLE' | 'W_APPLY_CREDENTIAL_KEPT' | 'E_APPLY_SANDBOX_PLAN_REQUIRED' | 'W_APPLY_HOSTED_KEY_DROPPED' | 'W_APPLY_VALUE_NORMALIZED' | 'W_APPLY_TYPE_CHANGED' | 'W_APPLY_TRIGGER_REMOVED' | 'W_APPLY_CATALOG_MOVED' | 'W_APPLY_PROBABLE_RENAME' | 'E_APPLY_LINT' | 'W_APPLY_LINT' | 'W_TABLE_UNKNOWN_COLUMN' | 'E_APPLY_INVALID_SCHEDULE' | 'E_APPLY_BLOCK_DELETE' | 'E_NAME_TAKEN' | 'E_WORKFLOW_META_INVALID';
3388
+ severity: 'error' | 'warning' | 'info';
3389
+ message: string;
3390
+ hint?: string;
3391
+ blockKey?: string;
3392
+ param?: string;
3393
+ file?: string;
3394
+ line?: number;
3395
+ column?: number;
3396
+ endLine?: number;
3397
+ endColumn?: number;
3398
+ frame?: string;
3399
+ blockId?: string;
3400
+ path?: string;
3401
+ }>;
3402
+ files: Record<string, string>;
3403
+ lock: {
3404
+ version: 1;
3405
+ blocks: Record<string, {
3406
+ id: string;
3407
+ parent: string | null;
3408
+ branches?: Record<string, string>;
3409
+ items?: Record<string, Array<{
3410
+ name: string;
3411
+ id: string;
3412
+ }>>;
3413
+ ident: string;
3414
+ order: number;
3415
+ layout?: {
3416
+ x: number;
3417
+ y: number;
3418
+ w?: number;
3419
+ h?: number;
3420
+ height?: number;
3421
+ horizontalHandles?: boolean;
3422
+ [key: string]: unknown;
3423
+ };
3424
+ codeFile?: string;
3425
+ [key: string]: unknown;
3426
+ }>;
3427
+ variables: Record<string, string>;
3428
+ [key: string]: unknown;
3429
+ };
3430
+ base: {
3431
+ version: 1;
3432
+ workflowId: string;
3433
+ workspaceId: string;
3434
+ fingerprint: string;
3435
+ catalogHash: string;
3436
+ [key: string]: unknown;
3437
+ };
3438
+ mintedIds: Record<string, string>;
3439
+ notes: Array<string>;
3440
+ needsRedeployment: boolean;
3441
+ };
3442
+ };
3046
3443
  /** `POST /api/v2/workflow-mcp-servers` */
3047
3444
  export type CreateWorkflowMcpServerQuery = Record<string, never>;
3048
3445
  export type CreateWorkflowMcpServerBody = {
@@ -3962,6 +4359,16 @@ export type DownloadFileVersionQuery = {
3962
4359
  };
3963
4360
  /** Non-JSON response (`binary`). */
3964
4361
  export type DownloadFileVersionResponse = never;
4362
+ /** `GET /api/v2/knowledge/[knowledgeBaseId]/documents/[documentId]/content` */
4363
+ export type DownloadKnowledgeDocumentParams = {
4364
+ documentId: string;
4365
+ knowledgeBaseId: string;
4366
+ };
4367
+ export type DownloadKnowledgeDocumentQuery = {
4368
+ workspaceId: string;
4369
+ };
4370
+ /** Non-JSON response (`binary`). */
4371
+ export type DownloadKnowledgeDocumentResponse = never;
3965
4372
  /** `GET /api/v2/projects/[projectId]/files/bulk-download` */
3966
4373
  export type DownloadProjectFileItemsParams = {
3967
4374
  projectId: string;
@@ -4207,6 +4614,23 @@ type ExportWorkflowResponseRef0 = {
4207
4614
  export type ExportWorkflowResponse = {
4208
4615
  data: ExportWorkflowResponseRef0;
4209
4616
  };
4617
+ /** `POST /api/v2/workspaces/[workspaceId]/source/blobs/missing` */
4618
+ export type FindMissingWorkspaceSourceBlobsParams = {
4619
+ workspaceId: string;
4620
+ };
4621
+ export type FindMissingWorkspaceSourceBlobsQuery = Record<string, never>;
4622
+ export type FindMissingWorkspaceSourceBlobsBody = {
4623
+ blobs: Array<{
4624
+ sha256: string;
4625
+ size: number;
4626
+ }>;
4627
+ };
4628
+ export type FindMissingWorkspaceSourceBlobsResponse = {
4629
+ data: {
4630
+ workspaceId: string;
4631
+ missing: Array<string>;
4632
+ };
4633
+ };
4210
4634
  /** `POST /api/v2/workspaces/[workspaceId]/fork` */
4211
4635
  export type ForkWorkspaceParams = {
4212
4636
  workspaceId: string;
@@ -5536,6 +5960,496 @@ type GetSkillResponseRef0 = {
5536
5960
  export type GetSkillResponse = {
5537
5961
  data: GetSkillResponseRef0;
5538
5962
  };
5963
+ /** `GET /api/v2/workspaces/[workspaceId]/workflows/source/catalog` */
5964
+ export type GetSourceCatalogParams = {
5965
+ workspaceId: string;
5966
+ };
5967
+ export type GetSourceCatalogQuery = {
5968
+ workflowId?: string;
5969
+ };
5970
+ export type GetSourceCatalogHeaders = {
5971
+ 'if-none-match'?: string;
5972
+ };
5973
+ export type GetSourceCatalogResponse = {
5974
+ data: {
5975
+ catalogVersion: 1;
5976
+ hash: string;
5977
+ sdkMajor: number;
5978
+ blocks: Record<string, {
5979
+ type: string;
5980
+ name: string;
5981
+ category: 'blocks' | 'tools' | 'triggers';
5982
+ addable?: false;
5983
+ lifecycle?: {
5984
+ hidden?: true;
5985
+ preview?: true;
5986
+ sunset?: {
5987
+ status: 'legacy' | 'deprecated';
5988
+ replacedBy?: string;
5989
+ };
5990
+ };
5991
+ triggerAllowed?: boolean;
5992
+ triggers?: {
5993
+ enabled: boolean;
5994
+ available: Array<string>;
5995
+ };
5996
+ singleInstance?: boolean;
5997
+ subBlocks: Array<{
5998
+ id: string;
5999
+ type: string;
6000
+ title?: string;
6001
+ mode?: 'basic' | 'advanced' | 'both' | 'trigger' | 'trigger-advanced';
6002
+ canonicalParamId?: string;
6003
+ surface?: 'action' | 'trigger';
6004
+ condition?: {
6005
+ field: string;
6006
+ value: string | number | boolean | Array<string | number | boolean> | {
6007
+ list: number;
6008
+ };
6009
+ not?: boolean;
6010
+ and?: {
6011
+ field: string;
6012
+ value?: string | number | boolean | Array<string | number | boolean> | {
6013
+ list: number;
6014
+ };
6015
+ not?: boolean;
6016
+ };
6017
+ } | {
6018
+ opaque: true;
6019
+ };
6020
+ visibleFor?: Record<string, boolean>;
6021
+ visibleWhen?: Record<string, {
6022
+ field: string;
6023
+ value: string | number | boolean | Array<string | number | boolean> | {
6024
+ list: number;
6025
+ };
6026
+ not?: boolean;
6027
+ and?: {
6028
+ field: string;
6029
+ value?: string | number | boolean | Array<string | number | boolean> | {
6030
+ list: number;
6031
+ };
6032
+ not?: boolean;
6033
+ };
6034
+ }>;
6035
+ visibleForModel?: Record<string, boolean>;
6036
+ required?: boolean | {
6037
+ field: string;
6038
+ value: string | number | boolean | Array<string | number | boolean> | {
6039
+ list: number;
6040
+ };
6041
+ not?: boolean;
6042
+ and?: {
6043
+ field: string;
6044
+ value?: string | number | boolean | Array<string | number | boolean> | {
6045
+ list: number;
6046
+ };
6047
+ not?: boolean;
6048
+ };
6049
+ } | {
6050
+ opaque: true;
6051
+ };
6052
+ dependsOn?: {
6053
+ all: Array<string>;
6054
+ any: Array<string>;
6055
+ };
6056
+ defaultValue?: unknown;
6057
+ valueDefault?: {
6058
+ computed: true;
6059
+ initial?: unknown;
6060
+ } | {
6061
+ constant: unknown;
6062
+ };
6063
+ options?: Array<{
6064
+ id: string;
6065
+ label?: string;
6066
+ }> | {
6067
+ dynamic: true;
6068
+ } | {
6069
+ opaque: true;
6070
+ };
6071
+ hidden?: boolean;
6072
+ readOnly?: boolean;
6073
+ password?: boolean;
6074
+ hideFromCopilot?: boolean;
6075
+ context?: 'tool-input';
6076
+ paramVisibility?: string;
6077
+ emptyIsValid?: boolean;
6078
+ language?: string;
6079
+ multiple?: boolean;
6080
+ min?: number;
6081
+ max?: number;
6082
+ step?: number;
6083
+ integer?: boolean;
6084
+ columns?: Array<string>;
6085
+ selectorKey?: string;
6086
+ serviceId?: string;
6087
+ credentialProviders?: Array<string>;
6088
+ valueKind: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'json' | 'code' | 'branches' | 'tools' | 'resource' | 'picked' | 'upload' | 'none';
6089
+ resourceKind?: string;
6090
+ storage: 'native' | 'json-string';
6091
+ structured?: 'tools' | 'branches' | 'tableRows' | 'inputFormat' | 'variables' | 'skills';
6092
+ acceptsNumber?: boolean;
6093
+ neverDecoded?: boolean;
6094
+ tableFilter?: boolean;
6095
+ valueShape?: 'number' | 'boolean' | 'json';
6096
+ } | {
6097
+ shared: number;
6098
+ } | {
6099
+ trigger: string;
6100
+ start: number;
6101
+ count: number;
6102
+ }>;
6103
+ tools: {
6104
+ access: Array<string>;
6105
+ selector: 'single' | 'operation' | 'opaque';
6106
+ };
6107
+ outputs?: Record<string, {
6108
+ type: string;
6109
+ description?: string;
6110
+ condition?: unknown;
6111
+ hiddenFromDisplay?: boolean;
6112
+ properties?: Record<string, unknown>;
6113
+ sharedProperties?: number;
6114
+ items?: unknown;
6115
+ }>;
6116
+ sharedOutputs?: number;
6117
+ operationOutputs?: Record<string, {
6118
+ names: Array<string>;
6119
+ nullable?: Array<string>;
6120
+ }>;
6121
+ dynamicOutputs?: {
6122
+ source: 'responseFormat' | 'inputFormat' | 'humanForm' | 'tableRows';
6123
+ param: string;
6124
+ };
6125
+ graph: {
6126
+ canBeTarget: boolean;
6127
+ errorPort: boolean;
6128
+ container: 'loop' | 'parallel' | null;
6129
+ annotationOnly: boolean;
6130
+ branches?: {
6131
+ subBlockId: string;
6132
+ kind: 'condition' | 'router';
6133
+ };
6134
+ };
6135
+ legacyIds?: Array<{
6136
+ from: string;
6137
+ to: string | null;
6138
+ whenOperation?: Array<string>;
6139
+ conditional?: true;
6140
+ }>;
6141
+ legacyCanonicalIds?: Array<{
6142
+ from: string;
6143
+ to: string;
6144
+ }>;
6145
+ paramAliases?: {
6146
+ action?: Record<string, string>;
6147
+ trigger?: Record<string, string>;
6148
+ };
6149
+ custom?: {
6150
+ sourceWorkflowId?: string;
6151
+ };
6152
+ }>;
6153
+ triggers: Record<string, {
6154
+ id: string;
6155
+ provider: string;
6156
+ name: string;
6157
+ polling?: boolean;
6158
+ webhook?: boolean;
6159
+ subBlocks: Array<{
6160
+ id: string;
6161
+ type: string;
6162
+ title?: string;
6163
+ mode?: 'basic' | 'advanced' | 'both' | 'trigger' | 'trigger-advanced';
6164
+ canonicalParamId?: string;
6165
+ surface?: 'action' | 'trigger';
6166
+ condition?: {
6167
+ field: string;
6168
+ value: string | number | boolean | Array<string | number | boolean> | {
6169
+ list: number;
6170
+ };
6171
+ not?: boolean;
6172
+ and?: {
6173
+ field: string;
6174
+ value?: string | number | boolean | Array<string | number | boolean> | {
6175
+ list: number;
6176
+ };
6177
+ not?: boolean;
6178
+ };
6179
+ } | {
6180
+ opaque: true;
6181
+ };
6182
+ visibleFor?: Record<string, boolean>;
6183
+ visibleWhen?: Record<string, {
6184
+ field: string;
6185
+ value: string | number | boolean | Array<string | number | boolean> | {
6186
+ list: number;
6187
+ };
6188
+ not?: boolean;
6189
+ and?: {
6190
+ field: string;
6191
+ value?: string | number | boolean | Array<string | number | boolean> | {
6192
+ list: number;
6193
+ };
6194
+ not?: boolean;
6195
+ };
6196
+ }>;
6197
+ visibleForModel?: Record<string, boolean>;
6198
+ required?: boolean | {
6199
+ field: string;
6200
+ value: string | number | boolean | Array<string | number | boolean> | {
6201
+ list: number;
6202
+ };
6203
+ not?: boolean;
6204
+ and?: {
6205
+ field: string;
6206
+ value?: string | number | boolean | Array<string | number | boolean> | {
6207
+ list: number;
6208
+ };
6209
+ not?: boolean;
6210
+ };
6211
+ } | {
6212
+ opaque: true;
6213
+ };
6214
+ dependsOn?: {
6215
+ all: Array<string>;
6216
+ any: Array<string>;
6217
+ };
6218
+ defaultValue?: unknown;
6219
+ valueDefault?: {
6220
+ computed: true;
6221
+ initial?: unknown;
6222
+ } | {
6223
+ constant: unknown;
6224
+ };
6225
+ options?: Array<{
6226
+ id: string;
6227
+ label?: string;
6228
+ }> | {
6229
+ dynamic: true;
6230
+ } | {
6231
+ opaque: true;
6232
+ };
6233
+ hidden?: boolean;
6234
+ readOnly?: boolean;
6235
+ password?: boolean;
6236
+ hideFromCopilot?: boolean;
6237
+ context?: 'tool-input';
6238
+ paramVisibility?: string;
6239
+ emptyIsValid?: boolean;
6240
+ language?: string;
6241
+ multiple?: boolean;
6242
+ min?: number;
6243
+ max?: number;
6244
+ step?: number;
6245
+ integer?: boolean;
6246
+ columns?: Array<string>;
6247
+ selectorKey?: string;
6248
+ serviceId?: string;
6249
+ credentialProviders?: Array<string>;
6250
+ valueKind: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'json' | 'code' | 'branches' | 'tools' | 'resource' | 'picked' | 'upload' | 'none';
6251
+ resourceKind?: string;
6252
+ storage: 'native' | 'json-string';
6253
+ structured?: 'tools' | 'branches' | 'tableRows' | 'inputFormat' | 'variables' | 'skills';
6254
+ acceptsNumber?: boolean;
6255
+ neverDecoded?: boolean;
6256
+ tableFilter?: boolean;
6257
+ valueShape?: 'number' | 'boolean' | 'json';
6258
+ } | {
6259
+ shared: number;
6260
+ }>;
6261
+ outputs?: Record<string, {
6262
+ type: string;
6263
+ description?: string;
6264
+ condition?: unknown;
6265
+ hiddenFromDisplay?: boolean;
6266
+ properties?: Record<string, unknown>;
6267
+ sharedProperties?: number;
6268
+ items?: unknown;
6269
+ }>;
6270
+ sharedOutputs?: number;
6271
+ }>;
6272
+ builders: Record<string, {
6273
+ type: string;
6274
+ operation?: string;
6275
+ triggerMode?: boolean;
6276
+ fixed?: Record<string, string>;
6277
+ }>;
6278
+ subBlocks?: Array<{
6279
+ id: string;
6280
+ type: string;
6281
+ title?: string;
6282
+ mode?: 'basic' | 'advanced' | 'both' | 'trigger' | 'trigger-advanced';
6283
+ canonicalParamId?: string;
6284
+ surface?: 'action' | 'trigger';
6285
+ condition?: {
6286
+ field: string;
6287
+ value: string | number | boolean | Array<string | number | boolean> | {
6288
+ list: number;
6289
+ };
6290
+ not?: boolean;
6291
+ and?: {
6292
+ field: string;
6293
+ value?: string | number | boolean | Array<string | number | boolean> | {
6294
+ list: number;
6295
+ };
6296
+ not?: boolean;
6297
+ };
6298
+ } | {
6299
+ opaque: true;
6300
+ };
6301
+ visibleFor?: Record<string, boolean>;
6302
+ visibleWhen?: Record<string, {
6303
+ field: string;
6304
+ value: string | number | boolean | Array<string | number | boolean> | {
6305
+ list: number;
6306
+ };
6307
+ not?: boolean;
6308
+ and?: {
6309
+ field: string;
6310
+ value?: string | number | boolean | Array<string | number | boolean> | {
6311
+ list: number;
6312
+ };
6313
+ not?: boolean;
6314
+ };
6315
+ }>;
6316
+ visibleForModel?: Record<string, boolean>;
6317
+ required?: boolean | {
6318
+ field: string;
6319
+ value: string | number | boolean | Array<string | number | boolean> | {
6320
+ list: number;
6321
+ };
6322
+ not?: boolean;
6323
+ and?: {
6324
+ field: string;
6325
+ value?: string | number | boolean | Array<string | number | boolean> | {
6326
+ list: number;
6327
+ };
6328
+ not?: boolean;
6329
+ };
6330
+ } | {
6331
+ opaque: true;
6332
+ };
6333
+ dependsOn?: {
6334
+ all: Array<string>;
6335
+ any: Array<string>;
6336
+ };
6337
+ defaultValue?: unknown;
6338
+ valueDefault?: {
6339
+ computed: true;
6340
+ initial?: unknown;
6341
+ } | {
6342
+ constant: unknown;
6343
+ };
6344
+ options?: Array<{
6345
+ id: string;
6346
+ label?: string;
6347
+ }> | {
6348
+ dynamic: true;
6349
+ } | {
6350
+ opaque: true;
6351
+ };
6352
+ hidden?: boolean;
6353
+ readOnly?: boolean;
6354
+ password?: boolean;
6355
+ hideFromCopilot?: boolean;
6356
+ context?: 'tool-input';
6357
+ paramVisibility?: string;
6358
+ emptyIsValid?: boolean;
6359
+ language?: string;
6360
+ multiple?: boolean;
6361
+ min?: number;
6362
+ max?: number;
6363
+ step?: number;
6364
+ integer?: boolean;
6365
+ columns?: Array<string>;
6366
+ selectorKey?: string;
6367
+ serviceId?: string;
6368
+ credentialProviders?: Array<string>;
6369
+ valueKind: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'json' | 'code' | 'branches' | 'tools' | 'resource' | 'picked' | 'upload' | 'none';
6370
+ resourceKind?: string;
6371
+ storage: 'native' | 'json-string';
6372
+ structured?: 'tools' | 'branches' | 'tableRows' | 'inputFormat' | 'variables' | 'skills';
6373
+ acceptsNumber?: boolean;
6374
+ neverDecoded?: boolean;
6375
+ tableFilter?: boolean;
6376
+ valueShape?: 'number' | 'boolean' | 'json';
6377
+ }>;
6378
+ lists?: Array<Array<string | number | boolean>>;
6379
+ outputs?: Array<Record<string, {
6380
+ type: string;
6381
+ description?: string;
6382
+ condition?: unknown;
6383
+ hiddenFromDisplay?: boolean;
6384
+ properties?: Record<string, unknown>;
6385
+ sharedProperties?: number;
6386
+ items?: unknown;
6387
+ }>>;
6388
+ scope?: {
6389
+ organizationId: string;
6390
+ };
6391
+ };
6392
+ };
6393
+ /** `GET /api/v2/workspaces/[workspaceId]/workflows/source/resources` */
6394
+ export type GetSourceResourcesParams = {
6395
+ workspaceId: string;
6396
+ };
6397
+ export type GetSourceResourcesQuery = Record<string, never>;
6398
+ export type GetSourceResourcesResponse = {
6399
+ data: {
6400
+ workspaceId: string;
6401
+ tables: Array<{
6402
+ key: string;
6403
+ id: string;
6404
+ name: string;
6405
+ columns: Array<{
6406
+ name: string;
6407
+ type: 'string' | 'number' | 'currency' | 'boolean' | 'date' | 'ttl' | 'json' | 'select';
6408
+ options?: Array<string>;
6409
+ multiple?: boolean;
6410
+ required?: boolean;
6411
+ }>;
6412
+ }>;
6413
+ knowledgeBases: Array<{
6414
+ key: string;
6415
+ id: string;
6416
+ name: string;
6417
+ }>;
6418
+ credentials: Array<{
6419
+ key: string;
6420
+ id: string;
6421
+ name: string;
6422
+ provider: string;
6423
+ }>;
6424
+ workflows: Array<{
6425
+ key: string;
6426
+ id: string;
6427
+ name: string;
6428
+ inputs: Array<{
6429
+ name: string;
6430
+ type: string;
6431
+ }>;
6432
+ }>;
6433
+ skills: Array<{
6434
+ key: string;
6435
+ id: string;
6436
+ name: string;
6437
+ }>;
6438
+ customTools: Array<{
6439
+ key: string;
6440
+ id: string;
6441
+ name: string;
6442
+ }>;
6443
+ mcpServers: Array<{
6444
+ key: string;
6445
+ id: string;
6446
+ name: string;
6447
+ tools?: Array<string>;
6448
+ }>;
6449
+ env: Array<string>;
6450
+ truncated: boolean;
6451
+ };
6452
+ };
5539
6453
  /** `GET /api/v2/organizations/[organizationId]/sso/policy` */
5540
6454
  export type GetSsoPolicyParams = {
5541
6455
  organizationId: string;
@@ -6094,6 +7008,66 @@ type GetWorkflowRunResponseRef4 = {
6094
7008
  export type GetWorkflowRunResponse = {
6095
7009
  data: GetWorkflowRunResponseRef4;
6096
7010
  };
7011
+ /** `GET /api/v2/workflows/[workflowId]/source` */
7012
+ export type GetWorkflowSourceParams = {
7013
+ workflowId: string;
7014
+ };
7015
+ export type GetWorkflowSourceQuery = {
7016
+ functionCode?: 'inline' | 'files';
7017
+ };
7018
+ export type GetWorkflowSourceResponse = {
7019
+ data: {
7020
+ workflowId: string;
7021
+ workspaceId: string;
7022
+ files: Record<string, string>;
7023
+ lock: {
7024
+ version: 1;
7025
+ blocks: Record<string, {
7026
+ id: string;
7027
+ parent: string | null;
7028
+ branches?: Record<string, string>;
7029
+ items?: Record<string, Array<{
7030
+ name: string;
7031
+ id: string;
7032
+ }>>;
7033
+ ident: string;
7034
+ order: number;
7035
+ layout?: {
7036
+ x: number;
7037
+ y: number;
7038
+ w?: number;
7039
+ h?: number;
7040
+ height?: number;
7041
+ horizontalHandles?: boolean;
7042
+ [key: string]: unknown;
7043
+ };
7044
+ codeFile?: string;
7045
+ [key: string]: unknown;
7046
+ }>;
7047
+ variables: Record<string, string>;
7048
+ [key: string]: unknown;
7049
+ };
7050
+ base: {
7051
+ version: 1;
7052
+ workflowId: string;
7053
+ workspaceId: string;
7054
+ fingerprint: string;
7055
+ catalogHash: string;
7056
+ [key: string]: unknown;
7057
+ };
7058
+ canonicalHash: string;
7059
+ sdkMajor: number;
7060
+ blockTypes: Array<string>;
7061
+ diagnostics: Array<{
7062
+ code: 'E_SYNTAX' | 'E_SDK_HEADER' | 'E_SDK_MAJOR' | 'E_SDK_MAJOR_OLD' | 'E_UNSUPPORTED_SYNTAX' | 'E_WORKFLOW_EXPORT' | 'E_LIMIT_EXCEEDED' | 'E_INVALID_CHARACTER' | 'E_NUMBER_NOT_FINITE' | 'W_NUMBER_PRECISION' | 'E_TOO_MANY_ERRORS' | 'W_TOO_MANY_WARNINGS' | 'E_DUPLICATE_NAME' | 'E_RESERVED_NAME' | 'E_KEY_OVERRIDE' | 'E_EMPTY_NAME' | 'E_LOOKALIKE_NAME' | 'W_LOOKALIKE_NAME' | 'W_SUSPICIOUS_CHARACTER' | 'E_NAME_NOT_LITERAL' | 'E_UNKNOWN_IDENTIFIER' | 'E_OUT_OF_SCOPE' | 'E_UNKNOWN_VARIABLE' | 'E_DUPLICATE_VARIABLE' | 'E_VARIABLE_NAME_MISMATCH' | 'E_INVALID_ENV_NAME' | 'W_ENV_UNKNOWN' | 'W_CHILD_INPUT_UNKNOWN' | 'W_CHILD_NO_START' | 'E_UNKNOWN_SUBFLOW_PROPERTY' | 'W_FORWARD_REF' | 'W_REF_NOT_NORMALIZED' | 'E_REF_UNREPRESENTABLE' | 'E_EDGE_SCOPE' | 'E_EDGE_NOTE' | 'E_TARGET_TRIGGER' | 'E_NO_DEFAULT_OUTPUT' | 'E_DUPLICATE_EDGE' | 'E_ERROR_PORT_UNSUPPORTED' | 'W_ERROR_PORT_STORED' | 'E_UNKNOWN_BRANCH' | 'E_DUPLICATE_BRANCH_KEY' | 'E_BRANCH_KEY_COLLIDES' | 'E_BRANCH_ELSE_LAST' | 'W_RAW_HANDLE' | 'W_SUBFLOW_HANDLE_SCOPE' | 'E_EDGE_CYCLE' | 'W_EDGE_CYCLE' | 'W_BRANCH_UNWIRED' | 'E_UNKNOWN_BUILDER' | 'E_UNKNOWN_PARAM' | 'E_FIXED_PARAM' | 'W_FIELD_NOT_APPLICABLE' | 'W_REQUIRED_MISSING' | 'W_UNKNOWN_OPTION' | 'E_UNKNOWN_OPERATION' | 'W_UNKNOWN_MODEL' | 'W_LEGACY_BLOCK_TYPE' | 'I_SCHEDULE_UTC' | 'E_STORED_VALUE_MISSING' | 'W_VALUE_KIND' | 'W_OUT_OF_RANGE' | 'W_TABLE_FILTER_SHAPE' | 'W_LITERAL_SECRET' | 'W_SUBFLOW_COUNT' | 'W_UNKNOWN_OUTPUT_PATH' | 'W_JSON_REF_UNTYPED' | 'E_CODE_FILE_MISSING' | 'E_CODE_FILE_PATH' | 'W_CODE_FILE_INLINED' | 'W_UNRESOLVED_REF' | 'W_FORWARD_REF_LITERALIZED' | 'W_COMMENT_MOVED' | 'W_COMMENT_DROPPED' | 'E_LOCK_JSON' | 'E_LOCK_VERSION' | 'E_LOCK_SHAPE' | 'E_LOCK_UNKNOWN_FIELD' | 'E_LOCK_KEY' | 'E_LOCK_IDENT' | 'E_LOCK_DUPLICATE_IDENT' | 'E_LOCK_DUPLICATE_ID' | 'E_LOCK_PARENT' | 'E_LOCK_BRANCH' | 'E_LOCK_CODE_FILE_PATH' | 'E_SOURCE_META_JSON' | 'E_SOURCE_META_VERSION' | 'E_SOURCE_META_SHAPE' | 'E_SOURCE_META_UNKNOWN_FIELD' | 'E_SOURCE_META_IDENT' | 'E_SOURCE_META_DUPLICATE_IDENT' | 'E_SOURCE_META_ANCHOR' | 'E_CANON_LEGACY_NAME_COLLISION' | 'E_CANON_EDGE_SCOPE' | 'W_CANON_RESERVED_NAME' | 'W_CANON_DANGLING_EDGE' | 'W_CANON_DANGLING_PARENT' | 'W_CANON_RAW_HANDLE' | 'W_CANON_UNKNOWN_BLOCK_TYPE' | 'W_CANON_UNRESOLVED_ID' | 'W_CANON_TITLE_OVERRIDE' | 'W_CANON_SUBFLOW_REPAIRED' | 'W_CANON_SUBBLOCK_TYPE_DRIFT' | 'W_CANON_UNDECODABLE_JSON' | 'E_MAT_DUPLICATE_LOCK_ID' | 'E_MAT_UNKNOWN_RESOURCE' | 'E_MAT_UNKNOWN_VARIABLE' | 'W_MAT_DELETED_SINCE_PULL' | 'W_MAT_INFERRED_RENAME' | 'W_MAT_RETYPE_RECREATED' | 'W_MAT_LOCK_ID_CLAIMED' | 'I_MAT_NEEDS_LAYOUT' | 'E_APPLY_STALE' | 'E_APPLY_WORKFLOW_MISMATCH' | 'E_APPLY_LOCKED_BLOCK' | 'E_APPLY_TYPE_NOT_ADDABLE' | 'E_APPLY_INVALID_STATE' | 'E_APPLY_BLOCK_NOT_FOUND' | 'E_APPLY_INVALID_BLOCK_TYPE' | 'E_APPLY_BLOCK_NOT_ALLOWED' | 'E_APPLY_MODEL_NOT_ALLOWED' | 'E_APPLY_TOOL_NOT_ALLOWED' | 'E_APPLY_INVALID_EDGE_SOURCE' | 'E_APPLY_INVALID_EDGE_SCOPE' | 'E_APPLY_INVALID_SOURCE_HANDLE' | 'E_APPLY_INVALID_TARGET_HANDLE' | 'E_APPLY_INVALID_SUBBLOCK_FIELD' | 'E_APPLY_MISSING_REQUIRED_PARAMS' | 'E_APPLY_RETRY_NOT_SUPPORTED' | 'E_APPLY_DUPLICATE_TRIGGER' | 'E_APPLY_DUPLICATE_SINGLE_INSTANCE_BLOCK' | 'E_APPLY_DISABLED_ANCESTOR' | 'E_APPLY_CREDENTIAL_UNREACHABLE' | 'W_APPLY_CREDENTIAL_KEPT' | 'E_APPLY_SANDBOX_PLAN_REQUIRED' | 'W_APPLY_HOSTED_KEY_DROPPED' | 'W_APPLY_VALUE_NORMALIZED' | 'W_APPLY_TYPE_CHANGED' | 'W_APPLY_TRIGGER_REMOVED' | 'W_APPLY_CATALOG_MOVED' | 'W_APPLY_PROBABLE_RENAME' | 'E_APPLY_LINT' | 'W_APPLY_LINT' | 'W_TABLE_UNKNOWN_COLUMN' | 'E_APPLY_INVALID_SCHEDULE' | 'E_APPLY_BLOCK_DELETE' | 'E_NAME_TAKEN' | 'E_WORKFLOW_META_INVALID';
7063
+ severity: 'error' | 'warning' | 'info';
7064
+ message: string;
7065
+ hint?: string;
7066
+ blockKey?: string;
7067
+ param?: string;
7068
+ }>;
7069
+ };
7070
+ };
6097
7071
  /** `GET /api/v2/workflows/[workflowId]/state` */
6098
7072
  export type GetWorkflowStateParams = {
6099
7073
  workflowId: string;
@@ -6383,6 +7357,74 @@ type GetWorkspacePermissionConfigResponseRef0 = {
6383
7357
  export type GetWorkspacePermissionConfigResponse = {
6384
7358
  data: GetWorkspacePermissionConfigResponseRef0;
6385
7359
  };
7360
+ /** `GET /api/v2/workspaces/[workspaceId]/source` */
7361
+ export type GetWorkspaceSourceParams = {
7362
+ workspaceId: string;
7363
+ };
7364
+ export type GetWorkspaceSourceQuery = {
7365
+ kinds?: string;
7366
+ };
7367
+ export type GetWorkspaceSourceResponse = {
7368
+ data: {
7369
+ workspaceId: string;
7370
+ kinds: Array<'secret' | 'credential' | 'custom-tool' | 'skill' | 'mcp-server' | 'table' | 'knowledge-base' | 'file' | 'workflow' | 'deployment'>;
7371
+ files: Record<string, string>;
7372
+ blobs: Array<{
7373
+ path: string;
7374
+ sha256?: string;
7375
+ size: number;
7376
+ id: string;
7377
+ href: string;
7378
+ rev?: string;
7379
+ }>;
7380
+ base: {
7381
+ version: 1;
7382
+ workspaceId: string;
7383
+ resources: Record<string, {
7384
+ id: string;
7385
+ fingerprint?: string;
7386
+ columns?: Record<string, {
7387
+ id: string;
7388
+ options?: Record<string, string>;
7389
+ }>;
7390
+ blobs?: Record<string, {
7391
+ id: string;
7392
+ rev: number | string;
7393
+ sha256: string;
7394
+ }>;
7395
+ rows?: {
7396
+ fingerprint: string;
7397
+ version: number;
7398
+ [key: string]: unknown;
7399
+ };
7400
+ [key: string]: unknown;
7401
+ }>;
7402
+ [key: string]: unknown;
7403
+ };
7404
+ skipped: Array<{
7405
+ kind: 'secret' | 'credential' | 'custom-tool' | 'skill' | 'mcp-server' | 'table' | 'knowledge-base' | 'file' | 'workflow' | 'deployment';
7406
+ key: string;
7407
+ reason: string;
7408
+ }>;
7409
+ diagnostics: Array<{
7410
+ code: 'E_DECL_SYNTAX' | 'E_DECL_HEADER' | 'E_DECL_IMPORT' | 'E_DECL_EXPORT' | 'E_DECL_UNSUPPORTED' | 'E_DECL_DUPLICATE_KEY' | 'E_DECL_SHAPE' | 'E_DECL_UNKNOWN_FIELD' | 'E_DECL_UNKNOWN_FILE' | 'W_PATH_NOT_SENT' | 'E_BLOB_MANIFEST' | 'E_BLOB_MISSING' | 'E_LIMIT_EXCEEDED' | 'E_KEY_INVALID' | 'W_DECL_SUSPICIOUS_CHARACTER' | 'E_BASE_JSON' | 'E_BASE_VERSION' | 'E_BASE_SHAPE' | 'E_BASE_UNKNOWN_FIELD' | 'E_SECRET_NAME' | 'E_SECRET_MISSING' | 'W_SECRET_MISSING' | 'E_CREDENTIAL_MISSING' | 'E_CREDENTIAL_AMBIGUOUS' | 'W_CREDENTIAL_MISSING' | 'W_CREDENTIAL_AMBIGUOUS' | 'E_TABLE_COLUMN_NAME' | 'E_TABLE_DUPLICATE_COLUMN' | 'E_TABLE_TOO_MANY_COLUMNS' | 'E_TABLE_OPTIONS' | 'E_TABLE_TYPE_CONVERSION' | 'E_TABLE_FOLDER' | 'E_TABLE_ROWS' | 'I_TABLE_SEED_SKIPPED' | 'I_TABLE_ROWS_UNKEYED' | 'W_LIKELY_RENAME' | 'E_TOOL_SCHEMA' | 'E_TOOL_CODE' | 'E_TOOL_STORED_MISSING' | 'W_TOOL_LITERAL_SECRET' | 'E_SKILL_FRONTMATTER' | 'E_MCP_LITERAL_SECRET' | 'E_MCP_STORED_MISSING' | 'E_MCP_TOOL_UNKNOWN' | 'W_MCP_REPLACE' | 'W_MCP_TOOLS_UNCHECKED' | 'E_FILE_PATH' | 'E_FILE_PATH_COLLISION' | 'E_FILE_NAME' | 'E_FILE_TOO_LARGE' | 'E_FILE_CONTENT' | 'E_KB_EMBEDDING_IMMUTABLE' | 'E_KB_EMBEDDING_MODEL' | 'E_KB_DOC_AMBIGUOUS' | 'E_KB_DOC_NAME' | 'E_KB_DOC_EMPTY' | 'E_KB_CHUNKING' | 'E_KB_FOLDER' | 'W_KB_DOC_UNCHECKED' | 'W_KB_DOC_FAILED' | 'I_KB_REEMBED' | 'I_KB_CHUNKING' | 'I_KB_PROCESSING' | 'I_KB_DOCS_UNHASHED' | 'I_KB_UNMANAGED_DOCS' | 'I_KB_REPLACE_UNFINISHED' | 'E_DEPLOY_WORKFLOW' | 'E_DEPLOY_SECRET' | 'E_DEPLOY_CHAT_OUTPUT' | 'E_DEPLOY_CHAT_IDENTIFIER' | 'E_DEPLOY_PINNED_CHAT' | 'W_DEPLOYED_DRAFT_CHANGED' | 'I_DEPLOY_DRAFT_NOT_LIVE' | 'E_APPLY_STALE' | 'E_APPLY_NO_BASE' | 'E_APPLY_FORBIDDEN' | 'E_APPLY_DELETE_NOT_ALLOWED' | 'E_APPLY_LOCKED' | 'E_APPLY_REFUSED' | 'E_APPLY_FAILED' | 'E_PLAN_TOO_LARGE' | 'E_PLAN_REF_DELETED' | 'E_PLAN_REF_HELD' | 'W_RESOURCE_IN_USE' | 'W_TABLE_COLUMN_RENAMED_IN_USE' | 'E_NAME_TAKEN' | 'E_WORKFLOW_FILES_MISSING' | 'E_WORKFLOW_FOLDER_COPIED' | 'W_UNDECLARED' | 'W_BASE_OTHER_WORKSPACE' | 'I_SERVER_CHANGED' | 'I_SERVER_DELETED' | 'I_SERVER_MOVED' | 'I_KEY_REBOUND' | 'E_KEY_RENAMED' | 'I_FINDINGS_TRUNCATED' | 'E_SYNTAX' | 'E_SDK_HEADER' | 'E_SDK_MAJOR' | 'E_SDK_MAJOR_OLD' | 'E_UNSUPPORTED_SYNTAX' | 'E_WORKFLOW_EXPORT' | 'E_INVALID_CHARACTER' | 'E_NUMBER_NOT_FINITE' | 'W_NUMBER_PRECISION' | 'E_TOO_MANY_ERRORS' | 'W_TOO_MANY_WARNINGS' | 'E_DUPLICATE_NAME' | 'E_RESERVED_NAME' | 'E_KEY_OVERRIDE' | 'E_EMPTY_NAME' | 'E_LOOKALIKE_NAME' | 'W_LOOKALIKE_NAME' | 'W_SUSPICIOUS_CHARACTER' | 'E_NAME_NOT_LITERAL' | 'E_UNKNOWN_IDENTIFIER' | 'E_OUT_OF_SCOPE' | 'E_UNKNOWN_VARIABLE' | 'E_DUPLICATE_VARIABLE' | 'E_VARIABLE_NAME_MISMATCH' | 'E_INVALID_ENV_NAME' | 'W_ENV_UNKNOWN' | 'W_CHILD_INPUT_UNKNOWN' | 'W_CHILD_NO_START' | 'E_UNKNOWN_SUBFLOW_PROPERTY' | 'W_FORWARD_REF' | 'W_REF_NOT_NORMALIZED' | 'E_REF_UNREPRESENTABLE' | 'E_EDGE_SCOPE' | 'E_EDGE_NOTE' | 'E_TARGET_TRIGGER' | 'E_NO_DEFAULT_OUTPUT' | 'E_DUPLICATE_EDGE' | 'E_ERROR_PORT_UNSUPPORTED' | 'W_ERROR_PORT_STORED' | 'E_UNKNOWN_BRANCH' | 'E_DUPLICATE_BRANCH_KEY' | 'E_BRANCH_KEY_COLLIDES' | 'E_BRANCH_ELSE_LAST' | 'W_RAW_HANDLE' | 'W_SUBFLOW_HANDLE_SCOPE' | 'E_EDGE_CYCLE' | 'W_EDGE_CYCLE' | 'W_BRANCH_UNWIRED' | 'E_UNKNOWN_BUILDER' | 'E_UNKNOWN_PARAM' | 'E_FIXED_PARAM' | 'W_FIELD_NOT_APPLICABLE' | 'W_REQUIRED_MISSING' | 'W_UNKNOWN_OPTION' | 'E_UNKNOWN_OPERATION' | 'W_UNKNOWN_MODEL' | 'W_LEGACY_BLOCK_TYPE' | 'I_SCHEDULE_UTC' | 'E_STORED_VALUE_MISSING' | 'W_VALUE_KIND' | 'W_OUT_OF_RANGE' | 'W_TABLE_FILTER_SHAPE' | 'W_LITERAL_SECRET' | 'W_SUBFLOW_COUNT' | 'W_UNKNOWN_OUTPUT_PATH' | 'W_JSON_REF_UNTYPED' | 'E_CODE_FILE_MISSING' | 'E_CODE_FILE_PATH' | 'W_CODE_FILE_INLINED' | 'W_UNRESOLVED_REF' | 'W_FORWARD_REF_LITERALIZED' | 'W_COMMENT_MOVED' | 'W_COMMENT_DROPPED' | 'E_LOCK_JSON' | 'E_LOCK_VERSION' | 'E_LOCK_SHAPE' | 'E_LOCK_UNKNOWN_FIELD' | 'E_LOCK_KEY' | 'E_LOCK_IDENT' | 'E_LOCK_DUPLICATE_IDENT' | 'E_LOCK_DUPLICATE_ID' | 'E_LOCK_PARENT' | 'E_LOCK_BRANCH' | 'E_LOCK_CODE_FILE_PATH' | 'E_SOURCE_META_JSON' | 'E_SOURCE_META_VERSION' | 'E_SOURCE_META_SHAPE' | 'E_SOURCE_META_UNKNOWN_FIELD' | 'E_SOURCE_META_IDENT' | 'E_SOURCE_META_DUPLICATE_IDENT' | 'E_SOURCE_META_ANCHOR' | 'E_CANON_LEGACY_NAME_COLLISION' | 'E_CANON_EDGE_SCOPE' | 'W_CANON_RESERVED_NAME' | 'W_CANON_DANGLING_EDGE' | 'W_CANON_DANGLING_PARENT' | 'W_CANON_RAW_HANDLE' | 'W_CANON_UNKNOWN_BLOCK_TYPE' | 'W_CANON_UNRESOLVED_ID' | 'W_CANON_TITLE_OVERRIDE' | 'W_CANON_SUBFLOW_REPAIRED' | 'W_CANON_SUBBLOCK_TYPE_DRIFT' | 'W_CANON_UNDECODABLE_JSON' | 'E_MAT_DUPLICATE_LOCK_ID' | 'E_MAT_UNKNOWN_RESOURCE' | 'E_MAT_UNKNOWN_VARIABLE' | 'W_MAT_DELETED_SINCE_PULL' | 'W_MAT_INFERRED_RENAME' | 'W_MAT_RETYPE_RECREATED' | 'W_MAT_LOCK_ID_CLAIMED' | 'I_MAT_NEEDS_LAYOUT' | 'E_APPLY_WORKFLOW_MISMATCH' | 'E_APPLY_LOCKED_BLOCK' | 'E_APPLY_TYPE_NOT_ADDABLE' | 'E_APPLY_INVALID_STATE' | 'E_APPLY_BLOCK_NOT_FOUND' | 'E_APPLY_INVALID_BLOCK_TYPE' | 'E_APPLY_BLOCK_NOT_ALLOWED' | 'E_APPLY_MODEL_NOT_ALLOWED' | 'E_APPLY_TOOL_NOT_ALLOWED' | 'E_APPLY_INVALID_EDGE_SOURCE' | 'E_APPLY_INVALID_EDGE_SCOPE' | 'E_APPLY_INVALID_SOURCE_HANDLE' | 'E_APPLY_INVALID_TARGET_HANDLE' | 'E_APPLY_INVALID_SUBBLOCK_FIELD' | 'E_APPLY_MISSING_REQUIRED_PARAMS' | 'E_APPLY_RETRY_NOT_SUPPORTED' | 'E_APPLY_DUPLICATE_TRIGGER' | 'E_APPLY_DUPLICATE_SINGLE_INSTANCE_BLOCK' | 'E_APPLY_DISABLED_ANCESTOR' | 'E_APPLY_CREDENTIAL_UNREACHABLE' | 'W_APPLY_CREDENTIAL_KEPT' | 'E_APPLY_SANDBOX_PLAN_REQUIRED' | 'W_APPLY_HOSTED_KEY_DROPPED' | 'W_APPLY_VALUE_NORMALIZED' | 'W_APPLY_TYPE_CHANGED' | 'W_APPLY_TRIGGER_REMOVED' | 'W_APPLY_CATALOG_MOVED' | 'W_APPLY_PROBABLE_RENAME' | 'E_APPLY_LINT' | 'W_APPLY_LINT' | 'W_TABLE_UNKNOWN_COLUMN' | 'E_APPLY_INVALID_SCHEDULE' | 'E_APPLY_BLOCK_DELETE' | 'E_WORKFLOW_META_INVALID';
7411
+ severity: 'error' | 'warning' | 'info';
7412
+ message: string;
7413
+ hint?: string;
7414
+ file?: string;
7415
+ line?: number;
7416
+ column?: number;
7417
+ endLine?: number;
7418
+ endColumn?: number;
7419
+ frame?: string;
7420
+ path?: string;
7421
+ kind?: string;
7422
+ key?: string;
7423
+ blockKey?: string;
7424
+ param?: string;
7425
+ }>;
7426
+ };
7427
+ };
6386
7428
  /** `POST /api/v2/skills/[skillId]/editors` */
6387
7429
  export type GrantSkillEditorParams = {
6388
7430
  skillId: string;
@@ -10849,6 +11891,20 @@ type SetSecretResponseRef0 = {
10849
11891
  export type SetSecretResponse = {
10850
11892
  data: SetSecretResponseRef0;
10851
11893
  };
11894
+ /** `POST /api/v2/workspaces/[workspaceId]/source/blobs` */
11895
+ export type StageWorkspaceSourceBlobsParams = {
11896
+ workspaceId: string;
11897
+ };
11898
+ export type StageWorkspaceSourceBlobsQuery = Record<string, never>;
11899
+ export type StageWorkspaceSourceBlobsResponse = {
11900
+ data: {
11901
+ workspaceId: string;
11902
+ staged: Array<{
11903
+ sha256: string;
11904
+ size: number;
11905
+ }>;
11906
+ };
11907
+ };
10852
11908
  /** `POST /api/v2/knowledge/[knowledgeBaseId]/connectors/[connectorId]/sync` */
10853
11909
  export type SyncKnowledgeConnectorParams = {
10854
11910
  connectorId: string;
@@ -12632,6 +13688,48 @@ export declare const V2_OPERATIONS: {
12632
13688
  };
12633
13689
  };
12634
13690
  };
13691
+ readonly applyWorkflowSource: {
13692
+ readonly method: 'POST';
13693
+ readonly path: '/api/v2/workflows/[workflowId]/source';
13694
+ readonly pathParams: readonly ['workflowId'];
13695
+ readonly pathParamDocs: {
13696
+ readonly workflowId: 'Unique workflow identifier.';
13697
+ };
13698
+ readonly responseMode: 'json';
13699
+ readonly summary: 'Apply workflow source';
13700
+ readonly workspaceKeyUnsupported: true;
13701
+ readonly query: {
13702
+ readonly dryRun: {
13703
+ readonly kind: 'boolean';
13704
+ readonly describe: 'Run every check without writing, auditing, or notifying collaborators. Findings, errors included, come back in `diagnostics` with `applied: false` and a `200`, and the files, lock and fingerprint show what a committed apply would store. A request refused before the source is evaluated (an invalid or oversized body, a locked workflow or folder) gets the same status as without `dryRun`, and a create under a taken name answers `409`.';
13705
+ };
13706
+ readonly allowDelete: {
13707
+ readonly kind: 'boolean';
13708
+ readonly describe: 'Allow the apply to delete blocks the source no longer declares. Without it, an apply that would delete any block is refused with `E_APPLY_BLOCK_DELETE` naming them. Ignored when creating a workflow.';
13709
+ };
13710
+ };
13711
+ readonly body: {
13712
+ readonly files: {
13713
+ readonly kind: 'object';
13714
+ readonly required: true;
13715
+ readonly describe: 'Relative path → file text: `workflow.ts` plus every function-code file it references (for example `functions/score.js`). At most 2001 files and 4000000 bytes together, for a workflow of at most 2000 blocks.';
13716
+ };
13717
+ readonly lock: {
13718
+ readonly kind: 'object';
13719
+ readonly required: true;
13720
+ readonly describe: 'Identity sidecar (`.sim/lock.json`): binds the keys in the source to stored ids.';
13721
+ };
13722
+ readonly base: {
13723
+ readonly kind: 'object';
13724
+ readonly required: true;
13725
+ readonly describe: 'Where and when the source was read (`.sim/base.json`). The apply answers `409` when the saved draft no longer matches `base.fingerprint`, and `400` when `base.workflowId` names another workflow.';
13726
+ };
13727
+ readonly provenance: {
13728
+ readonly kind: 'object';
13729
+ readonly describe: 'Where the source came from, for the audit log.';
13730
+ };
13731
+ };
13732
+ };
12635
13733
  readonly applyWorkflowVariables: {
12636
13734
  readonly method: 'PATCH';
12637
13735
  readonly path: '/api/v2/workflows/[workflowId]/variables';
@@ -12649,6 +13747,50 @@ export declare const V2_OPERATIONS: {
12649
13747
  };
12650
13748
  };
12651
13749
  };
13750
+ readonly applyWorkspaceSource: {
13751
+ readonly method: 'POST';
13752
+ readonly path: '/api/v2/workspaces/[workspaceId]/source';
13753
+ readonly pathParams: readonly ['workspaceId'];
13754
+ readonly pathParamDocs: {
13755
+ readonly workspaceId: 'Workspace to read or apply.';
13756
+ };
13757
+ readonly responseMode: 'json';
13758
+ readonly summary: 'Apply workspace source';
13759
+ readonly query: {
13760
+ readonly dryRun: {
13761
+ readonly kind: 'boolean';
13762
+ readonly describe: 'Plan, check and authorize every change without writing. Findings, errors included, come back in `diagnostics` with a `200`.';
13763
+ };
13764
+ };
13765
+ readonly body: {
13766
+ readonly files: {
13767
+ readonly kind: 'object';
13768
+ readonly required: true;
13769
+ readonly describe: 'Directory path → text for every managed kind: declarations (`tables/leads.ts`) and workflow folders (`workflows/ingest/workflow.ts`, `functions/*`, `.sim/lock.json`, `.sim/base.json`). A workflow folder sent with only its `.sim/base.json` is unchanged.';
13770
+ };
13771
+ readonly blobs: {
13772
+ readonly kind: 'array';
13773
+ readonly describe: 'Binary files by path, with the SHA-256 and size of their bytes. Their bytes must be staged first: `sim workspaces source apply` stages them, or upload them to `POST /api/v2/workspaces/{workspaceId}/source/blobs` (not available over MCP). An apply with any missing is refused with `E_BLOB_MISSING` and writes nothing.';
13774
+ };
13775
+ readonly base: {
13776
+ readonly kind: 'object';
13777
+ readonly describe: '`.sim/base.json`: per resource, the id and fingerprint the directory was read at. Apply compares it with the server to tell a local edit from a server change.';
13778
+ };
13779
+ readonly kinds: {
13780
+ readonly kind: 'array';
13781
+ readonly required: true;
13782
+ readonly describe: 'The kind folders the directory holds, empty ones included. A kind is managed only when listed here or when a file of it is sent.';
13783
+ };
13784
+ readonly options: {
13785
+ readonly kind: 'object';
13786
+ readonly describe: 'How far the apply may go.';
13787
+ };
13788
+ readonly provenance: {
13789
+ readonly kind: 'object';
13790
+ readonly describe: 'Where the directory came from, for the audit log.';
13791
+ };
13792
+ };
13793
+ };
12652
13794
  readonly archiveProjectFileItems: {
12653
13795
  readonly method: 'POST';
12654
13796
  readonly path: '/api/v2/projects/[projectId]/files/archive';
@@ -14421,6 +15563,50 @@ export declare const V2_OPERATIONS: {
14421
15563
  };
14422
15564
  };
14423
15565
  };
15566
+ readonly createWorkflowFromSource: {
15567
+ readonly method: 'POST';
15568
+ readonly path: '/api/v2/workspaces/[workspaceId]/workflows/source';
15569
+ readonly pathParams: readonly ['workspaceId'];
15570
+ readonly pathParamDocs: {
15571
+ readonly workspaceId: 'Workspace in which to create the workflow.';
15572
+ };
15573
+ readonly responseMode: 'json';
15574
+ readonly summary: 'Create workflow from source';
15575
+ readonly workspaceKeyUnsupported: true;
15576
+ readonly query: {
15577
+ readonly dryRun: {
15578
+ readonly kind: 'boolean';
15579
+ readonly describe: 'Run every check without writing, auditing, or notifying collaborators. Findings, errors included, come back in `diagnostics` with `applied: false` and a `200`, and the files, lock and fingerprint show what a committed apply would store. A request refused before the source is evaluated (an invalid or oversized body, a locked workflow or folder) gets the same status as without `dryRun`, and a create under a taken name answers `409`.';
15580
+ };
15581
+ readonly allowDelete: {
15582
+ readonly kind: 'boolean';
15583
+ readonly describe: 'Allow the apply to delete blocks the source no longer declares. Without it, an apply that would delete any block is refused with `E_APPLY_BLOCK_DELETE` naming them. Ignored when creating a workflow.';
15584
+ };
15585
+ };
15586
+ readonly body: {
15587
+ readonly files: {
15588
+ readonly kind: 'object';
15589
+ readonly required: true;
15590
+ readonly describe: 'Relative path → file text: `workflow.ts` plus every function-code file it references (for example `functions/score.js`). At most 2001 files and 4000000 bytes together, for a workflow of at most 2000 blocks.';
15591
+ };
15592
+ readonly name: {
15593
+ readonly kind: 'string';
15594
+ readonly describe: "Workflow name. Defaults to the name in the source's `workflow('…')` call.";
15595
+ };
15596
+ readonly description: {
15597
+ readonly kind: 'string';
15598
+ readonly describe: 'Workflow description. Defaults to the description in the source.';
15599
+ };
15600
+ readonly folderPath: {
15601
+ readonly kind: 'string';
15602
+ readonly describe: 'Folder path. A missing leading slash is normalized before validation. Segments are percent-encoded, so a folder shown as "New folder" is `/New%20folder`: everything outside `A-Z a-z 0-9 - _ . ~` is escaped as uppercase hex, and only that exact encoding is accepted. A trailing slash, an empty segment, and a literal `.` or `..` segment are rejected. At most 64 segments and 4096 encoded bytes.';
15603
+ };
15604
+ readonly provenance: {
15605
+ readonly kind: 'object';
15606
+ readonly describe: 'Where the source came from, for the audit log.';
15607
+ };
15608
+ };
15609
+ };
14424
15610
  readonly createWorkflowMcpServer: {
14425
15611
  readonly method: 'POST';
14426
15612
  readonly path: '/api/v2/workflow-mcp-servers';
@@ -15264,6 +16450,24 @@ export declare const V2_OPERATIONS: {
15264
16450
  };
15265
16451
  };
15266
16452
  };
16453
+ readonly downloadKnowledgeDocument: {
16454
+ readonly method: 'GET';
16455
+ readonly path: '/api/v2/knowledge/[knowledgeBaseId]/documents/[documentId]/content';
16456
+ readonly pathParams: readonly ['knowledgeBaseId', 'documentId'];
16457
+ readonly pathParamDocs: {
16458
+ readonly knowledgeBaseId: 'Unique knowledge base identifier.';
16459
+ readonly documentId: 'Unique knowledge document identifier.';
16460
+ };
16461
+ readonly responseMode: 'binary';
16462
+ readonly summary: 'Download document';
16463
+ readonly query: {
16464
+ readonly workspaceId: {
16465
+ readonly kind: 'string';
16466
+ readonly required: true;
16467
+ readonly describe: 'Workspace that owns the knowledge base.';
16468
+ };
16469
+ };
16470
+ };
15267
16471
  readonly downloadProjectFileItems: {
15268
16472
  readonly method: 'GET';
15269
16473
  readonly path: '/api/v2/projects/[projectId]/files/bulk-download';
@@ -15508,6 +16712,23 @@ export declare const V2_OPERATIONS: {
15508
16712
  };
15509
16713
  };
15510
16714
  };
16715
+ readonly findMissingWorkspaceSourceBlobs: {
16716
+ readonly method: 'POST';
16717
+ readonly path: '/api/v2/workspaces/[workspaceId]/source/blobs/missing';
16718
+ readonly pathParams: readonly ['workspaceId'];
16719
+ readonly pathParamDocs: {
16720
+ readonly workspaceId: 'Workspace to read or apply.';
16721
+ };
16722
+ readonly responseMode: 'json';
16723
+ readonly summary: 'Find missing workspace source blobs';
16724
+ readonly body: {
16725
+ readonly blobs: {
16726
+ readonly kind: 'array';
16727
+ readonly required: true;
16728
+ readonly describe: 'The binary files an apply will need.';
16729
+ };
16730
+ };
16731
+ };
15511
16732
  readonly forkWorkspace: {
15512
16733
  readonly method: 'POST';
15513
16734
  readonly path: '/api/v2/workspaces/[workspaceId]/fork';
@@ -16232,6 +17453,38 @@ export declare const V2_OPERATIONS: {
16232
17453
  };
16233
17454
  };
16234
17455
  };
17456
+ readonly getSourceCatalog: {
17457
+ readonly method: 'GET';
17458
+ readonly path: '/api/v2/workspaces/[workspaceId]/workflows/source/catalog';
17459
+ readonly pathParams: readonly ['workspaceId'];
17460
+ readonly pathParamDocs: {
17461
+ readonly workspaceId: 'Workspace whose integration allowlist, revealed preview blocks, and deployed custom blocks decide what the catalog contains.';
17462
+ };
17463
+ readonly responseMode: 'json';
17464
+ readonly summary: 'Get source catalog';
17465
+ readonly query: {
17466
+ readonly workflowId: {
17467
+ readonly kind: 'string';
17468
+ readonly describe: 'Return the source catalog for this workflow: the workspace catalog plus every block type already placed in it, the ones the caller could not add marked `addable: false`.';
17469
+ };
17470
+ };
17471
+ readonly headers: {
17472
+ readonly 'if-none-match': {
17473
+ readonly kind: 'string';
17474
+ readonly describe: 'A catalog `hash` (quoted, as sent in `ETag`) the caller already holds.';
17475
+ };
17476
+ };
17477
+ };
17478
+ readonly getSourceResources: {
17479
+ readonly method: 'GET';
17480
+ readonly path: '/api/v2/workspaces/[workspaceId]/workflows/source/resources';
17481
+ readonly pathParams: readonly ['workspaceId'];
17482
+ readonly pathParamDocs: {
17483
+ readonly workspaceId: 'Workspace whose resources to list.';
17484
+ };
17485
+ readonly responseMode: 'json';
17486
+ readonly summary: 'Get source resources';
17487
+ };
16235
17488
  readonly getSsoPolicy: {
16236
17489
  readonly method: 'GET';
16237
17490
  readonly path: '/api/v2/organizations/[organizationId]/sso/policy';
@@ -16470,6 +17723,23 @@ export declare const V2_OPERATIONS: {
16470
17723
  };
16471
17724
  };
16472
17725
  };
17726
+ readonly getWorkflowSource: {
17727
+ readonly method: 'GET';
17728
+ readonly path: '/api/v2/workflows/[workflowId]/source';
17729
+ readonly pathParams: readonly ['workflowId'];
17730
+ readonly pathParamDocs: {
17731
+ readonly workflowId: 'Unique workflow identifier.';
17732
+ };
17733
+ readonly responseMode: 'json';
17734
+ readonly summary: 'Get workflow source';
17735
+ readonly query: {
17736
+ readonly functionCode: {
17737
+ readonly kind: 'enum';
17738
+ readonly values: readonly ['inline', 'files'];
17739
+ readonly describe: 'Where function-block code goes: `files` (default) writes it to `functions/*` files referenced with `codeFile()`; `inline` prints it in tagged templates.';
17740
+ };
17741
+ };
17742
+ };
16473
17743
  readonly getWorkflowState: {
16474
17744
  readonly method: 'GET';
16475
17745
  readonly path: '/api/v2/workflows/[workflowId]/state';
@@ -16591,6 +17861,22 @@ export declare const V2_OPERATIONS: {
16591
17861
  readonly summary: 'Get workspace permission config';
16592
17862
  readonly workspaceKeyUnsupported: true;
16593
17863
  };
17864
+ readonly getWorkspaceSource: {
17865
+ readonly method: 'GET';
17866
+ readonly path: '/api/v2/workspaces/[workspaceId]/source';
17867
+ readonly pathParams: readonly ['workspaceId'];
17868
+ readonly pathParamDocs: {
17869
+ readonly workspaceId: 'Workspace to read or apply.';
17870
+ };
17871
+ readonly responseMode: 'json';
17872
+ readonly summary: 'Get workspace source';
17873
+ readonly query: {
17874
+ readonly kinds: {
17875
+ readonly kind: 'string';
17876
+ readonly describe: 'Comma-separated kinds to read; every kind the server supports when omitted.';
17877
+ };
17878
+ };
17879
+ };
16594
17880
  readonly grantSkillEditor: {
16595
17881
  readonly method: 'POST';
16596
17882
  readonly path: '/api/v2/skills/[skillId]/editors';
@@ -20956,6 +22242,16 @@ export declare const V2_OPERATIONS: {
20956
22242
  };
20957
22243
  };
20958
22244
  };
22245
+ readonly stageWorkspaceSourceBlobs: {
22246
+ readonly method: 'POST';
22247
+ readonly path: '/api/v2/workspaces/[workspaceId]/source/blobs';
22248
+ readonly pathParams: readonly ['workspaceId'];
22249
+ readonly pathParamDocs: {
22250
+ readonly workspaceId: 'Workspace to read or apply.';
22251
+ };
22252
+ readonly responseMode: 'json';
22253
+ readonly summary: 'Stage workspace source blobs';
22254
+ };
20959
22255
  readonly syncKnowledgeConnector: {
20960
22256
  readonly method: 'POST';
20961
22257
  readonly path: '/api/v2/knowledge/[knowledgeBaseId]/connectors/[connectorId]/sync';