@event4u/agent-config 14.6.0 → 14.8.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/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +255 -145
- package/README.md +1 -1
- package/dist/agent-src/commands/analyze/inbox.md +264 -10
- package/dist/agent-src/commands/analyze.md +1 -1
- package/dist/agent-src/commands/evals/git-pr-merge.json +13 -0
- package/dist/agent-src/commands/evals/roadmap.json +17 -1
- package/dist/agent-src/commands/pr/create.md +14 -2
- package/dist/agent-src/commands/pr/merge.md +379 -0
- package/dist/agent-src/commands/roadmap/process-full.md +272 -32
- package/dist/agent-src/commands/roadmap.md +1 -1
- package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +46 -36
- package/dist/agent-src/contexts/execution/autonomy-mechanics.md +37 -2
- package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +95 -2
- package/dist/agent-src/contexts/execution/roadmap-process-loop.md +289 -106
- package/dist/agent-src/rules/artifact-drafting-protocol.md +5 -1
- package/dist/agent-src/rules/context-hygiene.md +2 -0
- package/dist/agent-src/rules/decision-revisit-gate.md +67 -32
- package/dist/agent-src/rules/fix-what-you-see.md +108 -0
- package/dist/agent-src/rules/no-roadmap-references.md +0 -5
- package/dist/agent-src/rules/recurring-criticism.md +110 -0
- package/dist/agent-src/rules/roadmap-progress-sync.md +20 -1
- package/dist/agent-src/rules/rule-type-governance.md +0 -2
- package/dist/agent-src/rules/self-repair-loop.md +17 -0
- package/dist/agent-src/rules/skill-quality.md +0 -2
- package/dist/agent-src/rules/source-confidentiality.md +37 -7
- package/dist/agent-src/scripts/archival_sweep.ts +117 -0
- package/dist/agent-src/scripts/archive_completed_roadmaps.ts +26 -7
- package/dist/agent-src/scripts/dashboard_mode.ts +212 -0
- package/dist/agent-src/scripts/gate_budget.ts +282 -0
- package/dist/agent-src/scripts/gate_execute.ts +72 -31
- package/dist/agent-src/scripts/roadmap_gates.ts +74 -3
- package/dist/agent-src/scripts/update_roadmap_progress.ts +296 -53
- package/dist/agent-src/skills/adr-create/SKILL.md +124 -5
- package/dist/agent-src/skills/ai-council/SKILL.md +48 -807
- package/dist/agent-src/skills/ai-council/references/advanced-modes.md +320 -0
- package/dist/agent-src/skills/ai-council/references/cost-and-redaction.md +99 -0
- package/dist/agent-src/skills/ai-council/references/execution-modes.md +162 -0
- package/dist/agent-src/skills/ai-council/references/output-and-synthesis.md +125 -0
- package/dist/agent-src/skills/ai-council/references/procedure.md +143 -0
- package/dist/agent-src/skills/decision-record/SKILL.md +61 -3
- package/dist/agent-src/skills/decision-review/SKILL.md +65 -0
- package/dist/agent-src/skills/merge-conflicts/SKILL.md +26 -0
- package/dist/agent-src/skills/quality-tools/SKILL.md +34 -326
- package/dist/agent-src/skills/quality-tools/references/js-ts-tools.md +113 -0
- package/dist/agent-src/skills/quality-tools/references/php-tools.md +222 -0
- package/dist/agent-src/skills/roadmap-management/SKILL.md +15 -409
- package/dist/agent-src/skills/roadmap-management/references/archival.md +226 -0
- package/dist/agent-src/skills/roadmap-management/references/authoring.md +107 -0
- package/dist/agent-src/skills/roadmap-management/references/dashboard.md +47 -0
- package/dist/agent-src/skills/roadmap-management/references/lifecycle.md +58 -0
- package/dist/agent-src/skills/security/SKILL.md +8 -0
- package/dist/agent-src/skills/security-audit/SKILL.md +12 -1
- package/dist/agent-src/skills/skill-writing/SKILL.md +34 -570
- package/dist/agent-src/skills/skill-writing/references/procedure.md +275 -0
- package/dist/agent-src/skills/skill-writing/references/read-only-scripts.md +18 -0
- package/dist/agent-src/skills/skill-writing/references/section-patterns.md +298 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +65 -4
- package/dist/agent-src/templates/scripts/telemetry/flush_sender.mjs +163 -0
- package/dist/agent-src/templates/scripts/telemetry/remote.ts +160 -7
- package/dist/agent-src/templates/scripts/telemetry/transport.ts +169 -0
- package/dist/cli/registry.js +2 -1
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/chunk-2GNWGMAL.js +172 -0
- package/dist/cli-delegate/{chunk-P6LQDIWK.js → chunk-7PRE6ZV2.js} +338 -0
- package/dist/cli-delegate/{chunk-BKO2AZ7Z.js → chunk-B2ERU2VA.js} +1 -1
- package/dist/cli-delegate/chunk-E4XIZDIB.js +402 -0
- package/dist/cli-delegate/{chunk-3UCJWMMP.js → chunk-EEJUMCDZ.js} +16 -16
- package/dist/cli-delegate/{chunk-NXFWFAYV.js → chunk-G23AT6GD.js} +1 -0
- package/dist/cli-delegate/{chunk-XURJ4AQC.js → chunk-H4VIVD4C.js} +385 -284
- package/dist/cli-delegate/chunk-I3EIN2YG.js +36 -0
- package/dist/cli-delegate/{chunk-RLN73PR5.js → chunk-LPPWO5CE.js} +12 -8
- package/dist/cli-delegate/chunk-MWRD5YOH.js +100 -0
- package/dist/cli-delegate/{chunk-UEZ7D35A.js → chunk-N7CDDGI3.js} +4 -23
- package/dist/cli-delegate/{chunk-63WSP6YZ.js → chunk-PMEKGDED.js} +74 -167
- package/dist/cli-delegate/{chunk-GRRPEPRN.js → chunk-T7L2QK3K.js} +24 -5
- package/dist/cli-delegate/{chunk-EVTY7ISR.js → chunk-YM4GZDJG.js} +9 -1
- package/dist/cli-delegate/cmd_adr_effective.js +1162 -0
- package/dist/cli-delegate/cmd_conformance.js +466 -716
- package/dist/cli-delegate/cmd_converge.js +3 -3
- package/dist/cli-delegate/cmd_doctor.js +10 -10
- package/dist/cli-delegate/cmd_explain.js +1 -1
- package/dist/cli-delegate/cmd_export.js +10 -9
- package/dist/cli-delegate/cmd_handoff.js +10 -9
- package/dist/cli-delegate/cmd_memory_get.js +2 -1
- package/dist/cli-delegate/cmd_migrate.js +2 -2
- package/dist/cli-delegate/cmd_packs_active.js +1 -1
- package/dist/cli-delegate/cmd_preflight.js +5 -5
- package/dist/cli-delegate/cmd_prune.js +11 -10
- package/dist/cli-delegate/cmd_route_audit.js +6 -5
- package/dist/cli-delegate/cmd_route_explain.js +3 -3
- package/dist/cli-delegate/cmd_session_recycle.js +840 -30
- package/dist/cli-delegate/cmd_settings_get.js +3 -3
- package/dist/cli-delegate/cmd_settings_migrate.js +10 -9
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +11 -10
- package/dist/cli-delegate/cmd_uninstall.js +13 -11
- package/dist/cli-delegate/cmd_update.js +4 -4
- package/dist/cli-delegate/cmd_upgrade.js +4 -4
- package/dist/cli-delegate/cmd_validate.js +11 -10
- package/dist/cli-delegate/cmd_versions.js +3 -3
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +111 -37
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +5 -5
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +15 -12
- package/dist/discovery/trust-report.md +3 -3
- package/dist/discovery/workspaces.json +11 -8
- package/dist/hooks/dispatch.js +3165 -2192
- package/dist/install/claudePathsPlan.js +187 -0
- package/dist/install/claudePathsPlan.js.map +1 -0
- package/dist/install/globalRuleLayers.js +169 -0
- package/dist/install/globalRuleLayers.js.map +1 -0
- package/dist/install/hostLayerFingerprint.js +136 -0
- package/dist/install/hostLayerFingerprint.js.map +1 -0
- package/dist/install/install.mjs +553 -425
- package/dist/install/partitionEligibility.js +432 -0
- package/dist/install/partitionEligibility.js.map +1 -0
- package/dist/install/ruleLayerPartition.js +157 -0
- package/dist/install/ruleLayerPartition.js.map +1 -0
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +1863 -1234
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/agent_src.js +41 -0
- package/dist/scripts/_lib/agent_src.js.map +1 -1
- package/dist/scripts/_lib/install_layout.js +83 -0
- package/dist/scripts/_lib/install_layout.js.map +1 -0
- package/dist/scripts/_lib/installed_lock.js +444 -0
- package/dist/scripts/_lib/installed_lock.js.map +1 -0
- package/dist/scripts/_lib/prune_empty_dirs.js +85 -0
- package/dist/scripts/_lib/prune_empty_dirs.js.map +1 -0
- package/dist/scripts/condense.js +63 -251
- package/dist/scripts/condense.js.map +1 -1
- package/dist/server/schemas/settings.js +4 -0
- package/dist/server/schemas/settings.js.map +1 -1
- package/docs/contracts/settings-classes.md +12 -6
- package/docs/guidelines/agent-infra/agent-interaction-and-decision-quality.md +8 -3
- package/docs/guidelines/agent-infra/artifact-drafting-protocol-mechanics.md +45 -1
- package/docs/guidelines/agent-infra/context-hygiene-mechanics.md +26 -0
- package/docs/guidelines/agent-infra/false-green.md +47 -1
- package/docs/guidelines/agent-infra/memory-access.md +17 -0
- package/docs/guidelines/agent-infra/recurring-criticism-mechanics.md +96 -0
- package/package.json +1 -1
- package/src/agent-src/scripts/archival_sweep.ts +117 -0
- package/src/agent-src/scripts/archive_completed_roadmaps.ts +26 -7
- package/src/agent-src/scripts/dashboard_mode.ts +212 -0
- package/src/agent-src/scripts/gate_budget.ts +282 -0
- package/src/agent-src/scripts/gate_execute.ts +72 -31
- package/src/agent-src/scripts/roadmap_gates.ts +74 -3
- package/src/agent-src/scripts/update_roadmap_progress.ts +296 -53
- package/src/agent-src/templates/scripts/telemetry/flush_sender.mjs +163 -0
- package/src/agent-src/templates/scripts/telemetry/remote.ts +160 -7
- package/src/agent-src/templates/scripts/telemetry/transport.ts +169 -0
- package/src/config/agent-settings.template.yml +27 -2
- package/src/config/ci-local-parity.yml +39 -0
- package/src/config/estate-count-budget.json +612 -3
- package/src/config/evaluator-budgets.json +3 -3
- package/src/config/gate-coverage.yml +220 -12
- package/src/config/gate-violation-baselines.json +73 -63
- package/src/config/gitignore-block.txt +15 -2
- package/src/config/hook-latency-budget.json +5 -0
- package/src/config/rule-activation-census.json +14 -6
- package/src/config/rule-stub-ceilings.json +34 -7
- package/src/install/claudePathsPlan.ts +196 -0
- package/src/install/globalRuleLayers.ts +197 -0
- package/src/install/hostLayerFingerprint.ts +145 -0
- package/src/install/partitionEligibility.ts +502 -0
- package/src/install/ruleLayerPartition.ts +212 -0
- package/src/scripts/_cli/cmd_adr_effective.ts +484 -0
- package/src/scripts/_cli/cmd_session_recycle.ts +9 -1
- package/src/scripts/_dispatch.bash +17 -1
- package/src/scripts/_lib/ac_heading.ts +30 -0
- package/src/scripts/_lib/adr_frontmatter.test.ts +365 -0
- package/src/scripts/_lib/adr_frontmatter.ts +459 -0
- package/src/scripts/_lib/agent_src.ts +42 -0
- package/src/scripts/_lib/bench_ab_pinned_repo.ts +162 -0
- package/src/scripts/_lib/bench_ab_workspace.ts +10 -1
- package/src/scripts/_lib/envelope_grounding.ts +49 -9
- package/src/scripts/_lib/installed_lock.ts +50 -5
- package/src/scripts/_lib/layer_overlap_notice.ts +11 -2
- package/src/scripts/_lib/md_section.ts +129 -0
- package/src/scripts/_lib/prune_empty_dirs.ts +80 -0
- package/src/scripts/_lib/scope_guard.sh +26 -3
- package/src/scripts/_lib/self_repair.ts +19 -0
- package/src/scripts/_lib/self_repair_class_b.ts +171 -0
- package/src/scripts/adr/evidence_census.ts +899 -0
- package/src/scripts/adr/regenerate_index.ts +12 -32
- package/src/scripts/adr_cite_check.ts +540 -39
- package/src/scripts/ai_council/cli_help.ts +55 -0
- package/src/scripts/audit_adr_coverage.ts +103 -17
- package/src/scripts/before_complete_hook.ts +153 -28
- package/src/scripts/bench_ab_v2_complexity.ts +27 -7
- package/src/scripts/bench_hook_latency.ts +204 -0
- package/src/scripts/build_archive_index.ts +34 -0
- package/src/scripts/check_adr_frontmatter.ts +574 -39
- package/src/scripts/check_hook_bundle_content.ts +219 -0
- package/src/scripts/check_new_adr_evidence.ts +529 -0
- package/src/scripts/check_references.ts +78 -0
- package/src/scripts/check_release_published.ts +32 -11
- package/src/scripts/check_rule_layer_partition.ts +531 -0
- package/src/scripts/check_single_delivery.ts +194 -17
- package/src/scripts/check_standing_rule_delivery.ts +8 -2
- package/src/scripts/ci_settle.ts +170 -0
- package/src/scripts/condense.ts +79 -259
- package/src/scripts/council_cli.ts +3 -3
- package/src/scripts/dispatch_r2_reviewer.ts +6 -14
- package/src/scripts/external_sources_denylist.json +4 -1
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +77 -14
- package/src/scripts/hooks/block_no_verify.ts +61 -10
- package/src/scripts/hooks/block_unauthorized_git.ts +21 -1
- package/src/scripts/hooks/concern_registry.ts +4 -0
- package/src/scripts/hooks/dispatch_hook.ts +154 -187
- package/src/scripts/hooks/dispatch_issues.ts +38 -19
- package/src/scripts/hooks/fallback_yaml.ts +66 -0
- package/src/scripts/hooks/host_semantics.ts +21 -0
- package/src/scripts/hooks/injection_budget.ts +13 -3
- package/src/scripts/hooks/py_json_dumps.ts +103 -0
- package/src/scripts/hooks/rtk_wrap_hook.ts +8 -3
- package/src/scripts/hooks/run_continuation_hook.ts +8 -5
- package/src/scripts/hooks/ship_diff_volume_hook.ts +81 -15
- package/src/scripts/hooks/source_first_gate_hook.ts +464 -0
- package/src/scripts/hooks/state_io.ts +870 -21
- package/src/scripts/hooks/stdin_failure_policy.ts +96 -0
- package/src/scripts/hooks/subagent_ledger_hook.ts +44 -15
- package/src/scripts/hooks/telemetry_flush_hook.ts +139 -0
- package/src/scripts/hooks/telemetry_self_repair.ts +128 -0
- package/src/scripts/hooks/telemetry_usage_hook.ts +22 -4
- package/src/scripts/hooks/turn_end_gate_hook.ts +81 -15
- package/src/scripts/injection_scan_hook.ts +137 -5
- package/src/scripts/install.ts +16 -11
- package/src/scripts/language_mirror_hook.ts +561 -25
- package/src/scripts/lint_framework_leakage_allowlist.json +2 -2
- package/src/scripts/lint_hook_manifest.ts +49 -0
- package/src/scripts/lint_plan_risk_register.ts +4 -3
- package/src/scripts/lint_provenance_vocabulary.ts +472 -4
- package/src/scripts/lint_skill_router_head.ts +4 -4
- package/src/scripts/mcp_server/tools.ts +2 -2
- package/src/scripts/new_roadmap.ts +136 -0
- package/src/scripts/pack_mcp_content.ts +20 -5
- package/src/scripts/release.ts +37 -38
- package/src/scripts/report_layer_overlap.ts +6 -0
- package/src/scripts/routing_doctor.ts +5 -1
- package/src/scripts/self_repair_hook.ts +37 -5
- package/src/scripts/session_register_hook.ts +11 -0
- package/src/scripts/skill_usage_collect.ts +11 -1
- package/src/scripts/skill_usage_report.ts +278 -8
- package/src/scripts/sync_pr_branch.ts +170 -20
- package/src/server/schemas/settings.ts +8 -0
- package/dist/cli-delegate/chunk-EJITJBJX.js +0 -172
- package/dist/cli-delegate/chunk-PZWRPRWP.js +0 -38
- package/dist/cli-delegate/{chunk-PPQO4NGR.js → chunk-6RJA2F5A.js} +3 -3
- package/dist/cli-delegate/{chunk-RYNADUFG.js → chunk-LWTYTX6F.js} +0 -0
- package/dist/cli-delegate/{chunk-FBKL6JWT.js → chunk-MMSGVZKV.js} +3 -3
|
@@ -141,10 +141,114 @@ function _enabled(root: string): boolean {
|
|
|
141
141
|
return false;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
/**
|
|
144
|
+
/**
|
|
145
|
+
* ── The output-envelope contract ─────────────────────────────────────────────
|
|
146
|
+
*
|
|
147
|
+
* `b-injection-scan-unwrap-security`, option (a), council 2026-08-20 (2/2
|
|
148
|
+
* quorum): "specify the envelope contract and its fixtures BEFORE narrowing the
|
|
149
|
+
* scanner input". This block is that contract; the fixtures are in
|
|
150
|
+
* `tests/hooks/injection_scan_output_contract.test.ts`, and they are the
|
|
151
|
+
* deliverable — the code change below is one descent and one deletion.
|
|
152
|
+
*
|
|
153
|
+
* WHAT THIS CONCERN READS, exhaustively:
|
|
154
|
+
*
|
|
155
|
+
* 1. **The tool output, and only the tool output.** `injection-scan` is bound
|
|
156
|
+
* to `post_tool_use` on every platform that carries it, so a payload
|
|
157
|
+
* reaching here is expected to hold a tool result.
|
|
158
|
+
* 2. **Where it lives.** Under a dispatcher envelope the host-shaped fields are
|
|
159
|
+
* nested under `payload` (`dispatch_hook._build_envelope`); under a bare-host
|
|
160
|
+
* or direct invocation they sit at the root. Both are supported.
|
|
161
|
+
* 3. **Which keys.** {@link OUTPUT_KEYS}, in order. The first four mirror
|
|
162
|
+
* `payload_stub.BODY_KEYS.result` — the set the dispatcher stubs, and
|
|
163
|
+
* therefore the set it knows how to serve whole. `output` and `result` are
|
|
164
|
+
* the two generic spellings this concern has accepted since it shipped and
|
|
165
|
+
* are kept: dropping them would narrow coverage on the same change that
|
|
166
|
+
* narrows the fallback, and only one of those is decided here.
|
|
167
|
+
* 4. **How a value is read.** A string is scanned verbatim. An object or array
|
|
168
|
+
* is scanned as its compact JSON serialisation — unchanged, deliberately,
|
|
169
|
+
* including the consequence that a hidden codepoint inside a nested string
|
|
170
|
+
* becomes the literal text `\u200b` and does NOT trip `_HIDDEN`. That is a
|
|
171
|
+
* detection property of the serialiser, not of this contract, and changing
|
|
172
|
+
* it is a separate question.
|
|
173
|
+
* 5. **Missing output → nothing to scan → allow.** THIS IS THE NARROWING. The
|
|
174
|
+
* previous code fell through to serialising the WHOLE envelope, so what it
|
|
175
|
+
* actually scanned in production was everything: the tool input echo, the
|
|
176
|
+
* cwd, the session id, the settings block. It worked by accident and nothing
|
|
177
|
+
* tested the accident.
|
|
178
|
+
* 6. **Malformed envelope → allow.** Non-JSON, a list, a scalar: unchanged.
|
|
179
|
+
* 7. **A stubbed result body → allow, LOUDLY.** The manifest declares
|
|
180
|
+
* `needs_payload_bodies: [input, result]`, which is what keeps the result
|
|
181
|
+
* served whole. If that declaration is ever dropped the body arrives as a
|
|
182
|
+
* `PayloadStub` and a plain read finds no string — indistinguishable from
|
|
183
|
+
* "clean output", which is a scanner that silently stops scanning. Say so on
|
|
184
|
+
* stderr instead. Same second-silent-death route `ship-diff-volume` closes.
|
|
185
|
+
*
|
|
186
|
+
* BOTH DIRECTIONS OF THE COST, stated because the narrowing is on a security
|
|
187
|
+
* surface and only one direction is an improvement:
|
|
188
|
+
*
|
|
189
|
+
* - **Removed false positives.** The old fallback could raise a hit on text
|
|
190
|
+
* that is not tool output at all — a `cwd` under a path containing an exfil
|
|
191
|
+
* signature, an injection phrase echoed in the tool INPUT the user typed.
|
|
192
|
+
* - **Accepted false-negative risk.** A host that puts its tool output under a
|
|
193
|
+
* key not in {@link OUTPUT_KEYS} is now unscanned where the fallback would
|
|
194
|
+
* have caught it. This is mitigated, not dismissed: an unrecognised payload
|
|
195
|
+
* shape emits one stderr line naming the payload's top-level KEY NAMES (never
|
|
196
|
+
* values), so a new host spelling surfaces on first contact instead of going
|
|
197
|
+
* dark. The list is one exported constant; adding a spelling is one line.
|
|
198
|
+
*
|
|
199
|
+
* The descent below is LOCAL and is deliberately NOT `envelope.ts`'s shared
|
|
200
|
+
* `unwrap`, which descends only when all four `ENVELOPE_KEYS` are present: a
|
|
201
|
+
* producer emitting a partial envelope would leave this concern reading the root
|
|
202
|
+
* again with every test still green. `ship-diff-volume`, `design-slop` and
|
|
203
|
+
* `ui-route-nudge` each carry their own descent for the same reason.
|
|
204
|
+
*/
|
|
205
|
+
export const OUTPUT_KEYS: readonly string[] = [
|
|
206
|
+
// payload_stub.BODY_KEYS.result — the spellings the dispatcher serves.
|
|
207
|
+
"tool_response",
|
|
208
|
+
"toolResponse",
|
|
209
|
+
"tool_result",
|
|
210
|
+
"toolUseResult",
|
|
211
|
+
// Generic spellings accepted since this concern shipped.
|
|
212
|
+
"output",
|
|
213
|
+
"result",
|
|
214
|
+
];
|
|
215
|
+
|
|
216
|
+
/** The dispatcher's stub marker (payload_stub.STUB_MARKER), inlined so this
|
|
217
|
+
* concern keeps its no-hard-import-dependency property in a consumer repo. */
|
|
218
|
+
const STUB_MARKER = "_agent_config_body_omitted";
|
|
219
|
+
|
|
220
|
+
function _isStub(v: unknown): boolean {
|
|
221
|
+
return _isObject(v as JsonValue) && (v as JsonObject)[STUB_MARKER] === true;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Descend to the platform payload. See the contract block above, point 2.
|
|
226
|
+
*/
|
|
227
|
+
function _payload_of(root: JsonObject): JsonObject {
|
|
228
|
+
const inner = root["payload"];
|
|
229
|
+
return _isObject(inner) ? inner : root;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* The tool-output text, per the contract above. `''` means "nothing to scan",
|
|
234
|
+
* which is a real answer and not a failure.
|
|
235
|
+
*/
|
|
145
236
|
function _tool_output(envelope: JsonObject): string {
|
|
146
|
-
|
|
147
|
-
|
|
237
|
+
const payload = _payload_of(envelope);
|
|
238
|
+
for (const key of OUTPUT_KEYS) {
|
|
239
|
+
const v = payload[key];
|
|
240
|
+
if (v === undefined || v === null) {
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
if (_isStub(v)) {
|
|
244
|
+
// Contract point 7: the declaration that serves this body was dropped.
|
|
245
|
+
process.stderr.write(
|
|
246
|
+
`injection-scan: ${key} arrived stubbed; the concern declares ` +
|
|
247
|
+
"needs_payload_bodies: [input, result] and cannot scan tool output " +
|
|
248
|
+
"without it. Nothing was scanned on this event.\n",
|
|
249
|
+
);
|
|
250
|
+
return "";
|
|
251
|
+
}
|
|
148
252
|
if (typeof v === "string") {
|
|
149
253
|
return v;
|
|
150
254
|
}
|
|
@@ -152,8 +256,36 @@ function _tool_output(envelope: JsonObject): string {
|
|
|
152
256
|
return _pyJsonDumpsCompact(v);
|
|
153
257
|
}
|
|
154
258
|
}
|
|
155
|
-
//
|
|
156
|
-
|
|
259
|
+
// Contract point 5 + the accepted false-negative risk. Key NAMES only — a
|
|
260
|
+
// value here could be tool output, which is exactly what must not be logged.
|
|
261
|
+
const names = Object.keys(payload);
|
|
262
|
+
if (names.length > 0) {
|
|
263
|
+
process.stderr.write(
|
|
264
|
+
"injection-scan: no recognised tool-output key in this payload; nothing " +
|
|
265
|
+
`scanned. Present keys: ${names.sort().join(", ")}. Expected one of: ` +
|
|
266
|
+
`${OUTPUT_KEYS.join(", ")}.\n`,
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
return "";
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* The stdin boundary: raw concern stdin → the text this concern scans.
|
|
274
|
+
*
|
|
275
|
+
* Exported so the regression drives the BOUNDARY rather than the extractor —
|
|
276
|
+
* both council seats required that, and it is what stops a hand-written fixture
|
|
277
|
+
* from drifting into agreeing with the bug. Never throws.
|
|
278
|
+
*/
|
|
279
|
+
export function toolOutputFromStdin(raw: string): string {
|
|
280
|
+
if (!raw.trim()) return "";
|
|
281
|
+
let root: unknown;
|
|
282
|
+
try {
|
|
283
|
+
root = JSON.parse(raw);
|
|
284
|
+
} catch {
|
|
285
|
+
return "";
|
|
286
|
+
}
|
|
287
|
+
if (!_isObject(root as JsonValue)) return "";
|
|
288
|
+
return _tool_output(root as JsonObject);
|
|
157
289
|
}
|
|
158
290
|
|
|
159
291
|
function _scan(text: string): string[] {
|
package/src/scripts/install.ts
CHANGED
|
@@ -96,6 +96,7 @@ import {
|
|
|
96
96
|
ruleScopeFromSettings,
|
|
97
97
|
type RuleScope,
|
|
98
98
|
} from '../install/rule_scope.js';
|
|
99
|
+
import { isExclusivelyPackageOnly, stampHostLayerFingerprint } from '../install/partitionEligibility.js'; // ADR-236
|
|
99
100
|
import { RULE_SOURCE_REL } from '../install/wizard-plan.js';
|
|
100
101
|
import { flattenSurface, computeSurfaceDelta, type SettingsSurface } from '../shared/settingsSurface.js';
|
|
101
102
|
import { settingsSchema } from '../server/schemas/settings.js';
|
|
@@ -3635,7 +3636,8 @@ function _rule_filter_for_source(
|
|
|
3635
3636
|
scope: RuleScope,
|
|
3636
3637
|
): global_deploy_inventory.FileFilter | null {
|
|
3637
3638
|
if (src_rel !== RULE_SOURCE_REL) return null;
|
|
3638
|
-
return (srcFile: string): boolean =>
|
|
3639
|
+
return (srcFile: string): boolean =>
|
|
3640
|
+
ruleFileArrives(srcFile, scope) && !isExclusivelyPackageOnly(srcFile);
|
|
3639
3641
|
}
|
|
3640
3642
|
|
|
3641
3643
|
/**
|
|
@@ -3804,19 +3806,21 @@ function install_global(
|
|
|
3804
3806
|
(tool_id) => (deploy_results[tool_id] as DeployResult)[2] === 'deploy_failed',
|
|
3805
3807
|
),
|
|
3806
3808
|
);
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
}
|
|
3809
|
+
const corrected_tools =
|
|
3810
|
+
failed_tools.size > 0 ? merged_tools.filter((t) => !failed_tools.has(t)) : merged_tools;
|
|
3811
|
+
if (failed_tools.size > 0 && !arrayStrEqual(corrected_tools, merged_tools)) {
|
|
3812
|
+
installed_lock.write_lockfile(installed_version, corrected_tools, { path: write_path });
|
|
3813
|
+
if (!state.QUIET) {
|
|
3814
|
+
warn(
|
|
3815
|
+
'Lockfile corrected after deploy postcheck — dropped ' +
|
|
3816
|
+
`${[...failed_tools].sort().join(', ')} (verification failed).`,
|
|
3817
|
+
);
|
|
3817
3818
|
}
|
|
3818
3819
|
}
|
|
3819
3820
|
|
|
3821
|
+
stampHostLayerFingerprint(installed_version, corrected_tools, write_path,
|
|
3822
|
+
failed_tools.has('claude-code'), (m) => { if (!state.QUIET) info(m); });
|
|
3823
|
+
|
|
3820
3824
|
if (state.PROGRESS_NDJSON) {
|
|
3821
3825
|
const ordered = Object.keys(deploy_results).sort();
|
|
3822
3826
|
const total = ordered.length;
|
|
@@ -5457,5 +5461,6 @@ export {
|
|
|
5457
5461
|
_copy_dir_dereferencing_symlinks,
|
|
5458
5462
|
_preview_global_reap,
|
|
5459
5463
|
_resolve_global_rule_scope,
|
|
5464
|
+
_rule_filter_for_source,
|
|
5460
5465
|
};
|
|
5461
5466
|
export type { Options, PackRecord, DeployResult };
|