@sublang/slc 0.2.0 → 0.4.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 +86 -14
- package/dist/app.d.ts +13 -2
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +65 -15
- package/dist/app.js.map +1 -1
- package/dist/build-history.d.ts +74 -0
- package/dist/build-history.d.ts.map +1 -0
- package/dist/build-history.js +309 -0
- package/dist/build-history.js.map +1 -0
- package/dist/cli.js +2 -1
- package/dist/cli.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 +7 -1
- package/dist/compiled-executor.d.ts.map +1 -1
- package/dist/compiled-executor.js +11 -3
- 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 +29 -5
- 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 +9 -3
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +14 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +28 -0
- package/dist/errors.js.map +1 -0
- package/dist/execution.d.ts +42 -0
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +224 -29
- package/dist/execution.js.map +1 -1
- package/dist/hash.d.ts +22 -0
- package/dist/hash.d.ts.map +1 -1
- package/dist/hash.js +47 -0
- package/dist/hash.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/interpreter.d.ts +1 -1
- package/dist/interpreter.d.ts.map +1 -1
- package/dist/interpreter.js +9 -0
- package/dist/interpreter.js.map +1 -1
- package/dist/invocation.d.ts +5 -1
- package/dist/invocation.d.ts.map +1 -1
- package/dist/invocation.js +14 -3
- package/dist/invocation.js.map +1 -1
- package/dist/line-diff.d.ts +7 -0
- package/dist/line-diff.d.ts.map +1 -0
- package/dist/line-diff.js +66 -0
- package/dist/line-diff.js.map +1 -0
- package/dist/phase.d.ts +2 -0
- package/dist/phase.d.ts.map +1 -1
- package/dist/phase.js +19 -3
- package/dist/phase.js.map +1 -1
- package/dist/pin-closure.d.ts +2 -2
- package/dist/pin-closure.d.ts.map +1 -1
- package/dist/pin-closure.js +4 -3
- package/dist/pin-closure.js.map +1 -1
- package/dist/pin-currency.d.ts +6 -2
- package/dist/pin-currency.d.ts.map +1 -1
- package/dist/pin-currency.js +24 -43
- package/dist/pin-currency.js.map +1 -1
- package/dist/pin-generate.d.ts.map +1 -1
- package/dist/pin-generate.js +1 -3
- package/dist/pin-generate.js.map +1 -1
- package/dist/pin-paths.d.ts.map +1 -1
- package/dist/pin-paths.js +2 -13
- package/dist/pin-paths.js.map +1 -1
- package/dist/pins.d.ts.map +1 -1
- package/dist/pins.js +5 -15
- package/dist/pins.js.map +1 -1
- package/dist/playbook-ports.d.ts +17 -0
- package/dist/playbook-ports.d.ts.map +1 -1
- package/dist/playbook-ports.js +21 -6
- 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 +8 -0
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +673 -89
- package/dist/runner.js.map +1 -1
- package/dist/runtime-package.d.ts.map +1 -1
- package/dist/runtime-package.js +3 -11
- package/dist/runtime-package.js.map +1 -1
- package/dist/slc.config.template.yaml +5 -1
- package/dist/verify-coverage.d.ts.map +1 -1
- package/dist/verify-coverage.js +2 -0
- package/dist/verify-coverage.js.map +1 -1
- package/dist/verify-support.d.ts +7 -0
- package/dist/verify-support.d.ts.map +1 -1
- package/dist/verify-support.js +13 -6
- package/dist/verify-support.js.map +1 -1
- package/dist/verify.d.ts.map +1 -1
- package/dist/verify.js +2 -0
- package/dist/verify.js.map +1 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -49,16 +49,27 @@ compile stage — without waiting on a compile.
|
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
51
|
npm install -g @sublang/slc @sublang/playbook
|
|
52
|
+
npm install -g @anthropic-ai/claude-agent-sdk @openai/codex-sdk
|
|
52
53
|
slc --version
|
|
53
54
|
```
|
|
54
55
|
|
|
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
|
+
|
|
55
64
|
Compiled artifacts import the Playbook engine from their own directory;
|
|
56
65
|
when that import does not resolve, `playbook run` (3.1+) links its own
|
|
57
66
|
engine beside the artifact and says so (`--no-provision` opts out).
|
|
58
|
-
Working inside an npm project instead? Install
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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).
|
|
62
73
|
|
|
63
74
|
Requirements:
|
|
64
75
|
|
|
@@ -87,10 +98,13 @@ slc playbook my-workflow.md
|
|
|
87
98
|
dependency, so it compiles in any directory — no clone, no project
|
|
88
99
|
setup. Compilation drives your configured coding agent — the first run
|
|
89
100
|
seeds `~/.config/slc/config.yaml` with `agent: claude-code`; set
|
|
90
|
-
`SLC_AGENT` (or edit that file) to use another agent CLI
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
|
94
108
|
(`--no-optimize` skips it).
|
|
95
109
|
|
|
96
110
|
Artifacts land in your working directory: `my-workflow.playbook/` holds
|
|
@@ -106,9 +120,65 @@ Intermediates are first-class: edit one and re-run a single phase
|
|
|
106
120
|
(`slc playbook.gears2fsm …`) and it lands in the same place.
|
|
107
121
|
`slc --help` shows all invocation forms.
|
|
108
122
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
and
|
|
123
|
+
### Incremental recompiles
|
|
124
|
+
|
|
125
|
+
Canonical full and full-link runs of ordinary pipelines remember successful
|
|
126
|
+
builds under `<artifact-dir>/.slc/`. Each numbered, private snapshot contains
|
|
127
|
+
one manifest plus verbatim copies of the source and every accepted phase
|
|
128
|
+
output. The active marker is committed last. If that build is missing,
|
|
129
|
+
deleted, or corrupt in any part, `slc` treats the whole snapshot as absent and
|
|
130
|
+
compiles ordinarily.
|
|
131
|
+
|
|
132
|
+
On a re-run, `slc` walks the phases in order and chooses one mode for each:
|
|
133
|
+
|
|
134
|
+
- **Reuse** when every input is byte-identical and the live target is readable:
|
|
135
|
+
no agent runs, and the on-disk output stays exactly as it is, including manual
|
|
136
|
+
refinements.
|
|
137
|
+
- **Update** when a compile phase's inputs changed and its prior input and live
|
|
138
|
+
output are available: the ordinary executor also receives the recorded old
|
|
139
|
+
input, a bounded best-effort diff, and one instruction to update the complete
|
|
140
|
+
artifact while preserving unaffected work.
|
|
141
|
+
- **Ordinary** when no usable record exists, for a changed link phase, or when
|
|
142
|
+
`--rebuild` is given.
|
|
143
|
+
|
|
144
|
+
Update is only a hint to the usual executor. The phase definition remains the
|
|
145
|
+
sole authority, needs no update section, and uses the same acceptance rules as
|
|
146
|
+
a fresh compile. A run that only reuses reports `up to date` and records
|
|
147
|
+
nothing new. Before the first executor in an eligible run may write, `slc`
|
|
148
|
+
removes the active marker; only a wholly successful run, including required
|
|
149
|
+
deterministic post-processing, publishes a new marker. Once the marker is
|
|
150
|
+
removed, a failed or interrupted run therefore leaves the next run to compile
|
|
151
|
+
ordinarily. `--rebuild` forces every phase through Ordinary mode and records a
|
|
152
|
+
fresh successful build while retaining older numbered snapshots.
|
|
153
|
+
|
|
154
|
+
History selection and publication do not apply to `-o`, the reserved `slc`
|
|
155
|
+
meta-pipeline, single-phase or standalone-pass runs, or direct-link runs. If one
|
|
156
|
+
of those excluded forms is about to overwrite an artifact named by a usable
|
|
157
|
+
active build, `slc` clears that marker first so it cannot describe the new
|
|
158
|
+
bytes.
|
|
159
|
+
|
|
160
|
+
`.slc/` sits inside the artifact bundle and holds verbatim copies of your
|
|
161
|
+
source and every accepted phase output, so treat it as no less private than
|
|
162
|
+
the source, and add `.slc/` to your `.gitignore` if you commit the bundle.
|
|
163
|
+
Deleting it is always safe — the next run simply compiles ordinarily — and
|
|
164
|
+
old numbered builds under `.slc/builds/` can be pruned at any time. An upgrade
|
|
165
|
+
that changes a recorded definition or input invalidates only the affected
|
|
166
|
+
steps: an eligible compile step can use Update while link steps run ordinarily.
|
|
167
|
+
Pass `--rebuild` after an upgrade when you want every phase to compile from
|
|
168
|
+
scratch instead.
|
|
169
|
+
|
|
170
|
+
While a compile runs, `slc` reports progress on stderr: each phase as it
|
|
171
|
+
starts, each artifact as it lands with the elapsed time, the compiled
|
|
172
|
+
runtime's own state transitions, and a heartbeat so the terminal is
|
|
173
|
+
never silent for more than 30 seconds. An agent call that goes quiet for
|
|
174
|
+
`stallTimeout` seconds (default 600, `0` disables) is aborted and
|
|
175
|
+
reported as a failed phase rather than hanging indefinitely.
|
|
176
|
+
|
|
177
|
+
Success prints the written artifact paths to stdout and exits 0 — or
|
|
178
|
+
just `up to date` when incremental selection recompiled nothing, in which
|
|
179
|
+
case the paths the previous run reported are still current; a failure
|
|
180
|
+
prints diagnostics to stderr — naming the failing phase when one is at
|
|
181
|
+
fault — and exits non-zero.
|
|
112
182
|
|
|
113
183
|
## Configuration
|
|
114
184
|
|
|
@@ -123,14 +193,16 @@ and `pipelinePath` to the working directory.
|
|
|
123
193
|
# slc.config.yaml
|
|
124
194
|
agent: claude-code # claude-code | codex | gemini | opencode
|
|
125
195
|
model: claude-opus-4-8 # optional; omit to use the agent CLI's default
|
|
196
|
+
stallTimeout: 600 # seconds of agent silence before a stalled call fails
|
|
126
197
|
pipelinePath: # search roots for <pipeline> references; defaults to the cwd
|
|
127
198
|
- ./pipelines
|
|
128
199
|
```
|
|
129
200
|
|
|
130
201
|
A `slc.config.yaml` in the working directory wins over the user config;
|
|
131
|
-
`SLC_AGENT`, `SLC_MODEL`, and `SLC_PIPELINE_PATH`
|
|
132
|
-
key. Discovery order, `--config`, and validation
|
|
133
|
-
[CLI spec](specs/user/cli.md); `slc --help` prints the
|
|
202
|
+
`SLC_AGENT`, `SLC_MODEL`, `SLC_STALL_TIMEOUT`, and `SLC_PIPELINE_PATH`
|
|
203
|
+
override either per key. Discovery order, `--config`, and validation
|
|
204
|
+
rules live in the [CLI spec](specs/user/cli.md); `slc --help` prints the
|
|
205
|
+
summary.
|
|
134
206
|
|
|
135
207
|
## How pipelines work
|
|
136
208
|
|
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":"
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAoBA,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,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AAM,6BAA6B,MAAM,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvC,IAAI,EAAE,UAAU,GACf,SAAS,CAYX;AAyBD,mFAAmF;AACnF,wBAAgB,SAAS,IAAI,MAAM,CAuClC;AA6BD;;;;GAIG;AACH,wBAAsB,GAAG,CACvB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,MAAM,CAAC,CA+DjB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE;IACvC,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
|
@@ -14,8 +14,10 @@
|
|
|
14
14
|
* and signal wiring. See specs/dev/cli.md and specs/user/cli.md.
|
|
15
15
|
*/
|
|
16
16
|
import { createRequire } from 'node:module';
|
|
17
|
+
import { messageOf } from './errors.js';
|
|
17
18
|
import { createConfiguredCompiledFactory, createConfiguredExecutor, resolveAgentSelection, } from './config.js';
|
|
18
|
-
import { loadConfigFile } from './config-file.js';
|
|
19
|
+
import { loadConfigFile, MAX_STALL_TIMEOUT_SECONDS, } from './config-file.js';
|
|
20
|
+
import { createProgressReporter } from './progress.js';
|
|
19
21
|
import { createPipelineResolver, pipelineSearchRoots, withReservedPipelines, } from './resolver.js';
|
|
20
22
|
import { runSlc } from './runner.js';
|
|
21
23
|
const manifest = createRequire(import.meta.url)('../package.json');
|
|
@@ -45,7 +47,7 @@ export function version() {
|
|
|
45
47
|
* @throws {import('./config.js').ConfigError} when neither source supplies an
|
|
46
48
|
* agent, or the resolved agent is unsupported (CLI-12).
|
|
47
49
|
*/
|
|
48
|
-
export async function buildSlcDeps({ env, cwd, signal, configPath, note },
|
|
50
|
+
export async function buildSlcDeps({ env, cwd, signal, configPath, note, progress },
|
|
49
51
|
// Injectable so a test can capture the executor options — notably the
|
|
50
52
|
// non-interactive write permission below — without constructing a real
|
|
51
53
|
// adapter, the same seam pattern as `createConfiguredExecutor`'s
|
|
@@ -58,22 +60,40 @@ createExecutor = createConfiguredExecutor, createCompiled = createConfiguredComp
|
|
|
58
60
|
// First-run seeding (DR-015): name the created user config on stderr.
|
|
59
61
|
onSeed: (path) => note?.(`slc: seeded ${path} (agent: claude-code)\n`),
|
|
60
62
|
});
|
|
61
|
-
const { selection, pipelinePath } = resolveRunConfig(env, file.config);
|
|
63
|
+
const { selection, pipelinePath, stallTimeoutMs } = resolveRunConfig(env, file.config);
|
|
62
64
|
const resolver = withReservedPipelines(createPipelineResolver(pipelineSearchRoots(pipelinePath, cwd)));
|
|
63
65
|
// Auto-accept the agents' file operations so a non-interactive `slc` run can
|
|
64
66
|
// write its target artifact; the DR-003 generic checks still guard the
|
|
65
|
-
// protected inputs (DR-004).
|
|
66
|
-
|
|
67
|
+
// protected inputs (DR-004). The stall watchdog rides every constructed
|
|
68
|
+
// transport (DR-019, CLI-35).
|
|
69
|
+
const agentOpts = {
|
|
70
|
+
cwd,
|
|
71
|
+
permissions: { mode: 'auto' },
|
|
72
|
+
stallTimeoutMs,
|
|
73
|
+
};
|
|
67
74
|
const executor = createExecutor(selection, agentOpts);
|
|
68
|
-
|
|
69
|
-
|
|
75
|
+
// Compiled-runtime status streams to the same reporter as phase progress
|
|
76
|
+
// (PHEXEC-25, CLI-32).
|
|
77
|
+
const compiled = createCompiled(selection, {
|
|
78
|
+
...agentOpts,
|
|
79
|
+
onStatus: progress === undefined
|
|
80
|
+
? undefined
|
|
81
|
+
: (line) => progress({ kind: 'status', text: line }),
|
|
82
|
+
});
|
|
83
|
+
return { resolver, executor, compiled, cwd, signal, progress };
|
|
70
84
|
}
|
|
85
|
+
/** Default agent-stall watchdog window in seconds (DR-019, CLI-34). */
|
|
86
|
+
export const DEFAULT_STALL_TIMEOUT_SECONDS = 600;
|
|
71
87
|
/**
|
|
72
88
|
* Merges the environment over config-file values per key (DR-006, CLI-20): for
|
|
73
89
|
* each key a non-blank environment variable wins, otherwise the file value,
|
|
74
90
|
* otherwise the built-in default. The agent and model go through
|
|
75
91
|
* {@link resolveAgentSelection} so the supported-agent check stays single-sourced
|
|
76
|
-
* (CLI-7, CLI-12)
|
|
92
|
+
* (CLI-7, CLI-12); the stall timeout defaults to
|
|
93
|
+
* {@link DEFAULT_STALL_TIMEOUT_SECONDS} with `0` disabling the watchdog
|
|
94
|
+
* (DR-019, CLI-34).
|
|
95
|
+
*
|
|
96
|
+
* @throws {Error} when `SLC_STALL_TIMEOUT` is not a non-negative number.
|
|
77
97
|
*/
|
|
78
98
|
export function resolveRunConfig(env, file) {
|
|
79
99
|
const selection = resolveAgentSelection({
|
|
@@ -82,7 +102,24 @@ export function resolveRunConfig(env, file) {
|
|
|
82
102
|
SLC_EFFORT: nonBlank(env.SLC_EFFORT) ?? file.effort,
|
|
83
103
|
});
|
|
84
104
|
const pipelinePath = nonBlank(env.SLC_PIPELINE_PATH) ?? file.pipelinePath;
|
|
85
|
-
|
|
105
|
+
const stallSeconds = parseStallTimeout(nonBlank(env.SLC_STALL_TIMEOUT)) ??
|
|
106
|
+
file.stallTimeout ??
|
|
107
|
+
DEFAULT_STALL_TIMEOUT_SECONDS;
|
|
108
|
+
return { selection, pipelinePath, stallTimeoutMs: stallSeconds * 1000 };
|
|
109
|
+
}
|
|
110
|
+
function parseStallTimeout(value) {
|
|
111
|
+
if (value === undefined)
|
|
112
|
+
return undefined;
|
|
113
|
+
const seconds = Number(value);
|
|
114
|
+
if (!Number.isFinite(seconds) || seconds < 0) {
|
|
115
|
+
throw new Error(`SLC_STALL_TIMEOUT "${value}" must be a non-negative number of seconds (0 disables the stall watchdog)`);
|
|
116
|
+
}
|
|
117
|
+
// Beyond the timer range Node clamps the delay to 1 ms, which would abort
|
|
118
|
+
// every agent call at once — refuse rather than invert the watchdog.
|
|
119
|
+
if (seconds > MAX_STALL_TIMEOUT_SECONDS) {
|
|
120
|
+
throw new Error(`SLC_STALL_TIMEOUT "${value}" must be at most ${MAX_STALL_TIMEOUT_SECONDS} seconds (0 disables the stall watchdog)`);
|
|
121
|
+
}
|
|
122
|
+
return seconds;
|
|
86
123
|
}
|
|
87
124
|
/** Returns `value` when set and not all-whitespace, else `undefined` (DR-006). */
|
|
88
125
|
function nonBlank(value) {
|
|
@@ -108,6 +145,7 @@ export function usageText() {
|
|
|
108
145
|
" --normalize rewrite raw input to the entry phase's source form first",
|
|
109
146
|
" -O, --optimize run the pipeline's pass phases (the default)",
|
|
110
147
|
' --no-optimize run the chain without pass phases',
|
|
148
|
+
' --rebuild recompile every phase, ignoring recorded build history',
|
|
111
149
|
' --config <path> load configuration from <path> (disables discovery)',
|
|
112
150
|
' -v, --version print version and exit',
|
|
113
151
|
' -h, --help print this help and exit',
|
|
@@ -117,12 +155,14 @@ export function usageText() {
|
|
|
117
155
|
' environment variable below:',
|
|
118
156
|
' ./slc.config.yaml',
|
|
119
157
|
' ${XDG_CONFIG_HOME:-~/.config}/slc/config.yaml',
|
|
120
|
-
' Keys: agent, model, effort, pipelinePath.',
|
|
158
|
+
' Keys: agent, model, effort, pipelinePath, stallTimeout.',
|
|
121
159
|
'',
|
|
122
160
|
' SLC_AGENT agent CLI: claude-code | codex | gemini | opencode',
|
|
123
161
|
' SLC_MODEL optional model for the agent CLI',
|
|
124
162
|
' SLC_EFFORT optional adapter-scoped reasoning effort (e.g. xhigh)',
|
|
125
163
|
' SLC_PIPELINE_PATH search roots for <pipeline> references (default: cwd)',
|
|
164
|
+
' SLC_STALL_TIMEOUT seconds of agent inactivity before a stalled call',
|
|
165
|
+
' fails the run (default: 600; 0 disables)',
|
|
126
166
|
'',
|
|
127
167
|
].join('\n');
|
|
128
168
|
}
|
|
@@ -170,6 +210,9 @@ export async function run(argv, options = {}) {
|
|
|
170
210
|
const env = options.env ?? process.env;
|
|
171
211
|
const cwd = options.cwd ?? process.cwd();
|
|
172
212
|
const signal = options.signal ?? new AbortController().signal;
|
|
213
|
+
// In-run progress renders on stderr as it happens, with the silence-bounded
|
|
214
|
+
// heartbeat (DR-019, CLI-32, CLI-33, CLI-35).
|
|
215
|
+
const reporter = createProgressReporter(stderr);
|
|
173
216
|
let deps;
|
|
174
217
|
let rest;
|
|
175
218
|
try {
|
|
@@ -183,17 +226,27 @@ export async function run(argv, options = {}) {
|
|
|
183
226
|
signal,
|
|
184
227
|
configPath: extracted.configPath,
|
|
185
228
|
note: stderr,
|
|
229
|
+
progress: reporter.sink,
|
|
186
230
|
});
|
|
187
231
|
}
|
|
188
232
|
catch (error) {
|
|
189
233
|
// Configuration refusals — a bad `--config`, an invalid config file
|
|
190
234
|
// (CLI-21), or an unset/unsupported agent (CLI-12) — fail the run.
|
|
235
|
+
reporter.dispose();
|
|
191
236
|
stderr(`${name}: ${messageOf(error)}\n`);
|
|
192
237
|
return 1;
|
|
193
238
|
}
|
|
194
|
-
|
|
239
|
+
let result;
|
|
240
|
+
try {
|
|
241
|
+
result = await runSlc(rest, deps);
|
|
242
|
+
}
|
|
243
|
+
finally {
|
|
244
|
+
reporter.dispose();
|
|
245
|
+
}
|
|
195
246
|
if (result.ok) {
|
|
196
|
-
if (result.
|
|
247
|
+
if (result.outcome === 'up-to-date')
|
|
248
|
+
stdout('up to date\n');
|
|
249
|
+
else if (result.outputs.length > 0)
|
|
197
250
|
stdout(`${result.outputs.join('\n')}\n`);
|
|
198
251
|
// Surface any ambiguity the agent resolved without polluting the path output.
|
|
199
252
|
if (result.diagnostics.length > 0)
|
|
@@ -227,7 +280,4 @@ export function interruptSignal(emitter) {
|
|
|
227
280
|
function hasFlag(argv, ...flags) {
|
|
228
281
|
return argv.some((arg) => flags.includes(arg));
|
|
229
282
|
}
|
|
230
|
-
function messageOf(error) {
|
|
231
|
-
return error instanceof Error ? error.message : String(error);
|
|
232
|
-
}
|
|
233
283
|
//# sourceMappingURL=app.js.map
|
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,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,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/D,CAAC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Q,CAAC,GAAG,CAAC,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type Hash } from './hash.js';
|
|
2
|
+
export declare const HISTORY_DIR = ".slc";
|
|
3
|
+
export declare const BUILD_MANIFEST_SCHEMA = "sublang.slc.build.v1";
|
|
4
|
+
export declare const SOURCE_COPY = "source";
|
|
5
|
+
export interface StepHistoryRecord {
|
|
6
|
+
kind: 'compile' | 'link';
|
|
7
|
+
name: string;
|
|
8
|
+
/** Artifact-directory-relative POSIX locator. */
|
|
9
|
+
target: string;
|
|
10
|
+
inputs: Hash[];
|
|
11
|
+
output: Hash;
|
|
12
|
+
}
|
|
13
|
+
export interface BuildManifest {
|
|
14
|
+
schema: typeof BUILD_MANIFEST_SCHEMA;
|
|
15
|
+
pipeline: string;
|
|
16
|
+
source: {
|
|
17
|
+
/** Artifact-directory-relative POSIX locator; may climb outward. */
|
|
18
|
+
path: string;
|
|
19
|
+
hash: Hash;
|
|
20
|
+
};
|
|
21
|
+
steps: StepHistoryRecord[];
|
|
22
|
+
}
|
|
23
|
+
export interface BuildHistory {
|
|
24
|
+
build: number;
|
|
25
|
+
dir: string;
|
|
26
|
+
manifest: BuildManifest;
|
|
27
|
+
}
|
|
28
|
+
export interface VerifiedInput {
|
|
29
|
+
path: string;
|
|
30
|
+
bytes: Buffer;
|
|
31
|
+
}
|
|
32
|
+
export interface StepToRecord {
|
|
33
|
+
kind: 'compile' | 'link';
|
|
34
|
+
name: string;
|
|
35
|
+
/** Absolute target path. */
|
|
36
|
+
target: string;
|
|
37
|
+
inputs: readonly Hash[];
|
|
38
|
+
/** Hash accepted by the runner before publication. */
|
|
39
|
+
output: Hash;
|
|
40
|
+
/** Bytes re-read by the runner immediately before publication. */
|
|
41
|
+
bytes: Uint8Array;
|
|
42
|
+
}
|
|
43
|
+
/** Encodes an absolute path relative to the artifact directory. */
|
|
44
|
+
export declare function encodeLocator(artDir: string, path: string): string;
|
|
45
|
+
/** Fixed path of a phase's recorded output copy. */
|
|
46
|
+
export declare function outputCopyPath(history: BuildHistory, index: number): string;
|
|
47
|
+
/**
|
|
48
|
+
* Loads and verifies the complete active build. Any malformed directory,
|
|
49
|
+
* marker, manifest, source copy, output copy, or hash makes history absent.
|
|
50
|
+
*/
|
|
51
|
+
export declare function loadBuildHistory(artDir: string): Promise<BuildHistory | null>;
|
|
52
|
+
/**
|
|
53
|
+
* Re-verifies the recorded chained input immediately before Update mode uses
|
|
54
|
+
* it. Step zero reads the source copy; later steps read the prior output copy.
|
|
55
|
+
*/
|
|
56
|
+
export declare function verifiedInput(history: BuildHistory, stepIndex: number, expected: Hash): Promise<VerifiedInput | null>;
|
|
57
|
+
/**
|
|
58
|
+
* Removes the active marker before the first executor may write. A valid
|
|
59
|
+
* active marker must be removable; malformed advisory state is never followed.
|
|
60
|
+
*/
|
|
61
|
+
export declare function invalidateBuildHistory(artDir: string, active: boolean): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Publishes one complete snapshot and commits its number last. Callers pass
|
|
64
|
+
* already-materialized source/output bytes, so publication never follows a
|
|
65
|
+
* live phase target.
|
|
66
|
+
*/
|
|
67
|
+
export declare function recordBuild(opts: {
|
|
68
|
+
artDir: string;
|
|
69
|
+
pipeline: string;
|
|
70
|
+
sourcePath: string;
|
|
71
|
+
sourceBytes: Uint8Array;
|
|
72
|
+
steps: readonly StepToRecord[];
|
|
73
|
+
}): Promise<void>;
|
|
74
|
+
//# sourceMappingURL=build-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-history.d.ts","sourceRoot":"","sources":["../src/build-history.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAqB,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAEzD,eAAO,MAAM,WAAW,SAAS,CAAC;AAClC,eAAO,MAAM,qBAAqB,yBAAyB,CAAC;AAC5D,eAAO,MAAM,WAAW,WAAW,CAAC;AAQpC,MAAM,WAAW,iBAAiB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