@reasonlayer/sdk 0.0.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 (117) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +35 -0
  3. package/bin/rl.mjs +75 -0
  4. package/dist/builder.d.ts +38 -0
  5. package/dist/builder.js +41 -0
  6. package/dist/bundler/index.d.ts +32 -0
  7. package/dist/bundler/index.js +143 -0
  8. package/dist/bundler/lint.d.ts +13 -0
  9. package/dist/bundler/lint.js +74 -0
  10. package/dist/bundler/node.d.ts +10 -0
  11. package/dist/bundler/node.js +55 -0
  12. package/dist/bundler/smoke.d.ts +12 -0
  13. package/dist/bundler/smoke.js +70 -0
  14. package/dist/bundler/worker.d.ts +31 -0
  15. package/dist/bundler/worker.js +214 -0
  16. package/dist/cli/args.d.ts +9 -0
  17. package/dist/cli/args.js +71 -0
  18. package/dist/cli/config.d.ts +38 -0
  19. package/dist/cli/config.js +94 -0
  20. package/dist/cli/convex.d.ts +9 -0
  21. package/dist/cli/convex.js +25 -0
  22. package/dist/cli/format.d.ts +11 -0
  23. package/dist/cli/format.js +140 -0
  24. package/dist/cli/index.d.ts +1 -0
  25. package/dist/cli/index.js +721 -0
  26. package/dist/cli/keychain.d.ts +21 -0
  27. package/dist/cli/keychain.js +100 -0
  28. package/dist/cli/login-browser.d.ts +22 -0
  29. package/dist/cli/login-browser.js +106 -0
  30. package/dist/cli/mcp.d.ts +3 -0
  31. package/dist/cli/mcp.js +36 -0
  32. package/dist/cli/operations.d.ts +106 -0
  33. package/dist/cli/operations.js +623 -0
  34. package/dist/cli/sdk-package.d.ts +18 -0
  35. package/dist/cli/sdk-package.js +45 -0
  36. package/dist/cli/storage-upload.d.ts +9 -0
  37. package/dist/cli/storage-upload.js +21 -0
  38. package/dist/cli/watcher-compile.d.ts +1 -0
  39. package/dist/cli/watcher-compile.js +20 -0
  40. package/dist/cli/watcher-process.d.ts +1 -0
  41. package/dist/cli/watcher-process.js +312 -0
  42. package/dist/cli/worker-host.d.ts +10 -0
  43. package/dist/cli/worker-host.js +120 -0
  44. package/dist/cli/workspace-files.d.ts +12 -0
  45. package/dist/cli/workspace-files.js +91 -0
  46. package/dist/cli/workspace-local.d.ts +27 -0
  47. package/dist/cli/workspace-local.js +310 -0
  48. package/dist/cli/workspace-session.d.ts +13 -0
  49. package/dist/cli/workspace-session.js +12 -0
  50. package/dist/compile.d.ts +27 -0
  51. package/dist/compile.js +834 -0
  52. package/dist/index.d.ts +10 -0
  53. package/dist/index.js +5 -0
  54. package/dist/schedule-validation.d.ts +1 -0
  55. package/dist/schedule-validation.js +16 -0
  56. package/dist/selector-schema.d.ts +26 -0
  57. package/dist/selector-schema.js +780 -0
  58. package/dist/selectors.d.ts +25 -0
  59. package/dist/selectors.js +99 -0
  60. package/dist/testkit.d.ts +32 -0
  61. package/dist/testkit.js +161 -0
  62. package/dist/types.d.ts +184 -0
  63. package/dist/types.js +110 -0
  64. package/node_modules/@reasonlayer/integrations/dist/catalog.d.ts +4937 -0
  65. package/node_modules/@reasonlayer/integrations/dist/catalog.js +20 -0
  66. package/node_modules/@reasonlayer/integrations/dist/generated/slack.d.ts +3014 -0
  67. package/node_modules/@reasonlayer/integrations/dist/generated/slack.js +3101 -0
  68. package/node_modules/@reasonlayer/integrations/dist/index.d.ts +2 -0
  69. package/node_modules/@reasonlayer/integrations/dist/index.js +1 -0
  70. package/node_modules/@reasonlayer/integrations/dist/internal/definitions.d.ts +44 -0
  71. package/node_modules/@reasonlayer/integrations/dist/internal/definitions.js +52 -0
  72. package/node_modules/@reasonlayer/integrations/dist/internal/transport.d.ts +7 -0
  73. package/node_modules/@reasonlayer/integrations/dist/internal/transport.js +48 -0
  74. package/node_modules/@reasonlayer/integrations/dist/testkit.d.ts +1 -0
  75. package/node_modules/@reasonlayer/integrations/dist/testkit.js +1 -0
  76. package/node_modules/@reasonlayer/integrations/package.json +26 -0
  77. package/node_modules/@reasonlayer/protocol/dist/dispatch.d.ts +10 -0
  78. package/node_modules/@reasonlayer/protocol/dist/dispatch.js +58 -0
  79. package/node_modules/@reasonlayer/protocol/dist/envelope.d.ts +9 -0
  80. package/node_modules/@reasonlayer/protocol/dist/envelope.js +1 -0
  81. package/node_modules/@reasonlayer/protocol/dist/environments.d.ts +7 -0
  82. package/node_modules/@reasonlayer/protocol/dist/environments.js +7 -0
  83. package/node_modules/@reasonlayer/protocol/dist/events.d.ts +313 -0
  84. package/node_modules/@reasonlayer/protocol/dist/events.js +20 -0
  85. package/node_modules/@reasonlayer/protocol/dist/index.d.ts +18 -0
  86. package/node_modules/@reasonlayer/protocol/dist/index.js +9 -0
  87. package/node_modules/@reasonlayer/protocol/dist/ir.d.ts +252 -0
  88. package/node_modules/@reasonlayer/protocol/dist/ir.js +116 -0
  89. package/node_modules/@reasonlayer/protocol/dist/permissions.d.ts +5 -0
  90. package/node_modules/@reasonlayer/protocol/dist/permissions.js +30 -0
  91. package/node_modules/@reasonlayer/protocol/dist/readmodels.d.ts +617 -0
  92. package/node_modules/@reasonlayer/protocol/dist/readmodels.js +36 -0
  93. package/node_modules/@reasonlayer/protocol/dist/runtime.d.ts +67 -0
  94. package/node_modules/@reasonlayer/protocol/dist/runtime.js +66 -0
  95. package/node_modules/@reasonlayer/protocol/dist/scheduling.d.ts +69 -0
  96. package/node_modules/@reasonlayer/protocol/dist/scheduling.js +126 -0
  97. package/node_modules/@reasonlayer/protocol/dist/selector.d.ts +23 -0
  98. package/node_modules/@reasonlayer/protocol/dist/selector.js +77 -0
  99. package/node_modules/@reasonlayer/protocol/dist/tasks.d.ts +69 -0
  100. package/node_modules/@reasonlayer/protocol/dist/tasks.js +6 -0
  101. package/node_modules/@reasonlayer/protocol/dist/validate.d.ts +6 -0
  102. package/node_modules/@reasonlayer/protocol/dist/validate.js +18 -0
  103. package/node_modules/@reasonlayer/protocol/package.json +21 -0
  104. package/node_modules/@reasonlayer/runner/dist/environment-materializer.d.ts +13 -0
  105. package/node_modules/@reasonlayer/runner/dist/environment-materializer.js +92 -0
  106. package/node_modules/@reasonlayer/runner/dist/flue-transcript.d.ts +17 -0
  107. package/node_modules/@reasonlayer/runner/dist/flue-transcript.js +182 -0
  108. package/node_modules/@reasonlayer/runner/dist/index.d.ts +184 -0
  109. package/node_modules/@reasonlayer/runner/dist/index.js +884 -0
  110. package/node_modules/@reasonlayer/runner/dist/mcp-supervisor.d.ts +15 -0
  111. package/node_modules/@reasonlayer/runner/dist/mcp-supervisor.js +142 -0
  112. package/node_modules/@reasonlayer/runner/dist/sandbox-env.d.ts +36 -0
  113. package/node_modules/@reasonlayer/runner/dist/sandbox-env.js +171 -0
  114. package/node_modules/@reasonlayer/runner/dist/task-child.d.ts +1 -0
  115. package/node_modules/@reasonlayer/runner/dist/task-child.js +72 -0
  116. package/node_modules/@reasonlayer/runner/package.json +21 -0
  117. package/package.json +65 -0
