owenloop 0.5.0 → 0.5.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 +67 -0
- package/README.md +144 -35
- package/bin/owenloop.mjs +49 -1
- package/dist/packages/work/src/agent/brief.d.ts +29 -4
- package/dist/packages/work/src/agent/brief.js +49 -4
- package/dist/packages/work/src/agent/capability-model.d.ts +123 -0
- package/dist/packages/work/src/agent/capability-model.js +148 -0
- package/dist/packages/work/src/agent/loop.d.ts +56 -7
- package/dist/packages/work/src/agent/loop.js +166 -9
- package/dist/packages/work/src/bundle/cache.d.ts +7 -5
- package/dist/packages/work/src/bundle/cache.js +20 -6
- package/dist/packages/work/src/bundle/fetch.d.ts +7 -5
- package/dist/packages/work/src/bundle/fetch.js +27 -7
- package/dist/packages/work/src/bundle/types.d.ts +8 -4
- package/dist/packages/work/src/consumed-verifier.d.ts +45 -0
- package/dist/packages/work/src/consumed-verifier.js +205 -0
- package/dist/packages/work/src/exec/instructions.d.ts +99 -0
- package/dist/packages/work/src/exec/instructions.js +323 -0
- package/dist/packages/work/src/exec/loop.d.ts +29 -1
- package/dist/packages/work/src/exec/loop.js +313 -35
- package/dist/packages/work/src/exec/payload.d.ts +29 -0
- package/dist/packages/work/src/exec/payload.js +54 -0
- package/dist/packages/work/src/exec/receipt.d.ts +9 -6
- package/dist/packages/work/src/exec/receipt.js +12 -1
- package/dist/packages/work/src/exec/runner.d.ts +7 -1
- package/dist/packages/work/src/exec/runner.js +84 -3
- package/dist/packages/work/src/harness/child-env.js +7 -0
- package/dist/packages/work/src/harness/claude.d.ts +20 -8
- package/dist/packages/work/src/harness/claude.js +260 -58
- package/dist/packages/work/src/harness/codex.d.ts +5 -4
- package/dist/packages/work/src/harness/codex.js +169 -41
- package/dist/packages/work/src/harness/contract.d.ts +36 -11
- package/dist/packages/work/src/harness/fake.js +1 -0
- package/dist/packages/work/src/harness/jsonrpc-stdio.js +7 -0
- package/dist/packages/work/src/harness/permissions.d.ts +16 -3
- package/dist/packages/work/src/harness/permissions.js +102 -13
- package/dist/packages/work/src/harness/session-store.d.ts +30 -10
- package/dist/packages/work/src/harness/session-store.js +317 -89
- package/dist/packages/work/src/hold/mcp.d.ts +25 -5
- package/dist/packages/work/src/hold/mcp.js +134 -12
- package/dist/packages/work/src/hub/client.d.ts +8 -1
- package/dist/packages/work/src/hub/client.js +15 -1
- package/dist/packages/work/src/hub/types.d.ts +137 -33
- package/dist/packages/work/src/hub/types.js +8 -10
- package/dist/packages/work/src/mcp/server.js +1 -1
- package/dist/packages/work/src/owenloop-bin.d.ts +1 -0
- package/dist/packages/work/src/owenloop-bin.js +18 -0
- package/dist/packages/work/src/roles/agent-run.d.ts +12 -6
- package/dist/packages/work/src/roles/agent-run.js +115 -34
- package/dist/packages/work/src/roles/exec.d.ts +8 -0
- package/dist/packages/work/src/roles/exec.js +27 -2
- package/dist/packages/work/src/roles/hold.d.ts +6 -0
- package/dist/packages/work/src/roles/hold.js +83 -13
- package/dist/packages/work/src/roles/lint.d.ts +3 -4
- package/dist/packages/work/src/roles/lint.js +41 -7
- package/dist/packages/work/src/roles/settings.js +19 -2
- package/dist/packages/work/src/roles/shift.d.ts +1 -0
- package/dist/packages/work/src/roles/shift.js +36 -2
- package/dist/packages/work/src/settings/settings.d.ts +70 -1
- package/dist/packages/work/src/settings/settings.js +90 -4
- package/dist/packages/work/src/shift/logretention.d.ts +253 -0
- package/dist/packages/work/src/shift/logretention.js +407 -0
- package/dist/packages/work/src/shift/logsink.d.ts +14 -0
- package/dist/packages/work/src/shift/logsink.js +98 -0
- package/dist/packages/work/src/shift/loop.d.ts +32 -4
- package/dist/packages/work/src/shift/loop.js +687 -166
- package/dist/packages/work/src/shift/protocol.d.ts +128 -1
- package/dist/packages/work/src/shift/protocol.js +14 -0
- package/dist/packages/work/src/shift/runtime.d.ts +16 -0
- package/dist/packages/work/src/shift/runtime.js +291 -5
- package/dist/packages/work/src/shift/server.d.ts +13 -0
- package/dist/packages/work/src/shift/server.js +61 -36
- package/dist/packages/work/src/shift/spawn.d.ts +115 -19
- package/dist/packages/work/src/shift/spawn.js +234 -30
- package/dist/packages/work/src/shift/state.d.ts +76 -49
- package/dist/packages/work/src/shift/state.js +350 -103
- package/dist/packages/work/src/shift/truncate.d.ts +35 -0
- package/dist/packages/work/src/shift/truncate.js +73 -0
- package/dist/packages/work/src/submit-proof.d.ts +61 -0
- package/dist/packages/work/src/submit-proof.js +119 -0
- package/dist/packages/work/src/submit-value.d.ts +48 -0
- package/dist/packages/work/src/submit-value.js +118 -0
- package/dist/packages/work/src/usage.d.ts +1 -1
- package/dist/packages/work/src/usage.js +11 -0
- package/dist/src/add.d.ts +64 -259
- package/dist/src/add.js +81 -615
- package/dist/src/archive.d.ts +97 -0
- package/dist/src/archive.js +591 -0
- package/dist/src/bundle/index.d.ts +64 -0
- package/dist/src/bundle/index.js +508 -0
- package/dist/src/bundle/manifest.d.ts +50 -0
- package/dist/src/bundle/manifest.js +435 -0
- package/dist/src/bundle/runtime.d.ts +26 -0
- package/dist/src/bundle/runtime.js +64 -0
- package/dist/src/bundle/tar.d.ts +62 -0
- package/dist/src/bundle/tar.js +238 -0
- package/dist/src/bundle/types.d.ts +105 -0
- package/dist/src/bundle/types.js +21 -0
- package/dist/src/capabilities.d.ts +93 -0
- package/dist/src/capabilities.js +101 -0
- package/dist/src/cli.d.ts +90 -20
- package/dist/src/cli.js +2421 -374
- package/dist/src/credentials.d.ts +4 -3
- package/dist/src/credentials.js +21 -19
- package/dist/src/crypto/allowed-signers.d.ts +68 -0
- package/dist/src/crypto/allowed-signers.js +307 -0
- package/dist/src/crypto/canonical.d.ts +8 -0
- package/dist/src/crypto/canonical.js +92 -0
- package/dist/src/crypto/chain.d.ts +65 -0
- package/dist/src/crypto/chain.js +377 -0
- package/dist/src/crypto/dsse.d.ts +209 -0
- package/dist/src/crypto/dsse.js +282 -0
- package/dist/src/crypto/enrollment.d.ts +78 -0
- package/dist/src/crypto/enrollment.js +186 -0
- package/dist/src/crypto/index.d.ts +48 -0
- package/dist/src/crypto/index.js +44 -0
- package/dist/src/crypto/keys.d.ts +258 -0
- package/dist/src/crypto/keys.js +908 -0
- package/dist/src/crypto/org-root.d.ts +33 -0
- package/dist/src/crypto/org-root.js +78 -0
- package/dist/src/crypto/origin-rules.d.ts +56 -0
- package/dist/src/crypto/origin-rules.js +143 -0
- package/dist/src/crypto/policy-floor.d.ts +98 -0
- package/dist/src/crypto/policy-floor.js +353 -0
- package/dist/src/crypto/records.d.ts +319 -0
- package/dist/src/crypto/records.js +168 -0
- package/dist/src/crypto/scope.d.ts +49 -0
- package/dist/src/crypto/scope.js +83 -0
- package/dist/src/crypto/ssh.d.ts +171 -0
- package/dist/src/crypto/ssh.js +396 -0
- package/dist/src/crypto/submission.d.ts +33 -0
- package/dist/src/crypto/submission.js +47 -0
- package/dist/src/crypto/trust-roots.d.ts +29 -0
- package/dist/src/crypto/trust-roots.js +39 -0
- package/dist/src/crypto/verify-consumed.d.ts +67 -0
- package/dist/src/crypto/verify-consumed.js +259 -0
- package/dist/src/crypto/verify-origin.d.ts +50 -0
- package/dist/src/crypto/verify-origin.js +151 -0
- package/dist/src/crypto/verify-publication.d.ts +60 -0
- package/dist/src/crypto/verify-publication.js +150 -0
- package/dist/src/defs.d.ts +24 -1
- package/dist/src/defs.js +335 -27
- package/dist/src/engine.d.ts +211 -6
- package/dist/src/engine.js +459 -59
- package/dist/src/factory.d.ts +16 -0
- package/dist/src/factory.js +16 -4
- package/dist/src/global-config.d.ts +59 -0
- package/dist/src/global-config.js +84 -0
- package/dist/src/hub.d.ts +102 -32
- package/dist/src/hub.js +147 -58
- package/dist/src/index.d.ts +19 -2
- package/dist/src/index.js +23 -2
- package/dist/src/install.d.ts +538 -0
- package/dist/src/install.js +1981 -0
- package/dist/src/lock.d.ts +15 -57
- package/dist/src/lock.js +251 -143
- package/dist/src/mcp/serve.d.ts +46 -22
- package/dist/src/mcp/serve.js +174 -44
- package/dist/src/mcp/server.js +12 -1
- package/dist/src/model.d.ts +51 -0
- package/dist/src/model.js +157 -1
- package/dist/src/order-resolver.d.ts +184 -0
- package/dist/src/order-resolver.js +252 -0
- package/dist/src/package-version.d.ts +10 -0
- package/dist/src/package-version.js +42 -0
- package/dist/src/paths.d.ts +14 -1
- package/dist/src/paths.js +18 -0
- package/dist/src/schemas/enrollment-grant.v1.schema.json +90 -0
- package/dist/src/schemas/index.d.ts +1433 -0
- package/dist/src/schemas/index.js +31 -0
- package/dist/src/schemas/order.v1.schema.json +120 -0
- package/dist/src/schemas/origin.v1.schema.json +68 -0
- package/dist/src/schemas/policy-floor.v1.schema.json +29 -0
- package/dist/src/schemas/publication.v1.schema.json +31 -0
- package/dist/src/schemas/revocation.v1.schema.json +39 -0
- package/dist/src/schemas/submission.v1.schema.json +61 -0
- package/dist/src/store/def-source.d.ts +52 -0
- package/dist/src/store/def-source.js +335 -0
- package/dist/src/store/index-file.d.ts +69 -0
- package/dist/src/store/index-file.js +151 -0
- package/dist/src/store/index.d.ts +27 -0
- package/dist/src/store/index.js +22 -0
- package/dist/src/store/ingestor.d.ts +43 -0
- package/dist/src/store/ingestor.js +211 -0
- package/dist/src/store/install.d.ts +228 -0
- package/dist/src/store/install.js +555 -0
- package/dist/src/store/instruction-source.d.ts +49 -0
- package/dist/src/store/instruction-source.js +298 -0
- package/dist/src/store/origin-evidence.d.ts +21 -0
- package/dist/src/store/origin-evidence.js +66 -0
- package/dist/src/store/pre-commit-verifier.d.ts +68 -0
- package/dist/src/store/pre-commit-verifier.js +418 -0
- package/dist/src/store/resolve.d.ts +138 -0
- package/dist/src/store/resolve.js +363 -0
- package/dist/src/store/types.d.ts +288 -0
- package/dist/src/store/types.js +356 -0
- package/dist/src/store.d.ts +33 -1
- package/dist/src/store.js +57 -4
- package/dist/src/types.d.ts +146 -12
- package/dist/src/untar.d.ts +8 -23
- package/dist/src/untar.js +10 -136
- package/docs/agent-runner.md +86 -0
- package/docs/authoring.md +64 -6
- package/docs/bundles.md +350 -0
- package/docs/cli.md +1298 -106
- package/docs/crypto.md +832 -0
- package/docs/design.md +342 -20
- package/docs/embedding.md +132 -25
- package/docs/shift-logs.md +642 -0
- package/docs/wire-contracts.md +395 -0
- package/package.json +6 -1
- package/plugins/claude-code/.claude-plugin/marketplace.json +14 -0
- package/plugins/claude-code/plugin/.claude-plugin/plugin.json +8 -0
- package/plugins/claude-code/plugin/.mcp.json +14 -0
- package/plugins/claude-code/plugin/hooks/hooks.json +26 -0
- package/plugins/claude-code/plugin/hooks/session-end.sh +40 -0
- package/plugins/claude-code/plugin/hooks/session-start.sh +52 -0
- package/plugins/claude-code/plugin/skills/author/SKILL.md +181 -0
- package/plugins/claude-code/plugin/skills/conduct/SKILL.md +106 -0
- package/plugins/claude-code/plugin/skills/shift/SKILL.md +105 -0
- package/plugins/codex/.agents/plugins/marketplace.json +21 -0
- package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +7 -0
- package/plugins/codex/plugins/owenloop/.mcp.json +20 -0
- package/plugins/codex/plugins/owenloop/hooks/hooks.json +26 -0
- package/plugins/codex/plugins/owenloop/hooks/session-end.sh +40 -0
- package/plugins/codex/plugins/owenloop/hooks/session-start.sh +52 -0
- package/plugins/codex/plugins/owenloop/skills/author/SKILL.md +181 -0
- package/plugins/codex/plugins/owenloop/skills/conduct/SKILL.md +106 -0
- package/plugins/codex/plugins/owenloop/skills/shift/SKILL.md +105 -0
|
@@ -30,12 +30,10 @@
|
|
|
30
30
|
*
|
|
31
31
|
* ── WHERE THE STEP SPEC COMES FROM ──
|
|
32
32
|
*
|
|
33
|
-
* The
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* `readDispatchBundle(cacheDir, def)` → `bundle.def.hash` → `readStepSpec(...)`.
|
|
38
|
-
* That keeps the argv exactly as D6 specifies and adds no new settings surface.
|
|
33
|
+
* The order packet carries a `defDigest` reference but no authoritative prompt,
|
|
34
|
+
* harness, or permission text. The worker resolves the digest and step name
|
|
35
|
+
* through the verified local workflow store. The prepare cache remains available
|
|
36
|
+
* for routing and session state, but never supplies execution instructions.
|
|
39
37
|
*
|
|
40
38
|
* ── CREDENTIALS ──
|
|
41
39
|
*
|
|
@@ -71,6 +69,8 @@
|
|
|
71
69
|
*/
|
|
72
70
|
import '../harnesses.ts';
|
|
73
71
|
import { type AgentRunOutcome } from '../agent/loop.ts';
|
|
72
|
+
import { type InstructionResolver } from '../exec/instructions.ts';
|
|
73
|
+
import { type ConsumedVerifier } from '../consumed-verifier.ts';
|
|
74
74
|
import { type HubClient } from '../hub/client.ts';
|
|
75
75
|
import { type SignalHost } from './signals.ts';
|
|
76
76
|
interface ParsedArgs {
|
|
@@ -105,6 +105,12 @@ export interface RunDeps {
|
|
|
105
105
|
hub?: HubClient;
|
|
106
106
|
out?: (line: string) => void;
|
|
107
107
|
err?: (line: string) => void;
|
|
108
|
+
/** Store-backed instruction resolver; injected tests may provide a fake. */
|
|
109
|
+
instructions?: InstructionResolver;
|
|
110
|
+
/** Consume-side verifier; injected tests may provide a fake. */
|
|
111
|
+
consumedVerifier?: ConsumedVerifier;
|
|
112
|
+
/** Environment used to derive the global workflow-store root. */
|
|
113
|
+
env?: Record<string, string | undefined>;
|
|
108
114
|
/** cwd for an order that carries no `workdir` (default `process.cwd()`). */
|
|
109
115
|
cwd?: string;
|
|
110
116
|
/**
|
|
@@ -38,12 +38,10 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
38
38
|
*
|
|
39
39
|
* ── WHERE THE STEP SPEC COMES FROM ──
|
|
40
40
|
*
|
|
41
|
-
* The
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* `readDispatchBundle(cacheDir, def)` → `bundle.def.hash` → `readStepSpec(...)`.
|
|
46
|
-
* That keeps the argv exactly as D6 specifies and adds no new settings surface.
|
|
41
|
+
* The order packet carries a `defDigest` reference but no authoritative prompt,
|
|
42
|
+
* harness, or permission text. The worker resolves the digest and step name
|
|
43
|
+
* through the verified local workflow store. The prepare cache remains available
|
|
44
|
+
* for routing and session state, but never supplies execution instructions.
|
|
47
45
|
*
|
|
48
46
|
* ── CREDENTIALS ──
|
|
49
47
|
*
|
|
@@ -87,12 +85,16 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
87
85
|
import "../harnesses.js";
|
|
88
86
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
89
87
|
import { hostname } from 'node:os';
|
|
90
|
-
import {
|
|
88
|
+
import { resolveCacheDir } from "../bundle/cache.js";
|
|
91
89
|
import { createAgentRunLoop } from "../agent/loop.js";
|
|
90
|
+
import { createDefaultStoreInstructionResolver } from "../exec/instructions.js";
|
|
91
|
+
import { createConsumedVerifier } from "../consumed-verifier.js";
|
|
92
92
|
import { createHubClient } from "../hub/client.js";
|
|
93
93
|
import { resolveBearer } from "../credentials/resolve.js";
|
|
94
94
|
import { loadSettings } from "../settings/settings.js";
|
|
95
95
|
import { adapterFor, defaultHarnessId, registeredHarnessIds } from "../harness/registry.js";
|
|
96
|
+
import { parseHarnessCarrier } from "../bundle/fetch.js";
|
|
97
|
+
import { normalizeStepPermissions, validateHarnessOptions } from "../harness/permissions.js";
|
|
96
98
|
import { appendSession, latestFor, sessionsPath } from "../harness/session-store.js";
|
|
97
99
|
import { ensureWorkDir, resolveWorkRepo, resolveWorkRoot } from "../agent/workdir.js";
|
|
98
100
|
import { resolveShiftId, resolveTarget } from "./hold.js";
|
|
@@ -151,8 +153,11 @@ export function parseArgs(args) {
|
|
|
151
153
|
parsed.origin = r.value;
|
|
152
154
|
else if (name === '--shift')
|
|
153
155
|
parsed.shift = r.value;
|
|
154
|
-
else if (name === '--harness')
|
|
156
|
+
else if (name === '--harness') {
|
|
157
|
+
if (r.value.trim() === '')
|
|
158
|
+
return { error: '--harness must be a non-empty harness id' };
|
|
155
159
|
parsed.harness = r.value;
|
|
160
|
+
}
|
|
156
161
|
else {
|
|
157
162
|
const n = positiveMs(name, r.value);
|
|
158
163
|
if ('error' in n)
|
|
@@ -192,6 +197,10 @@ export function exitCodeFor(outcome) {
|
|
|
192
197
|
case 'misroute':
|
|
193
198
|
case 'no-template':
|
|
194
199
|
case 'no-harness':
|
|
200
|
+
case 'incompatible-harness-policy':
|
|
201
|
+
case 'unresolvable-capability':
|
|
202
|
+
case 'unverified-consumed':
|
|
203
|
+
case 'session-store-failed':
|
|
195
204
|
case 'no-submit':
|
|
196
205
|
case 'killed':
|
|
197
206
|
case 'lease-lost':
|
|
@@ -246,7 +255,7 @@ export async function run(args, deps = {}) {
|
|
|
246
255
|
usage();
|
|
247
256
|
return 2;
|
|
248
257
|
}
|
|
249
|
-
const env = process.env;
|
|
258
|
+
const env = deps.env ?? process.env;
|
|
250
259
|
let settings;
|
|
251
260
|
try {
|
|
252
261
|
settings = loadSettings(env);
|
|
@@ -255,11 +264,32 @@ export async function run(args, deps = {}) {
|
|
|
255
264
|
err(`owenloop work agent-run: ${errMsg(e)}`);
|
|
256
265
|
return 1;
|
|
257
266
|
}
|
|
267
|
+
// Passed through verbatim. `loadSettings` already validated every row (shape,
|
|
268
|
+
// effort on the ladder, effort accepted by a known model), so there is nothing
|
|
269
|
+
// left to normalize here — and nothing to default: an absent map means the
|
|
270
|
+
// loop refuses capability-bearing orders, which is the intended answer for a
|
|
271
|
+
// shift that never declared what serves what.
|
|
272
|
+
const capabilityModels = settings.capabilityModels;
|
|
258
273
|
const origin = parsed.origin ?? settings.hubOrigin;
|
|
259
274
|
if (origin === undefined || origin.trim() === '') {
|
|
260
275
|
err('owenloop work agent-run: no hub origin — pass --origin <url> or set hubOrigin in settings');
|
|
261
276
|
return 2;
|
|
262
277
|
}
|
|
278
|
+
const consumedVerifier = deps.consumedVerifier ?? createConsumedVerifier({
|
|
279
|
+
env,
|
|
280
|
+
now: () => Date.now(),
|
|
281
|
+
});
|
|
282
|
+
const instructionCwd = deps.cwd ?? process.cwd();
|
|
283
|
+
let instructions = deps.instructions;
|
|
284
|
+
if (instructions === undefined) {
|
|
285
|
+
try {
|
|
286
|
+
instructions = createDefaultStoreInstructionResolver({ cwd: instructionCwd, env, consumedVerifier });
|
|
287
|
+
}
|
|
288
|
+
catch (e) {
|
|
289
|
+
err(`owenloop work agent-run: instruction store unavailable: ${errMsg(e)}`);
|
|
290
|
+
return 1;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
263
293
|
let cacheDir;
|
|
264
294
|
try {
|
|
265
295
|
cacheDir = resolveCacheDir(env, settings.cacheDir);
|
|
@@ -319,11 +349,27 @@ export async function run(args, deps = {}) {
|
|
|
319
349
|
*/
|
|
320
350
|
const envHarness = env['OWENLOOP_HARNESS'];
|
|
321
351
|
const resolveAdapter = (stepHarness) => {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
352
|
+
let id;
|
|
353
|
+
if (parsed.harness !== undefined) {
|
|
354
|
+
id = parsed.harness;
|
|
355
|
+
}
|
|
356
|
+
else if (envHarness !== undefined) {
|
|
357
|
+
// Definition and default selection are lower precedence. An explicit empty
|
|
358
|
+
// environment override is invalid; it must not silently fall through.
|
|
359
|
+
if (envHarness.trim() === '') {
|
|
360
|
+
return {
|
|
361
|
+
id: '<empty OWENLOOP_HARNESS>',
|
|
362
|
+
registered: registeredHarnessIds(),
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
id = envHarness;
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
id =
|
|
369
|
+
(stepHarness !== undefined && stepHarness !== '' ? stepHarness : undefined) ??
|
|
370
|
+
defaultHarnessId() ??
|
|
371
|
+
'';
|
|
372
|
+
}
|
|
327
373
|
const adapter = id !== '' ? adapterFor(id) : undefined;
|
|
328
374
|
return {
|
|
329
375
|
id: id !== '' ? id : '<none>',
|
|
@@ -331,35 +377,66 @@ export async function run(args, deps = {}) {
|
|
|
331
377
|
registered: registeredHarnessIds(),
|
|
332
378
|
};
|
|
333
379
|
};
|
|
334
|
-
/** Resolve the
|
|
380
|
+
/** Resolve the verified step from the local workflow store, never the prepare cache. */
|
|
335
381
|
const loadStep = async (order) => {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
382
|
+
let resolved;
|
|
383
|
+
try {
|
|
384
|
+
resolved = await instructions.resolveStep(order);
|
|
385
|
+
}
|
|
386
|
+
catch (e) {
|
|
387
|
+
err(`owenloop work agent-run: instruction refusal (integrity): ${errMsg(e)}`);
|
|
340
388
|
return null;
|
|
341
389
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
err(`owenloop work agent-run: ${dispatch.warning}`);
|
|
345
|
-
if (dispatch.bundle === null) {
|
|
346
|
-
err(`owenloop work agent-run: no cached bundle for def '${defName}' — run \`owenloop work prepare ${defName}\``);
|
|
390
|
+
if (!resolved.ok) {
|
|
391
|
+
err(`owenloop work agent-run: ${resolved.reason}`);
|
|
347
392
|
return null;
|
|
348
393
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
394
|
+
// Harness adapters build their child environment from process.env. This
|
|
395
|
+
// worker owns one agent order, so the resolver-derived bundle root is
|
|
396
|
+
// per-order state; clear it when provenance is absent to prevent stale
|
|
397
|
+
// values from reaching a later step in the same process.
|
|
398
|
+
if (resolved.bundleDir !== undefined)
|
|
399
|
+
process.env['OWENLOOP_BUNDLE_DIR'] = resolved.bundleDir;
|
|
400
|
+
else
|
|
401
|
+
delete process.env['OWENLOOP_BUNDLE_DIR'];
|
|
402
|
+
// Run identity is engine-derived from this worker's target, never a consumed
|
|
403
|
+
// artifact value. Both registered adapter paths read process.env when they
|
|
404
|
+
// build their child environments, so one setter covers both; overwrite
|
|
405
|
+
// ambient values so a nested agent sees its own identity, not its parent's.
|
|
406
|
+
process.env['OWENLOOP_WORKFLOW'] = target.workflow;
|
|
407
|
+
process.env['OWENLOOP_RUN'] = target.run;
|
|
408
|
+
let carrier;
|
|
409
|
+
const rawStep = resolved.step;
|
|
410
|
+
try {
|
|
411
|
+
carrier = parseHarnessCarrier(rawStep, order.workflow, resolved.step.name);
|
|
412
|
+
}
|
|
413
|
+
catch (e) {
|
|
414
|
+
err(`owenloop work agent-run: instruction refusal (harness-carrier): ${errMsg(e)}`);
|
|
353
415
|
return null;
|
|
354
416
|
}
|
|
355
|
-
|
|
417
|
+
if (carrier.harnessOptions !== undefined) {
|
|
418
|
+
const errors = validateHarnessOptions(carrier.harnessOptions, resolved.step.name)
|
|
419
|
+
.filter((finding) => finding.severity === 'error');
|
|
420
|
+
if (errors.length > 0) {
|
|
421
|
+
for (const finding of errors) {
|
|
422
|
+
err(`owenloop work agent-run: instruction refusal (harness-policy): step '${finding.step}' ` +
|
|
423
|
+
`x.harness.${finding.field ?? '<bag>'}: ${finding.message}`);
|
|
424
|
+
}
|
|
425
|
+
return null;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
return {
|
|
429
|
+
step: resolved.step.name,
|
|
430
|
+
brief: resolved.step.body,
|
|
431
|
+
...(carrier.harness !== undefined ? { harness: carrier.harness } : {}),
|
|
432
|
+
permissions: normalizeStepPermissions(carrier.harnessOptions, resolved.step),
|
|
433
|
+
};
|
|
356
434
|
};
|
|
357
435
|
/**
|
|
358
|
-
* The session-store sink. `
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
* carries on. The lease, not this file, remains the record of truth.
|
|
436
|
+
* The session-store sink. A durable `active` row is a provider-work start
|
|
437
|
+
* gate: failure propagates to the loop, which abandons the turn and releases
|
|
438
|
+
* the order before delivery. Later lifecycle rows remain best-effort resume
|
|
439
|
+
* metadata and are reported without replacing the lease as the hub truth.
|
|
363
440
|
*/
|
|
364
441
|
const sessionsFile = sessionsPath(cacheDir);
|
|
365
442
|
const writeSession = (rec) => {
|
|
@@ -368,6 +445,8 @@ export async function run(args, deps = {}) {
|
|
|
368
445
|
}
|
|
369
446
|
catch (e) {
|
|
370
447
|
err(`owenloop work agent-run: could not record the session in ${sessionsFile}: ${errMsg(e)}`);
|
|
448
|
+
if (rec.status === 'active')
|
|
449
|
+
throw e;
|
|
371
450
|
}
|
|
372
451
|
};
|
|
373
452
|
/**
|
|
@@ -418,6 +497,8 @@ export async function run(args, deps = {}) {
|
|
|
418
497
|
cwd: workCwd,
|
|
419
498
|
loadStep,
|
|
420
499
|
resolveAdapter,
|
|
500
|
+
...(capabilityModels !== undefined ? { capabilityModels } : {}),
|
|
501
|
+
consumedVerifier,
|
|
421
502
|
appendSession: writeSession,
|
|
422
503
|
nextAttempt: (workflow, run, step) => {
|
|
423
504
|
const prev = latestFor(sessionsFile, workflow, run, step);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type HubClient } from '../hub/client.ts';
|
|
2
2
|
import { type ExecOutcome } from '../exec/loop.ts';
|
|
3
|
+
import { type InstructionResolver } from '../exec/instructions.ts';
|
|
3
4
|
import { type CommandRunner } from '../exec/runner.ts';
|
|
5
|
+
import { type ConsumedVerifier } from '../consumed-verifier.ts';
|
|
4
6
|
import { type SignalHost } from './signals.ts';
|
|
5
7
|
interface ParsedArgs {
|
|
6
8
|
orderId?: string;
|
|
@@ -29,10 +31,16 @@ export interface RunDeps {
|
|
|
29
31
|
signalHost?: SignalHost;
|
|
30
32
|
hub?: HubClient;
|
|
31
33
|
runner?: CommandRunner;
|
|
34
|
+
/** Store-backed instruction resolver; injected tests may provide a fake. */
|
|
35
|
+
instructions?: InstructionResolver;
|
|
36
|
+
/** Consume-side verifier; injected tests may provide a fake. */
|
|
37
|
+
consumedVerifier?: ConsumedVerifier;
|
|
32
38
|
out?: (line: string) => void;
|
|
33
39
|
err?: (line: string) => void;
|
|
34
40
|
/** cwd for a command order that carries no `workdir` (default `process.cwd()`). */
|
|
35
41
|
cwd?: string;
|
|
42
|
+
/** Environment used to derive the global workflow-store root. */
|
|
43
|
+
env?: Record<string, string | undefined>;
|
|
36
44
|
/** Holder id override (default `<hostname>:<pid>`) — pinned in tests. */
|
|
37
45
|
holderId?: string;
|
|
38
46
|
}
|
|
@@ -36,7 +36,9 @@ import { createHubClient } from "../hub/client.js";
|
|
|
36
36
|
import { resolveBearer } from "../credentials/resolve.js";
|
|
37
37
|
import { loadSettings } from "../settings/settings.js";
|
|
38
38
|
import { createExecLoop } from "../exec/loop.js";
|
|
39
|
+
import { createDefaultStoreInstructionResolver } from "../exec/instructions.js";
|
|
39
40
|
import { createDefaultRunner } from "../exec/runner.js";
|
|
41
|
+
import { createConsumedVerifier } from "../consumed-verifier.js";
|
|
40
42
|
import { resolveShiftId, resolveTarget } from "./hold.js";
|
|
41
43
|
import { installSignalHandlers } from "./signals.js";
|
|
42
44
|
const DEFAULT_INTERVAL_MS = 60_000;
|
|
@@ -115,14 +117,19 @@ export function exitCodeFor(outcome) {
|
|
|
115
117
|
switch (outcome) {
|
|
116
118
|
case 'submitted':
|
|
117
119
|
case 'completed':
|
|
120
|
+
case 'rejected':
|
|
121
|
+
case 'judge-rejected':
|
|
118
122
|
return 0;
|
|
119
123
|
case 'misroute':
|
|
124
|
+
case 'unresolved-instructions':
|
|
120
125
|
case 'killed':
|
|
121
126
|
case 'lease-lost':
|
|
122
127
|
case 'ownership-error':
|
|
123
128
|
case 'hub-unreachable':
|
|
124
129
|
case 'submit-rejected':
|
|
125
130
|
case 'submit-failed':
|
|
131
|
+
case 'judge-no-verdict':
|
|
132
|
+
case 'reject-failed':
|
|
126
133
|
case 'stopped':
|
|
127
134
|
return 1;
|
|
128
135
|
}
|
|
@@ -147,7 +154,7 @@ export async function run(args, deps = {}) {
|
|
|
147
154
|
usage();
|
|
148
155
|
return 2;
|
|
149
156
|
}
|
|
150
|
-
const env = process.env;
|
|
157
|
+
const env = deps.env ?? process.env;
|
|
151
158
|
let settings;
|
|
152
159
|
try {
|
|
153
160
|
settings = loadSettings(env);
|
|
@@ -156,11 +163,26 @@ export async function run(args, deps = {}) {
|
|
|
156
163
|
err(`owenloop work exec: ${errMsg(e)}`);
|
|
157
164
|
return 1;
|
|
158
165
|
}
|
|
166
|
+
const consumedVerifier = deps.consumedVerifier ?? createConsumedVerifier({
|
|
167
|
+
env,
|
|
168
|
+
now: () => Date.now(),
|
|
169
|
+
});
|
|
159
170
|
const origin = parsed.origin ?? settings.hubOrigin;
|
|
160
171
|
if (origin === undefined || origin.trim() === '') {
|
|
161
172
|
err('owenloop work exec: no hub origin — pass --origin <url> or set hubOrigin in settings');
|
|
162
173
|
return 2;
|
|
163
174
|
}
|
|
175
|
+
const cwd = deps.cwd ?? process.cwd();
|
|
176
|
+
let instructions = deps.instructions;
|
|
177
|
+
if (instructions === undefined) {
|
|
178
|
+
try {
|
|
179
|
+
instructions = createDefaultStoreInstructionResolver({ cwd, env, consumedVerifier });
|
|
180
|
+
}
|
|
181
|
+
catch (e) {
|
|
182
|
+
err(`owenloop work exec: instruction store unavailable: ${errMsg(e)}`);
|
|
183
|
+
return 1;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
164
186
|
const account = env['OWENLOOP_ACCOUNT'] ?? 'default';
|
|
165
187
|
const bearer = await resolveBearer({ origin, account, env });
|
|
166
188
|
if (!bearer.ok) {
|
|
@@ -181,8 +203,11 @@ export async function run(args, deps = {}) {
|
|
|
181
203
|
runner,
|
|
182
204
|
workflow: target.workflow,
|
|
183
205
|
run: target.run,
|
|
206
|
+
origin,
|
|
207
|
+
env,
|
|
184
208
|
holder,
|
|
185
|
-
|
|
209
|
+
instructions,
|
|
210
|
+
cwd,
|
|
186
211
|
sleep: (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
|
|
187
212
|
now: () => Date.now(),
|
|
188
213
|
out,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type HubClient } from '../hub/client.ts';
|
|
2
2
|
import { type HoldOutcome } from '../hold/loop.ts';
|
|
3
|
+
import { type HoldMcpToolName } from '../hold/mcp.ts';
|
|
3
4
|
import type { ContactHolder } from '../hub/types.ts';
|
|
4
5
|
import { type SignalHost, type StdinHost } from './signals.ts';
|
|
5
6
|
interface ParsedArgs {
|
|
@@ -13,6 +14,9 @@ interface ParsedArgs {
|
|
|
13
14
|
jumpToleranceMs?: number;
|
|
14
15
|
ignoreStdin: boolean;
|
|
15
16
|
mcp: boolean;
|
|
17
|
+
mcpTools?: HoldMcpToolName[];
|
|
18
|
+
/** Never hand the claim back — another process is the holder of record. */
|
|
19
|
+
neverRelease?: boolean;
|
|
16
20
|
error?: string;
|
|
17
21
|
}
|
|
18
22
|
/** Parse `--flag value` and `--flag=value`; unknown flags are an error. */
|
|
@@ -63,6 +67,8 @@ export interface RunDeps {
|
|
|
63
67
|
hub?: HubClient;
|
|
64
68
|
out?: (line: string) => void;
|
|
65
69
|
err?: (line: string) => void;
|
|
70
|
+
/** Environment used for settings and local trust-root resolution. */
|
|
71
|
+
env?: Record<string, string | undefined>;
|
|
66
72
|
}
|
|
67
73
|
export declare function run(args: string[], deps?: RunDeps): Promise<number>;
|
|
68
74
|
export {};
|
|
@@ -29,6 +29,17 @@
|
|
|
29
29
|
* closed at spawn (backgrounded/detached use), pass `--ignore-stdin` so hold
|
|
30
30
|
* does not final-breath at birth.
|
|
31
31
|
*
|
|
32
|
+
* HOLDER OF RECORD: by default this process IS the holder — its final breath
|
|
33
|
+
* releases the claim. `--never-release` says the opposite: some OTHER process
|
|
34
|
+
* holds the claim and this one is only along for the ride. `owenloop work
|
|
35
|
+
* agent-run` is the case that matters — it claims the order under its own
|
|
36
|
+
* `exec` lease loop and spawns `hold --mcp --never-release` purely to serve the
|
|
37
|
+
* agent's tool calls. There, a stop is a fact about this child (its stdin
|
|
38
|
+
* closed, it got a signal), never a fact about the order, so releasing would
|
|
39
|
+
* strip a live agent of the claim it is still working under. With
|
|
40
|
+
* `--never-release` every stop path skips the release and the loop settles as
|
|
41
|
+
* `stopped`; the holder of record decides the order's fate.
|
|
42
|
+
*
|
|
32
43
|
* Origin/credential resolution mirrors `shift`: origin `--origin` → settings;
|
|
33
44
|
* the bearer comes from owenloop's store via `resolveBearer`, reading the
|
|
34
45
|
* `agent:<account>` slot for `--as <account>` (default `default`, so a hand-run
|
|
@@ -41,13 +52,31 @@ import { createHubClient } from "../hub/client.js";
|
|
|
41
52
|
import { resolveBearer } from "../credentials/resolve.js";
|
|
42
53
|
import { loadSettings } from "../settings/settings.js";
|
|
43
54
|
import { createHoldLoop } from "../hold/loop.js";
|
|
44
|
-
import { createHoldMcp } from "../hold/mcp.js";
|
|
55
|
+
import { createHoldMcp, HOLD_MCP_TOOL_NAMES } from "../hold/mcp.js";
|
|
56
|
+
import { createConsumedVerifier } from "../consumed-verifier.js";
|
|
45
57
|
import { createMcpServer, pumpStdin } from "../mcp/server.js";
|
|
46
58
|
import { installSignalHandlers, watchStdinEof } from "./signals.js";
|
|
47
59
|
const DEFAULT_INTERVAL_MS = 60_000;
|
|
48
60
|
// Deliberate duplicate of main.ts's VERSION (also '0.0.0'): the roles must not
|
|
49
61
|
// import the CLI entry module, and the MCP serverInfo version is cosmetic.
|
|
50
62
|
const VERSION = '0.0.0';
|
|
63
|
+
function parseMcpTools(value) {
|
|
64
|
+
const names = value.split(',');
|
|
65
|
+
if (names.length === 0 || names.some((name) => name === '')) {
|
|
66
|
+
return { error: '--mcp-tools must be a comma-separated list with no empty names' };
|
|
67
|
+
}
|
|
68
|
+
const allowed = new Set(HOLD_MCP_TOOL_NAMES);
|
|
69
|
+
const unknown = names.filter((name) => !allowed.has(name));
|
|
70
|
+
if (unknown.length > 0) {
|
|
71
|
+
return {
|
|
72
|
+
error: `--mcp-tools contains unknown tool(s): ${unknown.join(', ')}; expected ${HOLD_MCP_TOOL_NAMES.join(',')}`,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (new Set(names).size !== names.length) {
|
|
76
|
+
return { error: '--mcp-tools must not contain duplicate names' };
|
|
77
|
+
}
|
|
78
|
+
return names;
|
|
79
|
+
}
|
|
51
80
|
/** Parse `--flag value` and `--flag=value`; unknown flags are an error. */
|
|
52
81
|
export function parseArgs(args) {
|
|
53
82
|
const parsed = { ignoreStdin: false, mcp: false };
|
|
@@ -70,6 +99,9 @@ export function parseArgs(args) {
|
|
|
70
99
|
case '--mcp':
|
|
71
100
|
parsed.mcp = true;
|
|
72
101
|
break;
|
|
102
|
+
case '--never-release':
|
|
103
|
+
parsed.neverRelease = true;
|
|
104
|
+
break;
|
|
73
105
|
case '--order':
|
|
74
106
|
case '--workflow':
|
|
75
107
|
case '--session':
|
|
@@ -77,7 +109,8 @@ export function parseArgs(args) {
|
|
|
77
109
|
case '--as':
|
|
78
110
|
case '--shift':
|
|
79
111
|
case '--heartbeat-interval':
|
|
80
|
-
case '--jump-tolerance':
|
|
112
|
+
case '--jump-tolerance':
|
|
113
|
+
case '--mcp-tools': {
|
|
81
114
|
const r = takeValue(a, i);
|
|
82
115
|
if ('error' in r)
|
|
83
116
|
return { ignoreStdin: false, mcp: false, error: r.error };
|
|
@@ -94,6 +127,12 @@ export function parseArgs(args) {
|
|
|
94
127
|
parsed.as = r.value;
|
|
95
128
|
else if (name === '--shift')
|
|
96
129
|
parsed.shift = r.value;
|
|
130
|
+
else if (name === '--mcp-tools') {
|
|
131
|
+
const selected = parseMcpTools(r.value);
|
|
132
|
+
if ('error' in selected)
|
|
133
|
+
return { ignoreStdin: false, mcp: false, error: selected.error };
|
|
134
|
+
parsed.mcpTools = selected;
|
|
135
|
+
}
|
|
97
136
|
else if (name === '--heartbeat-interval') {
|
|
98
137
|
const n = Number(r.value);
|
|
99
138
|
if (!Number.isFinite(n) || !Number.isInteger(n) || n <= 0) {
|
|
@@ -145,6 +184,7 @@ export function resolveTarget(order, workflowFlag) {
|
|
|
145
184
|
function usage() {
|
|
146
185
|
process.stderr.write('usage: owenloop work hold --order <workflow>/<run> [--origin <url>] [--as <account>] [--session <id>]\n' +
|
|
147
186
|
' [--shift <id>] [--heartbeat-interval <ms>] [--jump-tolerance <ms>] [--ignore-stdin] [--mcp]\n' +
|
|
187
|
+
' [--mcp-tools <get_order,submit,reject>]\n' +
|
|
148
188
|
' or: owenloop work hold --order <run> --workflow <wf> [...]\n');
|
|
149
189
|
}
|
|
150
190
|
function errMsg(err) {
|
|
@@ -213,13 +253,18 @@ export async function run(args, deps = {}) {
|
|
|
213
253
|
usage();
|
|
214
254
|
return 2;
|
|
215
255
|
}
|
|
256
|
+
if (parsed.mcpTools !== undefined && !parsed.mcp) {
|
|
257
|
+
err('owenloop work hold: --mcp-tools requires --mcp');
|
|
258
|
+
usage();
|
|
259
|
+
return 2;
|
|
260
|
+
}
|
|
216
261
|
const target = resolveTarget(parsed.order, parsed.workflow);
|
|
217
262
|
if ('error' in target) {
|
|
218
263
|
err(`owenloop work hold: ${target.error}`);
|
|
219
264
|
usage();
|
|
220
265
|
return 2;
|
|
221
266
|
}
|
|
222
|
-
const env = process.env;
|
|
267
|
+
const env = deps.env ?? process.env;
|
|
223
268
|
let settings;
|
|
224
269
|
try {
|
|
225
270
|
settings = loadSettings(env);
|
|
@@ -247,16 +292,41 @@ export async function run(args, deps = {}) {
|
|
|
247
292
|
const shiftId = resolveShiftId(parsed.shift, env);
|
|
248
293
|
const holder = resolveHolder(parsed.session, env, { shiftId });
|
|
249
294
|
const hub = deps.hub ?? createHubClient({ origin, getToken: async () => token });
|
|
250
|
-
// --
|
|
251
|
-
//
|
|
295
|
+
// --never-release: this hold is NOT the holder of record. `owenloop work
|
|
296
|
+
// agent-run` already claimed the order with its own `exec` lease loop and
|
|
297
|
+
// spawned this process only to serve the MCP tool surface (see
|
|
298
|
+
// `agent/brief.ts` buildOwenloopMcp). Under that parent, a stop of ANY kind —
|
|
299
|
+
// stdin EOF, SIGINT, SIGTERM — is a transport or lifecycle event for THIS
|
|
300
|
+
// child, not evidence that the order is finished, so it must never call
|
|
301
|
+
// `release`. Doing so hands the claim back while the agent is still working:
|
|
302
|
+
// the hub marks the run unclaimed, the mount's terminal guard fast-fails every
|
|
303
|
+
// subsequent get_order/submit, the agent dies empty-handed, and the shift
|
|
304
|
+
// re-dispatches the same order to a fresh worker that repeats the whole cycle.
|
|
305
|
+
// Every stop path below therefore routes through `stopOpts`/`stopTarget`.
|
|
306
|
+
const stopOpts = parsed.neverRelease === true ? { release: false } : undefined;
|
|
307
|
+
const stopTarget = (l) => ({
|
|
308
|
+
stop: (reason) => l.stop(reason, stopOpts),
|
|
309
|
+
});
|
|
310
|
+
// --mcp: run the born-bound work-holder as a stdio MCP server. The default
|
|
311
|
+
// registers get_order/submit/reject; --mcp-tools selects an exact positive
|
|
312
|
+
// subset. The lease loop stays warm underneath. stdout is the JSON-RPC
|
|
252
313
|
// channel, so every diagnostic (and the loop's own lines) goes to stderr;
|
|
253
|
-
// stdin is the transport, and its EOF
|
|
254
|
-
//
|
|
314
|
+
// stdin is the transport, and its EOF ends the mount. Whether that EOF also
|
|
315
|
+
// releases the claim depends on `--never-release` (see stopOpts above): a
|
|
316
|
+
// human-launched `hold --mcp` is the holder of record and releases; the
|
|
317
|
+
// `agent-run` child is not and does not.
|
|
255
318
|
if (parsed.mcp) {
|
|
256
319
|
const mount = createHoldMcp({
|
|
257
320
|
hub,
|
|
258
321
|
workflow: target.workflow,
|
|
259
322
|
run: target.run,
|
|
323
|
+
...(parsed.mcpTools !== undefined ? { tools: parsed.mcpTools } : {}),
|
|
324
|
+
origin,
|
|
325
|
+
env,
|
|
326
|
+
consumedVerifier: createConsumedVerifier({
|
|
327
|
+
env,
|
|
328
|
+
now: () => Date.now(),
|
|
329
|
+
}),
|
|
260
330
|
sleep: (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
|
|
261
331
|
now: () => Date.now(),
|
|
262
332
|
err,
|
|
@@ -271,9 +341,9 @@ export async function run(args, deps = {}) {
|
|
|
271
341
|
write: (msg) => void process.stdout.write(`${JSON.stringify(msg)}\n`),
|
|
272
342
|
err,
|
|
273
343
|
});
|
|
274
|
-
installSignalHandlers(mount.loop, deps.signalHost ?? process, err, {
|
|
344
|
+
installSignalHandlers(stopTarget(mount.loop), deps.signalHost ?? process, err, {
|
|
275
345
|
role: 'hold',
|
|
276
|
-
drainNote: 'final breath',
|
|
346
|
+
drainNote: parsed.neverRelease === true ? 'stopping (claim stays with the holder of record)' : 'final breath',
|
|
277
347
|
stopReason: 'signal',
|
|
278
348
|
});
|
|
279
349
|
// The MCP server must keep answering until the TRANSPORT ends, not until
|
|
@@ -288,7 +358,7 @@ export async function run(args, deps = {}) {
|
|
|
288
358
|
const stdin = (deps.stdin ?? process.stdin);
|
|
289
359
|
const eof = new Promise((resolve) => {
|
|
290
360
|
pumpStdin(stdin, server, () => {
|
|
291
|
-
mount.loop.stop('stdin-eof');
|
|
361
|
+
mount.loop.stop('stdin-eof', stopOpts);
|
|
292
362
|
resolve();
|
|
293
363
|
});
|
|
294
364
|
});
|
|
@@ -311,13 +381,13 @@ export async function run(args, deps = {}) {
|
|
|
311
381
|
...(parsed.jumpToleranceMs !== undefined ? { jumpToleranceMs: parsed.jumpToleranceMs } : {}),
|
|
312
382
|
holder,
|
|
313
383
|
});
|
|
314
|
-
installSignalHandlers(loop, deps.signalHost ?? process, err, {
|
|
384
|
+
installSignalHandlers(stopTarget(loop), deps.signalHost ?? process, err, {
|
|
315
385
|
role: 'hold',
|
|
316
|
-
drainNote: 'final breath',
|
|
386
|
+
drainNote: parsed.neverRelease === true ? 'stopping (claim stays with the holder of record)' : 'final breath',
|
|
317
387
|
stopReason: 'signal',
|
|
318
388
|
});
|
|
319
389
|
if (!parsed.ignoreStdin) {
|
|
320
|
-
watchStdinEof(deps.stdin ?? process.stdin, () => loop.stop('stdin-eof'));
|
|
390
|
+
watchStdinEof(deps.stdin ?? process.stdin, () => loop.stop('stdin-eof', stopOpts));
|
|
321
391
|
}
|
|
322
392
|
const outcome = await loop.run();
|
|
323
393
|
return exitCodeFor(outcome);
|
|
@@ -39,10 +39,9 @@ export declare function run(args: string[]): Promise<number>;
|
|
|
39
39
|
* Findings for ONE step: resolve which adapter would run it, then hand that
|
|
40
40
|
* adapter the step's option bag.
|
|
41
41
|
*
|
|
42
|
-
* A step
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* and carries no options is clean even in a build with an empty registry.
|
|
42
|
+
* A step that omits both the harness id and the `x.harness` bag is silent — lint
|
|
43
|
+
* has no explicit selection or options to judge. An explicit id is checked even
|
|
44
|
+
* when no option bag exists, because dispatch would still try to resolve that id.
|
|
46
45
|
*
|
|
47
46
|
* ONE finding is raised HERE rather than by the adapter: the bag-`model` /
|
|
48
47
|
* first-class-`model` conflict. The harness contract's `lintStep(bag, step)`
|