@zhushanwen/subagent-core 0.4.0 → 0.6.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/dist/{chunk-4KN4TTG7.js → chunk-43ONBFZX.js} +1 -1
- package/dist/{chunk-X7SZ5HLQ.js → chunk-V3VHZ2VX.js} +20 -27
- package/dist/execution/engine/engines/zcode/constants.cjs +29 -41
- package/dist/execution/engine/engines/zcode/constants.d.cts +65 -53
- package/dist/execution/engine/engines/zcode/constants.d.ts +65 -53
- package/dist/execution/engine/engines/zcode/constants.js +17 -27
- package/dist/execution/engine/engines/zcode/reader.d.cts +2 -1
- package/dist/execution/engine/engines/zcode/reader.d.ts +2 -1
- package/dist/execution/engine/engines/zcode/reader.js +2 -2
- package/dist/index.cjs +17100 -14082
- package/dist/index.d.cts +5336 -4033
- package/dist/index.d.ts +5336 -4033
- package/dist/index.js +17020 -14055
- package/dist/{types-DpUO16pj.d.cts → types-C3fE3R9x.d.cts} +280 -112
- package/dist/{types-DpUO16pj.d.ts → types-C3fE3R9x.d.ts} +280 -112
- package/dist.bundle/index.cjs +34933 -0
- package/package.json +3 -3
- package/src/__tests__/agent-opts-resolver-schema-prompt.test.ts +0 -1
- package/src/__tests__/append-system-prompt-assembly.test.ts +8 -7
- package/src/__tests__/fr4-get-state-handshake.test.ts +2 -2
- package/src/__tests__/m2-append-content-probe.test.ts +0 -1
- package/src/__tests__/manifest-store.test.ts +10 -9
- package/src/__tests__/record-store-cache.test.ts +0 -2
- package/src/__tests__/record-store-index.test.ts +1 -2
- package/src/__tests__/review-fix-loop-script.test.ts +4 -2
- package/src/__tests__/review-fix-loop-utils.test.ts +10 -10
- package/src/__tests__/robustness-low-batch1.test.ts +6 -5
- package/src/__tests__/robustness-medium-batch1.test.ts +2 -2
- package/src/__tests__/robustness-medium-batch2.test.ts +17 -6
- package/src/__tests__/robustness-medium-batch4.test.ts +2 -2
- package/src/__tests__/session-runner.test.ts +1 -1
- package/src/core/__tests__/host-services.test.ts +2 -2
- package/src/core/__tests__/logger.test.ts +1 -1
- package/src/core/error-message.ts +9 -0
- package/src/core/host-services.ts +21 -5
- package/src/core/notify-ports.ts +18 -5
- package/src/execution/__tests__/agent-profile.test.ts +4 -4
- package/src/execution/__tests__/agent-registry.test.ts +370 -0
- package/src/execution/__tests__/agent-result-mapper.test.ts +18 -2
- package/src/execution/__tests__/agents-assembly.test.ts +2 -2
- package/src/execution/__tests__/alive-store.test.ts +1 -1
- package/src/execution/__tests__/ask-user-transit-e2e.test.ts +6 -6
- package/src/execution/__tests__/chat-engine-routing.test.ts +68 -33
- package/src/execution/__tests__/chatmode-first-round-closure-spawn.test.ts +4 -4
- package/src/execution/__tests__/cold-resurrect.test.ts +283 -0
- package/src/execution/__tests__/collect-budget.test.ts +291 -0
- package/src/execution/__tests__/collect-coordinator-service.test.ts +327 -0
- package/src/execution/__tests__/collect-coordinator.test.ts +371 -0
- package/src/execution/__tests__/collect-mixed-dispatch.test.ts +262 -0
- package/src/execution/__tests__/config-collect-sync.test.ts +120 -0
- package/src/execution/__tests__/config.test.ts +1 -1
- package/src/execution/__tests__/delivery-methods.test.ts +75 -62
- package/src/execution/__tests__/descendant-sweep-guards.test.ts +220 -0
- package/src/execution/__tests__/descendant-sweep.test.ts +6 -6
- package/src/execution/__tests__/dialog-queue.test.ts +2 -2
- package/src/execution/__tests__/engine-model-validation.test.ts +741 -0
- package/src/execution/__tests__/epipe-fallback.test.ts +29 -24
- package/src/execution/__tests__/execute-and-await-worktree.test.ts +21 -91
- package/src/execution/__tests__/execute-nesting.test.ts +34 -188
- package/src/execution/__tests__/execution-record.test.ts +217 -60
- package/src/execution/__tests__/execution-runtime-face.test.ts +5 -5
- package/src/execution/__tests__/explicit-agent-ref-guard.test.ts +4 -4
- package/src/execution/__tests__/finalize-record.test.ts +173 -17
- package/src/execution/__tests__/finalized-marker.test.ts +1 -1
- package/src/execution/__tests__/gc-timer.test.ts +56 -3
- package/src/execution/__tests__/get-record-for-action-restart.test.ts +12 -12
- package/src/execution/__tests__/get-state-handshake.test.ts +1 -1
- package/src/execution/__tests__/helpers/mock-extension-api.ts +1 -1
- package/src/execution/__tests__/helpers/session-runner-mocks.ts +113 -0
- package/src/execution/__tests__/helpers/spawn-mock.ts +150 -3
- package/src/execution/__tests__/helpers/subagent-service-mocks.ts +137 -0
- package/src/execution/__tests__/keep-alive-no-progress.test.ts +50 -148
- package/src/execution/__tests__/kill-all-escalation.test.ts +2 -2
- package/src/execution/__tests__/lifecycle-predicates.test.ts +1 -2
- package/src/execution/__tests__/manifest-parentid.test.ts +4 -4
- package/src/execution/__tests__/manifest-store-tmp-recovery.test.ts +1 -1
- package/src/execution/__tests__/max-turns-to-watchdog-ms.test.ts +1 -1
- package/src/execution/__tests__/model-resolver.test.ts +2 -2
- package/src/execution/__tests__/nested-visibility-env-propagation.test.ts +23 -121
- package/src/execution/__tests__/nested-visibility.test.ts +2 -0
- package/src/execution/__tests__/notify-batch.test.ts +500 -0
- package/src/execution/__tests__/notify-ledger.test.ts +1000 -18
- package/src/execution/__tests__/output-collector.test.ts +117 -6
- package/src/execution/__tests__/pi-invocation.test.ts +36 -4
- package/src/execution/__tests__/record-entry-collect.test.ts +102 -0
- package/src/execution/__tests__/record-store.test.ts +10 -9
- package/src/execution/__tests__/records-cwd-isolation.test.ts +2 -2
- package/src/execution/__tests__/recursive-visibility-baseline.test.ts +29 -132
- package/src/execution/__tests__/recursive-visibility-env.test.ts +55 -179
- package/src/execution/__tests__/relay-env.test.ts +12 -1
- package/src/execution/__tests__/rpc-mode.test.ts +2 -2
- package/src/execution/__tests__/run-and-finalize-anchoring.test.ts +387 -0
- package/src/execution/__tests__/run-and-finalize-chatmode.test.ts +15 -9
- package/src/execution/__tests__/run-spawn-chatmode-settled.test.ts +4 -4
- package/src/execution/__tests__/run-spawn-edges.test.ts +17 -15
- package/src/execution/__tests__/run-spawn-integration.test.ts +2 -2
- package/src/execution/__tests__/run-spawn-resume.test.ts +2 -2
- package/src/execution/__tests__/run-spawn-rpc-mode.test.ts +2 -2
- package/src/execution/__tests__/run-spawn-stdout-callback-throw.test.ts +4 -4
- package/src/execution/__tests__/service-kill-escalation.test.ts +7 -5
- package/src/execution/__tests__/session-context-resolver.test.ts +0 -2
- package/src/execution/__tests__/session-file-gc.test.ts +36 -1
- package/src/execution/__tests__/session-pending.test.ts +257 -14
- package/src/execution/__tests__/session-reconstructor.test.ts +366 -15
- package/src/execution/__tests__/session-runner-branch-cache-lru.test.ts +1 -1
- package/src/execution/__tests__/session-runner-close-prune.test.ts +2 -2
- package/src/execution/__tests__/session-runner-dispatch.test.ts +489 -0
- package/src/execution/__tests__/session-runner-epipe.test.ts +3 -3
- package/src/execution/__tests__/session-runner-heartbeat-idle-fallback.test.ts +5 -4
- package/src/execution/__tests__/session-runner-lifecycle-helpers.test.ts +290 -0
- package/src/execution/__tests__/session-runner-schema-env.test.ts +7 -5
- package/src/execution/__tests__/settled-watchdog.test.ts +282 -47
- package/src/execution/__tests__/spawn-args.test.ts +11 -10
- package/src/execution/__tests__/spawn-event-adapter-rpc.test.ts +26 -23
- package/src/execution/__tests__/spawn-event-adapter.test.ts +3 -3
- package/src/execution/__tests__/spawn-worktree-guidance.test.ts +5 -4
- package/src/execution/__tests__/spawned-children.test.ts +2 -1
- package/src/execution/__tests__/start-collect-guard.test.ts +255 -0
- package/src/execution/__tests__/start-sync-model-guard.test.ts +5 -5
- package/src/execution/__tests__/stdin-writer.test.ts +6 -4
- package/src/execution/__tests__/stream-sink-retirement.test.ts +6 -6
- package/src/execution/__tests__/subagent-actions-core.test.ts +48 -22
- package/src/execution/__tests__/subagent-service-message-close.test.ts +29 -26
- package/src/execution/__tests__/subagent-service-multiproc-guard.test.ts +21 -8
- package/src/execution/__tests__/subagent-service-notify-gate.test.ts +27 -22
- package/src/execution/__tests__/subagent-service-parent-guard.test.ts +30 -29
- package/src/execution/__tests__/subagent-service-recovery-bounds.test.ts +45 -20
- package/src/execution/__tests__/subagent-service.test.ts +37 -30
- package/src/execution/__tests__/subprocess-agent-runner-routing.test.ts +88 -12
- package/src/execution/__tests__/subprocess-agent-runner-timeout.test.ts +75 -0
- package/src/execution/__tests__/subprocess-agent-runner.test.ts +22 -20
- package/src/execution/__tests__/sync-collect-recovery.test.ts +1117 -0
- package/src/execution/__tests__/temp-prompt.test.ts +1 -1
- package/src/execution/__tests__/timeout-integration.test.ts +6 -5
- package/src/execution/__tests__/tombstone-store.test.ts +1 -1
- package/src/execution/__tests__/turn-limiter-semantics.test.ts +1 -1
- package/src/execution/__tests__/turn-limiter.test.ts +1 -1
- package/src/execution/__tests__/ui-request-handler-factory.test.ts +12 -6
- package/src/execution/__tests__/ui-request-handler.test.ts +4 -3
- package/src/execution/__tests__/ui-request-queue.test.ts +142 -2
- package/src/execution/__tests__/worktree-git-ops.test.ts +1 -1
- package/src/execution/__tests__/worktree-manager.test.ts +14 -5
- package/src/execution/__tests__/worktree-pid-registration.integration.test.ts +4 -3
- package/src/execution/__tests__/worktree-reconcile-aging.test.ts +2 -2
- package/src/execution/__tests__/worktree-reconcile.integration.test.ts +1 -1
- package/src/execution/__tests__/worktree-registry.test.ts +1 -1
- package/src/execution/agent-registry.ts +74 -30
- package/src/execution/agent-result-mapper.ts +3 -0
- package/src/execution/cold-resurrect.ts +199 -0
- package/src/execution/collect-coordinator.ts +200 -0
- package/src/execution/config.ts +77 -5
- package/src/execution/engine/__tests__/common/capability-gate.test.ts +91 -0
- package/src/execution/engine/__tests__/common/data-dir.test.ts +1 -1
- package/src/execution/engine/__tests__/common/event-journal.test.ts +1 -1
- package/src/execution/engine/__tests__/common/journal-wiring.test.ts +84 -0
- package/src/execution/engine/__tests__/common/kill-chain.test.ts +34 -7
- package/src/execution/engine/__tests__/common/persona-router.test.ts +4 -5
- package/src/execution/engine/__tests__/common/pool-manager.test.ts +213 -53
- package/src/execution/engine/__tests__/common/session-view-service-zcode-dbpath.test.ts +149 -0
- package/src/execution/engine/__tests__/common/session-view-service.test.ts +499 -0
- package/src/execution/engine/__tests__/conformance/contract.abort.test.ts +22 -112
- package/src/execution/engine/__tests__/conformance/contract.agent-events.test.ts +15 -28
- package/src/execution/engine/__tests__/conformance/contract.read-degradation.test.ts +1 -1
- package/src/execution/engine/__tests__/conformance/engine-conformance.live.test.ts +12 -12
- package/src/execution/engine/__tests__/conformance/golden-replay.pi.test.ts +2 -2
- package/src/execution/engine/__tests__/conformance/golden-replay.zcode.test.ts +21 -82
- package/src/execution/engine/__tests__/conformance/zcode-appserver-harness.ts +4 -7
- package/src/execution/engine/__tests__/engine-discovery.test.ts +15 -3
- package/src/execution/engine/__tests__/model-prompt.test.ts +15 -3
- package/src/execution/engine/__tests__/registry.test.ts +4 -2
- package/src/execution/engine/__tests__/routing.test.ts +115 -6
- package/src/execution/engine/common/capability-gate.ts +92 -0
- package/src/execution/engine/common/journal-wiring.ts +97 -0
- package/src/execution/engine/common/kill-chain.ts +42 -10
- package/src/execution/engine/common/nesting-guard.ts +66 -0
- package/src/execution/engine/common/persona-router.ts +18 -8
- package/src/execution/engine/common/pool-manager.ts +332 -78
- package/src/execution/engine/common/session-view-service.ts +506 -0
- package/src/execution/engine/common/session-view-types.ts +125 -0
- package/src/execution/engine/engines/pi/__tests__/pi-engine.test.ts +174 -28
- package/src/execution/engine/engines/pi/__tests__/spawn-opts-direct.test.ts +257 -0
- package/src/execution/{argv-mirror.ts → engine/engines/pi/argv-mirror.ts} +43 -21
- package/src/execution/{get-state-handshake.ts → engine/engines/pi/get-state-handshake.ts} +1 -1
- package/src/execution/{output-collector.ts → engine/engines/pi/output-collector.ts} +108 -19
- package/src/execution/engine/engines/pi/pi-engine.ts +434 -38
- package/src/execution/{pi-invocation.ts → engine/engines/pi/pi-invocation.ts} +2 -2
- package/src/execution/engine/engines/pi/reader.ts +11 -0
- package/src/execution/engine/engines/pi/registration.ts +4 -2
- package/src/execution/{session-runner.ts → engine/engines/pi/session-runner.ts} +617 -412
- package/src/execution/{spawn-event-adapter.ts → engine/engines/pi/spawn-event-adapter.ts} +75 -34
- package/src/execution/{stdin-writer.ts → engine/engines/pi/stdin-writer.ts} +10 -9
- package/src/execution/{temp-prompt.ts → engine/engines/pi/temp-prompt.ts} +2 -2
- package/src/execution/{turn-limiter.ts → engine/engines/pi/turn-limiter.ts} +1 -1
- package/src/execution/engine/engines/zcode/__tests__/__fixtures__/fake-appserver.mjs +54 -27
- package/src/execution/engine/engines/zcode/__tests__/appserver-launcher.test.ts +321 -0
- package/src/execution/engine/engines/zcode/__tests__/connection.test.ts +13 -12
- package/src/execution/engine/engines/zcode/__tests__/parser.test.ts +7 -210
- package/src/execution/engine/engines/zcode/__tests__/preparer.test.ts +6 -110
- package/src/execution/engine/engines/zcode/__tests__/session-channel-dispose-harvest.test.ts +247 -0
- package/src/execution/engine/engines/zcode/__tests__/session-channel-turn-timers.test.ts +451 -0
- package/src/execution/engine/engines/zcode/__tests__/session-channel.test.ts +20 -8
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine-appserver.test.ts +77 -110
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine-degrade.test.ts +26 -320
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine-dispose.test.ts +210 -0
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine-retry.test.ts +353 -0
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine-status.test.ts +282 -0
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine-timeout.test.ts +372 -0
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine.live.test.ts +48 -148
- package/src/execution/engine/engines/zcode/appserver-launcher.ts +167 -0
- package/src/execution/engine/engines/zcode/connection.ts +24 -11
- package/src/execution/engine/engines/zcode/constants.ts +75 -71
- package/src/execution/engine/engines/zcode/golden-sample.ts +8 -46
- package/src/execution/engine/engines/zcode/parser.ts +12 -346
- package/src/execution/engine/engines/zcode/preparer.ts +12 -143
- package/src/execution/engine/engines/zcode/session-channel.ts +351 -39
- package/src/execution/engine/engines/zcode/zcode-engine.ts +665 -760
- package/src/execution/engine/host-task-spec.ts +32 -36
- package/src/execution/engine/model-validation.ts +177 -0
- package/src/execution/engine/port.ts +24 -6
- package/src/execution/engine/routing.ts +75 -1
- package/src/execution/engine/types.ts +30 -103
- package/src/execution/execution-record.ts +229 -144
- package/src/execution/finalize-record.ts +141 -99
- package/src/execution/idle-gc.ts +28 -0
- package/src/execution/lifecycle-predicates.ts +1 -1
- package/src/execution/notifier.ts +234 -25
- package/src/execution/notify-host.ts +232 -0
- package/src/execution/record-entry.ts +16 -0
- package/src/execution/record-store.ts +280 -103
- package/src/execution/round-settlement.ts +93 -0
- package/src/execution/session-file-gc.ts +96 -62
- package/src/execution/session-reconstructor.ts +256 -143
- package/src/execution/sessions-index.ts +117 -47
- package/src/execution/settled-watchdog.ts +264 -52
- package/src/execution/subagent-actions-core.ts +84 -28
- package/src/execution/subagent-service.ts +1225 -964
- package/src/execution/subprocess-agent-runner.ts +144 -97
- package/src/execution/sync-rebuild.ts +87 -0
- package/src/execution/types.ts +72 -0
- package/src/execution/ui-request-handler-factory.ts +102 -74
- package/src/execution/ui-request-queue.ts +50 -19
- package/src/index.ts +442 -316
- package/src/orchestration/__tests__/agent-call-catch-fallback.test.ts +1 -1
- package/src/orchestration/__tests__/agent-call-stream.test.ts +2 -2
- package/src/orchestration/__tests__/args-validator.test.ts +14 -0
- package/src/orchestration/__tests__/config-loader.test.ts +1 -1
- package/src/orchestration/__tests__/error-recovery-rebuild-failure.test.ts +1 -1
- package/src/orchestration/__tests__/error-recovery-terminal-hardening.test.ts +11 -9
- package/src/orchestration/__tests__/execute-agent-call.test.ts +151 -11
- package/src/orchestration/__tests__/file-run-store-prune.test.ts +1 -1
- package/src/orchestration/__tests__/file-run-store-throttle.test.ts +1 -1
- package/src/orchestration/__tests__/file-run-store.test.ts +7 -6
- package/src/orchestration/__tests__/launcher-nested-workflow.test.ts +2 -2
- package/src/orchestration/__tests__/lifecycle-abort-broadcast-signal.test.ts +1 -1
- package/src/orchestration/__tests__/lifecycle-runid-injection.test.ts +3 -3
- package/src/orchestration/__tests__/lifecycle.test.ts +7 -5
- package/src/orchestration/__tests__/non-cloneable-return-e2e.test.ts +1 -1
- package/src/orchestration/__tests__/review-fix-loop-scriptpath-failfast.test.ts +1 -1
- package/src/orchestration/__tests__/run-snapshot.test.ts +8 -5
- package/src/orchestration/__tests__/script-generate.test.ts +5 -5
- package/src/orchestration/__tests__/script-lint.test.ts +17 -0
- package/src/orchestration/__tests__/skill-discovery.test.ts +2 -2
- package/src/orchestration/__tests__/test-mocks.ts +2 -0
- package/src/orchestration/__tests__/worker-exit-without-result.test.ts +7 -6
- package/src/orchestration/__tests__/worker-message-pump-finalize-run.test.ts +229 -0
- package/src/orchestration/__tests__/{error-recovery-handlers.test.ts → worker-message-pump-handlers.test.ts} +27 -19
- package/src/orchestration/__tests__/{error-recovery-postmessage-defense.test.ts → worker-message-pump-postmessage-defense.test.ts} +8 -8
- package/src/orchestration/__tests__/{error-recovery-serialize-failed-result.test.ts → worker-message-pump-serialize-failed-result.test.ts} +2 -2
- package/src/orchestration/__tests__/{error-recovery-workflow-call.test.ts → worker-message-pump-workflow-call.test.ts} +1 -1
- package/src/orchestration/__tests__/worker-pending-timeout-abort.test.ts +1 -1
- package/src/orchestration/__tests__/worker-script-builder.test.ts +1 -1
- package/src/orchestration/__tests__/workflow-files.test.ts +10 -10
- package/src/orchestration/__tests__/workflow-nesting-e2e.test.ts +1 -1
- package/src/orchestration/__tests__/workflow-script-registry-impl.test.ts +1 -1
- package/src/orchestration/agent-opts-resolver.ts +1 -1
- package/src/orchestration/args-validator.ts +53 -31
- package/src/orchestration/execute-agent-call.ts +19 -73
- package/src/orchestration/launcher.ts +128 -81
- package/src/orchestration/lifecycle.ts +43 -45
- package/src/orchestration/models/ports.ts +4 -4
- package/src/orchestration/models/run-runtime.ts +2 -2
- package/src/orchestration/models/trace.ts +1 -1
- package/src/orchestration/models/types.ts +111 -22
- package/src/orchestration/models/workflow-run.ts +1 -1
- package/src/orchestration/script-lint.ts +91 -58
- package/src/orchestration/{error-recovery.ts → worker-message-pump.ts} +157 -150
- package/src/shared/__tests__/atomic-write.test.ts +1 -1
- package/src/shared/__tests__/meta-parser.test.ts +151 -0
- package/src/shared/__tests__/resource-discovery-host-roots.test.ts +5 -5
- package/src/shared/__tests__/resource-discovery.test.ts +258 -215
- package/src/shared/atomic-write.ts +12 -9
- package/src/shared/meta-parser.ts +158 -84
- package/src/shared/model-ref.ts +15 -2
- package/src/shared/resource-discovery.ts +9 -183
- package/src/shared/schema-jsonify.ts +1 -1
- package/workflows/review-fix-loop-utils.cjs +151 -89
- package/workflows/review-fix-loop-utils.d.cts +287 -0
- package/src/execution/__tests__/execute-options-mapper.test.ts +0 -200
- package/src/execution/engine/engines/pi/__tests__/task-spec-mapper.test.ts +0 -164
- package/src/execution/engine/engines/pi/task-spec-mapper.ts +0 -100
- package/src/execution/engine/engines/zcode/__tests__/__fixtures__/zcode-golden-spawn.json +0 -39
- package/src/execution/engine/engines/zcode/__tests__/launcher.test.ts +0 -150
- package/src/execution/engine/engines/zcode/__tests__/preparer-appserver.test.ts +0 -387
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine.test.ts +0 -710
- package/src/execution/engine/engines/zcode/appserver-home.ts +0 -442
- package/src/execution/engine/engines/zcode/appserver-probe.ts +0 -141
- package/src/execution/engine/engines/zcode/launcher.ts +0 -161
- package/src/execution/execute-options-mapper.ts +0 -115
- package/src/shared/__tests__/resource-discovery-manifest-cache.test.ts +0 -288
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// review-fix-loop-utils.cjs — review-fix-loop.js 的可测纯函数模块
|
|
2
2
|
//
|
|
3
3
|
// workflow 编排逻辑的纯函数抽到独立 .cjs,
|
|
4
|
-
// 供 vitest 单测直接 require(
|
|
4
|
+
// 供 vitest 单测直接 require(packages/subagent-core/src/__tests__/review-fix-loop-utils.test.ts)
|
|
5
5
|
// 与 worker 运行时共用(review-fix-loop.js 经 workerData.scriptPath 定位本文件)。
|
|
6
6
|
//
|
|
7
7
|
// 本文件不依赖 workflow 全局($ARGS/agent/parallel/phase/log),所有需要报错的函数
|
|
@@ -328,6 +328,64 @@ function findIssueKey(issues, issueId) {
|
|
|
328
328
|
return undefined;
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
+
/**
|
|
332
|
+
* deferred 条目的有效 severity(m9 交叉核对):自报 severity 可被单边绕过(fix agent
|
|
333
|
+
* 与审核方同一 LLM,有少干活动机,把 must-fix 标 minor 塞进 deferred 即过旧校验)——
|
|
334
|
+
* 与追踪表交叉核对:trackedIssues 中能找到的 ID 以其追踪 severity 为准;追踪表无此 ID
|
|
335
|
+
* 采信自报。仅认真实 severity 等级(critical/major/minor/trivial);"unknown"(reconcile
|
|
336
|
+
* 新 ID 默认)等非等级值不覆盖自报,避免误伤合法 minor deferral。
|
|
337
|
+
*/
|
|
338
|
+
function resolveDeferredEffectiveSeverity(d, trackedIssues, idMap) {
|
|
339
|
+
const sev = typeof d.severity === "string" ? d.severity.toLowerCase() : "";
|
|
340
|
+
let effectiveSev = sev;
|
|
341
|
+
if (trackedIssues && typeof d.issue_id === "string" && d.issue_id) {
|
|
342
|
+
const trackedKey = findIssueKey(trackedIssues, translateId(idMap, d.issue_id, trackedIssues));
|
|
343
|
+
const trackedSev = trackedKey ? trackedIssues[trackedKey].severity : undefined;
|
|
344
|
+
const ts = typeof trackedSev === "string" ? trackedSev.toLowerCase() : "";
|
|
345
|
+
if (ts === "critical" || ts === "major" || ts === "minor" || ts === "trivial") {
|
|
346
|
+
effectiveSev = ts;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return effectiveSev;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/** deferred 违规收集(TC3):有效 severity 非 minor/trivial 即违规;falsy 条目跳过。 */
|
|
353
|
+
function collectDeferredViolations(result, trackedIssues, idMap) {
|
|
354
|
+
const violations = [];
|
|
355
|
+
for (const d of result.deferred || []) {
|
|
356
|
+
if (!d) continue;
|
|
357
|
+
const effectiveSev = resolveDeferredEffectiveSeverity(d, trackedIssues, idMap);
|
|
358
|
+
if (effectiveSev && effectiveSev !== "minor" && effectiveSev !== "trivial") {
|
|
359
|
+
violations.push({ issue_id: d.issue_id || "(unnamed)", severity: effectiveSev });
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
return violations;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/** must-fix 申报 ID 归一化:string 直接归一;对象形态取 .id 归一;其余空串。 */
|
|
366
|
+
function normMustFixEntryId(id) {
|
|
367
|
+
if (typeof id === "string") return normIssueId(id);
|
|
368
|
+
return id && typeof id.id === "string" ? normIssueId(id.id) : "";
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* must-fix 漏修违规收集(m3):ID 归一化比较——大小写 + 尾部括号尾注(如 "(fixed)")
|
|
373
|
+
* 漂移不误杀:严格 trim 比较会把 "mf-1"/"MF-1 (fixed)" 判漏修,整轮 fix-failure 误杀。
|
|
374
|
+
*/
|
|
375
|
+
function collectMustFixNotFixedViolations(result, mustFixIds) {
|
|
376
|
+
const violations = [];
|
|
377
|
+
const fixedIds = new Set((result.fixes || [])
|
|
378
|
+
.map((f) => (f && typeof f.issue_id === "string" ? normIssueId(f.issue_id) : ""))
|
|
379
|
+
.filter(Boolean));
|
|
380
|
+
for (const id of mustFixIds) {
|
|
381
|
+
const norm = normMustFixEntryId(id);
|
|
382
|
+
if (norm && !fixedIds.has(norm)) {
|
|
383
|
+
violations.push({ issue_id: norm, severity: "must-fix-not-fixed" });
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return violations;
|
|
387
|
+
}
|
|
388
|
+
|
|
331
389
|
/**
|
|
332
390
|
* ES3 硬校验(5.3-P1 红线):(1) deferred 只允许 minor/trivial;(2) must-fix 必须全进
|
|
333
391
|
* fixes[]——mustFixIds 中未修复且未显式处理的 ID 判 violation(漏修)。mustFixIds
|
|
@@ -341,40 +399,9 @@ function findIssueKey(issues, issueId) {
|
|
|
341
399
|
* 翻译任一侧都会制造假失配(must-fix-not-fixed 误杀整 run)。
|
|
342
400
|
*/
|
|
343
401
|
function validateFixResult(result, mustFixIds, trackedIssues, idMap) {
|
|
344
|
-
const violations =
|
|
345
|
-
for (const d of result.deferred || []) {
|
|
346
|
-
if (!d) continue;
|
|
347
|
-
const sev = typeof d.severity === "string" ? d.severity.toLowerCase() : "";
|
|
348
|
-
// m9: 自报 severity 可被单边绕过(fix agent 与审核方同一 LLM,有少干活动机,
|
|
349
|
-
// 把 must-fix 标 minor 塞进 deferred 即过旧校验)——与追踪表交叉核对:
|
|
350
|
-
// trackedIssues 中能找到的 ID 以其追踪 severity 为准;追踪表无此 ID 采信自报。
|
|
351
|
-
let effectiveSev = sev;
|
|
352
|
-
if (trackedIssues && typeof d.issue_id === "string" && d.issue_id) {
|
|
353
|
-
const trackedKey = findIssueKey(trackedIssues, translateId(idMap, d.issue_id, trackedIssues));
|
|
354
|
-
const trackedSev = trackedKey ? trackedIssues[trackedKey].severity : undefined;
|
|
355
|
-
const ts = typeof trackedSev === "string" ? trackedSev.toLowerCase() : "";
|
|
356
|
-
// 仅认真实 severity 等级(critical/major/minor/trivial);"unknown"(reconcile 新
|
|
357
|
-
// ID 默认)等非等级值不覆盖自报,避免误伤合法 minor deferral
|
|
358
|
-
if (ts === "critical" || ts === "major" || ts === "minor" || ts === "trivial") {
|
|
359
|
-
effectiveSev = ts;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
if (effectiveSev && effectiveSev !== "minor" && effectiveSev !== "trivial") {
|
|
363
|
-
violations.push({ issue_id: d.issue_id || "(unnamed)", severity: effectiveSev });
|
|
364
|
-
}
|
|
365
|
-
}
|
|
402
|
+
const violations = collectDeferredViolations(result, trackedIssues, idMap);
|
|
366
403
|
if (Array.isArray(mustFixIds) && mustFixIds.length > 0) {
|
|
367
|
-
|
|
368
|
-
// 严格 trim 比较会把 "mf-1"/"MF-1 (fixed)" 判漏修,整轮 fix-failure 误杀
|
|
369
|
-
const fixedIds = new Set((result.fixes || [])
|
|
370
|
-
.map((f) => (f && typeof f.issue_id === "string" ? normIssueId(f.issue_id) : ""))
|
|
371
|
-
.filter(Boolean));
|
|
372
|
-
for (const id of mustFixIds) {
|
|
373
|
-
const norm = typeof id === "string" ? normIssueId(id) : (id && typeof id.id === "string" ? normIssueId(id.id) : "");
|
|
374
|
-
if (norm && !fixedIds.has(norm)) {
|
|
375
|
-
violations.push({ issue_id: norm, severity: "must-fix-not-fixed" });
|
|
376
|
-
}
|
|
377
|
-
}
|
|
404
|
+
violations.push(...collectMustFixNotFixedViolations(result, mustFixIds));
|
|
378
405
|
}
|
|
379
406
|
return violations;
|
|
380
407
|
}
|
|
@@ -829,6 +856,88 @@ function translateReconSets(reconSeen, reconEscalate, reconFixed, idMap, issues)
|
|
|
829
856
|
* 未知 ID(不在 prevIssues 中)按新发现处理;stuckThreshold 复用 stuckThreshold 参数。
|
|
830
857
|
* @returns { issues, stuck, stuckIds, knownRemaining }
|
|
831
858
|
*/
|
|
859
|
+
/** 条目克隆:浅拷贝 + history 复制——reconcile 不修改入参条目,转换落在新条目上。 */
|
|
860
|
+
function cloneTrackedIssue(issue) {
|
|
861
|
+
return { ...issue, history: [...(issue.history || [])] };
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* 5.1-5 显式升级:reconciliation 声明 escalate → 重新 open(保留历史与 fixAttempts),
|
|
866
|
+
* 进入修复循环;未升级的 deferred 留 known-remaining,不参与判定。
|
|
867
|
+
*/
|
|
868
|
+
function escalateDeferredIssue(entry, id, escalated, round) {
|
|
869
|
+
if (!escalated.has(id)) return;
|
|
870
|
+
entry.status = "open";
|
|
871
|
+
entry.openStreak = 0;
|
|
872
|
+
entry.history.push({ round, status: "escalated" });
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* open/regressed + 声明 fixed(verify-first)→ 清账,命中返回 true(调用方跳过后续
|
|
877
|
+
* 转换)。与"fix result claiming fixed is NOT evidence"原则不冲突:这里的 fixed 声明
|
|
878
|
+
* 来自 reviewer 亲自读目标后的申报(evidence 非空由调用方过滤),正是该原则认可的
|
|
879
|
+
* 证据形态——此前它被收集侧整体丢弃,open 条目无消除通道。
|
|
880
|
+
*/
|
|
881
|
+
function applyReconciledFix(entry, id, fixedDeclared, round) {
|
|
882
|
+
if (!((entry.status === "open" || entry.status === "regressed") && fixedDeclared.has(id))) return false;
|
|
883
|
+
entry.status = "fixed";
|
|
884
|
+
entry.openStreak = 0;
|
|
885
|
+
entry.history.push({ round, status: "fixed", via: "reconciliation" });
|
|
886
|
+
return true;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* fix-attempted 判定:未再现(未 seen)→ fixed;再现 → regressed(fixAttempts+1)。
|
|
891
|
+
*/
|
|
892
|
+
function applyFixAttemptedOutcome(entry, statusNow, id, seen, round) {
|
|
893
|
+
if (statusNow !== "fix-attempted") return;
|
|
894
|
+
if (!seen.has(id)) {
|
|
895
|
+
entry.status = "fixed";
|
|
896
|
+
entry.openStreak = 0;
|
|
897
|
+
entry.history.push({ round, status: "fixed" });
|
|
898
|
+
} else {
|
|
899
|
+
entry.status = "regressed";
|
|
900
|
+
// fixAttempts 语义 = 修复失败次数:初始 0,每次 regressed +1(RC-7「经 2 次修复
|
|
901
|
+
// 仍未收敛」= 第 2 次 regressed 后触发,修复见 findNeedsRedesign 阈值)。
|
|
902
|
+
entry.fixAttempts = (entry.fixAttempts || 0) + 1;
|
|
903
|
+
entry.history.push({ round, status: "regressed" });
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
|
+
* MF-2: fixed 条目再次被报告(seen)→ 回归:转 regressed + fixAttempts+1(已确认修复
|
|
909
|
+
* 的问题复发同样计修复失败,needs-redesign 可达);openStreak 由统一 if 累计
|
|
910
|
+
* (首轮回归 1)。未 seen → 保持 fixed(漏报不误转)。修复前此处无转换——fixed 条目
|
|
911
|
+
* 复发时 fixAttempts/openStreak 均不增长,与收敛终止组合后默认配置下 R3 即以
|
|
912
|
+
* converged 提前终止而 must-fix 仍活跃(MF-2)。
|
|
913
|
+
*/
|
|
914
|
+
function applyFixedRegression(entry, statusNow, id, seen, round) {
|
|
915
|
+
if (!(statusNow === "fixed" && seen.has(id))) return;
|
|
916
|
+
entry.status = "regressed";
|
|
917
|
+
entry.fixAttempts = (entry.fixAttempts || 0) + 1;
|
|
918
|
+
entry.history.push({ round, status: "regressed" });
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
// open/regressed 且本轮仍在(seen)→ openStreak +1(跨轮字段);漏报(未 seen)不增长(保守)。
|
|
922
|
+
// status 读 entry 当前值——fix-attempted/fixed 分支本轮转出的 regressed 同样累计(原语义)。
|
|
923
|
+
function accrueOpenStreak(entry, id, seen, stuckThreshold, stuckIds) {
|
|
924
|
+
if (seen.has(id) && (entry.status === "open" || entry.status === "regressed")) {
|
|
925
|
+
entry.openStreak = (entry.openStreak || 0) + 1;
|
|
926
|
+
if (entry.openStreak >= stuckThreshold) stuckIds.push(id);
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
// 新 ID(reviewer 声明的新发现)→ open。新 ID 首现 openStreak=1:统一判定语义
|
|
931
|
+
// openStreak >= stuckThreshold(与既有条目分支一致)。边界:stuckThreshold=1 时新 ID
|
|
932
|
+
// 首现即 stuck(语义自洽:阈值为 1 表示「任何未解决条目出现即视为卡住」,属显式配置而非 bug)。
|
|
933
|
+
function registerNewFinding(issues, id, round, stuckThreshold, stuckIds) {
|
|
934
|
+
issues[id] = {
|
|
935
|
+
firstSeen: round, severity: "unknown", status: "open", openStreak: 1,
|
|
936
|
+
history: [{ round, status: "open" }], fixAttempts: 0,
|
|
937
|
+
};
|
|
938
|
+
if (issues[id].openStreak >= stuckThreshold) stuckIds.push(id);
|
|
939
|
+
}
|
|
940
|
+
|
|
832
941
|
function reconcileIssues(prevIssues, { seenIds, escalateIds, fixedIds, round, stuckThreshold }) {
|
|
833
942
|
const issues = {};
|
|
834
943
|
const seen = new Set(seenIds || []);
|
|
@@ -836,67 +945,20 @@ function reconcileIssues(prevIssues, { seenIds, escalateIds, fixedIds, round, st
|
|
|
836
945
|
const fixedDeclared = new Set(fixedIds || []);
|
|
837
946
|
const stuckIds = [];
|
|
838
947
|
for (const [id, issue] of Object.entries(prevIssues || {})) {
|
|
839
|
-
|
|
948
|
+
const entry = cloneTrackedIssue(issue);
|
|
949
|
+
issues[id] = entry;
|
|
840
950
|
if (issue.status === "deferred") {
|
|
841
|
-
|
|
842
|
-
// 进入修复循环;未升级的 deferred 留 known-remaining,不参与判定。
|
|
843
|
-
if (escalated.has(id)) {
|
|
844
|
-
issues[id].status = "open";
|
|
845
|
-
issues[id].openStreak = 0;
|
|
846
|
-
issues[id].history.push({ round, status: "escalated" });
|
|
847
|
-
}
|
|
848
|
-
continue;
|
|
849
|
-
}
|
|
850
|
-
// open/regressed + 声明 fixed(verify-first)→ 清账。与"fix result claiming fixed
|
|
851
|
-
// is NOT evidence"原则不冲突:这里的 fixed 声明来自 reviewer 亲自读目标后的申报
|
|
852
|
-
// (evidence 非空由调用方过滤),正是该原则认可的证据形态——此前它被收集侧
|
|
853
|
-
// 整体丢弃,open 条目无消除通道。
|
|
854
|
-
if ((issues[id].status === "open" || issues[id].status === "regressed") && fixedDeclared.has(id)) {
|
|
855
|
-
issues[id].status = "fixed";
|
|
856
|
-
issues[id].openStreak = 0;
|
|
857
|
-
issues[id].history.push({ round, status: "fixed", via: "reconciliation" });
|
|
951
|
+
escalateDeferredIssue(entry, id, escalated, round);
|
|
858
952
|
continue;
|
|
859
953
|
}
|
|
860
|
-
if (
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
issues[id].history.push({ round, status: "fixed" });
|
|
865
|
-
} else {
|
|
866
|
-
issues[id].status = "regressed";
|
|
867
|
-
// fixAttempts 语义 = 修复失败次数:初始 0,每次 regressed +1(RC-7「经 2 次修复
|
|
868
|
-
// 仍未收敛」= 第 2 次 regressed 后触发,修复见 findNeedsRedesign 阈值)。
|
|
869
|
-
issues[id].fixAttempts = (issue.fixAttempts || 0) + 1;
|
|
870
|
-
issues[id].history.push({ round, status: "regressed" });
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
// MF-2: fixed 条目再次被报告(seen)→ 回归:转 regressed + fixAttempts+1(已确认修复
|
|
874
|
-
// 的问题复发同样计修复失败,needs-redesign 可达);openStreak 由下方统一 if 累计
|
|
875
|
-
// (首轮回归 1)。未 seen → 保持 fixed(漏报不误转)。修复前此处无转换——fixed 条目
|
|
876
|
-
// 复发时 fixAttempts/openStreak 均不增长,与收敛终止组合后默认配置下 R3 即以
|
|
877
|
-
// converged 提前终止而 must-fix 仍活跃(MF-2)。
|
|
878
|
-
if (issue.status === "fixed" && seen.has(id)) {
|
|
879
|
-
issues[id].status = "regressed";
|
|
880
|
-
issues[id].fixAttempts = (issue.fixAttempts || 0) + 1;
|
|
881
|
-
issues[id].history.push({ round, status: "regressed" });
|
|
882
|
-
}
|
|
883
|
-
// open/regressed 且本轮仍在(seen)→ openStreak +1(跨轮字段);漏报(未 seen)不增长(保守)
|
|
884
|
-
if (seen.has(id) && (issues[id].status === "open" || issues[id].status === "regressed")) {
|
|
885
|
-
issues[id].openStreak = (issues[id].openStreak || 0) + 1;
|
|
886
|
-
if (issues[id].openStreak >= stuckThreshold) stuckIds.push(id);
|
|
887
|
-
}
|
|
954
|
+
if (applyReconciledFix(entry, id, fixedDeclared, round)) continue;
|
|
955
|
+
applyFixAttemptedOutcome(entry, issue.status, id, seen, round);
|
|
956
|
+
applyFixedRegression(entry, issue.status, id, seen, round);
|
|
957
|
+
accrueOpenStreak(entry, id, seen, stuckThreshold, stuckIds);
|
|
888
958
|
}
|
|
889
|
-
// 新 ID(reviewer 声明的新发现)→ open
|
|
890
959
|
for (const id of seen) {
|
|
891
960
|
if (issues[id]) continue;
|
|
892
|
-
issues
|
|
893
|
-
firstSeen: round, severity: "unknown", status: "open", openStreak: 1,
|
|
894
|
-
history: [{ round, status: "open" }], fixAttempts: 0,
|
|
895
|
-
};
|
|
896
|
-
// 新 ID 首现 openStreak=1:统一判定语义 openStreak >= stuckThreshold(与下方既有
|
|
897
|
-
// 条目分支一致)。边界:stuckThreshold=1 时新 ID 首现即 stuck(语义自洽:阈值为 1
|
|
898
|
-
// 表示「任何未解决条目出现即视为卡住」,属显式配置而非 bug)。
|
|
899
|
-
if (issues[id].openStreak >= stuckThreshold) stuckIds.push(id);
|
|
961
|
+
registerNewFinding(issues, id, round, stuckThreshold, stuckIds);
|
|
900
962
|
}
|
|
901
963
|
const knownRemaining = computeKnownRemaining(issues);
|
|
902
964
|
return { issues, stuck: stuckIds.length > 0, stuckIds, knownRemaining };
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
// review-fix-loop-utils.cjs 的消费面类型声明(test-only 类型基建:src/__tests__/
|
|
2
|
+
// review-fix-loop-utils.test.ts 顶层 import 本模块;tsc 纳入测试后需要声明锚点)。
|
|
3
|
+
// 与 .cjs 同名同目录的 .d.cts 会被 TS 自动关联(相对路径导入解析)。
|
|
4
|
+
// 仅声明测试消费的导出——未来消费新导出时在编译期报缺并在此补充。
|
|
5
|
+
// 参数对象字段全可选(cjs 侧对缺省字段有兜底/容忍 undefined 的拼接语义)。
|
|
6
|
+
|
|
7
|
+
/** fail 回调(测试侧实现为抛错终止,签名兼容 (msg: string) => void)。 */
|
|
8
|
+
export type FailFn = (msg: string) => void;
|
|
9
|
+
|
|
10
|
+
/** 评分条目(landScores/backfillFixRegression 的 scores 元素形态)。 */
|
|
11
|
+
export interface ScoreEntry {
|
|
12
|
+
round?: number;
|
|
13
|
+
targetKind?: string;
|
|
14
|
+
targetName?: string;
|
|
15
|
+
batch?: number;
|
|
16
|
+
dimensions: Record<string, unknown>;
|
|
17
|
+
total?: number | null;
|
|
18
|
+
note?: string;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** workflow 跨轮状态(applyCleanRoundBackfill 的 state 形态)。 */
|
|
23
|
+
export interface AgentState {
|
|
24
|
+
issues: Record<string, IssueEntry>;
|
|
25
|
+
knownRemaining: string[];
|
|
26
|
+
scores: ScoreEntry[];
|
|
27
|
+
fixResults?: unknown[];
|
|
28
|
+
dormant?: Array<{ id: string; reason?: string; detail?: string; round?: number; revived?: boolean; [key: string]: unknown }>;
|
|
29
|
+
idMap?: { round?: number; map?: Record<string, string> };
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** issue 记录(issues map 值形态,测试按用例裁剪字段)。 */
|
|
34
|
+
export interface IssueEntry {
|
|
35
|
+
id?: string;
|
|
36
|
+
issue_id?: string;
|
|
37
|
+
title?: string;
|
|
38
|
+
status?: string;
|
|
39
|
+
severity?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
reason?: string;
|
|
42
|
+
fixAttempts?: number;
|
|
43
|
+
openStreak?: number;
|
|
44
|
+
firstSeen?: number;
|
|
45
|
+
history?: Array<{ round?: number; status?: string; [key: string]: unknown }>;
|
|
46
|
+
deferredReason?: string;
|
|
47
|
+
[key: string]: unknown;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export declare function parseBatches(args: Record<string, unknown>, fail: FailFn): string[][];
|
|
51
|
+
export declare function resolveBatchNames(
|
|
52
|
+
rawBatchNames: string[] | undefined,
|
|
53
|
+
batches: string[][],
|
|
54
|
+
fail: FailFn,
|
|
55
|
+
): string[];
|
|
56
|
+
export declare function buildReviewInstruction(targetType: string, target: string): string;
|
|
57
|
+
export declare function lockReviewBase(
|
|
58
|
+
targetType: string,
|
|
59
|
+
target: string,
|
|
60
|
+
run?: (cmd: string) => string,
|
|
61
|
+
): { base: string; hash: string };
|
|
62
|
+
export declare function buildScopedRecheckPrompt(args: {
|
|
63
|
+
header?: string;
|
|
64
|
+
round?: number;
|
|
65
|
+
max?: number;
|
|
66
|
+
roundDir?: string;
|
|
67
|
+
reportFile?: string;
|
|
68
|
+
modifiedFiles?: string[];
|
|
69
|
+
affectedFiles?: string[];
|
|
70
|
+
aggPath?: string;
|
|
71
|
+
fixResult?: Record<string, unknown> | null;
|
|
72
|
+
aggRound?: number;
|
|
73
|
+
fixRound?: number;
|
|
74
|
+
reviewPrompt?: string;
|
|
75
|
+
reviewInstruction?: string;
|
|
76
|
+
}): string;
|
|
77
|
+
export declare function wrapUntrusted(content: string, tag: string): string;
|
|
78
|
+
export declare function buildFixPrompt(args: {
|
|
79
|
+
header?: string;
|
|
80
|
+
reportContent?: string;
|
|
81
|
+
fixPrompt?: string;
|
|
82
|
+
commitInstr?: string;
|
|
83
|
+
caution?: string[];
|
|
84
|
+
guidance?: Array<{ id?: string; guidance?: string; [key: string]: unknown }>;
|
|
85
|
+
}): string;
|
|
86
|
+
export declare function buildAggregatorPrompt(args: {
|
|
87
|
+
header?: string;
|
|
88
|
+
round?: number;
|
|
89
|
+
max?: number;
|
|
90
|
+
roundDir?: string;
|
|
91
|
+
reviewResults?: unknown;
|
|
92
|
+
prevFixResult?: unknown;
|
|
93
|
+
prevTitles?: unknown;
|
|
94
|
+
}): string;
|
|
95
|
+
export declare function resolveReviewReportPath(
|
|
96
|
+
parsed: { report_content?: string; report_file?: string; [key: string]: unknown },
|
|
97
|
+
roundDir: string,
|
|
98
|
+
reportName: string,
|
|
99
|
+
): { reportFile?: string; reportContent: string; [key: string]: unknown };
|
|
100
|
+
export declare function normalizeFixResult(raw: unknown): {
|
|
101
|
+
fixed_count: number;
|
|
102
|
+
fixes: Array<{ issue_id: string; description?: string; [key: string]: unknown }>;
|
|
103
|
+
deferred: Array<{ issue_id: string; reason?: string; severity?: string; [key: string]: unknown }>;
|
|
104
|
+
[key: string]: unknown;
|
|
105
|
+
};
|
|
106
|
+
export declare function normIssueId(s: string | null | undefined): string;
|
|
107
|
+
export declare function findIssueKey(
|
|
108
|
+
issues: Record<string, unknown> | null | undefined,
|
|
109
|
+
issueId: string,
|
|
110
|
+
): string | undefined;
|
|
111
|
+
export declare function hasOpenResidue(issues: Record<string, unknown> | undefined): boolean;
|
|
112
|
+
export declare function normTitle(s: string | undefined): string;
|
|
113
|
+
export declare function matchByTitle(
|
|
114
|
+
title: string,
|
|
115
|
+
issues: Record<string, unknown>,
|
|
116
|
+
dormant: unknown,
|
|
117
|
+
): { kind: string; id?: string; [key: string]: unknown };
|
|
118
|
+
export declare function nextFreeId(existingIds: string[]): string;
|
|
119
|
+
export declare function resolveIssueIdentity(
|
|
120
|
+
entry: { id?: string; title?: string; [key: string]: unknown },
|
|
121
|
+
ctx: { issues: Record<string, unknown>; dormant: unknown[] },
|
|
122
|
+
): { kind: string; id: string; [key: string]: unknown };
|
|
123
|
+
export declare function translateId(
|
|
124
|
+
idMap: Record<string, string> | null | undefined,
|
|
125
|
+
id: string,
|
|
126
|
+
issues: Record<string, unknown>,
|
|
127
|
+
): string;
|
|
128
|
+
export declare function translateReconSets(
|
|
129
|
+
reconSeen: Set<unknown>,
|
|
130
|
+
reconEscalate: Set<unknown>,
|
|
131
|
+
reconFixed: Set<unknown>,
|
|
132
|
+
idMap: Record<string, string>,
|
|
133
|
+
issues: Record<string, unknown>,
|
|
134
|
+
): { seen: Set<string>; escalate: Set<string>; fixed: Set<string> };
|
|
135
|
+
export declare function validateFixResult(
|
|
136
|
+
result: unknown,
|
|
137
|
+
mustFixIds?: string[],
|
|
138
|
+
trackedIssues?: Record<string, unknown>,
|
|
139
|
+
idMap?: Record<string, string>,
|
|
140
|
+
): Array<Record<string, unknown>>;
|
|
141
|
+
export declare function reconcileIssues(
|
|
142
|
+
prevIssues: Record<string, unknown>,
|
|
143
|
+
opts: {
|
|
144
|
+
seenIds: Set<string> | string[];
|
|
145
|
+
escalateIds?: Set<string> | string[];
|
|
146
|
+
fixedIds?: Set<string> | string[];
|
|
147
|
+
round: number;
|
|
148
|
+
stuckThreshold: number;
|
|
149
|
+
},
|
|
150
|
+
): { issues: Record<string, IssueEntry>; stuck: boolean; knownRemaining: string[]; [key: string]: unknown };
|
|
151
|
+
export declare function normalizeReviewResult(raw: unknown): {
|
|
152
|
+
report_file?: string;
|
|
153
|
+
report_content?: string;
|
|
154
|
+
[key: string]: unknown;
|
|
155
|
+
};
|
|
156
|
+
export declare function checkConvergence(opts: {
|
|
157
|
+
prevStreak?: number;
|
|
158
|
+
newFindings?: number;
|
|
159
|
+
newFindingsCritical?: number;
|
|
160
|
+
convergeNewIssues?: number;
|
|
161
|
+
convergeRounds?: number;
|
|
162
|
+
}): { converged: boolean; streak: number; [key: string]: unknown };
|
|
163
|
+
export declare function findNeedsRedesign(
|
|
164
|
+
issues: Record<string, unknown>,
|
|
165
|
+
maxFixAttempts: number,
|
|
166
|
+
): Array<{ issue_id: string; [key: string]: unknown }>;
|
|
167
|
+
export declare function parseResult(raw: unknown): Record<string, unknown>;
|
|
168
|
+
export declare function normalizeAggregatorResult(raw: unknown): {
|
|
169
|
+
must_fix: number;
|
|
170
|
+
suggestion: number;
|
|
171
|
+
must_fix_ids: Array<{ id?: string; issue_id?: string; severity?: string; [key: string]: unknown }>;
|
|
172
|
+
scores?: ScoreEntry[];
|
|
173
|
+
[key: string]: unknown;
|
|
174
|
+
};
|
|
175
|
+
export declare function parseAggregatedMd(content: string): {
|
|
176
|
+
must_fix: number;
|
|
177
|
+
suggestion: number;
|
|
178
|
+
[key: string]: unknown;
|
|
179
|
+
};
|
|
180
|
+
export declare function resolveRunRoot(opts: {
|
|
181
|
+
runId?: string;
|
|
182
|
+
cwd?: string;
|
|
183
|
+
homeDir?: string;
|
|
184
|
+
tmpDir?: string;
|
|
185
|
+
exec?: (cmd: string) => string;
|
|
186
|
+
mkdir?: (p: string) => void;
|
|
187
|
+
}): { root: string; slug: string; degraded: boolean; [key: string]: unknown };
|
|
188
|
+
export declare function computeOrigin(
|
|
189
|
+
entry: { [key: string]: unknown },
|
|
190
|
+
opts: { lastModifiedFiles?: string[]; fixImpactFiles?: string[] },
|
|
191
|
+
): { origin: string; evidence?: unknown; [key: string]: unknown };
|
|
192
|
+
export declare function recordDormant(
|
|
193
|
+
dormant: unknown[],
|
|
194
|
+
entries: unknown[],
|
|
195
|
+
round: number,
|
|
196
|
+
excludeIds?: unknown[] | Set<unknown>,
|
|
197
|
+
): Array<{ id: string; [key: string]: unknown }>;
|
|
198
|
+
export declare function filterActiveIds(
|
|
199
|
+
entries: Array<{ id?: string; adjudication?: string; [key: string]: unknown }>,
|
|
200
|
+
): string[];
|
|
201
|
+
export declare function filterDormantFromRecon(
|
|
202
|
+
reconSeen: Set<string>,
|
|
203
|
+
reconEscalate: Set<string>,
|
|
204
|
+
dormant: Array<{ id?: string; [key: string]: unknown }>,
|
|
205
|
+
): { seen: Set<string>; escalate: Set<string> };
|
|
206
|
+
export declare function landScores(
|
|
207
|
+
existingScores?: ScoreEntry[] | null,
|
|
208
|
+
rawScores?: Array<Record<string, unknown> | null> | null,
|
|
209
|
+
batchIndex?: number,
|
|
210
|
+
): { scores: ScoreEntry[]; landed: number; malformed: number };
|
|
211
|
+
export declare function countMissingFields(entries: unknown[]): {
|
|
212
|
+
active: number;
|
|
213
|
+
missingGuidance: number;
|
|
214
|
+
missingEvidence: number;
|
|
215
|
+
};
|
|
216
|
+
export declare function backfillFixRegression(opts: {
|
|
217
|
+
scores?: ScoreEntry[];
|
|
218
|
+
fixResult?: Record<string, unknown> | null;
|
|
219
|
+
issues?: Record<string, unknown>;
|
|
220
|
+
round?: number;
|
|
221
|
+
batch?: number;
|
|
222
|
+
cleanRound?: boolean;
|
|
223
|
+
mode?: string;
|
|
224
|
+
}): ScoreEntry[];
|
|
225
|
+
export declare function applyCleanRoundBackfill(
|
|
226
|
+
state: Omit<AgentState, "issues"> & { issues: Record<string, unknown> | Record<string, IssueEntry> },
|
|
227
|
+
opts: {
|
|
228
|
+
reconSeen: Set<string> | string[];
|
|
229
|
+
reconEscalate: Set<string> | string[];
|
|
230
|
+
reconFixed?: Set<string> | string[];
|
|
231
|
+
round: number;
|
|
232
|
+
stuckThreshold: number;
|
|
233
|
+
batch?: number;
|
|
234
|
+
},
|
|
235
|
+
): { state: AgentState; stuck: boolean; [key: string]: unknown };
|
|
236
|
+
export declare function resolveAggregatorModel(raw: string | undefined, fallback: string | string | undefined): string;
|
|
237
|
+
export declare function resolveAgentDefs(batchNames: string[]): Array<Record<string, unknown>>;
|
|
238
|
+
export declare function recordAgentClean(
|
|
239
|
+
state: { agentStatus: Record<string, unknown>; fixCount?: number },
|
|
240
|
+
agentName: string,
|
|
241
|
+
batchIndex: number,
|
|
242
|
+
): void;
|
|
243
|
+
export declare function recordAgentDirty(
|
|
244
|
+
state: { agentStatus: Record<string, unknown>; fixCount?: number },
|
|
245
|
+
agentName: string,
|
|
246
|
+
mustFix: number,
|
|
247
|
+
batchIndex: number,
|
|
248
|
+
): void;
|
|
249
|
+
export declare function shouldSkipAgent(status: unknown, fixCount: number, batchIndex: number): boolean;
|
|
250
|
+
export declare function updateStuckState(
|
|
251
|
+
prevMustFix: number,
|
|
252
|
+
stuckCount: number,
|
|
253
|
+
mustFix: number,
|
|
254
|
+
stuckThreshold: number,
|
|
255
|
+
): { prevMustFix: number; stuckCount: number; [key: string]: unknown };
|
|
256
|
+
export declare function resolveBatchTerminated(
|
|
257
|
+
batchClean: boolean,
|
|
258
|
+
terminated: string | undefined,
|
|
259
|
+
): string | undefined;
|
|
260
|
+
|
|
261
|
+
export declare const TARGET_TYPES: string[];
|
|
262
|
+
export declare const VALID_ARG_KEYS: Set<string>;
|
|
263
|
+
export declare const ROUND_CONTEXT_MARKER: string;
|
|
264
|
+
export declare function buildR1ReviewPrompt(args: {
|
|
265
|
+
header?: string;
|
|
266
|
+
roundDir?: string;
|
|
267
|
+
reportFile?: string;
|
|
268
|
+
prevBatchesHint?: string;
|
|
269
|
+
reviewPrompt?: string;
|
|
270
|
+
reviewInstruction?: string;
|
|
271
|
+
}): string;
|
|
272
|
+
export declare function buildR2ReviewPrompt(args: {
|
|
273
|
+
header?: string;
|
|
274
|
+
round?: number;
|
|
275
|
+
max?: number;
|
|
276
|
+
roundDir?: string;
|
|
277
|
+
reportFile?: string;
|
|
278
|
+
aggPath?: string;
|
|
279
|
+
fixResult?: Record<string, unknown> | null;
|
|
280
|
+
aggRound?: number;
|
|
281
|
+
fixRound?: number;
|
|
282
|
+
knownRemaining?: string[];
|
|
283
|
+
dormant?: unknown[];
|
|
284
|
+
openIssues?: unknown[];
|
|
285
|
+
reviewPrompt?: string;
|
|
286
|
+
reviewInstruction?: string;
|
|
287
|
+
}): string;
|