werkmeister-core 0.89.3 → 0.90.2
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 +17 -0
- package/README.md +0 -4
- package/dist/config.d.ts +9 -0
- package/dist/config.js +40 -2
- package/dist/generate.js +36 -8
- package/dist/harness/claude/cli.d.ts +5 -0
- package/dist/harness/claude/cli.js +13 -1
- package/dist/pr_lifecycle.d.ts +2 -2
- package/dist/pr_lifecycle.js +2 -2
- package/dist/sandbox.d.ts +6 -5
- package/dist/sandbox.js +13 -6
- package/dist/scheduler.js +6 -2
- package/dist/sdk.d.ts +1 -7
- package/dist/sdk.js +1 -7
- package/package.json +13 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# sandbox-core
|
|
2
2
|
|
|
3
|
+
## 0.90.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 592f35a: `@anthropic-ai/claude-agent-sdk` is now an optional peer dependency of werkmeister-core, so `npm i werkmeister-core` no longer installs it or its ~240 MB `claude-agent-sdk-<platform>` binary. Only the `ask` helpers (refine, issue distillation, the Jira MCP fallback) load it; without it, `askOrThrow` fails with "Asking Claude needs the Claude Agent SDK, which is not installed" and the install command, and `ask`/`askJson` return null as for any other failure. Install it beside core to use them. The `werkmeister` CLI still depends on it.
|
|
8
|
+
- 9eef5be: An npm-installed werkmeister-core finds the CLI package without `WERKMEISTER_ROOT`. When no werkmeister checkout sits above core, `sandboxRoot()` (and with it `infraRoot()` and every function that starts or creates things, such as `up` and `createWorkspace`) and the CLI-wrapper lookup follow the `werkmeister` on PATH to its package, e.g. `$(npm root -g)/werkmeister`. A `werkmeister` on PATH whose nearest `package.json` is not named `werkmeister` is skipped. `WERKMEISTER_ROOT` still overrides, and a checkout still wins over the global install.
|
|
9
|
+
|
|
10
|
+
The lookup follows symlinked bins (npm global installs, `npm link`), not pnpm's shell-script shims; set `WERKMEISTER_ROOT` there. Anything that resolves the CLI wrapper through core without `WERKMEISTER_ROOT`, such as the VS Code extension and the dashboard, now also falls back to the `werkmeister` on PATH before `~/.local/bin/werkmeister`, where it used to stop with an error.
|
|
11
|
+
|
|
12
|
+
## 0.90.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- c08040c: A starved queue head no longer deadlocks with the feature it waits on (SW-699). A services start from a feature whose gate is running (its lease is busy) now starts past a queue head that holds the line, when it fits: it is how that gate ends and frees the room the head waits for. Before, a head waiting on a busy gate's lease and that gate's own request for one more service each waited on the other until someone stopped a container by hand.
|
|
17
|
+
|
|
18
|
+
## 0.90.0
|
|
19
|
+
|
|
3
20
|
## 0.89.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -31,10 +31,6 @@ for (const ws of workspaces) {
|
|
|
31
31
|
|
|
32
32
|
The daemon's operations are reached with `callTool`. The full API is at [werkmeister.io/sdk](https://werkmeister.io/sdk/).
|
|
33
33
|
|
|
34
|
-
## Limits
|
|
35
|
-
|
|
36
|
-
Functions that start or create things (`up`, `createWorkspace` …) need `WERKMEISTER_ROOT` set to the CLI package directory, for example `$(npm root -g)/werkmeister`, until [SW-695](https://jory-group.atlassian.net/browse/SW-695).
|
|
37
|
-
|
|
38
34
|
## Licence
|
|
39
35
|
|
|
40
36
|
Apache-2.0. See `LICENSE` and `NOTICE`.
|
package/dist/config.d.ts
CHANGED
|
@@ -385,6 +385,15 @@ export declare function getVolumeBaseNames(): string[];
|
|
|
385
385
|
* around it — which is why `WERKMEISTER_ROOT` ranks first rather than as a fallback.
|
|
386
386
|
*/
|
|
387
387
|
export declare function sandboxRoot(): string;
|
|
388
|
+
/**
|
|
389
|
+
* SW-695: the package directory of the `werkmeister` on *pathEnv*, for an
|
|
390
|
+
* npm-installed core with no checkout around it. The bin's realpath lands in the
|
|
391
|
+
* package (an npm global, or a checkout's apps/cli linked onto PATH); the nearest
|
|
392
|
+
* package.json must name it `werkmeister`, so another tool's `werkmeister` is skipped.
|
|
393
|
+
* shortcut: symlinked bins on PATH only, so pnpm's shell-script shims and a GUI process with a
|
|
394
|
+
* stripped PATH miss it; WERKMEISTER_ROOT covers both.
|
|
395
|
+
*/
|
|
396
|
+
export declare function installedCliPackage(pathEnv?: string): string | null;
|
|
388
397
|
/**
|
|
389
398
|
* The `infra/` dir holding compose files, templates, the proxy UI, schemas and
|
|
390
399
|
* skills. All versioned code — the machine-specific registry files live in
|
package/dist/config.js
CHANGED
|
@@ -624,8 +624,46 @@ export function sandboxRoot() {
|
|
|
624
624
|
break;
|
|
625
625
|
dir = parent;
|
|
626
626
|
}
|
|
627
|
-
|
|
628
|
-
|
|
627
|
+
const installed = installedCliPackage();
|
|
628
|
+
if (installed)
|
|
629
|
+
return installed;
|
|
630
|
+
throw new Error("Could not locate the werkmeister CLI package. Install it (npm install -g werkmeister) " +
|
|
631
|
+
"or set WERKMEISTER_ROOT to its package directory (a checkout's apps/cli).");
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* SW-695: the package directory of the `werkmeister` on *pathEnv*, for an
|
|
635
|
+
* npm-installed core with no checkout around it. The bin's realpath lands in the
|
|
636
|
+
* package (an npm global, or a checkout's apps/cli linked onto PATH); the nearest
|
|
637
|
+
* package.json must name it `werkmeister`, so another tool's `werkmeister` is skipped.
|
|
638
|
+
* shortcut: symlinked bins on PATH only, so pnpm's shell-script shims and a GUI process with a
|
|
639
|
+
* stripped PATH miss it; WERKMEISTER_ROOT covers both.
|
|
640
|
+
*/
|
|
641
|
+
export function installedCliPackage(pathEnv = process.env.PATH ?? "") {
|
|
642
|
+
for (const binDir of pathEnv.split(path.delimiter)) {
|
|
643
|
+
if (!binDir)
|
|
644
|
+
continue;
|
|
645
|
+
let dir;
|
|
646
|
+
try {
|
|
647
|
+
dir = path.dirname(fs.realpathSync(path.join(binDir, "werkmeister")));
|
|
648
|
+
}
|
|
649
|
+
catch {
|
|
650
|
+
continue;
|
|
651
|
+
}
|
|
652
|
+
for (; dir !== path.dirname(dir); dir = path.dirname(dir)) {
|
|
653
|
+
const pkg = path.join(dir, "package.json");
|
|
654
|
+
if (!fs.existsSync(pkg))
|
|
655
|
+
continue;
|
|
656
|
+
try {
|
|
657
|
+
if (JSON.parse(fs.readFileSync(pkg, "utf8")).name === "werkmeister")
|
|
658
|
+
return dir;
|
|
659
|
+
}
|
|
660
|
+
catch {
|
|
661
|
+
// an unreadable package.json is no CLI package
|
|
662
|
+
}
|
|
663
|
+
break;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
return null;
|
|
629
667
|
}
|
|
630
668
|
/**
|
|
631
669
|
* The `infra/` dir holding compose files, templates, the proxy UI, schemas and
|
package/dist/generate.js
CHANGED
|
@@ -1145,8 +1145,10 @@ function featureCookieRegexp(name) {
|
|
|
1145
1145
|
* VALUE, selects which one serves the request, so any number of workspaces
|
|
1146
1146
|
* share the hostname concurrently.
|
|
1147
1147
|
* A request with neither — or one naming a feature that doesn't run this
|
|
1148
|
-
* service — falls through to `upstream
|
|
1149
|
-
*
|
|
1148
|
+
* service — falls through to `upstream`, the remote tunnel when there is one.
|
|
1149
|
+
* A local-only host has no tunnel (SW-704): a request selecting nothing gets
|
|
1150
|
+
* the first feature by name (`fallback`), marked by an X-Werkmeister-Served-By
|
|
1151
|
+
* response header, and one whose selection matches nothing gets a 404.
|
|
1150
1152
|
*
|
|
1151
1153
|
* Selecting on the cookie rather than picking a single winner is what makes
|
|
1152
1154
|
* concurrent workstreams work. It also stops a torn-down-but-still-registered
|
|
@@ -1155,7 +1157,8 @@ function featureCookieRegexp(name) {
|
|
|
1155
1157
|
*
|
|
1156
1158
|
* Returns `[{hostname, service, upstream, features?}, ...]`, where `features` is
|
|
1157
1159
|
* `[{name, upstream, matcher, cookie_regexp}, ...]`, omitted entirely when no
|
|
1158
|
-
* feature declares the service so the template renders the static form
|
|
1160
|
+
* feature declares the service so the template renders the static form, and
|
|
1161
|
+
* `fallback` is set only on a local-only host.
|
|
1159
1162
|
*/
|
|
1160
1163
|
function buildHostRouters(allFeatures, servicesConfig) {
|
|
1161
1164
|
const routers = [];
|
|
@@ -1192,8 +1195,9 @@ function buildHostRouters(allFeatures, servicesConfig) {
|
|
|
1192
1195
|
// Prefer the remote tunnel as the no-cookie default: it is always live, and
|
|
1193
1196
|
// picking a local feature here is what used to let a dead workspace own the
|
|
1194
1197
|
// hostname. Local-only services have no remote face, so they still fall back
|
|
1195
|
-
// to a feature rather than losing the site block entirely
|
|
1196
|
-
const
|
|
1198
|
+
// to a feature rather than losing the site block entirely, named in `fallback`.
|
|
1199
|
+
const fallback = rc.remoteUpstream ? undefined : candidates[0];
|
|
1200
|
+
const defaultUpstream = rc.remoteUpstream ?? fallback?.upstream;
|
|
1197
1201
|
// No feature and no fallback -> nothing to proxy to, skip.
|
|
1198
1202
|
if (!defaultUpstream) {
|
|
1199
1203
|
continue;
|
|
@@ -1203,10 +1207,27 @@ function buildHostRouters(allFeatures, servicesConfig) {
|
|
|
1203
1207
|
service: svcName,
|
|
1204
1208
|
upstream: defaultUpstream,
|
|
1205
1209
|
...(candidates.length ? { features: candidates } : {}),
|
|
1210
|
+
...(fallback ? { fallback: fallback.name } : {}),
|
|
1206
1211
|
});
|
|
1207
1212
|
}
|
|
1208
1213
|
return routers;
|
|
1209
1214
|
}
|
|
1215
|
+
/** Local-only default (SW-704): nothing selected -> the marked fallback; a selection matching nothing -> 404. Mirrors Caddyfile.njk. */
|
|
1216
|
+
function fallbackLines(feature, upstream) {
|
|
1217
|
+
return [
|
|
1218
|
+
" @no_selection {",
|
|
1219
|
+
" not header X-Feature *",
|
|
1220
|
+
" not header_regexp Cookie (?:^|;\\s*)X-Feature=",
|
|
1221
|
+
" }",
|
|
1222
|
+
" handle @no_selection {",
|
|
1223
|
+
` header X-Werkmeister-Served-By "${feature} (fallback: no feature selected)"`,
|
|
1224
|
+
` reverse_proxy ${upstream}`,
|
|
1225
|
+
" }",
|
|
1226
|
+
" handle /* {",
|
|
1227
|
+
' respond "No running feature named in X-Feature serves {host}; pick one at /__werkmeister" 404',
|
|
1228
|
+
" }",
|
|
1229
|
+
];
|
|
1230
|
+
}
|
|
1210
1231
|
/** Render host-router site blocks (built-in fallback path). */
|
|
1211
1232
|
function hostRouterLines(routers) {
|
|
1212
1233
|
const lines = [];
|
|
@@ -1235,6 +1256,7 @@ function hostRouterLines(routers) {
|
|
|
1235
1256
|
for (const f of features) {
|
|
1236
1257
|
lines.push(` @${f["matcher"]}_header header X-Feature ${f["name"]}`);
|
|
1237
1258
|
lines.push(` handle @${f["matcher"]}_header {`);
|
|
1259
|
+
lines.push(` header X-Werkmeister-Served-By ${f["name"]}`);
|
|
1238
1260
|
lines.push(` reverse_proxy ${f["upstream"]}`);
|
|
1239
1261
|
lines.push(" }");
|
|
1240
1262
|
}
|
|
@@ -1243,6 +1265,7 @@ function hostRouterLines(routers) {
|
|
|
1243
1265
|
lines.push(` # X-Feature=${f["name"]} -> that workspace's containers.`);
|
|
1244
1266
|
lines.push(` @${f["matcher"]} header_regexp Cookie ${f["cookie_regexp"]}`);
|
|
1245
1267
|
lines.push(` handle @${f["matcher"]} {`);
|
|
1268
|
+
lines.push(` header X-Werkmeister-Served-By ${f["name"]}`);
|
|
1246
1269
|
lines.push(` reverse_proxy ${f["upstream"]} {`);
|
|
1247
1270
|
lines.push(` header_up X-Feature ${f["name"]}`);
|
|
1248
1271
|
lines.push(" }");
|
|
@@ -1262,9 +1285,14 @@ function hostRouterLines(routers) {
|
|
|
1262
1285
|
// `/*` rather than a bare `handle`: the more specific selector sibling
|
|
1263
1286
|
// still wins, and the structural lint's bare-vs-scoped route-drop guard stays
|
|
1264
1287
|
// meaningful instead of firing on every generated file.
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1288
|
+
if (r["fallback"]) {
|
|
1289
|
+
lines.push(...fallbackLines(r["fallback"], r["upstream"]));
|
|
1290
|
+
}
|
|
1291
|
+
else {
|
|
1292
|
+
lines.push(" handle /* {");
|
|
1293
|
+
lines.push(` reverse_proxy ${r["upstream"]}`);
|
|
1294
|
+
lines.push(" }");
|
|
1295
|
+
}
|
|
1268
1296
|
lines.push("}");
|
|
1269
1297
|
lines.push("");
|
|
1270
1298
|
}
|
|
@@ -22,6 +22,11 @@ export declare function extractJson(out: string): string | null;
|
|
|
22
22
|
type AskOpts = {
|
|
23
23
|
tools?: boolean;
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* SW-694: the SDK is an optional peer of core, so "not installed" becomes an install
|
|
27
|
+
* hint; any other load failure (a broken install) keeps its own error.
|
|
28
|
+
*/
|
|
29
|
+
export declare function sdkLoadError(e: unknown): unknown;
|
|
25
30
|
/** The structured answer in a result message, or the WorkspaceError that says why there is none. */
|
|
26
31
|
export declare function fromResult(m: SDKResultMessage): Record<string, unknown>;
|
|
27
32
|
/** One run, the answer or null on any failure. */
|
|
@@ -59,6 +59,16 @@ export function extractJson(out) {
|
|
|
59
59
|
const fenced = /```(?:json)?\s*([\s\S]*?)```/i.exec(out);
|
|
60
60
|
return fenced ? slice(fenced[1]) : whole;
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* SW-694: the SDK is an optional peer of core, so "not installed" becomes an install
|
|
64
|
+
* hint; any other load failure (a broken install) keeps its own error.
|
|
65
|
+
*/
|
|
66
|
+
export function sdkLoadError(e) {
|
|
67
|
+
return e?.code === "ERR_MODULE_NOT_FOUND"
|
|
68
|
+
? new WorkspaceError("Asking Claude needs the Claude Agent SDK, which is not installed. " +
|
|
69
|
+
"Install it beside werkmeister-core with: npm install @anthropic-ai/claude-agent-sdk")
|
|
70
|
+
: e;
|
|
71
|
+
}
|
|
62
72
|
/** `ask`'s answer as one string field: no tag scraping. */
|
|
63
73
|
const TEXT_SCHEMA = {
|
|
64
74
|
type: "object",
|
|
@@ -74,7 +84,9 @@ const TEXT_SCHEMA = {
|
|
|
74
84
|
*/
|
|
75
85
|
async function runQuery(prompt, schema, opts) {
|
|
76
86
|
// Loaded on use: the MCP server imports this module at start, and the SDK is heavy.
|
|
77
|
-
const { query } = await import("@anthropic-ai/claude-agent-sdk")
|
|
87
|
+
const { query } = await import("@anthropic-ai/claude-agent-sdk").catch((e) => {
|
|
88
|
+
throw sdkLoadError(e);
|
|
89
|
+
});
|
|
78
90
|
const abortController = new AbortController();
|
|
79
91
|
const timer = setTimeout(() => abortController.abort(), 120_000);
|
|
80
92
|
try {
|
package/dist/pr_lifecycle.d.ts
CHANGED
|
@@ -298,7 +298,7 @@ export declare function deliverHeadless(cb: PrCallback): Promise<string[]>;
|
|
|
298
298
|
/**
|
|
299
299
|
* `werkmeister pr watch` (desktop: false) and the werkmeister mod's timer (desktop: true): one
|
|
300
300
|
* pass over every workspace. Headless claims are delivered here; desktop claims are returned
|
|
301
|
-
* for the mod to send through the app, then one idle-reaper pass
|
|
301
|
+
* for the mod to send through the app, then one idle-reaper pass. Never merges and
|
|
302
302
|
* never closes out.
|
|
303
303
|
*/
|
|
304
304
|
export declare function watchPrs(opts: {
|
|
@@ -384,7 +384,7 @@ export declare function openTerminalSessions(ws: string, run?: Run, ownedDir?: s
|
|
|
384
384
|
/**
|
|
385
385
|
* The one end-of-workspace verb (#160). Shipped: close the issue, write closeout.md, remove, delete
|
|
386
386
|
* the merged branches. With *abandon*: record the reason, leave the issue, remove (which pushes every
|
|
387
|
-
* branch) and keep the branches. With *noPr
|
|
387
|
+
* branch) and keep the branches. With *noPr*: the work changed no repo, so close as done
|
|
388
388
|
* with the reason instead of a PR.
|
|
389
389
|
*/
|
|
390
390
|
export declare function closeOut(name: string, opts?: {
|
package/dist/pr_lifecycle.js
CHANGED
|
@@ -2065,7 +2065,7 @@ async function fixLeftBehind(dir, deps) {
|
|
|
2065
2065
|
/**
|
|
2066
2066
|
* `werkmeister pr watch` (desktop: false) and the werkmeister mod's timer (desktop: true): one
|
|
2067
2067
|
* pass over every workspace. Headless claims are delivered here; desktop claims are returned
|
|
2068
|
-
* for the mod to send through the app, then one idle-reaper pass
|
|
2068
|
+
* for the mod to send through the app, then one idle-reaper pass. Never merges and
|
|
2069
2069
|
* never closes out.
|
|
2070
2070
|
*/
|
|
2071
2071
|
export async function watchPrs(opts, deps = defaultDeps(), send = deliverHeadless, idleLock = path.join(sandboxHome(), "idle-stop.lock")) {
|
|
@@ -2451,7 +2451,7 @@ export async function openTerminalSessions(ws, run = execRun, ownedDir = vscodeT
|
|
|
2451
2451
|
/**
|
|
2452
2452
|
* The one end-of-workspace verb (#160). Shipped: close the issue, write closeout.md, remove, delete
|
|
2453
2453
|
* the merged branches. With *abandon*: record the reason, leave the issue, remove (which pushes every
|
|
2454
|
-
* branch) and keep the branches. With *noPr
|
|
2454
|
+
* branch) and keep the branches. With *noPr*: the work changed no repo, so close as done
|
|
2455
2455
|
* with the reason instead of a PR.
|
|
2456
2456
|
*/
|
|
2457
2457
|
export async function closeOut(name, opts = {}, deps = defaultDeps()) {
|
package/dist/sandbox.d.ts
CHANGED
|
@@ -52,7 +52,8 @@ export interface CreateResult {
|
|
|
52
52
|
* that shells out to the CLI (dashboard, MCP servers) must come through here rather than hand-rolling its own order.
|
|
53
53
|
*
|
|
54
54
|
* Order: $WERKMEISTER_BIN → $WERKMEISTER_ROOT/werkmeister → walk up from this module to the
|
|
55
|
-
* checkout root that owns the CLI package → the
|
|
55
|
+
* checkout root that owns the CLI package → the installed CLI package of the `werkmeister`
|
|
56
|
+
* on PATH (SW-695, for an npm-installed core) → the `~/.local/bin/werkmeister` symlink.
|
|
56
57
|
*
|
|
57
58
|
* WERKMEISTER_ROOT is the machine-global pointer at the *running* checkout: `werkmeister
|
|
58
59
|
* config` generates it into `~/.werkmeister/env.sh`, which `~/.zshenv` and the
|
|
@@ -60,8 +61,8 @@ export interface CreateResult {
|
|
|
60
61
|
* two resolve to whichever checkout happens to be nearest or globally linked,
|
|
61
62
|
* which is the wrong one as soon as you work out of a feature worktree.
|
|
62
63
|
*
|
|
63
|
-
*
|
|
64
|
-
* environment a GUI-launched process inherits.
|
|
64
|
+
* Every step but the installed-CLI one is a path lookup, not a PATH lookup — robust to
|
|
65
|
+
* the stripped environment a GUI-launched process inherits.
|
|
65
66
|
*/
|
|
66
67
|
export declare function resolveSandboxBin(opts?: {
|
|
67
68
|
from?: string;
|
|
@@ -165,7 +166,7 @@ export interface WorkspaceEntry {
|
|
|
165
166
|
/** {@link lifecycleOf}'s state: PR files only, no network. */
|
|
166
167
|
lifecycle: Lifecycle;
|
|
167
168
|
}
|
|
168
|
-
/** start_session's arguments for the workspace at `dir
|
|
169
|
+
/** start_session's arguments for the workspace at `dir`: the pane's ▶ Start work and `werkmeister workspace prompt --args`. */
|
|
169
170
|
export declare function startArgs(dir: string): Promise<StartArgs>;
|
|
170
171
|
/**
|
|
171
172
|
* List the workspaces (immediate subdirectories) under the workspaces root,
|
|
@@ -834,7 +835,7 @@ export declare function resumeClaudeInTerminal(name: string, sessionId?: string,
|
|
|
834
835
|
/** Where it opened. */
|
|
835
836
|
launcher: Launcher;
|
|
836
837
|
}>;
|
|
837
|
-
/** Opens a Terminal window following the workspace's container logs, for the pane's Logs
|
|
838
|
+
/** Opens a Terminal window following the workspace's container logs, for the pane's Logs. */
|
|
838
839
|
export declare function followLogsInTerminal(name: string): Promise<{
|
|
839
840
|
/** The feature (from the workspace's `.env`) whose logs the Terminal follows. */
|
|
840
841
|
feature: string;
|
package/dist/sandbox.js
CHANGED
|
@@ -41,7 +41,7 @@ export { childEnv } from "./tool_bins.js";
|
|
|
41
41
|
// Type-only: erased at build, so this adds nothing to the bundle.
|
|
42
42
|
import { isOneShotService, projectName } from "./compose.js";
|
|
43
43
|
import { INFRA_PROJECT, K8S_FORWARDS_CONTAINER } from "./compose_infra.js";
|
|
44
|
-
import { dotDir, envVar, forwardSpecs, loadServices, portsYamlPath, sandboxHome, servicesYamlPath, slotPortRange, workspacesRoot, } from "./config.js";
|
|
44
|
+
import { dotDir, envVar, forwardSpecs, installedCliPackage, loadServices, portsYamlPath, sandboxHome, servicesYamlPath, slotPortRange, workspacesRoot, } from "./config.js";
|
|
45
45
|
import { containerRunning, projectContainers } from "./docker.js";
|
|
46
46
|
import { WorkspaceError } from "./errors.js";
|
|
47
47
|
import { buildFormSchema } from "./form_schema.js";
|
|
@@ -88,7 +88,8 @@ async function isDir(p) {
|
|
|
88
88
|
* that shells out to the CLI (dashboard, MCP servers) must come through here rather than hand-rolling its own order.
|
|
89
89
|
*
|
|
90
90
|
* Order: $WERKMEISTER_BIN → $WERKMEISTER_ROOT/werkmeister → walk up from this module to the
|
|
91
|
-
* checkout root that owns the CLI package → the
|
|
91
|
+
* checkout root that owns the CLI package → the installed CLI package of the `werkmeister`
|
|
92
|
+
* on PATH (SW-695, for an npm-installed core) → the `~/.local/bin/werkmeister` symlink.
|
|
92
93
|
*
|
|
93
94
|
* WERKMEISTER_ROOT is the machine-global pointer at the *running* checkout: `werkmeister
|
|
94
95
|
* config` generates it into `~/.werkmeister/env.sh`, which `~/.zshenv` and the
|
|
@@ -96,8 +97,8 @@ async function isDir(p) {
|
|
|
96
97
|
* two resolve to whichever checkout happens to be nearest or globally linked,
|
|
97
98
|
* which is the wrong one as soon as you work out of a feature worktree.
|
|
98
99
|
*
|
|
99
|
-
*
|
|
100
|
-
* environment a GUI-launched process inherits.
|
|
100
|
+
* Every step but the installed-CLI one is a path lookup, not a PATH lookup — robust to
|
|
101
|
+
* the stripped environment a GUI-launched process inherits.
|
|
101
102
|
*/
|
|
102
103
|
export async function resolveSandboxBin(opts = {}) {
|
|
103
104
|
const explicit = envVar("BIN");
|
|
@@ -120,6 +121,12 @@ export async function resolveSandboxBin(opts = {}) {
|
|
|
120
121
|
break;
|
|
121
122
|
dir = parent;
|
|
122
123
|
}
|
|
124
|
+
const installed = installedCliPackage();
|
|
125
|
+
if (installed) {
|
|
126
|
+
const cand = path.join(installed, "werkmeister");
|
|
127
|
+
if (await isExecutable(cand))
|
|
128
|
+
return cand;
|
|
129
|
+
}
|
|
123
130
|
const local = path.join(os.homedir(), ".local", "bin", "werkmeister");
|
|
124
131
|
if (await isExecutable(local))
|
|
125
132
|
return local;
|
|
@@ -622,7 +629,7 @@ async function readWorkspaceConfig(workspaceDir) {
|
|
|
622
629
|
};
|
|
623
630
|
}
|
|
624
631
|
}
|
|
625
|
-
/** start_session's arguments for the workspace at `dir
|
|
632
|
+
/** start_session's arguments for the workspace at `dir`: the pane's ▶ Start work and `werkmeister workspace prompt --args`. */
|
|
626
633
|
export async function startArgs(dir) {
|
|
627
634
|
return buildStartArgs({ name: path.basename(dir), ...(await readWorkspaceConfig(dir)) });
|
|
628
635
|
}
|
|
@@ -2494,7 +2501,7 @@ export async function resumeClaudeInTerminal(name, sessionId, fresh = false, pro
|
|
|
2494
2501
|
const opened = await openClaudeSession(`cd ${shellQuote(target)} && ${harnessFor(target).resumeCommand(resumeId, model, prompt)}`, claudeLaunchUri({ workspace: path.basename(target), sessionId: resumeId, prompt }), true, launcher);
|
|
2495
2502
|
return { path: target, sessionId: resumeId, launcher: opened };
|
|
2496
2503
|
}
|
|
2497
|
-
/** Opens a Terminal window following the workspace's container logs, for the pane's Logs
|
|
2504
|
+
/** Opens a Terminal window following the workspace's container logs, for the pane's Logs. */
|
|
2498
2505
|
export async function followLogsInTerminal(name) {
|
|
2499
2506
|
const target = await resolveWorkspaceDir(name);
|
|
2500
2507
|
const feature = await readEnvValue(target, "FEATURE");
|
package/dist/scheduler.js
CHANGED
|
@@ -49,8 +49,12 @@ export function admit(budget, running, queue, req) {
|
|
|
49
49
|
const position = order.indexOf(self) + 1;
|
|
50
50
|
const isHead = position === 1;
|
|
51
51
|
// Backfill: what fits starts past a head that doesn't, unless the head is a gate (it frees its whole
|
|
52
|
-
// feature soonest) or has waited STARVE_MS (SW-675).
|
|
53
|
-
|
|
52
|
+
// feature soonest) or has waited STARVE_MS (SW-675). Never against a service start of a busy
|
|
53
|
+
// feature: it is how its gate ends and frees the lease the head may be waiting on (SW-699).
|
|
54
|
+
// shortcut: busy also covers a gate exec in the last idle_stop_minutes, so a recent gate's later
|
|
55
|
+
// --service start passes too; tighten to a live-gate signal if heads starve again.
|
|
56
|
+
const endsGate = !!req.services && running.some((l) => l.feature === req.feature && l.busy);
|
|
57
|
+
const headHolds = !isHead && !endsGate && (order[0].gate || order[0].waitedMs >= STARVE_MS);
|
|
54
58
|
if (fits({ memory: 0, cpus: 0 }) && (req.byPerson || !headHolds))
|
|
55
59
|
return { kind: "admit" };
|
|
56
60
|
// An idle or human-check lease (a session parked on a question) has nobody in it, so the queue head
|
package/dist/sdk.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
*
|
|
4
|
-
* Only `werkmeister-core/sdk` is public API and follows semver. Every other entry point, including
|
|
5
|
-
* the package root (`werkmeister-core`) and subpaths like `werkmeister-core/config`, is internal to
|
|
6
|
-
* werkmeister and can change in any release. `werkmeister-core` is versioned in lockstep with the
|
|
7
|
-
* werkmeister CLI: install the same version as the CLI you run. While the version is 0.x, a breaking
|
|
8
|
-
* change to `werkmeister-core/sdk` comes in a minor release, and its changelog entry says so.
|
|
2
|
+
* The exported functions, types and errors of the werkmeister SDK.
|
|
9
3
|
* @module
|
|
10
4
|
*/
|
|
11
5
|
export { clearNotice } from "./agent_state.js";
|
package/dist/sdk.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
*
|
|
4
|
-
* Only `werkmeister-core/sdk` is public API and follows semver. Every other entry point, including
|
|
5
|
-
* the package root (`werkmeister-core`) and subpaths like `werkmeister-core/config`, is internal to
|
|
6
|
-
* werkmeister and can change in any release. `werkmeister-core` is versioned in lockstep with the
|
|
7
|
-
* werkmeister CLI: install the same version as the CLI you run. While the version is 0.x, a breaking
|
|
8
|
-
* change to `werkmeister-core/sdk` comes in a minor release, and its changelog entry says so.
|
|
2
|
+
* The exported functions, types and errors of the werkmeister SDK.
|
|
9
3
|
* @module
|
|
10
4
|
*/
|
|
11
5
|
export { clearNotice } from "./agent_state.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "werkmeister-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.90.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "werkmeister's shared library. Its public API is werkmeister-core/sdk; every other entry point is internal.",
|
|
@@ -104,7 +104,6 @@
|
|
|
104
104
|
"./worktrees": "./dist/worktrees.js"
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
|
-
"@anthropic-ai/claude-agent-sdk": "^0.3.288",
|
|
108
107
|
"@types/dockerode": "^4.0.1",
|
|
109
108
|
"@types/tar-fs": "^2.0.4",
|
|
110
109
|
"ajv": "^8.20.0",
|
|
@@ -114,7 +113,17 @@
|
|
|
114
113
|
"tar-fs": "^2.1.5",
|
|
115
114
|
"yaml": "^2.9.0"
|
|
116
115
|
},
|
|
116
|
+
"//peerDependencies": "SW-694: only the lazy ask helpers load the agent SDK, and it pulls a ~240 MB platform binary, so a library install leaves it out.",
|
|
117
|
+
"peerDependencies": {
|
|
118
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.288"
|
|
119
|
+
},
|
|
120
|
+
"peerDependenciesMeta": {
|
|
121
|
+
"@anthropic-ai/claude-agent-sdk": {
|
|
122
|
+
"optional": true
|
|
123
|
+
}
|
|
124
|
+
},
|
|
117
125
|
"devDependencies": {
|
|
126
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.288",
|
|
118
127
|
"@types/node": "^22.10.0",
|
|
119
128
|
"@types/nunjucks": "^3.2.6",
|
|
120
129
|
"typedoc": "0.28.20",
|
|
@@ -125,6 +134,7 @@
|
|
|
125
134
|
"typecheck": "tsc --noEmit",
|
|
126
135
|
"docs:links": "typedoc",
|
|
127
136
|
"docs:sdk": "typedoc --options typedoc.sdk.json",
|
|
128
|
-
"test": "sh ./run-tests.sh"
|
|
137
|
+
"test": "sh ./run-tests.sh",
|
|
138
|
+
"test:changed": "node test-changed.mjs"
|
|
129
139
|
}
|
|
130
140
|
}
|