@holmes-lab/holmes-kit 0.39.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +344 -6
- package/README.md +54 -41
- package/dist/.build-id +1 -1
- package/dist/holmes/admission/core/admission-policy.d.ts +37 -0
- package/dist/holmes/admission/core/admission-policy.js +147 -0
- package/dist/holmes/admission/core/bounded-reader.d.ts +56 -0
- package/dist/holmes/admission/core/bounded-reader.js +135 -0
- package/dist/holmes/admission/core/change-classifier.d.ts +34 -0
- package/dist/holmes/admission/core/change-classifier.js +278 -0
- package/dist/holmes/admission/core/config-loader.d.ts +30 -0
- package/dist/holmes/admission/core/config-loader.js +145 -0
- package/dist/holmes/admission/core/event-judgement.d.ts +37 -0
- package/dist/holmes/admission/core/event-judgement.js +251 -0
- package/dist/holmes/admission/core/path-rules.d.ts +35 -0
- package/dist/holmes/admission/core/path-rules.js +88 -0
- package/dist/holmes/admission/core/pin.d.ts +7 -0
- package/dist/holmes/admission/core/pin.js +29 -0
- package/dist/holmes/admission/core/ports.d.ts +48 -0
- package/dist/holmes/admission/core/ports.js +11 -0
- package/dist/holmes/admission/core/range-resolver.d.ts +32 -0
- package/dist/holmes/admission/core/range-resolver.js +51 -0
- package/dist/holmes/admission/core/self-containment.d.ts +1 -0
- package/dist/holmes/admission/core/self-containment.js +125 -0
- package/dist/holmes/admission/core/signature-source.d.ts +9 -0
- package/dist/holmes/admission/core/signature-source.js +4 -0
- package/dist/holmes/admission/core/transition-planner.d.ts +15 -0
- package/dist/holmes/admission/core/transition-planner.js +14 -0
- package/dist/holmes/admission/core/verdict.d.ts +38 -0
- package/dist/holmes/admission/core/verdict.js +17 -0
- package/dist/holmes/admission/core/wiring.d.ts +44 -0
- package/dist/holmes/admission/core/wiring.js +618 -0
- package/dist/holmes/admission/forge/git-object-port.d.ts +4 -0
- package/dist/holmes/admission/forge/git-object-port.js +132 -0
- package/dist/holmes/assoc/assoc-arm.d.ts +1 -1
- package/dist/holmes/assoc/assoc-arm.js +1 -1
- package/dist/holmes/cli/agents.d.ts +8 -0
- package/dist/holmes/cli/agents.js +9 -5
- package/dist/holmes/cli/approve-cli.d.ts +2 -0
- package/dist/holmes/cli/approve-cli.js +392 -0
- package/dist/holmes/cli/approve-ref.d.ts +13 -7
- package/dist/holmes/cli/approve-ref.js +30 -10
- package/dist/holmes/cli/approve-status.d.ts +26 -2
- package/dist/holmes/cli/approve-status.js +98 -18
- package/dist/holmes/cli/approve-watch.d.ts +5 -0
- package/dist/holmes/cli/approve-watch.js +10 -5
- package/dist/holmes/cli/approve.d.ts +49 -13
- package/dist/holmes/cli/approve.js +249 -67
- package/dist/holmes/cli/attest.js +2 -1
- package/dist/holmes/cli/autonomy.d.ts +4 -1
- package/dist/holmes/cli/autonomy.js +17 -10
- package/dist/holmes/cli/codex-oracle.d.ts +11 -0
- package/dist/holmes/cli/codex-oracle.js +5 -1
- package/dist/holmes/cli/codex-toml.d.ts +10 -0
- package/dist/holmes/cli/codex-toml.js +36 -2
- package/dist/holmes/cli/doctor-boundary.d.ts +76 -0
- package/dist/holmes/cli/doctor-boundary.js +308 -0
- package/dist/holmes/cli/doctor-locks.d.ts +15 -0
- package/dist/holmes/cli/doctor-locks.js +119 -0
- package/dist/holmes/cli/doctor.d.ts +2 -0
- package/dist/holmes/cli/doctor.js +34 -5
- package/dist/holmes/cli/flags.d.ts +23 -0
- package/dist/holmes/cli/flags.js +89 -0
- package/dist/holmes/cli/index.d.ts +5 -1
- package/dist/holmes/cli/index.js +202 -424
- package/dist/holmes/cli/init.js +33 -0
- package/dist/holmes/cli/lock-recover.d.ts +5 -0
- package/dist/holmes/cli/lock-recover.js +126 -0
- package/dist/holmes/cli/mcp-processes.js +1 -1
- package/dist/holmes/cli/release-docs.js +1 -1
- package/dist/holmes/cli/run-exec.d.ts +141 -0
- package/dist/holmes/cli/run-exec.js +1435 -0
- package/dist/holmes/cli/run-provision.d.ts +3 -1
- package/dist/holmes/cli/run-provision.js +255 -44
- package/dist/holmes/cli/run-wiring.d.ts +69 -0
- package/dist/holmes/cli/run-wiring.js +270 -0
- package/dist/holmes/cli/run.d.ts +21 -0
- package/dist/holmes/cli/run.js +341 -92
- package/dist/holmes/cli/runtime-binding-approval.js +32 -19
- package/dist/holmes/cli/screen-safe.d.ts +3 -92
- package/dist/holmes/cli/screen-safe.js +18 -756
- package/dist/holmes/config/config.d.ts +2 -0
- package/dist/holmes/config/config.js +5 -2
- package/dist/holmes/cpg/foundation/language-matrix.js +2 -2
- package/dist/holmes/cpg/import-resolver.js +1 -1
- package/dist/holmes/governance/approval-decisions.d.ts +47 -0
- package/dist/holmes/governance/approval-decisions.js +29 -0
- package/dist/holmes/governance/approval-grants.d.ts +220 -1
- package/dist/holmes/governance/approval-grants.js +612 -33
- package/dist/holmes/governance/approval-queue.d.ts +26 -0
- package/dist/holmes/governance/approval-queue.js +109 -11
- package/dist/holmes/governance/approval-spend.d.ts +95 -0
- package/dist/holmes/governance/approval-spend.js +191 -0
- package/dist/holmes/governance/autonomous-shell.d.ts +61 -0
- package/dist/holmes/governance/autonomous-shell.js +332 -0
- package/dist/holmes/governance/autonomy.d.ts +5 -0
- package/dist/holmes/governance/autonomy.js +16 -11
- package/dist/holmes/governance/constitution.d.ts +5 -0
- package/dist/holmes/governance/constitution.js +32 -12
- package/dist/holmes/governance/full-autonomy.d.ts +10 -0
- package/dist/holmes/governance/full-autonomy.js +103 -7
- package/dist/holmes/governance/harness-catalog.d.ts +103 -0
- package/dist/holmes/governance/harness-catalog.js +348 -0
- package/dist/holmes/governance/human-channel.d.ts +38 -0
- package/dist/holmes/governance/human-channel.js +49 -0
- package/dist/holmes/governance/install-manifest.d.ts +22 -0
- package/dist/holmes/governance/install-manifest.js +160 -0
- package/dist/holmes/governance/ledger-rechain.js +2 -0
- package/dist/holmes/governance/ledger-store.conformance.d.ts +7 -1
- package/dist/holmes/governance/ledger-store.conformance.js +66 -0
- package/dist/holmes/governance/ledger-store.d.ts +88 -11
- package/dist/holmes/governance/ledger-store.js +186 -8
- package/dist/holmes/governance/provenance-chain.d.ts +16 -4
- package/dist/holmes/governance/provenance-chain.js +19 -4
- package/dist/holmes/governance/provenance-ledger.d.ts +6 -3
- package/dist/holmes/governance/provenance-ledger.js +53 -18
- package/dist/holmes/governance/push-gate-runner.js +11 -7
- package/dist/holmes/governance/recorded-pairs.d.ts +96 -0
- package/dist/holmes/governance/recorded-pairs.js +522 -0
- package/dist/holmes/governance/replica-id.d.ts +1 -1
- package/dist/holmes/governance/replica-id.js +1 -1
- package/dist/holmes/governance/spec-seam.d.ts +59 -0
- package/dist/holmes/governance/spec-seam.js +587 -0
- package/dist/holmes/governance/spend-kinds.d.ts +16 -0
- package/dist/holmes/governance/spend-kinds.js +18 -0
- package/dist/holmes/guardrail/decision-ledger.d.ts +2 -1
- package/dist/holmes/guardrail/decision-ledger.js +2 -1
- package/dist/holmes/guardrail/impact-gate.d.ts +1 -0
- package/dist/holmes/guardrail/impact-gate.js +1 -1
- package/dist/holmes/guardrail/line-continuation.d.ts +8 -0
- package/dist/holmes/guardrail/line-continuation.js +39 -0
- package/dist/holmes/guardrail/operator-person.d.ts +28 -4
- package/dist/holmes/guardrail/operator-person.js +57 -11
- package/dist/holmes/guardrail/refusal-codes.d.ts +8 -3
- package/dist/holmes/guardrail/refusal-codes.js +64 -10
- package/dist/holmes/guardrail/risk-classifier.d.ts +15 -9
- package/dist/holmes/guardrail/risk-classifier.js +228 -16
- package/dist/holmes/guardrail/risk-gate.d.ts +2 -8
- package/dist/holmes/guardrail/risk-gate.js +7 -34
- package/dist/holmes/guardrail/risk-types.d.ts +10 -0
- package/dist/holmes/guardrail/run-plan-scope.js +3 -1
- package/dist/holmes/guardrail/run-refusals.js +24 -8
- package/dist/holmes/guardrail/run-stages.d.ts +5 -0
- package/dist/holmes/guardrail/run-stages.js +25 -5
- package/dist/holmes/guardrail/scope-judgment.js +1 -1
- package/dist/holmes/guardrail/shell-words.js +24 -3
- package/dist/holmes/guardrail/unresolved-write.d.ts +40 -0
- package/dist/holmes/guardrail/unresolved-write.js +556 -0
- package/dist/holmes/guardrail/write-target.d.ts +3 -0
- package/dist/holmes/guardrail/write-target.js +26 -5
- package/dist/holmes/hooks/pre-tool-use.d.ts +105 -1
- package/dist/holmes/hooks/pre-tool-use.js +1134 -167
- package/dist/holmes/hooks/rtm-refresh-child.d.ts +1 -1
- package/dist/holmes/hooks/rtm-refresh-child.js +1 -1
- package/dist/holmes/hooks/stop.d.ts +23 -0
- package/dist/holmes/hooks/stop.js +86 -33
- package/dist/holmes/mcp/approval-adapters.js +3 -1
- package/dist/holmes/mcp/approval-commit.js +3 -2
- package/dist/holmes/mcp/approval-policy.d.ts +2 -1
- package/dist/holmes/mcp/approval-policy.js +3 -1
- package/dist/holmes/mcp/handlers/adoption.d.ts +1 -1
- package/dist/holmes/mcp/handlers/approval-ask.d.ts +3 -0
- package/dist/holmes/mcp/handlers/approval-ask.js +18 -7
- package/dist/holmes/mcp/handlers/entity-integration.d.ts +3 -3
- package/dist/holmes/mcp/handlers/entity-integration.js +29 -11
- package/dist/holmes/mcp/handlers/entity-renumber.d.ts +4 -4
- package/dist/holmes/mcp/handlers/entity-renumber.js +29 -11
- package/dist/holmes/mcp/handlers/entity-store.d.ts +2 -2
- package/dist/holmes/mcp/handlers/entity-store.js +133 -59
- package/dist/holmes/mcp/handlers/operator-inspection.d.ts +9 -5
- package/dist/holmes/mcp/handlers/operator-inspection.js +79 -16
- package/dist/holmes/mcp/handlers/phase-queries.d.ts +1 -1
- package/dist/holmes/mcp/handlers/requirement-triage.d.ts +4 -4
- package/dist/holmes/mcp/handlers/review-evidence.d.ts +2 -2
- package/dist/holmes/mcp/handlers/review-evidence.js +35 -11
- package/dist/holmes/mcp/handlers/review-queries.d.ts +5 -0
- package/dist/holmes/mcp/handlers/review-queries.js +8 -1
- package/dist/holmes/mcp/handlers/review-verdict.d.ts +3 -0
- package/dist/holmes/mcp/handlers/review-verdict.js +10 -3
- package/dist/holmes/mcp/handlers/risk-assessment.d.ts +7 -2
- package/dist/holmes/mcp/handlers/risk-assessment.js +34 -12
- package/dist/holmes/mcp/handlers/runtime-binding-tool.d.ts +2 -2
- package/dist/holmes/mcp/handlers/slice-orchestration.d.ts +6 -1
- package/dist/holmes/mcp/handlers/slice-orchestration.js +14 -1
- package/dist/holmes/mcp/handlers/spec-approval.d.ts +15 -3
- package/dist/holmes/mcp/handlers/spec-approval.js +32 -5
- package/dist/holmes/mcp/handlers/spec-authoring.d.ts +2 -2
- package/dist/holmes/mcp/handlers/spec-authoring.js +19 -2
- package/dist/holmes/mcp/handlers/spec-lifecycle.d.ts +11 -38
- package/dist/holmes/mcp/handlers/spec-lifecycle.js +441 -94
- package/dist/holmes/mcp/handlers/spec-queries.d.ts +2 -2
- package/dist/holmes/mcp/handlers/taint-screening.d.ts +1 -1
- package/dist/holmes/mcp/handlers/taint-screening.js +2 -2
- package/dist/holmes/mcp/handlers/test-execution.d.ts +1 -1
- package/dist/holmes/mcp/handlers/workspace-queries.d.ts +2 -2
- package/dist/holmes/mcp/handlers.d.ts +89 -79
- package/dist/holmes/mcp/handlers.js +69 -22
- package/dist/holmes/mcp/harness-attestation.d.ts +78 -5
- package/dist/holmes/mcp/harness-attestation.js +325 -53
- package/dist/holmes/mcp/maintenance-analyze.d.ts +1 -1
- package/dist/holmes/mcp/maintenance-analyze.js +9 -9
- package/dist/holmes/mcp/maintenance-evidence.js +31 -2
- package/dist/holmes/mcp/requirement-triage-evidence.js +22 -13
- package/dist/holmes/mcp/server-staleness.js +1 -1
- package/dist/holmes/mcp/server.js +9 -8
- package/dist/holmes/mcp/spec-id-guard.js +1 -1
- package/dist/holmes/mcp/tool-schemas.d.ts +13 -0
- package/dist/holmes/mcp/tool-schemas.js +29 -2
- package/dist/holmes/project/act-root.d.ts +19 -0
- package/dist/holmes/project/act-root.js +100 -0
- package/dist/holmes/project/baseline.js +4 -3
- package/dist/holmes/project/bounded-group.d.ts +47 -0
- package/dist/holmes/project/bounded-group.js +140 -0
- package/dist/holmes/project/bounded-io.d.ts +50 -2
- package/dist/holmes/project/bounded-io.js +138 -6
- package/dist/holmes/project/change-source.js +2 -2
- package/dist/holmes/project/instance-id.d.ts +10 -0
- package/dist/holmes/project/instance-id.js +233 -0
- package/dist/holmes/project/machine-identity.d.ts +25 -0
- package/dist/holmes/project/machine-identity.js +133 -0
- package/dist/holmes/project/owned-lock.d.ts +84 -0
- package/dist/holmes/project/owned-lock.js +263 -0
- package/dist/holmes/project/plain-lock-fs.d.ts +2 -0
- package/dist/holmes/project/plain-lock-fs.js +126 -0
- package/dist/holmes/project/request-lock.d.ts +85 -0
- package/dist/holmes/project/request-lock.js +459 -0
- package/dist/holmes/project/root.d.ts +12 -4
- package/dist/holmes/project/root.js +26 -7
- package/dist/holmes/project/run-records.d.ts +19 -0
- package/dist/holmes/project/run-records.js +94 -12
- package/dist/holmes/project/screen-text.d.ts +94 -0
- package/dist/holmes/project/screen-text.js +763 -0
- package/dist/holmes/project/spend-lock.d.ts +82 -0
- package/dist/holmes/project/spend-lock.js +413 -0
- package/dist/holmes/refresh/freshness-coordinator.d.ts +1 -1
- package/dist/holmes/refresh/freshness-coordinator.js +1 -1
- package/dist/holmes/review/condition-hunk-replay.js +4 -2
- package/dist/holmes/review/confidence-calibration.d.ts +1 -1
- package/dist/holmes/review/confidence-calibration.js +1 -1
- package/dist/holmes/review/content-verify.js +1 -1
- package/dist/holmes/review/hop-ablation.d.ts +4 -4
- package/dist/holmes/review/hop-ablation.js +5 -5
- package/dist/holmes/review/point-in-time-replay.js +12 -3
- package/dist/holmes/review/rank-diagnosis.d.ts +2 -2
- package/dist/holmes/review/rank-diagnosis.js +1 -1
- package/dist/holmes/review/replay-corpus.d.ts +10 -4
- package/dist/holmes/review/replay-corpus.js +25 -9
- package/dist/holmes/review/requirement-triage.js +2 -2
- package/dist/holmes/review/semantic-arm.d.ts +3 -3
- package/dist/holmes/review/semantic-arm.js +3 -3
- package/dist/holmes/review/test-outcomes.js +3 -1
- package/dist/holmes/review/test-runner.d.ts +11 -0
- package/dist/holmes/review/test-runner.js +31 -10
- package/dist/holmes/review/test-selection-breadth.js +2 -2
- package/dist/holmes/review/verdicts.d.ts +105 -8
- package/dist/holmes/review/verdicts.js +640 -36
- package/dist/holmes/rtm/anchor-census.d.ts +9 -0
- package/dist/holmes/rtm/anchor-census.js +151 -0
- package/dist/holmes/rtm/anchor-ids.d.ts +25 -1
- package/dist/holmes/rtm/anchor-ids.js +45 -2
- package/dist/holmes/rtm/comment-ranges.d.ts +2 -0
- package/dist/holmes/rtm/comment-ranges.js +104 -0
- package/dist/holmes/rtm/counted-tests.d.ts +1 -0
- package/dist/holmes/rtm/counted-tests.js +63 -0
- package/dist/holmes/rtm/impact-advisory.d.ts +1 -1
- package/dist/holmes/rtm/known-defects.js +1 -1
- package/dist/holmes/rtm/localize.js +1 -1
- package/dist/holmes/rtm/taint-benchmark.d.ts +1 -1
- package/dist/holmes/rtm/taint-vocabulary.d.ts +1 -1
- package/dist/holmes/rtm/test-scope.d.ts +31 -0
- package/dist/holmes/rtm/test-scope.js +166 -5
- package/dist/holmes/rtm/trace-gaps.js +1 -1
- package/dist/holmes/runtime/dispatch.d.ts +10 -0
- package/dist/holmes/runtime/dispatch.js +12 -1
- package/dist/holmes/semantic/cloud-usage.d.ts +1 -1
- package/dist/holmes/semantic/cloud-usage.js +1 -1
- package/dist/holmes/semantic/unreadable-paths.d.ts +1 -1
- package/dist/holmes/semantic/unreadable-paths.js +1 -1
- package/dist/holmes/spec/approval-blockers.js +1 -1
- package/dist/holmes/spec/entity-store.d.ts +6 -1
- package/dist/holmes/spec/entity-store.js +16 -2
- package/dist/holmes/spec/entity-transaction.d.ts +7 -2
- package/dist/holmes/spec/entity-transaction.js +87 -170
- package/dist/holmes/spec/spec-store.d.ts +12 -6
- package/dist/holmes/spec/spec-store.js +4 -2
- package/dist/holmes/spec/spec-types.js +1 -1
- package/dist/holmes/spec/succession-guard.d.ts +56 -0
- package/dist/holmes/spec/succession-guard.js +187 -0
- package/dist/holmes/spec/succession.d.ts +70 -0
- package/dist/holmes/spec/succession.js +171 -0
- package/dist/holmes/spec/transition-policy.d.ts +2 -2
- package/docs/install-guide.md +9 -3
- package/docs/language-support.md +78 -0
- package/package.json +4 -3
- package/playbooks/author-slice/PLAYBOOK.md +1 -1
- package/playbooks/promote-slice/PLAYBOOK.md +5 -1
- package/playbooks/publish/PLAYBOOK.md +45 -33
- package/dist/holmes/review/manual-baseline.d.ts +0 -209
- package/dist/holmes/review/manual-baseline.js +0 -2847
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SPEND_NAMESPACES = void 0;
|
|
4
|
+
exports.spendKind = spendKind;
|
|
5
|
+
exports.revokeKind = revokeKind;
|
|
6
|
+
// @implements A-SPEC-794.4, A-SPEC-794.46
|
|
7
|
+
/**
|
|
8
|
+
* The ledger kinds a nonce is spent and revoked under, by namespace. Every reader and writer of these rows names the
|
|
9
|
+
* kind through this table, so a new namespace (the queue redesign planned for 0.41 may add one) is a row here, not a branch in each
|
|
10
|
+
* reader. In 0.40.0 the one namespace is `grant`, whose kinds are the ones the ledger has always held.
|
|
11
|
+
*/
|
|
12
|
+
exports.SPEND_NAMESPACES = {
|
|
13
|
+
grant: { consumed: 'nonce-consumed', revoked: 'nonce-revoked' },
|
|
14
|
+
};
|
|
15
|
+
/** The ledger kind of a spend in `ns`. */
|
|
16
|
+
function spendKind(ns = 'grant') { return exports.SPEND_NAMESPACES[ns].consumed; }
|
|
17
|
+
/** The ledger kind of a revocation in `ns`. */
|
|
18
|
+
function revokeKind(ns = 'grant') { return exports.SPEND_NAMESPACES[ns].revoked; }
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { RiskAction, RiskLevel } from './risk-types';
|
|
2
|
+
import { LedgerActor } from '../governance/human-channel';
|
|
2
3
|
export interface DecisionEvent {
|
|
3
4
|
ts: string;
|
|
4
|
-
actor:
|
|
5
|
+
actor: LedgerActor;
|
|
5
6
|
action: RiskAction;
|
|
6
7
|
level: RiskLevel;
|
|
7
8
|
decision: 'auto' | 'approved' | 'proceeded-unconfirmed' | 'blocked' | 'rejected';
|
|
@@ -37,6 +37,7 @@ exports.DecisionLedger = void 0;
|
|
|
37
37
|
// @implements A-SPEC-125.2
|
|
38
38
|
const fs = __importStar(require("node:fs"));
|
|
39
39
|
const path = __importStar(require("node:path"));
|
|
40
|
+
const human_channel_1 = require("../governance/human-channel");
|
|
40
41
|
// Default path used by callers: .ax/ledger/decisions.jsonl
|
|
41
42
|
/**
|
|
42
43
|
* Append-only, provenance audit trail for riskGate decisions. Each call to
|
|
@@ -94,7 +95,7 @@ class DecisionLedger {
|
|
|
94
95
|
static serialize(e) {
|
|
95
96
|
const ordered = {
|
|
96
97
|
ts: e.ts,
|
|
97
|
-
actor: e.actor,
|
|
98
|
+
actor: (0, human_channel_1.ledgerActor)(e.actor),
|
|
98
99
|
action: e.action,
|
|
99
100
|
level: e.level,
|
|
100
101
|
decision: e.decision,
|
|
@@ -75,6 +75,7 @@ export type PreEditEvidenceMode = 'off' | 'warn' | 'block';
|
|
|
75
75
|
export declare function preEditEvidenceDecision(verdict: EditEvidenceVerdict, mode: PreEditEvidenceMode): {
|
|
76
76
|
permissionDecision: 'allow' | 'deny';
|
|
77
77
|
permissionDecisionReason?: string;
|
|
78
|
+
refusal?: string;
|
|
78
79
|
} | null;
|
|
79
80
|
/**
|
|
80
81
|
* @implements A-SPEC-278
|
|
@@ -243,7 +243,7 @@ function preEditEvidenceDecision(verdict, mode) {
|
|
|
243
243
|
// `widen` denies under `block` too: "the evidence is not sufficient yet" is not permission. The
|
|
244
244
|
// separate verdict word survives in the message so the reader knows which kind of insufficiency.
|
|
245
245
|
return mode === 'block'
|
|
246
|
-
? { permissionDecision: 'deny', permissionDecisionReason: reason }
|
|
246
|
+
? { permissionDecision: 'deny', refusal: 'evidence.missing', permissionDecisionReason: reason } // A-SPEC-245.24
|
|
247
247
|
: { permissionDecision: 'allow', permissionDecisionReason: reason };
|
|
248
248
|
}
|
|
249
249
|
const PERSISTED_SCAN_LIMIT = 64;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shell's line continuation for the push and publish flag judgement, the patch mark and the push spec-change check.
|
|
3
|
+
* Other readers keep their own handling (`write-target.ts` `joinShellText`, `pre-tool-use.ts` `scanShell`); merging
|
|
4
|
+
* them is on the 0.41 list. A backslash right before a line feed removes both, outside single quotes; a backslash that is
|
|
5
|
+
* itself escaped is a character, not a continuation; a backslash before a carriage return is not one either, as in
|
|
6
|
+
* bash. The caller removes comments and here-document bodies first, since this reader does not know them.
|
|
7
|
+
*/
|
|
8
|
+
export declare function joinLineContinuations(text: string): string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.joinLineContinuations = joinLineContinuations;
|
|
4
|
+
// @implements A-SPEC-794.52, A-SPEC-794.53
|
|
5
|
+
/**
|
|
6
|
+
* The shell's line continuation for the push and publish flag judgement, the patch mark and the push spec-change check.
|
|
7
|
+
* Other readers keep their own handling (`write-target.ts` `joinShellText`, `pre-tool-use.ts` `scanShell`); merging
|
|
8
|
+
* them is on the 0.41 list. A backslash right before a line feed removes both, outside single quotes; a backslash that is
|
|
9
|
+
* itself escaped is a character, not a continuation; a backslash before a carriage return is not one either, as in
|
|
10
|
+
* bash. The caller removes comments and here-document bodies first, since this reader does not know them.
|
|
11
|
+
*/
|
|
12
|
+
function joinLineContinuations(text) {
|
|
13
|
+
let out = '';
|
|
14
|
+
let quote = null;
|
|
15
|
+
for (let i = 0; i < text.length; i++) {
|
|
16
|
+
const ch = text[i];
|
|
17
|
+
if (quote === "'") {
|
|
18
|
+
out += ch;
|
|
19
|
+
if (ch === "'")
|
|
20
|
+
quote = null;
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
if (ch === '\\') {
|
|
24
|
+
if (text[i + 1] === '\n') {
|
|
25
|
+
i += 1;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
out += ch + (text[i + 1] ?? '');
|
|
29
|
+
i++;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (ch === '"')
|
|
33
|
+
quote = quote === '"' ? null : '"';
|
|
34
|
+
else if (ch === "'" && quote === null)
|
|
35
|
+
quote = "'";
|
|
36
|
+
out += ch;
|
|
37
|
+
}
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
@@ -4,11 +4,35 @@
|
|
|
4
4
|
* its environment marker (A-SPEC-102.7), a harness among its parents (A-SPEC-102.8), or parents that cannot be read.
|
|
5
5
|
* A person's terminal and a CI operator without a TTY are unchanged. Named residual: a script that loads these modules
|
|
6
6
|
* and calls `grantRequest` itself, or a process reparented away with its markers removed, is the same user.
|
|
7
|
+
* @implements A-SPEC-245.20 — the parents are read with the system's ps (never one on PATH), and a chain longer than the
|
|
8
|
+
* walk refuses. Named residual too: a command run through a daemon or a multiplexer the operator started (a new window
|
|
9
|
+
* in the owner's tmux server, code inside a launchd service the agent restarted) carries neither the marker nor the
|
|
10
|
+
* ancestry; on Windows powershell.exe is still found on PATH.
|
|
11
|
+
* @implements A-SPEC-245.22 (item 2) — and, named plainly: this boundary stops an agent that does not both empty its
|
|
12
|
+
* environment and reparent: an unmarked, reparented process is not told apart from the owner's own launchd job. A loop, a self-parent and a failed
|
|
13
|
+
* ps refuse.
|
|
14
|
+
* @implements A-SPEC-245.23 (item 6) — two more, named: a POSIX row has no creation time, so a reused pid can lead the
|
|
15
|
+
* walk into another process's chain (its parent must have exited first: the reparenting limit); on Windows a parent
|
|
16
|
+
* created after its child ends the walk as a person's (A-SPEC-779.6).
|
|
7
17
|
*/
|
|
8
18
|
import { HarnessAncestry } from '../review/verdicts';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export
|
|
19
|
+
import { type ActRoot, type HarnessCatalog } from '../governance/harness-catalog';
|
|
20
|
+
/** Null for a person's process, else why it is not one. @implements A-SPEC-102.30 — the act's root is required. */
|
|
21
|
+
export type OperatorProbe = (root: ActRoot | readonly string[]) => string | null;
|
|
22
|
+
export declare function agentProcessReason(env: NodeJS.ProcessEnv, catalog: HarnessCatalog, ancestry: (catalog: HarnessCatalog) => HarnessAncestry): string | null;
|
|
12
23
|
/** Test seam only: code that can call this can call grantRequest itself, so it adds no authority. */
|
|
13
24
|
export declare function setOperatorProbeForTests(next: OperatorProbe | null): void;
|
|
14
|
-
|
|
25
|
+
/**
|
|
26
|
+
* `root` is the project the act works on (actRoot: its `--target`, else the working directory's project), the projects
|
|
27
|
+
* an act covers (autonomy full's union), or a rootless act named so (A-SPEC-102.30).
|
|
28
|
+
*/
|
|
29
|
+
export declare function operatorActGuard(act: string, root: ActRoot | readonly string[]): string | null;
|
|
30
|
+
/**
|
|
31
|
+
* @implements A-SPEC-102.32 — the guard's refusal with its harness apart from its text: lock recover parsed the sentence,
|
|
32
|
+
* and a path holding "agent harness (FAKE). " was shown as the cause (A, low 7). `harness` is present only when the
|
|
33
|
+
* refusal is about one.
|
|
34
|
+
*/
|
|
35
|
+
export declare function operatorActVerdict(act: string, root: ActRoot | readonly string[]): {
|
|
36
|
+
text: string;
|
|
37
|
+
harness?: string;
|
|
38
|
+
} | null;
|
|
@@ -3,42 +3,88 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.agentProcessReason = agentProcessReason;
|
|
4
4
|
exports.setOperatorProbeForTests = setOperatorProbeForTests;
|
|
5
5
|
exports.operatorActGuard = operatorActGuard;
|
|
6
|
-
|
|
6
|
+
exports.operatorActVerdict = operatorActVerdict;
|
|
7
|
+
// @implements A-SPEC-794.37, A-SPEC-779.4, A-SPEC-779.6, A-SPEC-792.1, A-SPEC-732.2, A-SPEC-732.4, A-SPEC-102.28, A-SPEC-102.29, A-SPEC-102.30, A-SPEC-102.31, A-SPEC-102.32
|
|
7
8
|
/**
|
|
8
9
|
* Who may grant. The refusal text prints the very command that approves it, so a model following that text from its
|
|
9
10
|
* own shell approved itself (measured on 0.36.1). A granting act here refuses a process that an agent harness started:
|
|
10
11
|
* its environment marker (A-SPEC-102.7), a harness among its parents (A-SPEC-102.8), or parents that cannot be read.
|
|
11
12
|
* A person's terminal and a CI operator without a TTY are unchanged. Named residual: a script that loads these modules
|
|
12
13
|
* and calls `grantRequest` itself, or a process reparented away with its markers removed, is the same user.
|
|
14
|
+
* @implements A-SPEC-245.20 — the parents are read with the system's ps (never one on PATH), and a chain longer than the
|
|
15
|
+
* walk refuses. Named residual too: a command run through a daemon or a multiplexer the operator started (a new window
|
|
16
|
+
* in the owner's tmux server, code inside a launchd service the agent restarted) carries neither the marker nor the
|
|
17
|
+
* ancestry; on Windows powershell.exe is still found on PATH.
|
|
18
|
+
* @implements A-SPEC-245.22 (item 2) — and, named plainly: this boundary stops an agent that does not both empty its
|
|
19
|
+
* environment and reparent: an unmarked, reparented process is not told apart from the owner's own launchd job. A loop, a self-parent and a failed
|
|
20
|
+
* ps refuse.
|
|
21
|
+
* @implements A-SPEC-245.23 (item 6) — two more, named: a POSIX row has no creation time, so a reused pid can lead the
|
|
22
|
+
* walk into another process's chain (its parent must have exited first: the reparenting limit); on Windows a parent
|
|
23
|
+
* created after its child ends the walk as a person's (A-SPEC-779.6).
|
|
13
24
|
*/
|
|
14
25
|
const verdicts_1 = require("../review/verdicts");
|
|
15
|
-
const
|
|
26
|
+
const harness_catalog_1 = require("../governance/harness-catalog");
|
|
16
27
|
/** A-SPEC-779.6 — the reason prefix of an unreadable ancestry; the guard's remediation keys on it. */
|
|
17
28
|
const UNREADABLE = 'the parent processes cannot be read';
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
// @implements A-SPEC-102.28 — an addition named by the file that added it, so a person locked out by it can find it
|
|
30
|
+
// @implements A-SPEC-102.29 — the catalog is the caller's, resolved once for the marker and the walk
|
|
31
|
+
function agentProcessReason(env, catalog, ancestry) {
|
|
32
|
+
const marker = (0, verdicts_1.agentHarnessMarker)(env, catalog);
|
|
20
33
|
if (marker !== null)
|
|
21
|
-
return marker;
|
|
22
|
-
const walk = ancestry();
|
|
34
|
+
return (0, harness_catalog_1.withSource)(marker, (0, harness_catalog_1.markerSource)(marker, catalog));
|
|
35
|
+
const walk = ancestry(catalog);
|
|
23
36
|
if (walk.kind === 'harness')
|
|
24
|
-
return `process:${walk.harness}`;
|
|
37
|
+
return `process:${(0, harness_catalog_1.withSource)(walk.harness, walk.sources)}`;
|
|
25
38
|
if (walk.kind === 'unreadable')
|
|
26
39
|
return `${UNREADABLE} (${walk.reason})`;
|
|
27
40
|
return null;
|
|
28
41
|
}
|
|
29
|
-
|
|
42
|
+
// @implements A-SPEC-732.2 — the operator walk counts any claude version path (operatorAncestry's layout rule)
|
|
43
|
+
// @implements A-SPEC-732.4 — and its lookup is given that same rule (operatorAncestry's default lookup)
|
|
44
|
+
// @implements A-SPEC-102.29 — the catalog of the act's own project root (never the working directory: `cd /tmp` stepped
|
|
45
|
+
// around a project's additions), resolved once
|
|
46
|
+
// @implements A-SPEC-102.30 — a given root that cannot be resolved refuses, naming the path and the error (it dropped
|
|
47
|
+
// the project's additions silently)
|
|
48
|
+
const liveProbe = (root) => {
|
|
49
|
+
let catalog;
|
|
50
|
+
try {
|
|
51
|
+
catalog = (0, harness_catalog_1.liveHarnessCatalog)(root);
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
if (e instanceof harness_catalog_1.CatalogRootError)
|
|
55
|
+
return e.message;
|
|
56
|
+
throw e;
|
|
57
|
+
}
|
|
58
|
+
return agentProcessReason(process.env, catalog, (c) => (0, verdicts_1.operatorAncestry)(process.ppid, c));
|
|
59
|
+
};
|
|
30
60
|
let probe = liveProbe;
|
|
31
61
|
/** Test seam only: code that can call this can call grantRequest itself, so it adds no authority. */
|
|
32
62
|
function setOperatorProbeForTests(next) { probe = next ?? liveProbe; }
|
|
33
|
-
|
|
34
|
-
|
|
63
|
+
/**
|
|
64
|
+
* `root` is the project the act works on (actRoot: its `--target`, else the working directory's project), the projects
|
|
65
|
+
* an act covers (autonomy full's union), or a rootless act named so (A-SPEC-102.30).
|
|
66
|
+
*/
|
|
67
|
+
function operatorActGuard(act, root) {
|
|
68
|
+
return operatorActVerdict(act, root)?.text ?? null;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @implements A-SPEC-102.32 — the guard's refusal with its harness apart from its text: lock recover parsed the sentence,
|
|
72
|
+
* and a path holding "agent harness (FAKE). " was shown as the cause (A, low 7). `harness` is present only when the
|
|
73
|
+
* refusal is about one.
|
|
74
|
+
*/
|
|
75
|
+
function operatorActVerdict(act, root) {
|
|
76
|
+
const why = probe(root);
|
|
35
77
|
if (why === null)
|
|
36
78
|
return null;
|
|
79
|
+
// @implements A-SPEC-102.31 (low 8) — a project that cannot be resolved is no agent harness: a person's terminal was told
|
|
80
|
+
// it ran under one and sent to the approval dialog. Its own sentence and its own remedy (doctor's)
|
|
81
|
+
if (why.startsWith(harness_catalog_1.CATALOG_ROOT_FAILURE))
|
|
82
|
+
return { text: `${act} is refused — ${why}. ${harness_catalog_1.CATALOG_ROOT_FIX}` };
|
|
37
83
|
// A-SPEC-779.6: on Windows the refused terminal was the person's own (measured) — do not send them back to it.
|
|
38
84
|
const remedy = why.startsWith(UNREADABLE)
|
|
39
85
|
? 'The operator decides in the session\'s approval dialog (approval_ask) — this process\'s parents could not be read, '
|
|
40
86
|
+ 'so it cannot be told apart from an agent\'s.'
|
|
41
87
|
// @implements A-SPEC-792.1 — the dialog only; a typed command is not offered.
|
|
42
88
|
: 'The operator decides in the session\'s approval dialog (approval_ask).';
|
|
43
|
-
return `${act} is the operator's — this process runs under an agent harness (${why}). ${remedy}
|
|
89
|
+
return { text: `${act} is the operator's — this process runs under an agent harness (${why}). ${remedy}`, harness: why };
|
|
44
90
|
}
|
|
@@ -18,7 +18,12 @@ interface Row {
|
|
|
18
18
|
}
|
|
19
19
|
export declare const REFUSAL_CODES: readonly Row[];
|
|
20
20
|
export declare function refusalCode(reason: string): RefusalCode;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
/**
|
|
22
|
+
* @implements A-SPEC-245.23 (item 3) — the row for a code the deny site named; text matching is only the fallback for a
|
|
23
|
+
* deny that names none, because a reason can quote agent-chosen text (a path, a tool's output) that matches another row.
|
|
24
|
+
*/
|
|
25
|
+
export declare function refusalFor(reason: string, code?: string): RefusalCode;
|
|
26
|
+
export declare function refusalLine(reason: string, code?: string): string;
|
|
27
|
+
/** The deny reason with its refusal line appended once; `code` is the deny site's own, when it named one. */
|
|
28
|
+
export declare function withRefusalLine(reason: string | undefined, code?: string): string;
|
|
24
29
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// @implements A-SPEC-777, A-SPEC-778, A-SPEC-779, A-SPEC-780, A-SPEC-781.1, A-SPEC-778.2, A-SPEC-790.3, A-SPEC-476.4, A-SPEC-792.1, A-SPEC-792.8, A-SPEC-792.9
|
|
2
|
+
// @implements A-SPEC-794.57, A-SPEC-777, A-SPEC-778, A-SPEC-779, A-SPEC-780, A-SPEC-781.1, A-SPEC-778.2, A-SPEC-790.3, A-SPEC-476.4, A-SPEC-792.1, A-SPEC-792.8, A-SPEC-792.9, A-SPEC-794.42, A-SPEC-794.43, A-SPEC-794.45, A-SPEC-794.50
|
|
3
3
|
/**
|
|
4
4
|
* @implements A-SPEC-777 — a refusal's kind, readable by a program. An orchestrator retries a `retryable` refusal,
|
|
5
5
|
* pauses for a person on `needs_hitl`, and changes its plan on `permanent`. The prose stays for people; the line
|
|
@@ -8,12 +8,19 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.REFUSAL_CODES = exports.REFUSAL_LINE_PREFIX = void 0;
|
|
10
10
|
exports.refusalCode = refusalCode;
|
|
11
|
+
exports.refusalFor = refusalFor;
|
|
11
12
|
exports.refusalLine = refusalLine;
|
|
12
13
|
exports.withRefusalLine = withRefusalLine;
|
|
13
14
|
exports.REFUSAL_LINE_PREFIX = '[holmes-refusal] ';
|
|
14
15
|
// First match wins. Patterns name the refusal's own words; a new refusal that none of them names fails the census in
|
|
15
16
|
// refusal-codes.test.ts.
|
|
16
17
|
exports.REFUSAL_CODES = [
|
|
18
|
+
{
|
|
19
|
+
// @implements A-SPEC-245.4 — another act holds the grant this one needs; nothing was spent, so a retry is safe.
|
|
20
|
+
code: 'grant.in-use', class: 'retryable',
|
|
21
|
+
remediation: ['retry the act once; the other act settles its claim in moments', 'if it repeats, ask for a new approval with approval_ask'],
|
|
22
|
+
test: /approval grant [^\n]*is in use by another act/i,
|
|
23
|
+
},
|
|
17
24
|
{
|
|
18
25
|
// @implements A-SPEC-779 — a run waiting for the operator's decision: retry after it, never around it.
|
|
19
26
|
code: 'run.awaiting-approval', class: 'retryable',
|
|
@@ -28,12 +35,27 @@ exports.REFUSAL_CODES = [
|
|
|
28
35
|
test: /this run stopped|this run is now stopped|this run stalled|was not decided within|the Holmes install changed since run start/i, // A-SPEC-778.1/778.2: stalled
|
|
29
36
|
},
|
|
30
37
|
{
|
|
31
|
-
// @implements A-SPEC-792.8 — under a full profile nothing was filed
|
|
32
|
-
// would send an orchestrator to approval_ask or to the operator.
|
|
38
|
+
// @implements A-SPEC-792.8, A-SPEC-794.50 — under a full profile nothing was filed, so nothing waits on a decision; ahead
|
|
39
|
+
// of every row that would send an orchestrator to approval_ask or to the operator.
|
|
33
40
|
code: 'full-autonomy.refused', class: 'permanent',
|
|
34
|
-
remediation: ['
|
|
41
|
+
remediation: ['nothing was filed, so there is no request to decide — do not call approval_ask', 'follow the route the refusal names, or change the plan'],
|
|
35
42
|
test: /full autonomy: [^\n]*no approval request was filed/i,
|
|
36
43
|
},
|
|
44
|
+
{
|
|
45
|
+
// @implements A-SPEC-245.21 — holmes-kit lock recover is the operator's act: no grant opens it (the CLI refuses it
|
|
46
|
+
// from a session, A-SPEC-245.19), so the plan changes. The 245.19 advisory names the same act and is never a deny.
|
|
47
|
+
code: 'operator-act.refused', class: 'permanent',
|
|
48
|
+
// A-SPEC-792.1 — no typed command reaches the agent: the act is named, not spelled
|
|
49
|
+
remediation: ['do not run this from the session — approval_ask cannot grant it', 'tell the person: recovering the spend lock is their act, outside any agent session'],
|
|
50
|
+
test: /holmes-kit lock recover retires a lock|this command names holmes-kit lock recover/i,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
// @implements A-SPEC-245.24 (item 1) — the pre-edit impact evidence gate under `block`: the analysis that backs an
|
|
54
|
+
// edit is missing or does not cover it, so the plan changes (analyse, then edit), not the timing
|
|
55
|
+
code: 'evidence.missing', class: 'permanent',
|
|
56
|
+
remediation: ['run maintenance_analyze({ root, request, persist: true }) for this change, then edit'],
|
|
57
|
+
test: /pre-edit impact evidence — edit denied/i,
|
|
58
|
+
},
|
|
37
59
|
{
|
|
38
60
|
code: 'gate.unjudgeable', class: 'retryable',
|
|
39
61
|
remediation: ['split the command or edit into smaller parts', 'retry; if it repeats, ask the operator'],
|
|
@@ -138,21 +160,53 @@ exports.REFUSAL_CODES = [
|
|
|
138
160
|
const UNCLASSIFIED = {
|
|
139
161
|
code: 'gate.unclassified', class: 'needs_hitl', remediation: ['read the refusal; ask the operator if unsure'],
|
|
140
162
|
};
|
|
163
|
+
/**
|
|
164
|
+
* @implements A-SPEC-794.42 — the first step the reason names, ahead of the row's own: the code, the class and the approval
|
|
165
|
+
* route stay. Read from the words, as the fallback row match is; the worst outcome is one extra line on a refusal that stands.
|
|
166
|
+
*/
|
|
167
|
+
function withFirstStep(row, reason) {
|
|
168
|
+
// @implements A-SPEC-794.43 — only an approval refusal: under a full profile nothing asks for one. Leaving the store
|
|
169
|
+
// comes first, since a command run there may hold no mention to remove.
|
|
170
|
+
if (row.code !== 'approval.required')
|
|
171
|
+
return row;
|
|
172
|
+
// A-SPEC-794.57 — a spec staging is a request for a person: its prose leads with approval_ask, and so does this
|
|
173
|
+
if (/staging spec files is a person's decision/.test(reason))
|
|
174
|
+
return row;
|
|
175
|
+
// A-SPEC-794.45 — from a worktree under the store that `cd` would send the agent out of its worktree to the main checkout
|
|
176
|
+
const leave = /working directory \(\.ax[\\/]worktrees\b/.test(reason) ? null : /run `cd [^`]+` on its own first/.exec(reason);
|
|
177
|
+
const first = leave ? `${leave[0]}, then retry the command`
|
|
178
|
+
: /judged whole/.test(reason) ? 'remove the .ax mention, or split the command into separate calls, and retry; ask for an approval only if the command really writes there'
|
|
179
|
+
: /only mentions the path/.test(reason) ? 'if the command only mentions the path, leave the mention out and retry; ask for an approval only if it really writes there'
|
|
180
|
+
: null;
|
|
181
|
+
return first === null ? row : { ...row, remediation: [first, ...row.remediation] };
|
|
182
|
+
}
|
|
141
183
|
function refusalCode(reason) {
|
|
142
184
|
for (const r of exports.REFUSAL_CODES) {
|
|
143
185
|
if (r.test.test(reason))
|
|
144
|
-
return { code: r.code, class: r.class, remediation: [...r.remediation] };
|
|
186
|
+
return withFirstStep({ code: r.code, class: r.class, remediation: [...r.remediation] }, reason);
|
|
145
187
|
}
|
|
146
188
|
return { ...UNCLASSIFIED, remediation: [...UNCLASSIFIED.remediation] };
|
|
147
189
|
}
|
|
148
|
-
|
|
149
|
-
|
|
190
|
+
/**
|
|
191
|
+
* @implements A-SPEC-245.23 (item 3) — the row for a code the deny site named; text matching is only the fallback for a
|
|
192
|
+
* deny that names none, because a reason can quote agent-chosen text (a path, a tool's output) that matches another row.
|
|
193
|
+
*/
|
|
194
|
+
function refusalFor(reason, code) {
|
|
195
|
+
if (code === undefined)
|
|
196
|
+
return refusalCode(reason);
|
|
197
|
+
const row = exports.REFUSAL_CODES.find((r) => r.code === code);
|
|
198
|
+
// @implements A-SPEC-245.25 (item 1) — a named code that is not registered is unclassified, never matched by text:
|
|
199
|
+
// the site meant to name its kind, and the reason's words are not the gate's to trust
|
|
200
|
+
return row ? withFirstStep({ code: row.code, class: row.class, remediation: [...row.remediation] }, reason) : { ...UNCLASSIFIED, remediation: [...UNCLASSIFIED.remediation] };
|
|
201
|
+
}
|
|
202
|
+
function refusalLine(reason, code) {
|
|
203
|
+
return exports.REFUSAL_LINE_PREFIX + JSON.stringify(refusalFor(reason, code));
|
|
150
204
|
}
|
|
151
|
-
/** The deny reason with its refusal line appended once. */
|
|
152
|
-
function withRefusalLine(reason) {
|
|
205
|
+
/** The deny reason with its refusal line appended once; `code` is the deny site's own, when it named one. */
|
|
206
|
+
function withRefusalLine(reason, code) {
|
|
153
207
|
const text = reason ?? '';
|
|
154
208
|
const last = text.split('\n').pop() ?? '';
|
|
155
209
|
if (last.startsWith(exports.REFUSAL_LINE_PREFIX))
|
|
156
210
|
return text;
|
|
157
|
-
return text === '' ? refusalLine(text) : `${text}\n${refusalLine(text)}`;
|
|
211
|
+
return text === '' ? refusalLine(text, code) : `${text}\n${refusalLine(text, code)}`;
|
|
158
212
|
}
|
|
@@ -33,23 +33,23 @@ export declare function plainShellText(cmd: string): boolean;
|
|
|
33
33
|
* hide behind a pipe (`cat SPEC | tee OTHER`).
|
|
34
34
|
*/
|
|
35
35
|
export declare function splitShellClauses(cmd: string): string[];
|
|
36
|
+
/**
|
|
37
|
+
* @implements A-SPEC-747 — split at `||`, `&&`, `;`, `|` and newline outside single quotes, double quotes, a backslash
|
|
38
|
+
* escape, `$(…)`, `<(…)`, `>(…)` and backticks. `null` when a quote or substitution is left open.
|
|
39
|
+
*/
|
|
40
|
+
export declare function splitUnquoted(cmd: string, atPipe?: boolean): string[] | null;
|
|
36
41
|
/**
|
|
37
42
|
* @implements A-SPEC-728.2 — the classifier's own read judgement of a whole shell text, loops included, for the identity
|
|
38
43
|
* layer: a `for` loop whose body only reads its variable's files names no mutation target with its word list.
|
|
39
44
|
*/
|
|
40
45
|
export declare function shellTextOnlyReads(text: string): boolean;
|
|
41
46
|
export declare function stripCommitMessages(cmd: string): string;
|
|
47
|
+
export declare function classifyReversibility(action: RiskAction): AxisVerdict;
|
|
42
48
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* unknown kinds and ambiguous (tracked===undefined) states never resolve to 'auto'.
|
|
46
|
-
*/
|
|
47
|
-
/**
|
|
48
|
-
* @implements A-SPEC-728 (round 24) — the command is judged as written AND as the shell joins it (quote removal of plain
|
|
49
|
-
* words, an `eval`/`-c` program's escaped words): `r''m -rf /usr/local`, `r\m -rf .git`, `g''it reset --hard` were allowed
|
|
50
|
-
* while their plain forms were denied (measured). The stricter verdict stands.
|
|
49
|
+
* The execution-surface key a `git config` in this command writes, `'--edit'` for an edit, or null. Every segment is
|
|
50
|
+
* read; leading git options (`-C <dir>`, `-c <k=v>`, `--git-dir=…`) are skipped; `git config set|unset|edit` count too.
|
|
51
51
|
*/
|
|
52
|
-
export declare function
|
|
52
|
+
export declare function gitConfigExecWrite(command: string): string | null;
|
|
53
53
|
/**
|
|
54
54
|
* @implements A-SPEC-125.1
|
|
55
55
|
* Architecture axis: does this action reverse a previously accepted architectural decision?
|
|
@@ -73,3 +73,9 @@ export declare function classifyBlastRadius(action: RiskAction, cfg?: RiskThresh
|
|
|
73
73
|
* Pure function: no I/O, no clocks, no randomness — same input always yields the same output.
|
|
74
74
|
*/
|
|
75
75
|
export declare function assessRisk(action: RiskAction, cfg?: RiskThresholds): RiskAssessment;
|
|
76
|
+
/**
|
|
77
|
+
* @implements A-SPEC-794.49, A-SPEC-794.50 — the outward acts a clause of this command runs, read with the readers above.
|
|
78
|
+
* A comment or a here-document body is no clause, a control or grouping word is not the command, and a form with no
|
|
79
|
+
* outward effect is no act. A runner's inner program, a substitution and a package script are not read.
|
|
80
|
+
*/
|
|
81
|
+
export declare function outwardActsOf(command: string): Array<'push' | 'publish'>;
|