@sublang/slc 0.1.0 → 0.3.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/README.md +126 -94
- package/dist/app.d.ts +13 -2
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +60 -11
- package/dist/app.js.map +1 -1
- package/dist/cligent-agent.d.ts +19 -0
- package/dist/cligent-agent.d.ts.map +1 -1
- package/dist/cligent-agent.js +125 -30
- package/dist/cligent-agent.js.map +1 -1
- package/dist/compiled-executor.d.ts +6 -0
- package/dist/compiled-executor.d.ts.map +1 -1
- package/dist/compiled-executor.js +1 -0
- package/dist/compiled-executor.js.map +1 -1
- package/dist/config-file.d.ts +9 -0
- package/dist/config-file.d.ts.map +1 -1
- package/dist/config-file.js +28 -2
- package/dist/config-file.js.map +1 -1
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +12 -2
- package/dist/config.js.map +1 -1
- package/dist/emitted-imports.d.ts +6 -0
- package/dist/emitted-imports.d.ts.map +1 -0
- package/dist/emitted-imports.js +36 -0
- package/dist/emitted-imports.js.map +1 -0
- package/dist/entry-module.d.ts.map +1 -1
- package/dist/entry-module.js +3 -1
- package/dist/entry-module.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/playbook-ports.d.ts +8 -0
- package/dist/playbook-ports.d.ts.map +1 -1
- package/dist/playbook-ports.js +14 -2
- package/dist/playbook-ports.js.map +1 -1
- package/dist/progress.d.ts +71 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +96 -0
- package/dist/progress.js.map +1 -0
- package/dist/runner.d.ts +6 -0
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +71 -1
- package/dist/runner.js.map +1 -1
- package/dist/slc.config.template.yaml +5 -1
- package/package.json +8 -5
- package/dist/file-capability.d.ts +0 -46
- package/dist/file-capability.d.ts.map +0 -1
- package/dist/file-capability.js +0 -234
- package/dist/file-capability.js.map +0 -1
- package/dist/file-grants.d.ts +0 -79
- package/dist/file-grants.d.ts.map +0 -1
- package/dist/file-grants.js +0 -133
- package/dist/file-grants.js.map +0 -1
package/README.md
CHANGED
|
@@ -3,51 +3,73 @@
|
|
|
3
3
|
|
|
4
4
|
# slc
|
|
5
5
|
|
|
6
|
+
[](https://www.npmjs.com/package/@sublang/slc)
|
|
7
|
+
[](https://nodejs.org/)
|
|
6
8
|
[](https://github.com/sublang-ai/slc/actions/workflows/ci.yml)
|
|
7
9
|
|
|
8
|
-
_The SubLang Compiler:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
10
|
+
_The SubLang Compiler: describe a workflow in a paragraph of prose, get a
|
|
11
|
+
deterministic multi-agent program you can inspect, verify, and run._
|
|
12
|
+
|
|
13
|
+
You write what should happen — in English or Chinese, no DSL, no
|
|
14
|
+
orchestration framework. `slc` compiles that paragraph into a spec, a
|
|
15
|
+
state machine, and a runnable **playbook** that drives AI coding agents
|
|
16
|
+
through it. Why compile prose instead of prompting with it:
|
|
17
|
+
|
|
18
|
+
- **Deterministic where it matters.** Who acts, in what order, when to
|
|
19
|
+
stop — the control flow becomes an inspectable
|
|
20
|
+
[XState](https://xstate.js.org) machine, not prompt improvisation.
|
|
21
|
+
LLM judgment is confined to the work *inside* each state.
|
|
22
|
+
- **Auditable at every stage.** The intermediates are first-class files
|
|
23
|
+
you can read and edit: the normalized text, one testable "shall" item
|
|
24
|
+
per behavior (in the GEARS spec grammar the SubLang stack shares), and
|
|
25
|
+
the state machine itself. The compiler also emits verification tests
|
|
26
|
+
binding its output to the source spec.
|
|
27
|
+
- **Cheaper and safer by optimization.** Steps that need no judgment are
|
|
28
|
+
rewritten at compile time into plain shell commands — no LLM call, no
|
|
29
|
+
hallucination, verifiable before anything runs.
|
|
30
|
+
- **Your agents, per role.** Compilation and execution run through the
|
|
31
|
+
agent CLIs you already use — Claude Code, Codex, Gemini, OpenCode —
|
|
32
|
+
selectable per role.
|
|
33
|
+
|
|
34
|
+
The flagship pipeline is `playbook` (the name of both the pipeline and
|
|
35
|
+
the sibling [playbook](https://github.com/sublang-ai/playbook) project
|
|
36
|
+
that executes its output): prose → GEARS spec items → XState machine →
|
|
37
|
+
a linked module the `playbook` CLI runs.
|
|
38
|
+
|
|
39
|
+
## See it run
|
|
40
|
+
|
|
41
|
+
The [demo](demo/README.md) compiles a one-paragraph description into a
|
|
42
|
+
two-agent code-review loop, then lets it loose on a buggy C file: the
|
|
43
|
+
coder and reviewer commit, review, and debate inside a real Git
|
|
44
|
+
repository until the review comes back clean. Precompiled reference
|
|
45
|
+
artifacts are included, so you can watch a run — or just read every
|
|
46
|
+
compile stage — without waiting on a compile.
|
|
36
47
|
|
|
37
48
|
## Install
|
|
38
49
|
|
|
39
|
-
Install the compiler and Playbook runtime in the project that will contain the
|
|
40
|
-
generated artifacts:
|
|
41
|
-
|
|
42
50
|
```bash
|
|
43
|
-
npm install
|
|
44
|
-
|
|
51
|
+
npm install -g @sublang/slc @sublang/playbook
|
|
52
|
+
npm install -g @anthropic-ai/claude-agent-sdk @openai/codex-sdk
|
|
53
|
+
slc --version
|
|
45
54
|
```
|
|
46
55
|
|
|
47
|
-
The
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
The second line supplies the agent SDKs for the default Claude and Codex
|
|
57
|
+
lineup. Playbook 4 installs none itself — which versions work is
|
|
58
|
+
`@sublang/cligent`'s to enforce at load — so name the SDKs your own
|
|
59
|
+
configuration needs. If one is missing, the compile stops before any
|
|
60
|
+
agent call and names the package to install; if one is too old, it
|
|
61
|
+
names the installed and required versions along with the exact version
|
|
62
|
+
to install.
|
|
63
|
+
|
|
64
|
+
Compiled artifacts import the Playbook engine from their own directory;
|
|
65
|
+
when that import does not resolve, `playbook run` (3.1+) links its own
|
|
66
|
+
engine beside the artifact and says so (`--no-provision` opts out).
|
|
67
|
+
Working inside an npm project instead? Install the same set there — the
|
|
68
|
+
compiler, the engine, and the SDKs your lineup uses — and prefix the
|
|
69
|
+
commands with `npx`. A project's own install is always authoritative,
|
|
70
|
+
and a globally installed SDK is invisible to a project's nested
|
|
71
|
+
`@sublang/cligent`, so the SDKs belong in the same tree
|
|
72
|
+
([RELEASE-11](specs/dev/release.md#release-11) has the full rules).
|
|
51
73
|
|
|
52
74
|
Requirements:
|
|
53
75
|
|
|
@@ -64,32 +86,50 @@ Requirements:
|
|
|
64
86
|
|
|
65
87
|
## Quick start
|
|
66
88
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
89
|
+
In any directory, write a prose workflow as a `.md` or plain `.txt`
|
|
90
|
+
file — [`demo/workflow.txt`](demo/workflow.txt) is a complete
|
|
91
|
+
one-paragraph example — and compile it:
|
|
70
92
|
|
|
71
93
|
```bash
|
|
72
|
-
|
|
94
|
+
slc playbook my-workflow.md
|
|
73
95
|
```
|
|
74
96
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
`
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
97
|
+
`slc` finds the `playbook` pipeline inside its own `@sublang/playbook`
|
|
98
|
+
dependency, so it compiles in any directory — no clone, no project
|
|
99
|
+
setup. Compilation drives your configured coding agent — the first run
|
|
100
|
+
seeds `~/.config/slc/config.yaml` with `agent: claude-code`; set
|
|
101
|
+
`SLC_AGENT` (or edit that file) to use another agent CLI. Expect it to
|
|
102
|
+
take a while: duration is agent- and workload-dependent, and measured
|
|
103
|
+
compiles of a five-line workflow have run from tens of minutes to more
|
|
104
|
+
than two hours, with the first intermediate typically landing within
|
|
105
|
+
about five minutes. Plain-text input (`.txt`) works too; it is
|
|
106
|
+
normalized first. The pipeline's optimization pass, which rewrites
|
|
107
|
+
judgment-free steps into plain script, runs by default
|
|
108
|
+
(`--no-optimize` skips it).
|
|
109
|
+
|
|
110
|
+
Artifacts land in your working directory: `my-workflow.playbook/` holds
|
|
111
|
+
the intermediates — `my-workflow.gears.md`, the XState machine
|
|
112
|
+
`my-workflow.fsm.ts`, the linked runtime module, and its verification
|
|
113
|
+
tests — and `my-workflow.ts` is the runnable entry. Run it:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
playbook run ./my-workflow.ts "<your task>"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Intermediates are first-class: edit one and re-run a single phase
|
|
120
|
+
(`slc playbook.gears2fsm …`) and it lands in the same place.
|
|
121
|
+
`slc --help` shows all invocation forms.
|
|
122
|
+
|
|
123
|
+
While a compile runs, `slc` reports progress on stderr: each phase as it
|
|
124
|
+
starts, each artifact as it lands with the elapsed time, the compiled
|
|
125
|
+
runtime's own state transitions, and a heartbeat so the terminal is
|
|
126
|
+
never silent for more than 30 seconds. An agent call that goes quiet for
|
|
127
|
+
`stallTimeout` seconds (default 600, `0` disables) is aborted and
|
|
128
|
+
reported as a failed phase rather than hanging indefinitely.
|
|
129
|
+
|
|
130
|
+
Success prints the written artifact paths to stdout and exits 0; a
|
|
131
|
+
failure prints diagnostics to stderr — naming the failing phase when one
|
|
132
|
+
is at fault — and exits non-zero.
|
|
93
133
|
|
|
94
134
|
## Configuration
|
|
95
135
|
|
|
@@ -104,30 +144,16 @@ and `pipelinePath` to the working directory.
|
|
|
104
144
|
# slc.config.yaml
|
|
105
145
|
agent: claude-code # claude-code | codex | gemini | opencode
|
|
106
146
|
model: claude-opus-4-8 # optional; omit to use the agent CLI's default
|
|
147
|
+
stallTimeout: 600 # seconds of agent silence before a stalled call fails
|
|
107
148
|
pipelinePath: # search roots for <pipeline> references; defaults to the cwd
|
|
108
149
|
- ./pipelines
|
|
109
150
|
```
|
|
110
151
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
`slc --config <path>` loads a specific file and disables discovery; a `--config`
|
|
117
|
-
path that does not exist is an error, whereas a discovery miss simply falls
|
|
118
|
-
through to the environment and defaults. Unknown keys, malformed YAML, and
|
|
119
|
-
wrong-typed values are rejected.
|
|
120
|
-
|
|
121
|
-
The matching environment variables, which override the file per key, are:
|
|
122
|
-
|
|
123
|
-
| Variable | Overrides | Meaning |
|
|
124
|
-
| --- | --- | --- |
|
|
125
|
-
| `SLC_AGENT` | `agent` | agent CLI: `claude-code`, `codex`, `gemini`, `opencode` |
|
|
126
|
-
| `SLC_MODEL` | `model` | optional model for the agent CLI |
|
|
127
|
-
| `SLC_PIPELINE_PATH` | `pipelinePath` | OS path-list of search roots (default: cwd) |
|
|
128
|
-
|
|
129
|
-
Credentials are read by the agent CLI from the inherited process environment.
|
|
130
|
-
Run `slc --help` for the full invocation and configuration summary.
|
|
152
|
+
A `slc.config.yaml` in the working directory wins over the user config;
|
|
153
|
+
`SLC_AGENT`, `SLC_MODEL`, `SLC_STALL_TIMEOUT`, and `SLC_PIPELINE_PATH`
|
|
154
|
+
override either per key. Discovery order, `--config`, and validation
|
|
155
|
+
rules live in the [CLI spec](specs/user/cli.md); `slc --help` prints the
|
|
156
|
+
summary.
|
|
131
157
|
|
|
132
158
|
## How pipelines work
|
|
133
159
|
|
|
@@ -135,21 +161,23 @@ A pipeline is a directory of phase definitions named
|
|
|
135
161
|
`<source-format>2<target-format>.md`, each declaring its formats in a
|
|
136
162
|
`## Formats` table, plus an optional `link.md` defining the terminal
|
|
137
163
|
link phase. `slc` infers phase order by chaining formats — no
|
|
138
|
-
manifest — and refuses incomplete, branching, or cyclic chains.
|
|
139
|
-
|
|
140
|
-
|
|
164
|
+
manifest — and refuses incomplete, branching, or cyclic chains. Adding
|
|
165
|
+
a phase means writing a definition, never changing the compiler: `slc`
|
|
166
|
+
itself performs only the generic mechanics of chaining, validation, and
|
|
167
|
+
artifact placement. The bundled `playbook` pipeline chains `text2gears`
|
|
168
|
+
and `gears2fsm`, with `link` emitting the runnable runtime.
|
|
141
169
|
|
|
142
170
|
Every phase runs through a coding agent, one of two ways:
|
|
143
171
|
|
|
144
172
|
- **Interpreted** — the configured agent reads the definition and
|
|
145
|
-
performs it.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
173
|
+
performs it. This is how an npm-installed `slc` runs the `playbook`
|
|
174
|
+
pipeline, using the definitions shipped inside `@sublang/playbook`.
|
|
175
|
+
- **Compiled** — the phase's own compiled playbook artifact drives the
|
|
176
|
+
agent through audited state-machine steps. This repository's checkout
|
|
177
|
+
runs its bundled phases this way: `slc` is self-hosting, its phase
|
|
178
|
+
definitions compiled, reviewed, and sha256-pinned under
|
|
179
|
+
[`pipelines/playbook/`](pipelines/playbook), failing closed on drift
|
|
180
|
+
([self-hosting spec](specs/user/self-hosting.md)).
|
|
153
181
|
|
|
154
182
|
Specs are the source of truth — start at the
|
|
155
183
|
[spec map](specs/map.md).
|
|
@@ -163,8 +191,9 @@ Specs are the source of truth — start at the
|
|
|
163
191
|
coding-agent SDK `slc` executes phases through.
|
|
164
192
|
- [playbook](https://github.com/sublang-ai/playbook) — authors the
|
|
165
193
|
`playbook` pipeline's phase specs and runs the compiled output.
|
|
166
|
-
- [spex](https://github.com/sublang-ai/spex) — the
|
|
167
|
-
invokes `slc` for its in-app playbook
|
|
194
|
+
- [spex](https://github.com/sublang-ai/spex) — the spec tool that owns
|
|
195
|
+
the shared GEARS grammar and invokes `slc` for its in-app playbook
|
|
196
|
+
compile flow.
|
|
168
197
|
|
|
169
198
|
## Develop
|
|
170
199
|
|
|
@@ -175,8 +204,11 @@ npm test
|
|
|
175
204
|
npm run lint
|
|
176
205
|
```
|
|
177
206
|
|
|
178
|
-
|
|
179
|
-
|
|
207
|
+
A checkout's own [`slc.config.yaml`](slc.config.yaml) routes the
|
|
208
|
+
`playbook` pipeline to the bundled copy under `pipelines/`, so repo
|
|
209
|
+
compiles exercise the pinned artifacts. CI additionally re-verifies the
|
|
210
|
+
compiled meta-phase bundles and checks that pin regeneration is
|
|
211
|
+
byte-identical to the committed index.
|
|
180
212
|
|
|
181
213
|
## Contributing
|
|
182
214
|
|
package/dist/app.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createConfiguredCompiledFactory, createConfiguredExecutor, type AgentSelection } from './config.js';
|
|
2
2
|
import { type FileConfig } from './config-file.js';
|
|
3
|
+
import { type ProgressSink } from './progress.js';
|
|
3
4
|
import { type SlcDeps } from './runner.js';
|
|
4
5
|
/** The program name. */
|
|
5
6
|
export declare const name = "slc";
|
|
@@ -14,6 +15,8 @@ export type DepsBuilder = (io: {
|
|
|
14
15
|
configPath?: string;
|
|
15
16
|
/** Sink for host notes such as first-run config seeding (DR-015, CLI-30). */
|
|
16
17
|
note?: (text: string) => void;
|
|
18
|
+
/** The run's progress sink, rendered to stderr by the bin (DR-019, CLI-35). */
|
|
19
|
+
progress?: ProgressSink;
|
|
17
20
|
}) => SlcDeps | Promise<SlcDeps>;
|
|
18
21
|
/** Injectable IO and configuration for {@link run}; all fields default to the process. */
|
|
19
22
|
export interface RunOptions {
|
|
@@ -46,19 +49,27 @@ export type CompiledFactoryBuilder = typeof createConfiguredCompiledFactory;
|
|
|
46
49
|
* @throws {import('./config.js').ConfigError} when neither source supplies an
|
|
47
50
|
* agent, or the resolved agent is unsupported (CLI-12).
|
|
48
51
|
*/
|
|
49
|
-
export declare function buildSlcDeps({ env, cwd, signal, configPath, note }: Parameters<DepsBuilder>[0], createExecutor?: ExecutorFactory, createCompiled?: CompiledFactoryBuilder): Promise<SlcDeps>;
|
|
52
|
+
export declare function buildSlcDeps({ env, cwd, signal, configPath, note, progress }: Parameters<DepsBuilder>[0], createExecutor?: ExecutorFactory, createCompiled?: CompiledFactoryBuilder): Promise<SlcDeps>;
|
|
50
53
|
/** The cligent-invocation selection after merging environment over file (DR-006). */
|
|
51
54
|
export interface RunConfig {
|
|
52
55
|
selection: AgentSelection;
|
|
53
56
|
/** Search-root source: an `SLC_PIPELINE_PATH` string, the file's sequence, or undefined. */
|
|
54
57
|
pipelinePath: string | string[] | undefined;
|
|
58
|
+
/** Agent-stall watchdog window in milliseconds; `0` disables (DR-019, CLI-34). */
|
|
59
|
+
stallTimeoutMs: number;
|
|
55
60
|
}
|
|
61
|
+
/** Default agent-stall watchdog window in seconds (DR-019, CLI-34). */
|
|
62
|
+
export declare const DEFAULT_STALL_TIMEOUT_SECONDS = 600;
|
|
56
63
|
/**
|
|
57
64
|
* Merges the environment over config-file values per key (DR-006, CLI-20): for
|
|
58
65
|
* each key a non-blank environment variable wins, otherwise the file value,
|
|
59
66
|
* otherwise the built-in default. The agent and model go through
|
|
60
67
|
* {@link resolveAgentSelection} so the supported-agent check stays single-sourced
|
|
61
|
-
* (CLI-7, CLI-12)
|
|
68
|
+
* (CLI-7, CLI-12); the stall timeout defaults to
|
|
69
|
+
* {@link DEFAULT_STALL_TIMEOUT_SECONDS} with `0` disabling the watchdog
|
|
70
|
+
* (DR-019, CLI-34).
|
|
71
|
+
*
|
|
72
|
+
* @throws {Error} when `SLC_STALL_TIMEOUT` is not a non-negative number.
|
|
62
73
|
*/
|
|
63
74
|
export declare function resolveRunConfig(env: Record<string, string | undefined>, file: FileConfig): RunConfig;
|
|
64
75
|
/** Usage text naming the documented invocation forms and configuration (CLI-2). */
|
package/dist/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EAExB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AACrB,OAAO,
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EAExB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAA0B,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAM1E,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAUnD,wBAAwB;AACxB,eAAO,MAAM,IAAI,QAAQ,CAAC;AAE1B,sCAAsC;AACtC,wBAAgB,OAAO,IAAI,MAAM,CAEhC;AAED,4EAA4E;AAC5E,MAAM,MAAM,WAAW,GAAG,CAAC,EAAE,EAAE;IAC7B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,WAAW,CAAC;IACpB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEjC,0FAA0F;AAC1F,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,C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ACvC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC;IACnD,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC;CAC9D,GAAG;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAY/C"}
|
package/dist/app.js
CHANGED
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { createRequire } from 'node:module';
|
|
17
17
|
import { createConfiguredCompiledFactory, createConfiguredExecutor, resolveAgentSelection, } from './config.js';
|
|
18
|
-
import { loadConfigFile } from './config-file.js';
|
|
18
|
+
import { loadConfigFile, MAX_STALL_TIMEOUT_SECONDS, } from './config-file.js';
|
|
19
|
+
import { createProgressReporter } from './progress.js';
|
|
19
20
|
import { createPipelineResolver, pipelineSearchRoots, withReservedPipelines, } from './resolver.js';
|
|
20
21
|
import { runSlc } from './runner.js';
|
|
21
22
|
const manifest = createRequire(import.meta.url)('../package.json');
|
|
@@ -45,7 +46,7 @@ export function version() {
|
|
|
45
46
|
* @throws {import('./config.js').ConfigError} when neither source supplies an
|
|
46
47
|
* agent, or the resolved agent is unsupported (CLI-12).
|
|
47
48
|
*/
|
|
48
|
-
export async function buildSlcDeps({ env, cwd, signal, configPath, note },
|
|
49
|
+
export async function buildSlcDeps({ env, cwd, signal, configPath, note, progress },
|
|
49
50
|
// Injectable so a test can capture the executor options — notably the
|
|
50
51
|
// non-interactive write permission below — without constructing a real
|
|
51
52
|
// adapter, the same seam pattern as `createConfiguredExecutor`'s
|
|
@@ -58,22 +59,40 @@ createExecutor = createConfiguredExecutor, createCompiled = createConfiguredComp
|
|
|
58
59
|
// First-run seeding (DR-015): name the created user config on stderr.
|
|
59
60
|
onSeed: (path) => note?.(`slc: seeded ${path} (agent: claude-code)\n`),
|
|
60
61
|
});
|
|
61
|
-
const { selection, pipelinePath } = resolveRunConfig(env, file.config);
|
|
62
|
+
const { selection, pipelinePath, stallTimeoutMs } = resolveRunConfig(env, file.config);
|
|
62
63
|
const resolver = withReservedPipelines(createPipelineResolver(pipelineSearchRoots(pipelinePath, cwd)));
|
|
63
64
|
// Auto-accept the agents' file operations so a non-interactive `slc` run can
|
|
64
65
|
// write its target artifact; the DR-003 generic checks still guard the
|
|
65
|
-
// protected inputs (DR-004).
|
|
66
|
-
|
|
66
|
+
// protected inputs (DR-004). The stall watchdog rides every constructed
|
|
67
|
+
// transport (DR-019, CLI-35).
|
|
68
|
+
const agentOpts = {
|
|
69
|
+
cwd,
|
|
70
|
+
permissions: { mode: 'auto' },
|
|
71
|
+
stallTimeoutMs,
|
|
72
|
+
};
|
|
67
73
|
const executor = createExecutor(selection, agentOpts);
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
// Compiled-runtime status streams to the same reporter as phase progress
|
|
75
|
+
// (PHEXEC-25, CLI-32).
|
|
76
|
+
const compiled = createCompiled(selection, {
|
|
77
|
+
...agentOpts,
|
|
78
|
+
onStatus: progress === undefined
|
|
79
|
+
? undefined
|
|
80
|
+
: (line) => progress({ kind: 'status', text: line }),
|
|
81
|
+
});
|
|
82
|
+
return { resolver, executor, compiled, cwd, signal, progress };
|
|
70
83
|
}
|
|
84
|
+
/** Default agent-stall watchdog window in seconds (DR-019, CLI-34). */
|
|
85
|
+
export const DEFAULT_STALL_TIMEOUT_SECONDS = 600;
|
|
71
86
|
/**
|
|
72
87
|
* Merges the environment over config-file values per key (DR-006, CLI-20): for
|
|
73
88
|
* each key a non-blank environment variable wins, otherwise the file value,
|
|
74
89
|
* otherwise the built-in default. The agent and model go through
|
|
75
90
|
* {@link resolveAgentSelection} so the supported-agent check stays single-sourced
|
|
76
|
-
* (CLI-7, CLI-12)
|
|
91
|
+
* (CLI-7, CLI-12); the stall timeout defaults to
|
|
92
|
+
* {@link DEFAULT_STALL_TIMEOUT_SECONDS} with `0` disabling the watchdog
|
|
93
|
+
* (DR-019, CLI-34).
|
|
94
|
+
*
|
|
95
|
+
* @throws {Error} when `SLC_STALL_TIMEOUT` is not a non-negative number.
|
|
77
96
|
*/
|
|
78
97
|
export function resolveRunConfig(env, file) {
|
|
79
98
|
const selection = resolveAgentSelection({
|
|
@@ -82,7 +101,24 @@ export function resolveRunConfig(env, file) {
|
|
|
82
101
|
SLC_EFFORT: nonBlank(env.SLC_EFFORT) ?? file.effort,
|
|
83
102
|
});
|
|
84
103
|
const pipelinePath = nonBlank(env.SLC_PIPELINE_PATH) ?? file.pipelinePath;
|
|
85
|
-
|
|
104
|
+
const stallSeconds = parseStallTimeout(nonBlank(env.SLC_STALL_TIMEOUT)) ??
|
|
105
|
+
file.stallTimeout ??
|
|
106
|
+
DEFAULT_STALL_TIMEOUT_SECONDS;
|
|
107
|
+
return { selection, pipelinePath, stallTimeoutMs: stallSeconds * 1000 };
|
|
108
|
+
}
|
|
109
|
+
function parseStallTimeout(value) {
|
|
110
|
+
if (value === undefined)
|
|
111
|
+
return undefined;
|
|
112
|
+
const seconds = Number(value);
|
|
113
|
+
if (!Number.isFinite(seconds) || seconds < 0) {
|
|
114
|
+
throw new Error(`SLC_STALL_TIMEOUT "${value}" must be a non-negative number of seconds (0 disables the stall watchdog)`);
|
|
115
|
+
}
|
|
116
|
+
// Beyond the timer range Node clamps the delay to 1 ms, which would abort
|
|
117
|
+
// every agent call at once — refuse rather than invert the watchdog.
|
|
118
|
+
if (seconds > MAX_STALL_TIMEOUT_SECONDS) {
|
|
119
|
+
throw new Error(`SLC_STALL_TIMEOUT "${value}" must be at most ${MAX_STALL_TIMEOUT_SECONDS} seconds (0 disables the stall watchdog)`);
|
|
120
|
+
}
|
|
121
|
+
return seconds;
|
|
86
122
|
}
|
|
87
123
|
/** Returns `value` when set and not all-whitespace, else `undefined` (DR-006). */
|
|
88
124
|
function nonBlank(value) {
|
|
@@ -117,12 +153,14 @@ export function usageText() {
|
|
|
117
153
|
' environment variable below:',
|
|
118
154
|
' ./slc.config.yaml',
|
|
119
155
|
' ${XDG_CONFIG_HOME:-~/.config}/slc/config.yaml',
|
|
120
|
-
' Keys: agent, model, effort, pipelinePath.',
|
|
156
|
+
' Keys: agent, model, effort, pipelinePath, stallTimeout.',
|
|
121
157
|
'',
|
|
122
158
|
' SLC_AGENT agent CLI: claude-code | codex | gemini | opencode',
|
|
123
159
|
' SLC_MODEL optional model for the agent CLI',
|
|
124
160
|
' SLC_EFFORT optional adapter-scoped reasoning effort (e.g. xhigh)',
|
|
125
161
|
' SLC_PIPELINE_PATH search roots for <pipeline> references (default: cwd)',
|
|
162
|
+
' SLC_STALL_TIMEOUT seconds of agent inactivity before a stalled call',
|
|
163
|
+
' fails the run (default: 600; 0 disables)',
|
|
126
164
|
'',
|
|
127
165
|
].join('\n');
|
|
128
166
|
}
|
|
@@ -170,6 +208,9 @@ export async function run(argv, options = {}) {
|
|
|
170
208
|
const env = options.env ?? process.env;
|
|
171
209
|
const cwd = options.cwd ?? process.cwd();
|
|
172
210
|
const signal = options.signal ?? new AbortController().signal;
|
|
211
|
+
// In-run progress renders on stderr as it happens, with the silence-bounded
|
|
212
|
+
// heartbeat (DR-019, CLI-32, CLI-33, CLI-35).
|
|
213
|
+
const reporter = createProgressReporter(stderr);
|
|
173
214
|
let deps;
|
|
174
215
|
let rest;
|
|
175
216
|
try {
|
|
@@ -183,15 +224,23 @@ export async function run(argv, options = {}) {
|
|
|
183
224
|
signal,
|
|
184
225
|
configPath: extracted.configPath,
|
|
185
226
|
note: stderr,
|
|
227
|
+
progress: reporter.sink,
|
|
186
228
|
});
|
|
187
229
|
}
|
|
188
230
|
catch (error) {
|
|
189
231
|
// Configuration refusals — a bad `--config`, an invalid config file
|
|
190
232
|
// (CLI-21), or an unset/unsupported agent (CLI-12) — fail the run.
|
|
233
|
+
reporter.dispose();
|
|
191
234
|
stderr(`${name}: ${messageOf(error)}\n`);
|
|
192
235
|
return 1;
|
|
193
236
|
}
|
|
194
|
-
|
|
237
|
+
let result;
|
|
238
|
+
try {
|
|
239
|
+
result = await runSlc(rest, deps);
|
|
240
|
+
}
|
|
241
|
+
finally {
|
|
242
|
+
reporter.dispose();
|
|
243
|
+
}
|
|
195
244
|
if (result.ok) {
|
|
196
245
|
if (result.outputs.length > 0)
|
|
197
246
|
stdout(`${result.outputs.join('\n')}\n`);
|
package/dist/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,0EAA0E;AAE1E;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACxB,qBAAqB,GAEtB,MAAM,aAAa,CAAC;AACrB,OAAO,
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,0EAA0E;AAE1E;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACxB,qBAAqB,GAEtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,yBAAyB,GAE1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAqB,MAAM,eAAe,CAAC;AAC1E,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAgB,MAAM,aAAa,CAAC;AAEnD,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAEhE,CAAC;AACF,IAAI,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;IACzC,MAAM,IAAI,SAAS,CAAC,uCAAuC,CAAC,CAAC;AAC/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,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
package/dist/cligent-agent.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import type { AgentAdapter, PermissionPolicy } from '@sublang/cligent';
|
|
2
2
|
import type { AgentClient } from './interpreter.js';
|
|
3
|
+
/** Timer seams for the stall watchdog; injected in tests. */
|
|
4
|
+
export interface WatchdogTimers {
|
|
5
|
+
setTimeout(callback: () => void, ms: number): unknown;
|
|
6
|
+
clearTimeout(handle: unknown): void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The production watchdog timers. Exported so a test can assert the ref
|
|
10
|
+
* behavior the watchdog's correctness depends on, which an injected fake
|
|
11
|
+
* would bypass.
|
|
12
|
+
*/
|
|
13
|
+
export declare const defaultWatchdogTimers: WatchdogTimers;
|
|
3
14
|
/** Wraps a Cligent adapter as an {@link AgentClient} for the interpreter. */
|
|
4
15
|
export declare function createCligentAgent(opts: {
|
|
5
16
|
adapter: AgentAdapter;
|
|
@@ -7,5 +18,13 @@ export declare function createCligentAgent(opts: {
|
|
|
7
18
|
permissions?: PermissionPolicy;
|
|
8
19
|
/** Adapter-scoped reasoning effort, validated by the configuration layer. */
|
|
9
20
|
effort?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Milliseconds of adapter-event inactivity after which the in-flight call is
|
|
23
|
+
* aborted and reported as an error (DR-019, PHEXEC-36). Zero or absent
|
|
24
|
+
* disables the watchdog.
|
|
25
|
+
*/
|
|
26
|
+
stallTimeoutMs?: number;
|
|
27
|
+
/** Watchdog timer seams; defaults to real timers. Injected in tests. */
|
|
28
|
+
watchdogTimers?: WatchdogTimers;
|
|
10
29
|
}): AgentClient;
|
|
11
30
|
//# sourceMappingURL=cligent-agent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cligent-agent.d.ts","sourceRoot":"","sources":["../src/cligent-agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cligent-agent.d.ts","sourceRoot":"","sources":["../src/cligent-agent.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EACV,YAAY,EAGZ,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAGpE,6DAA6D;AAC7D,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IACtD,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CACrC;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,cASnC,CAAC;AAEF,6EAA6E;AAC7E,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wEAAwE;IACxE,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,GAAG,WAAW,CAiFd"}
|