mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
8e7c6e2fb6
Drive the FOR-137 self-learning story as an agent-orchestrated, narrated loop. When an over-limit approval is rejected, the agent offers to record a workflow; the officer demonstrates by filing a policy exception; the agent summarizes and saves the procedure; then it applies that procedure itself to a different over-limit charge. Same-session recall works by echoing the learned procedure back into the thread. page.tsx: three new human-in-the-loop tools (offerWorkflowRecording, recordExceptionDemonstration, saveLearnedWorkflow) plus a transactions agent-readable so the agent resolves a charge the user names to the right id instead of guessing. openPolicyException now returns the new exception id, and the agent-driven exception tools are followUp:true so the recall chain (open then finalize then approve) does not stall. route.ts: TEACH & RECALL prompt rules and an ACTION DISCIPLINE carve-out. The prompt does not restate the unlock procedure, preserving the learning invariant. policy-exception-inline.tsx: surface the demonstrated exception code via onFiled(code). scripts/over-limit-gate-smoke.mjs: regression guard proving only a finalized justifying-code exception lifts the policy-limit gate. Verified end-to-end in OSS dev mode (lint and build green): the demonstration clears the Google Ads charge and recall clears the AWS charge with a single successful approve.