@xyne/workflow-sdk 2.1.2 → 2.3.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 (94) hide show
  1. package/dist/agents/agent-step.d.ts +115 -3
  2. package/dist/agents/agent-step.d.ts.map +1 -1
  3. package/dist/agents/agent-step.js +247 -85
  4. package/dist/agents/agent-step.js.map +1 -1
  5. package/dist/agents/builtin/run-code-tool.d.ts +29 -0
  6. package/dist/agents/builtin/run-code-tool.d.ts.map +1 -0
  7. package/dist/agents/builtin/run-code-tool.js +54 -0
  8. package/dist/agents/builtin/run-code-tool.js.map +1 -0
  9. package/dist/agents/index.d.ts +1 -0
  10. package/dist/agents/index.d.ts.map +1 -1
  11. package/dist/agents/index.js +1 -0
  12. package/dist/agents/index.js.map +1 -1
  13. package/dist/agents/pi-mono-runtime.d.ts +5 -6
  14. package/dist/agents/pi-mono-runtime.d.ts.map +1 -1
  15. package/dist/agents/pi-mono-runtime.js +4 -5
  16. package/dist/agents/pi-mono-runtime.js.map +1 -1
  17. package/dist/agents/tool-types.d.ts +5 -0
  18. package/dist/agents/tool-types.d.ts.map +1 -1
  19. package/dist/agents/types.d.ts +5 -1
  20. package/dist/agents/types.d.ts.map +1 -1
  21. package/dist/agents/types.js.map +1 -1
  22. package/dist/client/index.d.ts +1 -1
  23. package/dist/client/index.d.ts.map +1 -1
  24. package/dist/client/types.d.ts +23 -1
  25. package/dist/client/types.d.ts.map +1 -1
  26. package/dist/client/workflow-client.d.ts.map +1 -1
  27. package/dist/client/workflow-client.js +22 -0
  28. package/dist/client/workflow-client.js.map +1 -1
  29. package/dist/common/attachment.d.ts +31 -2
  30. package/dist/common/attachment.d.ts.map +1 -1
  31. package/dist/common/attachment.js +53 -0
  32. package/dist/common/attachment.js.map +1 -1
  33. package/dist/common/principal.d.ts +45 -0
  34. package/dist/common/principal.d.ts.map +1 -0
  35. package/dist/common/principal.js +9 -0
  36. package/dist/common/principal.js.map +1 -0
  37. package/dist/engine/config-validator.d.ts.map +1 -1
  38. package/dist/engine/config-validator.js +0 -1
  39. package/dist/engine/config-validator.js.map +1 -1
  40. package/dist/engine/workflow-executor.d.ts +8 -0
  41. package/dist/engine/workflow-executor.d.ts.map +1 -1
  42. package/dist/engine/workflow-executor.js +16 -4
  43. package/dist/engine/workflow-executor.js.map +1 -1
  44. package/dist/index.d.ts +3 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +4 -0
  47. package/dist/index.js.map +1 -1
  48. package/dist/persistence/in-memory-adapter.d.ts +2 -0
  49. package/dist/persistence/in-memory-adapter.d.ts.map +1 -1
  50. package/dist/persistence/in-memory-adapter.js +3 -1
  51. package/dist/persistence/in-memory-adapter.js.map +1 -1
  52. package/dist/persistence/types.d.ts +7 -2
  53. package/dist/persistence/types.d.ts.map +1 -1
  54. package/dist/router/workflow-router.d.ts.map +1 -1
  55. package/dist/router/workflow-router.js +93 -3
  56. package/dist/router/workflow-router.js.map +1 -1
  57. package/dist/runtime/types.d.ts +7 -0
  58. package/dist/runtime/types.d.ts.map +1 -1
  59. package/dist/runtime/workflow-runtime.d.ts +26 -1
  60. package/dist/runtime/workflow-runtime.d.ts.map +1 -1
  61. package/dist/runtime/workflow-runtime.js +41 -1
  62. package/dist/runtime/workflow-runtime.js.map +1 -1
  63. package/dist/sandbox/types.d.ts +85 -0
  64. package/dist/sandbox/types.d.ts.map +1 -0
  65. package/dist/sandbox/types.js +22 -0
  66. package/dist/sandbox/types.js.map +1 -0
  67. package/dist/steps/base-step.d.ts +14 -0
  68. package/dist/steps/base-step.d.ts.map +1 -1
  69. package/dist/steps/base-step.js.map +1 -1
  70. package/dist/steps/builtin/http-request.step.d.ts +2 -2
  71. package/dist/steps/builtin/transform.step.d.ts +247 -0
  72. package/dist/steps/builtin/transform.step.d.ts.map +1 -0
  73. package/dist/steps/builtin/transform.step.js +135 -0
  74. package/dist/steps/builtin/transform.step.js.map +1 -0
  75. package/dist/testing/mock-step-context.d.ts +4 -0
  76. package/dist/testing/mock-step-context.d.ts.map +1 -1
  77. package/dist/testing/mock-step-context.js +2 -0
  78. package/dist/testing/mock-step-context.js.map +1 -1
  79. package/dist/triggers/builtin/default-manual-trigger.d.ts.map +1 -1
  80. package/dist/triggers/builtin/default-manual-trigger.js +17 -4
  81. package/dist/triggers/builtin/default-manual-trigger.js.map +1 -1
  82. package/dist/types/attachment.d.ts +23 -0
  83. package/dist/types/attachment.d.ts.map +1 -0
  84. package/dist/types/attachment.js +2 -0
  85. package/dist/types/attachment.js.map +1 -0
  86. package/dist/types/resume-payload.d.ts +34 -0
  87. package/dist/types/resume-payload.d.ts.map +1 -0
  88. package/dist/types/resume-payload.js +12 -0
  89. package/dist/types/resume-payload.js.map +1 -0
  90. package/dist/util/executable-check.d.ts +42 -0
  91. package/dist/util/executable-check.d.ts.map +1 -0
  92. package/dist/util/executable-check.js +115 -0
  93. package/dist/util/executable-check.js.map +1 -0
  94. package/package.json +1 -1
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Executable upload safety check.
3
+ *
4
+ * Allow-by-default with a deny-list of known dangerous types — covers the
5
+ * common attack surface (native binaries, scripts that auto-run, installers,
6
+ * macro-enabled Office docs) without forcing workflow authors to enumerate
7
+ * every safe MIME type.
8
+ *
9
+ * Two checks run in parallel so spoofed MIME types alone can't bypass:
10
+ * 1. MIME type matches the deny-list
11
+ * 2. Filename extension matches the deny-list
12
+ *
13
+ * Either match blocks the upload. To accept executables (e.g. a security-
14
+ * analysis workflow that intentionally examines binaries), the host opts
15
+ * in via `RuntimeOptions.allowExecutableUploads = true`.
16
+ */
17
+ /**
18
+ * MIME types treated as executable / unsafe (lowercase — input is also
19
+ * lowercased before comparison).
20
+ */
21
+ export const BLOCKED_EXECUTABLE_MIME_TYPES = new Set([
22
+ // Native binaries
23
+ 'application/x-msdownload',
24
+ 'application/x-msdos-program',
25
+ 'application/x-executable',
26
+ 'application/x-mach-binary',
27
+ 'application/vnd.microsoft.portable-executable',
28
+ 'application/x-msi',
29
+ 'application/x-ms-installer',
30
+ // Shell + Windows scripts
31
+ 'application/x-sh',
32
+ 'application/x-shellscript',
33
+ 'application/x-bat',
34
+ 'application/x-csh',
35
+ 'application/x-cmd',
36
+ 'application/x-msmetafile',
37
+ // JavaScript / ECMAScript
38
+ 'text/javascript',
39
+ 'application/javascript',
40
+ 'application/ecmascript',
41
+ 'application/x-javascript',
42
+ // Java / Flash
43
+ 'application/java-archive',
44
+ 'application/x-java-archive',
45
+ 'application/x-java-jnlp-file',
46
+ 'application/x-shockwave-flash',
47
+ // Installer / package formats that bundle executables
48
+ 'application/vnd.android.package-archive',
49
+ 'application/x-debian-package',
50
+ 'application/x-rpm',
51
+ // Macro-enabled Office documents (lowercased — IANA tokens are case-insensitive)
52
+ 'application/vnd.ms-word.document.macroenabled.12',
53
+ 'application/vnd.ms-word.template.macroenabled.12',
54
+ 'application/vnd.ms-excel.sheet.macroenabled.12',
55
+ 'application/vnd.ms-excel.template.macroenabled.12',
56
+ 'application/vnd.ms-excel.addin.macroenabled.12',
57
+ 'application/vnd.ms-excel.sheet.binary.macroenabled.12',
58
+ 'application/vnd.ms-powerpoint.presentation.macroenabled.12',
59
+ 'application/vnd.ms-powerpoint.template.macroenabled.12',
60
+ 'application/vnd.ms-powerpoint.addin.macroenabled.12',
61
+ ]);
62
+ /**
63
+ * File extensions treated as executable / unsafe (case-insensitive, no dot).
64
+ * The check uses the LAST extension so `report.exe.txt` is treated as text
65
+ * (Windows shows the trailing extension, which is what the user actually sees).
66
+ */
67
+ export const BLOCKED_EXECUTABLE_EXTENSIONS = new Set([
68
+ // Windows
69
+ 'exe', 'msi', 'com', 'scr', 'cmd', 'bat', 'ps1', 'psm1',
70
+ 'vbs', 'vbe', 'wsf', 'wsh', 'hta', 'cpl', 'lnk',
71
+ 'dll', 'sys', 'drv', 'ocx',
72
+ // macOS / Unix
73
+ 'app', 'dmg', 'pkg',
74
+ 'sh', 'bash', 'zsh', 'fish', 'csh', 'ksh', 'command', 'tool',
75
+ // Java / Flash
76
+ 'jar', 'war', 'jnlp', 'swf',
77
+ // Mobile installers
78
+ 'apk', 'ipa', 'xap',
79
+ // Linux installers
80
+ 'deb', 'rpm', 'run', 'bin',
81
+ // JavaScript (auto-executes in browser / Node contexts)
82
+ 'js', 'mjs', 'cjs',
83
+ // Macro-enabled Office
84
+ 'docm', 'dotm', 'xlsm', 'xltm', 'xlam', 'xlsb',
85
+ 'pptm', 'potm', 'ppam', 'ppsm', 'sldm',
86
+ ]);
87
+ /**
88
+ * Extract the lowercase extension (no dot) from a filename, or '' if none.
89
+ * A leading dot doesn't count — `.bashrc` has no extension, not "bashrc".
90
+ */
91
+ export function extensionOf(name) {
92
+ const dot = name.lastIndexOf('.');
93
+ if (dot <= 0 || dot === name.length - 1)
94
+ return '';
95
+ return name.slice(dot + 1).toLowerCase();
96
+ }
97
+ /**
98
+ * Returns a human-readable reason if the file should be blocked as
99
+ * executable, or `null` if it's safe.
100
+ *
101
+ * Always check both the MIME type and the filename — clients can spoof one
102
+ * but rarely both. This is defense-in-depth, not authoritative malware
103
+ * detection (run real AV at the storage layer for that).
104
+ */
105
+ export function isExecutable(mimeType, name) {
106
+ if (BLOCKED_EXECUTABLE_MIME_TYPES.has(mimeType.toLowerCase())) {
107
+ return `Executable MIME type "${mimeType}" is not allowed.`;
108
+ }
109
+ const ext = extensionOf(name);
110
+ if (ext && BLOCKED_EXECUTABLE_EXTENSIONS.has(ext)) {
111
+ return `Files with .${ext} extension are not allowed.`;
112
+ }
113
+ return null;
114
+ }
115
+ //# sourceMappingURL=executable-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executable-check.js","sourceRoot":"","sources":["../../src/util/executable-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAwB,IAAI,GAAG,CAAC;IACxE,kBAAkB;IAClB,0BAA0B;IAC1B,6BAA6B;IAC7B,0BAA0B;IAC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IACvB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAC9C,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CACvC,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IACnD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AAC3C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB,EAAE,IAAY;IACzD,IAAI,6BAA6B,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QAC9D,OAAO,yBAAyB,QAAQ,mBAAmB,CAAC;IAC9D,CAAC;IACD,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,GAAG,IAAI,6BAA6B,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QAClD,OAAO,eAAe,GAAG,6BAA6B,CAAC;IACzD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyne/workflow-sdk",
3
- "version": "2.1.2",
3
+ "version": "2.3.0",
4
4
  "description": "Workflow engine SDK — steps, triggers, executor, agents, and a framework-agnostic HTTP router.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {