@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.
- package/LICENSE +201 -0
- package/README.md +35 -0
- package/bin/rl.mjs +75 -0
- package/dist/builder.d.ts +38 -0
- package/dist/builder.js +41 -0
- package/dist/bundler/index.d.ts +32 -0
- package/dist/bundler/index.js +143 -0
- package/dist/bundler/lint.d.ts +13 -0
- package/dist/bundler/lint.js +74 -0
- package/dist/bundler/node.d.ts +10 -0
- package/dist/bundler/node.js +55 -0
- package/dist/bundler/smoke.d.ts +12 -0
- package/dist/bundler/smoke.js +70 -0
- package/dist/bundler/worker.d.ts +31 -0
- package/dist/bundler/worker.js +214 -0
- package/dist/cli/args.d.ts +9 -0
- package/dist/cli/args.js +71 -0
- package/dist/cli/config.d.ts +38 -0
- package/dist/cli/config.js +94 -0
- package/dist/cli/convex.d.ts +9 -0
- package/dist/cli/convex.js +25 -0
- package/dist/cli/format.d.ts +11 -0
- package/dist/cli/format.js +140 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +721 -0
- package/dist/cli/keychain.d.ts +21 -0
- package/dist/cli/keychain.js +100 -0
- package/dist/cli/login-browser.d.ts +22 -0
- package/dist/cli/login-browser.js +106 -0
- package/dist/cli/mcp.d.ts +3 -0
- package/dist/cli/mcp.js +36 -0
- package/dist/cli/operations.d.ts +106 -0
- package/dist/cli/operations.js +623 -0
- package/dist/cli/sdk-package.d.ts +18 -0
- package/dist/cli/sdk-package.js +45 -0
- package/dist/cli/storage-upload.d.ts +9 -0
- package/dist/cli/storage-upload.js +21 -0
- package/dist/cli/watcher-compile.d.ts +1 -0
- package/dist/cli/watcher-compile.js +20 -0
- package/dist/cli/watcher-process.d.ts +1 -0
- package/dist/cli/watcher-process.js +312 -0
- package/dist/cli/worker-host.d.ts +10 -0
- package/dist/cli/worker-host.js +120 -0
- package/dist/cli/workspace-files.d.ts +12 -0
- package/dist/cli/workspace-files.js +91 -0
- package/dist/cli/workspace-local.d.ts +27 -0
- package/dist/cli/workspace-local.js +310 -0
- package/dist/cli/workspace-session.d.ts +13 -0
- package/dist/cli/workspace-session.js +12 -0
- package/dist/compile.d.ts +27 -0
- package/dist/compile.js +834 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +5 -0
- package/dist/schedule-validation.d.ts +1 -0
- package/dist/schedule-validation.js +16 -0
- package/dist/selector-schema.d.ts +26 -0
- package/dist/selector-schema.js +780 -0
- package/dist/selectors.d.ts +25 -0
- package/dist/selectors.js +99 -0
- package/dist/testkit.d.ts +32 -0
- package/dist/testkit.js +161 -0
- package/dist/types.d.ts +184 -0
- package/dist/types.js +110 -0
- package/node_modules/@reasonlayer/integrations/dist/catalog.d.ts +4937 -0
- package/node_modules/@reasonlayer/integrations/dist/catalog.js +20 -0
- package/node_modules/@reasonlayer/integrations/dist/generated/slack.d.ts +3014 -0
- package/node_modules/@reasonlayer/integrations/dist/generated/slack.js +3101 -0
- package/node_modules/@reasonlayer/integrations/dist/index.d.ts +2 -0
- package/node_modules/@reasonlayer/integrations/dist/index.js +1 -0
- package/node_modules/@reasonlayer/integrations/dist/internal/definitions.d.ts +44 -0
- package/node_modules/@reasonlayer/integrations/dist/internal/definitions.js +52 -0
- package/node_modules/@reasonlayer/integrations/dist/internal/transport.d.ts +7 -0
- package/node_modules/@reasonlayer/integrations/dist/internal/transport.js +48 -0
- package/node_modules/@reasonlayer/integrations/dist/testkit.d.ts +1 -0
- package/node_modules/@reasonlayer/integrations/dist/testkit.js +1 -0
- package/node_modules/@reasonlayer/integrations/package.json +26 -0
- package/node_modules/@reasonlayer/protocol/dist/dispatch.d.ts +10 -0
- package/node_modules/@reasonlayer/protocol/dist/dispatch.js +58 -0
- package/node_modules/@reasonlayer/protocol/dist/envelope.d.ts +9 -0
- package/node_modules/@reasonlayer/protocol/dist/envelope.js +1 -0
- package/node_modules/@reasonlayer/protocol/dist/environments.d.ts +7 -0
- package/node_modules/@reasonlayer/protocol/dist/environments.js +7 -0
- package/node_modules/@reasonlayer/protocol/dist/events.d.ts +313 -0
- package/node_modules/@reasonlayer/protocol/dist/events.js +20 -0
- package/node_modules/@reasonlayer/protocol/dist/index.d.ts +18 -0
- package/node_modules/@reasonlayer/protocol/dist/index.js +9 -0
- package/node_modules/@reasonlayer/protocol/dist/ir.d.ts +252 -0
- package/node_modules/@reasonlayer/protocol/dist/ir.js +116 -0
- package/node_modules/@reasonlayer/protocol/dist/permissions.d.ts +5 -0
- package/node_modules/@reasonlayer/protocol/dist/permissions.js +30 -0
- package/node_modules/@reasonlayer/protocol/dist/readmodels.d.ts +617 -0
- package/node_modules/@reasonlayer/protocol/dist/readmodels.js +36 -0
- package/node_modules/@reasonlayer/protocol/dist/runtime.d.ts +67 -0
- package/node_modules/@reasonlayer/protocol/dist/runtime.js +66 -0
- package/node_modules/@reasonlayer/protocol/dist/scheduling.d.ts +69 -0
- package/node_modules/@reasonlayer/protocol/dist/scheduling.js +126 -0
- package/node_modules/@reasonlayer/protocol/dist/selector.d.ts +23 -0
- package/node_modules/@reasonlayer/protocol/dist/selector.js +77 -0
- package/node_modules/@reasonlayer/protocol/dist/tasks.d.ts +69 -0
- package/node_modules/@reasonlayer/protocol/dist/tasks.js +6 -0
- package/node_modules/@reasonlayer/protocol/dist/validate.d.ts +6 -0
- package/node_modules/@reasonlayer/protocol/dist/validate.js +18 -0
- package/node_modules/@reasonlayer/protocol/package.json +21 -0
- package/node_modules/@reasonlayer/runner/dist/environment-materializer.d.ts +13 -0
- package/node_modules/@reasonlayer/runner/dist/environment-materializer.js +92 -0
- package/node_modules/@reasonlayer/runner/dist/flue-transcript.d.ts +17 -0
- package/node_modules/@reasonlayer/runner/dist/flue-transcript.js +182 -0
- package/node_modules/@reasonlayer/runner/dist/index.d.ts +184 -0
- package/node_modules/@reasonlayer/runner/dist/index.js +884 -0
- package/node_modules/@reasonlayer/runner/dist/mcp-supervisor.d.ts +15 -0
- package/node_modules/@reasonlayer/runner/dist/mcp-supervisor.js +142 -0
- package/node_modules/@reasonlayer/runner/dist/sandbox-env.d.ts +36 -0
- package/node_modules/@reasonlayer/runner/dist/sandbox-env.js +171 -0
- package/node_modules/@reasonlayer/runner/dist/task-child.d.ts +1 -0
- package/node_modules/@reasonlayer/runner/dist/task-child.js +72 -0
- package/node_modules/@reasonlayer/runner/package.json +21 -0
- 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>;
|