@@ -0,0 +1,140 @@
1
+ const OPAQUE_VALUE_KEYS = new Set([
2
+ "buildInfo",
3
+ "content",
4
+ "data",
5
+ "decision",
6
+ "input",
7
+ "inputSchema",
8
+ "ir",
9
+ "output",
10
+ "outputSchema",
11
+ "schema",
12
+ "schemaJson",
13
+ "settings",
14
+ "variables",
15
+ "value",
16
+ "defaultJson",
17
+ ]);
18
+ const TIMESTAMP_KEYS = new Set([
19
+ "at",
20
+ "checkedAt",
21
+ "connectStartedAt",
22
+ "connectedAt",
23
+ "createdAt",
24
+ "deadlineAt",
25
+ "deletedAt",
26
+ "draftUpdatedAt",
27
+ "endedAt",
28
+ "expiresAt",
29
+ "finishedAt",
30
+ "lastCheckedAt",
31
+ "lastFiredAt",
32
+ "lastHealthyAt",
33
+ "lastHeartbeatAt",
34
+ "lastRefreshedAt",
35
+ "lastSeenAt",
36
+ "lastUsedAt",
37
+ "leaseExpiresAt",
38
+ "loginCompletedAt",
39
+ "loginRequestedAt",
40
+ "nextFireAt",
41
+ "nextRunAt",
42
+ "resolvedAt",
43
+ "revokedAt",
44
+ "scheduledFor",
45
+ "startedAt",
46
+ "ts",
47
+ "updatedAt",
48
+ "workosUpdatedAt",
49
+ ]);
50
+ function isTimestampKey(key) {
51
+ return TIMESTAMP_KEYS.has(key);
52
+ }
53
+ function isoTimestamp(value) {
54
+ if (!Number.isFinite(value))
55
+ return value;
56
+ const date = new Date(value);
57
+ return Number.isNaN(date.getTime()) ? value : date.toISOString();
58
+ }
59
+ export function serializeCliValue(value, key) {
60
+ if (key !== undefined && OPAQUE_VALUE_KEYS.has(key))
61
+ return value;
62
+ if (typeof value === "number" && key !== undefined && isTimestampKey(key)) {
63
+ return isoTimestamp(value);
64
+ }
65
+ if (Array.isArray(value)) {
66
+ return value.map((item) => serializeCliValue(item));
67
+ }
68
+ if (value !== null && typeof value === "object") {
69
+ return Object.fromEntries(Object.entries(value).map(([entryKey, entryValue]) => [
70
+ entryKey,
71
+ serializeCliValue(entryValue, entryKey),
72
+ ]));
73
+ }
74
+ return value;
75
+ }
76
+ export function jsonText(value) {
77
+ return `${JSON.stringify(serializeCliValue(value), null, 2)}\n`;
78
+ }
79
+ export function parseVariableValue(raw) {
80
+ try {
81
+ return JSON.parse(raw);
82
+ }
83
+ catch {
84
+ return raw;
85
+ }
86
+ }
87
+ function inlineJson(value) {
88
+ return JSON.stringify(value) ?? String(value);
89
+ }
90
+ export function formatVariableList(value) {
91
+ if (!Array.isArray(value) || value.length === 0)
92
+ return "No variables declared.\n";
93
+ const lines = value.map((item) => {
94
+ const variable = item;
95
+ const hasOverride = Object.hasOwn(variable, "value");
96
+ const current = hasOverride ? variable.value : variable.defaultJson;
97
+ return `${variable.name}: ${inlineJson(current)}${hasOverride ? "" : " (default)"}`;
98
+ });
99
+ return `${lines.join("\n")}\n`;
100
+ }
101
+ export function formatCompileErrors(result) {
102
+ return result.errors
103
+ .map((error) => `${error.stepId ? `${error.stepId}: ` : ""}${error.message}`)
104
+ .join("\n");
105
+ }
106
+ export function formatInspect(value) {
107
+ const inspected = value;
108
+ if (!inspected.run)
109
+ return jsonText(value);
110
+ const lines = [
111
+ `Run ${inspected.run.runId}`,
112
+ `Workflow: ${inspected.run.workflowId}`,
113
+ `Status: ${inspected.run.status}`,
114
+ ];
115
+ if (inspected.run.error)
116
+ lines.push(`Error: ${inspected.run.error}`);
117
+ if (inspected.run.output !== undefined) {
118
+ lines.push(`Output: ${JSON.stringify(inspected.run.output)}`);
119
+ }
120
+ if (inspected.steps && inspected.steps.length > 0) {
121
+ lines.push("Steps:");
122
+ for (const step of inspected.steps) {
123
+ const key = step.invocationKey ? ` key=${step.invocationKey}` : "";
124
+ const error = step.error ? ` error=${JSON.stringify(step.error)}` : "";
125
+ lines.push(`- ${step.stepId}${key} attempt=${step.attempt} status=${step.status}${error}`);
126
+ }
127
+ }
128
+ if (inspected.usage) {
129
+ const u = inspected.usage.totals;
130
+ lines.push(`Usage: input=${u.inputTokens} output=${u.outputTokens} cost=$${u.costUsd.toFixed(6)}`);
131
+ }
132
+ if (inspected.transcript && inspected.transcript.length > 0) {
133
+ lines.push("Transcript:");
134
+ for (const event of inspected.transcript) {
135
+ const key = event.invocationKey ? ` key=${event.invocationKey}` : "";
136
+ lines.push(`- ${event.stepId}${key} attempt=${event.attempt} seq=${event.seq} ${event.level} ${event.type} ${JSON.stringify(event.data)}`);
137
+ }
138
+ }
139
+ return `${lines.join("\n")}\n`;
140
+ }
@@ -0,0 +1 @@
1
+ export declare function main(argv: readonly string[]): Promise<number>;