owenloop 0.5.0 → 0.5.1
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 +45 -0
- package/README.md +137 -35
- package/bin/owenloop.mjs +49 -1
- package/dist/packages/work/src/agent/brief.d.ts +8 -4
- package/dist/packages/work/src/agent/brief.js +7 -3
- package/dist/packages/work/src/agent/loop.d.ts +13 -7
- package/dist/packages/work/src/agent/loop.js +136 -9
- package/dist/packages/work/src/agent/model-policy.d.ts +49 -0
- package/dist/packages/work/src/agent/model-policy.js +138 -0
- 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 +12 -1
- package/dist/packages/work/src/exec/loop.js +137 -20
- 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 +74 -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 +27 -9
- package/dist/packages/work/src/harness/session-store.js +271 -67
- package/dist/packages/work/src/hold/mcp.d.ts +25 -5
- package/dist/packages/work/src/hold/mcp.js +126 -11
- package/dist/packages/work/src/hub/client.d.ts +2 -1
- package/dist/packages/work/src/hub/client.js +14 -1
- package/dist/packages/work/src/hub/types.d.ts +69 -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 +116 -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 +4 -0
- package/dist/packages/work/src/roles/hold.js +44 -5
- 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 +5 -0
- package/dist/packages/work/src/roles/shift.d.ts +1 -0
- package/dist/packages/work/src/roles/shift.js +23 -1
- package/dist/packages/work/src/settings/settings.d.ts +17 -1
- package/dist/packages/work/src/settings/settings.js +39 -0
- package/dist/packages/work/src/shift/loop.d.ts +14 -3
- package/dist/packages/work/src/shift/loop.js +447 -164
- package/dist/packages/work/src/shift/protocol.d.ts +4 -0
- package/dist/packages/work/src/shift/runtime.d.ts +2 -0
- package/dist/packages/work/src/shift/runtime.js +66 -3
- package/dist/packages/work/src/shift/spawn.d.ts +41 -18
- package/dist/packages/work/src/shift/spawn.js +89 -31
- package/dist/packages/work/src/shift/state.d.ts +53 -51
- package/dist/packages/work/src/shift/state.js +325 -102
- package/dist/packages/work/src/submit-proof.d.ts +36 -0
- package/dist/packages/work/src/submit-proof.js +93 -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/cli.d.ts +90 -20
- package/dist/src/cli.js +2407 -365
- 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 +316 -0
- package/dist/src/crypto/records.js +157 -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 +145 -25
- package/dist/src/engine.d.ts +99 -3
- package/dist/src/engine.js +238 -34
- 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 +75 -21
- package/dist/src/hub.js +123 -40
- package/dist/src/index.d.ts +17 -2
- package/dist/src/index.js +20 -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 +167 -44
- package/dist/src/mcp/server.js +12 -1
- package/dist/src/model.d.ts +15 -0
- package/dist/src/model.js +111 -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 +1416 -0
- package/dist/src/schemas/index.js +31 -0
- package/dist/src/schemas/order.v1.schema.json +106 -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/types.d.ts +45 -11
- 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 +57 -6
- package/docs/bundles.md +250 -0
- package/docs/cli.md +1171 -97
- package/docs/crypto.md +816 -0
- package/docs/design.md +342 -20
- package/docs/embedding.md +132 -25
- package/docs/wire-contracts.md +380 -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
package/dist/src/mcp/serve.d.ts
CHANGED
|
@@ -33,7 +33,9 @@
|
|
|
33
33
|
* client, the tool registrations, the enrollment capability gate, and the
|
|
34
34
|
* command body — lives here.
|
|
35
35
|
*/
|
|
36
|
+
import { PrincipalKeyManager } from '../crypto/index.ts';
|
|
36
37
|
import type { CredentialIO } from '../credentials.ts';
|
|
38
|
+
import type { SshProcessAdapter } from '../crypto/ssh.ts';
|
|
37
39
|
import type { LineStream } from './server.ts';
|
|
38
40
|
/**
|
|
39
41
|
* The IO surface `runMcpCommand` needs — a strict subset of the CLI's `CliIO`,
|
|
@@ -45,41 +47,63 @@ export interface McpIo extends CredentialIO {
|
|
|
45
47
|
out: (line: string) => void;
|
|
46
48
|
err: (line: string) => void;
|
|
47
49
|
stdinStream?: LineStream;
|
|
50
|
+
principalKeys?: Pick<PrincipalKeyManager, 'inspect' | 'resolveRef' | 'withSigningKey'>;
|
|
51
|
+
/** Injectable ssh-keygen seam for hermetic submit-proof tests. */
|
|
52
|
+
sshProcess?: SshProcessAdapter;
|
|
48
53
|
}
|
|
49
|
-
/** The exit-2 ambiguity outcome; the caller prints `message` to stderr and returns 2. */
|
|
50
|
-
type OriginResolution = {
|
|
51
|
-
origin: string;
|
|
52
|
-
} | {
|
|
53
|
-
exitCode: 2;
|
|
54
|
-
message: string;
|
|
55
|
-
};
|
|
56
54
|
/**
|
|
57
55
|
* Resolve the hub origin this server binds to, precedence:
|
|
58
56
|
* 1. `--hub <origin>` flag,
|
|
59
57
|
* 2. `OWENLOOP_HUB` env,
|
|
60
|
-
* 3.
|
|
61
|
-
*
|
|
62
|
-
*
|
|
58
|
+
* 3. `~/.owenloop/config.json` (written by `owenloop login`; see
|
|
59
|
+
* `src/global-config.ts`'s header for why this is a separate file from
|
|
60
|
+
* the execution plane's `settings.json`),
|
|
61
|
+
* 4. if the FILE credential backend holds exactly ONE hub with a valid
|
|
62
|
+
* `human` slot, use it (back-compat for a login that predates rung 3),
|
|
63
|
+
* 5. else `DEFAULT_HUB` (`src/hub.ts`) — the production hub.
|
|
63
64
|
*
|
|
64
65
|
* Rungs 1–2 normalize the origin (a malformed value throws a `CliError` → the
|
|
65
|
-
* command's exit-1 path via `mainAsync`'s catch, matching every other
|
|
66
|
-
* Rung 3
|
|
67
|
-
*
|
|
68
|
-
*
|
|
66
|
+
* command's exit-1 path via `mainAsync`'s catch, matching every other
|
|
67
|
+
* command). Rung 3 reads `home` from `io.env.HOME`/`io.env.USERPROFILE` (the
|
|
68
|
+
* first non-blank of the two, mirroring `src/cli.ts`'s `workflowHome`) — but
|
|
69
|
+
* unlike `workflowHome`, an absent home does NOT throw here: it just means
|
|
70
|
+
* this rung has nothing to offer, same as a missing or malformed config file
|
|
71
|
+
* (`readGlobalConfig` never throws; see its doc comment in
|
|
72
|
+
* `src/global-config.ts`). Rung 4 is file-backend-only because only the file
|
|
73
|
+
* backend can enumerate (`listStoredHubOrigins`); `null` (cannot enumerate —
|
|
74
|
+
* keychain/external), `[]` (nothing stored), and length>1 (ambiguous) are ALL
|
|
75
|
+
* just "this rung has nothing to offer" and fall through to rung 5 — none of
|
|
76
|
+
* them is an error here.
|
|
69
77
|
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
78
|
+
* This function used to stop at what is now rung 4 and exit 2 instead of
|
|
79
|
+
* falling through, with a comment reading: "DELIBERATELY there is NO silent
|
|
80
|
+
* production fallback (the CLI's `resolveHub` `DEFAULT_HUB` rung): a
|
|
81
|
+
* control-plane server must never bind to a hub the operator did not name."
|
|
82
|
+
* Two things were wrong with that rule:
|
|
83
|
+
* 1. `resolveHub` (`src/cli.ts:2667-2674`) — used by `login` (`:2869`),
|
|
84
|
+
* `logout` (`:3173`), and `connect` (`:3193`) — ALREADY falls back to
|
|
85
|
+
* `DEFAULT_HUB`. `capability` and `crew` use `resolveAgentHub` instead;
|
|
86
|
+
* that resolver has no `DEFAULT_HUB` rung and still exits 2. The `login`
|
|
87
|
+
* command that CREATES credentials defaults to production while MCP's
|
|
88
|
+
* startup origin resolution exited 2 before it could reach any read or
|
|
89
|
+
* write tool. That asymmetry was the real inconsistency.
|
|
90
|
+
* 2. The no-fallback rule bought no safety. With no credential for the
|
|
91
|
+
* resolved origin, the server fails at the FIRST TOOL CALL with
|
|
92
|
+
* `loginHint` (below): "not logged in to <origin> — run `owenloop login
|
|
93
|
+
* --hub <origin>` in a terminal, then retry". That is a strictly better
|
|
94
|
+
* failure than dying before `initialize` — the host shows an actionable
|
|
95
|
+
* tool error instead of a dead server.
|
|
73
96
|
*/
|
|
74
|
-
export declare function resolveMcpOrigin(io: McpIo, hubFlag: string | undefined):
|
|
97
|
+
export declare function resolveMcpOrigin(io: McpIo, hubFlag: string | undefined): string;
|
|
75
98
|
/**
|
|
76
99
|
* Run the `owenloop mcp` command: resolve the origin, decide the enrollment
|
|
77
100
|
* gate, build the tool list, construct the JSON-RPC server, and pump stdin until
|
|
78
|
-
* EOF. Returns the process exit code:
|
|
79
|
-
*
|
|
80
|
-
*
|
|
101
|
+
* EOF. Returns the process exit code: always 0 on stdin EOF — origin
|
|
102
|
+
* resolution has no exit-2 path of its own anymore (see `resolveMcpOrigin`;
|
|
103
|
+
* it always resolves to some origin, falling back as far as `DEFAULT_HUB`).
|
|
104
|
+
* A malformed `--hub`/`OWENLOOP_HUB` still throws a `CliError` (exit-1 path,
|
|
105
|
+
* via `mainAsync`'s catch).
|
|
81
106
|
*/
|
|
82
107
|
export declare function runMcpCommand(io: McpIo, opts: {
|
|
83
108
|
hubFlag?: string;
|
|
84
109
|
}): Promise<number>;
|
|
85
|
-
export {};
|
package/dist/src/mcp/serve.js
CHANGED
|
@@ -33,64 +33,81 @@
|
|
|
33
33
|
* client, the tool registrations, the enrollment capability gate, and the
|
|
34
34
|
* command body — lives here.
|
|
35
35
|
*/
|
|
36
|
+
import { packageVersion } from "../package-version.js";
|
|
36
37
|
import { CliError } from "../util.js";
|
|
38
|
+
import { DSSE_SSH_NAMESPACE, PrincipalKeyManager, buildSubmissionRecord, createSshSigner, signSubmission, } from "../crypto/index.js";
|
|
37
39
|
import { authHeader, ensureFreshOAuth, hubFetch, refreshOAuth, storeCredential, } from "../credentials.js";
|
|
38
|
-
import {
|
|
40
|
+
import { DEFAULT_HUB, listStoredHubOrigins, normalizeOrigin, readStoredCredential, resolveEndpoint, } from "../hub.js";
|
|
41
|
+
import { globalConfigPath, readGlobalConfig } from "../global-config.js";
|
|
39
42
|
import { createMcpServer, pumpStdin, textResult } from "./server.js";
|
|
40
43
|
/** The human control plane authenticates as the human slot, always. */
|
|
41
44
|
const HUMAN = { principal: 'human' };
|
|
42
45
|
const isObject = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
46
|
+
// ---- origin resolution ------------------------------------------------------
|
|
43
47
|
/**
|
|
44
48
|
* Resolve the hub origin this server binds to, precedence:
|
|
45
49
|
* 1. `--hub <origin>` flag,
|
|
46
50
|
* 2. `OWENLOOP_HUB` env,
|
|
47
|
-
* 3.
|
|
48
|
-
*
|
|
49
|
-
*
|
|
51
|
+
* 3. `~/.owenloop/config.json` (written by `owenloop login`; see
|
|
52
|
+
* `src/global-config.ts`'s header for why this is a separate file from
|
|
53
|
+
* the execution plane's `settings.json`),
|
|
54
|
+
* 4. if the FILE credential backend holds exactly ONE hub with a valid
|
|
55
|
+
* `human` slot, use it (back-compat for a login that predates rung 3),
|
|
56
|
+
* 5. else `DEFAULT_HUB` (`src/hub.ts`) — the production hub.
|
|
50
57
|
*
|
|
51
58
|
* Rungs 1–2 normalize the origin (a malformed value throws a `CliError` → the
|
|
52
|
-
* command's exit-1 path via `mainAsync`'s catch, matching every other
|
|
53
|
-
* Rung 3
|
|
54
|
-
*
|
|
55
|
-
*
|
|
59
|
+
* command's exit-1 path via `mainAsync`'s catch, matching every other
|
|
60
|
+
* command). Rung 3 reads `home` from `io.env.HOME`/`io.env.USERPROFILE` (the
|
|
61
|
+
* first non-blank of the two, mirroring `src/cli.ts`'s `workflowHome`) — but
|
|
62
|
+
* unlike `workflowHome`, an absent home does NOT throw here: it just means
|
|
63
|
+
* this rung has nothing to offer, same as a missing or malformed config file
|
|
64
|
+
* (`readGlobalConfig` never throws; see its doc comment in
|
|
65
|
+
* `src/global-config.ts`). Rung 4 is file-backend-only because only the file
|
|
66
|
+
* backend can enumerate (`listStoredHubOrigins`); `null` (cannot enumerate —
|
|
67
|
+
* keychain/external), `[]` (nothing stored), and length>1 (ambiguous) are ALL
|
|
68
|
+
* just "this rung has nothing to offer" and fall through to rung 5 — none of
|
|
69
|
+
* them is an error here.
|
|
56
70
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
71
|
+
* This function used to stop at what is now rung 4 and exit 2 instead of
|
|
72
|
+
* falling through, with a comment reading: "DELIBERATELY there is NO silent
|
|
73
|
+
* production fallback (the CLI's `resolveHub` `DEFAULT_HUB` rung): a
|
|
74
|
+
* control-plane server must never bind to a hub the operator did not name."
|
|
75
|
+
* Two things were wrong with that rule:
|
|
76
|
+
* 1. `resolveHub` (`src/cli.ts:2667-2674`) — used by `login` (`:2869`),
|
|
77
|
+
* `logout` (`:3173`), and `connect` (`:3193`) — ALREADY falls back to
|
|
78
|
+
* `DEFAULT_HUB`. `capability` and `crew` use `resolveAgentHub` instead;
|
|
79
|
+
* that resolver has no `DEFAULT_HUB` rung and still exits 2. The `login`
|
|
80
|
+
* command that CREATES credentials defaults to production while MCP's
|
|
81
|
+
* startup origin resolution exited 2 before it could reach any read or
|
|
82
|
+
* write tool. That asymmetry was the real inconsistency.
|
|
83
|
+
* 2. The no-fallback rule bought no safety. With no credential for the
|
|
84
|
+
* resolved origin, the server fails at the FIRST TOOL CALL with
|
|
85
|
+
* `loginHint` (below): "not logged in to <origin> — run `owenloop login
|
|
86
|
+
* --hub <origin>` in a terminal, then retry". That is a strictly better
|
|
87
|
+
* failure than dying before `initialize` — the host shows an actionable
|
|
88
|
+
* tool error instead of a dead server.
|
|
60
89
|
*/
|
|
61
90
|
export function resolveMcpOrigin(io, hubFlag) {
|
|
62
91
|
const explicit = hubFlag ?? io.env.OWENLOOP_HUB;
|
|
63
92
|
if (explicit !== undefined && explicit.trim() !== '') {
|
|
64
93
|
try {
|
|
65
|
-
return
|
|
94
|
+
return normalizeOrigin(explicit);
|
|
66
95
|
}
|
|
67
96
|
catch (e) {
|
|
68
97
|
throw new CliError(e.message);
|
|
69
98
|
}
|
|
70
99
|
}
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
exitCode: 2,
|
|
77
|
-
message: `cannot list stored hubs from the ${which} credential store — ` +
|
|
78
|
-
'pass --hub <origin> (or set OWENLOOP_HUB)',
|
|
79
|
-
};
|
|
100
|
+
const home = [io.env.HOME, io.env.USERPROFILE].find((value) => value !== undefined && value.trim() !== '');
|
|
101
|
+
if (home !== undefined) {
|
|
102
|
+
const config = readGlobalConfig(globalConfigPath(home));
|
|
103
|
+
if (config !== null)
|
|
104
|
+
return config.hub;
|
|
80
105
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
message: 'no hub credentials stored — run `owenloop login --hub <origin>` first, or pass --hub <origin>',
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
if (origins.length > 1) {
|
|
88
|
-
return {
|
|
89
|
-
exitCode: 2,
|
|
90
|
-
message: `multiple hubs in the credential store (${origins.join(', ')}) — pass --hub <origin>`,
|
|
91
|
-
};
|
|
106
|
+
const origins = listStoredHubOrigins(io.env, io.keychain);
|
|
107
|
+
if (origins !== null && origins.length === 1) {
|
|
108
|
+
return origins[0];
|
|
92
109
|
}
|
|
93
|
-
return
|
|
110
|
+
return DEFAULT_HUB;
|
|
94
111
|
}
|
|
95
112
|
// ---- the authenticated hub client -------------------------------------------
|
|
96
113
|
/** The non-interactive "you are not authenticated" instruction (Decision 8). */
|
|
@@ -205,6 +222,98 @@ function passthrough(deps, build) {
|
|
|
205
222
|
return toolResultFromRest(r);
|
|
206
223
|
};
|
|
207
224
|
}
|
|
225
|
+
let warnedMcpUnsigned = false;
|
|
226
|
+
/** Sign the baseline MCP submit when a claimed order can be resolved locally. */
|
|
227
|
+
async function signMcpSubmit(deps, args) {
|
|
228
|
+
const workflow = args['workflow'];
|
|
229
|
+
const run = args['run'];
|
|
230
|
+
const path = args['path'];
|
|
231
|
+
if (typeof workflow !== 'string' || typeof run !== 'string' || typeof path !== 'string' || !('value' in args)) {
|
|
232
|
+
return undefined;
|
|
233
|
+
}
|
|
234
|
+
let keys;
|
|
235
|
+
try {
|
|
236
|
+
keys = deps.io.principalKeys ?? new PrincipalKeyManager({ env: deps.io.env });
|
|
237
|
+
}
|
|
238
|
+
catch (e) {
|
|
239
|
+
warnMcpUnsigned(deps, `machine signing is unavailable (${e.message}); submitting without a proof`);
|
|
240
|
+
return undefined;
|
|
241
|
+
}
|
|
242
|
+
const ref = keys.resolveRef(deps.origin, 'machine');
|
|
243
|
+
if (ref === null) {
|
|
244
|
+
warnMcpUnsigned(deps, `no machine signing key for ${deps.origin}; submitting without a proof`);
|
|
245
|
+
return undefined;
|
|
246
|
+
}
|
|
247
|
+
const inspected = await keys.inspect(ref);
|
|
248
|
+
if (!inspected.exists || inspected.publicKey === undefined) {
|
|
249
|
+
warnMcpUnsigned(deps, `machine signing key for ${deps.origin} is unavailable; submitting without a proof`);
|
|
250
|
+
return undefined;
|
|
251
|
+
}
|
|
252
|
+
const orderResponse = await callHub(deps, {
|
|
253
|
+
method: 'POST',
|
|
254
|
+
path: '/api/get_order',
|
|
255
|
+
body: { workflow, run },
|
|
256
|
+
});
|
|
257
|
+
if (!isOk(orderResponse.status) || !isObject(orderResponse.json) || !isObject(orderResponse.json['order'])) {
|
|
258
|
+
warnMcpUnsigned(deps, `order metadata for ${workflow}/${run} was unavailable; submitting without a proof`);
|
|
259
|
+
return undefined;
|
|
260
|
+
}
|
|
261
|
+
const order = orderResponse.json['order'];
|
|
262
|
+
const version = outputVersion(order, path);
|
|
263
|
+
if (version === undefined) {
|
|
264
|
+
warnMcpUnsigned(deps, `order ${workflow}/${run} omitted authoritative version metadata for output '${path}'; submitting without a proof`);
|
|
265
|
+
return undefined;
|
|
266
|
+
}
|
|
267
|
+
const consumedFingerprint = submissionFingerprint(order, deps);
|
|
268
|
+
if (consumedFingerprint === undefined)
|
|
269
|
+
return undefined;
|
|
270
|
+
const record = buildSubmissionRecord({
|
|
271
|
+
run: order.run,
|
|
272
|
+
workflow: order.workflow,
|
|
273
|
+
defDigest: order.defDigest,
|
|
274
|
+
step: order.step,
|
|
275
|
+
key: order.key,
|
|
276
|
+
...(order.index !== undefined ? { index: order.index } : {}),
|
|
277
|
+
produced: [{ artifact: path, version, value: args['value'] }],
|
|
278
|
+
consumedFingerprint,
|
|
279
|
+
producerKeyId: inspected.publicKey.keyid,
|
|
280
|
+
timestamp: Date.now(),
|
|
281
|
+
});
|
|
282
|
+
return keys.withSigningKey(ref, async (keyPath) => {
|
|
283
|
+
const signer = createSshSigner({
|
|
284
|
+
namespace: DSSE_SSH_NAMESPACE,
|
|
285
|
+
signKeyPath: keyPath,
|
|
286
|
+
...(deps.io.sshProcess !== undefined ? { process: deps.io.sshProcess } : {}),
|
|
287
|
+
});
|
|
288
|
+
return signSubmission(record, signer);
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
function submissionFingerprint(order, deps) {
|
|
292
|
+
if (order.consumedFingerprint !== undefined)
|
|
293
|
+
return order.consumedFingerprint;
|
|
294
|
+
if (order.inputs.length > 0 || Object.keys(order.consumes).length > 0) {
|
|
295
|
+
warnMcpUnsigned(deps, `order ${order.workflow}/${order.run} omitted its consumed fingerprint; submitting without a proof`);
|
|
296
|
+
return undefined;
|
|
297
|
+
}
|
|
298
|
+
return {};
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Resolve a signed submit version from authoritative immutable metadata only.
|
|
302
|
+
* Judge claims name the already-submitted version in their fingerprint. Producer
|
|
303
|
+
* claims do not name a retry-safe target: `owes[].version` is claim-time state and
|
|
304
|
+
* can be stale after a refinement, lost response, unsigned commit, or restart.
|
|
305
|
+
*/
|
|
306
|
+
function outputVersion(order, path) {
|
|
307
|
+
if (order.judge === path)
|
|
308
|
+
return order.consumedFingerprint?.[path];
|
|
309
|
+
return undefined;
|
|
310
|
+
}
|
|
311
|
+
function warnMcpUnsigned(deps, reason) {
|
|
312
|
+
if (warnedMcpUnsigned)
|
|
313
|
+
return;
|
|
314
|
+
warnedMcpUnsigned = true;
|
|
315
|
+
deps.io.err(`owenloop mcp: ${reason}`);
|
|
316
|
+
}
|
|
208
317
|
/**
|
|
209
318
|
* The 17 baseline tools — names, descriptions, and schemas mirror the hub's own
|
|
210
319
|
* HTTP-MCP toolset (owenloop-service `apps/hub-edge/src/mcp/tools.ts`); each maps
|
|
@@ -244,7 +353,23 @@ function buildBaselineTools(deps) {
|
|
|
244
353
|
required: ['workflow', 'run', 'path', 'value'],
|
|
245
354
|
additionalProperties: false,
|
|
246
355
|
},
|
|
247
|
-
handler:
|
|
356
|
+
handler: async (args) => {
|
|
357
|
+
let proof;
|
|
358
|
+
try {
|
|
359
|
+
proof = await signMcpSubmit(deps, args);
|
|
360
|
+
}
|
|
361
|
+
catch (e) {
|
|
362
|
+
// A configured signer/tool failure is a submit error, not an
|
|
363
|
+
// unsigned fallback. The missing-key cases are handled inside the
|
|
364
|
+
// helper and remain compatible with pre-WP-D2 clients.
|
|
365
|
+
return errorText(e.message);
|
|
366
|
+
}
|
|
367
|
+
const body = proof === undefined ? args : { ...args, proof };
|
|
368
|
+
const r = await callHub(deps, { method: 'POST', path: '/api/submit', body });
|
|
369
|
+
if (r.authFailed)
|
|
370
|
+
return errorText(r.authMessage ?? loginHint(deps.origin));
|
|
371
|
+
return toolResultFromRest(r);
|
|
372
|
+
},
|
|
248
373
|
},
|
|
249
374
|
{
|
|
250
375
|
name: 'reject_artifact',
|
|
@@ -674,23 +799,21 @@ async function shouldRegisterEnrollment(deps) {
|
|
|
674
799
|
/**
|
|
675
800
|
* Run the `owenloop mcp` command: resolve the origin, decide the enrollment
|
|
676
801
|
* gate, build the tool list, construct the JSON-RPC server, and pump stdin until
|
|
677
|
-
* EOF. Returns the process exit code:
|
|
678
|
-
*
|
|
679
|
-
*
|
|
802
|
+
* EOF. Returns the process exit code: always 0 on stdin EOF — origin
|
|
803
|
+
* resolution has no exit-2 path of its own anymore (see `resolveMcpOrigin`;
|
|
804
|
+
* it always resolves to some origin, falling back as far as `DEFAULT_HUB`).
|
|
805
|
+
* A malformed `--hub`/`OWENLOOP_HUB` still throws a `CliError` (exit-1 path,
|
|
806
|
+
* via `mainAsync`'s catch).
|
|
680
807
|
*/
|
|
681
808
|
export async function runMcpCommand(io, opts) {
|
|
682
|
-
const
|
|
683
|
-
|
|
684
|
-
io.err(resolved.message);
|
|
685
|
-
return resolved.exitCode;
|
|
686
|
-
}
|
|
687
|
-
const deps = { io, origin: resolved.origin };
|
|
809
|
+
const origin = resolveMcpOrigin(io, opts.hubFlag);
|
|
810
|
+
const deps = { io, origin };
|
|
688
811
|
const tools = [...buildBaselineTools(deps), createAgentTool(deps), ...buildCrewTools(deps)];
|
|
689
812
|
if (await shouldRegisterEnrollment(deps))
|
|
690
813
|
tools.push(stageEnrollmentTool(deps));
|
|
691
814
|
const server = createMcpServer({
|
|
692
815
|
name: 'owenloop-cli-mcp',
|
|
693
|
-
version:
|
|
816
|
+
version: packageVersion(),
|
|
694
817
|
tools,
|
|
695
818
|
write: (msg) => io.out(JSON.stringify(msg)),
|
|
696
819
|
err: (line) => io.err(line),
|
package/dist/src/mcp/server.js
CHANGED
|
@@ -44,7 +44,7 @@ const RECOGNIZED_PROTOCOL_VERSIONS = new Set([
|
|
|
44
44
|
'2024-11-05',
|
|
45
45
|
'2025-03-26',
|
|
46
46
|
'2025-06-18',
|
|
47
|
-
'2025-11-
|
|
47
|
+
'2025-11-25',
|
|
48
48
|
]);
|
|
49
49
|
/** The version we answer with when the client's is missing or unrecognized. */
|
|
50
50
|
const OUR_PROTOCOL_VERSION = '2025-06-18';
|
|
@@ -60,6 +60,12 @@ export function textResult(value, isError = false) {
|
|
|
60
60
|
}
|
|
61
61
|
export function createMcpServer(opts) {
|
|
62
62
|
const err = opts.err ?? (() => { });
|
|
63
|
+
// A plugin supplies its manifest version through the MCP environment. An
|
|
64
|
+
// absent expectation leaves hand-run and headless MCP servers unchanged;
|
|
65
|
+
// only a supplied value can describe a plugin/CLI drift. The comparison is
|
|
66
|
+
// deferred to tools/call instead of rejecting startup, because startup
|
|
67
|
+
// rejection surfaces as the opaque "server transport closed unexpectedly".
|
|
68
|
+
const expectedPluginVersion = process.env['OWENLOOP_PLUGIN_VERSION'];
|
|
63
69
|
const tools = new Map();
|
|
64
70
|
for (const t of opts.tools)
|
|
65
71
|
tools.set(t.name, t);
|
|
@@ -127,6 +133,11 @@ export function createMcpServer(opts) {
|
|
|
127
133
|
},
|
|
128
134
|
};
|
|
129
135
|
try {
|
|
136
|
+
// Keep the check at the transport choke point so every registered tool is
|
|
137
|
+
// covered, but leave unknown tools on the normal -32601 path above.
|
|
138
|
+
if (expectedPluginVersion !== undefined && expectedPluginVersion !== opts.version) {
|
|
139
|
+
throw new Error(`owenloop plugin ${expectedPluginVersion} does not match owenloop CLI ${opts.version}. Run: owenloop setup`);
|
|
140
|
+
}
|
|
130
141
|
const result = await reg.handler(args, ctx);
|
|
131
142
|
// A CLIENT-cancelled call sends NO response frame (the JSON-RPC/MCP
|
|
132
143
|
// cancel contract). A close-cancelled call still replies — see InFlight.
|
package/dist/src/model.d.ts
CHANGED
|
@@ -431,3 +431,18 @@ export declare function applyOutcome(def: WorkflowDef, arts: Map<string, Artifac
|
|
|
431
431
|
* Pure — no store, no engine, no IO.
|
|
432
432
|
*/
|
|
433
433
|
export declare function modelCheck(def: WorkflowDef, opts?: CheckOptions): CheckReport;
|
|
434
|
+
/**
|
|
435
|
+
* The single "definite defect" predicate over a modelCheck `report`, shared by
|
|
436
|
+
* every acceptance gate that accepts or rejects a def (`check`, `add`'s GitHub
|
|
437
|
+
* route, `add`'s workflow-bundle route, `push`). A pure function of the report
|
|
438
|
+
* object — it does NOT read or change how any caller seeded its modelCheck
|
|
439
|
+
* (install/push seed `assumeProvided: true`; check seeds
|
|
440
|
+
* `assumeProvided: !strictInputs`).
|
|
441
|
+
*
|
|
442
|
+
* invariant violations and structurally-dead steps are ALWAYS definite (sound
|
|
443
|
+
* regardless of bounds); a true deadlock counts ONLY when the search was
|
|
444
|
+
* exhaustive (`!bounded`) because a tight maxCollectionSize cap can manufacture
|
|
445
|
+
* a spurious one. `unreachedSteps` is deliberately EXCLUDED — it is a bounds
|
|
446
|
+
* artifact ("raise --max-states/--max-depth"), never a definite defect.
|
|
447
|
+
*/
|
|
448
|
+
export declare function hasDefiniteCheckDefect(report: CheckReport): boolean;
|
package/dist/src/model.js
CHANGED
|
@@ -386,6 +386,66 @@ function idleEligible(step, arts, time) {
|
|
|
386
386
|
return false; // allGreen owns this condition
|
|
387
387
|
return true;
|
|
388
388
|
}
|
|
389
|
+
/**
|
|
390
|
+
* Is a `calls:` step's gate ready in this state — i.e. is every parent artifact
|
|
391
|
+
* wired into `callsInputs` green?
|
|
392
|
+
*
|
|
393
|
+
* This is the model-side mirror of `Engine.callsGateReady` (engine.ts) and MUST
|
|
394
|
+
* read the same field it does: `callsInputs`, the mapping {child input name →
|
|
395
|
+
* parent artifact name}. A `calls:` step's `StepDef.consumes` is ALWAYS `[]`
|
|
396
|
+
* (`buildStep` hardcodes it — "eligibility is engine-managed", defs.ts), so
|
|
397
|
+
* gating on `plainConsumes(step)` is vacuously true for every `calls:` step and
|
|
398
|
+
* is NOT a gate at all. An empty `callsInputs` gate is genuinely always ready —
|
|
399
|
+
* same rule the engine applies.
|
|
400
|
+
*/
|
|
401
|
+
function callsGateReady(step, arts) {
|
|
402
|
+
const gateStems = Object.values(step.callsInputs ?? {});
|
|
403
|
+
return gateStems.every((s) => isGreen(arts.get(s)));
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* The `calls:` discharges available in THIS state — one firing per `calls:` step
|
|
407
|
+
* whose gate is ready (the engine would provision/re-provide the child now) and
|
|
408
|
+
* whose produced artifact is still a debt (the child has not yet discharged it).
|
|
409
|
+
*
|
|
410
|
+
* Why this exists: `eligibleFirings` skips every `calls:` step (M2 — the engine
|
|
411
|
+
* spawns a child rather than issuing a worker order), and `modelCheck` explores
|
|
412
|
+
* ONE def with no child engine attached. Without modeling the handoff, the
|
|
413
|
+
* exploration mistakes "waiting on a child I can't see" for "structurally dead",
|
|
414
|
+
* which made `hasDefiniteCheckDefect` reject EVERY `calls:`-using def at install
|
|
415
|
+
* time — including the repo's own `examples/workflows/provisioned-delivery.yaml`.
|
|
416
|
+
*
|
|
417
|
+
* This is a TRANSITION, not a reclassification. That distinction is the whole
|
|
418
|
+
* point: an earlier version of this fix was a def-wide boolean OR'd into the
|
|
419
|
+
* deadlock/stall branch, which relabelled EVERY zero-firing state in the def —
|
|
420
|
+
* so one unrelated `calls:` step anywhere in a def suppressed every genuine
|
|
421
|
+
* deadlock in it. Modeling the discharge as a successor state instead keeps the
|
|
422
|
+
* classification strictly per-state: the child greens ITS OWN artifact and
|
|
423
|
+
* nothing else, so a deadlock elsewhere in the same def is still reached and
|
|
424
|
+
* still reported.
|
|
425
|
+
*
|
|
426
|
+
* Kept separate from `eligibleFirings` deliberately: that function is the LIVE
|
|
427
|
+
* engine scheduler and a `calls:` step must never become a worker order. These
|
|
428
|
+
* firings are consumed only by `modelCheck`'s successor expansion.
|
|
429
|
+
*/
|
|
430
|
+
function callsDischargeFirings(def, arts) {
|
|
431
|
+
const firings = [];
|
|
432
|
+
for (const step of def.steps) {
|
|
433
|
+
if (!step.calls)
|
|
434
|
+
continue;
|
|
435
|
+
if (!callsGateReady(step, arts))
|
|
436
|
+
continue;
|
|
437
|
+
const outs = plainOutputs(step).filter((p) => isDebt(arts.get(p)));
|
|
438
|
+
if (outs.length === 0)
|
|
439
|
+
continue;
|
|
440
|
+
firings.push({
|
|
441
|
+
step: step.name,
|
|
442
|
+
key: '',
|
|
443
|
+
inputs: Object.values(step.callsInputs ?? {}),
|
|
444
|
+
outputs: outs,
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
return firings;
|
|
448
|
+
}
|
|
389
449
|
/**
|
|
390
450
|
* Every firing eligible *right now* — inputs satisfied AND an owed/rejected
|
|
391
451
|
* output to discharge. This is the scheduling gate (§11.4): necessary, not
|
|
@@ -1648,6 +1708,16 @@ function eligibleOutcomes(def, arts, firing) {
|
|
|
1648
1708
|
}
|
|
1649
1709
|
return ['judge-approve', 'judge-reject'];
|
|
1650
1710
|
}
|
|
1711
|
+
// M2: a `calls:` firing is the machine handing off to a child instance, not a
|
|
1712
|
+
// worker order. The only outcome the PARENT def can observe is the child's
|
|
1713
|
+
// terminal outcome cascading up as a green on the calls artifact. None of the
|
|
1714
|
+
// worker-verb outcomes apply: there is no worker to schema-reject a value, no
|
|
1715
|
+
// consumer to judgment-reject (a calls: step declares `consumes: []`), and a
|
|
1716
|
+
// calls: produce may carry neither `judges:` nor `group:` (rejected by
|
|
1717
|
+
// `buildStep`). Modeling only the green keeps the successor set faithful to
|
|
1718
|
+
// what the engine can actually do here.
|
|
1719
|
+
if (step.calls)
|
|
1720
|
+
return ['green'];
|
|
1651
1721
|
const stem = collectionStem(step);
|
|
1652
1722
|
const outPath = firing.outputs[0] ?? '';
|
|
1653
1723
|
const el = parseElement(outPath);
|
|
@@ -2029,7 +2099,28 @@ export function modelCheck(def, opts = {}) {
|
|
|
2029
2099
|
}
|
|
2030
2100
|
continue; // done states have no successors
|
|
2031
2101
|
}
|
|
2032
|
-
|
|
2102
|
+
// WS-6 — model the `calls:` handoff as a real TRANSITION, not a
|
|
2103
|
+
// reclassification. M2 makes `eligibleFirings` skip every `calls:` step (the
|
|
2104
|
+
// engine spawns a child to discharge it, so it must never become a worker
|
|
2105
|
+
// firing), and the model has no child engine attached. Left unmodeled, a
|
|
2106
|
+
// state waiting on a child reaches the classification branch below with zero
|
|
2107
|
+
// firings and gets called a TRUE deadlock — asserting this report's own
|
|
2108
|
+
// documented claim ("no path to completion even at unlimited attempts"),
|
|
2109
|
+
// which is false: the engine does spawn the child and the debt is
|
|
2110
|
+
// discharged.
|
|
2111
|
+
//
|
|
2112
|
+
// The child is modeled as a single opaque green of the calls artifact — the
|
|
2113
|
+
// only thing the parent def can observe about it. `callsDischargeFirings`
|
|
2114
|
+
// gates per-step on `callsInputs` (the same field `Engine.callsGateReady`
|
|
2115
|
+
// reads), so a `calls:` step whose gate is NOT green yields no firing and
|
|
2116
|
+
// the state is classified on its own merits. Because the discharge greens
|
|
2117
|
+
// only that step's own artifact, an unrelated deadlock elsewhere in the same
|
|
2118
|
+
// def is still reached and still reported.
|
|
2119
|
+
//
|
|
2120
|
+
// `eligibleFirings` (the LIVE engine scheduler) and `hasDefiniteCheckDefect`
|
|
2121
|
+
// (shared by check / add / push / install) are deliberately untouched.
|
|
2122
|
+
const callsFirings = callsDischargeFirings(def, node.arts);
|
|
2123
|
+
const firings = [...status.eligible, ...callsFirings];
|
|
2033
2124
|
// Non-done state with no eligible firings: classify by recomputing eligibility
|
|
2034
2125
|
// as if every freeze/stall were lifted (unlimited attempts). If a producer
|
|
2035
2126
|
// would re-arm → an EXPECTED stall state (a by-design brake). If not → a
|
|
@@ -2103,3 +2194,22 @@ export function modelCheck(def, opts = {}) {
|
|
|
2103
2194
|
}
|
|
2104
2195
|
return report;
|
|
2105
2196
|
}
|
|
2197
|
+
/**
|
|
2198
|
+
* The single "definite defect" predicate over a modelCheck `report`, shared by
|
|
2199
|
+
* every acceptance gate that accepts or rejects a def (`check`, `add`'s GitHub
|
|
2200
|
+
* route, `add`'s workflow-bundle route, `push`). A pure function of the report
|
|
2201
|
+
* object — it does NOT read or change how any caller seeded its modelCheck
|
|
2202
|
+
* (install/push seed `assumeProvided: true`; check seeds
|
|
2203
|
+
* `assumeProvided: !strictInputs`).
|
|
2204
|
+
*
|
|
2205
|
+
* invariant violations and structurally-dead steps are ALWAYS definite (sound
|
|
2206
|
+
* regardless of bounds); a true deadlock counts ONLY when the search was
|
|
2207
|
+
* exhaustive (`!bounded`) because a tight maxCollectionSize cap can manufacture
|
|
2208
|
+
* a spurious one. `unreachedSteps` is deliberately EXCLUDED — it is a bounds
|
|
2209
|
+
* artifact ("raise --max-states/--max-depth"), never a definite defect.
|
|
2210
|
+
*/
|
|
2211
|
+
export function hasDefiniteCheckDefect(report) {
|
|
2212
|
+
return (report.invariantViolations.length > 0 ||
|
|
2213
|
+
report.structurallyDeadSteps.length > 0 ||
|
|
2214
|
+
(!report.bounded && report.deadlocks.length > 0));
|
|
2215
|
+
}
|