sley
Build, change, debug, or review in-process workflow graphs with Sley in Python or TypeScript. Applies when code imports `sley` or `@jigging/sley`, or the request explicitly names Sley.
- License 许可
- MPL-2.0
- 所属仓库
- jiggy/jig
- 最近更新
- 2026-11-14
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- sley
- license
- MPL-2.0
- description
- Build, change, debug, or review in-process workflow graphs with Sley in Python or TypeScript. Applies when code imports `sley` or `@jigging/sley`, or the request explicitly names Sley.
02 资源文件 9
- 参考文档guides/concurrency-and-cycles.md5.8 KB
- 参考文档guides/inspection.md3.3 KB
- 参考文档guides/integration-boundaries.md5.1 KB
- 参考文档guides/retry-and-recovery.md7.8 KB
- 参考文档guides/testing.md4.9 KB
- 参考文档guides/validation-and-types.md4.6 KB
- 参考文档reference/python.md12.2 KB
- 参考文档reference/runtime-semantics.md13.0 KB
- 参考文档reference/typescript.md12.7 KB
03 SKILL.md 正文
Sley
Make the workflow's meaningful paths visible while leaving local work as ordinary code. A graph earns its place only when it is easier to scan than the conditions, callbacks, or counters it replaces.
Choose the path
- For Python construction, typing, results, or errors, search reference/python.md for the public name in use.
- For JavaScript or TypeScript construction, typing, results, or errors, search reference/typescript.md for the public name in use.
- For graph definitions, control, routing, settlement, fan-out, combine, nested Flows, scheduling, results, failures, or intentional limits, search reference/runtime-semantics.md for the relevant heading.
- For application schemas and payload trust boundaries, read guides/validation-and-types.md.
- For bounded parallelism, shared-state safety, or loops, read guides/concurrency-and-cycles.md.
- For transient operations and fallback policy, read guides/retry-and-recovery.md.
- For compiled topology and terminal evidence, read guides/inspection.md.
- For services, blocking work, shared clients, or provider limits, read guides/integration-boundaries.md.
- For verification strategy and failure assertions, read guides/testing.md.
Build the graph
- Trace the existing workflow from inputs to observable outcomes. Keep helper calls and local conditions as ordinary code.
- Create a Node only for a meaningful workflow step, decision, retry boundary, or independently scheduled unit of work.
- Put whole-run facts in
context.state. Carry branch-specific work throughcontext.input. Usecontext.end(value)only for a completed branch value that must settle or be combined. - Connect each allowed transition with
source.link(target, action?). The target is required; the optional action names the decision outcome. - Route with
context.emit(...). A successful Node with no control call takes its unlabelled path. A leaf with no matching unlabelled link exits its Flow normally and needs noend(). - Wrap the entry element in a Flow. Use
run(initialState)for the final shared state andstart(initialState).result()only when terminal or failure detail is required.
Handlers communicate through state, input, emissions, and terminal outputs.
They return no application value. Control calls buffer intent and do not stop
the function; use the host language's return when later statements must not
run.
Keep the boundary honest
- Sley owns in-process graph execution. The application owns payload validation, storage, service policy, timeouts, persistence, tracing, and distribution.
- Each run shallow-copies the initial top-level state once. Every branch shares that run-owned state, including nested object references. Coordinate concurrent writes exactly as ordinary concurrent code requires.
- Prefer branch inputs and terminal outputs over shared counters or result lists when work fans out.
- Validate untrusted state or input before writes, effects, or control calls.
- Pair fan-out with the Flow that owns its
combineboundary. Nest around owned behavior or policy, not file organization. - Give every cycle a domain exit and an explicit activation guard.
- Put retry around the smallest safe repeatable operation. Recover at the smallest boundary with enough context to choose the fallback.
Completion criterion
Finish when every changed route has an observable check, the project's existing type and test commands pass, and every remaining Node represents topology or runtime policy that an ordinary function call would hide.