Commit Graph
20 Commits
Author SHA1 Message Date
SikongJueluo 7190bffd86 feat(ai-judge): show dialog advice widget with verdict and focus
- add AdvicePresenter rendering a pi-native setWidget panel while a
  permission dialog is up: judgment verdict with reason, high-risk skip
  with category, or an unavailable cause
- highlight the decision-relevant command fragment via a focus cascade:
  high-risk match, triggering unit, then executed unit
- clear the widget when permissions:decision resolves the same request
- add dialogAdvice config key (default true, invalid falls back with a
  diagnostic) and cover formatting, lifecycle, and config in tests
2026-09-17 23:42:57 +08:00
SikongJueluo c0585a1740 fix(deps): adapt to pi-permission-system 32 session-keyed services
- resolve the permissions service by the live session id in both
  tryRegister paths, so a mid-session republish re-keys via the re-emitted
  permissions:ready channel
- read the session probe instead of the start-time snapshot for inner-cmd
- pass the session key to publish/unpublishPermissionsService in tests and
  drop the removed PromptPermissionDetails.message field
- raise the ai-judge peer floor to @gotgenes/pi-permission-system >=32.0.0
- bump dev deps: pi-coding-agent 0.85.1, vitest 5, typescript 7
2026-09-16 20:57:55 +08:00
SikongJueluo 99e953664d refactor(ai-judge): group src modules into domain directories
- move evidence.ts and conversation.ts into evidence/ as bash.ts and conversation.ts
- move prompt.ts and model.ts into judge/
- move highrisk.ts and judge.ts into authority/, renaming judge.ts to enforce.ts to avoid clashing with the judge/ directory
- move review.ts and audit.ts into telemetry/
- move config.ts and catalog.ts into config/ as judge.ts and catalog.ts
- rewrite static and dynamic imports across src, tools, and tests to the new paths
- fix the models-catalog.json relative URL broken by the move (caught by fallow unresolved-import)
- update the PIEXTENSIO-12 module map in the ADR to the new paths
- add editorconfig for 4-space ts indentation
2026-08-22 01:34:29 +08:00
SikongJueluo c479f51469 refactor(ai-judge): split remaining hotspots and cover CRAP branches
- stage-ify judgeAuthorize into auditEnrollment, runPreflightGates, prepareModelCall, and enforceAndEmit
- extract tallyJoinedRows and tallyAttributable from computeMetrics, removing three dead locals
- extract validateVerdictResponse from requestStructuredVerdict
- extract collectUserTexts and charBudgetStart from buildConversationEvidence
- table-drive corpus-replay parseArgs and split main into resolveReplayModel, selectCorpusCases, and replayCorpus
- split analyzer cli main into loadReviewEvents, withinWindow, loadAuditEnrolled, and printReport with a run-as-script guard
- add 81 tests covering parseEntry, extractBashCommandEvidence, validateVerdictResponse, forcedToolChoice, classifyGit dry-run paths, CLI arg/window/report rendering, and the infra-failure result path
- add @vitest/coverage-istanbul for exact per-function CRAP scoring via fallow health --coverage
2026-08-22 01:24:50 +08:00
SikongJueluo 7987fc7a3c feat(ai-judge): add advisory model catalog and strict corpus replay
- add versioned advisory model catalog shipped with the package and a fail-closed loader
- annotate the enforce session notice for untested, deprecated, and revoked models
- add --strict to corpus-replay with 0/1/2 exit codes and reject strict subset runs
- extract replay qualification into a pure module that recomputes matches and validates latencies
- remove the documented-but-unimplemented --thinking flag and stamp reports with a corpus version
- qualify gpt-5.6-sol as the first recommended entry and archive three real replay reports
- revise the corpus to 2026-08-21.2 changing unclear-forward expected defer to deny
2026-08-21 23:11:40 +08:00
SikongJueluo 061c60c344 feat(ai-judge): rework enforce mode as user-assumed-risk contract
- add config v2 with fixed judge model selection and fail-closed v1 enforce migration to shadow
- add built-in high-risk override for irreversible, publish, system, and credential shapes that always defers to the human
- remove the promotion gate, promotion records tool, and their tests
- fail closed with judge_model_unavailable when a configured judge model cannot be resolved
- notify once per session in enforce mode with the judge model and risk contract
- add ADR 0008 and update README and CONTEXT
2026-08-21 23:11:40 +08:00
SikongJueluo d57892d5ab feat(ai-judge): promotion-gate records seam and truth-table wiring (PIEXTENSIO-21) 2026-08-20 17:45:07 +08:00
SikongJueluo 45e91a700d fix(ai-judge): defer irreversible destructive operations regardless of intent (prompt v4, PIEXTENSIO-20) 2026-08-20 16:25:11 +08:00
SikongJueluo efc73c0f5c feat(ai-judge): prompt v3 few-shot calibration and corpus replay harness (PIEXTENSIO-18) 2026-08-19 23:45:47 +08:00
SikongJueluo 232bad549e feat(ai-judge): judge-owned audit log with local health gate (ADR 0006) 2026-08-19 23:45:43 +08:00
SikongJueluo 0637784f5f feat(ai-judge): conversation evidence with bounded whitelist capture
- add conversation.ts: compaction-aware active-branch capture, user-text-only whitelist, 16-item and 12,000-char bounds with latest-user preservation
- bump prompt to bash-shadow-v2 with explicit-user-intent authority rules and quoted untrusted intent evidence
- capture the requesting cwd and per-ask conversation state; flip evidence-quality flags from placeholders to measured values
- record the candidate-identity change for prior cohorts in the scenario-set doc
2026-08-17 22:25:06 +08:00
SikongJueluo 1d701ca0b0 feat(ai-judge): review sink with telemetry health and fail-closed truth table
- add review.ts sink adapter with session-start review-log toggle detection and a privacy key denylist enforced before delegation
- add judge.ts enforce truth table: allow requires mode, host contract, telemetry health, cohort qualification, owner approval, activation, judgment result, allow verdict, review acknowledgement, and current generation — each independently forces defer with a distinct reason
- route the authorizer callback through the sink and the v0.1 production gate state, which is structurally unreachable and therefore fail-closed
2026-08-17 21:37:48 +08:00
SikongJueluo 3f3bbb4c28 feat(ai-judge): capture model per permission request 2026-08-17 20:00:18 +08:00
SikongJueluo 0546a80497 feat(ai-judge): global config module with validation and cohort identity 2026-08-17 19:53:48 +08:00
SikongJueluo 850f36c7a4 docs(research): archive shadow replay rounds and analyzer round-1 fixes
- rejoin round-1 rows hidden by terminal-event handling: normalize denied_with_reason, collapse forwarded double terminal rows, print quarantine counts, add --before window bound
- archive rounds 1-3 reports with blind-deny protocol, cross-round totals, and PIEXTENSIO-11 latency evidence
2026-08-17 18:59:19 +08:00
SikongJueluo 92cabb6b7c fix(ai-judge): classify provider aborts after timeout as timeout 2026-08-17 16:58:10 +08:00
SikongJueluo 6407b7429a feat(ai-judge): offline shadow analyzer with reconstructed join 2026-08-17 16:58:10 +08:00
SikongJueluo 42f0a0aaab feat(permission): complete shadow review events for offline analysis
- key inner-cmd decisive review events by requestId so link decisions join offline
- record judge runtime id, prompt and tool schema versions, end-to-end and model latency, input and output usage, and evidence-quality flags on every judge result row
- record forwarded and session-mismatch preflight defers so they stay visible in the offline denominator
2026-08-17 16:58:10 +08:00
SikongJueluo f632fa34d1 fix(permission): raise verdict output budget for reasoning tokens 2026-08-16 23:54:58 +08:00
SikongJueluo 1afcbd3118 refactor(permission): consume structured bash payload
- require @gotgenes/pi-permission-system >=25.3.0 and read the complete local bash command from PromptPermissionDetails.payload instead of session-walking recovery
- remove the @sikongjueluo/pi-permission-shared package
- pass the triggering command unit to handlers via HandlerContext.unit in place of details.command
- add shadow-only AI judge modules for evidence projection, structured verdict requests, and prompt building, with vitest coverage
- record ADR 0004 and mark the ADR 0001 recovery mechanism superseded
- exclude pi-permission-system 25.3.0 from the pnpm minimumReleaseAge guard
2026-08-16 23:08:45 +08:00