@sapiom/orchestration-core 0.1.1 → 0.2.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/CHANGELOG.md +20 -0
- package/dist/cjs/local/dispatcher.d.ts +7 -5
- package/dist/cjs/local/dispatcher.js +49 -15
- package/dist/cjs/local/run-local.d.ts +10 -4
- package/dist/cjs/local/run-local.js +31 -9
- package/dist/esm/local/dispatcher.d.ts +7 -5
- package/dist/esm/local/dispatcher.js +52 -18
- package/dist/esm/local/run-local.d.ts +10 -4
- package/dist/esm/local/run-local.js +38 -16
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/templates/coding-pause/AGENTS.md +48 -0
- package/templates/coding-pause/CLAUDE.md +7 -0
- package/templates/coding-pause/README.md +53 -0
- package/templates/coding-pause/_gitignore +3 -0
- package/templates/coding-pause/index.ts +104 -0
- package/templates/coding-pause/package.json +21 -0
- package/templates/coding-pause/tsconfig.json +12 -0
- package/templates/default/AGENTS.md +21 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__PROJECT_NAME__",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"typecheck": "tsc --noEmit",
|
|
8
|
+
"format": "prettier --write \"**/*.ts\"",
|
|
9
|
+
"format:check": "prettier --check \"**/*.ts\""
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@sapiom/orchestration": "__ORCHESTRATION_VERSION__",
|
|
13
|
+
"@sapiom/tools": "__TOOLS_VERSION__",
|
|
14
|
+
"zod": "__ZOD_VERSION__"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/node": "^20.11.30",
|
|
18
|
+
"prettier": "^3.2.5",
|
|
19
|
+
"typescript": "^5.4.2"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -23,7 +23,26 @@ When you've made a coherent change and want to validate it — the same point yo
|
|
|
23
23
|
`run_local` works with **no stubs** — capabilities return sensible defaults. Add an override only when a step's logic branches on a specific result (e.g. "if `repositories.list()` already contains my repo, skip create"). Put overrides in `.sapiom-dev/stubs.json` (committed and human-reviewable); `run_local` reads it automatically. Shape:
|
|
24
24
|
|
|
25
25
|
```jsonc
|
|
26
|
-
{ "version": 1, "steps": { "<stepName>": { "<capability.path>": <response>
|
|
26
|
+
{ "version": 1, "steps": { "<stepName>": { "<capability.path>": <response> } } }
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
Capability paths are namespace methods (`repositories.list`, `agent.coding.run`) or handle methods (`repository.pushFromSandbox`, `sandbox.exec`)
|
|
29
|
+
- Capability paths are namespace methods (`repositories.list`, `repositories.create`, `agent.coding.run`) or handle methods, which use the **singular** handle type (`repository.pushFromSandbox`, `sandbox.exec`) — not the plural namespace.
|
|
30
|
+
- `<response>` is returned **verbatim** — it is the value that call would return, so match its real shape. `repositories.list` takes the array `list()` returns: `[{ "slug": "...", "cloneUrl": "..." }]` (each element a repository — *not* `[[ … ]]`). `repositories.create`/`get`/`attach` take a single `{ "slug", "cloneUrl" }`.
|
|
31
|
+
- `run_local` reports **`unusedStubs`** (a key that matched no call — usually a typo or the plural/singular mistake) and **`stubWarnings`** (a key matched but the value was the wrong shape). A green run with either non-empty means a stub silently didn't take effect — check them.
|
|
32
|
+
|
|
33
|
+
## Dispatched runs: pause & resume
|
|
34
|
+
|
|
35
|
+
A long-running capability (today the coding agent) is launched fire-and-forget and the workflow suspends until it finishes:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
const run = await ctx.sapiom.agent.coding.launch({ task, gitRepository: repo }); // returns a handle, not a result
|
|
39
|
+
return pauseUntilSignal(run, { resumeStep: "finalize" }); // suspend on the run's result signal
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- **The resumed step's `input` IS the run's result signal payload.** Annotate it with `CodingResultPayload` (from `@sapiom/tools`) — you don't have to hand-roll the shape.
|
|
43
|
+
- That payload crossed a wire boundary, so **`sandbox` is plain `{ name, workspaceRoot }`, not a live handle** — re-attach with `ctx.sapiom.sandboxes.attach(name)` to act on it. Anything else the resumed step needs, stash in `ctx.shared` before pausing.
|
|
44
|
+
- **To stub the resume payload** (e.g. to exercise the failure branch), override `agent.coding.run` *in the launching step* — that one value is both the `run()` result and the payload the paused step resumes with. `agent.coding.launch` is accepted there too.
|
|
45
|
+
|
|
46
|
+
## Determinism
|
|
47
|
+
|
|
48
|
+
A step body runs **once** on the happy path; it re-runs only on retry (after a throw). Don't rely on a value being recomputed identically across a pause/resume — capture non-deterministic values (timestamps, ids) once and pass them forward via the `goto(...)` input or `ctx.shared`.
|