@reasonlayer/sdk 0.0.1-rc.3
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/node.d.ts +10 -0
- package/dist/bundler/node.js +55 -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/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/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/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,21 @@
|
|
|
1
|
+
export declare class KeychainUnavailableError extends Error {
|
|
2
|
+
constructor(message: string, options?: {
|
|
3
|
+
cause?: unknown;
|
|
4
|
+
});
|
|
5
|
+
}
|
|
6
|
+
export declare class KeychainAccessError extends Error {
|
|
7
|
+
constructor(message: string, options?: {
|
|
8
|
+
cause?: unknown;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
/** Secret store keyed by account (we pass the Convex deployment URL). */
|
|
12
|
+
export interface KeychainBackend {
|
|
13
|
+
get(account: string): Promise<string | null>;
|
|
14
|
+
set(account: string, secret: string): Promise<void>;
|
|
15
|
+
delete(account: string): Promise<boolean>;
|
|
16
|
+
}
|
|
17
|
+
/** Test seam: swap the OS keychain for an in-memory backend. */
|
|
18
|
+
export declare function setKeychainBackend(backend: KeychainBackend | undefined): void;
|
|
19
|
+
export declare function getToken(account: string): Promise<string | null>;
|
|
20
|
+
export declare function setToken(account: string, token: string): Promise<void>;
|
|
21
|
+
export declare function deleteToken(account: string): Promise<boolean>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OS keychain wrapper for the CLI's bearer token. The engine and dashboard tie
|
|
3
|
+
* identity to WorkOS/scoped tokens (spec §11); this keeps the human token out
|
|
4
|
+
* of a plaintext dotfile and in the platform secret store (macOS Keychain,
|
|
5
|
+
* Windows Credential Manager, Linux Secret Service).
|
|
6
|
+
*
|
|
7
|
+
* Keyed by the Convex deployment URL so one machine can hold tokens for several
|
|
8
|
+
* deployments. `get` returns `null` (not an error) when no token is stored.
|
|
9
|
+
* Failures split into two kinds so callers can act on the difference:
|
|
10
|
+
* - {@link KeychainUnavailableError}: the keychain module cannot load at all
|
|
11
|
+
* (unsupported platform / missing native binary). Callers fall through to
|
|
12
|
+
* the RL_TOKEN env path.
|
|
13
|
+
* - {@link KeychainAccessError}: a keychain is present but rejected the
|
|
14
|
+
* operation (locked, prompt denied, ambiguous credential, no storage
|
|
15
|
+
* backend). Callers surface a diagnostic — this is never silently a token
|
|
16
|
+
* "not found".
|
|
17
|
+
*/
|
|
18
|
+
const SERVICE = "reasonlayer-cli";
|
|
19
|
+
export class KeychainUnavailableError extends Error {
|
|
20
|
+
constructor(message, options) {
|
|
21
|
+
super(message, options);
|
|
22
|
+
this.name = "KeychainUnavailableError";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export class KeychainAccessError extends Error {
|
|
26
|
+
constructor(message, options) {
|
|
27
|
+
super(message, options);
|
|
28
|
+
this.name = "KeychainAccessError";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
let override;
|
|
32
|
+
/** Test seam: swap the OS keychain for an in-memory backend. */
|
|
33
|
+
export function setKeychainBackend(backend) {
|
|
34
|
+
override = backend;
|
|
35
|
+
}
|
|
36
|
+
let entryCtor;
|
|
37
|
+
async function loadEntryCtor() {
|
|
38
|
+
if (entryCtor)
|
|
39
|
+
return entryCtor;
|
|
40
|
+
try {
|
|
41
|
+
const mod = await import("@napi-rs/keyring");
|
|
42
|
+
entryCtor = mod.Entry;
|
|
43
|
+
return entryCtor;
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
throw new KeychainUnavailableError("the OS keychain module could not be loaded", {
|
|
47
|
+
cause: err,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function reason(err) {
|
|
52
|
+
return err instanceof Error ? err.message : String(err);
|
|
53
|
+
}
|
|
54
|
+
function osBackend() {
|
|
55
|
+
return {
|
|
56
|
+
async get(account) {
|
|
57
|
+
const Entry = await loadEntryCtor();
|
|
58
|
+
try {
|
|
59
|
+
return new Entry(SERVICE, account).getPassword();
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
throw new KeychainAccessError(`could not read from the OS keychain (${reason(err)})`, {
|
|
63
|
+
cause: err,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
async set(account, secret) {
|
|
68
|
+
const Entry = await loadEntryCtor();
|
|
69
|
+
try {
|
|
70
|
+
new Entry(SERVICE, account).setPassword(secret);
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
throw new KeychainAccessError(`could not write to the OS keychain (${reason(err)})`, {
|
|
74
|
+
cause: err,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
async delete(account) {
|
|
79
|
+
const Entry = await loadEntryCtor();
|
|
80
|
+
try {
|
|
81
|
+
return new Entry(SERVICE, account).deletePassword();
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function backend() {
|
|
90
|
+
return override ?? osBackend();
|
|
91
|
+
}
|
|
92
|
+
export function getToken(account) {
|
|
93
|
+
return backend().get(account);
|
|
94
|
+
}
|
|
95
|
+
export function setToken(account, token) {
|
|
96
|
+
return backend().set(account, token);
|
|
97
|
+
}
|
|
98
|
+
export function deleteToken(account) {
|
|
99
|
+
return backend().delete(account);
|
|
100
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
import { type BuildManifest } from "../bundler/index.js";
|
|
3
|
+
import type { RlConfig } from "./config.js";
|
|
4
|
+
export interface RunOptions {
|
|
5
|
+
workflowId: string;
|
|
6
|
+
input: unknown;
|
|
7
|
+
runKey?: string;
|
|
8
|
+
wait: boolean;
|
|
9
|
+
pollIntervalMs: number;
|
|
10
|
+
timeoutMs: number;
|
|
11
|
+
/** Test seam; production uses real timers. */
|
|
12
|
+
sleep?: (ms: number) => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export interface DevRunOptions {
|
|
15
|
+
workflow: string;
|
|
16
|
+
input: unknown;
|
|
17
|
+
runKey?: string;
|
|
18
|
+
pollIntervalMs: number;
|
|
19
|
+
timeoutMs: number;
|
|
20
|
+
concurrency?: number;
|
|
21
|
+
signal?: AbortSignal;
|
|
22
|
+
onRunCreated?: (created: {
|
|
23
|
+
runId: string;
|
|
24
|
+
deduped: boolean;
|
|
25
|
+
}) => void;
|
|
26
|
+
}
|
|
27
|
+
export interface RlClient {
|
|
28
|
+
query<T>(name: string, args: Record<string, unknown>): Promise<T>;
|
|
29
|
+
mutation<T>(name: string, args: Record<string, unknown>): Promise<T>;
|
|
30
|
+
action<T>(name: string, args: Record<string, unknown>): Promise<T>;
|
|
31
|
+
}
|
|
32
|
+
export interface OperationRuntime {
|
|
33
|
+
config: RlConfig;
|
|
34
|
+
client: RlClient;
|
|
35
|
+
}
|
|
36
|
+
export declare function createOperationRuntime(config: RlConfig, client?: RlClient): OperationRuntime;
|
|
37
|
+
export declare const DEFAULT_POLL_INTERVAL_MS = 1000;
|
|
38
|
+
export declare const DEFAULT_RUN_TIMEOUT_MS = 600000;
|
|
39
|
+
export declare function validateWorkflow(entry: string): Promise<{
|
|
40
|
+
ok: true;
|
|
41
|
+
manifest: BuildManifest;
|
|
42
|
+
ir: unknown;
|
|
43
|
+
} | {
|
|
44
|
+
ok: false;
|
|
45
|
+
errors: {
|
|
46
|
+
stepId?: string;
|
|
47
|
+
message: string;
|
|
48
|
+
}[];
|
|
49
|
+
}>;
|
|
50
|
+
export declare function buildProject(entry: string, outDir: string): Promise<{
|
|
51
|
+
ok: true;
|
|
52
|
+
manifest: BuildManifest;
|
|
53
|
+
outDir: string;
|
|
54
|
+
} | {
|
|
55
|
+
ok: false;
|
|
56
|
+
errors: {
|
|
57
|
+
stepId?: string;
|
|
58
|
+
message: string;
|
|
59
|
+
}[];
|
|
60
|
+
}>;
|
|
61
|
+
export declare function runWorkflow(runtime: OperationRuntime, options: RunOptions): Promise<unknown>;
|
|
62
|
+
export declare function devWorkflow(runtime: OperationRuntime, options: DevRunOptions): Promise<{
|
|
63
|
+
ok: false;
|
|
64
|
+
errors: {
|
|
65
|
+
stepId?: string;
|
|
66
|
+
message: string;
|
|
67
|
+
}[];
|
|
68
|
+
} | ({
|
|
69
|
+
ok: true;
|
|
70
|
+
testArtifactId: string;
|
|
71
|
+
expiresAt: number;
|
|
72
|
+
deduped: boolean;
|
|
73
|
+
} & Record<string, unknown>)>;
|
|
74
|
+
export type OperationSurface = "cli";
|
|
75
|
+
export interface OperationRunContext {
|
|
76
|
+
runtime?: OperationRuntime;
|
|
77
|
+
}
|
|
78
|
+
/** A backend function this operation forwards to, with the org token attached. */
|
|
79
|
+
export interface OperationCall {
|
|
80
|
+
kind: "query" | "mutation" | "action";
|
|
81
|
+
fn: string;
|
|
82
|
+
}
|
|
83
|
+
interface OperationCommon {
|
|
84
|
+
name: string;
|
|
85
|
+
title: string;
|
|
86
|
+
description: string;
|
|
87
|
+
inputSchema: Record<string, z.ZodType>;
|
|
88
|
+
surfaces: readonly OperationSurface[];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* An operation either forwards its parsed input to one backend function
|
|
92
|
+
* (`call`) or has a local implementation deep enough to name (`run`).
|
|
93
|
+
*/
|
|
94
|
+
export type OperationDefinition = (OperationCommon & {
|
|
95
|
+
call: OperationCall;
|
|
96
|
+
run?: undefined;
|
|
97
|
+
}) | (OperationCommon & {
|
|
98
|
+
call?: undefined;
|
|
99
|
+
run: (ctx: OperationRunContext, args: Record<string, unknown>) => Promise<unknown>;
|
|
100
|
+
});
|
|
101
|
+
export declare function runOperation(operation: OperationDefinition, ctx: OperationRunContext, args: Record<string, unknown>): Promise<unknown>;
|
|
102
|
+
export declare const operationTable: OperationDefinition[];
|
|
103
|
+
export declare function operationsForSurface(surface: OperationSurface): OperationDefinition[];
|
|
104
|
+
export declare function operationByName(name: string): OperationDefinition | undefined;
|
|
105
|
+
export declare function operationForSurfaceByName(surface: OperationSurface, name: string): OperationDefinition | undefined;
|
|
106
|
+
export {};
|