drej 0.4.0 → 0.5.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.
- package/dist/index.d.ts +124 -0
- package/dist/index.js +1096 -0
- package/package.json +20 -4
- package/CHANGELOG.md +0 -80
- package/src/client.ts +0 -684
- package/src/index.ts +0 -35
- package/src/workflow.ts +0 -214
- package/tsconfig.json +0 -12
package/package.json
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drej",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
6
16
|
"scripts": {
|
|
7
|
-
"build": "
|
|
17
|
+
"build": "tsup"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@drej/core": "workspace:*",
|
|
21
|
+
"@drej/opensandbox": "workspace:*"
|
|
8
22
|
},
|
|
9
23
|
"devDependencies": {
|
|
24
|
+
"bun-types": "latest",
|
|
25
|
+
"tsup": "^8.5.1",
|
|
10
26
|
"typescript": "latest"
|
|
11
27
|
}
|
|
12
28
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# drej
|
|
2
|
-
|
|
3
|
-
## 0.4.0
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- d0486df: Add fluent workflow builder API to TypeScript SDK.
|
|
8
|
-
|
|
9
|
-
`workflow(id)` returns a `WorkflowBuilder` with chainable `.sandbox()` and `.parallel()` methods. Inside a sandbox scope, `SandboxStepBuilder` provides `.exec()`, `.writeFile()`, `.retry()`, `.forEach()`, `.when()`, and `.parallel()`. The `forEach` callback receives `(s, item)` where `item` serialises to `{{name}}` in template literals, enabling natural JS interpolation. Top-level `.parallel()` supports multiple concurrent sandbox sessions via `WorkflowParallelBuilder`. `DrejClient.run(w)` accepts a built workflow directly. The `sandbox()` helper defaults the entrypoint to `["tail", "-f", "/dev/null"]`.
|
|
10
|
-
|
|
11
|
-
Adds a server-side `sequence` step type that runs child steps sequentially, used internally by the builder to represent multi-step parallel branches.
|
|
12
|
-
|
|
13
|
-
- e1f9bb8: Add `snapshotConfig` option to `client.run()` and a `replayFromSnapshot()` method.
|
|
14
|
-
|
|
15
|
-
Pass `snapshotConfig: { afterSteps?: number[]; everyNSteps?: number }` to capture sandbox snapshots at specific points in a workflow. Call `client.replayFromSnapshot(name, runId, workflow)` to start a new run booted from the latest captured snapshot — skipping any setup steps already baked into the image.
|
|
16
|
-
|
|
17
|
-
- 9a30c31: Introduce per-run ledger with workflow name / run ID separation.
|
|
18
|
-
|
|
19
|
-
Each workflow execution now has a stable **workflow name** (user-defined) and an auto-generated **run ID** (UUID). Ledger files are stored at `ledgers/<name>/<runId>.ndjson` so all runs of a workflow are grouped together.
|
|
20
|
-
|
|
21
|
-
API changes:
|
|
22
|
-
|
|
23
|
-
- `POST /v1/workflows/:name/runs` — starts a run; first SSE event is `run_started` carrying the run ID
|
|
24
|
-
- `POST /v1/workflows/:name/runs/:runId/resume` — resumes a specific run
|
|
25
|
-
- `GET /v1/workflows/:name/runs` — lists all run IDs for a workflow
|
|
26
|
-
- `GET /v1/workflows/:name/runs/:runId/ledger` — fetches ledger for a specific run
|
|
27
|
-
|
|
28
|
-
SDK changes:
|
|
29
|
-
|
|
30
|
-
- `client.run(w)` is now `async` and returns `Promise<WorkflowRun>`; `run.id` gives the run ID, `run.name` the workflow name, and it is async-iterable for events
|
|
31
|
-
- `client.resumeRun(name, runId, w)` resumes a run
|
|
32
|
-
- `client.listWorkflowRuns(name)` lists runs
|
|
33
|
-
- `client.getWorkflowLedger(name, runId)` fetches the ledger
|
|
34
|
-
- `WorkflowEvent` fields renamed: `workflowId` → `workflowName` + `runId`
|
|
35
|
-
|
|
36
|
-
### Patch Changes
|
|
37
|
-
|
|
38
|
-
- b3c0bc9: feat: lifecycle hooks, append-only WAL, and clean adapter layer
|
|
39
|
-
|
|
40
|
-
- Add `WorkflowHooks` interface with `onStepStart`, `onStepComplete`, `onStepFailed`, `onStepRolledBack`, `onWorkflowComplete`, `onWorkflowFailed` callbacks on `WorkflowDeps`
|
|
41
|
-
- Fix `NdjsonLedger.append` to use `appendFileSync` (O_APPEND) instead of read-then-overwrite (O_TRUNC), preventing ledger truncation on crash
|
|
42
|
-
- Make `NdjsonLedger.readAll` resilient to malformed lines from partial writes
|
|
43
|
-
- Add `OpenSandboxControlAdapter` and `OpenSandboxExecFactory` to `@drej/opensandbox` — concrete implementations of `ISandboxControl` and `IExecClientFactory` that encapsulate execd readiness polling
|
|
44
|
-
- Remove `as unknown as` double-cast from `apps/api`; adapter wiring is now explicit and type-safe
|
|
45
|
-
|
|
46
|
-
## 0.3.0
|
|
47
|
-
|
|
48
|
-
### Minor Changes
|
|
49
|
-
|
|
50
|
-
- 6256955: Add retry, conditional, loop, and parallel step types to the workflow engine.
|
|
51
|
-
|
|
52
|
-
- `retry` — retries a child step up to N times with fixed or exponential backoff
|
|
53
|
-
- `conditional` — branches on a structured predicate (`eq`, `neq`, `gt`, `lt`, `exists`, `and`, `or`) evaluated against workflow state
|
|
54
|
-
- `loop` — iterates over a static `items` array or a dot-path `over` pointing to an array in state; supports `concurrently` flag for parallel iterations
|
|
55
|
-
- `parallel` — fans out multiple steps with `Promise.all`; emits events with a `branch` index for demuxing
|
|
56
|
-
- `{{key}}` interpolation in `exec_command` so loop items and other state values can be referenced in command strings
|
|
57
|
-
- `branch` field added to `WorkflowEvent` to identify parallel branch origin
|
|
58
|
-
- `Predicate` type exported from the SDK for use with `conditional` steps
|
|
59
|
-
|
|
60
|
-
- 2da4112: Add workflow engine support: `runWorkflow()` now supports `create_sandbox`, `exec_code`, `exec_command`, and `delete_sandbox` step types with SSE streaming and saga rollback.
|
|
61
|
-
- eb72eea: Add `write_file` workflow step type and always base64-encode `exec_command` strings.
|
|
62
|
-
|
|
63
|
-
- `write_file` step writes text or binary content to a path inside the sandbox; accepts `encoding: "utf8"` (default) or `"base64"` for binary files
|
|
64
|
-
- `exec_command` now unconditionally base64-encodes the command string before sending to the container, eliminating all quoting and special-character edge cases
|
|
65
|
-
|
|
66
|
-
## 0.2.1
|
|
67
|
-
|
|
68
|
-
### Patch Changes
|
|
69
|
-
|
|
70
|
-
- 5278aa9: Add `DrejError` and `run()` to the Python SDK, matching the TypeScript SDK's interface.
|
|
71
|
-
|
|
72
|
-
## 0.2.0
|
|
73
|
-
|
|
74
|
-
### Minor Changes
|
|
75
|
-
|
|
76
|
-
- c3fe034: Add `DrejClient.run(code)` method and `SandboxRunResult` type for submitting code to the sandbox execution endpoint.
|
|
77
|
-
|
|
78
|
-
### Patch Changes
|
|
79
|
-
|
|
80
|
-
- 3316570: Add `DrejError` class with HTTP status code — errors from API calls now throw `DrejError` instead of a generic `Error`.
|